From: Andrea Bianco Date: Mon, 17 Jan 2022 22:26:31 +0000 (+0100) Subject: Built motion from commit 8aeb62e4.|2.5.48 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22%7B%7Blicense.mail?a=commitdiff_plain;h=becef7c83c2e842d6cdb22f919bd8f56a973654f;p=motion2.git Built motion from commit 8aeb62e4.|2.5.48 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 843d3a1..99ef6cb 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-17T19:31:13.822Z", + "time": "2022-01-17T22:04:49.121Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index df56eb5..4916ecc 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-17T19:31:13.822Z", + "time": "2022-01-17T22:04:49.121Z", "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 132cb94..be72294 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 _0x4757=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','VIRTUAL','action','STRING','contactManager','integration','jscripty','urlForward','browser','bot'];(function(_0x548503,_0x1aa00c){var _0xf8f05f=function(_0x2014c2){while(--_0x2014c2){_0x548503['push'](_0x548503['shift']());}};_0xf8f05f(++_0x1aa00c);}(_0x4757,0x1c2));var _0x7475=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0x4757[_0x867b0a];return _0x137438;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7475('0x0')],'get':function(_0x2cbc93){return this['getDataValue'](_0x7475('0x1'));}},'action':{'type':Sequelize[_0x7475('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7475('0x3'),_0x7475('0x4'),'motionbar',_0x7475('0x5'),_0x7475('0x6'),_0x7475('0x7'),_0x7475('0x8'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x7475('0x9')},'data1':{'type':Sequelize[_0x7475('0x2')](0x1000),'comment':_0x7475('0xa')},'data2':{'type':Sequelize[_0x7475('0x2')](0x1000),'comment':_0x7475('0xb')},'data3':{'type':Sequelize[_0x7475('0x2')](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[_0x7475('0x2')](0x1000),'comments':_0x7475('0xc')},'data5':{'type':Sequelize[_0x7475('0x2')](0x1000),'comments':_0x7475('0xd')},'data6':{'type':Sequelize[_0x7475('0x2')],'comments':_0x7475('0xe')},'data7':{'type':Sequelize[_0x7475('0xf')],'comments':_0x7475('0x10')}}; \ No newline at end of file +var _0xd4ec=['getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0x1660c3,_0x3ea35b){var _0x4709d3=function(_0x453bfe){while(--_0x453bfe){_0x1660c3['push'](_0x1660c3['shift']());}};_0x4709d3(++_0x3ea35b);}(_0xd4ec,0x1eb));var _0xcd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcd4e('0x0'));module[_0xcd4e('0x1')]={'name':{'type':Sequelize[_0xcd4e('0x2')],'get':function(_0x1022c1){return this[_0xcd4e('0x3')](_0xcd4e('0x4'));}},'action':{'type':Sequelize[_0xcd4e('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xcd4e('0x6'),_0xcd4e('0x7'),'motionbar',_0xcd4e('0x8'),_0xcd4e('0x9'),_0xcd4e('0xa'),'bot',_0xcd4e('0xb')]],'msg':_0xcd4e('0xc')}},'comment':_0xcd4e('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xcd4e('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xcd4e('0xe')},'data4':{'type':Sequelize[_0xcd4e('0x5')](0x1000),'comments':_0xcd4e('0xf')},'data5':{'type':Sequelize[_0xcd4e('0x5')](0x1000),'comments':_0xcd4e('0x10')},'data6':{'type':Sequelize[_0xcd4e('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xcd4e('0x11')],'comments':_0xcd4e('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6183a42..4b0eb11 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 _0xef77=['util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','stack','name','send','Action','find','catch','destroy','params','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x25c43c,_0x3a3aa3){var _0x28e108=function(_0x425bfe){while(--_0x425bfe){_0x25c43c['push'](_0x25c43c['shift']());}};_0x28e108(++_0x3a3aa3);}(_0xef77,0x1d0));var _0x7ef7=function(_0x2499b7,_0x6aa2c6){_0x2499b7=_0x2499b7-0x0;var _0x5ba8d4=_0xef77[_0x2499b7];return _0x5ba8d4;};'use strict';var emlformat=require(_0x7ef7('0x0'));var rimraf=require(_0x7ef7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ef7('0x2'));var moment=require(_0x7ef7('0x3'));var BPromise=require(_0x7ef7('0x4'));var Mustache=require(_0x7ef7('0x5'));var util=require(_0x7ef7('0x6'));var path=require(_0x7ef7('0x7'));var sox=require(_0x7ef7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ef7('0x9'));var _=require(_0x7ef7('0xa'));var squel=require(_0x7ef7('0xb'));var crypto=require(_0x7ef7('0xc'));var jsforce=require(_0x7ef7('0xd'));var deskjs=require(_0x7ef7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7ef7('0xf'));var Papa=require(_0x7ef7('0x10'));var Redis=require('ioredis');var authService=require(_0x7ef7('0x11'));var qs=require(_0x7ef7('0x12'));var as=require(_0x7ef7('0x13'));var hardwareService=require(_0x7ef7('0x14'));var logger=require(_0x7ef7('0x15'))(_0x7ef7('0x16'));var utils=require(_0x7ef7('0x17'));var config=require(_0x7ef7('0x18'));var licenseUtil=require(_0x7ef7('0x19'));var db=require(_0x7ef7('0x1a'))['db'];function respondWithStatusCode(_0xd6b780,_0x2a084e){_0x2a084e=_0x2a084e||0xcc;return function(_0x51c50b){if(_0x51c50b){return _0xd6b780[_0x7ef7('0x1b')](_0x2a084e);}return _0xd6b780[_0x7ef7('0x1c')](_0x2a084e)['end']();};}function respondWithResult(_0x5b6fd6,_0x56b480){_0x56b480=_0x56b480||0xc8;return function(_0xc3caa8){if(_0xc3caa8){return _0x5b6fd6[_0x7ef7('0x1c')](_0x56b480)['json'](_0xc3caa8);}};}function respondWithFilteredResult(_0x282bbb,_0x29cd41){return function(_0x1e697f){if(_0x1e697f){var _0x4931b8=typeof _0x29cd41[_0x7ef7('0x1d')]==='undefined'&&typeof _0x29cd41[_0x7ef7('0x1e')]===_0x7ef7('0x1f');var _0x42c471=_0x1e697f[_0x7ef7('0x20')];var _0x4afe1e=_0x4931b8?0x0:_0x29cd41['offset'];var _0x4b0d8d=_0x4931b8?_0x1e697f[_0x7ef7('0x20')]:_0x29cd41['offset']+_0x29cd41[_0x7ef7('0x1e')];var _0x533c19;if(_0x4b0d8d>=_0x42c471){_0x4b0d8d=_0x42c471;_0x533c19=0xc8;}else{_0x533c19=0xce;}_0x282bbb[_0x7ef7('0x1c')](_0x533c19);return _0x282bbb[_0x7ef7('0x21')](_0x7ef7('0x22'),_0x4afe1e+'-'+_0x4b0d8d+'/'+_0x42c471)[_0x7ef7('0x23')](_0x1e697f);}return null;};}function patchUpdates(_0x2a70c4){return function(_0x2a51f7){try{jsonpatch['apply'](_0x2a51f7,_0x2a70c4,!![]);}catch(_0xf4a05){return BPromise[_0x7ef7('0x24')](_0xf4a05);}return _0x2a51f7['save']();};}function saveUpdates(_0x6f3281,_0x427e54){return function(_0x2670c0){if(_0x2670c0){return _0x2670c0[_0x7ef7('0x25')](_0x6f3281)[_0x7ef7('0x26')](function(_0x3597c2){return _0x3597c2;});}return null;};}function removeEntity(_0x1a79cc,_0x4a346f){return function(_0x2c4ee0){if(_0x2c4ee0){return _0x2c4ee0['destroy']()[_0x7ef7('0x26')](function(){_0x1a79cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4233,_0x4a6aa8){return function(_0x55a86a){if(!_0x55a86a){_0x3d4233[_0x7ef7('0x1b')](0x194);}return _0x55a86a;};}function handleError(_0x577517,_0x79047b){_0x79047b=_0x79047b||0x1f4;return function(_0xd4257d){logger['error'](_0xd4257d[_0x7ef7('0x27')]);if(_0xd4257d[_0x7ef7('0x28')]){delete _0xd4257d[_0x7ef7('0x28')];}_0x577517[_0x7ef7('0x1c')](_0x79047b)[_0x7ef7('0x29')](_0xd4257d);};}exports[_0x7ef7('0x25')]=function(_0x540a07,_0x37d6f3){if(_0x540a07['body']['id']){delete _0x540a07['body']['id'];}return db[_0x7ef7('0x2a')][_0x7ef7('0x2b')]({'where':{'id':_0x540a07['params']['id']}})['then'](handleEntityNotFound(_0x37d6f3,null))[_0x7ef7('0x26')](saveUpdates(_0x540a07['body'],null))[_0x7ef7('0x26')](respondWithResult(_0x37d6f3,null))[_0x7ef7('0x2c')](handleError(_0x37d6f3,null));};exports[_0x7ef7('0x2d')]=function(_0x5c194b,_0x3b4329){return db[_0x7ef7('0x2a')]['find']({'where':{'id':_0x5c194b[_0x7ef7('0x2e')]['id']}})[_0x7ef7('0x26')](handleEntityNotFound(_0x3b4329,null))[_0x7ef7('0x26')](removeEntity(_0x3b4329,null))[_0x7ef7('0x2c')](handleError(_0x3b4329,null));}; \ No newline at end of file +var _0x1a57=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','sendStatus','error','stack','name','body','Action','find','params','destroy','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x10d619,_0x5da8f6){var _0x54cb7f=function(_0x5388db){while(--_0x5388db){_0x10d619['push'](_0x10d619['shift']());}};_0x54cb7f(++_0x5da8f6);}(_0x1a57,0x186));var _0x71a5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1a57[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71a5('0x0'));var zipdir=require(_0x71a5('0x1'));var jsonpatch=require(_0x71a5('0x2'));var rp=require(_0x71a5('0x3'));var moment=require(_0x71a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x71a5('0x5'));var util=require(_0x71a5('0x6'));var path=require(_0x71a5('0x7'));var sox=require(_0x71a5('0x8'));var csv=require(_0x71a5('0x9'));var ejs=require(_0x71a5('0xa'));var fs=require('fs');var fs_extra=require(_0x71a5('0xb'));var _=require('lodash');var squel=require(_0x71a5('0xc'));var crypto=require(_0x71a5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x71a5('0xe'));var toCsv=require(_0x71a5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x71a5('0x10'));var as=require(_0x71a5('0x11'));var hardwareService=require(_0x71a5('0x12'));var logger=require(_0x71a5('0x13'))(_0x71a5('0x14'));var utils=require(_0x71a5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x71a5('0x16'));var db=require(_0x71a5('0x17'))['db'];function respondWithStatusCode(_0x4d6b90,_0x3fa483){_0x3fa483=_0x3fa483||0xcc;return function(_0x22f236){if(_0x22f236){return _0x4d6b90['sendStatus'](_0x3fa483);}return _0x4d6b90[_0x71a5('0x18')](_0x3fa483)[_0x71a5('0x19')]();};}function respondWithResult(_0xc3af1c,_0x282f57){_0x282f57=_0x282f57||0xc8;return function(_0x448b05){if(_0x448b05){return _0xc3af1c['status'](_0x282f57)[_0x71a5('0x1a')](_0x448b05);}};}function respondWithFilteredResult(_0x42f72d,_0x33ddb7){return function(_0x27bd28){if(_0x27bd28){var _0x1b9013=typeof _0x33ddb7['offset']===_0x71a5('0x1b')&&typeof _0x33ddb7[_0x71a5('0x1c')]==='undefined';var _0x2e2488=_0x27bd28[_0x71a5('0x1d')];var _0x518a21=_0x1b9013?0x0:_0x33ddb7[_0x71a5('0x1e')];var _0x3758b0=_0x1b9013?_0x27bd28[_0x71a5('0x1d')]:_0x33ddb7[_0x71a5('0x1e')]+_0x33ddb7[_0x71a5('0x1c')];var _0x5bdbbf;if(_0x3758b0>=_0x2e2488){_0x3758b0=_0x2e2488;_0x5bdbbf=0xc8;}else{_0x5bdbbf=0xce;}_0x42f72d[_0x71a5('0x18')](_0x5bdbbf);return _0x42f72d[_0x71a5('0x1f')](_0x71a5('0x20'),_0x518a21+'-'+_0x3758b0+'/'+_0x2e2488)['json'](_0x27bd28);}return null;};}function patchUpdates(_0xe1737d){return function(_0x295eb1){try{jsonpatch['apply'](_0x295eb1,_0xe1737d,!![]);}catch(_0x4e253b){return BPromise['reject'](_0x4e253b);}return _0x295eb1['save']();};}function saveUpdates(_0x2f0205,_0x5216d2){return function(_0x36103a){if(_0x36103a){return _0x36103a[_0x71a5('0x21')](_0x2f0205)[_0x71a5('0x22')](function(_0x1d6969){return _0x1d6969;});}return null;};}function removeEntity(_0x532c44,_0x368d28){return function(_0xd9e0f3){if(_0xd9e0f3){return _0xd9e0f3['destroy']()[_0x71a5('0x22')](function(){_0x532c44[_0x71a5('0x18')](0xcc)[_0x71a5('0x19')]();});}};}function handleEntityNotFound(_0x1d3085,_0x2732ba){return function(_0x4324a7){if(!_0x4324a7){_0x1d3085[_0x71a5('0x23')](0x194);}return _0x4324a7;};}function handleError(_0x52fd53,_0x562cbe){_0x562cbe=_0x562cbe||0x1f4;return function(_0x2ba906){logger[_0x71a5('0x24')](_0x2ba906[_0x71a5('0x25')]);if(_0x2ba906[_0x71a5('0x26')]){delete _0x2ba906[_0x71a5('0x26')];}_0x52fd53[_0x71a5('0x18')](_0x562cbe)['send'](_0x2ba906);};}exports[_0x71a5('0x21')]=function(_0x3a648b,_0x49e565){if(_0x3a648b[_0x71a5('0x27')]['id']){delete _0x3a648b[_0x71a5('0x27')]['id'];}return db[_0x71a5('0x28')][_0x71a5('0x29')]({'where':{'id':_0x3a648b[_0x71a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x49e565,null))['then'](saveUpdates(_0x3a648b[_0x71a5('0x27')],null))[_0x71a5('0x22')](respondWithResult(_0x49e565,null))['catch'](handleError(_0x49e565,null));};exports[_0x71a5('0x2b')]=function(_0x4acdb9,_0x35bf08){return db[_0x71a5('0x28')][_0x71a5('0x29')]({'where':{'id':_0x4acdb9['params']['id']}})['then'](handleEntityNotFound(_0x35bf08,null))[_0x71a5('0x22')](removeEntity(_0x35bf08,null))[_0x71a5('0x2c')](handleError(_0x35bf08,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index db417f7..85706f4 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 _0xf47b=['tools_actions','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','Action'];(function(_0x56d3a2,_0x5f191b){var _0x2c14d0=function(_0xb776e2){while(--_0xb776e2){_0x56d3a2['push'](_0x56d3a2['shift']());}};_0x2c14d0(++_0x5f191b);}(_0xf47b,0x15d));var _0xbf47=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf47b[_0x432682];return _0x463d05;};'use strict';var _=require(_0xbf47('0x0'));var util=require(_0xbf47('0x1'));var logger=require(_0xbf47('0x2'))('api');var moment=require(_0xbf47('0x3'));var BPromise=require(_0xbf47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf47('0x5'));var rimraf=require(_0xbf47('0x6'));var config=require(_0xbf47('0x7'));var attributes=require('./action.attributes');module[_0xbf47('0x8')]=function(_0x13a5dc,_0x50cae8){return _0x13a5dc[_0xbf47('0x9')](_0xbf47('0xa'),attributes,{'tableName':_0xbf47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4442=['exports','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5c058a,_0x266884){var _0x419fa7=function(_0x5892ed){while(--_0x5892ed){_0x5c058a['push'](_0x5c058a['shift']());}};_0x419fa7(++_0x266884);}(_0x4442,0x1cb));var _0x2444=function(_0x408035,_0x202850){_0x408035=_0x408035-0x0;var _0x192cd5=_0x4442[_0x408035];return _0x192cd5;};'use strict';var _=require(_0x2444('0x0'));var util=require(_0x2444('0x1'));var logger=require(_0x2444('0x2'))(_0x2444('0x3'));var moment=require(_0x2444('0x4'));var BPromise=require(_0x2444('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2444('0x6'));var rimraf=require(_0x2444('0x7'));var config=require(_0x2444('0x8'));var attributes=require('./action.attributes');module[_0x2444('0x9')]=function(_0x3e5562,_0x390677){return _0x3e5562[_0x2444('0xa')]('Action',attributes,{'tableName':_0x2444('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 8e74af3..397bf01 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x42d824,_0x1ab5e4){var _0x5a47a5=function(_0x50a03f){while(--_0x50a03f){_0x42d824['push'](_0x42d824['shift']());}};_0x5a47a5(++_0x1ab5e4);}(_0xe14b,0x93));var _0xbe14=function(_0x49c0ed,_0x45c426){_0x49c0ed=_0x49c0ed-0x0;var _0x7d8b63=_0xe14b[_0x49c0ed];return _0x7d8b63;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x814b,0x1a2));var _0xb814=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0x814b[_0x407461];return _0x2b3ffa;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e361d14..127ddd3 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 _0x811d=['./action.controller','put','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0x811d,0x1b2));var _0xd811=function(_0x3852fd,_0x5b321f){_0x3852fd=_0x3852fd-0x0;var _0x186388=_0x811d[_0x3852fd];return _0x186388;};'use strict';var multer=require(_0xd811('0x0'));var util=require(_0xd811('0x1'));var path=require(_0xd811('0x2'));var timeout=require(_0xd811('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd811('0x4'));var auth=require(_0xd811('0x5'));var interaction=require(_0xd811('0x6'));var config=require(_0xd811('0x7'));var controller=require(_0xd811('0x8'));router[_0xd811('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd811('0xa')](_0xd811('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd811('0xc')]=router; \ No newline at end of file +var _0x8c37=['../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4571a3,_0x29eb8b){var _0x1ba007=function(_0x2e0a45){while(--_0x2e0a45){_0x4571a3['push'](_0x4571a3['shift']());}};_0x1ba007(++_0x29eb8b);}(_0x8c37,0x157));var _0x78c3=function(_0xa3764c,_0x56490d){_0xa3764c=_0xa3764c-0x0;var _0x141301=_0x8c37[_0xa3764c];return _0x141301;};'use strict';var multer=require(_0x78c3('0x0'));var util=require(_0x78c3('0x1'));var path=require('path');var timeout=require(_0x78c3('0x2'));var express=require(_0x78c3('0x3'));var router=express[_0x78c3('0x4')]();var fs_extra=require(_0x78c3('0x5'));var auth=require(_0x78c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x78c3('0x7'));var controller=require(_0x78c3('0x8'));router[_0x78c3('0x9')](_0x78c3('0xa'),auth[_0x78c3('0xb')](),controller['update']);router[_0x78c3('0xc')](_0x78c3('0xa'),auth[_0x78c3('0xb')](),controller['destroy']);module[_0x78c3('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3634263..39697db 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7da7,0x10d));var _0x77da=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x7da7[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x1e2a97,_0x156023){var _0xd6dcf0=function(_0x50fea0){while(--_0x50fea0){_0x1e2a97['push'](_0x1e2a97['shift']());}};_0xd6dcf0(++_0x156023);}(_0xac9d,0x14d));var _0xdac9=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xac9d[_0x412342];return _0x3e62cb;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7039de5..fd45553 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 _0xfb4b=['to-csv','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','dbH','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','key','model','query','filters','intersection','attributes','length','nolimit','order','pick','where','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','fields','include','find','create','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','orderBy','DESC','alias','joins','parse','type','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','toString','sequelize','SELECT','join','left_join','cross_join','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','IS\x20EMPTY','metric','groupBy','foreignTable','output','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../files/reports','savename','countTable','QueryTypes','runReport','ROUND(%s)','Sequelize','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x352026,_0x2c8ec4){var _0x13ab75=function(_0x2dac17){while(--_0x2dac17){_0x352026['push'](_0x352026['shift']());}};_0x13ab75(++_0x2c8ec4);}(_0xfb4b,0x1d6));var _0xbfb4=function(_0x32c486,_0xa77c16){_0x32c486=_0x32c486-0x0;var _0x394cb4=_0xfb4b[_0x32c486];return _0x394cb4;};'use strict';var emlformat=require(_0xbfb4('0x0'));var rimraf=require(_0xbfb4('0x1'));var zipdir=require(_0xbfb4('0x2'));var jsonpatch=require(_0xbfb4('0x3'));var rp=require(_0xbfb4('0x4'));var moment=require(_0xbfb4('0x5'));var BPromise=require(_0xbfb4('0x6'));var Mustache=require('mustache');var util=require(_0xbfb4('0x7'));var path=require(_0xbfb4('0x8'));var sox=require(_0xbfb4('0x9'));var csv=require(_0xbfb4('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(_0xbfb4('0xb'));var jsforce=require(_0xbfb4('0xc'));var deskjs=require(_0xbfb4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbfb4('0xe'));var Papa=require(_0xbfb4('0xf'));var Redis=require(_0xbfb4('0x10'));var authService=require(_0xbfb4('0x11'));var qs=require(_0xbfb4('0x12'));var as=require(_0xbfb4('0x13'));var hardwareService=require(_0xbfb4('0x14'));var logger=require('../../config/logger')(_0xbfb4('0x15'));var utils=require(_0xbfb4('0x16'));var config=require(_0xbfb4('0x17'));var licenseUtil=require(_0xbfb4('0x18'));var db=require(_0xbfb4('0x19'))['db'];var dbH=require(_0xbfb4('0x19'))[_0xbfb4('0x1a')];function respondWithStatusCode(_0x22f6d8,_0xe05b98){_0xe05b98=_0xe05b98||0xcc;return function(_0x227ec9){if(_0x227ec9){return _0x22f6d8['sendStatus'](_0xe05b98);}return _0x22f6d8[_0xbfb4('0x1b')](_0xe05b98)[_0xbfb4('0x1c')]();};}function respondWithResult(_0x2ad597,_0x1937ff){_0x1937ff=_0x1937ff||0xc8;return function(_0x2f358d){if(_0x2f358d){return _0x2ad597[_0xbfb4('0x1b')](_0x1937ff)['json'](_0x2f358d);}};}function respondWithFilteredResult(_0x2764c7,_0x3eb341){return function(_0xe1054d){if(_0xe1054d){var _0x415b74=typeof _0x3eb341['offset']===_0xbfb4('0x1d')&&typeof _0x3eb341[_0xbfb4('0x1e')]===_0xbfb4('0x1d');var _0x2a9767=_0xe1054d[_0xbfb4('0x1f')];var _0x57f5a4=_0x415b74?0x0:_0x3eb341['offset'];var _0x541434=_0x415b74?_0xe1054d['count']:_0x3eb341[_0xbfb4('0x20')]+_0x3eb341['limit'];var _0x4f4b8f;if(_0x541434>=_0x2a9767){_0x541434=_0x2a9767;_0x4f4b8f=0xc8;}else{_0x4f4b8f=0xce;}_0x2764c7[_0xbfb4('0x1b')](_0x4f4b8f);return _0x2764c7[_0xbfb4('0x21')](_0xbfb4('0x22'),_0x57f5a4+'-'+_0x541434+'/'+_0x2a9767)['json'](_0xe1054d);}return null;};}function patchUpdates(_0x571c65){return function(_0x5f0a22){try{jsonpatch[_0xbfb4('0x23')](_0x5f0a22,_0x571c65,!![]);}catch(_0x37db32){return BPromise[_0xbfb4('0x24')](_0x37db32);}return _0x5f0a22['save']();};}function saveUpdates(_0x528781,_0x52c7b2){return function(_0x58a9cb){if(_0x58a9cb){return _0x58a9cb[_0xbfb4('0x25')](_0x528781)[_0xbfb4('0x26')](function(_0x2e170b){return _0x2e170b;});}return null;};}function removeEntity(_0x3bd69d,_0x7f53e3){return function(_0x5c7c75){if(_0x5c7c75){return _0x5c7c75[_0xbfb4('0x27')]()[_0xbfb4('0x26')](function(){var _0x1ae53a=_0x5c7c75[_0xbfb4('0x28')]({'plain':!![]});var _0x54880a=_0xbfb4('0x29');return db[_0xbfb4('0x2a')]['destroy']({'where':{'type':_0x54880a,'resourceId':_0x1ae53a['id']}})['then'](function(){return _0x5c7c75;});})[_0xbfb4('0x26')](function(){_0x3bd69d[_0xbfb4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbfec,_0x21300c){return function(_0x552660){if(!_0x552660){_0x3cbfec[_0xbfb4('0x2b')](0x194);}return _0x552660;};}function handleError(_0x2b771a,_0x1a914c){_0x1a914c=_0x1a914c||0x1f4;return function(_0x3ded24){logger['error'](_0x3ded24[_0xbfb4('0x2c')]);if(_0x3ded24[_0xbfb4('0x2d')]){delete _0x3ded24['name'];}_0x2b771a[_0xbfb4('0x1b')](_0x1a914c)[_0xbfb4('0x2e')](_0x3ded24);};}exports[_0xbfb4('0x2f')]=function(_0x1237cd,_0x301a27){var _0x2f0720={},_0x4e97c3={},_0x36d264={'count':0x0,'rows':[]};var _0x4c545c=_[_0xbfb4('0x30')](db[_0xbfb4('0x31')][_0xbfb4('0x32')],function(_0x5d4e63){return{'name':_0x5d4e63['fieldName'],'type':_0x5d4e63['type'][_0xbfb4('0x33')]};});_0x4e97c3[_0xbfb4('0x34')]=_['map'](_0x4c545c,'name');_0x4e97c3[_0xbfb4('0x35')]=_['keys'](_0x1237cd[_0xbfb4('0x35')]);_0x4e97c3[_0xbfb4('0x36')]=_['intersection'](_0x4e97c3['model'],_0x4e97c3[_0xbfb4('0x35')]);_0x2f0720['attributes']=_[_0xbfb4('0x37')](_0x4e97c3[_0xbfb4('0x34')],qs['fields'](_0x1237cd[_0xbfb4('0x35')]['fields']));_0x2f0720[_0xbfb4('0x38')]=_0x2f0720[_0xbfb4('0x38')][_0xbfb4('0x39')]?_0x2f0720[_0xbfb4('0x38')]:_0x4e97c3[_0xbfb4('0x34')];if(!_0x1237cd[_0xbfb4('0x35')]['hasOwnProperty'](_0xbfb4('0x3a'))){_0x2f0720[_0xbfb4('0x1e')]=qs[_0xbfb4('0x1e')](_0x1237cd[_0xbfb4('0x35')][_0xbfb4('0x1e')]);_0x2f0720['offset']=qs['offset'](_0x1237cd[_0xbfb4('0x35')][_0xbfb4('0x20')]);}_0x2f0720[_0xbfb4('0x3b')]=qs['sort'](_0x1237cd[_0xbfb4('0x35')]['sort']);_0x2f0720['where']=qs['filters'](_[_0xbfb4('0x3c')](_0x1237cd['query'],_0x4e97c3[_0xbfb4('0x36')]),_0x4c545c);if(_0x1237cd['query']['filter']){_0x2f0720[_0xbfb4('0x3d')]=_['merge'](_0x2f0720[_0xbfb4('0x3d')],{'$or':_[_0xbfb4('0x30')](_0x4c545c,function(_0x9c522b){if(_0x9c522b['type']!==_0xbfb4('0x3e')){var _0x372722={};_0x372722[_0x9c522b[_0xbfb4('0x2d')]]={'$like':'%'+_0x1237cd[_0xbfb4('0x35')]['filter']+'%'};return _0x372722;}})});}_0x2f0720=_[_0xbfb4('0x3f')]({},_0x2f0720,_0x1237cd[_0xbfb4('0x40')]);var _0x54e585={'where':_0x2f0720['where']};return db[_0xbfb4('0x31')]['count'](_0x54e585)[_0xbfb4('0x26')](function(_0x45afc5){_0x36d264[_0xbfb4('0x1f')]=_0x45afc5;if(_0x1237cd[_0xbfb4('0x35')][_0xbfb4('0x41')]){_0x2f0720['include']=[{'all':!![]}];}return db[_0xbfb4('0x31')][_0xbfb4('0x42')](_0x2f0720);})[_0xbfb4('0x26')](function(_0x1e1832){_0x36d264['rows']=_0x1e1832;return _0x36d264;})[_0xbfb4('0x26')](respondWithFilteredResult(_0x301a27,_0x2f0720))[_0xbfb4('0x43')](handleError(_0x301a27,null));};exports[_0xbfb4('0x44')]=function(_0x3ffcda,_0x457ea4){var _0x595d5f={'raw':![],'where':{'id':_0x3ffcda[_0xbfb4('0x45')]['id']}},_0x586386={};_0x586386[_0xbfb4('0x34')]=_[_0xbfb4('0x46')](db[_0xbfb4('0x31')]['rawAttributes']);_0x586386['query']=_['keys'](_0x3ffcda[_0xbfb4('0x35')]);_0x586386[_0xbfb4('0x36')]=_['intersection'](_0x586386['model'],_0x586386[_0xbfb4('0x35')]);_0x595d5f['attributes']=_[_0xbfb4('0x37')](_0x586386['model'],qs['fields'](_0x3ffcda[_0xbfb4('0x35')][_0xbfb4('0x47')]));_0x595d5f[_0xbfb4('0x38')]=_0x595d5f['attributes'][_0xbfb4('0x39')]?_0x595d5f[_0xbfb4('0x38')]:_0x586386[_0xbfb4('0x34')];if(_0x3ffcda['query'][_0xbfb4('0x41')]){_0x595d5f[_0xbfb4('0x48')]=[{'all':!![]}];}_0x595d5f=_[_0xbfb4('0x3f')]({},_0x595d5f,_0x3ffcda[_0xbfb4('0x40')]);return db[_0xbfb4('0x31')][_0xbfb4('0x49')](_0x595d5f)['then'](handleEntityNotFound(_0x457ea4,null))[_0xbfb4('0x26')](respondWithResult(_0x457ea4,null))[_0xbfb4('0x43')](handleError(_0x457ea4,null));};exports[_0xbfb4('0x4a')]=function(_0x4cf0af,_0x1525df){return db[_0xbfb4('0x31')][_0xbfb4('0x4a')](_0x4cf0af['body'],{})[_0xbfb4('0x26')](function(_0x496b4c){var _0x58f2fc=_0x4cf0af[_0xbfb4('0x4b')][_0xbfb4('0x28')]({'plain':!![]});if(!_0x58f2fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58f2fc[_0xbfb4('0x4c')]==='user'){var _0x1f542e=_0x496b4c['get']({'plain':!![]});var _0x523895='Reports';return db[_0xbfb4('0x4d')][_0xbfb4('0x49')]({'where':{'name':_0x523895,'userProfileId':_0x58f2fc[_0xbfb4('0x4e')]},'raw':!![]})['then'](function(_0x4e18ee){if(_0x4e18ee&&_0x4e18ee['autoAssociation']===0x0){return db[_0xbfb4('0x2a')]['create']({'name':_0x1f542e[_0xbfb4('0x2d')],'resourceId':_0x1f542e['id'],'type':_0xbfb4('0x29'),'sectionId':_0x4e18ee['id']},{})['then'](function(){return _0x496b4c;});}else{return _0x496b4c;}})[_0xbfb4('0x43')](function(_0x2e7c38){logger[_0xbfb4('0x4f')](_0xbfb4('0x50'),_0x2e7c38);throw _0x2e7c38;});}return _0x496b4c;})[_0xbfb4('0x26')](respondWithResult(_0x1525df,0xc9))[_0xbfb4('0x43')](handleError(_0x1525df,null));};exports[_0xbfb4('0x25')]=function(_0x4c616d,_0x2dfc15){if(_0x4c616d[_0xbfb4('0x51')]['id']){delete _0x4c616d['body']['id'];}return db[_0xbfb4('0x31')][_0xbfb4('0x49')]({'where':{'id':_0x4c616d[_0xbfb4('0x45')]['id']}})['then'](handleEntityNotFound(_0x2dfc15,null))[_0xbfb4('0x26')](saveUpdates(_0x4c616d[_0xbfb4('0x51')],null))[_0xbfb4('0x26')](respondWithResult(_0x2dfc15,null))['catch'](handleError(_0x2dfc15,null));};exports['destroy']=function(_0x5bf479,_0x102275){return db[_0xbfb4('0x31')][_0xbfb4('0x49')]({'where':{'id':_0x5bf479[_0xbfb4('0x45')]['id']}})[_0xbfb4('0x26')](handleEntityNotFound(_0x102275,null))[_0xbfb4('0x26')](removeEntity(_0x102275,null))['catch'](handleError(_0x102275,null));};exports[_0xbfb4('0x52')]=function(_0x1c1e4c,_0x594628){var _0x37f14f=0xa;var _0x255080=['join','left_join',_0xbfb4('0x53'),'cross_join'];var _0x3a5411={'SUM':'SUM(%s)','COUNT':_0xbfb4('0x54'),'COUNT DISTINCT':_0xbfb4('0x55'),'MAX':_0xbfb4('0x56'),'MIN':_0xbfb4('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbfb4('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x158025={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbfb4('0x59'),'HOUR':_0xbfb4('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfb4('0x5b')};var _0x4dc1dd=function(_0x3cd278){return!_[_0xbfb4('0x5c')]([_0xbfb4('0x5d'),_0xbfb4('0x5e'),'IS\x20EMPTY',_0xbfb4('0x5f')],_0x3cd278);};var _0x1867bf=function(_0x294424){if(!_0x294424||!_0x294424[_0xbfb4('0x60')][_0xbfb4('0x39')]){return'';}for(var _0x3b110c='(',_0x101cec=0x0;_0x101cec<_0x294424[_0xbfb4('0x60')]['length'];_0x101cec+=0x1){_0x101cec>0x0&&(_0x3b110c+='\x20'+_0x294424[_0xbfb4('0x61')]+'\x20');_0x3b110c+=_0x294424[_0xbfb4('0x60')][_0x101cec][_0xbfb4('0x62')]?_0x1867bf(_0x294424[_0xbfb4('0x60')][_0x101cec][_0xbfb4('0x62')]):_0x294424[_0xbfb4('0x60')][_0x101cec][_0xbfb4('0x63')]+'\x20'+_0x294424['rules'][_0x101cec]['condition']+(_0x4dc1dd(_0x294424[_0xbfb4('0x60')][_0x101cec][_0xbfb4('0x64')])?'\x20'+_0x294424[_0xbfb4('0x60')][_0x101cec]['value']:'');}return _0x3b110c+')';};var _0x48f6c5={'where':{'id':_0x1c1e4c[_0xbfb4('0x45')]['id']}},_0x28ec5e,_0x291e86,_0x1e4815,_0xeb2b37,_0x2108f9;_0x48f6c5=_[_0xbfb4('0x3f')]({},_0x48f6c5,_0x1c1e4c[_0xbfb4('0x40')]);return db[_0xbfb4('0x31')][_0xbfb4('0x49')](_0x48f6c5)[_0xbfb4('0x26')](function(_0x3fec08){if(_0x3fec08){_0x28ec5e=_0x3fec08;return _0x3fec08[_0xbfb4('0x65')]();}return null;})[_0xbfb4('0x26')](function(_0x57ca88){if(_0x57ca88){if(!_0x57ca88[_0xbfb4('0x39')]){throw new db['Sequelize'][(_0xbfb4('0x66'))](_0xbfb4('0x67'),0x193);}_0x291e86=_0x57ca88;return db[_0xbfb4('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x475612){if(_0x475612){_0x1e4815=_[_0xbfb4('0x69')](_0x475612,'id');var _0x3139b4;var _0x53321c=squel[_0xbfb4('0x6a')]();_0x53321c[_0xbfb4('0x6b')](_0x28ec5e['table']);for(var _0xa0be76=0x0;_0xa0be76<_0x291e86[_0xbfb4('0x39')];_0xa0be76+=0x1){_0x3139b4=_0x291e86[_0xa0be76][_0xbfb4('0x6c')]?_0x1e4815[_0x291e86[_0xa0be76]['MetricId']]['metric']:_0x291e86[_0xa0be76][_0xbfb4('0x63')];_0x3139b4=_0x291e86[_0xa0be76][_0xbfb4('0x6d')]?_[_0xbfb4('0x6e')](_0x3a5411[_0x291e86[_0xa0be76][_0xbfb4('0x6d')]],'%s',_0x3139b4):_0x3139b4;_0x3139b4=_0x291e86[_0xa0be76]['format']?_[_0xbfb4('0x6e')](_0x158025[_0x291e86[_0xa0be76][_0xbfb4('0x6f')]],'%s',_0x3139b4):_0x3139b4;if(_0x291e86[_0xa0be76]['groupBy']){_0x53321c[_0xbfb4('0x62')](_0x3139b4);}_0x291e86[_0xa0be76][_0xbfb4('0x70')]&&_0x53321c[_0xbfb4('0x3b')](_0x3139b4,_0x291e86[_0xa0be76][_0xbfb4('0x70')]===_0xbfb4('0x71')?![]:!![]);_0x53321c['field'](_0x3139b4,_0x291e86[_0xa0be76][_0xbfb4('0x72')]||_0x3139b4);}if(_0x28ec5e[_0xbfb4('0x73')]){_0x28ec5e['joins']=JSON[_0xbfb4('0x74')](_0x28ec5e[_0xbfb4('0x73')]);for(var _0x4b2a16=0x0;_0x4b2a16<_0x28ec5e[_0xbfb4('0x73')][_0xbfb4('0x39')];_0x4b2a16+=0x1){if(_0x28ec5e['joins'][_0x4b2a16]['type']&&_[_0xbfb4('0x5c')](_0x255080,_0x28ec5e[_0xbfb4('0x73')][_0x4b2a16][_0xbfb4('0x75')])&&_0x28ec5e[_0xbfb4('0x73')][_0x4b2a16][_0xbfb4('0x76')]&&_0x28ec5e[_0xbfb4('0x73')][_0x4b2a16]['foreignTable']&&_0x28ec5e[_0xbfb4('0x73')][_0x4b2a16][_0xbfb4('0x77')]){_0x53321c[_0x28ec5e['joins'][_0x4b2a16][_0xbfb4('0x75')]](_0x28ec5e['joins'][_0x4b2a16]['foreignTable'],null,util[_0xbfb4('0x6f')](_0xbfb4('0x78'),_0x28ec5e[_0xbfb4('0x79')],_0x28ec5e['joins'][_0x4b2a16][_0xbfb4('0x76')],_0x28ec5e[_0xbfb4('0x73')][_0x4b2a16]['foreignTable'],_0x28ec5e[_0xbfb4('0x73')][_0x4b2a16]['foreignKey']));}}}if(_0x28ec5e[_0xbfb4('0x7a')]){_0x28ec5e[_0xbfb4('0x7a')]=JSON[_0xbfb4('0x74')](_0x28ec5e['conditions']);_0x53321c[_0xbfb4('0x3d')](_0x1867bf(_0x28ec5e[_0xbfb4('0x7a')][_0xbfb4('0x62')]));}_0x2108f9=_0x53321c[_0xbfb4('0x7b')]();_0x53321c[_0xbfb4('0x1e')](_0x37f14f);_0x53321c[_0xbfb4('0x20')](0x0);logger[_0xbfb4('0x7c')]('Limited\x20Query:',_0x53321c[_0xbfb4('0x7d')]());return dbH[_0xbfb4('0x7e')][_0xbfb4('0x35')](_0x53321c['toString'](),{'type':dbH[_0xbfb4('0x7e')]['QueryTypes'][_0xbfb4('0x7f')]});}})['then'](respondWithResult(_0x594628,null))[_0xbfb4('0x43')](handleError(_0x594628,null));};function runReport(_0x3fc96e,_0x247657,_0x25b295){var _0x5e5085=_0x247657['name'];var _0x48c6cc=0xa;var _0x90cd27=[_0xbfb4('0x80'),_0xbfb4('0x81'),_0xbfb4('0x53'),_0xbfb4('0x82')];var _0x5849d3={'SUM':_0xbfb4('0x83'),'COUNT':_0xbfb4('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xbfb4('0x57'),'AVG':_0xbfb4('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbfb4('0x85'),'GROUP_CONCAT DESC':_0xbfb4('0x86')};var _0x1bb27a={'SEC_TO_TIME':_0xbfb4('0x87'),'DATE':_0xbfb4('0x59'),'HOUR':_0xbfb4('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfb4('0x5b')};var _0x136ea8=function(_0x408b8b){return!_[_0xbfb4('0x5c')]([_0xbfb4('0x5d'),'IS\x20NOT\x20NULL',_0xbfb4('0x88'),_0xbfb4('0x5f')],_0x408b8b);};var _0x11cbb5=function(_0x2bc737){if(!_0x2bc737||!_0x2bc737[_0xbfb4('0x60')]['length']){return'';}for(var _0x2a7c03='(',_0x598c93=0x0;_0x598c93<_0x2bc737['rules'][_0xbfb4('0x39')];_0x598c93+=0x1){_0x598c93>0x0&&(_0x2a7c03+='\x20'+_0x2bc737['operator']+'\x20');_0x2a7c03+=_0x2bc737[_0xbfb4('0x60')][_0x598c93][_0xbfb4('0x62')]?_0x11cbb5(_0x2bc737[_0xbfb4('0x60')][_0x598c93][_0xbfb4('0x62')]):_0x2bc737[_0xbfb4('0x60')][_0x598c93][_0xbfb4('0x63')]+'\x20'+_0x2bc737['rules'][_0x598c93][_0xbfb4('0x64')]+(_0x136ea8(_0x2bc737[_0xbfb4('0x60')][_0x598c93][_0xbfb4('0x64')])?'\x20'+_0x2bc737['rules'][_0x598c93]['value']:'');}return _0x2a7c03+')';};var _0x54e15c={'where':{'id':_0x3fc96e['id']}},_0x4191f7,_0x4a63f6,_0x4d0a4d,_0x589c3f,_0x369e42;_0x54e15c=_[_0xbfb4('0x3f')]({},_0x54e15c,_0x25b295);return db[_0xbfb4('0x31')][_0xbfb4('0x49')](_0x54e15c)['then'](function(_0xf92b18){if(_0xf92b18){_0x4191f7=_0xf92b18;return _0xf92b18[_0xbfb4('0x65')]();}return null;})[_0xbfb4('0x26')](function(_0x38aa74){if(_0x38aa74){if(!_0x38aa74['length']){throw new db['Sequelize'][(_0xbfb4('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4a63f6=_0x38aa74;return db[_0xbfb4('0x68')][_0xbfb4('0x42')]({'raw':!![]});}return null;})['then'](function(_0x28faf9){if(_0x28faf9){_0x4d0a4d=_[_0xbfb4('0x69')](_0x28faf9,'id');var _0x26cf7c;var _0x337cb4=squel['select']();_0x337cb4[_0xbfb4('0x6b')](_0x4191f7['table']);for(var _0xdfd8d1=0x0;_0xdfd8d1<_0x4a63f6[_0xbfb4('0x39')];_0xdfd8d1+=0x1){_0x26cf7c=_0x4a63f6[_0xdfd8d1][_0xbfb4('0x6c')]?_0x4d0a4d[_0x4a63f6[_0xdfd8d1][_0xbfb4('0x6c')]][_0xbfb4('0x89')]:_0x4a63f6[_0xdfd8d1][_0xbfb4('0x63')];_0x26cf7c=_0x4a63f6[_0xdfd8d1][_0xbfb4('0x6d')]?_[_0xbfb4('0x6e')](_0x5849d3[_0x4a63f6[_0xdfd8d1][_0xbfb4('0x6d')]],'%s',_0x26cf7c):_0x26cf7c;_0x26cf7c=_0x4a63f6[_0xdfd8d1][_0xbfb4('0x6f')]?_[_0xbfb4('0x6e')](_0x1bb27a[_0x4a63f6[_0xdfd8d1][_0xbfb4('0x6f')]],'%s',_0x26cf7c):_0x26cf7c;if(_0x4a63f6[_0xdfd8d1][_0xbfb4('0x8a')]){_0x337cb4['group'](_0x26cf7c);}_0x4a63f6[_0xdfd8d1][_0xbfb4('0x70')]&&_0x337cb4[_0xbfb4('0x3b')](_0x26cf7c,_0x4a63f6[_0xdfd8d1]['orderBy']===_0xbfb4('0x71')?![]:!![]);_0x337cb4[_0xbfb4('0x63')](_0x26cf7c,_0x4a63f6[_0xdfd8d1][_0xbfb4('0x72')]||_0x26cf7c);}if(_0x4191f7['joins']){_0x4191f7[_0xbfb4('0x73')]=JSON[_0xbfb4('0x74')](_0x4191f7['joins']);for(var _0x151409=0x0;_0x151409<_0x4191f7['joins'][_0xbfb4('0x39')];_0x151409+=0x1){if(_0x4191f7['joins'][_0x151409][_0xbfb4('0x75')]&&_[_0xbfb4('0x5c')](_0x90cd27,_0x4191f7[_0xbfb4('0x73')][_0x151409]['type'])&&_0x4191f7[_0xbfb4('0x73')][_0x151409][_0xbfb4('0x76')]&&_0x4191f7[_0xbfb4('0x73')][_0x151409]['foreignTable']&&_0x4191f7[_0xbfb4('0x73')][_0x151409]['foreignKey']){_0x337cb4[_0x4191f7[_0xbfb4('0x73')][_0x151409][_0xbfb4('0x75')]](_0x4191f7[_0xbfb4('0x73')][_0x151409][_0xbfb4('0x8b')],null,util[_0xbfb4('0x6f')]('%s.%s\x20=\x20%s.%s',_0x4191f7['table'],_0x4191f7[_0xbfb4('0x73')][_0x151409][_0xbfb4('0x76')],_0x4191f7['joins'][_0x151409]['foreignTable'],_0x4191f7[_0xbfb4('0x73')][_0x151409][_0xbfb4('0x77')]));}}}if(_0x4191f7[_0xbfb4('0x7a')]){_0x4191f7[_0xbfb4('0x7a')]=JSON[_0xbfb4('0x74')](_0x4191f7['conditions']);_0x337cb4[_0xbfb4('0x3d')](_0x11cbb5(_0x4191f7['conditions']['group']));}_0x369e42=_0x337cb4[_0xbfb4('0x7b')]();_0x337cb4[_0xbfb4('0x1e')](_0x48c6cc);_0x337cb4['offset'](0x0);return;}})[_0xbfb4('0x26')](function(){if(_0x247657[_0xbfb4('0x8c')]==='web'){return null;}var _0x3b3ad0=_['merge'](_0x247657,{'name':_0x247657[_0xbfb4('0x8d')]||_0x247657[_0xbfb4('0x2d')]||_0x4191f7[_0xbfb4('0x2d')],'basename':_0x5e5085,'savename':util[_0xbfb4('0x6f')](_0xbfb4('0x8e'),_0x247657[_0xbfb4('0x2d')]||_0x4191f7[_0xbfb4('0x2d')],require(_0xbfb4('0x8f'))['generate'](0x4),_0x247657[_0xbfb4('0x8c')]||_0xbfb4('0x90')),'reportId':_0x4191f7['id'],'reportType':'custom'});return db[_0xbfb4('0x91')]['create'](_0x3b3ad0,{'raw':!![]});})['then'](function(_0x5b305a){if(_0x4191f7['table']==='cdr'){_0x369e42[_0xbfb4('0x3d')](_0x4191f7[_0xbfb4('0x79')]+_0xbfb4('0x92'),_0x247657[_0xbfb4('0x93')],_0x247657['endDate']);}else{_0x369e42[_0xbfb4('0x3d')](_0x4191f7[_0xbfb4('0x79')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x247657[_0xbfb4('0x93')],_0x247657[_0xbfb4('0x94')]);}if(_0x5b305a){logger[_0xbfb4('0x95')]('Run\x20Query:',_0x369e42['toString']());require(_0xbfb4('0x96'))[_0xbfb4('0x97')](path['join'](__dirname,'../../components/export/',_0x5b305a['output']),[_0x5b305a['id'],_0x369e42[_0xbfb4('0x7d')](),path[_0xbfb4('0x80')](__dirname,_0xbfb4('0x98'),_0x5b305a[_0xbfb4('0x99')]),_0x5e5085]);return _0x5b305a;}else{var _0x36db96=squel[_0xbfb4('0x6a')]();_0x36db96['from']('('+_0x369e42['toString']()+')',_0xbfb4('0x9a'));_0x36db96[_0xbfb4('0x63')]('COUNT(*)','count');_0x369e42[_0xbfb4('0x1e')](_0x247657[_0xbfb4('0x1e')]||_0x48c6cc);_0x369e42['offset'](_0x247657[_0xbfb4('0x20')]||0x0);return dbH['sequelize'][_0xbfb4('0x35')](_0x36db96[_0xbfb4('0x7d')](),{'type':dbH[_0xbfb4('0x7e')][_0xbfb4('0x9b')]['SELECT']})[_0xbfb4('0x26')](function(_0x23845c){if(!_0x23845c[_0xbfb4('0x39')]){_0x589c3f=0x0;}else{_0x589c3f=_0x23845c[0x0]['count']||0x0;}return dbH['sequelize'][_0xbfb4('0x35')](_0x369e42[_0xbfb4('0x7d')](),{'type':dbH['sequelize'][_0xbfb4('0x9b')][_0xbfb4('0x7f')]});})[_0xbfb4('0x26')](function(_0x39de82){return{'rows':_0x39de82||[],'count':_0x589c3f};});}});}exports['run']=function(_0x171d00,_0x4b89e2){return runReport(_0x171d00[_0xbfb4('0x45')],_0x171d00['query'],_0x171d00['options'])[_0xbfb4('0x26')](respondWithResult(_0x4b89e2,null))[_0xbfb4('0x43')](handleError(_0x4b89e2,null));};exports[_0xbfb4('0x9c')]=runReport;exports[_0xbfb4('0x35')]=function(_0x11694b,_0x415fc6){var _0x6e79a1=0xa;var _0x1010ce=[_0xbfb4('0x80'),'left_join',_0xbfb4('0x53'),_0xbfb4('0x82')];var _0x4b4556={'SUM':_0xbfb4('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbfb4('0x55'),'MAX':'MAX(%s)','MIN':_0xbfb4('0x57'),'AVG':_0xbfb4('0x84'),'GROUP_CONCAT':_0xbfb4('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbfb4('0x86')};var _0x2c85f9={'SEC_TO_TIME':_0xbfb4('0x87'),'DATE':_0xbfb4('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xbfb4('0x9d'),'UNIX_TIMESTAMP':_0xbfb4('0x5b')};var _0x2dd52f=function(_0x113919){return!_[_0xbfb4('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xbfb4('0x88'),_0xbfb4('0x5f')],_0x113919);};var _0x434184=function(_0x44394b){if(!_0x44394b||!_0x44394b[_0xbfb4('0x60')][_0xbfb4('0x39')]){return'';}for(var _0x3fc715='(',_0x4e8e32=0x0;_0x4e8e32<_0x44394b['rules']['length'];_0x4e8e32+=0x1){_0x4e8e32>0x0&&(_0x3fc715+='\x20'+_0x44394b[_0xbfb4('0x61')]+'\x20');_0x3fc715+=_0x44394b['rules'][_0x4e8e32][_0xbfb4('0x62')]?_0x434184(_0x44394b[_0xbfb4('0x60')][_0x4e8e32][_0xbfb4('0x62')]):_0x44394b[_0xbfb4('0x60')][_0x4e8e32][_0xbfb4('0x63')]+'\x20'+_0x44394b[_0xbfb4('0x60')][_0x4e8e32][_0xbfb4('0x64')]+(_0x2dd52f(_0x44394b[_0xbfb4('0x60')][_0x4e8e32][_0xbfb4('0x64')])?'\x20'+_0x44394b[_0xbfb4('0x60')][_0x4e8e32]['value']:'');}return _0x3fc715+')';};var _0x56bae2={'where':{'id':_0x11694b[_0xbfb4('0x45')]['id']}},_0x426698,_0x53e786,_0x421221,_0x36e549,_0x2f6100;_0x56bae2=_[_0xbfb4('0x3f')]({},_0x56bae2,_0x11694b[_0xbfb4('0x40')]);return db[_0xbfb4('0x31')]['find'](_0x56bae2)['then'](function(_0x1558d4){if(_0x1558d4){_0x426698=_0x1558d4;return _0x1558d4[_0xbfb4('0x65')]();}return null;})[_0xbfb4('0x26')](function(_0x3f6323){if(_0x3f6323){if(!_0x3f6323[_0xbfb4('0x39')]){throw new db[(_0xbfb4('0x9e'))]['ValidationErrorItem'](_0xbfb4('0x67'),0x193);}_0x53e786=_0x3f6323;return db['AnalyticMetric'][_0xbfb4('0x42')]({'raw':!![]});}return null;})['then'](function(_0x31fe1d){if(_0x31fe1d){_0x421221=_[_0xbfb4('0x69')](_0x31fe1d,'id');var _0x5b2b96;var _0x264441=squel[_0xbfb4('0x6a')]();_0x264441[_0xbfb4('0x6b')](_0x426698[_0xbfb4('0x79')]);for(var _0x15b757=0x0;_0x15b757<_0x53e786['length'];_0x15b757+=0x1){_0x5b2b96=_0x53e786[_0x15b757][_0xbfb4('0x6c')]?_0x421221[_0x53e786[_0x15b757]['MetricId']][_0xbfb4('0x89')]:_0x53e786[_0x15b757][_0xbfb4('0x63')];_0x5b2b96=_0x53e786[_0x15b757][_0xbfb4('0x6d')]?_['replace'](_0x4b4556[_0x53e786[_0x15b757][_0xbfb4('0x6d')]],'%s',_0x5b2b96):_0x5b2b96;_0x5b2b96=_0x53e786[_0x15b757][_0xbfb4('0x6f')]?_[_0xbfb4('0x6e')](_0x2c85f9[_0x53e786[_0x15b757][_0xbfb4('0x6f')]],'%s',_0x5b2b96):_0x5b2b96;if(_0x53e786[_0x15b757]['groupBy']){_0x264441['group'](_0x5b2b96);}_0x53e786[_0x15b757]['orderBy']&&_0x264441[_0xbfb4('0x3b')](_0x5b2b96,_0x53e786[_0x15b757][_0xbfb4('0x70')]===_0xbfb4('0x71')?![]:!![]);_0x264441[_0xbfb4('0x63')](_0x5b2b96,_0x53e786[_0x15b757][_0xbfb4('0x72')]||_0x5b2b96);}if(_0x426698[_0xbfb4('0x73')]){_0x426698[_0xbfb4('0x73')]=JSON[_0xbfb4('0x74')](_0x426698[_0xbfb4('0x73')]);for(var _0x4ec9ec=0x0;_0x4ec9ec<_0x426698[_0xbfb4('0x73')][_0xbfb4('0x39')];_0x4ec9ec+=0x1){if(_0x426698['joins'][_0x4ec9ec][_0xbfb4('0x75')]&&_[_0xbfb4('0x5c')](_0x1010ce,_0x426698[_0xbfb4('0x73')][_0x4ec9ec]['type'])&&_0x426698[_0xbfb4('0x73')][_0x4ec9ec][_0xbfb4('0x76')]&&_0x426698['joins'][_0x4ec9ec][_0xbfb4('0x8b')]&&_0x426698[_0xbfb4('0x73')][_0x4ec9ec]['foreignKey']){_0x264441[_0x426698[_0xbfb4('0x73')][_0x4ec9ec][_0xbfb4('0x75')]](_0x426698[_0xbfb4('0x73')][_0x4ec9ec]['foreignTable'],null,util[_0xbfb4('0x6f')](_0xbfb4('0x78'),_0x426698[_0xbfb4('0x79')],_0x426698[_0xbfb4('0x73')][_0x4ec9ec]['parentKey'],_0x426698[_0xbfb4('0x73')][_0x4ec9ec]['foreignTable'],_0x426698[_0xbfb4('0x73')][_0x4ec9ec][_0xbfb4('0x77')]));}}}if(_0x426698[_0xbfb4('0x7a')]){_0x426698[_0xbfb4('0x7a')]=JSON[_0xbfb4('0x74')](_0x426698['conditions']);_0x264441[_0xbfb4('0x3d')](_0x434184(_0x426698[_0xbfb4('0x7a')][_0xbfb4('0x62')]));}_0x2f6100=_0x264441[_0xbfb4('0x7b')]();_0x264441[_0xbfb4('0x1e')](_0x6e79a1);_0x264441[_0xbfb4('0x20')](0x0);logger['debug'](_0xbfb4('0x9f'),_0x264441[_0xbfb4('0x7d')]());return dbH[_0xbfb4('0x7e')]['query'](_0x264441['toString'](),{'type':dbH[_0xbfb4('0x7e')][_0xbfb4('0x9b')][_0xbfb4('0x7f')]});}})['then'](function(){return{'sql':_0x2f6100[_0xbfb4('0x7d')]()};})['then'](respondWithResult(_0x415fc6,null))[_0xbfb4('0x43')](handleError(_0x415fc6,null));}; \ No newline at end of file +var _0x0bda=['table','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','debug','toString','sequelize','QueryTypes','left_join','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','findAll','metric','%s.%s\x20=\x20%s.%s','parse','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','select','countTable','COUNT(*)','SELECT','runReport','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','end','error','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','AnalyticCustomReport','rows','catch','params','keys','find','create','body','role','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from'];(function(_0x39de34,_0xf7f030){var _0x3dfd2c=function(_0x3b4399){while(--_0x3b4399){_0x39de34['push'](_0x39de34['shift']());}};_0x3dfd2c(++_0xf7f030);}(_0x0bda,0xda));var _0xa0bd=function(_0x248093,_0x4d9d63){_0x248093=_0x248093-0x0;var _0x23de45=_0x0bda[_0x248093];return _0x23de45;};'use strict';var emlformat=require(_0xa0bd('0x0'));var rimraf=require(_0xa0bd('0x1'));var zipdir=require(_0xa0bd('0x2'));var jsonpatch=require(_0xa0bd('0x3'));var rp=require(_0xa0bd('0x4'));var moment=require(_0xa0bd('0x5'));var BPromise=require(_0xa0bd('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa0bd('0x7'));var sox=require(_0xa0bd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0bd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa0bd('0xa'));var deskjs=require(_0xa0bd('0xb'));var toCsv=require(_0xa0bd('0xc'));var querystring=require(_0xa0bd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa0bd('0xe'));var qs=require(_0xa0bd('0xf'));var as=require(_0xa0bd('0x10'));var hardwareService=require(_0xa0bd('0x11'));var logger=require(_0xa0bd('0x12'))(_0xa0bd('0x13'));var utils=require(_0xa0bd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa0bd('0x15'));var db=require(_0xa0bd('0x16'))['db'];var dbH=require(_0xa0bd('0x16'))[_0xa0bd('0x17')];function respondWithStatusCode(_0x12365b,_0x5808f3){_0x5808f3=_0x5808f3||0xcc;return function(_0x2942e8){if(_0x2942e8){return _0x12365b[_0xa0bd('0x18')](_0x5808f3);}return _0x12365b['status'](_0x5808f3)['end']();};}function respondWithResult(_0x5046bc,_0x54ee28){_0x54ee28=_0x54ee28||0xc8;return function(_0x57f0ea){if(_0x57f0ea){return _0x5046bc[_0xa0bd('0x19')](_0x54ee28)[_0xa0bd('0x1a')](_0x57f0ea);}};}function respondWithFilteredResult(_0x273f3e,_0x4c6e04){return function(_0x4f6af3){if(_0x4f6af3){var _0x1a0fa8=typeof _0x4c6e04[_0xa0bd('0x1b')]==='undefined'&&typeof _0x4c6e04[_0xa0bd('0x1c')]===_0xa0bd('0x1d');var _0x37ae54=_0x4f6af3['count'];var _0x31c3a9=_0x1a0fa8?0x0:_0x4c6e04[_0xa0bd('0x1b')];var _0x38644d=_0x1a0fa8?_0x4f6af3['count']:_0x4c6e04[_0xa0bd('0x1b')]+_0x4c6e04[_0xa0bd('0x1c')];var _0x2f0af5;if(_0x38644d>=_0x37ae54){_0x38644d=_0x37ae54;_0x2f0af5=0xc8;}else{_0x2f0af5=0xce;}_0x273f3e[_0xa0bd('0x19')](_0x2f0af5);return _0x273f3e[_0xa0bd('0x1e')](_0xa0bd('0x1f'),_0x31c3a9+'-'+_0x38644d+'/'+_0x37ae54)[_0xa0bd('0x1a')](_0x4f6af3);}return null;};}function patchUpdates(_0x4cde14){return function(_0x1bd627){try{jsonpatch[_0xa0bd('0x20')](_0x1bd627,_0x4cde14,!![]);}catch(_0xc12aae){return BPromise[_0xa0bd('0x21')](_0xc12aae);}return _0x1bd627[_0xa0bd('0x22')]();};}function saveUpdates(_0x4bf2ad,_0x21076e){return function(_0x35041e){if(_0x35041e){return _0x35041e[_0xa0bd('0x23')](_0x4bf2ad)['then'](function(_0x1d8864){return _0x1d8864;});}return null;};}function removeEntity(_0x50fae7,_0x1678e3){return function(_0x2f6b5a){if(_0x2f6b5a){return _0x2f6b5a[_0xa0bd('0x24')]()[_0xa0bd('0x25')](function(){var _0x4bbfd8=_0x2f6b5a[_0xa0bd('0x26')]({'plain':!![]});var _0x50a1eb=_0xa0bd('0x27');return db[_0xa0bd('0x28')][_0xa0bd('0x24')]({'where':{'type':_0x50a1eb,'resourceId':_0x4bbfd8['id']}})[_0xa0bd('0x25')](function(){return _0x2f6b5a;});})[_0xa0bd('0x25')](function(){_0x50fae7[_0xa0bd('0x19')](0xcc)[_0xa0bd('0x29')]();});}};}function handleEntityNotFound(_0x435316,_0x356869){return function(_0x126d9b){if(!_0x126d9b){_0x435316['sendStatus'](0x194);}return _0x126d9b;};}function handleError(_0x76deb6,_0xb1c1c3){_0xb1c1c3=_0xb1c1c3||0x1f4;return function(_0x16a3fb){logger[_0xa0bd('0x2a')](_0x16a3fb['stack']);if(_0x16a3fb[_0xa0bd('0x2b')]){delete _0x16a3fb[_0xa0bd('0x2b')];}_0x76deb6['status'](_0xb1c1c3)[_0xa0bd('0x2c')](_0x16a3fb);};}exports[_0xa0bd('0x2d')]=function(_0x1f7338,_0x47d199){var _0x5c9ec1={},_0x2c3ae7={},_0x22a8d5={'count':0x0,'rows':[]};var _0x459cdb=_[_0xa0bd('0x2e')](db['AnalyticCustomReport']['rawAttributes'],function(_0x971e70){return{'name':_0x971e70['fieldName'],'type':_0x971e70[_0xa0bd('0x2f')][_0xa0bd('0x30')]};});_0x2c3ae7[_0xa0bd('0x31')]=_[_0xa0bd('0x2e')](_0x459cdb,_0xa0bd('0x2b'));_0x2c3ae7['query']=_['keys'](_0x1f7338[_0xa0bd('0x32')]);_0x2c3ae7[_0xa0bd('0x33')]=_[_0xa0bd('0x34')](_0x2c3ae7['model'],_0x2c3ae7[_0xa0bd('0x32')]);_0x5c9ec1[_0xa0bd('0x35')]=_[_0xa0bd('0x34')](_0x2c3ae7[_0xa0bd('0x31')],qs['fields'](_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x36')]));_0x5c9ec1['attributes']=_0x5c9ec1[_0xa0bd('0x35')][_0xa0bd('0x37')]?_0x5c9ec1[_0xa0bd('0x35')]:_0x2c3ae7['model'];if(!_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x38')]('nolimit')){_0x5c9ec1[_0xa0bd('0x1c')]=qs[_0xa0bd('0x1c')](_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x1c')]);_0x5c9ec1[_0xa0bd('0x1b')]=qs[_0xa0bd('0x1b')](_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x1b')]);}_0x5c9ec1[_0xa0bd('0x39')]=qs['sort'](_0x1f7338['query'][_0xa0bd('0x3a')]);_0x5c9ec1[_0xa0bd('0x3b')]=qs[_0xa0bd('0x33')](_[_0xa0bd('0x3c')](_0x1f7338['query'],_0x2c3ae7['filters']),_0x459cdb);if(_0x1f7338[_0xa0bd('0x32')][_0xa0bd('0x3d')]){_0x5c9ec1[_0xa0bd('0x3b')]=_[_0xa0bd('0x3e')](_0x5c9ec1[_0xa0bd('0x3b')],{'$or':_['map'](_0x459cdb,function(_0x42f6b3){if(_0x42f6b3['type']!==_0xa0bd('0x3f')){var _0x33fc06={};_0x33fc06[_0x42f6b3[_0xa0bd('0x2b')]]={'$like':'%'+_0x1f7338[_0xa0bd('0x32')]['filter']+'%'};return _0x33fc06;}})});}_0x5c9ec1=_[_0xa0bd('0x3e')]({},_0x5c9ec1,_0x1f7338[_0xa0bd('0x40')]);var _0x57a645={'where':_0x5c9ec1[_0xa0bd('0x3b')]};return db['AnalyticCustomReport'][_0xa0bd('0x41')](_0x57a645)[_0xa0bd('0x25')](function(_0x514f04){_0x22a8d5[_0xa0bd('0x41')]=_0x514f04;if(_0x1f7338['query'][_0xa0bd('0x42')]){_0x5c9ec1[_0xa0bd('0x43')]=[{'all':!![]}];}return db[_0xa0bd('0x44')]['findAll'](_0x5c9ec1);})[_0xa0bd('0x25')](function(_0x2290ac){_0x22a8d5[_0xa0bd('0x45')]=_0x2290ac;return _0x22a8d5;})['then'](respondWithFilteredResult(_0x47d199,_0x5c9ec1))[_0xa0bd('0x46')](handleError(_0x47d199,null));};exports['show']=function(_0x331065,_0x395cad){var _0x119fa6={'raw':![],'where':{'id':_0x331065[_0xa0bd('0x47')]['id']}},_0x230983={};_0x230983['model']=_['keys'](db[_0xa0bd('0x44')]['rawAttributes']);_0x230983['query']=_[_0xa0bd('0x48')](_0x331065['query']);_0x230983[_0xa0bd('0x33')]=_[_0xa0bd('0x34')](_0x230983[_0xa0bd('0x31')],_0x230983[_0xa0bd('0x32')]);_0x119fa6[_0xa0bd('0x35')]=_[_0xa0bd('0x34')](_0x230983[_0xa0bd('0x31')],qs[_0xa0bd('0x36')](_0x331065[_0xa0bd('0x32')][_0xa0bd('0x36')]));_0x119fa6['attributes']=_0x119fa6['attributes'][_0xa0bd('0x37')]?_0x119fa6[_0xa0bd('0x35')]:_0x230983[_0xa0bd('0x31')];if(_0x331065['query']['includeAll']){_0x119fa6[_0xa0bd('0x43')]=[{'all':!![]}];}_0x119fa6=_[_0xa0bd('0x3e')]({},_0x119fa6,_0x331065[_0xa0bd('0x40')]);return db[_0xa0bd('0x44')][_0xa0bd('0x49')](_0x119fa6)[_0xa0bd('0x25')](handleEntityNotFound(_0x395cad,null))[_0xa0bd('0x25')](respondWithResult(_0x395cad,null))[_0xa0bd('0x46')](handleError(_0x395cad,null));};exports[_0xa0bd('0x4a')]=function(_0x4e852b,_0x307106){return db[_0xa0bd('0x44')][_0xa0bd('0x4a')](_0x4e852b[_0xa0bd('0x4b')],{})[_0xa0bd('0x25')](function(_0x50bc6b){var _0x145631=_0x4e852b['user'][_0xa0bd('0x26')]({'plain':!![]});if(!_0x145631)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145631[_0xa0bd('0x4c')]==='user'){var _0x41ead6=_0x50bc6b[_0xa0bd('0x26')]({'plain':!![]});var _0x1002ae=_0xa0bd('0x4d');return db['UserProfileSection'][_0xa0bd('0x49')]({'where':{'name':_0x1002ae,'userProfileId':_0x145631[_0xa0bd('0x4e')]},'raw':!![]})[_0xa0bd('0x25')](function(_0x3b071b){if(_0x3b071b&&_0x3b071b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x41ead6['name'],'resourceId':_0x41ead6['id'],'type':_0xa0bd('0x27'),'sectionId':_0x3b071b['id']},{})[_0xa0bd('0x25')](function(){return _0x50bc6b;});}else{return _0x50bc6b;}})[_0xa0bd('0x46')](function(_0xb397e){logger[_0xa0bd('0x2a')](_0xa0bd('0x4f'),_0xb397e);throw _0xb397e;});}return _0x50bc6b;})[_0xa0bd('0x25')](respondWithResult(_0x307106,0xc9))[_0xa0bd('0x46')](handleError(_0x307106,null));};exports[_0xa0bd('0x23')]=function(_0x58a4ab,_0x4cd199){if(_0x58a4ab[_0xa0bd('0x4b')]['id']){delete _0x58a4ab[_0xa0bd('0x4b')]['id'];}return db[_0xa0bd('0x44')]['find']({'where':{'id':_0x58a4ab[_0xa0bd('0x47')]['id']}})[_0xa0bd('0x25')](handleEntityNotFound(_0x4cd199,null))[_0xa0bd('0x25')](saveUpdates(_0x58a4ab['body'],null))['then'](respondWithResult(_0x4cd199,null))[_0xa0bd('0x46')](handleError(_0x4cd199,null));};exports[_0xa0bd('0x24')]=function(_0x373c9b,_0x501c91){return db[_0xa0bd('0x44')][_0xa0bd('0x49')]({'where':{'id':_0x373c9b['params']['id']}})[_0xa0bd('0x25')](handleEntityNotFound(_0x501c91,null))[_0xa0bd('0x25')](removeEntity(_0x501c91,null))['catch'](handleError(_0x501c91,null));};exports[_0xa0bd('0x50')]=function(_0x4d03a4,_0x28074a){var _0xee2e41=0xa;var _0x5a5973=[_0xa0bd('0x51'),'left_join','right_join',_0xa0bd('0x52')];var _0x1c6cc0={'SUM':_0xa0bd('0x53'),'COUNT':_0xa0bd('0x54'),'COUNT DISTINCT':_0xa0bd('0x55'),'MAX':_0xa0bd('0x56'),'MIN':_0xa0bd('0x57'),'AVG':_0xa0bd('0x58'),'GROUP_CONCAT':_0xa0bd('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa0bd('0x5a')};var _0x1829d3={'SEC_TO_TIME':_0xa0bd('0x5b'),'DATE':'DATE(%s)','HOUR':_0xa0bd('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x58dc09=function(_0x266a67){return!_[_0xa0bd('0x5d')]([_0xa0bd('0x5e'),_0xa0bd('0x5f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x266a67);};var _0x1353fd=function(_0x58d31f){if(!_0x58d31f||!_0x58d31f['rules'][_0xa0bd('0x37')]){return'';}for(var _0x1b6f83='(',_0x5de1fc=0x0;_0x5de1fc<_0x58d31f[_0xa0bd('0x60')][_0xa0bd('0x37')];_0x5de1fc+=0x1){_0x5de1fc>0x0&&(_0x1b6f83+='\x20'+_0x58d31f[_0xa0bd('0x61')]+'\x20');_0x1b6f83+=_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x62')]?_0x1353fd(_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x62')]):_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x63')]+'\x20'+_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x64')]+(_0x58dc09(_0x58d31f[_0xa0bd('0x60')][_0x5de1fc]['condition'])?'\x20'+_0x58d31f[_0xa0bd('0x60')][_0x5de1fc][_0xa0bd('0x65')]:'');}return _0x1b6f83+')';};var _0x24feff={'where':{'id':_0x4d03a4[_0xa0bd('0x47')]['id']}},_0x3133a1,_0x42f75c,_0x1f3935,_0x6d65fd,_0x7c975c;_0x24feff=_[_0xa0bd('0x3e')]({},_0x24feff,_0x4d03a4['options']);return db['AnalyticCustomReport'][_0xa0bd('0x49')](_0x24feff)['then'](function(_0x4aa3e3){if(_0x4aa3e3){_0x3133a1=_0x4aa3e3;return _0x4aa3e3[_0xa0bd('0x66')]();}return null;})['then'](function(_0x31efcb){if(_0x31efcb){if(!_0x31efcb[_0xa0bd('0x37')]){throw new db[(_0xa0bd('0x67'))][(_0xa0bd('0x68'))](_0xa0bd('0x69'),0x193);}_0x42f75c=_0x31efcb;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xa0bd('0x25')](function(_0x45e864){if(_0x45e864){_0x1f3935=_[_0xa0bd('0x6a')](_0x45e864,'id');var _0x4d3beb;var _0xcf3bc9=squel['select']();_0xcf3bc9[_0xa0bd('0x6b')](_0x3133a1[_0xa0bd('0x6c')]);for(var _0x17528c=0x0;_0x17528c<_0x42f75c['length'];_0x17528c+=0x1){_0x4d3beb=_0x42f75c[_0x17528c][_0xa0bd('0x6d')]?_0x1f3935[_0x42f75c[_0x17528c]['MetricId']]['metric']:_0x42f75c[_0x17528c][_0xa0bd('0x63')];_0x4d3beb=_0x42f75c[_0x17528c]['function']?_['replace'](_0x1c6cc0[_0x42f75c[_0x17528c][_0xa0bd('0x6e')]],'%s',_0x4d3beb):_0x4d3beb;_0x4d3beb=_0x42f75c[_0x17528c][_0xa0bd('0x6f')]?_[_0xa0bd('0x70')](_0x1829d3[_0x42f75c[_0x17528c][_0xa0bd('0x6f')]],'%s',_0x4d3beb):_0x4d3beb;if(_0x42f75c[_0x17528c][_0xa0bd('0x71')]){_0xcf3bc9[_0xa0bd('0x62')](_0x4d3beb);}_0x42f75c[_0x17528c]['orderBy']&&_0xcf3bc9[_0xa0bd('0x39')](_0x4d3beb,_0x42f75c[_0x17528c][_0xa0bd('0x72')]===_0xa0bd('0x73')?![]:!![]);_0xcf3bc9[_0xa0bd('0x63')](_0x4d3beb,_0x42f75c[_0x17528c][_0xa0bd('0x74')]||_0x4d3beb);}if(_0x3133a1[_0xa0bd('0x75')]){_0x3133a1[_0xa0bd('0x75')]=JSON['parse'](_0x3133a1[_0xa0bd('0x75')]);for(var _0x1c5397=0x0;_0x1c5397<_0x3133a1[_0xa0bd('0x75')][_0xa0bd('0x37')];_0x1c5397+=0x1){if(_0x3133a1['joins'][_0x1c5397][_0xa0bd('0x2f')]&&_[_0xa0bd('0x5d')](_0x5a5973,_0x3133a1[_0xa0bd('0x75')][_0x1c5397]['type'])&&_0x3133a1['joins'][_0x1c5397][_0xa0bd('0x76')]&&_0x3133a1[_0xa0bd('0x75')][_0x1c5397]['foreignTable']&&_0x3133a1[_0xa0bd('0x75')][_0x1c5397]['foreignKey']){_0xcf3bc9[_0x3133a1['joins'][_0x1c5397][_0xa0bd('0x2f')]](_0x3133a1[_0xa0bd('0x75')][_0x1c5397][_0xa0bd('0x77')],null,util[_0xa0bd('0x6f')]('%s.%s\x20=\x20%s.%s',_0x3133a1['table'],_0x3133a1['joins'][_0x1c5397]['parentKey'],_0x3133a1[_0xa0bd('0x75')][_0x1c5397][_0xa0bd('0x77')],_0x3133a1[_0xa0bd('0x75')][_0x1c5397][_0xa0bd('0x78')]));}}}if(_0x3133a1[_0xa0bd('0x79')]){_0x3133a1['conditions']=JSON['parse'](_0x3133a1[_0xa0bd('0x79')]);_0xcf3bc9[_0xa0bd('0x3b')](_0x1353fd(_0x3133a1[_0xa0bd('0x79')][_0xa0bd('0x62')]));}_0x7c975c=_0xcf3bc9['clone']();_0xcf3bc9[_0xa0bd('0x1c')](_0xee2e41);_0xcf3bc9['offset'](0x0);logger[_0xa0bd('0x7a')]('Limited\x20Query:',_0xcf3bc9[_0xa0bd('0x7b')]());return dbH[_0xa0bd('0x7c')][_0xa0bd('0x32')](_0xcf3bc9['toString'](),{'type':dbH[_0xa0bd('0x7c')][_0xa0bd('0x7d')]['SELECT']});}})['then'](respondWithResult(_0x28074a,null))[_0xa0bd('0x46')](handleError(_0x28074a,null));};function runReport(_0x52a2c4,_0x1d3c9c,_0x3d168b){var _0x744f26=_0x1d3c9c['name'];var _0x188b6f=0xa;var _0x24dd01=[_0xa0bd('0x51'),_0xa0bd('0x7e'),_0xa0bd('0x7f'),_0xa0bd('0x52')];var _0xa1d3a={'SUM':_0xa0bd('0x53'),'COUNT':_0xa0bd('0x54'),'COUNT DISTINCT':_0xa0bd('0x55'),'MAX':_0xa0bd('0x56'),'MIN':'MIN(%s)','AVG':_0xa0bd('0x58'),'GROUP_CONCAT':_0xa0bd('0x59'),'GROUP_CONCAT ASC':_0xa0bd('0x80'),'GROUP_CONCAT DESC':_0xa0bd('0x5a')};var _0x3336ac={'SEC_TO_TIME':_0xa0bd('0x5b'),'DATE':_0xa0bd('0x81'),'HOUR':_0xa0bd('0x5c'),'ROUND':_0xa0bd('0x82'),'UNIX_TIMESTAMP':_0xa0bd('0x83')};var _0x10be38=function(_0x4f32ad){return!_['includes']([_0xa0bd('0x5e'),_0xa0bd('0x5f'),_0xa0bd('0x84'),_0xa0bd('0x85')],_0x4f32ad);};var _0x3e42e=function(_0x4967f1){if(!_0x4967f1||!_0x4967f1[_0xa0bd('0x60')][_0xa0bd('0x37')]){return'';}for(var _0x53f4a1='(',_0xbf5f44=0x0;_0xbf5f44<_0x4967f1[_0xa0bd('0x60')][_0xa0bd('0x37')];_0xbf5f44+=0x1){_0xbf5f44>0x0&&(_0x53f4a1+='\x20'+_0x4967f1['operator']+'\x20');_0x53f4a1+=_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x62')]?_0x3e42e(_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x62')]):_0x4967f1['rules'][_0xbf5f44][_0xa0bd('0x63')]+'\x20'+_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x64')]+(_0x10be38(_0x4967f1[_0xa0bd('0x60')][_0xbf5f44]['condition'])?'\x20'+_0x4967f1[_0xa0bd('0x60')][_0xbf5f44][_0xa0bd('0x65')]:'');}return _0x53f4a1+')';};var _0x4b917d={'where':{'id':_0x52a2c4['id']}},_0x22d752,_0x225c08,_0x1231ce,_0x5bcb3f,_0x13edff;_0x4b917d=_['merge']({},_0x4b917d,_0x3d168b);return db[_0xa0bd('0x44')]['find'](_0x4b917d)['then'](function(_0x597562){if(_0x597562){_0x22d752=_0x597562;return _0x597562['getFields']();}return null;})[_0xa0bd('0x25')](function(_0xbd6e3a){if(_0xbd6e3a){if(!_0xbd6e3a[_0xa0bd('0x37')]){throw new db[(_0xa0bd('0x67'))][(_0xa0bd('0x68'))](_0xa0bd('0x69'),0x193);}_0x225c08=_0xbd6e3a;return db['AnalyticMetric'][_0xa0bd('0x86')]({'raw':!![]});}return null;})['then'](function(_0x242c69){if(_0x242c69){_0x1231ce=_[_0xa0bd('0x6a')](_0x242c69,'id');var _0xf239e9;var _0x3ada6=squel['select']();_0x3ada6['from'](_0x22d752[_0xa0bd('0x6c')]);for(var _0x174611=0x0;_0x174611<_0x225c08[_0xa0bd('0x37')];_0x174611+=0x1){_0xf239e9=_0x225c08[_0x174611][_0xa0bd('0x6d')]?_0x1231ce[_0x225c08[_0x174611][_0xa0bd('0x6d')]][_0xa0bd('0x87')]:_0x225c08[_0x174611]['field'];_0xf239e9=_0x225c08[_0x174611][_0xa0bd('0x6e')]?_[_0xa0bd('0x70')](_0xa1d3a[_0x225c08[_0x174611][_0xa0bd('0x6e')]],'%s',_0xf239e9):_0xf239e9;_0xf239e9=_0x225c08[_0x174611][_0xa0bd('0x6f')]?_[_0xa0bd('0x70')](_0x3336ac[_0x225c08[_0x174611]['format']],'%s',_0xf239e9):_0xf239e9;if(_0x225c08[_0x174611][_0xa0bd('0x71')]){_0x3ada6[_0xa0bd('0x62')](_0xf239e9);}_0x225c08[_0x174611][_0xa0bd('0x72')]&&_0x3ada6[_0xa0bd('0x39')](_0xf239e9,_0x225c08[_0x174611]['orderBy']===_0xa0bd('0x73')?![]:!![]);_0x3ada6[_0xa0bd('0x63')](_0xf239e9,_0x225c08[_0x174611][_0xa0bd('0x74')]||_0xf239e9);}if(_0x22d752[_0xa0bd('0x75')]){_0x22d752[_0xa0bd('0x75')]=JSON['parse'](_0x22d752['joins']);for(var _0x313ff7=0x0;_0x313ff7<_0x22d752[_0xa0bd('0x75')]['length'];_0x313ff7+=0x1){if(_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x2f')]&&_['includes'](_0x24dd01,_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x2f')])&&_0x22d752['joins'][_0x313ff7][_0xa0bd('0x76')]&&_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x77')]&&_0x22d752['joins'][_0x313ff7]['foreignKey']){_0x3ada6[_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x2f')]](_0x22d752[_0xa0bd('0x75')][_0x313ff7]['foreignTable'],null,util[_0xa0bd('0x6f')](_0xa0bd('0x88'),_0x22d752['table'],_0x22d752['joins'][_0x313ff7][_0xa0bd('0x76')],_0x22d752[_0xa0bd('0x75')][_0x313ff7][_0xa0bd('0x77')],_0x22d752[_0xa0bd('0x75')][_0x313ff7]['foreignKey']));}}}if(_0x22d752['conditions']){_0x22d752[_0xa0bd('0x79')]=JSON[_0xa0bd('0x89')](_0x22d752[_0xa0bd('0x79')]);_0x3ada6[_0xa0bd('0x3b')](_0x3e42e(_0x22d752['conditions'][_0xa0bd('0x62')]));}_0x13edff=_0x3ada6[_0xa0bd('0x8a')]();_0x3ada6[_0xa0bd('0x1c')](_0x188b6f);_0x3ada6[_0xa0bd('0x1b')](0x0);return;}})[_0xa0bd('0x25')](function(){if(_0x1d3c9c[_0xa0bd('0x8b')]==='web'){return null;}var _0xc654f9=_[_0xa0bd('0x3e')](_0x1d3c9c,{'name':_0x1d3c9c[_0xa0bd('0x8c')]||_0x1d3c9c[_0xa0bd('0x2b')]||_0x22d752[_0xa0bd('0x2b')],'basename':_0x744f26,'savename':util[_0xa0bd('0x6f')](_0xa0bd('0x8d'),_0x1d3c9c['name']||_0x22d752[_0xa0bd('0x2b')],require(_0xa0bd('0x8e'))[_0xa0bd('0x8f')](0x4),_0x1d3c9c[_0xa0bd('0x8b')]||_0xa0bd('0x90')),'reportId':_0x22d752['id'],'reportType':_0xa0bd('0x91')});return db[_0xa0bd('0x92')][_0xa0bd('0x4a')](_0xc654f9,{'raw':!![]});})[_0xa0bd('0x25')](function(_0x13087e){if(_0x22d752[_0xa0bd('0x6c')]===_0xa0bd('0x93')){_0x13edff[_0xa0bd('0x3b')](_0x22d752[_0xa0bd('0x6c')]+_0xa0bd('0x94'),_0x1d3c9c[_0xa0bd('0x95')],_0x1d3c9c[_0xa0bd('0x96')]);}else{_0x13edff['where'](_0x22d752[_0xa0bd('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1d3c9c[_0xa0bd('0x95')],_0x1d3c9c[_0xa0bd('0x96')]);}if(_0x13087e){logger[_0xa0bd('0x97')](_0xa0bd('0x98'),_0x13edff[_0xa0bd('0x7b')]());require(_0xa0bd('0x99'))[_0xa0bd('0x9a')](path[_0xa0bd('0x51')](__dirname,_0xa0bd('0x9b'),_0x13087e[_0xa0bd('0x8b')]),[_0x13087e['id'],_0x13edff['toString'](),path['join'](__dirname,_0xa0bd('0x9c'),_0x13087e['savename']),_0x744f26]);return _0x13087e;}else{var _0x21e0b4=squel[_0xa0bd('0x9d')]();_0x21e0b4[_0xa0bd('0x6b')]('('+_0x13edff[_0xa0bd('0x7b')]()+')',_0xa0bd('0x9e'));_0x21e0b4['field'](_0xa0bd('0x9f'),_0xa0bd('0x41'));_0x13edff[_0xa0bd('0x1c')](_0x1d3c9c[_0xa0bd('0x1c')]||_0x188b6f);_0x13edff[_0xa0bd('0x1b')](_0x1d3c9c['offset']||0x0);return dbH['sequelize'][_0xa0bd('0x32')](_0x21e0b4[_0xa0bd('0x7b')](),{'type':dbH[_0xa0bd('0x7c')][_0xa0bd('0x7d')][_0xa0bd('0xa0')]})[_0xa0bd('0x25')](function(_0x37e30d){if(!_0x37e30d[_0xa0bd('0x37')]){_0x5bcb3f=0x0;}else{_0x5bcb3f=_0x37e30d[0x0][_0xa0bd('0x41')]||0x0;}return dbH[_0xa0bd('0x7c')][_0xa0bd('0x32')](_0x13edff[_0xa0bd('0x7b')](),{'type':dbH[_0xa0bd('0x7c')][_0xa0bd('0x7d')]['SELECT']});})[_0xa0bd('0x25')](function(_0x55332d){return{'rows':_0x55332d||[],'count':_0x5bcb3f};});}});}exports['run']=function(_0x239c86,_0x22d88f){return runReport(_0x239c86[_0xa0bd('0x47')],_0x239c86[_0xa0bd('0x32')],_0x239c86[_0xa0bd('0x40')])[_0xa0bd('0x25')](respondWithResult(_0x22d88f,null))[_0xa0bd('0x46')](handleError(_0x22d88f,null));};exports[_0xa0bd('0xa1')]=runReport;exports[_0xa0bd('0x32')]=function(_0x4fa91c,_0x3d521d){var _0x10027d=0xa;var _0x1f34b3=[_0xa0bd('0x51'),'left_join','right_join',_0xa0bd('0x52')];var _0x354d2c={'SUM':_0xa0bd('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xa0bd('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa0bd('0x80'),'GROUP_CONCAT DESC':_0xa0bd('0x5a')};var _0x13996a={'SEC_TO_TIME':_0xa0bd('0x5b'),'DATE':_0xa0bd('0x81'),'HOUR':'HOUR(%s)','ROUND':_0xa0bd('0x82'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3740f3=function(_0x275435){return!_['includes'](['IS\x20NULL',_0xa0bd('0x5f'),_0xa0bd('0x84'),'IS\x20NOT\x20EMPTY'],_0x275435);};var _0x5b32b3=function(_0x3f64eb){if(!_0x3f64eb||!_0x3f64eb[_0xa0bd('0x60')][_0xa0bd('0x37')]){return'';}for(var _0x2f2edf='(',_0x1c461a=0x0;_0x1c461a<_0x3f64eb['rules'][_0xa0bd('0x37')];_0x1c461a+=0x1){_0x1c461a>0x0&&(_0x2f2edf+='\x20'+_0x3f64eb[_0xa0bd('0x61')]+'\x20');_0x2f2edf+=_0x3f64eb[_0xa0bd('0x60')][_0x1c461a][_0xa0bd('0x62')]?_0x5b32b3(_0x3f64eb[_0xa0bd('0x60')][_0x1c461a][_0xa0bd('0x62')]):_0x3f64eb['rules'][_0x1c461a][_0xa0bd('0x63')]+'\x20'+_0x3f64eb[_0xa0bd('0x60')][_0x1c461a]['condition']+(_0x3740f3(_0x3f64eb[_0xa0bd('0x60')][_0x1c461a][_0xa0bd('0x64')])?'\x20'+_0x3f64eb[_0xa0bd('0x60')][_0x1c461a]['value']:'');}return _0x2f2edf+')';};var _0x1c0e30={'where':{'id':_0x4fa91c[_0xa0bd('0x47')]['id']}},_0x339e4e,_0x575d2f,_0x1397bb,_0x5b2d7a,_0x521a1f;_0x1c0e30=_[_0xa0bd('0x3e')]({},_0x1c0e30,_0x4fa91c['options']);return db[_0xa0bd('0x44')]['find'](_0x1c0e30)[_0xa0bd('0x25')](function(_0x581f1e){if(_0x581f1e){_0x339e4e=_0x581f1e;return _0x581f1e[_0xa0bd('0x66')]();}return null;})[_0xa0bd('0x25')](function(_0x11be76){if(_0x11be76){if(!_0x11be76['length']){throw new db[(_0xa0bd('0x67'))][(_0xa0bd('0x68'))](_0xa0bd('0x69'),0x193);}_0x575d2f=_0x11be76;return db['AnalyticMetric'][_0xa0bd('0x86')]({'raw':!![]});}return null;})['then'](function(_0x6a74ef){if(_0x6a74ef){_0x1397bb=_[_0xa0bd('0x6a')](_0x6a74ef,'id');var _0xb6ec47;var _0x2eaf99=squel[_0xa0bd('0x9d')]();_0x2eaf99['from'](_0x339e4e[_0xa0bd('0x6c')]);for(var _0x44203f=0x0;_0x44203f<_0x575d2f['length'];_0x44203f+=0x1){_0xb6ec47=_0x575d2f[_0x44203f]['MetricId']?_0x1397bb[_0x575d2f[_0x44203f][_0xa0bd('0x6d')]][_0xa0bd('0x87')]:_0x575d2f[_0x44203f][_0xa0bd('0x63')];_0xb6ec47=_0x575d2f[_0x44203f][_0xa0bd('0x6e')]?_[_0xa0bd('0x70')](_0x354d2c[_0x575d2f[_0x44203f][_0xa0bd('0x6e')]],'%s',_0xb6ec47):_0xb6ec47;_0xb6ec47=_0x575d2f[_0x44203f][_0xa0bd('0x6f')]?_[_0xa0bd('0x70')](_0x13996a[_0x575d2f[_0x44203f][_0xa0bd('0x6f')]],'%s',_0xb6ec47):_0xb6ec47;if(_0x575d2f[_0x44203f][_0xa0bd('0x71')]){_0x2eaf99[_0xa0bd('0x62')](_0xb6ec47);}_0x575d2f[_0x44203f]['orderBy']&&_0x2eaf99[_0xa0bd('0x39')](_0xb6ec47,_0x575d2f[_0x44203f]['orderBy']===_0xa0bd('0x73')?![]:!![]);_0x2eaf99[_0xa0bd('0x63')](_0xb6ec47,_0x575d2f[_0x44203f][_0xa0bd('0x74')]||_0xb6ec47);}if(_0x339e4e['joins']){_0x339e4e[_0xa0bd('0x75')]=JSON['parse'](_0x339e4e[_0xa0bd('0x75')]);for(var _0x560a45=0x0;_0x560a45<_0x339e4e[_0xa0bd('0x75')][_0xa0bd('0x37')];_0x560a45+=0x1){if(_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x2f')]&&_[_0xa0bd('0x5d')](_0x1f34b3,_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x2f')])&&_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x76')]&&_0x339e4e[_0xa0bd('0x75')][_0x560a45]['foreignTable']&&_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x78')]){_0x2eaf99[_0x339e4e['joins'][_0x560a45][_0xa0bd('0x2f')]](_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x77')],null,util[_0xa0bd('0x6f')]('%s.%s\x20=\x20%s.%s',_0x339e4e[_0xa0bd('0x6c')],_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x76')],_0x339e4e[_0xa0bd('0x75')][_0x560a45][_0xa0bd('0x77')],_0x339e4e['joins'][_0x560a45][_0xa0bd('0x78')]));}}}if(_0x339e4e[_0xa0bd('0x79')]){_0x339e4e[_0xa0bd('0x79')]=JSON[_0xa0bd('0x89')](_0x339e4e['conditions']);_0x2eaf99['where'](_0x5b32b3(_0x339e4e[_0xa0bd('0x79')]['group']));}_0x521a1f=_0x2eaf99[_0xa0bd('0x8a')]();_0x2eaf99[_0xa0bd('0x1c')](_0x10027d);_0x2eaf99[_0xa0bd('0x1b')](0x0);logger['debug'](_0xa0bd('0xa2'),_0x2eaf99[_0xa0bd('0x7b')]());return dbH['sequelize'][_0xa0bd('0x32')](_0x2eaf99[_0xa0bd('0x7b')](),{'type':dbH[_0xa0bd('0x7c')]['QueryTypes'][_0xa0bd('0xa0')]});}})[_0xa0bd('0x25')](function(){return{'sql':_0x521a1f['toString']()};})['then'](respondWithResult(_0x3d521d,null))[_0xa0bd('0x46')](handleError(_0x3d521d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index aed04b1..4100dfd 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 _0x1794=['api','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x11b852,_0x3d6dab){var _0xa16353=function(_0x5c9ec2){while(--_0x5c9ec2){_0x11b852['push'](_0x11b852['shift']());}};_0xa16353(++_0x3d6dab);}(_0x1794,0x8e));var _0x4179=function(_0x2788ee,_0x258844){_0x2788ee=_0x2788ee-0x0;var _0x506f12=_0x1794[_0x2788ee];return _0x506f12;};'use strict';var _=require(_0x4179('0x0'));var util=require(_0x4179('0x1'));var logger=require('../../config/logger')(_0x4179('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4179('0x3'));var fs=require('fs');var path=require(_0x4179('0x4'));var rimraf=require(_0x4179('0x5'));var config=require(_0x4179('0x6'));var attributes=require(_0x4179('0x7'));module[_0x4179('0x8')]=function(_0x23311b,_0x38c026){return _0x23311b[_0x4179('0x9')](_0x4179('0xa'),attributes,{'tableName':_0x4179('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6ce=['rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','util','api','moment','bluebird','path'];(function(_0x246f43,_0x18a2a0){var _0x10edfe=function(_0x187e48){while(--_0x187e48){_0x246f43['push'](_0x246f43['shift']());}};_0x10edfe(++_0x18a2a0);}(_0xf6ce,0x69));var _0xef6c=function(_0x4f296e,_0x2632f9){_0x4f296e=_0x4f296e-0x0;var _0x457d05=_0xf6ce[_0x4f296e];return _0x457d05;};'use strict';var _=require('lodash');var util=require(_0xef6c('0x0'));var logger=require('../../config/logger')(_0xef6c('0x1'));var moment=require(_0xef6c('0x2'));var BPromise=require(_0xef6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef6c('0x4'));var rimraf=require(_0xef6c('0x5'));var config=require(_0xef6c('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xef6c('0x7')]=function(_0x545226,_0x88f153){return _0x545226[_0xef6c('0x8')](_0xef6c('0x9'),attributes,{'tableName':_0xef6c('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 2972f64..c4c548d 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 _0x977b=['request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x59139b,_0x2d3dac){var _0x28afa4=function(_0x10cd6c){while(--_0x10cd6c){_0x59139b['push'](_0x59139b['shift']());}};_0x28afa4(++_0x2d3dac);}(_0x977b,0xf8));var _0xb977=function(_0x5437b5,_0x55cd61){_0x5437b5=_0x5437b5-0x0;var _0x2757ef=_0x977b[_0x5437b5];return _0x2757ef;};'use strict';var _=require(_0xb977('0x0'));var util=require(_0xb977('0x1'));var moment=require(_0xb977('0x2'));var BPromise=require(_0xb977('0x3'));var rs=require(_0xb977('0x4'));var fs=require('fs');var Redis=require(_0xb977('0x5'));var db=require(_0xb977('0x6'))['db'];var utils=require(_0xb977('0x7'));var logger=require('../../config/logger')(_0xb977('0x8'));var config=require(_0xb977('0x9'));var jayson=require(_0xb977('0xa'));var client=jayson[_0xb977('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e5300,_0x27befc,_0x4054db){return new BPromise(function(_0x5c9e22,_0x23116e){return client[_0xb977('0xc')](_0x5e5300,_0x4054db)[_0xb977('0xd')](function(_0x4adf40){logger[_0xb977('0xe')](_0xb977('0xf'),_0x27befc,_0xb977('0x10'));logger['debug'](_0xb977('0x11'),_0x27befc,_0xb977('0x10'),JSON[_0xb977('0x12')](_0x4adf40));if(_0x4adf40['error']){if(_0x4adf40[_0xb977('0x13')][_0xb977('0x14')]===0x1f4){logger[_0xb977('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27befc,_0x4adf40[_0xb977('0x13')][_0xb977('0x15')]);return _0x23116e(_0x4adf40[_0xb977('0x13')]['message']);}logger[_0xb977('0x13')](_0xb977('0xf'),_0x27befc,_0x4adf40[_0xb977('0x13')]['message']);return _0x5c9e22(_0x4adf40[_0xb977('0x13')][_0xb977('0x15')]);}else{logger[_0xb977('0xe')](_0xb977('0xf'),_0x27befc,'request\x20sent');_0x5c9e22(_0x4adf40[_0xb977('0x16')][_0xb977('0x15')]);}})[_0xb977('0x17')](function(_0x35e860){logger[_0xb977('0x13')](_0xb977('0xf'),_0x27befc,_0x35e860);_0x23116e(_0x35e860);});});} \ No newline at end of file +var _0x5588=['error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x63875f,_0xfea539){var _0x4b74c5=function(_0xba35cd){while(--_0xba35cd){_0x63875f['push'](_0x63875f['shift']());}};_0x4b74c5(++_0xfea539);}(_0x5588,0x139));var _0x8558=function(_0x5a46e5,_0x2e5217){_0x5a46e5=_0x5a46e5-0x0;var _0x23d53f=_0x5588[_0x5a46e5];return _0x23d53f;};'use strict';var _=require(_0x8558('0x0'));var util=require('util');var moment=require(_0x8558('0x1'));var BPromise=require(_0x8558('0x2'));var rs=require(_0x8558('0x3'));var fs=require('fs');var Redis=require(_0x8558('0x4'));var db=require(_0x8558('0x5'))['db'];var utils=require(_0x8558('0x6'));var logger=require(_0x8558('0x7'))(_0x8558('0x8'));var config=require(_0x8558('0x9'));var jayson=require(_0x8558('0xa'));var client=jayson['client'][_0x8558('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3df632,_0x36d236,_0x4ddd1d){return new BPromise(function(_0x365444,_0x1e5243){return client['request'](_0x3df632,_0x4ddd1d)[_0x8558('0xc')](function(_0x521d44){logger['info'](_0x8558('0xd'),_0x36d236,_0x8558('0xe'));logger[_0x8558('0xf')](_0x8558('0x10'),_0x36d236,_0x8558('0xe'),JSON['stringify'](_0x521d44));if(_0x521d44[_0x8558('0x11')]){if(_0x521d44[_0x8558('0x11')]['code']===0x1f4){logger[_0x8558('0x11')](_0x8558('0xd'),_0x36d236,_0x521d44['error'][_0x8558('0x12')]);return _0x1e5243(_0x521d44['error'][_0x8558('0x12')]);}logger[_0x8558('0x11')](_0x8558('0xd'),_0x36d236,_0x521d44[_0x8558('0x11')][_0x8558('0x12')]);return _0x365444(_0x521d44[_0x8558('0x11')][_0x8558('0x12')]);}else{logger[_0x8558('0x13')](_0x8558('0xd'),_0x36d236,_0x8558('0xe'));_0x365444(_0x521d44[_0x8558('0x14')][_0x8558('0x12')]);}})[_0x8558('0x15')](function(_0x13a089){logger[_0x8558('0x11')](_0x8558('0xd'),_0x36d236,_0x13a089);_0x1e5243(_0x13a089);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 70375df..693c892 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 _0x6bea=['update','delete','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','post','/:id'];(function(_0x3b06dd,_0xb782f){var _0x268997=function(_0x56de92){while(--_0x56de92){_0x3b06dd['push'](_0x3b06dd['shift']());}};_0x268997(++_0xb782f);}(_0x6bea,0x68));var _0xa6be=function(_0x3489fc,_0x3d14b7){_0x3489fc=_0x3489fc-0x0;var _0x482ca6=_0x6bea[_0x3489fc];return _0x482ca6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa6be('0x0'));var timeout=require('connect-timeout');var express=require(_0xa6be('0x1'));var router=express[_0xa6be('0x2')]();var fs_extra=require(_0xa6be('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa6be('0x4'));var config=require('../../config/environment');var controller=require(_0xa6be('0x5'));router[_0xa6be('0x6')]('/',auth[_0xa6be('0x7')](),controller[_0xa6be('0x8')]);router[_0xa6be('0x6')]('/:id',auth[_0xa6be('0x7')](),controller[_0xa6be('0x9')]);router[_0xa6be('0x6')](_0xa6be('0xa'),auth[_0xa6be('0x7')](),controller['preview']);router[_0xa6be('0x6')](_0xa6be('0xb'),auth[_0xa6be('0x7')](),controller[_0xa6be('0xc')]);router['get'](_0xa6be('0xd'),auth['isAuthenticated'](),controller['query']);router[_0xa6be('0xe')]('/',auth[_0xa6be('0x7')](),controller['create']);router['put'](_0xa6be('0xf'),auth['isAuthenticated'](),controller[_0xa6be('0x10')]);router[_0xa6be('0x11')]('/:id',auth[_0xa6be('0x7')](),controller[_0xa6be('0x12')]);module[_0xa6be('0x13')]=router; \ No newline at end of file +var _0xc4ee=['exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/preview','preview','/:id/run','isAuthenticated','run','query','post','put','update','delete','destroy'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xc4ee,0x18d));var _0xec4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xec4e('0x0'));var util=require('util');var path=require(_0xec4e('0x1'));var timeout=require('connect-timeout');var express=require(_0xec4e('0x2'));var router=express['Router']();var fs_extra=require(_0xec4e('0x3'));var auth=require(_0xec4e('0x4'));var interaction=require(_0xec4e('0x5'));var config=require(_0xec4e('0x6'));var controller=require('./analyticCustomReport.controller');router[_0xec4e('0x7')]('/',auth['isAuthenticated'](),controller[_0xec4e('0x8')]);router[_0xec4e('0x7')](_0xec4e('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xec4e('0xa'),auth['isAuthenticated'](),controller[_0xec4e('0xb')]);router[_0xec4e('0x7')](_0xec4e('0xc'),auth[_0xec4e('0xd')](),controller[_0xec4e('0xe')]);router[_0xec4e('0x7')]('/:id/query',auth[_0xec4e('0xd')](),controller[_0xec4e('0xf')]);router[_0xec4e('0x10')]('/',auth[_0xec4e('0xd')](),controller['create']);router[_0xec4e('0x11')](_0xec4e('0x9'),auth[_0xec4e('0xd')](),controller[_0xec4e('0x12')]);router[_0xec4e('0x13')](_0xec4e('0x9'),auth[_0xec4e('0xd')](),controller[_0xec4e('0x14')]);module[_0xec4e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a2bc798..b02bf72 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 _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0xd9413d,_0x2a7ddf){var _0x10ad51=function(_0x392ad9){while(--_0x392ad9){_0xd9413d['push'](_0xd9413d['shift']());}};_0x10ad51(++_0x2a7ddf);}(_0xa630,0xbe));var _0x0a63=function(_0x3b4c90,_0x2780fb){_0x3b4c90=_0x3b4c90-0x0;var _0xc004=_0xa630[_0x3b4c90];return _0xc004;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x31872e,_0x283ebd){var _0x39f624=function(_0xd2bb3b){while(--_0xd2bb3b){_0x31872e['push'](_0x31872e['shift']());}};_0x39f624(++_0x283ebd);}(_0xda19,0xd5));var _0x9da1=function(_0x27f1dd,_0x243958){_0x27f1dd=_0x27f1dd-0x0;var _0x5589f4=_0xda19[_0x27f1dd];return _0x5589f4;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index eb32e2f..dc24807 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 _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x458d19,_0x17097c){var _0x27b134=function(_0xd6700b){while(--_0xd6700b){_0x458d19['push'](_0x458d19['shift']());}};_0x27b134(++_0x17097c);}(_0x1261,0x144));var _0x1126=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0x1261[_0x2cdf41];return _0x39a70e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));}; \ No newline at end of file +var _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x18811b,_0x6bede4){var _0x2fbee4=function(_0x4dcf84){while(--_0x4dcf84){_0x18811b['push'](_0x18811b['shift']());}};_0x2fbee4(++_0x6bede4);}(_0x46ed,0x168));var _0xd46e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46ed[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2dd9b34..63d815f 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 _0xe8c1=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x47f14b,_0x293a3b){var _0x1a9a3d=function(_0x373aca){while(--_0x373aca){_0x47f14b['push'](_0x47f14b['shift']());}};_0x1a9a3d(++_0x293a3b);}(_0xe8c1,0x18c));var _0x1e8c=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0xe8c1[_0x522c6d];return _0x26300d;};'use strict';var _=require(_0x1e8c('0x0'));var util=require(_0x1e8c('0x1'));var logger=require(_0x1e8c('0x2'))(_0x1e8c('0x3'));var moment=require('moment');var BPromise=require(_0x1e8c('0x4'));var rp=require(_0x1e8c('0x5'));var fs=require('fs');var path=require(_0x1e8c('0x6'));var rimraf=require(_0x1e8c('0x7'));var config=require(_0x1e8c('0x8'));var attributes=require(_0x1e8c('0x9'));module[_0x1e8c('0xa')]=function(_0x78f235,_0xfd0310){return _0x78f235[_0x1e8c('0xb')](_0x1e8c('0xc'),attributes,{'tableName':_0x1e8c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9efd=['analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport'];(function(_0x6cc730,_0x4415ee){var _0x18f448=function(_0x727f9c){while(--_0x727f9c){_0x6cc730['push'](_0x6cc730['shift']());}};_0x18f448(++_0x4415ee);}(_0x9efd,0x83));var _0xd9ef=function(_0x4d2021,_0x251ed8){_0x4d2021=_0x4d2021-0x0;var _0x542d0f=_0x9efd[_0x4d2021];return _0x542d0f;};'use strict';var _=require(_0xd9ef('0x0'));var util=require(_0xd9ef('0x1'));var logger=require(_0xd9ef('0x2'))(_0xd9ef('0x3'));var moment=require(_0xd9ef('0x4'));var BPromise=require(_0xd9ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9ef('0x6'));var rimraf=require(_0xd9ef('0x7'));var config=require(_0xd9ef('0x8'));var attributes=require(_0xd9ef('0x9'));module['exports']=function(_0x38a937,_0x2c8758){return _0x38a937[_0xd9ef('0xa')](_0xd9ef('0xb'),attributes,{'tableName':_0xd9ef('0xc'),'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 2d22c77..1c97e31 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 _0x67df=['request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x67df,0x1d6));var _0xf67d=function(_0x44d9d6,_0x3f4e79){_0x44d9d6=_0x44d9d6-0x0;var _0x2fb9f1=_0x67df[_0x44d9d6];return _0x2fb9f1;};'use strict';var _=require(_0xf67d('0x0'));var util=require(_0xf67d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf67d('0x2'));var fs=require('fs');var Redis=require(_0xf67d('0x3'));var db=require(_0xf67d('0x4'))['db'];var utils=require(_0xf67d('0x5'));var logger=require(_0xf67d('0x6'))(_0xf67d('0x7'));var config=require(_0xf67d('0x8'));var jayson=require(_0xf67d('0x9'));var client=jayson[_0xf67d('0xa')][_0xf67d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a542f,_0x34da87,_0x1512de){return new BPromise(function(_0x5b988d,_0xa03535){return client[_0xf67d('0xc')](_0x1a542f,_0x1512de)['then'](function(_0x33e4c5){logger[_0xf67d('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x34da87,_0xf67d('0xe'));logger['debug'](_0xf67d('0xf'),_0x34da87,_0xf67d('0xe'),JSON[_0xf67d('0x10')](_0x33e4c5));if(_0x33e4c5[_0xf67d('0x11')]){if(_0x33e4c5['error'][_0xf67d('0x12')]===0x1f4){logger['error'](_0xf67d('0x13'),_0x34da87,_0x33e4c5[_0xf67d('0x11')][_0xf67d('0x14')]);return _0xa03535(_0x33e4c5[_0xf67d('0x11')][_0xf67d('0x14')]);}logger[_0xf67d('0x11')](_0xf67d('0x13'),_0x34da87,_0x33e4c5[_0xf67d('0x11')][_0xf67d('0x14')]);return _0x5b988d(_0x33e4c5[_0xf67d('0x11')][_0xf67d('0x14')]);}else{logger[_0xf67d('0xd')](_0xf67d('0x13'),_0x34da87,'request\x20sent');_0x5b988d(_0x33e4c5['result'][_0xf67d('0x14')]);}})[_0xf67d('0x15')](function(_0x733f49){logger[_0xf67d('0x11')](_0xf67d('0x13'),_0x34da87,_0x733f49);_0xa03535(_0x733f49);});});} \ No newline at end of file +var _0xd377=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0xb30cbf,_0x385a9c){var _0x22c6c3=function(_0x261681){while(--_0x261681){_0xb30cbf['push'](_0xb30cbf['shift']());}};_0x22c6c3(++_0x385a9c);}(_0xd377,0xa9));var _0x7d37=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd377[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7d37('0x0'));var util=require(_0x7d37('0x1'));var moment=require(_0x7d37('0x2'));var BPromise=require('bluebird');var rs=require(_0x7d37('0x3'));var fs=require('fs');var Redis=require(_0x7d37('0x4'));var db=require(_0x7d37('0x5'))['db'];var utils=require(_0x7d37('0x6'));var logger=require(_0x7d37('0x7'))(_0x7d37('0x8'));var config=require(_0x7d37('0x9'));var jayson=require(_0x7d37('0xa'));var client=jayson[_0x7d37('0xb')][_0x7d37('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b18ba,_0x331cb7,_0xea793e){return new BPromise(function(_0x5f0a0d,_0x4694be){return client[_0x7d37('0xd')](_0x2b18ba,_0xea793e)[_0x7d37('0xe')](function(_0xbf3251){logger[_0x7d37('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x331cb7,_0x7d37('0x10'));logger[_0x7d37('0x11')](_0x7d37('0x12'),_0x331cb7,_0x7d37('0x10'),JSON['stringify'](_0xbf3251));if(_0xbf3251['error']){if(_0xbf3251[_0x7d37('0x13')][_0x7d37('0x14')]===0x1f4){logger[_0x7d37('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x331cb7,_0xbf3251[_0x7d37('0x13')][_0x7d37('0x15')]);return _0x4694be(_0xbf3251[_0x7d37('0x13')][_0x7d37('0x15')]);}logger[_0x7d37('0x13')](_0x7d37('0x16'),_0x331cb7,_0xbf3251['error']['message']);return _0x5f0a0d(_0xbf3251[_0x7d37('0x13')]['message']);}else{logger[_0x7d37('0xf')](_0x7d37('0x16'),_0x331cb7,'request\x20sent');_0x5f0a0d(_0xbf3251[_0x7d37('0x17')][_0x7d37('0x15')]);}})['catch'](function(_0x1da301){logger[_0x7d37('0x13')](_0x7d37('0x16'),_0x331cb7,_0x1da301);_0x4694be(_0x1da301);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 77150d5..cd6d4e4 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 _0x9550=['put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post'];(function(_0x449c69,_0x5a4c82){var _0x4eca43=function(_0x3e656d){while(--_0x3e656d){_0x449c69['push'](_0x449c69['shift']());}};_0x4eca43(++_0x5a4c82);}(_0x9550,0x1cc));var _0x0955=function(_0x128a3b,_0x58add2){_0x128a3b=_0x128a3b-0x0;var _0x3ab862=_0x9550[_0x128a3b];return _0x3ab862;};'use strict';var multer=require('multer');var util=require(_0x0955('0x0'));var path=require(_0x0955('0x1'));var timeout=require('connect-timeout');var express=require(_0x0955('0x2'));var router=express[_0x0955('0x3')]();var fs_extra=require(_0x0955('0x4'));var auth=require(_0x0955('0x5'));var interaction=require(_0x0955('0x6'));var config=require(_0x0955('0x7'));var controller=require(_0x0955('0x8'));router[_0x0955('0x9')]('/',auth[_0x0955('0xa')](),controller[_0x0955('0xb')]);router['get'](_0x0955('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0955('0x9')](_0x0955('0xd'),auth[_0x0955('0xa')](),controller[_0x0955('0xe')]);router[_0x0955('0x9')](_0x0955('0xf'),auth[_0x0955('0xa')](),controller[_0x0955('0x10')]);router[_0x0955('0x9')](_0x0955('0x11'),auth['isAuthenticated'](),controller[_0x0955('0x12')]);router[_0x0955('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0955('0x14')](_0x0955('0xc'),auth['isAuthenticated'](),controller[_0x0955('0x15')]);router[_0x0955('0x16')](_0x0955('0xc'),auth[_0x0955('0xa')](),controller[_0x0955('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa723=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','util','path'];(function(_0x2e1777,_0x1f056a){var _0x35628f=function(_0x50499e){while(--_0x50499e){_0x2e1777['push'](_0x2e1777['shift']());}};_0x35628f(++_0x1f056a);}(_0xa723,0x185));var _0x3a72=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0xa723[_0x3eb630];return _0x1b840d;};'use strict';var multer=require('multer');var util=require(_0x3a72('0x0'));var path=require(_0x3a72('0x1'));var timeout=require(_0x3a72('0x2'));var express=require('express');var router=express[_0x3a72('0x3')]();var fs_extra=require(_0x3a72('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a72('0x5'));var config=require(_0x3a72('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x3a72('0x7')]('/',auth[_0x3a72('0x8')](),controller[_0x3a72('0x9')]);router[_0x3a72('0x7')](_0x3a72('0xa'),auth[_0x3a72('0x8')](),controller['show']);router[_0x3a72('0x7')](_0x3a72('0xb'),auth['isAuthenticated'](),controller[_0x3a72('0xc')]);router[_0x3a72('0x7')](_0x3a72('0xd'),auth['isAuthenticated'](),controller[_0x3a72('0xe')]);router[_0x3a72('0x7')](_0x3a72('0xf'),auth[_0x3a72('0x8')](),controller[_0x3a72('0x10')]);router[_0x3a72('0x11')]('/',auth[_0x3a72('0x8')](),controller[_0x3a72('0x12')]);router[_0x3a72('0x13')](_0x3a72('0xa'),auth[_0x3a72('0x8')](),controller[_0x3a72('0x14')]);router[_0x3a72('0x15')](_0x3a72('0xa'),auth[_0x3a72('0x8')](),controller[_0x3a72('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ff1c3a0..d78a337 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 _0xefb5=['csv','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','xlsx'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xefb5,0x15b));var _0x5efb=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xefb5[_0x54de5d];return _0x1b349e;};'use strict';var Sequelize=require(_0x5efb('0x0'));var moment=require(_0x5efb('0x1'));module['exports']={'name':{'type':Sequelize[_0x5efb('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x5efb('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x5efb('0x3')]('csv','pdf',_0x5efb('0x4')),'allowNull':![],'defaultValue':_0x5efb('0x5')},'savename':{'type':Sequelize[_0x5efb('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5efb('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x5efb('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x5efb('0x3')](_0x5efb('0x7'),_0x5efb('0x8')),'allowNull':![],'defaultValue':_0x5efb('0x7')},'reportId':{'type':Sequelize[_0x5efb('0x9')](0xb)[_0x5efb('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7d2a=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','INTEGER','UNSIGNED'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7d2a,0x14a));var _0xa7d2=function(_0x4e49d2,_0x12a180){_0x4e49d2=_0x4e49d2-0x0;var _0x39ce1d=_0x7d2a[_0x4e49d2];return _0x39ce1d;};'use strict';var Sequelize=require(_0xa7d2('0x0'));var moment=require(_0xa7d2('0x1'));module[_0xa7d2('0x2')]={'name':{'type':Sequelize[_0xa7d2('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xa7d2('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa7d2('0x4')](_0xa7d2('0x5'),_0xa7d2('0x6'),_0xa7d2('0x7')),'allowNull':![],'defaultValue':_0xa7d2('0x5')},'savename':{'type':Sequelize[_0xa7d2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa7d2('0x8')]},'endDate':{'type':Sequelize[_0xa7d2('0x8')]},'status':{'type':Sequelize[_0xa7d2('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xa7d2('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xa7d2('0x9')](0xb)[_0xa7d2('0xa')]},'reportType':{'type':Sequelize[_0xa7d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index dae5384..865fb53 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 _0x0ea6=['Report\x20not\x20found\x20or\x20empty','exists','download','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','UserProfileResource','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','rows','show','params','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x0ea6,0x190));var _0x60ea=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x0ea6[_0x1abb09];return _0xea1c07;};'use strict';var emlformat=require(_0x60ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x60ea('0x1'));var jsonpatch=require(_0x60ea('0x2'));var rp=require(_0x60ea('0x3'));var moment=require(_0x60ea('0x4'));var BPromise=require(_0x60ea('0x5'));var Mustache=require(_0x60ea('0x6'));var util=require(_0x60ea('0x7'));var path=require('path');var sox=require(_0x60ea('0x8'));var csv=require('to-csv');var ejs=require(_0x60ea('0x9'));var fs=require('fs');var fs_extra=require(_0x60ea('0xa'));var _=require(_0x60ea('0xb'));var squel=require(_0x60ea('0xc'));var crypto=require('crypto');var jsforce=require(_0x60ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x60ea('0xe'));var querystring=require('querystring');var Papa=require(_0x60ea('0xf'));var Redis=require(_0x60ea('0x10'));var authService=require(_0x60ea('0x11'));var qs=require(_0x60ea('0x12'));var as=require(_0x60ea('0x13'));var hardwareService=require(_0x60ea('0x14'));var logger=require('../../config/logger')(_0x60ea('0x15'));var utils=require(_0x60ea('0x16'));var config=require(_0x60ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x60ea('0x18'))['db'];function respondWithStatusCode(_0x4c2b58,_0x384723){_0x384723=_0x384723||0xcc;return function(_0x8a6c81){if(_0x8a6c81){return _0x4c2b58[_0x60ea('0x19')](_0x384723);}return _0x4c2b58['status'](_0x384723)[_0x60ea('0x1a')]();};}function respondWithResult(_0x3c3c7d,_0x407d73){_0x407d73=_0x407d73||0xc8;return function(_0x57366b){if(_0x57366b){return _0x3c3c7d[_0x60ea('0x1b')](_0x407d73)['json'](_0x57366b);}};}function respondWithFilteredResult(_0x3332c0,_0x4fab2f){return function(_0x15722f){if(_0x15722f){var _0x29f0b0=typeof _0x4fab2f['offset']==='undefined'&&typeof _0x4fab2f[_0x60ea('0x1c')]===_0x60ea('0x1d');var _0x2897e6=_0x15722f[_0x60ea('0x1e')];var _0x56713e=_0x29f0b0?0x0:_0x4fab2f['offset'];var _0x491731=_0x29f0b0?_0x15722f[_0x60ea('0x1e')]:_0x4fab2f[_0x60ea('0x1f')]+_0x4fab2f['limit'];var _0x379e8c;if(_0x491731>=_0x2897e6){_0x491731=_0x2897e6;_0x379e8c=0xc8;}else{_0x379e8c=0xce;}_0x3332c0[_0x60ea('0x1b')](_0x379e8c);return _0x3332c0[_0x60ea('0x20')](_0x60ea('0x21'),_0x56713e+'-'+_0x491731+'/'+_0x2897e6)['json'](_0x15722f);}return null;};}function patchUpdates(_0x4da468){return function(_0x315741){try{jsonpatch[_0x60ea('0x22')](_0x315741,_0x4da468,!![]);}catch(_0x40d542){return BPromise[_0x60ea('0x23')](_0x40d542);}return _0x315741[_0x60ea('0x24')]();};}function saveUpdates(_0x526f38,_0xea8c46){return function(_0x2bcfc7){if(_0x2bcfc7){return _0x2bcfc7[_0x60ea('0x25')](_0x526f38)['then'](function(_0x2f4d5d){return _0x2f4d5d;});}return null;};}function removeEntity(_0x1ea00d,_0x2569b7){return function(_0x5dc8e2){if(_0x5dc8e2){return _0x5dc8e2[_0x60ea('0x26')]()['then'](function(){var _0x45f663=_0x5dc8e2[_0x60ea('0x27')]({'plain':!![]});var _0x221417=_0x60ea('0x28');return db[_0x60ea('0x29')]['destroy']({'where':{'type':_0x221417,'resourceId':_0x45f663['id']}})[_0x60ea('0x2a')](function(){return _0x5dc8e2;});})['then'](function(){_0x1ea00d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1163ec,_0x3d3e74){return function(_0x1223ec){if(!_0x1223ec){_0x1163ec['sendStatus'](0x194);}return _0x1223ec;};}function handleError(_0x58e599,_0xebc5d){_0xebc5d=_0xebc5d||0x1f4;return function(_0x5295a2){logger['error'](_0x5295a2[_0x60ea('0x2b')]);if(_0x5295a2[_0x60ea('0x2c')]){delete _0x5295a2['name'];}_0x58e599[_0x60ea('0x1b')](_0xebc5d)[_0x60ea('0x2d')](_0x5295a2);};}exports['index']=function(_0x3175ce,_0x2060b0){var _0x215fc2={},_0x19b368={},_0x49b3b9={'count':0x0,'rows':[]};var _0x4b98da=_[_0x60ea('0x2e')](db['AnalyticExtractedReport'][_0x60ea('0x2f')],function(_0x2e4c7f){return{'name':_0x2e4c7f[_0x60ea('0x30')],'type':_0x2e4c7f[_0x60ea('0x31')][_0x60ea('0x32')]};});_0x19b368[_0x60ea('0x33')]=_[_0x60ea('0x2e')](_0x4b98da,_0x60ea('0x2c'));_0x19b368[_0x60ea('0x34')]=_[_0x60ea('0x35')](_0x3175ce[_0x60ea('0x34')]);_0x19b368[_0x60ea('0x36')]=_[_0x60ea('0x37')](_0x19b368[_0x60ea('0x33')],_0x19b368['query']);_0x215fc2[_0x60ea('0x38')]=_[_0x60ea('0x37')](_0x19b368[_0x60ea('0x33')],qs[_0x60ea('0x39')](_0x3175ce['query'][_0x60ea('0x39')]));_0x215fc2[_0x60ea('0x38')]=_0x215fc2[_0x60ea('0x38')][_0x60ea('0x3a')]?_0x215fc2[_0x60ea('0x38')]:_0x19b368[_0x60ea('0x33')];if(!_0x3175ce[_0x60ea('0x34')][_0x60ea('0x3b')](_0x60ea('0x3c'))){_0x215fc2[_0x60ea('0x1c')]=qs[_0x60ea('0x1c')](_0x3175ce[_0x60ea('0x34')]['limit']);_0x215fc2[_0x60ea('0x1f')]=qs[_0x60ea('0x1f')](_0x3175ce[_0x60ea('0x34')][_0x60ea('0x1f')]);}_0x215fc2[_0x60ea('0x3d')]=qs[_0x60ea('0x3e')](_0x3175ce[_0x60ea('0x34')]['sort']);_0x215fc2['where']=qs[_0x60ea('0x36')](_[_0x60ea('0x3f')](_0x3175ce[_0x60ea('0x34')],_0x19b368[_0x60ea('0x36')]),_0x4b98da);if(_0x3175ce[_0x60ea('0x34')][_0x60ea('0x40')]){_0x215fc2[_0x60ea('0x41')]=_[_0x60ea('0x42')](_0x215fc2['where'],{'$or':_['map'](_0x4b98da,function(_0x4ac5e){if(_0x4ac5e[_0x60ea('0x31')]!==_0x60ea('0x43')){var _0xaddb0c={};_0xaddb0c[_0x4ac5e[_0x60ea('0x2c')]]={'$like':'%'+_0x3175ce[_0x60ea('0x34')][_0x60ea('0x40')]+'%'};return _0xaddb0c;}})});}_0x215fc2=_[_0x60ea('0x42')]({},_0x215fc2,_0x3175ce[_0x60ea('0x44')]);var _0x503ec2={'where':_0x215fc2[_0x60ea('0x41')]};return db[_0x60ea('0x45')]['count'](_0x503ec2)[_0x60ea('0x2a')](function(_0x1e21f2){_0x49b3b9['count']=_0x1e21f2;if(_0x3175ce[_0x60ea('0x34')][_0x60ea('0x46')]){_0x215fc2['include']=[{'all':!![]}];}return db[_0x60ea('0x45')]['findAll'](_0x215fc2);})[_0x60ea('0x2a')](function(_0x1b8ea4){_0x49b3b9[_0x60ea('0x47')]=_0x1b8ea4;return _0x49b3b9;})['then'](respondWithFilteredResult(_0x2060b0,_0x215fc2))['catch'](handleError(_0x2060b0,null));};exports[_0x60ea('0x48')]=function(_0x731c84,_0x35f82b){var _0x63dfa3={'raw':!![],'where':{'id':_0x731c84[_0x60ea('0x49')]['id']}},_0x17f9bf={};_0x17f9bf[_0x60ea('0x33')]=_[_0x60ea('0x35')](db[_0x60ea('0x45')][_0x60ea('0x2f')]);_0x17f9bf['query']=_[_0x60ea('0x35')](_0x731c84['query']);_0x17f9bf[_0x60ea('0x36')]=_[_0x60ea('0x37')](_0x17f9bf['model'],_0x17f9bf[_0x60ea('0x34')]);_0x63dfa3['attributes']=_['intersection'](_0x17f9bf[_0x60ea('0x33')],qs['fields'](_0x731c84[_0x60ea('0x34')][_0x60ea('0x39')]));_0x63dfa3[_0x60ea('0x38')]=_0x63dfa3[_0x60ea('0x38')][_0x60ea('0x3a')]?_0x63dfa3[_0x60ea('0x38')]:_0x17f9bf[_0x60ea('0x33')];if(_0x731c84[_0x60ea('0x34')][_0x60ea('0x46')]){_0x63dfa3[_0x60ea('0x4a')]=[{'all':!![]}];}_0x63dfa3=_['merge']({},_0x63dfa3,_0x731c84[_0x60ea('0x44')]);return db[_0x60ea('0x45')]['find'](_0x63dfa3)[_0x60ea('0x2a')](handleEntityNotFound(_0x35f82b,null))[_0x60ea('0x2a')](respondWithResult(_0x35f82b,null))[_0x60ea('0x4b')](handleError(_0x35f82b,null));};exports[_0x60ea('0x4c')]=function(_0x3d29ef,_0x18fa8a){return db[_0x60ea('0x45')][_0x60ea('0x4c')](_0x3d29ef[_0x60ea('0x4d')],{})[_0x60ea('0x2a')](function(_0x308582){var _0xa16539=_0x3d29ef[_0x60ea('0x4e')][_0x60ea('0x27')]({'plain':!![]});if(!_0xa16539)throw new Error(_0x60ea('0x4f'));if(_0xa16539[_0x60ea('0x50')]==='user'){var _0x3086a8=_0x308582['get']({'plain':!![]});var _0x9d84cf=_0x60ea('0x28');return db[_0x60ea('0x51')][_0x60ea('0x52')]({'where':{'name':_0x9d84cf,'userProfileId':_0xa16539[_0x60ea('0x53')]},'raw':!![]})['then'](function(_0x1bdea3){if(_0x1bdea3&&_0x1bdea3[_0x60ea('0x54')]===0x0){return db[_0x60ea('0x29')]['create']({'name':_0x3086a8[_0x60ea('0x2c')],'resourceId':_0x3086a8['id'],'type':_0x1bdea3['name'],'sectionId':_0x1bdea3['id']},{})[_0x60ea('0x2a')](function(){return _0x308582;});}else{return _0x308582;}})[_0x60ea('0x4b')](function(_0x966ee0){logger[_0x60ea('0x55')](_0x60ea('0x56'),_0x966ee0);throw _0x966ee0;});}return _0x308582;})[_0x60ea('0x2a')](respondWithResult(_0x18fa8a,0xc9))[_0x60ea('0x4b')](handleError(_0x18fa8a,null));};exports[_0x60ea('0x25')]=function(_0xc196bc,_0xba1b66){if(_0xc196bc[_0x60ea('0x4d')]['id']){delete _0xc196bc[_0x60ea('0x4d')]['id'];}return db[_0x60ea('0x45')][_0x60ea('0x52')]({'where':{'id':_0xc196bc[_0x60ea('0x49')]['id']}})[_0x60ea('0x2a')](handleEntityNotFound(_0xba1b66,null))[_0x60ea('0x2a')](saveUpdates(_0xc196bc[_0x60ea('0x4d')],null))[_0x60ea('0x2a')](respondWithResult(_0xba1b66,null))[_0x60ea('0x4b')](handleError(_0xba1b66,null));};exports[_0x60ea('0x26')]=function(_0x303afe,_0xe3f4d){return db['AnalyticExtractedReport'][_0x60ea('0x52')]({'where':{'id':_0x303afe['params']['id']}})[_0x60ea('0x2a')](handleEntityNotFound(_0xe3f4d,null))['then'](removeEntity(_0xe3f4d,null))[_0x60ea('0x4b')](handleError(_0xe3f4d,null));};exports['download']=function(_0x4ad591,_0x17963f,_0x1dc049){return db[_0x60ea('0x45')][_0x60ea('0x52')]({'where':{'id':_0x4ad591['params']['id']},'attributes':[_0x60ea('0x2c'),_0x60ea('0x57'),_0x60ea('0x58'),_0x60ea('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x17963f,null))[_0x60ea('0x2a')](function(_0x2c34b8){if(_0x2c34b8){if(!fs[_0x60ea('0x5a')](path['join'](config[_0x60ea('0x5b')],_0x60ea('0x5c'),_0x2c34b8['savename']))){throw new db[(_0x60ea('0x5d'))][(_0x60ea('0x5e'))](_0x60ea('0x5f'));}if(_0x4ad591[_0x60ea('0x34')][_0x60ea('0x60')]){return _0x17963f[_0x60ea('0x19')](0xc8);}return _0x17963f[_0x60ea('0x61')](path['join'](config[_0x60ea('0x5b')],_0x60ea('0x5c'),_0x2c34b8[_0x60ea('0x58')]),util['format']('%s.%s',_0x2c34b8['basename']||_0x2c34b8[_0x60ea('0x2c')],_0x2c34b8[_0x60ea('0x59')][_0x60ea('0x62')]()));}})['catch'](handleError(_0x17963f,null));}; \ No newline at end of file +var _0xbb9c=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../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','set','Content-Range','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xbb9c,0xb6));var _0xcbb9=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xbb9c[_0x4d674b];return _0x535a1f;};'use strict';var emlformat=require(_0xcbb9('0x0'));var rimraf=require(_0xcbb9('0x1'));var zipdir=require(_0xcbb9('0x2'));var jsonpatch=require(_0xcbb9('0x3'));var rp=require(_0xcbb9('0x4'));var moment=require('moment');var BPromise=require(_0xcbb9('0x5'));var Mustache=require(_0xcbb9('0x6'));var util=require(_0xcbb9('0x7'));var path=require(_0xcbb9('0x8'));var sox=require('sox');var csv=require(_0xcbb9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcbb9('0xa'));var _=require(_0xcbb9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcbb9('0xc'));var deskjs=require(_0xcbb9('0xd'));var toCsv=require(_0xcbb9('0x9'));var querystring=require(_0xcbb9('0xe'));var Papa=require(_0xcbb9('0xf'));var Redis=require('ioredis');var authService=require(_0xcbb9('0x10'));var qs=require(_0xcbb9('0x11'));var as=require(_0xcbb9('0x12'));var hardwareService=require(_0xcbb9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcbb9('0x14'));var config=require(_0xcbb9('0x15'));var licenseUtil=require(_0xcbb9('0x16'));var db=require(_0xcbb9('0x17'))['db'];function respondWithStatusCode(_0x30608f,_0xe5c0bd){_0xe5c0bd=_0xe5c0bd||0xcc;return function(_0x5bde44){if(_0x5bde44){return _0x30608f[_0xcbb9('0x18')](_0xe5c0bd);}return _0x30608f[_0xcbb9('0x19')](_0xe5c0bd)[_0xcbb9('0x1a')]();};}function respondWithResult(_0x365c34,_0x55eeb7){_0x55eeb7=_0x55eeb7||0xc8;return function(_0x5cc06a){if(_0x5cc06a){return _0x365c34[_0xcbb9('0x19')](_0x55eeb7)[_0xcbb9('0x1b')](_0x5cc06a);}};}function respondWithFilteredResult(_0x16e25c,_0x1ab7d4){return function(_0x48884c){if(_0x48884c){var _0x2ccd2a=typeof _0x1ab7d4[_0xcbb9('0x1c')]===_0xcbb9('0x1d')&&typeof _0x1ab7d4[_0xcbb9('0x1e')]===_0xcbb9('0x1d');var _0x51fdb6=_0x48884c[_0xcbb9('0x1f')];var _0x52c959=_0x2ccd2a?0x0:_0x1ab7d4[_0xcbb9('0x1c')];var _0x52e2f4=_0x2ccd2a?_0x48884c[_0xcbb9('0x1f')]:_0x1ab7d4[_0xcbb9('0x1c')]+_0x1ab7d4[_0xcbb9('0x1e')];var _0x45c7e9;if(_0x52e2f4>=_0x51fdb6){_0x52e2f4=_0x51fdb6;_0x45c7e9=0xc8;}else{_0x45c7e9=0xce;}_0x16e25c[_0xcbb9('0x19')](_0x45c7e9);return _0x16e25c[_0xcbb9('0x20')](_0xcbb9('0x21'),_0x52c959+'-'+_0x52e2f4+'/'+_0x51fdb6)[_0xcbb9('0x1b')](_0x48884c);}return null;};}function patchUpdates(_0x3d6a25){return function(_0x5c36e0){try{jsonpatch['apply'](_0x5c36e0,_0x3d6a25,!![]);}catch(_0xdc6fe2){return BPromise[_0xcbb9('0x22')](_0xdc6fe2);}return _0x5c36e0[_0xcbb9('0x23')]();};}function saveUpdates(_0x5d2f20,_0x5745a5){return function(_0x3d6c86){if(_0x3d6c86){return _0x3d6c86['update'](_0x5d2f20)[_0xcbb9('0x24')](function(_0x193700){return _0x193700;});}return null;};}function removeEntity(_0x44f615,_0x3323c4){return function(_0x305243){if(_0x305243){return _0x305243[_0xcbb9('0x25')]()[_0xcbb9('0x24')](function(){var _0x1ecc8e=_0x305243[_0xcbb9('0x26')]({'plain':!![]});var _0x48caaa=_0xcbb9('0x27');return db[_0xcbb9('0x28')]['destroy']({'where':{'type':_0x48caaa,'resourceId':_0x1ecc8e['id']}})[_0xcbb9('0x24')](function(){return _0x305243;});})[_0xcbb9('0x24')](function(){_0x44f615[_0xcbb9('0x19')](0xcc)[_0xcbb9('0x1a')]();});}};}function handleEntityNotFound(_0x8444be,_0x5e621d){return function(_0x9aa480){if(!_0x9aa480){_0x8444be['sendStatus'](0x194);}return _0x9aa480;};}function handleError(_0x556e10,_0x5cdb2e){_0x5cdb2e=_0x5cdb2e||0x1f4;return function(_0x3ab270){logger[_0xcbb9('0x29')](_0x3ab270['stack']);if(_0x3ab270[_0xcbb9('0x2a')]){delete _0x3ab270[_0xcbb9('0x2a')];}_0x556e10[_0xcbb9('0x19')](_0x5cdb2e)[_0xcbb9('0x2b')](_0x3ab270);};}exports[_0xcbb9('0x2c')]=function(_0x3781dc,_0x999f43){var _0x400963={},_0x4accea={},_0x3e7f56={'count':0x0,'rows':[]};var _0x2de35c=_[_0xcbb9('0x2d')](db[_0xcbb9('0x2e')][_0xcbb9('0x2f')],function(_0x48465f){return{'name':_0x48465f['fieldName'],'type':_0x48465f['type'][_0xcbb9('0x30')]};});_0x4accea[_0xcbb9('0x31')]=_[_0xcbb9('0x2d')](_0x2de35c,_0xcbb9('0x2a'));_0x4accea[_0xcbb9('0x32')]=_[_0xcbb9('0x33')](_0x3781dc[_0xcbb9('0x32')]);_0x4accea[_0xcbb9('0x34')]=_[_0xcbb9('0x35')](_0x4accea['model'],_0x4accea[_0xcbb9('0x32')]);_0x400963[_0xcbb9('0x36')]=_[_0xcbb9('0x35')](_0x4accea['model'],qs[_0xcbb9('0x37')](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x37')]));_0x400963['attributes']=_0x400963[_0xcbb9('0x36')]['length']?_0x400963[_0xcbb9('0x36')]:_0x4accea[_0xcbb9('0x31')];if(!_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x38')](_0xcbb9('0x39'))){_0x400963[_0xcbb9('0x1e')]=qs[_0xcbb9('0x1e')](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x1e')]);_0x400963['offset']=qs['offset'](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x1c')]);}_0x400963[_0xcbb9('0x3a')]=qs[_0xcbb9('0x3b')](_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x3b')]);_0x400963[_0xcbb9('0x3c')]=qs['filters'](_[_0xcbb9('0x3d')](_0x3781dc[_0xcbb9('0x32')],_0x4accea[_0xcbb9('0x34')]),_0x2de35c);if(_0x3781dc[_0xcbb9('0x32')]['filter']){_0x400963[_0xcbb9('0x3c')]=_[_0xcbb9('0x3e')](_0x400963[_0xcbb9('0x3c')],{'$or':_['map'](_0x2de35c,function(_0x251719){if(_0x251719['type']!==_0xcbb9('0x3f')){var _0x1b81dc={};_0x1b81dc[_0x251719['name']]={'$like':'%'+_0x3781dc[_0xcbb9('0x32')][_0xcbb9('0x40')]+'%'};return _0x1b81dc;}})});}_0x400963=_['merge']({},_0x400963,_0x3781dc[_0xcbb9('0x41')]);var _0x202505={'where':_0x400963[_0xcbb9('0x3c')]};return db[_0xcbb9('0x2e')][_0xcbb9('0x1f')](_0x202505)[_0xcbb9('0x24')](function(_0x21c965){_0x3e7f56['count']=_0x21c965;if(_0x3781dc['query']['includeAll']){_0x400963[_0xcbb9('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xcbb9('0x43')](_0x400963);})[_0xcbb9('0x24')](function(_0x2370ea){_0x3e7f56['rows']=_0x2370ea;return _0x3e7f56;})[_0xcbb9('0x24')](respondWithFilteredResult(_0x999f43,_0x400963))[_0xcbb9('0x44')](handleError(_0x999f43,null));};exports[_0xcbb9('0x45')]=function(_0xc51c2f,_0x4d2510){var _0x2107a1={'raw':!![],'where':{'id':_0xc51c2f[_0xcbb9('0x46')]['id']}},_0x403b19={};_0x403b19[_0xcbb9('0x31')]=_['keys'](db[_0xcbb9('0x2e')]['rawAttributes']);_0x403b19[_0xcbb9('0x32')]=_[_0xcbb9('0x33')](_0xc51c2f[_0xcbb9('0x32')]);_0x403b19[_0xcbb9('0x34')]=_['intersection'](_0x403b19[_0xcbb9('0x31')],_0x403b19['query']);_0x2107a1['attributes']=_[_0xcbb9('0x35')](_0x403b19[_0xcbb9('0x31')],qs[_0xcbb9('0x37')](_0xc51c2f[_0xcbb9('0x32')][_0xcbb9('0x37')]));_0x2107a1[_0xcbb9('0x36')]=_0x2107a1[_0xcbb9('0x36')]['length']?_0x2107a1[_0xcbb9('0x36')]:_0x403b19[_0xcbb9('0x31')];if(_0xc51c2f['query'][_0xcbb9('0x47')]){_0x2107a1[_0xcbb9('0x42')]=[{'all':!![]}];}_0x2107a1=_[_0xcbb9('0x3e')]({},_0x2107a1,_0xc51c2f[_0xcbb9('0x41')]);return db[_0xcbb9('0x2e')]['find'](_0x2107a1)['then'](handleEntityNotFound(_0x4d2510,null))[_0xcbb9('0x24')](respondWithResult(_0x4d2510,null))[_0xcbb9('0x44')](handleError(_0x4d2510,null));};exports[_0xcbb9('0x48')]=function(_0xc08f00,_0x5c7931){return db['AnalyticExtractedReport']['create'](_0xc08f00[_0xcbb9('0x49')],{})[_0xcbb9('0x24')](function(_0x4935b6){var _0xf74f40=_0xc08f00['user']['get']({'plain':!![]});if(!_0xf74f40)throw new Error(_0xcbb9('0x4a'));if(_0xf74f40['role']===_0xcbb9('0x4b')){var _0x36287a=_0x4935b6[_0xcbb9('0x26')]({'plain':!![]});var _0x558c44='ExtractedReports';return db[_0xcbb9('0x4c')][_0xcbb9('0x4d')]({'where':{'name':_0x558c44,'userProfileId':_0xf74f40[_0xcbb9('0x4e')]},'raw':!![]})['then'](function(_0x4b2b85){if(_0x4b2b85&&_0x4b2b85[_0xcbb9('0x4f')]===0x0){return db[_0xcbb9('0x28')][_0xcbb9('0x48')]({'name':_0x36287a['name'],'resourceId':_0x36287a['id'],'type':_0x4b2b85[_0xcbb9('0x2a')],'sectionId':_0x4b2b85['id']},{})[_0xcbb9('0x24')](function(){return _0x4935b6;});}else{return _0x4935b6;}})[_0xcbb9('0x44')](function(_0x23c5d8){logger['error'](_0xcbb9('0x50'),_0x23c5d8);throw _0x23c5d8;});}return _0x4935b6;})[_0xcbb9('0x24')](respondWithResult(_0x5c7931,0xc9))['catch'](handleError(_0x5c7931,null));};exports[_0xcbb9('0x51')]=function(_0x6741d8,_0x22a16f){if(_0x6741d8[_0xcbb9('0x49')]['id']){delete _0x6741d8[_0xcbb9('0x49')]['id'];}return db[_0xcbb9('0x2e')]['find']({'where':{'id':_0x6741d8[_0xcbb9('0x46')]['id']}})[_0xcbb9('0x24')](handleEntityNotFound(_0x22a16f,null))[_0xcbb9('0x24')](saveUpdates(_0x6741d8[_0xcbb9('0x49')],null))[_0xcbb9('0x24')](respondWithResult(_0x22a16f,null))[_0xcbb9('0x44')](handleError(_0x22a16f,null));};exports[_0xcbb9('0x25')]=function(_0x39e2b2,_0x42a5f7){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x39e2b2[_0xcbb9('0x46')]['id']}})[_0xcbb9('0x24')](handleEntityNotFound(_0x42a5f7,null))[_0xcbb9('0x24')](removeEntity(_0x42a5f7,null))[_0xcbb9('0x44')](handleError(_0x42a5f7,null));};exports['download']=function(_0x49e7b8,_0x3ee2d3,_0x1f4c1f){return db[_0xcbb9('0x2e')]['find']({'where':{'id':_0x49e7b8[_0xcbb9('0x46')]['id']},'attributes':[_0xcbb9('0x2a'),'basename',_0xcbb9('0x52'),_0xcbb9('0x53')],'raw':!![]})[_0xcbb9('0x24')](handleEntityNotFound(_0x3ee2d3,null))[_0xcbb9('0x24')](function(_0x29a1b7){if(_0x29a1b7){if(!fs[_0xcbb9('0x54')](path[_0xcbb9('0x55')](config['root'],_0xcbb9('0x56'),_0x29a1b7['savename']))){throw new db[(_0xcbb9('0x57'))][(_0xcbb9('0x58'))](_0xcbb9('0x59'));}if(_0x49e7b8[_0xcbb9('0x32')][_0xcbb9('0x5a')]){return _0x3ee2d3[_0xcbb9('0x18')](0xc8);}return _0x3ee2d3[_0xcbb9('0x5b')](path[_0xcbb9('0x55')](config[_0xcbb9('0x5c')],_0xcbb9('0x56'),_0x29a1b7[_0xcbb9('0x52')]),util[_0xcbb9('0x5d')](_0xcbb9('0x5e'),_0x29a1b7[_0xcbb9('0x5f')]||_0x29a1b7[_0xcbb9('0x2a')],_0x29a1b7[_0xcbb9('0x53')][_0xcbb9('0x60')]()));}})['catch'](handleError(_0x3ee2d3,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index fe2f297..e9dd322 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 _0x0dc4=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x417b30,_0x5832f5){var _0x5e9a51=function(_0x29ee4b){while(--_0x29ee4b){_0x417b30['push'](_0x417b30['shift']());}};_0x5e9a51(++_0x5832f5);}(_0x0dc4,0x1d0));var _0x40dc=function(_0x22ac5b,_0x2ef85c){_0x22ac5b=_0x22ac5b-0x0;var _0x4b5cc4=_0x0dc4[_0x22ac5b];return _0x4b5cc4;};'use strict';var _=require('lodash');var util=require(_0x40dc('0x0'));var logger=require(_0x40dc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x40dc('0x2'));var rp=require(_0x40dc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40dc('0x4'));var config=require(_0x40dc('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0x40dc('0x6')]=function(_0x563852,_0x58d58d){return _0x563852[_0x40dc('0x7')](_0x40dc('0x8'),attributes,{'tableName':_0x40dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7274=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','AnalyticExtractedReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7274,0x136));var _0x4727=function(_0x3401ff,_0x465a74){_0x3401ff=_0x3401ff-0x0;var _0x2cb407=_0x7274[_0x3401ff];return _0x2cb407;};'use strict';var _=require(_0x4727('0x0'));var util=require(_0x4727('0x1'));var logger=require('../../config/logger')(_0x4727('0x2'));var moment=require(_0x4727('0x3'));var BPromise=require(_0x4727('0x4'));var rp=require(_0x4727('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4727('0x6'));var config=require(_0x4727('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x4727('0x8')]=function(_0x549df7,_0x532af3){return _0x549df7['define'](_0x4727('0x9'),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 6f5a2e0..ce2096c 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 _0xe39c=['../../config/utils','../../config/logger','rpc','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3a7614,_0x450eaa){var _0x37a549=function(_0x1151b1){while(--_0x1151b1){_0x3a7614['push'](_0x3a7614['shift']());}};_0x37a549(++_0x450eaa);}(_0xe39c,0x135));var _0xce39=function(_0x491768,_0x44a0e8){_0x491768=_0x491768-0x0;var _0x567b81=_0xe39c[_0x491768];return _0x567b81;};'use strict';var _=require(_0xce39('0x0'));var util=require(_0xce39('0x1'));var moment=require(_0xce39('0x2'));var BPromise=require(_0xce39('0x3'));var rs=require(_0xce39('0x4'));var fs=require('fs');var Redis=require(_0xce39('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xce39('0x6'));var logger=require(_0xce39('0x7'))(_0xce39('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xce39('0x9')][_0xce39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x310117,_0x44045a,_0xf46620){return new BPromise(function(_0x4ff25b,_0x419b20){return client['request'](_0x310117,_0xf46620)[_0xce39('0xb')](function(_0x252a74){logger[_0xce39('0xc')](_0xce39('0xd'),_0x44045a,'request\x20sent');logger[_0xce39('0xe')](_0xce39('0xf'),_0x44045a,'request\x20sent',JSON['stringify'](_0x252a74));if(_0x252a74[_0xce39('0x10')]){if(_0x252a74['error'][_0xce39('0x11')]===0x1f4){logger[_0xce39('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44045a,_0x252a74['error'][_0xce39('0x12')]);return _0x419b20(_0x252a74[_0xce39('0x10')][_0xce39('0x12')]);}logger[_0xce39('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44045a,_0x252a74[_0xce39('0x10')][_0xce39('0x12')]);return _0x4ff25b(_0x252a74[_0xce39('0x10')][_0xce39('0x12')]);}else{logger['info'](_0xce39('0xd'),_0x44045a,_0xce39('0x13'));_0x4ff25b(_0x252a74['result'][_0xce39('0x12')]);}})[_0xce39('0x14')](function(_0x603eb9){logger[_0xce39('0x10')](_0xce39('0xd'),_0x44045a,_0x603eb9);_0x419b20(_0x603eb9);});});} \ No newline at end of file +var _0x5635=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','util','bluebird'];(function(_0x24dc8f,_0x14b7e8){var _0x189c9b=function(_0x25b498){while(--_0x25b498){_0x24dc8f['push'](_0x24dc8f['shift']());}};_0x189c9b(++_0x14b7e8);}(_0x5635,0xbb));var _0x5563=function(_0x144045,_0x3b68b1){_0x144045=_0x144045-0x0;var _0x12a942=_0x5635[_0x144045];return _0x12a942;};'use strict';var _=require('lodash');var util=require(_0x5563('0x0'));var moment=require('moment');var BPromise=require(_0x5563('0x1'));var rs=require(_0x5563('0x2'));var fs=require('fs');var Redis=require(_0x5563('0x3'));var db=require(_0x5563('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5563('0x5'))(_0x5563('0x6'));var config=require(_0x5563('0x7'));var jayson=require(_0x5563('0x8'));var client=jayson[_0x5563('0x9')][_0x5563('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477c7b,_0x307f1a,_0x2dcf5b){return new BPromise(function(_0x36d77f,_0x479c2f){return client['request'](_0x477c7b,_0x2dcf5b)[_0x5563('0xb')](function(_0x89306f){logger[_0x5563('0xc')](_0x5563('0xd'),_0x307f1a,'request\x20sent');logger[_0x5563('0xe')](_0x5563('0xf'),_0x307f1a,'request\x20sent',JSON[_0x5563('0x10')](_0x89306f));if(_0x89306f[_0x5563('0x11')]){if(_0x89306f[_0x5563('0x11')][_0x5563('0x12')]===0x1f4){logger[_0x5563('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x307f1a,_0x89306f[_0x5563('0x11')][_0x5563('0x13')]);return _0x479c2f(_0x89306f['error'][_0x5563('0x13')]);}logger[_0x5563('0x11')](_0x5563('0xd'),_0x307f1a,_0x89306f[_0x5563('0x11')][_0x5563('0x13')]);return _0x36d77f(_0x89306f[_0x5563('0x11')][_0x5563('0x13')]);}else{logger[_0x5563('0xc')](_0x5563('0xd'),_0x307f1a,_0x5563('0x14'));_0x36d77f(_0x89306f['result'][_0x5563('0x13')]);}})['catch'](function(_0x211b09){logger[_0x5563('0x11')](_0x5563('0xd'),_0x307f1a,_0x211b09);_0x479c2f(_0x211b09);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 84e3fbc..2e540eb 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 _0x2d2b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','get','/:id','post','create','put','update','delete','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d2b,0xa9));var _0xb2d2=function(_0x406efe,_0x5c17d5){_0x406efe=_0x406efe-0x0;var _0x1aa088=_0x2d2b[_0x406efe];return _0x1aa088;};'use strict';var multer=require(_0xb2d2('0x0'));var util=require(_0xb2d2('0x1'));var path=require(_0xb2d2('0x2'));var timeout=require(_0xb2d2('0x3'));var express=require(_0xb2d2('0x4'));var router=express[_0xb2d2('0x5')]();var fs_extra=require(_0xb2d2('0x6'));var auth=require(_0xb2d2('0x7'));var interaction=require(_0xb2d2('0x8'));var config=require('../../config/environment');var controller=require(_0xb2d2('0x9'));router['get']('/',auth[_0xb2d2('0xa')](),controller['index']);router[_0xb2d2('0xb')](_0xb2d2('0xc'),auth[_0xb2d2('0xa')](),controller['show']);router['get']('/:id/download',auth[_0xb2d2('0xa')](),controller['download']);router[_0xb2d2('0xd')]('/',auth[_0xb2d2('0xa')](),controller[_0xb2d2('0xe')]);router[_0xb2d2('0xf')](_0xb2d2('0xc'),auth[_0xb2d2('0xa')](),controller[_0xb2d2('0x10')]);router[_0xb2d2('0x11')]('/:id',auth[_0xb2d2('0xa')](),controller['destroy']);module[_0xb2d2('0x12')]=router; \ No newline at end of file +var _0x9f8b=['/:id/download','post','create','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated'];(function(_0x261cfc,_0x3fe3d3){var _0x5cb3eb=function(_0x3cb4f3){while(--_0x3cb4f3){_0x261cfc['push'](_0x261cfc['shift']());}};_0x5cb3eb(++_0x3fe3d3);}(_0x9f8b,0x106));var _0xb9f8=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x9f8b[_0x109371];return _0x4fd858;};'use strict';var multer=require(_0xb9f8('0x0'));var util=require(_0xb9f8('0x1'));var path=require('path');var timeout=require(_0xb9f8('0x2'));var express=require('express');var router=express[_0xb9f8('0x3')]();var fs_extra=require(_0xb9f8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb9f8('0x5'));var controller=require(_0xb9f8('0x6'));router[_0xb9f8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb9f8('0x8'),auth[_0xb9f8('0x9')](),controller['show']);router[_0xb9f8('0x7')](_0xb9f8('0xa'),auth['isAuthenticated'](),controller['download']);router[_0xb9f8('0xb')]('/',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb9f8('0xd')]);router[_0xb9f8('0xe')](_0xb9f8('0x8'),auth[_0xb9f8('0x9')](),controller['destroy']);module[_0xb9f8('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 7ffd35a..ca919dd 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 _0xbefd=['STRING','BOOLEAN','exports','TEXT'];(function(_0x25ecaf,_0x3e9fc1){var _0x41ae78=function(_0x22b6bf){while(--_0x22b6bf){_0x25ecaf['push'](_0x25ecaf['shift']());}};_0x41ae78(++_0x3e9fc1);}(_0xbefd,0x106));var _0xdbef=function(_0x333cd8,_0x47221b){_0x333cd8=_0x333cd8-0x0;var _0x1f0b96=_0xbefd[_0x333cd8];return _0x1f0b96;};'use strict';var Sequelize=require('sequelize');module[_0xdbef('0x0')]={'field':{'type':Sequelize[_0xdbef('0x1')]},'alias':{'type':Sequelize[_0xdbef('0x2')]},'function':{'type':Sequelize[_0xdbef('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xdbef('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xdbef('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x81a1=['sequelize','exports','STRING','BOOLEAN'];(function(_0x10071d,_0x4c5399){var _0x128675=function(_0x378827){while(--_0x378827){_0x10071d['push'](_0x10071d['shift']());}};_0x128675(++_0x4c5399);}(_0x81a1,0x110));var _0x181a=function(_0x56b3fe,_0x3f1224){_0x56b3fe=_0x56b3fe-0x0;var _0x998277=_0x81a1[_0x56b3fe];return _0x998277;};'use strict';var Sequelize=require(_0x181a('0x0'));module[_0x181a('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x181a('0x2')]},'function':{'type':Sequelize[_0x181a('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x181a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x181a('0x2')]},'custom':{'type':Sequelize[_0x181a('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 49f5ab9..c8cd50c 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 _0x25c7=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x466e08,_0x5c4d83){var _0x417cbb=function(_0x89c0a4){while(--_0x89c0a4){_0x466e08['push'](_0x466e08['shift']());}};_0x417cbb(++_0x5c4d83);}(_0x25c7,0x99));var _0x725c=function(_0x5b84c4,_0xb7e5e8){_0x5b84c4=_0x5b84c4-0x0;var _0x37c25f=_0x25c7[_0x5b84c4];return _0x37c25f;};'use strict';var emlformat=require(_0x725c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x725c('0x1'));var jsonpatch=require(_0x725c('0x2'));var rp=require('request-promise');var moment=require(_0x725c('0x3'));var BPromise=require(_0x725c('0x4'));var Mustache=require(_0x725c('0x5'));var util=require(_0x725c('0x6'));var path=require(_0x725c('0x7'));var sox=require(_0x725c('0x8'));var csv=require(_0x725c('0x9'));var ejs=require(_0x725c('0xa'));var fs=require('fs');var fs_extra=require(_0x725c('0xb'));var _=require(_0x725c('0xc'));var squel=require('squel');var crypto=require(_0x725c('0xd'));var jsforce=require(_0x725c('0xe'));var deskjs=require(_0x725c('0xf'));var toCsv=require(_0x725c('0x9'));var querystring=require(_0x725c('0x10'));var Papa=require(_0x725c('0x11'));var Redis=require(_0x725c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x725c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x725c('0x14'));var logger=require(_0x725c('0x15'))(_0x725c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x725c('0x17'))['db'];function respondWithStatusCode(_0x2f5d55,_0x53148b){_0x53148b=_0x53148b||0xcc;return function(_0x4308af){if(_0x4308af){return _0x2f5d55[_0x725c('0x18')](_0x53148b);}return _0x2f5d55[_0x725c('0x19')](_0x53148b)[_0x725c('0x1a')]();};}function respondWithResult(_0x42d864,_0x4b4d09){_0x4b4d09=_0x4b4d09||0xc8;return function(_0x1c99a9){if(_0x1c99a9){return _0x42d864['status'](_0x4b4d09)[_0x725c('0x1b')](_0x1c99a9);}};}function respondWithFilteredResult(_0x3a635a,_0x291212){return function(_0xad2875){if(_0xad2875){var _0x1b4a60=typeof _0x291212['offset']===_0x725c('0x1c')&&typeof _0x291212[_0x725c('0x1d')]===_0x725c('0x1c');var _0x2b32bc=_0xad2875[_0x725c('0x1e')];var _0x388f27=_0x1b4a60?0x0:_0x291212[_0x725c('0x1f')];var _0x170751=_0x1b4a60?_0xad2875[_0x725c('0x1e')]:_0x291212[_0x725c('0x1f')]+_0x291212[_0x725c('0x1d')];var _0x502ee0;if(_0x170751>=_0x2b32bc){_0x170751=_0x2b32bc;_0x502ee0=0xc8;}else{_0x502ee0=0xce;}_0x3a635a[_0x725c('0x19')](_0x502ee0);return _0x3a635a[_0x725c('0x20')](_0x725c('0x21'),_0x388f27+'-'+_0x170751+'/'+_0x2b32bc)[_0x725c('0x1b')](_0xad2875);}return null;};}function patchUpdates(_0x1c2383){return function(_0x43e257){try{jsonpatch['apply'](_0x43e257,_0x1c2383,!![]);}catch(_0x26329e){return BPromise[_0x725c('0x22')](_0x26329e);}return _0x43e257[_0x725c('0x23')]();};}function saveUpdates(_0xdb7fc2,_0xd8ddf8){return function(_0x4c76d5){if(_0x4c76d5){return _0x4c76d5[_0x725c('0x24')](_0xdb7fc2)['then'](function(_0x1c0a0e){return _0x1c0a0e;});}return null;};}function removeEntity(_0x2c0ae2,_0x1ba2fb){return function(_0x58e00c){if(_0x58e00c){return _0x58e00c[_0x725c('0x25')]()[_0x725c('0x26')](function(){_0x2c0ae2[_0x725c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29655f,_0x20c6b5){return function(_0xd6722c){if(!_0xd6722c){_0x29655f[_0x725c('0x18')](0x194);}return _0xd6722c;};}function handleError(_0x38ddf5,_0x5e43b6){_0x5e43b6=_0x5e43b6||0x1f4;return function(_0xce4f7d){logger[_0x725c('0x27')](_0xce4f7d['stack']);if(_0xce4f7d[_0x725c('0x28')]){delete _0xce4f7d[_0x725c('0x28')];}_0x38ddf5['status'](_0x5e43b6)[_0x725c('0x29')](_0xce4f7d);};}exports[_0x725c('0x2a')]=function(_0x2855c0,_0x41b4ff){var _0x45035d={},_0x2a70b2={},_0x1634ee={'count':0x0,'rows':[]};var _0x4e1ad0=_[_0x725c('0x2b')](db[_0x725c('0x2c')][_0x725c('0x2d')],function(_0x4c494d){return{'name':_0x4c494d[_0x725c('0x2e')],'type':_0x4c494d[_0x725c('0x2f')][_0x725c('0x30')]};});_0x2a70b2[_0x725c('0x31')]=_[_0x725c('0x2b')](_0x4e1ad0,'name');_0x2a70b2[_0x725c('0x32')]=_[_0x725c('0x33')](_0x2855c0['query']);_0x2a70b2['filters']=_[_0x725c('0x34')](_0x2a70b2[_0x725c('0x31')],_0x2a70b2[_0x725c('0x32')]);_0x45035d[_0x725c('0x35')]=_[_0x725c('0x34')](_0x2a70b2['model'],qs[_0x725c('0x36')](_0x2855c0[_0x725c('0x32')][_0x725c('0x36')]));_0x45035d[_0x725c('0x35')]=_0x45035d[_0x725c('0x35')][_0x725c('0x37')]?_0x45035d['attributes']:_0x2a70b2['model'];if(!_0x2855c0[_0x725c('0x32')][_0x725c('0x38')]('nolimit')){_0x45035d['limit']=qs[_0x725c('0x1d')](_0x2855c0['query'][_0x725c('0x1d')]);_0x45035d['offset']=qs['offset'](_0x2855c0['query']['offset']);}_0x45035d[_0x725c('0x39')]=qs[_0x725c('0x3a')](_0x2855c0['query']['sort']);_0x45035d[_0x725c('0x3b')]=qs['filters'](_[_0x725c('0x3c')](_0x2855c0[_0x725c('0x32')],_0x2a70b2[_0x725c('0x3d')]),_0x4e1ad0);if(_0x2855c0[_0x725c('0x32')][_0x725c('0x3e')]){_0x45035d[_0x725c('0x3b')]=_[_0x725c('0x3f')](_0x45035d[_0x725c('0x3b')],{'$or':_[_0x725c('0x2b')](_0x4e1ad0,function(_0x159eaa){if(_0x159eaa[_0x725c('0x2f')]!==_0x725c('0x40')){var _0x36e5ed={};_0x36e5ed[_0x159eaa['name']]={'$like':'%'+_0x2855c0[_0x725c('0x32')]['filter']+'%'};return _0x36e5ed;}})});}_0x45035d=_[_0x725c('0x3f')]({},_0x45035d,_0x2855c0['options']);var _0x4ecb26={'where':_0x45035d['where']};return db[_0x725c('0x2c')][_0x725c('0x1e')](_0x4ecb26)[_0x725c('0x26')](function(_0x202f32){_0x1634ee['count']=_0x202f32;if(_0x2855c0[_0x725c('0x32')][_0x725c('0x41')]){_0x45035d[_0x725c('0x42')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x725c('0x43')](_0x45035d);})[_0x725c('0x26')](function(_0x45838e){_0x1634ee[_0x725c('0x44')]=_0x45838e;return _0x1634ee;})[_0x725c('0x26')](respondWithFilteredResult(_0x41b4ff,_0x45035d))['catch'](handleError(_0x41b4ff,null));};exports[_0x725c('0x45')]=function(_0x4abcb2,_0x472f49){var _0x244279={'raw':![],'where':{'id':_0x4abcb2[_0x725c('0x46')]['id']}},_0x4673f8={};_0x4673f8[_0x725c('0x31')]=_[_0x725c('0x33')](db['AnalyticFieldReport'][_0x725c('0x2d')]);_0x4673f8[_0x725c('0x32')]=_[_0x725c('0x33')](_0x4abcb2[_0x725c('0x32')]);_0x4673f8[_0x725c('0x3d')]=_[_0x725c('0x34')](_0x4673f8[_0x725c('0x31')],_0x4673f8[_0x725c('0x32')]);_0x244279[_0x725c('0x35')]=_[_0x725c('0x34')](_0x4673f8[_0x725c('0x31')],qs['fields'](_0x4abcb2[_0x725c('0x32')][_0x725c('0x36')]));_0x244279[_0x725c('0x35')]=_0x244279['attributes']['length']?_0x244279[_0x725c('0x35')]:_0x4673f8[_0x725c('0x31')];if(_0x4abcb2['query'][_0x725c('0x41')]){_0x244279['include']=[{'all':!![]}];}_0x244279=_[_0x725c('0x3f')]({},_0x244279,_0x4abcb2[_0x725c('0x47')]);return db['AnalyticFieldReport'][_0x725c('0x48')](_0x244279)[_0x725c('0x26')](handleEntityNotFound(_0x472f49,null))[_0x725c('0x26')](respondWithResult(_0x472f49,null))[_0x725c('0x49')](handleError(_0x472f49,null));};exports['create']=function(_0x3e2d47,_0x43307e){return db[_0x725c('0x2c')][_0x725c('0x4a')](_0x3e2d47[_0x725c('0x4b')],{})['then'](respondWithResult(_0x43307e,0xc9))[_0x725c('0x49')](handleError(_0x43307e,null));};exports[_0x725c('0x4c')]=function(_0x5a8aec,_0x578917){return db[_0x725c('0x2c')]['bulkCreate'](_0x5a8aec['body'],{'raw':![],'individualHooks':!![]})[_0x725c('0x26')](respondWithResult(_0x578917,0xc9))['catch'](handleError(_0x578917,null));};exports[_0x725c('0x24')]=function(_0x3fe07f,_0x150013){if(_0x3fe07f[_0x725c('0x4b')]['id']){delete _0x3fe07f['body']['id'];}return db[_0x725c('0x2c')][_0x725c('0x48')]({'where':{'id':_0x3fe07f['params']['id']}})[_0x725c('0x26')](handleEntityNotFound(_0x150013,null))[_0x725c('0x26')](saveUpdates(_0x3fe07f[_0x725c('0x4b')],null))[_0x725c('0x26')](respondWithResult(_0x150013,null))[_0x725c('0x49')](handleError(_0x150013,null));};exports[_0x725c('0x25')]=function(_0x3a58fb,_0x33d431){return db[_0x725c('0x2c')][_0x725c('0x48')]({'where':{'id':_0x3a58fb[_0x725c('0x46')]['id']}})['then'](handleEntityNotFound(_0x33d431,null))['then'](removeEntity(_0x33d431,null))[_0x725c('0x49')](handleError(_0x33d431,null));};exports[_0x725c('0x4d')]=function(_0x2232b1,_0x146bf5){return db[_0x725c('0x2c')][_0x725c('0x25')]({'where':{'id':_0x2232b1[_0x725c('0x32')][_0x725c('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x725c('0x26')](respondWithResult(_0x146bf5,0xcc))['catch'](handleError(_0x146bf5,null));};exports[_0x725c('0x4f')]=function(_0xf655e6,_0x28b29b,_0x4002b9){return db[_0x725c('0x50')][_0x725c('0x51')]({'where':{'id':_0xf655e6['params']['id']}})[_0x725c('0x26')](handleEntityNotFound(_0x28b29b,null))[_0x725c('0x26')](function(_0x491823){if(_0x491823){return db[_0x725c('0x52')]['transaction'](function(_0x59bd69){return db['AnalyticFieldReport'][_0x725c('0x25')]({'where':{'CustomReportId':_0xf655e6[_0x725c('0x46')]['id']},'transaction':_0x59bd69})[_0x725c('0x26')](function(_0x442e39){var _0x53e38f=_[_0x725c('0x2b')](_0xf655e6['body'],function(_0x3e9811){delete _0x3e9811['id'];_0x3e9811[_0x725c('0x53')]=_0xf655e6['params']['id'];return _0x3e9811;});return db[_0x725c('0x2c')][_0x725c('0x4c')](_0x53e38f,{'transaction':_0x59bd69});});})[_0x725c('0x26')](function(){return db['AnalyticFieldReport'][_0x725c('0x43')]({'where':{'CustomReportId':_0xf655e6['params']['id']}});});}})[_0x725c('0x26')](respondWithResult(_0x28b29b,null))[_0x725c('0x49')](handleError(_0x28b29b,null));}; \ No newline at end of file +var _0xb582=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','query','keys','intersection','model','attributes','length','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','params','find','create','body','catch','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5a6e3c,_0x28faa0){var _0x3bc48c=function(_0x5ccacf){while(--_0x5ccacf){_0x5a6e3c['push'](_0x5a6e3c['shift']());}};_0x3bc48c(++_0x28faa0);}(_0xb582,0xda));var _0x2b58=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb582[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x2b58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b58('0x1'));var jsonpatch=require(_0x2b58('0x2'));var rp=require(_0x2b58('0x3'));var moment=require(_0x2b58('0x4'));var BPromise=require(_0x2b58('0x5'));var Mustache=require('mustache');var util=require(_0x2b58('0x6'));var path=require(_0x2b58('0x7'));var sox=require('sox');var csv=require(_0x2b58('0x8'));var ejs=require(_0x2b58('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b58('0xa'));var squel=require('squel');var crypto=require(_0x2b58('0xb'));var jsforce=require(_0x2b58('0xc'));var deskjs=require(_0x2b58('0xd'));var toCsv=require(_0x2b58('0x8'));var querystring=require(_0x2b58('0xe'));var Papa=require(_0x2b58('0xf'));var Redis=require(_0x2b58('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2b58('0x11'));var as=require(_0x2b58('0x12'));var hardwareService=require(_0x2b58('0x13'));var logger=require('../../config/logger')(_0x2b58('0x14'));var utils=require(_0x2b58('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2b58('0x16'));var db=require(_0x2b58('0x17'))['db'];function respondWithStatusCode(_0x435470,_0x522994){_0x522994=_0x522994||0xcc;return function(_0x1d6988){if(_0x1d6988){return _0x435470[_0x2b58('0x18')](_0x522994);}return _0x435470[_0x2b58('0x19')](_0x522994)[_0x2b58('0x1a')]();};}function respondWithResult(_0x124610,_0x1c9fa8){_0x1c9fa8=_0x1c9fa8||0xc8;return function(_0x410535){if(_0x410535){return _0x124610['status'](_0x1c9fa8)[_0x2b58('0x1b')](_0x410535);}};}function respondWithFilteredResult(_0x4993f7,_0x42b9cb){return function(_0x543cfa){if(_0x543cfa){var _0x2fda73=typeof _0x42b9cb[_0x2b58('0x1c')]==='undefined'&&typeof _0x42b9cb[_0x2b58('0x1d')]==='undefined';var _0x4ac18f=_0x543cfa[_0x2b58('0x1e')];var _0x5c9ea1=_0x2fda73?0x0:_0x42b9cb[_0x2b58('0x1c')];var _0x51cd21=_0x2fda73?_0x543cfa[_0x2b58('0x1e')]:_0x42b9cb[_0x2b58('0x1c')]+_0x42b9cb[_0x2b58('0x1d')];var _0x2a8d62;if(_0x51cd21>=_0x4ac18f){_0x51cd21=_0x4ac18f;_0x2a8d62=0xc8;}else{_0x2a8d62=0xce;}_0x4993f7[_0x2b58('0x19')](_0x2a8d62);return _0x4993f7[_0x2b58('0x1f')](_0x2b58('0x20'),_0x5c9ea1+'-'+_0x51cd21+'/'+_0x4ac18f)['json'](_0x543cfa);}return null;};}function patchUpdates(_0x3ced3a){return function(_0x4b1837){try{jsonpatch[_0x2b58('0x21')](_0x4b1837,_0x3ced3a,!![]);}catch(_0x3efee5){return BPromise[_0x2b58('0x22')](_0x3efee5);}return _0x4b1837[_0x2b58('0x23')]();};}function saveUpdates(_0x24af76,_0x17b8ae){return function(_0x3d87b0){if(_0x3d87b0){return _0x3d87b0[_0x2b58('0x24')](_0x24af76)[_0x2b58('0x25')](function(_0x297ecd){return _0x297ecd;});}return null;};}function removeEntity(_0x736a36,_0x50fdbd){return function(_0x5482f1){if(_0x5482f1){return _0x5482f1[_0x2b58('0x26')]()[_0x2b58('0x25')](function(){_0x736a36[_0x2b58('0x19')](0xcc)[_0x2b58('0x1a')]();});}};}function handleEntityNotFound(_0x56fca5,_0x4c11ab){return function(_0x294884){if(!_0x294884){_0x56fca5[_0x2b58('0x18')](0x194);}return _0x294884;};}function handleError(_0x496615,_0x54bf0b){_0x54bf0b=_0x54bf0b||0x1f4;return function(_0x1f1c18){logger[_0x2b58('0x27')](_0x1f1c18[_0x2b58('0x28')]);if(_0x1f1c18['name']){delete _0x1f1c18[_0x2b58('0x29')];}_0x496615[_0x2b58('0x19')](_0x54bf0b)[_0x2b58('0x2a')](_0x1f1c18);};}exports[_0x2b58('0x2b')]=function(_0xc0dceb,_0x1c6d3a){var _0x3728ae={},_0x168e65={},_0x1454d9={'count':0x0,'rows':[]};var _0x362069=_[_0x2b58('0x2c')](db[_0x2b58('0x2d')][_0x2b58('0x2e')],function(_0x577aa1){return{'name':_0x577aa1[_0x2b58('0x2f')],'type':_0x577aa1['type']['key']};});_0x168e65['model']=_['map'](_0x362069,'name');_0x168e65[_0x2b58('0x30')]=_[_0x2b58('0x31')](_0xc0dceb[_0x2b58('0x30')]);_0x168e65['filters']=_[_0x2b58('0x32')](_0x168e65[_0x2b58('0x33')],_0x168e65[_0x2b58('0x30')]);_0x3728ae[_0x2b58('0x34')]=_[_0x2b58('0x32')](_0x168e65[_0x2b58('0x33')],qs['fields'](_0xc0dceb[_0x2b58('0x30')]['fields']));_0x3728ae['attributes']=_0x3728ae[_0x2b58('0x34')][_0x2b58('0x35')]?_0x3728ae[_0x2b58('0x34')]:_0x168e65[_0x2b58('0x33')];if(!_0xc0dceb[_0x2b58('0x30')]['hasOwnProperty']('nolimit')){_0x3728ae[_0x2b58('0x1d')]=qs[_0x2b58('0x1d')](_0xc0dceb['query'][_0x2b58('0x1d')]);_0x3728ae['offset']=qs[_0x2b58('0x1c')](_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x1c')]);}_0x3728ae[_0x2b58('0x36')]=qs[_0x2b58('0x37')](_0xc0dceb['query']['sort']);_0x3728ae[_0x2b58('0x38')]=qs[_0x2b58('0x39')](_[_0x2b58('0x3a')](_0xc0dceb['query'],_0x168e65[_0x2b58('0x39')]),_0x362069);if(_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x3b')]){_0x3728ae[_0x2b58('0x38')]=_['merge'](_0x3728ae[_0x2b58('0x38')],{'$or':_[_0x2b58('0x2c')](_0x362069,function(_0x275aeb){if(_0x275aeb[_0x2b58('0x3c')]!=='VIRTUAL'){var _0x3d8f1c={};_0x3d8f1c[_0x275aeb[_0x2b58('0x29')]]={'$like':'%'+_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x3b')]+'%'};return _0x3d8f1c;}})});}_0x3728ae=_[_0x2b58('0x3d')]({},_0x3728ae,_0xc0dceb[_0x2b58('0x3e')]);var _0x4afbc4={'where':_0x3728ae['where']};return db[_0x2b58('0x2d')][_0x2b58('0x1e')](_0x4afbc4)[_0x2b58('0x25')](function(_0x482fb1){_0x1454d9[_0x2b58('0x1e')]=_0x482fb1;if(_0xc0dceb[_0x2b58('0x30')][_0x2b58('0x3f')]){_0x3728ae[_0x2b58('0x40')]=[{'all':!![]}];}return db[_0x2b58('0x2d')][_0x2b58('0x41')](_0x3728ae);})['then'](function(_0x322f59){_0x1454d9[_0x2b58('0x42')]=_0x322f59;return _0x1454d9;})[_0x2b58('0x25')](respondWithFilteredResult(_0x1c6d3a,_0x3728ae))['catch'](handleError(_0x1c6d3a,null));};exports['show']=function(_0x3924d2,_0x183a3c){var _0x1bfc4f={'raw':![],'where':{'id':_0x3924d2[_0x2b58('0x43')]['id']}},_0x100efd={};_0x100efd['model']=_[_0x2b58('0x31')](db[_0x2b58('0x2d')][_0x2b58('0x2e')]);_0x100efd['query']=_['keys'](_0x3924d2[_0x2b58('0x30')]);_0x100efd['filters']=_[_0x2b58('0x32')](_0x100efd[_0x2b58('0x33')],_0x100efd[_0x2b58('0x30')]);_0x1bfc4f[_0x2b58('0x34')]=_[_0x2b58('0x32')](_0x100efd['model'],qs['fields'](_0x3924d2[_0x2b58('0x30')]['fields']));_0x1bfc4f[_0x2b58('0x34')]=_0x1bfc4f[_0x2b58('0x34')][_0x2b58('0x35')]?_0x1bfc4f['attributes']:_0x100efd['model'];if(_0x3924d2[_0x2b58('0x30')][_0x2b58('0x3f')]){_0x1bfc4f['include']=[{'all':!![]}];}_0x1bfc4f=_[_0x2b58('0x3d')]({},_0x1bfc4f,_0x3924d2[_0x2b58('0x3e')]);return db[_0x2b58('0x2d')][_0x2b58('0x44')](_0x1bfc4f)[_0x2b58('0x25')](handleEntityNotFound(_0x183a3c,null))[_0x2b58('0x25')](respondWithResult(_0x183a3c,null))['catch'](handleError(_0x183a3c,null));};exports[_0x2b58('0x45')]=function(_0x1b51b4,_0x5b4cd7){return db[_0x2b58('0x2d')][_0x2b58('0x45')](_0x1b51b4[_0x2b58('0x46')],{})['then'](respondWithResult(_0x5b4cd7,0xc9))[_0x2b58('0x47')](handleError(_0x5b4cd7,null));};exports[_0x2b58('0x48')]=function(_0x39cb74,_0x19e59e){return db[_0x2b58('0x2d')][_0x2b58('0x48')](_0x39cb74[_0x2b58('0x46')],{'raw':![],'individualHooks':!![]})[_0x2b58('0x25')](respondWithResult(_0x19e59e,0xc9))['catch'](handleError(_0x19e59e,null));};exports[_0x2b58('0x24')]=function(_0x42aadf,_0xb4862){if(_0x42aadf[_0x2b58('0x46')]['id']){delete _0x42aadf['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x42aadf[_0x2b58('0x43')]['id']}})[_0x2b58('0x25')](handleEntityNotFound(_0xb4862,null))['then'](saveUpdates(_0x42aadf[_0x2b58('0x46')],null))[_0x2b58('0x25')](respondWithResult(_0xb4862,null))[_0x2b58('0x47')](handleError(_0xb4862,null));};exports[_0x2b58('0x26')]=function(_0x5afa77,_0x517663){return db[_0x2b58('0x2d')]['find']({'where':{'id':_0x5afa77[_0x2b58('0x43')]['id']}})[_0x2b58('0x25')](handleEntityNotFound(_0x517663,null))[_0x2b58('0x25')](removeEntity(_0x517663,null))[_0x2b58('0x47')](handleError(_0x517663,null));};exports['bulkDestroy']=function(_0x30442f,_0x5a4fa0){return db[_0x2b58('0x2d')][_0x2b58('0x26')]({'where':{'id':_0x30442f['query'][_0x2b58('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x2b58('0x25')](respondWithResult(_0x5a4fa0,0xcc))[_0x2b58('0x47')](handleError(_0x5a4fa0,null));};exports[_0x2b58('0x4a')]=function(_0x3eb9ff,_0x166797,_0x143bc0){return db[_0x2b58('0x4b')][_0x2b58('0x4c')]({'where':{'id':_0x3eb9ff[_0x2b58('0x43')]['id']}})['then'](handleEntityNotFound(_0x166797,null))[_0x2b58('0x25')](function(_0x2f31df){if(_0x2f31df){return db['sequelize']['transaction'](function(_0x1b89a6){return db['AnalyticFieldReport'][_0x2b58('0x26')]({'where':{'CustomReportId':_0x3eb9ff[_0x2b58('0x43')]['id']},'transaction':_0x1b89a6})['then'](function(_0x5abb73){var _0x3b9209=_[_0x2b58('0x2c')](_0x3eb9ff[_0x2b58('0x46')],function(_0x10c692){delete _0x10c692['id'];_0x10c692[_0x2b58('0x4d')]=_0x3eb9ff[_0x2b58('0x43')]['id'];return _0x10c692;});return db[_0x2b58('0x2d')][_0x2b58('0x48')](_0x3b9209,{'transaction':_0x1b89a6});});})['then'](function(){return db[_0x2b58('0x2d')][_0x2b58('0x41')]({'where':{'CustomReportId':_0x3eb9ff[_0x2b58('0x43')]['id']}});});}})['then'](respondWithResult(_0x166797,null))[_0x2b58('0x47')](handleError(_0x166797,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6a9bb23..2acec07 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 _0x6fad=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2acbba,_0x5cb60f){var _0x4010e9=function(_0x5ab1bf){while(--_0x5ab1bf){_0x2acbba['push'](_0x2acbba['shift']());}};_0x4010e9(++_0x5cb60f);}(_0x6fad,0x117));var _0xd6fa=function(_0x4e6842,_0x468c69){_0x4e6842=_0x4e6842-0x0;var _0x2015d0=_0x6fad[_0x4e6842];return _0x2015d0;};'use strict';var _=require('lodash');var util=require(_0xd6fa('0x0'));var logger=require(_0xd6fa('0x1'))(_0xd6fa('0x2'));var moment=require('moment');var BPromise=require(_0xd6fa('0x3'));var rp=require(_0xd6fa('0x4'));var fs=require('fs');var path=require(_0xd6fa('0x5'));var rimraf=require(_0xd6fa('0x6'));var config=require(_0xd6fa('0x7'));var attributes=require(_0xd6fa('0x8'));module[_0xd6fa('0x9')]=function(_0x2a6899,_0x2754d9){return _0x2a6899[_0xd6fa('0xa')](_0xd6fa('0xb'),attributes,{'tableName':_0xd6fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd33f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x47ab40,_0x110b58){var _0x1b0a50=function(_0x3f0d4b){while(--_0x3f0d4b){_0x47ab40['push'](_0x47ab40['shift']());}};_0x1b0a50(++_0x110b58);}(_0xd33f,0x197));var _0xfd33=function(_0x375b13,_0x56813b){_0x375b13=_0x375b13-0x0;var _0x114f8f=_0xd33f[_0x375b13];return _0x114f8f;};'use strict';var _=require(_0xfd33('0x0'));var util=require('util');var logger=require(_0xfd33('0x1'))('api');var moment=require(_0xfd33('0x2'));var BPromise=require(_0xfd33('0x3'));var rp=require(_0xfd33('0x4'));var fs=require('fs');var path=require(_0xfd33('0x5'));var rimraf=require(_0xfd33('0x6'));var config=require(_0xfd33('0x7'));var attributes=require(_0xfd33('0x8'));module['exports']=function(_0x228aa5,_0x122eff){return _0x228aa5[_0xfd33('0x9')](_0xfd33('0xa'),attributes,{'tableName':_0xfd33('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 ea7a01a..68707fc 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 _0xa205=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xdc1176,_0x55c094){var _0x4d7c39=function(_0x280d21){while(--_0x280d21){_0xdc1176['push'](_0xdc1176['shift']());}};_0x4d7c39(++_0x55c094);}(_0xa205,0x1df));var _0x5a20=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xa205[_0x343e44];return _0xa5130e;};'use strict';var _=require(_0x5a20('0x0'));var util=require(_0x5a20('0x1'));var moment=require('moment');var BPromise=require(_0x5a20('0x2'));var rs=require(_0x5a20('0x3'));var fs=require('fs');var Redis=require(_0x5a20('0x4'));var db=require(_0x5a20('0x5'))['db'];var utils=require(_0x5a20('0x6'));var logger=require(_0x5a20('0x7'))(_0x5a20('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a20('0x9'));var client=jayson[_0x5a20('0xa')][_0x5a20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x173ff2,_0x10de61,_0x16fbfa){return new BPromise(function(_0x356108,_0x4f71a8){return client[_0x5a20('0xc')](_0x173ff2,_0x16fbfa)[_0x5a20('0xd')](function(_0x5c0161){logger[_0x5a20('0xe')](_0x5a20('0xf'),_0x10de61,_0x5a20('0x10'));logger[_0x5a20('0x11')](_0x5a20('0x12'),_0x10de61,_0x5a20('0x10'),JSON[_0x5a20('0x13')](_0x5c0161));if(_0x5c0161[_0x5a20('0x14')]){if(_0x5c0161['error'][_0x5a20('0x15')]===0x1f4){logger[_0x5a20('0x14')](_0x5a20('0xf'),_0x10de61,_0x5c0161[_0x5a20('0x14')][_0x5a20('0x16')]);return _0x4f71a8(_0x5c0161[_0x5a20('0x14')][_0x5a20('0x16')]);}logger['error'](_0x5a20('0xf'),_0x10de61,_0x5c0161[_0x5a20('0x14')]['message']);return _0x356108(_0x5c0161[_0x5a20('0x14')][_0x5a20('0x16')]);}else{logger['info'](_0x5a20('0xf'),_0x10de61,_0x5a20('0x10'));_0x356108(_0x5c0161[_0x5a20('0x17')][_0x5a20('0x16')]);}})[_0x5a20('0x18')](function(_0x51b27f){logger[_0x5a20('0x14')](_0x5a20('0xf'),_0x10de61,_0x51b27f);_0x4f71a8(_0x51b27f);});});} \ No newline at end of file +var _0x1818=['http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1ce442,_0x52ab4e){var _0x3f9c63=function(_0x23edc1){while(--_0x23edc1){_0x1ce442['push'](_0x1ce442['shift']());}};_0x3f9c63(++_0x52ab4e);}(_0x1818,0x19b));var _0x8181=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x1818[_0x1562a2];return _0x39a636;};'use strict';var _=require('lodash');var util=require(_0x8181('0x0'));var moment=require(_0x8181('0x1'));var BPromise=require(_0x8181('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8181('0x3'));var db=require(_0x8181('0x4'))['db'];var utils=require(_0x8181('0x5'));var logger=require(_0x8181('0x6'))(_0x8181('0x7'));var config=require(_0x8181('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8181('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x381fa4,_0x579bd9,_0x1b0ed4){return new BPromise(function(_0x5adb6d,_0x388ddd){return client[_0x8181('0xa')](_0x381fa4,_0x1b0ed4)[_0x8181('0xb')](function(_0x24ae7e){logger[_0x8181('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x579bd9,_0x8181('0xd'));logger[_0x8181('0xe')](_0x8181('0xf'),_0x579bd9,'request\x20sent',JSON['stringify'](_0x24ae7e));if(_0x24ae7e[_0x8181('0x10')]){if(_0x24ae7e[_0x8181('0x10')][_0x8181('0x11')]===0x1f4){logger[_0x8181('0x10')](_0x8181('0x12'),_0x579bd9,_0x24ae7e[_0x8181('0x10')]['message']);return _0x388ddd(_0x24ae7e[_0x8181('0x10')][_0x8181('0x13')]);}logger[_0x8181('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x579bd9,_0x24ae7e[_0x8181('0x10')][_0x8181('0x13')]);return _0x5adb6d(_0x24ae7e[_0x8181('0x10')]['message']);}else{logger[_0x8181('0xc')](_0x8181('0x12'),_0x579bd9,_0x8181('0xd'));_0x5adb6d(_0x24ae7e[_0x8181('0x14')]['message']);}})['catch'](function(_0x1ab70b){logger[_0x8181('0x10')](_0x8181('0x12'),_0x579bd9,_0x1ab70b);_0x388ddd(_0x1ab70b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 652769d..d47230c 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(_0x20e986,_0x445a88){var _0x4929df=function(_0x32ff70){while(--_0x32ff70){_0x20e986['push'](_0x20e986['shift']());}};_0x4929df(++_0x445a88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x20efe3,_0x48ad9f){var _0xa8aa36=function(_0x590de8){while(--_0x590de8){_0x20efe3['push'](_0x20efe3['shift']());}};_0xa8aa36(++_0x48ad9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 bb97f43..2c1acfa 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 _0xf81a=['exports','STRING','TEXT','sequelize'];(function(_0x513483,_0x105ccd){var _0x384a1e=function(_0x47bb41){while(--_0x47bb41){_0x513483['push'](_0x513483['shift']());}};_0x384a1e(++_0x105ccd);}(_0xf81a,0x16b));var _0xaf81=function(_0x478032,_0x349dae){_0x478032=_0x478032-0x0;var _0x5d7ef5=_0xf81a[_0x478032];return _0x5d7ef5;};'use strict';var Sequelize=require(_0xaf81('0x0'));module[_0xaf81('0x1')]={'name':{'type':Sequelize[_0xaf81('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xaf81('0x2')]},'metric':{'type':Sequelize[_0xaf81('0x3')]},'description':{'type':Sequelize[_0xaf81('0x2')]}}; \ No newline at end of file +var _0x76bc=['exports','STRING','name','sequelize'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x76bc,0x17f));var _0xc76b=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x76bc[_0x1f8053];return _0x174fd8;};'use strict';var Sequelize=require(_0xc76b('0x0'));module[_0xc76b('0x1')]={'name':{'type':Sequelize[_0xc76b('0x2')],'allowNull':![],'unique':_0xc76b('0x3')},'table':{'type':Sequelize[_0xc76b('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index bd83d54..9b282aa 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 _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x268afe,_0x50bb60){var _0x288d0b=function(_0x5ec113){while(--_0x5ec113){_0x268afe['push'](_0x268afe['shift']());}};_0x288d0b(++_0x50bb60);}(_0x4b84,0x1cc));var _0x44b8=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4b84[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file +var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x5182bd,_0xff8120){var _0x3b902d=function(_0x7fdcbc){while(--_0x7fdcbc){_0x5182bd['push'](_0x5182bd['shift']());}};_0x3b902d(++_0xff8120);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5c600b,_0x24a29d){_0x5c600b=_0x5c600b-0x0;var _0x4df353=_0x9c5a[_0x5c600b];return _0x4df353;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 045ba72..418b57b 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 _0xee55=['path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','../../config/logger','moment','request-promise'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xee55,0x1a0));var _0x5ee5=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0xee55[_0x48961c];return _0x1d895d;};'use strict';var _=require(_0x5ee5('0x0'));var util=require('util');var logger=require(_0x5ee5('0x1'))('api');var moment=require(_0x5ee5('0x2'));var BPromise=require('bluebird');var rp=require(_0x5ee5('0x3'));var fs=require('fs');var path=require(_0x5ee5('0x4'));var rimraf=require('rimraf');var config=require(_0x5ee5('0x5'));var attributes=require(_0x5ee5('0x6'));module[_0x5ee5('0x7')]=function(_0x392a8e,_0x684992){return _0x392a8e[_0x5ee5('0x8')](_0x5ee5('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6b=['request-promise','path','rimraf','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','lodash','moment'];(function(_0x5f6c8e,_0x4b240a){var _0x5c5e16=function(_0x32a063){while(--_0x32a063){_0x5f6c8e['push'](_0x5f6c8e['shift']());}};_0x5c5e16(++_0x4b240a);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x0a6b[_0x189305];return _0xea3406;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'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 e20e4b4..507e46c 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 _0x3511=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x3511,0x1eb));var _0x1351=function(_0x52dc0d,_0x4db716){_0x52dc0d=_0x52dc0d-0x0;var _0x9e4e71=_0x3511[_0x52dc0d];return _0x9e4e71;};'use strict';var _=require('lodash');var util=require(_0x1351('0x0'));var moment=require(_0x1351('0x1'));var BPromise=require(_0x1351('0x2'));var rs=require(_0x1351('0x3'));var fs=require('fs');var Redis=require(_0x1351('0x4'));var db=require(_0x1351('0x5'))['db'];var utils=require(_0x1351('0x6'));var logger=require('../../config/logger')(_0x1351('0x7'));var config=require('../../config/environment');var jayson=require(_0x1351('0x8'));var client=jayson[_0x1351('0x9')][_0x1351('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59259e,_0x236026,_0x168bef){return new BPromise(function(_0x252018,_0x14075d){return client[_0x1351('0xb')](_0x59259e,_0x168bef)[_0x1351('0xc')](function(_0x35f766){logger[_0x1351('0xd')](_0x1351('0xe'),_0x236026,_0x1351('0xf'));logger[_0x1351('0x10')](_0x1351('0x11'),_0x236026,'request\x20sent',JSON[_0x1351('0x12')](_0x35f766));if(_0x35f766[_0x1351('0x13')]){if(_0x35f766['error']['code']===0x1f4){logger['error'](_0x1351('0xe'),_0x236026,_0x35f766[_0x1351('0x13')][_0x1351('0x14')]);return _0x14075d(_0x35f766[_0x1351('0x13')][_0x1351('0x14')]);}logger['error'](_0x1351('0xe'),_0x236026,_0x35f766[_0x1351('0x13')][_0x1351('0x14')]);return _0x252018(_0x35f766[_0x1351('0x13')][_0x1351('0x14')]);}else{logger[_0x1351('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x236026,'request\x20sent');_0x252018(_0x35f766[_0x1351('0x15')]['message']);}})[_0x1351('0x16')](function(_0x302eda){logger[_0x1351('0x13')](_0x1351('0xe'),_0x236026,_0x302eda);_0x14075d(_0x302eda);});});} \ No newline at end of file +var _0xc9f7=['client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xc9f7,0xfd));var _0x7c9f=function(_0x3346d8,_0x1e2e46){_0x3346d8=_0x3346d8-0x0;var _0x4ad342=_0xc9f7[_0x3346d8];return _0x4ad342;};'use strict';var _=require(_0x7c9f('0x0'));var util=require(_0x7c9f('0x1'));var moment=require(_0x7c9f('0x2'));var BPromise=require(_0x7c9f('0x3'));var rs=require(_0x7c9f('0x4'));var fs=require('fs');var Redis=require(_0x7c9f('0x5'));var db=require(_0x7c9f('0x6'))['db'];var utils=require(_0x7c9f('0x7'));var logger=require(_0x7c9f('0x8'))(_0x7c9f('0x9'));var config=require('../../config/environment');var jayson=require(_0x7c9f('0xa'));var client=jayson[_0x7c9f('0xb')][_0x7c9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x996b2c,_0x41d018,_0x1dd4aa){return new BPromise(function(_0x213c89,_0x39bbbf){return client[_0x7c9f('0xd')](_0x996b2c,_0x1dd4aa)[_0x7c9f('0xe')](function(_0x2db949){logger[_0x7c9f('0xf')](_0x7c9f('0x10'),_0x41d018,_0x7c9f('0x11'));logger[_0x7c9f('0x12')](_0x7c9f('0x13'),_0x41d018,_0x7c9f('0x11'),JSON[_0x7c9f('0x14')](_0x2db949));if(_0x2db949['error']){if(_0x2db949[_0x7c9f('0x15')]['code']===0x1f4){logger[_0x7c9f('0x15')](_0x7c9f('0x10'),_0x41d018,_0x2db949[_0x7c9f('0x15')][_0x7c9f('0x16')]);return _0x39bbbf(_0x2db949[_0x7c9f('0x15')][_0x7c9f('0x16')]);}logger['error'](_0x7c9f('0x10'),_0x41d018,_0x2db949[_0x7c9f('0x15')]['message']);return _0x213c89(_0x2db949[_0x7c9f('0x15')]['message']);}else{logger[_0x7c9f('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x41d018,_0x7c9f('0x11'));_0x213c89(_0x2db949['result'][_0x7c9f('0x16')]);}})[_0x7c9f('0x17')](function(_0x1eee33){logger[_0x7c9f('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x41d018,_0x1eee33);_0x39bbbf(_0x1eee33);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4affd27..f557e7b 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 _0x5e17=['get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x5e17,0x17a));var _0x75e1=function(_0x57f61a,_0x366fe6){_0x57f61a=_0x57f61a-0x0;var _0x253312=_0x5e17[_0x57f61a];return _0x253312;};'use strict';var multer=require(_0x75e1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x75e1('0x1'));var auth=require(_0x75e1('0x2'));var interaction=require(_0x75e1('0x3'));var config=require(_0x75e1('0x4'));var controller=require(_0x75e1('0x5'));router[_0x75e1('0x6')]('/',auth[_0x75e1('0x7')](),controller[_0x75e1('0x8')]);router[_0x75e1('0x6')](_0x75e1('0x9'),auth[_0x75e1('0x7')](),controller[_0x75e1('0xa')]);router[_0x75e1('0xb')]('/',auth[_0x75e1('0x7')](),controller[_0x75e1('0xc')]);router['put'](_0x75e1('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x75e1('0xd')](_0x75e1('0x9'),auth[_0x75e1('0x7')](),controller[_0x75e1('0xe')]);module[_0x75e1('0xf')]=router; \ No newline at end of file +var _0x4a9c=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x2669ba,_0x4b2c24){_0x2669ba=_0x2669ba-0x0;var _0x1eccce=_0x4a9c[_0x2669ba];return _0x1eccce;};'use strict';var multer=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var path=require(_0xc4a9('0x2'));var timeout=require(_0xc4a9('0x3'));var express=require(_0xc4a9('0x4'));var router=express[_0xc4a9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc4a9('0x6'));var interaction=require(_0xc4a9('0x7'));var config=require(_0xc4a9('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xc4a9('0x9')](),controller[_0xc4a9('0xa')]);router[_0xc4a9('0xb')](_0xc4a9('0xc'),auth['isAuthenticated'](),controller[_0xc4a9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4a9('0xe')]);router[_0xc4a9('0xf')](_0xc4a9('0xc'),auth[_0xc4a9('0x9')](),controller[_0xc4a9('0x10')]);router[_0xc4a9('0x11')](_0xc4a9('0xc'),auth[_0xc4a9('0x9')](),controller[_0xc4a9('0x12')]);module[_0xc4a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 2495cf4..c00a393 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 _0xade8=['TEXT','sequelize','exports'];(function(_0x36db58,_0x120dd9){var _0x3a90c0=function(_0x127f55){while(--_0x127f55){_0x36db58['push'](_0x36db58['shift']());}};_0x3a90c0(++_0x120dd9);}(_0xade8,0x70));var _0x8ade=function(_0x14823a,_0x4b3287){_0x14823a=_0x14823a-0x0;var _0x1b8642=_0xade8[_0x14823a];return _0x1b8642;};'use strict';var Sequelize=require(_0x8ade('0x0'));module[_0x8ade('0x1')]={'tree':{'type':Sequelize[_0x8ade('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9f92=['TEXT','sequelize'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0x9f92,0x125));var _0x29f9=function(_0x2a31b9,_0x4a634d){_0x2a31b9=_0x2a31b9-0x0;var _0x5cda05=_0x9f92[_0x2a31b9];return _0x5cda05;};'use strict';var Sequelize=require(_0x29f9('0x0'));module['exports']={'tree':{'type':Sequelize[_0x29f9('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index aa29b24..83f7ec6 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 _0xf5fc=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','options','AnalyticTreeReport','includeAll','include','findAll','catch','show','keys','find','create','update','body','params','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3c3313,_0x1ea90d){var _0xb947aa=function(_0x2d911f){while(--_0x2d911f){_0x3c3313['push'](_0x3c3313['shift']());}};_0xb947aa(++_0x1ea90d);}(_0xf5fc,0x159));var _0xcf5f=function(_0xffd1b5,_0x1ede18){_0xffd1b5=_0xffd1b5-0x0;var _0x3176d6=_0xf5fc[_0xffd1b5];return _0x3176d6;};'use strict';var emlformat=require(_0xcf5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcf5f('0x2'));var BPromise=require(_0xcf5f('0x3'));var Mustache=require('mustache');var util=require(_0xcf5f('0x4'));var path=require(_0xcf5f('0x5'));var sox=require(_0xcf5f('0x6'));var csv=require(_0xcf5f('0x7'));var ejs=require(_0xcf5f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf5f('0x9'));var squel=require(_0xcf5f('0xa'));var crypto=require(_0xcf5f('0xb'));var jsforce=require(_0xcf5f('0xc'));var deskjs=require(_0xcf5f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcf5f('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf5f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcf5f('0x10'));var as=require(_0xcf5f('0x11'));var hardwareService=require(_0xcf5f('0x12'));var logger=require(_0xcf5f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcf5f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf5f('0x15'))['db'];function respondWithStatusCode(_0xbaf88f,_0x2c34e9){_0x2c34e9=_0x2c34e9||0xcc;return function(_0x1872e9){if(_0x1872e9){return _0xbaf88f[_0xcf5f('0x16')](_0x2c34e9);}return _0xbaf88f[_0xcf5f('0x17')](_0x2c34e9)[_0xcf5f('0x18')]();};}function respondWithResult(_0xa8ad16,_0x36a77d){_0x36a77d=_0x36a77d||0xc8;return function(_0x2e9d6c){if(_0x2e9d6c){return _0xa8ad16['status'](_0x36a77d)['json'](_0x2e9d6c);}};}function respondWithFilteredResult(_0xb33246,_0x232e91){return function(_0xd450d6){if(_0xd450d6){var _0x188ca2=typeof _0x232e91[_0xcf5f('0x19')]==='undefined'&&typeof _0x232e91[_0xcf5f('0x1a')]===_0xcf5f('0x1b');var _0x539aaa=_0xd450d6['count'];var _0x25f696=_0x188ca2?0x0:_0x232e91[_0xcf5f('0x19')];var _0x5a7390=_0x188ca2?_0xd450d6[_0xcf5f('0x1c')]:_0x232e91[_0xcf5f('0x19')]+_0x232e91[_0xcf5f('0x1a')];var _0x9271a3;if(_0x5a7390>=_0x539aaa){_0x5a7390=_0x539aaa;_0x9271a3=0xc8;}else{_0x9271a3=0xce;}_0xb33246[_0xcf5f('0x17')](_0x9271a3);return _0xb33246[_0xcf5f('0x1d')](_0xcf5f('0x1e'),_0x25f696+'-'+_0x5a7390+'/'+_0x539aaa)[_0xcf5f('0x1f')](_0xd450d6);}return null;};}function patchUpdates(_0x46f02d){return function(_0x57fbb2){try{jsonpatch[_0xcf5f('0x20')](_0x57fbb2,_0x46f02d,!![]);}catch(_0x49f79f){return BPromise['reject'](_0x49f79f);}return _0x57fbb2[_0xcf5f('0x21')]();};}function saveUpdates(_0x5317de,_0x1817fb){return function(_0x3a71a3){if(_0x3a71a3){return _0x3a71a3['update'](_0x5317de)[_0xcf5f('0x22')](function(_0x385fe7){return _0x385fe7;});}return null;};}function removeEntity(_0x15914f,_0x166087){return function(_0x56dea1){if(_0x56dea1){return _0x56dea1[_0xcf5f('0x23')]()[_0xcf5f('0x22')](function(){_0x15914f[_0xcf5f('0x17')](0xcc)[_0xcf5f('0x18')]();});}};}function handleEntityNotFound(_0x196bfa,_0x1cf2a9){return function(_0x451d05){if(!_0x451d05){_0x196bfa['sendStatus'](0x194);}return _0x451d05;};}function handleError(_0x518a06,_0x125691){_0x125691=_0x125691||0x1f4;return function(_0x397470){logger[_0xcf5f('0x24')](_0x397470[_0xcf5f('0x25')]);if(_0x397470[_0xcf5f('0x26')]){delete _0x397470[_0xcf5f('0x26')];}_0x518a06['status'](_0x125691)[_0xcf5f('0x27')](_0x397470);};}exports[_0xcf5f('0x28')]=function(_0x365e25,_0x1bed0c){var _0x8415e7={},_0x1bc6c6={},_0x2a99eb={'count':0x0,'rows':[]};var _0x563207=_['map'](db['AnalyticTreeReport'][_0xcf5f('0x29')],function(_0x2ec74c){return{'name':_0x2ec74c['fieldName'],'type':_0x2ec74c['type'][_0xcf5f('0x2a')]};});_0x1bc6c6[_0xcf5f('0x2b')]=_['map'](_0x563207,_0xcf5f('0x26'));_0x1bc6c6[_0xcf5f('0x2c')]=_['keys'](_0x365e25['query']);_0x1bc6c6[_0xcf5f('0x2d')]=_[_0xcf5f('0x2e')](_0x1bc6c6[_0xcf5f('0x2b')],_0x1bc6c6[_0xcf5f('0x2c')]);_0x8415e7[_0xcf5f('0x2f')]=_[_0xcf5f('0x2e')](_0x1bc6c6[_0xcf5f('0x2b')],qs[_0xcf5f('0x30')](_0x365e25[_0xcf5f('0x2c')][_0xcf5f('0x30')]));_0x8415e7[_0xcf5f('0x2f')]=_0x8415e7[_0xcf5f('0x2f')][_0xcf5f('0x31')]?_0x8415e7[_0xcf5f('0x2f')]:_0x1bc6c6[_0xcf5f('0x2b')];if(!_0x365e25[_0xcf5f('0x2c')][_0xcf5f('0x32')](_0xcf5f('0x33'))){_0x8415e7[_0xcf5f('0x1a')]=qs[_0xcf5f('0x1a')](_0x365e25['query']['limit']);_0x8415e7[_0xcf5f('0x19')]=qs['offset'](_0x365e25[_0xcf5f('0x2c')]['offset']);}_0x8415e7[_0xcf5f('0x34')]=qs[_0xcf5f('0x35')](_0x365e25['query'][_0xcf5f('0x35')]);_0x8415e7[_0xcf5f('0x36')]=qs[_0xcf5f('0x2d')](_['pick'](_0x365e25['query'],_0x1bc6c6[_0xcf5f('0x2d')]),_0x563207);if(_0x365e25[_0xcf5f('0x2c')][_0xcf5f('0x37')]){_0x8415e7[_0xcf5f('0x36')]=_[_0xcf5f('0x38')](_0x8415e7[_0xcf5f('0x36')],{'$or':_[_0xcf5f('0x39')](_0x563207,function(_0x4cc9b9){if(_0x4cc9b9[_0xcf5f('0x3a')]!=='VIRTUAL'){var _0x100518={};_0x100518[_0x4cc9b9['name']]={'$like':'%'+_0x365e25['query'][_0xcf5f('0x37')]+'%'};return _0x100518;}})});}_0x8415e7=_[_0xcf5f('0x38')]({},_0x8415e7,_0x365e25[_0xcf5f('0x3b')]);var _0x9a9360={'where':_0x8415e7[_0xcf5f('0x36')]};return db[_0xcf5f('0x3c')][_0xcf5f('0x1c')](_0x9a9360)['then'](function(_0x5ec10a){_0x2a99eb[_0xcf5f('0x1c')]=_0x5ec10a;if(_0x365e25[_0xcf5f('0x2c')][_0xcf5f('0x3d')]){_0x8415e7[_0xcf5f('0x3e')]=[{'all':!![]}];}return db[_0xcf5f('0x3c')][_0xcf5f('0x3f')](_0x8415e7);})['then'](function(_0xfb7267){_0x2a99eb['rows']=_0xfb7267;return _0x2a99eb;})[_0xcf5f('0x22')](respondWithFilteredResult(_0x1bed0c,_0x8415e7))[_0xcf5f('0x40')](handleError(_0x1bed0c,null));};exports[_0xcf5f('0x41')]=function(_0x3139e7,_0x505865){var _0x15faca={'raw':!![],'where':{'id':_0x3139e7['params']['id']}},_0x5639ba={};_0x5639ba[_0xcf5f('0x2b')]=_['keys'](db[_0xcf5f('0x3c')][_0xcf5f('0x29')]);_0x5639ba[_0xcf5f('0x2c')]=_[_0xcf5f('0x42')](_0x3139e7['query']);_0x5639ba['filters']=_['intersection'](_0x5639ba[_0xcf5f('0x2b')],_0x5639ba['query']);_0x15faca[_0xcf5f('0x2f')]=_['intersection'](_0x5639ba['model'],qs[_0xcf5f('0x30')](_0x3139e7[_0xcf5f('0x2c')][_0xcf5f('0x30')]));_0x15faca['attributes']=_0x15faca[_0xcf5f('0x2f')][_0xcf5f('0x31')]?_0x15faca[_0xcf5f('0x2f')]:_0x5639ba[_0xcf5f('0x2b')];if(_0x3139e7[_0xcf5f('0x2c')][_0xcf5f('0x3d')]){_0x15faca[_0xcf5f('0x3e')]=[{'all':!![]}];}_0x15faca=_[_0xcf5f('0x38')]({},_0x15faca,_0x3139e7[_0xcf5f('0x3b')]);return db['AnalyticTreeReport'][_0xcf5f('0x43')](_0x15faca)[_0xcf5f('0x22')](handleEntityNotFound(_0x505865,null))[_0xcf5f('0x22')](respondWithResult(_0x505865,null))[_0xcf5f('0x40')](handleError(_0x505865,null));};exports[_0xcf5f('0x44')]=function(_0x545950,_0x283945){return db[_0xcf5f('0x3c')][_0xcf5f('0x44')](_0x545950['body'],{})[_0xcf5f('0x22')](respondWithResult(_0x283945,0xc9))[_0xcf5f('0x40')](handleError(_0x283945,null));};exports[_0xcf5f('0x45')]=function(_0x5357c7,_0x50a930){if(_0x5357c7[_0xcf5f('0x46')]['id']){delete _0x5357c7[_0xcf5f('0x46')]['id'];}return db[_0xcf5f('0x3c')][_0xcf5f('0x43')]({'where':{'id':_0x5357c7[_0xcf5f('0x47')]['id']}})[_0xcf5f('0x22')](handleEntityNotFound(_0x50a930,null))[_0xcf5f('0x22')](saveUpdates(_0x5357c7['body'],null))[_0xcf5f('0x22')](respondWithResult(_0x50a930,null))[_0xcf5f('0x40')](handleError(_0x50a930,null));};exports[_0xcf5f('0x23')]=function(_0x59af1c,_0xfe95a3){return db[_0xcf5f('0x3c')][_0xcf5f('0x43')]({'where':{'id':_0x59af1c[_0xcf5f('0x47')]['id']}})['then'](handleEntityNotFound(_0xfe95a3,null))[_0xcf5f('0x22')](removeEntity(_0xfe95a3,null))[_0xcf5f('0x40')](handleError(_0xfe95a3,null));}; \ No newline at end of file +var _0x04ba=['AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x3c1f0a,_0x1422d5){var _0x22453e=function(_0x17451f){while(--_0x17451f){_0x3c1f0a['push'](_0x3c1f0a['shift']());}};_0x22453e(++_0x1422d5);}(_0x04ba,0x15c));var _0xa04b=function(_0x2780aa,_0x2fdb35){_0x2780aa=_0x2780aa-0x0;var _0x454f91=_0x04ba[_0x2780aa];return _0x454f91;};'use strict';var emlformat=require(_0xa04b('0x0'));var rimraf=require(_0xa04b('0x1'));var zipdir=require(_0xa04b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa04b('0x3'));var moment=require('moment');var BPromise=require(_0xa04b('0x4'));var Mustache=require(_0xa04b('0x5'));var util=require(_0xa04b('0x6'));var path=require(_0xa04b('0x7'));var sox=require(_0xa04b('0x8'));var csv=require('to-csv');var ejs=require(_0xa04b('0x9'));var fs=require('fs');var fs_extra=require(_0xa04b('0xa'));var _=require(_0xa04b('0xb'));var squel=require(_0xa04b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa04b('0xd'));var deskjs=require(_0xa04b('0xe'));var toCsv=require(_0xa04b('0xf'));var querystring=require(_0xa04b('0x10'));var Papa=require(_0xa04b('0x11'));var Redis=require(_0xa04b('0x12'));var authService=require(_0xa04b('0x13'));var qs=require(_0xa04b('0x14'));var as=require(_0xa04b('0x15'));var hardwareService=require(_0xa04b('0x16'));var logger=require(_0xa04b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xa04b('0x18'));var licenseUtil=require(_0xa04b('0x19'));var db=require(_0xa04b('0x1a'))['db'];function respondWithStatusCode(_0x394adf,_0xb100ff){_0xb100ff=_0xb100ff||0xcc;return function(_0x23fd9d){if(_0x23fd9d){return _0x394adf[_0xa04b('0x1b')](_0xb100ff);}return _0x394adf[_0xa04b('0x1c')](_0xb100ff)['end']();};}function respondWithResult(_0x5a335e,_0x48dacb){_0x48dacb=_0x48dacb||0xc8;return function(_0x59d0ba){if(_0x59d0ba){return _0x5a335e[_0xa04b('0x1c')](_0x48dacb)['json'](_0x59d0ba);}};}function respondWithFilteredResult(_0x305672,_0x2717a3){return function(_0x15f27b){if(_0x15f27b){var _0x2b3b83=typeof _0x2717a3[_0xa04b('0x1d')]===_0xa04b('0x1e')&&typeof _0x2717a3['limit']===_0xa04b('0x1e');var _0x2dea51=_0x15f27b[_0xa04b('0x1f')];var _0x4fe132=_0x2b3b83?0x0:_0x2717a3[_0xa04b('0x1d')];var _0x5376ea=_0x2b3b83?_0x15f27b['count']:_0x2717a3[_0xa04b('0x1d')]+_0x2717a3['limit'];var _0x1e350a;if(_0x5376ea>=_0x2dea51){_0x5376ea=_0x2dea51;_0x1e350a=0xc8;}else{_0x1e350a=0xce;}_0x305672[_0xa04b('0x1c')](_0x1e350a);return _0x305672[_0xa04b('0x20')](_0xa04b('0x21'),_0x4fe132+'-'+_0x5376ea+'/'+_0x2dea51)[_0xa04b('0x22')](_0x15f27b);}return null;};}function patchUpdates(_0x37c48f){return function(_0x56a473){try{jsonpatch[_0xa04b('0x23')](_0x56a473,_0x37c48f,!![]);}catch(_0x491572){return BPromise[_0xa04b('0x24')](_0x491572);}return _0x56a473['save']();};}function saveUpdates(_0x4ff5a3,_0x1f7370){return function(_0x2ca8aa){if(_0x2ca8aa){return _0x2ca8aa[_0xa04b('0x25')](_0x4ff5a3)[_0xa04b('0x26')](function(_0x54a6dd){return _0x54a6dd;});}return null;};}function removeEntity(_0x16303a,_0x1ef6a1){return function(_0x214d2c){if(_0x214d2c){return _0x214d2c[_0xa04b('0x27')]()[_0xa04b('0x26')](function(){_0x16303a[_0xa04b('0x1c')](0xcc)[_0xa04b('0x28')]();});}};}function handleEntityNotFound(_0x2ccfe1,_0x54e7bf){return function(_0x244481){if(!_0x244481){_0x2ccfe1[_0xa04b('0x1b')](0x194);}return _0x244481;};}function handleError(_0xb465e9,_0xbac081){_0xbac081=_0xbac081||0x1f4;return function(_0x1ca571){logger[_0xa04b('0x29')](_0x1ca571[_0xa04b('0x2a')]);if(_0x1ca571['name']){delete _0x1ca571[_0xa04b('0x2b')];}_0xb465e9[_0xa04b('0x1c')](_0xbac081)[_0xa04b('0x2c')](_0x1ca571);};}exports[_0xa04b('0x2d')]=function(_0x5459fe,_0x20f4b3){var _0x495ea6={},_0x28e261={},_0xa0ed13={'count':0x0,'rows':[]};var _0x39e176=_[_0xa04b('0x2e')](db[_0xa04b('0x2f')][_0xa04b('0x30')],function(_0x1f1712){return{'name':_0x1f1712[_0xa04b('0x31')],'type':_0x1f1712['type'][_0xa04b('0x32')]};});_0x28e261[_0xa04b('0x33')]=_['map'](_0x39e176,_0xa04b('0x2b'));_0x28e261[_0xa04b('0x34')]=_[_0xa04b('0x35')](_0x5459fe['query']);_0x28e261[_0xa04b('0x36')]=_[_0xa04b('0x37')](_0x28e261[_0xa04b('0x33')],_0x28e261[_0xa04b('0x34')]);_0x495ea6[_0xa04b('0x38')]=_['intersection'](_0x28e261[_0xa04b('0x33')],qs[_0xa04b('0x39')](_0x5459fe['query'][_0xa04b('0x39')]));_0x495ea6[_0xa04b('0x38')]=_0x495ea6['attributes'][_0xa04b('0x3a')]?_0x495ea6[_0xa04b('0x38')]:_0x28e261[_0xa04b('0x33')];if(!_0x5459fe[_0xa04b('0x34')][_0xa04b('0x3b')](_0xa04b('0x3c'))){_0x495ea6[_0xa04b('0x3d')]=qs[_0xa04b('0x3d')](_0x5459fe[_0xa04b('0x34')]['limit']);_0x495ea6[_0xa04b('0x1d')]=qs[_0xa04b('0x1d')](_0x5459fe[_0xa04b('0x34')][_0xa04b('0x1d')]);}_0x495ea6[_0xa04b('0x3e')]=qs[_0xa04b('0x3f')](_0x5459fe[_0xa04b('0x34')][_0xa04b('0x3f')]);_0x495ea6[_0xa04b('0x40')]=qs[_0xa04b('0x36')](_['pick'](_0x5459fe[_0xa04b('0x34')],_0x28e261[_0xa04b('0x36')]),_0x39e176);if(_0x5459fe[_0xa04b('0x34')][_0xa04b('0x41')]){_0x495ea6['where']=_[_0xa04b('0x42')](_0x495ea6[_0xa04b('0x40')],{'$or':_[_0xa04b('0x2e')](_0x39e176,function(_0x179308){if(_0x179308[_0xa04b('0x43')]!==_0xa04b('0x44')){var _0x3d8473={};_0x3d8473[_0x179308[_0xa04b('0x2b')]]={'$like':'%'+_0x5459fe[_0xa04b('0x34')]['filter']+'%'};return _0x3d8473;}})});}_0x495ea6=_[_0xa04b('0x42')]({},_0x495ea6,_0x5459fe[_0xa04b('0x45')]);var _0x57a0c3={'where':_0x495ea6[_0xa04b('0x40')]};return db['AnalyticTreeReport'][_0xa04b('0x1f')](_0x57a0c3)['then'](function(_0x40d09a){_0xa0ed13['count']=_0x40d09a;if(_0x5459fe['query'][_0xa04b('0x46')]){_0x495ea6['include']=[{'all':!![]}];}return db[_0xa04b('0x2f')][_0xa04b('0x47')](_0x495ea6);})[_0xa04b('0x26')](function(_0x215db6){_0xa0ed13[_0xa04b('0x48')]=_0x215db6;return _0xa0ed13;})[_0xa04b('0x26')](respondWithFilteredResult(_0x20f4b3,_0x495ea6))[_0xa04b('0x49')](handleError(_0x20f4b3,null));};exports['show']=function(_0x1210e7,_0x143d57){var _0x3c17af={'raw':!![],'where':{'id':_0x1210e7[_0xa04b('0x4a')]['id']}},_0x164559={};_0x164559['model']=_[_0xa04b('0x35')](db[_0xa04b('0x2f')]['rawAttributes']);_0x164559[_0xa04b('0x34')]=_[_0xa04b('0x35')](_0x1210e7[_0xa04b('0x34')]);_0x164559[_0xa04b('0x36')]=_['intersection'](_0x164559['model'],_0x164559[_0xa04b('0x34')]);_0x3c17af[_0xa04b('0x38')]=_['intersection'](_0x164559[_0xa04b('0x33')],qs[_0xa04b('0x39')](_0x1210e7[_0xa04b('0x34')][_0xa04b('0x39')]));_0x3c17af[_0xa04b('0x38')]=_0x3c17af['attributes'][_0xa04b('0x3a')]?_0x3c17af[_0xa04b('0x38')]:_0x164559[_0xa04b('0x33')];if(_0x1210e7[_0xa04b('0x34')][_0xa04b('0x46')]){_0x3c17af[_0xa04b('0x4b')]=[{'all':!![]}];}_0x3c17af=_[_0xa04b('0x42')]({},_0x3c17af,_0x1210e7[_0xa04b('0x45')]);return db['AnalyticTreeReport']['find'](_0x3c17af)['then'](handleEntityNotFound(_0x143d57,null))['then'](respondWithResult(_0x143d57,null))[_0xa04b('0x49')](handleError(_0x143d57,null));};exports['create']=function(_0x254b88,_0x1bf799){return db[_0xa04b('0x2f')][_0xa04b('0x4c')](_0x254b88['body'],{})[_0xa04b('0x26')](respondWithResult(_0x1bf799,0xc9))[_0xa04b('0x49')](handleError(_0x1bf799,null));};exports['update']=function(_0x11c9ef,_0x131244){if(_0x11c9ef[_0xa04b('0x4d')]['id']){delete _0x11c9ef['body']['id'];}return db[_0xa04b('0x2f')][_0xa04b('0x4e')]({'where':{'id':_0x11c9ef[_0xa04b('0x4a')]['id']}})[_0xa04b('0x26')](handleEntityNotFound(_0x131244,null))['then'](saveUpdates(_0x11c9ef['body'],null))[_0xa04b('0x26')](respondWithResult(_0x131244,null))[_0xa04b('0x49')](handleError(_0x131244,null));};exports[_0xa04b('0x27')]=function(_0x4511eb,_0x5883e9){return db[_0xa04b('0x2f')][_0xa04b('0x4e')]({'where':{'id':_0x4511eb[_0xa04b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5883e9,null))[_0xa04b('0x26')](removeEntity(_0x5883e9,null))[_0xa04b('0x49')](handleError(_0x5883e9,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 5605ab0..93df8c5 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 _0x9ca1=['moment','request-promise','path','rimraf','../../config/environment','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x36cf5d,_0x3aa354){var _0x5b08cf=function(_0x126400){while(--_0x126400){_0x36cf5d['push'](_0x36cf5d['shift']());}};_0x5b08cf(++_0x3aa354);}(_0x9ca1,0xbc));var _0x19ca=function(_0x2b7f72,_0x182819){_0x2b7f72=_0x2b7f72-0x0;var _0x1e1540=_0x9ca1[_0x2b7f72];return _0x1e1540;};'use strict';var _=require(_0x19ca('0x0'));var util=require(_0x19ca('0x1'));var logger=require(_0x19ca('0x2'))(_0x19ca('0x3'));var moment=require(_0x19ca('0x4'));var BPromise=require('bluebird');var rp=require(_0x19ca('0x5'));var fs=require('fs');var path=require(_0x19ca('0x6'));var rimraf=require(_0x19ca('0x7'));var config=require(_0x19ca('0x8'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x266b79,_0x1dfcc9){return _0x266b79[_0x19ca('0x9')](_0x19ca('0xa'),attributes,{'tableName':_0x19ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2707=['./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x2707,0x1cf));var _0x7270=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x2707[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x7270('0x0'));var util=require(_0x7270('0x1'));var logger=require(_0x7270('0x2'))(_0x7270('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7270('0x4'));var fs=require('fs');var path=require(_0x7270('0x5'));var rimraf=require('rimraf');var config=require(_0x7270('0x6'));var attributes=require(_0x7270('0x7'));module[_0x7270('0x8')]=function(_0x486089,_0x20168c){return _0x486089['define']('AnalyticTreeReport',attributes,{'tableName':_0x7270('0x9'),'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 5bbbe07..6f2166d 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22f9c0,_0x35410c){var _0x1883fe=function(_0x5a5601){while(--_0x5a5601){_0x22f9c0['push'](_0x22f9c0['shift']());}};_0x1883fe(++_0x35410c);}(_0xadb5,0xad));var _0x5adb=function(_0x27a595,_0x44b48e){_0x27a595=_0x27a595-0x0;var _0x5599bb=_0xadb5[_0x27a595];return _0x5599bb;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x5969fa,_0x5c40ae){var _0x410842=function(_0xca7d89){while(--_0xca7d89){_0x5969fa['push'](_0x5969fa['shift']());}};_0x410842(++_0x5c40ae);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e2b66a9..c49b174 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 _0x41e7=['post','create','put','update','destroy','exports','connect-timeout','express','Router','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id'];(function(_0xb51ec9,_0x21b476){var _0x495d62=function(_0x24da70){while(--_0x24da70){_0xb51ec9['push'](_0xb51ec9['shift']());}};_0x495d62(++_0x21b476);}(_0x41e7,0x15f));var _0x741e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x41e7[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x741e('0x0'));var express=require(_0x741e('0x1'));var router=express[_0x741e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x741e('0x3'));var controller=require(_0x741e('0x4'));router[_0x741e('0x5')]('/',auth[_0x741e('0x6')](),controller[_0x741e('0x7')]);router['get'](_0x741e('0x8'),auth[_0x741e('0x6')](),controller['show']);router[_0x741e('0x9')]('/',auth[_0x741e('0x6')](),controller[_0x741e('0xa')]);router[_0x741e('0xb')](_0x741e('0x8'),auth[_0x741e('0x6')](),controller[_0x741e('0xc')]);router['delete'](_0x741e('0x8'),auth[_0x741e('0x6')](),controller[_0x741e('0xd')]);module[_0x741e('0xe')]=router; \ No newline at end of file +var _0xec49=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer'];(function(_0xc74254,_0x6822fe){var _0x27c986=function(_0x3fa38f){while(--_0x3fa38f){_0xc74254['push'](_0xc74254['shift']());}};_0x27c986(++_0x6822fe);}(_0xec49,0x1c1));var _0x9ec4=function(_0x1a3c9a,_0x44cbc9){_0x1a3c9a=_0x1a3c9a-0x0;var _0x12689f=_0xec49[_0x1a3c9a];return _0x12689f;};'use strict';var multer=require(_0x9ec4('0x0'));var util=require(_0x9ec4('0x1'));var path=require(_0x9ec4('0x2'));var timeout=require(_0x9ec4('0x3'));var express=require(_0x9ec4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ec4('0x5'));var interaction=require(_0x9ec4('0x6'));var config=require(_0x9ec4('0x7'));var controller=require(_0x9ec4('0x8'));router[_0x9ec4('0x9')]('/',auth[_0x9ec4('0xa')](),controller[_0x9ec4('0xb')]);router[_0x9ec4('0x9')](_0x9ec4('0xc'),auth[_0x9ec4('0xa')](),controller['show']);router['post']('/',auth[_0x9ec4('0xa')](),controller[_0x9ec4('0xd')]);router[_0x9ec4('0xe')](_0x9ec4('0xc'),auth[_0x9ec4('0xa')](),controller[_0x9ec4('0xf')]);router[_0x9ec4('0x10')](_0x9ec4('0xc'),auth[_0x9ec4('0xa')](),controller[_0x9ec4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1732b7f..d133b42 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 _0x6c4b=['sequelize','exports','STRING'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x6c4b,0x93));var _0xb6c4=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x6c4b[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0xb6c4('0x0'));module[_0xb6c4('0x1')]={'name':{'type':Sequelize[_0xb6c4('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb6c4('0x2')]}}; \ No newline at end of file +var _0x3667=['STRING','sequelize','exports'];(function(_0x26fa5,_0x182714){var _0x564e52=function(_0x1a8f18){while(--_0x1a8f18){_0x26fa5['push'](_0x26fa5['shift']());}};_0x564e52(++_0x182714);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7366('0x0'));module[_0x7366('0x1')]={'name':{'type':Sequelize[_0x7366('0x2')]},'basename':{'type':Sequelize[_0x7366('0x2')]},'type':{'type':Sequelize[_0x7366('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ec9be5d..d129832 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 _0x0064=['path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','reject','save','destroy','then','sendStatus','error','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','createdAt','updatedAt','body','create','update','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x81fc49,_0x262dd8){var _0x596a1e=function(_0x5e4c43){while(--_0x5e4c43){_0x81fc49['push'](_0x81fc49['shift']());}};_0x596a1e(++_0x262dd8);}(_0x0064,0x10b));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4006('0x0'));var rimraf=require(_0x4006('0x1'));var zipdir=require(_0x4006('0x2'));var jsonpatch=require(_0x4006('0x3'));var rp=require(_0x4006('0x4'));var moment=require(_0x4006('0x5'));var BPromise=require(_0x4006('0x6'));var Mustache=require(_0x4006('0x7'));var util=require(_0x4006('0x8'));var path=require(_0x4006('0x9'));var sox=require(_0x4006('0xa'));var csv=require(_0x4006('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4006('0xc'));var _=require(_0x4006('0xd'));var squel=require(_0x4006('0xe'));var crypto=require(_0x4006('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4006('0xb'));var querystring=require(_0x4006('0x10'));var Papa=require(_0x4006('0x11'));var Redis=require(_0x4006('0x12'));var authService=require(_0x4006('0x13'));var qs=require(_0x4006('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4006('0x15'));var logger=require('../../config/logger')(_0x4006('0x16'));var utils=require(_0x4006('0x17'));var config=require(_0x4006('0x18'));var licenseUtil=require(_0x4006('0x19'));var db=require(_0x4006('0x1a'))['db'];function respondWithStatusCode(_0x43a700,_0x3bd820){_0x3bd820=_0x3bd820||0xcc;return function(_0xdaf4ae){if(_0xdaf4ae){return _0x43a700['sendStatus'](_0x3bd820);}return _0x43a700['status'](_0x3bd820)[_0x4006('0x1b')]();};}function respondWithResult(_0x58aa3f,_0x2a847a){_0x2a847a=_0x2a847a||0xc8;return function(_0x17842d){if(_0x17842d){return _0x58aa3f[_0x4006('0x1c')](_0x2a847a)[_0x4006('0x1d')](_0x17842d);}};}function respondWithFilteredResult(_0x16782e,_0xf7406c){return function(_0x3d91da){if(_0x3d91da){var _0x360dd2=typeof _0xf7406c[_0x4006('0x1e')]==='undefined'&&typeof _0xf7406c[_0x4006('0x1f')]==='undefined';var _0x3923b7=_0x3d91da['count'];var _0x27a1e1=_0x360dd2?0x0:_0xf7406c[_0x4006('0x1e')];var _0x592107=_0x360dd2?_0x3d91da[_0x4006('0x20')]:_0xf7406c[_0x4006('0x1e')]+_0xf7406c['limit'];var _0x5e354c;if(_0x592107>=_0x3923b7){_0x592107=_0x3923b7;_0x5e354c=0xc8;}else{_0x5e354c=0xce;}_0x16782e[_0x4006('0x1c')](_0x5e354c);return _0x16782e[_0x4006('0x21')]('Content-Range',_0x27a1e1+'-'+_0x592107+'/'+_0x3923b7)[_0x4006('0x1d')](_0x3d91da);}return null;};}function patchUpdates(_0x41937e){return function(_0x461f64){try{jsonpatch['apply'](_0x461f64,_0x41937e,!![]);}catch(_0x59e954){return BPromise[_0x4006('0x22')](_0x59e954);}return _0x461f64[_0x4006('0x23')]();};}function saveUpdates(_0x26ade4,_0x421b02){return function(_0xfdd093){if(_0xfdd093){return _0xfdd093['update'](_0x26ade4)['then'](function(_0x574dd4){return _0x574dd4;});}return null;};}function removeEntity(_0x1a0a5b,_0x4eb436){return function(_0x2f279b){if(_0x2f279b){return _0x2f279b[_0x4006('0x24')]()[_0x4006('0x25')](function(){_0x1a0a5b[_0x4006('0x1c')](0xcc)[_0x4006('0x1b')]();});}};}function handleEntityNotFound(_0xd053a4,_0xc38722){return function(_0x1fd25b){if(!_0x1fd25b){_0xd053a4[_0x4006('0x26')](0x194);}return _0x1fd25b;};}function handleError(_0x358b85,_0x11561b){_0x11561b=_0x11561b||0x1f4;return function(_0x515e5e){logger[_0x4006('0x27')](_0x515e5e['stack']);if(_0x515e5e[_0x4006('0x28')]){delete _0x515e5e[_0x4006('0x28')];}_0x358b85['status'](_0x11561b)['send'](_0x515e5e);};}exports[_0x4006('0x29')]=function(_0x3c5799,_0x4ee6d9){var _0x1c18a1={},_0xf6411b={},_0x19822a={'count':0x0,'rows':[]};var _0x2014aa=_[_0x4006('0x2a')](db[_0x4006('0x2b')][_0x4006('0x2c')],function(_0x537a83){return{'name':_0x537a83[_0x4006('0x2d')],'type':_0x537a83[_0x4006('0x2e')][_0x4006('0x2f')]};});_0xf6411b[_0x4006('0x30')]=_['map'](_0x2014aa,_0x4006('0x28'));_0xf6411b['query']=_[_0x4006('0x31')](_0x3c5799[_0x4006('0x32')]);_0xf6411b['filters']=_[_0x4006('0x33')](_0xf6411b['model'],_0xf6411b[_0x4006('0x32')]);_0x1c18a1[_0x4006('0x34')]=_[_0x4006('0x33')](_0xf6411b[_0x4006('0x30')],qs[_0x4006('0x35')](_0x3c5799['query'][_0x4006('0x35')]));_0x1c18a1['attributes']=_0x1c18a1['attributes'][_0x4006('0x36')]?_0x1c18a1[_0x4006('0x34')]:_0xf6411b['model'];if(!_0x3c5799['query'][_0x4006('0x37')](_0x4006('0x38'))){_0x1c18a1[_0x4006('0x1f')]=qs[_0x4006('0x1f')](_0x3c5799[_0x4006('0x32')][_0x4006('0x1f')]);_0x1c18a1[_0x4006('0x1e')]=qs[_0x4006('0x1e')](_0x3c5799[_0x4006('0x32')]['offset']);}_0x1c18a1[_0x4006('0x39')]=qs[_0x4006('0x3a')](_0x3c5799[_0x4006('0x32')]['sort']);_0x1c18a1['where']=qs[_0x4006('0x3b')](_['pick'](_0x3c5799[_0x4006('0x32')],_0xf6411b[_0x4006('0x3b')]),_0x2014aa);if(_0x3c5799['query'][_0x4006('0x3c')]){_0x1c18a1[_0x4006('0x3d')]=_[_0x4006('0x3e')](_0x1c18a1[_0x4006('0x3d')],{'$or':_[_0x4006('0x2a')](_0x2014aa,function(_0x4a3152){if(_0x4a3152[_0x4006('0x2e')]!==_0x4006('0x3f')){var _0x2a1704={};_0x2a1704[_0x4a3152[_0x4006('0x28')]]={'$like':'%'+_0x3c5799[_0x4006('0x32')]['filter']+'%'};return _0x2a1704;}})});}_0x1c18a1=_[_0x4006('0x3e')]({},_0x1c18a1,_0x3c5799[_0x4006('0x40')]);var _0x3e6dd2={'where':_0x1c18a1[_0x4006('0x3d')]};return db['Attachment'][_0x4006('0x20')](_0x3e6dd2)[_0x4006('0x25')](function(_0x26dd91){_0x19822a[_0x4006('0x20')]=_0x26dd91;if(_0x3c5799[_0x4006('0x32')][_0x4006('0x41')]){_0x1c18a1[_0x4006('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x4006('0x43')](_0x1c18a1);})[_0x4006('0x25')](function(_0xffcee7){_0x19822a[_0x4006('0x44')]=_0xffcee7;return _0x19822a;})['then'](respondWithFilteredResult(_0x4ee6d9,_0x1c18a1))[_0x4006('0x45')](handleError(_0x4ee6d9,null));};exports[_0x4006('0x46')]=function(_0x30b81c,_0x4cfdbb){var _0x7e04db={'raw':!![],'where':{'id':_0x30b81c[_0x4006('0x47')]['id']}},_0x432a={};_0x432a[_0x4006('0x30')]=_[_0x4006('0x31')](db[_0x4006('0x2b')][_0x4006('0x2c')]);_0x432a['query']=_['keys'](_0x30b81c['query']);_0x432a[_0x4006('0x3b')]=_[_0x4006('0x33')](_0x432a['model'],_0x432a[_0x4006('0x32')]);_0x7e04db[_0x4006('0x34')]=_[_0x4006('0x33')](_0x432a[_0x4006('0x30')],qs['fields'](_0x30b81c[_0x4006('0x32')][_0x4006('0x35')]));_0x7e04db[_0x4006('0x34')]=_0x7e04db[_0x4006('0x34')][_0x4006('0x36')]?_0x7e04db[_0x4006('0x34')]:_0x432a[_0x4006('0x30')];if(_0x30b81c[_0x4006('0x32')][_0x4006('0x41')]){_0x7e04db[_0x4006('0x42')]=[{'all':!![]}];}_0x7e04db=_[_0x4006('0x3e')]({},_0x7e04db,_0x30b81c[_0x4006('0x40')]);return db[_0x4006('0x2b')][_0x4006('0x48')](_0x7e04db)[_0x4006('0x25')](handleEntityNotFound(_0x4cfdbb,null))[_0x4006('0x25')](respondWithResult(_0x4cfdbb,null))[_0x4006('0x45')](handleError(_0x4cfdbb,null));};exports[_0x4006('0x49')]=function(_0x8840d9,_0x271f16){var _0x34d094={'where':{'id':_0x8840d9[_0x4006('0x47')]['id']}},_0x3dd535={};_0x3dd535[_0x4006('0x30')]=_[_0x4006('0x31')](db['Attachment'][_0x4006('0x2c')]);_0x34d094[_0x4006('0x34')]=_[_0x4006('0x33')](_0x3dd535[_0x4006('0x30')],qs[_0x4006('0x35')](_0x8840d9['query']['fields']));_0x34d094[_0x4006('0x34')]=_0x34d094[_0x4006('0x34')][_0x4006('0x36')]?_0x34d094['attributes']:_0x3dd535[_0x4006('0x30')];if(_0x8840d9['query'][_0x4006('0x41')]){_0x34d094[_0x4006('0x42')]=[{'all':!![]}];}_0x34d094=_[_0x4006('0x3e')]({},_0x34d094,_0x8840d9['options']);return db[_0x4006('0x2b')][_0x4006('0x48')](_0x34d094)[_0x4006('0x25')](handleEntityNotFound(_0x271f16,null))[_0x4006('0x25')](function(_0x538f59){if(_0x538f59){var _0x37f97e=_0x538f59[_0x4006('0x4a')]({'plain':!![]});_0x37f97e=qs[_0x4006('0x4b')](_0x37f97e,['id',_0x4006('0x4c'),_0x4006('0x4d')]);_0x8840d9[_0x4006('0x4e')]=_[_0x4006('0x4b')](_0x8840d9[_0x4006('0x4e')],['id',_0x4006('0x4c'),_0x4006('0x4d')]);return db['Attachment'][_0x4006('0x4f')](_[_0x4006('0x3e')](_0x37f97e,_0x8840d9[_0x4006('0x4e')]),{'include':_0x8840d9['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x271f16,0xc9))[_0x4006('0x45')](handleError(_0x271f16,null));};exports[_0x4006('0x50')]=function(_0x49ef5a,_0x239592){if(_0x49ef5a[_0x4006('0x4e')]['id']){delete _0x49ef5a[_0x4006('0x4e')]['id'];}return db[_0x4006('0x2b')][_0x4006('0x48')]({'where':{'id':_0x49ef5a[_0x4006('0x47')]['id']}})[_0x4006('0x25')](handleEntityNotFound(_0x239592,null))['then'](saveUpdates(_0x49ef5a[_0x4006('0x4e')],null))[_0x4006('0x25')](respondWithResult(_0x239592,null))[_0x4006('0x45')](handleError(_0x239592,null));};exports[_0x4006('0x24')]=function(_0x450d7a,_0x565ce7){return db[_0x4006('0x2b')][_0x4006('0x48')]({'where':{'id':_0x450d7a[_0x4006('0x47')]['id']}})[_0x4006('0x25')](handleEntityNotFound(_0x565ce7,null))[_0x4006('0x25')](removeEntity(_0x565ce7,null))[_0x4006('0x45')](handleError(_0x565ce7,null));};exports[_0x4006('0x4f')]=function(_0x10ab7d,_0x2f7051,_0xec7c9f){_0x10ab7d[_0x4006('0x4e')][_0x4006('0x28')]=_0x10ab7d[_0x4006('0x51')][_0x4006('0x52')];_0x10ab7d['body']['basename']=_0x10ab7d[_0x4006('0x51')][_0x4006('0x53')];_0x10ab7d[_0x4006('0x4e')][_0x4006('0x2e')]=_0x10ab7d[_0x4006('0x51')][_0x4006('0x54')];return db[_0x4006('0x2b')][_0x4006('0x4f')](_0x10ab7d[_0x4006('0x4e')])[_0x4006('0x25')](respondWithResult(_0x2f7051,0xc9))[_0x4006('0x45')](handleError(_0x2f7051,null));};exports[_0x4006('0x55')]=function(_0x1f1cab,_0x2f8f52,_0x21020a){return db[_0x4006('0x2b')][_0x4006('0x56')]({'where':{'id':_0x1f1cab[_0x4006('0x47')]['id']},'raw':!![]})[_0x4006('0x25')](handleEntityNotFound(_0x2f8f52,null))[_0x4006('0x25')](function(_0x1d003b){if(_0x1d003b){var _0x46abbf=_0x1d003b[_0x4006('0x57')]!==null;var _0x261771=path[_0x4006('0x58')](config[_0x4006('0x59')],_0x4006('0x5a'));if(_0x46abbf){_0x261771=path[_0x4006('0x58')](_0x261771,'offline-chat/');}var _0x55626e=path['join'](_0x261771,_0x1d003b[_0x4006('0x5b')]);return _0x2f8f52[_0x4006('0x55')](_0x55626e);}})[_0x4006('0x45')](handleError(_0x2f8f52,null));}; \ No newline at end of file +var _0x7986=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','get','omit','createdAt','updatedAt','body','destroy','file','originalname','basename','filename','mimetype','create','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','to-csv'];(function(_0x7aa744,_0x450c0d){var _0x3ef3cb=function(_0x44cc93){while(--_0x44cc93){_0x7aa744['push'](_0x7aa744['shift']());}};_0x3ef3cb(++_0x450c0d);}(_0x7986,0xab));var _0x6798=function(_0x1146ca,_0x50249a){_0x1146ca=_0x1146ca-0x0;var _0xce8354=_0x7986[_0x1146ca];return _0xce8354;};'use strict';var emlformat=require(_0x6798('0x0'));var rimraf=require(_0x6798('0x1'));var zipdir=require(_0x6798('0x2'));var jsonpatch=require(_0x6798('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6798('0x4'));var path=require('path');var sox=require(_0x6798('0x5'));var csv=require(_0x6798('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6798('0x7'));var squel=require(_0x6798('0x8'));var crypto=require(_0x6798('0x9'));var jsforce=require(_0x6798('0xa'));var deskjs=require(_0x6798('0xb'));var toCsv=require(_0x6798('0x6'));var querystring=require(_0x6798('0xc'));var Papa=require(_0x6798('0xd'));var Redis=require(_0x6798('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6798('0xf'));var as=require(_0x6798('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6798('0x11'))(_0x6798('0x12'));var utils=require(_0x6798('0x13'));var config=require(_0x6798('0x14'));var licenseUtil=require(_0x6798('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a0d8,_0x4c146c){_0x4c146c=_0x4c146c||0xcc;return function(_0x29cfa7){if(_0x29cfa7){return _0x12a0d8['sendStatus'](_0x4c146c);}return _0x12a0d8[_0x6798('0x16')](_0x4c146c)[_0x6798('0x17')]();};}function respondWithResult(_0xd96afe,_0x25ad8a){_0x25ad8a=_0x25ad8a||0xc8;return function(_0x181199){if(_0x181199){return _0xd96afe['status'](_0x25ad8a)['json'](_0x181199);}};}function respondWithFilteredResult(_0x5b959c,_0x5adbcb){return function(_0x1c9f15){if(_0x1c9f15){var _0x4c6596=typeof _0x5adbcb[_0x6798('0x18')]===_0x6798('0x19')&&typeof _0x5adbcb[_0x6798('0x1a')]==='undefined';var _0x39164b=_0x1c9f15['count'];var _0x3d7e33=_0x4c6596?0x0:_0x5adbcb['offset'];var _0x426b42=_0x4c6596?_0x1c9f15[_0x6798('0x1b')]:_0x5adbcb[_0x6798('0x18')]+_0x5adbcb['limit'];var _0x37441e;if(_0x426b42>=_0x39164b){_0x426b42=_0x39164b;_0x37441e=0xc8;}else{_0x37441e=0xce;}_0x5b959c[_0x6798('0x16')](_0x37441e);return _0x5b959c['set']('Content-Range',_0x3d7e33+'-'+_0x426b42+'/'+_0x39164b)[_0x6798('0x1c')](_0x1c9f15);}return null;};}function patchUpdates(_0x42c96a){return function(_0x1eb16d){try{jsonpatch[_0x6798('0x1d')](_0x1eb16d,_0x42c96a,!![]);}catch(_0x496f3b){return BPromise[_0x6798('0x1e')](_0x496f3b);}return _0x1eb16d[_0x6798('0x1f')]();};}function saveUpdates(_0x59aaa7,_0x57be28){return function(_0x99aac3){if(_0x99aac3){return _0x99aac3[_0x6798('0x20')](_0x59aaa7)[_0x6798('0x21')](function(_0x382454){return _0x382454;});}return null;};}function removeEntity(_0x5a2b41,_0x8398bb){return function(_0x3567f7){if(_0x3567f7){return _0x3567f7['destroy']()[_0x6798('0x21')](function(){_0x5a2b41[_0x6798('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420c9c,_0x817d2f){return function(_0x42d358){if(!_0x42d358){_0x420c9c[_0x6798('0x22')](0x194);}return _0x42d358;};}function handleError(_0x1c995b,_0xca2090){_0xca2090=_0xca2090||0x1f4;return function(_0x4d017c){logger[_0x6798('0x23')](_0x4d017c[_0x6798('0x24')]);if(_0x4d017c[_0x6798('0x25')]){delete _0x4d017c[_0x6798('0x25')];}_0x1c995b[_0x6798('0x16')](_0xca2090)[_0x6798('0x26')](_0x4d017c);};}exports[_0x6798('0x27')]=function(_0x357852,_0x3d3d59){var _0x5405ae={},_0x10f589={},_0x3bc348={'count':0x0,'rows':[]};var _0x102158=_[_0x6798('0x28')](db[_0x6798('0x29')][_0x6798('0x2a')],function(_0x46fda1){return{'name':_0x46fda1['fieldName'],'type':_0x46fda1[_0x6798('0x2b')][_0x6798('0x2c')]};});_0x10f589[_0x6798('0x2d')]=_['map'](_0x102158,'name');_0x10f589[_0x6798('0x2e')]=_[_0x6798('0x2f')](_0x357852[_0x6798('0x2e')]);_0x10f589[_0x6798('0x30')]=_[_0x6798('0x31')](_0x10f589[_0x6798('0x2d')],_0x10f589[_0x6798('0x2e')]);_0x5405ae[_0x6798('0x32')]=_[_0x6798('0x31')](_0x10f589['model'],qs[_0x6798('0x33')](_0x357852[_0x6798('0x2e')][_0x6798('0x33')]));_0x5405ae[_0x6798('0x32')]=_0x5405ae[_0x6798('0x32')][_0x6798('0x34')]?_0x5405ae[_0x6798('0x32')]:_0x10f589[_0x6798('0x2d')];if(!_0x357852['query'][_0x6798('0x35')](_0x6798('0x36'))){_0x5405ae[_0x6798('0x1a')]=qs[_0x6798('0x1a')](_0x357852[_0x6798('0x2e')][_0x6798('0x1a')]);_0x5405ae[_0x6798('0x18')]=qs[_0x6798('0x18')](_0x357852[_0x6798('0x2e')][_0x6798('0x18')]);}_0x5405ae[_0x6798('0x37')]=qs['sort'](_0x357852[_0x6798('0x2e')][_0x6798('0x38')]);_0x5405ae[_0x6798('0x39')]=qs[_0x6798('0x30')](_[_0x6798('0x3a')](_0x357852[_0x6798('0x2e')],_0x10f589[_0x6798('0x30')]),_0x102158);if(_0x357852['query'][_0x6798('0x3b')]){_0x5405ae[_0x6798('0x39')]=_[_0x6798('0x3c')](_0x5405ae['where'],{'$or':_['map'](_0x102158,function(_0x4b1ea2){if(_0x4b1ea2[_0x6798('0x2b')]!==_0x6798('0x3d')){var _0x217d67={};_0x217d67[_0x4b1ea2['name']]={'$like':'%'+_0x357852[_0x6798('0x2e')][_0x6798('0x3b')]+'%'};return _0x217d67;}})});}_0x5405ae=_[_0x6798('0x3c')]({},_0x5405ae,_0x357852[_0x6798('0x3e')]);var _0x57134c={'where':_0x5405ae[_0x6798('0x39')]};return db['Attachment'][_0x6798('0x1b')](_0x57134c)['then'](function(_0x4b3b1d){_0x3bc348[_0x6798('0x1b')]=_0x4b3b1d;if(_0x357852[_0x6798('0x2e')]['includeAll']){_0x5405ae['include']=[{'all':!![]}];}return db[_0x6798('0x29')][_0x6798('0x3f')](_0x5405ae);})['then'](function(_0x5e8efb){_0x3bc348[_0x6798('0x40')]=_0x5e8efb;return _0x3bc348;})['then'](respondWithFilteredResult(_0x3d3d59,_0x5405ae))[_0x6798('0x41')](handleError(_0x3d3d59,null));};exports[_0x6798('0x42')]=function(_0x428dab,_0x3445d1){var _0x3f4b2a={'raw':!![],'where':{'id':_0x428dab[_0x6798('0x43')]['id']}},_0x13e25d={};_0x13e25d['model']=_[_0x6798('0x2f')](db[_0x6798('0x29')][_0x6798('0x2a')]);_0x13e25d['query']=_[_0x6798('0x2f')](_0x428dab['query']);_0x13e25d[_0x6798('0x30')]=_[_0x6798('0x31')](_0x13e25d[_0x6798('0x2d')],_0x13e25d[_0x6798('0x2e')]);_0x3f4b2a[_0x6798('0x32')]=_[_0x6798('0x31')](_0x13e25d[_0x6798('0x2d')],qs['fields'](_0x428dab[_0x6798('0x2e')][_0x6798('0x33')]));_0x3f4b2a[_0x6798('0x32')]=_0x3f4b2a[_0x6798('0x32')]['length']?_0x3f4b2a['attributes']:_0x13e25d['model'];if(_0x428dab['query'][_0x6798('0x44')]){_0x3f4b2a['include']=[{'all':!![]}];}_0x3f4b2a=_[_0x6798('0x3c')]({},_0x3f4b2a,_0x428dab[_0x6798('0x3e')]);return db[_0x6798('0x29')][_0x6798('0x45')](_0x3f4b2a)['then'](handleEntityNotFound(_0x3445d1,null))[_0x6798('0x21')](respondWithResult(_0x3445d1,null))['catch'](handleError(_0x3445d1,null));};exports['clone']=function(_0x839b9c,_0x1c467d){var _0x14735e={'where':{'id':_0x839b9c[_0x6798('0x43')]['id']}},_0x51eb41={};_0x51eb41[_0x6798('0x2d')]=_[_0x6798('0x2f')](db['Attachment'][_0x6798('0x2a')]);_0x14735e[_0x6798('0x32')]=_[_0x6798('0x31')](_0x51eb41['model'],qs[_0x6798('0x33')](_0x839b9c['query'][_0x6798('0x33')]));_0x14735e[_0x6798('0x32')]=_0x14735e[_0x6798('0x32')]['length']?_0x14735e[_0x6798('0x32')]:_0x51eb41['model'];if(_0x839b9c[_0x6798('0x2e')]['includeAll']){_0x14735e['include']=[{'all':!![]}];}_0x14735e=_[_0x6798('0x3c')]({},_0x14735e,_0x839b9c[_0x6798('0x3e')]);return db[_0x6798('0x29')]['find'](_0x14735e)[_0x6798('0x21')](handleEntityNotFound(_0x1c467d,null))[_0x6798('0x21')](function(_0x10ab10){if(_0x10ab10){var _0x24ec06=_0x10ab10[_0x6798('0x46')]({'plain':!![]});_0x24ec06=qs[_0x6798('0x47')](_0x24ec06,['id',_0x6798('0x48'),_0x6798('0x49')]);_0x839b9c[_0x6798('0x4a')]=_[_0x6798('0x47')](_0x839b9c[_0x6798('0x4a')],['id',_0x6798('0x48'),'updatedAt']);return db[_0x6798('0x29')]['create'](_[_0x6798('0x3c')](_0x24ec06,_0x839b9c['body']),{'include':_0x839b9c[_0x6798('0x2e')][_0x6798('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1c467d,0xc9))[_0x6798('0x41')](handleError(_0x1c467d,null));};exports['update']=function(_0x278d5c,_0x8a40fe){if(_0x278d5c[_0x6798('0x4a')]['id']){delete _0x278d5c[_0x6798('0x4a')]['id'];}return db['Attachment']['find']({'where':{'id':_0x278d5c[_0x6798('0x43')]['id']}})[_0x6798('0x21')](handleEntityNotFound(_0x8a40fe,null))[_0x6798('0x21')](saveUpdates(_0x278d5c[_0x6798('0x4a')],null))[_0x6798('0x21')](respondWithResult(_0x8a40fe,null))[_0x6798('0x41')](handleError(_0x8a40fe,null));};exports[_0x6798('0x4b')]=function(_0x3e6a80,_0x40a9a5){return db[_0x6798('0x29')]['find']({'where':{'id':_0x3e6a80[_0x6798('0x43')]['id']}})[_0x6798('0x21')](handleEntityNotFound(_0x40a9a5,null))['then'](removeEntity(_0x40a9a5,null))[_0x6798('0x41')](handleError(_0x40a9a5,null));};exports['create']=function(_0x1d97a2,_0x90c533,_0x4f0841){_0x1d97a2[_0x6798('0x4a')]['name']=_0x1d97a2[_0x6798('0x4c')][_0x6798('0x4d')];_0x1d97a2['body'][_0x6798('0x4e')]=_0x1d97a2['file'][_0x6798('0x4f')];_0x1d97a2[_0x6798('0x4a')][_0x6798('0x2b')]=_0x1d97a2[_0x6798('0x4c')][_0x6798('0x50')];return db[_0x6798('0x29')][_0x6798('0x51')](_0x1d97a2[_0x6798('0x4a')])[_0x6798('0x21')](respondWithResult(_0x90c533,0xc9))[_0x6798('0x41')](handleError(_0x90c533,null));};exports[_0x6798('0x52')]=function(_0x2cf192,_0x586f68,_0x62dc07){return db[_0x6798('0x29')][_0x6798('0x53')]({'where':{'id':_0x2cf192[_0x6798('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x586f68,null))[_0x6798('0x21')](function(_0x2d19ea){if(_0x2d19ea){var _0x48d51b=_0x2d19ea[_0x6798('0x54')]!==null;var _0x1d24ac=path[_0x6798('0x55')](config[_0x6798('0x56')],_0x6798('0x57'));if(_0x48d51b){_0x1d24ac=path[_0x6798('0x55')](_0x1d24ac,_0x6798('0x58'));}var _0xaf2426=path[_0x6798('0x55')](_0x1d24ac,_0x2d19ea[_0x6798('0x4e')]);return _0x586f68['download'](_0xaf2426);}})[_0x6798('0x41')](handleError(_0x586f68,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8ff03ce..5bdb69c 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 _0x706c=['rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x566dd0,_0x4ec243){var _0x14df27=function(_0x363568){while(--_0x363568){_0x566dd0['push'](_0x566dd0['shift']());}};_0x14df27(++_0x4ec243);}(_0x706c,0x9d));var _0xc706=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x706c[_0x577519];return _0x5b12f7;};'use strict';var _=require(_0xc706('0x0'));var util=require(_0xc706('0x1'));var logger=require(_0xc706('0x2'))(_0xc706('0x3'));var moment=require(_0xc706('0x4'));var BPromise=require(_0xc706('0x5'));var rp=require(_0xc706('0x6'));var fs=require('fs');var path=require(_0xc706('0x7'));var rimraf=require(_0xc706('0x8'));var config=require(_0xc706('0x9'));var attributes=require(_0xc706('0xa'));module[_0xc706('0xb')]=function(_0x3bbba9,_0x73d8b4){return _0x3bbba9[_0xc706('0xc')](_0xc706('0xd'),attributes,{'tableName':_0xc706('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd12c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash'];(function(_0x4f9204,_0x5c4f49){var _0x3780b3=function(_0xea99a9){while(--_0xea99a9){_0x4f9204['push'](_0x4f9204['shift']());}};_0x3780b3(++_0x5c4f49);}(_0xd12c,0x16b));var _0xcd12=function(_0xeaf2ab,_0x59c9b8){_0xeaf2ab=_0xeaf2ab-0x0;var _0x33422a=_0xd12c[_0xeaf2ab];return _0x33422a;};'use strict';var _=require(_0xcd12('0x0'));var util=require(_0xcd12('0x1'));var logger=require(_0xcd12('0x2'))(_0xcd12('0x3'));var moment=require(_0xcd12('0x4'));var BPromise=require(_0xcd12('0x5'));var rp=require(_0xcd12('0x6'));var fs=require('fs');var path=require(_0xcd12('0x7'));var rimraf=require(_0xcd12('0x8'));var config=require(_0xcd12('0x9'));var attributes=require(_0xcd12('0xa'));module[_0xcd12('0xb')]=function(_0x516db7,_0x11c0d6){return _0x516db7[_0xcd12('0xc')]('Attachment',attributes,{'tableName':_0xcd12('0xd'),'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 08c9c4c..6501f30 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 _0x803f=['then','info','request\x20sent','debug','stringify','error','code','message','Attachment,\x20%s,\x20%s','result','catch','CreateAttachment','Attachment','create','body','options','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x652dbc,_0x20cb94){var _0x3a9bd4=function(_0x2bba9b){while(--_0x2bba9b){_0x652dbc['push'](_0x652dbc['shift']());}};_0x3a9bd4(++_0x20cb94);}(_0x803f,0x64));var _0xf803=function(_0x22f048,_0x20c372){_0x22f048=_0x22f048-0x0;var _0xda0bfa=_0x803f[_0x22f048];return _0xda0bfa;};'use strict';var _=require(_0xf803('0x0'));var util=require('util');var moment=require(_0xf803('0x1'));var BPromise=require(_0xf803('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf803('0x3'));var db=require(_0xf803('0x4'))['db'];var utils=require(_0xf803('0x5'));var logger=require(_0xf803('0x6'))(_0xf803('0x7'));var config=require('../../config/environment');var jayson=require(_0xf803('0x8'));var client=jayson[_0xf803('0x9')][_0xf803('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x584b2d,_0x214708,_0x47128f){return new BPromise(function(_0x587319,_0x3fc5ce){return client[_0xf803('0xb')](_0x584b2d,_0x47128f)[_0xf803('0xc')](function(_0x4c95cb){logger[_0xf803('0xd')]('Attachment,\x20%s,\x20%s',_0x214708,_0xf803('0xe'));logger[_0xf803('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x214708,_0xf803('0xe'),JSON[_0xf803('0x10')](_0x4c95cb));if(_0x4c95cb[_0xf803('0x11')]){if(_0x4c95cb[_0xf803('0x11')][_0xf803('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x214708,_0x4c95cb[_0xf803('0x11')][_0xf803('0x13')]);return _0x3fc5ce(_0x4c95cb['error'][_0xf803('0x13')]);}logger['error'](_0xf803('0x14'),_0x214708,_0x4c95cb[_0xf803('0x11')][_0xf803('0x13')]);return _0x587319(_0x4c95cb[_0xf803('0x11')]['message']);}else{logger[_0xf803('0xd')](_0xf803('0x14'),_0x214708,_0xf803('0xe'));_0x587319(_0x4c95cb[_0xf803('0x15')][_0xf803('0x13')]);}})[_0xf803('0x16')](function(_0xbd7728){logger['error']('Attachment,\x20%s,\x20%s',_0x214708,_0xbd7728);_0x3fc5ce(_0xbd7728);});});}exports[_0xf803('0x17')]=function(_0x292179){var _0x5c775b=this;return new Promise(function(_0x36d347,_0x29e28f){return db[_0xf803('0x18')][_0xf803('0x19')](_0x292179[_0xf803('0x1a')],{'raw':_0x292179[_0xf803('0x1b')]?_0x292179[_0xf803('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf803('0xc')](function(_0x252421){logger[_0xf803('0xd')](_0xf803('0x17'),_0x292179);logger[_0xf803('0xf')]('CreateAttachment',_0x292179,JSON[_0xf803('0x10')](_0x252421));_0x36d347(_0x252421);})[_0xf803('0x16')](function(_0x4a5299){logger[_0xf803('0x11')](_0xf803('0x17'),_0x4a5299[_0xf803('0x13')],_0x292179);_0x29e28f(_0x5c775b[_0xf803('0x11')](0x1f4,_0x4a5299[_0xf803('0x13')]));});});}; \ No newline at end of file +var _0x00b3=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateAttachment','create','body','options','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x00b3,0x17a));var _0x300b=function(_0x257df1,_0xd301fd){_0x257df1=_0x257df1-0x0;var _0x2e5d03=_0x00b3[_0x257df1];return _0x2e5d03;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});}exports[_0x300b('0x15')]=function(_0x4d2024){var _0x1fbf16=this;return new Promise(function(_0x2a7d96,_0xb4b3fa){return db['Attachment'][_0x300b('0x16')](_0x4d2024[_0x300b('0x17')],{'raw':_0x4d2024[_0x300b('0x18')]?_0x4d2024[_0x300b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x300b('0xb')](function(_0x16bfc6){logger[_0x300b('0x13')]('CreateAttachment',_0x4d2024);logger[_0x300b('0xe')](_0x300b('0x15'),_0x4d2024,JSON[_0x300b('0x10')](_0x16bfc6));_0x2a7d96(_0x16bfc6);})[_0x300b('0x19')](function(_0x26913f){logger['error']('CreateAttachment',_0x26913f[_0x300b('0x12')],_0x4d2024);_0xb4b3fa(_0x1fbf16[_0x300b('0x11')](0x1f4,_0x26913f[_0x300b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 249208f..a00d655 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x318d7c,_0x3e0150){var _0x550dc2=function(_0x592856){while(--_0x592856){_0x318d7c['push'](_0x318d7c['shift']());}};_0x550dc2(++_0x3e0150);}(_0x2032,0xd9));var _0x2203=function(_0x87db3b,_0x8c8cca){_0x87db3b=_0x87db3b-0x0;var _0x3992be=_0x2032[_0x87db3b];return _0x3992be;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +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(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'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 be25b1e..9d3bb68 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 _0x00c9=['Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','online','admin','user','agent','then','name','blocked','blockedAt','add','clearBlockUser','getLicense','catch','status','message','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport-local','activedirectory2','bluebird','util','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured'];(function(_0x54d77d,_0x4d560a){var _0x40eb65=function(_0x531b88){while(--_0x531b88){_0x54d77d['push'](_0x54d77d['shift']());}};_0x40eb65(++_0x4d560a);}(_0x00c9,0x1ce));var _0x900c=function(_0x267210,_0x2e390f){_0x267210=_0x267210-0x0;var _0x5d0893=_0x00c9[_0x267210];return _0x5d0893;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x900c('0x0'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x900c('0x1'));var BPromise=require(_0x900c('0x2'));var util=require(_0x900c('0x3'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x900c('0x4'));var config=require(_0x900c('0x5'));var logger=require('../../config/logger')(_0x900c('0x6'));function isActiveDirectoryConfigured(_0x583c9f){var _0x5e3d50=![];if(typeof _0x583c9f[_0x900c('0x7')]!==_0x900c('0x8')){_0x5e3d50=_0x583c9f[_0x900c('0x7')][_0x900c('0x9')]&&_0x583c9f[_0x900c('0x7')][_0x900c('0xa')]&&_0x583c9f[_0x900c('0x7')][_0x900c('0xb')];}return _0x5e3d50;}function adAuthenticate(_0xcdca3,_0x40d978,_0x3937ca){return new BPromise(function(_0x583622,_0x11faa1){try{var _0xa9483c=new ActiveDirectory(_0xcdca3);_0xa9483c['authenticate'](_0x40d978,_0x3937ca,function(_0x318899,_0x4afa4a){if(_0x318899){logger[_0x900c('0xc')](_0x900c('0xd'),_0x40d978,util[_0x900c('0xe')](_0x318899,{'showHidden':![],'depth':null}));_0x11faa1('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x4afa4a){logger[_0x900c('0xc')](_0x900c('0xf'),_0x40d978);_0x11faa1(_0x900c('0x10'));}else{_0x583622(_0x4afa4a);}});}catch(_0xf927ef){_0x11faa1(_0xf927ef);}});}function ActiveDirectoryAuthenticate(_0x491197,_0x47382e,_0x49995d,_0x467c45){var _0x4c337d,_0x220fad;if(!isActiveDirectoryConfigured(config)){logger[_0x900c('0xc')](_0x900c('0x11'),_0x47382e);return _0x467c45(null,![],{'message':_0x900c('0x10')});}return db[_0x900c('0x12')][_0x900c('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x900c('0x14')],'raw':!![]})['then'](function(_0xb31eca){_0x4c337d=_0xb31eca;if(!_0x4c337d[_0x900c('0x15')]){logger[_0x900c('0xc')](_0x900c('0x16'),_0x47382e);throw new Error(_0x900c('0x10'));}return _0x491197[_0x900c('0x13')]({'logging':!![],'attributes':['id','name',_0x900c('0x17'),_0x900c('0x18'),_0x900c('0x19'),_0x900c('0x1a'),'blocked','blockedAt',_0x900c('0x1b')],'where':{'name':_0x47382e,'role':{'$or':[_0x900c('0x1c'),_0x900c('0x1d'),_0x900c('0x1e')]},'adSsoEnabled':!![]}});})[_0x900c('0x1f')](function(_0x8c2fa0){if(!_0x8c2fa0||_0x8c2fa0&&_0x8c2fa0[_0x900c('0x20')]!==_0x47382e){throw new Error(_0x900c('0x10'));}_0x220fad=_0x8c2fa0;var _0x5574ca=_0x220fad[_0x900c('0x20')]+'@'+config[_0x900c('0x7')][_0x900c('0xb')];return adAuthenticate(config[_0x900c('0x7')],_0x5574ca,_0x49995d);})[_0x900c('0x1f')](function(_0x2360e9){if(_0x220fad[_0x900c('0x1a')]){throw new Error(_0x900c('0x10'));}if(_0x4c337d[_0x900c('0x14')]>0x0){if(_0x220fad[_0x900c('0x21')]){if(moment(_0x220fad[_0x900c('0x22')])[_0x900c('0x23')](_0x4c337d[_0x900c('0x14')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x900c('0x24')](_0x220fad,0x0,![],null)[_0x900c('0x1f')](function(){return utils[_0x900c('0x25')](_0x220fad);})[_0x900c('0x1f')](function(){return _0x467c45(null,_0x220fad);});}else{return utils[_0x900c('0x25')](_0x220fad)[_0x900c('0x1f')](function(){return _0x467c45(null,_0x220fad);});}}else{return utils['getLicense'](_0x220fad)[_0x900c('0x1f')](function(){return _0x467c45(null,_0x220fad);});}})[_0x900c('0x26')](function(_0x31489c){return _0x467c45(null,![],_0x31489c);});}function handleError(_0x222ca0,_0x57752f,_0x39702e){return _0x222ca0[_0x900c('0x27')](_0x57752f||0x1f4)['send']({'message':_0x39702e?_0x39702e[_0x900c('0x28')]||_0x39702e:''});}exports['login']=function(_0x2733c7,_0x5030a6,_0x27f63c){passport[_0x900c('0x29')](_0x900c('0x2a'),function(_0x1304cc,_0x16e668,_0x2a430b){var _0x2a667=_0x1304cc||_0x2a430b;if(_0x2a667){return handleError(_0x5030a6,0x191,_0x2a667);}if(!_0x16e668){return handleError(_0x5030a6,0x194,{'message':_0x900c('0x2b')});}else{var _0x4209d8={'payload':{'id':_0x16e668['id'],'role':_0x16e668[_0x900c('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0x900c('0x2c')](_0x4209d8)[_0x900c('0x1f')](function(_0x56e7d8){_0x5030a6[_0x900c('0x2d')]({'id':_0x16e668['id'],'token':_0x56e7d8,'statusCall':'','isAlreadyLogged':_0x16e668[_0x900c('0x1b')]});});}})(_0x2733c7,_0x5030a6,_0x27f63c);};passport[_0x900c('0x2e')](_0x900c('0x2a'),new LocalStrategy({'usernameField':_0x900c('0x20'),'passwordField':'password'},function(_0x512400,_0x5b245f,_0x417ff1){return ActiveDirectoryAuthenticate(db[_0x900c('0x2f')],_0x512400,_0x5b245f,_0x417ff1);})); \ No newline at end of file +var _0xa793=['domain','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','adSsoEnabled','blockDuration','then','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blockedAt','online','admin','user','agent','blocked','add','clearBlockUser','getLicense','status','send','message','ad-login','json','use','User','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url'];(function(_0x398a18,_0xe73c44){var _0x388956=function(_0x44ff0d){while(--_0x44ff0d){_0x398a18['push'](_0x398a18['shift']());}};_0x388956(++_0xe73c44);}(_0xa793,0x101));var _0x3a79=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0xa793[_0x5a6961];return _0x4af0a6;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x3a79('0x0'))['Strategy'];var moment=require(_0x3a79('0x1'));var ActiveDirectory=require(_0x3a79('0x2'));var BPromise=require(_0x3a79('0x3'));var util=require(_0x3a79('0x4'));var db=require(_0x3a79('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0x3a79('0x6'));var logger=require(_0x3a79('0x7'))(_0x3a79('0x8'));function isActiveDirectoryConfigured(_0x4f472c){var _0x1b85e7=![];if(typeof _0x4f472c[_0x3a79('0x9')]!==_0x3a79('0xa')){_0x1b85e7=_0x4f472c[_0x3a79('0x9')][_0x3a79('0xb')]&&_0x4f472c['activedirectory'][_0x3a79('0xc')]&&_0x4f472c[_0x3a79('0x9')][_0x3a79('0xd')];}return _0x1b85e7;}function adAuthenticate(_0xba653a,_0x2759eb,_0x110ed9){return new BPromise(function(_0x2eb752,_0x53875c){try{var _0x190095=new ActiveDirectory(_0xba653a);_0x190095[_0x3a79('0xe')](_0x2759eb,_0x110ed9,function(_0x1c318a,_0x2aa4d8){if(_0x1c318a){logger['error'](_0x3a79('0xf'),_0x2759eb,util['inspect'](_0x1c318a,{'showHidden':![],'depth':null}));_0x53875c(_0x3a79('0x10'));}else if(!_0x2aa4d8){logger['error'](_0x3a79('0x11'),_0x2759eb);_0x53875c(_0x3a79('0x10'));}else{_0x2eb752(_0x2aa4d8);}});}catch(_0x4b5214){_0x53875c(_0x4b5214);}});}function ActiveDirectoryAuthenticate(_0x2c3081,_0x1e68f2,_0x173c7e,_0x303e70){var _0xaff34d,_0x317a25;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x1e68f2);return _0x303e70(null,![],{'message':_0x3a79('0x10')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x3a79('0x12'),_0x3a79('0x13')],'raw':!![]})[_0x3a79('0x14')](function(_0x4747eb){_0xaff34d=_0x4747eb;if(!_0xaff34d[_0x3a79('0x12')]){logger[_0x3a79('0x15')](_0x3a79('0x16'),_0x1e68f2);throw new Error(_0x3a79('0x10'));}return _0x2c3081[_0x3a79('0x17')]({'logging':!![],'attributes':['id',_0x3a79('0x18'),_0x3a79('0x19'),_0x3a79('0x1a'),_0x3a79('0x1b'),_0x3a79('0x1c'),'blocked',_0x3a79('0x1d'),_0x3a79('0x1e')],'where':{'name':_0x1e68f2,'role':{'$or':[_0x3a79('0x1f'),_0x3a79('0x20'),_0x3a79('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x1da20a){if(!_0x1da20a||_0x1da20a&&_0x1da20a['name']!==_0x1e68f2){throw new Error(_0x3a79('0x10'));}_0x317a25=_0x1da20a;var _0x37936f=_0x317a25[_0x3a79('0x18')]+'@'+config['activedirectory'][_0x3a79('0xd')];return adAuthenticate(config['activedirectory'],_0x37936f,_0x173c7e);})['then'](function(_0x5d0c0d){if(_0x317a25[_0x3a79('0x1c')]){throw new Error(_0x3a79('0x10'));}if(_0xaff34d[_0x3a79('0x13')]>0x0){if(_0x317a25[_0x3a79('0x22')]){if(moment(_0x317a25[_0x3a79('0x1d')])[_0x3a79('0x23')](_0xaff34d[_0x3a79('0x13')],'minutes')>moment()){throw new Error(_0x3a79('0x10'));}return utils[_0x3a79('0x24')](_0x317a25,0x0,![],null)[_0x3a79('0x14')](function(){return utils[_0x3a79('0x25')](_0x317a25);})[_0x3a79('0x14')](function(){return _0x303e70(null,_0x317a25);});}else{return utils[_0x3a79('0x25')](_0x317a25)['then'](function(){return _0x303e70(null,_0x317a25);});}}else{return utils[_0x3a79('0x25')](_0x317a25)[_0x3a79('0x14')](function(){return _0x303e70(null,_0x317a25);});}})['catch'](function(_0x2c47e6){return _0x303e70(null,![],_0x2c47e6);});}function handleError(_0x2d1476,_0x145054,_0x3a1a50){return _0x2d1476[_0x3a79('0x26')](_0x145054||0x1f4)[_0x3a79('0x27')]({'message':_0x3a1a50?_0x3a1a50[_0x3a79('0x28')]||_0x3a1a50:''});}exports['login']=function(_0x535d53,_0x225669,_0x231c0e){passport[_0x3a79('0xe')](_0x3a79('0x29'),function(_0xfb7024,_0x505b87,_0xf8181b){var _0x3feaed=_0xfb7024||_0xf8181b;if(_0x3feaed){return handleError(_0x225669,0x191,_0x3feaed);}if(!_0x505b87){return handleError(_0x225669,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x525cf2={'payload':{'id':_0x505b87['id'],'role':_0x505b87['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x525cf2)['then'](function(_0x5ef893){_0x225669[_0x3a79('0x2a')]({'id':_0x505b87['id'],'token':_0x5ef893,'statusCall':'','isAlreadyLogged':_0x505b87[_0x3a79('0x1e')]});});}})(_0x535d53,_0x225669,_0x231c0e);};passport[_0x3a79('0x2b')](_0x3a79('0x29'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x55870b,_0x1c85e6,_0x11bc76){return ActiveDirectoryAuthenticate(db[_0x3a79('0x2c')],_0x55870b,_0x1c85e6,_0x11bc76);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index d526f22..5756b3b 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 _0x7de2=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x523070,_0x403d59){var _0x2475ec=function(_0x54cfdd){while(--_0x54cfdd){_0x523070['push'](_0x523070['shift']());}};_0x2475ec(++_0x403d59);}(_0x7de2,0x1ba));var _0x27de=function(_0x51f0c2,_0x59fc51){_0x51f0c2=_0x51f0c2-0x0;var _0x1f233b=_0x7de2[_0x51f0c2];return _0x1f233b;};'use strict';var express=require(_0x27de('0x0'));var router=express[_0x27de('0x1')]();var controller=require(_0x27de('0x2'));router[_0x27de('0x3')]('/',controller[_0x27de('0x4')]);module[_0x27de('0x5')]=router; \ No newline at end of file +var _0x70ae=['Router','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70ae,0x182));var _0xe70a=function(_0x339854,_0x5cae3f){_0x339854=_0x339854-0x0;var _0x4b10aa=_0x70ae[_0x339854];return _0x4b10aa;};'use strict';var express=require('express');var router=express[_0xe70a('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0xe70a('0x1')]('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a9e9f37..0fb0f79 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x33dc2c,_0x358dcc){var _0x4909ac=function(_0x2bc092){while(--_0x2bc092){_0x33dc2c['push'](_0x33dc2c['shift']());}};_0x4909ac(++_0x358dcc);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x50641e,_0x3bc2fe){var _0x426fa1=function(_0x509a53){while(--_0x509a53){_0x50641e['push'](_0x50641e['shift']());}};_0x426fa1(++_0x3bc2fe);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 82a598f..df8c7a6 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 _0xc7e6=['passport','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc7e6,0x1ef));var _0x6c7e=function(_0x183d0e,_0x1f520f){_0x183d0e=_0x183d0e-0x0;var _0x278ff8=_0xc7e6[_0x183d0e];return _0x278ff8;};'use strict';var express=require(_0x6c7e('0x0'));var passport=require(_0x6c7e('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x6c7e('0x2'));router[_0x6c7e('0x3')]('/',controller[_0x6c7e('0x4')]);router['get'](_0x6c7e('0x5'),controller['callback'],authService[_0x6c7e('0x6')],userController['login'],authService[_0x6c7e('0x7')]);module['exports']=router; \ No newline at end of file +var _0x5294=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x39e5a8,_0x367273){var _0x5c9feb=function(_0x5a372e){while(--_0x5a372e){_0x39e5a8['push'](_0x39e5a8['shift']());}};_0x5c9feb(++_0x367273);}(_0x5294,0x111));var _0x4529=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5294[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x4529('0x0'));var passport=require(_0x4529('0x1'));var router=express[_0x4529('0x2')]();var controller=require(_0x4529('0x3'));var userController=require(_0x4529('0x4'));var authService=require(_0x4529('0x5'));router['get']('/',controller[_0x4529('0x6')]);router[_0x4529('0x7')](_0x4529('0x8'),controller['callback'],authService[_0x4529('0x9')],userController[_0x4529('0x6')],authService[_0x4529('0xa')]);module[_0x4529('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0d2553f..32b573a 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 _0x54ef=['generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','resetPasswordToken','Password\x20reset!','use','passport','passport-local','Strategy','randomstring','moment','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','Smtp','CloudProvider','getSmtpOptions','merge','format','email','request','SendMail','error','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x54ef,0x108));var _0xf54e=function(_0x416d6b,_0x5b7d06){_0x416d6b=_0x416d6b-0x0;var _0x498e0c=_0x54ef[_0x416d6b];return _0x498e0c;};'use strict';var util=require('util');var passport=require(_0xf54e('0x0'));var LocalStrategy=require(_0xf54e('0x1'))[_0xf54e('0x2')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xf54e('0x5'));var utils=require(_0xf54e('0x6'));var client=jayson[_0xf54e('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x204062,_0x426aa9,_0x1546e9,_0x2e6f99){var _0x3b99c0,_0x522e6e;return db[_0xf54e('0x8')][_0xf54e('0x9')]({'where':{'id':0x1},'attributes':[_0xf54e('0xa'),_0xf54e('0xb')],'raw':!![]})[_0xf54e('0xc')](function(_0x8061ee){_0x3b99c0=_0x8061ee;return _0x204062['findOne']({'attributes':['id',_0xf54e('0xd'),_0xf54e('0xe'),_0xf54e('0xf'),_0xf54e('0x10'),_0xf54e('0x11'),'blocked',_0xf54e('0x12'),_0xf54e('0x13')],'where':{'name':_0x426aa9,'role':{'$or':[_0xf54e('0x14'),_0xf54e('0x15'),'agent']}}});})['then'](function(_0x1d60d5){if(!_0x1d60d5||_0x1d60d5&&_0x1d60d5['name']!==_0x426aa9){throw new Error(_0xf54e('0x16'));}else{_0x522e6e=_0x1d60d5;return _0x522e6e;}})['then'](function(){_0x522e6e[_0xf54e('0x17')](_0x1546e9,function(_0x4394ca,_0x66917e){var _0x11bde6=_0x522e6e['loginAttempts']+0x1;if(_0x4394ca){return _0x2e6f99(_0x4394ca);}else if(!_0x66917e){if(_0x522e6e[_0xf54e('0x11')]){return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});}else if(_0x3b99c0[_0xf54e('0xa')]>0x0){if(_0x522e6e[_0xf54e('0x18')]){if(_0x3b99c0[_0xf54e('0xb')]>0x0){if(moment(_0x522e6e[_0xf54e('0x12')])[_0xf54e('0x19')](_0x3b99c0['blockDuration'],_0xf54e('0x1a'))>moment()){return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});}else{return utils['clearBlockUser'](_0x522e6e,_0x11bde6,![],null)[_0xf54e('0xc')](function(){return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});});}}else{return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});}}else{if(_0x11bde6>=_0x3b99c0[_0xf54e('0xa')]){return utils[_0xf54e('0x1b')](_0x522e6e,0x0,!![],moment())[_0xf54e('0xc')](function(){return _0x2e6f99(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x522e6e,_0x11bde6,![],null)[_0xf54e('0xc')](function(){return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});});}}}else{return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});}}else{if(_0x522e6e[_0xf54e('0x11')]){return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});}else if(_0x3b99c0[_0xf54e('0xa')]>0x0){if(_0x522e6e[_0xf54e('0x18')]){if(_0x3b99c0[_0xf54e('0xb')]>0x0){if(moment(_0x522e6e[_0xf54e('0x12')])[_0xf54e('0x19')](_0x3b99c0[_0xf54e('0xb')],_0xf54e('0x1a'))>moment()){return _0x2e6f99(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf54e('0x1b')](_0x522e6e,0x0,![],null)[_0xf54e('0xc')](function(){return utils[_0xf54e('0x1c')](_0x522e6e);})[_0xf54e('0xc')](function(){return _0x2e6f99(null,_0x522e6e);});}}else{return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});}}else{return utils['clearBlockUser'](_0x522e6e,0x0,![],null)[_0xf54e('0xc')](function(){return utils['getLicense'](_0x522e6e);})[_0xf54e('0xc')](function(){return _0x2e6f99(null,_0x522e6e);})[_0xf54e('0x1d')](function(_0x181c1a){return _0x2e6f99(null,![],_0x181c1a);});}}else{if(_0x522e6e[_0xf54e('0x18')]){return _0x2e6f99(null,![],{'message':_0xf54e('0x16')});}else{return utils[_0xf54e('0x1c')](_0x522e6e)[_0xf54e('0xc')](function(){return _0x2e6f99(null,_0x522e6e);});}}}});})[_0xf54e('0x1d')](function(_0x25f762){return _0x2e6f99(null,![],_0x25f762);});}function sendServiceMail(_0x24991b){return db[_0xf54e('0x1e')][_0xf54e('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xf54e('0xd'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xf54e('0x20'),'include':[{'model':db[_0xf54e('0x21')],'as':'CloudProvider'}]}]})['then'](function(_0x1c6587){if(!_0x1c6587){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5b8088=_0x1c6587[_0xf54e('0x22')]();var _0x8dc62e={'account':_0x5b8088,'message':_[_0xf54e('0x23')]({'from':util[_0xf54e('0x24')]('\x22%s\x22\x20<%s>',_0x1c6587['name'],_0x1c6587[_0xf54e('0x25')]||_0x1c6587['Smtp'][_0xf54e('0x15')])},_0x24991b)};return client[_0xf54e('0x26')](_0xf54e('0x27'),_0x8dc62e);})[_0xf54e('0xc')](function(_0x12982f){if(_0x12982f[_0xf54e('0x28')]){throw new Error(util[_0xf54e('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x12982f['error'][_0xf54e('0x29')]||JSON[_0xf54e('0x2a')](_0x12982f[_0xf54e('0x28')])));}return!![];});}function handleError(_0x2576ce,_0x4a3a6a,_0x4bd2d5){return _0x2576ce['status'](_0x4a3a6a||0x1f4)[_0xf54e('0x2b')]({'message':_0x4bd2d5?_0x4bd2d5[_0xf54e('0x29')]||_0x4bd2d5:''});}exports[_0xf54e('0x2c')]=function(_0x226a72,_0x1ba218,_0x31b6df){passport['authenticate'](_0xf54e('0x2d'),function(_0x2813c4,_0x48324c,_0x22450d){var _0x3c4f6d=_0x2813c4||_0x22450d;if(_0x3c4f6d){return handleError(_0x1ba218,0x191,_0x3c4f6d);}if(!_0x48324c){return handleError(_0x1ba218,0x194,{'message':_0xf54e('0x2e')});}else{var _0x188cdc={'payload':{'id':_0x48324c['id'],'role':_0x48324c[_0xf54e('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xf54e('0x2f')](_0x188cdc)[_0xf54e('0xc')](function(_0x289c67){_0x1ba218[_0xf54e('0x30')]({'id':_0x48324c['id'],'token':_0x289c67,'statusCall':'','isAlreadyLogged':_0x48324c['online']});});}})(_0x226a72,_0x1ba218,_0x31b6df);};exports[_0xf54e('0x31')]=function(_0x240038,_0x1c7a41){if(!_0x240038[_0xf54e('0x32')]['email']){return handleError(_0x1c7a41,0x1f4,{'message':_0xf54e('0x33')});}var _0x7f6b89=rs[_0xf54e('0x34')]();_0x240038['body'][_0xf54e('0x25')]=_0x240038['body']['email'][_0xf54e('0x35')]()[_0xf54e('0x36')]();var _0x4aeadd;return db['Setting'][_0xf54e('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf54e('0xb')],'raw':!![]})[_0xf54e('0xc')](function(_0x2b17a1){_0x4aeadd=_0x2b17a1;return db[_0xf54e('0x37')][_0xf54e('0x1f')]({'where':{'email':_0x240038[_0xf54e('0x32')][_0xf54e('0x25')]}});})['then'](function(_0x181ec7){if(!_0x181ec7){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x181ec7[_0xf54e('0x11')]){throw new Error(_0xf54e('0x38'));}if(_0x181ec7[_0xf54e('0x18')]){if(moment(_0x181ec7[_0xf54e('0x12')])[_0xf54e('0x19')](_0x4aeadd[_0xf54e('0xb')],_0xf54e('0x1a'))>moment()){throw new Error(_0xf54e('0x39'));}else{_0x181ec7[_0xf54e('0x18')]=![];_0x181ec7[_0xf54e('0x12')]=null;}}_0x181ec7['resetPasswordToken']=_0x7f6b89;_0x181ec7[_0xf54e('0x3a')]=Date[_0xf54e('0x3b')]()+0x36ee80;return _0x181ec7['save']();})[_0xf54e('0xc')](function(){return sendServiceMail({'to':_0x240038[_0xf54e('0x32')][_0xf54e('0x25')],'subject':_0xf54e('0x3c'),'text':_0xf54e('0x3d')+_0xf54e('0x3e')+_0xf54e('0x3f')+_0x240038[_0xf54e('0x40')][_0xf54e('0x41')]+_0xf54e('0x42')+_0x7f6b89+'\x0a\x0a'+_0xf54e('0x43')});})['then'](function(){_0x1c7a41[_0xf54e('0x44')](0xc8)[_0xf54e('0x2b')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x2bd0d3){return handleError(_0x1c7a41,0x1f4,_0x2bd0d3);});};exports[_0xf54e('0x45')]=function(_0x50a04c,_0x23ec5b){return db[_0xf54e('0x37')][_0xf54e('0x1f')]({'where':{'resetPasswordToken':_0x50a04c[_0xf54e('0x46')][_0xf54e('0x47')],'resetPasswordExpires':{'$gt':Date[_0xf54e('0x3b')]()}}})[_0xf54e('0xc')](function(_0x112280){if(!_0x112280){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xf54e('0x8')]['findOne']({'attributes':['id','securePassword',_0xf54e('0x48'),_0xf54e('0x49')]})[_0xf54e('0xc')](function(_0x381503){if(_0x381503[_0xf54e('0x4a')])authService['validatePasswordPattern'](_0x50a04c[_0xf54e('0x32')][_0xf54e('0xe')]);if(!_0x381503[_0xf54e('0x48')]||!_0x112280['previousPasswords'])return _0x112280;authService['validatePasswordHistory'](_0x50a04c[_0xf54e('0x32')][_0xf54e('0xe')],_0x112280[_0xf54e('0x4b')],_0x381503[_0xf54e('0x49')]);return _0x112280;})[_0xf54e('0xc')](function(){_0x112280[_0xf54e('0xe')]=_0x50a04c[_0xf54e('0x32')][_0xf54e('0xe')];_0x112280[_0xf54e('0x4c')]=null;_0x112280[_0xf54e('0x3a')]=null;return _0x112280['save']();});})[_0xf54e('0xc')](function(){_0x23ec5b[_0xf54e('0x44')](0xc8)[_0xf54e('0x2b')]({'message':_0xf54e('0x4d')});})[_0xf54e('0x1d')](function(_0x59d538){return handleError(_0x23ec5b,0x1f4,_0x59d538);});};passport[_0xf54e('0x4e')](_0xf54e('0x2d'),new LocalStrategy({'usernameField':_0xf54e('0xd'),'passwordField':_0xf54e('0xe')},function(_0x1fe037,_0x77fd08,_0x32451b){return localAuthenticate(db['User'],_0x1fe037,_0x77fd08,_0x32451b);})); \ No newline at end of file +var _0x1915=['minutes','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','email','trim','User','find','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://','headers','host','/reset/','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','role','disabled','blockedAt','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','blocked','add'];(function(_0x6489f3,_0x4f479c){var _0x5583f5=function(_0x1fbfe5){while(--_0x1fbfe5){_0x6489f3['push'](_0x6489f3['shift']());}};_0x5583f5(++_0x4f479c);}(_0x1915,0xd8));var _0x5191=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1915[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x5191('0x0'));var passport=require(_0x5191('0x1'));var LocalStrategy=require(_0x5191('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x5191('0x3'));var rs=require('randomstring');var moment=require(_0x5191('0x4'));var db=require(_0x5191('0x5'))['db'];var authService=require(_0x5191('0x6'));var utils=require(_0x5191('0x7'));var client=jayson['client'][_0x5191('0x8')]({'port':0x232b});function localAuthenticate(_0x13eec1,_0x48af03,_0x2b3e3b,_0x31afe5){var _0x5ead24,_0x10b972;return db[_0x5191('0x9')][_0x5191('0xa')]({'where':{'id':0x1},'attributes':[_0x5191('0xb'),_0x5191('0xc')],'raw':!![]})['then'](function(_0x30cb3d){_0x5ead24=_0x30cb3d;return _0x13eec1[_0x5191('0xa')]({'attributes':['id','name',_0x5191('0xd'),_0x5191('0xe'),_0x5191('0xf'),_0x5191('0x10'),'blocked',_0x5191('0x11'),_0x5191('0x12')],'where':{'name':_0x48af03,'role':{'$or':[_0x5191('0x13'),'user',_0x5191('0x14')]}}});})['then'](function(_0x39b916){if(!_0x39b916||_0x39b916&&_0x39b916[_0x5191('0x15')]!==_0x48af03){throw new Error(_0x5191('0x16'));}else{_0x10b972=_0x39b916;return _0x10b972;}})[_0x5191('0x17')](function(){_0x10b972[_0x5191('0x18')](_0x2b3e3b,function(_0x41ecbb,_0x4ef982){var _0x5d2452=_0x10b972[_0x5191('0x12')]+0x1;if(_0x41ecbb){return _0x31afe5(_0x41ecbb);}else if(!_0x4ef982){if(_0x10b972[_0x5191('0x10')]){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5ead24[_0x5191('0xb')]>0x0){if(_0x10b972[_0x5191('0x19')]){if(_0x5ead24[_0x5191('0xc')]>0x0){if(moment(_0x10b972['blockedAt'])[_0x5191('0x1a')](_0x5ead24[_0x5191('0xc')],_0x5191('0x1b'))>moment()){return _0x31afe5(null,![],{'message':_0x5191('0x16')});}else{return utils[_0x5191('0x1c')](_0x10b972,_0x5d2452,![],null)[_0x5191('0x17')](function(){return _0x31afe5(null,![],{'message':_0x5191('0x16')});});}}else{return _0x31afe5(null,![],{'message':_0x5191('0x16')});}}else{if(_0x5d2452>=_0x5ead24['allowedLoginAttempts']){return utils[_0x5191('0x1c')](_0x10b972,0x0,!![],moment())[_0x5191('0x17')](function(){return _0x31afe5(null,![],{'message':_0x5191('0x16')});});}else{return utils[_0x5191('0x1c')](_0x10b972,_0x5d2452,![],null)[_0x5191('0x17')](function(){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x31afe5(null,![],{'message':_0x5191('0x16')});}}else{if(_0x10b972[_0x5191('0x10')]){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5ead24[_0x5191('0xb')]>0x0){if(_0x10b972[_0x5191('0x19')]){if(_0x5ead24[_0x5191('0xc')]>0x0){if(moment(_0x10b972[_0x5191('0x11')])[_0x5191('0x1a')](_0x5ead24[_0x5191('0xc')],_0x5191('0x1b'))>moment()){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5191('0x1c')](_0x10b972,0x0,![],null)[_0x5191('0x17')](function(){return utils[_0x5191('0x1d')](_0x10b972);})[_0x5191('0x17')](function(){return _0x31afe5(null,_0x10b972);});}}else{return _0x31afe5(null,![],{'message':_0x5191('0x16')});}}else{return utils[_0x5191('0x1c')](_0x10b972,0x0,![],null)['then'](function(){return utils[_0x5191('0x1d')](_0x10b972);})[_0x5191('0x17')](function(){return _0x31afe5(null,_0x10b972);})[_0x5191('0x1e')](function(_0xd9066e){return _0x31afe5(null,![],_0xd9066e);});}}else{if(_0x10b972[_0x5191('0x19')]){return _0x31afe5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x10b972)[_0x5191('0x17')](function(){return _0x31afe5(null,_0x10b972);});}}}});})[_0x5191('0x1e')](function(_0x15985a){return _0x31afe5(null,![],_0x15985a);});}function sendServiceMail(_0x14b05c){return db[_0x5191('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x5191('0x15'),'email'],'include':[{'model':db[_0x5191('0x20')],'as':_0x5191('0x21'),'include':[{'model':db[_0x5191('0x22')],'as':_0x5191('0x22')}]}]})['then'](function(_0x5933e6){if(!_0x5933e6){throw new Error(_0x5191('0x23'));}var _0x44f57e=_0x5933e6[_0x5191('0x24')]();var _0x38e72c={'account':_0x44f57e,'message':_[_0x5191('0x25')]({'from':util[_0x5191('0x26')]('\x22%s\x22\x20<%s>',_0x5933e6[_0x5191('0x15')],_0x5933e6['email']||_0x5933e6[_0x5191('0x21')][_0x5191('0x27')])},_0x14b05c)};return client[_0x5191('0x28')](_0x5191('0x29'),_0x38e72c);})[_0x5191('0x17')](function(_0x286f15){if(_0x286f15[_0x5191('0x2a')]){throw new Error(util['format'](_0x5191('0x2b'),_0x286f15[_0x5191('0x2a')][_0x5191('0x2c')]||JSON['stringify'](_0x286f15[_0x5191('0x2a')])));}return!![];});}function handleError(_0x358817,_0x5488e8,_0x518c8d){return _0x358817[_0x5191('0x2d')](_0x5488e8||0x1f4)[_0x5191('0x2e')]({'message':_0x518c8d?_0x518c8d[_0x5191('0x2c')]||_0x518c8d:''});}exports[_0x5191('0x2f')]=function(_0x5f49a8,_0x55f8f3,_0x2a04c3){passport[_0x5191('0x18')](_0x5191('0x30'),function(_0x56c4bf,_0x13fa40,_0x28196a){var _0x4ba50f=_0x56c4bf||_0x28196a;if(_0x4ba50f){return handleError(_0x55f8f3,0x191,_0x4ba50f);}if(!_0x13fa40){return handleError(_0x55f8f3,0x194,{'message':_0x5191('0x31')});}else{var _0x2291ff={'payload':{'id':_0x13fa40['id'],'role':_0x13fa40[_0x5191('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x5191('0x32')](_0x2291ff)[_0x5191('0x17')](function(_0x2adba0){_0x55f8f3[_0x5191('0x33')]({'id':_0x13fa40['id'],'token':_0x2adba0,'statusCall':'','isAlreadyLogged':_0x13fa40['online']});});}})(_0x5f49a8,_0x55f8f3,_0x2a04c3);};exports['forgot']=function(_0x200c67,_0x243a8d){if(!_0x200c67[_0x5191('0x34')]['email']){return handleError(_0x243a8d,0x1f4,{'message':_0x5191('0x35')});}var _0x7d4ac3=rs[_0x5191('0x36')]();_0x200c67[_0x5191('0x34')][_0x5191('0x37')]=_0x200c67[_0x5191('0x34')][_0x5191('0x37')][_0x5191('0x38')]()['toLowerCase']();var _0x39d0d3;return db[_0x5191('0x9')][_0x5191('0xa')]({'where':{'id':0x1},'attributes':[_0x5191('0xb'),_0x5191('0xc')],'raw':!![]})['then'](function(_0x5e8c8b){_0x39d0d3=_0x5e8c8b;return db[_0x5191('0x39')][_0x5191('0x3a')]({'where':{'email':_0x200c67[_0x5191('0x34')][_0x5191('0x37')]}});})[_0x5191('0x17')](function(_0x13d10a){if(!_0x13d10a){throw new Error(_0x5191('0x3b'));}if(_0x13d10a[_0x5191('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x13d10a[_0x5191('0x19')]){if(moment(_0x13d10a[_0x5191('0x11')])[_0x5191('0x1a')](_0x39d0d3[_0x5191('0xc')],'minutes')>moment()){throw new Error(_0x5191('0x3c'));}else{_0x13d10a[_0x5191('0x19')]=![];_0x13d10a[_0x5191('0x11')]=null;}}_0x13d10a[_0x5191('0x3d')]=_0x7d4ac3;_0x13d10a['resetPasswordExpires']=Date[_0x5191('0x3e')]()+0x36ee80;return _0x13d10a[_0x5191('0x3f')]();})[_0x5191('0x17')](function(){return sendServiceMail({'to':_0x200c67[_0x5191('0x34')][_0x5191('0x37')],'subject':_0x5191('0x40'),'text':_0x5191('0x41')+_0x5191('0x42')+_0x5191('0x43')+_0x200c67[_0x5191('0x44')][_0x5191('0x45')]+_0x5191('0x46')+_0x7d4ac3+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x5191('0x17')](function(){_0x243a8d[_0x5191('0x2d')](0xc8)[_0x5191('0x2e')]({'message':'Reset\x20Email\x20sent!'});})[_0x5191('0x1e')](function(_0x122c38){return handleError(_0x243a8d,0x1f4,_0x122c38);});};exports['reset']=function(_0x4b3050,_0x2c8e09){return db[_0x5191('0x39')][_0x5191('0x3a')]({'where':{'resetPasswordToken':_0x4b3050[_0x5191('0x47')][_0x5191('0x48')],'resetPasswordExpires':{'$gt':Date[_0x5191('0x3e')]()}}})[_0x5191('0x17')](function(_0x500c5a){if(!_0x500c5a){throw new Error(_0x5191('0x49'));}return db[_0x5191('0x9')][_0x5191('0xa')]({'attributes':['id','securePassword',_0x5191('0x4a'),_0x5191('0x4b')]})[_0x5191('0x17')](function(_0x41459b){if(_0x41459b[_0x5191('0x4c')])authService[_0x5191('0x4d')](_0x4b3050[_0x5191('0x34')]['password']);if(!_0x41459b[_0x5191('0x4a')]||!_0x500c5a['previousPasswords'])return _0x500c5a;authService['validatePasswordHistory'](_0x4b3050[_0x5191('0x34')][_0x5191('0xd')],_0x500c5a[_0x5191('0x4e')],_0x41459b[_0x5191('0x4b')]);return _0x500c5a;})[_0x5191('0x17')](function(){_0x500c5a['password']=_0x4b3050[_0x5191('0x34')][_0x5191('0xd')];_0x500c5a[_0x5191('0x3d')]=null;_0x500c5a[_0x5191('0x4f')]=null;return _0x500c5a[_0x5191('0x3f')]();});})['then'](function(){_0x2c8e09[_0x5191('0x2d')](0xc8)[_0x5191('0x2e')]({'message':_0x5191('0x50')});})[_0x5191('0x1e')](function(_0x232ed5){return handleError(_0x2c8e09,0x1f4,_0x232ed5);});};passport['use'](_0x5191('0x30'),new LocalStrategy({'usernameField':_0x5191('0x15'),'passwordField':_0x5191('0xd')},function(_0x3e31c0,_0xd862bb,_0x3f4fe9){return localAuthenticate(db[_0x5191('0x39')],_0x3e31c0,_0xd862bb,_0x3f4fe9);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6fc7557..735df69 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 _0x70e7=['exports','express','Router','./authLocal.controller','login','/forgot','forgot','post','reset'];(function(_0x3a4e01,_0x4f6da1){var _0x1390a6=function(_0x433816){while(--_0x433816){_0x3a4e01['push'](_0x3a4e01['shift']());}};_0x1390a6(++_0x4f6da1);}(_0x70e7,0x106));var _0x770e=function(_0x175d24,_0x3c6eec){_0x175d24=_0x175d24-0x0;var _0x3137e3=_0x70e7[_0x175d24];return _0x3137e3;};'use strict';var express=require(_0x770e('0x0'));var router=express[_0x770e('0x1')]();var controller=require(_0x770e('0x2'));router['post']('/',controller[_0x770e('0x3')]);router['post'](_0x770e('0x4'),controller[_0x770e('0x5')]);router[_0x770e('0x6')]('/reset/:token',controller[_0x770e('0x7')]);module[_0x770e('0x8')]=router; \ No newline at end of file +var _0xe566=['/forgot','post','reset','exports','Router','./authLocal.controller','login'];(function(_0x46b0ce,_0x16acc7){var _0x295ece=function(_0x2d6194){while(--_0x2d6194){_0x46b0ce['push'](_0x46b0ce['shift']());}};_0x295ece(++_0x16acc7);}(_0xe566,0x82));var _0x6e56=function(_0x5a6e7b,_0x18905f){_0x5a6e7b=_0x5a6e7b-0x0;var _0x4af6ff=_0xe566[_0x5a6e7b];return _0x4af6ff;};'use strict';var express=require('express');var router=express[_0x6e56('0x0')]();var controller=require(_0x6e56('0x1'));router['post']('/',controller[_0x6e56('0x2')]);router['post'](_0x6e56('0x3'),controller['forgot']);router[_0x6e56('0x4')]('/reset/:token',controller[_0x6e56('0x5')]);module[_0x6e56('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 fbce9f3..7fdf4ba 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 _0xe1f0=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x34cc90,_0x768579){var _0x3359b9=function(_0x2fd0dd){while(--_0x2fd0dd){_0x34cc90['push'](_0x34cc90['shift']());}};_0x3359b9(++_0x768579);}(_0xe1f0,0x160));var _0x0e1f=function(_0x3735af,_0x4bbb9b){_0x3735af=_0x3735af-0x0;var _0x12cfd9=_0xe1f0[_0x3735af];return _0x12cfd9;};'use strict';var Sequelize=require(_0x0e1f('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e1f('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e1f('0x1')]},'status':{'type':Sequelize[_0x0e1f('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0e1f('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5e76=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x5e76,0x80));var _0x65e7=function(_0x48bff0,_0x5ec28d){_0x48bff0=_0x48bff0-0x0;var _0x5520c7=_0x5e76[_0x48bff0];return _0x5520c7;};'use strict';var Sequelize=require(_0x65e7('0x0'));module[_0x65e7('0x1')]={'name':{'type':Sequelize[_0x65e7('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x65e7('0x2')]},'description':{'type':Sequelize[_0x65e7('0x2')]},'status':{'type':Sequelize[_0x65e7('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x65e7('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 c06942e..3460c46 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 _0x8aed=['order','sort','where','filter','merge','options','includeAll','include','rows','params','keys','catch','create','body','find','addConditions','Condition','ids','omit','findOne','getConditions','length','nolimit','addActions','getActions','Action','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x8aed,0x1b5));var _0xd8ae=function(_0x43d97f,_0x36fec3){_0x43d97f=_0x43d97f-0x0;var _0x490481=_0x8aed[_0x43d97f];return _0x490481;};'use strict';var emlformat=require(_0xd8ae('0x0'));var rimraf=require(_0xd8ae('0x1'));var zipdir=require(_0xd8ae('0x2'));var jsonpatch=require(_0xd8ae('0x3'));var rp=require(_0xd8ae('0x4'));var moment=require(_0xd8ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd8ae('0x6'));var util=require(_0xd8ae('0x7'));var path=require(_0xd8ae('0x8'));var sox=require('sox');var csv=require(_0xd8ae('0x9'));var ejs=require(_0xd8ae('0xa'));var fs=require('fs');var fs_extra=require(_0xd8ae('0xb'));var _=require(_0xd8ae('0xc'));var squel=require(_0xd8ae('0xd'));var crypto=require(_0xd8ae('0xe'));var jsforce=require(_0xd8ae('0xf'));var deskjs=require(_0xd8ae('0x10'));var toCsv=require(_0xd8ae('0x9'));var querystring=require('querystring');var Papa=require(_0xd8ae('0x11'));var Redis=require(_0xd8ae('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd8ae('0x13'));var as=require(_0xd8ae('0x14'));var hardwareService=require(_0xd8ae('0x15'));var logger=require('../../config/logger')(_0xd8ae('0x16'));var utils=require(_0xd8ae('0x17'));var config=require(_0xd8ae('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8ae('0x19'))['db'];function respondWithStatusCode(_0x123676,_0x11ed88){_0x11ed88=_0x11ed88||0xcc;return function(_0xb85d1d){if(_0xb85d1d){return _0x123676[_0xd8ae('0x1a')](_0x11ed88);}return _0x123676['status'](_0x11ed88)[_0xd8ae('0x1b')]();};}function respondWithResult(_0x5b97fe,_0x17a12e){_0x17a12e=_0x17a12e||0xc8;return function(_0x1472a2){if(_0x1472a2){return _0x5b97fe[_0xd8ae('0x1c')](_0x17a12e)[_0xd8ae('0x1d')](_0x1472a2);}};}function respondWithFilteredResult(_0x3ca408,_0x3ef5c0){return function(_0x32a8d8){if(_0x32a8d8){var _0xdd9d21=typeof _0x3ef5c0[_0xd8ae('0x1e')]===_0xd8ae('0x1f')&&typeof _0x3ef5c0[_0xd8ae('0x20')]==='undefined';var _0x39119a=_0x32a8d8[_0xd8ae('0x21')];var _0x18a1e2=_0xdd9d21?0x0:_0x3ef5c0['offset'];var _0x5bb641=_0xdd9d21?_0x32a8d8[_0xd8ae('0x21')]:_0x3ef5c0[_0xd8ae('0x1e')]+_0x3ef5c0[_0xd8ae('0x20')];var _0x13cac8;if(_0x5bb641>=_0x39119a){_0x5bb641=_0x39119a;_0x13cac8=0xc8;}else{_0x13cac8=0xce;}_0x3ca408[_0xd8ae('0x1c')](_0x13cac8);return _0x3ca408[_0xd8ae('0x22')]('Content-Range',_0x18a1e2+'-'+_0x5bb641+'/'+_0x39119a)[_0xd8ae('0x1d')](_0x32a8d8);}return null;};}function patchUpdates(_0x3da0f6){return function(_0x2f7d95){try{jsonpatch[_0xd8ae('0x23')](_0x2f7d95,_0x3da0f6,!![]);}catch(_0xae934){return BPromise[_0xd8ae('0x24')](_0xae934);}return _0x2f7d95[_0xd8ae('0x25')]();};}function saveUpdates(_0x435b9e,_0x739129){return function(_0x340c3c){if(_0x340c3c){return _0x340c3c['update'](_0x435b9e)[_0xd8ae('0x26')](function(_0xaa5952){return _0xaa5952;});}return null;};}function removeEntity(_0x38b86c,_0x6ec86e){return function(_0x1118f8){if(_0x1118f8){return _0x1118f8[_0xd8ae('0x27')]()[_0xd8ae('0x26')](function(){_0x38b86c[_0xd8ae('0x1c')](0xcc)[_0xd8ae('0x1b')]();});}};}function handleEntityNotFound(_0x5a1fa7,_0x5461db){return function(_0x39bd63){if(!_0x39bd63){_0x5a1fa7[_0xd8ae('0x1a')](0x194);}return _0x39bd63;};}function handleError(_0x576a89,_0x38d512){_0x38d512=_0x38d512||0x1f4;return function(_0x1b00c1){logger[_0xd8ae('0x28')](_0x1b00c1[_0xd8ae('0x29')]);if(_0x1b00c1[_0xd8ae('0x2a')]){delete _0x1b00c1[_0xd8ae('0x2a')];}_0x576a89['status'](_0x38d512)['send'](_0x1b00c1);};}exports[_0xd8ae('0x2b')]=function(_0x43b409,_0x3d397e){var _0x3349ac={},_0x81250e={},_0x4632c1={'count':0x0,'rows':[]};var _0x238396=_[_0xd8ae('0x2c')](db[_0xd8ae('0x2d')][_0xd8ae('0x2e')],function(_0x9fa33b){return{'name':_0x9fa33b[_0xd8ae('0x2f')],'type':_0x9fa33b[_0xd8ae('0x30')]['key']};});_0x81250e[_0xd8ae('0x31')]=_[_0xd8ae('0x2c')](_0x238396,_0xd8ae('0x2a'));_0x81250e[_0xd8ae('0x32')]=_['keys'](_0x43b409[_0xd8ae('0x32')]);_0x81250e[_0xd8ae('0x33')]=_[_0xd8ae('0x34')](_0x81250e[_0xd8ae('0x31')],_0x81250e['query']);_0x3349ac[_0xd8ae('0x35')]=_['intersection'](_0x81250e[_0xd8ae('0x31')],qs[_0xd8ae('0x36')](_0x43b409[_0xd8ae('0x32')][_0xd8ae('0x36')]));_0x3349ac[_0xd8ae('0x35')]=_0x3349ac[_0xd8ae('0x35')]['length']?_0x3349ac[_0xd8ae('0x35')]:_0x81250e[_0xd8ae('0x31')];if(!_0x43b409['query']['hasOwnProperty']('nolimit')){_0x3349ac[_0xd8ae('0x20')]=qs[_0xd8ae('0x20')](_0x43b409[_0xd8ae('0x32')][_0xd8ae('0x20')]);_0x3349ac['offset']=qs['offset'](_0x43b409['query'][_0xd8ae('0x1e')]);}_0x3349ac[_0xd8ae('0x37')]=qs['sort'](_0x43b409['query'][_0xd8ae('0x38')]);_0x3349ac[_0xd8ae('0x39')]=qs[_0xd8ae('0x33')](_['pick'](_0x43b409[_0xd8ae('0x32')],_0x81250e['filters']),_0x238396);if(_0x43b409[_0xd8ae('0x32')][_0xd8ae('0x3a')]){_0x3349ac[_0xd8ae('0x39')]=_[_0xd8ae('0x3b')](_0x3349ac[_0xd8ae('0x39')],{'$or':_['map'](_0x238396,function(_0x32c761){if(_0x32c761['type']!=='VIRTUAL'){var _0x4aa678={};_0x4aa678[_0x32c761['name']]={'$like':'%'+_0x43b409[_0xd8ae('0x32')][_0xd8ae('0x3a')]+'%'};return _0x4aa678;}})});}_0x3349ac=_[_0xd8ae('0x3b')]({},_0x3349ac,_0x43b409[_0xd8ae('0x3c')]);var _0x385b5f={'where':_0x3349ac[_0xd8ae('0x39')]};return db[_0xd8ae('0x2d')]['count'](_0x385b5f)[_0xd8ae('0x26')](function(_0x3636af){_0x4632c1[_0xd8ae('0x21')]=_0x3636af;if(_0x43b409['query'][_0xd8ae('0x3d')]){_0x3349ac[_0xd8ae('0x3e')]=[{'all':!![]}];}return db[_0xd8ae('0x2d')]['findAll'](_0x3349ac);})[_0xd8ae('0x26')](function(_0x4ba4a8){_0x4632c1[_0xd8ae('0x3f')]=_0x4ba4a8;return _0x4632c1;})['then'](respondWithFilteredResult(_0x3d397e,_0x3349ac))['catch'](handleError(_0x3d397e,null));};exports['show']=function(_0x4d18ef,_0x5dd4c7){var _0x515adf={'raw':![],'where':{'id':_0x4d18ef[_0xd8ae('0x40')]['id']}},_0x2f0418={};_0x2f0418[_0xd8ae('0x31')]=_[_0xd8ae('0x41')](db[_0xd8ae('0x2d')][_0xd8ae('0x2e')]);_0x2f0418[_0xd8ae('0x32')]=_[_0xd8ae('0x41')](_0x4d18ef[_0xd8ae('0x32')]);_0x2f0418['filters']=_[_0xd8ae('0x34')](_0x2f0418[_0xd8ae('0x31')],_0x2f0418[_0xd8ae('0x32')]);_0x515adf[_0xd8ae('0x35')]=_[_0xd8ae('0x34')](_0x2f0418[_0xd8ae('0x31')],qs['fields'](_0x4d18ef[_0xd8ae('0x32')][_0xd8ae('0x36')]));_0x515adf['attributes']=_0x515adf[_0xd8ae('0x35')]['length']?_0x515adf['attributes']:_0x2f0418[_0xd8ae('0x31')];if(_0x4d18ef[_0xd8ae('0x32')][_0xd8ae('0x3d')]){_0x515adf[_0xd8ae('0x3e')]=[{'all':!![]}];}_0x515adf=_['merge']({},_0x515adf,_0x4d18ef[_0xd8ae('0x3c')]);return db['Automation']['find'](_0x515adf)[_0xd8ae('0x26')](handleEntityNotFound(_0x5dd4c7,null))['then'](respondWithResult(_0x5dd4c7,null))[_0xd8ae('0x42')](handleError(_0x5dd4c7,null));};exports[_0xd8ae('0x43')]=function(_0x393dd2,_0x2fae67){return db[_0xd8ae('0x2d')]['create'](_0x393dd2[_0xd8ae('0x44')],{})[_0xd8ae('0x26')](respondWithResult(_0x2fae67,0xc9))[_0xd8ae('0x42')](handleError(_0x2fae67,null));};exports['update']=function(_0x45e001,_0x29722b){if(_0x45e001['body']['id']){delete _0x45e001['body']['id'];}return db['Automation'][_0xd8ae('0x45')]({'where':{'id':_0x45e001[_0xd8ae('0x40')]['id']}})[_0xd8ae('0x26')](handleEntityNotFound(_0x29722b,null))[_0xd8ae('0x26')](saveUpdates(_0x45e001[_0xd8ae('0x44')],null))[_0xd8ae('0x26')](respondWithResult(_0x29722b,null))[_0xd8ae('0x42')](handleError(_0x29722b,null));};exports[_0xd8ae('0x27')]=function(_0x5e5254,_0x1f60c4){return db[_0xd8ae('0x2d')][_0xd8ae('0x45')]({'where':{'id':_0x5e5254[_0xd8ae('0x40')]['id']}})[_0xd8ae('0x26')](handleEntityNotFound(_0x1f60c4,null))[_0xd8ae('0x26')](removeEntity(_0x1f60c4,null))[_0xd8ae('0x42')](handleError(_0x1f60c4,null));};exports[_0xd8ae('0x46')]=function(_0x3484f3,_0x6380fe,_0x23dcd5){return db[_0xd8ae('0x47')][_0xd8ae('0x45')]({'where':{'id':_0x3484f3[_0xd8ae('0x40')]['id']}})[_0xd8ae('0x26')](handleEntityNotFound(_0x6380fe,null))['then'](function(_0x35f23c){if(_0x35f23c){return _0x35f23c[_0xd8ae('0x46')](_0x3484f3[_0xd8ae('0x44')][_0xd8ae('0x48')],_[_0xd8ae('0x49')](_0x3484f3[_0xd8ae('0x44')],[_0xd8ae('0x48'),'id'])||{});}})[_0xd8ae('0x26')](respondWithResult(_0x6380fe,null))[_0xd8ae('0x42')](handleError(_0x6380fe,null));};exports['getConditions']=function(_0x46cd78,_0x424344,_0x232562){var _0x30f57f={};var _0x46217f={};var _0x20930a;var _0x9ee4e9;return db[_0xd8ae('0x2d')][_0xd8ae('0x4a')]({'where':{'id':_0x46cd78[_0xd8ae('0x40')]['id']}})['then'](handleEntityNotFound(_0x424344,null))[_0xd8ae('0x26')](function(_0x54726){if(_0x54726){_0x20930a=_0x54726;_0x46217f[_0xd8ae('0x31')]=_['keys'](db['Condition'][_0xd8ae('0x2e')]);_0x46217f['query']=_[_0xd8ae('0x41')](_0x46cd78['query']);_0x46217f[_0xd8ae('0x33')]=_[_0xd8ae('0x34')](_0x46217f[_0xd8ae('0x31')],_0x46217f['query']);_0x30f57f[_0xd8ae('0x35')]=_['intersection'](_0x46217f['model'],qs[_0xd8ae('0x36')](_0x46cd78[_0xd8ae('0x32')][_0xd8ae('0x36')]));_0x30f57f[_0xd8ae('0x35')]=_0x30f57f['attributes']['length']?_0x30f57f[_0xd8ae('0x35')]:_0x46217f['model'];_0x30f57f[_0xd8ae('0x37')]=qs[_0xd8ae('0x38')](_0x46cd78['query']['sort']);_0x30f57f[_0xd8ae('0x39')]=qs[_0xd8ae('0x33')](_['pick'](_0x46cd78['query'],_0x46217f[_0xd8ae('0x33')]));if(_0x46cd78[_0xd8ae('0x32')][_0xd8ae('0x3a')]){_0x30f57f['where']=_[_0xd8ae('0x3b')](_0x30f57f[_0xd8ae('0x39')],{'$or':_[_0xd8ae('0x2c')](_0x30f57f[_0xd8ae('0x35')],function(_0x153d5f){var _0x1eaaf1={};_0x1eaaf1[_0x153d5f]={'$like':'%'+_0x46cd78[_0xd8ae('0x32')]['filter']+'%'};return _0x1eaaf1;})});}_0x30f57f=_['merge']({},_0x30f57f,_0x46cd78[_0xd8ae('0x3c')]);return _0x20930a[_0xd8ae('0x4b')](_0x30f57f);}})[_0xd8ae('0x26')](function(_0x131d69){if(_0x131d69){_0x9ee4e9=_0x131d69[_0xd8ae('0x4c')];if(!_0x46cd78['query']['hasOwnProperty'](_0xd8ae('0x4d'))){_0x30f57f[_0xd8ae('0x20')]=qs[_0xd8ae('0x20')](_0x46cd78[_0xd8ae('0x32')][_0xd8ae('0x20')]);_0x30f57f[_0xd8ae('0x1e')]=qs[_0xd8ae('0x1e')](_0x46cd78[_0xd8ae('0x32')][_0xd8ae('0x1e')]);}return _0x20930a[_0xd8ae('0x4b')](_0x30f57f);}})[_0xd8ae('0x26')](function(_0xda44c1){if(_0xda44c1){return _0xda44c1?{'count':_0x9ee4e9,'rows':_0xda44c1}:null;}})[_0xd8ae('0x26')](respondWithResult(_0x424344,null))['catch'](handleError(_0x424344,null));};exports['addActions']=function(_0x11b9fc,_0x16f752,_0x2e425e){return db['Action'][_0xd8ae('0x45')]({'where':{'id':_0x11b9fc[_0xd8ae('0x40')]['id']}})['then'](handleEntityNotFound(_0x16f752,null))[_0xd8ae('0x26')](function(_0x4c69cf){if(_0x4c69cf){return _0x4c69cf[_0xd8ae('0x4e')](_0x11b9fc[_0xd8ae('0x44')][_0xd8ae('0x48')],_[_0xd8ae('0x49')](_0x11b9fc[_0xd8ae('0x44')],[_0xd8ae('0x48'),'id'])||{});}})[_0xd8ae('0x26')](respondWithResult(_0x16f752,null))[_0xd8ae('0x42')](handleError(_0x16f752,null));};exports[_0xd8ae('0x4f')]=function(_0x2b5768,_0x3460ef,_0xb10a3b){var _0x28733d={};var _0x3faec7={};var _0x385646;var _0x13f2d5;return db['Automation'][_0xd8ae('0x4a')]({'where':{'id':_0x2b5768['params']['id']}})['then'](handleEntityNotFound(_0x3460ef,null))[_0xd8ae('0x26')](function(_0x3b2cb1){if(_0x3b2cb1){_0x385646=_0x3b2cb1;_0x3faec7[_0xd8ae('0x31')]=_['keys'](db[_0xd8ae('0x50')][_0xd8ae('0x2e')]);_0x3faec7[_0xd8ae('0x32')]=_[_0xd8ae('0x41')](_0x2b5768[_0xd8ae('0x32')]);_0x3faec7[_0xd8ae('0x33')]=_[_0xd8ae('0x34')](_0x3faec7[_0xd8ae('0x31')],_0x3faec7['query']);_0x28733d[_0xd8ae('0x35')]=_[_0xd8ae('0x34')](_0x3faec7[_0xd8ae('0x31')],qs[_0xd8ae('0x36')](_0x2b5768[_0xd8ae('0x32')][_0xd8ae('0x36')]));_0x28733d['attributes']=_0x28733d['attributes'][_0xd8ae('0x4c')]?_0x28733d['attributes']:_0x3faec7[_0xd8ae('0x31')];_0x28733d[_0xd8ae('0x37')]=qs[_0xd8ae('0x38')](_0x2b5768[_0xd8ae('0x32')][_0xd8ae('0x38')]);_0x28733d[_0xd8ae('0x39')]=qs['filters'](_['pick'](_0x2b5768['query'],_0x3faec7[_0xd8ae('0x33')]));if(_0x2b5768['query']['filter']){_0x28733d[_0xd8ae('0x39')]=_[_0xd8ae('0x3b')](_0x28733d[_0xd8ae('0x39')],{'$or':_[_0xd8ae('0x2c')](_0x28733d[_0xd8ae('0x35')],function(_0x4f621b){var _0x362e6d={};_0x362e6d[_0x4f621b]={'$like':'%'+_0x2b5768[_0xd8ae('0x32')][_0xd8ae('0x3a')]+'%'};return _0x362e6d;})});}_0x28733d=_[_0xd8ae('0x3b')]({},_0x28733d,_0x2b5768[_0xd8ae('0x3c')]);return _0x385646['getActions'](_0x28733d);}})[_0xd8ae('0x26')](function(_0x3e8a43){if(_0x3e8a43){_0x13f2d5=_0x3e8a43[_0xd8ae('0x4c')];if(!_0x2b5768[_0xd8ae('0x32')][_0xd8ae('0x51')](_0xd8ae('0x4d'))){_0x28733d['limit']=qs['limit'](_0x2b5768[_0xd8ae('0x32')][_0xd8ae('0x20')]);_0x28733d['offset']=qs[_0xd8ae('0x1e')](_0x2b5768[_0xd8ae('0x32')][_0xd8ae('0x1e')]);}return _0x385646[_0xd8ae('0x4f')](_0x28733d);}})[_0xd8ae('0x26')](function(_0x2bb768){if(_0x2bb768){return _0x2bb768?{'count':_0x13f2d5,'rows':_0x2bb768}:null;}})[_0xd8ae('0x26')](respondWithResult(_0x3460ef,null))[_0xd8ae('0x42')](handleError(_0x3460ef,null));}; \ No newline at end of file +var _0x868e=['eml-format','zip-dir','request-promise','bluebird','path','ejs','lodash','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','Automation','rawAttributes','fieldName','key','keys','query','intersection','fields','attributes','length','model','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','addConditions','Condition','ids','getConditions','findOne','addActions','omit','getActions','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x868e,0x128));var _0xe868=function(_0x37e597,_0x3569a8){_0x37e597=_0x37e597-0x0;var _0x14fe81=_0x868e[_0x37e597];return _0x14fe81;};'use strict';var emlformat=require(_0xe868('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe868('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe868('0x2'));var moment=require('moment');var BPromise=require(_0xe868('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe868('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe868('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe868('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe868('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xe868('0x8'));var querystring=require('querystring');var Papa=require(_0xe868('0x9'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe868('0xa'));var as=require(_0xe868('0xb'));var hardwareService=require(_0xe868('0xc'));var logger=require(_0xe868('0xd'))(_0xe868('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe868('0xf'))['db'];function respondWithStatusCode(_0x342529,_0x3e1065){_0x3e1065=_0x3e1065||0xcc;return function(_0x459404){if(_0x459404){return _0x342529[_0xe868('0x10')](_0x3e1065);}return _0x342529[_0xe868('0x11')](_0x3e1065)[_0xe868('0x12')]();};}function respondWithResult(_0x4b7181,_0x4f9f47){_0x4f9f47=_0x4f9f47||0xc8;return function(_0x1d5a18){if(_0x1d5a18){return _0x4b7181[_0xe868('0x11')](_0x4f9f47)[_0xe868('0x13')](_0x1d5a18);}};}function respondWithFilteredResult(_0xe2f0cc,_0x5a442f){return function(_0x4dad6c){if(_0x4dad6c){var _0x3c9a2f=typeof _0x5a442f[_0xe868('0x14')]==='undefined'&&typeof _0x5a442f[_0xe868('0x15')]==='undefined';var _0x5a2885=_0x4dad6c['count'];var _0x28f4c8=_0x3c9a2f?0x0:_0x5a442f[_0xe868('0x14')];var _0x3c7211=_0x3c9a2f?_0x4dad6c[_0xe868('0x16')]:_0x5a442f[_0xe868('0x14')]+_0x5a442f['limit'];var _0x3e68d4;if(_0x3c7211>=_0x5a2885){_0x3c7211=_0x5a2885;_0x3e68d4=0xc8;}else{_0x3e68d4=0xce;}_0xe2f0cc[_0xe868('0x11')](_0x3e68d4);return _0xe2f0cc[_0xe868('0x17')](_0xe868('0x18'),_0x28f4c8+'-'+_0x3c7211+'/'+_0x5a2885)['json'](_0x4dad6c);}return null;};}function patchUpdates(_0x81aad1){return function(_0x387102){try{jsonpatch[_0xe868('0x19')](_0x387102,_0x81aad1,!![]);}catch(_0x28cd53){return BPromise['reject'](_0x28cd53);}return _0x387102[_0xe868('0x1a')]();};}function saveUpdates(_0x4d77a6,_0x4fdf9d){return function(_0x372af6){if(_0x372af6){return _0x372af6[_0xe868('0x1b')](_0x4d77a6)[_0xe868('0x1c')](function(_0x4ba0ab){return _0x4ba0ab;});}return null;};}function removeEntity(_0x46bfd3,_0x20fdc8){return function(_0x5c8f34){if(_0x5c8f34){return _0x5c8f34[_0xe868('0x1d')]()['then'](function(){_0x46bfd3[_0xe868('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c1e2e,_0x458be3){return function(_0x3b25cc){if(!_0x3b25cc){_0x6c1e2e[_0xe868('0x10')](0x194);}return _0x3b25cc;};}function handleError(_0x153048,_0x18123e){_0x18123e=_0x18123e||0x1f4;return function(_0x57cd99){logger['error'](_0x57cd99['stack']);if(_0x57cd99[_0xe868('0x1e')]){delete _0x57cd99[_0xe868('0x1e')];}_0x153048['status'](_0x18123e)[_0xe868('0x1f')](_0x57cd99);};}exports[_0xe868('0x20')]=function(_0x9322d7,_0x853f53){var _0x33a4e2={},_0x57e171={},_0x5548b5={'count':0x0,'rows':[]};var _0x6df6cf=_[_0xe868('0x21')](db[_0xe868('0x22')][_0xe868('0x23')],function(_0x1074da){return{'name':_0x1074da[_0xe868('0x24')],'type':_0x1074da['type'][_0xe868('0x25')]};});_0x57e171['model']=_[_0xe868('0x21')](_0x6df6cf,_0xe868('0x1e'));_0x57e171['query']=_[_0xe868('0x26')](_0x9322d7[_0xe868('0x27')]);_0x57e171['filters']=_[_0xe868('0x28')](_0x57e171['model'],_0x57e171['query']);_0x33a4e2['attributes']=_[_0xe868('0x28')](_0x57e171['model'],qs[_0xe868('0x29')](_0x9322d7[_0xe868('0x27')][_0xe868('0x29')]));_0x33a4e2[_0xe868('0x2a')]=_0x33a4e2[_0xe868('0x2a')][_0xe868('0x2b')]?_0x33a4e2[_0xe868('0x2a')]:_0x57e171[_0xe868('0x2c')];if(!_0x9322d7['query']['hasOwnProperty'](_0xe868('0x2d'))){_0x33a4e2[_0xe868('0x15')]=qs['limit'](_0x9322d7[_0xe868('0x27')][_0xe868('0x15')]);_0x33a4e2[_0xe868('0x14')]=qs[_0xe868('0x14')](_0x9322d7['query'][_0xe868('0x14')]);}_0x33a4e2[_0xe868('0x2e')]=qs['sort'](_0x9322d7[_0xe868('0x27')][_0xe868('0x2f')]);_0x33a4e2['where']=qs[_0xe868('0x30')](_[_0xe868('0x31')](_0x9322d7['query'],_0x57e171['filters']),_0x6df6cf);if(_0x9322d7[_0xe868('0x27')][_0xe868('0x32')]){_0x33a4e2[_0xe868('0x33')]=_[_0xe868('0x34')](_0x33a4e2[_0xe868('0x33')],{'$or':_[_0xe868('0x21')](_0x6df6cf,function(_0x5595a8){if(_0x5595a8[_0xe868('0x35')]!==_0xe868('0x36')){var _0x11f11c={};_0x11f11c[_0x5595a8[_0xe868('0x1e')]]={'$like':'%'+_0x9322d7[_0xe868('0x27')][_0xe868('0x32')]+'%'};return _0x11f11c;}})});}_0x33a4e2=_[_0xe868('0x34')]({},_0x33a4e2,_0x9322d7[_0xe868('0x37')]);var _0x19e6c9={'where':_0x33a4e2[_0xe868('0x33')]};return db['Automation'][_0xe868('0x16')](_0x19e6c9)['then'](function(_0x5e1930){_0x5548b5[_0xe868('0x16')]=_0x5e1930;if(_0x9322d7['query'][_0xe868('0x38')]){_0x33a4e2[_0xe868('0x39')]=[{'all':!![]}];}return db[_0xe868('0x22')][_0xe868('0x3a')](_0x33a4e2);})['then'](function(_0x415b4b){_0x5548b5[_0xe868('0x3b')]=_0x415b4b;return _0x5548b5;})[_0xe868('0x1c')](respondWithFilteredResult(_0x853f53,_0x33a4e2))['catch'](handleError(_0x853f53,null));};exports['show']=function(_0x2f56e4,_0x3f20b6){var _0x51bc34={'raw':![],'where':{'id':_0x2f56e4[_0xe868('0x3c')]['id']}},_0x476342={};_0x476342[_0xe868('0x2c')]=_[_0xe868('0x26')](db['Automation']['rawAttributes']);_0x476342[_0xe868('0x27')]=_[_0xe868('0x26')](_0x2f56e4[_0xe868('0x27')]);_0x476342[_0xe868('0x30')]=_[_0xe868('0x28')](_0x476342[_0xe868('0x2c')],_0x476342[_0xe868('0x27')]);_0x51bc34[_0xe868('0x2a')]=_['intersection'](_0x476342['model'],qs[_0xe868('0x29')](_0x2f56e4[_0xe868('0x27')][_0xe868('0x29')]));_0x51bc34['attributes']=_0x51bc34[_0xe868('0x2a')][_0xe868('0x2b')]?_0x51bc34[_0xe868('0x2a')]:_0x476342['model'];if(_0x2f56e4['query'][_0xe868('0x38')]){_0x51bc34[_0xe868('0x39')]=[{'all':!![]}];}_0x51bc34=_[_0xe868('0x34')]({},_0x51bc34,_0x2f56e4[_0xe868('0x37')]);return db[_0xe868('0x22')][_0xe868('0x3d')](_0x51bc34)[_0xe868('0x1c')](handleEntityNotFound(_0x3f20b6,null))[_0xe868('0x1c')](respondWithResult(_0x3f20b6,null))[_0xe868('0x3e')](handleError(_0x3f20b6,null));};exports[_0xe868('0x3f')]=function(_0x477850,_0x489bf3){return db['Automation']['create'](_0x477850[_0xe868('0x40')],{})[_0xe868('0x1c')](respondWithResult(_0x489bf3,0xc9))[_0xe868('0x3e')](handleError(_0x489bf3,null));};exports[_0xe868('0x1b')]=function(_0x2545c0,_0x46abb9){if(_0x2545c0[_0xe868('0x40')]['id']){delete _0x2545c0[_0xe868('0x40')]['id'];}return db['Automation'][_0xe868('0x3d')]({'where':{'id':_0x2545c0[_0xe868('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46abb9,null))[_0xe868('0x1c')](saveUpdates(_0x2545c0[_0xe868('0x40')],null))[_0xe868('0x1c')](respondWithResult(_0x46abb9,null))[_0xe868('0x3e')](handleError(_0x46abb9,null));};exports[_0xe868('0x1d')]=function(_0x14fcae,_0x504754){return db[_0xe868('0x22')]['find']({'where':{'id':_0x14fcae[_0xe868('0x3c')]['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x504754,null))[_0xe868('0x1c')](removeEntity(_0x504754,null))[_0xe868('0x3e')](handleError(_0x504754,null));};exports[_0xe868('0x41')]=function(_0x49840a,_0xe41d6f,_0x42934d){return db[_0xe868('0x42')][_0xe868('0x3d')]({'where':{'id':_0x49840a['params']['id']}})['then'](handleEntityNotFound(_0xe41d6f,null))[_0xe868('0x1c')](function(_0x4ea561){if(_0x4ea561){return _0x4ea561[_0xe868('0x41')](_0x49840a['body'][_0xe868('0x43')],_['omit'](_0x49840a['body'],[_0xe868('0x43'),'id'])||{});}})[_0xe868('0x1c')](respondWithResult(_0xe41d6f,null))[_0xe868('0x3e')](handleError(_0xe41d6f,null));};exports[_0xe868('0x44')]=function(_0x4b7f35,_0x29743d,_0x35be34){var _0x3d7db={};var _0x241d27={};var _0x2c3bc6;var _0x1055da;return db[_0xe868('0x22')][_0xe868('0x45')]({'where':{'id':_0x4b7f35['params']['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x29743d,null))['then'](function(_0x4a71ff){if(_0x4a71ff){_0x2c3bc6=_0x4a71ff;_0x241d27[_0xe868('0x2c')]=_['keys'](db[_0xe868('0x42')]['rawAttributes']);_0x241d27[_0xe868('0x27')]=_[_0xe868('0x26')](_0x4b7f35['query']);_0x241d27[_0xe868('0x30')]=_[_0xe868('0x28')](_0x241d27['model'],_0x241d27['query']);_0x3d7db[_0xe868('0x2a')]=_['intersection'](_0x241d27['model'],qs[_0xe868('0x29')](_0x4b7f35[_0xe868('0x27')]['fields']));_0x3d7db[_0xe868('0x2a')]=_0x3d7db[_0xe868('0x2a')][_0xe868('0x2b')]?_0x3d7db[_0xe868('0x2a')]:_0x241d27[_0xe868('0x2c')];_0x3d7db[_0xe868('0x2e')]=qs[_0xe868('0x2f')](_0x4b7f35[_0xe868('0x27')][_0xe868('0x2f')]);_0x3d7db[_0xe868('0x33')]=qs['filters'](_[_0xe868('0x31')](_0x4b7f35[_0xe868('0x27')],_0x241d27[_0xe868('0x30')]));if(_0x4b7f35[_0xe868('0x27')][_0xe868('0x32')]){_0x3d7db[_0xe868('0x33')]=_['merge'](_0x3d7db[_0xe868('0x33')],{'$or':_[_0xe868('0x21')](_0x3d7db['attributes'],function(_0x5ae1e7){var _0x4dcc5e={};_0x4dcc5e[_0x5ae1e7]={'$like':'%'+_0x4b7f35[_0xe868('0x27')][_0xe868('0x32')]+'%'};return _0x4dcc5e;})});}_0x3d7db=_[_0xe868('0x34')]({},_0x3d7db,_0x4b7f35['options']);return _0x2c3bc6['getConditions'](_0x3d7db);}})[_0xe868('0x1c')](function(_0x1c275e){if(_0x1c275e){_0x1055da=_0x1c275e[_0xe868('0x2b')];if(!_0x4b7f35[_0xe868('0x27')]['hasOwnProperty'](_0xe868('0x2d'))){_0x3d7db[_0xe868('0x15')]=qs[_0xe868('0x15')](_0x4b7f35[_0xe868('0x27')][_0xe868('0x15')]);_0x3d7db[_0xe868('0x14')]=qs['offset'](_0x4b7f35[_0xe868('0x27')]['offset']);}return _0x2c3bc6['getConditions'](_0x3d7db);}})['then'](function(_0x29db43){if(_0x29db43){return _0x29db43?{'count':_0x1055da,'rows':_0x29db43}:null;}})[_0xe868('0x1c')](respondWithResult(_0x29743d,null))[_0xe868('0x3e')](handleError(_0x29743d,null));};exports[_0xe868('0x46')]=function(_0x1f9687,_0x13b609,_0x4c4316){return db['Action']['find']({'where':{'id':_0x1f9687['params']['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x13b609,null))['then'](function(_0x2d5722){if(_0x2d5722){return _0x2d5722[_0xe868('0x46')](_0x1f9687[_0xe868('0x40')][_0xe868('0x43')],_[_0xe868('0x47')](_0x1f9687['body'],[_0xe868('0x43'),'id'])||{});}})['then'](respondWithResult(_0x13b609,null))[_0xe868('0x3e')](handleError(_0x13b609,null));};exports['getActions']=function(_0x5dd4a0,_0x2cac53,_0x498ce4){var _0x1f7d47={};var _0x454e32={};var _0x14d78c;var _0x13bad5;return db['Automation'][_0xe868('0x45')]({'where':{'id':_0x5dd4a0[_0xe868('0x3c')]['id']}})[_0xe868('0x1c')](handleEntityNotFound(_0x2cac53,null))['then'](function(_0x36de2e){if(_0x36de2e){_0x14d78c=_0x36de2e;_0x454e32[_0xe868('0x2c')]=_['keys'](db['Action']['rawAttributes']);_0x454e32[_0xe868('0x27')]=_['keys'](_0x5dd4a0['query']);_0x454e32['filters']=_[_0xe868('0x28')](_0x454e32[_0xe868('0x2c')],_0x454e32[_0xe868('0x27')]);_0x1f7d47[_0xe868('0x2a')]=_['intersection'](_0x454e32[_0xe868('0x2c')],qs[_0xe868('0x29')](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x29')]));_0x1f7d47[_0xe868('0x2a')]=_0x1f7d47['attributes']['length']?_0x1f7d47[_0xe868('0x2a')]:_0x454e32[_0xe868('0x2c')];_0x1f7d47[_0xe868('0x2e')]=qs[_0xe868('0x2f')](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x2f')]);_0x1f7d47[_0xe868('0x33')]=qs['filters'](_[_0xe868('0x31')](_0x5dd4a0[_0xe868('0x27')],_0x454e32[_0xe868('0x30')]));if(_0x5dd4a0[_0xe868('0x27')][_0xe868('0x32')]){_0x1f7d47[_0xe868('0x33')]=_['merge'](_0x1f7d47[_0xe868('0x33')],{'$or':_[_0xe868('0x21')](_0x1f7d47['attributes'],function(_0x23ddee){var _0x22059a={};_0x22059a[_0x23ddee]={'$like':'%'+_0x5dd4a0['query'][_0xe868('0x32')]+'%'};return _0x22059a;})});}_0x1f7d47=_[_0xe868('0x34')]({},_0x1f7d47,_0x5dd4a0['options']);return _0x14d78c[_0xe868('0x48')](_0x1f7d47);}})[_0xe868('0x1c')](function(_0x534b82){if(_0x534b82){_0x13bad5=_0x534b82[_0xe868('0x2b')];if(!_0x5dd4a0['query'][_0xe868('0x49')]('nolimit')){_0x1f7d47[_0xe868('0x15')]=qs[_0xe868('0x15')](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x15')]);_0x1f7d47[_0xe868('0x14')]=qs['offset'](_0x5dd4a0[_0xe868('0x27')][_0xe868('0x14')]);}return _0x14d78c[_0xe868('0x48')](_0x1f7d47);}})[_0xe868('0x1c')](function(_0x1db7d6){if(_0x1db7d6){return _0x1db7d6?{'count':_0x13bad5,'rows':_0x1db7d6}:null;}})[_0xe868('0x1c')](respondWithResult(_0x2cac53,null))['catch'](handleError(_0x2cac53,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ee24666..23f7a1b 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 _0x18d6=['tools_automations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x1bc9b8,_0x379fc7){var _0x1a9a13=function(_0x3a73ea){while(--_0x3a73ea){_0x1bc9b8['push'](_0x1bc9b8['shift']());}};_0x1a9a13(++_0x379fc7);}(_0x18d6,0x15f));var _0x618d=function(_0x56566d,_0x470d71){_0x56566d=_0x56566d-0x0;var _0x15aa22=_0x18d6[_0x56566d];return _0x15aa22;};'use strict';var _=require(_0x618d('0x0'));var util=require(_0x618d('0x1'));var logger=require(_0x618d('0x2'))('api');var moment=require(_0x618d('0x3'));var BPromise=require(_0x618d('0x4'));var rp=require(_0x618d('0x5'));var fs=require('fs');var path=require(_0x618d('0x6'));var rimraf=require(_0x618d('0x7'));var config=require(_0x618d('0x8'));var attributes=require(_0x618d('0x9'));module[_0x618d('0xa')]=function(_0x16fa0e,_0x4d9897){return _0x16fa0e[_0x618d('0xb')](_0x618d('0xc'),attributes,{'tableName':_0x618d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x129e=['exports','define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x129e,0x12e));var _0xe129=function(_0x264917,_0x98e348){_0x264917=_0x264917-0x0;var _0x182b5a=_0x129e[_0x264917];return _0x182b5a;};'use strict';var _=require(_0xe129('0x0'));var util=require(_0xe129('0x1'));var logger=require(_0xe129('0x2'))(_0xe129('0x3'));var moment=require(_0xe129('0x4'));var BPromise=require(_0xe129('0x5'));var rp=require(_0xe129('0x6'));var fs=require('fs');var path=require(_0xe129('0x7'));var rimraf=require(_0xe129('0x8'));var config=require('../../config/environment');var attributes=require(_0xe129('0x9'));module[_0xe129('0xa')]=function(_0x44ad13,_0x23eea5){return _0x44ad13[_0xe129('0xb')](_0xe129('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 068fc14..cee7b29 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 _0x69d4=['error','Automation,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x69d4,0x83));var _0x469d=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x69d4[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var moment=require('moment');var BPromise=require(_0x469d('0x2'));var rs=require(_0x469d('0x3'));var fs=require('fs');var Redis=require(_0x469d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x469d('0x5'));var logger=require('../../config/logger')(_0x469d('0x6'));var config=require(_0x469d('0x7'));var jayson=require(_0x469d('0x8'));var client=jayson[_0x469d('0x9')][_0x469d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb15ca9,_0x5129a8,_0x1e9300){return new BPromise(function(_0x486595,_0x37ee05){return client[_0x469d('0xb')](_0xb15ca9,_0x1e9300)[_0x469d('0xc')](function(_0x5f05c9){logger['info']('Automation,\x20%s,\x20%s',_0x5129a8,_0x469d('0xd'));logger[_0x469d('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x5129a8,_0x469d('0xd'),JSON[_0x469d('0xf')](_0x5f05c9));if(_0x5f05c9[_0x469d('0x10')]){if(_0x5f05c9['error']['code']===0x1f4){logger['error'](_0x469d('0x11'),_0x5129a8,_0x5f05c9[_0x469d('0x10')][_0x469d('0x12')]);return _0x37ee05(_0x5f05c9[_0x469d('0x10')][_0x469d('0x12')]);}logger[_0x469d('0x10')](_0x469d('0x11'),_0x5129a8,_0x5f05c9['error'][_0x469d('0x12')]);return _0x486595(_0x5f05c9[_0x469d('0x10')][_0x469d('0x12')]);}else{logger[_0x469d('0x13')]('Automation,\x20%s,\x20%s',_0x5129a8,_0x469d('0xd'));_0x486595(_0x5f05c9[_0x469d('0x14')][_0x469d('0x12')]);}})['catch'](function(_0x16d3b5){logger[_0x469d('0x10')](_0x469d('0x11'),_0x5129a8,_0x16d3b5);_0x37ee05(_0x16d3b5);});});} \ No newline at end of file +var _0x5204=['rpc','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5204,0xdf));var _0x4520=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x5204[_0x13f980];return _0x27153c;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index fb453b4..71edccf 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 _0x58ef=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','post','addConditions','/:id/actions','addActions','delete'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x58ef,0x1ce));var _0xf58e=function(_0x27a08e,_0x1d9a5b){_0x27a08e=_0x27a08e-0x0;var _0x20d509=_0x58ef[_0x27a08e];return _0x20d509;};'use strict';var multer=require(_0xf58e('0x0'));var util=require('util');var path=require(_0xf58e('0x1'));var timeout=require(_0xf58e('0x2'));var express=require(_0xf58e('0x3'));var router=express[_0xf58e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf58e('0x5'));var interaction=require(_0xf58e('0x6'));var config=require(_0xf58e('0x7'));var controller=require(_0xf58e('0x8'));router[_0xf58e('0x9')]('/',auth[_0xf58e('0xa')](),controller[_0xf58e('0xb')]);router[_0xf58e('0x9')](_0xf58e('0xc'),auth['isAuthenticated'](),controller[_0xf58e('0xd')]);router['get'](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0xf')]);router[_0xf58e('0x9')]('/:id/actions',auth[_0xf58e('0xa')](),controller['getActions']);router[_0xf58e('0x10')]('/',auth[_0xf58e('0xa')](),controller['create']);router[_0xf58e('0x10')](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x11')]);router[_0xf58e('0x10')](_0xf58e('0x12'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x13')]);router['put'](_0xf58e('0xc'),auth[_0xf58e('0xa')](),controller['update']);router[_0xf58e('0x14')](_0xf58e('0xc'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x15')]);module[_0xf58e('0x16')]=router; \ No newline at end of file +var _0x8bc3=['create','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post'];(function(_0x119da2,_0x1651ee){var _0x5724ec=function(_0x388b79){while(--_0x388b79){_0x119da2['push'](_0x119da2['shift']());}};_0x5724ec(++_0x1651ee);}(_0x8bc3,0x82));var _0x38bc=function(_0x38d4ac,_0x19cf87){_0x38d4ac=_0x38d4ac-0x0;var _0x3497fb=_0x8bc3[_0x38d4ac];return _0x3497fb;};'use strict';var multer=require(_0x38bc('0x0'));var util=require('util');var path=require(_0x38bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x38bc('0x2'));var router=express[_0x38bc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x38bc('0x4'));var interaction=require(_0x38bc('0x5'));var config=require(_0x38bc('0x6'));var controller=require(_0x38bc('0x7'));router['get']('/',auth[_0x38bc('0x8')](),controller[_0x38bc('0x9')]);router[_0x38bc('0xa')](_0x38bc('0xb'),auth[_0x38bc('0x8')](),controller['show']);router['get'](_0x38bc('0xc'),auth[_0x38bc('0x8')](),controller[_0x38bc('0xd')]);router[_0x38bc('0xa')](_0x38bc('0xe'),auth[_0x38bc('0x8')](),controller[_0x38bc('0xf')]);router[_0x38bc('0x10')]('/',auth[_0x38bc('0x8')](),controller[_0x38bc('0x11')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x38bc('0x10')]('/:id/actions',auth['isAuthenticated'](),controller['addActions']);router['put'](_0x38bc('0xb'),auth[_0x38bc('0x8')](),controller[_0x38bc('0x12')]);router['delete'](_0x38bc('0xb'),auth[_0x38bc('0x8')](),controller[_0x38bc('0x13')]);module[_0x38bc('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 55f1a77..af38eca 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 _0x8156=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x8156,0xad));var _0x6815=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8156[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x6815('0x0')]={'name':{'type':Sequelize[_0x6815('0x1')],'unique':_0x6815('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6815('0x3')](_0x6815('0x4')),'allowNull':![],'defaultValue':_0x6815('0x4')},'description':{'type':Sequelize[_0x6815('0x1')]},'active':{'type':Sequelize[_0x6815('0x5')],'defaultValue':0x0,'comment':_0x6815('0x6')},'limitCalls':{'type':Sequelize[_0x6815('0x7')](0x4)[_0x6815('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6815('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6815('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6815('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x6815('0x7')](0x3)[_0x6815('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6815('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6815('0x7')](0x5)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6815('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x6815('0x7')](0x3)[_0x6815('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6815('0x7')](0x5)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6815('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6815('0x8')],'defaultValue':0x3,'comment':_0x6815('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6815('0x7')](0x5)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6815('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6815('0x7')](0x3)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6815('0x11')},'dialTimezone':{'type':Sequelize[_0x6815('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6815('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x6815('0x3')](_0x6815('0x12'),_0x6815('0x13'),_0x6815('0x14')),'defaultValue':_0x6815('0x12')},'dialAMDActive':{'type':Sequelize[_0x6815('0x5')],'defaultValue':0x0,'comment':_0x6815('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x6815('0x7')](0x9)[_0x6815('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6815('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x6815('0x7')](0x9)[_0x6815('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6815('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6815('0x7')](0x9)[_0x6815('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6815('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6815('0x7')](0x9)[_0x6815('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6815('0x19')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6815('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6815('0x7')](0x9)[_0x6815('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6815('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x6815('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6815('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6815('0x7')](0x5)[_0x6815('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6815('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6815('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6815('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6815('0x1e'),_0x6815('0x1f')),'defaultValue':_0x6815('0x1e')},'dialPrefix':{'type':Sequelize[_0x6815('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x6815('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6815('0x20')},'dialCutDigit':{'type':Sequelize[_0x6815('0x7')](0x3)[_0x6815('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6815('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6815('0x7')](0x3)[_0x6815('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6815('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6815('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x6815('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0x6815('0x7')](0x5)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6815('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0x26')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6815('0x7')](0x5)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6815('0x27')},'dialMachineMaxRetry':{'type':Sequelize[_0x6815('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0x28')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6815('0x7')](0x3)[_0x6815('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6815('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6815('0x7')](0x5)[_0x6815('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6815('0x2a')}}; \ No newline at end of file +var _0x6ce5=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\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)','sequelize','exports','STRING','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3bb06c,_0x2e3a24){var _0x4e1722=function(_0x502ab7){while(--_0x502ab7){_0x3bb06c['push'](_0x3bb06c['shift']());}};_0x4e1722(++_0x2e3a24);}(_0x6ce5,0x1b9));var _0x56ce=function(_0x2d1f90,_0x522ec3){_0x2d1f90=_0x2d1f90-0x0;var _0x3927f5=_0x6ce5[_0x2d1f90];return _0x3927f5;};'use strict';var Sequelize=require(_0x56ce('0x0'));module[_0x56ce('0x1')]={'name':{'type':Sequelize[_0x56ce('0x2')],'unique':_0x56ce('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x56ce('0x4')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x56ce('0x2')]},'active':{'type':Sequelize[_0x56ce('0x5')],'defaultValue':0x0,'comment':_0x56ce('0x6')},'limitCalls':{'type':Sequelize[_0x56ce('0x7')](0x4)[_0x56ce('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x56ce('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x56ce('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x56ce('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x56ce('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x56ce('0xe')},'dialTimezone':{'type':Sequelize[_0x56ce('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x56ce('0x2')],'defaultValue':_0x56ce('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x56ce('0x4')](_0x56ce('0x10'),_0x56ce('0x11'),_0x56ce('0x12')),'defaultValue':_0x56ce('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x56ce('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x56ce('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x56ce('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x56ce('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x56ce('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x56ce('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x56ce('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x56ce('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x56ce('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x56ce('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x56ce('0x7')](0x9)[_0x56ce('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x56ce('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x56ce('0x4')]('DESC',_0x56ce('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x56ce('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x56ce('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x56ce('0x7')](0x3)[_0x56ce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x56ce('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x56ce('0x7')](0x5)[_0x56ce('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x56ce('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f554520..ae711e3 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 _0x9563=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','Campaign','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','destroy','hasOwnProperty','CampaignId','CmHopper','include','getHopperHistories','CmHopperHistory','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','into','fromQuery','phone','scheduledAt','ContactId','select','field','CmListId','toString','ListId','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_contacts','all','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x968411,_0x151619){var _0x46e3e5=function(_0x3c621e){while(--_0x3c621e){_0x968411['push'](_0x968411['shift']());}};_0x46e3e5(++_0x151619);}(_0x9563,0x71));var _0x3956=function(_0x395909,_0x1f851c){_0x395909=_0x395909-0x0;var _0x1800dc=_0x9563[_0x395909];return _0x1800dc;};'use strict';var emlformat=require(_0x3956('0x0'));var rimraf=require(_0x3956('0x1'));var zipdir=require(_0x3956('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3956('0x3'));var moment=require('moment');var BPromise=require(_0x3956('0x4'));var Mustache=require(_0x3956('0x5'));var util=require('util');var path=require(_0x3956('0x6'));var sox=require(_0x3956('0x7'));var csv=require(_0x3956('0x8'));var ejs=require(_0x3956('0x9'));var fs=require('fs');var fs_extra=require(_0x3956('0xa'));var _=require(_0x3956('0xb'));var squel=require(_0x3956('0xc'));var crypto=require('crypto');var jsforce=require(_0x3956('0xd'));var deskjs=require(_0x3956('0xe'));var toCsv=require(_0x3956('0x8'));var querystring=require(_0x3956('0xf'));var Papa=require(_0x3956('0x10'));var Redis=require(_0x3956('0x11'));var authService=require(_0x3956('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3956('0x13'));var logger=require(_0x3956('0x14'))(_0x3956('0x15'));var utils=require(_0x3956('0x16'));var config=require(_0x3956('0x17'));var licenseUtil=require(_0x3956('0x18'));var db=require(_0x3956('0x19'))['db'];function respondWithStatusCode(_0x19c41c,_0xa4481f){_0xa4481f=_0xa4481f||0xcc;return function(_0x2c5408){if(_0x2c5408){return _0x19c41c[_0x3956('0x1a')](_0xa4481f);}return _0x19c41c['status'](_0xa4481f)['end']();};}function respondWithResult(_0x3ed725,_0x1c3fcd){_0x1c3fcd=_0x1c3fcd||0xc8;return function(_0x3d1a7f){if(_0x3d1a7f){return _0x3ed725[_0x3956('0x1b')](_0x1c3fcd)['json'](_0x3d1a7f);}};}function respondWithFilteredResult(_0x52b4ab,_0x12c8eb){return function(_0x790260){if(_0x790260){var _0x25dbe3=typeof _0x12c8eb['offset']===_0x3956('0x1c')&&typeof _0x12c8eb[_0x3956('0x1d')]===_0x3956('0x1c');var _0x2980e1=_0x790260[_0x3956('0x1e')];var _0x5ed3ed=_0x25dbe3?0x0:_0x12c8eb[_0x3956('0x1f')];var _0x17555a=_0x25dbe3?_0x790260[_0x3956('0x1e')]:_0x12c8eb[_0x3956('0x1f')]+_0x12c8eb['limit'];var _0x3cd4be;if(_0x17555a>=_0x2980e1){_0x17555a=_0x2980e1;_0x3cd4be=0xc8;}else{_0x3cd4be=0xce;}_0x52b4ab[_0x3956('0x1b')](_0x3cd4be);return _0x52b4ab[_0x3956('0x20')](_0x3956('0x21'),_0x5ed3ed+'-'+_0x17555a+'/'+_0x2980e1)[_0x3956('0x22')](_0x790260);}return null;};}function patchUpdates(_0x4fbef2){return function(_0x4ba6ef){try{jsonpatch[_0x3956('0x23')](_0x4ba6ef,_0x4fbef2,!![]);}catch(_0x1c1ac8){return BPromise['reject'](_0x1c1ac8);}return _0x4ba6ef[_0x3956('0x24')]();};}function saveUpdates(_0x16f7cc,_0xb23a42){return function(_0x3e9420){if(_0x3e9420){return _0x3e9420[_0x3956('0x25')](_0x16f7cc)[_0x3956('0x26')](function(_0x3fe564){return _0x3fe564;});}return null;};}function removeEntity(_0x148a4a,_0x23d1a9){return function(_0x11d6cd){if(_0x11d6cd){return _0x11d6cd['destroy']()[_0x3956('0x26')](function(){var _0x3e2652=_0x11d6cd[_0x3956('0x27')]({'plain':!![]});var _0x4f1252=_0x3956('0x28');return db[_0x3956('0x29')]['destroy']({'where':{'type':_0x4f1252,'resourceId':_0x3e2652['id']}})['then'](function(){return _0x11d6cd;});})[_0x3956('0x26')](function(){_0x148a4a[_0x3956('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158860,_0x6ad435){return function(_0x4982b1){if(!_0x4982b1){_0x158860[_0x3956('0x1a')](0x194);}return _0x4982b1;};}function handleError(_0x3d9e74,_0x322d3c){_0x322d3c=_0x322d3c||0x1f4;return function(_0x9cfe30){logger[_0x3956('0x2a')](_0x9cfe30[_0x3956('0x2b')]);if(_0x9cfe30[_0x3956('0x2c')]){delete _0x9cfe30[_0x3956('0x2c')];}_0x3d9e74[_0x3956('0x1b')](_0x322d3c)[_0x3956('0x2d')](_0x9cfe30);};}exports[_0x3956('0x2e')]=function(_0x41b4c3,_0x3ad496){var _0x4f7dcf={},_0x1c6170={},_0x49d91a={'count':0x0,'rows':[]};var _0x401759=_[_0x3956('0x2f')](db['Campaign'][_0x3956('0x30')],function(_0xb174ae){return{'name':_0xb174ae[_0x3956('0x31')],'type':_0xb174ae[_0x3956('0x32')][_0x3956('0x33')]};});_0x1c6170[_0x3956('0x34')]=_['map'](_0x401759,_0x3956('0x2c'));_0x1c6170[_0x3956('0x35')]=_[_0x3956('0x36')](_0x41b4c3[_0x3956('0x35')]);_0x1c6170[_0x3956('0x37')]=_[_0x3956('0x38')](_0x1c6170[_0x3956('0x34')],_0x1c6170[_0x3956('0x35')]);_0x4f7dcf[_0x3956('0x39')]=_[_0x3956('0x38')](_0x1c6170[_0x3956('0x34')],qs[_0x3956('0x3a')](_0x41b4c3[_0x3956('0x35')][_0x3956('0x3a')]));_0x4f7dcf['attributes']=_0x4f7dcf[_0x3956('0x39')][_0x3956('0x3b')]?_0x4f7dcf[_0x3956('0x39')]:_0x1c6170[_0x3956('0x34')];if(!_0x41b4c3[_0x3956('0x35')]['hasOwnProperty'](_0x3956('0x3c'))){_0x4f7dcf[_0x3956('0x1d')]=qs[_0x3956('0x1d')](_0x41b4c3[_0x3956('0x35')][_0x3956('0x1d')]);_0x4f7dcf[_0x3956('0x1f')]=qs[_0x3956('0x1f')](_0x41b4c3[_0x3956('0x35')]['offset']);}_0x4f7dcf[_0x3956('0x3d')]=qs['sort'](_0x41b4c3[_0x3956('0x35')][_0x3956('0x3e')]);_0x4f7dcf['where']=qs['filters'](_['pick'](_0x41b4c3['query'],_0x1c6170['filters']),_0x401759);if(_0x41b4c3[_0x3956('0x35')][_0x3956('0x3f')]){_0x4f7dcf[_0x3956('0x40')]=_[_0x3956('0x41')](_0x4f7dcf[_0x3956('0x40')],{'$or':_[_0x3956('0x2f')](_0x401759,function(_0xcea750){if(_0xcea750[_0x3956('0x32')]!==_0x3956('0x42')){var _0x4ba484={};_0x4ba484[_0xcea750['name']]={'$like':'%'+_0x41b4c3[_0x3956('0x35')]['filter']+'%'};return _0x4ba484;}})});}_0x4f7dcf=_[_0x3956('0x41')]({},_0x4f7dcf,_0x41b4c3[_0x3956('0x43')]);var _0xf064c2={'where':_0x4f7dcf[_0x3956('0x40')]};return db['Campaign']['count'](_0xf064c2)[_0x3956('0x26')](function(_0x334073){_0x49d91a['count']=_0x334073;if(_0x41b4c3[_0x3956('0x35')][_0x3956('0x44')]){_0x4f7dcf['include']=[{'all':!![]}];}return db[_0x3956('0x45')][_0x3956('0x46')](_0x4f7dcf);})[_0x3956('0x26')](function(_0x2515b8){_0x49d91a[_0x3956('0x47')]=_0x2515b8;return _0x49d91a;})[_0x3956('0x26')](respondWithFilteredResult(_0x3ad496,_0x4f7dcf))[_0x3956('0x48')](handleError(_0x3ad496,null));};exports[_0x3956('0x49')]=function(_0x189210,_0x5744b1){var _0x4b8f54={'raw':![],'where':{'id':_0x189210[_0x3956('0x4a')]['id']}},_0x50e5d1={};_0x50e5d1[_0x3956('0x34')]=_[_0x3956('0x36')](db[_0x3956('0x45')]['rawAttributes']);_0x50e5d1['query']=_['keys'](_0x189210[_0x3956('0x35')]);_0x50e5d1[_0x3956('0x37')]=_['intersection'](_0x50e5d1['model'],_0x50e5d1[_0x3956('0x35')]);_0x4b8f54['attributes']=_[_0x3956('0x38')](_0x50e5d1['model'],qs['fields'](_0x189210[_0x3956('0x35')][_0x3956('0x3a')]));_0x4b8f54[_0x3956('0x39')]=_0x4b8f54[_0x3956('0x39')][_0x3956('0x3b')]?_0x4b8f54[_0x3956('0x39')]:_0x50e5d1[_0x3956('0x34')];if(_0x189210[_0x3956('0x35')]['includeAll']){_0x4b8f54['include']=[{'all':!![]}];}_0x4b8f54=_[_0x3956('0x41')]({},_0x4b8f54,_0x189210[_0x3956('0x43')]);return db['Campaign']['find'](_0x4b8f54)['then'](handleEntityNotFound(_0x5744b1,null))['then'](respondWithResult(_0x5744b1,null))['catch'](handleError(_0x5744b1,null));};exports[_0x3956('0x4b')]=function(_0x31cdb2,_0xf4e03a){return db[_0x3956('0x45')][_0x3956('0x4b')](_0x31cdb2[_0x3956('0x4c')],{})[_0x3956('0x26')](function(_0x408555){var _0x4dfa09=_0x31cdb2[_0x3956('0x4d')][_0x3956('0x27')]({'plain':!![]});if(!_0x4dfa09)throw new Error(_0x3956('0x4e'));if(_0x4dfa09[_0x3956('0x4f')]===_0x3956('0x4d')){var _0x5b3b8c=_0x408555[_0x3956('0x27')]({'plain':!![]});var _0x1150ef=_0x3956('0x28');return db[_0x3956('0x50')][_0x3956('0x51')]({'where':{'name':_0x1150ef,'userProfileId':_0x4dfa09[_0x3956('0x52')]},'raw':!![]})[_0x3956('0x26')](function(_0xa7c423){if(_0xa7c423&&_0xa7c423[_0x3956('0x53')]===0x0){return db[_0x3956('0x29')][_0x3956('0x4b')]({'name':_0x5b3b8c[_0x3956('0x2c')],'resourceId':_0x5b3b8c['id'],'type':_0xa7c423[_0x3956('0x2c')],'sectionId':_0xa7c423['id']},{})[_0x3956('0x26')](function(){return _0x408555;});}else{return _0x408555;}})['catch'](function(_0x57bb5a){logger[_0x3956('0x2a')](_0x3956('0x54'),_0x57bb5a);throw _0x57bb5a;});}return _0x408555;})['then'](respondWithResult(_0xf4e03a,0xc9))[_0x3956('0x48')](handleError(_0xf4e03a,null));};exports[_0x3956('0x55')]=function(_0x4c0fff,_0x2aaa4f){var _0x436ed2={'where':{'id':_0x4c0fff[_0x3956('0x4a')]['id']}},_0x3a38c7={};_0x3a38c7[_0x3956('0x34')]=_[_0x3956('0x36')](db[_0x3956('0x45')][_0x3956('0x30')]);_0x436ed2['attributes']=_['intersection'](_0x3a38c7[_0x3956('0x34')],qs[_0x3956('0x3a')](_0x4c0fff[_0x3956('0x35')]['fields']));_0x436ed2[_0x3956('0x39')]=_0x436ed2[_0x3956('0x39')]['length']?_0x436ed2['attributes']:_0x3a38c7[_0x3956('0x34')];if(_0x4c0fff['query']['includeAll']){_0x436ed2['include']=[{'all':!![]}];}_0x436ed2=_[_0x3956('0x41')]({},_0x436ed2,_0x4c0fff[_0x3956('0x43')]);return db['Campaign']['find'](_0x436ed2)['then'](handleEntityNotFound(_0x2aaa4f,null))[_0x3956('0x26')](function(_0x4cafd0){if(_0x4cafd0){var _0xc6b1a5=_0x4cafd0['get']({'plain':!![]});_0xc6b1a5=qs[_0x3956('0x56')](_0xc6b1a5,['id',_0x3956('0x57'),_0x3956('0x58')]);_0x4c0fff[_0x3956('0x4c')]=_['omit'](_0x4c0fff[_0x3956('0x4c')],['id',_0x3956('0x57'),_0x3956('0x58')]);return db[_0x3956('0x45')][_0x3956('0x4b')](_['merge'](_0xc6b1a5,_0x4c0fff[_0x3956('0x4c')]),{'include':_0x4c0fff[_0x3956('0x35')][_0x3956('0x44')]?[{'all':!![]}]:undefined})[_0x3956('0x26')](function(_0x57357a){var _0x29b95d=_0x4c0fff[_0x3956('0x4d')][_0x3956('0x27')]({'plain':!![]});if(!_0x29b95d)throw new Error(_0x3956('0x4e'));if(_0x29b95d[_0x3956('0x4f')]==='user'){var _0x378811=_0x57357a[_0x3956('0x27')]({'plain':!![]});var _0x550e1e=_0x3956('0x28');return db[_0x3956('0x50')]['find']({'where':{'name':_0x550e1e,'userProfileId':_0x29b95d['userProfileId']},'raw':!![]})[_0x3956('0x26')](function(_0x117fc9){if(_0x117fc9&&_0x117fc9[_0x3956('0x53')]===0x0){return db[_0x3956('0x29')]['create']({'name':_0x378811['name'],'resourceId':_0x378811['id'],'type':_0x117fc9['name'],'sectionId':_0x117fc9['id']},{})['then'](function(){return _0x57357a;});}else{return _0x57357a;}})[_0x3956('0x48')](function(_0x572554){logger[_0x3956('0x2a')](_0x3956('0x54'),_0x572554);throw _0x572554;});}return _0x57357a;});}})[_0x3956('0x26')](respondWithResult(_0x2aaa4f,0xc9))['catch'](handleError(_0x2aaa4f,null));};exports['update']=function(_0x5ba9a0,_0x310171){if(_0x5ba9a0['body']['id']){delete _0x5ba9a0[_0x3956('0x4c')]['id'];}return db[_0x3956('0x45')]['find']({'where':{'id':_0x5ba9a0[_0x3956('0x4a')]['id']}})[_0x3956('0x26')](handleEntityNotFound(_0x310171,null))[_0x3956('0x26')](saveUpdates(_0x5ba9a0[_0x3956('0x4c')],null))[_0x3956('0x26')](respondWithResult(_0x310171,null))[_0x3956('0x48')](handleError(_0x310171,null));};exports[_0x3956('0x59')]=function(_0x318474,_0x4085bc){return db[_0x3956('0x45')][_0x3956('0x51')]({'where':{'id':_0x318474['params']['id']}})['then'](handleEntityNotFound(_0x4085bc,null))[_0x3956('0x26')](removeEntity(_0x4085bc,null))[_0x3956('0x48')](handleError(_0x4085bc,null));};exports['getHoppers']=function(_0x147b17,_0x4df02e,_0x4936e4){var _0x3ab49a={'raw':!![],'where':{}};var _0xc48f52={};var _0x11d577={'count':0x0,'rows':[]};return db[_0x3956('0x45')]['findOne']({'where':{'id':_0x147b17['params']['id']}})['then'](handleEntityNotFound(_0x4df02e,null))[_0x3956('0x26')](function(_0x13e0bf){if(_0x13e0bf){_0xc48f52[_0x3956('0x34')]=_['keys'](db['CmHopper'][_0x3956('0x30')]);_0xc48f52[_0x3956('0x35')]=_[_0x3956('0x36')](_0x147b17[_0x3956('0x35')]);_0xc48f52[_0x3956('0x37')]=_[_0x3956('0x38')](_0xc48f52[_0x3956('0x34')],_0xc48f52[_0x3956('0x35')]);_0x3ab49a['attributes']=_[_0x3956('0x38')](_0xc48f52[_0x3956('0x34')],qs[_0x3956('0x3a')](_0x147b17['query']['fields']));_0x3ab49a[_0x3956('0x39')]=_0x3ab49a[_0x3956('0x39')][_0x3956('0x3b')]?_0x3ab49a[_0x3956('0x39')]:_0xc48f52['model'];if(!_0x147b17[_0x3956('0x35')][_0x3956('0x5a')](_0x3956('0x3c'))){_0x3ab49a[_0x3956('0x1d')]=qs[_0x3956('0x1d')](_0x147b17['query']['limit']);_0x3ab49a[_0x3956('0x1f')]=qs[_0x3956('0x1f')](_0x147b17[_0x3956('0x35')][_0x3956('0x1f')]);}_0x3ab49a[_0x3956('0x3d')]=qs['sort'](_0x147b17[_0x3956('0x35')][_0x3956('0x3e')]);_0x3ab49a[_0x3956('0x40')]=qs['filters'](_['pick'](_0x147b17[_0x3956('0x35')],_0xc48f52[_0x3956('0x37')]));_0x3ab49a[_0x3956('0x40')][_0x3956('0x5b')]=_0x13e0bf['id'];if(_0x147b17[_0x3956('0x35')][_0x3956('0x3f')]){_0x3ab49a['where']=_[_0x3956('0x41')](_0x3ab49a[_0x3956('0x40')],{'$or':_[_0x3956('0x2f')](_0x3ab49a[_0x3956('0x39')],function(_0x1a56d0){var _0x3180dd={};_0x3180dd[_0x1a56d0]={'$like':'%'+_0x147b17[_0x3956('0x35')][_0x3956('0x3f')]+'%'};return _0x3180dd;})});}_0x3ab49a=_[_0x3956('0x41')]({},_0x3ab49a,_0x147b17[_0x3956('0x43')]);return db[_0x3956('0x5c')][_0x3956('0x1e')]({'where':_0x3ab49a[_0x3956('0x40')]})[_0x3956('0x26')](function(_0x2a6b78){_0x11d577['count']=_0x2a6b78;if(_0x147b17['query'][_0x3956('0x44')]){_0x3ab49a[_0x3956('0x5d')]=[{'all':!![]}];}return db[_0x3956('0x5c')][_0x3956('0x46')](_0x3ab49a);})[_0x3956('0x26')](function(_0x14f882){_0x11d577['rows']=_0x14f882;return _0x11d577;});}})['then'](respondWithFilteredResult(_0x4df02e,_0x3ab49a))[_0x3956('0x48')](handleError(_0x4df02e,null));};exports[_0x3956('0x5e')]=function(_0x1da173,_0x7df870,_0x1ff306){var _0x45c007={'raw':!![],'where':{}};var _0x1e8cec={};var _0x3b34c6={'count':0x0,'rows':[]};return db[_0x3956('0x45')]['findOne']({'where':{'id':_0x1da173['params']['id']}})['then'](handleEntityNotFound(_0x7df870,null))[_0x3956('0x26')](function(_0x57cb8e){if(_0x57cb8e){_0x1e8cec[_0x3956('0x34')]=_[_0x3956('0x36')](db[_0x3956('0x5f')]['rawAttributes']);_0x1e8cec[_0x3956('0x35')]=_[_0x3956('0x36')](_0x1da173['query']);_0x1e8cec[_0x3956('0x37')]=_[_0x3956('0x38')](_0x1e8cec[_0x3956('0x34')],_0x1e8cec[_0x3956('0x35')]);_0x45c007[_0x3956('0x39')]=_[_0x3956('0x38')](_0x1e8cec['model'],qs[_0x3956('0x3a')](_0x1da173[_0x3956('0x35')][_0x3956('0x3a')]));_0x45c007[_0x3956('0x39')]=_0x45c007[_0x3956('0x39')][_0x3956('0x3b')]?_0x45c007[_0x3956('0x39')]:_0x1e8cec[_0x3956('0x34')];if(!_0x1da173[_0x3956('0x35')][_0x3956('0x5a')]('nolimit')){_0x45c007[_0x3956('0x1d')]=qs[_0x3956('0x1d')](_0x1da173[_0x3956('0x35')][_0x3956('0x1d')]);_0x45c007[_0x3956('0x1f')]=qs[_0x3956('0x1f')](_0x1da173['query'][_0x3956('0x1f')]);}_0x45c007[_0x3956('0x3d')]=qs[_0x3956('0x3e')](_0x1da173[_0x3956('0x35')][_0x3956('0x3e')]);_0x45c007[_0x3956('0x40')]=qs['filters'](_[_0x3956('0x60')](_0x1da173[_0x3956('0x35')],_0x1e8cec[_0x3956('0x37')]));_0x45c007[_0x3956('0x40')][_0x3956('0x5b')]=_0x57cb8e['id'];if(_0x1da173[_0x3956('0x35')][_0x3956('0x3f')]){_0x45c007[_0x3956('0x40')]=_[_0x3956('0x41')](_0x45c007[_0x3956('0x40')],{'$or':_[_0x3956('0x2f')](_0x45c007['attributes'],function(_0x56fd4e){var _0x254a93={};_0x254a93[_0x56fd4e]={'$like':'%'+_0x1da173[_0x3956('0x35')][_0x3956('0x3f')]+'%'};return _0x254a93;})});}_0x45c007=_[_0x3956('0x41')]({},_0x45c007,_0x1da173[_0x3956('0x43')]);return db['CmHopperHistory']['count']({'where':_0x45c007[_0x3956('0x40')]})[_0x3956('0x26')](function(_0x4f994b){_0x3b34c6[_0x3956('0x1e')]=_0x4f994b;if(_0x1da173[_0x3956('0x35')][_0x3956('0x44')]){_0x45c007['include']=[{'all':!![]}];}return db[_0x3956('0x5f')][_0x3956('0x46')](_0x45c007);})['then'](function(_0xf3614b){_0x3b34c6[_0x3956('0x47')]=_0xf3614b;return _0x3b34c6;});}})[_0x3956('0x26')](respondWithFilteredResult(_0x7df870,_0x45c007))[_0x3956('0x48')](handleError(_0x7df870,null));};exports[_0x3956('0x61')]=function(_0x512979,_0x5036a1,_0x9886bc){var _0x5e143d={'raw':!![],'where':{}};var _0x10bad5={};var _0x3779de={'count':0x0,'rows':[]};return db[_0x3956('0x45')][_0x3956('0x62')]({'where':{'id':_0x512979[_0x3956('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5036a1,null))[_0x3956('0x26')](function(_0x1404be){if(_0x1404be){_0x10bad5['model']=_[_0x3956('0x36')](db[_0x3956('0x63')]['rawAttributes']);_0x10bad5['query']=_[_0x3956('0x36')](_0x512979['query']);_0x10bad5[_0x3956('0x37')]=_[_0x3956('0x38')](_0x10bad5[_0x3956('0x34')],_0x10bad5[_0x3956('0x35')]);_0x5e143d['attributes']=_[_0x3956('0x38')](_0x10bad5[_0x3956('0x34')],qs[_0x3956('0x3a')](_0x512979[_0x3956('0x35')][_0x3956('0x3a')]));_0x5e143d[_0x3956('0x39')]=_0x5e143d[_0x3956('0x39')][_0x3956('0x3b')]?_0x5e143d['attributes']:_0x10bad5[_0x3956('0x34')];if(!_0x512979[_0x3956('0x35')][_0x3956('0x5a')](_0x3956('0x3c'))){_0x5e143d[_0x3956('0x1d')]=qs[_0x3956('0x1d')](_0x512979[_0x3956('0x35')][_0x3956('0x1d')]);_0x5e143d[_0x3956('0x1f')]=qs[_0x3956('0x1f')](_0x512979[_0x3956('0x35')][_0x3956('0x1f')]);}_0x5e143d[_0x3956('0x3d')]=qs[_0x3956('0x3e')](_0x512979[_0x3956('0x35')]['sort']);_0x5e143d[_0x3956('0x40')]=qs[_0x3956('0x37')](_['pick'](_0x512979[_0x3956('0x35')],_0x10bad5[_0x3956('0x37')]));_0x5e143d[_0x3956('0x40')][_0x3956('0x5b')]=_0x1404be['id'];if(_0x512979[_0x3956('0x35')]['filter']){_0x5e143d['where']=_[_0x3956('0x41')](_0x5e143d[_0x3956('0x40')],{'$or':_['map'](_0x5e143d[_0x3956('0x39')],function(_0x2f8b32){var _0x4fec13={};_0x4fec13[_0x2f8b32]={'$like':'%'+_0x512979[_0x3956('0x35')]['filter']+'%'};return _0x4fec13;})});}_0x5e143d=_[_0x3956('0x41')]({},_0x5e143d,_0x512979['options']);return db[_0x3956('0x63')]['count']({'where':_0x5e143d[_0x3956('0x40')]})[_0x3956('0x26')](function(_0x1e68ca){_0x3779de['count']=_0x1e68ca;if(_0x512979[_0x3956('0x35')][_0x3956('0x44')]){_0x5e143d[_0x3956('0x5d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3956('0x46')](_0x5e143d);})[_0x3956('0x26')](function(_0x4b3176){_0x3779de[_0x3956('0x47')]=_0x4b3176;return _0x3779de;});}})[_0x3956('0x26')](respondWithFilteredResult(_0x5036a1,_0x5e143d))[_0x3956('0x48')](handleError(_0x5036a1,null));};exports['getHopperBlacks']=function(_0x2fef29,_0x3e5051,_0x1d580d){var _0x113b39={'raw':!![],'where':{}};var _0x250157={};var _0x2ea3ae={'count':0x0,'rows':[]};return db['Campaign'][_0x3956('0x62')]({'where':{'id':_0x2fef29[_0x3956('0x4a')]['id']}})[_0x3956('0x26')](handleEntityNotFound(_0x3e5051,null))[_0x3956('0x26')](function(_0x2d4ea2){if(_0x2d4ea2){_0x250157[_0x3956('0x34')]=_[_0x3956('0x36')](db[_0x3956('0x64')][_0x3956('0x30')]);_0x250157['query']=_['keys'](_0x2fef29[_0x3956('0x35')]);_0x250157[_0x3956('0x37')]=_[_0x3956('0x38')](_0x250157[_0x3956('0x34')],_0x250157[_0x3956('0x35')]);_0x113b39['attributes']=_[_0x3956('0x38')](_0x250157[_0x3956('0x34')],qs['fields'](_0x2fef29['query']['fields']));_0x113b39[_0x3956('0x39')]=_0x113b39[_0x3956('0x39')][_0x3956('0x3b')]?_0x113b39['attributes']:_0x250157[_0x3956('0x34')];if(!_0x2fef29[_0x3956('0x35')][_0x3956('0x5a')](_0x3956('0x3c'))){_0x113b39['limit']=qs[_0x3956('0x1d')](_0x2fef29[_0x3956('0x35')]['limit']);_0x113b39[_0x3956('0x1f')]=qs[_0x3956('0x1f')](_0x2fef29[_0x3956('0x35')][_0x3956('0x1f')]);}_0x113b39['order']=qs[_0x3956('0x3e')](_0x2fef29[_0x3956('0x35')][_0x3956('0x3e')]);_0x113b39[_0x3956('0x40')]=qs[_0x3956('0x37')](_[_0x3956('0x60')](_0x2fef29[_0x3956('0x35')],_0x250157[_0x3956('0x37')]));_0x113b39[_0x3956('0x40')]['CampaignId']=_0x2d4ea2['id'];if(_0x2fef29['query'][_0x3956('0x3f')]){_0x113b39[_0x3956('0x40')]=_[_0x3956('0x41')](_0x113b39[_0x3956('0x40')],{'$or':_['map'](_0x113b39[_0x3956('0x39')],function(_0x512be3){var _0x5a42ae={};_0x5a42ae[_0x512be3]={'$like':'%'+_0x2fef29[_0x3956('0x35')][_0x3956('0x3f')]+'%'};return _0x5a42ae;})});}_0x113b39=_[_0x3956('0x41')]({},_0x113b39,_0x2fef29['options']);return db[_0x3956('0x64')]['count']({'where':_0x113b39[_0x3956('0x40')]})[_0x3956('0x26')](function(_0x58461a){_0x2ea3ae[_0x3956('0x1e')]=_0x58461a;if(_0x2fef29['query'][_0x3956('0x44')]){_0x113b39[_0x3956('0x5d')]=[{'all':!![]}];}return db[_0x3956('0x64')][_0x3956('0x46')](_0x113b39);})[_0x3956('0x26')](function(_0x25a0bf){_0x2ea3ae[_0x3956('0x47')]=_0x25a0bf;return _0x2ea3ae;});}})['then'](respondWithFilteredResult(_0x3e5051,_0x113b39))['catch'](handleError(_0x3e5051,null));};exports[_0x3956('0x65')]=function(_0x359ad3,_0x57df0e,_0x1b6642){var _0x5eeefb={};var _0x32917b={};var _0x2790d4;var _0x5cc4f1;return db[_0x3956('0x45')][_0x3956('0x62')]({'where':{'id':_0x359ad3[_0x3956('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57df0e,null))[_0x3956('0x26')](function(_0x3b7740){if(_0x3b7740){_0x2790d4=_0x3b7740;_0x32917b[_0x3956('0x34')]=_['keys'](db[_0x3956('0x66')][_0x3956('0x30')]);_0x32917b['query']=_[_0x3956('0x36')](_0x359ad3[_0x3956('0x35')]);_0x32917b[_0x3956('0x37')]=_[_0x3956('0x38')](_0x32917b[_0x3956('0x34')],_0x32917b[_0x3956('0x35')]);_0x5eeefb[_0x3956('0x39')]=_[_0x3956('0x38')](_0x32917b[_0x3956('0x34')],qs['fields'](_0x359ad3[_0x3956('0x35')]['fields']));_0x5eeefb[_0x3956('0x39')]=_0x5eeefb['attributes'][_0x3956('0x3b')]?_0x5eeefb['attributes']:_0x32917b['model'];_0x5eeefb[_0x3956('0x3d')]=qs[_0x3956('0x3e')](_0x359ad3[_0x3956('0x35')][_0x3956('0x3e')]);_0x5eeefb[_0x3956('0x40')]=qs[_0x3956('0x37')](_[_0x3956('0x60')](_0x359ad3['query'],_0x32917b[_0x3956('0x37')]));if(_0x359ad3[_0x3956('0x35')]['filter']){_0x5eeefb[_0x3956('0x40')]=_[_0x3956('0x41')](_0x5eeefb[_0x3956('0x40')],{'$or':_[_0x3956('0x2f')](_0x5eeefb['attributes'],function(_0x3e4d68){var _0x6623b5={};_0x6623b5[_0x3e4d68]={'$like':'%'+_0x359ad3['query'][_0x3956('0x3f')]+'%'};return _0x6623b5;})});}_0x5eeefb=_[_0x3956('0x41')]({},_0x5eeefb,_0x359ad3['options']);return _0x2790d4['getLists'](_0x5eeefb);}})[_0x3956('0x26')](function(_0x4586d3){if(_0x4586d3){_0x5cc4f1=_0x4586d3[_0x3956('0x3b')];if(!_0x359ad3[_0x3956('0x35')][_0x3956('0x5a')](_0x3956('0x3c'))){_0x5eeefb[_0x3956('0x1d')]=qs[_0x3956('0x1d')](_0x359ad3['query']['limit']);_0x5eeefb[_0x3956('0x1f')]=qs[_0x3956('0x1f')](_0x359ad3[_0x3956('0x35')][_0x3956('0x1f')]);}return _0x2790d4['getLists'](_0x5eeefb);}})['then'](function(_0x4e9878){if(_0x4e9878){return _0x4e9878?{'count':_0x5cc4f1,'rows':_0x4e9878}:null;}})['then'](respondWithResult(_0x57df0e,null))[_0x3956('0x48')](handleError(_0x57df0e,null));};exports[_0x3956('0x67')]=function(_0x1a04a0,_0x15dd5d,_0x352eda){var _0x18787a,_0xb35e2;return db[_0x3956('0x45')]['find']({'where':{'id':_0x1a04a0[_0x3956('0x4a')]['id']}})[_0x3956('0x26')](handleEntityNotFound(_0x15dd5d,null))['then'](function(_0x107111){if(_0x107111){_0xb35e2=_0x107111;return _0x107111[_0x3956('0x67')](_0x1a04a0[_0x3956('0x4c')][_0x3956('0x68')],_[_0x3956('0x56')](_0x1a04a0['body'],[_0x3956('0x68'),'id'])||{});}return null;})[_0x3956('0x69')](function(_0x3d36c2){var _0xd01c0;_0x18787a=_0x3d36c2||[];var _0x5766b4=[];if(_0x3d36c2){for(var _0x22a05b=0x0;_0x22a05b<_0x3d36c2['length'];_0x22a05b+=0x1){var _0xdee0cc=_0x3d36c2[_0x22a05b][_0x3956('0x27')]({'plain':!![]});_0xb35e2['dialCheckDuplicateType']=_0x1a04a0['body'][_0x3956('0x6a')]?_0x1a04a0['body'][_0x3956('0x6a')]:_0xb35e2[_0x3956('0x6a')];switch(_0xb35e2[_0x3956('0x6a')]){case'always':_0xd01c0=squel['insert']()[_0x3956('0x6b')]('cm_hopper')[_0x3956('0x6c')]([_0x3956('0x6d'),_0x3956('0x6e'),_0x3956('0x6f'),'ListId',_0x3956('0x5b'),_0x3956('0x57'),_0x3956('0x58')],squel[_0x3956('0x70')]()[_0x3956('0x71')](_0x3956('0x6d'),_0x3956('0x6d'))[_0x3956('0x71')]('NOW()','scheduledAt')[_0x3956('0x71')]('id',_0x3956('0x6f'))[_0x3956('0x71')](_0xdee0cc[_0x3956('0x72')][_0x3956('0x73')](),_0x3956('0x74'))[_0x3956('0x71')](_0x1a04a0['params']['id']['toString'](),'CampaignId')[_0x3956('0x71')](_0x3956('0x75'),_0x3956('0x57'))[_0x3956('0x71')](_0x3956('0x75'),_0x3956('0x58'))[_0x3956('0x76')]('cm_contacts')[_0x3956('0x40')](_0x3956('0x77'))[_0x3956('0x40')](_0x3956('0x78'),_0xdee0cc[_0x3956('0x72')][_0x3956('0x73')]())[_0x3956('0x40')](_0x3956('0x79'))[_0x3956('0x40')](_0x3956('0x7a'),squel[_0x3956('0x70')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x3956('0x76')]('cm_hopper_final')[_0x3956('0x40')](_0x3956('0x7b'),_0x1a04a0[_0x3956('0x4a')]['id'][_0x3956('0x73')]()))[_0x3956('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3956('0x70')]()[_0x3956('0x71')](_0x3956('0x7c'))['from'](_0x3956('0x7d'))['where'](_0x3956('0x7b'),_0x1a04a0[_0x3956('0x4a')]['id']['toString']())))['toString']();break;case _0x3956('0x7e'):_0xd01c0=squel[_0x3956('0x7f')]()[_0x3956('0x6b')]('cm_hopper')[_0x3956('0x6c')]([_0x3956('0x6d'),_0x3956('0x6e'),_0x3956('0x6f'),_0x3956('0x74'),_0x3956('0x5b'),_0x3956('0x57'),_0x3956('0x58')],squel[_0x3956('0x70')]()['field'](_0x3956('0x6d'),_0x3956('0x6d'))[_0x3956('0x71')]('NOW()','scheduledAt')[_0x3956('0x71')]('id',_0x3956('0x6f'))[_0x3956('0x71')](_0xdee0cc['CmListId']['toString'](),_0x3956('0x74'))[_0x3956('0x71')](_0x1a04a0[_0x3956('0x4a')]['id'][_0x3956('0x73')](),_0x3956('0x5b'))[_0x3956('0x71')](_0x3956('0x75'),_0x3956('0x57'))[_0x3956('0x71')](_0x3956('0x75'),_0x3956('0x58'))[_0x3956('0x76')]('cm_contacts')[_0x3956('0x40')](_0x3956('0x77'))[_0x3956('0x40')]('ListId\x20=\x20?',_0xdee0cc[_0x3956('0x72')][_0x3956('0x73')]())['where'](_0x3956('0x79'))[_0x3956('0x40')](_0x3956('0x7a'),squel[_0x3956('0x70')]()[_0x3956('0x71')]('COALESCE(phone,\x27\x27)')[_0x3956('0x76')](_0x3956('0x7d'))[_0x3956('0x40')](_0x3956('0x7b'),_0x1a04a0['params']['id'][_0x3956('0x73')]())))[_0x3956('0x73')]();break;default:_0xd01c0=squel[_0x3956('0x7f')]()['into']('cm_hopper')['fromQuery']([_0x3956('0x6d'),_0x3956('0x6e'),'ContactId','ListId',_0x3956('0x5b'),_0x3956('0x57'),_0x3956('0x58')],squel[_0x3956('0x70')]()['field'](_0x3956('0x6d'),'phone')['field'](_0x3956('0x75'),'scheduledAt')['field']('id',_0x3956('0x6f'))[_0x3956('0x71')](_0xdee0cc[_0x3956('0x72')]['toString'](),_0x3956('0x74'))['field'](_0x1a04a0[_0x3956('0x4a')]['id'][_0x3956('0x73')](),'CampaignId')[_0x3956('0x71')](_0x3956('0x75'),_0x3956('0x57'))['field'](_0x3956('0x75'),'updatedAt')[_0x3956('0x76')]('cm_contacts')[_0x3956('0x40')](_0x3956('0x77'))[_0x3956('0x40')](_0x3956('0x78'),_0xdee0cc[_0x3956('0x72')][_0x3956('0x73')]())[_0x3956('0x40')](_0x3956('0x79')))[_0x3956('0x73')]();}_0x5766b4[_0x3956('0x80')](db[_0x3956('0x81')][_0x3956('0x35')](_0xd01c0));}return BPromise['all'](_0x5766b4);}})[_0x3956('0x26')](function(){return _0x18787a;})[_0x3956('0x26')](respondWithResult(_0x15dd5d,null))['catch'](handleError(_0x15dd5d,null));};exports[_0x3956('0x82')]=function(_0x28d8fc,_0x2e1781,_0x1bfdf8){return db[_0x3956('0x45')][_0x3956('0x51')]({'where':{'id':_0x28d8fc['params']['id']}})[_0x3956('0x26')](handleEntityNotFound(_0x2e1781,null))[_0x3956('0x26')](function(_0x68823f){if(_0x68823f){return _0x68823f['removeLists'](_0x28d8fc[_0x3956('0x35')][_0x3956('0x68')]);}})[_0x3956('0x26')](function(_0x106b76){if(_0x106b76){return db[_0x3956('0x5c')][_0x3956('0x59')]({'where':{'ListId':_0x28d8fc[_0x3956('0x35')][_0x3956('0x68')],'CampaignId':_0x28d8fc['params']['id']}})[_0x3956('0x26')](function(){return _0x106b76;});}})[_0x3956('0x26')](respondWithStatusCode(_0x2e1781,null))['catch'](handleError(_0x2e1781,null));};exports['getBlackLists']=function(_0x371ada,_0x1f1707,_0x2ddef3){var _0x4a41f3={};var _0x2b8302={};var _0x544e47;var _0x28f110;return db[_0x3956('0x45')]['findOne']({'where':{'id':_0x371ada[_0x3956('0x4a')]['id']}})[_0x3956('0x26')](handleEntityNotFound(_0x1f1707,null))[_0x3956('0x26')](function(_0x5aad80){if(_0x5aad80){_0x544e47=_0x5aad80;_0x2b8302[_0x3956('0x34')]=_[_0x3956('0x36')](db['CmList'][_0x3956('0x30')]);_0x2b8302[_0x3956('0x35')]=_[_0x3956('0x36')](_0x371ada[_0x3956('0x35')]);_0x2b8302[_0x3956('0x37')]=_[_0x3956('0x38')](_0x2b8302[_0x3956('0x34')],_0x2b8302['query']);_0x4a41f3[_0x3956('0x39')]=_[_0x3956('0x38')](_0x2b8302[_0x3956('0x34')],qs[_0x3956('0x3a')](_0x371ada[_0x3956('0x35')][_0x3956('0x3a')]));_0x4a41f3[_0x3956('0x39')]=_0x4a41f3[_0x3956('0x39')][_0x3956('0x3b')]?_0x4a41f3[_0x3956('0x39')]:_0x2b8302['model'];_0x4a41f3['order']=qs[_0x3956('0x3e')](_0x371ada[_0x3956('0x35')][_0x3956('0x3e')]);_0x4a41f3[_0x3956('0x40')]=qs[_0x3956('0x37')](_[_0x3956('0x60')](_0x371ada[_0x3956('0x35')],_0x2b8302['filters']));if(_0x371ada[_0x3956('0x35')][_0x3956('0x3f')]){_0x4a41f3[_0x3956('0x40')]=_[_0x3956('0x41')](_0x4a41f3['where'],{'$or':_[_0x3956('0x2f')](_0x4a41f3[_0x3956('0x39')],function(_0x27a37c){var _0xf63ca6={};_0xf63ca6[_0x27a37c]={'$like':'%'+_0x371ada[_0x3956('0x35')][_0x3956('0x3f')]+'%'};return _0xf63ca6;})});}_0x4a41f3=_['merge']({},_0x4a41f3,_0x371ada[_0x3956('0x43')]);return _0x544e47[_0x3956('0x83')](_0x4a41f3);}})[_0x3956('0x26')](function(_0x222a21){if(_0x222a21){_0x28f110=_0x222a21[_0x3956('0x3b')];if(!_0x371ada['query']['hasOwnProperty'](_0x3956('0x3c'))){_0x4a41f3[_0x3956('0x1d')]=qs[_0x3956('0x1d')](_0x371ada['query'][_0x3956('0x1d')]);_0x4a41f3[_0x3956('0x1f')]=qs[_0x3956('0x1f')](_0x371ada[_0x3956('0x35')][_0x3956('0x1f')]);}return _0x544e47[_0x3956('0x83')](_0x4a41f3);}})[_0x3956('0x26')](function(_0x310d8f){if(_0x310d8f){return _0x310d8f?{'count':_0x28f110,'rows':_0x310d8f}:null;}})[_0x3956('0x26')](respondWithResult(_0x1f1707,null))['catch'](handleError(_0x1f1707,null));};exports[_0x3956('0x84')]=function(_0x42f06b,_0x4920a0,_0x572842){var _0x4793a5,_0x3e51bd;return db[_0x3956('0x45')][_0x3956('0x51')]({'where':{'id':_0x42f06b['params']['id']}})['then'](handleEntityNotFound(_0x4920a0,null))[_0x3956('0x26')](function(_0x2755ec){if(_0x2755ec){_0x3e51bd=_0x2755ec;return _0x2755ec[_0x3956('0x84')](_0x42f06b[_0x3956('0x4c')][_0x3956('0x68')],_[_0x3956('0x56')](_0x42f06b[_0x3956('0x4c')],[_0x3956('0x68'),'id'])||{});}return null;})[_0x3956('0x69')](function(_0x297df1){var _0x466fe;_0x4793a5=_0x297df1||[];var _0x2d7de2=[];if(_0x297df1){for(var _0x114fb4=0x0;_0x114fb4<_0x297df1['length'];_0x114fb4+=0x1){var _0x228816=_0x297df1[_0x114fb4][_0x3956('0x27')]({'plain':!![]});_0x466fe=squel[_0x3956('0x7f')]()[_0x3956('0x6b')]('cm_hopper_black')[_0x3956('0x6c')](['phone',_0x3956('0x6f'),_0x3956('0x74'),_0x3956('0x5b'),_0x3956('0x57'),'updatedAt'],squel[_0x3956('0x70')]()[_0x3956('0x71')](_0x3956('0x6d'),_0x3956('0x6d'))['field']('id',_0x3956('0x6f'))[_0x3956('0x71')](_0x228816[_0x3956('0x72')][_0x3956('0x73')](),_0x3956('0x74'))[_0x3956('0x71')](_0x42f06b[_0x3956('0x4a')]['id'][_0x3956('0x73')](),_0x3956('0x5b'))[_0x3956('0x71')](_0x3956('0x75'),_0x3956('0x57'))[_0x3956('0x71')]('NOW()','updatedAt')['from'](_0x3956('0x85'))['where'](_0x3956('0x77'))['where'](_0x3956('0x78'),_0x228816[_0x3956('0x72')]['toString']())[_0x3956('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0x3956('0x73')]();_0x2d7de2['push'](db[_0x3956('0x81')][_0x3956('0x35')](_0x466fe));}return BPromise[_0x3956('0x86')](_0x2d7de2);}})[_0x3956('0x26')](function(){return _0x4793a5;})['then'](respondWithResult(_0x4920a0,null))[_0x3956('0x48')](handleError(_0x4920a0,null));};exports[_0x3956('0x87')]=function(_0x3e5856,_0x18e305,_0x42aa38){return db[_0x3956('0x45')][_0x3956('0x51')]({'where':{'id':_0x3e5856[_0x3956('0x4a')]['id']}})[_0x3956('0x26')](handleEntityNotFound(_0x18e305,null))[_0x3956('0x26')](function(_0x3c4192){if(_0x3c4192){return _0x3c4192[_0x3956('0x87')](_0x3e5856['query'][_0x3956('0x68')]);}})[_0x3956('0x26')](function(_0x563dd3){if(_0x563dd3){return db[_0x3956('0x64')]['destroy']({'where':{'ListId':_0x3e5856['query'][_0x3956('0x68')],'CampaignId':_0x3e5856[_0x3956('0x4a')]['id']}})[_0x3956('0x26')](function(){return _0x563dd3;});}})[_0x3956('0x26')](respondWithStatusCode(_0x18e305,null))[_0x3956('0x48')](handleError(_0x18e305,null));}; \ No newline at end of file +var _0x1d63=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','fields','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','CampaignId','findAll','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','toString','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','CampaignId\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','then','error','name','index','map','Campaign','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0x286a1c,_0x11c207){var _0x52f18b=function(_0x55677e){while(--_0x55677e){_0x286a1c['push'](_0x286a1c['shift']());}};_0x52f18b(++_0x11c207);}(_0x1d63,0x14f));var _0x31d6=function(_0x138e88,_0x559802){_0x138e88=_0x138e88-0x0;var _0x452f20=_0x1d63[_0x138e88];return _0x452f20;};'use strict';var emlformat=require(_0x31d6('0x0'));var rimraf=require(_0x31d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31d6('0x2'));var rp=require(_0x31d6('0x3'));var moment=require(_0x31d6('0x4'));var BPromise=require(_0x31d6('0x5'));var Mustache=require(_0x31d6('0x6'));var util=require(_0x31d6('0x7'));var path=require(_0x31d6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31d6('0x9'));var _=require(_0x31d6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x31d6('0xb'));var deskjs=require(_0x31d6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x31d6('0xd'));var Redis=require(_0x31d6('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31d6('0xf'));var logger=require(_0x31d6('0x10'))(_0x31d6('0x11'));var utils=require(_0x31d6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x31d6('0x13'))['db'];function respondWithStatusCode(_0x38f302,_0x4fd486){_0x4fd486=_0x4fd486||0xcc;return function(_0x4cf6b4){if(_0x4cf6b4){return _0x38f302[_0x31d6('0x14')](_0x4fd486);}return _0x38f302['status'](_0x4fd486)[_0x31d6('0x15')]();};}function respondWithResult(_0x1ae053,_0x292b84){_0x292b84=_0x292b84||0xc8;return function(_0xed8063){if(_0xed8063){return _0x1ae053['status'](_0x292b84)['json'](_0xed8063);}};}function respondWithFilteredResult(_0xb5bb6,_0x2af5d1){return function(_0x48628b){if(_0x48628b){var _0x104649=typeof _0x2af5d1[_0x31d6('0x16')]===_0x31d6('0x17')&&typeof _0x2af5d1[_0x31d6('0x18')]===_0x31d6('0x17');var _0x31d80b=_0x48628b[_0x31d6('0x19')];var _0x4554fa=_0x104649?0x0:_0x2af5d1['offset'];var _0x27d283=_0x104649?_0x48628b[_0x31d6('0x19')]:_0x2af5d1[_0x31d6('0x16')]+_0x2af5d1[_0x31d6('0x18')];var _0x2c0552;if(_0x27d283>=_0x31d80b){_0x27d283=_0x31d80b;_0x2c0552=0xc8;}else{_0x2c0552=0xce;}_0xb5bb6[_0x31d6('0x1a')](_0x2c0552);return _0xb5bb6[_0x31d6('0x1b')](_0x31d6('0x1c'),_0x4554fa+'-'+_0x27d283+'/'+_0x31d80b)['json'](_0x48628b);}return null;};}function patchUpdates(_0xe9feaa){return function(_0x1aecde){try{jsonpatch[_0x31d6('0x1d')](_0x1aecde,_0xe9feaa,!![]);}catch(_0x588e42){return BPromise[_0x31d6('0x1e')](_0x588e42);}return _0x1aecde['save']();};}function saveUpdates(_0x441c1a,_0x515619){return function(_0x44db6f){if(_0x44db6f){return _0x44db6f[_0x31d6('0x1f')](_0x441c1a)['then'](function(_0x244bcc){return _0x244bcc;});}return null;};}function removeEntity(_0x16fdcd,_0x10f01b){return function(_0x3a202c){if(_0x3a202c){return _0x3a202c[_0x31d6('0x20')]()['then'](function(){var _0x2c866f=_0x3a202c[_0x31d6('0x21')]({'plain':!![]});var _0x846a4b='IvrCampaigns';return db[_0x31d6('0x22')]['destroy']({'where':{'type':_0x846a4b,'resourceId':_0x2c866f['id']}})[_0x31d6('0x23')](function(){return _0x3a202c;});})[_0x31d6('0x23')](function(){_0x16fdcd[_0x31d6('0x1a')](0xcc)[_0x31d6('0x15')]();});}};}function handleEntityNotFound(_0x27868a,_0x3356f2){return function(_0x238226){if(!_0x238226){_0x27868a[_0x31d6('0x14')](0x194);}return _0x238226;};}function handleError(_0x56af42,_0x18a63e){_0x18a63e=_0x18a63e||0x1f4;return function(_0x10373d){logger[_0x31d6('0x24')](_0x10373d['stack']);if(_0x10373d[_0x31d6('0x25')]){delete _0x10373d['name'];}_0x56af42[_0x31d6('0x1a')](_0x18a63e)['send'](_0x10373d);};}exports[_0x31d6('0x26')]=function(_0xa6b215,_0x4a30ce){var _0x540202={},_0xeaa5b9={},_0x206234={'count':0x0,'rows':[]};var _0x1efce4=_[_0x31d6('0x27')](db[_0x31d6('0x28')][_0x31d6('0x29')],function(_0x1bf6c9){return{'name':_0x1bf6c9['fieldName'],'type':_0x1bf6c9[_0x31d6('0x2a')][_0x31d6('0x2b')]};});_0xeaa5b9['model']=_[_0x31d6('0x27')](_0x1efce4,_0x31d6('0x25'));_0xeaa5b9[_0x31d6('0x2c')]=_[_0x31d6('0x2d')](_0xa6b215[_0x31d6('0x2c')]);_0xeaa5b9[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0xeaa5b9[_0x31d6('0x30')],_0xeaa5b9['query']);_0x540202[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0xeaa5b9['model'],qs['fields'](_0xa6b215[_0x31d6('0x2c')]['fields']));_0x540202['attributes']=_0x540202[_0x31d6('0x31')]['length']?_0x540202['attributes']:_0xeaa5b9[_0x31d6('0x30')];if(!_0xa6b215['query'][_0x31d6('0x32')](_0x31d6('0x33'))){_0x540202[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0xa6b215[_0x31d6('0x2c')]['limit']);_0x540202[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x16')]);}_0x540202[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x35')]);_0x540202[_0x31d6('0x36')]=qs[_0x31d6('0x2e')](_[_0x31d6('0x37')](_0xa6b215[_0x31d6('0x2c')],_0xeaa5b9[_0x31d6('0x2e')]),_0x1efce4);if(_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x540202['where']=_['merge'](_0x540202['where'],{'$or':_[_0x31d6('0x27')](_0x1efce4,function(_0x705a28){if(_0x705a28['type']!==_0x31d6('0x39')){var _0x1f178c={};_0x1f178c[_0x705a28[_0x31d6('0x25')]]={'$like':'%'+_0xa6b215[_0x31d6('0x2c')][_0x31d6('0x38')]+'%'};return _0x1f178c;}})});}_0x540202=_['merge']({},_0x540202,_0xa6b215[_0x31d6('0x3a')]);var _0x3f10a9={'where':_0x540202[_0x31d6('0x36')]};return db[_0x31d6('0x28')]['count'](_0x3f10a9)[_0x31d6('0x23')](function(_0x2e0744){_0x206234[_0x31d6('0x19')]=_0x2e0744;if(_0xa6b215['query'][_0x31d6('0x3b')]){_0x540202[_0x31d6('0x3c')]=[{'all':!![]}];}return db[_0x31d6('0x28')]['findAll'](_0x540202);})[_0x31d6('0x23')](function(_0x53c65f){_0x206234[_0x31d6('0x3d')]=_0x53c65f;return _0x206234;})[_0x31d6('0x23')](respondWithFilteredResult(_0x4a30ce,_0x540202))[_0x31d6('0x3e')](handleError(_0x4a30ce,null));};exports['show']=function(_0x2e03f7,_0x2ad9a5){var _0x2b290d={'raw':![],'where':{'id':_0x2e03f7[_0x31d6('0x3f')]['id']}},_0x32a3a1={};_0x32a3a1[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x28')][_0x31d6('0x29')]);_0x32a3a1['query']=_[_0x31d6('0x2d')](_0x2e03f7['query']);_0x32a3a1[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0x32a3a1[_0x31d6('0x30')],_0x32a3a1['query']);_0x2b290d[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x32a3a1['model'],qs['fields'](_0x2e03f7[_0x31d6('0x2c')]['fields']));_0x2b290d[_0x31d6('0x31')]=_0x2b290d[_0x31d6('0x31')][_0x31d6('0x40')]?_0x2b290d[_0x31d6('0x31')]:_0x32a3a1[_0x31d6('0x30')];if(_0x2e03f7[_0x31d6('0x2c')][_0x31d6('0x3b')]){_0x2b290d[_0x31d6('0x3c')]=[{'all':!![]}];}_0x2b290d=_[_0x31d6('0x41')]({},_0x2b290d,_0x2e03f7[_0x31d6('0x3a')]);return db[_0x31d6('0x28')][_0x31d6('0x42')](_0x2b290d)[_0x31d6('0x23')](handleEntityNotFound(_0x2ad9a5,null))[_0x31d6('0x23')](respondWithResult(_0x2ad9a5,null))[_0x31d6('0x3e')](handleError(_0x2ad9a5,null));};exports[_0x31d6('0x43')]=function(_0xd93b61,_0x4b7251){return db[_0x31d6('0x28')][_0x31d6('0x43')](_0xd93b61[_0x31d6('0x44')],{})[_0x31d6('0x23')](function(_0x5bb0a9){var _0x3a1014=_0xd93b61[_0x31d6('0x45')][_0x31d6('0x21')]({'plain':!![]});if(!_0x3a1014)throw new Error(_0x31d6('0x46'));if(_0x3a1014[_0x31d6('0x47')]===_0x31d6('0x45')){var _0x3e237f=_0x5bb0a9[_0x31d6('0x21')]({'plain':!![]});var _0x38861e=_0x31d6('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x38861e,'userProfileId':_0x3a1014[_0x31d6('0x49')]},'raw':!![]})[_0x31d6('0x23')](function(_0x51d869){if(_0x51d869&&_0x51d869[_0x31d6('0x4a')]===0x0){return db[_0x31d6('0x22')]['create']({'name':_0x3e237f[_0x31d6('0x25')],'resourceId':_0x3e237f['id'],'type':_0x51d869[_0x31d6('0x25')],'sectionId':_0x51d869['id']},{})[_0x31d6('0x23')](function(){return _0x5bb0a9;});}else{return _0x5bb0a9;}})[_0x31d6('0x3e')](function(_0x30f833){logger['error'](_0x31d6('0x4b'),_0x30f833);throw _0x30f833;});}return _0x5bb0a9;})[_0x31d6('0x23')](respondWithResult(_0x4b7251,0xc9))['catch'](handleError(_0x4b7251,null));};exports[_0x31d6('0x4c')]=function(_0x22c49d,_0x27df26){var _0x5a5363={'where':{'id':_0x22c49d[_0x31d6('0x3f')]['id']}},_0x797a9d={};_0x797a9d[_0x31d6('0x30')]=_['keys'](db[_0x31d6('0x28')][_0x31d6('0x29')]);_0x5a5363[_0x31d6('0x31')]=_['intersection'](_0x797a9d[_0x31d6('0x30')],qs[_0x31d6('0x4d')](_0x22c49d[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x5a5363[_0x31d6('0x31')]=_0x5a5363['attributes']['length']?_0x5a5363[_0x31d6('0x31')]:_0x797a9d[_0x31d6('0x30')];if(_0x22c49d['query'][_0x31d6('0x3b')]){_0x5a5363['include']=[{'all':!![]}];}_0x5a5363=_[_0x31d6('0x41')]({},_0x5a5363,_0x22c49d[_0x31d6('0x3a')]);return db[_0x31d6('0x28')][_0x31d6('0x42')](_0x5a5363)['then'](handleEntityNotFound(_0x27df26,null))[_0x31d6('0x23')](function(_0x551803){if(_0x551803){var _0x4d198b=_0x551803[_0x31d6('0x21')]({'plain':!![]});_0x4d198b=qs[_0x31d6('0x4e')](_0x4d198b,['id',_0x31d6('0x4f'),_0x31d6('0x50')]);_0x22c49d[_0x31d6('0x44')]=_[_0x31d6('0x4e')](_0x22c49d[_0x31d6('0x44')],['id','createdAt',_0x31d6('0x50')]);return db[_0x31d6('0x28')][_0x31d6('0x43')](_[_0x31d6('0x41')](_0x4d198b,_0x22c49d[_0x31d6('0x44')]),{'include':_0x22c49d[_0x31d6('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x31d6('0x23')](function(_0x356509){var _0x4c1872=_0x22c49d[_0x31d6('0x45')][_0x31d6('0x21')]({'plain':!![]});if(!_0x4c1872)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1872[_0x31d6('0x47')]===_0x31d6('0x45')){var _0x346c92=_0x356509[_0x31d6('0x21')]({'plain':!![]});var _0x2bba38=_0x31d6('0x48');return db[_0x31d6('0x51')]['find']({'where':{'name':_0x2bba38,'userProfileId':_0x4c1872[_0x31d6('0x49')]},'raw':!![]})[_0x31d6('0x23')](function(_0x2921c7){if(_0x2921c7&&_0x2921c7['autoAssociation']===0x0){return db[_0x31d6('0x22')][_0x31d6('0x43')]({'name':_0x346c92['name'],'resourceId':_0x346c92['id'],'type':_0x2921c7[_0x31d6('0x25')],'sectionId':_0x2921c7['id']},{})['then'](function(){return _0x356509;});}else{return _0x356509;}})[_0x31d6('0x3e')](function(_0x12c0d0){logger[_0x31d6('0x24')](_0x31d6('0x4b'),_0x12c0d0);throw _0x12c0d0;});}return _0x356509;});}})[_0x31d6('0x23')](respondWithResult(_0x27df26,0xc9))[_0x31d6('0x3e')](handleError(_0x27df26,null));};exports[_0x31d6('0x1f')]=function(_0x21e58e,_0x23d830){if(_0x21e58e[_0x31d6('0x44')]['id']){delete _0x21e58e[_0x31d6('0x44')]['id'];}return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x21e58e[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x23d830,null))[_0x31d6('0x23')](saveUpdates(_0x21e58e['body'],null))['then'](respondWithResult(_0x23d830,null))[_0x31d6('0x3e')](handleError(_0x23d830,null));};exports[_0x31d6('0x20')]=function(_0x1d82ca,_0x78eba5){return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x1d82ca['params']['id']}})['then'](handleEntityNotFound(_0x78eba5,null))[_0x31d6('0x23')](removeEntity(_0x78eba5,null))[_0x31d6('0x3e')](handleError(_0x78eba5,null));};exports[_0x31d6('0x52')]=function(_0x320219,_0x4f8a59,_0x3f71f9){var _0x403898={'raw':!![],'where':{}};var _0x1d1807={};var _0x1cbb96={'count':0x0,'rows':[]};return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x320219[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x4f8a59,null))[_0x31d6('0x23')](function(_0x4fa786){if(_0x4fa786){_0x1d1807[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x54')][_0x31d6('0x29')]);_0x1d1807['query']=_[_0x31d6('0x2d')](_0x320219['query']);_0x1d1807['filters']=_[_0x31d6('0x2f')](_0x1d1807[_0x31d6('0x30')],_0x1d1807[_0x31d6('0x2c')]);_0x403898[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x1d1807[_0x31d6('0x30')],qs['fields'](_0x320219[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x403898[_0x31d6('0x31')]=_0x403898[_0x31d6('0x31')][_0x31d6('0x40')]?_0x403898[_0x31d6('0x31')]:_0x1d1807[_0x31d6('0x30')];if(!_0x320219[_0x31d6('0x2c')][_0x31d6('0x32')](_0x31d6('0x33'))){_0x403898[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0x320219[_0x31d6('0x2c')][_0x31d6('0x18')]);_0x403898[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0x320219[_0x31d6('0x2c')][_0x31d6('0x16')]);}_0x403898[_0x31d6('0x34')]=qs['sort'](_0x320219[_0x31d6('0x2c')][_0x31d6('0x35')]);_0x403898[_0x31d6('0x36')]=qs[_0x31d6('0x2e')](_[_0x31d6('0x37')](_0x320219['query'],_0x1d1807[_0x31d6('0x2e')]));_0x403898[_0x31d6('0x36')][_0x31d6('0x55')]=_0x4fa786['id'];if(_0x320219[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x403898[_0x31d6('0x36')]=_['merge'](_0x403898['where'],{'$or':_[_0x31d6('0x27')](_0x403898[_0x31d6('0x31')],function(_0x4437b1){var _0x5c929a={};_0x5c929a[_0x4437b1]={'$like':'%'+_0x320219['query'][_0x31d6('0x38')]+'%'};return _0x5c929a;})});}_0x403898=_[_0x31d6('0x41')]({},_0x403898,_0x320219['options']);return db[_0x31d6('0x54')][_0x31d6('0x19')]({'where':_0x403898['where']})[_0x31d6('0x23')](function(_0x1b1b30){_0x1cbb96[_0x31d6('0x19')]=_0x1b1b30;if(_0x320219[_0x31d6('0x2c')]['includeAll']){_0x403898[_0x31d6('0x3c')]=[{'all':!![]}];}return db[_0x31d6('0x54')][_0x31d6('0x56')](_0x403898);})[_0x31d6('0x23')](function(_0x48834a){_0x1cbb96['rows']=_0x48834a;return _0x1cbb96;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x4f8a59,_0x403898))[_0x31d6('0x3e')](handleError(_0x4f8a59,null));};exports['getHopperHistories']=function(_0x5b8631,_0x2842cd,_0x2dea83){var _0x7071a9={'raw':!![],'where':{}};var _0x1f87dd={};var _0x2fd215={'count':0x0,'rows':[]};return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x5b8631[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x2842cd,null))['then'](function(_0x167f08){if(_0x167f08){_0x1f87dd[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x57')][_0x31d6('0x29')]);_0x1f87dd['query']=_[_0x31d6('0x2d')](_0x5b8631[_0x31d6('0x2c')]);_0x1f87dd['filters']=_['intersection'](_0x1f87dd['model'],_0x1f87dd[_0x31d6('0x2c')]);_0x7071a9['attributes']=_[_0x31d6('0x2f')](_0x1f87dd[_0x31d6('0x30')],qs[_0x31d6('0x4d')](_0x5b8631[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x7071a9[_0x31d6('0x31')]=_0x7071a9[_0x31d6('0x31')][_0x31d6('0x40')]?_0x7071a9[_0x31d6('0x31')]:_0x1f87dd['model'];if(!_0x5b8631['query'][_0x31d6('0x32')]('nolimit')){_0x7071a9[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0x5b8631['query'][_0x31d6('0x18')]);_0x7071a9['offset']=qs[_0x31d6('0x16')](_0x5b8631['query'][_0x31d6('0x16')]);}_0x7071a9['order']=qs[_0x31d6('0x35')](_0x5b8631[_0x31d6('0x2c')]['sort']);_0x7071a9[_0x31d6('0x36')]=qs['filters'](_[_0x31d6('0x37')](_0x5b8631[_0x31d6('0x2c')],_0x1f87dd[_0x31d6('0x2e')]));_0x7071a9[_0x31d6('0x36')][_0x31d6('0x55')]=_0x167f08['id'];if(_0x5b8631['query'][_0x31d6('0x38')]){_0x7071a9['where']=_[_0x31d6('0x41')](_0x7071a9['where'],{'$or':_['map'](_0x7071a9['attributes'],function(_0x3456d4){var _0x59db63={};_0x59db63[_0x3456d4]={'$like':'%'+_0x5b8631['query'][_0x31d6('0x38')]+'%'};return _0x59db63;})});}_0x7071a9=_['merge']({},_0x7071a9,_0x5b8631[_0x31d6('0x3a')]);return db[_0x31d6('0x57')]['count']({'where':_0x7071a9[_0x31d6('0x36')]})[_0x31d6('0x23')](function(_0x5aba69){_0x2fd215[_0x31d6('0x19')]=_0x5aba69;if(_0x5b8631[_0x31d6('0x2c')]['includeAll']){_0x7071a9[_0x31d6('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x31d6('0x56')](_0x7071a9);})[_0x31d6('0x23')](function(_0x72dd06){_0x2fd215[_0x31d6('0x3d')]=_0x72dd06;return _0x2fd215;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x2842cd,_0x7071a9))['catch'](handleError(_0x2842cd,null));};exports['getHopperFinals']=function(_0xbcce78,_0x1fa85b,_0x1768c1){var _0x453a8e={'raw':!![],'where':{}};var _0x248de6={};var _0x2e9302={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xbcce78[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x1fa85b,null))[_0x31d6('0x23')](function(_0x35c501){if(_0x35c501){_0x248de6['model']=_[_0x31d6('0x2d')](db[_0x31d6('0x58')][_0x31d6('0x29')]);_0x248de6[_0x31d6('0x2c')]=_['keys'](_0xbcce78['query']);_0x248de6[_0x31d6('0x2e')]=_['intersection'](_0x248de6[_0x31d6('0x30')],_0x248de6[_0x31d6('0x2c')]);_0x453a8e[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x248de6[_0x31d6('0x30')],qs['fields'](_0xbcce78[_0x31d6('0x2c')]['fields']));_0x453a8e[_0x31d6('0x31')]=_0x453a8e[_0x31d6('0x31')][_0x31d6('0x40')]?_0x453a8e[_0x31d6('0x31')]:_0x248de6[_0x31d6('0x30')];if(!_0xbcce78[_0x31d6('0x2c')]['hasOwnProperty'](_0x31d6('0x33'))){_0x453a8e[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x18')]);_0x453a8e[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0xbcce78['query']['offset']);}_0x453a8e[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0xbcce78[_0x31d6('0x2c')]['sort']);_0x453a8e[_0x31d6('0x36')]=qs['filters'](_[_0x31d6('0x37')](_0xbcce78[_0x31d6('0x2c')],_0x248de6['filters']));_0x453a8e[_0x31d6('0x36')][_0x31d6('0x55')]=_0x35c501['id'];if(_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x453a8e[_0x31d6('0x36')]=_['merge'](_0x453a8e[_0x31d6('0x36')],{'$or':_[_0x31d6('0x27')](_0x453a8e['attributes'],function(_0x52fb8b){var _0x1d7696={};_0x1d7696[_0x52fb8b]={'$like':'%'+_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x38')]+'%'};return _0x1d7696;})});}_0x453a8e=_[_0x31d6('0x41')]({},_0x453a8e,_0xbcce78['options']);return db['CmHopperFinal'][_0x31d6('0x19')]({'where':_0x453a8e[_0x31d6('0x36')]})[_0x31d6('0x23')](function(_0x2e8591){_0x2e9302['count']=_0x2e8591;if(_0xbcce78[_0x31d6('0x2c')][_0x31d6('0x3b')]){_0x453a8e[_0x31d6('0x3c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x31d6('0x56')](_0x453a8e);})['then'](function(_0x2450b2){_0x2e9302[_0x31d6('0x3d')]=_0x2450b2;return _0x2e9302;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x1fa85b,_0x453a8e))[_0x31d6('0x3e')](handleError(_0x1fa85b,null));};exports[_0x31d6('0x59')]=function(_0x160156,_0x44f4ef,_0x1f799b){var _0x2f0035={'raw':!![],'where':{}};var _0x586399={};var _0xda715b={'count':0x0,'rows':[]};return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x160156['params']['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x44f4ef,null))[_0x31d6('0x23')](function(_0x1e667b){if(_0x1e667b){_0x586399[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db[_0x31d6('0x5a')][_0x31d6('0x29')]);_0x586399['query']=_[_0x31d6('0x2d')](_0x160156[_0x31d6('0x2c')]);_0x586399[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0x586399[_0x31d6('0x30')],_0x586399[_0x31d6('0x2c')]);_0x2f0035[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x586399[_0x31d6('0x30')],qs['fields'](_0x160156[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x2f0035[_0x31d6('0x31')]=_0x2f0035[_0x31d6('0x31')][_0x31d6('0x40')]?_0x2f0035['attributes']:_0x586399[_0x31d6('0x30')];if(!_0x160156[_0x31d6('0x2c')][_0x31d6('0x32')](_0x31d6('0x33'))){_0x2f0035['limit']=qs[_0x31d6('0x18')](_0x160156['query']['limit']);_0x2f0035['offset']=qs['offset'](_0x160156[_0x31d6('0x2c')][_0x31d6('0x16')]);}_0x2f0035[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0x160156['query'][_0x31d6('0x35')]);_0x2f0035[_0x31d6('0x36')]=qs[_0x31d6('0x2e')](_['pick'](_0x160156['query'],_0x586399[_0x31d6('0x2e')]));_0x2f0035[_0x31d6('0x36')][_0x31d6('0x55')]=_0x1e667b['id'];if(_0x160156['query'][_0x31d6('0x38')]){_0x2f0035[_0x31d6('0x36')]=_[_0x31d6('0x41')](_0x2f0035[_0x31d6('0x36')],{'$or':_[_0x31d6('0x27')](_0x2f0035[_0x31d6('0x31')],function(_0x182413){var _0x1149bd={};_0x1149bd[_0x182413]={'$like':'%'+_0x160156[_0x31d6('0x2c')][_0x31d6('0x38')]+'%'};return _0x1149bd;})});}_0x2f0035=_['merge']({},_0x2f0035,_0x160156[_0x31d6('0x3a')]);return db[_0x31d6('0x5a')][_0x31d6('0x19')]({'where':_0x2f0035[_0x31d6('0x36')]})['then'](function(_0x1cdae0){_0xda715b['count']=_0x1cdae0;if(_0x160156['query'][_0x31d6('0x3b')]){_0x2f0035[_0x31d6('0x3c')]=[{'all':!![]}];}return db[_0x31d6('0x5a')][_0x31d6('0x56')](_0x2f0035);})[_0x31d6('0x23')](function(_0x48715){_0xda715b[_0x31d6('0x3d')]=_0x48715;return _0xda715b;});}})[_0x31d6('0x23')](respondWithFilteredResult(_0x44f4ef,_0x2f0035))[_0x31d6('0x3e')](handleError(_0x44f4ef,null));};exports['getLists']=function(_0x156438,_0x34ab84,_0x46b42e){var _0x5221f4={};var _0xb8481c={};var _0xfef001;var _0x3e7c3a;return db[_0x31d6('0x28')][_0x31d6('0x53')]({'where':{'id':_0x156438['params']['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x34ab84,null))[_0x31d6('0x23')](function(_0x33138e){if(_0x33138e){_0xfef001=_0x33138e;_0xb8481c[_0x31d6('0x30')]=_[_0x31d6('0x2d')](db['CmList'][_0x31d6('0x29')]);_0xb8481c[_0x31d6('0x2c')]=_['keys'](_0x156438[_0x31d6('0x2c')]);_0xb8481c[_0x31d6('0x2e')]=_[_0x31d6('0x2f')](_0xb8481c[_0x31d6('0x30')],_0xb8481c[_0x31d6('0x2c')]);_0x5221f4['attributes']=_['intersection'](_0xb8481c[_0x31d6('0x30')],qs['fields'](_0x156438[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x5221f4[_0x31d6('0x31')]=_0x5221f4[_0x31d6('0x31')][_0x31d6('0x40')]?_0x5221f4['attributes']:_0xb8481c['model'];_0x5221f4[_0x31d6('0x34')]=qs[_0x31d6('0x35')](_0x156438['query']['sort']);_0x5221f4[_0x31d6('0x36')]=qs['filters'](_[_0x31d6('0x37')](_0x156438['query'],_0xb8481c[_0x31d6('0x2e')]));if(_0x156438[_0x31d6('0x2c')][_0x31d6('0x38')]){_0x5221f4[_0x31d6('0x36')]=_[_0x31d6('0x41')](_0x5221f4[_0x31d6('0x36')],{'$or':_[_0x31d6('0x27')](_0x5221f4[_0x31d6('0x31')],function(_0xf61b07){var _0x7cef0f={};_0x7cef0f[_0xf61b07]={'$like':'%'+_0x156438[_0x31d6('0x2c')]['filter']+'%'};return _0x7cef0f;})});}_0x5221f4=_['merge']({},_0x5221f4,_0x156438['options']);return _0xfef001[_0x31d6('0x5b')](_0x5221f4);}})['then'](function(_0x3839ba){if(_0x3839ba){_0x3e7c3a=_0x3839ba[_0x31d6('0x40')];if(!_0x156438[_0x31d6('0x2c')][_0x31d6('0x32')](_0x31d6('0x33'))){_0x5221f4[_0x31d6('0x18')]=qs[_0x31d6('0x18')](_0x156438['query'][_0x31d6('0x18')]);_0x5221f4[_0x31d6('0x16')]=qs[_0x31d6('0x16')](_0x156438[_0x31d6('0x2c')][_0x31d6('0x16')]);}return _0xfef001['getLists'](_0x5221f4);}})[_0x31d6('0x23')](function(_0x5bc7a1){if(_0x5bc7a1){return _0x5bc7a1?{'count':_0x3e7c3a,'rows':_0x5bc7a1}:null;}})[_0x31d6('0x23')](respondWithResult(_0x34ab84,null))[_0x31d6('0x3e')](handleError(_0x34ab84,null));};exports[_0x31d6('0x5c')]=function(_0x5af015,_0x11f8af,_0x5d5e50){var _0x29ab01,_0x188836;return db['Campaign']['find']({'where':{'id':_0x5af015[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x11f8af,null))[_0x31d6('0x23')](function(_0x226381){if(_0x226381){_0x188836=_0x226381;return _0x226381['addLists'](_0x5af015['body']['ids'],_[_0x31d6('0x4e')](_0x5af015[_0x31d6('0x44')],[_0x31d6('0x5d'),'id'])||{});}return null;})['spread'](function(_0x4c2a69){var _0x89b101;_0x29ab01=_0x4c2a69||[];var _0x46ac63=[];if(_0x4c2a69){for(var _0x2503ae=0x0;_0x2503ae<_0x4c2a69[_0x31d6('0x40')];_0x2503ae+=0x1){var _0x322f04=_0x4c2a69[_0x2503ae][_0x31d6('0x21')]({'plain':!![]});_0x188836['dialCheckDuplicateType']=_0x5af015[_0x31d6('0x44')][_0x31d6('0x5e')]?_0x5af015['body'][_0x31d6('0x5e')]:_0x188836[_0x31d6('0x5e')];switch(_0x188836[_0x31d6('0x5e')]){case _0x31d6('0x5f'):_0x89b101=squel[_0x31d6('0x60')]()[_0x31d6('0x61')](_0x31d6('0x62'))[_0x31d6('0x63')](['phone',_0x31d6('0x64'),_0x31d6('0x65'),'ListId',_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x68'),_0x31d6('0x68'))['field'](_0x31d6('0x69'),_0x31d6('0x64'))[_0x31d6('0x67')]('id',_0x31d6('0x65'))['field'](_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')](),_0x31d6('0x6c'))['field'](_0x5af015[_0x31d6('0x3f')]['id'][_0x31d6('0x6b')](),'CampaignId')[_0x31d6('0x67')]('NOW()',_0x31d6('0x4f'))['field'](_0x31d6('0x69'),_0x31d6('0x50'))[_0x31d6('0x6d')]('cm_contacts')[_0x31d6('0x36')]('deletedAt\x20IS\x20NULL')[_0x31d6('0x36')](_0x31d6('0x6e'),_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')]())['where'](_0x31d6('0x6f'))[_0x31d6('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x31d6('0x66')]()['field'](_0x31d6('0x70'))['from'](_0x31d6('0x71'))['where']('CampaignId\x20=\x20?',_0x5af015[_0x31d6('0x3f')]['id'][_0x31d6('0x6b')]()))[_0x31d6('0x36')](_0x31d6('0x72'),squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x73'))[_0x31d6('0x6d')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x5af015['params']['id'][_0x31d6('0x6b')]())))[_0x31d6('0x6b')]();break;case _0x31d6('0x74'):_0x89b101=squel['insert']()[_0x31d6('0x61')](_0x31d6('0x62'))['fromQuery']([_0x31d6('0x68'),'scheduledAt',_0x31d6('0x65'),_0x31d6('0x6c'),_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x68'),_0x31d6('0x68'))[_0x31d6('0x67')](_0x31d6('0x69'),_0x31d6('0x64'))['field']('id',_0x31d6('0x65'))['field'](_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')](),_0x31d6('0x6c'))[_0x31d6('0x67')](_0x5af015[_0x31d6('0x3f')]['id']['toString'](),_0x31d6('0x55'))['field']('NOW()',_0x31d6('0x4f'))[_0x31d6('0x67')](_0x31d6('0x69'),'updatedAt')[_0x31d6('0x6d')](_0x31d6('0x75'))[_0x31d6('0x36')](_0x31d6('0x76'))[_0x31d6('0x36')](_0x31d6('0x6e'),_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')]())['where'](_0x31d6('0x6f'))[_0x31d6('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x31d6('0x66')]()[_0x31d6('0x67')](_0x31d6('0x73'))[_0x31d6('0x6d')](_0x31d6('0x62'))[_0x31d6('0x36')](_0x31d6('0x77'),_0x5af015['params']['id'][_0x31d6('0x6b')]())))[_0x31d6('0x6b')]();break;default:_0x89b101=squel[_0x31d6('0x60')]()[_0x31d6('0x61')](_0x31d6('0x62'))[_0x31d6('0x63')]([_0x31d6('0x68'),'scheduledAt','ContactId',_0x31d6('0x6c'),_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel[_0x31d6('0x66')]()['field'](_0x31d6('0x68'),_0x31d6('0x68'))[_0x31d6('0x67')](_0x31d6('0x69'),_0x31d6('0x64'))[_0x31d6('0x67')]('id',_0x31d6('0x65'))[_0x31d6('0x67')](_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')](),_0x31d6('0x6c'))[_0x31d6('0x67')](_0x5af015[_0x31d6('0x3f')]['id'][_0x31d6('0x6b')](),_0x31d6('0x55'))[_0x31d6('0x67')]('NOW()','createdAt')[_0x31d6('0x67')]('NOW()',_0x31d6('0x50'))['from'](_0x31d6('0x75'))[_0x31d6('0x36')](_0x31d6('0x76'))['where']('ListId\x20=\x20?',_0x322f04[_0x31d6('0x6a')][_0x31d6('0x6b')]())[_0x31d6('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0x31d6('0x6b')]();}_0x46ac63[_0x31d6('0x78')](db['sequelize'][_0x31d6('0x2c')](_0x89b101));}return BPromise[_0x31d6('0x79')](_0x46ac63);}})['then'](function(){return _0x29ab01;})['then'](respondWithResult(_0x11f8af,null))['catch'](handleError(_0x11f8af,null));};exports[_0x31d6('0x7a')]=function(_0x2cdfcd,_0x10e2c0,_0x5b49e6){return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x2cdfcd[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0x10e2c0,null))[_0x31d6('0x23')](function(_0x2024b3){if(_0x2024b3){return _0x2024b3[_0x31d6('0x7a')](_0x2cdfcd['query'][_0x31d6('0x5d')]);}})[_0x31d6('0x23')](function(_0x4efb55){if(_0x4efb55){return db[_0x31d6('0x54')][_0x31d6('0x20')]({'where':{'ListId':_0x2cdfcd[_0x31d6('0x2c')]['ids'],'CampaignId':_0x2cdfcd[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](function(){return _0x4efb55;});}})[_0x31d6('0x23')](respondWithStatusCode(_0x10e2c0,null))[_0x31d6('0x3e')](handleError(_0x10e2c0,null));};exports[_0x31d6('0x7b')]=function(_0x50fc83,_0xc526b4,_0x3cdc53){var _0x432fca={};var _0x149f10={};var _0x1bdb0e;var _0xf65e76;return db[_0x31d6('0x28')]['findOne']({'where':{'id':_0x50fc83[_0x31d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc526b4,null))[_0x31d6('0x23')](function(_0xda0a03){if(_0xda0a03){_0x1bdb0e=_0xda0a03;_0x149f10['model']=_[_0x31d6('0x2d')](db['CmList'][_0x31d6('0x29')]);_0x149f10[_0x31d6('0x2c')]=_[_0x31d6('0x2d')](_0x50fc83[_0x31d6('0x2c')]);_0x149f10['filters']=_['intersection'](_0x149f10[_0x31d6('0x30')],_0x149f10[_0x31d6('0x2c')]);_0x432fca[_0x31d6('0x31')]=_[_0x31d6('0x2f')](_0x149f10['model'],qs['fields'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x4d')]));_0x432fca[_0x31d6('0x31')]=_0x432fca[_0x31d6('0x31')][_0x31d6('0x40')]?_0x432fca[_0x31d6('0x31')]:_0x149f10[_0x31d6('0x30')];_0x432fca[_0x31d6('0x34')]=qs['sort'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x35')]);_0x432fca['where']=qs[_0x31d6('0x2e')](_[_0x31d6('0x37')](_0x50fc83['query'],_0x149f10[_0x31d6('0x2e')]));if(_0x50fc83['query'][_0x31d6('0x38')]){_0x432fca['where']=_['merge'](_0x432fca['where'],{'$or':_['map'](_0x432fca['attributes'],function(_0x490d93){var _0x50f2b2={};_0x50f2b2[_0x490d93]={'$like':'%'+_0x50fc83[_0x31d6('0x2c')]['filter']+'%'};return _0x50f2b2;})});}_0x432fca=_[_0x31d6('0x41')]({},_0x432fca,_0x50fc83[_0x31d6('0x3a')]);return _0x1bdb0e[_0x31d6('0x7b')](_0x432fca);}})[_0x31d6('0x23')](function(_0x2efcda){if(_0x2efcda){_0xf65e76=_0x2efcda[_0x31d6('0x40')];if(!_0x50fc83[_0x31d6('0x2c')]['hasOwnProperty'](_0x31d6('0x33'))){_0x432fca[_0x31d6('0x18')]=qs['limit'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x18')]);_0x432fca[_0x31d6('0x16')]=qs['offset'](_0x50fc83[_0x31d6('0x2c')][_0x31d6('0x16')]);}return _0x1bdb0e[_0x31d6('0x7b')](_0x432fca);}})[_0x31d6('0x23')](function(_0x390fd7){if(_0x390fd7){return _0x390fd7?{'count':_0xf65e76,'rows':_0x390fd7}:null;}})[_0x31d6('0x23')](respondWithResult(_0xc526b4,null))[_0x31d6('0x3e')](handleError(_0xc526b4,null));};exports[_0x31d6('0x7c')]=function(_0x4b7afe,_0x1da08c,_0x1b5515){var _0x5cd950,_0x3f7bfe;return db[_0x31d6('0x28')][_0x31d6('0x42')]({'where':{'id':_0x4b7afe[_0x31d6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1da08c,null))['then'](function(_0x4eb783){if(_0x4eb783){_0x3f7bfe=_0x4eb783;return _0x4eb783[_0x31d6('0x7c')](_0x4b7afe['body'][_0x31d6('0x5d')],_['omit'](_0x4b7afe['body'],['ids','id'])||{});}return null;})['spread'](function(_0x5e7d62){var _0x4ecbb3;_0x5cd950=_0x5e7d62||[];var _0x1950f2=[];if(_0x5e7d62){for(var _0x3ffb84=0x0;_0x3ffb84<_0x5e7d62[_0x31d6('0x40')];_0x3ffb84+=0x1){var _0x542b62=_0x5e7d62[_0x3ffb84]['get']({'plain':!![]});_0x4ecbb3=squel[_0x31d6('0x60')]()[_0x31d6('0x61')](_0x31d6('0x7d'))[_0x31d6('0x63')]([_0x31d6('0x68'),_0x31d6('0x65'),'ListId',_0x31d6('0x55'),_0x31d6('0x4f'),_0x31d6('0x50')],squel['select']()['field']('phone',_0x31d6('0x68'))[_0x31d6('0x67')]('id',_0x31d6('0x65'))[_0x31d6('0x67')](_0x542b62[_0x31d6('0x6a')][_0x31d6('0x6b')](),'ListId')[_0x31d6('0x67')](_0x4b7afe['params']['id'][_0x31d6('0x6b')](),_0x31d6('0x55'))[_0x31d6('0x67')](_0x31d6('0x69'),_0x31d6('0x4f'))[_0x31d6('0x67')](_0x31d6('0x69'),'updatedAt')['from'](_0x31d6('0x75'))[_0x31d6('0x36')]('deletedAt\x20IS\x20NULL')[_0x31d6('0x36')](_0x31d6('0x6e'),_0x542b62[_0x31d6('0x6a')][_0x31d6('0x6b')]())[_0x31d6('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0x31d6('0x6b')]();_0x1950f2['push'](db[_0x31d6('0x7e')]['query'](_0x4ecbb3));}return BPromise['all'](_0x1950f2);}})[_0x31d6('0x23')](function(){return _0x5cd950;})[_0x31d6('0x23')](respondWithResult(_0x1da08c,null))[_0x31d6('0x3e')](handleError(_0x1da08c,null));};exports[_0x31d6('0x7f')]=function(_0x1e2b51,_0xc3419b,_0x274d60){return db['Campaign'][_0x31d6('0x42')]({'where':{'id':_0x1e2b51[_0x31d6('0x3f')]['id']}})[_0x31d6('0x23')](handleEntityNotFound(_0xc3419b,null))[_0x31d6('0x23')](function(_0x156dd4){if(_0x156dd4){return _0x156dd4['removeBlackLists'](_0x1e2b51[_0x31d6('0x2c')][_0x31d6('0x5d')]);}})[_0x31d6('0x23')](function(_0x3d0218){if(_0x3d0218){return db[_0x31d6('0x5a')][_0x31d6('0x20')]({'where':{'ListId':_0x1e2b51[_0x31d6('0x2c')][_0x31d6('0x5d')],'CampaignId':_0x1e2b51[_0x31d6('0x3f')]['id']}})['then'](function(){return _0x3d0218;});}})[_0x31d6('0x23')](respondWithStatusCode(_0xc3419b,null))[_0x31d6('0x3e')](handleError(_0xc3419b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 65d6cb7..735c60c 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(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x40b7ec,_0x307707){var _0x72b976=function(_0x5bfcc3){while(--_0x5bfcc3){_0x40b7ec['push'](_0x40b7ec['shift']());}};_0x72b976(++_0x307707);}(_0x7a54,0x106));var _0x47a5=function(_0x4e02a1,_0x43b5d0){_0x4e02a1=_0x4e02a1-0x0;var _0x30d550=_0x7a54[_0x4e02a1];return _0x30d550;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index d300d45..c4c27e7 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 _0xb945=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','stringify','lodash','moment','randomstring','../../config/utils'];(function(_0x3ad751,_0x4111fd){var _0x1039e9=function(_0x35c6a7){while(--_0x35c6a7){_0x3ad751['push'](_0x3ad751['shift']());}};_0x1039e9(++_0x4111fd);}(_0xb945,0x97));var _0x5b94=function(_0xcedf57,_0x335b10){_0xcedf57=_0xcedf57-0x0;var _0x35eccf=_0xb945[_0xcedf57];return _0x35eccf;};'use strict';var _=require(_0x5b94('0x0'));var util=require('util');var moment=require(_0x5b94('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b94('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b94('0x3'));var logger=require(_0x5b94('0x4'))(_0x5b94('0x5'));var config=require(_0x5b94('0x6'));var jayson=require(_0x5b94('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2db8d8,_0x2cfea8,_0x42bd69){return new BPromise(function(_0x186d22,_0x5d2448){return client[_0x5b94('0x8')](_0x2db8d8,_0x42bd69)['then'](function(_0x3e7695){logger[_0x5b94('0x9')](_0x5b94('0xa'),_0x2cfea8,_0x5b94('0xb'));logger[_0x5b94('0xc')](_0x5b94('0xd'),_0x2cfea8,_0x5b94('0xb'),JSON['stringify'](_0x3e7695));if(_0x3e7695[_0x5b94('0xe')]){if(_0x3e7695['error'][_0x5b94('0xf')]===0x1f4){logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x3e7695[_0x5b94('0xe')][_0x5b94('0x10')]);return _0x5d2448(_0x3e7695['error'][_0x5b94('0x10')]);}logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x3e7695[_0x5b94('0xe')]['message']);return _0x186d22(_0x3e7695[_0x5b94('0xe')]['message']);}else{logger[_0x5b94('0x9')](_0x5b94('0xa'),_0x2cfea8,'request\x20sent');_0x186d22(_0x3e7695[_0x5b94('0x11')][_0x5b94('0x10')]);}})[_0x5b94('0x12')](function(_0x537c8e){logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x537c8e);_0x5d2448(_0x537c8e);});});}exports['GetCampaign']=function(_0x2bb003){var _0x1171ac=this;return new Promise(function(_0x1b5874,_0x5f389e){return db[_0x5b94('0x13')][_0x5b94('0x14')]({'raw':_0x2bb003['options']?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x16')]===undefined?!![]:![]:!![],'where':_0x2bb003[_0x5b94('0x15')]?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x17')]||null:null,'attributes':_0x2bb003['options']?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x18')]||null:null,'limit':_0x2bb003['options']?_0x2bb003['options'][_0x5b94('0x19')]||null:null,'include':_0x2bb003[_0x5b94('0x15')]?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x1a')]?_[_0x5b94('0x1b')](_0x2bb003[_0x5b94('0x15')][_0x5b94('0x1a')],function(_0x31d950){return{'model':db[_0x31d950[_0x5b94('0x1c')]],'as':_0x31d950['as'],'attributes':_0x31d950[_0x5b94('0x18')],'include':_0x31d950[_0x5b94('0x1a')]?_[_0x5b94('0x1b')](_0x31d950[_0x5b94('0x1a')],function(_0x1c8db6){return{'model':db[_0x1c8db6[_0x5b94('0x1c')]],'as':_0x1c8db6['as'],'attributes':_0x1c8db6[_0x5b94('0x18')],'include':_0x1c8db6['include']?_[_0x5b94('0x1b')](_0x1c8db6[_0x5b94('0x1a')],function(_0x344373){return{'model':db[_0x344373[_0x5b94('0x1c')]],'as':_0x344373['as'],'attributes':_0x344373[_0x5b94('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x548ab5){logger[_0x5b94('0x9')](_0x5b94('0x1d'),_0x2bb003);logger[_0x5b94('0xc')]('GetCampaign',_0x2bb003,JSON[_0x5b94('0x1e')](_0x548ab5));_0x1b5874(_0x548ab5);})[_0x5b94('0x12')](function(_0x594aca){logger['error'](_0x5b94('0x1d'),_0x594aca[_0x5b94('0x10')],_0x2bb003);_0x5f389e(_0x1171ac[_0x5b94('0xe')](0x1f4,_0x594aca[_0x5b94('0x10')]));});});}; \ No newline at end of file +var _0x2bd6=['where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw'];(function(_0x3d92e3,_0x4a8dcf){var _0x4150dc=function(_0x58f184){while(--_0x58f184){_0x3d92e3['push'](_0x3d92e3['shift']());}};_0x4150dc(++_0x4a8dcf);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x2bd6[_0x1e2321];return _0x1d346d;};'use strict';var _=require(_0x62bd('0x0'));var util=require(_0x62bd('0x1'));var moment=require(_0x62bd('0x2'));var BPromise=require(_0x62bd('0x3'));var rs=require(_0x62bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62bd('0x5'))['db'];var utils=require(_0x62bd('0x6'));var logger=require(_0x62bd('0x7'))('rpc');var config=require(_0x62bd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x62bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39af04,_0x55d811,_0x3d0d8b){return new BPromise(function(_0x11af94,_0x4ff8b8){return client[_0x62bd('0xa')](_0x39af04,_0x3d0d8b)[_0x62bd('0xb')](function(_0x1e2413){logger[_0x62bd('0xc')](_0x62bd('0xd'),_0x55d811,_0x62bd('0xe'));logger[_0x62bd('0xf')](_0x62bd('0x10'),_0x55d811,_0x62bd('0xe'),JSON[_0x62bd('0x11')](_0x1e2413));if(_0x1e2413['error']){if(_0x1e2413['error'][_0x62bd('0x12')]===0x1f4){logger[_0x62bd('0x13')](_0x62bd('0xd'),_0x55d811,_0x1e2413[_0x62bd('0x13')][_0x62bd('0x14')]);return _0x4ff8b8(_0x1e2413[_0x62bd('0x13')]['message']);}logger[_0x62bd('0x13')]('Campaign,\x20%s,\x20%s',_0x55d811,_0x1e2413[_0x62bd('0x13')]['message']);return _0x11af94(_0x1e2413['error'][_0x62bd('0x14')]);}else{logger[_0x62bd('0xc')](_0x62bd('0xd'),_0x55d811,_0x62bd('0xe'));_0x11af94(_0x1e2413[_0x62bd('0x15')][_0x62bd('0x14')]);}})[_0x62bd('0x16')](function(_0x16f723){logger['error'](_0x62bd('0xd'),_0x55d811,_0x16f723);_0x4ff8b8(_0x16f723);});});}exports[_0x62bd('0x17')]=function(_0x1e0b6a){var _0x38eb80=this;return new Promise(function(_0x59a648,_0x3d050b){return db[_0x62bd('0x18')][_0x62bd('0x19')]({'raw':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a['options'][_0x62bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1c')]||null:null,'attributes':_0x1e0b6a['options']?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1d')]||null:null,'limit':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')]['limit']||null:null,'include':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1e')]?_[_0x62bd('0x1f')](_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1e')],function(_0x245628){return{'model':db[_0x245628[_0x62bd('0x20')]],'as':_0x245628['as'],'attributes':_0x245628[_0x62bd('0x1d')],'include':_0x245628[_0x62bd('0x1e')]?_[_0x62bd('0x1f')](_0x245628[_0x62bd('0x1e')],function(_0x45e4f2){return{'model':db[_0x45e4f2['model']],'as':_0x45e4f2['as'],'attributes':_0x45e4f2[_0x62bd('0x1d')],'include':_0x45e4f2[_0x62bd('0x1e')]?_['map'](_0x45e4f2[_0x62bd('0x1e')],function(_0x3c6761){return{'model':db[_0x3c6761[_0x62bd('0x20')]],'as':_0x3c6761['as'],'attributes':_0x3c6761['attributes']};}):[]};}):[]};}):[]:[]})[_0x62bd('0xb')](function(_0x205d78){logger[_0x62bd('0xc')](_0x62bd('0x17'),_0x1e0b6a);logger[_0x62bd('0xf')](_0x62bd('0x17'),_0x1e0b6a,JSON[_0x62bd('0x11')](_0x205d78));_0x59a648(_0x205d78);})[_0x62bd('0x16')](function(_0x532515){logger['error'](_0x62bd('0x17'),_0x532515[_0x62bd('0x14')],_0x1e0b6a);_0x3d050b(_0x38eb80[_0x62bd('0x13')](0x1f4,_0x532515[_0x62bd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 42a1ada..7bcb27f 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 _0x0422=['removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','delete'];(function(_0x1d4434,_0x1e6aa0){var _0x17ff20=function(_0x58d53e){while(--_0x58d53e){_0x1d4434['push'](_0x1d4434['shift']());}};_0x17ff20(++_0x1e6aa0);}(_0x0422,0x1b3));var _0x2042=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0x0422[_0xc7348b];return _0x307cec;};'use strict';var multer=require(_0x2042('0x0'));var util=require(_0x2042('0x1'));var path=require(_0x2042('0x2'));var timeout=require(_0x2042('0x3'));var express=require(_0x2042('0x4'));var router=express[_0x2042('0x5')]();var fs_extra=require(_0x2042('0x6'));var auth=require(_0x2042('0x7'));var interaction=require(_0x2042('0x8'));var config=require('../../config/environment');var controller=require(_0x2042('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2042('0xa')](_0x2042('0xb'),auth[_0x2042('0xc')](),controller[_0x2042('0xd')]);router['get']('/:id/hoppers',auth[_0x2042('0xc')](),controller['getHoppers']);router[_0x2042('0xa')](_0x2042('0xe'),auth[_0x2042('0xc')](),controller[_0x2042('0xf')]);router[_0x2042('0xa')](_0x2042('0x10'),auth[_0x2042('0xc')](),controller[_0x2042('0x11')]);router['get'](_0x2042('0x12'),auth[_0x2042('0xc')](),controller[_0x2042('0x13')]);router[_0x2042('0xa')]('/:id/lists',auth[_0x2042('0xc')](),controller[_0x2042('0x14')]);router[_0x2042('0xa')](_0x2042('0x15'),auth[_0x2042('0xc')](),controller[_0x2042('0x16')]);router[_0x2042('0x17')]('/',auth['isAuthenticated'](),controller[_0x2042('0x18')]);router['post'](_0x2042('0x19'),auth[_0x2042('0xc')](),controller[_0x2042('0x1a')]);router['post'](_0x2042('0x1b'),auth[_0x2042('0xc')](),controller[_0x2042('0x1c')]);router[_0x2042('0x17')](_0x2042('0x15'),auth[_0x2042('0xc')](),controller[_0x2042('0x1d')]);router[_0x2042('0x1e')]('/:id',auth[_0x2042('0xc')](),controller[_0x2042('0x1f')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2042('0x20')]('/:id/lists',auth[_0x2042('0xc')](),controller[_0x2042('0x21')]);router['delete'](_0x2042('0x15'),auth[_0x2042('0xc')](),controller[_0x2042('0x22')]);module[_0x2042('0x23')]=router; \ No newline at end of file +var _0x9fb1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','exports','multer','util','path'];(function(_0x5b9259,_0x198473){var _0x5bbf28=function(_0x392f8e){while(--_0x392f8e){_0x5b9259['push'](_0x5b9259['shift']());}};_0x5bbf28(++_0x198473);}(_0x9fb1,0x11d));var _0x19fb=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x9fb1[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x19fb('0x0'));var util=require(_0x19fb('0x1'));var path=require(_0x19fb('0x2'));var timeout=require(_0x19fb('0x3'));var express=require(_0x19fb('0x4'));var router=express[_0x19fb('0x5')]();var fs_extra=require(_0x19fb('0x6'));var auth=require(_0x19fb('0x7'));var interaction=require(_0x19fb('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x19fb('0x9')]('/',auth[_0x19fb('0xa')](),controller['index']);router[_0x19fb('0x9')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0xc')]);router[_0x19fb('0x9')](_0x19fb('0xd'),auth['isAuthenticated'](),controller[_0x19fb('0xe')]);router[_0x19fb('0x9')](_0x19fb('0xf'),auth[_0x19fb('0xa')](),controller['getHopperHistories']);router[_0x19fb('0x9')]('/:id/hopper_finals',auth[_0x19fb('0xa')](),controller['getHopperFinals']);router[_0x19fb('0x9')](_0x19fb('0x10'),auth[_0x19fb('0xa')](),controller['getHopperBlacks']);router['get'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x12')]);router[_0x19fb('0x9')]('/:id/blacklists',auth[_0x19fb('0xa')](),controller[_0x19fb('0x13')]);router[_0x19fb('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x19fb('0x14')](_0x19fb('0x15'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x16')]);router['post'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x17')]);router['post'](_0x19fb('0x18'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x19')]);router[_0x19fb('0x1a')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1b')]);router[_0x19fb('0x1c')](_0x19fb('0xb'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1d')]);router['delete'](_0x19fb('0x11'),auth[_0x19fb('0xa')](),controller[_0x19fb('0x1e')]);router[_0x19fb('0x1c')](_0x19fb('0x18'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x19fb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ad1c2f0..2f1618e 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 _0x86b9=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x563c9e,_0x242d88){var _0x58f477=function(_0x51c195){while(--_0x51c195){_0x563c9e['push'](_0x563c9e['shift']());}};_0x58f477(++_0x242d88);}(_0x86b9,0x198));var _0x986b=function(_0xc17ecf,_0x1b550a){_0xc17ecf=_0xc17ecf-0x0;var _0xfcdbe=_0x86b9[_0xc17ecf];return _0xfcdbe;};'use strict';var Sequelize=require(_0x986b('0x0'));module[_0x986b('0x1')]={'key':{'type':Sequelize[_0x986b('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x986b('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x986b('0x4')],'get':function(){return this[_0x986b('0x5')](_0x986b('0x6'));}}}; \ No newline at end of file +var _0x716c=['getDataValue','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x15ddec,_0x3a1bbe){var _0x129d60=function(_0x779b50){while(--_0x779b50){_0x15ddec['push'](_0x15ddec['shift']());}};_0x129d60(++_0x3a1bbe);}(_0x716c,0x6d));var _0xc716=function(_0x429dd7,_0x3d7e15){_0x429dd7=_0x429dd7-0x0;var _0x1888ae=_0x716c[_0x429dd7];return _0x1888ae;};'use strict';var Sequelize=require(_0xc716('0x0'));module[_0xc716('0x1')]={'key':{'type':Sequelize[_0xc716('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xc716('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xc716('0x2')]},'name':{'type':Sequelize[_0xc716('0x4')],'get':function(){return this[_0xc716('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 753ca0c..28f6f01 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 _0x74c1=['../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','stack','name','send','index','map','CannedAnswer','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/environment','../../config/license/util'];(function(_0x1baa1a,_0x16d722){var _0x4854b7=function(_0x407b08){while(--_0x407b08){_0x1baa1a['push'](_0x1baa1a['shift']());}};_0x4854b7(++_0x16d722);}(_0x74c1,0x95));var _0x174c=function(_0x3e43c8,_0x516592){_0x3e43c8=_0x3e43c8-0x0;var _0x17b9b0=_0x74c1[_0x3e43c8];return _0x17b9b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x174c('0x0'));var zipdir=require(_0x174c('0x1'));var jsonpatch=require(_0x174c('0x2'));var rp=require(_0x174c('0x3'));var moment=require(_0x174c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x174c('0x5'));var util=require(_0x174c('0x6'));var path=require(_0x174c('0x7'));var sox=require(_0x174c('0x8'));var csv=require('to-csv');var ejs=require(_0x174c('0x9'));var fs=require('fs');var fs_extra=require(_0x174c('0xa'));var _=require(_0x174c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x174c('0xc'));var deskjs=require(_0x174c('0xd'));var toCsv=require(_0x174c('0xe'));var querystring=require(_0x174c('0xf'));var Papa=require(_0x174c('0x10'));var Redis=require(_0x174c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x174c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x174c('0x13'));var licenseUtil=require(_0x174c('0x14'));var db=require(_0x174c('0x15'))['db'];function respondWithStatusCode(_0x4ccbdb,_0x1c1fa7){_0x1c1fa7=_0x1c1fa7||0xcc;return function(_0x16f977){if(_0x16f977){return _0x4ccbdb['sendStatus'](_0x1c1fa7);}return _0x4ccbdb[_0x174c('0x16')](_0x1c1fa7)['end']();};}function respondWithResult(_0x542925,_0x35c26a){_0x35c26a=_0x35c26a||0xc8;return function(_0x91e7e0){if(_0x91e7e0){return _0x542925[_0x174c('0x16')](_0x35c26a)[_0x174c('0x17')](_0x91e7e0);}};}function respondWithFilteredResult(_0x34962e,_0x5bac11){return function(_0x43a031){if(_0x43a031){var _0xecb5fa=typeof _0x5bac11[_0x174c('0x18')]===_0x174c('0x19')&&typeof _0x5bac11[_0x174c('0x1a')]===_0x174c('0x19');var _0x473e98=_0x43a031[_0x174c('0x1b')];var _0x24e6c4=_0xecb5fa?0x0:_0x5bac11[_0x174c('0x18')];var _0x465b81=_0xecb5fa?_0x43a031[_0x174c('0x1b')]:_0x5bac11[_0x174c('0x18')]+_0x5bac11[_0x174c('0x1a')];var _0x586fc6;if(_0x465b81>=_0x473e98){_0x465b81=_0x473e98;_0x586fc6=0xc8;}else{_0x586fc6=0xce;}_0x34962e['status'](_0x586fc6);return _0x34962e[_0x174c('0x1c')](_0x174c('0x1d'),_0x24e6c4+'-'+_0x465b81+'/'+_0x473e98)[_0x174c('0x17')](_0x43a031);}return null;};}function patchUpdates(_0x299a7b){return function(_0x5a06a0){try{jsonpatch[_0x174c('0x1e')](_0x5a06a0,_0x299a7b,!![]);}catch(_0x48a9b2){return BPromise[_0x174c('0x1f')](_0x48a9b2);}return _0x5a06a0['save']();};}function saveUpdates(_0x3edb3d,_0x4f892e){return function(_0x7cb04d){if(_0x7cb04d){return _0x7cb04d[_0x174c('0x20')](_0x3edb3d)[_0x174c('0x21')](function(_0x4f8c09){return _0x4f8c09;});}return null;};}function removeEntity(_0x5b9ab2,_0x11f166){return function(_0x18c315){if(_0x18c315){return _0x18c315[_0x174c('0x22')]()['then'](function(){var _0x4219ee=_0x18c315[_0x174c('0x23')]({'plain':!![]});var _0x2df587=_0x174c('0x24');return db[_0x174c('0x25')][_0x174c('0x22')]({'where':{'type':_0x2df587,'resourceId':_0x4219ee['id']}})[_0x174c('0x21')](function(){return _0x18c315;});})[_0x174c('0x21')](function(){_0x5b9ab2[_0x174c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9be124,_0x435de9){return function(_0xd27bca){if(!_0xd27bca){_0x9be124[_0x174c('0x26')](0x194);}return _0xd27bca;};}function handleError(_0x19835c,_0x34adcc){_0x34adcc=_0x34adcc||0x1f4;return function(_0x2003c3){logger['error'](_0x2003c3[_0x174c('0x27')]);if(_0x2003c3[_0x174c('0x28')]){delete _0x2003c3['name'];}_0x19835c['status'](_0x34adcc)[_0x174c('0x29')](_0x2003c3);};}exports[_0x174c('0x2a')]=function(_0xdf9a15,_0x30a038){var _0x2a1cdc={},_0xd75b67={},_0x49b388={'count':0x0,'rows':[]};var _0x40ea24=_[_0x174c('0x2b')](db[_0x174c('0x2c')]['rawAttributes'],function(_0x3d48d3){return{'name':_0x3d48d3[_0x174c('0x2d')],'type':_0x3d48d3['type'][_0x174c('0x2e')]};});_0xd75b67['model']=_['map'](_0x40ea24,_0x174c('0x28'));_0xd75b67[_0x174c('0x2f')]=_['keys'](_0xdf9a15['query']);_0xd75b67['filters']=_[_0x174c('0x30')](_0xd75b67[_0x174c('0x31')],_0xd75b67[_0x174c('0x2f')]);_0x2a1cdc[_0x174c('0x32')]=_[_0x174c('0x30')](_0xd75b67[_0x174c('0x31')],qs['fields'](_0xdf9a15[_0x174c('0x2f')][_0x174c('0x33')]));_0x2a1cdc[_0x174c('0x32')]=_0x2a1cdc[_0x174c('0x32')][_0x174c('0x34')]?_0x2a1cdc['attributes']:_0xd75b67['model'];if(!_0xdf9a15[_0x174c('0x2f')][_0x174c('0x35')]('nolimit')){_0x2a1cdc[_0x174c('0x1a')]=qs['limit'](_0xdf9a15['query'][_0x174c('0x1a')]);_0x2a1cdc[_0x174c('0x18')]=qs[_0x174c('0x18')](_0xdf9a15[_0x174c('0x2f')]['offset']);}_0x2a1cdc[_0x174c('0x36')]=qs['sort'](_0xdf9a15[_0x174c('0x2f')][_0x174c('0x37')]);_0x2a1cdc[_0x174c('0x38')]=qs['filters'](_[_0x174c('0x39')](_0xdf9a15[_0x174c('0x2f')],_0xd75b67[_0x174c('0x3a')]),_0x40ea24);if(_0xdf9a15[_0x174c('0x2f')][_0x174c('0x3b')]){_0x2a1cdc[_0x174c('0x38')]=_[_0x174c('0x3c')](_0x2a1cdc[_0x174c('0x38')],{'$or':[{'key':{'$like':'%'+_0xdf9a15[_0x174c('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0xdf9a15[_0x174c('0x2f')]['filter']+'%'}}]});}_0x2a1cdc=_['merge']({},_0x2a1cdc,_0xdf9a15[_0x174c('0x3d')]);var _0x3bf8e5={'where':_0x2a1cdc[_0x174c('0x38')]};return db[_0x174c('0x2c')][_0x174c('0x1b')](_0x3bf8e5)[_0x174c('0x21')](function(_0x444e27){_0x49b388[_0x174c('0x1b')]=_0x444e27;if(_0xdf9a15[_0x174c('0x2f')][_0x174c('0x3e')]){_0x2a1cdc[_0x174c('0x3f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x174c('0x40')](_0x2a1cdc);})[_0x174c('0x21')](function(_0x5c2229){_0x49b388[_0x174c('0x41')]=_0x5c2229;return _0x49b388;})['then'](respondWithFilteredResult(_0x30a038,_0x2a1cdc))[_0x174c('0x42')](handleError(_0x30a038,null));};exports['show']=function(_0x105853,_0x576e29){var _0x422784={'raw':!![],'where':{'id':_0x105853[_0x174c('0x43')]['id']}},_0x1bd749={};_0x1bd749[_0x174c('0x31')]=_[_0x174c('0x44')](db['CannedAnswer'][_0x174c('0x45')]);_0x1bd749[_0x174c('0x2f')]=_[_0x174c('0x44')](_0x105853[_0x174c('0x2f')]);_0x1bd749[_0x174c('0x3a')]=_[_0x174c('0x30')](_0x1bd749[_0x174c('0x31')],_0x1bd749['query']);_0x422784[_0x174c('0x32')]=_[_0x174c('0x30')](_0x1bd749['model'],qs['fields'](_0x105853[_0x174c('0x2f')][_0x174c('0x33')]));_0x422784[_0x174c('0x32')]=_0x422784[_0x174c('0x32')][_0x174c('0x34')]?_0x422784[_0x174c('0x32')]:_0x1bd749[_0x174c('0x31')];if(_0x105853[_0x174c('0x2f')]['includeAll']){_0x422784[_0x174c('0x3f')]=[{'all':!![]}];}_0x422784=_[_0x174c('0x3c')]({},_0x422784,_0x105853[_0x174c('0x3d')]);return db[_0x174c('0x2c')][_0x174c('0x46')](_0x422784)[_0x174c('0x21')](handleEntityNotFound(_0x576e29,null))[_0x174c('0x21')](respondWithResult(_0x576e29,null))[_0x174c('0x42')](handleError(_0x576e29,null));};exports[_0x174c('0x20')]=function(_0x5290c0,_0x5a614b){if(_0x5290c0['body']['id']){delete _0x5290c0[_0x174c('0x47')]['id'];}return db[_0x174c('0x2c')][_0x174c('0x46')]({'where':{'id':_0x5290c0[_0x174c('0x43')]['id']}})[_0x174c('0x21')](handleEntityNotFound(_0x5a614b,null))['then'](saveUpdates(_0x5290c0['body'],null))[_0x174c('0x21')](respondWithResult(_0x5a614b,null))[_0x174c('0x42')](handleError(_0x5a614b,null));};exports[_0x174c('0x22')]=function(_0x3868b7,_0x13f146){return db[_0x174c('0x2c')]['find']({'where':{'id':_0x3868b7[_0x174c('0x43')]['id']}})['then'](handleEntityNotFound(_0x13f146,null))[_0x174c('0x21')](removeEntity(_0x13f146,null))['catch'](handleError(_0x13f146,null));};exports[_0x174c('0x48')]=function(_0x34006d,_0x1f3b8d){var _0x47f320={'key':_0x34006d[_0x174c('0x47')][_0x174c('0x2e')]};if(_0x34006d['body'][_0x174c('0x49')]){_0x47f320['MailAccountId']=_0x34006d['body'][_0x174c('0x49')];}else if(_0x34006d['body'][_0x174c('0x4a')]){_0x47f320[_0x174c('0x4a')]=_0x34006d[_0x174c('0x47')]['SmsAccountId'];}else if(_0x34006d[_0x174c('0x47')]['OpenchannelAccountId']){_0x47f320[_0x174c('0x4b')]=_0x34006d[_0x174c('0x47')][_0x174c('0x4b')];}else if(_0x34006d[_0x174c('0x47')][_0x174c('0x4c')]){_0x47f320['ChatWebsiteId']=_0x34006d[_0x174c('0x47')][_0x174c('0x4c')];}return db[_0x174c('0x2c')][_0x174c('0x46')]({'where':_0x47f320})[_0x174c('0x21')](function(_0x48adb5){if(_0x48adb5){throw new db[(_0x174c('0x4d'))][(_0x174c('0x4e'))](_0x174c('0x4f'));}return db[_0x174c('0x2c')][_0x174c('0x48')](_0x34006d['body']);})[_0x174c('0x21')](function(_0x2f8b8d){var _0x5885bc=_0x34006d[_0x174c('0x50')][_0x174c('0x23')]({'plain':!![]});if(!_0x5885bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5885bc[_0x174c('0x51')]===_0x174c('0x50')){var _0x2486c8=_0x2f8b8d[_0x174c('0x23')]({'plain':!![]});return db[_0x174c('0x52')][_0x174c('0x46')]({'where':{'name':_0x174c('0x24'),'userProfileId':_0x5885bc[_0x174c('0x53')]},'raw':!![]})[_0x174c('0x21')](function(_0x36295c){if(_0x36295c&&_0x36295c['autoAssociation']===0x0){return db['UserProfileResource'][_0x174c('0x48')]({'name':_0x2486c8[_0x174c('0x28')],'resourceId':_0x2486c8['id'],'type':_0x36295c[_0x174c('0x28')],'sectionId':_0x36295c['id']},{})[_0x174c('0x21')](function(){return _0x2f8b8d;});}else{return _0x2f8b8d;}})['catch'](function(_0x2ccc58){logger['error'](_0x174c('0x54'),_0x2ccc58);throw _0x2ccc58;});}return _0x2f8b8d;})[_0x174c('0x21')](respondWithResult(_0x1f3b8d,0xc9))[_0x174c('0x42')](handleError(_0x1f3b8d,null));}; \ No newline at end of file +var _0xe420=['destroy','error','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','catch','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','CannedAnswers'];(function(_0x24f484,_0x1621ec){var _0x32f642=function(_0x1961bb){while(--_0x1961bb){_0x24f484['push'](_0x24f484['shift']());}};_0x32f642(++_0x1621ec);}(_0xe420,0x149));var _0x0e42=function(_0x47cd8b,_0x982a8e){_0x47cd8b=_0x47cd8b-0x0;var _0x36b69c=_0xe420[_0x47cd8b];return _0x36b69c;};'use strict';var emlformat=require(_0x0e42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e42('0x1'));var jsonpatch=require(_0x0e42('0x2'));var rp=require('request-promise');var moment=require(_0x0e42('0x3'));var BPromise=require(_0x0e42('0x4'));var Mustache=require(_0x0e42('0x5'));var util=require('util');var path=require(_0x0e42('0x6'));var sox=require(_0x0e42('0x7'));var csv=require('to-csv');var ejs=require(_0x0e42('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e42('0x9'));var squel=require(_0x0e42('0xa'));var crypto=require(_0x0e42('0xb'));var jsforce=require(_0x0e42('0xc'));var deskjs=require(_0x0e42('0xd'));var toCsv=require(_0x0e42('0xe'));var querystring=require(_0x0e42('0xf'));var Papa=require(_0x0e42('0x10'));var Redis=require(_0x0e42('0x11'));var authService=require(_0x0e42('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0e42('0x13'));var hardwareService=require(_0x0e42('0x14'));var logger=require(_0x0e42('0x15'))('api');var utils=require(_0x0e42('0x16'));var config=require(_0x0e42('0x17'));var licenseUtil=require(_0x0e42('0x18'));var db=require(_0x0e42('0x19'))['db'];function respondWithStatusCode(_0x413273,_0x4d125c){_0x4d125c=_0x4d125c||0xcc;return function(_0x274e0d){if(_0x274e0d){return _0x413273[_0x0e42('0x1a')](_0x4d125c);}return _0x413273[_0x0e42('0x1b')](_0x4d125c)[_0x0e42('0x1c')]();};}function respondWithResult(_0x30b280,_0x8c8b82){_0x8c8b82=_0x8c8b82||0xc8;return function(_0x1d71c8){if(_0x1d71c8){return _0x30b280[_0x0e42('0x1b')](_0x8c8b82)[_0x0e42('0x1d')](_0x1d71c8);}};}function respondWithFilteredResult(_0x3ec2c8,_0x3be9ea){return function(_0x4bcc41){if(_0x4bcc41){var _0x5b4245=typeof _0x3be9ea['offset']===_0x0e42('0x1e')&&typeof _0x3be9ea['limit']===_0x0e42('0x1e');var _0x138b41=_0x4bcc41[_0x0e42('0x1f')];var _0x2d0b2e=_0x5b4245?0x0:_0x3be9ea[_0x0e42('0x20')];var _0x4b6443=_0x5b4245?_0x4bcc41['count']:_0x3be9ea[_0x0e42('0x20')]+_0x3be9ea[_0x0e42('0x21')];var _0x3cf82e;if(_0x4b6443>=_0x138b41){_0x4b6443=_0x138b41;_0x3cf82e=0xc8;}else{_0x3cf82e=0xce;}_0x3ec2c8[_0x0e42('0x1b')](_0x3cf82e);return _0x3ec2c8[_0x0e42('0x22')](_0x0e42('0x23'),_0x2d0b2e+'-'+_0x4b6443+'/'+_0x138b41)['json'](_0x4bcc41);}return null;};}function patchUpdates(_0x59f1cb){return function(_0x2038ff){try{jsonpatch[_0x0e42('0x24')](_0x2038ff,_0x59f1cb,!![]);}catch(_0x349151){return BPromise[_0x0e42('0x25')](_0x349151);}return _0x2038ff[_0x0e42('0x26')]();};}function saveUpdates(_0x1ffbae,_0x35a8de){return function(_0x1e1464){if(_0x1e1464){return _0x1e1464[_0x0e42('0x27')](_0x1ffbae)[_0x0e42('0x28')](function(_0x219dbe){return _0x219dbe;});}return null;};}function removeEntity(_0x553a80,_0x5468e9){return function(_0x3e051b){if(_0x3e051b){return _0x3e051b['destroy']()[_0x0e42('0x28')](function(){var _0x2fb5c8=_0x3e051b[_0x0e42('0x29')]({'plain':!![]});var _0x11e9c6=_0x0e42('0x2a');return db['UserProfileResource'][_0x0e42('0x2b')]({'where':{'type':_0x11e9c6,'resourceId':_0x2fb5c8['id']}})[_0x0e42('0x28')](function(){return _0x3e051b;});})['then'](function(){_0x553a80[_0x0e42('0x1b')](0xcc)[_0x0e42('0x1c')]();});}};}function handleEntityNotFound(_0x15e1e3,_0x372ba4){return function(_0x5d734e){if(!_0x5d734e){_0x15e1e3[_0x0e42('0x1a')](0x194);}return _0x5d734e;};}function handleError(_0x3e7acf,_0x2504bb){_0x2504bb=_0x2504bb||0x1f4;return function(_0x26f356){logger[_0x0e42('0x2c')](_0x26f356['stack']);if(_0x26f356['name']){delete _0x26f356[_0x0e42('0x2d')];}_0x3e7acf[_0x0e42('0x1b')](_0x2504bb)[_0x0e42('0x2e')](_0x26f356);};}exports[_0x0e42('0x2f')]=function(_0x2622ba,_0x51816e){var _0x22d459={},_0x2adcbb={},_0x4f47db={'count':0x0,'rows':[]};var _0x30f8c9=_['map'](db[_0x0e42('0x30')][_0x0e42('0x31')],function(_0x560b37){return{'name':_0x560b37[_0x0e42('0x32')],'type':_0x560b37[_0x0e42('0x33')][_0x0e42('0x34')]};});_0x2adcbb['model']=_['map'](_0x30f8c9,_0x0e42('0x2d'));_0x2adcbb[_0x0e42('0x35')]=_[_0x0e42('0x36')](_0x2622ba['query']);_0x2adcbb[_0x0e42('0x37')]=_[_0x0e42('0x38')](_0x2adcbb[_0x0e42('0x39')],_0x2adcbb['query']);_0x22d459['attributes']=_[_0x0e42('0x38')](_0x2adcbb[_0x0e42('0x39')],qs[_0x0e42('0x3a')](_0x2622ba[_0x0e42('0x35')]['fields']));_0x22d459[_0x0e42('0x3b')]=_0x22d459[_0x0e42('0x3b')][_0x0e42('0x3c')]?_0x22d459[_0x0e42('0x3b')]:_0x2adcbb['model'];if(!_0x2622ba[_0x0e42('0x35')][_0x0e42('0x3d')](_0x0e42('0x3e'))){_0x22d459['limit']=qs[_0x0e42('0x21')](_0x2622ba[_0x0e42('0x35')]['limit']);_0x22d459[_0x0e42('0x20')]=qs[_0x0e42('0x20')](_0x2622ba[_0x0e42('0x35')][_0x0e42('0x20')]);}_0x22d459[_0x0e42('0x3f')]=qs[_0x0e42('0x40')](_0x2622ba[_0x0e42('0x35')][_0x0e42('0x40')]);_0x22d459[_0x0e42('0x41')]=qs[_0x0e42('0x37')](_[_0x0e42('0x42')](_0x2622ba['query'],_0x2adcbb['filters']),_0x30f8c9);if(_0x2622ba[_0x0e42('0x35')][_0x0e42('0x43')]){_0x22d459['where']=_[_0x0e42('0x44')](_0x22d459[_0x0e42('0x41')],{'$or':[{'key':{'$like':'%'+_0x2622ba[_0x0e42('0x35')][_0x0e42('0x43')]+'%'}},{'value':{'$like':'%'+_0x2622ba['query']['filter']+'%'}}]});}_0x22d459=_[_0x0e42('0x44')]({},_0x22d459,_0x2622ba[_0x0e42('0x45')]);var _0x195516={'where':_0x22d459[_0x0e42('0x41')]};return db[_0x0e42('0x30')][_0x0e42('0x1f')](_0x195516)['then'](function(_0x24e817){_0x4f47db[_0x0e42('0x1f')]=_0x24e817;if(_0x2622ba[_0x0e42('0x35')][_0x0e42('0x46')]){_0x22d459[_0x0e42('0x47')]=[{'all':!![]}];}return db[_0x0e42('0x30')][_0x0e42('0x48')](_0x22d459);})['then'](function(_0x13db90){_0x4f47db[_0x0e42('0x49')]=_0x13db90;return _0x4f47db;})[_0x0e42('0x28')](respondWithFilteredResult(_0x51816e,_0x22d459))['catch'](handleError(_0x51816e,null));};exports[_0x0e42('0x4a')]=function(_0x53bc3c,_0x474f20){var _0x455ec7={'raw':!![],'where':{'id':_0x53bc3c['params']['id']}},_0x39afa0={};_0x39afa0['model']=_[_0x0e42('0x36')](db[_0x0e42('0x30')][_0x0e42('0x31')]);_0x39afa0['query']=_[_0x0e42('0x36')](_0x53bc3c[_0x0e42('0x35')]);_0x39afa0[_0x0e42('0x37')]=_[_0x0e42('0x38')](_0x39afa0[_0x0e42('0x39')],_0x39afa0[_0x0e42('0x35')]);_0x455ec7['attributes']=_['intersection'](_0x39afa0[_0x0e42('0x39')],qs[_0x0e42('0x3a')](_0x53bc3c[_0x0e42('0x35')][_0x0e42('0x3a')]));_0x455ec7[_0x0e42('0x3b')]=_0x455ec7[_0x0e42('0x3b')][_0x0e42('0x3c')]?_0x455ec7[_0x0e42('0x3b')]:_0x39afa0[_0x0e42('0x39')];if(_0x53bc3c[_0x0e42('0x35')]['includeAll']){_0x455ec7[_0x0e42('0x47')]=[{'all':!![]}];}_0x455ec7=_[_0x0e42('0x44')]({},_0x455ec7,_0x53bc3c['options']);return db[_0x0e42('0x30')]['find'](_0x455ec7)[_0x0e42('0x28')](handleEntityNotFound(_0x474f20,null))[_0x0e42('0x28')](respondWithResult(_0x474f20,null))[_0x0e42('0x4b')](handleError(_0x474f20,null));};exports[_0x0e42('0x27')]=function(_0xefad3e,_0x3f2727){if(_0xefad3e[_0x0e42('0x4c')]['id']){delete _0xefad3e[_0x0e42('0x4c')]['id'];}return db[_0x0e42('0x30')][_0x0e42('0x4d')]({'where':{'id':_0xefad3e['params']['id']}})[_0x0e42('0x28')](handleEntityNotFound(_0x3f2727,null))['then'](saveUpdates(_0xefad3e['body'],null))['then'](respondWithResult(_0x3f2727,null))[_0x0e42('0x4b')](handleError(_0x3f2727,null));};exports['destroy']=function(_0x38e31f,_0x58a5c3){return db['CannedAnswer']['find']({'where':{'id':_0x38e31f[_0x0e42('0x4e')]['id']}})[_0x0e42('0x28')](handleEntityNotFound(_0x58a5c3,null))[_0x0e42('0x28')](removeEntity(_0x58a5c3,null))[_0x0e42('0x4b')](handleError(_0x58a5c3,null));};exports[_0x0e42('0x4f')]=function(_0x5579dc,_0x361aae){var _0x3ea812={'key':_0x5579dc['body'][_0x0e42('0x34')]};if(_0x5579dc['body'][_0x0e42('0x50')]){_0x3ea812[_0x0e42('0x50')]=_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x50')];}else if(_0x5579dc['body']['SmsAccountId']){_0x3ea812[_0x0e42('0x51')]=_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x51')];}else if(_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x52')]){_0x3ea812[_0x0e42('0x52')]=_0x5579dc['body'][_0x0e42('0x52')];}else if(_0x5579dc[_0x0e42('0x4c')][_0x0e42('0x53')]){_0x3ea812[_0x0e42('0x53')]=_0x5579dc['body'][_0x0e42('0x53')];}return db[_0x0e42('0x30')][_0x0e42('0x4d')]({'where':_0x3ea812})[_0x0e42('0x28')](function(_0x473315){if(_0x473315){throw new db['Sequelize'][(_0x0e42('0x54'))](_0x0e42('0x55'));}return db[_0x0e42('0x30')]['create'](_0x5579dc['body']);})[_0x0e42('0x28')](function(_0x5e9c78){var _0x5a67a2=_0x5579dc[_0x0e42('0x56')][_0x0e42('0x29')]({'plain':!![]});if(!_0x5a67a2)throw new Error(_0x0e42('0x57'));if(_0x5a67a2[_0x0e42('0x58')]===_0x0e42('0x56')){var _0x231255=_0x5e9c78['get']({'plain':!![]});return db[_0x0e42('0x59')][_0x0e42('0x4d')]({'where':{'name':_0x0e42('0x2a'),'userProfileId':_0x5a67a2['userProfileId']},'raw':!![]})[_0x0e42('0x28')](function(_0x5eeced){if(_0x5eeced&&_0x5eeced[_0x0e42('0x5a')]===0x0){return db[_0x0e42('0x5b')][_0x0e42('0x4f')]({'name':_0x231255[_0x0e42('0x2d')],'resourceId':_0x231255['id'],'type':_0x5eeced[_0x0e42('0x2d')],'sectionId':_0x5eeced['id']},{})[_0x0e42('0x28')](function(){return _0x5e9c78;});}else{return _0x5e9c78;}})['catch'](function(_0x32186c){logger[_0x0e42('0x2c')](_0x0e42('0x5c'),_0x32186c);throw _0x32186c;});}return _0x5e9c78;})[_0x0e42('0x28')](respondWithResult(_0x361aae,0xc9))[_0x0e42('0x4b')](handleError(_0x361aae,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a0f28d3..ee4c56b 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 _0x24ed=['path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x274596,_0x193c4e){var _0x490cbb=function(_0x1889fc){while(--_0x1889fc){_0x274596['push'](_0x274596['shift']());}};_0x490cbb(++_0x193c4e);}(_0x24ed,0x1e4));var _0xd24e=function(_0x2af981,_0x116a02){_0x2af981=_0x2af981-0x0;var _0x13d5f3=_0x24ed[_0x2af981];return _0x13d5f3;};'use strict';var _=require(_0xd24e('0x0'));var util=require('util');var logger=require(_0xd24e('0x1'))(_0xd24e('0x2'));var moment=require(_0xd24e('0x3'));var BPromise=require(_0xd24e('0x4'));var rp=require(_0xd24e('0x5'));var fs=require('fs');var path=require(_0xd24e('0x6'));var rimraf=require(_0xd24e('0x7'));var config=require('../../config/environment');var attributes=require(_0xd24e('0x8'));module[_0xd24e('0x9')]=function(_0x49a499,_0x3363f1){return _0x49a499[_0xd24e('0xa')](_0xd24e('0xb'),attributes,{'tableName':_0xd24e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd24e('0xd')});}; \ No newline at end of file +var _0x6599=['bluebird','path','../../config/environment','exports','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6599,0xb0));var _0x9659=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x6599[_0x996bc8];return _0x20b0ea;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var logger=require(_0x9659('0x1'))(_0x9659('0x2'));var moment=require(_0x9659('0x3'));var BPromise=require(_0x9659('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9659('0x5'));var rimraf=require('rimraf');var config=require(_0x9659('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x9659('0x7')]=function(_0xb08ede,_0x159ac2){return _0xb08ede['define']('CannedAnswer',attributes,{'tableName':_0x9659('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9659('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ec77e40..96cdf72 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(_0x691348,_0x5bfbbc){var _0x4a5ab9=function(_0x1bf5dd){while(--_0x1bf5dd){_0x691348['push'](_0x691348['shift']());}};_0x4a5ab9(++_0x5bfbbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x31bc64,_0x315baa){var _0x312095=function(_0x3f14af){while(--_0x3f14af){_0x31bc64['push'](_0x31bc64['shift']());}};_0x312095(++_0x315baa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 c3979da..669d393 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 _0x75bc=['/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated'];(function(_0x35454a,_0x6ae92a){var _0x35ca06=function(_0x2455c9){while(--_0x2455c9){_0x35454a['push'](_0x35454a['shift']());}};_0x35ca06(++_0x6ae92a);}(_0x75bc,0x184));var _0xc75b=function(_0x5541f3,_0x266df7){_0x5541f3=_0x5541f3-0x0;var _0xe30f20=_0x75bc[_0x5541f3];return _0xe30f20;};'use strict';var multer=require(_0xc75b('0x0'));var util=require('util');var path=require(_0xc75b('0x1'));var timeout=require('connect-timeout');var express=require(_0xc75b('0x2'));var router=express[_0xc75b('0x3')]();var fs_extra=require(_0xc75b('0x4'));var auth=require(_0xc75b('0x5'));var interaction=require(_0xc75b('0x6'));var config=require(_0xc75b('0x7'));var controller=require(_0xc75b('0x8'));router[_0xc75b('0x9')]('/',auth[_0xc75b('0xa')](),controller['index']);router[_0xc75b('0x9')](_0xc75b('0xb'),auth[_0xc75b('0xa')](),controller[_0xc75b('0xc')]);router['post']('/',auth[_0xc75b('0xa')](),controller[_0xc75b('0xd')]);router[_0xc75b('0xe')](_0xc75b('0xb'),auth[_0xc75b('0xa')](),controller[_0xc75b('0xf')]);router[_0xc75b('0x10')](_0xc75b('0xb'),auth['isAuthenticated'](),controller[_0xc75b('0x11')]);module[_0xc75b('0x12')]=router; \ No newline at end of file +var _0xdeba=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe456dc,_0x5662de){var _0x304d45=function(_0x68f858){while(--_0x68f858){_0xe456dc['push'](_0xe456dc['shift']());}};_0x304d45(++_0x5662de);}(_0xdeba,0x171));var _0xadeb=function(_0x10afb8,_0x167b07){_0x10afb8=_0x10afb8-0x0;var _0xdb4d6a=_0xdeba[_0x10afb8];return _0xdb4d6a;};'use strict';var multer=require(_0xadeb('0x0'));var util=require(_0xadeb('0x1'));var path=require(_0xadeb('0x2'));var timeout=require(_0xadeb('0x3'));var express=require(_0xadeb('0x4'));var router=express[_0xadeb('0x5')]();var fs_extra=require(_0xadeb('0x6'));var auth=require(_0xadeb('0x7'));var interaction=require(_0xadeb('0x8'));var config=require('../../config/environment');var controller=require(_0xadeb('0x9'));router[_0xadeb('0xa')]('/',auth[_0xadeb('0xb')](),controller[_0xadeb('0xc')]);router['get'](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller[_0xadeb('0xe')]);router['post']('/',auth[_0xadeb('0xb')](),controller['create']);router[_0xadeb('0xf')](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller[_0xadeb('0x10')]);router['delete'](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller[_0xadeb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 2d9e847..3164730 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 _0xdecb=['INTEGER','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x1b8b15,_0x54010a){var _0x4b0411=function(_0x63598f){while(--_0x63598f){_0x1b8b15['push'](_0x1b8b15['shift']());}};_0x4b0411(++_0x54010a);}(_0xdecb,0xe2));var _0xbdec=function(_0x42e67a,_0x324254){_0x42e67a=_0x42e67a-0x0;var _0x53b151=_0xdecb[_0x42e67a];return _0x53b151;};'use strict';var Sequelize=require('sequelize');module[_0xbdec('0x0')]={'calldate':{'type':Sequelize[_0xbdec('0x1')],'allowNull':![],'defaultValue':_0xbdec('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xbdec('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xbdec('0x3')]},'channel':{'type':Sequelize[_0xbdec('0x3')]},'dstchannel':{'type':Sequelize[_0xbdec('0x3')]},'lastapp':{'type':Sequelize[_0xbdec('0x3')]},'lastdata':{'type':Sequelize[_0xbdec('0x3')]},'duration':{'type':Sequelize[_0xbdec('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbdec('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xbdec('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xbdec('0x3')]},'userfield':{'type':Sequelize[_0xbdec('0x3')]},'uniqueid':{'type':Sequelize[_0xbdec('0x3')]},'linkedid':{'type':Sequelize[_0xbdec('0x3')]},'sequence':{'type':Sequelize[_0xbdec('0x3')]},'peeraccount':{'type':Sequelize[_0xbdec('0x3')]},'type':{'type':Sequelize[_0xbdec('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf78d=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2a6ac9,_0x1da3cd){var _0x332cc2=function(_0xdacd78){while(--_0xdacd78){_0x2a6ac9['push'](_0x2a6ac9['shift']());}};_0x332cc2(++_0x1da3cd);}(_0xf78d,0x1c7));var _0xdf78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf78d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdf78('0x0')]={'calldate':{'type':Sequelize[_0xdf78('0x1')],'allowNull':![],'defaultValue':_0xdf78('0x2')},'clid':{'type':Sequelize[_0xdf78('0x3')]},'src':{'type':Sequelize[_0xdf78('0x3')]},'dst':{'type':Sequelize[_0xdf78('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xdf78('0x3')]},'lastapp':{'type':Sequelize[_0xdf78('0x3')]},'lastdata':{'type':Sequelize[_0xdf78('0x3')]},'duration':{'type':Sequelize[_0xdf78('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdf78('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdf78('0x3')]},'amaflags':{'type':Sequelize[_0xdf78('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdf78('0x3')]},'linkedid':{'type':Sequelize[_0xdf78('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xdf78('0x3')]},'type':{'type':Sequelize[_0xdf78('0x3')]},'tag':{'type':Sequelize[_0xdf78('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 0c3fb8a..64155f8 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 _0xf69d=['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','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','send','map','Cdr','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xfed70c,_0xb596d6){var _0x46da41=function(_0x52631e){while(--_0x52631e){_0xfed70c['push'](_0xfed70c['shift']());}};_0x46da41(++_0xb596d6);}(_0xf69d,0xd3));var _0xdf69=function(_0x1cee35,_0x22413c){_0x1cee35=_0x1cee35-0x0;var _0x1761d6=_0xf69d[_0x1cee35];return _0x1761d6;};'use strict';var emlformat=require(_0xdf69('0x0'));var rimraf=require(_0xdf69('0x1'));var zipdir=require(_0xdf69('0x2'));var jsonpatch=require(_0xdf69('0x3'));var rp=require(_0xdf69('0x4'));var moment=require('moment');var BPromise=require(_0xdf69('0x5'));var Mustache=require(_0xdf69('0x6'));var util=require(_0xdf69('0x7'));var path=require(_0xdf69('0x8'));var sox=require(_0xdf69('0x9'));var csv=require(_0xdf69('0xa'));var ejs=require(_0xdf69('0xb'));var fs=require('fs');var fs_extra=require(_0xdf69('0xc'));var _=require(_0xdf69('0xd'));var squel=require(_0xdf69('0xe'));var crypto=require(_0xdf69('0xf'));var jsforce=require(_0xdf69('0x10'));var deskjs=require(_0xdf69('0x11'));var toCsv=require(_0xdf69('0xa'));var querystring=require(_0xdf69('0x12'));var Papa=require(_0xdf69('0x13'));var Redis=require(_0xdf69('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdf69('0x15'));var as=require(_0xdf69('0x16'));var hardwareService=require(_0xdf69('0x17'));var logger=require(_0xdf69('0x18'))(_0xdf69('0x19'));var utils=require(_0xdf69('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5df98a,_0x3dcda8){_0x3dcda8=_0x3dcda8||0xcc;return function(_0xbacdc6){if(_0xbacdc6){return _0x5df98a[_0xdf69('0x1b')](_0x3dcda8);}return _0x5df98a[_0xdf69('0x1c')](_0x3dcda8)[_0xdf69('0x1d')]();};}function respondWithResult(_0x38aee2,_0x584cbd){_0x584cbd=_0x584cbd||0xc8;return function(_0x41cc77){if(_0x41cc77){return _0x38aee2[_0xdf69('0x1c')](_0x584cbd)[_0xdf69('0x1e')](_0x41cc77);}};}function respondWithFilteredResult(_0xef2df5,_0x4f28fc){return function(_0xa4242f){if(_0xa4242f){var _0x56be66=typeof _0x4f28fc[_0xdf69('0x1f')]===_0xdf69('0x20')&&typeof _0x4f28fc['limit']===_0xdf69('0x20');var _0x449908=_0xa4242f[_0xdf69('0x21')];var _0x85d1d=_0x56be66?0x0:_0x4f28fc['offset'];var _0x5ae237=_0x56be66?_0xa4242f[_0xdf69('0x21')]:_0x4f28fc[_0xdf69('0x1f')]+_0x4f28fc['limit'];var _0x32cf65;if(_0x5ae237>=_0x449908){_0x5ae237=_0x449908;_0x32cf65=0xc8;}else{_0x32cf65=0xce;}_0xef2df5[_0xdf69('0x1c')](_0x32cf65);return _0xef2df5[_0xdf69('0x22')]('Content-Range',_0x85d1d+'-'+_0x5ae237+'/'+_0x449908)[_0xdf69('0x1e')](_0xa4242f);}return null;};}function patchUpdates(_0x452cfa){return function(_0x4d09d5){try{jsonpatch['apply'](_0x4d09d5,_0x452cfa,!![]);}catch(_0x32505a){return BPromise[_0xdf69('0x23')](_0x32505a);}return _0x4d09d5[_0xdf69('0x24')]();};}function saveUpdates(_0x5d91b8,_0x50ef18){return function(_0x5be7dd){if(_0x5be7dd){return _0x5be7dd[_0xdf69('0x25')](_0x5d91b8)['then'](function(_0x21f757){return _0x21f757;});}return null;};}function removeEntity(_0x311534,_0x1d37d8){return function(_0x54d2ca){if(_0x54d2ca){return _0x54d2ca['destroy']()[_0xdf69('0x26')](function(){_0x311534[_0xdf69('0x1c')](0xcc)[_0xdf69('0x1d')]();});}};}function handleEntityNotFound(_0x3fd933,_0x549191){return function(_0x3b727c){if(!_0x3b727c){_0x3fd933[_0xdf69('0x1b')](0x194);}return _0x3b727c;};}function handleError(_0x3e4f28,_0x5969cb){_0x5969cb=_0x5969cb||0x1f4;return function(_0x2da3df){logger['error'](_0x2da3df['stack']);if(_0x2da3df['name']){delete _0x2da3df['name'];}_0x3e4f28[_0xdf69('0x1c')](_0x5969cb)[_0xdf69('0x27')](_0x2da3df);};}exports['index']=function(_0x301bd2,_0xd81d0a){var _0x19cf2d={},_0x12aec3={},_0x1b7c16={'count':0x0,'rows':[]};var _0x1b57b3=_[_0xdf69('0x28')](db[_0xdf69('0x29')][_0xdf69('0x2a')],function(_0x3b97df){return{'name':_0x3b97df[_0xdf69('0x2b')],'type':_0x3b97df[_0xdf69('0x2c')][_0xdf69('0x2d')]};});_0x12aec3[_0xdf69('0x2e')]=_[_0xdf69('0x28')](_0x1b57b3,_0xdf69('0x2f'));_0x12aec3[_0xdf69('0x30')]=_['keys'](_0x301bd2[_0xdf69('0x30')]);_0x12aec3[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x12aec3[_0xdf69('0x2e')],_0x12aec3[_0xdf69('0x30')]);_0x19cf2d['attributes']=_[_0xdf69('0x32')](_0x12aec3['model'],qs[_0xdf69('0x33')](_0x301bd2[_0xdf69('0x30')]['fields']));_0x19cf2d[_0xdf69('0x34')]=_0x19cf2d['attributes'][_0xdf69('0x35')]?_0x19cf2d[_0xdf69('0x34')]:_0x12aec3[_0xdf69('0x2e')];if(!_0x301bd2[_0xdf69('0x30')][_0xdf69('0x36')]('nolimit')){_0x19cf2d[_0xdf69('0x37')]=qs['limit'](_0x301bd2[_0xdf69('0x30')][_0xdf69('0x37')]);_0x19cf2d[_0xdf69('0x1f')]=qs[_0xdf69('0x1f')](_0x301bd2['query'][_0xdf69('0x1f')]);}_0x19cf2d['order']=qs[_0xdf69('0x38')](_0x301bd2['query'][_0xdf69('0x38')]);_0x19cf2d['where']=qs[_0xdf69('0x31')](_[_0xdf69('0x39')](_0x301bd2[_0xdf69('0x30')],_0x12aec3[_0xdf69('0x31')]),_0x1b57b3);if(_0x301bd2[_0xdf69('0x30')]['filter']){_0x19cf2d[_0xdf69('0x3a')]=_[_0xdf69('0x3b')](_0x19cf2d['where'],{'$or':_['map'](_0x1b57b3,function(_0x4ee03c){if(_0x4ee03c['type']!==_0xdf69('0x3c')){var _0x5aff7d={};_0x5aff7d[_0x4ee03c[_0xdf69('0x2f')]]={'$like':'%'+_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3d')]+'%'};return _0x5aff7d;}})});}_0x19cf2d=_[_0xdf69('0x3b')]({},_0x19cf2d,_0x301bd2['options']);var _0x3de096={'where':_0x19cf2d[_0xdf69('0x3a')]};return db[_0xdf69('0x29')]['count'](_0x3de096)[_0xdf69('0x26')](function(_0xdd919d){_0x1b7c16[_0xdf69('0x21')]=_0xdd919d;if(_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3e')]){_0x19cf2d[_0xdf69('0x3f')]=[{'all':!![]}];}return db[_0xdf69('0x29')]['findAll'](_0x19cf2d);})['then'](function(_0x1fc4aa){_0x1b7c16[_0xdf69('0x40')]=_0x1fc4aa;return _0x1b7c16;})[_0xdf69('0x26')](respondWithFilteredResult(_0xd81d0a,_0x19cf2d))[_0xdf69('0x41')](handleError(_0xd81d0a,null));};exports['show']=function(_0x4a972c,_0x5980b1){var _0x5454e1={'raw':!![],'where':{'id':_0x4a972c['params']['id']}},_0x2abc7f={};_0x2abc7f[_0xdf69('0x2e')]=_['keys'](db[_0xdf69('0x29')][_0xdf69('0x2a')]);_0x2abc7f[_0xdf69('0x30')]=_[_0xdf69('0x42')](_0x4a972c[_0xdf69('0x30')]);_0x2abc7f[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x2abc7f[_0xdf69('0x2e')],_0x2abc7f[_0xdf69('0x30')]);_0x5454e1['attributes']=_['intersection'](_0x2abc7f[_0xdf69('0x2e')],qs['fields'](_0x4a972c[_0xdf69('0x30')][_0xdf69('0x33')]));_0x5454e1[_0xdf69('0x34')]=_0x5454e1['attributes'][_0xdf69('0x35')]?_0x5454e1[_0xdf69('0x34')]:_0x2abc7f[_0xdf69('0x2e')];if(_0x4a972c[_0xdf69('0x30')]['includeAll']){_0x5454e1[_0xdf69('0x3f')]=[{'all':!![]}];}_0x5454e1=_[_0xdf69('0x3b')]({},_0x5454e1,_0x4a972c['options']);return db['Cdr'][_0xdf69('0x43')](_0x5454e1)[_0xdf69('0x26')](handleEntityNotFound(_0x5980b1,null))[_0xdf69('0x26')](respondWithResult(_0x5980b1,null))[_0xdf69('0x41')](handleError(_0x5980b1,null));};exports[_0xdf69('0x44')]=function(_0x1b46c6,_0x578eec){return db['Cdr'][_0xdf69('0x44')](_0x1b46c6[_0xdf69('0x45')],{})[_0xdf69('0x26')](respondWithResult(_0x578eec,0xc9))[_0xdf69('0x41')](handleError(_0x578eec,null));};exports['update']=function(_0x4bc70f,_0xb34f76){if(_0x4bc70f[_0xdf69('0x45')]['id']){delete _0x4bc70f[_0xdf69('0x45')]['id'];}return db[_0xdf69('0x29')][_0xdf69('0x43')]({'where':{'id':_0x4bc70f[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0xb34f76,null))[_0xdf69('0x26')](saveUpdates(_0x4bc70f[_0xdf69('0x45')],null))[_0xdf69('0x26')](respondWithResult(_0xb34f76,null))[_0xdf69('0x41')](handleError(_0xb34f76,null));};exports[_0xdf69('0x47')]=function(_0x9a24c9,_0x439b06){return db['Cdr'][_0xdf69('0x43')]({'where':{'id':_0x9a24c9[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0x439b06,null))['then'](removeEntity(_0x439b06,null))[_0xdf69('0x41')](handleError(_0x439b06,null));};exports[_0xdf69('0x48')]=function(_0x15ca48,_0x4abeb7){return db[_0xdf69('0x29')]['describe']()[_0xdf69('0x26')](respondWithResult(_0x4abeb7,null))[_0xdf69('0x41')](handleError(_0x4abeb7,null));}; \ No newline at end of file +var _0xcd59=['includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x2db82d,_0x2576f7){var _0x424948=function(_0x20d583){while(--_0x20d583){_0x2db82d['push'](_0x2db82d['shift']());}};_0x424948(++_0x2576f7);}(_0xcd59,0x14b));var _0x9cd5=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xcd59[_0x919445];return _0x511b3e;};'use strict';var emlformat=require(_0x9cd5('0x0'));var rimraf=require(_0x9cd5('0x1'));var zipdir=require(_0x9cd5('0x2'));var jsonpatch=require(_0x9cd5('0x3'));var rp=require(_0x9cd5('0x4'));var moment=require(_0x9cd5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cd5('0x6'));var util=require(_0x9cd5('0x7'));var path=require(_0x9cd5('0x8'));var sox=require(_0x9cd5('0x9'));var csv=require(_0x9cd5('0xa'));var ejs=require(_0x9cd5('0xb'));var fs=require('fs');var fs_extra=require(_0x9cd5('0xc'));var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xa'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9cf1,_0x172e29){_0x172e29=_0x172e29||0xcc;return function(_0x44518d){if(_0x44518d){return _0x2c9cf1[_0x9cd5('0x1b')](_0x172e29);}return _0x2c9cf1[_0x9cd5('0x1c')](_0x172e29)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x52698b,_0x15b639){_0x15b639=_0x15b639||0xc8;return function(_0x1445c0){if(_0x1445c0){return _0x52698b[_0x9cd5('0x1c')](_0x15b639)['json'](_0x1445c0);}};}function respondWithFilteredResult(_0x541cb8,_0x5c4f3d){return function(_0x258305){if(_0x258305){var _0x1ea3f7=typeof _0x5c4f3d['offset']===_0x9cd5('0x1e')&&typeof _0x5c4f3d[_0x9cd5('0x1f')]===_0x9cd5('0x1e');var _0x57b986=_0x258305[_0x9cd5('0x20')];var _0x2d1863=_0x1ea3f7?0x0:_0x5c4f3d[_0x9cd5('0x21')];var _0x3a6f01=_0x1ea3f7?_0x258305[_0x9cd5('0x20')]:_0x5c4f3d[_0x9cd5('0x21')]+_0x5c4f3d['limit'];var _0x37ea13;if(_0x3a6f01>=_0x57b986){_0x3a6f01=_0x57b986;_0x37ea13=0xc8;}else{_0x37ea13=0xce;}_0x541cb8[_0x9cd5('0x1c')](_0x37ea13);return _0x541cb8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x2d1863+'-'+_0x3a6f01+'/'+_0x57b986)[_0x9cd5('0x24')](_0x258305);}return null;};}function patchUpdates(_0x4ed8b9){return function(_0x16c4e9){try{jsonpatch[_0x9cd5('0x25')](_0x16c4e9,_0x4ed8b9,!![]);}catch(_0x3f1f5c){return BPromise[_0x9cd5('0x26')](_0x3f1f5c);}return _0x16c4e9[_0x9cd5('0x27')]();};}function saveUpdates(_0x1185d7,_0x1cf603){return function(_0x2238ec){if(_0x2238ec){return _0x2238ec[_0x9cd5('0x28')](_0x1185d7)['then'](function(_0x297f0e){return _0x297f0e;});}return null;};}function removeEntity(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(_0x43f47d){return _0x43f47d['destroy']()[_0x9cd5('0x29')](function(){_0xba8ee9[_0x9cd5('0x1c')](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xe36f86,_0x297776){return function(_0x4509e7){if(!_0x4509e7){_0xe36f86[_0x9cd5('0x1b')](0x194);}return _0x4509e7;};}function handleError(_0x4a245f,_0x1dcb6f){_0x1dcb6f=_0x1dcb6f||0x1f4;return function(_0x64a1c4){logger[_0x9cd5('0x2a')](_0x64a1c4['stack']);if(_0x64a1c4['name']){delete _0x64a1c4[_0x9cd5('0x2b')];}_0x4a245f['status'](_0x1dcb6f)['send'](_0x64a1c4);};}exports[_0x9cd5('0x2c')]=function(_0x2a20d2,_0x13e0d3){var _0x5184b9={},_0x40461a={},_0xc0104b={'count':0x0,'rows':[]};var _0x27e1fd=_[_0x9cd5('0x2d')](db[_0x9cd5('0x2e')][_0x9cd5('0x2f')],function(_0x1dbddc){return{'name':_0x1dbddc[_0x9cd5('0x30')],'type':_0x1dbddc[_0x9cd5('0x31')][_0x9cd5('0x32')]};});_0x40461a[_0x9cd5('0x33')]=_[_0x9cd5('0x2d')](_0x27e1fd,_0x9cd5('0x2b'));_0x40461a[_0x9cd5('0x34')]=_['keys'](_0x2a20d2[_0x9cd5('0x34')]);_0x40461a[_0x9cd5('0x35')]=_['intersection'](_0x40461a['model'],_0x40461a[_0x9cd5('0x34')]);_0x5184b9[_0x9cd5('0x36')]=_['intersection'](_0x40461a[_0x9cd5('0x33')],qs['fields'](_0x2a20d2['query'][_0x9cd5('0x37')]));_0x5184b9[_0x9cd5('0x36')]=_0x5184b9[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x5184b9['attributes']:_0x40461a[_0x9cd5('0x33')];if(!_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x39')]('nolimit')){_0x5184b9[_0x9cd5('0x1f')]=qs[_0x9cd5('0x1f')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x1f')]);_0x5184b9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x21')]);}_0x5184b9[_0x9cd5('0x3a')]=qs[_0x9cd5('0x3b')](_0x2a20d2[_0x9cd5('0x34')]['sort']);_0x5184b9[_0x9cd5('0x3c')]=qs['filters'](_['pick'](_0x2a20d2[_0x9cd5('0x34')],_0x40461a[_0x9cd5('0x35')]),_0x27e1fd);if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]){_0x5184b9['where']=_[_0x9cd5('0x3e')](_0x5184b9[_0x9cd5('0x3c')],{'$or':_[_0x9cd5('0x2d')](_0x27e1fd,function(_0x458a6a){if(_0x458a6a['type']!==_0x9cd5('0x3f')){var _0x3f50de={};_0x3f50de[_0x458a6a[_0x9cd5('0x2b')]]={'$like':'%'+_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]+'%'};return _0x3f50de;}})});}_0x5184b9=_[_0x9cd5('0x3e')]({},_0x5184b9,_0x2a20d2['options']);var _0x26cf61={'where':_0x5184b9[_0x9cd5('0x3c')]};return db[_0x9cd5('0x2e')][_0x9cd5('0x20')](_0x26cf61)[_0x9cd5('0x29')](function(_0x4182bd){_0xc0104b[_0x9cd5('0x20')]=_0x4182bd;if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x5184b9[_0x9cd5('0x41')]=[{'all':!![]}];}return db[_0x9cd5('0x2e')][_0x9cd5('0x42')](_0x5184b9);})[_0x9cd5('0x29')](function(_0xa12319){_0xc0104b[_0x9cd5('0x43')]=_0xa12319;return _0xc0104b;})[_0x9cd5('0x29')](respondWithFilteredResult(_0x13e0d3,_0x5184b9))[_0x9cd5('0x44')](handleError(_0x13e0d3,null));};exports[_0x9cd5('0x45')]=function(_0x4ba72c,_0x13d4b8){var _0x58ae2e={'raw':!![],'where':{'id':_0x4ba72c[_0x9cd5('0x46')]['id']}},_0x427d78={};_0x427d78[_0x9cd5('0x33')]=_[_0x9cd5('0x47')](db[_0x9cd5('0x2e')]['rawAttributes']);_0x427d78[_0x9cd5('0x34')]=_[_0x9cd5('0x47')](_0x4ba72c[_0x9cd5('0x34')]);_0x427d78['filters']=_[_0x9cd5('0x48')](_0x427d78[_0x9cd5('0x33')],_0x427d78[_0x9cd5('0x34')]);_0x58ae2e[_0x9cd5('0x36')]=_['intersection'](_0x427d78[_0x9cd5('0x33')],qs[_0x9cd5('0x37')](_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x37')]));_0x58ae2e[_0x9cd5('0x36')]=_0x58ae2e[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x58ae2e[_0x9cd5('0x36')]:_0x427d78[_0x9cd5('0x33')];if(_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x58ae2e[_0x9cd5('0x41')]=[{'all':!![]}];}_0x58ae2e=_[_0x9cd5('0x3e')]({},_0x58ae2e,_0x4ba72c[_0x9cd5('0x49')]);return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')](_0x58ae2e)[_0x9cd5('0x29')](handleEntityNotFound(_0x13d4b8,null))[_0x9cd5('0x29')](respondWithResult(_0x13d4b8,null))['catch'](handleError(_0x13d4b8,null));};exports[_0x9cd5('0x4b')]=function(_0x1c581a,_0x3fead7){return db[_0x9cd5('0x2e')]['create'](_0x1c581a[_0x9cd5('0x4c')],{})[_0x9cd5('0x29')](respondWithResult(_0x3fead7,0xc9))['catch'](handleError(_0x3fead7,null));};exports[_0x9cd5('0x28')]=function(_0x155652,_0x152b17){if(_0x155652[_0x9cd5('0x4c')]['id']){delete _0x155652[_0x9cd5('0x4c')]['id'];}return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')]({'where':{'id':_0x155652[_0x9cd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x152b17,null))['then'](saveUpdates(_0x155652[_0x9cd5('0x4c')],null))[_0x9cd5('0x29')](respondWithResult(_0x152b17,null))[_0x9cd5('0x44')](handleError(_0x152b17,null));};exports[_0x9cd5('0x4d')]=function(_0x5a933a,_0xf6e17b){return db['Cdr']['find']({'where':{'id':_0x5a933a[_0x9cd5('0x46')]['id']}})[_0x9cd5('0x29')](handleEntityNotFound(_0xf6e17b,null))[_0x9cd5('0x29')](removeEntity(_0xf6e17b,null))['catch'](handleError(_0xf6e17b,null));};exports[_0x9cd5('0x4e')]=function(_0x30c80f,_0x310e4a){return db[_0x9cd5('0x2e')][_0x9cd5('0x4e')]()[_0x9cd5('0x29')](respondWithResult(_0x310e4a,null))['catch'](handleError(_0x310e4a,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c54a876..21928bc 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(_0x1fe06f,_0x160669){var _0x500880=function(_0x4ba843){while(--_0x4ba843){_0x1fe06f['push'](_0x1fe06f['shift']());}};_0x500880(++_0x160669);}(_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(_0x3d3690,_0x5c3131){var _0x5ea78b=function(_0x53ce9e){while(--_0x53ce9e){_0x3d3690['push'](_0x3d3690['shift']());}};_0x5ea78b(++_0x5c3131);}(_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 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 0cd546a..df9f894 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 _0xeb87=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3d40b8,_0x4dce8e){var _0x57fc0d=function(_0x3134fe){while(--_0x3134fe){_0x3d40b8['push'](_0x3d40b8['shift']());}};_0x57fc0d(++_0x4dce8e);}(_0xeb87,0x195));var _0x7eb8=function(_0x50199c,_0x5bd464){_0x50199c=_0x50199c-0x0;var _0x358438=_0xeb87[_0x50199c];return _0x358438;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7eb8('0x0'));var BPromise=require(_0x7eb8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eb8('0x2'));var db=require(_0x7eb8('0x3'))['db'];var utils=require(_0x7eb8('0x4'));var logger=require(_0x7eb8('0x5'))(_0x7eb8('0x6'));var config=require(_0x7eb8('0x7'));var jayson=require(_0x7eb8('0x8'));var client=jayson[_0x7eb8('0x9')][_0x7eb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6915,_0x48c092,_0x545f6d){return new BPromise(function(_0x3858bc,_0x28b2a4){return client[_0x7eb8('0xb')](_0x4e6915,_0x545f6d)[_0x7eb8('0xc')](function(_0xfe16a7){logger['info'](_0x7eb8('0xd'),_0x48c092,_0x7eb8('0xe'));logger[_0x7eb8('0xf')](_0x7eb8('0x10'),_0x48c092,_0x7eb8('0xe'),JSON[_0x7eb8('0x11')](_0xfe16a7));if(_0xfe16a7['error']){if(_0xfe16a7[_0x7eb8('0x12')][_0x7eb8('0x13')]===0x1f4){logger[_0x7eb8('0x12')](_0x7eb8('0xd'),_0x48c092,_0xfe16a7['error'][_0x7eb8('0x14')]);return _0x28b2a4(_0xfe16a7[_0x7eb8('0x12')][_0x7eb8('0x14')]);}logger[_0x7eb8('0x12')]('Cdr,\x20%s,\x20%s',_0x48c092,_0xfe16a7[_0x7eb8('0x12')][_0x7eb8('0x14')]);return _0x3858bc(_0xfe16a7[_0x7eb8('0x12')][_0x7eb8('0x14')]);}else{logger['info'](_0x7eb8('0xd'),_0x48c092,'request\x20sent');_0x3858bc(_0xfe16a7['result']['message']);}})[_0x7eb8('0x15')](function(_0x3d0491){logger[_0x7eb8('0x12')](_0x7eb8('0xd'),_0x48c092,_0x3d0491);_0x28b2a4(_0x3d0491);});});} \ No newline at end of file +var _0xf1df=['jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5169ca,_0x2356e5){var _0x13f00d=function(_0xd31006){while(--_0xd31006){_0x5169ca['push'](_0x5169ca['shift']());}};_0x13f00d(++_0x2356e5);}(_0xf1df,0x186));var _0xff1d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf1df[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xff1d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xff1d('0x1'));var rs=require(_0xff1d('0x2'));var fs=require('fs');var Redis=require(_0xff1d('0x3'));var db=require(_0xff1d('0x4'))['db'];var utils=require(_0xff1d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xff1d('0x6'));var client=jayson[_0xff1d('0x7')][_0xff1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd42abf,_0x4a01d9,_0x2f6af8){return new BPromise(function(_0x4843ce,_0x43b6d5){return client[_0xff1d('0x9')](_0xd42abf,_0x2f6af8)[_0xff1d('0xa')](function(_0x20ad8c){logger[_0xff1d('0xb')](_0xff1d('0xc'),_0x4a01d9,_0xff1d('0xd'));logger[_0xff1d('0xe')](_0xff1d('0xf'),_0x4a01d9,_0xff1d('0xd'),JSON[_0xff1d('0x10')](_0x20ad8c));if(_0x20ad8c['error']){if(_0x20ad8c['error'][_0xff1d('0x11')]===0x1f4){logger[_0xff1d('0x12')]('Cdr,\x20%s,\x20%s',_0x4a01d9,_0x20ad8c['error'][_0xff1d('0x13')]);return _0x43b6d5(_0x20ad8c[_0xff1d('0x12')][_0xff1d('0x13')]);}logger[_0xff1d('0x12')](_0xff1d('0xc'),_0x4a01d9,_0x20ad8c[_0xff1d('0x12')]['message']);return _0x4843ce(_0x20ad8c[_0xff1d('0x12')][_0xff1d('0x13')]);}else{logger[_0xff1d('0xb')](_0xff1d('0xc'),_0x4a01d9,_0xff1d('0xd'));_0x4843ce(_0x20ad8c[_0xff1d('0x14')][_0xff1d('0x13')]);}})[_0xff1d('0x15')](function(_0x3cfcb7){logger['error'](_0xff1d('0xc'),_0x4a01d9,_0x3cfcb7);_0x43b6d5(_0x3cfcb7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 83a4e3e..a2f54cb 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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 _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(_0x2b3d1f,_0x40c8b6){var _0x187469=function(_0x23f359){while(--_0x23f359){_0x2b3d1f['push'](_0x2b3d1f['shift']());}};_0x187469(++_0x40c8b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 8ae1c95..a361f60 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 _0x34e2=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x34e2,0x105));var _0x234e=function(_0x135deb,_0x6292e){_0x135deb=_0x135deb-0x0;var _0x31f7bd=_0x34e2[_0x135deb];return _0x31f7bd;};'use strict';var Sequelize=require(_0x234e('0x0'));module[_0x234e('0x1')]={'priority':{'type':Sequelize[_0x234e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x234e('0x3')],'allowNull':![],'defaultValue':_0x234e('0x4')},'appdata':{'type':Sequelize[_0x234e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x234e('0x3')],'defaultValue':_0x234e('0x6')}}; \ No newline at end of file +var _0xeddb=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xeddb,0x9a));var _0xbedd=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0xeddb[_0x323430];return _0x9eecd1;};'use strict';var Sequelize=require(_0xbedd('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbedd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbedd('0x2')],'allowNull':![],'defaultValue':_0xbedd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbedd('0x2')],'defaultValue':_0xbedd('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 4369262..5151f21 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 _0xd8cc=['end','json','undefined','limit','count','offset','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','includeAll','include','options','find','catch','body','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','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'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0xd8cc[_0x459423];return _0x42ed14;};'use strict';var emlformat=require(_0xcd8c('0x0'));var rimraf=require(_0xcd8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd8c('0x2'));var moment=require(_0xcd8c('0x3'));var BPromise=require(_0xcd8c('0x4'));var Mustache=require(_0xcd8c('0x5'));var util=require('util');var path=require(_0xcd8c('0x6'));var sox=require(_0xcd8c('0x7'));var csv=require('to-csv');var ejs=require(_0xcd8c('0x8'));var fs=require('fs');var fs_extra=require(_0xcd8c('0x9'));var _=require('lodash');var squel=require(_0xcd8c('0xa'));var crypto=require(_0xcd8c('0xb'));var jsforce=require(_0xcd8c('0xc'));var deskjs=require(_0xcd8c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcd8c('0xe'));var Papa=require(_0xcd8c('0xf'));var Redis=require(_0xcd8c('0x10'));var authService=require(_0xcd8c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcd8c('0x12'));var hardwareService=require(_0xcd8c('0x13'));var logger=require(_0xcd8c('0x14'))(_0xcd8c('0x15'));var utils=require(_0xcd8c('0x16'));var config=require(_0xcd8c('0x17'));var licenseUtil=require(_0xcd8c('0x18'));var db=require(_0xcd8c('0x19'))['db'];function respondWithStatusCode(_0x338bd6,_0x5a55f4){_0x5a55f4=_0x5a55f4||0xcc;return function(_0x1d695b){if(_0x1d695b){return _0x338bd6['sendStatus'](_0x5a55f4);}return _0x338bd6[_0xcd8c('0x1a')](_0x5a55f4)[_0xcd8c('0x1b')]();};}function respondWithResult(_0x3b90be,_0x5a41e0){_0x5a41e0=_0x5a41e0||0xc8;return function(_0xf0cb62){if(_0xf0cb62){return _0x3b90be[_0xcd8c('0x1a')](_0x5a41e0)[_0xcd8c('0x1c')](_0xf0cb62);}};}function respondWithFilteredResult(_0xffcb8d,_0x8e98d6){return function(_0x2df9d1){if(_0x2df9d1){var _0x13058b=typeof _0x8e98d6['offset']===_0xcd8c('0x1d')&&typeof _0x8e98d6[_0xcd8c('0x1e')]===_0xcd8c('0x1d');var _0x2f1180=_0x2df9d1[_0xcd8c('0x1f')];var _0x4a6652=_0x13058b?0x0:_0x8e98d6[_0xcd8c('0x20')];var _0x120d0d=_0x13058b?_0x2df9d1[_0xcd8c('0x1f')]:_0x8e98d6[_0xcd8c('0x20')]+_0x8e98d6[_0xcd8c('0x1e')];var _0x387ff2;if(_0x120d0d>=_0x2f1180){_0x120d0d=_0x2f1180;_0x387ff2=0xc8;}else{_0x387ff2=0xce;}_0xffcb8d[_0xcd8c('0x1a')](_0x387ff2);return _0xffcb8d['set'](_0xcd8c('0x21'),_0x4a6652+'-'+_0x120d0d+'/'+_0x2f1180)[_0xcd8c('0x1c')](_0x2df9d1);}return null;};}function patchUpdates(_0x5008d3){return function(_0x5330ea){try{jsonpatch['apply'](_0x5330ea,_0x5008d3,!![]);}catch(_0x506d64){return BPromise[_0xcd8c('0x22')](_0x506d64);}return _0x5330ea['save']();};}function saveUpdates(_0x534257,_0x59297d){return function(_0x4f12b8){if(_0x4f12b8){return _0x4f12b8['update'](_0x534257)[_0xcd8c('0x23')](function(_0x3c60ff){return _0x3c60ff;});}return null;};}function removeEntity(_0x2d7718,_0x5368df){return function(_0x2e5711){if(_0x2e5711){return _0x2e5711[_0xcd8c('0x24')]()[_0xcd8c('0x23')](function(){_0x2d7718[_0xcd8c('0x1a')](0xcc)[_0xcd8c('0x1b')]();});}};}function handleEntityNotFound(_0x77ca04,_0x5caaa0){return function(_0x56a54c){if(!_0x56a54c){_0x77ca04[_0xcd8c('0x25')](0x194);}return _0x56a54c;};}function handleError(_0x1e1e00,_0xfc6ca5){_0xfc6ca5=_0xfc6ca5||0x1f4;return function(_0x4c67c1){logger[_0xcd8c('0x26')](_0x4c67c1[_0xcd8c('0x27')]);if(_0x4c67c1['name']){delete _0x4c67c1[_0xcd8c('0x28')];}_0x1e1e00[_0xcd8c('0x1a')](_0xfc6ca5)[_0xcd8c('0x29')](_0x4c67c1);};}exports['show']=function(_0x5193a1,_0x36c342){var _0x5308ec={'raw':!![],'where':{'id':_0x5193a1['params']['id']}},_0x4c772a={};_0x4c772a[_0xcd8c('0x2a')]=_[_0xcd8c('0x2b')](db[_0xcd8c('0x2c')][_0xcd8c('0x2d')]);_0x4c772a[_0xcd8c('0x2e')]=_[_0xcd8c('0x2b')](_0x5193a1[_0xcd8c('0x2e')]);_0x4c772a[_0xcd8c('0x2f')]=_['intersection'](_0x4c772a[_0xcd8c('0x2a')],_0x4c772a[_0xcd8c('0x2e')]);_0x5308ec[_0xcd8c('0x30')]=_['intersection'](_0x4c772a[_0xcd8c('0x2a')],qs[_0xcd8c('0x31')](_0x5193a1['query'][_0xcd8c('0x31')]));_0x5308ec['attributes']=_0x5308ec[_0xcd8c('0x30')]['length']?_0x5308ec['attributes']:_0x4c772a[_0xcd8c('0x2a')];if(_0x5193a1[_0xcd8c('0x2e')][_0xcd8c('0x32')]){_0x5308ec[_0xcd8c('0x33')]=[{'all':!![]}];}_0x5308ec=_['merge']({},_0x5308ec,_0x5193a1[_0xcd8c('0x34')]);return db['ChatApplication'][_0xcd8c('0x35')](_0x5308ec)[_0xcd8c('0x23')](handleEntityNotFound(_0x36c342,null))[_0xcd8c('0x23')](respondWithResult(_0x36c342,null))[_0xcd8c('0x36')](handleError(_0x36c342,null));};exports['update']=function(_0x3f57b0,_0x5bb651){if(_0x3f57b0[_0xcd8c('0x37')]['id']){delete _0x3f57b0['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x3f57b0[_0xcd8c('0x38')]['id']}})['then'](handleEntityNotFound(_0x5bb651,null))['then'](saveUpdates(_0x3f57b0[_0xcd8c('0x37')],null))[_0xcd8c('0x23')](respondWithResult(_0x5bb651,null))[_0xcd8c('0x36')](handleError(_0x5bb651,null));};exports['destroy']=function(_0x1b92bb,_0x19df28){return db[_0xcd8c('0x2c')][_0xcd8c('0x35')]({'where':{'id':_0x1b92bb[_0xcd8c('0x38')]['id']}})[_0xcd8c('0x23')](handleEntityNotFound(_0x19df28,null))[_0xcd8c('0x23')](removeEntity(_0x19df28,null))[_0xcd8c('0x36')](handleError(_0x19df28,null));}; \ No newline at end of file +var _0x8a9a=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','body','destroy','find','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a9a,0x193));var _0xa8a9=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8a9a[_0x550d12];return _0x12103d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8a9('0x0'));var jsonpatch=require(_0xa8a9('0x1'));var rp=require(_0xa8a9('0x2'));var moment=require('moment');var BPromise=require(_0xa8a9('0x3'));var Mustache=require(_0xa8a9('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa8a9('0x5'));var csv=require(_0xa8a9('0x6'));var ejs=require(_0xa8a9('0x7'));var fs=require('fs');var fs_extra=require(_0xa8a9('0x8'));var _=require(_0xa8a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8a9('0xa'));var deskjs=require(_0xa8a9('0xb'));var toCsv=require(_0xa8a9('0x6'));var querystring=require(_0xa8a9('0xc'));var Papa=require(_0xa8a9('0xd'));var Redis=require(_0xa8a9('0xe'));var authService=require(_0xa8a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8a9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8a9('0x11'))('api');var utils=require(_0xa8a9('0x12'));var config=require(_0xa8a9('0x13'));var licenseUtil=require(_0xa8a9('0x14'));var db=require(_0xa8a9('0x15'))['db'];function respondWithStatusCode(_0x3e962a,_0x16d838){_0x16d838=_0x16d838||0xcc;return function(_0x53fbc5){if(_0x53fbc5){return _0x3e962a['sendStatus'](_0x16d838);}return _0x3e962a[_0xa8a9('0x16')](_0x16d838)['end']();};}function respondWithResult(_0x3bb559,_0x34bec9){_0x34bec9=_0x34bec9||0xc8;return function(_0x3a0e08){if(_0x3a0e08){return _0x3bb559[_0xa8a9('0x16')](_0x34bec9)[_0xa8a9('0x17')](_0x3a0e08);}};}function respondWithFilteredResult(_0x4c448c,_0x3593fa){return function(_0x5c2cde){if(_0x5c2cde){var _0x1c7d52=typeof _0x3593fa['offset']===_0xa8a9('0x18')&&typeof _0x3593fa[_0xa8a9('0x19')]==='undefined';var _0x25285c=_0x5c2cde['count'];var _0x2c4fe7=_0x1c7d52?0x0:_0x3593fa[_0xa8a9('0x1a')];var _0xce2084=_0x1c7d52?_0x5c2cde[_0xa8a9('0x1b')]:_0x3593fa['offset']+_0x3593fa['limit'];var _0x34b6d1;if(_0xce2084>=_0x25285c){_0xce2084=_0x25285c;_0x34b6d1=0xc8;}else{_0x34b6d1=0xce;}_0x4c448c['status'](_0x34b6d1);return _0x4c448c[_0xa8a9('0x1c')](_0xa8a9('0x1d'),_0x2c4fe7+'-'+_0xce2084+'/'+_0x25285c)[_0xa8a9('0x17')](_0x5c2cde);}return null;};}function patchUpdates(_0x39384c){return function(_0x126648){try{jsonpatch[_0xa8a9('0x1e')](_0x126648,_0x39384c,!![]);}catch(_0x20381c){return BPromise[_0xa8a9('0x1f')](_0x20381c);}return _0x126648[_0xa8a9('0x20')]();};}function saveUpdates(_0x390011,_0x1cc77a){return function(_0x2fd285){if(_0x2fd285){return _0x2fd285[_0xa8a9('0x21')](_0x390011)['then'](function(_0x481a29){return _0x481a29;});}return null;};}function removeEntity(_0x4343f4,_0xa4c41a){return function(_0x32e784){if(_0x32e784){return _0x32e784['destroy']()[_0xa8a9('0x22')](function(){_0x4343f4[_0xa8a9('0x16')](0xcc)[_0xa8a9('0x23')]();});}};}function handleEntityNotFound(_0x233fe1,_0x488791){return function(_0x20fb5a){if(!_0x20fb5a){_0x233fe1[_0xa8a9('0x24')](0x194);}return _0x20fb5a;};}function handleError(_0x2f7a56,_0x1aef34){_0x1aef34=_0x1aef34||0x1f4;return function(_0x5f0c62){logger['error'](_0x5f0c62[_0xa8a9('0x25')]);if(_0x5f0c62[_0xa8a9('0x26')]){delete _0x5f0c62[_0xa8a9('0x26')];}_0x2f7a56[_0xa8a9('0x16')](_0x1aef34)[_0xa8a9('0x27')](_0x5f0c62);};}exports[_0xa8a9('0x28')]=function(_0x2abeb7,_0x155527){var _0x4c87d4={'raw':!![],'where':{'id':_0x2abeb7[_0xa8a9('0x29')]['id']}},_0x45714a={};_0x45714a[_0xa8a9('0x2a')]=_[_0xa8a9('0x2b')](db[_0xa8a9('0x2c')][_0xa8a9('0x2d')]);_0x45714a[_0xa8a9('0x2e')]=_[_0xa8a9('0x2b')](_0x2abeb7[_0xa8a9('0x2e')]);_0x45714a[_0xa8a9('0x2f')]=_[_0xa8a9('0x30')](_0x45714a[_0xa8a9('0x2a')],_0x45714a[_0xa8a9('0x2e')]);_0x4c87d4[_0xa8a9('0x31')]=_[_0xa8a9('0x30')](_0x45714a[_0xa8a9('0x2a')],qs['fields'](_0x2abeb7[_0xa8a9('0x2e')][_0xa8a9('0x32')]));_0x4c87d4[_0xa8a9('0x31')]=_0x4c87d4[_0xa8a9('0x31')]['length']?_0x4c87d4[_0xa8a9('0x31')]:_0x45714a[_0xa8a9('0x2a')];if(_0x2abeb7['query'][_0xa8a9('0x33')]){_0x4c87d4[_0xa8a9('0x34')]=[{'all':!![]}];}_0x4c87d4=_[_0xa8a9('0x35')]({},_0x4c87d4,_0x2abeb7[_0xa8a9('0x36')]);return db[_0xa8a9('0x2c')]['find'](_0x4c87d4)[_0xa8a9('0x22')](handleEntityNotFound(_0x155527,null))[_0xa8a9('0x22')](respondWithResult(_0x155527,null))[_0xa8a9('0x37')](handleError(_0x155527,null));};exports[_0xa8a9('0x21')]=function(_0x2c09b2,_0x44524d){if(_0x2c09b2['body']['id']){delete _0x2c09b2[_0xa8a9('0x38')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x2c09b2['params']['id']}})['then'](handleEntityNotFound(_0x44524d,null))[_0xa8a9('0x22')](saveUpdates(_0x2c09b2['body'],null))[_0xa8a9('0x22')](respondWithResult(_0x44524d,null))['catch'](handleError(_0x44524d,null));};exports[_0xa8a9('0x39')]=function(_0x15801f,_0xbc61c0){return db[_0xa8a9('0x2c')][_0xa8a9('0x3a')]({'where':{'id':_0x15801f[_0xa8a9('0x29')]['id']}})[_0xa8a9('0x22')](handleEntityNotFound(_0xbc61c0,null))[_0xa8a9('0x22')](removeEntity(_0xbc61c0,null))['catch'](handleError(_0xbc61c0,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 98af7e6..30776b8 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 _0x7c8e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x4e4552,_0xedadb4){var _0x2ee747=function(_0x53d485){while(--_0x53d485){_0x4e4552['push'](_0x4e4552['shift']());}};_0x2ee747(++_0xedadb4);}(_0x7c8e,0x94));var _0xe7c8=function(_0x313532,_0x33e75f){_0x313532=_0x313532-0x0;var _0x44bc16=_0x7c8e[_0x313532];return _0x44bc16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7c8('0x0'))(_0xe7c8('0x1'));var moment=require(_0xe7c8('0x2'));var BPromise=require(_0xe7c8('0x3'));var rp=require(_0xe7c8('0x4'));var fs=require('fs');var path=require(_0xe7c8('0x5'));var rimraf=require(_0xe7c8('0x6'));var config=require(_0xe7c8('0x7'));var attributes=require(_0xe7c8('0x8'));module[_0xe7c8('0x9')]=function(_0x1cd3e5,_0x52ac01){return _0x1cd3e5[_0xe7c8('0xa')](_0xe7c8('0xb'),attributes,{'tableName':_0xe7c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7c8('0xd'),'collate':_0xe7c8('0xe')});}; \ No newline at end of file +var _0x0fc2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1e18a8,_0x4f715f){var _0x21a158=function(_0x21976d){while(--_0x21976d){_0x1e18a8['push'](_0x1e18a8['shift']());}};_0x21a158(++_0x4f715f);}(_0x0fc2,0x6e));var _0x20fc=function(_0x38a642,_0x2cf3dd){_0x38a642=_0x38a642-0x0;var _0x2bda49=_0x0fc2[_0x38a642];return _0x2bda49;};'use strict';var _=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var logger=require(_0x20fc('0x2'))(_0x20fc('0x3'));var moment=require('moment');var BPromise=require(_0x20fc('0x4'));var rp=require(_0x20fc('0x5'));var fs=require('fs');var path=require(_0x20fc('0x6'));var rimraf=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var attributes=require(_0x20fc('0x9'));module[_0x20fc('0xa')]=function(_0x13f2d5,_0x10f6ad){return _0x13f2d5[_0x20fc('0xb')](_0x20fc('0xc'),attributes,{'tableName':_0x20fc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x20fc('0xe'),'collate':_0x20fc('0xf')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b261254..6ee430a 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 _0x8dff=['rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x8dff,0x72));var _0xf8df=function(_0x16b3d7,_0x5d77f9){_0x16b3d7=_0x16b3d7-0x0;var _0x1abeaa=_0x8dff[_0x16b3d7];return _0x1abeaa;};'use strict';var _=require('lodash');var util=require(_0xf8df('0x0'));var moment=require(_0xf8df('0x1'));var BPromise=require(_0xf8df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8df('0x4'));var logger=require(_0xf8df('0x5'))(_0xf8df('0x6'));var config=require(_0xf8df('0x7'));var jayson=require(_0xf8df('0x8'));var client=jayson[_0xf8df('0x9')][_0xf8df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6172,_0x1e89fd,_0x41a64b){return new BPromise(function(_0x14201e,_0x5d8039){return client[_0xf8df('0xb')](_0x4e6172,_0x41a64b)['then'](function(_0x1a0b00){logger[_0xf8df('0xc')](_0xf8df('0xd'),_0x1e89fd,_0xf8df('0xe'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1e89fd,_0xf8df('0xe'),JSON[_0xf8df('0xf')](_0x1a0b00));if(_0x1a0b00[_0xf8df('0x10')]){if(_0x1a0b00['error'][_0xf8df('0x11')]===0x1f4){logger[_0xf8df('0x10')](_0xf8df('0xd'),_0x1e89fd,_0x1a0b00[_0xf8df('0x10')][_0xf8df('0x12')]);return _0x5d8039(_0x1a0b00[_0xf8df('0x10')]['message']);}logger[_0xf8df('0x10')](_0xf8df('0xd'),_0x1e89fd,_0x1a0b00['error']['message']);return _0x14201e(_0x1a0b00[_0xf8df('0x10')][_0xf8df('0x12')]);}else{logger[_0xf8df('0xc')]('ChatApplication,\x20%s,\x20%s',_0x1e89fd,'request\x20sent');_0x14201e(_0x1a0b00['result'][_0xf8df('0x12')]);}})[_0xf8df('0x13')](function(_0x228106){logger['error']('ChatApplication,\x20%s,\x20%s',_0x1e89fd,_0x228106);_0x5d8039(_0x228106);});});} \ No newline at end of file +var _0xfca9=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2bf1fb,_0x10022d){var _0x5e7e68=function(_0x287fbb){while(--_0x287fbb){_0x2bf1fb['push'](_0x2bf1fb['shift']());}};_0x5e7e68(++_0x10022d);}(_0xfca9,0xd8));var _0x9fca=function(_0x5b80dd,_0x233be0){_0x5b80dd=_0x5b80dd-0x0;var _0x1db308=_0xfca9[_0x5b80dd];return _0x1db308;};'use strict';var _=require(_0x9fca('0x0'));var util=require(_0x9fca('0x1'));var moment=require(_0x9fca('0x2'));var BPromise=require(_0x9fca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fca('0x4'));var db=require(_0x9fca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fca('0x6'))(_0x9fca('0x7'));var config=require('../../config/environment');var jayson=require(_0x9fca('0x8'));var client=jayson[_0x9fca('0x9')][_0x9fca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221f35,_0x2e2110,_0x4dbc62){return new BPromise(function(_0x42eb58,_0x284f32){return client['request'](_0x221f35,_0x4dbc62)[_0x9fca('0xb')](function(_0x5dcc7b){logger[_0x9fca('0xc')](_0x9fca('0xd'),_0x2e2110,_0x9fca('0xe'));logger['debug'](_0x9fca('0xf'),_0x2e2110,_0x9fca('0xe'),JSON[_0x9fca('0x10')](_0x5dcc7b));if(_0x5dcc7b[_0x9fca('0x11')]){if(_0x5dcc7b[_0x9fca('0x11')][_0x9fca('0x12')]===0x1f4){logger[_0x9fca('0x11')]('ChatApplication,\x20%s,\x20%s',_0x2e2110,_0x5dcc7b['error'][_0x9fca('0x13')]);return _0x284f32(_0x5dcc7b[_0x9fca('0x11')][_0x9fca('0x13')]);}logger[_0x9fca('0x11')](_0x9fca('0xd'),_0x2e2110,_0x5dcc7b['error'][_0x9fca('0x13')]);return _0x42eb58(_0x5dcc7b['error'][_0x9fca('0x13')]);}else{logger[_0x9fca('0xc')](_0x9fca('0xd'),_0x2e2110,_0x9fca('0xe'));_0x42eb58(_0x5dcc7b[_0x9fca('0x14')]['message']);}})[_0x9fca('0x15')](function(_0x4a7050){logger[_0x9fca('0x11')](_0x9fca('0xd'),_0x2e2110,_0x4a7050);_0x284f32(_0x4a7050);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 49daafe..c60ac4a 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 _0x34a2=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer'];(function(_0x1405e0,_0x505221){var _0x4dcfec=function(_0x457ba6){while(--_0x457ba6){_0x1405e0['push'](_0x1405e0['shift']());}};_0x4dcfec(++_0x505221);}(_0x34a2,0x1cf));var _0x234a=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x34a2[_0x4a5f6c];return _0x281ffd;};'use strict';var multer=require(_0x234a('0x0'));var util=require(_0x234a('0x1'));var path=require(_0x234a('0x2'));var timeout=require('connect-timeout');var express=require(_0x234a('0x3'));var router=express['Router']();var fs_extra=require(_0x234a('0x4'));var auth=require(_0x234a('0x5'));var interaction=require(_0x234a('0x6'));var config=require('../../config/environment');var controller=require(_0x234a('0x7'));router[_0x234a('0x8')](_0x234a('0x9'),auth[_0x234a('0xa')](),controller['show']);router[_0x234a('0xb')](_0x234a('0x9'),auth[_0x234a('0xa')](),controller[_0x234a('0xc')]);router[_0x234a('0xd')](_0x234a('0x9'),auth[_0x234a('0xa')](),controller[_0x234a('0xe')]);module[_0x234a('0xf')]=router; \ No newline at end of file +var _0xbadd=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','/:id','update','delete','exports','multer','util'];(function(_0x35920b,_0xa2169f){var _0x5ce2e1=function(_0x153c94){while(--_0x153c94){_0x35920b['push'](_0x35920b['shift']());}};_0x5ce2e1(++_0xa2169f);}(_0xbadd,0x12a));var _0xdbad=function(_0xf8886b,_0x504891){_0xf8886b=_0xf8886b-0x0;var _0x321bd5=_0xbadd[_0xf8886b];return _0x321bd5;};'use strict';var multer=require(_0xdbad('0x0'));var util=require(_0xdbad('0x1'));var path=require(_0xdbad('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdbad('0x3')]();var fs_extra=require(_0xdbad('0x4'));var auth=require(_0xdbad('0x5'));var interaction=require(_0xdbad('0x6'));var config=require(_0xdbad('0x7'));var controller=require('./chatApplication.controller');router[_0xdbad('0x8')]('/:id',auth[_0xdbad('0x9')](),controller['show']);router[_0xdbad('0xa')](_0xdbad('0xb'),auth['isAuthenticated'](),controller[_0xdbad('0xc')]);router[_0xdbad('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdbad('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c1deb9f..c1d5d33 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 _0x29e8=['exports','STRING','sequelize'];(function(_0x507e23,_0x22987a){var _0x19d05d=function(_0x799b82){while(--_0x799b82){_0x507e23['push'](_0x507e23['shift']());}};_0x19d05d(++_0x22987a);}(_0x29e8,0x116));var _0x829e=function(_0x58c226,_0x58b0e8){_0x58c226=_0x58c226-0x0;var _0x4c608e=_0x29e8[_0x58c226];return _0x4c608e;};'use strict';var Sequelize=require(_0x829e('0x0'));module[_0x829e('0x1')]={'name':{'type':Sequelize[_0x829e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x829e('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x855f=['BOOLEAN','sequelize','STRING'];(function(_0xf27b1,_0x29bae7){var _0x188b0b=function(_0x2f57cc){while(--_0x2f57cc){_0xf27b1['push'](_0xf27b1['shift']());}};_0x188b0b(++_0x29bae7);}(_0x855f,0x145));var _0xf855=function(_0x18f891,_0xbd3c84){_0x18f891=_0x18f891-0x0;var _0x241742=_0x855f[_0x18f891];return _0x241742;};'use strict';var Sequelize=require(_0xf855('0x0'));module['exports']={'name':{'type':Sequelize[_0xf855('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf855('0x1')]},'write':{'type':Sequelize[_0xf855('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ccdfb3c..369e6e4 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 _0xfd71=['params','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','order','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','ChatGroup','rows','catch','show'];(function(_0x341271,_0x234e68){var _0x42afdf=function(_0x4e54c7){while(--_0x4e54c7){_0x341271['push'](_0x341271['shift']());}};_0x42afdf(++_0x234e68);}(_0xfd71,0x13c));var _0x1fd7=function(_0x28bef9,_0x28e8d6){_0x28bef9=_0x28bef9-0x0;var _0x45db81=_0xfd71[_0x28bef9];return _0x45db81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fd7('0x0'));var zipdir=require(_0x1fd7('0x1'));var jsonpatch=require(_0x1fd7('0x2'));var rp=require(_0x1fd7('0x3'));var moment=require(_0x1fd7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1fd7('0x5'));var util=require(_0x1fd7('0x6'));var path=require(_0x1fd7('0x7'));var sox=require(_0x1fd7('0x8'));var csv=require('to-csv');var ejs=require(_0x1fd7('0x9'));var fs=require('fs');var fs_extra=require(_0x1fd7('0xa'));var _=require(_0x1fd7('0xb'));var squel=require(_0x1fd7('0xc'));var crypto=require(_0x1fd7('0xd'));var jsforce=require(_0x1fd7('0xe'));var deskjs=require(_0x1fd7('0xf'));var toCsv=require(_0x1fd7('0x10'));var querystring=require(_0x1fd7('0x11'));var Papa=require(_0x1fd7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1fd7('0x13'));var hardwareService=require(_0x1fd7('0x14'));var logger=require('../../config/logger')(_0x1fd7('0x15'));var utils=require(_0x1fd7('0x16'));var config=require(_0x1fd7('0x17'));var licenseUtil=require(_0x1fd7('0x18'));var db=require(_0x1fd7('0x19'))['db'];config[_0x1fd7('0x1a')]=_[_0x1fd7('0x1b')](config[_0x1fd7('0x1a')],{'host':_0x1fd7('0x1c'),'port':0x18eb});var socket=require(_0x1fd7('0x1d'))(new Redis(config['redis']));require(_0x1fd7('0x1e'))[_0x1fd7('0x1f')](socket);function respondWithStatusCode(_0x5dfaa7,_0x16262f){_0x16262f=_0x16262f||0xcc;return function(_0x421a64){if(_0x421a64){return _0x5dfaa7['sendStatus'](_0x16262f);}return _0x5dfaa7[_0x1fd7('0x20')](_0x16262f)[_0x1fd7('0x21')]();};}function respondWithResult(_0x410ce5,_0xfa4c6e){_0xfa4c6e=_0xfa4c6e||0xc8;return function(_0x38fe27){if(_0x38fe27){return _0x410ce5['status'](_0xfa4c6e)[_0x1fd7('0x22')](_0x38fe27);}};}function respondWithFilteredResult(_0x3bda6a,_0x21bf74){return function(_0x23797c){if(_0x23797c){var _0x47414b=typeof _0x21bf74['offset']==='undefined'&&typeof _0x21bf74[_0x1fd7('0x23')]===_0x1fd7('0x24');var _0x3d0788=_0x23797c[_0x1fd7('0x25')];var _0x37b710=_0x47414b?0x0:_0x21bf74[_0x1fd7('0x26')];var _0x5931b8=_0x47414b?_0x23797c[_0x1fd7('0x25')]:_0x21bf74['offset']+_0x21bf74[_0x1fd7('0x23')];var _0x446e69;if(_0x5931b8>=_0x3d0788){_0x5931b8=_0x3d0788;_0x446e69=0xc8;}else{_0x446e69=0xce;}_0x3bda6a[_0x1fd7('0x20')](_0x446e69);return _0x3bda6a['set'](_0x1fd7('0x27'),_0x37b710+'-'+_0x5931b8+'/'+_0x3d0788)['json'](_0x23797c);}return null;};}function patchUpdates(_0x306199){return function(_0x1b868f){try{jsonpatch[_0x1fd7('0x28')](_0x1b868f,_0x306199,!![]);}catch(_0x251d94){return BPromise[_0x1fd7('0x29')](_0x251d94);}return _0x1b868f['save']();};}function saveUpdates(_0x4f4473,_0x2c8e35){return function(_0x22558b){if(_0x22558b){return _0x22558b[_0x1fd7('0x2a')](_0x4f4473)[_0x1fd7('0x2b')](function(_0x47a442){return _0x47a442;});}return null;};}function removeEntity(_0x41ad6c,_0x47cfdf){return function(_0x478376){if(_0x478376){return _0x478376['destroy']()[_0x1fd7('0x2b')](function(){_0x41ad6c['status'](0xcc)[_0x1fd7('0x21')]();});}};}function handleEntityNotFound(_0x4e8b49,_0x4e07b9){return function(_0x46f4e9){if(!_0x46f4e9){_0x4e8b49[_0x1fd7('0x2c')](0x194);}return _0x46f4e9;};}function handleError(_0x3c3446,_0x5b42bc){_0x5b42bc=_0x5b42bc||0x1f4;return function(_0x1c5903){logger['error'](_0x1c5903[_0x1fd7('0x2d')]);if(_0x1c5903[_0x1fd7('0x2e')]){delete _0x1c5903[_0x1fd7('0x2e')];}_0x3c3446['status'](_0x5b42bc)[_0x1fd7('0x2f')](_0x1c5903);};}exports[_0x1fd7('0x30')]=function(_0x413a05,_0x2c7d4b){var _0x10ab1a={},_0x5d45da={},_0x3fe097={'count':0x0,'rows':[]};var _0x41fd23=_[_0x1fd7('0x31')](db['ChatGroup'][_0x1fd7('0x32')],function(_0x3a5f9a){return{'name':_0x3a5f9a[_0x1fd7('0x33')],'type':_0x3a5f9a[_0x1fd7('0x34')][_0x1fd7('0x35')]};});_0x5d45da[_0x1fd7('0x36')]=_[_0x1fd7('0x31')](_0x41fd23,'name');_0x5d45da[_0x1fd7('0x37')]=_[_0x1fd7('0x38')](_0x413a05[_0x1fd7('0x37')]);_0x5d45da['filters']=_[_0x1fd7('0x39')](_0x5d45da[_0x1fd7('0x36')],_0x5d45da[_0x1fd7('0x37')]);_0x10ab1a[_0x1fd7('0x3a')]=_[_0x1fd7('0x39')](_0x5d45da[_0x1fd7('0x36')],qs[_0x1fd7('0x3b')](_0x413a05['query'][_0x1fd7('0x3b')]));_0x10ab1a[_0x1fd7('0x3a')]=_0x10ab1a[_0x1fd7('0x3a')][_0x1fd7('0x3c')]?_0x10ab1a['attributes']:_0x5d45da[_0x1fd7('0x36')];if(!_0x413a05[_0x1fd7('0x37')][_0x1fd7('0x3d')]('nolimit')){_0x10ab1a[_0x1fd7('0x23')]=qs[_0x1fd7('0x23')](_0x413a05[_0x1fd7('0x37')]['limit']);_0x10ab1a['offset']=qs[_0x1fd7('0x26')](_0x413a05['query']['offset']);}_0x10ab1a['order']=qs[_0x1fd7('0x3e')](_0x413a05['query'][_0x1fd7('0x3e')]);_0x10ab1a[_0x1fd7('0x3f')]=qs[_0x1fd7('0x40')](_[_0x1fd7('0x41')](_0x413a05[_0x1fd7('0x37')],_0x5d45da[_0x1fd7('0x40')]),_0x41fd23);if(_0x413a05[_0x1fd7('0x37')][_0x1fd7('0x42')]){_0x10ab1a[_0x1fd7('0x3f')]=_[_0x1fd7('0x43')](_0x10ab1a[_0x1fd7('0x3f')],{'$or':_[_0x1fd7('0x31')](_0x41fd23,function(_0xc524a6){if(_0xc524a6[_0x1fd7('0x34')]!==_0x1fd7('0x44')){var _0x1f11fc={};_0x1f11fc[_0xc524a6[_0x1fd7('0x2e')]]={'$like':'%'+_0x413a05[_0x1fd7('0x37')][_0x1fd7('0x42')]+'%'};return _0x1f11fc;}})});}_0x10ab1a=_['merge']({},_0x10ab1a,_0x413a05[_0x1fd7('0x45')]);var _0x13488f={'where':_0x10ab1a[_0x1fd7('0x3f')]};return db['ChatGroup'][_0x1fd7('0x25')](_0x13488f)['then'](function(_0xc393bb){_0x3fe097[_0x1fd7('0x25')]=_0xc393bb;if(_0x413a05['query'][_0x1fd7('0x46')]){_0x10ab1a[_0x1fd7('0x47')]=[{'all':!![]}];}return db[_0x1fd7('0x48')]['findAll'](_0x10ab1a);})[_0x1fd7('0x2b')](function(_0x4b762e){_0x3fe097[_0x1fd7('0x49')]=_0x4b762e;return _0x3fe097;})['then'](respondWithFilteredResult(_0x2c7d4b,_0x10ab1a))[_0x1fd7('0x4a')](handleError(_0x2c7d4b,null));};exports[_0x1fd7('0x4b')]=function(_0x4b765b,_0x504e10){var _0x1aedc6={'raw':!![],'where':{'id':_0x4b765b[_0x1fd7('0x4c')]['id']}},_0x20080b={};_0x20080b['model']=_[_0x1fd7('0x38')](db[_0x1fd7('0x48')]['rawAttributes']);_0x20080b[_0x1fd7('0x37')]=_['keys'](_0x4b765b[_0x1fd7('0x37')]);_0x20080b[_0x1fd7('0x40')]=_[_0x1fd7('0x39')](_0x20080b[_0x1fd7('0x36')],_0x20080b[_0x1fd7('0x37')]);_0x1aedc6['attributes']=_[_0x1fd7('0x39')](_0x20080b['model'],qs[_0x1fd7('0x3b')](_0x4b765b[_0x1fd7('0x37')][_0x1fd7('0x3b')]));_0x1aedc6[_0x1fd7('0x3a')]=_0x1aedc6[_0x1fd7('0x3a')][_0x1fd7('0x3c')]?_0x1aedc6[_0x1fd7('0x3a')]:_0x20080b[_0x1fd7('0x36')];if(_0x4b765b['query'][_0x1fd7('0x46')]){_0x1aedc6[_0x1fd7('0x47')]=[{'all':!![]}];}_0x1aedc6=_[_0x1fd7('0x43')]({},_0x1aedc6,_0x4b765b[_0x1fd7('0x45')]);return db[_0x1fd7('0x48')][_0x1fd7('0x4d')](_0x1aedc6)[_0x1fd7('0x2b')](handleEntityNotFound(_0x504e10,null))[_0x1fd7('0x2b')](respondWithResult(_0x504e10,null))['catch'](handleError(_0x504e10,null));};exports[_0x1fd7('0x4e')]=function(_0x45eaed,_0x30051e){return db['ChatGroup'][_0x1fd7('0x4e')](_0x45eaed[_0x1fd7('0x4f')],{})[_0x1fd7('0x2b')](respondWithResult(_0x30051e,0xc9))['catch'](handleError(_0x30051e,null));};exports[_0x1fd7('0x2a')]=function(_0x39f5ce,_0x5a9b61){if(_0x39f5ce['body']['id']){delete _0x39f5ce[_0x1fd7('0x4f')]['id'];}return db[_0x1fd7('0x48')]['find']({'where':{'id':_0x39f5ce['params']['id']}})['then'](handleEntityNotFound(_0x5a9b61,null))[_0x1fd7('0x2b')](saveUpdates(_0x39f5ce[_0x1fd7('0x4f')],null))[_0x1fd7('0x2b')](respondWithResult(_0x5a9b61,null))['catch'](handleError(_0x5a9b61,null));};exports[_0x1fd7('0x50')]=function(_0x1a7b8b,_0xcaea2d){return db[_0x1fd7('0x48')][_0x1fd7('0x4d')]({'where':{'id':_0x1a7b8b['params']['id']}})[_0x1fd7('0x2b')](handleEntityNotFound(_0xcaea2d,null))[_0x1fd7('0x2b')](removeEntity(_0xcaea2d,null))['catch'](handleError(_0xcaea2d,null));};exports[_0x1fd7('0x51')]=function(_0x2cee2c,_0x1e044b){return db['ChatGroup'][_0x1fd7('0x51')]()['then'](respondWithResult(_0x1e044b,null))[_0x1fd7('0x4a')](handleError(_0x1e044b,null));};exports[_0x1fd7('0x52')]=function(_0x402062,_0x4765ed,_0x3c624e){return db[_0x1fd7('0x53')][_0x1fd7('0x25')]({'where':{'ChatGroupId':_0x402062[_0x1fd7('0x4c')]['id'],'ToId':_0x402062[_0x1fd7('0x54')]['id'],'read':![]}})[_0x1fd7('0x2b')](function(_0x536665){return{'id':_[_0x1fd7('0x55')](_0x402062[_0x1fd7('0x4c')]['id']),'count':_0x536665};})[_0x1fd7('0x2b')](respondWithResult(_0x4765ed,null))[_0x1fd7('0x4a')](handleError(_0x4765ed,null));};exports['addMembers']=function(_0x53c749,_0x30a96b,_0xc6b3ac){return db[_0x1fd7('0x48')]['find']({'where':{'id':_0x53c749[_0x1fd7('0x4c')]['id']}})[_0x1fd7('0x2b')](handleEntityNotFound(_0x30a96b,null))[_0x1fd7('0x2b')](function(_0x23984e){if(_0x23984e){return _0x23984e[_0x1fd7('0x56')](_0x53c749[_0x1fd7('0x4f')][_0x1fd7('0x57')],_[_0x1fd7('0x58')](_0x53c749['body'],[_0x1fd7('0x57'),'id'])||{});}})['then'](respondWithResult(_0x30a96b,null))[_0x1fd7('0x4a')](handleError(_0x30a96b,null));};exports[_0x1fd7('0x59')]=function(_0x3d140b,_0x33f804,_0x3d65b8){var _0x215b22={};var _0x5ae1c7={};var _0x4ee69a;var _0x1001b8;return db['ChatGroup']['findOne']({'where':{'id':_0x3d140b[_0x1fd7('0x4c')]['id']}})[_0x1fd7('0x2b')](handleEntityNotFound(_0x33f804,null))[_0x1fd7('0x2b')](function(_0x7f1849){if(_0x7f1849){_0x4ee69a=_0x7f1849;_0x5ae1c7[_0x1fd7('0x36')]=_[_0x1fd7('0x38')](db['User'][_0x1fd7('0x32')]);_0x5ae1c7[_0x1fd7('0x37')]=_[_0x1fd7('0x38')](_0x3d140b[_0x1fd7('0x37')]);_0x5ae1c7[_0x1fd7('0x40')]=_[_0x1fd7('0x39')](_0x5ae1c7['model'],_0x5ae1c7['query']);_0x215b22['attributes']=_[_0x1fd7('0x39')](_0x5ae1c7[_0x1fd7('0x36')],qs[_0x1fd7('0x3b')](_0x3d140b[_0x1fd7('0x37')]['fields']));_0x215b22[_0x1fd7('0x3a')]=_0x215b22['attributes'][_0x1fd7('0x3c')]?_0x215b22[_0x1fd7('0x3a')]:_0x5ae1c7[_0x1fd7('0x36')];_0x215b22['order']=qs[_0x1fd7('0x3e')](_0x3d140b['query'][_0x1fd7('0x3e')]);_0x215b22['where']=qs[_0x1fd7('0x40')](_['pick'](_0x3d140b[_0x1fd7('0x37')],_0x5ae1c7[_0x1fd7('0x40')]));if(_0x3d140b[_0x1fd7('0x37')][_0x1fd7('0x42')]){_0x215b22[_0x1fd7('0x3f')]=_[_0x1fd7('0x43')](_0x215b22[_0x1fd7('0x3f')],{'$or':_[_0x1fd7('0x31')](_0x215b22[_0x1fd7('0x3a')],function(_0x5fb61f){var _0x1363ca={};_0x1363ca[_0x5fb61f]={'$like':'%'+_0x3d140b[_0x1fd7('0x37')]['filter']+'%'};return _0x1363ca;})});}_0x215b22=_['merge']({},_0x215b22,_0x3d140b['options']);return _0x4ee69a['getMembers'](_0x215b22);}})['then'](function(_0x13d30c){if(_0x13d30c){_0x1001b8=_0x13d30c[_0x1fd7('0x3c')];if(!_0x3d140b[_0x1fd7('0x37')]['hasOwnProperty']('nolimit')){_0x215b22[_0x1fd7('0x23')]=qs[_0x1fd7('0x23')](_0x3d140b['query']['limit']);_0x215b22[_0x1fd7('0x26')]=qs['offset'](_0x3d140b['query'][_0x1fd7('0x26')]);}return _0x4ee69a[_0x1fd7('0x59')](_0x215b22);}})[_0x1fd7('0x2b')](function(_0x3562b5){if(_0x3562b5){return _0x3562b5?{'count':_0x1001b8,'rows':_0x3562b5}:null;}})[_0x1fd7('0x2b')](respondWithResult(_0x33f804,null))[_0x1fd7('0x4a')](handleError(_0x33f804,null));};exports[_0x1fd7('0x5a')]=function(_0xc998c9,_0x9592bf,_0x582dc5){return db['ChatGroup'][_0x1fd7('0x4d')]({'where':{'id':_0xc998c9['params']['id']}})[_0x1fd7('0x2b')](handleEntityNotFound(_0x9592bf,null))[_0x1fd7('0x2b')](function(_0x1b078b){if(_0x1b078b){return _0x1b078b[_0x1fd7('0x5a')](_0xc998c9[_0x1fd7('0x37')][_0x1fd7('0x57')]);}})['then'](respondWithStatusCode(_0x9592bf,null))[_0x1fd7('0x4a')](handleError(_0x9592bf,null));};exports[_0x1fd7('0x5b')]=function(_0x170979,_0x88cf13,_0xa1b151){if(_0x170979[_0x1fd7('0x4f')]['id']){delete _0x170979[_0x1fd7('0x4f')]['id'];}return db[_0x1fd7('0x48')][_0x1fd7('0x4d')]({'where':{'id':_0x170979[_0x1fd7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x88cf13,null))['then'](function(_0x3de4d2){if(_0x3de4d2){_0x170979[_0x1fd7('0x4f')][_0x1fd7('0x5c')]=_0x3de4d2['id'];return db[_0x1fd7('0x53')]['create'](_0x170979[_0x1fd7('0x4f')]);}})[_0x1fd7('0x2b')](respondWithResult(_0x88cf13,null))['catch'](handleError(_0x88cf13,null));};exports[_0x1fd7('0x5d')]=function(_0x3976fc,_0x2d9c92,_0xd22941){var _0x355018={};var _0x5d2260={};var _0x35b9a6;var _0x12e64f;return db[_0x1fd7('0x48')]['findOne']({'where':{'id':_0x3976fc[_0x1fd7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d9c92,null))[_0x1fd7('0x2b')](function(_0x1afe02){if(_0x1afe02){_0x35b9a6=_0x1afe02;_0x5d2260['model']=_[_0x1fd7('0x38')](db[_0x1fd7('0x53')]['rawAttributes']);_0x5d2260[_0x1fd7('0x37')]=_[_0x1fd7('0x38')](_0x3976fc['query']);_0x5d2260[_0x1fd7('0x40')]=_[_0x1fd7('0x39')](_0x5d2260[_0x1fd7('0x36')],_0x5d2260[_0x1fd7('0x37')]);_0x355018[_0x1fd7('0x3a')]=_[_0x1fd7('0x39')](_0x5d2260[_0x1fd7('0x36')],qs[_0x1fd7('0x3b')](_0x3976fc[_0x1fd7('0x37')]['fields']));_0x355018[_0x1fd7('0x3a')]=_0x355018[_0x1fd7('0x3a')]['length']?_0x355018['attributes']:_0x5d2260[_0x1fd7('0x36')];_0x355018[_0x1fd7('0x5e')]=qs[_0x1fd7('0x3e')](_0x3976fc[_0x1fd7('0x37')]['sort']);_0x355018[_0x1fd7('0x3f')]=qs[_0x1fd7('0x40')](_[_0x1fd7('0x41')](_0x3976fc[_0x1fd7('0x37')],_0x5d2260[_0x1fd7('0x40')]));if(_0x3976fc[_0x1fd7('0x37')][_0x1fd7('0x42')]){_0x355018[_0x1fd7('0x3f')]=_['merge'](_0x355018['where'],{'$or':_[_0x1fd7('0x31')](_0x355018[_0x1fd7('0x3a')],function(_0x4e4d25){var _0x51c352={};_0x51c352[_0x4e4d25]={'$like':'%'+_0x3976fc[_0x1fd7('0x37')]['filter']+'%'};return _0x51c352;})});}if(_0x3976fc[_0x1fd7('0x37')][_0x1fd7('0x5f')]){var _0x146356=_0x3976fc[_0x1fd7('0x37')][_0x1fd7('0x5f')][_0x1fd7('0x60')](',');var _0x473bbe={};_0x473bbe[_0x146356[0x0]]={'$gte':moment(_0x146356[0x1])['format'](_0x1fd7('0x61'))};_0x355018[_0x1fd7('0x3f')]=_['merge'](_0x355018[_0x1fd7('0x3f')],_0x473bbe);}_0x355018=_[_0x1fd7('0x43')]({},_0x355018,_0x3976fc[_0x1fd7('0x45')]);return _0x35b9a6[_0x1fd7('0x5d')](_0x355018);}})['then'](function(_0x141036){if(_0x141036){_0x12e64f=_0x141036['length'];if(!_0x3976fc['query']['hasOwnProperty']('nolimit')){_0x355018[_0x1fd7('0x23')]=qs[_0x1fd7('0x23')](_0x3976fc[_0x1fd7('0x37')]['limit']);_0x355018['offset']=qs['offset'](_0x3976fc[_0x1fd7('0x37')]['offset']);}return _0x35b9a6[_0x1fd7('0x5d')](_0x355018);}})[_0x1fd7('0x2b')](function(_0xc55020){if(_0xc55020){return _0xc55020?{'count':_0x12e64f,'rows':_0xc55020}:null;}})[_0x1fd7('0x2b')](respondWithResult(_0x2d9c92,null))[_0x1fd7('0x4a')](handleError(_0x2d9c92,null));}; \ No newline at end of file +var _0xb1fa=['status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','fieldName','type','model','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatGroup','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','destroy','params','describe','getUnread','ChatInternalMessage','user','addMembers','ids','findOne','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','sendStatus'];(function(_0x4323d4,_0x42b60e){var _0xbff5e6=function(_0xdefe85){while(--_0xdefe85){_0x4323d4['push'](_0x4323d4['shift']());}};_0xbff5e6(++_0x42b60e);}(_0xb1fa,0x9c));var _0xab1f=function(_0x4d0c54,_0x3fdbee){_0x4d0c54=_0x4d0c54-0x0;var _0x5b834f=_0xb1fa[_0x4d0c54];return _0x5b834f;};'use strict';var emlformat=require(_0xab1f('0x0'));var rimraf=require(_0xab1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab1f('0x2'));var rp=require(_0xab1f('0x3'));var moment=require(_0xab1f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab1f('0x5'));var util=require(_0xab1f('0x6'));var path=require(_0xab1f('0x7'));var sox=require(_0xab1f('0x8'));var csv=require(_0xab1f('0x9'));var ejs=require(_0xab1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab1f('0xb'));var squel=require(_0xab1f('0xc'));var crypto=require(_0xab1f('0xd'));var jsforce=require(_0xab1f('0xe'));var deskjs=require(_0xab1f('0xf'));var toCsv=require(_0xab1f('0x9'));var querystring=require(_0xab1f('0x10'));var Papa=require(_0xab1f('0x11'));var Redis=require('ioredis');var authService=require(_0xab1f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xab1f('0x13'));var hardwareService=require(_0xab1f('0x14'));var logger=require(_0xab1f('0x15'))(_0xab1f('0x16'));var utils=require(_0xab1f('0x17'));var config=require(_0xab1f('0x18'));var licenseUtil=require(_0xab1f('0x19'));var db=require(_0xab1f('0x1a'))['db'];config[_0xab1f('0x1b')]=_[_0xab1f('0x1c')](config[_0xab1f('0x1b')],{'host':_0xab1f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xab1f('0x1e'))['register'](socket);function respondWithStatusCode(_0x5c17d6,_0x32667f){_0x32667f=_0x32667f||0xcc;return function(_0x72c258){if(_0x72c258){return _0x5c17d6[_0xab1f('0x1f')](_0x32667f);}return _0x5c17d6[_0xab1f('0x20')](_0x32667f)[_0xab1f('0x21')]();};}function respondWithResult(_0x1308d6,_0x1d268d){_0x1d268d=_0x1d268d||0xc8;return function(_0x4e940e){if(_0x4e940e){return _0x1308d6[_0xab1f('0x20')](_0x1d268d)['json'](_0x4e940e);}};}function respondWithFilteredResult(_0x4d8979,_0x5d56a1){return function(_0x36cd7b){if(_0x36cd7b){var _0x5462e2=typeof _0x5d56a1[_0xab1f('0x22')]===_0xab1f('0x23')&&typeof _0x5d56a1['limit']===_0xab1f('0x23');var _0x45c081=_0x36cd7b[_0xab1f('0x24')];var _0x52b883=_0x5462e2?0x0:_0x5d56a1['offset'];var _0x2e3d06=_0x5462e2?_0x36cd7b[_0xab1f('0x24')]:_0x5d56a1[_0xab1f('0x22')]+_0x5d56a1[_0xab1f('0x25')];var _0x27d176;if(_0x2e3d06>=_0x45c081){_0x2e3d06=_0x45c081;_0x27d176=0xc8;}else{_0x27d176=0xce;}_0x4d8979[_0xab1f('0x20')](_0x27d176);return _0x4d8979[_0xab1f('0x26')](_0xab1f('0x27'),_0x52b883+'-'+_0x2e3d06+'/'+_0x45c081)['json'](_0x36cd7b);}return null;};}function patchUpdates(_0x310a0d){return function(_0x4e7388){try{jsonpatch[_0xab1f('0x28')](_0x4e7388,_0x310a0d,!![]);}catch(_0x3b67c9){return BPromise[_0xab1f('0x29')](_0x3b67c9);}return _0x4e7388[_0xab1f('0x2a')]();};}function saveUpdates(_0x523d15,_0x53ae7f){return function(_0x5d0239){if(_0x5d0239){return _0x5d0239[_0xab1f('0x2b')](_0x523d15)['then'](function(_0x3c826f){return _0x3c826f;});}return null;};}function removeEntity(_0x532031,_0x3ab185){return function(_0x5dad0c){if(_0x5dad0c){return _0x5dad0c['destroy']()[_0xab1f('0x2c')](function(){_0x532031[_0xab1f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6bc3,_0x3e4827){return function(_0x4cb0ce){if(!_0x4cb0ce){_0x2d6bc3[_0xab1f('0x1f')](0x194);}return _0x4cb0ce;};}function handleError(_0x5388ae,_0x28aea8){_0x28aea8=_0x28aea8||0x1f4;return function(_0x1fb567){logger[_0xab1f('0x2d')](_0x1fb567[_0xab1f('0x2e')]);if(_0x1fb567[_0xab1f('0x2f')]){delete _0x1fb567[_0xab1f('0x2f')];}_0x5388ae[_0xab1f('0x20')](_0x28aea8)['send'](_0x1fb567);};}exports['index']=function(_0x3caf95,_0xd739f4){var _0x599542={},_0x2605a3={},_0x4636d7={'count':0x0,'rows':[]};var _0xcd9d90=_['map'](db['ChatGroup']['rawAttributes'],function(_0x42e5db){return{'name':_0x42e5db[_0xab1f('0x30')],'type':_0x42e5db[_0xab1f('0x31')]['key']};});_0x2605a3[_0xab1f('0x32')]=_[_0xab1f('0x33')](_0xcd9d90,_0xab1f('0x2f'));_0x2605a3['query']=_['keys'](_0x3caf95['query']);_0x2605a3[_0xab1f('0x34')]=_[_0xab1f('0x35')](_0x2605a3[_0xab1f('0x32')],_0x2605a3['query']);_0x599542[_0xab1f('0x36')]=_['intersection'](_0x2605a3[_0xab1f('0x32')],qs[_0xab1f('0x37')](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x37')]));_0x599542[_0xab1f('0x36')]=_0x599542['attributes'][_0xab1f('0x39')]?_0x599542[_0xab1f('0x36')]:_0x2605a3[_0xab1f('0x32')];if(!_0x3caf95[_0xab1f('0x38')][_0xab1f('0x3a')](_0xab1f('0x3b'))){_0x599542[_0xab1f('0x25')]=qs[_0xab1f('0x25')](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x25')]);_0x599542[_0xab1f('0x22')]=qs['offset'](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x22')]);}_0x599542[_0xab1f('0x3c')]=qs[_0xab1f('0x3d')](_0x3caf95[_0xab1f('0x38')][_0xab1f('0x3d')]);_0x599542['where']=qs['filters'](_[_0xab1f('0x3e')](_0x3caf95[_0xab1f('0x38')],_0x2605a3['filters']),_0xcd9d90);if(_0x3caf95[_0xab1f('0x38')][_0xab1f('0x3f')]){_0x599542[_0xab1f('0x40')]=_['merge'](_0x599542[_0xab1f('0x40')],{'$or':_[_0xab1f('0x33')](_0xcd9d90,function(_0x3d36c5){if(_0x3d36c5[_0xab1f('0x31')]!==_0xab1f('0x41')){var _0x13df76={};_0x13df76[_0x3d36c5['name']]={'$like':'%'+_0x3caf95['query'][_0xab1f('0x3f')]+'%'};return _0x13df76;}})});}_0x599542=_[_0xab1f('0x42')]({},_0x599542,_0x3caf95[_0xab1f('0x43')]);var _0x45667f={'where':_0x599542[_0xab1f('0x40')]};return db[_0xab1f('0x44')][_0xab1f('0x24')](_0x45667f)[_0xab1f('0x2c')](function(_0x5c1079){_0x4636d7[_0xab1f('0x24')]=_0x5c1079;if(_0x3caf95['query'][_0xab1f('0x45')]){_0x599542[_0xab1f('0x46')]=[{'all':!![]}];}return db['ChatGroup'][_0xab1f('0x47')](_0x599542);})['then'](function(_0x4e87f2){_0x4636d7[_0xab1f('0x48')]=_0x4e87f2;return _0x4636d7;})[_0xab1f('0x2c')](respondWithFilteredResult(_0xd739f4,_0x599542))[_0xab1f('0x49')](handleError(_0xd739f4,null));};exports['show']=function(_0x225fe0,_0xbf012){var _0x59146d={'raw':!![],'where':{'id':_0x225fe0['params']['id']}},_0x370239={};_0x370239[_0xab1f('0x32')]=_[_0xab1f('0x4a')](db[_0xab1f('0x44')][_0xab1f('0x4b')]);_0x370239[_0xab1f('0x38')]=_[_0xab1f('0x4a')](_0x225fe0[_0xab1f('0x38')]);_0x370239[_0xab1f('0x34')]=_['intersection'](_0x370239[_0xab1f('0x32')],_0x370239[_0xab1f('0x38')]);_0x59146d['attributes']=_[_0xab1f('0x35')](_0x370239['model'],qs[_0xab1f('0x37')](_0x225fe0[_0xab1f('0x38')]['fields']));_0x59146d[_0xab1f('0x36')]=_0x59146d[_0xab1f('0x36')][_0xab1f('0x39')]?_0x59146d[_0xab1f('0x36')]:_0x370239[_0xab1f('0x32')];if(_0x225fe0[_0xab1f('0x38')][_0xab1f('0x45')]){_0x59146d[_0xab1f('0x46')]=[{'all':!![]}];}_0x59146d=_[_0xab1f('0x42')]({},_0x59146d,_0x225fe0[_0xab1f('0x43')]);return db[_0xab1f('0x44')][_0xab1f('0x4c')](_0x59146d)[_0xab1f('0x2c')](handleEntityNotFound(_0xbf012,null))['then'](respondWithResult(_0xbf012,null))[_0xab1f('0x49')](handleError(_0xbf012,null));};exports[_0xab1f('0x4d')]=function(_0x331c67,_0x52195c){return db[_0xab1f('0x44')]['create'](_0x331c67['body'],{})[_0xab1f('0x2c')](respondWithResult(_0x52195c,0xc9))[_0xab1f('0x49')](handleError(_0x52195c,null));};exports[_0xab1f('0x2b')]=function(_0x19f27f,_0x1d6adf){if(_0x19f27f[_0xab1f('0x4e')]['id']){delete _0x19f27f[_0xab1f('0x4e')]['id'];}return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x19f27f['params']['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x1d6adf,null))[_0xab1f('0x2c')](saveUpdates(_0x19f27f[_0xab1f('0x4e')],null))[_0xab1f('0x2c')](respondWithResult(_0x1d6adf,null))['catch'](handleError(_0x1d6adf,null));};exports[_0xab1f('0x4f')]=function(_0x594428,_0x55a748){return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x594428[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x55a748,null))[_0xab1f('0x2c')](removeEntity(_0x55a748,null))[_0xab1f('0x49')](handleError(_0x55a748,null));};exports['describe']=function(_0x4de6b2,_0x368cd9){return db[_0xab1f('0x44')][_0xab1f('0x51')]()[_0xab1f('0x2c')](respondWithResult(_0x368cd9,null))[_0xab1f('0x49')](handleError(_0x368cd9,null));};exports[_0xab1f('0x52')]=function(_0x5d8fea,_0x4711c3,_0x17ef9a){return db[_0xab1f('0x53')][_0xab1f('0x24')]({'where':{'ChatGroupId':_0x5d8fea[_0xab1f('0x50')]['id'],'ToId':_0x5d8fea[_0xab1f('0x54')]['id'],'read':![]}})[_0xab1f('0x2c')](function(_0xc63b8e){return{'id':_['toInteger'](_0x5d8fea[_0xab1f('0x50')]['id']),'count':_0xc63b8e};})[_0xab1f('0x2c')](respondWithResult(_0x4711c3,null))['catch'](handleError(_0x4711c3,null));};exports[_0xab1f('0x55')]=function(_0x4656b5,_0x308eb5,_0x10780e){return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x4656b5[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x308eb5,null))[_0xab1f('0x2c')](function(_0x212ca4){if(_0x212ca4){return _0x212ca4[_0xab1f('0x55')](_0x4656b5['body'][_0xab1f('0x56')],_['omit'](_0x4656b5[_0xab1f('0x4e')],[_0xab1f('0x56'),'id'])||{});}})['then'](respondWithResult(_0x308eb5,null))[_0xab1f('0x49')](handleError(_0x308eb5,null));};exports['getMembers']=function(_0x442aa8,_0x5f9aaf,_0x3b2e59){var _0x38bb6e={};var _0x3f9b00={};var _0x3669da;var _0x44b91d;return db['ChatGroup'][_0xab1f('0x57')]({'where':{'id':_0x442aa8[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x5f9aaf,null))[_0xab1f('0x2c')](function(_0x177cd2){if(_0x177cd2){_0x3669da=_0x177cd2;_0x3f9b00[_0xab1f('0x32')]=_['keys'](db['User'][_0xab1f('0x4b')]);_0x3f9b00[_0xab1f('0x38')]=_['keys'](_0x442aa8[_0xab1f('0x38')]);_0x3f9b00[_0xab1f('0x34')]=_[_0xab1f('0x35')](_0x3f9b00[_0xab1f('0x32')],_0x3f9b00[_0xab1f('0x38')]);_0x38bb6e['attributes']=_['intersection'](_0x3f9b00[_0xab1f('0x32')],qs[_0xab1f('0x37')](_0x442aa8[_0xab1f('0x38')]['fields']));_0x38bb6e[_0xab1f('0x36')]=_0x38bb6e['attributes'][_0xab1f('0x39')]?_0x38bb6e[_0xab1f('0x36')]:_0x3f9b00[_0xab1f('0x32')];_0x38bb6e[_0xab1f('0x3c')]=qs[_0xab1f('0x3d')](_0x442aa8[_0xab1f('0x38')][_0xab1f('0x3d')]);_0x38bb6e[_0xab1f('0x40')]=qs[_0xab1f('0x34')](_[_0xab1f('0x3e')](_0x442aa8[_0xab1f('0x38')],_0x3f9b00[_0xab1f('0x34')]));if(_0x442aa8[_0xab1f('0x38')]['filter']){_0x38bb6e[_0xab1f('0x40')]=_['merge'](_0x38bb6e[_0xab1f('0x40')],{'$or':_[_0xab1f('0x33')](_0x38bb6e[_0xab1f('0x36')],function(_0x421035){var _0x2d1757={};_0x2d1757[_0x421035]={'$like':'%'+_0x442aa8[_0xab1f('0x38')][_0xab1f('0x3f')]+'%'};return _0x2d1757;})});}_0x38bb6e=_[_0xab1f('0x42')]({},_0x38bb6e,_0x442aa8['options']);return _0x3669da[_0xab1f('0x58')](_0x38bb6e);}})['then'](function(_0x58fe57){if(_0x58fe57){_0x44b91d=_0x58fe57[_0xab1f('0x39')];if(!_0x442aa8[_0xab1f('0x38')][_0xab1f('0x3a')](_0xab1f('0x3b'))){_0x38bb6e[_0xab1f('0x25')]=qs[_0xab1f('0x25')](_0x442aa8[_0xab1f('0x38')][_0xab1f('0x25')]);_0x38bb6e[_0xab1f('0x22')]=qs[_0xab1f('0x22')](_0x442aa8[_0xab1f('0x38')][_0xab1f('0x22')]);}return _0x3669da[_0xab1f('0x58')](_0x38bb6e);}})[_0xab1f('0x2c')](function(_0x92551e){if(_0x92551e){return _0x92551e?{'count':_0x44b91d,'rows':_0x92551e}:null;}})[_0xab1f('0x2c')](respondWithResult(_0x5f9aaf,null))[_0xab1f('0x49')](handleError(_0x5f9aaf,null));};exports[_0xab1f('0x59')]=function(_0x33cbeb,_0x1202b5,_0x22cf12){return db[_0xab1f('0x44')]['find']({'where':{'id':_0x33cbeb['params']['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x1202b5,null))[_0xab1f('0x2c')](function(_0x29b247){if(_0x29b247){return _0x29b247[_0xab1f('0x59')](_0x33cbeb[_0xab1f('0x38')][_0xab1f('0x56')]);}})[_0xab1f('0x2c')](respondWithStatusCode(_0x1202b5,null))[_0xab1f('0x49')](handleError(_0x1202b5,null));};exports[_0xab1f('0x5a')]=function(_0x557e15,_0xf76938,_0xc27e25){if(_0x557e15[_0xab1f('0x4e')]['id']){delete _0x557e15[_0xab1f('0x4e')]['id'];}return db[_0xab1f('0x44')][_0xab1f('0x4c')]({'where':{'id':_0x557e15['params']['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0xf76938,null))[_0xab1f('0x2c')](function(_0x53ba74){if(_0x53ba74){_0x557e15[_0xab1f('0x4e')][_0xab1f('0x5b')]=_0x53ba74['id'];return db['ChatInternalMessage'][_0xab1f('0x4d')](_0x557e15[_0xab1f('0x4e')]);}})['then'](respondWithResult(_0xf76938,null))[_0xab1f('0x49')](handleError(_0xf76938,null));};exports[_0xab1f('0x5c')]=function(_0x40aec3,_0x56f346,_0x1ba6c4){var _0xd07fcd={};var _0x344420={};var _0x5be7ea;var _0x343ef8;return db[_0xab1f('0x44')]['findOne']({'where':{'id':_0x40aec3[_0xab1f('0x50')]['id']}})[_0xab1f('0x2c')](handleEntityNotFound(_0x56f346,null))[_0xab1f('0x2c')](function(_0x4dfa9e){if(_0x4dfa9e){_0x5be7ea=_0x4dfa9e;_0x344420[_0xab1f('0x32')]=_[_0xab1f('0x4a')](db[_0xab1f('0x53')]['rawAttributes']);_0x344420[_0xab1f('0x38')]=_['keys'](_0x40aec3[_0xab1f('0x38')]);_0x344420[_0xab1f('0x34')]=_[_0xab1f('0x35')](_0x344420['model'],_0x344420['query']);_0xd07fcd[_0xab1f('0x36')]=_[_0xab1f('0x35')](_0x344420[_0xab1f('0x32')],qs[_0xab1f('0x37')](_0x40aec3[_0xab1f('0x38')][_0xab1f('0x37')]));_0xd07fcd['attributes']=_0xd07fcd[_0xab1f('0x36')][_0xab1f('0x39')]?_0xd07fcd[_0xab1f('0x36')]:_0x344420[_0xab1f('0x32')];_0xd07fcd[_0xab1f('0x3c')]=qs[_0xab1f('0x3d')](_0x40aec3[_0xab1f('0x38')]['sort']);_0xd07fcd[_0xab1f('0x40')]=qs[_0xab1f('0x34')](_[_0xab1f('0x3e')](_0x40aec3['query'],_0x344420[_0xab1f('0x34')]));if(_0x40aec3['query'][_0xab1f('0x3f')]){_0xd07fcd[_0xab1f('0x40')]=_['merge'](_0xd07fcd[_0xab1f('0x40')],{'$or':_[_0xab1f('0x33')](_0xd07fcd['attributes'],function(_0x436ab8){var _0x1203f5={};_0x1203f5[_0x436ab8]={'$like':'%'+_0x40aec3[_0xab1f('0x38')][_0xab1f('0x3f')]+'%'};return _0x1203f5;})});}if(_0x40aec3[_0xab1f('0x38')][_0xab1f('0x5d')]){var _0x27735b=_0x40aec3[_0xab1f('0x38')]['$gte']['split'](',');var _0x24de27={};_0x24de27[_0x27735b[0x0]]={'$gte':moment(_0x27735b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xd07fcd[_0xab1f('0x40')]=_['merge'](_0xd07fcd[_0xab1f('0x40')],_0x24de27);}_0xd07fcd=_['merge']({},_0xd07fcd,_0x40aec3[_0xab1f('0x43')]);return _0x5be7ea[_0xab1f('0x5c')](_0xd07fcd);}})[_0xab1f('0x2c')](function(_0x12f46f){if(_0x12f46f){_0x343ef8=_0x12f46f[_0xab1f('0x39')];if(!_0x40aec3[_0xab1f('0x38')]['hasOwnProperty'](_0xab1f('0x3b'))){_0xd07fcd[_0xab1f('0x25')]=qs[_0xab1f('0x25')](_0x40aec3[_0xab1f('0x38')][_0xab1f('0x25')]);_0xd07fcd[_0xab1f('0x22')]=qs[_0xab1f('0x22')](_0x40aec3[_0xab1f('0x38')][_0xab1f('0x22')]);}return _0x5be7ea['getMessages'](_0xd07fcd);}})['then'](function(_0x329dca){if(_0x329dca){return _0x329dca?{'count':_0x343ef8,'rows':_0x329dca}:null;}})[_0xab1f('0x2c')](respondWithResult(_0x56f346,null))[_0xab1f('0x49')](handleError(_0x56f346,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 0375cb1..46e9738 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 _0xcad5=['remove','emit','hook','exports','events','../../mysqldb','ChatGroup','save','update'];(function(_0x391a87,_0x49d004){var _0x5726d6=function(_0x5be824){while(--_0x5be824){_0x391a87['push'](_0x391a87['shift']());}};_0x5726d6(++_0x49d004);}(_0xcad5,0x1cf));var _0x5cad=function(_0x1fc88e,_0x10d4fb){_0x1fc88e=_0x1fc88e-0x0;var _0x2bb70d=_0xcad5[_0x1fc88e];return _0x2bb70d;};'use strict';var EventEmitter=require(_0x5cad('0x0'));var ChatGroup=require(_0x5cad('0x1'))['db'][_0x5cad('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cad('0x3'),'afterUpdate':_0x5cad('0x4'),'afterDestroy':_0x5cad('0x5')};function emitEvent(_0xd249e3){return function(_0x56a163,_0x4dba52,_0x53fab7){ChatGroupEvents['emit'](_0xd249e3+':'+_0x56a163['id'],_0x56a163);ChatGroupEvents[_0x5cad('0x6')](_0xd249e3,_0x56a163);_0x53fab7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x5cad('0x7')](e,emitEvent(event));}}module[_0x5cad('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2ace=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove'];(function(_0x393caf,_0x234484){var _0x3ad823=function(_0x1585b7){while(--_0x1585b7){_0x393caf['push'](_0x393caf['shift']());}};_0x3ad823(++_0x234484);}(_0x2ace,0x17e));var _0xe2ac=function(_0x86337d,_0x2b57c3){_0x86337d=_0x86337d-0x0;var _0x22b2c6=_0x2ace[_0x86337d];return _0x22b2c6;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xe2ac('0x0'))['db'][_0xe2ac('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe2ac('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2ac('0x3'),'afterDestroy':_0xe2ac('0x4')};function emitEvent(_0x47c3a2){return function(_0x171092,_0x464ec4,_0x240663){ChatGroupEvents[_0xe2ac('0x5')](_0x47c3a2+':'+_0x171092['id'],_0x171092);ChatGroupEvents[_0xe2ac('0x5')](_0x47c3a2,_0x171092);_0x240663(null);};}for(var e in events){if(events[_0xe2ac('0x6')](e)){var event=events[e];ChatGroup[_0xe2ac('0x7')](e,emitEvent(event));}}module[_0xe2ac('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 515afa9..6e1cbe0 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 _0xf36a=['define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x547510,_0x30e1c5){var _0x273c31=function(_0x51caf5){while(--_0x51caf5){_0x547510['push'](_0x547510['shift']());}};_0x273c31(++_0x30e1c5);}(_0xf36a,0x12e));var _0xaf36=function(_0x51b2bc,_0x225bc4){_0x51b2bc=_0x51b2bc-0x0;var _0x4413a7=_0xf36a[_0x51b2bc];return _0x4413a7;};'use strict';var _=require('lodash');var util=require(_0xaf36('0x0'));var logger=require(_0xaf36('0x1'))(_0xaf36('0x2'));var moment=require(_0xaf36('0x3'));var BPromise=require(_0xaf36('0x4'));var rp=require(_0xaf36('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf36('0x6'));var config=require(_0xaf36('0x7'));var attributes=require(_0xaf36('0x8'));module[_0xaf36('0x9')]=function(_0x3e1e8,_0x42cf7d){return _0x3e1e8[_0xaf36('0xa')](_0xaf36('0xb'),attributes,{'tableName':_0xaf36('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd78=['../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3bde7b,_0x5c98d0){var _0x30df0f=function(_0x11389b){while(--_0x11389b){_0x3bde7b['push'](_0x3bde7b['shift']());}};_0x30df0f(++_0x5c98d0);}(_0xbd78,0xfc));var _0x8bd7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbd78[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8bd7('0x0'));var util=require(_0x8bd7('0x1'));var logger=require(_0x8bd7('0x2'))(_0x8bd7('0x3'));var moment=require('moment');var BPromise=require(_0x8bd7('0x4'));var rp=require(_0x8bd7('0x5'));var fs=require('fs');var path=require(_0x8bd7('0x6'));var rimraf=require(_0x8bd7('0x7'));var config=require(_0x8bd7('0x8'));var attributes=require(_0x8bd7('0x9'));module['exports']=function(_0x16c76d,_0x351123){return _0x16c76d[_0x8bd7('0xa')](_0x8bd7('0xb'),attributes,{'tableName':_0x8bd7('0xc'),'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 0cb1ca8..5b4c559 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 _0x2cd0=['socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3c9e05,_0x2871fd){var _0x5cefa0=function(_0x4c71f7){while(--_0x4c71f7){_0x3c9e05['push'](_0x3c9e05['shift']());}};_0x5cefa0(++_0x2871fd);}(_0x2cd0,0x8a));var _0x02cd=function(_0x1bcac2,_0x2f2084){_0x1bcac2=_0x1bcac2-0x0;var _0x3f813a=_0x2cd0[_0x1bcac2];return _0x3f813a;};'use strict';var _=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x02cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02cd('0x3'));var logger=require(_0x02cd('0x4'))(_0x02cd('0x5'));var config=require(_0x02cd('0x6'));var jayson=require(_0x02cd('0x7'));var client=jayson[_0x02cd('0x8')][_0x02cd('0x9')]({'port':0x232a});config[_0x02cd('0xa')]=_[_0x02cd('0xb')](config[_0x02cd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x02cd('0xc'))(new Redis(config[_0x02cd('0xa')]));require(_0x02cd('0xd'))[_0x02cd('0xe')](socket);function respondWithRpcPromise(_0x45cc20,_0xd0cc56,_0x18dfe0){return new BPromise(function(_0x2364c3,_0x15a488){return client[_0x02cd('0xf')](_0x45cc20,_0x18dfe0)['then'](function(_0x59f017){logger[_0x02cd('0x10')](_0x02cd('0x11'),_0xd0cc56,'request\x20sent');logger['debug'](_0x02cd('0x12'),_0xd0cc56,'request\x20sent',JSON[_0x02cd('0x13')](_0x59f017));if(_0x59f017[_0x02cd('0x14')]){if(_0x59f017[_0x02cd('0x14')][_0x02cd('0x15')]===0x1f4){logger[_0x02cd('0x14')](_0x02cd('0x11'),_0xd0cc56,_0x59f017['error']['message']);return _0x15a488(_0x59f017[_0x02cd('0x14')][_0x02cd('0x16')]);}logger[_0x02cd('0x14')](_0x02cd('0x11'),_0xd0cc56,_0x59f017[_0x02cd('0x14')]['message']);return _0x2364c3(_0x59f017[_0x02cd('0x14')]['message']);}else{logger['info'](_0x02cd('0x11'),_0xd0cc56,_0x02cd('0x17'));_0x2364c3(_0x59f017[_0x02cd('0x18')][_0x02cd('0x16')]);}})['catch'](function(_0x341ace){logger['error'](_0x02cd('0x11'),_0xd0cc56,_0x341ace);_0x15a488(_0x341ace);});});} \ No newline at end of file +var _0xe799=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2111bc,_0x2d65d5){var _0x1ff93b=function(_0x2cfb28){while(--_0x2cfb28){_0x2111bc['push'](_0x2111bc['shift']());}};_0x1ff93b(++_0x2d65d5);}(_0xe799,0x170));var _0x9e79=function(_0x4532c0,_0x18bf16){_0x4532c0=_0x4532c0-0x0;var _0x598927=_0xe799[_0x4532c0];return _0x598927;};'use strict';var _=require(_0x9e79('0x0'));var util=require('util');var moment=require(_0x9e79('0x1'));var BPromise=require('bluebird');var rs=require(_0x9e79('0x2'));var fs=require('fs');var Redis=require(_0x9e79('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e79('0x4'));var logger=require(_0x9e79('0x5'))(_0x9e79('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e79('0x7'));var client=jayson['client'][_0x9e79('0x8')]({'port':0x232a});config[_0x9e79('0x9')]=_[_0x9e79('0xa')](config['redis'],{'host':_0x9e79('0xb'),'port':0x18eb});var socket=require(_0x9e79('0xc'))(new Redis(config['redis']));require(_0x9e79('0xd'))[_0x9e79('0xe')](socket);function respondWithRpcPromise(_0xc46eed,_0x6464d6,_0x502f36){return new BPromise(function(_0x43bd7a,_0x15efc4){return client['request'](_0xc46eed,_0x502f36)[_0x9e79('0xf')](function(_0x127c92){logger[_0x9e79('0x10')](_0x9e79('0x11'),_0x6464d6,_0x9e79('0x12'));logger['debug'](_0x9e79('0x13'),_0x6464d6,_0x9e79('0x12'),JSON[_0x9e79('0x14')](_0x127c92));if(_0x127c92[_0x9e79('0x15')]){if(_0x127c92[_0x9e79('0x15')][_0x9e79('0x16')]===0x1f4){logger[_0x9e79('0x15')](_0x9e79('0x11'),_0x6464d6,_0x127c92[_0x9e79('0x15')][_0x9e79('0x17')]);return _0x15efc4(_0x127c92[_0x9e79('0x15')][_0x9e79('0x17')]);}logger['error'](_0x9e79('0x11'),_0x6464d6,_0x127c92['error'][_0x9e79('0x17')]);return _0x43bd7a(_0x127c92[_0x9e79('0x15')]['message']);}else{logger[_0x9e79('0x10')](_0x9e79('0x11'),_0x6464d6,'request\x20sent');_0x43bd7a(_0x127c92['result'][_0x9e79('0x17')]);}})[_0x9e79('0x18')](function(_0x33e7a2){logger[_0x9e79('0x15')](_0x9e79('0x11'),_0x6464d6,_0x33e7a2);_0x15efc4(_0x33e7a2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index bec33ab..273aab6 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 _0x8c3d=['./chatGroup.events','save','remove','emit','removeListener','register','length','chatGroup:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c3d,0xe8));var _0xd8c3=function(_0x57d4c4,_0x1eb1c7){_0x57d4c4=_0x57d4c4-0x0;var _0x551561=_0x8c3d[_0x57d4c4];return _0x551561;};'use strict';var ChatGroupEvents=require(_0xd8c3('0x0'));var events=[_0xd8c3('0x1'),_0xd8c3('0x2'),'update'];function createListener(_0x2a6adc,_0x394bc2){return function(_0x169763){_0x394bc2[_0xd8c3('0x3')](_0x2a6adc,_0x169763);};}function removeListener(_0x46a95e,_0x2a5af8){return function(){ChatGroupEvents[_0xd8c3('0x4')](_0x46a95e,_0x2a5af8);};}exports[_0xd8c3('0x5')]=function(_0x528b48){for(var _0x34b6d8=0x0,_0x13dac9=events[_0xd8c3('0x6')];_0x34b6d8<_0x13dac9;_0x34b6d8++){var _0x440fe0=events[_0x34b6d8];var _0x30c00d=createListener(_0xd8c3('0x7')+_0x440fe0,_0x528b48);ChatGroupEvents['on'](_0x440fe0,_0x30c00d);}}; \ No newline at end of file +var _0x383a=['register','length','./chatGroup.events','save','remove','emit','removeListener'];(function(_0x2ef076,_0x7e4f75){var _0x202f26=function(_0x277542){while(--_0x277542){_0x2ef076['push'](_0x2ef076['shift']());}};_0x202f26(++_0x7e4f75);}(_0x383a,0xb1));var _0xa383=function(_0x315216,_0x15d0cc){_0x315216=_0x315216-0x0;var _0x4dfb84=_0x383a[_0x315216];return _0x4dfb84;};'use strict';var ChatGroupEvents=require(_0xa383('0x0'));var events=[_0xa383('0x1'),_0xa383('0x2'),'update'];function createListener(_0x4c5afb,_0x5f0fd1){return function(_0x422361){_0x5f0fd1[_0xa383('0x3')](_0x4c5afb,_0x422361);};}function removeListener(_0xd98016,_0x126341){return function(){ChatGroupEvents[_0xa383('0x4')](_0xd98016,_0x126341);};}exports[_0xa383('0x5')]=function(_0x4fd756){for(var _0x1bbcef=0x0,_0x75d54c=events[_0xa383('0x6')];_0x1bbcef<_0x75d54c;_0x1bbcef++){var _0x2d1c43=events[_0x1bbcef];var _0x3fe5a4=createListener('chatGroup:'+_0x2d1c43,_0x4fd756);ChatGroupEvents['on'](_0x2d1c43,_0x3fe5a4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 7d74a94..9dc4e30 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 _0xbd23=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','create','addMembers','post','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express'];(function(_0x27c7b7,_0x3ac29c){var _0x22e7d5=function(_0x1a5494){while(--_0x1a5494){_0x27c7b7['push'](_0x27c7b7['shift']());}};_0x22e7d5(++_0x3ac29c);}(_0xbd23,0xa9));var _0x3bd2=function(_0x29222b,_0x190e44){_0x29222b=_0x29222b-0x0;var _0x24b5e2=_0xbd23[_0x29222b];return _0x24b5e2;};'use strict';var multer=require(_0x3bd2('0x0'));var util=require(_0x3bd2('0x1'));var path=require(_0x3bd2('0x2'));var timeout=require(_0x3bd2('0x3'));var express=require(_0x3bd2('0x4'));var router=express[_0x3bd2('0x5')]();var fs_extra=require(_0x3bd2('0x6'));var auth=require(_0x3bd2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3bd2('0x8'));var controller=require(_0x3bd2('0x9'));router[_0x3bd2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3bd2('0xb'),auth[_0x3bd2('0xc')](),controller[_0x3bd2('0xd')]);router[_0x3bd2('0xa')](_0x3bd2('0xe'),auth[_0x3bd2('0xc')](),controller[_0x3bd2('0xf')]);router[_0x3bd2('0xa')](_0x3bd2('0x10'),auth['isAuthenticated'](),controller[_0x3bd2('0x11')]);router['get'](_0x3bd2('0x12'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x3bd2('0x13'),auth[_0x3bd2('0xc')](),controller[_0x3bd2('0x14')]);router['post']('/',auth[_0x3bd2('0xc')](),controller[_0x3bd2('0x15')]);router['post'](_0x3bd2('0x12'),auth['isAuthenticated'](),controller[_0x3bd2('0x16')]);router[_0x3bd2('0x17')](_0x3bd2('0x13'),auth[_0x3bd2('0xc')](),controller['addMessage']);router['put'](_0x3bd2('0xe'),auth[_0x3bd2('0xc')](),controller[_0x3bd2('0x18')]);router[_0x3bd2('0x19')](_0x3bd2('0xe'),auth[_0x3bd2('0xc')](),controller[_0x3bd2('0x1a')]);router[_0x3bd2('0x19')](_0x3bd2('0x12'),auth[_0x3bd2('0xc')](),controller[_0x3bd2('0x1b')]);module[_0x3bd2('0x1c')]=router; \ No newline at end of file +var _0x2a72=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x2a72,0x121));var _0x22a7=function(_0x42b7b3,_0x2e0015){_0x42b7b3=_0x42b7b3-0x0;var _0x4284e7=_0x2a72[_0x42b7b3];return _0x4284e7;};'use strict';var multer=require(_0x22a7('0x0'));var util=require(_0x22a7('0x1'));var path=require(_0x22a7('0x2'));var timeout=require(_0x22a7('0x3'));var express=require('express');var router=express[_0x22a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x22a7('0x5'));var interaction=require(_0x22a7('0x6'));var config=require('../../config/environment');var controller=require(_0x22a7('0x7'));router[_0x22a7('0x8')]('/',auth[_0x22a7('0x9')](),controller[_0x22a7('0xa')]);router[_0x22a7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x22a7('0xb')]);router[_0x22a7('0x8')](_0x22a7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x22a7('0x8')](_0x22a7('0xd'),auth[_0x22a7('0x9')](),controller[_0x22a7('0xe')]);router[_0x22a7('0x8')](_0x22a7('0xf'),auth[_0x22a7('0x9')](),controller[_0x22a7('0x10')]);router[_0x22a7('0x8')](_0x22a7('0x11'),auth[_0x22a7('0x9')](),controller['getMessages']);router[_0x22a7('0x12')]('/',auth[_0x22a7('0x9')](),controller[_0x22a7('0x13')]);router[_0x22a7('0x12')]('/:id/members',auth[_0x22a7('0x9')](),controller[_0x22a7('0x14')]);router[_0x22a7('0x12')](_0x22a7('0x11'),auth[_0x22a7('0x9')](),controller[_0x22a7('0x15')]);router[_0x22a7('0x16')](_0x22a7('0xc'),auth[_0x22a7('0x9')](),controller['update']);router[_0x22a7('0x17')](_0x22a7('0xc'),auth[_0x22a7('0x9')](),controller[_0x22a7('0x18')]);router[_0x22a7('0x17')]('/:id/members',auth[_0x22a7('0x9')](),controller['removeMembers']);module[_0x22a7('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f78c03a..b3a9037 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 _0xc788=['BOOLEAN','star','thumb','TEXT','DATE','STRING','long','ENUM','out','sequelize','exports'];(function(_0x14900b,_0x5e84c4){var _0x493ffc=function(_0x3d952c){while(--_0x3d952c){_0x14900b['push'](_0x14900b['shift']());}};_0x493ffc(++_0x5e84c4);}(_0xc788,0xc4));var _0x8c78=function(_0x1f1731,_0x4b77eb){_0x1f1731=_0x1f1731-0x0;var _0x1f7625=_0xc788[_0x1f1731];return _0x1f7625;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'closed':{'type':Sequelize[_0x8c78('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x8c78('0x3'),_0x8c78('0x4')),'defaultValue':_0x8c78('0x3')},'ratingMessage':{'type':Sequelize[_0x8c78('0x5')]},'pathTranscript':{'type':Sequelize[_0x8c78('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8c78('0x6')]},'disposition':{'type':Sequelize[_0x8c78('0x7')]},'secondDisposition':{'type':Sequelize[_0x8c78('0x7')]},'thirdDisposition':{'type':Sequelize[_0x8c78('0x7')]},'note':{'type':Sequelize[_0x8c78('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x8c78('0x7')]},'osName':{'type':Sequelize[_0x8c78('0x7')]},'osVersion':{'type':Sequelize[_0x8c78('0x7')]},'deviceModel':{'type':Sequelize[_0x8c78('0x7')]},'deviceVendor':{'type':Sequelize[_0x8c78('0x7')]},'deviceType':{'type':Sequelize[_0x8c78('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x8c78('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x8c78('0x8'))},'read1stAt':{'type':Sequelize[_0x8c78('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8c78('0x9')]('in',_0x8c78('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x8c78('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8a5c=['DATE','long','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x240a17,_0x4a0bf8){var _0x58b5a4=function(_0x30e869){while(--_0x30e869){_0x240a17['push'](_0x240a17['shift']());}};_0x58b5a4(++_0x4a0bf8);}(_0x8a5c,0x136));var _0xc8a5=function(_0x5e01c6,_0x30bc2c){_0x5e01c6=_0x5e01c6-0x0;var _0x5d7383=_0x8a5c[_0x5e01c6];return _0x5d7383;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'closed':{'type':Sequelize[_0xc8a5('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc8a5('0x3')]},'ratingType':{'type':Sequelize[_0xc8a5('0x4')](_0xc8a5('0x5'),_0xc8a5('0x6')),'defaultValue':_0xc8a5('0x5')},'ratingMessage':{'type':Sequelize[_0xc8a5('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xc8a5('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc8a5('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc8a5('0x8')]},'thirdDisposition':{'type':Sequelize[_0xc8a5('0x8')]},'note':{'type':Sequelize[_0xc8a5('0x8')]},'browserName':{'type':Sequelize[_0xc8a5('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xc8a5('0x8')]},'osVersion':{'type':Sequelize[_0xc8a5('0x8')]},'deviceModel':{'type':Sequelize[_0xc8a5('0x8')]},'deviceVendor':{'type':Sequelize[_0xc8a5('0x8')]},'deviceType':{'type':Sequelize[_0xc8a5('0x8')]},'referer':{'type':Sequelize[_0xc8a5('0x7')]},'customerIp':{'type':Sequelize[_0xc8a5('0x8')]},'formData':{'type':Sequelize[_0xc8a5('0x7')](_0xc8a5('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc8a5('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc8a5('0x8')]},'customerPort':{'type':Sequelize[_0xc8a5('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xc8a5('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xc8a5('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 313fe3c..5227d15 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 _0xb821=['`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','toString','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','params','intersection','includeAll','include','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','vidaooNote','follow','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','attachmentDownload','json','Unauthorized','Attachment','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','setTags','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','Account','Owner','mkdirSync','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','zip-dir','request-promise','mustache','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','update','destroy','name','body','contact','interaction','account','Users','map','TagIds','Tags','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','closed','UserId','disposition','total','index','ChatInteraction','rawAttributes','key','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','keys','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb821,0xa7));var _0x1b82=function(_0x7a5ec5,_0x4473bb){_0x7a5ec5=_0x7a5ec5-0x0;var _0x1b191f=_0xb821[_0x7a5ec5];return _0x1b191f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1b82('0x0'));var rp=require(_0x1b82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b82('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x1b82('0x3'));var fs=require('fs');var _=require(_0x1b82('0x4'));var squel=require(_0x1b82('0x5'));var Redis=require(_0x1b82('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0x1b82('0x7'));var pdf=require(_0x1b82('0x8'));var logger=require(_0x1b82('0x9'))(_0x1b82('0xa'));var config=require(_0x1b82('0xb'));var db=require(_0x1b82('0xc'))['db'];config[_0x1b82('0xd')]=_[_0x1b82('0xe')](config[_0x1b82('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b82('0xf'))(new Redis(config[_0x1b82('0xd')]));require(_0x1b82('0x10'))[_0x1b82('0x11')](socket);var jayson=require(_0x1b82('0x12'));var client=jayson[_0x1b82('0x13')][_0x1b82('0x14')]({'port':0x232b});var client9004=jayson[_0x1b82('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x46007e,_0x241d11,_0x2391f5,_0x61b6eb){return new BPromise(function(_0x50aed7,_0x1a6285){var _0x5767aa=_0x61b6eb||client;return _0x5767aa['request'](_0x46007e,_0x2391f5)[_0x1b82('0x15')](function(_0x4bf75b){logger[_0x1b82('0x16')](_0x1b82('0x17'),_0x241d11,'request\x20sent');logger[_0x1b82('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x241d11,'request\x20sent',JSON[_0x1b82('0x19')](_0x4bf75b));if(_0x4bf75b['error']){if(_0x4bf75b[_0x1b82('0x1a')][_0x1b82('0x1b')]===0x1f4){logger[_0x1b82('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x241d11,_0x4bf75b['error'][_0x1b82('0x1c')]);return _0x1a6285(_0x4bf75b['error'][_0x1b82('0x1c')]);}logger[_0x1b82('0x1a')](_0x1b82('0x17'),_0x241d11,_0x4bf75b['error'][_0x1b82('0x1c')]);return _0x50aed7(_0x4bf75b[_0x1b82('0x1a')][_0x1b82('0x1c')]);}else{logger[_0x1b82('0x16')](_0x1b82('0x17'),_0x241d11,'request\x20sent');_0x50aed7(_0x4bf75b[_0x1b82('0x1d')][_0x1b82('0x1c')]);}})[_0x1b82('0x1e')](function(_0x1d50b6){logger[_0x1b82('0x1a')](_0x1b82('0x17'),_0x241d11,_0x1d50b6);_0x1a6285(_0x1d50b6);});});}function respondWithStatusCode(_0x2d07f4,_0x486e92){_0x486e92=_0x486e92||0xcc;return function(_0x1df569){if(_0x1df569){return _0x2d07f4[_0x1b82('0x1f')](_0x486e92);}return _0x2d07f4['status'](_0x486e92)[_0x1b82('0x20')]();};}function respondWithResult(_0x225b81,_0x1ad9d6){_0x1ad9d6=_0x1ad9d6||0xc8;return function(_0x4bbbbf){if(_0x4bbbbf){return _0x225b81[_0x1b82('0x21')](_0x1ad9d6)['json'](_0x4bbbbf);}};}function respondWithFilteredResult(_0x5cd458,_0x5f556b){return function(_0xf2e556){if(_0xf2e556){var _0x149d0f=typeof _0x5f556b[_0x1b82('0x22')]===_0x1b82('0x23')&&typeof _0x5f556b['limit']===_0x1b82('0x23');var _0x165b45=_0xf2e556[_0x1b82('0x24')];var _0x7455e8=_0x149d0f?0x0:_0x5f556b[_0x1b82('0x22')];var _0x1b8b6f=_0x149d0f?_0xf2e556[_0x1b82('0x24')]:_0x5f556b[_0x1b82('0x22')]+_0x5f556b[_0x1b82('0x25')];var _0x1f9c6b;if(_0x1b8b6f>=_0x165b45){_0x1b8b6f=_0x165b45;_0x1f9c6b=0xc8;}else{_0x1f9c6b=0xce;}_0x5cd458[_0x1b82('0x21')](_0x1f9c6b);return _0x5cd458[_0x1b82('0x26')](_0x1b82('0x27'),_0x7455e8+'-'+_0x1b8b6f+'/'+_0x165b45)['json'](_0xf2e556);}return null;};}function saveUpdates(_0x17b3aa){return function(_0x2931d0){if(_0x2931d0){return _0x2931d0[_0x1b82('0x28')](_0x17b3aa)[_0x1b82('0x15')](function(_0x18e4ff){return _0x18e4ff;});}return null;};}function removeEntity(_0x115ce7){return function(_0xd3c4a){if(_0xd3c4a){return _0xd3c4a[_0x1b82('0x29')]()[_0x1b82('0x15')](function(){_0x115ce7[_0x1b82('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225c06){return function(_0x29a31e){if(!_0x29a31e){_0x225c06[_0x1b82('0x1f')](0x194);}return _0x29a31e;};}function handleError(_0xc98ee2,_0x5b7b18){_0x5b7b18=_0x5b7b18||0x1f4;return function(_0x474218){logger[_0x1b82('0x1a')](_0x474218['stack']);if(_0x474218[_0x1b82('0x2a')]){delete _0x474218[_0x1b82('0x2a')];}_0xc98ee2[_0x1b82('0x21')](_0x5b7b18)['send'](_0x474218);};}function getMustacheRender(_0x5efb8e,_0x8e881b){return Mustache['render'](_0x5efb8e,_['merge'](_0x8e881b[_0x1b82('0x2b')],{'contact':_0x8e881b[_0x1b82('0x2c')],'message':_0x8e881b[_0x1b82('0x1c')],'agent':_0x8e881b['agent'],'interaction':_0x8e881b[_0x1b82('0x2d')],'account':_0x8e881b[_0x1b82('0x2e')]}))||'';}function getInteractionUsers(_0xea774a,_0x31607f){return new BPromise(function(_0x4dd64a,_0x42c1c4){try{if(_0x31607f[_0xea774a['id']]){_0xea774a[_0x1b82('0x2f')]=_[_0x1b82('0x30')](_0x31607f[_0xea774a['id']],function(_0x5ebf6c){return{'id':_0x5ebf6c['id'],'fullname':_0x5ebf6c['fullname']};});}}catch(_0x21e859){_0x42c1c4(_0x21e859);}_0x4dd64a(_0xea774a);});}function getInteractionTags(_0x5d7e6a,_0x1d3e68){return new BPromise(function(_0x1e6a9,_0x286b4b){try{if(_0x5d7e6a[_0x1b82('0x31')]){_0x5d7e6a[_0x1b82('0x32')]=[];_0x5d7e6a[_0x1b82('0x31')][_0x1b82('0x33')](',')[_0x1b82('0x34')](function(_0x47cd9f){_0x5d7e6a['Tags'][_0x1b82('0x35')](_0x1d3e68[_0x47cd9f]);});}delete _0x5d7e6a['TagIds'];}catch(_0x34890e){_0x286b4b(_0x34890e);}_0x1e6a9(_0x5d7e6a);});}function updateChatInteraction(_0x592449,_0x1c5bc1,_0x331379){return new BPromise(function(_0x1db463,_0x2c1cd0){return getInteractionUsers(_0x592449,_0x331379)[_0x1b82('0x15')](function(_0x202bb4){return getInteractionTags(_0x202bb4,_0x1c5bc1);})['then'](function(_0x17d214){return getStateInteraction(_0x17d214);})['then'](function(_0x410722){_0x1db463(_0x410722);})['catch'](function(_0x21617d){_0x2c1cd0(_0x21617d);});});}function getStateInteraction(_0x4edc17){return new BPromise(function(_0x5aeac1){_0x4edc17[_0x1b82('0x36')]=0x0;_0x4edc17[_0x1b82('0x37')]=0x0;_0x4edc17[_0x1b82('0x38')]=0x0;_0x4edc17[_0x1b82('0x39')]=0x0;_0x4edc17[_0x1b82('0x3a')]=0x0;_0x4edc17['total']=0x0;if(!_0x4edc17[_0x1b82('0x3b')]&&!_0x4edc17['UserId']){_0x4edc17[_0x1b82('0x36')]+=0x1;}if(!_0x4edc17[_0x1b82('0x3b')]&&_0x4edc17[_0x1b82('0x3c')]){_0x4edc17[_0x1b82('0x37')]+=0x1;if(_0x4edc17[_0x1b82('0x36')]){_0x4edc17['waiting']-=0x1;}}if(_0x4edc17[_0x1b82('0x3b')]&&_0x4edc17['disposition']===_0x1b82('0x3a')){_0x4edc17[_0x1b82('0x3a')]+=0x1;if(_0x4edc17['waiting']){_0x4edc17[_0x1b82('0x36')]-=0x1;}}else if(_0x4edc17[_0x1b82('0x3b')]&&!_0x4edc17[_0x1b82('0x3c')]&&_0x4edc17[_0x1b82('0x3d')]){_0x4edc17[_0x1b82('0x39')]+=0x1;if(_0x4edc17[_0x1b82('0x36')]){_0x4edc17[_0x1b82('0x36')]-=0x1;}}else if(_0x4edc17['closed']&&_0x4edc17[_0x1b82('0x3c')]){_0x4edc17['answered']+=0x1;if(_0x4edc17[_0x1b82('0x37')]){_0x4edc17[_0x1b82('0x37')]-=0x1;}}_0x4edc17[_0x1b82('0x3e')]+=0x1;_0x5aeac1(_0x4edc17);});}exports[_0x1b82('0x3f')]=function(_0x429a25,_0x1d24d6){var _0x60a3e1={},_0x19c7ad={},_0x192ce3={'count':0x0,'rows':[]};var _0x120b35=_[_0x1b82('0x30')](db[_0x1b82('0x40')][_0x1b82('0x41')],function(_0x432e84){return{'name':_0x432e84['fieldName'],'type':_0x432e84['type'][_0x1b82('0x42')]};});_0x19c7ad['model']=_[_0x1b82('0x30')](_0x120b35,_0x1b82('0x2a'));_0x19c7ad[_0x1b82('0x43')]=_['keys'](_0x429a25[_0x1b82('0x43')]);_0x19c7ad['filters']=_['intersection'](_0x19c7ad[_0x1b82('0x44')],_0x19c7ad[_0x1b82('0x43')]);_0x60a3e1[_0x1b82('0x45')]=_['intersection'](_0x19c7ad[_0x1b82('0x44')],qs[_0x1b82('0x46')](_0x429a25['query']['fields']));_0x60a3e1[_0x1b82('0x45')]=_0x60a3e1[_0x1b82('0x45')][_0x1b82('0x47')]?_0x60a3e1['attributes']:_0x19c7ad[_0x1b82('0x44')];if(!_0x429a25[_0x1b82('0x43')][_0x1b82('0x48')](_0x1b82('0x49'))){_0x60a3e1[_0x1b82('0x25')]=qs[_0x1b82('0x25')](_0x429a25['query'][_0x1b82('0x25')]);_0x60a3e1['offset']=qs[_0x1b82('0x22')](_0x429a25[_0x1b82('0x43')]['offset']);}_0x60a3e1[_0x1b82('0x4a')]=qs['sort'](_0x429a25[_0x1b82('0x43')][_0x1b82('0x4b')]);_0x60a3e1[_0x1b82('0x4c')]=qs[_0x1b82('0x4d')](_[_0x1b82('0x4e')](_0x429a25[_0x1b82('0x43')],_0x19c7ad['filters']),_0x120b35);var _0x5e8779=[];var _0xe2ad3e=squel[_0x1b82('0x4f')]()[_0x1b82('0x50')]('id')[_0x1b82('0x50')](_0x1b82('0x2a'))[_0x1b82('0x50')](_0x1b82('0x51'))[_0x1b82('0x52')]('tools_tags');var _0x4cdcfe=squel['select']()[_0x1b82('0x50')](_0x1b82('0x53'))[_0x1b82('0x50')](_0x1b82('0x54'))[_0x1b82('0x50')](_0x1b82('0x55'))[_0x1b82('0x52')]('user_has_chat_interactions','ui')[_0x1b82('0x56')](_0x1b82('0x57'),'u',_0x1b82('0x58'));var _0x42d3e1=squel[_0x1b82('0x4f')]()[_0x1b82('0x52')](_0x1b82('0x59'),'i')[_0x1b82('0x56')]('cm_contacts','c',_0x1b82('0x5a'))[_0x1b82('0x56')](_0x1b82('0x57'),'o',_0x1b82('0x5b'))[_0x1b82('0x56')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x1b82('0x56')](_0x1b82('0x5c'),'me',_0x1b82('0x5d'))[_0x1b82('0x56')]('chat_interaction_has_tags','it',_0x1b82('0x5e'))[_0x1b82('0x56')](_0x1b82('0x5f'),'t',_0x1b82('0x60'));var _0x152f84=squel[_0x1b82('0x61')]();var _0x3e591a=[];var _0x38e573=squel[_0x1b82('0x61')]();var _0x23a124;if(_0x429a25['query'][_0x1b82('0x62')]){_0x23a124=as[_0x1b82('0x63')](_0x429a25['query'][_0x1b82('0x62')]);var _0x33ee1c=_0x23a124[_0x1b82('0x64')];for(var _0x2a5435=0x0;_0x2a5435<_0x23a124['conditions'][_0x1b82('0x47')];_0x2a5435++){var _0x29bcce=_0x23a124[_0x1b82('0x65')][_0x2a5435];var _0x138723='i';var _0x3c0bef=_[_0x1b82('0x66')](_0x120b35,['name',_0x29bcce[_0x1b82('0x50')]]);if(!_0x3c0bef){switch(_0x29bcce['field']){case _0x1b82('0x67'):if(_0x29bcce['value']==0x1){_0x42d3e1[_0x1b82('0x68')]('`'+_0x29bcce[_0x1b82('0x50')]+_0x1b82('0x69'));}else{_0x42d3e1[_0x1b82('0x68')]('`'+_0x29bcce[_0x1b82('0x50')]+_0x1b82('0x6a'));}break;case _0x1b82('0x6b'):if(_0x29bcce['operator']===_0x1b82('0x6c')){if(_0x29bcce[_0x1b82('0x6d')][_0x1b82('0x33')]('\x20')[_0x1b82('0x47')]>0x1){_0x152f84[_0x33ee1c](_0x1b82('0x6e'),qs[_0x1b82('0x6f')](_0x29bcce[_0x1b82('0x6d')]),null);}else{var _0xa763a3='%'+_0x29bcce[_0x1b82('0x6d')]+'%';_0x152f84[_0x33ee1c](_0x1b82('0x70'),_0xa763a3,_0xa763a3,_0xa763a3);}}else{_0x3c0bef=_[_0x1b82('0x66')](_0x120b35,[_0x1b82('0x2a'),_0x1b82('0x71')]);_0x29bcce['field']=_0x1b82('0x71');_0x68b4fb=as[_0x1b82('0x72')](_0x138723,_0x3c0bef[_0x1b82('0x73')],_0x29bcce);_0x152f84[_0x33ee1c](_0x68b4fb['text'],_0x68b4fb[_0x1b82('0x6d')][_0x1b82('0x74')],_0x68b4fb['value'][_0x1b82('0x20')]);}break;case _0x1b82('0x75'):var _0x1a3bed=_0x29bcce['value']['split'](',')[_0x1b82('0x30')](function(_0x3b2da4){return Number(_0x3b2da4);});_0x1a3bed[_0x1b82('0x34')](function(_0x3e8db4){_0x38e573['or'](_0x1b82('0x76'),'%,'+_0x3e8db4+',%');});_0x3e591a=_['union'](_0x3e591a,_0x1a3bed);break;case _0x1b82('0x77'):if(_0x29bcce['operator']===_0x1b82('0x6c')){_0x152f84[_0x33ee1c](_0x1b82('0x78'),'%'+_0x29bcce[_0x1b82('0x6d')]+'%',null);}else{_0x3c0bef=_[_0x1b82('0x66')](_0x120b35,[_0x1b82('0x2a'),_0x1b82('0x3c')]);_0x29bcce[_0x1b82('0x50')]=_0x1b82('0x3c');_0x68b4fb=as[_0x1b82('0x72')](_0x138723,_0x3c0bef[_0x1b82('0x73')],_0x29bcce);_0x152f84[_0x33ee1c](_0x68b4fb[_0x1b82('0x79')],_0x68b4fb['value'][_0x1b82('0x74')],_0x68b4fb['value']['end']);}break;case _0x1b82('0x2b'):_0x68b4fb=as[_0x1b82('0x72')]('me',null,_0x29bcce);_0x152f84[_0x33ee1c](_0x68b4fb[_0x1b82('0x79')],_0x68b4fb[_0x1b82('0x6d')][_0x1b82('0x74')],_0x68b4fb[_0x1b82('0x6d')][_0x1b82('0x20')]);break;}}else{var _0x68b4fb=as[_0x1b82('0x72')](_0x138723,_0x3c0bef[_0x1b82('0x73')],_0x29bcce);_0x152f84[_0x33ee1c](_0x68b4fb['text'],_0x68b4fb[_0x1b82('0x6d')]['start'],_0x68b4fb[_0x1b82('0x6d')]['end']);}}}else{var _0x3bd27c=_(_0x429a25[_0x1b82('0x43')])[_0x1b82('0x7a')]()[_0x1b82('0x30')](function(_0x1d3b4b){return _['some'](_0x120b35,[_0x1b82('0x2a'),_0x1d3b4b])?_0x1d3b4b:undefined;})['compact']()['value']();if(!_[_0x1b82('0x7b')](_0x3bd27c)){_0x3bd27c[_0x1b82('0x34')](function(_0x1a4826){if(_0x1a4826==='ChatWebsiteId'){_0x42d3e1[_0x1b82('0x4c')]('i.ChatWebsiteId\x20IN\x20?',[][_0x1b82('0x7c')](_0x429a25['query'][_0x1a4826]));}else if(_0x1a4826===_0x1b82('0x7d')){var _0x20900d=JSON[_0x1b82('0x7e')](_0x429a25[_0x1b82('0x43')][_0x1a4826])['$gte'];var _0x46cae4=JSON['parse'](_0x429a25[_0x1b82('0x43')][_0x1a4826])[_0x1b82('0x7f')];_0x42d3e1[_0x1b82('0x4c')](_0x1b82('0x80'),_0x20900d,_0x46cae4);}else{if(_0x429a25[_0x1b82('0x43')][_0x1a4826]==='null'){_0x42d3e1[_0x1b82('0x4c')]('i.'+_0x1a4826+'\x20IS\x20NULL');}else{_0x42d3e1[_0x1b82('0x4c')]('i.'+_0x1a4826+'\x20=\x20?',_0x429a25[_0x1b82('0x43')][_0x1a4826]);}}});}if(_0x429a25[_0x1b82('0x43')][_0x1b82('0x81')]){if(_0x429a25['query'][_0x1b82('0x81')]==0x1){_0x42d3e1[_0x1b82('0x68')](_0x1b82('0x82'));}else{_0x42d3e1['having'](_0x1b82('0x83'));}}if(_0x429a25[_0x1b82('0x43')][_0x1b82('0x84')]){_0x3e591a=_[_0x1b82('0x85')](_0x429a25[_0x1b82('0x43')]['tag'])?_0x429a25[_0x1b82('0x43')]['tag']:new Array(_0x429a25['query'][_0x1b82('0x84')]);_0x3e591a['forEach'](function(_0x3f989f){_0x38e573['or'](_0x1b82('0x76'),'%,'+_0x3f989f+',%');});}if(_0x429a25['query'][_0x1b82('0x86')]){var _0x391207=_0x429a25['query']['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1b82('0x87')](_0x391207)){_0x152f84['or'](_0x1b82('0x88'),_0x391207+'%');}else{_0x152f84['or'](_0x1b82('0x89'),qs['getFullTextValue'](_0x391207))['or'](_0x1b82('0x8a'),_0x391207+'%');}}}_0x42d3e1['where'](_0x152f84);_0x42d3e1[_0x1b82('0x8b')](_0x1b82('0x8c'));var _0x96910f={'type':db[_0x1b82('0x8d')]['QueryTypes'][_0x1b82('0x8e')],'raw':!![]};var _0x2257fb=_0x42d3e1[_0x1b82('0x8f')]();_0x2257fb[_0x1b82('0x50')](_0x1b82('0x8c'));_0x2257fb[_0x1b82('0x50')](_0x1b82('0x90'),'unreadMessages');if(_0x60a3e1['order']){_0x60a3e1[_0x1b82('0x4a')]['forEach'](function(_0x4eb0d4){var _0x1228d3=_0x4eb0d4[0x0]===_0x1b82('0x91')?_0x4eb0d4[0x0]:'i.'+_0x4eb0d4[0x0];_0x42d3e1[_0x1b82('0x4a')](_0x1228d3,_0x4eb0d4[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1b82('0x7b')](_0x3e591a)){_0x42d3e1['having'](_0x38e573);_0x2257fb[_0x1b82('0x4c')](_0x1b82('0x92'),_0x3e591a);}BPromise[_0x1b82('0x93')]()[_0x1b82('0x15')](function(){if(!_0x23a124){if(_0x429a25['query'][_0x1b82('0x94')])return;_0x2257fb['where'](_0x1b82('0x95'));_0x42d3e1[_0x1b82('0x4c')](_0x1b82('0x95'));return;}if(_0x429a25['user']['role']!==_0x1b82('0x96'))return;return _0x429a25[_0x1b82('0x97')][_0x1b82('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a211b){if(_[_0x1b82('0x7b')](_0x5a211b)){_0x2257fb[_0x1b82('0x4c')](_0x1b82('0x99'));_0x42d3e1[_0x1b82('0x4c')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x2257fb[_0x1b82('0x4c')](_0x1b82('0x9a'),_['map'](_0x5a211b,'id'));_0x42d3e1['where'](_0x1b82('0x9a'),_[_0x1b82('0x30')](_0x5a211b,'id'));}});})[_0x1b82('0x15')](function(){if(_0x429a25[_0x1b82('0x97')][_0x1b82('0x9b')]===_0x1b82('0x96')&&!_0x23a124&&!_0x429a25['query'][_0x1b82('0x94')])return[];return db['sequelize'][_0x1b82('0x43')](_0x2257fb['toString'](),_0x96910f);})[_0x1b82('0x15')](function(_0x293828){_0x192ce3[_0x1b82('0x24')]=_0x293828[_0x1b82('0x47')];if(_0x192ce3[_0x1b82('0x24')]===0x0)return[];return db['sequelize'][_0x1b82('0x43')](_0xe2ad3e['toString'](),_0x96910f)[_0x1b82('0x15')](function(_0x523639){_0x5e8779=_[_0x1b82('0x9c')](_0x523639,'id');_0x96910f=_[_0x1b82('0x9d')](_0x96910f,{'model':db[_0x1b82('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x429a25['query'][_0x1b82('0x46')]){_0x60a3e1[_0x1b82('0x45')][_0x1b82('0x34')](function(_0x3869d2){_0x42d3e1['field']('i.'+_0x3869d2);});}else{_0x42d3e1[_0x1b82('0x50')](_0x1b82('0x90'),_0x1b82('0x67'));_0x42d3e1[_0x1b82('0x50')](_0x1b82('0x9e'),_0x1b82('0x9f'));_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xa0'),'Account.mandatoryDisposition');_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xa1'),_0x1b82('0x91'));_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xa2'));_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xa3'),_0x1b82('0xa4'));_0x42d3e1[_0x1b82('0x50')]('c.lastName',_0x1b82('0xa5'));_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xa6'),_0x1b82('0xa7'));_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xa8'),_0x1b82('0xa9'));_0x42d3e1['field'](_0x1b82('0xaa'),'Contact.mobile');_0x42d3e1[_0x1b82('0x50')]('c.fax',_0x1b82('0xab'));_0x42d3e1[_0x1b82('0x50')]('o.fullname',_0x1b82('0xac'));_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xad'),'Owner.internal');_0x42d3e1[_0x1b82('0x50')](_0x1b82('0xae'),'TagIds');}if(_0x60a3e1[_0x1b82('0x25')])_0x42d3e1[_0x1b82('0x25')](_0x60a3e1[_0x1b82('0x25')]);if(_0x60a3e1[_0x1b82('0x22')])_0x42d3e1['offset'](_0x60a3e1[_0x1b82('0x22')]);return db[_0x1b82('0xaf')][_0x1b82('0x43')](_0x42d3e1[_0x1b82('0xb0')](),_0x96910f);})[_0x1b82('0x15')](function(_0x4e92a8){if(_0x4e92a8[_0x1b82('0x47')]>0x0)_0x4cdcfe[_0x1b82('0x4c')](_0x1b82('0xb1'),_[_0x1b82('0x30')](_0x4e92a8,'id'));return db[_0x1b82('0xaf')][_0x1b82('0x43')](_0x4cdcfe[_0x1b82('0xb0')](),_0x96910f)[_0x1b82('0x15')](function(_0x5ef041){var _0x42dbb3=_['groupBy'](_0x5ef041,_0x1b82('0xb2'));var _0x57ac8b=[];_0x4e92a8[_0x1b82('0x34')](function(_0x2b50c0){_0x57ac8b['push'](updateChatInteraction(_0x2b50c0,_0x5e8779,_0x42dbb3));});return BPromise['all'](_0x57ac8b);});});})[_0x1b82('0x15')](function(_0x3d5ee6){_0x192ce3['rows']=_0x3d5ee6;return _0x192ce3;})['then'](respondWithFilteredResult(_0x1d24d6,_0x60a3e1))[_0x1b82('0x1e')](handleError(_0x1d24d6,null));};exports['show']=function(_0x588deb,_0x31b018){var _0xf62c10={'raw':![],'where':{'id':_0x588deb[_0x1b82('0xb3')]['id']}},_0x2f7fa5={};_0x2f7fa5[_0x1b82('0x44')]=_[_0x1b82('0x7a')](db[_0x1b82('0x40')][_0x1b82('0x41')]);_0x2f7fa5[_0x1b82('0x43')]=_['keys'](_0x588deb[_0x1b82('0x43')]);_0x2f7fa5[_0x1b82('0x4d')]=_[_0x1b82('0xb4')](_0x2f7fa5[_0x1b82('0x44')],_0x2f7fa5[_0x1b82('0x43')]);_0xf62c10[_0x1b82('0x45')]=_['intersection'](_0x2f7fa5[_0x1b82('0x44')],qs[_0x1b82('0x46')](_0x588deb['query'][_0x1b82('0x46')]));_0xf62c10['attributes']=_0xf62c10[_0x1b82('0x45')][_0x1b82('0x47')]?_0xf62c10[_0x1b82('0x45')]:_0x2f7fa5[_0x1b82('0x44')];if(_0x588deb[_0x1b82('0x43')][_0x1b82('0xb5')]){_0xf62c10[_0x1b82('0xb6')]=[{'all':!![]}];}_0xf62c10=_[_0x1b82('0x9d')]({},_0xf62c10,_0x588deb['options']);return db[_0x1b82('0x40')][_0x1b82('0x66')](_0xf62c10)[_0x1b82('0x15')](handleEntityNotFound(_0x31b018,null))[_0x1b82('0x15')](respondWithResult(_0x31b018,null))[_0x1b82('0x1e')](handleError(_0x31b018,null));};exports[_0x1b82('0xb7')]=function(_0x3aac5e,_0x5cb765){return db[_0x1b82('0x40')][_0x1b82('0xb7')](_0x3aac5e[_0x1b82('0x2b')],{})[_0x1b82('0x15')](respondWithResult(_0x5cb765,0xc9))[_0x1b82('0x1e')](handleError(_0x5cb765,null));};exports['update']=function(_0x5aad3c,_0x5dedcc){if(_0x5aad3c[_0x1b82('0x2b')]['id']){delete _0x5aad3c[_0x1b82('0x2b')]['id'];}return db[_0x1b82('0x40')][_0x1b82('0x66')]({'where':{'id':_0x5aad3c[_0x1b82('0xb3')]['id']}})[_0x1b82('0x15')](handleEntityNotFound(_0x5dedcc,null))[_0x1b82('0x15')](saveUpdates(_0x5aad3c[_0x1b82('0x2b')],null))[_0x1b82('0x15')](respondWithResult(_0x5dedcc,null))[_0x1b82('0x1e')](handleError(_0x5dedcc,null));};exports[_0x1b82('0x29')]=function(_0x58655d,_0x2f5754){return db[_0x1b82('0x40')]['find']({'where':{'id':_0x58655d[_0x1b82('0xb3')]['id']}})['then'](handleEntityNotFound(_0x2f5754,null))[_0x1b82('0x15')](removeEntity(_0x2f5754,null))[_0x1b82('0x1e')](handleError(_0x2f5754,null));};exports[_0x1b82('0xb8')]=function(_0x55014e,_0xb2d45e){return db[_0x1b82('0x40')][_0x1b82('0xb8')]()[_0x1b82('0x15')](respondWithResult(_0xb2d45e,null))[_0x1b82('0x1e')](handleError(_0xb2d45e,null));};exports[_0x1b82('0xb9')]=function(_0x5f554e,_0x1b0d41){var _0x3a5365=_0x5f554e['params']['id'];var _0x3e493b;var _0x27da5e;var _0x5e4427;return db[_0x1b82('0x40')][_0x1b82('0xba')]({'where':{'id':_0x3a5365}})['then'](function(_0x312d90){_0x3e493b=_0x312d90;return db[_0x1b82('0xbb')][_0x1b82('0xba')]({'where':{'id':_0x312d90[_0x1b82('0x94')]},'attributes':['id',_0x1b82('0xbc'),'vidaooEscalation',_0x1b82('0xbd'),'vidaooNote',_0x1b82('0xbe')],'raw':!![]});})[_0x1b82('0x15')](function(_0x8b0b24){if(_0x8b0b24&&_0x8b0b24['vidaooApiKey']&&_0x8b0b24[_0x1b82('0xbf')]){_0x27da5e=_0x8b0b24;var _0xe0de93={'interaction':{'id':_0x3a5365},'agent':{'id':_0x5f554e[_0x1b82('0x97')]['id'],'name':_0x5f554e[_0x1b82('0x97')][_0x1b82('0x2a')],'fullname':_0x5f554e[_0x1b82('0x97')]['fullname'],'email':_0x5f554e[_0x1b82('0x97')][_0x1b82('0xc0')]},'contact':_0x5f554e[_0x1b82('0x2b')][_0x1b82('0x2c')],'account':_0x5f554e[_0x1b82('0x2b')]['account']};var _0x2f3278={'rejectUnauthorized':![],'method':_0x1b82('0xc1'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x8b0b24[_0x1b82('0xbc')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5f554e['user']['email']],'buttons':null,'topic':_0x27da5e[_0x1b82('0xbd')],'note':_['isNull'](_0x27da5e[_0x1b82('0xc2')])?null:getMustacheRender(_0x27da5e[_0x1b82('0xc2')],_0xe0de93),'metadata':null},'redirect':_0x1b82('0xc3'),'json':!![]};try{if(!_[_0x1b82('0xc4')](_0x27da5e['vidaooMetadata'])){var _0x325d82=getMustacheRender(_0x27da5e[_0x1b82('0xbe')],_0xe0de93);var _0x27369e=JSON[_0x1b82('0x7e')](_0x325d82);_0x2f3278['body'][_0x1b82('0xc5')]=_0x27369e;}}catch(_0x5ebb52){throw new db[(_0x1b82('0x8d'))][(_0x1b82('0xc6'))](_0x1b82('0xc7'));}return rp(_0x2f3278);}else{throw new db[(_0x1b82('0x8d'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x35e91c){_0x5e4427=_0x35e91c;if(_0x5e4427['id']){var _0x219d2d={'body':_0x5e4427[_0x1b82('0xc8')],'ChatWebsiteId':_0x27da5e['id'],'ChatInteractionId':_0x3e493b['id'],'direction':'out','UserId':_0x5f554e[_0x1b82('0x97')]['id']};return db[_0x1b82('0xc9')][_0x1b82('0xb7')](_0x219d2d,{});}else{throw new db[(_0x1b82('0x8d'))][(_0x1b82('0xc6'))](_0x1b82('0xca'));}})['then'](function(){return _0x3e493b[_0x1b82('0xcb')]({'vidaooSessionId':_0x5e4427['id']});})[_0x1b82('0x15')](respondWithResult(_0x1b0d41,null))[_0x1b82('0x1e')](handleError(_0x1b0d41,null));};exports['customUpdate']=function(_0x1f3080,_0x544e2d){if(_0x1f3080[_0x1b82('0x2b')]['id']){delete _0x1f3080['body']['id'];}return db[_0x1b82('0x40')][_0x1b82('0x66')]({'where':{'id':_0x1f3080[_0x1b82('0xb3')]['id']},'include':[{'model':db['CmContact'],'as':_0x1b82('0x6b')}]})['then'](handleEntityNotFound(_0x544e2d,null))['then'](saveUpdates(_0x1f3080[_0x1b82('0x2b')],null))['then'](respondWithResult(_0x544e2d,null))[_0x1b82('0x1e')](handleError(_0x544e2d,null));};exports['abandon']=function(_0x3bc6b6,_0x2b6c76){if(_0x3bc6b6[_0x1b82('0x2b')]['id']){delete _0x3bc6b6[_0x1b82('0x2b')]['id'];}return db[_0x1b82('0x40')][_0x1b82('0x66')]({'where':{'id':_0x3bc6b6['params']['id']}})[_0x1b82('0x15')](function(_0x12b9a5){if(!_0x12b9a5){logger[_0x1b82('0x1a')](_0x1b82('0xcc'),_0x1b82('0xcd'),0x194,_0x1b82('0xce'));_0x2b6c76[_0x1b82('0x1f')](0x194);}else{if(_0x12b9a5[_0x1b82('0x3c')]){throw new db[(_0x1b82('0x8d'))][(_0x1b82('0xc6'))](_0x1b82('0xcf'));}}return _0x12b9a5;})[_0x1b82('0x15')](function(_0x58fda2){if(_0x58fda2){return _0x58fda2[_0x1b82('0x28')]({'closed':_0x3bc6b6[_0x1b82('0x2b')][_0x1b82('0x3b')],'disposition':_0x3bc6b6[_0x1b82('0x2b')][_0x1b82('0x3d')]})['then'](function(_0x27d092){return _0x27d092;});}})[_0x1b82('0x15')](function(){return respondWithRpcPromise(_0x1b82('0xd0'),_0x1b82('0xcd'),_0x3bc6b6[_0x1b82('0x2b')],client9004);})[_0x1b82('0x15')](respondWithResult(_0x2b6c76,null))[_0x1b82('0x1e')](handleError(_0x2b6c76,null));};exports[_0x1b82('0xd1')]=function(_0x230ef2,_0x41fb0d){_0x230ef2[_0x1b82('0x2b')][_0x1b82('0x2a')]=_0x230ef2[_0x1b82('0xd2')][_0x1b82('0xd3')];_0x230ef2[_0x1b82('0x2b')][_0x1b82('0xd4')]=_0x230ef2[_0x1b82('0xd2')]['filename'];_0x230ef2[_0x1b82('0x2b')][_0x1b82('0x73')]=_0x230ef2[_0x1b82('0xd2')][_0x1b82('0xd5')];return db['Attachment'][_0x1b82('0xb7')](_0x230ef2['body'])['then'](respondWithResult(_0x41fb0d,0xc9))['catch'](handleError(_0x41fb0d,null));};exports[_0x1b82('0xd6')]=function(_0x2127da,_0x44f101){return db[_0x1b82('0x40')][_0x1b82('0xba')]({'where':{'id':_0x2127da[_0x1b82('0xb3')]['id']},'raw':!![]})[_0x1b82('0x15')](handleEntityNotFound(_0x44f101,null))[_0x1b82('0x15')](function(_0x2ac3d7){if(_0x2ac3d7){if(_0x2ac3d7['closed']){return _0x44f101[_0x1b82('0x21')](0x193)[_0x1b82('0xd7')]({'status':0x193,'message':_0x1b82('0xd8')});}return db[_0x1b82('0xd9')][_0x1b82('0xba')]({'where':{'id':_0x2127da['query'][_0x1b82('0xda')]},'raw':!![]})[_0x1b82('0x15')](handleEntityNotFound(_0x44f101,null));}})['then'](function(_0x1e681c){if(_0x1e681c){var _0x5d9c15=_0x1e681c[_0x1b82('0xdb')]!==null;var _0x32d6c5=path['join'](config[_0x1b82('0xdc')],_0x1b82('0xdd'));if(_0x5d9c15){_0x32d6c5=path[_0x1b82('0xde')](_0x32d6c5,_0x1b82('0xdf'));}var _0x2998e0=path[_0x1b82('0xde')](_0x32d6c5,_0x1e681c[_0x1b82('0xd4')]);return _0x44f101[_0x1b82('0xe0')](_0x2998e0);}})['catch'](handleError(_0x44f101,null));};exports[_0x1b82('0xe1')]=function(_0x5bc153,_0x235e79){var _0x58ae14=null;var _0xd51f0b=null;var _0x5700f7=null;if(_0x5bc153[_0x1b82('0x2b')]['id']){delete _0x5bc153[_0x1b82('0x2b')]['id'];}if(_0x5bc153[_0x1b82('0x2b')][_0x1b82('0xe2')]){_0x5700f7=path['join'](config['root'],_0x1b82('0xe3'),util[_0x1b82('0xe4')](_0x1b82('0xe5'),Date[_0x1b82('0xe6')]()));_0x5bc153[_0x1b82('0x2b')][_0x1b82('0xe7')]=_0x5700f7;}return db[_0x1b82('0x40')][_0x1b82('0x66')]({'where':{'id':_0x5bc153[_0x1b82('0xb3')]['id']},'include':[{'model':db[_0x1b82('0xc9')],'as':_0x1b82('0xe8'),'include':[{'model':db[_0x1b82('0x77')],'as':_0x1b82('0x77')}]}]})[_0x1b82('0x15')](handleEntityNotFound(_0x235e79,null))[_0x1b82('0x15')](saveUpdates(_0x5bc153[_0x1b82('0x2b')],null))[_0x1b82('0x15')](function(_0x8602e1){if(_0x8602e1){_0x58ae14=_0x8602e1;return db['ChatWebsite'][_0x1b82('0x66')]({'where':{'id':_0x58ae14['ChatWebsiteId']}});}})['then'](function(_0x564f3d){if(_0x564f3d){_0xd51f0b=_0x564f3d;return db[_0x1b82('0xe9')][_0x1b82('0x66')]({'where':{'id':_0x58ae14[_0x1b82('0x71')]}});}})[_0x1b82('0x15')](function(_0x238f03){if(_0x238f03){if(_0x5700f7){var _0x2c0749=null;for(var _0x1c0138=0x1;_0x1c0138<_0x58ae14[_0x1b82('0xe8')][_0x1b82('0x47')];++_0x1c0138){_0x2c0749=_0x58ae14[_0x1b82('0xe8')][_0x1c0138];var _0x29374b=_0x2c0749[_0x1b82('0x3c')]?util[_0x1b82('0xe4')](_0x1b82('0xea'),_0xd51f0b[_0x1b82('0xeb')],_0x2c0749[_0x1b82('0x3c')]):_0x1b82('0xec');var _0x599dcd=_0x5bc153[_0x1b82('0x2b')][_0x1b82('0xed')]||util['format'](_0x1b82('0xea'),_0x1b82('0xee'),_0x2c0749[_0x1b82('0x71')]);switch(_0xd51f0b['agentIdentifier']){case _0x1b82('0xef'):_0x29374b=_0x2c0749[_0x1b82('0x3c')]?util[_0x1b82('0xe4')](_0x1b82('0xea'),_0xd51f0b[_0x1b82('0xeb')],_0x2c0749[_0x1b82('0x3c')]):_0x1b82('0xec');break;case _0x1b82('0xf0'):_0x29374b=_0x2c0749['UserId']?_0x2c0749[_0x1b82('0x77')][_0x1b82('0xf1')]||_0x2c0749[_0x1b82('0x77')]['fullname']:_0x1b82('0xec');break;case _0x1b82('0xf2'):_0x29374b=_0x2c0749[_0x1b82('0x3c')]?_0x2c0749['User'][_0x1b82('0xf3')]:_0x1b82('0xec');break;default:_0x29374b=_0x2c0749[_0x1b82('0x3c')]?util[_0x1b82('0xe4')](_0x1b82('0xea'),_0xd51f0b[_0x1b82('0xeb')],_0x2c0749['UserId']):_0x1b82('0xec');}var _0x4a97b4=util[_0x1b82('0xe4')](_0x1b82('0xf4'),moment(_0x2c0749[_0x1b82('0x7d')])[_0x1b82('0xe4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2c0749[_0x1b82('0xf5')]==='in'?_0x599dcd:_0x29374b,_0x2c0749[_0x1b82('0x2b')]);if(!_0x2c0749[_0x1b82('0xf6')]){fs[_0x1b82('0xf7')](_0x5700f7,_0x4a97b4);}}return db['MailAccount'][_0x1b82('0xba')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1b82('0xf8'),'raw':!![],'include':[{'model':db[_0x1b82('0xf9')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x1b82('0x15')](function(_0x94580c){if(!_0x94580c||!_0x94580c[_0x1b82('0xf8')]||!_0x5bc153[_0x1b82('0x2b')])return _0x58ae14;var _0x5ded06=_0x94580c[_0x1b82('0xfa')]();return respondWithRpcPromise(_0x1b82('0xfb'),_0x1b82('0xfc'),{'account':_0x5ded06,'message':{'from':util[_0x1b82('0xe4')](_0x1b82('0xfd'),_0x94580c[_0x1b82('0x2a')],_0x94580c[_0x1b82('0xc0')]||_0x94580c[_0x1b82('0xf8')][_0x1b82('0x97')]),'to':_0x5bc153[_0x1b82('0x2b')][_0x1b82('0xe2')],'subject':_0x1b82('0xfe'),'text':util[_0x1b82('0xe4')](_0x1b82('0xff'),_0x5bc153['body'][_0x1b82('0xe2')]),'attachments':[{'path':_0x5700f7}]}})[_0x1b82('0x15')](function(){return _0x58ae14;})[_0x1b82('0x1e')](function(_0x49c6d7){logger[_0x1b82('0x1a')](_0x49c6d7);});})[_0x1b82('0x15')](respondWithStatusCode(_0x235e79,0xc8))[_0x1b82('0x1e')](handleError(_0x235e79,null));};exports[_0x1b82('0x100')]=function(_0xb6da23,_0x27488b){return db[_0x1b82('0xc9')][_0x1b82('0x66')]({'where':{'id':_0xb6da23[_0x1b82('0xb3')]['id']}})[_0x1b82('0x15')](handleEntityNotFound(_0x27488b,null))[_0x1b82('0x15')](function(_0x4ce97a){if(_0x4ce97a){return _0x4ce97a[_0x1b82('0x100')](_0xb6da23[_0x1b82('0x2b')][_0x1b82('0x101')],_[_0x1b82('0x102')](_0xb6da23[_0x1b82('0x2b')],['ids','id'])||{});}})[_0x1b82('0x15')](respondWithResult(_0x27488b,null))[_0x1b82('0x1e')](handleError(_0x27488b,null));};exports[_0x1b82('0x103')]=function(_0x5cdc48,_0x32d235){var _0x447e72={'raw':![],'where':{}};var _0x635572={};var _0x15b233={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x1b82('0xba')]({'where':{'id':_0x5cdc48[_0x1b82('0xb3')]['id']}})['then'](handleEntityNotFound(_0x32d235,null))[_0x1b82('0x15')](function(_0x274f82){if(_0x274f82){_0x635572[_0x1b82('0x44')]=_[_0x1b82('0x7a')](db[_0x1b82('0xc9')][_0x1b82('0x41')]);_0x635572['query']=_[_0x1b82('0x7a')](_0x5cdc48['query']);_0x635572[_0x1b82('0x4d')]=_[_0x1b82('0xb4')](_0x635572[_0x1b82('0x44')],_0x635572[_0x1b82('0x43')]);_0x447e72[_0x1b82('0x45')]=_[_0x1b82('0xb4')](_0x635572[_0x1b82('0x44')],qs[_0x1b82('0x46')](_0x5cdc48['query']['fields']));_0x447e72['attributes']=_0x447e72[_0x1b82('0x45')][_0x1b82('0x47')]?_0x447e72[_0x1b82('0x45')]:_0x635572[_0x1b82('0x44')];if(!_0x5cdc48['query'][_0x1b82('0x48')]('nolimit')){_0x447e72[_0x1b82('0x25')]=qs[_0x1b82('0x25')](_0x5cdc48['query'][_0x1b82('0x25')]);_0x447e72['offset']=qs[_0x1b82('0x22')](_0x5cdc48['query'][_0x1b82('0x22')]);}_0x447e72[_0x1b82('0x4a')]=qs['sort'](_0x5cdc48[_0x1b82('0x43')][_0x1b82('0x4b')]);_0x447e72[_0x1b82('0x4c')]=qs[_0x1b82('0x4d')](_[_0x1b82('0x4e')](_0x5cdc48[_0x1b82('0x43')],_0x635572[_0x1b82('0x4d')]));_0x447e72[_0x1b82('0x4c')]['ChatInteractionId']=_0x274f82['id'];if(_0x5cdc48[_0x1b82('0x43')][_0x1b82('0x86')]){_0x447e72[_0x1b82('0x4c')]=_['merge'](_0x447e72['where'],{'$or':_[_0x1b82('0x30')](_0x447e72[_0x1b82('0x45')],function(_0x14ef8e){var _0x4c5c0f={};_0x4c5c0f[_0x14ef8e]={'$like':'%'+_0x5cdc48[_0x1b82('0x43')][_0x1b82('0x86')]+'%'};return _0x4c5c0f;})});}if(_0x5cdc48[_0x1b82('0x43')][_0x1b82('0x104')]){var _0x3dca3a=_0x5cdc48[_0x1b82('0x43')][_0x1b82('0x104')][_0x1b82('0x33')](',');var _0x3504a1={};_0x3504a1[_0x3dca3a[0x0]]={'$gte':moment(_0x3dca3a[0x1])[_0x1b82('0xe4')](_0x1b82('0x105'))};_0x447e72[_0x1b82('0x4c')]=_[_0x1b82('0x9d')](_0x447e72[_0x1b82('0x4c')],_0x3504a1);}_0x447e72=_['merge']({},_0x447e72,_0x5cdc48['options']);return db[_0x1b82('0xc9')][_0x1b82('0x24')]({'where':_0x447e72[_0x1b82('0x4c')]})[_0x1b82('0x15')](function(_0xb88dda){_0x15b233[_0x1b82('0x24')]=_0xb88dda;if(_0x5cdc48[_0x1b82('0x43')][_0x1b82('0xb5')]){_0x447e72['include']=[{'all':!![]}];}return db['ChatMessage'][_0x1b82('0x106')](_0x447e72);})[_0x1b82('0x15')](function(_0x16e810){_0x15b233[_0x1b82('0x107')]=_0x16e810;return _0x15b233;});}})[_0x1b82('0x15')](respondWithFilteredResult(_0x32d235,_0x447e72))['catch'](handleError(_0x32d235,null));};exports[_0x1b82('0x108')]=function(_0x5148dc,_0x1a0e44){var _0x2c8bf4={'where':{}},_0x8ea60c={},_0x489187={'count':0x0,'rows':[]};return db[_0x1b82('0x40')][_0x1b82('0xba')]({'where':{'id':_0x5148dc[_0x1b82('0xb3')]['id']}})[_0x1b82('0x15')](handleEntityNotFound(_0x1a0e44,null))[_0x1b82('0x15')](function(_0x40c685){if(_0x40c685){_0x8ea60c[_0x1b82('0x44')]=_['keys'](db[_0x1b82('0xc9')]['rawAttributes']);_0x8ea60c['query']=_[_0x1b82('0x7a')](_0x5148dc[_0x1b82('0x43')]);_0x8ea60c[_0x1b82('0x4d')]=_[_0x1b82('0xb4')](_0x8ea60c[_0x1b82('0x44')],_0x8ea60c[_0x1b82('0x43')]);_0x2c8bf4['attributes']=_['intersection'](_0x8ea60c[_0x1b82('0x44')],qs[_0x1b82('0x46')](_0x5148dc['query'][_0x1b82('0x46')]));_0x2c8bf4[_0x1b82('0x45')]=_0x2c8bf4[_0x1b82('0x45')]['length']?_0x2c8bf4[_0x1b82('0x45')]:_0x8ea60c[_0x1b82('0x44')];if(!_0x5148dc[_0x1b82('0x43')]['hasOwnProperty'](_0x1b82('0x49'))){_0x2c8bf4[_0x1b82('0x25')]=qs[_0x1b82('0x25')](_0x5148dc[_0x1b82('0x43')][_0x1b82('0x25')]);_0x2c8bf4[_0x1b82('0x22')]=qs[_0x1b82('0x22')](_0x5148dc[_0x1b82('0x43')]['offset']);}_0x2c8bf4[_0x1b82('0x4a')]=qs[_0x1b82('0x4b')](_0x5148dc[_0x1b82('0x43')][_0x1b82('0x4b')]);_0x2c8bf4[_0x1b82('0x4c')]=qs[_0x1b82('0x4d')](_[_0x1b82('0x4e')](_0x5148dc[_0x1b82('0x43')],_0x8ea60c[_0x1b82('0x4d')]));_0x2c8bf4[_0x1b82('0x4c')][_0x1b82('0xb2')]=_0x40c685['id'];if(_0x5148dc[_0x1b82('0x43')][_0x1b82('0x86')]){_0x2c8bf4[_0x1b82('0x4c')]=_[_0x1b82('0x9d')](_0x2c8bf4[_0x1b82('0x4c')],{'$or':_['map'](_0x2c8bf4[_0x1b82('0x45')],function(_0x1369e0){var _0x47c524={};_0x47c524[_0x1369e0]={'$like':'%'+_0x5148dc[_0x1b82('0x43')][_0x1b82('0x86')]+'%'};return _0x47c524;})});}_0x2c8bf4['where'][_0x1b82('0xf6')]=![];if(_0x5148dc[_0x1b82('0x43')]['id']){_0x2c8bf4[_0x1b82('0x4c')]['id']={'$gt':_0x5148dc[_0x1b82('0x43')]['id']};}_0x2c8bf4=_[_0x1b82('0x9d')]({},_0x2c8bf4,_0x5148dc['options']);return db[_0x1b82('0xc9')][_0x1b82('0x24')]({'where':_0x2c8bf4[_0x1b82('0x4c')]})[_0x1b82('0x15')](function(_0x4ab3d3){_0x489187[_0x1b82('0x24')]=_0x4ab3d3;_0x2c8bf4[_0x1b82('0xb6')]=[];if(_0x5148dc[_0x1b82('0x43')][_0x1b82('0x109')]){_0x2c8bf4['include'][_0x1b82('0x35')]({'model':db[_0x1b82('0x77')],'as':_0x1b82('0x77'),'attributes':['id','fullname',_0x1b82('0xf1')]});}if(_0x5148dc[_0x1b82('0x43')]['includeAll']){_0x2c8bf4[_0x1b82('0xb6')]=[{'all':!![]}];}return db[_0x1b82('0xc9')][_0x1b82('0x106')](_0x2c8bf4);})[_0x1b82('0x15')](function(_0x341b52){_0x489187[_0x1b82('0x107')]=_0x341b52;return _0x489187;});}})['then'](respondWithFilteredResult(_0x1a0e44,_0x2c8bf4))[_0x1b82('0x1e')](handleError(_0x1a0e44,null));};exports[_0x1b82('0x10a')]=function(_0x404297,_0x38f439){return db[_0x1b82('0x40')][_0x1b82('0x66')]({'where':{'id':_0x404297[_0x1b82('0xb3')]['id']}})[_0x1b82('0x15')](handleEntityNotFound(_0x38f439,null))[_0x1b82('0x15')](function(_0x2fbe3b){if(_0x2fbe3b){return _0x2fbe3b[_0x1b82('0x10b')](_0x404297[_0x1b82('0x2b')][_0x1b82('0x101')],_[_0x1b82('0x102')](_0x404297['body'],['ids','id'])||{})['spread'](function(){return db[_0x1b82('0x75')][_0x1b82('0x106')]({'attributes':['id',_0x1b82('0x2a'),_0x1b82('0x51')],'where':{'id':_0x404297[_0x1b82('0x2b')][_0x1b82('0x101')]}});})['then'](function(_0x23c0c8){socket[_0x1b82('0x10c')](_0x1b82('0x10d'),{'id':Number(_0x404297['params']['id']),'tags':_0x23c0c8||[]});return{'id':Number(_0x404297['params']['id']),'tags':_0x23c0c8||[]};});}})[_0x1b82('0x15')](respondWithResult(_0x38f439,null))[_0x1b82('0x1e')](handleError(_0x38f439,null));};exports[_0x1b82('0x10e')]=function(_0x48ed1c,_0x132da6){return db[_0x1b82('0x40')][_0x1b82('0x66')]({'where':{'id':_0x48ed1c[_0x1b82('0xb3')]['id']}})[_0x1b82('0x15')](handleEntityNotFound(_0x132da6,null))[_0x1b82('0x15')](function(_0x14018a){if(_0x14018a){return _0x14018a[_0x1b82('0x10e')](_0x48ed1c['query'][_0x1b82('0x101')]);}})['then'](respondWithStatusCode(_0x132da6,null))[_0x1b82('0x1e')](handleError(_0x132da6,null));};exports[_0x1b82('0xe0')]=function(_0x26a377,_0x4ffd8e){var _0x20f967=moment()[_0x1b82('0x10f')]()[_0x1b82('0xb0')]();var _0xd491d5=path[_0x1b82('0xde')](config['root'],_0x1b82('0x110'),_0x1b82('0x111'),_0x1b82('0x112'));var _0x164eb5=path[_0x1b82('0xde')](config[_0x1b82('0xdc')],_0x1b82('0x110'),_0x1b82('0x111'),'attachments');var _0x3a79f3=path['join'](_0xd491d5,_0x20f967);var _0x24bb32=util[_0x1b82('0xe4')](_0x1b82('0x113'),_0x26a377[_0x1b82('0xb3')]['id'],_0x20f967);var _0x4da468=path[_0x1b82('0xde')](_0xd491d5,_0x24bb32);var _0x2c49c7=[];_0x2c49c7['push']({'model':db[_0x1b82('0x77')],'as':_0x1b82('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x2c49c7[_0x1b82('0x35')]({'model':db[_0x1b82('0xe9')],'as':'Contact','attributes':['id',_0x1b82('0x114'),_0x1b82('0x115')],'raw':!![]});if(_0x26a377[_0x1b82('0x43')]['attachments']){_0x2c49c7[_0x1b82('0x35')]({'model':db[_0x1b82('0xd9')],'as':_0x1b82('0xd9'),'raw':!![]});}var _0x279446=[{'model':db['ChatMessage'],'as':_0x1b82('0xe8'),'attributes':['id',_0x1b82('0x2b'),_0x1b82('0x7d'),'direction','secret',_0x1b82('0x81')],'include':_0x2c49c7}];_0x279446[_0x1b82('0x35')]({'model':db[_0x1b82('0xbb')],'as':_0x1b82('0x116'),'attributes':['id',_0x1b82('0x2a')]});_0x279446[_0x1b82('0x35')]({'model':db['User'],'as':_0x1b82('0x117'),'attributes':['id',_0x1b82('0xf3')]});return db['ChatInteraction'][_0x1b82('0x66')]({'where':{'id':_0x26a377[_0x1b82('0xb3')]['id']},'include':_0x279446})[_0x1b82('0x15')](handleEntityNotFound(_0x4ffd8e,null))['then'](function(_0x254970){if(_0x254970){var _0x110559=_0x254970['get']({'plain':!![]});fs[_0x1b82('0x118')](_0x3a79f3);var _0x5cbdb0={'channel':'Chat','account':_0x110559[_0x1b82('0x116')][_0x1b82('0x2a')],'agent':_0x110559['Owner']?_0x110559[_0x1b82('0x117')][_0x1b82('0xf3')]:_0x1b82('0x119'),'createdAt':moment(_0x110559[_0x1b82('0x7d')])['format'](_0x1b82('0x105'))[_0x1b82('0xb0')](),'closedAt':_0x110559['closed']?moment(_0x110559[_0x1b82('0x11a')])[_0x1b82('0xe4')](_0x1b82('0x105'))[_0x1b82('0xb0')]():'','disposition':_0x110559[_0x1b82('0x3d')],'chatInfo':{'browser':_0x110559[_0x1b82('0x11b')],'os':_0x110559[_0x1b82('0x11c')],'referer':_0x110559[_0x1b82('0x11d')],'customerIp':_0x110559[_0x1b82('0x11e')],'customerPort':_0x110559[_0x1b82('0x11f')]?_0x110559['customerPort']:_0x1b82('0x119')},'messages':_(_0x110559[_0x1b82('0xe8')])['tail']()[_0x1b82('0x86')]({'secret':![]})[_0x1b82('0x30')](function(_0x16807d){if(_0x16807d[_0x1b82('0xd9')]){var _0x25b9d9=path[_0x1b82('0xde')](_0x164eb5,_0x16807d[_0x1b82('0xd9')]['basename']);if(fs[_0x1b82('0x120')](_0x25b9d9)){fs[_0x1b82('0x121')](_0x25b9d9)[_0x1b82('0x122')](fs['createWriteStream'](path['join'](_0x3a79f3,_0x16807d[_0x1b82('0xd9')]['basename'])));}}return{'date':moment(_0x16807d[_0x1b82('0x7d')])['format'](_0x1b82('0x105'))[_0x1b82('0xb0')](),'sender':_0x16807d['direction']===_0x1b82('0x123')?_0x16807d[_0x1b82('0x77')]?_0x16807d[_0x1b82('0x77')][_0x1b82('0xf3')]:_0x1b82('0xec'):_0x16807d[_0x1b82('0x6b')]['firstName']+(_0x16807d[_0x1b82('0x6b')][_0x1b82('0x115')]?'\x20'+_0x16807d[_0x1b82('0x6b')][_0x1b82('0x115')]:''),'body':_0x16807d[_0x1b82('0xd9')]?_0x16807d[_0x1b82('0xd9')]['basename']:_0x16807d[_0x1b82('0x2b')],'direction':_0x16807d[_0x1b82('0xf5')]==='out'?'A':'C','secret':_0x16807d['secret'],'read':_0x16807d[_0x1b82('0x81')],'attachment':_0x16807d[_0x1b82('0xd9')]};})[_0x1b82('0x6d')]()};return ejs[_0x1b82('0x124')](path[_0x1b82('0xde')](config[_0x1b82('0xdc')],_0x1b82('0x110'),'views',_0x1b82('0x125')),{'interaction':_0x5cbdb0})[_0x1b82('0x15')](function(_0x282a1a){var _0x1a18c2=path[_0x1b82('0xde')](_0x3a79f3,_0x1b82('0x126')+_0x110559['id']+'-'+_0x20f967+_0x1b82('0x127'));var _0x3f92d2={'path':_0x1a18c2,'channel':_0x1b82('0x128'),'interactionId':_0x110559['id']};return pdf[_0x1b82('0x129')](_0x282a1a,_0x3f92d2);})[_0x1b82('0x15')](function(){return new Promise(function(_0x3d6def,_0x29cc7c){zipdir(_0x3a79f3,{'saveTo':_0x4da468},function(_0x3e6449,_0x3710bf){if(_0x3e6449)return _0x29cc7c(_0x3e6449);return _0x3d6def(_0x3710bf);});})['then'](function(){return new BPromise(function(_0x3b287f,_0x2499c6){rimraf(_0x3a79f3,function(_0x3534ab){if(_0x3534ab)_0x2499c6(_0x3534ab);return _0x3b287f();});});})[_0x1b82('0x15')](function(){return _0x4ffd8e[_0x1b82('0xe0')](_0x4da468,_0x24bb32,function(_0x26620f){if(_0x26620f){logger[_0x1b82('0x1a')]('err',_0x26620f);}else{fs['unlinkSync'](_0x4da468);}});});});}else{return _0x4ffd8e['sendStatus'](0xc8);}})[_0x1b82('0x1e')](handleError(_0x4ffd8e,null));}; \ No newline at end of file +var _0x153f=['sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','setTags','spread','emit','chatInteractionTags:save','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','secret','read','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','render','merge','contact','agent','interaction','account','Users','map','TagIds','split','Tags','push','catch','waiting','talking','answered','unmanaged','closed','UserId','disposition','abandoned','total','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','unreadMessages','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','rows','show','params','fields','includeAll','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','isNull','vidaooMetadata','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','pathTranscript','Messages','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail'];(function(_0x1dc0b9,_0x43ffca){var _0x20013a=function(_0x147ffa){while(--_0x147ffa){_0x1dc0b9['push'](_0x1dc0b9['shift']());}};_0x20013a(++_0x43ffca);}(_0x153f,0x15b));var _0xf153=function(_0x1cff93,_0x1d1ead){_0x1cff93=_0x1cff93-0x0;var _0x12d1e6=_0x153f[_0x1cff93];return _0x12d1e6;};'use strict';var rimraf=require(_0xf153('0x0'));var zipdir=require(_0xf153('0x1'));var rp=require(_0xf153('0x2'));var moment=require(_0xf153('0x3'));var BPromise=require(_0xf153('0x4'));var Mustache=require(_0xf153('0x5'));var util=require(_0xf153('0x6'));var path=require('path');var ejs=require(_0xf153('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf153('0x8'));var Redis=require(_0xf153('0x9'));var qs=require(_0xf153('0xa'));var as=require(_0xf153('0xb'));var pdf=require(_0xf153('0xc'));var logger=require('../../config/logger')(_0xf153('0xd'));var config=require(_0xf153('0xe'));var db=require(_0xf153('0xf'))['db'];config[_0xf153('0x10')]=_[_0xf153('0x11')](config[_0xf153('0x10')],{'host':_0xf153('0x12'),'port':0x18eb});var socket=require(_0xf153('0x13'))(new Redis(config[_0xf153('0x10')]));require(_0xf153('0x14'))['register'](socket);var jayson=require(_0xf153('0x15'));var client=jayson[_0xf153('0x16')][_0xf153('0x17')]({'port':0x232b});var client9004=jayson['client'][_0xf153('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x292f89,_0x65756d,_0x1cc666,_0x256b7d){return new BPromise(function(_0x107d31,_0x3f915c){var _0x1d54c4=_0x256b7d||client;return _0x1d54c4[_0xf153('0x18')](_0x292f89,_0x1cc666)['then'](function(_0x18be7e){logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));logger[_0xf153('0x1c')](_0xf153('0x1d'),_0x65756d,_0xf153('0x1b'),JSON[_0xf153('0x1e')](_0x18be7e));if(_0x18be7e['error']){if(_0x18be7e[_0xf153('0x1f')]['code']===0x1f4){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x3f915c(_0x18be7e['error'][_0xf153('0x20')]);}logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);return _0x107d31(_0x18be7e[_0xf153('0x1f')][_0xf153('0x20')]);}else{logger[_0xf153('0x19')](_0xf153('0x1a'),_0x65756d,_0xf153('0x1b'));_0x107d31(_0x18be7e[_0xf153('0x21')][_0xf153('0x20')]);}})['catch'](function(_0xcd5762){logger[_0xf153('0x1f')](_0xf153('0x1a'),_0x65756d,_0xcd5762);_0x3f915c(_0xcd5762);});});}function respondWithStatusCode(_0x32e759,_0x5c9f44){_0x5c9f44=_0x5c9f44||0xcc;return function(_0x3e94b5){if(_0x3e94b5){return _0x32e759[_0xf153('0x22')](_0x5c9f44);}return _0x32e759[_0xf153('0x23')](_0x5c9f44)[_0xf153('0x24')]();};}function respondWithResult(_0x38190c,_0x1570fc){_0x1570fc=_0x1570fc||0xc8;return function(_0x39f3ed){if(_0x39f3ed){return _0x38190c[_0xf153('0x23')](_0x1570fc)[_0xf153('0x25')](_0x39f3ed);}};}function respondWithFilteredResult(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(_0x141ef4){var _0x703adb=typeof _0x35f9da[_0xf153('0x26')]===_0xf153('0x27')&&typeof _0x35f9da['limit']===_0xf153('0x27');var _0x3f1c6f=_0x141ef4['count'];var _0x16cdcd=_0x703adb?0x0:_0x35f9da[_0xf153('0x26')];var _0x4e45f9=_0x703adb?_0x141ef4[_0xf153('0x28')]:_0x35f9da[_0xf153('0x26')]+_0x35f9da[_0xf153('0x29')];var _0x2b9a9c;if(_0x4e45f9>=_0x3f1c6f){_0x4e45f9=_0x3f1c6f;_0x2b9a9c=0xc8;}else{_0x2b9a9c=0xce;}_0xe490f8[_0xf153('0x23')](_0x2b9a9c);return _0xe490f8[_0xf153('0x2a')](_0xf153('0x2b'),_0x16cdcd+'-'+_0x4e45f9+'/'+_0x3f1c6f)[_0xf153('0x25')](_0x141ef4);}return null;};}function saveUpdates(_0x19a568){return function(_0x8e31bf){if(_0x8e31bf){return _0x8e31bf[_0xf153('0x2c')](_0x19a568)[_0xf153('0x2d')](function(_0x5b5237){return _0x5b5237;});}return null;};}function removeEntity(_0x258fb0){return function(_0xbb3619){if(_0xbb3619){return _0xbb3619[_0xf153('0x2e')]()[_0xf153('0x2d')](function(){_0x258fb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28433d){return function(_0x4c6ea0){if(!_0x4c6ea0){_0x28433d['sendStatus'](0x194);}return _0x4c6ea0;};}function handleError(_0x2473d0,_0x4ab958){_0x4ab958=_0x4ab958||0x1f4;return function(_0x2b9623){logger['error'](_0x2b9623[_0xf153('0x2f')]);if(_0x2b9623[_0xf153('0x30')]){delete _0x2b9623['name'];}_0x2473d0[_0xf153('0x23')](_0x4ab958)[_0xf153('0x31')](_0x2b9623);};}function getMustacheRender(_0x538069,_0x40be52){return Mustache[_0xf153('0x32')](_0x538069,_[_0xf153('0x33')](_0x40be52['body'],{'contact':_0x40be52[_0xf153('0x34')],'message':_0x40be52['message'],'agent':_0x40be52[_0xf153('0x35')],'interaction':_0x40be52[_0xf153('0x36')],'account':_0x40be52[_0xf153('0x37')]}))||'';}function getInteractionUsers(_0x1820c3,_0x274bcc){return new BPromise(function(_0x284fe8,_0x4becf3){try{if(_0x274bcc[_0x1820c3['id']]){_0x1820c3[_0xf153('0x38')]=_[_0xf153('0x39')](_0x274bcc[_0x1820c3['id']],function(_0x332809){return{'id':_0x332809['id'],'fullname':_0x332809['fullname']};});}}catch(_0x244172){_0x4becf3(_0x244172);}_0x284fe8(_0x1820c3);});}function getInteractionTags(_0x17d60c,_0xd2a763){return new BPromise(function(_0x254692,_0x36c5cd){try{if(_0x17d60c[_0xf153('0x3a')]){_0x17d60c['Tags']=[];_0x17d60c[_0xf153('0x3a')][_0xf153('0x3b')](',')['forEach'](function(_0x14b2e3){_0x17d60c[_0xf153('0x3c')][_0xf153('0x3d')](_0xd2a763[_0x14b2e3]);});}delete _0x17d60c[_0xf153('0x3a')];}catch(_0x103b91){_0x36c5cd(_0x103b91);}_0x254692(_0x17d60c);});}function updateChatInteraction(_0x42360a,_0xef1510,_0x4d90c1){return new BPromise(function(_0x355131,_0x2f63d6){return getInteractionUsers(_0x42360a,_0x4d90c1)[_0xf153('0x2d')](function(_0x352e7c){return getInteractionTags(_0x352e7c,_0xef1510);})[_0xf153('0x2d')](function(_0x1ee606){return getStateInteraction(_0x1ee606);})['then'](function(_0x4b108e){_0x355131(_0x4b108e);})[_0xf153('0x3e')](function(_0x5051f3){_0x2f63d6(_0x5051f3);});});}function getStateInteraction(_0x46dd09){return new BPromise(function(_0x36c456){_0x46dd09[_0xf153('0x3f')]=0x0;_0x46dd09[_0xf153('0x40')]=0x0;_0x46dd09[_0xf153('0x41')]=0x0;_0x46dd09[_0xf153('0x42')]=0x0;_0x46dd09['abandoned']=0x0;_0x46dd09['total']=0x0;if(!_0x46dd09[_0xf153('0x43')]&&!_0x46dd09[_0xf153('0x44')]){_0x46dd09['waiting']+=0x1;}if(!_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09[_0xf153('0x40')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x45')]===_0xf153('0x46')){_0x46dd09[_0xf153('0x46')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09[_0xf153('0x3f')]-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&!_0x46dd09['UserId']&&_0x46dd09[_0xf153('0x45')]){_0x46dd09[_0xf153('0x42')]+=0x1;if(_0x46dd09[_0xf153('0x3f')]){_0x46dd09['waiting']-=0x1;}}else if(_0x46dd09[_0xf153('0x43')]&&_0x46dd09[_0xf153('0x44')]){_0x46dd09['answered']+=0x1;if(_0x46dd09[_0xf153('0x40')]){_0x46dd09['talking']-=0x1;}}_0x46dd09[_0xf153('0x47')]+=0x1;_0x36c456(_0x46dd09);});}exports[_0xf153('0x48')]=function(_0x17fb10,_0x550d45){var _0x1f540b={},_0x209048={},_0x1426eb={'count':0x0,'rows':[]};var _0x1bece2=_[_0xf153('0x39')](db['ChatInteraction'][_0xf153('0x49')],function(_0x3bc265){return{'name':_0x3bc265['fieldName'],'type':_0x3bc265[_0xf153('0x4a')][_0xf153('0x4b')]};});_0x209048[_0xf153('0x4c')]=_['map'](_0x1bece2,_0xf153('0x30'));_0x209048[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x17fb10[_0xf153('0x4d')]);_0x209048[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x209048[_0xf153('0x4c')],_0x209048[_0xf153('0x4d')]);_0x1f540b[_0xf153('0x51')]=_['intersection'](_0x209048[_0xf153('0x4c')],qs['fields'](_0x17fb10['query']['fields']));_0x1f540b[_0xf153('0x51')]=_0x1f540b[_0xf153('0x51')]['length']?_0x1f540b[_0xf153('0x51')]:_0x209048[_0xf153('0x4c')];if(!_0x17fb10['query'][_0xf153('0x52')](_0xf153('0x53'))){_0x1f540b[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1f540b['offset']=qs[_0xf153('0x26')](_0x17fb10[_0xf153('0x4d')]['offset']);}_0x1f540b['order']=qs[_0xf153('0x54')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x54')]);_0x1f540b[_0xf153('0x55')]=qs[_0xf153('0x4f')](_[_0xf153('0x56')](_0x17fb10['query'],_0x209048[_0xf153('0x4f')]),_0x1bece2);var _0x51d813=[];var _0x340aba=squel[_0xf153('0x57')]()[_0xf153('0x58')]('id')['field'](_0xf153('0x30'))[_0xf153('0x58')](_0xf153('0x59'))[_0xf153('0x5a')](_0xf153('0x5b'));var _0x18d0ce=squel[_0xf153('0x57')]()['field'](_0xf153('0x5c'))[_0xf153('0x58')](_0xf153('0x5d'))['field'](_0xf153('0x5e'))[_0xf153('0x5a')](_0xf153('0x5f'),'ui')[_0xf153('0x60')](_0xf153('0x61'),'u',_0xf153('0x62'));var _0x245124=squel[_0xf153('0x57')]()['from'](_0xf153('0x63'),'i')[_0xf153('0x60')]('cm_contacts','c',_0xf153('0x64'))[_0xf153('0x60')](_0xf153('0x61'),'o',_0xf153('0x65'))[_0xf153('0x60')](_0xf153('0x66'),'a',_0xf153('0x67'))[_0xf153('0x60')](_0xf153('0x68'),'me',_0xf153('0x69'))[_0xf153('0x60')]('chat_interaction_has_tags','it',_0xf153('0x6a'))[_0xf153('0x60')]('tools_tags','t',_0xf153('0x6b'));var _0x25e66e=squel[_0xf153('0x6c')]();var _0x147d3a=[];var _0x603892=squel[_0xf153('0x6c')]();var _0x2736e3;if(_0x17fb10['query'][_0xf153('0x6d')]){_0x2736e3=as[_0xf153('0x6e')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x6d')]);var _0x17f58d=_0x2736e3[_0xf153('0x6f')];for(var _0x19ec0b=0x0;_0x19ec0b<_0x2736e3[_0xf153('0x70')][_0xf153('0x71')];_0x19ec0b++){var _0x4c9157=_0x2736e3[_0xf153('0x70')][_0x19ec0b];var _0x433566='i';var _0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name',_0x4c9157[_0xf153('0x58')]]);if(!_0x4afdc4){switch(_0x4c9157[_0xf153('0x58')]){case'unreadMessages':if(_0x4c9157[_0xf153('0x73')]==0x1){_0x245124['having']('`'+_0x4c9157[_0xf153('0x58')]+_0xf153('0x74'));}else{_0x245124[_0xf153('0x75')]('`'+_0x4c9157[_0xf153('0x58')]+'`\x20>\x200');}break;case _0xf153('0x76'):if(_0x4c9157[_0xf153('0x77')]==='$substring'){if(_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')]('\x20')[_0xf153('0x71')]>0x1){_0x25e66e[_0x17f58d](_0xf153('0x78'),qs[_0xf153('0x79')](_0x4c9157['value']),null);}else{var _0xf4a542='%'+_0x4c9157['value']+'%';_0x25e66e[_0x17f58d](_0xf153('0x7a'),_0xf4a542,_0xf4a542,_0xf4a542);}}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','ContactId']);_0x4c9157[_0xf153('0x58')]=_0xf153('0x7b');_0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')]['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}break;case _0xf153('0x7d'):var _0x1e5e95=_0x4c9157[_0xf153('0x73')][_0xf153('0x3b')](',')[_0xf153('0x39')](function(_0x364957){return Number(_0x364957);});_0x1e5e95[_0xf153('0x7e')](function(_0x858289){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x858289+',%');});_0x147d3a=_[_0xf153('0x80')](_0x147d3a,_0x1e5e95);break;case _0xf153('0x81'):if(_0x4c9157[_0xf153('0x77')]===_0xf153('0x82')){_0x25e66e[_0x17f58d](_0xf153('0x83'),'%'+_0x4c9157['value']+'%',null);}else{_0x4afdc4=_[_0xf153('0x72')](_0x1bece2,['name','UserId']);_0x4c9157[_0xf153('0x58')]='UserId';_0x44da13=as[_0xf153('0x84')](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13[_0xf153('0x73')][_0xf153('0x85')],_0x44da13[_0xf153('0x73')]['end']);}break;case _0xf153('0x86'):_0x44da13=as[_0xf153('0x84')]('me',null,_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13[_0xf153('0x7c')],_0x44da13['value']['start'],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);break;}}else{var _0x44da13=as['buildExpression'](_0x433566,_0x4afdc4[_0xf153('0x4a')],_0x4c9157);_0x25e66e[_0x17f58d](_0x44da13['text'],_0x44da13['value'][_0xf153('0x85')],_0x44da13[_0xf153('0x73')][_0xf153('0x24')]);}}}else{var _0x583dbf=_(_0x17fb10[_0xf153('0x4d')])[_0xf153('0x4e')]()['map'](function(_0x193c8c){return _[_0xf153('0x87')](_0x1bece2,[_0xf153('0x30'),_0x193c8c])?_0x193c8c:undefined;})[_0xf153('0x88')]()[_0xf153('0x73')]();if(!_['isEmpty'](_0x583dbf)){_0x583dbf[_0xf153('0x7e')](function(_0xf791a1){if(_0xf791a1===_0xf153('0x89')){_0x245124[_0xf153('0x55')](_0xf153('0x8a'),[][_0xf153('0x8b')](_0x17fb10[_0xf153('0x4d')][_0xf791a1]));}else if(_0xf791a1==='createdAt'){var _0x756f52=JSON[_0xf153('0x8c')](_0x17fb10[_0xf153('0x4d')][_0xf791a1])[_0xf153('0x8d')];var _0x269102=JSON[_0xf153('0x8c')](_0x17fb10['query'][_0xf791a1])[_0xf153('0x8e')];_0x245124[_0xf153('0x55')](_0xf153('0x8f'),_0x756f52,_0x269102);}else{if(_0x17fb10[_0xf153('0x4d')][_0xf791a1]===_0xf153('0x90')){_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x91'));}else{_0x245124[_0xf153('0x55')]('i.'+_0xf791a1+_0xf153('0x92'),_0x17fb10[_0xf153('0x4d')][_0xf791a1]);}}});}if(_0x17fb10['query']['read']){if(_0x17fb10['query']['read']==0x1){_0x245124[_0xf153('0x75')](_0xf153('0x93'));}else{_0x245124[_0xf153('0x75')](_0xf153('0x94'));}}if(_0x17fb10[_0xf153('0x4d')]['tag']){_0x147d3a=_[_0xf153('0x95')](_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')])?_0x17fb10[_0xf153('0x4d')]['tag']:new Array(_0x17fb10[_0xf153('0x4d')][_0xf153('0x96')]);_0x147d3a[_0xf153('0x7e')](function(_0x4a5f54){_0x603892['or'](_0xf153('0x7f'),'%,'+_0x4a5f54+',%');});}if(_0x17fb10['query'][_0xf153('0x97')]){var _0x25ab76=_0x17fb10[_0xf153('0x4d')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf153('0x98')](_0x25ab76)){_0x25e66e['or'](_0xf153('0x99'),_0x25ab76+'%');}else{_0x25e66e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x25ab76))['or'](_0xf153('0x9a'),_0x25ab76+'%');}}}_0x245124['where'](_0x25e66e);_0x245124[_0xf153('0x9b')]('i.id');var _0xb3632c={'type':db[_0xf153('0x9c')][_0xf153('0x9d')][_0xf153('0x9e')],'raw':!![]};var _0x303dcf=_0x245124[_0xf153('0x9f')]();_0x303dcf['field'](_0xf153('0xa0'));_0x303dcf[_0xf153('0x58')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf153('0xa1'));if(_0x1f540b[_0xf153('0xa2')]){_0x1f540b[_0xf153('0xa2')][_0xf153('0x7e')](function(_0x5c6ac2){var _0x3e36fc=_0x5c6ac2[0x0]===_0xf153('0xa3')?_0x5c6ac2[0x0]:'i.'+_0x5c6ac2[0x0];_0x245124['order'](_0x3e36fc,_0x5c6ac2[0x1]===_0xf153('0xa4')?![]:!![]);});}if(!_[_0xf153('0xa5')](_0x147d3a)){_0x245124[_0xf153('0x75')](_0x603892);_0x303dcf[_0xf153('0x55')]('t.id\x20IN\x20?',_0x147d3a);}BPromise[_0xf153('0xa6')]()[_0xf153('0x2d')](function(){if(!_0x2736e3){if(_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return;_0x303dcf[_0xf153('0x55')](_0xf153('0xa7'));_0x245124[_0xf153('0x55')](_0xf153('0xa7'));return;}if(_0x17fb10[_0xf153('0xa8')]['role']!==_0xf153('0x35'))return;return _0x17fb10[_0xf153('0xa8')][_0xf153('0xa9')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d24b5){if(_[_0xf153('0xa5')](_0x4d24b5)){_0x303dcf['where'](_0xf153('0xaa'));_0x245124[_0xf153('0x55')](_0xf153('0xaa'));}else{_0x303dcf['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xf153('0x39')](_0x4d24b5,'id'));_0x245124[_0xf153('0x55')](_0xf153('0x8a'),_['map'](_0x4d24b5,'id'));}});})[_0xf153('0x2d')](function(){if(_0x17fb10[_0xf153('0xa8')][_0xf153('0xab')]===_0xf153('0x35')&&!_0x2736e3&&!_0x17fb10[_0xf153('0x4d')][_0xf153('0x89')])return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x303dcf[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x347859){_0x1426eb[_0xf153('0x28')]=_0x347859[_0xf153('0x71')];if(_0x1426eb['count']===0x0)return[];return db[_0xf153('0xac')][_0xf153('0x4d')](_0x340aba[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x573032){_0x51d813=_[_0xf153('0xae')](_0x573032,'id');_0xb3632c=_['merge'](_0xb3632c,{'model':db[_0xf153('0xaf')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17fb10[_0xf153('0x4d')]['fields']){_0x1f540b[_0xf153('0x51')][_0xf153('0x7e')](function(_0x3b0b94){_0x245124[_0xf153('0x58')]('i.'+_0x3b0b94);});}else{_0x245124[_0xf153('0x58')](_0xf153('0xb0'),_0xf153('0xa1'));_0x245124[_0xf153('0x58')]('a.key',_0xf153('0xb1'));_0x245124[_0xf153('0x58')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x245124[_0xf153('0x58')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x245124[_0xf153('0x58')](_0xf153('0xb2'));_0x245124['field'](_0xf153('0xb3'),_0xf153('0xb4'));_0x245124[_0xf153('0x58')](_0xf153('0xb5'),_0xf153('0xb6'));_0x245124[_0xf153('0x58')](_0xf153('0xb7'),_0xf153('0xb8'));_0x245124[_0xf153('0x58')]('c.phone',_0xf153('0xb9'));_0x245124['field'](_0xf153('0xba'),'Contact.mobile');_0x245124[_0xf153('0x58')]('c.fax','Contact.fax');_0x245124[_0xf153('0x58')]('o.fullname',_0xf153('0xbb'));_0x245124[_0xf153('0x58')]('o.internal','Owner.internal');_0x245124[_0xf153('0x58')](_0xf153('0xbc'),_0xf153('0x3a'));}if(_0x1f540b['limit'])_0x245124[_0xf153('0x29')](_0x1f540b[_0xf153('0x29')]);if(_0x1f540b[_0xf153('0x26')])_0x245124[_0xf153('0x26')](_0x1f540b['offset']);return db[_0xf153('0xac')][_0xf153('0x4d')](_0x245124[_0xf153('0xad')](),_0xb3632c);})[_0xf153('0x2d')](function(_0x1022c5){if(_0x1022c5[_0xf153('0x71')]>0x0)_0x18d0ce[_0xf153('0x55')](_0xf153('0xbd'),_[_0xf153('0x39')](_0x1022c5,'id'));return db[_0xf153('0xac')][_0xf153('0x4d')](_0x18d0ce[_0xf153('0xad')](),_0xb3632c)['then'](function(_0x1aebab){var _0x192708=_['groupBy'](_0x1aebab,_0xf153('0xbe'));var _0x4525e1=[];_0x1022c5[_0xf153('0x7e')](function(_0x449f8d){_0x4525e1[_0xf153('0x3d')](updateChatInteraction(_0x449f8d,_0x51d813,_0x192708));});return BPromise['all'](_0x4525e1);});});})[_0xf153('0x2d')](function(_0xa13662){_0x1426eb[_0xf153('0xbf')]=_0xa13662;return _0x1426eb;})[_0xf153('0x2d')](respondWithFilteredResult(_0x550d45,_0x1f540b))[_0xf153('0x3e')](handleError(_0x550d45,null));};exports[_0xf153('0xc0')]=function(_0x2e55f4,_0x1098b7){var _0x29d492={'raw':![],'where':{'id':_0x2e55f4[_0xf153('0xc1')]['id']}},_0x3f7938={};_0x3f7938[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xaf')][_0xf153('0x49')]);_0x3f7938['query']=_[_0xf153('0x4e')](_0x2e55f4[_0xf153('0x4d')]);_0x3f7938[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x3f7938[_0xf153('0x4c')],_0x3f7938[_0xf153('0x4d')]);_0x29d492[_0xf153('0x51')]=_[_0xf153('0x50')](_0x3f7938['model'],qs[_0xf153('0xc2')](_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc2')]));_0x29d492[_0xf153('0x51')]=_0x29d492[_0xf153('0x51')]['length']?_0x29d492[_0xf153('0x51')]:_0x3f7938[_0xf153('0x4c')];if(_0x2e55f4[_0xf153('0x4d')][_0xf153('0xc3')]){_0x29d492['include']=[{'all':!![]}];}_0x29d492=_['merge']({},_0x29d492,_0x2e55f4[_0xf153('0xc4')]);return db[_0xf153('0xaf')]['find'](_0x29d492)['then'](handleEntityNotFound(_0x1098b7,null))[_0xf153('0x2d')](respondWithResult(_0x1098b7,null))[_0xf153('0x3e')](handleError(_0x1098b7,null));};exports[_0xf153('0xc5')]=function(_0x339e9e,_0x31a019){return db[_0xf153('0xaf')][_0xf153('0xc5')](_0x339e9e[_0xf153('0x86')],{})[_0xf153('0x2d')](respondWithResult(_0x31a019,0xc9))['catch'](handleError(_0x31a019,null));};exports[_0xf153('0x2c')]=function(_0x110f72,_0x527cce){if(_0x110f72[_0xf153('0x86')]['id']){delete _0x110f72[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x110f72['params']['id']}})['then'](handleEntityNotFound(_0x527cce,null))[_0xf153('0x2d')](saveUpdates(_0x110f72[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0x527cce,null))['catch'](handleError(_0x527cce,null));};exports[_0xf153('0x2e')]=function(_0x45c835,_0x3ca774){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x45c835[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3ca774,null))['then'](removeEntity(_0x3ca774,null))[_0xf153('0x3e')](handleError(_0x3ca774,null));};exports[_0xf153('0xc6')]=function(_0x3451e9,_0x3af786){return db[_0xf153('0xaf')][_0xf153('0xc6')]()[_0xf153('0x2d')](respondWithResult(_0x3af786,null))[_0xf153('0x3e')](handleError(_0x3af786,null));};exports[_0xf153('0xc7')]=function(_0x53eee4,_0x2dd1d8){var _0x2c3f76=_0x53eee4[_0xf153('0xc1')]['id'];var _0x374ba4;var _0x1b4f50;var _0x40c1d1;return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c3f76}})[_0xf153('0x2d')](function(_0x8711eb){_0x374ba4=_0x8711eb;return db[_0xf153('0xc9')]['findOne']({'where':{'id':_0x8711eb[_0xf153('0x89')]},'attributes':['id',_0xf153('0xca'),_0xf153('0xcb'),_0xf153('0xcc'),_0xf153('0xcd'),'vidaooMetadata'],'raw':!![]});})[_0xf153('0x2d')](function(_0x2e908a){if(_0x2e908a&&_0x2e908a['vidaooApiKey']&&_0x2e908a[_0xf153('0xcb')]){_0x1b4f50=_0x2e908a;var _0x57d320={'interaction':{'id':_0x2c3f76},'agent':{'id':_0x53eee4[_0xf153('0xa8')]['id'],'name':_0x53eee4[_0xf153('0xa8')][_0xf153('0x30')],'fullname':_0x53eee4[_0xf153('0xa8')]['fullname'],'email':_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]},'contact':_0x53eee4['body'][_0xf153('0x34')],'account':_0x53eee4['body'][_0xf153('0x37')]};var _0x30ae3c={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2e908a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53eee4[_0xf153('0xa8')][_0xf153('0xce')]],'buttons':null,'topic':_0x1b4f50['vidaooTopic'],'note':_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xcd')])?null:getMustacheRender(_0x1b4f50['vidaooNote'],_0x57d320),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xf153('0xcf')](_0x1b4f50[_0xf153('0xd0')])){var _0x32971d=getMustacheRender(_0x1b4f50[_0xf153('0xd0')],_0x57d320);var _0x1a4825=JSON[_0xf153('0x8c')](_0x32971d);_0x30ae3c[_0xf153('0x86')][_0xf153('0xd1')]=_0x1a4825;}}catch(_0xb03f70){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd2'));}return rp(_0x30ae3c);}else{throw new db['Sequelize']['ValidationError'](_0xf153('0xd3'));}})[_0xf153('0x2d')](function(_0x264968){_0x40c1d1=_0x264968;if(_0x40c1d1['id']){var _0xe61167={'body':_0x40c1d1['join_url'],'ChatWebsiteId':_0x1b4f50['id'],'ChatInteractionId':_0x374ba4['id'],'direction':_0xf153('0xd4'),'UserId':_0x53eee4['user']['id']};return db[_0xf153('0xd5')][_0xf153('0xc5')](_0xe61167,{});}else{throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xd6'));}})[_0xf153('0x2d')](function(){return _0x374ba4['updateAttributes']({'vidaooSessionId':_0x40c1d1['id']});})[_0xf153('0x2d')](respondWithResult(_0x2dd1d8,null))['catch'](handleError(_0x2dd1d8,null));};exports[_0xf153('0xd7')]=function(_0x1ba174,_0xab67b7){if(_0x1ba174['body']['id']){delete _0x1ba174['body']['id'];}return db[_0xf153('0xaf')]['find']({'where':{'id':_0x1ba174[_0xf153('0xc1')]['id']},'include':[{'model':db[_0xf153('0xd8')],'as':_0xf153('0x76')}]})[_0xf153('0x2d')](handleEntityNotFound(_0xab67b7,null))[_0xf153('0x2d')](saveUpdates(_0x1ba174[_0xf153('0x86')],null))[_0xf153('0x2d')](respondWithResult(_0xab67b7,null))[_0xf153('0x3e')](handleError(_0xab67b7,null));};exports[_0xf153('0xd9')]=function(_0x40ade6,_0x1a9bfb){if(_0x40ade6[_0xf153('0x86')]['id']){delete _0x40ade6[_0xf153('0x86')]['id'];}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x40ade6[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](function(_0x50dd96){if(!_0x50dd96){logger[_0xf153('0x1f')](_0xf153('0xda'),_0xf153('0xd9'),0x194,'entity\x20not\x20found');_0x1a9bfb[_0xf153('0x22')](0x194);}else{if(_0x50dd96[_0xf153('0x44')]){throw new db[(_0xf153('0x9c'))]['ValidationError'](_0xf153('0xdb'));}}return _0x50dd96;})[_0xf153('0x2d')](function(_0xeebd4f){if(_0xeebd4f){return _0xeebd4f[_0xf153('0x2c')]({'closed':_0x40ade6[_0xf153('0x86')]['closed'],'disposition':_0x40ade6[_0xf153('0x86')]['disposition']})[_0xf153('0x2d')](function(_0x4fe273){return _0x4fe273;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xf153('0xd9'),_0x40ade6['body'],client9004);})[_0xf153('0x2d')](respondWithResult(_0x1a9bfb,null))['catch'](handleError(_0x1a9bfb,null));};exports[_0xf153('0xdc')]=function(_0x25543b,_0x3c1ae6){_0x25543b[_0xf153('0x86')]['name']=_0x25543b[_0xf153('0xdd')][_0xf153('0xde')];_0x25543b['body'][_0xf153('0xdf')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe0')];_0x25543b[_0xf153('0x86')][_0xf153('0x4a')]=_0x25543b[_0xf153('0xdd')][_0xf153('0xe1')];return db['Attachment'][_0xf153('0xc5')](_0x25543b[_0xf153('0x86')])[_0xf153('0x2d')](respondWithResult(_0x3c1ae6,0xc9))[_0xf153('0x3e')](handleError(_0x3c1ae6,null));};exports[_0xf153('0xe2')]=function(_0x2c8401,_0x41ef70){return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0xc1')]['id']},'raw':!![]})[_0xf153('0x2d')](handleEntityNotFound(_0x41ef70,null))[_0xf153('0x2d')](function(_0x283f9e){if(_0x283f9e){if(_0x283f9e['closed']){return _0x41ef70['status'](0x193)[_0xf153('0x25')]({'status':0x193,'message':_0xf153('0xe3')});}return db['Attachment'][_0xf153('0xc8')]({'where':{'id':_0x2c8401[_0xf153('0x4d')][_0xf153('0xe4')]},'raw':!![]})['then'](handleEntityNotFound(_0x41ef70,null));}})['then'](function(_0x13b7e2){if(_0x13b7e2){var _0x25222f=_0x13b7e2[_0xf153('0xe5')]!==null;var _0x4b2cdd=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0xe8'));if(_0x25222f){_0x4b2cdd=path[_0xf153('0xe6')](_0x4b2cdd,_0xf153('0xe9'));}var _0x1ac5ff=path[_0xf153('0xe6')](_0x4b2cdd,_0x13b7e2[_0xf153('0xdf')]);return _0x41ef70[_0xf153('0xea')](_0x1ac5ff);}})[_0xf153('0x3e')](handleError(_0x41ef70,null));};exports[_0xf153('0xeb')]=function(_0x126535,_0x392c8e){var _0x203143=null;var _0x173f12=null;var _0x1f8794=null;if(_0x126535[_0xf153('0x86')]['id']){delete _0x126535[_0xf153('0x86')]['id'];}if(_0x126535['body'][_0xf153('0xec')]){_0x1f8794=path['join'](config[_0xf153('0xe7')],_0xf153('0xed'),util['format']('transcript-%s.txt',Date['now']()));_0x126535[_0xf153('0x86')][_0xf153('0xee')]=_0x1f8794;}return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x126535['params']['id']},'include':[{'model':db[_0xf153('0xd5')],'as':_0xf153('0xef'),'include':[{'model':db[_0xf153('0x81')],'as':_0xf153('0x81')}]}]})[_0xf153('0x2d')](handleEntityNotFound(_0x392c8e,null))[_0xf153('0x2d')](saveUpdates(_0x126535[_0xf153('0x86')],null))[_0xf153('0x2d')](function(_0x4c2b50){if(_0x4c2b50){_0x203143=_0x4c2b50;return db[_0xf153('0xc9')][_0xf153('0x72')]({'where':{'id':_0x203143['ChatWebsiteId']}});}})['then'](function(_0x3021e6){if(_0x3021e6){_0x173f12=_0x3021e6;return db[_0xf153('0xd8')]['find']({'where':{'id':_0x203143[_0xf153('0x7b')]}});}})['then'](function(_0x3057f1){if(_0x3057f1){if(_0x1f8794){var _0x207255=null;for(var _0xd8cd84=0x1;_0xd8cd84<_0x203143[_0xf153('0xef')][_0xf153('0x71')];++_0xd8cd84){_0x207255=_0x203143['Messages'][_0xd8cd84];var _0xb4dbdd=_0x207255['UserId']?util['format'](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');var _0x5b1a91=_0x126535[_0xf153('0x86')][_0xf153('0xf3')]||util[_0xf153('0xf4')](_0xf153('0xf0'),_0xf153('0xf5'),_0x207255[_0xf153('0x7b')]);switch(_0x173f12[_0xf153('0xf6')]){case _0xf153('0xf7'):_0xb4dbdd=_0x207255['UserId']?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');break;case _0xf153('0xf8'):_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')][_0xf153('0xf9')]||_0x207255[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2');break;case'agent_fullname':_0xb4dbdd=_0x207255[_0xf153('0x44')]?_0x207255[_0xf153('0x81')]['fullname']:_0xf153('0xf2');break;default:_0xb4dbdd=_0x207255[_0xf153('0x44')]?util[_0xf153('0xf4')](_0xf153('0xf0'),_0x173f12[_0xf153('0xf1')],_0x207255[_0xf153('0x44')]):_0xf153('0xf2');}var _0x4b8d5c=util[_0xf153('0xf4')](_0xf153('0xfb'),moment(_0x207255[_0xf153('0xfc')])[_0xf153('0xf4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x207255[_0xf153('0xfd')]==='in'?_0x5b1a91:_0xb4dbdd,_0x207255[_0xf153('0x86')]);if(!_0x207255['secret']){fs[_0xf153('0xfe')](_0x1f8794,_0x4b8d5c);}}return db['MailAccount'][_0xf153('0xc8')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf153('0xff'),'raw':!![],'include':[{'model':db[_0xf153('0x100')],'as':_0xf153('0x100'),'raw':!![]}]}]});}}})[_0xf153('0x2d')](function(_0x5a8d13){if(!_0x5a8d13||!_0x5a8d13[_0xf153('0xff')]||!_0x126535['body'])return _0x203143;var _0x21285e=_0x5a8d13[_0xf153('0x101')]();return respondWithRpcPromise(_0xf153('0x102'),_0xf153('0x103'),{'account':_0x21285e,'message':{'from':util[_0xf153('0xf4')](_0xf153('0x104'),_0x5a8d13['name'],_0x5a8d13[_0xf153('0xce')]||_0x5a8d13['Smtp'][_0xf153('0xa8')]),'to':_0x126535['body'][_0xf153('0xec')],'subject':_0xf153('0x105'),'text':util[_0xf153('0xf4')](_0xf153('0x106'),_0x126535['body'][_0xf153('0xec')]),'attachments':[{'path':_0x1f8794}]}})['then'](function(){return _0x203143;})[_0xf153('0x3e')](function(_0x5c32d1){logger[_0xf153('0x1f')](_0x5c32d1);});})[_0xf153('0x2d')](respondWithStatusCode(_0x392c8e,0xc8))[_0xf153('0x3e')](handleError(_0x392c8e,null));};exports[_0xf153('0x107')]=function(_0x273b03,_0x3165e5){return db[_0xf153('0xd5')][_0xf153('0x72')]({'where':{'id':_0x273b03['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3165e5,null))[_0xf153('0x2d')](function(_0x48c9e4){if(_0x48c9e4){return _0x48c9e4[_0xf153('0x107')](_0x273b03[_0xf153('0x86')][_0xf153('0x108')],_[_0xf153('0x109')](_0x273b03[_0xf153('0x86')],[_0xf153('0x108'),'id'])||{});}})[_0xf153('0x2d')](respondWithResult(_0x3165e5,null))['catch'](handleError(_0x3165e5,null));};exports['getMessages']=function(_0x550c10,_0x3e8153){var _0x1fb83a={'raw':![],'where':{}};var _0x10f948={};var _0x5cc922={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf153('0xc8')]({'where':{'id':_0x550c10['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x3e8153,null))[_0xf153('0x2d')](function(_0x21a1c9){if(_0x21a1c9){_0x10f948[_0xf153('0x4c')]=_[_0xf153('0x4e')](db['ChatMessage'][_0xf153('0x49')]);_0x10f948[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x550c10['query']);_0x10f948[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],_0x10f948[_0xf153('0x4d')]);_0x1fb83a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x10f948[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x550c10[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1fb83a[_0xf153('0x51')]=_0x1fb83a[_0xf153('0x51')][_0xf153('0x71')]?_0x1fb83a[_0xf153('0x51')]:_0x10f948[_0xf153('0x4c')];if(!_0x550c10[_0xf153('0x4d')][_0xf153('0x52')]('nolimit')){_0x1fb83a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x550c10[_0xf153('0x4d')][_0xf153('0x29')]);_0x1fb83a['offset']=qs[_0xf153('0x26')](_0x550c10[_0xf153('0x4d')][_0xf153('0x26')]);}_0x1fb83a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x550c10[_0xf153('0x4d')]['sort']);_0x1fb83a[_0xf153('0x55')]=qs[_0xf153('0x4f')](_['pick'](_0x550c10[_0xf153('0x4d')],_0x10f948[_0xf153('0x4f')]));_0x1fb83a[_0xf153('0x55')][_0xf153('0xbe')]=_0x21a1c9['id'];if(_0x550c10[_0xf153('0x4d')][_0xf153('0x97')]){_0x1fb83a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1fb83a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1fb83a[_0xf153('0x51')],function(_0x4538be){var _0x63ad32={};_0x63ad32[_0x4538be]={'$like':'%'+_0x550c10['query'][_0xf153('0x97')]+'%'};return _0x63ad32;})});}if(_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]){var _0x9503e=_0x550c10[_0xf153('0x4d')][_0xf153('0x8d')]['split'](',');var _0x49ea9a={};_0x49ea9a[_0x9503e[0x0]]={'$gte':moment(_0x9503e[0x1])[_0xf153('0xf4')](_0xf153('0x10a'))};_0x1fb83a[_0xf153('0x55')]=_['merge'](_0x1fb83a[_0xf153('0x55')],_0x49ea9a);}_0x1fb83a=_[_0xf153('0x33')]({},_0x1fb83a,_0x550c10[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1fb83a[_0xf153('0x55')]})[_0xf153('0x2d')](function(_0x921b52){_0x5cc922['count']=_0x921b52;if(_0x550c10['query'][_0xf153('0xc3')]){_0x1fb83a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1fb83a);})[_0xf153('0x2d')](function(_0x577fc7){_0x5cc922[_0xf153('0xbf')]=_0x577fc7;return _0x5cc922;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x3e8153,_0x1fb83a))[_0xf153('0x3e')](handleError(_0x3e8153,null));};exports[_0xf153('0x10d')]=function(_0x283af8,_0x58be79){var _0x1d0d1a={'where':{}},_0x5397a8={},_0x466386={'count':0x0,'rows':[]};return db[_0xf153('0xaf')][_0xf153('0xc8')]({'where':{'id':_0x283af8[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x58be79,null))['then'](function(_0x5efd23){if(_0x5efd23){_0x5397a8[_0xf153('0x4c')]=_[_0xf153('0x4e')](db[_0xf153('0xd5')][_0xf153('0x49')]);_0x5397a8[_0xf153('0x4d')]=_[_0xf153('0x4e')](_0x283af8[_0xf153('0x4d')]);_0x5397a8[_0xf153('0x4f')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],_0x5397a8[_0xf153('0x4d')]);_0x1d0d1a[_0xf153('0x51')]=_[_0xf153('0x50')](_0x5397a8[_0xf153('0x4c')],qs[_0xf153('0xc2')](_0x283af8[_0xf153('0x4d')][_0xf153('0xc2')]));_0x1d0d1a[_0xf153('0x51')]=_0x1d0d1a[_0xf153('0x51')][_0xf153('0x71')]?_0x1d0d1a[_0xf153('0x51')]:_0x5397a8[_0xf153('0x4c')];if(!_0x283af8['query']['hasOwnProperty'](_0xf153('0x53'))){_0x1d0d1a[_0xf153('0x29')]=qs[_0xf153('0x29')](_0x283af8['query'][_0xf153('0x29')]);_0x1d0d1a[_0xf153('0x26')]=qs[_0xf153('0x26')](_0x283af8['query'][_0xf153('0x26')]);}_0x1d0d1a[_0xf153('0xa2')]=qs[_0xf153('0x54')](_0x283af8[_0xf153('0x4d')]['sort']);_0x1d0d1a[_0xf153('0x55')]=qs['filters'](_[_0xf153('0x56')](_0x283af8[_0xf153('0x4d')],_0x5397a8[_0xf153('0x4f')]));_0x1d0d1a[_0xf153('0x55')]['ChatInteractionId']=_0x5efd23['id'];if(_0x283af8[_0xf153('0x4d')]['filter']){_0x1d0d1a[_0xf153('0x55')]=_[_0xf153('0x33')](_0x1d0d1a[_0xf153('0x55')],{'$or':_[_0xf153('0x39')](_0x1d0d1a[_0xf153('0x51')],function(_0x397ee2){var _0x17e62e={};_0x17e62e[_0x397ee2]={'$like':'%'+_0x283af8[_0xf153('0x4d')][_0xf153('0x97')]+'%'};return _0x17e62e;})});}_0x1d0d1a['where']['secret']=![];if(_0x283af8[_0xf153('0x4d')]['id']){_0x1d0d1a[_0xf153('0x55')]['id']={'$gt':_0x283af8[_0xf153('0x4d')]['id']};}_0x1d0d1a=_['merge']({},_0x1d0d1a,_0x283af8[_0xf153('0xc4')]);return db[_0xf153('0xd5')][_0xf153('0x28')]({'where':_0x1d0d1a['where']})[_0xf153('0x2d')](function(_0x100f48){_0x466386[_0xf153('0x28')]=_0x100f48;_0x1d0d1a[_0xf153('0x10b')]=[];if(_0x283af8['query']['includeAgent']){_0x1d0d1a[_0xf153('0x10b')][_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id','fullname',_0xf153('0xf9')]});}if(_0x283af8[_0xf153('0x4d')][_0xf153('0xc3')]){_0x1d0d1a[_0xf153('0x10b')]=[{'all':!![]}];}return db[_0xf153('0xd5')][_0xf153('0x10c')](_0x1d0d1a);})[_0xf153('0x2d')](function(_0x3a94c5){_0x466386[_0xf153('0xbf')]=_0x3a94c5;return _0x466386;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x58be79,_0x1d0d1a))['catch'](handleError(_0x58be79,null));};exports['addTags']=function(_0x11997d,_0x74943){return db[_0xf153('0xaf')]['find']({'where':{'id':_0x11997d[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x74943,null))['then'](function(_0x3f7eb6){if(_0x3f7eb6){return _0x3f7eb6[_0xf153('0x10e')](_0x11997d['body']['ids'],_[_0xf153('0x109')](_0x11997d['body'],[_0xf153('0x108'),'id'])||{})[_0xf153('0x10f')](function(){return db[_0xf153('0x7d')]['findAll']({'attributes':['id',_0xf153('0x30'),_0xf153('0x59')],'where':{'id':_0x11997d['body'][_0xf153('0x108')]}});})['then'](function(_0x5742a6){socket[_0xf153('0x110')](_0xf153('0x111'),{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]});return{'id':Number(_0x11997d[_0xf153('0xc1')]['id']),'tags':_0x5742a6||[]};});}})[_0xf153('0x2d')](respondWithResult(_0x74943,null))[_0xf153('0x3e')](handleError(_0x74943,null));};exports['removeTags']=function(_0x9d9d65,_0x301675){return db[_0xf153('0xaf')][_0xf153('0x72')]({'where':{'id':_0x9d9d65[_0xf153('0xc1')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x301675,null))[_0xf153('0x2d')](function(_0x4a5c86){if(_0x4a5c86){return _0x4a5c86['removeTags'](_0x9d9d65[_0xf153('0x4d')][_0xf153('0x108')]);}})['then'](respondWithStatusCode(_0x301675,null))[_0xf153('0x3e')](handleError(_0x301675,null));};exports[_0xf153('0xea')]=function(_0x252e74,_0x48f9ff){var _0x2180ec=moment()[_0xf153('0x112')]()[_0xf153('0xad')]();var _0x265407=path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x115'));var _0x2a39ae=path[_0xf153('0xe6')](config['root'],_0xf153('0x113'),_0xf153('0x114'),_0xf153('0x116'));var _0x154c3c=path[_0xf153('0xe6')](_0x265407,_0x2180ec);var _0x5b9c=util[_0xf153('0xf4')](_0xf153('0x117'),_0x252e74[_0xf153('0xc1')]['id'],_0x2180ec);var _0x304d66=path['join'](_0x265407,_0x5b9c);var _0x444f68=[];_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x81'),'attributes':['id',_0xf153('0xfa')],'raw':!![]});_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0xd8')],'as':_0xf153('0x76'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x252e74[_0xf153('0x4d')]['attachments']){_0x444f68[_0xf153('0x3d')]({'model':db[_0xf153('0x118')],'as':_0xf153('0x118'),'raw':!![]});}var _0x3d553d=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0xf153('0x86'),_0xf153('0xfc'),_0xf153('0xfd'),_0xf153('0x119'),_0xf153('0x11a')],'include':_0x444f68}];_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0xc9')],'as':_0xf153('0x11b'),'attributes':['id',_0xf153('0x30')]});_0x3d553d[_0xf153('0x3d')]({'model':db[_0xf153('0x81')],'as':_0xf153('0x11c'),'attributes':['id',_0xf153('0xfa')]});return db[_0xf153('0xaf')]['find']({'where':{'id':_0x252e74[_0xf153('0xc1')]['id']},'include':_0x3d553d})[_0xf153('0x2d')](handleEntityNotFound(_0x48f9ff,null))[_0xf153('0x2d')](function(_0xf53fc6){if(_0xf53fc6){var _0x45112b=_0xf53fc6[_0xf153('0x11d')]({'plain':!![]});fs[_0xf153('0x11e')](_0x154c3c);var _0x1435bd={'channel':_0xf153('0x11f'),'account':_0x45112b[_0xf153('0x11b')]['name'],'agent':_0x45112b[_0xf153('0x11c')]?_0x45112b[_0xf153('0x11c')][_0xf153('0xfa')]:_0xf153('0x120'),'createdAt':moment(_0x45112b['createdAt'])[_0xf153('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x45112b['closed']?moment(_0x45112b['closedAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')]():'','disposition':_0x45112b[_0xf153('0x45')],'chatInfo':{'browser':_0x45112b[_0xf153('0x121')],'os':_0x45112b['osName'],'referer':_0x45112b[_0xf153('0x122')],'customerIp':_0x45112b[_0xf153('0x123')],'customerPort':_0x45112b['customerPort']?_0x45112b[_0xf153('0x124')]:_0xf153('0x120')},'messages':_(_0x45112b['Messages'])[_0xf153('0x125')]()['filter']({'secret':![]})[_0xf153('0x39')](function(_0x5aa0bf){if(_0x5aa0bf[_0xf153('0x118')]){var _0x5ec77c=path[_0xf153('0xe6')](_0x2a39ae,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')]);if(fs[_0xf153('0x126')](_0x5ec77c)){fs[_0xf153('0x127')](_0x5ec77c)['pipe'](fs[_0xf153('0x128')](path[_0xf153('0xe6')](_0x154c3c,_0x5aa0bf[_0xf153('0x118')][_0xf153('0xdf')])));}}return{'date':moment(_0x5aa0bf['createdAt'])[_0xf153('0xf4')](_0xf153('0x10a'))[_0xf153('0xad')](),'sender':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?_0x5aa0bf['User']?_0x5aa0bf[_0xf153('0x81')][_0xf153('0xfa')]:_0xf153('0xf2'):_0x5aa0bf[_0xf153('0x76')]['firstName']+(_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]?'\x20'+_0x5aa0bf[_0xf153('0x76')][_0xf153('0x129')]:''),'body':_0x5aa0bf[_0xf153('0x118')]?_0x5aa0bf['Attachment'][_0xf153('0xdf')]:_0x5aa0bf[_0xf153('0x86')],'direction':_0x5aa0bf[_0xf153('0xfd')]===_0xf153('0xd4')?'A':'C','secret':_0x5aa0bf[_0xf153('0x119')],'read':_0x5aa0bf[_0xf153('0x11a')],'attachment':_0x5aa0bf['Attachment']};})['value']()};return ejs[_0xf153('0x12a')](path[_0xf153('0xe6')](config[_0xf153('0xe7')],_0xf153('0x113'),_0xf153('0x12b'),'downloadInteraction.ejs'),{'interaction':_0x1435bd})[_0xf153('0x2d')](function(_0x415d13){var _0xb2f8e0=path[_0xf153('0xe6')](_0x154c3c,_0xf153('0x12c')+_0x45112b['id']+'-'+_0x2180ec+'.pdf');var _0x3b6a0e={'path':_0xb2f8e0,'channel':_0xf153('0x11f'),'interactionId':_0x45112b['id']};return pdf['createPdfFromHTML'](_0x415d13,_0x3b6a0e);})[_0xf153('0x2d')](function(){return new Promise(function(_0x19de76,_0x5912d8){zipdir(_0x154c3c,{'saveTo':_0x304d66},function(_0x426db4,_0x52677c){if(_0x426db4)return _0x5912d8(_0x426db4);return _0x19de76(_0x52677c);});})[_0xf153('0x2d')](function(){return new BPromise(function(_0x200d37,_0x393d95){rimraf(_0x154c3c,function(_0x30a638){if(_0x30a638)_0x393d95(_0x30a638);return _0x200d37();});});})[_0xf153('0x2d')](function(){return _0x48f9ff['download'](_0x304d66,_0x5b9c,function(_0x416a91){if(_0x416a91){logger['error'](_0xf153('0x12d'),_0x416a91);}else{fs[_0xf153('0x12e')](_0x304d66);}});});});}else{return _0x48f9ff[_0xf153('0x22')](0xc8);}})[_0xf153('0x3e')](handleError(_0x48f9ff,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5e3d279..127db86 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 _0xb80f=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','hook','exports'];(function(_0x5771a1,_0x3939ef){var _0x5a3ffe=function(_0x59bc39){while(--_0x59bc39){_0x5771a1['push'](_0x5771a1['shift']());}};_0x5a3ffe(++_0x3939ef);}(_0xb80f,0x190));var _0xfb80=function(_0x4f3957,_0x2dbe4b){_0x4f3957=_0x4f3957-0x0;var _0x44816c=_0xb80f[_0x4f3957];return _0x44816c;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xfb80('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xfb80('0x0'))['db'][_0xfb80('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfb80('0x2')](0x0);var events={'afterCreate':_0xfb80('0x3'),'afterUpdate':_0xfb80('0x4'),'afterDestroy':_0xfb80('0x5')};function emitEvent(_0x40367f){return function(_0x5c63c4,_0x18d0af,_0x290846){_0x5c63c4[_0xfb80('0x6')]({'attributes':['id'],'raw':!![]})[_0xfb80('0x7')](function(_0x31e8cb){_0x5c63c4[_0xfb80('0x8')](_0xfb80('0x9'),_0x31e8cb['map'](function(_0x3c5f4d){return{'id':_0x3c5f4d['id']};}));return ChatMessage[_0xfb80('0xa')]({'where':{'ChatInteractionId':_0x5c63c4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfb80('0x7')](function(_0x58ee4e){_0x5c63c4[_0xfb80('0x8')]('unreadMessages',_0x58ee4e[_0xfb80('0xb')]);ChatInteractionEvents[_0xfb80('0xc')](_0x40367f+':'+_0x5c63c4['id'],_0x5c63c4);ChatInteractionEvents['emit'](_0x40367f,_0x5c63c4);_0x290846(null);})['catch'](_0x290846(null));};}for(var e in events){if(events[_0xfb80('0xd')](e)){var event=events[e];ChatInteraction[_0xfb80('0xe')](e,emitEvent(event));}}module[_0xfb80('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xeb87=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','ChatMessage','update','remove'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0xeb87,0xc0));var _0x7eb8=function(_0xe617cc,_0x59ded5){_0xe617cc=_0xe617cc-0x0;var _0x3d1c51=_0xeb87[_0xe617cc];return _0x3d1c51;};'use strict';var EventEmitter=require(_0x7eb8('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x7eb8('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7eb8('0x2'),'afterDestroy':_0x7eb8('0x3')};function emitEvent(_0x4baa3d){return function(_0x5182a8,_0x18463e,_0x4c7915){_0x5182a8['getUsers']({'attributes':['id'],'raw':!![]})[_0x7eb8('0x4')](function(_0x4a5ea4){_0x5182a8[_0x7eb8('0x5')]('Users',_0x4a5ea4[_0x7eb8('0x6')](function(_0x3ad5eb){return{'id':_0x3ad5eb['id']};}));return ChatMessage[_0x7eb8('0x7')]({'where':{'ChatInteractionId':_0x5182a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7eb8('0x4')](function(_0x899fe0){_0x5182a8[_0x7eb8('0x5')](_0x7eb8('0x8'),_0x899fe0[_0x7eb8('0x9')]);ChatInteractionEvents[_0x7eb8('0xa')](_0x4baa3d+':'+_0x5182a8['id'],_0x5182a8);ChatInteractionEvents[_0x7eb8('0xa')](_0x4baa3d,_0x5182a8);_0x4c7915(null);})[_0x7eb8('0xb')](_0x4c7915(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x7eb8('0xc')](e,emitEvent(event));}}module[_0x7eb8('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 97ff98b..c74b4f2 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 _0x2cd8=['closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','chat_interactions','closed'];(function(_0x319b23,_0x2bc213){var _0x3542a6=function(_0x1c6c51){while(--_0x1c6c51){_0x319b23['push'](_0x319b23['shift']());}};_0x3542a6(++_0x2bc213);}(_0x2cd8,0xc7));var _0x82cd=function(_0xcf60a,_0x460780){_0xcf60a=_0xcf60a-0x0;var _0x8f76f=_0x2cd8[_0xcf60a];return _0x8f76f;};'use strict';var _=require(_0x82cd('0x0'));var util=require('util');var logger=require(_0x82cd('0x1'))(_0x82cd('0x2'));var moment=require(_0x82cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x82cd('0x4'));var fs=require('fs');var path=require(_0x82cd('0x5'));var rimraf=require(_0x82cd('0x6'));var config=require(_0x82cd('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x82cd('0x8')]=function(_0x4ce5e3,_0x2c8cc2){return _0x4ce5e3['define']('ChatInteraction',attributes,{'tableName':_0x82cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e3042,_0x2e4d50,_0x2194cd){if(_0x1e3042['changed'](_0x82cd('0xa'))){_0x1e3042[_0x82cd('0xb')]=moment()['format'](_0x82cd('0xc'));}_0x2194cd(null,_0x1e3042);}},'charset':_0x82cd('0xd'),'collate':_0x82cd('0xe')});}; \ No newline at end of file +var _0xa160=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_interactions','changed'];(function(_0x48d8c4,_0x1556e6){var _0x36c652=function(_0x4fb0ad){while(--_0x4fb0ad){_0x48d8c4['push'](_0x48d8c4['shift']());}};_0x36c652(++_0x1556e6);}(_0xa160,0xb6));var _0x0a16=function(_0x1c529b,_0x17dc54){_0x1c529b=_0x1c529b-0x0;var _0x5e64ca=_0xa160[_0x1c529b];return _0x5e64ca;};'use strict';var _=require(_0x0a16('0x0'));var util=require(_0x0a16('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0a16('0x2'));var rp=require(_0x0a16('0x3'));var fs=require('fs');var path=require(_0x0a16('0x4'));var rimraf=require(_0x0a16('0x5'));var config=require(_0x0a16('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x0a16('0x7')]=function(_0x3b5e69,_0x42c030){return _0x3b5e69['define']('ChatInteraction',attributes,{'tableName':_0x0a16('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x116e7b,_0x45697a,_0x4edfb4){if(_0x116e7b[_0x0a16('0x9')](_0x0a16('0xa'))){_0x116e7b[_0x0a16('0xb')]=moment()[_0x0a16('0xc')](_0x0a16('0xd'));}_0x4edfb4(null,_0x116e7b);}},'charset':_0x0a16('0xe'),'collate':_0x0a16('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 210d487..48dfde8 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 _0x5103=['find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ChatInteraction','update','body','options','raw','where','UpdateChatInteraction'];(function(_0x20d732,_0x3bfac8){var _0x462538=function(_0x56623d){while(--_0x56623d){_0x20d732['push'](_0x20d732['shift']());}};_0x462538(++_0x3bfac8);}(_0x5103,0x1a7));var _0x3510=function(_0x3ba0a5,_0x26ff89){_0x3ba0a5=_0x3ba0a5-0x0;var _0x58765e=_0x5103[_0x3ba0a5];return _0x58765e;};'use strict';var _=require(_0x3510('0x0'));var util=require(_0x3510('0x1'));var moment=require('moment');var BPromise=require(_0x3510('0x2'));var rs=require(_0x3510('0x3'));var fs=require('fs');var Redis=require(_0x3510('0x4'));var db=require(_0x3510('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3510('0x6'));var jayson=require(_0x3510('0x7'));var client=jayson[_0x3510('0x8')][_0x3510('0x9')]({'port':0x232a});config[_0x3510('0xa')]=_[_0x3510('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3510('0xc'))(new Redis(config[_0x3510('0xa')]));require(_0x3510('0xd'))['register'](socket);function respondWithRpcPromise(_0x481398,_0x17584b,_0x35719f){return new BPromise(function(_0x135a22,_0x32bc86){return client[_0x3510('0xe')](_0x481398,_0x35719f)[_0x3510('0xf')](function(_0x4fd7ee){logger[_0x3510('0x10')](_0x3510('0x11'),_0x17584b,'request\x20sent');logger[_0x3510('0x12')](_0x3510('0x13'),_0x17584b,_0x3510('0x14'),JSON[_0x3510('0x15')](_0x4fd7ee));if(_0x4fd7ee[_0x3510('0x16')]){if(_0x4fd7ee['error'][_0x3510('0x17')]===0x1f4){logger[_0x3510('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x17584b,_0x4fd7ee[_0x3510('0x16')][_0x3510('0x18')]);return _0x32bc86(_0x4fd7ee[_0x3510('0x16')][_0x3510('0x18')]);}logger[_0x3510('0x16')](_0x3510('0x11'),_0x17584b,_0x4fd7ee['error'][_0x3510('0x18')]);return _0x135a22(_0x4fd7ee[_0x3510('0x16')][_0x3510('0x18')]);}else{logger[_0x3510('0x10')](_0x3510('0x11'),_0x17584b,_0x3510('0x14'));_0x135a22(_0x4fd7ee['result'][_0x3510('0x18')]);}})[_0x3510('0x19')](function(_0x313555){logger[_0x3510('0x16')](_0x3510('0x11'),_0x17584b,_0x313555);_0x32bc86(_0x313555);});});}exports['UpdateChatInteraction']=function(_0x53102b){var _0x20fcc8=this;return new Promise(function(_0x32dd6b,_0x24d593){return db[_0x3510('0x1a')][_0x3510('0x1b')](_0x53102b[_0x3510('0x1c')],{'raw':_0x53102b[_0x3510('0x1d')]?_0x53102b['options'][_0x3510('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53102b['options']?_0x53102b[_0x3510('0x1d')][_0x3510('0x1f')]||null:null,'attributes':_0x53102b[_0x3510('0x1d')]?_0x53102b['options']['attributes']||null:null,'limit':_0x53102b['options']?_0x53102b[_0x3510('0x1d')]['limit']||null:null})[_0x3510('0xf')](function(_0x278947){logger['info']('UpdateChatInteraction',_0x53102b);logger[_0x3510('0x12')]('UpdateChatInteraction',_0x53102b,JSON['stringify'](_0x278947));_0x32dd6b(_0x278947);})[_0x3510('0x19')](function(_0x221b29){logger[_0x3510('0x16')](_0x3510('0x20'),_0x221b29[_0x3510('0x18')],_0x53102b);_0x24d593(_0x20fcc8['error'](0x1f4,_0x221b29['message']));});});};exports['AddTagsToChatInteraction']=function(_0x3911d9){return new Promise(function(_0xbc0d18,_0x41e708){return db[_0x3510('0x1a')][_0x3510('0x21')]({'where':_0x3911d9[_0x3510('0x1d')]?_0x3911d9[_0x3510('0x1d')][_0x3510('0x1f')]||null:null})[_0x3510('0xf')](function(_0x34a7cf){if(_0x34a7cf){return _0x34a7cf[_0x3510('0x22')](_0x3911d9[_0x3510('0x1c')][_0x3510('0x23')],_['omit'](_0x3911d9[_0x3510('0x1c')],[_0x3510('0x23'),'id'])||{});}})[_0x3510('0x24')](function(_0x115d17){logger['info'](_0x3510('0x25'),_0x3911d9);logger[_0x3510('0x12')](_0x3510('0x25'),_0x3911d9,JSON['stringify'](_0x115d17));_0xbc0d18(_0x115d17);})[_0x3510('0x19')](function(_0x4af225){logger[_0x3510('0x16')](_0x3510('0x25'),_0x4af225['message'],_0x3911d9);_0x41e708(_this[_0x3510('0x16')](0x1f4,_0x4af225['message']));});});}; \ No newline at end of file +var _0x1d98=['ids','omit','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','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','code','message','result','UpdateChatInteraction','ChatInteraction','body','options','where','limit','AddTagsToChatInteraction','find','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d98,0x1bd));var _0x81d9=function(_0x4e3be8,_0x194867){_0x4e3be8=_0x4e3be8-0x0;var _0x496611=_0x1d98[_0x4e3be8];return _0x496611;};'use strict';var _=require(_0x81d9('0x0'));var util=require(_0x81d9('0x1'));var moment=require(_0x81d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x81d9('0x3'));var fs=require('fs');var Redis=require(_0x81d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x81d9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x81d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x81d9('0x7')][_0x81d9('0x8')]({'port':0x232a});config[_0x81d9('0x9')]=_[_0x81d9('0xa')](config[_0x81d9('0x9')],{'host':_0x81d9('0xb'),'port':0x18eb});var socket=require(_0x81d9('0xc'))(new Redis(config[_0x81d9('0x9')]));require(_0x81d9('0xd'))['register'](socket);function respondWithRpcPromise(_0x9b5238,_0x2d0577,_0x5e60c6){return new BPromise(function(_0x5cb3b3,_0x88ae91){return client[_0x81d9('0xe')](_0x9b5238,_0x5e60c6)[_0x81d9('0xf')](function(_0x4b4efb){logger[_0x81d9('0x10')](_0x81d9('0x11'),_0x2d0577,_0x81d9('0x12'));logger[_0x81d9('0x13')](_0x81d9('0x14'),_0x2d0577,_0x81d9('0x12'),JSON[_0x81d9('0x15')](_0x4b4efb));if(_0x4b4efb[_0x81d9('0x16')]){if(_0x4b4efb[_0x81d9('0x16')][_0x81d9('0x17')]===0x1f4){logger[_0x81d9('0x16')](_0x81d9('0x11'),_0x2d0577,_0x4b4efb['error'][_0x81d9('0x18')]);return _0x88ae91(_0x4b4efb[_0x81d9('0x16')][_0x81d9('0x18')]);}logger['error'](_0x81d9('0x11'),_0x2d0577,_0x4b4efb[_0x81d9('0x16')]['message']);return _0x5cb3b3(_0x4b4efb['error'][_0x81d9('0x18')]);}else{logger[_0x81d9('0x10')](_0x81d9('0x11'),_0x2d0577,'request\x20sent');_0x5cb3b3(_0x4b4efb[_0x81d9('0x19')][_0x81d9('0x18')]);}})['catch'](function(_0x5640ad){logger['error'](_0x81d9('0x11'),_0x2d0577,_0x5640ad);_0x88ae91(_0x5640ad);});});}exports[_0x81d9('0x1a')]=function(_0xb8b52){var _0x14bfd3=this;return new Promise(function(_0x5302dd,_0x1fed45){return db[_0x81d9('0x1b')]['update'](_0xb8b52[_0x81d9('0x1c')],{'raw':_0xb8b52[_0x81d9('0x1d')]?_0xb8b52['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb8b52['options']?_0xb8b52[_0x81d9('0x1d')][_0x81d9('0x1e')]||null:null,'attributes':_0xb8b52[_0x81d9('0x1d')]?_0xb8b52[_0x81d9('0x1d')]['attributes']||null:null,'limit':_0xb8b52[_0x81d9('0x1d')]?_0xb8b52[_0x81d9('0x1d')][_0x81d9('0x1f')]||null:null})['then'](function(_0x3d7fc2){logger[_0x81d9('0x10')](_0x81d9('0x1a'),_0xb8b52);logger['debug'](_0x81d9('0x1a'),_0xb8b52,JSON[_0x81d9('0x15')](_0x3d7fc2));_0x5302dd(_0x3d7fc2);})['catch'](function(_0x40e1bb){logger[_0x81d9('0x16')](_0x81d9('0x1a'),_0x40e1bb[_0x81d9('0x18')],_0xb8b52);_0x1fed45(_0x14bfd3[_0x81d9('0x16')](0x1f4,_0x40e1bb[_0x81d9('0x18')]));});});};exports[_0x81d9('0x20')]=function(_0x34701e){return new Promise(function(_0x2bc672,_0x41e6cc){return db[_0x81d9('0x1b')][_0x81d9('0x21')]({'where':_0x34701e[_0x81d9('0x1d')]?_0x34701e[_0x81d9('0x1d')][_0x81d9('0x1e')]||null:null})[_0x81d9('0xf')](function(_0x294c28){if(_0x294c28){return _0x294c28[_0x81d9('0x22')](_0x34701e['body'][_0x81d9('0x23')],_[_0x81d9('0x24')](_0x34701e[_0x81d9('0x1c')],[_0x81d9('0x23'),'id'])||{});}})[_0x81d9('0x25')](function(_0x37e2e2){logger[_0x81d9('0x10')]('AddTags',_0x34701e);logger[_0x81d9('0x13')](_0x81d9('0x26'),_0x34701e,JSON[_0x81d9('0x15')](_0x37e2e2));_0x2bc672(_0x37e2e2);})[_0x81d9('0x27')](function(_0x6eec96){logger[_0x81d9('0x16')](_0x81d9('0x26'),_0x6eec96[_0x81d9('0x18')],_0x34701e);_0x41e6cc(_this[_0x81d9('0x16')](0x1f4,_0x6eec96['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 073cb6b..ca41b1d 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 _0x863a=['removeListener','register','chatInteraction:','save','remove'];(function(_0xf700f9,_0x590be3){var _0x41f335=function(_0x159979){while(--_0x159979){_0xf700f9['push'](_0xf700f9['shift']());}};_0x41f335(++_0x590be3);}(_0x863a,0x107));var _0xa863=function(_0x44de7a,_0x3c7ace){_0x44de7a=_0x44de7a-0x0;var _0x4111fb=_0x863a[_0x44de7a];return _0x4111fb;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xa863('0x0'),_0xa863('0x1'),'update'];function createListener(_0x3b959e,_0x4cc094){return function(_0x5e2ebc){_0x4cc094['emit'](_0x3b959e,_0x5e2ebc);};}function removeListener(_0x5333b0,_0x4549c0){return function(){ChatInteractionEvents[_0xa863('0x2')](_0x5333b0,_0x4549c0);};}exports[_0xa863('0x3')]=function(_0x1d820e){for(var _0x366868=0x0,_0x4ff995=events['length'];_0x366868<_0x4ff995;_0x366868++){var _0x1318dd=events[_0x366868];var _0x100722=createListener(_0xa863('0x4')+_0x1318dd,_0x1d820e);ChatInteractionEvents['on'](_0x1318dd,_0x100722);}}; \ No newline at end of file +var _0x0922=['./chatInteraction.events','remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x16a52e,_0xc67a21){var _0x2397e2=function(_0x5201ae){while(--_0x5201ae){_0x16a52e['push'](_0x16a52e['shift']());}};_0x2397e2(++_0xc67a21);}(_0x0922,0x90));var _0x2092=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x0922[_0x1ff575];return _0x48fc9e;};'use strict';var ChatInteractionEvents=require(_0x2092('0x0'));var events=['save',_0x2092('0x1'),_0x2092('0x2')];function createListener(_0x5347d4,_0x1a3c12){return function(_0x1fe6d5){_0x1a3c12[_0x2092('0x3')](_0x5347d4,_0x1fe6d5);};}function removeListener(_0x29bab6,_0x3c9776){return function(){ChatInteractionEvents[_0x2092('0x4')](_0x29bab6,_0x3c9776);};}exports[_0x2092('0x5')]=function(_0x19f3f6){for(var _0xbf44b6=0x0,_0x16a6a2=events[_0x2092('0x6')];_0xbf44b6<_0x16a6a2;_0xbf44b6++){var _0x2349a3=events[_0xbf44b6];var _0x330a3f=createListener(_0x2092('0x7')+_0x2349a3,_0x19f3f6);ChatInteractionEvents['on'](_0x2349a3,_0x330a3f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d0a5d0e..3aeae88 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 _0xa8c6=['isChatInteractionAuthorized','getMyMessages','/:id/download','download','post','create','createVidaooSession','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','/:id/messages','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','attachmentDownload','/:id/my_messages'];(function(_0x1bc1b7,_0x316155){var _0x4e29a8=function(_0x5e3a47){while(--_0x5e3a47){_0x1bc1b7['push'](_0x1bc1b7['shift']());}};_0x4e29a8(++_0x316155);}(_0xa8c6,0x142));var _0x6a8c=function(_0x4ef1a9,_0x59a5fa){_0x4ef1a9=_0x4ef1a9-0x0;var _0x23f201=_0xa8c6[_0x4ef1a9];return _0x23f201;};'use strict';var multer=require(_0x6a8c('0x0'));var util=require(_0x6a8c('0x1'));var path=require(_0x6a8c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a8c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a8c('0x4'));var config=require(_0x6a8c('0x5'));var controller=require('./chatInteraction.controller');router[_0x6a8c('0x6')]('/',auth[_0x6a8c('0x7')](),controller[_0x6a8c('0x8')]);router['get'](_0x6a8c('0x9'),auth['isAuthenticated'](),controller[_0x6a8c('0xa')]);router[_0x6a8c('0x6')](_0x6a8c('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x6a8c('0x6')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x6a8c('0xc')]);router[_0x6a8c('0x6')]('/:id/messages',auth[_0x6a8c('0x7')](),controller['getMessages']);router[_0x6a8c('0x6')](_0x6a8c('0xd'),auth[_0x6a8c('0xe')](),controller[_0x6a8c('0xf')]);router[_0x6a8c('0x6')](_0x6a8c('0x10'),auth['isAuthenticated'](),controller[_0x6a8c('0x11')]);router[_0x6a8c('0x12')]('/',auth[_0x6a8c('0x7')](),controller[_0x6a8c('0x13')]);router[_0x6a8c('0x12')]('/:id/vidaoo',auth[_0x6a8c('0x7')](),controller[_0x6a8c('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1af5f6,_0x2d871f,_0x26a097){_0x26a097(null,path['join'](config['root'],_0x6a8c('0x15')));},'filename':function(_0x9d0126,_0x11259f,_0x3511dd){_0x3511dd(null,util[_0x6a8c('0x16')](_0x6a8c('0x17'),Date[_0x6a8c('0x18')](),_0x11259f[_0x6a8c('0x19')][_0x6a8c('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6a8c('0x12')](_0x6a8c('0x1b'),upload['single'](_0x6a8c('0x1c')),controller[_0x6a8c('0x1d')]);router[_0x6a8c('0x12')](_0x6a8c('0x1e'),auth[_0x6a8c('0xe')](),controller['addMessage']);router[_0x6a8c('0x12')](_0x6a8c('0x1f'),auth[_0x6a8c('0x7')](),interaction[_0x6a8c('0x20')](_0x6a8c('0x21'),_0x6a8c('0x22')),controller[_0x6a8c('0x23')]);router['put'](_0x6a8c('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x6a8c('0x21'),_0x6a8c('0x24')),controller[_0x6a8c('0x25')]);router[_0x6a8c('0x26')](_0x6a8c('0x27'),controller['customUpdate']);router[_0x6a8c('0x26')](_0x6a8c('0x28'),auth[_0x6a8c('0xe')](),controller[_0x6a8c('0x29')]);router[_0x6a8c('0x26')](_0x6a8c('0x2a'),controller['close']);router[_0x6a8c('0x2b')](_0x6a8c('0xb'),auth['isAuthenticated'](),interaction[_0x6a8c('0x20')](_0x6a8c('0x21'),_0x6a8c('0x2c')),controller[_0x6a8c('0x2d')]);router[_0x6a8c('0x2b')](_0x6a8c('0x1f'),auth[_0x6a8c('0x7')](),controller[_0x6a8c('0x2e')]);module[_0x6a8c('0x2f')]=router; \ No newline at end of file +var _0x9175=['chatinteraction:update','/:id/custom_update','customUpdate','put','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags'];(function(_0x5e56d2,_0x69a9d9){var _0x382751=function(_0x44c5ef){while(--_0x44c5ef){_0x5e56d2['push'](_0x5e56d2['shift']());}};_0x382751(++_0x69a9d9);}(_0x9175,0x184));var _0x5917=function(_0x397ce6,_0x2ee6f8){_0x397ce6=_0x397ce6-0x0;var _0x31db01=_0x9175[_0x397ce6];return _0x31db01;};'use strict';var multer=require(_0x5917('0x0'));var util=require(_0x5917('0x1'));var path=require(_0x5917('0x2'));var timeout=require(_0x5917('0x3'));var express=require(_0x5917('0x4'));var router=express[_0x5917('0x5')]();var fs_extra=require(_0x5917('0x6'));var auth=require(_0x5917('0x7'));var interaction=require(_0x5917('0x8'));var config=require(_0x5917('0x9'));var controller=require(_0x5917('0xa'));router[_0x5917('0xb')]('/',auth[_0x5917('0xc')](),controller[_0x5917('0xd')]);router[_0x5917('0xb')]('/describe',auth[_0x5917('0xc')](),controller[_0x5917('0xe')]);router[_0x5917('0xb')](_0x5917('0xf'),auth[_0x5917('0x10')](),controller[_0x5917('0x11')]);router[_0x5917('0xb')](_0x5917('0x12'),auth[_0x5917('0x10')](),controller[_0x5917('0x13')]);router[_0x5917('0xb')](_0x5917('0x14'),auth['isAuthenticated'](),controller[_0x5917('0x15')]);router['get'](_0x5917('0x16'),auth[_0x5917('0x10')](),controller[_0x5917('0x17')]);router[_0x5917('0xb')](_0x5917('0x18'),auth[_0x5917('0xc')](),controller[_0x5917('0x19')]);router[_0x5917('0x1a')]('/',auth[_0x5917('0xc')](),controller['create']);router[_0x5917('0x1a')](_0x5917('0x1b'),auth[_0x5917('0xc')](),controller[_0x5917('0x1c')]);var upload=multer({'storage':multer[_0x5917('0x1d')]({'destination':function(_0x3c2768,_0x3fc463,_0x6d6f61){_0x6d6f61(null,path['join'](config[_0x5917('0x1e')],_0x5917('0x1f')));},'filename':function(_0x75fe01,_0x1d7214,_0x122e4a){_0x122e4a(null,util['format']('%s-%s',Date[_0x5917('0x20')](),_0x1d7214[_0x5917('0x21')][_0x5917('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5917('0x23'),upload[_0x5917('0x24')](_0x5917('0x25')),controller[_0x5917('0x26')]);router[_0x5917('0x1a')](_0x5917('0x14'),auth[_0x5917('0x10')](),controller['addMessage']);router[_0x5917('0x1a')](_0x5917('0x27'),auth['isAuthenticated'](),interaction[_0x5917('0x28')](_0x5917('0x29'),_0x5917('0x2a')),controller[_0x5917('0x2b')]);router['put'](_0x5917('0xf'),auth[_0x5917('0xc')](),interaction[_0x5917('0x28')]('chat',_0x5917('0x2c')),controller['update']);router['put'](_0x5917('0x2d'),controller[_0x5917('0x2e')]);router[_0x5917('0x2f')]('/:id/abandon',auth[_0x5917('0x10')](),controller['abandon']);router[_0x5917('0x2f')](_0x5917('0x30'),controller[_0x5917('0x31')]);router[_0x5917('0x32')](_0x5917('0xf'),auth[_0x5917('0xc')](),interaction['tracked'](_0x5917('0x29'),'chatinteraction:destroy'),controller[_0x5917('0x33')]);router[_0x5917('0x32')](_0x5917('0x27'),auth[_0x5917('0xc')](),controller[_0x5917('0x34')]);module[_0x5917('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 8edb41d..b6ec768 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 _0x2730=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x20643a,_0x4dd717){var _0x5e21fe=function(_0x1cdf46){while(--_0x1cdf46){_0x20643a['push'](_0x20643a['shift']());}};_0x5e21fe(++_0x4dd717);}(_0x2730,0x137));var _0x0273=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2730[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0273('0x0'));module[_0x0273('0x1')]={'body':{'type':Sequelize[_0x0273('0x2')](_0x0273('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0273('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x0273('0x5')]}}; \ No newline at end of file +var _0xe826=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x316725,_0x560533){var _0x201762=function(_0x5756f1){while(--_0x5756f1){_0x316725['push'](_0x316725['shift']());}};_0x201762(++_0x560533);}(_0xe826,0x16a));var _0x6e82=function(_0x7732b9,_0x54bbd1){_0x7732b9=_0x7732b9-0x0;var _0x3b5af9=_0xe826[_0x7732b9];return _0x3b5af9;};'use strict';var Sequelize=require(_0x6e82('0x0'));module[_0x6e82('0x1')]={'body':{'type':Sequelize[_0x6e82('0x2')](_0x6e82('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6e82('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6e82('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 7decd9e..11da3c1 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 _0x6522=['role','userpic','lastLoginAt','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','undefined','offset','count','set','json','apply','reject','then','destroy','end','error','stack','name','send','index','ChatInternalMessage','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','catch','show','params','create','body','update','find','describe','get','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','fullname'];(function(_0x710820,_0x14ac63){var _0x58450e=function(_0xbb271d){while(--_0xbb271d){_0x710820['push'](_0x710820['shift']());}};_0x58450e(++_0x14ac63);}(_0x6522,0x14d));var _0x2652=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6522[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x2652('0x0'));var rimraf=require(_0x2652('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2652('0x2'));var rp=require(_0x2652('0x3'));var moment=require(_0x2652('0x4'));var BPromise=require(_0x2652('0x5'));var Mustache=require('mustache');var util=require(_0x2652('0x6'));var path=require(_0x2652('0x7'));var sox=require(_0x2652('0x8'));var csv=require('to-csv');var ejs=require(_0x2652('0x9'));var fs=require('fs');var fs_extra=require(_0x2652('0xa'));var _=require(_0x2652('0xb'));var squel=require(_0x2652('0xc'));var crypto=require(_0x2652('0xd'));var jsforce=require(_0x2652('0xe'));var deskjs=require(_0x2652('0xf'));var toCsv=require(_0x2652('0x10'));var querystring=require(_0x2652('0x11'));var Papa=require(_0x2652('0x12'));var Redis=require(_0x2652('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2652('0x14'));var as=require(_0x2652('0x15'));var hardwareService=require(_0x2652('0x16'));var logger=require('../../config/logger')(_0x2652('0x17'));var utils=require(_0x2652('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2652('0x19'));var db=require('../../mysqldb')['db'];config[_0x2652('0x1a')]=_[_0x2652('0x1b')](config['redis'],{'host':_0x2652('0x1c'),'port':0x18eb});var socket=require(_0x2652('0x1d'))(new Redis(config['redis']));require(_0x2652('0x1e'))[_0x2652('0x1f')](socket);function respondWithStatusCode(_0x31aefd,_0x272108){_0x272108=_0x272108||0xcc;return function(_0x1a6e7a){if(_0x1a6e7a){return _0x31aefd[_0x2652('0x20')](_0x272108);}return _0x31aefd['status'](_0x272108)['end']();};}function respondWithResult(_0x549d5d,_0x480363){_0x480363=_0x480363||0xc8;return function(_0x491678){if(_0x491678){return _0x549d5d[_0x2652('0x21')](_0x480363)['json'](_0x491678);}};}function respondWithFilteredResult(_0x3082af,_0x1ccbb2){return function(_0x2a206d){if(_0x2a206d){var _0x6b930f=typeof _0x1ccbb2['offset']===_0x2652('0x22')&&typeof _0x1ccbb2['limit']===_0x2652('0x22');var _0x5bed30=_0x2a206d['count'];var _0x28ade3=_0x6b930f?0x0:_0x1ccbb2[_0x2652('0x23')];var _0x246f9d=_0x6b930f?_0x2a206d[_0x2652('0x24')]:_0x1ccbb2[_0x2652('0x23')]+_0x1ccbb2['limit'];var _0x9b506f;if(_0x246f9d>=_0x5bed30){_0x246f9d=_0x5bed30;_0x9b506f=0xc8;}else{_0x9b506f=0xce;}_0x3082af[_0x2652('0x21')](_0x9b506f);return _0x3082af[_0x2652('0x25')]('Content-Range',_0x28ade3+'-'+_0x246f9d+'/'+_0x5bed30)[_0x2652('0x26')](_0x2a206d);}return null;};}function patchUpdates(_0x954a0){return function(_0x1aef7f){try{jsonpatch[_0x2652('0x27')](_0x1aef7f,_0x954a0,!![]);}catch(_0x256e08){return BPromise[_0x2652('0x28')](_0x256e08);}return _0x1aef7f['save']();};}function saveUpdates(_0x469848,_0x580bf7){return function(_0x3c5c13){if(_0x3c5c13){return _0x3c5c13['update'](_0x469848)[_0x2652('0x29')](function(_0x4896d0){return _0x4896d0;});}return null;};}function removeEntity(_0x1a27cb,_0x39de86){return function(_0x30cc71){if(_0x30cc71){return _0x30cc71[_0x2652('0x2a')]()[_0x2652('0x29')](function(){_0x1a27cb[_0x2652('0x21')](0xcc)[_0x2652('0x2b')]();});}};}function handleEntityNotFound(_0x35107c,_0x39a9db){return function(_0xbbd615){if(!_0xbbd615){_0x35107c['sendStatus'](0x194);}return _0xbbd615;};}function handleError(_0x3126e6,_0x4b2e2b){_0x4b2e2b=_0x4b2e2b||0x1f4;return function(_0x2bc9c9){logger[_0x2652('0x2c')](_0x2bc9c9[_0x2652('0x2d')]);if(_0x2bc9c9[_0x2652('0x2e')]){delete _0x2bc9c9[_0x2652('0x2e')];}_0x3126e6[_0x2652('0x21')](_0x4b2e2b)[_0x2652('0x2f')](_0x2bc9c9);};}exports[_0x2652('0x30')]=function(_0x27412e,_0x2c624d){var _0x26de4b={},_0x5804ff={},_0x834b35={'count':0x0,'rows':[]};var _0x1da709=_['map'](db[_0x2652('0x31')][_0x2652('0x32')],function(_0x246731){return{'name':_0x246731['fieldName'],'type':_0x246731['type'][_0x2652('0x33')]};});_0x5804ff[_0x2652('0x34')]=_[_0x2652('0x35')](_0x1da709,_0x2652('0x2e'));_0x5804ff[_0x2652('0x36')]=_[_0x2652('0x37')](_0x27412e['query']);_0x5804ff['filters']=_['intersection'](_0x5804ff[_0x2652('0x34')],_0x5804ff['query']);_0x26de4b[_0x2652('0x38')]=_[_0x2652('0x39')](_0x5804ff[_0x2652('0x34')],qs[_0x2652('0x3a')](_0x27412e[_0x2652('0x36')][_0x2652('0x3a')]));_0x26de4b[_0x2652('0x38')]=_0x26de4b['attributes'][_0x2652('0x3b')]?_0x26de4b[_0x2652('0x38')]:_0x5804ff[_0x2652('0x34')];if(!_0x27412e['query'][_0x2652('0x3c')](_0x2652('0x3d'))){_0x26de4b[_0x2652('0x3e')]=qs['limit'](_0x27412e[_0x2652('0x36')][_0x2652('0x3e')]);_0x26de4b['offset']=qs['offset'](_0x27412e[_0x2652('0x36')]['offset']);}_0x26de4b['order']=qs[_0x2652('0x3f')](_0x27412e['query']['sort']);_0x26de4b[_0x2652('0x40')]=qs[_0x2652('0x41')](_[_0x2652('0x42')](_0x27412e['query'],_0x5804ff[_0x2652('0x41')]),_0x1da709);if(_0x27412e[_0x2652('0x36')][_0x2652('0x43')]){_0x26de4b[_0x2652('0x40')]=_[_0x2652('0x44')](_0x26de4b[_0x2652('0x40')],{'$or':_[_0x2652('0x35')](_0x1da709,function(_0x4ed269){if(_0x4ed269[_0x2652('0x45')]!=='VIRTUAL'){var _0x923e1={};_0x923e1[_0x4ed269[_0x2652('0x2e')]]={'$like':'%'+_0x27412e['query']['filter']+'%'};return _0x923e1;}})});}_0x26de4b=_[_0x2652('0x44')]({},_0x26de4b,_0x27412e[_0x2652('0x46')]);var _0x13cfae={'where':_0x26de4b[_0x2652('0x40')]};return db[_0x2652('0x31')]['count'](_0x13cfae)[_0x2652('0x29')](function(_0xc74401){_0x834b35[_0x2652('0x24')]=_0xc74401;if(_0x27412e[_0x2652('0x36')][_0x2652('0x47')]){_0x26de4b[_0x2652('0x48')]=[{'all':!![]}];}return db[_0x2652('0x31')]['findAll'](_0x26de4b);})['then'](function(_0x5ebae4){_0x834b35['rows']=_0x5ebae4;return _0x834b35;})[_0x2652('0x29')](respondWithFilteredResult(_0x2c624d,_0x26de4b))[_0x2652('0x49')](handleError(_0x2c624d,null));};exports[_0x2652('0x4a')]=function(_0x57ba12,_0x1e52fa){var _0x1d696e={'raw':!![],'where':{'id':_0x57ba12[_0x2652('0x4b')]['id']}},_0x1b84ee={};_0x1b84ee[_0x2652('0x34')]=_[_0x2652('0x37')](db[_0x2652('0x31')][_0x2652('0x32')]);_0x1b84ee[_0x2652('0x36')]=_['keys'](_0x57ba12['query']);_0x1b84ee[_0x2652('0x41')]=_[_0x2652('0x39')](_0x1b84ee[_0x2652('0x34')],_0x1b84ee['query']);_0x1d696e[_0x2652('0x38')]=_[_0x2652('0x39')](_0x1b84ee[_0x2652('0x34')],qs[_0x2652('0x3a')](_0x57ba12['query'][_0x2652('0x3a')]));_0x1d696e[_0x2652('0x38')]=_0x1d696e[_0x2652('0x38')][_0x2652('0x3b')]?_0x1d696e[_0x2652('0x38')]:_0x1b84ee[_0x2652('0x34')];if(_0x57ba12[_0x2652('0x36')]['includeAll']){_0x1d696e['include']=[{'all':!![]}];}_0x1d696e=_[_0x2652('0x44')]({},_0x1d696e,_0x57ba12['options']);return db[_0x2652('0x31')]['find'](_0x1d696e)['then'](handleEntityNotFound(_0x1e52fa,null))[_0x2652('0x29')](respondWithResult(_0x1e52fa,null))[_0x2652('0x49')](handleError(_0x1e52fa,null));};exports['create']=function(_0x34761b,_0x194d06){return db[_0x2652('0x31')][_0x2652('0x4c')](_0x34761b[_0x2652('0x4d')],{})[_0x2652('0x29')](respondWithResult(_0x194d06,0xc9))[_0x2652('0x49')](handleError(_0x194d06,null));};exports[_0x2652('0x4e')]=function(_0xfd2d8e,_0x56933a){if(_0xfd2d8e[_0x2652('0x4d')]['id']){delete _0xfd2d8e[_0x2652('0x4d')]['id'];}return db[_0x2652('0x31')][_0x2652('0x4f')]({'where':{'id':_0xfd2d8e[_0x2652('0x4b')]['id']}})[_0x2652('0x29')](handleEntityNotFound(_0x56933a,null))['then'](saveUpdates(_0xfd2d8e[_0x2652('0x4d')],null))[_0x2652('0x29')](respondWithResult(_0x56933a,null))['catch'](handleError(_0x56933a,null));};exports[_0x2652('0x2a')]=function(_0x15c07a,_0x1fdf56){return db['ChatInternalMessage']['find']({'where':{'id':_0x15c07a[_0x2652('0x4b')]['id']}})[_0x2652('0x29')](handleEntityNotFound(_0x1fdf56,null))['then'](removeEntity(_0x1fdf56,null))[_0x2652('0x49')](handleError(_0x1fdf56,null));};exports[_0x2652('0x50')]=function(_0x1d9b1b,_0x16cb7d){return db[_0x2652('0x31')][_0x2652('0x50')]()[_0x2652('0x29')](respondWithResult(_0x16cb7d,null))[_0x2652('0x49')](handleError(_0x16cb7d,null));};function wrapUser(_0x72c9d3){return function(_0x236c2d){var _0x134dc4=_0x72c9d3[_0x2652('0x51')]({'plain':!![]});_0x134dc4[_0x2652('0x52')]=[];if(_0x236c2d){_0x134dc4['lastMessageAt']=_0x236c2d[_0x2652('0x53')];_0x134dc4[_0x2652('0x54')]=_0x236c2d;}else{_0x134dc4[_0x2652('0x55')]=moment(0x0)['format'](_0x2652('0x56'));_0x134dc4[_0x2652('0x54')]={};}return _0x134dc4;};}exports['getUsers']=function(_0x5ba61e,_0x49d675,_0x430924){var _0x59b974=[];return db[_0x2652('0x57')][_0x2652('0x58')]({'where':{'role':[_0x2652('0x59'),'admin','user']},'attributes':['id',_0x2652('0x5a'),_0x2652('0x2e'),_0x2652('0x5b'),_0x2652('0x5c'),'internal','online',_0x2652('0x5d'),'allowmessenger','showWebBar'],'order':qs[_0x2652('0x3f')]('-online'),'include':[{'model':db[_0x2652('0x5e')],'as':_0x2652('0x5f'),'attributes':['id',_0x2652('0x2e'),_0x2652('0x45')],'through':{'attributes':[]}}]})['then'](function(_0x81dc00){if(_0x81dc00){var _0x4e723f=_0x5ba61e['user'][_0x2652('0x51')]({'plain':!![]});if(!_0x4e723f)throw new Error(_0x2652('0x60'));if(_0x4e723f[_0x2652('0x5b')]===_0x2652('0x61')){return db['UserProfileSection'][_0x2652('0x4f')]({'where':{'name':_0x2652('0x62'),'userProfileId':_0x4e723f[_0x2652('0x63')]},'raw':!![]})[_0x2652('0x29')](function(_0x5ad027){if(_0x5ad027){if(_0x5ad027[_0x2652('0x64')]===0x0){return db[_0x2652('0x65')][_0x2652('0x58')]({'where':{'sectionId':_0x5ad027['id']},'raw':!![]})[_0x2652('0x29')](function(_0x1e66f7){var _0x37704b=[];if(_[_0x2652('0x66')](_0x1e66f7)){_0x37704b=_[_0x2652('0x43')](_0x81dc00,function(_0x37b25e){if(_0x37b25e['role']!==_0x2652('0x59')){return _0x37b25e;}});return _0x37704b;}else{for(var _0x2d1b54=0x0;_0x2d1b54<_0x81dc00['length'];_0x2d1b54++){var _0x1a3b8e=_0x81dc00[_0x2d1b54];if(_0x1a3b8e[_0x2652('0x5b')]===_0x2652('0x59')){var _0x3c4cae=_['find'](_0x1e66f7,function(_0x273226){return _0x273226[_0x2652('0x67')]===_0x1a3b8e['id'];});if(_0x3c4cae)_0x37704b[_0x2652('0x68')](_0x1a3b8e);}else{_0x37704b[_0x2652('0x68')](_0x1a3b8e);}}return _0x37704b;}});}else{return _0x81dc00;}}else{var _0x1c684b=_[_0x2652('0x43')](_0x81dc00,function(_0x500ddb){if(_0x500ddb['role']!==_0x2652('0x59')){return _0x500ddb;}});return _0x1c684b;}});}else{return _0x81dc00;}}})[_0x2652('0x29')](function(_0x332f02){var _0x55854e=[];if(_0x332f02){_0x59b974=_0x332f02;for(var _0x40eede=0x0;_0x40eede<_0x332f02[_0x2652('0x3b')];_0x40eede+=0x1){_0x59b974[_0x40eede][_0x2652('0x52')]=[];_0x55854e['push'](db['ChatInternalMessage'][_0x2652('0x4f')]({'where':{'FromId':[_0x5ba61e[_0x2652('0x61')]['id'],_0x332f02[_0x40eede]['id']],'ToId':[_0x5ba61e[_0x2652('0x61')]['id'],_0x332f02[_0x40eede]['id']],'ChatGroupId':null},'attributes':['id',_0x2652('0x53'),'FromId','ToId','read',_0x2652('0x4d')],'order':qs[_0x2652('0x3f')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2652('0x29')](wrapUser(_0x332f02[_0x40eede])));}return BPromise[_0x2652('0x69')](_0x55854e);}return[];})[_0x2652('0x29')](function(_0x3d2071){return{'rows':_0x3d2071,'count':_0x3d2071[_0x2652('0x3b')]};})['then'](respondWithResult(_0x49d675,null))[_0x2652('0x49')](handleError(_0x49d675,null));}; \ No newline at end of file +var _0x0386=['agent','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','catch','show','options','find','create','body','params','destroy','describe','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','admin','user','role','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','findAll','isEmpty'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x0386,0x153));var _0x6038=function(_0x3bcf4f,_0x507a7b){_0x3bcf4f=_0x3bcf4f-0x0;var _0x26d549=_0x0386[_0x3bcf4f];return _0x26d549;};'use strict';var emlformat=require(_0x6038('0x0'));var rimraf=require(_0x6038('0x1'));var zipdir=require(_0x6038('0x2'));var jsonpatch=require(_0x6038('0x3'));var rp=require(_0x6038('0x4'));var moment=require(_0x6038('0x5'));var BPromise=require(_0x6038('0x6'));var Mustache=require(_0x6038('0x7'));var util=require('util');var path=require(_0x6038('0x8'));var sox=require(_0x6038('0x9'));var csv=require('to-csv');var ejs=require(_0x6038('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6038('0xb'));var squel=require(_0x6038('0xc'));var crypto=require(_0x6038('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6038('0xe'));var toCsv=require(_0x6038('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6038('0x10'));var authService=require(_0x6038('0x11'));var qs=require(_0x6038('0x12'));var as=require(_0x6038('0x13'));var hardwareService=require(_0x6038('0x14'));var logger=require(_0x6038('0x15'))('api');var utils=require(_0x6038('0x16'));var config=require(_0x6038('0x17'));var licenseUtil=require(_0x6038('0x18'));var db=require(_0x6038('0x19'))['db'];config[_0x6038('0x1a')]=_[_0x6038('0x1b')](config[_0x6038('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6038('0x1a')]));require('./chatInternalMessage.socket')[_0x6038('0x1c')](socket);function respondWithStatusCode(_0x294860,_0xacc34b){_0xacc34b=_0xacc34b||0xcc;return function(_0x4a77b1){if(_0x4a77b1){return _0x294860[_0x6038('0x1d')](_0xacc34b);}return _0x294860[_0x6038('0x1e')](_0xacc34b)[_0x6038('0x1f')]();};}function respondWithResult(_0x471295,_0x335690){_0x335690=_0x335690||0xc8;return function(_0x5e7e2a){if(_0x5e7e2a){return _0x471295[_0x6038('0x1e')](_0x335690)[_0x6038('0x20')](_0x5e7e2a);}};}function respondWithFilteredResult(_0x40ee3a,_0x330c56){return function(_0x5c346e){if(_0x5c346e){var _0x4d48d5=typeof _0x330c56[_0x6038('0x21')]==='undefined'&&typeof _0x330c56['limit']===_0x6038('0x22');var _0x34ab7f=_0x5c346e[_0x6038('0x23')];var _0x1a03db=_0x4d48d5?0x0:_0x330c56[_0x6038('0x21')];var _0x3b4f68=_0x4d48d5?_0x5c346e[_0x6038('0x23')]:_0x330c56[_0x6038('0x21')]+_0x330c56[_0x6038('0x24')];var _0x2558a5;if(_0x3b4f68>=_0x34ab7f){_0x3b4f68=_0x34ab7f;_0x2558a5=0xc8;}else{_0x2558a5=0xce;}_0x40ee3a[_0x6038('0x1e')](_0x2558a5);return _0x40ee3a['set'](_0x6038('0x25'),_0x1a03db+'-'+_0x3b4f68+'/'+_0x34ab7f)['json'](_0x5c346e);}return null;};}function patchUpdates(_0x2e764e){return function(_0x2872be){try{jsonpatch[_0x6038('0x26')](_0x2872be,_0x2e764e,!![]);}catch(_0x39b049){return BPromise['reject'](_0x39b049);}return _0x2872be[_0x6038('0x27')]();};}function saveUpdates(_0x5da1fb,_0x4b86cc){return function(_0x374ef9){if(_0x374ef9){return _0x374ef9[_0x6038('0x28')](_0x5da1fb)['then'](function(_0x3dc302){return _0x3dc302;});}return null;};}function removeEntity(_0x11e5fc,_0x3e94eb){return function(_0x159f49){if(_0x159f49){return _0x159f49['destroy']()['then'](function(){_0x11e5fc[_0x6038('0x1e')](0xcc)[_0x6038('0x1f')]();});}};}function handleEntityNotFound(_0x3af6f8,_0x1d0996){return function(_0x55904b){if(!_0x55904b){_0x3af6f8['sendStatus'](0x194);}return _0x55904b;};}function handleError(_0x339757,_0x2c4155){_0x2c4155=_0x2c4155||0x1f4;return function(_0x53ad90){logger[_0x6038('0x29')](_0x53ad90[_0x6038('0x2a')]);if(_0x53ad90[_0x6038('0x2b')]){delete _0x53ad90[_0x6038('0x2b')];}_0x339757['status'](_0x2c4155)['send'](_0x53ad90);};}exports[_0x6038('0x2c')]=function(_0x123c41,_0x456522){var _0x14a1e9={},_0x1abbb9={},_0x1e338d={'count':0x0,'rows':[]};var _0x578e6d=_[_0x6038('0x2d')](db[_0x6038('0x2e')][_0x6038('0x2f')],function(_0x4e94d2){return{'name':_0x4e94d2[_0x6038('0x30')],'type':_0x4e94d2[_0x6038('0x31')][_0x6038('0x32')]};});_0x1abbb9[_0x6038('0x33')]=_[_0x6038('0x2d')](_0x578e6d,'name');_0x1abbb9[_0x6038('0x34')]=_[_0x6038('0x35')](_0x123c41['query']);_0x1abbb9[_0x6038('0x36')]=_[_0x6038('0x37')](_0x1abbb9['model'],_0x1abbb9[_0x6038('0x34')]);_0x14a1e9[_0x6038('0x38')]=_['intersection'](_0x1abbb9[_0x6038('0x33')],qs[_0x6038('0x39')](_0x123c41[_0x6038('0x34')][_0x6038('0x39')]));_0x14a1e9['attributes']=_0x14a1e9['attributes'][_0x6038('0x3a')]?_0x14a1e9[_0x6038('0x38')]:_0x1abbb9[_0x6038('0x33')];if(!_0x123c41[_0x6038('0x34')][_0x6038('0x3b')](_0x6038('0x3c'))){_0x14a1e9[_0x6038('0x24')]=qs[_0x6038('0x24')](_0x123c41[_0x6038('0x34')][_0x6038('0x24')]);_0x14a1e9[_0x6038('0x21')]=qs[_0x6038('0x21')](_0x123c41[_0x6038('0x34')][_0x6038('0x21')]);}_0x14a1e9[_0x6038('0x3d')]=qs[_0x6038('0x3e')](_0x123c41[_0x6038('0x34')][_0x6038('0x3e')]);_0x14a1e9[_0x6038('0x3f')]=qs[_0x6038('0x36')](_[_0x6038('0x40')](_0x123c41['query'],_0x1abbb9['filters']),_0x578e6d);if(_0x123c41[_0x6038('0x34')][_0x6038('0x41')]){_0x14a1e9['where']=_[_0x6038('0x42')](_0x14a1e9[_0x6038('0x3f')],{'$or':_['map'](_0x578e6d,function(_0x528187){if(_0x528187[_0x6038('0x31')]!==_0x6038('0x43')){var _0x46c8bf={};_0x46c8bf[_0x528187[_0x6038('0x2b')]]={'$like':'%'+_0x123c41['query'][_0x6038('0x41')]+'%'};return _0x46c8bf;}})});}_0x14a1e9=_['merge']({},_0x14a1e9,_0x123c41['options']);var _0x3e421b={'where':_0x14a1e9[_0x6038('0x3f')]};return db[_0x6038('0x2e')][_0x6038('0x23')](_0x3e421b)[_0x6038('0x44')](function(_0x3d47b0){_0x1e338d['count']=_0x3d47b0;if(_0x123c41[_0x6038('0x34')][_0x6038('0x45')]){_0x14a1e9[_0x6038('0x46')]=[{'all':!![]}];}return db[_0x6038('0x2e')]['findAll'](_0x14a1e9);})[_0x6038('0x44')](function(_0x359311){_0x1e338d['rows']=_0x359311;return _0x1e338d;})[_0x6038('0x44')](respondWithFilteredResult(_0x456522,_0x14a1e9))[_0x6038('0x47')](handleError(_0x456522,null));};exports[_0x6038('0x48')]=function(_0x243103,_0x17bda4){var _0xd9f2f8={'raw':!![],'where':{'id':_0x243103['params']['id']}},_0x6c1589={};_0x6c1589['model']=_[_0x6038('0x35')](db[_0x6038('0x2e')][_0x6038('0x2f')]);_0x6c1589[_0x6038('0x34')]=_[_0x6038('0x35')](_0x243103['query']);_0x6c1589[_0x6038('0x36')]=_[_0x6038('0x37')](_0x6c1589[_0x6038('0x33')],_0x6c1589[_0x6038('0x34')]);_0xd9f2f8[_0x6038('0x38')]=_['intersection'](_0x6c1589['model'],qs[_0x6038('0x39')](_0x243103[_0x6038('0x34')][_0x6038('0x39')]));_0xd9f2f8[_0x6038('0x38')]=_0xd9f2f8[_0x6038('0x38')]['length']?_0xd9f2f8[_0x6038('0x38')]:_0x6c1589['model'];if(_0x243103[_0x6038('0x34')][_0x6038('0x45')]){_0xd9f2f8[_0x6038('0x46')]=[{'all':!![]}];}_0xd9f2f8=_['merge']({},_0xd9f2f8,_0x243103[_0x6038('0x49')]);return db[_0x6038('0x2e')][_0x6038('0x4a')](_0xd9f2f8)[_0x6038('0x44')](handleEntityNotFound(_0x17bda4,null))[_0x6038('0x44')](respondWithResult(_0x17bda4,null))[_0x6038('0x47')](handleError(_0x17bda4,null));};exports[_0x6038('0x4b')]=function(_0xc751cf,_0x4366a8){return db[_0x6038('0x2e')][_0x6038('0x4b')](_0xc751cf[_0x6038('0x4c')],{})[_0x6038('0x44')](respondWithResult(_0x4366a8,0xc9))[_0x6038('0x47')](handleError(_0x4366a8,null));};exports[_0x6038('0x28')]=function(_0x5231cc,_0x57b209){if(_0x5231cc[_0x6038('0x4c')]['id']){delete _0x5231cc[_0x6038('0x4c')]['id'];}return db[_0x6038('0x2e')][_0x6038('0x4a')]({'where':{'id':_0x5231cc[_0x6038('0x4d')]['id']}})[_0x6038('0x44')](handleEntityNotFound(_0x57b209,null))['then'](saveUpdates(_0x5231cc[_0x6038('0x4c')],null))['then'](respondWithResult(_0x57b209,null))[_0x6038('0x47')](handleError(_0x57b209,null));};exports[_0x6038('0x4e')]=function(_0x3d8985,_0x4a24b1){return db['ChatInternalMessage'][_0x6038('0x4a')]({'where':{'id':_0x3d8985[_0x6038('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a24b1,null))[_0x6038('0x44')](removeEntity(_0x4a24b1,null))[_0x6038('0x47')](handleError(_0x4a24b1,null));};exports[_0x6038('0x4f')]=function(_0x368933,_0x34e932){return db['ChatInternalMessage'][_0x6038('0x4f')]()[_0x6038('0x44')](respondWithResult(_0x34e932,null))[_0x6038('0x47')](handleError(_0x34e932,null));};function wrapUser(_0x5198d2){return function(_0x182d0d){var _0x1dd450=_0x5198d2['get']({'plain':!![]});_0x1dd450['messages']=[];if(_0x182d0d){_0x1dd450[_0x6038('0x50')]=_0x182d0d['createdAt'];_0x1dd450[_0x6038('0x51')]=_0x182d0d;}else{_0x1dd450[_0x6038('0x50')]=moment(0x0)[_0x6038('0x52')](_0x6038('0x53'));_0x1dd450[_0x6038('0x51')]={};}return _0x1dd450;};}exports['getUsers']=function(_0x1fa1f6,_0x37ad51,_0x51adfb){var _0x29f683=[];return db[_0x6038('0x54')]['findAll']({'where':{'role':['agent',_0x6038('0x55'),_0x6038('0x56')]},'attributes':['id','fullname',_0x6038('0x2b'),_0x6038('0x57'),'userpic',_0x6038('0x58'),'online',_0x6038('0x59'),_0x6038('0x5a'),_0x6038('0x5b')],'order':qs[_0x6038('0x3e')]('-online'),'include':[{'model':db[_0x6038('0x5c')],'as':_0x6038('0x5d'),'attributes':['id',_0x6038('0x2b'),_0x6038('0x31')],'through':{'attributes':[]}}]})[_0x6038('0x44')](function(_0x5b054a){if(_0x5b054a){var _0x568cc0=_0x1fa1f6[_0x6038('0x56')][_0x6038('0x5e')]({'plain':!![]});if(!_0x568cc0)throw new Error(_0x6038('0x5f'));if(_0x568cc0[_0x6038('0x57')]===_0x6038('0x56')){return db['UserProfileSection'][_0x6038('0x4a')]({'where':{'name':'Agents','userProfileId':_0x568cc0[_0x6038('0x60')]},'raw':!![]})[_0x6038('0x44')](function(_0x4fd5a2){if(_0x4fd5a2){if(_0x4fd5a2[_0x6038('0x61')]===0x0){return db[_0x6038('0x62')][_0x6038('0x63')]({'where':{'sectionId':_0x4fd5a2['id']},'raw':!![]})[_0x6038('0x44')](function(_0x4a72a3){var _0x37ba5b=[];if(_[_0x6038('0x64')](_0x4a72a3)){_0x37ba5b=_[_0x6038('0x41')](_0x5b054a,function(_0x5a3dfd){if(_0x5a3dfd[_0x6038('0x57')]!==_0x6038('0x65')){return _0x5a3dfd;}});return _0x37ba5b;}else{for(var _0xe39d54=0x0;_0xe39d54<_0x5b054a[_0x6038('0x3a')];_0xe39d54++){var _0xe3543f=_0x5b054a[_0xe39d54];if(_0xe3543f[_0x6038('0x57')]===_0x6038('0x65')){var _0x5c1af1=_['find'](_0x4a72a3,function(_0x40a2d3){return _0x40a2d3[_0x6038('0x66')]===_0xe3543f['id'];});if(_0x5c1af1)_0x37ba5b[_0x6038('0x67')](_0xe3543f);}else{_0x37ba5b[_0x6038('0x67')](_0xe3543f);}}return _0x37ba5b;}});}else{return _0x5b054a;}}else{var _0x58d89e=_[_0x6038('0x41')](_0x5b054a,function(_0x57c4cb){if(_0x57c4cb[_0x6038('0x57')]!==_0x6038('0x65')){return _0x57c4cb;}});return _0x58d89e;}});}else{return _0x5b054a;}}})[_0x6038('0x44')](function(_0x39aad6){var _0x130353=[];if(_0x39aad6){_0x29f683=_0x39aad6;for(var _0x4186cf=0x0;_0x4186cf<_0x39aad6['length'];_0x4186cf+=0x1){_0x29f683[_0x4186cf]['messages']=[];_0x130353['push'](db[_0x6038('0x2e')]['find']({'where':{'FromId':[_0x1fa1f6[_0x6038('0x56')]['id'],_0x39aad6[_0x4186cf]['id']],'ToId':[_0x1fa1f6[_0x6038('0x56')]['id'],_0x39aad6[_0x4186cf]['id']],'ChatGroupId':null},'attributes':['id',_0x6038('0x68'),_0x6038('0x69'),_0x6038('0x6a'),_0x6038('0x6b'),_0x6038('0x4c')],'order':qs[_0x6038('0x3e')](_0x6038('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6038('0x44')](wrapUser(_0x39aad6[_0x4186cf])));}return BPromise[_0x6038('0x6d')](_0x130353);}return[];})[_0x6038('0x44')](function(_0x2adcd2){return{'rows':_0x2adcd2,'count':_0x2adcd2['length']};})['then'](respondWithResult(_0x37ad51,null))[_0x6038('0x47')](handleError(_0x37ad51,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2cadb92..fb5f0ff 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 _0x4efa=['ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x311722,_0x196cae){var _0x2dbc3e=function(_0x4a5ebb){while(--_0x4a5ebb){_0x311722['push'](_0x311722['shift']());}};_0x2dbc3e(++_0x196cae);}(_0x4efa,0x181));var _0xa4ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4efa[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0xa4ef('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa4ef('0x1')](0x0);var events={'afterCreate':_0xa4ef('0x2'),'afterUpdate':'update','afterDestroy':_0xa4ef('0x3')};function emitEvent(_0x59ec30){return function(_0x5d0742,_0x4e6df9,_0x584cfe){ChatInternalMessageEvents['emit'](_0x59ec30+':'+_0x5d0742['id'],_0x5d0742);ChatInternalMessageEvents[_0xa4ef('0x4')](_0x59ec30,_0x5d0742);_0x584cfe(null);};}for(var e in events){if(events[_0xa4ef('0x5')](e)){var event=events[e];ChatInternalMessage[_0xa4ef('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x62a8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','ChatInternalMessage'];(function(_0x21ec2b,_0x1feca4){var _0x246e9e=function(_0x3cca26){while(--_0x3cca26){_0x21ec2b['push'](_0x21ec2b['shift']());}};_0x246e9e(++_0x1feca4);}(_0x62a8,0x142));var _0x862a=function(_0x4c27ee,_0x404762){_0x4c27ee=_0x4c27ee-0x0;var _0x2e2150=_0x62a8[_0x4c27ee];return _0x2e2150;};'use strict';var EventEmitter=require(_0x862a('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x862a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x862a('0x2')](0x0);var events={'afterCreate':_0x862a('0x3'),'afterUpdate':_0x862a('0x4'),'afterDestroy':_0x862a('0x5')};function emitEvent(_0x3931ef){return function(_0x728534,_0x3c3409,_0x1cc4b5){ChatInternalMessageEvents[_0x862a('0x6')](_0x3931ef+':'+_0x728534['id'],_0x728534);ChatInternalMessageEvents['emit'](_0x3931ef,_0x728534);_0x1cc4b5(null);};}for(var e in events){if(events[_0x862a('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x862a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b6058a2..28afb11 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 _0x6feb=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0xb356e4,_0xa40de9){var _0x319906=function(_0x41780a){while(--_0x41780a){_0xb356e4['push'](_0xb356e4['shift']());}};_0x319906(++_0xa40de9);}(_0x6feb,0x120));var _0xb6fe=function(_0x55103a,_0x4e3ae5){_0x55103a=_0x55103a-0x0;var _0x174fbd=_0x6feb[_0x55103a];return _0x174fbd;};'use strict';var _=require(_0xb6fe('0x0'));var util=require(_0xb6fe('0x1'));var logger=require(_0xb6fe('0x2'))('api');var moment=require(_0xb6fe('0x3'));var BPromise=require(_0xb6fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6fe('0x5'));var rimraf=require(_0xb6fe('0x6'));var config=require(_0xb6fe('0x7'));var attributes=require(_0xb6fe('0x8'));module[_0xb6fe('0x9')]=function(_0x1ebcf9,_0x1510e4){return _0x1ebcf9[_0xb6fe('0xa')](_0xb6fe('0xb'),attributes,{'tableName':_0xb6fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6fe('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3ca0=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x903d0d,_0x51f65b){var _0x1ba526=function(_0x3f09c3){while(--_0x3f09c3){_0x903d0d['push'](_0x903d0d['shift']());}};_0x1ba526(++_0x51f65b);}(_0x3ca0,0x11c));var _0x03ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x03ca('0x0'));var util=require('util');var logger=require(_0x03ca('0x1'))(_0x03ca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x03ca('0x3'));var fs=require('fs');var path=require(_0x03ca('0x4'));var rimraf=require(_0x03ca('0x5'));var config=require(_0x03ca('0x6'));var attributes=require(_0x03ca('0x7'));module[_0x03ca('0x8')]=function(_0x4cd543,_0x412f8b){return _0x4cd543[_0x03ca('0x9')](_0x03ca('0xa'),attributes,{'tableName':_0x03ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x03ca('0xc'),'collate':_0x03ca('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4ee427f..ce35c87 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 _0xa60e=['debug','request\x20sent','stringify','error','code','message','info','ChatInternalMessage,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0xd9b70d,_0x2e8973){var _0x25854d=function(_0x53b85b){while(--_0x53b85b){_0xd9b70d['push'](_0xd9b70d['shift']());}};_0x25854d(++_0x2e8973);}(_0xa60e,0x1c3));var _0xea60=function(_0x2f38af,_0x2253f3){_0x2f38af=_0x2f38af-0x0;var _0x2ccb7d=_0xa60e[_0x2f38af];return _0x2ccb7d;};'use strict';var _=require(_0xea60('0x0'));var util=require(_0xea60('0x1'));var moment=require(_0xea60('0x2'));var BPromise=require(_0xea60('0x3'));var rs=require(_0xea60('0x4'));var fs=require('fs');var Redis=require(_0xea60('0x5'));var db=require(_0xea60('0x6'))['db'];var utils=require(_0xea60('0x7'));var logger=require(_0xea60('0x8'))('rpc');var config=require(_0xea60('0x9'));var jayson=require(_0xea60('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xea60('0xb')]=_[_0xea60('0xc')](config[_0xea60('0xb')],{'host':_0xea60('0xd'),'port':0x18eb});var socket=require(_0xea60('0xe'))(new Redis(config[_0xea60('0xb')]));require('./chatInternalMessage.socket')[_0xea60('0xf')](socket);function respondWithRpcPromise(_0x5aa7e9,_0x4de85b,_0x4b1c80){return new BPromise(function(_0x1a702e,_0x4b2ebb){return client[_0xea60('0x10')](_0x5aa7e9,_0x4b1c80)['then'](function(_0xd5e811){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x4de85b,'request\x20sent');logger[_0xea60('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4de85b,_0xea60('0x12'),JSON[_0xea60('0x13')](_0xd5e811));if(_0xd5e811[_0xea60('0x14')]){if(_0xd5e811[_0xea60('0x14')][_0xea60('0x15')]===0x1f4){logger[_0xea60('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x4de85b,_0xd5e811[_0xea60('0x14')][_0xea60('0x16')]);return _0x4b2ebb(_0xd5e811[_0xea60('0x14')][_0xea60('0x16')]);}logger[_0xea60('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x4de85b,_0xd5e811[_0xea60('0x14')][_0xea60('0x16')]);return _0x1a702e(_0xd5e811[_0xea60('0x14')][_0xea60('0x16')]);}else{logger[_0xea60('0x17')](_0xea60('0x18'),_0x4de85b,_0xea60('0x12'));_0x1a702e(_0xd5e811['result'][_0xea60('0x16')]);}})[_0xea60('0x19')](function(_0x1807f5){logger[_0xea60('0x14')](_0xea60('0x18'),_0x4de85b,_0x1807f5);_0x4b2ebb(_0x1807f5);});});} \ No newline at end of file +var _0xe0eb=['localhost','socket.io-emitter','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis'];(function(_0x1aba79,_0x335da1){var _0x3d2058=function(_0x3cf3a5){while(--_0x3cf3a5){_0x1aba79['push'](_0x1aba79['shift']());}};_0x3d2058(++_0x335da1);}(_0xe0eb,0x71));var _0xbe0e=function(_0xe3839f,_0x555463){_0xe3839f=_0xe3839f-0x0;var _0x43c987=_0xe0eb[_0xe3839f];return _0x43c987;};'use strict';var _=require(_0xbe0e('0x0'));var util=require(_0xbe0e('0x1'));var moment=require('moment');var BPromise=require(_0xbe0e('0x2'));var rs=require(_0xbe0e('0x3'));var fs=require('fs');var Redis=require(_0xbe0e('0x4'));var db=require(_0xbe0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe0e('0x6'))(_0xbe0e('0x7'));var config=require(_0xbe0e('0x8'));var jayson=require(_0xbe0e('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xbe0e('0xa')](config[_0xbe0e('0xb')],{'host':_0xbe0e('0xc'),'port':0x18eb});var socket=require(_0xbe0e('0xd'))(new Redis(config[_0xbe0e('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2de8ff,_0x59bd72,_0x219e5c){return new BPromise(function(_0x5ea57b,_0x1b0a61){return client[_0xbe0e('0xe')](_0x2de8ff,_0x219e5c)['then'](function(_0x59c89a){logger[_0xbe0e('0xf')](_0xbe0e('0x10'),_0x59bd72,_0xbe0e('0x11'));logger[_0xbe0e('0x12')](_0xbe0e('0x13'),_0x59bd72,'request\x20sent',JSON[_0xbe0e('0x14')](_0x59c89a));if(_0x59c89a['error']){if(_0x59c89a['error'][_0xbe0e('0x15')]===0x1f4){logger['error'](_0xbe0e('0x10'),_0x59bd72,_0x59c89a[_0xbe0e('0x16')][_0xbe0e('0x17')]);return _0x1b0a61(_0x59c89a['error'][_0xbe0e('0x17')]);}logger[_0xbe0e('0x16')](_0xbe0e('0x10'),_0x59bd72,_0x59c89a[_0xbe0e('0x16')]['message']);return _0x5ea57b(_0x59c89a[_0xbe0e('0x16')][_0xbe0e('0x17')]);}else{logger['info'](_0xbe0e('0x10'),_0x59bd72,_0xbe0e('0x11'));_0x5ea57b(_0x59c89a['result'][_0xbe0e('0x17')]);}})[_0xbe0e('0x18')](function(_0x3dabc4){logger[_0xbe0e('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x59bd72,_0x3dabc4);_0x1b0a61(_0x3dabc4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a8065dc..0625873 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 _0xa675=['./chatInternalMessage.events','save','remove','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa675,0xe8));var _0x5a67=function(_0x29b2a2,_0x4b7224){_0x29b2a2=_0x29b2a2-0x0;var _0x836e8c=_0xa675[_0x29b2a2];return _0x836e8c;};'use strict';var ChatInternalMessageEvents=require(_0x5a67('0x0'));var events=[_0x5a67('0x1'),_0x5a67('0x2'),'update'];function createListener(_0x101d0a,_0x29b0ec){return function(_0x356b23){_0x29b0ec[_0x5a67('0x3')](_0x101d0a,_0x356b23);};}function removeListener(_0x125f31,_0x2629f4){return function(){ChatInternalMessageEvents[_0x5a67('0x4')](_0x125f31,_0x2629f4);};}exports[_0x5a67('0x5')]=function(_0x33640a){for(var _0x5107c3=0x0,_0x28980e=events[_0x5a67('0x6')];_0x5107c3<_0x28980e;_0x5107c3++){var _0x46c3a3=events[_0x5107c3];var _0x153e1c=createListener(_0x5a67('0x7')+_0x46c3a3,_0x33640a);ChatInternalMessageEvents['on'](_0x46c3a3,_0x153e1c);}}; \ No newline at end of file +var _0xada1=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xada1,0x12b));var _0x1ada=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xada1[_0x411017];return _0x2adeea;};'use strict';var ChatInternalMessageEvents=require(_0x1ada('0x0'));var events=[_0x1ada('0x1'),'remove',_0x1ada('0x2')];function createListener(_0x3a329a,_0x4010c2){return function(_0xf01bdf){_0x4010c2[_0x1ada('0x3')](_0x3a329a,_0xf01bdf);};}function removeListener(_0x1f286a,_0x39be5f){return function(){ChatInternalMessageEvents[_0x1ada('0x4')](_0x1f286a,_0x39be5f);};}exports[_0x1ada('0x5')]=function(_0xaf6740){for(var _0x2a2f06=0x0,_0x1ed1e2=events[_0x1ada('0x6')];_0x2a2f06<_0x1ed1e2;_0x2a2f06++){var _0x3c123e=events[_0x2a2f06];var _0xcc8f48=createListener(_0x1ada('0x7')+_0x3c123e,_0xaf6740);ChatInternalMessageEvents['on'](_0x3c123e,_0xcc8f48);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 850880f..12b016b 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 _0xbf21=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/users','getUsers'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xbf21,0x106));var _0x1bf2=function(_0x56bc0d,_0x4e7bce){_0x56bc0d=_0x56bc0d-0x0;var _0x7c7c8b=_0xbf21[_0x56bc0d];return _0x7c7c8b;};'use strict';var multer=require(_0x1bf2('0x0'));var util=require(_0x1bf2('0x1'));var path=require(_0x1bf2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bf2('0x3')]();var fs_extra=require(_0x1bf2('0x4'));var auth=require(_0x1bf2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1bf2('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x1bf2('0x7')]('/',auth[_0x1bf2('0x8')](),controller[_0x1bf2('0x9')]);router['get'](_0x1bf2('0xa'),auth['isAuthenticated'](),controller[_0x1bf2('0xb')]);router[_0x1bf2('0x7')](_0x1bf2('0xc'),auth[_0x1bf2('0x8')](),controller[_0x1bf2('0xd')]);router[_0x1bf2('0x7')](_0x1bf2('0xe'),auth['isAuthenticated'](),controller[_0x1bf2('0xf')]);router[_0x1bf2('0x10')]('/',auth['isAuthenticated'](),controller[_0x1bf2('0x11')]);router[_0x1bf2('0x12')]('/:id',controller[_0x1bf2('0x13')]);router[_0x1bf2('0x14')](_0x1bf2('0xe'),auth[_0x1bf2('0x8')](),controller[_0x1bf2('0x15')]);module[_0x1bf2('0x16')]=router; \ No newline at end of file +var _0x5aa1=['/describe','isAuthenticated','describe','/users','getUsers','show','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index'];(function(_0x525ca3,_0x17acb7){var _0x2b6804=function(_0x292646){while(--_0x292646){_0x525ca3['push'](_0x525ca3['shift']());}};_0x2b6804(++_0x17acb7);}(_0x5aa1,0x12a));var _0x15aa=function(_0xe5b539,_0x467802){_0xe5b539=_0xe5b539-0x0;var _0x4bd185=_0x5aa1[_0xe5b539];return _0x4bd185;};'use strict';var multer=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var path=require('path');var timeout=require(_0x15aa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x15aa('0x3'));var auth=require(_0x15aa('0x4'));var interaction=require(_0x15aa('0x5'));var config=require(_0x15aa('0x6'));var controller=require(_0x15aa('0x7'));router[_0x15aa('0x8')]('/',auth['isAuthenticated'](),controller[_0x15aa('0x9')]);router['get'](_0x15aa('0xa'),auth[_0x15aa('0xb')](),controller[_0x15aa('0xc')]);router[_0x15aa('0x8')](_0x15aa('0xd'),auth[_0x15aa('0xb')](),controller[_0x15aa('0xe')]);router['get']('/:id',auth[_0x15aa('0xb')](),controller[_0x15aa('0xf')]);router['post']('/',auth[_0x15aa('0xb')](),controller[_0x15aa('0x10')]);router[_0x15aa('0x11')](_0x15aa('0x12'),controller[_0x15aa('0x13')]);router[_0x15aa('0x14')](_0x15aa('0x12'),auth[_0x15aa('0xb')](),controller[_0x15aa('0x15')]);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 10577fb..eaa0cb6 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 _0x8caf=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x1d34e3,_0x4f5844){_0x1d34e3=_0x1d34e3-0x0;var _0x34266b=_0x8caf[_0x1d34e3];return _0x34266b;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'body':{'type':Sequelize[_0xf8ca('0x1')](_0xf8ca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf8ca('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf8ca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf8ca('0x4')]('in','out'),'defaultValue':_0xf8ca('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf8ca('0x6')]},'providerName':{'type':Sequelize[_0xf8ca('0x7')]},'providerResponse':{'type':Sequelize[_0xf8ca('0x1')]}}; \ No newline at end of file +var _0x6a95=['ENUM','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x38cb64,_0x3cf237){var _0x543a29=function(_0x3d1503){while(--_0x3d1503){_0x38cb64['push'](_0x38cb64['shift']());}};_0x543a29(++_0x3cf237);}(_0x6a95,0x1db));var _0x56a9=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6a95[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'body':{'type':Sequelize[_0x56a9('0x2')](_0x56a9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x56a9('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x56a9('0x6')]},'providerName':{'type':Sequelize[_0x56a9('0x7')]},'providerResponse':{'type':Sequelize[_0x56a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4e38b2f..02dd7f3 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 _0x776d=['reject','update','destroy','sendStatus','stack','name','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','create','body','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','manual','SIP/%s','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','fullname','internal','motionChannel','rejectmessage','parse','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','status','end','offset','undefined','count','set','Content-Range','json'];(function(_0x117a8b,_0x5830de){var _0x574991=function(_0x87cae8){while(--_0x87cae8){_0x117a8b['push'](_0x117a8b['shift']());}};_0x574991(++_0x5830de);}(_0x776d,0x15f));var _0xd776=function(_0x58a86b,_0x31261a){_0x58a86b=_0x58a86b-0x0;var _0xf141c9=_0x776d[_0x58a86b];return _0xf141c9;};'use strict';var emlformat=require(_0xd776('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd776('0x1'));var rp=require(_0xd776('0x2'));var moment=require(_0xd776('0x3'));var BPromise=require(_0xd776('0x4'));var Mustache=require(_0xd776('0x5'));var util=require(_0xd776('0x6'));var path=require(_0xd776('0x7'));var sox=require(_0xd776('0x8'));var csv=require(_0xd776('0x9'));var ejs=require(_0xd776('0xa'));var fs=require('fs');var fs_extra=require(_0xd776('0xb'));var _=require(_0xd776('0xc'));var squel=require(_0xd776('0xd'));var crypto=require(_0xd776('0xe'));var jsforce=require(_0xd776('0xf'));var deskjs=require(_0xd776('0x10'));var toCsv=require(_0xd776('0x9'));var querystring=require(_0xd776('0x11'));var Papa=require(_0xd776('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd776('0x13'));var as=require(_0xd776('0x14'));var hardwareService=require(_0xd776('0x15'));var logger=require(_0xd776('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd776('0x17'));var licenseUtil=require(_0xd776('0x18'));var db=require(_0xd776('0x19'))['db'];config[_0xd776('0x1a')]=_[_0xd776('0x1b')](config[_0xd776('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xd776('0x1c'))(new Redis(config['redis']));require(_0xd776('0x1d'))[_0xd776('0x1e')](socket);var jayson=require(_0xd776('0x1f'));var client=jayson[_0xd776('0x20')][_0xd776('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xd776('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4e54f4,_0x5886d9,_0xda4af6,_0x39e2ad){return new BPromise(function(_0x3e74d,_0xdcc3b1){var _0x3002a0=_0x39e2ad||client;return _0x3002a0['request'](_0x4e54f4,_0xda4af6)[_0xd776('0x22')](function(_0x275445){logger[_0xd776('0x23')](_0xd776('0x24'),_0x5886d9,'request\x20sent');logger[_0xd776('0x25')](_0xd776('0x26'),_0x5886d9,_0xd776('0x27'),JSON[_0xd776('0x28')](_0x275445));if(_0x275445[_0xd776('0x29')]){if(_0x275445[_0xd776('0x29')]['code']===0x1f4){logger['error'](_0xd776('0x24'),_0x5886d9,_0x275445[_0xd776('0x29')]['message']);return _0xdcc3b1(_0x275445[_0xd776('0x29')][_0xd776('0x2a')]);}logger[_0xd776('0x29')](_0xd776('0x24'),_0x5886d9,_0x275445[_0xd776('0x29')]['message']);return _0x3e74d(_0x275445[_0xd776('0x29')]['message']);}else{logger[_0xd776('0x23')](_0xd776('0x24'),_0x5886d9,_0xd776('0x27'));_0x3e74d(_0x275445['result']['message']);}})['catch'](function(_0x31df14){logger[_0xd776('0x29')](_0xd776('0x24'),_0x5886d9,_0x31df14);_0xdcc3b1(_0x31df14);});});}function respondWithStatusCode(_0x4681f9,_0x22f433){_0x22f433=_0x22f433||0xcc;return function(_0x17e789){if(_0x17e789){return _0x4681f9['sendStatus'](_0x22f433);}return _0x4681f9[_0xd776('0x2b')](_0x22f433)[_0xd776('0x2c')]();};}function respondWithResult(_0x14ad80,_0xd641e4){_0xd641e4=_0xd641e4||0xc8;return function(_0x584f6d){if(_0x584f6d){return _0x14ad80[_0xd776('0x2b')](_0xd641e4)['json'](_0x584f6d);}};}function respondWithFilteredResult(_0x25dcab,_0x4c066c){return function(_0x499c79){if(_0x499c79){var _0x3c7dc3=typeof _0x4c066c[_0xd776('0x2d')]===_0xd776('0x2e')&&typeof _0x4c066c['limit']==='undefined';var _0x1d0aca=_0x499c79['count'];var _0x958d32=_0x3c7dc3?0x0:_0x4c066c[_0xd776('0x2d')];var _0x5716e0=_0x3c7dc3?_0x499c79[_0xd776('0x2f')]:_0x4c066c[_0xd776('0x2d')]+_0x4c066c['limit'];var _0x4316a3;if(_0x5716e0>=_0x1d0aca){_0x5716e0=_0x1d0aca;_0x4316a3=0xc8;}else{_0x4316a3=0xce;}_0x25dcab[_0xd776('0x2b')](_0x4316a3);return _0x25dcab[_0xd776('0x30')](_0xd776('0x31'),_0x958d32+'-'+_0x5716e0+'/'+_0x1d0aca)[_0xd776('0x32')](_0x499c79);}return null;};}function patchUpdates(_0x27c48b){return function(_0x159922){try{jsonpatch['apply'](_0x159922,_0x27c48b,!![]);}catch(_0x47cae7){return BPromise[_0xd776('0x33')](_0x47cae7);}return _0x159922['save']();};}function saveUpdates(_0x30043c,_0x1d080c){return function(_0x4f5d65){if(_0x4f5d65){return _0x4f5d65[_0xd776('0x34')](_0x30043c)['then'](function(_0x819a90){return _0x819a90;});}return null;};}function removeEntity(_0x307b0f,_0x22930e){return function(_0x3da0a5){if(_0x3da0a5){return _0x3da0a5[_0xd776('0x35')]()['then'](function(){_0x307b0f['status'](0xcc)[_0xd776('0x2c')]();});}};}function handleEntityNotFound(_0x351cc2,_0x4d4d16){return function(_0x787eec){if(!_0x787eec){_0x351cc2[_0xd776('0x36')](0x194);}return _0x787eec;};}function handleError(_0x1a27fe,_0x5cd3ab){_0x5cd3ab=_0x5cd3ab||0x1f4;return function(_0x429eaa){logger[_0xd776('0x29')](_0x429eaa[_0xd776('0x37')]);if(_0x429eaa[_0xd776('0x38')]){delete _0x429eaa[_0xd776('0x38')];}_0x1a27fe['status'](_0x5cd3ab)['send'](_0x429eaa);};}exports[_0xd776('0x39')]=function(_0x3fe0ee,_0x2e6996){var _0x242afc={},_0x454246={},_0x2f3f7f={'count':0x0,'rows':[]};var _0x368947=_[_0xd776('0x3a')](db[_0xd776('0x3b')]['rawAttributes'],function(_0x762631){return{'name':_0x762631[_0xd776('0x3c')],'type':_0x762631[_0xd776('0x3d')][_0xd776('0x3e')]};});_0x454246[_0xd776('0x3f')]=_[_0xd776('0x3a')](_0x368947,_0xd776('0x38'));_0x454246[_0xd776('0x40')]=_[_0xd776('0x41')](_0x3fe0ee[_0xd776('0x40')]);_0x454246[_0xd776('0x42')]=_[_0xd776('0x43')](_0x454246[_0xd776('0x3f')],_0x454246[_0xd776('0x40')]);_0x242afc[_0xd776('0x44')]=_['intersection'](_0x454246[_0xd776('0x3f')],qs[_0xd776('0x45')](_0x3fe0ee['query'][_0xd776('0x45')]));_0x242afc['attributes']=_0x242afc[_0xd776('0x44')][_0xd776('0x46')]?_0x242afc[_0xd776('0x44')]:_0x454246['model'];if(!_0x3fe0ee['query'][_0xd776('0x47')](_0xd776('0x48'))){_0x242afc['limit']=qs[_0xd776('0x49')](_0x3fe0ee['query'][_0xd776('0x49')]);_0x242afc[_0xd776('0x2d')]=qs[_0xd776('0x2d')](_0x3fe0ee[_0xd776('0x40')][_0xd776('0x2d')]);}_0x242afc[_0xd776('0x4a')]=qs[_0xd776('0x4b')](_0x3fe0ee[_0xd776('0x40')][_0xd776('0x4b')]);_0x242afc[_0xd776('0x4c')]=qs['filters'](_[_0xd776('0x4d')](_0x3fe0ee[_0xd776('0x40')],_0x454246[_0xd776('0x42')]),_0x368947);if(_0x3fe0ee[_0xd776('0x40')][_0xd776('0x4e')]){_0x242afc[_0xd776('0x4c')]=_['merge'](_0x242afc['where'],{'$or':_[_0xd776('0x3a')](_0x368947,function(_0x19f468){if(_0x19f468['type']!==_0xd776('0x4f')){var _0x31c15b={};_0x31c15b[_0x19f468[_0xd776('0x38')]]={'$like':'%'+_0x3fe0ee[_0xd776('0x40')][_0xd776('0x4e')]+'%'};return _0x31c15b;}})});}_0x242afc=_['merge']({},_0x242afc,_0x3fe0ee[_0xd776('0x50')]);var _0x4434b2={'where':_0x242afc[_0xd776('0x4c')]};return db[_0xd776('0x3b')][_0xd776('0x2f')](_0x4434b2)[_0xd776('0x22')](function(_0x37abd8){_0x2f3f7f['count']=_0x37abd8;if(_0x3fe0ee[_0xd776('0x40')][_0xd776('0x51')]){_0x242afc[_0xd776('0x52')]=[{'all':!![]}];}return db[_0xd776('0x3b')][_0xd776('0x53')](_0x242afc);})[_0xd776('0x22')](function(_0x2db8ef){_0x2f3f7f['rows']=_0x2db8ef;return _0x2f3f7f;})[_0xd776('0x22')](respondWithFilteredResult(_0x2e6996,_0x242afc))[_0xd776('0x54')](handleError(_0x2e6996,null));};exports[_0xd776('0x55')]=function(_0x59b8f3,_0x480daf){var _0x55871b={'raw':!![],'where':{'id':_0x59b8f3[_0xd776('0x56')]['id']}},_0x403015={};_0x403015[_0xd776('0x3f')]=_[_0xd776('0x41')](db['ChatMessage'][_0xd776('0x57')]);_0x403015[_0xd776('0x40')]=_['keys'](_0x59b8f3[_0xd776('0x40')]);_0x403015['filters']=_[_0xd776('0x43')](_0x403015[_0xd776('0x3f')],_0x403015[_0xd776('0x40')]);_0x55871b[_0xd776('0x44')]=_[_0xd776('0x43')](_0x403015[_0xd776('0x3f')],qs['fields'](_0x59b8f3[_0xd776('0x40')][_0xd776('0x45')]));_0x55871b[_0xd776('0x44')]=_0x55871b[_0xd776('0x44')][_0xd776('0x46')]?_0x55871b[_0xd776('0x44')]:_0x403015[_0xd776('0x3f')];if(_0x59b8f3[_0xd776('0x40')][_0xd776('0x51')]){_0x55871b[_0xd776('0x52')]=[{'all':!![]}];}_0x55871b=_[_0xd776('0x58')]({},_0x55871b,_0x59b8f3[_0xd776('0x50')]);return db[_0xd776('0x3b')][_0xd776('0x59')](_0x55871b)[_0xd776('0x22')](handleEntityNotFound(_0x480daf,null))[_0xd776('0x22')](respondWithResult(_0x480daf,null))['catch'](handleError(_0x480daf,null));};exports[_0xd776('0x5a')]=function(_0x6845d0,_0x53dd09){return db[_0xd776('0x3b')]['create'](_0x6845d0[_0xd776('0x5b')],{})[_0xd776('0x22')](respondWithResult(_0x53dd09,0xc9))[_0xd776('0x54')](handleError(_0x53dd09,null));};exports[_0xd776('0x34')]=function(_0x2889ab,_0x2b7126){if(_0x2889ab['body']['id']){delete _0x2889ab[_0xd776('0x5b')]['id'];}return db[_0xd776('0x3b')][_0xd776('0x59')]({'where':{'id':_0x2889ab[_0xd776('0x56')]['id']}})[_0xd776('0x22')](handleEntityNotFound(_0x2b7126,null))[_0xd776('0x22')](saveUpdates(_0x2889ab[_0xd776('0x5b')],null))['then'](respondWithResult(_0x2b7126,null))['catch'](handleError(_0x2b7126,null));};exports[_0xd776('0x35')]=function(_0x5dd5a4,_0x528301){return db[_0xd776('0x3b')]['find']({'where':{'id':_0x5dd5a4[_0xd776('0x56')]['id']}})['then'](handleEntityNotFound(_0x528301,null))[_0xd776('0x22')](removeEntity(_0x528301,null))[_0xd776('0x54')](handleError(_0x528301,null));};exports[_0xd776('0x5c')]=function(_0x827679,_0x3f07cb){return db[_0xd776('0x3b')][_0xd776('0x5c')]()[_0xd776('0x22')](respondWithResult(_0x3f07cb,null))['catch'](handleError(_0x3f07cb,null));};var interaction_log=require(_0xd776('0x16'))(_0xd776('0x5d'));exports[_0xd776('0x5e')]=function(_0x1d1a58,_0x38d4d7,_0x239933){var _0x438ddb={'agent':{},'channel':_0xd776('0x5f')};if(_0x1d1a58[_0xd776('0x5b')]['id']){delete _0x1d1a58[_0xd776('0x5b')]['id'];}_0x1d1a58[_0xd776('0x5b')]['read']=!![];_0x1d1a58[_0xd776('0x5b')][_0xd776('0x60')]=moment()[_0xd776('0x61')](_0xd776('0x62'));_0x1d1a58[_0xd776('0x5b')][_0xd776('0x63')]=_0x1d1a58['body'][_0xd776('0x63')]||_0x1d1a58[_0xd776('0x64')]['id'];_0x438ddb[_0xd776('0x65')]['id']=_0x1d1a58[_0xd776('0x5b')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x1d1a58[_0xd776('0x56')]['id'],'UserId':null}})[_0xd776('0x22')](handleEntityNotFound(_0x38d4d7,null))[_0xd776('0x22')](saveUpdates(_0x1d1a58[_0xd776('0x5b')],null))[_0xd776('0x22')](function(_0x1a4905){if(_0x1a4905){_0x438ddb[_0xd776('0x2a')]=_0x1a4905[_0xd776('0x66')]({'plain':!![]});return db[_0xd776('0x67')]['find']({'where':{'id':_0x1a4905[_0xd776('0x68')]}});}return null;})[_0xd776('0x22')](handleEntityNotFound(_0x38d4d7,null))[_0xd776('0x22')](function(_0x3ac0af){if(_0x3ac0af){return _0x3ac0af[_0xd776('0x34')]({'UserId':_0x1d1a58[_0xd776('0x5b')][_0xd776('0x63')],'read1stAt':_[_0xd776('0x69')](_0x3ac0af['read1stAt'])?moment()[_0xd776('0x61')](_0xd776('0x62')):undefined});}return null;})[_0xd776('0x22')](function(_0x311e5d){if(_0x311e5d){_0x438ddb[_0xd776('0x6a')]=_0x311e5d[_0xd776('0x66')]({'plain':!![]});interaction_log[_0xd776('0x23')](_0xd776('0x6b'),_0x1d1a58[_0xd776('0x64')]['id'],_0x1d1a58[_0xd776('0x64')][_0xd776('0x38')],_0x1d1a58[_0xd776('0x64')][_0xd776('0x6c')],_0x438ddb[_0xd776('0x6a')]['id'],_0x1d1a58['body']?JSON[_0xd776('0x28')](_0x1d1a58[_0xd776('0x5b')]):_0xd776('0x6d'));return respondWithRpcPromise(_0xd776('0x6e'),'acceptMessage',_0x438ddb);}return null;})[_0xd776('0x22')](function(_0x3b5850){var _0x5c635b=_0xd776('0x6f')+_0x3b5850[_0xd776('0x2a')][_0xd776('0x70')];return db[_0xd776('0x71')][_0xd776('0x40')](_0x5c635b,{'type':db[_0xd776('0x72')][_0xd776('0x73')][_0xd776('0x74')],'raw':!![]})[_0xd776('0x22')](function(_0x2fc2de){return _0x2fc2de;});})[_0xd776('0x22')](function(_0x44a94c){if(_0x44a94c){_0x438ddb[_0xd776('0x2a')][_0xd776('0x75')]=_0x44a94c[0x0];if(!_0x1d1a58['body'][_0xd776('0x63')])return;return db['User'][_0xd776('0x59')]({'where':{'id':_0x1d1a58[_0xd776('0x5b')][_0xd776('0x63')],'role':_0xd776('0x65')},'attributes':['id',_0xd776('0x38'),'fullname',_0xd776('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x15ed0f){if(!_0x15ed0f)return null;_0x438ddb[_0xd776('0x2a')]['agent']=_0x15ed0f;return _0x438ddb;})[_0xd776('0x22')](function(_0x49e021){if(_0x49e021){if(_0x1d1a58[_0xd776('0x5b')][_0xd776('0x77')]){_0x438ddb[_0xd776('0x2a')]['interface']=util['format'](_0xd776('0x78'),_0x1d1a58['user'][_0xd776('0x38')]);_0x438ddb[_0xd776('0x2a')][_0xd776('0x79')]=_0x438ddb[_0xd776('0x79')];_0x438ddb['message']['motionChannel']=_0x438ddb[_0xd776('0x79')];_0x438ddb[_0xd776('0x2a')][_0xd776('0x7a')]=_0xd776('0x5e');return respondWithRpcPromise('EventManager',_0xd776('0x7b'),{'event':_0xd776('0x7c'),'message':_['merge'](_0x438ddb[_0xd776('0x2a')],JSON['parse'](_0x438ddb[_0xd776('0x6a')][_0xd776('0x7d')]))},client9002)[_0xd776('0x22')](function(){return _0x438ddb;});}return _0x438ddb;}return null;})['then'](respondWithResult(_0x38d4d7,null))[_0xd776('0x54')](handleError(_0x38d4d7,null));};var interaction_log=require(_0xd776('0x16'))('chat-interactions');exports[_0xd776('0x33')]=function(_0xb14d07,_0x5c795c,_0x245623){var _0x5278bd={'agent':{},'channel':_0xd776('0x5f')};if(_0xb14d07['body']['id']){delete _0xb14d07[_0xd776('0x5b')]['id'];}_0xb14d07[_0xd776('0x5b')][_0xd776('0x63')]=_0xb14d07['body'][_0xd776('0x63')]||_0xb14d07[_0xd776('0x64')]['id'];_0x5278bd[_0xd776('0x65')]['id']=_0xb14d07[_0xd776('0x5b')][_0xd776('0x63')];return db[_0xd776('0x3b')][_0xd776('0x59')]({'where':{'id':_0xb14d07['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c795c,null))[_0xd776('0x22')](function(_0x36fcb1){if(_0x36fcb1){_0x5278bd[_0xd776('0x2a')]=_0x36fcb1[_0xd776('0x66')]({'plain':!![]});return db[_0xd776('0x67')][_0xd776('0x59')]({'where':{'id':_0x36fcb1[_0xd776('0x68')]}});}return null;})[_0xd776('0x22')](handleEntityNotFound(_0x5c795c,null))[_0xd776('0x22')](function(_0x36a293){if(_0x36a293){_0x5278bd[_0xd776('0x6a')]=_0x36a293['get']({'plain':!![]});interaction_log[_0xd776('0x23')](_0xd776('0x7e'),_0xb14d07[_0xd776('0x64')]['id'],_0xb14d07['user']['name'],_0xb14d07[_0xd776('0x64')][_0xd776('0x6c')],_0x5278bd[_0xd776('0x6a')]['id'],_0xb14d07[_0xd776('0x5b')]?JSON['stringify'](_0xb14d07[_0xd776('0x5b')]):_0xd776('0x6d'));return respondWithRpcPromise('RejectMessage',_0xd776('0x7f'),_0x5278bd);}return null;})[_0xd776('0x22')](function(_0xfd862){var _0x195572=_0xd776('0x6f')+_0xfd862[_0xd776('0x2a')][_0xd776('0x70')];return db['sequelize'][_0xd776('0x40')](_0x195572,{'type':db[_0xd776('0x72')][_0xd776('0x73')][_0xd776('0x74')],'raw':!![]})[_0xd776('0x22')](function(_0x1e52b6){return _0x1e52b6;});})['then'](function(_0x15d6c5){if(_0x15d6c5){_0x5278bd[_0xd776('0x2a')]['contact']=_0x15d6c5[0x0];if(!_0xb14d07[_0xd776('0x5b')][_0xd776('0x63')])return;return db[_0xd776('0x80')][_0xd776('0x59')]({'where':{'id':_0xb14d07['body'][_0xd776('0x63')],'role':_0xd776('0x65')},'attributes':['id','name',_0xd776('0x81'),_0xd776('0x76'),_0xd776('0x82')],'raw':!![]});}return null;})[_0xd776('0x22')](function(_0x10fc42){if(!_0x10fc42)return null;_0x5278bd[_0xd776('0x2a')][_0xd776('0x65')]=_0x10fc42;return _0x5278bd;})[_0xd776('0x22')](function(_0x403423){if(_0x403423){_0x403423[_0xd776('0x2a')]['interface']=util[_0xd776('0x61')](_0xd776('0x78'),_0xb14d07[_0xd776('0x64')][_0xd776('0x38')]);_0x403423[_0xd776('0x2a')]['channel']=_0x5278bd['channel'];_0x403423[_0xd776('0x2a')][_0xd776('0x83')]=_0x5278bd[_0xd776('0x79')];_0x403423[_0xd776('0x2a')][_0xd776('0x7a')]='reject';respondWithRpcPromise(_0xd776('0x7b'),_0xd776('0x7b'),{'event':_0xd776('0x84'),'message':_['merge'](_0x5278bd[_0xd776('0x2a')],JSON[_0xd776('0x85')](_0x5278bd[_0xd776('0x6a')][_0xd776('0x7d')]))},client9002);return _0x5278bd;}return null;})['then'](respondWithResult(_0x5c795c,null))[_0xd776('0x54')](handleError(_0x5c795c,null));}; \ No newline at end of file +var _0x4d1c=['ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','destroy','name','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','read1stAt','interaction','info','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','parse','formData','reject','ChatInteraction','RejectMessage','ContactId','SIP/%s','event','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4d1c,0xfa));var _0xc4d1=function(_0x2af021,_0x195fdd){_0x2af021=_0x2af021-0x0;var _0x2e057e=_0x4d1c[_0x2af021];return _0x2e057e;};'use strict';var emlformat=require(_0xc4d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4d1('0x1'));var jsonpatch=require(_0xc4d1('0x2'));var rp=require('request-promise');var moment=require(_0xc4d1('0x3'));var BPromise=require(_0xc4d1('0x4'));var Mustache=require(_0xc4d1('0x5'));var util=require(_0xc4d1('0x6'));var path=require(_0xc4d1('0x7'));var sox=require(_0xc4d1('0x8'));var csv=require(_0xc4d1('0x9'));var ejs=require(_0xc4d1('0xa'));var fs=require('fs');var fs_extra=require(_0xc4d1('0xb'));var _=require('lodash');var squel=require(_0xc4d1('0xc'));var crypto=require(_0xc4d1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc4d1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc4d1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc4d1('0x11'))(_0xc4d1('0x12'));var utils=require(_0xc4d1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc4d1('0x14'));var db=require(_0xc4d1('0x15'))['db'];config[_0xc4d1('0x16')]=_[_0xc4d1('0x17')](config[_0xc4d1('0x16')],{'host':_0xc4d1('0x18'),'port':0x18eb});var socket=require(_0xc4d1('0x19'))(new Redis(config[_0xc4d1('0x16')]));require(_0xc4d1('0x1a'))[_0xc4d1('0x1b')](socket);var jayson=require(_0xc4d1('0x1c'));var client=jayson[_0xc4d1('0x1d')][_0xc4d1('0x1e')]({'port':0x232c});var client9002=jayson[_0xc4d1('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25fba5,_0x25375d,_0x220381,_0x551594){return new BPromise(function(_0x13b4a7,_0x40f908){var _0x2ed25d=_0x551594||client;return _0x2ed25d['request'](_0x25fba5,_0x220381)['then'](function(_0x346a5f){logger['info'](_0xc4d1('0x1f'),_0x25375d,'request\x20sent');logger[_0xc4d1('0x20')](_0xc4d1('0x21'),_0x25375d,_0xc4d1('0x22'),JSON[_0xc4d1('0x23')](_0x346a5f));if(_0x346a5f[_0xc4d1('0x24')]){if(_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x25')]===0x1f4){logger[_0xc4d1('0x24')](_0xc4d1('0x1f'),_0x25375d,_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x26')]);return _0x40f908(_0x346a5f['error'][_0xc4d1('0x26')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x25375d,_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x26')]);return _0x13b4a7(_0x346a5f[_0xc4d1('0x24')][_0xc4d1('0x26')]);}else{logger['info'](_0xc4d1('0x1f'),_0x25375d,'request\x20sent');_0x13b4a7(_0x346a5f[_0xc4d1('0x27')][_0xc4d1('0x26')]);}})['catch'](function(_0x4a164d){logger[_0xc4d1('0x24')](_0xc4d1('0x1f'),_0x25375d,_0x4a164d);_0x40f908(_0x4a164d);});});}function respondWithStatusCode(_0x4837d8,_0x487010){_0x487010=_0x487010||0xcc;return function(_0x37a1db){if(_0x37a1db){return _0x4837d8[_0xc4d1('0x28')](_0x487010);}return _0x4837d8[_0xc4d1('0x29')](_0x487010)[_0xc4d1('0x2a')]();};}function respondWithResult(_0x52f770,_0x174e0b){_0x174e0b=_0x174e0b||0xc8;return function(_0x35c256){if(_0x35c256){return _0x52f770[_0xc4d1('0x29')](_0x174e0b)['json'](_0x35c256);}};}function respondWithFilteredResult(_0x1061dc,_0x29a852){return function(_0x153c61){if(_0x153c61){var _0x570723=typeof _0x29a852[_0xc4d1('0x2b')]==='undefined'&&typeof _0x29a852[_0xc4d1('0x2c')]===_0xc4d1('0x2d');var _0x4f598c=_0x153c61[_0xc4d1('0x2e')];var _0x305c12=_0x570723?0x0:_0x29a852[_0xc4d1('0x2b')];var _0xa986a3=_0x570723?_0x153c61[_0xc4d1('0x2e')]:_0x29a852[_0xc4d1('0x2b')]+_0x29a852['limit'];var _0x1b9206;if(_0xa986a3>=_0x4f598c){_0xa986a3=_0x4f598c;_0x1b9206=0xc8;}else{_0x1b9206=0xce;}_0x1061dc['status'](_0x1b9206);return _0x1061dc[_0xc4d1('0x2f')](_0xc4d1('0x30'),_0x305c12+'-'+_0xa986a3+'/'+_0x4f598c)[_0xc4d1('0x31')](_0x153c61);}return null;};}function patchUpdates(_0x30bfcf){return function(_0x345afd){try{jsonpatch[_0xc4d1('0x32')](_0x345afd,_0x30bfcf,!![]);}catch(_0x447739){return BPromise['reject'](_0x447739);}return _0x345afd['save']();};}function saveUpdates(_0x2b8af8,_0x155ec3){return function(_0x25057a){if(_0x25057a){return _0x25057a[_0xc4d1('0x33')](_0x2b8af8)[_0xc4d1('0x34')](function(_0x36825e){return _0x36825e;});}return null;};}function removeEntity(_0x33b125,_0xc8dec){return function(_0x15f85a){if(_0x15f85a){return _0x15f85a[_0xc4d1('0x35')]()[_0xc4d1('0x34')](function(){_0x33b125['status'](0xcc)[_0xc4d1('0x2a')]();});}};}function handleEntityNotFound(_0x3317eb,_0x1397d6){return function(_0x2d3dff){if(!_0x2d3dff){_0x3317eb['sendStatus'](0x194);}return _0x2d3dff;};}function handleError(_0x1730b8,_0x41a00c){_0x41a00c=_0x41a00c||0x1f4;return function(_0x9d782c){logger[_0xc4d1('0x24')](_0x9d782c['stack']);if(_0x9d782c[_0xc4d1('0x36')]){delete _0x9d782c[_0xc4d1('0x36')];}_0x1730b8['status'](_0x41a00c)['send'](_0x9d782c);};}exports[_0xc4d1('0x37')]=function(_0x41bf54,_0x43ce8d){var _0x38c9d1={},_0x442170={},_0x2bf297={'count':0x0,'rows':[]};var _0x843cc5=_[_0xc4d1('0x38')](db[_0xc4d1('0x39')][_0xc4d1('0x3a')],function(_0x18bb6d){return{'name':_0x18bb6d['fieldName'],'type':_0x18bb6d[_0xc4d1('0x3b')][_0xc4d1('0x3c')]};});_0x442170[_0xc4d1('0x3d')]=_[_0xc4d1('0x38')](_0x843cc5,_0xc4d1('0x36'));_0x442170[_0xc4d1('0x3e')]=_[_0xc4d1('0x3f')](_0x41bf54[_0xc4d1('0x3e')]);_0x442170['filters']=_[_0xc4d1('0x40')](_0x442170[_0xc4d1('0x3d')],_0x442170['query']);_0x38c9d1[_0xc4d1('0x41')]=_['intersection'](_0x442170[_0xc4d1('0x3d')],qs[_0xc4d1('0x42')](_0x41bf54[_0xc4d1('0x3e')]['fields']));_0x38c9d1[_0xc4d1('0x41')]=_0x38c9d1[_0xc4d1('0x41')][_0xc4d1('0x43')]?_0x38c9d1[_0xc4d1('0x41')]:_0x442170[_0xc4d1('0x3d')];if(!_0x41bf54[_0xc4d1('0x3e')][_0xc4d1('0x44')](_0xc4d1('0x45'))){_0x38c9d1[_0xc4d1('0x2c')]=qs[_0xc4d1('0x2c')](_0x41bf54[_0xc4d1('0x3e')]['limit']);_0x38c9d1[_0xc4d1('0x2b')]=qs['offset'](_0x41bf54['query'][_0xc4d1('0x2b')]);}_0x38c9d1[_0xc4d1('0x46')]=qs[_0xc4d1('0x47')](_0x41bf54['query'][_0xc4d1('0x47')]);_0x38c9d1['where']=qs[_0xc4d1('0x48')](_[_0xc4d1('0x49')](_0x41bf54[_0xc4d1('0x3e')],_0x442170[_0xc4d1('0x48')]),_0x843cc5);if(_0x41bf54[_0xc4d1('0x3e')][_0xc4d1('0x4a')]){_0x38c9d1[_0xc4d1('0x4b')]=_[_0xc4d1('0x4c')](_0x38c9d1[_0xc4d1('0x4b')],{'$or':_[_0xc4d1('0x38')](_0x843cc5,function(_0x3ace86){if(_0x3ace86[_0xc4d1('0x3b')]!=='VIRTUAL'){var _0x7ac3d1={};_0x7ac3d1[_0x3ace86[_0xc4d1('0x36')]]={'$like':'%'+_0x41bf54['query'][_0xc4d1('0x4a')]+'%'};return _0x7ac3d1;}})});}_0x38c9d1=_[_0xc4d1('0x4c')]({},_0x38c9d1,_0x41bf54[_0xc4d1('0x4d')]);var _0x2ae786={'where':_0x38c9d1[_0xc4d1('0x4b')]};return db[_0xc4d1('0x39')][_0xc4d1('0x2e')](_0x2ae786)[_0xc4d1('0x34')](function(_0x5673f3){_0x2bf297[_0xc4d1('0x2e')]=_0x5673f3;if(_0x41bf54[_0xc4d1('0x3e')][_0xc4d1('0x4e')]){_0x38c9d1[_0xc4d1('0x4f')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x38c9d1);})['then'](function(_0x35c858){_0x2bf297[_0xc4d1('0x50')]=_0x35c858;return _0x2bf297;})[_0xc4d1('0x34')](respondWithFilteredResult(_0x43ce8d,_0x38c9d1))[_0xc4d1('0x51')](handleError(_0x43ce8d,null));};exports[_0xc4d1('0x52')]=function(_0x44343e,_0x1e97ab){var _0x7af4f0={'raw':!![],'where':{'id':_0x44343e[_0xc4d1('0x53')]['id']}},_0x457c53={};_0x457c53[_0xc4d1('0x3d')]=_[_0xc4d1('0x3f')](db['ChatMessage'][_0xc4d1('0x3a')]);_0x457c53[_0xc4d1('0x3e')]=_[_0xc4d1('0x3f')](_0x44343e[_0xc4d1('0x3e')]);_0x457c53['filters']=_['intersection'](_0x457c53[_0xc4d1('0x3d')],_0x457c53[_0xc4d1('0x3e')]);_0x7af4f0[_0xc4d1('0x41')]=_[_0xc4d1('0x40')](_0x457c53['model'],qs[_0xc4d1('0x42')](_0x44343e['query']['fields']));_0x7af4f0[_0xc4d1('0x41')]=_0x7af4f0[_0xc4d1('0x41')][_0xc4d1('0x43')]?_0x7af4f0[_0xc4d1('0x41')]:_0x457c53[_0xc4d1('0x3d')];if(_0x44343e['query']['includeAll']){_0x7af4f0[_0xc4d1('0x4f')]=[{'all':!![]}];}_0x7af4f0=_[_0xc4d1('0x4c')]({},_0x7af4f0,_0x44343e[_0xc4d1('0x4d')]);return db['ChatMessage'][_0xc4d1('0x54')](_0x7af4f0)[_0xc4d1('0x34')](handleEntityNotFound(_0x1e97ab,null))[_0xc4d1('0x34')](respondWithResult(_0x1e97ab,null))['catch'](handleError(_0x1e97ab,null));};exports[_0xc4d1('0x55')]=function(_0x49da25,_0x450feb){return db['ChatMessage'][_0xc4d1('0x55')](_0x49da25['body'],{})['then'](respondWithResult(_0x450feb,0xc9))[_0xc4d1('0x51')](handleError(_0x450feb,null));};exports[_0xc4d1('0x33')]=function(_0x30034b,_0x17dfef){if(_0x30034b['body']['id']){delete _0x30034b[_0xc4d1('0x56')]['id'];}return db[_0xc4d1('0x39')][_0xc4d1('0x54')]({'where':{'id':_0x30034b[_0xc4d1('0x53')]['id']}})[_0xc4d1('0x34')](handleEntityNotFound(_0x17dfef,null))[_0xc4d1('0x34')](saveUpdates(_0x30034b[_0xc4d1('0x56')],null))[_0xc4d1('0x34')](respondWithResult(_0x17dfef,null))['catch'](handleError(_0x17dfef,null));};exports[_0xc4d1('0x35')]=function(_0x15efd1,_0x8d7cc3){return db[_0xc4d1('0x39')][_0xc4d1('0x54')]({'where':{'id':_0x15efd1[_0xc4d1('0x53')]['id']}})[_0xc4d1('0x34')](handleEntityNotFound(_0x8d7cc3,null))[_0xc4d1('0x34')](removeEntity(_0x8d7cc3,null))['catch'](handleError(_0x8d7cc3,null));};exports[_0xc4d1('0x57')]=function(_0x1637ee,_0x5ea89b){return db[_0xc4d1('0x39')][_0xc4d1('0x57')]()['then'](respondWithResult(_0x5ea89b,null))[_0xc4d1('0x51')](handleError(_0x5ea89b,null));};var interaction_log=require(_0xc4d1('0x11'))(_0xc4d1('0x58'));exports[_0xc4d1('0x59')]=function(_0x4881d8,_0x382271,_0x341a8a){var _0x2a2836={'agent':{},'channel':_0xc4d1('0x5a')};if(_0x4881d8['body']['id']){delete _0x4881d8[_0xc4d1('0x56')]['id'];}_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5b')]=!![];_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5c')]=moment()[_0xc4d1('0x5d')](_0xc4d1('0x5e'));_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')]=_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')]||_0x4881d8[_0xc4d1('0x60')]['id'];_0x2a2836[_0xc4d1('0x61')]['id']=_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')];return db[_0xc4d1('0x39')][_0xc4d1('0x54')]({'where':{'id':_0x4881d8[_0xc4d1('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x382271,null))[_0xc4d1('0x34')](saveUpdates(_0x4881d8[_0xc4d1('0x56')],null))['then'](function(_0x4e8699){if(_0x4e8699){_0x2a2836[_0xc4d1('0x26')]=_0x4e8699[_0xc4d1('0x62')]({'plain':!![]});return db['ChatInteraction'][_0xc4d1('0x54')]({'where':{'id':_0x4e8699[_0xc4d1('0x63')]}});}return null;})[_0xc4d1('0x34')](handleEntityNotFound(_0x382271,null))['then'](function(_0x44c6b1){if(_0x44c6b1){return _0x44c6b1[_0xc4d1('0x33')]({'UserId':_0x4881d8[_0xc4d1('0x56')]['UserId'],'read1stAt':_['isNil'](_0x44c6b1[_0xc4d1('0x64')])?moment()[_0xc4d1('0x5d')](_0xc4d1('0x5e')):undefined});}return null;})[_0xc4d1('0x34')](function(_0x84c879){if(_0x84c879){_0x2a2836[_0xc4d1('0x65')]=_0x84c879[_0xc4d1('0x62')]({'plain':!![]});interaction_log[_0xc4d1('0x66')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4881d8[_0xc4d1('0x60')]['id'],_0x4881d8[_0xc4d1('0x60')]['name'],_0x4881d8['user'][_0xc4d1('0x67')],_0x2a2836['interaction']['id'],_0x4881d8[_0xc4d1('0x56')]?JSON['stringify'](_0x4881d8['body']):_0xc4d1('0x68'));return respondWithRpcPromise(_0xc4d1('0x69'),_0xc4d1('0x6a'),_0x2a2836);}return null;})[_0xc4d1('0x34')](function(_0x48147a){var _0x3fb791='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x48147a[_0xc4d1('0x26')]['ContactId'];return db[_0xc4d1('0x6b')][_0xc4d1('0x3e')](_0x3fb791,{'type':db[_0xc4d1('0x6c')][_0xc4d1('0x6d')][_0xc4d1('0x6e')],'raw':!![]})[_0xc4d1('0x34')](function(_0x5c6acd){return _0x5c6acd;});})['then'](function(_0x55f1e1){if(_0x55f1e1){_0x2a2836['message'][_0xc4d1('0x6f')]=_0x55f1e1[0x0];if(!_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')])return;return db[_0xc4d1('0x70')][_0xc4d1('0x54')]({'where':{'id':_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x5f')],'role':'agent'},'attributes':['id','name',_0xc4d1('0x71'),_0xc4d1('0x72'),_0xc4d1('0x73')],'raw':!![]});}return null;})[_0xc4d1('0x34')](function(_0x2c06d4){if(!_0x2c06d4)return null;_0x2a2836[_0xc4d1('0x26')][_0xc4d1('0x61')]=_0x2c06d4;return _0x2a2836;})['then'](function(_0xc9dd0a){if(_0xc9dd0a){if(_0x4881d8[_0xc4d1('0x56')][_0xc4d1('0x74')]){_0x2a2836['message'][_0xc4d1('0x75')]=util[_0xc4d1('0x5d')]('SIP/%s',_0x4881d8[_0xc4d1('0x60')][_0xc4d1('0x36')]);_0x2a2836[_0xc4d1('0x26')][_0xc4d1('0x76')]=_0x2a2836[_0xc4d1('0x76')];_0x2a2836[_0xc4d1('0x26')][_0xc4d1('0x77')]=_0x2a2836[_0xc4d1('0x76')];_0x2a2836[_0xc4d1('0x26')]['event']=_0xc4d1('0x59');return respondWithRpcPromise(_0xc4d1('0x78'),'EventManager',{'event':_0xc4d1('0x79'),'message':_[_0xc4d1('0x4c')](_0x2a2836[_0xc4d1('0x26')],JSON[_0xc4d1('0x7a')](_0x2a2836[_0xc4d1('0x65')][_0xc4d1('0x7b')]))},client9002)['then'](function(){return _0x2a2836;});}return _0x2a2836;}return null;})[_0xc4d1('0x34')](respondWithResult(_0x382271,null))[_0xc4d1('0x51')](handleError(_0x382271,null));};var interaction_log=require(_0xc4d1('0x11'))(_0xc4d1('0x58'));exports[_0xc4d1('0x7c')]=function(_0x2bef6f,_0x154180,_0x128745){var _0x4d39e3={'agent':{},'channel':'chat'};if(_0x2bef6f['body']['id']){delete _0x2bef6f[_0xc4d1('0x56')]['id'];}_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')]=_0x2bef6f['body'][_0xc4d1('0x5f')]||_0x2bef6f[_0xc4d1('0x60')]['id'];_0x4d39e3[_0xc4d1('0x61')]['id']=_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0x2bef6f[_0xc4d1('0x53')]['id'],'UserId':null}})[_0xc4d1('0x34')](handleEntityNotFound(_0x154180,null))['then'](function(_0x553a86){if(_0x553a86){_0x4d39e3['message']=_0x553a86[_0xc4d1('0x62')]({'plain':!![]});return db[_0xc4d1('0x7d')][_0xc4d1('0x54')]({'where':{'id':_0x553a86[_0xc4d1('0x63')]}});}return null;})[_0xc4d1('0x34')](handleEntityNotFound(_0x154180,null))['then'](function(_0x4ef974){if(_0x4ef974){_0x4d39e3[_0xc4d1('0x65')]=_0x4ef974['get']({'plain':!![]});interaction_log[_0xc4d1('0x66')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2bef6f[_0xc4d1('0x60')]['id'],_0x2bef6f[_0xc4d1('0x60')][_0xc4d1('0x36')],_0x2bef6f[_0xc4d1('0x60')][_0xc4d1('0x67')],_0x4d39e3[_0xc4d1('0x65')]['id'],_0x2bef6f[_0xc4d1('0x56')]?JSON[_0xc4d1('0x23')](_0x2bef6f[_0xc4d1('0x56')]):_0xc4d1('0x68'));return respondWithRpcPromise(_0xc4d1('0x7e'),'rejectMessage',_0x4d39e3);}return null;})[_0xc4d1('0x34')](function(_0x3bc7f1){var _0x4dac22='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3bc7f1[_0xc4d1('0x26')][_0xc4d1('0x7f')];return db['sequelize'][_0xc4d1('0x3e')](_0x4dac22,{'type':db[_0xc4d1('0x6c')][_0xc4d1('0x6d')]['SELECT'],'raw':!![]})['then'](function(_0x514f92){return _0x514f92;});})[_0xc4d1('0x34')](function(_0x1e3529){if(_0x1e3529){_0x4d39e3[_0xc4d1('0x26')]['contact']=_0x1e3529[0x0];if(!_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')])return;return db[_0xc4d1('0x70')]['find']({'where':{'id':_0x2bef6f[_0xc4d1('0x56')][_0xc4d1('0x5f')],'role':'agent'},'attributes':['id',_0xc4d1('0x36'),'fullname','email',_0xc4d1('0x73')],'raw':!![]});}return null;})[_0xc4d1('0x34')](function(_0x209880){if(!_0x209880)return null;_0x4d39e3[_0xc4d1('0x26')][_0xc4d1('0x61')]=_0x209880;return _0x4d39e3;})['then'](function(_0x2f87a3){if(_0x2f87a3){_0x2f87a3['message'][_0xc4d1('0x75')]=util['format'](_0xc4d1('0x80'),_0x2bef6f['user'][_0xc4d1('0x36')]);_0x2f87a3['message'][_0xc4d1('0x76')]=_0x4d39e3[_0xc4d1('0x76')];_0x2f87a3['message'][_0xc4d1('0x77')]=_0x4d39e3[_0xc4d1('0x76')];_0x2f87a3[_0xc4d1('0x26')][_0xc4d1('0x81')]=_0xc4d1('0x7c');respondWithRpcPromise(_0xc4d1('0x78'),_0xc4d1('0x78'),{'event':'rejectmessage','message':_['merge'](_0x4d39e3[_0xc4d1('0x26')],JSON[_0xc4d1('0x7a')](_0x4d39e3['interaction'][_0xc4d1('0x7b')]))},client9002);return _0x4d39e3;}return null;})[_0xc4d1('0x34')](respondWithResult(_0x154180,null))[_0xc4d1('0x51')](handleError(_0x154180,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index ae8cffe..824649a 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 _0x8c78=['events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1a48fc,_0x10855c){var _0x14c157=function(_0xa60124){while(--_0xa60124){_0x1a48fc['push'](_0x1a48fc['shift']());}};_0x14c157(++_0x10855c);}(_0x8c78,0xbe));var _0x88c7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8c78[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x88c7('0x0'));var ChatMessage=require(_0x88c7('0x1'))['db'][_0x88c7('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x88c7('0x3')](0x0);var events={'afterCreate':_0x88c7('0x4'),'afterUpdate':'update','afterDestroy':_0x88c7('0x5')};function emitEvent(_0x1b93e9){return function(_0x2b136c,_0xd58fc8,_0x2e0fdc){ChatMessageEvents[_0x88c7('0x6')](_0x1b93e9+':'+_0x2b136c['id'],_0x2b136c);ChatMessageEvents['emit'](_0x1b93e9,_0x2b136c);_0x2e0fdc(null);};}for(var e in events){if(events[_0x88c7('0x7')](e)){var event=events[e];ChatMessage[_0x88c7('0x8')](e,emitEvent(event));}}module[_0x88c7('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xb828=['events','ChatMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x1b33bc,_0x282af6){var _0x23b81c=function(_0x67994a){while(--_0x67994a){_0x1b33bc['push'](_0x1b33bc['shift']());}};_0x23b81c(++_0x282af6);}(_0xb828,0xfc));var _0x8b82=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xb828[_0x38af48];return _0x445384;};'use strict';var EventEmitter=require(_0x8b82('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8b82('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8b82('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b82('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16022e){return function(_0x905780,_0x509612,_0xf09c66){ChatMessageEvents[_0x8b82('0x4')](_0x16022e+':'+_0x905780['id'],_0x905780);ChatMessageEvents[_0x8b82('0x4')](_0x16022e,_0x905780);_0xf09c66(null);};}for(var e in events){if(events[_0x8b82('0x5')](e)){var event=events[e];ChatMessage[_0x8b82('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index bf8d19e..2a0b5b2 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 _0x49d2=['util','../../config/logger','api','moment','bluebird','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash'];(function(_0xc775ea,_0x5e5895){var _0x5b5e4b=function(_0x4992b7){while(--_0x4992b7){_0xc775ea['push'](_0xc775ea['shift']());}};_0x5b5e4b(++_0x5e5895);}(_0x49d2,0xa7));var _0x249d=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x49d2[_0x1a7550];return _0x426e22;};'use strict';var _=require(_0x249d('0x0'));var util=require(_0x249d('0x1'));var logger=require(_0x249d('0x2'))(_0x249d('0x3'));var moment=require(_0x249d('0x4'));var BPromise=require(_0x249d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x249d('0x6'));var attributes=require(_0x249d('0x7'));module[_0x249d('0x8')]=function(_0x4eaa46,_0x531a66){return _0x4eaa46[_0x249d('0x9')](_0x249d('0xa'),attributes,{'tableName':_0x249d('0xb'),'paranoid':![],'indexes':[{'name':_0x249d('0xc'),'fields':[_0x249d('0xd')],'type':_0x249d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2867a1,_0x5a0068,_0x53a1b2){var _0x5018ce=_0x4eaa46['models'];var _0x2b0bef=_0x2867a1['get']({'plain':!![]});if(_0x2b0bef[_0x249d('0xf')][_0x249d('0x10')]()==='in'||_0x2b0bef[_0x249d('0xf')][_0x249d('0x10')]()===_0x249d('0x11')&&!_0x2b0bef['secret']&&!_[_0x249d('0x12')](_0x2b0bef[_0x249d('0x13')])){_0x5018ce[_0x249d('0x14')][_0x249d('0x15')]({'where':{'id':_0x2b0bef['ChatInteractionId']}})[_0x249d('0x16')](function(_0x36e222){if(_0x36e222){_0x36e222[_0x249d('0x17')]({'lastMsgAt':_0x2b0bef[_0x249d('0x18')],'lastMsgDirection':_0x2b0bef[_0x249d('0xf')]['toLowerCase']()});}})[_0x249d('0x19')](function(_0x3b0a74){console[_0x249d('0x1a')](_0x3b0a74);});}_0x53a1b2();}},'charset':'utf8mb4','collate':_0x249d('0x1b')});}; \ No newline at end of file +var _0xc52f=['ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x3c7000,_0x43db6e){var _0x8f22f1=function(_0x240bd0){while(--_0x240bd0){_0x3c7000['push'](_0x3c7000['shift']());}};_0x8f22f1(++_0x43db6e);}(_0xc52f,0x1e3));var _0xfc52=function(_0x121bb9,_0x3d8455){_0x121bb9=_0x121bb9-0x0;var _0x443350=_0xc52f[_0x121bb9];return _0x443350;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc52('0x2'));var rp=require(_0xfc52('0x3'));var fs=require('fs');var path=require(_0xfc52('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc52('0x5'));module[_0xfc52('0x6')]=function(_0x29636f,_0x5cb478){return _0x29636f[_0xfc52('0x7')](_0xfc52('0x8'),attributes,{'tableName':_0xfc52('0x9'),'paranoid':![],'indexes':[{'name':_0xfc52('0xa'),'fields':[_0xfc52('0xb')],'type':_0xfc52('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30a878,_0x286ca3,_0x3f5b8e){var _0x15001a=_0x29636f[_0xfc52('0xd')];var _0x16aa7a=_0x30a878['get']({'plain':!![]});if(_0x16aa7a[_0xfc52('0xe')]['toLowerCase']()==='in'||_0x16aa7a[_0xfc52('0xe')][_0xfc52('0xf')]()===_0xfc52('0x10')&&!_0x16aa7a[_0xfc52('0x11')]&&!_[_0xfc52('0x12')](_0x16aa7a[_0xfc52('0x13')])){_0x15001a['ChatInteraction'][_0xfc52('0x14')]({'where':{'id':_0x16aa7a[_0xfc52('0x15')]}})[_0xfc52('0x16')](function(_0x24cf4f){if(_0x24cf4f){_0x24cf4f['update']({'lastMsgAt':_0x16aa7a[_0xfc52('0x17')],'lastMsgDirection':_0x16aa7a[_0xfc52('0xe')][_0xfc52('0xf')]()});}})[_0xfc52('0x18')](function(_0x30c8f3){console[_0xfc52('0x19')](_0x30c8f3);});}_0x3f5b8e();}},'charset':_0xfc52('0x1a'),'collate':_0xfc52('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 513f3d9..b270c6e 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 _0xee10=['stringify','error','code','ChatMessage,\x20%s,\x20%s','message','CreateChatMessage','ChatMessage','create','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0xee10,0x66));var _0x0ee1=function(_0x39f7c8,_0x4bf22e){_0x39f7c8=_0x39f7c8-0x0;var _0x1ce574=_0xee10[_0x39f7c8];return _0x1ce574;};'use strict';var _=require(_0x0ee1('0x0'));var util=require('util');var moment=require(_0x0ee1('0x1'));var BPromise=require(_0x0ee1('0x2'));var rs=require(_0x0ee1('0x3'));var fs=require('fs');var Redis=require(_0x0ee1('0x4'));var db=require(_0x0ee1('0x5'))['db'];var utils=require(_0x0ee1('0x6'));var logger=require(_0x0ee1('0x7'))(_0x0ee1('0x8'));var config=require(_0x0ee1('0x9'));var jayson=require(_0x0ee1('0xa'));var client=jayson['client'][_0x0ee1('0xb')]({'port':0x232a});config[_0x0ee1('0xc')]=_['defaults'](config[_0x0ee1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ee1('0xd'))(new Redis(config[_0x0ee1('0xc')]));require(_0x0ee1('0xe'))[_0x0ee1('0xf')](socket);function respondWithRpcPromise(_0x19ccb4,_0x8497aa,_0x470702){return new BPromise(function(_0x580776,_0x3d0fa1){return client[_0x0ee1('0x10')](_0x19ccb4,_0x470702)[_0x0ee1('0x11')](function(_0x37ec9e){logger[_0x0ee1('0x12')]('ChatMessage,\x20%s,\x20%s',_0x8497aa,'request\x20sent');logger[_0x0ee1('0x13')](_0x0ee1('0x14'),_0x8497aa,_0x0ee1('0x15'),JSON[_0x0ee1('0x16')](_0x37ec9e));if(_0x37ec9e[_0x0ee1('0x17')]){if(_0x37ec9e[_0x0ee1('0x17')][_0x0ee1('0x18')]===0x1f4){logger[_0x0ee1('0x17')](_0x0ee1('0x19'),_0x8497aa,_0x37ec9e[_0x0ee1('0x17')][_0x0ee1('0x1a')]);return _0x3d0fa1(_0x37ec9e[_0x0ee1('0x17')][_0x0ee1('0x1a')]);}logger[_0x0ee1('0x17')]('ChatMessage,\x20%s,\x20%s',_0x8497aa,_0x37ec9e[_0x0ee1('0x17')][_0x0ee1('0x1a')]);return _0x580776(_0x37ec9e['error'][_0x0ee1('0x1a')]);}else{logger[_0x0ee1('0x12')](_0x0ee1('0x19'),_0x8497aa,'request\x20sent');_0x580776(_0x37ec9e['result'][_0x0ee1('0x1a')]);}})['catch'](function(_0x4c4b71){logger[_0x0ee1('0x17')]('ChatMessage,\x20%s,\x20%s',_0x8497aa,_0x4c4b71);_0x3d0fa1(_0x4c4b71);});});}exports[_0x0ee1('0x1b')]=function(_0x58e204){var _0x3d9876=this;return new Promise(function(_0x2288b6,_0x2ad7a3){return db[_0x0ee1('0x1c')][_0x0ee1('0x1d')](_0x58e204['body'],{'raw':_0x58e204['options']?_0x58e204['options'][_0x0ee1('0x1e')]===undefined?!![]:![]:!![]})[_0x0ee1('0x11')](function(_0x210974){logger['info'](_0x0ee1('0x1b'),_0x58e204);logger['debug'](_0x0ee1('0x1b'),_0x58e204,JSON[_0x0ee1('0x16')](_0x210974));_0x2288b6(_0x210974);})['catch'](function(_0x235b62){logger[_0x0ee1('0x17')]('CreateChatMessage',_0x235b62[_0x0ee1('0x1a')],_0x58e204);_0x2ad7a3(_0x3d9876[_0x0ee1('0x17')](0x1f4,_0x235b62[_0x0ee1('0x1a')]));});});}; \ No newline at end of file +var _0xff1c=['rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a4a99,_0x64b4a){var _0x1cef2f=function(_0x43beef){while(--_0x43beef){_0x2a4a99['push'](_0x2a4a99['shift']());}};_0x1cef2f(++_0x64b4a);}(_0xff1c,0xdf));var _0xcff1=function(_0x4bd35b,_0x19525b){_0x4bd35b=_0x4bd35b-0x0;var _0x2d498b=_0xff1c[_0x4bd35b];return _0x2d498b;};'use strict';var _=require(_0xcff1('0x0'));var util=require('util');var moment=require(_0xcff1('0x1'));var BPromise=require(_0xcff1('0x2'));var rs=require(_0xcff1('0x3'));var fs=require('fs');var Redis=require(_0xcff1('0x4'));var db=require(_0xcff1('0x5'))['db'];var utils=require(_0xcff1('0x6'));var logger=require(_0xcff1('0x7'))(_0xcff1('0x8'));var config=require(_0xcff1('0x9'));var jayson=require(_0xcff1('0xa'));var client=jayson[_0xcff1('0xb')][_0xcff1('0xc')]({'port':0x232a});config['redis']=_[_0xcff1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcff1('0xe'))(new Redis(config[_0xcff1('0xf')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x192f5a,_0xbf6dcc,_0x72e082){return new BPromise(function(_0x4a4d26,_0x532f99){return client[_0xcff1('0x10')](_0x192f5a,_0x72e082)[_0xcff1('0x11')](function(_0x3bf230){logger[_0xcff1('0x12')](_0xcff1('0x13'),_0xbf6dcc,_0xcff1('0x14'));logger[_0xcff1('0x15')](_0xcff1('0x16'),_0xbf6dcc,_0xcff1('0x14'),JSON[_0xcff1('0x17')](_0x3bf230));if(_0x3bf230['error']){if(_0x3bf230['error'][_0xcff1('0x18')]===0x1f4){logger[_0xcff1('0x19')]('ChatMessage,\x20%s,\x20%s',_0xbf6dcc,_0x3bf230[_0xcff1('0x19')][_0xcff1('0x1a')]);return _0x532f99(_0x3bf230[_0xcff1('0x19')]['message']);}logger[_0xcff1('0x19')](_0xcff1('0x13'),_0xbf6dcc,_0x3bf230[_0xcff1('0x19')][_0xcff1('0x1a')]);return _0x4a4d26(_0x3bf230[_0xcff1('0x19')][_0xcff1('0x1a')]);}else{logger[_0xcff1('0x12')](_0xcff1('0x13'),_0xbf6dcc,_0xcff1('0x14'));_0x4a4d26(_0x3bf230[_0xcff1('0x1b')][_0xcff1('0x1a')]);}})[_0xcff1('0x1c')](function(_0x4ac8c8){logger[_0xcff1('0x19')]('ChatMessage,\x20%s,\x20%s',_0xbf6dcc,_0x4ac8c8);_0x532f99(_0x4ac8c8);});});}exports[_0xcff1('0x1d')]=function(_0x140f31){var _0x419995=this;return new Promise(function(_0x57e128,_0x33e8e5){return db[_0xcff1('0x1e')][_0xcff1('0x1f')](_0x140f31['body'],{'raw':_0x140f31[_0xcff1('0x20')]?_0x140f31['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x568ee5){logger[_0xcff1('0x12')]('CreateChatMessage',_0x140f31);logger[_0xcff1('0x15')](_0xcff1('0x1d'),_0x140f31,JSON[_0xcff1('0x17')](_0x568ee5));_0x57e128(_0x568ee5);})[_0xcff1('0x1c')](function(_0x15cca6){logger[_0xcff1('0x19')](_0xcff1('0x1d'),_0x15cca6[_0xcff1('0x1a')],_0x140f31);_0x33e8e5(_0x419995['error'](0x1f4,_0x15cca6[_0xcff1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 58a12dc..c109749 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 _0xc3b5=['length','remove','update','emit','register'];(function(_0x12df63,_0x4625aa){var _0xeebfcc=function(_0x52d38e){while(--_0x52d38e){_0x12df63['push'](_0x12df63['shift']());}};_0xeebfcc(++_0x4625aa);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x572b75,_0x5c693b){_0x572b75=_0x572b75-0x0;var _0x5d7116=_0xc3b5[_0x572b75];return _0x5d7116;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x5c3b('0x0'),_0x5c3b('0x1')];function createListener(_0xbe95d4,_0x3acf12){return function(_0x2f9a72){_0x3acf12[_0x5c3b('0x2')](_0xbe95d4,_0x2f9a72);};}function removeListener(_0x237a61,_0x48f8a1){return function(){ChatMessageEvents['removeListener'](_0x237a61,_0x48f8a1);};}exports[_0x5c3b('0x3')]=function(_0x6b8a1e){for(var _0x56345e=0x0,_0x568a28=events[_0x5c3b('0x4')];_0x56345e<_0x568a28;_0x56345e++){var _0x420839=events[_0x56345e];var _0x3892ad=createListener('chatMessage:'+_0x420839,_0x6b8a1e);ChatMessageEvents['on'](_0x420839,_0x3892ad);}}; \ No newline at end of file +var _0xa630=['removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x2e2fa7,_0x1b7721){var _0x261dad=function(_0x457dfa){while(--_0x457dfa){_0x2e2fa7['push'](_0x2e2fa7['shift']());}};_0x261dad(++_0x1b7721);}(_0xa630,0xbe));var _0x0a63=function(_0x2fc67c,_0xac72f0){_0x2fc67c=_0x2fc67c-0x0;var _0x4a0c12=_0xa630[_0x2fc67c];return _0x4a0c12;};'use strict';var ChatMessageEvents=require(_0x0a63('0x0'));var events=[_0x0a63('0x1'),'remove','update'];function createListener(_0x1a9586,_0x4f6b34){return function(_0xd0a045){_0x4f6b34['emit'](_0x1a9586,_0xd0a045);};}function removeListener(_0x91a747,_0x3bcb90){return function(){ChatMessageEvents[_0x0a63('0x2')](_0x91a747,_0x3bcb90);};}exports[_0x0a63('0x3')]=function(_0x37b4c9){for(var _0x4b7474=0x0,_0x2760b0=events[_0x0a63('0x4')];_0x4b7474<_0x2760b0;_0x4b7474++){var _0xc2dcd7=events[_0x4b7474];var _0x41d21d=createListener(_0x0a63('0x5')+_0xc2dcd7,_0x37b4c9);ChatMessageEvents['on'](_0xc2dcd7,_0x41d21d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 281ff36..5d4e101 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 _0xced0=['index','describe','post','chat','chatmessage:create','create','/:id','update','put','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x24b175,_0x42eba2){var _0x16fa11=function(_0x45bf3e){while(--_0x45bf3e){_0x24b175['push'](_0x24b175['shift']());}};_0x16fa11(++_0x42eba2);}(_0xced0,0x1be));var _0x0ced=function(_0x4fc7ec,_0x288747){_0x4fc7ec=_0x4fc7ec-0x0;var _0x24765e=_0xced0[_0x4fc7ec];return _0x24765e;};'use strict';var multer=require(_0x0ced('0x0'));var util=require('util');var path=require(_0x0ced('0x1'));var timeout=require('connect-timeout');var express=require(_0x0ced('0x2'));var router=express[_0x0ced('0x3')]();var fs_extra=require(_0x0ced('0x4'));var auth=require(_0x0ced('0x5'));var interaction=require(_0x0ced('0x6'));var config=require(_0x0ced('0x7'));var controller=require('./chatMessage.controller');router[_0x0ced('0x8')]('/',auth[_0x0ced('0x9')](),controller[_0x0ced('0xa')]);router['get']('/describe',auth[_0x0ced('0x9')](),controller[_0x0ced('0xb')]);router[_0x0ced('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0ced('0xc')]('/',auth[_0x0ced('0x9')](),interaction['tracked'](_0x0ced('0xd'),_0x0ced('0xe')),controller[_0x0ced('0xf')]);router['put'](_0x0ced('0x10'),controller[_0x0ced('0x11')]);router[_0x0ced('0x12')](_0x0ced('0x13'),auth[_0x0ced('0x9')](),controller[_0x0ced('0x14')]);router['put']('/:id/reject',auth[_0x0ced('0x9')](),controller[_0x0ced('0x15')]);router['delete'](_0x0ced('0x10'),auth[_0x0ced('0x9')](),controller[_0x0ced('0x16')]);module[_0x0ced('0x17')]=router; \ No newline at end of file +var _0x5602=['show','post','tracked','chat','chatmessage:create','put','/:id','update','/:id/accept','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x301393,_0x3a0fcc){var _0x5f2e66=function(_0x535427){while(--_0x535427){_0x301393['push'](_0x301393['shift']());}};_0x5f2e66(++_0x3a0fcc);}(_0x5602,0xba));var _0x2560=function(_0x57eae4,_0x2d6405){_0x57eae4=_0x57eae4-0x0;var _0x5313ec=_0x5602[_0x57eae4];return _0x5313ec;};'use strict';var multer=require(_0x2560('0x0'));var util=require(_0x2560('0x1'));var path=require(_0x2560('0x2'));var timeout=require(_0x2560('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2560('0x4'));var auth=require(_0x2560('0x5'));var interaction=require(_0x2560('0x6'));var config=require(_0x2560('0x7'));var controller=require(_0x2560('0x8'));router['get']('/',auth[_0x2560('0x9')](),controller[_0x2560('0xa')]);router['get'](_0x2560('0xb'),auth[_0x2560('0x9')](),controller[_0x2560('0xc')]);router[_0x2560('0xd')]('/:id',auth[_0x2560('0x9')](),controller[_0x2560('0xe')]);router[_0x2560('0xf')]('/',auth[_0x2560('0x9')](),interaction[_0x2560('0x10')](_0x2560('0x11'),_0x2560('0x12')),controller['create']);router[_0x2560('0x13')](_0x2560('0x14'),controller[_0x2560('0x15')]);router[_0x2560('0x13')](_0x2560('0x16'),auth[_0x2560('0x9')](),controller['accept']);router[_0x2560('0x13')]('/:id/reject',auth[_0x2560('0x9')](),controller['reject']);router[_0x2560('0x17')]('/:id',auth[_0x2560('0x9')](),controller[_0x2560('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c5ce03c..1f606e4 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['medium','sequelize','TEXT'];(function(_0x2164cb,_0x476264){var _0x4da4aa=function(_0x3b3ba6){while(--_0x3b3ba6){_0x2164cb['push'](_0x2164cb['shift']());}};_0x4da4aa(++_0x476264);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0xb10b[_0x2d4340];return _0x5a2e9e;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0xc56785,_0x5531a9){var _0xeaf7d0=function(_0x474676){while(--_0x474676){_0xc56785['push'](_0xc56785['shift']());}};_0xeaf7d0(++_0x5531a9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 792c1a0..6295a14 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(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x7a54,0x106));var _0x47a5=function(_0x745668,_0x154450){_0x745668=_0x745668-0x0;var _0x22f77c=_0x7a54[_0x745668];return _0x22f77c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0x497ad0,_0x369c22){_0x497ad0=_0x497ad0-0x0;var _0x33c245=_0x7a54[_0x497ad0];return _0x33c245;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 38a99f0..350d24f 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 _0x08d2=['emit','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x08d2,0xd2));var _0x208d=function(_0x5eaaf3,_0x4219c6){_0x5eaaf3=_0x5eaaf3-0x0;var _0x3d6184=_0x08d2[_0x5eaaf3];return _0x3d6184;};'use strict';var EventEmitter=require(_0x208d('0x0'));var ChatOfflineMessage=require(_0x208d('0x1'))['db'][_0x208d('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x208d('0x3')](0x0);var events={'afterCreate':_0x208d('0x4'),'afterUpdate':_0x208d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x37325d){return function(_0x6dc9ac,_0x3f38a4,_0x47de1c){ChatOfflineMessageEvents['emit'](_0x37325d+':'+_0x6dc9ac['id'],_0x6dc9ac);ChatOfflineMessageEvents[_0x208d('0x6')](_0x37325d,_0x6dc9ac);_0x47de1c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x208d('0x7')](e,emitEvent(event));}}module[_0x208d('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x0a9e=['emit','hook','exports','events','../../mysqldb','ChatOfflineMessage','save','update','remove'];(function(_0x3528f8,_0x23b9cf){var _0x143401=function(_0x4dad8b){while(--_0x4dad8b){_0x3528f8['push'](_0x3528f8['shift']());}};_0x143401(++_0x23b9cf);}(_0x0a9e,0x1c5));var _0xe0a9=function(_0x20867d,_0x5f54ed){_0x20867d=_0x20867d-0x0;var _0x53fa30=_0x0a9e[_0x20867d];return _0x53fa30;};'use strict';var EventEmitter=require(_0xe0a9('0x0'));var ChatOfflineMessage=require(_0xe0a9('0x1'))['db'][_0xe0a9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0a9('0x3'),'afterUpdate':_0xe0a9('0x4'),'afterDestroy':_0xe0a9('0x5')};function emitEvent(_0x5c7f2b){return function(_0x106a6a,_0x53af0a,_0x31b53c){ChatOfflineMessageEvents[_0xe0a9('0x6')](_0x5c7f2b+':'+_0x106a6a['id'],_0x106a6a);ChatOfflineMessageEvents['emit'](_0x5c7f2b,_0x106a6a);_0x31b53c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xe0a9('0x7')](e,emitEvent(event));}}module[_0xe0a9('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index dce6a4c..361ad77 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 _0x2570=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define','ChatOfflineMessage'];(function(_0x2d606b,_0x4e58c0){var _0x33fcd7=function(_0xba8169){while(--_0xba8169){_0x2d606b['push'](_0x2d606b['shift']());}};_0x33fcd7(++_0x4e58c0);}(_0x2570,0x165));var _0x0257=function(_0x7c4840,_0x43dc5c){_0x7c4840=_0x7c4840-0x0;var _0x1a19a5=_0x2570[_0x7c4840];return _0x1a19a5;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x0257('0x0')]=function(_0xdf039e){return _0xdf039e[_0x0257('0x1')](_0x0257('0x2'),attributes,{'tableName':_0x0257('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0257('0x4'),'collate':_0x0257('0x5')});}; \ No newline at end of file +var _0x24d8=['define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x38f3e9,_0x53ce92){var _0xe8ee0a=function(_0x1280cf){while(--_0x1280cf){_0x38f3e9['push'](_0x38f3e9['shift']());}};_0xe8ee0a(++_0x53ce92);}(_0x24d8,0x118));var _0x824d=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x24d8[_0x172747];return _0x509692;};'use strict';var attributes=require(_0x824d('0x0'));module[_0x824d('0x1')]=function(_0x3b63f4){return _0x3b63f4[_0x824d('0x2')](_0x824d('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x824d('0x4'),'collate':_0x824d('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f31fff0..c84c460 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 _0x2a68=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x509ea1,_0x5c6996){var _0x2971bc=function(_0x468dc6){while(--_0x468dc6){_0x509ea1['push'](_0x509ea1['shift']());}};_0x2971bc(++_0x5c6996);}(_0x2a68,0x148));var _0x82a6=function(_0x3b2c6f,_0xa9f35c){_0x3b2c6f=_0x3b2c6f-0x0;var _0x22e219=_0x2a68[_0x3b2c6f];return _0x22e219;};'use strict';var _=require(_0x82a6('0x0'));var util=require(_0x82a6('0x1'));var moment=require(_0x82a6('0x2'));var BPromise=require(_0x82a6('0x3'));var rs=require(_0x82a6('0x4'));var fs=require('fs');var Redis=require(_0x82a6('0x5'));var db=require(_0x82a6('0x6'))['db'];var utils=require(_0x82a6('0x7'));var logger=require('../../config/logger')(_0x82a6('0x8'));var config=require(_0x82a6('0x9'));var jayson=require(_0x82a6('0xa'));var client=jayson[_0x82a6('0xb')][_0x82a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x575616,_0x498af1,_0x28016e){return new BPromise(function(_0x1a980e,_0x4841a8){return client[_0x82a6('0xd')](_0x575616,_0x28016e)[_0x82a6('0xe')](function(_0x206876){logger[_0x82a6('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x498af1,_0x82a6('0x10'));logger['debug'](_0x82a6('0x11'),_0x498af1,_0x82a6('0x10'),JSON['stringify'](_0x206876));if(_0x206876['error']){if(_0x206876[_0x82a6('0x12')][_0x82a6('0x13')]===0x1f4){logger[_0x82a6('0x12')](_0x82a6('0x14'),_0x498af1,_0x206876[_0x82a6('0x12')][_0x82a6('0x15')]);return _0x4841a8(_0x206876['error'][_0x82a6('0x15')]);}logger[_0x82a6('0x12')](_0x82a6('0x14'),_0x498af1,_0x206876['error'][_0x82a6('0x15')]);return _0x1a980e(_0x206876[_0x82a6('0x12')][_0x82a6('0x15')]);}else{logger[_0x82a6('0xf')](_0x82a6('0x14'),_0x498af1,'request\x20sent');_0x1a980e(_0x206876['result'][_0x82a6('0x15')]);}})[_0x82a6('0x16')](function(_0x5785e3){logger['error'](_0x82a6('0x14'),_0x498af1,_0x5785e3);_0x4841a8(_0x5785e3);});});} \ No newline at end of file +var _0x9400=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message'];(function(_0x16812f,_0x4f4060){var _0x407004=function(_0x2823a4){while(--_0x2823a4){_0x16812f['push'](_0x16812f['shift']());}};_0x407004(++_0x4f4060);}(_0x9400,0x152));var _0x0940=function(_0x569631,_0x5b4875){_0x569631=_0x569631-0x0;var _0x242ad7=_0x9400[_0x569631];return _0x242ad7;};'use strict';var _=require(_0x0940('0x0'));var util=require(_0x0940('0x1'));var moment=require(_0x0940('0x2'));var BPromise=require(_0x0940('0x3'));var rs=require(_0x0940('0x4'));var fs=require('fs');var Redis=require(_0x0940('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0940('0x6'));var logger=require(_0x0940('0x7'))(_0x0940('0x8'));var config=require(_0x0940('0x9'));var jayson=require(_0x0940('0xa'));var client=jayson[_0x0940('0xb')][_0x0940('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2585f3,_0x8445e4,_0x193c30){return new BPromise(function(_0x138e81,_0xa53bed){return client['request'](_0x2585f3,_0x193c30)[_0x0940('0xd')](function(_0x46acbb){logger[_0x0940('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x8445e4,_0x0940('0xf'));logger[_0x0940('0x10')](_0x0940('0x11'),_0x8445e4,'request\x20sent',JSON[_0x0940('0x12')](_0x46acbb));if(_0x46acbb[_0x0940('0x13')]){if(_0x46acbb['error']['code']===0x1f4){logger[_0x0940('0x13')](_0x0940('0x14'),_0x8445e4,_0x46acbb[_0x0940('0x13')][_0x0940('0x15')]);return _0xa53bed(_0x46acbb[_0x0940('0x13')]['message']);}logger[_0x0940('0x13')](_0x0940('0x14'),_0x8445e4,_0x46acbb[_0x0940('0x13')]['message']);return _0x138e81(_0x46acbb[_0x0940('0x13')]['message']);}else{logger[_0x0940('0xe')](_0x0940('0x14'),_0x8445e4,_0x0940('0xf'));_0x138e81(_0x46acbb[_0x0940('0x16')]['message']);}})[_0x0940('0x17')](function(_0x24c604){logger['error'](_0x0940('0x14'),_0x8445e4,_0x24c604);_0xa53bed(_0x24c604);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 082fa3c..bc10d6e 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 _0x3a35=['fs-extra','../../components/interaction/service','./chatOfflineMessage.controller','get','index','describe','isAuthenticated','show','put','/:id','delete','destroy','path','connect-timeout','express','Router'];(function(_0x4adf83,_0x4eaea3){var _0x234701=function(_0x3f9a26){while(--_0x3f9a26){_0x4adf83['push'](_0x4adf83['shift']());}};_0x234701(++_0x4eaea3);}(_0x3a35,0x19c));var _0x53a3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x3a35[_0x5b561d];return _0x431060;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x53a3('0x0'));var timeout=require(_0x53a3('0x1'));var express=require(_0x53a3('0x2'));var router=express[_0x53a3('0x3')]();var fs_extra=require(_0x53a3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x53a3('0x5'));var config=require('../../config/environment');var controller=require(_0x53a3('0x6'));router[_0x53a3('0x7')]('/',auth['isAuthenticated'](),controller[_0x53a3('0x8')]);router[_0x53a3('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x53a3('0x9')]);router[_0x53a3('0x7')]('/:id',auth[_0x53a3('0xa')](),controller[_0x53a3('0xb')]);router['post']('/',auth[_0x53a3('0xa')](),controller['create']);router[_0x53a3('0xc')](_0x53a3('0xd'),auth[_0x53a3('0xa')](),controller['update']);router[_0x53a3('0xe')]('/:id',auth[_0x53a3('0xa')](),controller[_0x53a3('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2464=['/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x41d9a7,_0x43843a){var _0x5bbb89=function(_0x520c26){while(--_0x520c26){_0x41d9a7['push'](_0x41d9a7['shift']());}};_0x5bbb89(++_0x43843a);}(_0x2464,0xba));var _0x4246=function(_0x50394d,_0x135d68){_0x50394d=_0x50394d-0x0;var _0x54773b=_0x2464[_0x50394d];return _0x54773b;};'use strict';var multer=require('multer');var util=require(_0x4246('0x0'));var path=require(_0x4246('0x1'));var timeout=require(_0x4246('0x2'));var express=require(_0x4246('0x3'));var router=express[_0x4246('0x4')]();var fs_extra=require(_0x4246('0x5'));var auth=require(_0x4246('0x6'));var interaction=require(_0x4246('0x7'));var config=require('../../config/environment');var controller=require(_0x4246('0x8'));router[_0x4246('0x9')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0xb')]);router[_0x4246('0x9')](_0x4246('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4246('0xd'),auth[_0x4246('0xa')](),controller[_0x4246('0xe')]);router[_0x4246('0xf')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0x10')]);router[_0x4246('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4246('0x12')]);router[_0x4246('0x13')](_0x4246('0xd'),auth[_0x4246('0xa')](),controller[_0x4246('0x14')]);module[_0x4246('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index fbd7bbd..de49b0e 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 _0x2add=['mouseOver','INTEGER','sequelize','exports','ENUM','timeout'];(function(_0x3e4cf6,_0x5ca045){var _0x57ae29=function(_0x19aa4c){while(--_0x19aa4c){_0x3e4cf6['push'](_0x3e4cf6['shift']());}};_0x57ae29(++_0x5ca045);}(_0x2add,0x68));var _0xd2ad=function(_0x8415ec,_0x303a38){_0x8415ec=_0x8415ec-0x0;var _0x314978=_0x2add[_0x8415ec];return _0x314978;};'use strict';var Sequelize=require(_0xd2ad('0x0'));module[_0xd2ad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd2ad('0x2')]('mouseOver',_0xd2ad('0x3')),'defaultValue':_0xd2ad('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd2ad('0x5')]}}; \ No newline at end of file +var _0xa7bc=['STRING','ENUM','mouseOver','timeout','sequelize','exports'];(function(_0x578a78,_0xfdd763){var _0x5b517b=function(_0x30e4e1){while(--_0x30e4e1){_0x578a78['push'](_0x578a78['shift']());}};_0x5b517b(++_0xfdd763);}(_0xa7bc,0x12a));var _0xca7b=function(_0x3b3545,_0x1f46ed){_0x3b3545=_0x3b3545-0x0;var _0x6dc734=_0xa7bc[_0x3b3545];return _0x6dc734;};'use strict';var Sequelize=require(_0xca7b('0x0'));module[_0xca7b('0x1')]={'name':{'type':Sequelize[_0xca7b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xca7b('0x3')](_0xca7b('0x4'),_0xca7b('0x5')),'defaultValue':_0xca7b('0x4')},'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 fd0328f..05b8e31 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 _0xe94a=['to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','send','params','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','fields','attributes','model','includeAll','options','catch','create','body','update','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1d1b38,_0x56fb20){var _0x3980ae=function(_0x21be84){while(--_0x21be84){_0x1d1b38['push'](_0x1d1b38['shift']());}};_0x3980ae(++_0x56fb20);}(_0xe94a,0x1c7));var _0xae94=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0xe94a[_0x454e6d];return _0x4bc294;};'use strict';var emlformat=require(_0xae94('0x0'));var rimraf=require(_0xae94('0x1'));var zipdir=require(_0xae94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae94('0x3'));var moment=require(_0xae94('0x4'));var BPromise=require(_0xae94('0x5'));var Mustache=require(_0xae94('0x6'));var util=require(_0xae94('0x7'));var path=require(_0xae94('0x8'));var sox=require('sox');var csv=require(_0xae94('0x9'));var ejs=require(_0xae94('0xa'));var fs=require('fs');var fs_extra=require(_0xae94('0xb'));var _=require(_0xae94('0xc'));var squel=require(_0xae94('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xae94('0xe'));var toCsv=require(_0xae94('0x9'));var querystring=require('querystring');var Papa=require(_0xae94('0xf'));var Redis=require(_0xae94('0x10'));var authService=require(_0xae94('0x11'));var qs=require(_0xae94('0x12'));var as=require(_0xae94('0x13'));var hardwareService=require(_0xae94('0x14'));var logger=require(_0xae94('0x15'))(_0xae94('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae94('0x17'));var db=require(_0xae94('0x18'))['db'];function respondWithStatusCode(_0x5de3c5,_0x1b2a36){_0x1b2a36=_0x1b2a36||0xcc;return function(_0x488159){if(_0x488159){return _0x5de3c5[_0xae94('0x19')](_0x1b2a36);}return _0x5de3c5[_0xae94('0x1a')](_0x1b2a36)[_0xae94('0x1b')]();};}function respondWithResult(_0x490d83,_0x223e35){_0x223e35=_0x223e35||0xc8;return function(_0x48bf46){if(_0x48bf46){return _0x490d83[_0xae94('0x1a')](_0x223e35)[_0xae94('0x1c')](_0x48bf46);}};}function respondWithFilteredResult(_0x17589d,_0x56a922){return function(_0x274fb3){if(_0x274fb3){var _0x5581b6=typeof _0x56a922[_0xae94('0x1d')]==='undefined'&&typeof _0x56a922[_0xae94('0x1e')]===_0xae94('0x1f');var _0x48a943=_0x274fb3['count'];var _0x3f6145=_0x5581b6?0x0:_0x56a922[_0xae94('0x1d')];var _0x296009=_0x5581b6?_0x274fb3[_0xae94('0x20')]:_0x56a922['offset']+_0x56a922[_0xae94('0x1e')];var _0x4467cc;if(_0x296009>=_0x48a943){_0x296009=_0x48a943;_0x4467cc=0xc8;}else{_0x4467cc=0xce;}_0x17589d['status'](_0x4467cc);return _0x17589d[_0xae94('0x21')](_0xae94('0x22'),_0x3f6145+'-'+_0x296009+'/'+_0x48a943)['json'](_0x274fb3);}return null;};}function patchUpdates(_0x46d84f){return function(_0xb9b721){try{jsonpatch[_0xae94('0x23')](_0xb9b721,_0x46d84f,!![]);}catch(_0xb42887){return BPromise[_0xae94('0x24')](_0xb42887);}return _0xb9b721[_0xae94('0x25')]();};}function saveUpdates(_0x3d7d0f,_0x4260a6){return function(_0x3cfd53){if(_0x3cfd53){return _0x3cfd53['update'](_0x3d7d0f)[_0xae94('0x26')](function(_0x123dd6){return _0x123dd6;});}return null;};}function removeEntity(_0x5bc532,_0x111bd8){return function(_0xea4b73){if(_0xea4b73){return _0xea4b73[_0xae94('0x27')]()['then'](function(){_0x5bc532['status'](0xcc)[_0xae94('0x1b')]();});}};}function handleEntityNotFound(_0x4a3cd4,_0x2a61ff){return function(_0x49aa3a){if(!_0x49aa3a){_0x4a3cd4[_0xae94('0x19')](0x194);}return _0x49aa3a;};}function handleError(_0xc51ace,_0x3ea78a){_0x3ea78a=_0x3ea78a||0x1f4;return function(_0xf67ced){logger['error'](_0xf67ced['stack']);if(_0xf67ced['name']){delete _0xf67ced['name'];}_0xc51ace['status'](_0x3ea78a)[_0xae94('0x28')](_0xf67ced);};}exports['show']=function(_0xd35015,_0x58e74c){var _0x223b33={'raw':!![],'where':{'id':_0xd35015[_0xae94('0x29')]['id']}},_0x3f5339={};_0x3f5339['model']=_['keys'](db[_0xae94('0x2a')][_0xae94('0x2b')]);_0x3f5339[_0xae94('0x2c')]=_[_0xae94('0x2d')](_0xd35015[_0xae94('0x2c')]);_0x3f5339[_0xae94('0x2e')]=_[_0xae94('0x2f')](_0x3f5339['model'],_0x3f5339[_0xae94('0x2c')]);_0x223b33['attributes']=_['intersection'](_0x3f5339['model'],qs[_0xae94('0x30')](_0xd35015[_0xae94('0x2c')][_0xae94('0x30')]));_0x223b33[_0xae94('0x31')]=_0x223b33['attributes']['length']?_0x223b33[_0xae94('0x31')]:_0x3f5339[_0xae94('0x32')];if(_0xd35015[_0xae94('0x2c')][_0xae94('0x33')]){_0x223b33['include']=[{'all':!![]}];}_0x223b33=_['merge']({},_0x223b33,_0xd35015[_0xae94('0x34')]);return db[_0xae94('0x2a')]['find'](_0x223b33)[_0xae94('0x26')](handleEntityNotFound(_0x58e74c,null))[_0xae94('0x26')](respondWithResult(_0x58e74c,null))[_0xae94('0x35')](handleError(_0x58e74c,null));};exports[_0xae94('0x36')]=function(_0x95590,_0x7c1e61){return db[_0xae94('0x2a')]['create'](_0x95590[_0xae94('0x37')],{})[_0xae94('0x26')](respondWithResult(_0x7c1e61,0xc9))['catch'](handleError(_0x7c1e61,null));};exports[_0xae94('0x38')]=function(_0x41b933,_0x107870){if(_0x41b933[_0xae94('0x37')]['id']){delete _0x41b933[_0xae94('0x37')]['id'];}return db[_0xae94('0x2a')][_0xae94('0x39')]({'where':{'id':_0x41b933['params']['id']}})[_0xae94('0x26')](handleEntityNotFound(_0x107870,null))[_0xae94('0x26')](saveUpdates(_0x41b933['body'],null))[_0xae94('0x26')](respondWithResult(_0x107870,null))['catch'](handleError(_0x107870,null));};exports[_0xae94('0x27')]=function(_0x326860,_0x257340){return db[_0xae94('0x2a')][_0xae94('0x39')]({'where':{'id':_0x326860[_0xae94('0x29')]['id']}})[_0xae94('0x26')](handleEntityNotFound(_0x257340,null))['then'](removeEntity(_0x257340,null))['catch'](handleError(_0x257340,null));}; \ No newline at end of file +var _0xa990=['offset','limit','json','save','update','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count'];(function(_0x115eec,_0x1c3866){var _0x2ce914=function(_0x44dc63){while(--_0x44dc63){_0x115eec['push'](_0x115eec['shift']());}};_0x2ce914(++_0x1c3866);}(_0xa990,0xc9));var _0x0a99=function(_0x473cd6,_0x40672f){_0x473cd6=_0x473cd6-0x0;var _0x1bbbdd=_0xa990[_0x473cd6];return _0x1bbbdd;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['show']=function(_0x47bc34,_0x4e597b){var _0x223bdb={'raw':!![],'where':{'id':_0x47bc34[_0x0a99('0x29')]['id']}},_0x379c7e={};_0x379c7e[_0x0a99('0x2a')]=_[_0x0a99('0x2b')](db[_0x0a99('0x2c')][_0x0a99('0x2d')]);_0x379c7e['query']=_[_0x0a99('0x2b')](_0x47bc34[_0x0a99('0x2e')]);_0x379c7e[_0x0a99('0x2f')]=_[_0x0a99('0x30')](_0x379c7e['model'],_0x379c7e['query']);_0x223bdb['attributes']=_[_0x0a99('0x30')](_0x379c7e[_0x0a99('0x2a')],qs[_0x0a99('0x31')](_0x47bc34['query'][_0x0a99('0x31')]));_0x223bdb[_0x0a99('0x32')]=_0x223bdb[_0x0a99('0x32')][_0x0a99('0x33')]?_0x223bdb[_0x0a99('0x32')]:_0x379c7e[_0x0a99('0x2a')];if(_0x47bc34[_0x0a99('0x2e')]['includeAll']){_0x223bdb[_0x0a99('0x34')]=[{'all':!![]}];}_0x223bdb=_[_0x0a99('0x35')]({},_0x223bdb,_0x47bc34[_0x0a99('0x36')]);return db[_0x0a99('0x2c')][_0x0a99('0x37')](_0x223bdb)['then'](handleEntityNotFound(_0x4e597b,null))[_0x0a99('0x24')](respondWithResult(_0x4e597b,null))['catch'](handleError(_0x4e597b,null));};exports['create']=function(_0x5f20d0,_0x51b4ec){return db[_0x0a99('0x2c')]['create'](_0x5f20d0[_0x0a99('0x38')],{})[_0x0a99('0x24')](respondWithResult(_0x51b4ec,0xc9))[_0x0a99('0x39')](handleError(_0x51b4ec,null));};exports[_0x0a99('0x23')]=function(_0x414a0f,_0x43614d){if(_0x414a0f[_0x0a99('0x38')]['id']){delete _0x414a0f[_0x0a99('0x38')]['id'];}return db[_0x0a99('0x2c')][_0x0a99('0x37')]({'where':{'id':_0x414a0f[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x43614d,null))[_0x0a99('0x24')](saveUpdates(_0x414a0f['body'],null))[_0x0a99('0x24')](respondWithResult(_0x43614d,null))[_0x0a99('0x39')](handleError(_0x43614d,null));};exports['destroy']=function(_0x3f0a9,_0x549bb9){return db[_0x0a99('0x2c')]['find']({'where':{'id':_0x3f0a9[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x549bb9,null))[_0x0a99('0x24')](removeEntity(_0x549bb9,null))[_0x0a99('0x39')](handleError(_0x549bb9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 77a4600..59a5b99 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 _0xe6e2=['request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','moment'];(function(_0x48e338,_0x240edf){var _0x5bf51e=function(_0x16e6b2){while(--_0x16e6b2){_0x48e338['push'](_0x48e338['shift']());}};_0x5bf51e(++_0x240edf);}(_0xe6e2,0x1b7));var _0x2e6e=function(_0xc7e7ba,_0x2ec03e){_0xc7e7ba=_0xc7e7ba-0x0;var _0x5d22b2=_0xe6e2[_0xc7e7ba];return _0x5d22b2;};'use strict';var _=require(_0x2e6e('0x0'));var util=require(_0x2e6e('0x1'));var logger=require(_0x2e6e('0x2'))(_0x2e6e('0x3'));var moment=require(_0x2e6e('0x4'));var BPromise=require('bluebird');var rp=require(_0x2e6e('0x5'));var fs=require('fs');var path=require(_0x2e6e('0x6'));var rimraf=require(_0x2e6e('0x7'));var config=require(_0x2e6e('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x2e6e('0x9')]=function(_0x546011,_0x102deb){return _0x546011[_0x2e6e('0xa')](_0x2e6e('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a68=['./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0xde3560,_0x4fdc30){var _0xc57df7=function(_0x4328b2){while(--_0x4328b2){_0xde3560['push'](_0xde3560['shift']());}};_0xc57df7(++_0x4fdc30);}(_0x3a68,0x1d2));var _0x83a6=function(_0x57b30c,_0x3013aa){_0x57b30c=_0x57b30c-0x0;var _0x11a5fd=_0x3a68[_0x57b30c];return _0x11a5fd;};'use strict';var _=require(_0x83a6('0x0'));var util=require(_0x83a6('0x1'));var logger=require(_0x83a6('0x2'))('api');var moment=require(_0x83a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x83a6('0x4'));var fs=require('fs');var path=require(_0x83a6('0x5'));var rimraf=require('rimraf');var config=require(_0x83a6('0x6'));var attributes=require(_0x83a6('0x7'));module[_0x83a6('0x8')]=function(_0x17e08f,_0x1f6c80){return _0x17e08f['define'](_0x83a6('0x9'),attributes,{'tableName':_0x83a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 02c5219..caf6e2f 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 _0xafbc=['ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x253dad,_0x3bfafa){var _0x6c42df=function(_0x32fd1c){while(--_0x32fd1c){_0x253dad['push'](_0x253dad['shift']());}};_0x6c42df(++_0x3bfafa);}(_0xafbc,0x1a1));var _0xcafb=function(_0x3f158b,_0x52ade4){_0x3f158b=_0x3f158b-0x0;var _0x132ee2=_0xafbc[_0x3f158b];return _0x132ee2;};'use strict';var _=require('lodash');var util=require(_0xcafb('0x0'));var moment=require(_0xcafb('0x1'));var BPromise=require(_0xcafb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcafb('0x3'));var db=require(_0xcafb('0x4'))['db'];var utils=require(_0xcafb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcafb('0x6'));var client=jayson['client'][_0xcafb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4623a4,_0x5b0e09,_0x453ec4){return new BPromise(function(_0x4c820f,_0x27d411){return client[_0xcafb('0x8')](_0x4623a4,_0x453ec4)[_0xcafb('0x9')](function(_0x413078){logger['info'](_0xcafb('0xa'),_0x5b0e09,'request\x20sent');logger[_0xcafb('0xb')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5b0e09,_0xcafb('0xc'),JSON[_0xcafb('0xd')](_0x413078));if(_0x413078[_0xcafb('0xe')]){if(_0x413078[_0xcafb('0xe')][_0xcafb('0xf')]===0x1f4){logger[_0xcafb('0xe')](_0xcafb('0xa'),_0x5b0e09,_0x413078['error'][_0xcafb('0x10')]);return _0x27d411(_0x413078[_0xcafb('0xe')]['message']);}logger[_0xcafb('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x5b0e09,_0x413078[_0xcafb('0xe')][_0xcafb('0x10')]);return _0x4c820f(_0x413078[_0xcafb('0xe')][_0xcafb('0x10')]);}else{logger[_0xcafb('0x11')](_0xcafb('0xa'),_0x5b0e09,_0xcafb('0xc'));_0x4c820f(_0x413078[_0xcafb('0x12')][_0xcafb('0x10')]);}})[_0xcafb('0x13')](function(_0x28a773){logger[_0xcafb('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x5b0e09,_0x28a773);_0x27d411(_0x28a773);});});} \ No newline at end of file +var _0xe189=['stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x388e6c,_0x2ca243){var _0x3dc6de=function(_0x1dfd84){while(--_0x1dfd84){_0x388e6c['push'](_0x388e6c['shift']());}};_0x3dc6de(++_0x2ca243);}(_0xe189,0x194));var _0x9e18=function(_0x2e3992,_0x4322fa){_0x2e3992=_0x2e3992-0x0;var _0x724b7b=_0xe189[_0x2e3992];return _0x724b7b;};'use strict';var _=require(_0x9e18('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9e18('0x1'));var rs=require(_0x9e18('0x2'));var fs=require('fs');var Redis=require(_0x9e18('0x3'));var db=require(_0x9e18('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e18('0x5'));var config=require(_0x9e18('0x6'));var jayson=require(_0x9e18('0x7'));var client=jayson[_0x9e18('0x8')][_0x9e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e6097,_0x3153cf,_0x2e4691){return new BPromise(function(_0x4656a4,_0x50a0ce){return client[_0x9e18('0xa')](_0x5e6097,_0x2e4691)[_0x9e18('0xb')](function(_0x33e9cd){logger['info'](_0x9e18('0xc'),_0x3153cf,_0x9e18('0xd'));logger[_0x9e18('0xe')](_0x9e18('0xf'),_0x3153cf,_0x9e18('0xd'),JSON[_0x9e18('0x10')](_0x33e9cd));if(_0x33e9cd[_0x9e18('0x11')]){if(_0x33e9cd[_0x9e18('0x11')][_0x9e18('0x12')]===0x1f4){logger['error'](_0x9e18('0xc'),_0x3153cf,_0x33e9cd['error'][_0x9e18('0x13')]);return _0x50a0ce(_0x33e9cd[_0x9e18('0x11')]['message']);}logger[_0x9e18('0x11')](_0x9e18('0xc'),_0x3153cf,_0x33e9cd[_0x9e18('0x11')][_0x9e18('0x13')]);return _0x4656a4(_0x33e9cd['error'][_0x9e18('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x3153cf,_0x9e18('0xd'));_0x4656a4(_0x33e9cd['result'][_0x9e18('0x13')]);}})[_0x9e18('0x14')](function(_0x1f71fc){logger[_0x9e18('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3153cf,_0x1f71fc);_0x50a0ce(_0x1f71fc);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1fcb69d..144ecd7 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 _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xeff8,0x186));var _0x8eff=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xeff8[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file +var _0xed1f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ee172,_0x278363){var _0x2106e7=function(_0x54f214){while(--_0x54f214){_0x2ee172['push'](_0x2ee172['shift']());}};_0x2106e7(++_0x278363);}(_0xed1f,0x6a));var _0xfed1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xed1f[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/',auth[_0xfed1('0xd')](),controller[_0xfed1('0x10')]);router['put'](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller['update']);router[_0xfed1('0x11')](_0xfed1('0xc'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 61adbda..0e3c363 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 _0x9bfd=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x2a3b42,_0x945f41){var _0x1fafd3=function(_0x2667f7){while(--_0x2667f7){_0x2a3b42['push'](_0x2a3b42['shift']());}};_0x1fafd3(++_0x945f41);}(_0x9bfd,0x165));var _0xd9bf=function(_0x12ee9f,_0x56d7e1){_0x12ee9f=_0x12ee9f-0x0;var _0x527bce=_0x9bfd[_0x12ee9f];return _0x527bce;};'use strict';var Sequelize=require(_0xd9bf('0x0'));module[_0xd9bf('0x1')]={'name':{'type':Sequelize[_0xd9bf('0x2')],'unique':_0xd9bf('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd9bf('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd9bf('0x5'),_0xd9bf('0x6'),_0xd9bf('0x7'))}}; \ No newline at end of file +var _0xecc6=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x32b645,_0x38267b){var _0xa82341=function(_0xa91833){while(--_0xa91833){_0x32b645['push'](_0x32b645['shift']());}};_0xa82341(++_0x38267b);}(_0xecc6,0x15d));var _0x6ecc=function(_0x2326ff,_0x27e552){_0x2326ff=_0x2326ff-0x0;var _0x54bd8d=_0xecc6[_0x2326ff];return _0x54bd8d;};'use strict';var Sequelize=require(_0x6ecc('0x0'));module[_0x6ecc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6ecc('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6ecc('0x3')]},'timeout':{'type':Sequelize[_0x6ecc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6ecc('0x5')](_0x6ecc('0x6'),'beepall',_0x6ecc('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f56a386..04aa949 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 _0xf36f=['ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','TeamId','includes','all','union','compact','isEmpty','userChatQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','ChatQueues','UserProfileResource','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','includeAll','include','ChatQueue','show','params','keys','rawAttributes','find','create','body','get','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','filter','findAll','User','agent','updatedAt','createdAt','rows','format','SIP','chatPause','getTeams','Team','addTeams'];(function(_0x4ac88c,_0x26411c){var _0x55f9e6=function(_0x45259c){while(--_0x45259c){_0x4ac88c['push'](_0x4ac88c['shift']());}};_0x55f9e6(++_0x26411c);}(_0xf36f,0x146));var _0xff36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf36f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xff36('0x0'));var rp=require(_0xff36('0x1'));var moment=require(_0xff36('0x2'));var BPromise=require(_0xff36('0x3'));var Mustache=require(_0xff36('0x4'));var util=require(_0xff36('0x5'));var path=require('path');var sox=require(_0xff36('0x6'));var csv=require(_0xff36('0x7'));var ejs=require(_0xff36('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff36('0x9'));var crypto=require(_0xff36('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xff36('0xb'));var toCsv=require(_0xff36('0x7'));var querystring=require(_0xff36('0xc'));var Papa=require(_0xff36('0xd'));var Redis=require(_0xff36('0xe'));var authService=require(_0xff36('0xf'));var qs=require(_0xff36('0x10'));var as=require(_0xff36('0x11'));var hardwareService=require(_0xff36('0x12'));var logger=require(_0xff36('0x13'))(_0xff36('0x14'));var utils=require('../../config/utils');var config=require(_0xff36('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xff36('0x16'))['db'];config[_0xff36('0x17')]=_[_0xff36('0x18')](config['redis'],{'host':_0xff36('0x19'),'port':0x18eb});var socket=require(_0xff36('0x1a'))(new Redis(config[_0xff36('0x17')]));require(_0xff36('0x1b'))[_0xff36('0x1c')](socket);var jayson=require(_0xff36('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43affc,_0x2221c8,_0x3689ea,_0x39441c){return new BPromise(function(_0x49a5b3,_0x55bf0e){var _0xbf5707=_0x39441c||client;return _0xbf5707['request'](_0x43affc,_0x3689ea)[_0xff36('0x1e')](function(_0x518ece){logger[_0xff36('0x1f')](_0xff36('0x20'),_0x2221c8,_0xff36('0x21'));logger[_0xff36('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2221c8,'request\x20sent',JSON['stringify'](_0x518ece));if(_0x518ece[_0xff36('0x23')]){if(_0x518ece['error']['code']===0x1f4){logger[_0xff36('0x23')](_0xff36('0x20'),_0x2221c8,_0x518ece[_0xff36('0x23')]['message']);return _0x55bf0e(_0x518ece[_0xff36('0x23')][_0xff36('0x24')]);}logger[_0xff36('0x23')](_0xff36('0x20'),_0x2221c8,_0x518ece[_0xff36('0x23')][_0xff36('0x24')]);return _0x49a5b3(_0x518ece[_0xff36('0x23')][_0xff36('0x24')]);}else{logger[_0xff36('0x1f')](_0xff36('0x20'),_0x2221c8,_0xff36('0x21'));_0x49a5b3(_0x518ece[_0xff36('0x25')][_0xff36('0x24')]);}})[_0xff36('0x26')](function(_0x388df7){logger[_0xff36('0x23')](_0xff36('0x20'),_0x2221c8,_0x388df7);_0x55bf0e(_0x388df7);});});}function respondWithStatusCode(_0x3e7a0e,_0x21f19f){_0x21f19f=_0x21f19f||0xcc;return function(_0x4272d3){if(_0x4272d3){return _0x3e7a0e[_0xff36('0x27')](_0x21f19f);}return _0x3e7a0e[_0xff36('0x28')](_0x21f19f)[_0xff36('0x29')]();};}function respondWithResult(_0x4561cf,_0x4b3567){_0x4b3567=_0x4b3567||0xc8;return function(_0x59a41d){if(_0x59a41d){return _0x4561cf['status'](_0x4b3567)[_0xff36('0x2a')](_0x59a41d);}};}function respondWithFilteredResult(_0x3a6616,_0x544344){return function(_0x398f50){if(_0x398f50){var _0x1f5db3=typeof _0x544344[_0xff36('0x2b')]===_0xff36('0x2c')&&typeof _0x544344[_0xff36('0x2d')]===_0xff36('0x2c');var _0x364a6a=_0x398f50[_0xff36('0x2e')];var _0x108891=_0x1f5db3?0x0:_0x544344[_0xff36('0x2b')];var _0x24c086=_0x1f5db3?_0x398f50[_0xff36('0x2e')]:_0x544344['offset']+_0x544344[_0xff36('0x2d')];var _0x19cef4;if(_0x24c086>=_0x364a6a){_0x24c086=_0x364a6a;_0x19cef4=0xc8;}else{_0x19cef4=0xce;}_0x3a6616['status'](_0x19cef4);return _0x3a6616[_0xff36('0x2f')](_0xff36('0x30'),_0x108891+'-'+_0x24c086+'/'+_0x364a6a)[_0xff36('0x2a')](_0x398f50);}return null;};}function patchUpdates(_0x359530){return function(_0x723057){try{jsonpatch[_0xff36('0x31')](_0x723057,_0x359530,!![]);}catch(_0x531f2f){return BPromise[_0xff36('0x32')](_0x531f2f);}return _0x723057[_0xff36('0x33')]();};}function saveUpdates(_0x46057a,_0x7d770f){return function(_0x339953){if(_0x339953){return _0x339953[_0xff36('0x34')](_0x46057a)['then'](function(_0x1e066d){return _0x1e066d;});}return null;};}function removeEntity(_0x5716c0,_0x2d8581){return function(_0x40e310){if(_0x40e310){return _0x40e310['destroy']()[_0xff36('0x1e')](function(){var _0x501344=_0x40e310['get']({'plain':!![]});var _0x16a74a=_0xff36('0x35');return db[_0xff36('0x36')]['destroy']({'where':{'type':_0x16a74a,'resourceId':_0x501344['id']}})[_0xff36('0x1e')](function(){return _0x40e310;});})['then'](function(){_0x5716c0['status'](0xcc)[_0xff36('0x29')]();});}};}function handleEntityNotFound(_0x18c4a6,_0x3c13f5){return function(_0x294b15){if(!_0x294b15){_0x18c4a6[_0xff36('0x27')](0x194);}return _0x294b15;};}function handleError(_0x4098d1,_0x2879a8){_0x2879a8=_0x2879a8||0x1f4;return function(_0x4e80bf){logger[_0xff36('0x23')](_0x4e80bf['stack']);if(_0x4e80bf[_0xff36('0x37')]){delete _0x4e80bf[_0xff36('0x37')];}_0x4098d1['status'](_0x2879a8)[_0xff36('0x38')](_0x4e80bf);};}exports['index']=function(_0x3c28fc,_0x2c0599){var _0x1aa22f={},_0x3ef1bd={},_0x5ef18e={'count':0x0,'rows':[]};var _0x449e25=_[_0xff36('0x39')](db['ChatQueue']['rawAttributes'],function(_0x473deb){return{'name':_0x473deb[_0xff36('0x3a')],'type':_0x473deb[_0xff36('0x3b')][_0xff36('0x3c')]};});_0x3ef1bd[_0xff36('0x3d')]=_[_0xff36('0x39')](_0x449e25,_0xff36('0x37'));_0x3ef1bd['query']=_['keys'](_0x3c28fc[_0xff36('0x3e')]);_0x3ef1bd[_0xff36('0x3f')]=_[_0xff36('0x40')](_0x3ef1bd[_0xff36('0x3d')],_0x3ef1bd[_0xff36('0x3e')]);_0x1aa22f['attributes']=_['intersection'](_0x3ef1bd[_0xff36('0x3d')],qs['fields'](_0x3c28fc[_0xff36('0x3e')][_0xff36('0x41')]));_0x1aa22f['attributes']=_0x1aa22f[_0xff36('0x42')][_0xff36('0x43')]?_0x1aa22f[_0xff36('0x42')]:_0x3ef1bd[_0xff36('0x3d')];if(!_0x3c28fc[_0xff36('0x3e')][_0xff36('0x44')](_0xff36('0x45'))){_0x1aa22f['limit']=qs[_0xff36('0x2d')](_0x3c28fc[_0xff36('0x3e')][_0xff36('0x2d')]);_0x1aa22f[_0xff36('0x2b')]=qs[_0xff36('0x2b')](_0x3c28fc[_0xff36('0x3e')][_0xff36('0x2b')]);}_0x1aa22f['order']=qs[_0xff36('0x46')](_0x3c28fc['query']['sort']);_0x1aa22f[_0xff36('0x47')]=qs[_0xff36('0x3f')](_[_0xff36('0x48')](_0x3c28fc[_0xff36('0x3e')],_0x3ef1bd[_0xff36('0x3f')]),_0x449e25);if(_0x3c28fc['query']['filter']){_0x1aa22f['where']=_['merge'](_0x1aa22f[_0xff36('0x47')],{'$or':_[_0xff36('0x39')](_0x449e25,function(_0x471ba3){if(_0x471ba3[_0xff36('0x3b')]!==_0xff36('0x49')){var _0x4b1889={};_0x4b1889[_0x471ba3['name']]={'$like':'%'+_0x3c28fc[_0xff36('0x3e')]['filter']+'%'};return _0x4b1889;}})});}_0x1aa22f=_[_0xff36('0x4a')]({},_0x1aa22f,_0x3c28fc[_0xff36('0x4b')]);var _0x3882e0={'where':_0x1aa22f[_0xff36('0x47')]};return db['ChatQueue'][_0xff36('0x2e')](_0x3882e0)['then'](function(_0x3c0912){_0x5ef18e[_0xff36('0x2e')]=_0x3c0912;if(_0x3c28fc[_0xff36('0x3e')][_0xff36('0x4c')]){_0x1aa22f[_0xff36('0x4d')]=[{'all':!![]}];}return db[_0xff36('0x4e')]['findAll'](_0x1aa22f);})[_0xff36('0x1e')](function(_0x256a65){_0x5ef18e['rows']=_0x256a65;return _0x5ef18e;})[_0xff36('0x1e')](respondWithFilteredResult(_0x2c0599,_0x1aa22f))['catch'](handleError(_0x2c0599,null));};exports[_0xff36('0x4f')]=function(_0x596ac8,_0x5d5649){var _0x59c9e4={'raw':!![],'where':{'id':_0x596ac8[_0xff36('0x50')]['id']}},_0x31f06b={};_0x31f06b[_0xff36('0x3d')]=_[_0xff36('0x51')](db[_0xff36('0x4e')][_0xff36('0x52')]);_0x31f06b[_0xff36('0x3e')]=_[_0xff36('0x51')](_0x596ac8[_0xff36('0x3e')]);_0x31f06b[_0xff36('0x3f')]=_[_0xff36('0x40')](_0x31f06b[_0xff36('0x3d')],_0x31f06b['query']);_0x59c9e4[_0xff36('0x42')]=_[_0xff36('0x40')](_0x31f06b[_0xff36('0x3d')],qs[_0xff36('0x41')](_0x596ac8['query'][_0xff36('0x41')]));_0x59c9e4[_0xff36('0x42')]=_0x59c9e4[_0xff36('0x42')][_0xff36('0x43')]?_0x59c9e4[_0xff36('0x42')]:_0x31f06b['model'];if(_0x596ac8[_0xff36('0x3e')][_0xff36('0x4c')]){_0x59c9e4['include']=[{'all':!![]}];}_0x59c9e4=_[_0xff36('0x4a')]({},_0x59c9e4,_0x596ac8[_0xff36('0x4b')]);return db[_0xff36('0x4e')][_0xff36('0x53')](_0x59c9e4)[_0xff36('0x1e')](handleEntityNotFound(_0x5d5649,null))['then'](respondWithResult(_0x5d5649,null))['catch'](handleError(_0x5d5649,null));};exports[_0xff36('0x54')]=function(_0x3732ca,_0x4d99a7){return db[_0xff36('0x4e')][_0xff36('0x54')](_0x3732ca[_0xff36('0x55')],{})['then'](function(_0x3b76f3){var _0x14b1a3=_0x3732ca['user'][_0xff36('0x56')]({'plain':!![]});if(!_0x14b1a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14b1a3[_0xff36('0x57')]===_0xff36('0x58')){var _0x3cc9a2=_0x3b76f3['get']({'plain':!![]});var _0x2ddc9b=_0xff36('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x2ddc9b,'userProfileId':_0x14b1a3[_0xff36('0x59')]},'raw':!![]})[_0xff36('0x1e')](function(_0x1a5758){if(_0x1a5758&&_0x1a5758[_0xff36('0x5a')]===0x0){return db['UserProfileResource'][_0xff36('0x54')]({'name':_0x3cc9a2[_0xff36('0x37')],'resourceId':_0x3cc9a2['id'],'type':_0x1a5758['name'],'sectionId':_0x1a5758['id']},{})[_0xff36('0x1e')](function(){return _0x3b76f3;});}else{return _0x3b76f3;}})[_0xff36('0x26')](function(_0x2f66f2){logger[_0xff36('0x23')](_0xff36('0x5b'),_0x2f66f2);throw _0x2f66f2;});}return _0x3b76f3;})[_0xff36('0x1e')](respondWithResult(_0x4d99a7,0xc9))[_0xff36('0x26')](handleError(_0x4d99a7,null));};exports[_0xff36('0x34')]=function(_0x4bd540,_0x322271){if(_0x4bd540[_0xff36('0x55')]['id']){delete _0x4bd540[_0xff36('0x55')]['id'];}return db[_0xff36('0x4e')][_0xff36('0x53')]({'where':{'id':_0x4bd540[_0xff36('0x50')]['id']}})[_0xff36('0x1e')](handleEntityNotFound(_0x322271,null))[_0xff36('0x1e')](saveUpdates(_0x4bd540[_0xff36('0x55')],null))['then'](respondWithResult(_0x322271,null))[_0xff36('0x26')](handleError(_0x322271,null));};exports[_0xff36('0x5c')]=function(_0x5ecc44,_0x37f819){return db['ChatQueue']['find']({'where':{'id':_0x5ecc44[_0xff36('0x50')]['id']}})[_0xff36('0x1e')](handleEntityNotFound(_0x37f819,null))[_0xff36('0x1e')](removeEntity(_0x37f819,null))[_0xff36('0x26')](handleError(_0x37f819,null));};exports[_0xff36('0x5d')]=function(_0x427eea,_0x2b9a01){return db['ChatQueue'][_0xff36('0x5d')]()['then'](respondWithResult(_0x2b9a01,null))[_0xff36('0x26')](handleError(_0x2b9a01,null));};exports[_0xff36('0x5e')]=function(_0x95a902,_0x5830bd,_0x227f2d){var _0x1e0b09={'raw':!![],'where':{}},_0x9779e6={},_0x33930f;return db[_0xff36('0x4e')][_0xff36('0x5f')]({'where':{'id':_0x95a902['params']['id']}})['then'](handleEntityNotFound(_0x5830bd,null))[_0xff36('0x1e')](function(_0x158f53){if(_0x158f53){_0x33930f=_0x158f53[_0xff36('0x56')]({'plain':!![]});_0x9779e6[_0xff36('0x3d')]=_['keys'](db[_0xff36('0x60')]['rawAttributes']);_0x9779e6[_0xff36('0x3e')]=_[_0xff36('0x51')](_0x95a902[_0xff36('0x3e')]);_0x9779e6[_0xff36('0x3f')]=_[_0xff36('0x40')](_0x9779e6[_0xff36('0x3d')],_0x9779e6[_0xff36('0x3e')]);_0x1e0b09[_0xff36('0x42')]=_[_0xff36('0x40')](_0x9779e6[_0xff36('0x3d')],qs[_0xff36('0x41')](_0x95a902['query']['fields']));_0x1e0b09[_0xff36('0x42')]=_0x1e0b09[_0xff36('0x42')][_0xff36('0x43')]?_0x1e0b09[_0xff36('0x42')]:_0x9779e6[_0xff36('0x3d')];if(!_0x95a902['query'][_0xff36('0x44')](_0xff36('0x45'))){_0x1e0b09[_0xff36('0x2d')]=qs[_0xff36('0x2d')](_0x95a902[_0xff36('0x3e')]['limit']);_0x1e0b09[_0xff36('0x2b')]=qs[_0xff36('0x2b')](_0x95a902[_0xff36('0x3e')][_0xff36('0x2b')]);}_0x1e0b09[_0xff36('0x61')]=qs[_0xff36('0x46')](_0x95a902[_0xff36('0x3e')][_0xff36('0x46')]);_0x1e0b09[_0xff36('0x47')]=qs[_0xff36('0x3f')](_['pick'](_0x95a902['query'],_0x9779e6['filters']));_0x1e0b09[_0xff36('0x47')][_0xff36('0x62')]=_0x158f53['id'];if(_0x95a902['query'][_0xff36('0x63')]){_0x1e0b09[_0xff36('0x47')]=_[_0xff36('0x4a')](_0x1e0b09[_0xff36('0x47')],{'$or':_[_0xff36('0x39')](_0x1e0b09[_0xff36('0x42')],function(_0x4378e2){var _0x216703={};_0x216703[_0x4378e2]={'$like':'%'+_0x95a902[_0xff36('0x3e')][_0xff36('0x63')]+'%'};return _0x216703;})});}_0x1e0b09=_['merge']({},_0x1e0b09,_0x95a902[_0xff36('0x4b')]);return db[_0xff36('0x60')][_0xff36('0x64')](_0x1e0b09);}})['then'](function(_0x6c7edc){if(_0x6c7edc){return db[_0xff36('0x65')]['findAndCountAll']({'where':{'id':_[_0xff36('0x39')](_0x6c7edc,'UserId'),'role':_0xff36('0x66')},'attributes':['id',_0xff36('0x37'),'chatPause',_0xff36('0x67'),_0xff36('0x68')]});}})[_0xff36('0x1e')](function(_0x21da5e){if(_0x21da5e){return{'count':_0x21da5e[_0xff36('0x2e')],'rows':_[_0xff36('0x39')](_0x21da5e[_0xff36('0x69')],function(_0x27000b){return{'membername':_0x27000b['name'],'UserId':_0x27000b['id'],'queue_name':_0x33930f[_0xff36('0x37')],'ChatQueueId':_0x33930f['id'],'interface':util[_0xff36('0x6a')]('%s/%s',_0xff36('0x6b'),_0x27000b['name']),'penalty':0x0,'paused':_0x27000b[_0xff36('0x6c')],'createdAt':_0x27000b[_0xff36('0x68')],'updatedAt':_0x27000b[_0xff36('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xff36('0x1e')](respondWithFilteredResult(_0x5830bd,_0x1e0b09))[_0xff36('0x26')](handleError(_0x5830bd,null));};exports[_0xff36('0x6d')]=function(_0x525305,_0x5b9023,_0x93d230){var _0x36293e={};var _0x1f8208={};var _0x23c355;var _0x2fc271;return db['ChatQueue'][_0xff36('0x5f')]({'where':{'id':_0x525305[_0xff36('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b9023,null))[_0xff36('0x1e')](function(_0x55a76b){if(_0x55a76b){_0x23c355=_0x55a76b;_0x1f8208[_0xff36('0x3d')]=_[_0xff36('0x51')](db[_0xff36('0x6e')][_0xff36('0x52')]);_0x1f8208[_0xff36('0x3e')]=_['keys'](_0x525305[_0xff36('0x3e')]);_0x1f8208[_0xff36('0x3f')]=_['intersection'](_0x1f8208[_0xff36('0x3d')],_0x1f8208[_0xff36('0x3e')]);_0x36293e[_0xff36('0x42')]=_[_0xff36('0x40')](_0x1f8208[_0xff36('0x3d')],qs['fields'](_0x525305[_0xff36('0x3e')][_0xff36('0x41')]));_0x36293e['attributes']=_0x36293e[_0xff36('0x42')]['length']?_0x36293e[_0xff36('0x42')]:_0x1f8208[_0xff36('0x3d')];_0x36293e['order']=qs[_0xff36('0x46')](_0x525305['query'][_0xff36('0x46')]);_0x36293e['where']=qs[_0xff36('0x3f')](_['pick'](_0x525305[_0xff36('0x3e')],_0x1f8208[_0xff36('0x3f')]));if(_0x525305[_0xff36('0x3e')][_0xff36('0x63')]){_0x36293e[_0xff36('0x47')]=_[_0xff36('0x4a')](_0x36293e[_0xff36('0x47')],{'$or':_[_0xff36('0x39')](_0x36293e[_0xff36('0x42')],function(_0xc52523){var _0x5514a6={};_0x5514a6[_0xc52523]={'$like':'%'+_0x525305['query'][_0xff36('0x63')]+'%'};return _0x5514a6;})});}_0x36293e=_[_0xff36('0x4a')]({},_0x36293e,_0x525305[_0xff36('0x4b')]);return _0x23c355[_0xff36('0x6d')](_0x36293e);}})[_0xff36('0x1e')](function(_0x73f852){if(_0x73f852){_0x2fc271=_0x73f852[_0xff36('0x43')];if(!_0x525305['query'][_0xff36('0x44')](_0xff36('0x45'))){_0x36293e[_0xff36('0x2d')]=qs[_0xff36('0x2d')](_0x525305['query'][_0xff36('0x2d')]);_0x36293e[_0xff36('0x2b')]=qs[_0xff36('0x2b')](_0x525305[_0xff36('0x3e')][_0xff36('0x2b')]);}return _0x23c355[_0xff36('0x6d')](_0x36293e);}})[_0xff36('0x1e')](function(_0x18b246){if(_0x18b246){return _0x18b246?{'count':_0x2fc271,'rows':_0x18b246}:null;}})['then'](respondWithResult(_0x5b9023,null))[_0xff36('0x26')](handleError(_0x5b9023,null));};exports[_0xff36('0x6f')]=function(_0x47a1cd,_0x25ce6d,_0x1832b5){var _0x20650b=_0x47a1cd[_0xff36('0x55')][_0xff36('0x70')];return db[_0xff36('0x6e')]['findAll']({'where':{'id':_0x20650b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xff36('0x71'),'attributes':['id',_0xff36('0x37'),'online',_0xff36('0x72'),_0xff36('0x73')],'raw':!![]}]})[_0xff36('0x1e')](function(_0x484809){if(_0x484809){var _0x3cd739=_['flatMap'](_0x484809,function(_0x360b2f){var _0x4771ad=_0x360b2f[_0xff36('0x56')]({'plain':!![]});return _0x4771ad[_0xff36('0x71')];});return db[_0xff36('0x4e')][_0xff36('0x53')]({'where':{'id':_0x47a1cd[_0xff36('0x50')]['id']}})['then'](function(_0x33dfb5){return db[_0xff36('0x74')][_0xff36('0x75')](function(_0x2fa524){return _0x33dfb5[_0xff36('0x6f')](_0x20650b,{'transaction':_0x2fa524})[_0xff36('0x1e')](function(){return BPromise[_0xff36('0x76')](_0x3cd739,function(_0xb64c5c){return db[_0xff36('0x60')][_0xff36('0x77')]({'where':{'UserId':_0xb64c5c['id'],'ChatQueueId':_0x47a1cd[_0xff36('0x50')]['id']},'transaction':_0x2fa524});});})[_0xff36('0x1e')](function(){_0x3cd739[_0xff36('0x78')](function(_0x49696b){socket[_0xff36('0x79')](_0xff36('0x7a'),{'UserId':_0x49696b['id'],'ChatQueueId':_0x33dfb5['id']});});});});});}})['then'](respondWithStatusCode(_0x25ce6d,null))[_0xff36('0x26')](handleError(_0x25ce6d,null));};exports[_0xff36('0x7b')]=function(_0x2840fb,_0x43cdd0,_0x4531d6){return db['Team'][_0xff36('0x64')]({'where':{'id':_0x2840fb['query'][_0xff36('0x70')]},'attributes':['id'],'include':[{'model':db[_0xff36('0x65')],'as':_0xff36('0x71'),'attributes':['id'],'raw':!![]}]})[_0xff36('0x1e')](handleEntityNotFound(_0x43cdd0,null))[_0xff36('0x1e')](function(_0x3380ea){var _0x169ffa=_['map'](_0x3380ea,'id');var _0x4bab9d=[];var _0x3d1804=[];var _0x169b4b=squel['select']();_0x169b4b[_0xff36('0x7c')](_0xff36('0x7d'))['from'](_0xff36('0x7e'),'tq')[_0xff36('0x7f')]('user_has_teams','ut',_0xff36('0x80'))[_0xff36('0x47')](_0xff36('0x81'),_0x2840fb[_0xff36('0x50')]['id']);for(var _0x3a653f=0x0;_0x3a653f<_0x3380ea['length'];_0x3a653f+=0x1){let _0x2c1773=_0x3380ea[_0x3a653f];for(var _0xdd3bed=0x0;_0xdd3bed<_0x2c1773[_0xff36('0x71')][_0xff36('0x43')];_0xdd3bed+=0x1){let _0x3535ad=_0x2c1773[_0xff36('0x71')][_0xdd3bed];var _0xcc9091=_0x169b4b[_0xff36('0x82')]();_0xcc9091[_0xff36('0x47')]('ut.UserId\x20=\x20?',_0x3535ad['id']);_0x3d1804[_0xff36('0x83')](db[_0xff36('0x74')][_0xff36('0x3e')](_0xcc9091[_0xff36('0x84')](),{'type':db[_0xff36('0x74')][_0xff36('0x85')]['SELECT']})[_0xff36('0x1e')](function(_0x90a0bd){if(_0x90a0bd[_0xff36('0x43')]===0x1){return _0x3535ad['id'];}else{var _0x57a9fc=_['every'](_['map'](_0x90a0bd,_0xff36('0x86')),function(_0x36c962){return _[_0xff36('0x87')](_0x169ffa,_0x36c962);});if(_0x57a9fc){return _0x3535ad['id'];}}}));}}return BPromise[_0xff36('0x88')](_0x3d1804)[_0xff36('0x1e')](function(_0x1158a7){_0x4bab9d=_(_0x4bab9d)[_0xff36('0x89')](_0x1158a7)[_0xff36('0x8a')]()['value']();return db['ChatQueue'][_0xff36('0x53')]({'where':{'id':_0x2840fb['params']['id']}})[_0xff36('0x1e')](function(_0x114b2e){return db[_0xff36('0x74')]['transaction'](function(_0x5807e2){return _0x114b2e[_0xff36('0x7b')](_0x2840fb[_0xff36('0x3e')][_0xff36('0x70')],{'transaction':_0x5807e2})[_0xff36('0x1e')](function(){if(!_[_0xff36('0x8b')](_0x4bab9d)){return _0x114b2e['removeAgents'](_0x4bab9d,{'transaction':_0x5807e2});}})[_0xff36('0x1e')](function(){_0x4bab9d['forEach'](function(_0xc892e3){socket['emit'](_0xff36('0x8c'),{'UserId':_0xc892e3,'ChatQueueId':_0x114b2e['id']});});});});});});})[_0xff36('0x1e')](respondWithStatusCode(_0x43cdd0,null))[_0xff36('0x26')](handleError(_0x43cdd0,null));};exports[_0xff36('0x8d')]=function(_0x1aaa6a,_0x37a397,_0x392e67){return db['ChatQueue'][_0xff36('0x53')]({'where':{'id':_0x1aaa6a[_0xff36('0x50')]['id']}})[_0xff36('0x1e')](handleEntityNotFound(_0x37a397,null))['then'](function(_0x2e11f3){if(_0x2e11f3){return _0x2e11f3['addAgents'](_0x1aaa6a[_0xff36('0x55')][_0xff36('0x70')],_['omit'](_0x1aaa6a[_0xff36('0x55')],[_0xff36('0x70'),'id'])||{})[_0xff36('0x8e')](function(_0x239166){for(var _0x2413b8=0x0;_0x2413b8<_0x1aaa6a[_0xff36('0x55')][_0xff36('0x70')]['length'];_0x2413b8+=0x1){socket[_0xff36('0x79')](_0xff36('0x7a'),{'UserId':Number(_0x1aaa6a[_0xff36('0x55')][_0xff36('0x70')][_0x2413b8]),'ChatQueueId':Number(_0x1aaa6a['params']['id'])});}return _0x239166;});}})[_0xff36('0x1e')](respondWithResult(_0x37a397,null))['catch'](handleError(_0x37a397,null));};exports['removeAgents']=function(_0x952e69,_0x7a99cf,_0x1083f5){return db['ChatQueue'][_0xff36('0x53')]({'where':{'id':_0x952e69[_0xff36('0x50')]['id']}})[_0xff36('0x1e')](handleEntityNotFound(_0x7a99cf,null))['then'](function(_0x40e27d){if(_0x40e27d){return _0x40e27d[_0xff36('0x8f')](_0x952e69[_0xff36('0x3e')]['ids'])[_0xff36('0x1e')](function(){if(_[_0xff36('0x90')](_0x952e69[_0xff36('0x3e')][_0xff36('0x70')])){for(var _0x349906=0x0;_0x349906<_0x952e69[_0xff36('0x3e')][_0xff36('0x70')]['length'];_0x349906+=0x1){socket[_0xff36('0x79')]('userChatQueue:remove',{'UserId':Number(_0x952e69[_0xff36('0x3e')][_0xff36('0x70')][_0x349906]),'ChatQueueId':Number(_0x952e69[_0xff36('0x50')]['id'])});}}else{socket['emit'](_0xff36('0x8c'),{'UserId':Number(_0x952e69[_0xff36('0x3e')][_0xff36('0x70')]),'ChatQueueId':Number(_0x952e69[_0xff36('0x50')]['id'])});}});}})[_0xff36('0x1e')](respondWithStatusCode(_0x7a99cf,null))['catch'](handleError(_0x7a99cf,null));};exports[_0xff36('0x91')]=function(_0x283097,_0x204580,_0x12effc){var _0x3470ca={};var _0x3dc4c1={};var _0x1c7126;var _0x1bd470;return db[_0xff36('0x4e')][_0xff36('0x5f')]({'where':{'id':_0x283097['params']['id']}})[_0xff36('0x1e')](handleEntityNotFound(_0x204580,null))[_0xff36('0x1e')](function(_0x57e0e9){if(_0x57e0e9){_0x1c7126=_0x57e0e9;_0x3dc4c1[_0xff36('0x3d')]=_[_0xff36('0x51')](db[_0xff36('0x65')][_0xff36('0x52')]);_0x3dc4c1[_0xff36('0x3e')]=_['keys'](_0x283097[_0xff36('0x3e')]);_0x3dc4c1['filters']=_['intersection'](_0x3dc4c1[_0xff36('0x3d')],_0x3dc4c1[_0xff36('0x3e')]);_0x3470ca[_0xff36('0x42')]=_['intersection'](_0x3dc4c1[_0xff36('0x3d')],qs['fields'](_0x283097[_0xff36('0x3e')][_0xff36('0x41')]));_0x3470ca['attributes']=_0x3470ca[_0xff36('0x42')][_0xff36('0x43')]?_0x3470ca['attributes']:_0x3dc4c1[_0xff36('0x3d')];_0x3470ca[_0xff36('0x61')]=qs[_0xff36('0x46')](_0x283097[_0xff36('0x3e')][_0xff36('0x46')]);_0x3470ca['where']=qs[_0xff36('0x3f')](_['pick'](_0x283097[_0xff36('0x3e')],_0x3dc4c1[_0xff36('0x3f')]));if(_0x283097[_0xff36('0x3e')]['filter']){_0x3470ca['where']=_[_0xff36('0x4a')](_0x3470ca[_0xff36('0x47')],{'$or':_['map'](_0x3470ca['attributes'],function(_0x232536){var _0x481129={};_0x481129[_0x232536]={'$like':'%'+_0x283097[_0xff36('0x3e')][_0xff36('0x63')]+'%'};return _0x481129;})});}_0x3470ca=_[_0xff36('0x4a')]({},_0x3470ca,_0x283097[_0xff36('0x4b')]);return _0x1c7126[_0xff36('0x91')](_0x3470ca);}})[_0xff36('0x1e')](function(_0x2290d0){if(_0x2290d0){_0x1bd470=_0x2290d0[_0xff36('0x43')];if(!_0x283097['query'][_0xff36('0x44')]('nolimit')){_0x3470ca[_0xff36('0x2d')]=qs['limit'](_0x283097[_0xff36('0x3e')][_0xff36('0x2d')]);_0x3470ca[_0xff36('0x2b')]=qs['offset'](_0x283097[_0xff36('0x3e')][_0xff36('0x2b')]);}return _0x1c7126[_0xff36('0x91')](_0x3470ca);}})[_0xff36('0x1e')](function(_0x46224a){if(_0x46224a){return _0x46224a?{'count':_0x1bd470,'rows':_0x46224a}:null;}})['then'](respondWithResult(_0x204580,null))['catch'](handleError(_0x204580,null));}; \ No newline at end of file +var _0x732d=['clone','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','userChatQueue:save','isArray','userChatQueue:remove','getAgents','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','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','./chatQueue.socket','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','get','ChatQueues','destroy','sendStatus','stack','name','index','map','ChatQueue','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','create','body','user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserChatQueue','sort','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','flatMap','sequelize','transaction','findOrCreate','emit','removeTeams','Agents','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x732d,0xaa));var _0xd732=function(_0x3be646,_0x1083f3){_0x3be646=_0x3be646-0x0;var _0x86ea57=_0x732d[_0x3be646];return _0x86ea57;};'use strict';var emlformat=require(_0xd732('0x0'));var rimraf=require(_0xd732('0x1'));var zipdir=require(_0xd732('0x2'));var jsonpatch=require(_0xd732('0x3'));var rp=require(_0xd732('0x4'));var moment=require('moment');var BPromise=require(_0xd732('0x5'));var Mustache=require(_0xd732('0x6'));var util=require(_0xd732('0x7'));var path=require(_0xd732('0x8'));var sox=require(_0xd732('0x9'));var csv=require(_0xd732('0xa'));var ejs=require(_0xd732('0xb'));var fs=require('fs');var fs_extra=require(_0xd732('0xc'));var _=require(_0xd732('0xd'));var squel=require(_0xd732('0xe'));var crypto=require(_0xd732('0xf'));var jsforce=require(_0xd732('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd732('0x11'));var Papa=require(_0xd732('0x12'));var Redis=require(_0xd732('0x13'));var authService=require(_0xd732('0x14'));var qs=require(_0xd732('0x15'));var as=require(_0xd732('0x16'));var hardwareService=require(_0xd732('0x17'));var logger=require(_0xd732('0x18'))(_0xd732('0x19'));var utils=require(_0xd732('0x1a'));var config=require(_0xd732('0x1b'));var licenseUtil=require(_0xd732('0x1c'));var db=require(_0xd732('0x1d'))['db'];config[_0xd732('0x1e')]=_['defaults'](config[_0xd732('0x1e')],{'host':_0xd732('0x1f'),'port':0x18eb});var socket=require(_0xd732('0x20'))(new Redis(config[_0xd732('0x1e')]));require(_0xd732('0x21'))['register'](socket);var jayson=require(_0xd732('0x22'));var client=jayson[_0xd732('0x23')][_0xd732('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x249ca6,_0x5a2422,_0x246e21,_0x799b93){return new BPromise(function(_0x532122,_0x389fab){var _0x1f83c3=_0x799b93||client;return _0x1f83c3['request'](_0x249ca6,_0x246e21)[_0xd732('0x25')](function(_0x3fb5f8){logger[_0xd732('0x26')](_0xd732('0x27'),_0x5a2422,_0xd732('0x28'));logger['debug'](_0xd732('0x29'),_0x5a2422,'request\x20sent',JSON[_0xd732('0x2a')](_0x3fb5f8));if(_0x3fb5f8[_0xd732('0x2b')]){if(_0x3fb5f8[_0xd732('0x2b')][_0xd732('0x2c')]===0x1f4){logger[_0xd732('0x2b')]('ChatQueue,\x20%s,\x20%s',_0x5a2422,_0x3fb5f8[_0xd732('0x2b')][_0xd732('0x2d')]);return _0x389fab(_0x3fb5f8[_0xd732('0x2b')]['message']);}logger['error'](_0xd732('0x27'),_0x5a2422,_0x3fb5f8[_0xd732('0x2b')]['message']);return _0x532122(_0x3fb5f8[_0xd732('0x2b')][_0xd732('0x2d')]);}else{logger['info'](_0xd732('0x27'),_0x5a2422,_0xd732('0x28'));_0x532122(_0x3fb5f8[_0xd732('0x2e')][_0xd732('0x2d')]);}})[_0xd732('0x2f')](function(_0x2e926b){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5a2422,_0x2e926b);_0x389fab(_0x2e926b);});});}function respondWithStatusCode(_0x5c0593,_0xc25d56){_0xc25d56=_0xc25d56||0xcc;return function(_0x3bcaa7){if(_0x3bcaa7){return _0x5c0593['sendStatus'](_0xc25d56);}return _0x5c0593[_0xd732('0x30')](_0xc25d56)[_0xd732('0x31')]();};}function respondWithResult(_0x3e8d97,_0x277007){_0x277007=_0x277007||0xc8;return function(_0x5a6bdb){if(_0x5a6bdb){return _0x3e8d97['status'](_0x277007)[_0xd732('0x32')](_0x5a6bdb);}};}function respondWithFilteredResult(_0x21e6e9,_0x46a007){return function(_0x480177){if(_0x480177){var _0x23ff36=typeof _0x46a007[_0xd732('0x33')]===_0xd732('0x34')&&typeof _0x46a007[_0xd732('0x35')]===_0xd732('0x34');var _0x4be270=_0x480177[_0xd732('0x36')];var _0x229370=_0x23ff36?0x0:_0x46a007[_0xd732('0x33')];var _0xd6a9c9=_0x23ff36?_0x480177[_0xd732('0x36')]:_0x46a007['offset']+_0x46a007[_0xd732('0x35')];var _0x58e0e5;if(_0xd6a9c9>=_0x4be270){_0xd6a9c9=_0x4be270;_0x58e0e5=0xc8;}else{_0x58e0e5=0xce;}_0x21e6e9[_0xd732('0x30')](_0x58e0e5);return _0x21e6e9['set'](_0xd732('0x37'),_0x229370+'-'+_0xd6a9c9+'/'+_0x4be270)['json'](_0x480177);}return null;};}function patchUpdates(_0x53fed4){return function(_0x2f4ea1){try{jsonpatch['apply'](_0x2f4ea1,_0x53fed4,!![]);}catch(_0x2d8a0b){return BPromise[_0xd732('0x38')](_0x2d8a0b);}return _0x2f4ea1[_0xd732('0x39')]();};}function saveUpdates(_0x132678,_0x17896c){return function(_0x18ad6c){if(_0x18ad6c){return _0x18ad6c['update'](_0x132678)[_0xd732('0x25')](function(_0x3db4af){return _0x3db4af;});}return null;};}function removeEntity(_0xeb16a3,_0x1678b6){return function(_0x3f5ddd){if(_0x3f5ddd){return _0x3f5ddd['destroy']()[_0xd732('0x25')](function(){var _0x20b6f4=_0x3f5ddd[_0xd732('0x3a')]({'plain':!![]});var _0x1322f1=_0xd732('0x3b');return db['UserProfileResource'][_0xd732('0x3c')]({'where':{'type':_0x1322f1,'resourceId':_0x20b6f4['id']}})[_0xd732('0x25')](function(){return _0x3f5ddd;});})[_0xd732('0x25')](function(){_0xeb16a3['status'](0xcc)[_0xd732('0x31')]();});}};}function handleEntityNotFound(_0x4fd284,_0x41f4d2){return function(_0x502ade){if(!_0x502ade){_0x4fd284[_0xd732('0x3d')](0x194);}return _0x502ade;};}function handleError(_0x286331,_0x4d07f4){_0x4d07f4=_0x4d07f4||0x1f4;return function(_0x2f1e5b){logger[_0xd732('0x2b')](_0x2f1e5b[_0xd732('0x3e')]);if(_0x2f1e5b[_0xd732('0x3f')]){delete _0x2f1e5b[_0xd732('0x3f')];}_0x286331['status'](_0x4d07f4)['send'](_0x2f1e5b);};}exports[_0xd732('0x40')]=function(_0x1f1fda,_0x46f646){var _0x3d144b={},_0x334e66={},_0x1f556c={'count':0x0,'rows':[]};var _0xf1756f=_[_0xd732('0x41')](db[_0xd732('0x42')][_0xd732('0x43')],function(_0x2b8bd7){return{'name':_0x2b8bd7['fieldName'],'type':_0x2b8bd7[_0xd732('0x44')]['key']};});_0x334e66[_0xd732('0x45')]=_[_0xd732('0x41')](_0xf1756f,_0xd732('0x3f'));_0x334e66['query']=_[_0xd732('0x46')](_0x1f1fda[_0xd732('0x47')]);_0x334e66[_0xd732('0x48')]=_['intersection'](_0x334e66['model'],_0x334e66[_0xd732('0x47')]);_0x3d144b[_0xd732('0x49')]=_[_0xd732('0x4a')](_0x334e66[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x1f1fda[_0xd732('0x47')][_0xd732('0x4b')]));_0x3d144b[_0xd732('0x49')]=_0x3d144b[_0xd732('0x49')][_0xd732('0x4c')]?_0x3d144b[_0xd732('0x49')]:_0x334e66[_0xd732('0x45')];if(!_0x1f1fda[_0xd732('0x47')][_0xd732('0x4d')](_0xd732('0x4e'))){_0x3d144b['limit']=qs[_0xd732('0x35')](_0x1f1fda['query']['limit']);_0x3d144b[_0xd732('0x33')]=qs['offset'](_0x1f1fda[_0xd732('0x47')]['offset']);}_0x3d144b[_0xd732('0x4f')]=qs['sort'](_0x1f1fda[_0xd732('0x47')]['sort']);_0x3d144b[_0xd732('0x50')]=qs[_0xd732('0x48')](_[_0xd732('0x51')](_0x1f1fda[_0xd732('0x47')],_0x334e66['filters']),_0xf1756f);if(_0x1f1fda[_0xd732('0x47')][_0xd732('0x52')]){_0x3d144b[_0xd732('0x50')]=_[_0xd732('0x53')](_0x3d144b[_0xd732('0x50')],{'$or':_[_0xd732('0x41')](_0xf1756f,function(_0x214762){if(_0x214762['type']!==_0xd732('0x54')){var _0x547065={};_0x547065[_0x214762['name']]={'$like':'%'+_0x1f1fda['query']['filter']+'%'};return _0x547065;}})});}_0x3d144b=_[_0xd732('0x53')]({},_0x3d144b,_0x1f1fda[_0xd732('0x55')]);var _0x5d6e5c={'where':_0x3d144b[_0xd732('0x50')]};return db[_0xd732('0x42')][_0xd732('0x36')](_0x5d6e5c)[_0xd732('0x25')](function(_0x5c0649){_0x1f556c['count']=_0x5c0649;if(_0x1f1fda[_0xd732('0x47')][_0xd732('0x56')]){_0x3d144b[_0xd732('0x57')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x3d144b);})[_0xd732('0x25')](function(_0x18b1ed){_0x1f556c['rows']=_0x18b1ed;return _0x1f556c;})[_0xd732('0x25')](respondWithFilteredResult(_0x46f646,_0x3d144b))[_0xd732('0x2f')](handleError(_0x46f646,null));};exports[_0xd732('0x58')]=function(_0x3c07ed,_0x2cc095){var _0x47aedd={'raw':!![],'where':{'id':_0x3c07ed[_0xd732('0x59')]['id']}},_0x190f07={};_0x190f07['model']=_[_0xd732('0x46')](db[_0xd732('0x42')][_0xd732('0x43')]);_0x190f07[_0xd732('0x47')]=_[_0xd732('0x46')](_0x3c07ed[_0xd732('0x47')]);_0x190f07[_0xd732('0x48')]=_[_0xd732('0x4a')](_0x190f07['model'],_0x190f07[_0xd732('0x47')]);_0x47aedd['attributes']=_[_0xd732('0x4a')](_0x190f07[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x3c07ed[_0xd732('0x47')][_0xd732('0x4b')]));_0x47aedd[_0xd732('0x49')]=_0x47aedd['attributes'][_0xd732('0x4c')]?_0x47aedd['attributes']:_0x190f07[_0xd732('0x45')];if(_0x3c07ed['query'][_0xd732('0x56')]){_0x47aedd['include']=[{'all':!![]}];}_0x47aedd=_[_0xd732('0x53')]({},_0x47aedd,_0x3c07ed[_0xd732('0x55')]);return db[_0xd732('0x42')]['find'](_0x47aedd)[_0xd732('0x25')](handleEntityNotFound(_0x2cc095,null))[_0xd732('0x25')](respondWithResult(_0x2cc095,null))['catch'](handleError(_0x2cc095,null));};exports['create']=function(_0x54aa66,_0x4186d9){return db[_0xd732('0x42')][_0xd732('0x5a')](_0x54aa66[_0xd732('0x5b')],{})[_0xd732('0x25')](function(_0x58a89d){var _0x35cca5=_0x54aa66[_0xd732('0x5c')][_0xd732('0x3a')]({'plain':!![]});if(!_0x35cca5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35cca5[_0xd732('0x5d')]==='user'){var _0x23bea6=_0x58a89d['get']({'plain':!![]});var _0x2ba03b=_0xd732('0x3b');return db[_0xd732('0x5e')][_0xd732('0x5f')]({'where':{'name':_0x2ba03b,'userProfileId':_0x35cca5['userProfileId']},'raw':!![]})[_0xd732('0x25')](function(_0x3ecc3a){if(_0x3ecc3a&&_0x3ecc3a[_0xd732('0x60')]===0x0){return db[_0xd732('0x61')][_0xd732('0x5a')]({'name':_0x23bea6['name'],'resourceId':_0x23bea6['id'],'type':_0x3ecc3a[_0xd732('0x3f')],'sectionId':_0x3ecc3a['id']},{})[_0xd732('0x25')](function(){return _0x58a89d;});}else{return _0x58a89d;}})['catch'](function(_0xe2017f){logger[_0xd732('0x2b')](_0xd732('0x62'),_0xe2017f);throw _0xe2017f;});}return _0x58a89d;})['then'](respondWithResult(_0x4186d9,0xc9))[_0xd732('0x2f')](handleError(_0x4186d9,null));};exports[_0xd732('0x63')]=function(_0x10bb0e,_0x1488a4){if(_0x10bb0e[_0xd732('0x5b')]['id']){delete _0x10bb0e['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x10bb0e[_0xd732('0x59')]['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x1488a4,null))[_0xd732('0x25')](saveUpdates(_0x10bb0e[_0xd732('0x5b')],null))['then'](respondWithResult(_0x1488a4,null))[_0xd732('0x2f')](handleError(_0x1488a4,null));};exports[_0xd732('0x3c')]=function(_0x201981,_0x2acaff){return db['ChatQueue'][_0xd732('0x5f')]({'where':{'id':_0x201981[_0xd732('0x59')]['id']}})['then'](handleEntityNotFound(_0x2acaff,null))[_0xd732('0x25')](removeEntity(_0x2acaff,null))[_0xd732('0x2f')](handleError(_0x2acaff,null));};exports[_0xd732('0x64')]=function(_0x434a0f,_0x27fb70){return db['ChatQueue'][_0xd732('0x64')]()[_0xd732('0x25')](respondWithResult(_0x27fb70,null))['catch'](handleError(_0x27fb70,null));};exports['getMembers']=function(_0x31a7bb,_0x3bb041,_0x1ef16c){var _0x49fcb2={'raw':!![],'where':{}},_0x19d72b={},_0x1b6629;return db[_0xd732('0x42')][_0xd732('0x65')]({'where':{'id':_0x31a7bb[_0xd732('0x59')]['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x3bb041,null))[_0xd732('0x25')](function(_0x2b4488){if(_0x2b4488){_0x1b6629=_0x2b4488[_0xd732('0x3a')]({'plain':!![]});_0x19d72b['model']=_['keys'](db[_0xd732('0x66')]['rawAttributes']);_0x19d72b[_0xd732('0x47')]=_[_0xd732('0x46')](_0x31a7bb['query']);_0x19d72b[_0xd732('0x48')]=_[_0xd732('0x4a')](_0x19d72b[_0xd732('0x45')],_0x19d72b[_0xd732('0x47')]);_0x49fcb2[_0xd732('0x49')]=_[_0xd732('0x4a')](_0x19d72b[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x31a7bb['query'][_0xd732('0x4b')]));_0x49fcb2[_0xd732('0x49')]=_0x49fcb2[_0xd732('0x49')][_0xd732('0x4c')]?_0x49fcb2[_0xd732('0x49')]:_0x19d72b[_0xd732('0x45')];if(!_0x31a7bb[_0xd732('0x47')][_0xd732('0x4d')]('nolimit')){_0x49fcb2[_0xd732('0x35')]=qs['limit'](_0x31a7bb[_0xd732('0x47')]['limit']);_0x49fcb2[_0xd732('0x33')]=qs[_0xd732('0x33')](_0x31a7bb[_0xd732('0x47')]['offset']);}_0x49fcb2['order']=qs['sort'](_0x31a7bb[_0xd732('0x47')][_0xd732('0x67')]);_0x49fcb2['where']=qs[_0xd732('0x48')](_[_0xd732('0x51')](_0x31a7bb['query'],_0x19d72b[_0xd732('0x48')]));_0x49fcb2[_0xd732('0x50')][_0xd732('0x68')]=_0x2b4488['id'];if(_0x31a7bb[_0xd732('0x47')][_0xd732('0x52')]){_0x49fcb2['where']=_[_0xd732('0x53')](_0x49fcb2[_0xd732('0x50')],{'$or':_[_0xd732('0x41')](_0x49fcb2[_0xd732('0x49')],function(_0x5a0f8b){var _0x5bb3cd={};_0x5bb3cd[_0x5a0f8b]={'$like':'%'+_0x31a7bb[_0xd732('0x47')][_0xd732('0x52')]+'%'};return _0x5bb3cd;})});}_0x49fcb2=_[_0xd732('0x53')]({},_0x49fcb2,_0x31a7bb[_0xd732('0x55')]);return db['UserChatQueue'][_0xd732('0x69')](_0x49fcb2);}})['then'](function(_0x77350e){if(_0x77350e){return db[_0xd732('0x6a')][_0xd732('0x6b')]({'where':{'id':_[_0xd732('0x41')](_0x77350e,_0xd732('0x6c')),'role':_0xd732('0x6d')},'attributes':['id',_0xd732('0x3f'),_0xd732('0x6e'),_0xd732('0x6f'),_0xd732('0x70')]});}})[_0xd732('0x25')](function(_0x395a6f){if(_0x395a6f){return{'count':_0x395a6f['count'],'rows':_[_0xd732('0x41')](_0x395a6f[_0xd732('0x71')],function(_0x209dfd){return{'membername':_0x209dfd[_0xd732('0x3f')],'UserId':_0x209dfd['id'],'queue_name':_0x1b6629[_0xd732('0x3f')],'ChatQueueId':_0x1b6629['id'],'interface':util['format'](_0xd732('0x72'),'SIP',_0x209dfd['name']),'penalty':0x0,'paused':_0x209dfd['chatPause'],'createdAt':_0x209dfd['createdAt'],'updatedAt':_0x209dfd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd732('0x25')](respondWithFilteredResult(_0x3bb041,_0x49fcb2))[_0xd732('0x2f')](handleError(_0x3bb041,null));};exports[_0xd732('0x73')]=function(_0x411061,_0x3c3c74,_0x72f456){var _0x452a08={};var _0x246713={};var _0x32c801;var _0xc66546;return db['ChatQueue'][_0xd732('0x65')]({'where':{'id':_0x411061['params']['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x3c3c74,null))['then'](function(_0x2d588d){if(_0x2d588d){_0x32c801=_0x2d588d;_0x246713['model']=_['keys'](db[_0xd732('0x74')]['rawAttributes']);_0x246713[_0xd732('0x47')]=_[_0xd732('0x46')](_0x411061[_0xd732('0x47')]);_0x246713[_0xd732('0x48')]=_['intersection'](_0x246713[_0xd732('0x45')],_0x246713[_0xd732('0x47')]);_0x452a08[_0xd732('0x49')]=_['intersection'](_0x246713['model'],qs[_0xd732('0x4b')](_0x411061['query'][_0xd732('0x4b')]));_0x452a08[_0xd732('0x49')]=_0x452a08[_0xd732('0x49')][_0xd732('0x4c')]?_0x452a08[_0xd732('0x49')]:_0x246713[_0xd732('0x45')];_0x452a08['order']=qs[_0xd732('0x67')](_0x411061[_0xd732('0x47')][_0xd732('0x67')]);_0x452a08[_0xd732('0x50')]=qs[_0xd732('0x48')](_['pick'](_0x411061[_0xd732('0x47')],_0x246713[_0xd732('0x48')]));if(_0x411061[_0xd732('0x47')][_0xd732('0x52')]){_0x452a08[_0xd732('0x50')]=_['merge'](_0x452a08['where'],{'$or':_[_0xd732('0x41')](_0x452a08['attributes'],function(_0x3c9bde){var _0x73190b={};_0x73190b[_0x3c9bde]={'$like':'%'+_0x411061[_0xd732('0x47')][_0xd732('0x52')]+'%'};return _0x73190b;})});}_0x452a08=_[_0xd732('0x53')]({},_0x452a08,_0x411061[_0xd732('0x55')]);return _0x32c801[_0xd732('0x73')](_0x452a08);}})[_0xd732('0x25')](function(_0x3401ea){if(_0x3401ea){_0xc66546=_0x3401ea['length'];if(!_0x411061[_0xd732('0x47')][_0xd732('0x4d')](_0xd732('0x4e'))){_0x452a08[_0xd732('0x35')]=qs[_0xd732('0x35')](_0x411061[_0xd732('0x47')]['limit']);_0x452a08[_0xd732('0x33')]=qs[_0xd732('0x33')](_0x411061[_0xd732('0x47')][_0xd732('0x33')]);}return _0x32c801[_0xd732('0x73')](_0x452a08);}})[_0xd732('0x25')](function(_0x2574c9){if(_0x2574c9){return _0x2574c9?{'count':_0xc66546,'rows':_0x2574c9}:null;}})[_0xd732('0x25')](respondWithResult(_0x3c3c74,null))['catch'](handleError(_0x3c3c74,null));};exports[_0xd732('0x75')]=function(_0x3ddfdc,_0x4f57e6,_0x33ffd7){var _0x33024b=_0x3ddfdc['body'][_0xd732('0x76')];return db['Team']['findAll']({'where':{'id':_0x33024b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd732('0x3f'),_0xd732('0x77'),_0xd732('0x78'),'interface'],'raw':!![]}]})[_0xd732('0x25')](function(_0x3a13cc){if(_0x3a13cc){var _0x2eb168=_[_0xd732('0x79')](_0x3a13cc,function(_0x12d005){var _0x37dd96=_0x12d005[_0xd732('0x3a')]({'plain':!![]});return _0x37dd96['Agents'];});return db[_0xd732('0x42')][_0xd732('0x5f')]({'where':{'id':_0x3ddfdc['params']['id']}})['then'](function(_0x49c2a7){return db[_0xd732('0x7a')][_0xd732('0x7b')](function(_0x28f4f8){return _0x49c2a7[_0xd732('0x75')](_0x33024b,{'transaction':_0x28f4f8})[_0xd732('0x25')](function(){return BPromise['each'](_0x2eb168,function(_0x9f4191){return db[_0xd732('0x66')][_0xd732('0x7c')]({'where':{'UserId':_0x9f4191['id'],'ChatQueueId':_0x3ddfdc[_0xd732('0x59')]['id']},'transaction':_0x28f4f8});});})[_0xd732('0x25')](function(){_0x2eb168['forEach'](function(_0x426de3){socket[_0xd732('0x7d')]('userChatQueue:save',{'UserId':_0x426de3['id'],'ChatQueueId':_0x49c2a7['id']});});});});});}})[_0xd732('0x25')](respondWithStatusCode(_0x4f57e6,null))['catch'](handleError(_0x4f57e6,null));};exports[_0xd732('0x7e')]=function(_0xb62ad8,_0x1b99b8,_0xf14c1f){return db['Team']['findAll']({'where':{'id':_0xb62ad8[_0xd732('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd732('0x6a')],'as':_0xd732('0x7f'),'attributes':['id'],'raw':!![]}]})[_0xd732('0x25')](handleEntityNotFound(_0x1b99b8,null))['then'](function(_0x33f738){var _0x3eb2a1=_[_0xd732('0x41')](_0x33f738,'id');var _0x30d68a=[];var _0x5141a7=[];var _0x26a5cd=squel[_0xd732('0x80')]();_0x26a5cd[_0xd732('0x81')](_0xd732('0x82'))[_0xd732('0x83')]('team_has_chat_queues','tq')[_0xd732('0x84')](_0xd732('0x85'),'ut',_0xd732('0x86'))[_0xd732('0x50')](_0xd732('0x87'),_0xb62ad8[_0xd732('0x59')]['id']);for(var _0xcc39f2=0x0;_0xcc39f2<_0x33f738['length'];_0xcc39f2+=0x1){let _0x5f3843=_0x33f738[_0xcc39f2];for(var _0x40f96d=0x0;_0x40f96d<_0x5f3843['Agents'][_0xd732('0x4c')];_0x40f96d+=0x1){let _0x1c8c88=_0x5f3843[_0xd732('0x7f')][_0x40f96d];var _0x24d231=_0x26a5cd[_0xd732('0x88')]();_0x24d231['where']('ut.UserId\x20=\x20?',_0x1c8c88['id']);_0x5141a7[_0xd732('0x89')](db[_0xd732('0x7a')]['query'](_0x24d231[_0xd732('0x8a')](),{'type':db[_0xd732('0x7a')][_0xd732('0x8b')]['SELECT']})['then'](function(_0x2c84be){if(_0x2c84be[_0xd732('0x4c')]===0x1){return _0x1c8c88['id'];}else{var _0x41e83f=_[_0xd732('0x8c')](_[_0xd732('0x41')](_0x2c84be,_0xd732('0x8d')),function(_0x385e12){return _[_0xd732('0x8e')](_0x3eb2a1,_0x385e12);});if(_0x41e83f){return _0x1c8c88['id'];}}}));}}return BPromise[_0xd732('0x8f')](_0x5141a7)[_0xd732('0x25')](function(_0x1adba9){_0x30d68a=_(_0x30d68a)[_0xd732('0x90')](_0x1adba9)[_0xd732('0x91')]()[_0xd732('0x92')]();return db['ChatQueue']['find']({'where':{'id':_0xb62ad8['params']['id']}})['then'](function(_0x9eae3){return db['sequelize'][_0xd732('0x7b')](function(_0x473b9c){return _0x9eae3['removeTeams'](_0xb62ad8[_0xd732('0x47')][_0xd732('0x76')],{'transaction':_0x473b9c})[_0xd732('0x25')](function(){if(!_['isEmpty'](_0x30d68a)){return _0x9eae3[_0xd732('0x93')](_0x30d68a,{'transaction':_0x473b9c});}})[_0xd732('0x25')](function(){_0x30d68a['forEach'](function(_0x34178d){socket['emit']('userChatQueue:remove',{'UserId':_0x34178d,'ChatQueueId':_0x9eae3['id']});});});});});});})[_0xd732('0x25')](respondWithStatusCode(_0x1b99b8,null))[_0xd732('0x2f')](handleError(_0x1b99b8,null));};exports[_0xd732('0x94')]=function(_0x42221e,_0x4657a4,_0x560265){return db['ChatQueue'][_0xd732('0x5f')]({'where':{'id':_0x42221e[_0xd732('0x59')]['id']}})[_0xd732('0x25')](handleEntityNotFound(_0x4657a4,null))[_0xd732('0x25')](function(_0x2fdb0a){if(_0x2fdb0a){return _0x2fdb0a[_0xd732('0x94')](_0x42221e['body']['ids'],_['omit'](_0x42221e[_0xd732('0x5b')],[_0xd732('0x76'),'id'])||{})['spread'](function(_0xc661b6){for(var _0x34e6da=0x0;_0x34e6da<_0x42221e[_0xd732('0x5b')][_0xd732('0x76')][_0xd732('0x4c')];_0x34e6da+=0x1){socket[_0xd732('0x7d')](_0xd732('0x95'),{'UserId':Number(_0x42221e[_0xd732('0x5b')][_0xd732('0x76')][_0x34e6da]),'ChatQueueId':Number(_0x42221e[_0xd732('0x59')]['id'])});}return _0xc661b6;});}})[_0xd732('0x25')](respondWithResult(_0x4657a4,null))['catch'](handleError(_0x4657a4,null));};exports['removeAgents']=function(_0x20a3dc,_0x51b4b5,_0x90128c){return db['ChatQueue'][_0xd732('0x5f')]({'where':{'id':_0x20a3dc[_0xd732('0x59')]['id']}})['then'](handleEntityNotFound(_0x51b4b5,null))[_0xd732('0x25')](function(_0x5b0eec){if(_0x5b0eec){return _0x5b0eec[_0xd732('0x93')](_0x20a3dc[_0xd732('0x47')][_0xd732('0x76')])[_0xd732('0x25')](function(){if(_[_0xd732('0x96')](_0x20a3dc[_0xd732('0x47')][_0xd732('0x76')])){for(var _0x3f257d=0x0;_0x3f257d<_0x20a3dc[_0xd732('0x47')]['ids']['length'];_0x3f257d+=0x1){socket[_0xd732('0x7d')](_0xd732('0x97'),{'UserId':Number(_0x20a3dc[_0xd732('0x47')]['ids'][_0x3f257d]),'ChatQueueId':Number(_0x20a3dc[_0xd732('0x59')]['id'])});}}else{socket[_0xd732('0x7d')](_0xd732('0x97'),{'UserId':Number(_0x20a3dc['query'][_0xd732('0x76')]),'ChatQueueId':Number(_0x20a3dc[_0xd732('0x59')]['id'])});}});}})[_0xd732('0x25')](respondWithStatusCode(_0x51b4b5,null))[_0xd732('0x2f')](handleError(_0x51b4b5,null));};exports[_0xd732('0x98')]=function(_0x5131d7,_0xe001eb,_0x3541af){var _0xdfe7d9={};var _0x58c85e={};var _0x4b7590;var _0x2a39ac;return db[_0xd732('0x42')]['findOne']({'where':{'id':_0x5131d7['params']['id']}})[_0xd732('0x25')](handleEntityNotFound(_0xe001eb,null))[_0xd732('0x25')](function(_0x3261af){if(_0x3261af){_0x4b7590=_0x3261af;_0x58c85e[_0xd732('0x45')]=_['keys'](db[_0xd732('0x6a')][_0xd732('0x43')]);_0x58c85e[_0xd732('0x47')]=_[_0xd732('0x46')](_0x5131d7['query']);_0x58c85e[_0xd732('0x48')]=_[_0xd732('0x4a')](_0x58c85e['model'],_0x58c85e[_0xd732('0x47')]);_0xdfe7d9['attributes']=_[_0xd732('0x4a')](_0x58c85e[_0xd732('0x45')],qs[_0xd732('0x4b')](_0x5131d7[_0xd732('0x47')][_0xd732('0x4b')]));_0xdfe7d9[_0xd732('0x49')]=_0xdfe7d9[_0xd732('0x49')][_0xd732('0x4c')]?_0xdfe7d9[_0xd732('0x49')]:_0x58c85e[_0xd732('0x45')];_0xdfe7d9['order']=qs[_0xd732('0x67')](_0x5131d7['query']['sort']);_0xdfe7d9['where']=qs[_0xd732('0x48')](_['pick'](_0x5131d7[_0xd732('0x47')],_0x58c85e[_0xd732('0x48')]));if(_0x5131d7[_0xd732('0x47')][_0xd732('0x52')]){_0xdfe7d9['where']=_['merge'](_0xdfe7d9[_0xd732('0x50')],{'$or':_[_0xd732('0x41')](_0xdfe7d9['attributes'],function(_0x320977){var _0x3ce90e={};_0x3ce90e[_0x320977]={'$like':'%'+_0x5131d7[_0xd732('0x47')][_0xd732('0x52')]+'%'};return _0x3ce90e;})});}_0xdfe7d9=_['merge']({},_0xdfe7d9,_0x5131d7[_0xd732('0x55')]);return _0x4b7590[_0xd732('0x98')](_0xdfe7d9);}})[_0xd732('0x25')](function(_0x4db66d){if(_0x4db66d){_0x2a39ac=_0x4db66d[_0xd732('0x4c')];if(!_0x5131d7[_0xd732('0x47')][_0xd732('0x4d')]('nolimit')){_0xdfe7d9['limit']=qs[_0xd732('0x35')](_0x5131d7[_0xd732('0x47')][_0xd732('0x35')]);_0xdfe7d9[_0xd732('0x33')]=qs[_0xd732('0x33')](_0x5131d7[_0xd732('0x47')][_0xd732('0x33')]);}return _0x4b7590[_0xd732('0x98')](_0xdfe7d9);}})[_0xd732('0x25')](function(_0x4e21a5){if(_0x4e21a5){return _0x4e21a5?{'count':_0x2a39ac,'rows':_0x4e21a5}:null;}})[_0xd732('0x25')](respondWithResult(_0xe001eb,null))[_0xd732('0x2f')](handleError(_0xe001eb,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ca094ac..3d98ee5 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 _0x79fc=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatQueue'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x79fc,0x1ad));var _0xc79f=function(_0x41e10,_0x17657d){_0x41e10=_0x41e10-0x0;var _0x4efe10=_0x79fc[_0x41e10];return _0x4efe10;};'use strict';var EventEmitter=require(_0xc79f('0x0'));var ChatQueue=require(_0xc79f('0x1'))['db'][_0xc79f('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xc79f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc79f('0x4'),'afterDestroy':_0xc79f('0x5')};function emitEvent(_0x55acc0){return function(_0x285a56,_0x492e51,_0x4036bb){ChatQueueEvents[_0xc79f('0x6')](_0x55acc0+':'+_0x285a56['id'],_0x285a56);ChatQueueEvents['emit'](_0x55acc0,_0x285a56);_0x4036bb(null);};}for(var e in events){if(events[_0xc79f('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xc79f('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xe10c=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','save','remove'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe10c,0x153));var _0xce10=function(_0x1dbff8,_0x224859){_0x1dbff8=_0x1dbff8-0x0;var _0x5b3885=_0xe10c[_0x1dbff8];return _0x5b3885;};'use strict';var EventEmitter=require(_0xce10('0x0'));var ChatQueue=require(_0xce10('0x1'))['db'][_0xce10('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce10('0x3'),'afterUpdate':'update','afterDestroy':_0xce10('0x4')};function emitEvent(_0x2295e5){return function(_0x411b5a,_0x59d1c6,_0x5d72b0){ChatQueueEvents[_0xce10('0x5')](_0x2295e5+':'+_0x411b5a['id'],_0x411b5a);ChatQueueEvents[_0xce10('0x5')](_0x2295e5,_0x411b5a);_0x5d72b0(null);};}for(var e in events){if(events[_0xce10('0x6')](e)){var event=events[e];ChatQueue[_0xce10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9030ad5..6b27e58 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 _0x9946=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x3cfaea,_0x59581c){var _0x5131f6=function(_0x57deeb){while(--_0x57deeb){_0x3cfaea['push'](_0x3cfaea['shift']());}};_0x5131f6(++_0x59581c);}(_0x9946,0xd2));var _0x6994=function(_0x3ba4dd,_0x30ad87){_0x3ba4dd=_0x3ba4dd-0x0;var _0x3e1ac8=_0x9946[_0x3ba4dd];return _0x3e1ac8;};'use strict';var _=require(_0x6994('0x0'));var util=require(_0x6994('0x1'));var logger=require(_0x6994('0x2'))(_0x6994('0x3'));var moment=require('moment');var BPromise=require(_0x6994('0x4'));var rp=require(_0x6994('0x5'));var fs=require('fs');var path=require(_0x6994('0x6'));var rimraf=require('rimraf');var config=require(_0x6994('0x7'));var attributes=require(_0x6994('0x8'));module[_0x6994('0x9')]=function(_0x591d58,_0x4d8481){return _0x591d58[_0x6994('0xa')](_0x6994('0xb'),attributes,{'tableName':_0x6994('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5be=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','util','../../config/logger'];(function(_0x264009,_0x466fe4){var _0x6de28=function(_0x34a32b){while(--_0x34a32b){_0x264009['push'](_0x264009['shift']());}};_0x6de28(++_0x466fe4);}(_0xd5be,0x1c5));var _0xed5b=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0xd5be[_0xfd495c];return _0x561dd8;};'use strict';var _=require('lodash');var util=require(_0xed5b('0x0'));var logger=require(_0xed5b('0x1'))(_0xed5b('0x2'));var moment=require(_0xed5b('0x3'));var BPromise=require(_0xed5b('0x4'));var rp=require(_0xed5b('0x5'));var fs=require('fs');var path=require(_0xed5b('0x6'));var rimraf=require(_0xed5b('0x7'));var config=require(_0xed5b('0x8'));var attributes=require('./chatQueue.attributes');module[_0xed5b('0x9')]=function(_0x43f18e,_0x3d99e1){return _0x43f18e[_0xed5b('0xa')](_0xed5b('0xb'),attributes,{'tableName':_0xed5b('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 8517193..64901f5 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 _0x6d77=['raw','where','attributes','limit','include','map','model','then','ShowChatQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetChatQueue','ChatQueue','findAll','options'];(function(_0x495339,_0x100a94){var _0x57654a=function(_0x4d6d6e){while(--_0x4d6d6e){_0x495339['push'](_0x495339['shift']());}};_0x57654a(++_0x100a94);}(_0x6d77,0x13a));var _0x76d7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6d77[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x76d7('0x0'));var util=require(_0x76d7('0x1'));var moment=require(_0x76d7('0x2'));var BPromise=require(_0x76d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76d7('0x5'));var logger=require(_0x76d7('0x6'))(_0x76d7('0x7'));var config=require(_0x76d7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x76d7('0x9')]=_['defaults'](config['redis'],{'host':_0x76d7('0xa'),'port':0x18eb});var socket=require(_0x76d7('0xb'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x76d7('0xc')](socket);function respondWithRpcPromise(_0x4b5740,_0x1a258d,_0x3b58ec){return new BPromise(function(_0x57a821,_0x1bf80d){return client[_0x76d7('0xd')](_0x4b5740,_0x3b58ec)['then'](function(_0x54322b){logger[_0x76d7('0xe')](_0x76d7('0xf'),_0x1a258d,_0x76d7('0x10'));logger[_0x76d7('0x11')](_0x76d7('0x12'),_0x1a258d,_0x76d7('0x10'),JSON[_0x76d7('0x13')](_0x54322b));if(_0x54322b['error']){if(_0x54322b['error'][_0x76d7('0x14')]===0x1f4){logger[_0x76d7('0x15')](_0x76d7('0xf'),_0x1a258d,_0x54322b[_0x76d7('0x15')][_0x76d7('0x16')]);return _0x1bf80d(_0x54322b['error'][_0x76d7('0x16')]);}logger['error'](_0x76d7('0xf'),_0x1a258d,_0x54322b['error'][_0x76d7('0x16')]);return _0x57a821(_0x54322b['error'][_0x76d7('0x16')]);}else{logger['info'](_0x76d7('0xf'),_0x1a258d,_0x76d7('0x10'));_0x57a821(_0x54322b['result'][_0x76d7('0x16')]);}})[_0x76d7('0x17')](function(_0xa7e75d){logger[_0x76d7('0x15')]('ChatQueue,\x20%s,\x20%s',_0x1a258d,_0xa7e75d);_0x1bf80d(_0xa7e75d);});});}exports[_0x76d7('0x18')]=function(_0x1fed23){var _0x4f966a=this;return new Promise(function(_0x57ec55,_0x54295d){return db[_0x76d7('0x19')][_0x76d7('0x1a')]({'raw':_0x1fed23[_0x76d7('0x1b')]?_0x1fed23[_0x76d7('0x1b')][_0x76d7('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fed23[_0x76d7('0x1b')]?_0x1fed23['options'][_0x76d7('0x1d')]||null:null,'attributes':_0x1fed23['options']?_0x1fed23[_0x76d7('0x1b')][_0x76d7('0x1e')]||null:null,'limit':_0x1fed23['options']?_0x1fed23['options'][_0x76d7('0x1f')]||null:null,'include':_0x1fed23[_0x76d7('0x1b')]?_0x1fed23[_0x76d7('0x1b')][_0x76d7('0x20')]?_[_0x76d7('0x21')](_0x1fed23[_0x76d7('0x1b')][_0x76d7('0x20')],function(_0x1de80d){return{'model':db[_0x1de80d[_0x76d7('0x22')]],'as':_0x1de80d['as'],'attributes':_0x1de80d[_0x76d7('0x1e')],'include':_0x1de80d[_0x76d7('0x20')]?_[_0x76d7('0x21')](_0x1de80d[_0x76d7('0x20')],function(_0x23604e){return{'model':db[_0x23604e[_0x76d7('0x22')]],'as':_0x23604e['as'],'attributes':_0x23604e[_0x76d7('0x1e')],'include':_0x23604e['include']?_['map'](_0x23604e['include'],function(_0x228a48){return{'model':db[_0x228a48[_0x76d7('0x22')]],'as':_0x228a48['as'],'attributes':_0x228a48[_0x76d7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76d7('0x23')](function(_0x5916b0){logger[_0x76d7('0xe')](_0x76d7('0x18'),_0x1fed23);logger['debug'](_0x76d7('0x18'),_0x1fed23,JSON[_0x76d7('0x13')](_0x5916b0));_0x57ec55(_0x5916b0);})[_0x76d7('0x17')](function(_0xea025d){logger[_0x76d7('0x15')](_0x76d7('0x18'),_0xea025d['message'],_0x1fed23);_0x54295d(_0x4f966a[_0x76d7('0x15')](0x1f4,_0xea025d[_0x76d7('0x16')]));});});};exports[_0x76d7('0x24')]=function(_0x279e78){var _0x4e7dbe=this;return new Promise(function(_0x160fe3,_0x3f6a6e){return db[_0x76d7('0x19')][_0x76d7('0x25')]({'raw':_0x279e78[_0x76d7('0x1b')]?_0x279e78[_0x76d7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x279e78['options']?_0x279e78['options'][_0x76d7('0x1d')]||null:null,'attributes':_0x279e78[_0x76d7('0x1b')]?_0x279e78[_0x76d7('0x1b')][_0x76d7('0x1e')]||null:null,'include':_0x279e78['options']?_0x279e78['options'][_0x76d7('0x20')]?_[_0x76d7('0x21')](_0x279e78[_0x76d7('0x1b')]['include'],function(_0xc83f55){return{'model':db[_0xc83f55['model']],'as':_0xc83f55['as'],'attributes':_0xc83f55[_0x76d7('0x1e')],'include':_0xc83f55['include']?_['map'](_0xc83f55[_0x76d7('0x20')],function(_0x2c7fa4){return{'model':db[_0x2c7fa4[_0x76d7('0x22')]],'as':_0x2c7fa4['as'],'attributes':_0x2c7fa4[_0x76d7('0x1e')],'include':_0x2c7fa4[_0x76d7('0x20')]?_[_0x76d7('0x21')](_0x2c7fa4[_0x76d7('0x20')],function(_0x115aec){return{'model':db[_0x115aec['model']],'as':_0x115aec['as'],'attributes':_0x115aec[_0x76d7('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5db90c){logger[_0x76d7('0xe')](_0x76d7('0x24'),_0x279e78);logger['debug'](_0x76d7('0x24'),_0x279e78,JSON['stringify'](_0x5db90c));_0x160fe3(_0x5db90c);})['catch'](function(_0x5dbe20){logger['error'](_0x76d7('0x24'),_0x5dbe20['message'],_0x279e78);_0x3f6a6e(_0x4e7dbe[_0x76d7('0x15')](0x1f4,_0x5dbe20[_0x76d7('0x16')]));});});}; \ No newline at end of file +var _0x51d7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetChatQueue','stringify','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x579aeb,_0x5c1bb0){var _0x769607=function(_0x21bf40){while(--_0x21bf40){_0x579aeb['push'](_0x579aeb['shift']());}};_0x769607(++_0x5c1bb0);}(_0x51d7,0xcf));var _0x751d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x51d7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x751d('0x0'));var util=require(_0x751d('0x1'));var moment=require(_0x751d('0x2'));var BPromise=require(_0x751d('0x3'));var rs=require(_0x751d('0x4'));var fs=require('fs');var Redis=require(_0x751d('0x5'));var db=require(_0x751d('0x6'))['db'];var utils=require(_0x751d('0x7'));var logger=require(_0x751d('0x8'))(_0x751d('0x9'));var config=require(_0x751d('0xa'));var jayson=require(_0x751d('0xb'));var client=jayson[_0x751d('0xc')][_0x751d('0xd')]({'port':0x232a});config[_0x751d('0xe')]=_[_0x751d('0xf')](config[_0x751d('0xe')],{'host':_0x751d('0x10'),'port':0x18eb});var socket=require(_0x751d('0x11'))(new Redis(config[_0x751d('0xe')]));require(_0x751d('0x12'))[_0x751d('0x13')](socket);function respondWithRpcPromise(_0x3bb87a,_0x10cce6,_0x3b712a){return new BPromise(function(_0x2ab84c,_0x47e380){return client[_0x751d('0x14')](_0x3bb87a,_0x3b712a)[_0x751d('0x15')](function(_0x2c6e5d){logger[_0x751d('0x16')](_0x751d('0x17'),_0x10cce6,'request\x20sent');logger[_0x751d('0x18')](_0x751d('0x19'),_0x10cce6,_0x751d('0x1a'),JSON['stringify'](_0x2c6e5d));if(_0x2c6e5d[_0x751d('0x1b')]){if(_0x2c6e5d['error'][_0x751d('0x1c')]===0x1f4){logger[_0x751d('0x1b')]('ChatQueue,\x20%s,\x20%s',_0x10cce6,_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);return _0x47e380(_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);}logger['error'](_0x751d('0x17'),_0x10cce6,_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);return _0x2ab84c(_0x2c6e5d[_0x751d('0x1b')][_0x751d('0x1d')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x10cce6,_0x751d('0x1a'));_0x2ab84c(_0x2c6e5d[_0x751d('0x1e')]['message']);}})[_0x751d('0x1f')](function(_0x3272b1){logger[_0x751d('0x1b')](_0x751d('0x17'),_0x10cce6,_0x3272b1);_0x47e380(_0x3272b1);});});}exports['GetChatQueue']=function(_0x2ecc9f){var _0x445289=this;return new Promise(function(_0x11a825,_0x13a062){return db['ChatQueue'][_0x751d('0x20')]({'raw':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')][_0x751d('0x22')]===undefined?!![]:![]:!![],'where':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')][_0x751d('0x23')]||null:null,'attributes':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')][_0x751d('0x24')]||null:null,'limit':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f[_0x751d('0x21')]['limit']||null:null,'include':_0x2ecc9f[_0x751d('0x21')]?_0x2ecc9f['options'][_0x751d('0x25')]?_[_0x751d('0x26')](_0x2ecc9f[_0x751d('0x21')][_0x751d('0x25')],function(_0x31882e){return{'model':db[_0x31882e[_0x751d('0x27')]],'as':_0x31882e['as'],'attributes':_0x31882e[_0x751d('0x24')],'include':_0x31882e[_0x751d('0x25')]?_['map'](_0x31882e['include'],function(_0x278015){return{'model':db[_0x278015[_0x751d('0x27')]],'as':_0x278015['as'],'attributes':_0x278015[_0x751d('0x24')],'include':_0x278015[_0x751d('0x25')]?_[_0x751d('0x26')](_0x278015[_0x751d('0x25')],function(_0x2acfea){return{'model':db[_0x2acfea[_0x751d('0x27')]],'as':_0x2acfea['as'],'attributes':_0x2acfea[_0x751d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x751d('0x15')](function(_0x105224){logger['info'](_0x751d('0x28'),_0x2ecc9f);logger[_0x751d('0x18')](_0x751d('0x28'),_0x2ecc9f,JSON[_0x751d('0x29')](_0x105224));_0x11a825(_0x105224);})['catch'](function(_0x531890){logger[_0x751d('0x1b')](_0x751d('0x28'),_0x531890[_0x751d('0x1d')],_0x2ecc9f);_0x13a062(_0x445289[_0x751d('0x1b')](0x1f4,_0x531890[_0x751d('0x1d')]));});});};exports[_0x751d('0x2a')]=function(_0x2ffbfc){var _0x380028=this;return new Promise(function(_0x2dbd70,_0x34d92d){return db['ChatQueue']['find']({'raw':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc['options'][_0x751d('0x22')]===undefined?!![]:![]:!![],'where':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc[_0x751d('0x21')][_0x751d('0x23')]||null:null,'attributes':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc[_0x751d('0x21')][_0x751d('0x24')]||null:null,'include':_0x2ffbfc[_0x751d('0x21')]?_0x2ffbfc[_0x751d('0x21')][_0x751d('0x25')]?_['map'](_0x2ffbfc[_0x751d('0x21')][_0x751d('0x25')],function(_0x5c7d67){return{'model':db[_0x5c7d67['model']],'as':_0x5c7d67['as'],'attributes':_0x5c7d67[_0x751d('0x24')],'include':_0x5c7d67[_0x751d('0x25')]?_[_0x751d('0x26')](_0x5c7d67['include'],function(_0x94c096){return{'model':db[_0x94c096[_0x751d('0x27')]],'as':_0x94c096['as'],'attributes':_0x94c096[_0x751d('0x24')],'include':_0x94c096['include']?_['map'](_0x94c096['include'],function(_0x522a8d){return{'model':db[_0x522a8d[_0x751d('0x27')]],'as':_0x522a8d['as'],'attributes':_0x522a8d[_0x751d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x751d('0x15')](function(_0x2bbf65){logger[_0x751d('0x16')](_0x751d('0x2a'),_0x2ffbfc);logger[_0x751d('0x18')](_0x751d('0x2a'),_0x2ffbfc,JSON[_0x751d('0x29')](_0x2bbf65));_0x2dbd70(_0x2bbf65);})[_0x751d('0x1f')](function(_0x4ce32d){logger[_0x751d('0x1b')](_0x751d('0x2a'),_0x4ce32d['message'],_0x2ffbfc);_0x34d92d(_0x380028[_0x751d('0x1b')](0x1f4,_0x4ce32d[_0x751d('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8f209f9..7fe0400 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(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb903,0x185));var _0x3b90=function(_0xf2579a,_0x25ca0e){_0xf2579a=_0xf2579a-0x0;var _0x3c0dae=_0xb903[_0xf2579a];return _0x3c0dae;};'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 _0x68fc=['emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0x68fc,0xa5));var _0xc68f=function(_0x3dca1e,_0x1161b8){_0x3dca1e=_0x3dca1e-0x0;var _0x3b10d2=_0x68fc[_0x3dca1e];return _0x3b10d2;};'use strict';var ChatQueueEvents=require(_0xc68f('0x0'));var events=[_0xc68f('0x1'),_0xc68f('0x2'),'update'];function createListener(_0x49aa95,_0x26513f){return function(_0x506fb5){_0x26513f[_0xc68f('0x3')](_0x49aa95,_0x506fb5);};}function removeListener(_0x593648,_0x5899ea){return function(){ChatQueueEvents[_0xc68f('0x4')](_0x593648,_0x5899ea);};}exports[_0xc68f('0x5')]=function(_0x1c6df9){for(var _0x363cdf=0x0,_0x4fcce4=events['length'];_0x363cdf<_0x4fcce4;_0x363cdf++){var _0x9f2705=events[_0x363cdf];var _0x2bf3fd=createListener(_0xc68f('0x6')+_0x9f2705,_0x1c6df9);ChatQueueEvents['on'](_0x9f2705,_0x2bf3fd);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 57f1174..8b7a8fb 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x316606,_0x189791){var _0x1288e7=function(_0x12c123){while(--_0x12c123){_0x316606['push'](_0x316606['shift']());}};_0x1288e7(++_0x189791);}(_0x008c,0x188));var _0xc008=function(_0x3df1c2,_0x1d32db){_0x3df1c2=_0x3df1c2-0x0;var _0x70d3e8=_0x008c[_0x3df1c2];return _0x70d3e8;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29ce77,_0x2c60a2){var _0x4d6d31=function(_0x3e8668){while(--_0x3e8668){_0x29ce77['push'](_0x29ce77['shift']());}};_0x4d6d31(++_0x2c60a2);}(_0x008c,0x188));var _0xc008=function(_0x5f035f,_0x5300d1){_0x5f035f=_0x5f035f-0x0;var _0xad281e=_0x008c[_0x5f035f];return _0xad281e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);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 6a1e46b..6d3bb93 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 _0xd84d=['DATE','moment','exports','STRING'];(function(_0x4f41e9,_0x485797){var _0x3b8ccb=function(_0x3cd88b){while(--_0x3cd88b){_0x4f41e9['push'](_0x4f41e9['shift']());}};_0x3b8ccb(++_0x485797);}(_0xd84d,0x69));var _0xdd84=function(_0x14d107,_0x2baa21){_0x14d107=_0x14d107-0x0;var _0x5b73b3=_0xd84d[_0x14d107];return _0x5b73b3;};'use strict';var moment=require(_0xdd84('0x0'));var Sequelize=require('sequelize');module[_0xdd84('0x1')]={'uniqueid':{'type':Sequelize[_0xdd84('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdd84('0x2')]},'joinAt':{'type':Sequelize[_0xdd84('0x3')]},'leaveAt':{'type':Sequelize[_0xdd84('0x3')]},'acceptAt':{'type':Sequelize[_0xdd84('0x3')]},'exitAt':{'type':Sequelize[_0xdd84('0x3')]},'reason':{'type':Sequelize[_0xdd84('0x2')]}}; \ No newline at end of file +var _0x4986=['moment','sequelize','exports','DATE','STRING'];(function(_0x4ec7d2,_0x509e4e){var _0x2ed1ff=function(_0x36582c){while(--_0x36582c){_0x4ec7d2['push'](_0x4ec7d2['shift']());}};_0x2ed1ff(++_0x509e4e);}(_0x4986,0x6e));var _0x6498=function(_0x3ecc23,_0x1b1b15){_0x3ecc23=_0x3ecc23-0x0;var _0x54500b=_0x4986[_0x3ecc23];return _0x54500b;};'use strict';var moment=require(_0x6498('0x0'));var Sequelize=require(_0x6498('0x1'));module[_0x6498('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6498('0x3')]},'leaveAt':{'type':Sequelize[_0x6498('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6498('0x3')]},'reason':{'type':Sequelize[_0x6498('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index ef7c91a..419a431 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 _0x8af6=['then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','findAll','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x4cd080,_0x1d04e2){var _0x12ce45=function(_0x144f25){while(--_0x144f25){_0x4cd080['push'](_0x4cd080['shift']());}};_0x12ce45(++_0x1d04e2);}(_0x8af6,0x76));var _0x68af=function(_0x4c3c9a,_0x127439){_0x4c3c9a=_0x4c3c9a-0x0;var _0x428077=_0x8af6[_0x4c3c9a];return _0x428077;};'use strict';var emlformat=require(_0x68af('0x0'));var rimraf=require(_0x68af('0x1'));var zipdir=require(_0x68af('0x2'));var jsonpatch=require(_0x68af('0x3'));var rp=require(_0x68af('0x4'));var moment=require(_0x68af('0x5'));var BPromise=require(_0x68af('0x6'));var Mustache=require(_0x68af('0x7'));var util=require(_0x68af('0x8'));var path=require(_0x68af('0x9'));var sox=require('sox');var csv=require(_0x68af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68af('0xb'));var _=require(_0x68af('0xc'));var squel=require(_0x68af('0xd'));var crypto=require(_0x68af('0xe'));var jsforce=require(_0x68af('0xf'));var deskjs=require(_0x68af('0x10'));var toCsv=require(_0x68af('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68af('0x11'));var authService=require(_0x68af('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68af('0x13'));var hardwareService=require(_0x68af('0x14'));var logger=require(_0x68af('0x15'))(_0x68af('0x16'));var utils=require(_0x68af('0x17'));var config=require(_0x68af('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b66bc,_0x48a21d){_0x48a21d=_0x48a21d||0xcc;return function(_0x5cfc81){if(_0x5cfc81){return _0x2b66bc[_0x68af('0x19')](_0x48a21d);}return _0x2b66bc[_0x68af('0x1a')](_0x48a21d)[_0x68af('0x1b')]();};}function respondWithResult(_0x5d8a97,_0x1ab12a){_0x1ab12a=_0x1ab12a||0xc8;return function(_0x50f1ea){if(_0x50f1ea){return _0x5d8a97[_0x68af('0x1a')](_0x1ab12a)[_0x68af('0x1c')](_0x50f1ea);}};}function respondWithFilteredResult(_0x23fc49,_0x2e7e1e){return function(_0x45c41c){if(_0x45c41c){var _0x58764e=typeof _0x2e7e1e[_0x68af('0x1d')]===_0x68af('0x1e')&&typeof _0x2e7e1e[_0x68af('0x1f')]===_0x68af('0x1e');var _0x59d7f3=_0x45c41c['count'];var _0x3aa998=_0x58764e?0x0:_0x2e7e1e[_0x68af('0x1d')];var _0x4e1c41=_0x58764e?_0x45c41c[_0x68af('0x20')]:_0x2e7e1e[_0x68af('0x1d')]+_0x2e7e1e[_0x68af('0x1f')];var _0x1a82f0;if(_0x4e1c41>=_0x59d7f3){_0x4e1c41=_0x59d7f3;_0x1a82f0=0xc8;}else{_0x1a82f0=0xce;}_0x23fc49['status'](_0x1a82f0);return _0x23fc49[_0x68af('0x21')](_0x68af('0x22'),_0x3aa998+'-'+_0x4e1c41+'/'+_0x59d7f3)['json'](_0x45c41c);}return null;};}function patchUpdates(_0x5ad458){return function(_0x257545){try{jsonpatch[_0x68af('0x23')](_0x257545,_0x5ad458,!![]);}catch(_0x14b930){return BPromise[_0x68af('0x24')](_0x14b930);}return _0x257545[_0x68af('0x25')]();};}function saveUpdates(_0x34906b,_0x484fac){return function(_0x25a210){if(_0x25a210){return _0x25a210[_0x68af('0x26')](_0x34906b)['then'](function(_0x3ebd57){return _0x3ebd57;});}return null;};}function removeEntity(_0x539bc0,_0x13af7b){return function(_0x1f0d0e){if(_0x1f0d0e){return _0x1f0d0e[_0x68af('0x27')]()[_0x68af('0x28')](function(){_0x539bc0[_0x68af('0x1a')](0xcc)[_0x68af('0x1b')]();});}};}function handleEntityNotFound(_0x5851b9,_0x514ebc){return function(_0x29f003){if(!_0x29f003){_0x5851b9[_0x68af('0x19')](0x194);}return _0x29f003;};}function handleError(_0x351909,_0x1651de){_0x1651de=_0x1651de||0x1f4;return function(_0x375d38){logger[_0x68af('0x29')](_0x375d38[_0x68af('0x2a')]);if(_0x375d38[_0x68af('0x2b')]){delete _0x375d38['name'];}_0x351909[_0x68af('0x1a')](_0x1651de)[_0x68af('0x2c')](_0x375d38);};}exports[_0x68af('0x2d')]=function(_0x3d1303,_0x4c3b67){var _0x524310={},_0x128d5d={},_0x22f1c7={'count':0x0,'rows':[]};var _0x1cb7c5=_['map'](db['ChatQueueReport'][_0x68af('0x2e')],function(_0x135dc1){return{'name':_0x135dc1['fieldName'],'type':_0x135dc1[_0x68af('0x2f')][_0x68af('0x30')]};});_0x128d5d[_0x68af('0x31')]=_[_0x68af('0x32')](_0x1cb7c5,_0x68af('0x2b'));_0x128d5d[_0x68af('0x33')]=_[_0x68af('0x34')](_0x3d1303['query']);_0x128d5d[_0x68af('0x35')]=_[_0x68af('0x36')](_0x128d5d[_0x68af('0x31')],_0x128d5d['query']);_0x524310[_0x68af('0x37')]=_[_0x68af('0x36')](_0x128d5d['model'],qs[_0x68af('0x38')](_0x3d1303[_0x68af('0x33')]['fields']));_0x524310[_0x68af('0x37')]=_0x524310['attributes']['length']?_0x524310[_0x68af('0x37')]:_0x128d5d[_0x68af('0x31')];if(!_0x3d1303[_0x68af('0x33')][_0x68af('0x39')](_0x68af('0x3a'))){_0x524310[_0x68af('0x1f')]=qs['limit'](_0x3d1303['query']['limit']);_0x524310[_0x68af('0x1d')]=qs[_0x68af('0x1d')](_0x3d1303['query'][_0x68af('0x1d')]);}_0x524310[_0x68af('0x3b')]=qs[_0x68af('0x3c')](_0x3d1303['query'][_0x68af('0x3c')]);_0x524310[_0x68af('0x3d')]=qs[_0x68af('0x35')](_[_0x68af('0x3e')](_0x3d1303[_0x68af('0x33')],_0x128d5d['filters']),_0x1cb7c5);if(_0x3d1303[_0x68af('0x33')][_0x68af('0x3f')]){_0x524310[_0x68af('0x3d')]=_[_0x68af('0x40')](_0x524310[_0x68af('0x3d')],{'$or':_[_0x68af('0x32')](_0x1cb7c5,function(_0x1b4096){if(_0x1b4096[_0x68af('0x2f')]!==_0x68af('0x41')){var _0x3110c4={};_0x3110c4[_0x1b4096['name']]={'$like':'%'+_0x3d1303[_0x68af('0x33')][_0x68af('0x3f')]+'%'};return _0x3110c4;}})});}_0x524310=_['merge']({},_0x524310,_0x3d1303[_0x68af('0x42')]);var _0xfc32e8={'where':_0x524310[_0x68af('0x3d')]};return db[_0x68af('0x43')][_0x68af('0x20')](_0xfc32e8)['then'](function(_0x509177){_0x22f1c7['count']=_0x509177;if(_0x3d1303[_0x68af('0x33')][_0x68af('0x44')]){_0x524310['include']=[{'all':!![]}];}return db[_0x68af('0x43')][_0x68af('0x45')](_0x524310);})[_0x68af('0x28')](function(_0x3bb630){_0x22f1c7['rows']=_0x3bb630;return _0x22f1c7;})[_0x68af('0x28')](respondWithFilteredResult(_0x4c3b67,_0x524310))[_0x68af('0x46')](handleError(_0x4c3b67,null));};exports[_0x68af('0x47')]=function(_0x1f477b,_0x356567){var _0x3b5f44={'raw':!![],'where':{'id':_0x1f477b[_0x68af('0x48')]['id']}},_0x3b0953={};_0x3b0953[_0x68af('0x31')]=_[_0x68af('0x34')](db['ChatQueueReport']['rawAttributes']);_0x3b0953[_0x68af('0x33')]=_[_0x68af('0x34')](_0x1f477b[_0x68af('0x33')]);_0x3b0953[_0x68af('0x35')]=_[_0x68af('0x36')](_0x3b0953['model'],_0x3b0953[_0x68af('0x33')]);_0x3b5f44[_0x68af('0x37')]=_[_0x68af('0x36')](_0x3b0953['model'],qs[_0x68af('0x38')](_0x1f477b[_0x68af('0x33')][_0x68af('0x38')]));_0x3b5f44[_0x68af('0x37')]=_0x3b5f44[_0x68af('0x37')][_0x68af('0x49')]?_0x3b5f44[_0x68af('0x37')]:_0x3b0953['model'];if(_0x1f477b[_0x68af('0x33')][_0x68af('0x44')]){_0x3b5f44[_0x68af('0x4a')]=[{'all':!![]}];}_0x3b5f44=_[_0x68af('0x40')]({},_0x3b5f44,_0x1f477b['options']);return db[_0x68af('0x43')][_0x68af('0x4b')](_0x3b5f44)['then'](handleEntityNotFound(_0x356567,null))[_0x68af('0x28')](respondWithResult(_0x356567,null))['catch'](handleError(_0x356567,null));};exports[_0x68af('0x4c')]=function(_0x5bab92,_0xbec158){return db[_0x68af('0x43')][_0x68af('0x4c')](_0x5bab92[_0x68af('0x4d')],{})[_0x68af('0x28')](respondWithResult(_0xbec158,0xc9))[_0x68af('0x46')](handleError(_0xbec158,null));};exports[_0x68af('0x26')]=function(_0x3b43a6,_0x3544d5){if(_0x3b43a6[_0x68af('0x4d')]['id']){delete _0x3b43a6[_0x68af('0x4d')]['id'];}return db[_0x68af('0x43')]['find']({'where':{'id':_0x3b43a6[_0x68af('0x48')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x3544d5,null))['then'](saveUpdates(_0x3b43a6[_0x68af('0x4d')],null))[_0x68af('0x28')](respondWithResult(_0x3544d5,null))[_0x68af('0x46')](handleError(_0x3544d5,null));};exports['destroy']=function(_0x18bbc0,_0x1c6c50){return db[_0x68af('0x43')][_0x68af('0x4b')]({'where':{'id':_0x18bbc0[_0x68af('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c6c50,null))[_0x68af('0x28')](removeEntity(_0x1c6c50,null))[_0x68af('0x46')](handleError(_0x1c6c50,null));};exports[_0x68af('0x4e')]=function(_0x460d29,_0x2442ef){return db[_0x68af('0x43')][_0x68af('0x4e')]()[_0x68af('0x28')](respondWithResult(_0x2442ef,null))[_0x68af('0x46')](handleError(_0x2442ef,null));}; \ No newline at end of file +var _0x084b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','fields','include','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0xd09502,_0x493218){var _0x8fcf6e=function(_0x32ee03){while(--_0x32ee03){_0xd09502['push'](_0xd09502['shift']());}};_0x8fcf6e(++_0x493218);}(_0x084b,0xd5));var _0xb084=function(_0x512506,_0x4e22ca){_0x512506=_0x512506-0x0;var _0x19c580=_0x084b[_0x512506];return _0x19c580;};'use strict';var emlformat=require(_0xb084('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb084('0x1'));var moment=require(_0xb084('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb084('0x3'));var util=require(_0xb084('0x4'));var path=require(_0xb084('0x5'));var sox=require('sox');var csv=require(_0xb084('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb084('0x7'));var _=require(_0xb084('0x8'));var squel=require(_0xb084('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb084('0xa'));var toCsv=require(_0xb084('0x6'));var querystring=require(_0xb084('0xb'));var Papa=require(_0xb084('0xc'));var Redis=require(_0xb084('0xd'));var authService=require(_0xb084('0xe'));var qs=require(_0xb084('0xf'));var as=require(_0xb084('0x10'));var hardwareService=require(_0xb084('0x11'));var logger=require(_0xb084('0x12'))(_0xb084('0x13'));var utils=require(_0xb084('0x14'));var config=require(_0xb084('0x15'));var licenseUtil=require(_0xb084('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51aee2,_0x3582a0){_0x3582a0=_0x3582a0||0xcc;return function(_0x514829){if(_0x514829){return _0x51aee2['sendStatus'](_0x3582a0);}return _0x51aee2[_0xb084('0x17')](_0x3582a0)[_0xb084('0x18')]();};}function respondWithResult(_0x5bae3a,_0x4da0fb){_0x4da0fb=_0x4da0fb||0xc8;return function(_0x44be03){if(_0x44be03){return _0x5bae3a[_0xb084('0x17')](_0x4da0fb)[_0xb084('0x19')](_0x44be03);}};}function respondWithFilteredResult(_0x28ad2d,_0xc6df71){return function(_0x5a5d11){if(_0x5a5d11){var _0x240838=typeof _0xc6df71[_0xb084('0x1a')]===_0xb084('0x1b')&&typeof _0xc6df71[_0xb084('0x1c')]===_0xb084('0x1b');var _0x2cce88=_0x5a5d11[_0xb084('0x1d')];var _0x42657a=_0x240838?0x0:_0xc6df71[_0xb084('0x1a')];var _0x19d426=_0x240838?_0x5a5d11['count']:_0xc6df71['offset']+_0xc6df71['limit'];var _0x5b076b;if(_0x19d426>=_0x2cce88){_0x19d426=_0x2cce88;_0x5b076b=0xc8;}else{_0x5b076b=0xce;}_0x28ad2d[_0xb084('0x17')](_0x5b076b);return _0x28ad2d['set'](_0xb084('0x1e'),_0x42657a+'-'+_0x19d426+'/'+_0x2cce88)[_0xb084('0x19')](_0x5a5d11);}return null;};}function patchUpdates(_0x228ef1){return function(_0x2e8789){try{jsonpatch[_0xb084('0x1f')](_0x2e8789,_0x228ef1,!![]);}catch(_0x434690){return BPromise[_0xb084('0x20')](_0x434690);}return _0x2e8789[_0xb084('0x21')]();};}function saveUpdates(_0x517dc0,_0x5dfc7f){return function(_0x171dd5){if(_0x171dd5){return _0x171dd5[_0xb084('0x22')](_0x517dc0)[_0xb084('0x23')](function(_0x28d074){return _0x28d074;});}return null;};}function removeEntity(_0x5dced1,_0x4795d9){return function(_0x3ef50e){if(_0x3ef50e){return _0x3ef50e[_0xb084('0x24')]()['then'](function(){_0x5dced1[_0xb084('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4983,_0x22059f){return function(_0x5d9314){if(!_0x5d9314){_0x1f4983[_0xb084('0x25')](0x194);}return _0x5d9314;};}function handleError(_0x3d467e,_0x1ecb58){_0x1ecb58=_0x1ecb58||0x1f4;return function(_0x4ce54c){logger[_0xb084('0x26')](_0x4ce54c['stack']);if(_0x4ce54c[_0xb084('0x27')]){delete _0x4ce54c[_0xb084('0x27')];}_0x3d467e['status'](_0x1ecb58)[_0xb084('0x28')](_0x4ce54c);};}exports[_0xb084('0x29')]=function(_0x49cbd6,_0x4587e7){var _0x1a7726={},_0x57406f={},_0x1ad27b={'count':0x0,'rows':[]};var _0x2795cf=_['map'](db[_0xb084('0x2a')][_0xb084('0x2b')],function(_0x330a35){return{'name':_0x330a35[_0xb084('0x2c')],'type':_0x330a35[_0xb084('0x2d')]['key']};});_0x57406f[_0xb084('0x2e')]=_[_0xb084('0x2f')](_0x2795cf,_0xb084('0x27'));_0x57406f[_0xb084('0x30')]=_['keys'](_0x49cbd6[_0xb084('0x30')]);_0x57406f[_0xb084('0x31')]=_[_0xb084('0x32')](_0x57406f[_0xb084('0x2e')],_0x57406f[_0xb084('0x30')]);_0x1a7726['attributes']=_['intersection'](_0x57406f[_0xb084('0x2e')],qs['fields'](_0x49cbd6[_0xb084('0x30')]['fields']));_0x1a7726[_0xb084('0x33')]=_0x1a7726[_0xb084('0x33')][_0xb084('0x34')]?_0x1a7726[_0xb084('0x33')]:_0x57406f['model'];if(!_0x49cbd6[_0xb084('0x30')][_0xb084('0x35')](_0xb084('0x36'))){_0x1a7726[_0xb084('0x1c')]=qs[_0xb084('0x1c')](_0x49cbd6['query'][_0xb084('0x1c')]);_0x1a7726[_0xb084('0x1a')]=qs['offset'](_0x49cbd6['query'][_0xb084('0x1a')]);}_0x1a7726[_0xb084('0x37')]=qs[_0xb084('0x38')](_0x49cbd6[_0xb084('0x30')][_0xb084('0x38')]);_0x1a7726[_0xb084('0x39')]=qs[_0xb084('0x31')](_[_0xb084('0x3a')](_0x49cbd6['query'],_0x57406f[_0xb084('0x31')]),_0x2795cf);if(_0x49cbd6[_0xb084('0x30')]['filter']){_0x1a7726[_0xb084('0x39')]=_['merge'](_0x1a7726[_0xb084('0x39')],{'$or':_[_0xb084('0x2f')](_0x2795cf,function(_0xad9187){if(_0xad9187[_0xb084('0x2d')]!==_0xb084('0x3b')){var _0x2254a3={};_0x2254a3[_0xad9187[_0xb084('0x27')]]={'$like':'%'+_0x49cbd6[_0xb084('0x30')][_0xb084('0x3c')]+'%'};return _0x2254a3;}})});}_0x1a7726=_[_0xb084('0x3d')]({},_0x1a7726,_0x49cbd6[_0xb084('0x3e')]);var _0x77b2cc={'where':_0x1a7726[_0xb084('0x39')]};return db[_0xb084('0x2a')][_0xb084('0x1d')](_0x77b2cc)[_0xb084('0x23')](function(_0x584b34){_0x1ad27b['count']=_0x584b34;if(_0x49cbd6[_0xb084('0x30')][_0xb084('0x3f')]){_0x1a7726['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xb084('0x40')](_0x1a7726);})[_0xb084('0x23')](function(_0x1de365){_0x1ad27b['rows']=_0x1de365;return _0x1ad27b;})[_0xb084('0x23')](respondWithFilteredResult(_0x4587e7,_0x1a7726))[_0xb084('0x41')](handleError(_0x4587e7,null));};exports[_0xb084('0x42')]=function(_0x526c47,_0xc63ca9){var _0x13b059={'raw':!![],'where':{'id':_0x526c47[_0xb084('0x43')]['id']}},_0x3f38f9={};_0x3f38f9['model']=_[_0xb084('0x44')](db[_0xb084('0x2a')][_0xb084('0x2b')]);_0x3f38f9[_0xb084('0x30')]=_['keys'](_0x526c47[_0xb084('0x30')]);_0x3f38f9[_0xb084('0x31')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],_0x3f38f9[_0xb084('0x30')]);_0x13b059[_0xb084('0x33')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],qs[_0xb084('0x45')](_0x526c47[_0xb084('0x30')][_0xb084('0x45')]));_0x13b059[_0xb084('0x33')]=_0x13b059[_0xb084('0x33')][_0xb084('0x34')]?_0x13b059[_0xb084('0x33')]:_0x3f38f9['model'];if(_0x526c47[_0xb084('0x30')][_0xb084('0x3f')]){_0x13b059[_0xb084('0x46')]=[{'all':!![]}];}_0x13b059=_[_0xb084('0x3d')]({},_0x13b059,_0x526c47[_0xb084('0x3e')]);return db[_0xb084('0x2a')]['find'](_0x13b059)[_0xb084('0x23')](handleEntityNotFound(_0xc63ca9,null))[_0xb084('0x23')](respondWithResult(_0xc63ca9,null))[_0xb084('0x41')](handleError(_0xc63ca9,null));};exports[_0xb084('0x47')]=function(_0x1a95e4,_0x305f4a){return db[_0xb084('0x2a')]['create'](_0x1a95e4[_0xb084('0x48')],{})[_0xb084('0x23')](respondWithResult(_0x305f4a,0xc9))[_0xb084('0x41')](handleError(_0x305f4a,null));};exports[_0xb084('0x22')]=function(_0x32014e,_0xb1fdeb){if(_0x32014e[_0xb084('0x48')]['id']){delete _0x32014e[_0xb084('0x48')]['id'];}return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x32014e[_0xb084('0x43')]['id']}})['then'](handleEntityNotFound(_0xb1fdeb,null))[_0xb084('0x23')](saveUpdates(_0x32014e[_0xb084('0x48')],null))[_0xb084('0x23')](respondWithResult(_0xb1fdeb,null))[_0xb084('0x41')](handleError(_0xb1fdeb,null));};exports[_0xb084('0x24')]=function(_0x4bad1b,_0x2d5ebd){return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x4bad1b[_0xb084('0x43')]['id']}})[_0xb084('0x23')](handleEntityNotFound(_0x2d5ebd,null))[_0xb084('0x23')](removeEntity(_0x2d5ebd,null))[_0xb084('0x41')](handleError(_0x2d5ebd,null));};exports[_0xb084('0x4a')]=function(_0x2d9239,_0x557649){return db['ChatQueueReport']['describe']()[_0xb084('0x23')](respondWithResult(_0x557649,null))[_0xb084('0x41')](handleError(_0x557649,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9598e30..73d48eb 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x490b12,_0x74826a){var _0x805008=function(_0x5b7cb5){while(--_0x5b7cb5){_0x490b12['push'](_0x490b12['shift']());}};_0x805008(++_0x74826a);}(_0x757a,0xde));var _0xa757=function(_0x2d8f7f,_0x274aee){_0x2d8f7f=_0x2d8f7f-0x0;var _0x1b0492=_0x757a[_0x2d8f7f];return _0x1b0492;};'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 +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x471268,_0x5ce885){_0x471268=_0x471268-0x0;var _0x1298f3=_0xb10b[_0x471268];return _0x1298f3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 931476c..93ad20a 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 _0x10df=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','options','raw','debug','CreateChatQueueReport','update','attributes','UpdateChatQueueReport','lodash','util','moment'];(function(_0xda6024,_0x1434d4){var _0x338ba0=function(_0x2d9829){while(--_0x2d9829){_0xda6024['push'](_0xda6024['shift']());}};_0x338ba0(++_0x1434d4);}(_0x10df,0xb1));var _0xf10d=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0x10df[_0x326c48];return _0xf71bc5;};'use strict';var _=require(_0xf10d('0x0'));var util=require(_0xf10d('0x1'));var moment=require(_0xf10d('0x2'));var BPromise=require('bluebird');var rs=require(_0xf10d('0x3'));var fs=require('fs');var Redis=require(_0xf10d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf10d('0x5'));var logger=require(_0xf10d('0x6'))(_0xf10d('0x7'));var config=require(_0xf10d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf10d('0x9')][_0xf10d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e8a64,_0x99b185,_0x17f04b){return new BPromise(function(_0xe5226,_0x5803cf){return client['request'](_0x1e8a64,_0x17f04b)[_0xf10d('0xb')](function(_0x5f3a3f){logger[_0xf10d('0xc')](_0xf10d('0xd'),_0x99b185,_0xf10d('0xe'));logger['debug'](_0xf10d('0xf'),_0x99b185,'request\x20sent',JSON[_0xf10d('0x10')](_0x5f3a3f));if(_0x5f3a3f[_0xf10d('0x11')]){if(_0x5f3a3f[_0xf10d('0x11')]['code']===0x1f4){logger[_0xf10d('0x11')](_0xf10d('0xd'),_0x99b185,_0x5f3a3f['error'][_0xf10d('0x12')]);return _0x5803cf(_0x5f3a3f[_0xf10d('0x11')][_0xf10d('0x12')]);}logger[_0xf10d('0x11')](_0xf10d('0xd'),_0x99b185,_0x5f3a3f[_0xf10d('0x11')]['message']);return _0xe5226(_0x5f3a3f[_0xf10d('0x11')][_0xf10d('0x12')]);}else{logger[_0xf10d('0xc')](_0xf10d('0xd'),_0x99b185,_0xf10d('0xe'));_0xe5226(_0x5f3a3f[_0xf10d('0x13')][_0xf10d('0x12')]);}})[_0xf10d('0x14')](function(_0x31180d){logger[_0xf10d('0x11')](_0xf10d('0xd'),_0x99b185,_0x31180d);_0x5803cf(_0x31180d);});});}exports['CreateChatQueueReport']=function(_0x46f790){var _0xbc73fd=this;return new Promise(function(_0x5c2539,_0x1138d8){return db[_0xf10d('0x15')][_0xf10d('0x16')](_0x46f790['body'],{'raw':_0x46f790[_0xf10d('0x17')]?_0x46f790['options'][_0xf10d('0x18')]===undefined?!![]:![]:!![]})[_0xf10d('0xb')](function(_0x37bc6f){logger[_0xf10d('0xc')]('CreateChatQueueReport',_0x46f790);logger[_0xf10d('0x19')]('CreateChatQueueReport',_0x46f790,JSON['stringify'](_0x37bc6f));_0x5c2539(_0x37bc6f);})[_0xf10d('0x14')](function(_0x23be70){logger['error'](_0xf10d('0x1a'),_0x23be70[_0xf10d('0x12')],_0x46f790);_0x1138d8(_0xbc73fd[_0xf10d('0x11')](0x1f4,_0x23be70['message']));});});};exports['UpdateChatQueueReport']=function(_0x14f835){var _0x21e6ef=this;return new Promise(function(_0x4e678b,_0x445204){return db[_0xf10d('0x15')][_0xf10d('0x1b')](_0x14f835['body'],{'raw':_0x14f835['options']?_0x14f835[_0xf10d('0x17')][_0xf10d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f835[_0xf10d('0x17')]?_0x14f835['options']['where']||null:null,'attributes':_0x14f835[_0xf10d('0x17')]?_0x14f835[_0xf10d('0x17')][_0xf10d('0x1c')]||null:null,'limit':_0x14f835['options']?_0x14f835[_0xf10d('0x17')]['limit']||null:null})[_0xf10d('0xb')](function(_0x1728b5){logger['info'](_0xf10d('0x1d'),_0x14f835);logger[_0xf10d('0x19')](_0xf10d('0x1d'),_0x14f835,JSON[_0xf10d('0x10')](_0x1728b5));_0x4e678b(_0x1728b5);})['catch'](function(_0x2692a8){logger['error'](_0xf10d('0x1d'),_0x2692a8['message'],_0x14f835);_0x445204(_0x21e6ef[_0xf10d('0x11')](0x1f4,_0x2692a8[_0xf10d('0x12')]));});});}; \ No newline at end of file +var _0x0b94=['info','catch','ChatQueueReport','create','body','options','raw','then','CreateChatQueueReport','stringify','UpdateChatQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x0b94,0xaf));var _0x40b9=function(_0x2ad946,_0x19e233){_0x2ad946=_0x2ad946-0x0;var _0x278869=_0x0b94[_0x2ad946];return _0x278869;};'use strict';var _=require(_0x40b9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40b9('0x1'));var rs=require(_0x40b9('0x2'));var fs=require('fs');var Redis=require(_0x40b9('0x3'));var db=require(_0x40b9('0x4'))['db'];var utils=require(_0x40b9('0x5'));var logger=require(_0x40b9('0x6'))('rpc');var config=require(_0x40b9('0x7'));var jayson=require(_0x40b9('0x8'));var client=jayson[_0x40b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4625d1,_0x126e16,_0x36f834){return new BPromise(function(_0x230c1f,_0x244c8f){return client[_0x40b9('0xa')](_0x4625d1,_0x36f834)['then'](function(_0x18e683){logger['info'](_0x40b9('0xb'),_0x126e16,_0x40b9('0xc'));logger[_0x40b9('0xd')](_0x40b9('0xe'),_0x126e16,_0x40b9('0xc'),JSON['stringify'](_0x18e683));if(_0x18e683[_0x40b9('0xf')]){if(_0x18e683[_0x40b9('0xf')]['code']===0x1f4){logger['error'](_0x40b9('0xb'),_0x126e16,_0x18e683[_0x40b9('0xf')]['message']);return _0x244c8f(_0x18e683['error'][_0x40b9('0x10')]);}logger[_0x40b9('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x126e16,_0x18e683[_0x40b9('0xf')]['message']);return _0x230c1f(_0x18e683[_0x40b9('0xf')][_0x40b9('0x10')]);}else{logger[_0x40b9('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x126e16,_0x40b9('0xc'));_0x230c1f(_0x18e683['result'][_0x40b9('0x10')]);}})[_0x40b9('0x12')](function(_0x36678c){logger[_0x40b9('0xf')](_0x40b9('0xb'),_0x126e16,_0x36678c);_0x244c8f(_0x36678c);});});}exports['CreateChatQueueReport']=function(_0x4dd18f){var _0x53dabc=this;return new Promise(function(_0x13b697,_0x34ae51){return db[_0x40b9('0x13')][_0x40b9('0x14')](_0x4dd18f[_0x40b9('0x15')],{'raw':_0x4dd18f['options']?_0x4dd18f[_0x40b9('0x16')][_0x40b9('0x17')]===undefined?!![]:![]:!![]})[_0x40b9('0x18')](function(_0x60530){logger[_0x40b9('0x11')](_0x40b9('0x19'),_0x4dd18f);logger[_0x40b9('0xd')]('CreateChatQueueReport',_0x4dd18f,JSON[_0x40b9('0x1a')](_0x60530));_0x13b697(_0x60530);})[_0x40b9('0x12')](function(_0x55193d){logger['error']('CreateChatQueueReport',_0x55193d['message'],_0x4dd18f);_0x34ae51(_0x53dabc['error'](0x1f4,_0x55193d[_0x40b9('0x10')]));});});};exports[_0x40b9('0x1b')]=function(_0x3119c0){var _0x4c9165=this;return new Promise(function(_0x20888e,_0x12d953){return db['ChatQueueReport'][_0x40b9('0x1c')](_0x3119c0['body'],{'raw':_0x3119c0[_0x40b9('0x16')]?_0x3119c0[_0x40b9('0x16')][_0x40b9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3119c0[_0x40b9('0x16')]?_0x3119c0['options'][_0x40b9('0x1d')]||null:null,'attributes':_0x3119c0[_0x40b9('0x16')]?_0x3119c0[_0x40b9('0x16')][_0x40b9('0x1e')]||null:null,'limit':_0x3119c0[_0x40b9('0x16')]?_0x3119c0[_0x40b9('0x16')][_0x40b9('0x1f')]||null:null})[_0x40b9('0x18')](function(_0x19a3df){logger['info'](_0x40b9('0x1b'),_0x3119c0);logger['debug']('UpdateChatQueueReport',_0x3119c0,JSON[_0x40b9('0x1a')](_0x19a3df));_0x20888e(_0x19a3df);})[_0x40b9('0x12')](function(_0x2ce6d9){logger['error'](_0x40b9('0x1b'),_0x2ce6d9[_0x40b9('0x10')],_0x3119c0);_0x12d953(_0x4c9165['error'](0x1f4,_0x2ce6d9[_0x40b9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c92b9ff..4c337df 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 _0x7ce1=['../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x40a5e8,_0x21b743){var _0x3d9295=function(_0x6eeeae){while(--_0x6eeeae){_0x40a5e8['push'](_0x40a5e8['shift']());}};_0x3d9295(++_0x21b743);}(_0x7ce1,0x14b));var _0x17ce=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x7ce1[_0x55abd9];return _0x3e5669;};'use strict';var multer=require(_0x17ce('0x0'));var util=require('util');var path=require(_0x17ce('0x1'));var timeout=require(_0x17ce('0x2'));var express=require(_0x17ce('0x3'));var router=express['Router']();var fs_extra=require(_0x17ce('0x4'));var auth=require(_0x17ce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x17ce('0x6'));var controller=require(_0x17ce('0x7'));router[_0x17ce('0x8')]('/',auth[_0x17ce('0x9')](),controller[_0x17ce('0xa')]);router[_0x17ce('0x8')](_0x17ce('0xb'),auth[_0x17ce('0x9')](),controller[_0x17ce('0xc')]);router[_0x17ce('0x8')](_0x17ce('0xd'),auth[_0x17ce('0x9')](),controller[_0x17ce('0xe')]);router[_0x17ce('0xf')]('/',auth[_0x17ce('0x9')](),controller[_0x17ce('0x10')]);router['put'](_0x17ce('0xd'),auth[_0x17ce('0x9')](),controller[_0x17ce('0x11')]);router[_0x17ce('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x17ce('0x13')]);module[_0x17ce('0x14')]=router; \ No newline at end of file +var _0x7bf4=['../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','util','path','Router'];(function(_0x3047f7,_0x326044){var _0x331118=function(_0x5f3942){while(--_0x5f3942){_0x3047f7['push'](_0x3047f7['shift']());}};_0x331118(++_0x326044);}(_0x7bf4,0x16c));var _0x47bf=function(_0x60be6e,_0x4abac6){_0x60be6e=_0x60be6e-0x0;var _0x515da0=_0x7bf4[_0x60be6e];return _0x515da0;};'use strict';var multer=require(_0x47bf('0x0'));var util=require(_0x47bf('0x1'));var path=require(_0x47bf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x47bf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x47bf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x47bf('0x5')]('/',auth[_0x47bf('0x6')](),controller[_0x47bf('0x7')]);router[_0x47bf('0x5')](_0x47bf('0x8'),auth[_0x47bf('0x6')](),controller[_0x47bf('0x9')]);router[_0x47bf('0x5')](_0x47bf('0xa'),auth[_0x47bf('0x6')](),controller[_0x47bf('0xb')]);router[_0x47bf('0xc')]('/',auth[_0x47bf('0x6')](),controller[_0x47bf('0xd')]);router['put'](_0x47bf('0xa'),auth[_0x47bf('0x6')](),controller[_0x47bf('0xe')]);router[_0x47bf('0xf')](_0x47bf('0xa'),auth[_0x47bf('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9481d6b..2f610fd 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1e73fc,_0x533750){var _0xeceac4=function(_0x2c6dda){while(--_0x2c6dda){_0x1e73fc['push'](_0x1e73fc['shift']());}};_0xeceac4(++_0x533750);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb43b,0x1b2));var _0xbb43=function(_0x188540,_0x3ed948){_0x188540=_0x188540-0x0;var _0x1f8384=_0xb43b[_0x188540];return _0x1f8384;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index f308e9e..604b8d2 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 _0x8220=['merge','options','include','ChatTransferReport','findAll','params','find','catch','create','body','describe','fast-json-patch','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','stack','name','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','filter','VIRTUAL'];(function(_0x21c1a4,_0x30b425){var _0x7ac3e5=function(_0x2dded1){while(--_0x2dded1){_0x21c1a4['push'](_0x21c1a4['shift']());}};_0x7ac3e5(++_0x30b425);}(_0x8220,0x93));var _0x0822=function(_0x9d5a92,_0x34875d){_0x9d5a92=_0x9d5a92-0x0;var _0x3d84f2=_0x8220[_0x9d5a92];return _0x3d84f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0822('0x0'));var rp=require('request-promise');var moment=require(_0x0822('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x0822('0x2'));var util=require(_0x0822('0x3'));var path=require('path');var sox=require(_0x0822('0x4'));var csv=require('to-csv');var ejs=require(_0x0822('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0822('0x6'));var squel=require('squel');var crypto=require(_0x0822('0x7'));var jsforce=require(_0x0822('0x8'));var deskjs=require(_0x0822('0x9'));var toCsv=require(_0x0822('0xa'));var querystring=require(_0x0822('0xb'));var Papa=require(_0x0822('0xc'));var Redis=require(_0x0822('0xd'));var authService=require(_0x0822('0xe'));var qs=require(_0x0822('0xf'));var as=require(_0x0822('0x10'));var hardwareService=require(_0x0822('0x11'));var logger=require(_0x0822('0x12'))('api');var utils=require(_0x0822('0x13'));var config=require(_0x0822('0x14'));var licenseUtil=require(_0x0822('0x15'));var db=require(_0x0822('0x16'))['db'];function respondWithStatusCode(_0x3d8934,_0xf5fbe7){_0xf5fbe7=_0xf5fbe7||0xcc;return function(_0x2cc32f){if(_0x2cc32f){return _0x3d8934[_0x0822('0x17')](_0xf5fbe7);}return _0x3d8934['status'](_0xf5fbe7)[_0x0822('0x18')]();};}function respondWithResult(_0x54087d,_0xe21803){_0xe21803=_0xe21803||0xc8;return function(_0x59484a){if(_0x59484a){return _0x54087d['status'](_0xe21803)[_0x0822('0x19')](_0x59484a);}};}function respondWithFilteredResult(_0x26f4b7,_0x31bf95){return function(_0x46271d){if(_0x46271d){var _0x122305=typeof _0x31bf95['offset']===_0x0822('0x1a')&&typeof _0x31bf95[_0x0822('0x1b')]==='undefined';var _0x1088cf=_0x46271d['count'];var _0x5c09fe=_0x122305?0x0:_0x31bf95['offset'];var _0x276af4=_0x122305?_0x46271d[_0x0822('0x1c')]:_0x31bf95[_0x0822('0x1d')]+_0x31bf95[_0x0822('0x1b')];var _0x38e52b;if(_0x276af4>=_0x1088cf){_0x276af4=_0x1088cf;_0x38e52b=0xc8;}else{_0x38e52b=0xce;}_0x26f4b7['status'](_0x38e52b);return _0x26f4b7[_0x0822('0x1e')](_0x0822('0x1f'),_0x5c09fe+'-'+_0x276af4+'/'+_0x1088cf)['json'](_0x46271d);}return null;};}function patchUpdates(_0x56ffd3){return function(_0x11625b){try{jsonpatch[_0x0822('0x20')](_0x11625b,_0x56ffd3,!![]);}catch(_0x3aec88){return BPromise[_0x0822('0x21')](_0x3aec88);}return _0x11625b[_0x0822('0x22')]();};}function saveUpdates(_0x31d148,_0x1a4e9a){return function(_0xa02f5d){if(_0xa02f5d){return _0xa02f5d[_0x0822('0x23')](_0x31d148)[_0x0822('0x24')](function(_0x50d6d1){return _0x50d6d1;});}return null;};}function removeEntity(_0x26cb05,_0x266b7b){return function(_0x57b361){if(_0x57b361){return _0x57b361[_0x0822('0x25')]()[_0x0822('0x24')](function(){_0x26cb05[_0x0822('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a62d4,_0x587607){return function(_0x59b8da){if(!_0x59b8da){_0x1a62d4['sendStatus'](0x194);}return _0x59b8da;};}function handleError(_0x45133b,_0x291a35){_0x291a35=_0x291a35||0x1f4;return function(_0x2088a5){logger['error'](_0x2088a5[_0x0822('0x27')]);if(_0x2088a5['name']){delete _0x2088a5[_0x0822('0x28')];}_0x45133b[_0x0822('0x26')](_0x291a35)['send'](_0x2088a5);};}exports['index']=function(_0x2510ad,_0x4c2a38){var _0x2cd649={},_0x5bd634={},_0x2d9fbf={'count':0x0,'rows':[]};var _0x5f40a1=_[_0x0822('0x29')](db['ChatTransferReport']['rawAttributes'],function(_0x517754){return{'name':_0x517754[_0x0822('0x2a')],'type':_0x517754[_0x0822('0x2b')]['key']};});_0x5bd634[_0x0822('0x2c')]=_[_0x0822('0x29')](_0x5f40a1,_0x0822('0x28'));_0x5bd634[_0x0822('0x2d')]=_[_0x0822('0x2e')](_0x2510ad[_0x0822('0x2d')]);_0x5bd634['filters']=_[_0x0822('0x2f')](_0x5bd634['model'],_0x5bd634['query']);_0x2cd649[_0x0822('0x30')]=_[_0x0822('0x2f')](_0x5bd634[_0x0822('0x2c')],qs[_0x0822('0x31')](_0x2510ad[_0x0822('0x2d')][_0x0822('0x31')]));_0x2cd649['attributes']=_0x2cd649['attributes'][_0x0822('0x32')]?_0x2cd649[_0x0822('0x30')]:_0x5bd634[_0x0822('0x2c')];if(!_0x2510ad[_0x0822('0x2d')]['hasOwnProperty']('nolimit')){_0x2cd649[_0x0822('0x1b')]=qs[_0x0822('0x1b')](_0x2510ad['query'][_0x0822('0x1b')]);_0x2cd649[_0x0822('0x1d')]=qs[_0x0822('0x1d')](_0x2510ad[_0x0822('0x2d')]['offset']);}_0x2cd649[_0x0822('0x33')]=qs[_0x0822('0x34')](_0x2510ad[_0x0822('0x2d')][_0x0822('0x34')]);_0x2cd649[_0x0822('0x35')]=qs[_0x0822('0x36')](_['pick'](_0x2510ad['query'],_0x5bd634[_0x0822('0x36')]),_0x5f40a1);if(_0x2510ad[_0x0822('0x2d')][_0x0822('0x37')]){_0x2cd649['where']=_['merge'](_0x2cd649['where'],{'$or':_[_0x0822('0x29')](_0x5f40a1,function(_0x522d82){if(_0x522d82[_0x0822('0x2b')]!==_0x0822('0x38')){var _0x5a6077={};_0x5a6077[_0x522d82[_0x0822('0x28')]]={'$like':'%'+_0x2510ad[_0x0822('0x2d')]['filter']+'%'};return _0x5a6077;}})});}_0x2cd649=_[_0x0822('0x39')]({},_0x2cd649,_0x2510ad[_0x0822('0x3a')]);var _0x3c9356={'where':_0x2cd649[_0x0822('0x35')]};return db['ChatTransferReport']['count'](_0x3c9356)[_0x0822('0x24')](function(_0x5b5523){_0x2d9fbf['count']=_0x5b5523;if(_0x2510ad[_0x0822('0x2d')]['includeAll']){_0x2cd649[_0x0822('0x3b')]=[{'all':!![]}];}return db[_0x0822('0x3c')][_0x0822('0x3d')](_0x2cd649);})[_0x0822('0x24')](function(_0x581906){_0x2d9fbf['rows']=_0x581906;return _0x2d9fbf;})[_0x0822('0x24')](respondWithFilteredResult(_0x4c2a38,_0x2cd649))['catch'](handleError(_0x4c2a38,null));};exports['show']=function(_0x39331e,_0x3c2e9e){var _0x106847={'raw':!![],'where':{'id':_0x39331e[_0x0822('0x3e')]['id']}},_0x2479c9={};_0x2479c9[_0x0822('0x2c')]=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x2479c9[_0x0822('0x2d')]=_[_0x0822('0x2e')](_0x39331e[_0x0822('0x2d')]);_0x2479c9['filters']=_['intersection'](_0x2479c9['model'],_0x2479c9[_0x0822('0x2d')]);_0x106847['attributes']=_[_0x0822('0x2f')](_0x2479c9['model'],qs['fields'](_0x39331e['query'][_0x0822('0x31')]));_0x106847['attributes']=_0x106847[_0x0822('0x30')][_0x0822('0x32')]?_0x106847[_0x0822('0x30')]:_0x2479c9[_0x0822('0x2c')];if(_0x39331e[_0x0822('0x2d')]['includeAll']){_0x106847[_0x0822('0x3b')]=[{'all':!![]}];}_0x106847=_[_0x0822('0x39')]({},_0x106847,_0x39331e[_0x0822('0x3a')]);return db[_0x0822('0x3c')][_0x0822('0x3f')](_0x106847)[_0x0822('0x24')](handleEntityNotFound(_0x3c2e9e,null))[_0x0822('0x24')](respondWithResult(_0x3c2e9e,null))[_0x0822('0x40')](handleError(_0x3c2e9e,null));};exports['create']=function(_0x29c19a,_0x516d46){return db[_0x0822('0x3c')][_0x0822('0x41')](_0x29c19a[_0x0822('0x42')],{})[_0x0822('0x24')](respondWithResult(_0x516d46,0xc9))[_0x0822('0x40')](handleError(_0x516d46,null));};exports[_0x0822('0x23')]=function(_0x21665c,_0xbea9b3){if(_0x21665c[_0x0822('0x42')]['id']){delete _0x21665c['body']['id'];}return db[_0x0822('0x3c')][_0x0822('0x3f')]({'where':{'id':_0x21665c[_0x0822('0x3e')]['id']}})[_0x0822('0x24')](handleEntityNotFound(_0xbea9b3,null))[_0x0822('0x24')](saveUpdates(_0x21665c[_0x0822('0x42')],null))[_0x0822('0x24')](respondWithResult(_0xbea9b3,null))[_0x0822('0x40')](handleError(_0xbea9b3,null));};exports[_0x0822('0x25')]=function(_0x1f6968,_0x151486){return db['ChatTransferReport']['find']({'where':{'id':_0x1f6968[_0x0822('0x3e')]['id']}})[_0x0822('0x24')](handleEntityNotFound(_0x151486,null))[_0x0822('0x24')](removeEntity(_0x151486,null))['catch'](handleError(_0x151486,null));};exports[_0x0822('0x43')]=function(_0x5478c0,_0x189a47){return db[_0x0822('0x3c')][_0x0822('0x43')]()['then'](respondWithResult(_0x189a47,null))['catch'](handleError(_0x189a47,null));}; \ No newline at end of file +var _0x33f8=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','ChatTransferReport','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x41e6fa,_0x2dc57e){var _0x56bceb=function(_0x4950b1){while(--_0x4950b1){_0x41e6fa['push'](_0x41e6fa['shift']());}};_0x56bceb(++_0x2dc57e);}(_0x33f8,0x177));var _0x833f=function(_0x2cfd7f,_0x517c76){_0x2cfd7f=_0x2cfd7f-0x0;var _0x302d2a=_0x33f8[_0x2cfd7f];return _0x302d2a;};'use strict';var emlformat=require(_0x833f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x833f('0x1'));var jsonpatch=require(_0x833f('0x2'));var rp=require('request-promise');var moment=require(_0x833f('0x3'));var BPromise=require(_0x833f('0x4'));var Mustache=require(_0x833f('0x5'));var util=require('util');var path=require(_0x833f('0x6'));var sox=require(_0x833f('0x7'));var csv=require(_0x833f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x833f('0x9'));var _=require(_0x833f('0xa'));var squel=require('squel');var crypto=require(_0x833f('0xb'));var jsforce=require(_0x833f('0xc'));var deskjs=require(_0x833f('0xd'));var toCsv=require(_0x833f('0x8'));var querystring=require(_0x833f('0xe'));var Papa=require(_0x833f('0xf'));var Redis=require(_0x833f('0x10'));var authService=require(_0x833f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x833f('0x12'));var logger=require(_0x833f('0x13'))(_0x833f('0x14'));var utils=require('../../config/utils');var config=require(_0x833f('0x15'));var licenseUtil=require(_0x833f('0x16'));var db=require(_0x833f('0x17'))['db'];function respondWithStatusCode(_0x229331,_0x45f63f){_0x45f63f=_0x45f63f||0xcc;return function(_0x5711b2){if(_0x5711b2){return _0x229331[_0x833f('0x18')](_0x45f63f);}return _0x229331['status'](_0x45f63f)[_0x833f('0x19')]();};}function respondWithResult(_0x464952,_0x195a64){_0x195a64=_0x195a64||0xc8;return function(_0x161dd4){if(_0x161dd4){return _0x464952[_0x833f('0x1a')](_0x195a64)[_0x833f('0x1b')](_0x161dd4);}};}function respondWithFilteredResult(_0x446a80,_0x2100c3){return function(_0x334bed){if(_0x334bed){var _0x2ccd5d=typeof _0x2100c3['offset']==='undefined'&&typeof _0x2100c3[_0x833f('0x1c')]===_0x833f('0x1d');var _0x328a01=_0x334bed[_0x833f('0x1e')];var _0x4c58c5=_0x2ccd5d?0x0:_0x2100c3[_0x833f('0x1f')];var _0x46e7ed=_0x2ccd5d?_0x334bed['count']:_0x2100c3[_0x833f('0x1f')]+_0x2100c3[_0x833f('0x1c')];var _0x2055bc;if(_0x46e7ed>=_0x328a01){_0x46e7ed=_0x328a01;_0x2055bc=0xc8;}else{_0x2055bc=0xce;}_0x446a80[_0x833f('0x1a')](_0x2055bc);return _0x446a80[_0x833f('0x20')](_0x833f('0x21'),_0x4c58c5+'-'+_0x46e7ed+'/'+_0x328a01)[_0x833f('0x1b')](_0x334bed);}return null;};}function patchUpdates(_0x4bb941){return function(_0x4f52f0){try{jsonpatch[_0x833f('0x22')](_0x4f52f0,_0x4bb941,!![]);}catch(_0x5a5e2e){return BPromise[_0x833f('0x23')](_0x5a5e2e);}return _0x4f52f0[_0x833f('0x24')]();};}function saveUpdates(_0x331a28,_0xdb1a29){return function(_0x280fd5){if(_0x280fd5){return _0x280fd5[_0x833f('0x25')](_0x331a28)[_0x833f('0x26')](function(_0x27d573){return _0x27d573;});}return null;};}function removeEntity(_0x336f65,_0x4b6a72){return function(_0x5df83f){if(_0x5df83f){return _0x5df83f[_0x833f('0x27')]()[_0x833f('0x26')](function(){_0x336f65[_0x833f('0x1a')](0xcc)[_0x833f('0x19')]();});}};}function handleEntityNotFound(_0x1c82e1,_0x11ebfe){return function(_0x3f0a4f){if(!_0x3f0a4f){_0x1c82e1['sendStatus'](0x194);}return _0x3f0a4f;};}function handleError(_0x9403ae,_0x3e41e8){_0x3e41e8=_0x3e41e8||0x1f4;return function(_0x8c32c5){logger[_0x833f('0x28')](_0x8c32c5[_0x833f('0x29')]);if(_0x8c32c5['name']){delete _0x8c32c5[_0x833f('0x2a')];}_0x9403ae[_0x833f('0x1a')](_0x3e41e8)[_0x833f('0x2b')](_0x8c32c5);};}exports[_0x833f('0x2c')]=function(_0x555718,_0x30c8e1){var _0xb26093={},_0x2df0aa={},_0x466aff={'count':0x0,'rows':[]};var _0x484d77=_[_0x833f('0x2d')](db['ChatTransferReport'][_0x833f('0x2e')],function(_0x1ae5ed){return{'name':_0x1ae5ed[_0x833f('0x2f')],'type':_0x1ae5ed[_0x833f('0x30')]['key']};});_0x2df0aa[_0x833f('0x31')]=_[_0x833f('0x2d')](_0x484d77,_0x833f('0x2a'));_0x2df0aa['query']=_[_0x833f('0x32')](_0x555718[_0x833f('0x33')]);_0x2df0aa[_0x833f('0x34')]=_[_0x833f('0x35')](_0x2df0aa[_0x833f('0x31')],_0x2df0aa['query']);_0xb26093[_0x833f('0x36')]=_[_0x833f('0x35')](_0x2df0aa[_0x833f('0x31')],qs[_0x833f('0x37')](_0x555718[_0x833f('0x33')][_0x833f('0x37')]));_0xb26093[_0x833f('0x36')]=_0xb26093[_0x833f('0x36')]['length']?_0xb26093['attributes']:_0x2df0aa[_0x833f('0x31')];if(!_0x555718['query'][_0x833f('0x38')](_0x833f('0x39'))){_0xb26093[_0x833f('0x1c')]=qs[_0x833f('0x1c')](_0x555718[_0x833f('0x33')]['limit']);_0xb26093[_0x833f('0x1f')]=qs['offset'](_0x555718[_0x833f('0x33')]['offset']);}_0xb26093[_0x833f('0x3a')]=qs[_0x833f('0x3b')](_0x555718[_0x833f('0x33')][_0x833f('0x3b')]);_0xb26093[_0x833f('0x3c')]=qs[_0x833f('0x34')](_[_0x833f('0x3d')](_0x555718['query'],_0x2df0aa[_0x833f('0x34')]),_0x484d77);if(_0x555718[_0x833f('0x33')][_0x833f('0x3e')]){_0xb26093['where']=_[_0x833f('0x3f')](_0xb26093[_0x833f('0x3c')],{'$or':_[_0x833f('0x2d')](_0x484d77,function(_0x2d87b5){if(_0x2d87b5['type']!==_0x833f('0x40')){var _0x23ab1c={};_0x23ab1c[_0x2d87b5[_0x833f('0x2a')]]={'$like':'%'+_0x555718['query'][_0x833f('0x3e')]+'%'};return _0x23ab1c;}})});}_0xb26093=_[_0x833f('0x3f')]({},_0xb26093,_0x555718[_0x833f('0x41')]);var _0x32ee2f={'where':_0xb26093['where']};return db['ChatTransferReport']['count'](_0x32ee2f)[_0x833f('0x26')](function(_0x225f4d){_0x466aff[_0x833f('0x1e')]=_0x225f4d;if(_0x555718[_0x833f('0x33')]['includeAll']){_0xb26093[_0x833f('0x42')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x833f('0x43')](_0xb26093);})['then'](function(_0x25c7a6){_0x466aff[_0x833f('0x44')]=_0x25c7a6;return _0x466aff;})[_0x833f('0x26')](respondWithFilteredResult(_0x30c8e1,_0xb26093))[_0x833f('0x45')](handleError(_0x30c8e1,null));};exports[_0x833f('0x46')]=function(_0x2d61e7,_0x391ec1){var _0x4365e2={'raw':!![],'where':{'id':_0x2d61e7[_0x833f('0x47')]['id']}},_0x49588b={};_0x49588b[_0x833f('0x31')]=_['keys'](db['ChatTransferReport'][_0x833f('0x2e')]);_0x49588b['query']=_[_0x833f('0x32')](_0x2d61e7[_0x833f('0x33')]);_0x49588b[_0x833f('0x34')]=_[_0x833f('0x35')](_0x49588b['model'],_0x49588b[_0x833f('0x33')]);_0x4365e2[_0x833f('0x36')]=_[_0x833f('0x35')](_0x49588b['model'],qs[_0x833f('0x37')](_0x2d61e7[_0x833f('0x33')][_0x833f('0x37')]));_0x4365e2[_0x833f('0x36')]=_0x4365e2[_0x833f('0x36')][_0x833f('0x48')]?_0x4365e2[_0x833f('0x36')]:_0x49588b[_0x833f('0x31')];if(_0x2d61e7['query'][_0x833f('0x49')]){_0x4365e2['include']=[{'all':!![]}];}_0x4365e2=_['merge']({},_0x4365e2,_0x2d61e7['options']);return db[_0x833f('0x4a')][_0x833f('0x4b')](_0x4365e2)[_0x833f('0x26')](handleEntityNotFound(_0x391ec1,null))[_0x833f('0x26')](respondWithResult(_0x391ec1,null))[_0x833f('0x45')](handleError(_0x391ec1,null));};exports[_0x833f('0x4c')]=function(_0x4fce8a,_0x6cd73b){return db[_0x833f('0x4a')][_0x833f('0x4c')](_0x4fce8a[_0x833f('0x4d')],{})[_0x833f('0x26')](respondWithResult(_0x6cd73b,0xc9))['catch'](handleError(_0x6cd73b,null));};exports['update']=function(_0x270693,_0x5235c4){if(_0x270693[_0x833f('0x4d')]['id']){delete _0x270693[_0x833f('0x4d')]['id'];}return db['ChatTransferReport'][_0x833f('0x4b')]({'where':{'id':_0x270693[_0x833f('0x47')]['id']}})[_0x833f('0x26')](handleEntityNotFound(_0x5235c4,null))[_0x833f('0x26')](saveUpdates(_0x270693[_0x833f('0x4d')],null))[_0x833f('0x26')](respondWithResult(_0x5235c4,null))[_0x833f('0x45')](handleError(_0x5235c4,null));};exports[_0x833f('0x27')]=function(_0x4d2f59,_0x1333a8){return db[_0x833f('0x4a')]['find']({'where':{'id':_0x4d2f59['params']['id']}})[_0x833f('0x26')](handleEntityNotFound(_0x1333a8,null))[_0x833f('0x26')](removeEntity(_0x1333a8,null))[_0x833f('0x45')](handleError(_0x1333a8,null));};exports[_0x833f('0x4e')]=function(_0x5bedf1,_0x4c1fad){return db['ChatTransferReport']['describe']()[_0x833f('0x26')](respondWithResult(_0x4c1fad,null))[_0x833f('0x45')](handleError(_0x4c1fad,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 88ba2bc..87c2256 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 _0xc0f2=['bluebird','rimraf','../../config/environment','./chatTransferReport.attributes','uniqueid','lodash','util','../../config/logger','api'];(function(_0x29c11f,_0x546362){var _0x49f24a=function(_0x22b1a3){while(--_0x22b1a3){_0x29c11f['push'](_0x29c11f['shift']());}};_0x49f24a(++_0x546362);}(_0xc0f2,0x16d));var _0x2c0f=function(_0x251049,_0x21a6cc){_0x251049=_0x251049-0x0;var _0x24fe11=_0xc0f2[_0x251049];return _0x24fe11;};'use strict';var _=require(_0x2c0f('0x0'));var util=require(_0x2c0f('0x1'));var logger=require(_0x2c0f('0x2'))(_0x2c0f('0x3'));var moment=require('moment');var BPromise=require(_0x2c0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2c0f('0x5'));var config=require(_0x2c0f('0x6'));var attributes=require(_0x2c0f('0x7'));module['exports']=function(_0x4489d7,_0x1a48ee){return _0x4489d7['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x2c0f('0x8'),'fields':[_0x2c0f('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb746=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x2a642d,_0x2df503){var _0x4adf7d=function(_0x5c3068){while(--_0x5c3068){_0x2a642d['push'](_0x2a642d['shift']());}};_0x4adf7d(++_0x2df503);}(_0xb746,0x162));var _0x6b74=function(_0x4ceec9,_0x16057d){_0x4ceec9=_0x4ceec9-0x0;var _0x4e2033=_0xb746[_0x4ceec9];return _0x4e2033;};'use strict';var _=require(_0x6b74('0x0'));var util=require('util');var logger=require(_0x6b74('0x1'))(_0x6b74('0x2'));var moment=require(_0x6b74('0x3'));var BPromise=require(_0x6b74('0x4'));var rp=require(_0x6b74('0x5'));var fs=require('fs');var path=require(_0x6b74('0x6'));var rimraf=require('rimraf');var config=require(_0x6b74('0x7'));var attributes=require(_0x6b74('0x8'));module[_0x6b74('0x9')]=function(_0x12a443,_0x26cedb){return _0x12a443['define'](_0x6b74('0xa'),attributes,{'tableName':_0x6b74('0xb'),'paranoid':![],'indexes':[{'name':_0x6b74('0xc'),'fields':[_0x6b74('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5c968eb..bd40b9e 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 _0x9bcf=['result','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','error','ChatTransferReport,\x20%s,\x20%s','message'];(function(_0x329c19,_0x512fea){var _0x55fdaf=function(_0x437c72){while(--_0x437c72){_0x329c19['push'](_0x329c19['shift']());}};_0x55fdaf(++_0x512fea);}(_0x9bcf,0x9a));var _0xf9bc=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0x9bcf[_0x5e7e1a];return _0x46b94f;};'use strict';var _=require(_0xf9bc('0x0'));var util=require('util');var moment=require(_0xf9bc('0x1'));var BPromise=require(_0xf9bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf9bc('0x3'));var logger=require(_0xf9bc('0x4'))(_0xf9bc('0x5'));var config=require(_0xf9bc('0x6'));var jayson=require(_0xf9bc('0x7'));var client=jayson[_0xf9bc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23fda9,_0x137cea,_0x484a74){return new BPromise(function(_0x53a1bd,_0x5b1f08){return client[_0xf9bc('0x9')](_0x23fda9,_0x484a74)['then'](function(_0x5487ef){logger[_0xf9bc('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x137cea,_0xf9bc('0xb'));logger[_0xf9bc('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x137cea,_0xf9bc('0xb'),JSON['stringify'](_0x5487ef));if(_0x5487ef[_0xf9bc('0xd')]){if(_0x5487ef[_0xf9bc('0xd')]['code']===0x1f4){logger[_0xf9bc('0xd')](_0xf9bc('0xe'),_0x137cea,_0x5487ef[_0xf9bc('0xd')][_0xf9bc('0xf')]);return _0x5b1f08(_0x5487ef['error'][_0xf9bc('0xf')]);}logger['error'](_0xf9bc('0xe'),_0x137cea,_0x5487ef['error']['message']);return _0x53a1bd(_0x5487ef[_0xf9bc('0xd')][_0xf9bc('0xf')]);}else{logger[_0xf9bc('0xa')](_0xf9bc('0xe'),_0x137cea,_0xf9bc('0xb'));_0x53a1bd(_0x5487ef[_0xf9bc('0x10')][_0xf9bc('0xf')]);}})['catch'](function(_0x221d42){logger[_0xf9bc('0xd')](_0xf9bc('0xe'),_0x137cea,_0x221d42);_0x5b1f08(_0x221d42);});});} \ No newline at end of file +var _0xc11e=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x5f3031,_0x350e0f){var _0x3879e6=function(_0x337da7){while(--_0x337da7){_0x5f3031['push'](_0x5f3031['shift']());}};_0x3879e6(++_0x350e0f);}(_0xc11e,0x153));var _0xec11=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xc11e[_0xd4636c];return _0x5ee17d;};'use strict';var _=require(_0xec11('0x0'));var util=require(_0xec11('0x1'));var moment=require('moment');var BPromise=require(_0xec11('0x2'));var rs=require(_0xec11('0x3'));var fs=require('fs');var Redis=require(_0xec11('0x4'));var db=require(_0xec11('0x5'))['db'];var utils=require(_0xec11('0x6'));var logger=require(_0xec11('0x7'))(_0xec11('0x8'));var config=require('../../config/environment');var jayson=require(_0xec11('0x9'));var client=jayson['client'][_0xec11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2faf25,_0x209007,_0xbf648f){return new BPromise(function(_0x4e0d05,_0x366d7b){return client[_0xec11('0xb')](_0x2faf25,_0xbf648f)[_0xec11('0xc')](function(_0x37fd71){logger['info'](_0xec11('0xd'),_0x209007,_0xec11('0xe'));logger[_0xec11('0xf')](_0xec11('0x10'),_0x209007,_0xec11('0xe'),JSON[_0xec11('0x11')](_0x37fd71));if(_0x37fd71[_0xec11('0x12')]){if(_0x37fd71[_0xec11('0x12')]['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x209007,_0x37fd71[_0xec11('0x12')][_0xec11('0x13')]);return _0x366d7b(_0x37fd71[_0xec11('0x12')][_0xec11('0x13')]);}logger[_0xec11('0x12')](_0xec11('0xd'),_0x209007,_0x37fd71[_0xec11('0x12')][_0xec11('0x13')]);return _0x4e0d05(_0x37fd71['error'][_0xec11('0x13')]);}else{logger[_0xec11('0x14')](_0xec11('0xd'),_0x209007,_0xec11('0xe'));_0x4e0d05(_0x37fd71[_0xec11('0x15')][_0xec11('0x13')]);}})['catch'](function(_0x228978){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x209007,_0x228978);_0x366d7b(_0x228978);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 371f3f1..9b8793e 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 _0x581e=['/:id','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','describe','get','show','post','create'];(function(_0x544da7,_0x5d5ac1){var _0x163310=function(_0x11d220){while(--_0x11d220){_0x544da7['push'](_0x544da7['shift']());}};_0x163310(++_0x5d5ac1);}(_0x581e,0x6a));var _0xe581=function(_0xb13d69,_0x5941ed){_0xb13d69=_0xb13d69-0x0;var _0x2d9a47=_0x581e[_0xb13d69];return _0x2d9a47;};'use strict';var multer=require(_0xe581('0x0'));var util=require(_0xe581('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe581('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe581('0x3'));var config=require(_0xe581('0x4'));var controller=require(_0xe581('0x5'));router['get']('/',auth[_0xe581('0x6')](),controller[_0xe581('0x7')]);router['get']('/describe',auth[_0xe581('0x6')](),controller[_0xe581('0x8')]);router[_0xe581('0x9')]('/:id',auth[_0xe581('0x6')](),controller[_0xe581('0xa')]);router[_0xe581('0xb')]('/',auth[_0xe581('0x6')](),controller[_0xe581('0xc')]);router['put'](_0xe581('0xd'),auth[_0xe581('0x6')](),controller['update']);router[_0xe581('0xe')]('/:id',auth[_0xe581('0x6')](),controller[_0xe581('0xf')]);module[_0xe581('0x10')]=router; \ No newline at end of file +var _0x368e=['get','isAuthenticated','index','describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatTransferReport.controller'];(function(_0xbaae28,_0x5657f5){var _0x542e54=function(_0x24e247){while(--_0x24e247){_0xbaae28['push'](_0xbaae28['shift']());}};_0x542e54(++_0x5657f5);}(_0x368e,0x196));var _0xe368=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x368e[_0x3337b6];return _0x568270;};'use strict';var multer=require(_0xe368('0x0'));var util=require(_0xe368('0x1'));var path=require(_0xe368('0x2'));var timeout=require(_0xe368('0x3'));var express=require('express');var router=express[_0xe368('0x4')]();var fs_extra=require(_0xe368('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe368('0x6'));var config=require('../../config/environment');var controller=require(_0xe368('0x7'));router[_0xe368('0x8')]('/',auth[_0xe368('0x9')](),controller[_0xe368('0xa')]);router[_0xe368('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe368('0xb')]);router[_0xe368('0x8')](_0xe368('0xc'),auth[_0xe368('0x9')](),controller[_0xe368('0xd')]);router[_0xe368('0xe')]('/',auth[_0xe368('0x9')](),controller['create']);router[_0xe368('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe368('0x10')]);router['delete'](_0xe368('0xc'),auth[_0xe368('0x9')](),controller['destroy']);module[_0xe368('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index d2b589e..2c90e86 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 _0xd80c=['TEXT','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback','star','stringify','name','text','input','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY'];(function(_0x2c6777,_0x29aaff){var _0xa0c123=function(_0x572849){while(--_0x572849){_0x2c6777['push'](_0x2c6777['shift']());}};_0xa0c123(++_0x29aaff);}(_0xd80c,0x17a));var _0xcd80=function(_0x8076fc,_0x53ca55){_0x8076fc=_0x8076fc-0x0;var _0x118b6f=_0xd80c[_0x8076fc];return _0x118b6f;};'use strict';var Sequelize=require(_0xcd80('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xcd80('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xcd80('0x1')],'allowNull':![],'unique':_0xcd80('0x2')},'description':{'type':Sequelize[_0xcd80('0x1')]},'mapKey':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x3')},'mapKeyOffline':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xcd80('0x1')],'allowNull':![],'defaultValue':_0xcd80('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xcd80('0x1')],'allowNull':![],'defaultValue':_0xcd80('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcd80('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xcd80('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xcd80('0x1')]},'animation':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcd80('0x8')](_0xcd80('0x9'),'squared'),'defaultValue':_0xcd80('0x9')},'header_online':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0xb')},'offline_chat_button':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0xc')},'download_transcript':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcd80('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xcd80('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0xf')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x10')},'closingMessage':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x11')},'closingMessageButton':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x12')},'skipMessageButton':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x13')},'ratingType':{'type':Sequelize[_0xcd80('0x8')](_0xcd80('0x14'),'thumb'),'defaultValue':_0xcd80('0x14')},'ratingStarsNumber':{'type':Sequelize[_0xcd80('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':function(){return JSON[_0xcd80('0x15')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xcd80('0x16'),'type':_0xcd80('0x17'),'required':!![]},'props':{'title':_0xcd80('0x16'),'helpText':''}},{'type':_0xcd80('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xcd80('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xcd80('0x19'))?JSON[_0xcd80('0x1a')](this[_0xcd80('0x1b')](_0xcd80('0x19'))):{};},'set':function(_0x1c7bf1){return this[_0xcd80('0x1c')](_0xcd80('0x19'),JSON['stringify'](_0x1c7bf1));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xcd80('0x15')]({'items':[{'type':_0xcd80('0x18'),'props':{'title':_0xcd80('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xcd80('0x3'),'type':'email'},'variable':null},{'type':_0xcd80('0x1d'),'config':{'placeholder':_0xcd80('0x1e')},'props':{'title':'Comments','helpText':_0xcd80('0x1f')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xcd80('0x20'))?JSON[_0xcd80('0x1a')](this[_0xcd80('0x1b')](_0xcd80('0x20'))):{};},'set':function(_0x8a4ec4){return this[_0xcd80('0x1c')](_0xcd80('0x20'),JSON[_0xcd80('0x15')](_0x8a4ec4));}},'token':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':function(){return rs[_0xcd80('0x21')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xcd80('0x1')]},'forwardOffline':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xcd80('0x1')]},'waitingTitle':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x24')},'offlineMessageBody':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x26')},'skipUnmanaged':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x27')},'sendUnmanaged':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x12')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xcd80('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':function(){return _0xcd80('0x28');}},'notificationSound':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x2a')},'verticalAlignment':{'type':Sequelize[_0xcd80('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x2b')},'messagesAlignment':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xcd80('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcd80('0x1')],'allowNull':![],'defaultValue':_0xcd80('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':_0xcd80('0x2d')},'systemAvatar':{'type':Sequelize[_0xcd80('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd80('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcd80('0x2e'),'set':function(_0x1e1e48){if(!_0x1e1e48)this[_0xcd80('0x1c')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xcd80('0x2f'),_0x1e1e48);}},'vidaooEscalation':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xcd80('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xcd80('0x1')],'defaultValue':function(){return _0xcd80('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xcd80('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xcd80('0xe')]}}; \ No newline at end of file +var _0x5b03=['TEXT','name','text','input','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','CHAT','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb'];(function(_0x3272e3,_0x2db4a5){var _0xb2f245=function(_0x4fe8a1){while(--_0x4fe8a1){_0x3272e3['push'](_0x3272e3['shift']());}};_0xb2f245(++_0x2db4a5);}(_0x5b03,0x145));var _0x35b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x35b0('0x0'));var rs=require(_0x35b0('0x1'));module[_0x35b0('0x2')]={'name':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'unique':_0x35b0('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':_0x35b0('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x35b0('0x8')](_0x35b0('0x9'),_0x35b0('0xa')),'defaultValue':_0x35b0('0x9')},'header_online':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xb')},'start_chat_button':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xc')},'offline_chat_button':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xd')},'header_offline':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xe')},'download_transcript':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x35b0('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x14')},'closingMessageButton':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xd')},'skipMessageButton':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x15')},'conditionAgreement':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x16')},'ratingType':{'type':Sequelize[_0x35b0('0x8')](_0x35b0('0x17'),_0x35b0('0x18')),'defaultValue':_0x35b0('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x35b0('0x10')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x35b0('0x19')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x35b0('0x1a'),'type':_0x35b0('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x35b0('0x1c'),'props':{'title':_0x35b0('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x35b0('0x5'),'type':_0x35b0('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x35b0('0x1d')](_0x35b0('0x1e'))?JSON['parse'](this[_0x35b0('0x1d')](_0x35b0('0x1e'))):{};},'set':function(_0x886d1c){return this[_0x35b0('0x1f')]('onlineForm',JSON[_0x35b0('0x20')](_0x886d1c));}},'offlineForm':{'type':Sequelize[_0x35b0('0x19')],'defaultValue':function(){return JSON[_0x35b0('0x20')]({'items':[{'type':_0x35b0('0x1c'),'props':{'title':_0x35b0('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x35b0('0x5'),'type':'email'},'variable':null},{'type':_0x35b0('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x35b0('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x35b0('0x1d')]('offlineForm')?JSON[_0x35b0('0x23')](this['getDataValue'](_0x35b0('0x24'))):{};},'set':function(_0x550f10){return this['setDataValue'](_0x35b0('0x24'),JSON[_0x35b0('0x20')](_0x550f10));}},'token':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':function(){return rs[_0x35b0('0x25')]();}},'autoclose':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x35b0('0x3')]},'forwardOffline':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x35b0('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x26')},'waitingMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x35b0('0x15')},'sendUnmanaged':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x35b0('0x19')]},'showAgentAvatar':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x35b0('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x35b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x2b')},'messagesAlignment':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x35b0('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':_0x35b0('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x35b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x35b0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':_0x35b0('0x2d')},'systemAvatar':{'type':Sequelize[_0x35b0('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x35b0('0x2e'),'set':function(_0x4d654e){if(!_0x4d654e)this[_0x35b0('0x1f')](_0x35b0('0x2f'),null);this['setDataValue'](_0x35b0('0x30'),_0x4d654e);}},'vidaooEscalation':{'type':Sequelize[_0x35b0('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x35b0('0x3')]},'vidaooTopic':{'type':Sequelize[_0x35b0('0x3')],'allowNull':![],'defaultValue':_0x35b0('0x31')},'vidaooNote':{'type':Sequelize[_0x35b0('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x35b0('0x19')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 09c0a19..bf6dfd1 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 _0x509c=['UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','download','notify','user-agent-parser','setUA','headers','user-agent','ValidationError','difference','updatedAt','CompanyId','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','List','list','orderBy','priority','asc','account','ListId','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','applications','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','forcedOwnership','startRouting','EventManager','offline','files','no\x20available\x20attributes','createdAt','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','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','notifyMail','remove','addInteraction','omit','Contact','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','getSnippet','Interval','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','Intervals','push','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','color_button','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','ChatProactiveAction','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','html-to-text','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','destroy','get','ChatWebsites','stack','name','send','index','Pause','map','ChatWebsite','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x44fc74,_0xe2ab0d){var _0x3cc2ba=function(_0x36a7ff){while(--_0x36a7ff){_0x44fc74['push'](_0x44fc74['shift']());}};_0x3cc2ba(++_0xe2ab0d);}(_0x509c,0xd4));var _0xc509=function(_0x329232,_0x5752b2){_0x329232=_0x329232-0x0;var _0x36c515=_0x509c[_0x329232];return _0x36c515;};'use strict';var BPromise=require(_0xc509('0x0'));var Mustache=require(_0xc509('0x1'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xc509('0x2'));var Redis=require(_0xc509('0x3'));var qs=require(_0xc509('0x4'));var logger=require(_0xc509('0x5'))('api');var config=require('../../config/environment');var db=require(_0xc509('0x6'))['db'];config[_0xc509('0x7')]=_[_0xc509('0x8')](config[_0xc509('0x7')],{'host':_0xc509('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc509('0x7')]));require('./chatWebsite.socket')['register'](socket);var htmlToText=require(_0xc509('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc509('0xb')]['http']({'port':0x232c});var client9002=jayson[_0xc509('0xb')]['http']({'port':0x232a});var client9003=jayson['client'][_0xc509('0xc')]({'port':0x232b});var client9001=jayson[_0xc509('0xb')][_0xc509('0xc')]({'port':0x2329});function respondWithRpcPromise(_0x5e7914,_0x4bf702,_0x5d335b,_0x2f4d03){return new BPromise(function(_0x5886b7,_0x487fee){var _0x44501e=_0x2f4d03||client;return _0x44501e[_0xc509('0xd')](_0x5e7914,_0x5d335b)[_0xc509('0xe')](function(_0x8bed90){logger['info'](_0xc509('0xf'),_0x4bf702,_0xc509('0x10'));logger[_0xc509('0x11')](_0xc509('0x12'),_0x4bf702,_0xc509('0x10'),JSON['stringify'](_0x8bed90));if(_0x8bed90[_0xc509('0x13')]){if(_0x8bed90[_0xc509('0x13')][_0xc509('0x14')]===0x1f4){logger[_0xc509('0x13')](_0xc509('0xf'),_0x4bf702,_0x8bed90['error'][_0xc509('0x15')]);return _0x487fee(_0x8bed90['error'][_0xc509('0x15')]);}logger[_0xc509('0x13')](_0xc509('0xf'),_0x4bf702,_0x8bed90[_0xc509('0x13')]['message']);return _0x5886b7(_0x8bed90['error'][_0xc509('0x15')]);}else{logger[_0xc509('0x16')](_0xc509('0xf'),_0x4bf702,_0xc509('0x10'));_0x5886b7(_0x8bed90[_0xc509('0x17')][_0xc509('0x15')]);}})[_0xc509('0x18')](function(_0x26029a){logger[_0xc509('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x4bf702,_0x26029a);_0x487fee(_0x26029a);});});}function respondWithStatusCode(_0xf56d54,_0xa5070c){_0xa5070c=_0xa5070c||0xcc;return function(_0x42add4){if(_0x42add4){return _0xf56d54[_0xc509('0x19')](_0xa5070c);}return _0xf56d54[_0xc509('0x1a')](_0xa5070c)[_0xc509('0x1b')]();};}function respondWithResult(_0x163573,_0xe1ed51){_0xe1ed51=_0xe1ed51||0xc8;return function(_0x3e7f6a){if(_0x3e7f6a){return _0x163573[_0xc509('0x1a')](_0xe1ed51)[_0xc509('0x1c')](_0x3e7f6a);}};}function respondWithFilteredResult(_0x1de209,_0x41d80f){return function(_0x4618fd){if(_0x4618fd){var _0x6d561a=typeof _0x41d80f[_0xc509('0x1d')]===_0xc509('0x1e')&&typeof _0x41d80f['limit']===_0xc509('0x1e');var _0x191bdb=_0x4618fd['count'];var _0x40d01f=_0x6d561a?0x0:_0x41d80f['offset'];var _0x1132d4=_0x6d561a?_0x4618fd[_0xc509('0x1f')]:_0x41d80f[_0xc509('0x1d')]+_0x41d80f[_0xc509('0x20')];var _0x12bece;if(_0x1132d4>=_0x191bdb){_0x1132d4=_0x191bdb;_0x12bece=0xc8;}else{_0x12bece=0xce;}_0x1de209['status'](_0x12bece);return _0x1de209['set'](_0xc509('0x21'),_0x40d01f+'-'+_0x1132d4+'/'+_0x191bdb)[_0xc509('0x1c')](_0x4618fd);}return null;};}function saveUpdates(_0x2e3ea6){return function(_0x3e5ee5){if(_0x3e5ee5){return _0x3e5ee5[_0xc509('0x22')](_0x2e3ea6)[_0xc509('0xe')](function(_0x564066){return _0x564066;});}return null;};}function removeEntity(_0x38512b){return function(_0x44f19c){if(_0x44f19c){return _0x44f19c[_0xc509('0x23')]()[_0xc509('0xe')](function(){var _0x106fb8=_0x44f19c[_0xc509('0x24')]({'plain':!![]});var _0x4e9fbf=_0xc509('0x25');return db['UserProfileResource'][_0xc509('0x23')]({'where':{'type':_0x4e9fbf,'resourceId':_0x106fb8['id']}})[_0xc509('0xe')](function(){return _0x44f19c;});})[_0xc509('0xe')](function(){_0x38512b[_0xc509('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8884){return function(_0x192461){if(!_0x192461){_0x5e8884['sendStatus'](0x194);}return _0x192461;};}function handleError(_0x435b23,_0x3ae766){_0x3ae766=_0x3ae766||0x1f4;return function(_0x4e7fa7){logger[_0xc509('0x13')](_0x4e7fa7[_0xc509('0x26')]);if(_0x4e7fa7[_0xc509('0x27')]){delete _0x4e7fa7[_0xc509('0x27')];}_0x435b23['status'](_0x3ae766)[_0xc509('0x28')](_0x4e7fa7);};}exports[_0xc509('0x29')]=function(_0x216353,_0x2bee8c){var _0x29cc51={'include':[{'model':db[_0xc509('0x2a')],'as':'mandatoryDispositionPause'}]},_0x4110a6={},_0x3f7088={'count':0x0,'rows':[]};var _0x2c6791=_[_0xc509('0x2b')](db[_0xc509('0x2c')]['rawAttributes'],function(_0x363bd4){return{'name':_0x363bd4[_0xc509('0x2d')],'type':_0x363bd4[_0xc509('0x2e')][_0xc509('0x2f')]};});_0x4110a6[_0xc509('0x30')]=_[_0xc509('0x2b')](_0x2c6791,_0xc509('0x27'));_0x4110a6['query']=_['keys'](_0x216353[_0xc509('0x31')]);_0x4110a6[_0xc509('0x32')]=_[_0xc509('0x33')](_0x4110a6[_0xc509('0x30')],_0x4110a6[_0xc509('0x31')]);_0x29cc51['attributes']=_[_0xc509('0x33')](_0x4110a6[_0xc509('0x30')],qs[_0xc509('0x34')](_0x216353['query'][_0xc509('0x34')]));_0x29cc51['attributes']=_0x29cc51['attributes'][_0xc509('0x35')]?_0x29cc51[_0xc509('0x36')]:_0x4110a6[_0xc509('0x30')];if(!_0x216353['query'][_0xc509('0x37')](_0xc509('0x38'))){_0x29cc51['limit']=qs[_0xc509('0x20')](_0x216353[_0xc509('0x31')][_0xc509('0x20')]);_0x29cc51[_0xc509('0x1d')]=qs[_0xc509('0x1d')](_0x216353[_0xc509('0x31')]['offset']);}_0x29cc51[_0xc509('0x39')]=qs[_0xc509('0x3a')](_0x216353['query']['sort']);_0x29cc51[_0xc509('0x3b')]=qs['filters'](_[_0xc509('0x3c')](_0x216353[_0xc509('0x31')],_0x4110a6[_0xc509('0x32')]),_0x2c6791);if(_0x216353[_0xc509('0x31')][_0xc509('0x3d')]){_0x29cc51[_0xc509('0x3b')]=_['merge'](_0x29cc51[_0xc509('0x3b')],{'$or':_[_0xc509('0x2b')](_0x2c6791,function(_0x18f60c){if(_0x18f60c[_0xc509('0x2e')]!==_0xc509('0x3e')){var _0x4c32b9={};_0x4c32b9[_0x18f60c[_0xc509('0x27')]]={'$like':'%'+_0x216353[_0xc509('0x31')][_0xc509('0x3d')]+'%'};return _0x4c32b9;}})});}_0x29cc51=_[_0xc509('0x3f')]({},_0x29cc51,_0x216353[_0xc509('0x40')]);var _0x4e2f78={'where':_0x29cc51[_0xc509('0x3b')]};return db[_0xc509('0x2c')]['count'](_0x4e2f78)['then'](function(_0x31b407){_0x3f7088[_0xc509('0x1f')]=_0x31b407;if(_0x216353[_0xc509('0x31')][_0xc509('0x41')]){_0x29cc51[_0xc509('0x42')]=[{'all':!![]}];}return db[_0xc509('0x2c')]['findAll'](_0x29cc51);})[_0xc509('0xe')](function(_0x1d76dd){_0x3f7088[_0xc509('0x43')]=_0x1d76dd;return _0x3f7088;})[_0xc509('0xe')](respondWithFilteredResult(_0x2bee8c,_0x29cc51))['catch'](handleError(_0x2bee8c,null));};exports[_0xc509('0x44')]=function(_0x460857,_0x5f47e0){var _0x4c820e={'raw':![],'where':{'id':_0x460857[_0xc509('0x45')]['id']},'include':[{'model':db[_0xc509('0x2a')],'as':'mandatoryDispositionPause'}]},_0x181da4={};_0x181da4[_0xc509('0x30')]=_[_0xc509('0x46')](db[_0xc509('0x2c')][_0xc509('0x47')]);_0x181da4['query']=_[_0xc509('0x46')](_0x460857[_0xc509('0x31')]);_0x181da4['filters']=_[_0xc509('0x33')](_0x181da4[_0xc509('0x30')],_0x181da4[_0xc509('0x31')]);_0x4c820e[_0xc509('0x36')]=_[_0xc509('0x33')](_0x181da4[_0xc509('0x30')],qs[_0xc509('0x34')](_0x460857[_0xc509('0x31')][_0xc509('0x34')]));_0x4c820e[_0xc509('0x36')]=_0x4c820e[_0xc509('0x36')][_0xc509('0x35')]?_0x4c820e[_0xc509('0x36')]:_0x181da4[_0xc509('0x30')];if(_0x460857[_0xc509('0x31')][_0xc509('0x41')]){_0x4c820e[_0xc509('0x42')]=[{'all':!![]}];}_0x4c820e=_['merge']({},_0x4c820e,_0x460857[_0xc509('0x40')]);return db[_0xc509('0x2c')]['find'](_0x4c820e)['then'](handleEntityNotFound(_0x5f47e0,null))[_0xc509('0xe')](respondWithResult(_0x5f47e0,null))['catch'](handleError(_0x5f47e0,null));};exports['create']=function(_0x347533,_0x561cbc){return db['ChatWebsite'][_0xc509('0x48')](_0x347533['body'],{})[_0xc509('0xe')](function(_0x4334be){var _0x2f4c87=_0x347533['user'][_0xc509('0x24')]({'plain':!![]});if(!_0x2f4c87)throw new Error(_0xc509('0x49'));if(_0x2f4c87['role']===_0xc509('0x4a')){var _0x5b7104=_0x4334be['get']({'plain':!![]});var _0x21f3dc=_0xc509('0x25');return db[_0xc509('0x4b')][_0xc509('0x4c')]({'where':{'name':_0x21f3dc,'userProfileId':_0x2f4c87[_0xc509('0x4d')]},'raw':!![]})[_0xc509('0xe')](function(_0x5779a9){if(_0x5779a9&&_0x5779a9[_0xc509('0x4e')]===0x0){return db['UserProfileResource'][_0xc509('0x48')]({'name':_0x5b7104[_0xc509('0x27')],'resourceId':_0x5b7104['id'],'type':_0x5779a9[_0xc509('0x27')],'sectionId':_0x5779a9['id']},{})[_0xc509('0xe')](function(){return _0x4334be;});}else{return _0x4334be;}})[_0xc509('0x18')](function(_0x255496){logger[_0xc509('0x13')](_0xc509('0x4f'),_0x255496);throw _0x255496;});}return _0x4334be;})[_0xc509('0xe')](respondWithResult(_0x561cbc,0xc9))[_0xc509('0x18')](handleError(_0x561cbc,null));};exports[_0xc509('0x22')]=function(_0x22b11d,_0x2f216b){if(_0x22b11d[_0xc509('0x50')]['id']){delete _0x22b11d[_0xc509('0x50')]['id'];}return db['ChatWebsite'][_0xc509('0x4c')]({'where':{'id':_0x22b11d[_0xc509('0x45')]['id']},'include':[{'model':db[_0xc509('0x2a')],'as':_0xc509('0x51')}]})['then'](handleEntityNotFound(_0x2f216b,null))[_0xc509('0xe')](saveUpdates(_0x22b11d[_0xc509('0x50')],null))['then'](respondWithResult(_0x2f216b,null))[_0xc509('0x18')](handleError(_0x2f216b,null));};exports[_0xc509('0x23')]=function(_0x525303,_0x5bc3c6){return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x525303['params']['id']}})['then'](handleEntityNotFound(_0x5bc3c6,null))['then'](removeEntity(_0x5bc3c6,null))[_0xc509('0x18')](handleError(_0x5bc3c6,null));};exports[_0xc509('0x52')]=function(_0x52e0cb,_0x3fb488){return db[_0xc509('0x2c')][_0xc509('0x52')]()[_0xc509('0xe')](respondWithResult(_0x3fb488,null))[_0xc509('0x18')](handleError(_0x3fb488,null));};exports[_0xc509('0x53')]=function(_0x2fed40,_0x5096c8){if(_0x2fed40[_0xc509('0x50')]['id']){delete _0x2fed40[_0xc509('0x50')]['id'];}return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x2fed40[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x5096c8,null))['then'](function(_0x5602c4){if(_0x5602c4){_0x2fed40[_0xc509('0x50')][_0xc509('0x54')]=_0x5602c4['id'];return db[_0xc509('0x55')][_0xc509('0x48')](_0x2fed40[_0xc509('0x50')]);}})['then'](respondWithResult(_0x5096c8,null))[_0xc509('0x18')](handleError(_0x5096c8,null));};exports[_0xc509('0x56')]=function(_0x1078dd,_0x532fbf){var _0x1a5d6c={'raw':![],'where':{}};var _0x3c7796={};var _0x31c3aa={'count':0x0,'rows':[]};return db[_0xc509('0x2c')]['findOne']({'where':{'id':_0x1078dd[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x532fbf,null))[_0xc509('0xe')](function(_0xa9f620){if(_0xa9f620){_0x3c7796[_0xc509('0x30')]=_[_0xc509('0x46')](db[_0xc509('0x55')][_0xc509('0x47')]);_0x3c7796[_0xc509('0x31')]=_[_0xc509('0x46')](_0x1078dd[_0xc509('0x31')]);_0x3c7796[_0xc509('0x32')]=_['intersection'](_0x3c7796[_0xc509('0x30')],_0x3c7796[_0xc509('0x31')]);_0x1a5d6c[_0xc509('0x36')]=_[_0xc509('0x33')](_0x3c7796[_0xc509('0x30')],qs['fields'](_0x1078dd[_0xc509('0x31')]['fields']));_0x1a5d6c[_0xc509('0x36')]=_0x1a5d6c[_0xc509('0x36')][_0xc509('0x35')]?_0x1a5d6c[_0xc509('0x36')]:_0x3c7796[_0xc509('0x30')];if(!_0x1078dd[_0xc509('0x31')][_0xc509('0x37')](_0xc509('0x38'))){_0x1a5d6c[_0xc509('0x20')]=qs[_0xc509('0x20')](_0x1078dd[_0xc509('0x31')][_0xc509('0x20')]);_0x1a5d6c[_0xc509('0x1d')]=qs[_0xc509('0x1d')](_0x1078dd[_0xc509('0x31')]['offset']);}_0x1a5d6c[_0xc509('0x39')]=qs[_0xc509('0x3a')](_0x1078dd['query'][_0xc509('0x3a')]);_0x1a5d6c[_0xc509('0x3b')]=qs[_0xc509('0x32')](_[_0xc509('0x3c')](_0x1078dd[_0xc509('0x31')],_0x3c7796['filters']));_0x1a5d6c[_0xc509('0x3b')]['ChatWebsiteId']=_0xa9f620['id'];if(_0x1078dd['query'][_0xc509('0x3d')]){_0x1a5d6c[_0xc509('0x3b')]=_[_0xc509('0x3f')](_0x1a5d6c[_0xc509('0x3b')],{'$or':_['map'](_0x1a5d6c[_0xc509('0x36')],function(_0x100dda){var _0x3d29fa={};_0x3d29fa[_0x100dda]={'$like':'%'+_0x1078dd[_0xc509('0x31')][_0xc509('0x3d')]+'%'};return _0x3d29fa;})});}_0x1a5d6c=_[_0xc509('0x3f')]({},_0x1a5d6c,_0x1078dd[_0xc509('0x40')]);return db['Disposition'][_0xc509('0x1f')]({'where':_0x1a5d6c['where']})['then'](function(_0x4b132a){_0x31c3aa[_0xc509('0x1f')]=_0x4b132a;if(_0x1078dd[_0xc509('0x31')]['includeAll']){_0x1a5d6c[_0xc509('0x42')]=[{'all':!![]}];}return db[_0xc509('0x55')][_0xc509('0x57')](_0x1a5d6c);})['then'](function(_0x4dda35){_0x31c3aa['rows']=_0x4dda35;return _0x31c3aa;});}})[_0xc509('0xe')](respondWithFilteredResult(_0x532fbf,_0x1a5d6c))[_0xc509('0x18')](handleError(_0x532fbf,null));};exports['removeDispositions']=function(_0x12608a,_0x239e09){return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x12608a[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x239e09,null))[_0xc509('0xe')](function(_0xdd2b06){if(_0xdd2b06){return _0xdd2b06[_0xc509('0x58')](_0x12608a[_0xc509('0x31')][_0xc509('0x59')]);}})['then'](respondWithStatusCode(_0x239e09,null))[_0xc509('0x18')](handleError(_0x239e09,null));};exports['addAnswer']=function(_0x42b908,_0x1220c1){if(_0x42b908[_0xc509('0x50')]['id']){delete _0x42b908[_0xc509('0x50')]['id'];}return db['ChatWebsite'][_0xc509('0x4c')]({'where':{'id':_0x42b908[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x1220c1,null))['then'](function(_0x884c3c){if(_0x884c3c){_0x42b908[_0xc509('0x50')][_0xc509('0x54')]=_0x884c3c['id'];return db[_0xc509('0x5a')][_0xc509('0x48')](_0x42b908[_0xc509('0x50')]);}})[_0xc509('0xe')](respondWithResult(_0x1220c1,null))[_0xc509('0x18')](handleError(_0x1220c1,null));};exports[_0xc509('0x5b')]=function(_0x1fd8c7,_0x4c7ab2){var _0x452056={'raw':![],'where':{}};var _0x9dc85b={};var _0x33476a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc509('0x5c')]({'where':{'id':_0x1fd8c7[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x4c7ab2,null))[_0xc509('0xe')](function(_0x36deee){if(_0x36deee){_0x9dc85b[_0xc509('0x30')]=_[_0xc509('0x46')](db[_0xc509('0x5a')][_0xc509('0x47')]);_0x9dc85b[_0xc509('0x31')]=_[_0xc509('0x46')](_0x1fd8c7[_0xc509('0x31')]);_0x9dc85b[_0xc509('0x32')]=_[_0xc509('0x33')](_0x9dc85b[_0xc509('0x30')],_0x9dc85b[_0xc509('0x31')]);_0x452056[_0xc509('0x36')]=_[_0xc509('0x33')](_0x9dc85b['model'],qs[_0xc509('0x34')](_0x1fd8c7[_0xc509('0x31')]['fields']));_0x452056[_0xc509('0x36')]=_0x452056['attributes'][_0xc509('0x35')]?_0x452056[_0xc509('0x36')]:_0x9dc85b[_0xc509('0x30')];if(!_0x1fd8c7['query'][_0xc509('0x37')](_0xc509('0x38'))){_0x452056[_0xc509('0x20')]=qs[_0xc509('0x20')](_0x1fd8c7[_0xc509('0x31')][_0xc509('0x20')]);_0x452056['offset']=qs[_0xc509('0x1d')](_0x1fd8c7[_0xc509('0x31')][_0xc509('0x1d')]);}_0x452056['order']=qs[_0xc509('0x3a')](_0x1fd8c7[_0xc509('0x31')][_0xc509('0x3a')]);_0x452056[_0xc509('0x3b')]=qs[_0xc509('0x32')](_[_0xc509('0x3c')](_0x1fd8c7[_0xc509('0x31')],_0x9dc85b[_0xc509('0x32')]));_0x452056[_0xc509('0x3b')][_0xc509('0x54')]=_0x36deee['id'];if(_0x1fd8c7[_0xc509('0x31')][_0xc509('0x3d')]){_0x452056[_0xc509('0x3b')]=_['merge'](_0x452056['where'],{'$or':_['map'](_0x452056[_0xc509('0x36')],function(_0x23087e){var _0x2f40ea={};_0x2f40ea[_0x23087e]={'$like':'%'+_0x1fd8c7[_0xc509('0x31')][_0xc509('0x3d')]+'%'};return _0x2f40ea;})});}_0x452056=_['merge']({},_0x452056,_0x1fd8c7[_0xc509('0x40')]);return db[_0xc509('0x5a')]['count']({'where':_0x452056[_0xc509('0x3b')]})[_0xc509('0xe')](function(_0x3e0e60){_0x33476a[_0xc509('0x1f')]=_0x3e0e60;if(_0x1fd8c7[_0xc509('0x31')][_0xc509('0x41')]){_0x452056[_0xc509('0x42')]=[{'all':!![]}];}return db[_0xc509('0x5a')][_0xc509('0x57')](_0x452056);})['then'](function(_0x5e9efd){_0x33476a[_0xc509('0x43')]=_0x5e9efd;return _0x33476a;});}})[_0xc509('0xe')](respondWithFilteredResult(_0x4c7ab2,_0x452056))['catch'](handleError(_0x4c7ab2,null));};exports['removeAnswers']=function(_0x2b0a12,_0x41f136){return db[_0xc509('0x2c')]['find']({'where':{'id':_0x2b0a12['params']['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x41f136,null))['then'](function(_0x779a1e){if(_0x779a1e){return _0x779a1e[_0xc509('0x5d')](_0x2b0a12[_0xc509('0x31')]['ids']);}})[_0xc509('0xe')](respondWithStatusCode(_0x41f136,null))[_0xc509('0x18')](handleError(_0x41f136,null));};exports[_0xc509('0x5e')]=function(_0x3ca957,_0x4c38bc){_0x3ca957[_0xc509('0x50')][_0xc509('0x5f')]=_0x3ca957[_0xc509('0x60')][_0xc509('0x61')];return db['ChatWebsite'][_0xc509('0x4c')]({'where':{'id':_0x3ca957[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x4c38bc,null))[_0xc509('0xe')](saveUpdates(_0x3ca957[_0xc509('0x50')],null))[_0xc509('0xe')](respondWithResult(_0x4c38bc,null))[_0xc509('0x18')](handleError(_0x4c38bc,null));};exports['addAvatar']=function(_0x3e6c0d,_0x5aaecf){_0x3e6c0d[_0xc509('0x50')][_0xc509('0x62')]=_0x3e6c0d['file'][_0xc509('0x61')];return db[_0xc509('0x2c')]['find']({'where':{'id':_0x3e6c0d['params']['id']}})['then'](handleEntityNotFound(_0x5aaecf,null))[_0xc509('0xe')](saveUpdates(_0x3e6c0d[_0xc509('0x50')],null))['then'](respondWithResult(_0x5aaecf,null))[_0xc509('0x18')](handleError(_0x5aaecf,null));};exports[_0xc509('0x63')]=function(_0x389fca,_0x10a558){_0x389fca[_0xc509('0x50')][_0xc509('0x64')]=_0x389fca[_0xc509('0x60')][_0xc509('0x61')];return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x389fca[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x10a558,null))[_0xc509('0xe')](saveUpdates(_0x389fca[_0xc509('0x50')],null))[_0xc509('0xe')](respondWithResult(_0x10a558,null))[_0xc509('0x18')](handleError(_0x10a558,null));};exports[_0xc509('0x65')]=function(_0x163859,_0x580a31){_0x163859[_0xc509('0x50')][_0xc509('0x66')]=_0x163859[_0xc509('0x60')][_0xc509('0x61')];return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x163859[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x580a31,null))[_0xc509('0xe')](saveUpdates(_0x163859[_0xc509('0x50')],null))['then'](respondWithResult(_0x580a31,null))['catch'](handleError(_0x580a31,null));};exports[_0xc509('0x67')]=function(_0x5ad9a9,_0x5e5f16){var _0x2f4f02=path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0x6a'));var _0x39dba1={'where':{'id':_0x5ad9a9[_0xc509('0x45')]['id']},'attributes':['id',_0xc509('0x5f')],'raw':!![]};var _0x545f4d=![];return require(_0xc509('0x6b'))['getLicense']()[_0xc509('0xe')](function(_0x1db97d){if(_0x1db97d){_0x545f4d=_0x1db97d[_0xc509('0x6c')];}})[_0xc509('0xe')](function(){return db[_0xc509('0x2c')][_0xc509('0x4c')](_0x39dba1);})[_0xc509('0xe')](handleEntityNotFound(_0x5e5f16,null))[_0xc509('0xe')](function(_0x314041){if(_0x314041){if(!_[_0xc509('0x6d')](_0x314041['sitepic'])){if(fs[_0xc509('0x6e')](path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0x6f'),_0x314041[_0xc509('0x5f')]))&&_0x545f4d){_0x2f4f02=path[_0xc509('0x68')](config['root'],_0xc509('0x6f'),_0x314041[_0xc509('0x5f')]);}}return _0x5e5f16['download'](_0x2f4f02);}})[_0xc509('0x18')](handleError(_0x5e5f16,null));};exports[_0xc509('0x70')]=function(_0x2e520d,_0x27e9d0){var _0x238846=path[_0xc509('0x68')](config[_0xc509('0x69')],'server/files/images/avatars/default_avatar.png');var _0x21c37b={'where':{'id':_0x2e520d[_0xc509('0x45')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xc509('0x2c')][_0xc509('0x4c')](_0x21c37b)['then'](handleEntityNotFound(_0x27e9d0,null))[_0xc509('0xe')](function(_0x48ea6e){if(_0x48ea6e){if(!_[_0xc509('0x6d')](_0x48ea6e[_0xc509('0x62')])){if(fs['existsSync'](path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0x71'),_0x48ea6e['agentAvatar']))){_0x238846=path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0x71'),_0x48ea6e[_0xc509('0x62')]);}}return _0x27e9d0['download'](_0x238846);}})[_0xc509('0x18')](handleError(_0x27e9d0,null));};exports[_0xc509('0x72')]=function(_0x4cd980,_0x31998b){var _0x423e5e=path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0x73'));var _0x2fc69f={'where':{'id':_0x4cd980[_0xc509('0x45')]['id']},'attributes':['id',_0xc509('0x64'),_0xc509('0x74')],'raw':!![]};return db['ChatWebsite'][_0xc509('0x4c')](_0x2fc69f)['then'](handleEntityNotFound(_0x31998b,null))['then'](function(_0x2b1229){if(_0x2b1229){if(!_['isNil'](_0x2b1229[_0xc509('0x64')])){if(fs[_0xc509('0x6e')](path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0x71'),_0x2b1229[_0xc509('0x64')]))&&_0x2b1229[_0xc509('0x74')]){_0x423e5e=path[_0xc509('0x68')](config[_0xc509('0x69')],'server/files/images/avatars/',_0x2b1229[_0xc509('0x64')]);}}return _0x31998b['download'](_0x423e5e);}})[_0xc509('0x18')](handleError(_0x31998b,null));};exports['getSystemAvatar']=function(_0x27fa31,_0x15aa93){var _0x462579=path['join'](config['root'],_0xc509('0x75'));var _0xcf7b11={'where':{'id':_0x27fa31[_0xc509('0x45')]['id']},'attributes':['id',_0xc509('0x66')],'raw':!![]};return db[_0xc509('0x2c')][_0xc509('0x4c')](_0xcf7b11)['then'](handleEntityNotFound(_0x15aa93,null))[_0xc509('0xe')](function(_0x28ef2b){if(_0x28ef2b){if(!_['isNil'](_0x28ef2b['systemAvatar'])){if(fs[_0xc509('0x6e')](path['join'](config[_0xc509('0x69')],_0xc509('0x71'),_0x28ef2b[_0xc509('0x66')]))){_0x462579=path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0x71'),_0x28ef2b['systemAvatar']);}}return _0x15aa93[_0xc509('0x76')](_0x462579);}})[_0xc509('0x18')](handleError(_0x15aa93,null));};exports[_0xc509('0x77')]=function(_0x17d67c,_0x26944c){var _0x135d0f=require(_0xc509('0x78'));var _0x19af4c=new _0x135d0f();var _0x3780a0=_0x19af4c[_0xc509('0x79')](_0x17d67c[_0xc509('0x7a')][_0xc509('0x7b')])['getResult']();var _0x4f566f={'body':_0x17d67c[_0xc509('0x50')],'channel':'chat'};var _0xb96c1d=[];var _0x44bae7=[];var _0x10a78e={};var _0x228915=![];return db['CmContact']['describe']()[_0xc509('0xe')](function(_0x37de4d){if(!_0x37de4d){throw new db['Sequelize'][(_0xc509('0x7c'))]('no\x20available\x20attributes');}_0xb96c1d=_[_0xc509('0x7d')](_[_0xc509('0x46')](_0x37de4d),['createdAt',_0xc509('0x7e')]);_0x44bae7=_[_0xc509('0x7d')](_[_0xc509('0x46')](_0x37de4d),['createdAt',_0xc509('0x7e'),_0xc509('0x7f'),'ListId']);if(_0x17d67c[_0xc509('0x50')]['id']){delete _0x17d67c[_0xc509('0x50')]['id'];}if(_[_0xc509('0x6d')](_0x17d67c[_0xc509('0x50')]['from'])){throw new db[(_0xc509('0x80'))][(_0xc509('0x7c'))](_0xc509('0x81'));}if(_[_0xc509('0x6d')](_0x17d67c[_0xc509('0x50')]['body'])||_0x17d67c[_0xc509('0x50')][_0xc509('0x50')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc509('0x6d')](_0x17d67c[_0xc509('0x50')][_0xc509('0x82')])){throw new db['Sequelize'][(_0xc509('0x7c'))](_0xc509('0x83')+_0x44bae7);}if(!_[_0xc509('0x84')](_0x44bae7,_0x17d67c['body'][_0xc509('0x82')])){throw new db[(_0xc509('0x80'))][(_0xc509('0x7c'))](_0xc509('0x85')+_0x44bae7);}_0x10a78e[_0x17d67c[_0xc509('0x50')]['mapKey']]=_0x17d67c['body'][_0xc509('0x86')];})[_0xc509('0xe')](function(){return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x17d67c[_0xc509('0x45')]['id']},'include':[{'model':db[_0xc509('0x87')],'as':'List','include':[{'model':db[_0xc509('0x88')],'as':_0xc509('0x89'),'where':_0x10a78e,'limit':0x1,'order':[[_0xc509('0x7e'),_0xc509('0x8a')]]}]},{'model':db[_0xc509('0x8b')],'as':_0xc509('0x8c')}]});})[_0xc509('0xe')](handleEntityNotFound(_0x26944c,null))[_0xc509('0xe')](function(_0x44b462){if(_0x44b462&&_0x44b462[_0xc509('0x8d')]){_0x4f566f['account']=_0x44b462;_0x4f566f['applications']=_0x44b462['Applications'];_0x4f566f[_0xc509('0x8e')]=_0x44b462[_0xc509('0x8d')];_0x4f566f['applications']=_[_0xc509('0x8f')](_0x4f566f['applications'],[_0xc509('0x90')],[_0xc509('0x91')]);if(_0x4f566f['account']['Applications']){delete _0x4f566f['account'][_0xc509('0x8c')];}if(_0x4f566f[_0xc509('0x92')][_0xc509('0x8d')]&&_0x4f566f[_0xc509('0x92')][_0xc509('0x8d')][_0xc509('0x89')]['length']){return _0x4f566f[_0xc509('0x92')][_0xc509('0x8d')][_0xc509('0x89')][0x0];}var _0x3f35fd=_[_0xc509('0x8')](_0x17d67c[_0xc509('0x50')],{'firstName':_0x17d67c[_0xc509('0x50')]['from'],'ListId':_0x44b462[_0xc509('0x93')]});_0x3f35fd[_0x17d67c[_0xc509('0x50')][_0xc509('0x82')]]=_0x17d67c[_0xc509('0x50')][_0xc509('0x86')];return db[_0xc509('0x88')][_0xc509('0x48')](_0x3f35fd,{'fields':_0xb96c1d,'raw':!![]});}})['then'](handleEntityNotFound(_0x26944c,null))[_0xc509('0xe')](function(_0xfef7a2){_0x4f566f['contact']=_0xfef7a2;var _0x2e794c=_0x17d67c[_0xc509('0x50')]['customerIp'];if(_0x17d67c[_0xc509('0x7a')][_0xc509('0x94')]){_0x2e794c=_0x17d67c[_0xc509('0x7a')][_0xc509('0x94')];}else if(_0x17d67c[_0xc509('0x7a')]['x-forwarded-for']){_0x2e794c=_['first'](_0x17d67c['headers'][_0xc509('0x95')][_0xc509('0x96')](','));}if(_0xfef7a2){var _0x7ab978={'ContactId':_0xfef7a2['id'],'ChatWebsiteId':_0x17d67c[_0xc509('0x45')]['id'],'from':(_0xfef7a2['firstName']||'')+'\x20'+(_0xfef7a2[_0xc509('0x97')]||''),'customerIp':_0x2e794c,'customerPort':_0x17d67c[_0xc509('0x7a')][_0xc509('0x98')]?_0x17d67c['headers'][_0xc509('0x98')]:null,'referer':_0x17d67c[_0xc509('0x50')][_0xc509('0x99')],'browserName':_0x3780a0[_0xc509('0x9a')][_0xc509('0x27')]&&_0x3780a0[_0xc509('0x9a')][_0xc509('0x9b')]?util[_0xc509('0x9c')](_0xc509('0x9d'),_0x3780a0[_0xc509('0x9a')][_0xc509('0x27')],_0x3780a0[_0xc509('0x9a')]['version']):'unknown','browserVersion':_0x3780a0[_0xc509('0x9a')][_0xc509('0x9b')]||_0xc509('0x9e'),'osName':util[_0xc509('0x9c')](_0xc509('0x9d'),_0x3780a0['os']['name'],_0x3780a0['os'][_0xc509('0x9b')]),'osVersion':_0x3780a0['os'][_0xc509('0x9b')],'deviceModel':_0x3780a0[_0xc509('0x9f')][_0xc509('0x30')]&&_0x3780a0[_0xc509('0x9f')]['vendor']?util[_0xc509('0x9c')](_0xc509('0xa0'),_0x3780a0[_0xc509('0x9f')][_0xc509('0x30')],_0x3780a0[_0xc509('0x9f')][_0xc509('0xa1')],_0x3780a0[_0xc509('0x9f')][_0xc509('0x2e')]):null,'deviceVendor':_0x3780a0['device'][_0xc509('0xa1')],'deviceType':_0x3780a0['device'][_0xc509('0x2e')],'formData':JSON[_0xc509('0xa2')](_0x17d67c[_0xc509('0x50')])};var _0x26677c={'ChatWebsiteId':_0x17d67c[_0xc509('0x45')]['id'],'closed':![]};if(_0x17d67c['body'][_0xc509('0xa3')]){_0x26677c[_0xc509('0xa3')]=_0x17d67c[_0xc509('0x50')][_0xc509('0xa3')];return db[_0xc509('0xa4')]['find']({'where':_0x26677c})[_0xc509('0xe')](function(_0x46d23f){if(_0x46d23f){return[_0x46d23f,![]];}_0x7ab978[_0xc509('0xa3')]=_0x17d67c[_0xc509('0x50')][_0xc509('0xa3')];_0x7ab978[_0xc509('0xa5')]=_0x17d67c['body'][_0xc509('0xa5')];return db['ChatInteraction'][_0xc509('0x48')](_0x7ab978)[_0xc509('0xe')](function(_0x1dfaa8){return[_0x1dfaa8,!![]];});});}_0x26677c[_0xc509('0xa6')]=_0xfef7a2['id'];if(_0x17d67c[_0xc509('0x50')][_0xc509('0xa7')]&&_0x17d67c['body'][_0xc509('0xa7')]['id']){_0x26677c['id']=_0x17d67c['body'][_0xc509('0xa7')]['id'];return db['ChatInteraction'][_0xc509('0x4c')]({'where':_0x26677c})[_0xc509('0xe')](function(_0x1f87a9){if(_0x1f87a9){return[_0x1f87a9,![]];}return db[_0xc509('0xa4')][_0xc509('0x48')](_0x7ab978)['then'](function(_0x21ad69){return[_0x21ad69,!![]];});});}return db['ChatInteraction']['create'](_0x7ab978)[_0xc509('0xe')](function(_0x530488){return[_0x530488,!![]];});}})[_0xc509('0xa8')](function(_0x10ad44,_0x56dc04){if(_0x10ad44){_0x228915=_0x56dc04;if(!_0x56dc04){var _0x37467e={'from':(_0x4f566f[_0xc509('0xa9')]['firstName']||'')+'\x20'+(_0x4f566f[_0xc509('0xa9')][_0xc509('0x97')]||'')};if(_0x17d67c[_0xc509('0x50')]['threadId']&&_0x17d67c[_0xc509('0x50')][_0xc509('0xaa')]&&_0x17d67c[_0xc509('0x50')][_0xc509('0xa3')]!=_0x17d67c['body'][_0xc509('0xaa')]){_0x37467e[_0xc509('0xa3')]=_0x17d67c[_0xc509('0x50')][_0xc509('0xaa')];}return _0x10ad44[_0xc509('0x22')](_0x37467e);}else{return _0x10ad44;}}})[_0xc509('0xe')](function(_0x59493a){_0x4f566f[_0xc509('0xa7')]=_0x59493a[_0xc509('0x24')]({'plain':!![]});_0x4f566f[_0xc509('0xa7')][_0xc509('0xab')]=_0x228915;if(_0x4f566f[_0xc509('0xa7')][_0xc509('0xab')]){if(_0x4f566f['account']['autoclose']){_0x4f566f['applications']['push']({'id':0x0,'priority':_0x4f566f[_0xc509('0xac')][_0xc509('0x35')]+0x1,'app':_0xc509('0xad'),'appdata':_0xc509('0xae'),'interval':_0xc509('0xaf')});}}return db['ChatMessage'][_0xc509('0x48')]({'body':_0x17d67c[_0xc509('0x50')]['body'],'ChatWebsiteId':_0x17d67c[_0xc509('0x45')]['id'],'ChatInteractionId':_0x59493a['id'],'direction':'in','ContactId':_0x4f566f[_0xc509('0xa9')]['id'],'AttachmentId':_0x17d67c['body'][_0xc509('0xb0')]});})['then'](function(_0x2c6088){_0x4f566f['message']=_0x2c6088;if(_0x4f566f[_0xc509('0xa7')][_0xc509('0xb1')]){return db[_0xc509('0xb2')][_0xc509('0x4c')]({'attributes':['id',_0xc509('0x27')],'where':{'id':_0x4f566f[_0xc509('0xa7')][_0xc509('0xb1')]}})['then'](function(_0x2c59b1){if(_0x2c59b1){_0x4f566f['applications'][_0xc509('0xb3')]({'id':0x0,'priority':0x0,'app':_0xc509('0xb4'),'appdata':_0x2c59b1[_0xc509('0x27')]+','+(_0x4f566f[_0xc509('0x92')]['waitForTheAssignedAgent']||0xa),'interval':_0xc509('0xaf')});_0x4f566f[_0xc509('0xb5')]=!![];}return respondWithRpcPromise('Start',_0xc509('0xb6'),_0x4f566f);});}return respondWithRpcPromise('Start',_0xc509('0xb6'),_0x4f566f);})[_0xc509('0xe')](function(_0x244611){respondWithRpcPromise('EventManager',_0xc509('0xb7'),{'event':_0xc509('0x77'),'message':_0x244611},client9002);return _0x244611;})['then'](respondWithResult(_0x26944c,null))[_0xc509('0x18')](handleError(_0x26944c,null));};exports[_0xc509('0xb8')]=function(_0x40e6b1,_0x519489){var _0x47de00,_0x39e6f0,_0x1a1f93;var _0x158851=[];var _0x3d2d9e={};var _0x58df6a=_0x40e6b1[_0xc509('0xb9')]||[];var _0x20968f=[];var _0x17c55d;return db[_0xc509('0x88')][_0xc509('0x52')]()[_0xc509('0xe')](function(_0x409fb9){if(!_0x409fb9){throw new db['Sequelize'][(_0xc509('0x7c'))](_0xc509('0xba'));}_0x158851=_['difference'](_[_0xc509('0x46')](_0x409fb9),[_0xc509('0xbb'),_0xc509('0x7e'),_0xc509('0x7f'),_0xc509('0x93')]);if(_0x40e6b1['body']['id']){delete _0x40e6b1[_0xc509('0x50')]['id'];}if(_['isNil'](_0x40e6b1[_0xc509('0x50')][_0xc509('0x86')])){throw _0x519489[_0xc509('0x1a')](0x1f4)[_0xc509('0x28')](new db[(_0xc509('0x80'))][(_0xc509('0x7c'))](_0xc509('0x81')));}if(_['isNil'](_0x40e6b1[_0xc509('0x50')][_0xc509('0x50')])||_0x40e6b1['body'][_0xc509('0x50')]===''){throw _0x519489['status'](0x1f4)[_0xc509('0x28')](new db['Sequelize'][(_0xc509('0x7c'))](_0xc509('0xbc')));}if(_[_0xc509('0x6d')](_0x40e6b1[_0xc509('0x50')]['mapKeyOffline'])){throw _0x519489[_0xc509('0x1a')](0x1f4)[_0xc509('0x28')](new db[(_0xc509('0x80'))][(_0xc509('0x7c'))](_0xc509('0xbd')+_0x158851));}if(!_[_0xc509('0x84')](_0x158851,_0x40e6b1[_0xc509('0x50')][_0xc509('0xbe')])){throw _0x519489[_0xc509('0x1a')](0x1f4)[_0xc509('0x28')](new db['Sequelize'][(_0xc509('0x7c'))](_0xc509('0xbf')+_0x158851));}_0x3d2d9e[_0x40e6b1[_0xc509('0x50')]['mapKeyOffline']]=_0x40e6b1[_0xc509('0x50')]['from'];})[_0xc509('0xe')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x40e6b1[_0xc509('0x45')]['id']},'include':[{'model':db['CmList'],'as':_0xc509('0x8d')},{'model':db['MailAccount'],'as':_0xc509('0xc0')}]});})['then'](handleEntityNotFound(_0x519489,null))[_0xc509('0xe')](function(_0x2a6e90){if(_0x2a6e90&&_0x2a6e90[_0xc509('0x8d')]){_0x39e6f0=_0x2a6e90;var _0x489105=_[_0xc509('0x8')](_0x40e6b1[_0xc509('0x50')],{'firstName':_0x40e6b1[_0xc509('0x50')]['from'],'phone':_0x40e6b1[_0xc509('0x50')][_0xc509('0x86')],'ListId':_0x2a6e90['ListId']});_0x489105[_0x40e6b1['body']['mapKeyOffline']]=_0x40e6b1[_0xc509('0x50')][_0xc509('0x86')];return db['CmContact'][_0xc509('0xc1')]({'where':_0x3d2d9e,'defaults':_0x489105});}})['spread'](function(_0x56633c){if(_0x56633c){_0x1a1f93=_0x56633c;var _0x5ad474=fs['readFileSync'](path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0xc2')),_0xc509('0xc3'));var _0x357e09=ejs[_0xc509('0xc4')](_0x5ad474,{'body':_[_0xc509('0xc5')](_0x40e6b1['body'][_0xc509('0x50')]),'bodyTitle':_0x39e6f0['offlineMessageBody']});return db[_0xc509('0xc6')][_0xc509('0x48')]({'body':_0x357e09,'plainBody':htmlToText[_0xc509('0xc7')](_0x357e09),'ContactId':_0x56633c['id'],'ChatWebsiteId':_0x39e6f0['id']});}})[_0xc509('0xe')](function(_0x4b37a2){_0x17c55d=_0x4b37a2;if(_0x58df6a[_0xc509('0x35')]){var _0x2d85f2=_0x58df6a['map'](function(_0x23258f){return{'name':_0x23258f[_0xc509('0xc8')],'basename':_0x23258f[_0xc509('0x61')],'type':_0x23258f[_0xc509('0xc9')],'ChatOfflineMessageId':_0x4b37a2['id']};});_0x20968f=_0x2d85f2['map'](_0x4479b2=>{var _0xfe9503={'filename':_0x4479b2[_0xc509('0x27')],'path':path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0xca'),'files',_0xc509('0xcb'),_0xc509('0xcc'),_0x4479b2['basename'])};return _0xfe9503;});if(!_0x39e6f0[_0xc509('0xcd')]){return db[_0xc509('0xce')][_0xc509('0xcf')](function(_0x3ffad6){return db[_0xc509('0xd0')][_0xc509('0xd1')](_0x2d85f2,{'transaction':_0x3ffad6});});}}})[_0xc509('0xe')](function(){if(_0x17c55d){_0x47de00=_0x17c55d;return db[_0xc509('0xc0')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xc509('0xd2')],'as':_0xc509('0xd3'),'raw':!![],'include':[{'model':db[_0xc509('0xd4')],'as':_0xc509('0xd4'),'raw':!![]}]}]});}})[_0xc509('0xe')](function(_0x282692){if(_0x282692&&_0x282692[_0xc509('0xd3')]&&_0x39e6f0[_0xc509('0xd5')]&&_0x39e6f0['forwardOfflineAddress']){var _0x48a722=_0x282692['getSmtpOptions']();return respondWithRpcPromise(_0xc509('0xd6'),'sendMail',{'account':_0x48a722,'message':{'from':util[_0xc509('0x9c')](_0xc509('0xd7'),_0x282692[_0xc509('0x27')],_0x282692[_0xc509('0xd8')]||_0x282692[_0xc509('0xd3')]['user']),'to':_0x39e6f0[_0xc509('0xd9')],'subject':_0x39e6f0[_0xc509('0xda')],'html':_0x47de00['body'],'attachments':_0x20968f}},client9003)[_0xc509('0xe')](function(){return _0x47de00;})[_0xc509('0x18')](function(_0x312783){logger[_0xc509('0x13')](_0x312783);});}})[_0xc509('0xe')](function(){if(_0x39e6f0&&_0x39e6f0['openNewInteraction']&&_0x39e6f0[_0xc509('0xdb')]){var _0x40495d=[];if(_0x58df6a['length']){_0x40495d=_0x58df6a['map'](function(_0x28e9a9){return{'name':_0x28e9a9[_0xc509('0xc8')],'basename':_0x28e9a9[_0xc509('0x61')],'type':_0x28e9a9['mimetype'],'ChatOfflineMessageId':_0x17c55d['id']};});}var _0x407fb4;if(!_['isNil'](_0x39e6f0['subjectOffline'])){var _0x5d92b6=_[_0xc509('0x2b')](_0x40e6b1['body'],function(_0x11052e){return _0x11052e;});var _0x4be558=_[_0xc509('0xdc')](_0x5d92b6)[0x0];var _0x5281c6=_[_0xc509('0xdd')](_0x4be558,function(_0x37c769){return _0x37c769;});_0x407fb4=_0x5281c6[0x1][_0x39e6f0[_0xc509('0xde')]];}var _0x2fd173={'from':_0x1a1f93[_0xc509('0xd8')],'firstName':_0x1a1f93['firstName'],'lastName':_0x1a1f93['lastName'],'mapKey':_0xc509('0xd8'),'message':{'from':_0x1a1f93[_0xc509('0xd8')],'to':_0x39e6f0[_0xc509('0xc0')]['email'],'cc':'','subject':_[_0xc509('0x6d')](_0x407fb4)?_0x39e6f0['offlineMessageSubject']:_0x407fb4,'messageId':'','sentAt':new Date(),'attach':_0x40495d[_0xc509('0x35')],'attachments':_0x40495d,'originChannel':'Chat','ChatWebsiteId':_0x39e6f0['id'],'ChatOfflineMessageId':_0x47de00['id'],'originTo':_0x39e6f0[_0xc509('0xc0')][_0xc509('0xd8')]},'body':_0x47de00[_0xc509('0x50')]};var _0x16a854={'account':{'id':_0x39e6f0['MailAccountId']},'body':_0x2fd173,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xc509('0xdf'),_0x16a854,client9001)['then'](function(){return _0x47de00;})[_0xc509('0x18')](function(_0x49c914){logger[_0xc509('0x13')](_0x49c914);});}return;})['then'](function(){if(_0x47de00){return _0x47de00;}})[_0xc509('0xe')](respondWithResult(_0x519489,null))[_0xc509('0x18')](function(_0x20ae68){logger[_0xc509('0x13')](_0xc509('0x18'),_0x20ae68);for(var _0x3f0839 of _0x58df6a){var _0x5a00ac=path[_0xc509('0x68')](config[_0xc509('0x69')],_0xc509('0xca'),_0xc509('0xb9'),'attachments',_0xc509('0xcc'),_0x3f0839[_0xc509('0x61')]);fs_extra[_0xc509('0xe0')](_0x5a00ac)[_0xc509('0x18')](function(_0x5b610b){logger[_0xc509('0x13')]('Could\x20not\x20remove\x20attachment\x20file',_0x5a00ac,_0x5b610b);});}});};exports[_0xc509('0xe1')]=function(_0x20ac3f,_0xb5d8ba){return db[_0xc509('0xa4')]['find']({'where':{'id':_0x20ac3f[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0xb5d8ba,null))['then'](function(_0x2150a0){if(_0x2150a0){return _0x2150a0['addInteraction'](_0x20ac3f[_0xc509('0x50')][_0xc509('0x59')],_[_0xc509('0xe2')](_0x20ac3f[_0xc509('0x50')],[_0xc509('0x59'),'id'])||{});}})[_0xc509('0xe')](respondWithResult(_0xb5d8ba,null))['catch'](handleError(_0xb5d8ba,null));};exports['getInteractions']=function(_0x143eb0,_0x51cb61){var _0xd92c41={'raw':![],'where':{}};var _0x3807b0={};var _0x1c2132={'count':0x0,'rows':[]};return db[_0xc509('0x2c')][_0xc509('0x5c')]({'where':{'id':_0x143eb0['params']['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x51cb61,null))[_0xc509('0xe')](function(_0x29233b){if(_0x29233b){_0x3807b0['model']=_[_0xc509('0x46')](db[_0xc509('0xa4')]['rawAttributes']);_0x3807b0[_0xc509('0x31')]=_['keys'](_0x143eb0[_0xc509('0x31')]);_0x3807b0[_0xc509('0x32')]=_['intersection'](_0x3807b0[_0xc509('0x30')],_0x3807b0[_0xc509('0x31')]);_0xd92c41[_0xc509('0x36')]=_[_0xc509('0x33')](_0x3807b0['model'],qs['fields'](_0x143eb0[_0xc509('0x31')][_0xc509('0x34')]));_0xd92c41[_0xc509('0x36')]=_0xd92c41['attributes'][_0xc509('0x35')]?_0xd92c41[_0xc509('0x36')]:_0x3807b0[_0xc509('0x30')];if(!_0x143eb0[_0xc509('0x31')][_0xc509('0x37')]('nolimit')){_0xd92c41[_0xc509('0x20')]=qs[_0xc509('0x20')](_0x143eb0[_0xc509('0x31')][_0xc509('0x20')]);_0xd92c41[_0xc509('0x1d')]=qs[_0xc509('0x1d')](_0x143eb0[_0xc509('0x31')][_0xc509('0x1d')]);}_0xd92c41['order']=qs[_0xc509('0x3a')](_0x143eb0[_0xc509('0x31')][_0xc509('0x3a')]);_0xd92c41[_0xc509('0x3b')]=qs[_0xc509('0x32')](_[_0xc509('0x3c')](_0x143eb0[_0xc509('0x31')],_0x3807b0[_0xc509('0x32')]));_0xd92c41[_0xc509('0x3b')][_0xc509('0x54')]=_0x29233b['id'];if(_0x143eb0[_0xc509('0x31')]['filter']){_0xd92c41[_0xc509('0x3b')]=_['merge'](_0xd92c41['where'],{'$or':_['map'](_0xd92c41[_0xc509('0x36')],function(_0x3a3ece){var _0x19dbd7={};_0x19dbd7[_0x3a3ece]={'$like':'%'+_0x143eb0[_0xc509('0x31')]['filter']+'%'};return _0x19dbd7;})});}_0xd92c41=_[_0xc509('0x3f')]({},_0xd92c41,_0x143eb0[_0xc509('0x40')]);return db[_0xc509('0xa4')][_0xc509('0x1f')]({'where':_0xd92c41[_0xc509('0x3b')]})[_0xc509('0xe')](function(_0x130382){_0x1c2132['count']=_0x130382;if(_0x143eb0[_0xc509('0x31')]['includeAll']){_0xd92c41['include']=[{'model':db[_0xc509('0x88')],'as':_0xc509('0xe3'),'required':![]},{'model':db[_0xc509('0xb2')],'as':'Owner','attributes':[_0xc509('0x27'),_0xc509('0xe4'),_0xc509('0xe5')],'required':![]},{'model':db[_0xc509('0xe6')],'as':_0xc509('0xe7'),'attributes':['id',_0xc509('0x27'),_0xc509('0xe8')],'where':_0x143eb0[_0xc509('0x31')][_0xc509('0xe9')]?{'id':_0x143eb0[_0xc509('0x31')][_0xc509('0xe9')]}:undefined,'required':_0x143eb0[_0xc509('0x31')]['tag']?!![]:![]}];}return db[_0xc509('0xa4')][_0xc509('0x57')](_0xd92c41);})[_0xc509('0xe')](function(_0x2d0248){_0x1c2132[_0xc509('0x43')]=_0x2d0248;return _0x1c2132;});}})[_0xc509('0xe')](respondWithFilteredResult(_0x51cb61,_0xd92c41))[_0xc509('0x18')](handleError(_0x51cb61,null));};function iftimePromise(_0x307534,_0x245d39){return respondWithRpcPromise(_0xc509('0xea'),'getSnippet',{'command':_0x245d39[_0xc509('0xeb')]?util[_0xc509('0x9c')]('iftime\x20%s,%s',_0x307534[_0xc509('0xec')],_0x245d39['timezone']):util[_0xc509('0x9c')](_0xc509('0xed'),_0x307534['interval'])},client9002)[_0xc509('0xe')](function(_0x2e48e1){var _0x263722=_0x2e48e1&&_0x2e48e1['indexOf'](_0xc509('0xee'))>=0x0?!![]:![];logger['info'](_0xc509('0xef'),_0x245d39['id'],_0x307534['id'],_0x307534[_0xc509('0xec')],_0x263722?_0xc509('0xf0'):'OFFLINE',_0x245d39['timezone']?_0x245d39[_0xc509('0xeb')]:_0xc509('0xf1'));return _0x263722;})['catch'](function(_0x2ba0da){logger[_0xc509('0x13')](_0xc509('0xef'),_0x245d39['id'],_0x307534['id'],_0x307534[_0xc509('0xec')],util[_0xc509('0xf2')](_0x2ba0da,{'showHidden':![],'depth':null}),_0x245d39[_0xc509('0xeb')]?_0x245d39['timezone']:_0xc509('0xf1'));return![];});}exports[_0xc509('0xf3')]=function(_0x225466,_0x121aea){var _0x3f853c=0x0;var _0x2c068c=0x0;var _0x49b046=![];var _0x4c8b2c;var _0x24e4b2;return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x225466[_0xc509('0x45')]['id']},'include':[{'model':db[_0xc509('0xf4')],'as':_0xc509('0xf4'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xc509('0xec')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x121aea,null))[_0xc509('0xe')](function(_0xeddc23){if(_0xeddc23){_0x4c8b2c=_0xeddc23;return _0xeddc23[_0xc509('0xf5')]({'raw':!![]});}})[_0xc509('0xe')](function(_0x12951a){if(_0x4c8b2c){if(_0x12951a){_0x24e4b2=_0x12951a;}}return require(_0xc509('0x6b'))[_0xc509('0xf6')]();})[_0xc509('0xe')](function(_0x505c99){if(_0x505c99){_0x2c068c=_0x505c99[_0xc509('0xf7')];_0x49b046=_0x505c99['custom'];}})['then'](function(){return db['ChatInteraction'][_0xc509('0x1f')]({'where':{'closed':![]}});})['then'](function(_0x476ce9){_0x3f853c=_0x476ce9;if(_0x2c068c&&_0x476ce9>_0x2c068c){return db[_0xc509('0xf8')][_0xc509('0x5c')]({'where':{'id':0x1}})[_0xc509('0xe')](function(_0x134c2d){if(_0x134c2d){_0x134c2d['increment'](_0xc509('0xf9'));}});}})[_0xc509('0xe')](function(){if(_0x4c8b2c[_0xc509('0xf4')]&&_0x4c8b2c[_0xc509('0xf4')][_0xc509('0xfa')]){var _0x164b5f=[];for(var _0x318adb=0x0;_0x318adb<_0x4c8b2c[_0xc509('0xf4')][_0xc509('0xfa')][_0xc509('0x35')];_0x318adb++){var _0x39e5a7=_0x4c8b2c[_0xc509('0xf4')]['Intervals'][_0x318adb][_0xc509('0x24')]({'plain':!![]});_0x164b5f[_0xc509('0xfb')](iftimePromise(_0x39e5a7,_0x4c8b2c));}return BPromise[_0xc509('0xfc')](_0x164b5f)[_0xc509('0xe')](function(_0x37d795){return _[_0xc509('0xfd')](_0x37d795);});}else{return!![];}})['then'](function(_0x356857){var _0x29ddeb=fs[_0xc509('0xfe')](path[_0xc509('0x68')](config['root'],_0xc509('0xff')),_0xc509('0xc3'));var _0xab368={'remote':_0x4c8b2c[_0xc509('0x100')],'query':querystring[_0xc509('0xa2')](_[_0xc509('0x3f')](_0x4c8b2c[_0xc509('0x24')]({'plain':!![]}),{'customerIp':_0x225466[_0xc509('0x7a')][_0xc509('0x95')]||_0x225466[_0xc509('0x7a')][_0xc509('0x101')]||_0x225466[_0xc509('0x102')][_0xc509('0x103')]||_0x225466['ip'],'referer':_0x225466['headers'][_0xc509('0x99')],'openedInteractions':_0x3f853c,'maxInteractions':_0x2c068c,'virtual':_0x49b046[_0xc509('0xf7')],'online':_0x356857,'custom':_0x49b046}))['replace'](/'/g,'\x5c\x27')};_0x121aea['send'](ejs['render'](Mustache[_0xc509('0xc4')](_0x29ddeb,_0xab368),{'proactiveActions':_0x24e4b2,'alignment':_0x4c8b2c[_0xc509('0x104')],'verticalAlignment':_0x4c8b2c[_0xc509('0x105')],'div_color':_0x4c8b2c[_0xc509('0xe8')],'labelText':_0x4c8b2c[_0xc509('0x106')],'text_color':_0x4c8b2c[_0xc509('0x107')],'button_color':_0x4c8b2c[_0xc509('0x108')],'background_color':_0x4c8b2c['backgroundColor'],'hideWhenOffline':_0x4c8b2c[_0xc509('0x109')],'interval':_0x4c8b2c[_0xc509('0x10a')]}));})[_0xc509('0x18')](handleError(_0x121aea,null));};exports[_0xc509('0x10b')]=function(_0x2658de,_0x40af8d){var _0x1ae38e=_0x2658de['params']['id'];var _0x32ac8c=_0x2658de[_0xc509('0x50')];var _0x3bc80e=0xc8;var _0x3a8250=null;return db[_0xc509('0xce')][_0xc509('0xcf')]({'isolationLevel':db[_0xc509('0xce')]['Transaction'][_0xc509('0x10c')][_0xc509('0x10d')]},function(_0xdef13d){return db[_0xc509('0x2c')][_0xc509('0x5c')]({'where':{'id':_0x1ae38e},'transaction':_0xdef13d})[_0xc509('0xe')](function(_0x1f1fa1){if(_0x1f1fa1){return db[_0xc509('0x8b')][_0xc509('0x23')]({'where':{'ChatWebsiteId':_0x1ae38e},'transaction':_0xdef13d})[_0xc509('0xe')](function(){var _0x161001=_[_0xc509('0x2b')](_0x32ac8c,function(_0x43efc7){_0x43efc7[_0xc509('0x54')]=_0x1ae38e;return _0x43efc7;});return db['ChatApplication'][_0xc509('0xd1')](_0x161001,{'transaction':_0xdef13d});});}else{_0x3bc80e=0x194;_0x3a8250=[];}});})[_0xc509('0xe')](function(){if(_0x3bc80e!==0x194){return db[_0xc509('0x8b')][_0xc509('0x10e')]({'where':{'ChatWebsiteId':_0x1ae38e},'order':_0xc509('0x90')})['then'](function(_0x16907c){_0x3a8250=_0x16907c;});}})[_0xc509('0x18')](function(_0x1ed890){_0x3bc80e=0x1f4;logger['error'](_0x1ed890[_0xc509('0x26')]);if(_0x1ed890[_0xc509('0x27')]){delete _0x1ed890[_0xc509('0x27')];}_0x3a8250=_0x1ed890;})[_0xc509('0x10f')](function(){if(_0x3a8250===null){_0x40af8d['sendStatus'](_0x3bc80e);}else{if(_0x3bc80e===0x1f4){_0x40af8d[_0xc509('0x1a')](_0x3bc80e)[_0xc509('0x28')](_0x3a8250);}else{_0x40af8d[_0xc509('0x1a')](_0x3bc80e)[_0xc509('0x1c')](_0x3a8250);}}});};exports[_0xc509('0x110')]=function(_0x59fca6,_0x2ee293){var _0x37628b={};var _0x31317e={};var _0x5c9115;var _0x23f797;return db[_0xc509('0x2c')]['findOne']({'where':{'id':_0x59fca6[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x2ee293,null))[_0xc509('0xe')](function(_0x23ca7d){if(_0x23ca7d){_0x5c9115=_0x23ca7d;_0x31317e['model']=_[_0xc509('0x46')](db[_0xc509('0x8b')]['rawAttributes']);_0x31317e[_0xc509('0x31')]=_[_0xc509('0x46')](_0x59fca6[_0xc509('0x31')]);_0x31317e[_0xc509('0x32')]=_[_0xc509('0x33')](_0x31317e[_0xc509('0x30')],_0x31317e[_0xc509('0x31')]);_0x37628b['attributes']=_[_0xc509('0x33')](_0x31317e['model'],qs[_0xc509('0x34')](_0x59fca6['query'][_0xc509('0x34')]));_0x37628b[_0xc509('0x36')]=_0x37628b[_0xc509('0x36')][_0xc509('0x35')]?_0x37628b[_0xc509('0x36')]:_0x31317e[_0xc509('0x30')];_0x37628b[_0xc509('0x39')]=qs[_0xc509('0x3a')](_0x59fca6[_0xc509('0x31')][_0xc509('0x3a')]);_0x37628b[_0xc509('0x3b')]=qs[_0xc509('0x32')](_['pick'](_0x59fca6[_0xc509('0x31')],_0x31317e[_0xc509('0x32')]));if(_0x59fca6[_0xc509('0x31')][_0xc509('0x3d')]){_0x37628b[_0xc509('0x3b')]=_['merge'](_0x37628b[_0xc509('0x3b')],{'$or':_[_0xc509('0x2b')](_0x37628b[_0xc509('0x36')],function(_0x4d0751){var _0x367b3a={};_0x367b3a[_0x4d0751]={'$like':'%'+_0x59fca6['query'][_0xc509('0x3d')]+'%'};return _0x367b3a;})});}_0x37628b=_[_0xc509('0x3f')]({},_0x37628b,_0x59fca6[_0xc509('0x40')]);return _0x5c9115[_0xc509('0x110')](_0x37628b);}})[_0xc509('0xe')](function(_0x5adba5){if(_0x5adba5){_0x23f797=_0x5adba5[_0xc509('0x35')];if(!_0x59fca6['query']['hasOwnProperty'](_0xc509('0x38'))){_0x37628b[_0xc509('0x20')]=qs[_0xc509('0x20')](_0x59fca6[_0xc509('0x31')][_0xc509('0x20')]);_0x37628b['offset']=qs[_0xc509('0x1d')](_0x59fca6[_0xc509('0x31')][_0xc509('0x1d')]);}return _0x5c9115[_0xc509('0x110')](_0x37628b);}})[_0xc509('0xe')](function(_0xa33928){if(_0xa33928){return _0xa33928?{'count':_0x23f797,'rows':_0xa33928}:null;}})[_0xc509('0xe')](respondWithResult(_0x2ee293,null))[_0xc509('0x18')](handleError(_0x2ee293,null));};exports['addProactiveActions']=function(_0x5e5155,_0x3efb30){return db[_0xc509('0x111')][_0xc509('0x4c')]({'where':{'id':_0x5e5155[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x3efb30,null))[_0xc509('0xe')](function(_0x3d8d53){if(_0x3d8d53){return _0x3d8d53['addProactiveActions'](_0x5e5155[_0xc509('0x50')][_0xc509('0x59')],_['omit'](_0x5e5155[_0xc509('0x50')],[_0xc509('0x59'),'id'])||{});}})[_0xc509('0xe')](respondWithResult(_0x3efb30,null))[_0xc509('0x18')](handleError(_0x3efb30,null));};exports[_0xc509('0xf5')]=function(_0x4c8610,_0x5eae5c){var _0xd05bca={};var _0x52954f={};var _0x5b55c2;var _0x27d138;return db[_0xc509('0x2c')][_0xc509('0x5c')]({'where':{'id':_0x4c8610[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x5eae5c,null))['then'](function(_0x42de03){if(_0x42de03){_0x5b55c2=_0x42de03;_0x52954f[_0xc509('0x30')]=_['keys'](db[_0xc509('0x112')][_0xc509('0x47')]);_0x52954f['query']=_[_0xc509('0x46')](_0x4c8610[_0xc509('0x31')]);_0x52954f[_0xc509('0x32')]=_['intersection'](_0x52954f[_0xc509('0x30')],_0x52954f[_0xc509('0x31')]);_0xd05bca['attributes']=_[_0xc509('0x33')](_0x52954f['model'],qs[_0xc509('0x34')](_0x4c8610[_0xc509('0x31')][_0xc509('0x34')]));_0xd05bca[_0xc509('0x36')]=_0xd05bca[_0xc509('0x36')]['length']?_0xd05bca[_0xc509('0x36')]:_0x52954f[_0xc509('0x30')];_0xd05bca[_0xc509('0x39')]=qs[_0xc509('0x3a')](_0x4c8610[_0xc509('0x31')][_0xc509('0x3a')]);_0xd05bca[_0xc509('0x3b')]=qs[_0xc509('0x32')](_[_0xc509('0x3c')](_0x4c8610[_0xc509('0x31')],_0x52954f[_0xc509('0x32')]));if(_0x4c8610[_0xc509('0x31')][_0xc509('0x3d')]){_0xd05bca[_0xc509('0x3b')]=_[_0xc509('0x3f')](_0xd05bca['where'],{'$or':_[_0xc509('0x2b')](_0xd05bca[_0xc509('0x36')],function(_0x1fd346){var _0x2bf0b1={};_0x2bf0b1[_0x1fd346]={'$like':'%'+_0x4c8610[_0xc509('0x31')][_0xc509('0x3d')]+'%'};return _0x2bf0b1;})});}_0xd05bca=_[_0xc509('0x3f')]({},_0xd05bca,_0x4c8610[_0xc509('0x40')]);return _0x5b55c2[_0xc509('0xf5')](_0xd05bca);}})['then'](function(_0x2ba581){if(_0x2ba581){_0x27d138=_0x2ba581[_0xc509('0x35')];if(!_0x4c8610[_0xc509('0x31')][_0xc509('0x37')](_0xc509('0x38'))){_0xd05bca[_0xc509('0x20')]=qs['limit'](_0x4c8610[_0xc509('0x31')][_0xc509('0x20')]);_0xd05bca[_0xc509('0x1d')]=qs[_0xc509('0x1d')](_0x4c8610[_0xc509('0x31')][_0xc509('0x1d')]);}return _0x5b55c2['getProactiveActions'](_0xd05bca);}})[_0xc509('0xe')](function(_0x25126c){if(_0x25126c){return _0x25126c?{'count':_0x27d138,'rows':_0x25126c}:null;}})[_0xc509('0xe')](respondWithResult(_0x5eae5c,null))['catch'](handleError(_0x5eae5c,null));};exports['getFields']=function(_0x325ee8,_0x274b82){var _0x362276=_0x325ee8[_0xc509('0x31')]['online']===_0xc509('0x113')?'offlineForm':_0xc509('0x114');return db[_0xc509('0x2c')][_0xc509('0x4c')]({'attributes':['id',_0x362276],'where':{'id':_0x325ee8['params']['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x274b82,null))['then'](function(_0x39056b){if(_0x39056b){var _0x169ef3=_0x39056b[_0x362276];var _0x19a013=_0x169ef3&&_0x169ef3['items']?_0x169ef3[_0xc509('0x115')]:[];_0x274b82[_0xc509('0x28')]({'fromKey':_[_0xc509('0x6d')](_0x169ef3['fromKey'])?undefined:_0x169ef3[_0xc509('0x116')],'count':_0x19a013[_0xc509('0x35')],'rows':_0x19a013});}})['catch'](handleError(_0x274b82,null));};exports[_0xc509('0x117')]=function(_0x50a3c0,_0x1e2723){var _0x538928={'raw':![],'where':{}};var _0x1145ca={};var _0x138a8a={'count':0x0,'rows':[]};return db[_0xc509('0x2c')][_0xc509('0x5c')]({'where':{'id':_0x50a3c0[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x1e2723,null))['then'](function(_0x264bff){if(_0x264bff){_0x1145ca[_0xc509('0x30')]=_['keys'](db['ChatOfflineMessage'][_0xc509('0x47')]);_0x1145ca[_0xc509('0x31')]=_[_0xc509('0x46')](_0x50a3c0[_0xc509('0x31')]);_0x1145ca[_0xc509('0x32')]=_[_0xc509('0x33')](_0x1145ca[_0xc509('0x30')],_0x1145ca['query']);_0x538928[_0xc509('0x36')]=_[_0xc509('0x33')](_0x1145ca[_0xc509('0x30')],qs[_0xc509('0x34')](_0x50a3c0[_0xc509('0x31')][_0xc509('0x34')]));_0x538928[_0xc509('0x36')]=_0x538928[_0xc509('0x36')][_0xc509('0x35')]?_0x538928[_0xc509('0x36')]:_0x1145ca[_0xc509('0x30')];if(!_0x50a3c0['query'][_0xc509('0x37')](_0xc509('0x38'))){_0x538928[_0xc509('0x20')]=qs['limit'](_0x50a3c0['query'][_0xc509('0x20')]);_0x538928['offset']=qs['offset'](_0x50a3c0[_0xc509('0x31')][_0xc509('0x1d')]);}_0x538928['order']=qs['sort'](_0x50a3c0['query'][_0xc509('0x3a')]);_0x538928[_0xc509('0x3b')]=qs[_0xc509('0x32')](_[_0xc509('0x3c')](_0x50a3c0[_0xc509('0x31')],_0x1145ca['filters']));_0x538928[_0xc509('0x3b')][_0xc509('0x54')]=_0x264bff['id'];if(_0x50a3c0[_0xc509('0x31')][_0xc509('0x3d')]){_0x538928[_0xc509('0x3b')]=_['merge'](_0x538928[_0xc509('0x3b')],{'$or':_[_0xc509('0x2b')](_0x538928[_0xc509('0x36')],function(_0x1df742){var _0x1554d5={};_0x1554d5[_0x1df742]={'$like':'%'+_0x50a3c0[_0xc509('0x31')][_0xc509('0x3d')]+'%'};return _0x1554d5;})});}_0x538928=_[_0xc509('0x3f')]({},_0x538928,_0x50a3c0[_0xc509('0x40')]);return db[_0xc509('0xc6')][_0xc509('0x1f')]({'where':_0x538928[_0xc509('0x3b')]})[_0xc509('0xe')](function(_0x4f9d6b){_0x138a8a[_0xc509('0x1f')]=_0x4f9d6b;if(_0x50a3c0['query']['includeAll']){_0x538928['include']=[{'all':!![]}];}else{_0x538928['include']=[{'model':db[_0xc509('0x88')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xc509('0xc6')][_0xc509('0x57')](_0x538928);})['then'](function(_0x1f54d3){_0x138a8a[_0xc509('0x43')]=_0x1f54d3;return _0x138a8a;});}})['then'](respondWithFilteredResult(_0x1e2723,_0x538928))[_0xc509('0x18')](handleError(_0x1e2723,null));};exports[_0xc509('0x118')]=function(_0x9ebfb6,_0x1ede12){return db[_0xc509('0x2c')]['find']({'where':{'id':_0x9ebfb6['params']['id']}})['then'](handleEntityNotFound(_0x1ede12,null))[_0xc509('0xe')](function(_0x4b6ff){if(_0x4b6ff){return _0x4b6ff[_0xc509('0x118')](_0x9ebfb6['body'][_0xc509('0x59')],_[_0xc509('0xe2')](_0x9ebfb6[_0xc509('0x50')],[_0xc509('0x59'),'id'])||{})['spread'](function(_0x969ebe){for(var _0x429b5a=0x0;_0x429b5a<_0x9ebfb6[_0xc509('0x50')][_0xc509('0x59')][_0xc509('0x35')];_0x429b5a+=0x1){socket[_0xc509('0x119')](_0xc509('0x11a'),{'UserId':Number(_0x9ebfb6[_0xc509('0x50')][_0xc509('0x59')][_0x429b5a]),'ChatWebsiteId':Number(_0x9ebfb6['params']['id'])});}return _0x969ebe;});}})[_0xc509('0xe')](respondWithResult(_0x1ede12,null))['catch'](handleError(_0x1ede12,null));};exports['removeAgents']=function(_0x17fa70,_0x3e5e76){return db[_0xc509('0x2c')][_0xc509('0x4c')]({'where':{'id':_0x17fa70[_0xc509('0x45')]['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x3e5e76,null))[_0xc509('0xe')](function(_0x56189c){if(_0x56189c){return _0x56189c[_0xc509('0x11b')](_0x17fa70['query'][_0xc509('0x59')])[_0xc509('0xe')](function(){if(_[_0xc509('0x11c')](_0x17fa70['query'][_0xc509('0x59')])){for(var _0xcbb60f=0x0;_0xcbb60f<_0x17fa70[_0xc509('0x31')][_0xc509('0x59')][_0xc509('0x35')];_0xcbb60f+=0x1){socket[_0xc509('0x119')](_0xc509('0x11d'),{'UserId':Number(_0x17fa70[_0xc509('0x31')][_0xc509('0x59')][_0xcbb60f]),'ChatWebsiteId':Number(_0x17fa70[_0xc509('0x45')]['id'])});}}else{socket[_0xc509('0x119')](_0xc509('0x11d'),{'UserId':Number(_0x17fa70[_0xc509('0x31')][_0xc509('0x59')]),'ChatWebsiteId':Number(_0x17fa70[_0xc509('0x45')]['id'])});}});}})[_0xc509('0xe')](respondWithStatusCode(_0x3e5e76,null))[_0xc509('0x18')](handleError(_0x3e5e76,null));};exports['getAgents']=function(_0xe0dab0,_0x4dbfca){var _0x2a5d77={};var _0x438108={};var _0x113abe;var _0x182fb8;return db[_0xc509('0x2c')][_0xc509('0x5c')]({'where':{'id':_0xe0dab0['params']['id']}})[_0xc509('0xe')](handleEntityNotFound(_0x4dbfca,null))[_0xc509('0xe')](function(_0x349a1b){if(_0x349a1b){_0x113abe=_0x349a1b;_0x438108['model']=_['keys'](db[_0xc509('0xb2')][_0xc509('0x47')]);_0x438108[_0xc509('0x31')]=_[_0xc509('0x46')](_0xe0dab0['query']);_0x438108[_0xc509('0x32')]=_['intersection'](_0x438108[_0xc509('0x30')],_0x438108[_0xc509('0x31')]);_0x2a5d77['attributes']=_[_0xc509('0x33')](_0x438108['model'],qs[_0xc509('0x34')](_0xe0dab0['query']['fields']));_0x2a5d77['attributes']=_0x2a5d77[_0xc509('0x36')][_0xc509('0x35')]?_0x2a5d77[_0xc509('0x36')]:_0x438108[_0xc509('0x30')];_0x2a5d77[_0xc509('0x39')]=qs[_0xc509('0x3a')](_0xe0dab0[_0xc509('0x31')][_0xc509('0x3a')]);_0x2a5d77[_0xc509('0x3b')]=qs['filters'](_[_0xc509('0x3c')](_0xe0dab0['query'],_0x438108[_0xc509('0x32')]));if(_0xe0dab0[_0xc509('0x31')]['filter']){_0x2a5d77[_0xc509('0x3b')]=_[_0xc509('0x3f')](_0x2a5d77['where'],{'$or':_[_0xc509('0x2b')](_0x2a5d77[_0xc509('0x36')],function(_0x71aecf){var _0x450457={};_0x450457[_0x71aecf]={'$like':'%'+_0xe0dab0[_0xc509('0x31')]['filter']+'%'};return _0x450457;})});}_0x2a5d77=_[_0xc509('0x3f')]({},_0x2a5d77,_0xe0dab0[_0xc509('0x40')]);return _0x113abe[_0xc509('0x11e')](_0x2a5d77);}})[_0xc509('0xe')](function(_0x11a655){if(_0x11a655){_0x182fb8=_0x11a655['length'];if(!_0xe0dab0['query']['hasOwnProperty'](_0xc509('0x38'))){_0x2a5d77['limit']=qs[_0xc509('0x20')](_0xe0dab0[_0xc509('0x31')][_0xc509('0x20')]);_0x2a5d77[_0xc509('0x1d')]=qs[_0xc509('0x1d')](_0xe0dab0[_0xc509('0x31')][_0xc509('0x1d')]);}return _0x113abe[_0xc509('0x11e')](_0x2a5d77);}})['then'](function(_0x301779){if(_0x301779){return _0x301779?{'count':_0x182fb8,'rows':_0x301779}:null;}})['then'](respondWithResult(_0x4dbfca,null))[_0xc509('0x18')](handleError(_0x4dbfca,null));}; \ No newline at end of file +var _0xd2ce=['Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','agentAvatar','customerAvatar','addSystemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','from','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','CompanyId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','server/files/templates/chatOfflineMessage.ejs','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','user','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','readFileSync','utf8','remote','x-real-ip','connection','remoteAddress','referer','alignment','verticalAlignment','labelText','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','READ_COMMITTED','findAndCountAll','stack','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','ChatWebsites','name','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','includeAll','findAll','show','params','include','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','UserProfileResource','describe','addDisposition','ChatWebsiteId','findOne','nolimit','order','map'];(function(_0x348fa1,_0x1f815c){var _0xe177d3=function(_0x2cd736){while(--_0x2cd736){_0x348fa1['push'](_0x348fa1['shift']());}};_0xe177d3(++_0x1f815c);}(_0xd2ce,0xd1));var _0xed2c=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xd2ce[_0x28d18d];return _0x470640;};'use strict';var BPromise=require(_0xed2c('0x0'));var Mustache=require(_0xed2c('0x1'));var util=require(_0xed2c('0x2'));var path=require(_0xed2c('0x3'));var ejs=require(_0xed2c('0x4'));var fs=require('fs');var fs_extra=require(_0xed2c('0x5'));var _=require(_0xed2c('0x6'));var querystring=require(_0xed2c('0x7'));var Redis=require('ioredis');var qs=require(_0xed2c('0x8'));var logger=require(_0xed2c('0x9'))(_0xed2c('0xa'));var config=require(_0xed2c('0xb'));var db=require(_0xed2c('0xc'))['db'];config[_0xed2c('0xd')]=_[_0xed2c('0xe')](config[_0xed2c('0xd')],{'host':_0xed2c('0xf'),'port':0x18eb});var socket=require(_0xed2c('0x10'))(new Redis(config[_0xed2c('0xd')]));require(_0xed2c('0x11'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0xed2c('0x12'));var client=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x232c});var client9002=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x232a});var client9003=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x232b});var client9001=jayson[_0xed2c('0x13')][_0xed2c('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x26388f,_0x194185,_0x2d4e0e,_0x29dcd9){return new BPromise(function(_0x57c6b2,_0x1585e5){var _0x45ed01=_0x29dcd9||client;return _0x45ed01[_0xed2c('0x15')](_0x26388f,_0x2d4e0e)[_0xed2c('0x16')](function(_0x9871ae){logger[_0xed2c('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x194185,_0xed2c('0x18'));logger[_0xed2c('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x194185,_0xed2c('0x18'),JSON['stringify'](_0x9871ae));if(_0x9871ae[_0xed2c('0x1a')]){if(_0x9871ae[_0xed2c('0x1a')][_0xed2c('0x1b')]===0x1f4){logger[_0xed2c('0x1a')](_0xed2c('0x1c'),_0x194185,_0x9871ae['error'][_0xed2c('0x1d')]);return _0x1585e5(_0x9871ae[_0xed2c('0x1a')][_0xed2c('0x1d')]);}logger[_0xed2c('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x194185,_0x9871ae['error'][_0xed2c('0x1d')]);return _0x57c6b2(_0x9871ae[_0xed2c('0x1a')][_0xed2c('0x1d')]);}else{logger[_0xed2c('0x17')](_0xed2c('0x1c'),_0x194185,_0xed2c('0x18'));_0x57c6b2(_0x9871ae[_0xed2c('0x1e')][_0xed2c('0x1d')]);}})[_0xed2c('0x1f')](function(_0x129401){logger['error'](_0xed2c('0x1c'),_0x194185,_0x129401);_0x1585e5(_0x129401);});});}function respondWithStatusCode(_0x3f724d,_0x2331d0){_0x2331d0=_0x2331d0||0xcc;return function(_0x1386c4){if(_0x1386c4){return _0x3f724d[_0xed2c('0x20')](_0x2331d0);}return _0x3f724d[_0xed2c('0x21')](_0x2331d0)[_0xed2c('0x22')]();};}function respondWithResult(_0x35f70e,_0x51088c){_0x51088c=_0x51088c||0xc8;return function(_0x5bf75e){if(_0x5bf75e){return _0x35f70e[_0xed2c('0x21')](_0x51088c)[_0xed2c('0x23')](_0x5bf75e);}};}function respondWithFilteredResult(_0x33a29e,_0x4438c1){return function(_0x22fd91){if(_0x22fd91){var _0x265c36=typeof _0x4438c1[_0xed2c('0x24')]==='undefined'&&typeof _0x4438c1[_0xed2c('0x25')]===_0xed2c('0x26');var _0x5ab86b=_0x22fd91[_0xed2c('0x27')];var _0x4d5d7c=_0x265c36?0x0:_0x4438c1[_0xed2c('0x24')];var _0x495008=_0x265c36?_0x22fd91['count']:_0x4438c1[_0xed2c('0x24')]+_0x4438c1['limit'];var _0x4e969f;if(_0x495008>=_0x5ab86b){_0x495008=_0x5ab86b;_0x4e969f=0xc8;}else{_0x4e969f=0xce;}_0x33a29e[_0xed2c('0x21')](_0x4e969f);return _0x33a29e[_0xed2c('0x28')](_0xed2c('0x29'),_0x4d5d7c+'-'+_0x495008+'/'+_0x5ab86b)[_0xed2c('0x23')](_0x22fd91);}return null;};}function saveUpdates(_0x53db46){return function(_0x6a0ee6){if(_0x6a0ee6){return _0x6a0ee6[_0xed2c('0x2a')](_0x53db46)['then'](function(_0x23256f){return _0x23256f;});}return null;};}function removeEntity(_0x2ce2ce){return function(_0x1b62d3){if(_0x1b62d3){return _0x1b62d3[_0xed2c('0x2b')]()['then'](function(){var _0x3bb243=_0x1b62d3['get']({'plain':!![]});var _0x1c6c00=_0xed2c('0x2c');return db['UserProfileResource'][_0xed2c('0x2b')]({'where':{'type':_0x1c6c00,'resourceId':_0x3bb243['id']}})[_0xed2c('0x16')](function(){return _0x1b62d3;});})[_0xed2c('0x16')](function(){_0x2ce2ce[_0xed2c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318ff1){return function(_0x272daf){if(!_0x272daf){_0x318ff1['sendStatus'](0x194);}return _0x272daf;};}function handleError(_0x292340,_0x5b634f){_0x5b634f=_0x5b634f||0x1f4;return function(_0x2d58bb){logger[_0xed2c('0x1a')](_0x2d58bb['stack']);if(_0x2d58bb['name']){delete _0x2d58bb[_0xed2c('0x2d')];}_0x292340[_0xed2c('0x21')](_0x5b634f)['send'](_0x2d58bb);};}exports[_0xed2c('0x2e')]=function(_0x544e68,_0x2e477c){var _0x44cfdf={'include':[{'model':db[_0xed2c('0x2f')],'as':_0xed2c('0x30')}]},_0x40c392={},_0x381a3d={'count':0x0,'rows':[]};var _0x1afb34=_['map'](db[_0xed2c('0x31')][_0xed2c('0x32')],function(_0x3155a4){return{'name':_0x3155a4[_0xed2c('0x33')],'type':_0x3155a4[_0xed2c('0x34')]['key']};});_0x40c392[_0xed2c('0x35')]=_['map'](_0x1afb34,_0xed2c('0x2d'));_0x40c392[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x544e68[_0xed2c('0x36')]);_0x40c392[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x40c392[_0xed2c('0x35')],_0x40c392[_0xed2c('0x36')]);_0x44cfdf[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x40c392[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x544e68[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x44cfdf[_0xed2c('0x3a')]=_0x44cfdf[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x44cfdf['attributes']:_0x40c392[_0xed2c('0x35')];if(!_0x544e68[_0xed2c('0x36')][_0xed2c('0x3d')]('nolimit')){_0x44cfdf[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0x544e68[_0xed2c('0x36')][_0xed2c('0x25')]);_0x44cfdf['offset']=qs[_0xed2c('0x24')](_0x544e68[_0xed2c('0x36')][_0xed2c('0x24')]);}_0x44cfdf['order']=qs[_0xed2c('0x3e')](_0x544e68[_0xed2c('0x36')]['sort']);_0x44cfdf['where']=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x544e68['query'],_0x40c392['filters']),_0x1afb34);if(_0x544e68[_0xed2c('0x36')][_0xed2c('0x40')]){_0x44cfdf[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x44cfdf[_0xed2c('0x41')],{'$or':_['map'](_0x1afb34,function(_0x44e92a){if(_0x44e92a[_0xed2c('0x34')]!=='VIRTUAL'){var _0x5490f0={};_0x5490f0[_0x44e92a[_0xed2c('0x2d')]]={'$like':'%'+_0x544e68[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x5490f0;}})});}_0x44cfdf=_[_0xed2c('0x42')]({},_0x44cfdf,_0x544e68['options']);var _0x26dc6e={'where':_0x44cfdf['where']};return db[_0xed2c('0x31')][_0xed2c('0x27')](_0x26dc6e)[_0xed2c('0x16')](function(_0x2ddf6e){_0x381a3d[_0xed2c('0x27')]=_0x2ddf6e;if(_0x544e68[_0xed2c('0x36')][_0xed2c('0x43')]){_0x44cfdf['include']=[{'all':!![]}];}return db[_0xed2c('0x31')][_0xed2c('0x44')](_0x44cfdf);})[_0xed2c('0x16')](function(_0x3b8dc7){_0x381a3d['rows']=_0x3b8dc7;return _0x381a3d;})[_0xed2c('0x16')](respondWithFilteredResult(_0x2e477c,_0x44cfdf))[_0xed2c('0x1f')](handleError(_0x2e477c,null));};exports[_0xed2c('0x45')]=function(_0x2963d4,_0x1501e3){var _0x42a42a={'raw':![],'where':{'id':_0x2963d4[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x2f')],'as':_0xed2c('0x30')}]},_0x48e252={};_0x48e252[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0x31')][_0xed2c('0x32')]);_0x48e252[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x2963d4['query']);_0x48e252[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x48e252[_0xed2c('0x35')],_0x48e252[_0xed2c('0x36')]);_0x42a42a[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x48e252[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x2963d4['query'][_0xed2c('0x3b')]));_0x42a42a[_0xed2c('0x3a')]=_0x42a42a[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x42a42a[_0xed2c('0x3a')]:_0x48e252[_0xed2c('0x35')];if(_0x2963d4[_0xed2c('0x36')][_0xed2c('0x43')]){_0x42a42a[_0xed2c('0x47')]=[{'all':!![]}];}_0x42a42a=_[_0xed2c('0x42')]({},_0x42a42a,_0x2963d4[_0xed2c('0x48')]);return db[_0xed2c('0x31')]['find'](_0x42a42a)[_0xed2c('0x16')](handleEntityNotFound(_0x1501e3,null))['then'](respondWithResult(_0x1501e3,null))[_0xed2c('0x1f')](handleError(_0x1501e3,null));};exports['create']=function(_0x2ce08b,_0xd9d431){return db[_0xed2c('0x31')][_0xed2c('0x49')](_0x2ce08b[_0xed2c('0x4a')],{})[_0xed2c('0x16')](function(_0x295164){var _0x28b4dc=_0x2ce08b['user'][_0xed2c('0x4b')]({'plain':!![]});if(!_0x28b4dc)throw new Error(_0xed2c('0x4c'));if(_0x28b4dc[_0xed2c('0x4d')]==='user'){var _0x3bf8f5=_0x295164[_0xed2c('0x4b')]({'plain':!![]});var _0x1a39df=_0xed2c('0x2c');return db['UserProfileSection'][_0xed2c('0x4e')]({'where':{'name':_0x1a39df,'userProfileId':_0x28b4dc[_0xed2c('0x4f')]},'raw':!![]})[_0xed2c('0x16')](function(_0x2256f4){if(_0x2256f4&&_0x2256f4['autoAssociation']===0x0){return db[_0xed2c('0x50')][_0xed2c('0x49')]({'name':_0x3bf8f5['name'],'resourceId':_0x3bf8f5['id'],'type':_0x2256f4[_0xed2c('0x2d')],'sectionId':_0x2256f4['id']},{})[_0xed2c('0x16')](function(){return _0x295164;});}else{return _0x295164;}})[_0xed2c('0x1f')](function(_0x26b912){logger[_0xed2c('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26b912);throw _0x26b912;});}return _0x295164;})[_0xed2c('0x16')](respondWithResult(_0xd9d431,0xc9))[_0xed2c('0x1f')](handleError(_0xd9d431,null));};exports[_0xed2c('0x2a')]=function(_0x40ebd2,_0x4733c1){if(_0x40ebd2[_0xed2c('0x4a')]['id']){delete _0x40ebd2['body']['id'];}return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x40ebd2[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x2f')],'as':_0xed2c('0x30')}]})[_0xed2c('0x16')](handleEntityNotFound(_0x4733c1,null))[_0xed2c('0x16')](saveUpdates(_0x40ebd2[_0xed2c('0x4a')],null))[_0xed2c('0x16')](respondWithResult(_0x4733c1,null))[_0xed2c('0x1f')](handleError(_0x4733c1,null));};exports[_0xed2c('0x2b')]=function(_0x52bba2,_0x589737){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x52bba2[_0xed2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x589737,null))[_0xed2c('0x16')](removeEntity(_0x589737,null))['catch'](handleError(_0x589737,null));};exports[_0xed2c('0x51')]=function(_0x1b53ba,_0x409da0){return db[_0xed2c('0x31')][_0xed2c('0x51')]()['then'](respondWithResult(_0x409da0,null))[_0xed2c('0x1f')](handleError(_0x409da0,null));};exports[_0xed2c('0x52')]=function(_0x9ebef5,_0x5b806e){if(_0x9ebef5['body']['id']){delete _0x9ebef5[_0xed2c('0x4a')]['id'];}return db[_0xed2c('0x31')]['find']({'where':{'id':_0x9ebef5['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5b806e,null))[_0xed2c('0x16')](function(_0x2dc76d){if(_0x2dc76d){_0x9ebef5[_0xed2c('0x4a')][_0xed2c('0x53')]=_0x2dc76d['id'];return db['Disposition'][_0xed2c('0x49')](_0x9ebef5[_0xed2c('0x4a')]);}})[_0xed2c('0x16')](respondWithResult(_0x5b806e,null))['catch'](handleError(_0x5b806e,null));};exports['getDispositions']=function(_0x2bd18b,_0x5212ac){var _0x9bdb7c={'raw':![],'where':{}};var _0x15a1da={};var _0x540727={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xed2c('0x54')]({'where':{'id':_0x2bd18b[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5212ac,null))[_0xed2c('0x16')](function(_0x1237ec){if(_0x1237ec){_0x15a1da[_0xed2c('0x35')]=_[_0xed2c('0x37')](db['Disposition'][_0xed2c('0x32')]);_0x15a1da[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x2bd18b['query']);_0x15a1da['filters']=_[_0xed2c('0x39')](_0x15a1da[_0xed2c('0x35')],_0x15a1da['query']);_0x9bdb7c[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x15a1da['model'],qs[_0xed2c('0x3b')](_0x2bd18b[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x9bdb7c[_0xed2c('0x3a')]=_0x9bdb7c[_0xed2c('0x3a')]['length']?_0x9bdb7c[_0xed2c('0x3a')]:_0x15a1da['model'];if(!_0x2bd18b[_0xed2c('0x36')]['hasOwnProperty'](_0xed2c('0x55'))){_0x9bdb7c['limit']=qs[_0xed2c('0x25')](_0x2bd18b['query'][_0xed2c('0x25')]);_0x9bdb7c[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x2bd18b['query']['offset']);}_0x9bdb7c[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x2bd18b['query'][_0xed2c('0x3e')]);_0x9bdb7c['where']=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x2bd18b[_0xed2c('0x36')],_0x15a1da['filters']));_0x9bdb7c[_0xed2c('0x41')]['ChatWebsiteId']=_0x1237ec['id'];if(_0x2bd18b['query'][_0xed2c('0x40')]){_0x9bdb7c[_0xed2c('0x41')]=_['merge'](_0x9bdb7c[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x9bdb7c['attributes'],function(_0x18b309){var _0x8577b6={};_0x8577b6[_0x18b309]={'$like':'%'+_0x2bd18b[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x8577b6;})});}_0x9bdb7c=_[_0xed2c('0x42')]({},_0x9bdb7c,_0x2bd18b['options']);return db[_0xed2c('0x58')]['count']({'where':_0x9bdb7c[_0xed2c('0x41')]})[_0xed2c('0x16')](function(_0x15f18c){_0x540727['count']=_0x15f18c;if(_0x2bd18b[_0xed2c('0x36')][_0xed2c('0x43')]){_0x9bdb7c[_0xed2c('0x47')]=[{'all':!![]}];}return db[_0xed2c('0x58')][_0xed2c('0x44')](_0x9bdb7c);})['then'](function(_0x10c7fe){_0x540727[_0xed2c('0x59')]=_0x10c7fe;return _0x540727;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x5212ac,_0x9bdb7c))[_0xed2c('0x1f')](handleError(_0x5212ac,null));};exports['removeDispositions']=function(_0x23e6ef,_0x2731b5){return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x23e6ef[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x2731b5,null))[_0xed2c('0x16')](function(_0x55a57f){if(_0x55a57f){return _0x55a57f[_0xed2c('0x5a')](_0x23e6ef[_0xed2c('0x36')][_0xed2c('0x5b')]);}})[_0xed2c('0x16')](respondWithStatusCode(_0x2731b5,null))[_0xed2c('0x1f')](handleError(_0x2731b5,null));};exports[_0xed2c('0x5c')]=function(_0x54fdb5,_0x14b694){if(_0x54fdb5[_0xed2c('0x4a')]['id']){delete _0x54fdb5[_0xed2c('0x4a')]['id'];}return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x54fdb5['params']['id']}})['then'](handleEntityNotFound(_0x14b694,null))[_0xed2c('0x16')](function(_0x5b6a5c){if(_0x5b6a5c){_0x54fdb5[_0xed2c('0x4a')][_0xed2c('0x53')]=_0x5b6a5c['id'];return db[_0xed2c('0x5d')][_0xed2c('0x49')](_0x54fdb5[_0xed2c('0x4a')]);}})[_0xed2c('0x16')](respondWithResult(_0x14b694,null))[_0xed2c('0x1f')](handleError(_0x14b694,null));};exports[_0xed2c('0x5e')]=function(_0x13b184,_0x3ea9f7){var _0x783172={'raw':![],'where':{}};var _0x3264ef={};var _0x5aa810={'count':0x0,'rows':[]};return db[_0xed2c('0x31')]['findOne']({'where':{'id':_0x13b184[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x3ea9f7,null))[_0xed2c('0x16')](function(_0x1e9f31){if(_0x1e9f31){_0x3264ef[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0x5d')][_0xed2c('0x32')]);_0x3264ef[_0xed2c('0x36')]=_['keys'](_0x13b184['query']);_0x3264ef[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x3264ef['model'],_0x3264ef[_0xed2c('0x36')]);_0x783172[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x3264ef[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x13b184[_0xed2c('0x36')]['fields']));_0x783172[_0xed2c('0x3a')]=_0x783172[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x783172[_0xed2c('0x3a')]:_0x3264ef[_0xed2c('0x35')];if(!_0x13b184[_0xed2c('0x36')][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x783172[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0x13b184[_0xed2c('0x36')][_0xed2c('0x25')]);_0x783172[_0xed2c('0x24')]=qs['offset'](_0x13b184[_0xed2c('0x36')]['offset']);}_0x783172['order']=qs[_0xed2c('0x3e')](_0x13b184['query']['sort']);_0x783172[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x13b184['query'],_0x3264ef[_0xed2c('0x38')]));_0x783172[_0xed2c('0x41')]['ChatWebsiteId']=_0x1e9f31['id'];if(_0x13b184[_0xed2c('0x36')]['filter']){_0x783172[_0xed2c('0x41')]=_['merge'](_0x783172[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x783172[_0xed2c('0x3a')],function(_0x4c3c0d){var _0x2461ed={};_0x2461ed[_0x4c3c0d]={'$like':'%'+_0x13b184[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x2461ed;})});}_0x783172=_['merge']({},_0x783172,_0x13b184['options']);return db[_0xed2c('0x5d')]['count']({'where':_0x783172[_0xed2c('0x41')]})['then'](function(_0x175133){_0x5aa810[_0xed2c('0x27')]=_0x175133;if(_0x13b184[_0xed2c('0x36')]['includeAll']){_0x783172['include']=[{'all':!![]}];}return db[_0xed2c('0x5d')][_0xed2c('0x44')](_0x783172);})[_0xed2c('0x16')](function(_0x3ab23c){_0x5aa810['rows']=_0x3ab23c;return _0x5aa810;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x3ea9f7,_0x783172))[_0xed2c('0x1f')](handleError(_0x3ea9f7,null));};exports['removeAnswers']=function(_0x4a45b5,_0x3352e7){return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x4a45b5[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x3352e7,null))[_0xed2c('0x16')](function(_0x5a9a5b){if(_0x5a9a5b){return _0x5a9a5b[_0xed2c('0x5f')](_0x4a45b5[_0xed2c('0x36')][_0xed2c('0x5b')]);}})[_0xed2c('0x16')](respondWithStatusCode(_0x3352e7,null))[_0xed2c('0x1f')](handleError(_0x3352e7,null));};exports['addLogo']=function(_0x2562e3,_0x61960f){_0x2562e3['body'][_0xed2c('0x60')]=_0x2562e3[_0xed2c('0x61')][_0xed2c('0x62')];return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x2562e3['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x61960f,null))[_0xed2c('0x16')](saveUpdates(_0x2562e3[_0xed2c('0x4a')],null))[_0xed2c('0x16')](respondWithResult(_0x61960f,null))['catch'](handleError(_0x61960f,null));};exports['addAvatar']=function(_0x4b3b81,_0x5e1440){_0x4b3b81[_0xed2c('0x4a')][_0xed2c('0x63')]=_0x4b3b81[_0xed2c('0x61')][_0xed2c('0x62')];return db['ChatWebsite'][_0xed2c('0x4e')]({'where':{'id':_0x4b3b81[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5e1440,null))[_0xed2c('0x16')](saveUpdates(_0x4b3b81[_0xed2c('0x4a')],null))[_0xed2c('0x16')](respondWithResult(_0x5e1440,null))[_0xed2c('0x1f')](handleError(_0x5e1440,null));};exports['addCustomerAvatar']=function(_0x31fefb,_0x906449){_0x31fefb[_0xed2c('0x4a')][_0xed2c('0x64')]=_0x31fefb[_0xed2c('0x61')][_0xed2c('0x62')];return db[_0xed2c('0x31')]['find']({'where':{'id':_0x31fefb[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x906449,null))[_0xed2c('0x16')](saveUpdates(_0x31fefb[_0xed2c('0x4a')],null))['then'](respondWithResult(_0x906449,null))[_0xed2c('0x1f')](handleError(_0x906449,null));};exports[_0xed2c('0x65')]=function(_0x4520db,_0x1b92ab){_0x4520db[_0xed2c('0x4a')]['systemAvatar']=_0x4520db[_0xed2c('0x61')][_0xed2c('0x62')];return db[_0xed2c('0x31')]['find']({'where':{'id':_0x4520db['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x1b92ab,null))[_0xed2c('0x16')](saveUpdates(_0x4520db[_0xed2c('0x4a')],null))['then'](respondWithResult(_0x1b92ab,null))[_0xed2c('0x1f')](handleError(_0x1b92ab,null));};exports[_0xed2c('0x66')]=function(_0xc55ed8,_0xab8ab1){var _0x20d65c=path['join'](config[_0xed2c('0x67')],'server/files/images/logos/default_logo.svg');var _0xb39d5b={'where':{'id':_0xc55ed8[_0xed2c('0x46')]['id']},'attributes':['id',_0xed2c('0x60')],'raw':!![]};var _0x3cc498=![];return require(_0xed2c('0x68'))[_0xed2c('0x69')]()[_0xed2c('0x16')](function(_0x1c2a77){if(_0x1c2a77){_0x3cc498=_0x1c2a77[_0xed2c('0x6a')];}})[_0xed2c('0x16')](function(){return db[_0xed2c('0x31')][_0xed2c('0x4e')](_0xb39d5b);})[_0xed2c('0x16')](handleEntityNotFound(_0xab8ab1,null))['then'](function(_0x5ce687){if(_0x5ce687){if(!_[_0xed2c('0x6b')](_0x5ce687[_0xed2c('0x60')])){if(fs[_0xed2c('0x6c')](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x6e'),_0x5ce687[_0xed2c('0x60')]))&&_0x3cc498){_0x20d65c=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x6e'),_0x5ce687[_0xed2c('0x60')]);}}return _0xab8ab1[_0xed2c('0x6f')](_0x20d65c);}})[_0xed2c('0x1f')](handleError(_0xab8ab1,null));};exports['getAvatar']=function(_0x2ccda7,_0x250b37){var _0x1e18a7=path[_0xed2c('0x6d')](config['root'],_0xed2c('0x70'));var _0x2e5266={'where':{'id':_0x2ccda7['params']['id']},'attributes':['id',_0xed2c('0x63')],'raw':!![]};return db['ChatWebsite'][_0xed2c('0x4e')](_0x2e5266)[_0xed2c('0x16')](handleEntityNotFound(_0x250b37,null))[_0xed2c('0x16')](function(_0x2fb96b){if(_0x2fb96b){if(!_[_0xed2c('0x6b')](_0x2fb96b['agentAvatar'])){if(fs['existsSync'](path[_0xed2c('0x6d')](config['root'],_0xed2c('0x71'),_0x2fb96b[_0xed2c('0x63')]))){_0x1e18a7=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x2fb96b['agentAvatar']);}}return _0x250b37[_0xed2c('0x6f')](_0x1e18a7);}})['catch'](handleError(_0x250b37,null));};exports[_0xed2c('0x72')]=function(_0x3b78e4,_0x5644c2){var _0x966824=path[_0xed2c('0x6d')](config['root'],_0xed2c('0x73'));var _0x501dca={'where':{'id':_0x3b78e4['params']['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xed2c('0x31')][_0xed2c('0x4e')](_0x501dca)[_0xed2c('0x16')](handleEntityNotFound(_0x5644c2,null))[_0xed2c('0x16')](function(_0x57f876){if(_0x57f876){if(!_['isNil'](_0x57f876[_0xed2c('0x64')])){if(fs['existsSync'](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x57f876[_0xed2c('0x64')]))&&_0x57f876[_0xed2c('0x74')]){_0x966824=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],'server/files/images/avatars/',_0x57f876[_0xed2c('0x64')]);}}return _0x5644c2[_0xed2c('0x6f')](_0x966824);}})[_0xed2c('0x1f')](handleError(_0x5644c2,null));};exports['getSystemAvatar']=function(_0x270150,_0x52a2de){var _0x446d53=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x75'));var _0x3fab0c={'where':{'id':_0x270150[_0xed2c('0x46')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xed2c('0x31')][_0xed2c('0x4e')](_0x3fab0c)[_0xed2c('0x16')](handleEntityNotFound(_0x52a2de,null))['then'](function(_0x5a8652){if(_0x5a8652){if(!_['isNil'](_0x5a8652[_0xed2c('0x76')])){if(fs[_0xed2c('0x6c')](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x5a8652[_0xed2c('0x76')]))){_0x446d53=path['join'](config[_0xed2c('0x67')],_0xed2c('0x71'),_0x5a8652[_0xed2c('0x76')]);}}return _0x52a2de[_0xed2c('0x6f')](_0x446d53);}})['catch'](handleError(_0x52a2de,null));};exports[_0xed2c('0x77')]=function(_0x2b69d8,_0x17be26){var _0x1eb252=require('user-agent-parser');var _0x4033aa=new _0x1eb252();var _0x288ec1=_0x4033aa[_0xed2c('0x78')](_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x7a')])[_0xed2c('0x7b')]();var _0xe00116={'body':_0x2b69d8['body'],'channel':_0xed2c('0x7c')};var _0x5a73ac=[];var _0x3cf43a=[];var _0x34eea9={};var _0x5832de=![];return db[_0xed2c('0x7d')][_0xed2c('0x51')]()[_0xed2c('0x16')](function(_0x4001f2){if(!_0x4001f2){throw new db['Sequelize']['ValidationError'](_0xed2c('0x7e'));}_0x5a73ac=_[_0xed2c('0x7f')](_[_0xed2c('0x37')](_0x4001f2),[_0xed2c('0x80'),'updatedAt']);_0x3cf43a=_[_0xed2c('0x7f')](_[_0xed2c('0x37')](_0x4001f2),[_0xed2c('0x80'),_0xed2c('0x81'),'CompanyId',_0xed2c('0x82')]);if(_0x2b69d8[_0xed2c('0x4a')]['id']){delete _0x2b69d8[_0xed2c('0x4a')]['id'];}if(_[_0xed2c('0x6b')](_0x2b69d8[_0xed2c('0x4a')]['from'])){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x4a')])||_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x4a')]===''){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))](_0xed2c('0x85'));}if(_[_0xed2c('0x6b')](_0x2b69d8[_0xed2c('0x4a')]['mapKey'])){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cf43a);}if(!_['includes'](_0x3cf43a,_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x86')])){throw new db['Sequelize'][(_0xed2c('0x84'))](_0xed2c('0x87')+_0x3cf43a);}_0x34eea9[_0x2b69d8['body'][_0xed2c('0x86')]]=_0x2b69d8[_0xed2c('0x4a')]['from'];})[_0xed2c('0x16')](function(){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x2b69d8[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x88')],'as':_0xed2c('0x89'),'include':[{'model':db[_0xed2c('0x7d')],'as':_0xed2c('0x8a'),'where':_0x34eea9,'limit':0x1,'order':[[_0xed2c('0x81'),'DESC']]}]},{'model':db[_0xed2c('0x8b')],'as':_0xed2c('0x8c')}]});})[_0xed2c('0x16')](handleEntityNotFound(_0x17be26,null))[_0xed2c('0x16')](function(_0x2ff81d){if(_0x2ff81d&&_0x2ff81d[_0xed2c('0x89')]){_0xe00116['account']=_0x2ff81d;_0xe00116['applications']=_0x2ff81d['Applications'];_0xe00116[_0xed2c('0x8d')]=_0x2ff81d[_0xed2c('0x89')];_0xe00116[_0xed2c('0x8e')]=_[_0xed2c('0x8f')](_0xe00116[_0xed2c('0x8e')],[_0xed2c('0x90')],[_0xed2c('0x91')]);if(_0xe00116[_0xed2c('0x92')][_0xed2c('0x8c')]){delete _0xe00116[_0xed2c('0x92')][_0xed2c('0x8c')];}if(_0xe00116[_0xed2c('0x92')][_0xed2c('0x89')]&&_0xe00116[_0xed2c('0x92')][_0xed2c('0x89')][_0xed2c('0x8a')][_0xed2c('0x3c')]){return _0xe00116[_0xed2c('0x92')][_0xed2c('0x89')][_0xed2c('0x8a')][0x0];}var _0x2fb00d=_[_0xed2c('0xe')](_0x2b69d8[_0xed2c('0x4a')],{'firstName':_0x2b69d8['body'][_0xed2c('0x93')],'ListId':_0x2ff81d[_0xed2c('0x82')]});_0x2fb00d[_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x86')]]=_0x2b69d8['body']['from'];return db[_0xed2c('0x7d')][_0xed2c('0x49')](_0x2fb00d,{'fields':_0x5a73ac,'raw':!![]});}})['then'](handleEntityNotFound(_0x17be26,null))[_0xed2c('0x16')](function(_0x2cdfd3){_0xe00116[_0xed2c('0x94')]=_0x2cdfd3;var _0x5e86d5=_0x2b69d8['body']['customerIp'];if(_0x2b69d8[_0xed2c('0x79')]['cf-connecting-ip']){_0x5e86d5=_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x95')];}else if(_0x2b69d8[_0xed2c('0x79')]['x-forwarded-for']){_0x5e86d5=_['first'](_0x2b69d8['headers'][_0xed2c('0x96')][_0xed2c('0x97')](','));}if(_0x2cdfd3){var _0x837254={'ContactId':_0x2cdfd3['id'],'ChatWebsiteId':_0x2b69d8[_0xed2c('0x46')]['id'],'from':(_0x2cdfd3[_0xed2c('0x98')]||'')+'\x20'+(_0x2cdfd3[_0xed2c('0x99')]||''),'customerIp':_0x5e86d5,'customerPort':_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x9a')]?_0x2b69d8[_0xed2c('0x79')][_0xed2c('0x9a')]:null,'referer':_0x2b69d8['body']['referer'],'browserName':_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x2d')]&&_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x9c')]?util['format'](_0xed2c('0x9d'),_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x2d')],_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x9c')]):_0xed2c('0x9e'),'browserVersion':_0x288ec1[_0xed2c('0x9b')][_0xed2c('0x9c')]||'unknown','osName':util[_0xed2c('0x9f')](_0xed2c('0x9d'),_0x288ec1['os']['name'],_0x288ec1['os'][_0xed2c('0x9c')]),'osVersion':_0x288ec1['os'][_0xed2c('0x9c')],'deviceModel':_0x288ec1[_0xed2c('0xa0')][_0xed2c('0x35')]&&_0x288ec1[_0xed2c('0xa0')][_0xed2c('0xa1')]?util[_0xed2c('0x9f')](_0xed2c('0xa2'),_0x288ec1[_0xed2c('0xa0')][_0xed2c('0x35')],_0x288ec1[_0xed2c('0xa0')][_0xed2c('0xa1')],_0x288ec1['device'][_0xed2c('0x34')]):null,'deviceVendor':_0x288ec1[_0xed2c('0xa0')][_0xed2c('0xa1')],'deviceType':_0x288ec1[_0xed2c('0xa0')][_0xed2c('0x34')],'formData':JSON[_0xed2c('0xa3')](_0x2b69d8[_0xed2c('0x4a')])};var _0x1aa150={'ChatWebsiteId':_0x2b69d8[_0xed2c('0x46')]['id'],'closed':![]};if(_0x2b69d8['body'][_0xed2c('0xa4')]){_0x1aa150[_0xed2c('0xa4')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa4')];return db[_0xed2c('0xa5')][_0xed2c('0x4e')]({'where':_0x1aa150})[_0xed2c('0x16')](function(_0x5e78b8){if(_0x5e78b8){return[_0x5e78b8,![]];}_0x837254[_0xed2c('0xa4')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa4')];_0x837254[_0xed2c('0xa6')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa6')];return db[_0xed2c('0xa5')][_0xed2c('0x49')](_0x837254)['then'](function(_0x4dca4a){return[_0x4dca4a,!![]];});});}_0x1aa150[_0xed2c('0xa7')]=_0x2cdfd3['id'];if(_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa8')]&&_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa8')]['id']){_0x1aa150['id']=_0x2b69d8[_0xed2c('0x4a')]['interaction']['id'];return db['ChatInteraction'][_0xed2c('0x4e')]({'where':_0x1aa150})['then'](function(_0x32708d){if(_0x32708d){return[_0x32708d,![]];}return db[_0xed2c('0xa5')]['create'](_0x837254)[_0xed2c('0x16')](function(_0x247c6b){return[_0x247c6b,!![]];});});}return db['ChatInteraction'][_0xed2c('0x49')](_0x837254)[_0xed2c('0x16')](function(_0xe0dcc0){return[_0xe0dcc0,!![]];});}})[_0xed2c('0xa9')](function(_0x496fb7,_0x3bf42f){if(_0x496fb7){_0x5832de=_0x3bf42f;if(!_0x3bf42f){var _0x2d0381={'from':(_0xe00116[_0xed2c('0x94')][_0xed2c('0x98')]||'')+'\x20'+(_0xe00116[_0xed2c('0x94')][_0xed2c('0x99')]||'')};if(_0x2b69d8[_0xed2c('0x4a')]['threadId']&&_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xaa')]&&_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xa4')]!=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xaa')]){_0x2d0381[_0xed2c('0xa4')]=_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0xaa')];}return _0x496fb7['update'](_0x2d0381);}else{return _0x496fb7;}}})[_0xed2c('0x16')](function(_0x43c627){_0xe00116[_0xed2c('0xa8')]=_0x43c627[_0xed2c('0x4b')]({'plain':!![]});_0xe00116[_0xed2c('0xa8')][_0xed2c('0xab')]=_0x5832de;if(_0xe00116[_0xed2c('0xa8')]['created']){if(_0xe00116[_0xed2c('0x92')][_0xed2c('0xac')]){_0xe00116['applications'][_0xed2c('0xad')]({'id':0x0,'priority':_0xe00116[_0xed2c('0x8e')][_0xed2c('0x3c')]+0x1,'app':_0xed2c('0xae'),'appdata':_0xed2c('0xaf'),'interval':_0xed2c('0xb0')});}}return db[_0xed2c('0xb1')][_0xed2c('0x49')]({'body':_0x2b69d8[_0xed2c('0x4a')][_0xed2c('0x4a')],'ChatWebsiteId':_0x2b69d8['params']['id'],'ChatInteractionId':_0x43c627['id'],'direction':'in','ContactId':_0xe00116[_0xed2c('0x94')]['id'],'AttachmentId':_0x2b69d8['body'][_0xed2c('0xb2')]});})[_0xed2c('0x16')](function(_0x3fd0da){_0xe00116['message']=_0x3fd0da;if(_0xe00116['interaction'][_0xed2c('0xb3')]){return db[_0xed2c('0xb4')][_0xed2c('0x4e')]({'attributes':['id',_0xed2c('0x2d')],'where':{'id':_0xe00116['interaction'][_0xed2c('0xb3')]}})[_0xed2c('0x16')](function(_0x1a8d6f){if(_0x1a8d6f){_0xe00116[_0xed2c('0x8e')][_0xed2c('0xb5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a8d6f[_0xed2c('0x2d')]+','+(_0xe00116['account'][_0xed2c('0xb6')]||0xa),'interval':_0xed2c('0xb0')});_0xe00116['forcedOwnership']=!![];}return respondWithRpcPromise(_0xed2c('0xb7'),_0xed2c('0xb8'),_0xe00116);});}return respondWithRpcPromise(_0xed2c('0xb7'),_0xed2c('0xb8'),_0xe00116);})['then'](function(_0x254f31){respondWithRpcPromise(_0xed2c('0xb9'),'EventManager',{'event':_0xed2c('0x77'),'message':_0x254f31},client9002);return _0x254f31;})[_0xed2c('0x16')](respondWithResult(_0x17be26,null))[_0xed2c('0x1f')](handleError(_0x17be26,null));};exports[_0xed2c('0xba')]=function(_0x2da941,_0x3c5da6){var _0x118e22,_0x17426a,_0x382b79;var _0x2e94bb=[];var _0x481aa5={};var _0x4a2ae4=_0x2da941[_0xed2c('0xbb')]||[];var _0x449f20=[];var _0x410c3a;return db[_0xed2c('0x7d')][_0xed2c('0x51')]()['then'](function(_0x264689){if(!_0x264689){throw new db[(_0xed2c('0x83'))][(_0xed2c('0x84'))]('no\x20available\x20attributes');}_0x2e94bb=_[_0xed2c('0x7f')](_[_0xed2c('0x37')](_0x264689),[_0xed2c('0x80'),_0xed2c('0x81'),_0xed2c('0xbc'),_0xed2c('0x82')]);if(_0x2da941['body']['id']){delete _0x2da941[_0xed2c('0x4a')]['id'];}if(_[_0xed2c('0x6b')](_0x2da941['body'][_0xed2c('0x93')])){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db['Sequelize'][(_0xed2c('0x84'))]('from\x20is\x20mandatory'));}if(_[_0xed2c('0x6b')](_0x2da941[_0xed2c('0x4a')][_0xed2c('0x4a')])||_0x2da941['body'][_0xed2c('0x4a')]===''){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db[(_0xed2c('0x83'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xed2c('0x6b')](_0x2da941['body'][_0xed2c('0xbe')])){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db['Sequelize'][(_0xed2c('0x84'))](_0xed2c('0xbf')+_0x2e94bb));}if(!_[_0xed2c('0xc0')](_0x2e94bb,_0x2da941[_0xed2c('0x4a')][_0xed2c('0xbe')])){throw _0x3c5da6[_0xed2c('0x21')](0x1f4)[_0xed2c('0xbd')](new db['Sequelize']['ValidationError'](_0xed2c('0xc1')+_0x2e94bb));}_0x481aa5[_0x2da941[_0xed2c('0x4a')][_0xed2c('0xbe')]]=_0x2da941[_0xed2c('0x4a')]['from'];})[_0xed2c('0x16')](function(){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x2da941[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0x88')],'as':_0xed2c('0x89')},{'model':db[_0xed2c('0xc2')],'as':_0xed2c('0xc2')}]});})[_0xed2c('0x16')](handleEntityNotFound(_0x3c5da6,null))[_0xed2c('0x16')](function(_0x39b165){if(_0x39b165&&_0x39b165[_0xed2c('0x89')]){_0x17426a=_0x39b165;var _0x16b357=_[_0xed2c('0xe')](_0x2da941[_0xed2c('0x4a')],{'firstName':_0x2da941['body'][_0xed2c('0x93')],'phone':_0x2da941[_0xed2c('0x4a')]['from'],'ListId':_0x39b165[_0xed2c('0x82')]});_0x16b357[_0x2da941[_0xed2c('0x4a')][_0xed2c('0xbe')]]=_0x2da941[_0xed2c('0x4a')][_0xed2c('0x93')];return db[_0xed2c('0x7d')]['findOrCreate']({'where':_0x481aa5,'defaults':_0x16b357});}})[_0xed2c('0xa9')](function(_0x36da32){if(_0x36da32){_0x382b79=_0x36da32;var _0x4781e4=fs['readFileSync'](path['join'](config[_0xed2c('0x67')],_0xed2c('0xc3')),'utf8');var _0x4cc773=ejs[_0xed2c('0xc4')](_0x4781e4,{'body':_[_0xed2c('0xc5')](_0x2da941[_0xed2c('0x4a')]['body']),'bodyTitle':_0x17426a['offlineMessageBody']});return db[_0xed2c('0xc6')][_0xed2c('0x49')]({'body':_0x4cc773,'plainBody':htmlToText['fromString'](_0x4cc773),'ContactId':_0x36da32['id'],'ChatWebsiteId':_0x17426a['id']});}})[_0xed2c('0x16')](function(_0x53c6d2){_0x410c3a=_0x53c6d2;if(_0x4a2ae4[_0xed2c('0x3c')]){var _0x12aa08=_0x4a2ae4['map'](function(_0x212293){return{'name':_0x212293[_0xed2c('0xc7')],'basename':_0x212293['filename'],'type':_0x212293[_0xed2c('0xc8')],'ChatOfflineMessageId':_0x53c6d2['id']};});_0x449f20=_0x12aa08[_0xed2c('0x57')](_0x4e5dff=>{var _0x43cdab={'filename':_0x4e5dff[_0xed2c('0x2d')],'path':path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0xc9'),'files',_0xed2c('0xca'),'offline-chat',_0x4e5dff[_0xed2c('0xcb')])};return _0x43cdab;});if(!_0x17426a[_0xed2c('0xcc')]){return db[_0xed2c('0xcd')][_0xed2c('0xce')](function(_0x5126b4){return db[_0xed2c('0xcf')][_0xed2c('0xd0')](_0x12aa08,{'transaction':_0x5126b4});});}}})[_0xed2c('0x16')](function(){if(_0x410c3a){_0x118e22=_0x410c3a;return db[_0xed2c('0xc2')][_0xed2c('0x54')]({'where':{'active':!![]},'include':[{'model':db[_0xed2c('0xd1')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xed2c('0xd2'),'raw':!![]}]}]});}})[_0xed2c('0x16')](function(_0x4ac39d){if(_0x4ac39d&&_0x4ac39d[_0xed2c('0xd3')]&&_0x17426a[_0xed2c('0xd4')]&&_0x17426a[_0xed2c('0xd5')]){var _0xe2266f=_0x4ac39d[_0xed2c('0xd6')]();return respondWithRpcPromise(_0xed2c('0xd7'),_0xed2c('0xd8'),{'account':_0xe2266f,'message':{'from':util[_0xed2c('0x9f')](_0xed2c('0xd9'),_0x4ac39d[_0xed2c('0x2d')],_0x4ac39d['email']||_0x4ac39d[_0xed2c('0xd3')][_0xed2c('0xda')]),'to':_0x17426a[_0xed2c('0xd5')],'subject':_0x17426a['offlineMessageSubject'],'html':_0x118e22[_0xed2c('0x4a')],'attachments':_0x449f20}},client9003)[_0xed2c('0x16')](function(){return _0x118e22;})[_0xed2c('0x1f')](function(_0x21743d){logger['error'](_0x21743d);});}})[_0xed2c('0x16')](function(){if(_0x17426a&&_0x17426a[_0xed2c('0xcc')]&&_0x17426a[_0xed2c('0xdb')]){var _0x13aeb1=[];if(_0x4a2ae4['length']){_0x13aeb1=_0x4a2ae4['map'](function(_0x50bdb2){return{'name':_0x50bdb2[_0xed2c('0xc7')],'basename':_0x50bdb2[_0xed2c('0x62')],'type':_0x50bdb2[_0xed2c('0xc8')],'ChatOfflineMessageId':_0x410c3a['id']};});}var _0x3ad984;if(!_[_0xed2c('0x6b')](_0x17426a[_0xed2c('0xdc')])){var _0x18a516=_[_0xed2c('0x57')](_0x2da941[_0xed2c('0x4a')],function(_0x4d20ef){return _0x4d20ef;});var _0x1ebabd=_[_0xed2c('0xdd')](_0x18a516)[0x0];var _0x40abfe=_[_0xed2c('0xde')](_0x1ebabd,function(_0x24ebed){return _0x24ebed;});_0x3ad984=_0x40abfe[0x1][_0x17426a[_0xed2c('0xdc')]];}var _0x556247={'from':_0x382b79[_0xed2c('0xdf')],'firstName':_0x382b79[_0xed2c('0x98')],'lastName':_0x382b79[_0xed2c('0x99')],'mapKey':_0xed2c('0xdf'),'message':{'from':_0x382b79[_0xed2c('0xdf')],'to':_0x17426a[_0xed2c('0xc2')][_0xed2c('0xdf')],'cc':'','subject':_[_0xed2c('0x6b')](_0x3ad984)?_0x17426a[_0xed2c('0xe0')]:_0x3ad984,'messageId':'','sentAt':new Date(),'attach':_0x13aeb1[_0xed2c('0x3c')],'attachments':_0x13aeb1,'originChannel':_0xed2c('0xe1'),'ChatWebsiteId':_0x17426a['id'],'ChatOfflineMessageId':_0x118e22['id'],'originTo':_0x17426a[_0xed2c('0xc2')]['email']},'body':_0x118e22[_0xed2c('0x4a')]};var _0x55fb88={'account':{'id':_0x17426a[_0xed2c('0xdb')]},'body':_0x556247,'log':_0xed2c('0xe2')};return respondWithRpcPromise(_0xed2c('0xe2'),_0xed2c('0xe3'),_0x55fb88,client9001)[_0xed2c('0x16')](function(){return _0x118e22;})[_0xed2c('0x1f')](function(_0x2ef5f5){logger['error'](_0x2ef5f5);});}return;})['then'](function(){if(_0x118e22){return _0x118e22;}})['then'](respondWithResult(_0x3c5da6,null))[_0xed2c('0x1f')](function(_0x34ea16){logger[_0xed2c('0x1a')](_0xed2c('0x1f'),_0x34ea16);for(var _0x53b6fc of _0x4a2ae4){var _0xa6048a=path[_0xed2c('0x6d')](config[_0xed2c('0x67')],_0xed2c('0xc9'),_0xed2c('0xbb'),'attachments',_0xed2c('0xe4'),_0x53b6fc[_0xed2c('0x62')]);fs_extra[_0xed2c('0xe5')](_0xa6048a)[_0xed2c('0x1f')](function(_0x5ea21a){logger[_0xed2c('0x1a')](_0xed2c('0xe6'),_0xa6048a,_0x5ea21a);});}});};exports[_0xed2c('0xe7')]=function(_0x1dc313,_0x492558){return db[_0xed2c('0xa5')]['find']({'where':{'id':_0x1dc313[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x492558,null))[_0xed2c('0x16')](function(_0x46f6d5){if(_0x46f6d5){return _0x46f6d5[_0xed2c('0xe7')](_0x1dc313['body'][_0xed2c('0x5b')],_[_0xed2c('0xe8')](_0x1dc313[_0xed2c('0x4a')],[_0xed2c('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x492558,null))[_0xed2c('0x1f')](handleError(_0x492558,null));};exports[_0xed2c('0xe9')]=function(_0x4cf396,_0x1c7787){var _0x452817={'raw':![],'where':{}};var _0x178b48={};var _0x4ae2d2={'count':0x0,'rows':[]};return db[_0xed2c('0x31')]['findOne']({'where':{'id':_0x4cf396[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x1c7787,null))[_0xed2c('0x16')](function(_0xe09e6b){if(_0xe09e6b){_0x178b48[_0xed2c('0x35')]=_['keys'](db['ChatInteraction'][_0xed2c('0x32')]);_0x178b48['query']=_[_0xed2c('0x37')](_0x4cf396[_0xed2c('0x36')]);_0x178b48['filters']=_[_0xed2c('0x39')](_0x178b48['model'],_0x178b48['query']);_0x452817['attributes']=_[_0xed2c('0x39')](_0x178b48[_0xed2c('0x35')],qs['fields'](_0x4cf396['query'][_0xed2c('0x3b')]));_0x452817['attributes']=_0x452817['attributes']['length']?_0x452817['attributes']:_0x178b48[_0xed2c('0x35')];if(!_0x4cf396['query'][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x452817[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0x4cf396['query']['limit']);_0x452817[_0xed2c('0x24')]=qs['offset'](_0x4cf396[_0xed2c('0x36')]['offset']);}_0x452817[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x4cf396[_0xed2c('0x36')]['sort']);_0x452817[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x4cf396['query'],_0x178b48['filters']));_0x452817[_0xed2c('0x41')][_0xed2c('0x53')]=_0xe09e6b['id'];if(_0x4cf396[_0xed2c('0x36')][_0xed2c('0x40')]){_0x452817[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x452817[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x452817['attributes'],function(_0x5968fd){var _0x2005ed={};_0x2005ed[_0x5968fd]={'$like':'%'+_0x4cf396[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x2005ed;})});}_0x452817=_[_0xed2c('0x42')]({},_0x452817,_0x4cf396[_0xed2c('0x48')]);return db[_0xed2c('0xa5')]['count']({'where':_0x452817[_0xed2c('0x41')]})[_0xed2c('0x16')](function(_0x37d466){_0x4ae2d2['count']=_0x37d466;if(_0x4cf396[_0xed2c('0x36')]['includeAll']){_0x452817['include']=[{'model':db[_0xed2c('0x7d')],'as':_0xed2c('0xea'),'required':![]},{'model':db[_0xed2c('0xb4')],'as':_0xed2c('0xeb'),'attributes':[_0xed2c('0x2d'),_0xed2c('0xec'),_0xed2c('0xed')],'required':![]},{'model':db[_0xed2c('0xee')],'as':_0xed2c('0xef'),'attributes':['id',_0xed2c('0x2d'),_0xed2c('0xf0')],'where':_0x4cf396[_0xed2c('0x36')][_0xed2c('0xf1')]?{'id':_0x4cf396[_0xed2c('0x36')]['tag']}:undefined,'required':_0x4cf396['query'][_0xed2c('0xf1')]?!![]:![]}];}return db[_0xed2c('0xa5')][_0xed2c('0x44')](_0x452817);})[_0xed2c('0x16')](function(_0x335854){_0x4ae2d2[_0xed2c('0x59')]=_0x335854;return _0x4ae2d2;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x1c7787,_0x452817))[_0xed2c('0x1f')](handleError(_0x1c7787,null));};function iftimePromise(_0x44926a,_0x2f041c){return respondWithRpcPromise(_0xed2c('0xf2'),_0xed2c('0xf3'),{'command':_0x2f041c[_0xed2c('0xf4')]?util[_0xed2c('0x9f')](_0xed2c('0xf5'),_0x44926a['interval'],_0x2f041c['timezone']):util[_0xed2c('0x9f')](_0xed2c('0xf6'),_0x44926a[_0xed2c('0xf7')])},client9002)['then'](function(_0x3ee60f){var _0x1a9c7d=_0x3ee60f&&_0x3ee60f[_0xed2c('0xf8')](_0xed2c('0xf9'))>=0x0?!![]:![];logger[_0xed2c('0x17')](_0xed2c('0xfa'),_0x2f041c['id'],_0x44926a['id'],_0x44926a[_0xed2c('0xf7')],_0x1a9c7d?_0xed2c('0xfb'):'OFFLINE',_0x2f041c['timezone']?_0x2f041c[_0xed2c('0xf4')]:_0xed2c('0xfc'));return _0x1a9c7d;})['catch'](function(_0x4527b6){logger['error'](_0xed2c('0xfa'),_0x2f041c['id'],_0x44926a['id'],_0x44926a[_0xed2c('0xf7')],util['inspect'](_0x4527b6,{'showHidden':![],'depth':null}),_0x2f041c[_0xed2c('0xf4')]?_0x2f041c['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x2b1b34,_0x2385ea){var _0x1f6c3b=0x0;var _0x3d199b=0x0;var _0x50212f=![];var _0x433510;var _0x2c1636;return db[_0xed2c('0x31')]['find']({'where':{'id':_0x2b1b34[_0xed2c('0x46')]['id']},'include':[{'model':db[_0xed2c('0xfd')],'as':_0xed2c('0xfd'),'include':[{'model':db[_0xed2c('0xfd')],'as':'Intervals','attributes':['id',_0xed2c('0xf7')],'raw':!![]}]}]})[_0xed2c('0x16')](handleEntityNotFound(_0x2385ea,null))[_0xed2c('0x16')](function(_0x5b25d6){if(_0x5b25d6){_0x433510=_0x5b25d6;return _0x5b25d6[_0xed2c('0xfe')]({'raw':!![]});}})[_0xed2c('0x16')](function(_0x4a1cd4){if(_0x433510){if(_0x4a1cd4){_0x2c1636=_0x4a1cd4;}}return require(_0xed2c('0x68'))[_0xed2c('0x69')]();})[_0xed2c('0x16')](function(_0x36dc63){if(_0x36dc63){_0x3d199b=_0x36dc63[_0xed2c('0xff')];_0x50212f=_0x36dc63[_0xed2c('0x6a')];}})['then'](function(){return db['ChatInteraction'][_0xed2c('0x27')]({'where':{'closed':![]}});})[_0xed2c('0x16')](function(_0x56e392){_0x1f6c3b=_0x56e392;if(_0x3d199b&&_0x56e392>_0x3d199b){return db[_0xed2c('0x100')][_0xed2c('0x54')]({'where':{'id':0x1}})[_0xed2c('0x16')](function(_0x2ed30f){if(_0x2ed30f){_0x2ed30f[_0xed2c('0x101')](_0xed2c('0x102'));}});}})['then'](function(){if(_0x433510[_0xed2c('0xfd')]&&_0x433510[_0xed2c('0xfd')][_0xed2c('0x103')]){var _0x30d1c9=[];for(var _0x29e3f2=0x0;_0x29e3f2<_0x433510[_0xed2c('0xfd')][_0xed2c('0x103')][_0xed2c('0x3c')];_0x29e3f2++){var _0x3259a2=_0x433510[_0xed2c('0xfd')]['Intervals'][_0x29e3f2][_0xed2c('0x4b')]({'plain':!![]});_0x30d1c9[_0xed2c('0xad')](iftimePromise(_0x3259a2,_0x433510));}return BPromise[_0xed2c('0x104')](_0x30d1c9)['then'](function(_0x2ecc7e){return _[_0xed2c('0x105')](_0x2ecc7e);});}else{return!![];}})['then'](function(_0x3cafe6){var _0x20039a=fs[_0xed2c('0x106')](path[_0xed2c('0x6d')](config[_0xed2c('0x67')],'server/files/chat/iframe.ejs'),_0xed2c('0x107'));var _0x987e6b={'remote':_0x433510[_0xed2c('0x108')],'query':querystring[_0xed2c('0xa3')](_[_0xed2c('0x42')](_0x433510[_0xed2c('0x4b')]({'plain':!![]}),{'customerIp':_0x2b1b34[_0xed2c('0x79')][_0xed2c('0x96')]||_0x2b1b34[_0xed2c('0x79')][_0xed2c('0x109')]||_0x2b1b34[_0xed2c('0x10a')][_0xed2c('0x10b')]||_0x2b1b34['ip'],'referer':_0x2b1b34[_0xed2c('0x79')][_0xed2c('0x10c')],'openedInteractions':_0x1f6c3b,'maxInteractions':_0x3d199b,'virtual':_0x50212f[_0xed2c('0xff')],'online':_0x3cafe6,'custom':_0x50212f}))['replace'](/'/g,'\x5c\x27')};_0x2385ea[_0xed2c('0xbd')](ejs[_0xed2c('0xc4')](Mustache[_0xed2c('0xc4')](_0x20039a,_0x987e6b),{'proactiveActions':_0x2c1636,'alignment':_0x433510[_0xed2c('0x10d')],'verticalAlignment':_0x433510[_0xed2c('0x10e')],'div_color':_0x433510[_0xed2c('0xf0')],'labelText':_0x433510[_0xed2c('0x10f')],'text_color':_0x433510['textColor'],'button_color':_0x433510[_0xed2c('0x110')],'background_color':_0x433510[_0xed2c('0x111')],'hideWhenOffline':_0x433510[_0xed2c('0x112')],'interval':_0x433510[_0xed2c('0x113')]}));})[_0xed2c('0x1f')](handleError(_0x2385ea,null));};exports[_0xed2c('0x114')]=function(_0x216084,_0xe52497){var _0x44198a=_0x216084[_0xed2c('0x46')]['id'];var _0x9e2ade=_0x216084[_0xed2c('0x4a')];var _0x2047cb=0xc8;var _0x1f2788=null;return db[_0xed2c('0xcd')][_0xed2c('0xce')]({'isolationLevel':db[_0xed2c('0xcd')]['Transaction']['ISOLATION_LEVELS'][_0xed2c('0x115')]},function(_0x506c48){return db[_0xed2c('0x31')][_0xed2c('0x54')]({'where':{'id':_0x44198a},'transaction':_0x506c48})['then'](function(_0x22ef1c){if(_0x22ef1c){return db[_0xed2c('0x8b')]['destroy']({'where':{'ChatWebsiteId':_0x44198a},'transaction':_0x506c48})['then'](function(){var _0xb30562=_[_0xed2c('0x57')](_0x9e2ade,function(_0x19ef49){_0x19ef49[_0xed2c('0x53')]=_0x44198a;return _0x19ef49;});return db['ChatApplication'][_0xed2c('0xd0')](_0xb30562,{'transaction':_0x506c48});});}else{_0x2047cb=0x194;_0x1f2788=[];}});})[_0xed2c('0x16')](function(){if(_0x2047cb!==0x194){return db[_0xed2c('0x8b')][_0xed2c('0x116')]({'where':{'ChatWebsiteId':_0x44198a},'order':_0xed2c('0x90')})['then'](function(_0x14360a){_0x1f2788=_0x14360a;});}})[_0xed2c('0x1f')](function(_0x55a6d0){_0x2047cb=0x1f4;logger[_0xed2c('0x1a')](_0x55a6d0[_0xed2c('0x117')]);if(_0x55a6d0[_0xed2c('0x2d')]){delete _0x55a6d0[_0xed2c('0x2d')];}_0x1f2788=_0x55a6d0;})['finally'](function(){if(_0x1f2788===null){_0xe52497['sendStatus'](_0x2047cb);}else{if(_0x2047cb===0x1f4){_0xe52497[_0xed2c('0x21')](_0x2047cb)['send'](_0x1f2788);}else{_0xe52497[_0xed2c('0x21')](_0x2047cb)['json'](_0x1f2788);}}});};exports[_0xed2c('0x118')]=function(_0x43522a,_0x5a7864){var _0x1ec3a2={};var _0x343e3b={};var _0xda07c3;var _0x5ceb43;return db['ChatWebsite'][_0xed2c('0x54')]({'where':{'id':_0x43522a[_0xed2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a7864,null))[_0xed2c('0x16')](function(_0x563e99){if(_0x563e99){_0xda07c3=_0x563e99;_0x343e3b[_0xed2c('0x35')]=_['keys'](db[_0xed2c('0x8b')][_0xed2c('0x32')]);_0x343e3b[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x43522a['query']);_0x343e3b[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x343e3b[_0xed2c('0x35')],_0x343e3b['query']);_0x1ec3a2['attributes']=_[_0xed2c('0x39')](_0x343e3b['model'],qs[_0xed2c('0x3b')](_0x43522a[_0xed2c('0x36')]['fields']));_0x1ec3a2[_0xed2c('0x3a')]=_0x1ec3a2[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x1ec3a2['attributes']:_0x343e3b[_0xed2c('0x35')];_0x1ec3a2[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x43522a[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x1ec3a2[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x43522a[_0xed2c('0x36')],_0x343e3b[_0xed2c('0x38')]));if(_0x43522a[_0xed2c('0x36')][_0xed2c('0x40')]){_0x1ec3a2[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x1ec3a2[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x1ec3a2[_0xed2c('0x3a')],function(_0x5ac036){var _0x10b6c0={};_0x10b6c0[_0x5ac036]={'$like':'%'+_0x43522a['query']['filter']+'%'};return _0x10b6c0;})});}_0x1ec3a2=_[_0xed2c('0x42')]({},_0x1ec3a2,_0x43522a[_0xed2c('0x48')]);return _0xda07c3['getApplications'](_0x1ec3a2);}})['then'](function(_0x52f4f7){if(_0x52f4f7){_0x5ceb43=_0x52f4f7[_0xed2c('0x3c')];if(!_0x43522a[_0xed2c('0x36')]['hasOwnProperty'](_0xed2c('0x55'))){_0x1ec3a2[_0xed2c('0x25')]=qs['limit'](_0x43522a[_0xed2c('0x36')][_0xed2c('0x25')]);_0x1ec3a2[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x43522a[_0xed2c('0x36')][_0xed2c('0x24')]);}return _0xda07c3['getApplications'](_0x1ec3a2);}})[_0xed2c('0x16')](function(_0x11c194){if(_0x11c194){return _0x11c194?{'count':_0x5ceb43,'rows':_0x11c194}:null;}})[_0xed2c('0x16')](respondWithResult(_0x5a7864,null))['catch'](handleError(_0x5a7864,null));};exports[_0xed2c('0x119')]=function(_0x572f09,_0x263be3){return db[_0xed2c('0x11a')][_0xed2c('0x4e')]({'where':{'id':_0x572f09[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x263be3,null))[_0xed2c('0x16')](function(_0x206b73){if(_0x206b73){return _0x206b73['addProactiveActions'](_0x572f09[_0xed2c('0x4a')][_0xed2c('0x5b')],_[_0xed2c('0xe8')](_0x572f09[_0xed2c('0x4a')],[_0xed2c('0x5b'),'id'])||{});}})[_0xed2c('0x16')](respondWithResult(_0x263be3,null))['catch'](handleError(_0x263be3,null));};exports['getProactiveActions']=function(_0xe54018,_0x5b5018){var _0x6550a4={};var _0x11661f={};var _0x5e1e93;var _0x28a7a4;return db['ChatWebsite'][_0xed2c('0x54')]({'where':{'id':_0xe54018[_0xed2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b5018,null))['then'](function(_0x492f05){if(_0x492f05){_0x5e1e93=_0x492f05;_0x11661f[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0x11b')][_0xed2c('0x32')]);_0x11661f[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0xe54018[_0xed2c('0x36')]);_0x11661f['filters']=_[_0xed2c('0x39')](_0x11661f['model'],_0x11661f['query']);_0x6550a4[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x11661f['model'],qs[_0xed2c('0x3b')](_0xe54018['query'][_0xed2c('0x3b')]));_0x6550a4[_0xed2c('0x3a')]=_0x6550a4['attributes'][_0xed2c('0x3c')]?_0x6550a4[_0xed2c('0x3a')]:_0x11661f['model'];_0x6550a4[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0xe54018[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x6550a4[_0xed2c('0x41')]=qs['filters'](_[_0xed2c('0x3f')](_0xe54018['query'],_0x11661f[_0xed2c('0x38')]));if(_0xe54018[_0xed2c('0x36')][_0xed2c('0x40')]){_0x6550a4['where']=_[_0xed2c('0x42')](_0x6550a4[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x6550a4[_0xed2c('0x3a')],function(_0x5a5fca){var _0x516013={};_0x516013[_0x5a5fca]={'$like':'%'+_0xe54018[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x516013;})});}_0x6550a4=_['merge']({},_0x6550a4,_0xe54018['options']);return _0x5e1e93[_0xed2c('0xfe')](_0x6550a4);}})[_0xed2c('0x16')](function(_0x311da3){if(_0x311da3){_0x28a7a4=_0x311da3[_0xed2c('0x3c')];if(!_0xe54018['query'][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x6550a4[_0xed2c('0x25')]=qs[_0xed2c('0x25')](_0xe54018['query'][_0xed2c('0x25')]);_0x6550a4[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0xe54018[_0xed2c('0x36')]['offset']);}return _0x5e1e93[_0xed2c('0xfe')](_0x6550a4);}})[_0xed2c('0x16')](function(_0x3ebceb){if(_0x3ebceb){return _0x3ebceb?{'count':_0x28a7a4,'rows':_0x3ebceb}:null;}})[_0xed2c('0x16')](respondWithResult(_0x5b5018,null))[_0xed2c('0x1f')](handleError(_0x5b5018,null));};exports[_0xed2c('0x11c')]=function(_0x1c779c,_0xc66d56){var _0x12fade=_0x1c779c[_0xed2c('0x36')]['online']===_0xed2c('0x11d')?_0xed2c('0x11e'):_0xed2c('0x11f');return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'attributes':['id',_0x12fade],'where':{'id':_0x1c779c[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0xc66d56,null))[_0xed2c('0x16')](function(_0x5568b2){if(_0x5568b2){var _0x1db71a=_0x5568b2[_0x12fade];var _0x50eacb=_0x1db71a&&_0x1db71a[_0xed2c('0x120')]?_0x1db71a[_0xed2c('0x120')]:[];_0xc66d56[_0xed2c('0xbd')]({'fromKey':_[_0xed2c('0x6b')](_0x1db71a['fromKey'])?undefined:_0x1db71a[_0xed2c('0x121')],'count':_0x50eacb[_0xed2c('0x3c')],'rows':_0x50eacb});}})['catch'](handleError(_0xc66d56,null));};exports[_0xed2c('0x122')]=function(_0x41c9f7,_0x5ab51a){var _0x2152fd={'raw':![],'where':{}};var _0x26b59c={};var _0x116886={'count':0x0,'rows':[]};return db[_0xed2c('0x31')][_0xed2c('0x54')]({'where':{'id':_0x41c9f7['params']['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x5ab51a,null))[_0xed2c('0x16')](function(_0x256ab3){if(_0x256ab3){_0x26b59c[_0xed2c('0x35')]=_[_0xed2c('0x37')](db['ChatOfflineMessage'][_0xed2c('0x32')]);_0x26b59c[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x41c9f7[_0xed2c('0x36')]);_0x26b59c[_0xed2c('0x38')]=_[_0xed2c('0x39')](_0x26b59c[_0xed2c('0x35')],_0x26b59c[_0xed2c('0x36')]);_0x2152fd[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0x26b59c[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x2152fd[_0xed2c('0x3a')]=_0x2152fd[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x2152fd[_0xed2c('0x3a')]:_0x26b59c['model'];if(!_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x3d')](_0xed2c('0x55'))){_0x2152fd['limit']=qs[_0xed2c('0x25')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x25')]);_0x2152fd[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x24')]);}_0x2152fd[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x2152fd[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x41c9f7[_0xed2c('0x36')],_0x26b59c[_0xed2c('0x38')]));_0x2152fd[_0xed2c('0x41')][_0xed2c('0x53')]=_0x256ab3['id'];if(_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x40')]){_0x2152fd[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x2152fd['where'],{'$or':_[_0xed2c('0x57')](_0x2152fd[_0xed2c('0x3a')],function(_0x1fff28){var _0xd62043={};_0xd62043[_0x1fff28]={'$like':'%'+_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0xd62043;})});}_0x2152fd=_['merge']({},_0x2152fd,_0x41c9f7[_0xed2c('0x48')]);return db['ChatOfflineMessage']['count']({'where':_0x2152fd[_0xed2c('0x41')]})['then'](function(_0xd9cb82){_0x116886[_0xed2c('0x27')]=_0xd9cb82;if(_0x41c9f7[_0xed2c('0x36')][_0xed2c('0x43')]){_0x2152fd[_0xed2c('0x47')]=[{'all':!![]}];}else{_0x2152fd[_0xed2c('0x47')]=[{'model':db[_0xed2c('0x7d')],'as':_0xed2c('0xea'),'required':![]},{'model':db[_0xed2c('0xcf')],'as':'Attachments','required':![]}];}return db[_0xed2c('0xc6')][_0xed2c('0x44')](_0x2152fd);})['then'](function(_0xac6af0){_0x116886['rows']=_0xac6af0;return _0x116886;});}})[_0xed2c('0x16')](respondWithFilteredResult(_0x5ab51a,_0x2152fd))['catch'](handleError(_0x5ab51a,null));};exports[_0xed2c('0x123')]=function(_0x25ad40,_0x285048){return db[_0xed2c('0x31')]['find']({'where':{'id':_0x25ad40[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x285048,null))[_0xed2c('0x16')](function(_0x2c2f23){if(_0x2c2f23){return _0x2c2f23[_0xed2c('0x123')](_0x25ad40[_0xed2c('0x4a')][_0xed2c('0x5b')],_[_0xed2c('0xe8')](_0x25ad40[_0xed2c('0x4a')],[_0xed2c('0x5b'),'id'])||{})[_0xed2c('0xa9')](function(_0x5f137f){for(var _0x4ec26a=0x0;_0x4ec26a<_0x25ad40[_0xed2c('0x4a')][_0xed2c('0x5b')][_0xed2c('0x3c')];_0x4ec26a+=0x1){socket[_0xed2c('0x124')]('userChatWebsite:save',{'UserId':Number(_0x25ad40[_0xed2c('0x4a')][_0xed2c('0x5b')][_0x4ec26a]),'ChatWebsiteId':Number(_0x25ad40['params']['id'])});}return _0x5f137f;});}})[_0xed2c('0x16')](respondWithResult(_0x285048,null))[_0xed2c('0x1f')](handleError(_0x285048,null));};exports['removeAgents']=function(_0x1fd1a9,_0x3da0f0){return db[_0xed2c('0x31')][_0xed2c('0x4e')]({'where':{'id':_0x1fd1a9[_0xed2c('0x46')]['id']}})[_0xed2c('0x16')](handleEntityNotFound(_0x3da0f0,null))[_0xed2c('0x16')](function(_0x2c0e07){if(_0x2c0e07){return _0x2c0e07[_0xed2c('0x125')](_0x1fd1a9[_0xed2c('0x36')][_0xed2c('0x5b')])['then'](function(){if(_[_0xed2c('0x126')](_0x1fd1a9[_0xed2c('0x36')][_0xed2c('0x5b')])){for(var _0xe167a1=0x0;_0xe167a1<_0x1fd1a9['query'][_0xed2c('0x5b')][_0xed2c('0x3c')];_0xe167a1+=0x1){socket[_0xed2c('0x124')]('userChatWebsite:remove',{'UserId':Number(_0x1fd1a9[_0xed2c('0x36')][_0xed2c('0x5b')][_0xe167a1]),'ChatWebsiteId':Number(_0x1fd1a9[_0xed2c('0x46')]['id'])});}}else{socket[_0xed2c('0x124')](_0xed2c('0x127'),{'UserId':Number(_0x1fd1a9['query']['ids']),'ChatWebsiteId':Number(_0x1fd1a9[_0xed2c('0x46')]['id'])});}});}})[_0xed2c('0x16')](respondWithStatusCode(_0x3da0f0,null))[_0xed2c('0x1f')](handleError(_0x3da0f0,null));};exports[_0xed2c('0x128')]=function(_0x297394,_0x98520b){var _0x2ff311={};var _0xc5bce8={};var _0x5bf311;var _0x3bc928;return db[_0xed2c('0x31')][_0xed2c('0x54')]({'where':{'id':_0x297394['params']['id']}})['then'](handleEntityNotFound(_0x98520b,null))[_0xed2c('0x16')](function(_0x2488e1){if(_0x2488e1){_0x5bf311=_0x2488e1;_0xc5bce8[_0xed2c('0x35')]=_[_0xed2c('0x37')](db[_0xed2c('0xb4')][_0xed2c('0x32')]);_0xc5bce8[_0xed2c('0x36')]=_[_0xed2c('0x37')](_0x297394['query']);_0xc5bce8[_0xed2c('0x38')]=_['intersection'](_0xc5bce8['model'],_0xc5bce8[_0xed2c('0x36')]);_0x2ff311[_0xed2c('0x3a')]=_[_0xed2c('0x39')](_0xc5bce8[_0xed2c('0x35')],qs[_0xed2c('0x3b')](_0x297394[_0xed2c('0x36')][_0xed2c('0x3b')]));_0x2ff311[_0xed2c('0x3a')]=_0x2ff311[_0xed2c('0x3a')][_0xed2c('0x3c')]?_0x2ff311[_0xed2c('0x3a')]:_0xc5bce8['model'];_0x2ff311[_0xed2c('0x56')]=qs[_0xed2c('0x3e')](_0x297394[_0xed2c('0x36')][_0xed2c('0x3e')]);_0x2ff311[_0xed2c('0x41')]=qs[_0xed2c('0x38')](_[_0xed2c('0x3f')](_0x297394[_0xed2c('0x36')],_0xc5bce8[_0xed2c('0x38')]));if(_0x297394['query'][_0xed2c('0x40')]){_0x2ff311[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x2ff311[_0xed2c('0x41')],{'$or':_[_0xed2c('0x57')](_0x2ff311['attributes'],function(_0x23871b){var _0x1f6484={};_0x1f6484[_0x23871b]={'$like':'%'+_0x297394[_0xed2c('0x36')][_0xed2c('0x40')]+'%'};return _0x1f6484;})});}_0x2ff311=_[_0xed2c('0x42')]({},_0x2ff311,_0x297394[_0xed2c('0x48')]);return _0x5bf311[_0xed2c('0x128')](_0x2ff311);}})[_0xed2c('0x16')](function(_0x3d7a69){if(_0x3d7a69){_0x3bc928=_0x3d7a69[_0xed2c('0x3c')];if(!_0x297394['query']['hasOwnProperty']('nolimit')){_0x2ff311[_0xed2c('0x25')]=qs['limit'](_0x297394['query']['limit']);_0x2ff311[_0xed2c('0x24')]=qs[_0xed2c('0x24')](_0x297394[_0xed2c('0x36')][_0xed2c('0x24')]);}return _0x5bf311[_0xed2c('0x128')](_0x2ff311);}})[_0xed2c('0x16')](function(_0x1f8523){if(_0x1f8523){return _0x1f8523?{'count':_0x3bc928,'rows':_0x1f8523}:null;}})[_0xed2c('0x16')](respondWithResult(_0x98520b,null))[_0xed2c('0x1f')](handleError(_0x98520b,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 90503de..2214626 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 _0xc03e=['hasOwnProperty','hook','exports','events','setMaxListeners','update','emit'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc03e,0x15a));var _0xec03=function(_0x17371c,_0x1a1e9c){_0x17371c=_0x17371c-0x0;var _0x422265=_0xc03e[_0x17371c];return _0x422265;};'use strict';var EventEmitter=require(_0xec03('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xec03('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec03('0x2'),'afterDestroy':'remove'};function emitEvent(_0xfed10f){return function(_0x269001,_0x3e3a78,_0x194e54){ChatWebsiteEvents[_0xec03('0x3')](_0xfed10f+':'+_0x269001['id'],_0x269001);ChatWebsiteEvents[_0xec03('0x3')](_0xfed10f,_0x269001);_0x194e54(null);};}for(var e in events){if(events[_0xec03('0x4')](e)){var event=events[e];ChatWebsite[_0xec03('0x5')](e,emitEvent(event));}}module[_0xec03('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xba6c=['remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite','setMaxListeners','save','update'];(function(_0x40001a,_0x57f2ae){var _0x4cec45=function(_0x5e4166){while(--_0x5e4166){_0x40001a['push'](_0x40001a['shift']());}};_0x4cec45(++_0x57f2ae);}(_0xba6c,0x113));var _0xcba6=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xba6c[_0x5a9c0c];return _0x53c77d;};'use strict';var EventEmitter=require(_0xcba6('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xcba6('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcba6('0x2')](0x0);var events={'afterCreate':_0xcba6('0x3'),'afterUpdate':_0xcba6('0x4'),'afterDestroy':_0xcba6('0x5')};function emitEvent(_0x3e9fb9){return function(_0x2b34a3,_0x5c911d,_0x57b9b2){ChatWebsiteEvents[_0xcba6('0x6')](_0x3e9fb9+':'+_0x2b34a3['id'],_0x2b34a3);ChatWebsiteEvents[_0xcba6('0x6')](_0x3e9fb9,_0x2b34a3);_0x57b9b2(null);};}for(var e in events){if(events[_0xcba6('0x7')](e)){var event=events[e];ChatWebsite[_0xcba6('0x8')](e,emitEvent(event));}}module[_0xcba6('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ea12187..35d913e 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 _0x6018=['path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','moment','request-promise'];(function(_0x3788ad,_0x3ce640){var _0x24ac05=function(_0x533aa2){while(--_0x533aa2){_0x3788ad['push'](_0x3788ad['shift']());}};_0x24ac05(++_0x3ce640);}(_0x6018,0x15a));var _0x8601=function(_0x103934,_0x2df8ea){_0x103934=_0x103934-0x0;var _0x339b3f=_0x6018[_0x103934];return _0x339b3f;};'use strict';var _=require(_0x8601('0x0'));var util=require(_0x8601('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8601('0x2'));var BPromise=require('bluebird');var rp=require(_0x8601('0x3'));var fs=require('fs');var path=require(_0x8601('0x4'));var rimraf=require(_0x8601('0x5'));var config=require('../../config/environment');var attributes=require(_0x8601('0x6'));module[_0x8601('0x7')]=function(_0x3d6df8,_0x1d31c8){return _0x3d6df8[_0x8601('0x8')](_0x8601('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb451=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4a67ae,_0x50a957){var _0x37f94a=function(_0x10b491){while(--_0x10b491){_0x4a67ae['push'](_0x4a67ae['shift']());}};_0x37f94a(++_0x50a957);}(_0xb451,0x119));var _0x1b45=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xb451[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x1b45('0x0'));var util=require('util');var logger=require(_0x1b45('0x1'))(_0x1b45('0x2'));var moment=require(_0x1b45('0x3'));var BPromise=require(_0x1b45('0x4'));var rp=require(_0x1b45('0x5'));var fs=require('fs');var path=require(_0x1b45('0x6'));var rimraf=require(_0x1b45('0x7'));var config=require(_0x1b45('0x8'));var attributes=require(_0x1b45('0x9'));module[_0x1b45('0xa')]=function(_0x5581da,_0x19c8b5){return _0x5581da[_0x1b45('0xb')](_0x1b45('0xc'),attributes,{'tableName':'chat_websites','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 c103a6c..0bdfbaf 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 _0x6ec2=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x5829b9,_0x1e49a7){var _0x127db6=function(_0x7bf8d7){while(--_0x7bf8d7){_0x5829b9['push'](_0x5829b9['shift']());}};_0x127db6(++_0x1e49a7);}(_0x6ec2,0x105));var _0x26ec=function(_0xb2318f,_0x2f9172){_0xb2318f=_0xb2318f-0x0;var _0x10a11b=_0x6ec2[_0xb2318f];return _0x10a11b;};'use strict';var _=require('lodash');var util=require(_0x26ec('0x0'));var moment=require(_0x26ec('0x1'));var BPromise=require(_0x26ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26ec('0x3'));var db=require(_0x26ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x26ec('0x5'))(_0x26ec('0x6'));var config=require(_0x26ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x26ec('0x8')][_0x26ec('0x9')]({'port':0x232a});config[_0x26ec('0xa')]=_[_0x26ec('0xb')](config[_0x26ec('0xa')],{'host':_0x26ec('0xc'),'port':0x18eb});var socket=require(_0x26ec('0xd'))(new Redis(config[_0x26ec('0xa')]));require(_0x26ec('0xe'))['register'](socket);function respondWithRpcPromise(_0x23b9cd,_0x57e780,_0x25b9ab){return new BPromise(function(_0x5e0a8f,_0x10c8db){return client['request'](_0x23b9cd,_0x25b9ab)[_0x26ec('0xf')](function(_0x217509){logger[_0x26ec('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x57e780,_0x26ec('0x11'));logger['debug'](_0x26ec('0x12'),_0x57e780,'request\x20sent',JSON[_0x26ec('0x13')](_0x217509));if(_0x217509['error']){if(_0x217509[_0x26ec('0x14')][_0x26ec('0x15')]===0x1f4){logger[_0x26ec('0x14')](_0x26ec('0x16'),_0x57e780,_0x217509[_0x26ec('0x14')][_0x26ec('0x17')]);return _0x10c8db(_0x217509[_0x26ec('0x14')][_0x26ec('0x17')]);}logger[_0x26ec('0x14')](_0x26ec('0x16'),_0x57e780,_0x217509[_0x26ec('0x14')][_0x26ec('0x17')]);return _0x5e0a8f(_0x217509[_0x26ec('0x14')][_0x26ec('0x17')]);}else{logger[_0x26ec('0x10')](_0x26ec('0x16'),_0x57e780,_0x26ec('0x11'));_0x5e0a8f(_0x217509[_0x26ec('0x18')][_0x26ec('0x17')]);}})[_0x26ec('0x19')](function(_0x1fa661){logger[_0x26ec('0x14')](_0x26ec('0x16'),_0x57e780,_0x1fa661);_0x10c8db(_0x1fa661);});});} \ No newline at end of file +var _0x77e1=['./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x5b7f04,_0x4b5ff8){var _0x580493=function(_0x4ee188){while(--_0x4ee188){_0x5b7f04['push'](_0x5b7f04['shift']());}};_0x580493(++_0x4b5ff8);}(_0x77e1,0xe4));var _0x177e=function(_0x17019d,_0x4c6c3c){_0x17019d=_0x17019d-0x0;var _0x14c24c=_0x77e1[_0x17019d];return _0x14c24c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x177e('0x0'));var BPromise=require('bluebird');var rs=require(_0x177e('0x1'));var fs=require('fs');var Redis=require(_0x177e('0x2'));var db=require(_0x177e('0x3'))['db'];var utils=require(_0x177e('0x4'));var logger=require(_0x177e('0x5'))('rpc');var config=require(_0x177e('0x6'));var jayson=require(_0x177e('0x7'));var client=jayson['client'][_0x177e('0x8')]({'port':0x232a});config[_0x177e('0x9')]=_['defaults'](config['redis'],{'host':_0x177e('0xa'),'port':0x18eb});var socket=require(_0x177e('0xb'))(new Redis(config[_0x177e('0x9')]));require(_0x177e('0xc'))[_0x177e('0xd')](socket);function respondWithRpcPromise(_0x5a686f,_0x455330,_0x1fc0e9){return new BPromise(function(_0x8d6d68,_0x1f7d16){return client[_0x177e('0xe')](_0x5a686f,_0x1fc0e9)[_0x177e('0xf')](function(_0x285e45){logger['info'](_0x177e('0x10'),_0x455330,'request\x20sent');logger[_0x177e('0x11')](_0x177e('0x12'),_0x455330,_0x177e('0x13'),JSON[_0x177e('0x14')](_0x285e45));if(_0x285e45[_0x177e('0x15')]){if(_0x285e45['error']['code']===0x1f4){logger[_0x177e('0x15')](_0x177e('0x10'),_0x455330,_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);return _0x1f7d16(_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);}logger[_0x177e('0x15')](_0x177e('0x10'),_0x455330,_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);return _0x8d6d68(_0x285e45[_0x177e('0x15')][_0x177e('0x16')]);}else{logger['info'](_0x177e('0x10'),_0x455330,_0x177e('0x13'));_0x8d6d68(_0x285e45[_0x177e('0x17')][_0x177e('0x16')]);}})['catch'](function(_0x5a1a9c){logger[_0x177e('0x15')](_0x177e('0x10'),_0x455330,_0x5a1a9c);_0x1f7d16(_0x5a1a9c);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e2afc73..ec1cba8 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 _0x8e86=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x5a3bd3,_0x9a7411){var _0x20650c=function(_0xc9d659){while(--_0xc9d659){_0x5a3bd3['push'](_0x5a3bd3['shift']());}};_0x20650c(++_0x9a7411);}(_0x8e86,0xf2));var _0x68e8=function(_0x1ae160,_0xa9e346){_0x1ae160=_0x1ae160-0x0;var _0x47b73d=_0x8e86[_0x1ae160];return _0x47b73d;};'use strict';var ChatWebsiteEvents=require(_0x68e8('0x0'));var events=[_0x68e8('0x1'),_0x68e8('0x2'),'update'];function createListener(_0x171d53,_0x205ed2){return function(_0x48d4a1){_0x205ed2[_0x68e8('0x3')](_0x171d53,_0x48d4a1);};}function removeListener(_0x284cf9,_0x590f7d){return function(){ChatWebsiteEvents[_0x68e8('0x4')](_0x284cf9,_0x590f7d);};}exports[_0x68e8('0x5')]=function(_0x458238){for(var _0xe6d6f4=0x0,_0x2487de=events['length'];_0xe6d6f4<_0x2487de;_0xe6d6f4++){var _0x1bd1e5=events[_0xe6d6f4];var _0x3eed04=createListener(_0x68e8('0x6')+_0x1bd1e5,_0x458238);ChatWebsiteEvents['on'](_0x1bd1e5,_0x3eed04);}}; \ No newline at end of file +var _0xcd53=['register','length','chatWebsite:','./chatWebsite.events','save','update','emit'];(function(_0x4d6dec,_0xd3abf3){var _0x343485=function(_0x2b627a){while(--_0x2b627a){_0x4d6dec['push'](_0x4d6dec['shift']());}};_0x343485(++_0xd3abf3);}(_0xcd53,0x106));var _0x3cd5=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xcd53[_0x575b72];return _0x561c57;};'use strict';var ChatWebsiteEvents=require(_0x3cd5('0x0'));var events=[_0x3cd5('0x1'),'remove',_0x3cd5('0x2')];function createListener(_0x109b75,_0x1fb9fb){return function(_0x20b65c){_0x1fb9fb[_0x3cd5('0x3')](_0x109b75,_0x20b65c);};}function removeListener(_0x49513d,_0x26490d){return function(){ChatWebsiteEvents['removeListener'](_0x49513d,_0x26490d);};}exports[_0x3cd5('0x4')]=function(_0x352fb6){for(var _0x540e80=0x0,_0x2e18b7=events[_0x3cd5('0x5')];_0x540e80<_0x2e18b7;_0x540e80++){var _0x3860e0=events[_0x540e80];var _0x59f84f=createListener(_0x3cd5('0x6')+_0x3860e0,_0x352fb6);ChatWebsiteEvents['on'](_0x3860e0,_0x59f84f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7225799..111642a 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 _0x40b8=['/:id','isAuthenticated','show','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','diskStorage','join','format','now','single','file','addLogo','originalname','addAvatar','root','server/files/images/avatars/','%s-%s','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addAgents','put','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','/describe','describe'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x40b8,0x118));var _0x840b=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x40b8[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0x840b('0x0'));var util=require(_0x840b('0x1'));var path=require('path');var timeout=require(_0x840b('0x2'));var express=require('express');var router=express[_0x840b('0x3')]();var fs_extra=require(_0x840b('0x4'));var auth=require(_0x840b('0x5'));var interaction=require(_0x840b('0x6'));var config=require(_0x840b('0x7'));var controller=require(_0x840b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x840b('0x9')](_0x840b('0xa'),auth['isAuthenticated'](),controller[_0x840b('0xb')]);router[_0x840b('0x9')](_0x840b('0xc'),auth[_0x840b('0xd')](),controller[_0x840b('0xe')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x840b('0x9')]('/:id/canned_answers',auth[_0x840b('0xd')](),controller['getAnswers']);router['get'](_0x840b('0xf'),controller[_0x840b('0x10')]);router[_0x840b('0x9')](_0x840b('0x11'),controller[_0x840b('0x12')]);router[_0x840b('0x9')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x840b('0x9')](_0x840b('0x13'),controller[_0x840b('0x14')]);router[_0x840b('0x9')](_0x840b('0x15'),auth[_0x840b('0xd')](),controller[_0x840b('0x16')]);router[_0x840b('0x9')](_0x840b('0x17'),controller[_0x840b('0x18')]);router[_0x840b('0x9')](_0x840b('0x19'),auth[_0x840b('0xd')](),controller[_0x840b('0x1a')]);router[_0x840b('0x9')](_0x840b('0x1b'),auth[_0x840b('0xd')](),controller[_0x840b('0x1c')]);router['get']('/:id/fields',controller[_0x840b('0x1d')]);router[_0x840b('0x9')](_0x840b('0x1e'),auth[_0x840b('0xd')](),controller[_0x840b('0x1f')]);router[_0x840b('0x9')](_0x840b('0x20'),auth[_0x840b('0xd')](),controller[_0x840b('0x21')]);router[_0x840b('0x22')]('/',auth['isAuthenticated'](),controller[_0x840b('0x23')]);router[_0x840b('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x840b('0x22')](_0x840b('0x24'),auth[_0x840b('0xd')](),controller[_0x840b('0x25')]);var upload=multer({'storage':multer[_0x840b('0x26')]({'destination':function(_0x1751e9,_0x24eb5c,_0x130a54){_0x130a54(null,path[_0x840b('0x27')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1d69bf,_0xa7355c,_0x5e4354){_0x5e4354(null,util[_0x840b('0x28')]('%s-%s',Date[_0x840b('0x29')](),_0xa7355c['originalname']));}})});router['post'](_0x840b('0xf'),upload[_0x840b('0x2a')](_0x840b('0x2b')),controller[_0x840b('0x2c')]);var upload=multer({'storage':multer[_0x840b('0x26')]({'destination':function(_0x5f4b1c,_0x4b1c74,_0x552306){_0x552306(null,path[_0x840b('0x27')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x3def68,_0x2ecbb9,_0x22d349){_0x22d349(null,util[_0x840b('0x28')]('%s-%s',Date[_0x840b('0x29')](),_0x2ecbb9[_0x840b('0x2d')]));}})});router[_0x840b('0x22')](_0x840b('0x11'),upload[_0x840b('0x2a')](_0x840b('0x2b')),controller[_0x840b('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xef2087,_0x5580c8,_0xb9e54d){_0xb9e54d(null,path[_0x840b('0x27')](config[_0x840b('0x2f')],_0x840b('0x30')));},'filename':function(_0x4ebd09,_0x43f6b3,_0x4b8b97){_0x4b8b97(null,util['format'](_0x840b('0x31'),Date[_0x840b('0x29')](),_0x43f6b3[_0x840b('0x2d')]));}})});router['post'](_0x840b('0x32'),upload['single'](_0x840b('0x2b')),controller[_0x840b('0x33')]);var upload=multer({'storage':multer[_0x840b('0x26')]({'destination':function(_0x36e17d,_0x343d18,_0xee9f03){_0xee9f03(null,path[_0x840b('0x27')](config[_0x840b('0x2f')],_0x840b('0x30')));},'filename':function(_0xf0808e,_0x42a2f8,_0x38449a){_0x38449a(null,util['format'](_0x840b('0x31'),Date[_0x840b('0x29')](),_0x42a2f8['originalname']));}})});router[_0x840b('0x22')](_0x840b('0x13'),upload['single'](_0x840b('0x2b')),controller[_0x840b('0x34')]);router['post'](_0x840b('0x35'),controller[_0x840b('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x840b('0x26')]({'destination':function(_0x2da2cb,_0x26ffd9,_0x29ee64){const _0x34ef23=path[_0x840b('0x27')](config['root'],_0x840b('0x37'),_0x840b('0x38'),_0x840b('0x39'));fs_extra[_0x840b('0x3a')](_0x34ef23,function(){_0x29ee64(null,_0x34ef23);});},'filename':function(_0x18ffef,_0x81bf66,_0x2e9633){const _0x47ff6c=_0x81bf66['originalname'][_0x840b('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x58c8f1=path[_0x840b('0x3c')](_0x47ff6c);const _0x5221f8=Date[_0x840b('0x29')]()+'-'+_0x47ff6c[_0x840b('0x3b')](_0x58c8f1,'')+_0x58c8f1;_0x2e9633(null,_0x5221f8);}})});router[_0x840b('0x22')](_0x840b('0x3d'),offlineUploadMulter[_0x840b('0x3e')](),controller[_0x840b('0x3f')]);router[_0x840b('0x22')]('/:id/interactions',auth[_0x840b('0xd')](),controller[_0x840b('0x40')]);router['post'](_0x840b('0x19'),auth[_0x840b('0xd')](),controller[_0x840b('0x41')]);router[_0x840b('0x22')](_0x840b('0x1b'),auth[_0x840b('0xd')](),controller['addProactiveActions']);router[_0x840b('0x22')](_0x840b('0x20'),auth[_0x840b('0xd')](),controller[_0x840b('0x42')]);router[_0x840b('0x43')]('/:id',auth[_0x840b('0xd')](),controller['update']);router[_0x840b('0x44')](_0x840b('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x840b('0x45'),auth[_0x840b('0xd')](),controller[_0x840b('0x46')]);router[_0x840b('0x44')](_0x840b('0x24'),auth[_0x840b('0xd')](),controller[_0x840b('0x47')]);router[_0x840b('0x44')](_0x840b('0x20'),auth[_0x840b('0xd')](),controller[_0x840b('0x48')]);module['exports']=router; \ No newline at end of file +var _0x2c52=['addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','express','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','now','single','join','server/files/images/avatars/','format','%s-%s','file','addCustomerAvatar','originalname','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions'];(function(_0x2c47ad,_0x41c0d8){var _0x3ae667=function(_0x2ea183){while(--_0x2ea183){_0x2c47ad['push'](_0x2c47ad['shift']());}};_0x3ae667(++_0x41c0d8);}(_0x2c52,0xca));var _0x22c5=function(_0x543371,_0xea894){_0x543371=_0x543371-0x0;var _0x2e0303=_0x2c52[_0x543371];return _0x2e0303;};'use strict';var multer=require(_0x22c5('0x0'));var util=require(_0x22c5('0x1'));var path=require('path');var timeout=require(_0x22c5('0x2'));var express=require(_0x22c5('0x3'));var router=express['Router']();var fs_extra=require(_0x22c5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22c5('0x5'));var controller=require(_0x22c5('0x6'));router[_0x22c5('0x7')]('/',auth[_0x22c5('0x8')](),controller[_0x22c5('0x9')]);router[_0x22c5('0x7')]('/describe',auth[_0x22c5('0x8')](),controller[_0x22c5('0xa')]);router[_0x22c5('0x7')](_0x22c5('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0x22c5('0x8')](),controller['getDispositions']);router[_0x22c5('0x7')](_0x22c5('0xc'),auth[_0x22c5('0x8')](),controller['getAnswers']);router[_0x22c5('0x7')](_0x22c5('0xd'),controller[_0x22c5('0xe')]);router[_0x22c5('0x7')](_0x22c5('0xf'),controller[_0x22c5('0x10')]);router[_0x22c5('0x7')](_0x22c5('0x11'),controller['getCustomerAvatar']);router[_0x22c5('0x7')](_0x22c5('0x12'),controller['getSystemAvatar']);router[_0x22c5('0x7')](_0x22c5('0x13'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x14')]);router[_0x22c5('0x7')](_0x22c5('0x15'),controller[_0x22c5('0x16')]);router[_0x22c5('0x7')](_0x22c5('0x17'),auth['isAuthenticated'](),controller[_0x22c5('0x18')]);router['get'](_0x22c5('0x19'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x1a')]);router[_0x22c5('0x7')]('/:id/fields',controller[_0x22c5('0x1b')]);router[_0x22c5('0x7')](_0x22c5('0x1c'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x1d')]);router['get'](_0x22c5('0x1e'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x1f')]);router[_0x22c5('0x20')]('/',auth[_0x22c5('0x8')](),controller['create']);router['post'](_0x22c5('0x21'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x22')]);router[_0x22c5('0x20')](_0x22c5('0xc'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x23')]);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x74a058,_0x392d87,_0x3e4d65){_0x3e4d65(null,path['join'](config[_0x22c5('0x25')],'server/files/images/logos/'));},'filename':function(_0x224c15,_0x398c2f,_0x18baad){_0x18baad(null,util['format']('%s-%s',Date[_0x22c5('0x26')](),_0x398c2f['originalname']));}})});router[_0x22c5('0x20')](_0x22c5('0xd'),upload[_0x22c5('0x27')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x220f8a,_0x43353d,_0x25df43){_0x25df43(null,path[_0x22c5('0x28')](config[_0x22c5('0x25')],_0x22c5('0x29')));},'filename':function(_0x40368f,_0x3b22cd,_0x4afccc){_0x4afccc(null,util[_0x22c5('0x2a')](_0x22c5('0x2b'),Date[_0x22c5('0x26')](),_0x3b22cd['originalname']));}})});router[_0x22c5('0x20')]('/:id/avatar',upload['single'](_0x22c5('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x54c975,_0x4dbbb7,_0x19e2df){_0x19e2df(null,path[_0x22c5('0x28')](config[_0x22c5('0x25')],_0x22c5('0x29')));},'filename':function(_0x4b1529,_0x3d514c,_0xb9707b){_0xb9707b(null,util[_0x22c5('0x2a')]('%s-%s',Date['now'](),_0x3d514c['originalname']));}})});router[_0x22c5('0x20')](_0x22c5('0x11'),upload['single']('file'),controller[_0x22c5('0x2d')]);var upload=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x18c291,_0x4af732,_0x491231){_0x491231(null,path[_0x22c5('0x28')](config[_0x22c5('0x25')],_0x22c5('0x29')));},'filename':function(_0x8123e,_0x3d2e18,_0x3f9601){_0x3f9601(null,util[_0x22c5('0x2a')](_0x22c5('0x2b'),Date[_0x22c5('0x26')](),_0x3d2e18[_0x22c5('0x2e')]));}})});router['post'](_0x22c5('0x12'),upload['single'](_0x22c5('0x2c')),controller['addSystemAvatar']);router[_0x22c5('0x20')]('/:id/notify',controller[_0x22c5('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0x22c5('0x24')]({'destination':function(_0x14ffe4,_0x58bbfb,_0x10e25e){const _0xdd982c=path['join'](config['root'],_0x22c5('0x30'),_0x22c5('0x31'),_0x22c5('0x32'));fs_extra['ensureDir'](_0xdd982c,function(){_0x10e25e(null,_0xdd982c);});},'filename':function(_0x4b9b3f,_0x25b96e,_0x7f7696){const _0x203e41=_0x25b96e[_0x22c5('0x2e')][_0x22c5('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xbc5394=path[_0x22c5('0x34')](_0x203e41);const _0x4bf118=Date['now']()+'-'+_0x203e41[_0x22c5('0x33')](_0xbc5394,'')+_0xbc5394;_0x7f7696(null,_0x4bf118);}})});router[_0x22c5('0x20')](_0x22c5('0x35'),offlineUploadMulter['any'](),controller[_0x22c5('0x36')]);router[_0x22c5('0x20')](_0x22c5('0x13'),auth['isAuthenticated'](),controller[_0x22c5('0x37')]);router[_0x22c5('0x20')](_0x22c5('0x17'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x38')]);router['post']('/:id/proactive_actions',auth[_0x22c5('0x8')](),controller[_0x22c5('0x39')]);router[_0x22c5('0x20')](_0x22c5('0x1e'),auth['isAuthenticated'](),controller[_0x22c5('0x3a')]);router[_0x22c5('0x3b')]('/:id',auth[_0x22c5('0x8')](),controller[_0x22c5('0x3c')]);router[_0x22c5('0x3d')]('/:id',auth[_0x22c5('0x8')](),controller[_0x22c5('0x3e')]);router[_0x22c5('0x3d')](_0x22c5('0x21'),auth[_0x22c5('0x8')](),controller[_0x22c5('0x3f')]);router[_0x22c5('0x3d')](_0x22c5('0xc'),auth[_0x22c5('0x8')](),controller['removeAnswers']);router[_0x22c5('0x3d')]('/:id/users',auth['isAuthenticated'](),controller[_0x22c5('0x40')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 1d00918..c2224ed 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 _0x0571=['client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','production','get'];(function(_0x1db153,_0x1ab5d){var _0x530cbe=function(_0x4115f7){while(--_0x4115f7){_0x1db153['push'](_0x1db153['shift']());}};_0x530cbe(++_0x1ab5d);}(_0x0571,0x1cd));var _0x1057=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x0571[_0x40ebff];return _0x40122a;};var beaverLogger=require(_0x1057('0x0'));var express=require(_0x1057('0x1'));var auth=require(_0x1057('0x2'));var config=require('../config/environment');var router=express[_0x1057('0x3')]();var isProduction=config[_0x1057('0x4')]===_0x1057('0x5')||![];function clientSideLogs(_0x95ed68,_0x5e48da,_0x4fd43c){var _0x16ba4a=_0x95ed68['app'][_0x1057('0x6')](_0x1057('0x7'));if(!_0x16ba4a){throw new Error(_0x1057('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x1057('0x9'),'logger':_0x16ba4a,'enableCors':!isProduction})(_0x95ed68,_0x5e48da,_0x4fd43c);}router['use'](auth[_0x1057('0xa')](),clientSideLogs);module[_0x1057('0xb')]=router; \ No newline at end of file +var _0xeb05=['get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','exports','beaver-logger/server','express','Router','env','production','app'];(function(_0x51d211,_0x21bab9){var _0x53d316=function(_0xe1efd0){while(--_0xe1efd0){_0x51d211['push'](_0x51d211['shift']());}};_0x53d316(++_0x21bab9);}(_0xeb05,0x90));var _0x5eb0=function(_0x36b8de,_0x4085c1){_0x36b8de=_0x36b8de-0x0;var _0x4ce4e5=_0xeb05[_0x36b8de];return _0x4ce4e5;};var beaverLogger=require(_0x5eb0('0x0'));var express=require(_0x5eb0('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x5eb0('0x2')]();var isProduction=config[_0x5eb0('0x3')]===_0x5eb0('0x4')||![];function clientSideLogs(_0x5e64e7,_0x4b6bb4,_0x89a8bf){var _0x3cb733=_0x5e64e7[_0x5eb0('0x5')][_0x5eb0('0x6')]('client-side-logger');if(!_0x3cb733){throw new Error(_0x5eb0('0x7'));}return beaverLogger[_0x5eb0('0x8')]({'uri':'/client-logs','logger':_0x3cb733,'enableCors':!isProduction})(_0x5e64e7,_0x4b6bb4,_0x89a8bf);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x5eb0('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 84df59b..36faf24 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 _0xb1e3=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','Outlook365'];(function(_0x21602d,_0x4b30ab){var _0x4ceba6=function(_0xcf323f){while(--_0xcf323f){_0x21602d['push'](_0x21602d['shift']());}};_0x4ceba6(++_0x4b30ab);}(_0xb1e3,0xda));var _0x3b1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3b1e('0x0'));module[_0x3b1e('0x1')]={'name':{'type':Sequelize[_0x3b1e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3b1e('0x3')]('AmazonAWS',_0x3b1e('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3b1e('0x3')](_0x3b1e('0x5'),_0x3b1e('0x6'))},'data1':{'type':Sequelize[_0x3b1e('0x2')],'comment':_0x3b1e('0x7')},'data2':{'type':Sequelize[_0x3b1e('0x2')],'comment':_0x3b1e('0x8')},'data3':{'type':Sequelize[_0x3b1e('0x2')],'comment':_0x3b1e('0x9')},'data4':{'type':Sequelize[_0x3b1e('0x2')],'comment':_0x3b1e('0xa')},'data5':{'type':Sequelize[_0x3b1e('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x3b1e('0xb')],'comment':_0x3b1e('0xc')},'data7':{'type':Sequelize[_0x3b1e('0xb')],'comment':_0x3b1e('0xd')}}; \ No newline at end of file +var _0x797e=['Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','Google','MicrosoftAzure','Outlook365'];(function(_0x5ec03f,_0x4ca34b){var _0x162000=function(_0x473078){while(--_0x473078){_0x5ec03f['push'](_0x5ec03f['shift']());}};_0x162000(++_0x4ca34b);}(_0x797e,0x158));var _0xe797=function(_0x3aadce,_0x455a70){_0x3aadce=_0x3aadce-0x0;var _0x2db10b=_0x797e[_0x3aadce];return _0x2db10b;};'use strict';var Sequelize=require(_0xe797('0x0'));module[_0xe797('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe797('0x2')]('AmazonAWS',_0xe797('0x3'),_0xe797('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe797('0x2')](_0xe797('0x5'),_0xe797('0x6'))},'data1':{'type':Sequelize[_0xe797('0x7')],'comment':_0xe797('0x8')},'data2':{'type':Sequelize[_0xe797('0x7')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0xe797('0x9')},'data4':{'type':Sequelize[_0xe797('0x7')],'comment':_0xe797('0xa')},'data5':{'type':Sequelize[_0xe797('0xb')],'comment':_0xe797('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xe797('0xb')],'comment':_0xe797('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 682bd95..dddafcc 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 _0xe6d6=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','CloudProvider','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','include','options','find','service','create','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','update','encryptString','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','parse','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','refresh_token','data5','data6','startRefreshInterval','microsoftAuthorization:error','message','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','padEnd','slice','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x17fd88,_0x13ee8c){var _0x34007f=function(_0x2aa6b3){while(--_0x2aa6b3){_0x17fd88['push'](_0x17fd88['shift']());}};_0x34007f(++_0x13ee8c);}(_0xe6d6,0xf1));var _0x6e6d=function(_0x29d1ba,_0x7a5223){_0x29d1ba=_0x29d1ba-0x0;var _0x3de575=_0xe6d6[_0x29d1ba];return _0x3de575;};'use strict';var _=require(_0x6e6d('0x0'));var Redis=require(_0x6e6d('0x1'));var qs=require(_0x6e6d('0x2'));var encryptor=require(_0x6e6d('0x3'));var config=require(_0x6e6d('0x4'));var logger=require('../../config/logger')('api');var db=require(_0x6e6d('0x5'))['db'];var oauth=require(_0x6e6d('0x6'));config[_0x6e6d('0x7')]=_[_0x6e6d('0x8')](config['redis'],{'host':_0x6e6d('0x9'),'port':0x18eb});var socket=require(_0x6e6d('0xa'))(new Redis(config[_0x6e6d('0x7')]));var redis=new Redis(config[_0x6e6d('0x7')]);function respondWithStatusCode(_0x64a419,_0x160ea0){_0x160ea0=_0x160ea0||0xcc;return function(_0x4cadfc){if(_0x4cadfc){return _0x64a419[_0x6e6d('0xb')](_0x160ea0);}return _0x64a419[_0x6e6d('0xc')](_0x160ea0)[_0x6e6d('0xd')]();};}function respondWithResult(_0x1dfc51,_0x27f76e){_0x27f76e=_0x27f76e||0xc8;return function(_0x2e43ae){if(_0x2e43ae){return _0x1dfc51['status'](_0x27f76e)[_0x6e6d('0xe')](_0x2e43ae);}};}function respondWithFilteredResult(_0xa05470,_0x385e6a){return function(_0x4a19b7){if(_0x4a19b7){var _0x414d90=typeof _0x385e6a[_0x6e6d('0xf')]===_0x6e6d('0x10')&&typeof _0x385e6a['limit']==='undefined';var _0x1c161b=_0x4a19b7[_0x6e6d('0x11')];var _0x55b283=_0x414d90?0x0:_0x385e6a['offset'];var _0x26767d=_0x414d90?_0x4a19b7[_0x6e6d('0x11')]:_0x385e6a[_0x6e6d('0xf')]+_0x385e6a[_0x6e6d('0x12')];var _0x1fb363;if(_0x26767d>=_0x1c161b){_0x26767d=_0x1c161b;_0x1fb363=0xc8;}else{_0x1fb363=0xce;}_0xa05470[_0x6e6d('0xc')](_0x1fb363);return _0xa05470[_0x6e6d('0x13')](_0x6e6d('0x14'),_0x55b283+'-'+_0x26767d+'/'+_0x1c161b)[_0x6e6d('0xe')](_0x4a19b7);}return null;};}function saveUpdates(_0x31bb09){return function(_0x2d0bc8){if(_0x2d0bc8){return _0x2d0bc8['update'](_0x31bb09)[_0x6e6d('0x15')](function(_0x24c646){return _0x24c646;});}return null;};}function removeEntity(_0x5dd4ca){return function(_0x4200b2){if(_0x4200b2){return _0x4200b2[_0x6e6d('0x16')]()[_0x6e6d('0x15')](function(){_0x5dd4ca[_0x6e6d('0xc')](0xcc)[_0x6e6d('0xd')]();});}};}function handleEntityNotFound(_0x2158df){return function(_0x2fd4b9){if(!_0x2fd4b9){_0x2158df[_0x6e6d('0xb')](0x194);}return _0x2fd4b9;};}function handleError(_0x176618,_0x1ca93f){_0x1ca93f=_0x1ca93f||0x1f4;return function(_0x94eade){logger[_0x6e6d('0x17')](_0x94eade['stack']);if(_0x94eade[_0x6e6d('0x18')]){delete _0x94eade[_0x6e6d('0x18')];}_0x176618[_0x6e6d('0xc')](_0x1ca93f)[_0x6e6d('0x19')](_0x94eade);};}function maskClientSecret(_0x4db583){return _[_0x6e6d('0x1a')](_0x4db583[_0x6e6d('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0x3d94a5,_0x455f10){var _0x44e320={},_0x4b5921={},_0x54c1a5={'count':0x0,'rows':[]};var _0x40fa57=_[_0x6e6d('0x1c')](db['CloudProvider'][_0x6e6d('0x1d')],function(_0x5650ba){return{'name':_0x5650ba[_0x6e6d('0x1e')],'type':_0x5650ba[_0x6e6d('0x1f')][_0x6e6d('0x20')]};});_0x4b5921[_0x6e6d('0x21')]=_['map'](_0x40fa57,_0x6e6d('0x18'));_0x4b5921[_0x6e6d('0x22')]=_[_0x6e6d('0x23')](_0x3d94a5[_0x6e6d('0x22')]);_0x4b5921[_0x6e6d('0x24')]=_[_0x6e6d('0x25')](_0x4b5921[_0x6e6d('0x21')],_0x4b5921[_0x6e6d('0x22')]);_0x44e320['attributes']=_[_0x6e6d('0x25')](_0x4b5921['model'],qs[_0x6e6d('0x26')](_0x3d94a5[_0x6e6d('0x22')][_0x6e6d('0x26')]));_0x44e320['attributes']=_0x44e320[_0x6e6d('0x27')][_0x6e6d('0x28')]?_0x44e320[_0x6e6d('0x27')]:_0x4b5921[_0x6e6d('0x21')];if(!_0x3d94a5['query'][_0x6e6d('0x29')]('nolimit')){_0x44e320[_0x6e6d('0x12')]=qs['limit'](_0x3d94a5[_0x6e6d('0x22')][_0x6e6d('0x12')]);_0x44e320['offset']=qs[_0x6e6d('0xf')](_0x3d94a5[_0x6e6d('0x22')]['offset']);}_0x44e320[_0x6e6d('0x2a')]=qs[_0x6e6d('0x2b')](_0x3d94a5[_0x6e6d('0x22')]['sort']);_0x44e320['where']=qs[_0x6e6d('0x24')](_['pick'](_0x3d94a5[_0x6e6d('0x22')],_0x4b5921['filters']),_0x40fa57);if(_0x3d94a5['query'][_0x6e6d('0x2c')]){_0x44e320[_0x6e6d('0x2d')]=_[_0x6e6d('0x2e')](_0x44e320['where'],{'$or':_[_0x6e6d('0x1c')](_0x40fa57,function(_0x535465){if(_0x535465['type']!==_0x6e6d('0x2f')){var _0x4bdddd={};_0x4bdddd[_0x535465['name']]={'$like':'%'+_0x3d94a5[_0x6e6d('0x22')][_0x6e6d('0x2c')]+'%'};return _0x4bdddd;}})});}_0x44e320=_[_0x6e6d('0x2e')]({},_0x44e320,_0x3d94a5['options']);var _0x28c658={'where':_0x44e320['where']};return db['CloudProvider'][_0x6e6d('0x11')](_0x28c658)['then'](function(_0x2911c0){_0x54c1a5[_0x6e6d('0x11')]=_0x2911c0;if(_0x3d94a5[_0x6e6d('0x22')][_0x6e6d('0x30')]){_0x44e320['include']=[{'all':!![]}];}return db[_0x6e6d('0x31')][_0x6e6d('0x32')](_0x44e320);})[_0x6e6d('0x15')](function(_0x2ea872){_0x54c1a5[_0x6e6d('0x33')]=_[_0x6e6d('0x1c')](_0x2ea872,function(_0x43c93f){if(_0x43c93f['service']===_0x6e6d('0x34')){var _0x70fb3f=encryptor[_0x6e6d('0x35')](_0x43c93f[_0x6e6d('0x36')]);_0x43c93f[_0x6e6d('0x36')]=maskClientSecret(_0x70fb3f);}return _0x43c93f;});return _0x54c1a5;})[_0x6e6d('0x15')](respondWithFilteredResult(_0x455f10,_0x44e320))[_0x6e6d('0x37')](handleError(_0x455f10,null));};exports[_0x6e6d('0x38')]=function(_0x1927b5,_0x41b94a){var _0x2cfc9c={'raw':!![],'where':{'id':_0x1927b5['params']['id']}},_0x4b948e={};_0x4b948e[_0x6e6d('0x21')]=_[_0x6e6d('0x23')](db[_0x6e6d('0x31')][_0x6e6d('0x1d')]);_0x4b948e[_0x6e6d('0x22')]=_[_0x6e6d('0x23')](_0x1927b5[_0x6e6d('0x22')]);_0x4b948e['filters']=_[_0x6e6d('0x25')](_0x4b948e[_0x6e6d('0x21')],_0x4b948e[_0x6e6d('0x22')]);_0x2cfc9c[_0x6e6d('0x27')]=_[_0x6e6d('0x25')](_0x4b948e[_0x6e6d('0x21')],qs[_0x6e6d('0x26')](_0x1927b5[_0x6e6d('0x22')]['fields']));_0x2cfc9c['attributes']=_0x2cfc9c[_0x6e6d('0x27')][_0x6e6d('0x28')]?_0x2cfc9c[_0x6e6d('0x27')]:_0x4b948e[_0x6e6d('0x21')];if(_0x1927b5[_0x6e6d('0x22')][_0x6e6d('0x30')]){_0x2cfc9c[_0x6e6d('0x39')]=[{'all':!![]}];}_0x2cfc9c=_['merge']({},_0x2cfc9c,_0x1927b5[_0x6e6d('0x3a')]);return db[_0x6e6d('0x31')][_0x6e6d('0x3b')](_0x2cfc9c)[_0x6e6d('0x15')](handleEntityNotFound(_0x41b94a,null))[_0x6e6d('0x15')](function(_0x581e73){if(_0x581e73[_0x6e6d('0x3c')]===_0x6e6d('0x34')){var _0x228c64=encryptor[_0x6e6d('0x35')](_0x581e73[_0x6e6d('0x36')]);_0x581e73['data3']=maskClientSecret(_0x228c64);}return _0x581e73;})['then'](respondWithResult(_0x41b94a,null))[_0x6e6d('0x37')](handleError(_0x41b94a,null));};exports[_0x6e6d('0x3d')]=function(_0x3f55f3,_0x3f69fb){if(!_0x3f55f3[_0x6e6d('0x3e')][_0x6e6d('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3f55f3['body'][_0x6e6d('0x3c')])throw new Error(_0x6e6d('0x3f'));var _0x311783=db['CloudProvider'][_0x6e6d('0x1d')][_0x6e6d('0x3c')][_0x6e6d('0x40')];if(!_0x311783['includes'](_0x3f55f3['body'][_0x6e6d('0x3c')]))throw new Error(_0x6e6d('0x41')+_0x311783[_0x6e6d('0x42')](',\x20'));if(_0x3f55f3[_0x6e6d('0x3e')][_0x6e6d('0x3c')]===_0x6e6d('0x34')&&_0x3f55f3[_0x6e6d('0x3e')]['data3']){_0x3f55f3[_0x6e6d('0x3e')]['data3']=encryptor['encryptString'](_0x3f55f3['body']['data3']);}return db[_0x6e6d('0x31')][_0x6e6d('0x3d')](_0x3f55f3[_0x6e6d('0x3e')],{})[_0x6e6d('0x15')](respondWithResult(_0x3f69fb,0xc9))[_0x6e6d('0x37')](handleError(_0x3f69fb,null));};exports[_0x6e6d('0x43')]=function(_0x3840d9,_0x4f3d6f){if(_0x3840d9[_0x6e6d('0x3e')]['id']){delete _0x3840d9[_0x6e6d('0x3e')]['id'];}return db[_0x6e6d('0x31')][_0x6e6d('0x3b')]({'where':{'id':_0x3840d9['params']['id']}})[_0x6e6d('0x15')](handleEntityNotFound(_0x4f3d6f,null))[_0x6e6d('0x15')](function(_0x41bea9){if(_0x41bea9[_0x6e6d('0x3c')]===_0x6e6d('0x34')&&_0x3840d9['body'][_0x6e6d('0x36')]){_0x3840d9['body'][_0x6e6d('0x36')]=encryptor[_0x6e6d('0x44')](_0x3840d9[_0x6e6d('0x3e')]['data3']);}return _0x41bea9;})[_0x6e6d('0x15')](saveUpdates(_0x3840d9['body'],null))[_0x6e6d('0x15')](respondWithResult(_0x4f3d6f,null))['catch'](handleError(_0x4f3d6f,null));};exports[_0x6e6d('0x16')]=function(_0x1a5448,_0x116d07){return db['CloudProvider'][_0x6e6d('0x3b')]({'where':{'id':_0x1a5448[_0x6e6d('0x45')]['id']}})[_0x6e6d('0x15')](handleEntityNotFound(_0x116d07,null))[_0x6e6d('0x15')](removeEntity(_0x116d07,null))[_0x6e6d('0x37')](handleError(_0x116d07,null));};exports[_0x6e6d('0x46')]=function(_0x6e3207,_0x4e9619){return db[_0x6e6d('0x31')][_0x6e6d('0x47')]({'where':{'id':_0x6e3207['params']['id']},'raw':!![]})[_0x6e6d('0x15')](function(_0x3589b1){if(!_0x3589b1)return _0x4e9619['sendStatus'](0x194);return{'url':oauth[_0x6e6d('0x48')](_0x3589b1,_0x6e3207['user']['id'])};})['then'](respondWithResult(_0x4e9619,null))[_0x6e6d('0x37')](handleError(_0x4e9619,null));};exports[_0x6e6d('0x49')]=function(_0x12e62b,_0x3f9b0a){var _0x5bc505=_0x12e62b[_0x6e6d('0x3e')];var _0x5009b3;var _0x455ced;if(_0x5bc505[_0x6e6d('0x17')])throw _0x5bc505;redis[_0x6e6d('0x4a')](_0x5bc505[_0x6e6d('0x4b')])[_0x6e6d('0x15')](function(_0x29c88f){if(!_0x29c88f)throw new Error('Invalid\x20state\x20parameter');_0x5009b3=JSON[_0x6e6d('0x4c')](_0x29c88f);var _0x4a5b5b=Buffer['from'](_0x5bc505[_0x6e6d('0x4b')],'base64')[_0x6e6d('0x4d')](_0x6e6d('0x4e'));_0x455ced=JSON['parse'](_0x4a5b5b);if(!oauth['isValidIdToken'](_0x5bc505[_0x6e6d('0x4f')],_0x5009b3[_0x6e6d('0x50')]))throw new Error(_0x6e6d('0x51'));redis[_0x6e6d('0x52')](_0x5bc505['state']);return oauth[_0x6e6d('0x53')](_0x5bc505[_0x6e6d('0x54')],_0x5009b3);})[_0x6e6d('0x15')](function(_0x46c4de){_0x5009b3['data5']=_0x46c4de[_0x6e6d('0x55')];_0x5009b3['data6']=_0x46c4de[_0x6e6d('0x56')];return db[_0x6e6d('0x31')][_0x6e6d('0x43')]({'data5':_0x5009b3[_0x6e6d('0x57')],'data6':_0x5009b3[_0x6e6d('0x58')]},{'where':{'id':_0x5009b3['id']}});})['then'](function(){oauth[_0x6e6d('0x59')](_0x5009b3);socket['emit']('microsoftAuthorization:success',{'id':_0x455ced['id']});return;})['then'](respondWithStatusCode(_0x3f9b0a,null))[_0x6e6d('0x37')](function(_0x42725e){if(_0x455ced){socket['emit'](_0x6e6d('0x5a'),{'id':_0x455ced['id']});}if(!_0x5009b3){logger[_0x6e6d('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x42725e);return _0x3f9b0a[_0x6e6d('0xc')](0x1f4)['send'](_0x42725e[_0x6e6d('0x5b')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x5009b3['id'],JSON['stringify'](_0x42725e));});}; \ No newline at end of file +var _0x2b27=['includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','params','keys','find','create','Name\x20parameter\x20not\x20specified','body','service','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','parse','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','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/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','status','end','json','undefined','count','offset','limit','update','then','destroy','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options'];(function(_0x5265c7,_0x2bdcd4){var _0x38f9c2=function(_0x6ba70f){while(--_0x6ba70f){_0x5265c7['push'](_0x5265c7['shift']());}};_0x38f9c2(++_0x2bdcd4);}(_0x2b27,0x1aa));var _0x72b2=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x2b27[_0x228ac9];return _0x69fe02;};'use strict';var _=require(_0x72b2('0x0'));var Redis=require(_0x72b2('0x1'));var qs=require(_0x72b2('0x2'));var encryptor=require(_0x72b2('0x3'));var config=require('../../config/environment');var logger=require(_0x72b2('0x4'))(_0x72b2('0x5'));var db=require(_0x72b2('0x6'))['db'];var oauth=require(_0x72b2('0x7'));config['redis']=_[_0x72b2('0x8')](config[_0x72b2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x72b2('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x72b2('0x9')]);function respondWithStatusCode(_0x5e2915,_0x36938f){_0x36938f=_0x36938f||0xcc;return function(_0x146098){if(_0x146098){return _0x5e2915[_0x72b2('0xb')](_0x36938f);}return _0x5e2915[_0x72b2('0xc')](_0x36938f)[_0x72b2('0xd')]();};}function respondWithResult(_0x3c33cf,_0x2d2d1b){_0x2d2d1b=_0x2d2d1b||0xc8;return function(_0x180c3f){if(_0x180c3f){return _0x3c33cf['status'](_0x2d2d1b)[_0x72b2('0xe')](_0x180c3f);}};}function respondWithFilteredResult(_0x50f925,_0xb2bf0a){return function(_0x6a5bca){if(_0x6a5bca){var _0x2e2e13=typeof _0xb2bf0a['offset']==='undefined'&&typeof _0xb2bf0a['limit']===_0x72b2('0xf');var _0x55243e=_0x6a5bca[_0x72b2('0x10')];var _0x325934=_0x2e2e13?0x0:_0xb2bf0a[_0x72b2('0x11')];var _0x454cc9=_0x2e2e13?_0x6a5bca[_0x72b2('0x10')]:_0xb2bf0a[_0x72b2('0x11')]+_0xb2bf0a[_0x72b2('0x12')];var _0x44792a;if(_0x454cc9>=_0x55243e){_0x454cc9=_0x55243e;_0x44792a=0xc8;}else{_0x44792a=0xce;}_0x50f925[_0x72b2('0xc')](_0x44792a);return _0x50f925['set']('Content-Range',_0x325934+'-'+_0x454cc9+'/'+_0x55243e)[_0x72b2('0xe')](_0x6a5bca);}return null;};}function saveUpdates(_0x168c0a){return function(_0x1f9106){if(_0x1f9106){return _0x1f9106[_0x72b2('0x13')](_0x168c0a)[_0x72b2('0x14')](function(_0x228ba1){return _0x228ba1;});}return null;};}function removeEntity(_0x40ab8f){return function(_0x446f68){if(_0x446f68){return _0x446f68[_0x72b2('0x15')]()['then'](function(){_0x40ab8f['status'](0xcc)[_0x72b2('0xd')]();});}};}function handleEntityNotFound(_0x46b7e5){return function(_0x176c38){if(!_0x176c38){_0x46b7e5[_0x72b2('0xb')](0x194);}return _0x176c38;};}function handleError(_0x42f270,_0x2819b6){_0x2819b6=_0x2819b6||0x1f4;return function(_0x1eb8df){logger[_0x72b2('0x16')](_0x1eb8df[_0x72b2('0x17')]);if(_0x1eb8df[_0x72b2('0x18')]){delete _0x1eb8df[_0x72b2('0x18')];}_0x42f270[_0x72b2('0xc')](_0x2819b6)[_0x72b2('0x19')](_0x1eb8df);};}function maskClientSecret(_0x1c6792){return _['padEnd'](_0x1c6792[_0x72b2('0x1a')](0x0,0x3),0x14,'*');}exports[_0x72b2('0x1b')]=function(_0x724c06,_0x4e50fa){var _0x35e04e={},_0x288c99={},_0x561fcc={'count':0x0,'rows':[]};var _0x2b8bfe=_[_0x72b2('0x1c')](db[_0x72b2('0x1d')][_0x72b2('0x1e')],function(_0x4a9665){return{'name':_0x4a9665['fieldName'],'type':_0x4a9665[_0x72b2('0x1f')][_0x72b2('0x20')]};});_0x288c99[_0x72b2('0x21')]=_[_0x72b2('0x1c')](_0x2b8bfe,_0x72b2('0x18'));_0x288c99[_0x72b2('0x22')]=_['keys'](_0x724c06['query']);_0x288c99[_0x72b2('0x23')]=_[_0x72b2('0x24')](_0x288c99['model'],_0x288c99['query']);_0x35e04e[_0x72b2('0x25')]=_[_0x72b2('0x24')](_0x288c99[_0x72b2('0x21')],qs[_0x72b2('0x26')](_0x724c06[_0x72b2('0x22')][_0x72b2('0x26')]));_0x35e04e['attributes']=_0x35e04e['attributes'][_0x72b2('0x27')]?_0x35e04e[_0x72b2('0x25')]:_0x288c99[_0x72b2('0x21')];if(!_0x724c06[_0x72b2('0x22')][_0x72b2('0x28')](_0x72b2('0x29'))){_0x35e04e[_0x72b2('0x12')]=qs[_0x72b2('0x12')](_0x724c06[_0x72b2('0x22')][_0x72b2('0x12')]);_0x35e04e['offset']=qs[_0x72b2('0x11')](_0x724c06[_0x72b2('0x22')]['offset']);}_0x35e04e[_0x72b2('0x2a')]=qs[_0x72b2('0x2b')](_0x724c06[_0x72b2('0x22')][_0x72b2('0x2b')]);_0x35e04e['where']=qs['filters'](_[_0x72b2('0x2c')](_0x724c06[_0x72b2('0x22')],_0x288c99[_0x72b2('0x23')]),_0x2b8bfe);if(_0x724c06[_0x72b2('0x22')][_0x72b2('0x2d')]){_0x35e04e[_0x72b2('0x2e')]=_[_0x72b2('0x2f')](_0x35e04e[_0x72b2('0x2e')],{'$or':_[_0x72b2('0x1c')](_0x2b8bfe,function(_0x51a173){if(_0x51a173['type']!=='VIRTUAL'){var _0x3c7209={};_0x3c7209[_0x51a173[_0x72b2('0x18')]]={'$like':'%'+_0x724c06[_0x72b2('0x22')][_0x72b2('0x2d')]+'%'};return _0x3c7209;}})});}_0x35e04e=_[_0x72b2('0x2f')]({},_0x35e04e,_0x724c06[_0x72b2('0x30')]);var _0x46179d={'where':_0x35e04e[_0x72b2('0x2e')]};return db['CloudProvider'][_0x72b2('0x10')](_0x46179d)[_0x72b2('0x14')](function(_0x30d166){_0x561fcc[_0x72b2('0x10')]=_0x30d166;if(_0x724c06[_0x72b2('0x22')][_0x72b2('0x31')]){_0x35e04e[_0x72b2('0x32')]=[{'all':!![]}];}return db[_0x72b2('0x1d')][_0x72b2('0x33')](_0x35e04e);})[_0x72b2('0x14')](function(_0x5a8786){_0x561fcc[_0x72b2('0x34')]=_[_0x72b2('0x1c')](_0x5a8786,function(_0x5d6a27){if(_0x5d6a27['service']===_0x72b2('0x35')){var _0x1d6ece=encryptor[_0x72b2('0x36')](_0x5d6a27['data3']);_0x5d6a27[_0x72b2('0x37')]=maskClientSecret(_0x1d6ece);}return _0x5d6a27;});return _0x561fcc;})[_0x72b2('0x14')](respondWithFilteredResult(_0x4e50fa,_0x35e04e))[_0x72b2('0x38')](handleError(_0x4e50fa,null));};exports['show']=function(_0x475650,_0xdb889c){var _0x121086={'raw':!![],'where':{'id':_0x475650[_0x72b2('0x39')]['id']}},_0x1cfa82={};_0x1cfa82[_0x72b2('0x21')]=_['keys'](db[_0x72b2('0x1d')]['rawAttributes']);_0x1cfa82['query']=_[_0x72b2('0x3a')](_0x475650[_0x72b2('0x22')]);_0x1cfa82[_0x72b2('0x23')]=_['intersection'](_0x1cfa82[_0x72b2('0x21')],_0x1cfa82['query']);_0x121086['attributes']=_[_0x72b2('0x24')](_0x1cfa82[_0x72b2('0x21')],qs[_0x72b2('0x26')](_0x475650[_0x72b2('0x22')][_0x72b2('0x26')]));_0x121086[_0x72b2('0x25')]=_0x121086[_0x72b2('0x25')][_0x72b2('0x27')]?_0x121086[_0x72b2('0x25')]:_0x1cfa82[_0x72b2('0x21')];if(_0x475650['query']['includeAll']){_0x121086[_0x72b2('0x32')]=[{'all':!![]}];}_0x121086=_[_0x72b2('0x2f')]({},_0x121086,_0x475650['options']);return db[_0x72b2('0x1d')][_0x72b2('0x3b')](_0x121086)[_0x72b2('0x14')](handleEntityNotFound(_0xdb889c,null))[_0x72b2('0x14')](function(_0x62b423){if(_0x62b423['service']===_0x72b2('0x35')){var _0x9e9245=encryptor[_0x72b2('0x36')](_0x62b423[_0x72b2('0x37')]);_0x62b423[_0x72b2('0x37')]=maskClientSecret(_0x9e9245);}return _0x62b423;})[_0x72b2('0x14')](respondWithResult(_0xdb889c,null))[_0x72b2('0x38')](handleError(_0xdb889c,null));};exports[_0x72b2('0x3c')]=function(_0x3d81e0,_0x2b4975){if(!_0x3d81e0['body'][_0x72b2('0x18')])throw new Error(_0x72b2('0x3d'));if(!_0x3d81e0[_0x72b2('0x3e')][_0x72b2('0x3f')])throw new Error(_0x72b2('0x40'));var _0x2b09fc=db[_0x72b2('0x1d')]['rawAttributes'][_0x72b2('0x3f')][_0x72b2('0x41')];if(!_0x2b09fc[_0x72b2('0x42')](_0x3d81e0[_0x72b2('0x3e')]['service']))throw new Error(_0x72b2('0x43')+_0x2b09fc[_0x72b2('0x44')](',\x20'));if(_0x3d81e0['body'][_0x72b2('0x3f')]===_0x72b2('0x35')&&_0x3d81e0[_0x72b2('0x3e')][_0x72b2('0x37')]){_0x3d81e0['body'][_0x72b2('0x37')]=encryptor['encryptString'](_0x3d81e0[_0x72b2('0x3e')][_0x72b2('0x37')]);}return db[_0x72b2('0x1d')]['create'](_0x3d81e0[_0x72b2('0x3e')],{})['then'](respondWithResult(_0x2b4975,0xc9))[_0x72b2('0x38')](handleError(_0x2b4975,null));};exports['update']=function(_0x3dbac3,_0x29d698){if(_0x3dbac3[_0x72b2('0x3e')]['id']){delete _0x3dbac3[_0x72b2('0x3e')]['id'];}return db[_0x72b2('0x1d')]['find']({'where':{'id':_0x3dbac3[_0x72b2('0x39')]['id']}})['then'](handleEntityNotFound(_0x29d698,null))[_0x72b2('0x14')](function(_0x218225){if(_0x218225['service']===_0x72b2('0x35')&&_0x3dbac3[_0x72b2('0x3e')][_0x72b2('0x37')]){_0x3dbac3[_0x72b2('0x3e')][_0x72b2('0x37')]=encryptor['encryptString'](_0x3dbac3['body']['data3']);}return _0x218225;})[_0x72b2('0x14')](saveUpdates(_0x3dbac3[_0x72b2('0x3e')],null))['then'](respondWithResult(_0x29d698,null))[_0x72b2('0x38')](handleError(_0x29d698,null));};exports[_0x72b2('0x15')]=function(_0x4c4f44,_0x1b8d65){return db[_0x72b2('0x1d')][_0x72b2('0x3b')]({'where':{'id':_0x4c4f44['params']['id']}})[_0x72b2('0x14')](handleEntityNotFound(_0x1b8d65,null))[_0x72b2('0x14')](removeEntity(_0x1b8d65,null))[_0x72b2('0x38')](handleError(_0x1b8d65,null));};exports[_0x72b2('0x45')]=function(_0x270d42,_0x19533f){return db[_0x72b2('0x1d')][_0x72b2('0x46')]({'where':{'id':_0x270d42[_0x72b2('0x39')]['id']},'raw':!![]})[_0x72b2('0x14')](function(_0x995682){if(!_0x995682)return _0x19533f[_0x72b2('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x995682,_0x270d42[_0x72b2('0x47')]['id'])};})[_0x72b2('0x14')](respondWithResult(_0x19533f,null))['catch'](handleError(_0x19533f,null));};exports[_0x72b2('0x48')]=function(_0x468f60,_0x1ced5a){var _0x10300d=_0x468f60[_0x72b2('0x3e')];var _0x500be8;var _0x55c6d8;if(_0x10300d[_0x72b2('0x16')])throw _0x10300d;redis[_0x72b2('0x49')](_0x10300d[_0x72b2('0x4a')])[_0x72b2('0x14')](function(_0x2fcef9){if(!_0x2fcef9)throw new Error('Invalid\x20state\x20parameter');_0x500be8=JSON[_0x72b2('0x4b')](_0x2fcef9);var _0x2052a8=Buffer['from'](_0x10300d['state'],'base64')[_0x72b2('0x4c')](_0x72b2('0x4d'));_0x55c6d8=JSON[_0x72b2('0x4b')](_0x2052a8);if(!oauth[_0x72b2('0x4e')](_0x10300d['id_token'],_0x500be8[_0x72b2('0x4f')]))throw new Error(_0x72b2('0x50'));redis['del'](_0x10300d[_0x72b2('0x4a')]);return oauth[_0x72b2('0x51')](_0x10300d[_0x72b2('0x52')],_0x500be8);})[_0x72b2('0x14')](function(_0x1c47a5){_0x500be8[_0x72b2('0x53')]=_0x1c47a5[_0x72b2('0x54')];_0x500be8[_0x72b2('0x55')]=_0x1c47a5[_0x72b2('0x56')];return db['CloudProvider'][_0x72b2('0x13')]({'data5':_0x500be8['data5'],'data6':_0x500be8['data6']},{'where':{'id':_0x500be8['id']}});})[_0x72b2('0x14')](function(){oauth[_0x72b2('0x57')](_0x500be8);socket[_0x72b2('0x58')](_0x72b2('0x59'),{'id':_0x55c6d8['id']});return;})[_0x72b2('0x14')](respondWithStatusCode(_0x1ced5a,null))[_0x72b2('0x38')](function(_0x17db04){if(_0x55c6d8){socket['emit'](_0x72b2('0x5a'),{'id':_0x55c6d8['id']});}if(!_0x500be8){logger[_0x72b2('0x16')](_0x72b2('0x5b'),_0x17db04);return _0x1ced5a[_0x72b2('0xc')](0x1f4)['send'](_0x17db04[_0x72b2('0x5c')]);}logger[_0x72b2('0x16')](_0x72b2('0x5d'),_0x500be8['id'],JSON[_0x72b2('0x5e')](_0x17db04));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index cdaa06d..344be23 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 _0xb0b7=['./cloudProvider.attributes','define','CloudProvider','cloud_providers','util','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0b7,0x7c));var _0x7b0b=function(_0x38ee8c,_0x41ae11){_0x38ee8c=_0x38ee8c-0x0;var _0x95d48c=_0xb0b7[_0x38ee8c];return _0x95d48c;};'use strict';var _=require('lodash');var util=require(_0x7b0b('0x0'));var logger=require(_0x7b0b('0x1'))(_0x7b0b('0x2'));var moment=require('moment');var BPromise=require(_0x7b0b('0x3'));var rp=require(_0x7b0b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7b0b('0x5'));var attributes=require(_0x7b0b('0x6'));module['exports']=function(_0x8c41fa,_0x1145dd){return _0x8c41fa[_0x7b0b('0x7')](_0x7b0b('0x8'),attributes,{'tableName':_0x7b0b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26eb=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api','bluebird','path'];(function(_0x140c8c,_0xca8737){var _0xf1a4c0=function(_0x227fe6){while(--_0x227fe6){_0x140c8c['push'](_0x140c8c['shift']());}};_0xf1a4c0(++_0xca8737);}(_0x26eb,0xf7));var _0xb26e=function(_0xe38db,_0x489ec9){_0xe38db=_0xe38db-0x0;var _0x4f764c=_0x26eb[_0xe38db];return _0x4f764c;};'use strict';var _=require('lodash');var util=require(_0xb26e('0x0'));var logger=require(_0xb26e('0x1'))(_0xb26e('0x2'));var moment=require('moment');var BPromise=require(_0xb26e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb26e('0x4'));var rimraf=require(_0xb26e('0x5'));var config=require(_0xb26e('0x6'));var attributes=require(_0xb26e('0x7'));module[_0xb26e('0x8')]=function(_0x37f651,_0x300121){return _0x37f651[_0xb26e('0x9')](_0xb26e('0xa'),attributes,{'tableName':_0xb26e('0xb'),'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 8053771..ae28f14 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 _0x3c20=['authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','moment','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','data2','code','id_token','stringify','toString','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','form_post','scope','nonce','prompt','login','key','oauth2Claims','oauth2/','data1','decode','payload','iss','issuer','audience','isAfter','unix','exp','resolve','then','data3','data6','decryptString','POST','replace','{TENANT_ID}','access_token','refresh_token','CloudProvider','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x3c20,0xa1));var _0x03c2=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3c20[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0x03c2('0x0'));var Redis=require('ioredis');var rp=require('request-promise');var util=require('util');var encryptor=require(_0x03c2('0x1'));var config=require(_0x03c2('0x2'));var logger=require(_0x03c2('0x3'))(_0x03c2('0x4'));var schedule=require(_0x03c2('0x5'));var db=require(_0x03c2('0x6'))['db'];config['redis']=_['defaults'](config[_0x03c2('0x7')],{'host':_0x03c2('0x8'),'port':0x18eb});var redis=new Redis(config[_0x03c2('0x7')]);var MICROSOFT_AUTH_URL=_0x03c2('0x9');var AZURE_AUTH_SCOPES={'Outlook365':[_0x03c2('0xa'),'profile',_0x03c2('0xb'),_0x03c2('0xc'),_0x03c2('0xd'),_0x03c2('0xe'),_0x03c2('0xf')],'Dynamics365':['openid',_0x03c2('0xc')]};var MICROSOFT_AUTH_ENDPOINT=_0x03c2('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x03c2('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x13a988){var _0x240266=_[_0x03c2('0x12')](AZURE_AUTH_SCOPES[_0x13a988[_0x03c2('0x13')]]);if(_0x13a988[_0x03c2('0x13')]===_0x03c2('0x14'))_0x240266[_0x03c2('0x15')](_0x13a988[_0x03c2('0x16')]+_0x03c2('0x17'));return _0x240266[_0x03c2('0x18')]('\x20');}function getAccessTokenScope(_0xf250a0){if(_0xf250a0[_0x03c2('0x13')]===_0x03c2('0x19'))return _0x03c2('0xd');if(_0xf250a0['type']===_0x03c2('0x14'))return _0xf250a0[_0x03c2('0x16')]+_0x03c2('0x17');}function generateMicrosoftAuthorizationUrl(_0x12589e,_0x80bad7){var _0x4bbcfe=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x12589e[_0x03c2('0x1a')]);var _0x5d50e1=[_0x03c2('0x1b'),_0x03c2('0x1c')];var _0x380d8e=Buffer['from'](JSON[_0x03c2('0x1d')]({'id':_0x80bad7}))[_0x03c2('0x1e')](_0x03c2('0x1f'));var _0x5233b3=crypto[_0x03c2('0x20')](0x10)[_0x03c2('0x1e')](_0x03c2('0x21'));var _0x3d0a4d=getAuthorizationScopes(_0x12589e);var _0x6bcce4=[{'key':_0x03c2('0x22'),'value':_0x12589e['data1']},{'key':_0x03c2('0x23'),'value':encodeURIComponent(_0x5d50e1[_0x03c2('0x18')]('\x20'))},{'key':_0x03c2('0x24'),'value':_0x12589e[_0x03c2('0x25')]},{'key':'response_mode','value':_0x03c2('0x26')},{'key':_0x03c2('0x27'),'value':encodeURIComponent(_0x3d0a4d)},{'key':'state','value':_0x380d8e},{'key':_0x03c2('0x28'),'value':_0x5233b3},{'key':_0x03c2('0x29'),'value':_0x03c2('0x2a')}];var _0x3e1cb6=_0x4bbcfe+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x03c2('0x12')](_0x6bcce4,function(_0x3bd7b8){return _0x3bd7b8[_0x03c2('0x2b')]+'='+_0x3bd7b8['value'];})[_0x03c2('0x18')]('&');_0x12589e[_0x03c2('0x2c')]={'issuer':_0x4bbcfe['replace'](_0x03c2('0x2d'),''),'audience':_0x12589e[_0x03c2('0x2e')],'state':_0x380d8e,'nonce':_0x5233b3};redis['set'](_0x380d8e,JSON[_0x03c2('0x1d')](_0x12589e));return _0x3e1cb6;}function isValidIdToken(_0x1b6d3e,_0xef9aeb){try{var _0x187d0b=jwt[_0x03c2('0x2f')](_0x1b6d3e,{'complete':!![]});var _0x57817e=_0x187d0b[_0x03c2('0x30')];if(_0x57817e[_0x03c2('0x31')]!==_0xef9aeb[_0x03c2('0x32')])return![];if(_0x57817e['aud']!==_0xef9aeb[_0x03c2('0x33')])return![];if(_0x57817e[_0x03c2('0x28')]!==_0xef9aeb['nonce'])return![];if(moment()[_0x03c2('0x34')](moment[_0x03c2('0x35')](_0x57817e[_0x03c2('0x36')])))return![];return!![];}catch(_0x15b55a){throw _0x15b55a;}}function refreshOauth2MicrosoftAccessToken(_0x33d68c){return Promise[_0x03c2('0x37')]()[_0x03c2('0x38')](function(){if(_0x33d68c[_0x03c2('0x39')])return _0x33d68c;return db['CloudProvider']['findOne']({'where':{'id':_0x33d68c['id']},'raw':!![]});})[_0x03c2('0x38')](function(_0x32c4b1){var _0x250810={'grant_type':'refresh_token','refresh_token':_0x32c4b1[_0x03c2('0x3a')],'scope':getAccessTokenScope(_0x32c4b1),'redirect_uri':_0x32c4b1[_0x03c2('0x25')],'client_id':_0x32c4b1['data1'],'client_secret':encryptor[_0x03c2('0x3b')](_0x32c4b1[_0x03c2('0x39')])};var _0x182fb3={'method':_0x03c2('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x03c2('0x3d')](_0x03c2('0x3e'),_0x32c4b1['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x250810,'json':!![]};return rp(_0x182fb3);})[_0x03c2('0x38')](function(_0x431ffb){_0x33d68c['data5']=_0x431ffb[_0x03c2('0x3f')];_0x33d68c['data6']=_0x431ffb[_0x03c2('0x40')];return db[_0x03c2('0x41')][_0x03c2('0x42')]({'data5':_0x33d68c[_0x03c2('0x43')],'data6':_0x33d68c[_0x03c2('0x3a')]},{'where':{'id':_0x33d68c['id']}});})[_0x03c2('0x38')](function(){return _0x33d68c;})['catch'](function(_0x2ead81){logger[_0x03c2('0x44')](_0x03c2('0x45'),_0x33d68c['id'],_0x2ead81);});}function getOauth2MicrosoftAccessToken(_0x2ab57f,_0x14ddaa){var _0x509c21={'grant_type':_0x03c2('0x46'),'code':_0x2ab57f,'scope':getAccessTokenScope(_0x14ddaa),'redirect_uri':_0x14ddaa[_0x03c2('0x25')],'client_id':_0x14ddaa[_0x03c2('0x2e')],'client_secret':encryptor[_0x03c2('0x3b')](_0x14ddaa[_0x03c2('0x39')])};var _0x11668e={'method':_0x03c2('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x03c2('0x3d')](_0x03c2('0x3e'),_0x14ddaa[_0x03c2('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x509c21,'json':!![]};return rp(_0x11668e);}function startRefreshInterval(_0x54976c){var _0x4da6ed=schedule[_0x03c2('0x47')];if(_0x4da6ed[_0x54976c['id']])clearInterval(_0x4da6ed[_0x54976c['id']]);_0x4da6ed[_0x54976c['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x54976c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4da6ed;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x03c2('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x03c2('0x38')](function(_0x393559){var _0x232d42=_0x393559['map'](function(_0x48c595){return refreshOauth2MicrosoftAccessToken(_0x48c595)[_0x03c2('0x38')](function(_0x1e2e5a){startRefreshInterval(_0x1e2e5a);});});return Promise[_0x03c2('0x49')](_0x232d42);})['catch'](function(_0x2e2a4a){var _0x2823e9=_0x2e2a4a?util[_0x03c2('0x4a')](_0x2e2a4a,{'showHidden':![],'depth':null}):'';logger['error'](_0x03c2('0x4b'),_0x2823e9);});}module[_0x03c2('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xcfc4=['client_id','data1','response_type','data4','response_mode','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','POST','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','all','inspect','exports','lodash','jsonwebtoken','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push','join','data7','/.default','replace','{TENANT_ID}','data2','id_token','stringify','toString','base64','hex'];(function(_0x3a2225,_0xb6600){var _0x5c8040=function(_0x2bdb09){while(--_0x2bdb09){_0x3a2225['push'](_0x3a2225['shift']());}};_0x5c8040(++_0xb6600);}(_0xcfc4,0x199));var _0x4cfc=function(_0x6a93d1,_0x308671){_0x6a93d1=_0x6a93d1-0x0;var _0x48bec9=_0xcfc4[_0x6a93d1];return _0x48bec9;};'use strict';var _=require(_0x4cfc('0x0'));var crypto=require('crypto');var jwt=require(_0x4cfc('0x1'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x4cfc('0x2'));var util=require(_0x4cfc('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x4cfc('0x4'));var logger=require(_0x4cfc('0x5'))(_0x4cfc('0x6'));var schedule=require(_0x4cfc('0x7'));var db=require(_0x4cfc('0x8'))['db'];config['redis']=_[_0x4cfc('0x9')](config[_0x4cfc('0xa')],{'host':_0x4cfc('0xb'),'port':0x18eb});var redis=new Redis(config[_0x4cfc('0xa')]);var MICROSOFT_AUTH_URL=_0x4cfc('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4cfc('0xd'),'profile',_0x4cfc('0xe'),_0x4cfc('0xf'),_0x4cfc('0x10'),_0x4cfc('0x11'),_0x4cfc('0x12')],'Dynamics365':['openid',_0x4cfc('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x4cfc('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x19c647){var _0x5db77c=_[_0x4cfc('0x14')](AZURE_AUTH_SCOPES[_0x19c647['type']]);if(_0x19c647[_0x4cfc('0x15')]===_0x4cfc('0x16'))_0x5db77c[_0x4cfc('0x17')](_0x19c647['data7']+'/.default');return _0x5db77c[_0x4cfc('0x18')]('\x20');}function getAccessTokenScope(_0xde6aa9){if(_0xde6aa9['type']==='Outlook365')return _0x4cfc('0x10');if(_0xde6aa9['type']==='Dynamics365')return _0xde6aa9[_0x4cfc('0x19')]+_0x4cfc('0x1a');}function generateMicrosoftAuthorizationUrl(_0x40ee18,_0x14043f){var _0x42c891=MICROSOFT_AUTH_URL[_0x4cfc('0x1b')](_0x4cfc('0x1c'),_0x40ee18[_0x4cfc('0x1d')]);var _0x46bc83=['code',_0x4cfc('0x1e')];var _0x192e61=Buffer['from'](JSON[_0x4cfc('0x1f')]({'id':_0x14043f}))[_0x4cfc('0x20')](_0x4cfc('0x21'));var _0x5f2c36=crypto['randomBytes'](0x10)[_0x4cfc('0x20')](_0x4cfc('0x22'));var _0x104024=getAuthorizationScopes(_0x40ee18);var _0x4623da=[{'key':_0x4cfc('0x23'),'value':_0x40ee18[_0x4cfc('0x24')]},{'key':_0x4cfc('0x25'),'value':encodeURIComponent(_0x46bc83[_0x4cfc('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x40ee18[_0x4cfc('0x26')]},{'key':_0x4cfc('0x27'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x104024)},{'key':_0x4cfc('0x28'),'value':_0x192e61},{'key':_0x4cfc('0x29'),'value':_0x5f2c36},{'key':_0x4cfc('0x2a'),'value':_0x4cfc('0x2b')}];var _0x5cf7bd=_0x42c891+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4cfc('0x14')](_0x4623da,function(_0x363aa6){return _0x363aa6[_0x4cfc('0x2c')]+'='+_0x363aa6[_0x4cfc('0x2d')];})[_0x4cfc('0x18')]('&');_0x40ee18[_0x4cfc('0x2e')]={'issuer':_0x42c891[_0x4cfc('0x1b')](_0x4cfc('0x2f'),''),'audience':_0x40ee18[_0x4cfc('0x24')],'state':_0x192e61,'nonce':_0x5f2c36};redis['set'](_0x192e61,JSON[_0x4cfc('0x1f')](_0x40ee18));return _0x5cf7bd;}function isValidIdToken(_0x669ac8,_0x28f196){try{var _0x336b24=jwt[_0x4cfc('0x30')](_0x669ac8,{'complete':!![]});var _0x5a5d6a=_0x336b24[_0x4cfc('0x31')];if(_0x5a5d6a['iss']!==_0x28f196[_0x4cfc('0x32')])return![];if(_0x5a5d6a[_0x4cfc('0x33')]!==_0x28f196[_0x4cfc('0x34')])return![];if(_0x5a5d6a[_0x4cfc('0x29')]!==_0x28f196['nonce'])return![];if(moment()[_0x4cfc('0x35')](moment[_0x4cfc('0x36')](_0x5a5d6a[_0x4cfc('0x37')])))return![];return!![];}catch(_0x4f1ef4){throw _0x4f1ef4;}}function refreshOauth2MicrosoftAccessToken(_0x56f1d8){return Promise[_0x4cfc('0x38')]()['then'](function(){if(_0x56f1d8[_0x4cfc('0x39')])return _0x56f1d8;return db[_0x4cfc('0x3a')][_0x4cfc('0x3b')]({'where':{'id':_0x56f1d8['id']},'raw':!![]});})[_0x4cfc('0x3c')](function(_0x2893d3){var _0x3ca7e2={'grant_type':_0x4cfc('0x3d'),'refresh_token':_0x2893d3[_0x4cfc('0x3e')],'scope':getAccessTokenScope(_0x2893d3),'redirect_uri':_0x2893d3[_0x4cfc('0x26')],'client_id':_0x2893d3['data1'],'client_secret':encryptor[_0x4cfc('0x3f')](_0x2893d3[_0x4cfc('0x39')])};var _0x49b3a6={'method':_0x4cfc('0x40'),'uri':MICROSOFT_AUTH_URL[_0x4cfc('0x1b')](_0x4cfc('0x1c'),_0x2893d3['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ca7e2,'json':!![]};return rp(_0x49b3a6);})[_0x4cfc('0x3c')](function(_0x41f2cb){_0x56f1d8[_0x4cfc('0x41')]=_0x41f2cb['access_token'];_0x56f1d8[_0x4cfc('0x3e')]=_0x41f2cb[_0x4cfc('0x3d')];return db[_0x4cfc('0x3a')]['update']({'data5':_0x56f1d8[_0x4cfc('0x41')],'data6':_0x56f1d8[_0x4cfc('0x3e')]},{'where':{'id':_0x56f1d8['id']}});})[_0x4cfc('0x3c')](function(){return _0x56f1d8;})[_0x4cfc('0x42')](function(_0x379e20){logger[_0x4cfc('0x43')](_0x4cfc('0x44'),_0x56f1d8['id'],_0x379e20);});}function getOauth2MicrosoftAccessToken(_0x55abdf,_0x41153d){var _0x2b2db6={'grant_type':'authorization_code','code':_0x55abdf,'scope':getAccessTokenScope(_0x41153d),'redirect_uri':_0x41153d[_0x4cfc('0x26')],'client_id':_0x41153d[_0x4cfc('0x24')],'client_secret':encryptor[_0x4cfc('0x3f')](_0x41153d[_0x4cfc('0x39')])};var _0x915ecc={'method':_0x4cfc('0x40'),'uri':MICROSOFT_AUTH_URL[_0x4cfc('0x1b')](_0x4cfc('0x1c'),_0x41153d[_0x4cfc('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2b2db6,'json':!![]};return rp(_0x915ecc);}function startRefreshInterval(_0xaf2987){var _0x33c75=schedule[_0x4cfc('0x45')];if(_0x33c75[_0xaf2987['id']])clearInterval(_0x33c75[_0xaf2987['id']]);_0x33c75[_0xaf2987['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4cfc('0x46')](this,{'id':_0xaf2987['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4cfc('0x45')]=_0x33c75;}function startAllRefreshIntervals(){return db[_0x4cfc('0x3a')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4cfc('0x3c')](function(_0x1f75b0){var _0x4a52e8=_0x1f75b0[_0x4cfc('0x14')](function(_0x44078d){return refreshOauth2MicrosoftAccessToken(_0x44078d)[_0x4cfc('0x3c')](function(_0x17a030){startRefreshInterval(_0x17a030);});});return Promise[_0x4cfc('0x47')](_0x4a52e8);})[_0x4cfc('0x42')](function(_0xea6184){var _0x146882=_0xea6184?util[_0x4cfc('0x48')](_0xea6184,{'showHidden':![],'depth':null}):'';logger[_0x4cfc('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x146882);});}module[_0x4cfc('0x49')]={'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 210b04b..998e6d1 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 _0x8f25=['catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x58a021,_0x17bc70){var _0x194761=function(_0x32db18){while(--_0x32db18){_0x58a021['push'](_0x58a021['shift']());}};_0x194761(++_0x17bc70);}(_0x8f25,0x14b));var _0x58f2=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x8f25[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var moment=require(_0x58f2('0x2'));var BPromise=require(_0x58f2('0x3'));var rs=require(_0x58f2('0x4'));var fs=require('fs');var Redis=require(_0x58f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58f2('0x6'));var config=require(_0x58f2('0x7'));var jayson=require(_0x58f2('0x8'));var client=jayson['client'][_0x58f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f94f,_0x3d5efe,_0x107b61){return new BPromise(function(_0xf47f9,_0x1209e2){return client[_0x58f2('0xa')](_0x26f94f,_0x107b61)[_0x58f2('0xb')](function(_0x4b56c1){logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));logger[_0x58f2('0xf')](_0x58f2('0x10'),_0x3d5efe,'request\x20sent',JSON[_0x58f2('0x11')](_0x4b56c1));if(_0x4b56c1[_0x58f2('0x12')]){if(_0x4b56c1[_0x58f2('0x12')]['code']===0x1f4){logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1['error'][_0x58f2('0x13')]);return _0x1209e2(_0x4b56c1[_0x58f2('0x12')]['message']);}logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);return _0xf47f9(_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);}else{logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));_0xf47f9(_0x4b56c1[_0x58f2('0x14')][_0x58f2('0x13')]);}})[_0x58f2('0x15')](function(_0x4af52c){logger[_0x58f2('0x12')]('CloudProvider,\x20%s,\x20%s',_0x3d5efe,_0x4af52c);_0x1209e2(_0x4af52c);});});} \ No newline at end of file +var _0x3e22=['http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','CloudProvider,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x2ddb6d,_0x25d45b){var _0x56c103=function(_0x4f73c4){while(--_0x4f73c4){_0x2ddb6d['push'](_0x2ddb6d['shift']());}};_0x56c103(++_0x25d45b);}(_0x3e22,0xa8));var _0x23e2=function(_0x4cb8e7,_0x2e1d22){_0x4cb8e7=_0x4cb8e7-0x0;var _0x3d0188=_0x3e22[_0x4cb8e7];return _0x3d0188;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var moment=require('moment');var BPromise=require(_0x23e2('0x1'));var rs=require(_0x23e2('0x2'));var fs=require('fs');var Redis=require(_0x23e2('0x3'));var db=require(_0x23e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23e2('0x5'));var config=require(_0x23e2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x23e2('0x7')][_0x23e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a8351,_0x927fbb,_0xb71434){return new BPromise(function(_0x4c13ae,_0x64c91b){return client[_0x23e2('0x9')](_0x3a8351,_0xb71434)[_0x23e2('0xa')](function(_0x75da0a){logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));logger[_0x23e2('0xd')](_0x23e2('0xe'),_0x927fbb,_0x23e2('0xc'),JSON[_0x23e2('0xf')](_0x75da0a));if(_0x75da0a['error']){if(_0x75da0a['error'][_0x23e2('0x10')]===0x1f4){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x64c91b(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x4c13ae(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}else{logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));_0x4c13ae(_0x75da0a[_0x23e2('0x14')][_0x23e2('0x13')]);}})[_0x23e2('0x15')](function(_0x276c2d){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x276c2d);_0x64c91b(_0x276c2d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a1a7354..093d2ce 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 _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(_0x12a3c9,_0x2e8ab3){var _0x64e096=function(_0x35890f){while(--_0x35890f){_0x12a3c9['push'](_0x12a3c9['shift']());}};_0x64e096(++_0x2e8ab3);}(_0xdb28,0x106));var _0x8db2=function(_0x29a7a8,_0xfc5658){_0x29a7a8=_0x29a7a8-0x0;var _0xb71fdf=_0xdb28[_0x29a7a8];return _0xb71fdf;};'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 +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7a54,0x106));var _0x47a5=function(_0x19b2b6,_0x2dec56){_0x19b2b6=_0x19b2b6-0x0;var _0xf478bc=_0x7a54[_0x19b2b6];return _0xf478bc;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 922c6ef..60bdb37 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 _0x011c=['STRING','name','sequelize','exports'];(function(_0x2b9c17,_0xc8ac81){var _0x28711d=function(_0x135903){while(--_0x135903){_0x2b9c17['push'](_0x2b9c17['shift']());}};_0x28711d(++_0xc8ac81);}(_0x011c,0x8e));var _0xc011=function(_0x2e9329,_0x254609){_0x2e9329=_0x2e9329-0x0;var _0x1a3303=_0x011c[_0x2e9329];return _0x1a3303;};'use strict';var Sequelize=require(_0xc011('0x0'));module[_0xc011('0x1')]={'name':{'type':Sequelize[_0xc011('0x2')],'unique':_0xc011('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc011('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc011('0x2')]},'phone':{'type':Sequelize[_0xc011('0x2')]},'fax':{'type':Sequelize[_0xc011('0x2')]},'type':{'type':Sequelize[_0xc011('0x2')]},'street':{'type':Sequelize[_0xc011('0x2')]},'postalCode':{'type':Sequelize[_0xc011('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc011('0x2')]},'email':{'type':Sequelize[_0xc011('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xc011('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xc011('0x2')]},'description':{'type':Sequelize[_0xc011('0x2')]}}; \ No newline at end of file +var _0x3c14=['sequelize','STRING','name'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x3c14,0x186));var _0x43c1=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0x3c14[_0x258b93];return _0x35484b;};'use strict';var Sequelize=require(_0x43c1('0x0'));module['exports']={'name':{'type':Sequelize[_0x43c1('0x1')],'unique':_0x43c1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x43c1('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x43c1('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x43c1('0x1')]},'type':{'type':Sequelize[_0x43c1('0x1')]},'street':{'type':Sequelize[_0x43c1('0x1')]},'postalCode':{'type':Sequelize[_0x43c1('0x1')]},'city':{'type':Sequelize[_0x43c1('0x1')]},'country':{'type':Sequelize[_0x43c1('0x1')]},'email':{'type':Sequelize[_0x43c1('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 83311aa..c0945b7 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 _0xc1bc=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','Companies','end','error','stack','name','send','index','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','map','includeAll','include','CmCompany','findAll','catch','show','rawAttributes','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','getContacts','findOne','sort','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x3d4084,_0x36fa5e){var _0xe0324b=function(_0x5dcc3e){while(--_0x5dcc3e){_0x3d4084['push'](_0x3d4084['shift']());}};_0xe0324b(++_0x36fa5e);}(_0xc1bc,0x15f));var _0xcc1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1bc[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xcc1b('0x0'));var rimraf=require(_0xcc1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc1b('0x2'));var rp=require(_0xcc1b('0x3'));var moment=require(_0xcc1b('0x4'));var BPromise=require(_0xcc1b('0x5'));var Mustache=require(_0xcc1b('0x6'));var util=require(_0xcc1b('0x7'));var path=require(_0xcc1b('0x8'));var sox=require(_0xcc1b('0x9'));var csv=require(_0xcc1b('0xa'));var ejs=require(_0xcc1b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcc1b('0xc'));var crypto=require(_0xcc1b('0xd'));var jsforce=require(_0xcc1b('0xe'));var deskjs=require(_0xcc1b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcc1b('0x10'));var Papa=require(_0xcc1b('0x11'));var Redis=require(_0xcc1b('0x12'));var authService=require(_0xcc1b('0x13'));var qs=require(_0xcc1b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc1b('0x15'));var logger=require(_0xcc1b('0x16'))(_0xcc1b('0x17'));var utils=require('../../config/utils');var config=require(_0xcc1b('0x18'));var licenseUtil=require(_0xcc1b('0x19'));var db=require(_0xcc1b('0x1a'))['db'];function respondWithStatusCode(_0x1eb0a3,_0x766ece){_0x766ece=_0x766ece||0xcc;return function(_0x2183e1){if(_0x2183e1){return _0x1eb0a3[_0xcc1b('0x1b')](_0x766ece);}return _0x1eb0a3[_0xcc1b('0x1c')](_0x766ece)['end']();};}function respondWithResult(_0x8c7cf5,_0x40a521){_0x40a521=_0x40a521||0xc8;return function(_0x2077e9){if(_0x2077e9){return _0x8c7cf5[_0xcc1b('0x1c')](_0x40a521)[_0xcc1b('0x1d')](_0x2077e9);}};}function respondWithFilteredResult(_0x47d637,_0x78f6d4){return function(_0x3f54af){if(_0x3f54af){var _0x4814d6=typeof _0x78f6d4[_0xcc1b('0x1e')]===_0xcc1b('0x1f')&&typeof _0x78f6d4['limit']===_0xcc1b('0x1f');var _0x2f9f67=_0x3f54af[_0xcc1b('0x20')];var _0x13088d=_0x4814d6?0x0:_0x78f6d4[_0xcc1b('0x1e')];var _0x165233=_0x4814d6?_0x3f54af[_0xcc1b('0x20')]:_0x78f6d4[_0xcc1b('0x1e')]+_0x78f6d4[_0xcc1b('0x21')];var _0x85b6c6;if(_0x165233>=_0x2f9f67){_0x165233=_0x2f9f67;_0x85b6c6=0xc8;}else{_0x85b6c6=0xce;}_0x47d637[_0xcc1b('0x1c')](_0x85b6c6);return _0x47d637[_0xcc1b('0x22')]('Content-Range',_0x13088d+'-'+_0x165233+'/'+_0x2f9f67)[_0xcc1b('0x1d')](_0x3f54af);}return null;};}function patchUpdates(_0x1ce7ec){return function(_0x5753d7){try{jsonpatch[_0xcc1b('0x23')](_0x5753d7,_0x1ce7ec,!![]);}catch(_0x17b482){return BPromise[_0xcc1b('0x24')](_0x17b482);}return _0x5753d7['save']();};}function saveUpdates(_0x585c28,_0x27d224){return function(_0x39d4b7){if(_0x39d4b7){return _0x39d4b7[_0xcc1b('0x25')](_0x585c28)[_0xcc1b('0x26')](function(_0x13ade0){return _0x13ade0;});}return null;};}function removeEntity(_0x5e8bc0,_0x4b46d4){return function(_0x50ab73){if(_0x50ab73){return _0x50ab73[_0xcc1b('0x27')]()[_0xcc1b('0x26')](function(){var _0x5c7e35=_0x50ab73[_0xcc1b('0x28')]({'plain':!![]});var _0x2c2b4f=_0xcc1b('0x29');return db['UserProfileResource'][_0xcc1b('0x27')]({'where':{'type':_0x2c2b4f,'resourceId':_0x5c7e35['id']}})[_0xcc1b('0x26')](function(){return _0x50ab73;});})[_0xcc1b('0x26')](function(){_0x5e8bc0[_0xcc1b('0x1c')](0xcc)[_0xcc1b('0x2a')]();});}};}function handleEntityNotFound(_0x25bc43,_0x54cc22){return function(_0x56d4ba){if(!_0x56d4ba){_0x25bc43['sendStatus'](0x194);}return _0x56d4ba;};}function handleError(_0x3a84b2,_0x30f87c){_0x30f87c=_0x30f87c||0x1f4;return function(_0x5ab84b){logger[_0xcc1b('0x2b')](_0x5ab84b[_0xcc1b('0x2c')]);if(_0x5ab84b[_0xcc1b('0x2d')]){delete _0x5ab84b[_0xcc1b('0x2d')];}_0x3a84b2[_0xcc1b('0x1c')](_0x30f87c)[_0xcc1b('0x2e')](_0x5ab84b);};}exports[_0xcc1b('0x2f')]=function(_0xc994c6,_0x3118cb){var _0x4c1cb8={},_0x484bd3={},_0x423a8f={'count':0x0,'rows':[]};return db['CmCompany']['describe']()['then'](function(_0x36fdd9){_0x484bd3[_0xcc1b('0x30')]=_[_0xcc1b('0x31')](_0x36fdd9);_0x484bd3[_0xcc1b('0x32')]=_[_0xcc1b('0x31')](_0xc994c6['query']);_0x484bd3['filters']=_[_0xcc1b('0x33')](_0x484bd3[_0xcc1b('0x30')],_0x484bd3['query']);_0x4c1cb8[_0xcc1b('0x34')]=_[_0xcc1b('0x33')](_0x484bd3[_0xcc1b('0x30')],qs[_0xcc1b('0x35')](_0xc994c6[_0xcc1b('0x32')]['fields']));_0x4c1cb8['attributes']=_0x4c1cb8[_0xcc1b('0x34')]['length']?_0x4c1cb8['attributes']:_0x484bd3[_0xcc1b('0x30')];if(!_0xc994c6[_0xcc1b('0x32')][_0xcc1b('0x36')](_0xcc1b('0x37'))){_0x4c1cb8[_0xcc1b('0x21')]=qs[_0xcc1b('0x21')](_0xc994c6[_0xcc1b('0x32')][_0xcc1b('0x21')]);_0x4c1cb8[_0xcc1b('0x1e')]=qs[_0xcc1b('0x1e')](_0xc994c6[_0xcc1b('0x32')][_0xcc1b('0x1e')]);}_0x4c1cb8[_0xcc1b('0x38')]=qs['sort'](_0xc994c6[_0xcc1b('0x32')]['sort']);_0x4c1cb8[_0xcc1b('0x39')]=qs['filters'](_[_0xcc1b('0x3a')](_0xc994c6[_0xcc1b('0x32')],_0x484bd3[_0xcc1b('0x3b')]),_0x36fdd9);if(_0xc994c6[_0xcc1b('0x32')][_0xcc1b('0x3c')]){_0x4c1cb8[_0xcc1b('0x39')]=_[_0xcc1b('0x3d')](_0x4c1cb8[_0xcc1b('0x39')],{'$or':_[_0xcc1b('0x3e')](_0x4c1cb8[_0xcc1b('0x34')],function(_0x37629e){var _0x140ea6={};_0x140ea6[_0x37629e]={'$like':'%'+_0xc994c6[_0xcc1b('0x32')][_0xcc1b('0x3c')]+'%'};return _0x140ea6;})});}_0x4c1cb8=_[_0xcc1b('0x3d')]({},_0x4c1cb8,_0xc994c6['options']);var _0x26964b={'where':_0x4c1cb8[_0xcc1b('0x39')]};return db['CmCompany'][_0xcc1b('0x20')](_0x26964b)[_0xcc1b('0x26')](function(_0x4db596){_0x423a8f[_0xcc1b('0x20')]=_0x4db596;if(_0xc994c6[_0xcc1b('0x32')][_0xcc1b('0x3f')]){_0x4c1cb8[_0xcc1b('0x40')]=[{'all':!![]}];}return db[_0xcc1b('0x41')][_0xcc1b('0x42')](_0x4c1cb8);})[_0xcc1b('0x26')](function(_0x5996d4){_0x423a8f['rows']=_0x5996d4;return _0x423a8f;})[_0xcc1b('0x26')](respondWithFilteredResult(_0x3118cb,_0x4c1cb8))[_0xcc1b('0x43')](handleError(_0x3118cb,null));})[_0xcc1b('0x43')](handleError(_0x3118cb,null));};exports[_0xcc1b('0x44')]=function(_0x40a976,_0x35376a){var _0xfe98a7={'raw':![],'where':{'id':_0x40a976['params']['id']}},_0x53fc55={};_0x53fc55['model']=_[_0xcc1b('0x31')](db['CmCompany'][_0xcc1b('0x45')]);_0x53fc55['query']=_['keys'](_0x40a976['query']);_0x53fc55[_0xcc1b('0x3b')]=_[_0xcc1b('0x33')](_0x53fc55[_0xcc1b('0x30')],_0x53fc55['query']);_0xfe98a7[_0xcc1b('0x34')]=_['intersection'](_0x53fc55[_0xcc1b('0x30')],qs[_0xcc1b('0x35')](_0x40a976[_0xcc1b('0x32')][_0xcc1b('0x35')]));_0xfe98a7[_0xcc1b('0x34')]=_0xfe98a7['attributes'][_0xcc1b('0x46')]?_0xfe98a7[_0xcc1b('0x34')]:_0x53fc55[_0xcc1b('0x30')];if(_0x40a976[_0xcc1b('0x32')]['includeAll']){_0xfe98a7[_0xcc1b('0x40')]=[{'all':!![]}];}_0xfe98a7=_[_0xcc1b('0x3d')]({},_0xfe98a7,_0x40a976[_0xcc1b('0x47')]);return db[_0xcc1b('0x41')][_0xcc1b('0x48')](_0xfe98a7)[_0xcc1b('0x26')](handleEntityNotFound(_0x35376a,null))['then'](respondWithResult(_0x35376a,null))[_0xcc1b('0x43')](handleError(_0x35376a,null));};exports[_0xcc1b('0x49')]=function(_0x31bece,_0x519a7a){return db['CmCompany'][_0xcc1b('0x49')](_0x31bece[_0xcc1b('0x4a')],{})['then'](function(_0x426fd5){var _0x67cb12=_0x31bece['user'][_0xcc1b('0x28')]({'plain':!![]});if(!_0x67cb12)throw new Error(_0xcc1b('0x4b'));if(_0x67cb12[_0xcc1b('0x4c')]===_0xcc1b('0x4d')){var _0x2af513=_0x426fd5[_0xcc1b('0x28')]({'plain':!![]});var _0x55ed1e='Companies';return db[_0xcc1b('0x4e')][_0xcc1b('0x48')]({'where':{'name':_0x55ed1e,'userProfileId':_0x67cb12['userProfileId']},'raw':!![]})[_0xcc1b('0x26')](function(_0xa51589){if(_0xa51589&&_0xa51589[_0xcc1b('0x4f')]===0x0){return db[_0xcc1b('0x50')][_0xcc1b('0x49')]({'name':_0x2af513[_0xcc1b('0x2d')],'resourceId':_0x2af513['id'],'type':_0xa51589[_0xcc1b('0x2d')],'sectionId':_0xa51589['id']},{})['then'](function(){return _0x426fd5;});}else{return _0x426fd5;}})[_0xcc1b('0x43')](function(_0x3c44e8){logger[_0xcc1b('0x2b')](_0xcc1b('0x51'),_0x3c44e8);throw _0x3c44e8;});}return _0x426fd5;})[_0xcc1b('0x26')](respondWithResult(_0x519a7a,0xc9))[_0xcc1b('0x43')](handleError(_0x519a7a,null));};exports[_0xcc1b('0x25')]=function(_0x4b8861,_0x292dbb){if(_0x4b8861[_0xcc1b('0x4a')]['id']){delete _0x4b8861['body']['id'];}return db[_0xcc1b('0x41')]['find']({'where':{'id':_0x4b8861[_0xcc1b('0x52')]['id']}})[_0xcc1b('0x26')](handleEntityNotFound(_0x292dbb,null))[_0xcc1b('0x26')](saveUpdates(_0x4b8861['body'],null))[_0xcc1b('0x26')](respondWithResult(_0x292dbb,null))[_0xcc1b('0x43')](handleError(_0x292dbb,null));};exports[_0xcc1b('0x27')]=function(_0x317011,_0x830d4f){return db[_0xcc1b('0x41')][_0xcc1b('0x48')]({'where':{'id':_0x317011[_0xcc1b('0x52')]['id']}})['then'](handleEntityNotFound(_0x830d4f,null))[_0xcc1b('0x26')](removeEntity(_0x830d4f,null))[_0xcc1b('0x43')](handleError(_0x830d4f,null));};exports[_0xcc1b('0x53')]=function(_0x5cab69,_0x31f70a){return db[_0xcc1b('0x41')][_0xcc1b('0x53')]()[_0xcc1b('0x26')](respondWithResult(_0x31f70a,null))['catch'](handleError(_0x31f70a,null));};exports[_0xcc1b('0x54')]=function(_0x2a1856,_0x2b9c52,_0x202851){return db[_0xcc1b('0x55')][_0xcc1b('0x48')]({'where':{'id':_0x2a1856[_0xcc1b('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b9c52,null))[_0xcc1b('0x26')](function(_0x23c34d){if(_0x23c34d){return _0x23c34d[_0xcc1b('0x54')](_0x2a1856[_0xcc1b('0x4a')]['ids'],_[_0xcc1b('0x56')](_0x2a1856[_0xcc1b('0x4a')],[_0xcc1b('0x57'),'id'])||{});}})[_0xcc1b('0x26')](respondWithResult(_0x2b9c52,null))[_0xcc1b('0x43')](handleError(_0x2b9c52,null));};exports[_0xcc1b('0x58')]=function(_0x3e852b,_0x9efdb1,_0x44627f){var _0x566943={};var _0x44d1c5={};var _0x1c200e;var _0x413f12;return db[_0xcc1b('0x41')][_0xcc1b('0x59')]({'where':{'id':_0x3e852b[_0xcc1b('0x52')]['id']}})[_0xcc1b('0x26')](handleEntityNotFound(_0x9efdb1,null))[_0xcc1b('0x26')](function(_0x5639e9){if(_0x5639e9){_0x1c200e=_0x5639e9;_0x44d1c5[_0xcc1b('0x30')]=_[_0xcc1b('0x31')](db[_0xcc1b('0x55')]['rawAttributes']);_0x44d1c5['query']=_['keys'](_0x3e852b['query']);_0x44d1c5[_0xcc1b('0x3b')]=_[_0xcc1b('0x33')](_0x44d1c5['model'],_0x44d1c5[_0xcc1b('0x32')]);_0x566943[_0xcc1b('0x34')]=_[_0xcc1b('0x33')](_0x44d1c5[_0xcc1b('0x30')],qs[_0xcc1b('0x35')](_0x3e852b[_0xcc1b('0x32')][_0xcc1b('0x35')]));_0x566943[_0xcc1b('0x34')]=_0x566943[_0xcc1b('0x34')][_0xcc1b('0x46')]?_0x566943[_0xcc1b('0x34')]:_0x44d1c5[_0xcc1b('0x30')];_0x566943['order']=qs['sort'](_0x3e852b[_0xcc1b('0x32')][_0xcc1b('0x5a')]);_0x566943[_0xcc1b('0x39')]=qs[_0xcc1b('0x3b')](_['pick'](_0x3e852b['query'],_0x44d1c5[_0xcc1b('0x3b')]));if(_0x3e852b[_0xcc1b('0x32')][_0xcc1b('0x3c')]){_0x566943[_0xcc1b('0x39')]=_[_0xcc1b('0x3d')](_0x566943[_0xcc1b('0x39')],{'$or':_[_0xcc1b('0x3e')](_0x566943[_0xcc1b('0x34')],function(_0x4ca872){var _0x5f0765={};_0x5f0765[_0x4ca872]={'$like':'%'+_0x3e852b[_0xcc1b('0x32')]['filter']+'%'};return _0x5f0765;})});}_0x566943=_[_0xcc1b('0x3d')]({},_0x566943,_0x3e852b[_0xcc1b('0x47')]);return _0x1c200e[_0xcc1b('0x58')](_0x566943);}})['then'](function(_0x3014d2){if(_0x3014d2){_0x413f12=_0x3014d2['length'];if(!_0x3e852b['query'][_0xcc1b('0x36')](_0xcc1b('0x37'))){_0x566943['limit']=qs[_0xcc1b('0x21')](_0x3e852b[_0xcc1b('0x32')][_0xcc1b('0x21')]);_0x566943['offset']=qs['offset'](_0x3e852b[_0xcc1b('0x32')]['offset']);}return _0x1c200e[_0xcc1b('0x58')](_0x566943);}})[_0xcc1b('0x26')](function(_0x451791){if(_0x451791){return _0x451791?{'count':_0x413f12,'rows':_0x451791}:null;}})[_0xcc1b('0x26')](respondWithResult(_0x9efdb1,null))[_0xcc1b('0x43')](handleError(_0x9efdb1,null));}; \ No newline at end of file +var _0xe0ae=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','map','merge','includeAll','include','rows','catch','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','set','Content-Range','apply','reject','then','get','Companies','UserProfileResource','destroy','end','error','stack','name','send','index','CmCompany','describe','model','keys','query'];(function(_0x3bcdb1,_0xcda140){var _0x40f0ec=function(_0x44ba03){while(--_0x44ba03){_0x3bcdb1['push'](_0x3bcdb1['shift']());}};_0x40f0ec(++_0xcda140);}(_0xe0ae,0x18d));var _0xee0a=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0xe0ae[_0x4d40dd];return _0x1c51f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee0a('0x0'));var zipdir=require(_0xee0a('0x1'));var jsonpatch=require(_0xee0a('0x2'));var rp=require(_0xee0a('0x3'));var moment=require(_0xee0a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee0a('0x5'));var util=require('util');var path=require(_0xee0a('0x6'));var sox=require(_0xee0a('0x7'));var csv=require('to-csv');var ejs=require(_0xee0a('0x8'));var fs=require('fs');var fs_extra=require(_0xee0a('0x9'));var _=require(_0xee0a('0xa'));var squel=require(_0xee0a('0xb'));var crypto=require(_0xee0a('0xc'));var jsforce=require(_0xee0a('0xd'));var deskjs=require(_0xee0a('0xe'));var toCsv=require(_0xee0a('0xf'));var querystring=require(_0xee0a('0x10'));var Papa=require(_0xee0a('0x11'));var Redis=require(_0xee0a('0x12'));var authService=require(_0xee0a('0x13'));var qs=require(_0xee0a('0x14'));var as=require(_0xee0a('0x15'));var hardwareService=require(_0xee0a('0x16'));var logger=require(_0xee0a('0x17'))(_0xee0a('0x18'));var utils=require(_0xee0a('0x19'));var config=require(_0xee0a('0x1a'));var licenseUtil=require(_0xee0a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b8d2d,_0x125f7a){_0x125f7a=_0x125f7a||0xcc;return function(_0x1571bd){if(_0x1571bd){return _0x4b8d2d[_0xee0a('0x1c')](_0x125f7a);}return _0x4b8d2d['status'](_0x125f7a)['end']();};}function respondWithResult(_0x319a55,_0x1be524){_0x1be524=_0x1be524||0xc8;return function(_0x5a18c7){if(_0x5a18c7){return _0x319a55[_0xee0a('0x1d')](_0x1be524)['json'](_0x5a18c7);}};}function respondWithFilteredResult(_0x2f27a4,_0x164e37){return function(_0x3d1ed0){if(_0x3d1ed0){var _0x46cdcd=typeof _0x164e37['offset']===_0xee0a('0x1e')&&typeof _0x164e37[_0xee0a('0x1f')]===_0xee0a('0x1e');var _0x1726ce=_0x3d1ed0[_0xee0a('0x20')];var _0x58e20b=_0x46cdcd?0x0:_0x164e37['offset'];var _0xbf627=_0x46cdcd?_0x3d1ed0[_0xee0a('0x20')]:_0x164e37['offset']+_0x164e37[_0xee0a('0x1f')];var _0x5a4341;if(_0xbf627>=_0x1726ce){_0xbf627=_0x1726ce;_0x5a4341=0xc8;}else{_0x5a4341=0xce;}_0x2f27a4[_0xee0a('0x1d')](_0x5a4341);return _0x2f27a4[_0xee0a('0x21')](_0xee0a('0x22'),_0x58e20b+'-'+_0xbf627+'/'+_0x1726ce)['json'](_0x3d1ed0);}return null;};}function patchUpdates(_0x4c3034){return function(_0x236353){try{jsonpatch[_0xee0a('0x23')](_0x236353,_0x4c3034,!![]);}catch(_0xb462af){return BPromise[_0xee0a('0x24')](_0xb462af);}return _0x236353['save']();};}function saveUpdates(_0x3fca79,_0x8a3794){return function(_0x145084){if(_0x145084){return _0x145084['update'](_0x3fca79)[_0xee0a('0x25')](function(_0x2a9310){return _0x2a9310;});}return null;};}function removeEntity(_0x33e798,_0x25af37){return function(_0x40ab10){if(_0x40ab10){return _0x40ab10['destroy']()['then'](function(){var _0xf089c0=_0x40ab10[_0xee0a('0x26')]({'plain':!![]});var _0x312099=_0xee0a('0x27');return db[_0xee0a('0x28')][_0xee0a('0x29')]({'where':{'type':_0x312099,'resourceId':_0xf089c0['id']}})['then'](function(){return _0x40ab10;});})['then'](function(){_0x33e798[_0xee0a('0x1d')](0xcc)[_0xee0a('0x2a')]();});}};}function handleEntityNotFound(_0x47ef0f,_0x2aa9a0){return function(_0x29ee24){if(!_0x29ee24){_0x47ef0f[_0xee0a('0x1c')](0x194);}return _0x29ee24;};}function handleError(_0x2a2ee0,_0x24d5ee){_0x24d5ee=_0x24d5ee||0x1f4;return function(_0x2dd2b1){logger[_0xee0a('0x2b')](_0x2dd2b1[_0xee0a('0x2c')]);if(_0x2dd2b1[_0xee0a('0x2d')]){delete _0x2dd2b1[_0xee0a('0x2d')];}_0x2a2ee0[_0xee0a('0x1d')](_0x24d5ee)[_0xee0a('0x2e')](_0x2dd2b1);};}exports[_0xee0a('0x2f')]=function(_0x2100d8,_0x3743bf){var _0x1761e9={},_0x5869c5={},_0x40f821={'count':0x0,'rows':[]};return db[_0xee0a('0x30')][_0xee0a('0x31')]()[_0xee0a('0x25')](function(_0x2cdb93){_0x5869c5[_0xee0a('0x32')]=_[_0xee0a('0x33')](_0x2cdb93);_0x5869c5[_0xee0a('0x34')]=_['keys'](_0x2100d8[_0xee0a('0x34')]);_0x5869c5['filters']=_[_0xee0a('0x35')](_0x5869c5[_0xee0a('0x32')],_0x5869c5[_0xee0a('0x34')]);_0x1761e9[_0xee0a('0x36')]=_[_0xee0a('0x35')](_0x5869c5['model'],qs['fields'](_0x2100d8[_0xee0a('0x34')][_0xee0a('0x37')]));_0x1761e9[_0xee0a('0x36')]=_0x1761e9[_0xee0a('0x36')][_0xee0a('0x38')]?_0x1761e9[_0xee0a('0x36')]:_0x5869c5[_0xee0a('0x32')];if(!_0x2100d8[_0xee0a('0x34')][_0xee0a('0x39')](_0xee0a('0x3a'))){_0x1761e9[_0xee0a('0x1f')]=qs[_0xee0a('0x1f')](_0x2100d8['query'][_0xee0a('0x1f')]);_0x1761e9[_0xee0a('0x3b')]=qs[_0xee0a('0x3b')](_0x2100d8[_0xee0a('0x34')][_0xee0a('0x3b')]);}_0x1761e9['order']=qs[_0xee0a('0x3c')](_0x2100d8[_0xee0a('0x34')][_0xee0a('0x3c')]);_0x1761e9[_0xee0a('0x3d')]=qs[_0xee0a('0x3e')](_[_0xee0a('0x3f')](_0x2100d8[_0xee0a('0x34')],_0x5869c5[_0xee0a('0x3e')]),_0x2cdb93);if(_0x2100d8[_0xee0a('0x34')][_0xee0a('0x40')]){_0x1761e9[_0xee0a('0x3d')]=_['merge'](_0x1761e9['where'],{'$or':_[_0xee0a('0x41')](_0x1761e9['attributes'],function(_0x285753){var _0x390c31={};_0x390c31[_0x285753]={'$like':'%'+_0x2100d8[_0xee0a('0x34')]['filter']+'%'};return _0x390c31;})});}_0x1761e9=_[_0xee0a('0x42')]({},_0x1761e9,_0x2100d8['options']);var _0x1a5fbf={'where':_0x1761e9[_0xee0a('0x3d')]};return db[_0xee0a('0x30')]['count'](_0x1a5fbf)[_0xee0a('0x25')](function(_0x42b12){_0x40f821[_0xee0a('0x20')]=_0x42b12;if(_0x2100d8[_0xee0a('0x34')][_0xee0a('0x43')]){_0x1761e9[_0xee0a('0x44')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x1761e9);})['then'](function(_0x9ec47b){_0x40f821[_0xee0a('0x45')]=_0x9ec47b;return _0x40f821;})[_0xee0a('0x25')](respondWithFilteredResult(_0x3743bf,_0x1761e9))[_0xee0a('0x46')](handleError(_0x3743bf,null));})[_0xee0a('0x46')](handleError(_0x3743bf,null));};exports['show']=function(_0x5ae865,_0x16829e){var _0x448b1e={'raw':![],'where':{'id':_0x5ae865[_0xee0a('0x47')]['id']}},_0x359c72={};_0x359c72[_0xee0a('0x32')]=_[_0xee0a('0x33')](db[_0xee0a('0x30')][_0xee0a('0x48')]);_0x359c72[_0xee0a('0x34')]=_[_0xee0a('0x33')](_0x5ae865['query']);_0x359c72[_0xee0a('0x3e')]=_[_0xee0a('0x35')](_0x359c72[_0xee0a('0x32')],_0x359c72[_0xee0a('0x34')]);_0x448b1e[_0xee0a('0x36')]=_['intersection'](_0x359c72['model'],qs[_0xee0a('0x37')](_0x5ae865[_0xee0a('0x34')][_0xee0a('0x37')]));_0x448b1e[_0xee0a('0x36')]=_0x448b1e['attributes'][_0xee0a('0x38')]?_0x448b1e['attributes']:_0x359c72[_0xee0a('0x32')];if(_0x5ae865[_0xee0a('0x34')][_0xee0a('0x43')]){_0x448b1e[_0xee0a('0x44')]=[{'all':!![]}];}_0x448b1e=_[_0xee0a('0x42')]({},_0x448b1e,_0x5ae865[_0xee0a('0x49')]);return db['CmCompany']['find'](_0x448b1e)[_0xee0a('0x25')](handleEntityNotFound(_0x16829e,null))[_0xee0a('0x25')](respondWithResult(_0x16829e,null))[_0xee0a('0x46')](handleError(_0x16829e,null));};exports['create']=function(_0xfd70a2,_0x5a6dc0){return db['CmCompany'][_0xee0a('0x4a')](_0xfd70a2[_0xee0a('0x4b')],{})[_0xee0a('0x25')](function(_0x3763d9){var _0x49fee1=_0xfd70a2[_0xee0a('0x4c')][_0xee0a('0x26')]({'plain':!![]});if(!_0x49fee1)throw new Error(_0xee0a('0x4d'));if(_0x49fee1['role']===_0xee0a('0x4c')){var _0xa2c069=_0x3763d9['get']({'plain':!![]});var _0x26a7ad='Companies';return db[_0xee0a('0x4e')][_0xee0a('0x4f')]({'where':{'name':_0x26a7ad,'userProfileId':_0x49fee1[_0xee0a('0x50')]},'raw':!![]})['then'](function(_0x2dffdf){if(_0x2dffdf&&_0x2dffdf[_0xee0a('0x51')]===0x0){return db['UserProfileResource'][_0xee0a('0x4a')]({'name':_0xa2c069[_0xee0a('0x2d')],'resourceId':_0xa2c069['id'],'type':_0x2dffdf[_0xee0a('0x2d')],'sectionId':_0x2dffdf['id']},{})[_0xee0a('0x25')](function(){return _0x3763d9;});}else{return _0x3763d9;}})[_0xee0a('0x46')](function(_0x160ab6){logger['error'](_0xee0a('0x52'),_0x160ab6);throw _0x160ab6;});}return _0x3763d9;})[_0xee0a('0x25')](respondWithResult(_0x5a6dc0,0xc9))[_0xee0a('0x46')](handleError(_0x5a6dc0,null));};exports[_0xee0a('0x53')]=function(_0x35705f,_0x20cb11){if(_0x35705f[_0xee0a('0x4b')]['id']){delete _0x35705f[_0xee0a('0x4b')]['id'];}return db[_0xee0a('0x30')][_0xee0a('0x4f')]({'where':{'id':_0x35705f[_0xee0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x20cb11,null))['then'](saveUpdates(_0x35705f['body'],null))[_0xee0a('0x25')](respondWithResult(_0x20cb11,null))[_0xee0a('0x46')](handleError(_0x20cb11,null));};exports[_0xee0a('0x29')]=function(_0x5c2462,_0x1e5c52){return db[_0xee0a('0x30')][_0xee0a('0x4f')]({'where':{'id':_0x5c2462[_0xee0a('0x47')]['id']}})[_0xee0a('0x25')](handleEntityNotFound(_0x1e5c52,null))[_0xee0a('0x25')](removeEntity(_0x1e5c52,null))[_0xee0a('0x46')](handleError(_0x1e5c52,null));};exports[_0xee0a('0x31')]=function(_0x43e146,_0x4e2402){return db[_0xee0a('0x30')]['describe']()[_0xee0a('0x25')](respondWithResult(_0x4e2402,null))[_0xee0a('0x46')](handleError(_0x4e2402,null));};exports[_0xee0a('0x54')]=function(_0x38bf51,_0x485613,_0x29200b){return db[_0xee0a('0x55')]['find']({'where':{'id':_0x38bf51[_0xee0a('0x47')]['id']}})[_0xee0a('0x25')](handleEntityNotFound(_0x485613,null))[_0xee0a('0x25')](function(_0x350d0c){if(_0x350d0c){return _0x350d0c[_0xee0a('0x54')](_0x38bf51[_0xee0a('0x4b')][_0xee0a('0x56')],_[_0xee0a('0x57')](_0x38bf51[_0xee0a('0x4b')],[_0xee0a('0x56'),'id'])||{});}})[_0xee0a('0x25')](respondWithResult(_0x485613,null))[_0xee0a('0x46')](handleError(_0x485613,null));};exports[_0xee0a('0x58')]=function(_0x23f08c,_0x3c94c8,_0x599971){var _0x5f0225={};var _0x46a214={};var _0xe9a978;var _0x59a7c7;return db[_0xee0a('0x30')]['findOne']({'where':{'id':_0x23f08c[_0xee0a('0x47')]['id']}})[_0xee0a('0x25')](handleEntityNotFound(_0x3c94c8,null))['then'](function(_0x44214e){if(_0x44214e){_0xe9a978=_0x44214e;_0x46a214['model']=_[_0xee0a('0x33')](db[_0xee0a('0x55')]['rawAttributes']);_0x46a214[_0xee0a('0x34')]=_['keys'](_0x23f08c[_0xee0a('0x34')]);_0x46a214[_0xee0a('0x3e')]=_['intersection'](_0x46a214['model'],_0x46a214[_0xee0a('0x34')]);_0x5f0225[_0xee0a('0x36')]=_['intersection'](_0x46a214[_0xee0a('0x32')],qs[_0xee0a('0x37')](_0x23f08c['query']['fields']));_0x5f0225['attributes']=_0x5f0225[_0xee0a('0x36')]['length']?_0x5f0225[_0xee0a('0x36')]:_0x46a214['model'];_0x5f0225[_0xee0a('0x59')]=qs[_0xee0a('0x3c')](_0x23f08c[_0xee0a('0x34')][_0xee0a('0x3c')]);_0x5f0225[_0xee0a('0x3d')]=qs['filters'](_[_0xee0a('0x3f')](_0x23f08c[_0xee0a('0x34')],_0x46a214[_0xee0a('0x3e')]));if(_0x23f08c[_0xee0a('0x34')][_0xee0a('0x40')]){_0x5f0225[_0xee0a('0x3d')]=_['merge'](_0x5f0225['where'],{'$or':_['map'](_0x5f0225['attributes'],function(_0x57e83a){var _0x4435dd={};_0x4435dd[_0x57e83a]={'$like':'%'+_0x23f08c['query'][_0xee0a('0x40')]+'%'};return _0x4435dd;})});}_0x5f0225=_[_0xee0a('0x42')]({},_0x5f0225,_0x23f08c['options']);return _0xe9a978[_0xee0a('0x58')](_0x5f0225);}})[_0xee0a('0x25')](function(_0x56139d){if(_0x56139d){_0x59a7c7=_0x56139d[_0xee0a('0x38')];if(!_0x23f08c['query']['hasOwnProperty'](_0xee0a('0x3a'))){_0x5f0225[_0xee0a('0x1f')]=qs[_0xee0a('0x1f')](_0x23f08c[_0xee0a('0x34')]['limit']);_0x5f0225['offset']=qs[_0xee0a('0x3b')](_0x23f08c[_0xee0a('0x34')][_0xee0a('0x3b')]);}return _0xe9a978[_0xee0a('0x58')](_0x5f0225);}})['then'](function(_0x380c5b){if(_0x380c5b){return _0x380c5b?{'count':_0x59a7c7,'rows':_0x380c5b}:null;}})[_0xee0a('0x25')](respondWithResult(_0x3c94c8,null))[_0xee0a('0x46')](handleError(_0x3c94c8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 46bed35..979f310 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 _0x4e9d=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','cm_companies'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x4e9d,0xc6));var _0xd4e9=function(_0x3ff9bc,_0x51778d){_0x3ff9bc=_0x3ff9bc-0x0;var _0x4017d6=_0x4e9d[_0x3ff9bc];return _0x4017d6;};'use strict';var _=require(_0xd4e9('0x0'));var util=require(_0xd4e9('0x1'));var logger=require(_0xd4e9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd4e9('0x3'));var rp=require(_0xd4e9('0x4'));var fs=require('fs');var path=require(_0xd4e9('0x5'));var rimraf=require(_0xd4e9('0x6'));var config=require(_0xd4e9('0x7'));var attributes=require(_0xd4e9('0x8'));module[_0xd4e9('0x9')]=function(_0x5d84dd,_0xd9217e){return _0x5d84dd['define']('CmCompany',attributes,{'tableName':_0xd4e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda61=['moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xda61,0x65));var _0x1da6=function(_0x42ae90,_0xc9e59b){_0x42ae90=_0x42ae90-0x0;var _0x5c4f06=_0xda61[_0x42ae90];return _0x5c4f06;};'use strict';var _=require(_0x1da6('0x0'));var util=require(_0x1da6('0x1'));var logger=require(_0x1da6('0x2'))('api');var moment=require(_0x1da6('0x3'));var BPromise=require(_0x1da6('0x4'));var rp=require(_0x1da6('0x5'));var fs=require('fs');var path=require(_0x1da6('0x6'));var rimraf=require('rimraf');var config=require(_0x1da6('0x7'));var attributes=require(_0x1da6('0x8'));module[_0x1da6('0x9')]=function(_0x2e258f,_0x4dc9d8){return _0x2e258f[_0x1da6('0xa')](_0x1da6('0xb'),attributes,{'tableName':_0x1da6('0xc'),'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 8ca2d16..96fa416 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 _0x0861=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s'];(function(_0x102227,_0x57414a){var _0xf2786=function(_0x2e6080){while(--_0x2e6080){_0x102227['push'](_0x102227['shift']());}};_0xf2786(++_0x57414a);}(_0x0861,0x65));var _0x1086=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0861[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x1086('0x0'));var moment=require('moment');var BPromise=require(_0x1086('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1086('0x2'));var db=require(_0x1086('0x3'))['db'];var utils=require(_0x1086('0x4'));var logger=require('../../config/logger')(_0x1086('0x5'));var config=require(_0x1086('0x6'));var jayson=require(_0x1086('0x7'));var client=jayson[_0x1086('0x8')][_0x1086('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x459086,_0x143cf2,_0x31a433){return new BPromise(function(_0x1ba1a0,_0x145b13){return client[_0x1086('0xa')](_0x459086,_0x31a433)['then'](function(_0x1977e8){logger[_0x1086('0xb')](_0x1086('0xc'),_0x143cf2,'request\x20sent');logger['debug'](_0x1086('0xd'),_0x143cf2,_0x1086('0xe'),JSON[_0x1086('0xf')](_0x1977e8));if(_0x1977e8[_0x1086('0x10')]){if(_0x1977e8['error']['code']===0x1f4){logger[_0x1086('0x10')](_0x1086('0xc'),_0x143cf2,_0x1977e8[_0x1086('0x10')][_0x1086('0x11')]);return _0x145b13(_0x1977e8[_0x1086('0x10')][_0x1086('0x11')]);}logger[_0x1086('0x10')](_0x1086('0xc'),_0x143cf2,_0x1977e8['error'][_0x1086('0x11')]);return _0x1ba1a0(_0x1977e8[_0x1086('0x10')]['message']);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x143cf2,_0x1086('0xe'));_0x1ba1a0(_0x1977e8[_0x1086('0x12')][_0x1086('0x11')]);}})['catch'](function(_0x2701ba){logger['error'](_0x1086('0xc'),_0x143cf2,_0x2701ba);_0x145b13(_0x2701ba);});});} \ No newline at end of file +var _0xe560=['../../config/environment','jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xb9c7d5,_0x1d1dbc){var _0x1fe79e=function(_0x1d0265){while(--_0x1d0265){_0xb9c7d5['push'](_0xb9c7d5['shift']());}};_0x1fe79e(++_0x1d1dbc);}(_0xe560,0x7a));var _0x0e56=function(_0x431dd3,_0x1581d8){_0x431dd3=_0x431dd3-0x0;var _0x2058b4=_0xe560[_0x431dd3];return _0x2058b4;};'use strict';var _=require(_0x0e56('0x0'));var util=require(_0x0e56('0x1'));var moment=require(_0x0e56('0x2'));var BPromise=require(_0x0e56('0x3'));var rs=require(_0x0e56('0x4'));var fs=require('fs');var Redis=require(_0x0e56('0x5'));var db=require(_0x0e56('0x6'))['db'];var utils=require(_0x0e56('0x7'));var logger=require(_0x0e56('0x8'))(_0x0e56('0x9'));var config=require(_0x0e56('0xa'));var jayson=require(_0x0e56('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e6a46,_0x8e037,_0x1718dd){return new BPromise(function(_0x8845bf,_0x3673ad){return client[_0x0e56('0xc')](_0x1e6a46,_0x1718dd)[_0x0e56('0xd')](function(_0x5512e9){logger[_0x0e56('0xe')](_0x0e56('0xf'),_0x8e037,_0x0e56('0x10'));logger[_0x0e56('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x8e037,'request\x20sent',JSON[_0x0e56('0x12')](_0x5512e9));if(_0x5512e9['error']){if(_0x5512e9['error'][_0x0e56('0x13')]===0x1f4){logger[_0x0e56('0x14')]('CmCompany,\x20%s,\x20%s',_0x8e037,_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);return _0x3673ad(_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);}logger[_0x0e56('0x14')](_0x0e56('0xf'),_0x8e037,_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);return _0x8845bf(_0x5512e9[_0x0e56('0x14')][_0x0e56('0x15')]);}else{logger[_0x0e56('0xe')](_0x0e56('0xf'),_0x8e037,_0x0e56('0x10'));_0x8845bf(_0x5512e9['result'][_0x0e56('0x15')]);}})['catch'](function(_0x3a78fb){logger[_0x0e56('0x14')]('CmCompany,\x20%s,\x20%s',_0x8e037,_0x3a78fb);_0x3673ad(_0x3a78fb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d8b3c87..6e51a8c 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 _0x3583=['addContacts','put','/:id','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id/contacts','getContacts','create','post'];(function(_0x21adb6,_0x13ca6e){var _0x31b2b5=function(_0x181f4e){while(--_0x181f4e){_0x21adb6['push'](_0x21adb6['shift']());}};_0x31b2b5(++_0x13ca6e);}(_0x3583,0x12a));var _0x3358=function(_0x2fc689,_0x5d944b){_0x2fc689=_0x2fc689-0x0;var _0x26953e=_0x3583[_0x2fc689];return _0x26953e;};'use strict';var multer=require(_0x3358('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3358('0x1'));var express=require('express');var router=express[_0x3358('0x2')]();var fs_extra=require(_0x3358('0x3'));var auth=require(_0x3358('0x4'));var interaction=require(_0x3358('0x5'));var config=require(_0x3358('0x6'));var controller=require(_0x3358('0x7'));router[_0x3358('0x8')]('/',auth[_0x3358('0x9')](),controller[_0x3358('0xa')]);router[_0x3358('0x8')](_0x3358('0xb'),auth[_0x3358('0x9')](),controller[_0x3358('0xc')]);router[_0x3358('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3358('0x8')](_0x3358('0xd'),auth['isAuthenticated'](),controller[_0x3358('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3358('0xf')]);router[_0x3358('0x10')]('/:id/contacts',auth[_0x3358('0x9')](),controller[_0x3358('0x11')]);router[_0x3358('0x12')](_0x3358('0x13'),auth[_0x3358('0x9')](),controller['update']);router['delete'](_0x3358('0x13'),auth[_0x3358('0x9')](),controller['destroy']);module[_0x3358('0x14')]=router; \ No newline at end of file +var _0x2293=['/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','/describe','describe','get','/:id','isAuthenticated','show'];(function(_0x4b8d18,_0x51cf18){var _0x47aa67=function(_0x17679f){while(--_0x17679f){_0x4b8d18['push'](_0x4b8d18['shift']());}};_0x47aa67(++_0x51cf18);}(_0x2293,0x6d));var _0x3229=function(_0x2a31e4,_0x484990){_0x2a31e4=_0x2a31e4-0x0;var _0x39c146=_0x2293[_0x2a31e4];return _0x39c146;};'use strict';var multer=require(_0x3229('0x0'));var util=require(_0x3229('0x1'));var path=require(_0x3229('0x2'));var timeout=require(_0x3229('0x3'));var express=require('express');var router=express[_0x3229('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3229('0x5'));var interaction=require(_0x3229('0x6'));var config=require(_0x3229('0x7'));var controller=require(_0x3229('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3229('0x9')]);router['get'](_0x3229('0xa'),auth['isAuthenticated'](),controller[_0x3229('0xb')]);router[_0x3229('0xc')](_0x3229('0xd'),auth[_0x3229('0xe')](),controller[_0x3229('0xf')]);router[_0x3229('0xc')](_0x3229('0x10'),auth[_0x3229('0xe')](),controller[_0x3229('0x11')]);router[_0x3229('0x12')]('/',auth['isAuthenticated'](),controller[_0x3229('0x13')]);router['post'](_0x3229('0x10'),auth['isAuthenticated'](),controller[_0x3229('0x14')]);router[_0x3229('0x15')](_0x3229('0xd'),auth['isAuthenticated'](),controller[_0x3229('0x16')]);router[_0x3229('0x17')]('/:id',auth[_0x3229('0xe')](),controller[_0x3229('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index e4a20ed..604581b 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 _0x757a=['STRING','TEXT','INTEGER','UNSIGNED','DATE','sequelize','exports'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x757a,0xde));var _0xa757=function(_0x2dd5cf,_0x442eac){_0x2dd5cf=_0x2dd5cf-0x0;var _0x4fd267=_0x757a[_0x2dd5cf];return _0x4fd267;};'use strict';var _=require('lodash');var Sequelize=require(_0xa757('0x0'));module[_0xa757('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa757('0x2')]},'city':{'type':Sequelize[_0xa757('0x2')]},'country':{'type':Sequelize[_0xa757('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa757('0x2')]},'description':{'type':Sequelize[_0xa757('0x3')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa757('0x2')]},'email':{'type':Sequelize[_0xa757('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa757('0x2')]},'fb_data':{'type':Sequelize[_0xa757('0x2')]},'twitter':{'type':Sequelize[_0xa757('0x2')]},'skype':{'type':Sequelize[_0xa757('0x2')]},'teams':{'type':Sequelize[_0xa757('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa757('0x2')]},'wechat':{'type':Sequelize[_0xa757('0x2')]},'telegram':{'type':Sequelize[_0xa757('0x2')]},'UserId':{'type':Sequelize[_0xa757('0x4')]},'priority':{'type':Sequelize[_0xa757('0x4')](0x2)[_0xa757('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa757('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x3485c9,_0x1b2e25){var _0x382b23=function(_0x3a6895){while(--_0x3a6895){_0x3485c9['push'](_0x3485c9['shift']());}};_0x382b23(++_0x1b2e25);}(_0x0b0e,0x187));var _0xe0b0=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x0b0e[_0x419e17];return _0x1f2044;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0d05145..07e22d1 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 _0x3c1c=['having','t.id\x20IN\x20?','resolve','user','getLists','c.ListId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','tags','columnName','analytics','findAll','displayName','custom','values','body','get','mergeWith','isArray','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','catch','dialTimezone','timezones','utcOffset','bulkCreate','duplicates','$or','findOrCreate','spread','show','params','cf_%d','$and','format','table','setFields','id\x20=\x20?','toParam','text','phone','getTags','options','setTags','ids','getHoppers','rawAttributes','pick','ContactId','includeAll','include','getHopperHistories','nolimit','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','file','parse','meta','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','pid','getJourney','chat','sms','openchannel','whatsapp','voice','includes','Invalid\x20channel','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','alias','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','DESC','customerPort','osName','ratingMessage','ratingType','referer','subject','externalUrl','threadId','fullname','flatten','sortBy','reverse','util','path','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','json','offset','undefined','limit','count','status','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','CmCustomField','findOne','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','select','field','color','from','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','map','forEach','union','User','and','dateOfBirth','datetime','DATE','buildExpression','start','filter','isNil','Contact','push','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','isEmpty'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x3c1c,0xb1));var _0xc3c1=function(_0x4f1b87,_0x260834){_0x4f1b87=_0x4f1b87-0x0;var _0x74718e=_0x3c1c[_0x4f1b87];return _0x74718e;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xc3c1('0x0'));var path=require(_0xc3c1('0x1'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xc3c1('0x2'));var Redis=require(_0xc3c1('0x3'));var qs=require('../../components/parsers/qs');var as=require(_0xc3c1('0x4'));var logger=require(_0xc3c1('0x5'))('api');var config=require('../../config/environment');var shared=require(_0xc3c1('0x6'));var db=require(_0xc3c1('0x7'))['db'];config[_0xc3c1('0x8')]=_[_0xc3c1('0x9')](config[_0xc3c1('0x8')],{'host':_0xc3c1('0xa'),'port':0x18eb});var socket=require(_0xc3c1('0xb'))(new Redis(config[_0xc3c1('0x8')]));require(_0xc3c1('0xc'))['register'](socket);function respondWithResult(_0x216331,_0x4fd0f3){_0x4fd0f3=_0x4fd0f3||0xc8;return function(_0x36fcdf){if(_0x36fcdf){return _0x216331['status'](_0x4fd0f3)[_0xc3c1('0xd')](_0x36fcdf);}};}function respondWithFilteredResult(_0xd533d1,_0x1c7381){return function(_0x5d6bee){if(_0x5d6bee){var _0x307943=typeof _0x1c7381[_0xc3c1('0xe')]===_0xc3c1('0xf')&&typeof _0x1c7381[_0xc3c1('0x10')]==='undefined';var _0x13cb66=_0x5d6bee[_0xc3c1('0x11')];var _0x2c59fe=_0x307943?0x0:_0x1c7381[_0xc3c1('0xe')];var _0x277ff8=_0x307943?_0x5d6bee[_0xc3c1('0x11')]:_0x1c7381[_0xc3c1('0xe')]+_0x1c7381[_0xc3c1('0x10')];var _0x3e5259;if(_0x277ff8>=_0x13cb66){_0x277ff8=_0x13cb66;_0x3e5259=0xc8;}else{_0x3e5259=0xce;}_0xd533d1[_0xc3c1('0x12')](_0x3e5259);return _0xd533d1['set'](_0xc3c1('0x13'),_0x2c59fe+'-'+_0x277ff8+'/'+_0x13cb66)[_0xc3c1('0xd')](_0x5d6bee);}return null;};}function saveUpdates(_0x2b99c1){return function(_0x5f4814){if(_0x5f4814){return _0x5f4814[_0xc3c1('0x14')](_0x2b99c1)[_0xc3c1('0x15')](function(_0x4f45c1){return _0x4f45c1;});}return null;};}function removeEntity(_0x14e433){return function(_0x1c5147){if(_0x1c5147){return _0x1c5147[_0xc3c1('0x16')]()[_0xc3c1('0x15')](function(){_0x14e433['status'](0xcc)[_0xc3c1('0x17')]();});}};}function handleEntityNotFound(_0x5b7faf){return function(_0xda8b2c){if(!_0xda8b2c){_0x5b7faf[_0xc3c1('0x18')](0x194);}return _0xda8b2c;};}function handleError(_0x30f19b,_0x3c09a3){_0x3c09a3=_0x3c09a3||0x1f4;return function(_0x195af4){logger['error'](_0x195af4[_0xc3c1('0x19')]);if(_0x195af4[_0xc3c1('0x1a')]){delete _0x195af4[_0xc3c1('0x1a')];}_0x30f19b[_0xc3c1('0x12')](_0x3c09a3)[_0xc3c1('0x1b')](_0x195af4);};}exports[_0xc3c1('0x1c')]=function(_0x12dec3,_0x2c6880){var _0x2ac0a3={},_0x5dfec7={},_0x4f65d2={'count':0x0,'rows':[]};return db[_0xc3c1('0x1d')][_0xc3c1('0x1e')]()[_0xc3c1('0x15')](function(_0x570194){var _0x57274a=[];for(var _0x1ddb02=0x0;_0x1ddb020x1){_0x458526['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x27e769),null);}else{if(qs[_0xc3c1('0x5b')](_0x27e769)){_0x458526['or']('c.id\x20LIKE\x20?',_0x27e769+'%');_0x458526['or'](_0xc3c1('0x5c'),_0x27e769+'%');_0x458526['or'](_0xc3c1('0x5d'),_0x27e769+'%');_0x458526['or'](_0xc3c1('0x5e'),_0x27e769+'%');}else if(qs[_0xc3c1('0x5f')](_0x27e769)){_0x458526['or'](_0xc3c1('0x60'),_0x27e769+'%');}else{_0x458526['or'](_0xc3c1('0x61'),'%'+_0x27e769+'%');_0x458526['or'](_0xc3c1('0x62'),'%'+_0x27e769+'%');_0x458526['or'](_0xc3c1('0x60'),'%'+_0x27e769+'%');}}}}_0xb6a97b[_0xc3c1('0x31')](_0x458526);_0xb6a97b[_0xc3c1('0x63')](_0xc3c1('0x64'));var _0x594442={'type':db[_0xc3c1('0x65')][_0xc3c1('0x66')]['SELECT'],'raw':!![]};var _0x157ed3=_0xb6a97b[_0xc3c1('0x67')]()['field'](_0xc3c1('0x64'));if(_0x2ac0a3['order']){_0x2ac0a3[_0xc3c1('0x2f')]['forEach'](function(_0x1a9097){_0xb6a97b[_0xc3c1('0x2f')]('c.'+_0x1a9097[0x0],_0x1a9097[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc3c1('0x68')](_0x462adb)){_0xb6a97b[_0xc3c1('0x69')](_0x4602c7);_0x157ed3[_0xc3c1('0x31')](_0xc3c1('0x6a'),_0x462adb);}BPromise[_0xc3c1('0x6b')]()['then'](function(){if(!_0x1e496b)return;if(_0x12dec3[_0xc3c1('0x6c')]['role']!=='agent')return;if(!_['some'](_0x1e496b[_0xc3c1('0x40')],[_0xc3c1('0x33'),_0xc3c1('0x48')])){return _0x12dec3[_0xc3c1('0x6c')][_0xc3c1('0x6d')]({'attributes':['id'],'raw':!![]})[_0xc3c1('0x15')](function(_0x58a01e){if(_[_0xc3c1('0x68')](_0x58a01e)){_0x157ed3['where'](_0xc3c1('0x6e'));_0xb6a97b[_0xc3c1('0x31')](_0xc3c1('0x6e'));}else{_0x157ed3[_0xc3c1('0x31')](_0xc3c1('0x54'),_[_0xc3c1('0x45')](_0x58a01e,'id'));_0xb6a97b[_0xc3c1('0x31')](_0xc3c1('0x54'),_['map'](_0x58a01e,'id'));}});}})[_0xc3c1('0x15')](function(){if(_0x12dec3['user']['role']===_0xc3c1('0x6f')&&!_0x1e496b&&!_0x12dec3['query'][_0xc3c1('0x53')])return[];return db['sequelize'][_0xc3c1('0x29')](_0x157ed3[_0xc3c1('0x70')](),_0x594442);})[_0xc3c1('0x15')](function(_0xfb9ef7){_0x4f65d2[_0xc3c1('0x11')]=_0xfb9ef7[_0xc3c1('0x20')];if(_0x4f65d2['count']===0x0)return[];return db[_0xc3c1('0x71')][_0xc3c1('0x29')](_0x356cc1[_0xc3c1('0x70')](),_0x594442)[_0xc3c1('0x15')](function(_0x47bc11){_0x5108d8=_[_0xc3c1('0x72')](_0x47bc11,'id');_0x594442=_[_0xc3c1('0x73')](_0x594442,{'model':db[_0xc3c1('0x1d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12dec3[_0xc3c1('0x29')]['fields']){_0x2ac0a3[_0xc3c1('0x2c')]['forEach'](function(_0x4756cc){_0xb6a97b[_0xc3c1('0x33')]('c.'+_0x4756cc);});}else{_0xb6a97b[_0xc3c1('0x33')](_0xc3c1('0x64'));_0xb6a97b[_0xc3c1('0x33')]('c.firstName');_0xb6a97b[_0xc3c1('0x33')]('c.lastName');_0xb6a97b[_0xc3c1('0x33')](_0xc3c1('0x74'));_0xb6a97b[_0xc3c1('0x33')]('c.mobile');_0xb6a97b['field'](_0xc3c1('0x75'));_0xb6a97b[_0xc3c1('0x33')](_0xc3c1('0x76'));_0xb6a97b[_0xc3c1('0x33')](_0xc3c1('0x77'));_0xb6a97b[_0xc3c1('0x33')](_0xc3c1('0x78'));_0xb6a97b[_0xc3c1('0x33')](_0xc3c1('0x79'));_0xb6a97b[_0xc3c1('0x33')](_0xc3c1('0x7a'));_0xb6a97b[_0xc3c1('0x33')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x2ac0a3[_0xc3c1('0x10')])_0xb6a97b['limit'](_0x2ac0a3[_0xc3c1('0x10')]);if(_0x2ac0a3[_0xc3c1('0xe')])_0xb6a97b['offset'](_0x2ac0a3[_0xc3c1('0xe')]);return db['sequelize']['query'](_0xb6a97b[_0xc3c1('0x70')](),_0x594442);});})[_0xc3c1('0x15')](function(_0x320c4b){_0x320c4b[_0xc3c1('0x46')](function(_0x550a4b){if(_0x550a4b[_0xc3c1('0x7b')]){_0x550a4b[_0xc3c1('0x7c')]=[];_0x550a4b['TagIds'][_0xc3c1('0x44')](',')[_0xc3c1('0x46')](function(_0x5d8666){_0x550a4b[_0xc3c1('0x7c')]['push'](_0x5108d8[_0x5d8666]);});}delete _0x550a4b[_0xc3c1('0x7b')];});_0x4f65d2[_0xc3c1('0x7d')]=_0x320c4b;return _0x4f65d2;})[_0xc3c1('0x15')](respondWithFilteredResult(_0x2c6880,_0x2ac0a3));})['catch'](handleError(_0x2c6880,null));};exports[_0xc3c1('0x16')]=function(_0x2f9d85,_0x1dfd6c){return db[_0xc3c1('0x1d')]['find']({'where':{'id':_0x2f9d85['params']['id']}})['then'](handleEntityNotFound(_0x1dfd6c,null))['then'](removeEntity(_0x1dfd6c,null))['catch'](handleError(_0x1dfd6c,null));};exports['describe']=function(_0x51b2c2,_0x577021){return db[_0xc3c1('0x1d')]['describe']()[_0xc3c1('0x15')](function(_0x41f0b6){delete _0x41f0b6[_0xc3c1('0x7e')];for(var _0x604440=0x0;_0x604440=_0x824a68){_0x43f71f=_0x824a68;_0x3b4283=0xc8;}else{_0x3b4283=0xce;}_0x158ece[_0xe43f('0x11')](_0x3b4283);return _0x158ece['set'](_0xe43f('0x17'),_0x45f5db+'-'+_0x43f71f+'/'+_0x824a68)[_0xe43f('0x12')](_0x3ec1e5);}return null;};}function saveUpdates(_0x9be2fe){return function(_0x442189){if(_0x442189){return _0x442189[_0xe43f('0x18')](_0x9be2fe)['then'](function(_0x217d74){return _0x217d74;});}return null;};}function removeEntity(_0x396c99){return function(_0x1d0f6b){if(_0x1d0f6b){return _0x1d0f6b[_0xe43f('0x19')]()[_0xe43f('0x1a')](function(){_0x396c99['status'](0xcc)[_0xe43f('0x1b')]();});}};}function handleEntityNotFound(_0x2cba66){return function(_0x4d3a5b){if(!_0x4d3a5b){_0x2cba66[_0xe43f('0x1c')](0x194);}return _0x4d3a5b;};}function handleError(_0x398f28,_0x5d1a9b){_0x5d1a9b=_0x5d1a9b||0x1f4;return function(_0x3a7678){logger[_0xe43f('0x1d')](_0x3a7678['stack']);if(_0x3a7678[_0xe43f('0x1e')]){delete _0x3a7678[_0xe43f('0x1e')];}_0x398f28[_0xe43f('0x11')](_0x5d1a9b)[_0xe43f('0x1f')](_0x3a7678);};}exports[_0xe43f('0x20')]=function(_0x500930,_0x1bd1cf){var _0x44e14a={},_0x29b914={},_0x1851cd={'count':0x0,'rows':[]};return db[_0xe43f('0x21')]['describe']()[_0xe43f('0x1a')](function(_0x526a89){var _0x4f15de=[];for(var _0x128415=0x0;_0x1284150x1){_0xc9eb74['or'](_0xe43f('0x63'),qs[_0xe43f('0x64')](_0x27b1c9),null);}else{if(qs[_0xe43f('0x65')](_0x27b1c9)){_0xc9eb74['or'](_0xe43f('0x66'),_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x67'),_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x68'),_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x69'),_0x27b1c9+'%');}else if(qs[_0xe43f('0x6a')](_0x27b1c9)){_0xc9eb74['or'](_0xe43f('0x6b'),_0x27b1c9+'%');}else{_0xc9eb74['or']('c.firstName\x20LIKE\x20?','%'+_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x6c'),'%'+_0x27b1c9+'%');_0xc9eb74['or'](_0xe43f('0x6b'),'%'+_0x27b1c9+'%');}}}}_0x5f441f[_0xe43f('0x36')](_0xc9eb74);_0x5f441f[_0xe43f('0x6d')](_0xe43f('0x6e'));var _0x5cbcd6={'type':db['Sequelize'][_0xe43f('0x6f')]['SELECT'],'raw':!![]};var _0xc4612d=_0x5f441f[_0xe43f('0x70')]()[_0xe43f('0x38')](_0xe43f('0x6e'));if(_0x44e14a[_0xe43f('0x34')]){_0x44e14a[_0xe43f('0x34')][_0xe43f('0x4c')](function(_0x9390c1){_0x5f441f[_0xe43f('0x34')]('c.'+_0x9390c1[0x0],_0x9390c1[0x1]===_0xe43f('0x71')?![]:!![]);});}if(!_[_0xe43f('0x5b')](_0x58381d)){_0x5f441f[_0xe43f('0x72')](_0x1707de);_0xc4612d[_0xe43f('0x36')](_0xe43f('0x73'),_0x58381d);}BPromise[_0xe43f('0x74')]()['then'](function(){if(!_0x583bda)return;if(_0x500930['user'][_0xe43f('0x75')]!==_0xe43f('0x76'))return;if(!_[_0xe43f('0x77')](_0x583bda['conditions'],[_0xe43f('0x38'),_0xe43f('0x4e')])){return _0x500930['user']['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x18cef4){if(_['isEmpty'](_0x18cef4)){_0xc4612d[_0xe43f('0x36')]('c.ListId\x20IS\x20NULL');_0x5f441f[_0xe43f('0x36')](_0xe43f('0x78'));}else{_0xc4612d[_0xe43f('0x36')]('c.ListId\x20IN\x20?',_[_0xe43f('0x57')](_0x18cef4,'id'));_0x5f441f['where']('c.ListId\x20IN\x20?',_[_0xe43f('0x57')](_0x18cef4,'id'));}});}})['then'](function(){if(_0x500930['user'][_0xe43f('0x75')]==='agent'&&!_0x583bda&&!_0x500930['query'][_0xe43f('0x5c')])return[];return db['sequelize'][_0xe43f('0x2d')](_0xc4612d['toString'](),_0x5cbcd6);})[_0xe43f('0x1a')](function(_0x120880){_0x1851cd['count']=_0x120880[_0xe43f('0x23')];if(_0x1851cd[_0xe43f('0x15')]===0x0)return[];return db['sequelize']['query'](_0xd97e93[_0xe43f('0x79')](),_0x5cbcd6)[_0xe43f('0x1a')](function(_0x25521c){_0xbd3f12=_[_0xe43f('0x7a')](_0x25521c,'id');_0x5cbcd6=_[_0xe43f('0x7b')](_0x5cbcd6,{'model':db[_0xe43f('0x21')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x500930[_0xe43f('0x2d')][_0xe43f('0x31')]){_0x44e14a[_0xe43f('0x30')][_0xe43f('0x4c')](function(_0x1f0987){_0x5f441f['field']('c.'+_0x1f0987);});}else{_0x5f441f[_0xe43f('0x38')](_0xe43f('0x6e'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7c'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7d'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7e'));_0x5f441f[_0xe43f('0x38')]('c.mobile');_0x5f441f[_0xe43f('0x38')]('c.fax');_0x5f441f[_0xe43f('0x38')]('c.email');_0x5f441f[_0xe43f('0x38')](_0xe43f('0x7f'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x80'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x81'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x82'));_0x5f441f[_0xe43f('0x38')](_0xe43f('0x83'),_0xe43f('0x84'));}if(_0x44e14a[_0xe43f('0x14')])_0x5f441f[_0xe43f('0x14')](_0x44e14a[_0xe43f('0x14')]);if(_0x44e14a[_0xe43f('0x16')])_0x5f441f[_0xe43f('0x16')](_0x44e14a[_0xe43f('0x16')]);return db[_0xe43f('0x85')][_0xe43f('0x2d')](_0x5f441f[_0xe43f('0x79')](),_0x5cbcd6);});})[_0xe43f('0x1a')](function(_0x46b68a){_0x46b68a[_0xe43f('0x4c')](function(_0x52a357){if(_0x52a357[_0xe43f('0x84')]){_0x52a357[_0xe43f('0x86')]=[];_0x52a357[_0xe43f('0x84')]['split'](',')[_0xe43f('0x4c')](function(_0x3a7dd2){_0x52a357[_0xe43f('0x86')][_0xe43f('0x26')](_0xbd3f12[_0x3a7dd2]);});}delete _0x52a357['TagIds'];});_0x1851cd[_0xe43f('0x87')]=_0x46b68a;return _0x1851cd;})[_0xe43f('0x1a')](respondWithFilteredResult(_0x1bd1cf,_0x44e14a));})[_0xe43f('0x88')](handleError(_0x1bd1cf,null));};exports[_0xe43f('0x19')]=function(_0xf9b6b1,_0x1a8925){return db[_0xe43f('0x21')][_0xe43f('0x48')]({'where':{'id':_0xf9b6b1[_0xe43f('0x89')]['id']}})[_0xe43f('0x1a')](handleEntityNotFound(_0x1a8925,null))[_0xe43f('0x1a')](removeEntity(_0x1a8925,null))[_0xe43f('0x88')](handleError(_0x1a8925,null));};exports['describe']=function(_0xbed09d,_0x2c9b0b){return db['CmContact']['describe']()['then'](function(_0x5c29ce){delete _0x5c29ce['tags'];for(var _0x5709f5=0x0;_0x5709f5{}\s\\|]/g,'-');_0x7d1ce0(null,util['format'](_0x9052('0x27'),path[_0x9052('0x28')](_0x411135[_0x9052('0x25')],path[_0x9052('0x29')](_0x411135[_0x9052('0x25')])),Date[_0x9052('0x2a')](),path[_0x9052('0x29')](_0x411135[_0x9052('0x25')])));}})});router[_0x9052('0x1b')](_0x9052('0x2b'),upload['single'](_0x9052('0x2c')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x9052('0x21')]({'destination':function(_0x526814,_0x1f1c32,_0x106037){_0x106037(null,path[_0x9052('0x22')](config[_0x9052('0x23')],_0x9052('0x24')));},'filename':function(_0xc3b4ad,_0x59fbc2,_0x568d06){_0x59fbc2[_0x9052('0x25')]=_0x59fbc2[_0x9052('0x25')][_0x9052('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x568d06(null,util[_0x9052('0x2d')](_0x9052('0x27'),path[_0x9052('0x28')](_0x59fbc2[_0x9052('0x25')],path[_0x9052('0x29')](_0x59fbc2[_0x9052('0x25')])),Date[_0x9052('0x2a')](),path[_0x9052('0x29')](_0x59fbc2['originalname'])));}})});router[_0x9052('0x1b')]('/upload',upload[_0x9052('0x2e')]('file'),controller[_0x9052('0x2f')]);router[_0x9052('0x1b')](_0x9052('0x30'),auth[_0x9052('0xb')](),controller[_0x9052('0x31')]);router['put'](_0x9052('0xd'),auth['isAuthenticated'](),controller[_0x9052('0x32')]);router[_0x9052('0x33')](_0x9052('0xd'),auth[_0x9052('0xb')](),controller['destroy']);module[_0x9052('0x34')]=router; \ No newline at end of file +var _0xc3db=['file','uploadCsv','root','server/files/tmp','now','/upload','upload','/upload/:id','import','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','/merge','merge','post','create','/create_many','bulkCreate','setTags','diskStorage','join','originalname','replace','%s-%s%s','basename','extname','single'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc3db,0x121));var _0xbc3d=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xc3db[_0x43fdf8];return _0x1160c6;};'use strict';var multer=require(_0xbc3d('0x0'));var util=require(_0xbc3d('0x1'));var path=require(_0xbc3d('0x2'));var timeout=require(_0xbc3d('0x3'));var express=require(_0xbc3d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbc3d('0x5'));var interaction=require(_0xbc3d('0x6'));var config=require(_0xbc3d('0x7'));var controller=require(_0xbc3d('0x8'));router['get']('/',auth[_0xbc3d('0x9')](),controller[_0xbc3d('0xa')]);router[_0xbc3d('0xb')](_0xbc3d('0xc'),auth[_0xbc3d('0x9')](),controller['describe']);router['get'](_0xbc3d('0xd'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0xe')]);router[_0xbc3d('0xb')](_0xbc3d('0xf'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x10')]);router['get'](_0xbc3d('0x11'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x12')]);router[_0xbc3d('0xb')](_0xbc3d('0x13'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x14')]);router['get'](_0xbc3d('0x15'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x16')]);router[_0xbc3d('0xb')](_0xbc3d('0x17'),auth[_0xbc3d('0x9')](),controller['getJscriptySessions']);router[_0xbc3d('0xb')](_0xbc3d('0x18'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x19')]);router['post'](_0xbc3d('0x1a'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x1b')]);router[_0xbc3d('0x1c')]('/',auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x1d')]);router[_0xbc3d('0x1c')](_0xbc3d('0x1e'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x1f')]);router[_0xbc3d('0x1c')]('/:id/tags',auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x20')]);var upload=multer({'storage':multer[_0xbc3d('0x21')]({'destination':function(_0x253841,_0x563b18,_0xd0a15b){_0xd0a15b(null,path[_0xbc3d('0x22')](config['root'],'server/files/tmp'));},'filename':function(_0x41492f,_0x46ff71,_0xc4cbc6){_0x46ff71[_0xbc3d('0x23')]=_0x46ff71[_0xbc3d('0x23')][_0xbc3d('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xc4cbc6(null,util['format'](_0xbc3d('0x25'),path[_0xbc3d('0x26')](_0x46ff71[_0xbc3d('0x23')],path['extname'](_0x46ff71[_0xbc3d('0x23')])),Date['now'](),path[_0xbc3d('0x27')](_0x46ff71[_0xbc3d('0x23')])));}})});router['post']('/csv',upload[_0xbc3d('0x28')](_0xbc3d('0x29')),controller[_0xbc3d('0x2a')]);var upload=multer({'storage':multer[_0xbc3d('0x21')]({'destination':function(_0x2295ec,_0x485c19,_0x29d353){_0x29d353(null,path[_0xbc3d('0x22')](config[_0xbc3d('0x2b')],_0xbc3d('0x2c')));},'filename':function(_0x3ce172,_0x3399c0,_0x41e011){_0x3399c0[_0xbc3d('0x23')]=_0x3399c0[_0xbc3d('0x23')][_0xbc3d('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41e011(null,util['format']('%s-%s%s',path[_0xbc3d('0x26')](_0x3399c0['originalname'],path[_0xbc3d('0x27')](_0x3399c0[_0xbc3d('0x23')])),Date[_0xbc3d('0x2d')](),path['extname'](_0x3399c0[_0xbc3d('0x23')])));}})});router[_0xbc3d('0x1c')](_0xbc3d('0x2e'),upload[_0xbc3d('0x28')](_0xbc3d('0x29')),controller[_0xbc3d('0x2f')]);router['post'](_0xbc3d('0x30'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x31')]);router[_0xbc3d('0x32')]('/:id',auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x33')]);router[_0xbc3d('0x34')](_0xbc3d('0xd'),auth[_0xbc3d('0x9')](),controller[_0xbc3d('0x35')]);module[_0xbc3d('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3edb377..a3de83c 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 _0x5ff0=['VIRTUAL','setDataValue','alias','getDataValue','name','STRING','TEXT','long','select','parse','values','isArray','stringify','BOOLEAN','sequelize','exports'];(function(_0x5af863,_0x5b457d){var _0x1cff52=function(_0x4be65c){while(--_0x4be65c){_0x5af863['push'](_0x5af863['shift']());}};_0x1cff52(++_0x5b457d);}(_0x5ff0,0x12e));var _0x05ff=function(_0x3a61f1,_0x3cb96d){_0x3a61f1=_0x3a61f1-0x0;var _0x2d1931=_0x5ff0[_0x3a61f1];return _0x2d1931;};'use strict';var Sequelize=require(_0x05ff('0x0'));var _=require('lodash');module[_0x05ff('0x1')]={'name':{'type':Sequelize[_0x05ff('0x2')],'get':function(_0x5485de){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3499d1){this[_0x05ff('0x3')](_0x05ff('0x4'),_0x3499d1?_0x3499d1:this[_0x05ff('0x5')](_0x05ff('0x6')));}},'type':{'type':Sequelize[_0x05ff('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x05ff('0x8')](_0x05ff('0x9')),'get':function(){if(this[_0x05ff('0x5')]('type')===_0x05ff('0xa')){return JSON[_0x05ff('0xb')](this[_0x05ff('0x5')](_0x05ff('0xc')));}else{return this[_0x05ff('0x5')](_0x05ff('0xc'));}},'set':function(_0x398a30){if(Array[_0x05ff('0xd')](_0x398a30)){this['setDataValue']('values',JSON[_0x05ff('0xe')](_0x398a30));}else{this[_0x05ff('0x3')](_0x05ff('0xc'),_0x398a30);}}},'required':{'type':Sequelize[_0x05ff('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x6242=['lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type','select','parse','values','isArray','stringify','ENUM','voice'];(function(_0x585234,_0x3ae470){var _0x28b8a7=function(_0x9081e1){while(--_0x9081e1){_0x585234['push'](_0x585234['shift']());}};_0x28b8a7(++_0x3ae470);}(_0x6242,0xff));var _0x2624=function(_0x213e8a,_0x13e070){_0x213e8a=_0x213e8a-0x0;var _0x1316b1=_0x6242[_0x213e8a];return _0x1316b1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2624('0x0'));module[_0x2624('0x1')]={'name':{'type':Sequelize[_0x2624('0x2')],'get':function(_0x278ad7){return this[_0x2624('0x3')](_0x2624('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x349f3e){this[_0x2624('0x5')](_0x2624('0x4'),_0x349f3e?_0x349f3e:this[_0x2624('0x3')](_0x2624('0x6')));}},'type':{'type':Sequelize[_0x2624('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x2624('0x8')]('long'),'get':function(){if(this[_0x2624('0x3')](_0x2624('0x9'))===_0x2624('0xa')){return JSON[_0x2624('0xb')](this[_0x2624('0x3')](_0x2624('0xc')));}else{return this[_0x2624('0x3')](_0x2624('0xc'));}},'set':function(_0x5a83e2){if(Array[_0x2624('0xd')](_0x5a83e2)){this['setDataValue']('values',JSON[_0x2624('0xe')](_0x5a83e2));}else{this[_0x2624('0x5')](_0x2624('0xc'),_0x5a83e2);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2624('0xf')](_0x2624('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4ed7e2a..cf4c441 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 _0x0cd3=['fieldName','type','key','model','differenceBy','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','CmCustomField','rows','catch','show','params','length','find','update','body','create','Sequelize','TEXT','text','number','INTEGER','switch','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','stack','name','send','index','rawAttributes'];(function(_0x6aa8f3,_0x15216e){var _0x33f9c2=function(_0x577dac){while(--_0x577dac){_0x6aa8f3['push'](_0x6aa8f3['shift']());}};_0x33f9c2(++_0x15216e);}(_0x0cd3,0x83));var _0x30cd=function(_0x4f658d,_0x3243dc){_0x4f658d=_0x4f658d-0x0;var _0x165924=_0x0cd3[_0x4f658d];return _0x165924;};'use strict';var emlformat=require(_0x30cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30cd('0x1'));var jsonpatch=require(_0x30cd('0x2'));var rp=require(_0x30cd('0x3'));var moment=require(_0x30cd('0x4'));var BPromise=require(_0x30cd('0x5'));var Mustache=require('mustache');var util=require(_0x30cd('0x6'));var path=require(_0x30cd('0x7'));var sox=require(_0x30cd('0x8'));var csv=require('to-csv');var ejs=require(_0x30cd('0x9'));var fs=require('fs');var fs_extra=require(_0x30cd('0xa'));var _=require(_0x30cd('0xb'));var squel=require(_0x30cd('0xc'));var crypto=require('crypto');var jsforce=require(_0x30cd('0xd'));var deskjs=require(_0x30cd('0xe'));var toCsv=require(_0x30cd('0xf'));var querystring=require(_0x30cd('0x10'));var Papa=require(_0x30cd('0x11'));var Redis=require(_0x30cd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x30cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x30cd('0x14'));var config=require(_0x30cd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x30cd('0x16'))['db'];function respondWithStatusCode(_0x8d9bcc,_0x5a0fac){_0x5a0fac=_0x5a0fac||0xcc;return function(_0xbac953){if(_0xbac953){return _0x8d9bcc[_0x30cd('0x17')](_0x5a0fac);}return _0x8d9bcc[_0x30cd('0x18')](_0x5a0fac)[_0x30cd('0x19')]();};}function respondWithResult(_0x556e23,_0x6a900){_0x6a900=_0x6a900||0xc8;return function(_0x56aebc){if(_0x56aebc){return _0x556e23['status'](_0x6a900)[_0x30cd('0x1a')](_0x56aebc);}};}function respondWithFilteredResult(_0x392ce9,_0xec6c7b){return function(_0x29fb40){if(_0x29fb40){var _0x474c9a=typeof _0xec6c7b[_0x30cd('0x1b')]===_0x30cd('0x1c')&&typeof _0xec6c7b[_0x30cd('0x1d')]==='undefined';var _0x298d3a=_0x29fb40['count'];var _0x3bc299=_0x474c9a?0x0:_0xec6c7b[_0x30cd('0x1b')];var _0x521f8e=_0x474c9a?_0x29fb40[_0x30cd('0x1e')]:_0xec6c7b['offset']+_0xec6c7b[_0x30cd('0x1d')];var _0x14648a;if(_0x521f8e>=_0x298d3a){_0x521f8e=_0x298d3a;_0x14648a=0xc8;}else{_0x14648a=0xce;}_0x392ce9['status'](_0x14648a);return _0x392ce9[_0x30cd('0x1f')](_0x30cd('0x20'),_0x3bc299+'-'+_0x521f8e+'/'+_0x298d3a)[_0x30cd('0x1a')](_0x29fb40);}return null;};}function patchUpdates(_0x2cf978){return function(_0x13eafa){try{jsonpatch[_0x30cd('0x21')](_0x13eafa,_0x2cf978,!![]);}catch(_0x5d909e){return BPromise['reject'](_0x5d909e);}return _0x13eafa['save']();};}function saveUpdates(_0x595713,_0x2b1ec9){return function(_0x476df0){if(_0x476df0){return _0x476df0['update'](_0x595713)[_0x30cd('0x22')](function(_0x49693b){return _0x49693b;});}return null;};}function removeEntity(_0x1656d4,_0x122b0f){return function(_0x5406c8){if(_0x5406c8){return _0x5406c8[_0x30cd('0x23')]()[_0x30cd('0x22')](function(){_0x1656d4[_0x30cd('0x18')](0xcc)[_0x30cd('0x19')]();});}};}function handleEntityNotFound(_0x4d0db0,_0x2996e8){return function(_0x53c0e4){if(!_0x53c0e4){_0x4d0db0[_0x30cd('0x17')](0x194);}return _0x53c0e4;};}function handleError(_0x5ecd8a,_0x32692a){_0x32692a=_0x32692a||0x1f4;return function(_0x1fab4d){logger['error'](_0x1fab4d[_0x30cd('0x24')]);if(_0x1fab4d[_0x30cd('0x25')]){delete _0x1fab4d[_0x30cd('0x25')];}_0x5ecd8a[_0x30cd('0x18')](_0x32692a)[_0x30cd('0x26')](_0x1fab4d);};}exports[_0x30cd('0x27')]=function(_0xb11409,_0x257c6c){var _0x35ecac={},_0x33d85d={},_0x59414c={'count':0x0,'rows':[]};var _0x279859=_['map'](db['CmCustomField'][_0x30cd('0x28')],function(_0xf5365){return{'name':_0xf5365[_0x30cd('0x29')],'type':_0xf5365[_0x30cd('0x2a')][_0x30cd('0x2b')]};});_0x33d85d[_0x30cd('0x2c')]=_[_0x30cd('0x2d')](_[_0x30cd('0x2e')](_0x279859,_0x30cd('0x25')),[_0x30cd('0x25')]);_0x33d85d[_0x30cd('0x2f')]=_[_0x30cd('0x30')](_0xb11409[_0x30cd('0x2f')]);_0x33d85d['filters']=_[_0x30cd('0x31')](_0x33d85d['model'],_0x33d85d[_0x30cd('0x2f')]);_0x35ecac[_0x30cd('0x32')]=_[_0x30cd('0x31')](_0x33d85d[_0x30cd('0x2c')],qs[_0x30cd('0x33')](_0xb11409[_0x30cd('0x2f')][_0x30cd('0x33')]));_0x35ecac[_0x30cd('0x32')]=_0x35ecac[_0x30cd('0x32')]['length']?_0x35ecac['attributes']:_0x33d85d[_0x30cd('0x2c')];if(!_0xb11409[_0x30cd('0x2f')][_0x30cd('0x34')](_0x30cd('0x35'))){_0x35ecac[_0x30cd('0x1d')]=qs[_0x30cd('0x1d')](_0xb11409[_0x30cd('0x2f')]['limit']);_0x35ecac[_0x30cd('0x1b')]=qs[_0x30cd('0x1b')](_0xb11409[_0x30cd('0x2f')][_0x30cd('0x1b')]);}_0x35ecac[_0x30cd('0x36')]=qs[_0x30cd('0x37')](_0xb11409[_0x30cd('0x2f')]['sort']);_0x35ecac[_0x30cd('0x38')]=qs[_0x30cd('0x39')](_['pick'](_0xb11409[_0x30cd('0x2f')],_0x33d85d[_0x30cd('0x39')]),_0x279859);if(_0xb11409[_0x30cd('0x2f')][_0x30cd('0x3a')]){_0x35ecac[_0x30cd('0x38')]=_[_0x30cd('0x3b')](_0x35ecac[_0x30cd('0x38')],{'$or':_['map'](_0x279859,function(_0x4583fb){if(_0x4583fb[_0x30cd('0x2a')]!==_0x30cd('0x3c')){var _0x579b5d={};_0x579b5d[_0x4583fb[_0x30cd('0x25')]]={'$like':'%'+_0xb11409[_0x30cd('0x2f')][_0x30cd('0x3a')]+'%'};return _0x579b5d;}})});}_0x35ecac=_['merge']({},_0x35ecac,_0xb11409[_0x30cd('0x3d')]);var _0x37b3c0={'where':_0x35ecac['where']};return db['CmCustomField'][_0x30cd('0x1e')](_0x37b3c0)[_0x30cd('0x22')](function(_0xe4010a){_0x59414c[_0x30cd('0x1e')]=_0xe4010a;if(_0xb11409['query'][_0x30cd('0x3e')]){_0x35ecac[_0x30cd('0x3f')]=[{'all':!![]}];}return db[_0x30cd('0x40')]['findAll'](_0x35ecac);})[_0x30cd('0x22')](function(_0x2d4423){_0x59414c[_0x30cd('0x41')]=_0x2d4423;return _0x59414c;})['then'](respondWithFilteredResult(_0x257c6c,_0x35ecac))[_0x30cd('0x42')](handleError(_0x257c6c,null));};exports[_0x30cd('0x43')]=function(_0x306c24,_0x520513){var _0x51f6cf={'raw':!![],'where':{'id':_0x306c24[_0x30cd('0x44')]['id']}},_0x31465a={};_0x31465a[_0x30cd('0x2c')]=_[_0x30cd('0x30')](db[_0x30cd('0x40')][_0x30cd('0x28')]);_0x31465a[_0x30cd('0x2f')]=_[_0x30cd('0x30')](_0x306c24['query']);_0x31465a[_0x30cd('0x39')]=_[_0x30cd('0x31')](_0x31465a['model'],_0x31465a[_0x30cd('0x2f')]);_0x51f6cf[_0x30cd('0x32')]=_[_0x30cd('0x31')](_0x31465a[_0x30cd('0x2c')],qs[_0x30cd('0x33')](_0x306c24[_0x30cd('0x2f')][_0x30cd('0x33')]));_0x51f6cf[_0x30cd('0x32')]=_0x51f6cf['attributes'][_0x30cd('0x45')]?_0x51f6cf[_0x30cd('0x32')]:_0x31465a[_0x30cd('0x2c')];if(_0x306c24[_0x30cd('0x2f')][_0x30cd('0x3e')]){_0x51f6cf['include']=[{'all':!![]}];}_0x51f6cf=_[_0x30cd('0x3b')]({},_0x51f6cf,_0x306c24['options']);return db[_0x30cd('0x40')][_0x30cd('0x46')](_0x51f6cf)['then'](handleEntityNotFound(_0x520513,null))[_0x30cd('0x22')](respondWithResult(_0x520513,null))[_0x30cd('0x42')](handleError(_0x520513,null));};exports[_0x30cd('0x47')]=function(_0x1b358d,_0x7bcc52){if(_0x1b358d[_0x30cd('0x48')]['id']){delete _0x1b358d[_0x30cd('0x48')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x1b358d['params']['id']}})[_0x30cd('0x22')](handleEntityNotFound(_0x7bcc52,null))[_0x30cd('0x22')](saveUpdates(_0x1b358d[_0x30cd('0x48')],null))[_0x30cd('0x22')](respondWithResult(_0x7bcc52,null))[_0x30cd('0x42')](handleError(_0x7bcc52,null));};exports[_0x30cd('0x23')]=function(_0x3bbe4b,_0x4133ee){return db['CmCustomField']['find']({'where':{'id':_0x3bbe4b['params']['id']}})[_0x30cd('0x22')](handleEntityNotFound(_0x4133ee,null))[_0x30cd('0x22')](removeEntity(_0x4133ee,null))[_0x30cd('0x42')](handleError(_0x4133ee,null));};exports[_0x30cd('0x49')]=function(_0x4273a7,_0x8ae1d7){var _0x12ef98;return db['sequelize']['transaction'](function(_0x1e1dfe){return db['CmCustomField'][_0x30cd('0x49')](_0x4273a7['body'],{'transaction':_0x1e1dfe})[_0x30cd('0x22')](function(_0x4d0d2d){_0x12ef98=_0x4d0d2d;var _0x1e6b06={'type':db[_0x30cd('0x4a')][_0x30cd('0x4b')],'transaction':_0x1e1dfe};switch(_0x4273a7[_0x30cd('0x48')][_0x30cd('0x2a')]){case _0x30cd('0x4c'):_0x1e6b06[_0x30cd('0x2a')]=db[_0x30cd('0x4a')]['TEXT'];break;case _0x30cd('0x4d'):_0x1e6b06[_0x30cd('0x2a')]=db['Sequelize'][_0x30cd('0x4e')];break;case _0x30cd('0x4f'):_0x1e6b06[_0x30cd('0x2a')]=db[_0x30cd('0x4a')]['BOOLEAN'];_0x1e6b06['defaultValue']=![];break;default:}return db[_0x30cd('0x50')][_0x30cd('0x51')][_0x30cd('0x52')](_0x30cd('0x53'),util[_0x30cd('0x54')](_0x30cd('0x55'),_0x12ef98['id']),_0x1e6b06);})[_0x30cd('0x22')](function(){return _0x12ef98;});})[_0x30cd('0x22')](respondWithResult(_0x8ae1d7,0xc9))[_0x30cd('0x42')](handleError(_0x8ae1d7,null));}; \ No newline at end of file +var _0x8d8a=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','reject','save','update','then','status','end','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','params','options','find','body','destroy','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis'];(function(_0x5990d1,_0xdebf08){var _0x263b56=function(_0x3bef28){while(--_0x3bef28){_0x5990d1['push'](_0x5990d1['shift']());}};_0x263b56(++_0xdebf08);}(_0x8d8a,0x18f));var _0xa8d8=function(_0x4d333a,_0x3622b1){_0x4d333a=_0x4d333a-0x0;var _0x8b49c5=_0x8d8a[_0x4d333a];return _0x8b49c5;};'use strict';var emlformat=require(_0xa8d8('0x0'));var rimraf=require(_0xa8d8('0x1'));var zipdir=require(_0xa8d8('0x2'));var jsonpatch=require(_0xa8d8('0x3'));var rp=require('request-promise');var moment=require(_0xa8d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d8('0x5'));var util=require(_0xa8d8('0x6'));var path=require(_0xa8d8('0x7'));var sox=require(_0xa8d8('0x8'));var csv=require(_0xa8d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8d8('0xa'));var _=require(_0xa8d8('0xb'));var squel=require(_0xa8d8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8d8('0xd'));var toCsv=require(_0xa8d8('0x9'));var querystring=require('querystring');var Papa=require(_0xa8d8('0xe'));var Redis=require(_0xa8d8('0xf'));var authService=require(_0xa8d8('0x10'));var qs=require(_0xa8d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8d8('0x12'));var logger=require(_0xa8d8('0x13'))(_0xa8d8('0x14'));var utils=require(_0xa8d8('0x15'));var config=require(_0xa8d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8d8('0x17'))['db'];function respondWithStatusCode(_0x544d6f,_0x418b12){_0x418b12=_0x418b12||0xcc;return function(_0x5ab2f3){if(_0x5ab2f3){return _0x544d6f[_0xa8d8('0x18')](_0x418b12);}return _0x544d6f['status'](_0x418b12)['end']();};}function respondWithResult(_0x1366b4,_0x13045b){_0x13045b=_0x13045b||0xc8;return function(_0x389268){if(_0x389268){return _0x1366b4['status'](_0x13045b)[_0xa8d8('0x19')](_0x389268);}};}function respondWithFilteredResult(_0x25f5c6,_0x3a94ce){return function(_0x12b847){if(_0x12b847){var _0x2d78c8=typeof _0x3a94ce[_0xa8d8('0x1a')]===_0xa8d8('0x1b')&&typeof _0x3a94ce[_0xa8d8('0x1c')]===_0xa8d8('0x1b');var _0x35ed21=_0x12b847[_0xa8d8('0x1d')];var _0x1f2292=_0x2d78c8?0x0:_0x3a94ce['offset'];var _0x41f2a4=_0x2d78c8?_0x12b847['count']:_0x3a94ce['offset']+_0x3a94ce[_0xa8d8('0x1c')];var _0x20a270;if(_0x41f2a4>=_0x35ed21){_0x41f2a4=_0x35ed21;_0x20a270=0xc8;}else{_0x20a270=0xce;}_0x25f5c6['status'](_0x20a270);return _0x25f5c6[_0xa8d8('0x1e')]('Content-Range',_0x1f2292+'-'+_0x41f2a4+'/'+_0x35ed21)[_0xa8d8('0x19')](_0x12b847);}return null;};}function patchUpdates(_0x5e3edf){return function(_0x51a616){try{jsonpatch['apply'](_0x51a616,_0x5e3edf,!![]);}catch(_0xe58c34){return BPromise[_0xa8d8('0x1f')](_0xe58c34);}return _0x51a616[_0xa8d8('0x20')]();};}function saveUpdates(_0x3a851f,_0x4a7022){return function(_0x1148f9){if(_0x1148f9){return _0x1148f9[_0xa8d8('0x21')](_0x3a851f)['then'](function(_0x395aa8){return _0x395aa8;});}return null;};}function removeEntity(_0x26a03c,_0x4d2400){return function(_0x24f06c){if(_0x24f06c){return _0x24f06c['destroy']()[_0xa8d8('0x22')](function(){_0x26a03c[_0xa8d8('0x23')](0xcc)[_0xa8d8('0x24')]();});}};}function handleEntityNotFound(_0x4bbbbc,_0x110213){return function(_0x2dd805){if(!_0x2dd805){_0x4bbbbc[_0xa8d8('0x18')](0x194);}return _0x2dd805;};}function handleError(_0x5d7d45,_0x3bd6b5){_0x3bd6b5=_0x3bd6b5||0x1f4;return function(_0xaa4fbc){logger['error'](_0xaa4fbc[_0xa8d8('0x25')]);if(_0xaa4fbc[_0xa8d8('0x26')]){delete _0xaa4fbc['name'];}_0x5d7d45[_0xa8d8('0x23')](_0x3bd6b5)['send'](_0xaa4fbc);};}exports[_0xa8d8('0x27')]=function(_0x551e8e,_0x378466){var _0x31b300={},_0xfb5ba4={},_0x40e5b2={'count':0x0,'rows':[]};var _0x4834d5=_[_0xa8d8('0x28')](db[_0xa8d8('0x29')][_0xa8d8('0x2a')],function(_0x4aa4b3){return{'name':_0x4aa4b3[_0xa8d8('0x2b')],'type':_0x4aa4b3[_0xa8d8('0x2c')][_0xa8d8('0x2d')]};});_0xfb5ba4[_0xa8d8('0x2e')]=_[_0xa8d8('0x2f')](_[_0xa8d8('0x28')](_0x4834d5,_0xa8d8('0x26')),[_0xa8d8('0x26')]);_0xfb5ba4[_0xa8d8('0x30')]=_[_0xa8d8('0x31')](_0x551e8e['query']);_0xfb5ba4[_0xa8d8('0x32')]=_[_0xa8d8('0x33')](_0xfb5ba4[_0xa8d8('0x2e')],_0xfb5ba4['query']);_0x31b300[_0xa8d8('0x34')]=_['intersection'](_0xfb5ba4[_0xa8d8('0x2e')],qs[_0xa8d8('0x35')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x35')]));_0x31b300[_0xa8d8('0x34')]=_0x31b300[_0xa8d8('0x34')][_0xa8d8('0x36')]?_0x31b300['attributes']:_0xfb5ba4[_0xa8d8('0x2e')];if(!_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x37')](_0xa8d8('0x38'))){_0x31b300[_0xa8d8('0x1c')]=qs[_0xa8d8('0x1c')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x1c')]);_0x31b300[_0xa8d8('0x1a')]=qs[_0xa8d8('0x1a')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x1a')]);}_0x31b300[_0xa8d8('0x39')]=qs[_0xa8d8('0x3a')](_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x3a')]);_0x31b300['where']=qs['filters'](_[_0xa8d8('0x3b')](_0x551e8e[_0xa8d8('0x30')],_0xfb5ba4[_0xa8d8('0x32')]),_0x4834d5);if(_0x551e8e['query'][_0xa8d8('0x3c')]){_0x31b300[_0xa8d8('0x3d')]=_[_0xa8d8('0x3e')](_0x31b300[_0xa8d8('0x3d')],{'$or':_['map'](_0x4834d5,function(_0x1360ae){if(_0x1360ae[_0xa8d8('0x2c')]!=='VIRTUAL'){var _0x57f5fb={};_0x57f5fb[_0x1360ae[_0xa8d8('0x26')]]={'$like':'%'+_0x551e8e[_0xa8d8('0x30')][_0xa8d8('0x3c')]+'%'};return _0x57f5fb;}})});}_0x31b300=_[_0xa8d8('0x3e')]({},_0x31b300,_0x551e8e['options']);var _0x515abd={'where':_0x31b300['where']};return db[_0xa8d8('0x29')][_0xa8d8('0x1d')](_0x515abd)[_0xa8d8('0x22')](function(_0x2472f5){_0x40e5b2[_0xa8d8('0x1d')]=_0x2472f5;if(_0x551e8e[_0xa8d8('0x30')]['includeAll']){_0x31b300[_0xa8d8('0x3f')]=[{'all':!![]}];}return db[_0xa8d8('0x29')][_0xa8d8('0x40')](_0x31b300);})[_0xa8d8('0x22')](function(_0x388fd5){_0x40e5b2[_0xa8d8('0x41')]=_0x388fd5;return _0x40e5b2;})['then'](respondWithFilteredResult(_0x378466,_0x31b300))[_0xa8d8('0x42')](handleError(_0x378466,null));};exports['show']=function(_0x457b2e,_0x548950){var _0x30dd2c={'raw':!![],'where':{'id':_0x457b2e[_0xa8d8('0x43')]['id']}},_0x46d6ff={};_0x46d6ff[_0xa8d8('0x2e')]=_[_0xa8d8('0x31')](db[_0xa8d8('0x29')][_0xa8d8('0x2a')]);_0x46d6ff[_0xa8d8('0x30')]=_[_0xa8d8('0x31')](_0x457b2e[_0xa8d8('0x30')]);_0x46d6ff[_0xa8d8('0x32')]=_[_0xa8d8('0x33')](_0x46d6ff[_0xa8d8('0x2e')],_0x46d6ff[_0xa8d8('0x30')]);_0x30dd2c[_0xa8d8('0x34')]=_[_0xa8d8('0x33')](_0x46d6ff[_0xa8d8('0x2e')],qs[_0xa8d8('0x35')](_0x457b2e[_0xa8d8('0x30')][_0xa8d8('0x35')]));_0x30dd2c['attributes']=_0x30dd2c[_0xa8d8('0x34')]['length']?_0x30dd2c[_0xa8d8('0x34')]:_0x46d6ff[_0xa8d8('0x2e')];if(_0x457b2e[_0xa8d8('0x30')]['includeAll']){_0x30dd2c[_0xa8d8('0x3f')]=[{'all':!![]}];}_0x30dd2c=_[_0xa8d8('0x3e')]({},_0x30dd2c,_0x457b2e[_0xa8d8('0x44')]);return db[_0xa8d8('0x29')][_0xa8d8('0x45')](_0x30dd2c)[_0xa8d8('0x22')](handleEntityNotFound(_0x548950,null))[_0xa8d8('0x22')](respondWithResult(_0x548950,null))[_0xa8d8('0x42')](handleError(_0x548950,null));};exports[_0xa8d8('0x21')]=function(_0x377fdd,_0x473d91){if(_0x377fdd[_0xa8d8('0x46')]['id']){delete _0x377fdd[_0xa8d8('0x46')]['id'];}return db['CmCustomField'][_0xa8d8('0x45')]({'where':{'id':_0x377fdd['params']['id']}})[_0xa8d8('0x22')](handleEntityNotFound(_0x473d91,null))['then'](saveUpdates(_0x377fdd['body'],null))[_0xa8d8('0x22')](respondWithResult(_0x473d91,null))[_0xa8d8('0x42')](handleError(_0x473d91,null));};exports[_0xa8d8('0x47')]=function(_0xca7cca,_0x4bcc96){return db[_0xa8d8('0x29')][_0xa8d8('0x45')]({'where':{'id':_0xca7cca[_0xa8d8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4bcc96,null))[_0xa8d8('0x22')](removeEntity(_0x4bcc96,null))[_0xa8d8('0x42')](handleError(_0x4bcc96,null));};exports['create']=function(_0x18f8ab,_0x326c86){var _0x5bd21a;return db[_0xa8d8('0x48')][_0xa8d8('0x49')](function(_0x55bdf2){return db[_0xa8d8('0x29')]['create'](_0x18f8ab[_0xa8d8('0x46')],{'transaction':_0x55bdf2})[_0xa8d8('0x22')](function(_0x2ef707){_0x5bd21a=_0x2ef707;var _0x37f3dc={'type':db['Sequelize']['TEXT'],'transaction':_0x55bdf2};switch(_0x18f8ab[_0xa8d8('0x46')][_0xa8d8('0x2c')]){case _0xa8d8('0x4a'):_0x37f3dc[_0xa8d8('0x2c')]=db[_0xa8d8('0x4b')][_0xa8d8('0x4c')];break;case _0xa8d8('0x4d'):_0x37f3dc[_0xa8d8('0x2c')]=db['Sequelize'][_0xa8d8('0x4e')];break;case'switch':_0x37f3dc[_0xa8d8('0x2c')]=db['Sequelize']['BOOLEAN'];_0x37f3dc[_0xa8d8('0x4f')]=![];break;default:}return db['sequelize'][_0xa8d8('0x50')][_0xa8d8('0x51')]('cm_contacts',util[_0xa8d8('0x52')]('cf_%d',_0x5bd21a['id']),_0x37f3dc);})[_0xa8d8('0x22')](function(){return _0x5bd21a;});})['then'](respondWithResult(_0x326c86,0xc9))['catch'](handleError(_0x326c86,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6b94d06..c2b6778 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 _0x4b8f=['rimraf','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields','../../config/logger','moment','request-promise','path'];(function(_0x1d524d,_0x3cdf11){var _0x552dfb=function(_0x2cc927){while(--_0x2cc927){_0x1d524d['push'](_0x1d524d['shift']());}};_0x552dfb(++_0x3cdf11);}(_0x4b8f,0x1c7));var _0xf4b8=function(_0x2aac3b,_0x401595){_0x2aac3b=_0x2aac3b-0x0;var _0x4e322e=_0x4b8f[_0x2aac3b];return _0x4e322e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4b8('0x0'))('api');var moment=require(_0xf4b8('0x1'));var BPromise=require('bluebird');var rp=require(_0xf4b8('0x2'));var fs=require('fs');var path=require(_0xf4b8('0x3'));var rimraf=require(_0xf4b8('0x4'));var config=require(_0xf4b8('0x5'));var attributes=require(_0xf4b8('0x6'));module['exports']=function(_0x29b1a4,_0x1024ea){return _0x29b1a4['define'](_0xf4b8('0x7'),attributes,{'tableName':_0xf4b8('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x635d=['exports','define','cm_custom_fields','lodash','util','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x268fdd,_0x46b228){var _0x5ce50c=function(_0x37c598){while(--_0x37c598){_0x268fdd['push'](_0x268fdd['shift']());}};_0x5ce50c(++_0x46b228);}(_0x635d,0x1cf));var _0xd635=function(_0xbf6d20,_0x55d1b1){_0xbf6d20=_0xbf6d20-0x0;var _0x1e6b38=_0x635d[_0xbf6d20];return _0x1e6b38;};'use strict';var _=require(_0xd635('0x0'));var util=require(_0xd635('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd635('0x2'));var fs=require('fs');var path=require(_0xd635('0x3'));var rimraf=require(_0xd635('0x4'));var config=require(_0xd635('0x5'));var attributes=require(_0xd635('0x6'));module[_0xd635('0x7')]=function(_0x198aa6,_0x49aecd){return _0x198aa6[_0xd635('0x8')]('CmCustomField',attributes,{'tableName':_0xd635('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 31c25fa..facd362 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 _0xbcec=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','bluebird','randomstring','../../config/utils','jayson/promise','http','request','then','info'];(function(_0xc3884c,_0x3a05db){var _0x4a7eaf=function(_0x572f96){while(--_0x572f96){_0xc3884c['push'](_0xc3884c['shift']());}};_0x4a7eaf(++_0x3a05db);}(_0xbcec,0x177));var _0xcbce=function(_0x5c5e95,_0x740a18){_0x5c5e95=_0x5c5e95-0x0;var _0x55c9aa=_0xbcec[_0x5c5e95];return _0x55c9aa;};'use strict';var _=require(_0xcbce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbce('0x1'));var rs=require(_0xcbce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcbce('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbce('0x4'));var client=jayson['client'][_0xcbce('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5ead4a,_0x15ccbb,_0x2fd743){return new BPromise(function(_0x41cc83,_0xab1063){return client[_0xcbce('0x6')](_0x5ead4a,_0x2fd743)[_0xcbce('0x7')](function(_0x5c6568){logger[_0xcbce('0x8')](_0xcbce('0x9'),_0x15ccbb,_0xcbce('0xa'));logger[_0xcbce('0xb')](_0xcbce('0xc'),_0x15ccbb,_0xcbce('0xa'),JSON['stringify'](_0x5c6568));if(_0x5c6568[_0xcbce('0xd')]){if(_0x5c6568['error']['code']===0x1f4){logger[_0xcbce('0xd')]('CmCustomField,\x20%s,\x20%s',_0x15ccbb,_0x5c6568['error']['message']);return _0xab1063(_0x5c6568[_0xcbce('0xd')]['message']);}logger[_0xcbce('0xd')](_0xcbce('0x9'),_0x15ccbb,_0x5c6568[_0xcbce('0xd')][_0xcbce('0xe')]);return _0x41cc83(_0x5c6568[_0xcbce('0xd')][_0xcbce('0xe')]);}else{logger[_0xcbce('0x8')](_0xcbce('0x9'),_0x15ccbb,_0xcbce('0xa'));_0x41cc83(_0x5c6568[_0xcbce('0xf')][_0xcbce('0xe')]);}})['catch'](function(_0x17360c){logger[_0xcbce('0xd')](_0xcbce('0x9'),_0x15ccbb,_0x17360c);_0xab1063(_0x17360c);});});} \ No newline at end of file +var _0x49ec=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfb211d,_0x469369){var _0xdeed13=function(_0x3e08b1){while(--_0x3e08b1){_0xfb211d['push'](_0xfb211d['shift']());}};_0xdeed13(++_0x469369);}(_0x49ec,0x188));var _0xc49e=function(_0xe9bbaa,_0x2c4410){_0xe9bbaa=_0xe9bbaa-0x0;var _0x556272=_0x49ec[_0xe9bbaa];return _0x556272;};'use strict';var _=require(_0xc49e('0x0'));var util=require(_0xc49e('0x1'));var moment=require(_0xc49e('0x2'));var BPromise=require(_0xc49e('0x3'));var rs=require(_0xc49e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc49e('0x5'))['db'];var utils=require(_0xc49e('0x6'));var logger=require(_0xc49e('0x7'))(_0xc49e('0x8'));var config=require(_0xc49e('0x9'));var jayson=require(_0xc49e('0xa'));var client=jayson[_0xc49e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d3bb4,_0x10176d,_0x4b9752){return new BPromise(function(_0x4d06fb,_0x2a1018){return client['request'](_0x2d3bb4,_0x4b9752)[_0xc49e('0xc')](function(_0x304a84){logger['info'](_0xc49e('0xd'),_0x10176d,_0xc49e('0xe'));logger[_0xc49e('0xf')](_0xc49e('0x10'),_0x10176d,_0xc49e('0xe'),JSON[_0xc49e('0x11')](_0x304a84));if(_0x304a84[_0xc49e('0x12')]){if(_0x304a84['error'][_0xc49e('0x13')]===0x1f4){logger[_0xc49e('0x12')]('CmCustomField,\x20%s,\x20%s',_0x10176d,_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);return _0x2a1018(_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);}logger[_0xc49e('0x12')](_0xc49e('0xd'),_0x10176d,_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);return _0x4d06fb(_0x304a84[_0xc49e('0x12')][_0xc49e('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x10176d,_0xc49e('0xe'));_0x4d06fb(_0x304a84[_0xc49e('0x15')][_0xc49e('0x14')]);}})[_0xc49e('0x16')](function(_0xb2f3cf){logger['error'](_0xc49e('0xd'),_0x10176d,_0xb2f3cf);_0x2a1018(_0xb2f3cf);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f5a7779..e9cfeeb 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 _0x13e3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id','create','put','update','exports','path'];(function(_0x5eaa32,_0x490c4f){var _0x26a16f=function(_0x566104){while(--_0x566104){_0x5eaa32['push'](_0x5eaa32['shift']());}};_0x26a16f(++_0x490c4f);}(_0x13e3,0x137));var _0x313e=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0x13e3[_0x319e2e];return _0x302524;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x313e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x313e('0x1')]();var fs_extra=require(_0x313e('0x2'));var auth=require(_0x313e('0x3'));var interaction=require(_0x313e('0x4'));var config=require('../../config/environment');var controller=require(_0x313e('0x5'));router[_0x313e('0x6')]('/',auth[_0x313e('0x7')](),controller['index']);router[_0x313e('0x6')](_0x313e('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x313e('0x7')](),controller[_0x313e('0x9')]);router[_0x313e('0xa')](_0x313e('0x8'),auth[_0x313e('0x7')](),controller[_0x313e('0xb')]);router['delete'](_0x313e('0x8'),auth[_0x313e('0x7')](),controller['destroy']);module[_0x313e('0xc')]=router; \ No newline at end of file +var _0x36eb=['isAuthenticated','show','post','create','put','delete','destroy','multer','path','express','fs-extra','./cmCustomField.controller','get','/:id'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x36eb,0x111));var _0xb36e=function(_0x3bba67,_0x198327){_0x3bba67=_0x3bba67-0x0;var _0x6ff30a=_0x36eb[_0x3bba67];return _0x6ff30a;};'use strict';var multer=require(_0xb36e('0x0'));var util=require('util');var path=require(_0xb36e('0x1'));var timeout=require('connect-timeout');var express=require(_0xb36e('0x2'));var router=express['Router']();var fs_extra=require(_0xb36e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb36e('0x4'));router[_0xb36e('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb36e('0x5')](_0xb36e('0x6'),auth[_0xb36e('0x7')](),controller[_0xb36e('0x8')]);router[_0xb36e('0x9')]('/',auth['isAuthenticated'](),controller[_0xb36e('0xa')]);router[_0xb36e('0xb')]('/:id',auth[_0xb36e('0x7')](),controller['update']);router[_0xb36e('0xc')](_0xb36e('0x6'),auth[_0xb36e('0x7')](),controller[_0xb36e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index aa7cede..536c452 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 _0x8e3f=['format','INTEGER','STRING','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0xf8e3('0x0'));var Sequelize=require(_0xf8e3('0x1'));module[_0xf8e3('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xf8e3('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf8e3('0x4')],'defaultValue':moment()[_0xf8e3('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf8e3('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf8e3('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf8e3('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf8e3('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf8e3('0x4')]},'priority':{'type':Sequelize[_0xf8e3('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf8e3('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf8e3('0x6')],'unique':_0xf8e3('0x8')},'ListId':{'type':Sequelize[_0xf8e3('0x6')],'unique':_0xf8e3('0x8')},'UserId':{'type':Sequelize[_0xf8e3('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xf8e3('0x6')],'unique':_0xf8e3('0x8')},'CampaignId':{'type':Sequelize[_0xf8e3('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xf8e3('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf8e3('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf8e3('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf8e3('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf8e3('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0xf8e3('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x524e=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports'];(function(_0x1e8982,_0x37bfc7){var _0x115066=function(_0x202cb1){while(--_0x202cb1){_0x1e8982['push'](_0x1e8982['shift']());}};_0x115066(++_0x37bfc7);}(_0x524e,0x15e));var _0xe524=function(_0x31f256,_0x512984){_0x31f256=_0x31f256-0x0;var _0x557c19=_0x524e[_0x31f256];return _0x557c19;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe524('0x0')]={'phone':{'type':Sequelize[_0xe524('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xe524('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe524('0x3')],'defaultValue':moment()[_0xe524('0x4')](_0xe524('0x5'))},'countbusyretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe524('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe524('0x3')]},'priority':{'type':Sequelize[_0xe524('0x6')](0x2)[_0xe524('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'ListId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'UserId':{'type':Sequelize[_0xe524('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'CampaignId':{'type':Sequelize[_0xe524('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe524('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xe524('0x3')],'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 8e7201f..f706a18 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 _0x2c59=['literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','hopperId','scheduledat','LOCK','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','map','CmHopper','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','isNil','firstName','calleridname','lastName','CmHopperFinal','getPreview','CmContact','describe','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC'];(function(_0x5d7a5f,_0x367350){var _0x1cb7ec=function(_0x22cfea){while(--_0x22cfea){_0x5d7a5f['push'](_0x5d7a5f['shift']());}};_0x1cb7ec(++_0x367350);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x92c5('0x0'));var jsonpatch=require(_0x92c5('0x1'));var rp=require(_0x92c5('0x2'));var moment=require(_0x92c5('0x3'));var BPromise=require(_0x92c5('0x4'));var Mustache=require('mustache');var util=require(_0x92c5('0x5'));var path=require(_0x92c5('0x6'));var sox=require(_0x92c5('0x7'));var csv=require(_0x92c5('0x8'));var ejs=require(_0x92c5('0x9'));var fs=require('fs');var fs_extra=require(_0x92c5('0xa'));var _=require(_0x92c5('0xb'));var squel=require(_0x92c5('0xc'));var crypto=require(_0x92c5('0xd'));var jsforce=require(_0x92c5('0xe'));var deskjs=require(_0x92c5('0xf'));var toCsv=require(_0x92c5('0x8'));var querystring=require(_0x92c5('0x10'));var Papa=require(_0x92c5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x92c5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92c5('0x13'))(_0x92c5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var shared=require(_0x92c5('0x15'));var licenseUtil=require(_0x92c5('0x16'));var db=require(_0x92c5('0x17'))['db'];function respondWithStatusCode(_0x5b9f06,_0xb4e472){_0xb4e472=_0xb4e472||0xcc;return function(_0x2f04ce){if(_0x2f04ce){return _0x5b9f06[_0x92c5('0x18')](_0xb4e472);}return _0x5b9f06['status'](_0xb4e472)[_0x92c5('0x19')]();};}function respondWithResult(_0x3b0567,_0x2e0455){_0x2e0455=_0x2e0455||0xc8;return function(_0x3a32e5){if(_0x3a32e5){return _0x3b0567[_0x92c5('0x1a')](_0x2e0455)[_0x92c5('0x1b')](_0x3a32e5);}};}function respondWithFilteredResult(_0x178323,_0x3b293d){return function(_0x48b8ce){if(_0x48b8ce){var _0x3c0c92=typeof _0x3b293d[_0x92c5('0x1c')]===_0x92c5('0x1d')&&typeof _0x3b293d[_0x92c5('0x1e')]===_0x92c5('0x1d');var _0x2165cb=_0x48b8ce[_0x92c5('0x1f')];var _0x8a3e32=_0x3c0c92?0x0:_0x3b293d[_0x92c5('0x1c')];var _0x171ce4=_0x3c0c92?_0x48b8ce[_0x92c5('0x1f')]:_0x3b293d['offset']+_0x3b293d[_0x92c5('0x1e')];var _0x530a11;if(_0x171ce4>=_0x2165cb){_0x171ce4=_0x2165cb;_0x530a11=0xc8;}else{_0x530a11=0xce;}_0x178323[_0x92c5('0x1a')](_0x530a11);return _0x178323['set'](_0x92c5('0x20'),_0x8a3e32+'-'+_0x171ce4+'/'+_0x2165cb)[_0x92c5('0x1b')](_0x48b8ce);}return null;};}function patchUpdates(_0x29e9f5){return function(_0x19064a){try{jsonpatch['apply'](_0x19064a,_0x29e9f5,!![]);}catch(_0x165aae){return BPromise[_0x92c5('0x21')](_0x165aae);}return _0x19064a[_0x92c5('0x22')]();};}function saveUpdates(_0x16d8fd,_0x4c1d99){return function(_0x407ec5){if(_0x407ec5){return _0x407ec5[_0x92c5('0x23')](_0x16d8fd)[_0x92c5('0x24')](function(_0x51362){return _0x51362;});}return null;};}function removeEntity(_0x5c5e6d,_0x1e960f){return function(_0x49556d){if(_0x49556d){return _0x49556d['destroy']()[_0x92c5('0x24')](function(){_0x5c5e6d[_0x92c5('0x1a')](0xcc)[_0x92c5('0x19')]();});}};}function handleEntityNotFound(_0x4313a4,_0x1415d4){return function(_0x384e85){if(!_0x384e85){_0x4313a4[_0x92c5('0x18')](0x194);}return _0x384e85;};}function handleError(_0x3331c5,_0x7f0f6f){_0x7f0f6f=_0x7f0f6f||0x1f4;return function(_0x12a47d){logger[_0x92c5('0x25')](_0x12a47d[_0x92c5('0x26')]);if(_0x12a47d[_0x92c5('0x27')]){delete _0x12a47d[_0x92c5('0x27')];}_0x3331c5[_0x92c5('0x1a')](_0x7f0f6f)[_0x92c5('0x28')](_0x12a47d);};}exports[_0x92c5('0x29')]=function(_0x3b1514,_0x529118){var _0x1f70d6={},_0x55b554={},_0x3d54f8={'count':0x0,'rows':[]};var _0xca6113=_[_0x92c5('0x2a')](db[_0x92c5('0x2b')]['rawAttributes'],function(_0xe7c5d6){return{'name':_0xe7c5d6[_0x92c5('0x2c')],'type':_0xe7c5d6['type'][_0x92c5('0x2d')]};});_0x55b554[_0x92c5('0x2e')]=_[_0x92c5('0x2a')](_0xca6113,_0x92c5('0x27'));_0x55b554[_0x92c5('0x2f')]=_[_0x92c5('0x30')](_0x3b1514[_0x92c5('0x2f')]);_0x55b554[_0x92c5('0x31')]=_[_0x92c5('0x32')](_0x55b554[_0x92c5('0x2e')],_0x55b554[_0x92c5('0x2f')]);_0x55b554[_0x92c5('0x31')]=_[_0x92c5('0x33')](_0x55b554['filters'],[_0x92c5('0x34'),_0x92c5('0x35'),_0x92c5('0x36'),_0x92c5('0x37'),_0x92c5('0x38'),_0x92c5('0x39'),_0x92c5('0x3a'),_0x92c5('0x3b'),_0x92c5('0x3c'),_0x92c5('0x3d'),_0x92c5('0x3e'),'$in',_0x92c5('0x3f'),_0x92c5('0x40'),_0x92c5('0x41'),'$iLike',_0x92c5('0x42'),_0x92c5('0x40'),_0x92c5('0x43'),_0x92c5('0x44'),_0x92c5('0x45'),_0x92c5('0x46')]);_0x1f70d6[_0x92c5('0x47')]=_[_0x92c5('0x32')](_0x55b554['model'],qs[_0x92c5('0x48')](_0x3b1514[_0x92c5('0x2f')][_0x92c5('0x48')]));_0x1f70d6['attributes']=_0x1f70d6[_0x92c5('0x47')][_0x92c5('0x49')]?_0x1f70d6[_0x92c5('0x47')]:_0x55b554[_0x92c5('0x2e')];if(!_0x3b1514[_0x92c5('0x2f')][_0x92c5('0x4a')](_0x92c5('0x4b'))){_0x1f70d6[_0x92c5('0x1e')]=qs[_0x92c5('0x1e')](_0x3b1514['query'][_0x92c5('0x1e')]);_0x1f70d6['offset']=qs[_0x92c5('0x1c')](_0x3b1514[_0x92c5('0x2f')][_0x92c5('0x1c')]);}_0x1f70d6[_0x92c5('0x4c')]=qs[_0x92c5('0x4d')](_0x3b1514[_0x92c5('0x2f')]['sort']);_0x1f70d6[_0x92c5('0x4e')]=qs['filters'](_[_0x92c5('0x4f')](_0x3b1514[_0x92c5('0x2f')],_0x55b554['filters']),_0xca6113);if(_0x3b1514[_0x92c5('0x2f')]['filter']){_0x1f70d6[_0x92c5('0x4e')]=_[_0x92c5('0x50')](_0x1f70d6[_0x92c5('0x4e')],{'$or':_[_0x92c5('0x2a')](_0xca6113,function(_0x252f38){if(_0x252f38[_0x92c5('0x51')]!==_0x92c5('0x52')){var _0x2986c7={};_0x2986c7[_0x252f38['name']]={'$like':'%'+_0x3b1514[_0x92c5('0x2f')][_0x92c5('0x53')]+'%'};return _0x2986c7;}})});}_0x1f70d6=_[_0x92c5('0x50')]({},_0x1f70d6,_0x3b1514[_0x92c5('0x54')]);var _0x370d21={'where':_0x1f70d6['where']};return db[_0x92c5('0x2b')][_0x92c5('0x1f')](_0x370d21)['then'](function(_0x47eca9){_0x3d54f8[_0x92c5('0x1f')]=_0x47eca9;if(_0x3b1514[_0x92c5('0x2f')][_0x92c5('0x55')]){_0x1f70d6[_0x92c5('0x56')]=[{'all':!![]}];}return db[_0x92c5('0x2b')][_0x92c5('0x57')](_0x1f70d6);})[_0x92c5('0x24')](function(_0x40eff5){_0x3d54f8[_0x92c5('0x58')]=_0x40eff5;return _0x3d54f8;})['then'](respondWithFilteredResult(_0x529118,_0x1f70d6))[_0x92c5('0x59')](handleError(_0x529118,null));};exports['show']=function(_0x1b525b,_0x3a1b66){var _0x1abc17={'raw':!![],'where':{'id':_0x1b525b[_0x92c5('0x5a')]['id']}},_0x12bbc4={};_0x12bbc4[_0x92c5('0x2e')]=_[_0x92c5('0x30')](db[_0x92c5('0x2b')][_0x92c5('0x5b')]);_0x12bbc4[_0x92c5('0x2f')]=_['keys'](_0x1b525b['query']);_0x12bbc4['filters']=_[_0x92c5('0x32')](_0x12bbc4['model'],_0x12bbc4[_0x92c5('0x2f')]);_0x1abc17[_0x92c5('0x47')]=_[_0x92c5('0x32')](_0x12bbc4[_0x92c5('0x2e')],qs[_0x92c5('0x48')](_0x1b525b[_0x92c5('0x2f')][_0x92c5('0x48')]));_0x1abc17[_0x92c5('0x47')]=_0x1abc17[_0x92c5('0x47')][_0x92c5('0x49')]?_0x1abc17[_0x92c5('0x47')]:_0x12bbc4[_0x92c5('0x2e')];if(_0x1b525b['query'][_0x92c5('0x55')]){_0x1abc17['include']=[{'all':!![]}];}_0x1abc17=_[_0x92c5('0x50')]({},_0x1abc17,_0x1b525b[_0x92c5('0x54')]);return db[_0x92c5('0x2b')][_0x92c5('0x5c')](_0x1abc17)[_0x92c5('0x24')](handleEntityNotFound(_0x3a1b66,null))[_0x92c5('0x24')](respondWithResult(_0x3a1b66,null))[_0x92c5('0x59')](handleError(_0x3a1b66,null));};exports[_0x92c5('0x5d')]=function(_0x5dfbf0,_0x36c57e){return db[_0x92c5('0x2b')][_0x92c5('0x5d')](_0x5dfbf0['body'],{})['then'](respondWithResult(_0x36c57e,0xc9))['catch'](handleError(_0x36c57e,null));};exports[_0x92c5('0x23')]=function(_0x1f8fba,_0x5cdfc3){if(_0x1f8fba['body']['id']){delete _0x1f8fba[_0x92c5('0x5e')]['id'];}return db[_0x92c5('0x2b')][_0x92c5('0x5c')]({'where':{'id':_0x1f8fba['params']['id']}})['then'](handleEntityNotFound(_0x5cdfc3,null))[_0x92c5('0x24')](saveUpdates(_0x1f8fba[_0x92c5('0x5e')],null))['then'](respondWithResult(_0x5cdfc3,null))['catch'](handleError(_0x5cdfc3,null));};exports['describe']=function(_0x5e7510,_0x22fb24){return db[_0x92c5('0x2b')]['describe']()['then'](respondWithResult(_0x22fb24,null))['catch'](handleError(_0x22fb24,null));};exports[_0x92c5('0x5f')]=function(_0x1b32ed,_0x19379a){var _0x1c850a;return db[_0x92c5('0x2b')][_0x92c5('0x5c')]({'where':{'id':_0x1b32ed[_0x92c5('0x5a')]['id']}})[_0x92c5('0x24')](handleEntityNotFound(_0x19379a,null))['then'](function(_0x45f7a5){if(_0x45f7a5){return _0x45f7a5[_0x92c5('0x5f')]()[_0x92c5('0x24')](function(_0x5b1af2){return _0x5b1af2;});}})[_0x92c5('0x24')](function(_0xcd6412){_0x1c850a=_0xcd6412;if(_0xcd6412){if(_0xcd6412['VoiceQueueId']||_0xcd6412[_0x92c5('0x60')]){return db[_0xcd6412[_0x92c5('0x61')]?_0x92c5('0x62'):_0x92c5('0x63')][_0x92c5('0x5c')]({'where':{'id':_0xcd6412[_0x92c5('0x61')]?_0xcd6412[_0x92c5('0x61')]:_0xcd6412['CampaignId']},'attributes':['id',_0x92c5('0x27')],'raw':!![]});}}})[_0x92c5('0x24')](function(_0x1ed295){var _0x56b001={};if(_0x1ed295){_[_0x92c5('0x50')](_0x56b001,_['omit'](_0x1c850a[_0x92c5('0x64')],[_0x92c5('0x65'),_0x92c5('0x66'),'id']));_0x56b001[_0x92c5('0x67')]=0x15;_0x56b001[_0x92c5('0x68')]='deleted';_0x56b001[_0x92c5('0x69')]=_0x1ed295[_0x92c5('0x27')];_0x56b001['membername']=_0x1b32ed[_0x92c5('0x6a')][_0x92c5('0x27')];_0x56b001[_0x92c5('0x6b')]=_0x1b32ed[_0x92c5('0x6a')]['id'];_0x56b001['deleted']=!![];_0x56b001[_0x92c5('0x6c')]=moment()[_0x92c5('0x6d')](_0x92c5('0x6e'));_0x56b001['calleridnum']=_0x1c850a[_0x92c5('0x6f')];_0x56b001[_0x92c5('0x70')]=_0x1c850a['VoiceQueueId']?_0x92c5('0x71'):_0x92c5('0x72');return db['CmContact'][_0x92c5('0x5c')]({'where':{'id':_0x56b001[_0x92c5('0x73')]},'attributes':['firstName','lastName']})[_0x92c5('0x24')](function(_0x77068b){if(!_[_0x92c5('0x74')](_0x19379a)&&!_[_0x92c5('0x74')](_0x77068b[_0x92c5('0x75')])){_0x56b001[_0x92c5('0x76')]=_0x77068b[_0x92c5('0x75')];if(!_[_0x92c5('0x74')](_0x77068b[_0x92c5('0x77')])){_0x56b001[_0x92c5('0x76')]+='\x20'+_0x77068b[_0x92c5('0x77')];}}})['finally'](function(){return db[_0x92c5('0x78')][_0x92c5('0x5d')](_0x56b001);});}})[_0x92c5('0x24')](function(){return _0x19379a['status'](0xcc)['end']();})[_0x92c5('0x59')](handleError(_0x19379a,null));};exports[_0x92c5('0x79')]=function(_0x42c022,_0x36afc1,_0x188293){var _0x20cf4f=[];return db[_0x92c5('0x7a')][_0x92c5('0x7b')]()[_0x92c5('0x24')](function(_0x1e569b){_0x20cf4f=_[_0x92c5('0x30')](_0x1e569b);return _0x42c022[_0x92c5('0x6a')][_0x92c5('0x7c')]({'where':{'type':_0x92c5('0x7d'),'dialActive':!![],'dialMethod':_0x92c5('0x7e')},'attributes':['id',_0x92c5('0x7f'),_0x92c5('0x80')],'raw':!![]});})[_0x92c5('0x24')](function(_0x40d2ee){if(_0x40d2ee&&_0x40d2ee['length']){return db[_0x92c5('0x81')][_0x92c5('0x82')](function(_0x45c6ce){var _0x1f86d9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x92c5('0x6d')](_0x92c5('0x6e'))},'VoiceQueueId':{'$in':_['map'](_0x40d2ee,'id')},'$or':[{'UserId':null},{'UserId':_0x42c022[_0x92c5('0x6a')]['id']}]};var _0x4c7c3e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x40d2ee)[_0x92c5('0x53')](['dialPreviewAutoRecallMe',0x0])[_0x92c5('0x2a')]('id')[_0x92c5('0x83')]()},'$or':[{'UserId':null},{'UserId':_0x42c022[_0x92c5('0x6a')]['id']}]};var _0x1294b2={'$or':[_0x1f86d9,_0x4c7c3e]};var _0x2a4119=[];if(_0x42c022[_0x92c5('0x5e')][_0x92c5('0x84')]&&_0x42c022[_0x92c5('0x5e')][_0x92c5('0x84')]===_0x92c5('0x85')){if(!_['isEmpty'](_0x42c022[_0x92c5('0x5e')][_0x92c5('0x86')])){_0x1294b2['id']={'$in':_0x42c022[_0x92c5('0x5e')]['hopperIds']};}_0x2a4119=[[_0x92c5('0x87'),_0x92c5('0x88')],[_0x92c5('0x89'),_0x40d2ee[0x0][_0x92c5('0x7f')]==='ASC'?_0x92c5('0x8a'):'ASC'],db['sequelize'][_0x92c5('0x8b')](_0x92c5('0x8c')),['id',_0x92c5('0x8a')]];}else{if(!_['isEmpty'](_0x42c022[_0x92c5('0x5e')][_0x92c5('0x86')])){_0x1294b2['id']={'$notIn':_0x42c022[_0x92c5('0x5e')][_0x92c5('0x86')]};}_0x2a4119=[[_0x92c5('0x87'),_0x92c5('0x8a')],[_0x92c5('0x89'),_0x40d2ee[0x0][_0x92c5('0x7f')]],db[_0x92c5('0x81')][_0x92c5('0x8b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x92c5('0x88')]];}return db[_0x92c5('0x2b')][_0x92c5('0x8d')]({'attributes':['id','scheduledat',_0x92c5('0x8e')],'where':_0x1294b2,'order':_0x2a4119,'transaction':_0x45c6ce,'lock':_0x45c6ce['LOCK'][_0x92c5('0x8f')],'include':[{'model':db['CmContact'],'as':_0x92c5('0x90'),'attributes':_0x20cf4f,'include':[{'model':db[_0x92c5('0x91')],'as':_0x92c5('0x92'),'attributes':['id',_0x92c5('0x27')]}]},{'model':db[_0x92c5('0x93')],'as':_0x92c5('0x94'),'attributes':['id',_0x92c5('0x27')]},{'model':db[_0x92c5('0x62')],'as':_0x92c5('0x95'),'attributes':['id','name',_0x92c5('0x96')]}]})[_0x92c5('0x24')](function(_0x3cc202){if(_0x3cc202){return _0x3cc202[_0x92c5('0x23')]({'UserId':_0x42c022[_0x92c5('0x6a')]['id']},{'transaction':_0x45c6ce});}});});}})['then'](handleEntityNotFound(_0x36afc1,null))[_0x92c5('0x24')](respondWithResult(_0x36afc1,null))[_0x92c5('0x59')](handleError(_0x36afc1,null));};exports[_0x92c5('0x97')]=function(_0x41eeb9,_0x25eea7,_0x4b506c){var _0x461cbb=[];return db[_0x92c5('0x7a')][_0x92c5('0x7b')]()['then'](function(_0x120d4a){_0x461cbb=_[_0x92c5('0x30')](_0x120d4a);return _0x41eeb9[_0x92c5('0x6a')][_0x92c5('0x7c')]({'where':{'type':_0x92c5('0x7d'),'dialActive':!![],'dialMethod':_0x92c5('0x7e')},'attributes':['id',_0x92c5('0x7f'),_0x92c5('0x80')],'raw':!![]});})[_0x92c5('0x24')](function(_0x16702a){if(_0x16702a&&_0x16702a[_0x92c5('0x49')]){return db[_0x92c5('0x81')]['transaction'](function(_0x787930){var _0xad4be3={'active':![],'recallme':!![],'id':_0x41eeb9['body'][_0x92c5('0x98')]};return db['CmHopper'][_0x92c5('0x8d')]({'attributes':['id',_0x92c5('0x99'),'recallme'],'where':_0xad4be3,'transaction':_0x787930,'lock':_0x787930[_0x92c5('0x9a')]['UPDATE'],'include':[{'model':db[_0x92c5('0x7a')],'as':_0x92c5('0x90'),'attributes':_0x461cbb,'include':[{'model':db['CmCompany'],'as':_0x92c5('0x92'),'attributes':['id','name']}]},{'model':db[_0x92c5('0x93')],'as':_0x92c5('0x94'),'attributes':['id',_0x92c5('0x27')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x92c5('0x27'),_0x92c5('0x96')]}]})[_0x92c5('0x24')](function(_0x30de4b){if(_0x30de4b){return _0x30de4b['update']({'UserId':_0x41eeb9[_0x92c5('0x6a')]['id']},{'transaction':_0x787930});}});});}})[_0x92c5('0x24')](handleEntityNotFound(_0x25eea7,null))[_0x92c5('0x24')](respondWithResult(_0x25eea7,null))[_0x92c5('0x59')](handleError(_0x25eea7,null));};exports[_0x92c5('0x9b')]=function(_0x6372dd,_0x37f5f2,_0x12a5c3){return _0x6372dd[_0x92c5('0x6a')][_0x92c5('0x7c')]({'where':{'type':_0x92c5('0x7d'),'dialActive':!![],'dialMethod':_0x92c5('0x7e')},'attributes':['id'],'raw':!![]})[_0x92c5('0x24')](function(_0x3d15ba){if(_0x3d15ba&&_0x3d15ba[_0x92c5('0x49')]){return db['CmHopper'][_0x92c5('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x92c5('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x92c5('0x2a')](_0x3d15ba,'id')},'$or':[{'UserId':null},{'UserId':_0x6372dd['user']['id']}]}});}return 0x0;})[_0x92c5('0x24')](function(_0x1fe20a){if(!_[_0x92c5('0x74')](_0x1fe20a)&&_['isNumber'](_0x1fe20a)){return _0x37f5f2[_0x92c5('0x1a')](0xc8)[_0x92c5('0x1b')]({'contacts':_0x1fe20a});}else{logger[_0x92c5('0x25')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x92c5('0x9b'),0x194,_0x92c5('0x9c'));_0x37f5f2[_0x92c5('0x18')](0x194);}})['catch'](handleError(_0x37f5f2,null));};exports[_0x92c5('0x9d')]=function(_0x3c5eea,_0x54142e,_0x1e59ab){var _0x3dd8f4=shared[_0x92c5('0x9e')];var _0x296e53=[];_['map'](_0x3dd8f4,function(_0x52c125){_0x296e53[_0x92c5('0x9f')]({'id':_0x52c125['name'],'name':_0x52c125['name'],'utcOffset':_0x52c125[_0x92c5('0xa0')]});});return _0x54142e[_0x92c5('0x1a')](0xc8)[_0x92c5('0x1b')]({'tz':_0x296e53});};exports['getTimezone']=function(_0x5885db,_0x289f0a,_0x38c187){var _0x364f34=shared[_0x92c5('0x9e')];var _0x2586d4={};if(!_[_0x92c5('0x74')](_0x364f34[_0x5885db[_0x92c5('0x5e')]['id']]))_0x2586d4=_0x364f34[_0x5885db['body']['id']];return _0x289f0a['status'](0xc8)[_0x92c5('0x1b')](_0x2586d4);}; \ No newline at end of file +var _0xdb06=['includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','transaction','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','dialOrderByScheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledAt','scheduledat','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','preview','hopperId','findOne','recallme','LOCK','UPDATE','Company','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params'];(function(_0x4ab311,_0x51ac35){var _0x2c56c0=function(_0x17186d){while(--_0x17186d){_0x4ab311['push'](_0x4ab311['shift']());}};_0x2c56c0(++_0x51ac35);}(_0xdb06,0x194));var _0x6db0=function(_0x317d82,_0x526684){_0x317d82=_0x317d82-0x0;var _0x349785=_0xdb06[_0x317d82];return _0x349785;};'use strict';var emlformat=require(_0x6db0('0x0'));var rimraf=require(_0x6db0('0x1'));var zipdir=require(_0x6db0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db0('0x3'));var moment=require(_0x6db0('0x4'));var BPromise=require(_0x6db0('0x5'));var Mustache=require(_0x6db0('0x6'));var util=require('util');var path=require(_0x6db0('0x7'));var sox=require(_0x6db0('0x8'));var csv=require('to-csv');var ejs=require(_0x6db0('0x9'));var fs=require('fs');var fs_extra=require(_0x6db0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6db0('0xb'));var jsforce=require(_0x6db0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6db0('0xd'));var querystring=require(_0x6db0('0xe'));var Papa=require(_0x6db0('0xf'));var Redis=require(_0x6db0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6db0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6db0('0x12'));var logger=require(_0x6db0('0x13'))('api');var utils=require(_0x6db0('0x14'));var config=require(_0x6db0('0x15'));var shared=require(_0x6db0('0x15'));var licenseUtil=require(_0x6db0('0x16'));var db=require(_0x6db0('0x17'))['db'];function respondWithStatusCode(_0x5806d0,_0x445d1f){_0x445d1f=_0x445d1f||0xcc;return function(_0x1e1427){if(_0x1e1427){return _0x5806d0[_0x6db0('0x18')](_0x445d1f);}return _0x5806d0['status'](_0x445d1f)[_0x6db0('0x19')]();};}function respondWithResult(_0x181421,_0x1f12dd){_0x1f12dd=_0x1f12dd||0xc8;return function(_0x378d53){if(_0x378d53){return _0x181421['status'](_0x1f12dd)[_0x6db0('0x1a')](_0x378d53);}};}function respondWithFilteredResult(_0x41deee,_0x5ce005){return function(_0x234e37){if(_0x234e37){var _0xc9074=typeof _0x5ce005[_0x6db0('0x1b')]===_0x6db0('0x1c')&&typeof _0x5ce005[_0x6db0('0x1d')]==='undefined';var _0x95ef1c=_0x234e37['count'];var _0x1efde7=_0xc9074?0x0:_0x5ce005['offset'];var _0x27f7b6=_0xc9074?_0x234e37[_0x6db0('0x1e')]:_0x5ce005[_0x6db0('0x1b')]+_0x5ce005[_0x6db0('0x1d')];var _0x2b1f75;if(_0x27f7b6>=_0x95ef1c){_0x27f7b6=_0x95ef1c;_0x2b1f75=0xc8;}else{_0x2b1f75=0xce;}_0x41deee[_0x6db0('0x1f')](_0x2b1f75);return _0x41deee['set'](_0x6db0('0x20'),_0x1efde7+'-'+_0x27f7b6+'/'+_0x95ef1c)[_0x6db0('0x1a')](_0x234e37);}return null;};}function patchUpdates(_0x1fd268){return function(_0x2dfa8b){try{jsonpatch['apply'](_0x2dfa8b,_0x1fd268,!![]);}catch(_0x328ef7){return BPromise[_0x6db0('0x21')](_0x328ef7);}return _0x2dfa8b[_0x6db0('0x22')]();};}function saveUpdates(_0x5c81e7,_0x4c45ad){return function(_0x489839){if(_0x489839){return _0x489839[_0x6db0('0x23')](_0x5c81e7)['then'](function(_0x21d907){return _0x21d907;});}return null;};}function removeEntity(_0x4d4162,_0x2671d0){return function(_0x4b97d3){if(_0x4b97d3){return _0x4b97d3[_0x6db0('0x24')]()[_0x6db0('0x25')](function(){_0x4d4162[_0x6db0('0x1f')](0xcc)[_0x6db0('0x19')]();});}};}function handleEntityNotFound(_0x4fa792,_0x227ec0){return function(_0x549591){if(!_0x549591){_0x4fa792[_0x6db0('0x18')](0x194);}return _0x549591;};}function handleError(_0x364b53,_0x146e46){_0x146e46=_0x146e46||0x1f4;return function(_0x4b4ebb){logger[_0x6db0('0x26')](_0x4b4ebb[_0x6db0('0x27')]);if(_0x4b4ebb[_0x6db0('0x28')]){delete _0x4b4ebb[_0x6db0('0x28')];}_0x364b53['status'](_0x146e46)[_0x6db0('0x29')](_0x4b4ebb);};}exports[_0x6db0('0x2a')]=function(_0x509437,_0x403ec3){var _0x22eb49={},_0x391a46={},_0x2a10fa={'count':0x0,'rows':[]};var _0x4d9225=_[_0x6db0('0x2b')](db[_0x6db0('0x2c')][_0x6db0('0x2d')],function(_0x4c31f4){return{'name':_0x4c31f4[_0x6db0('0x2e')],'type':_0x4c31f4[_0x6db0('0x2f')][_0x6db0('0x30')]};});_0x391a46['model']=_[_0x6db0('0x2b')](_0x4d9225,'name');_0x391a46[_0x6db0('0x31')]=_[_0x6db0('0x32')](_0x509437['query']);_0x391a46[_0x6db0('0x33')]=_[_0x6db0('0x34')](_0x391a46[_0x6db0('0x35')],_0x391a46[_0x6db0('0x31')]);_0x391a46[_0x6db0('0x33')]=_[_0x6db0('0x36')](_0x391a46[_0x6db0('0x33')],['$and',_0x6db0('0x37'),_0x6db0('0x38'),_0x6db0('0x39'),_0x6db0('0x3a'),_0x6db0('0x3b'),_0x6db0('0x3c'),_0x6db0('0x3d'),_0x6db0('0x3e'),_0x6db0('0x3f'),_0x6db0('0x40'),'$in',_0x6db0('0x41'),'$like',_0x6db0('0x42'),_0x6db0('0x43'),_0x6db0('0x44'),_0x6db0('0x45'),_0x6db0('0x46'),'$contains','$contained',_0x6db0('0x47')]);_0x22eb49[_0x6db0('0x48')]=_[_0x6db0('0x34')](_0x391a46[_0x6db0('0x35')],qs[_0x6db0('0x49')](_0x509437[_0x6db0('0x31')][_0x6db0('0x49')]));_0x22eb49[_0x6db0('0x48')]=_0x22eb49[_0x6db0('0x48')][_0x6db0('0x4a')]?_0x22eb49['attributes']:_0x391a46['model'];if(!_0x509437[_0x6db0('0x31')][_0x6db0('0x4b')](_0x6db0('0x4c'))){_0x22eb49[_0x6db0('0x1d')]=qs[_0x6db0('0x1d')](_0x509437[_0x6db0('0x31')][_0x6db0('0x1d')]);_0x22eb49[_0x6db0('0x1b')]=qs['offset'](_0x509437[_0x6db0('0x31')][_0x6db0('0x1b')]);}_0x22eb49[_0x6db0('0x4d')]=qs['sort'](_0x509437[_0x6db0('0x31')][_0x6db0('0x4e')]);_0x22eb49[_0x6db0('0x4f')]=qs[_0x6db0('0x33')](_[_0x6db0('0x50')](_0x509437[_0x6db0('0x31')],_0x391a46[_0x6db0('0x33')]),_0x4d9225);if(_0x509437[_0x6db0('0x31')]['filter']){_0x22eb49[_0x6db0('0x4f')]=_[_0x6db0('0x51')](_0x22eb49[_0x6db0('0x4f')],{'$or':_['map'](_0x4d9225,function(_0x9c70db){if(_0x9c70db[_0x6db0('0x2f')]!==_0x6db0('0x52')){var _0x3680d5={};_0x3680d5[_0x9c70db[_0x6db0('0x28')]]={'$like':'%'+_0x509437[_0x6db0('0x31')][_0x6db0('0x53')]+'%'};return _0x3680d5;}})});}_0x22eb49=_[_0x6db0('0x51')]({},_0x22eb49,_0x509437[_0x6db0('0x54')]);var _0x3f4359={'where':_0x22eb49[_0x6db0('0x4f')]};return db[_0x6db0('0x2c')][_0x6db0('0x1e')](_0x3f4359)[_0x6db0('0x25')](function(_0x17facb){_0x2a10fa[_0x6db0('0x1e')]=_0x17facb;if(_0x509437[_0x6db0('0x31')]['includeAll']){_0x22eb49[_0x6db0('0x55')]=[{'all':!![]}];}return db[_0x6db0('0x2c')][_0x6db0('0x56')](_0x22eb49);})[_0x6db0('0x25')](function(_0x47cf84){_0x2a10fa[_0x6db0('0x57')]=_0x47cf84;return _0x2a10fa;})[_0x6db0('0x25')](respondWithFilteredResult(_0x403ec3,_0x22eb49))[_0x6db0('0x58')](handleError(_0x403ec3,null));};exports[_0x6db0('0x59')]=function(_0x2f6e52,_0x7412c7){var _0x392363={'raw':!![],'where':{'id':_0x2f6e52[_0x6db0('0x5a')]['id']}},_0x149b65={};_0x149b65['model']=_['keys'](db[_0x6db0('0x2c')][_0x6db0('0x2d')]);_0x149b65[_0x6db0('0x31')]=_[_0x6db0('0x32')](_0x2f6e52[_0x6db0('0x31')]);_0x149b65['filters']=_[_0x6db0('0x34')](_0x149b65[_0x6db0('0x35')],_0x149b65[_0x6db0('0x31')]);_0x392363[_0x6db0('0x48')]=_[_0x6db0('0x34')](_0x149b65[_0x6db0('0x35')],qs[_0x6db0('0x49')](_0x2f6e52[_0x6db0('0x31')][_0x6db0('0x49')]));_0x392363[_0x6db0('0x48')]=_0x392363[_0x6db0('0x48')]['length']?_0x392363[_0x6db0('0x48')]:_0x149b65[_0x6db0('0x35')];if(_0x2f6e52[_0x6db0('0x31')][_0x6db0('0x5b')]){_0x392363[_0x6db0('0x55')]=[{'all':!![]}];}_0x392363=_['merge']({},_0x392363,_0x2f6e52['options']);return db[_0x6db0('0x2c')][_0x6db0('0x5c')](_0x392363)[_0x6db0('0x25')](handleEntityNotFound(_0x7412c7,null))['then'](respondWithResult(_0x7412c7,null))['catch'](handleError(_0x7412c7,null));};exports[_0x6db0('0x5d')]=function(_0x599cc2,_0x52c496){return db[_0x6db0('0x2c')][_0x6db0('0x5d')](_0x599cc2[_0x6db0('0x5e')],{})['then'](respondWithResult(_0x52c496,0xc9))[_0x6db0('0x58')](handleError(_0x52c496,null));};exports[_0x6db0('0x23')]=function(_0x4cea54,_0x3fbbe3){if(_0x4cea54[_0x6db0('0x5e')]['id']){delete _0x4cea54['body']['id'];}return db[_0x6db0('0x2c')][_0x6db0('0x5c')]({'where':{'id':_0x4cea54['params']['id']}})[_0x6db0('0x25')](handleEntityNotFound(_0x3fbbe3,null))['then'](saveUpdates(_0x4cea54[_0x6db0('0x5e')],null))['then'](respondWithResult(_0x3fbbe3,null))[_0x6db0('0x58')](handleError(_0x3fbbe3,null));};exports[_0x6db0('0x5f')]=function(_0x18be8e,_0x5c1cc8){return db[_0x6db0('0x2c')][_0x6db0('0x5f')]()[_0x6db0('0x25')](respondWithResult(_0x5c1cc8,null))[_0x6db0('0x58')](handleError(_0x5c1cc8,null));};exports[_0x6db0('0x24')]=function(_0x457f77,_0x592b24){var _0x5ec572;return db['CmHopper'][_0x6db0('0x5c')]({'where':{'id':_0x457f77['params']['id']}})[_0x6db0('0x25')](handleEntityNotFound(_0x592b24,null))[_0x6db0('0x25')](function(_0x2defb0){if(_0x2defb0){return _0x2defb0[_0x6db0('0x24')]()[_0x6db0('0x25')](function(_0x15762f){return _0x15762f;});}})[_0x6db0('0x25')](function(_0xe83d15){_0x5ec572=_0xe83d15;if(_0xe83d15){if(_0xe83d15[_0x6db0('0x60')]||_0xe83d15[_0x6db0('0x61')]){return db[_0xe83d15[_0x6db0('0x60')]?_0x6db0('0x62'):_0x6db0('0x63')]['find']({'where':{'id':_0xe83d15[_0x6db0('0x60')]?_0xe83d15['VoiceQueueId']:_0xe83d15[_0x6db0('0x61')]},'attributes':['id',_0x6db0('0x28')],'raw':!![]});}}})[_0x6db0('0x25')](function(_0x28e235){var _0x4e0dc0={};if(_0x28e235){_[_0x6db0('0x51')](_0x4e0dc0,_['omit'](_0x5ec572[_0x6db0('0x64')],[_0x6db0('0x65'),_0x6db0('0x66'),'id']));_0x4e0dc0[_0x6db0('0x67')]=0x15;_0x4e0dc0[_0x6db0('0x68')]=_0x6db0('0x69');_0x4e0dc0['campaign']=_0x28e235[_0x6db0('0x28')];_0x4e0dc0[_0x6db0('0x6a')]=_0x457f77[_0x6db0('0x6b')][_0x6db0('0x28')];_0x4e0dc0[_0x6db0('0x6c')]=_0x457f77[_0x6db0('0x6b')]['id'];_0x4e0dc0[_0x6db0('0x69')]=!![];_0x4e0dc0[_0x6db0('0x6d')]=moment()[_0x6db0('0x6e')](_0x6db0('0x6f'));_0x4e0dc0[_0x6db0('0x70')]=_0x5ec572[_0x6db0('0x71')];_0x4e0dc0[_0x6db0('0x72')]=_0x5ec572['VoiceQueueId']?_0x6db0('0x73'):_0x6db0('0x74');return db[_0x6db0('0x75')][_0x6db0('0x5c')]({'where':{'id':_0x4e0dc0[_0x6db0('0x76')]},'attributes':[_0x6db0('0x77'),_0x6db0('0x78')]})[_0x6db0('0x25')](function(_0x41cf50){if(!_[_0x6db0('0x79')](_0x592b24)&&!_[_0x6db0('0x79')](_0x41cf50['firstName'])){_0x4e0dc0[_0x6db0('0x7a')]=_0x41cf50[_0x6db0('0x77')];if(!_[_0x6db0('0x79')](_0x41cf50[_0x6db0('0x78')])){_0x4e0dc0['calleridname']+='\x20'+_0x41cf50[_0x6db0('0x78')];}}})[_0x6db0('0x7b')](function(){return db[_0x6db0('0x7c')][_0x6db0('0x5d')](_0x4e0dc0);});}})[_0x6db0('0x25')](function(){return _0x592b24[_0x6db0('0x1f')](0xcc)['end']();})[_0x6db0('0x58')](handleError(_0x592b24,null));};exports[_0x6db0('0x7d')]=function(_0x1f46a4,_0x4dc2c2,_0x29ac84){var _0x199b55=[];return db[_0x6db0('0x75')]['describe']()[_0x6db0('0x25')](function(_0x42837c){_0x199b55=_[_0x6db0('0x32')](_0x42837c);return _0x1f46a4[_0x6db0('0x6b')][_0x6db0('0x7e')]({'where':{'type':_0x6db0('0x7f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x2ffba5){if(_0x2ffba5&&_0x2ffba5['length']){return db['sequelize'][_0x6db0('0x80')](function(_0x26cd9e){var _0x5c87d3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6db0('0x6e')](_0x6db0('0x6f'))},'VoiceQueueId':{'$in':_['map'](_0x2ffba5,'id')},'$or':[{'UserId':null},{'UserId':_0x1f46a4[_0x6db0('0x6b')]['id']}]};var _0x64fb2e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2ffba5)[_0x6db0('0x53')]([_0x6db0('0x81'),0x0])[_0x6db0('0x2b')]('id')[_0x6db0('0x82')]()},'$or':[{'UserId':null},{'UserId':_0x1f46a4[_0x6db0('0x6b')]['id']}]};var _0x4e0f3b={'$or':[_0x5c87d3,_0x64fb2e]};var _0x3e70fe=[];if(_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x83')]&&_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x83')]===_0x6db0('0x84')){if(!_[_0x6db0('0x85')](_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x86')])){_0x4e0f3b['id']={'$in':_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x86')]};}_0x3e70fe=[['priority','ASC'],['scheduledAt',_0x2ffba5[0x0][_0x6db0('0x87')]===_0x6db0('0x88')?_0x6db0('0x89'):_0x6db0('0x88')],db[_0x6db0('0x8a')][_0x6db0('0x8b')](_0x6db0('0x8c')),['id',_0x6db0('0x89')]];}else{if(!_[_0x6db0('0x85')](_0x1f46a4[_0x6db0('0x5e')][_0x6db0('0x86')])){_0x4e0f3b['id']={'$notIn':_0x1f46a4[_0x6db0('0x5e')]['hopperIds']};}_0x3e70fe=[[_0x6db0('0x8d'),_0x6db0('0x89')],[_0x6db0('0x8e'),_0x2ffba5[0x0][_0x6db0('0x87')]],db[_0x6db0('0x8a')][_0x6db0('0x8b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6db0('0x88')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x6db0('0x8f'),'recallme'],'where':_0x4e0f3b,'order':_0x3e70fe,'transaction':_0x26cd9e,'lock':_0x26cd9e['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6db0('0x90'),'attributes':_0x199b55,'include':[{'model':db[_0x6db0('0x91')],'as':'Company','attributes':['id',_0x6db0('0x28')]}]},{'model':db[_0x6db0('0x92')],'as':_0x6db0('0x93'),'attributes':['id',_0x6db0('0x28')]},{'model':db[_0x6db0('0x62')],'as':_0x6db0('0x94'),'attributes':['id',_0x6db0('0x28'),_0x6db0('0x95')]}]})['then'](function(_0x4ad66a){if(_0x4ad66a){return _0x4ad66a['update']({'UserId':_0x1f46a4['user']['id']},{'transaction':_0x26cd9e});}});});}})[_0x6db0('0x25')](handleEntityNotFound(_0x4dc2c2,null))[_0x6db0('0x25')](respondWithResult(_0x4dc2c2,null))[_0x6db0('0x58')](handleError(_0x4dc2c2,null));};exports[_0x6db0('0x96')]=function(_0xf5fd12,_0x52fe99,_0x36f6c5){var _0x3eadd9=[];return db[_0x6db0('0x75')][_0x6db0('0x5f')]()[_0x6db0('0x25')](function(_0x10b703){_0x3eadd9=_[_0x6db0('0x32')](_0x10b703);return _0xf5fd12['user'][_0x6db0('0x7e')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6db0('0x97')},'attributes':['id','dialOrderByScheduledAt',_0x6db0('0x81')],'raw':!![]});})[_0x6db0('0x25')](function(_0x5312e4){if(_0x5312e4&&_0x5312e4['length']){return db[_0x6db0('0x8a')][_0x6db0('0x80')](function(_0x43e570){var _0x4661e7={'active':![],'recallme':!![],'id':_0xf5fd12[_0x6db0('0x5e')][_0x6db0('0x98')]};return db['CmHopper'][_0x6db0('0x99')]({'attributes':['id',_0x6db0('0x8f'),_0x6db0('0x9a')],'where':_0x4661e7,'transaction':_0x43e570,'lock':_0x43e570[_0x6db0('0x9b')][_0x6db0('0x9c')],'include':[{'model':db[_0x6db0('0x75')],'as':_0x6db0('0x90'),'attributes':_0x3eadd9,'include':[{'model':db[_0x6db0('0x91')],'as':_0x6db0('0x9d'),'attributes':['id',_0x6db0('0x28')]}]},{'model':db['CmList'],'as':_0x6db0('0x93'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x6db0('0x94'),'attributes':['id',_0x6db0('0x28'),_0x6db0('0x95')]}]})[_0x6db0('0x25')](function(_0x5cac11){if(_0x5cac11){return _0x5cac11['update']({'UserId':_0xf5fd12[_0x6db0('0x6b')]['id']},{'transaction':_0x43e570});}});});}})[_0x6db0('0x25')](handleEntityNotFound(_0x52fe99,null))[_0x6db0('0x25')](respondWithResult(_0x52fe99,null))[_0x6db0('0x58')](handleError(_0x52fe99,null));};exports[_0x6db0('0x9e')]=function(_0x180b0d,_0x30feb9,_0x1d3a11){return _0x180b0d[_0x6db0('0x6b')][_0x6db0('0x7e')]({'where':{'type':_0x6db0('0x7f'),'dialActive':!![],'dialMethod':_0x6db0('0x97')},'attributes':['id'],'raw':!![]})['then'](function(_0x404ba7){if(_0x404ba7&&_0x404ba7[_0x6db0('0x4a')]){return db[_0x6db0('0x2c')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6db0('0x2b')](_0x404ba7,'id')},'$or':[{'UserId':null},{'UserId':_0x180b0d[_0x6db0('0x6b')]['id']}]}});}return 0x0;})[_0x6db0('0x25')](function(_0x12e193){if(!_[_0x6db0('0x79')](_0x12e193)&&_[_0x6db0('0x9f')](_0x12e193)){return _0x30feb9['status'](0xc8)['json']({'contacts':_0x12e193});}else{logger['error'](_0x6db0('0xa0'),_0x6db0('0x9e'),0x194,_0x6db0('0xa1'));_0x30feb9[_0x6db0('0x18')](0x194);}})[_0x6db0('0x58')](handleError(_0x30feb9,null));};exports[_0x6db0('0xa2')]=function(_0x3a60d2,_0x44e115,_0x1bc18f){var _0x406103=shared[_0x6db0('0xa3')];var _0xfd713c=[];_['map'](_0x406103,function(_0x344981){_0xfd713c['push']({'id':_0x344981[_0x6db0('0x28')],'name':_0x344981[_0x6db0('0x28')],'utcOffset':_0x344981[_0x6db0('0xa4')]});});return _0x44e115[_0x6db0('0x1f')](0xc8)[_0x6db0('0x1a')]({'tz':_0xfd713c});};exports['getTimezone']=function(_0x3d353d,_0x4751d0,_0xcb9a0f){var _0x266549=shared[_0x6db0('0xa3')];var _0xc53636={};if(!_[_0x6db0('0x79')](_0x266549[_0x3d353d[_0x6db0('0x5e')]['id']]))_0xc53636=_0x266549[_0x3d353d['body']['id']];return _0x4751d0[_0x6db0('0x1f')](0xc8)[_0x6db0('0x1a')](_0xc53636);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d1cac47..9dcb738 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 _0xbd51=['./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5b476e,_0x3ac5d3){_0x5b476e=_0x5b476e-0x0;var _0x388d41=_0xbd51[_0x5b476e];return _0x388d41;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'name':_0x1bd5('0xa'),'fields':[_0x1bd5('0xa')]},{'name':'phone','fields':[_0x1bd5('0xb')]},{'name':'priority','fields':[_0x1bd5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xd117,0x182));var _0x7d11=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xd117[_0x544099];return _0x20ab09;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b14c3b0..e2453e4 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 _0xabec=['stringify','error','message','info','catch','GetCmHopper','CmHopper','options','raw','where','limit','include','map','model','attributes','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','findAll','order','LOCK','CmContact','Contact','keys','User','Agent','name','voicePause','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','UserId','UPDATE','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','\x20MINUTE','CmList','List','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1705e9,_0x394f32){var _0x33285a=function(_0x42f603){while(--_0x42f603){_0x1705e9['push'](_0x1705e9['shift']());}};_0x33285a(++_0x394f32);}(_0xabec,0xf2));var _0xcabe=function(_0x376981,_0x4c338c){_0x376981=_0x376981-0x0;var _0x4ab265=_0xabec[_0x376981];return _0x4ab265;};'use strict';var _=require(_0xcabe('0x0'));var util=require(_0xcabe('0x1'));var moment=require(_0xcabe('0x2'));var BPromise=require(_0xcabe('0x3'));var rs=require(_0xcabe('0x4'));var fs=require('fs');var Redis=require(_0xcabe('0x5'));var db=require(_0xcabe('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcabe('0x7'));var config=require(_0xcabe('0x8'));var jayson=require('jayson/promise');const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0xcabe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54c2a1,_0x4f9853,_0x5364ba){return new BPromise(function(_0x3a8188,_0x2954e9){return client[_0xcabe('0xa')](_0x54c2a1,_0x5364ba)[_0xcabe('0xb')](function(_0x54b477){logger['info'](_0xcabe('0xc'),_0x4f9853,'request\x20sent');logger[_0xcabe('0xd')](_0xcabe('0xe'),_0x4f9853,_0xcabe('0xf'),JSON[_0xcabe('0x10')](_0x54b477));if(_0x54b477[_0xcabe('0x11')]){if(_0x54b477[_0xcabe('0x11')]['code']===0x1f4){logger['error'](_0xcabe('0xc'),_0x4f9853,_0x54b477['error'][_0xcabe('0x12')]);return _0x2954e9(_0x54b477['error']['message']);}logger[_0xcabe('0x11')]('CmHopper,\x20%s,\x20%s',_0x4f9853,_0x54b477[_0xcabe('0x11')][_0xcabe('0x12')]);return _0x3a8188(_0x54b477[_0xcabe('0x11')][_0xcabe('0x12')]);}else{logger[_0xcabe('0x13')](_0xcabe('0xc'),_0x4f9853,_0xcabe('0xf'));_0x3a8188(_0x54b477['result']['message']);}})[_0xcabe('0x14')](function(_0x184460){logger[_0xcabe('0x11')](_0xcabe('0xc'),_0x4f9853,_0x184460);_0x2954e9(_0x184460);});});}exports[_0xcabe('0x15')]=function(_0x1650a3){var _0x51decd=this;return new Promise(function(_0xb71ff1,_0xc7e6b9){return db[_0xcabe('0x16')]['findAll']({'raw':_0x1650a3[_0xcabe('0x17')]?_0x1650a3['options'][_0xcabe('0x18')]===undefined?!![]:![]:!![],'where':_0x1650a3['options']?_0x1650a3[_0xcabe('0x17')][_0xcabe('0x19')]||null:null,'attributes':_0x1650a3[_0xcabe('0x17')]?_0x1650a3['options']['attributes']||null:null,'limit':_0x1650a3[_0xcabe('0x17')]?_0x1650a3['options'][_0xcabe('0x1a')]||null:null,'include':_0x1650a3[_0xcabe('0x17')]?_0x1650a3[_0xcabe('0x17')][_0xcabe('0x1b')]?_[_0xcabe('0x1c')](_0x1650a3[_0xcabe('0x17')][_0xcabe('0x1b')],function(_0x422007){return{'model':db[_0x422007[_0xcabe('0x1d')]],'as':_0x422007['as'],'attributes':_0x422007[_0xcabe('0x1e')],'include':_0x422007[_0xcabe('0x1b')]?_['map'](_0x422007[_0xcabe('0x1b')],function(_0x2317e3){return{'model':db[_0x2317e3[_0xcabe('0x1d')]],'as':_0x2317e3['as'],'attributes':_0x2317e3[_0xcabe('0x1e')],'include':_0x2317e3['include']?_[_0xcabe('0x1c')](_0x2317e3[_0xcabe('0x1b')],function(_0x25402a){return{'model':db[_0x25402a['model']],'as':_0x25402a['as'],'attributes':_0x25402a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x407920){logger[_0xcabe('0x13')](_0xcabe('0x15'),_0x1650a3);logger['debug'](_0xcabe('0x15'),_0x1650a3,JSON['stringify'](_0x407920));_0xb71ff1(_0x407920);})[_0xcabe('0x14')](function(_0x2f7b32){logger[_0xcabe('0x11')](_0xcabe('0x15'),_0x2f7b32[_0xcabe('0x12')],_0x1650a3);_0xc7e6b9(_0x51decd['error'](0x1f4,_0x2f7b32['message']));});});};exports[_0xcabe('0x1f')]=function(_0x5e6810){var _0x12d2d0=this;return new Promise(function(_0x39a34c,_0x18c0fc){return db[_0xcabe('0x16')][_0xcabe('0x20')]({'raw':_0x5e6810[_0xcabe('0x17')]?_0x5e6810[_0xcabe('0x17')][_0xcabe('0x18')]===undefined?!![]:![]:!![],'where':_0x5e6810[_0xcabe('0x17')]?_0x5e6810[_0xcabe('0x17')][_0xcabe('0x19')]||null:null,'attributes':_0x5e6810[_0xcabe('0x17')]?_0x5e6810[_0xcabe('0x17')][_0xcabe('0x1e')]||null:null,'include':_0x5e6810[_0xcabe('0x17')]?_0x5e6810[_0xcabe('0x17')][_0xcabe('0x1b')]?_[_0xcabe('0x1c')](_0x5e6810['options'][_0xcabe('0x1b')],function(_0x4c4448){return{'model':db[_0x4c4448[_0xcabe('0x1d')]],'as':_0x4c4448['as'],'attributes':_0x4c4448[_0xcabe('0x1e')],'include':_0x4c4448[_0xcabe('0x1b')]?_['map'](_0x4c4448[_0xcabe('0x1b')],function(_0x42b560){return{'model':db[_0x42b560[_0xcabe('0x1d')]],'as':_0x42b560['as'],'attributes':_0x42b560['attributes'],'include':_0x42b560[_0xcabe('0x1b')]?_['map'](_0x42b560[_0xcabe('0x1b')],function(_0x432c63){return{'model':db[_0x432c63['model']],'as':_0x432c63['as'],'attributes':_0x432c63[_0xcabe('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d2129){logger[_0xcabe('0x13')]('ShowCmHopper',_0x5e6810);logger['debug'](_0xcabe('0x1f'),_0x5e6810,JSON[_0xcabe('0x10')](_0x4d2129));_0x39a34c(_0x4d2129);})[_0xcabe('0x14')](function(_0x37d1a3){logger['error'](_0xcabe('0x1f'),_0x37d1a3[_0xcabe('0x12')],_0x5e6810);_0x18c0fc(_0x12d2d0['error'](0x1f4,_0x37d1a3[_0xcabe('0x12')]));});});};exports[_0xcabe('0x21')]=function(_0x59c3f9){var _0x120ba3=this;return new Promise(function(_0x5cb06b,_0x122f8b){return db[_0xcabe('0x16')][_0xcabe('0x22')](_0x59c3f9[_0xcabe('0x23')],{'raw':_0x59c3f9[_0xcabe('0x17')]?_0x59c3f9['options'][_0xcabe('0x18')]===undefined?!![]:![]:!![]})[_0xcabe('0xb')](function(_0x4a72cc){logger[_0xcabe('0x13')](_0xcabe('0x21'),_0x59c3f9);logger[_0xcabe('0xd')]('CreateCmHopper',_0x59c3f9,JSON['stringify'](_0x4a72cc));_0x5cb06b(_0x4a72cc);})[_0xcabe('0x14')](function(_0x6a8e3){logger[_0xcabe('0x11')]('CreateCmHopper',_0x6a8e3['message'],_0x59c3f9);_0x122f8b(_0x120ba3[_0xcabe('0x11')](0x1f4,_0x6a8e3[_0xcabe('0x12')]));});});};exports[_0xcabe('0x24')]=function(_0x2c9add){var _0x20b304=this;return new Promise(function(_0x2aa4c8,_0x2299e6){return db[_0xcabe('0x16')][_0xcabe('0x25')](_0x2c9add[_0xcabe('0x23')],{'raw':_0x2c9add['options']?_0x2c9add[_0xcabe('0x17')][_0xcabe('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9add[_0xcabe('0x17')]?_0x2c9add[_0xcabe('0x17')]['where']||null:null,'attributes':_0x2c9add[_0xcabe('0x17')]?_0x2c9add['options'][_0xcabe('0x1e')]||null:null,'limit':_0x2c9add[_0xcabe('0x17')]?_0x2c9add['options']['limit']||null:null})[_0xcabe('0xb')](function(_0x25ca7d){logger['info'](_0xcabe('0x24'),_0x2c9add);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xcabe('0x10')](_0x2c9add['options'][_0xcabe('0x19')]),_0x2c9add['body']['active']);logger[_0xcabe('0xd')](_0xcabe('0x24'),_0x2c9add,JSON[_0xcabe('0x10')](_0x25ca7d));_0x2aa4c8(_0x25ca7d);})['catch'](function(_0x2b8dfa){logger[_0xcabe('0x11')](_0xcabe('0x24'),_0x2b8dfa[_0xcabe('0x12')],_0x2c9add);_0x2299e6(_0x20b304['error'](0x1f4,_0x2b8dfa[_0xcabe('0x12')]));});});};exports[_0xcabe('0x26')]=function(_0x38b901){var _0x46dbd0=this;return new Promise(function(_0x43b2bf,_0x464e07){return db[_0xcabe('0x16')][_0xcabe('0x27')]({'where':_0x38b901[_0xcabe('0x17')]?_0x38b901[_0xcabe('0x17')][_0xcabe('0x19')]||null:null})[_0xcabe('0xb')](function(_0x38cccd){logger[_0xcabe('0x13')]('DestroyCmHopper',_0x38b901);logger[_0xcabe('0xd')](_0xcabe('0x26'),_0x38b901,JSON[_0xcabe('0x10')](_0x38cccd));_0x43b2bf(_0x38cccd);})[_0xcabe('0x14')](function(_0x4304d1){logger['error'](_0xcabe('0x26'),_0x4304d1[_0xcabe('0x12')],_0x38b901);_0x464e07(_0x46dbd0[_0xcabe('0x11')](0x1f4,_0x4304d1[_0xcabe('0x12')]));});});};exports[_0xcabe('0x28')]=function(_0x2d532c){var _0x2d0258=this;return new Promise(function(_0x3eb67f,_0x3fcade){return db['CmContact'][_0xcabe('0x29')]()['then'](function(_0x248659){return db[_0xcabe('0x2a')][_0xcabe('0x2b')](function(_0x3d1d5c){return db[_0xcabe('0x16')][_0xcabe('0x2c')]({'where':_0x2d532c[_0xcabe('0x17')]?_0x2d532c['options'][_0xcabe('0x19')]||null:null,'attributes':_0x2d532c[_0xcabe('0x17')]?_0x2d532c[_0xcabe('0x17')][_0xcabe('0x1e')]||null:null,'limit':_0x2d532c[_0xcabe('0x17')]?_0x2d532c['options'][_0xcabe('0x1a')]||null:null,'order':_0x2d532c[_0xcabe('0x17')]?_0x2d532c[_0xcabe('0x17')][_0xcabe('0x2d')]||null:null,'transaction':_0x3d1d5c,'lock':_0x3d1d5c[_0xcabe('0x2e')]['UPDATE'],'include':[{'model':db[_0xcabe('0x2f')],'as':_0xcabe('0x30'),'attributes':_[_0xcabe('0x31')](_0x248659)},{'model':db[_0xcabe('0x32')],'as':_0xcabe('0x33'),'attributes':['id',_0xcabe('0x34'),_0xcabe('0x35')]}]})[_0xcabe('0xb')](function(_0x572497){var _0x4aa1ea=[];var _0x1bc0f8=[];for(var _0x10201f=0x0;_0x10201f<_0x572497['length'];_0x10201f+=0x1){var _0x1fdbb3=_0x572497[_0x10201f]['UserId'];if(_0x1fdbb3===null){_0x4aa1ea[_0xcabe('0x36')](_0x572497[_0x10201f][_0xcabe('0x25')](_0x2d532c[_0xcabe('0x23')],{'transaction':_0x3d1d5c}));}else if(!_0x1bc0f8[_0xcabe('0x37')](_0x1fdbb3)){_0x1bc0f8[_0xcabe('0x36')](_0x1fdbb3);_0x4aa1ea[_0xcabe('0x36')](_0x572497[_0x10201f][_0xcabe('0x25')](_0x2d532c['body'],{'transaction':_0x3d1d5c}));}}return BPromise[_0xcabe('0x38')](_0x4aa1ea);});})[_0xcabe('0xb')](function(_0x34aa15){logger[_0xcabe('0x13')]('GetContactDialer',_0x2d532c);if(_0x34aa15[_0xcabe('0x39')]>0x0){logger[_0xcabe('0x13')](_0xcabe('0x3a'),_0x34aa15[0x0][_0xcabe('0x3b')]['id'],_0x34aa15[0x0]['dataValues'][_0xcabe('0x3c')],_0x34aa15[0x0][_0xcabe('0x3b')]['active']);}logger[_0xcabe('0xd')](_0xcabe('0x28'),_0x2d532c,JSON[_0xcabe('0x10')](_0x34aa15));_0x3eb67f(_0x34aa15);})[_0xcabe('0x14')](function(_0x26570e){logger['error'](_0xcabe('0x28'),_0x26570e[_0xcabe('0x12')],_0x2d532c);_0x3fcade(_0x2d0258[_0xcabe('0x11')](0x1f4,_0x26570e[_0xcabe('0x12')]));});});});};exports[_0xcabe('0x3d')]=function(_0x27f49e){var _0xc3fdba=this;return new Promise(function(_0x4abefd,_0x3d89be){return db[_0xcabe('0x2a')][_0xcabe('0x2b')](function(_0x188fcf){return db[_0xcabe('0x3e')][_0xcabe('0x22')](_0x27f49e['body'],{'raw':_0x27f49e[_0xcabe('0x17')]?_0x27f49e[_0xcabe('0x17')][_0xcabe('0x18')]===undefined?!![]:![]:!![],'transaction':_0x188fcf})['then'](function(){logger['info'](_0xcabe('0x3f'),JSON[_0xcabe('0x10')](_0x27f49e[_0xcabe('0x17')]['where']),_0x27f49e['options']['where'][_0xcabe('0x40')]);return db['CmHopper']['destroy']({'where':_0x27f49e[_0xcabe('0x17')]?_0x27f49e[_0xcabe('0x17')][_0xcabe('0x19')]||null:null,'transaction':_0x188fcf});});})['then'](function(_0x2fe42b){logger[_0xcabe('0x13')](_0xcabe('0x3d'),_0x27f49e);logger[_0xcabe('0xd')]('MoveContactManagedDialer',_0x27f49e,JSON[_0xcabe('0x10')](_0x2fe42b));_0x4abefd(_0x2fe42b);})[_0xcabe('0x14')](function(_0x1a476a){logger['error'](_0xcabe('0x3d'),_0x1a476a['message'],_0x27f49e);_0x3d89be(_0xc3fdba[_0xcabe('0x11')](0x1f4,_0x1a476a['message']));});});};exports['CountReScheduled']=function(_0xd4846){var _0x1fc549=this;return new Promise(function(_0x15e2a4,_0x1b54d9){return db[_0xcabe('0x16')][_0xcabe('0x2c')]({'raw':_0xd4846[_0xcabe('0x17')]?_0xd4846['options'][_0xcabe('0x18')]===undefined?!![]:![]:!![],'where':_0xd4846[_0xcabe('0x17')]?_0xd4846['options'][_0xcabe('0x19')]||null:null,'attributes':[[db[_0xcabe('0x2a')]['fn'](_0xcabe('0x41'),db['sequelize']['fn']('IF',db[_0xcabe('0x2a')][_0xcabe('0x42')](_0xcabe('0x43')+util[_0xcabe('0x44')](_0xcabe('0x45'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0xcabe('0x46')))),'contactsRescheduled']]})[_0xcabe('0xb')](function(_0x38e12a){logger[_0xcabe('0x13')]('CountReScheduled',_0xd4846);logger[_0xcabe('0xd')](_0xcabe('0x47'),_0xd4846,JSON[_0xcabe('0x10')](_0x38e12a));_0x15e2a4(_0x38e12a);})['catch'](function(_0x49b5cc){logger[_0xcabe('0x11')](_0xcabe('0x47'),_0x49b5cc[_0xcabe('0x12')],_0xd4846);_0x1b54d9(_0x1fc549[_0xcabe('0x11')](0x1f4,_0x49b5cc['message']));});});};exports[_0xcabe('0x48')]=function(_0x5751df){var _0x2c65c9=this;return new Promise(function(_0x33d9ed,_0x2edf88){return db['CmContact'][_0xcabe('0x29')]()[_0xcabe('0xb')](function(_0x302a2c){return db[_0xcabe('0x2a')][_0xcabe('0x2b')](function(_0x2fb405){return db[_0xcabe('0x16')][_0xcabe('0x2c')]({'where':_0x5751df[_0xcabe('0x17')]?_0x5751df[_0xcabe('0x17')]['where']||null:null,'attributes':_0x5751df[_0xcabe('0x17')]?_0x5751df[_0xcabe('0x17')]['attributes']||null:null,'limit':0x1,'order':_0x5751df['options']?_0x5751df[_0xcabe('0x17')]['order']||null:null,'group':db[_0xcabe('0x16')][_0xcabe('0x49')],'transaction':_0x2fb405,'lock':_0x2fb405[_0xcabe('0x2e')][_0xcabe('0x4a')],'include':_0x5751df[_0xcabe('0x17')]?_0x5751df['options'][_0xcabe('0x1b')]?_[_0xcabe('0x1c')](_0x5751df[_0xcabe('0x17')]['include'],function(_0x57cae4){return{'model':db[_0x57cae4[_0xcabe('0x1d')]],'as':_0x57cae4['as'],'attributes':_0x57cae4[_0xcabe('0x1e')],'include':_0x57cae4[_0xcabe('0x1b')]?_[_0xcabe('0x1c')](_0x57cae4[_0xcabe('0x1b')],function(_0x3ec104){return{'model':db[_0x3ec104['model']],'as':_0x3ec104['as'],'attributes':_0x3ec104[_0xcabe('0x1e')],'include':_0x3ec104[_0xcabe('0x1b')]?_[_0xcabe('0x1c')](_0x3ec104[_0xcabe('0x1b')],function(_0x59a55c){return{'model':db[_0x59a55c[_0xcabe('0x1d')]],'as':_0x59a55c['as'],'attributes':_0x59a55c[_0xcabe('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17a10d){var _0x20c8a4=[];for(var _0x28d42f=0x0;_0x28d42f<_0x17a10d['length'];_0x28d42f+=0x1){_0x20c8a4['push'](_0x17a10d[_0x28d42f][_0xcabe('0x25')](_0x5751df[_0xcabe('0x23')],{'transaction':_0x2fb405}));}return BPromise[_0xcabe('0x38')](_0x20c8a4);});})[_0xcabe('0xb')](function(_0x3be137){logger['info']('GetContactRecallMe',_0x5751df);logger[_0xcabe('0xd')](_0xcabe('0x48'),_0x5751df,JSON['stringify'](_0x3be137));_0x33d9ed(_0x3be137);})[_0xcabe('0x14')](function(_0x469d00){logger[_0xcabe('0x11')]('GetContactRecallMe',_0x469d00[_0xcabe('0x12')],_0x5751df);_0x2edf88(_0x2c65c9[_0xcabe('0x11')](0x1f4,_0x469d00[_0xcabe('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x6a1a06){var _0x127bc3=this;return new Promise(function(_0x49bf22,_0x3293bc){db[_0xcabe('0x2f')][_0xcabe('0x29')]()[_0xcabe('0xb')](function(_0x4dc988){return db[_0xcabe('0x16')][_0xcabe('0x2c')]({'raw':_0x6a1a06[_0xcabe('0x17')]?_0x6a1a06[_0xcabe('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x6a1a06['options']?_0x6a1a06[_0xcabe('0x17')][_0xcabe('0x19')]||null:null,'attributes':_0x6a1a06[_0xcabe('0x17')]?_0x6a1a06[_0xcabe('0x17')][_0xcabe('0x1e')]||null:null,'limit':_0x6a1a06[_0xcabe('0x17')]?_0x6a1a06['options'][_0xcabe('0x1a')]||null:null,'include':_0x6a1a06['options']?_0x6a1a06['options'][_0xcabe('0x1b')]?_[_0xcabe('0x1c')](_0x6a1a06[_0xcabe('0x17')][_0xcabe('0x1b')],function(_0x220f83){return{'model':db[_0x220f83[_0xcabe('0x1d')]],'as':_0x220f83['as'],'attributes':_0x220f83['as']==='Contact'?_[_0xcabe('0x31')](_0x4dc988):_0x220f83[_0xcabe('0x1e')],'include':_0x220f83[_0xcabe('0x1b')]?_['map'](_0x220f83['include'],function(_0x38dd7e){return{'model':db[_0x38dd7e[_0xcabe('0x1d')]],'as':_0x38dd7e['as'],'attributes':_0x38dd7e[_0xcabe('0x1e')],'include':_0x38dd7e[_0xcabe('0x1b')]?_['map'](_0x38dd7e[_0xcabe('0x1b')],function(_0x2c3c9c){return{'model':db[_0x2c3c9c[_0xcabe('0x1d')]],'as':_0x2c3c9c['as'],'attributes':_0x2c3c9c[_0xcabe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcabe('0xb')](function(_0x44e2cf){logger['info'](_0xcabe('0x15'),_0x6a1a06);logger[_0xcabe('0xd')](_0xcabe('0x15'),_0x6a1a06,JSON['stringify'](_0x44e2cf));_0x49bf22(_0x44e2cf);})[_0xcabe('0x14')](function(_0x37983c){logger[_0xcabe('0x11')](_0xcabe('0x15'),_0x37983c[_0xcabe('0x12')],_0x6a1a06);_0x3293bc(_0x127bc3[_0xcabe('0x11')](0x1f4,_0x37983c[_0xcabe('0x12')]));});});});};exports['GetContactByPhone']=function(_0x530e13){var _0x134e60=this;return new Promise(function(_0x4b3257,_0x1626de){return db['CmContact'][_0xcabe('0x4b')]({'raw':!![],'where':{'phone':_0x530e13[_0xcabe('0x17')][_0xcabe('0x19')][_0xcabe('0x4c')]},'attributes':['id',_0xcabe('0x4d')],'order':[['id',_0xcabe('0x4e')]]})[_0xcabe('0xb')](function(_0x5ba9d2){logger[_0xcabe('0x13')](_0xcabe('0x4f'),_0x530e13);logger['debug']('getContactByPhone',_0x530e13,JSON[_0xcabe('0x10')](_0x5ba9d2));_0x4b3257(_0x5ba9d2);})[_0xcabe('0x14')](function(_0x418ff4){logger['error'](_0xcabe('0x4f'),_0x418ff4[_0xcabe('0x12')],_0x530e13);_0x1626de(_0x134e60['error'](0x1f4,_0x418ff4[_0xcabe('0x12')]));});});};exports[_0xcabe('0x50')]=function(_0xf526cc){var _0x2dcfd5=this;return new Promise(function(_0x376790,_0x42a13f){return db[_0xcabe('0x2a')][_0xcabe('0x2b')](function(_0x15d574){return db[_0xcabe('0x16')][_0xcabe('0x25')]({'active':![]},{'where':{},'transaction':_0x15d574})[_0xcabe('0xb')](function(_0x1330bc){logger[_0xcabe('0x13')](_0xcabe('0x50'),_0xf526cc);logger[_0xcabe('0xd')](_0xcabe('0x50'),_0xf526cc,JSON[_0xcabe('0x10')](_0x1330bc));_0x376790(_0x1330bc);})[_0xcabe('0x14')](function(_0x2f2cfd){logger[_0xcabe('0x11')]('ResetActiveCalls',_0x2f2cfd[_0xcabe('0x12')],_0xf526cc);_0x42a13f(_0x2dcfd5['error'](0x1f4,_0x2f2cfd[_0xcabe('0x12')]));});});});};exports[_0xcabe('0x51')]=function(_0x492f1d){var _0x4b9a96=this;var _0x485f8e=_0x492f1d[_0xcabe('0x23')][_0xcabe('0x19')][_0xcabe('0x52')];var _0x25bc97=_0x492f1d['body'][_0xcabe('0x19')]['interval'];return new Promise(function(_0x1cb7ed,_0x4484ab){return db[_0xcabe('0x16')][_0xcabe('0x2c')]({'where':{'voiceQueueId':_0x485f8e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x25bc97+_0xcabe('0x53'))}},'include':[{'model':db[_0xcabe('0x2f')],'as':_0xcabe('0x30')},{'model':db[_0xcabe('0x32')],'as':'Agent','attributes':['id',_0xcabe('0x34'),_0xcabe('0x35')]},{'model':db[_0xcabe('0x54')],'as':_0xcabe('0x55')}]})[_0xcabe('0xb')](function(_0x57cf0f){return db['sequelize'][_0xcabe('0x2b')](function(_0x6e36e5){return db[_0xcabe('0x16')][_0xcabe('0x25')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x485f8e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xcabe('0x2a')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x25bc97+_0xcabe('0x53'))}},'transaction':_0x6e36e5})['then'](function(_0x23a98b){_0x1cb7ed(_0x57cf0f);})[_0xcabe('0x14')](function(_0x398900){logger[_0xcabe('0x11')](_0xcabe('0x51'),_0x398900[_0xcabe('0x12')],_0x492f1d);_0x4484ab(validateExpressRequest);});});})[_0xcabe('0x14')](function(_0x20d73c){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x20d73c['message'],_0x492f1d);_0x4484ab(_0x4b9a96['error'](0x1f4,_0x20d73c[_0xcabe('0x12')]));});});}; \ No newline at end of file +var _0x1b52=['phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','CmHopper','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne'];(function(_0x264585,_0xe94438){var _0x304257=function(_0x5e9f25){while(--_0x5e9f25){_0x264585['push'](_0x264585['shift']());}};_0x304257(++_0xe94438);}(_0x1b52,0x165));var _0x21b5=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x1b52[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x21b5('0x0'));var util=require(_0x21b5('0x1'));var moment=require(_0x21b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x21b5('0x3'));var fs=require('fs');var Redis=require(_0x21b5('0x4'));var db=require(_0x21b5('0x5'))['db'];var utils=require(_0x21b5('0x6'));var logger=require('../../config/logger')(_0x21b5('0x7'));var config=require(_0x21b5('0x8'));var jayson=require('jayson/promise');const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0x21b5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8f0b,_0xc1107a,_0x19fa03){return new BPromise(function(_0x406b24,_0x56e681){return client['request'](_0x3f8f0b,_0x19fa03)['then'](function(_0x4f1355){logger[_0x21b5('0xa')](_0x21b5('0xb'),_0xc1107a,_0x21b5('0xc'));logger[_0x21b5('0xd')](_0x21b5('0xe'),_0xc1107a,_0x21b5('0xc'),JSON['stringify'](_0x4f1355));if(_0x4f1355[_0x21b5('0xf')]){if(_0x4f1355[_0x21b5('0xf')][_0x21b5('0x10')]===0x1f4){logger['error'](_0x21b5('0xb'),_0xc1107a,_0x4f1355[_0x21b5('0xf')][_0x21b5('0x11')]);return _0x56e681(_0x4f1355['error'][_0x21b5('0x11')]);}logger[_0x21b5('0xf')](_0x21b5('0xb'),_0xc1107a,_0x4f1355[_0x21b5('0xf')][_0x21b5('0x11')]);return _0x406b24(_0x4f1355[_0x21b5('0xf')][_0x21b5('0x11')]);}else{logger[_0x21b5('0xa')](_0x21b5('0xb'),_0xc1107a,'request\x20sent');_0x406b24(_0x4f1355[_0x21b5('0x12')][_0x21b5('0x11')]);}})[_0x21b5('0x13')](function(_0x49f58a){logger[_0x21b5('0xf')]('CmHopper,\x20%s,\x20%s',_0xc1107a,_0x49f58a);_0x56e681(_0x49f58a);});});}exports[_0x21b5('0x14')]=function(_0x12ad29){var _0x5267ab=this;return new Promise(function(_0x280629,_0x74af6e){return db['CmHopper'][_0x21b5('0x15')]({'raw':_0x12ad29[_0x21b5('0x16')]?_0x12ad29[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0x12ad29[_0x21b5('0x16')]?_0x12ad29['options'][_0x21b5('0x18')]||null:null,'attributes':_0x12ad29[_0x21b5('0x16')]?_0x12ad29[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0x12ad29['options']?_0x12ad29['options'][_0x21b5('0x1a')]||null:null,'include':_0x12ad29[_0x21b5('0x16')]?_0x12ad29[_0x21b5('0x16')][_0x21b5('0x1b')]?_['map'](_0x12ad29[_0x21b5('0x16')][_0x21b5('0x1b')],function(_0x2801a8){return{'model':db[_0x2801a8[_0x21b5('0x1c')]],'as':_0x2801a8['as'],'attributes':_0x2801a8[_0x21b5('0x19')],'include':_0x2801a8[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x2801a8[_0x21b5('0x1b')],function(_0x1ec6cd){return{'model':db[_0x1ec6cd['model']],'as':_0x1ec6cd['as'],'attributes':_0x1ec6cd[_0x21b5('0x19')],'include':_0x1ec6cd[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x1ec6cd[_0x21b5('0x1b')],function(_0x19a45e){return{'model':db[_0x19a45e[_0x21b5('0x1c')]],'as':_0x19a45e['as'],'attributes':_0x19a45e[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x21b5('0x1e')](function(_0xa55da2){logger[_0x21b5('0xa')](_0x21b5('0x14'),_0x12ad29);logger['debug'](_0x21b5('0x14'),_0x12ad29,JSON[_0x21b5('0x1f')](_0xa55da2));_0x280629(_0xa55da2);})[_0x21b5('0x13')](function(_0xa21c69){logger['error'](_0x21b5('0x14'),_0xa21c69[_0x21b5('0x11')],_0x12ad29);_0x74af6e(_0x5267ab[_0x21b5('0xf')](0x1f4,_0xa21c69[_0x21b5('0x11')]));});});};exports['ShowCmHopper']=function(_0x4b20ea){var _0xe06f6a=this;return new Promise(function(_0xfce606,_0x1df18b){return db[_0x21b5('0x20')][_0x21b5('0x21')]({'raw':_0x4b20ea[_0x21b5('0x16')]?_0x4b20ea[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0x4b20ea['options']?_0x4b20ea[_0x21b5('0x16')][_0x21b5('0x18')]||null:null,'attributes':_0x4b20ea[_0x21b5('0x16')]?_0x4b20ea['options']['attributes']||null:null,'include':_0x4b20ea['options']?_0x4b20ea[_0x21b5('0x16')][_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x4b20ea['options']['include'],function(_0x3e24d5){return{'model':db[_0x3e24d5['model']],'as':_0x3e24d5['as'],'attributes':_0x3e24d5[_0x21b5('0x19')],'include':_0x3e24d5[_0x21b5('0x1b')]?_['map'](_0x3e24d5['include'],function(_0x51a497){return{'model':db[_0x51a497[_0x21b5('0x1c')]],'as':_0x51a497['as'],'attributes':_0x51a497[_0x21b5('0x19')],'include':_0x51a497[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x51a497['include'],function(_0x6cc21f){return{'model':db[_0x6cc21f['model']],'as':_0x6cc21f['as'],'attributes':_0x6cc21f[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x21b5('0x1e')](function(_0x29b5d8){logger[_0x21b5('0xa')]('ShowCmHopper',_0x4b20ea);logger[_0x21b5('0xd')](_0x21b5('0x22'),_0x4b20ea,JSON[_0x21b5('0x1f')](_0x29b5d8));_0xfce606(_0x29b5d8);})['catch'](function(_0x205bfc){logger[_0x21b5('0xf')](_0x21b5('0x22'),_0x205bfc[_0x21b5('0x11')],_0x4b20ea);_0x1df18b(_0xe06f6a['error'](0x1f4,_0x205bfc['message']));});});};exports['CreateCmHopper']=function(_0x555668){var _0x51ad02=this;return new Promise(function(_0x43c776,_0x368f50){return db[_0x21b5('0x20')][_0x21b5('0x23')](_0x555668[_0x21b5('0x24')],{'raw':_0x555668[_0x21b5('0x16')]?_0x555668[_0x21b5('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x21b5('0x1e')](function(_0x3fb439){logger[_0x21b5('0xa')](_0x21b5('0x25'),_0x555668);logger[_0x21b5('0xd')]('CreateCmHopper',_0x555668,JSON[_0x21b5('0x1f')](_0x3fb439));_0x43c776(_0x3fb439);})[_0x21b5('0x13')](function(_0x1ffdf7){logger['error']('CreateCmHopper',_0x1ffdf7[_0x21b5('0x11')],_0x555668);_0x368f50(_0x51ad02[_0x21b5('0xf')](0x1f4,_0x1ffdf7['message']));});});};exports[_0x21b5('0x26')]=function(_0x16585){var _0x39d3c4=this;return new Promise(function(_0x4795a4,_0x1cfafa){return db['CmHopper'][_0x21b5('0x27')](_0x16585['body'],{'raw':_0x16585[_0x21b5('0x16')]?_0x16585[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16585[_0x21b5('0x16')]?_0x16585['options'][_0x21b5('0x18')]||null:null,'attributes':_0x16585['options']?_0x16585[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0x16585['options']?_0x16585['options'][_0x21b5('0x1a')]||null:null})['then'](function(_0x6d9361){logger[_0x21b5('0xa')](_0x21b5('0x26'),_0x16585);logger[_0x21b5('0xa')](_0x21b5('0x28'),JSON['stringify'](_0x16585[_0x21b5('0x16')][_0x21b5('0x18')]),_0x16585[_0x21b5('0x24')][_0x21b5('0x29')]);logger[_0x21b5('0xd')](_0x21b5('0x26'),_0x16585,JSON['stringify'](_0x6d9361));_0x4795a4(_0x6d9361);})[_0x21b5('0x13')](function(_0x1dc451){logger['error'](_0x21b5('0x26'),_0x1dc451[_0x21b5('0x11')],_0x16585);_0x1cfafa(_0x39d3c4[_0x21b5('0xf')](0x1f4,_0x1dc451[_0x21b5('0x11')]));});});};exports[_0x21b5('0x2a')]=function(_0x6462ff){var _0x3124c2=this;return new Promise(function(_0x5ac946,_0x590be2){return db[_0x21b5('0x20')][_0x21b5('0x2b')]({'where':_0x6462ff[_0x21b5('0x16')]?_0x6462ff['options'][_0x21b5('0x18')]||null:null})[_0x21b5('0x1e')](function(_0x2b0000){logger[_0x21b5('0xa')](_0x21b5('0x2a'),_0x6462ff);logger[_0x21b5('0xd')]('DestroyCmHopper',_0x6462ff,JSON[_0x21b5('0x1f')](_0x2b0000));_0x5ac946(_0x2b0000);})[_0x21b5('0x13')](function(_0x3f2f22){logger[_0x21b5('0xf')](_0x21b5('0x2a'),_0x3f2f22['message'],_0x6462ff);_0x590be2(_0x3124c2['error'](0x1f4,_0x3f2f22[_0x21b5('0x11')]));});});};exports['GetContactDialer']=function(_0x4f97dc){var _0x12e3f3=this;return new Promise(function(_0xf43431,_0x1d5433){return db[_0x21b5('0x2c')][_0x21b5('0x2d')]()[_0x21b5('0x1e')](function(_0x4be55d){return db[_0x21b5('0x2e')][_0x21b5('0x2f')](function(_0x37b80d){return db[_0x21b5('0x20')]['findAll']({'where':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')][_0x21b5('0x18')]||null:null,'attributes':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')]['limit']||null:null,'order':_0x4f97dc[_0x21b5('0x16')]?_0x4f97dc[_0x21b5('0x16')]['order']||null:null,'transaction':_0x37b80d,'lock':_0x37b80d['LOCK']['UPDATE'],'include':[{'model':db[_0x21b5('0x2c')],'as':_0x21b5('0x30'),'attributes':_[_0x21b5('0x31')](_0x4be55d)},{'model':db[_0x21b5('0x32')],'as':_0x21b5('0x33'),'attributes':['id',_0x21b5('0x34'),_0x21b5('0x35')]}]})[_0x21b5('0x1e')](function(_0x2f96b4){var _0x550184=[];var _0x5e35ee=[];for(var _0x58cab9=0x0;_0x58cab9<_0x2f96b4[_0x21b5('0x36')];_0x58cab9+=0x1){var _0x11f18c=_0x2f96b4[_0x58cab9][_0x21b5('0x37')];if(_0x11f18c===null){_0x550184[_0x21b5('0x38')](_0x2f96b4[_0x58cab9][_0x21b5('0x27')](_0x4f97dc[_0x21b5('0x24')],{'transaction':_0x37b80d}));}else if(!_0x5e35ee[_0x21b5('0x39')](_0x11f18c)){_0x5e35ee[_0x21b5('0x38')](_0x11f18c);_0x550184[_0x21b5('0x38')](_0x2f96b4[_0x58cab9]['update'](_0x4f97dc[_0x21b5('0x24')],{'transaction':_0x37b80d}));}}return BPromise['all'](_0x550184);});})[_0x21b5('0x1e')](function(_0x583b01){logger[_0x21b5('0xa')](_0x21b5('0x3a'),_0x4f97dc);if(_0x583b01[_0x21b5('0x36')]>0x0){logger[_0x21b5('0xa')](_0x21b5('0x3b'),_0x583b01[0x0][_0x21b5('0x3c')]['id'],_0x583b01[0x0][_0x21b5('0x3c')][_0x21b5('0x3d')],_0x583b01[0x0][_0x21b5('0x3c')][_0x21b5('0x29')]);}logger[_0x21b5('0xd')](_0x21b5('0x3a'),_0x4f97dc,JSON[_0x21b5('0x1f')](_0x583b01));_0xf43431(_0x583b01);})['catch'](function(_0x52f7ad){logger['error'](_0x21b5('0x3a'),_0x52f7ad[_0x21b5('0x11')],_0x4f97dc);_0x1d5433(_0x12e3f3[_0x21b5('0xf')](0x1f4,_0x52f7ad[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x3e')]=function(_0x2ee10c){var _0xb91ca2=this;return new Promise(function(_0x10f73d,_0x1c5304){return db['sequelize'][_0x21b5('0x2f')](function(_0x11ad95){return db[_0x21b5('0x3f')][_0x21b5('0x23')](_0x2ee10c[_0x21b5('0x24')],{'raw':_0x2ee10c[_0x21b5('0x16')]?_0x2ee10c[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'transaction':_0x11ad95})[_0x21b5('0x1e')](function(){logger[_0x21b5('0xa')](_0x21b5('0x40'),JSON['stringify'](_0x2ee10c['options'][_0x21b5('0x18')]),_0x2ee10c['options'][_0x21b5('0x18')][_0x21b5('0x29')]);return db[_0x21b5('0x20')][_0x21b5('0x2b')]({'where':_0x2ee10c[_0x21b5('0x16')]?_0x2ee10c[_0x21b5('0x16')]['where']||null:null,'transaction':_0x11ad95});});})[_0x21b5('0x1e')](function(_0x24a333){logger[_0x21b5('0xa')](_0x21b5('0x3e'),_0x2ee10c);logger[_0x21b5('0xd')]('MoveContactManagedDialer',_0x2ee10c,JSON[_0x21b5('0x1f')](_0x24a333));_0x10f73d(_0x24a333);})[_0x21b5('0x13')](function(_0x482be0){logger['error'](_0x21b5('0x3e'),_0x482be0['message'],_0x2ee10c);_0x1c5304(_0xb91ca2[_0x21b5('0xf')](0x1f4,_0x482be0[_0x21b5('0x11')]));});});};exports[_0x21b5('0x41')]=function(_0x3ca7e1){var _0xa0c7c0=this;return new Promise(function(_0x16e468,_0x8da82d){return db[_0x21b5('0x20')][_0x21b5('0x15')]({'raw':_0x3ca7e1['options']?_0x3ca7e1[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0x3ca7e1[_0x21b5('0x16')]?_0x3ca7e1[_0x21b5('0x16')][_0x21b5('0x18')]||null:null,'attributes':[[db[_0x21b5('0x2e')]['fn'](_0x21b5('0x42'),db[_0x21b5('0x2e')]['fn']('IF',db[_0x21b5('0x2e')][_0x21b5('0x43')](_0x21b5('0x44')+util[_0x21b5('0x45')](_0x21b5('0x46'),moment()[_0x21b5('0x45')](_0x21b5('0x47')))+'\x20,\x201,\x20null'))),_0x21b5('0x48')]]})[_0x21b5('0x1e')](function(_0x2126e2){logger[_0x21b5('0xa')](_0x21b5('0x41'),_0x3ca7e1);logger[_0x21b5('0xd')]('CountReScheduled',_0x3ca7e1,JSON[_0x21b5('0x1f')](_0x2126e2));_0x16e468(_0x2126e2);})[_0x21b5('0x13')](function(_0x48594d){logger[_0x21b5('0xf')]('CountReScheduled',_0x48594d[_0x21b5('0x11')],_0x3ca7e1);_0x8da82d(_0xa0c7c0[_0x21b5('0xf')](0x1f4,_0x48594d[_0x21b5('0x11')]));});});};exports[_0x21b5('0x49')]=function(_0x4d6150){var _0x32038f=this;return new Promise(function(_0x5fa0a6,_0x6cd996){return db[_0x21b5('0x2c')][_0x21b5('0x2d')]()[_0x21b5('0x1e')](function(_0x3b9b2b){return db[_0x21b5('0x2e')]['transaction'](function(_0x5e6fe1){return db[_0x21b5('0x20')][_0x21b5('0x15')]({'where':_0x4d6150[_0x21b5('0x16')]?_0x4d6150['options'][_0x21b5('0x18')]||null:null,'attributes':_0x4d6150['options']?_0x4d6150[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':0x1,'order':_0x4d6150['options']?_0x4d6150[_0x21b5('0x16')]['order']||null:null,'group':db[_0x21b5('0x20')][_0x21b5('0x37')],'transaction':_0x5e6fe1,'lock':_0x5e6fe1['LOCK'][_0x21b5('0x4a')],'include':_0x4d6150[_0x21b5('0x16')]?_0x4d6150[_0x21b5('0x16')]['include']?_[_0x21b5('0x1d')](_0x4d6150[_0x21b5('0x16')][_0x21b5('0x1b')],function(_0x577617){return{'model':db[_0x577617[_0x21b5('0x1c')]],'as':_0x577617['as'],'attributes':_0x577617['attributes'],'include':_0x577617[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x577617[_0x21b5('0x1b')],function(_0x35c41d){return{'model':db[_0x35c41d['model']],'as':_0x35c41d['as'],'attributes':_0x35c41d[_0x21b5('0x19')],'include':_0x35c41d[_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0x35c41d[_0x21b5('0x1b')],function(_0x496a32){return{'model':db[_0x496a32[_0x21b5('0x1c')]],'as':_0x496a32['as'],'attributes':_0x496a32[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x21b5('0x1e')](function(_0x45fbc9){var _0x169e57=[];for(var _0x1fd5b3=0x0;_0x1fd5b3<_0x45fbc9['length'];_0x1fd5b3+=0x1){_0x169e57['push'](_0x45fbc9[_0x1fd5b3]['update'](_0x4d6150[_0x21b5('0x24')],{'transaction':_0x5e6fe1}));}return BPromise['all'](_0x169e57);});})[_0x21b5('0x1e')](function(_0x28e2e3){logger[_0x21b5('0xa')](_0x21b5('0x49'),_0x4d6150);logger['debug']('GetContactRecallMe',_0x4d6150,JSON[_0x21b5('0x1f')](_0x28e2e3));_0x5fa0a6(_0x28e2e3);})[_0x21b5('0x13')](function(_0x395f31){logger[_0x21b5('0xf')](_0x21b5('0x49'),_0x395f31[_0x21b5('0x11')],_0x4d6150);_0x6cd996(_0x32038f[_0x21b5('0xf')](0x1f4,_0x395f31[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x4b')]=function(_0xa765a){var _0x1aec0b=this;return new Promise(function(_0x2c8f02,_0x7b861e){db['CmContact'][_0x21b5('0x2d')]()[_0x21b5('0x1e')](function(_0xb6734a){return db['CmHopper']['findAll']({'raw':_0xa765a['options']?_0xa765a[_0x21b5('0x16')][_0x21b5('0x17')]===undefined?!![]:![]:!![],'where':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')]['where']||null:null,'attributes':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')][_0x21b5('0x19')]||null:null,'limit':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')][_0x21b5('0x1a')]||null:null,'include':_0xa765a[_0x21b5('0x16')]?_0xa765a[_0x21b5('0x16')][_0x21b5('0x1b')]?_[_0x21b5('0x1d')](_0xa765a['options'][_0x21b5('0x1b')],function(_0x51120e){return{'model':db[_0x51120e[_0x21b5('0x1c')]],'as':_0x51120e['as'],'attributes':_0x51120e['as']===_0x21b5('0x30')?_['keys'](_0xb6734a):_0x51120e[_0x21b5('0x19')],'include':_0x51120e[_0x21b5('0x1b')]?_['map'](_0x51120e[_0x21b5('0x1b')],function(_0x1d39fd){return{'model':db[_0x1d39fd[_0x21b5('0x1c')]],'as':_0x1d39fd['as'],'attributes':_0x1d39fd[_0x21b5('0x19')],'include':_0x1d39fd[_0x21b5('0x1b')]?_['map'](_0x1d39fd[_0x21b5('0x1b')],function(_0x59c5ac){return{'model':db[_0x59c5ac[_0x21b5('0x1c')]],'as':_0x59c5ac['as'],'attributes':_0x59c5ac[_0x21b5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15a780){logger['info'](_0x21b5('0x14'),_0xa765a);logger['debug']('GetCmHopper',_0xa765a,JSON[_0x21b5('0x1f')](_0x15a780));_0x2c8f02(_0x15a780);})[_0x21b5('0x13')](function(_0x2b5203){logger[_0x21b5('0xf')](_0x21b5('0x14'),_0x2b5203[_0x21b5('0x11')],_0xa765a);_0x7b861e(_0x1aec0b[_0x21b5('0xf')](0x1f4,_0x2b5203[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x4c')]=function(_0x59a9c8){var _0xad0728=this;return new Promise(function(_0x3d3446,_0x2af2b5){return db[_0x21b5('0x2c')][_0x21b5('0x4d')]({'raw':!![],'where':{'phone':_0x59a9c8['options'][_0x21b5('0x18')][_0x21b5('0x4e')]},'attributes':['id',_0x21b5('0x4f')],'order':[['id','DESC']]})[_0x21b5('0x1e')](function(_0x263f54){logger['info'](_0x21b5('0x50'),_0x59a9c8);logger['debug'](_0x21b5('0x50'),_0x59a9c8,JSON[_0x21b5('0x1f')](_0x263f54));_0x3d3446(_0x263f54);})[_0x21b5('0x13')](function(_0x252e85){logger[_0x21b5('0xf')](_0x21b5('0x50'),_0x252e85[_0x21b5('0x11')],_0x59a9c8);_0x2af2b5(_0xad0728[_0x21b5('0xf')](0x1f4,_0x252e85[_0x21b5('0x11')]));});});};exports[_0x21b5('0x51')]=function(_0xc3c77d){var _0x39b82d=this;return new Promise(function(_0x2e3f0c,_0x29da3e){return db[_0x21b5('0x2e')][_0x21b5('0x2f')](function(_0x2a56dc){return db[_0x21b5('0x20')]['update']({'active':![]},{'where':{},'transaction':_0x2a56dc})[_0x21b5('0x1e')](function(_0xd5803d){logger[_0x21b5('0xa')]('ResetActiveCalls',_0xc3c77d);logger[_0x21b5('0xd')]('ResetActiveCalls',_0xc3c77d,JSON[_0x21b5('0x1f')](_0xd5803d));_0x2e3f0c(_0xd5803d);})[_0x21b5('0x13')](function(_0x3a131f){logger['error'](_0x21b5('0x51'),_0x3a131f[_0x21b5('0x11')],_0xc3c77d);_0x29da3e(_0x39b82d[_0x21b5('0xf')](0x1f4,_0x3a131f[_0x21b5('0x11')]));});});});};exports[_0x21b5('0x52')]=function(_0x208cb1){var _0x455a58=this;var _0xe3942e=_0x208cb1[_0x21b5('0x24')][_0x21b5('0x18')]['voiceQueueId'];var _0x4ff325=_0x208cb1[_0x21b5('0x24')][_0x21b5('0x18')]['interval'];return new Promise(function(_0x480f7,_0x1a710d){return db['CmHopper'][_0x21b5('0x15')]({'where':{'voiceQueueId':_0xe3942e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x21b5('0x2e')][_0x21b5('0x43')](_0x21b5('0x53')+_0x4ff325+_0x21b5('0x54'))}},'include':[{'model':db[_0x21b5('0x2c')],'as':_0x21b5('0x30')},{'model':db['User'],'as':_0x21b5('0x33'),'attributes':['id','name',_0x21b5('0x35')]},{'model':db[_0x21b5('0x55')],'as':_0x21b5('0x56')}]})[_0x21b5('0x1e')](function(_0x4a4087){return db['sequelize'][_0x21b5('0x2f')](function(_0x4f0e4d){return db[_0x21b5('0x20')][_0x21b5('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0xe3942e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x21b5('0x2e')][_0x21b5('0x43')]('NOW()\x20+\x20INTERVAL\x20'+_0x4ff325+_0x21b5('0x54'))}},'transaction':_0x4f0e4d})[_0x21b5('0x1e')](function(_0x53ef8c){_0x480f7(_0x4a4087);})[_0x21b5('0x13')](function(_0x3dbbc2){logger[_0x21b5('0xf')](_0x21b5('0x52'),_0x3dbbc2[_0x21b5('0x11')],_0x208cb1);_0x1a710d(validateExpressRequest);});});})[_0x21b5('0x13')](function(_0x593ecd){logger['error'](_0x21b5('0x52'),_0x593ecd[_0x21b5('0x11')],_0x208cb1);_0x1a710d(_0x455a58[_0x21b5('0xf')](0x1f4,_0x593ecd[_0x21b5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c8fa845..fc8400e 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 _0x4f88=['isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','post','create','getPreview','/timezone','/previewrecall','getPreviewRecall','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopper.controller','get'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x4f88,0xf3));var _0x84f8=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x4f88[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var path=require('path');var timeout=require(_0x84f8('0x2'));var express=require(_0x84f8('0x3'));var router=express[_0x84f8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x84f8('0x5'));var config=require(_0x84f8('0x6'));var controller=require(_0x84f8('0x7'));router[_0x84f8('0x8')]('/',auth[_0x84f8('0x9')](),controller[_0x84f8('0xa')]);router['get'](_0x84f8('0xb'),auth[_0x84f8('0x9')](),controller['describe']);router['get'](_0x84f8('0xc'),auth[_0x84f8('0x9')](),controller[_0x84f8('0xd')]);router[_0x84f8('0x8')](_0x84f8('0xe'),auth[_0x84f8('0x9')](),controller[_0x84f8('0xf')]);router[_0x84f8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x84f8('0x10')]);router[_0x84f8('0x11')]('/',auth[_0x84f8('0x9')](),controller[_0x84f8('0x12')]);router[_0x84f8('0x11')]('/preview',auth[_0x84f8('0x9')](),controller[_0x84f8('0x13')]);router[_0x84f8('0x11')](_0x84f8('0x14'),auth[_0x84f8('0x9')](),controller['getTimezone']);router[_0x84f8('0x11')](_0x84f8('0x15'),auth[_0x84f8('0x9')](),controller[_0x84f8('0x16')]);router['put'](_0x84f8('0x17'),auth['isAuthenticated'](),controller[_0x84f8('0x18')]);router[_0x84f8('0x19')](_0x84f8('0x17'),auth['isAuthenticated'](),controller[_0x84f8('0x1a')]);module[_0x84f8('0x1b')]=router; \ No newline at end of file +var _0x4059=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','/describe','get','/opencontacts','getOpenContacts','getTimezones','show','post','create','/preview','getPreview','/timezone','/previewrecall','getPreviewRecall'];(function(_0x3d6632,_0x3f1495){var _0x2a7ec4=function(_0x5a09b1){while(--_0x5a09b1){_0x3d6632['push'](_0x3d6632['shift']());}};_0x2a7ec4(++_0x3f1495);}(_0x4059,0xb2));var _0x9405=function(_0x43fb69,_0x584019){_0x43fb69=_0x43fb69-0x0;var _0x68be8b=_0x4059[_0x43fb69];return _0x68be8b;};'use strict';var multer=require(_0x9405('0x0'));var util=require(_0x9405('0x1'));var path=require(_0x9405('0x2'));var timeout=require(_0x9405('0x3'));var express=require(_0x9405('0x4'));var router=express['Router']();var fs_extra=require(_0x9405('0x5'));var auth=require(_0x9405('0x6'));var interaction=require(_0x9405('0x7'));var config=require(_0x9405('0x8'));var controller=require(_0x9405('0x9'));router['get']('/',auth[_0x9405('0xa')](),controller[_0x9405('0xb')]);router['get'](_0x9405('0xc'),auth[_0x9405('0xa')](),controller['describe']);router[_0x9405('0xd')](_0x9405('0xe'),auth[_0x9405('0xa')](),controller[_0x9405('0xf')]);router[_0x9405('0xd')]('/timezones',auth[_0x9405('0xa')](),controller[_0x9405('0x10')]);router[_0x9405('0xd')]('/:id',auth[_0x9405('0xa')](),controller[_0x9405('0x11')]);router[_0x9405('0x12')]('/',auth[_0x9405('0xa')](),controller[_0x9405('0x13')]);router['post'](_0x9405('0x14'),auth[_0x9405('0xa')](),controller[_0x9405('0x15')]);router['post'](_0x9405('0x16'),auth[_0x9405('0xa')](),controller['getTimezone']);router[_0x9405('0x12')](_0x9405('0x17'),auth[_0x9405('0xa')](),controller[_0x9405('0x18')]);router[_0x9405('0x19')]('/:id',auth[_0x9405('0xa')](),controller['update']);router[_0x9405('0x1a')]('/:id',auth[_0x9405('0xa')](),controller[_0x9405('0x1b')]);module[_0x9405('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 768a8e8..970bc7e 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 _0x2cd0=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x245801,_0x3d8556){var _0xbbe558=function(_0x112791){while(--_0x112791){_0x245801['push'](_0x245801['shift']());}};_0xbbe558(++_0x3d8556);}(_0x2cd0,0x10f));var _0x02cd=function(_0x557a30,_0x433df5){_0x557a30=_0x557a30-0x0;var _0x2bf5f6=_0x2cd0[_0x557a30];return _0x2bf5f6;};'use strict';var moment=require(_0x02cd('0x0'));var Sequelize=require(_0x02cd('0x1'));module[_0x02cd('0x2')]={'phone':{'type':Sequelize[_0x02cd('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x02cd('0x4')],'unique':_0x02cd('0x5')},'ListId':{'type':Sequelize[_0x02cd('0x4')],'unique':_0x02cd('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x02cd('0x5')}}; \ No newline at end of file +var _0x995a=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x310231,_0x4bb6a5){var _0x120fa4=function(_0x27c995){while(--_0x27c995){_0x310231['push'](_0x310231['shift']());}};_0x120fa4(++_0x4bb6a5);}(_0x995a,0x176));var _0xa995=function(_0x5f1137,_0x4bdc99){_0x5f1137=_0x5f1137-0x0;var _0x5290e9=_0x995a[_0x5f1137];return _0x5290e9;};'use strict';var moment=require(_0xa995('0x0'));var Sequelize=require(_0xa995('0x1'));module[_0xa995('0x2')]={'phone':{'type':Sequelize[_0xa995('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa995('0x4')],'unique':_0xa995('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa995('0x5')},'VoiceQueueId':{'type':Sequelize[_0xa995('0x4')],'unique':_0xa995('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index f854553..989d276 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 _0x0018=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','error','stack','name','send','index','map','CmHopperBlack','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0018,0x1aa));var _0x8001=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0018[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x8001('0x0'));var rimraf=require(_0x8001('0x1'));var zipdir=require(_0x8001('0x2'));var jsonpatch=require(_0x8001('0x3'));var rp=require(_0x8001('0x4'));var moment=require(_0x8001('0x5'));var BPromise=require(_0x8001('0x6'));var Mustache=require(_0x8001('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8001('0x8'));var csv=require(_0x8001('0x9'));var ejs=require(_0x8001('0xa'));var fs=require('fs');var fs_extra=require(_0x8001('0xb'));var _=require(_0x8001('0xc'));var squel=require(_0x8001('0xd'));var crypto=require(_0x8001('0xe'));var jsforce=require(_0x8001('0xf'));var deskjs=require(_0x8001('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8001('0x11'));var Papa=require('papaparse');var Redis=require(_0x8001('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8001('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8001('0x14'))(_0x8001('0x15'));var utils=require(_0x8001('0x16'));var config=require(_0x8001('0x17'));var licenseUtil=require(_0x8001('0x18'));var db=require(_0x8001('0x19'))['db'];function respondWithStatusCode(_0xa6afa5,_0x527a30){_0x527a30=_0x527a30||0xcc;return function(_0x39a714){if(_0x39a714){return _0xa6afa5[_0x8001('0x1a')](_0x527a30);}return _0xa6afa5[_0x8001('0x1b')](_0x527a30)[_0x8001('0x1c')]();};}function respondWithResult(_0x20ed8d,_0x1520ba){_0x1520ba=_0x1520ba||0xc8;return function(_0x554ca8){if(_0x554ca8){return _0x20ed8d[_0x8001('0x1b')](_0x1520ba)['json'](_0x554ca8);}};}function respondWithFilteredResult(_0xed75e7,_0x463ce6){return function(_0x31276b){if(_0x31276b){var _0xf4aba4=typeof _0x463ce6[_0x8001('0x1d')]===_0x8001('0x1e')&&typeof _0x463ce6[_0x8001('0x1f')]===_0x8001('0x1e');var _0x31452b=_0x31276b[_0x8001('0x20')];var _0x13b484=_0xf4aba4?0x0:_0x463ce6['offset'];var _0x388613=_0xf4aba4?_0x31276b[_0x8001('0x20')]:_0x463ce6[_0x8001('0x1d')]+_0x463ce6[_0x8001('0x1f')];var _0x34a972;if(_0x388613>=_0x31452b){_0x388613=_0x31452b;_0x34a972=0xc8;}else{_0x34a972=0xce;}_0xed75e7[_0x8001('0x1b')](_0x34a972);return _0xed75e7['set'](_0x8001('0x21'),_0x13b484+'-'+_0x388613+'/'+_0x31452b)[_0x8001('0x22')](_0x31276b);}return null;};}function patchUpdates(_0x52f2d5){return function(_0x33acc5){try{jsonpatch['apply'](_0x33acc5,_0x52f2d5,!![]);}catch(_0x2f4ee7){return BPromise['reject'](_0x2f4ee7);}return _0x33acc5[_0x8001('0x23')]();};}function saveUpdates(_0x45139a,_0xaa134d){return function(_0xffe9cd){if(_0xffe9cd){return _0xffe9cd[_0x8001('0x24')](_0x45139a)[_0x8001('0x25')](function(_0x5a7400){return _0x5a7400;});}return null;};}function removeEntity(_0x7afff8,_0x540396){return function(_0x163ae4){if(_0x163ae4){return _0x163ae4['destroy']()[_0x8001('0x25')](function(){_0x7afff8['status'](0xcc)[_0x8001('0x1c')]();});}};}function handleEntityNotFound(_0x1b7de0,_0xc30eb){return function(_0x463ceb){if(!_0x463ceb){_0x1b7de0['sendStatus'](0x194);}return _0x463ceb;};}function handleError(_0x3f74e3,_0x5515cd){_0x5515cd=_0x5515cd||0x1f4;return function(_0x649e21){logger[_0x8001('0x26')](_0x649e21[_0x8001('0x27')]);if(_0x649e21[_0x8001('0x28')]){delete _0x649e21[_0x8001('0x28')];}_0x3f74e3['status'](_0x5515cd)[_0x8001('0x29')](_0x649e21);};}exports[_0x8001('0x2a')]=function(_0x5587f5,_0x355c29){var _0x455963={},_0x508e2a={},_0x41ba33={'count':0x0,'rows':[]};var _0x3fc646=_[_0x8001('0x2b')](db[_0x8001('0x2c')]['rawAttributes'],function(_0x3e08a6){return{'name':_0x3e08a6[_0x8001('0x2d')],'type':_0x3e08a6['type'][_0x8001('0x2e')]};});_0x508e2a[_0x8001('0x2f')]=_[_0x8001('0x2b')](_0x3fc646,'name');_0x508e2a[_0x8001('0x30')]=_[_0x8001('0x31')](_0x5587f5[_0x8001('0x30')]);_0x508e2a[_0x8001('0x32')]=_[_0x8001('0x33')](_0x508e2a[_0x8001('0x2f')],_0x508e2a[_0x8001('0x30')]);_0x455963['attributes']=_[_0x8001('0x33')](_0x508e2a[_0x8001('0x2f')],qs[_0x8001('0x34')](_0x5587f5[_0x8001('0x30')][_0x8001('0x34')]));_0x455963[_0x8001('0x35')]=_0x455963[_0x8001('0x35')][_0x8001('0x36')]?_0x455963['attributes']:_0x508e2a['model'];if(!_0x5587f5[_0x8001('0x30')][_0x8001('0x37')](_0x8001('0x38'))){_0x455963[_0x8001('0x1f')]=qs[_0x8001('0x1f')](_0x5587f5[_0x8001('0x30')][_0x8001('0x1f')]);_0x455963[_0x8001('0x1d')]=qs['offset'](_0x5587f5[_0x8001('0x30')][_0x8001('0x1d')]);}_0x455963['order']=qs[_0x8001('0x39')](_0x5587f5['query']['sort']);_0x455963[_0x8001('0x3a')]=qs[_0x8001('0x32')](_[_0x8001('0x3b')](_0x5587f5[_0x8001('0x30')],_0x508e2a[_0x8001('0x32')]),_0x3fc646);if(_0x5587f5['query'][_0x8001('0x3c')]){_0x455963['where']=_[_0x8001('0x3d')](_0x455963['where'],{'$or':_['map'](_0x3fc646,function(_0x4c9bd3){if(_0x4c9bd3[_0x8001('0x3e')]!==_0x8001('0x3f')){var _0x44d46f={};_0x44d46f[_0x4c9bd3['name']]={'$like':'%'+_0x5587f5['query'][_0x8001('0x3c')]+'%'};return _0x44d46f;}})});}_0x455963=_[_0x8001('0x3d')]({},_0x455963,_0x5587f5[_0x8001('0x40')]);var _0x176c5f={'where':_0x455963[_0x8001('0x3a')]};return db['CmHopperBlack'][_0x8001('0x20')](_0x176c5f)['then'](function(_0x43bcd0){_0x41ba33[_0x8001('0x20')]=_0x43bcd0;if(_0x5587f5[_0x8001('0x30')][_0x8001('0x41')]){_0x455963[_0x8001('0x42')]=[{'all':!![]}];}return db[_0x8001('0x2c')][_0x8001('0x43')](_0x455963);})[_0x8001('0x25')](function(_0x1691e3){_0x41ba33['rows']=_0x1691e3;return _0x41ba33;})[_0x8001('0x25')](respondWithFilteredResult(_0x355c29,_0x455963))[_0x8001('0x44')](handleError(_0x355c29,null));};exports[_0x8001('0x45')]=function(_0x7e13ad,_0x17cad1){var _0x573a69={'raw':!![],'where':{'id':_0x7e13ad[_0x8001('0x46')]['id']}},_0x504e1c={};_0x504e1c[_0x8001('0x2f')]=_[_0x8001('0x31')](db[_0x8001('0x2c')]['rawAttributes']);_0x504e1c['query']=_[_0x8001('0x31')](_0x7e13ad[_0x8001('0x30')]);_0x504e1c['filters']=_[_0x8001('0x33')](_0x504e1c[_0x8001('0x2f')],_0x504e1c[_0x8001('0x30')]);_0x573a69['attributes']=_[_0x8001('0x33')](_0x504e1c[_0x8001('0x2f')],qs[_0x8001('0x34')](_0x7e13ad[_0x8001('0x30')]['fields']));_0x573a69[_0x8001('0x35')]=_0x573a69['attributes'][_0x8001('0x36')]?_0x573a69[_0x8001('0x35')]:_0x504e1c['model'];if(_0x7e13ad[_0x8001('0x30')][_0x8001('0x41')]){_0x573a69['include']=[{'all':!![]}];}_0x573a69=_[_0x8001('0x3d')]({},_0x573a69,_0x7e13ad[_0x8001('0x40')]);return db[_0x8001('0x2c')]['find'](_0x573a69)['then'](handleEntityNotFound(_0x17cad1,null))[_0x8001('0x25')](respondWithResult(_0x17cad1,null))[_0x8001('0x44')](handleError(_0x17cad1,null));};exports[_0x8001('0x24')]=function(_0x436653,_0x1de2e7){if(_0x436653[_0x8001('0x47')]['id']){delete _0x436653['body']['id'];}return db[_0x8001('0x2c')][_0x8001('0x48')]({'where':{'id':_0x436653['params']['id']}})[_0x8001('0x25')](handleEntityNotFound(_0x1de2e7,null))['then'](saveUpdates(_0x436653[_0x8001('0x47')],null))[_0x8001('0x25')](respondWithResult(_0x1de2e7,null))[_0x8001('0x44')](handleError(_0x1de2e7,null));};exports[_0x8001('0x49')]=function(_0x53fa5e,_0xe89fc3){return db[_0x8001('0x2c')][_0x8001('0x48')]({'where':{'id':_0x53fa5e[_0x8001('0x46')]['id']}})[_0x8001('0x25')](handleEntityNotFound(_0xe89fc3,null))[_0x8001('0x25')](removeEntity(_0xe89fc3,null))[_0x8001('0x44')](handleError(_0xe89fc3,null));};exports[_0x8001('0x4a')]=function(_0x12d7f6,_0x30391c){return db[_0x8001('0x2c')][_0x8001('0x4a')]()[_0x8001('0x25')](respondWithResult(_0x30391c,null))[_0x8001('0x44')](handleError(_0x30391c,null));}; \ No newline at end of file +var _0xd260=['find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include'];(function(_0x1ce233,_0x48fbad){var _0x554ccd=function(_0x18654d){while(--_0x18654d){_0x1ce233['push'](_0x1ce233['shift']());}};_0x554ccd(++_0x48fbad);}(_0xd260,0xf1));var _0x0d26=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0xd260[_0x17406e];return _0x2bfc5a;};'use strict';var emlformat=require(_0x0d26('0x0'));var rimraf=require(_0x0d26('0x1'));var zipdir=require(_0x0d26('0x2'));var jsonpatch=require(_0x0d26('0x3'));var rp=require(_0x0d26('0x4'));var moment=require(_0x0d26('0x5'));var BPromise=require(_0x0d26('0x6'));var Mustache=require(_0x0d26('0x7'));var util=require(_0x0d26('0x8'));var path=require(_0x0d26('0x9'));var sox=require(_0x0d26('0xa'));var csv=require(_0x0d26('0xb'));var ejs=require(_0x0d26('0xc'));var fs=require('fs');var fs_extra=require(_0x0d26('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d26('0xe'));var jsforce=require(_0x0d26('0xf'));var deskjs=require(_0x0d26('0x10'));var toCsv=require(_0x0d26('0xb'));var querystring=require(_0x0d26('0x11'));var Papa=require(_0x0d26('0x12'));var Redis=require(_0x0d26('0x13'));var authService=require(_0x0d26('0x14'));var qs=require(_0x0d26('0x15'));var as=require(_0x0d26('0x16'));var hardwareService=require(_0x0d26('0x17'));var logger=require(_0x0d26('0x18'))(_0x0d26('0x19'));var utils=require(_0x0d26('0x1a'));var config=require(_0x0d26('0x1b'));var licenseUtil=require(_0x0d26('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bd12,_0x5b3c7a){_0x5b3c7a=_0x5b3c7a||0xcc;return function(_0x17c4d0){if(_0x17c4d0){return _0x54bd12[_0x0d26('0x1d')](_0x5b3c7a);}return _0x54bd12[_0x0d26('0x1e')](_0x5b3c7a)[_0x0d26('0x1f')]();};}function respondWithResult(_0x382e14,_0x4b7152){_0x4b7152=_0x4b7152||0xc8;return function(_0x130f98){if(_0x130f98){return _0x382e14[_0x0d26('0x1e')](_0x4b7152)[_0x0d26('0x20')](_0x130f98);}};}function respondWithFilteredResult(_0x563e7f,_0xce39e4){return function(_0x26509a){if(_0x26509a){var _0x56bf4b=typeof _0xce39e4[_0x0d26('0x21')]===_0x0d26('0x22')&&typeof _0xce39e4[_0x0d26('0x23')]===_0x0d26('0x22');var _0x509ead=_0x26509a[_0x0d26('0x24')];var _0x2795a6=_0x56bf4b?0x0:_0xce39e4[_0x0d26('0x21')];var _0x96aaad=_0x56bf4b?_0x26509a[_0x0d26('0x24')]:_0xce39e4[_0x0d26('0x21')]+_0xce39e4[_0x0d26('0x23')];var _0x38c53b;if(_0x96aaad>=_0x509ead){_0x96aaad=_0x509ead;_0x38c53b=0xc8;}else{_0x38c53b=0xce;}_0x563e7f[_0x0d26('0x1e')](_0x38c53b);return _0x563e7f['set']('Content-Range',_0x2795a6+'-'+_0x96aaad+'/'+_0x509ead)['json'](_0x26509a);}return null;};}function patchUpdates(_0x36406c){return function(_0x51b55a){try{jsonpatch[_0x0d26('0x25')](_0x51b55a,_0x36406c,!![]);}catch(_0x1cc25a){return BPromise[_0x0d26('0x26')](_0x1cc25a);}return _0x51b55a['save']();};}function saveUpdates(_0x51f352,_0x55bb24){return function(_0x12bca0){if(_0x12bca0){return _0x12bca0[_0x0d26('0x27')](_0x51f352)[_0x0d26('0x28')](function(_0x5b3b1a){return _0x5b3b1a;});}return null;};}function removeEntity(_0x278b69,_0x5b2274){return function(_0x12ee37){if(_0x12ee37){return _0x12ee37[_0x0d26('0x29')]()[_0x0d26('0x28')](function(){_0x278b69[_0x0d26('0x1e')](0xcc)[_0x0d26('0x1f')]();});}};}function handleEntityNotFound(_0x9b97f3,_0x12d2e5){return function(_0x50f78b){if(!_0x50f78b){_0x9b97f3['sendStatus'](0x194);}return _0x50f78b;};}function handleError(_0x5d68b4,_0x49b20d){_0x49b20d=_0x49b20d||0x1f4;return function(_0x4db6bc){logger[_0x0d26('0x2a')](_0x4db6bc[_0x0d26('0x2b')]);if(_0x4db6bc[_0x0d26('0x2c')]){delete _0x4db6bc[_0x0d26('0x2c')];}_0x5d68b4[_0x0d26('0x1e')](_0x49b20d)[_0x0d26('0x2d')](_0x4db6bc);};}exports[_0x0d26('0x2e')]=function(_0x4ca790,_0x5b480e){var _0x363f50={},_0x124cde={},_0x49ad22={'count':0x0,'rows':[]};var _0x101a83=_[_0x0d26('0x2f')](db[_0x0d26('0x30')][_0x0d26('0x31')],function(_0xe7fce2){return{'name':_0xe7fce2[_0x0d26('0x32')],'type':_0xe7fce2[_0x0d26('0x33')]['key']};});_0x124cde[_0x0d26('0x34')]=_[_0x0d26('0x2f')](_0x101a83,'name');_0x124cde[_0x0d26('0x35')]=_[_0x0d26('0x36')](_0x4ca790[_0x0d26('0x35')]);_0x124cde['filters']=_['intersection'](_0x124cde[_0x0d26('0x34')],_0x124cde[_0x0d26('0x35')]);_0x363f50[_0x0d26('0x37')]=_[_0x0d26('0x38')](_0x124cde['model'],qs[_0x0d26('0x39')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x39')]));_0x363f50[_0x0d26('0x37')]=_0x363f50['attributes'][_0x0d26('0x3a')]?_0x363f50[_0x0d26('0x37')]:_0x124cde[_0x0d26('0x34')];if(!_0x4ca790['query'][_0x0d26('0x3b')](_0x0d26('0x3c'))){_0x363f50[_0x0d26('0x23')]=qs[_0x0d26('0x23')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x23')]);_0x363f50[_0x0d26('0x21')]=qs[_0x0d26('0x21')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x21')]);}_0x363f50[_0x0d26('0x3d')]=qs[_0x0d26('0x3e')](_0x4ca790[_0x0d26('0x35')][_0x0d26('0x3e')]);_0x363f50[_0x0d26('0x3f')]=qs[_0x0d26('0x40')](_[_0x0d26('0x41')](_0x4ca790[_0x0d26('0x35')],_0x124cde['filters']),_0x101a83);if(_0x4ca790['query']['filter']){_0x363f50[_0x0d26('0x3f')]=_[_0x0d26('0x42')](_0x363f50[_0x0d26('0x3f')],{'$or':_[_0x0d26('0x2f')](_0x101a83,function(_0x42d8da){if(_0x42d8da[_0x0d26('0x33')]!==_0x0d26('0x43')){var _0x258006={};_0x258006[_0x42d8da[_0x0d26('0x2c')]]={'$like':'%'+_0x4ca790[_0x0d26('0x35')][_0x0d26('0x44')]+'%'};return _0x258006;}})});}_0x363f50=_[_0x0d26('0x42')]({},_0x363f50,_0x4ca790[_0x0d26('0x45')]);var _0x2fea27={'where':_0x363f50[_0x0d26('0x3f')]};return db[_0x0d26('0x30')]['count'](_0x2fea27)[_0x0d26('0x28')](function(_0x53adcb){_0x49ad22[_0x0d26('0x24')]=_0x53adcb;if(_0x4ca790[_0x0d26('0x35')][_0x0d26('0x46')]){_0x363f50['include']=[{'all':!![]}];}return db[_0x0d26('0x30')]['findAll'](_0x363f50);})[_0x0d26('0x28')](function(_0x299be4){_0x49ad22[_0x0d26('0x47')]=_0x299be4;return _0x49ad22;})[_0x0d26('0x28')](respondWithFilteredResult(_0x5b480e,_0x363f50))['catch'](handleError(_0x5b480e,null));};exports[_0x0d26('0x48')]=function(_0x5ac5c5,_0x481a0d){var _0x15bb49={'raw':!![],'where':{'id':_0x5ac5c5[_0x0d26('0x49')]['id']}},_0x574f94={};_0x574f94[_0x0d26('0x34')]=_[_0x0d26('0x36')](db[_0x0d26('0x30')][_0x0d26('0x31')]);_0x574f94[_0x0d26('0x35')]=_[_0x0d26('0x36')](_0x5ac5c5[_0x0d26('0x35')]);_0x574f94[_0x0d26('0x40')]=_[_0x0d26('0x38')](_0x574f94[_0x0d26('0x34')],_0x574f94[_0x0d26('0x35')]);_0x15bb49[_0x0d26('0x37')]=_['intersection'](_0x574f94[_0x0d26('0x34')],qs[_0x0d26('0x39')](_0x5ac5c5[_0x0d26('0x35')]['fields']));_0x15bb49[_0x0d26('0x37')]=_0x15bb49[_0x0d26('0x37')]['length']?_0x15bb49[_0x0d26('0x37')]:_0x574f94['model'];if(_0x5ac5c5[_0x0d26('0x35')][_0x0d26('0x46')]){_0x15bb49[_0x0d26('0x4a')]=[{'all':!![]}];}_0x15bb49=_[_0x0d26('0x42')]({},_0x15bb49,_0x5ac5c5[_0x0d26('0x45')]);return db[_0x0d26('0x30')][_0x0d26('0x4b')](_0x15bb49)['then'](handleEntityNotFound(_0x481a0d,null))[_0x0d26('0x28')](respondWithResult(_0x481a0d,null))[_0x0d26('0x4c')](handleError(_0x481a0d,null));};exports[_0x0d26('0x27')]=function(_0x5e32d4,_0x16d037){if(_0x5e32d4['body']['id']){delete _0x5e32d4['body']['id'];}return db[_0x0d26('0x30')][_0x0d26('0x4b')]({'where':{'id':_0x5e32d4[_0x0d26('0x49')]['id']}})[_0x0d26('0x28')](handleEntityNotFound(_0x16d037,null))[_0x0d26('0x28')](saveUpdates(_0x5e32d4[_0x0d26('0x4d')],null))[_0x0d26('0x28')](respondWithResult(_0x16d037,null))[_0x0d26('0x4c')](handleError(_0x16d037,null));};exports[_0x0d26('0x29')]=function(_0x1b2d71,_0x2915a2){return db['CmHopperBlack']['find']({'where':{'id':_0x1b2d71['params']['id']}})[_0x0d26('0x28')](handleEntityNotFound(_0x2915a2,null))['then'](removeEntity(_0x2915a2,null))[_0x0d26('0x4c')](handleError(_0x2915a2,null));};exports['describe']=function(_0x433b20,_0x3f176e){return db['CmHopperBlack'][_0x0d26('0x4e')]()[_0x0d26('0x28')](respondWithResult(_0x3f176e,null))[_0x0d26('0x4c')](handleError(_0x3f176e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e2a0a0a..5150c67 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 _0x3443=['rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x542185,_0x325852){var _0x2504b3=function(_0x5912fe){while(--_0x5912fe){_0x542185['push'](_0x542185['shift']());}};_0x2504b3(++_0x325852);}(_0x3443,0x6e));var _0x3344=function(_0x539228,_0x2168c9){_0x539228=_0x539228-0x0;var _0x59aa15=_0x3443[_0x539228];return _0x59aa15;};'use strict';var _=require(_0x3344('0x0'));var util=require(_0x3344('0x1'));var logger=require(_0x3344('0x2'))(_0x3344('0x3'));var moment=require(_0x3344('0x4'));var BPromise=require(_0x3344('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3344('0x6'));var rimraf=require(_0x3344('0x7'));var config=require(_0x3344('0x8'));var attributes=require(_0x3344('0x9'));module['exports']=function(_0x3e78ce,_0x44b4ab){return _0x3e78ce[_0x3344('0xa')](_0x3344('0xb'),attributes,{'tableName':_0x3344('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb716=['../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4fae81,_0x5e0107){var _0x2b28af=function(_0x47fd9f){while(--_0x47fd9f){_0x4fae81['push'](_0x4fae81['shift']());}};_0x2b28af(++_0x5e0107);}(_0xb716,0x1bc));var _0x6b71=function(_0x1630b3,_0x56559d){_0x1630b3=_0x1630b3-0x0;var _0x4acaa3=_0xb716[_0x1630b3];return _0x4acaa3;};'use strict';var _=require(_0x6b71('0x0'));var util=require(_0x6b71('0x1'));var logger=require(_0x6b71('0x2'))(_0x6b71('0x3'));var moment=require(_0x6b71('0x4'));var BPromise=require(_0x6b71('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b71('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x6b71('0x7')]=function(_0x5f09af,_0x127f08){return _0x5f09af['define'](_0x6b71('0x8'),attributes,{'tableName':_0x6b71('0x9'),'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 ea3c1a7..1f52334 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 _0x777a=['attributes','include','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','findAll','options','raw','where'];(function(_0x26a5d4,_0x48ca0d){var _0x247235=function(_0x1f2c30){while(--_0x1f2c30){_0x26a5d4['push'](_0x26a5d4['shift']());}};_0x247235(++_0x48ca0d);}(_0x777a,0x1d1));var _0xa777=function(_0x3ee414,_0x5a42e0){_0x3ee414=_0x3ee414-0x0;var _0xea81ba=_0x777a[_0x3ee414];return _0xea81ba;};'use strict';var _=require(_0xa777('0x0'));var util=require('util');var moment=require(_0xa777('0x1'));var BPromise=require(_0xa777('0x2'));var rs=require(_0xa777('0x3'));var fs=require('fs');var Redis=require(_0xa777('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa777('0x5'));var logger=require('../../config/logger')(_0xa777('0x6'));var config=require(_0xa777('0x7'));var jayson=require(_0xa777('0x8'));var client=jayson[_0xa777('0x9')][_0xa777('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be906,_0x144c99,_0x54b448){return new BPromise(function(_0x294d5b,_0x45c4d0){return client['request'](_0x1be906,_0x54b448)[_0xa777('0xb')](function(_0x26a80e){logger['info'](_0xa777('0xc'),_0x144c99,'request\x20sent');logger[_0xa777('0xd')](_0xa777('0xe'),_0x144c99,'request\x20sent',JSON[_0xa777('0xf')](_0x26a80e));if(_0x26a80e[_0xa777('0x10')]){if(_0x26a80e[_0xa777('0x10')]['code']===0x1f4){logger['error'](_0xa777('0xc'),_0x144c99,_0x26a80e['error'][_0xa777('0x11')]);return _0x45c4d0(_0x26a80e[_0xa777('0x10')]['message']);}logger[_0xa777('0x10')](_0xa777('0xc'),_0x144c99,_0x26a80e[_0xa777('0x10')]['message']);return _0x294d5b(_0x26a80e[_0xa777('0x10')]['message']);}else{logger[_0xa777('0x12')](_0xa777('0xc'),_0x144c99,'request\x20sent');_0x294d5b(_0x26a80e[_0xa777('0x13')]['message']);}})[_0xa777('0x14')](function(_0x42c7af){logger['error'](_0xa777('0xc'),_0x144c99,_0x42c7af);_0x45c4d0(_0x42c7af);});});}exports['GetCmHopperBlack']=function(_0x478477){var _0x2bb446=this;return new Promise(function(_0x3b74ca,_0x2069b9){return db['CmHopperBlack'][_0xa777('0x15')]({'raw':_0x478477[_0xa777('0x16')]?_0x478477[_0xa777('0x16')][_0xa777('0x17')]===undefined?!![]:![]:!![],'where':_0x478477[_0xa777('0x16')]?_0x478477['options'][_0xa777('0x18')]||null:null,'attributes':_0x478477[_0xa777('0x16')]?_0x478477[_0xa777('0x16')][_0xa777('0x19')]||null:null,'limit':_0x478477[_0xa777('0x16')]?_0x478477['options']['limit']||null:null,'include':_0x478477[_0xa777('0x16')]?_0x478477[_0xa777('0x16')]['include']?_['map'](_0x478477[_0xa777('0x16')][_0xa777('0x1a')],function(_0x483349){return{'model':db[_0x483349[_0xa777('0x1b')]],'as':_0x483349['as'],'attributes':_0x483349[_0xa777('0x19')],'include':_0x483349['include']?_['map'](_0x483349[_0xa777('0x1a')],function(_0x1c9226){return{'model':db[_0x1c9226[_0xa777('0x1b')]],'as':_0x1c9226['as'],'attributes':_0x1c9226[_0xa777('0x19')],'include':_0x1c9226[_0xa777('0x1a')]?_['map'](_0x1c9226[_0xa777('0x1a')],function(_0x3a5553){return{'model':db[_0x3a5553[_0xa777('0x1b')]],'as':_0x3a5553['as'],'attributes':_0x3a5553['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41a5c0){logger[_0xa777('0x12')](_0xa777('0x1c'),_0x478477);logger[_0xa777('0xd')]('GetCmHopperBlack',_0x478477,JSON[_0xa777('0xf')](_0x41a5c0));_0x3b74ca(_0x41a5c0);})[_0xa777('0x14')](function(_0x3c979a){logger['error'](_0xa777('0x1c'),_0x3c979a[_0xa777('0x11')],_0x478477);_0x2069b9(_0x2bb446[_0xa777('0x10')](0x1f4,_0x3c979a['message']));});});};exports[_0xa777('0x1d')]=function(_0x4add6b){var _0x5a6a13=this;return new Promise(function(_0x3a649b,_0x2b6053){return db['CmHopperBlack'][_0xa777('0x1e')](_0x4add6b[_0xa777('0x1f')],{'raw':_0x4add6b['options']?_0x4add6b[_0xa777('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4add6b[_0xa777('0x16')]?_0x4add6b[_0xa777('0x16')]['where']||null:null,'attributes':_0x4add6b['options']?_0x4add6b[_0xa777('0x16')][_0xa777('0x19')]||null:null,'limit':_0x4add6b['options']?_0x4add6b['options'][_0xa777('0x20')]||null:null})[_0xa777('0xb')](function(_0x369db3){logger['info']('UpdateCmHopperBlack',_0x4add6b);logger['debug'](_0xa777('0x1d'),_0x4add6b,JSON[_0xa777('0xf')](_0x369db3));_0x3a649b(_0x369db3);})['catch'](function(_0x492dcc){logger[_0xa777('0x10')](_0xa777('0x1d'),_0x492dcc[_0xa777('0x11')],_0x4add6b);_0x2b6053(_0x5a6a13['error'](0x1f4,_0x492dcc[_0xa777('0x11')]));});});};exports[_0xa777('0x21')]=function(_0x5a70c1){var _0x154678=this;return new Promise(function(_0x54ac28,_0x49b73a){return db['CmHopperBlack'][_0xa777('0x22')]({'where':_0x5a70c1[_0xa777('0x16')]?_0x5a70c1[_0xa777('0x16')][_0xa777('0x18')]||null:null})['then'](function(_0x25161f){logger['info'](_0xa777('0x21'),_0x5a70c1);logger[_0xa777('0xd')](_0xa777('0x21'),_0x5a70c1,JSON[_0xa777('0xf')](_0x25161f));_0x54ac28(_0x25161f);})[_0xa777('0x14')](function(_0x59ae96){logger[_0xa777('0x10')](_0xa777('0x21'),_0x59ae96['message'],_0x5a70c1);_0x49b73a(_0x154678['error'](0x1f4,_0x59ae96[_0xa777('0x11')]));});});}; \ No newline at end of file +var _0xade5=['findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack'];(function(_0x4ae309,_0x5b5f56){var _0x4a7ebe=function(_0x26e1c0){while(--_0x26e1c0){_0x4ae309['push'](_0x4ae309['shift']());}};_0x4a7ebe(++_0x5b5f56);}(_0xade5,0x7d));var _0x5ade=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xade5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5ade('0x0'));var moment=require(_0x5ade('0x1'));var BPromise=require(_0x5ade('0x2'));var rs=require(_0x5ade('0x3'));var fs=require('fs');var Redis=require(_0x5ade('0x4'));var db=require(_0x5ade('0x5'))['db'];var utils=require(_0x5ade('0x6'));var logger=require(_0x5ade('0x7'))('rpc');var config=require(_0x5ade('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5ade('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538031,_0x43f44a,_0x31d0bf){return new BPromise(function(_0x57f047,_0x4e1f22){return client[_0x5ade('0xa')](_0x538031,_0x31d0bf)[_0x5ade('0xb')](function(_0x1b4254){logger[_0x5ade('0xc')](_0x5ade('0xd'),_0x43f44a,'request\x20sent');logger[_0x5ade('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x43f44a,'request\x20sent',JSON[_0x5ade('0xf')](_0x1b4254));if(_0x1b4254[_0x5ade('0x10')]){if(_0x1b4254[_0x5ade('0x10')]['code']===0x1f4){logger[_0x5ade('0x10')](_0x5ade('0xd'),_0x43f44a,_0x1b4254[_0x5ade('0x10')]['message']);return _0x4e1f22(_0x1b4254[_0x5ade('0x10')][_0x5ade('0x11')]);}logger['error'](_0x5ade('0xd'),_0x43f44a,_0x1b4254['error'][_0x5ade('0x11')]);return _0x57f047(_0x1b4254[_0x5ade('0x10')][_0x5ade('0x11')]);}else{logger[_0x5ade('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x43f44a,_0x5ade('0x12'));_0x57f047(_0x1b4254[_0x5ade('0x13')]['message']);}})[_0x5ade('0x14')](function(_0x565c64){logger[_0x5ade('0x10')](_0x5ade('0xd'),_0x43f44a,_0x565c64);_0x4e1f22(_0x565c64);});});}exports[_0x5ade('0x15')]=function(_0x101e45){var _0x4dd4df=this;return new Promise(function(_0x55b796,_0x3652a5){return db[_0x5ade('0x16')][_0x5ade('0x17')]({'raw':_0x101e45[_0x5ade('0x18')]?_0x101e45['options'][_0x5ade('0x19')]===undefined?!![]:![]:!![],'where':_0x101e45[_0x5ade('0x18')]?_0x101e45[_0x5ade('0x18')][_0x5ade('0x1a')]||null:null,'attributes':_0x101e45[_0x5ade('0x18')]?_0x101e45[_0x5ade('0x18')][_0x5ade('0x1b')]||null:null,'limit':_0x101e45[_0x5ade('0x18')]?_0x101e45['options'][_0x5ade('0x1c')]||null:null,'include':_0x101e45['options']?_0x101e45[_0x5ade('0x18')][_0x5ade('0x1d')]?_[_0x5ade('0x1e')](_0x101e45['options'][_0x5ade('0x1d')],function(_0x6af6ba){return{'model':db[_0x6af6ba[_0x5ade('0x1f')]],'as':_0x6af6ba['as'],'attributes':_0x6af6ba[_0x5ade('0x1b')],'include':_0x6af6ba[_0x5ade('0x1d')]?_['map'](_0x6af6ba[_0x5ade('0x1d')],function(_0x31326d){return{'model':db[_0x31326d[_0x5ade('0x1f')]],'as':_0x31326d['as'],'attributes':_0x31326d[_0x5ade('0x1b')],'include':_0x31326d[_0x5ade('0x1d')]?_[_0x5ade('0x1e')](_0x31326d[_0x5ade('0x1d')],function(_0x311f15){return{'model':db[_0x311f15[_0x5ade('0x1f')]],'as':_0x311f15['as'],'attributes':_0x311f15[_0x5ade('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5ade('0xb')](function(_0x521169){logger[_0x5ade('0xc')]('GetCmHopperBlack',_0x101e45);logger[_0x5ade('0xe')](_0x5ade('0x15'),_0x101e45,JSON[_0x5ade('0xf')](_0x521169));_0x55b796(_0x521169);})[_0x5ade('0x14')](function(_0x43b040){logger[_0x5ade('0x10')]('GetCmHopperBlack',_0x43b040[_0x5ade('0x11')],_0x101e45);_0x3652a5(_0x4dd4df[_0x5ade('0x10')](0x1f4,_0x43b040[_0x5ade('0x11')]));});});};exports[_0x5ade('0x20')]=function(_0x56f8bf){var _0x1eee2f=this;return new Promise(function(_0x1cdacc,_0x15c377){return db[_0x5ade('0x16')][_0x5ade('0x21')](_0x56f8bf[_0x5ade('0x22')],{'raw':_0x56f8bf[_0x5ade('0x18')]?_0x56f8bf[_0x5ade('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56f8bf[_0x5ade('0x18')]?_0x56f8bf['options'][_0x5ade('0x1a')]||null:null,'attributes':_0x56f8bf[_0x5ade('0x18')]?_0x56f8bf[_0x5ade('0x18')][_0x5ade('0x1b')]||null:null,'limit':_0x56f8bf['options']?_0x56f8bf[_0x5ade('0x18')][_0x5ade('0x1c')]||null:null})[_0x5ade('0xb')](function(_0x7a9790){logger[_0x5ade('0xc')]('UpdateCmHopperBlack',_0x56f8bf);logger['debug'](_0x5ade('0x20'),_0x56f8bf,JSON[_0x5ade('0xf')](_0x7a9790));_0x1cdacc(_0x7a9790);})[_0x5ade('0x14')](function(_0x40e995){logger['error'](_0x5ade('0x20'),_0x40e995[_0x5ade('0x11')],_0x56f8bf);_0x15c377(_0x1eee2f[_0x5ade('0x10')](0x1f4,_0x40e995['message']));});});};exports[_0x5ade('0x23')]=function(_0x2bd13b){var _0x4889ae=this;return new Promise(function(_0x1fedad,_0x51ac18){return db[_0x5ade('0x16')][_0x5ade('0x24')]({'where':_0x2bd13b[_0x5ade('0x18')]?_0x2bd13b['options']['where']||null:null})['then'](function(_0x558195){logger['info'](_0x5ade('0x23'),_0x2bd13b);logger['debug']('DestroyCmHopperBlack',_0x2bd13b,JSON[_0x5ade('0xf')](_0x558195));_0x1fedad(_0x558195);})[_0x5ade('0x14')](function(_0x18196c){logger[_0x5ade('0x10')](_0x5ade('0x23'),_0x18196c[_0x5ade('0x11')],_0x2bd13b);_0x51ac18(_0x4889ae['error'](0x1f4,_0x18196c[_0x5ade('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 57e6150..6ea558b 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 _0x5d58=['exports','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','destroy'];(function(_0x3b881c,_0xc9b851){var _0x1fd3c9=function(_0x8f7f97){while(--_0x8f7f97){_0x3b881c['push'](_0x3b881c['shift']());}};_0x1fd3c9(++_0xc9b851);}(_0x5d58,0x187));var _0x85d5=function(_0x5ed91b,_0x234eb1){_0x5ed91b=_0x5ed91b-0x0;var _0x18dc5d=_0x5d58[_0x5ed91b];return _0x18dc5d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./cmHopperBlack.controller');router[_0x85d5('0x4')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0x6')]);router[_0x85d5('0x4')]('/describe',auth[_0x85d5('0x5')](),controller[_0x85d5('0x7')]);router['get'](_0x85d5('0x8'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x85d5('0x8'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xb')]);module[_0x85d5('0xc')]=router; \ No newline at end of file +var _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x465d35,_0x540f6e){var _0x208cb5=function(_0x337c2c){while(--_0x337c2c){_0x465d35['push'](_0x465d35['shift']());}};_0x208cb5(++_0x540f6e);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x16fc2a,_0x545bfd){_0x16fc2a=_0x16fc2a-0x0;var _0x28d677=_0xa6b0[_0x16fc2a];return _0x28d677;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d2f29dd..c156db0 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 _0xd730=['INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize'];(function(_0x12feee,_0x59315d){var _0x3ad092=function(_0x1cfade){while(--_0x1cfade){_0x12feee['push'](_0x12feee['shift']());}};_0x3ad092(++_0x59315d);}(_0xd730,0x77));var _0x0d73=function(_0x102042,_0x3b3c02){_0x102042=_0x102042-0x0;var _0x501165=_0xd730[_0x102042];return _0x501165;};'use strict';var Sequelize=require(_0x0d73('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x0d73('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0d73('0x2')]},'scheduledat':{'type':Sequelize[_0x0d73('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0d73('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0d73('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0d73('0x2')]},'calleridnum':{'type':Sequelize[_0x0d73('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0d73('0x3')]},'responsetime':{'type':Sequelize[_0x0d73('0x3')]},'answertime':{'type':Sequelize[_0x0d73('0x3')]},'droptime':{'type':Sequelize[_0x0d73('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0d73('0x2')]},'campaign':{'type':Sequelize[_0x0d73('0x2')]},'campaigntype':{'type':Sequelize[_0x0d73('0x2')]},'membername':{'type':Sequelize[_0x0d73('0x2')]},'reason':{'type':Sequelize[_0x0d73('0x2')]},'disposition':{'type':Sequelize[_0x0d73('0x2')]},'secondDisposition':{'type':Sequelize[_0x0d73('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0d73('0x2')]},'dispositionat':{'type':Sequelize[_0x0d73('0x3')],'set':function(_0xcf7ce5){var _0x176b4a=this[_0x0d73('0x4')](_0x0d73('0x5'));if(_0x176b4a&&_0xcf7ce5){this['setDataValue'](_0x0d73('0x6'),moment(_0xcf7ce5)[_0x0d73('0x7')](moment(_0x176b4a),_0x0d73('0x8')));}return this[_0x0d73('0x9')](_0x0d73('0xa'),_0xcf7ce5);}},'amd':{'type':Sequelize[_0x0d73('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0d73('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0d73('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0d73('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0d73('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0d73('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0d73('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0d73('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0d73('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31ec=['seconds','dispositionat','BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x270f18,_0x8155e9){var _0x39d745=function(_0x294bdd){while(--_0x294bdd){_0x270f18['push'](_0x270f18['shift']());}};_0x39d745(++_0x8155e9);}(_0x31ec,0xf3));var _0xc31e=function(_0x3a7f4b,_0x46ab83){_0x3a7f4b=_0x3a7f4b-0x0;var _0x1c6d63=_0x31ec[_0x3a7f4b];return _0x1c6d63;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc31e('0x0')]={'state':{'type':Sequelize[_0xc31e('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc31e('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc31e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc31e('0x2')]},'originatecalleridname':{'type':Sequelize[_0xc31e('0x2')]},'calleridnum':{'type':Sequelize[_0xc31e('0x2')]},'calleridname':{'type':Sequelize[_0xc31e('0x2')]},'starttime':{'type':Sequelize[_0xc31e('0x3')]},'responsetime':{'type':Sequelize[_0xc31e('0x3')]},'answertime':{'type':Sequelize[_0xc31e('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc31e('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xc31e('0x2')]},'membername':{'type':Sequelize[_0xc31e('0x2')]},'reason':{'type':Sequelize[_0xc31e('0x2')]},'disposition':{'type':Sequelize[_0xc31e('0x2')]},'secondDisposition':{'type':Sequelize[_0xc31e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc31e('0x2')]},'dispositionat':{'type':Sequelize[_0xc31e('0x3')],'set':function(_0x325e71){var _0x3bb32c=this[_0xc31e('0x4')](_0xc31e('0x5'));if(_0x3bb32c&&_0x325e71){this[_0xc31e('0x6')](_0xc31e('0x7'),moment(_0x325e71)[_0xc31e('0x8')](moment(_0x3bb32c),_0xc31e('0x9')));}return this[_0xc31e('0x6')](_0xc31e('0xa'),_0x325e71);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xc31e('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc31e('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xc31e('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc31e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 2d64b3f..4f0b769 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 _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x2244b6,_0x32713d){var _0x336b95=function(_0xb29d27){while(--_0xb29d27){_0x2244b6['push'](_0x2244b6['shift']());}};_0x336b95(++_0x32713d);}(_0x1883,0xab));var _0x3188=function(_0x4c390b,_0x536d80){_0x4c390b=_0x4c390b-0x0;var _0x54197b=_0x1883[_0x4c390b];return _0x54197b;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));}; \ No newline at end of file +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(_0x51a5d8,_0x3d48d4){var _0x1f15a0=function(_0x1eb08e){while(--_0x1eb08e){_0x51a5d8['push'](_0x51a5d8['shift']());}};_0x1f15a0(++_0x3d48d4);}(_0x33af,0xec));var _0xf33a=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x33af[_0xea8947];return _0x2455e9;};'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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0c9de66..b3e86f8 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 _0xe27b=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xe27b,0x1af));var _0xbe27=function(_0x3d3c01,_0x9baccc){_0x3d3c01=_0x3d3c01-0x0;var _0x504c05=_0xe27b[_0x3d3c01];return _0x504c05;};'use strict';var _=require(_0xbe27('0x0'));var util=require(_0xbe27('0x1'));var logger=require('../../config/logger')(_0xbe27('0x2'));var moment=require(_0xbe27('0x3'));var BPromise=require(_0xbe27('0x4'));var rp=require(_0xbe27('0x5'));var fs=require('fs');var path=require(_0xbe27('0x6'));var rimraf=require(_0xbe27('0x7'));var config=require(_0xbe27('0x8'));var attributes=require(_0xbe27('0x9'));module[_0xbe27('0xa')]=function(_0x34d69c,_0xc53977){return _0x34d69c['define'](_0xbe27('0xb'),attributes,{'tableName':_0xbe27('0xc'),'paranoid':![],'indexes':[{'name':_0xbe27('0xd'),'fields':[_0xbe27('0xd')]},{'name':_0xbe27('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc78a=['exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0xc78a,0x13d));var _0xac78=function(_0x30f87a,_0x2cce5a){_0x30f87a=_0x30f87a-0x0;var _0x3a8efc=_0xc78a[_0x30f87a];return _0x3a8efc;};'use strict';var _=require(_0xac78('0x0'));var util=require('util');var logger=require(_0xac78('0x1'))('api');var moment=require(_0xac78('0x2'));var BPromise=require('bluebird');var rp=require(_0xac78('0x3'));var fs=require('fs');var path=require(_0xac78('0x4'));var rimraf=require(_0xac78('0x5'));var config=require(_0xac78('0x6'));var attributes=require(_0xac78('0x7'));module[_0xac78('0x8')]=function(_0x4a4a94,_0x5bf10a){return _0x4a4a94[_0xac78('0x9')]('CmHopperFinal',attributes,{'tableName':_0xac78('0xa'),'paranoid':![],'indexes':[{'name':_0xac78('0xb'),'fields':[_0xac78('0xb')]},{'name':_0xac78('0xc'),'fields':[_0xac78('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index eca0049..f150ebc 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x10a19a,_0x497428){var _0x4c2b57=function(_0x17ce2f){while(--_0x17ce2f){_0x10a19a['push'](_0x10a19a['shift']());}};_0x4c2b57(++_0x497428);}(_0x7a54,0x106));var _0x47a5=function(_0xb9aaeb,_0x1d0dba){_0xb9aaeb=_0xb9aaeb-0x0;var _0x120a3c=_0x7a54[_0xb9aaeb];return _0x120a3c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3416df,_0x517940){var _0x2b089b=function(_0x33b9ad){while(--_0x33b9ad){_0x3416df['push'](_0x3416df['shift']());}};_0x2b089b(++_0x517940);}(_0x7a54,0x106));var _0x47a5=function(_0xa5c3f6,_0x345645){_0xa5c3f6=_0xa5c3f6-0x0;var _0x55146b=_0x7a54[_0xa5c3f6];return _0x55146b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index d1c0248..401065a 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 _0xb3c3=['/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal'];(function(_0x11dcbf,_0x596003){var _0x801c2e=function(_0x3a738f){while(--_0x3a738f){_0x11dcbf['push'](_0x11dcbf['shift']());}};_0x801c2e(++_0x596003);}(_0xb3c3,0x1ce));var _0x3b3c=function(_0x3917ad,_0x2caf3e){_0x3917ad=_0x3917ad-0x0;var _0x26c3ec=_0xb3c3[_0x3917ad];return _0x26c3ec;};'use strict';var multer=require(_0x3b3c('0x0'));var util=require('util');var path=require(_0x3b3c('0x1'));var timeout=require('connect-timeout');var express=require(_0x3b3c('0x2'));var router=express['Router']();var fs_extra=require(_0x3b3c('0x3'));var auth=require(_0x3b3c('0x4'));var interaction=require(_0x3b3c('0x5'));var config=require('../../config/environment');var controller=require(_0x3b3c('0x6'));router[_0x3b3c('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b3c('0x8')]);router['get'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller[_0x3b3c('0xb')]);router['get']('/:id',auth[_0x3b3c('0xa')](),controller['show']);router[_0x3b3c('0x7')](_0x3b3c('0xc'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x3b3c('0x7')](_0x3b3c('0xd'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x3b3c('0xe')](_0x3b3c('0xf'),auth[_0x3b3c('0xa')](),controller[_0x3b3c('0x10')]);router[_0x3b3c('0xe')]('/voice/campaign/moveContacts/:id',auth[_0x3b3c('0xa')](),controller[_0x3b3c('0x11')]);router[_0x3b3c('0xe')](_0x3b3c('0x12'),auth[_0x3b3c('0xa')](),controller[_0x3b3c('0x13')]);router[_0x3b3c('0x14')](_0x3b3c('0x15'),auth['isAuthenticated'](),controller[_0x3b3c('0x16')]);module[_0x3b3c('0x17')]=router; \ No newline at end of file +var _0xc428=['/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','checkContactHopper','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x450e32,_0x1f4f6a){var _0x3041e0=function(_0x42bba5){while(--_0x42bba5){_0x450e32['push'](_0x450e32['shift']());}};_0x3041e0(++_0x1f4f6a);}(_0xc428,0x85));var _0x8c42=function(_0x507dd8,_0x3519e7){_0x507dd8=_0x507dd8-0x0;var _0x8e90b1=_0xc428[_0x507dd8];return _0x8e90b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8c42('0x0'));var express=require(_0x8c42('0x1'));var router=express[_0x8c42('0x2')]();var fs_extra=require(_0x8c42('0x3'));var auth=require(_0x8c42('0x4'));var interaction=require(_0x8c42('0x5'));var config=require(_0x8c42('0x6'));var controller=require(_0x8c42('0x7'));router[_0x8c42('0x8')]('/',auth[_0x8c42('0x9')](),controller[_0x8c42('0xa')]);router[_0x8c42('0x8')](_0x8c42('0xb'),auth[_0x8c42('0x9')](),controller['describe']);router[_0x8c42('0x8')](_0x8c42('0xc'),auth['isAuthenticated'](),controller[_0x8c42('0xd')]);router[_0x8c42('0x8')]('/voice/queue/countAttributes/:id',auth[_0x8c42('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x8c42('0xe'),auth[_0x8c42('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x8c42('0x9')](),controller[_0x8c42('0xf')]);router['post']('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8c42('0x10')]('/checkContactHopper',auth[_0x8c42('0x9')](),controller[_0x8c42('0x11')]);router[_0x8c42('0x12')](_0x8c42('0xc'),auth[_0x8c42('0x9')](),controller[_0x8c42('0x13')]);module[_0x8c42('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f8686cf..58a917a 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 _0x6bee=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x31729e,_0x45944d){var _0x597280=function(_0x4279f8){while(--_0x4279f8){_0x31729e['push'](_0x31729e['shift']());}};_0x597280(++_0x45944d);}(_0x6bee,0x66));var _0xe6be=function(_0x252a33,_0x2be6ff){_0x252a33=_0x252a33-0x0;var _0x5f29a4=_0x6bee[_0x252a33];return _0x5f29a4;};'use strict';var Sequelize=require(_0xe6be('0x0'));module[_0xe6be('0x1')]={'state':{'type':Sequelize[_0xe6be('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe6be('0x3')]},'scheduledat':{'type':Sequelize[_0xe6be('0x4')]},'countbusyretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xe6be('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe6be('0x3')]},'starttime':{'type':Sequelize[_0xe6be('0x4')]},'responsetime':{'type':Sequelize[_0xe6be('0x4')]},'answertime':{'type':Sequelize[_0xe6be('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe6be('0x4')]},'ringtime':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe6be('0x3')]},'campaign':{'type':Sequelize[_0xe6be('0x3')]},'campaigntype':{'type':Sequelize[_0xe6be('0x3')]},'membername':{'type':Sequelize[_0xe6be('0x3')]},'reason':{'type':Sequelize[_0xe6be('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe6be('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe6be('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe6be('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe6be('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xe6be('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe6be('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe6be('0x3')]}}; \ No newline at end of file +var _0xeca9=['STRING','DATE','INTEGER','BOOLEAN','exports'];(function(_0x46edeb,_0x4cd458){var _0x1cc555=function(_0x5409cb){while(--_0x5409cb){_0x46edeb['push'](_0x46edeb['shift']());}};_0x1cc555(++_0x4cd458);}(_0xeca9,0x1da));var _0x9eca=function(_0x556707,_0xbc3a43){_0x556707=_0x556707-0x0;var _0x336815=_0xeca9[_0x556707];return _0x336815;};'use strict';var Sequelize=require('sequelize');module[_0x9eca('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9eca('0x1')]},'scheduledat':{'type':Sequelize[_0x9eca('0x2')]},'countbusyretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9eca('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x9eca('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9eca('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9eca('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x9eca('0x2')]},'endtime':{'type':Sequelize[_0x9eca('0x2')]},'ringtime':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9eca('0x1')]},'campaign':{'type':Sequelize[_0x9eca('0x1')]},'campaigntype':{'type':Sequelize[_0x9eca('0x1')]},'membername':{'type':Sequelize[_0x9eca('0x1')]},'reason':{'type':Sequelize[_0x9eca('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x9eca('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9eca('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9eca('0x2')]},'recallme':{'type':Sequelize[_0x9eca('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9eca('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9eca('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index b528f6a..a146988 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 _0x4d90=['merge','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','options','include','findAll','rows','catch','params'];(function(_0x444b28,_0x576e14){var _0x2b11e2=function(_0x2ee723){while(--_0x2ee723){_0x444b28['push'](_0x444b28['shift']());}};_0x2b11e2(++_0x576e14);}(_0x4d90,0x1bd));var _0x04d9=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x4d90[_0xf71120];return _0xbe2fd3;};'use strict';var emlformat=require(_0x04d9('0x0'));var rimraf=require(_0x04d9('0x1'));var zipdir=require(_0x04d9('0x2'));var jsonpatch=require(_0x04d9('0x3'));var rp=require('request-promise');var moment=require(_0x04d9('0x4'));var BPromise=require(_0x04d9('0x5'));var Mustache=require(_0x04d9('0x6'));var util=require(_0x04d9('0x7'));var path=require(_0x04d9('0x8'));var sox=require(_0x04d9('0x9'));var csv=require(_0x04d9('0xa'));var ejs=require(_0x04d9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04d9('0xc'));var crypto=require('crypto');var jsforce=require(_0x04d9('0xd'));var deskjs=require(_0x04d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x04d9('0xf'));var Papa=require('papaparse');var Redis=require(_0x04d9('0x10'));var authService=require(_0x04d9('0x11'));var qs=require(_0x04d9('0x12'));var as=require(_0x04d9('0x13'));var hardwareService=require(_0x04d9('0x14'));var logger=require(_0x04d9('0x15'))(_0x04d9('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x04d9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f59c0,_0x10d6fa){_0x10d6fa=_0x10d6fa||0xcc;return function(_0x5d3d90){if(_0x5d3d90){return _0x1f59c0['sendStatus'](_0x10d6fa);}return _0x1f59c0[_0x04d9('0x18')](_0x10d6fa)[_0x04d9('0x19')]();};}function respondWithResult(_0x498fc4,_0x283531){_0x283531=_0x283531||0xc8;return function(_0x5e6c29){if(_0x5e6c29){return _0x498fc4[_0x04d9('0x18')](_0x283531)[_0x04d9('0x1a')](_0x5e6c29);}};}function respondWithFilteredResult(_0x28442c,_0xfbba65){return function(_0x18b42d){if(_0x18b42d){var _0x499de0=typeof _0xfbba65[_0x04d9('0x1b')]===_0x04d9('0x1c')&&typeof _0xfbba65['limit']===_0x04d9('0x1c');var _0x53b01b=_0x18b42d[_0x04d9('0x1d')];var _0x52d98b=_0x499de0?0x0:_0xfbba65[_0x04d9('0x1b')];var _0x468a06=_0x499de0?_0x18b42d[_0x04d9('0x1d')]:_0xfbba65['offset']+_0xfbba65[_0x04d9('0x1e')];var _0x32a8b9;if(_0x468a06>=_0x53b01b){_0x468a06=_0x53b01b;_0x32a8b9=0xc8;}else{_0x32a8b9=0xce;}_0x28442c['status'](_0x32a8b9);return _0x28442c['set'](_0x04d9('0x1f'),_0x52d98b+'-'+_0x468a06+'/'+_0x53b01b)[_0x04d9('0x1a')](_0x18b42d);}return null;};}function patchUpdates(_0x249e02){return function(_0x7f2e07){try{jsonpatch[_0x04d9('0x20')](_0x7f2e07,_0x249e02,!![]);}catch(_0x4b891d){return BPromise[_0x04d9('0x21')](_0x4b891d);}return _0x7f2e07['save']();};}function saveUpdates(_0x3490e1,_0x4b420e){return function(_0x475f6a){if(_0x475f6a){return _0x475f6a['update'](_0x3490e1)[_0x04d9('0x22')](function(_0x91370f){return _0x91370f;});}return null;};}function removeEntity(_0x1c34d3,_0x2c3222){return function(_0x442e83){if(_0x442e83){return _0x442e83[_0x04d9('0x23')]()[_0x04d9('0x22')](function(){_0x1c34d3[_0x04d9('0x18')](0xcc)[_0x04d9('0x19')]();});}};}function handleEntityNotFound(_0x2d527e,_0x37dc6a){return function(_0x2f4de2){if(!_0x2f4de2){_0x2d527e[_0x04d9('0x24')](0x194);}return _0x2f4de2;};}function handleError(_0x2a227b,_0x1cbdc0){_0x1cbdc0=_0x1cbdc0||0x1f4;return function(_0x1f60c0){logger['error'](_0x1f60c0[_0x04d9('0x25')]);if(_0x1f60c0[_0x04d9('0x26')]){delete _0x1f60c0['name'];}_0x2a227b[_0x04d9('0x18')](_0x1cbdc0)[_0x04d9('0x27')](_0x1f60c0);};}exports['index']=function(_0x5832ba,_0x51f803){var _0x55f2ba={},_0x25d5a5={},_0x1b127b={'count':0x0,'rows':[]};var _0x530d16=_[_0x04d9('0x28')](db[_0x04d9('0x29')][_0x04d9('0x2a')],function(_0x349a82){return{'name':_0x349a82[_0x04d9('0x2b')],'type':_0x349a82['type'][_0x04d9('0x2c')]};});_0x25d5a5[_0x04d9('0x2d')]=_[_0x04d9('0x28')](_0x530d16,_0x04d9('0x26'));_0x25d5a5['query']=_[_0x04d9('0x2e')](_0x5832ba[_0x04d9('0x2f')]);_0x25d5a5[_0x04d9('0x30')]=_['intersection'](_0x25d5a5[_0x04d9('0x2d')],_0x25d5a5[_0x04d9('0x2f')]);_0x55f2ba[_0x04d9('0x31')]=_[_0x04d9('0x32')](_0x25d5a5['model'],qs[_0x04d9('0x33')](_0x5832ba[_0x04d9('0x2f')][_0x04d9('0x33')]));_0x55f2ba[_0x04d9('0x31')]=_0x55f2ba[_0x04d9('0x31')][_0x04d9('0x34')]?_0x55f2ba[_0x04d9('0x31')]:_0x25d5a5['model'];if(!_0x5832ba[_0x04d9('0x2f')][_0x04d9('0x35')]('nolimit')){_0x55f2ba[_0x04d9('0x1e')]=qs[_0x04d9('0x1e')](_0x5832ba[_0x04d9('0x2f')]['limit']);_0x55f2ba[_0x04d9('0x1b')]=qs[_0x04d9('0x1b')](_0x5832ba[_0x04d9('0x2f')][_0x04d9('0x1b')]);}_0x55f2ba['order']=qs[_0x04d9('0x36')](_0x5832ba[_0x04d9('0x2f')][_0x04d9('0x36')]);_0x55f2ba['where']=qs['filters'](_[_0x04d9('0x37')](_0x5832ba[_0x04d9('0x2f')],_0x25d5a5[_0x04d9('0x30')]),_0x530d16);if(_0x5832ba[_0x04d9('0x2f')][_0x04d9('0x38')]){_0x55f2ba[_0x04d9('0x39')]=_['merge'](_0x55f2ba[_0x04d9('0x39')],{'$or':_[_0x04d9('0x28')](_0x530d16,function(_0x281130){if(_0x281130[_0x04d9('0x3a')]!==_0x04d9('0x3b')){var _0x44dae6={};_0x44dae6[_0x281130[_0x04d9('0x26')]]={'$like':'%'+_0x5832ba[_0x04d9('0x2f')][_0x04d9('0x38')]+'%'};return _0x44dae6;}})});}_0x55f2ba=_['merge']({},_0x55f2ba,_0x5832ba[_0x04d9('0x3c')]);var _0x3a8f70={'where':_0x55f2ba[_0x04d9('0x39')]};return db[_0x04d9('0x29')][_0x04d9('0x1d')](_0x3a8f70)[_0x04d9('0x22')](function(_0x360341){_0x1b127b[_0x04d9('0x1d')]=_0x360341;if(_0x5832ba[_0x04d9('0x2f')]['includeAll']){_0x55f2ba[_0x04d9('0x3d')]=[{'all':!![]}];}return db[_0x04d9('0x29')][_0x04d9('0x3e')](_0x55f2ba);})[_0x04d9('0x22')](function(_0x4e9812){_0x1b127b[_0x04d9('0x3f')]=_0x4e9812;return _0x1b127b;})[_0x04d9('0x22')](respondWithFilteredResult(_0x51f803,_0x55f2ba))[_0x04d9('0x40')](handleError(_0x51f803,null));};exports['show']=function(_0x2f0d6b,_0x2e9570){var _0x30baf9={'raw':!![],'where':{'id':_0x2f0d6b[_0x04d9('0x41')]['id']}},_0x15cc92={};_0x15cc92[_0x04d9('0x2d')]=_[_0x04d9('0x2e')](db[_0x04d9('0x29')]['rawAttributes']);_0x15cc92[_0x04d9('0x2f')]=_[_0x04d9('0x2e')](_0x2f0d6b['query']);_0x15cc92[_0x04d9('0x30')]=_[_0x04d9('0x32')](_0x15cc92[_0x04d9('0x2d')],_0x15cc92['query']);_0x30baf9['attributes']=_['intersection'](_0x15cc92[_0x04d9('0x2d')],qs[_0x04d9('0x33')](_0x2f0d6b['query'][_0x04d9('0x33')]));_0x30baf9[_0x04d9('0x31')]=_0x30baf9[_0x04d9('0x31')][_0x04d9('0x34')]?_0x30baf9[_0x04d9('0x31')]:_0x15cc92['model'];if(_0x2f0d6b[_0x04d9('0x2f')]['includeAll']){_0x30baf9[_0x04d9('0x3d')]=[{'all':!![]}];}_0x30baf9=_[_0x04d9('0x42')]({},_0x30baf9,_0x2f0d6b[_0x04d9('0x3c')]);return db[_0x04d9('0x29')][_0x04d9('0x43')](_0x30baf9)[_0x04d9('0x22')](handleEntityNotFound(_0x2e9570,null))[_0x04d9('0x22')](respondWithResult(_0x2e9570,null))['catch'](handleError(_0x2e9570,null));};exports[_0x04d9('0x44')]=function(_0x1e3685,_0x4091d5){return db[_0x04d9('0x29')][_0x04d9('0x44')](_0x1e3685[_0x04d9('0x45')],{})[_0x04d9('0x22')](respondWithResult(_0x4091d5,0xc9))['catch'](handleError(_0x4091d5,null));};exports[_0x04d9('0x46')]=function(_0x1515df,_0x3df360){return db[_0x04d9('0x29')]['describe']()[_0x04d9('0x22')](respondWithResult(_0x3df360,null))['catch'](handleError(_0x3df360,null));};exports[_0x04d9('0x47')]=function(_0x90150c,_0x31ad96){if(_0x90150c['body'][_0x04d9('0x48')]){delete _0x90150c[_0x04d9('0x45')][_0x04d9('0x48')];}return db['CmHopperHistory'][_0x04d9('0x43')]({'where':{'uniqueid':_0x90150c[_0x04d9('0x41')]['id']}})[_0x04d9('0x22')](handleEntityNotFound(_0x31ad96,null))['then'](saveUpdates(_0x90150c[_0x04d9('0x45')],null))[_0x04d9('0x22')](respondWithResult(_0x31ad96,null))[_0x04d9('0x40')](handleError(_0x31ad96,null));}; \ No newline at end of file +var _0x1208=['status','json','limit','count','offset','set','Content-Range','save','then','destroy','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x21e607,_0x30c8ca){var _0x14912a=function(_0x2a595c){while(--_0x2a595c){_0x21e607['push'](_0x21e607['shift']());}};_0x14912a(++_0x30c8ca);}(_0x1208,0x1a1));var _0x8120=function(_0x57db19,_0x6b6722){_0x57db19=_0x57db19-0x0;var _0x1a410d=_0x1208[_0x57db19];return _0x1a410d;};'use strict';var emlformat=require(_0x8120('0x0'));var rimraf=require(_0x8120('0x1'));var zipdir=require(_0x8120('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8120('0x3'));var moment=require(_0x8120('0x4'));var BPromise=require(_0x8120('0x5'));var Mustache=require(_0x8120('0x6'));var util=require(_0x8120('0x7'));var path=require(_0x8120('0x8'));var sox=require(_0x8120('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8120('0xa'));var _=require(_0x8120('0xb'));var squel=require(_0x8120('0xc'));var crypto=require(_0x8120('0xd'));var jsforce=require(_0x8120('0xe'));var deskjs=require(_0x8120('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8120('0x10'));var Papa=require(_0x8120('0x11'));var Redis=require(_0x8120('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8120('0x13'));var as=require(_0x8120('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8120('0x15'))(_0x8120('0x16'));var utils=require(_0x8120('0x17'));var config=require(_0x8120('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c01b,_0x5602aa){_0x5602aa=_0x5602aa||0xcc;return function(_0x415139){if(_0x415139){return _0x25c01b[_0x8120('0x19')](_0x5602aa);}return _0x25c01b['status'](_0x5602aa)[_0x8120('0x1a')]();};}function respondWithResult(_0x204379,_0x319865){_0x319865=_0x319865||0xc8;return function(_0x119a7d){if(_0x119a7d){return _0x204379[_0x8120('0x1b')](_0x319865)[_0x8120('0x1c')](_0x119a7d);}};}function respondWithFilteredResult(_0x38d57b,_0x213fcb){return function(_0x28a348){if(_0x28a348){var _0x4d4a39=typeof _0x213fcb['offset']==='undefined'&&typeof _0x213fcb[_0x8120('0x1d')]==='undefined';var _0x2ff0f2=_0x28a348['count'];var _0x57e627=_0x4d4a39?0x0:_0x213fcb['offset'];var _0x21b0b6=_0x4d4a39?_0x28a348[_0x8120('0x1e')]:_0x213fcb[_0x8120('0x1f')]+_0x213fcb['limit'];var _0x2decab;if(_0x21b0b6>=_0x2ff0f2){_0x21b0b6=_0x2ff0f2;_0x2decab=0xc8;}else{_0x2decab=0xce;}_0x38d57b[_0x8120('0x1b')](_0x2decab);return _0x38d57b[_0x8120('0x20')](_0x8120('0x21'),_0x57e627+'-'+_0x21b0b6+'/'+_0x2ff0f2)[_0x8120('0x1c')](_0x28a348);}return null;};}function patchUpdates(_0x143360){return function(_0x273f41){try{jsonpatch['apply'](_0x273f41,_0x143360,!![]);}catch(_0x9d8d2a){return BPromise['reject'](_0x9d8d2a);}return _0x273f41[_0x8120('0x22')]();};}function saveUpdates(_0x157c09,_0x1dda4b){return function(_0x337199){if(_0x337199){return _0x337199['update'](_0x157c09)[_0x8120('0x23')](function(_0x472d51){return _0x472d51;});}return null;};}function removeEntity(_0x3e835b,_0x8cff34){return function(_0x4de468){if(_0x4de468){return _0x4de468[_0x8120('0x24')]()[_0x8120('0x23')](function(){_0x3e835b[_0x8120('0x1b')](0xcc)[_0x8120('0x1a')]();});}};}function handleEntityNotFound(_0x3ecf82,_0x5879c0){return function(_0x289e8){if(!_0x289e8){_0x3ecf82['sendStatus'](0x194);}return _0x289e8;};}function handleError(_0x42bc31,_0x5992b0){_0x5992b0=_0x5992b0||0x1f4;return function(_0x2f5019){logger[_0x8120('0x25')](_0x2f5019[_0x8120('0x26')]);if(_0x2f5019['name']){delete _0x2f5019[_0x8120('0x27')];}_0x42bc31[_0x8120('0x1b')](_0x5992b0)[_0x8120('0x28')](_0x2f5019);};}exports[_0x8120('0x29')]=function(_0x221200,_0x429167){var _0x17e684={},_0x2c5ce7={},_0x4e68a3={'count':0x0,'rows':[]};var _0x17069d=_['map'](db[_0x8120('0x2a')][_0x8120('0x2b')],function(_0x5cbcb9){return{'name':_0x5cbcb9[_0x8120('0x2c')],'type':_0x5cbcb9[_0x8120('0x2d')]['key']};});_0x2c5ce7['model']=_[_0x8120('0x2e')](_0x17069d,_0x8120('0x27'));_0x2c5ce7[_0x8120('0x2f')]=_[_0x8120('0x30')](_0x221200[_0x8120('0x2f')]);_0x2c5ce7[_0x8120('0x31')]=_['intersection'](_0x2c5ce7[_0x8120('0x32')],_0x2c5ce7['query']);_0x17e684[_0x8120('0x33')]=_[_0x8120('0x34')](_0x2c5ce7[_0x8120('0x32')],qs[_0x8120('0x35')](_0x221200['query'][_0x8120('0x35')]));_0x17e684['attributes']=_0x17e684['attributes'][_0x8120('0x36')]?_0x17e684['attributes']:_0x2c5ce7[_0x8120('0x32')];if(!_0x221200['query'][_0x8120('0x37')]('nolimit')){_0x17e684['limit']=qs['limit'](_0x221200[_0x8120('0x2f')][_0x8120('0x1d')]);_0x17e684[_0x8120('0x1f')]=qs[_0x8120('0x1f')](_0x221200[_0x8120('0x2f')][_0x8120('0x1f')]);}_0x17e684['order']=qs[_0x8120('0x38')](_0x221200[_0x8120('0x2f')][_0x8120('0x38')]);_0x17e684[_0x8120('0x39')]=qs['filters'](_[_0x8120('0x3a')](_0x221200[_0x8120('0x2f')],_0x2c5ce7[_0x8120('0x31')]),_0x17069d);if(_0x221200['query']['filter']){_0x17e684['where']=_[_0x8120('0x3b')](_0x17e684[_0x8120('0x39')],{'$or':_[_0x8120('0x2e')](_0x17069d,function(_0x5ceef7){if(_0x5ceef7['type']!==_0x8120('0x3c')){var _0x42fa11={};_0x42fa11[_0x5ceef7[_0x8120('0x27')]]={'$like':'%'+_0x221200[_0x8120('0x2f')][_0x8120('0x3d')]+'%'};return _0x42fa11;}})});}_0x17e684=_[_0x8120('0x3b')]({},_0x17e684,_0x221200[_0x8120('0x3e')]);var _0xe648e8={'where':_0x17e684[_0x8120('0x39')]};return db[_0x8120('0x2a')][_0x8120('0x1e')](_0xe648e8)[_0x8120('0x23')](function(_0x12c0e3){_0x4e68a3['count']=_0x12c0e3;if(_0x221200['query'][_0x8120('0x3f')]){_0x17e684[_0x8120('0x40')]=[{'all':!![]}];}return db[_0x8120('0x2a')][_0x8120('0x41')](_0x17e684);})[_0x8120('0x23')](function(_0x133e8d){_0x4e68a3['rows']=_0x133e8d;return _0x4e68a3;})[_0x8120('0x23')](respondWithFilteredResult(_0x429167,_0x17e684))[_0x8120('0x42')](handleError(_0x429167,null));};exports[_0x8120('0x43')]=function(_0x5afc3b,_0x8f6267){var _0xe5f909={'raw':!![],'where':{'id':_0x5afc3b[_0x8120('0x44')]['id']}},_0x170792={};_0x170792[_0x8120('0x32')]=_[_0x8120('0x30')](db[_0x8120('0x2a')]['rawAttributes']);_0x170792['query']=_['keys'](_0x5afc3b[_0x8120('0x2f')]);_0x170792[_0x8120('0x31')]=_[_0x8120('0x34')](_0x170792[_0x8120('0x32')],_0x170792[_0x8120('0x2f')]);_0xe5f909[_0x8120('0x33')]=_['intersection'](_0x170792['model'],qs[_0x8120('0x35')](_0x5afc3b[_0x8120('0x2f')][_0x8120('0x35')]));_0xe5f909[_0x8120('0x33')]=_0xe5f909['attributes']['length']?_0xe5f909[_0x8120('0x33')]:_0x170792[_0x8120('0x32')];if(_0x5afc3b[_0x8120('0x2f')][_0x8120('0x3f')]){_0xe5f909[_0x8120('0x40')]=[{'all':!![]}];}_0xe5f909=_[_0x8120('0x3b')]({},_0xe5f909,_0x5afc3b[_0x8120('0x3e')]);return db[_0x8120('0x2a')]['find'](_0xe5f909)['then'](handleEntityNotFound(_0x8f6267,null))[_0x8120('0x23')](respondWithResult(_0x8f6267,null))['catch'](handleError(_0x8f6267,null));};exports[_0x8120('0x45')]=function(_0x1d99a6,_0x32f8db){return db[_0x8120('0x2a')][_0x8120('0x45')](_0x1d99a6[_0x8120('0x46')],{})[_0x8120('0x23')](respondWithResult(_0x32f8db,0xc9))[_0x8120('0x42')](handleError(_0x32f8db,null));};exports['describe']=function(_0x5cc7b8,_0x5df4b7){return db[_0x8120('0x2a')][_0x8120('0x47')]()['then'](respondWithResult(_0x5df4b7,null))[_0x8120('0x42')](handleError(_0x5df4b7,null));};exports['update']=function(_0x5c1048,_0x2e3f3e){if(_0x5c1048[_0x8120('0x46')]['uniqueid']){delete _0x5c1048['body'][_0x8120('0x48')];}return db[_0x8120('0x2a')][_0x8120('0x49')]({'where':{'uniqueid':_0x5c1048[_0x8120('0x44')]['id']}})[_0x8120('0x23')](handleEntityNotFound(_0x2e3f3e,null))[_0x8120('0x23')](saveUpdates(_0x5c1048[_0x8120('0x46')],null))[_0x8120('0x23')](respondWithResult(_0x2e3f3e,null))[_0x8120('0x42')](handleError(_0x2e3f3e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d876dd2..a02269b 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 _0xda2d=['api','moment','bluebird','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x4e3c02,_0x734e35){var _0x5a1912=function(_0x49c24b){while(--_0x49c24b){_0x4e3c02['push'](_0x4e3c02['shift']());}};_0x5a1912(++_0x734e35);}(_0xda2d,0x102));var _0xdda2=function(_0x3d487f,_0x318849){_0x3d487f=_0x3d487f-0x0;var _0x358039=_0xda2d[_0x3d487f];return _0x358039;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[{'name':_0xdda2('0xb'),'fields':[_0xdda2('0xb')]},{'name':'uniqueid','fields':[_0xdda2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f37=['uniqueid','lodash','util','api','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x9f37,0xd1));var _0x79f3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9f37[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var logger=require('../../config/logger')(_0x79f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79f3('0x3'));var fs=require('fs');var path=require(_0x79f3('0x4'));var rimraf=require(_0x79f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x79f3('0x6'));module[_0x79f3('0x7')]=function(_0x594d87,_0x5db84b){return _0x594d87[_0x79f3('0x8')](_0x79f3('0x9'),attributes,{'tableName':_0x79f3('0xa'),'paranoid':![],'indexes':[{'name':_0x79f3('0xb'),'fields':['endtime']},{'name':_0x79f3('0xc'),'fields':[_0x79f3('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 204fbbc..8bdb243 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 _0x5ab4=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','create','body','options','CmHopperHistory','where','sequelize','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','catch','GetVoiceQueueHopperHistory','findAll','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x5ab4,0x9f));var _0x45ab=function(_0x94c901,_0x810a17){_0x94c901=_0x94c901-0x0;var _0x547151=_0x5ab4[_0x94c901];return _0x547151;};'use strict';var _=require(_0x45ab('0x0'));var util=require(_0x45ab('0x1'));var moment=require(_0x45ab('0x2'));var BPromise=require(_0x45ab('0x3'));var rs=require(_0x45ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ab('0x5'))['db'];var utils=require(_0x45ab('0x6'));var logger=require(_0x45ab('0x7'))(_0x45ab('0x8'));var config=require(_0x45ab('0x9'));var jayson=require(_0x45ab('0xa'));var client=jayson['client'][_0x45ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a033,_0x2941e8,_0x4250ec){return new BPromise(function(_0x2beb3a,_0x2b7264){return client[_0x45ab('0xc')](_0x22a033,_0x4250ec)[_0x45ab('0xd')](function(_0x292720){logger[_0x45ab('0xe')](_0x45ab('0xf'),_0x2941e8,_0x45ab('0x10'));logger[_0x45ab('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2941e8,_0x45ab('0x10'),JSON[_0x45ab('0x12')](_0x292720));if(_0x292720[_0x45ab('0x13')]){if(_0x292720[_0x45ab('0x13')][_0x45ab('0x14')]===0x1f4){logger[_0x45ab('0x13')](_0x45ab('0xf'),_0x2941e8,_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);return _0x2b7264(_0x292720['error']['message']);}logger[_0x45ab('0x13')](_0x45ab('0xf'),_0x2941e8,_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);return _0x2beb3a(_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);}else{logger[_0x45ab('0xe')](_0x45ab('0xf'),_0x2941e8,'request\x20sent');_0x2beb3a(_0x292720[_0x45ab('0x16')][_0x45ab('0x15')]);}})['catch'](function(_0x3a9e8b){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2941e8,_0x3a9e8b);_0x2b7264(_0x3a9e8b);});});}exports[_0x45ab('0x17')]=function(_0x46ef46){var _0x40e4d1=this;return new Promise(function(_0xac7ce0,_0x277352){return db['CmHopperHistory'][_0x45ab('0x18')](_0x46ef46[_0x45ab('0x19')],{'raw':_0x46ef46[_0x45ab('0x1a')]?_0x46ef46[_0x45ab('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x45ab('0xd')](function(_0x54fdab){logger[_0x45ab('0xe')](_0x45ab('0x17'),_0x46ef46);logger[_0x45ab('0x11')](_0x45ab('0x17'),_0x46ef46,JSON[_0x45ab('0x12')](_0x54fdab));_0xac7ce0(_0x54fdab);})['catch'](function(_0x16549e){logger[_0x45ab('0x13')]('CreateCmHopperHistory',_0x16549e[_0x45ab('0x15')],_0x46ef46);_0x277352(_0x40e4d1[_0x45ab('0x13')](0x1f4,_0x16549e[_0x45ab('0x15')]));});});};exports['AvgHandleTime']=function(_0x229ead){var _0x559a00=this;return new Promise(function(_0x577a3a,_0x4d5fac){return db[_0x45ab('0x1b')]['findAll']({'raw':_0x229ead['options']?_0x229ead[_0x45ab('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x229ead[_0x45ab('0x1a')]?_0x229ead[_0x45ab('0x1a')][_0x45ab('0x1c')]||null:null,'attributes':[[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x20')))),_0x45ab('0x21')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0x45ab('0x22')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x45ab('0x24')))),'predictiveIntervalAvgHoldtime'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x23'),db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x25')))),'predictiveIntervalAvgTalktime']]})[_0x45ab('0xd')](function(_0x2b0158){logger[_0x45ab('0xe')](_0x45ab('0x26'),_0x229ead);logger[_0x45ab('0x11')]('AvgHandleTime',_0x229ead,JSON[_0x45ab('0x12')](_0x2b0158));_0x577a3a(_0x2b0158);})[_0x45ab('0x27')](function(_0x58bd17){logger[_0x45ab('0x13')]('AvgHandleTime',_0x58bd17[_0x45ab('0x15')],_0x229ead);_0x4d5fac(_0x559a00[_0x45ab('0x13')](0x1f4,_0x58bd17[_0x45ab('0x15')]));});});};exports[_0x45ab('0x28')]=function(_0x5e5379){var _0x3d3694=this;return new Promise(function(_0x5e2fa9,_0x5aeff1){return db[_0x45ab('0x1b')][_0x45ab('0x29')]({'raw':_0x5e5379[_0x45ab('0x1a')]?_0x5e5379[_0x45ab('0x1a')][_0x45ab('0x2a')]===undefined?!![]:![]:!![],'where':_0x5e5379[_0x45ab('0x1a')]?_0x5e5379['options'][_0x45ab('0x1c')]||null:null,'attributes':[[_0x45ab('0x2b'),_0x45ab('0x2c')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')](_0x45ab('0x2d')))),_0x45ab('0x2e')],[db['sequelize']['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')](_0x45ab('0x2f')))),_0x45ab('0x30')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x45ab('0x31')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')](_0x45ab('0x32')))),'outboundBusyCallsDay'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x208,\x201,\x20null'))),_0x45ab('0x33')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x45ab('0x34')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x35')))),_0x45ab('0x36')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x2012,\x201,\x20null'))),_0x45ab('0x37')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x38')))),'outboundBlacklistCallsDay'],[db[_0x45ab('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x45ab('0x1d')]['literal'](_0x45ab('0x39')))),_0x45ab('0x3a')],[db['sequelize']['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x3b')))),_0x45ab('0x3c')],[db[_0x45ab('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x3d')))),_0x45ab('0x3e')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x3f')))),_0x45ab('0x3c')],[db[_0x45ab('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x45ab('0x1d')]['literal'](_0x45ab('0x40')))),_0x45ab('0x41')]],'group':['campaign']})['then'](function(_0x26f423){logger[_0x45ab('0xe')](_0x45ab('0x28'),_0x5e5379);logger[_0x45ab('0x11')](_0x45ab('0x28'),_0x5e5379,JSON[_0x45ab('0x12')](_0x26f423));_0x5e2fa9(_0x26f423);})[_0x45ab('0x27')](function(_0x2ee47c){logger[_0x45ab('0x13')]('GetVoiceQueueHopperHistory',_0x2ee47c[_0x45ab('0x15')],_0x5e5379);_0x5aeff1(_0x3d3694[_0x45ab('0x13')](0x1f4,_0x2ee47c[_0x45ab('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x45c6dd){var _0x189280=this;return new Promise(function(_0xaf5bd4,_0x5505a3){return db[_0x45ab('0x1b')][_0x45ab('0x29')]({'raw':_0x45c6dd['options']?_0x45c6dd[_0x45ab('0x1a')][_0x45ab('0x2a')]===undefined?!![]:![]:!![],'where':_0x45c6dd[_0x45ab('0x1a')]?_0x45c6dd[_0x45ab('0x1a')][_0x45ab('0x1c')]||null:null,'attributes':[[_0x45ab('0x2b'),_0x45ab('0x2c')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['col']('id')),_0x45ab('0x42')],[db['sequelize']['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x45ab('0x43')]],'group':[_0x45ab('0x2b')]})['then'](function(_0x31e8e1){logger['info'](_0x45ab('0x44'),_0x45c6dd);logger['debug'](_0x45ab('0x44'),_0x45c6dd,JSON[_0x45ab('0x12')](_0x31e8e1));_0xaf5bd4(_0x31e8e1);})[_0x45ab('0x27')](function(_0x50d837){logger[_0x45ab('0x13')](_0x45ab('0x44'),_0x50d837[_0x45ab('0x15')],_0x45c6dd);_0x5505a3(_0x189280[_0x45ab('0x13')](0x1f4,_0x50d837['message']));});});}; \ No newline at end of file +var _0xa9be=['message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','stringify','AvgHandleTime','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x2ba17d,_0x168f47){var _0x142eef=function(_0x4f1f3d){while(--_0x4f1f3d){_0x2ba17d['push'](_0x2ba17d['shift']());}};_0x142eef(++_0x168f47);}(_0xa9be,0x1eb));var _0xea9b=function(_0x4b8744,_0x2b0446){_0x4b8744=_0x4b8744-0x0;var _0x2699a3=_0xa9be[_0x4b8744];return _0x2699a3;};'use strict';var _=require(_0xea9b('0x0'));var util=require(_0xea9b('0x1'));var moment=require(_0xea9b('0x2'));var BPromise=require(_0xea9b('0x3'));var rs=require(_0xea9b('0x4'));var fs=require('fs');var Redis=require(_0xea9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea9b('0x6'));var logger=require(_0xea9b('0x7'))(_0xea9b('0x8'));var config=require(_0xea9b('0x9'));var jayson=require(_0xea9b('0xa'));var client=jayson[_0xea9b('0xb')][_0xea9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f1c0e,_0x10e567,_0x1197c1){return new BPromise(function(_0x4f513f,_0x156dfb){return client['request'](_0x4f1c0e,_0x1197c1)[_0xea9b('0xd')](function(_0x2bacbc){logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,_0xea9b('0x10'));logger[_0xea9b('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x10e567,_0xea9b('0x10'),JSON['stringify'](_0x2bacbc));if(_0x2bacbc[_0xea9b('0x12')]){if(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x13')]===0x1f4){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')]['message']);return _0x156dfb(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);}logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);return _0x4f513f(_0x2bacbc['error'][_0xea9b('0x14')]);}else{logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,'request\x20sent');_0x4f513f(_0x2bacbc[_0xea9b('0x15')][_0xea9b('0x14')]);}})[_0xea9b('0x16')](function(_0x1c2dd8){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x1c2dd8);_0x156dfb(_0x1c2dd8);});});}exports[_0xea9b('0x17')]=function(_0x1de758){var _0x49dd19=this;return new Promise(function(_0x4c1b81,_0xc033e0){return db[_0xea9b('0x18')][_0xea9b('0x19')](_0x1de758[_0xea9b('0x1a')],{'raw':_0x1de758[_0xea9b('0x1b')]?_0x1de758[_0xea9b('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x20f52f){logger[_0xea9b('0xe')](_0xea9b('0x17'),_0x1de758);logger[_0xea9b('0x11')](_0xea9b('0x17'),_0x1de758,JSON[_0xea9b('0x1c')](_0x20f52f));_0x4c1b81(_0x20f52f);})['catch'](function(_0x419586){logger['error'](_0xea9b('0x17'),_0x419586[_0xea9b('0x14')],_0x1de758);_0xc033e0(_0x49dd19[_0xea9b('0x12')](0x1f4,_0x419586[_0xea9b('0x14')]));});});};exports[_0xea9b('0x1d')]=function(_0x5037dc){var _0x4e556d=this;return new Promise(function(_0x3fb675,_0x6f82cf){return db[_0xea9b('0x18')]['findAll']({'raw':_0x5037dc['options']?_0x5037dc[_0xea9b('0x1b')][_0xea9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5037dc[_0xea9b('0x1b')]?_0x5037dc[_0xea9b('0x1b')][_0xea9b('0x1f')]||null:null,'attributes':[[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')][_0xea9b('0x22')]('id')),_0xea9b('0x23')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal'](_0xea9b('0x24')))),_0xea9b('0x25')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xea9b('0x26')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')](_0xea9b('0x27')))),_0xea9b('0x28')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x29'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')](_0xea9b('0x2a')))),_0xea9b('0x2b')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x29'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal'](_0xea9b('0x2c')))),_0xea9b('0x2d')]]})[_0xea9b('0xd')](function(_0x3487c7){logger[_0xea9b('0xe')](_0xea9b('0x1d'),_0x5037dc);logger[_0xea9b('0x11')](_0xea9b('0x1d'),_0x5037dc,JSON['stringify'](_0x3487c7));_0x3fb675(_0x3487c7);})[_0xea9b('0x16')](function(_0x38f012){logger['error'](_0xea9b('0x1d'),_0x38f012[_0xea9b('0x14')],_0x5037dc);_0x6f82cf(_0x4e556d[_0xea9b('0x12')](0x1f4,_0x38f012[_0xea9b('0x14')]));});});};exports[_0xea9b('0x2e')]=function(_0x28c888){var _0x119565=this;return new Promise(function(_0x12e93e,_0x2ad5b4){return db[_0xea9b('0x18')]['findAll']({'raw':_0x28c888[_0xea9b('0x1b')]?_0x28c888[_0xea9b('0x1b')][_0xea9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x28c888[_0xea9b('0x1b')]?_0x28c888[_0xea9b('0x1b')][_0xea9b('0x1f')]||null:null,'attributes':[[_0xea9b('0x2f'),_0xea9b('0x30')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x31')))),_0xea9b('0x32')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xea9b('0x33')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xea9b('0x34')],[db['sequelize']['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xea9b('0x35')],[db['sequelize']['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x36')))),_0xea9b('0x37')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x38')))),_0xea9b('0x39')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xea9b('0x3a')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db['sequelize'][_0xea9b('0x26')]('`state`\x20=\x2012,\x201,\x20null'))),_0xea9b('0x3b')],[db[_0xea9b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')]('`state`\x20=\x2013,\x201,\x20null'))),_0xea9b('0x3c')],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x3d')))),_0xea9b('0x3e')],[db['sequelize']['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x3f')))),_0xea9b('0x40')],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')][_0xea9b('0x26')](_0xea9b('0x41')))),_0xea9b('0x42')],[db[_0xea9b('0x20')]['fn']('COUNT',db[_0xea9b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xea9b('0x40')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal'](_0xea9b('0x43')))),_0xea9b('0x44')]],'group':[_0xea9b('0x2f')]})[_0xea9b('0xd')](function(_0x56ad5f){logger[_0xea9b('0xe')](_0xea9b('0x2e'),_0x28c888);logger[_0xea9b('0x11')]('GetVoiceQueueHopperHistory',_0x28c888,JSON['stringify'](_0x56ad5f));_0x12e93e(_0x56ad5f);})[_0xea9b('0x16')](function(_0x399072){logger[_0xea9b('0x12')]('GetVoiceQueueHopperHistory',_0x399072[_0xea9b('0x14')],_0x28c888);_0x2ad5b4(_0x119565[_0xea9b('0x12')](0x1f4,_0x399072[_0xea9b('0x14')]));});});};exports[_0xea9b('0x45')]=function(_0x988bc){var _0x1ac804=this;return new Promise(function(_0x51fb81,_0x153b03){return db[_0xea9b('0x18')][_0xea9b('0x46')]({'raw':_0x988bc['options']?_0x988bc[_0xea9b('0x1b')][_0xea9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x988bc[_0xea9b('0x1b')]?_0x988bc[_0xea9b('0x1b')][_0xea9b('0x1f')]||null:null,'attributes':[['campaign',_0xea9b('0x30')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')][_0xea9b('0x22')]('id')),_0xea9b('0x47')],[db[_0xea9b('0x20')]['fn'](_0xea9b('0x21'),db[_0xea9b('0x20')]['fn']('IF',db[_0xea9b('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xea9b('0x48')]],'group':[_0xea9b('0x2f')]})[_0xea9b('0xd')](function(_0x551d94){logger[_0xea9b('0xe')](_0xea9b('0x45'),_0x988bc);logger[_0xea9b('0x11')]('GetCampaignHopperHistory',_0x988bc,JSON[_0xea9b('0x1c')](_0x551d94));_0x51fb81(_0x551d94);})[_0xea9b('0x16')](function(_0x31746a){logger[_0xea9b('0x12')](_0xea9b('0x45'),_0x31746a[_0xea9b('0x14')],_0x988bc);_0x153b03(_0x1ac804[_0xea9b('0x12')](0x1f4,_0x31746a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9b22a77..34e5205 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 _0xd9d2=['post','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x3fcaf6,_0x5d3940){var _0x42eb77=function(_0x37d27c){while(--_0x37d27c){_0x3fcaf6['push'](_0x3fcaf6['shift']());}};_0x42eb77(++_0x5d3940);}(_0xd9d2,0x88));var _0x2d9d=function(_0x4bfcc4,_0x460dc9){_0x4bfcc4=_0x4bfcc4-0x0;var _0x85ce92=_0xd9d2[_0x4bfcc4];return _0x85ce92;};'use strict';var multer=require(_0x2d9d('0x0'));var util=require(_0x2d9d('0x1'));var path=require(_0x2d9d('0x2'));var timeout=require(_0x2d9d('0x3'));var express=require(_0x2d9d('0x4'));var router=express[_0x2d9d('0x5')]();var fs_extra=require(_0x2d9d('0x6'));var auth=require(_0x2d9d('0x7'));var interaction=require(_0x2d9d('0x8'));var config=require(_0x2d9d('0x9'));var controller=require(_0x2d9d('0xa'));router[_0x2d9d('0xb')]('/',auth[_0x2d9d('0xc')](),controller[_0x2d9d('0xd')]);router['get'](_0x2d9d('0xe'),auth[_0x2d9d('0xc')](),controller['describe']);router['get'](_0x2d9d('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x2d9d('0x10')]('/',auth[_0x2d9d('0xc')](),controller['create']);router[_0x2d9d('0x11')]('/:id',auth[_0x2d9d('0xc')](),controller[_0x2d9d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe2c9=['post','isAuthenticated','create','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe','describe'];(function(_0x3588f7,_0x318d8f){var _0x4b96d5=function(_0xd0b6a3){while(--_0xd0b6a3){_0x3588f7['push'](_0x3588f7['shift']());}};_0x4b96d5(++_0x318d8f);}(_0xe2c9,0x114));var _0x9e2c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe2c9[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x9e2c('0x0'));var util=require(_0x9e2c('0x1'));var path=require(_0x9e2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e2c('0x3'));var router=express[_0x9e2c('0x4')]();var fs_extra=require(_0x9e2c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e2c('0x6'));var config=require(_0x9e2c('0x7'));var controller=require(_0x9e2c('0x8'));router[_0x9e2c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9e2c('0x9')](_0x9e2c('0xa'),auth['isAuthenticated'](),controller[_0x9e2c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9e2c('0xc')]('/',auth[_0x9e2c('0xd')](),controller[_0x9e2c('0xe')]);router['put'](_0x9e2c('0xf'),auth[_0x9e2c('0xd')](),controller[_0x9e2c('0x10')]);module[_0x9e2c('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 5a4793d..70d601b 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 _0xf120=['STRING','name','exports'];(function(_0x2baa5d,_0x42a1cb){var _0x88bf18=function(_0x45385f){while(--_0x45385f){_0x2baa5d['push'](_0x2baa5d['shift']());}};_0x88bf18(++_0x42a1cb);}(_0xf120,0x179));var _0x0f12=function(_0x3dab0d,_0x1270a6){_0x3dab0d=_0x3dab0d-0x0;var _0x1481f4=_0xf120[_0x3dab0d];return _0x1481f4;};'use strict';var Sequelize=require('sequelize');module[_0x0f12('0x0')]={'name':{'type':Sequelize[_0x0f12('0x1')],'unique':_0x0f12('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x0f12('0x1')]}}; \ No newline at end of file +var _0x9ef8=['exports','name','STRING','sequelize'];(function(_0x77b525,_0xd4dc1e){var _0xa83673=function(_0x133b1f){while(--_0x133b1f){_0x77b525['push'](_0x77b525['shift']());}};_0xa83673(++_0xd4dc1e);}(_0x9ef8,0x17f));var _0x89ef=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x9ef8[_0x5a2d95];return _0x2c3986;};'use strict';var Sequelize=require(_0x89ef('0x0'));module[_0x89ef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x89ef('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x89ef('0x3')]},'dialPrefix':{'type':Sequelize[_0x89ef('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ff45023..eb7c6f6 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 _0xe1f1=['./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','Lists','UserProfileResource','stack','name','send','index','map','CmList','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','ListId','findAll','removeDispositions','CmContact','tags','join','isArray','push','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','ids','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost'];(function(_0x1602fb,_0x20b6b3){var _0x461831=function(_0x4a19f1){while(--_0x4a19f1){_0x1602fb['push'](_0x1602fb['shift']());}};_0x461831(++_0x20b6b3);}(_0xe1f1,0x1a2));var _0x1e1f=function(_0x3a35e0,_0x3ae8fd){_0x3a35e0=_0x3a35e0-0x0;var _0x436eee=_0xe1f1[_0x3a35e0];return _0x436eee;};'use strict';var emlformat=require(_0x1e1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e1f('0x1'));var jsonpatch=require(_0x1e1f('0x2'));var rp=require(_0x1e1f('0x3'));var moment=require(_0x1e1f('0x4'));var BPromise=require(_0x1e1f('0x5'));var Mustache=require('mustache');var util=require(_0x1e1f('0x6'));var path=require(_0x1e1f('0x7'));var sox=require(_0x1e1f('0x8'));var csv=require('to-csv');var ejs=require(_0x1e1f('0x9'));var fs=require('fs');var fs_extra=require(_0x1e1f('0xa'));var _=require(_0x1e1f('0xb'));var squel=require(_0x1e1f('0xc'));var crypto=require(_0x1e1f('0xd'));var jsforce=require(_0x1e1f('0xe'));var deskjs=require(_0x1e1f('0xf'));var toCsv=require(_0x1e1f('0x10'));var querystring=require(_0x1e1f('0x11'));var Papa=require(_0x1e1f('0x12'));var Redis=require(_0x1e1f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1e1f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e1f('0x15'));var logger=require(_0x1e1f('0x16'))(_0x1e1f('0x17'));var utils=require(_0x1e1f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1e1f('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1e1f('0x1a')](config[_0x1e1f('0x1b')],{'host':_0x1e1f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e1f('0x1b')]));require(_0x1e1f('0x1d'))[_0x1e1f('0x1e')](socket);function respondWithStatusCode(_0x253d9a,_0x38f2e5){_0x38f2e5=_0x38f2e5||0xcc;return function(_0x47ba73){if(_0x47ba73){return _0x253d9a[_0x1e1f('0x1f')](_0x38f2e5);}return _0x253d9a[_0x1e1f('0x20')](_0x38f2e5)[_0x1e1f('0x21')]();};}function respondWithResult(_0x499690,_0xceab1f){_0xceab1f=_0xceab1f||0xc8;return function(_0x255cef){if(_0x255cef){return _0x499690[_0x1e1f('0x20')](_0xceab1f)[_0x1e1f('0x22')](_0x255cef);}};}function respondWithFilteredResult(_0x2be3cb,_0x35f637){return function(_0x1069ff){if(_0x1069ff){var _0x5338c1=typeof _0x35f637[_0x1e1f('0x23')]===_0x1e1f('0x24')&&typeof _0x35f637['limit']===_0x1e1f('0x24');var _0x4aa3d3=_0x1069ff['count'];var _0x491669=_0x5338c1?0x0:_0x35f637[_0x1e1f('0x23')];var _0x131762=_0x5338c1?_0x1069ff[_0x1e1f('0x25')]:_0x35f637[_0x1e1f('0x23')]+_0x35f637[_0x1e1f('0x26')];var _0x4f2da5;if(_0x131762>=_0x4aa3d3){_0x131762=_0x4aa3d3;_0x4f2da5=0xc8;}else{_0x4f2da5=0xce;}_0x2be3cb[_0x1e1f('0x20')](_0x4f2da5);return _0x2be3cb[_0x1e1f('0x27')]('Content-Range',_0x491669+'-'+_0x131762+'/'+_0x4aa3d3)['json'](_0x1069ff);}return null;};}function patchUpdates(_0x39514d){return function(_0x46d674){try{jsonpatch[_0x1e1f('0x28')](_0x46d674,_0x39514d,!![]);}catch(_0xfeb96a){return BPromise[_0x1e1f('0x29')](_0xfeb96a);}return _0x46d674[_0x1e1f('0x2a')]();};}function saveUpdates(_0x38a2c6,_0x538599){return function(_0x71040a){if(_0x71040a){return _0x71040a['update'](_0x38a2c6)[_0x1e1f('0x2b')](function(_0x530b3b){return _0x530b3b;});}return null;};}function removeEntity(_0x5d54ec,_0x1b5c22){return function(_0x1f84a1){if(_0x1f84a1){return _0x1f84a1[_0x1e1f('0x2c')]()[_0x1e1f('0x2b')](function(){var _0x443822=_0x1f84a1[_0x1e1f('0x2d')]({'plain':!![]});var _0x3207e6=_0x1e1f('0x2e');return db[_0x1e1f('0x2f')][_0x1e1f('0x2c')]({'where':{'type':_0x3207e6,'resourceId':_0x443822['id']}})['then'](function(){return _0x1f84a1;});})[_0x1e1f('0x2b')](function(){_0x5d54ec[_0x1e1f('0x20')](0xcc)[_0x1e1f('0x21')]();});}};}function handleEntityNotFound(_0x1f6c3e,_0x27f062){return function(_0x4c9d99){if(!_0x4c9d99){_0x1f6c3e['sendStatus'](0x194);}return _0x4c9d99;};}function handleError(_0x57b167,_0x4c1982){_0x4c1982=_0x4c1982||0x1f4;return function(_0x1661ed){logger['error'](_0x1661ed[_0x1e1f('0x30')]);if(_0x1661ed[_0x1e1f('0x31')]){delete _0x1661ed[_0x1e1f('0x31')];}_0x57b167[_0x1e1f('0x20')](_0x4c1982)[_0x1e1f('0x32')](_0x1661ed);};}exports[_0x1e1f('0x33')]=function(_0x3f4b4b,_0x31f402){var _0x558081={},_0x3e17ba={},_0x530a4e={'count':0x0,'rows':[]};var _0x2d19b6=_[_0x1e1f('0x34')](db[_0x1e1f('0x35')]['rawAttributes'],function(_0x48143c){return{'name':_0x48143c[_0x1e1f('0x36')],'type':_0x48143c[_0x1e1f('0x37')]['key']};});_0x3e17ba[_0x1e1f('0x38')]=_[_0x1e1f('0x34')](_0x2d19b6,_0x1e1f('0x31'));_0x3e17ba[_0x1e1f('0x39')]=_[_0x1e1f('0x3a')](_0x3f4b4b[_0x1e1f('0x39')]);_0x3e17ba[_0x1e1f('0x3b')]=_[_0x1e1f('0x3c')](_0x3e17ba[_0x1e1f('0x38')],_0x3e17ba['query']);_0x558081['attributes']=_[_0x1e1f('0x3c')](_0x3e17ba[_0x1e1f('0x38')],qs[_0x1e1f('0x3d')](_0x3f4b4b[_0x1e1f('0x39')][_0x1e1f('0x3d')]));_0x558081[_0x1e1f('0x3e')]=_0x558081[_0x1e1f('0x3e')][_0x1e1f('0x3f')]?_0x558081[_0x1e1f('0x3e')]:_0x3e17ba[_0x1e1f('0x38')];if(!_0x3f4b4b[_0x1e1f('0x39')][_0x1e1f('0x40')]('nolimit')){_0x558081[_0x1e1f('0x26')]=qs[_0x1e1f('0x26')](_0x3f4b4b[_0x1e1f('0x39')][_0x1e1f('0x26')]);_0x558081[_0x1e1f('0x23')]=qs[_0x1e1f('0x23')](_0x3f4b4b[_0x1e1f('0x39')][_0x1e1f('0x23')]);}_0x558081[_0x1e1f('0x41')]=qs[_0x1e1f('0x42')](_0x3f4b4b[_0x1e1f('0x39')]['sort']);_0x558081[_0x1e1f('0x43')]=qs[_0x1e1f('0x3b')](_[_0x1e1f('0x44')](_0x3f4b4b[_0x1e1f('0x39')],_0x3e17ba[_0x1e1f('0x3b')]),_0x2d19b6);if(_0x3f4b4b[_0x1e1f('0x39')][_0x1e1f('0x45')]){_0x558081[_0x1e1f('0x43')]=_['merge'](_0x558081[_0x1e1f('0x43')],{'$or':_[_0x1e1f('0x34')](_0x2d19b6,function(_0x399d6f){if(_0x399d6f['type']!==_0x1e1f('0x46')){var _0xb3cad5={};_0xb3cad5[_0x399d6f[_0x1e1f('0x31')]]={'$like':'%'+_0x3f4b4b['query'][_0x1e1f('0x45')]+'%'};return _0xb3cad5;}})});}_0x558081=_[_0x1e1f('0x47')]({},_0x558081,_0x3f4b4b['options']);var _0x143aa3={'where':_0x558081[_0x1e1f('0x43')]};return db['CmList']['count'](_0x143aa3)['then'](function(_0x404637){_0x530a4e[_0x1e1f('0x25')]=_0x404637;if(_0x3f4b4b['query'][_0x1e1f('0x48')]){_0x558081[_0x1e1f('0x49')]=[{'all':!![]}];}return db[_0x1e1f('0x35')]['findAll'](_0x558081);})[_0x1e1f('0x2b')](function(_0xa09bdf){_0x530a4e[_0x1e1f('0x4a')]=_0xa09bdf;return _0x530a4e;})[_0x1e1f('0x2b')](respondWithFilteredResult(_0x31f402,_0x558081))[_0x1e1f('0x4b')](handleError(_0x31f402,null));};exports[_0x1e1f('0x4c')]=function(_0x19e13c,_0x250873){var _0x40de70={'raw':![],'where':{'id':_0x19e13c[_0x1e1f('0x4d')]['id']}},_0x23ef76={};_0x23ef76[_0x1e1f('0x38')]=_[_0x1e1f('0x3a')](db[_0x1e1f('0x35')][_0x1e1f('0x4e')]);_0x23ef76[_0x1e1f('0x39')]=_[_0x1e1f('0x3a')](_0x19e13c[_0x1e1f('0x39')]);_0x23ef76[_0x1e1f('0x3b')]=_[_0x1e1f('0x3c')](_0x23ef76['model'],_0x23ef76['query']);_0x40de70[_0x1e1f('0x3e')]=_[_0x1e1f('0x3c')](_0x23ef76['model'],qs[_0x1e1f('0x3d')](_0x19e13c['query'][_0x1e1f('0x3d')]));_0x40de70[_0x1e1f('0x3e')]=_0x40de70[_0x1e1f('0x3e')][_0x1e1f('0x3f')]?_0x40de70[_0x1e1f('0x3e')]:_0x23ef76[_0x1e1f('0x38')];if(_0x19e13c['query'][_0x1e1f('0x48')]){_0x40de70[_0x1e1f('0x49')]=[{'all':!![]}];}_0x40de70=_[_0x1e1f('0x47')]({},_0x40de70,_0x19e13c[_0x1e1f('0x4f')]);return db['CmList'][_0x1e1f('0x50')](_0x40de70)[_0x1e1f('0x2b')](handleEntityNotFound(_0x250873,null))['then'](respondWithResult(_0x250873,null))[_0x1e1f('0x4b')](handleError(_0x250873,null));};exports[_0x1e1f('0x51')]=function(_0x38e545,_0x44a47a){return db[_0x1e1f('0x35')]['create'](_0x38e545[_0x1e1f('0x52')],{})[_0x1e1f('0x2b')](function(_0x4d019c){var _0x3ea2a1=_0x38e545[_0x1e1f('0x53')][_0x1e1f('0x2d')]({'plain':!![]});if(!_0x3ea2a1)throw new Error(_0x1e1f('0x54'));if(_0x3ea2a1[_0x1e1f('0x55')]===_0x1e1f('0x53')){var _0x9ff719=_0x4d019c[_0x1e1f('0x2d')]({'plain':!![]});var _0x55aff7=_0x1e1f('0x2e');return db[_0x1e1f('0x56')]['find']({'where':{'name':_0x55aff7,'userProfileId':_0x3ea2a1[_0x1e1f('0x57')]},'raw':!![]})[_0x1e1f('0x2b')](function(_0xfe0b9c){if(_0xfe0b9c&&_0xfe0b9c[_0x1e1f('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x9ff719[_0x1e1f('0x31')],'resourceId':_0x9ff719['id'],'type':_0xfe0b9c[_0x1e1f('0x31')],'sectionId':_0xfe0b9c['id']},{})[_0x1e1f('0x2b')](function(){return _0x4d019c;});}else{return _0x4d019c;}})[_0x1e1f('0x4b')](function(_0x29e72d){logger['error'](_0x1e1f('0x59'),_0x29e72d);throw _0x29e72d;});}return _0x4d019c;})[_0x1e1f('0x2b')](respondWithResult(_0x44a47a,0xc9))['catch'](handleError(_0x44a47a,null));};exports[_0x1e1f('0x5a')]=function(_0x430049,_0x589c5a){if(_0x430049[_0x1e1f('0x52')]['id']){delete _0x430049[_0x1e1f('0x52')]['id'];}return db[_0x1e1f('0x35')][_0x1e1f('0x50')]({'where':{'id':_0x430049[_0x1e1f('0x4d')]['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0x589c5a,null))[_0x1e1f('0x2b')](saveUpdates(_0x430049['body'],null))[_0x1e1f('0x2b')](respondWithResult(_0x589c5a,null))[_0x1e1f('0x4b')](handleError(_0x589c5a,null));};exports[_0x1e1f('0x2c')]=function(_0x5510b2,_0x10b993){return db[_0x1e1f('0x35')][_0x1e1f('0x50')]({'where':{'id':_0x5510b2[_0x1e1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x10b993,null))[_0x1e1f('0x2b')](removeEntity(_0x10b993,null))[_0x1e1f('0x4b')](handleError(_0x10b993,null));};exports['describe']=function(_0x482e2e,_0x50d4e7){return db[_0x1e1f('0x35')][_0x1e1f('0x5b')]()[_0x1e1f('0x2b')](respondWithResult(_0x50d4e7,null))[_0x1e1f('0x4b')](handleError(_0x50d4e7,null));};exports[_0x1e1f('0x5c')]=function(_0x482209,_0x3b0bc8,_0x4603b2){if(_0x482209[_0x1e1f('0x52')]['id']){delete _0x482209[_0x1e1f('0x52')]['id'];}return db[_0x1e1f('0x35')][_0x1e1f('0x50')]({'where':{'id':_0x482209[_0x1e1f('0x4d')]['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0x3b0bc8,null))[_0x1e1f('0x2b')](function(_0x41544f){if(_0x41544f){_0x482209[_0x1e1f('0x52')]['ListId']=_0x41544f['id'];return db[_0x1e1f('0x5d')][_0x1e1f('0x51')](_0x482209[_0x1e1f('0x52')]);}})[_0x1e1f('0x2b')](respondWithResult(_0x3b0bc8,null))[_0x1e1f('0x4b')](handleError(_0x3b0bc8,null));};exports[_0x1e1f('0x5e')]=function(_0x3df8f0,_0x515fdd,_0x348005){var _0x20c7f3={'raw':![],'where':{}};var _0x22374c={};var _0x48350f={'count':0x0,'rows':[]};return db[_0x1e1f('0x35')][_0x1e1f('0x5f')]({'where':{'id':_0x3df8f0[_0x1e1f('0x4d')]['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0x515fdd,null))[_0x1e1f('0x2b')](function(_0x20226d){if(_0x20226d){_0x22374c[_0x1e1f('0x38')]=_['keys'](db['Disposition']['rawAttributes']);_0x22374c[_0x1e1f('0x39')]=_[_0x1e1f('0x3a')](_0x3df8f0[_0x1e1f('0x39')]);_0x22374c[_0x1e1f('0x3b')]=_[_0x1e1f('0x3c')](_0x22374c[_0x1e1f('0x38')],_0x22374c[_0x1e1f('0x39')]);_0x20c7f3[_0x1e1f('0x3e')]=_[_0x1e1f('0x3c')](_0x22374c[_0x1e1f('0x38')],qs[_0x1e1f('0x3d')](_0x3df8f0[_0x1e1f('0x39')][_0x1e1f('0x3d')]));_0x20c7f3['attributes']=_0x20c7f3['attributes']['length']?_0x20c7f3[_0x1e1f('0x3e')]:_0x22374c[_0x1e1f('0x38')];if(!_0x3df8f0['query'][_0x1e1f('0x40')](_0x1e1f('0x60'))){_0x20c7f3[_0x1e1f('0x26')]=qs[_0x1e1f('0x26')](_0x3df8f0['query'][_0x1e1f('0x26')]);_0x20c7f3[_0x1e1f('0x23')]=qs['offset'](_0x3df8f0[_0x1e1f('0x39')]['offset']);}_0x20c7f3['order']=qs[_0x1e1f('0x42')](_0x3df8f0[_0x1e1f('0x39')]['sort']);_0x20c7f3[_0x1e1f('0x43')]=qs[_0x1e1f('0x3b')](_[_0x1e1f('0x44')](_0x3df8f0[_0x1e1f('0x39')],_0x22374c['filters']));_0x20c7f3[_0x1e1f('0x43')][_0x1e1f('0x61')]=_0x20226d['id'];if(_0x3df8f0[_0x1e1f('0x39')][_0x1e1f('0x45')]){_0x20c7f3[_0x1e1f('0x43')]=_[_0x1e1f('0x47')](_0x20c7f3[_0x1e1f('0x43')],{'$or':_[_0x1e1f('0x34')](_0x20c7f3['attributes'],function(_0x235819){var _0x31eedc={};_0x31eedc[_0x235819]={'$like':'%'+_0x3df8f0['query'][_0x1e1f('0x45')]+'%'};return _0x31eedc;})});}_0x20c7f3=_[_0x1e1f('0x47')]({},_0x20c7f3,_0x3df8f0['options']);return db[_0x1e1f('0x5d')]['count']({'where':_0x20c7f3['where']})[_0x1e1f('0x2b')](function(_0x252d2f){_0x48350f['count']=_0x252d2f;if(_0x3df8f0['query']['includeAll']){_0x20c7f3['include']=[{'all':!![]}];}return db[_0x1e1f('0x5d')][_0x1e1f('0x62')](_0x20c7f3);})[_0x1e1f('0x2b')](function(_0x51d5df){_0x48350f[_0x1e1f('0x4a')]=_0x51d5df;return _0x48350f;});}})[_0x1e1f('0x2b')](respondWithFilteredResult(_0x515fdd,_0x20c7f3))[_0x1e1f('0x4b')](handleError(_0x515fdd,null));};exports[_0x1e1f('0x63')]=function(_0x568a17,_0x23f75a,_0x1a6758){return db[_0x1e1f('0x35')]['find']({'where':{'id':_0x568a17['params']['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0x23f75a,null))[_0x1e1f('0x2b')](function(_0x5c1772){if(_0x5c1772){return _0x5c1772[_0x1e1f('0x63')](_0x568a17['query']['ids']);}})[_0x1e1f('0x2b')](respondWithStatusCode(_0x23f75a,null))[_0x1e1f('0x4b')](handleError(_0x23f75a,null));};exports['addContacts']=function(_0x3221c6,_0x4b1ac5,_0x4c95cd){return db['CmList'][_0x1e1f('0x50')]({'where':{'id':_0x3221c6[_0x1e1f('0x4d')]['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0x4b1ac5,null))[_0x1e1f('0x2b')](function(_0x233d27){if(_0x233d27){var _0x5f35a0=[];var _0x203b7b={'success':[],'errors':[]};return db[_0x1e1f('0x64')][_0x1e1f('0x5b')]()['then'](function(_0x22ff80){if(_0x3221c6[_0x1e1f('0x52')][_0x1e1f('0x65')]&&_['isArray'](_0x3221c6[_0x1e1f('0x52')]['tags'])){if(_0x3221c6[_0x1e1f('0x52')][_0x1e1f('0x65')][_0x1e1f('0x3f')]){_0x3221c6[_0x1e1f('0x52')][_0x1e1f('0x65')]=_0x3221c6[_0x1e1f('0x52')][_0x1e1f('0x65')][_0x1e1f('0x66')](';')+';';}else{_0x3221c6[_0x1e1f('0x52')][_0x1e1f('0x65')]=null;}}else{_0x3221c6[_0x1e1f('0x52')][_0x1e1f('0x65')]=null;}if(_0x3221c6[_0x1e1f('0x52')]&&_[_0x1e1f('0x67')](_0x3221c6[_0x1e1f('0x52')])){for(var _0x44a5a7=0x0;_0x44a5a7<_0x3221c6[_0x1e1f('0x52')][_0x1e1f('0x3f')];_0x44a5a7+=0x1){_0x3221c6[_0x1e1f('0x52')][_0x44a5a7]['ListId']=_0x3221c6[_0x1e1f('0x4d')]['id'];_0x5f35a0[_0x1e1f('0x68')](_0x3221c6[_0x1e1f('0x52')][_0x44a5a7]);}return BPromise['each'](_0x5f35a0,function(_0x27604f){return db[_0x1e1f('0x64')][_0x1e1f('0x51')](_['omit'](_0x27604f,['ids','id'])||{},{'fields':_['keys'](_0x22ff80),'raw':!![]})[_0x1e1f('0x2b')](function(_0xf1c557){_0x203b7b[_0x1e1f('0x69')][_0x1e1f('0x68')](_0xf1c557[_0x1e1f('0x6a')]);})['catch'](function(_0xd9e6eb){_0x203b7b['errors'][_0x1e1f('0x68')]({'data':_0x27604f,'error':_0xd9e6eb[_0x1e1f('0x6b')]});});})[_0x1e1f('0x2b')](function(_0x3e7d44){return _0x203b7b;})[_0x1e1f('0x4b')](function(_0x148135){return _0x148135;});}else{_0x4b1ac5[_0x1e1f('0x20')](0x190)[_0x1e1f('0x22')]({'message':_0x1e1f('0x6c')});}});}})[_0x1e1f('0x2b')](respondWithResult(_0x4b1ac5,null))[_0x1e1f('0x4b')](handleError(_0x4b1ac5,null));};exports['getContacts']=function(_0x4f292a,_0x486b8f,_0x5038f7){var _0x58bb36;return db['CmList']['find']({'where':{'id':_0x4f292a[_0x1e1f('0x4d')]['id']},'include':[{'model':db[_0x1e1f('0x6d')],'as':_0x1e1f('0x6e')}]})[_0x1e1f('0x2b')](handleEntityNotFound(_0x486b8f,null))['then'](function(_0x2a6666){if(_0x2a6666){_0x58bb36=_0x2a6666;return db[_0x1e1f('0x64')][_0x1e1f('0x4e')];}})[_0x1e1f('0x2b')](function(_0x4d56d0){if(_0x4d56d0){var _0x47344e={};var _0x38d332={};_0x38d332[_0x1e1f('0x38')]=_[_0x1e1f('0x6f')](_[_0x1e1f('0x3a')](_0x4d56d0),_['map'](_0x58bb36[_0x1e1f('0x6e')],function(_0x5e9443){return util[_0x1e1f('0x70')](_0x1e1f('0x71'),_0x5e9443['id']);}));_0x38d332['query']=_[_0x1e1f('0x3a')](_0x4f292a['query']);_0x38d332[_0x1e1f('0x3b')]=_['intersection'](_0x38d332[_0x1e1f('0x38')],_0x38d332['query']);_0x47344e['attributes']=_[_0x1e1f('0x3c')](_0x38d332[_0x1e1f('0x38')],qs['fields'](_0x4f292a[_0x1e1f('0x39')][_0x1e1f('0x3d')]));_0x47344e[_0x1e1f('0x3e')]=_0x47344e[_0x1e1f('0x3e')][_0x1e1f('0x3f')]?_0x47344e[_0x1e1f('0x3e')]:_0x38d332[_0x1e1f('0x38')];if(!_0x4f292a['query']['hasOwnProperty'](_0x1e1f('0x60'))){_0x47344e[_0x1e1f('0x26')]=qs[_0x1e1f('0x26')](_0x4f292a[_0x1e1f('0x39')][_0x1e1f('0x26')]);_0x47344e['offset']=qs[_0x1e1f('0x23')](_0x4f292a[_0x1e1f('0x39')]['offset']);}_0x47344e[_0x1e1f('0x41')]=qs[_0x1e1f('0x42')](_0x4f292a['query'][_0x1e1f('0x42')]);_0x47344e[_0x1e1f('0x43')]=qs[_0x1e1f('0x3b')](_['pick'](_0x4f292a[_0x1e1f('0x39')],_0x38d332['filters']));_0x47344e[_0x1e1f('0x72')]=!![];if(_0x4f292a[_0x1e1f('0x39')][_0x1e1f('0x45')]){_0x47344e[_0x1e1f('0x43')]=_[_0x1e1f('0x47')](_0x47344e[_0x1e1f('0x43')],{'$or':_[_0x1e1f('0x34')](_0x47344e[_0x1e1f('0x3e')],function(_0x585218){var _0x401d74={};_0x401d74[_0x585218]={'$like':'%'+_0x4f292a[_0x1e1f('0x39')]['filter']+'%'};return _0x401d74;})});}_0x47344e=_['merge']({},_0x47344e,_0x4f292a['options']);return _0x58bb36[_0x1e1f('0x73')](_0x47344e);}})['then'](respondWithResult(_0x486b8f,null))[_0x1e1f('0x4b')](handleError(_0x486b8f,null));};exports[_0x1e1f('0x74')]=function(_0x48621f,_0x4134a0,_0x14b524){var _0x25fb9f;return db[_0x1e1f('0x35')][_0x1e1f('0x50')]({'where':{'id':_0x48621f[_0x1e1f('0x4d')]['id']},'include':[{'model':db[_0x1e1f('0x6d')],'as':'CustomFields'}]})[_0x1e1f('0x2b')](handleEntityNotFound(_0x4134a0,null))[_0x1e1f('0x2b')](function(_0x2f4601){if(_0x2f4601){_0x25fb9f=_0x2f4601;return db[_0x1e1f('0x64')][_0x1e1f('0x4e')];}})[_0x1e1f('0x2b')](function(_0x513454){if(_0x513454){var _0x3f0359={};var _0x55bd3d={};_0x55bd3d[_0x1e1f('0x38')]=_[_0x1e1f('0x6f')](_[_0x1e1f('0x3a')](_0x513454),_[_0x1e1f('0x34')](_0x25fb9f[_0x1e1f('0x6e')],function(_0x46a753){return util['format'](_0x1e1f('0x71'),_0x46a753['id']);}));_0x55bd3d[_0x1e1f('0x39')]=_[_0x1e1f('0x3a')](_0x48621f[_0x1e1f('0x39')]);_0x55bd3d[_0x1e1f('0x3b')]=_[_0x1e1f('0x3c')](_0x55bd3d[_0x1e1f('0x38')],_0x55bd3d[_0x1e1f('0x39')]);_0x3f0359['attributes']=_[_0x1e1f('0x3c')](_0x55bd3d['model'],qs['fields'](_0x48621f[_0x1e1f('0x39')][_0x1e1f('0x3d')]));_0x3f0359[_0x1e1f('0x3e')]=_0x3f0359[_0x1e1f('0x3e')][_0x1e1f('0x3f')]?_0x3f0359[_0x1e1f('0x3e')]:_0x55bd3d[_0x1e1f('0x38')];if(!_0x48621f['query'][_0x1e1f('0x40')]('nolimit')){_0x3f0359[_0x1e1f('0x26')]=qs[_0x1e1f('0x26')](_0x48621f[_0x1e1f('0x39')][_0x1e1f('0x26')]);_0x3f0359[_0x1e1f('0x23')]=qs[_0x1e1f('0x23')](_0x48621f['query'][_0x1e1f('0x23')]);}_0x3f0359[_0x1e1f('0x41')]=qs[_0x1e1f('0x42')](_0x48621f[_0x1e1f('0x39')][_0x1e1f('0x42')]);_0x3f0359[_0x1e1f('0x43')]=qs[_0x1e1f('0x3b')](_['pick'](_0x48621f[_0x1e1f('0x39')],_0x55bd3d[_0x1e1f('0x3b')]));_0x3f0359['raw']=!![];if(_0x48621f['query'][_0x1e1f('0x45')]){_0x3f0359['where']=_['merge'](_0x3f0359[_0x1e1f('0x43')],{'$or':_[_0x1e1f('0x34')](_0x3f0359['attributes'],function(_0xe95851){var _0x5a09a7={};_0x5a09a7[_0xe95851]={'$like':'%'+_0x48621f['query'][_0x1e1f('0x45')]+'%'};return _0x5a09a7;})});}_0x3f0359=_[_0x1e1f('0x47')]({},_0x3f0359,_0x48621f[_0x1e1f('0x4f')]);return _0x25fb9f[_0x1e1f('0x73')](_0x3f0359);}})[_0x1e1f('0x2b')](function(_0x850e88){if(!_[_0x1e1f('0x75')](_0x850e88)){var _0xc9c52=toCsv(_0x850e88);var _0x142a7c=Date[_0x1e1f('0x76')]();fs[_0x1e1f('0x77')](util[_0x1e1f('0x70')](_0x1e1f('0x78'),_0x25fb9f['id'],_0x142a7c),_0xc9c52);_0x4134a0[_0x1e1f('0x79')](_0x1e1f('0x7a'),'attachment;\x20filename='+util[_0x1e1f('0x70')](_0x1e1f('0x7b'),_0x25fb9f['id'],_0x142a7c));_0x4134a0[_0x1e1f('0x79')](_0x1e1f('0x7c'),_0x1e1f('0x7d'));return _0x4134a0[_0x1e1f('0x7e')](util['format']('/tmp/list_%d_%s.csv',_0x25fb9f['id'],_0x142a7c));}else{return _0x4134a0['sendStatus'](0xcc);}})[_0x1e1f('0x4b')](handleError(_0x4134a0,null));};exports[_0x1e1f('0x7f')]=function(_0x163704,_0x2e2ce6,_0x5a494a){var _0x3cd65d;delete _0x163704[_0x1e1f('0x52')]['id'];return db[_0x1e1f('0x35')]['findOne']({'where':{'id':_0x163704[_0x1e1f('0x4d')]['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0x2e2ce6,null))[_0x1e1f('0x2b')](function(_0xa01dfd){if(_0xa01dfd){return db['sequelize'][_0x1e1f('0x80')](function(_0x417238){return db[_0x1e1f('0x6d')][_0x1e1f('0x51')](_0x163704[_0x1e1f('0x52')],{'transaction':_0x417238})[_0x1e1f('0x2b')](function(_0x28a618){_0x3cd65d=_0x28a618;return _0xa01dfd[_0x1e1f('0x81')](_0x28a618,{'transaction':_0x417238});})[_0x1e1f('0x2b')](function(){var _0x22a4fb={'type':db[_0x1e1f('0x82')][_0x1e1f('0x83')],'transaction':_0x417238};switch(_0x163704[_0x1e1f('0x52')][_0x1e1f('0x37')]){case'text':_0x22a4fb[_0x1e1f('0x37')]=db['Sequelize'][_0x1e1f('0x83')];break;case'number':_0x22a4fb[_0x1e1f('0x37')]=db[_0x1e1f('0x82')][_0x1e1f('0x84')];break;case _0x1e1f('0x85'):_0x22a4fb['type']=db['Sequelize'][_0x1e1f('0x86')];_0x22a4fb[_0x1e1f('0x87')]=![];break;default:}return db[_0x1e1f('0x88')]['queryInterface'][_0x1e1f('0x89')](_0x1e1f('0x8a'),util['format'](_0x1e1f('0x8b'),_0x3cd65d['id']),_0x22a4fb);})['then'](function(){return _0x3cd65d;});});}})['then'](respondWithResult(_0x2e2ce6,null))[_0x1e1f('0x4b')](handleError(_0x2e2ce6,null));};exports[_0x1e1f('0x8c')]=function(_0x3ce352,_0x2708b1,_0x250259){var _0x9a614f={};var _0x568fd9={};var _0x4010af;var _0x304c2a;return db[_0x1e1f('0x35')][_0x1e1f('0x5f')]({'where':{'id':_0x3ce352[_0x1e1f('0x4d')]['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0x2708b1,null))['then'](function(_0x447477){if(_0x447477){_0x4010af=_0x447477;_0x568fd9['model']=_[_0x1e1f('0x3a')](db['CmCustomField'][_0x1e1f('0x4e')]);_0x568fd9[_0x1e1f('0x39')]=_[_0x1e1f('0x3a')](_0x3ce352[_0x1e1f('0x39')]);_0x568fd9[_0x1e1f('0x3b')]=_[_0x1e1f('0x3c')](_0x568fd9[_0x1e1f('0x38')],_0x568fd9[_0x1e1f('0x39')]);_0x9a614f['attributes']=_[_0x1e1f('0x3c')](_0x568fd9[_0x1e1f('0x38')],qs[_0x1e1f('0x3d')](_0x3ce352['query'][_0x1e1f('0x3d')]));_0x9a614f[_0x1e1f('0x3e')]=_0x9a614f[_0x1e1f('0x3e')][_0x1e1f('0x3f')]?_0x9a614f[_0x1e1f('0x3e')]:_0x568fd9[_0x1e1f('0x38')];_0x9a614f['order']=qs['sort'](_0x3ce352[_0x1e1f('0x39')]['sort']);_0x9a614f[_0x1e1f('0x43')]=qs[_0x1e1f('0x3b')](_[_0x1e1f('0x44')](_0x3ce352[_0x1e1f('0x39')],_0x568fd9[_0x1e1f('0x3b')]));_0x9a614f['where']=_['merge'](_0x9a614f['where'],{'$or':[{'ListId':_0x447477['id']},{'ListId':null}]});if(_0x3ce352[_0x1e1f('0x39')][_0x1e1f('0x45')]){_0x9a614f[_0x1e1f('0x43')]=_[_0x1e1f('0x47')](_0x9a614f[_0x1e1f('0x43')],{'$or':_[_0x1e1f('0x34')](_0x9a614f['attributes'],function(_0xe72a3f){var _0x1d5ace={};_0x1d5ace[_0xe72a3f]={'$like':'%'+_0x3ce352[_0x1e1f('0x39')][_0x1e1f('0x45')]+'%'};return _0x1d5ace;})});}_0x9a614f=_[_0x1e1f('0x47')]({},_0x9a614f,_0x3ce352['options']);return db['CmCustomField']['findAndCountAll'](_0x9a614f);}})['then'](respondWithResult(_0x2708b1,null))['catch'](handleError(_0x2708b1,null));};exports[_0x1e1f('0x8d')]=function(_0x774bd7,_0x1cb351,_0x2a0cb0){return db[_0x1e1f('0x35')][_0x1e1f('0x50')]({'where':{'id':_0x774bd7[_0x1e1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1cb351,null))[_0x1e1f('0x2b')](function(_0x136332){if(_0x136332){return _0x136332[_0x1e1f('0x8d')](_0x774bd7[_0x1e1f('0x52')]['ids'],_['omit'](_0x774bd7[_0x1e1f('0x52')],[_0x1e1f('0x8e'),'id'])||{})[_0x1e1f('0x8f')](function(_0x503189){for(var _0x38e243=0x0;_0x38e243<_0x774bd7[_0x1e1f('0x52')][_0x1e1f('0x8e')]['length'];_0x38e243+=0x1){socket[_0x1e1f('0x90')]('userCmList:save',{'UserId':Number(_0x774bd7[_0x1e1f('0x52')][_0x1e1f('0x8e')][_0x38e243]),'CmListId':Number(_0x774bd7[_0x1e1f('0x4d')]['id'])});}return _0x503189;});}})['then'](respondWithResult(_0x1cb351,null))[_0x1e1f('0x4b')](handleError(_0x1cb351,null));};exports[_0x1e1f('0x91')]=function(_0xfed03e,_0x5d118b,_0x246890){return db['CmList'][_0x1e1f('0x50')]({'where':{'id':_0xfed03e[_0x1e1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d118b,null))[_0x1e1f('0x2b')](function(_0xa39ed){if(_0xa39ed){return _0xa39ed[_0x1e1f('0x91')](_0xfed03e[_0x1e1f('0x39')][_0x1e1f('0x8e')])[_0x1e1f('0x2b')](function(){if(_[_0x1e1f('0x67')](_0xfed03e[_0x1e1f('0x39')][_0x1e1f('0x8e')])){for(var _0x666bf9=0x0;_0x666bf9<_0xfed03e['query'][_0x1e1f('0x8e')][_0x1e1f('0x3f')];_0x666bf9+=0x1){socket[_0x1e1f('0x90')](_0x1e1f('0x92'),{'UserId':Number(_0xfed03e[_0x1e1f('0x39')][_0x1e1f('0x8e')][_0x666bf9]),'CmListId':Number(_0xfed03e[_0x1e1f('0x4d')]['id'])});}}else{socket['emit'](_0x1e1f('0x92'),{'UserId':Number(_0xfed03e[_0x1e1f('0x39')][_0x1e1f('0x8e')]),'CmListId':Number(_0xfed03e[_0x1e1f('0x4d')]['id'])});}});}})[_0x1e1f('0x2b')](respondWithStatusCode(_0x5d118b,null))[_0x1e1f('0x4b')](handleError(_0x5d118b,null));};exports[_0x1e1f('0x93')]=function(_0x142ef0,_0xfac990,_0x1291ad){var _0xe23af4={};var _0xb7e4f9={};var _0x453f25;var _0x5602c7;return db['CmList'][_0x1e1f('0x5f')]({'where':{'id':_0x142ef0[_0x1e1f('0x4d')]['id']}})[_0x1e1f('0x2b')](handleEntityNotFound(_0xfac990,null))[_0x1e1f('0x2b')](function(_0xbfacfc){if(_0xbfacfc){_0x453f25=_0xbfacfc;_0xb7e4f9[_0x1e1f('0x38')]=_['keys'](db[_0x1e1f('0x94')]['rawAttributes']);_0xb7e4f9[_0x1e1f('0x39')]=_['keys'](_0x142ef0['query']);_0xb7e4f9['filters']=_[_0x1e1f('0x3c')](_0xb7e4f9[_0x1e1f('0x38')],_0xb7e4f9[_0x1e1f('0x39')]);_0xe23af4['attributes']=_[_0x1e1f('0x3c')](_0xb7e4f9['model'],qs['fields'](_0x142ef0[_0x1e1f('0x39')]['fields']));_0xe23af4[_0x1e1f('0x3e')]=_0xe23af4[_0x1e1f('0x3e')][_0x1e1f('0x3f')]?_0xe23af4[_0x1e1f('0x3e')]:_0xb7e4f9['model'];_0xe23af4['order']=qs[_0x1e1f('0x42')](_0x142ef0[_0x1e1f('0x39')][_0x1e1f('0x42')]);_0xe23af4['where']=qs[_0x1e1f('0x3b')](_['pick'](_0x142ef0['query'],_0xb7e4f9[_0x1e1f('0x3b')]));if(_0x142ef0[_0x1e1f('0x39')][_0x1e1f('0x45')]){_0xe23af4[_0x1e1f('0x43')]=_[_0x1e1f('0x47')](_0xe23af4[_0x1e1f('0x43')],{'$or':_['map'](_0xe23af4[_0x1e1f('0x3e')],function(_0x3a1e50){var _0x365bcf={};_0x365bcf[_0x3a1e50]={'$like':'%'+_0x142ef0[_0x1e1f('0x39')]['filter']+'%'};return _0x365bcf;})});}_0xe23af4=_['merge']({},_0xe23af4,_0x142ef0[_0x1e1f('0x4f')]);return _0x453f25[_0x1e1f('0x93')](_0xe23af4);}})[_0x1e1f('0x2b')](function(_0x35d83e){if(_0x35d83e){_0x5602c7=_0x35d83e[_0x1e1f('0x3f')];if(!_0x142ef0[_0x1e1f('0x39')][_0x1e1f('0x40')]('nolimit')){_0xe23af4[_0x1e1f('0x26')]=qs[_0x1e1f('0x26')](_0x142ef0[_0x1e1f('0x39')]['limit']);_0xe23af4[_0x1e1f('0x23')]=qs[_0x1e1f('0x23')](_0x142ef0[_0x1e1f('0x39')][_0x1e1f('0x23')]);}return _0x453f25['getAgents'](_0xe23af4);}})[_0x1e1f('0x2b')](function(_0xc00e87){if(_0xc00e87){return _0xc00e87?{'count':_0x5602c7,'rows':_0xc00e87}:null;}})[_0x1e1f('0x2b')](respondWithResult(_0xfac990,null))['catch'](handleError(_0xfac990,null));}; \ No newline at end of file +var _0x4bc0=['index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','findAll','show','params','fields','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','ListId','rows','addContacts','CmContact','isArray','tags','join','each','omit','success','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','findAndCountAll','addAgents','ids','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','socket.io-emitter','redis','./cmList.socket','register','status','end','json','offset','count','limit','apply','reject','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4bc0,0xf6));var _0x04bc=function(_0x22f11e,_0xe64bc6){_0x22f11e=_0x22f11e-0x0;var _0x51f8c9=_0x4bc0[_0x22f11e];return _0x51f8c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04bc('0x0'));var zipdir=require(_0x04bc('0x1'));var jsonpatch=require(_0x04bc('0x2'));var rp=require(_0x04bc('0x3'));var moment=require(_0x04bc('0x4'));var BPromise=require(_0x04bc('0x5'));var Mustache=require(_0x04bc('0x6'));var util=require(_0x04bc('0x7'));var path=require('path');var sox=require(_0x04bc('0x8'));var csv=require(_0x04bc('0x9'));var ejs=require(_0x04bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04bc('0xb'));var crypto=require(_0x04bc('0xc'));var jsforce=require(_0x04bc('0xd'));var deskjs=require(_0x04bc('0xe'));var toCsv=require(_0x04bc('0x9'));var querystring=require('querystring');var Papa=require(_0x04bc('0xf'));var Redis=require('ioredis');var authService=require(_0x04bc('0x10'));var qs=require(_0x04bc('0x11'));var as=require(_0x04bc('0x12'));var hardwareService=require(_0x04bc('0x13'));var logger=require('../../config/logger')(_0x04bc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x04bc('0x15'))['db'];config['redis']=_[_0x04bc('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x04bc('0x17'))(new Redis(config[_0x04bc('0x18')]));require(_0x04bc('0x19'))[_0x04bc('0x1a')](socket);function respondWithStatusCode(_0x3dac97,_0x155188){_0x155188=_0x155188||0xcc;return function(_0x194fd6){if(_0x194fd6){return _0x3dac97['sendStatus'](_0x155188);}return _0x3dac97[_0x04bc('0x1b')](_0x155188)[_0x04bc('0x1c')]();};}function respondWithResult(_0x25715e,_0x3e4b09){_0x3e4b09=_0x3e4b09||0xc8;return function(_0x8c8e84){if(_0x8c8e84){return _0x25715e[_0x04bc('0x1b')](_0x3e4b09)[_0x04bc('0x1d')](_0x8c8e84);}};}function respondWithFilteredResult(_0x27d63c,_0x522f60){return function(_0x32ede6){if(_0x32ede6){var _0x53a983=typeof _0x522f60[_0x04bc('0x1e')]==='undefined'&&typeof _0x522f60['limit']==='undefined';var _0x2a7f2b=_0x32ede6[_0x04bc('0x1f')];var _0x2815dc=_0x53a983?0x0:_0x522f60[_0x04bc('0x1e')];var _0x5268cf=_0x53a983?_0x32ede6[_0x04bc('0x1f')]:_0x522f60[_0x04bc('0x1e')]+_0x522f60[_0x04bc('0x20')];var _0x476027;if(_0x5268cf>=_0x2a7f2b){_0x5268cf=_0x2a7f2b;_0x476027=0xc8;}else{_0x476027=0xce;}_0x27d63c[_0x04bc('0x1b')](_0x476027);return _0x27d63c['set']('Content-Range',_0x2815dc+'-'+_0x5268cf+'/'+_0x2a7f2b)[_0x04bc('0x1d')](_0x32ede6);}return null;};}function patchUpdates(_0x2e8b38){return function(_0x2ad47b){try{jsonpatch[_0x04bc('0x21')](_0x2ad47b,_0x2e8b38,!![]);}catch(_0x38430a){return BPromise[_0x04bc('0x22')](_0x38430a);}return _0x2ad47b['save']();};}function saveUpdates(_0x25a9e6,_0x5e7d66){return function(_0x5d05c1){if(_0x5d05c1){return _0x5d05c1[_0x04bc('0x23')](_0x25a9e6)['then'](function(_0x45727a){return _0x45727a;});}return null;};}function removeEntity(_0x8a4f43,_0x549e2a){return function(_0x4b45ac){if(_0x4b45ac){return _0x4b45ac['destroy']()[_0x04bc('0x24')](function(){var _0x963bce=_0x4b45ac[_0x04bc('0x25')]({'plain':!![]});var _0x521c16='Lists';return db[_0x04bc('0x26')][_0x04bc('0x27')]({'where':{'type':_0x521c16,'resourceId':_0x963bce['id']}})[_0x04bc('0x24')](function(){return _0x4b45ac;});})[_0x04bc('0x24')](function(){_0x8a4f43['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc071,_0x222101){return function(_0x2e14be){if(!_0x2e14be){_0x1dc071[_0x04bc('0x28')](0x194);}return _0x2e14be;};}function handleError(_0x10e9d0,_0x2cef5a){_0x2cef5a=_0x2cef5a||0x1f4;return function(_0x417997){logger[_0x04bc('0x29')](_0x417997[_0x04bc('0x2a')]);if(_0x417997[_0x04bc('0x2b')]){delete _0x417997[_0x04bc('0x2b')];}_0x10e9d0[_0x04bc('0x1b')](_0x2cef5a)['send'](_0x417997);};}exports[_0x04bc('0x2c')]=function(_0x4c74f8,_0x59d4a8){var _0x3ed90b={},_0x2314c6={},_0x1285bf={'count':0x0,'rows':[]};var _0x397cea=_[_0x04bc('0x2d')](db[_0x04bc('0x2e')][_0x04bc('0x2f')],function(_0x9395ad){return{'name':_0x9395ad[_0x04bc('0x30')],'type':_0x9395ad['type'][_0x04bc('0x31')]};});_0x2314c6[_0x04bc('0x32')]=_[_0x04bc('0x2d')](_0x397cea,_0x04bc('0x2b'));_0x2314c6[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x4c74f8[_0x04bc('0x33')]);_0x2314c6[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x2314c6[_0x04bc('0x32')],_0x2314c6['query']);_0x3ed90b[_0x04bc('0x37')]=_[_0x04bc('0x36')](_0x2314c6[_0x04bc('0x32')],qs['fields'](_0x4c74f8[_0x04bc('0x33')]['fields']));_0x3ed90b[_0x04bc('0x37')]=_0x3ed90b[_0x04bc('0x37')][_0x04bc('0x38')]?_0x3ed90b['attributes']:_0x2314c6['model'];if(!_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x39')]('nolimit')){_0x3ed90b['limit']=qs[_0x04bc('0x20')](_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x20')]);_0x3ed90b[_0x04bc('0x1e')]=qs[_0x04bc('0x1e')](_0x4c74f8['query'][_0x04bc('0x1e')]);}_0x3ed90b[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x4c74f8['query']['sort']);_0x3ed90b['where']=qs[_0x04bc('0x35')](_[_0x04bc('0x3c')](_0x4c74f8[_0x04bc('0x33')],_0x2314c6[_0x04bc('0x35')]),_0x397cea);if(_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x3d')]){_0x3ed90b['where']=_[_0x04bc('0x3e')](_0x3ed90b[_0x04bc('0x3f')],{'$or':_['map'](_0x397cea,function(_0x562dc4){if(_0x562dc4[_0x04bc('0x40')]!==_0x04bc('0x41')){var _0x2feb6d={};_0x2feb6d[_0x562dc4[_0x04bc('0x2b')]]={'$like':'%'+_0x4c74f8['query'][_0x04bc('0x3d')]+'%'};return _0x2feb6d;}})});}_0x3ed90b=_['merge']({},_0x3ed90b,_0x4c74f8['options']);var _0x55ce17={'where':_0x3ed90b['where']};return db[_0x04bc('0x2e')][_0x04bc('0x1f')](_0x55ce17)[_0x04bc('0x24')](function(_0x15ac52){_0x1285bf['count']=_0x15ac52;if(_0x4c74f8[_0x04bc('0x33')][_0x04bc('0x42')]){_0x3ed90b['include']=[{'all':!![]}];}return db[_0x04bc('0x2e')][_0x04bc('0x43')](_0x3ed90b);})['then'](function(_0x462d51){_0x1285bf['rows']=_0x462d51;return _0x1285bf;})[_0x04bc('0x24')](respondWithFilteredResult(_0x59d4a8,_0x3ed90b))['catch'](handleError(_0x59d4a8,null));};exports[_0x04bc('0x44')]=function(_0x734c6e,_0x3190fc){var _0x5a0608={'raw':![],'where':{'id':_0x734c6e[_0x04bc('0x45')]['id']}},_0x5b5249={};_0x5b5249[_0x04bc('0x32')]=_['keys'](db[_0x04bc('0x2e')]['rawAttributes']);_0x5b5249['query']=_[_0x04bc('0x34')](_0x734c6e['query']);_0x5b5249[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x5b5249[_0x04bc('0x32')],_0x5b5249[_0x04bc('0x33')]);_0x5a0608[_0x04bc('0x37')]=_['intersection'](_0x5b5249[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x734c6e[_0x04bc('0x33')][_0x04bc('0x46')]));_0x5a0608[_0x04bc('0x37')]=_0x5a0608[_0x04bc('0x37')][_0x04bc('0x38')]?_0x5a0608[_0x04bc('0x37')]:_0x5b5249['model'];if(_0x734c6e[_0x04bc('0x33')][_0x04bc('0x42')]){_0x5a0608['include']=[{'all':!![]}];}_0x5a0608=_[_0x04bc('0x3e')]({},_0x5a0608,_0x734c6e[_0x04bc('0x47')]);return db['CmList'][_0x04bc('0x48')](_0x5a0608)[_0x04bc('0x24')](handleEntityNotFound(_0x3190fc,null))[_0x04bc('0x24')](respondWithResult(_0x3190fc,null))[_0x04bc('0x49')](handleError(_0x3190fc,null));};exports[_0x04bc('0x4a')]=function(_0x3dabdd,_0x321dd1){return db[_0x04bc('0x2e')][_0x04bc('0x4a')](_0x3dabdd[_0x04bc('0x4b')],{})[_0x04bc('0x24')](function(_0x4e93a7){var _0x3d3986=_0x3dabdd[_0x04bc('0x4c')][_0x04bc('0x25')]({'plain':!![]});if(!_0x3d3986)throw new Error(_0x04bc('0x4d'));if(_0x3d3986[_0x04bc('0x4e')]==='user'){var _0x435645=_0x4e93a7[_0x04bc('0x25')]({'plain':!![]});var _0xc92a5=_0x04bc('0x4f');return db[_0x04bc('0x50')][_0x04bc('0x48')]({'where':{'name':_0xc92a5,'userProfileId':_0x3d3986[_0x04bc('0x51')]},'raw':!![]})[_0x04bc('0x24')](function(_0x2a72e0){if(_0x2a72e0&&_0x2a72e0[_0x04bc('0x52')]===0x0){return db[_0x04bc('0x26')][_0x04bc('0x4a')]({'name':_0x435645['name'],'resourceId':_0x435645['id'],'type':_0x2a72e0[_0x04bc('0x2b')],'sectionId':_0x2a72e0['id']},{})[_0x04bc('0x24')](function(){return _0x4e93a7;});}else{return _0x4e93a7;}})[_0x04bc('0x49')](function(_0x1c9ca2){logger['error'](_0x04bc('0x53'),_0x1c9ca2);throw _0x1c9ca2;});}return _0x4e93a7;})['then'](respondWithResult(_0x321dd1,0xc9))[_0x04bc('0x49')](handleError(_0x321dd1,null));};exports[_0x04bc('0x23')]=function(_0x54ede7,_0x350e3d){if(_0x54ede7[_0x04bc('0x4b')]['id']){delete _0x54ede7[_0x04bc('0x4b')]['id'];}return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x54ede7['params']['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x350e3d,null))[_0x04bc('0x24')](saveUpdates(_0x54ede7[_0x04bc('0x4b')],null))[_0x04bc('0x24')](respondWithResult(_0x350e3d,null))['catch'](handleError(_0x350e3d,null));};exports[_0x04bc('0x27')]=function(_0x1aec40,_0x47f2b9){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x1aec40['params']['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x47f2b9,null))[_0x04bc('0x24')](removeEntity(_0x47f2b9,null))[_0x04bc('0x49')](handleError(_0x47f2b9,null));};exports[_0x04bc('0x54')]=function(_0x33ec22,_0x263560){return db[_0x04bc('0x2e')]['describe']()['then'](respondWithResult(_0x263560,null))[_0x04bc('0x49')](handleError(_0x263560,null));};exports[_0x04bc('0x55')]=function(_0x2bb982,_0x2b9f05,_0x516127){if(_0x2bb982['body']['id']){delete _0x2bb982[_0x04bc('0x4b')]['id'];}return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x2bb982['params']['id']}})['then'](handleEntityNotFound(_0x2b9f05,null))[_0x04bc('0x24')](function(_0x5efb3c){if(_0x5efb3c){_0x2bb982['body']['ListId']=_0x5efb3c['id'];return db[_0x04bc('0x56')][_0x04bc('0x4a')](_0x2bb982[_0x04bc('0x4b')]);}})[_0x04bc('0x24')](respondWithResult(_0x2b9f05,null))['catch'](handleError(_0x2b9f05,null));};exports[_0x04bc('0x57')]=function(_0x2e0388,_0x59f654,_0x35c5b1){var _0xad8933={'raw':![],'where':{}};var _0x1fb362={};var _0x315915={'count':0x0,'rows':[]};return db['CmList'][_0x04bc('0x58')]({'where':{'id':_0x2e0388[_0x04bc('0x45')]['id']}})['then'](handleEntityNotFound(_0x59f654,null))['then'](function(_0xc0afbe){if(_0xc0afbe){_0x1fb362[_0x04bc('0x32')]=_[_0x04bc('0x34')](db['Disposition'][_0x04bc('0x2f')]);_0x1fb362[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x2e0388['query']);_0x1fb362[_0x04bc('0x35')]=_['intersection'](_0x1fb362[_0x04bc('0x32')],_0x1fb362[_0x04bc('0x33')]);_0xad8933[_0x04bc('0x37')]=_[_0x04bc('0x36')](_0x1fb362[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x2e0388['query']['fields']));_0xad8933['attributes']=_0xad8933[_0x04bc('0x37')][_0x04bc('0x38')]?_0xad8933['attributes']:_0x1fb362[_0x04bc('0x32')];if(!_0x2e0388[_0x04bc('0x33')]['hasOwnProperty'](_0x04bc('0x59'))){_0xad8933['limit']=qs[_0x04bc('0x20')](_0x2e0388[_0x04bc('0x33')][_0x04bc('0x20')]);_0xad8933[_0x04bc('0x1e')]=qs[_0x04bc('0x1e')](_0x2e0388[_0x04bc('0x33')][_0x04bc('0x1e')]);}_0xad8933[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x2e0388[_0x04bc('0x33')]['sort']);_0xad8933['where']=qs[_0x04bc('0x35')](_['pick'](_0x2e0388[_0x04bc('0x33')],_0x1fb362[_0x04bc('0x35')]));_0xad8933[_0x04bc('0x3f')][_0x04bc('0x5a')]=_0xc0afbe['id'];if(_0x2e0388[_0x04bc('0x33')]['filter']){_0xad8933[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0xad8933[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0xad8933[_0x04bc('0x37')],function(_0x8599b1){var _0x3dd431={};_0x3dd431[_0x8599b1]={'$like':'%'+_0x2e0388[_0x04bc('0x33')]['filter']+'%'};return _0x3dd431;})});}_0xad8933=_[_0x04bc('0x3e')]({},_0xad8933,_0x2e0388[_0x04bc('0x47')]);return db[_0x04bc('0x56')][_0x04bc('0x1f')]({'where':_0xad8933[_0x04bc('0x3f')]})[_0x04bc('0x24')](function(_0xad009e){_0x315915[_0x04bc('0x1f')]=_0xad009e;if(_0x2e0388['query'][_0x04bc('0x42')]){_0xad8933['include']=[{'all':!![]}];}return db['Disposition'][_0x04bc('0x43')](_0xad8933);})['then'](function(_0x344283){_0x315915[_0x04bc('0x5b')]=_0x344283;return _0x315915;});}})[_0x04bc('0x24')](respondWithFilteredResult(_0x59f654,_0xad8933))[_0x04bc('0x49')](handleError(_0x59f654,null));};exports['removeDispositions']=function(_0x2c48d1,_0x4733ae,_0x49cafe){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x2c48d1[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x4733ae,null))['then'](function(_0xed2c28){if(_0xed2c28){return _0xed2c28['removeDispositions'](_0x2c48d1[_0x04bc('0x33')]['ids']);}})['then'](respondWithStatusCode(_0x4733ae,null))[_0x04bc('0x49')](handleError(_0x4733ae,null));};exports[_0x04bc('0x5c')]=function(_0x610233,_0x276bb4,_0x3e937a){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x610233[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x276bb4,null))[_0x04bc('0x24')](function(_0xf61409){if(_0xf61409){var _0x4bd4fc=[];var _0x43e87e={'success':[],'errors':[]};return db[_0x04bc('0x5d')][_0x04bc('0x54')]()['then'](function(_0x271c5e){if(_0x610233[_0x04bc('0x4b')]['tags']&&_[_0x04bc('0x5e')](_0x610233[_0x04bc('0x4b')]['tags'])){if(_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')][_0x04bc('0x38')]){_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')]=_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')][_0x04bc('0x60')](';')+';';}else{_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')]=null;}}else{_0x610233[_0x04bc('0x4b')][_0x04bc('0x5f')]=null;}if(_0x610233['body']&&_[_0x04bc('0x5e')](_0x610233[_0x04bc('0x4b')])){for(var _0x319246=0x0;_0x319246<_0x610233['body']['length'];_0x319246+=0x1){_0x610233[_0x04bc('0x4b')][_0x319246][_0x04bc('0x5a')]=_0x610233[_0x04bc('0x45')]['id'];_0x4bd4fc['push'](_0x610233[_0x04bc('0x4b')][_0x319246]);}return BPromise[_0x04bc('0x61')](_0x4bd4fc,function(_0x50282b){return db[_0x04bc('0x5d')]['create'](_[_0x04bc('0x62')](_0x50282b,['ids','id'])||{},{'fields':_['keys'](_0x271c5e),'raw':!![]})[_0x04bc('0x24')](function(_0x3d5887){_0x43e87e[_0x04bc('0x63')][_0x04bc('0x64')](_0x3d5887['dataValues']);})[_0x04bc('0x49')](function(_0x568b0a){_0x43e87e['errors']['push']({'data':_0x50282b,'error':_0x568b0a[_0x04bc('0x65')]});});})[_0x04bc('0x24')](function(_0x5a5401){return _0x43e87e;})['catch'](function(_0x156b57){return _0x156b57;});}else{_0x276bb4[_0x04bc('0x1b')](0x190)[_0x04bc('0x1d')]({'message':_0x04bc('0x66')});}});}})[_0x04bc('0x24')](respondWithResult(_0x276bb4,null))[_0x04bc('0x49')](handleError(_0x276bb4,null));};exports[_0x04bc('0x67')]=function(_0x232dc8,_0x59f3d2,_0x13bd02){var _0x3b4a35;return db['CmList'][_0x04bc('0x48')]({'where':{'id':_0x232dc8[_0x04bc('0x45')]['id']},'include':[{'model':db[_0x04bc('0x68')],'as':_0x04bc('0x69')}]})['then'](handleEntityNotFound(_0x59f3d2,null))[_0x04bc('0x24')](function(_0x2e5009){if(_0x2e5009){_0x3b4a35=_0x2e5009;return db[_0x04bc('0x5d')][_0x04bc('0x2f')];}})[_0x04bc('0x24')](function(_0x52f038){if(_0x52f038){var _0xeb4aaa={};var _0x2af043={};_0x2af043[_0x04bc('0x32')]=_[_0x04bc('0x6a')](_[_0x04bc('0x34')](_0x52f038),_[_0x04bc('0x2d')](_0x3b4a35[_0x04bc('0x69')],function(_0x2c110e){return util[_0x04bc('0x6b')](_0x04bc('0x6c'),_0x2c110e['id']);}));_0x2af043[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x232dc8[_0x04bc('0x33')]);_0x2af043[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x2af043[_0x04bc('0x32')],_0x2af043['query']);_0xeb4aaa['attributes']=_['intersection'](_0x2af043[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x232dc8['query']['fields']));_0xeb4aaa[_0x04bc('0x37')]=_0xeb4aaa[_0x04bc('0x37')]['length']?_0xeb4aaa[_0x04bc('0x37')]:_0x2af043['model'];if(!_0x232dc8[_0x04bc('0x33')]['hasOwnProperty'](_0x04bc('0x59'))){_0xeb4aaa[_0x04bc('0x20')]=qs[_0x04bc('0x20')](_0x232dc8['query']['limit']);_0xeb4aaa[_0x04bc('0x1e')]=qs['offset'](_0x232dc8[_0x04bc('0x33')][_0x04bc('0x1e')]);}_0xeb4aaa[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x232dc8[_0x04bc('0x33')][_0x04bc('0x3b')]);_0xeb4aaa[_0x04bc('0x3f')]=qs[_0x04bc('0x35')](_[_0x04bc('0x3c')](_0x232dc8[_0x04bc('0x33')],_0x2af043[_0x04bc('0x35')]));_0xeb4aaa[_0x04bc('0x6d')]=!![];if(_0x232dc8[_0x04bc('0x33')]['filter']){_0xeb4aaa[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0xeb4aaa['where'],{'$or':_[_0x04bc('0x2d')](_0xeb4aaa[_0x04bc('0x37')],function(_0x2809a0){var _0x4784d4={};_0x4784d4[_0x2809a0]={'$like':'%'+_0x232dc8[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x4784d4;})});}_0xeb4aaa=_[_0x04bc('0x3e')]({},_0xeb4aaa,_0x232dc8[_0x04bc('0x47')]);return _0x3b4a35[_0x04bc('0x67')](_0xeb4aaa);}})['then'](respondWithResult(_0x59f3d2,null))['catch'](handleError(_0x59f3d2,null));};exports[_0x04bc('0x6e')]=function(_0x5f4cd3,_0xed9fe0,_0x3c087c){var _0x145929;return db[_0x04bc('0x2e')]['find']({'where':{'id':_0x5f4cd3[_0x04bc('0x45')]['id']},'include':[{'model':db[_0x04bc('0x68')],'as':_0x04bc('0x69')}]})[_0x04bc('0x24')](handleEntityNotFound(_0xed9fe0,null))[_0x04bc('0x24')](function(_0x50fef6){if(_0x50fef6){_0x145929=_0x50fef6;return db[_0x04bc('0x5d')][_0x04bc('0x2f')];}})[_0x04bc('0x24')](function(_0x4ba5be){if(_0x4ba5be){var _0x3bb91d={};var _0x20437e={};_0x20437e[_0x04bc('0x32')]=_[_0x04bc('0x6a')](_[_0x04bc('0x34')](_0x4ba5be),_['map'](_0x145929[_0x04bc('0x69')],function(_0x35ef1){return util[_0x04bc('0x6b')](_0x04bc('0x6c'),_0x35ef1['id']);}));_0x20437e[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x5f4cd3[_0x04bc('0x33')]);_0x20437e[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x20437e['model'],_0x20437e[_0x04bc('0x33')]);_0x3bb91d[_0x04bc('0x37')]=_[_0x04bc('0x36')](_0x20437e[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x5f4cd3[_0x04bc('0x33')]['fields']));_0x3bb91d['attributes']=_0x3bb91d[_0x04bc('0x37')][_0x04bc('0x38')]?_0x3bb91d[_0x04bc('0x37')]:_0x20437e[_0x04bc('0x32')];if(!_0x5f4cd3[_0x04bc('0x33')]['hasOwnProperty']('nolimit')){_0x3bb91d[_0x04bc('0x20')]=qs['limit'](_0x5f4cd3[_0x04bc('0x33')][_0x04bc('0x20')]);_0x3bb91d['offset']=qs[_0x04bc('0x1e')](_0x5f4cd3['query']['offset']);}_0x3bb91d[_0x04bc('0x3a')]=qs['sort'](_0x5f4cd3[_0x04bc('0x33')][_0x04bc('0x3b')]);_0x3bb91d[_0x04bc('0x3f')]=qs['filters'](_['pick'](_0x5f4cd3[_0x04bc('0x33')],_0x20437e['filters']));_0x3bb91d[_0x04bc('0x6d')]=!![];if(_0x5f4cd3[_0x04bc('0x33')]['filter']){_0x3bb91d[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0x3bb91d[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0x3bb91d[_0x04bc('0x37')],function(_0x2bc674){var _0x35f5ab={};_0x35f5ab[_0x2bc674]={'$like':'%'+_0x5f4cd3[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x35f5ab;})});}_0x3bb91d=_[_0x04bc('0x3e')]({},_0x3bb91d,_0x5f4cd3[_0x04bc('0x47')]);return _0x145929[_0x04bc('0x67')](_0x3bb91d);}})['then'](function(_0x32ad36){if(!_[_0x04bc('0x6f')](_0x32ad36)){var _0x5c2c15=toCsv(_0x32ad36);var _0x36ef22=Date['now']();fs[_0x04bc('0x70')](util['format']('/tmp/list_%d_%s.csv',_0x145929['id'],_0x36ef22),_0x5c2c15);_0xed9fe0[_0x04bc('0x71')](_0x04bc('0x72'),'attachment;\x20filename='+util[_0x04bc('0x6b')](_0x04bc('0x73'),_0x145929['id'],_0x36ef22));_0xed9fe0['setHeader'](_0x04bc('0x74'),_0x04bc('0x75'));return _0xed9fe0[_0x04bc('0x76')](util[_0x04bc('0x6b')](_0x04bc('0x77'),_0x145929['id'],_0x36ef22));}else{return _0xed9fe0[_0x04bc('0x28')](0xcc);}})[_0x04bc('0x49')](handleError(_0xed9fe0,null));};exports[_0x04bc('0x78')]=function(_0x12d363,_0x1cc1e0,_0x211759){var _0x4bc4bb;delete _0x12d363[_0x04bc('0x4b')]['id'];return db[_0x04bc('0x2e')][_0x04bc('0x58')]({'where':{'id':_0x12d363[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x1cc1e0,null))['then'](function(_0x2f99bc){if(_0x2f99bc){return db[_0x04bc('0x79')][_0x04bc('0x7a')](function(_0x36dca6){return db[_0x04bc('0x68')][_0x04bc('0x4a')](_0x12d363[_0x04bc('0x4b')],{'transaction':_0x36dca6})[_0x04bc('0x24')](function(_0x384fcc){_0x4bc4bb=_0x384fcc;return _0x2f99bc[_0x04bc('0x7b')](_0x384fcc,{'transaction':_0x36dca6});})[_0x04bc('0x24')](function(){var _0x1f9fc6={'type':db[_0x04bc('0x7c')][_0x04bc('0x7d')],'transaction':_0x36dca6};switch(_0x12d363[_0x04bc('0x4b')][_0x04bc('0x40')]){case _0x04bc('0x7e'):_0x1f9fc6[_0x04bc('0x40')]=db[_0x04bc('0x7c')]['TEXT'];break;case _0x04bc('0x7f'):_0x1f9fc6['type']=db[_0x04bc('0x7c')][_0x04bc('0x80')];break;case _0x04bc('0x81'):_0x1f9fc6[_0x04bc('0x40')]=db[_0x04bc('0x7c')][_0x04bc('0x82')];_0x1f9fc6[_0x04bc('0x83')]=![];break;default:}return db[_0x04bc('0x79')][_0x04bc('0x84')][_0x04bc('0x85')](_0x04bc('0x86'),util['format']('cf_%s',_0x4bc4bb['id']),_0x1f9fc6);})['then'](function(){return _0x4bc4bb;});});}})[_0x04bc('0x24')](respondWithResult(_0x1cc1e0,null))['catch'](handleError(_0x1cc1e0,null));};exports['getCustomFields']=function(_0x399a17,_0x3a2d6b,_0x152f35){var _0x4c2b0e={};var _0x19824d={};var _0x2875c5;var _0x2f95d7;return db[_0x04bc('0x2e')][_0x04bc('0x58')]({'where':{'id':_0x399a17[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x3a2d6b,null))['then'](function(_0x3ecd4f){if(_0x3ecd4f){_0x2875c5=_0x3ecd4f;_0x19824d['model']=_[_0x04bc('0x34')](db['CmCustomField']['rawAttributes']);_0x19824d['query']=_[_0x04bc('0x34')](_0x399a17[_0x04bc('0x33')]);_0x19824d['filters']=_[_0x04bc('0x36')](_0x19824d['model'],_0x19824d[_0x04bc('0x33')]);_0x4c2b0e[_0x04bc('0x37')]=_['intersection'](_0x19824d[_0x04bc('0x32')],qs[_0x04bc('0x46')](_0x399a17['query'][_0x04bc('0x46')]));_0x4c2b0e['attributes']=_0x4c2b0e[_0x04bc('0x37')][_0x04bc('0x38')]?_0x4c2b0e['attributes']:_0x19824d[_0x04bc('0x32')];_0x4c2b0e[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x399a17[_0x04bc('0x33')][_0x04bc('0x3b')]);_0x4c2b0e['where']=qs[_0x04bc('0x35')](_[_0x04bc('0x3c')](_0x399a17[_0x04bc('0x33')],_0x19824d[_0x04bc('0x35')]));_0x4c2b0e[_0x04bc('0x3f')]=_['merge'](_0x4c2b0e[_0x04bc('0x3f')],{'$or':[{'ListId':_0x3ecd4f['id']},{'ListId':null}]});if(_0x399a17[_0x04bc('0x33')][_0x04bc('0x3d')]){_0x4c2b0e[_0x04bc('0x3f')]=_[_0x04bc('0x3e')](_0x4c2b0e[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0x4c2b0e['attributes'],function(_0x48c19b){var _0x3db07a={};_0x3db07a[_0x48c19b]={'$like':'%'+_0x399a17[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x3db07a;})});}_0x4c2b0e=_[_0x04bc('0x3e')]({},_0x4c2b0e,_0x399a17[_0x04bc('0x47')]);return db[_0x04bc('0x68')][_0x04bc('0x87')](_0x4c2b0e);}})[_0x04bc('0x24')](respondWithResult(_0x3a2d6b,null))[_0x04bc('0x49')](handleError(_0x3a2d6b,null));};exports[_0x04bc('0x88')]=function(_0xf26561,_0x417215,_0x10e419){return db['CmList']['find']({'where':{'id':_0xf26561[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x417215,null))['then'](function(_0x2a0fab){if(_0x2a0fab){return _0x2a0fab[_0x04bc('0x88')](_0xf26561['body'][_0x04bc('0x89')],_['omit'](_0xf26561['body'],['ids','id'])||{})[_0x04bc('0x8a')](function(_0x2cd41e){for(var _0x2caaba=0x0;_0x2caaba<_0xf26561[_0x04bc('0x4b')][_0x04bc('0x89')][_0x04bc('0x38')];_0x2caaba+=0x1){socket[_0x04bc('0x8b')](_0x04bc('0x8c'),{'UserId':Number(_0xf26561[_0x04bc('0x4b')][_0x04bc('0x89')][_0x2caaba]),'CmListId':Number(_0xf26561[_0x04bc('0x45')]['id'])});}return _0x2cd41e;});}})[_0x04bc('0x24')](respondWithResult(_0x417215,null))[_0x04bc('0x49')](handleError(_0x417215,null));};exports['removeAgents']=function(_0x5b2695,_0x45909e,_0x1edbd8){return db[_0x04bc('0x2e')][_0x04bc('0x48')]({'where':{'id':_0x5b2695[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x45909e,null))['then'](function(_0x3e1e73){if(_0x3e1e73){return _0x3e1e73[_0x04bc('0x8d')](_0x5b2695[_0x04bc('0x33')]['ids'])['then'](function(){if(_[_0x04bc('0x5e')](_0x5b2695[_0x04bc('0x33')]['ids'])){for(var _0x3f65b7=0x0;_0x3f65b7<_0x5b2695[_0x04bc('0x33')]['ids'][_0x04bc('0x38')];_0x3f65b7+=0x1){socket[_0x04bc('0x8b')](_0x04bc('0x8e'),{'UserId':Number(_0x5b2695[_0x04bc('0x33')][_0x04bc('0x89')][_0x3f65b7]),'CmListId':Number(_0x5b2695['params']['id'])});}}else{socket[_0x04bc('0x8b')](_0x04bc('0x8e'),{'UserId':Number(_0x5b2695[_0x04bc('0x33')]['ids']),'CmListId':Number(_0x5b2695[_0x04bc('0x45')]['id'])});}});}})[_0x04bc('0x24')](respondWithStatusCode(_0x45909e,null))[_0x04bc('0x49')](handleError(_0x45909e,null));};exports['getAgents']=function(_0x2ccd91,_0x209c00,_0x506bda){var _0x10635d={};var _0x4ad676={};var _0x391fd9;var _0x689cc;return db[_0x04bc('0x2e')][_0x04bc('0x58')]({'where':{'id':_0x2ccd91[_0x04bc('0x45')]['id']}})[_0x04bc('0x24')](handleEntityNotFound(_0x209c00,null))[_0x04bc('0x24')](function(_0x2cdd87){if(_0x2cdd87){_0x391fd9=_0x2cdd87;_0x4ad676['model']=_[_0x04bc('0x34')](db[_0x04bc('0x8f')][_0x04bc('0x2f')]);_0x4ad676[_0x04bc('0x33')]=_[_0x04bc('0x34')](_0x2ccd91['query']);_0x4ad676[_0x04bc('0x35')]=_[_0x04bc('0x36')](_0x4ad676['model'],_0x4ad676[_0x04bc('0x33')]);_0x10635d[_0x04bc('0x37')]=_['intersection'](_0x4ad676[_0x04bc('0x32')],qs['fields'](_0x2ccd91[_0x04bc('0x33')]['fields']));_0x10635d['attributes']=_0x10635d['attributes'][_0x04bc('0x38')]?_0x10635d[_0x04bc('0x37')]:_0x4ad676[_0x04bc('0x32')];_0x10635d[_0x04bc('0x3a')]=qs[_0x04bc('0x3b')](_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x3b')]);_0x10635d[_0x04bc('0x3f')]=qs[_0x04bc('0x35')](_['pick'](_0x2ccd91[_0x04bc('0x33')],_0x4ad676['filters']));if(_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x3d')]){_0x10635d['where']=_['merge'](_0x10635d[_0x04bc('0x3f')],{'$or':_[_0x04bc('0x2d')](_0x10635d[_0x04bc('0x37')],function(_0x226a2d){var _0x118583={};_0x118583[_0x226a2d]={'$like':'%'+_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x3d')]+'%'};return _0x118583;})});}_0x10635d=_[_0x04bc('0x3e')]({},_0x10635d,_0x2ccd91[_0x04bc('0x47')]);return _0x391fd9[_0x04bc('0x90')](_0x10635d);}})['then'](function(_0x18e8c3){if(_0x18e8c3){_0x689cc=_0x18e8c3[_0x04bc('0x38')];if(!_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x39')](_0x04bc('0x59'))){_0x10635d[_0x04bc('0x20')]=qs[_0x04bc('0x20')](_0x2ccd91[_0x04bc('0x33')]['limit']);_0x10635d['offset']=qs[_0x04bc('0x1e')](_0x2ccd91[_0x04bc('0x33')][_0x04bc('0x1e')]);}return _0x391fd9[_0x04bc('0x90')](_0x10635d);}})['then'](function(_0xd65c3f){if(_0xd65c3f){return _0xd65c3f?{'count':_0x689cc,'rows':_0xd65c3f}:null;}})[_0x04bc('0x24')](respondWithResult(_0x209c00,null))['catch'](handleError(_0x209c00,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c3ae1d0..cf6c24f 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x4c6b59,_0x24d6d3){_0x4c6b59=_0x4c6b59-0x0;var _0x2ef400=_0xe14b[_0x4c6b59];return _0x2ef400;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x12ec5b,_0x492207){_0x12ec5b=_0x12ec5b-0x0;var _0x6cf7a4=_0xe14b[_0x12ec5b];return _0x6cf7a4;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 314f1c4..4a698f7 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 _0x2547=['rimraf','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0x2547,0x1cd));var _0x7254=function(_0x202bb4,_0x232a11){_0x202bb4=_0x202bb4-0x0;var _0x47d2ca=_0x2547[_0x202bb4];return _0x47d2ca;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1be1=['define','cm_lists','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1be1,0x192));var _0x11be=function(_0x419ffa,_0x304167){_0x419ffa=_0x419ffa-0x0;var _0x2472ed=_0x1be1[_0x419ffa];return _0x2472ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var moment=require('moment');var BPromise=require(_0x11be('0x2'));var rp=require(_0x11be('0x3'));var fs=require('fs');var path=require(_0x11be('0x4'));var rimraf=require(_0x11be('0x5'));var config=require('../../config/environment');var attributes=require(_0x11be('0x6'));module[_0x11be('0x7')]=function(_0x11f793,_0x479719){return _0x11f793[_0x11be('0x8')]('CmList',attributes,{'tableName':_0x11be('0x9'),'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 71f0f91..4b354c6 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 _0x3683=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43519a,_0x34cc9d){var _0x156ada=function(_0x1a8020){while(--_0x1a8020){_0x43519a['push'](_0x43519a['shift']());}};_0x156ada(++_0x34cc9d);}(_0x3683,0x154));var _0x3368=function(_0x237df7,_0x2c3a9a){_0x237df7=_0x237df7-0x0;var _0xd93b57=_0x3683[_0x237df7];return _0xd93b57;};'use strict';var _=require(_0x3368('0x0'));var util=require(_0x3368('0x1'));var moment=require('moment');var BPromise=require(_0x3368('0x2'));var rs=require(_0x3368('0x3'));var fs=require('fs');var Redis=require(_0x3368('0x4'));var db=require(_0x3368('0x5'))['db'];var utils=require(_0x3368('0x6'));var logger=require(_0x3368('0x7'))(_0x3368('0x8'));var config=require(_0x3368('0x9'));var jayson=require(_0x3368('0xa'));var client=jayson[_0x3368('0xb')][_0x3368('0xc')]({'port':0x232a});config[_0x3368('0xd')]=_[_0x3368('0xe')](config[_0x3368('0xd')],{'host':_0x3368('0xf'),'port':0x18eb});var socket=require(_0x3368('0x10'))(new Redis(config[_0x3368('0xd')]));require(_0x3368('0x11'))[_0x3368('0x12')](socket);function respondWithRpcPromise(_0x2cc5ce,_0x26ced9,_0x41ba72){return new BPromise(function(_0x8837de,_0x25c288){return client[_0x3368('0x13')](_0x2cc5ce,_0x41ba72)['then'](function(_0x49dbba){logger[_0x3368('0x14')](_0x3368('0x15'),_0x26ced9,_0x3368('0x16'));logger[_0x3368('0x17')]('CmList,\x20%s,\x20%s,\x20%s',_0x26ced9,_0x3368('0x16'),JSON[_0x3368('0x18')](_0x49dbba));if(_0x49dbba[_0x3368('0x19')]){if(_0x49dbba[_0x3368('0x19')]['code']===0x1f4){logger[_0x3368('0x19')](_0x3368('0x15'),_0x26ced9,_0x49dbba[_0x3368('0x19')][_0x3368('0x1a')]);return _0x25c288(_0x49dbba[_0x3368('0x19')][_0x3368('0x1a')]);}logger[_0x3368('0x19')](_0x3368('0x15'),_0x26ced9,_0x49dbba[_0x3368('0x19')][_0x3368('0x1a')]);return _0x8837de(_0x49dbba[_0x3368('0x19')][_0x3368('0x1a')]);}else{logger[_0x3368('0x14')](_0x3368('0x15'),_0x26ced9,_0x3368('0x16'));_0x8837de(_0x49dbba[_0x3368('0x1b')][_0x3368('0x1a')]);}})[_0x3368('0x1c')](function(_0x347795){logger['error'](_0x3368('0x15'),_0x26ced9,_0x347795);_0x25c288(_0x347795);});});} \ No newline at end of file +var _0x443b=['socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2f4e7a,_0x4c3f4e){var _0x3299a0=function(_0x422bd1){while(--_0x422bd1){_0x2f4e7a['push'](_0x2f4e7a['shift']());}};_0x3299a0(++_0x4c3f4e);}(_0x443b,0x155));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb443('0x0'));var util=require('util');var moment=require(_0xb443('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb443('0x2'))['db'];var utils=require(_0xb443('0x3'));var logger=require('../../config/logger')(_0xb443('0x4'));var config=require('../../config/environment');var jayson=require(_0xb443('0x5'));var client=jayson[_0xb443('0x6')][_0xb443('0x7')]({'port':0x232a});config[_0xb443('0x8')]=_[_0xb443('0x9')](config['redis'],{'host':_0xb443('0xa'),'port':0x18eb});var socket=require(_0xb443('0xb'))(new Redis(config[_0xb443('0x8')]));require(_0xb443('0xc'))[_0xb443('0xd')](socket);function respondWithRpcPromise(_0x5b1e0f,_0xb9a2af,_0x5a4d16){return new BPromise(function(_0x149811,_0x36cc5f){return client['request'](_0x5b1e0f,_0x5a4d16)['then'](function(_0x470839){logger[_0xb443('0xe')](_0xb443('0xf'),_0xb9a2af,_0xb443('0x10'));logger[_0xb443('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0xb9a2af,_0xb443('0x10'),JSON[_0xb443('0x12')](_0x470839));if(_0x470839['error']){if(_0x470839[_0xb443('0x13')]['code']===0x1f4){logger[_0xb443('0x13')](_0xb443('0xf'),_0xb9a2af,_0x470839['error'][_0xb443('0x14')]);return _0x36cc5f(_0x470839[_0xb443('0x13')]['message']);}logger[_0xb443('0x13')](_0xb443('0xf'),_0xb9a2af,_0x470839['error']['message']);return _0x149811(_0x470839[_0xb443('0x13')][_0xb443('0x14')]);}else{logger[_0xb443('0xe')](_0xb443('0xf'),_0xb9a2af,'request\x20sent');_0x149811(_0x470839[_0xb443('0x15')][_0xb443('0x14')]);}})['catch'](function(_0x28c977){logger[_0xb443('0x13')](_0xb443('0xf'),_0xb9a2af,_0x28c977);_0x36cc5f(_0x28c977);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 119afe2..29d4307 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 _0xe942=['update','emit','removeListener','cmList:','./cmList.events','save','remove'];(function(_0x223ee9,_0x211a6f){var _0x1798a1=function(_0x35fa51){while(--_0x35fa51){_0x223ee9['push'](_0x223ee9['shift']());}};_0x1798a1(++_0x211a6f);}(_0xe942,0x1ee));var _0x2e94=function(_0x53ed0b,_0x25e205){_0x53ed0b=_0x53ed0b-0x0;var _0x453628=_0xe942[_0x53ed0b];return _0x453628;};'use strict';var CmListEvents=require(_0x2e94('0x0'));var events=[_0x2e94('0x1'),_0x2e94('0x2'),_0x2e94('0x3')];function createListener(_0x56d552,_0x402b21){return function(_0x35974d){_0x402b21[_0x2e94('0x4')](_0x56d552,_0x35974d);};}function removeListener(_0x259301,_0x3323d2){return function(){CmListEvents[_0x2e94('0x5')](_0x259301,_0x3323d2);};}exports['register']=function(_0x3474d0){for(var _0x4d49ed=0x0,_0x17e41b=events['length'];_0x4d49ed<_0x17e41b;_0x4d49ed++){var _0x412cbd=events[_0x4d49ed];var _0x2b579b=createListener(_0x2e94('0x6')+_0x412cbd,_0x3474d0);CmListEvents['on'](_0x412cbd,_0x2b579b);}}; \ No newline at end of file +var _0x698e=['remove','removeListener','register','cmList:','./cmList.events','save'];(function(_0x277ded,_0x830a66){var _0xf3081b=function(_0x1a5d25){while(--_0x1a5d25){_0x277ded['push'](_0x277ded['shift']());}};_0xf3081b(++_0x830a66);}(_0x698e,0x130));var _0xe698=function(_0x2604bd,_0x49db71){_0x2604bd=_0x2604bd-0x0;var _0xea15ed=_0x698e[_0x2604bd];return _0xea15ed;};'use strict';var CmListEvents=require(_0xe698('0x0'));var events=[_0xe698('0x1'),_0xe698('0x2'),'update'];function createListener(_0x4e6ef9,_0x5b66bd){return function(_0x1f79a1){_0x5b66bd['emit'](_0x4e6ef9,_0x1f79a1);};}function removeListener(_0x41dc18,_0x24333a){return function(){CmListEvents[_0xe698('0x3')](_0x41dc18,_0x24333a);};}exports[_0xe698('0x4')]=function(_0x2fee4a){for(var _0x343379=0x0,_0x47d2ef=events['length'];_0x343379<_0x47d2ef;_0x343379++){var _0x473c89=events[_0x343379];var _0x278300=createListener(_0xe698('0x5')+_0x473c89,_0x2fee4a);CmListEvents['on'](_0x473c89,_0x278300);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 5307b1d..69cea03 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 _0xe0e0=['getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','create','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','/:id','update','delete','destroy','/:id/users','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x45593f,_0x1a196b){var _0x34c808=function(_0xc725bb){while(--_0xc725bb){_0x45593f['push'](_0x45593f['shift']());}};_0x34c808(++_0x1a196b);}(_0xe0e0,0xb9));var _0x0e0e=function(_0x331104,_0xc0be83){_0x331104=_0x331104-0x0;var _0x56fc9b=_0xe0e0[_0x331104];return _0x56fc9b;};'use strict';var multer=require(_0x0e0e('0x0'));var util=require(_0x0e0e('0x1'));var path=require('path');var timeout=require(_0x0e0e('0x2'));var express=require('express');var router=express[_0x0e0e('0x3')]();var fs_extra=require(_0x0e0e('0x4'));var auth=require(_0x0e0e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e0e('0x6'));var controller=require(_0x0e0e('0x7'));router[_0x0e0e('0x8')]('/',auth[_0x0e0e('0x9')](),controller[_0x0e0e('0xa')]);router[_0x0e0e('0x8')](_0x0e0e('0xb'),auth[_0x0e0e('0x9')](),controller[_0x0e0e('0xc')]);router[_0x0e0e('0x8')]('/:id',auth[_0x0e0e('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0x0e0e('0x9')](),controller[_0x0e0e('0xd')]);router['get']('/:id/contacts',auth[_0x0e0e('0x9')](),controller['getContacts']);router[_0x0e0e('0x8')](_0x0e0e('0xe'),auth[_0x0e0e('0x9')](),controller[_0x0e0e('0xf')]);router[_0x0e0e('0x8')](_0x0e0e('0x10'),auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x11')]);router[_0x0e0e('0x8')]('/:id/users',auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e0e('0x13')]);router[_0x0e0e('0x14')](_0x0e0e('0x15'),auth['isAuthenticated'](),controller[_0x0e0e('0x16')]);router[_0x0e0e('0x14')]('/:id/contacts',auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x17')]);router[_0x0e0e('0x14')](_0x0e0e('0x10'),auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x18')]);router[_0x0e0e('0x14')]('/:id/users',auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x19')]);router['put'](_0x0e0e('0x1a'),auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x1b')]);router[_0x0e0e('0x1c')](_0x0e0e('0x1a'),auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x1d')]);router[_0x0e0e('0x1c')]('/:id/dispositions',auth[_0x0e0e('0x9')](),controller['removeDispositions']);router['delete'](_0x0e0e('0x1e'),auth[_0x0e0e('0x9')](),controller[_0x0e0e('0x1f')]);module[_0x0e0e('0x20')]=router; \ No newline at end of file +var _0x891b=['get','index','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller'];(function(_0x47f63d,_0x13f702){var _0x31bafd=function(_0x3e5a0f){while(--_0x3e5a0f){_0x47f63d['push'](_0x47f63d['shift']());}};_0x31bafd(++_0x13f702);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var fs_extra=require(_0xb891('0x3'));var auth=require(_0xb891('0x4'));var interaction=require(_0xb891('0x5'));var config=require('../../config/environment');var controller=require(_0xb891('0x6'));router[_0xb891('0x7')]('/',auth['isAuthenticated'](),controller[_0xb891('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb891('0x9')]);router[_0xb891('0x7')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0xc')]);router[_0xb891('0x7')](_0xb891('0xd'),auth['isAuthenticated'](),controller[_0xb891('0xe')]);router[_0xb891('0x7')](_0xb891('0xf'),auth[_0xb891('0xb')](),controller[_0xb891('0x10')]);router[_0xb891('0x7')](_0xb891('0x11'),auth[_0xb891('0xb')](),controller[_0xb891('0x12')]);router[_0xb891('0x7')](_0xb891('0x13'),auth['isAuthenticated'](),controller[_0xb891('0x14')]);router[_0xb891('0x7')](_0xb891('0x15'),auth['isAuthenticated'](),controller[_0xb891('0x16')]);router[_0xb891('0x17')]('/',auth['isAuthenticated'](),controller[_0xb891('0x18')]);router['post'](_0xb891('0xd'),auth[_0xb891('0xb')](),controller[_0xb891('0x19')]);router[_0xb891('0x17')](_0xb891('0xf'),auth[_0xb891('0xb')](),controller['addContacts']);router['post'](_0xb891('0x13'),auth[_0xb891('0xb')](),controller[_0xb891('0x1a')]);router[_0xb891('0x17')](_0xb891('0x15'),auth[_0xb891('0xb')](),controller[_0xb891('0x1b')]);router[_0xb891('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xb891('0x1d')]);router['delete'](_0xb891('0xa'),auth[_0xb891('0xb')](),controller['destroy']);router[_0xb891('0x1e')]('/:id/dispositions',auth[_0xb891('0xb')](),controller[_0xb891('0x1f')]);router[_0xb891('0x1e')](_0xb891('0x15'),auth[_0xb891('0xb')](),controller[_0xb891('0x20')]);module[_0xb891('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5d30d01..a6d9157 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 _0xd4a0=['sequelize','exports','VIRTUAL','STRING'];(function(_0x48fc0d,_0x8ae2bc){var _0x36452e=function(_0x14f6b4){while(--_0x14f6b4){_0x48fc0d['push'](_0x48fc0d['shift']());}};_0x36452e(++_0x8ae2bc);}(_0xd4a0,0x130));var _0x0d4a=function(_0x5692a2,_0x48e2b6){_0x5692a2=_0x5692a2-0x0;var _0x53ee60=_0xd4a0[_0x5692a2];return _0x53ee60;};'use strict';var Sequelize=require(_0x0d4a('0x0'));module[_0x0d4a('0x1')]={'name':{'type':Sequelize[_0x0d4a('0x2')],'get':function(_0x2735e1){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x0d4a('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x0d4a('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x136e=['STRING','sequelize','VIRTUAL','getDataValue','field'];(function(_0x1ac0f7,_0x46e477){var _0x2b36e3=function(_0x2e71f2){while(--_0x2e71f2){_0x1ac0f7['push'](_0x1ac0f7['shift']());}};_0x2b36e3(++_0x46e477);}(_0x136e,0xd8));var _0xe136=function(_0x56aaed,_0x408e35){_0x56aaed=_0x56aaed-0x0;var _0x154eba=_0x136e[_0x56aaed];return _0x154eba;};'use strict';var Sequelize=require(_0xe136('0x0'));module['exports']={'name':{'type':Sequelize[_0xe136('0x1')],'get':function(_0x52f3f8){return this[_0xe136('0x2')](_0xe136('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xe136('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xe136('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index bc2b25b..17be20d 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1b5be6,_0x54aed6){var _0x45b8ac=function(_0x480aa1){while(--_0x480aa1){_0x1b5be6['push'](_0x1b5be6['shift']());}};_0x45b8ac(++_0x54aed6);}(_0x7a54,0x106));var _0x47a5=function(_0x5d4af9,_0x3dc1bf){_0x5d4af9=_0x5d4af9-0x0;var _0x2b1496=_0x7a54[_0x5d4af9];return _0x2b1496;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x48ba0a,_0x4b5223){var _0x56397e=function(_0x1b353d){while(--_0x1b353d){_0x48ba0a['push'](_0x48ba0a['shift']());}};_0x56397e(++_0x4b5223);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 9fcf9ee..06ec857 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 _0xdf86=['path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x587000,_0x500fa7){var _0x59d012=function(_0x46e485){while(--_0x46e485){_0x587000['push'](_0x587000['shift']());}};_0x59d012(++_0x500fa7);}(_0xdf86,0xa1));var _0x6df8=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0xdf86[_0x5b3b9b];return _0x47c1d7;};'use strict';var _=require(_0x6df8('0x0'));var util=require(_0x6df8('0x1'));var logger=require(_0x6df8('0x2'))(_0x6df8('0x3'));var moment=require(_0x6df8('0x4'));var BPromise=require(_0x6df8('0x5'));var rp=require(_0x6df8('0x6'));var fs=require('fs');var path=require(_0x6df8('0x7'));var rimraf=require(_0x6df8('0x8'));var config=require(_0x6df8('0x9'));var attributes=require(_0x6df8('0xa'));module[_0x6df8('0xb')]=function(_0x259b3d,_0x8ed9b0){return _0x259b3d[_0x6df8('0xc')](_0x6df8('0xd'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2794=['request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2794,0x181));var _0x4279=function(_0x3fd7ec,_0x568221){_0x3fd7ec=_0x3fd7ec-0x0;var _0x4ff270=_0x2794[_0x3fd7ec];return _0x4ff270;};'use strict';var _=require('lodash');var util=require(_0x4279('0x0'));var logger=require(_0x4279('0x1'))(_0x4279('0x2'));var moment=require(_0x4279('0x3'));var BPromise=require(_0x4279('0x4'));var rp=require(_0x4279('0x5'));var fs=require('fs');var path=require(_0x4279('0x6'));var rimraf=require('rimraf');var config=require(_0x4279('0x7'));var attributes=require(_0x4279('0x8'));module[_0x4279('0x9')]=function(_0x3b8486,_0x593dd5){return _0x3b8486[_0x4279('0xa')](_0x4279('0xb'),attributes,{'tableName':_0x4279('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 11e574e..390ffd6 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 _0x6e13=['http','request','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x6e13,0x97));var _0x36e1=function(_0x3e0865,_0x2098dc){_0x3e0865=_0x3e0865-0x0;var _0xd66fe5=_0x6e13[_0x3e0865];return _0xd66fe5;};'use strict';var _=require(_0x36e1('0x0'));var util=require(_0x36e1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x36e1('0x2'));var fs=require('fs');var Redis=require(_0x36e1('0x3'));var db=require(_0x36e1('0x4'))['db'];var utils=require(_0x36e1('0x5'));var logger=require(_0x36e1('0x6'))('rpc');var config=require(_0x36e1('0x7'));var jayson=require(_0x36e1('0x8'));var client=jayson[_0x36e1('0x9')][_0x36e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f02f,_0x471824,_0x5bed19){return new BPromise(function(_0x237064,_0x50a509){return client[_0x36e1('0xb')](_0x39f02f,_0x5bed19)['then'](function(_0x280b3f){logger[_0x36e1('0xc')]('Condition,\x20%s,\x20%s',_0x471824,_0x36e1('0xd'));logger[_0x36e1('0xe')](_0x36e1('0xf'),_0x471824,_0x36e1('0xd'),JSON[_0x36e1('0x10')](_0x280b3f));if(_0x280b3f['error']){if(_0x280b3f[_0x36e1('0x11')][_0x36e1('0x12')]===0x1f4){logger['error'](_0x36e1('0x13'),_0x471824,_0x280b3f[_0x36e1('0x11')]['message']);return _0x50a509(_0x280b3f[_0x36e1('0x11')][_0x36e1('0x14')]);}logger['error'](_0x36e1('0x13'),_0x471824,_0x280b3f[_0x36e1('0x11')][_0x36e1('0x14')]);return _0x237064(_0x280b3f['error'][_0x36e1('0x14')]);}else{logger[_0x36e1('0xc')](_0x36e1('0x13'),_0x471824,_0x36e1('0xd'));_0x237064(_0x280b3f[_0x36e1('0x15')]['message']);}})[_0x36e1('0x16')](function(_0x1724db){logger['error']('Condition,\x20%s,\x20%s',_0x471824,_0x1724db);_0x50a509(_0x1724db);});});} \ No newline at end of file +var _0x41d6=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3fee26,_0xf93364){var _0x491205=function(_0x37d0cb){while(--_0x37d0cb){_0x3fee26['push'](_0x3fee26['shift']());}};_0x491205(++_0xf93364);}(_0x41d6,0x154));var _0x641d=function(_0x380320,_0x278bb5){_0x380320=_0x380320-0x0;var _0x58e944=_0x41d6[_0x380320];return _0x58e944;};'use strict';var _=require(_0x641d('0x0'));var util=require(_0x641d('0x1'));var moment=require(_0x641d('0x2'));var BPromise=require(_0x641d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x641d('0x4'));var db=require(_0x641d('0x5'))['db'];var utils=require(_0x641d('0x6'));var logger=require('../../config/logger')(_0x641d('0x7'));var config=require(_0x641d('0x8'));var jayson=require(_0x641d('0x9'));var client=jayson[_0x641d('0xa')][_0x641d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x383117,_0x4bb9ac,_0x394b15){return new BPromise(function(_0x672a77,_0x343632){return client['request'](_0x383117,_0x394b15)[_0x641d('0xc')](function(_0x31abe0){logger[_0x641d('0xd')](_0x641d('0xe'),_0x4bb9ac,_0x641d('0xf'));logger[_0x641d('0x10')](_0x641d('0x11'),_0x4bb9ac,_0x641d('0xf'),JSON[_0x641d('0x12')](_0x31abe0));if(_0x31abe0[_0x641d('0x13')]){if(_0x31abe0[_0x641d('0x13')]['code']===0x1f4){logger['error'](_0x641d('0xe'),_0x4bb9ac,_0x31abe0[_0x641d('0x13')][_0x641d('0x14')]);return _0x343632(_0x31abe0['error'][_0x641d('0x14')]);}logger[_0x641d('0x13')]('Condition,\x20%s,\x20%s',_0x4bb9ac,_0x31abe0[_0x641d('0x13')][_0x641d('0x14')]);return _0x672a77(_0x31abe0['error'][_0x641d('0x14')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x4bb9ac,_0x641d('0xf'));_0x672a77(_0x31abe0[_0x641d('0x15')][_0x641d('0x14')]);}})[_0x641d('0x16')](function(_0x30fe62){logger[_0x641d('0x13')](_0x641d('0xe'),_0x4bb9ac,_0x30fe62);_0x343632(_0x30fe62);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b2b6754..3c7ac42 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 _0x32bc=['./condition.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32bc,0xf7));var _0xc32b=function(_0x229e0a,_0x288c0a){_0x229e0a=_0x229e0a-0x0;var _0x36315d=_0x32bc[_0x229e0a];return _0x36315d;};'use strict';var multer=require(_0xc32b('0x0'));var util=require(_0xc32b('0x1'));var path=require(_0xc32b('0x2'));var timeout=require(_0xc32b('0x3'));var express=require(_0xc32b('0x4'));var router=express[_0xc32b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc32b('0x6'));var interaction=require(_0xc32b('0x7'));var config=require(_0xc32b('0x8'));var controller=require(_0xc32b('0x9'));router[_0xc32b('0xa')](_0xc32b('0xb'),auth[_0xc32b('0xc')](),controller[_0xc32b('0xd')]);router['delete'](_0xc32b('0xb'),auth[_0xc32b('0xc')](),controller[_0xc32b('0xe')]);module[_0xc32b('0xf')]=router; \ No newline at end of file +var _0xc5c6=['../../config/environment','./condition.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xdb647a,_0x4ee8a5){var _0x152504=function(_0x38f9e5){while(--_0x38f9e5){_0xdb647a['push'](_0xdb647a['shift']());}};_0x152504(++_0x4ee8a5);}(_0xc5c6,0x1e4));var _0x6c5c=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xc5c6[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0x6c5c('0x0'));var util=require(_0x6c5c('0x1'));var path=require('path');var timeout=require(_0x6c5c('0x2'));var express=require(_0x6c5c('0x3'));var router=express[_0x6c5c('0x4')]();var fs_extra=require(_0x6c5c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c5c('0x6'));var controller=require(_0x6c5c('0x7'));router['put']('/:id',auth[_0x6c5c('0x8')](),controller[_0x6c5c('0x9')]);router[_0x6c5c('0xa')](_0x6c5c('0xb'),auth['isAuthenticated'](),controller[_0x6c5c('0xc')]);module[_0x6c5c('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 4b632ef..a61b5dd 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x38458b,_0x4bf482){var _0x2259f7=function(_0x2dc2fa){while(--_0x2dc2fa){_0x38458b['push'](_0x38458b['shift']());}};_0x2259f7(++_0x4bf482);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x41e766,_0x174107){var _0x290e0d=function(_0x1d037c){while(--_0x1d037c){_0x41e766['push'](_0x41e766['shift']());}};_0x290e0d(++_0x174107);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index af3a197..952721a 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 _0xd3a9=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','update','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','save','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x45c3ae,_0xf0f13b){var _0xbd19e9=function(_0x4a4503){while(--_0x4a4503){_0x45c3ae['push'](_0x45c3ae['shift']());}};_0xbd19e9(++_0xf0f13b);}(_0xd3a9,0x1d5));var _0x9d3a=function(_0x585a6b,_0x4b836d){_0x585a6b=_0x585a6b-0x0;var _0x3d36c8=_0xd3a9[_0x585a6b];return _0x3d36c8;};'use strict';var emlformat=require(_0x9d3a('0x0'));var rimraf=require(_0x9d3a('0x1'));var zipdir=require(_0x9d3a('0x2'));var jsonpatch=require(_0x9d3a('0x3'));var rp=require(_0x9d3a('0x4'));var moment=require(_0x9d3a('0x5'));var BPromise=require(_0x9d3a('0x6'));var Mustache=require(_0x9d3a('0x7'));var util=require(_0x9d3a('0x8'));var path=require(_0x9d3a('0x9'));var sox=require(_0x9d3a('0xa'));var csv=require(_0x9d3a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d3a('0xc'));var _=require(_0x9d3a('0xd'));var squel=require(_0x9d3a('0xe'));var crypto=require(_0x9d3a('0xf'));var jsforce=require(_0x9d3a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9d3a('0x11'));var Papa=require(_0x9d3a('0x12'));var Redis=require(_0x9d3a('0x13'));var authService=require(_0x9d3a('0x14'));var qs=require(_0x9d3a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d3a('0x16'));var logger=require('../../config/logger')(_0x9d3a('0x17'));var utils=require('../../config/utils');var config=require(_0x9d3a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9d3a('0x19')]=_[_0x9d3a('0x1a')](config[_0x9d3a('0x19')],{'host':_0x9d3a('0x1b'),'port':0x18eb});var socket=require(_0x9d3a('0x1c'))(new Redis(config[_0x9d3a('0x19')]));require(_0x9d3a('0x1d'))[_0x9d3a('0x1e')](socket);function respondWithStatusCode(_0x4d0ba8,_0x4edbb7){_0x4edbb7=_0x4edbb7||0xcc;return function(_0x340d56){if(_0x340d56){return _0x4d0ba8['sendStatus'](_0x4edbb7);}return _0x4d0ba8[_0x9d3a('0x1f')](_0x4edbb7)[_0x9d3a('0x20')]();};}function respondWithResult(_0x1b2cc8,_0x2c29a7){_0x2c29a7=_0x2c29a7||0xc8;return function(_0x3670dd){if(_0x3670dd){return _0x1b2cc8[_0x9d3a('0x1f')](_0x2c29a7)[_0x9d3a('0x21')](_0x3670dd);}};}function respondWithFilteredResult(_0xcb681c,_0x5499db){return function(_0x26e66f){if(_0x26e66f){var _0x4c4ce4=typeof _0x5499db[_0x9d3a('0x22')]===_0x9d3a('0x23')&&typeof _0x5499db[_0x9d3a('0x24')]===_0x9d3a('0x23');var _0x3f52f5=_0x26e66f['count'];var _0x486108=_0x4c4ce4?0x0:_0x5499db['offset'];var _0x5db22d=_0x4c4ce4?_0x26e66f[_0x9d3a('0x25')]:_0x5499db[_0x9d3a('0x22')]+_0x5499db[_0x9d3a('0x24')];var _0x3c4ef7;if(_0x5db22d>=_0x3f52f5){_0x5db22d=_0x3f52f5;_0x3c4ef7=0xc8;}else{_0x3c4ef7=0xce;}_0xcb681c[_0x9d3a('0x1f')](_0x3c4ef7);return _0xcb681c[_0x9d3a('0x26')](_0x9d3a('0x27'),_0x486108+'-'+_0x5db22d+'/'+_0x3f52f5)[_0x9d3a('0x21')](_0x26e66f);}return null;};}function patchUpdates(_0x1c7a29){return function(_0x3e3fa3){try{jsonpatch['apply'](_0x3e3fa3,_0x1c7a29,!![]);}catch(_0x528364){return BPromise['reject'](_0x528364);}return _0x3e3fa3[_0x9d3a('0x28')]();};}function saveUpdates(_0x109315,_0x3b9641){return function(_0x3e386e){if(_0x3e386e){return _0x3e386e['update'](_0x109315)['then'](function(_0x439904){return _0x439904;});}return null;};}function removeEntity(_0x3bfd72,_0x5ab9db){return function(_0x2be324){if(_0x2be324){return _0x2be324[_0x9d3a('0x29')]()['then'](function(){var _0xd7b582=_0x2be324[_0x9d3a('0x2a')]({'plain':!![]});var _0x5214f5='CustomDashboards';return db[_0x9d3a('0x2b')][_0x9d3a('0x29')]({'where':{'type':_0x5214f5,'resourceId':_0xd7b582['id']}})[_0x9d3a('0x2c')](function(){return _0x2be324;});})[_0x9d3a('0x2c')](function(){_0x3bfd72[_0x9d3a('0x1f')](0xcc)[_0x9d3a('0x20')]();});}};}function handleEntityNotFound(_0x25c822,_0x2e32a0){return function(_0x2cc073){if(!_0x2cc073){_0x25c822[_0x9d3a('0x2d')](0x194);}return _0x2cc073;};}function handleError(_0x4c0879,_0x1cdb40){_0x1cdb40=_0x1cdb40||0x1f4;return function(_0x24f89a){logger[_0x9d3a('0x2e')](_0x24f89a[_0x9d3a('0x2f')]);if(_0x24f89a[_0x9d3a('0x30')]){delete _0x24f89a[_0x9d3a('0x30')];}_0x4c0879[_0x9d3a('0x1f')](_0x1cdb40)[_0x9d3a('0x31')](_0x24f89a);};}exports['index']=function(_0x30503d,_0x4ae3ac){var _0x5dd9f1={},_0x15752b={},_0x59e271={'count':0x0,'rows':[]};var _0x5cb82e=_['map'](db[_0x9d3a('0x32')][_0x9d3a('0x33')],function(_0x26c98b){return{'name':_0x26c98b[_0x9d3a('0x34')],'type':_0x26c98b[_0x9d3a('0x35')][_0x9d3a('0x36')]};});_0x15752b[_0x9d3a('0x37')]=_['map'](_0x5cb82e,_0x9d3a('0x30'));_0x15752b[_0x9d3a('0x38')]=_[_0x9d3a('0x39')](_0x30503d[_0x9d3a('0x38')]);_0x15752b[_0x9d3a('0x3a')]=_[_0x9d3a('0x3b')](_0x15752b[_0x9d3a('0x37')],_0x15752b['query']);_0x5dd9f1[_0x9d3a('0x3c')]=_[_0x9d3a('0x3b')](_0x15752b['model'],qs[_0x9d3a('0x3d')](_0x30503d[_0x9d3a('0x38')][_0x9d3a('0x3d')]));_0x5dd9f1[_0x9d3a('0x3c')]=_0x5dd9f1['attributes'][_0x9d3a('0x3e')]?_0x5dd9f1[_0x9d3a('0x3c')]:_0x15752b['model'];if(!_0x30503d[_0x9d3a('0x38')][_0x9d3a('0x3f')](_0x9d3a('0x40'))){_0x5dd9f1[_0x9d3a('0x24')]=qs[_0x9d3a('0x24')](_0x30503d['query']['limit']);_0x5dd9f1['offset']=qs[_0x9d3a('0x22')](_0x30503d[_0x9d3a('0x38')][_0x9d3a('0x22')]);}_0x5dd9f1[_0x9d3a('0x41')]=qs[_0x9d3a('0x42')](_0x30503d[_0x9d3a('0x38')]['sort']);_0x5dd9f1[_0x9d3a('0x43')]=qs[_0x9d3a('0x3a')](_[_0x9d3a('0x44')](_0x30503d[_0x9d3a('0x38')],_0x15752b[_0x9d3a('0x3a')]),_0x5cb82e);if(_0x30503d[_0x9d3a('0x38')][_0x9d3a('0x45')]){_0x5dd9f1['where']=_['merge'](_0x5dd9f1['where'],{'$or':_[_0x9d3a('0x46')](_0x5cb82e,function(_0x3d674f){if(_0x3d674f[_0x9d3a('0x35')]!==_0x9d3a('0x47')){var _0x2b73ec={};_0x2b73ec[_0x3d674f['name']]={'$like':'%'+_0x30503d[_0x9d3a('0x38')][_0x9d3a('0x45')]+'%'};return _0x2b73ec;}})});}_0x5dd9f1=_[_0x9d3a('0x48')]({},_0x5dd9f1,_0x30503d[_0x9d3a('0x49')]);var _0x569e7f={'where':_0x5dd9f1['where']};return db['Dashboard'][_0x9d3a('0x25')](_0x569e7f)[_0x9d3a('0x2c')](function(_0x204c26){_0x59e271[_0x9d3a('0x25')]=_0x204c26;if(_0x30503d[_0x9d3a('0x38')][_0x9d3a('0x4a')]){_0x5dd9f1[_0x9d3a('0x4b')]=[{'all':!![]}];}return db[_0x9d3a('0x32')][_0x9d3a('0x4c')](_0x5dd9f1);})['then'](function(_0x470bec){_0x59e271['rows']=_0x470bec;return _0x59e271;})['then'](respondWithFilteredResult(_0x4ae3ac,_0x5dd9f1))['catch'](handleError(_0x4ae3ac,null));};exports[_0x9d3a('0x4d')]=function(_0x1e75a1,_0x10b80b){var _0x1e3647={'raw':![],'where':{'id':_0x1e75a1[_0x9d3a('0x4e')]['id']}},_0x35099d={};_0x35099d[_0x9d3a('0x37')]=_[_0x9d3a('0x39')](db[_0x9d3a('0x32')][_0x9d3a('0x33')]);_0x35099d[_0x9d3a('0x38')]=_[_0x9d3a('0x39')](_0x1e75a1[_0x9d3a('0x38')]);_0x35099d[_0x9d3a('0x3a')]=_[_0x9d3a('0x3b')](_0x35099d[_0x9d3a('0x37')],_0x35099d[_0x9d3a('0x38')]);_0x1e3647[_0x9d3a('0x3c')]=_['intersection'](_0x35099d[_0x9d3a('0x37')],qs[_0x9d3a('0x3d')](_0x1e75a1[_0x9d3a('0x38')][_0x9d3a('0x3d')]));_0x1e3647[_0x9d3a('0x3c')]=_0x1e3647[_0x9d3a('0x3c')][_0x9d3a('0x3e')]?_0x1e3647[_0x9d3a('0x3c')]:_0x35099d[_0x9d3a('0x37')];if(_0x1e75a1['query'][_0x9d3a('0x4a')]){_0x1e3647['include']=[{'all':!![]}];}_0x1e3647=_['merge']({},_0x1e3647,_0x1e75a1[_0x9d3a('0x49')]);return db[_0x9d3a('0x32')][_0x9d3a('0x4f')](_0x1e3647)[_0x9d3a('0x2c')](handleEntityNotFound(_0x10b80b,null))[_0x9d3a('0x2c')](respondWithResult(_0x10b80b,null))[_0x9d3a('0x50')](handleError(_0x10b80b,null));};exports[_0x9d3a('0x51')]=function(_0xc1d333,_0x9bb346){return db[_0x9d3a('0x32')][_0x9d3a('0x51')](_0xc1d333['body'],{})['then'](function(_0x114bbe){var _0x3e0c44=_0xc1d333['user'][_0x9d3a('0x2a')]({'plain':!![]});if(!_0x3e0c44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e0c44[_0x9d3a('0x52')]==='user'){var _0x4118bb=_0x114bbe[_0x9d3a('0x2a')]({'plain':!![]});var _0x2e6846='CustomDashboards';return db[_0x9d3a('0x53')][_0x9d3a('0x4f')]({'where':{'name':_0x2e6846,'userProfileId':_0x3e0c44[_0x9d3a('0x54')]},'raw':!![]})[_0x9d3a('0x2c')](function(_0x3c17b9){if(_0x3c17b9&&_0x3c17b9[_0x9d3a('0x55')]===0x0){return db['UserProfileResource'][_0x9d3a('0x51')]({'name':_0x4118bb['name'],'resourceId':_0x4118bb['id'],'type':_0x3c17b9[_0x9d3a('0x30')],'sectionId':_0x3c17b9['id']},{})[_0x9d3a('0x2c')](function(){return _0x114bbe;});}else{return _0x114bbe;}})[_0x9d3a('0x50')](function(_0x260184){logger[_0x9d3a('0x2e')](_0x9d3a('0x56'),_0x260184);throw _0x260184;});}return _0x114bbe;})[_0x9d3a('0x2c')](respondWithResult(_0x9bb346,0xc9))[_0x9d3a('0x50')](handleError(_0x9bb346,null));};exports[_0x9d3a('0x57')]=function(_0x134eaa,_0xf87a49){var _0x290683={'where':{'id':_0x134eaa[_0x9d3a('0x4e')]['id']}},_0x399ec2={};_0x399ec2[_0x9d3a('0x37')]=_[_0x9d3a('0x39')](db['Dashboard'][_0x9d3a('0x33')]);_0x290683[_0x9d3a('0x3c')]=_[_0x9d3a('0x3b')](_0x399ec2['model'],qs['fields'](_0x134eaa[_0x9d3a('0x38')][_0x9d3a('0x3d')]));_0x290683[_0x9d3a('0x3c')]=_0x290683[_0x9d3a('0x3c')][_0x9d3a('0x3e')]?_0x290683['attributes']:_0x399ec2[_0x9d3a('0x37')];if(_0x134eaa['query'][_0x9d3a('0x4a')]){_0x290683['include']=[{'all':!![]}];}_0x290683=_['merge']({},_0x290683,_0x134eaa[_0x9d3a('0x49')]);return db[_0x9d3a('0x32')][_0x9d3a('0x4f')](_0x290683)[_0x9d3a('0x2c')](handleEntityNotFound(_0xf87a49,null))[_0x9d3a('0x2c')](function(_0x5c0145){if(_0x5c0145){var _0x2c5d51=_0x5c0145[_0x9d3a('0x2a')]({'plain':!![]});_0x2c5d51=qs[_0x9d3a('0x58')](_0x2c5d51,['id',_0x9d3a('0x59'),_0x9d3a('0x5a')]);_0x134eaa[_0x9d3a('0x5b')]=_[_0x9d3a('0x58')](_0x134eaa[_0x9d3a('0x5b')],['id',_0x9d3a('0x59'),'updatedAt']);return db[_0x9d3a('0x32')]['create'](_[_0x9d3a('0x48')](_0x2c5d51,_0x134eaa[_0x9d3a('0x5b')]),{'include':_0x134eaa[_0x9d3a('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x9d3a('0x2c')](function(_0x2be65b){var _0x5de312=_0x134eaa[_0x9d3a('0x5c')]['get']({'plain':!![]});if(!_0x5de312)throw new Error(_0x9d3a('0x5d'));if(_0x5de312[_0x9d3a('0x52')]==='user'){var _0x1c007c=_0x2be65b[_0x9d3a('0x2a')]({'plain':!![]});var _0x5302fa=_0x9d3a('0x5e');return db[_0x9d3a('0x53')][_0x9d3a('0x4f')]({'where':{'name':_0x5302fa,'userProfileId':_0x5de312['userProfileId']},'raw':!![]})[_0x9d3a('0x2c')](function(_0x27b2e6){if(_0x27b2e6&&_0x27b2e6['autoAssociation']===0x0){return db[_0x9d3a('0x2b')]['create']({'name':_0x1c007c['name'],'resourceId':_0x1c007c['id'],'type':_0x27b2e6[_0x9d3a('0x30')],'sectionId':_0x27b2e6['id']},{})[_0x9d3a('0x2c')](function(){return _0x2be65b;});}else{return _0x2be65b;}})[_0x9d3a('0x50')](function(_0x59be12){logger[_0x9d3a('0x2e')](_0x9d3a('0x56'),_0x59be12);throw _0x59be12;});}return _0x2be65b;});}})[_0x9d3a('0x2c')](respondWithResult(_0xf87a49,0xc9))['catch'](handleError(_0xf87a49,null));};exports[_0x9d3a('0x5f')]=function(_0x5bad72,_0x4ac11e){if(_0x5bad72[_0x9d3a('0x5b')]['id']){delete _0x5bad72[_0x9d3a('0x5b')]['id'];}return db[_0x9d3a('0x32')]['find']({'where':{'id':_0x5bad72[_0x9d3a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4ac11e,null))['then'](saveUpdates(_0x5bad72[_0x9d3a('0x5b')],null))['then'](respondWithResult(_0x4ac11e,null))[_0x9d3a('0x50')](handleError(_0x4ac11e,null));};exports['destroy']=function(_0x4044c5,_0xb6dd2d){return db[_0x9d3a('0x32')][_0x9d3a('0x4f')]({'where':{'id':_0x4044c5[_0x9d3a('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb6dd2d,null))['then'](removeEntity(_0xb6dd2d,null))[_0x9d3a('0x50')](handleError(_0xb6dd2d,null));};function widgetAttributes(_0x478798){try{switch(_0x478798[_0x9d3a('0x35')]){case _0x9d3a('0x60'):return[{'name':_0x9d3a('0x61'),'value':_0x478798[_0x9d3a('0x61')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x0]?_0x478798['attrs'][0x0][_0x9d3a('0x63')]:undefined)||'https://'}];case _0x9d3a('0x64'):return[{'name':'attrPath','value':_0x478798[_0x9d3a('0x65')]||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0x0]?_0x478798['attrs'][0x0][_0x9d3a('0x63')]:undefined)||''}];case _0x9d3a('0x66'):return[{'name':_0x9d3a('0x67'),'value':_0x478798['attrHourFormat']||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x0]?_0x478798['attrs'][0x0][_0x9d3a('0x63')]:undefined)||_0x9d3a('0x68')},{'name':'attrTimezone','value':_0x478798[_0x9d3a('0x69')]||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0x1]?_0x478798[_0x9d3a('0x62')][0x1]['value']:undefined)||_0x9d3a('0x6a')},{'name':_0x9d3a('0x6b'),'value':_0x478798[_0x9d3a('0x6b')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798['attrs'][0x2]?_0x478798[_0x9d3a('0x62')][0x2][_0x9d3a('0x63')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x478798['attrMetric']||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x0]?_0x478798['attrs'][0x0][_0x9d3a('0x63')]:undefined)||_0x9d3a('0x6c')},{'name':_0x9d3a('0x6d'),'value':_0x478798[_0x9d3a('0x6d')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x1]?_0x478798[_0x9d3a('0x62')][0x1][_0x9d3a('0x63')]:undefined)||[]},{'name':_0x9d3a('0x6b'),'value':_0x478798['attrFontSize']||(_0x478798[_0x9d3a('0x62')]&&_0x478798['attrs'][0x2]?_0x478798[_0x9d3a('0x62')][0x2][_0x9d3a('0x63')]:undefined)||0x14},{'name':_0x9d3a('0x6e'),'value':_0x478798[_0x9d3a('0x6e')]||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0x3]?_0x478798[_0x9d3a('0x62')][0x3][_0x9d3a('0x63')]:undefined)||_0x9d3a('0x6f')},{'name':_0x9d3a('0x70'),'value':_0x478798[_0x9d3a('0x70')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x4]?_0x478798[_0x9d3a('0x62')][0x4]['value']:undefined)||''},{'name':_0x9d3a('0x71'),'value':_0x478798['attrFaxAccounts']||(_0x478798['attrs']&&_0x478798['attrs'][0x5]?_0x478798[_0x9d3a('0x62')][0x5]['value']:undefined)||''},{'name':_0x9d3a('0x72'),'value':_0x478798['attrSmsAccounts']||(_0x478798[_0x9d3a('0x62')]&&_0x478798['attrs'][0x6]?_0x478798[_0x9d3a('0x62')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x478798[_0x9d3a('0x73')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x7]?_0x478798[_0x9d3a('0x62')][0x7][_0x9d3a('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x478798[_0x9d3a('0x74')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x8]?_0x478798[_0x9d3a('0x62')][0x8][_0x9d3a('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x478798[_0x9d3a('0x75')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x9]?_0x478798[_0x9d3a('0x62')][0x9]['value']:undefined)||''}];case _0x9d3a('0x76'):case _0x9d3a('0x77'):return[{'name':_0x9d3a('0x78'),'value':_0x478798[_0x9d3a('0x78')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x0]?_0x478798[_0x9d3a('0x62')][0x0][_0x9d3a('0x63')]:undefined)||_0x9d3a('0x6c')},{'name':_0x9d3a('0x79'),'value':_0x478798[_0x9d3a('0x79')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x1]?_0x478798['attrs'][0x1][_0x9d3a('0x63')]:undefined)||null},{'name':_0x9d3a('0x7a'),'value':_0x478798[_0x9d3a('0x7a')]||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0x2]?_0x478798[_0x9d3a('0x62')][0x2]['value']:undefined)||null},{'name':_0x9d3a('0x6d'),'value':_0x478798[_0x9d3a('0x6d')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x3]?_0x478798[_0x9d3a('0x62')][0x3][_0x9d3a('0x63')]:undefined)||[]},{'name':_0x9d3a('0x6e'),'value':_0x478798['attrChannel']||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x4]?_0x478798['attrs'][0x4]['value']:undefined)||_0x9d3a('0x6f')},{'name':'attrEmailAccounts','value':_0x478798['attrEmailAccounts']||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0x5]?_0x478798[_0x9d3a('0x62')][0x5][_0x9d3a('0x63')]:undefined)||''},{'name':_0x9d3a('0x71'),'value':_0x478798[_0x9d3a('0x71')]||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0x6]?_0x478798['attrs'][0x6]['value']:undefined)||''},{'name':_0x9d3a('0x72'),'value':_0x478798[_0x9d3a('0x72')]||(_0x478798['attrs']&&_0x478798['attrs'][0x7]?_0x478798[_0x9d3a('0x62')][0x7][_0x9d3a('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x478798[_0x9d3a('0x73')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x8]?_0x478798[_0x9d3a('0x62')][0x8][_0x9d3a('0x63')]:undefined)||''},{'name':_0x9d3a('0x74'),'value':_0x478798[_0x9d3a('0x74')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798['attrs'][0x9]?_0x478798[_0x9d3a('0x62')][0x9][_0x9d3a('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x478798[_0x9d3a('0x75')]||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0xa]?_0x478798[_0x9d3a('0x62')][0xa][_0x9d3a('0x63')]:undefined)||''}];case _0x9d3a('0x7b'):return[{'name':_0x9d3a('0x7c'),'type':_0x478798['reportType']||(_0x478798[_0x9d3a('0x62')]&&_0x478798['attrs'][0x0]?_0x478798[_0x9d3a('0x62')][0x0][_0x9d3a('0x35')]:undefined)||null,'value':_0x478798[_0x9d3a('0x7c')]||(_0x478798[_0x9d3a('0x62')]&&_0x478798[_0x9d3a('0x62')][0x0]?_0x478798['attrs'][0x0][_0x9d3a('0x63')]:undefined)||null},{'name':_0x9d3a('0x7d'),'value':_0x478798[_0x9d3a('0x7d')]||(_0x478798['attrs']&&_0x478798[_0x9d3a('0x62')][0x1]?_0x478798['attrs'][0x1][_0x9d3a('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x282f91){logger[_0x9d3a('0x2e')](_0x9d3a('0x7e'),JSON[_0x9d3a('0x7f')](_0x282f91));return[];}}exports['addItem']=function(_0x3a5dcf,_0x21553a,_0x3e8a38){if(_0x3a5dcf['body']['id']){delete _0x3a5dcf[_0x9d3a('0x5b')]['id'];}return db['Dashboard'][_0x9d3a('0x4f')]({'where':{'id':_0x3a5dcf[_0x9d3a('0x4e')]['id']}})[_0x9d3a('0x2c')](handleEntityNotFound(_0x21553a,null))[_0x9d3a('0x2c')](function(_0x2e8ae6){if(_0x2e8ae6){_0x3a5dcf[_0x9d3a('0x5b')][_0x9d3a('0x80')]=_0x2e8ae6['id'];_0x3a5dcf[_0x9d3a('0x5b')][_0x9d3a('0x62')]=widgetAttributes(_0x3a5dcf[_0x9d3a('0x5b')]);return db[_0x9d3a('0x81')][_0x9d3a('0x51')](_0x3a5dcf['body']);}})[_0x9d3a('0x2c')](respondWithResult(_0x21553a,null))[_0x9d3a('0x50')](handleError(_0x21553a,null));};exports[_0x9d3a('0x82')]=function(_0x394685,_0x59bfb4,_0x20b5b9){var _0x5d663d={};var _0x3ca827={};var _0x57c086;var _0xb524e2;return db[_0x9d3a('0x32')][_0x9d3a('0x83')]({'where':{'id':_0x394685['params']['id']}})['then'](handleEntityNotFound(_0x59bfb4,null))['then'](function(_0x2b01c3){if(_0x2b01c3){_0x57c086=_0x2b01c3;_0x3ca827[_0x9d3a('0x37')]=_[_0x9d3a('0x39')](db[_0x9d3a('0x81')][_0x9d3a('0x33')]);_0x3ca827[_0x9d3a('0x38')]=_['keys'](_0x394685[_0x9d3a('0x38')]);_0x3ca827[_0x9d3a('0x3a')]=_[_0x9d3a('0x3b')](_0x3ca827[_0x9d3a('0x37')],_0x3ca827[_0x9d3a('0x38')]);_0x5d663d[_0x9d3a('0x3c')]=_['intersection'](_0x3ca827[_0x9d3a('0x37')],qs[_0x9d3a('0x3d')](_0x394685[_0x9d3a('0x38')]['fields']));_0x5d663d[_0x9d3a('0x3c')]=_0x5d663d[_0x9d3a('0x3c')][_0x9d3a('0x3e')]?_0x5d663d[_0x9d3a('0x3c')]:_0x3ca827[_0x9d3a('0x37')];_0x5d663d[_0x9d3a('0x41')]=qs[_0x9d3a('0x42')](_0x394685[_0x9d3a('0x38')]['sort']);_0x5d663d[_0x9d3a('0x43')]=qs[_0x9d3a('0x3a')](_['pick'](_0x394685[_0x9d3a('0x38')],_0x3ca827['filters']));if(_0x394685[_0x9d3a('0x38')][_0x9d3a('0x45')]){_0x5d663d['where']=_['merge'](_0x5d663d[_0x9d3a('0x43')],{'$or':_[_0x9d3a('0x46')](_0x5d663d[_0x9d3a('0x3c')],function(_0x21b3fa){var _0x2c7a98={};_0x2c7a98[_0x21b3fa]={'$like':'%'+_0x394685[_0x9d3a('0x38')][_0x9d3a('0x45')]+'%'};return _0x2c7a98;})});}_0x5d663d=_[_0x9d3a('0x48')]({},_0x5d663d,_0x394685[_0x9d3a('0x49')]);return _0x57c086['getItems'](_0x5d663d);}})['then'](function(_0x3bbb20){if(_0x3bbb20){_0xb524e2=_0x3bbb20['length'];if(!_0x394685['query'][_0x9d3a('0x3f')](_0x9d3a('0x40'))){_0x5d663d[_0x9d3a('0x24')]=qs[_0x9d3a('0x24')](_0x394685[_0x9d3a('0x38')]['limit']);_0x5d663d[_0x9d3a('0x22')]=qs[_0x9d3a('0x22')](_0x394685[_0x9d3a('0x38')]['offset']);}return _0x57c086[_0x9d3a('0x82')](_0x5d663d);}})['then'](function(_0x5599a5){if(_0x5599a5){return _0x5599a5?{'count':_0xb524e2,'rows':_0x5599a5}:null;}})[_0x9d3a('0x2c')](respondWithResult(_0x59bfb4,null))['catch'](handleError(_0x59bfb4,null));}; \ No newline at end of file +var _0x6f4a=['pick','filter','merge','where','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','updatedAt','body','createdAt','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','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters'];(function(_0x562e31,_0x108992){var _0x4014ff=function(_0x32c69d){while(--_0x32c69d){_0x562e31['push'](_0x562e31['shift']());}};_0x4014ff(++_0x108992);}(_0x6f4a,0xcc));var _0xa6f4=function(_0x29e30a,_0xe6dfc8){_0x29e30a=_0x29e30a-0x0;var _0x16417f=_0x6f4a[_0x29e30a];return _0x16417f;};'use strict';var emlformat=require(_0xa6f4('0x0'));var rimraf=require(_0xa6f4('0x1'));var zipdir=require(_0xa6f4('0x2'));var jsonpatch=require(_0xa6f4('0x3'));var rp=require(_0xa6f4('0x4'));var moment=require(_0xa6f4('0x5'));var BPromise=require(_0xa6f4('0x6'));var Mustache=require(_0xa6f4('0x7'));var util=require(_0xa6f4('0x8'));var path=require(_0xa6f4('0x9'));var sox=require(_0xa6f4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa6f4('0xb'));var _=require(_0xa6f4('0xc'));var squel=require(_0xa6f4('0xd'));var crypto=require('crypto');var jsforce=require(_0xa6f4('0xe'));var deskjs=require(_0xa6f4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa6f4('0x10'));var Papa=require(_0xa6f4('0x11'));var Redis=require(_0xa6f4('0x12'));var authService=require(_0xa6f4('0x13'));var qs=require(_0xa6f4('0x14'));var as=require(_0xa6f4('0x15'));var hardwareService=require(_0xa6f4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xa6f4('0x17'));var config=require(_0xa6f4('0x18'));var licenseUtil=require(_0xa6f4('0x19'));var db=require(_0xa6f4('0x1a'))['db'];config[_0xa6f4('0x1b')]=_['defaults'](config['redis'],{'host':_0xa6f4('0x1c'),'port':0x18eb});var socket=require(_0xa6f4('0x1d'))(new Redis(config[_0xa6f4('0x1b')]));require(_0xa6f4('0x1e'))['register'](socket);function respondWithStatusCode(_0x3d6da2,_0x9f7f3){_0x9f7f3=_0x9f7f3||0xcc;return function(_0x289e7b){if(_0x289e7b){return _0x3d6da2['sendStatus'](_0x9f7f3);}return _0x3d6da2['status'](_0x9f7f3)['end']();};}function respondWithResult(_0x354ae1,_0x640e2a){_0x640e2a=_0x640e2a||0xc8;return function(_0x2fe784){if(_0x2fe784){return _0x354ae1[_0xa6f4('0x1f')](_0x640e2a)['json'](_0x2fe784);}};}function respondWithFilteredResult(_0xe3ceaf,_0x11542f){return function(_0x4a3d12){if(_0x4a3d12){var _0x3398e4=typeof _0x11542f[_0xa6f4('0x20')]===_0xa6f4('0x21')&&typeof _0x11542f[_0xa6f4('0x22')]==='undefined';var _0x518bdf=_0x4a3d12['count'];var _0x3e5951=_0x3398e4?0x0:_0x11542f['offset'];var _0x566238=_0x3398e4?_0x4a3d12[_0xa6f4('0x23')]:_0x11542f['offset']+_0x11542f['limit'];var _0x321b40;if(_0x566238>=_0x518bdf){_0x566238=_0x518bdf;_0x321b40=0xc8;}else{_0x321b40=0xce;}_0xe3ceaf[_0xa6f4('0x1f')](_0x321b40);return _0xe3ceaf[_0xa6f4('0x24')](_0xa6f4('0x25'),_0x3e5951+'-'+_0x566238+'/'+_0x518bdf)[_0xa6f4('0x26')](_0x4a3d12);}return null;};}function patchUpdates(_0x2bdfc7){return function(_0x4aef5f){try{jsonpatch[_0xa6f4('0x27')](_0x4aef5f,_0x2bdfc7,!![]);}catch(_0x5ba94c){return BPromise['reject'](_0x5ba94c);}return _0x4aef5f[_0xa6f4('0x28')]();};}function saveUpdates(_0x3610d9,_0x4370f5){return function(_0x563f35){if(_0x563f35){return _0x563f35[_0xa6f4('0x29')](_0x3610d9)[_0xa6f4('0x2a')](function(_0x4d1e22){return _0x4d1e22;});}return null;};}function removeEntity(_0x32fe71,_0x46bedb){return function(_0x496e98){if(_0x496e98){return _0x496e98['destroy']()[_0xa6f4('0x2a')](function(){var _0xfef44a=_0x496e98['get']({'plain':!![]});var _0x549139='CustomDashboards';return db[_0xa6f4('0x2b')][_0xa6f4('0x2c')]({'where':{'type':_0x549139,'resourceId':_0xfef44a['id']}})[_0xa6f4('0x2a')](function(){return _0x496e98;});})['then'](function(){_0x32fe71[_0xa6f4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfadde8,_0x5d0f4a){return function(_0x1a82c7){if(!_0x1a82c7){_0xfadde8[_0xa6f4('0x2d')](0x194);}return _0x1a82c7;};}function handleError(_0x593617,_0x29080d){_0x29080d=_0x29080d||0x1f4;return function(_0x2f1be0){logger[_0xa6f4('0x2e')](_0x2f1be0[_0xa6f4('0x2f')]);if(_0x2f1be0['name']){delete _0x2f1be0[_0xa6f4('0x30')];}_0x593617[_0xa6f4('0x1f')](_0x29080d)[_0xa6f4('0x31')](_0x2f1be0);};}exports[_0xa6f4('0x32')]=function(_0x548be7,_0x519dab){var _0xac09e5={},_0x41d70f={},_0xb07c92={'count':0x0,'rows':[]};var _0x1a6774=_[_0xa6f4('0x33')](db[_0xa6f4('0x34')]['rawAttributes'],function(_0x309460){return{'name':_0x309460[_0xa6f4('0x35')],'type':_0x309460['type'][_0xa6f4('0x36')]};});_0x41d70f['model']=_['map'](_0x1a6774,_0xa6f4('0x30'));_0x41d70f['query']=_[_0xa6f4('0x37')](_0x548be7[_0xa6f4('0x38')]);_0x41d70f['filters']=_[_0xa6f4('0x39')](_0x41d70f[_0xa6f4('0x3a')],_0x41d70f[_0xa6f4('0x38')]);_0xac09e5[_0xa6f4('0x3b')]=_[_0xa6f4('0x39')](_0x41d70f[_0xa6f4('0x3a')],qs[_0xa6f4('0x3c')](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0xac09e5[_0xa6f4('0x3b')]=_0xac09e5['attributes'][_0xa6f4('0x3d')]?_0xac09e5[_0xa6f4('0x3b')]:_0x41d70f[_0xa6f4('0x3a')];if(!_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x3e')]('nolimit')){_0xac09e5['limit']=qs[_0xa6f4('0x22')](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x22')]);_0xac09e5['offset']=qs['offset'](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x20')]);}_0xac09e5[_0xa6f4('0x3f')]=qs[_0xa6f4('0x40')](_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x40')]);_0xac09e5['where']=qs[_0xa6f4('0x41')](_[_0xa6f4('0x42')](_0x548be7[_0xa6f4('0x38')],_0x41d70f[_0xa6f4('0x41')]),_0x1a6774);if(_0x548be7['query'][_0xa6f4('0x43')]){_0xac09e5['where']=_[_0xa6f4('0x44')](_0xac09e5[_0xa6f4('0x45')],{'$or':_[_0xa6f4('0x33')](_0x1a6774,function(_0x49536b){if(_0x49536b[_0xa6f4('0x46')]!==_0xa6f4('0x47')){var _0x51f8e2={};_0x51f8e2[_0x49536b[_0xa6f4('0x30')]]={'$like':'%'+_0x548be7[_0xa6f4('0x38')]['filter']+'%'};return _0x51f8e2;}})});}_0xac09e5=_[_0xa6f4('0x44')]({},_0xac09e5,_0x548be7[_0xa6f4('0x48')]);var _0x24aede={'where':_0xac09e5[_0xa6f4('0x45')]};return db[_0xa6f4('0x34')][_0xa6f4('0x23')](_0x24aede)[_0xa6f4('0x2a')](function(_0x5be323){_0xb07c92[_0xa6f4('0x23')]=_0x5be323;if(_0x548be7[_0xa6f4('0x38')][_0xa6f4('0x49')]){_0xac09e5['include']=[{'all':!![]}];}return db[_0xa6f4('0x34')]['findAll'](_0xac09e5);})['then'](function(_0x1d4d56){_0xb07c92[_0xa6f4('0x4a')]=_0x1d4d56;return _0xb07c92;})[_0xa6f4('0x2a')](respondWithFilteredResult(_0x519dab,_0xac09e5))[_0xa6f4('0x4b')](handleError(_0x519dab,null));};exports[_0xa6f4('0x4c')]=function(_0x35e0f5,_0x56c339){var _0x4b041c={'raw':![],'where':{'id':_0x35e0f5[_0xa6f4('0x4d')]['id']}},_0x5866fe={};_0x5866fe[_0xa6f4('0x3a')]=_[_0xa6f4('0x37')](db['Dashboard']['rawAttributes']);_0x5866fe[_0xa6f4('0x38')]=_[_0xa6f4('0x37')](_0x35e0f5[_0xa6f4('0x38')]);_0x5866fe['filters']=_[_0xa6f4('0x39')](_0x5866fe['model'],_0x5866fe[_0xa6f4('0x38')]);_0x4b041c[_0xa6f4('0x3b')]=_['intersection'](_0x5866fe[_0xa6f4('0x3a')],qs[_0xa6f4('0x3c')](_0x35e0f5[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x4b041c[_0xa6f4('0x3b')]=_0x4b041c[_0xa6f4('0x3b')][_0xa6f4('0x3d')]?_0x4b041c['attributes']:_0x5866fe['model'];if(_0x35e0f5['query'][_0xa6f4('0x49')]){_0x4b041c[_0xa6f4('0x4e')]=[{'all':!![]}];}_0x4b041c=_[_0xa6f4('0x44')]({},_0x4b041c,_0x35e0f5['options']);return db[_0xa6f4('0x34')]['find'](_0x4b041c)[_0xa6f4('0x2a')](handleEntityNotFound(_0x56c339,null))[_0xa6f4('0x2a')](respondWithResult(_0x56c339,null))[_0xa6f4('0x4b')](handleError(_0x56c339,null));};exports['create']=function(_0x8c4a29,_0x307569){return db[_0xa6f4('0x34')][_0xa6f4('0x4f')](_0x8c4a29['body'],{})[_0xa6f4('0x2a')](function(_0x4b79a8){var _0xfb46f0=_0x8c4a29[_0xa6f4('0x50')][_0xa6f4('0x51')]({'plain':!![]});if(!_0xfb46f0)throw new Error(_0xa6f4('0x52'));if(_0xfb46f0[_0xa6f4('0x53')]===_0xa6f4('0x50')){var _0x133afd=_0x4b79a8[_0xa6f4('0x51')]({'plain':!![]});var _0x187dc3=_0xa6f4('0x54');return db[_0xa6f4('0x55')][_0xa6f4('0x56')]({'where':{'name':_0x187dc3,'userProfileId':_0xfb46f0[_0xa6f4('0x57')]},'raw':!![]})['then'](function(_0x25f669){if(_0x25f669&&_0x25f669[_0xa6f4('0x58')]===0x0){return db[_0xa6f4('0x2b')][_0xa6f4('0x4f')]({'name':_0x133afd[_0xa6f4('0x30')],'resourceId':_0x133afd['id'],'type':_0x25f669[_0xa6f4('0x30')],'sectionId':_0x25f669['id']},{})['then'](function(){return _0x4b79a8;});}else{return _0x4b79a8;}})[_0xa6f4('0x4b')](function(_0x23aaaf){logger['error'](_0xa6f4('0x59'),_0x23aaaf);throw _0x23aaaf;});}return _0x4b79a8;})['then'](respondWithResult(_0x307569,0xc9))[_0xa6f4('0x4b')](handleError(_0x307569,null));};exports['clone']=function(_0x5e04ad,_0x1d9063){var _0x5d3c29={'where':{'id':_0x5e04ad[_0xa6f4('0x4d')]['id']}},_0x33286d={};_0x33286d[_0xa6f4('0x3a')]=_[_0xa6f4('0x37')](db[_0xa6f4('0x34')][_0xa6f4('0x5a')]);_0x5d3c29['attributes']=_[_0xa6f4('0x39')](_0x33286d['model'],qs[_0xa6f4('0x3c')](_0x5e04ad[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x5d3c29[_0xa6f4('0x3b')]=_0x5d3c29[_0xa6f4('0x3b')][_0xa6f4('0x3d')]?_0x5d3c29['attributes']:_0x33286d[_0xa6f4('0x3a')];if(_0x5e04ad[_0xa6f4('0x38')][_0xa6f4('0x49')]){_0x5d3c29['include']=[{'all':!![]}];}_0x5d3c29=_[_0xa6f4('0x44')]({},_0x5d3c29,_0x5e04ad[_0xa6f4('0x48')]);return db['Dashboard'][_0xa6f4('0x56')](_0x5d3c29)['then'](handleEntityNotFound(_0x1d9063,null))[_0xa6f4('0x2a')](function(_0x29e3ff){if(_0x29e3ff){var _0x323a61=_0x29e3ff['get']({'plain':!![]});_0x323a61=qs[_0xa6f4('0x5b')](_0x323a61,['id','createdAt',_0xa6f4('0x5c')]);_0x5e04ad[_0xa6f4('0x5d')]=_[_0xa6f4('0x5b')](_0x5e04ad[_0xa6f4('0x5d')],['id',_0xa6f4('0x5e'),'updatedAt']);return db[_0xa6f4('0x34')]['create'](_[_0xa6f4('0x44')](_0x323a61,_0x5e04ad[_0xa6f4('0x5d')]),{'include':_0x5e04ad[_0xa6f4('0x38')][_0xa6f4('0x49')]?[{'all':!![]}]:undefined})[_0xa6f4('0x2a')](function(_0xb46c4a){var _0x40c226=_0x5e04ad['user'][_0xa6f4('0x51')]({'plain':!![]});if(!_0x40c226)throw new Error(_0xa6f4('0x52'));if(_0x40c226['role']===_0xa6f4('0x50')){var _0x25533f=_0xb46c4a[_0xa6f4('0x51')]({'plain':!![]});var _0x3a8f4a=_0xa6f4('0x54');return db['UserProfileSection'][_0xa6f4('0x56')]({'where':{'name':_0x3a8f4a,'userProfileId':_0x40c226[_0xa6f4('0x57')]},'raw':!![]})['then'](function(_0x44b15c){if(_0x44b15c&&_0x44b15c['autoAssociation']===0x0){return db[_0xa6f4('0x2b')][_0xa6f4('0x4f')]({'name':_0x25533f[_0xa6f4('0x30')],'resourceId':_0x25533f['id'],'type':_0x44b15c[_0xa6f4('0x30')],'sectionId':_0x44b15c['id']},{})[_0xa6f4('0x2a')](function(){return _0xb46c4a;});}else{return _0xb46c4a;}})[_0xa6f4('0x4b')](function(_0x3d161e){logger[_0xa6f4('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d161e);throw _0x3d161e;});}return _0xb46c4a;});}})[_0xa6f4('0x2a')](respondWithResult(_0x1d9063,0xc9))[_0xa6f4('0x4b')](handleError(_0x1d9063,null));};exports['update']=function(_0x1df377,_0x265ea9){if(_0x1df377['body']['id']){delete _0x1df377[_0xa6f4('0x5d')]['id'];}return db['Dashboard'][_0xa6f4('0x56')]({'where':{'id':_0x1df377[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x265ea9,null))[_0xa6f4('0x2a')](saveUpdates(_0x1df377[_0xa6f4('0x5d')],null))[_0xa6f4('0x2a')](respondWithResult(_0x265ea9,null))['catch'](handleError(_0x265ea9,null));};exports['destroy']=function(_0x1c65a5,_0x3033ce){return db[_0xa6f4('0x34')]['find']({'where':{'id':_0x1c65a5[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x3033ce,null))['then'](removeEntity(_0x3033ce,null))[_0xa6f4('0x4b')](handleError(_0x3033ce,null));};function widgetAttributes(_0x3d3012){try{switch(_0x3d3012[_0xa6f4('0x46')]){case _0xa6f4('0x5f'):return[{'name':_0xa6f4('0x60'),'value':_0x3d3012[_0xa6f4('0x60')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x63')}];case _0xa6f4('0x64'):return[{'name':_0xa6f4('0x65'),'value':_0x3d3012['attrPath']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x62')]:undefined)||''}];case _0xa6f4('0x66'):return[{'name':_0xa6f4('0x67'),'value':_0x3d3012['attrHourFormat']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x68')},{'name':_0xa6f4('0x69'),'value':_0x3d3012[_0xa6f4('0x69')]||(_0x3d3012['attrs']&&_0x3d3012[_0xa6f4('0x61')][0x1]?_0x3d3012['attrs'][0x1]['value']:undefined)||_0xa6f4('0x6a')},{'name':_0xa6f4('0x6b'),'value':_0x3d3012[_0xa6f4('0x6b')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x2]?_0x3d3012[_0xa6f4('0x61')][0x2]['value']:undefined)||0xc}];case _0xa6f4('0x6c'):return[{'name':'attrMetric','value':_0x3d3012[_0xa6f4('0x6d')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012['attrs'][0x0][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x6e')},{'name':_0xa6f4('0x6f'),'value':_0x3d3012[_0xa6f4('0x6f')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x1]?_0x3d3012[_0xa6f4('0x61')][0x1][_0xa6f4('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0x3d3012[_0xa6f4('0x6b')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x2]?_0x3d3012[_0xa6f4('0x61')][0x2][_0xa6f4('0x62')]:undefined)||0x14},{'name':_0xa6f4('0x70'),'value':_0x3d3012['attrChannel']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x3]?_0x3d3012[_0xa6f4('0x61')][0x3]['value']:undefined)||_0xa6f4('0x71')},{'name':_0xa6f4('0x72'),'value':_0x3d3012[_0xa6f4('0x72')]||(_0x3d3012['attrs']&&_0x3d3012[_0xa6f4('0x61')][0x4]?_0x3d3012['attrs'][0x4][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x73'),'value':_0x3d3012[_0xa6f4('0x73')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x5]?_0x3d3012[_0xa6f4('0x61')][0x5][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x74'),'value':_0x3d3012['attrSmsAccounts']||(_0x3d3012['attrs']&&_0x3d3012[_0xa6f4('0x61')][0x6]?_0x3d3012['attrs'][0x6]['value']:undefined)||''},{'name':_0xa6f4('0x75'),'value':_0x3d3012[_0xa6f4('0x75')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x7]?_0x3d3012['attrs'][0x7][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x76'),'value':_0x3d3012['attrWhatsappAccounts']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x8]?_0x3d3012[_0xa6f4('0x61')][0x8][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x77'),'value':_0x3d3012['attrChatWebsites']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x9]?_0x3d3012[_0xa6f4('0x61')][0x9]['value']:undefined)||''}];case _0xa6f4('0x78'):case'pie-chart':return[{'name':'attrSerie1','value':_0x3d3012['attrSerie1']||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0]['value']:undefined)||_0xa6f4('0x6e')},{'name':_0xa6f4('0x79'),'value':_0x3d3012[_0xa6f4('0x79')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x1]?_0x3d3012['attrs'][0x1][_0xa6f4('0x62')]:undefined)||null},{'name':_0xa6f4('0x7a'),'value':_0x3d3012[_0xa6f4('0x7a')]||(_0x3d3012['attrs']&&_0x3d3012['attrs'][0x2]?_0x3d3012[_0xa6f4('0x61')][0x2][_0xa6f4('0x62')]:undefined)||null},{'name':_0xa6f4('0x6f'),'value':_0x3d3012[_0xa6f4('0x6f')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x3]?_0x3d3012[_0xa6f4('0x61')][0x3][_0xa6f4('0x62')]:undefined)||[]},{'name':'attrChannel','value':_0x3d3012[_0xa6f4('0x70')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x4]?_0x3d3012['attrs'][0x4][_0xa6f4('0x62')]:undefined)||_0xa6f4('0x71')},{'name':_0xa6f4('0x72'),'value':_0x3d3012[_0xa6f4('0x72')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x5]?_0x3d3012[_0xa6f4('0x61')][0x5]['value']:undefined)||''},{'name':_0xa6f4('0x73'),'value':_0x3d3012[_0xa6f4('0x73')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x6]?_0x3d3012[_0xa6f4('0x61')][0x6][_0xa6f4('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3d3012[_0xa6f4('0x74')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x7]?_0x3d3012['attrs'][0x7][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x75'),'value':_0x3d3012[_0xa6f4('0x75')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x8]?_0x3d3012['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3d3012[_0xa6f4('0x76')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x9]?_0x3d3012['attrs'][0x9][_0xa6f4('0x62')]:undefined)||''},{'name':_0xa6f4('0x77'),'value':_0x3d3012[_0xa6f4('0x77')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0xa]?_0x3d3012[_0xa6f4('0x61')][0xa][_0xa6f4('0x62')]:undefined)||''}];case _0xa6f4('0x7b'):return[{'name':_0xa6f4('0x7c'),'type':_0x3d3012[_0xa6f4('0x7d')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0][_0xa6f4('0x46')]:undefined)||null,'value':_0x3d3012[_0xa6f4('0x7c')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012[_0xa6f4('0x61')][0x0]?_0x3d3012[_0xa6f4('0x61')][0x0]['value']:undefined)||null},{'name':_0xa6f4('0x7e'),'value':_0x3d3012[_0xa6f4('0x7e')]||(_0x3d3012[_0xa6f4('0x61')]&&_0x3d3012['attrs'][0x1]?_0x3d3012['attrs'][0x1][_0xa6f4('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x292984){logger['error'](_0xa6f4('0x7f'),JSON[_0xa6f4('0x80')](_0x292984));return[];}}exports[_0xa6f4('0x81')]=function(_0x13b70f,_0x2ed12a,_0x1e78f6){if(_0x13b70f[_0xa6f4('0x5d')]['id']){delete _0x13b70f[_0xa6f4('0x5d')]['id'];}return db[_0xa6f4('0x34')]['find']({'where':{'id':_0x13b70f[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x2ed12a,null))[_0xa6f4('0x2a')](function(_0x343efc){if(_0x343efc){_0x13b70f[_0xa6f4('0x5d')][_0xa6f4('0x82')]=_0x343efc['id'];_0x13b70f[_0xa6f4('0x5d')][_0xa6f4('0x61')]=widgetAttributes(_0x13b70f['body']);return db['DashboardItem'][_0xa6f4('0x4f')](_0x13b70f['body']);}})[_0xa6f4('0x2a')](respondWithResult(_0x2ed12a,null))[_0xa6f4('0x4b')](handleError(_0x2ed12a,null));};exports[_0xa6f4('0x83')]=function(_0x181e5a,_0x5b374d,_0x468a38){var _0x317609={};var _0x30812f={};var _0x52957b;var _0x5bd283;return db[_0xa6f4('0x34')][_0xa6f4('0x84')]({'where':{'id':_0x181e5a[_0xa6f4('0x4d')]['id']}})[_0xa6f4('0x2a')](handleEntityNotFound(_0x5b374d,null))[_0xa6f4('0x2a')](function(_0x24075f){if(_0x24075f){_0x52957b=_0x24075f;_0x30812f[_0xa6f4('0x3a')]=_['keys'](db[_0xa6f4('0x85')][_0xa6f4('0x5a')]);_0x30812f[_0xa6f4('0x38')]=_[_0xa6f4('0x37')](_0x181e5a[_0xa6f4('0x38')]);_0x30812f[_0xa6f4('0x41')]=_[_0xa6f4('0x39')](_0x30812f[_0xa6f4('0x3a')],_0x30812f[_0xa6f4('0x38')]);_0x317609['attributes']=_['intersection'](_0x30812f[_0xa6f4('0x3a')],qs['fields'](_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x317609['attributes']=_0x317609['attributes'][_0xa6f4('0x3d')]?_0x317609[_0xa6f4('0x3b')]:_0x30812f[_0xa6f4('0x3a')];_0x317609[_0xa6f4('0x3f')]=qs['sort'](_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x40')]);_0x317609[_0xa6f4('0x45')]=qs['filters'](_[_0xa6f4('0x42')](_0x181e5a[_0xa6f4('0x38')],_0x30812f[_0xa6f4('0x41')]));if(_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x43')]){_0x317609[_0xa6f4('0x45')]=_[_0xa6f4('0x44')](_0x317609['where'],{'$or':_['map'](_0x317609[_0xa6f4('0x3b')],function(_0xc5782c){var _0x35f3e7={};_0x35f3e7[_0xc5782c]={'$like':'%'+_0x181e5a[_0xa6f4('0x38')]['filter']+'%'};return _0x35f3e7;})});}_0x317609=_[_0xa6f4('0x44')]({},_0x317609,_0x181e5a[_0xa6f4('0x48')]);return _0x52957b[_0xa6f4('0x83')](_0x317609);}})[_0xa6f4('0x2a')](function(_0x4bf581){if(_0x4bf581){_0x5bd283=_0x4bf581[_0xa6f4('0x3d')];if(!_0x181e5a[_0xa6f4('0x38')][_0xa6f4('0x3e')](_0xa6f4('0x86'))){_0x317609[_0xa6f4('0x22')]=qs[_0xa6f4('0x22')](_0x181e5a['query'][_0xa6f4('0x22')]);_0x317609[_0xa6f4('0x20')]=qs['offset'](_0x181e5a['query'][_0xa6f4('0x20')]);}return _0x52957b[_0xa6f4('0x83')](_0x317609);}})[_0xa6f4('0x2a')](function(_0x282e16){if(_0x282e16){return _0x282e16?{'count':_0x5bd283,'rows':_0x282e16}:null;}})[_0xa6f4('0x2a')](respondWithResult(_0x5b374d,null))[_0xa6f4('0x4b')](handleError(_0x5b374d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d9b9bf7..90ff390 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 _0x5af9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','Dashboard'];(function(_0xf98af1,_0x4aa8c3){var _0x123b66=function(_0x4342b9){while(--_0x4342b9){_0xf98af1['push'](_0xf98af1['shift']());}};_0x123b66(++_0x4aa8c3);}(_0x5af9,0x19c));var _0x95af=function(_0x14a513,_0x3239f){_0x14a513=_0x14a513-0x0;var _0x47236c=_0x5af9[_0x14a513];return _0x47236c;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x95af('0x0'))['db'][_0x95af('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x95af('0x2')](0x0);var events={'afterCreate':_0x95af('0x3'),'afterUpdate':_0x95af('0x4'),'afterDestroy':_0x95af('0x5')};function emitEvent(_0x23f913){return function(_0x44569b,_0x58e3b8,_0x2fc8f2){DashboardEvents['emit'](_0x23f913+':'+_0x44569b['id'],_0x44569b);DashboardEvents[_0x95af('0x6')](_0x23f913,_0x44569b);_0x2fc8f2(null);};}for(var e in events){if(events[_0x95af('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x95af('0x8')]=DashboardEvents; \ No newline at end of file +var _0x3343=['hasOwnProperty','hook','exports','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x552c27,_0x478dc2){var _0x2a0922=function(_0x22617c){while(--_0x22617c){_0x552c27['push'](_0x552c27['shift']());}};_0x2a0922(++_0x478dc2);}(_0x3343,0x1aa));var _0x3334=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x3343[_0x1551af];return _0xd8eb82;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x3334('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3334('0x1')](0x0);var events={'afterCreate':_0x3334('0x2'),'afterUpdate':_0x3334('0x3'),'afterDestroy':_0x3334('0x4')};function emitEvent(_0x5f5083){return function(_0x30b1fb,_0x16dcc0,_0x52de11){DashboardEvents[_0x3334('0x5')](_0x5f5083+':'+_0x30b1fb['id'],_0x30b1fb);DashboardEvents[_0x3334('0x5')](_0x5f5083,_0x30b1fb);_0x52de11(null);};}for(var e in events){if(events[_0x3334('0x6')](e)){var event=events[e];Dashboard[_0x3334('0x7')](e,emitEvent(event));}}module[_0x3334('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 56c5a69..c6dd141 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 _0xdeff=['api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util'];(function(_0x3aacbb,_0x2e334f){var _0x199e55=function(_0x55e3f2){while(--_0x55e3f2){_0x3aacbb['push'](_0x3aacbb['shift']());}};_0x199e55(++_0x2e334f);}(_0xdeff,0x82));var _0xfdef=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xdeff[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0xfdef('0x0'));var util=require(_0xfdef('0x1'));var logger=require('../../config/logger')(_0xfdef('0x2'));var moment=require(_0xfdef('0x3'));var BPromise=require(_0xfdef('0x4'));var rp=require(_0xfdef('0x5'));var fs=require('fs');var path=require(_0xfdef('0x6'));var rimraf=require('rimraf');var config=require(_0xfdef('0x7'));var attributes=require(_0xfdef('0x8'));module[_0xfdef('0x9')]=function(_0x4a14ab,_0x5e3669){return _0x4a14ab[_0xfdef('0xa')](_0xfdef('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbad9=['request-promise','rimraf','./dashboard.attributes','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird'];(function(_0x4be114,_0x15293d){var _0x39ac67=function(_0x4489a0){while(--_0x4489a0){_0x4be114['push'](_0x4be114['shift']());}};_0x39ac67(++_0x15293d);}(_0xbad9,0x119));var _0x9bad=function(_0x25ac0f,_0x251aa6){_0x25ac0f=_0x25ac0f-0x0;var _0x28201d=_0xbad9[_0x25ac0f];return _0x28201d;};'use strict';var _=require('lodash');var util=require(_0x9bad('0x0'));var logger=require(_0x9bad('0x1'))(_0x9bad('0x2'));var moment=require(_0x9bad('0x3'));var BPromise=require(_0x9bad('0x4'));var rp=require(_0x9bad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bad('0x6'));var config=require('../../config/environment');var attributes=require(_0x9bad('0x7'));module['exports']=function(_0x21de87,_0x130aa2){return _0x21de87[_0x9bad('0x8')](_0x9bad('0x9'),attributes,{'tableName':_0x9bad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index f1349f8..b6acee9 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 _0x22eb=['ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x15c19a,_0xd4667b){var _0x3290d9=function(_0x1c533d){while(--_0x1c533d){_0x15c19a['push'](_0x15c19a['shift']());}};_0x3290d9(++_0xd4667b);}(_0x22eb,0xaa));var _0xb22e=function(_0x289f45,_0x29674f){_0x289f45=_0x289f45-0x0;var _0x29ab12=_0x22eb[_0x289f45];return _0x29ab12;};'use strict';var _=require(_0xb22e('0x0'));var util=require(_0xb22e('0x1'));var moment=require(_0xb22e('0x2'));var BPromise=require(_0xb22e('0x3'));var rs=require(_0xb22e('0x4'));var fs=require('fs');var Redis=require(_0xb22e('0x5'));var db=require(_0xb22e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb22e('0x7'))(_0xb22e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb22e('0x9')]['http']({'port':0x232a});config[_0xb22e('0xa')]=_[_0xb22e('0xb')](config[_0xb22e('0xa')],{'host':_0xb22e('0xc'),'port':0x18eb});var socket=require(_0xb22e('0xd'))(new Redis(config[_0xb22e('0xa')]));require(_0xb22e('0xe'))[_0xb22e('0xf')](socket);function respondWithRpcPromise(_0x49168e,_0xe2620e,_0x46fea4){return new BPromise(function(_0x1f827b,_0x3836e9){return client['request'](_0x49168e,_0x46fea4)[_0xb22e('0x10')](function(_0x30b063){logger['info']('Dashboard,\x20%s,\x20%s',_0xe2620e,_0xb22e('0x11'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0xe2620e,_0xb22e('0x11'),JSON[_0xb22e('0x12')](_0x30b063));if(_0x30b063[_0xb22e('0x13')]){if(_0x30b063[_0xb22e('0x13')][_0xb22e('0x14')]===0x1f4){logger['error'](_0xb22e('0x15'),_0xe2620e,_0x30b063[_0xb22e('0x13')][_0xb22e('0x16')]);return _0x3836e9(_0x30b063['error'][_0xb22e('0x16')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0xe2620e,_0x30b063[_0xb22e('0x13')][_0xb22e('0x16')]);return _0x1f827b(_0x30b063['error'][_0xb22e('0x16')]);}else{logger[_0xb22e('0x17')](_0xb22e('0x15'),_0xe2620e,_0xb22e('0x11'));_0x1f827b(_0x30b063['result']['message']);}})[_0xb22e('0x18')](function(_0x47281e){logger[_0xb22e('0x13')]('Dashboard,\x20%s,\x20%s',_0xe2620e,_0x47281e);_0x3836e9(_0x47281e);});});} \ No newline at end of file +var _0x555c=['rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x555c,0x1f0));var _0xc555=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x555c[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xc555('0x0'));var util=require(_0xc555('0x1'));var moment=require('moment');var BPromise=require(_0xc555('0x2'));var rs=require(_0xc555('0x3'));var fs=require('fs');var Redis=require(_0xc555('0x4'));var db=require(_0xc555('0x5'))['db'];var utils=require(_0xc555('0x6'));var logger=require(_0xc555('0x7'))(_0xc555('0x8'));var config=require('../../config/environment');var jayson=require(_0xc555('0x9'));var client=jayson['client'][_0xc555('0xa')]({'port':0x232a});config['redis']=_[_0xc555('0xb')](config[_0xc555('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc555('0xd'))(new Redis(config[_0xc555('0xc')]));require(_0xc555('0xe'))['register'](socket);function respondWithRpcPromise(_0x4f596a,_0x10ffba,_0x15ba93){return new BPromise(function(_0x5b2ca6,_0xcdad29){return client[_0xc555('0xf')](_0x4f596a,_0x15ba93)[_0xc555('0x10')](function(_0x37167c){logger[_0xc555('0x11')](_0xc555('0x12'),_0x10ffba,_0xc555('0x13'));logger['debug'](_0xc555('0x14'),_0x10ffba,_0xc555('0x13'),JSON['stringify'](_0x37167c));if(_0x37167c[_0xc555('0x15')]){if(_0x37167c[_0xc555('0x15')]['code']===0x1f4){logger[_0xc555('0x15')]('Dashboard,\x20%s,\x20%s',_0x10ffba,_0x37167c[_0xc555('0x15')][_0xc555('0x16')]);return _0xcdad29(_0x37167c[_0xc555('0x15')]['message']);}logger[_0xc555('0x15')](_0xc555('0x12'),_0x10ffba,_0x37167c[_0xc555('0x15')][_0xc555('0x16')]);return _0x5b2ca6(_0x37167c[_0xc555('0x15')]['message']);}else{logger[_0xc555('0x11')](_0xc555('0x12'),_0x10ffba,_0xc555('0x13'));_0x5b2ca6(_0x37167c['result']['message']);}})[_0xc555('0x17')](function(_0x3375c6){logger[_0xc555('0x15')](_0xc555('0x12'),_0x10ffba,_0x3375c6);_0xcdad29(_0x3375c6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4a0ffbf..e5830ec 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 _0x1c26=['register','length','dashboard:','./dashboard.events','remove','update','emit','removeListener'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1c26,0x153));var _0x61c2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c26[_0x432682];return _0x463d05;};'use strict';var DashboardEvents=require(_0x61c2('0x0'));var events=['save',_0x61c2('0x1'),_0x61c2('0x2')];function createListener(_0x277f3b,_0x15657f){return function(_0xf36843){_0x15657f[_0x61c2('0x3')](_0x277f3b,_0xf36843);};}function removeListener(_0x586412,_0x2ee20b){return function(){DashboardEvents[_0x61c2('0x4')](_0x586412,_0x2ee20b);};}exports[_0x61c2('0x5')]=function(_0x3b9b7c){for(var _0xd6c0c2=0x0,_0x3858b2=events[_0x61c2('0x6')];_0xd6c0c2<_0x3858b2;_0xd6c0c2++){var _0x3fe690=events[_0xd6c0c2];var _0x1e804c=createListener(_0x61c2('0x7')+_0x3fe690,_0x3b9b7c);DashboardEvents['on'](_0x3fe690,_0x1e804c);}}; \ No newline at end of file +var _0xda3c=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','length'];(function(_0x39a879,_0x5df6d3){var _0x32c158=function(_0x305b71){while(--_0x305b71){_0x39a879['push'](_0x39a879['shift']());}};_0x32c158(++_0x5df6d3);}(_0xda3c,0xe1));var _0xcda3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xda3c[_0x57b54c];return _0x59cc19;};'use strict';var DashboardEvents=require(_0xcda3('0x0'));var events=[_0xcda3('0x1'),_0xcda3('0x2'),_0xcda3('0x3')];function createListener(_0x2c39a2,_0x2e8c81){return function(_0x36e9a8){_0x2e8c81[_0xcda3('0x4')](_0x2c39a2,_0x36e9a8);};}function removeListener(_0x15eea1,_0x745413){return function(){DashboardEvents[_0xcda3('0x5')](_0x15eea1,_0x745413);};}exports['register']=function(_0x21756b){for(var _0x188821=0x0,_0x5df442=events[_0xcda3('0x6')];_0x188821<_0x5df442;_0x188821++){var _0x3598b9=events[_0x188821];var _0x1f5a1f=createListener(_0xcda3('0x7')+_0x3598b9,_0x21756b);DashboardEvents['on'](_0x3598b9,_0x1f5a1f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e6c8263..2fe2e6e 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 _0x3bcc=['getItems','post','create','/:id/clone','clone','/:id/items','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show'];(function(_0x56a7ca,_0x4b0636){var _0x3426c1=function(_0x29cd97){while(--_0x29cd97){_0x56a7ca['push'](_0x56a7ca['shift']());}};_0x3426c1(++_0x4b0636);}(_0x3bcc,0x159));var _0xc3bc=function(_0x555373,_0x2b44f5){_0x555373=_0x555373-0x0;var _0x39299b=_0x3bcc[_0x555373];return _0x39299b;};'use strict';var multer=require(_0xc3bc('0x0'));var util=require(_0xc3bc('0x1'));var path=require(_0xc3bc('0x2'));var timeout=require(_0xc3bc('0x3'));var express=require(_0xc3bc('0x4'));var router=express['Router']();var fs_extra=require(_0xc3bc('0x5'));var auth=require(_0xc3bc('0x6'));var interaction=require(_0xc3bc('0x7'));var config=require(_0xc3bc('0x8'));var controller=require(_0xc3bc('0x9'));router[_0xc3bc('0xa')]('/',auth[_0xc3bc('0xb')](),controller[_0xc3bc('0xc')]);router[_0xc3bc('0xa')](_0xc3bc('0xd'),auth[_0xc3bc('0xb')](),controller[_0xc3bc('0xe')]);router[_0xc3bc('0xa')]('/:id/items',auth[_0xc3bc('0xb')](),controller[_0xc3bc('0xf')]);router[_0xc3bc('0x10')]('/',auth[_0xc3bc('0xb')](),controller[_0xc3bc('0x11')]);router[_0xc3bc('0x10')](_0xc3bc('0x12'),auth[_0xc3bc('0xb')](),controller[_0xc3bc('0x13')]);router['post'](_0xc3bc('0x14'),auth[_0xc3bc('0xb')](),controller['addItem']);router[_0xc3bc('0x15')](_0xc3bc('0xd'),auth[_0xc3bc('0xb')](),controller[_0xc3bc('0x16')]);router['delete'](_0xc3bc('0xd'),auth[_0xc3bc('0xb')](),controller[_0xc3bc('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa94d=['create','post','clone','addItem','put','/:id','update','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items'];(function(_0x62bbab,_0x166c3f){var _0x86bfc0=function(_0x183817){while(--_0x183817){_0x62bbab['push'](_0x62bbab['shift']());}};_0x86bfc0(++_0x166c3f);}(_0xa94d,0xa8));var _0xda94=function(_0x292b2c,_0x20d015){_0x292b2c=_0x292b2c-0x0;var _0x1abc31=_0xa94d[_0x292b2c];return _0x1abc31;};'use strict';var multer=require('multer');var util=require(_0xda94('0x0'));var path=require(_0xda94('0x1'));var timeout=require(_0xda94('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xda94('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xda94('0x4'));var config=require(_0xda94('0x5'));var controller=require(_0xda94('0x6'));router[_0xda94('0x7')]('/',auth[_0xda94('0x8')](),controller[_0xda94('0x9')]);router[_0xda94('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xda94('0xa')]);router['get'](_0xda94('0xb'),auth[_0xda94('0x8')](),controller['getItems']);router['post']('/',auth[_0xda94('0x8')](),controller[_0xda94('0xc')]);router[_0xda94('0xd')]('/:id/clone',auth[_0xda94('0x8')](),controller[_0xda94('0xe')]);router[_0xda94('0xd')]('/:id/items',auth[_0xda94('0x8')](),controller[_0xda94('0xf')]);router[_0xda94('0x10')](_0xda94('0x11'),auth[_0xda94('0x8')](),controller[_0xda94('0x12')]);router['delete'](_0xda94('0x11'),auth[_0xda94('0x8')](),controller[_0xda94('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 5df5268..afd48ba 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['squel','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x39000f,_0x295ed1){var _0x10a00c=function(_0x549b31){while(--_0x549b31){_0x39000f['push'](_0x39000f['shift']());}};_0x10a00c(++_0x295ed1);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x36f1aa,_0x3a8794){_0x36f1aa=_0x36f1aa-0x0;var _0x564802=_0xdbf5[_0x36f1aa];return _0x564802;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5dbf('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dbf('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5dbf('0x2')](_0x5dbf('0x3')),'get':function(){try{return JSON[_0x5dbf('0x4')](this[_0x5dbf('0x5')](_0x5dbf('0x6')));}catch(_0x1decd2){return[];}},'set':function(_0x3f8628){try{this[_0x5dbf('0x7')](_0x5dbf('0x6'),JSON[_0x5dbf('0x8')](_0x3f8628));}catch(_0x93e657){this['setDataValue'](_0x5dbf('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5dbf('0x9')]},'col':{'type':Sequelize[_0x5dbf('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dbf('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5dbf('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x5d17,0x114));var _0x75d1=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0x5d17[_0x18fb16];return _0x147b0d;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'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 157c7a4..39cee0c 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 _0xfb67=['HH:mm:ss','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0xfb67,0xdd));var _0x7fb6=function(_0x48e7d0,_0x22d41c){_0x48e7d0=_0x48e7d0-0x0;var _0x2bc556=_0xfb67[_0x48e7d0];return _0x2bc556;};'use strict';var emlformat=require(_0x7fb6('0x0'));var rimraf=require(_0x7fb6('0x1'));var zipdir=require(_0x7fb6('0x2'));var jsonpatch=require(_0x7fb6('0x3'));var rp=require(_0x7fb6('0x4'));var moment=require(_0x7fb6('0x5'));var BPromise=require(_0x7fb6('0x6'));var Mustache=require('mustache');var util=require(_0x7fb6('0x7'));var path=require(_0x7fb6('0x8'));var sox=require(_0x7fb6('0x9'));var csv=require(_0x7fb6('0xa'));var ejs=require(_0x7fb6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fb6('0xc'));var squel=require(_0x7fb6('0xd'));var crypto=require(_0x7fb6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fb6('0xf'));var toCsv=require(_0x7fb6('0xa'));var querystring=require('querystring');var Papa=require(_0x7fb6('0x10'));var Redis=require(_0x7fb6('0x11'));var authService=require(_0x7fb6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fb6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fb6('0x14'))(_0x7fb6('0x15'));var utils=require(_0x7fb6('0x16'));var config=require(_0x7fb6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fb6('0x18'))['db'];config[_0x7fb6('0x19')]=_[_0x7fb6('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x2e8b7c,_0x1f73cd){_0x1f73cd=_0x1f73cd||0xcc;return function(_0x5264df){if(_0x5264df){return _0x2e8b7c[_0x7fb6('0x1b')](_0x1f73cd);}return _0x2e8b7c[_0x7fb6('0x1c')](_0x1f73cd)[_0x7fb6('0x1d')]();};}function respondWithResult(_0xb4c375,_0x3bdf2e){_0x3bdf2e=_0x3bdf2e||0xc8;return function(_0x2290e6){if(_0x2290e6){return _0xb4c375[_0x7fb6('0x1c')](_0x3bdf2e)[_0x7fb6('0x1e')](_0x2290e6);}};}function respondWithFilteredResult(_0x26c3ec,_0x3b2493){return function(_0x3ef701){if(_0x3ef701){var _0x2f8b0a=typeof _0x3b2493['offset']===_0x7fb6('0x1f')&&typeof _0x3b2493[_0x7fb6('0x20')]===_0x7fb6('0x1f');var _0x169389=_0x3ef701[_0x7fb6('0x21')];var _0x2bd770=_0x2f8b0a?0x0:_0x3b2493[_0x7fb6('0x22')];var _0x5519c7=_0x2f8b0a?_0x3ef701['count']:_0x3b2493[_0x7fb6('0x22')]+_0x3b2493[_0x7fb6('0x20')];var _0x293c9d;if(_0x5519c7>=_0x169389){_0x5519c7=_0x169389;_0x293c9d=0xc8;}else{_0x293c9d=0xce;}_0x26c3ec[_0x7fb6('0x1c')](_0x293c9d);return _0x26c3ec['set'](_0x7fb6('0x23'),_0x2bd770+'-'+_0x5519c7+'/'+_0x169389)[_0x7fb6('0x1e')](_0x3ef701);}return null;};}function patchUpdates(_0x490749){return function(_0x189d11){try{jsonpatch['apply'](_0x189d11,_0x490749,!![]);}catch(_0x488cd2){return BPromise[_0x7fb6('0x24')](_0x488cd2);}return _0x189d11['save']();};}function saveUpdates(_0x51ed55,_0x5040fe){return function(_0x455916){if(_0x455916){return _0x455916['update'](_0x51ed55)[_0x7fb6('0x25')](function(_0x4a9866){return _0x4a9866;});}return null;};}function removeEntity(_0x3566a1,_0xc60290){return function(_0x37a754){if(_0x37a754){return _0x37a754[_0x7fb6('0x26')]()[_0x7fb6('0x25')](function(){_0x3566a1['status'](0xcc)[_0x7fb6('0x1d')]();});}};}function handleEntityNotFound(_0x4c7df4,_0x21a045){return function(_0x25ede1){if(!_0x25ede1){_0x4c7df4['sendStatus'](0x194);}return _0x25ede1;};}function handleError(_0x4fb049,_0x57beb1){_0x57beb1=_0x57beb1||0x1f4;return function(_0x25216a){logger[_0x7fb6('0x27')](_0x25216a[_0x7fb6('0x28')]);if(_0x25216a[_0x7fb6('0x29')]){delete _0x25216a[_0x7fb6('0x29')];}_0x4fb049[_0x7fb6('0x1c')](_0x57beb1)['send'](_0x25216a);};}exports[_0x7fb6('0x2a')]=function(_0x5251ab,_0x4221c3){var _0xa114d5={'raw':![],'where':{'id':_0x5251ab[_0x7fb6('0x2b')]['id']}},_0xbb0240={};_0xbb0240[_0x7fb6('0x2c')]=_[_0x7fb6('0x2d')](db[_0x7fb6('0x2e')][_0x7fb6('0x2f')]);_0xbb0240[_0x7fb6('0x30')]=_['keys'](_0x5251ab[_0x7fb6('0x30')]);_0xbb0240[_0x7fb6('0x31')]=_[_0x7fb6('0x32')](_0xbb0240[_0x7fb6('0x2c')],_0xbb0240[_0x7fb6('0x30')]);_0xa114d5[_0x7fb6('0x33')]=_[_0x7fb6('0x32')](_0xbb0240[_0x7fb6('0x2c')],qs[_0x7fb6('0x34')](_0x5251ab['query'][_0x7fb6('0x34')]));_0xa114d5[_0x7fb6('0x33')]=_0xa114d5[_0x7fb6('0x33')][_0x7fb6('0x35')]?_0xa114d5['attributes']:_0xbb0240['model'];if(_0x5251ab[_0x7fb6('0x30')][_0x7fb6('0x36')]){_0xa114d5[_0x7fb6('0x37')]=[{'all':!![]}];}_0xa114d5=_[_0x7fb6('0x38')]({},_0xa114d5,_0x5251ab[_0x7fb6('0x39')]);return db['DashboardItem'][_0x7fb6('0x3a')](_0xa114d5)[_0x7fb6('0x25')](handleEntityNotFound(_0x4221c3,null))[_0x7fb6('0x25')](respondWithResult(_0x4221c3,null))[_0x7fb6('0x3b')](handleError(_0x4221c3,null));};exports['destroy']=function(_0x430bfc,_0x1bb99d){return db['DashboardItem'][_0x7fb6('0x3a')]({'where':{'id':_0x430bfc['params']['id']}})[_0x7fb6('0x25')](handleEntityNotFound(_0x1bb99d,null))['then'](removeEntity(_0x1bb99d,null))[_0x7fb6('0x3b')](handleError(_0x1bb99d,null));};function widgetAttributes(_0x48ec94){try{switch(_0x48ec94[_0x7fb6('0x3c')]){case _0x7fb6('0x3d'):return[{'name':_0x7fb6('0x3e'),'value':_0x48ec94[_0x7fb6('0x3e')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x0]?_0x48ec94['attrs'][0x0]['value']:undefined)||_0x7fb6('0x40')}];case _0x7fb6('0x41'):return[{'name':_0x7fb6('0x42'),'value':_0x48ec94[_0x7fb6('0x42')]||(_0x48ec94['attrs']&&_0x48ec94['attrs'][0x0]?_0x48ec94[_0x7fb6('0x3f')][0x0]['value']:undefined)||''}];case _0x7fb6('0x43'):return[{'name':_0x7fb6('0x44'),'value':_0x48ec94[_0x7fb6('0x44')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x0]?_0x48ec94[_0x7fb6('0x3f')][0x0][_0x7fb6('0x45')]:undefined)||_0x7fb6('0x46')},{'name':'attrTimezone','value':_0x48ec94['attrTimezone']||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x1]?_0x48ec94[_0x7fb6('0x3f')][0x1][_0x7fb6('0x45')]:undefined)||_0x7fb6('0x47')},{'name':_0x7fb6('0x48'),'value':_0x48ec94[_0x7fb6('0x48')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x2]?_0x48ec94[_0x7fb6('0x3f')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x7fb6('0x49'),'value':_0x48ec94['attrMetric']||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x0]?_0x48ec94[_0x7fb6('0x3f')][0x0][_0x7fb6('0x45')]:undefined)||'total'},{'name':_0x7fb6('0x4a'),'value':_0x48ec94[_0x7fb6('0x4a')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x1]?_0x48ec94[_0x7fb6('0x3f')][0x1][_0x7fb6('0x45')]:undefined)||[]},{'name':_0x7fb6('0x48'),'value':_0x48ec94[_0x7fb6('0x48')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x2]?_0x48ec94[_0x7fb6('0x3f')][0x2]['value']:undefined)||0x14},{'name':_0x7fb6('0x4b'),'value':_0x48ec94[_0x7fb6('0x4b')]||(_0x48ec94['attrs']&&_0x48ec94[_0x7fb6('0x3f')][0x3]?_0x48ec94[_0x7fb6('0x3f')][0x3][_0x7fb6('0x45')]:undefined)||'voice'},{'name':_0x7fb6('0x4c'),'value':_0x48ec94[_0x7fb6('0x4c')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x4]?_0x48ec94[_0x7fb6('0x3f')][0x4][_0x7fb6('0x45')]:undefined)||''},{'name':_0x7fb6('0x4d'),'value':_0x48ec94[_0x7fb6('0x4d')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x5]?_0x48ec94['attrs'][0x5][_0x7fb6('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x48ec94[_0x7fb6('0x4e')]||(_0x48ec94['attrs']&&_0x48ec94[_0x7fb6('0x3f')][0x6]?_0x48ec94['attrs'][0x6][_0x7fb6('0x45')]:undefined)||''},{'name':_0x7fb6('0x4f'),'value':_0x48ec94['attrOpenchannelAccounts']||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x7]?_0x48ec94[_0x7fb6('0x3f')][0x7][_0x7fb6('0x45')]:undefined)||''},{'name':_0x7fb6('0x50'),'value':_0x48ec94[_0x7fb6('0x50')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x8]?_0x48ec94[_0x7fb6('0x3f')][0x8][_0x7fb6('0x45')]:undefined)||''},{'name':_0x7fb6('0x51'),'value':_0x48ec94[_0x7fb6('0x51')]||(_0x48ec94['attrs']&&_0x48ec94['attrs'][0x9]?_0x48ec94[_0x7fb6('0x3f')][0x9]['value']:undefined)||''}];case _0x7fb6('0x52'):case _0x7fb6('0x53'):return[{'name':_0x7fb6('0x54'),'value':_0x48ec94[_0x7fb6('0x54')]||(_0x48ec94['attrs']&&_0x48ec94[_0x7fb6('0x3f')][0x0]?_0x48ec94[_0x7fb6('0x3f')][0x0][_0x7fb6('0x45')]:undefined)||'total'},{'name':_0x7fb6('0x55'),'value':_0x48ec94[_0x7fb6('0x55')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x1]?_0x48ec94[_0x7fb6('0x3f')][0x1]['value']:undefined)||null},{'name':_0x7fb6('0x56'),'value':_0x48ec94[_0x7fb6('0x56')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x2]?_0x48ec94[_0x7fb6('0x3f')][0x2]['value']:undefined)||null},{'name':_0x7fb6('0x4a'),'value':_0x48ec94[_0x7fb6('0x4a')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x3]?_0x48ec94[_0x7fb6('0x3f')][0x3]['value']:undefined)||[]},{'name':_0x7fb6('0x4b'),'value':_0x48ec94[_0x7fb6('0x4b')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x4]?_0x48ec94[_0x7fb6('0x3f')][0x4][_0x7fb6('0x45')]:undefined)||_0x7fb6('0x57')},{'name':_0x7fb6('0x4c'),'value':_0x48ec94['attrEmailAccounts']||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x5]?_0x48ec94[_0x7fb6('0x3f')][0x5][_0x7fb6('0x45')]:undefined)||''},{'name':_0x7fb6('0x4d'),'value':_0x48ec94[_0x7fb6('0x4d')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x6]?_0x48ec94[_0x7fb6('0x3f')][0x6][_0x7fb6('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x48ec94[_0x7fb6('0x4e')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94['attrs'][0x7]?_0x48ec94[_0x7fb6('0x3f')][0x7][_0x7fb6('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x48ec94[_0x7fb6('0x4f')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x8]?_0x48ec94[_0x7fb6('0x3f')][0x8]['value']:undefined)||''},{'name':_0x7fb6('0x50'),'value':_0x48ec94[_0x7fb6('0x50')]||(_0x48ec94['attrs']&&_0x48ec94['attrs'][0x9]?_0x48ec94[_0x7fb6('0x3f')][0x9][_0x7fb6('0x45')]:undefined)||''},{'name':_0x7fb6('0x51'),'value':_0x48ec94['attrChatWebsites']||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0xa]?_0x48ec94[_0x7fb6('0x3f')][0xa][_0x7fb6('0x45')]:undefined)||''}];case _0x7fb6('0x58'):return[{'name':_0x7fb6('0x59'),'type':_0x48ec94[_0x7fb6('0x5a')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x0]?_0x48ec94[_0x7fb6('0x3f')][0x0][_0x7fb6('0x3c')]:undefined)||null,'value':_0x48ec94[_0x7fb6('0x59')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x0]?_0x48ec94[_0x7fb6('0x3f')][0x0][_0x7fb6('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x48ec94[_0x7fb6('0x5b')]||(_0x48ec94[_0x7fb6('0x3f')]&&_0x48ec94[_0x7fb6('0x3f')][0x1]?_0x48ec94[_0x7fb6('0x3f')][0x1][_0x7fb6('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x75fdc){logger['error'](_0x7fb6('0x5c'),JSON[_0x7fb6('0x5d')](_0x75fdc));return[];}}exports[_0x7fb6('0x5e')]=function(_0x3d4bc5,_0x630e30){if(_0x3d4bc5['body']){_0x3d4bc5[_0x7fb6('0x5f')][_0x7fb6('0x3f')]=widgetAttributes(_0x3d4bc5[_0x7fb6('0x5f')]);}return db[_0x7fb6('0x2e')]['create'](_0x3d4bc5[_0x7fb6('0x5f')],{})[_0x7fb6('0x25')](respondWithResult(_0x630e30,0xc9))[_0x7fb6('0x3b')](handleError(_0x630e30,null));};exports[_0x7fb6('0x60')]=function(_0x1140bd,_0x126d4f){if(_0x1140bd[_0x7fb6('0x5f')]['id']){delete _0x1140bd['body']['id'];}_0x1140bd[_0x7fb6('0x5f')][_0x7fb6('0x3f')]=widgetAttributes(_0x1140bd[_0x7fb6('0x5f')]);return db[_0x7fb6('0x2e')][_0x7fb6('0x3a')]({'where':{'id':_0x1140bd[_0x7fb6('0x2b')]['id']}})[_0x7fb6('0x25')](handleEntityNotFound(_0x126d4f,null))[_0x7fb6('0x25')](saveUpdates(_0x1140bd[_0x7fb6('0x5f')],null))[_0x7fb6('0x25')](respondWithResult(_0x126d4f,null))['catch'](handleError(_0x126d4f,null));}; \ No newline at end of file +var _0xc0f9=['moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','params','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','options','DashboardItem','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x22b142,_0x3b0dbe){var _0x299cb5=function(_0x1c5943){while(--_0x1c5943){_0x22b142['push'](_0x22b142['shift']());}};_0x299cb5(++_0x3b0dbe);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0xc0f9[_0x5093e9];return _0x4c9a22;};'use strict';var emlformat=require(_0x9c0f('0x0'));var rimraf=require(_0x9c0f('0x1'));var zipdir=require(_0x9c0f('0x2'));var jsonpatch=require(_0x9c0f('0x3'));var rp=require(_0x9c0f('0x4'));var moment=require(_0x9c0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c0f('0x6'));var util=require(_0x9c0f('0x7'));var path=require(_0x9c0f('0x8'));var sox=require('sox');var csv=require(_0x9c0f('0x9'));var ejs=require(_0x9c0f('0xa'));var fs=require('fs');var fs_extra=require(_0x9c0f('0xb'));var _=require(_0x9c0f('0xc'));var squel=require('squel');var crypto=require(_0x9c0f('0xd'));var jsforce=require(_0x9c0f('0xe'));var deskjs=require(_0x9c0f('0xf'));var toCsv=require(_0x9c0f('0x9'));var querystring=require('querystring');var Papa=require(_0x9c0f('0x10'));var Redis=require(_0x9c0f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9c0f('0x12'));var as=require(_0x9c0f('0x13'));var hardwareService=require(_0x9c0f('0x14'));var logger=require(_0x9c0f('0x15'))(_0x9c0f('0x16'));var utils=require(_0x9c0f('0x17'));var config=require(_0x9c0f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c0f('0x19'))['db'];config[_0x9c0f('0x1a')]=_[_0x9c0f('0x1b')](config[_0x9c0f('0x1a')],{'host':_0x9c0f('0x1c'),'port':0x18eb});var socket=require(_0x9c0f('0x1d'))(new Redis(config[_0x9c0f('0x1a')]));require(_0x9c0f('0x1e'))[_0x9c0f('0x1f')](socket);function respondWithStatusCode(_0x1201db,_0x38749d){_0x38749d=_0x38749d||0xcc;return function(_0x5cb198){if(_0x5cb198){return _0x1201db[_0x9c0f('0x20')](_0x38749d);}return _0x1201db['status'](_0x38749d)[_0x9c0f('0x21')]();};}function respondWithResult(_0x4d2611,_0x455a04){_0x455a04=_0x455a04||0xc8;return function(_0x307696){if(_0x307696){return _0x4d2611[_0x9c0f('0x22')](_0x455a04)['json'](_0x307696);}};}function respondWithFilteredResult(_0x58a631,_0x2274f9){return function(_0x339c47){if(_0x339c47){var _0x32d253=typeof _0x2274f9[_0x9c0f('0x23')]===_0x9c0f('0x24')&&typeof _0x2274f9['limit']===_0x9c0f('0x24');var _0x2aa887=_0x339c47[_0x9c0f('0x25')];var _0x1f3016=_0x32d253?0x0:_0x2274f9['offset'];var _0x33dff7=_0x32d253?_0x339c47[_0x9c0f('0x25')]:_0x2274f9[_0x9c0f('0x23')]+_0x2274f9[_0x9c0f('0x26')];var _0x2485dc;if(_0x33dff7>=_0x2aa887){_0x33dff7=_0x2aa887;_0x2485dc=0xc8;}else{_0x2485dc=0xce;}_0x58a631['status'](_0x2485dc);return _0x58a631['set'](_0x9c0f('0x27'),_0x1f3016+'-'+_0x33dff7+'/'+_0x2aa887)[_0x9c0f('0x28')](_0x339c47);}return null;};}function patchUpdates(_0x3b16dc){return function(_0x2f1bd6){try{jsonpatch[_0x9c0f('0x29')](_0x2f1bd6,_0x3b16dc,!![]);}catch(_0x4f5f61){return BPromise['reject'](_0x4f5f61);}return _0x2f1bd6[_0x9c0f('0x2a')]();};}function saveUpdates(_0x463ea6,_0x5c4df9){return function(_0x3c8efd){if(_0x3c8efd){return _0x3c8efd[_0x9c0f('0x2b')](_0x463ea6)[_0x9c0f('0x2c')](function(_0x1af538){return _0x1af538;});}return null;};}function removeEntity(_0x56e12e,_0x540842){return function(_0x2145e2){if(_0x2145e2){return _0x2145e2[_0x9c0f('0x2d')]()[_0x9c0f('0x2c')](function(){_0x56e12e[_0x9c0f('0x22')](0xcc)[_0x9c0f('0x21')]();});}};}function handleEntityNotFound(_0x46e1c6,_0x192799){return function(_0x257fca){if(!_0x257fca){_0x46e1c6[_0x9c0f('0x20')](0x194);}return _0x257fca;};}function handleError(_0x56a3b7,_0x3adc6b){_0x3adc6b=_0x3adc6b||0x1f4;return function(_0x497f24){logger[_0x9c0f('0x2e')](_0x497f24[_0x9c0f('0x2f')]);if(_0x497f24[_0x9c0f('0x30')]){delete _0x497f24[_0x9c0f('0x30')];}_0x56a3b7['status'](_0x3adc6b)['send'](_0x497f24);};}exports['show']=function(_0x5d6f25,_0x222d97){var _0x18b564={'raw':![],'where':{'id':_0x5d6f25[_0x9c0f('0x31')]['id']}},_0x37f059={};_0x37f059['model']=_[_0x9c0f('0x32')](db['DashboardItem'][_0x9c0f('0x33')]);_0x37f059[_0x9c0f('0x34')]=_['keys'](_0x5d6f25[_0x9c0f('0x34')]);_0x37f059[_0x9c0f('0x35')]=_['intersection'](_0x37f059[_0x9c0f('0x36')],_0x37f059[_0x9c0f('0x34')]);_0x18b564[_0x9c0f('0x37')]=_[_0x9c0f('0x38')](_0x37f059[_0x9c0f('0x36')],qs[_0x9c0f('0x39')](_0x5d6f25['query'][_0x9c0f('0x39')]));_0x18b564['attributes']=_0x18b564[_0x9c0f('0x37')][_0x9c0f('0x3a')]?_0x18b564[_0x9c0f('0x37')]:_0x37f059[_0x9c0f('0x36')];if(_0x5d6f25['query']['includeAll']){_0x18b564['include']=[{'all':!![]}];}_0x18b564=_['merge']({},_0x18b564,_0x5d6f25[_0x9c0f('0x3b')]);return db[_0x9c0f('0x3c')]['find'](_0x18b564)[_0x9c0f('0x2c')](handleEntityNotFound(_0x222d97,null))[_0x9c0f('0x2c')](respondWithResult(_0x222d97,null))[_0x9c0f('0x3d')](handleError(_0x222d97,null));};exports[_0x9c0f('0x2d')]=function(_0x75caac,_0x552b81){return db[_0x9c0f('0x3c')]['find']({'where':{'id':_0x75caac[_0x9c0f('0x31')]['id']}})[_0x9c0f('0x2c')](handleEntityNotFound(_0x552b81,null))[_0x9c0f('0x2c')](removeEntity(_0x552b81,null))[_0x9c0f('0x3d')](handleError(_0x552b81,null));};function widgetAttributes(_0x2d7aa0){try{switch(_0x2d7aa0[_0x9c0f('0x3e')]){case'iframe':return[{'name':_0x9c0f('0x3f'),'value':_0x2d7aa0['attrUrl']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x42')}];case _0x9c0f('0x43'):return[{'name':'attrPath','value':_0x2d7aa0[_0x9c0f('0x44')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0]['value']:undefined)||''}];case _0x9c0f('0x45'):return[{'name':'attrHourFormat','value':_0x2d7aa0[_0x9c0f('0x46')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x47')},{'name':_0x9c0f('0x48'),'value':_0x2d7aa0[_0x9c0f('0x48')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x49')},{'name':_0x9c0f('0x4a'),'value':_0x2d7aa0[_0x9c0f('0x4a')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x2]?_0x2d7aa0['attrs'][0x2][_0x9c0f('0x41')]:undefined)||0xc}];case _0x9c0f('0x4b'):return[{'name':_0x9c0f('0x4c'),'value':_0x2d7aa0['attrMetric']||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0]['value']:undefined)||_0x9c0f('0x4d')},{'name':'attrVoiceQueues','value':_0x2d7aa0[_0x9c0f('0x4e')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x2d7aa0[_0x9c0f('0x4a')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x2]?_0x2d7aa0[_0x9c0f('0x40')][0x2][_0x9c0f('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x2d7aa0['attrChannel']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x3]?_0x2d7aa0[_0x9c0f('0x40')][0x3][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4f')},{'name':_0x9c0f('0x50'),'value':_0x2d7aa0[_0x9c0f('0x50')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x4]?_0x2d7aa0[_0x9c0f('0x40')][0x4]['value']:undefined)||''},{'name':_0x9c0f('0x51'),'value':_0x2d7aa0[_0x9c0f('0x51')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x5]?_0x2d7aa0[_0x9c0f('0x40')][0x5][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x52'),'value':_0x2d7aa0['attrSmsAccounts']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x6]?_0x2d7aa0[_0x9c0f('0x40')][0x6][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x53'),'value':_0x2d7aa0[_0x9c0f('0x53')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x7]?_0x2d7aa0[_0x9c0f('0x40')][0x7][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x54'),'value':_0x2d7aa0[_0x9c0f('0x54')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x8]?_0x2d7aa0[_0x9c0f('0x40')][0x8][_0x9c0f('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2d7aa0[_0x9c0f('0x55')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x9]?_0x2d7aa0['attrs'][0x9][_0x9c0f('0x41')]:undefined)||''}];case _0x9c0f('0x56'):case _0x9c0f('0x57'):return[{'name':_0x9c0f('0x58'),'value':_0x2d7aa0[_0x9c0f('0x58')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4d')},{'name':_0x9c0f('0x59'),'value':_0x2d7aa0[_0x9c0f('0x59')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2d7aa0[_0x9c0f('0x5a')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x2]?_0x2d7aa0[_0x9c0f('0x40')][0x2][_0x9c0f('0x41')]:undefined)||null},{'name':_0x9c0f('0x4e'),'value':_0x2d7aa0['attrVoiceQueues']||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x3]?_0x2d7aa0[_0x9c0f('0x40')][0x3][_0x9c0f('0x41')]:undefined)||[]},{'name':_0x9c0f('0x5b'),'value':_0x2d7aa0[_0x9c0f('0x5b')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x4]?_0x2d7aa0['attrs'][0x4][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4f')},{'name':_0x9c0f('0x50'),'value':_0x2d7aa0[_0x9c0f('0x50')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x5]?_0x2d7aa0[_0x9c0f('0x40')][0x5][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x51'),'value':_0x2d7aa0[_0x9c0f('0x51')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x6]?_0x2d7aa0[_0x9c0f('0x40')][0x6][_0x9c0f('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2d7aa0[_0x9c0f('0x52')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x7]?_0x2d7aa0[_0x9c0f('0x40')][0x7][_0x9c0f('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2d7aa0[_0x9c0f('0x53')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x8]?_0x2d7aa0['attrs'][0x8][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x54'),'value':_0x2d7aa0[_0x9c0f('0x54')]||(_0x2d7aa0['attrs']&&_0x2d7aa0['attrs'][0x9]?_0x2d7aa0[_0x9c0f('0x40')][0x9][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x55'),'value':_0x2d7aa0[_0x9c0f('0x55')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0xa]?_0x2d7aa0[_0x9c0f('0x40')][0xa][_0x9c0f('0x41')]:undefined)||''}];case _0x9c0f('0x5c'):return[{'name':_0x9c0f('0x5d'),'type':_0x2d7aa0[_0x9c0f('0x5e')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0][_0x9c0f('0x3e')]:undefined)||null,'value':_0x2d7aa0[_0x9c0f('0x5d')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0][_0x9c0f('0x41')]:undefined)||null},{'name':_0x9c0f('0x5f'),'value':_0x2d7aa0[_0x9c0f('0x5f')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x5df9a6){logger['error'](_0x9c0f('0x60'),JSON[_0x9c0f('0x61')](_0x5df9a6));return[];}}exports[_0x9c0f('0x62')]=function(_0x40890b,_0x53abc8){if(_0x40890b[_0x9c0f('0x63')]){_0x40890b[_0x9c0f('0x63')][_0x9c0f('0x40')]=widgetAttributes(_0x40890b[_0x9c0f('0x63')]);}return db[_0x9c0f('0x3c')][_0x9c0f('0x62')](_0x40890b['body'],{})[_0x9c0f('0x2c')](respondWithResult(_0x53abc8,0xc9))[_0x9c0f('0x3d')](handleError(_0x53abc8,null));};exports[_0x9c0f('0x2b')]=function(_0x14e1be,_0xc0b6b5){if(_0x14e1be[_0x9c0f('0x63')]['id']){delete _0x14e1be[_0x9c0f('0x63')]['id'];}_0x14e1be[_0x9c0f('0x63')][_0x9c0f('0x40')]=widgetAttributes(_0x14e1be[_0x9c0f('0x63')]);return db['DashboardItem'][_0x9c0f('0x64')]({'where':{'id':_0x14e1be[_0x9c0f('0x31')]['id']}})[_0x9c0f('0x2c')](handleEntityNotFound(_0xc0b6b5,null))[_0x9c0f('0x2c')](saveUpdates(_0x14e1be[_0x9c0f('0x63')],null))[_0x9c0f('0x2c')](respondWithResult(_0xc0b6b5,null))[_0x9c0f('0x3d')](handleError(_0xc0b6b5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index af69022..54eb67b 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 _0x9c6f=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x58ed76,_0x10b2cb){var _0x4cc2da=function(_0x4762d9){while(--_0x4762d9){_0x58ed76['push'](_0x58ed76['shift']());}};_0x4cc2da(++_0x10b2cb);}(_0x9c6f,0x1a8));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf9c6('0x0'));var DashboardItem=require(_0xf9c6('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf9c6('0x2'),'afterUpdate':_0xf9c6('0x3'),'afterDestroy':_0xf9c6('0x4')};function emitEvent(_0x4763ea){return function(_0x5ac956,_0x261168,_0x34bf07){DashboardItemEvents[_0xf9c6('0x5')](_0x4763ea+':'+_0x5ac956['id'],_0x5ac956);DashboardItemEvents[_0xf9c6('0x5')](_0x4763ea,_0x5ac956);_0x34bf07(null);};}for(var e in events){if(events[_0xf9c6('0x6')](e)){var event=events[e];DashboardItem[_0xf9c6('0x7')](e,emitEvent(event));}}module[_0xf9c6('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x3512=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3512,0xf9));var _0x2351=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3512[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x2351('0x0'));var DashboardItem=require(_0x2351('0x1'))['db'][_0x2351('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2351('0x3')](0x0);var events={'afterCreate':_0x2351('0x4'),'afterUpdate':_0x2351('0x5'),'afterDestroy':_0x2351('0x6')};function emitEvent(_0x1908d5){return function(_0x3fa655,_0x250295,_0x210b74){DashboardItemEvents['emit'](_0x1908d5+':'+_0x3fa655['id'],_0x3fa655);DashboardItemEvents[_0x2351('0x7')](_0x1908d5,_0x3fa655);_0x210b74(null);};}for(var e in events){if(events[_0x2351('0x8')](e)){var event=events[e];DashboardItem[_0x2351('0x9')](e,emitEvent(event));}}module[_0x2351('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 3fb981a..ece4559 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 _0x0af7=['DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x0af7,0x17b));var _0x70af=function(_0x44fe9a,_0x1f9b56){_0x44fe9a=_0x44fe9a-0x0;var _0x1a4a2a=_0x0af7[_0x44fe9a];return _0x1a4a2a;};'use strict';var _=require(_0x70af('0x0'));var util=require('util');var logger=require(_0x70af('0x1'))(_0x70af('0x2'));var moment=require(_0x70af('0x3'));var BPromise=require(_0x70af('0x4'));var rp=require(_0x70af('0x5'));var fs=require('fs');var path=require(_0x70af('0x6'));var rimraf=require('rimraf');var config=require(_0x70af('0x7'));var attributes=require(_0x70af('0x8'));module[_0x70af('0x9')]=function(_0x44ea51,_0x5b5aa5){return _0x44ea51[_0x70af('0xa')](_0x70af('0xb'),attributes,{'tableName':_0x70af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1320=['moment','bluebird','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x3c3698,_0xa0bf08){var _0x4e6637=function(_0x1fc9a4){while(--_0x1fc9a4){_0x3c3698['push'](_0x3c3698['shift']());}};_0x4e6637(++_0xa0bf08);}(_0x1320,0x128));var _0x0132=function(_0x4d6d9a,_0xa022de){_0x4d6d9a=_0x4d6d9a-0x0;var _0x2029f8=_0x1320[_0x4d6d9a];return _0x2029f8;};'use strict';var _=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var logger=require(_0x0132('0x2'))(_0x0132('0x3'));var moment=require(_0x0132('0x4'));var BPromise=require(_0x0132('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0132('0x6'));var config=require(_0x0132('0x7'));var attributes=require(_0x0132('0x8'));module[_0x0132('0x9')]=function(_0x1a2a51,_0x34408b){return _0x1a2a51['define'](_0x0132('0xa'),attributes,{'tableName':_0x0132('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7ace95a..86d8a52 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 _0x47ff=['../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','code','error','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x163ac5,_0x269661){var _0x2e6fb1=function(_0x919a3c){while(--_0x919a3c){_0x163ac5['push'](_0x163ac5['shift']());}};_0x2e6fb1(++_0x269661);}(_0x47ff,0x107));var _0xf47f=function(_0x2d285a,_0x3404d6){_0x2d285a=_0x2d285a-0x0;var _0x438199=_0x47ff[_0x2d285a];return _0x438199;};'use strict';var _=require(_0xf47f('0x0'));var util=require(_0xf47f('0x1'));var moment=require(_0xf47f('0x2'));var BPromise=require(_0xf47f('0x3'));var rs=require(_0xf47f('0x4'));var fs=require('fs');var Redis=require(_0xf47f('0x5'));var db=require(_0xf47f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf47f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf47f('0x8')][_0xf47f('0x9')]({'port':0x232a});config[_0xf47f('0xa')]=_[_0xf47f('0xb')](config[_0xf47f('0xa')],{'host':_0xf47f('0xc'),'port':0x18eb});var socket=require(_0xf47f('0xd'))(new Redis(config['redis']));require(_0xf47f('0xe'))['register'](socket);function respondWithRpcPromise(_0x7852dc,_0x355f39,_0x270920){return new BPromise(function(_0x2f0d93,_0x31b468){return client[_0xf47f('0xf')](_0x7852dc,_0x270920)[_0xf47f('0x10')](function(_0x52d9df){logger[_0xf47f('0x11')]('DashboardItem,\x20%s,\x20%s',_0x355f39,_0xf47f('0x12'));logger[_0xf47f('0x13')](_0xf47f('0x14'),_0x355f39,_0xf47f('0x12'),JSON['stringify'](_0x52d9df));if(_0x52d9df['error']){if(_0x52d9df['error'][_0xf47f('0x15')]===0x1f4){logger[_0xf47f('0x16')]('DashboardItem,\x20%s,\x20%s',_0x355f39,_0x52d9df['error'][_0xf47f('0x17')]);return _0x31b468(_0x52d9df['error']['message']);}logger[_0xf47f('0x16')](_0xf47f('0x18'),_0x355f39,_0x52d9df[_0xf47f('0x16')]['message']);return _0x2f0d93(_0x52d9df[_0xf47f('0x16')]['message']);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x355f39,_0xf47f('0x12'));_0x2f0d93(_0x52d9df[_0xf47f('0x19')]['message']);}})[_0xf47f('0x1a')](function(_0x3ab5ce){logger[_0xf47f('0x16')]('DashboardItem,\x20%s,\x20%s',_0x355f39,_0x3ab5ce);_0x31b468(_0x3ab5ce);});});} \ No newline at end of file +var _0x7d3c=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3099e4,_0x5520d4){var _0x398197=function(_0x2f80b5){while(--_0x2f80b5){_0x3099e4['push'](_0x3099e4['shift']());}};_0x398197(++_0x5520d4);}(_0x7d3c,0x1c7));var _0xc7d3=function(_0xe2cbd3,_0x678694){_0xe2cbd3=_0xe2cbd3-0x0;var _0x5155e3=_0x7d3c[_0xe2cbd3];return _0x5155e3;};'use strict';var _=require(_0xc7d3('0x0'));var util=require(_0xc7d3('0x1'));var moment=require(_0xc7d3('0x2'));var BPromise=require(_0xc7d3('0x3'));var rs=require(_0xc7d3('0x4'));var fs=require('fs');var Redis=require(_0xc7d3('0x5'));var db=require(_0xc7d3('0x6'))['db'];var utils=require(_0xc7d3('0x7'));var logger=require(_0xc7d3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7d3('0x9')]['http']({'port':0x232a});config[_0xc7d3('0xa')]=_['defaults'](config[_0xc7d3('0xa')],{'host':_0xc7d3('0xb'),'port':0x18eb});var socket=require(_0xc7d3('0xc'))(new Redis(config['redis']));require(_0xc7d3('0xd'))['register'](socket);function respondWithRpcPromise(_0x215952,_0x2daf7f,_0x3c1d80){return new BPromise(function(_0x312e9d,_0x341aa5){return client[_0xc7d3('0xe')](_0x215952,_0x3c1d80)[_0xc7d3('0xf')](function(_0x15acf4){logger[_0xc7d3('0x10')](_0xc7d3('0x11'),_0x2daf7f,'request\x20sent');logger['debug'](_0xc7d3('0x12'),_0x2daf7f,_0xc7d3('0x13'),JSON[_0xc7d3('0x14')](_0x15acf4));if(_0x15acf4['error']){if(_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x16')]===0x1f4){logger[_0xc7d3('0x15')](_0xc7d3('0x11'),_0x2daf7f,_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x17')]);return _0x341aa5(_0x15acf4['error'][_0xc7d3('0x17')]);}logger['error'](_0xc7d3('0x11'),_0x2daf7f,_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x17')]);return _0x312e9d(_0x15acf4[_0xc7d3('0x15')][_0xc7d3('0x17')]);}else{logger[_0xc7d3('0x10')]('DashboardItem,\x20%s,\x20%s',_0x2daf7f,'request\x20sent');_0x312e9d(_0x15acf4['result'][_0xc7d3('0x17')]);}})[_0xc7d3('0x18')](function(_0x2d7041){logger['error'](_0xc7d3('0x11'),_0x2daf7f,_0x2d7041);_0x341aa5(_0x2d7041);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c1c3b47..8812b19 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 _0xd3db=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','remove'];(function(_0x5877b7,_0x57d044){var _0x3a22af=function(_0x44961b){while(--_0x44961b){_0x5877b7['push'](_0x5877b7['shift']());}};_0x3a22af(++_0x57d044);}(_0xd3db,0x1cc));var _0xbd3d=function(_0x49d851,_0x5c2022){_0x49d851=_0x49d851-0x0;var _0x5366d5=_0xd3db[_0x49d851];return _0x5366d5;};'use strict';var DashboardItemEvents=require(_0xbd3d('0x0'));var events=['save',_0xbd3d('0x1'),'update'];function createListener(_0x3b90b2,_0x305c93){return function(_0x5b7fe1){_0x305c93[_0xbd3d('0x2')](_0x3b90b2,_0x5b7fe1);};}function removeListener(_0x35143e,_0x3df806){return function(){DashboardItemEvents[_0xbd3d('0x3')](_0x35143e,_0x3df806);};}exports[_0xbd3d('0x4')]=function(_0x444d68){for(var _0x15aeb9=0x0,_0x11d58b=events['length'];_0x15aeb9<_0x11d58b;_0x15aeb9++){var _0x34f03d=events[_0x15aeb9];var _0x435419=createListener(_0xbd3d('0x5')+_0x34f03d,_0x444d68);DashboardItemEvents['on'](_0x34f03d,_0x435419);}}; \ No newline at end of file +var _0x2e06=['remove','update','emit','register','length','./dashboardItem.events','save'];(function(_0x23d137,_0x862a9f){var _0xf3acc1=function(_0x211173){while(--_0x211173){_0x23d137['push'](_0x23d137['shift']());}};_0xf3acc1(++_0x862a9f);}(_0x2e06,0x91));var _0x62e0=function(_0x37451c,_0x515e3e){_0x37451c=_0x37451c-0x0;var _0x485c57=_0x2e06[_0x37451c];return _0x485c57;};'use strict';var DashboardItemEvents=require(_0x62e0('0x0'));var events=[_0x62e0('0x1'),_0x62e0('0x2'),_0x62e0('0x3')];function createListener(_0x4df2ae,_0x4a581e){return function(_0x77201f){_0x4a581e[_0x62e0('0x4')](_0x4df2ae,_0x77201f);};}function removeListener(_0x478ef6,_0x8390a8){return function(){DashboardItemEvents['removeListener'](_0x478ef6,_0x8390a8);};}exports[_0x62e0('0x5')]=function(_0x466e69){for(var _0x2b5de3=0x0,_0xe74e05=events[_0x62e0('0x6')];_0x2b5de3<_0xe74e05;_0x2b5de3++){var _0x5f360d=events[_0x2b5de3];var _0x330281=createListener('dashboardItem:'+_0x5f360d,_0x466e69);DashboardItemEvents['on'](_0x5f360d,_0x330281);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2185bc5..9a96a27 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 _0x8e25=['exports','connect-timeout','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8e25,0x169));var _0x58e2=function(_0x87f25b,_0xbb1bda){_0x87f25b=_0x87f25b-0x0;var _0x437140=_0x8e25[_0x87f25b];return _0x437140;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x58e2('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x58e2('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x58e2('0x2'));var controller=require('./dashboardItem.controller');router[_0x58e2('0x3')](_0x58e2('0x4'),auth[_0x58e2('0x5')](),controller[_0x58e2('0x6')]);router[_0x58e2('0x7')]('/',auth[_0x58e2('0x5')](),controller['create']);router[_0x58e2('0x8')]('/:id',auth[_0x58e2('0x5')](),controller['update']);router[_0x58e2('0x9')](_0x58e2('0x4'),auth[_0x58e2('0x5')](),controller[_0x58e2('0xa')]);module[_0x58e2('0xb')]=router; \ No newline at end of file +var _0x7d74=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put'];(function(_0x14ce3d,_0x58dde7){var _0x61eecd=function(_0x164fde){while(--_0x164fde){_0x14ce3d['push'](_0x14ce3d['shift']());}};_0x61eecd(++_0x58dde7);}(_0x7d74,0x1e9));var _0x47d7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7d74[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x47d7('0x0'));var util=require(_0x47d7('0x1'));var path=require(_0x47d7('0x2'));var timeout=require(_0x47d7('0x3'));var express=require(_0x47d7('0x4'));var router=express[_0x47d7('0x5')]();var fs_extra=require(_0x47d7('0x6'));var auth=require(_0x47d7('0x7'));var interaction=require(_0x47d7('0x8'));var config=require(_0x47d7('0x9'));var controller=require(_0x47d7('0xa'));router[_0x47d7('0xb')]('/:id',auth[_0x47d7('0xc')](),controller[_0x47d7('0xd')]);router[_0x47d7('0xe')]('/',auth[_0x47d7('0xc')](),controller[_0x47d7('0xf')]);router[_0x47d7('0x10')](_0x47d7('0x11'),auth[_0x47d7('0xc')](),controller[_0x47d7('0x12')]);router[_0x47d7('0x13')](_0x47d7('0x11'),auth[_0x47d7('0xc')](),controller[_0x47d7('0x14')]);module[_0x47d7('0x15')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 06b02ef..ccb4bca 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 _0x88bf=['second','STRING','ENUM','first'];(function(_0x1aa297,_0x7b3da7){var _0x45831a=function(_0x37edb1){while(--_0x37edb1){_0x1aa297['push'](_0x1aa297['shift']());}};_0x45831a(++_0x7b3da7);}(_0x88bf,0x99));var _0xf88b=function(_0x5adb18,_0x222326){_0x5adb18=_0x5adb18-0x0;var _0x420c98=_0x88bf[_0x5adb18];return _0x420c98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf88b('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0xf88b('0x1')](_0xf88b('0x2'),_0xf88b('0x3'),'third'),'allowNull':![],'defaultValue':_0xf88b('0x2')},'description':{'type':Sequelize[_0xf88b('0x0')]}}; \ No newline at end of file +var _0xb053=['sequelize','exports','STRING','ENUM','first','second'];(function(_0x326a44,_0x41c393){var _0x218e10=function(_0x4ef0a6){while(--_0x4ef0a6){_0x326a44['push'](_0x326a44['shift']());}};_0x218e10(++_0x41c393);}(_0xb053,0x96));var _0x3b05=function(_0x58ef8c,_0x305ab2){_0x58ef8c=_0x58ef8c-0x0;var _0x26fca6=_0xb053[_0x58ef8c];return _0x26fca6;};'use strict';var Sequelize=require(_0x3b05('0x0'));module[_0x3b05('0x1')]={'name':{'type':Sequelize[_0x3b05('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3b05('0x3')](_0x3b05('0x4'),_0x3b05('0x5'),'third'),'allowNull':![],'defaultValue':_0x3b05('0x4')},'description':{'type':Sequelize[_0x3b05('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1f43491..ad96063 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 _0x8b51=['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','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','Dispositions','UserProfileResource','status','error','name','index','map','Disposition','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash'];(function(_0x41805e,_0x24314d){var _0x4726aa=function(_0x5ee868){while(--_0x5ee868){_0x41805e['push'](_0x41805e['shift']());}};_0x4726aa(++_0x24314d);}(_0x8b51,0xef));var _0x18b5=function(_0x18cfff,_0x59b362){_0x18cfff=_0x18cfff-0x0;var _0x245ef6=_0x8b51[_0x18cfff];return _0x245ef6;};'use strict';var emlformat=require(_0x18b5('0x0'));var rimraf=require(_0x18b5('0x1'));var zipdir=require(_0x18b5('0x2'));var jsonpatch=require(_0x18b5('0x3'));var rp=require(_0x18b5('0x4'));var moment=require(_0x18b5('0x5'));var BPromise=require(_0x18b5('0x6'));var Mustache=require('mustache');var util=require(_0x18b5('0x7'));var path=require(_0x18b5('0x8'));var sox=require(_0x18b5('0x9'));var csv=require('to-csv');var ejs=require(_0x18b5('0xa'));var fs=require('fs');var fs_extra=require(_0x18b5('0xb'));var _=require(_0x18b5('0xc'));var squel=require(_0x18b5('0xd'));var crypto=require(_0x18b5('0xe'));var jsforce=require(_0x18b5('0xf'));var deskjs=require(_0x18b5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x18b5('0x11'));var Papa=require(_0x18b5('0x12'));var Redis=require(_0x18b5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x18b5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18b5('0x15'));var logger=require(_0x18b5('0x16'))(_0x18b5('0x17'));var utils=require(_0x18b5('0x18'));var config=require(_0x18b5('0x19'));var licenseUtil=require(_0x18b5('0x1a'));var db=require(_0x18b5('0x1b'))['db'];function respondWithStatusCode(_0x3cece7,_0x4204a1){_0x4204a1=_0x4204a1||0xcc;return function(_0x38623f){if(_0x38623f){return _0x3cece7['sendStatus'](_0x4204a1);}return _0x3cece7['status'](_0x4204a1)[_0x18b5('0x1c')]();};}function respondWithResult(_0x35bb8c,_0x5710da){_0x5710da=_0x5710da||0xc8;return function(_0x4c7d75){if(_0x4c7d75){return _0x35bb8c['status'](_0x5710da)[_0x18b5('0x1d')](_0x4c7d75);}};}function respondWithFilteredResult(_0x3fc58a,_0x4e2414){return function(_0x51e6b4){if(_0x51e6b4){var _0x426662=typeof _0x4e2414[_0x18b5('0x1e')]===_0x18b5('0x1f')&&typeof _0x4e2414[_0x18b5('0x20')]===_0x18b5('0x1f');var _0x336d8b=_0x51e6b4[_0x18b5('0x21')];var _0x3640f7=_0x426662?0x0:_0x4e2414[_0x18b5('0x1e')];var _0x1336ae=_0x426662?_0x51e6b4[_0x18b5('0x21')]:_0x4e2414[_0x18b5('0x1e')]+_0x4e2414[_0x18b5('0x20')];var _0x5e3062;if(_0x1336ae>=_0x336d8b){_0x1336ae=_0x336d8b;_0x5e3062=0xc8;}else{_0x5e3062=0xce;}_0x3fc58a['status'](_0x5e3062);return _0x3fc58a['set'](_0x18b5('0x22'),_0x3640f7+'-'+_0x1336ae+'/'+_0x336d8b)[_0x18b5('0x1d')](_0x51e6b4);}return null;};}function patchUpdates(_0x513b11){return function(_0x1b004d){try{jsonpatch[_0x18b5('0x23')](_0x1b004d,_0x513b11,!![]);}catch(_0x165a4f){return BPromise['reject'](_0x165a4f);}return _0x1b004d[_0x18b5('0x24')]();};}function saveUpdates(_0x4d79a5,_0xc1044){return function(_0x48d96c){if(_0x48d96c){return _0x48d96c[_0x18b5('0x25')](_0x4d79a5)['then'](function(_0x55a256){return _0x55a256;});}return null;};}function removeEntity(_0x2778eb,_0x3e11c1){return function(_0x33b606){if(_0x33b606){return _0x33b606[_0x18b5('0x26')]()[_0x18b5('0x27')](function(){var _0x2474d2=_0x33b606[_0x18b5('0x28')]({'plain':!![]});var _0x1c8acc=_0x18b5('0x29');return db[_0x18b5('0x2a')][_0x18b5('0x26')]({'where':{'type':_0x1c8acc,'resourceId':_0x2474d2['id']}})[_0x18b5('0x27')](function(){return _0x33b606;});})[_0x18b5('0x27')](function(){_0x2778eb[_0x18b5('0x2b')](0xcc)[_0x18b5('0x1c')]();});}};}function handleEntityNotFound(_0x16167c,_0x229ae7){return function(_0x4f9422){if(!_0x4f9422){_0x16167c['sendStatus'](0x194);}return _0x4f9422;};}function handleError(_0x4d4628,_0x3a7da6){_0x3a7da6=_0x3a7da6||0x1f4;return function(_0x495348){logger[_0x18b5('0x2c')](_0x495348['stack']);if(_0x495348[_0x18b5('0x2d')]){delete _0x495348[_0x18b5('0x2d')];}_0x4d4628[_0x18b5('0x2b')](_0x3a7da6)['send'](_0x495348);};}exports[_0x18b5('0x2e')]=function(_0x133647,_0x1bae9c){var _0x1854c0={},_0x2639c9={},_0x315b54={'count':0x0,'rows':[]};var _0x5941d2=_[_0x18b5('0x2f')](db[_0x18b5('0x30')][_0x18b5('0x31')],function(_0x3a703f){return{'name':_0x3a703f[_0x18b5('0x32')],'type':_0x3a703f[_0x18b5('0x33')]['key']};});_0x2639c9[_0x18b5('0x34')]=_[_0x18b5('0x2f')](_0x5941d2,_0x18b5('0x2d'));_0x2639c9['query']=_[_0x18b5('0x35')](_0x133647[_0x18b5('0x36')]);_0x2639c9[_0x18b5('0x37')]=_[_0x18b5('0x38')](_0x2639c9[_0x18b5('0x34')],_0x2639c9[_0x18b5('0x36')]);_0x1854c0['attributes']=_['intersection'](_0x2639c9[_0x18b5('0x34')],qs[_0x18b5('0x39')](_0x133647[_0x18b5('0x36')][_0x18b5('0x39')]));_0x1854c0[_0x18b5('0x3a')]=_0x1854c0[_0x18b5('0x3a')]['length']?_0x1854c0[_0x18b5('0x3a')]:_0x2639c9[_0x18b5('0x34')];if(!_0x133647['query'][_0x18b5('0x3b')](_0x18b5('0x3c'))){_0x1854c0[_0x18b5('0x20')]=qs[_0x18b5('0x20')](_0x133647[_0x18b5('0x36')][_0x18b5('0x20')]);_0x1854c0[_0x18b5('0x1e')]=qs[_0x18b5('0x1e')](_0x133647[_0x18b5('0x36')][_0x18b5('0x1e')]);}_0x1854c0[_0x18b5('0x3d')]=qs['sort'](_0x133647['query']['sort']);_0x1854c0[_0x18b5('0x3e')]=qs[_0x18b5('0x37')](_['pick'](_0x133647[_0x18b5('0x36')],_0x2639c9['filters']),_0x5941d2);if(_0x133647[_0x18b5('0x36')]['filter']){_0x1854c0[_0x18b5('0x3e')]=_[_0x18b5('0x3f')](_0x1854c0[_0x18b5('0x3e')],{'$or':_[_0x18b5('0x2f')](_0x5941d2,function(_0x1d036b){if(_0x1d036b['type']!==_0x18b5('0x40')){var _0x48c483={};_0x48c483[_0x1d036b[_0x18b5('0x2d')]]={'$like':'%'+_0x133647[_0x18b5('0x36')][_0x18b5('0x41')]+'%'};return _0x48c483;}})});}_0x1854c0=_[_0x18b5('0x3f')]({},_0x1854c0,_0x133647[_0x18b5('0x42')]);var _0x29dde8={'where':_0x1854c0[_0x18b5('0x3e')]};return db[_0x18b5('0x30')][_0x18b5('0x21')](_0x29dde8)['then'](function(_0x24c2ff){_0x315b54[_0x18b5('0x21')]=_0x24c2ff;if(_0x133647[_0x18b5('0x36')][_0x18b5('0x43')]){_0x1854c0[_0x18b5('0x44')]=[{'all':!![]}];}return db[_0x18b5('0x30')][_0x18b5('0x45')](_0x1854c0);})[_0x18b5('0x27')](function(_0x6cee96){_0x315b54[_0x18b5('0x46')]=_0x6cee96;return _0x315b54;})['then'](respondWithFilteredResult(_0x1bae9c,_0x1854c0))[_0x18b5('0x47')](handleError(_0x1bae9c,null));};exports[_0x18b5('0x48')]=function(_0x1263ba,_0xbbd678){var _0x37f2cb={'raw':!![],'where':{'id':_0x1263ba[_0x18b5('0x49')]['id']}},_0x57bf45={};_0x57bf45[_0x18b5('0x34')]=_['keys'](db[_0x18b5('0x30')][_0x18b5('0x31')]);_0x57bf45[_0x18b5('0x36')]=_[_0x18b5('0x35')](_0x1263ba['query']);_0x57bf45['filters']=_[_0x18b5('0x38')](_0x57bf45[_0x18b5('0x34')],_0x57bf45[_0x18b5('0x36')]);_0x37f2cb['attributes']=_[_0x18b5('0x38')](_0x57bf45[_0x18b5('0x34')],qs['fields'](_0x1263ba['query']['fields']));_0x37f2cb[_0x18b5('0x3a')]=_0x37f2cb[_0x18b5('0x3a')][_0x18b5('0x4a')]?_0x37f2cb[_0x18b5('0x3a')]:_0x57bf45[_0x18b5('0x34')];if(_0x1263ba['query']['includeAll']){_0x37f2cb[_0x18b5('0x44')]=[{'all':!![]}];}_0x37f2cb=_[_0x18b5('0x3f')]({},_0x37f2cb,_0x1263ba['options']);return db[_0x18b5('0x30')][_0x18b5('0x4b')](_0x37f2cb)[_0x18b5('0x27')](handleEntityNotFound(_0xbbd678,null))[_0x18b5('0x27')](respondWithResult(_0xbbd678,null))['catch'](handleError(_0xbbd678,null));};exports[_0x18b5('0x4c')]=function(_0x27abdf,_0x434783){return db[_0x18b5('0x30')][_0x18b5('0x4c')](_0x27abdf[_0x18b5('0x4d')],{})[_0x18b5('0x27')](function(_0xa95738){var _0x5e1a49=_0x27abdf['user']['get']({'plain':!![]});if(!_0x5e1a49)throw new Error(_0x18b5('0x4e'));if(_0x5e1a49['role']===_0x18b5('0x4f')){var _0x3bb59b=_0xa95738['get']({'plain':!![]});var _0x1de0f8='Dispositions';return db[_0x18b5('0x50')][_0x18b5('0x4b')]({'where':{'name':_0x1de0f8,'userProfileId':_0x5e1a49[_0x18b5('0x51')]},'raw':!![]})[_0x18b5('0x27')](function(_0x5f0787){if(_0x5f0787&&_0x5f0787[_0x18b5('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x3bb59b[_0x18b5('0x2d')],'resourceId':_0x3bb59b['id'],'type':_0x5f0787['name'],'sectionId':_0x5f0787['id']},{})['then'](function(){return _0xa95738;});}else{return _0xa95738;}})[_0x18b5('0x47')](function(_0x243da2){logger['error'](_0x18b5('0x53'),_0x243da2);throw _0x243da2;});}return _0xa95738;})[_0x18b5('0x27')](respondWithResult(_0x434783,0xc9))[_0x18b5('0x47')](handleError(_0x434783,null));};exports['update']=function(_0x4dfd58,_0x19e55e){if(_0x4dfd58[_0x18b5('0x4d')]['id']){delete _0x4dfd58['body']['id'];}return db[_0x18b5('0x30')][_0x18b5('0x4b')]({'where':{'id':_0x4dfd58[_0x18b5('0x49')]['id']}})[_0x18b5('0x27')](handleEntityNotFound(_0x19e55e,null))[_0x18b5('0x27')](saveUpdates(_0x4dfd58[_0x18b5('0x4d')],null))[_0x18b5('0x27')](respondWithResult(_0x19e55e,null))[_0x18b5('0x47')](handleError(_0x19e55e,null));};exports[_0x18b5('0x26')]=function(_0x128aee,_0x48c37d){return db[_0x18b5('0x30')]['find']({'where':{'id':_0x128aee['params']['id']}})[_0x18b5('0x27')](handleEntityNotFound(_0x48c37d,null))[_0x18b5('0x27')](removeEntity(_0x48c37d,null))[_0x18b5('0x47')](handleError(_0x48c37d,null));}; \ No newline at end of file +var _0x0e4b=['update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','get','UserProfileResource','error','name','send','index','Disposition','fieldName','type','key','model','map','query','keys','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','findAll','rows','params','rawAttributes','filters','intersection','fields','length','include','find','catch','body','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2d16cc,_0x46c3ac){var _0x18babf=function(_0x4c665e){while(--_0x4c665e){_0x2d16cc['push'](_0x2d16cc['shift']());}};_0x18babf(++_0x46c3ac);}(_0x0e4b,0x15a));var _0xb0e4=function(_0x17c5d6,_0x5efae6){_0x17c5d6=_0x17c5d6-0x0;var _0x4aecca=_0x0e4b[_0x17c5d6];return _0x4aecca;};'use strict';var emlformat=require(_0xb0e4('0x0'));var rimraf=require(_0xb0e4('0x1'));var zipdir=require(_0xb0e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0e4('0x3'));var moment=require(_0xb0e4('0x4'));var BPromise=require(_0xb0e4('0x5'));var Mustache=require(_0xb0e4('0x6'));var util=require(_0xb0e4('0x7'));var path=require(_0xb0e4('0x8'));var sox=require(_0xb0e4('0x9'));var csv=require(_0xb0e4('0xa'));var ejs=require(_0xb0e4('0xb'));var fs=require('fs');var fs_extra=require(_0xb0e4('0xc'));var _=require(_0xb0e4('0xd'));var squel=require(_0xb0e4('0xe'));var crypto=require(_0xb0e4('0xf'));var jsforce=require(_0xb0e4('0x10'));var deskjs=require(_0xb0e4('0x11'));var toCsv=require(_0xb0e4('0xa'));var querystring=require(_0xb0e4('0x12'));var Papa=require(_0xb0e4('0x13'));var Redis=require('ioredis');var authService=require(_0xb0e4('0x14'));var qs=require(_0xb0e4('0x15'));var as=require(_0xb0e4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0e4('0x17'))(_0xb0e4('0x18'));var utils=require(_0xb0e4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb0e4('0x1a'));var db=require(_0xb0e4('0x1b'))['db'];function respondWithStatusCode(_0x27d18c,_0x8523ad){_0x8523ad=_0x8523ad||0xcc;return function(_0x1693a5){if(_0x1693a5){return _0x27d18c[_0xb0e4('0x1c')](_0x8523ad);}return _0x27d18c[_0xb0e4('0x1d')](_0x8523ad)[_0xb0e4('0x1e')]();};}function respondWithResult(_0x1355f2,_0x436c07){_0x436c07=_0x436c07||0xc8;return function(_0x1bc455){if(_0x1bc455){return _0x1355f2[_0xb0e4('0x1d')](_0x436c07)[_0xb0e4('0x1f')](_0x1bc455);}};}function respondWithFilteredResult(_0x571261,_0x5548cd){return function(_0x3eb829){if(_0x3eb829){var _0x4f3b4f=typeof _0x5548cd[_0xb0e4('0x20')]===_0xb0e4('0x21')&&typeof _0x5548cd[_0xb0e4('0x22')]===_0xb0e4('0x21');var _0x9e001d=_0x3eb829[_0xb0e4('0x23')];var _0x296a24=_0x4f3b4f?0x0:_0x5548cd[_0xb0e4('0x20')];var _0x2cbf7a=_0x4f3b4f?_0x3eb829[_0xb0e4('0x23')]:_0x5548cd[_0xb0e4('0x20')]+_0x5548cd[_0xb0e4('0x22')];var _0x466815;if(_0x2cbf7a>=_0x9e001d){_0x2cbf7a=_0x9e001d;_0x466815=0xc8;}else{_0x466815=0xce;}_0x571261[_0xb0e4('0x1d')](_0x466815);return _0x571261[_0xb0e4('0x24')]('Content-Range',_0x296a24+'-'+_0x2cbf7a+'/'+_0x9e001d)[_0xb0e4('0x1f')](_0x3eb829);}return null;};}function patchUpdates(_0x3f1c7c){return function(_0x53817b){try{jsonpatch[_0xb0e4('0x25')](_0x53817b,_0x3f1c7c,!![]);}catch(_0x13c714){return BPromise[_0xb0e4('0x26')](_0x13c714);}return _0x53817b['save']();};}function saveUpdates(_0x33ef01,_0x9d6dd9){return function(_0x39764d){if(_0x39764d){return _0x39764d['update'](_0x33ef01)[_0xb0e4('0x27')](function(_0x23ac33){return _0x23ac33;});}return null;};}function removeEntity(_0x42b5e8,_0x1bd73d){return function(_0x1ee632){if(_0x1ee632){return _0x1ee632['destroy']()[_0xb0e4('0x27')](function(){var _0x30d7fc=_0x1ee632[_0xb0e4('0x28')]({'plain':!![]});var _0x34ba60='Dispositions';return db[_0xb0e4('0x29')]['destroy']({'where':{'type':_0x34ba60,'resourceId':_0x30d7fc['id']}})[_0xb0e4('0x27')](function(){return _0x1ee632;});})['then'](function(){_0x42b5e8[_0xb0e4('0x1d')](0xcc)[_0xb0e4('0x1e')]();});}};}function handleEntityNotFound(_0xd3fda5,_0x532c07){return function(_0x5d4bba){if(!_0x5d4bba){_0xd3fda5[_0xb0e4('0x1c')](0x194);}return _0x5d4bba;};}function handleError(_0x5d65e7,_0x27b5c7){_0x27b5c7=_0x27b5c7||0x1f4;return function(_0x11ffac){logger[_0xb0e4('0x2a')](_0x11ffac['stack']);if(_0x11ffac['name']){delete _0x11ffac[_0xb0e4('0x2b')];}_0x5d65e7[_0xb0e4('0x1d')](_0x27b5c7)[_0xb0e4('0x2c')](_0x11ffac);};}exports[_0xb0e4('0x2d')]=function(_0x383928,_0x3bf014){var _0x59379d={},_0x45d279={},_0x210c59={'count':0x0,'rows':[]};var _0x401719=_['map'](db[_0xb0e4('0x2e')]['rawAttributes'],function(_0x57dd40){return{'name':_0x57dd40[_0xb0e4('0x2f')],'type':_0x57dd40[_0xb0e4('0x30')][_0xb0e4('0x31')]};});_0x45d279[_0xb0e4('0x32')]=_[_0xb0e4('0x33')](_0x401719,_0xb0e4('0x2b'));_0x45d279[_0xb0e4('0x34')]=_[_0xb0e4('0x35')](_0x383928[_0xb0e4('0x34')]);_0x45d279['filters']=_['intersection'](_0x45d279[_0xb0e4('0x32')],_0x45d279[_0xb0e4('0x34')]);_0x59379d[_0xb0e4('0x36')]=_['intersection'](_0x45d279[_0xb0e4('0x32')],qs['fields'](_0x383928[_0xb0e4('0x34')]['fields']));_0x59379d[_0xb0e4('0x36')]=_0x59379d['attributes']['length']?_0x59379d[_0xb0e4('0x36')]:_0x45d279[_0xb0e4('0x32')];if(!_0x383928[_0xb0e4('0x34')][_0xb0e4('0x37')](_0xb0e4('0x38'))){_0x59379d[_0xb0e4('0x22')]=qs[_0xb0e4('0x22')](_0x383928['query']['limit']);_0x59379d[_0xb0e4('0x20')]=qs['offset'](_0x383928[_0xb0e4('0x34')]['offset']);}_0x59379d[_0xb0e4('0x39')]=qs['sort'](_0x383928[_0xb0e4('0x34')][_0xb0e4('0x3a')]);_0x59379d['where']=qs['filters'](_[_0xb0e4('0x3b')](_0x383928[_0xb0e4('0x34')],_0x45d279['filters']),_0x401719);if(_0x383928[_0xb0e4('0x34')]['filter']){_0x59379d['where']=_['merge'](_0x59379d[_0xb0e4('0x3c')],{'$or':_[_0xb0e4('0x33')](_0x401719,function(_0x597f10){if(_0x597f10['type']!==_0xb0e4('0x3d')){var _0x1c9589={};_0x1c9589[_0x597f10['name']]={'$like':'%'+_0x383928[_0xb0e4('0x34')][_0xb0e4('0x3e')]+'%'};return _0x1c9589;}})});}_0x59379d=_[_0xb0e4('0x3f')]({},_0x59379d,_0x383928['options']);var _0x21a0bc={'where':_0x59379d['where']};return db[_0xb0e4('0x2e')][_0xb0e4('0x23')](_0x21a0bc)[_0xb0e4('0x27')](function(_0x15e655){_0x210c59[_0xb0e4('0x23')]=_0x15e655;if(_0x383928[_0xb0e4('0x34')][_0xb0e4('0x40')]){_0x59379d['include']=[{'all':!![]}];}return db[_0xb0e4('0x2e')][_0xb0e4('0x41')](_0x59379d);})[_0xb0e4('0x27')](function(_0x51dd0d){_0x210c59[_0xb0e4('0x42')]=_0x51dd0d;return _0x210c59;})[_0xb0e4('0x27')](respondWithFilteredResult(_0x3bf014,_0x59379d))['catch'](handleError(_0x3bf014,null));};exports['show']=function(_0x31a039,_0x154af8){var _0x5afe84={'raw':!![],'where':{'id':_0x31a039[_0xb0e4('0x43')]['id']}},_0x169902={};_0x169902[_0xb0e4('0x32')]=_[_0xb0e4('0x35')](db['Disposition'][_0xb0e4('0x44')]);_0x169902[_0xb0e4('0x34')]=_['keys'](_0x31a039['query']);_0x169902[_0xb0e4('0x45')]=_[_0xb0e4('0x46')](_0x169902[_0xb0e4('0x32')],_0x169902['query']);_0x5afe84[_0xb0e4('0x36')]=_[_0xb0e4('0x46')](_0x169902['model'],qs[_0xb0e4('0x47')](_0x31a039[_0xb0e4('0x34')]['fields']));_0x5afe84[_0xb0e4('0x36')]=_0x5afe84[_0xb0e4('0x36')][_0xb0e4('0x48')]?_0x5afe84[_0xb0e4('0x36')]:_0x169902[_0xb0e4('0x32')];if(_0x31a039[_0xb0e4('0x34')][_0xb0e4('0x40')]){_0x5afe84[_0xb0e4('0x49')]=[{'all':!![]}];}_0x5afe84=_['merge']({},_0x5afe84,_0x31a039['options']);return db[_0xb0e4('0x2e')][_0xb0e4('0x4a')](_0x5afe84)[_0xb0e4('0x27')](handleEntityNotFound(_0x154af8,null))[_0xb0e4('0x27')](respondWithResult(_0x154af8,null))[_0xb0e4('0x4b')](handleError(_0x154af8,null));};exports['create']=function(_0x5ac8c2,_0x468e31){return db[_0xb0e4('0x2e')]['create'](_0x5ac8c2[_0xb0e4('0x4c')],{})[_0xb0e4('0x27')](function(_0x151d49){var _0x2cda61=_0x5ac8c2[_0xb0e4('0x4d')][_0xb0e4('0x28')]({'plain':!![]});if(!_0x2cda61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cda61['role']===_0xb0e4('0x4d')){var _0x404f1e=_0x151d49['get']({'plain':!![]});var _0x46dd66=_0xb0e4('0x4e');return db[_0xb0e4('0x4f')][_0xb0e4('0x4a')]({'where':{'name':_0x46dd66,'userProfileId':_0x2cda61[_0xb0e4('0x50')]},'raw':!![]})[_0xb0e4('0x27')](function(_0xc9ceb9){if(_0xc9ceb9&&_0xc9ceb9[_0xb0e4('0x51')]===0x0){return db['UserProfileResource'][_0xb0e4('0x52')]({'name':_0x404f1e[_0xb0e4('0x2b')],'resourceId':_0x404f1e['id'],'type':_0xc9ceb9[_0xb0e4('0x2b')],'sectionId':_0xc9ceb9['id']},{})[_0xb0e4('0x27')](function(){return _0x151d49;});}else{return _0x151d49;}})[_0xb0e4('0x4b')](function(_0x34db9d){logger[_0xb0e4('0x2a')](_0xb0e4('0x53'),_0x34db9d);throw _0x34db9d;});}return _0x151d49;})[_0xb0e4('0x27')](respondWithResult(_0x468e31,0xc9))[_0xb0e4('0x4b')](handleError(_0x468e31,null));};exports[_0xb0e4('0x54')]=function(_0xa3bba6,_0xab9922){if(_0xa3bba6[_0xb0e4('0x4c')]['id']){delete _0xa3bba6['body']['id'];}return db[_0xb0e4('0x2e')][_0xb0e4('0x4a')]({'where':{'id':_0xa3bba6[_0xb0e4('0x43')]['id']}})[_0xb0e4('0x27')](handleEntityNotFound(_0xab9922,null))[_0xb0e4('0x27')](saveUpdates(_0xa3bba6[_0xb0e4('0x4c')],null))[_0xb0e4('0x27')](respondWithResult(_0xab9922,null))[_0xb0e4('0x4b')](handleError(_0xab9922,null));};exports[_0xb0e4('0x55')]=function(_0x4881b3,_0x12a414){return db['Disposition'][_0xb0e4('0x4a')]({'where':{'id':_0x4881b3[_0xb0e4('0x43')]['id']}})[_0xb0e4('0x27')](handleEntityNotFound(_0x12a414,null))[_0xb0e4('0x27')](removeEntity(_0x12a414,null))[_0xb0e4('0x4b')](handleError(_0x12a414,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 69a12c5..4392229 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 _0x807b=['exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./disposition.attributes'];(function(_0x559434,_0x2f9870){var _0x252834=function(_0x548490){while(--_0x548490){_0x559434['push'](_0x559434['shift']());}};_0x252834(++_0x2f9870);}(_0x807b,0x17e));var _0xb807=function(_0x47b550,_0x55ef1e){_0x47b550=_0x47b550-0x0;var _0x22b260=_0x807b[_0x47b550];return _0x22b260;};'use strict';var _=require(_0xb807('0x0'));var util=require(_0xb807('0x1'));var logger=require(_0xb807('0x2'))(_0xb807('0x3'));var moment=require(_0xb807('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb807('0x5'));var rimraf=require(_0xb807('0x6'));var config=require(_0xb807('0x7'));var attributes=require(_0xb807('0x8'));module[_0xb807('0x9')]=function(_0x4e08c7,_0x891cd8){return _0x4e08c7[_0xb807('0xa')]('Disposition',attributes,{'tableName':_0xb807('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb807('0xc'),'fields':[_0xb807('0xd'),_0xb807('0xe')]},{'unique':!![],'name':_0xb807('0xf'),'fields':[_0xb807('0xd'),_0xb807('0x10')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0xb807('0x11'),'fields':[_0xb807('0xd'),'SmsAccountId']},{'unique':!![],'name':_0xb807('0x12'),'fields':[_0xb807('0xd'),_0xb807('0x13')]},{'unique':!![],'name':_0xb807('0x14'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xb807('0x15'),'fields':['name',_0xb807('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0526=['rimraf','../../config/environment','exports','define','name_voice','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','path'];(function(_0x377f50,_0x5589ba){var _0x14a9d2=function(_0x4ab38b){while(--_0x4ab38b){_0x377f50['push'](_0x377f50['shift']());}};_0x14a9d2(++_0x5589ba);}(_0x0526,0x11b));var _0x6052=function(_0x5e7330,_0x505b45){_0x5e7330=_0x5e7330-0x0;var _0x51fe73=_0x0526[_0x5e7330];return _0x51fe73;};'use strict';var _=require(_0x6052('0x0'));var util=require('util');var logger=require(_0x6052('0x1'))('api');var moment=require(_0x6052('0x2'));var BPromise=require(_0x6052('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6052('0x4'));var rimraf=require(_0x6052('0x5'));var config=require(_0x6052('0x6'));var attributes=require('./disposition.attributes');module[_0x6052('0x7')]=function(_0xa38cfa,_0x37eec3){return _0xa38cfa[_0x6052('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x6052('0x9'),'fields':[_0x6052('0xa'),'ListId']},{'unique':!![],'name':_0x6052('0xb'),'fields':['name',_0x6052('0xc')]},{'unique':!![],'name':'name_mail','fields':[_0x6052('0xa'),_0x6052('0xd')]},{'unique':!![],'name':_0x6052('0xe'),'fields':[_0x6052('0xa'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0x6052('0xf')]},{'unique':!![],'name':_0x6052('0x10'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x6052('0xa'),_0x6052('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 3651344..eefbe98 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(_0x4d3b68,_0x4c8930){var _0x58366c=function(_0x9cb0f5){while(--_0x9cb0f5){_0x4d3b68['push'](_0x4d3b68['shift']());}};_0x58366c(++_0x4c8930);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x560980,_0x7981cc){var _0xb3b9d6=function(_0x349580){while(--_0x349580){_0x560980['push'](_0x560980['shift']());}};_0xb3b9d6(++_0x7981cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 0c0b513..481e76a 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 _0xf3be=['./disposition.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x460252,_0x4dc9b3){var _0xa904d3=function(_0x1c8752){while(--_0x1c8752){_0x460252['push'](_0x460252['shift']());}};_0xa904d3(++_0x4dc9b3);}(_0xf3be,0x12a));var _0xef3b=function(_0x5e640b,_0x535fec){_0x5e640b=_0x5e640b-0x0;var _0xf59f2b=_0xf3be[_0x5e640b];return _0xf59f2b;};'use strict';var multer=require(_0xef3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xef3b('0x1'));var express=require(_0xef3b('0x2'));var router=express[_0xef3b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xef3b('0x4'));var interaction=require(_0xef3b('0x5'));var config=require('../../config/environment');var controller=require(_0xef3b('0x6'));router[_0xef3b('0x7')]('/',auth[_0xef3b('0x8')](),controller[_0xef3b('0x9')]);router[_0xef3b('0x7')](_0xef3b('0xa'),auth[_0xef3b('0x8')](),controller['show']);router['post']('/',auth[_0xef3b('0x8')](),controller[_0xef3b('0xb')]);router[_0xef3b('0xc')](_0xef3b('0xa'),auth[_0xef3b('0x8')](),controller[_0xef3b('0xd')]);router[_0xef3b('0xe')](_0xef3b('0xa'),auth[_0xef3b('0x8')](),controller[_0xef3b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x32d0=['get','isAuthenticated','index','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','../../config/environment','./disposition.controller'];(function(_0x4e48de,_0xffdb21){var _0x567e8c=function(_0x296f6c){while(--_0x296f6c){_0x4e48de['push'](_0x4e48de['shift']());}};_0x567e8c(++_0xffdb21);}(_0x32d0,0x139));var _0x032d=function(_0x3c5a91,_0x478b6e){_0x3c5a91=_0x3c5a91-0x0;var _0x270daa=_0x32d0[_0x3c5a91];return _0x270daa;};'use strict';var multer=require(_0x032d('0x0'));var util=require(_0x032d('0x1'));var path=require(_0x032d('0x2'));var timeout=require(_0x032d('0x3'));var express=require(_0x032d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x032d('0x5'));var controller=require(_0x032d('0x6'));router[_0x032d('0x7')]('/',auth[_0x032d('0x8')](),controller[_0x032d('0x9')]);router[_0x032d('0x7')](_0x032d('0xa'),auth[_0x032d('0x8')](),controller[_0x032d('0xb')]);router[_0x032d('0xc')]('/',auth['isAuthenticated'](),controller[_0x032d('0xd')]);router[_0x032d('0xe')](_0x032d('0xa'),auth[_0x032d('0x8')](),controller['update']);router['delete'](_0x032d('0xa'),auth['isAuthenticated'](),controller[_0x032d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2404be1..be124c6 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 _0xa8f2=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','IAX','DADHI','KHOMP','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x49c65c,_0x1345d5){var _0x13c1fc=function(_0x4db7f4){while(--_0x4db7f4){_0x49c65c['push'](_0x49c65c['shift']());}};_0x13c1fc(++_0x1345d5);}(_0xa8f2,0x1e5));var _0x2a8f=function(_0xde9740,_0x2fa2c3){_0xde9740=_0xde9740-0x0;var _0x2d24a5=_0xa8f2[_0xde9740];return _0x2d24a5;};'use strict';var Sequelize=require(_0x2a8f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2a8f('0x1')]},'ecm':{'type':Sequelize[_0x2a8f('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x2a8f('0x1')],'defaultValue':_0x2a8f('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x2a8f('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x2a8f('0x5'),_0x2a8f('0x6'),_0x2a8f('0x7'),_0x2a8f('0x8'),_0x2a8f('0x9'),_0x2a8f('0xa')),'defaultValue':_0x2a8f('0x6')},'maxrate':{'type':Sequelize[_0x2a8f('0x2')](_0x2a8f('0x5'),_0x2a8f('0x6'),'7200','9600',_0x2a8f('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x2a8f('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x2a8f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2a8f('0x2')]('SIP',_0x2a8f('0xc'),_0x2a8f('0xd'),_0x2a8f('0xe')),'defaultValue':_0x2a8f('0xf')},'key':{'type':Sequelize[_0x2a8f('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2a8f('0x10');}},'notificationSound':{'type':Sequelize[_0x2a8f('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2a8f('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2a8f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2a8f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2a8f('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2a8f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2a8f('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2a8f('0x14'),'set':function(_0x4c1463){if(!_0x4c1463)this[_0x2a8f('0x15')](_0x2a8f('0x16'),null);this[_0x2a8f('0x15')](_0x2a8f('0x17'),_0x4c1463);}}}; \ No newline at end of file +var _0x4604=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','9600','14400','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports'];(function(_0x4718f7,_0x3cb9be){var _0x3c3f70=function(_0x92e3f0){while(--_0x92e3f0){_0x4718f7['push'](_0x4718f7['shift']());}};_0x3c3f70(++_0x3cb9be);}(_0x4604,0x1e1));var _0x4460=function(_0x5ac8fc,_0x35b006){_0x5ac8fc=_0x5ac8fc-0x0;var _0x3d3db5=_0x4604[_0x5ac8fc];return _0x3d3db5;};'use strict';var Sequelize=require(_0x4460('0x0'));module[_0x4460('0x1')]={'name':{'type':Sequelize[_0x4460('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4460('0x2')]},'ecm':{'type':Sequelize[_0x4460('0x3')](_0x4460('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x4460('0x5')},'localstationid':{'type':Sequelize[_0x4460('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x4460('0x3')](_0x4460('0x6'),_0x4460('0x7'),_0x4460('0x8'),'9600',_0x4460('0x9'),'14400'),'defaultValue':_0x4460('0x7')},'maxrate':{'type':Sequelize[_0x4460('0x3')](_0x4460('0x6'),_0x4460('0x7'),_0x4460('0x8'),_0x4460('0xa'),_0x4460('0x9'),_0x4460('0xb')),'defaultValue':_0x4460('0xb')},'modem':{'type':Sequelize[_0x4460('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x4460('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4460('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4460('0x3')]('SIP','IAX',_0x4460('0xc'),'KHOMP'),'defaultValue':_0x4460('0xd')},'key':{'type':Sequelize[_0x4460('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4460('0xe')],'defaultValue':function(){return _0x4460('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4460('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4460('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4460('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4460('0x10')],'allowNull':!![],'defaultValue':null,'comment':_0x4460('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x4460('0x11')],'defaultValue':![],'comment':_0x4460('0x13'),'set':function(_0x5049ff){if(!_0x5049ff)this['setDataValue'](_0x4460('0x14'),null);this['setDataValue']('mandatoryDisposition',_0x5049ff);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 57937f9..33b052a 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 _0x302e=['Set','ecm','gateway','headerinfo','maxrate','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','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','FaxAccount','count','rows','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','getDispositions','findOne','Disposition','rawAttributes','hasOwnProperty','FaxAccountId','removeDispositions','find','ids','addAnswer','getAnswers','CannedAnswer','order','findAll','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','pick','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','from-voip-provider','localstationid','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax'];(function(_0x4133c3,_0x370944){var _0x3a0520=function(_0x282d7a){while(--_0x282d7a){_0x4133c3['push'](_0x4133c3['shift']());}};_0x3a0520(++_0x370944);}(_0x302e,0xfe));var _0xe302=function(_0x409362,_0x1470e6){_0x409362=_0x409362-0x0;var _0x16c8c9=_0x302e[_0x409362];return _0x16c8c9;};'use strict';var emlformat=require(_0xe302('0x0'));var rimraf=require(_0xe302('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe302('0x2'));var rp=require(_0xe302('0x3'));var moment=require('moment');var BPromise=require(_0xe302('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe302('0x5'));var sox=require(_0xe302('0x6'));var csv=require(_0xe302('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe302('0x8'));var squel=require('squel');var crypto=require(_0xe302('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe302('0xa'));var toCsv=require(_0xe302('0x7'));var querystring=require('querystring');var Papa=require(_0xe302('0xb'));var Redis=require(_0xe302('0xc'));var authService=require(_0xe302('0xd'));var qs=require(_0xe302('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe302('0xf'));var logger=require(_0xe302('0x10'))(_0xe302('0x11'));var utils=require(_0xe302('0x12'));var config=require(_0xe302('0x13'));var licenseUtil=require(_0xe302('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe302('0x15')](config[_0xe302('0x16')],{'host':_0xe302('0x17'),'port':0x18eb});var socket=require(_0xe302('0x18'))(new Redis(config[_0xe302('0x16')]));require(_0xe302('0x19'))[_0xe302('0x1a')](socket);var jayson=require(_0xe302('0x1b'));var client=jayson[_0xe302('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xe302('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2daa4c,_0x45c217,_0x22cdfe,_0xaab147){return new BPromise(function(_0x3173df,_0x2b5b8b){var _0x2b2145=_0xaab147||client;return _0x2b2145[_0xe302('0x1d')](_0x2daa4c,_0x22cdfe)[_0xe302('0x1e')](function(_0x33edcb){logger[_0xe302('0x1f')](_0xe302('0x20'),_0x45c217,_0xe302('0x21'));logger['debug'](_0xe302('0x22'),_0x45c217,_0xe302('0x21'),JSON[_0xe302('0x23')](_0x33edcb));if(_0x33edcb['error']){if(_0x33edcb[_0xe302('0x24')]['code']===0x1f4){logger[_0xe302('0x24')](_0xe302('0x20'),_0x45c217,_0x33edcb['error']['message']);return _0x2b5b8b(_0x33edcb[_0xe302('0x24')][_0xe302('0x25')]);}logger[_0xe302('0x24')]('FaxAccount,\x20%s,\x20%s',_0x45c217,_0x33edcb[_0xe302('0x24')][_0xe302('0x25')]);return _0x3173df(_0x33edcb['error'][_0xe302('0x25')]);}else{logger[_0xe302('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x45c217,_0xe302('0x21'));_0x3173df(_0x33edcb['result'][_0xe302('0x25')]);}})[_0xe302('0x26')](function(_0x5af45d){logger[_0xe302('0x24')]('FaxAccount,\x20%s,\x20%s',_0x45c217,_0x5af45d);_0x2b5b8b(_0x5af45d);});});}function respondWithStatusCode(_0x30856e,_0x1ce92e){_0x1ce92e=_0x1ce92e||0xcc;return function(_0x480924){if(_0x480924){return _0x30856e[_0xe302('0x27')](_0x1ce92e);}return _0x30856e[_0xe302('0x28')](_0x1ce92e)[_0xe302('0x29')]();};}function respondWithResult(_0x390d24,_0x1d82f9){_0x1d82f9=_0x1d82f9||0xc8;return function(_0x5bf477){if(_0x5bf477){return _0x390d24['status'](_0x1d82f9)[_0xe302('0x2a')](_0x5bf477);}};}function respondWithFilteredResult(_0x429561,_0x4de683){return function(_0x404b02){if(_0x404b02){var _0x114311=typeof _0x4de683[_0xe302('0x2b')]==='undefined'&&typeof _0x4de683[_0xe302('0x2c')]===_0xe302('0x2d');var _0x5c8859=_0x404b02['count'];var _0x3c029e=_0x114311?0x0:_0x4de683[_0xe302('0x2b')];var _0x68f66f=_0x114311?_0x404b02['count']:_0x4de683[_0xe302('0x2b')]+_0x4de683[_0xe302('0x2c')];var _0x32d3a9;if(_0x68f66f>=_0x5c8859){_0x68f66f=_0x5c8859;_0x32d3a9=0xc8;}else{_0x32d3a9=0xce;}_0x429561[_0xe302('0x28')](_0x32d3a9);return _0x429561[_0xe302('0x2e')](_0xe302('0x2f'),_0x3c029e+'-'+_0x68f66f+'/'+_0x5c8859)[_0xe302('0x2a')](_0x404b02);}return null;};}function patchUpdates(_0x77b75a){return function(_0x298503){try{jsonpatch[_0xe302('0x30')](_0x298503,_0x77b75a,!![]);}catch(_0xc011e9){return BPromise[_0xe302('0x31')](_0xc011e9);}return _0x298503[_0xe302('0x32')]();};}function saveUpdates(_0x2a7449,_0x426992){return function(_0x1754ff){if(_0x1754ff){return _0x1754ff['update'](_0x2a7449)[_0xe302('0x1e')](function(_0x15ca9b){return _0x15ca9b;});}return null;};}function removeEntity(_0xab185e,_0x1cbfef){return function(_0xfa00c0){if(_0xfa00c0){return _0xfa00c0[_0xe302('0x33')]()[_0xe302('0x1e')](function(){var _0x3676bc=_0xfa00c0[_0xe302('0x34')]({'plain':!![]});var _0x1be351=_0xe302('0x35');return db[_0xe302('0x36')]['destroy']({'where':{'type':_0x1be351,'resourceId':_0x3676bc['id']}})[_0xe302('0x1e')](function(){return _0xfa00c0;});})[_0xe302('0x1e')](function(){_0xab185e[_0xe302('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5858dc,_0xb1f5f3){return function(_0x2c3ee4){if(!_0x2c3ee4){_0x5858dc['sendStatus'](0x194);}return _0x2c3ee4;};}function handleError(_0xa91be4,_0x4ecce3){_0x4ecce3=_0x4ecce3||0x1f4;return function(_0x3e8fea){logger['error'](_0x3e8fea[_0xe302('0x37')]);if(_0x3e8fea[_0xe302('0x38')]){delete _0x3e8fea[_0xe302('0x38')];}_0xa91be4['status'](_0x4ecce3)['send'](_0x3e8fea);};}exports[_0xe302('0x39')]=function(_0x57e082,_0xcb6fa7){var _0x477a4d={'include':[{'model':db[_0xe302('0x3a')],'as':_0xe302('0x3b')}]},_0x1c610c={},_0x5865d1={'count':0x0,'rows':[]};var _0x312619=_[_0xe302('0x3c')](db['FaxAccount']['rawAttributes'],function(_0x540d9f){return{'name':_0x540d9f['fieldName'],'type':_0x540d9f['type'][_0xe302('0x3d')]};});_0x1c610c[_0xe302('0x3e')]=_['map'](_0x312619,_0xe302('0x38'));_0x1c610c[_0xe302('0x3f')]=_[_0xe302('0x40')](_0x57e082['query']);_0x1c610c[_0xe302('0x41')]=_[_0xe302('0x42')](_0x1c610c[_0xe302('0x3e')],_0x1c610c[_0xe302('0x3f')]);_0x477a4d[_0xe302('0x43')]=_[_0xe302('0x42')](_0x1c610c[_0xe302('0x3e')],qs[_0xe302('0x44')](_0x57e082['query'][_0xe302('0x44')]));_0x477a4d['attributes']=_0x477a4d[_0xe302('0x43')][_0xe302('0x45')]?_0x477a4d[_0xe302('0x43')]:_0x1c610c[_0xe302('0x3e')];if(!_0x57e082[_0xe302('0x3f')]['hasOwnProperty'](_0xe302('0x46'))){_0x477a4d[_0xe302('0x2c')]=qs[_0xe302('0x2c')](_0x57e082[_0xe302('0x3f')][_0xe302('0x2c')]);_0x477a4d[_0xe302('0x2b')]=qs[_0xe302('0x2b')](_0x57e082['query'][_0xe302('0x2b')]);}_0x477a4d['order']=qs[_0xe302('0x47')](_0x57e082[_0xe302('0x3f')][_0xe302('0x47')]);_0x477a4d[_0xe302('0x48')]=qs[_0xe302('0x41')](_['pick'](_0x57e082[_0xe302('0x3f')],_0x1c610c[_0xe302('0x41')]),_0x312619);if(_0x57e082['query'][_0xe302('0x49')]){_0x477a4d[_0xe302('0x48')]=_[_0xe302('0x4a')](_0x477a4d['where'],{'$or':_[_0xe302('0x3c')](_0x312619,function(_0x1c36c5){if(_0x1c36c5[_0xe302('0x4b')]!==_0xe302('0x4c')){var _0x39f4a0={};_0x39f4a0[_0x1c36c5[_0xe302('0x38')]]={'$like':'%'+_0x57e082['query'][_0xe302('0x49')]+'%'};return _0x39f4a0;}})});}_0x477a4d=_[_0xe302('0x4a')]({},_0x477a4d,_0x57e082[_0xe302('0x4d')]);var _0x1a02e6={'where':_0x477a4d['where']};return db[_0xe302('0x4e')][_0xe302('0x4f')](_0x1a02e6)[_0xe302('0x1e')](function(_0x4752bc){_0x5865d1[_0xe302('0x4f')]=_0x4752bc;if(_0x57e082['query']['includeAll']){_0x477a4d['include']=[{'all':!![]}];}return db[_0xe302('0x4e')]['findAll'](_0x477a4d);})[_0xe302('0x1e')](function(_0x121bf6){_0x5865d1[_0xe302('0x50')]=_0x121bf6;return _0x5865d1;})[_0xe302('0x1e')](respondWithFilteredResult(_0xcb6fa7,_0x477a4d))[_0xe302('0x26')](handleError(_0xcb6fa7,null));};exports[_0xe302('0x51')]=function(_0x44416a,_0x5a963b){var _0x3ff357={'raw':![],'where':{'id':_0x44416a[_0xe302('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xe302('0x3b')}]},_0x409435={};_0x409435[_0xe302('0x3e')]=_[_0xe302('0x40')](db[_0xe302('0x4e')]['rawAttributes']);_0x409435['query']=_[_0xe302('0x40')](_0x44416a[_0xe302('0x3f')]);_0x409435[_0xe302('0x41')]=_[_0xe302('0x42')](_0x409435[_0xe302('0x3e')],_0x409435[_0xe302('0x3f')]);_0x3ff357[_0xe302('0x43')]=_[_0xe302('0x42')](_0x409435[_0xe302('0x3e')],qs[_0xe302('0x44')](_0x44416a['query'][_0xe302('0x44')]));_0x3ff357[_0xe302('0x43')]=_0x3ff357['attributes'][_0xe302('0x45')]?_0x3ff357[_0xe302('0x43')]:_0x409435[_0xe302('0x3e')];if(_0x44416a['query'][_0xe302('0x53')]){_0x3ff357[_0xe302('0x54')]=[{'all':!![]}];}_0x3ff357=_[_0xe302('0x4a')]({},_0x3ff357,_0x44416a[_0xe302('0x4d')]);return db['FaxAccount']['find'](_0x3ff357)[_0xe302('0x1e')](handleEntityNotFound(_0x5a963b,null))[_0xe302('0x1e')](respondWithResult(_0x5a963b,null))[_0xe302('0x26')](handleError(_0x5a963b,null));};exports[_0xe302('0x55')]=function(_0x1a0e0f,_0x8e8300){return db[_0xe302('0x4e')][_0xe302('0x55')](_0x1a0e0f[_0xe302('0x56')],{})[_0xe302('0x1e')](function(_0x20a599){var _0x11d7c1=_0x1a0e0f[_0xe302('0x57')][_0xe302('0x34')]({'plain':!![]});if(!_0x11d7c1)throw new Error(_0xe302('0x58'));if(_0x11d7c1['role']===_0xe302('0x57')){var _0xe56372=_0x20a599[_0xe302('0x34')]({'plain':!![]});var _0x13ec6d=_0xe302('0x35');return db[_0xe302('0x59')]['find']({'where':{'name':_0x13ec6d,'userProfileId':_0x11d7c1[_0xe302('0x5a')]},'raw':!![]})['then'](function(_0x2710b8){if(_0x2710b8&&_0x2710b8[_0xe302('0x5b')]===0x0){return db[_0xe302('0x36')][_0xe302('0x55')]({'name':_0xe56372['name'],'resourceId':_0xe56372['id'],'type':_0x2710b8[_0xe302('0x38')],'sectionId':_0x2710b8['id']},{})[_0xe302('0x1e')](function(){return _0x20a599;});}else{return _0x20a599;}})[_0xe302('0x26')](function(_0x5972bf){logger[_0xe302('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5972bf);throw _0x5972bf;});}return _0x20a599;})[_0xe302('0x1e')](respondWithResult(_0x8e8300,0xc9))[_0xe302('0x26')](handleError(_0x8e8300,null));};exports[_0xe302('0x5c')]=function(_0x322a8e,_0x18b365){if(_0x322a8e[_0xe302('0x56')]['id']){delete _0x322a8e[_0xe302('0x56')]['id'];}return db[_0xe302('0x4e')]['find']({'where':{'id':_0x322a8e[_0xe302('0x52')]['id']},'include':[{'model':db[_0xe302('0x3a')],'as':'mandatoryDispositionPause'}]})[_0xe302('0x1e')](handleEntityNotFound(_0x18b365,null))[_0xe302('0x1e')](saveUpdates(_0x322a8e[_0xe302('0x56')],null))[_0xe302('0x1e')](respondWithResult(_0x18b365,null))[_0xe302('0x26')](handleError(_0x18b365,null));};exports[_0xe302('0x33')]=function(_0x47d737,_0x14b420){return db['FaxAccount']['find']({'where':{'id':_0x47d737[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x14b420,null))[_0xe302('0x1e')](removeEntity(_0x14b420,null))[_0xe302('0x26')](handleError(_0x14b420,null));};exports['describe']=function(_0x33f629,_0x44e36b){return db[_0xe302('0x4e')][_0xe302('0x5d')]()[_0xe302('0x1e')](respondWithResult(_0x44e36b,null))[_0xe302('0x26')](handleError(_0x44e36b,null));};exports[_0xe302('0x5e')]=function(_0x2b413c,_0x1be4ae,_0x320a9b){if(_0x2b413c[_0xe302('0x56')]['id']){delete _0x2b413c[_0xe302('0x56')]['id'];}return db[_0xe302('0x4e')]['find']({'where':{'id':_0x2b413c[_0xe302('0x52')]['id']}})['then'](handleEntityNotFound(_0x1be4ae,null))['then'](function(_0x207e08){if(_0x207e08){_0x2b413c[_0xe302('0x56')]['FaxAccountId']=_0x207e08['id'];return db['Disposition']['create'](_0x2b413c[_0xe302('0x56')]);}})[_0xe302('0x1e')](respondWithResult(_0x1be4ae,null))['catch'](handleError(_0x1be4ae,null));};exports[_0xe302('0x5f')]=function(_0x141a0,_0x149cc7,_0x4cda83){var _0x4e3c9f={'raw':![],'where':{}};var _0xc65e2b={};var _0x526f24={'count':0x0,'rows':[]};return db[_0xe302('0x4e')][_0xe302('0x60')]({'where':{'id':_0x141a0[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x149cc7,null))[_0xe302('0x1e')](function(_0x2d4ac5){if(_0x2d4ac5){_0xc65e2b['model']=_['keys'](db[_0xe302('0x61')][_0xe302('0x62')]);_0xc65e2b[_0xe302('0x3f')]=_[_0xe302('0x40')](_0x141a0[_0xe302('0x3f')]);_0xc65e2b['filters']=_[_0xe302('0x42')](_0xc65e2b['model'],_0xc65e2b['query']);_0x4e3c9f[_0xe302('0x43')]=_['intersection'](_0xc65e2b[_0xe302('0x3e')],qs[_0xe302('0x44')](_0x141a0[_0xe302('0x3f')][_0xe302('0x44')]));_0x4e3c9f['attributes']=_0x4e3c9f[_0xe302('0x43')][_0xe302('0x45')]?_0x4e3c9f[_0xe302('0x43')]:_0xc65e2b['model'];if(!_0x141a0['query'][_0xe302('0x63')](_0xe302('0x46'))){_0x4e3c9f[_0xe302('0x2c')]=qs[_0xe302('0x2c')](_0x141a0[_0xe302('0x3f')][_0xe302('0x2c')]);_0x4e3c9f[_0xe302('0x2b')]=qs[_0xe302('0x2b')](_0x141a0['query']['offset']);}_0x4e3c9f['order']=qs[_0xe302('0x47')](_0x141a0[_0xe302('0x3f')][_0xe302('0x47')]);_0x4e3c9f['where']=qs[_0xe302('0x41')](_['pick'](_0x141a0[_0xe302('0x3f')],_0xc65e2b[_0xe302('0x41')]));_0x4e3c9f[_0xe302('0x48')][_0xe302('0x64')]=_0x2d4ac5['id'];if(_0x141a0[_0xe302('0x3f')][_0xe302('0x49')]){_0x4e3c9f[_0xe302('0x48')]=_[_0xe302('0x4a')](_0x4e3c9f[_0xe302('0x48')],{'$or':_['map'](_0x4e3c9f['attributes'],function(_0x4a42fe){var _0x4a15d2={};_0x4a15d2[_0x4a42fe]={'$like':'%'+_0x141a0[_0xe302('0x3f')]['filter']+'%'};return _0x4a15d2;})});}_0x4e3c9f=_[_0xe302('0x4a')]({},_0x4e3c9f,_0x141a0[_0xe302('0x4d')]);return db[_0xe302('0x61')]['count']({'where':_0x4e3c9f['where']})[_0xe302('0x1e')](function(_0x30beb3){_0x526f24['count']=_0x30beb3;if(_0x141a0[_0xe302('0x3f')]['includeAll']){_0x4e3c9f[_0xe302('0x54')]=[{'all':!![]}];}return db[_0xe302('0x61')]['findAll'](_0x4e3c9f);})[_0xe302('0x1e')](function(_0x53676c){_0x526f24[_0xe302('0x50')]=_0x53676c;return _0x526f24;});}})['then'](respondWithFilteredResult(_0x149cc7,_0x4e3c9f))[_0xe302('0x26')](handleError(_0x149cc7,null));};exports[_0xe302('0x65')]=function(_0x49fbdc,_0xc45dbf,_0x21f1cd){return db[_0xe302('0x4e')][_0xe302('0x66')]({'where':{'id':_0x49fbdc['params']['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0xc45dbf,null))[_0xe302('0x1e')](function(_0x10ae5e){if(_0x10ae5e){return _0x10ae5e[_0xe302('0x65')](_0x49fbdc[_0xe302('0x3f')][_0xe302('0x67')]);}})[_0xe302('0x1e')](respondWithStatusCode(_0xc45dbf,null))[_0xe302('0x26')](handleError(_0xc45dbf,null));};exports[_0xe302('0x68')]=function(_0x2932b3,_0xb370a,_0x39767d){if(_0x2932b3[_0xe302('0x56')]['id']){delete _0x2932b3[_0xe302('0x56')]['id'];}return db[_0xe302('0x4e')][_0xe302('0x66')]({'where':{'id':_0x2932b3[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0xb370a,null))[_0xe302('0x1e')](function(_0x246cda){if(_0x246cda){_0x2932b3[_0xe302('0x56')][_0xe302('0x64')]=_0x246cda['id'];return db['CannedAnswer'][_0xe302('0x55')](_0x2932b3['body']);}})[_0xe302('0x1e')](respondWithResult(_0xb370a,null))[_0xe302('0x26')](handleError(_0xb370a,null));};exports[_0xe302('0x69')]=function(_0x59fe7e,_0x830837,_0x176c02){var _0x4e0919={'raw':![],'where':{}};var _0x4c0d4b={};var _0x4cef7c={'count':0x0,'rows':[]};return db[_0xe302('0x4e')][_0xe302('0x60')]({'where':{'id':_0x59fe7e[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x830837,null))[_0xe302('0x1e')](function(_0x3f3669){if(_0x3f3669){_0x4c0d4b[_0xe302('0x3e')]=_['keys'](db[_0xe302('0x6a')][_0xe302('0x62')]);_0x4c0d4b['query']=_['keys'](_0x59fe7e[_0xe302('0x3f')]);_0x4c0d4b['filters']=_[_0xe302('0x42')](_0x4c0d4b['model'],_0x4c0d4b[_0xe302('0x3f')]);_0x4e0919[_0xe302('0x43')]=_[_0xe302('0x42')](_0x4c0d4b['model'],qs[_0xe302('0x44')](_0x59fe7e['query'][_0xe302('0x44')]));_0x4e0919[_0xe302('0x43')]=_0x4e0919[_0xe302('0x43')][_0xe302('0x45')]?_0x4e0919['attributes']:_0x4c0d4b[_0xe302('0x3e')];if(!_0x59fe7e[_0xe302('0x3f')]['hasOwnProperty'](_0xe302('0x46'))){_0x4e0919[_0xe302('0x2c')]=qs[_0xe302('0x2c')](_0x59fe7e[_0xe302('0x3f')][_0xe302('0x2c')]);_0x4e0919['offset']=qs[_0xe302('0x2b')](_0x59fe7e['query']['offset']);}_0x4e0919[_0xe302('0x6b')]=qs[_0xe302('0x47')](_0x59fe7e['query'][_0xe302('0x47')]);_0x4e0919[_0xe302('0x48')]=qs[_0xe302('0x41')](_['pick'](_0x59fe7e[_0xe302('0x3f')],_0x4c0d4b['filters']));_0x4e0919[_0xe302('0x48')]['FaxAccountId']=_0x3f3669['id'];if(_0x59fe7e[_0xe302('0x3f')][_0xe302('0x49')]){_0x4e0919[_0xe302('0x48')]=_['merge'](_0x4e0919['where'],{'$or':_['map'](_0x4e0919[_0xe302('0x43')],function(_0x86e1b0){var _0x3a28c7={};_0x3a28c7[_0x86e1b0]={'$like':'%'+_0x59fe7e['query'][_0xe302('0x49')]+'%'};return _0x3a28c7;})});}_0x4e0919=_[_0xe302('0x4a')]({},_0x4e0919,_0x59fe7e['options']);return db['CannedAnswer'][_0xe302('0x4f')]({'where':_0x4e0919[_0xe302('0x48')]})[_0xe302('0x1e')](function(_0x144b17){_0x4cef7c[_0xe302('0x4f')]=_0x144b17;if(_0x59fe7e[_0xe302('0x3f')][_0xe302('0x53')]){_0x4e0919[_0xe302('0x54')]=[{'all':!![]}];}return db[_0xe302('0x6a')][_0xe302('0x6c')](_0x4e0919);})['then'](function(_0x1cacc8){_0x4cef7c[_0xe302('0x50')]=_0x1cacc8;return _0x4cef7c;});}})[_0xe302('0x1e')](respondWithFilteredResult(_0x830837,_0x4e0919))['catch'](handleError(_0x830837,null));};exports[_0xe302('0x6d')]=function(_0x2f216b,_0x104210,_0x19372a){return db['FaxAccount'][_0xe302('0x66')]({'where':{'id':_0x2f216b[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x104210,null))[_0xe302('0x1e')](function(_0x1ee3ad){if(_0x1ee3ad){return _0x1ee3ad['removeAnswers'](_0x2f216b[_0xe302('0x3f')]['ids']);}})[_0xe302('0x1e')](respondWithStatusCode(_0x104210,null))[_0xe302('0x26')](handleError(_0x104210,null));};exports[_0xe302('0x6e')]=function(_0x419b6c,_0x5c5606,_0xf939a9){return db[_0xe302('0x6f')][_0xe302('0x66')]({'where':{'id':_0x419b6c[_0xe302('0x52')]['id']}})['then'](handleEntityNotFound(_0x5c5606,null))[_0xe302('0x1e')](function(_0x40ab22){if(_0x40ab22){return _0x40ab22[_0xe302('0x6e')](_0x419b6c['body']['ids'],_[_0xe302('0x70')](_0x419b6c[_0xe302('0x56')],[_0xe302('0x67'),'id'])||{});}})[_0xe302('0x1e')](respondWithResult(_0x5c5606,null))['catch'](handleError(_0x5c5606,null));};exports[_0xe302('0x71')]=function(_0x4b1869,_0x18d7a1,_0x38fe12){var _0x85bb7b={'raw':![],'where':{}};var _0x445ef5={};var _0x3753f4={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe302('0x60')]({'where':{'id':_0x4b1869[_0xe302('0x52')]['id']}})['then'](handleEntityNotFound(_0x18d7a1,null))[_0xe302('0x1e')](function(_0x448df8){if(_0x448df8){_0x445ef5['model']=_['keys'](db[_0xe302('0x6f')][_0xe302('0x62')]);_0x445ef5[_0xe302('0x3f')]=_[_0xe302('0x40')](_0x4b1869[_0xe302('0x3f')]);_0x445ef5['filters']=_[_0xe302('0x42')](_0x445ef5[_0xe302('0x3e')],_0x445ef5[_0xe302('0x3f')]);_0x85bb7b['attributes']=_[_0xe302('0x42')](_0x445ef5['model'],qs[_0xe302('0x44')](_0x4b1869[_0xe302('0x3f')][_0xe302('0x44')]));_0x85bb7b[_0xe302('0x43')]=_0x85bb7b[_0xe302('0x43')][_0xe302('0x45')]?_0x85bb7b['attributes']:_0x445ef5['model'];if(!_0x4b1869[_0xe302('0x3f')][_0xe302('0x63')](_0xe302('0x46'))){_0x85bb7b[_0xe302('0x2c')]=qs['limit'](_0x4b1869[_0xe302('0x3f')][_0xe302('0x2c')]);_0x85bb7b[_0xe302('0x2b')]=qs[_0xe302('0x2b')](_0x4b1869[_0xe302('0x3f')]['offset']);}_0x85bb7b[_0xe302('0x6b')]=qs[_0xe302('0x47')](_0x4b1869[_0xe302('0x3f')]['sort']);_0x85bb7b[_0xe302('0x48')]=qs[_0xe302('0x41')](_[_0xe302('0x72')](_0x4b1869[_0xe302('0x3f')],_0x445ef5['filters']));_0x85bb7b[_0xe302('0x48')][_0xe302('0x64')]=_0x448df8['id'];if(_0x4b1869['query']['filter']){_0x85bb7b['where']=_['merge'](_0x85bb7b[_0xe302('0x48')],{'$or':_[_0xe302('0x3c')](_0x85bb7b[_0xe302('0x43')],function(_0x542571){var _0x3a509e={};_0x3a509e[_0x542571]={'$like':'%'+_0x4b1869[_0xe302('0x3f')][_0xe302('0x49')]+'%'};return _0x3a509e;})});}_0x85bb7b=_[_0xe302('0x4a')]({},_0x85bb7b,_0x4b1869['options']);return db[_0xe302('0x6f')][_0xe302('0x4f')]({'where':_0x85bb7b[_0xe302('0x48')]})['then'](function(_0x291165){_0x3753f4[_0xe302('0x4f')]=_0x291165;if(_0x4b1869[_0xe302('0x3f')]['includeAll']){_0x85bb7b[_0xe302('0x54')]=[{'model':db[_0xe302('0x73')],'as':_0xe302('0x74'),'required':![]},{'model':db[_0xe302('0x75')],'as':_0xe302('0x76'),'attributes':[_0xe302('0x38'),_0xe302('0x77'),_0xe302('0x78')],'required':![]},{'model':db[_0xe302('0x79')],'as':_0xe302('0x7a'),'attributes':['id',_0xe302('0x38'),_0xe302('0x7b')],'where':_0x4b1869[_0xe302('0x3f')][_0xe302('0x7c')]?{'id':_0x4b1869['query'][_0xe302('0x7c')]}:undefined,'required':_0x4b1869[_0xe302('0x3f')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xe302('0x6c')](_0x85bb7b);})[_0xe302('0x1e')](function(_0x2b700c){_0x3753f4[_0xe302('0x50')]=_0x2b700c;return _0x3753f4;});}})[_0xe302('0x1e')](respondWithFilteredResult(_0x18d7a1,_0x85bb7b))[_0xe302('0x26')](handleError(_0x18d7a1,null));};exports[_0xe302('0x7d')]=function(_0x3ebca6,_0x5304bd){var _0x5bf0c1=_0x3ebca6[_0xe302('0x52')]['id'];var _0x490097=_0x3ebca6[_0xe302('0x56')];var _0x1636cb=0xc8;var _0x5e8456=null;return db[_0xe302('0x7e')][_0xe302('0x7f')]({'isolationLevel':db['sequelize'][_0xe302('0x80')]['ISOLATION_LEVELS'][_0xe302('0x81')]},function(_0x3d3508){return db[_0xe302('0x4e')][_0xe302('0x60')]({'where':{'id':_0x5bf0c1},'transaction':_0x3d3508})[_0xe302('0x1e')](function(_0x1a14f3){if(_0x1a14f3){return db[_0xe302('0x82')]['destroy']({'where':{'FaxAccountId':_0x5bf0c1},'transaction':_0x3d3508})[_0xe302('0x1e')](function(){var _0x3985db=_[_0xe302('0x3c')](_0x490097,function(_0x9a6acf){_0x9a6acf['FaxAccountId']=_0x5bf0c1;return _0x9a6acf;});return db[_0xe302('0x82')][_0xe302('0x83')](_0x3985db,{'transaction':_0x3d3508});});}else{_0x1636cb=0x194;_0x5e8456=[];}});})[_0xe302('0x1e')](function(){if(_0x1636cb!==0x194){return db['FaxApplication'][_0xe302('0x84')]({'where':{'FaxAccountId':_0x5bf0c1},'order':_0xe302('0x85')})[_0xe302('0x1e')](function(_0x4fca1c){_0x5e8456=_0x4fca1c;});}})['catch'](function(_0x3f1858){_0x1636cb=0x1f4;logger[_0xe302('0x24')](_0x3f1858[_0xe302('0x37')]);if(_0x3f1858[_0xe302('0x38')]){delete _0x3f1858[_0xe302('0x38')];}_0x5e8456=_0x3f1858;})[_0xe302('0x86')](function(){if(_0x5e8456===null){_0x5304bd[_0xe302('0x27')](_0x1636cb);}else{if(_0x1636cb===0x1f4){_0x5304bd[_0xe302('0x28')](_0x1636cb)[_0xe302('0x87')](_0x5e8456);}else{_0x5304bd[_0xe302('0x28')](_0x1636cb)[_0xe302('0x2a')](_0x5e8456);}}});};exports[_0xe302('0x88')]=function(_0x36040a,_0x9bd5e3,_0x493b83){var _0x5827c3={};var _0x5e7e63={};var _0x14f510;var _0x207cbf;return db[_0xe302('0x4e')][_0xe302('0x60')]({'where':{'id':_0x36040a[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x9bd5e3,null))['then'](function(_0x341d56){if(_0x341d56){_0x14f510=_0x341d56;_0x5e7e63[_0xe302('0x3e')]=_['keys'](db[_0xe302('0x82')][_0xe302('0x62')]);_0x5e7e63[_0xe302('0x3f')]=_[_0xe302('0x40')](_0x36040a['query']);_0x5e7e63['filters']=_['intersection'](_0x5e7e63[_0xe302('0x3e')],_0x5e7e63[_0xe302('0x3f')]);_0x5827c3[_0xe302('0x43')]=_[_0xe302('0x42')](_0x5e7e63[_0xe302('0x3e')],qs['fields'](_0x36040a[_0xe302('0x3f')]['fields']));_0x5827c3[_0xe302('0x43')]=_0x5827c3['attributes'][_0xe302('0x45')]?_0x5827c3[_0xe302('0x43')]:_0x5e7e63[_0xe302('0x3e')];_0x5827c3[_0xe302('0x6b')]=qs[_0xe302('0x47')](_0x36040a['query'][_0xe302('0x47')]);_0x5827c3[_0xe302('0x48')]=qs[_0xe302('0x41')](_['pick'](_0x36040a[_0xe302('0x3f')],_0x5e7e63[_0xe302('0x41')]));if(_0x36040a['query'][_0xe302('0x49')]){_0x5827c3[_0xe302('0x48')]=_[_0xe302('0x4a')](_0x5827c3[_0xe302('0x48')],{'$or':_[_0xe302('0x3c')](_0x5827c3[_0xe302('0x43')],function(_0x1fb7cd){var _0x4f219d={};_0x4f219d[_0x1fb7cd]={'$like':'%'+_0x36040a[_0xe302('0x3f')][_0xe302('0x49')]+'%'};return _0x4f219d;})});}_0x5827c3=_[_0xe302('0x4a')]({},_0x5827c3,_0x36040a[_0xe302('0x4d')]);return _0x14f510['getApplications'](_0x5827c3);}})[_0xe302('0x1e')](function(_0x2f32ed){if(_0x2f32ed){_0x207cbf=_0x2f32ed[_0xe302('0x45')];if(!_0x36040a[_0xe302('0x3f')]['hasOwnProperty']('nolimit')){_0x5827c3[_0xe302('0x2c')]=qs[_0xe302('0x2c')](_0x36040a[_0xe302('0x3f')][_0xe302('0x2c')]);_0x5827c3[_0xe302('0x2b')]=qs[_0xe302('0x2b')](_0x36040a[_0xe302('0x3f')]['offset']);}return _0x14f510[_0xe302('0x88')](_0x5827c3);}})[_0xe302('0x1e')](function(_0x14e842){if(_0x14e842){return _0x14e842?{'count':_0x207cbf,'rows':_0x14e842}:null;}})[_0xe302('0x1e')](respondWithResult(_0x9bd5e3,null))[_0xe302('0x26')](handleError(_0x9bd5e3,null));};function Extension(_0x1fdc1d,_0x28a114,_0x2859a9,_0xa8f3dc){this[_0xe302('0x89')]=_0xe302('0x8a');this['exten']=_0x1fdc1d[_0xe302('0x8b')];this['app']=_0xa8f3dc;this[_0xe302('0x4b')]=_0xe302('0x8c');this[_0xe302('0x8d')]=_0xe302('0x8e');this[_0xe302('0x64')]=_0x1fdc1d['id'];this['priority']=_0x28a114;this['appdata']=_0x2859a9;}function createExtensionsReciveFax(_0x3a6dae){var _0x430977=0x1;var _0x207b26=[];_0x207b26[_0xe302('0x8f')](new Extension(_0x3a6dae,_0x430977,'',_0xe302('0x90')));_0x430977+=0x1;_0x207b26[_0xe302('0x8f')](new Extension(_0x3a6dae,_0x430977,_0xe302('0x91'),_0xe302('0x92')));_0x430977+=0x1;for(var _0x47dc72 in _0x3a6dae){if(_0x3a6dae[_0xe302('0x63')](_0x47dc72)&&(_0x47dc72===_0xe302('0x93')||_0x47dc72===_0xe302('0x8b')||_0x47dc72===_0xe302('0x94')||_0x47dc72==='faxdetect'||_0x47dc72===_0xe302('0x95')||_0x47dc72===_0xe302('0x96')||_0x47dc72==='minrate'||_0x47dc72===_0xe302('0x97')||_0x47dc72===_0xe302('0x98'))){_0x207b26[_0xe302('0x8f')](new Extension(_0x3a6dae,_0x430977,_0xe302('0x99')+_0x47dc72+')='+_0x3a6dae[_0x47dc72],_0xe302('0x92')));_0x430977+=0x1;}}_0x207b26[_0xe302('0x8f')](new Extension(_0x3a6dae,_0x430977,'6',_0xe302('0x9a')));_0x430977+=0x1;_0x207b26[_0xe302('0x8f')](new Extension(_0x3a6dae,_0x430977,_0xe302('0x9b'),_0xe302('0x9c')));_0x430977=0x0;return _0x207b26;}exports[_0xe302('0x9d')]=function(_0x3354f7,_0x3b1c3e,_0x22cdea){var _0x125741;return db[_0xe302('0x7e')][_0xe302('0x7f')](function(_0x4c5f42){return db['FaxAccount'][_0xe302('0x55')](_0x3354f7[_0xe302('0x56')],{'transaction':_0x4c5f42})[_0xe302('0x1e')](function(_0x101be2){_0x125741=_0x101be2[_0xe302('0x34')]({'plain':!![]});return db[_0xe302('0x9e')][_0xe302('0x83')](createExtensionsReciveFax(_0x125741),{'transaction':_0x4c5f42});});})[_0xe302('0x1e')](function(){return _0x125741;})['then'](respondWithResult(_0x3b1c3e,null))[_0xe302('0x26')](handleError(_0x3b1c3e,null));};exports[_0xe302('0x9f')]=function(_0x3f705e,_0x49af0f,_0x50a517){var _0x3f8f41;return db[_0xe302('0x7e')]['transaction'](function(_0xd140d3){return db[_0xe302('0x4e')]['update'](_0x3f705e['body'],{'where':{'id':_0x3f705e[_0xe302('0x56')]['id']},'transaction':_0xd140d3})[_0xe302('0x1e')](function(_0x189a26){return db[_0xe302('0x9e')]['destroy']({'where':{'FaxAccountId':_0x3f705e[_0xe302('0x56')]['id']},'transaction':_0xd140d3})[_0xe302('0x1e')](function(_0x4c451c){return db[_0xe302('0x9e')][_0xe302('0x83')](createExtensionsReciveFax(_[_0xe302('0x70')](_0x3f705e[_0xe302('0x56')],[_0xe302('0xa0'),_0xe302('0x3d'),'createdAt',_0xe302('0xa1'),'TrunkId',_0xe302('0xa2')])),{'transaction':_0xd140d3});});});})[_0xe302('0x1e')](function(){return db[_0xe302('0x4e')][_0xe302('0xa3')](_0x3f705e[_0xe302('0x56')]['id']);})['then'](respondWithResult(_0x49af0f,null))['catch'](handleError(_0x49af0f,null));};exports[_0xe302('0xa4')]=function(_0x1609c3,_0x1a097a,_0x21c44d){var _0x4c0a36={'raw':!![],'where':{}};var _0x15be5d={};var _0x47039f={'count':0x0,'rows':[]};return db[_0xe302('0x4e')][_0xe302('0x60')]({'where':{'id':_0x1609c3[_0xe302('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a097a,null))[_0xe302('0x1e')](function(_0x149f6f){if(_0x149f6f){_0x15be5d[_0xe302('0x3e')]=_['keys'](db[_0xe302('0xa5')][_0xe302('0x62')]);_0x15be5d[_0xe302('0x3f')]=_['keys'](_0x1609c3['query']);_0x15be5d['filters']=_[_0xe302('0x42')](_0x15be5d[_0xe302('0x3e')],_0x15be5d[_0xe302('0x3f')]);_0x4c0a36[_0xe302('0x43')]=_['intersection'](_0x15be5d[_0xe302('0x3e')],qs[_0xe302('0x44')](_0x1609c3[_0xe302('0x3f')][_0xe302('0x44')]));_0x4c0a36[_0xe302('0x43')]=_0x4c0a36[_0xe302('0x43')][_0xe302('0x45')]?_0x4c0a36[_0xe302('0x43')]:_0x15be5d['model'];if(!_0x1609c3[_0xe302('0x3f')][_0xe302('0x63')]('nolimit')){_0x4c0a36[_0xe302('0x2c')]=qs[_0xe302('0x2c')](_0x1609c3['query']['limit']);_0x4c0a36[_0xe302('0x2b')]=qs[_0xe302('0x2b')](_0x1609c3[_0xe302('0x3f')][_0xe302('0x2b')]);}_0x4c0a36['order']=qs[_0xe302('0x47')](_0x1609c3[_0xe302('0x3f')][_0xe302('0x47')]);_0x4c0a36[_0xe302('0x48')]=qs[_0xe302('0x41')](_[_0xe302('0x72')](_0x1609c3['query'],_0x15be5d[_0xe302('0x41')]));_0x4c0a36[_0xe302('0x48')][_0xe302('0x64')]=_0x149f6f['id'];if(_0x1609c3[_0xe302('0x3f')][_0xe302('0x49')]){_0x4c0a36[_0xe302('0x48')]=_['merge'](_0x4c0a36[_0xe302('0x48')],{'$or':_[_0xe302('0x3c')](_0x4c0a36['attributes'],function(_0xa294e1){var _0x398334={};_0x398334[_0xa294e1]={'$like':'%'+_0x1609c3[_0xe302('0x3f')][_0xe302('0x49')]+'%'};return _0x398334;})});}if(_0x1609c3['query']['$gte']){var _0xfc5b04=_0x1609c3[_0xe302('0x3f')][_0xe302('0xa6')][_0xe302('0xa7')](',');var _0x2fdfff={};_0x2fdfff[_0xfc5b04[0x0]]={'$gte':moment(_0xfc5b04[0x1])[_0xe302('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4c0a36[_0xe302('0x48')]=_['merge'](_0x4c0a36[_0xe302('0x48')],_0x2fdfff);}_0x4c0a36=_[_0xe302('0x4a')]({},_0x4c0a36,_0x1609c3['options']);return db[_0xe302('0xa5')][_0xe302('0x4f')]({'where':_0x4c0a36[_0xe302('0x48')]})[_0xe302('0x1e')](function(_0x1bf17d){_0x47039f['count']=_0x1bf17d;if(_0x1609c3[_0xe302('0x3f')]['includeAll']){_0x4c0a36[_0xe302('0x54')]=[{'all':!![]}];}return db[_0xe302('0xa5')][_0xe302('0x6c')](_0x4c0a36);})['then'](function(_0x4448fb){_0x47039f['rows']=_0x4448fb;return _0x47039f;});}})[_0xe302('0x1e')](respondWithFilteredResult(_0x1a097a,_0x4c0a36))['catch'](handleError(_0x1a097a,null));};exports[_0xe302('0x87')]=function(_0x2be0e5,_0x283822,_0x5bc8e6){var _0x450d32,_0xdd33bc={},_0x37db61;if(_0x2be0e5[_0xe302('0x56')]['to']){_0x37db61=_0x2be0e5[_0xe302('0x56')]['to'][0x0];}return db[_0xe302('0x4e')][_0xe302('0x66')]({'where':{'id':_0x2be0e5[_0xe302('0x52')]['id']},'include':[{'model':db[_0xe302('0xa9')],'as':_0xe302('0xaa'),'include':[{'model':db[_0xe302('0x73')],'as':_0xe302('0xab'),'where':{'fax':_0x37db61},'limit':0x1,'order':[['updatedAt',_0xe302('0xac')]]}]}]})[_0xe302('0x1e')](handleEntityNotFound(_0x283822,null))[_0xe302('0x1e')](function(_0x45d422){_0x450d32=_0x45d422;if(_0x2be0e5[_0xe302('0x56')]['attachments']&&_0x2be0e5[_0xe302('0x56')]['attachments'][_0xe302('0x45')]){for(var _0x125d71=0x0;_0x125d71<_0x2be0e5['body'][_0xe302('0xad')]['length'];_0x125d71+=0x1){_0x2be0e5['body'][_0xe302('0xad')][_0x125d71]={'filename':_0x2be0e5['body'][_0xe302('0xad')][_0x125d71][_0xe302('0x38')],'id':_0x2be0e5[_0xe302('0x56')][_0xe302('0xad')][_0x125d71]['id'],'path':path[_0xe302('0xae')](config[_0xe302('0xaf')],_0xe302('0xb0'),_0x2be0e5[_0xe302('0x56')][_0xe302('0xad')][_0x125d71][_0xe302('0xb1')])};}}return respondWithRpcPromise(_0xe302('0xb2'),_0xe302('0xb2'),{'FaxAccountId':_[_0xe302('0xb3')](_0x2be0e5['params']['id'])?undefined:_0x2be0e5[_0xe302('0x52')]['id'],'path':_[_0xe302('0xb3')](_0x2be0e5[_0xe302('0x56')][_0xe302('0xad')][0x0][_0xe302('0x5')])?undefined:_0x2be0e5['body']['attachments'][0x0][_0xe302('0x5')],'fax':_[_0xe302('0xb3')](_0x2be0e5['body']['to'][0x0])?undefined:_0x2be0e5[_0xe302('0x56')]['to'][0x0]},client9002);})[_0xe302('0x1e')](function(){if(_0x450d32){if(_['isNil'](_0x2be0e5[_0xe302('0x56')][_0xe302('0xb4')])){_0x2be0e5['body'][_0xe302('0xb4')]=util[_0xe302('0xa8')](_0xe302('0xb5'),_0x450d32[_0xe302('0x38')],_0x450d32[_0xe302('0xb6')]);}if(_0x450d32[_0xe302('0xaa')]){if(_0x450d32['List']['Contacts'][_0xe302('0x45')]){return _0x450d32['List'][_0xe302('0xab')][0x0];}else{return db[_0xe302('0x73')][_0xe302('0x55')](_[_0xe302('0x15')](_0x2be0e5[_0xe302('0x56')],{'firstName':_0x2be0e5[_0xe302('0x56')]['to'][0x0],'phone':_0x2be0e5[_0xe302('0x56')]['to'][0x0],'fax':_0x2be0e5[_0xe302('0x56')]['to'][0x0],'ListId':_0x450d32[_0xe302('0xa2')]}));}}else{throw new Error(_0xe302('0xb7'));}}else{throw new Error(_0xe302('0xb8'));}})[_0xe302('0x1e')](function(_0x359621){if(_0x359621){return db[_0xe302('0x6f')][_0xe302('0x66')]({'where':{'ContactId':_0x359621['id'],'closed':![],'FaxAccountId':_0x450d32['id']}})[_0xe302('0x1e')](function(_0x3d96ff){if(_0x3d96ff){return[_0x3d96ff,![]];}return db['FaxInteraction'][_0xe302('0x55')]({'UserId':_0x2be0e5['user']['id'],'ContactId':_0x359621['id'],'FaxAccountId':_0x450d32['id'],'fax':_0x2be0e5['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xe302('0x4a')](_0x2be0e5[_0xe302('0x56')],{'read':![],'body':_0x2be0e5[_0xe302('0x56')]['attachments'][0x0][_0xe302('0xb9')],'FaxAccountId':_0x450d32['id'],'UserId':_0x2be0e5[_0xe302('0x57')]['id'],'ContactId':_0x359621['id'],'AttachmentId':_0x2be0e5['body'][_0xe302('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xe302('0xa5')],'as':_0xe302('0xba')}]})[_0xe302('0x1e')](function(_0x234b83){return[_0x234b83,!![]];});});}else{throw new Error(_0xe302('0xbb'));}})[_0xe302('0xbc')](function(_0x43573a,_0x5d0f8d){if(_0x5d0f8d){return _0x43573a;}return db[_0xe302('0xa5')][_0xe302('0x55')]({'direction':_0xe302('0xbd'),'read':![],'body':_0x2be0e5[_0xe302('0x56')][_0xe302('0xad')][0x0][_0xe302('0xb9')],'FaxAccountId':_0x450d32['id'],'FaxInteractionId':_0x43573a['id'],'UserId':_0x2be0e5[_0xe302('0x57')]['id'],'ContactId':_0x43573a['ContactId'],'AttachmentId':_0x2be0e5[_0xe302('0x56')]['attachments'][0x0]['id']})[_0xe302('0x1e')](function(_0x59d7e1){_0x43573a[_0xe302('0xbe')][_0xe302('0xba')]=[];_0x43573a[_0xe302('0xbe')][_0xe302('0xba')][_0xe302('0x8f')](_0x59d7e1[_0xe302('0xbe')]);return _0x43573a;});})[_0xe302('0x1e')](function(_0x2e87f1){respondWithRpcPromise(_0xe302('0xbf'),_0xe302('0xbf'),{'FaxAccountId':_[_0xe302('0xb3')](_0x2be0e5[_0xe302('0x52')]['id'])?undefined:_0x2be0e5[_0xe302('0x52')]['id'],'path':_['isNil'](_0x2be0e5['body'][_0xe302('0xad')][0x0][_0xe302('0x5')])?undefined:_0x2be0e5['body'][_0xe302('0xad')][0x0][_0xe302('0x5')],'fax':_[_0xe302('0xb3')](_0x2be0e5[_0xe302('0x56')]['to'][0x0])?undefined:_0x2be0e5[_0xe302('0x56')]['to'][0x0],'AttachmentId':_0x2be0e5[_0xe302('0x56')][_0xe302('0xad')][0x0]['id']},client9002)[_0xe302('0x1e')](function(_0x215e82){logger['info'](_0xe302('0xc0'),_0x215e82);})[_0xe302('0x26')](function(_0x4e8034){logger[_0xe302('0x1f')]('SendFaxRpc,\x20%s',_0x4e8034);});return _0x2e87f1;})[_0xe302('0x1e')](respondWithResult(_0x283822,null))[_0xe302('0x26')](handleError(_0x283822,null));};exports[_0xe302('0xc1')]=function(_0x47da59,_0x290cca,_0x20134c){return db[_0xe302('0x4e')][_0xe302('0x66')]({'where':{'id':_0x47da59[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x290cca,null))['then'](function(_0x2aeea8){if(_0x2aeea8){return _0x2aeea8[_0xe302('0xc1')](_0x47da59[_0xe302('0x56')][_0xe302('0x67')],_[_0xe302('0x70')](_0x47da59[_0xe302('0x56')],[_0xe302('0x67'),'id'])||{})[_0xe302('0xbc')](function(_0x37d0d8){for(var _0xf15a19=0x0;_0xf15a19<_0x47da59['body'][_0xe302('0x67')][_0xe302('0x45')];_0xf15a19+=0x1){socket[_0xe302('0xc2')](_0xe302('0xc3'),{'UserId':Number(_0x47da59['body']['ids'][_0xf15a19]),'FaxAccountId':Number(_0x47da59[_0xe302('0x52')]['id'])});}return _0x37d0d8;});}})[_0xe302('0x1e')](respondWithResult(_0x290cca,null))[_0xe302('0x26')](handleError(_0x290cca,null));};exports['removeAgents']=function(_0x5e44d3,_0x479c4c,_0x4f2d8e){return db[_0xe302('0x4e')][_0xe302('0x66')]({'where':{'id':_0x5e44d3['params']['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x479c4c,null))[_0xe302('0x1e')](function(_0x59a3b1){if(_0x59a3b1){return _0x59a3b1[_0xe302('0xc4')](_0x5e44d3[_0xe302('0x3f')][_0xe302('0x67')])[_0xe302('0x1e')](function(){if(_[_0xe302('0xc5')](_0x5e44d3['query']['ids'])){for(var _0x141031=0x0;_0x141031<_0x5e44d3[_0xe302('0x3f')][_0xe302('0x67')][_0xe302('0x45')];_0x141031+=0x1){socket[_0xe302('0xc2')](_0xe302('0xc6'),{'UserId':Number(_0x5e44d3[_0xe302('0x3f')]['ids'][_0x141031]),'FaxAccountId':Number(_0x5e44d3[_0xe302('0x52')]['id'])});}}else{socket['emit'](_0xe302('0xc6'),{'UserId':Number(_0x5e44d3[_0xe302('0x3f')]['ids']),'FaxAccountId':Number(_0x5e44d3[_0xe302('0x52')]['id'])});}});}})[_0xe302('0x1e')](respondWithStatusCode(_0x479c4c,null))[_0xe302('0x26')](handleError(_0x479c4c,null));};exports[_0xe302('0xc7')]=function(_0x517eca,_0x37dbd9,_0x42181e){var _0x3436b8={};var _0x2fce06={};var _0x3d5459;var _0x7b6e72;return db['FaxAccount'][_0xe302('0x60')]({'where':{'id':_0x517eca[_0xe302('0x52')]['id']}})[_0xe302('0x1e')](handleEntityNotFound(_0x37dbd9,null))[_0xe302('0x1e')](function(_0x2de9f7){if(_0x2de9f7){_0x3d5459=_0x2de9f7;_0x2fce06[_0xe302('0x3e')]=_[_0xe302('0x40')](db[_0xe302('0x75')][_0xe302('0x62')]);_0x2fce06[_0xe302('0x3f')]=_['keys'](_0x517eca['query']);_0x2fce06[_0xe302('0x41')]=_['intersection'](_0x2fce06[_0xe302('0x3e')],_0x2fce06[_0xe302('0x3f')]);_0x3436b8['attributes']=_['intersection'](_0x2fce06['model'],qs[_0xe302('0x44')](_0x517eca[_0xe302('0x3f')][_0xe302('0x44')]));_0x3436b8[_0xe302('0x43')]=_0x3436b8['attributes'][_0xe302('0x45')]?_0x3436b8[_0xe302('0x43')]:_0x2fce06[_0xe302('0x3e')];_0x3436b8[_0xe302('0x6b')]=qs[_0xe302('0x47')](_0x517eca['query'][_0xe302('0x47')]);_0x3436b8[_0xe302('0x48')]=qs[_0xe302('0x41')](_['pick'](_0x517eca[_0xe302('0x3f')],_0x2fce06[_0xe302('0x41')]));if(_0x517eca[_0xe302('0x3f')][_0xe302('0x49')]){_0x3436b8[_0xe302('0x48')]=_['merge'](_0x3436b8[_0xe302('0x48')],{'$or':_[_0xe302('0x3c')](_0x3436b8[_0xe302('0x43')],function(_0xa3818d){var _0x201063={};_0x201063[_0xa3818d]={'$like':'%'+_0x517eca['query'][_0xe302('0x49')]+'%'};return _0x201063;})});}_0x3436b8=_[_0xe302('0x4a')]({},_0x3436b8,_0x517eca[_0xe302('0x4d')]);return _0x3d5459[_0xe302('0xc7')](_0x3436b8);}})[_0xe302('0x1e')](function(_0x371591){if(_0x371591){_0x7b6e72=_0x371591[_0xe302('0x45')];if(!_0x517eca['query'][_0xe302('0x63')]('nolimit')){_0x3436b8['limit']=qs[_0xe302('0x2c')](_0x517eca['query'][_0xe302('0x2c')]);_0x3436b8[_0xe302('0x2b')]=qs['offset'](_0x517eca[_0xe302('0x3f')][_0xe302('0x2b')]);}return _0x3d5459[_0xe302('0xc7')](_0x3436b8);}})[_0xe302('0x1e')](function(_0x17756a){if(_0x17756a){return _0x17756a?{'count':_0x7b6e72,'rows':_0x17756a}:null;}})[_0xe302('0x1e')](respondWithResult(_0x37dbd9,null))[_0xe302('0x26')](handleError(_0x37dbd9,null));}; \ No newline at end of file +var _0xb00e=['removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request','then','info','debug','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','destroy','FaxAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','create','body','user','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','stack','json','getApplications','from-voip-provider','exten','localstationid','app','system','description','appdata','Answer','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','DESC','attachments','join','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save'];(function(_0x3df739,_0xfd6450){var _0x2ea45b=function(_0x3818aa){while(--_0x3818aa){_0x3df739['push'](_0x3df739['shift']());}};_0x2ea45b(++_0xfd6450);}(_0xb00e,0xc9));var _0xeb00=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xb00e[_0x1ab180];return _0xfb2c2d;};'use strict';var emlformat=require(_0xeb00('0x0'));var rimraf=require(_0xeb00('0x1'));var zipdir=require(_0xeb00('0x2'));var jsonpatch=require(_0xeb00('0x3'));var rp=require(_0xeb00('0x4'));var moment=require(_0xeb00('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb00('0x6'));var util=require(_0xeb00('0x7'));var path=require(_0xeb00('0x8'));var sox=require(_0xeb00('0x9'));var csv=require(_0xeb00('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb00('0xb'));var crypto=require(_0xeb00('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb00('0xa'));var querystring=require('querystring');var Papa=require(_0xeb00('0xd'));var Redis=require(_0xeb00('0xe'));var authService=require(_0xeb00('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeb00('0x10'));var hardwareService=require(_0xeb00('0x11'));var logger=require(_0xeb00('0x12'))(_0xeb00('0x13'));var utils=require(_0xeb00('0x14'));var config=require(_0xeb00('0x15'));var licenseUtil=require(_0xeb00('0x16'));var db=require(_0xeb00('0x17'))['db'];config[_0xeb00('0x18')]=_[_0xeb00('0x19')](config[_0xeb00('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb00('0x1a'))(new Redis(config[_0xeb00('0x18')]));require(_0xeb00('0x1b'))['register'](socket);var jayson=require(_0xeb00('0x1c'));var client=jayson['client'][_0xeb00('0x1d')]({'port':0x232c});var client9002=jayson[_0xeb00('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4266d4,_0x845b4,_0x17b47d,_0x54cf6c){return new BPromise(function(_0x250257,_0x51d4df){var _0x22e124=_0x54cf6c||client;return _0x22e124[_0xeb00('0x1f')](_0x4266d4,_0x17b47d)[_0xeb00('0x20')](function(_0x759bf2){logger[_0xeb00('0x21')]('FaxAccount,\x20%s,\x20%s',_0x845b4,'request\x20sent');logger[_0xeb00('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x845b4,_0xeb00('0x23'),JSON[_0xeb00('0x24')](_0x759bf2));if(_0x759bf2[_0xeb00('0x25')]){if(_0x759bf2[_0xeb00('0x25')][_0xeb00('0x26')]===0x1f4){logger[_0xeb00('0x25')](_0xeb00('0x27'),_0x845b4,_0x759bf2[_0xeb00('0x25')][_0xeb00('0x28')]);return _0x51d4df(_0x759bf2[_0xeb00('0x25')][_0xeb00('0x28')]);}logger[_0xeb00('0x25')](_0xeb00('0x27'),_0x845b4,_0x759bf2['error'][_0xeb00('0x28')]);return _0x250257(_0x759bf2['error']['message']);}else{logger[_0xeb00('0x21')]('FaxAccount,\x20%s,\x20%s',_0x845b4,_0xeb00('0x23'));_0x250257(_0x759bf2[_0xeb00('0x29')][_0xeb00('0x28')]);}})[_0xeb00('0x2a')](function(_0x3b62be){logger['error'](_0xeb00('0x27'),_0x845b4,_0x3b62be);_0x51d4df(_0x3b62be);});});}function respondWithStatusCode(_0x222612,_0x457f50){_0x457f50=_0x457f50||0xcc;return function(_0x587ca4){if(_0x587ca4){return _0x222612[_0xeb00('0x2b')](_0x457f50);}return _0x222612[_0xeb00('0x2c')](_0x457f50)[_0xeb00('0x2d')]();};}function respondWithResult(_0x4d06f7,_0x3f051e){_0x3f051e=_0x3f051e||0xc8;return function(_0x15629b){if(_0x15629b){return _0x4d06f7[_0xeb00('0x2c')](_0x3f051e)['json'](_0x15629b);}};}function respondWithFilteredResult(_0xe74e19,_0x414ded){return function(_0x5d514f){if(_0x5d514f){var _0xc95f15=typeof _0x414ded[_0xeb00('0x2e')]===_0xeb00('0x2f')&&typeof _0x414ded[_0xeb00('0x30')]===_0xeb00('0x2f');var _0xe76e08=_0x5d514f[_0xeb00('0x31')];var _0x5528a7=_0xc95f15?0x0:_0x414ded[_0xeb00('0x2e')];var _0x4dd261=_0xc95f15?_0x5d514f[_0xeb00('0x31')]:_0x414ded[_0xeb00('0x2e')]+_0x414ded[_0xeb00('0x30')];var _0x873c0;if(_0x4dd261>=_0xe76e08){_0x4dd261=_0xe76e08;_0x873c0=0xc8;}else{_0x873c0=0xce;}_0xe74e19['status'](_0x873c0);return _0xe74e19[_0xeb00('0x32')](_0xeb00('0x33'),_0x5528a7+'-'+_0x4dd261+'/'+_0xe76e08)['json'](_0x5d514f);}return null;};}function patchUpdates(_0x1b2990){return function(_0x14b810){try{jsonpatch['apply'](_0x14b810,_0x1b2990,!![]);}catch(_0x553435){return BPromise['reject'](_0x553435);}return _0x14b810[_0xeb00('0x34')]();};}function saveUpdates(_0x30150a,_0x9c8862){return function(_0x2c92dc){if(_0x2c92dc){return _0x2c92dc['update'](_0x30150a)['then'](function(_0x399baa){return _0x399baa;});}return null;};}function removeEntity(_0x45ba8b,_0x142420){return function(_0x118c69){if(_0x118c69){return _0x118c69[_0xeb00('0x35')]()[_0xeb00('0x20')](function(){var _0x5d599a=_0x118c69['get']({'plain':!![]});var _0x277e70=_0xeb00('0x36');return db[_0xeb00('0x37')][_0xeb00('0x35')]({'where':{'type':_0x277e70,'resourceId':_0x5d599a['id']}})[_0xeb00('0x20')](function(){return _0x118c69;});})[_0xeb00('0x20')](function(){_0x45ba8b[_0xeb00('0x2c')](0xcc)[_0xeb00('0x2d')]();});}};}function handleEntityNotFound(_0x321ac4,_0xb08c91){return function(_0x2d3fe7){if(!_0x2d3fe7){_0x321ac4[_0xeb00('0x2b')](0x194);}return _0x2d3fe7;};}function handleError(_0x20eb12,_0x46b90d){_0x46b90d=_0x46b90d||0x1f4;return function(_0x5e98e2){logger[_0xeb00('0x25')](_0x5e98e2['stack']);if(_0x5e98e2[_0xeb00('0x38')]){delete _0x5e98e2[_0xeb00('0x38')];}_0x20eb12[_0xeb00('0x2c')](_0x46b90d)[_0xeb00('0x39')](_0x5e98e2);};}exports[_0xeb00('0x3a')]=function(_0x41a0f2,_0xf4d0c4){var _0x5e1b4d={'include':[{'model':db['Pause'],'as':_0xeb00('0x3b')}]},_0x54abd8={},_0x1a4cb2={'count':0x0,'rows':[]};var _0x30e447=_['map'](db[_0xeb00('0x3c')][_0xeb00('0x3d')],function(_0x34100b){return{'name':_0x34100b[_0xeb00('0x3e')],'type':_0x34100b[_0xeb00('0x3f')][_0xeb00('0x40')]};});_0x54abd8[_0xeb00('0x41')]=_[_0xeb00('0x42')](_0x30e447,'name');_0x54abd8['query']=_[_0xeb00('0x43')](_0x41a0f2['query']);_0x54abd8[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0x54abd8['model'],_0x54abd8[_0xeb00('0x46')]);_0x5e1b4d[_0xeb00('0x47')]=_['intersection'](_0x54abd8[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x41a0f2['query'][_0xeb00('0x48')]));_0x5e1b4d[_0xeb00('0x47')]=_0x5e1b4d[_0xeb00('0x47')][_0xeb00('0x49')]?_0x5e1b4d['attributes']:_0x54abd8[_0xeb00('0x41')];if(!_0x41a0f2[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x5e1b4d[_0xeb00('0x30')]=qs[_0xeb00('0x30')](_0x41a0f2[_0xeb00('0x46')][_0xeb00('0x30')]);_0x5e1b4d[_0xeb00('0x2e')]=qs[_0xeb00('0x2e')](_0x41a0f2['query'][_0xeb00('0x2e')]);}_0x5e1b4d[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x41a0f2[_0xeb00('0x46')]['sort']);_0x5e1b4d[_0xeb00('0x4e')]=qs['filters'](_[_0xeb00('0x4f')](_0x41a0f2[_0xeb00('0x46')],_0x54abd8[_0xeb00('0x44')]),_0x30e447);if(_0x41a0f2[_0xeb00('0x46')][_0xeb00('0x50')]){_0x5e1b4d[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x5e1b4d[_0xeb00('0x4e')],{'$or':_['map'](_0x30e447,function(_0x5a7db8){if(_0x5a7db8['type']!==_0xeb00('0x52')){var _0x22b940={};_0x22b940[_0x5a7db8[_0xeb00('0x38')]]={'$like':'%'+_0x41a0f2['query'][_0xeb00('0x50')]+'%'};return _0x22b940;}})});}_0x5e1b4d=_[_0xeb00('0x51')]({},_0x5e1b4d,_0x41a0f2[_0xeb00('0x53')]);var _0x3920a4={'where':_0x5e1b4d[_0xeb00('0x4e')]};return db['FaxAccount'][_0xeb00('0x31')](_0x3920a4)[_0xeb00('0x20')](function(_0x4c50d2){_0x1a4cb2['count']=_0x4c50d2;if(_0x41a0f2[_0xeb00('0x46')]['includeAll']){_0x5e1b4d[_0xeb00('0x54')]=[{'all':!![]}];}return db[_0xeb00('0x3c')][_0xeb00('0x55')](_0x5e1b4d);})[_0xeb00('0x20')](function(_0x1a0dda){_0x1a4cb2[_0xeb00('0x56')]=_0x1a0dda;return _0x1a4cb2;})[_0xeb00('0x20')](respondWithFilteredResult(_0xf4d0c4,_0x5e1b4d))[_0xeb00('0x2a')](handleError(_0xf4d0c4,null));};exports[_0xeb00('0x57')]=function(_0x1fdb86,_0x113fbb){var _0x452a13={'raw':![],'where':{'id':_0x1fdb86[_0xeb00('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xeb00('0x3b')}]},_0x1d95ea={};_0x1d95ea[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x3c')][_0xeb00('0x3d')]);_0x1d95ea[_0xeb00('0x46')]=_[_0xeb00('0x43')](_0x1fdb86[_0xeb00('0x46')]);_0x1d95ea['filters']=_[_0xeb00('0x45')](_0x1d95ea['model'],_0x1d95ea[_0xeb00('0x46')]);_0x452a13['attributes']=_[_0xeb00('0x45')](_0x1d95ea[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x1fdb86[_0xeb00('0x46')][_0xeb00('0x48')]));_0x452a13[_0xeb00('0x47')]=_0x452a13['attributes'][_0xeb00('0x49')]?_0x452a13[_0xeb00('0x47')]:_0x1d95ea[_0xeb00('0x41')];if(_0x1fdb86[_0xeb00('0x46')][_0xeb00('0x59')]){_0x452a13[_0xeb00('0x54')]=[{'all':!![]}];}_0x452a13=_[_0xeb00('0x51')]({},_0x452a13,_0x1fdb86[_0xeb00('0x53')]);return db[_0xeb00('0x3c')]['find'](_0x452a13)[_0xeb00('0x20')](handleEntityNotFound(_0x113fbb,null))['then'](respondWithResult(_0x113fbb,null))['catch'](handleError(_0x113fbb,null));};exports[_0xeb00('0x5a')]=function(_0x17abbb,_0x5e6a9a){return db['FaxAccount']['create'](_0x17abbb[_0xeb00('0x5b')],{})['then'](function(_0x229102){var _0x3e2a24=_0x17abbb[_0xeb00('0x5c')][_0xeb00('0x5d')]({'plain':!![]});if(!_0x3e2a24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e2a24[_0xeb00('0x5e')]===_0xeb00('0x5c')){var _0x4fe41c=_0x229102[_0xeb00('0x5d')]({'plain':!![]});var _0x161e54=_0xeb00('0x36');return db['UserProfileSection'][_0xeb00('0x5f')]({'where':{'name':_0x161e54,'userProfileId':_0x3e2a24[_0xeb00('0x60')]},'raw':!![]})[_0xeb00('0x20')](function(_0x3c8832){if(_0x3c8832&&_0x3c8832[_0xeb00('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fe41c[_0xeb00('0x38')],'resourceId':_0x4fe41c['id'],'type':_0x3c8832['name'],'sectionId':_0x3c8832['id']},{})[_0xeb00('0x20')](function(){return _0x229102;});}else{return _0x229102;}})[_0xeb00('0x2a')](function(_0x535e65){logger[_0xeb00('0x25')](_0xeb00('0x62'),_0x535e65);throw _0x535e65;});}return _0x229102;})['then'](respondWithResult(_0x5e6a9a,0xc9))[_0xeb00('0x2a')](handleError(_0x5e6a9a,null));};exports[_0xeb00('0x63')]=function(_0x5e3ed6,_0x4c0ff3){if(_0x5e3ed6[_0xeb00('0x5b')]['id']){delete _0x5e3ed6[_0xeb00('0x5b')]['id'];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x5e3ed6['params']['id']},'include':[{'model':db[_0xeb00('0x64')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4c0ff3,null))[_0xeb00('0x20')](saveUpdates(_0x5e3ed6[_0xeb00('0x5b')],null))[_0xeb00('0x20')](respondWithResult(_0x4c0ff3,null))[_0xeb00('0x2a')](handleError(_0x4c0ff3,null));};exports[_0xeb00('0x35')]=function(_0x155d32,_0x258f9c){return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x155d32[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x258f9c,null))[_0xeb00('0x20')](removeEntity(_0x258f9c,null))[_0xeb00('0x2a')](handleError(_0x258f9c,null));};exports[_0xeb00('0x65')]=function(_0x2af283,_0x2c5452){return db['FaxAccount'][_0xeb00('0x65')]()[_0xeb00('0x20')](respondWithResult(_0x2c5452,null))[_0xeb00('0x2a')](handleError(_0x2c5452,null));};exports[_0xeb00('0x66')]=function(_0xb3d201,_0x2d5a35,_0x49f484){if(_0xb3d201['body']['id']){delete _0xb3d201['body']['id'];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0xb3d201[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x2d5a35,null))[_0xeb00('0x20')](function(_0x1a4a18){if(_0x1a4a18){_0xb3d201['body'][_0xeb00('0x67')]=_0x1a4a18['id'];return db[_0xeb00('0x68')][_0xeb00('0x5a')](_0xb3d201[_0xeb00('0x5b')]);}})['then'](respondWithResult(_0x2d5a35,null))[_0xeb00('0x2a')](handleError(_0x2d5a35,null));};exports[_0xeb00('0x69')]=function(_0x572863,_0x405b03,_0x365614){var _0x324eb4={'raw':![],'where':{}};var _0x1e282a={};var _0xbb1041={'count':0x0,'rows':[]};return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x572863[_0xeb00('0x58')]['id']}})['then'](handleEntityNotFound(_0x405b03,null))['then'](function(_0x9aba1f){if(_0x9aba1f){_0x1e282a[_0xeb00('0x41')]=_['keys'](db[_0xeb00('0x68')]['rawAttributes']);_0x1e282a[_0xeb00('0x46')]=_[_0xeb00('0x43')](_0x572863['query']);_0x1e282a[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0x1e282a[_0xeb00('0x41')],_0x1e282a[_0xeb00('0x46')]);_0x324eb4[_0xeb00('0x47')]=_[_0xeb00('0x45')](_0x1e282a[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x572863['query'][_0xeb00('0x48')]));_0x324eb4['attributes']=_0x324eb4['attributes'][_0xeb00('0x49')]?_0x324eb4['attributes']:_0x1e282a['model'];if(!_0x572863[_0xeb00('0x46')]['hasOwnProperty']('nolimit')){_0x324eb4[_0xeb00('0x30')]=qs[_0xeb00('0x30')](_0x572863[_0xeb00('0x46')][_0xeb00('0x30')]);_0x324eb4[_0xeb00('0x2e')]=qs['offset'](_0x572863[_0xeb00('0x46')][_0xeb00('0x2e')]);}_0x324eb4[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x572863[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x324eb4[_0xeb00('0x4e')]=qs[_0xeb00('0x44')](_['pick'](_0x572863[_0xeb00('0x46')],_0x1e282a[_0xeb00('0x44')]));_0x324eb4[_0xeb00('0x4e')]['FaxAccountId']=_0x9aba1f['id'];if(_0x572863['query'][_0xeb00('0x50')]){_0x324eb4[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x324eb4[_0xeb00('0x4e')],{'$or':_[_0xeb00('0x42')](_0x324eb4['attributes'],function(_0x59b2ff){var _0x3bbacb={};_0x3bbacb[_0x59b2ff]={'$like':'%'+_0x572863[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x3bbacb;})});}_0x324eb4=_[_0xeb00('0x51')]({},_0x324eb4,_0x572863[_0xeb00('0x53')]);return db[_0xeb00('0x68')][_0xeb00('0x31')]({'where':_0x324eb4[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x1fa13c){_0xbb1041['count']=_0x1fa13c;if(_0x572863[_0xeb00('0x46')][_0xeb00('0x59')]){_0x324eb4[_0xeb00('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xeb00('0x55')](_0x324eb4);})[_0xeb00('0x20')](function(_0x3b0bb7){_0xbb1041['rows']=_0x3b0bb7;return _0xbb1041;});}})['then'](respondWithFilteredResult(_0x405b03,_0x324eb4))['catch'](handleError(_0x405b03,null));};exports[_0xeb00('0x6b')]=function(_0x583d06,_0x356401,_0x573f0c){return db[_0xeb00('0x3c')]['find']({'where':{'id':_0x583d06['params']['id']}})['then'](handleEntityNotFound(_0x356401,null))[_0xeb00('0x20')](function(_0x592acd){if(_0x592acd){return _0x592acd[_0xeb00('0x6b')](_0x583d06[_0xeb00('0x46')][_0xeb00('0x6c')]);}})[_0xeb00('0x20')](respondWithStatusCode(_0x356401,null))[_0xeb00('0x2a')](handleError(_0x356401,null));};exports['addAnswer']=function(_0x37d430,_0x1dc81a,_0x53e9ec){if(_0x37d430[_0xeb00('0x5b')]['id']){delete _0x37d430[_0xeb00('0x5b')]['id'];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x37d430[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x1dc81a,null))[_0xeb00('0x20')](function(_0x2ea338){if(_0x2ea338){_0x37d430['body'][_0xeb00('0x67')]=_0x2ea338['id'];return db[_0xeb00('0x6d')]['create'](_0x37d430['body']);}})[_0xeb00('0x20')](respondWithResult(_0x1dc81a,null))[_0xeb00('0x2a')](handleError(_0x1dc81a,null));};exports[_0xeb00('0x6e')]=function(_0x414a02,_0x20e876,_0x3ed0f4){var _0x299119={'raw':![],'where':{}};var _0xf17045={};var _0x38f14d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xeb00('0x6a')]({'where':{'id':_0x414a02['params']['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x20e876,null))[_0xeb00('0x20')](function(_0x4a1069){if(_0x4a1069){_0xf17045[_0xeb00('0x41')]=_['keys'](db[_0xeb00('0x6d')]['rawAttributes']);_0xf17045['query']=_[_0xeb00('0x43')](_0x414a02[_0xeb00('0x46')]);_0xf17045[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0xf17045[_0xeb00('0x41')],_0xf17045['query']);_0x299119[_0xeb00('0x47')]=_['intersection'](_0xf17045['model'],qs[_0xeb00('0x48')](_0x414a02[_0xeb00('0x46')]['fields']));_0x299119['attributes']=_0x299119[_0xeb00('0x47')][_0xeb00('0x49')]?_0x299119[_0xeb00('0x47')]:_0xf17045[_0xeb00('0x41')];if(!_0x414a02[_0xeb00('0x46')][_0xeb00('0x4a')]('nolimit')){_0x299119[_0xeb00('0x30')]=qs['limit'](_0x414a02[_0xeb00('0x46')][_0xeb00('0x30')]);_0x299119['offset']=qs[_0xeb00('0x2e')](_0x414a02['query'][_0xeb00('0x2e')]);}_0x299119['order']=qs[_0xeb00('0x4d')](_0x414a02[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x299119['where']=qs['filters'](_[_0xeb00('0x4f')](_0x414a02[_0xeb00('0x46')],_0xf17045[_0xeb00('0x44')]));_0x299119[_0xeb00('0x4e')][_0xeb00('0x67')]=_0x4a1069['id'];if(_0x414a02[_0xeb00('0x46')][_0xeb00('0x50')]){_0x299119[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x299119['where'],{'$or':_['map'](_0x299119[_0xeb00('0x47')],function(_0x2526b7){var _0x39dcd6={};_0x39dcd6[_0x2526b7]={'$like':'%'+_0x414a02[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x39dcd6;})});}_0x299119=_['merge']({},_0x299119,_0x414a02[_0xeb00('0x53')]);return db[_0xeb00('0x6d')][_0xeb00('0x31')]({'where':_0x299119[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x4f9819){_0x38f14d[_0xeb00('0x31')]=_0x4f9819;if(_0x414a02[_0xeb00('0x46')]['includeAll']){_0x299119[_0xeb00('0x54')]=[{'all':!![]}];}return db[_0xeb00('0x6d')][_0xeb00('0x55')](_0x299119);})['then'](function(_0x148a8c){_0x38f14d[_0xeb00('0x56')]=_0x148a8c;return _0x38f14d;});}})[_0xeb00('0x20')](respondWithFilteredResult(_0x20e876,_0x299119))[_0xeb00('0x2a')](handleError(_0x20e876,null));};exports[_0xeb00('0x6f')]=function(_0x982d82,_0x281b18,_0x51e1da){return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x982d82['params']['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x281b18,null))['then'](function(_0x5970cd){if(_0x5970cd){return _0x5970cd[_0xeb00('0x6f')](_0x982d82['query']['ids']);}})[_0xeb00('0x20')](respondWithStatusCode(_0x281b18,null))['catch'](handleError(_0x281b18,null));};exports[_0xeb00('0x70')]=function(_0x5d1073,_0x38f1db,_0x52195b){return db['FaxInteraction'][_0xeb00('0x5f')]({'where':{'id':_0x5d1073[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x38f1db,null))[_0xeb00('0x20')](function(_0x1d01f1){if(_0x1d01f1){return _0x1d01f1[_0xeb00('0x70')](_0x5d1073[_0xeb00('0x5b')]['ids'],_['omit'](_0x5d1073['body'],[_0xeb00('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x38f1db,null))[_0xeb00('0x2a')](handleError(_0x38f1db,null));};exports[_0xeb00('0x71')]=function(_0x26ea0a,_0x7895b0,_0x1e0436){var _0x1f3766={'raw':![],'where':{}};var _0x2a40a9={};var _0x13bf85={'count':0x0,'rows':[]};return db[_0xeb00('0x3c')]['findOne']({'where':{'id':_0x26ea0a[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x7895b0,null))[_0xeb00('0x20')](function(_0x269988){if(_0x269988){_0x2a40a9[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x72')][_0xeb00('0x3d')]);_0x2a40a9['query']=_[_0xeb00('0x43')](_0x26ea0a[_0xeb00('0x46')]);_0x2a40a9[_0xeb00('0x44')]=_[_0xeb00('0x45')](_0x2a40a9[_0xeb00('0x41')],_0x2a40a9[_0xeb00('0x46')]);_0x1f3766['attributes']=_[_0xeb00('0x45')](_0x2a40a9['model'],qs[_0xeb00('0x48')](_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x48')]));_0x1f3766[_0xeb00('0x47')]=_0x1f3766[_0xeb00('0x47')][_0xeb00('0x49')]?_0x1f3766[_0xeb00('0x47')]:_0x2a40a9[_0xeb00('0x41')];if(!_0x26ea0a['query'][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x1f3766['limit']=qs[_0xeb00('0x30')](_0x26ea0a[_0xeb00('0x46')]['limit']);_0x1f3766['offset']=qs[_0xeb00('0x2e')](_0x26ea0a['query'][_0xeb00('0x2e')]);}_0x1f3766[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x1f3766[_0xeb00('0x4e')]=qs['filters'](_[_0xeb00('0x4f')](_0x26ea0a[_0xeb00('0x46')],_0x2a40a9[_0xeb00('0x44')]));_0x1f3766[_0xeb00('0x4e')][_0xeb00('0x67')]=_0x269988['id'];if(_0x26ea0a[_0xeb00('0x46')]['filter']){_0x1f3766[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x1f3766[_0xeb00('0x4e')],{'$or':_['map'](_0x1f3766[_0xeb00('0x47')],function(_0x267135){var _0x9ed0a2={};_0x9ed0a2[_0x267135]={'$like':'%'+_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x9ed0a2;})});}_0x1f3766=_[_0xeb00('0x51')]({},_0x1f3766,_0x26ea0a[_0xeb00('0x53')]);return db[_0xeb00('0x72')][_0xeb00('0x31')]({'where':_0x1f3766[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x19af6f){_0x13bf85[_0xeb00('0x31')]=_0x19af6f;if(_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x59')]){_0x1f3766['include']=[{'model':db[_0xeb00('0x73')],'as':_0xeb00('0x74'),'required':![]},{'model':db[_0xeb00('0x75')],'as':_0xeb00('0x76'),'attributes':[_0xeb00('0x38'),_0xeb00('0x77'),_0xeb00('0x78')],'required':![]},{'model':db[_0xeb00('0x79')],'as':_0xeb00('0x7a'),'attributes':['id',_0xeb00('0x38'),_0xeb00('0x7b')],'where':_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x7c')]?{'id':_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x7c')]}:undefined,'required':_0x26ea0a[_0xeb00('0x46')][_0xeb00('0x7c')]?!![]:![]}];}return db[_0xeb00('0x72')][_0xeb00('0x55')](_0x1f3766);})[_0xeb00('0x20')](function(_0x39156a){_0x13bf85[_0xeb00('0x56')]=_0x39156a;return _0x13bf85;});}})['then'](respondWithFilteredResult(_0x7895b0,_0x1f3766))['catch'](handleError(_0x7895b0,null));};exports[_0xeb00('0x7d')]=function(_0x3852be,_0x4a1420){var _0x77f06e=_0x3852be['params']['id'];var _0x383bfc=_0x3852be[_0xeb00('0x5b')];var _0x29051e=0xc8;var _0x22099b=null;return db[_0xeb00('0x7e')][_0xeb00('0x7f')]({'isolationLevel':db[_0xeb00('0x7e')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x19dbb6){return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x77f06e},'transaction':_0x19dbb6})[_0xeb00('0x20')](function(_0x339820){if(_0x339820){return db[_0xeb00('0x80')]['destroy']({'where':{'FaxAccountId':_0x77f06e},'transaction':_0x19dbb6})['then'](function(){var _0x36fe11=_[_0xeb00('0x42')](_0x383bfc,function(_0xdc4134){_0xdc4134[_0xeb00('0x67')]=_0x77f06e;return _0xdc4134;});return db[_0xeb00('0x80')]['bulkCreate'](_0x36fe11,{'transaction':_0x19dbb6});});}else{_0x29051e=0x194;_0x22099b=[];}});})['then'](function(){if(_0x29051e!==0x194){return db[_0xeb00('0x80')][_0xeb00('0x81')]({'where':{'FaxAccountId':_0x77f06e},'order':_0xeb00('0x82')})[_0xeb00('0x20')](function(_0x308fc2){_0x22099b=_0x308fc2;});}})[_0xeb00('0x2a')](function(_0x13de1a){_0x29051e=0x1f4;logger[_0xeb00('0x25')](_0x13de1a[_0xeb00('0x83')]);if(_0x13de1a[_0xeb00('0x38')]){delete _0x13de1a[_0xeb00('0x38')];}_0x22099b=_0x13de1a;})['finally'](function(){if(_0x22099b===null){_0x4a1420[_0xeb00('0x2b')](_0x29051e);}else{if(_0x29051e===0x1f4){_0x4a1420[_0xeb00('0x2c')](_0x29051e)['send'](_0x22099b);}else{_0x4a1420[_0xeb00('0x2c')](_0x29051e)[_0xeb00('0x84')](_0x22099b);}}});};exports[_0xeb00('0x85')]=function(_0x95962c,_0x3cd6d6,_0x3e37a6){var _0x3a24f8={};var _0x427173={};var _0x25590e;var _0x1434ee;return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x95962c[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x3cd6d6,null))['then'](function(_0x2827f9){if(_0x2827f9){_0x25590e=_0x2827f9;_0x427173[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x80')]['rawAttributes']);_0x427173['query']=_[_0xeb00('0x43')](_0x95962c['query']);_0x427173[_0xeb00('0x44')]=_['intersection'](_0x427173[_0xeb00('0x41')],_0x427173[_0xeb00('0x46')]);_0x3a24f8['attributes']=_[_0xeb00('0x45')](_0x427173[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x95962c['query'][_0xeb00('0x48')]));_0x3a24f8[_0xeb00('0x47')]=_0x3a24f8[_0xeb00('0x47')][_0xeb00('0x49')]?_0x3a24f8[_0xeb00('0x47')]:_0x427173['model'];_0x3a24f8[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x95962c['query'][_0xeb00('0x4d')]);_0x3a24f8[_0xeb00('0x4e')]=qs['filters'](_['pick'](_0x95962c[_0xeb00('0x46')],_0x427173[_0xeb00('0x44')]));if(_0x95962c[_0xeb00('0x46')][_0xeb00('0x50')]){_0x3a24f8[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x3a24f8[_0xeb00('0x4e')],{'$or':_['map'](_0x3a24f8[_0xeb00('0x47')],function(_0x22c6f0){var _0x1569eb={};_0x1569eb[_0x22c6f0]={'$like':'%'+_0x95962c[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x1569eb;})});}_0x3a24f8=_[_0xeb00('0x51')]({},_0x3a24f8,_0x95962c[_0xeb00('0x53')]);return _0x25590e[_0xeb00('0x85')](_0x3a24f8);}})[_0xeb00('0x20')](function(_0x5c3d1e){if(_0x5c3d1e){_0x1434ee=_0x5c3d1e['length'];if(!_0x95962c[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x3a24f8['limit']=qs[_0xeb00('0x30')](_0x95962c[_0xeb00('0x46')][_0xeb00('0x30')]);_0x3a24f8[_0xeb00('0x2e')]=qs[_0xeb00('0x2e')](_0x95962c[_0xeb00('0x46')][_0xeb00('0x2e')]);}return _0x25590e[_0xeb00('0x85')](_0x3a24f8);}})[_0xeb00('0x20')](function(_0x5400f9){if(_0x5400f9){return _0x5400f9?{'count':_0x1434ee,'rows':_0x5400f9}:null;}})[_0xeb00('0x20')](respondWithResult(_0x3cd6d6,null))[_0xeb00('0x2a')](handleError(_0x3cd6d6,null));};function Extension(_0x18dad2,_0x3c69b8,_0x36be05,_0x57e426){this['context']=_0xeb00('0x86');this[_0xeb00('0x87')]=_0x18dad2[_0xeb00('0x88')];this[_0xeb00('0x89')]=_0x57e426;this[_0xeb00('0x3f')]=_0xeb00('0x8a');this[_0xeb00('0x8b')]='Fax\x20Extension';this['FaxAccountId']=_0x18dad2['id'];this[_0xeb00('0x82')]=_0x3c69b8;this[_0xeb00('0x8c')]=_0x36be05;}function createExtensionsReciveFax(_0x5e4bf2){var _0x35f926=0x1;var _0x3d8cec=[];_0x3d8cec['push'](new Extension(_0x5e4bf2,_0x35f926,'',_0xeb00('0x8d')));_0x35f926+=0x1;_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,_0xeb00('0x8f'),'Set'));_0x35f926+=0x1;for(var _0x44b60e in _0x5e4bf2){if(_0x5e4bf2[_0xeb00('0x4a')](_0x44b60e)&&(_0x44b60e==='ecm'||_0x44b60e===_0xeb00('0x88')||_0x44b60e===_0xeb00('0x90')||_0x44b60e===_0xeb00('0x91')||_0x44b60e===_0xeb00('0x92')||_0x44b60e===_0xeb00('0x93')||_0x44b60e==='minrate'||_0x44b60e===_0xeb00('0x94')||_0x44b60e===_0xeb00('0x95'))){_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,'FAXOPT('+_0x44b60e+')='+_0x5e4bf2[_0x44b60e],_0xeb00('0x96')));_0x35f926+=0x1;}}_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,'6',_0xeb00('0x97')));_0x35f926+=0x1;_0x3d8cec[_0xeb00('0x8e')](new Extension(_0x5e4bf2,_0x35f926,_0xeb00('0x98'),_0xeb00('0x99')));_0x35f926=0x0;return _0x3d8cec;}exports[_0xeb00('0x9a')]=function(_0x1b3f80,_0x54e61c,_0x35c84f){var _0x52be40;return db['sequelize'][_0xeb00('0x7f')](function(_0x76dc78){return db[_0xeb00('0x3c')]['create'](_0x1b3f80[_0xeb00('0x5b')],{'transaction':_0x76dc78})['then'](function(_0x2dfb4c){_0x52be40=_0x2dfb4c[_0xeb00('0x5d')]({'plain':!![]});return db[_0xeb00('0x9b')][_0xeb00('0x9c')](createExtensionsReciveFax(_0x52be40),{'transaction':_0x76dc78});});})[_0xeb00('0x20')](function(){return _0x52be40;})[_0xeb00('0x20')](respondWithResult(_0x54e61c,null))[_0xeb00('0x2a')](handleError(_0x54e61c,null));};exports[_0xeb00('0x9d')]=function(_0x5a80a5,_0x296b8f,_0x2d3d97){var _0x315e54;return db[_0xeb00('0x7e')][_0xeb00('0x7f')](function(_0x7544c5){return db[_0xeb00('0x3c')][_0xeb00('0x63')](_0x5a80a5[_0xeb00('0x5b')],{'where':{'id':_0x5a80a5['body']['id']},'transaction':_0x7544c5})['then'](function(_0x10d6bc){return db[_0xeb00('0x9b')][_0xeb00('0x35')]({'where':{'FaxAccountId':_0x5a80a5[_0xeb00('0x5b')]['id']},'transaction':_0x7544c5})[_0xeb00('0x20')](function(_0x30a807){return db[_0xeb00('0x9b')][_0xeb00('0x9c')](createExtensionsReciveFax(_[_0xeb00('0x9e')](_0x5a80a5[_0xeb00('0x5b')],[_0xeb00('0x9f'),'key',_0xeb00('0xa0'),_0xeb00('0xa1'),_0xeb00('0xa2'),_0xeb00('0xa3')])),{'transaction':_0x7544c5});});});})[_0xeb00('0x20')](function(){return db[_0xeb00('0x3c')]['findById'](_0x5a80a5[_0xeb00('0x5b')]['id']);})['then'](respondWithResult(_0x296b8f,null))[_0xeb00('0x2a')](handleError(_0x296b8f,null));};exports[_0xeb00('0xa4')]=function(_0x4b9837,_0x42f827,_0x150495){var _0x229b71={'raw':!![],'where':{}};var _0x391e2c={};var _0x104b00={'count':0x0,'rows':[]};return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x4b9837[_0xeb00('0x58')]['id']}})['then'](handleEntityNotFound(_0x42f827,null))[_0xeb00('0x20')](function(_0x38dde0){if(_0x38dde0){_0x391e2c['model']=_['keys'](db['FaxMessage'][_0xeb00('0x3d')]);_0x391e2c[_0xeb00('0x46')]=_[_0xeb00('0x43')](_0x4b9837['query']);_0x391e2c[_0xeb00('0x44')]=_['intersection'](_0x391e2c[_0xeb00('0x41')],_0x391e2c[_0xeb00('0x46')]);_0x229b71[_0xeb00('0x47')]=_['intersection'](_0x391e2c[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x4b9837[_0xeb00('0x46')]['fields']));_0x229b71[_0xeb00('0x47')]=_0x229b71[_0xeb00('0x47')][_0xeb00('0x49')]?_0x229b71['attributes']:_0x391e2c[_0xeb00('0x41')];if(!_0x4b9837[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x229b71[_0xeb00('0x30')]=qs[_0xeb00('0x30')](_0x4b9837[_0xeb00('0x46')][_0xeb00('0x30')]);_0x229b71[_0xeb00('0x2e')]=qs[_0xeb00('0x2e')](_0x4b9837[_0xeb00('0x46')][_0xeb00('0x2e')]);}_0x229b71[_0xeb00('0x4c')]=qs[_0xeb00('0x4d')](_0x4b9837[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x229b71[_0xeb00('0x4e')]=qs[_0xeb00('0x44')](_['pick'](_0x4b9837[_0xeb00('0x46')],_0x391e2c['filters']));_0x229b71[_0xeb00('0x4e')][_0xeb00('0x67')]=_0x38dde0['id'];if(_0x4b9837['query'][_0xeb00('0x50')]){_0x229b71['where']=_[_0xeb00('0x51')](_0x229b71[_0xeb00('0x4e')],{'$or':_['map'](_0x229b71[_0xeb00('0x47')],function(_0x41b9c9){var _0x271175={};_0x271175[_0x41b9c9]={'$like':'%'+_0x4b9837[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x271175;})});}if(_0x4b9837[_0xeb00('0x46')]['$gte']){var _0xb0452b=_0x4b9837[_0xeb00('0x46')]['$gte']['split'](',');var _0x12f843={};_0x12f843[_0xb0452b[0x0]]={'$gte':moment(_0xb0452b[0x1])[_0xeb00('0xa5')](_0xeb00('0xa6'))};_0x229b71[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x229b71['where'],_0x12f843);}_0x229b71=_['merge']({},_0x229b71,_0x4b9837['options']);return db[_0xeb00('0xa7')]['count']({'where':_0x229b71[_0xeb00('0x4e')]})[_0xeb00('0x20')](function(_0x506f56){_0x104b00['count']=_0x506f56;if(_0x4b9837[_0xeb00('0x46')][_0xeb00('0x59')]){_0x229b71[_0xeb00('0x54')]=[{'all':!![]}];}return db[_0xeb00('0xa7')]['findAll'](_0x229b71);})[_0xeb00('0x20')](function(_0x56a70b){_0x104b00[_0xeb00('0x56')]=_0x56a70b;return _0x104b00;});}})[_0xeb00('0x20')](respondWithFilteredResult(_0x42f827,_0x229b71))['catch'](handleError(_0x42f827,null));};exports[_0xeb00('0x39')]=function(_0x27efab,_0x5edbb1,_0x5c76d7){var _0x188cf8,_0x5727ca={},_0x1d5374;if(_0x27efab[_0xeb00('0x5b')]['to']){_0x1d5374=_0x27efab['body']['to'][0x0];}return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x27efab[_0xeb00('0x58')]['id']},'include':[{'model':db[_0xeb00('0xa8')],'as':_0xeb00('0xa9'),'include':[{'model':db[_0xeb00('0x73')],'as':'Contacts','where':{'fax':_0x1d5374},'limit':0x1,'order':[['updatedAt',_0xeb00('0xaa')]]}]}]})[_0xeb00('0x20')](handleEntityNotFound(_0x5edbb1,null))[_0xeb00('0x20')](function(_0x303042){_0x188cf8=_0x303042;if(_0x27efab['body'][_0xeb00('0xab')]&&_0x27efab[_0xeb00('0x5b')]['attachments']['length']){for(var _0x4beb98=0x0;_0x4beb98<_0x27efab['body']['attachments'][_0xeb00('0x49')];_0x4beb98+=0x1){_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][_0x4beb98]={'filename':_0x27efab['body'][_0xeb00('0xab')][_0x4beb98][_0xeb00('0x38')],'id':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][_0x4beb98]['id'],'path':path[_0xeb00('0xac')](config['root'],_0xeb00('0xad'),_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][_0x4beb98][_0xeb00('0xae')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xeb00('0xaf')](_0x27efab[_0xeb00('0x58')]['id'])?undefined:_0x27efab[_0xeb00('0x58')]['id'],'path':_[_0xeb00('0xaf')](_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0x8')])?undefined:_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0x8')],'fax':_[_0xeb00('0xaf')](_0x27efab[_0xeb00('0x5b')]['to'][0x0])?undefined:_0x27efab[_0xeb00('0x5b')]['to'][0x0]},client9002);})[_0xeb00('0x20')](function(){if(_0x188cf8){if(_['isNil'](_0x27efab[_0xeb00('0x5b')][_0xeb00('0xb0')])){_0x27efab[_0xeb00('0x5b')]['from']=util[_0xeb00('0xa5')](_0xeb00('0xb1'),_0x188cf8['name'],_0x188cf8[_0xeb00('0xb2')]);}if(_0x188cf8[_0xeb00('0xa9')]){if(_0x188cf8[_0xeb00('0xa9')]['Contacts'][_0xeb00('0x49')]){return _0x188cf8[_0xeb00('0xa9')][_0xeb00('0xb3')][0x0];}else{return db[_0xeb00('0x73')][_0xeb00('0x5a')](_['defaults'](_0x27efab['body'],{'firstName':_0x27efab[_0xeb00('0x5b')]['to'][0x0],'phone':_0x27efab[_0xeb00('0x5b')]['to'][0x0],'fax':_0x27efab['body']['to'][0x0],'ListId':_0x188cf8['ListId']}));}}else{throw new Error(_0xeb00('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xeb00('0x20')](function(_0x30fcd0){if(_0x30fcd0){return db[_0xeb00('0x72')][_0xeb00('0x5f')]({'where':{'ContactId':_0x30fcd0['id'],'closed':![],'FaxAccountId':_0x188cf8['id']}})[_0xeb00('0x20')](function(_0x30a317){if(_0x30a317){return[_0x30a317,![]];}return db[_0xeb00('0x72')]['create']({'UserId':_0x27efab[_0xeb00('0x5c')]['id'],'ContactId':_0x30fcd0['id'],'FaxAccountId':_0x188cf8['id'],'fax':_0x27efab[_0xeb00('0x5b')]['to'][0x0],'firstMsgDirection':_0xeb00('0xb5'),'Messages':[_[_0xeb00('0x51')](_0x27efab[_0xeb00('0x5b')],{'read':![],'body':_0x27efab[_0xeb00('0x5b')]['attachments'][0x0][_0xeb00('0xb6')],'FaxAccountId':_0x188cf8['id'],'UserId':_0x27efab[_0xeb00('0x5c')]['id'],'ContactId':_0x30fcd0['id'],'AttachmentId':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xeb00('0xb7')}]})[_0xeb00('0x20')](function(_0x41fc3f){return[_0x41fc3f,!![]];});});}else{throw new Error(_0xeb00('0xb8'));}})[_0xeb00('0xb9')](function(_0xb2da0b,_0x5972e2){if(_0x5972e2){return _0xb2da0b;}return db[_0xeb00('0xa7')][_0xeb00('0x5a')]({'direction':_0xeb00('0xb5'),'read':![],'body':_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0xb6')],'FaxAccountId':_0x188cf8['id'],'FaxInteractionId':_0xb2da0b['id'],'UserId':_0x27efab[_0xeb00('0x5c')]['id'],'ContactId':_0xb2da0b[_0xeb00('0xba')],'AttachmentId':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][0x0]['id']})['then'](function(_0x54e81d){_0xb2da0b[_0xeb00('0xbb')]['Messages']=[];_0xb2da0b[_0xeb00('0xbb')][_0xeb00('0xb7')][_0xeb00('0x8e')](_0x54e81d[_0xeb00('0xbb')]);return _0xb2da0b;});})[_0xeb00('0x20')](function(_0x27ada4){respondWithRpcPromise(_0xeb00('0xbc'),'SendFax',{'FaxAccountId':_['isNil'](_0x27efab[_0xeb00('0x58')]['id'])?undefined:_0x27efab[_0xeb00('0x58')]['id'],'path':_[_0xeb00('0xaf')](_0x27efab['body'][_0xeb00('0xab')][0x0][_0xeb00('0x8')])?undefined:_0x27efab[_0xeb00('0x5b')]['attachments'][0x0][_0xeb00('0x8')],'fax':_['isNil'](_0x27efab['body']['to'][0x0])?undefined:_0x27efab[_0xeb00('0x5b')]['to'][0x0],'AttachmentId':_0x27efab[_0xeb00('0x5b')][_0xeb00('0xab')][0x0]['id']},client9002)[_0xeb00('0x20')](function(_0x126250){logger[_0xeb00('0x21')](_0xeb00('0xbd'),_0x126250);})[_0xeb00('0x2a')](function(_0x320bfd){logger['info'](_0xeb00('0xbd'),_0x320bfd);});return _0x27ada4;})[_0xeb00('0x20')](respondWithResult(_0x5edbb1,null))[_0xeb00('0x2a')](handleError(_0x5edbb1,null));};exports[_0xeb00('0xbe')]=function(_0x549126,_0x229a64,_0x2244e7){return db['FaxAccount'][_0xeb00('0x5f')]({'where':{'id':_0x549126[_0xeb00('0x58')]['id']}})['then'](handleEntityNotFound(_0x229a64,null))[_0xeb00('0x20')](function(_0x4a9c9c){if(_0x4a9c9c){return _0x4a9c9c[_0xeb00('0xbe')](_0x549126[_0xeb00('0x5b')]['ids'],_[_0xeb00('0x9e')](_0x549126[_0xeb00('0x5b')],[_0xeb00('0x6c'),'id'])||{})['spread'](function(_0x3a9af5){for(var _0x4df6a3=0x0;_0x4df6a3<_0x549126['body'][_0xeb00('0x6c')][_0xeb00('0x49')];_0x4df6a3+=0x1){socket[_0xeb00('0xbf')](_0xeb00('0xc0'),{'UserId':Number(_0x549126[_0xeb00('0x5b')][_0xeb00('0x6c')][_0x4df6a3]),'FaxAccountId':Number(_0x549126[_0xeb00('0x58')]['id'])});}return _0x3a9af5;});}})[_0xeb00('0x20')](respondWithResult(_0x229a64,null))['catch'](handleError(_0x229a64,null));};exports['removeAgents']=function(_0x126be6,_0xa4ffe2,_0x5740db){return db[_0xeb00('0x3c')][_0xeb00('0x5f')]({'where':{'id':_0x126be6[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0xa4ffe2,null))[_0xeb00('0x20')](function(_0x368d61){if(_0x368d61){return _0x368d61[_0xeb00('0xc1')](_0x126be6[_0xeb00('0x46')][_0xeb00('0x6c')])[_0xeb00('0x20')](function(){if(_[_0xeb00('0xc2')](_0x126be6[_0xeb00('0x46')]['ids'])){for(var _0x1a233d=0x0;_0x1a233d<_0x126be6['query'][_0xeb00('0x6c')][_0xeb00('0x49')];_0x1a233d+=0x1){socket['emit'](_0xeb00('0xc3'),{'UserId':Number(_0x126be6[_0xeb00('0x46')][_0xeb00('0x6c')][_0x1a233d]),'FaxAccountId':Number(_0x126be6[_0xeb00('0x58')]['id'])});}}else{socket[_0xeb00('0xbf')](_0xeb00('0xc3'),{'UserId':Number(_0x126be6[_0xeb00('0x46')][_0xeb00('0x6c')]),'FaxAccountId':Number(_0x126be6[_0xeb00('0x58')]['id'])});}});}})[_0xeb00('0x20')](respondWithStatusCode(_0xa4ffe2,null))[_0xeb00('0x2a')](handleError(_0xa4ffe2,null));};exports[_0xeb00('0xc4')]=function(_0x864e10,_0x592502,_0x4efeaf){var _0x302565={};var _0x17a143={};var _0x4e3619;var _0xe47f52;return db[_0xeb00('0x3c')][_0xeb00('0x6a')]({'where':{'id':_0x864e10[_0xeb00('0x58')]['id']}})[_0xeb00('0x20')](handleEntityNotFound(_0x592502,null))[_0xeb00('0x20')](function(_0x4f9162){if(_0x4f9162){_0x4e3619=_0x4f9162;_0x17a143[_0xeb00('0x41')]=_[_0xeb00('0x43')](db[_0xeb00('0x75')][_0xeb00('0x3d')]);_0x17a143[_0xeb00('0x46')]=_['keys'](_0x864e10['query']);_0x17a143['filters']=_[_0xeb00('0x45')](_0x17a143[_0xeb00('0x41')],_0x17a143[_0xeb00('0x46')]);_0x302565[_0xeb00('0x47')]=_[_0xeb00('0x45')](_0x17a143[_0xeb00('0x41')],qs[_0xeb00('0x48')](_0x864e10[_0xeb00('0x46')][_0xeb00('0x48')]));_0x302565[_0xeb00('0x47')]=_0x302565['attributes'][_0xeb00('0x49')]?_0x302565[_0xeb00('0x47')]:_0x17a143[_0xeb00('0x41')];_0x302565[_0xeb00('0x4c')]=qs['sort'](_0x864e10[_0xeb00('0x46')][_0xeb00('0x4d')]);_0x302565[_0xeb00('0x4e')]=qs[_0xeb00('0x44')](_['pick'](_0x864e10['query'],_0x17a143[_0xeb00('0x44')]));if(_0x864e10[_0xeb00('0x46')][_0xeb00('0x50')]){_0x302565[_0xeb00('0x4e')]=_[_0xeb00('0x51')](_0x302565[_0xeb00('0x4e')],{'$or':_[_0xeb00('0x42')](_0x302565[_0xeb00('0x47')],function(_0x108488){var _0x42829e={};_0x42829e[_0x108488]={'$like':'%'+_0x864e10[_0xeb00('0x46')][_0xeb00('0x50')]+'%'};return _0x42829e;})});}_0x302565=_[_0xeb00('0x51')]({},_0x302565,_0x864e10[_0xeb00('0x53')]);return _0x4e3619['getAgents'](_0x302565);}})[_0xeb00('0x20')](function(_0x4f90e1){if(_0x4f90e1){_0xe47f52=_0x4f90e1[_0xeb00('0x49')];if(!_0x864e10[_0xeb00('0x46')][_0xeb00('0x4a')](_0xeb00('0x4b'))){_0x302565['limit']=qs[_0xeb00('0x30')](_0x864e10['query'][_0xeb00('0x30')]);_0x302565['offset']=qs[_0xeb00('0x2e')](_0x864e10[_0xeb00('0x46')]['offset']);}return _0x4e3619['getAgents'](_0x302565);}})[_0xeb00('0x20')](function(_0x589799){if(_0x589799){return _0x589799?{'count':_0xe47f52,'rows':_0x589799}:null;}})[_0xeb00('0x20')](respondWithResult(_0x592502,null))[_0xeb00('0x2a')](handleError(_0x592502,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b74c498..c7278a3 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 _0x7dba=['update','remove','emit','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x44907e,_0x25f57d){var _0x1355a2=function(_0x5ca60a){while(--_0x5ca60a){_0x44907e['push'](_0x44907e['shift']());}};_0x1355a2(++_0x25f57d);}(_0x7dba,0x109));var _0xa7db=function(_0x21d57e,_0xfc6036){_0x21d57e=_0x21d57e-0x0;var _0x457ebb=_0x7dba[_0x21d57e];return _0x457ebb;};'use strict';var EventEmitter=require(_0xa7db('0x0'));var FaxAccount=require(_0xa7db('0x1'))['db'][_0xa7db('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa7db('0x3')](0x0);var events={'afterCreate':_0xa7db('0x4'),'afterUpdate':_0xa7db('0x5'),'afterDestroy':_0xa7db('0x6')};function emitEvent(_0x56e096){return function(_0x526d2b,_0x59fdb5,_0xda4da){FaxAccountEvents[_0xa7db('0x7')](_0x56e096+':'+_0x526d2b['id'],_0x526d2b);FaxAccountEvents[_0xa7db('0x7')](_0x56e096,_0x526d2b);_0xda4da(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa7db('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x3609=['save','update','remove','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x53b0be,_0x54cd5f){var _0x22712c=function(_0x10966d){while(--_0x10966d){_0x53b0be['push'](_0x53b0be['shift']());}};_0x22712c(++_0x54cd5f);}(_0x3609,0x101));var _0x9360=function(_0xb28e63,_0x4b1981){_0xb28e63=_0xb28e63-0x0;var _0x596d0f=_0x3609[_0xb28e63];return _0x596d0f;};'use strict';var EventEmitter=require(_0x9360('0x0'));var FaxAccount=require(_0x9360('0x1'))['db'][_0x9360('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9360('0x3')](0x0);var events={'afterCreate':_0x9360('0x4'),'afterUpdate':_0x9360('0x5'),'afterDestroy':_0x9360('0x6')};function emitEvent(_0x577c1d){return function(_0x28376e,_0x24c531,_0x22133a){FaxAccountEvents['emit'](_0x577c1d+':'+_0x28376e['id'],_0x28376e);FaxAccountEvents['emit'](_0x577c1d,_0x28376e);_0x22133a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x9360('0x7')](e,emitEvent(event));}}module[_0x9360('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0814b38..ff032fe 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 _0xa2d1=['exports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x4952be,_0x34399f){var _0x25e046=function(_0x4fcc49){while(--_0x4fcc49){_0x4952be['push'](_0x4952be['shift']());}};_0x25e046(++_0x34399f);}(_0xa2d1,0x1a3));var _0x1a2d=function(_0x38c202,_0x299906){_0x38c202=_0x38c202-0x0;var _0xb66482=_0xa2d1[_0x38c202];return _0xb66482;};'use strict';var _=require('lodash');var util=require(_0x1a2d('0x0'));var logger=require(_0x1a2d('0x1'))(_0x1a2d('0x2'));var moment=require(_0x1a2d('0x3'));var BPromise=require(_0x1a2d('0x4'));var rp=require(_0x1a2d('0x5'));var fs=require('fs');var path=require(_0x1a2d('0x6'));var rimraf=require(_0x1a2d('0x7'));var config=require(_0x1a2d('0x8'));var attributes=require(_0x1a2d('0x9'));module[_0x1a2d('0xa')]=function(_0x47ae88,_0x56fd7d){return _0x47ae88['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa03b=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','path','./faxAccount.attributes','exports'];(function(_0x1ed952,_0xcbca17){var _0x1ef805=function(_0x16b49f){while(--_0x16b49f){_0x1ed952['push'](_0x1ed952['shift']());}};_0x1ef805(++_0xcbca17);}(_0xa03b,0xad));var _0xba03=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xa03b[_0x39bc44];return _0x2916d8;};'use strict';var _=require(_0xba03('0x0'));var util=require(_0xba03('0x1'));var logger=require(_0xba03('0x2'))(_0xba03('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba03('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba03('0x5'));module[_0xba03('0x6')]=function(_0x15585a,_0x527224){return _0x15585a[_0xba03('0x7')](_0xba03('0x8'),attributes,{'tableName':_0xba03('0x9'),'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 2bbf831..1b84702 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 _0xa51b=['startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','agent','Start'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa51b,0x1b9));var _0xba51=function(_0x12803e,_0x56c117){_0x12803e=_0x12803e-0x0;var _0x4e87f8=_0xa51b[_0x12803e];return _0x4e87f8;};'use strict';var _=require(_0xba51('0x0'));var util=require(_0xba51('0x1'));var moment=require('moment');var BPromise=require(_0xba51('0x2'));var rs=require(_0xba51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba51('0x5'))(_0xba51('0x6'));var config=require(_0xba51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba51('0x8')]['http']({'port':0x232c});config['redis']=_[_0xba51('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xba51('0xa'))(new Redis(config['redis']));require(_0xba51('0xb'))[_0xba51('0xc')](socket);function respondWithRpcPromise(_0xb74d16,_0x34ab66,_0x3fadc5){return new BPromise(function(_0x249d88,_0x30f8ad){return client[_0xba51('0xd')](_0xb74d16,_0x3fadc5)[_0xba51('0xe')](function(_0xd9c0c9){logger[_0xba51('0xf')](_0xba51('0x10'),_0x34ab66,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x34ab66,'request\x20sent',JSON[_0xba51('0x11')](_0xd9c0c9));if(_0xd9c0c9[_0xba51('0x12')]){if(_0xd9c0c9[_0xba51('0x12')][_0xba51('0x13')]===0x1f4){logger[_0xba51('0x12')]('FaxAccount,\x20%s,\x20%s',_0x34ab66,_0xd9c0c9[_0xba51('0x12')]['message']);return _0x30f8ad(_0xd9c0c9[_0xba51('0x12')][_0xba51('0x14')]);}logger[_0xba51('0x12')](_0xba51('0x10'),_0x34ab66,_0xd9c0c9[_0xba51('0x12')]['message']);return _0x249d88(_0xd9c0c9[_0xba51('0x12')][_0xba51('0x14')]);}else{logger[_0xba51('0xf')]('FaxAccount,\x20%s,\x20%s',_0x34ab66,_0xba51('0x15'));_0x249d88(_0xd9c0c9[_0xba51('0x16')]['message']);}})[_0xba51('0x17')](function(_0x36104d){logger['error'](_0xba51('0x10'),_0x34ab66,_0x36104d);_0x30f8ad(_0x36104d);});});}exports[_0xba51('0x18')]=function(_0x161550){var _0x72e524=this;return new Promise(function(_0x221f6e,_0x5ad4a8){return db[_0xba51('0x19')]['findAll']({'raw':_0x161550[_0xba51('0x1a')]?_0x161550[_0xba51('0x1a')][_0xba51('0x1b')]===undefined?!![]:![]:!![],'where':_0x161550[_0xba51('0x1a')]?_0x161550[_0xba51('0x1a')]['where']||null:null,'attributes':_0x161550['options']?_0x161550[_0xba51('0x1a')][_0xba51('0x1c')]||null:null,'limit':_0x161550['options']?_0x161550[_0xba51('0x1a')][_0xba51('0x1d')]||null:null,'include':_0x161550[_0xba51('0x1a')]?_0x161550['options'][_0xba51('0x1e')]?_[_0xba51('0x1f')](_0x161550[_0xba51('0x1a')][_0xba51('0x1e')],function(_0x3b24ce){return{'model':db[_0x3b24ce[_0xba51('0x20')]],'as':_0x3b24ce['as'],'attributes':_0x3b24ce[_0xba51('0x1c')],'include':_0x3b24ce[_0xba51('0x1e')]?_['map'](_0x3b24ce[_0xba51('0x1e')],function(_0x32ee15){return{'model':db[_0x32ee15['model']],'as':_0x32ee15['as'],'attributes':_0x32ee15[_0xba51('0x1c')],'include':_0x32ee15['include']?_[_0xba51('0x1f')](_0x32ee15[_0xba51('0x1e')],function(_0x56fd8d){return{'model':db[_0x56fd8d['model']],'as':_0x56fd8d['as'],'attributes':_0x56fd8d['attributes']};}):[]};}):[]};}):[]:[]})[_0xba51('0xe')](function(_0x50f97f){logger[_0xba51('0xf')](_0xba51('0x18'),_0x161550);logger['debug'](_0xba51('0x18'),_0x161550,JSON[_0xba51('0x11')](_0x50f97f));_0x221f6e(_0x50f97f);})[_0xba51('0x17')](function(_0x2cff6f){logger[_0xba51('0x12')](_0xba51('0x18'),_0x2cff6f[_0xba51('0x14')],_0x161550);_0x5ad4a8(_0x72e524[_0xba51('0x12')](0x1f4,_0x2cff6f['message']));});});};exports[_0xba51('0x21')]=function(_0x2d6e41,_0x4573b9,_0x284c5e){var _0x1ee917=this;return new Promise(function(_0x228b46,_0x585364){var _0x563ca3={'body':_0x2d6e41[_0xba51('0x22')],'channel':_0xba51('0x23')};var _0xdc4d08=[];var _0x25bf47=[];var _0x16f137={};return db[_0xba51('0x24')][_0xba51('0x25')]()[_0xba51('0xe')](function(_0x4d3b40){if(!_0x4d3b40){throw new db['Sequelize'][(_0xba51('0x26'))](_0xba51('0x27'));}_0xdc4d08=_[_0xba51('0x28')](_[_0xba51('0x29')](_0x4d3b40),[_0xba51('0x2a'),'updatedAt']);_0x25bf47=_[_0xba51('0x28')](_['keys'](_0x4d3b40),[_0xba51('0x2a'),_0xba51('0x2b'),_0xba51('0x2c'),_0xba51('0x2d')]);if(_0x2d6e41[_0xba51('0x22')]['id']){delete _0x2d6e41[_0xba51('0x22')]['id'];}if(_[_0xba51('0x2e')](_0x2d6e41[_0xba51('0x22')][_0xba51('0x2f')])){throw new db[(_0xba51('0x30'))][(_0xba51('0x26'))](_0xba51('0x31'));}if(_[_0xba51('0x2e')](_0x2d6e41[_0xba51('0x22')][_0xba51('0x22')])||_0x2d6e41[_0xba51('0x22')][_0xba51('0x22')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xba51('0x2e')](_0x2d6e41[_0xba51('0x22')][_0xba51('0x32')])){throw new db[(_0xba51('0x30'))]['ValidationError'](_0xba51('0x33')+_0x25bf47);}if(!_[_0xba51('0x34')](_0x25bf47,_0x2d6e41[_0xba51('0x22')][_0xba51('0x32')])){throw new db['Sequelize']['ValidationError'](_0xba51('0x35')+_0x25bf47);}_0x16f137[_0x2d6e41[_0xba51('0x22')][_0xba51('0x32')]]=_0x2d6e41[_0xba51('0x22')][_0xba51('0x2f')];})[_0xba51('0xe')](function(){return db[_0xba51('0x19')][_0xba51('0x36')]({'where':{'id':_0x2d6e41[_0xba51('0x37')]['id']},'include':[{'model':db[_0xba51('0x38')],'as':'List','include':[{'model':db[_0xba51('0x24')],'as':_0xba51('0x39'),'where':_0x16f137,'limit':0x1,'order':[['updatedAt',_0xba51('0x3a')]]}]},{'model':db[_0xba51('0x3b')],'as':_0xba51('0x3c')}]});})[_0xba51('0xe')](function(_0x4f24f3){if(_0x4f24f3&&_0x4f24f3[_0xba51('0x3d')]){var _0x10fa7d=_0x4f24f3[_0xba51('0x3e')]({'plain':!![]});_0x563ca3['account']=_0x10fa7d;_0x563ca3[_0xba51('0x3f')]=_0x10fa7d[_0xba51('0x3c')];_0x563ca3[_0xba51('0x40')]=_0x10fa7d[_0xba51('0x3d')];_0x563ca3['applications']=_['orderBy'](_0x563ca3[_0xba51('0x3f')],['priority'],[_0xba51('0x41')]);if(_0x563ca3['account']['Applications']){delete _0x563ca3[_0xba51('0x37')][_0xba51('0x3c')];}if(_0x563ca3[_0xba51('0x37')][_0xba51('0x3d')]&&_0x563ca3[_0xba51('0x37')][_0xba51('0x3d')][_0xba51('0x39')]['length']){return _0x563ca3['account']['List'][_0xba51('0x39')][0x0];}var _0x2eadec=_[_0xba51('0x9')](_0x2d6e41[_0xba51('0x22')],{'firstName':_0x2d6e41[_0xba51('0x22')][_0xba51('0x2f')],'ListId':_0x10fa7d[_0xba51('0x2d')]});_0x2eadec[_0x2d6e41[_0xba51('0x22')][_0xba51('0x32')]]=_0x2d6e41[_0xba51('0x22')][_0xba51('0x2f')];return db[_0xba51('0x24')][_0xba51('0x42')](_0x2eadec,{'fields':_0xdc4d08,'raw':!![]});}})[_0xba51('0xe')](function(_0x43b9e1){_0x563ca3[_0xba51('0x43')]=_0x43b9e1;if(_0x43b9e1){var _0x36f70f={'ContactId':_0x43b9e1['id'],'FaxAccountId':_0x2d6e41[_0xba51('0x37')]['id'],'fax':_0x43b9e1['fax']};return db[_0xba51('0x44')]['find']({'where':{'ContactId':_0x43b9e1['id'],'closed':![],'FaxAccountId':_0x2d6e41[_0xba51('0x37')]['id']}})[_0xba51('0xe')](function(_0x47d3fa){if(_0x47d3fa){return[_0x47d3fa,![]];}return db[_0xba51('0x44')]['create'](_0x36f70f)[_0xba51('0xe')](function(_0xc9fee6){return[_0xc9fee6,!![]];});});}else{throw new Error(_0xba51('0x45'));}})[_0xba51('0x46')](function(_0x4c5d6e,_0x4f951b){var _0xeca097=_0x4c5d6e[_0xba51('0x3e')]({'plain':!![]});if(_0x4f951b){if(_0x563ca3[_0xba51('0x37')][_0xba51('0x47')]){_0x563ca3[_0xba51('0x3f')][_0xba51('0x48')]({'id':0x0,'priority':_0x563ca3[_0xba51('0x3f')][_0xba51('0x49')]+0x1,'app':_0xba51('0x4a'),'appdata':_0xba51('0x4b'),'interval':_0xba51('0x4c')});}_0xeca097[_0xba51('0x4d')]=!![];}else{_0xeca097['created']=![];}_0x563ca3[_0xba51('0x4e')]=_0xeca097;return db[_0xba51('0x4f')][_0xba51('0x42')]({'body':_0x2d6e41[_0xba51('0x22')][_0xba51('0x22')],'FaxAccountId':_0x2d6e41[_0xba51('0x37')]['id'],'FaxInteractionId':_0x4c5d6e['id'],'direction':'in','ContactId':_0x4c5d6e[_0xba51('0x50')],'AttachmentId':_0x2d6e41['body'][_0xba51('0x51')]});})['then'](function(_0x1bc9ed){_0x563ca3[_0xba51('0x14')]=_0x1bc9ed;if(_0x563ca3[_0xba51('0x4e')]['UserId']){return db[_0xba51('0x52')][_0xba51('0x36')]({'attributes':['id',_0xba51('0x53')],'where':{'id':_0x563ca3[_0xba51('0x4e')][_0xba51('0x54')]}})[_0xba51('0xe')](function(_0x55e026){if(_0x55e026){_0x563ca3[_0xba51('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xba51('0x55'),'appdata':_0x55e026[_0xba51('0x53')]+','+(_0x563ca3[_0xba51('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0xba51('0x4c')});}return respondWithRpcPromise(_0xba51('0x56'),'startRouting',_0x563ca3);});}return respondWithRpcPromise(_0xba51('0x56'),_0xba51('0x57'),_0x563ca3);})[_0xba51('0xe')](function(_0xa420be){_0x228b46(_0xa420be);})[_0xba51('0x17')](function(_0x3a4493){_0x585364(_0x1ee917[_0xba51('0x12')](0x1f4,_0x3a4493['message']));});});}; \ No newline at end of file +var _0x8073=['raw','limit','include','map','attributes','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','then','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','FaxApplication','Applications','account','applications','orderBy','priority','length','Contacts','create','contact','FaxInteraction','find','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxAccount','findAll','options'];(function(_0x2c1818,_0x1e360c){var _0x907722=function(_0x11b0fc){while(--_0x11b0fc){_0x2c1818['push'](_0x2c1818['shift']());}};_0x907722(++_0x1e360c);}(_0x8073,0x94));var _0x3807=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8073[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3807('0x0'));var util=require(_0x3807('0x1'));var moment=require(_0x3807('0x2'));var BPromise=require(_0x3807('0x3'));var rs=require(_0x3807('0x4'));var fs=require('fs');var Redis=require(_0x3807('0x5'));var db=require(_0x3807('0x6'))['db'];var utils=require(_0x3807('0x7'));var logger=require(_0x3807('0x8'))(_0x3807('0x9'));var config=require(_0x3807('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3807('0xb')]['http']({'port':0x232c});config[_0x3807('0xc')]=_[_0x3807('0xd')](config['redis'],{'host':_0x3807('0xe'),'port':0x18eb});var socket=require(_0x3807('0xf'))(new Redis(config[_0x3807('0xc')]));require(_0x3807('0x10'))[_0x3807('0x11')](socket);function respondWithRpcPromise(_0xf2c679,_0x28e439,_0x524713){return new BPromise(function(_0x556df5,_0x5439e9){return client[_0x3807('0x12')](_0xf2c679,_0x524713)['then'](function(_0x52eadf){logger[_0x3807('0x13')](_0x3807('0x14'),_0x28e439,_0x3807('0x15'));logger[_0x3807('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x28e439,_0x3807('0x15'),JSON[_0x3807('0x17')](_0x52eadf));if(_0x52eadf[_0x3807('0x18')]){if(_0x52eadf[_0x3807('0x18')][_0x3807('0x19')]===0x1f4){logger[_0x3807('0x18')](_0x3807('0x14'),_0x28e439,_0x52eadf[_0x3807('0x18')][_0x3807('0x1a')]);return _0x5439e9(_0x52eadf[_0x3807('0x18')][_0x3807('0x1a')]);}logger['error'](_0x3807('0x14'),_0x28e439,_0x52eadf['error'][_0x3807('0x1a')]);return _0x556df5(_0x52eadf[_0x3807('0x18')]['message']);}else{logger[_0x3807('0x13')](_0x3807('0x14'),_0x28e439,'request\x20sent');_0x556df5(_0x52eadf[_0x3807('0x1b')][_0x3807('0x1a')]);}})[_0x3807('0x1c')](function(_0x19f094){logger[_0x3807('0x18')](_0x3807('0x14'),_0x28e439,_0x19f094);_0x5439e9(_0x19f094);});});}exports['GetFaxAccount']=function(_0x2b24c5){var _0x593737=this;return new Promise(function(_0x4eaa15,_0x300ea8){return db[_0x3807('0x1d')][_0x3807('0x1e')]({'raw':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')][_0x3807('0x20')]===undefined?!![]:![]:!![],'where':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')]['where']||null:null,'attributes':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')]['attributes']||null:null,'limit':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5['options'][_0x3807('0x21')]||null:null,'include':_0x2b24c5[_0x3807('0x1f')]?_0x2b24c5[_0x3807('0x1f')][_0x3807('0x22')]?_[_0x3807('0x23')](_0x2b24c5[_0x3807('0x1f')][_0x3807('0x22')],function(_0x437128){return{'model':db[_0x437128['model']],'as':_0x437128['as'],'attributes':_0x437128[_0x3807('0x24')],'include':_0x437128['include']?_['map'](_0x437128['include'],function(_0x30c4aa){return{'model':db[_0x30c4aa[_0x3807('0x25')]],'as':_0x30c4aa['as'],'attributes':_0x30c4aa[_0x3807('0x24')],'include':_0x30c4aa['include']?_['map'](_0x30c4aa[_0x3807('0x22')],function(_0x401ce1){return{'model':db[_0x401ce1[_0x3807('0x25')]],'as':_0x401ce1['as'],'attributes':_0x401ce1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e35ba){logger[_0x3807('0x13')](_0x3807('0x26'),_0x2b24c5);logger[_0x3807('0x16')]('GetFaxAccount',_0x2b24c5,JSON[_0x3807('0x17')](_0x5e35ba));_0x4eaa15(_0x5e35ba);})[_0x3807('0x1c')](function(_0x358405){logger[_0x3807('0x18')](_0x3807('0x26'),_0x358405[_0x3807('0x1a')],_0x2b24c5);_0x300ea8(_0x593737[_0x3807('0x18')](0x1f4,_0x358405[_0x3807('0x1a')]));});});};exports[_0x3807('0x27')]=function(_0x1af34e,_0x5dd814,_0x51ae83){var _0x5b04f4=this;return new Promise(function(_0x119a7c,_0x49d580){var _0x387a22={'body':_0x1af34e[_0x3807('0x28')],'channel':_0x3807('0x29')};var _0x407833=[];var _0x3116b5=[];var _0x1f97c7={};return db[_0x3807('0x2a')][_0x3807('0x2b')]()[_0x3807('0x2c')](function(_0x334800){if(!_0x334800){throw new db['Sequelize'][(_0x3807('0x2d'))]('no\x20available\x20attributes');}_0x407833=_[_0x3807('0x2e')](_[_0x3807('0x2f')](_0x334800),[_0x3807('0x30'),_0x3807('0x31')]);_0x3116b5=_[_0x3807('0x2e')](_[_0x3807('0x2f')](_0x334800),[_0x3807('0x30'),_0x3807('0x31'),_0x3807('0x32'),_0x3807('0x33')]);if(_0x1af34e['body']['id']){delete _0x1af34e['body']['id'];}if(_[_0x3807('0x34')](_0x1af34e['body'][_0x3807('0x35')])){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x37'));}if(_[_0x3807('0x34')](_0x1af34e[_0x3807('0x28')][_0x3807('0x28')])||_0x1af34e[_0x3807('0x28')][_0x3807('0x28')]===''){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x38'));}if(_[_0x3807('0x34')](_0x1af34e[_0x3807('0x28')]['mapKey'])){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x39')+_0x3116b5);}if(!_['includes'](_0x3116b5,_0x1af34e[_0x3807('0x28')]['mapKey'])){throw new db[(_0x3807('0x36'))][(_0x3807('0x2d'))](_0x3807('0x3a')+_0x3116b5);}_0x1f97c7[_0x1af34e[_0x3807('0x28')][_0x3807('0x3b')]]=_0x1af34e[_0x3807('0x28')][_0x3807('0x35')];})[_0x3807('0x2c')](function(){return db[_0x3807('0x1d')]['find']({'where':{'id':_0x1af34e['account']['id']},'include':[{'model':db[_0x3807('0x3c')],'as':_0x3807('0x3d'),'include':[{'model':db[_0x3807('0x2a')],'as':'Contacts','where':_0x1f97c7,'limit':0x1,'order':[[_0x3807('0x31'),'DESC']]}]},{'model':db[_0x3807('0x3e')],'as':_0x3807('0x3f')}]});})[_0x3807('0x2c')](function(_0x50ce18){if(_0x50ce18&&_0x50ce18[_0x3807('0x3d')]){var _0x15d07d=_0x50ce18['get']({'plain':!![]});_0x387a22[_0x3807('0x40')]=_0x15d07d;_0x387a22[_0x3807('0x41')]=_0x15d07d['Applications'];_0x387a22['list']=_0x15d07d[_0x3807('0x3d')];_0x387a22[_0x3807('0x41')]=_[_0x3807('0x42')](_0x387a22[_0x3807('0x41')],[_0x3807('0x43')],['asc']);if(_0x387a22[_0x3807('0x40')][_0x3807('0x3f')]){delete _0x387a22[_0x3807('0x40')][_0x3807('0x3f')];}if(_0x387a22[_0x3807('0x40')]['List']&&_0x387a22[_0x3807('0x40')]['List']['Contacts'][_0x3807('0x44')]){return _0x387a22[_0x3807('0x40')][_0x3807('0x3d')][_0x3807('0x45')][0x0];}var _0x465bf0=_['defaults'](_0x1af34e[_0x3807('0x28')],{'firstName':_0x1af34e[_0x3807('0x28')][_0x3807('0x35')],'ListId':_0x15d07d[_0x3807('0x33')]});_0x465bf0[_0x1af34e['body'][_0x3807('0x3b')]]=_0x1af34e[_0x3807('0x28')]['from'];return db[_0x3807('0x2a')][_0x3807('0x46')](_0x465bf0,{'fields':_0x407833,'raw':!![]});}})[_0x3807('0x2c')](function(_0x2ec9ec){_0x387a22[_0x3807('0x47')]=_0x2ec9ec;if(_0x2ec9ec){var _0x41a15e={'ContactId':_0x2ec9ec['id'],'FaxAccountId':_0x1af34e['account']['id'],'fax':_0x2ec9ec[_0x3807('0x29')]};return db[_0x3807('0x48')][_0x3807('0x49')]({'where':{'ContactId':_0x2ec9ec['id'],'closed':![],'FaxAccountId':_0x1af34e['account']['id']}})['then'](function(_0x5b7803){if(_0x5b7803){return[_0x5b7803,![]];}return db[_0x3807('0x48')][_0x3807('0x46')](_0x41a15e)[_0x3807('0x2c')](function(_0x3d84b1){return[_0x3d84b1,!![]];});});}else{throw new Error(_0x3807('0x4a'));}})['spread'](function(_0x5ddc59,_0x4d8fd4){var _0x49cc43=_0x5ddc59['get']({'plain':!![]});if(_0x4d8fd4){if(_0x387a22[_0x3807('0x40')]['autoclose']){_0x387a22[_0x3807('0x41')][_0x3807('0x4b')]({'id':0x0,'priority':_0x387a22[_0x3807('0x41')][_0x3807('0x44')]+0x1,'app':_0x3807('0x4c'),'appdata':_0x3807('0x4d'),'interval':_0x3807('0x4e')});}_0x49cc43[_0x3807('0x4f')]=!![];}else{_0x49cc43['created']=![];}_0x387a22[_0x3807('0x50')]=_0x49cc43;return db[_0x3807('0x51')]['create']({'body':_0x1af34e[_0x3807('0x28')][_0x3807('0x28')],'FaxAccountId':_0x1af34e[_0x3807('0x40')]['id'],'FaxInteractionId':_0x5ddc59['id'],'direction':'in','ContactId':_0x5ddc59[_0x3807('0x52')],'AttachmentId':_0x1af34e[_0x3807('0x28')][_0x3807('0x53')]});})['then'](function(_0x565337){_0x387a22[_0x3807('0x1a')]=_0x565337;if(_0x387a22['interaction'][_0x3807('0x54')]){return db['User'][_0x3807('0x49')]({'attributes':['id',_0x3807('0x55')],'where':{'id':_0x387a22[_0x3807('0x50')]['UserId']}})[_0x3807('0x2c')](function(_0x2cba80){if(_0x2cba80){_0x387a22[_0x3807('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3807('0x56'),'appdata':_0x2cba80[_0x3807('0x55')]+','+(_0x387a22[_0x3807('0x40')][_0x3807('0x57')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3807('0x58'),_0x3807('0x59'),_0x387a22);});}return respondWithRpcPromise(_0x3807('0x58'),_0x3807('0x59'),_0x387a22);})[_0x3807('0x2c')](function(_0x371af3){_0x119a7c(_0x371af3);})[_0x3807('0x1c')](function(_0x3b1ebe){_0x49d580(_0x5b04f4[_0x3807('0x18')](0x1f4,_0x3b1ebe['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index be72dbe..cf22927 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 _0x0323=['emit','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x42aabd,_0x217ade){var _0x2e83fb=function(_0x1508d8){while(--_0x1508d8){_0x42aabd['push'](_0x42aabd['shift']());}};_0x2e83fb(++_0x217ade);}(_0x0323,0x129));var _0x3032=function(_0x128e62,_0x2ae3ef){_0x128e62=_0x128e62-0x0;var _0x55328f=_0x0323[_0x128e62];return _0x55328f;};'use strict';var FaxAccountEvents=require(_0x3032('0x0'));var events=[_0x3032('0x1'),_0x3032('0x2'),'update'];function createListener(_0xf1cbea,_0x2925b2){return function(_0x30fd8c){_0x2925b2[_0x3032('0x3')](_0xf1cbea,_0x30fd8c);};}function removeListener(_0x34ba62,_0x4266b1){return function(){FaxAccountEvents['removeListener'](_0x34ba62,_0x4266b1);};}exports['register']=function(_0x44f5b4){for(var _0x525b91=0x0,_0x22c2d8=events[_0x3032('0x4')];_0x525b91<_0x22c2d8;_0x525b91++){var _0x2c4731=events[_0x525b91];var _0x5b1b3a=createListener(_0x3032('0x5')+_0x2c4731,_0x44f5b4);FaxAccountEvents['on'](_0x2c4731,_0x5b1b3a);}}; \ No newline at end of file +var _0xf94f=['register','length','faxAccount:','./faxAccount.events','remove','update','emit','removeListener'];(function(_0x55cf08,_0x187024){var _0x5b8ddd=function(_0x4df428){while(--_0x4df428){_0x55cf08['push'](_0x55cf08['shift']());}};_0x5b8ddd(++_0x187024);}(_0xf94f,0x1d3));var _0xff94=function(_0x14cfe4,_0x5f0cc7){_0x14cfe4=_0x14cfe4-0x0;var _0x26463c=_0xf94f[_0x14cfe4];return _0x26463c;};'use strict';var FaxAccountEvents=require(_0xff94('0x0'));var events=['save',_0xff94('0x1'),_0xff94('0x2')];function createListener(_0x41a3b2,_0x4c0c70){return function(_0xdd89b3){_0x4c0c70[_0xff94('0x3')](_0x41a3b2,_0xdd89b3);};}function removeListener(_0x47f5af,_0x59886c){return function(){FaxAccountEvents[_0xff94('0x4')](_0x47f5af,_0x59886c);};}exports[_0xff94('0x5')]=function(_0x4817fb){for(var _0x5afe60=0x0,_0x4eb3de=events[_0xff94('0x6')];_0x5afe60<_0x4eb3de;_0x5afe60++){var _0x15e38d=events[_0x5afe60];var _0x27a04e=createListener(_0xff94('0x7')+_0x15e38d,_0x4817fb);FaxAccountEvents['on'](_0x15e38d,_0x27a04e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c69b586..09257eb 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2db09e,_0x192eae){var _0x4656ac=function(_0x1ac202){while(--_0x1ac202){_0x2db09e['push'](_0x2db09e['shift']());}};_0x4656ac(++_0x192eae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5c839c,_0x335a88){var _0x14a48a=function(_0x443775){while(--_0x443775){_0x5c839c['push'](_0x5c839c['shift']());}};_0x14a48a(++_0x335a88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0d5f918..f32af24 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 _0xcad2=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x462843,_0x9f4398){var _0x29fa43=function(_0x50ee55){while(--_0x50ee55){_0x462843['push'](_0x462843['shift']());}};_0x29fa43(++_0x9f4398);}(_0xcad2,0xfe));var _0x2cad=function(_0x4065f8,_0x236724){_0x4065f8=_0x4065f8-0x0;var _0x32a746=_0xcad2[_0x4065f8];return _0x32a746;};'use strict';var Sequelize=require(_0x2cad('0x0'));module[_0x2cad('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2cad('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2cad('0x3')]()},'description':{'type':Sequelize[_0x2cad('0x2')]},'interval':{'type':Sequelize[_0x2cad('0x2')],'defaultValue':_0x2cad('0x4')}}; \ No newline at end of file +var _0xc2c9=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xc2c9,0x83));var _0x9c2c=function(_0x1f4ef7,_0x27c88f){_0x1f4ef7=_0x1f4ef7-0x0;var _0xe1cf72=_0xc2c9[_0x1f4ef7];return _0xe1cf72;};'use strict';var Sequelize=require(_0x9c2c('0x0'));module[_0x9c2c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9c2c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9c2c('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9c2c('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 283deaf..9becca5 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 _0x20f3=['sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','end','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x20f3,0xab));var _0x320f=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x20f3[_0x4207f4];return _0x29a621;};'use strict';var emlformat=require(_0x320f('0x0'));var rimraf=require(_0x320f('0x1'));var zipdir=require(_0x320f('0x2'));var jsonpatch=require(_0x320f('0x3'));var rp=require('request-promise');var moment=require(_0x320f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x320f('0x5'));var path=require(_0x320f('0x6'));var sox=require(_0x320f('0x7'));var csv=require(_0x320f('0x8'));var ejs=require(_0x320f('0x9'));var fs=require('fs');var fs_extra=require(_0x320f('0xa'));var _=require(_0x320f('0xb'));var squel=require(_0x320f('0xc'));var crypto=require(_0x320f('0xd'));var jsforce=require(_0x320f('0xe'));var deskjs=require(_0x320f('0xf'));var toCsv=require(_0x320f('0x8'));var querystring=require(_0x320f('0x10'));var Papa=require(_0x320f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x320f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x320f('0x13'))(_0x320f('0x14'));var utils=require(_0x320f('0x15'));var config=require(_0x320f('0x16'));var licenseUtil=require(_0x320f('0x17'));var db=require(_0x320f('0x18'))['db'];function respondWithStatusCode(_0x12606a,_0x1ee713){_0x1ee713=_0x1ee713||0xcc;return function(_0x1c9bfd){if(_0x1c9bfd){return _0x12606a[_0x320f('0x19')](_0x1ee713);}return _0x12606a[_0x320f('0x1a')](_0x1ee713)['end']();};}function respondWithResult(_0x3193b1,_0x347091){_0x347091=_0x347091||0xc8;return function(_0x24b14e){if(_0x24b14e){return _0x3193b1[_0x320f('0x1a')](_0x347091)[_0x320f('0x1b')](_0x24b14e);}};}function respondWithFilteredResult(_0x373c5e,_0x1365df){return function(_0x531bc1){if(_0x531bc1){var _0x31a26e=typeof _0x1365df[_0x320f('0x1c')]==='undefined'&&typeof _0x1365df[_0x320f('0x1d')]===_0x320f('0x1e');var _0x22a530=_0x531bc1[_0x320f('0x1f')];var _0xdd667c=_0x31a26e?0x0:_0x1365df[_0x320f('0x1c')];var _0x44821a=_0x31a26e?_0x531bc1['count']:_0x1365df[_0x320f('0x1c')]+_0x1365df[_0x320f('0x1d')];var _0x3bb831;if(_0x44821a>=_0x22a530){_0x44821a=_0x22a530;_0x3bb831=0xc8;}else{_0x3bb831=0xce;}_0x373c5e[_0x320f('0x1a')](_0x3bb831);return _0x373c5e[_0x320f('0x20')](_0x320f('0x21'),_0xdd667c+'-'+_0x44821a+'/'+_0x22a530)[_0x320f('0x1b')](_0x531bc1);}return null;};}function patchUpdates(_0x5116cc){return function(_0x31ccf7){try{jsonpatch[_0x320f('0x22')](_0x31ccf7,_0x5116cc,!![]);}catch(_0x2ac38e){return BPromise['reject'](_0x2ac38e);}return _0x31ccf7['save']();};}function saveUpdates(_0x246c4a,_0x533c93){return function(_0xf22f33){if(_0xf22f33){return _0xf22f33['update'](_0x246c4a)[_0x320f('0x23')](function(_0x3aea73){return _0x3aea73;});}return null;};}function removeEntity(_0x2d1fda,_0x2013ad){return function(_0x432602){if(_0x432602){return _0x432602[_0x320f('0x24')]()['then'](function(){_0x2d1fda['status'](0xcc)[_0x320f('0x25')]();});}};}function handleEntityNotFound(_0x80298e,_0x5d3e29){return function(_0x5e1532){if(!_0x5e1532){_0x80298e[_0x320f('0x19')](0x194);}return _0x5e1532;};}function handleError(_0x1158a4,_0x247067){_0x247067=_0x247067||0x1f4;return function(_0x9480ba){logger[_0x320f('0x26')](_0x9480ba[_0x320f('0x27')]);if(_0x9480ba[_0x320f('0x28')]){delete _0x9480ba[_0x320f('0x28')];}_0x1158a4[_0x320f('0x1a')](_0x247067)[_0x320f('0x29')](_0x9480ba);};}exports['index']=function(_0x14bf58,_0x4019e7){var _0x39ca3c={},_0x53c38d={},_0x1260e6={'count':0x0,'rows':[]};var _0x29e5eb=_[_0x320f('0x2a')](db[_0x320f('0x2b')][_0x320f('0x2c')],function(_0xbd95b4){return{'name':_0xbd95b4[_0x320f('0x2d')],'type':_0xbd95b4['type']['key']};});_0x53c38d['model']=_[_0x320f('0x2a')](_0x29e5eb,'name');_0x53c38d['query']=_[_0x320f('0x2e')](_0x14bf58[_0x320f('0x2f')]);_0x53c38d[_0x320f('0x30')]=_[_0x320f('0x31')](_0x53c38d[_0x320f('0x32')],_0x53c38d[_0x320f('0x2f')]);_0x39ca3c['attributes']=_[_0x320f('0x31')](_0x53c38d[_0x320f('0x32')],qs['fields'](_0x14bf58['query'][_0x320f('0x33')]));_0x39ca3c[_0x320f('0x34')]=_0x39ca3c[_0x320f('0x34')][_0x320f('0x35')]?_0x39ca3c[_0x320f('0x34')]:_0x53c38d[_0x320f('0x32')];if(!_0x14bf58[_0x320f('0x2f')][_0x320f('0x36')](_0x320f('0x37'))){_0x39ca3c['limit']=qs[_0x320f('0x1d')](_0x14bf58['query'][_0x320f('0x1d')]);_0x39ca3c[_0x320f('0x1c')]=qs['offset'](_0x14bf58[_0x320f('0x2f')]['offset']);}_0x39ca3c[_0x320f('0x38')]=qs['sort'](_0x14bf58['query'][_0x320f('0x39')]);_0x39ca3c[_0x320f('0x3a')]=qs['filters'](_[_0x320f('0x3b')](_0x14bf58[_0x320f('0x2f')],_0x53c38d['filters']),_0x29e5eb);if(_0x14bf58[_0x320f('0x2f')][_0x320f('0x3c')]){_0x39ca3c['where']=_['merge'](_0x39ca3c[_0x320f('0x3a')],{'$or':_[_0x320f('0x2a')](_0x29e5eb,function(_0x40a4b4){if(_0x40a4b4[_0x320f('0x3d')]!==_0x320f('0x3e')){var _0x3f08cc={};_0x3f08cc[_0x40a4b4['name']]={'$like':'%'+_0x14bf58[_0x320f('0x2f')]['filter']+'%'};return _0x3f08cc;}})});}_0x39ca3c=_[_0x320f('0x3f')]({},_0x39ca3c,_0x14bf58['options']);var _0x40ee51={'where':_0x39ca3c[_0x320f('0x3a')]};return db[_0x320f('0x2b')][_0x320f('0x1f')](_0x40ee51)['then'](function(_0x44427d){_0x1260e6['count']=_0x44427d;if(_0x14bf58[_0x320f('0x2f')][_0x320f('0x40')]){_0x39ca3c[_0x320f('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0x320f('0x42')](_0x39ca3c);})[_0x320f('0x23')](function(_0x1fcf89){_0x1260e6[_0x320f('0x43')]=_0x1fcf89;return _0x1260e6;})[_0x320f('0x23')](respondWithFilteredResult(_0x4019e7,_0x39ca3c))[_0x320f('0x44')](handleError(_0x4019e7,null));};exports[_0x320f('0x45')]=function(_0x372b73,_0x296bc6){var _0x37d849={'raw':!![],'where':{'id':_0x372b73[_0x320f('0x46')]['id']}},_0x1bb4bc={};_0x1bb4bc[_0x320f('0x32')]=_[_0x320f('0x2e')](db[_0x320f('0x2b')]['rawAttributes']);_0x1bb4bc[_0x320f('0x2f')]=_[_0x320f('0x2e')](_0x372b73[_0x320f('0x2f')]);_0x1bb4bc[_0x320f('0x30')]=_['intersection'](_0x1bb4bc[_0x320f('0x32')],_0x1bb4bc[_0x320f('0x2f')]);_0x37d849['attributes']=_['intersection'](_0x1bb4bc[_0x320f('0x32')],qs[_0x320f('0x33')](_0x372b73[_0x320f('0x2f')][_0x320f('0x33')]));_0x37d849['attributes']=_0x37d849[_0x320f('0x34')]['length']?_0x37d849[_0x320f('0x34')]:_0x1bb4bc[_0x320f('0x32')];if(_0x372b73[_0x320f('0x2f')]['includeAll']){_0x37d849[_0x320f('0x41')]=[{'all':!![]}];}_0x37d849=_[_0x320f('0x3f')]({},_0x37d849,_0x372b73[_0x320f('0x47')]);return db[_0x320f('0x2b')][_0x320f('0x48')](_0x37d849)[_0x320f('0x23')](handleEntityNotFound(_0x296bc6,null))[_0x320f('0x23')](respondWithResult(_0x296bc6,null))[_0x320f('0x44')](handleError(_0x296bc6,null));};exports[_0x320f('0x49')]=function(_0x4a5929,_0x5f4cf8){return db[_0x320f('0x2b')][_0x320f('0x49')](_0x4a5929[_0x320f('0x4a')],{})[_0x320f('0x23')](respondWithResult(_0x5f4cf8,0xc9))[_0x320f('0x44')](handleError(_0x5f4cf8,null));};exports[_0x320f('0x4b')]=function(_0x1cacac,_0x18e45a){if(_0x1cacac[_0x320f('0x4a')]['id']){delete _0x1cacac[_0x320f('0x4a')]['id'];}return db[_0x320f('0x2b')][_0x320f('0x48')]({'where':{'id':_0x1cacac['params']['id']}})['then'](handleEntityNotFound(_0x18e45a,null))[_0x320f('0x23')](saveUpdates(_0x1cacac['body'],null))[_0x320f('0x23')](respondWithResult(_0x18e45a,null))[_0x320f('0x44')](handleError(_0x18e45a,null));};exports[_0x320f('0x24')]=function(_0x49c348,_0x5c22d6){return db['FaxApplication']['find']({'where':{'id':_0x49c348[_0x320f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c22d6,null))[_0x320f('0x23')](removeEntity(_0x5c22d6,null))[_0x320f('0x44')](handleError(_0x5c22d6,null));}; \ No newline at end of file +var _0xe342=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','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','reject','save','update','then','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x53ad14,_0x4328b8){var _0x4f0e6f=function(_0x514b81){while(--_0x514b81){_0x53ad14['push'](_0x53ad14['shift']());}};_0x4f0e6f(++_0x4328b8);}(_0xe342,0x149));var _0x2e34=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xe342[_0x1b1e76];return _0x3d743a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e34('0x0'));var zipdir=require(_0x2e34('0x1'));var jsonpatch=require(_0x2e34('0x2'));var rp=require(_0x2e34('0x3'));var moment=require(_0x2e34('0x4'));var BPromise=require(_0x2e34('0x5'));var Mustache=require(_0x2e34('0x6'));var util=require(_0x2e34('0x7'));var path=require(_0x2e34('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e34('0x9'));var fs=require('fs');var fs_extra=require(_0x2e34('0xa'));var _=require(_0x2e34('0xb'));var squel=require('squel');var crypto=require(_0x2e34('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e34('0xd'));var Redis=require(_0x2e34('0xe'));var authService=require(_0x2e34('0xf'));var qs=require(_0x2e34('0x10'));var as=require(_0x2e34('0x11'));var hardwareService=require(_0x2e34('0x12'));var logger=require('../../config/logger')(_0x2e34('0x13'));var utils=require(_0x2e34('0x14'));var config=require(_0x2e34('0x15'));var licenseUtil=require(_0x2e34('0x16'));var db=require(_0x2e34('0x17'))['db'];function respondWithStatusCode(_0x426338,_0x30bf64){_0x30bf64=_0x30bf64||0xcc;return function(_0x580db6){if(_0x580db6){return _0x426338[_0x2e34('0x18')](_0x30bf64);}return _0x426338[_0x2e34('0x19')](_0x30bf64)['end']();};}function respondWithResult(_0x47f0fb,_0x1741a4){_0x1741a4=_0x1741a4||0xc8;return function(_0x5ddb0b){if(_0x5ddb0b){return _0x47f0fb[_0x2e34('0x19')](_0x1741a4)[_0x2e34('0x1a')](_0x5ddb0b);}};}function respondWithFilteredResult(_0x1b9c82,_0x15ac8d){return function(_0x10d109){if(_0x10d109){var _0x22a048=typeof _0x15ac8d[_0x2e34('0x1b')]===_0x2e34('0x1c')&&typeof _0x15ac8d[_0x2e34('0x1d')]===_0x2e34('0x1c');var _0x122ac4=_0x10d109[_0x2e34('0x1e')];var _0x5d659e=_0x22a048?0x0:_0x15ac8d[_0x2e34('0x1b')];var _0x5125cc=_0x22a048?_0x10d109[_0x2e34('0x1e')]:_0x15ac8d[_0x2e34('0x1b')]+_0x15ac8d[_0x2e34('0x1d')];var _0x3ff0bd;if(_0x5125cc>=_0x122ac4){_0x5125cc=_0x122ac4;_0x3ff0bd=0xc8;}else{_0x3ff0bd=0xce;}_0x1b9c82[_0x2e34('0x19')](_0x3ff0bd);return _0x1b9c82[_0x2e34('0x1f')](_0x2e34('0x20'),_0x5d659e+'-'+_0x5125cc+'/'+_0x122ac4)['json'](_0x10d109);}return null;};}function patchUpdates(_0x5e0235){return function(_0x3ec497){try{jsonpatch['apply'](_0x3ec497,_0x5e0235,!![]);}catch(_0x54749e){return BPromise[_0x2e34('0x21')](_0x54749e);}return _0x3ec497[_0x2e34('0x22')]();};}function saveUpdates(_0x14794d,_0x36e35a){return function(_0x552734){if(_0x552734){return _0x552734[_0x2e34('0x23')](_0x14794d)[_0x2e34('0x24')](function(_0x1d65f4){return _0x1d65f4;});}return null;};}function removeEntity(_0x2828c5,_0x28e2f2){return function(_0x9f145e){if(_0x9f145e){return _0x9f145e['destroy']()[_0x2e34('0x24')](function(){_0x2828c5[_0x2e34('0x19')](0xcc)[_0x2e34('0x25')]();});}};}function handleEntityNotFound(_0xa4b1ca,_0x3ccbec){return function(_0x3f7a56){if(!_0x3f7a56){_0xa4b1ca['sendStatus'](0x194);}return _0x3f7a56;};}function handleError(_0x48091c,_0x48c9ca){_0x48c9ca=_0x48c9ca||0x1f4;return function(_0x16db14){logger[_0x2e34('0x26')](_0x16db14[_0x2e34('0x27')]);if(_0x16db14['name']){delete _0x16db14[_0x2e34('0x28')];}_0x48091c[_0x2e34('0x19')](_0x48c9ca)[_0x2e34('0x29')](_0x16db14);};}exports[_0x2e34('0x2a')]=function(_0x5072a0,_0x23e6cc){var _0x5cdfe0={},_0x363a9e={},_0x2c277f={'count':0x0,'rows':[]};var _0x6c2434=_[_0x2e34('0x2b')](db[_0x2e34('0x2c')][_0x2e34('0x2d')],function(_0x510cad){return{'name':_0x510cad[_0x2e34('0x2e')],'type':_0x510cad[_0x2e34('0x2f')][_0x2e34('0x30')]};});_0x363a9e[_0x2e34('0x31')]=_[_0x2e34('0x2b')](_0x6c2434,'name');_0x363a9e[_0x2e34('0x32')]=_[_0x2e34('0x33')](_0x5072a0['query']);_0x363a9e[_0x2e34('0x34')]=_[_0x2e34('0x35')](_0x363a9e[_0x2e34('0x31')],_0x363a9e[_0x2e34('0x32')]);_0x5cdfe0[_0x2e34('0x36')]=_[_0x2e34('0x35')](_0x363a9e[_0x2e34('0x31')],qs[_0x2e34('0x37')](_0x5072a0[_0x2e34('0x32')]['fields']));_0x5cdfe0[_0x2e34('0x36')]=_0x5cdfe0[_0x2e34('0x36')][_0x2e34('0x38')]?_0x5cdfe0['attributes']:_0x363a9e[_0x2e34('0x31')];if(!_0x5072a0[_0x2e34('0x32')][_0x2e34('0x39')](_0x2e34('0x3a'))){_0x5cdfe0['limit']=qs[_0x2e34('0x1d')](_0x5072a0['query'][_0x2e34('0x1d')]);_0x5cdfe0[_0x2e34('0x1b')]=qs['offset'](_0x5072a0[_0x2e34('0x32')]['offset']);}_0x5cdfe0[_0x2e34('0x3b')]=qs[_0x2e34('0x3c')](_0x5072a0[_0x2e34('0x32')][_0x2e34('0x3c')]);_0x5cdfe0[_0x2e34('0x3d')]=qs[_0x2e34('0x34')](_[_0x2e34('0x3e')](_0x5072a0[_0x2e34('0x32')],_0x363a9e[_0x2e34('0x34')]),_0x6c2434);if(_0x5072a0['query'][_0x2e34('0x3f')]){_0x5cdfe0[_0x2e34('0x3d')]=_[_0x2e34('0x40')](_0x5cdfe0[_0x2e34('0x3d')],{'$or':_[_0x2e34('0x2b')](_0x6c2434,function(_0x4e4819){if(_0x4e4819['type']!==_0x2e34('0x41')){var _0x41f310={};_0x41f310[_0x4e4819[_0x2e34('0x28')]]={'$like':'%'+_0x5072a0[_0x2e34('0x32')][_0x2e34('0x3f')]+'%'};return _0x41f310;}})});}_0x5cdfe0=_[_0x2e34('0x40')]({},_0x5cdfe0,_0x5072a0[_0x2e34('0x42')]);var _0xad0b30={'where':_0x5cdfe0['where']};return db[_0x2e34('0x2c')][_0x2e34('0x1e')](_0xad0b30)[_0x2e34('0x24')](function(_0x462a59){_0x2c277f[_0x2e34('0x1e')]=_0x462a59;if(_0x5072a0[_0x2e34('0x32')]['includeAll']){_0x5cdfe0[_0x2e34('0x43')]=[{'all':!![]}];}return db[_0x2e34('0x2c')][_0x2e34('0x44')](_0x5cdfe0);})[_0x2e34('0x24')](function(_0x37e6c4){_0x2c277f[_0x2e34('0x45')]=_0x37e6c4;return _0x2c277f;})['then'](respondWithFilteredResult(_0x23e6cc,_0x5cdfe0))[_0x2e34('0x46')](handleError(_0x23e6cc,null));};exports[_0x2e34('0x47')]=function(_0x5eb237,_0x1db793){var _0xcd3ab2={'raw':!![],'where':{'id':_0x5eb237[_0x2e34('0x48')]['id']}},_0x398393={};_0x398393[_0x2e34('0x31')]=_[_0x2e34('0x33')](db[_0x2e34('0x2c')][_0x2e34('0x2d')]);_0x398393[_0x2e34('0x32')]=_['keys'](_0x5eb237[_0x2e34('0x32')]);_0x398393[_0x2e34('0x34')]=_[_0x2e34('0x35')](_0x398393[_0x2e34('0x31')],_0x398393[_0x2e34('0x32')]);_0xcd3ab2['attributes']=_[_0x2e34('0x35')](_0x398393[_0x2e34('0x31')],qs[_0x2e34('0x37')](_0x5eb237[_0x2e34('0x32')][_0x2e34('0x37')]));_0xcd3ab2[_0x2e34('0x36')]=_0xcd3ab2[_0x2e34('0x36')]['length']?_0xcd3ab2[_0x2e34('0x36')]:_0x398393[_0x2e34('0x31')];if(_0x5eb237[_0x2e34('0x32')][_0x2e34('0x49')]){_0xcd3ab2['include']=[{'all':!![]}];}_0xcd3ab2=_[_0x2e34('0x40')]({},_0xcd3ab2,_0x5eb237['options']);return db['FaxApplication'][_0x2e34('0x4a')](_0xcd3ab2)[_0x2e34('0x24')](handleEntityNotFound(_0x1db793,null))['then'](respondWithResult(_0x1db793,null))[_0x2e34('0x46')](handleError(_0x1db793,null));};exports[_0x2e34('0x4b')]=function(_0x67ae65,_0x5d2d61){return db[_0x2e34('0x2c')]['create'](_0x67ae65['body'],{})[_0x2e34('0x24')](respondWithResult(_0x5d2d61,0xc9))[_0x2e34('0x46')](handleError(_0x5d2d61,null));};exports[_0x2e34('0x23')]=function(_0x37e1d3,_0x20654a){if(_0x37e1d3[_0x2e34('0x4c')]['id']){delete _0x37e1d3[_0x2e34('0x4c')]['id'];}return db[_0x2e34('0x2c')][_0x2e34('0x4a')]({'where':{'id':_0x37e1d3[_0x2e34('0x48')]['id']}})[_0x2e34('0x24')](handleEntityNotFound(_0x20654a,null))['then'](saveUpdates(_0x37e1d3[_0x2e34('0x4c')],null))['then'](respondWithResult(_0x20654a,null))[_0x2e34('0x46')](handleError(_0x20654a,null));};exports[_0x2e34('0x4d')]=function(_0x26033e,_0xaf4d49){return db[_0x2e34('0x2c')][_0x2e34('0x4a')]({'where':{'id':_0x26033e[_0x2e34('0x48')]['id']}})[_0x2e34('0x24')](handleEntityNotFound(_0xaf4d49,null))['then'](removeEntity(_0xaf4d49,null))['catch'](handleError(_0xaf4d49,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ef55027..6f9f05c 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 _0xc361=['bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','moment'];(function(_0x18d11c,_0x5ce545){var _0x464640=function(_0x2db4b9){while(--_0x2db4b9){_0x18d11c['push'](_0x18d11c['shift']());}};_0x464640(++_0x5ce545);}(_0xc361,0x106));var _0x1c36=function(_0x3349a2,_0xa1a17a){_0x3349a2=_0x3349a2-0x0;var _0x3532a6=_0xc361[_0x3349a2];return _0x3532a6;};'use strict';var _=require('lodash');var util=require(_0x1c36('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1c36('0x1'));var BPromise=require(_0x1c36('0x2'));var rp=require(_0x1c36('0x3'));var fs=require('fs');var path=require(_0x1c36('0x4'));var rimraf=require('rimraf');var config=require(_0x1c36('0x5'));var attributes=require(_0x1c36('0x6'));module[_0x1c36('0x7')]=function(_0x590a25,_0x3dc867){return _0x590a25[_0x1c36('0x8')]('FaxApplication',attributes,{'tableName':_0x1c36('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1c36('0xa'),'collate':_0x1c36('0xb')});}; \ No newline at end of file +var _0xc262=['api','moment','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xc262,0x1cc));var _0x2c26=function(_0x51fb74,_0x5b169b){_0x51fb74=_0x51fb74-0x0;var _0x1d62dd=_0xc262[_0x51fb74];return _0x1d62dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2c26('0x0'));var moment=require(_0x2c26('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c26('0x2'));var rimraf=require(_0x2c26('0x3'));var config=require(_0x2c26('0x4'));var attributes=require('./faxApplication.attributes');module[_0x2c26('0x5')]=function(_0x39e691,_0x279954){return _0x39e691[_0x2c26('0x6')](_0x2c26('0x7'),attributes,{'tableName':_0x2c26('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2c26('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 95951a4..12cfcd6 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 _0x930e=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent'];(function(_0x46191b,_0x39929d){var _0x7b8c24=function(_0x4eeb8a){while(--_0x4eeb8a){_0x46191b['push'](_0x46191b['shift']());}};_0x7b8c24(++_0x39929d);}(_0x930e,0x179));var _0xe930=function(_0x279b9b,_0x551087){_0x279b9b=_0x279b9b-0x0;var _0xeca0a1=_0x930e[_0x279b9b];return _0xeca0a1;};'use strict';var _=require(_0xe930('0x0'));var util=require(_0xe930('0x1'));var moment=require(_0xe930('0x2'));var BPromise=require('bluebird');var rs=require(_0xe930('0x3'));var fs=require('fs');var Redis=require(_0xe930('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe930('0x5'))(_0xe930('0x6'));var config=require(_0xe930('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe930('0x8')][_0xe930('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bb95a,_0x316838,_0xfe3c48){return new BPromise(function(_0x372b9c,_0x8d4f8a){return client[_0xe930('0xa')](_0x1bb95a,_0xfe3c48)['then'](function(_0x363fc8){logger[_0xe930('0xb')]('FaxApplication,\x20%s,\x20%s',_0x316838,_0xe930('0xc'));logger[_0xe930('0xd')](_0xe930('0xe'),_0x316838,_0xe930('0xc'),JSON[_0xe930('0xf')](_0x363fc8));if(_0x363fc8['error']){if(_0x363fc8[_0xe930('0x10')]['code']===0x1f4){logger['error'](_0xe930('0x11'),_0x316838,_0x363fc8[_0xe930('0x10')][_0xe930('0x12')]);return _0x8d4f8a(_0x363fc8[_0xe930('0x10')][_0xe930('0x12')]);}logger[_0xe930('0x10')](_0xe930('0x11'),_0x316838,_0x363fc8[_0xe930('0x10')][_0xe930('0x12')]);return _0x372b9c(_0x363fc8[_0xe930('0x10')][_0xe930('0x12')]);}else{logger[_0xe930('0xb')](_0xe930('0x11'),_0x316838,'request\x20sent');_0x372b9c(_0x363fc8[_0xe930('0x13')][_0xe930('0x12')]);}})[_0xe930('0x14')](function(_0x279342){logger[_0xe930('0x10')](_0xe930('0x11'),_0x316838,_0x279342);_0x8d4f8a(_0x279342);});});}exports[_0xe930('0x15')]=function(_0x5aca8d){var _0x13f897=this;return new Promise(function(_0x5db9bc,_0x2d6ec3){return db[_0xe930('0x16')][_0xe930('0x17')](_0x5aca8d[_0xe930('0x18')],{'raw':_0x5aca8d[_0xe930('0x19')]?_0x5aca8d[_0xe930('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aca8d[_0xe930('0x19')]?_0x5aca8d[_0xe930('0x19')][_0xe930('0x1a')]||null:null,'attributes':_0x5aca8d['options']?_0x5aca8d[_0xe930('0x19')][_0xe930('0x1b')]||null:null,'limit':_0x5aca8d[_0xe930('0x19')]?_0x5aca8d[_0xe930('0x19')][_0xe930('0x1c')]||null:null})[_0xe930('0x1d')](function(_0xc79d9a){logger['info']('UpdateFaxApplication',_0x5aca8d);logger[_0xe930('0xd')](_0xe930('0x15'),_0x5aca8d,JSON[_0xe930('0xf')](_0xc79d9a));_0x5db9bc(_0xc79d9a);})[_0xe930('0x14')](function(_0x3c9fff){logger['error']('UpdateFaxApplication',_0x3c9fff[_0xe930('0x12')],_0x5aca8d);_0x2d6ec3(_0x13f897[_0xe930('0x10')](0x1f4,_0x3c9fff[_0xe930('0x12')]));});});}; \ No newline at end of file +var _0x3647=['error','code','message','result','catch','FaxApplication','update','body','options','raw','attributes','limit','then','UpdateFaxApplication','debug','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','stringify'];(function(_0x440a92,_0x25d5b7){var _0x13571d=function(_0x3a7f49){while(--_0x3a7f49){_0x440a92['push'](_0x440a92['shift']());}};_0x13571d(++_0x25d5b7);}(_0x3647,0x161));var _0x7364=function(_0x4c60a6,_0x232e71){_0x4c60a6=_0x4c60a6-0x0;var _0x3c61de=_0x3647[_0x4c60a6];return _0x3c61de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7364('0x0'));var BPromise=require('bluebird');var rs=require(_0x7364('0x1'));var fs=require('fs');var Redis=require(_0x7364('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7364('0x3'));var logger=require(_0x7364('0x4'))('rpc');var config=require(_0x7364('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7364('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24ee88,_0x4e7e67,_0x27aa8b){return new BPromise(function(_0x875162,_0x19a782){return client[_0x7364('0x7')](_0x24ee88,_0x27aa8b)['then'](function(_0x5cdd55){logger[_0x7364('0x8')]('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x7364('0x9'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4e7e67,'request\x20sent',JSON[_0x7364('0xa')](_0x5cdd55));if(_0x5cdd55['error']){if(_0x5cdd55[_0x7364('0xb')][_0x7364('0xc')]===0x1f4){logger[_0x7364('0xb')]('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x5cdd55['error']['message']);return _0x19a782(_0x5cdd55['error'][_0x7364('0xd')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x5cdd55[_0x7364('0xb')][_0x7364('0xd')]);return _0x875162(_0x5cdd55[_0x7364('0xb')][_0x7364('0xd')]);}else{logger[_0x7364('0x8')]('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x7364('0x9'));_0x875162(_0x5cdd55[_0x7364('0xe')][_0x7364('0xd')]);}})[_0x7364('0xf')](function(_0x4c5f49){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4e7e67,_0x4c5f49);_0x19a782(_0x4c5f49);});});}exports['UpdateFaxApplication']=function(_0x28189c){var _0x58a24a=this;return new Promise(function(_0x1fd236,_0xf0ae2d){return db[_0x7364('0x10')][_0x7364('0x11')](_0x28189c[_0x7364('0x12')],{'raw':_0x28189c[_0x7364('0x13')]?_0x28189c[_0x7364('0x13')][_0x7364('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28189c[_0x7364('0x13')]?_0x28189c['options']['where']||null:null,'attributes':_0x28189c[_0x7364('0x13')]?_0x28189c[_0x7364('0x13')][_0x7364('0x15')]||null:null,'limit':_0x28189c[_0x7364('0x13')]?_0x28189c[_0x7364('0x13')][_0x7364('0x16')]||null:null})[_0x7364('0x17')](function(_0x9de9de){logger[_0x7364('0x8')](_0x7364('0x18'),_0x28189c);logger[_0x7364('0x19')](_0x7364('0x18'),_0x28189c,JSON[_0x7364('0xa')](_0x9de9de));_0x1fd236(_0x9de9de);})[_0x7364('0xf')](function(_0x550f56){logger[_0x7364('0xb')](_0x7364('0x18'),_0x550f56['message'],_0x28189c);_0xf0ae2d(_0x58a24a['error'](0x1f4,_0x550f56[_0x7364('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 9353f57..5957801 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 _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2e6406,_0x3b7e29){var _0x340e3b=function(_0x2d5622){while(--_0x2d5622){_0x2e6406['push'](_0x2e6406['shift']());}};_0x340e3b(++_0x3b7e29);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4bd21e,_0x5e331b){_0x4bd21e=_0x4bd21e-0x0;var _0x49634d=_0xb03e[_0x4bd21e];return _0x49634d;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file +var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x2ebfd0,_0x46da5a){var _0x12da74=function(_0x4b4fdb){while(--_0x4b4fdb){_0x2ebfd0['push'](_0x2ebfd0['shift']());}};_0x12da74(++_0x46da5a);}(_0xa571,0x107));var _0x1a57=function(_0x2d56ef,_0x399c70){_0x2d56ef=_0x2d56ef-0x0;var _0x29b4ca=_0xa571[_0x2d56ef];return _0x29b4ca;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('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 e855df5..3352d5b 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 _0xf99c=['exports','DATE','STRING','ENUM','out'];(function(_0x5e33f6,_0x2e18e6){var _0x20cb0f=function(_0x358e5c){while(--_0x358e5c){_0x5e33f6['push'](_0x5e33f6['shift']());}};_0x20cb0f(++_0x2e18e6);}(_0xf99c,0x109));var _0xcf99=function(_0x4ae84b,_0x3269cb){_0x4ae84b=_0x4ae84b-0x0;var _0x1f2e58=_0xf99c[_0x4ae84b];return _0x1f2e58;};'use strict';var Sequelize=require('sequelize');module[_0xcf99('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcf99('0x1')]},'disposition':{'type':Sequelize[_0xcf99('0x2')]},'secondDisposition':{'type':Sequelize[_0xcf99('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcf99('0x2')]},'note':{'type':Sequelize[_0xcf99('0x2')]},'read1stAt':{'type':Sequelize[_0xcf99('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xcf99('0x3')]('in',_0xcf99('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcf99('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3104=['out','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1dbaec,_0x3c991f){var _0x4badf4=function(_0x563229){while(--_0x563229){_0x1dbaec['push'](_0x1dbaec['shift']());}};_0x4badf4(++_0x3c991f);}(_0x3104,0x11e));var _0x4310=function(_0x5da615,_0x4ee8c4){_0x5da615=_0x5da615-0x0;var _0x14f07b=_0x3104[_0x5da615];return _0x14f07b;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4310('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4310('0x1')]},'disposition':{'type':Sequelize[_0x4310('0x2')]},'secondDisposition':{'type':Sequelize[_0x4310('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4310('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4310('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x4310('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4310('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x4310('0x3')]('in',_0x4310('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 3de80fa..10e6867 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 _0xaf0f=['intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','users','u.id\x20=\x20ui.UserId','cm_contacts','left_join','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','params','includeAll','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','$gte','format','include','findAll','rows','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','save','update','error','name','send','map','fullname','TagIds','Tags','forEach','push','then','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','attributes'];(function(_0x211e87,_0x19bcbc){var _0x2d027f=function(_0x185d0e){while(--_0x185d0e){_0x211e87['push'](_0x211e87['shift']());}};_0x2d027f(++_0x19bcbc);}(_0xaf0f,0x9c));var _0xfaf0=function(_0x449b75,_0x19a550){_0x449b75=_0x449b75-0x0;var _0x5d0657=_0xaf0f[_0x449b75];return _0x5d0657;};'use strict';var emlformat=require(_0xfaf0('0x0'));var rimraf=require(_0xfaf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfaf0('0x2'));var BPromise=require(_0xfaf0('0x3'));var Mustache=require(_0xfaf0('0x4'));var util=require(_0xfaf0('0x5'));var path=require(_0xfaf0('0x6'));var sox=require(_0xfaf0('0x7'));var csv=require(_0xfaf0('0x8'));var ejs=require(_0xfaf0('0x9'));var fs=require('fs');var fs_extra=require(_0xfaf0('0xa'));var _=require(_0xfaf0('0xb'));var squel=require(_0xfaf0('0xc'));var crypto=require(_0xfaf0('0xd'));var jsforce=require(_0xfaf0('0xe'));var deskjs=require(_0xfaf0('0xf'));var toCsv=require(_0xfaf0('0x8'));var querystring=require(_0xfaf0('0x10'));var Papa=require(_0xfaf0('0x11'));var Redis=require(_0xfaf0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfaf0('0x13'));var as=require(_0xfaf0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfaf0('0x15'))(_0xfaf0('0x16'));var utils=require(_0xfaf0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfaf0('0x18'))['db'];config['redis']=_[_0xfaf0('0x19')](config[_0xfaf0('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfaf0('0x1b'))(new Redis(config['redis']));require(_0xfaf0('0x1c'))[_0xfaf0('0x1d')](socket);function respondWithStatusCode(_0x340a1a,_0x204f31){_0x204f31=_0x204f31||0xcc;return function(_0x58acb9){if(_0x58acb9){return _0x340a1a[_0xfaf0('0x1e')](_0x204f31);}return _0x340a1a[_0xfaf0('0x1f')](_0x204f31)[_0xfaf0('0x20')]();};}function respondWithResult(_0x1e5439,_0x3f98d9){_0x3f98d9=_0x3f98d9||0xc8;return function(_0x56c722){if(_0x56c722){return _0x1e5439[_0xfaf0('0x1f')](_0x3f98d9)[_0xfaf0('0x21')](_0x56c722);}};}function respondWithFilteredResult(_0xa3ab8c,_0x5cd3da){return function(_0x9e9bd){if(_0x9e9bd){var _0xc88686=typeof _0x5cd3da['offset']===_0xfaf0('0x22')&&typeof _0x5cd3da[_0xfaf0('0x23')]==='undefined';var _0x1a6cce=_0x9e9bd['count'];var _0xcbef41=_0xc88686?0x0:_0x5cd3da[_0xfaf0('0x24')];var _0x5b4c84=_0xc88686?_0x9e9bd[_0xfaf0('0x25')]:_0x5cd3da[_0xfaf0('0x24')]+_0x5cd3da[_0xfaf0('0x23')];var _0x59966d;if(_0x5b4c84>=_0x1a6cce){_0x5b4c84=_0x1a6cce;_0x59966d=0xc8;}else{_0x59966d=0xce;}_0xa3ab8c['status'](_0x59966d);return _0xa3ab8c[_0xfaf0('0x26')]('Content-Range',_0xcbef41+'-'+_0x5b4c84+'/'+_0x1a6cce)[_0xfaf0('0x21')](_0x9e9bd);}return null;};}function patchUpdates(_0x5a16a7){return function(_0x8ded1e){try{jsonpatch['apply'](_0x8ded1e,_0x5a16a7,!![]);}catch(_0x96ebab){return BPromise[_0xfaf0('0x27')](_0x96ebab);}return _0x8ded1e[_0xfaf0('0x28')]();};}function saveUpdates(_0xcea2ef,_0x4dcde5){return function(_0x5d1cd9){if(_0x5d1cd9){return _0x5d1cd9[_0xfaf0('0x29')](_0xcea2ef)['then'](function(_0x2c82f0){return _0x2c82f0;});}return null;};}function removeEntity(_0x579525,_0x5070a){return function(_0x24ad45){if(_0x24ad45){return _0x24ad45['destroy']()['then'](function(){_0x579525[_0xfaf0('0x1f')](0xcc)[_0xfaf0('0x20')]();});}};}function handleEntityNotFound(_0x43d549,_0x1bdbf2){return function(_0x5def06){if(!_0x5def06){_0x43d549[_0xfaf0('0x1e')](0x194);}return _0x5def06;};}function handleError(_0x320cec,_0x59c21d){_0x59c21d=_0x59c21d||0x1f4;return function(_0x107c90){logger[_0xfaf0('0x2a')](_0x107c90['stack']);if(_0x107c90['name']){delete _0x107c90[_0xfaf0('0x2b')];}_0x320cec[_0xfaf0('0x1f')](_0x59c21d)[_0xfaf0('0x2c')](_0x107c90);};}function getInteractionUsers(_0x126590,_0x519875){return new BPromise(function(_0xcda965,_0xe785){try{if(_0x519875[_0x126590['id']]){_0x126590['Users']=_[_0xfaf0('0x2d')](_0x519875[_0x126590['id']],function(_0x26368e){return{'id':_0x26368e['id'],'fullname':_0x26368e[_0xfaf0('0x2e')]};});}}catch(_0x4cc279){_0xe785(_0x4cc279);}_0xcda965(_0x126590);});}function getInteractionTags(_0x5d66df,_0x4a6237){return new BPromise(function(_0x45a8a2,_0x112d52){try{if(_0x5d66df[_0xfaf0('0x2f')]){_0x5d66df[_0xfaf0('0x30')]=[];_0x5d66df[_0xfaf0('0x2f')]['split'](',')[_0xfaf0('0x31')](function(_0x1089b0){_0x5d66df[_0xfaf0('0x30')][_0xfaf0('0x32')](_0x4a6237[_0x1089b0]);});}delete _0x5d66df[_0xfaf0('0x2f')];}catch(_0x2e0a62){_0x112d52(_0x2e0a62);}_0x45a8a2(_0x5d66df);});}function updateFaxInteraction(_0x37d1f5,_0x5207b3,_0x1c3802){return new BPromise(function(_0x435597,_0x393123){return getInteractionUsers(_0x37d1f5,_0x1c3802)[_0xfaf0('0x33')](function(_0x5400dc){return getInteractionTags(_0x5400dc,_0x5207b3);})[_0xfaf0('0x33')](function(_0x4747d4){return getStateInteraction(_0x4747d4);})[_0xfaf0('0x33')](function(_0xf83870){_0x435597(_0xf83870);})[_0xfaf0('0x34')](function(_0x2a7def){_0x393123(_0x2a7def);});});}function getStateInteraction(_0x493f3f){return new BPromise(function(_0x3fdae4){_0x493f3f[_0xfaf0('0x35')]=0x0;_0x493f3f['talking']=0x0;_0x493f3f[_0xfaf0('0x36')]=0x0;_0x493f3f[_0xfaf0('0x37')]=0x0;_0x493f3f[_0xfaf0('0x38')]=0x0;if(!_0x493f3f[_0xfaf0('0x39')]&&!_0x493f3f[_0xfaf0('0x3a')]){_0x493f3f[_0xfaf0('0x35')]+=0x1;}if(!_0x493f3f['closed']&&_0x493f3f[_0xfaf0('0x3a')]){_0x493f3f[_0xfaf0('0x3b')]+=0x1;if(_0x493f3f[_0xfaf0('0x35')]){_0x493f3f['waiting']-=0x1;}}if(_0x493f3f['closed']&&_0x493f3f[_0xfaf0('0x3a')]){_0x493f3f[_0xfaf0('0x36')]+=0x1;if(_0x493f3f[_0xfaf0('0x3b')]){_0x493f3f[_0xfaf0('0x3b')]-=0x1;}}if(_0x493f3f[_0xfaf0('0x39')]&&!_0x493f3f[_0xfaf0('0x3a')]){_0x493f3f[_0xfaf0('0x37')]+=0x1;if(_0x493f3f[_0xfaf0('0x35')]){_0x493f3f[_0xfaf0('0x35')]-=0x1;}}_0x493f3f[_0xfaf0('0x38')]+=0x1;_0x3fdae4(_0x493f3f);});}exports[_0xfaf0('0x3c')]=function(_0x303e34,_0x3556be){var _0x4b6255={},_0x264bc6={},_0x202902={'count':0x0,'rows':[]};var _0x48fd3=_['map'](db[_0xfaf0('0x3d')][_0xfaf0('0x3e')],function(_0x25e85e){return{'name':_0x25e85e[_0xfaf0('0x3f')],'type':_0x25e85e[_0xfaf0('0x40')][_0xfaf0('0x41')]};});_0x264bc6[_0xfaf0('0x42')]=_[_0xfaf0('0x2d')](_0x48fd3,_0xfaf0('0x2b'));_0x264bc6['query']=_[_0xfaf0('0x43')](_0x303e34[_0xfaf0('0x44')]);_0x264bc6['filters']=_['intersection'](_0x264bc6[_0xfaf0('0x42')],_0x264bc6[_0xfaf0('0x44')]);_0x4b6255[_0xfaf0('0x45')]=_[_0xfaf0('0x46')](_0x264bc6[_0xfaf0('0x42')],qs[_0xfaf0('0x47')](_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x47')]));_0x4b6255['attributes']=_0x4b6255[_0xfaf0('0x45')]['length']?_0x4b6255[_0xfaf0('0x45')]:_0x264bc6[_0xfaf0('0x42')];if(!_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x48')](_0xfaf0('0x49'))){_0x4b6255[_0xfaf0('0x23')]=qs[_0xfaf0('0x23')](_0x303e34[_0xfaf0('0x44')]['limit']);_0x4b6255[_0xfaf0('0x24')]=qs['offset'](_0x303e34['query']['offset']);}_0x4b6255[_0xfaf0('0x4a')]=qs[_0xfaf0('0x4b')](_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x4b')]);_0x4b6255[_0xfaf0('0x4c')]=qs[_0xfaf0('0x4d')](_[_0xfaf0('0x4e')](_0x303e34['query'],_0x264bc6[_0xfaf0('0x4d')]),_0x48fd3);var _0x40b344=[];var _0x17ae98=squel[_0xfaf0('0x4f')]()[_0xfaf0('0x50')]('id')[_0xfaf0('0x50')](_0xfaf0('0x2b'))[_0xfaf0('0x50')](_0xfaf0('0x51'))[_0xfaf0('0x52')]('tools_tags');var _0x4aea5a=squel[_0xfaf0('0x4f')]()['field'](_0xfaf0('0x53'))[_0xfaf0('0x50')](_0xfaf0('0x54'))['field']('ui.FaxInteractionId')[_0xfaf0('0x52')]('user_has_fax_interactions','ui')['left_join'](_0xfaf0('0x55'),'u',_0xfaf0('0x56'));var _0x1708c3=squel[_0xfaf0('0x4f')]()['from']('fax_interactions','i')['left_join'](_0xfaf0('0x57'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xfaf0('0x58')]('users','o',_0xfaf0('0x59'))['left_join'](_0xfaf0('0x5a'),'a',_0xfaf0('0x5b'))[_0xfaf0('0x58')](_0xfaf0('0x5c'),'me',_0xfaf0('0x5d'))[_0xfaf0('0x58')](_0xfaf0('0x5e'),'it',_0xfaf0('0x5f'))[_0xfaf0('0x58')](_0xfaf0('0x60'),'t',_0xfaf0('0x61'));var _0x28bc48=squel[_0xfaf0('0x62')]();var _0x1dadb7=[];var _0xabdc15=squel['expr']();var _0x6e333e;if(_0x303e34[_0xfaf0('0x44')]['search']){_0x6e333e=as[_0xfaf0('0x63')](_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x64')]);var _0x1da290=_0x6e333e[_0xfaf0('0x65')];for(var _0x3984ff=0x0;_0x3984ff<_0x6e333e[_0xfaf0('0x66')][_0xfaf0('0x67')];_0x3984ff++){var _0x53ccdc=_0x6e333e[_0xfaf0('0x66')][_0x3984ff];var _0x3a08ae='i';var _0x29eea2=_[_0xfaf0('0x68')](_0x48fd3,['name',_0x53ccdc['field']]);if(!_0x29eea2){switch(_0x53ccdc[_0xfaf0('0x50')]){case _0xfaf0('0x69'):if(_0x53ccdc[_0xfaf0('0x6a')]==0x1){_0x1708c3[_0xfaf0('0x6b')]('`'+_0x53ccdc[_0xfaf0('0x50')]+_0xfaf0('0x6c'));}else{_0x1708c3['having']('`'+_0x53ccdc[_0xfaf0('0x50')]+_0xfaf0('0x6d'));}break;case'Contact':if(_0x53ccdc[_0xfaf0('0x6e')]===_0xfaf0('0x6f')){if(_0x53ccdc[_0xfaf0('0x6a')][_0xfaf0('0x70')]('\x20')[_0xfaf0('0x67')]>0x1){_0x28bc48[_0x1da290]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfaf0('0x71')](_0x53ccdc[_0xfaf0('0x6a')]),null);}else{var _0x3c668b='%'+_0x53ccdc['value']+'%';_0x28bc48[_0x1da290](_0xfaf0('0x72'),_0x3c668b,_0x3c668b,_0x3c668b);}}else{_0x29eea2=_['find'](_0x48fd3,['name',_0xfaf0('0x73')]);_0x53ccdc['field']=_0xfaf0('0x73');_0x26b229=as[_0xfaf0('0x74')](_0x3a08ae,_0x29eea2[_0xfaf0('0x40')],_0x53ccdc);_0x28bc48[_0x1da290](_0x26b229[_0xfaf0('0x75')],_0x26b229[_0xfaf0('0x6a')]['start'],_0x26b229[_0xfaf0('0x6a')][_0xfaf0('0x20')]);}break;case _0xfaf0('0x76'):var _0x1919e4=_0x53ccdc[_0xfaf0('0x6a')][_0xfaf0('0x70')](',')[_0xfaf0('0x2d')](function(_0x1dc9b4){return Number(_0x1dc9b4);});_0x1919e4['forEach'](function(_0x21923a){_0xabdc15['or'](_0xfaf0('0x77'),'%,'+_0x21923a+',%');});_0x1dadb7=_[_0xfaf0('0x78')](_0x1dadb7,_0x1919e4);break;case'User':if(_0x53ccdc[_0xfaf0('0x6e')]===_0xfaf0('0x6f')){_0x28bc48[_0x1da290](_0xfaf0('0x79'),'%'+_0x53ccdc[_0xfaf0('0x6a')]+'%',null);}else{_0x29eea2=_[_0xfaf0('0x68')](_0x48fd3,[_0xfaf0('0x2b'),'UserId']);_0x53ccdc[_0xfaf0('0x50')]=_0xfaf0('0x3a');_0x26b229=as[_0xfaf0('0x74')](_0x3a08ae,_0x29eea2['type'],_0x53ccdc);_0x28bc48[_0x1da290](_0x26b229[_0xfaf0('0x75')],_0x26b229[_0xfaf0('0x6a')][_0xfaf0('0x7a')],_0x26b229['value']['end']);}break;case _0xfaf0('0x7b'):_0x26b229=as[_0xfaf0('0x74')]('me',null,_0x53ccdc);_0x28bc48[_0x1da290](_0x26b229[_0xfaf0('0x75')],_0x26b229[_0xfaf0('0x6a')]['start'],_0x26b229[_0xfaf0('0x6a')][_0xfaf0('0x20')]);break;}}else{var _0x26b229=as[_0xfaf0('0x74')](_0x3a08ae,_0x29eea2[_0xfaf0('0x40')],_0x53ccdc);_0x28bc48[_0x1da290](_0x26b229[_0xfaf0('0x75')],_0x26b229[_0xfaf0('0x6a')]['start'],_0x26b229[_0xfaf0('0x6a')][_0xfaf0('0x20')]);}}}else{var _0x5942e1=_(_0x303e34[_0xfaf0('0x44')])[_0xfaf0('0x43')]()[_0xfaf0('0x2d')](function(_0x4951a1){return _[_0xfaf0('0x7c')](_0x48fd3,[_0xfaf0('0x2b'),_0x4951a1])?_0x4951a1:undefined;})[_0xfaf0('0x7d')]()['value']();if(!_[_0xfaf0('0x7e')](_0x5942e1)){_0x5942e1[_0xfaf0('0x31')](function(_0x5aff50){if(_0x5aff50===_0xfaf0('0x7f')){_0x1708c3[_0xfaf0('0x4c')](_0xfaf0('0x80'),[][_0xfaf0('0x81')](_0x303e34[_0xfaf0('0x44')][_0x5aff50]));}else if(_0x5aff50==='createdAt'){var _0x582eae=JSON[_0xfaf0('0x82')](_0x303e34['query'][_0x5aff50])['$gte'];var _0x36769c=JSON[_0xfaf0('0x82')](_0x303e34[_0xfaf0('0x44')][_0x5aff50])[_0xfaf0('0x83')];_0x1708c3[_0xfaf0('0x4c')](_0xfaf0('0x84'),_0x582eae,_0x36769c);}else{if(_0x303e34[_0xfaf0('0x44')][_0x5aff50]==='null'){_0x1708c3[_0xfaf0('0x4c')]('i.'+_0x5aff50+'\x20IS\x20NULL');}else{_0x1708c3[_0xfaf0('0x4c')]('i.'+_0x5aff50+_0xfaf0('0x85'),_0x303e34[_0xfaf0('0x44')][_0x5aff50]);}}});}if(_0x303e34['query'][_0xfaf0('0x86')]){if(_0x303e34['query']['read']==0x1){_0x1708c3[_0xfaf0('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x1708c3[_0xfaf0('0x6b')](_0xfaf0('0x87'));}}if(_0x303e34[_0xfaf0('0x44')]['tag']){_0x1dadb7=_[_0xfaf0('0x88')](_0x303e34['query'][_0xfaf0('0x89')])?_0x303e34[_0xfaf0('0x44')]['tag']:new Array(_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x89')]);_0x1dadb7[_0xfaf0('0x31')](function(_0x3c63ef){_0xabdc15['or'](_0xfaf0('0x77'),'%,'+_0x3c63ef+',%');});}if(_0x303e34[_0xfaf0('0x44')]['filter']){var _0xab462e=_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x8a')][_0xfaf0('0x8b')]('\x5c','\x5c\x5c')[_0xfaf0('0x8b')](/'/g,'\x27\x27');if(qs[_0xfaf0('0x8c')](_0xab462e)){_0x28bc48['or']('i.id\x20LIKE\x20?',_0xab462e+'%')['or']('i.fax\x20LIKE\x20?',_0xab462e+'%');}_0x28bc48['or'](_0xfaf0('0x8d'),_0xab462e+'%');}}_0x1708c3[_0xfaf0('0x4c')](_0x28bc48);_0x1708c3[_0xfaf0('0x8e')](_0xfaf0('0x8f'));var _0x4af88b={'type':db['Sequelize'][_0xfaf0('0x90')]['SELECT'],'raw':!![]};var _0xd1154f=_0x1708c3[_0xfaf0('0x91')]();_0xd1154f[_0xfaf0('0x50')](_0xfaf0('0x8f'));_0xd1154f[_0xfaf0('0x50')](_0xfaf0('0x92'),'unreadMessages');if(_0x4b6255[_0xfaf0('0x4a')]){_0x4b6255[_0xfaf0('0x4a')][_0xfaf0('0x31')](function(_0x2e7265){var _0x3b8be3=_0x2e7265[0x0]===_0xfaf0('0x93')?_0x2e7265[0x0]:'i.'+_0x2e7265[0x0];_0x1708c3[_0xfaf0('0x4a')](_0x3b8be3,_0x2e7265[0x1]===_0xfaf0('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x1dadb7)){_0x1708c3[_0xfaf0('0x6b')](_0xabdc15);_0xd1154f['where']('t.id\x20IN\x20?',_0x1dadb7);}BPromise[_0xfaf0('0x95')]()[_0xfaf0('0x33')](function(){if(!_0x6e333e){if(_0x303e34['query']['FaxAccountId'])return;_0xd1154f[_0xfaf0('0x4c')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1708c3[_0xfaf0('0x4c')](_0xfaf0('0x96'));return;}if(_0x303e34[_0xfaf0('0x97')][_0xfaf0('0x98')]!=='agent')return;return _0x303e34[_0xfaf0('0x97')][_0xfaf0('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25229f){if(_['isEmpty'](_0x25229f)){_0xd1154f[_0xfaf0('0x4c')](_0xfaf0('0x9a'));_0x1708c3[_0xfaf0('0x4c')](_0xfaf0('0x9a'));}else{_0xd1154f['where'](_0xfaf0('0x80'),_[_0xfaf0('0x2d')](_0x25229f,'id'));_0x1708c3[_0xfaf0('0x4c')](_0xfaf0('0x80'),_[_0xfaf0('0x2d')](_0x25229f,'id'));}});})[_0xfaf0('0x33')](function(){if(_0x303e34[_0xfaf0('0x97')][_0xfaf0('0x98')]===_0xfaf0('0x9b')&&!_0x6e333e&&!_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x7f')])return[];return db[_0xfaf0('0x9c')]['query'](_0xd1154f['toString'](),_0x4af88b);})['then'](function(_0x513c25){_0x202902[_0xfaf0('0x25')]=_0x513c25[_0xfaf0('0x67')];if(_0x202902['count']===0x0)return[];return db['sequelize']['query'](_0x17ae98[_0xfaf0('0x9d')](),_0x4af88b)['then'](function(_0x200fcd){_0x40b344=_[_0xfaf0('0x9e')](_0x200fcd,'id');_0x4af88b=_[_0xfaf0('0x9f')](_0x4af88b,{'model':db[_0xfaf0('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x303e34[_0xfaf0('0x44')][_0xfaf0('0x47')]){_0x4b6255[_0xfaf0('0x45')][_0xfaf0('0x31')](function(_0x2eb3c7){_0x1708c3['field']('i.'+_0x2eb3c7);});}else{_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0x92'),'unreadMessages');_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xa0'),'Account.key');_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xa1'),_0xfaf0('0xa2'));_0x1708c3['field'](_0xfaf0('0xa3'),_0xfaf0('0x93'));_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xa4'));_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xa5'),'Contact.firstName');_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xa6'),_0xfaf0('0xa7'));_0x1708c3['field']('c.email',_0xfaf0('0xa8'));_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xa9'),_0xfaf0('0xaa'));_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xab'),_0xfaf0('0xac'));_0x1708c3['field'](_0xfaf0('0xad'),_0xfaf0('0xae'));_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xaf'),_0xfaf0('0xb0'));_0x1708c3[_0xfaf0('0x50')](_0xfaf0('0xb1'),_0xfaf0('0xb2'));_0x1708c3['field'](_0xfaf0('0xb3'),'TagIds');}if(_0x4b6255[_0xfaf0('0x23')])_0x1708c3[_0xfaf0('0x23')](_0x4b6255['limit']);if(_0x4b6255[_0xfaf0('0x24')])_0x1708c3[_0xfaf0('0x24')](_0x4b6255[_0xfaf0('0x24')]);return db['sequelize'][_0xfaf0('0x44')](_0x1708c3[_0xfaf0('0x9d')](),_0x4af88b);})[_0xfaf0('0x33')](function(_0x10d2ca){if(_0x10d2ca[_0xfaf0('0x67')]>0x0)_0x4aea5a[_0xfaf0('0x4c')](_0xfaf0('0xb4'),_[_0xfaf0('0x2d')](_0x10d2ca,'id'));return db[_0xfaf0('0x9c')]['query'](_0x4aea5a[_0xfaf0('0x9d')](),_0x4af88b)[_0xfaf0('0x33')](function(_0x23e2d6){var _0x377d3d=_[_0xfaf0('0xb5')](_0x23e2d6,_0xfaf0('0xb6'));var _0x599fd4=[];_0x10d2ca[_0xfaf0('0x31')](function(_0x1826c7){_0x599fd4[_0xfaf0('0x32')](updateFaxInteraction(_0x1826c7,_0x40b344,_0x377d3d));});return BPromise[_0xfaf0('0xb7')](_0x599fd4);});});})[_0xfaf0('0x33')](function(_0x52e201){_0x202902['rows']=_0x52e201;return _0x202902;})[_0xfaf0('0x33')](respondWithFilteredResult(_0x3556be,_0x4b6255))[_0xfaf0('0x34')](handleError(_0x3556be,null));};exports['show']=function(_0x17ddf3,_0x3ab811){var _0x40fcc1={'raw':![],'where':{'id':_0x17ddf3[_0xfaf0('0xb8')]['id']}},_0x4c6dd5={};_0x4c6dd5[_0xfaf0('0x42')]=_[_0xfaf0('0x43')](db[_0xfaf0('0x3d')][_0xfaf0('0x3e')]);_0x4c6dd5['query']=_['keys'](_0x17ddf3[_0xfaf0('0x44')]);_0x4c6dd5[_0xfaf0('0x4d')]=_['intersection'](_0x4c6dd5[_0xfaf0('0x42')],_0x4c6dd5[_0xfaf0('0x44')]);_0x40fcc1[_0xfaf0('0x45')]=_['intersection'](_0x4c6dd5[_0xfaf0('0x42')],qs['fields'](_0x17ddf3['query'][_0xfaf0('0x47')]));_0x40fcc1['attributes']=_0x40fcc1[_0xfaf0('0x45')][_0xfaf0('0x67')]?_0x40fcc1[_0xfaf0('0x45')]:_0x4c6dd5[_0xfaf0('0x42')];if(_0x17ddf3[_0xfaf0('0x44')][_0xfaf0('0xb9')]){_0x40fcc1['include']=[{'all':!![]}];}_0x40fcc1=_[_0xfaf0('0x9f')]({},_0x40fcc1,_0x17ddf3[_0xfaf0('0xba')]);return db[_0xfaf0('0x3d')][_0xfaf0('0x68')](_0x40fcc1)[_0xfaf0('0x33')](handleEntityNotFound(_0x3ab811,null))['then'](respondWithResult(_0x3ab811,null))['catch'](handleError(_0x3ab811,null));};exports[_0xfaf0('0xbb')]=function(_0x21a97d,_0x18567d){return db[_0xfaf0('0x3d')]['create'](_0x21a97d[_0xfaf0('0x7b')],{})[_0xfaf0('0x33')](respondWithResult(_0x18567d,0xc9))[_0xfaf0('0x34')](handleError(_0x18567d,null));};exports['update']=function(_0x327dd4,_0x53d656){if(_0x327dd4[_0xfaf0('0x7b')]['id']){delete _0x327dd4[_0xfaf0('0x7b')]['id'];}return db[_0xfaf0('0x3d')][_0xfaf0('0x68')]({'where':{'id':_0x327dd4[_0xfaf0('0xb8')]['id']}})['then'](handleEntityNotFound(_0x53d656,null))[_0xfaf0('0x33')](saveUpdates(_0x327dd4[_0xfaf0('0x7b')],null))[_0xfaf0('0x33')](respondWithResult(_0x53d656,null))[_0xfaf0('0x34')](handleError(_0x53d656,null));};exports[_0xfaf0('0xbc')]=function(_0x2761e2,_0x1cfb23){return db[_0xfaf0('0x3d')][_0xfaf0('0x68')]({'where':{'id':_0x2761e2['params']['id']}})[_0xfaf0('0x33')](handleEntityNotFound(_0x1cfb23,null))['then'](removeEntity(_0x1cfb23,null))['catch'](handleError(_0x1cfb23,null));};exports['describe']=function(_0x471f2c,_0x4a8fd5){return db[_0xfaf0('0x3d')][_0xfaf0('0xbd')]()[_0xfaf0('0x33')](respondWithResult(_0x4a8fd5,null))[_0xfaf0('0x34')](handleError(_0x4a8fd5,null));};exports[_0xfaf0('0xbe')]=function(_0x5f3b63,_0x59fa54,_0x42bd69){return db[_0xfaf0('0xbf')]['find']({'where':{'id':_0x5f3b63[_0xfaf0('0xb8')]['id']}})['then'](handleEntityNotFound(_0x59fa54,null))[_0xfaf0('0x33')](function(_0x167002){if(_0x167002){return _0x167002[_0xfaf0('0xbe')](_0x5f3b63['body'][_0xfaf0('0xc0')],_[_0xfaf0('0xc1')](_0x5f3b63[_0xfaf0('0x7b')],[_0xfaf0('0xc0'),'id'])||{});}})[_0xfaf0('0x33')](respondWithResult(_0x59fa54,null))['catch'](handleError(_0x59fa54,null));};exports[_0xfaf0('0xc2')]=function(_0x3018aa,_0x5aa19f,_0x1280e7){var _0x1d3338={'raw':![],'where':{}};var _0x32b2f1={};var _0x3d5c1a={'count':0x0,'rows':[]};return db[_0xfaf0('0x3d')][_0xfaf0('0xc3')]({'where':{'id':_0x3018aa[_0xfaf0('0xb8')]['id']}})[_0xfaf0('0x33')](handleEntityNotFound(_0x5aa19f,null))['then'](function(_0xa64f6d){if(_0xa64f6d){_0x32b2f1['model']=_[_0xfaf0('0x43')](db['FaxMessage']['rawAttributes']);_0x32b2f1[_0xfaf0('0x44')]=_[_0xfaf0('0x43')](_0x3018aa['query']);_0x32b2f1[_0xfaf0('0x4d')]=_['intersection'](_0x32b2f1[_0xfaf0('0x42')],_0x32b2f1['query']);_0x1d3338[_0xfaf0('0x45')]=_[_0xfaf0('0x46')](_0x32b2f1[_0xfaf0('0x42')],qs[_0xfaf0('0x47')](_0x3018aa[_0xfaf0('0x44')][_0xfaf0('0x47')]));_0x1d3338['attributes']=_0x1d3338[_0xfaf0('0x45')]['length']?_0x1d3338[_0xfaf0('0x45')]:_0x32b2f1[_0xfaf0('0x42')];if(!_0x3018aa[_0xfaf0('0x44')][_0xfaf0('0x48')](_0xfaf0('0x49'))){_0x1d3338[_0xfaf0('0x23')]=qs['limit'](_0x3018aa[_0xfaf0('0x44')][_0xfaf0('0x23')]);_0x1d3338[_0xfaf0('0x24')]=qs['offset'](_0x3018aa[_0xfaf0('0x44')][_0xfaf0('0x24')]);}_0x1d3338['order']=qs[_0xfaf0('0x4b')](_0x3018aa['query'][_0xfaf0('0x4b')]);_0x1d3338['where']=qs[_0xfaf0('0x4d')](_[_0xfaf0('0x4e')](_0x3018aa[_0xfaf0('0x44')],_0x32b2f1[_0xfaf0('0x4d')]));_0x1d3338[_0xfaf0('0x4c')][_0xfaf0('0xb6')]=_0xa64f6d['id'];if(_0x3018aa['query'][_0xfaf0('0x8a')]){_0x1d3338['where']=_[_0xfaf0('0x9f')](_0x1d3338[_0xfaf0('0x4c')],{'$or':_[_0xfaf0('0x2d')](_0x1d3338[_0xfaf0('0x45')],function(_0x461154){var _0x250e33={};_0x250e33[_0x461154]={'$like':'%'+_0x3018aa['query'][_0xfaf0('0x8a')]+'%'};return _0x250e33;})});}if(_0x3018aa['query'][_0xfaf0('0xc4')]){var _0x472b11=_0x3018aa[_0xfaf0('0x44')]['$gte'][_0xfaf0('0x70')](',');var _0x12a280={};_0x12a280[_0x472b11[0x0]]={'$gte':moment(_0x472b11[0x1])[_0xfaf0('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d3338['where']=_[_0xfaf0('0x9f')](_0x1d3338['where'],_0x12a280);}_0x1d3338=_[_0xfaf0('0x9f')]({},_0x1d3338,_0x3018aa[_0xfaf0('0xba')]);return db[_0xfaf0('0xbf')]['count']({'where':_0x1d3338['where']})[_0xfaf0('0x33')](function(_0x15c8e1){_0x3d5c1a[_0xfaf0('0x25')]=_0x15c8e1;if(_0x3018aa[_0xfaf0('0x44')][_0xfaf0('0xb9')]){_0x1d3338[_0xfaf0('0xc6')]=[{'all':!![]}];}return db[_0xfaf0('0xbf')][_0xfaf0('0xc7')](_0x1d3338);})[_0xfaf0('0x33')](function(_0x38c153){_0x3d5c1a[_0xfaf0('0xc8')]=_0x38c153;return _0x3d5c1a;});}})[_0xfaf0('0x33')](respondWithFilteredResult(_0x5aa19f,_0x1d3338))['catch'](handleError(_0x5aa19f,null));};exports['addTags']=function(_0x5491c2,_0x1d5933,_0x294151){return db[_0xfaf0('0x3d')]['find']({'where':{'id':_0x5491c2[_0xfaf0('0xb8')]['id']}})['then'](handleEntityNotFound(_0x1d5933,null))[_0xfaf0('0x33')](function(_0x471e2a){if(_0x471e2a){return _0x471e2a[_0xfaf0('0xc9')](_0x5491c2[_0xfaf0('0x7b')][_0xfaf0('0xc0')],_[_0xfaf0('0xc1')](_0x5491c2[_0xfaf0('0x7b')],[_0xfaf0('0xc0'),'id'])||{})[_0xfaf0('0xca')](function(){return db[_0xfaf0('0x76')]['findAll']({'attributes':['id',_0xfaf0('0x2b'),_0xfaf0('0x51')],'where':{'id':_0x5491c2['body']['ids']}});})[_0xfaf0('0x33')](function(_0x4ad2cf){socket[_0xfaf0('0xcb')](_0xfaf0('0xcc'),{'id':Number(_0x5491c2[_0xfaf0('0xb8')]['id']),'tags':_0x4ad2cf||[]});return{'id':Number(_0x5491c2[_0xfaf0('0xb8')]['id']),'tags':_0x4ad2cf||[]};});}})[_0xfaf0('0x33')](respondWithResult(_0x1d5933,null))[_0xfaf0('0x34')](handleError(_0x1d5933,null));};exports[_0xfaf0('0xcd')]=function(_0x36329c,_0x354e6b,_0x276e9f){return db[_0xfaf0('0x3d')][_0xfaf0('0x68')]({'where':{'id':_0x36329c[_0xfaf0('0xb8')]['id']}})[_0xfaf0('0x33')](handleEntityNotFound(_0x354e6b,null))[_0xfaf0('0x33')](function(_0x4e2d31){if(_0x4e2d31){return _0x4e2d31['removeTags'](_0x36329c[_0xfaf0('0x44')][_0xfaf0('0xc0')]);}})[_0xfaf0('0x33')](respondWithStatusCode(_0x354e6b,null))['catch'](handleError(_0x354e6b,null));};exports[_0xfaf0('0xce')]=function(_0x15e9d5,_0x1046fb){var _0x29bfc9=moment()[_0xfaf0('0xcf')]()[_0xfaf0('0x9d')]();var _0x13406e=path['join'](config[_0xfaf0('0xd0')],_0xfaf0('0xd1'),_0xfaf0('0xd2'),'tmp');var _0xb44d1b=path[_0xfaf0('0xd3')](config[_0xfaf0('0xd0')],_0xfaf0('0xd1'),_0xfaf0('0xd2'),_0xfaf0('0xd4'));var _0x2aecad=path[_0xfaf0('0xd3')](_0x13406e,_0x29bfc9);var _0x1753dc=util[_0xfaf0('0xc5')](_0xfaf0('0xd5'),_0x15e9d5['params']['id'],_0x29bfc9);var _0x57534e=path[_0xfaf0('0xd3')](_0x13406e,_0x1753dc);var _0x50047b=[];_0x50047b[_0xfaf0('0x32')]({'model':db[_0xfaf0('0xd6')],'as':_0xfaf0('0xd6'),'raw':!![]});var _0x7db180=[{'model':db['FaxMessage'],'as':_0xfaf0('0xd7'),'attributes':['id',_0xfaf0('0x7b'),_0xfaf0('0xd8')],'include':_0x50047b}];return db[_0xfaf0('0x3d')][_0xfaf0('0x68')]({'where':{'id':_0x15e9d5[_0xfaf0('0xb8')]['id']},'include':_0x7db180})[_0xfaf0('0x33')](handleEntityNotFound(_0x1046fb,null))[_0xfaf0('0x33')](function(_0x46e7fb){if(_0x46e7fb&&_0x46e7fb[_0xfaf0('0xd7')]){var _0x36cc76=_0x46e7fb[_0xfaf0('0xd9')]({'plain':!![]});fs[_0xfaf0('0xda')](_0x2aecad);for(var _0x6d759e=0x0;_0x6d759e<_0x36cc76[_0xfaf0('0xd7')][_0xfaf0('0x67')];_0x6d759e++){var _0xac8227=_0x36cc76[_0xfaf0('0xd7')][_0x6d759e][_0xfaf0('0xd6')];if(_0xac8227){var _0x1e3b35=path[_0xfaf0('0xd3')](_0xb44d1b,_0xac8227['basename']);if(fs['existsSync'](_0x1e3b35)){fs[_0xfaf0('0xdb')](_0x1e3b35)[_0xfaf0('0xdc')](fs[_0xfaf0('0xdd')](path[_0xfaf0('0xd3')](_0x2aecad,_0xac8227[_0xfaf0('0xde')])));}}}return BPromise[_0xfaf0('0x95')]()[_0xfaf0('0x33')](function(){return new BPromise(function(_0x227f02,_0x2728be){zipdir(_0x2aecad,{'saveTo':_0x57534e},function(_0x40dc72,_0x524ace){if(_0x40dc72)return _0x2728be(_0x40dc72);return _0x227f02(_0x524ace);});})[_0xfaf0('0x33')](function(){return new BPromise(function(_0x5950ef,_0x5f585e){rimraf(_0x2aecad,function(_0x5bdb10){if(_0x5bdb10)_0x5f585e(_0x5bdb10);return _0x5950ef();});});})['then'](function(){return _0x1046fb[_0xfaf0('0xce')](_0x57534e,_0x1753dc,function(_0x10fbf2){if(_0x10fbf2){console[_0xfaf0('0xdf')](_0xfaf0('0xe0'),_0x10fbf2);}else{fs[_0xfaf0('0xe1')](_0x57534e);}});});});}else{return _0x1046fb[_0xfaf0('0x1e')](0xc8);}})[_0xfaf0('0x34')](handleError(_0x1046fb,null));}; \ No newline at end of file +var _0x07cc=['catch','waiting','talking','answered','total','UserId','closed','index','FaxInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','select','field','color','tools_tags','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','body','text','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','i.id','order','contactName','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','addTags','spread','findAll','emit','faxInteractionTags:save','download','unix','server','files','join','root','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','createWriteStream','basename','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push'];(function(_0x3c7501,_0x47e75c){var _0x2a7c96=function(_0x579b66){while(--_0x579b66){_0x3c7501['push'](_0x3c7501['shift']());}};_0x2a7c96(++_0x47e75c);}(_0x07cc,0x181));var _0xc07c=function(_0x22f65e,_0x54a29f){_0x22f65e=_0x22f65e-0x0;var _0x542eaf=_0x07cc[_0x22f65e];return _0x542eaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc07c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc07c('0x1'));var rp=require(_0xc07c('0x2'));var moment=require(_0xc07c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc07c('0x4'));var util=require(_0xc07c('0x5'));var path=require(_0xc07c('0x6'));var sox=require(_0xc07c('0x7'));var csv=require(_0xc07c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc07c('0x9'));var squel=require(_0xc07c('0xa'));var crypto=require(_0xc07c('0xb'));var jsforce=require(_0xc07c('0xc'));var deskjs=require(_0xc07c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc07c('0xe'));var Papa=require('papaparse');var Redis=require(_0xc07c('0xf'));var authService=require(_0xc07c('0x10'));var qs=require(_0xc07c('0x11'));var as=require(_0xc07c('0x12'));var hardwareService=require(_0xc07c('0x13'));var logger=require(_0xc07c('0x14'))(_0xc07c('0x15'));var utils=require(_0xc07c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc07c('0x17'));var db=require(_0xc07c('0x18'))['db'];config[_0xc07c('0x19')]=_[_0xc07c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc07c('0x1b'))(new Redis(config[_0xc07c('0x19')]));require('./faxInteraction.socket')[_0xc07c('0x1c')](socket);function respondWithStatusCode(_0x580f11,_0x19f8ec){_0x19f8ec=_0x19f8ec||0xcc;return function(_0x1dbe36){if(_0x1dbe36){return _0x580f11[_0xc07c('0x1d')](_0x19f8ec);}return _0x580f11[_0xc07c('0x1e')](_0x19f8ec)[_0xc07c('0x1f')]();};}function respondWithResult(_0x568eab,_0xce203f){_0xce203f=_0xce203f||0xc8;return function(_0x1c020d){if(_0x1c020d){return _0x568eab[_0xc07c('0x1e')](_0xce203f)[_0xc07c('0x20')](_0x1c020d);}};}function respondWithFilteredResult(_0x5b6cc6,_0x3aab81){return function(_0x1bb056){if(_0x1bb056){var _0x3f81bd=typeof _0x3aab81[_0xc07c('0x21')]===_0xc07c('0x22')&&typeof _0x3aab81[_0xc07c('0x23')]===_0xc07c('0x22');var _0x4357c4=_0x1bb056['count'];var _0x16fbe9=_0x3f81bd?0x0:_0x3aab81[_0xc07c('0x21')];var _0x1fc080=_0x3f81bd?_0x1bb056[_0xc07c('0x24')]:_0x3aab81[_0xc07c('0x21')]+_0x3aab81[_0xc07c('0x23')];var _0x95d842;if(_0x1fc080>=_0x4357c4){_0x1fc080=_0x4357c4;_0x95d842=0xc8;}else{_0x95d842=0xce;}_0x5b6cc6['status'](_0x95d842);return _0x5b6cc6[_0xc07c('0x25')]('Content-Range',_0x16fbe9+'-'+_0x1fc080+'/'+_0x4357c4)[_0xc07c('0x20')](_0x1bb056);}return null;};}function patchUpdates(_0x5ce3f4){return function(_0x16ee9e){try{jsonpatch[_0xc07c('0x26')](_0x16ee9e,_0x5ce3f4,!![]);}catch(_0x37fe93){return BPromise[_0xc07c('0x27')](_0x37fe93);}return _0x16ee9e['save']();};}function saveUpdates(_0x3d0a5e,_0x32dc88){return function(_0x2885a6){if(_0x2885a6){return _0x2885a6[_0xc07c('0x28')](_0x3d0a5e)[_0xc07c('0x29')](function(_0x472ddd){return _0x472ddd;});}return null;};}function removeEntity(_0x2d519f,_0x24a054){return function(_0x249dd4){if(_0x249dd4){return _0x249dd4['destroy']()[_0xc07c('0x29')](function(){_0x2d519f['status'](0xcc)[_0xc07c('0x1f')]();});}};}function handleEntityNotFound(_0x40d868,_0x4aae49){return function(_0x4b3367){if(!_0x4b3367){_0x40d868[_0xc07c('0x1d')](0x194);}return _0x4b3367;};}function handleError(_0x45c8fe,_0x1ebb0b){_0x1ebb0b=_0x1ebb0b||0x1f4;return function(_0x38c0e8){logger['error'](_0x38c0e8[_0xc07c('0x2a')]);if(_0x38c0e8[_0xc07c('0x2b')]){delete _0x38c0e8[_0xc07c('0x2b')];}_0x45c8fe['status'](_0x1ebb0b)[_0xc07c('0x2c')](_0x38c0e8);};}function getInteractionUsers(_0x43449f,_0xa954e2){return new BPromise(function(_0x33ba5e,_0x2b6efb){try{if(_0xa954e2[_0x43449f['id']]){_0x43449f[_0xc07c('0x2d')]=_[_0xc07c('0x2e')](_0xa954e2[_0x43449f['id']],function(_0x220608){return{'id':_0x220608['id'],'fullname':_0x220608[_0xc07c('0x2f')]};});}}catch(_0x3f7ace){_0x2b6efb(_0x3f7ace);}_0x33ba5e(_0x43449f);});}function getInteractionTags(_0x38d4b8,_0x396a91){return new BPromise(function(_0x16e105,_0x5b6041){try{if(_0x38d4b8['TagIds']){_0x38d4b8[_0xc07c('0x30')]=[];_0x38d4b8[_0xc07c('0x31')][_0xc07c('0x32')](',')[_0xc07c('0x33')](function(_0x481e80){_0x38d4b8['Tags'][_0xc07c('0x34')](_0x396a91[_0x481e80]);});}delete _0x38d4b8[_0xc07c('0x31')];}catch(_0x35e56c){_0x5b6041(_0x35e56c);}_0x16e105(_0x38d4b8);});}function updateFaxInteraction(_0x473fb3,_0x5363b5,_0x35be8d){return new BPromise(function(_0x5bd5e7,_0x3d0fe9){return getInteractionUsers(_0x473fb3,_0x35be8d)[_0xc07c('0x29')](function(_0x49ee45){return getInteractionTags(_0x49ee45,_0x5363b5);})[_0xc07c('0x29')](function(_0x4b5635){return getStateInteraction(_0x4b5635);})[_0xc07c('0x29')](function(_0x455d37){_0x5bd5e7(_0x455d37);})[_0xc07c('0x35')](function(_0x48245c){_0x3d0fe9(_0x48245c);});});}function getStateInteraction(_0x42ef6a){return new BPromise(function(_0x475a05){_0x42ef6a[_0xc07c('0x36')]=0x0;_0x42ef6a[_0xc07c('0x37')]=0x0;_0x42ef6a[_0xc07c('0x38')]=0x0;_0x42ef6a['unmanaged']=0x0;_0x42ef6a[_0xc07c('0x39')]=0x0;if(!_0x42ef6a['closed']&&!_0x42ef6a[_0xc07c('0x3a')]){_0x42ef6a['waiting']+=0x1;}if(!_0x42ef6a['closed']&&_0x42ef6a[_0xc07c('0x3a')]){_0x42ef6a[_0xc07c('0x37')]+=0x1;if(_0x42ef6a['waiting']){_0x42ef6a['waiting']-=0x1;}}if(_0x42ef6a[_0xc07c('0x3b')]&&_0x42ef6a['UserId']){_0x42ef6a['answered']+=0x1;if(_0x42ef6a[_0xc07c('0x37')]){_0x42ef6a[_0xc07c('0x37')]-=0x1;}}if(_0x42ef6a[_0xc07c('0x3b')]&&!_0x42ef6a[_0xc07c('0x3a')]){_0x42ef6a['unmanaged']+=0x1;if(_0x42ef6a['waiting']){_0x42ef6a[_0xc07c('0x36')]-=0x1;}}_0x42ef6a['total']+=0x1;_0x475a05(_0x42ef6a);});}exports[_0xc07c('0x3c')]=function(_0x58f581,_0x447727){var _0x5708a3={},_0xe9e9af={},_0x2c905e={'count':0x0,'rows':[]};var _0xfc254f=_[_0xc07c('0x2e')](db[_0xc07c('0x3d')][_0xc07c('0x3e')],function(_0xb2bbe5){return{'name':_0xb2bbe5[_0xc07c('0x3f')],'type':_0xb2bbe5[_0xc07c('0x40')]['key']};});_0xe9e9af['model']=_[_0xc07c('0x2e')](_0xfc254f,_0xc07c('0x2b'));_0xe9e9af[_0xc07c('0x41')]=_[_0xc07c('0x42')](_0x58f581[_0xc07c('0x41')]);_0xe9e9af[_0xc07c('0x43')]=_[_0xc07c('0x44')](_0xe9e9af[_0xc07c('0x45')],_0xe9e9af[_0xc07c('0x41')]);_0x5708a3[_0xc07c('0x46')]=_[_0xc07c('0x44')](_0xe9e9af[_0xc07c('0x45')],qs[_0xc07c('0x47')](_0x58f581[_0xc07c('0x41')][_0xc07c('0x47')]));_0x5708a3['attributes']=_0x5708a3[_0xc07c('0x46')][_0xc07c('0x48')]?_0x5708a3[_0xc07c('0x46')]:_0xe9e9af[_0xc07c('0x45')];if(!_0x58f581[_0xc07c('0x41')][_0xc07c('0x49')]('nolimit')){_0x5708a3['limit']=qs[_0xc07c('0x23')](_0x58f581['query']['limit']);_0x5708a3[_0xc07c('0x21')]=qs[_0xc07c('0x21')](_0x58f581[_0xc07c('0x41')][_0xc07c('0x21')]);}_0x5708a3['order']=qs[_0xc07c('0x4a')](_0x58f581[_0xc07c('0x41')]['sort']);_0x5708a3[_0xc07c('0x4b')]=qs[_0xc07c('0x43')](_['pick'](_0x58f581[_0xc07c('0x41')],_0xe9e9af['filters']),_0xfc254f);var _0x134178=[];var _0x590ab1=squel[_0xc07c('0x4c')]()[_0xc07c('0x4d')]('id')[_0xc07c('0x4d')]('name')[_0xc07c('0x4d')](_0xc07c('0x4e'))['from'](_0xc07c('0x4f'));var _0xcadbce=squel[_0xc07c('0x4c')]()['field']('u.id')[_0xc07c('0x4d')](_0xc07c('0x50'))[_0xc07c('0x4d')](_0xc07c('0x51'))[_0xc07c('0x52')](_0xc07c('0x53'),'ui')['left_join'](_0xc07c('0x54'),'u',_0xc07c('0x55'));var _0x147ce3=squel[_0xc07c('0x4c')]()[_0xc07c('0x52')](_0xc07c('0x56'),'i')[_0xc07c('0x57')](_0xc07c('0x58'),'c',_0xc07c('0x59'))[_0xc07c('0x57')](_0xc07c('0x54'),'o',_0xc07c('0x5a'))['left_join']('fax_accounts','a',_0xc07c('0x5b'))['left_join'](_0xc07c('0x5c'),'me',_0xc07c('0x5d'))[_0xc07c('0x57')]('fax_interaction_has_tags','it',_0xc07c('0x5e'))[_0xc07c('0x57')](_0xc07c('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x33aec9=squel['expr']();var _0x51f992=[];var _0x318286=squel['expr']();var _0x7b6cdc;if(_0x58f581[_0xc07c('0x41')][_0xc07c('0x5f')]){_0x7b6cdc=as[_0xc07c('0x60')](_0x58f581[_0xc07c('0x41')][_0xc07c('0x5f')]);var _0x1a5831=_0x7b6cdc[_0xc07c('0x61')];for(var _0x941737=0x0;_0x941737<_0x7b6cdc[_0xc07c('0x62')][_0xc07c('0x48')];_0x941737++){var _0x1e1968=_0x7b6cdc[_0xc07c('0x62')][_0x941737];var _0x490b46='i';var _0x3a6f26=_[_0xc07c('0x63')](_0xfc254f,[_0xc07c('0x2b'),_0x1e1968[_0xc07c('0x4d')]]);if(!_0x3a6f26){switch(_0x1e1968[_0xc07c('0x4d')]){case _0xc07c('0x64'):if(_0x1e1968['value']==0x1){_0x147ce3['having']('`'+_0x1e1968[_0xc07c('0x4d')]+_0xc07c('0x65'));}else{_0x147ce3[_0xc07c('0x66')]('`'+_0x1e1968[_0xc07c('0x4d')]+_0xc07c('0x67'));}break;case _0xc07c('0x68'):if(_0x1e1968[_0xc07c('0x69')]===_0xc07c('0x6a')){if(_0x1e1968['value'][_0xc07c('0x32')]('\x20')['length']>0x1){_0x33aec9[_0x1a5831](_0xc07c('0x6b'),qs[_0xc07c('0x6c')](_0x1e1968[_0xc07c('0x6d')]),null);}else{var _0x3e8f06='%'+_0x1e1968[_0xc07c('0x6d')]+'%';_0x33aec9[_0x1a5831](_0xc07c('0x6e'),_0x3e8f06,_0x3e8f06,_0x3e8f06);}}else{_0x3a6f26=_[_0xc07c('0x63')](_0xfc254f,['name',_0xc07c('0x6f')]);_0x1e1968[_0xc07c('0x4d')]=_0xc07c('0x6f');_0x51d67f=as[_0xc07c('0x70')](_0x490b46,_0x3a6f26['type'],_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f['text'],_0x51d67f['value'][_0xc07c('0x71')],_0x51d67f['value'][_0xc07c('0x1f')]);}break;case _0xc07c('0x72'):var _0x2252ba=_0x1e1968[_0xc07c('0x6d')][_0xc07c('0x32')](',')['map'](function(_0x59ffbc){return Number(_0x59ffbc);});_0x2252ba['forEach'](function(_0x3c17a1){_0x318286['or'](_0xc07c('0x73'),'%,'+_0x3c17a1+',%');});_0x51f992=_[_0xc07c('0x74')](_0x51f992,_0x2252ba);break;case'User':if(_0x1e1968[_0xc07c('0x69')]===_0xc07c('0x6a')){_0x33aec9[_0x1a5831]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1e1968[_0xc07c('0x6d')]+'%',null);}else{_0x3a6f26=_[_0xc07c('0x63')](_0xfc254f,[_0xc07c('0x2b'),_0xc07c('0x3a')]);_0x1e1968['field']=_0xc07c('0x3a');_0x51d67f=as[_0xc07c('0x70')](_0x490b46,_0x3a6f26[_0xc07c('0x40')],_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f['text'],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x71')],_0x51d67f['value'][_0xc07c('0x1f')]);}break;case _0xc07c('0x75'):_0x51d67f=as[_0xc07c('0x70')]('me',null,_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f[_0xc07c('0x76')],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x71')],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x1f')]);break;}}else{var _0x51d67f=as[_0xc07c('0x70')](_0x490b46,_0x3a6f26[_0xc07c('0x40')],_0x1e1968);_0x33aec9[_0x1a5831](_0x51d67f[_0xc07c('0x76')],_0x51d67f['value'][_0xc07c('0x71')],_0x51d67f[_0xc07c('0x6d')][_0xc07c('0x1f')]);}}}else{var _0x1d4a95=_(_0x58f581[_0xc07c('0x41')])['keys']()[_0xc07c('0x2e')](function(_0x3edc60){return _[_0xc07c('0x77')](_0xfc254f,[_0xc07c('0x2b'),_0x3edc60])?_0x3edc60:undefined;})[_0xc07c('0x78')]()['value']();if(!_[_0xc07c('0x79')](_0x1d4a95)){_0x1d4a95[_0xc07c('0x33')](function(_0x1b55e8){if(_0x1b55e8===_0xc07c('0x7a')){_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x7b'),[][_0xc07c('0x7c')](_0x58f581[_0xc07c('0x41')][_0x1b55e8]));}else if(_0x1b55e8==='createdAt'){var _0x45451a=JSON[_0xc07c('0x7d')](_0x58f581[_0xc07c('0x41')][_0x1b55e8])['$gte'];var _0xf42424=JSON[_0xc07c('0x7d')](_0x58f581[_0xc07c('0x41')][_0x1b55e8])[_0xc07c('0x7e')];_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x7f'),_0x45451a,_0xf42424);}else{if(_0x58f581[_0xc07c('0x41')][_0x1b55e8]===_0xc07c('0x80')){_0x147ce3['where']('i.'+_0x1b55e8+_0xc07c('0x81'));}else{_0x147ce3[_0xc07c('0x4b')]('i.'+_0x1b55e8+_0xc07c('0x82'),_0x58f581[_0xc07c('0x41')][_0x1b55e8]);}}});}if(_0x58f581[_0xc07c('0x41')][_0xc07c('0x83')]){if(_0x58f581['query'][_0xc07c('0x83')]==0x1){_0x147ce3['having'](_0xc07c('0x84'));}else{_0x147ce3[_0xc07c('0x66')](_0xc07c('0x85'));}}if(_0x58f581[_0xc07c('0x41')][_0xc07c('0x86')]){_0x51f992=_['isArray'](_0x58f581['query'][_0xc07c('0x86')])?_0x58f581[_0xc07c('0x41')]['tag']:new Array(_0x58f581[_0xc07c('0x41')][_0xc07c('0x86')]);_0x51f992[_0xc07c('0x33')](function(_0x5bf8bc){_0x318286['or'](_0xc07c('0x73'),'%,'+_0x5bf8bc+',%');});}if(_0x58f581[_0xc07c('0x41')]['filter']){var _0x492d5e=_0x58f581['query']['filter'][_0xc07c('0x87')]('\x5c','\x5c\x5c')[_0xc07c('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x492d5e)){_0x33aec9['or']('i.id\x20LIKE\x20?',_0x492d5e+'%')['or'](_0xc07c('0x88'),_0x492d5e+'%');}_0x33aec9['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x492d5e+'%');}}_0x147ce3[_0xc07c('0x4b')](_0x33aec9);_0x147ce3[_0xc07c('0x89')]('i.id');var _0xca4221={'type':db[_0xc07c('0x8a')][_0xc07c('0x8b')]['SELECT'],'raw':!![]};var _0x33d86c=_0x147ce3['clone']();_0x33d86c['field'](_0xc07c('0x8c'));_0x33d86c[_0xc07c('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc07c('0x64'));if(_0x5708a3[_0xc07c('0x8d')]){_0x5708a3[_0xc07c('0x8d')][_0xc07c('0x33')](function(_0x46debc){var _0x3a97ec=_0x46debc[0x0]===_0xc07c('0x8e')?_0x46debc[0x0]:'i.'+_0x46debc[0x0];_0x147ce3[_0xc07c('0x8d')](_0x3a97ec,_0x46debc[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x51f992)){_0x147ce3['having'](_0x318286);_0x33d86c['where']('t.id\x20IN\x20?',_0x51f992);}BPromise[_0xc07c('0x8f')]()[_0xc07c('0x29')](function(){if(!_0x7b6cdc){if(_0x58f581['query'][_0xc07c('0x7a')])return;_0x33d86c[_0xc07c('0x4b')](_0xc07c('0x90'));_0x147ce3['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x58f581['user'][_0xc07c('0x91')]!==_0xc07c('0x92'))return;return _0x58f581[_0xc07c('0x93')][_0xc07c('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11e067){if(_['isEmpty'](_0x11e067)){_0x33d86c['where']('i.FaxAccountId\x20IS\x20NULL');_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x95'));}else{_0x33d86c[_0xc07c('0x4b')](_0xc07c('0x7b'),_[_0xc07c('0x2e')](_0x11e067,'id'));_0x147ce3[_0xc07c('0x4b')](_0xc07c('0x7b'),_['map'](_0x11e067,'id'));}});})[_0xc07c('0x29')](function(){if(_0x58f581[_0xc07c('0x93')][_0xc07c('0x91')]===_0xc07c('0x92')&&!_0x7b6cdc&&!_0x58f581['query'][_0xc07c('0x7a')])return[];return db[_0xc07c('0x96')][_0xc07c('0x41')](_0x33d86c[_0xc07c('0x97')](),_0xca4221);})[_0xc07c('0x29')](function(_0x41772a){_0x2c905e[_0xc07c('0x24')]=_0x41772a[_0xc07c('0x48')];if(_0x2c905e['count']===0x0)return[];return db[_0xc07c('0x96')][_0xc07c('0x41')](_0x590ab1[_0xc07c('0x97')](),_0xca4221)['then'](function(_0x5b8643){_0x134178=_[_0xc07c('0x98')](_0x5b8643,'id');_0xca4221=_[_0xc07c('0x99')](_0xca4221,{'model':db[_0xc07c('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58f581['query'][_0xc07c('0x47')]){_0x5708a3[_0xc07c('0x46')][_0xc07c('0x33')](function(_0x30b74f){_0x147ce3['field']('i.'+_0x30b74f);});}else{_0x147ce3[_0xc07c('0x4d')](_0xc07c('0x9a'),_0xc07c('0x64'));_0x147ce3['field'](_0xc07c('0x9b'),_0xc07c('0x9c'));_0x147ce3[_0xc07c('0x4d')]('a.mandatoryDisposition',_0xc07c('0x9d'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0x9e'),_0xc07c('0x8e'));_0x147ce3['field'](_0xc07c('0x9f'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa0'),_0xc07c('0xa1'));_0x147ce3[_0xc07c('0x4d')]('c.lastName',_0xc07c('0xa2'));_0x147ce3[_0xc07c('0x4d')]('c.email','Contact.email');_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa3'),_0xc07c('0xa4'));_0x147ce3[_0xc07c('0x4d')]('c.mobile','Contact.mobile');_0x147ce3['field'](_0xc07c('0xa5'),_0xc07c('0xa6'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa7'),_0xc07c('0xa8'));_0x147ce3[_0xc07c('0x4d')](_0xc07c('0xa9'),_0xc07c('0xaa'));_0x147ce3[_0xc07c('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc07c('0x31'));}if(_0x5708a3[_0xc07c('0x23')])_0x147ce3[_0xc07c('0x23')](_0x5708a3[_0xc07c('0x23')]);if(_0x5708a3[_0xc07c('0x21')])_0x147ce3['offset'](_0x5708a3[_0xc07c('0x21')]);return db['sequelize'][_0xc07c('0x41')](_0x147ce3[_0xc07c('0x97')](),_0xca4221);})[_0xc07c('0x29')](function(_0xdaa37a){if(_0xdaa37a[_0xc07c('0x48')]>0x0)_0xcadbce[_0xc07c('0x4b')](_0xc07c('0xab'),_[_0xc07c('0x2e')](_0xdaa37a,'id'));return db[_0xc07c('0x96')][_0xc07c('0x41')](_0xcadbce[_0xc07c('0x97')](),_0xca4221)[_0xc07c('0x29')](function(_0x3ef1f3){var _0x49c223=_[_0xc07c('0xac')](_0x3ef1f3,_0xc07c('0xad'));var _0x381be9=[];_0xdaa37a[_0xc07c('0x33')](function(_0x488db6){_0x381be9[_0xc07c('0x34')](updateFaxInteraction(_0x488db6,_0x134178,_0x49c223));});return BPromise[_0xc07c('0xae')](_0x381be9);});});})[_0xc07c('0x29')](function(_0x27588e){_0x2c905e['rows']=_0x27588e;return _0x2c905e;})[_0xc07c('0x29')](respondWithFilteredResult(_0x447727,_0x5708a3))[_0xc07c('0x35')](handleError(_0x447727,null));};exports[_0xc07c('0xaf')]=function(_0x154d64,_0x45d737){var _0x2ac46b={'raw':![],'where':{'id':_0x154d64[_0xc07c('0xb0')]['id']}},_0xdc0a62={};_0xdc0a62[_0xc07c('0x45')]=_[_0xc07c('0x42')](db[_0xc07c('0x3d')][_0xc07c('0x3e')]);_0xdc0a62[_0xc07c('0x41')]=_[_0xc07c('0x42')](_0x154d64[_0xc07c('0x41')]);_0xdc0a62[_0xc07c('0x43')]=_[_0xc07c('0x44')](_0xdc0a62[_0xc07c('0x45')],_0xdc0a62[_0xc07c('0x41')]);_0x2ac46b[_0xc07c('0x46')]=_[_0xc07c('0x44')](_0xdc0a62['model'],qs['fields'](_0x154d64[_0xc07c('0x41')][_0xc07c('0x47')]));_0x2ac46b['attributes']=_0x2ac46b[_0xc07c('0x46')][_0xc07c('0x48')]?_0x2ac46b[_0xc07c('0x46')]:_0xdc0a62[_0xc07c('0x45')];if(_0x154d64[_0xc07c('0x41')]['includeAll']){_0x2ac46b['include']=[{'all':!![]}];}_0x2ac46b=_[_0xc07c('0x99')]({},_0x2ac46b,_0x154d64[_0xc07c('0xb1')]);return db[_0xc07c('0x3d')][_0xc07c('0x63')](_0x2ac46b)[_0xc07c('0x29')](handleEntityNotFound(_0x45d737,null))['then'](respondWithResult(_0x45d737,null))['catch'](handleError(_0x45d737,null));};exports[_0xc07c('0xb2')]=function(_0x1bb6e5,_0x1a3585){return db[_0xc07c('0x3d')][_0xc07c('0xb2')](_0x1bb6e5[_0xc07c('0x75')],{})[_0xc07c('0x29')](respondWithResult(_0x1a3585,0xc9))[_0xc07c('0x35')](handleError(_0x1a3585,null));};exports[_0xc07c('0x28')]=function(_0x7d870b,_0xba1165){if(_0x7d870b['body']['id']){delete _0x7d870b[_0xc07c('0x75')]['id'];}return db[_0xc07c('0x3d')]['find']({'where':{'id':_0x7d870b[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0xba1165,null))[_0xc07c('0x29')](saveUpdates(_0x7d870b[_0xc07c('0x75')],null))['then'](respondWithResult(_0xba1165,null))[_0xc07c('0x35')](handleError(_0xba1165,null));};exports[_0xc07c('0xb3')]=function(_0x14d050,_0x51d161){return db['FaxInteraction']['find']({'where':{'id':_0x14d050['params']['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x51d161,null))[_0xc07c('0x29')](removeEntity(_0x51d161,null))[_0xc07c('0x35')](handleError(_0x51d161,null));};exports[_0xc07c('0xb4')]=function(_0x4c0b86,_0x30af3b){return db[_0xc07c('0x3d')]['describe']()[_0xc07c('0x29')](respondWithResult(_0x30af3b,null))['catch'](handleError(_0x30af3b,null));};exports[_0xc07c('0xb5')]=function(_0x3b908d,_0x53abbc,_0x45e7c4){return db[_0xc07c('0xb6')]['find']({'where':{'id':_0x3b908d['params']['id']}})['then'](handleEntityNotFound(_0x53abbc,null))[_0xc07c('0x29')](function(_0x4bbc21){if(_0x4bbc21){return _0x4bbc21['addMessage'](_0x3b908d[_0xc07c('0x75')][_0xc07c('0xb7')],_[_0xc07c('0xb8')](_0x3b908d[_0xc07c('0x75')],[_0xc07c('0xb7'),'id'])||{});}})[_0xc07c('0x29')](respondWithResult(_0x53abbc,null))[_0xc07c('0x35')](handleError(_0x53abbc,null));};exports[_0xc07c('0xb9')]=function(_0x347209,_0x26f5bc,_0x10bde0){var _0x35bcde={'raw':![],'where':{}};var _0x2b65a8={};var _0x58ac5e={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xc07c('0xba')]({'where':{'id':_0x347209[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x26f5bc,null))[_0xc07c('0x29')](function(_0x5700b5){if(_0x5700b5){_0x2b65a8[_0xc07c('0x45')]=_['keys'](db[_0xc07c('0xb6')][_0xc07c('0x3e')]);_0x2b65a8['query']=_[_0xc07c('0x42')](_0x347209['query']);_0x2b65a8[_0xc07c('0x43')]=_[_0xc07c('0x44')](_0x2b65a8[_0xc07c('0x45')],_0x2b65a8[_0xc07c('0x41')]);_0x35bcde[_0xc07c('0x46')]=_[_0xc07c('0x44')](_0x2b65a8['model'],qs[_0xc07c('0x47')](_0x347209[_0xc07c('0x41')]['fields']));_0x35bcde[_0xc07c('0x46')]=_0x35bcde[_0xc07c('0x46')][_0xc07c('0x48')]?_0x35bcde[_0xc07c('0x46')]:_0x2b65a8['model'];if(!_0x347209[_0xc07c('0x41')]['hasOwnProperty'](_0xc07c('0xbb'))){_0x35bcde[_0xc07c('0x23')]=qs[_0xc07c('0x23')](_0x347209[_0xc07c('0x41')][_0xc07c('0x23')]);_0x35bcde['offset']=qs[_0xc07c('0x21')](_0x347209['query']['offset']);}_0x35bcde['order']=qs[_0xc07c('0x4a')](_0x347209[_0xc07c('0x41')]['sort']);_0x35bcde[_0xc07c('0x4b')]=qs[_0xc07c('0x43')](_['pick'](_0x347209[_0xc07c('0x41')],_0x2b65a8[_0xc07c('0x43')]));_0x35bcde[_0xc07c('0x4b')]['FaxInteractionId']=_0x5700b5['id'];if(_0x347209[_0xc07c('0x41')][_0xc07c('0xbc')]){_0x35bcde[_0xc07c('0x4b')]=_[_0xc07c('0x99')](_0x35bcde['where'],{'$or':_[_0xc07c('0x2e')](_0x35bcde[_0xc07c('0x46')],function(_0x22a123){var _0xb7861d={};_0xb7861d[_0x22a123]={'$like':'%'+_0x347209[_0xc07c('0x41')][_0xc07c('0xbc')]+'%'};return _0xb7861d;})});}if(_0x347209['query'][_0xc07c('0xbd')]){var _0x4f0f17=_0x347209[_0xc07c('0x41')][_0xc07c('0xbd')][_0xc07c('0x32')](',');var _0x4d6333={};_0x4d6333[_0x4f0f17[0x0]]={'$gte':moment(_0x4f0f17[0x1])[_0xc07c('0xbe')](_0xc07c('0xbf'))};_0x35bcde[_0xc07c('0x4b')]=_[_0xc07c('0x99')](_0x35bcde[_0xc07c('0x4b')],_0x4d6333);}_0x35bcde=_[_0xc07c('0x99')]({},_0x35bcde,_0x347209[_0xc07c('0xb1')]);return db[_0xc07c('0xb6')]['count']({'where':_0x35bcde[_0xc07c('0x4b')]})['then'](function(_0x19f5e9){_0x58ac5e['count']=_0x19f5e9;if(_0x347209[_0xc07c('0x41')][_0xc07c('0xc0')]){_0x35bcde[_0xc07c('0xc1')]=[{'all':!![]}];}return db[_0xc07c('0xb6')]['findAll'](_0x35bcde);})[_0xc07c('0x29')](function(_0x23edf4){_0x58ac5e[_0xc07c('0xc2')]=_0x23edf4;return _0x58ac5e;});}})[_0xc07c('0x29')](respondWithFilteredResult(_0x26f5bc,_0x35bcde))[_0xc07c('0x35')](handleError(_0x26f5bc,null));};exports[_0xc07c('0xc3')]=function(_0x2e3525,_0x433e6b,_0x561308){return db['FaxInteraction'][_0xc07c('0x63')]({'where':{'id':_0x2e3525[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x433e6b,null))[_0xc07c('0x29')](function(_0x4d3bc2){if(_0x4d3bc2){return _0x4d3bc2['setTags'](_0x2e3525[_0xc07c('0x75')][_0xc07c('0xb7')],_[_0xc07c('0xb8')](_0x2e3525[_0xc07c('0x75')],[_0xc07c('0xb7'),'id'])||{})[_0xc07c('0xc4')](function(){return db[_0xc07c('0x72')][_0xc07c('0xc5')]({'attributes':['id',_0xc07c('0x2b'),_0xc07c('0x4e')],'where':{'id':_0x2e3525[_0xc07c('0x75')][_0xc07c('0xb7')]}});})[_0xc07c('0x29')](function(_0x51cd48){socket[_0xc07c('0xc6')](_0xc07c('0xc7'),{'id':Number(_0x2e3525[_0xc07c('0xb0')]['id']),'tags':_0x51cd48||[]});return{'id':Number(_0x2e3525[_0xc07c('0xb0')]['id']),'tags':_0x51cd48||[]};});}})[_0xc07c('0x29')](respondWithResult(_0x433e6b,null))[_0xc07c('0x35')](handleError(_0x433e6b,null));};exports['removeTags']=function(_0x419f90,_0x198193,_0x39a5d6){return db[_0xc07c('0x3d')][_0xc07c('0x63')]({'where':{'id':_0x419f90[_0xc07c('0xb0')]['id']}})[_0xc07c('0x29')](handleEntityNotFound(_0x198193,null))[_0xc07c('0x29')](function(_0x4cb960){if(_0x4cb960){return _0x4cb960['removeTags'](_0x419f90[_0xc07c('0x41')]['ids']);}})[_0xc07c('0x29')](respondWithStatusCode(_0x198193,null))[_0xc07c('0x35')](handleError(_0x198193,null));};exports[_0xc07c('0xc8')]=function(_0x377475,_0x4a1090){var _0x47f9ae=moment()[_0xc07c('0xc9')]()[_0xc07c('0x97')]();var _0x3cde92=path['join'](config['root'],_0xc07c('0xca'),_0xc07c('0xcb'),'tmp');var _0x3b9c7f=path[_0xc07c('0xcc')](config[_0xc07c('0xcd')],_0xc07c('0xca'),'files',_0xc07c('0xce'));var _0xbf42ec=path['join'](_0x3cde92,_0x47f9ae);var _0x136b3c=util[_0xc07c('0xbe')](_0xc07c('0xcf'),_0x377475['params']['id'],_0x47f9ae);var _0x31d560=path[_0xc07c('0xcc')](_0x3cde92,_0x136b3c);var _0x4e50a6=[];_0x4e50a6['push']({'model':db['Attachment'],'as':_0xc07c('0xd0'),'raw':!![]});var _0x3f44fc=[{'model':db[_0xc07c('0xb6')],'as':_0xc07c('0xd1'),'attributes':['id',_0xc07c('0x75'),_0xc07c('0xd2')],'include':_0x4e50a6}];return db[_0xc07c('0x3d')]['find']({'where':{'id':_0x377475['params']['id']},'include':_0x3f44fc})[_0xc07c('0x29')](handleEntityNotFound(_0x4a1090,null))[_0xc07c('0x29')](function(_0x125ecd){if(_0x125ecd&&_0x125ecd[_0xc07c('0xd1')]){var _0x213bb2=_0x125ecd['get']({'plain':!![]});fs[_0xc07c('0xd3')](_0xbf42ec);for(var _0x1d7e68=0x0;_0x1d7e68<_0x213bb2[_0xc07c('0xd1')][_0xc07c('0x48')];_0x1d7e68++){var _0x1a4047=_0x213bb2[_0xc07c('0xd1')][_0x1d7e68][_0xc07c('0xd0')];if(_0x1a4047){var _0x3f93e5=path[_0xc07c('0xcc')](_0x3b9c7f,_0x1a4047['basename']);if(fs[_0xc07c('0xd4')](_0x3f93e5)){fs[_0xc07c('0xd5')](_0x3f93e5)['pipe'](fs[_0xc07c('0xd6')](path[_0xc07c('0xcc')](_0xbf42ec,_0x1a4047[_0xc07c('0xd7')])));}}}return BPromise['resolve']()[_0xc07c('0x29')](function(){return new BPromise(function(_0x5b5e82,_0x4b960e){zipdir(_0xbf42ec,{'saveTo':_0x31d560},function(_0x32d782,_0xd0627d){if(_0x32d782)return _0x4b960e(_0x32d782);return _0x5b5e82(_0xd0627d);});})[_0xc07c('0x29')](function(){return new BPromise(function(_0x45a7ce,_0x23ba00){rimraf(_0xbf42ec,function(_0x17ca77){if(_0x17ca77)_0x23ba00(_0x17ca77);return _0x45a7ce();});});})[_0xc07c('0x29')](function(){return _0x4a1090['download'](_0x31d560,_0x136b3c,function(_0x4de08e){if(_0x4de08e){console[_0xc07c('0xd8')](_0xc07c('0xd9'),_0x4de08e);}else{fs[_0xc07c('0xda')](_0x31d560);}});});});}else{return _0x4a1090[_0xc07c('0x1d')](0xc8);}})[_0xc07c('0x35')](handleError(_0x4a1090,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 040d0ca..f207999 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 _0xaee2=['catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','setDataValue','map','then','unreadMessages','length','emit'];(function(_0x41c0ca,_0x4fe109){var _0x50249a=function(_0x3560a3){while(--_0x3560a3){_0x41c0ca['push'](_0x41c0ca['shift']());}};_0x50249a(++_0x4fe109);}(_0xaee2,0xc2));var _0x2aee=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0xaee2[_0x1aba25];return _0x47d997;};'use strict';var EventEmitter=require(_0x2aee('0x0'));var FaxInteraction=require(_0x2aee('0x1'))['db'][_0x2aee('0x2')];var FaxMessage=require(_0x2aee('0x1'))['db'][_0x2aee('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2aee('0x4')](0x0);var events={'afterCreate':_0x2aee('0x5'),'afterUpdate':_0x2aee('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4350e4){return function(_0x55f495,_0x5ce275,_0xc3ce83){_0x55f495[_0x2aee('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x407b9f){_0x55f495[_0x2aee('0x8')]('Users',_0x407b9f[_0x2aee('0x9')](function(_0x32e1c7){return{'id':_0x32e1c7['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x55f495['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2aee('0xa')](function(_0x16a91a){_0x55f495[_0x2aee('0x8')](_0x2aee('0xb'),_0x16a91a[_0x2aee('0xc')]);FaxInteractionEvents[_0x2aee('0xd')](_0x4350e4+':'+_0x55f495['id'],_0x55f495);FaxInteractionEvents[_0x2aee('0xd')](_0x4350e4,_0x55f495);_0xc3ce83(null);})[_0x2aee('0xe')](_0xc3ce83(null));};}for(var e in events){if(events[_0x2aee('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xdbf5=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','map'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xdbf5,0x194));var _0x5dbf=function(_0x2c1038,_0x15327c){_0x2c1038=_0x2c1038-0x0;var _0x50c3ed=_0xdbf5[_0x2c1038];return _0x50c3ed;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5dbf('0x0'))['db'][_0x5dbf('0x1')];var FaxMessage=require(_0x5dbf('0x0'))['db'][_0x5dbf('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5dbf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5dbf('0x4')};function emitEvent(_0x2c5b43){return function(_0x5b542e,_0x137365,_0xa8ee7d){_0x5b542e[_0x5dbf('0x5')]({'attributes':['id'],'raw':!![]})[_0x5dbf('0x6')](function(_0x5a18e2){_0x5b542e[_0x5dbf('0x7')](_0x5dbf('0x8'),_0x5a18e2[_0x5dbf('0x9')](function(_0x46aa01){return{'id':_0x46aa01['id']};}));return FaxMessage[_0x5dbf('0xa')]({'where':{'FaxInteractionId':_0x5b542e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5dbf('0x6')](function(_0x337038){_0x5b542e[_0x5dbf('0x7')](_0x5dbf('0xb'),_0x337038[_0x5dbf('0xc')]);FaxInteractionEvents['emit'](_0x2c5b43+':'+_0x5b542e['id'],_0x5b542e);FaxInteractionEvents[_0x5dbf('0xd')](_0x2c5b43,_0x5b542e);_0xa8ee7d(null);})[_0x5dbf('0xe')](_0xa8ee7d(null));};}for(var e in events){if(events[_0x5dbf('0xf')](e)){var event=events[e];FaxInteraction[_0x5dbf('0x10')](e,emitEvent(event));}}module[_0x5dbf('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 e9ecb9e..738b21d 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 _0x05ed=['path','rimraf','../../config/environment','exports','define','FaxInteraction','changed','closedAt','format','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x05ed,0x14b));var _0xd05e=function(_0x42c797,_0x16382b){_0x42c797=_0x42c797-0x0;var _0x320035=_0x05ed[_0x42c797];return _0x320035;};'use strict';var _=require(_0xd05e('0x0'));var util=require('util');var logger=require(_0xd05e('0x1'))(_0xd05e('0x2'));var moment=require('moment');var BPromise=require(_0xd05e('0x3'));var rp=require(_0xd05e('0x4'));var fs=require('fs');var path=require(_0xd05e('0x5'));var rimraf=require(_0xd05e('0x6'));var config=require(_0xd05e('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xd05e('0x8')]=function(_0x529344,_0x5a11d5){return _0x529344[_0xd05e('0x9')](_0xd05e('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b6ccc,_0x7bd4b2,_0x2a7fdc){if(_0x5b6ccc[_0xd05e('0xb')]('closed')){_0x5b6ccc[_0xd05e('0xc')]=moment()[_0xd05e('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2a7fdc(null,_0x5b6ccc);}}});}; \ No newline at end of file +var _0x84ef=['FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x84ef,0x1d5));var _0xf84e=function(_0x3bc4cd,_0x6b254c){_0x3bc4cd=_0x3bc4cd-0x0;var _0x4aa969=_0x84ef[_0x3bc4cd];return _0x4aa969;};'use strict';var _=require('lodash');var util=require(_0xf84e('0x0'));var logger=require(_0xf84e('0x1'))(_0xf84e('0x2'));var moment=require(_0xf84e('0x3'));var BPromise=require(_0xf84e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf84e('0x5'));var rimraf=require(_0xf84e('0x6'));var config=require(_0xf84e('0x7'));var attributes=require(_0xf84e('0x8'));module[_0xf84e('0x9')]=function(_0x55d760,_0x5d1425){return _0x55d760[_0xf84e('0xa')](_0xf84e('0xb'),attributes,{'tableName':_0xf84e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57819f,_0x21bd01,_0x270b02){if(_0x57819f['changed'](_0xf84e('0xd'))){_0x57819f[_0xf84e('0xe')]=moment()['format'](_0xf84e('0xf'));}_0x270b02(null,_0x57819f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1647438..7a773fe 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 _0xa47b=['error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','debug','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa47b,0x197));var _0xba47=function(_0x492e99,_0x23f189){_0x492e99=_0x492e99-0x0;var _0x43b127=_0xa47b[_0x492e99];return _0x43b127;};'use strict';var _=require(_0xba47('0x0'));var util=require(_0xba47('0x1'));var moment=require(_0xba47('0x2'));var BPromise=require(_0xba47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba47('0x4'));var db=require(_0xba47('0x5'))['db'];var utils=require(_0xba47('0x6'));var logger=require('../../config/logger')(_0xba47('0x7'));var config=require(_0xba47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba47('0x9')][_0xba47('0xa')]({'port':0x232a});config[_0xba47('0xb')]=_[_0xba47('0xc')](config[_0xba47('0xb')],{'host':_0xba47('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba47('0xb')]));require(_0xba47('0xe'))[_0xba47('0xf')](socket);function respondWithRpcPromise(_0x592239,_0x25b1ed,_0x4a26ff){return new BPromise(function(_0x93b641,_0xbff217){return client[_0xba47('0x10')](_0x592239,_0x4a26ff)[_0xba47('0x11')](function(_0x24dfb9){logger[_0xba47('0x12')](_0xba47('0x13'),_0x25b1ed,_0xba47('0x14'));logger['debug'](_0xba47('0x15'),_0x25b1ed,_0xba47('0x14'),JSON[_0xba47('0x16')](_0x24dfb9));if(_0x24dfb9[_0xba47('0x17')]){if(_0x24dfb9['error'][_0xba47('0x18')]===0x1f4){logger[_0xba47('0x17')](_0xba47('0x13'),_0x25b1ed,_0x24dfb9['error'][_0xba47('0x19')]);return _0xbff217(_0x24dfb9[_0xba47('0x17')][_0xba47('0x19')]);}logger['error'](_0xba47('0x13'),_0x25b1ed,_0x24dfb9[_0xba47('0x17')][_0xba47('0x19')]);return _0x93b641(_0x24dfb9[_0xba47('0x17')]['message']);}else{logger[_0xba47('0x12')](_0xba47('0x13'),_0x25b1ed,_0xba47('0x14'));_0x93b641(_0x24dfb9[_0xba47('0x1a')][_0xba47('0x19')]);}})[_0xba47('0x1b')](function(_0x4cd3f5){logger[_0xba47('0x17')](_0xba47('0x13'),_0x25b1ed,_0x4cd3f5);_0xbff217(_0x4cd3f5);});});}exports[_0xba47('0x1c')]=function(_0x1d4cd9){var _0x3637ba=this;return new Promise(function(_0x4cbbdd,_0x7d3234){return db[_0xba47('0x1d')][_0xba47('0x1e')](_0x1d4cd9['body'],{'raw':_0x1d4cd9[_0xba47('0x1f')]?_0x1d4cd9[_0xba47('0x1f')][_0xba47('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d4cd9[_0xba47('0x1f')]?_0x1d4cd9[_0xba47('0x1f')][_0xba47('0x21')]||null:null,'attributes':_0x1d4cd9[_0xba47('0x1f')]?_0x1d4cd9[_0xba47('0x1f')][_0xba47('0x22')]||null:null,'limit':_0x1d4cd9[_0xba47('0x1f')]?_0x1d4cd9[_0xba47('0x1f')][_0xba47('0x23')]||null:null})[_0xba47('0x11')](function(_0x1fbdd8){logger[_0xba47('0x12')](_0xba47('0x1c'),_0x1d4cd9);logger[_0xba47('0x24')](_0xba47('0x1c'),_0x1d4cd9,JSON['stringify'](_0x1fbdd8));_0x4cbbdd(_0x1fbdd8);})[_0xba47('0x1b')](function(_0x580c7b){logger['error'](_0xba47('0x1c'),_0x580c7b['message'],_0x1d4cd9);_0x7d3234(_0x3637ba[_0xba47('0x17')](0x1f4,_0x580c7b[_0xba47('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0xd8fa07){return new Promise(function(_0xc3348d,_0x280f34){return db[_0xba47('0x1d')][_0xba47('0x25')]({'where':_0xd8fa07[_0xba47('0x1f')]?_0xd8fa07['options'][_0xba47('0x21')]||null:null})[_0xba47('0x11')](function(_0x1aaaf8){if(_0x1aaaf8){return _0x1aaaf8[_0xba47('0x26')](_0xd8fa07[_0xba47('0x27')][_0xba47('0x28')],_[_0xba47('0x29')](_0xd8fa07['body'],[_0xba47('0x28'),'id'])||{});}})['spread'](function(_0x33951c){logger['info']('AddTags',_0xd8fa07);logger['debug'](_0xba47('0x2a'),_0xd8fa07,JSON[_0xba47('0x16')](_0x33951c));_0xc3348d(_0x33951c);})[_0xba47('0x1b')](function(_0x237fe1){logger['error']('AddTags',_0x237fe1[_0xba47('0x19')],_0xd8fa07);_0x280f34(_this[_0xba47('0x17')](0x1f4,_0x237fe1[_0xba47('0x19')]));});});}; \ No newline at end of file +var _0x106e=['message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','AddTagsToFaxInteraction','then','addTags','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x106e,0x1bd));var _0xe106=function(_0x32aaf4,_0x4af273){_0x32aaf4=_0x32aaf4-0x0;var _0x244de5=_0x106e[_0x32aaf4];return _0x244de5;};'use strict';var _=require(_0xe106('0x0'));var util=require(_0xe106('0x1'));var moment=require('moment');var BPromise=require(_0xe106('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe106('0x3'));var db=require(_0xe106('0x4'))['db'];var utils=require(_0xe106('0x5'));var logger=require('../../config/logger')(_0xe106('0x6'));var config=require(_0xe106('0x7'));var jayson=require(_0xe106('0x8'));var client=jayson[_0xe106('0x9')][_0xe106('0xa')]({'port':0x232a});config['redis']=_[_0xe106('0xb')](config[_0xe106('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe106('0xd'))(new Redis(config[_0xe106('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x494082,_0x9b1e63,_0x518e93){return new BPromise(function(_0x2dd774,_0x5963cf){return client[_0xe106('0xe')](_0x494082,_0x518e93)['then'](function(_0x5252de){logger[_0xe106('0xf')](_0xe106('0x10'),_0x9b1e63,_0xe106('0x11'));logger[_0xe106('0x12')](_0xe106('0x13'),_0x9b1e63,_0xe106('0x11'),JSON[_0xe106('0x14')](_0x5252de));if(_0x5252de[_0xe106('0x15')]){if(_0x5252de[_0xe106('0x15')][_0xe106('0x16')]===0x1f4){logger[_0xe106('0x15')](_0xe106('0x10'),_0x9b1e63,_0x5252de[_0xe106('0x15')][_0xe106('0x17')]);return _0x5963cf(_0x5252de[_0xe106('0x15')][_0xe106('0x17')]);}logger[_0xe106('0x15')](_0xe106('0x10'),_0x9b1e63,_0x5252de['error'][_0xe106('0x17')]);return _0x2dd774(_0x5252de[_0xe106('0x15')][_0xe106('0x17')]);}else{logger[_0xe106('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x9b1e63,'request\x20sent');_0x2dd774(_0x5252de[_0xe106('0x18')][_0xe106('0x17')]);}})[_0xe106('0x19')](function(_0x58c51e){logger['error'](_0xe106('0x10'),_0x9b1e63,_0x58c51e);_0x5963cf(_0x58c51e);});});}exports[_0xe106('0x1a')]=function(_0x5c280b){var _0x3ab72d=this;return new Promise(function(_0x2f8da6,_0x38e1ea){return db[_0xe106('0x1b')][_0xe106('0x1c')](_0x5c280b[_0xe106('0x1d')],{'raw':_0x5c280b['options']?_0x5c280b[_0xe106('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c280b[_0xe106('0x1e')]?_0x5c280b[_0xe106('0x1e')][_0xe106('0x1f')]||null:null,'attributes':_0x5c280b[_0xe106('0x1e')]?_0x5c280b[_0xe106('0x1e')][_0xe106('0x20')]||null:null,'limit':_0x5c280b['options']?_0x5c280b[_0xe106('0x1e')][_0xe106('0x21')]||null:null})['then'](function(_0x528ec6){logger[_0xe106('0xf')](_0xe106('0x1a'),_0x5c280b);logger[_0xe106('0x12')](_0xe106('0x1a'),_0x5c280b,JSON[_0xe106('0x14')](_0x528ec6));_0x2f8da6(_0x528ec6);})[_0xe106('0x19')](function(_0x732b38){logger['error'](_0xe106('0x1a'),_0x732b38[_0xe106('0x17')],_0x5c280b);_0x38e1ea(_0x3ab72d[_0xe106('0x15')](0x1f4,_0x732b38[_0xe106('0x17')]));});});};exports[_0xe106('0x22')]=function(_0x4acd6f){return new Promise(function(_0x45824b,_0x543435){return db[_0xe106('0x1b')]['find']({'where':_0x4acd6f[_0xe106('0x1e')]?_0x4acd6f[_0xe106('0x1e')][_0xe106('0x1f')]||null:null})[_0xe106('0x23')](function(_0x3d9a9d){if(_0x3d9a9d){return _0x3d9a9d[_0xe106('0x24')](_0x4acd6f[_0xe106('0x1d')]['ids'],_['omit'](_0x4acd6f[_0xe106('0x1d')],[_0xe106('0x25'),'id'])||{});}})['spread'](function(_0x19075a){logger[_0xe106('0xf')](_0xe106('0x26'),_0x4acd6f);logger[_0xe106('0x12')]('AddTags',_0x4acd6f,JSON['stringify'](_0x19075a));_0x45824b(_0x19075a);})[_0xe106('0x19')](function(_0x2bd368){logger[_0xe106('0x15')](_0xe106('0x26'),_0x2bd368[_0xe106('0x17')],_0x4acd6f);_0x543435(_this[_0xe106('0x15')](0x1f4,_0x2bd368[_0xe106('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ec13fd1..f7844fe 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 _0x9adc=['register','length','save','remove','update'];(function(_0x3c3e8e,_0x3a9f14){var _0x224ee1=function(_0x4c8792){while(--_0x4c8792){_0x3c3e8e['push'](_0x3c3e8e['shift']());}};_0x224ee1(++_0x3a9f14);}(_0x9adc,0x179));var _0xc9ad=function(_0x48ce90,_0x2992a6){_0x48ce90=_0x48ce90-0x0;var _0x35bd38=_0x9adc[_0x48ce90];return _0x35bd38;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xc9ad('0x0'),_0xc9ad('0x1'),_0xc9ad('0x2')];function createListener(_0x354981,_0x4af75a){return function(_0x5da0ff){_0x4af75a['emit'](_0x354981,_0x5da0ff);};}function removeListener(_0x2787d4,_0x4a8e93){return function(){FaxInteractionEvents['removeListener'](_0x2787d4,_0x4a8e93);};}exports[_0xc9ad('0x3')]=function(_0xafa817){for(var _0x2a5fa4=0x0,_0x1601f7=events[_0xc9ad('0x4')];_0x2a5fa4<_0x1601f7;_0x2a5fa4++){var _0x2430c5=events[_0x2a5fa4];var _0x36ba54=createListener('faxInteraction:'+_0x2430c5,_0xafa817);FaxInteractionEvents['on'](_0x2430c5,_0x36ba54);}}; \ No newline at end of file +var _0x4f5f=['emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x9ea4c6,_0x1df2d3){var _0x290c87=function(_0x550208){while(--_0x550208){_0x9ea4c6['push'](_0x9ea4c6['shift']());}};_0x290c87(++_0x1df2d3);}(_0x4f5f,0xfc));var _0xf4f5=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x4f5f[_0x5311a1];return _0x2acb9f;};'use strict';var FaxInteractionEvents=require(_0xf4f5('0x0'));var events=[_0xf4f5('0x1'),_0xf4f5('0x2'),_0xf4f5('0x3')];function createListener(_0x4bacea,_0x2eb9e1){return function(_0x2dae3){_0x2eb9e1[_0xf4f5('0x4')](_0x4bacea,_0x2dae3);};}function removeListener(_0x7f6ab9,_0x18f862){return function(){FaxInteractionEvents[_0xf4f5('0x5')](_0x7f6ab9,_0x18f862);};}exports['register']=function(_0xf64e67){for(var _0x4bcc4e=0x0,_0x41129d=events[_0xf4f5('0x6')];_0x4bcc4e<_0x41129d;_0x4bcc4e++){var _0x2f098f=events[_0x4bcc4e];var _0xae3264=createListener(_0xf4f5('0x7')+_0x2f098f,_0xf64e67);FaxInteractionEvents['on'](_0x2f098f,_0xae3264);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 54fe504..2ef6a4b 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 _0x3040=['isAuthenticated','show','/:id/messages','getMessages','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id'];(function(_0x35651d,_0x44a564){var _0x872370=function(_0x371815){while(--_0x371815){_0x35651d['push'](_0x35651d['shift']());}};_0x872370(++_0x44a564);}(_0x3040,0x6f));var _0x0304=function(_0x516edc,_0x124705){_0x516edc=_0x516edc-0x0;var _0x644bd4=_0x3040[_0x516edc];return _0x644bd4;};'use strict';var multer=require('multer');var util=require(_0x0304('0x0'));var path=require(_0x0304('0x1'));var timeout=require('connect-timeout');var express=require(_0x0304('0x2'));var router=express[_0x0304('0x3')]();var fs_extra=require(_0x0304('0x4'));var auth=require(_0x0304('0x5'));var interaction=require(_0x0304('0x6'));var config=require(_0x0304('0x7'));var controller=require('./faxInteraction.controller');router[_0x0304('0x8')]('/',auth['isAuthenticated'](),controller[_0x0304('0x9')]);router['get'](_0x0304('0xa'),auth['isAuthenticated'](),controller[_0x0304('0xb')]);router[_0x0304('0x8')](_0x0304('0xc'),auth[_0x0304('0xd')](),controller[_0x0304('0xe')]);router[_0x0304('0x8')](_0x0304('0xf'),auth['isAuthenticated'](),controller[_0x0304('0x10')]);router[_0x0304('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0304('0xd')](),controller['create']);router[_0x0304('0x11')](_0x0304('0xf'),auth[_0x0304('0xd')](),controller[_0x0304('0x12')]);router[_0x0304('0x11')](_0x0304('0x13'),auth[_0x0304('0xd')](),interaction[_0x0304('0x14')](_0x0304('0x15'),_0x0304('0x16')),controller[_0x0304('0x17')]);router[_0x0304('0x18')](_0x0304('0xc'),auth[_0x0304('0xd')](),interaction[_0x0304('0x14')](_0x0304('0x15'),'faxinteraction:update'),controller[_0x0304('0x19')]);router[_0x0304('0x1a')]('/:id',auth[_0x0304('0xd')](),interaction[_0x0304('0x14')](_0x0304('0x15'),_0x0304('0x1b')),controller[_0x0304('0x1c')]);router['delete'](_0x0304('0x13'),auth[_0x0304('0xd')](),controller[_0x0304('0x1d')]);module[_0x0304('0x1e')]=router; \ No newline at end of file +var _0x53ec=['download','post','create','addMessage','fax','addTags','put','tracked','faxinteraction:update','delete','destroy','removeTags','exports','util','connect-timeout','express','fs-extra','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x524636,_0x12067c){var _0x3811c3=function(_0x559488){while(--_0x559488){_0x524636['push'](_0x524636['shift']());}};_0x3811c3(++_0x12067c);}(_0x53ec,0x179));var _0xc53e=function(_0x8ec6b4,_0x31ef52){_0x8ec6b4=_0x8ec6b4-0x0;var _0x52c0d0=_0x53ec[_0x8ec6b4];return _0x52c0d0;};'use strict';var multer=require('multer');var util=require(_0xc53e('0x0'));var path=require('path');var timeout=require(_0xc53e('0x1'));var express=require(_0xc53e('0x2'));var router=express['Router']();var fs_extra=require(_0xc53e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x4'));var controller=require(_0xc53e('0x5'));router[_0xc53e('0x6')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x7')]);router[_0xc53e('0x6')](_0xc53e('0x8'),auth[_0xc53e('0x9')](),controller['describe']);router[_0xc53e('0x6')](_0xc53e('0xa'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xb')]);router[_0xc53e('0x6')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xd')]);router[_0xc53e('0x6')](_0xc53e('0xe'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x11')]);router[_0xc53e('0x10')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0x10')]('/:id/tags',auth[_0xc53e('0x9')](),interaction['tracked'](_0xc53e('0x13'),'faxinteraction:addtags'),controller[_0xc53e('0x14')]);router[_0xc53e('0x15')](_0xc53e('0xa'),auth['isAuthenticated'](),interaction[_0xc53e('0x16')]('fax',_0xc53e('0x17')),controller['update']);router[_0xc53e('0x18')](_0xc53e('0xa'),auth[_0xc53e('0x9')](),interaction[_0xc53e('0x16')](_0xc53e('0x13'),'faxinteraction:destroy'),controller[_0xc53e('0x19')]);router['delete']('/:id/tags',auth[_0xc53e('0x9')](),controller[_0xc53e('0x1a')]);module[_0xc53e('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 5b5898d..bd49eb9 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 _0xcab6=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4d54dd,_0x58b2ca){var _0x4117a7=function(_0x464cd9){while(--_0x464cd9){_0x4d54dd['push'](_0x4d54dd['shift']());}};_0x4117a7(++_0x58b2ca);}(_0xcab6,0xd4));var _0x6cab=function(_0x163d7b,_0x1657a7){_0x163d7b=_0x163d7b-0x0;var _0x1b60b6=_0xcab6[_0x163d7b];return _0x1b60b6;};'use strict';var Sequelize=require(_0x6cab('0x0'));module['exports']={'body':{'type':Sequelize[_0x6cab('0x1')](_0x6cab('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6cab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6cab('0x4')]('in',_0x6cab('0x5')),'defaultValue':_0x6cab('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x6cab('0x6')]}}; \ No newline at end of file +var _0xcb99=['TEXT','ENUM','out','DATE','sequelize'];(function(_0x2f1467,_0xd189c6){var _0xf9c138=function(_0x5415e1){while(--_0x5415e1){_0x2f1467['push'](_0x2f1467['shift']());}};_0xf9c138(++_0xd189c6);}(_0xcb99,0x8b));var _0x9cb9=function(_0x219bca,_0xe5a6e5){_0x219bca=_0x219bca-0x0;var _0x5e3451=_0xcb99[_0x219bca];return _0x5e3451;};'use strict';var Sequelize=require(_0x9cb9('0x0'));module['exports']={'body':{'type':Sequelize[_0x9cb9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9cb9('0x2')]('in',_0x9cb9('0x3')),'defaultValue':_0x9cb9('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x9cb9('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 69a3329..d8c6b16 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 _0xa7f4=['includeAll','include','findAll','rawAttributes','length','find','body','params','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','motionChannel','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','download','join','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','destroy','sendStatus','name','send','map','FaxMessage','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0xa7f4,0x1e8));var _0x4a7f=function(_0x3e5bb1,_0x399ddb){_0x3e5bb1=_0x3e5bb1-0x0;var _0x5eeea4=_0xa7f4[_0x3e5bb1];return _0x5eeea4;};'use strict';var emlformat=require(_0x4a7f('0x0'));var rimraf=require(_0x4a7f('0x1'));var zipdir=require(_0x4a7f('0x2'));var jsonpatch=require(_0x4a7f('0x3'));var rp=require(_0x4a7f('0x4'));var moment=require(_0x4a7f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a7f('0x6'));var path=require('path');var sox=require(_0x4a7f('0x7'));var csv=require(_0x4a7f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a7f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4a7f('0xa'));var deskjs=require(_0x4a7f('0xb'));var toCsv=require(_0x4a7f('0x8'));var querystring=require(_0x4a7f('0xc'));var Papa=require(_0x4a7f('0xd'));var Redis=require('ioredis');var authService=require(_0x4a7f('0xe'));var qs=require(_0x4a7f('0xf'));var as=require(_0x4a7f('0x10'));var hardwareService=require(_0x4a7f('0x11'));var logger=require(_0x4a7f('0x12'))(_0x4a7f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4a7f('0x14'))['db'];config[_0x4a7f('0x15')]=_['defaults'](config[_0x4a7f('0x15')],{'host':_0x4a7f('0x16'),'port':0x18eb});var socket=require(_0x4a7f('0x17'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x4a7f('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4a7f('0x19')][_0x4a7f('0x1a')]({'port':0x232c});var client9002=jayson[_0x4a7f('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x578879,_0x10322a,_0x838ee,_0xef85e8){return new BPromise(function(_0x1f81bb,_0x2cd3d7){var _0x28935f=_0xef85e8||client;return _0x28935f[_0x4a7f('0x1b')](_0x578879,_0x838ee)['then'](function(_0xf2fcc){logger['info']('FaxMessage,\x20%s,\x20%s',_0x10322a,_0x4a7f('0x1c'));logger[_0x4a7f('0x1d')](_0x4a7f('0x1e'),_0x10322a,'request\x20sent',JSON[_0x4a7f('0x1f')](_0xf2fcc));if(_0xf2fcc[_0x4a7f('0x20')]){if(_0xf2fcc['error'][_0x4a7f('0x21')]===0x1f4){logger[_0x4a7f('0x20')](_0x4a7f('0x22'),_0x10322a,_0xf2fcc['error'][_0x4a7f('0x23')]);return _0x2cd3d7(_0xf2fcc[_0x4a7f('0x20')][_0x4a7f('0x23')]);}logger[_0x4a7f('0x20')](_0x4a7f('0x22'),_0x10322a,_0xf2fcc['error'][_0x4a7f('0x23')]);return _0x1f81bb(_0xf2fcc[_0x4a7f('0x20')][_0x4a7f('0x23')]);}else{logger[_0x4a7f('0x24')](_0x4a7f('0x22'),_0x10322a,'request\x20sent');_0x1f81bb(_0xf2fcc[_0x4a7f('0x25')][_0x4a7f('0x23')]);}})[_0x4a7f('0x26')](function(_0x7b272f){logger[_0x4a7f('0x20')](_0x4a7f('0x22'),_0x10322a,_0x7b272f);_0x2cd3d7(_0x7b272f);});});}function respondWithStatusCode(_0x57d74a,_0x53be5b){_0x53be5b=_0x53be5b||0xcc;return function(_0x213e4b){if(_0x213e4b){return _0x57d74a['sendStatus'](_0x53be5b);}return _0x57d74a['status'](_0x53be5b)[_0x4a7f('0x27')]();};}function respondWithResult(_0x35ac5b,_0xb80d94){_0xb80d94=_0xb80d94||0xc8;return function(_0x3071fc){if(_0x3071fc){return _0x35ac5b['status'](_0xb80d94)[_0x4a7f('0x28')](_0x3071fc);}};}function respondWithFilteredResult(_0x2b2eab,_0x252424){return function(_0x4edf5a){if(_0x4edf5a){var _0x1348d9=typeof _0x252424[_0x4a7f('0x29')]===_0x4a7f('0x2a')&&typeof _0x252424[_0x4a7f('0x2b')]==='undefined';var _0x507a73=_0x4edf5a['count'];var _0x263d0a=_0x1348d9?0x0:_0x252424['offset'];var _0x38105a=_0x1348d9?_0x4edf5a[_0x4a7f('0x2c')]:_0x252424[_0x4a7f('0x29')]+_0x252424['limit'];var _0xfdc628;if(_0x38105a>=_0x507a73){_0x38105a=_0x507a73;_0xfdc628=0xc8;}else{_0xfdc628=0xce;}_0x2b2eab[_0x4a7f('0x2d')](_0xfdc628);return _0x2b2eab[_0x4a7f('0x2e')](_0x4a7f('0x2f'),_0x263d0a+'-'+_0x38105a+'/'+_0x507a73)[_0x4a7f('0x28')](_0x4edf5a);}return null;};}function patchUpdates(_0x5dc8f7){return function(_0x3a2498){try{jsonpatch[_0x4a7f('0x30')](_0x3a2498,_0x5dc8f7,!![]);}catch(_0x25c5b2){return BPromise['reject'](_0x25c5b2);}return _0x3a2498['save']();};}function saveUpdates(_0x139f3d,_0x518382){return function(_0x2da32b){if(_0x2da32b){return _0x2da32b[_0x4a7f('0x31')](_0x139f3d)[_0x4a7f('0x32')](function(_0x4d89d8){return _0x4d89d8;});}return null;};}function removeEntity(_0x4ac5b0,_0x5eb3b0){return function(_0x58316e){if(_0x58316e){return _0x58316e[_0x4a7f('0x33')]()['then'](function(){_0x4ac5b0[_0x4a7f('0x2d')](0xcc)[_0x4a7f('0x27')]();});}};}function handleEntityNotFound(_0x259a70,_0x413dac){return function(_0x3806c2){if(!_0x3806c2){_0x259a70[_0x4a7f('0x34')](0x194);}return _0x3806c2;};}function handleError(_0x435a7e,_0x317373){_0x317373=_0x317373||0x1f4;return function(_0x1ebfa2){logger[_0x4a7f('0x20')](_0x1ebfa2['stack']);if(_0x1ebfa2['name']){delete _0x1ebfa2[_0x4a7f('0x35')];}_0x435a7e[_0x4a7f('0x2d')](_0x317373)[_0x4a7f('0x36')](_0x1ebfa2);};}exports['index']=function(_0x2fb1fa,_0xb7791a){var _0x2efcb4={},_0x4e473f={},_0x5eb4ac={'count':0x0,'rows':[]};var _0x5af65a=_[_0x4a7f('0x37')](db[_0x4a7f('0x38')]['rawAttributes'],function(_0x3eaa23){return{'name':_0x3eaa23[_0x4a7f('0x39')],'type':_0x3eaa23[_0x4a7f('0x3a')]['key']};});_0x4e473f[_0x4a7f('0x3b')]=_['map'](_0x5af65a,'name');_0x4e473f['query']=_[_0x4a7f('0x3c')](_0x2fb1fa[_0x4a7f('0x3d')]);_0x4e473f['filters']=_[_0x4a7f('0x3e')](_0x4e473f[_0x4a7f('0x3b')],_0x4e473f[_0x4a7f('0x3d')]);_0x2efcb4[_0x4a7f('0x3f')]=_[_0x4a7f('0x3e')](_0x4e473f[_0x4a7f('0x3b')],qs[_0x4a7f('0x40')](_0x2fb1fa['query'][_0x4a7f('0x40')]));_0x2efcb4[_0x4a7f('0x3f')]=_0x2efcb4['attributes']['length']?_0x2efcb4['attributes']:_0x4e473f[_0x4a7f('0x3b')];if(!_0x2fb1fa[_0x4a7f('0x3d')][_0x4a7f('0x41')](_0x4a7f('0x42'))){_0x2efcb4[_0x4a7f('0x2b')]=qs[_0x4a7f('0x2b')](_0x2fb1fa[_0x4a7f('0x3d')]['limit']);_0x2efcb4[_0x4a7f('0x29')]=qs[_0x4a7f('0x29')](_0x2fb1fa[_0x4a7f('0x3d')][_0x4a7f('0x29')]);}_0x2efcb4[_0x4a7f('0x43')]=qs[_0x4a7f('0x44')](_0x2fb1fa['query'][_0x4a7f('0x44')]);_0x2efcb4['where']=qs[_0x4a7f('0x45')](_[_0x4a7f('0x46')](_0x2fb1fa['query'],_0x4e473f[_0x4a7f('0x45')]),_0x5af65a);if(_0x2fb1fa[_0x4a7f('0x3d')]['filter']){_0x2efcb4[_0x4a7f('0x47')]=_[_0x4a7f('0x48')](_0x2efcb4[_0x4a7f('0x47')],{'$or':_[_0x4a7f('0x37')](_0x5af65a,function(_0xd9beff){if(_0xd9beff[_0x4a7f('0x3a')]!==_0x4a7f('0x49')){var _0x23bf62={};_0x23bf62[_0xd9beff[_0x4a7f('0x35')]]={'$like':'%'+_0x2fb1fa['query'][_0x4a7f('0x4a')]+'%'};return _0x23bf62;}})});}_0x2efcb4=_['merge']({},_0x2efcb4,_0x2fb1fa[_0x4a7f('0x4b')]);var _0x1eded3={'where':_0x2efcb4[_0x4a7f('0x47')]};return db[_0x4a7f('0x38')]['count'](_0x1eded3)[_0x4a7f('0x32')](function(_0x4b26c0){_0x5eb4ac[_0x4a7f('0x2c')]=_0x4b26c0;if(_0x2fb1fa[_0x4a7f('0x3d')][_0x4a7f('0x4c')]){_0x2efcb4[_0x4a7f('0x4d')]=[{'all':!![]}];}return db[_0x4a7f('0x38')][_0x4a7f('0x4e')](_0x2efcb4);})[_0x4a7f('0x32')](function(_0x5bb9d2){_0x5eb4ac['rows']=_0x5bb9d2;return _0x5eb4ac;})['then'](respondWithFilteredResult(_0xb7791a,_0x2efcb4))[_0x4a7f('0x26')](handleError(_0xb7791a,null));};exports['show']=function(_0x21bb60,_0x1594dc){var _0x437ce7={'raw':!![],'where':{'id':_0x21bb60['params']['id']}},_0x1a0b09={};_0x1a0b09[_0x4a7f('0x3b')]=_[_0x4a7f('0x3c')](db[_0x4a7f('0x38')][_0x4a7f('0x4f')]);_0x1a0b09[_0x4a7f('0x3d')]=_[_0x4a7f('0x3c')](_0x21bb60[_0x4a7f('0x3d')]);_0x1a0b09['filters']=_[_0x4a7f('0x3e')](_0x1a0b09[_0x4a7f('0x3b')],_0x1a0b09[_0x4a7f('0x3d')]);_0x437ce7[_0x4a7f('0x3f')]=_['intersection'](_0x1a0b09[_0x4a7f('0x3b')],qs[_0x4a7f('0x40')](_0x21bb60[_0x4a7f('0x3d')][_0x4a7f('0x40')]));_0x437ce7[_0x4a7f('0x3f')]=_0x437ce7[_0x4a7f('0x3f')][_0x4a7f('0x50')]?_0x437ce7[_0x4a7f('0x3f')]:_0x1a0b09['model'];if(_0x21bb60[_0x4a7f('0x3d')][_0x4a7f('0x4c')]){_0x437ce7['include']=[{'all':!![]}];}_0x437ce7=_[_0x4a7f('0x48')]({},_0x437ce7,_0x21bb60[_0x4a7f('0x4b')]);return db[_0x4a7f('0x38')][_0x4a7f('0x51')](_0x437ce7)[_0x4a7f('0x32')](handleEntityNotFound(_0x1594dc,null))[_0x4a7f('0x32')](respondWithResult(_0x1594dc,null))['catch'](handleError(_0x1594dc,null));};exports[_0x4a7f('0x31')]=function(_0x38b1f4,_0x6adc26){if(_0x38b1f4[_0x4a7f('0x52')]['id']){delete _0x38b1f4['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x38b1f4['params']['id']}})[_0x4a7f('0x32')](handleEntityNotFound(_0x6adc26,null))[_0x4a7f('0x32')](saveUpdates(_0x38b1f4['body'],null))['then'](respondWithResult(_0x6adc26,null))[_0x4a7f('0x26')](handleError(_0x6adc26,null));};exports[_0x4a7f('0x33')]=function(_0x771418,_0x3136d7){return db[_0x4a7f('0x38')][_0x4a7f('0x51')]({'where':{'id':_0x771418[_0x4a7f('0x53')]['id']}})[_0x4a7f('0x32')](handleEntityNotFound(_0x3136d7,null))['then'](removeEntity(_0x3136d7,null))['catch'](handleError(_0x3136d7,null));};exports['describe']=function(_0x5c4588,_0x4a12dd){return db['FaxMessage'][_0x4a7f('0x54')]()['then'](respondWithResult(_0x4a12dd,null))[_0x4a7f('0x26')](handleError(_0x4a12dd,null));};var interaction_log=require(_0x4a7f('0x12'))(_0x4a7f('0x55'));exports[_0x4a7f('0x56')]=function(_0x577205,_0x1d17a9,_0x3a70a0){var _0x9eaac1={'agent':{},'channel':'fax'};if(_0x577205[_0x4a7f('0x52')]['id']){delete _0x577205['body']['id'];}_0x577205[_0x4a7f('0x52')][_0x4a7f('0x57')]=!![];_0x577205[_0x4a7f('0x52')][_0x4a7f('0x58')]=moment()[_0x4a7f('0x59')](_0x4a7f('0x5a'));_0x577205[_0x4a7f('0x52')][_0x4a7f('0x5b')]=_0x577205[_0x4a7f('0x52')][_0x4a7f('0x5b')]||_0x577205[_0x4a7f('0x5c')]['id'];_0x9eaac1[_0x4a7f('0x5d')]['id']=_0x577205[_0x4a7f('0x52')][_0x4a7f('0x5b')];return db[_0x4a7f('0x38')][_0x4a7f('0x51')]({'where':{'id':_0x577205[_0x4a7f('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d17a9,null))[_0x4a7f('0x32')](saveUpdates(_0x577205[_0x4a7f('0x52')],null))[_0x4a7f('0x32')](function(_0x806f67){if(_0x806f67){_0x9eaac1[_0x4a7f('0x23')]=_0x806f67[_0x4a7f('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0x4a7f('0x51')]({'where':{'id':_0x806f67[_0x4a7f('0x5f')]}});}return null;})[_0x4a7f('0x32')](handleEntityNotFound(_0x1d17a9,null))['then'](function(_0x1b9f7f){if(_0x1b9f7f){return _0x1b9f7f[_0x4a7f('0x31')]({'UserId':_0x577205[_0x4a7f('0x52')]['UserId'],'read1stAt':_[_0x4a7f('0x60')](_0x1b9f7f[_0x4a7f('0x61')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4a7f('0x32')](function(_0x364503){if(_0x364503){_0x9eaac1[_0x4a7f('0x62')]=_0x364503[_0x4a7f('0x5e')]({'plain':!![]});interaction_log[_0x4a7f('0x24')](_0x4a7f('0x63'),_0x577205['user']['id'],_0x577205[_0x4a7f('0x5c')][_0x4a7f('0x35')],_0x577205[_0x4a7f('0x5c')][_0x4a7f('0x64')],_0x9eaac1[_0x4a7f('0x62')]['id'],_0x577205['body']?JSON[_0x4a7f('0x1f')](_0x577205['body']):_0x4a7f('0x65'));return respondWithRpcPromise('AcceptMessage',_0x4a7f('0x66'),_0x9eaac1);}return null;})[_0x4a7f('0x32')](function(_0x3f25bf){var _0xa7b146=_0x4a7f('0x67')+_0x3f25bf[_0x4a7f('0x23')][_0x4a7f('0x68')];return db['sequelize'][_0x4a7f('0x3d')](_0xa7b146,{'type':db[_0x4a7f('0x69')][_0x4a7f('0x6a')][_0x4a7f('0x6b')],'raw':!![]})[_0x4a7f('0x32')](function(_0x4e9021){return _0x4e9021;});})[_0x4a7f('0x32')](function(_0x3b2842){if(_0x3b2842){_0x9eaac1[_0x4a7f('0x23')][_0x4a7f('0x6c')]=_0x3b2842[0x0];if(!_0x577205[_0x4a7f('0x52')][_0x4a7f('0x5b')])return;return db[_0x4a7f('0x6d')]['find']({'where':{'id':_0x577205[_0x4a7f('0x52')][_0x4a7f('0x5b')],'role':_0x4a7f('0x5d')},'attributes':['id',_0x4a7f('0x35'),_0x4a7f('0x6e'),_0x4a7f('0x6f'),_0x4a7f('0x70')],'raw':!![]});}return null;})['then'](function(_0xad13c5){if(!_0xad13c5)return null;_0x9eaac1[_0x4a7f('0x23')][_0x4a7f('0x5d')]=_0xad13c5;return _0x9eaac1;})[_0x4a7f('0x32')](function(_0x281b73){if(_0x281b73){if(_0x577205[_0x4a7f('0x52')][_0x4a7f('0x71')]){_0x9eaac1[_0x4a7f('0x23')][_0x4a7f('0x72')]=util[_0x4a7f('0x59')](_0x4a7f('0x73'),_0x577205['user'][_0x4a7f('0x35')]);_0x9eaac1['message'][_0x4a7f('0x74')]=_0x9eaac1[_0x4a7f('0x74')];_0x9eaac1['message']['motionChannel']=_0x9eaac1['channel'];_0x9eaac1[_0x4a7f('0x23')][_0x4a7f('0x75')]=_0x4a7f('0x56');return respondWithRpcPromise(_0x4a7f('0x76'),_0x4a7f('0x76'),{'event':_0x4a7f('0x77'),'message':_0x9eaac1[_0x4a7f('0x23')]},client9002)[_0x4a7f('0x32')](function(){return _0x9eaac1;});}return _0x9eaac1;}return null;})[_0x4a7f('0x32')](respondWithResult(_0x1d17a9,null))[_0x4a7f('0x26')](handleError(_0x1d17a9,null));};var interaction_log=require(_0x4a7f('0x12'))(_0x4a7f('0x55'));exports[_0x4a7f('0x78')]=function(_0x36563b,_0x5dbce5,_0x3d3625){var _0x3042aa={'agent':{},'channel':_0x4a7f('0x79')};if(_0x36563b[_0x4a7f('0x52')]['id']){delete _0x36563b[_0x4a7f('0x52')]['id'];}_0x36563b[_0x4a7f('0x52')][_0x4a7f('0x5b')]=_0x36563b['body'][_0x4a7f('0x5b')]||_0x36563b['user']['id'];_0x3042aa[_0x4a7f('0x5d')]['id']=_0x36563b[_0x4a7f('0x52')][_0x4a7f('0x5b')];return db[_0x4a7f('0x38')]['find']({'where':{'id':_0x36563b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5dbce5,null))[_0x4a7f('0x32')](function(_0x25cda7){if(_0x25cda7){_0x3042aa[_0x4a7f('0x23')]=_0x25cda7[_0x4a7f('0x5e')]({'plain':!![]});return db[_0x4a7f('0x7a')][_0x4a7f('0x51')]({'where':{'id':_0x25cda7['FaxInteractionId']}});}return null;})[_0x4a7f('0x32')](handleEntityNotFound(_0x5dbce5,null))[_0x4a7f('0x32')](function(_0x5041fd){if(_0x5041fd){_0x3042aa[_0x4a7f('0x62')]=_0x5041fd[_0x4a7f('0x5e')]({'plain':!![]});interaction_log['info'](_0x4a7f('0x7b'),_0x36563b['user']['id'],_0x36563b[_0x4a7f('0x5c')][_0x4a7f('0x35')],_0x36563b[_0x4a7f('0x5c')][_0x4a7f('0x64')],_0x3042aa[_0x4a7f('0x62')]['id'],_0x36563b[_0x4a7f('0x52')]?JSON[_0x4a7f('0x1f')](_0x36563b[_0x4a7f('0x52')]):_0x4a7f('0x65'));return respondWithRpcPromise(_0x4a7f('0x7c'),_0x4a7f('0x7d'),_0x3042aa);}return null;})[_0x4a7f('0x32')](function(_0x9cf8a5){var _0x1e96b2=_0x4a7f('0x67')+_0x9cf8a5[_0x4a7f('0x23')][_0x4a7f('0x68')];return db[_0x4a7f('0x7e')][_0x4a7f('0x3d')](_0x1e96b2,{'type':db[_0x4a7f('0x69')]['QueryTypes'][_0x4a7f('0x6b')],'raw':!![]})[_0x4a7f('0x32')](function(_0x14cffe){return _0x14cffe;});})[_0x4a7f('0x32')](function(_0x297351){if(_0x297351){_0x3042aa[_0x4a7f('0x23')]['contact']=_0x297351[0x0];if(!_0x36563b['body'][_0x4a7f('0x5b')])return;return db[_0x4a7f('0x6d')]['find']({'where':{'id':_0x36563b['body'][_0x4a7f('0x5b')],'role':_0x4a7f('0x5d')},'attributes':['id',_0x4a7f('0x35'),_0x4a7f('0x6e'),_0x4a7f('0x6f'),_0x4a7f('0x70')],'raw':!![]});}return null;})[_0x4a7f('0x32')](function(_0x59510a){if(!_0x59510a)return null;_0x3042aa['message'][_0x4a7f('0x5d')]=_0x59510a;return _0x3042aa;})['then'](function(_0x53240a){if(_0x53240a){_0x53240a[_0x4a7f('0x23')][_0x4a7f('0x72')]=util[_0x4a7f('0x59')]('SIP/%s',_0x36563b['user']['name']);_0x53240a['message'][_0x4a7f('0x74')]=_0x3042aa[_0x4a7f('0x74')];_0x53240a['message'][_0x4a7f('0x7f')]=_0x3042aa[_0x4a7f('0x74')];_0x53240a[_0x4a7f('0x23')][_0x4a7f('0x75')]=_0x4a7f('0x78');respondWithRpcPromise(_0x4a7f('0x76'),_0x4a7f('0x76'),{'event':_0x4a7f('0x80'),'message':_0x53240a[_0x4a7f('0x23')]},client9002);return _0x3042aa;}return null;})[_0x4a7f('0x32')](respondWithResult(_0x5dbce5,null))[_0x4a7f('0x26')](handleError(_0x5dbce5,null));};exports[_0x4a7f('0x81')]=function(_0x6d5fa6,_0x947811){var _0xa87c3e;return db[_0x4a7f('0x38')][_0x4a7f('0x81')](_0x6d5fa6[_0x4a7f('0x52')],{})['then'](function(_0x5dc50e){_0xa87c3e=_0x5dc50e;return db[_0x4a7f('0x82')]['findOne']({'where':{'id':_0xa87c3e['ContactId']}});})['then'](function(_0xab5483){if(_[_0x4a7f('0x60')](_0xab5483)){return;}else{_0xa87c3e[_0x4a7f('0x79')]=_0xab5483[_0x4a7f('0x79')];return db[_0x4a7f('0x83')][_0x4a7f('0x84')]({'where':{'id':_0xa87c3e[_0x4a7f('0x85')]}});}})['then'](function(_0x4fa05d){return respondWithRpcPromise(_0x4a7f('0x86'),_0x4a7f('0x86'),{'FaxAccountId':_[_0x4a7f('0x60')](_0x6d5fa6[_0x4a7f('0x52')])?undefined:_0x6d5fa6[_0x4a7f('0x52')][_0x4a7f('0x87')],'path':_[_0x4a7f('0x60')](_0x4fa05d)?undefined:util[_0x4a7f('0x59')]('/var/opt/motion2/server/files/attachments/%s',_0x4fa05d['basename']),'fax':_[_0x4a7f('0x60')](_0xa87c3e['fax'])?undefined:_0xa87c3e['fax'],'AttachmentId':_0xa87c3e['AttachmentId']},client9002);})[_0x4a7f('0x32')](respondWithResult(_0x947811,0xc9))['catch'](handleError(_0x947811,null));};exports[_0x4a7f('0x88')]=function(_0xdcf2dc,_0x316df1){var _0x2f3a9d=path[_0x4a7f('0x89')](config['root'],_0x4a7f('0x8a'),_0x4a7f('0x8b'),_0x4a7f('0x8c'));return db['FaxMessage'][_0x4a7f('0x51')]({'where':{'id':_0xdcf2dc[_0x4a7f('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0x4a7f('0x83')}]})['then'](handleEntityNotFound(_0x316df1,null))[_0x4a7f('0x32')](function(_0x2aea71){if(_0x2aea71){return _0x316df1['download'](path['join'](_0x2f3a9d,_0x2aea71[_0x4a7f('0x83')]['basename']));}})[_0x4a7f('0x26')](handleError(_0x316df1,null));}; \ No newline at end of file +var _0x5bc1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','body','find','describe','../../config/logger','fax-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','fax','RejectMessage','rejectMessage','contact','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','download','rimraf','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1e945f,_0x3f24d2){var _0x189aa7=function(_0x15d561){while(--_0x15d561){_0x1e945f['push'](_0x1e945f['shift']());}};_0x189aa7(++_0x3f24d2);}(_0x5bc1,0x10c));var _0x15bc=function(_0x18ae8f,_0x25f684){_0x18ae8f=_0x18ae8f-0x0;var _0x43e219=_0x5bc1[_0x18ae8f];return _0x43e219;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15bc('0x1'));var moment=require('moment');var BPromise=require(_0x15bc('0x2'));var Mustache=require('mustache');var util=require(_0x15bc('0x3'));var path=require(_0x15bc('0x4'));var sox=require(_0x15bc('0x5'));var csv=require(_0x15bc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15bc('0x7'));var _=require(_0x15bc('0x8'));var squel=require('squel');var crypto=require(_0x15bc('0x9'));var jsforce=require(_0x15bc('0xa'));var deskjs=require(_0x15bc('0xb'));var toCsv=require(_0x15bc('0x6'));var querystring=require(_0x15bc('0xc'));var Papa=require(_0x15bc('0xd'));var Redis=require(_0x15bc('0xe'));var authService=require(_0x15bc('0xf'));var qs=require(_0x15bc('0x10'));var as=require(_0x15bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15bc('0x12'));var utils=require(_0x15bc('0x13'));var config=require(_0x15bc('0x14'));var licenseUtil=require(_0x15bc('0x15'));var db=require('../../mysqldb')['db'];config[_0x15bc('0x16')]=_[_0x15bc('0x17')](config[_0x15bc('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x15bc('0x18'))(new Redis(config[_0x15bc('0x16')]));require(_0x15bc('0x19'))[_0x15bc('0x1a')](socket);var jayson=require(_0x15bc('0x1b'));var client=jayson[_0x15bc('0x1c')][_0x15bc('0x1d')]({'port':0x232c});var client9002=jayson[_0x15bc('0x1c')][_0x15bc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2e14da,_0x27eb34,_0xb551ca,_0x69f259){return new BPromise(function(_0x11b74f,_0x9c13a9){var _0x4438b3=_0x69f259||client;return _0x4438b3[_0x15bc('0x1e')](_0x2e14da,_0xb551ca)['then'](function(_0x216f85){logger[_0x15bc('0x1f')](_0x15bc('0x20'),_0x27eb34,_0x15bc('0x21'));logger['debug'](_0x15bc('0x22'),_0x27eb34,'request\x20sent',JSON[_0x15bc('0x23')](_0x216f85));if(_0x216f85['error']){if(_0x216f85['error']['code']===0x1f4){logger[_0x15bc('0x24')]('FaxMessage,\x20%s,\x20%s',_0x27eb34,_0x216f85[_0x15bc('0x24')][_0x15bc('0x25')]);return _0x9c13a9(_0x216f85[_0x15bc('0x24')]['message']);}logger[_0x15bc('0x24')]('FaxMessage,\x20%s,\x20%s',_0x27eb34,_0x216f85[_0x15bc('0x24')][_0x15bc('0x25')]);return _0x11b74f(_0x216f85['error']['message']);}else{logger[_0x15bc('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x27eb34,_0x15bc('0x21'));_0x11b74f(_0x216f85[_0x15bc('0x26')]['message']);}})[_0x15bc('0x27')](function(_0x27cf74){logger[_0x15bc('0x24')](_0x15bc('0x20'),_0x27eb34,_0x27cf74);_0x9c13a9(_0x27cf74);});});}function respondWithStatusCode(_0x55fa65,_0x3403e8){_0x3403e8=_0x3403e8||0xcc;return function(_0x4560dd){if(_0x4560dd){return _0x55fa65['sendStatus'](_0x3403e8);}return _0x55fa65[_0x15bc('0x28')](_0x3403e8)[_0x15bc('0x29')]();};}function respondWithResult(_0x3f9dbc,_0x3b42c0){_0x3b42c0=_0x3b42c0||0xc8;return function(_0x4e8d86){if(_0x4e8d86){return _0x3f9dbc[_0x15bc('0x28')](_0x3b42c0)[_0x15bc('0x2a')](_0x4e8d86);}};}function respondWithFilteredResult(_0xda4d90,_0x40247f){return function(_0x2a9161){if(_0x2a9161){var _0x343b93=typeof _0x40247f[_0x15bc('0x2b')]===_0x15bc('0x2c')&&typeof _0x40247f['limit']===_0x15bc('0x2c');var _0x5cedd6=_0x2a9161['count'];var _0x59dd58=_0x343b93?0x0:_0x40247f[_0x15bc('0x2b')];var _0x363ae5=_0x343b93?_0x2a9161[_0x15bc('0x2d')]:_0x40247f[_0x15bc('0x2b')]+_0x40247f[_0x15bc('0x2e')];var _0x28f47b;if(_0x363ae5>=_0x5cedd6){_0x363ae5=_0x5cedd6;_0x28f47b=0xc8;}else{_0x28f47b=0xce;}_0xda4d90[_0x15bc('0x28')](_0x28f47b);return _0xda4d90[_0x15bc('0x2f')](_0x15bc('0x30'),_0x59dd58+'-'+_0x363ae5+'/'+_0x5cedd6)['json'](_0x2a9161);}return null;};}function patchUpdates(_0x3a7005){return function(_0x3dc49a){try{jsonpatch['apply'](_0x3dc49a,_0x3a7005,!![]);}catch(_0x7973d3){return BPromise[_0x15bc('0x31')](_0x7973d3);}return _0x3dc49a[_0x15bc('0x32')]();};}function saveUpdates(_0x34134a,_0x4ece35){return function(_0x5ea819){if(_0x5ea819){return _0x5ea819[_0x15bc('0x33')](_0x34134a)[_0x15bc('0x34')](function(_0x2a1d53){return _0x2a1d53;});}return null;};}function removeEntity(_0x433bf2,_0x5f4c9b){return function(_0x260559){if(_0x260559){return _0x260559[_0x15bc('0x35')]()['then'](function(){_0x433bf2[_0x15bc('0x28')](0xcc)[_0x15bc('0x29')]();});}};}function handleEntityNotFound(_0x2acab7,_0x1c0ddf){return function(_0x5f494b){if(!_0x5f494b){_0x2acab7[_0x15bc('0x36')](0x194);}return _0x5f494b;};}function handleError(_0x2d36da,_0x1131f9){_0x1131f9=_0x1131f9||0x1f4;return function(_0x328a81){logger[_0x15bc('0x24')](_0x328a81[_0x15bc('0x37')]);if(_0x328a81[_0x15bc('0x38')]){delete _0x328a81[_0x15bc('0x38')];}_0x2d36da[_0x15bc('0x28')](_0x1131f9)['send'](_0x328a81);};}exports[_0x15bc('0x39')]=function(_0x567f75,_0x36541c){var _0x1d504a={},_0x4e7724={},_0x3bda69={'count':0x0,'rows':[]};var _0x41ba2f=_['map'](db[_0x15bc('0x3a')][_0x15bc('0x3b')],function(_0x1642be){return{'name':_0x1642be['fieldName'],'type':_0x1642be[_0x15bc('0x3c')][_0x15bc('0x3d')]};});_0x4e7724[_0x15bc('0x3e')]=_[_0x15bc('0x3f')](_0x41ba2f,'name');_0x4e7724[_0x15bc('0x40')]=_[_0x15bc('0x41')](_0x567f75[_0x15bc('0x40')]);_0x4e7724[_0x15bc('0x42')]=_[_0x15bc('0x43')](_0x4e7724[_0x15bc('0x3e')],_0x4e7724[_0x15bc('0x40')]);_0x1d504a[_0x15bc('0x44')]=_['intersection'](_0x4e7724[_0x15bc('0x3e')],qs[_0x15bc('0x45')](_0x567f75[_0x15bc('0x40')][_0x15bc('0x45')]));_0x1d504a[_0x15bc('0x44')]=_0x1d504a['attributes'][_0x15bc('0x46')]?_0x1d504a[_0x15bc('0x44')]:_0x4e7724[_0x15bc('0x3e')];if(!_0x567f75[_0x15bc('0x40')][_0x15bc('0x47')](_0x15bc('0x48'))){_0x1d504a[_0x15bc('0x2e')]=qs[_0x15bc('0x2e')](_0x567f75[_0x15bc('0x40')][_0x15bc('0x2e')]);_0x1d504a[_0x15bc('0x2b')]=qs[_0x15bc('0x2b')](_0x567f75['query']['offset']);}_0x1d504a['order']=qs['sort'](_0x567f75[_0x15bc('0x40')][_0x15bc('0x49')]);_0x1d504a[_0x15bc('0x4a')]=qs[_0x15bc('0x42')](_[_0x15bc('0x4b')](_0x567f75[_0x15bc('0x40')],_0x4e7724[_0x15bc('0x42')]),_0x41ba2f);if(_0x567f75[_0x15bc('0x40')][_0x15bc('0x4c')]){_0x1d504a[_0x15bc('0x4a')]=_[_0x15bc('0x4d')](_0x1d504a[_0x15bc('0x4a')],{'$or':_[_0x15bc('0x3f')](_0x41ba2f,function(_0x4d64b2){if(_0x4d64b2[_0x15bc('0x3c')]!==_0x15bc('0x4e')){var _0x2dfd71={};_0x2dfd71[_0x4d64b2['name']]={'$like':'%'+_0x567f75[_0x15bc('0x40')]['filter']+'%'};return _0x2dfd71;}})});}_0x1d504a=_[_0x15bc('0x4d')]({},_0x1d504a,_0x567f75[_0x15bc('0x4f')]);var _0x598478={'where':_0x1d504a[_0x15bc('0x4a')]};return db[_0x15bc('0x3a')][_0x15bc('0x2d')](_0x598478)[_0x15bc('0x34')](function(_0x2a89ad){_0x3bda69[_0x15bc('0x2d')]=_0x2a89ad;if(_0x567f75[_0x15bc('0x40')]['includeAll']){_0x1d504a[_0x15bc('0x50')]=[{'all':!![]}];}return db[_0x15bc('0x3a')][_0x15bc('0x51')](_0x1d504a);})[_0x15bc('0x34')](function(_0x140d1c){_0x3bda69['rows']=_0x140d1c;return _0x3bda69;})[_0x15bc('0x34')](respondWithFilteredResult(_0x36541c,_0x1d504a))['catch'](handleError(_0x36541c,null));};exports[_0x15bc('0x52')]=function(_0x2d6dac,_0x29839b){var _0x4908ae={'raw':!![],'where':{'id':_0x2d6dac[_0x15bc('0x53')]['id']}},_0x3c4b57={};_0x3c4b57[_0x15bc('0x3e')]=_[_0x15bc('0x41')](db[_0x15bc('0x3a')][_0x15bc('0x3b')]);_0x3c4b57['query']=_[_0x15bc('0x41')](_0x2d6dac[_0x15bc('0x40')]);_0x3c4b57['filters']=_[_0x15bc('0x43')](_0x3c4b57[_0x15bc('0x3e')],_0x3c4b57['query']);_0x4908ae[_0x15bc('0x44')]=_[_0x15bc('0x43')](_0x3c4b57[_0x15bc('0x3e')],qs[_0x15bc('0x45')](_0x2d6dac[_0x15bc('0x40')][_0x15bc('0x45')]));_0x4908ae[_0x15bc('0x44')]=_0x4908ae[_0x15bc('0x44')][_0x15bc('0x46')]?_0x4908ae[_0x15bc('0x44')]:_0x3c4b57[_0x15bc('0x3e')];if(_0x2d6dac[_0x15bc('0x40')]['includeAll']){_0x4908ae[_0x15bc('0x50')]=[{'all':!![]}];}_0x4908ae=_[_0x15bc('0x4d')]({},_0x4908ae,_0x2d6dac[_0x15bc('0x4f')]);return db[_0x15bc('0x3a')]['find'](_0x4908ae)[_0x15bc('0x34')](handleEntityNotFound(_0x29839b,null))['then'](respondWithResult(_0x29839b,null))[_0x15bc('0x27')](handleError(_0x29839b,null));};exports[_0x15bc('0x33')]=function(_0x37d2e4,_0x3fe147){if(_0x37d2e4['body']['id']){delete _0x37d2e4[_0x15bc('0x54')]['id'];}return db[_0x15bc('0x3a')][_0x15bc('0x55')]({'where':{'id':_0x37d2e4[_0x15bc('0x53')]['id']}})[_0x15bc('0x34')](handleEntityNotFound(_0x3fe147,null))[_0x15bc('0x34')](saveUpdates(_0x37d2e4[_0x15bc('0x54')],null))[_0x15bc('0x34')](respondWithResult(_0x3fe147,null))[_0x15bc('0x27')](handleError(_0x3fe147,null));};exports[_0x15bc('0x35')]=function(_0x43312d,_0xb3d5fa){return db['FaxMessage'][_0x15bc('0x55')]({'where':{'id':_0x43312d['params']['id']}})['then'](handleEntityNotFound(_0xb3d5fa,null))[_0x15bc('0x34')](removeEntity(_0xb3d5fa,null))[_0x15bc('0x27')](handleError(_0xb3d5fa,null));};exports[_0x15bc('0x56')]=function(_0x55f5a2,_0x25e8df){return db[_0x15bc('0x3a')][_0x15bc('0x56')]()['then'](respondWithResult(_0x25e8df,null))[_0x15bc('0x27')](handleError(_0x25e8df,null));};var interaction_log=require(_0x15bc('0x57'))(_0x15bc('0x58'));exports['accept']=function(_0x46a4aa,_0x2ed834,_0x56dea6){var _0x47f187={'agent':{},'channel':'fax'};if(_0x46a4aa[_0x15bc('0x54')]['id']){delete _0x46a4aa['body']['id'];}_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x59')]=!![];_0x46a4aa[_0x15bc('0x54')]['readAt']=moment()[_0x15bc('0x5a')](_0x15bc('0x5b'));_0x46a4aa['body'][_0x15bc('0x5c')]=_0x46a4aa['body']['UserId']||_0x46a4aa[_0x15bc('0x5d')]['id'];_0x47f187[_0x15bc('0x5e')]['id']=_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')];return db['FaxMessage'][_0x15bc('0x55')]({'where':{'id':_0x46a4aa[_0x15bc('0x53')]['id'],'UserId':null}})[_0x15bc('0x34')](handleEntityNotFound(_0x2ed834,null))[_0x15bc('0x34')](saveUpdates(_0x46a4aa[_0x15bc('0x54')],null))['then'](function(_0x3b9d10){if(_0x3b9d10){_0x47f187[_0x15bc('0x25')]=_0x3b9d10[_0x15bc('0x5f')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3b9d10[_0x15bc('0x60')]}});}return null;})[_0x15bc('0x34')](handleEntityNotFound(_0x2ed834,null))[_0x15bc('0x34')](function(_0x2614c8){if(_0x2614c8){return _0x2614c8['update']({'UserId':_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')],'read1stAt':_['isNil'](_0x2614c8[_0x15bc('0x61')])?moment()[_0x15bc('0x5a')](_0x15bc('0x5b')):undefined});}return null;})['then'](function(_0x42521e){if(_0x42521e){_0x47f187[_0x15bc('0x62')]=_0x42521e[_0x15bc('0x5f')]({'plain':!![]});interaction_log[_0x15bc('0x1f')](_0x15bc('0x63'),_0x46a4aa['user']['id'],_0x46a4aa[_0x15bc('0x5d')][_0x15bc('0x38')],_0x46a4aa[_0x15bc('0x5d')][_0x15bc('0x64')],_0x47f187[_0x15bc('0x62')]['id'],_0x46a4aa['body']?JSON[_0x15bc('0x23')](_0x46a4aa['body']):_0x15bc('0x65'));return respondWithRpcPromise(_0x15bc('0x66'),_0x15bc('0x67'),_0x47f187);}return null;})[_0x15bc('0x34')](function(_0x157d66){var _0x4d665f=_0x15bc('0x68')+_0x157d66['message'][_0x15bc('0x69')];return db[_0x15bc('0x6a')][_0x15bc('0x40')](_0x4d665f,{'type':db[_0x15bc('0x6b')][_0x15bc('0x6c')][_0x15bc('0x6d')],'raw':!![]})['then'](function(_0x2aefc8){return _0x2aefc8;});})[_0x15bc('0x34')](function(_0x164e53){if(_0x164e53){_0x47f187[_0x15bc('0x25')]['contact']=_0x164e53[0x0];if(!_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')])return;return db[_0x15bc('0x6e')][_0x15bc('0x55')]({'where':{'id':_0x46a4aa[_0x15bc('0x54')][_0x15bc('0x5c')],'role':_0x15bc('0x5e')},'attributes':['id',_0x15bc('0x38'),_0x15bc('0x6f'),_0x15bc('0x70'),_0x15bc('0x71')],'raw':!![]});}return null;})[_0x15bc('0x34')](function(_0x33959c){if(!_0x33959c)return null;_0x47f187[_0x15bc('0x25')][_0x15bc('0x5e')]=_0x33959c;return _0x47f187;})[_0x15bc('0x34')](function(_0x58b40c){if(_0x58b40c){if(_0x46a4aa[_0x15bc('0x54')]['manual']){_0x47f187[_0x15bc('0x25')][_0x15bc('0x72')]=util['format'](_0x15bc('0x73'),_0x46a4aa['user'][_0x15bc('0x38')]);_0x47f187[_0x15bc('0x25')][_0x15bc('0x74')]=_0x47f187['channel'];_0x47f187['message'][_0x15bc('0x75')]=_0x47f187[_0x15bc('0x74')];_0x47f187['message'][_0x15bc('0x76')]='accept';return respondWithRpcPromise(_0x15bc('0x77'),_0x15bc('0x77'),{'event':'acceptmessage','message':_0x47f187[_0x15bc('0x25')]},client9002)[_0x15bc('0x34')](function(){return _0x47f187;});}return _0x47f187;}return null;})['then'](respondWithResult(_0x2ed834,null))['catch'](handleError(_0x2ed834,null));};var interaction_log=require(_0x15bc('0x57'))('fax-interactions');exports[_0x15bc('0x31')]=function(_0x49ca16,_0x1d294b,_0x4a66ae){var _0x27afcf={'agent':{},'channel':_0x15bc('0x78')};if(_0x49ca16['body']['id']){delete _0x49ca16[_0x15bc('0x54')]['id'];}_0x49ca16[_0x15bc('0x54')][_0x15bc('0x5c')]=_0x49ca16[_0x15bc('0x54')]['UserId']||_0x49ca16[_0x15bc('0x5d')]['id'];_0x27afcf[_0x15bc('0x5e')]['id']=_0x49ca16[_0x15bc('0x54')][_0x15bc('0x5c')];return db[_0x15bc('0x3a')][_0x15bc('0x55')]({'where':{'id':_0x49ca16[_0x15bc('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d294b,null))['then'](function(_0x2eecf7){if(_0x2eecf7){_0x27afcf[_0x15bc('0x25')]=_0x2eecf7['get']({'plain':!![]});return db['FaxInteraction'][_0x15bc('0x55')]({'where':{'id':_0x2eecf7['FaxInteractionId']}});}return null;})[_0x15bc('0x34')](handleEntityNotFound(_0x1d294b,null))[_0x15bc('0x34')](function(_0x3aeaad){if(_0x3aeaad){_0x27afcf['interaction']=_0x3aeaad['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x49ca16['user']['id'],_0x49ca16[_0x15bc('0x5d')]['name'],_0x49ca16[_0x15bc('0x5d')]['role'],_0x27afcf[_0x15bc('0x62')]['id'],_0x49ca16[_0x15bc('0x54')]?JSON['stringify'](_0x49ca16[_0x15bc('0x54')]):_0x15bc('0x65'));return respondWithRpcPromise(_0x15bc('0x79'),_0x15bc('0x7a'),_0x27afcf);}return null;})[_0x15bc('0x34')](function(_0x4271b6){var _0x28d0a8=_0x15bc('0x68')+_0x4271b6[_0x15bc('0x25')][_0x15bc('0x69')];return db[_0x15bc('0x6a')]['query'](_0x28d0a8,{'type':db[_0x15bc('0x6b')][_0x15bc('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x2998f4){return _0x2998f4;});})[_0x15bc('0x34')](function(_0x3db777){if(_0x3db777){_0x27afcf[_0x15bc('0x25')][_0x15bc('0x7b')]=_0x3db777[0x0];if(!_0x49ca16[_0x15bc('0x54')]['UserId'])return;return db[_0x15bc('0x6e')][_0x15bc('0x55')]({'where':{'id':_0x49ca16[_0x15bc('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0x15bc('0x38'),_0x15bc('0x6f'),'email',_0x15bc('0x71')],'raw':!![]});}return null;})['then'](function(_0x12a719){if(!_0x12a719)return null;_0x27afcf[_0x15bc('0x25')]['agent']=_0x12a719;return _0x27afcf;})[_0x15bc('0x34')](function(_0x2c6b88){if(_0x2c6b88){_0x2c6b88[_0x15bc('0x25')][_0x15bc('0x72')]=util[_0x15bc('0x5a')](_0x15bc('0x73'),_0x49ca16[_0x15bc('0x5d')][_0x15bc('0x38')]);_0x2c6b88['message']['channel']=_0x27afcf[_0x15bc('0x74')];_0x2c6b88[_0x15bc('0x25')][_0x15bc('0x75')]=_0x27afcf[_0x15bc('0x74')];_0x2c6b88['message'][_0x15bc('0x76')]=_0x15bc('0x31');respondWithRpcPromise(_0x15bc('0x77'),_0x15bc('0x77'),{'event':_0x15bc('0x7c'),'message':_0x2c6b88[_0x15bc('0x25')]},client9002);return _0x27afcf;}return null;})[_0x15bc('0x34')](respondWithResult(_0x1d294b,null))[_0x15bc('0x27')](handleError(_0x1d294b,null));};exports[_0x15bc('0x7d')]=function(_0x5eff69,_0x1412f3){var _0x516220;return db['FaxMessage'][_0x15bc('0x7d')](_0x5eff69[_0x15bc('0x54')],{})[_0x15bc('0x34')](function(_0x4f6aa8){_0x516220=_0x4f6aa8;return db[_0x15bc('0x7e')][_0x15bc('0x7f')]({'where':{'id':_0x516220['ContactId']}});})[_0x15bc('0x34')](function(_0x3b41f9){if(_[_0x15bc('0x80')](_0x3b41f9)){return;}else{_0x516220[_0x15bc('0x78')]=_0x3b41f9[_0x15bc('0x78')];return db[_0x15bc('0x81')][_0x15bc('0x7f')]({'where':{'id':_0x516220[_0x15bc('0x82')]}});}})['then'](function(_0x3c8460){return respondWithRpcPromise(_0x15bc('0x83'),_0x15bc('0x83'),{'FaxAccountId':_[_0x15bc('0x80')](_0x5eff69['body'])?undefined:_0x5eff69['body'][_0x15bc('0x84')],'path':_[_0x15bc('0x80')](_0x3c8460)?undefined:util[_0x15bc('0x5a')](_0x15bc('0x85'),_0x3c8460[_0x15bc('0x86')]),'fax':_['isNil'](_0x516220[_0x15bc('0x78')])?undefined:_0x516220[_0x15bc('0x78')],'AttachmentId':_0x516220['AttachmentId']},client9002);})[_0x15bc('0x34')](respondWithResult(_0x1412f3,0xc9))[_0x15bc('0x27')](handleError(_0x1412f3,null));};exports['download']=function(_0x1d967d,_0x54e5ed){var _0x13cff7=path[_0x15bc('0x87')](config['root'],_0x15bc('0x88'),_0x15bc('0x89'),_0x15bc('0x8a'));return db[_0x15bc('0x3a')]['find']({'where':{'id':_0x1d967d[_0x15bc('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0x15bc('0x81')}]})[_0x15bc('0x34')](handleEntityNotFound(_0x54e5ed,null))['then'](function(_0x2332c0){if(_0x2332c0){return _0x54e5ed[_0x15bc('0x8b')](path[_0x15bc('0x87')](_0x13cff7,_0x2332c0[_0x15bc('0x81')][_0x15bc('0x86')]));}})[_0x15bc('0x27')](handleError(_0x54e5ed,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 98a91bb..2a41408 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 _0x6a0b=['save','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0xbfde8c,_0xa89828){var _0x2a796e=function(_0x21baea){while(--_0x21baea){_0xbfde8c['push'](_0xbfde8c['shift']());}};_0x2a796e(++_0xa89828);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x1c3df8,_0x3bffb3){_0x1c3df8=_0x1c3df8-0x0;var _0x2e818f=_0x6a0b[_0x1c3df8];return _0x2e818f;};'use strict';var EventEmitter=require(_0xb6a0('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb6a0('0x1')](0x0);var events={'afterCreate':_0xb6a0('0x2'),'afterUpdate':'update','afterDestroy':_0xb6a0('0x3')};function emitEvent(_0x3e5b73){return function(_0x1505b1,_0x557a99,_0x4652da){FaxMessageEvents['emit'](_0x3e5b73+':'+_0x1505b1['id'],_0x1505b1);FaxMessageEvents[_0xb6a0('0x4')](_0x3e5b73,_0x1505b1);_0x4652da(null);};}for(var e in events){if(events[_0xb6a0('0x5')](e)){var event=events[e];FaxMessage[_0xb6a0('0x6')](e,emitEvent(event));}}module[_0xb6a0('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x41d0=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update'];(function(_0x222688,_0x46c5eb){var _0x437433=function(_0x29958c){while(--_0x29958c){_0x222688['push'](_0x222688['shift']());}};_0x437433(++_0x46c5eb);}(_0x41d0,0x1c6));var _0x041d=function(_0x2709f9,_0x2c9b2e){_0x2709f9=_0x2709f9-0x0;var _0x51da75=_0x41d0[_0x2709f9];return _0x51da75;};'use strict';var EventEmitter=require(_0x041d('0x0'));var FaxMessage=require(_0x041d('0x1'))['db'][_0x041d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x041d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041d('0x4'),'afterDestroy':_0x041d('0x5')};function emitEvent(_0x12e55d){return function(_0x397dad,_0x41e587,_0x3a22a4){FaxMessageEvents[_0x041d('0x6')](_0x12e55d+':'+_0x397dad['id'],_0x397dad);FaxMessageEvents[_0x041d('0x6')](_0x12e55d,_0x397dad);_0x3a22a4(null);};}for(var e in events){if(events[_0x041d('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x041d('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b0523b3..b4fee6a 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 _0x133f=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','get','direction','toLowerCase','UserId','FaxInteraction','findOne','then','update','createdAt','catch','error'];(function(_0x22a15e,_0x25fbc4){var _0x3e459f=function(_0x28a114){while(--_0x28a114){_0x22a15e['push'](_0x22a15e['shift']());}};_0x3e459f(++_0x25fbc4);}(_0x133f,0x1cc));var _0xf133=function(_0x2171c1,_0x43b7fa){_0x2171c1=_0x2171c1-0x0;var _0x32fc80=_0x133f[_0x2171c1];return _0x32fc80;};'use strict';var _=require(_0xf133('0x0'));var util=require('util');var logger=require(_0xf133('0x1'))('api');var moment=require(_0xf133('0x2'));var BPromise=require('bluebird');var rp=require(_0xf133('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf133('0x4'));var config=require(_0xf133('0x5'));var attributes=require(_0xf133('0x6'));module[_0xf133('0x7')]=function(_0x438e1b,_0x179c4f){return _0x438e1b[_0xf133('0x8')](_0xf133('0x9'),attributes,{'tableName':_0xf133('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xf133('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x367746,_0x3a7a03,_0x386d82){var _0x2cd975=_0x438e1b['models'];var _0x306cbf=_0x367746[_0xf133('0xc')]({'plain':!![]});if(_0x306cbf[_0xf133('0xd')][_0xf133('0xe')]()==='in'||_0x306cbf[_0xf133('0xd')][_0xf133('0xe')]()==='out'&&!_0x306cbf['secret']&&!_['isNil'](_0x306cbf[_0xf133('0xf')])){_0x2cd975[_0xf133('0x10')][_0xf133('0x11')]({'where':{'id':_0x306cbf['FaxInteractionId']}})[_0xf133('0x12')](function(_0x5514b8){if(_0x5514b8){_0x5514b8[_0xf133('0x13')]({'lastMsgAt':_0x306cbf[_0xf133('0x14')],'lastMsgDirection':_0x306cbf[_0xf133('0xd')]['toLowerCase']()});}})[_0xf133('0x15')](function(_0x7c92fd){console[_0xf133('0x16')](_0x7c92fd);});}_0x386d82();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd523=['get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models'];(function(_0x508338,_0xcf1f4d){var _0x1ccd1b=function(_0x3b4525){while(--_0x3b4525){_0x508338['push'](_0x508338['shift']());}};_0x1ccd1b(++_0xcf1f4d);}(_0xd523,0x112));var _0x3d52=function(_0x36722b,_0x429390){_0x36722b=_0x36722b-0x0;var _0x2a9748=_0xd523[_0x36722b];return _0x2a9748;};'use strict';var _=require('lodash');var util=require(_0x3d52('0x0'));var logger=require(_0x3d52('0x1'))(_0x3d52('0x2'));var moment=require(_0x3d52('0x3'));var BPromise=require(_0x3d52('0x4'));var rp=require(_0x3d52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d52('0x6'));var config=require(_0x3d52('0x7'));var attributes=require(_0x3d52('0x8'));module['exports']=function(_0x6aec2e,_0x286b76){return _0x6aec2e[_0x3d52('0x9')](_0x3d52('0xa'),attributes,{'tableName':_0x3d52('0xb'),'paranoid':![],'indexes':[{'name':_0x3d52('0xc'),'fields':[_0x3d52('0xd')],'type':_0x3d52('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37372c,_0x51b9e8,_0x2661b7){var _0x19f905=_0x6aec2e[_0x3d52('0xf')];var _0x19fdd3=_0x37372c[_0x3d52('0x10')]({'plain':!![]});if(_0x19fdd3[_0x3d52('0x11')][_0x3d52('0x12')]()==='in'||_0x19fdd3[_0x3d52('0x11')]['toLowerCase']()==='out'&&!_0x19fdd3[_0x3d52('0x13')]&&!_[_0x3d52('0x14')](_0x19fdd3[_0x3d52('0x15')])){_0x19f905[_0x3d52('0x16')][_0x3d52('0x17')]({'where':{'id':_0x19fdd3['FaxInteractionId']}})['then'](function(_0xe984f){if(_0xe984f){_0xe984f[_0x3d52('0x18')]({'lastMsgAt':_0x19fdd3[_0x3d52('0x19')],'lastMsgDirection':_0x19fdd3[_0x3d52('0x11')][_0x3d52('0x12')]()});}})['catch'](function(_0x4c6044){console[_0x3d52('0x1a')](_0x4c6044);});}_0x2661b7();}},'charset':_0x3d52('0x1b'),'collate':_0x3d52('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 450caa3..961ff2a 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 _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4f23b7,_0x1d50b9){var _0x3c84a1=function(_0x261ecd){while(--_0x261ecd){_0x4f23b7['push'](_0x4f23b7['shift']());}};_0x3c84a1(++_0x1d50b9);}(_0xe14d,0x1ee));var _0xde14=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xe14d[_0x32d457];return _0x338386;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file +var _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x2033d4,_0x1a1c6a){var _0x30dd43=function(_0x33224b){while(--_0x33224b){_0x2033d4['push'](_0x2033d4['shift']());}};_0x30dd43(++_0x1a1c6a);}(_0x81bd,0x7c));var _0xd81b=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x81bd[_0x229f5e];return _0x2d62ff;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index bbfe26e..35c2982 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 _0x1a5c=['update','emit','removeListener','register','faxMessage:','remove'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x1a5c,0x1a3));var _0xc1a5=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x1a5c[_0x1abb09];return _0xea1c07;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0xc1a5('0x0'),_0xc1a5('0x1')];function createListener(_0x10bca1,_0x1afa04){return function(_0x2f3e3e){_0x1afa04[_0xc1a5('0x2')](_0x10bca1,_0x2f3e3e);};}function removeListener(_0x5ce14d,_0x443bae){return function(){FaxMessageEvents[_0xc1a5('0x3')](_0x5ce14d,_0x443bae);};}exports[_0xc1a5('0x4')]=function(_0x4e5815){for(var _0x39c3e1=0x0,_0x3fc397=events['length'];_0x39c3e1<_0x3fc397;_0x39c3e1++){var _0xb5124=events[_0x39c3e1];var _0x724b0b=createListener(_0xc1a5('0x5')+_0xb5124,_0x4e5815);FaxMessageEvents['on'](_0xb5124,_0x724b0b);}}; \ No newline at end of file +var _0xb21c=['./faxMessage.events','save','remove','emit','removeListener','register','length','faxMessage:'];(function(_0x871788,_0xcabf5){var _0x4a4207=function(_0x1f2608){while(--_0x1f2608){_0x871788['push'](_0x871788['shift']());}};_0x4a4207(++_0xcabf5);}(_0xb21c,0x1d0));var _0xcb21=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xb21c[_0x4404ff];return _0x5e7b19;};'use strict';var FaxMessageEvents=require(_0xcb21('0x0'));var events=[_0xcb21('0x1'),_0xcb21('0x2'),'update'];function createListener(_0x585e2e,_0x5e9255){return function(_0x1e2a53){_0x5e9255[_0xcb21('0x3')](_0x585e2e,_0x1e2a53);};}function removeListener(_0x240106,_0x18918d){return function(){FaxMessageEvents[_0xcb21('0x4')](_0x240106,_0x18918d);};}exports[_0xcb21('0x5')]=function(_0x38b362){for(var _0x402b56=0x0,_0x534371=events[_0xcb21('0x6')];_0x402b56<_0x534371;_0x402b56++){var _0x2215dc=events[_0x402b56];var _0x422dba=createListener(_0xcb21('0x7')+_0x2215dc,_0x38b362);FaxMessageEvents['on'](_0x2215dc,_0x422dba);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d044854..a907014 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 _0xe5b5=['fax','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x54334b,_0x5d01b8){var _0x55faf6=function(_0x51787d){while(--_0x51787d){_0x54334b['push'](_0x54334b['shift']());}};_0x55faf6(++_0x5d01b8);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xe5b5[_0x215e65];return _0xa85842;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/download',auth[_0x5e5b('0xc')](),controller['download']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x13')](_0x5e5b('0x14'),'faxmessage:create'),controller['create']);router['put'](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x18')]);router['put'](_0x5e5b('0x19'),auth[_0x5e5b('0xc')](),controller['reject']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x5e5b('0x1b')]);module[_0x5e5b('0x1c')]=router; \ No newline at end of file +var _0x22fb=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','update','put','/:id/accept','accept','delete'];(function(_0x5c84a6,_0x321f95){var _0xb8c5f0=function(_0x106d58){while(--_0x106d58){_0x5c84a6['push'](_0x5c84a6['shift']());}};_0xb8c5f0(++_0x321f95);}(_0x22fb,0x192));var _0xb22f=function(_0x4b4950,_0xcb693b){_0x4b4950=_0x4b4950-0x0;var _0x6602c5=_0x22fb[_0x4b4950];return _0x6602c5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0x7')](_0xb22f('0xe'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')]('/',auth[_0xb22f('0x8')](),interaction['tracked']('fax','faxmessage:create'),controller[_0xb22f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb22f('0x12')]);router[_0xb22f('0x13')](_0xb22f('0x14'),auth[_0xb22f('0x8')](),controller[_0xb22f('0x15')]);router[_0xb22f('0x13')]('/:id/reject',auth[_0xb22f('0x8')](),controller['reject']);router[_0xb22f('0x16')]('/:id',auth[_0xb22f('0x8')](),controller[_0xb22f('0x17')]);module[_0xb22f('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 3354ff3..a1b79c6 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 _0x398b=['STRING','name','ENUM','rrmemory','roundrobin','INTEGER','sequelize','exports'];(function(_0x462146,_0x3358d3){var _0x364e35=function(_0x3e4eba){while(--_0x3e4eba){_0x462146['push'](_0x462146['shift']());}};_0x364e35(++_0x3358d3);}(_0x398b,0x1b6));var _0xb398=function(_0x3eff47,_0x2796a1){_0x3eff47=_0x3eff47-0x0;var _0x8c1be2=_0x398b[_0x3eff47];return _0x8c1be2;};'use strict';var Sequelize=require(_0xb398('0x0'));module[_0xb398('0x1')]={'name':{'type':Sequelize[_0xb398('0x2')],'unique':_0xb398('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb398('0x4')](_0xb398('0x5'),'beepall',_0xb398('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb398('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ea4=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8ea4,0x85));var _0x48ea=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0x8ea4[_0x575b72];return _0x561c57;};'use strict';var Sequelize=require(_0x48ea('0x0'));module[_0x48ea('0x1')]={'name':{'type':Sequelize[_0x48ea('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x48ea('0x2')]},'timeout':{'type':Sequelize[_0x48ea('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48ea('0x4')](_0x48ea('0x5'),'beepall',_0x48ea('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x48ea('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 9128604..34102a2 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 _0xaa15=['filter','merge','VIRTUAL','options','includeAll','FaxQueue','findAll','catch','show','params','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','sort','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','getAgents','findOne','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick'];(function(_0x48f8ad,_0xdd2ae0){var _0xf932f5=function(_0x92e8ee){while(--_0x92e8ee){_0x48f8ad['push'](_0x48f8ad['shift']());}};_0xf932f5(++_0xdd2ae0);}(_0xaa15,0x1df));var _0x5aa1=function(_0x5b18ac,_0x1ef1b6){_0x5b18ac=_0x5b18ac-0x0;var _0x27638e=_0xaa15[_0x5b18ac];return _0x27638e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5aa1('0x0'));var zipdir=require(_0x5aa1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5aa1('0x2'));var moment=require(_0x5aa1('0x3'));var BPromise=require(_0x5aa1('0x4'));var Mustache=require(_0x5aa1('0x5'));var util=require(_0x5aa1('0x6'));var path=require('path');var sox=require(_0x5aa1('0x7'));var csv=require(_0x5aa1('0x8'));var ejs=require(_0x5aa1('0x9'));var fs=require('fs');var fs_extra=require(_0x5aa1('0xa'));var _=require(_0x5aa1('0xb'));var squel=require(_0x5aa1('0xc'));var crypto=require(_0x5aa1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5aa1('0xe'));var toCsv=require(_0x5aa1('0x8'));var querystring=require(_0x5aa1('0xf'));var Papa=require(_0x5aa1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5aa1('0x11'));var as=require(_0x5aa1('0x12'));var hardwareService=require(_0x5aa1('0x13'));var logger=require(_0x5aa1('0x14'))(_0x5aa1('0x15'));var utils=require(_0x5aa1('0x16'));var config=require(_0x5aa1('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5aa1('0x18')]=_[_0x5aa1('0x19')](config[_0x5aa1('0x18')],{'host':_0x5aa1('0x1a'),'port':0x18eb});var socket=require(_0x5aa1('0x1b'))(new Redis(config[_0x5aa1('0x18')]));require(_0x5aa1('0x1c'))['register'](socket);function respondWithStatusCode(_0x25f641,_0x5079ea){_0x5079ea=_0x5079ea||0xcc;return function(_0x5a073e){if(_0x5a073e){return _0x25f641[_0x5aa1('0x1d')](_0x5079ea);}return _0x25f641[_0x5aa1('0x1e')](_0x5079ea)[_0x5aa1('0x1f')]();};}function respondWithResult(_0x41dc89,_0x3fb948){_0x3fb948=_0x3fb948||0xc8;return function(_0x73c8e8){if(_0x73c8e8){return _0x41dc89[_0x5aa1('0x1e')](_0x3fb948)[_0x5aa1('0x20')](_0x73c8e8);}};}function respondWithFilteredResult(_0x37f92c,_0x432ebc){return function(_0x25a62e){if(_0x25a62e){var _0x36391e=typeof _0x432ebc[_0x5aa1('0x21')]===_0x5aa1('0x22')&&typeof _0x432ebc[_0x5aa1('0x23')]==='undefined';var _0x459a49=_0x25a62e['count'];var _0x480aeb=_0x36391e?0x0:_0x432ebc[_0x5aa1('0x21')];var _0x1852d9=_0x36391e?_0x25a62e[_0x5aa1('0x24')]:_0x432ebc[_0x5aa1('0x21')]+_0x432ebc[_0x5aa1('0x23')];var _0x391edb;if(_0x1852d9>=_0x459a49){_0x1852d9=_0x459a49;_0x391edb=0xc8;}else{_0x391edb=0xce;}_0x37f92c[_0x5aa1('0x1e')](_0x391edb);return _0x37f92c[_0x5aa1('0x25')]('Content-Range',_0x480aeb+'-'+_0x1852d9+'/'+_0x459a49)['json'](_0x25a62e);}return null;};}function patchUpdates(_0x5610ad){return function(_0x3b9fab){try{jsonpatch[_0x5aa1('0x26')](_0x3b9fab,_0x5610ad,!![]);}catch(_0x258845){return BPromise[_0x5aa1('0x27')](_0x258845);}return _0x3b9fab[_0x5aa1('0x28')]();};}function saveUpdates(_0x2b4b89,_0x55cb87){return function(_0x408ea3){if(_0x408ea3){return _0x408ea3[_0x5aa1('0x29')](_0x2b4b89)[_0x5aa1('0x2a')](function(_0x5e9494){return _0x5e9494;});}return null;};}function removeEntity(_0x3f23cf,_0x2b27cb){return function(_0x51d183){if(_0x51d183){return _0x51d183[_0x5aa1('0x2b')]()[_0x5aa1('0x2a')](function(){var _0x515e56=_0x51d183[_0x5aa1('0x2c')]({'plain':!![]});var _0x3109c7='FaxQueues';return db['UserProfileResource'][_0x5aa1('0x2b')]({'where':{'type':_0x3109c7,'resourceId':_0x515e56['id']}})[_0x5aa1('0x2a')](function(){return _0x51d183;});})['then'](function(){_0x3f23cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x256d7f,_0x3fe1ea){return function(_0x37c615){if(!_0x37c615){_0x256d7f['sendStatus'](0x194);}return _0x37c615;};}function handleError(_0x1465a6,_0x2db3ad){_0x2db3ad=_0x2db3ad||0x1f4;return function(_0x5987d2){logger[_0x5aa1('0x2d')](_0x5987d2[_0x5aa1('0x2e')]);if(_0x5987d2[_0x5aa1('0x2f')]){delete _0x5987d2[_0x5aa1('0x2f')];}_0x1465a6[_0x5aa1('0x1e')](_0x2db3ad)['send'](_0x5987d2);};}exports[_0x5aa1('0x30')]=function(_0x52a43c,_0x2327d5){var _0x186f67={},_0x5e7b5f={},_0x33273b={'count':0x0,'rows':[]};var _0x520fe0=_[_0x5aa1('0x31')](db['FaxQueue'][_0x5aa1('0x32')],function(_0xb118eb){return{'name':_0xb118eb[_0x5aa1('0x33')],'type':_0xb118eb[_0x5aa1('0x34')]['key']};});_0x5e7b5f[_0x5aa1('0x35')]=_['map'](_0x520fe0,_0x5aa1('0x2f'));_0x5e7b5f[_0x5aa1('0x36')]=_[_0x5aa1('0x37')](_0x52a43c[_0x5aa1('0x36')]);_0x5e7b5f[_0x5aa1('0x38')]=_['intersection'](_0x5e7b5f[_0x5aa1('0x35')],_0x5e7b5f[_0x5aa1('0x36')]);_0x186f67[_0x5aa1('0x39')]=_['intersection'](_0x5e7b5f[_0x5aa1('0x35')],qs['fields'](_0x52a43c[_0x5aa1('0x36')][_0x5aa1('0x3a')]));_0x186f67['attributes']=_0x186f67[_0x5aa1('0x39')][_0x5aa1('0x3b')]?_0x186f67[_0x5aa1('0x39')]:_0x5e7b5f[_0x5aa1('0x35')];if(!_0x52a43c['query'][_0x5aa1('0x3c')](_0x5aa1('0x3d'))){_0x186f67[_0x5aa1('0x23')]=qs['limit'](_0x52a43c['query'][_0x5aa1('0x23')]);_0x186f67['offset']=qs[_0x5aa1('0x21')](_0x52a43c[_0x5aa1('0x36')]['offset']);}_0x186f67[_0x5aa1('0x3e')]=qs['sort'](_0x52a43c['query']['sort']);_0x186f67[_0x5aa1('0x3f')]=qs[_0x5aa1('0x38')](_[_0x5aa1('0x40')](_0x52a43c[_0x5aa1('0x36')],_0x5e7b5f['filters']),_0x520fe0);if(_0x52a43c[_0x5aa1('0x36')][_0x5aa1('0x41')]){_0x186f67[_0x5aa1('0x3f')]=_[_0x5aa1('0x42')](_0x186f67['where'],{'$or':_[_0x5aa1('0x31')](_0x520fe0,function(_0x1176e4){if(_0x1176e4['type']!==_0x5aa1('0x43')){var _0x14ec9b={};_0x14ec9b[_0x1176e4[_0x5aa1('0x2f')]]={'$like':'%'+_0x52a43c['query'][_0x5aa1('0x41')]+'%'};return _0x14ec9b;}})});}_0x186f67=_[_0x5aa1('0x42')]({},_0x186f67,_0x52a43c[_0x5aa1('0x44')]);var _0x955c2b={'where':_0x186f67['where']};return db['FaxQueue'][_0x5aa1('0x24')](_0x955c2b)[_0x5aa1('0x2a')](function(_0x44c676){_0x33273b['count']=_0x44c676;if(_0x52a43c[_0x5aa1('0x36')][_0x5aa1('0x45')]){_0x186f67['include']=[{'all':!![]}];}return db[_0x5aa1('0x46')][_0x5aa1('0x47')](_0x186f67);})['then'](function(_0x4bdaed){_0x33273b['rows']=_0x4bdaed;return _0x33273b;})['then'](respondWithFilteredResult(_0x2327d5,_0x186f67))[_0x5aa1('0x48')](handleError(_0x2327d5,null));};exports[_0x5aa1('0x49')]=function(_0x554e91,_0x249e5c){var _0x335e17={'raw':!![],'where':{'id':_0x554e91[_0x5aa1('0x4a')]['id']}},_0x643836={};_0x643836[_0x5aa1('0x35')]=_[_0x5aa1('0x37')](db['FaxQueue']['rawAttributes']);_0x643836['query']=_[_0x5aa1('0x37')](_0x554e91['query']);_0x643836[_0x5aa1('0x38')]=_[_0x5aa1('0x4b')](_0x643836['model'],_0x643836[_0x5aa1('0x36')]);_0x335e17[_0x5aa1('0x39')]=_[_0x5aa1('0x4b')](_0x643836['model'],qs[_0x5aa1('0x3a')](_0x554e91['query'][_0x5aa1('0x3a')]));_0x335e17[_0x5aa1('0x39')]=_0x335e17[_0x5aa1('0x39')][_0x5aa1('0x3b')]?_0x335e17[_0x5aa1('0x39')]:_0x643836[_0x5aa1('0x35')];if(_0x554e91[_0x5aa1('0x36')][_0x5aa1('0x45')]){_0x335e17[_0x5aa1('0x4c')]=[{'all':!![]}];}_0x335e17=_[_0x5aa1('0x42')]({},_0x335e17,_0x554e91[_0x5aa1('0x44')]);return db[_0x5aa1('0x46')][_0x5aa1('0x4d')](_0x335e17)[_0x5aa1('0x2a')](handleEntityNotFound(_0x249e5c,null))[_0x5aa1('0x2a')](respondWithResult(_0x249e5c,null))[_0x5aa1('0x48')](handleError(_0x249e5c,null));};exports[_0x5aa1('0x4e')]=function(_0xecd289,_0x132c91){return db[_0x5aa1('0x46')][_0x5aa1('0x4e')](_0xecd289[_0x5aa1('0x4f')],{})[_0x5aa1('0x2a')](function(_0x23be3d){var _0x4cdc99=_0xecd289[_0x5aa1('0x50')][_0x5aa1('0x2c')]({'plain':!![]});if(!_0x4cdc99)throw new Error(_0x5aa1('0x51'));if(_0x4cdc99[_0x5aa1('0x52')]==='user'){var _0xf49a82=_0x23be3d['get']({'plain':!![]});var _0xd87dd8='FaxQueues';return db[_0x5aa1('0x53')][_0x5aa1('0x4d')]({'where':{'name':_0xd87dd8,'userProfileId':_0x4cdc99['userProfileId']},'raw':!![]})[_0x5aa1('0x2a')](function(_0x51f4ec){if(_0x51f4ec&&_0x51f4ec[_0x5aa1('0x54')]===0x0){return db[_0x5aa1('0x55')][_0x5aa1('0x4e')]({'name':_0xf49a82[_0x5aa1('0x2f')],'resourceId':_0xf49a82['id'],'type':_0x51f4ec[_0x5aa1('0x2f')],'sectionId':_0x51f4ec['id']},{})[_0x5aa1('0x2a')](function(){return _0x23be3d;});}else{return _0x23be3d;}})[_0x5aa1('0x48')](function(_0x203845){logger[_0x5aa1('0x2d')](_0x5aa1('0x56'),_0x203845);throw _0x203845;});}return _0x23be3d;})[_0x5aa1('0x2a')](respondWithResult(_0x132c91,0xc9))[_0x5aa1('0x48')](handleError(_0x132c91,null));};exports[_0x5aa1('0x29')]=function(_0x1a2441,_0x2bedcd){if(_0x1a2441[_0x5aa1('0x4f')]['id']){delete _0x1a2441['body']['id'];}return db[_0x5aa1('0x46')][_0x5aa1('0x4d')]({'where':{'id':_0x1a2441[_0x5aa1('0x4a')]['id']}})[_0x5aa1('0x2a')](handleEntityNotFound(_0x2bedcd,null))[_0x5aa1('0x2a')](saveUpdates(_0x1a2441[_0x5aa1('0x4f')],null))[_0x5aa1('0x2a')](respondWithResult(_0x2bedcd,null))[_0x5aa1('0x48')](handleError(_0x2bedcd,null));};exports[_0x5aa1('0x2b')]=function(_0x2794f8,_0x2a0c6d){return db[_0x5aa1('0x46')]['find']({'where':{'id':_0x2794f8[_0x5aa1('0x4a')]['id']}})[_0x5aa1('0x2a')](handleEntityNotFound(_0x2a0c6d,null))[_0x5aa1('0x2a')](removeEntity(_0x2a0c6d,null))[_0x5aa1('0x48')](handleError(_0x2a0c6d,null));};exports[_0x5aa1('0x57')]=function(_0x17d3cf,_0xda0c16){return db[_0x5aa1('0x46')][_0x5aa1('0x57')]()['then'](respondWithResult(_0xda0c16,null))['catch'](handleError(_0xda0c16,null));};exports['getMembers']=function(_0x739752,_0x7499bd,_0x5f48e5){var _0x437613={'raw':!![],'where':{}},_0x4560f2={},_0x521730;return db[_0x5aa1('0x46')]['findOne']({'where':{'id':_0x739752['params']['id']}})[_0x5aa1('0x2a')](handleEntityNotFound(_0x7499bd,null))['then'](function(_0x49e9d6){if(_0x49e9d6){_0x521730=_0x49e9d6[_0x5aa1('0x2c')]({'plain':!![]});_0x4560f2['model']=_[_0x5aa1('0x37')](db[_0x5aa1('0x58')][_0x5aa1('0x32')]);_0x4560f2[_0x5aa1('0x36')]=_[_0x5aa1('0x37')](_0x739752[_0x5aa1('0x36')]);_0x4560f2[_0x5aa1('0x38')]=_['intersection'](_0x4560f2[_0x5aa1('0x35')],_0x4560f2[_0x5aa1('0x36')]);_0x437613[_0x5aa1('0x39')]=_['intersection'](_0x4560f2[_0x5aa1('0x35')],qs[_0x5aa1('0x3a')](_0x739752['query'][_0x5aa1('0x3a')]));_0x437613[_0x5aa1('0x39')]=_0x437613['attributes'][_0x5aa1('0x3b')]?_0x437613['attributes']:_0x4560f2[_0x5aa1('0x35')];if(!_0x739752[_0x5aa1('0x36')][_0x5aa1('0x3c')](_0x5aa1('0x3d'))){_0x437613['limit']=qs[_0x5aa1('0x23')](_0x739752[_0x5aa1('0x36')][_0x5aa1('0x23')]);_0x437613[_0x5aa1('0x21')]=qs[_0x5aa1('0x21')](_0x739752[_0x5aa1('0x36')][_0x5aa1('0x21')]);}_0x437613['order']=qs['sort'](_0x739752[_0x5aa1('0x36')][_0x5aa1('0x59')]);_0x437613[_0x5aa1('0x3f')]=qs['filters'](_[_0x5aa1('0x40')](_0x739752[_0x5aa1('0x36')],_0x4560f2[_0x5aa1('0x38')]));_0x437613[_0x5aa1('0x3f')][_0x5aa1('0x5a')]=_0x49e9d6['id'];if(_0x739752[_0x5aa1('0x36')][_0x5aa1('0x41')]){_0x437613[_0x5aa1('0x3f')]=_['merge'](_0x437613[_0x5aa1('0x3f')],{'$or':_[_0x5aa1('0x31')](_0x437613[_0x5aa1('0x39')],function(_0x3f3835){var _0x124e28={};_0x124e28[_0x3f3835]={'$like':'%'+_0x739752['query'][_0x5aa1('0x41')]+'%'};return _0x124e28;})});}_0x437613=_[_0x5aa1('0x42')]({},_0x437613,_0x739752['options']);return db[_0x5aa1('0x58')][_0x5aa1('0x47')](_0x437613);}})[_0x5aa1('0x2a')](function(_0x3929c3){if(_0x3929c3){return db[_0x5aa1('0x5b')][_0x5aa1('0x5c')]({'where':{'id':_['map'](_0x3929c3,_0x5aa1('0x5d')),'role':_0x5aa1('0x5e')},'attributes':['id',_0x5aa1('0x2f'),_0x5aa1('0x5f'),_0x5aa1('0x60'),'createdAt']});}})[_0x5aa1('0x2a')](function(_0x45ffac){if(_0x45ffac){return{'count':_0x45ffac[_0x5aa1('0x24')],'rows':_[_0x5aa1('0x31')](_0x45ffac[_0x5aa1('0x61')],function(_0x58c089){return{'membername':_0x58c089[_0x5aa1('0x2f')],'UserId':_0x58c089['id'],'queue_name':_0x521730['name'],'FaxQueueId':_0x521730['id'],'interface':util[_0x5aa1('0x62')]('%s/%s',_0x5aa1('0x63'),_0x58c089[_0x5aa1('0x2f')]),'penalty':0x0,'paused':_0x58c089[_0x5aa1('0x5f')],'createdAt':_0x58c089['createdAt'],'updatedAt':_0x58c089[_0x5aa1('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5aa1('0x2a')](respondWithFilteredResult(_0x7499bd,_0x437613))[_0x5aa1('0x48')](handleError(_0x7499bd,null));};exports[_0x5aa1('0x64')]=function(_0x17472e,_0x1f3ead,_0xfbdb79){var _0x21bb44={};var _0x58d35b={};var _0x2ad095;var _0x4ab9ed;return db[_0x5aa1('0x46')]['findOne']({'where':{'id':_0x17472e[_0x5aa1('0x4a')]['id']}})[_0x5aa1('0x2a')](handleEntityNotFound(_0x1f3ead,null))[_0x5aa1('0x2a')](function(_0x19116f){if(_0x19116f){_0x2ad095=_0x19116f;_0x58d35b[_0x5aa1('0x35')]=_['keys'](db[_0x5aa1('0x65')]['rawAttributes']);_0x58d35b[_0x5aa1('0x36')]=_['keys'](_0x17472e['query']);_0x58d35b['filters']=_['intersection'](_0x58d35b[_0x5aa1('0x35')],_0x58d35b['query']);_0x21bb44[_0x5aa1('0x39')]=_['intersection'](_0x58d35b[_0x5aa1('0x35')],qs[_0x5aa1('0x3a')](_0x17472e[_0x5aa1('0x36')][_0x5aa1('0x3a')]));_0x21bb44[_0x5aa1('0x39')]=_0x21bb44[_0x5aa1('0x39')][_0x5aa1('0x3b')]?_0x21bb44[_0x5aa1('0x39')]:_0x58d35b[_0x5aa1('0x35')];_0x21bb44['order']=qs['sort'](_0x17472e[_0x5aa1('0x36')]['sort']);_0x21bb44['where']=qs[_0x5aa1('0x38')](_[_0x5aa1('0x40')](_0x17472e[_0x5aa1('0x36')],_0x58d35b[_0x5aa1('0x38')]));if(_0x17472e[_0x5aa1('0x36')][_0x5aa1('0x41')]){_0x21bb44[_0x5aa1('0x3f')]=_[_0x5aa1('0x42')](_0x21bb44[_0x5aa1('0x3f')],{'$or':_['map'](_0x21bb44[_0x5aa1('0x39')],function(_0x197040){var _0x225438={};_0x225438[_0x197040]={'$like':'%'+_0x17472e[_0x5aa1('0x36')][_0x5aa1('0x41')]+'%'};return _0x225438;})});}_0x21bb44=_['merge']({},_0x21bb44,_0x17472e[_0x5aa1('0x44')]);return _0x2ad095[_0x5aa1('0x64')](_0x21bb44);}})['then'](function(_0x179888){if(_0x179888){_0x4ab9ed=_0x179888[_0x5aa1('0x3b')];if(!_0x17472e['query'][_0x5aa1('0x3c')](_0x5aa1('0x3d'))){_0x21bb44['limit']=qs['limit'](_0x17472e['query'][_0x5aa1('0x23')]);_0x21bb44[_0x5aa1('0x21')]=qs[_0x5aa1('0x21')](_0x17472e['query'][_0x5aa1('0x21')]);}return _0x2ad095[_0x5aa1('0x64')](_0x21bb44);}})[_0x5aa1('0x2a')](function(_0x1e5348){if(_0x1e5348){return _0x1e5348?{'count':_0x4ab9ed,'rows':_0x1e5348}:null;}})['then'](respondWithResult(_0x1f3ead,null))[_0x5aa1('0x48')](handleError(_0x1f3ead,null));};exports[_0x5aa1('0x66')]=function(_0x3e8d75,_0x4fbed0,_0x137c79){var _0x4d53b4=_0x3e8d75[_0x5aa1('0x4f')][_0x5aa1('0x67')];return db[_0x5aa1('0x65')]['findAll']({'where':{'id':_0x4d53b4},'attributes':['id'],'include':[{'model':db[_0x5aa1('0x5b')],'as':_0x5aa1('0x68'),'attributes':['id',_0x5aa1('0x2f'),'online','voicePause',_0x5aa1('0x69')],'raw':!![]}]})[_0x5aa1('0x2a')](function(_0x29a0fe){if(_0x29a0fe){var _0x3890ab=_['flatMap'](_0x29a0fe,function(_0xc41ec7){var _0x2ae16f=_0xc41ec7[_0x5aa1('0x2c')]({'plain':!![]});return _0x2ae16f[_0x5aa1('0x68')];});return db[_0x5aa1('0x46')]['find']({'where':{'id':_0x3e8d75['params']['id']}})[_0x5aa1('0x2a')](function(_0x3d76b3){return db[_0x5aa1('0x6a')][_0x5aa1('0x6b')](function(_0x3463a0){return _0x3d76b3['addTeams'](_0x4d53b4,{'transaction':_0x3463a0})[_0x5aa1('0x2a')](function(){return BPromise[_0x5aa1('0x6c')](_0x3890ab,function(_0x42d9e7){return db['UserFaxQueue'][_0x5aa1('0x6d')]({'where':{'UserId':_0x42d9e7['id'],'FaxQueueId':_0x3e8d75['params']['id']},'transaction':_0x3463a0});});})['then'](function(){_0x3890ab[_0x5aa1('0x6e')](function(_0x2b8e29){socket[_0x5aa1('0x6f')](_0x5aa1('0x70'),{'UserId':_0x2b8e29['id'],'FaxQueueId':_0x3d76b3['id']});});});});});}})['then'](respondWithStatusCode(_0x4fbed0,null))[_0x5aa1('0x48')](handleError(_0x4fbed0,null));};exports['removeTeams']=function(_0x429fdd,_0x451ad7,_0x558af3){return db[_0x5aa1('0x65')][_0x5aa1('0x47')]({'where':{'id':_0x429fdd[_0x5aa1('0x36')][_0x5aa1('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5aa1('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x451ad7,null))['then'](function(_0x30e343){var _0x2eff6f=_[_0x5aa1('0x31')](_0x30e343,'id');var _0xbac4cc=[];var _0x4f27b3=[];var _0x225c38=squel[_0x5aa1('0x71')]();_0x225c38[_0x5aa1('0x72')]('tq.TeamId')[_0x5aa1('0x73')]('team_has_fax_queues','tq')[_0x5aa1('0x74')](_0x5aa1('0x75'),'ut',_0x5aa1('0x76'))[_0x5aa1('0x3f')](_0x5aa1('0x77'),_0x429fdd[_0x5aa1('0x4a')]['id']);for(var _0x5129bd=0x0;_0x5129bd<_0x30e343[_0x5aa1('0x3b')];_0x5129bd+=0x1){let _0x3726c5=_0x30e343[_0x5129bd];for(var _0x55c42f=0x0;_0x55c42f<_0x3726c5['Agents'][_0x5aa1('0x3b')];_0x55c42f+=0x1){let _0x3bedcd=_0x3726c5[_0x5aa1('0x68')][_0x55c42f];var _0x299f0a=_0x225c38[_0x5aa1('0x78')]();_0x299f0a['where'](_0x5aa1('0x79'),_0x3bedcd['id']);_0x4f27b3['push'](db['sequelize'][_0x5aa1('0x36')](_0x299f0a['toString'](),{'type':db[_0x5aa1('0x6a')][_0x5aa1('0x7a')][_0x5aa1('0x7b')]})['then'](function(_0x52e15a){if(_0x52e15a['length']===0x1){return _0x3bedcd['id'];}else{var _0xbceef7=_[_0x5aa1('0x7c')](_[_0x5aa1('0x31')](_0x52e15a,_0x5aa1('0x7d')),function(_0x3906b7){return _[_0x5aa1('0x7e')](_0x2eff6f,_0x3906b7);});if(_0xbceef7){return _0x3bedcd['id'];}}}));}}return BPromise['all'](_0x4f27b3)[_0x5aa1('0x2a')](function(_0xbdb777){_0xbac4cc=_(_0xbac4cc)[_0x5aa1('0x7f')](_0xbdb777)['compact']()[_0x5aa1('0x80')]();return db['FaxQueue']['find']({'where':{'id':_0x429fdd[_0x5aa1('0x4a')]['id']}})[_0x5aa1('0x2a')](function(_0x309e74){return db[_0x5aa1('0x6a')][_0x5aa1('0x6b')](function(_0x495748){return _0x309e74['removeTeams'](_0x429fdd[_0x5aa1('0x36')][_0x5aa1('0x67')],{'transaction':_0x495748})[_0x5aa1('0x2a')](function(){if(!_[_0x5aa1('0x81')](_0xbac4cc)){return _0x309e74[_0x5aa1('0x82')](_0xbac4cc,{'transaction':_0x495748});}})[_0x5aa1('0x2a')](function(){_0xbac4cc[_0x5aa1('0x6e')](function(_0x5d168f){socket[_0x5aa1('0x6f')](_0x5aa1('0x83'),{'UserId':_0x5d168f,'FaxQueueId':_0x309e74['id']});});});});});});})['then'](respondWithStatusCode(_0x451ad7,null))[_0x5aa1('0x48')](handleError(_0x451ad7,null));};exports[_0x5aa1('0x84')]=function(_0x4a53f9,_0x350f7a,_0x220b18){return db[_0x5aa1('0x46')][_0x5aa1('0x4d')]({'where':{'id':_0x4a53f9[_0x5aa1('0x4a')]['id']}})[_0x5aa1('0x2a')](handleEntityNotFound(_0x350f7a,null))[_0x5aa1('0x2a')](function(_0x200c0e){if(_0x200c0e){return _0x200c0e[_0x5aa1('0x84')](_0x4a53f9[_0x5aa1('0x4f')][_0x5aa1('0x67')],_[_0x5aa1('0x85')](_0x4a53f9[_0x5aa1('0x4f')],[_0x5aa1('0x67'),'id'])||{})['spread'](function(_0x1a94fb){for(var _0x5b7d6c=0x0;_0x5b7d6c<_0x4a53f9[_0x5aa1('0x4f')]['ids']['length'];_0x5b7d6c+=0x1){socket[_0x5aa1('0x6f')](_0x5aa1('0x70'),{'UserId':Number(_0x4a53f9['body']['ids'][_0x5b7d6c]),'FaxQueueId':Number(_0x4a53f9[_0x5aa1('0x4a')]['id'])});}return _0x1a94fb;});}})[_0x5aa1('0x2a')](respondWithResult(_0x350f7a,null))[_0x5aa1('0x48')](handleError(_0x350f7a,null));};exports[_0x5aa1('0x82')]=function(_0x220a1c,_0x34b99a,_0x2a3fa3){return db[_0x5aa1('0x46')][_0x5aa1('0x4d')]({'where':{'id':_0x220a1c['params']['id']}})['then'](handleEntityNotFound(_0x34b99a,null))[_0x5aa1('0x2a')](function(_0x47c0cd){if(_0x47c0cd){return _0x47c0cd[_0x5aa1('0x82')](_0x220a1c[_0x5aa1('0x36')][_0x5aa1('0x67')])[_0x5aa1('0x2a')](function(){if(_['isArray'](_0x220a1c['query']['ids'])){for(var _0xda12b3=0x0;_0xda12b3<_0x220a1c[_0x5aa1('0x36')][_0x5aa1('0x67')][_0x5aa1('0x3b')];_0xda12b3+=0x1){socket[_0x5aa1('0x6f')](_0x5aa1('0x83'),{'UserId':Number(_0x220a1c[_0x5aa1('0x36')][_0x5aa1('0x67')][_0xda12b3]),'FaxQueueId':Number(_0x220a1c[_0x5aa1('0x4a')]['id'])});}}else{socket[_0x5aa1('0x6f')](_0x5aa1('0x83'),{'UserId':Number(_0x220a1c['query']['ids']),'FaxQueueId':Number(_0x220a1c[_0x5aa1('0x4a')]['id'])});}});}})[_0x5aa1('0x2a')](respondWithStatusCode(_0x34b99a,null))[_0x5aa1('0x48')](handleError(_0x34b99a,null));};exports[_0x5aa1('0x86')]=function(_0xa11078,_0x1d5461,_0x10a804){var _0x276637={};var _0x2fc6a1={};var _0x1f23ee;var _0xccae63;return db[_0x5aa1('0x46')][_0x5aa1('0x87')]({'where':{'id':_0xa11078[_0x5aa1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d5461,null))['then'](function(_0x423785){if(_0x423785){_0x1f23ee=_0x423785;_0x2fc6a1[_0x5aa1('0x35')]=_['keys'](db['User']['rawAttributes']);_0x2fc6a1['query']=_[_0x5aa1('0x37')](_0xa11078[_0x5aa1('0x36')]);_0x2fc6a1[_0x5aa1('0x38')]=_[_0x5aa1('0x4b')](_0x2fc6a1[_0x5aa1('0x35')],_0x2fc6a1['query']);_0x276637[_0x5aa1('0x39')]=_[_0x5aa1('0x4b')](_0x2fc6a1['model'],qs[_0x5aa1('0x3a')](_0xa11078[_0x5aa1('0x36')]['fields']));_0x276637['attributes']=_0x276637[_0x5aa1('0x39')][_0x5aa1('0x3b')]?_0x276637[_0x5aa1('0x39')]:_0x2fc6a1[_0x5aa1('0x35')];_0x276637[_0x5aa1('0x3e')]=qs[_0x5aa1('0x59')](_0xa11078['query'][_0x5aa1('0x59')]);_0x276637['where']=qs[_0x5aa1('0x38')](_[_0x5aa1('0x40')](_0xa11078[_0x5aa1('0x36')],_0x2fc6a1[_0x5aa1('0x38')]));if(_0xa11078[_0x5aa1('0x36')][_0x5aa1('0x41')]){_0x276637[_0x5aa1('0x3f')]=_[_0x5aa1('0x42')](_0x276637[_0x5aa1('0x3f')],{'$or':_[_0x5aa1('0x31')](_0x276637['attributes'],function(_0x19db4){var _0x10c9e9={};_0x10c9e9[_0x19db4]={'$like':'%'+_0xa11078['query'][_0x5aa1('0x41')]+'%'};return _0x10c9e9;})});}_0x276637=_[_0x5aa1('0x42')]({},_0x276637,_0xa11078['options']);return _0x1f23ee['getAgents'](_0x276637);}})[_0x5aa1('0x2a')](function(_0x1953c6){if(_0x1953c6){_0xccae63=_0x1953c6[_0x5aa1('0x3b')];if(!_0xa11078[_0x5aa1('0x36')]['hasOwnProperty']('nolimit')){_0x276637[_0x5aa1('0x23')]=qs['limit'](_0xa11078['query']['limit']);_0x276637[_0x5aa1('0x21')]=qs[_0x5aa1('0x21')](_0xa11078['query']['offset']);}return _0x1f23ee[_0x5aa1('0x86')](_0x276637);}})[_0x5aa1('0x2a')](function(_0x4d4d48){if(_0x4d4d48){return _0x4d4d48?{'count':_0xccae63,'rows':_0x4d4d48}:null;}})['then'](respondWithResult(_0x1d5461,null))[_0x5aa1('0x48')](handleError(_0x1d5461,null));}; \ No newline at end of file +var _0xde35=['offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','user','get','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','nolimit','order','FaxQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','faxPause','getTeams','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','userFaxQueue:save','removeTeams','field','join','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','includes','all','compact','value','transaction','ids','isEmpty','forEach','emit','userFaxQueue:remove','addAgents','omit','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json'];(function(_0xcc4673,_0x1de536){var _0x2f86aa=function(_0x1139d3){while(--_0x1139d3){_0xcc4673['push'](_0xcc4673['shift']());}};_0x2f86aa(++_0x1de536);}(_0xde35,0x17a));var _0x5de3=function(_0x231223,_0x39b615){_0x231223=_0x231223-0x0;var _0x4b5fdb=_0xde35[_0x231223];return _0x4b5fdb;};'use strict';var emlformat=require(_0x5de3('0x0'));var rimraf=require(_0x5de3('0x1'));var zipdir=require(_0x5de3('0x2'));var jsonpatch=require(_0x5de3('0x3'));var rp=require('request-promise');var moment=require(_0x5de3('0x4'));var BPromise=require(_0x5de3('0x5'));var Mustache=require(_0x5de3('0x6'));var util=require(_0x5de3('0x7'));var path=require(_0x5de3('0x8'));var sox=require(_0x5de3('0x9'));var csv=require(_0x5de3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5de3('0xb'));var squel=require(_0x5de3('0xc'));var crypto=require('crypto');var jsforce=require(_0x5de3('0xd'));var deskjs=require(_0x5de3('0xe'));var toCsv=require(_0x5de3('0xa'));var querystring=require(_0x5de3('0xf'));var Papa=require('papaparse');var Redis=require(_0x5de3('0x10'));var authService=require(_0x5de3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5de3('0x12'));var hardwareService=require(_0x5de3('0x13'));var logger=require(_0x5de3('0x14'))(_0x5de3('0x15'));var utils=require(_0x5de3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5de3('0x17'));var db=require(_0x5de3('0x18'))['db'];config[_0x5de3('0x19')]=_[_0x5de3('0x1a')](config[_0x5de3('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5de3('0x1b'))(new Redis(config['redis']));require(_0x5de3('0x1c'))['register'](socket);function respondWithStatusCode(_0x518cd6,_0x384b9f){_0x384b9f=_0x384b9f||0xcc;return function(_0x17dce7){if(_0x17dce7){return _0x518cd6[_0x5de3('0x1d')](_0x384b9f);}return _0x518cd6[_0x5de3('0x1e')](_0x384b9f)[_0x5de3('0x1f')]();};}function respondWithResult(_0x53f17b,_0x3afc9f){_0x3afc9f=_0x3afc9f||0xc8;return function(_0x198057){if(_0x198057){return _0x53f17b[_0x5de3('0x1e')](_0x3afc9f)[_0x5de3('0x20')](_0x198057);}};}function respondWithFilteredResult(_0x38690e,_0x4fc3b2){return function(_0x3e11cc){if(_0x3e11cc){var _0x6e769e=typeof _0x4fc3b2[_0x5de3('0x21')]===_0x5de3('0x22')&&typeof _0x4fc3b2[_0x5de3('0x23')]===_0x5de3('0x22');var _0x4ec700=_0x3e11cc[_0x5de3('0x24')];var _0x465a4e=_0x6e769e?0x0:_0x4fc3b2['offset'];var _0x209305=_0x6e769e?_0x3e11cc[_0x5de3('0x24')]:_0x4fc3b2['offset']+_0x4fc3b2[_0x5de3('0x23')];var _0x25a332;if(_0x209305>=_0x4ec700){_0x209305=_0x4ec700;_0x25a332=0xc8;}else{_0x25a332=0xce;}_0x38690e[_0x5de3('0x1e')](_0x25a332);return _0x38690e[_0x5de3('0x25')](_0x5de3('0x26'),_0x465a4e+'-'+_0x209305+'/'+_0x4ec700)['json'](_0x3e11cc);}return null;};}function patchUpdates(_0x3f5ef6){return function(_0x2bbe7e){try{jsonpatch[_0x5de3('0x27')](_0x2bbe7e,_0x3f5ef6,!![]);}catch(_0x71ee50){return BPromise[_0x5de3('0x28')](_0x71ee50);}return _0x2bbe7e['save']();};}function saveUpdates(_0x194699,_0x3c3976){return function(_0x32f68f){if(_0x32f68f){return _0x32f68f['update'](_0x194699)[_0x5de3('0x29')](function(_0x4a1e81){return _0x4a1e81;});}return null;};}function removeEntity(_0x38f36d,_0x3033e7){return function(_0x3ea318){if(_0x3ea318){return _0x3ea318['destroy']()[_0x5de3('0x29')](function(){var _0x5413ab=_0x3ea318['get']({'plain':!![]});var _0xbe56aa='FaxQueues';return db['UserProfileResource'][_0x5de3('0x2a')]({'where':{'type':_0xbe56aa,'resourceId':_0x5413ab['id']}})['then'](function(){return _0x3ea318;});})[_0x5de3('0x29')](function(){_0x38f36d[_0x5de3('0x1e')](0xcc)[_0x5de3('0x1f')]();});}};}function handleEntityNotFound(_0x164dcd,_0xc274de){return function(_0x2374f5){if(!_0x2374f5){_0x164dcd[_0x5de3('0x1d')](0x194);}return _0x2374f5;};}function handleError(_0x115d77,_0x37b6f8){_0x37b6f8=_0x37b6f8||0x1f4;return function(_0x33bac0){logger['error'](_0x33bac0[_0x5de3('0x2b')]);if(_0x33bac0[_0x5de3('0x2c')]){delete _0x33bac0[_0x5de3('0x2c')];}_0x115d77[_0x5de3('0x1e')](_0x37b6f8)[_0x5de3('0x2d')](_0x33bac0);};}exports[_0x5de3('0x2e')]=function(_0x194255,_0x44efac){var _0x51a57e={},_0x17d63c={},_0x181fab={'count':0x0,'rows':[]};var _0x45ba6a=_[_0x5de3('0x2f')](db[_0x5de3('0x30')][_0x5de3('0x31')],function(_0x47c27e){return{'name':_0x47c27e[_0x5de3('0x32')],'type':_0x47c27e[_0x5de3('0x33')]['key']};});_0x17d63c[_0x5de3('0x34')]=_[_0x5de3('0x2f')](_0x45ba6a,_0x5de3('0x2c'));_0x17d63c['query']=_[_0x5de3('0x35')](_0x194255[_0x5de3('0x36')]);_0x17d63c[_0x5de3('0x37')]=_['intersection'](_0x17d63c[_0x5de3('0x34')],_0x17d63c[_0x5de3('0x36')]);_0x51a57e[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x17d63c[_0x5de3('0x34')],qs[_0x5de3('0x3a')](_0x194255[_0x5de3('0x36')][_0x5de3('0x3a')]));_0x51a57e['attributes']=_0x51a57e[_0x5de3('0x38')][_0x5de3('0x3b')]?_0x51a57e[_0x5de3('0x38')]:_0x17d63c[_0x5de3('0x34')];if(!_0x194255[_0x5de3('0x36')][_0x5de3('0x3c')]('nolimit')){_0x51a57e['limit']=qs['limit'](_0x194255['query']['limit']);_0x51a57e['offset']=qs[_0x5de3('0x21')](_0x194255[_0x5de3('0x36')][_0x5de3('0x21')]);}_0x51a57e['order']=qs['sort'](_0x194255['query'][_0x5de3('0x3d')]);_0x51a57e[_0x5de3('0x3e')]=qs[_0x5de3('0x37')](_[_0x5de3('0x3f')](_0x194255[_0x5de3('0x36')],_0x17d63c['filters']),_0x45ba6a);if(_0x194255[_0x5de3('0x36')][_0x5de3('0x40')]){_0x51a57e[_0x5de3('0x3e')]=_[_0x5de3('0x41')](_0x51a57e[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0x45ba6a,function(_0x22303b){if(_0x22303b[_0x5de3('0x33')]!==_0x5de3('0x42')){var _0x30fdc9={};_0x30fdc9[_0x22303b[_0x5de3('0x2c')]]={'$like':'%'+_0x194255['query'][_0x5de3('0x40')]+'%'};return _0x30fdc9;}})});}_0x51a57e=_[_0x5de3('0x41')]({},_0x51a57e,_0x194255['options']);var _0x108328={'where':_0x51a57e[_0x5de3('0x3e')]};return db[_0x5de3('0x30')][_0x5de3('0x24')](_0x108328)[_0x5de3('0x29')](function(_0x56f7d3){_0x181fab[_0x5de3('0x24')]=_0x56f7d3;if(_0x194255[_0x5de3('0x36')][_0x5de3('0x43')]){_0x51a57e[_0x5de3('0x44')]=[{'all':!![]}];}return db[_0x5de3('0x30')][_0x5de3('0x45')](_0x51a57e);})[_0x5de3('0x29')](function(_0x468b4e){_0x181fab['rows']=_0x468b4e;return _0x181fab;})[_0x5de3('0x29')](respondWithFilteredResult(_0x44efac,_0x51a57e))[_0x5de3('0x46')](handleError(_0x44efac,null));};exports[_0x5de3('0x47')]=function(_0x1b1ae3,_0x23d6b8){var _0x52e311={'raw':!![],'where':{'id':_0x1b1ae3[_0x5de3('0x48')]['id']}},_0x25e15c={};_0x25e15c[_0x5de3('0x34')]=_[_0x5de3('0x35')](db['FaxQueue'][_0x5de3('0x31')]);_0x25e15c[_0x5de3('0x36')]=_[_0x5de3('0x35')](_0x1b1ae3['query']);_0x25e15c['filters']=_[_0x5de3('0x39')](_0x25e15c['model'],_0x25e15c['query']);_0x52e311[_0x5de3('0x38')]=_['intersection'](_0x25e15c[_0x5de3('0x34')],qs[_0x5de3('0x3a')](_0x1b1ae3[_0x5de3('0x36')][_0x5de3('0x3a')]));_0x52e311[_0x5de3('0x38')]=_0x52e311[_0x5de3('0x38')][_0x5de3('0x3b')]?_0x52e311[_0x5de3('0x38')]:_0x25e15c[_0x5de3('0x34')];if(_0x1b1ae3['query'][_0x5de3('0x43')]){_0x52e311[_0x5de3('0x44')]=[{'all':!![]}];}_0x52e311=_[_0x5de3('0x41')]({},_0x52e311,_0x1b1ae3[_0x5de3('0x49')]);return db[_0x5de3('0x30')][_0x5de3('0x4a')](_0x52e311)['then'](handleEntityNotFound(_0x23d6b8,null))[_0x5de3('0x29')](respondWithResult(_0x23d6b8,null))[_0x5de3('0x46')](handleError(_0x23d6b8,null));};exports[_0x5de3('0x4b')]=function(_0x46215a,_0x87463b){return db[_0x5de3('0x30')]['create'](_0x46215a['body'],{})[_0x5de3('0x29')](function(_0xfa6668){var _0x38cdf1=_0x46215a[_0x5de3('0x4c')][_0x5de3('0x4d')]({'plain':!![]});if(!_0x38cdf1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38cdf1[_0x5de3('0x4e')]===_0x5de3('0x4c')){var _0xf5f995=_0xfa6668[_0x5de3('0x4d')]({'plain':!![]});var _0x22f824=_0x5de3('0x4f');return db[_0x5de3('0x50')][_0x5de3('0x4a')]({'where':{'name':_0x22f824,'userProfileId':_0x38cdf1[_0x5de3('0x51')]},'raw':!![]})[_0x5de3('0x29')](function(_0x288893){if(_0x288893&&_0x288893[_0x5de3('0x52')]===0x0){return db['UserProfileResource'][_0x5de3('0x4b')]({'name':_0xf5f995['name'],'resourceId':_0xf5f995['id'],'type':_0x288893['name'],'sectionId':_0x288893['id']},{})[_0x5de3('0x29')](function(){return _0xfa6668;});}else{return _0xfa6668;}})[_0x5de3('0x46')](function(_0x3ce955){logger[_0x5de3('0x53')](_0x5de3('0x54'),_0x3ce955);throw _0x3ce955;});}return _0xfa6668;})[_0x5de3('0x29')](respondWithResult(_0x87463b,0xc9))[_0x5de3('0x46')](handleError(_0x87463b,null));};exports[_0x5de3('0x55')]=function(_0x2172e8,_0x34f9c6){if(_0x2172e8[_0x5de3('0x56')]['id']){delete _0x2172e8[_0x5de3('0x56')]['id'];}return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x2172e8[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x34f9c6,null))[_0x5de3('0x29')](saveUpdates(_0x2172e8[_0x5de3('0x56')],null))[_0x5de3('0x29')](respondWithResult(_0x34f9c6,null))['catch'](handleError(_0x34f9c6,null));};exports[_0x5de3('0x2a')]=function(_0x2b4ef7,_0x570787){return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x2b4ef7[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x570787,null))[_0x5de3('0x29')](removeEntity(_0x570787,null))[_0x5de3('0x46')](handleError(_0x570787,null));};exports[_0x5de3('0x57')]=function(_0x38d56d,_0x224695){return db[_0x5de3('0x30')][_0x5de3('0x57')]()[_0x5de3('0x29')](respondWithResult(_0x224695,null))[_0x5de3('0x46')](handleError(_0x224695,null));};exports[_0x5de3('0x58')]=function(_0x3868df,_0x3d5e72,_0x120a3b){var _0x1eb563={'raw':!![],'where':{}},_0x540bef={},_0x40e78e;return db[_0x5de3('0x30')][_0x5de3('0x59')]({'where':{'id':_0x3868df[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x3d5e72,null))['then'](function(_0x2ba7ab){if(_0x2ba7ab){_0x40e78e=_0x2ba7ab['get']({'plain':!![]});_0x540bef[_0x5de3('0x34')]=_[_0x5de3('0x35')](db[_0x5de3('0x5a')][_0x5de3('0x31')]);_0x540bef['query']=_[_0x5de3('0x35')](_0x3868df[_0x5de3('0x36')]);_0x540bef[_0x5de3('0x37')]=_[_0x5de3('0x39')](_0x540bef['model'],_0x540bef[_0x5de3('0x36')]);_0x1eb563[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x540bef['model'],qs['fields'](_0x3868df[_0x5de3('0x36')][_0x5de3('0x3a')]));_0x1eb563[_0x5de3('0x38')]=_0x1eb563[_0x5de3('0x38')][_0x5de3('0x3b')]?_0x1eb563[_0x5de3('0x38')]:_0x540bef[_0x5de3('0x34')];if(!_0x3868df[_0x5de3('0x36')][_0x5de3('0x3c')](_0x5de3('0x5b'))){_0x1eb563[_0x5de3('0x23')]=qs[_0x5de3('0x23')](_0x3868df[_0x5de3('0x36')][_0x5de3('0x23')]);_0x1eb563[_0x5de3('0x21')]=qs[_0x5de3('0x21')](_0x3868df[_0x5de3('0x36')][_0x5de3('0x21')]);}_0x1eb563[_0x5de3('0x5c')]=qs['sort'](_0x3868df['query'][_0x5de3('0x3d')]);_0x1eb563[_0x5de3('0x3e')]=qs[_0x5de3('0x37')](_[_0x5de3('0x3f')](_0x3868df[_0x5de3('0x36')],_0x540bef[_0x5de3('0x37')]));_0x1eb563[_0x5de3('0x3e')][_0x5de3('0x5d')]=_0x2ba7ab['id'];if(_0x3868df[_0x5de3('0x36')][_0x5de3('0x40')]){_0x1eb563[_0x5de3('0x3e')]=_[_0x5de3('0x41')](_0x1eb563[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0x1eb563[_0x5de3('0x38')],function(_0x3bf7c9){var _0x53606a={};_0x53606a[_0x3bf7c9]={'$like':'%'+_0x3868df[_0x5de3('0x36')][_0x5de3('0x40')]+'%'};return _0x53606a;})});}_0x1eb563=_[_0x5de3('0x41')]({},_0x1eb563,_0x3868df[_0x5de3('0x49')]);return db[_0x5de3('0x5a')]['findAll'](_0x1eb563);}})[_0x5de3('0x29')](function(_0x272107){if(_0x272107){return db['User'][_0x5de3('0x5e')]({'where':{'id':_[_0x5de3('0x2f')](_0x272107,_0x5de3('0x5f')),'role':_0x5de3('0x60')},'attributes':['id',_0x5de3('0x2c'),'faxPause',_0x5de3('0x61'),_0x5de3('0x62')]});}})[_0x5de3('0x29')](function(_0x211e5e){if(_0x211e5e){return{'count':_0x211e5e[_0x5de3('0x24')],'rows':_[_0x5de3('0x2f')](_0x211e5e[_0x5de3('0x63')],function(_0x189730){return{'membername':_0x189730[_0x5de3('0x2c')],'UserId':_0x189730['id'],'queue_name':_0x40e78e[_0x5de3('0x2c')],'FaxQueueId':_0x40e78e['id'],'interface':util[_0x5de3('0x64')](_0x5de3('0x65'),'SIP',_0x189730['name']),'penalty':0x0,'paused':_0x189730[_0x5de3('0x66')],'createdAt':_0x189730['createdAt'],'updatedAt':_0x189730['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5de3('0x29')](respondWithFilteredResult(_0x3d5e72,_0x1eb563))[_0x5de3('0x46')](handleError(_0x3d5e72,null));};exports[_0x5de3('0x67')]=function(_0x47ee2c,_0x575b7a,_0xc41be6){var _0xe16033={};var _0x4da714={};var _0x26df73;var _0x4cc3cb;return db['FaxQueue'][_0x5de3('0x59')]({'where':{'id':_0x47ee2c[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x575b7a,null))[_0x5de3('0x29')](function(_0x53bb56){if(_0x53bb56){_0x26df73=_0x53bb56;_0x4da714[_0x5de3('0x34')]=_[_0x5de3('0x35')](db[_0x5de3('0x68')][_0x5de3('0x31')]);_0x4da714[_0x5de3('0x36')]=_[_0x5de3('0x35')](_0x47ee2c[_0x5de3('0x36')]);_0x4da714['filters']=_[_0x5de3('0x39')](_0x4da714['model'],_0x4da714['query']);_0xe16033[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x4da714[_0x5de3('0x34')],qs['fields'](_0x47ee2c['query'][_0x5de3('0x3a')]));_0xe16033['attributes']=_0xe16033[_0x5de3('0x38')][_0x5de3('0x3b')]?_0xe16033[_0x5de3('0x38')]:_0x4da714[_0x5de3('0x34')];_0xe16033[_0x5de3('0x5c')]=qs[_0x5de3('0x3d')](_0x47ee2c['query'][_0x5de3('0x3d')]);_0xe16033[_0x5de3('0x3e')]=qs['filters'](_[_0x5de3('0x3f')](_0x47ee2c[_0x5de3('0x36')],_0x4da714[_0x5de3('0x37')]));if(_0x47ee2c['query'][_0x5de3('0x40')]){_0xe16033[_0x5de3('0x3e')]=_['merge'](_0xe16033[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0xe16033[_0x5de3('0x38')],function(_0x17c5bc){var _0x53a0f7={};_0x53a0f7[_0x17c5bc]={'$like':'%'+_0x47ee2c['query'][_0x5de3('0x40')]+'%'};return _0x53a0f7;})});}_0xe16033=_['merge']({},_0xe16033,_0x47ee2c[_0x5de3('0x49')]);return _0x26df73['getTeams'](_0xe16033);}})['then'](function(_0x290b21){if(_0x290b21){_0x4cc3cb=_0x290b21[_0x5de3('0x3b')];if(!_0x47ee2c[_0x5de3('0x36')][_0x5de3('0x3c')]('nolimit')){_0xe16033['limit']=qs[_0x5de3('0x23')](_0x47ee2c[_0x5de3('0x36')][_0x5de3('0x23')]);_0xe16033[_0x5de3('0x21')]=qs['offset'](_0x47ee2c['query'][_0x5de3('0x21')]);}return _0x26df73[_0x5de3('0x67')](_0xe16033);}})[_0x5de3('0x29')](function(_0x570d4e){if(_0x570d4e){return _0x570d4e?{'count':_0x4cc3cb,'rows':_0x570d4e}:null;}})[_0x5de3('0x29')](respondWithResult(_0x575b7a,null))[_0x5de3('0x46')](handleError(_0x575b7a,null));};exports[_0x5de3('0x69')]=function(_0x1fd019,_0x481e48,_0x1fb949){var _0x2bcfe7=_0x1fd019[_0x5de3('0x56')]['ids'];return db[_0x5de3('0x68')]['findAll']({'where':{'id':_0x2bcfe7},'attributes':['id'],'include':[{'model':db[_0x5de3('0x6a')],'as':_0x5de3('0x6b'),'attributes':['id',_0x5de3('0x2c'),_0x5de3('0x6c'),_0x5de3('0x6d'),'interface'],'raw':!![]}]})[_0x5de3('0x29')](function(_0xc8d311){if(_0xc8d311){var _0x116b54=_[_0x5de3('0x6e')](_0xc8d311,function(_0x204b91){var _0x7d5ee4=_0x204b91[_0x5de3('0x4d')]({'plain':!![]});return _0x7d5ee4[_0x5de3('0x6b')];});return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x1fd019[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](function(_0x290d66){return db[_0x5de3('0x6f')]['transaction'](function(_0x8db233){return _0x290d66[_0x5de3('0x69')](_0x2bcfe7,{'transaction':_0x8db233})['then'](function(){return BPromise[_0x5de3('0x70')](_0x116b54,function(_0x3f141f){return db[_0x5de3('0x5a')][_0x5de3('0x71')]({'where':{'UserId':_0x3f141f['id'],'FaxQueueId':_0x1fd019['params']['id']},'transaction':_0x8db233});});})['then'](function(){_0x116b54['forEach'](function(_0x2b9be3){socket['emit'](_0x5de3('0x72'),{'UserId':_0x2b9be3['id'],'FaxQueueId':_0x290d66['id']});});});});});}})['then'](respondWithStatusCode(_0x481e48,null))[_0x5de3('0x46')](handleError(_0x481e48,null));};exports[_0x5de3('0x73')]=function(_0x52b66a,_0x412919,_0x184072){return db['Team'][_0x5de3('0x45')]({'where':{'id':_0x52b66a[_0x5de3('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5de3('0x6a')],'as':_0x5de3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x5de3('0x29')](handleEntityNotFound(_0x412919,null))['then'](function(_0x235249){var _0x2b5e4b=_[_0x5de3('0x2f')](_0x235249,'id');var _0x4f6c64=[];var _0x3c3ac9=[];var _0x2c51ca=squel['select']();_0x2c51ca[_0x5de3('0x74')]('tq.TeamId')['from']('team_has_fax_queues','tq')[_0x5de3('0x75')]('user_has_teams','ut',_0x5de3('0x76'))[_0x5de3('0x3e')]('FaxQueueId\x20=\x20?',_0x52b66a['params']['id']);for(var _0x447ddd=0x0;_0x447ddd<_0x235249['length'];_0x447ddd+=0x1){let _0x3d0199=_0x235249[_0x447ddd];for(var _0x40f5d1=0x0;_0x40f5d1<_0x3d0199[_0x5de3('0x6b')]['length'];_0x40f5d1+=0x1){let _0x1d0063=_0x3d0199[_0x5de3('0x6b')][_0x40f5d1];var _0x429f37=_0x2c51ca[_0x5de3('0x77')]();_0x429f37[_0x5de3('0x3e')]('ut.UserId\x20=\x20?',_0x1d0063['id']);_0x3c3ac9['push'](db[_0x5de3('0x6f')]['query'](_0x429f37[_0x5de3('0x78')](),{'type':db[_0x5de3('0x6f')][_0x5de3('0x79')][_0x5de3('0x7a')]})['then'](function(_0x4982ca){if(_0x4982ca[_0x5de3('0x3b')]===0x1){return _0x1d0063['id'];}else{var _0x3d4a66=_[_0x5de3('0x7b')](_[_0x5de3('0x2f')](_0x4982ca,'TeamId'),function(_0x569009){return _[_0x5de3('0x7c')](_0x2b5e4b,_0x569009);});if(_0x3d4a66){return _0x1d0063['id'];}}}));}}return BPromise[_0x5de3('0x7d')](_0x3c3ac9)[_0x5de3('0x29')](function(_0xaec84a){_0x4f6c64=_(_0x4f6c64)['union'](_0xaec84a)[_0x5de3('0x7e')]()[_0x5de3('0x7f')]();return db[_0x5de3('0x30')]['find']({'where':{'id':_0x52b66a[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](function(_0x326661){return db['sequelize'][_0x5de3('0x80')](function(_0x45a5b4){return _0x326661[_0x5de3('0x73')](_0x52b66a[_0x5de3('0x36')][_0x5de3('0x81')],{'transaction':_0x45a5b4})[_0x5de3('0x29')](function(){if(!_[_0x5de3('0x82')](_0x4f6c64)){return _0x326661['removeAgents'](_0x4f6c64,{'transaction':_0x45a5b4});}})[_0x5de3('0x29')](function(){_0x4f6c64[_0x5de3('0x83')](function(_0x4a3acc){socket[_0x5de3('0x84')](_0x5de3('0x85'),{'UserId':_0x4a3acc,'FaxQueueId':_0x326661['id']});});});});});});})[_0x5de3('0x29')](respondWithStatusCode(_0x412919,null))['catch'](handleError(_0x412919,null));};exports[_0x5de3('0x86')]=function(_0x23e74f,_0x2b4a54,_0x54dae2){return db[_0x5de3('0x30')][_0x5de3('0x4a')]({'where':{'id':_0x23e74f[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x2b4a54,null))[_0x5de3('0x29')](function(_0x519c94){if(_0x519c94){return _0x519c94[_0x5de3('0x86')](_0x23e74f[_0x5de3('0x56')][_0x5de3('0x81')],_[_0x5de3('0x87')](_0x23e74f['body'],[_0x5de3('0x81'),'id'])||{})['spread'](function(_0x402657){for(var _0x344f9d=0x0;_0x344f9d<_0x23e74f['body'][_0x5de3('0x81')][_0x5de3('0x3b')];_0x344f9d+=0x1){socket[_0x5de3('0x84')](_0x5de3('0x72'),{'UserId':Number(_0x23e74f[_0x5de3('0x56')][_0x5de3('0x81')][_0x344f9d]),'FaxQueueId':Number(_0x23e74f[_0x5de3('0x48')]['id'])});}return _0x402657;});}})['then'](respondWithResult(_0x2b4a54,null))[_0x5de3('0x46')](handleError(_0x2b4a54,null));};exports['removeAgents']=function(_0x31aef1,_0x35a6d5,_0x3c1b0c){return db['FaxQueue'][_0x5de3('0x4a')]({'where':{'id':_0x31aef1[_0x5de3('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6d5,null))['then'](function(_0x439f63){if(_0x439f63){return _0x439f63[_0x5de3('0x88')](_0x31aef1[_0x5de3('0x36')][_0x5de3('0x81')])[_0x5de3('0x29')](function(){if(_['isArray'](_0x31aef1[_0x5de3('0x36')]['ids'])){for(var _0x1b1ce2=0x0;_0x1b1ce2<_0x31aef1[_0x5de3('0x36')]['ids'][_0x5de3('0x3b')];_0x1b1ce2+=0x1){socket[_0x5de3('0x84')]('userFaxQueue:remove',{'UserId':Number(_0x31aef1[_0x5de3('0x36')][_0x5de3('0x81')][_0x1b1ce2]),'FaxQueueId':Number(_0x31aef1[_0x5de3('0x48')]['id'])});}}else{socket['emit'](_0x5de3('0x85'),{'UserId':Number(_0x31aef1['query']['ids']),'FaxQueueId':Number(_0x31aef1[_0x5de3('0x48')]['id'])});}});}})[_0x5de3('0x29')](respondWithStatusCode(_0x35a6d5,null))['catch'](handleError(_0x35a6d5,null));};exports['getAgents']=function(_0x12064a,_0x25af52,_0x4364c0){var _0x1391be={};var _0x4b892a={};var _0x554a43;var _0x54d77b;return db['FaxQueue'][_0x5de3('0x59')]({'where':{'id':_0x12064a[_0x5de3('0x48')]['id']}})[_0x5de3('0x29')](handleEntityNotFound(_0x25af52,null))[_0x5de3('0x29')](function(_0x21bfa0){if(_0x21bfa0){_0x554a43=_0x21bfa0;_0x4b892a[_0x5de3('0x34')]=_['keys'](db[_0x5de3('0x6a')][_0x5de3('0x31')]);_0x4b892a[_0x5de3('0x36')]=_[_0x5de3('0x35')](_0x12064a[_0x5de3('0x36')]);_0x4b892a[_0x5de3('0x37')]=_[_0x5de3('0x39')](_0x4b892a['model'],_0x4b892a[_0x5de3('0x36')]);_0x1391be[_0x5de3('0x38')]=_[_0x5de3('0x39')](_0x4b892a[_0x5de3('0x34')],qs[_0x5de3('0x3a')](_0x12064a[_0x5de3('0x36')]['fields']));_0x1391be[_0x5de3('0x38')]=_0x1391be[_0x5de3('0x38')]['length']?_0x1391be['attributes']:_0x4b892a[_0x5de3('0x34')];_0x1391be[_0x5de3('0x5c')]=qs[_0x5de3('0x3d')](_0x12064a[_0x5de3('0x36')][_0x5de3('0x3d')]);_0x1391be[_0x5de3('0x3e')]=qs[_0x5de3('0x37')](_[_0x5de3('0x3f')](_0x12064a[_0x5de3('0x36')],_0x4b892a[_0x5de3('0x37')]));if(_0x12064a['query'][_0x5de3('0x40')]){_0x1391be['where']=_[_0x5de3('0x41')](_0x1391be[_0x5de3('0x3e')],{'$or':_[_0x5de3('0x2f')](_0x1391be['attributes'],function(_0x2ffe61){var _0x477374={};_0x477374[_0x2ffe61]={'$like':'%'+_0x12064a['query'][_0x5de3('0x40')]+'%'};return _0x477374;})});}_0x1391be=_['merge']({},_0x1391be,_0x12064a[_0x5de3('0x49')]);return _0x554a43['getAgents'](_0x1391be);}})[_0x5de3('0x29')](function(_0x168ead){if(_0x168ead){_0x54d77b=_0x168ead[_0x5de3('0x3b')];if(!_0x12064a['query'][_0x5de3('0x3c')]('nolimit')){_0x1391be[_0x5de3('0x23')]=qs[_0x5de3('0x23')](_0x12064a[_0x5de3('0x36')][_0x5de3('0x23')]);_0x1391be[_0x5de3('0x21')]=qs[_0x5de3('0x21')](_0x12064a[_0x5de3('0x36')][_0x5de3('0x21')]);}return _0x554a43['getAgents'](_0x1391be);}})[_0x5de3('0x29')](function(_0x16eaac){if(_0x16eaac){return _0x16eaac?{'count':_0x54d77b,'rows':_0x16eaac}:null;}})[_0x5de3('0x29')](respondWithResult(_0x25af52,null))[_0x5de3('0x46')](handleError(_0x25af52,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5683984..84ee4e9 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 _0x6425=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x6425,0xa3));var _0x5642=function(_0xb3e04b,_0x16e1d1){_0xb3e04b=_0xb3e04b-0x0;var _0x492991=_0x6425[_0xb3e04b];return _0x492991;};'use strict';var EventEmitter=require(_0x5642('0x0'));var FaxQueue=require(_0x5642('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5642('0x2')](0x0);var events={'afterCreate':_0x5642('0x3'),'afterUpdate':'update','afterDestroy':_0x5642('0x4')};function emitEvent(_0x2605e2){return function(_0x3b6b42,_0x9b18a,_0x40de39){FaxQueueEvents['emit'](_0x2605e2+':'+_0x3b6b42['id'],_0x3b6b42);FaxQueueEvents['emit'](_0x2605e2,_0x3b6b42);_0x40de39(null);};}for(var e in events){if(events[_0x5642('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x3bf1=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0xefce43,_0x38d27c){var _0x12a38b=function(_0x18eb27){while(--_0x18eb27){_0xefce43['push'](_0xefce43['shift']());}};_0x12a38b(++_0x38d27c);}(_0x3bf1,0x92));var _0x13bf=function(_0x2d69f9,_0x33c552){_0x2d69f9=_0x2d69f9-0x0;var _0x3ef740=_0x3bf1[_0x2d69f9];return _0x3ef740;};'use strict';var EventEmitter=require(_0x13bf('0x0'));var FaxQueue=require(_0x13bf('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x13bf('0x2')](0x0);var events={'afterCreate':_0x13bf('0x3'),'afterUpdate':'update','afterDestroy':_0x13bf('0x4')};function emitEvent(_0xbd29a){return function(_0x120c1a,_0x3d0e35,_0x564f67){FaxQueueEvents['emit'](_0xbd29a+':'+_0x120c1a['id'],_0x120c1a);FaxQueueEvents[_0x13bf('0x5')](_0xbd29a,_0x120c1a);_0x564f67(null);};}for(var e in events){if(events[_0x13bf('0x6')](e)){var event=events[e];FaxQueue[_0x13bf('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index e6cc047..1c24880 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 _0x8a5c=['rimraf','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4f7e5b,_0x452c65){var _0x13ea34=function(_0x3f04c0){while(--_0x3f04c0){_0x4f7e5b['push'](_0x4f7e5b['shift']());}};_0x13ea34(++_0x452c65);}(_0x8a5c,0x1c1));var _0xc8a5=function(_0x19308f,_0x3f0df8){_0x19308f=_0x19308f-0x0;var _0xf51aaf=_0x8a5c[_0x19308f];return _0xf51aaf;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var logger=require(_0xc8a5('0x2'))(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8a5('0x5'));var fs=require('fs');var path=require(_0xc8a5('0x6'));var rimraf=require(_0xc8a5('0x7'));var config=require('../../config/environment');var attributes=require(_0xc8a5('0x8'));module['exports']=function(_0x108c4f,_0x31a889){return _0x108c4f[_0xc8a5('0x9')](_0xc8a5('0xa'),attributes,{'tableName':_0xc8a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ce1=['fax_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','./faxQueue.attributes','define'];(function(_0x3daf1a,_0x5438ec){var _0x300c8c=function(_0x20deab){while(--_0x20deab){_0x3daf1a['push'](_0x3daf1a['shift']());}};_0x300c8c(++_0x5438ec);}(_0x6ce1,0x119));var _0x16ce=function(_0xe3af3b,_0x1a16be){_0xe3af3b=_0xe3af3b-0x0;var _0x551199=_0x6ce1[_0xe3af3b];return _0x551199;};'use strict';var _=require(_0x16ce('0x0'));var util=require(_0x16ce('0x1'));var logger=require('../../config/logger')(_0x16ce('0x2'));var moment=require(_0x16ce('0x3'));var BPromise=require(_0x16ce('0x4'));var rp=require(_0x16ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16ce('0x6'));var config=require('../../config/environment');var attributes=require(_0x16ce('0x7'));module['exports']=function(_0x4204a6,_0x516f7a){return _0x4204a6[_0x16ce('0x8')]('FaxQueue',attributes,{'tableName':_0x16ce('0x9'),'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 7a1e94a..4096d44 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 _0xc411=['message','result','catch','GetFaxQueue','options','raw','attributes','limit','include','map','model','FaxQueue','find','where','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x380c61,_0x2bd6c4){var _0x5dcd64=function(_0xde8d19){while(--_0xde8d19){_0x380c61['push'](_0x380c61['shift']());}};_0x5dcd64(++_0x2bd6c4);}(_0xc411,0xed));var _0x1c41=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xc411[_0x4409e7];return _0x24c751;};'use strict';var _=require(_0x1c41('0x0'));var util=require(_0x1c41('0x1'));var moment=require(_0x1c41('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c41('0x3'));var fs=require('fs');var Redis=require(_0x1c41('0x4'));var db=require(_0x1c41('0x5'))['db'];var utils=require(_0x1c41('0x6'));var logger=require(_0x1c41('0x7'))(_0x1c41('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1c41('0x9')][_0x1c41('0xa')]({'port':0x232a});config[_0x1c41('0xb')]=_[_0x1c41('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1c41('0xd'))(new Redis(config[_0x1c41('0xb')]));require(_0x1c41('0xe'))['register'](socket);function respondWithRpcPromise(_0x55e948,_0x1546b6,_0x18a9c7){return new BPromise(function(_0x4e69b5,_0xf7c76e){return client['request'](_0x55e948,_0x18a9c7)[_0x1c41('0xf')](function(_0x417d66){logger[_0x1c41('0x10')](_0x1c41('0x11'),_0x1546b6,_0x1c41('0x12'));logger[_0x1c41('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1546b6,_0x1c41('0x12'),JSON['stringify'](_0x417d66));if(_0x417d66['error']){if(_0x417d66[_0x1c41('0x14')][_0x1c41('0x15')]===0x1f4){logger[_0x1c41('0x14')]('FaxQueue,\x20%s,\x20%s',_0x1546b6,_0x417d66['error'][_0x1c41('0x16')]);return _0xf7c76e(_0x417d66[_0x1c41('0x14')]['message']);}logger[_0x1c41('0x14')](_0x1c41('0x11'),_0x1546b6,_0x417d66['error'][_0x1c41('0x16')]);return _0x4e69b5(_0x417d66[_0x1c41('0x14')]['message']);}else{logger[_0x1c41('0x10')](_0x1c41('0x11'),_0x1546b6,_0x1c41('0x12'));_0x4e69b5(_0x417d66[_0x1c41('0x17')][_0x1c41('0x16')]);}})[_0x1c41('0x18')](function(_0x108e8b){logger[_0x1c41('0x14')](_0x1c41('0x11'),_0x1546b6,_0x108e8b);_0xf7c76e(_0x108e8b);});});}exports[_0x1c41('0x19')]=function(_0x56ba2c){var _0x5c32fb=this;return new Promise(function(_0x5d28a0,_0x2e22e6){return db['FaxQueue']['findAll']({'raw':_0x56ba2c[_0x1c41('0x1a')]?_0x56ba2c['options'][_0x1c41('0x1b')]===undefined?!![]:![]:!![],'where':_0x56ba2c[_0x1c41('0x1a')]?_0x56ba2c['options']['where']||null:null,'attributes':_0x56ba2c[_0x1c41('0x1a')]?_0x56ba2c['options'][_0x1c41('0x1c')]||null:null,'limit':_0x56ba2c[_0x1c41('0x1a')]?_0x56ba2c['options'][_0x1c41('0x1d')]||null:null,'include':_0x56ba2c[_0x1c41('0x1a')]?_0x56ba2c[_0x1c41('0x1a')][_0x1c41('0x1e')]?_[_0x1c41('0x1f')](_0x56ba2c[_0x1c41('0x1a')][_0x1c41('0x1e')],function(_0x461277){return{'model':db[_0x461277['model']],'as':_0x461277['as'],'attributes':_0x461277[_0x1c41('0x1c')],'include':_0x461277[_0x1c41('0x1e')]?_[_0x1c41('0x1f')](_0x461277[_0x1c41('0x1e')],function(_0x3e299d){return{'model':db[_0x3e299d[_0x1c41('0x20')]],'as':_0x3e299d['as'],'attributes':_0x3e299d[_0x1c41('0x1c')],'include':_0x3e299d[_0x1c41('0x1e')]?_['map'](_0x3e299d['include'],function(_0x285353){return{'model':db[_0x285353[_0x1c41('0x20')]],'as':_0x285353['as'],'attributes':_0x285353[_0x1c41('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c41('0xf')](function(_0xe19c7d){logger[_0x1c41('0x10')]('GetFaxQueue',_0x56ba2c);logger['debug'](_0x1c41('0x19'),_0x56ba2c,JSON['stringify'](_0xe19c7d));_0x5d28a0(_0xe19c7d);})['catch'](function(_0x32be55){logger[_0x1c41('0x14')](_0x1c41('0x19'),_0x32be55[_0x1c41('0x16')],_0x56ba2c);_0x2e22e6(_0x5c32fb[_0x1c41('0x14')](0x1f4,_0x32be55['message']));});});};exports['ShowFaxQueue']=function(_0x437af7){var _0x4c7c66=this;return new Promise(function(_0x228f22,_0x5e88a3){return db[_0x1c41('0x21')][_0x1c41('0x22')]({'raw':_0x437af7['options']?_0x437af7[_0x1c41('0x1a')][_0x1c41('0x1b')]===undefined?!![]:![]:!![],'where':_0x437af7[_0x1c41('0x1a')]?_0x437af7[_0x1c41('0x1a')][_0x1c41('0x23')]||null:null,'attributes':_0x437af7[_0x1c41('0x1a')]?_0x437af7[_0x1c41('0x1a')]['attributes']||null:null,'include':_0x437af7['options']?_0x437af7[_0x1c41('0x1a')][_0x1c41('0x1e')]?_['map'](_0x437af7[_0x1c41('0x1a')]['include'],function(_0x6d35f8){return{'model':db[_0x6d35f8[_0x1c41('0x20')]],'as':_0x6d35f8['as'],'attributes':_0x6d35f8[_0x1c41('0x1c')],'include':_0x6d35f8[_0x1c41('0x1e')]?_['map'](_0x6d35f8['include'],function(_0x3b1dce){return{'model':db[_0x3b1dce[_0x1c41('0x20')]],'as':_0x3b1dce['as'],'attributes':_0x3b1dce['attributes'],'include':_0x3b1dce['include']?_['map'](_0x3b1dce[_0x1c41('0x1e')],function(_0x367e48){return{'model':db[_0x367e48[_0x1c41('0x20')]],'as':_0x367e48['as'],'attributes':_0x367e48[_0x1c41('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c41('0xf')](function(_0x56e651){logger[_0x1c41('0x10')]('ShowFaxQueue',_0x437af7);logger[_0x1c41('0x13')]('ShowFaxQueue',_0x437af7,JSON[_0x1c41('0x24')](_0x56e651));_0x228f22(_0x56e651);})[_0x1c41('0x18')](function(_0xbbee60){logger[_0x1c41('0x14')]('ShowFaxQueue',_0xbbee60[_0x1c41('0x16')],_0x437af7);_0x5e88a3(_0x4c7c66[_0x1c41('0x14')](0x1f4,_0xbbee60[_0x1c41('0x16')]));});});}; \ No newline at end of file +var _0x0400=['find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','include','map','model','ShowFaxQueue'];(function(_0x2c8553,_0x309ff8){var _0x34b8cb=function(_0x59265b){while(--_0x59265b){_0x2c8553['push'](_0x2c8553['shift']());}};_0x34b8cb(++_0x309ff8);}(_0x0400,0xae));var _0x0040=function(_0x5f0f3f,_0x4a63ae){_0x5f0f3f=_0x5f0f3f-0x0;var _0x2545cc=_0x0400[_0x5f0f3f];return _0x2545cc;};'use strict';var _=require(_0x0040('0x0'));var util=require(_0x0040('0x1'));var moment=require(_0x0040('0x2'));var BPromise=require(_0x0040('0x3'));var rs=require(_0x0040('0x4'));var fs=require('fs');var Redis=require(_0x0040('0x5'));var db=require(_0x0040('0x6'))['db'];var utils=require(_0x0040('0x7'));var logger=require(_0x0040('0x8'))(_0x0040('0x9'));var config=require(_0x0040('0xa'));var jayson=require(_0x0040('0xb'));var client=jayson[_0x0040('0xc')][_0x0040('0xd')]({'port':0x232a});config[_0x0040('0xe')]=_[_0x0040('0xf')](config[_0x0040('0xe')],{'host':_0x0040('0x10'),'port':0x18eb});var socket=require(_0x0040('0x11'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x0040('0x12')](socket);function respondWithRpcPromise(_0x2c4877,_0x20593d,_0x5441a0){return new BPromise(function(_0x270900,_0x3717d2){return client['request'](_0x2c4877,_0x5441a0)[_0x0040('0x13')](function(_0x44a06c){logger[_0x0040('0x14')](_0x0040('0x15'),_0x20593d,_0x0040('0x16'));logger[_0x0040('0x17')](_0x0040('0x18'),_0x20593d,'request\x20sent',JSON[_0x0040('0x19')](_0x44a06c));if(_0x44a06c[_0x0040('0x1a')]){if(_0x44a06c['error'][_0x0040('0x1b')]===0x1f4){logger[_0x0040('0x1a')](_0x0040('0x15'),_0x20593d,_0x44a06c[_0x0040('0x1a')][_0x0040('0x1c')]);return _0x3717d2(_0x44a06c[_0x0040('0x1a')][_0x0040('0x1c')]);}logger[_0x0040('0x1a')](_0x0040('0x15'),_0x20593d,_0x44a06c[_0x0040('0x1a')]['message']);return _0x270900(_0x44a06c[_0x0040('0x1a')][_0x0040('0x1c')]);}else{logger[_0x0040('0x14')]('FaxQueue,\x20%s,\x20%s',_0x20593d,_0x0040('0x16'));_0x270900(_0x44a06c[_0x0040('0x1d')][_0x0040('0x1c')]);}})[_0x0040('0x1e')](function(_0xcdefbe){logger[_0x0040('0x1a')](_0x0040('0x15'),_0x20593d,_0xcdefbe);_0x3717d2(_0xcdefbe);});});}exports[_0x0040('0x1f')]=function(_0x1974db){var _0x24a1f1=this;return new Promise(function(_0x2b3153,_0x582f02){return db[_0x0040('0x20')][_0x0040('0x21')]({'raw':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')][_0x0040('0x23')]===undefined?!![]:![]:!![],'where':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')]['where']||null:null,'attributes':_0x1974db['options']?_0x1974db[_0x0040('0x22')][_0x0040('0x24')]||null:null,'limit':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')]['limit']||null:null,'include':_0x1974db[_0x0040('0x22')]?_0x1974db[_0x0040('0x22')][_0x0040('0x25')]?_['map'](_0x1974db[_0x0040('0x22')][_0x0040('0x25')],function(_0x4a34e5){return{'model':db[_0x4a34e5['model']],'as':_0x4a34e5['as'],'attributes':_0x4a34e5[_0x0040('0x24')],'include':_0x4a34e5['include']?_[_0x0040('0x26')](_0x4a34e5['include'],function(_0x392ceb){return{'model':db[_0x392ceb[_0x0040('0x27')]],'as':_0x392ceb['as'],'attributes':_0x392ceb['attributes'],'include':_0x392ceb[_0x0040('0x25')]?_[_0x0040('0x26')](_0x392ceb[_0x0040('0x25')],function(_0x537647){return{'model':db[_0x537647[_0x0040('0x27')]],'as':_0x537647['as'],'attributes':_0x537647[_0x0040('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3246fe){logger['info'](_0x0040('0x1f'),_0x1974db);logger[_0x0040('0x17')](_0x0040('0x1f'),_0x1974db,JSON[_0x0040('0x19')](_0x3246fe));_0x2b3153(_0x3246fe);})['catch'](function(_0x858139){logger[_0x0040('0x1a')](_0x0040('0x1f'),_0x858139['message'],_0x1974db);_0x582f02(_0x24a1f1[_0x0040('0x1a')](0x1f4,_0x858139[_0x0040('0x1c')]));});});};exports[_0x0040('0x28')]=function(_0x3e431d){var _0x1609df=this;return new Promise(function(_0x9cf090,_0x287be7){return db[_0x0040('0x20')][_0x0040('0x29')]({'raw':_0x3e431d[_0x0040('0x22')]?_0x3e431d[_0x0040('0x22')][_0x0040('0x23')]===undefined?!![]:![]:!![],'where':_0x3e431d[_0x0040('0x22')]?_0x3e431d[_0x0040('0x22')][_0x0040('0x2a')]||null:null,'attributes':_0x3e431d[_0x0040('0x22')]?_0x3e431d['options'][_0x0040('0x24')]||null:null,'include':_0x3e431d[_0x0040('0x22')]?_0x3e431d[_0x0040('0x22')][_0x0040('0x25')]?_[_0x0040('0x26')](_0x3e431d['options'][_0x0040('0x25')],function(_0x18e80a){return{'model':db[_0x18e80a[_0x0040('0x27')]],'as':_0x18e80a['as'],'attributes':_0x18e80a['attributes'],'include':_0x18e80a['include']?_['map'](_0x18e80a[_0x0040('0x25')],function(_0x296928){return{'model':db[_0x296928['model']],'as':_0x296928['as'],'attributes':_0x296928[_0x0040('0x24')],'include':_0x296928[_0x0040('0x25')]?_[_0x0040('0x26')](_0x296928[_0x0040('0x25')],function(_0x4bcadb){return{'model':db[_0x4bcadb[_0x0040('0x27')]],'as':_0x4bcadb['as'],'attributes':_0x4bcadb[_0x0040('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0040('0x13')](function(_0x3d341b){logger[_0x0040('0x14')](_0x0040('0x28'),_0x3e431d);logger['debug'](_0x0040('0x28'),_0x3e431d,JSON[_0x0040('0x19')](_0x3d341b));_0x9cf090(_0x3d341b);})[_0x0040('0x1e')](function(_0x2545c6){logger[_0x0040('0x1a')](_0x0040('0x28'),_0x2545c6[_0x0040('0x1c')],_0x3e431d);_0x287be7(_0x1609df['error'](0x1f4,_0x2545c6[_0x0040('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index dc59f1b..7dcbabb 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 _0x61d3=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x4ebc5a,_0x5bc3c1){var _0x553d99=function(_0x4dd950){while(--_0x4dd950){_0x4ebc5a['push'](_0x4ebc5a['shift']());}};_0x553d99(++_0x5bc3c1);}(_0x61d3,0x122));var _0x361d=function(_0x65efc5,_0x5d978c){_0x65efc5=_0x65efc5-0x0;var _0x4c387a=_0x61d3[_0x65efc5];return _0x4c387a;};'use strict';var FaxQueueEvents=require(_0x361d('0x0'));var events=[_0x361d('0x1'),_0x361d('0x2'),_0x361d('0x3')];function createListener(_0x1db7ef,_0x298cb5){return function(_0x52a81f){_0x298cb5[_0x361d('0x4')](_0x1db7ef,_0x52a81f);};}function removeListener(_0x1abb88,_0x5340d8){return function(){FaxQueueEvents[_0x361d('0x5')](_0x1abb88,_0x5340d8);};}exports['register']=function(_0x290956){for(var _0x96b177=0x0,_0x399fde=events[_0x361d('0x6')];_0x96b177<_0x399fde;_0x96b177++){var _0x528af4=events[_0x96b177];var _0x320736=createListener(_0x361d('0x7')+_0x528af4,_0x290956);FaxQueueEvents['on'](_0x528af4,_0x320736);}}; \ No newline at end of file +var _0x19b4=['length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x5c455a,_0x4febed){var _0x57d3dc=function(_0x227798){while(--_0x227798){_0x5c455a['push'](_0x5c455a['shift']());}};_0x57d3dc(++_0x4febed);}(_0x19b4,0x113));var _0x419b=function(_0x2efa3d,_0x3f1b4d){_0x2efa3d=_0x2efa3d-0x0;var _0x58c525=_0x19b4[_0x2efa3d];return _0x58c525;};'use strict';var FaxQueueEvents=require(_0x419b('0x0'));var events=[_0x419b('0x1'),_0x419b('0x2'),_0x419b('0x3')];function createListener(_0x1ca2df,_0x2ea070){return function(_0x1dec10){_0x2ea070[_0x419b('0x4')](_0x1ca2df,_0x1dec10);};}function removeListener(_0xe4168,_0x5df4d3){return function(){FaxQueueEvents['removeListener'](_0xe4168,_0x5df4d3);};}exports['register']=function(_0x50bad2){for(var _0x42b277=0x0,_0x4ba3dd=events[_0x419b('0x5')];_0x42b277<_0x4ba3dd;_0x42b277++){var _0x4b73e3=events[_0x42b277];var _0xeee8b2=createListener(_0x419b('0x6')+_0x4b73e3,_0x50bad2);FaxQueueEvents['on'](_0x4b73e3,_0xeee8b2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 50ac6c0..20a3f29 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 _0x7bd0=['fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2b8393,_0x48dd53){var _0x4b5ca0=function(_0x46b3e0){while(--_0x46b3e0){_0x2b8393['push'](_0x2b8393['shift']());}};_0x4b5ca0(++_0x48dd53);}(_0x7bd0,0x111));var _0x07bd=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x7bd0[_0x5fa520];return _0x1bf6c4;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['get'](_0x07bd('0x11'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x12')]);router[_0x07bd('0xa')]('/:id/teams',auth[_0x07bd('0xb')](),controller[_0x07bd('0x13')]);router[_0x07bd('0xa')](_0x07bd('0x14'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x15')]);router[_0x07bd('0x16')]('/',auth[_0x07bd('0xb')](),controller['create']);router['post'](_0x07bd('0x17'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x18')]);router[_0x07bd('0x16')](_0x07bd('0x14'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x19')]);router['put'](_0x07bd('0xf'),auth['isAuthenticated'](),controller[_0x07bd('0x1a')]);router[_0x07bd('0x1b')](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x1c')]);router['delete'](_0x07bd('0x17'),auth[_0x07bd('0xb')](),controller['removeTeams']);router[_0x07bd('0x1b')](_0x07bd('0x14'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x1d')]);module[_0x07bd('0x1e')]=router; \ No newline at end of file +var _0x583c=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','/:id','delete','removeTeams','removeAgents','exports','multer'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x583c,0x12b));var _0xc583=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x583c[_0x550e29];return _0x3515b6;};'use strict';var multer=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var timeout=require(_0xc583('0x3'));var express=require('express');var router=express[_0xc583('0x4')]();var fs_extra=require(_0xc583('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc583('0x6'));var controller=require(_0xc583('0x7'));router['get']('/',auth[_0xc583('0x8')](),controller[_0xc583('0x9')]);router[_0xc583('0xa')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0xc')]);router[_0xc583('0xa')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0xd')]);router[_0xc583('0xa')](_0xc583('0xe'),auth[_0xc583('0x8')](),controller['getMembers']);router[_0xc583('0xa')](_0xc583('0xf'),auth['isAuthenticated'](),controller[_0xc583('0x10')]);router[_0xc583('0xa')]('/:id/users',auth[_0xc583('0x8')](),controller[_0xc583('0x11')]);router[_0xc583('0x12')]('/',auth[_0xc583('0x8')](),controller[_0xc583('0x13')]);router[_0xc583('0x12')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x14')]);router['post'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x16')]);router[_0xc583('0x17')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0x18')]);router['delete'](_0xc583('0x19'),auth[_0xc583('0x8')](),controller['destroy']);router[_0xc583('0x1a')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x1b')]);router['delete'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x1c')]);module[_0xc583('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 62686d4..456882e 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 _0xbab2=['STRING','DATE','moment','sequelize','exports'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xbab2,0xbb));var _0x2bab=function(_0x2d82ff,_0xe3532a){_0x2d82ff=_0x2d82ff-0x0;var _0x32fc59=_0xbab2[_0x2d82ff];return _0x32fc59;};'use strict';var moment=require(_0x2bab('0x0'));var Sequelize=require(_0x2bab('0x1'));module[_0x2bab('0x2')]={'uniqueid':{'type':Sequelize[_0x2bab('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2bab('0x4')]},'leaveAt':{'type':Sequelize[_0x2bab('0x4')]},'acceptAt':{'type':Sequelize[_0x2bab('0x4')]},'exitAt':{'type':Sequelize[_0x2bab('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde32=['DATE','moment','sequelize','STRING'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xde32,0xd5));var _0x2de3=function(_0x1fdaf4,_0x465974){_0x1fdaf4=_0x1fdaf4-0x0;var _0x527f4b=_0xde32[_0x1fdaf4];return _0x527f4b;};'use strict';var moment=require(_0x2de3('0x0'));var Sequelize=require(_0x2de3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2de3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2de3('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2de3('0x3')]},'acceptAt':{'type':Sequelize[_0x2de3('0x3')]},'exitAt':{'type':Sequelize[_0x2de3('0x3')]},'reason':{'type':Sequelize[_0x2de3('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d9115d4..b9dd690 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 _0x2bbb=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxQueueReport','include','rows','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x3791a5,_0x3e9d44){var _0x495f05=function(_0x2a2e0c){while(--_0x2a2e0c){_0x3791a5['push'](_0x3791a5['shift']());}};_0x495f05(++_0x3e9d44);}(_0x2bbb,0x85));var _0xb2bb=function(_0x133d21,_0x61f158){_0x133d21=_0x133d21-0x0;var _0x533332=_0x2bbb[_0x133d21];return _0x533332;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2bb('0x0'));var zipdir=require(_0xb2bb('0x1'));var jsonpatch=require(_0xb2bb('0x2'));var rp=require('request-promise');var moment=require(_0xb2bb('0x3'));var BPromise=require(_0xb2bb('0x4'));var Mustache=require(_0xb2bb('0x5'));var util=require(_0xb2bb('0x6'));var path=require(_0xb2bb('0x7'));var sox=require(_0xb2bb('0x8'));var csv=require('to-csv');var ejs=require(_0xb2bb('0x9'));var fs=require('fs');var fs_extra=require(_0xb2bb('0xa'));var _=require('lodash');var squel=require(_0xb2bb('0xb'));var crypto=require(_0xb2bb('0xc'));var jsforce=require(_0xb2bb('0xd'));var deskjs=require(_0xb2bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb2bb('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2bb('0x10'));var authService=require(_0xb2bb('0x11'));var qs=require(_0xb2bb('0x12'));var as=require(_0xb2bb('0x13'));var hardwareService=require(_0xb2bb('0x14'));var logger=require('../../config/logger')(_0xb2bb('0x15'));var utils=require('../../config/utils');var config=require(_0xb2bb('0x16'));var licenseUtil=require(_0xb2bb('0x17'));var db=require(_0xb2bb('0x18'))['db'];function respondWithStatusCode(_0x43950f,_0x38ea15){_0x38ea15=_0x38ea15||0xcc;return function(_0x14c05e){if(_0x14c05e){return _0x43950f['sendStatus'](_0x38ea15);}return _0x43950f[_0xb2bb('0x19')](_0x38ea15)[_0xb2bb('0x1a')]();};}function respondWithResult(_0x332903,_0x2905e2){_0x2905e2=_0x2905e2||0xc8;return function(_0x50a32e){if(_0x50a32e){return _0x332903[_0xb2bb('0x19')](_0x2905e2)[_0xb2bb('0x1b')](_0x50a32e);}};}function respondWithFilteredResult(_0x3bb017,_0x28b73c){return function(_0x367c6f){if(_0x367c6f){var _0x48d630=typeof _0x28b73c[_0xb2bb('0x1c')]===_0xb2bb('0x1d')&&typeof _0x28b73c[_0xb2bb('0x1e')]===_0xb2bb('0x1d');var _0x2dcb2d=_0x367c6f[_0xb2bb('0x1f')];var _0x35c4de=_0x48d630?0x0:_0x28b73c[_0xb2bb('0x1c')];var _0x8d2033=_0x48d630?_0x367c6f[_0xb2bb('0x1f')]:_0x28b73c[_0xb2bb('0x1c')]+_0x28b73c[_0xb2bb('0x1e')];var _0x5e8d6a;if(_0x8d2033>=_0x2dcb2d){_0x8d2033=_0x2dcb2d;_0x5e8d6a=0xc8;}else{_0x5e8d6a=0xce;}_0x3bb017[_0xb2bb('0x19')](_0x5e8d6a);return _0x3bb017['set'](_0xb2bb('0x20'),_0x35c4de+'-'+_0x8d2033+'/'+_0x2dcb2d)['json'](_0x367c6f);}return null;};}function patchUpdates(_0x3e7028){return function(_0x8f37d9){try{jsonpatch['apply'](_0x8f37d9,_0x3e7028,!![]);}catch(_0x302cd4){return BPromise[_0xb2bb('0x21')](_0x302cd4);}return _0x8f37d9['save']();};}function saveUpdates(_0x5ab483,_0x4a428f){return function(_0x2f1e0f){if(_0x2f1e0f){return _0x2f1e0f[_0xb2bb('0x22')](_0x5ab483)[_0xb2bb('0x23')](function(_0x494344){return _0x494344;});}return null;};}function removeEntity(_0x297d52,_0x2b1f94){return function(_0x250c3f){if(_0x250c3f){return _0x250c3f['destroy']()[_0xb2bb('0x23')](function(){_0x297d52[_0xb2bb('0x19')](0xcc)[_0xb2bb('0x1a')]();});}};}function handleEntityNotFound(_0x14aba5,_0x4b77e7){return function(_0x467b79){if(!_0x467b79){_0x14aba5[_0xb2bb('0x24')](0x194);}return _0x467b79;};}function handleError(_0x3d7890,_0x4a47ab){_0x4a47ab=_0x4a47ab||0x1f4;return function(_0xa09168){logger[_0xb2bb('0x25')](_0xa09168[_0xb2bb('0x26')]);if(_0xa09168[_0xb2bb('0x27')]){delete _0xa09168[_0xb2bb('0x27')];}_0x3d7890[_0xb2bb('0x19')](_0x4a47ab)['send'](_0xa09168);};}exports[_0xb2bb('0x28')]=function(_0x48d96f,_0xf1ed22){var _0x53e6aa={},_0x3d82c8={},_0x2b8ae3={'count':0x0,'rows':[]};var _0x5719f3=_[_0xb2bb('0x29')](db['FaxQueueReport'][_0xb2bb('0x2a')],function(_0x115202){return{'name':_0x115202['fieldName'],'type':_0x115202[_0xb2bb('0x2b')][_0xb2bb('0x2c')]};});_0x3d82c8[_0xb2bb('0x2d')]=_[_0xb2bb('0x29')](_0x5719f3,_0xb2bb('0x27'));_0x3d82c8[_0xb2bb('0x2e')]=_[_0xb2bb('0x2f')](_0x48d96f[_0xb2bb('0x2e')]);_0x3d82c8[_0xb2bb('0x30')]=_[_0xb2bb('0x31')](_0x3d82c8[_0xb2bb('0x2d')],_0x3d82c8['query']);_0x53e6aa[_0xb2bb('0x32')]=_[_0xb2bb('0x31')](_0x3d82c8[_0xb2bb('0x2d')],qs[_0xb2bb('0x33')](_0x48d96f[_0xb2bb('0x2e')]['fields']));_0x53e6aa[_0xb2bb('0x32')]=_0x53e6aa[_0xb2bb('0x32')][_0xb2bb('0x34')]?_0x53e6aa[_0xb2bb('0x32')]:_0x3d82c8[_0xb2bb('0x2d')];if(!_0x48d96f['query']['hasOwnProperty'](_0xb2bb('0x35'))){_0x53e6aa[_0xb2bb('0x1e')]=qs['limit'](_0x48d96f[_0xb2bb('0x2e')][_0xb2bb('0x1e')]);_0x53e6aa['offset']=qs[_0xb2bb('0x1c')](_0x48d96f['query'][_0xb2bb('0x1c')]);}_0x53e6aa[_0xb2bb('0x36')]=qs['sort'](_0x48d96f[_0xb2bb('0x2e')][_0xb2bb('0x37')]);_0x53e6aa[_0xb2bb('0x38')]=qs[_0xb2bb('0x30')](_['pick'](_0x48d96f[_0xb2bb('0x2e')],_0x3d82c8[_0xb2bb('0x30')]),_0x5719f3);if(_0x48d96f[_0xb2bb('0x2e')][_0xb2bb('0x39')]){_0x53e6aa[_0xb2bb('0x38')]=_[_0xb2bb('0x3a')](_0x53e6aa[_0xb2bb('0x38')],{'$or':_[_0xb2bb('0x29')](_0x5719f3,function(_0xa8e622){if(_0xa8e622['type']!==_0xb2bb('0x3b')){var _0x3e1ab8={};_0x3e1ab8[_0xa8e622[_0xb2bb('0x27')]]={'$like':'%'+_0x48d96f[_0xb2bb('0x2e')][_0xb2bb('0x39')]+'%'};return _0x3e1ab8;}})});}_0x53e6aa=_[_0xb2bb('0x3a')]({},_0x53e6aa,_0x48d96f[_0xb2bb('0x3c')]);var _0x185c68={'where':_0x53e6aa['where']};return db[_0xb2bb('0x3d')]['count'](_0x185c68)[_0xb2bb('0x23')](function(_0x18d464){_0x2b8ae3[_0xb2bb('0x1f')]=_0x18d464;if(_0x48d96f[_0xb2bb('0x2e')]['includeAll']){_0x53e6aa[_0xb2bb('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x53e6aa);})[_0xb2bb('0x23')](function(_0x51c19b){_0x2b8ae3[_0xb2bb('0x3f')]=_0x51c19b;return _0x2b8ae3;})['then'](respondWithFilteredResult(_0xf1ed22,_0x53e6aa))['catch'](handleError(_0xf1ed22,null));};exports['show']=function(_0x3a1220,_0x2fc06e){var _0x37dee5={'raw':!![],'where':{'id':_0x3a1220['params']['id']}},_0x5dab12={};_0x5dab12[_0xb2bb('0x2d')]=_[_0xb2bb('0x2f')](db['FaxQueueReport'][_0xb2bb('0x2a')]);_0x5dab12[_0xb2bb('0x2e')]=_['keys'](_0x3a1220[_0xb2bb('0x2e')]);_0x5dab12[_0xb2bb('0x30')]=_['intersection'](_0x5dab12['model'],_0x5dab12[_0xb2bb('0x2e')]);_0x37dee5[_0xb2bb('0x32')]=_[_0xb2bb('0x31')](_0x5dab12[_0xb2bb('0x2d')],qs['fields'](_0x3a1220[_0xb2bb('0x2e')][_0xb2bb('0x33')]));_0x37dee5[_0xb2bb('0x32')]=_0x37dee5[_0xb2bb('0x32')][_0xb2bb('0x34')]?_0x37dee5[_0xb2bb('0x32')]:_0x5dab12['model'];if(_0x3a1220[_0xb2bb('0x2e')]['includeAll']){_0x37dee5[_0xb2bb('0x3e')]=[{'all':!![]}];}_0x37dee5=_[_0xb2bb('0x3a')]({},_0x37dee5,_0x3a1220[_0xb2bb('0x3c')]);return db[_0xb2bb('0x3d')][_0xb2bb('0x40')](_0x37dee5)[_0xb2bb('0x23')](handleEntityNotFound(_0x2fc06e,null))[_0xb2bb('0x23')](respondWithResult(_0x2fc06e,null))[_0xb2bb('0x41')](handleError(_0x2fc06e,null));};exports['create']=function(_0x764d07,_0x4e70e3){return db[_0xb2bb('0x3d')][_0xb2bb('0x42')](_0x764d07[_0xb2bb('0x43')],{})['then'](respondWithResult(_0x4e70e3,0xc9))[_0xb2bb('0x41')](handleError(_0x4e70e3,null));};exports[_0xb2bb('0x22')]=function(_0x4a3fb2,_0x47ac7d){if(_0x4a3fb2['body']['id']){delete _0x4a3fb2[_0xb2bb('0x43')]['id'];}return db['FaxQueueReport'][_0xb2bb('0x40')]({'where':{'id':_0x4a3fb2[_0xb2bb('0x44')]['id']}})['then'](handleEntityNotFound(_0x47ac7d,null))[_0xb2bb('0x23')](saveUpdates(_0x4a3fb2[_0xb2bb('0x43')],null))[_0xb2bb('0x23')](respondWithResult(_0x47ac7d,null))[_0xb2bb('0x41')](handleError(_0x47ac7d,null));};exports[_0xb2bb('0x45')]=function(_0xb883ef,_0x127666){return db['FaxQueueReport'][_0xb2bb('0x40')]({'where':{'id':_0xb883ef[_0xb2bb('0x44')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x127666,null))[_0xb2bb('0x23')](removeEntity(_0x127666,null))['catch'](handleError(_0x127666,null));};exports[_0xb2bb('0x46')]=function(_0x44e406,_0x59a1be){return db[_0xb2bb('0x3d')][_0xb2bb('0x46')]()[_0xb2bb('0x23')](respondWithResult(_0x59a1be,null))[_0xb2bb('0x41')](handleError(_0x59a1be,null));}; \ No newline at end of file +var _0x35a9=['send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x35a9,0x73));var _0x935a=function(_0x187077,_0x1b69e1){_0x187077=_0x187077-0x0;var _0x2a85aa=_0x35a9[_0x187077];return _0x2a85aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x935a('0x0'));var zipdir=require(_0x935a('0x1'));var jsonpatch=require(_0x935a('0x2'));var rp=require(_0x935a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x935a('0x4'));var util=require('util');var path=require(_0x935a('0x5'));var sox=require(_0x935a('0x6'));var csv=require(_0x935a('0x7'));var ejs=require(_0x935a('0x8'));var fs=require('fs');var fs_extra=require(_0x935a('0x9'));var _=require(_0x935a('0xa'));var squel=require(_0x935a('0xb'));var crypto=require(_0x935a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x935a('0xd'));var toCsv=require(_0x935a('0x7'));var querystring=require(_0x935a('0xe'));var Papa=require(_0x935a('0xf'));var Redis=require(_0x935a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x935a('0x11'));var as=require(_0x935a('0x12'));var hardwareService=require(_0x935a('0x13'));var logger=require('../../config/logger')(_0x935a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x935a('0x15'));var db=require(_0x935a('0x16'))['db'];function respondWithStatusCode(_0x1e5152,_0x441f98){_0x441f98=_0x441f98||0xcc;return function(_0x3ed7e0){if(_0x3ed7e0){return _0x1e5152[_0x935a('0x17')](_0x441f98);}return _0x1e5152[_0x935a('0x18')](_0x441f98)[_0x935a('0x19')]();};}function respondWithResult(_0x5e1131,_0x109a98){_0x109a98=_0x109a98||0xc8;return function(_0x304c38){if(_0x304c38){return _0x5e1131[_0x935a('0x18')](_0x109a98)[_0x935a('0x1a')](_0x304c38);}};}function respondWithFilteredResult(_0xeebc0c,_0x22ab95){return function(_0xf881d6){if(_0xf881d6){var _0x463db1=typeof _0x22ab95[_0x935a('0x1b')]===_0x935a('0x1c')&&typeof _0x22ab95['limit']===_0x935a('0x1c');var _0x2aab94=_0xf881d6[_0x935a('0x1d')];var _0x446232=_0x463db1?0x0:_0x22ab95[_0x935a('0x1b')];var _0x3bac3e=_0x463db1?_0xf881d6[_0x935a('0x1d')]:_0x22ab95['offset']+_0x22ab95[_0x935a('0x1e')];var _0x90ef4;if(_0x3bac3e>=_0x2aab94){_0x3bac3e=_0x2aab94;_0x90ef4=0xc8;}else{_0x90ef4=0xce;}_0xeebc0c[_0x935a('0x18')](_0x90ef4);return _0xeebc0c[_0x935a('0x1f')]('Content-Range',_0x446232+'-'+_0x3bac3e+'/'+_0x2aab94)[_0x935a('0x1a')](_0xf881d6);}return null;};}function patchUpdates(_0x2c6873){return function(_0x53267b){try{jsonpatch[_0x935a('0x20')](_0x53267b,_0x2c6873,!![]);}catch(_0x257eb9){return BPromise[_0x935a('0x21')](_0x257eb9);}return _0x53267b[_0x935a('0x22')]();};}function saveUpdates(_0xe04139,_0x490627){return function(_0x267c48){if(_0x267c48){return _0x267c48[_0x935a('0x23')](_0xe04139)[_0x935a('0x24')](function(_0x4dd7aa){return _0x4dd7aa;});}return null;};}function removeEntity(_0x13e62a,_0x413787){return function(_0x326246){if(_0x326246){return _0x326246[_0x935a('0x25')]()['then'](function(){_0x13e62a['status'](0xcc)[_0x935a('0x19')]();});}};}function handleEntityNotFound(_0x46b6b8,_0x5a29df){return function(_0xa2c3f5){if(!_0xa2c3f5){_0x46b6b8[_0x935a('0x17')](0x194);}return _0xa2c3f5;};}function handleError(_0x34fb6f,_0x33f8c3){_0x33f8c3=_0x33f8c3||0x1f4;return function(_0x45ffc1){logger[_0x935a('0x26')](_0x45ffc1[_0x935a('0x27')]);if(_0x45ffc1[_0x935a('0x28')]){delete _0x45ffc1[_0x935a('0x28')];}_0x34fb6f[_0x935a('0x18')](_0x33f8c3)[_0x935a('0x29')](_0x45ffc1);};}exports[_0x935a('0x2a')]=function(_0x595b1c,_0x39c72c){var _0x43d93b={},_0x18a9dc={},_0x4f53af={'count':0x0,'rows':[]};var _0x261a8a=_[_0x935a('0x2b')](db[_0x935a('0x2c')][_0x935a('0x2d')],function(_0x48c9b5){return{'name':_0x48c9b5[_0x935a('0x2e')],'type':_0x48c9b5[_0x935a('0x2f')][_0x935a('0x30')]};});_0x18a9dc[_0x935a('0x31')]=_['map'](_0x261a8a,'name');_0x18a9dc[_0x935a('0x32')]=_[_0x935a('0x33')](_0x595b1c['query']);_0x18a9dc['filters']=_[_0x935a('0x34')](_0x18a9dc[_0x935a('0x31')],_0x18a9dc['query']);_0x43d93b[_0x935a('0x35')]=_['intersection'](_0x18a9dc[_0x935a('0x31')],qs['fields'](_0x595b1c[_0x935a('0x32')][_0x935a('0x36')]));_0x43d93b['attributes']=_0x43d93b['attributes'][_0x935a('0x37')]?_0x43d93b[_0x935a('0x35')]:_0x18a9dc[_0x935a('0x31')];if(!_0x595b1c[_0x935a('0x32')][_0x935a('0x38')](_0x935a('0x39'))){_0x43d93b[_0x935a('0x1e')]=qs[_0x935a('0x1e')](_0x595b1c[_0x935a('0x32')][_0x935a('0x1e')]);_0x43d93b['offset']=qs['offset'](_0x595b1c['query'][_0x935a('0x1b')]);}_0x43d93b[_0x935a('0x3a')]=qs[_0x935a('0x3b')](_0x595b1c[_0x935a('0x32')][_0x935a('0x3b')]);_0x43d93b[_0x935a('0x3c')]=qs['filters'](_[_0x935a('0x3d')](_0x595b1c['query'],_0x18a9dc[_0x935a('0x3e')]),_0x261a8a);if(_0x595b1c[_0x935a('0x32')][_0x935a('0x3f')]){_0x43d93b[_0x935a('0x3c')]=_['merge'](_0x43d93b[_0x935a('0x3c')],{'$or':_[_0x935a('0x2b')](_0x261a8a,function(_0x319642){if(_0x319642[_0x935a('0x2f')]!==_0x935a('0x40')){var _0x4dc91c={};_0x4dc91c[_0x319642['name']]={'$like':'%'+_0x595b1c[_0x935a('0x32')][_0x935a('0x3f')]+'%'};return _0x4dc91c;}})});}_0x43d93b=_[_0x935a('0x41')]({},_0x43d93b,_0x595b1c[_0x935a('0x42')]);var _0x1a2ae6={'where':_0x43d93b[_0x935a('0x3c')]};return db[_0x935a('0x2c')][_0x935a('0x1d')](_0x1a2ae6)[_0x935a('0x24')](function(_0x20584f){_0x4f53af[_0x935a('0x1d')]=_0x20584f;if(_0x595b1c['query'][_0x935a('0x43')]){_0x43d93b['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x935a('0x44')](_0x43d93b);})['then'](function(_0x3f5653){_0x4f53af[_0x935a('0x45')]=_0x3f5653;return _0x4f53af;})[_0x935a('0x24')](respondWithFilteredResult(_0x39c72c,_0x43d93b))[_0x935a('0x46')](handleError(_0x39c72c,null));};exports[_0x935a('0x47')]=function(_0x43ea46,_0x329719){var _0x57f870={'raw':!![],'where':{'id':_0x43ea46['params']['id']}},_0x2d734d={};_0x2d734d[_0x935a('0x31')]=_[_0x935a('0x33')](db[_0x935a('0x2c')][_0x935a('0x2d')]);_0x2d734d[_0x935a('0x32')]=_[_0x935a('0x33')](_0x43ea46['query']);_0x2d734d[_0x935a('0x3e')]=_['intersection'](_0x2d734d[_0x935a('0x31')],_0x2d734d['query']);_0x57f870[_0x935a('0x35')]=_[_0x935a('0x34')](_0x2d734d['model'],qs[_0x935a('0x36')](_0x43ea46[_0x935a('0x32')][_0x935a('0x36')]));_0x57f870[_0x935a('0x35')]=_0x57f870[_0x935a('0x35')][_0x935a('0x37')]?_0x57f870['attributes']:_0x2d734d['model'];if(_0x43ea46[_0x935a('0x32')]['includeAll']){_0x57f870[_0x935a('0x48')]=[{'all':!![]}];}_0x57f870=_[_0x935a('0x41')]({},_0x57f870,_0x43ea46[_0x935a('0x42')]);return db[_0x935a('0x2c')][_0x935a('0x49')](_0x57f870)[_0x935a('0x24')](handleEntityNotFound(_0x329719,null))[_0x935a('0x24')](respondWithResult(_0x329719,null))[_0x935a('0x46')](handleError(_0x329719,null));};exports['create']=function(_0x27aa52,_0x21e2c3){return db[_0x935a('0x2c')][_0x935a('0x4a')](_0x27aa52[_0x935a('0x4b')],{})[_0x935a('0x24')](respondWithResult(_0x21e2c3,0xc9))[_0x935a('0x46')](handleError(_0x21e2c3,null));};exports[_0x935a('0x23')]=function(_0x479124,_0x23e85f){if(_0x479124['body']['id']){delete _0x479124['body']['id'];}return db['FaxQueueReport'][_0x935a('0x49')]({'where':{'id':_0x479124[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x23e85f,null))[_0x935a('0x24')](saveUpdates(_0x479124['body'],null))[_0x935a('0x24')](respondWithResult(_0x23e85f,null))['catch'](handleError(_0x23e85f,null));};exports['destroy']=function(_0x41c5dc,_0x17d5ef){return db[_0x935a('0x2c')][_0x935a('0x49')]({'where':{'id':_0x41c5dc[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x17d5ef,null))[_0x935a('0x24')](removeEntity(_0x17d5ef,null))['catch'](handleError(_0x17d5ef,null));};exports[_0x935a('0x4d')]=function(_0x209cd8,_0x5bde42){return db[_0x935a('0x2c')]['describe']()['then'](respondWithResult(_0x5bde42,null))['catch'](handleError(_0x5bde42,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ff2dda7..5bab051 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x3576c9,_0x5b211b){var _0x1b2d2d=function(_0x827a05){while(--_0x827a05){_0x3576c9['push'](_0x3576c9['shift']());}};_0x1b2d2d(++_0x5b211b);}(_0x5fc3,0xa8));var _0x35fc=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x5fc3[_0xe896bf];return _0x4c7a8a;};'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 +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x5fc3[_0x39cd3c];return _0x47a0ae;};'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 557fcc9..4f4c482 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 _0x74e1=['raw','UpdateFaxQueueReport','update','body','where','limit','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','options'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x74e1,0xe7));var _0x174e=function(_0x24a85d,_0x4a9727){_0x24a85d=_0x24a85d-0x0;var _0x38090c=_0x74e1[_0x24a85d];return _0x38090c;};'use strict';var _=require(_0x174e('0x0'));var util=require(_0x174e('0x1'));var moment=require(_0x174e('0x2'));var BPromise=require('bluebird');var rs=require(_0x174e('0x3'));var fs=require('fs');var Redis=require(_0x174e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x174e('0x5'));var logger=require(_0x174e('0x6'))(_0x174e('0x7'));var config=require(_0x174e('0x8'));var jayson=require(_0x174e('0x9'));var client=jayson['client'][_0x174e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x74487c,_0x5e46a1,_0x2b40ab){return new BPromise(function(_0x5965b3,_0x342e9e){return client['request'](_0x74487c,_0x2b40ab)[_0x174e('0xb')](function(_0x1c27b7){logger['info'](_0x174e('0xc'),_0x5e46a1,_0x174e('0xd'));logger[_0x174e('0xe')](_0x174e('0xf'),_0x5e46a1,_0x174e('0xd'),JSON['stringify'](_0x1c27b7));if(_0x1c27b7[_0x174e('0x10')]){if(_0x1c27b7[_0x174e('0x10')][_0x174e('0x11')]===0x1f4){logger[_0x174e('0x10')](_0x174e('0xc'),_0x5e46a1,_0x1c27b7[_0x174e('0x10')][_0x174e('0x12')]);return _0x342e9e(_0x1c27b7['error']['message']);}logger[_0x174e('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x5e46a1,_0x1c27b7[_0x174e('0x10')]['message']);return _0x5965b3(_0x1c27b7['error']['message']);}else{logger[_0x174e('0x13')](_0x174e('0xc'),_0x5e46a1,_0x174e('0xd'));_0x5965b3(_0x1c27b7[_0x174e('0x14')][_0x174e('0x12')]);}})[_0x174e('0x15')](function(_0x4c2ee2){logger[_0x174e('0x10')](_0x174e('0xc'),_0x5e46a1,_0x4c2ee2);_0x342e9e(_0x4c2ee2);});});}exports[_0x174e('0x16')]=function(_0x5417a0){var _0x433f8d=this;return new Promise(function(_0x5bd3d5,_0x493f1f){return db[_0x174e('0x17')]['create'](_0x5417a0['body'],{'raw':_0x5417a0[_0x174e('0x18')]?_0x5417a0[_0x174e('0x18')][_0x174e('0x19')]===undefined?!![]:![]:!![]})[_0x174e('0xb')](function(_0x6d8d4f){logger[_0x174e('0x13')]('CreateFaxQueueReport',_0x5417a0);logger[_0x174e('0xe')]('CreateFaxQueueReport',_0x5417a0,JSON['stringify'](_0x6d8d4f));_0x5bd3d5(_0x6d8d4f);})[_0x174e('0x15')](function(_0xcc929a){logger[_0x174e('0x10')](_0x174e('0x16'),_0xcc929a['message'],_0x5417a0);_0x493f1f(_0x433f8d[_0x174e('0x10')](0x1f4,_0xcc929a['message']));});});};exports[_0x174e('0x1a')]=function(_0x1d6fbb){var _0x2bc0d5=this;return new Promise(function(_0x5ad639,_0x34592b){return db[_0x174e('0x17')][_0x174e('0x1b')](_0x1d6fbb[_0x174e('0x1c')],{'raw':_0x1d6fbb['options']?_0x1d6fbb[_0x174e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d6fbb['options']?_0x1d6fbb[_0x174e('0x18')][_0x174e('0x1d')]||null:null,'attributes':_0x1d6fbb[_0x174e('0x18')]?_0x1d6fbb[_0x174e('0x18')]['attributes']||null:null,'limit':_0x1d6fbb['options']?_0x1d6fbb[_0x174e('0x18')][_0x174e('0x1e')]||null:null})[_0x174e('0xb')](function(_0x56a7ca){logger[_0x174e('0x13')](_0x174e('0x1a'),_0x1d6fbb);logger[_0x174e('0xe')](_0x174e('0x1a'),_0x1d6fbb,JSON[_0x174e('0x1f')](_0x56a7ca));_0x5ad639(_0x56a7ca);})['catch'](function(_0x314d70){logger[_0x174e('0x10')](_0x174e('0x1a'),_0x314d70[_0x174e('0x12')],_0x1d6fbb);_0x34592b(_0x2bc0d5['error'](0x1f4,_0x314d70[_0x174e('0x12')]));});});}; \ No newline at end of file +var _0x42c1=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1dffb9,_0x516fb0){var _0x38dc12=function(_0x1a2756){while(--_0x1a2756){_0x1dffb9['push'](_0x1dffb9['shift']());}};_0x38dc12(++_0x516fb0);}(_0x42c1,0x69));var _0x142c=function(_0x1e30fb,_0x79ff8e){_0x1e30fb=_0x1e30fb-0x0;var _0x3ffec9=_0x42c1[_0x1e30fb];return _0x3ffec9;};'use strict';var _=require(_0x142c('0x0'));var util=require(_0x142c('0x1'));var moment=require('moment');var BPromise=require(_0x142c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x142c('0x3'));var db=require(_0x142c('0x4'))['db'];var utils=require(_0x142c('0x5'));var logger=require('../../config/logger')(_0x142c('0x6'));var config=require(_0x142c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x142c('0x8')][_0x142c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf1c147,_0x491a47,_0x94839){return new BPromise(function(_0x1668a9,_0xae3e60){return client['request'](_0xf1c147,_0x94839)[_0x142c('0xa')](function(_0x158d14){logger[_0x142c('0xb')](_0x142c('0xc'),_0x491a47,_0x142c('0xd'));logger[_0x142c('0xe')](_0x142c('0xf'),_0x491a47,_0x142c('0xd'),JSON[_0x142c('0x10')](_0x158d14));if(_0x158d14['error']){if(_0x158d14[_0x142c('0x11')]['code']===0x1f4){logger[_0x142c('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x491a47,_0x158d14[_0x142c('0x11')]['message']);return _0xae3e60(_0x158d14[_0x142c('0x11')][_0x142c('0x12')]);}logger[_0x142c('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x491a47,_0x158d14[_0x142c('0x11')][_0x142c('0x12')]);return _0x1668a9(_0x158d14['error'][_0x142c('0x12')]);}else{logger[_0x142c('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x491a47,_0x142c('0xd'));_0x1668a9(_0x158d14[_0x142c('0x13')]['message']);}})[_0x142c('0x14')](function(_0x14c32a){logger[_0x142c('0x11')](_0x142c('0xc'),_0x491a47,_0x14c32a);_0xae3e60(_0x14c32a);});});}exports[_0x142c('0x15')]=function(_0x55113d){var _0x3bc11f=this;return new Promise(function(_0x19cf5a,_0x59c9f3){return db[_0x142c('0x16')][_0x142c('0x17')](_0x55113d[_0x142c('0x18')],{'raw':_0x55113d['options']?_0x55113d[_0x142c('0x19')][_0x142c('0x1a')]===undefined?!![]:![]:!![]})[_0x142c('0xa')](function(_0x2cb514){logger[_0x142c('0xb')](_0x142c('0x15'),_0x55113d);logger[_0x142c('0xe')](_0x142c('0x15'),_0x55113d,JSON['stringify'](_0x2cb514));_0x19cf5a(_0x2cb514);})[_0x142c('0x14')](function(_0x3d4ca3){logger['error']('CreateFaxQueueReport',_0x3d4ca3[_0x142c('0x12')],_0x55113d);_0x59c9f3(_0x3bc11f[_0x142c('0x11')](0x1f4,_0x3d4ca3[_0x142c('0x12')]));});});};exports[_0x142c('0x1b')]=function(_0x1f5f41){var _0x39f5af=this;return new Promise(function(_0x417684,_0x5e2e9a){return db[_0x142c('0x16')]['update'](_0x1f5f41[_0x142c('0x18')],{'raw':_0x1f5f41['options']?_0x1f5f41['options'][_0x142c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f5f41['options']?_0x1f5f41[_0x142c('0x19')]['where']||null:null,'attributes':_0x1f5f41[_0x142c('0x19')]?_0x1f5f41[_0x142c('0x19')][_0x142c('0x1c')]||null:null,'limit':_0x1f5f41[_0x142c('0x19')]?_0x1f5f41[_0x142c('0x19')][_0x142c('0x1d')]||null:null})[_0x142c('0xa')](function(_0x21af20){logger[_0x142c('0xb')](_0x142c('0x1b'),_0x1f5f41);logger[_0x142c('0xe')](_0x142c('0x1b'),_0x1f5f41,JSON[_0x142c('0x10')](_0x21af20));_0x417684(_0x21af20);})[_0x142c('0x14')](function(_0x3812e2){logger[_0x142c('0x11')]('UpdateFaxQueueReport',_0x3812e2[_0x142c('0x12')],_0x1f5f41);_0x5e2e9a(_0x39f5af['error'](0x1f4,_0x3812e2[_0x142c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2defe2b..a60d1a8 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 _0x559b=['get','index','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x549d61,_0x1ea8fd){var _0x34df79=function(_0x1e0560){while(--_0x1e0560){_0x549d61['push'](_0x549d61['shift']());}};_0x34df79(++_0x1ea8fd);}(_0x559b,0x186));var _0xb559=function(_0x5b7a60,_0xcc49ed){_0x5b7a60=_0x5b7a60-0x0;var _0x34b236=_0x559b[_0x5b7a60];return _0x34b236;};'use strict';var multer=require(_0xb559('0x0'));var util=require(_0xb559('0x1'));var path=require(_0xb559('0x2'));var timeout=require(_0xb559('0x3'));var express=require(_0xb559('0x4'));var router=express['Router']();var fs_extra=require(_0xb559('0x5'));var auth=require(_0xb559('0x6'));var interaction=require(_0xb559('0x7'));var config=require(_0xb559('0x8'));var controller=require('./faxQueueReport.controller');router[_0xb559('0x9')]('/',auth['isAuthenticated'](),controller[_0xb559('0xa')]);router['get']('/describe',auth[_0xb559('0xb')](),controller[_0xb559('0xc')]);router['get'](_0xb559('0xd'),auth['isAuthenticated'](),controller[_0xb559('0xe')]);router[_0xb559('0xf')]('/',auth['isAuthenticated'](),controller[_0xb559('0x10')]);router['put'](_0xb559('0xd'),auth[_0xb559('0xb')](),controller[_0xb559('0x11')]);router[_0xb559('0x12')](_0xb559('0xd'),auth[_0xb559('0xb')](),controller[_0xb559('0x13')]);module[_0xb559('0x14')]=router; \ No newline at end of file +var _0xc89a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x1896b8,_0x350017){var _0x3d34df=function(_0x43d9d7){while(--_0x43d9d7){_0x1896b8['push'](_0x1896b8['shift']());}};_0x3d34df(++_0x350017);}(_0xc89a,0x1a3));var _0xac89=function(_0x464f3b,_0x5c5db2){_0x464f3b=_0x464f3b-0x0;var _0x5e861d=_0xc89a[_0x464f3b];return _0x5e861d;};'use strict';var multer=require(_0xac89('0x0'));var util=require(_0xac89('0x1'));var path=require(_0xac89('0x2'));var timeout=require(_0xac89('0x3'));var express=require(_0xac89('0x4'));var router=express[_0xac89('0x5')]();var fs_extra=require(_0xac89('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xac89('0x7'));var config=require(_0xac89('0x8'));var controller=require(_0xac89('0x9'));router[_0xac89('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xac89('0xa')](_0xac89('0xb'),auth[_0xac89('0xc')](),controller[_0xac89('0xd')]);router[_0xac89('0xa')](_0xac89('0xe'),auth[_0xac89('0xc')](),controller[_0xac89('0xf')]);router[_0xac89('0x10')]('/',auth[_0xac89('0xc')](),controller[_0xac89('0x11')]);router['put'](_0xac89('0xe'),auth['isAuthenticated'](),controller[_0xac89('0x12')]);router[_0xac89('0x13')](_0xac89('0xe'),auth[_0xac89('0xc')](),controller[_0xac89('0x14')]);module[_0xac89('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e63e626..dba2b2f 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x35e6ca,_0x54939f){var _0x239e43=function(_0x3ea90d){while(--_0x3ea90d){_0x35e6ca['push'](_0x35e6ca['shift']());}};_0x239e43(++_0x54939f);}(_0x54ef,0x112));var _0xf54e=function(_0x46d9b6,_0x2ad5be){_0x46d9b6=_0x46d9b6-0x0;var _0x52cbda=_0x54ef[_0x46d9b6];return _0x52cbda;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4684af,_0x34880f){var _0x3bb413=function(_0x600b5a){while(--_0x600b5a){_0x4684af['push'](_0x4684af['shift']());}};_0x3bb413(++_0x34880f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b2cb44c..232e0e2 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 _0x2eeb=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','reject','error','name','send','index','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','FaxTransferReport','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','destroy','describe','zip-dir','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x2eeb,0xbd));var _0xb2ee=function(_0x326406,_0x5aa772){_0x326406=_0x326406-0x0;var _0x30abe7=_0x2eeb[_0x326406];return _0x30abe7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb2ee('0x0'));var jsonpatch=require(_0xb2ee('0x1'));var rp=require('request-promise');var moment=require(_0xb2ee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb2ee('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb2ee('0x4'));var ejs=require(_0xb2ee('0x5'));var fs=require('fs');var fs_extra=require(_0xb2ee('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb2ee('0x7'));var jsforce=require(_0xb2ee('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xb2ee('0x4'));var querystring=require(_0xb2ee('0x9'));var Papa=require(_0xb2ee('0xa'));var Redis=require(_0xb2ee('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb2ee('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2ee('0xd'))(_0xb2ee('0xe'));var utils=require(_0xb2ee('0xf'));var config=require(_0xb2ee('0x10'));var licenseUtil=require(_0xb2ee('0x11'));var db=require(_0xb2ee('0x12'))['db'];function respondWithStatusCode(_0x3fd763,_0x2ab29b){_0x2ab29b=_0x2ab29b||0xcc;return function(_0x52d976){if(_0x52d976){return _0x3fd763['sendStatus'](_0x2ab29b);}return _0x3fd763[_0xb2ee('0x13')](_0x2ab29b)[_0xb2ee('0x14')]();};}function respondWithResult(_0x265efe,_0x23ea0e){_0x23ea0e=_0x23ea0e||0xc8;return function(_0x3d76fd){if(_0x3d76fd){return _0x265efe[_0xb2ee('0x13')](_0x23ea0e)['json'](_0x3d76fd);}};}function respondWithFilteredResult(_0x3f330c,_0x46d13c){return function(_0x1f8be3){if(_0x1f8be3){var _0x23515d=typeof _0x46d13c[_0xb2ee('0x15')]==='undefined'&&typeof _0x46d13c['limit']===_0xb2ee('0x16');var _0x20f989=_0x1f8be3[_0xb2ee('0x17')];var _0x30e3fb=_0x23515d?0x0:_0x46d13c[_0xb2ee('0x15')];var _0x566d49=_0x23515d?_0x1f8be3['count']:_0x46d13c['offset']+_0x46d13c[_0xb2ee('0x18')];var _0x1d0990;if(_0x566d49>=_0x20f989){_0x566d49=_0x20f989;_0x1d0990=0xc8;}else{_0x1d0990=0xce;}_0x3f330c['status'](_0x1d0990);return _0x3f330c[_0xb2ee('0x19')](_0xb2ee('0x1a'),_0x30e3fb+'-'+_0x566d49+'/'+_0x20f989)['json'](_0x1f8be3);}return null;};}function patchUpdates(_0x3b5126){return function(_0x3b33b4){try{jsonpatch['apply'](_0x3b33b4,_0x3b5126,!![]);}catch(_0x19282a){return BPromise[_0xb2ee('0x1b')](_0x19282a);}return _0x3b33b4['save']();};}function saveUpdates(_0x3028c7,_0x48f525){return function(_0x554ec5){if(_0x554ec5){return _0x554ec5['update'](_0x3028c7)['then'](function(_0xde806){return _0xde806;});}return null;};}function removeEntity(_0xcc7d,_0x433cb0){return function(_0x3a3cbf){if(_0x3a3cbf){return _0x3a3cbf['destroy']()['then'](function(){_0xcc7d[_0xb2ee('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x144a54,_0x15e56b){return function(_0x34c5e6){if(!_0x34c5e6){_0x144a54['sendStatus'](0x194);}return _0x34c5e6;};}function handleError(_0x1074f7,_0x1a0c7d){_0x1a0c7d=_0x1a0c7d||0x1f4;return function(_0x2932e7){logger[_0xb2ee('0x1c')](_0x2932e7['stack']);if(_0x2932e7[_0xb2ee('0x1d')]){delete _0x2932e7[_0xb2ee('0x1d')];}_0x1074f7[_0xb2ee('0x13')](_0x1a0c7d)[_0xb2ee('0x1e')](_0x2932e7);};}exports[_0xb2ee('0x1f')]=function(_0x403d9b,_0x1a70bd){var _0x517686={},_0x1d3557={},_0x2e700c={'count':0x0,'rows':[]};var _0x27a076=_['map'](db['FaxTransferReport'][_0xb2ee('0x20')],function(_0x57b3ee){return{'name':_0x57b3ee[_0xb2ee('0x21')],'type':_0x57b3ee[_0xb2ee('0x22')]['key']};});_0x1d3557[_0xb2ee('0x23')]=_['map'](_0x27a076,_0xb2ee('0x1d'));_0x1d3557['query']=_[_0xb2ee('0x24')](_0x403d9b[_0xb2ee('0x25')]);_0x1d3557[_0xb2ee('0x26')]=_[_0xb2ee('0x27')](_0x1d3557[_0xb2ee('0x23')],_0x1d3557[_0xb2ee('0x25')]);_0x517686[_0xb2ee('0x28')]=_[_0xb2ee('0x27')](_0x1d3557[_0xb2ee('0x23')],qs[_0xb2ee('0x29')](_0x403d9b['query'][_0xb2ee('0x29')]));_0x517686[_0xb2ee('0x28')]=_0x517686[_0xb2ee('0x28')][_0xb2ee('0x2a')]?_0x517686[_0xb2ee('0x28')]:_0x1d3557[_0xb2ee('0x23')];if(!_0x403d9b[_0xb2ee('0x25')]['hasOwnProperty'](_0xb2ee('0x2b'))){_0x517686[_0xb2ee('0x18')]=qs[_0xb2ee('0x18')](_0x403d9b['query'][_0xb2ee('0x18')]);_0x517686[_0xb2ee('0x15')]=qs[_0xb2ee('0x15')](_0x403d9b[_0xb2ee('0x25')][_0xb2ee('0x15')]);}_0x517686[_0xb2ee('0x2c')]=qs[_0xb2ee('0x2d')](_0x403d9b[_0xb2ee('0x25')]['sort']);_0x517686[_0xb2ee('0x2e')]=qs['filters'](_['pick'](_0x403d9b['query'],_0x1d3557[_0xb2ee('0x26')]),_0x27a076);if(_0x403d9b[_0xb2ee('0x25')][_0xb2ee('0x2f')]){_0x517686[_0xb2ee('0x2e')]=_[_0xb2ee('0x30')](_0x517686[_0xb2ee('0x2e')],{'$or':_[_0xb2ee('0x31')](_0x27a076,function(_0x14b6b3){if(_0x14b6b3[_0xb2ee('0x22')]!==_0xb2ee('0x32')){var _0x30b5b8={};_0x30b5b8[_0x14b6b3[_0xb2ee('0x1d')]]={'$like':'%'+_0x403d9b[_0xb2ee('0x25')]['filter']+'%'};return _0x30b5b8;}})});}_0x517686=_[_0xb2ee('0x30')]({},_0x517686,_0x403d9b[_0xb2ee('0x33')]);var _0x39fe25={'where':_0x517686['where']};return db[_0xb2ee('0x34')][_0xb2ee('0x17')](_0x39fe25)[_0xb2ee('0x35')](function(_0x61dc4d){_0x2e700c[_0xb2ee('0x17')]=_0x61dc4d;if(_0x403d9b[_0xb2ee('0x25')]['includeAll']){_0x517686[_0xb2ee('0x36')]=[{'all':!![]}];}return db[_0xb2ee('0x34')][_0xb2ee('0x37')](_0x517686);})[_0xb2ee('0x35')](function(_0x20451b){_0x2e700c[_0xb2ee('0x38')]=_0x20451b;return _0x2e700c;})[_0xb2ee('0x35')](respondWithFilteredResult(_0x1a70bd,_0x517686))[_0xb2ee('0x39')](handleError(_0x1a70bd,null));};exports[_0xb2ee('0x3a')]=function(_0x219f99,_0x19e6ec){var _0x3ef453={'raw':!![],'where':{'id':_0x219f99[_0xb2ee('0x3b')]['id']}},_0x17b726={};_0x17b726['model']=_[_0xb2ee('0x24')](db[_0xb2ee('0x34')][_0xb2ee('0x20')]);_0x17b726[_0xb2ee('0x25')]=_[_0xb2ee('0x24')](_0x219f99[_0xb2ee('0x25')]);_0x17b726[_0xb2ee('0x26')]=_[_0xb2ee('0x27')](_0x17b726[_0xb2ee('0x23')],_0x17b726[_0xb2ee('0x25')]);_0x3ef453[_0xb2ee('0x28')]=_[_0xb2ee('0x27')](_0x17b726[_0xb2ee('0x23')],qs[_0xb2ee('0x29')](_0x219f99['query'][_0xb2ee('0x29')]));_0x3ef453[_0xb2ee('0x28')]=_0x3ef453[_0xb2ee('0x28')][_0xb2ee('0x2a')]?_0x3ef453['attributes']:_0x17b726[_0xb2ee('0x23')];if(_0x219f99[_0xb2ee('0x25')][_0xb2ee('0x3c')]){_0x3ef453[_0xb2ee('0x36')]=[{'all':!![]}];}_0x3ef453=_[_0xb2ee('0x30')]({},_0x3ef453,_0x219f99[_0xb2ee('0x33')]);return db['FaxTransferReport'][_0xb2ee('0x3d')](_0x3ef453)[_0xb2ee('0x35')](handleEntityNotFound(_0x19e6ec,null))['then'](respondWithResult(_0x19e6ec,null))['catch'](handleError(_0x19e6ec,null));};exports[_0xb2ee('0x3e')]=function(_0x5aa3eb,_0x54bf58){return db['FaxTransferReport'][_0xb2ee('0x3e')](_0x5aa3eb[_0xb2ee('0x3f')],{})['then'](respondWithResult(_0x54bf58,0xc9))[_0xb2ee('0x39')](handleError(_0x54bf58,null));};exports[_0xb2ee('0x40')]=function(_0x5df7fe,_0x3e95d2){if(_0x5df7fe[_0xb2ee('0x3f')]['id']){delete _0x5df7fe[_0xb2ee('0x3f')]['id'];}return db[_0xb2ee('0x34')][_0xb2ee('0x3d')]({'where':{'id':_0x5df7fe[_0xb2ee('0x3b')]['id']}})[_0xb2ee('0x35')](handleEntityNotFound(_0x3e95d2,null))[_0xb2ee('0x35')](saveUpdates(_0x5df7fe[_0xb2ee('0x3f')],null))['then'](respondWithResult(_0x3e95d2,null))[_0xb2ee('0x39')](handleError(_0x3e95d2,null));};exports[_0xb2ee('0x41')]=function(_0x4b5cd4,_0x24696c){return db[_0xb2ee('0x34')][_0xb2ee('0x3d')]({'where':{'id':_0x4b5cd4['params']['id']}})['then'](handleEntityNotFound(_0x24696c,null))[_0xb2ee('0x35')](removeEntity(_0x24696c,null))[_0xb2ee('0x39')](handleError(_0x24696c,null));};exports[_0xb2ee('0x42')]=function(_0x2385ba,_0x340288){return db[_0xb2ee('0x34')][_0xb2ee('0x42')]()['then'](respondWithResult(_0x340288,null))['catch'](handleError(_0x340288,null));}; \ No newline at end of file +var _0x09e1=['status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','fields','includeAll','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x31e9e2,_0x1445c7){var _0x4728c1=function(_0x456d6c){while(--_0x456d6c){_0x31e9e2['push'](_0x31e9e2['shift']());}};_0x4728c1(++_0x1445c7);}(_0x09e1,0x7b));var _0x109e=function(_0xd0fc05,_0x367594){_0xd0fc05=_0xd0fc05-0x0;var _0x5818ad=_0x09e1[_0xd0fc05];return _0x5818ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x109e('0x0'));var jsonpatch=require(_0x109e('0x1'));var rp=require('request-promise');var moment=require(_0x109e('0x2'));var BPromise=require(_0x109e('0x3'));var Mustache=require(_0x109e('0x4'));var util=require(_0x109e('0x5'));var path=require(_0x109e('0x6'));var sox=require(_0x109e('0x7'));var csv=require(_0x109e('0x8'));var ejs=require(_0x109e('0x9'));var fs=require('fs');var fs_extra=require(_0x109e('0xa'));var _=require(_0x109e('0xb'));var squel=require(_0x109e('0xc'));var crypto=require(_0x109e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x109e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x109e('0xf'));var Papa=require(_0x109e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x109e('0x11'));var as=require(_0x109e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x109e('0x13'))(_0x109e('0x14'));var utils=require('../../config/utils');var config=require(_0x109e('0x15'));var licenseUtil=require(_0x109e('0x16'));var db=require(_0x109e('0x17'))['db'];function respondWithStatusCode(_0x2192eb,_0x522ce9){_0x522ce9=_0x522ce9||0xcc;return function(_0x1c7b83){if(_0x1c7b83){return _0x2192eb[_0x109e('0x18')](_0x522ce9);}return _0x2192eb[_0x109e('0x19')](_0x522ce9)[_0x109e('0x1a')]();};}function respondWithResult(_0xf93a7e,_0x202825){_0x202825=_0x202825||0xc8;return function(_0x24ca02){if(_0x24ca02){return _0xf93a7e[_0x109e('0x19')](_0x202825)[_0x109e('0x1b')](_0x24ca02);}};}function respondWithFilteredResult(_0x5dc47a,_0x1546ef){return function(_0x48b6e1){if(_0x48b6e1){var _0x4afe8e=typeof _0x1546ef[_0x109e('0x1c')]===_0x109e('0x1d')&&typeof _0x1546ef[_0x109e('0x1e')]===_0x109e('0x1d');var _0x29bf6b=_0x48b6e1[_0x109e('0x1f')];var _0xffc19=_0x4afe8e?0x0:_0x1546ef[_0x109e('0x1c')];var _0x1d97b6=_0x4afe8e?_0x48b6e1[_0x109e('0x1f')]:_0x1546ef['offset']+_0x1546ef[_0x109e('0x1e')];var _0x52be15;if(_0x1d97b6>=_0x29bf6b){_0x1d97b6=_0x29bf6b;_0x52be15=0xc8;}else{_0x52be15=0xce;}_0x5dc47a[_0x109e('0x19')](_0x52be15);return _0x5dc47a[_0x109e('0x20')]('Content-Range',_0xffc19+'-'+_0x1d97b6+'/'+_0x29bf6b)[_0x109e('0x1b')](_0x48b6e1);}return null;};}function patchUpdates(_0x2a6700){return function(_0x312389){try{jsonpatch[_0x109e('0x21')](_0x312389,_0x2a6700,!![]);}catch(_0x10691a){return BPromise['reject'](_0x10691a);}return _0x312389['save']();};}function saveUpdates(_0x38fbc6,_0x3ad154){return function(_0x41ebbb){if(_0x41ebbb){return _0x41ebbb[_0x109e('0x22')](_0x38fbc6)[_0x109e('0x23')](function(_0x2f4c5d){return _0x2f4c5d;});}return null;};}function removeEntity(_0x3bfe70,_0x35036b){return function(_0x3ab336){if(_0x3ab336){return _0x3ab336['destroy']()[_0x109e('0x23')](function(){_0x3bfe70[_0x109e('0x19')](0xcc)[_0x109e('0x1a')]();});}};}function handleEntityNotFound(_0x5be022,_0x4cccb8){return function(_0x750e90){if(!_0x750e90){_0x5be022[_0x109e('0x18')](0x194);}return _0x750e90;};}function handleError(_0x33be40,_0x2f2dfe){_0x2f2dfe=_0x2f2dfe||0x1f4;return function(_0x19047c){logger[_0x109e('0x24')](_0x19047c[_0x109e('0x25')]);if(_0x19047c[_0x109e('0x26')]){delete _0x19047c['name'];}_0x33be40[_0x109e('0x19')](_0x2f2dfe)['send'](_0x19047c);};}exports[_0x109e('0x27')]=function(_0x56ebf5,_0x42d17b){var _0x527225={},_0x5e00a3={},_0x5bb4b5={'count':0x0,'rows':[]};var _0x1f9b62=_[_0x109e('0x28')](db[_0x109e('0x29')][_0x109e('0x2a')],function(_0x2c0433){return{'name':_0x2c0433[_0x109e('0x2b')],'type':_0x2c0433[_0x109e('0x2c')]['key']};});_0x5e00a3[_0x109e('0x2d')]=_[_0x109e('0x28')](_0x1f9b62,'name');_0x5e00a3[_0x109e('0x2e')]=_['keys'](_0x56ebf5[_0x109e('0x2e')]);_0x5e00a3[_0x109e('0x2f')]=_[_0x109e('0x30')](_0x5e00a3[_0x109e('0x2d')],_0x5e00a3[_0x109e('0x2e')]);_0x527225[_0x109e('0x31')]=_[_0x109e('0x30')](_0x5e00a3[_0x109e('0x2d')],qs['fields'](_0x56ebf5[_0x109e('0x2e')]['fields']));_0x527225[_0x109e('0x31')]=_0x527225[_0x109e('0x31')][_0x109e('0x32')]?_0x527225['attributes']:_0x5e00a3[_0x109e('0x2d')];if(!_0x56ebf5[_0x109e('0x2e')][_0x109e('0x33')](_0x109e('0x34'))){_0x527225[_0x109e('0x1e')]=qs[_0x109e('0x1e')](_0x56ebf5[_0x109e('0x2e')][_0x109e('0x1e')]);_0x527225[_0x109e('0x1c')]=qs[_0x109e('0x1c')](_0x56ebf5[_0x109e('0x2e')][_0x109e('0x1c')]);}_0x527225[_0x109e('0x35')]=qs[_0x109e('0x36')](_0x56ebf5[_0x109e('0x2e')][_0x109e('0x36')]);_0x527225['where']=qs[_0x109e('0x2f')](_[_0x109e('0x37')](_0x56ebf5[_0x109e('0x2e')],_0x5e00a3['filters']),_0x1f9b62);if(_0x56ebf5[_0x109e('0x2e')][_0x109e('0x38')]){_0x527225[_0x109e('0x39')]=_['merge'](_0x527225['where'],{'$or':_[_0x109e('0x28')](_0x1f9b62,function(_0x20c95f){if(_0x20c95f['type']!==_0x109e('0x3a')){var _0x2ef322={};_0x2ef322[_0x20c95f[_0x109e('0x26')]]={'$like':'%'+_0x56ebf5[_0x109e('0x2e')][_0x109e('0x38')]+'%'};return _0x2ef322;}})});}_0x527225=_[_0x109e('0x3b')]({},_0x527225,_0x56ebf5[_0x109e('0x3c')]);var _0x4c13a6={'where':_0x527225['where']};return db[_0x109e('0x29')]['count'](_0x4c13a6)[_0x109e('0x23')](function(_0xc153f){_0x5bb4b5[_0x109e('0x1f')]=_0xc153f;if(_0x56ebf5['query']['includeAll']){_0x527225[_0x109e('0x3d')]=[{'all':!![]}];}return db[_0x109e('0x29')][_0x109e('0x3e')](_0x527225);})[_0x109e('0x23')](function(_0x369a3f){_0x5bb4b5['rows']=_0x369a3f;return _0x5bb4b5;})['then'](respondWithFilteredResult(_0x42d17b,_0x527225))[_0x109e('0x3f')](handleError(_0x42d17b,null));};exports[_0x109e('0x40')]=function(_0x11e330,_0x5313c8){var _0x294b0d={'raw':!![],'where':{'id':_0x11e330[_0x109e('0x41')]['id']}},_0x3b3fef={};_0x3b3fef[_0x109e('0x2d')]=_[_0x109e('0x42')](db['FaxTransferReport'][_0x109e('0x2a')]);_0x3b3fef['query']=_[_0x109e('0x42')](_0x11e330[_0x109e('0x2e')]);_0x3b3fef[_0x109e('0x2f')]=_['intersection'](_0x3b3fef[_0x109e('0x2d')],_0x3b3fef[_0x109e('0x2e')]);_0x294b0d[_0x109e('0x31')]=_[_0x109e('0x30')](_0x3b3fef['model'],qs[_0x109e('0x43')](_0x11e330['query']['fields']));_0x294b0d[_0x109e('0x31')]=_0x294b0d[_0x109e('0x31')][_0x109e('0x32')]?_0x294b0d[_0x109e('0x31')]:_0x3b3fef['model'];if(_0x11e330['query'][_0x109e('0x44')]){_0x294b0d[_0x109e('0x3d')]=[{'all':!![]}];}_0x294b0d=_[_0x109e('0x3b')]({},_0x294b0d,_0x11e330[_0x109e('0x3c')]);return db[_0x109e('0x29')][_0x109e('0x45')](_0x294b0d)[_0x109e('0x23')](handleEntityNotFound(_0x5313c8,null))['then'](respondWithResult(_0x5313c8,null))[_0x109e('0x3f')](handleError(_0x5313c8,null));};exports[_0x109e('0x46')]=function(_0x2d77ea,_0x2c56da){return db[_0x109e('0x29')][_0x109e('0x46')](_0x2d77ea[_0x109e('0x47')],{})[_0x109e('0x23')](respondWithResult(_0x2c56da,0xc9))[_0x109e('0x3f')](handleError(_0x2c56da,null));};exports['update']=function(_0x53a1c8,_0x1404dc){if(_0x53a1c8[_0x109e('0x47')]['id']){delete _0x53a1c8[_0x109e('0x47')]['id'];}return db[_0x109e('0x29')][_0x109e('0x45')]({'where':{'id':_0x53a1c8[_0x109e('0x41')]['id']}})[_0x109e('0x23')](handleEntityNotFound(_0x1404dc,null))[_0x109e('0x23')](saveUpdates(_0x53a1c8[_0x109e('0x47')],null))['then'](respondWithResult(_0x1404dc,null))[_0x109e('0x3f')](handleError(_0x1404dc,null));};exports[_0x109e('0x48')]=function(_0x55374b,_0xc9d558){return db[_0x109e('0x29')][_0x109e('0x45')]({'where':{'id':_0x55374b['params']['id']}})[_0x109e('0x23')](handleEntityNotFound(_0xc9d558,null))['then'](removeEntity(_0xc9d558,null))[_0x109e('0x3f')](handleError(_0xc9d558,null));};exports[_0x109e('0x49')]=function(_0x4cf0b8,_0x120f69){return db[_0x109e('0x29')][_0x109e('0x49')]()[_0x109e('0x23')](respondWithResult(_0x120f69,null))[_0x109e('0x3f')](handleError(_0x120f69,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7964ed0..f7bd820 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 _0x8fdb=['bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8fdb,0xe9));var _0xb8fd=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x8fdb[_0x5b7788];return _0x573871;};'use strict';var _=require(_0xb8fd('0x0'));var util=require(_0xb8fd('0x1'));var logger=require(_0xb8fd('0x2'))(_0xb8fd('0x3'));var moment=require(_0xb8fd('0x4'));var BPromise=require(_0xb8fd('0x5'));var rp=require(_0xb8fd('0x6'));var fs=require('fs');var path=require(_0xb8fd('0x7'));var rimraf=require(_0xb8fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb8fd('0x9'));module[_0xb8fd('0xa')]=function(_0x1de637,_0x1b27f6){return _0x1de637['define'](_0xb8fd('0xb'),attributes,{'tableName':_0xb8fd('0xc'),'paranoid':![],'indexes':[{'name':_0xb8fd('0xd'),'fields':[_0xb8fd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbae8=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','lodash'];(function(_0xf8821a,_0x140c15){var _0x35da95=function(_0x225a49){while(--_0x225a49){_0xf8821a['push'](_0xf8821a['shift']());}};_0x35da95(++_0x140c15);}(_0xbae8,0x195));var _0x8bae=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xbae8[_0x12a2a6];return _0x1754ae;};'use strict';var _=require(_0x8bae('0x0'));var util=require(_0x8bae('0x1'));var logger=require(_0x8bae('0x2'))(_0x8bae('0x3'));var moment=require('moment');var BPromise=require(_0x8bae('0x4'));var rp=require(_0x8bae('0x5'));var fs=require('fs');var path=require(_0x8bae('0x6'));var rimraf=require(_0x8bae('0x7'));var config=require(_0x8bae('0x8'));var attributes=require(_0x8bae('0x9'));module[_0x8bae('0xa')]=function(_0x55c816,_0x4d13fa){return _0x55c816[_0x8bae('0xb')](_0x8bae('0xc'),attributes,{'tableName':_0x8bae('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 27b0584..969b46e 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 _0x6ef4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x5ea9f6,_0x32baa1){var _0x46a222=function(_0x21f2ce){while(--_0x21f2ce){_0x5ea9f6['push'](_0x5ea9f6['shift']());}};_0x46a222(++_0x32baa1);}(_0x6ef4,0x1df));var _0x46ef=function(_0x27fc86,_0x59cd0c){_0x27fc86=_0x27fc86-0x0;var _0x20e800=_0x6ef4[_0x27fc86];return _0x20e800;};'use strict';var _=require(_0x46ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x46ef('0x1'));var fs=require('fs');var Redis=require(_0x46ef('0x2'));var db=require(_0x46ef('0x3'))['db'];var utils=require(_0x46ef('0x4'));var logger=require(_0x46ef('0x5'))('rpc');var config=require(_0x46ef('0x6'));var jayson=require(_0x46ef('0x7'));var client=jayson['client'][_0x46ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31c34f,_0x4652de,_0x24880e){return new BPromise(function(_0x2af5d5,_0x4841e9){return client[_0x46ef('0x9')](_0x31c34f,_0x24880e)[_0x46ef('0xa')](function(_0xb2c952){logger[_0x46ef('0xb')](_0x46ef('0xc'),_0x4652de,_0x46ef('0xd'));logger[_0x46ef('0xe')](_0x46ef('0xf'),_0x4652de,_0x46ef('0xd'),JSON['stringify'](_0xb2c952));if(_0xb2c952['error']){if(_0xb2c952[_0x46ef('0x10')]['code']===0x1f4){logger['error'](_0x46ef('0xc'),_0x4652de,_0xb2c952[_0x46ef('0x10')]['message']);return _0x4841e9(_0xb2c952[_0x46ef('0x10')][_0x46ef('0x11')]);}logger[_0x46ef('0x10')](_0x46ef('0xc'),_0x4652de,_0xb2c952['error']['message']);return _0x2af5d5(_0xb2c952[_0x46ef('0x10')]['message']);}else{logger[_0x46ef('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x4652de,_0x46ef('0xd'));_0x2af5d5(_0xb2c952[_0x46ef('0x12')][_0x46ef('0x11')]);}})[_0x46ef('0x13')](function(_0x876cf){logger[_0x46ef('0x10')](_0x46ef('0xc'),_0x4652de,_0x876cf);_0x4841e9(_0x876cf);});});} \ No newline at end of file +var _0xb80e=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xb80e,0x9b));var _0xeb80=function(_0x3732ed,_0x279d0a){_0x3732ed=_0x3732ed-0x0;var _0x55844c=_0xb80e[_0x3732ed];return _0x55844c;};'use strict';var _=require('lodash');var util=require(_0xeb80('0x0'));var moment=require(_0xeb80('0x1'));var BPromise=require(_0xeb80('0x2'));var rs=require(_0xeb80('0x3'));var fs=require('fs');var Redis=require(_0xeb80('0x4'));var db=require(_0xeb80('0x5'))['db'];var utils=require(_0xeb80('0x6'));var logger=require('../../config/logger')(_0xeb80('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb80('0x8'));var client=jayson['client'][_0xeb80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f4f84,_0x30b682,_0xdb286e){return new BPromise(function(_0x3a6878,_0xa1ac05){return client['request'](_0x2f4f84,_0xdb286e)[_0xeb80('0xa')](function(_0x822fef){logger[_0xeb80('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x30b682,_0xeb80('0xc'));logger[_0xeb80('0xd')](_0xeb80('0xe'),_0x30b682,'request\x20sent',JSON[_0xeb80('0xf')](_0x822fef));if(_0x822fef[_0xeb80('0x10')]){if(_0x822fef[_0xeb80('0x10')][_0xeb80('0x11')]===0x1f4){logger[_0xeb80('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x30b682,_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);return _0xa1ac05(_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);}logger[_0xeb80('0x10')](_0xeb80('0x13'),_0x30b682,_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);return _0x3a6878(_0x822fef[_0xeb80('0x10')][_0xeb80('0x12')]);}else{logger['info'](_0xeb80('0x13'),_0x30b682,_0xeb80('0xc'));_0x3a6878(_0x822fef['result'][_0xeb80('0x12')]);}})[_0xeb80('0x14')](function(_0x221e67){logger[_0xeb80('0x10')](_0xeb80('0x13'),_0x30b682,_0x221e67);_0xa1ac05(_0x221e67);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8eac6a6..abf8029 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 _0xcfff=['delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create','put','update'];(function(_0x57f3a5,_0xa1c09f){var _0x128854=function(_0x2bcc4){while(--_0x2bcc4){_0x57f3a5['push'](_0x57f3a5['shift']());}};_0x128854(++_0xa1c09f);}(_0xcfff,0x73));var _0xfcff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfff[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfcff('0x0'));var util=require(_0xfcff('0x1'));var path=require(_0xfcff('0x2'));var timeout=require('connect-timeout');var express=require(_0xfcff('0x3'));var router=express[_0xfcff('0x4')]();var fs_extra=require(_0xfcff('0x5'));var auth=require(_0xfcff('0x6'));var interaction=require(_0xfcff('0x7'));var config=require(_0xfcff('0x8'));var controller=require('./faxTransferReport.controller');router[_0xfcff('0x9')]('/',auth[_0xfcff('0xa')](),controller['index']);router[_0xfcff('0x9')](_0xfcff('0xb'),auth['isAuthenticated'](),controller[_0xfcff('0xc')]);router[_0xfcff('0x9')](_0xfcff('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfcff('0xe')]('/',auth[_0xfcff('0xa')](),controller[_0xfcff('0xf')]);router[_0xfcff('0x10')](_0xfcff('0xd'),auth[_0xfcff('0xa')](),controller[_0xfcff('0x11')]);router[_0xfcff('0x12')](_0xfcff('0xd'),auth[_0xfcff('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xafb7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2e529c,_0x376e88){var _0x195cba=function(_0x1dfe82){while(--_0x1dfe82){_0x2e529c['push'](_0x2e529c['shift']());}};_0x195cba(++_0x376e88);}(_0xafb7,0x13e));var _0x7afb=function(_0x20267c,_0x325024){_0x20267c=_0x20267c-0x0;var _0x3143ba=_0xafb7[_0x20267c];return _0x3143ba;};'use strict';var multer=require(_0x7afb('0x0'));var util=require(_0x7afb('0x1'));var path=require(_0x7afb('0x2'));var timeout=require(_0x7afb('0x3'));var express=require(_0x7afb('0x4'));var router=express[_0x7afb('0x5')]();var fs_extra=require(_0x7afb('0x6'));var auth=require(_0x7afb('0x7'));var interaction=require(_0x7afb('0x8'));var config=require(_0x7afb('0x9'));var controller=require('./faxTransferReport.controller');router[_0x7afb('0xa')]('/',auth[_0x7afb('0xb')](),controller[_0x7afb('0xc')]);router[_0x7afb('0xa')](_0x7afb('0xd'),auth[_0x7afb('0xb')](),controller[_0x7afb('0xe')]);router['get'](_0x7afb('0xf'),auth[_0x7afb('0xb')](),controller[_0x7afb('0x10')]);router[_0x7afb('0x11')]('/',auth[_0x7afb('0xb')](),controller[_0x7afb('0x12')]);router[_0x7afb('0x13')](_0x7afb('0xf'),auth[_0x7afb('0xb')](),controller[_0x7afb('0x14')]);router['delete'](_0x7afb('0xf'),auth[_0x7afb('0xb')](),controller[_0x7afb('0x15')]);module[_0x7afb('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3db39d2..e41eedb 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 _0xd3dd=['addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x181e0c,_0x280d22){var _0x39301f=function(_0x544a39){while(--_0x544a39){_0x181e0c['push'](_0x181e0c['shift']());}};_0x39301f(++_0x280d22);}(_0xd3dd,0xad));var _0xdd3d=function(_0x479713,_0x3a1278){_0x479713=_0x479713-0x0;var _0xd162a1=_0xd3dd[_0x479713];return _0xd162a1;};'use strict';var multer=require(_0xdd3d('0x0'));var util=require(_0xdd3d('0x1'));var path=require(_0xdd3d('0x2'));var timeout=require(_0xdd3d('0x3'));var express=require(_0xdd3d('0x4'));var router=express[_0xdd3d('0x5')]();var fs_extra=require(_0xdd3d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdd3d('0x7'));var config=require('../../config/environment');var controller=require(_0xdd3d('0x8'));router[_0xdd3d('0x9')]('/',auth[_0xdd3d('0xa')](),controller['index']);router[_0xdd3d('0x9')](_0xdd3d('0xb'),auth[_0xdd3d('0xa')](),controller[_0xdd3d('0xc')]);router[_0xdd3d('0x9')](_0xdd3d('0xd'),auth['isAuthenticated'](),controller[_0xdd3d('0xe')]);router[_0xdd3d('0x9')](_0xdd3d('0xf'),auth['isAuthenticated'](),controller[_0xdd3d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd3d('0x11')]);router[_0xdd3d('0x12')](_0xdd3d('0xd'),auth[_0xdd3d('0xa')](),controller[_0xdd3d('0x13')]);router[_0xdd3d('0x14')](_0xdd3d('0xb'),auth[_0xdd3d('0xa')](),controller[_0xdd3d('0x15')]);router[_0xdd3d('0x16')](_0xdd3d('0xb'),auth[_0xdd3d('0xa')](),controller['destroy']);module[_0xdd3d('0x17')]=router; \ No newline at end of file +var _0x043e=['/:id/fields','getFields','create','addConfiguration','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations'];(function(_0x41f36b,_0x3fa688){var _0xfd5df2=function(_0x3197e3){while(--_0x3197e3){_0x41f36b['push'](_0x41f36b['shift']());}};_0xfd5df2(++_0x3fa688);}(_0x043e,0x194));var _0xe043=function(_0x43b539,_0x346844){_0x43b539=_0x43b539-0x0;var _0x47d925=_0x043e[_0x43b539];return _0x47d925;};'use strict';var multer=require('multer');var util=require(_0xe043('0x0'));var path=require('path');var timeout=require(_0xe043('0x1'));var express=require(_0xe043('0x2'));var router=express[_0xe043('0x3')]();var fs_extra=require(_0xe043('0x4'));var auth=require(_0xe043('0x5'));var interaction=require(_0xe043('0x6'));var config=require(_0xe043('0x7'));var controller=require(_0xe043('0x8'));router['get']('/',auth[_0xe043('0x9')](),controller[_0xe043('0xa')]);router[_0xe043('0xb')](_0xe043('0xc'),auth[_0xe043('0x9')](),controller[_0xe043('0xd')]);router[_0xe043('0xb')](_0xe043('0xe'),auth['isAuthenticated'](),controller[_0xe043('0xf')]);router[_0xe043('0xb')](_0xe043('0x10'),auth[_0xe043('0x9')](),controller[_0xe043('0x11')]);router['post']('/',auth[_0xe043('0x9')](),controller[_0xe043('0x12')]);router['post'](_0xe043('0xe'),auth[_0xe043('0x9')](),controller[_0xe043('0x13')]);router['put'](_0xe043('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe043('0x14')]('/:id',auth[_0xe043('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index f8c4bce..08910d2 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 _0x6525=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x3f0941,_0x24ecfb){var _0x13f825=function(_0x266cf9){while(--_0x266cf9){_0x3f0941['push'](_0x3f0941['shift']());}};_0x13f825(++_0x24ecfb);}(_0x6525,0xaf));var _0x5652=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x6525[_0x220afa];return _0x1b79d1;};'use strict';var Sequelize=require(_0x5652('0x0'));module[_0x5652('0x1')]={'name':{'type':Sequelize[_0x5652('0x2')]},'description':{'type':Sequelize[_0x5652('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5652('0x2')]},'authType':{'type':Sequelize[_0x5652('0x3')](_0x5652('0x4')),'defaultValue':_0x5652('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x5652('0x2')]},'consumerSecret':{'type':Sequelize[_0x5652('0x2')]},'token':{'type':Sequelize[_0x5652('0x2')]},'tokenSecret':{'type':Sequelize[_0x5652('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5652('0x3')](_0x5652('0x5'),_0x5652('0x6')),'defaultValue':_0x5652('0x5')}}; \ No newline at end of file +var _0x518d=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x34311c,_0x52a317){var _0x4b8b35=function(_0x16888a){while(--_0x16888a){_0x34311c['push'](_0x34311c['shift']());}};_0x4b8b35(++_0x52a317);}(_0x518d,0x1d5));var _0xd518=function(_0x2e1a5a,_0x5e52f1){_0x2e1a5a=_0x2e1a5a-0x0;var _0xb7df2d=_0x518d[_0x2e1a5a];return _0xb7df2d;};'use strict';var Sequelize=require(_0xd518('0x0'));module[_0xd518('0x1')]={'name':{'type':Sequelize[_0xd518('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd518('0x2')]},'authType':{'type':Sequelize[_0xd518('0x3')](_0xd518('0x4')),'defaultValue':_0xd518('0x4')},'password':{'type':Sequelize[_0xd518('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd518('0x2')]},'token':{'type':Sequelize[_0xd518('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd518('0x3')](_0xd518('0x5'),_0xd518('0x6')),'defaultValue':_0xd518('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 14d9127..cf57efb 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 _0xc2bf=['destroy','findOne','DeskConfiguration','pick','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','base64','concat','_embedded','entries','active','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','index','map','DeskAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','findAll','rows','params','find','catch','create','body'];(function(_0x1ae61f,_0x29c6ea){var _0x3365e8=function(_0x863399){while(--_0x863399){_0x1ae61f['push'](_0x1ae61f['shift']());}};_0x3365e8(++_0x29c6ea);}(_0xc2bf,0x17c));var _0xfc2b=function(_0x829f54,_0x1bafc6){_0x829f54=_0x829f54-0x0;var _0xf2b9cb=_0xc2bf[_0x829f54];return _0xf2b9cb;};'use strict';var emlformat=require(_0xfc2b('0x0'));var rimraf=require(_0xfc2b('0x1'));var zipdir=require(_0xfc2b('0x2'));var jsonpatch=require(_0xfc2b('0x3'));var rp=require(_0xfc2b('0x4'));var moment=require('moment');var BPromise=require(_0xfc2b('0x5'));var Mustache=require(_0xfc2b('0x6'));var util=require(_0xfc2b('0x7'));var path=require(_0xfc2b('0x8'));var sox=require(_0xfc2b('0x9'));var csv=require(_0xfc2b('0xa'));var ejs=require(_0xfc2b('0xb'));var fs=require('fs');var fs_extra=require(_0xfc2b('0xc'));var _=require('lodash');var squel=require(_0xfc2b('0xd'));var crypto=require(_0xfc2b('0xe'));var jsforce=require(_0xfc2b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfc2b('0xa'));var querystring=require(_0xfc2b('0x10'));var Papa=require(_0xfc2b('0x11'));var Redis=require(_0xfc2b('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc2b('0x13'));var hardwareService=require(_0xfc2b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfc2b('0x15'));var config=require(_0xfc2b('0x16'));var licenseUtil=require(_0xfc2b('0x17'));var db=require(_0xfc2b('0x18'))['db'];var integrations=require(_0xfc2b('0x19'));function respondWithStatusCode(_0x273431,_0x4b7cc9){_0x4b7cc9=_0x4b7cc9||0xcc;return function(_0x13a4c5){if(_0x13a4c5){return _0x273431['sendStatus'](_0x4b7cc9);}return _0x273431['status'](_0x4b7cc9)[_0xfc2b('0x1a')]();};}function respondWithResult(_0x3ac797,_0xa31bbc){_0xa31bbc=_0xa31bbc||0xc8;return function(_0x1320da){if(_0x1320da){return _0x3ac797[_0xfc2b('0x1b')](_0xa31bbc)['json'](_0x1320da);}};}function respondWithFilteredResult(_0x48a1a9,_0x1a6c62){return function(_0x18fadd){if(_0x18fadd){var _0x49988e=typeof _0x1a6c62[_0xfc2b('0x1c')]===_0xfc2b('0x1d')&&typeof _0x1a6c62[_0xfc2b('0x1e')]===_0xfc2b('0x1d');var _0x529b9b=_0x18fadd[_0xfc2b('0x1f')];var _0x39eaea=_0x49988e?0x0:_0x1a6c62[_0xfc2b('0x1c')];var _0x93eb5d=_0x49988e?_0x18fadd[_0xfc2b('0x1f')]:_0x1a6c62[_0xfc2b('0x1c')]+_0x1a6c62['limit'];var _0x14a9b8;if(_0x93eb5d>=_0x529b9b){_0x93eb5d=_0x529b9b;_0x14a9b8=0xc8;}else{_0x14a9b8=0xce;}_0x48a1a9[_0xfc2b('0x1b')](_0x14a9b8);return _0x48a1a9['set'](_0xfc2b('0x20'),_0x39eaea+'-'+_0x93eb5d+'/'+_0x529b9b)[_0xfc2b('0x21')](_0x18fadd);}return null;};}function patchUpdates(_0x2168f2){return function(_0x3bfcc6){try{jsonpatch[_0xfc2b('0x22')](_0x3bfcc6,_0x2168f2,!![]);}catch(_0xe13a6f){return BPromise[_0xfc2b('0x23')](_0xe13a6f);}return _0x3bfcc6[_0xfc2b('0x24')]();};}function saveUpdates(_0x19dc67,_0x472e33){return function(_0x11d4cd){if(_0x11d4cd){return _0x11d4cd[_0xfc2b('0x25')](_0x19dc67)[_0xfc2b('0x26')](function(_0x49d92d){return _0x49d92d;});}return null;};}function removeEntity(_0x12c12c,_0x4bba5d){return function(_0x445d9a){if(_0x445d9a){return _0x445d9a['destroy']()[_0xfc2b('0x26')](function(){_0x12c12c['status'](0xcc)[_0xfc2b('0x1a')]();});}};}function handleEntityNotFound(_0x5a5988,_0x1c48dd){return function(_0x339eef){if(!_0x339eef){_0x5a5988[_0xfc2b('0x27')](0x194);}return _0x339eef;};}function handleError(_0x50a030,_0x4eedc1){_0x4eedc1=_0x4eedc1||0x1f4;return function(_0x56ed53){logger[_0xfc2b('0x28')](_0x56ed53[_0xfc2b('0x29')]);if(_0x56ed53['name']){delete _0x56ed53['name'];}_0x50a030[_0xfc2b('0x1b')](_0x4eedc1)['send'](_0x56ed53);};}exports[_0xfc2b('0x2a')]=function(_0x282585,_0x26fbc1){var _0x58a1f4={},_0x35fa4d={},_0x5115ba={'count':0x0,'rows':[]};var _0xfc235f=_[_0xfc2b('0x2b')](db[_0xfc2b('0x2c')][_0xfc2b('0x2d')],function(_0x3a71d9){return{'name':_0x3a71d9[_0xfc2b('0x2e')],'type':_0x3a71d9[_0xfc2b('0x2f')]['key']};});_0x35fa4d[_0xfc2b('0x30')]=_['map'](_0xfc235f,_0xfc2b('0x31'));_0x35fa4d[_0xfc2b('0x32')]=_[_0xfc2b('0x33')](_0x282585['query']);_0x35fa4d[_0xfc2b('0x34')]=_[_0xfc2b('0x35')](_0x35fa4d[_0xfc2b('0x30')],_0x35fa4d[_0xfc2b('0x32')]);_0x58a1f4[_0xfc2b('0x36')]=_[_0xfc2b('0x35')](_0x35fa4d[_0xfc2b('0x30')],qs[_0xfc2b('0x37')](_0x282585[_0xfc2b('0x32')][_0xfc2b('0x37')]));_0x58a1f4['attributes']=_0x58a1f4[_0xfc2b('0x36')][_0xfc2b('0x38')]?_0x58a1f4['attributes']:_0x35fa4d[_0xfc2b('0x30')];if(!_0x282585[_0xfc2b('0x32')][_0xfc2b('0x39')]('nolimit')){_0x58a1f4[_0xfc2b('0x1e')]=qs[_0xfc2b('0x1e')](_0x282585[_0xfc2b('0x32')]['limit']);_0x58a1f4[_0xfc2b('0x1c')]=qs[_0xfc2b('0x1c')](_0x282585['query'][_0xfc2b('0x1c')]);}_0x58a1f4[_0xfc2b('0x3a')]=qs[_0xfc2b('0x3b')](_0x282585['query'][_0xfc2b('0x3b')]);_0x58a1f4['where']=qs[_0xfc2b('0x34')](_['pick'](_0x282585['query'],_0x35fa4d[_0xfc2b('0x34')]),_0xfc235f);if(_0x282585[_0xfc2b('0x32')][_0xfc2b('0x3c')]){_0x58a1f4[_0xfc2b('0x3d')]=_[_0xfc2b('0x3e')](_0x58a1f4[_0xfc2b('0x3d')],{'$or':_[_0xfc2b('0x2b')](_0xfc235f,function(_0x5bdd90){if(_0x5bdd90['type']!=='VIRTUAL'){var _0x3570e4={};_0x3570e4[_0x5bdd90[_0xfc2b('0x31')]]={'$like':'%'+_0x282585[_0xfc2b('0x32')][_0xfc2b('0x3c')]+'%'};return _0x3570e4;}})});}_0x58a1f4=_[_0xfc2b('0x3e')]({},_0x58a1f4,_0x282585[_0xfc2b('0x3f')]);var _0x2bcc51={'where':_0x58a1f4[_0xfc2b('0x3d')]};return db[_0xfc2b('0x2c')][_0xfc2b('0x1f')](_0x2bcc51)[_0xfc2b('0x26')](function(_0x4c912f){_0x5115ba[_0xfc2b('0x1f')]=_0x4c912f;if(_0x282585['query'][_0xfc2b('0x40')]){_0x58a1f4['include']=[{'all':!![]}];}return db[_0xfc2b('0x2c')][_0xfc2b('0x41')](_0x58a1f4);})['then'](function(_0x44b158){_0x5115ba[_0xfc2b('0x42')]=_0x44b158;return _0x5115ba;})[_0xfc2b('0x26')](respondWithFilteredResult(_0x26fbc1,_0x58a1f4))['catch'](handleError(_0x26fbc1,null));};exports['show']=function(_0x1f8848,_0x4d0b6b){var _0x4fc0f9={'raw':![],'where':{'id':_0x1f8848[_0xfc2b('0x43')]['id']}},_0x48f4cb={};_0x48f4cb['model']=_[_0xfc2b('0x33')](db[_0xfc2b('0x2c')][_0xfc2b('0x2d')]);_0x48f4cb['query']=_[_0xfc2b('0x33')](_0x1f8848[_0xfc2b('0x32')]);_0x48f4cb[_0xfc2b('0x34')]=_[_0xfc2b('0x35')](_0x48f4cb[_0xfc2b('0x30')],_0x48f4cb['query']);_0x4fc0f9[_0xfc2b('0x36')]=_[_0xfc2b('0x35')](_0x48f4cb['model'],qs[_0xfc2b('0x37')](_0x1f8848['query'][_0xfc2b('0x37')]));_0x4fc0f9[_0xfc2b('0x36')]=_0x4fc0f9[_0xfc2b('0x36')][_0xfc2b('0x38')]?_0x4fc0f9[_0xfc2b('0x36')]:_0x48f4cb['model'];if(_0x1f8848[_0xfc2b('0x32')][_0xfc2b('0x40')]){_0x4fc0f9['include']=[{'all':!![]}];}_0x4fc0f9=_[_0xfc2b('0x3e')]({},_0x4fc0f9,_0x1f8848['options']);return db[_0xfc2b('0x2c')][_0xfc2b('0x44')](_0x4fc0f9)['then'](handleEntityNotFound(_0x4d0b6b,null))[_0xfc2b('0x26')](respondWithResult(_0x4d0b6b,null))[_0xfc2b('0x45')](handleError(_0x4d0b6b,null));};exports['create']=function(_0x30295f,_0x1252ed){return db[_0xfc2b('0x2c')][_0xfc2b('0x46')](_0x30295f[_0xfc2b('0x47')],{})['then'](respondWithResult(_0x1252ed,0xc9))[_0xfc2b('0x45')](handleError(_0x1252ed,null));};exports[_0xfc2b('0x25')]=function(_0x35afb9,_0x39b7e2){if(_0x35afb9[_0xfc2b('0x47')]['id']){delete _0x35afb9[_0xfc2b('0x47')]['id'];}return db[_0xfc2b('0x2c')][_0xfc2b('0x44')]({'where':{'id':_0x35afb9[_0xfc2b('0x43')]['id']}})[_0xfc2b('0x26')](handleEntityNotFound(_0x39b7e2,null))[_0xfc2b('0x26')](saveUpdates(_0x35afb9[_0xfc2b('0x47')],null))[_0xfc2b('0x26')](respondWithResult(_0x39b7e2,null))['catch'](handleError(_0x39b7e2,null));};exports[_0xfc2b('0x48')]=function(_0x3a3030,_0x33f93b){return db[_0xfc2b('0x2c')][_0xfc2b('0x44')]({'where':{'id':_0x3a3030[_0xfc2b('0x43')]['id']}})[_0xfc2b('0x26')](handleEntityNotFound(_0x33f93b,null))[_0xfc2b('0x26')](removeEntity(_0x33f93b,null))[_0xfc2b('0x45')](handleError(_0x33f93b,null));};exports['getConfigurations']=function(_0x6a2399,_0x2b3bff,_0x4c4ec5){var _0x2565f0={};var _0x400e9a={};var _0x4ca378;var _0x5ae669;return db['DeskAccount'][_0xfc2b('0x49')]({'where':{'id':_0x6a2399[_0xfc2b('0x43')]['id']}})[_0xfc2b('0x26')](handleEntityNotFound(_0x2b3bff,null))[_0xfc2b('0x26')](function(_0xb45ca6){if(_0xb45ca6){_0x4ca378=_0xb45ca6;_0x400e9a[_0xfc2b('0x30')]=_[_0xfc2b('0x33')](db[_0xfc2b('0x4a')][_0xfc2b('0x2d')]);_0x400e9a['query']=_[_0xfc2b('0x33')](_0x6a2399[_0xfc2b('0x32')]);_0x400e9a['filters']=_[_0xfc2b('0x35')](_0x400e9a['model'],_0x400e9a[_0xfc2b('0x32')]);_0x2565f0[_0xfc2b('0x36')]=_['intersection'](_0x400e9a['model'],qs[_0xfc2b('0x37')](_0x6a2399['query']['fields']));_0x2565f0[_0xfc2b('0x36')]=_0x2565f0['attributes'][_0xfc2b('0x38')]?_0x2565f0[_0xfc2b('0x36')]:_0x400e9a[_0xfc2b('0x30')];_0x2565f0[_0xfc2b('0x3a')]=qs[_0xfc2b('0x3b')](_0x6a2399[_0xfc2b('0x32')][_0xfc2b('0x3b')]);_0x2565f0[_0xfc2b('0x3d')]=qs[_0xfc2b('0x34')](_[_0xfc2b('0x4b')](_0x6a2399[_0xfc2b('0x32')],_0x400e9a['filters']));if(_0x6a2399[_0xfc2b('0x32')][_0xfc2b('0x3c')]){_0x2565f0[_0xfc2b('0x3d')]=_['merge'](_0x2565f0[_0xfc2b('0x3d')],{'$or':_['map'](_0x2565f0[_0xfc2b('0x36')],function(_0x925b50){var _0x2058e5={};_0x2058e5[_0x925b50]={'$like':'%'+_0x6a2399[_0xfc2b('0x32')][_0xfc2b('0x3c')]+'%'};return _0x2058e5;})});}_0x2565f0=_[_0xfc2b('0x3e')]({},_0x2565f0,_0x6a2399['options']);return _0x4ca378[_0xfc2b('0x4c')](_0x2565f0);}})[_0xfc2b('0x26')](function(_0x5652c3){if(_0x5652c3){_0x5ae669=_0x5652c3[_0xfc2b('0x38')];if(!_0x6a2399[_0xfc2b('0x32')][_0xfc2b('0x39')](_0xfc2b('0x4d'))){_0x2565f0[_0xfc2b('0x1e')]=qs['limit'](_0x6a2399[_0xfc2b('0x32')][_0xfc2b('0x1e')]);_0x2565f0[_0xfc2b('0x1c')]=qs[_0xfc2b('0x1c')](_0x6a2399[_0xfc2b('0x32')]['offset']);}return _0x4ca378['getConfigurations'](_0x2565f0);}})[_0xfc2b('0x26')](function(_0x433e66){if(_0x433e66){return _0x433e66?{'count':_0x5ae669,'rows':_0x433e66}:null;}})[_0xfc2b('0x26')](respondWithResult(_0x2b3bff,null))[_0xfc2b('0x45')](handleError(_0x2b3bff,null));};exports[_0xfc2b('0x4e')]=function(_0xbc17a2,_0x31e84a,_0x46ce07){if(_0xbc17a2[_0xfc2b('0x47')]['id']){delete _0xbc17a2['body']['id'];}return db['DeskAccount'][_0xfc2b('0x49')]({'where':{'id':_0xbc17a2[_0xfc2b('0x43')]['id']}})[_0xfc2b('0x26')](handleEntityNotFound(_0x31e84a,null))[_0xfc2b('0x26')](function(_0x4aa2e8){if(_0x4aa2e8){_0xbc17a2[_0xfc2b('0x47')][_0xfc2b('0x4f')]=_0x4aa2e8['id'];_0xbc17a2[_0xfc2b('0x47')][_0xfc2b('0x50')]=integrations[_0xfc2b('0x51')](_0xbc17a2['body'][_0xfc2b('0x52')],_0xbc17a2['body']['type']);_0xbc17a2['body'][_0xfc2b('0x53')]=integrations[_0xfc2b('0x54')](_0xbc17a2[_0xfc2b('0x47')]['channel'],_0xbc17a2[_0xfc2b('0x47')][_0xfc2b('0x2f')]);return db[_0xfc2b('0x4a')][_0xfc2b('0x46')](_0xbc17a2['body'],{'include':[{'model':db[_0xfc2b('0x55')],'as':'Subjects'},{'model':db[_0xfc2b('0x55')],'as':_0xfc2b('0x53')}]});}return null;})[_0xfc2b('0x26')](respondWithResult(_0x31e84a,null))['catch'](handleError(_0x31e84a,null));};exports[_0xfc2b('0x56')]=function(_0x4dcaaf,_0x68111,_0x6c22f0){var _0x50f448=[{'name':_0xfc2b('0x57'),'label':_0xfc2b('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x47f5dd='';return db[_0xfc2b('0x2c')]['findOne']({'where':{'id':_0x4dcaaf[_0xfc2b('0x43')]['id']},'attributes':['id',_0xfc2b('0x58'),_0xfc2b('0x59'),_0xfc2b('0x5a'),_0xfc2b('0x5b'),_0xfc2b('0x5c'),'consumerSecret',_0xfc2b('0x5d'),_0xfc2b('0x5e')]})['then'](handleEntityNotFound(_0x68111,null))[_0xfc2b('0x26')](function(_0x5bcabd){if(_0x5bcabd){_0x47f5dd=_0x5bcabd[_0xfc2b('0x58')];var _0xa7d6d3=_0x47f5dd['slice'](-0x1);if(_0xa7d6d3==='/'){_0x47f5dd=_0x47f5dd[_0xfc2b('0x5f')](0x0,_0x47f5dd[_0xfc2b('0x60')](_0xa7d6d3));}var _0x5099a0={'method':'GET','uri':util[_0xfc2b('0x61')](_0xfc2b('0x62'),_0x47f5dd),'headers':{'Content-Type':'application/json','Accept':_0xfc2b('0x63')},'json':!![]};if(_0x5bcabd[_0xfc2b('0x59')]==='basic'){_0x5099a0[_0xfc2b('0x64')][_0xfc2b('0x65')]=util[_0xfc2b('0x61')]('Basic\x20%s',new Buffer(util[_0xfc2b('0x61')](_0xfc2b('0x66'),_0x5bcabd[_0xfc2b('0x5a')],_0x5bcabd[_0xfc2b('0x5b')]))['toString'](_0xfc2b('0x67')));}return rp(_0x5099a0)['then'](function(_0x20deb4){return _0x50f448[_0xfc2b('0x68')](_[_0xfc2b('0x2b')](_0x20deb4[_0xfc2b('0x69')][_0xfc2b('0x6a')],function(_0x3bc19d){return{'id':_0x3bc19d[_0xfc2b('0x31')],'name':_0x3bc19d[_0xfc2b('0x31')],'type':_0x3bc19d['type'],'active':_0x3bc19d[_0xfc2b('0x6b')],'label':_0x3bc19d['label'],'custom':!![]};}));});}})[_0xfc2b('0x26')](function(_0x15556c){return{'count':_0x15556c[_0xfc2b('0x38')],'rows':_0x15556c};})['then'](respondWithResult(_0x68111,null))['catch'](function(_0x3c88e7){var _0x37207b=_0x4dcaaf['query'][_0xfc2b('0x6c')]?0x1f4:_0x3c88e7['statusCode']||0x1f4;logger[_0xfc2b('0x28')](_0xfc2b('0x6d'),_0xfc2b('0x56'),_0x37207b,JSON[_0xfc2b('0x6e')](_0x3c88e7));delete _0x3c88e7[_0xfc2b('0x31')];if(_0x37207b===0x191){_0x37207b=0x190;}_0x68111[_0xfc2b('0x1b')](_0x37207b)['send'](_0x4dcaaf[_0xfc2b('0x32')][_0xfc2b('0x6c')]?{'message':_0xfc2b('0x6f'),'statusCode':_0x3c88e7[_0xfc2b('0x70')]}:_0x3c88e7);});}; \ No newline at end of file +var _0x71a1=['password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','entries','active','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','DeskAccount','findAll','rows','show','includeAll','catch','create','body','params','DeskConfiguration','filter','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType'];(function(_0x13f320,_0x4899e6){var _0x16a918=function(_0x3cddab){while(--_0x3cddab){_0x13f320['push'](_0x13f320['shift']());}};_0x16a918(++_0x4899e6);}(_0x71a1,0x8a));var _0x171a=function(_0x3d9d2f,_0x5e1987){_0x3d9d2f=_0x3d9d2f-0x0;var _0x1ac44d=_0x71a1[_0x3d9d2f];return _0x1ac44d;};'use strict';var emlformat=require(_0x171a('0x0'));var rimraf=require(_0x171a('0x1'));var zipdir=require(_0x171a('0x2'));var jsonpatch=require(_0x171a('0x3'));var rp=require(_0x171a('0x4'));var moment=require(_0x171a('0x5'));var BPromise=require(_0x171a('0x6'));var Mustache=require(_0x171a('0x7'));var util=require(_0x171a('0x8'));var path=require('path');var sox=require(_0x171a('0x9'));var csv=require('to-csv');var ejs=require(_0x171a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x171a('0xb'));var squel=require(_0x171a('0xc'));var crypto=require('crypto');var jsforce=require(_0x171a('0xd'));var deskjs=require(_0x171a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x171a('0xf'));var Papa=require(_0x171a('0x10'));var Redis=require(_0x171a('0x11'));var authService=require(_0x171a('0x12'));var qs=require(_0x171a('0x13'));var as=require(_0x171a('0x14'));var hardwareService=require(_0x171a('0x15'));var logger=require(_0x171a('0x16'))('api');var utils=require(_0x171a('0x17'));var config=require(_0x171a('0x18'));var licenseUtil=require(_0x171a('0x19'));var db=require(_0x171a('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b1b52,_0x48a39b){_0x48a39b=_0x48a39b||0xcc;return function(_0x2cbbad){if(_0x2cbbad){return _0x5b1b52['sendStatus'](_0x48a39b);}return _0x5b1b52[_0x171a('0x1b')](_0x48a39b)[_0x171a('0x1c')]();};}function respondWithResult(_0x41f584,_0x21d3a2){_0x21d3a2=_0x21d3a2||0xc8;return function(_0x477730){if(_0x477730){return _0x41f584[_0x171a('0x1b')](_0x21d3a2)['json'](_0x477730);}};}function respondWithFilteredResult(_0x10c8bc,_0x9a8bb5){return function(_0x59f341){if(_0x59f341){var _0x1294cb=typeof _0x9a8bb5[_0x171a('0x1d')]==='undefined'&&typeof _0x9a8bb5['limit']==='undefined';var _0x47484f=_0x59f341[_0x171a('0x1e')];var _0x189b5b=_0x1294cb?0x0:_0x9a8bb5[_0x171a('0x1d')];var _0x20ca08=_0x1294cb?_0x59f341['count']:_0x9a8bb5['offset']+_0x9a8bb5[_0x171a('0x1f')];var _0x2fe719;if(_0x20ca08>=_0x47484f){_0x20ca08=_0x47484f;_0x2fe719=0xc8;}else{_0x2fe719=0xce;}_0x10c8bc[_0x171a('0x1b')](_0x2fe719);return _0x10c8bc[_0x171a('0x20')](_0x171a('0x21'),_0x189b5b+'-'+_0x20ca08+'/'+_0x47484f)[_0x171a('0x22')](_0x59f341);}return null;};}function patchUpdates(_0x31a992){return function(_0x404ec6){try{jsonpatch[_0x171a('0x23')](_0x404ec6,_0x31a992,!![]);}catch(_0x1ddd74){return BPromise['reject'](_0x1ddd74);}return _0x404ec6[_0x171a('0x24')]();};}function saveUpdates(_0x3d4da8,_0x2d7768){return function(_0x234927){if(_0x234927){return _0x234927[_0x171a('0x25')](_0x3d4da8)[_0x171a('0x26')](function(_0x1741d6){return _0x1741d6;});}return null;};}function removeEntity(_0xd364da,_0xf36ec1){return function(_0x51caf8){if(_0x51caf8){return _0x51caf8[_0x171a('0x27')]()[_0x171a('0x26')](function(){_0xd364da['status'](0xcc)[_0x171a('0x1c')]();});}};}function handleEntityNotFound(_0x293179,_0x3aa8c8){return function(_0x10eeb6){if(!_0x10eeb6){_0x293179[_0x171a('0x28')](0x194);}return _0x10eeb6;};}function handleError(_0x5c796b,_0x4502ff){_0x4502ff=_0x4502ff||0x1f4;return function(_0x285601){logger[_0x171a('0x29')](_0x285601[_0x171a('0x2a')]);if(_0x285601[_0x171a('0x2b')]){delete _0x285601[_0x171a('0x2b')];}_0x5c796b[_0x171a('0x1b')](_0x4502ff)[_0x171a('0x2c')](_0x285601);};}exports[_0x171a('0x2d')]=function(_0x484e70,_0xd5fdb0){var _0x16b3e2={},_0x35ce03={},_0x267901={'count':0x0,'rows':[]};var _0xece286=_['map'](db['DeskAccount'][_0x171a('0x2e')],function(_0x24256a){return{'name':_0x24256a[_0x171a('0x2f')],'type':_0x24256a[_0x171a('0x30')]['key']};});_0x35ce03[_0x171a('0x31')]=_[_0x171a('0x32')](_0xece286,_0x171a('0x2b'));_0x35ce03[_0x171a('0x33')]=_[_0x171a('0x34')](_0x484e70['query']);_0x35ce03[_0x171a('0x35')]=_[_0x171a('0x36')](_0x35ce03[_0x171a('0x31')],_0x35ce03[_0x171a('0x33')]);_0x16b3e2[_0x171a('0x37')]=_[_0x171a('0x36')](_0x35ce03[_0x171a('0x31')],qs['fields'](_0x484e70['query'][_0x171a('0x38')]));_0x16b3e2[_0x171a('0x37')]=_0x16b3e2[_0x171a('0x37')][_0x171a('0x39')]?_0x16b3e2[_0x171a('0x37')]:_0x35ce03[_0x171a('0x31')];if(!_0x484e70[_0x171a('0x33')][_0x171a('0x3a')](_0x171a('0x3b'))){_0x16b3e2['limit']=qs[_0x171a('0x1f')](_0x484e70['query'][_0x171a('0x1f')]);_0x16b3e2['offset']=qs[_0x171a('0x1d')](_0x484e70[_0x171a('0x33')][_0x171a('0x1d')]);}_0x16b3e2[_0x171a('0x3c')]=qs[_0x171a('0x3d')](_0x484e70['query'][_0x171a('0x3d')]);_0x16b3e2[_0x171a('0x3e')]=qs['filters'](_[_0x171a('0x3f')](_0x484e70[_0x171a('0x33')],_0x35ce03['filters']),_0xece286);if(_0x484e70[_0x171a('0x33')]['filter']){_0x16b3e2[_0x171a('0x3e')]=_[_0x171a('0x40')](_0x16b3e2[_0x171a('0x3e')],{'$or':_[_0x171a('0x32')](_0xece286,function(_0x572248){if(_0x572248[_0x171a('0x30')]!==_0x171a('0x41')){var _0x3d6867={};_0x3d6867[_0x572248['name']]={'$like':'%'+_0x484e70[_0x171a('0x33')]['filter']+'%'};return _0x3d6867;}})});}_0x16b3e2=_['merge']({},_0x16b3e2,_0x484e70[_0x171a('0x42')]);var _0x5c6937={'where':_0x16b3e2[_0x171a('0x3e')]};return db[_0x171a('0x43')][_0x171a('0x1e')](_0x5c6937)[_0x171a('0x26')](function(_0x3b017b){_0x267901['count']=_0x3b017b;if(_0x484e70[_0x171a('0x33')]['includeAll']){_0x16b3e2['include']=[{'all':!![]}];}return db[_0x171a('0x43')][_0x171a('0x44')](_0x16b3e2);})['then'](function(_0x5d4159){_0x267901[_0x171a('0x45')]=_0x5d4159;return _0x267901;})[_0x171a('0x26')](respondWithFilteredResult(_0xd5fdb0,_0x16b3e2))['catch'](handleError(_0xd5fdb0,null));};exports[_0x171a('0x46')]=function(_0x410cf7,_0x192bbe){var _0x104eca={'raw':![],'where':{'id':_0x410cf7['params']['id']}},_0x1d8031={};_0x1d8031['model']=_[_0x171a('0x34')](db[_0x171a('0x43')][_0x171a('0x2e')]);_0x1d8031['query']=_['keys'](_0x410cf7['query']);_0x1d8031[_0x171a('0x35')]=_[_0x171a('0x36')](_0x1d8031[_0x171a('0x31')],_0x1d8031['query']);_0x104eca[_0x171a('0x37')]=_[_0x171a('0x36')](_0x1d8031[_0x171a('0x31')],qs[_0x171a('0x38')](_0x410cf7['query'][_0x171a('0x38')]));_0x104eca[_0x171a('0x37')]=_0x104eca[_0x171a('0x37')][_0x171a('0x39')]?_0x104eca[_0x171a('0x37')]:_0x1d8031[_0x171a('0x31')];if(_0x410cf7['query'][_0x171a('0x47')]){_0x104eca['include']=[{'all':!![]}];}_0x104eca=_['merge']({},_0x104eca,_0x410cf7['options']);return db[_0x171a('0x43')]['find'](_0x104eca)['then'](handleEntityNotFound(_0x192bbe,null))['then'](respondWithResult(_0x192bbe,null))[_0x171a('0x48')](handleError(_0x192bbe,null));};exports['create']=function(_0x16c551,_0x53f3c0){return db[_0x171a('0x43')][_0x171a('0x49')](_0x16c551[_0x171a('0x4a')],{})['then'](respondWithResult(_0x53f3c0,0xc9))[_0x171a('0x48')](handleError(_0x53f3c0,null));};exports[_0x171a('0x25')]=function(_0x200194,_0x1eb5b0){if(_0x200194[_0x171a('0x4a')]['id']){delete _0x200194[_0x171a('0x4a')]['id'];}return db[_0x171a('0x43')]['find']({'where':{'id':_0x200194[_0x171a('0x4b')]['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x1eb5b0,null))[_0x171a('0x26')](saveUpdates(_0x200194[_0x171a('0x4a')],null))[_0x171a('0x26')](respondWithResult(_0x1eb5b0,null))[_0x171a('0x48')](handleError(_0x1eb5b0,null));};exports[_0x171a('0x27')]=function(_0xba1fcc,_0x2829a0){return db[_0x171a('0x43')]['find']({'where':{'id':_0xba1fcc[_0x171a('0x4b')]['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x2829a0,null))[_0x171a('0x26')](removeEntity(_0x2829a0,null))[_0x171a('0x48')](handleError(_0x2829a0,null));};exports['getConfigurations']=function(_0x174a0c,_0x4e3284,_0x391abc){var _0x820362={};var _0x59a8ea={};var _0x535698;var _0x326105;return db[_0x171a('0x43')]['findOne']({'where':{'id':_0x174a0c[_0x171a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e3284,null))[_0x171a('0x26')](function(_0x17c3fd){if(_0x17c3fd){_0x535698=_0x17c3fd;_0x59a8ea[_0x171a('0x31')]=_['keys'](db[_0x171a('0x4c')][_0x171a('0x2e')]);_0x59a8ea[_0x171a('0x33')]=_[_0x171a('0x34')](_0x174a0c['query']);_0x59a8ea[_0x171a('0x35')]=_[_0x171a('0x36')](_0x59a8ea[_0x171a('0x31')],_0x59a8ea['query']);_0x820362[_0x171a('0x37')]=_[_0x171a('0x36')](_0x59a8ea[_0x171a('0x31')],qs[_0x171a('0x38')](_0x174a0c[_0x171a('0x33')][_0x171a('0x38')]));_0x820362[_0x171a('0x37')]=_0x820362['attributes'][_0x171a('0x39')]?_0x820362['attributes']:_0x59a8ea[_0x171a('0x31')];_0x820362['order']=qs['sort'](_0x174a0c['query'][_0x171a('0x3d')]);_0x820362['where']=qs[_0x171a('0x35')](_[_0x171a('0x3f')](_0x174a0c['query'],_0x59a8ea[_0x171a('0x35')]));if(_0x174a0c[_0x171a('0x33')][_0x171a('0x4d')]){_0x820362[_0x171a('0x3e')]=_[_0x171a('0x40')](_0x820362[_0x171a('0x3e')],{'$or':_[_0x171a('0x32')](_0x820362[_0x171a('0x37')],function(_0xe5b6ad){var _0x554421={};_0x554421[_0xe5b6ad]={'$like':'%'+_0x174a0c[_0x171a('0x33')][_0x171a('0x4d')]+'%'};return _0x554421;})});}_0x820362=_[_0x171a('0x40')]({},_0x820362,_0x174a0c[_0x171a('0x42')]);return _0x535698['getConfigurations'](_0x820362);}})[_0x171a('0x26')](function(_0x4be2da){if(_0x4be2da){_0x326105=_0x4be2da[_0x171a('0x39')];if(!_0x174a0c[_0x171a('0x33')][_0x171a('0x3a')](_0x171a('0x3b'))){_0x820362[_0x171a('0x1f')]=qs[_0x171a('0x1f')](_0x174a0c['query'][_0x171a('0x1f')]);_0x820362['offset']=qs[_0x171a('0x1d')](_0x174a0c['query']['offset']);}return _0x535698[_0x171a('0x4e')](_0x820362);}})[_0x171a('0x26')](function(_0x354f97){if(_0x354f97){return _0x354f97?{'count':_0x326105,'rows':_0x354f97}:null;}})[_0x171a('0x26')](respondWithResult(_0x4e3284,null))[_0x171a('0x48')](handleError(_0x4e3284,null));};exports[_0x171a('0x4f')]=function(_0x16b742,_0x75b8a8,_0xa6c25b){if(_0x16b742['body']['id']){delete _0x16b742['body']['id'];}return db[_0x171a('0x43')][_0x171a('0x50')]({'where':{'id':_0x16b742[_0x171a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x75b8a8,null))[_0x171a('0x26')](function(_0x53d59c){if(_0x53d59c){_0x16b742[_0x171a('0x4a')]['AccountId']=_0x53d59c['id'];_0x16b742[_0x171a('0x4a')][_0x171a('0x51')]=integrations[_0x171a('0x52')](_0x16b742[_0x171a('0x4a')][_0x171a('0x53')],_0x16b742['body'][_0x171a('0x30')]);_0x16b742[_0x171a('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x16b742['body'][_0x171a('0x53')],_0x16b742['body'][_0x171a('0x30')]);return db[_0x171a('0x4c')][_0x171a('0x49')](_0x16b742[_0x171a('0x4a')],{'include':[{'model':db[_0x171a('0x54')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x171a('0x55')}]});}return null;})['then'](respondWithResult(_0x75b8a8,null))['catch'](handleError(_0x75b8a8,null));};exports[_0x171a('0x56')]=function(_0x802bc,_0x150d51,_0x4e0b42){var _0x55db62=[{'name':_0x171a('0x57'),'label':_0x171a('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x33cf50='';return db['DeskAccount'][_0x171a('0x50')]({'where':{'id':_0x802bc[_0x171a('0x4b')]['id']},'attributes':['id',_0x171a('0x58'),_0x171a('0x59'),'username',_0x171a('0x5a'),_0x171a('0x5b'),_0x171a('0x5c'),_0x171a('0x5d'),_0x171a('0x5e')]})['then'](handleEntityNotFound(_0x150d51,null))[_0x171a('0x26')](function(_0x3142b9){if(_0x3142b9){_0x33cf50=_0x3142b9['remoteUri'];var _0x493e36=_0x33cf50['slice'](-0x1);if(_0x493e36==='/'){_0x33cf50=_0x33cf50[_0x171a('0x5f')](0x0,_0x33cf50[_0x171a('0x60')](_0x493e36));}var _0x1985ed={'method':_0x171a('0x61'),'uri':util[_0x171a('0x62')]('%s/custom_fields',_0x33cf50),'headers':{'Content-Type':_0x171a('0x63'),'Accept':'application/json'},'json':!![]};if(_0x3142b9[_0x171a('0x59')]===_0x171a('0x64')){_0x1985ed[_0x171a('0x65')][_0x171a('0x66')]=util['format'](_0x171a('0x67'),new Buffer(util[_0x171a('0x62')](_0x171a('0x68'),_0x3142b9['username'],_0x3142b9[_0x171a('0x5a')]))[_0x171a('0x69')](_0x171a('0x6a')));}return rp(_0x1985ed)[_0x171a('0x26')](function(_0xeb61c5){return _0x55db62['concat'](_[_0x171a('0x32')](_0xeb61c5['_embedded'][_0x171a('0x6b')],function(_0x4724cb){return{'id':_0x4724cb[_0x171a('0x2b')],'name':_0x4724cb[_0x171a('0x2b')],'type':_0x4724cb['type'],'active':_0x4724cb[_0x171a('0x6c')],'label':_0x4724cb['label'],'custom':!![]};}));});}})[_0x171a('0x26')](function(_0x5bfa3c){return{'count':_0x5bfa3c[_0x171a('0x39')],'rows':_0x5bfa3c};})[_0x171a('0x26')](respondWithResult(_0x150d51,null))[_0x171a('0x48')](function(_0x58881b){var _0x24068f=_0x802bc[_0x171a('0x33')]['test']?0x1f4:_0x58881b['statusCode']||0x1f4;logger['error'](_0x171a('0x6d'),_0x171a('0x56'),_0x24068f,JSON[_0x171a('0x6e')](_0x58881b));delete _0x58881b[_0x171a('0x2b')];if(_0x24068f===0x191){_0x24068f=0x190;}_0x150d51[_0x171a('0x1b')](_0x24068f)['send'](_0x802bc['query'][_0x171a('0x6f')]?{'message':_0x171a('0x70'),'statusCode':_0x58881b[_0x171a('0x71')]}:_0x58881b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b24fef3..a4a26d6 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 _0xc49e=['moment','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','util'];(function(_0x1bdcdd,_0x148860){var _0x5dffe9=function(_0x43091b){while(--_0x43091b){_0x1bdcdd['push'](_0x1bdcdd['shift']());}};_0x5dffe9(++_0x148860);}(_0xc49e,0xb7));var _0xec49=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xc49e[_0x369151];return _0x4292d5;};'use strict';var _=require('lodash');var util=require(_0xec49('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xec49('0x1'));var BPromise=require('bluebird');var rp=require(_0xec49('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec49('0x3'));var config=require('../../config/environment');var attributes=require(_0xec49('0x4'));var integrations=require(_0xec49('0x5'));module['exports']=function(_0x312da8,_0x474616){return _0x312da8[_0xec49('0x6')](_0xec49('0x7'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb283=['int_desk_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x141206,_0x48263b){var _0xf8a1d6=function(_0x4b180c){while(--_0x4b180c){_0x141206['push'](_0x141206['shift']());}};_0xf8a1d6(++_0x48263b);}(_0xb283,0x6d));var _0x3b28=function(_0x4dbeaa,_0x3fb85d){_0x4dbeaa=_0x4dbeaa-0x0;var _0x889e79=_0xb283[_0x4dbeaa];return _0x889e79;};'use strict';var _=require(_0x3b28('0x0'));var util=require(_0x3b28('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3b28('0x2'));var BPromise=require(_0x3b28('0x3'));var rp=require(_0x3b28('0x4'));var fs=require('fs');var path=require(_0x3b28('0x5'));var rimraf=require(_0x3b28('0x6'));var config=require(_0x3b28('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x3b28('0x8'));module[_0x3b28('0x9')]=function(_0x1d6f07,_0xbdf26e){return _0x1d6f07[_0x3b28('0xa')]('DeskAccount',attributes,{'tableName':_0x3b28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index ce67e1e..11c97d2 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 _0x3368=['options','attributes','limit','include','map','model','stringify','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll'];(function(_0x3f2fe1,_0x5bccf8){var _0x3e474d=function(_0x1c165c){while(--_0x1c165c){_0x3f2fe1['push'](_0x3f2fe1['shift']());}};_0x3e474d(++_0x5bccf8);}(_0x3368,0x18a));var _0x8336=function(_0x3afb73,_0xaa578f){_0x3afb73=_0x3afb73-0x0;var _0x5165f2=_0x3368[_0x3afb73];return _0x5165f2;};'use strict';var _=require(_0x8336('0x0'));var util=require(_0x8336('0x1'));var moment=require(_0x8336('0x2'));var BPromise=require(_0x8336('0x3'));var rs=require(_0x8336('0x4'));var fs=require('fs');var Redis=require(_0x8336('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8336('0x6'));var config=require('../../config/environment');var jayson=require(_0x8336('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1247ec,_0x9869f5,_0x2f0507){return new BPromise(function(_0x3b03bd,_0x12bc2c){return client[_0x8336('0x8')](_0x1247ec,_0x2f0507)[_0x8336('0x9')](function(_0x5e84aa){logger[_0x8336('0xa')]('DeskAccount,\x20%s,\x20%s',_0x9869f5,_0x8336('0xb'));logger[_0x8336('0xc')](_0x8336('0xd'),_0x9869f5,_0x8336('0xb'),JSON['stringify'](_0x5e84aa));if(_0x5e84aa[_0x8336('0xe')]){if(_0x5e84aa[_0x8336('0xe')]['code']===0x1f4){logger[_0x8336('0xe')](_0x8336('0xf'),_0x9869f5,_0x5e84aa['error'][_0x8336('0x10')]);return _0x12bc2c(_0x5e84aa[_0x8336('0xe')][_0x8336('0x10')]);}logger[_0x8336('0xe')](_0x8336('0xf'),_0x9869f5,_0x5e84aa[_0x8336('0xe')][_0x8336('0x10')]);return _0x3b03bd(_0x5e84aa[_0x8336('0xe')]['message']);}else{logger[_0x8336('0xa')]('DeskAccount,\x20%s,\x20%s',_0x9869f5,_0x8336('0xb'));_0x3b03bd(_0x5e84aa[_0x8336('0x11')][_0x8336('0x10')]);}})[_0x8336('0x12')](function(_0x1c0da5){logger[_0x8336('0xe')]('DeskAccount,\x20%s,\x20%s',_0x9869f5,_0x1c0da5);_0x12bc2c(_0x1c0da5);});});}exports[_0x8336('0x13')]=function(_0x57599d){var _0x36a2c4=this;return new Promise(function(_0x5db1b1,_0xd76fe3){return db[_0x8336('0x14')][_0x8336('0x15')]({'raw':_0x57599d[_0x8336('0x16')]?_0x57599d[_0x8336('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x57599d['options']?_0x57599d['options']['where']||null:null,'attributes':_0x57599d[_0x8336('0x16')]?_0x57599d[_0x8336('0x16')][_0x8336('0x17')]||null:null,'limit':_0x57599d[_0x8336('0x16')]?_0x57599d[_0x8336('0x16')][_0x8336('0x18')]||null:null,'include':_0x57599d[_0x8336('0x16')]?_0x57599d[_0x8336('0x16')][_0x8336('0x19')]?_[_0x8336('0x1a')](_0x57599d['options'][_0x8336('0x19')],function(_0x591345){return{'model':db[_0x591345[_0x8336('0x1b')]],'as':_0x591345['as'],'attributes':_0x591345['attributes'],'include':_0x591345[_0x8336('0x19')]?_[_0x8336('0x1a')](_0x591345[_0x8336('0x19')],function(_0x110a0f){return{'model':db[_0x110a0f[_0x8336('0x1b')]],'as':_0x110a0f['as'],'attributes':_0x110a0f[_0x8336('0x17')],'include':_0x110a0f[_0x8336('0x19')]?_[_0x8336('0x1a')](_0x110a0f[_0x8336('0x19')],function(_0x2f5b39){return{'model':db[_0x2f5b39[_0x8336('0x1b')]],'as':_0x2f5b39['as'],'attributes':_0x2f5b39[_0x8336('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8336('0x9')](function(_0x1e3dd5){logger['info'](_0x8336('0x13'),_0x57599d);logger['debug'](_0x8336('0x13'),_0x57599d,JSON[_0x8336('0x1c')](_0x1e3dd5));_0x5db1b1(_0x1e3dd5);})[_0x8336('0x12')](function(_0x42bc23){logger[_0x8336('0xe')](_0x8336('0x13'),_0x42bc23[_0x8336('0x10')],_0x57599d);_0xd76fe3(_0x36a2c4[_0x8336('0xe')](0x1f4,_0x42bc23[_0x8336('0x10')]));});});};exports[_0x8336('0x1d')]=function(_0x2f00d4){var _0x377308=this;return new Promise(function(_0x3eae9c,_0x1d4f01){return db[_0x8336('0x14')][_0x8336('0x1e')]({'raw':_0x2f00d4['options']?_0x2f00d4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f00d4['options']?_0x2f00d4[_0x8336('0x16')][_0x8336('0x1f')]||null:null,'attributes':_0x2f00d4[_0x8336('0x16')]?_0x2f00d4['options'][_0x8336('0x17')]||null:null,'include':_0x2f00d4[_0x8336('0x16')]?_0x2f00d4[_0x8336('0x16')]['include']?_[_0x8336('0x1a')](_0x2f00d4[_0x8336('0x16')]['include'],function(_0xdd624d){return{'model':db[_0xdd624d['model']],'as':_0xdd624d['as'],'attributes':_0xdd624d[_0x8336('0x17')],'include':_0xdd624d[_0x8336('0x19')]?_[_0x8336('0x1a')](_0xdd624d['include'],function(_0x8a27a4){return{'model':db[_0x8a27a4[_0x8336('0x1b')]],'as':_0x8a27a4['as'],'attributes':_0x8a27a4['attributes'],'include':_0x8a27a4[_0x8336('0x19')]?_[_0x8336('0x1a')](_0x8a27a4[_0x8336('0x19')],function(_0x2bc291){return{'model':db[_0x2bc291[_0x8336('0x1b')]],'as':_0x2bc291['as'],'attributes':_0x2bc291[_0x8336('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8336('0x9')](function(_0x4f231c){logger[_0x8336('0xa')]('ShowDeskAccount',_0x2f00d4);logger[_0x8336('0xc')](_0x8336('0x1d'),_0x2f00d4,JSON['stringify'](_0x4f231c));_0x3eae9c(_0x4f231c);})[_0x8336('0x12')](function(_0x5bec96){logger[_0x8336('0xe')](_0x8336('0x1d'),_0x5bec96[_0x8336('0x10')],_0x2f00d4);_0x1d4f01(_0x377308['error'](0x1f4,_0x5bec96[_0x8336('0x10')]));});});}; \ No newline at end of file +var _0x2280=['error','code','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x2280,0x167));var _0x0228=function(_0x21cbd8,_0x358cfe){_0x21cbd8=_0x21cbd8-0x0;var _0x3b7e9b=_0x2280[_0x21cbd8];return _0x3b7e9b;};'use strict';var _=require(_0x0228('0x0'));var util=require(_0x0228('0x1'));var moment=require(_0x0228('0x2'));var BPromise=require('bluebird');var rs=require(_0x0228('0x3'));var fs=require('fs');var Redis=require(_0x0228('0x4'));var db=require(_0x0228('0x5'))['db'];var utils=require(_0x0228('0x6'));var logger=require(_0x0228('0x7'))(_0x0228('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0228('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2613f7,_0x1025f7,_0x1d9c52){return new BPromise(function(_0x6571a1,_0x1b0dc4){return client[_0x0228('0xa')](_0x2613f7,_0x1d9c52)[_0x0228('0xb')](function(_0x1da754){logger['info'](_0x0228('0xc'),_0x1025f7,_0x0228('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1025f7,_0x0228('0xd'),JSON[_0x0228('0xe')](_0x1da754));if(_0x1da754['error']){if(_0x1da754[_0x0228('0xf')][_0x0228('0x10')]===0x1f4){logger['error'](_0x0228('0xc'),_0x1025f7,_0x1da754[_0x0228('0xf')][_0x0228('0x11')]);return _0x1b0dc4(_0x1da754['error']['message']);}logger[_0x0228('0xf')](_0x0228('0xc'),_0x1025f7,_0x1da754['error'][_0x0228('0x11')]);return _0x6571a1(_0x1da754['error'][_0x0228('0x11')]);}else{logger[_0x0228('0x12')](_0x0228('0xc'),_0x1025f7,_0x0228('0xd'));_0x6571a1(_0x1da754[_0x0228('0x13')][_0x0228('0x11')]);}})[_0x0228('0x14')](function(_0x2a3134){logger[_0x0228('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1025f7,_0x2a3134);_0x1b0dc4(_0x2a3134);});});}exports[_0x0228('0x15')]=function(_0x22c5b9){var _0x543073=this;return new Promise(function(_0x108158,_0x3ef2a0){return db[_0x0228('0x16')][_0x0228('0x17')]({'raw':_0x22c5b9[_0x0228('0x18')]?_0x22c5b9[_0x0228('0x18')][_0x0228('0x19')]===undefined?!![]:![]:!![],'where':_0x22c5b9[_0x0228('0x18')]?_0x22c5b9[_0x0228('0x18')][_0x0228('0x1a')]||null:null,'attributes':_0x22c5b9['options']?_0x22c5b9[_0x0228('0x18')][_0x0228('0x1b')]||null:null,'limit':_0x22c5b9[_0x0228('0x18')]?_0x22c5b9[_0x0228('0x18')][_0x0228('0x1c')]||null:null,'include':_0x22c5b9['options']?_0x22c5b9['options'][_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x22c5b9[_0x0228('0x18')]['include'],function(_0x3eb191){return{'model':db[_0x3eb191['model']],'as':_0x3eb191['as'],'attributes':_0x3eb191[_0x0228('0x1b')],'include':_0x3eb191[_0x0228('0x1d')]?_['map'](_0x3eb191[_0x0228('0x1d')],function(_0x4550ce){return{'model':db[_0x4550ce[_0x0228('0x1f')]],'as':_0x4550ce['as'],'attributes':_0x4550ce[_0x0228('0x1b')],'include':_0x4550ce[_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x4550ce[_0x0228('0x1d')],function(_0x1f7aef){return{'model':db[_0x1f7aef['model']],'as':_0x1f7aef['as'],'attributes':_0x1f7aef[_0x0228('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0228('0xb')](function(_0x4e6878){logger[_0x0228('0x12')](_0x0228('0x15'),_0x22c5b9);logger[_0x0228('0x20')]('GetDeskAccount',_0x22c5b9,JSON[_0x0228('0xe')](_0x4e6878));_0x108158(_0x4e6878);})['catch'](function(_0x54534f){logger[_0x0228('0xf')](_0x0228('0x15'),_0x54534f[_0x0228('0x11')],_0x22c5b9);_0x3ef2a0(_0x543073[_0x0228('0xf')](0x1f4,_0x54534f[_0x0228('0x11')]));});});};exports[_0x0228('0x21')]=function(_0x5a7c4b){var _0x284f21=this;return new Promise(function(_0x51c211,_0x450612){return db[_0x0228('0x16')]['find']({'raw':_0x5a7c4b[_0x0228('0x18')]?_0x5a7c4b[_0x0228('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a7c4b[_0x0228('0x18')]?_0x5a7c4b[_0x0228('0x18')][_0x0228('0x1a')]||null:null,'attributes':_0x5a7c4b['options']?_0x5a7c4b[_0x0228('0x18')][_0x0228('0x1b')]||null:null,'include':_0x5a7c4b['options']?_0x5a7c4b[_0x0228('0x18')]['include']?_['map'](_0x5a7c4b[_0x0228('0x18')][_0x0228('0x1d')],function(_0x9c40fd){return{'model':db[_0x9c40fd['model']],'as':_0x9c40fd['as'],'attributes':_0x9c40fd[_0x0228('0x1b')],'include':_0x9c40fd[_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x9c40fd[_0x0228('0x1d')],function(_0x18fb57){return{'model':db[_0x18fb57['model']],'as':_0x18fb57['as'],'attributes':_0x18fb57[_0x0228('0x1b')],'include':_0x18fb57[_0x0228('0x1d')]?_[_0x0228('0x1e')](_0x18fb57['include'],function(_0x18773a){return{'model':db[_0x18773a[_0x0228('0x1f')]],'as':_0x18773a['as'],'attributes':_0x18773a[_0x0228('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0228('0xb')](function(_0x46d36b){logger[_0x0228('0x12')](_0x0228('0x21'),_0x5a7c4b);logger[_0x0228('0x20')]('ShowDeskAccount',_0x5a7c4b,JSON[_0x0228('0xe')](_0x46d36b));_0x51c211(_0x46d36b);})['catch'](function(_0x4811be){logger['error'](_0x0228('0x21'),_0x4811be[_0x0228('0x11')],_0x5a7c4b);_0x450612(_0x284f21[_0x0228('0xf')](0x1f4,_0x4811be[_0x0228('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 36aa3a9..be70837 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x490c6a,_0x102891){var _0x8fa262=function(_0x444982){while(--_0x444982){_0x490c6a['push'](_0x490c6a['shift']());}};_0x8fa262(++_0x102891);}(_0x008c,0x188));var _0xc008=function(_0x16ce30,_0x3a957b){_0x16ce30=_0x16ce30-0x0;var _0x2de58b=_0x008c[_0x16ce30];return _0x2de58b;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x331136,_0x15c2e9){var _0x1d0359=function(_0x555a86){while(--_0x555a86){_0x331136['push'](_0x331136['shift']());}};_0x1d0359(++_0x15c2e9);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f486697..fd647b4 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 _0xe15f=['exports','STRING'];(function(_0xc31ebb,_0x2445ec){var _0x1fd7fa=function(_0x58e9e1){while(--_0x58e9e1){_0xc31ebb['push'](_0xc31ebb['shift']());}};_0x1fd7fa(++_0x2445ec);}(_0xe15f,0x164));var _0xfe15=function(_0x14d4cc,_0x23bbb7){_0x14d4cc=_0x14d4cc-0x0;var _0x55cda5=_0xe15f[_0x14d4cc];return _0x55cda5;};'use strict';var Sequelize=require('sequelize');module[_0xfe15('0x0')]={'name':{'type':Sequelize[_0xfe15('0x1')]},'description':{'type':Sequelize[_0xfe15('0x1')]}}; \ No newline at end of file +var _0xb481=['exports','STRING','sequelize'];(function(_0x323ad7,_0x12b203){var _0x946599=function(_0x42da92){while(--_0x42da92){_0x323ad7['push'](_0x323ad7['shift']());}};_0x946599(++_0x12b203);}(_0xb481,0x1d0));var _0x1b48=function(_0x23428f,_0x288620){_0x23428f=_0x23428f-0x0;var _0x4a1f23=_0xb481[_0x23428f];return _0x4a1f23;};'use strict';var Sequelize=require(_0x1b48('0x0'));module[_0x1b48('0x1')]={'name':{'type':Sequelize[_0x1b48('0x2')]},'description':{'type':Sequelize[_0x1b48('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 12f5ec0..6025d65 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 _0xdcac=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','DeskConfiguration','rawAttributes','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','show','params','keys','includeAll','find','catch','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x22e8dc,_0x50b1b0){var _0x103d1b=function(_0x19dfc7){while(--_0x19dfc7){_0x22e8dc['push'](_0x22e8dc['shift']());}};_0x103d1b(++_0x50b1b0);}(_0xdcac,0x1d4));var _0xcdca=function(_0x3331eb,_0x5c6f50){_0x3331eb=_0x3331eb-0x0;var _0x4357eb=_0xdcac[_0x3331eb];return _0x4357eb;};'use strict';var emlformat=require(_0xcdca('0x0'));var rimraf=require(_0xcdca('0x1'));var zipdir=require(_0xcdca('0x2'));var jsonpatch=require(_0xcdca('0x3'));var rp=require(_0xcdca('0x4'));var moment=require(_0xcdca('0x5'));var BPromise=require(_0xcdca('0x6'));var Mustache=require('mustache');var util=require(_0xcdca('0x7'));var path=require('path');var sox=require(_0xcdca('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdca('0x9'));var _=require('lodash');var squel=require(_0xcdca('0xa'));var crypto=require(_0xcdca('0xb'));var jsforce=require(_0xcdca('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcdca('0xd'));var querystring=require(_0xcdca('0xe'));var Papa=require(_0xcdca('0xf'));var Redis=require(_0xcdca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcdca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdca('0x12'));var logger=require(_0xcdca('0x13'))(_0xcdca('0x14'));var utils=require(_0xcdca('0x15'));var config=require(_0xcdca('0x16'));var licenseUtil=require(_0xcdca('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x387f4e,_0x26384b){_0x26384b=_0x26384b||0xcc;return function(_0x12c645){if(_0x12c645){return _0x387f4e['sendStatus'](_0x26384b);}return _0x387f4e['status'](_0x26384b)[_0xcdca('0x18')]();};}function respondWithResult(_0x6ea29,_0x852f0c){_0x852f0c=_0x852f0c||0xc8;return function(_0x5ace2f){if(_0x5ace2f){return _0x6ea29['status'](_0x852f0c)[_0xcdca('0x19')](_0x5ace2f);}};}function respondWithFilteredResult(_0x2c1f45,_0x3cbf9d){return function(_0x3efd36){if(_0x3efd36){var _0x47baf1=typeof _0x3cbf9d[_0xcdca('0x1a')]===_0xcdca('0x1b')&&typeof _0x3cbf9d[_0xcdca('0x1c')]===_0xcdca('0x1b');var _0xee421c=_0x3efd36[_0xcdca('0x1d')];var _0x56087b=_0x47baf1?0x0:_0x3cbf9d[_0xcdca('0x1a')];var _0x3cb4bc=_0x47baf1?_0x3efd36[_0xcdca('0x1d')]:_0x3cbf9d[_0xcdca('0x1a')]+_0x3cbf9d[_0xcdca('0x1c')];var _0xc73598;if(_0x3cb4bc>=_0xee421c){_0x3cb4bc=_0xee421c;_0xc73598=0xc8;}else{_0xc73598=0xce;}_0x2c1f45[_0xcdca('0x1e')](_0xc73598);return _0x2c1f45['set'](_0xcdca('0x1f'),_0x56087b+'-'+_0x3cb4bc+'/'+_0xee421c)[_0xcdca('0x19')](_0x3efd36);}return null;};}function patchUpdates(_0x2bfe54){return function(_0x57fc1e){try{jsonpatch[_0xcdca('0x20')](_0x57fc1e,_0x2bfe54,!![]);}catch(_0x559221){return BPromise[_0xcdca('0x21')](_0x559221);}return _0x57fc1e[_0xcdca('0x22')]();};}function saveUpdates(_0xf84591,_0x330125){return function(_0x909444){if(_0x909444){return _0x909444[_0xcdca('0x23')](_0xf84591)[_0xcdca('0x24')](function(_0x2fc137){return _0x2fc137;});}return null;};}function removeEntity(_0x3edd4e,_0x23bded){return function(_0x116a55){if(_0x116a55){return _0x116a55[_0xcdca('0x25')]()[_0xcdca('0x24')](function(){_0x3edd4e[_0xcdca('0x1e')](0xcc)[_0xcdca('0x18')]();});}};}function handleEntityNotFound(_0x4a8c03,_0x7c9fd7){return function(_0x125f3a){if(!_0x125f3a){_0x4a8c03[_0xcdca('0x26')](0x194);}return _0x125f3a;};}function handleError(_0x3b42ba,_0x48d032){_0x48d032=_0x48d032||0x1f4;return function(_0x28383c){logger[_0xcdca('0x27')](_0x28383c[_0xcdca('0x28')]);if(_0x28383c[_0xcdca('0x29')]){delete _0x28383c[_0xcdca('0x29')];}_0x3b42ba[_0xcdca('0x1e')](_0x48d032)[_0xcdca('0x2a')](_0x28383c);};}exports[_0xcdca('0x2b')]=function(_0x2c62e0,_0x4a12d8){var _0x2a2fc2={},_0xfd323e={},_0x52d255={'count':0x0,'rows':[]};var _0x285c63=_['map'](db[_0xcdca('0x2c')][_0xcdca('0x2d')],function(_0x1b7daa){return{'name':_0x1b7daa['fieldName'],'type':_0x1b7daa[_0xcdca('0x2e')]['key']};});_0xfd323e[_0xcdca('0x2f')]=_[_0xcdca('0x30')](_0x285c63,_0xcdca('0x29'));_0xfd323e[_0xcdca('0x31')]=_['keys'](_0x2c62e0['query']);_0xfd323e['filters']=_[_0xcdca('0x32')](_0xfd323e[_0xcdca('0x2f')],_0xfd323e[_0xcdca('0x31')]);_0x2a2fc2[_0xcdca('0x33')]=_[_0xcdca('0x32')](_0xfd323e['model'],qs[_0xcdca('0x34')](_0x2c62e0[_0xcdca('0x31')][_0xcdca('0x34')]));_0x2a2fc2[_0xcdca('0x33')]=_0x2a2fc2[_0xcdca('0x33')][_0xcdca('0x35')]?_0x2a2fc2[_0xcdca('0x33')]:_0xfd323e[_0xcdca('0x2f')];if(!_0x2c62e0[_0xcdca('0x31')][_0xcdca('0x36')](_0xcdca('0x37'))){_0x2a2fc2[_0xcdca('0x1c')]=qs[_0xcdca('0x1c')](_0x2c62e0[_0xcdca('0x31')][_0xcdca('0x1c')]);_0x2a2fc2[_0xcdca('0x1a')]=qs['offset'](_0x2c62e0[_0xcdca('0x31')]['offset']);}_0x2a2fc2[_0xcdca('0x38')]=qs['sort'](_0x2c62e0[_0xcdca('0x31')][_0xcdca('0x39')]);_0x2a2fc2[_0xcdca('0x3a')]=qs[_0xcdca('0x3b')](_[_0xcdca('0x3c')](_0x2c62e0[_0xcdca('0x31')],_0xfd323e[_0xcdca('0x3b')]),_0x285c63);if(_0x2c62e0['query'][_0xcdca('0x3d')]){_0x2a2fc2[_0xcdca('0x3a')]=_[_0xcdca('0x3e')](_0x2a2fc2['where'],{'$or':_[_0xcdca('0x30')](_0x285c63,function(_0x2a2de3){if(_0x2a2de3[_0xcdca('0x2e')]!=='VIRTUAL'){var _0xc0a666={};_0xc0a666[_0x2a2de3[_0xcdca('0x29')]]={'$like':'%'+_0x2c62e0['query'][_0xcdca('0x3d')]+'%'};return _0xc0a666;}})});}_0x2a2fc2=_[_0xcdca('0x3e')]({},_0x2a2fc2,_0x2c62e0[_0xcdca('0x3f')]);var _0x424c54={'where':_0x2a2fc2['where']};return db[_0xcdca('0x2c')][_0xcdca('0x1d')](_0x424c54)['then'](function(_0x494f54){_0x52d255['count']=_0x494f54;if(_0x2c62e0[_0xcdca('0x31')]['includeAll']){_0x2a2fc2[_0xcdca('0x40')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x2a2fc2);})['then'](function(_0x4b448e){_0x52d255[_0xcdca('0x41')]=_0x4b448e;return _0x52d255;})[_0xcdca('0x24')](respondWithFilteredResult(_0x4a12d8,_0x2a2fc2))['catch'](handleError(_0x4a12d8,null));};exports[_0xcdca('0x42')]=function(_0x4bc6b1,_0x1601fc){var _0x416501={'raw':![],'where':{'id':_0x4bc6b1[_0xcdca('0x43')]['id']}},_0x8e2393={};_0x8e2393[_0xcdca('0x2f')]=_[_0xcdca('0x44')](db[_0xcdca('0x2c')][_0xcdca('0x2d')]);_0x8e2393[_0xcdca('0x31')]=_['keys'](_0x4bc6b1['query']);_0x8e2393[_0xcdca('0x3b')]=_['intersection'](_0x8e2393['model'],_0x8e2393['query']);_0x416501[_0xcdca('0x33')]=_[_0xcdca('0x32')](_0x8e2393[_0xcdca('0x2f')],qs[_0xcdca('0x34')](_0x4bc6b1[_0xcdca('0x31')]['fields']));_0x416501[_0xcdca('0x33')]=_0x416501[_0xcdca('0x33')]['length']?_0x416501[_0xcdca('0x33')]:_0x8e2393['model'];if(_0x4bc6b1[_0xcdca('0x31')][_0xcdca('0x45')]){_0x416501[_0xcdca('0x40')]=[{'all':!![]}];}_0x416501=_[_0xcdca('0x3e')]({},_0x416501,_0x4bc6b1[_0xcdca('0x3f')]);return db[_0xcdca('0x2c')][_0xcdca('0x46')](_0x416501)[_0xcdca('0x24')](handleEntityNotFound(_0x1601fc,null))[_0xcdca('0x24')](respondWithResult(_0x1601fc,null))[_0xcdca('0x47')](handleError(_0x1601fc,null));};exports[_0xcdca('0x48')]=function(_0x5d83f0,_0x3f8884){return db[_0xcdca('0x2c')][_0xcdca('0x48')](_0x5d83f0[_0xcdca('0x49')],{})[_0xcdca('0x24')](respondWithResult(_0x3f8884,0xc9))[_0xcdca('0x47')](handleError(_0x3f8884,null));};exports[_0xcdca('0x23')]=function(_0x2f16e3,_0x17dd37){if(_0x2f16e3[_0xcdca('0x49')]['id']){delete _0x2f16e3['body']['id'];}return db[_0xcdca('0x2c')][_0xcdca('0x46')]({'where':{'id':_0x2f16e3[_0xcdca('0x43')]['id']}})[_0xcdca('0x24')](handleEntityNotFound(_0x17dd37,null))['then'](saveUpdates(_0x2f16e3[_0xcdca('0x49')],null))[_0xcdca('0x24')](respondWithResult(_0x17dd37,null))[_0xcdca('0x47')](handleError(_0x17dd37,null));};exports[_0xcdca('0x25')]=function(_0x2ec88e,_0x7fffec){return db['DeskConfiguration']['find']({'where':{'id':_0x2ec88e[_0xcdca('0x43')]['id']}})['then'](handleEntityNotFound(_0x7fffec,null))['then'](removeEntity(_0x7fffec,null))['catch'](handleError(_0x7fffec,null));};exports[_0xcdca('0x4a')]=function(_0x52911b,_0x25d0cd,_0x111779){var _0xcdbda={};var _0x5b5b5f={};var _0x31b50c;var _0x3a70db;return db[_0xcdca('0x2c')][_0xcdca('0x4b')]({'where':{'id':_0x52911b[_0xcdca('0x43')]['id']}})['then'](handleEntityNotFound(_0x25d0cd,null))[_0xcdca('0x24')](function(_0x1cec43){if(_0x1cec43){_0x31b50c=_0x1cec43;_0x5b5b5f['model']=_[_0xcdca('0x44')](db[_0xcdca('0x4c')]['rawAttributes']);_0x5b5b5f[_0xcdca('0x31')]=_[_0xcdca('0x44')](_0x52911b[_0xcdca('0x31')]);_0x5b5b5f[_0xcdca('0x3b')]=_[_0xcdca('0x32')](_0x5b5b5f['model'],_0x5b5b5f[_0xcdca('0x31')]);_0xcdbda['attributes']=_['intersection'](_0x5b5b5f['model'],qs[_0xcdca('0x34')](_0x52911b[_0xcdca('0x31')][_0xcdca('0x34')]));_0xcdbda['attributes']=_0xcdbda['attributes'][_0xcdca('0x35')]?_0xcdbda[_0xcdca('0x33')]:_0x5b5b5f['model'];_0xcdbda[_0xcdca('0x38')]=qs[_0xcdca('0x39')](_0x52911b[_0xcdca('0x31')][_0xcdca('0x39')]);_0xcdbda[_0xcdca('0x3a')]=qs[_0xcdca('0x3b')](_[_0xcdca('0x3c')](_0x52911b['query'],_0x5b5b5f['filters']));if(_0x52911b[_0xcdca('0x31')][_0xcdca('0x3d')]){_0xcdbda['where']=_['merge'](_0xcdbda[_0xcdca('0x3a')],{'$or':_[_0xcdca('0x30')](_0xcdbda[_0xcdca('0x33')],function(_0x391842){var _0x1efa1f={};_0x1efa1f[_0x391842]={'$like':'%'+_0x52911b[_0xcdca('0x31')][_0xcdca('0x3d')]+'%'};return _0x1efa1f;})});}_0xcdbda=_[_0xcdca('0x3e')]({},_0xcdbda,_0x52911b[_0xcdca('0x3f')]);return _0x31b50c['getFields'](_0xcdbda);}})[_0xcdca('0x24')](function(_0x5237ed){if(_0x5237ed){_0x3a70db=_0x5237ed[_0xcdca('0x35')];if(!_0x52911b[_0xcdca('0x31')][_0xcdca('0x36')]('nolimit')){_0xcdbda['limit']=qs['limit'](_0x52911b[_0xcdca('0x31')][_0xcdca('0x1c')]);_0xcdbda[_0xcdca('0x1a')]=qs[_0xcdca('0x1a')](_0x52911b[_0xcdca('0x31')][_0xcdca('0x1a')]);}return _0x31b50c[_0xcdca('0x4a')](_0xcdbda);}})['then'](function(_0x24a721){if(_0x24a721){return _0x24a721?{'count':_0x3a70db,'rows':_0x24a721}:null;}})[_0xcdca('0x24')](respondWithResult(_0x25d0cd,null))[_0xcdca('0x47')](handleError(_0x25d0cd,null));};exports['getSubjects']=function(_0x305fa2,_0x458f19,_0x24e96a){var _0x2f8537={};var _0x2ce48e={};var _0x25cfe0;var _0x469b88;return db[_0xcdca('0x2c')]['findOne']({'where':{'id':_0x305fa2[_0xcdca('0x43')]['id']}})[_0xcdca('0x24')](handleEntityNotFound(_0x458f19,null))[_0xcdca('0x24')](function(_0x1e2381){if(_0x1e2381){_0x25cfe0=_0x1e2381;_0x2ce48e[_0xcdca('0x2f')]=_['keys'](db['DeskField'][_0xcdca('0x2d')]);_0x2ce48e[_0xcdca('0x31')]=_[_0xcdca('0x44')](_0x305fa2[_0xcdca('0x31')]);_0x2ce48e[_0xcdca('0x3b')]=_[_0xcdca('0x32')](_0x2ce48e['model'],_0x2ce48e[_0xcdca('0x31')]);_0x2f8537['attributes']=_['intersection'](_0x2ce48e[_0xcdca('0x2f')],qs[_0xcdca('0x34')](_0x305fa2['query']['fields']));_0x2f8537[_0xcdca('0x33')]=_0x2f8537[_0xcdca('0x33')]['length']?_0x2f8537['attributes']:_0x2ce48e[_0xcdca('0x2f')];_0x2f8537[_0xcdca('0x38')]=qs[_0xcdca('0x39')](_0x305fa2[_0xcdca('0x31')][_0xcdca('0x39')]);_0x2f8537[_0xcdca('0x3a')]=qs[_0xcdca('0x3b')](_['pick'](_0x305fa2[_0xcdca('0x31')],_0x2ce48e[_0xcdca('0x3b')]));if(_0x305fa2[_0xcdca('0x31')][_0xcdca('0x3d')]){_0x2f8537[_0xcdca('0x3a')]=_[_0xcdca('0x3e')](_0x2f8537[_0xcdca('0x3a')],{'$or':_[_0xcdca('0x30')](_0x2f8537[_0xcdca('0x33')],function(_0x204c8b){var _0x52d35d={};_0x52d35d[_0x204c8b]={'$like':'%'+_0x305fa2[_0xcdca('0x31')][_0xcdca('0x3d')]+'%'};return _0x52d35d;})});}_0x2f8537=_['merge']({},_0x2f8537,_0x305fa2[_0xcdca('0x3f')]);return _0x25cfe0[_0xcdca('0x4d')](_0x2f8537);}})['then'](function(_0x3045d4){if(_0x3045d4){_0x469b88=_0x3045d4[_0xcdca('0x35')];if(!_0x305fa2['query']['hasOwnProperty'](_0xcdca('0x37'))){_0x2f8537[_0xcdca('0x1c')]=qs[_0xcdca('0x1c')](_0x305fa2[_0xcdca('0x31')][_0xcdca('0x1c')]);_0x2f8537[_0xcdca('0x1a')]=qs[_0xcdca('0x1a')](_0x305fa2['query'][_0xcdca('0x1a')]);}return _0x25cfe0[_0xcdca('0x4d')](_0x2f8537);}})[_0xcdca('0x24')](function(_0x2f91fe){if(_0x2f91fe){return _0x2f91fe?{'count':_0x469b88,'rows':_0x2f91fe}:null;}})[_0xcdca('0x24')](respondWithResult(_0x458f19,null))[_0xcdca('0x47')](handleError(_0x458f19,null));};exports[_0xcdca('0x4e')]=function(_0x5855b0,_0x554024,_0x2cfb7e){var _0x2f12e3={};var _0x3242ec={};var _0x13bf2c;var _0x323e3d;return db[_0xcdca('0x2c')][_0xcdca('0x4b')]({'where':{'id':_0x5855b0[_0xcdca('0x43')]['id']}})[_0xcdca('0x24')](handleEntityNotFound(_0x554024,null))[_0xcdca('0x24')](function(_0x2b543a){if(_0x2b543a){_0x13bf2c=_0x2b543a;_0x3242ec[_0xcdca('0x2f')]=_[_0xcdca('0x44')](db['DeskField']['rawAttributes']);_0x3242ec[_0xcdca('0x31')]=_['keys'](_0x5855b0[_0xcdca('0x31')]);_0x3242ec[_0xcdca('0x3b')]=_[_0xcdca('0x32')](_0x3242ec[_0xcdca('0x2f')],_0x3242ec[_0xcdca('0x31')]);_0x2f12e3[_0xcdca('0x33')]=_['intersection'](_0x3242ec[_0xcdca('0x2f')],qs[_0xcdca('0x34')](_0x5855b0[_0xcdca('0x31')]['fields']));_0x2f12e3[_0xcdca('0x33')]=_0x2f12e3[_0xcdca('0x33')][_0xcdca('0x35')]?_0x2f12e3[_0xcdca('0x33')]:_0x3242ec['model'];_0x2f12e3[_0xcdca('0x38')]=qs[_0xcdca('0x39')](_0x5855b0[_0xcdca('0x31')][_0xcdca('0x39')]);_0x2f12e3['where']=qs[_0xcdca('0x3b')](_[_0xcdca('0x3c')](_0x5855b0[_0xcdca('0x31')],_0x3242ec['filters']));if(_0x5855b0[_0xcdca('0x31')]['filter']){_0x2f12e3[_0xcdca('0x3a')]=_[_0xcdca('0x3e')](_0x2f12e3[_0xcdca('0x3a')],{'$or':_[_0xcdca('0x30')](_0x2f12e3['attributes'],function(_0x31ce9b){var _0x22ac13={};_0x22ac13[_0x31ce9b]={'$like':'%'+_0x5855b0['query'][_0xcdca('0x3d')]+'%'};return _0x22ac13;})});}_0x2f12e3=_['merge']({},_0x2f12e3,_0x5855b0['options']);return _0x13bf2c[_0xcdca('0x4e')](_0x2f12e3);}})['then'](function(_0x22ef4b){if(_0x22ef4b){_0x323e3d=_0x22ef4b[_0xcdca('0x35')];if(!_0x5855b0[_0xcdca('0x31')][_0xcdca('0x36')]('nolimit')){_0x2f12e3[_0xcdca('0x1c')]=qs['limit'](_0x5855b0[_0xcdca('0x31')]['limit']);_0x2f12e3[_0xcdca('0x1a')]=qs['offset'](_0x5855b0['query']['offset']);}return _0x13bf2c[_0xcdca('0x4e')](_0x2f12e3);}})[_0xcdca('0x24')](function(_0x523c13){if(_0x523c13){return _0x523c13?{'count':_0x323e3d,'rows':_0x523c13}:null;}})['then'](respondWithResult(_0x554024,null))['catch'](handleError(_0x554024,null));};exports[_0xcdca('0x4f')]=function(_0x24c9ae,_0x548028,_0x28c865){var _0x3dcb4d={};var _0x422b4d={};var _0x2f1c82;var _0xd230dc;return db['DeskConfiguration']['findOne']({'where':{'id':_0x24c9ae['params']['id']}})['then'](handleEntityNotFound(_0x548028,null))[_0xcdca('0x24')](function(_0x1d1a03){if(_0x1d1a03){_0x2f1c82=_0x1d1a03;_0x422b4d[_0xcdca('0x2f')]=_[_0xcdca('0x44')](db[_0xcdca('0x50')]['rawAttributes']);_0x422b4d['query']=_[_0xcdca('0x44')](_0x24c9ae[_0xcdca('0x31')]);_0x422b4d['filters']=_[_0xcdca('0x32')](_0x422b4d[_0xcdca('0x2f')],_0x422b4d[_0xcdca('0x31')]);_0x3dcb4d['attributes']=_[_0xcdca('0x32')](_0x422b4d[_0xcdca('0x2f')],qs[_0xcdca('0x34')](_0x24c9ae[_0xcdca('0x31')][_0xcdca('0x34')]));_0x3dcb4d[_0xcdca('0x33')]=_0x3dcb4d[_0xcdca('0x33')][_0xcdca('0x35')]?_0x3dcb4d['attributes']:_0x422b4d[_0xcdca('0x2f')];_0x3dcb4d[_0xcdca('0x38')]=qs[_0xcdca('0x39')](_0x24c9ae[_0xcdca('0x31')][_0xcdca('0x39')]);_0x3dcb4d[_0xcdca('0x3a')]=qs[_0xcdca('0x3b')](_[_0xcdca('0x3c')](_0x24c9ae[_0xcdca('0x31')],_0x422b4d[_0xcdca('0x3b')]));if(_0x24c9ae[_0xcdca('0x31')][_0xcdca('0x3d')]){_0x3dcb4d[_0xcdca('0x3a')]=_['merge'](_0x3dcb4d[_0xcdca('0x3a')],{'$or':_[_0xcdca('0x30')](_0x3dcb4d[_0xcdca('0x33')],function(_0x17accb){var _0x3c53c4={};_0x3c53c4[_0x17accb]={'$like':'%'+_0x24c9ae[_0xcdca('0x31')][_0xcdca('0x3d')]+'%'};return _0x3c53c4;})});}_0x3dcb4d=_[_0xcdca('0x3e')]({},_0x3dcb4d,_0x24c9ae[_0xcdca('0x3f')]);return _0x2f1c82[_0xcdca('0x4f')](_0x3dcb4d);}})[_0xcdca('0x24')](function(_0x1f944b){if(_0x1f944b){_0xd230dc=_0x1f944b[_0xcdca('0x35')];if(!_0x24c9ae[_0xcdca('0x31')][_0xcdca('0x36')](_0xcdca('0x37'))){_0x3dcb4d[_0xcdca('0x1c')]=qs[_0xcdca('0x1c')](_0x24c9ae[_0xcdca('0x31')]['limit']);_0x3dcb4d['offset']=qs[_0xcdca('0x1a')](_0x24c9ae[_0xcdca('0x31')][_0xcdca('0x1a')]);}return _0x2f1c82[_0xcdca('0x4f')](_0x3dcb4d);}})[_0xcdca('0x24')](function(_0x10487c){if(_0x10487c){return _0x10487c?{'count':_0xd230dc,'rows':_0x10487c}:null;}})['then'](respondWithResult(_0x548028,null))[_0xcdca('0x47')](handleError(_0x548028,null));};exports['setTags']=function(_0x30235f,_0x420967,_0x24f586){if(_0x30235f[_0xcdca('0x49')]['id']){delete _0x30235f[_0xcdca('0x49')]['id'];}return db[_0xcdca('0x2c')][_0xcdca('0x4b')]({'where':{'id':_0x30235f['params']['id']}})[_0xcdca('0x24')](handleEntityNotFound(_0x420967,null))[_0xcdca('0x24')](function(_0x45fe1d){if(_0x45fe1d){return _0x45fe1d['setTags'](_0x30235f['body']['ids']||[]);}return null;})[_0xcdca('0x24')](respondWithResult(_0x420967,null))[_0xcdca('0x47')](handleError(_0x420967,null));}; \ No newline at end of file +var _0x3ac3=['end','json','offset','limit','undefined','count','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ac3,0x1d9));var _0x33ac=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x3ac3[_0x4d7f3f];return _0x5d67cc;};'use strict';var emlformat=require(_0x33ac('0x0'));var rimraf=require(_0x33ac('0x1'));var zipdir=require(_0x33ac('0x2'));var jsonpatch=require(_0x33ac('0x3'));var rp=require('request-promise');var moment=require(_0x33ac('0x4'));var BPromise=require(_0x33ac('0x5'));var Mustache=require(_0x33ac('0x6'));var util=require('util');var path=require(_0x33ac('0x7'));var sox=require(_0x33ac('0x8'));var csv=require(_0x33ac('0x9'));var ejs=require(_0x33ac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x33ac('0xb'));var crypto=require(_0x33ac('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x33ac('0xd'));var toCsv=require(_0x33ac('0x9'));var querystring=require(_0x33ac('0xe'));var Papa=require(_0x33ac('0xf'));var Redis=require('ioredis');var authService=require(_0x33ac('0x10'));var qs=require(_0x33ac('0x11'));var as=require(_0x33ac('0x12'));var hardwareService=require(_0x33ac('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x33ac('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x33ac('0x15'));var db=require(_0x33ac('0x16'))['db'];function respondWithStatusCode(_0x1f5733,_0x5dd1b1){_0x5dd1b1=_0x5dd1b1||0xcc;return function(_0x20ba07){if(_0x20ba07){return _0x1f5733[_0x33ac('0x17')](_0x5dd1b1);}return _0x1f5733[_0x33ac('0x18')](_0x5dd1b1)[_0x33ac('0x19')]();};}function respondWithResult(_0x59f8f6,_0x4305ba){_0x4305ba=_0x4305ba||0xc8;return function(_0x113342){if(_0x113342){return _0x59f8f6[_0x33ac('0x18')](_0x4305ba)[_0x33ac('0x1a')](_0x113342);}};}function respondWithFilteredResult(_0x82545e,_0x4ac99a){return function(_0x19cb6e){if(_0x19cb6e){var _0x104b1f=typeof _0x4ac99a[_0x33ac('0x1b')]==='undefined'&&typeof _0x4ac99a[_0x33ac('0x1c')]===_0x33ac('0x1d');var _0x18277a=_0x19cb6e['count'];var _0x459a2a=_0x104b1f?0x0:_0x4ac99a[_0x33ac('0x1b')];var _0x13c197=_0x104b1f?_0x19cb6e[_0x33ac('0x1e')]:_0x4ac99a[_0x33ac('0x1b')]+_0x4ac99a['limit'];var _0x1d34ea;if(_0x13c197>=_0x18277a){_0x13c197=_0x18277a;_0x1d34ea=0xc8;}else{_0x1d34ea=0xce;}_0x82545e['status'](_0x1d34ea);return _0x82545e['set']('Content-Range',_0x459a2a+'-'+_0x13c197+'/'+_0x18277a)[_0x33ac('0x1a')](_0x19cb6e);}return null;};}function patchUpdates(_0x564801){return function(_0xa10f39){try{jsonpatch[_0x33ac('0x1f')](_0xa10f39,_0x564801,!![]);}catch(_0x80c60c){return BPromise[_0x33ac('0x20')](_0x80c60c);}return _0xa10f39[_0x33ac('0x21')]();};}function saveUpdates(_0x508532,_0x22699b){return function(_0x4da0c6){if(_0x4da0c6){return _0x4da0c6[_0x33ac('0x22')](_0x508532)[_0x33ac('0x23')](function(_0x419b8a){return _0x419b8a;});}return null;};}function removeEntity(_0xd31d56,_0x1c0a47){return function(_0xedef4b){if(_0xedef4b){return _0xedef4b['destroy']()[_0x33ac('0x23')](function(){_0xd31d56[_0x33ac('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1914bd,_0x43b41e){return function(_0x4231f3){if(!_0x4231f3){_0x1914bd[_0x33ac('0x17')](0x194);}return _0x4231f3;};}function handleError(_0x4df7d0,_0x16ffc5){_0x16ffc5=_0x16ffc5||0x1f4;return function(_0x57d5df){logger[_0x33ac('0x24')](_0x57d5df['stack']);if(_0x57d5df[_0x33ac('0x25')]){delete _0x57d5df[_0x33ac('0x25')];}_0x4df7d0[_0x33ac('0x18')](_0x16ffc5)[_0x33ac('0x26')](_0x57d5df);};}exports[_0x33ac('0x27')]=function(_0x42ecef,_0x4b2649){var _0x4b97e1={},_0x4cfc6a={},_0x1fcf18={'count':0x0,'rows':[]};var _0x419e50=_[_0x33ac('0x28')](db['DeskConfiguration'][_0x33ac('0x29')],function(_0x38d859){return{'name':_0x38d859[_0x33ac('0x2a')],'type':_0x38d859[_0x33ac('0x2b')][_0x33ac('0x2c')]};});_0x4cfc6a[_0x33ac('0x2d')]=_['map'](_0x419e50,_0x33ac('0x25'));_0x4cfc6a[_0x33ac('0x2e')]=_[_0x33ac('0x2f')](_0x42ecef[_0x33ac('0x2e')]);_0x4cfc6a[_0x33ac('0x30')]=_[_0x33ac('0x31')](_0x4cfc6a['model'],_0x4cfc6a[_0x33ac('0x2e')]);_0x4b97e1['attributes']=_[_0x33ac('0x31')](_0x4cfc6a[_0x33ac('0x2d')],qs[_0x33ac('0x32')](_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x4b97e1[_0x33ac('0x33')]=_0x4b97e1[_0x33ac('0x33')][_0x33ac('0x34')]?_0x4b97e1[_0x33ac('0x33')]:_0x4cfc6a['model'];if(!_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x4b97e1[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x1c')]);_0x4b97e1[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x42ecef['query']['offset']);}_0x4b97e1['order']=qs[_0x33ac('0x37')](_0x42ecef['query'][_0x33ac('0x37')]);_0x4b97e1[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_[_0x33ac('0x39')](_0x42ecef[_0x33ac('0x2e')],_0x4cfc6a[_0x33ac('0x30')]),_0x419e50);if(_0x42ecef['query'][_0x33ac('0x3a')]){_0x4b97e1[_0x33ac('0x38')]=_[_0x33ac('0x3b')](_0x4b97e1[_0x33ac('0x38')],{'$or':_[_0x33ac('0x28')](_0x419e50,function(_0x2d7a19){if(_0x2d7a19[_0x33ac('0x2b')]!==_0x33ac('0x3c')){var _0x4f71ec={};_0x4f71ec[_0x2d7a19[_0x33ac('0x25')]]={'$like':'%'+_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x3a')]+'%'};return _0x4f71ec;}})});}_0x4b97e1=_['merge']({},_0x4b97e1,_0x42ecef[_0x33ac('0x3d')]);var _0x3582d1={'where':_0x4b97e1[_0x33ac('0x38')]};return db[_0x33ac('0x3e')][_0x33ac('0x1e')](_0x3582d1)[_0x33ac('0x23')](function(_0x4d20b5){_0x1fcf18[_0x33ac('0x1e')]=_0x4d20b5;if(_0x42ecef[_0x33ac('0x2e')][_0x33ac('0x3f')]){_0x4b97e1[_0x33ac('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x33ac('0x41')](_0x4b97e1);})[_0x33ac('0x23')](function(_0x75cac9){_0x1fcf18[_0x33ac('0x42')]=_0x75cac9;return _0x1fcf18;})[_0x33ac('0x23')](respondWithFilteredResult(_0x4b2649,_0x4b97e1))[_0x33ac('0x43')](handleError(_0x4b2649,null));};exports[_0x33ac('0x44')]=function(_0xb01b73,_0x4b6f74){var _0x14936c={'raw':![],'where':{'id':_0xb01b73[_0x33ac('0x45')]['id']}},_0x4a40e6={};_0x4a40e6[_0x33ac('0x2d')]=_[_0x33ac('0x2f')](db[_0x33ac('0x3e')][_0x33ac('0x29')]);_0x4a40e6[_0x33ac('0x2e')]=_['keys'](_0xb01b73[_0x33ac('0x2e')]);_0x4a40e6[_0x33ac('0x30')]=_['intersection'](_0x4a40e6[_0x33ac('0x2d')],_0x4a40e6['query']);_0x14936c[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x4a40e6[_0x33ac('0x2d')],qs['fields'](_0xb01b73[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x14936c[_0x33ac('0x33')]=_0x14936c[_0x33ac('0x33')]['length']?_0x14936c[_0x33ac('0x33')]:_0x4a40e6[_0x33ac('0x2d')];if(_0xb01b73[_0x33ac('0x2e')][_0x33ac('0x3f')]){_0x14936c['include']=[{'all':!![]}];}_0x14936c=_[_0x33ac('0x3b')]({},_0x14936c,_0xb01b73['options']);return db[_0x33ac('0x3e')][_0x33ac('0x46')](_0x14936c)[_0x33ac('0x23')](handleEntityNotFound(_0x4b6f74,null))[_0x33ac('0x23')](respondWithResult(_0x4b6f74,null))[_0x33ac('0x43')](handleError(_0x4b6f74,null));};exports[_0x33ac('0x47')]=function(_0x54c15c,_0x2d1fc9){return db['DeskConfiguration']['create'](_0x54c15c['body'],{})[_0x33ac('0x23')](respondWithResult(_0x2d1fc9,0xc9))[_0x33ac('0x43')](handleError(_0x2d1fc9,null));};exports[_0x33ac('0x22')]=function(_0x2e023d,_0x5cb713){if(_0x2e023d['body']['id']){delete _0x2e023d['body']['id'];}return db[_0x33ac('0x3e')]['find']({'where':{'id':_0x2e023d[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x5cb713,null))[_0x33ac('0x23')](saveUpdates(_0x2e023d[_0x33ac('0x48')],null))[_0x33ac('0x23')](respondWithResult(_0x5cb713,null))[_0x33ac('0x43')](handleError(_0x5cb713,null));};exports[_0x33ac('0x49')]=function(_0x47d664,_0x16b7af){return db[_0x33ac('0x3e')]['find']({'where':{'id':_0x47d664['params']['id']}})['then'](handleEntityNotFound(_0x16b7af,null))[_0x33ac('0x23')](removeEntity(_0x16b7af,null))[_0x33ac('0x43')](handleError(_0x16b7af,null));};exports['getFields']=function(_0x54490f,_0x3b05f7,_0x1acfe6){var _0x375043={};var _0x229d8b={};var _0xfe3449;var _0x141ad2;return db[_0x33ac('0x3e')][_0x33ac('0x4a')]({'where':{'id':_0x54490f[_0x33ac('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b05f7,null))[_0x33ac('0x23')](function(_0x399524){if(_0x399524){_0xfe3449=_0x399524;_0x229d8b[_0x33ac('0x2d')]=_[_0x33ac('0x2f')](db[_0x33ac('0x4b')]['rawAttributes']);_0x229d8b[_0x33ac('0x2e')]=_['keys'](_0x54490f['query']);_0x229d8b[_0x33ac('0x30')]=_['intersection'](_0x229d8b[_0x33ac('0x2d')],_0x229d8b[_0x33ac('0x2e')]);_0x375043[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x229d8b[_0x33ac('0x2d')],qs['fields'](_0x54490f[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x375043[_0x33ac('0x33')]=_0x375043[_0x33ac('0x33')][_0x33ac('0x34')]?_0x375043[_0x33ac('0x33')]:_0x229d8b[_0x33ac('0x2d')];_0x375043[_0x33ac('0x4c')]=qs[_0x33ac('0x37')](_0x54490f[_0x33ac('0x2e')]['sort']);_0x375043[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_[_0x33ac('0x39')](_0x54490f['query'],_0x229d8b[_0x33ac('0x30')]));if(_0x54490f[_0x33ac('0x2e')]['filter']){_0x375043['where']=_[_0x33ac('0x3b')](_0x375043[_0x33ac('0x38')],{'$or':_['map'](_0x375043['attributes'],function(_0x3f81dd){var _0x1a42f6={};_0x1a42f6[_0x3f81dd]={'$like':'%'+_0x54490f[_0x33ac('0x2e')]['filter']+'%'};return _0x1a42f6;})});}_0x375043=_['merge']({},_0x375043,_0x54490f['options']);return _0xfe3449[_0x33ac('0x4d')](_0x375043);}})[_0x33ac('0x23')](function(_0x4de2fd){if(_0x4de2fd){_0x141ad2=_0x4de2fd['length'];if(!_0x54490f[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x375043[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x54490f[_0x33ac('0x2e')][_0x33ac('0x1c')]);_0x375043[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x54490f[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0xfe3449[_0x33ac('0x4d')](_0x375043);}})[_0x33ac('0x23')](function(_0x20dbbf){if(_0x20dbbf){return _0x20dbbf?{'count':_0x141ad2,'rows':_0x20dbbf}:null;}})['then'](respondWithResult(_0x3b05f7,null))[_0x33ac('0x43')](handleError(_0x3b05f7,null));};exports['getSubjects']=function(_0x462457,_0x57fff9,_0x249129){var _0x537fc8={};var _0x5cfa99={};var _0x18795c;var _0x5ccbe3;return db[_0x33ac('0x3e')][_0x33ac('0x4a')]({'where':{'id':_0x462457[_0x33ac('0x45')]['id']}})['then'](handleEntityNotFound(_0x57fff9,null))['then'](function(_0x5f2c2d){if(_0x5f2c2d){_0x18795c=_0x5f2c2d;_0x5cfa99[_0x33ac('0x2d')]=_[_0x33ac('0x2f')](db['DeskField']['rawAttributes']);_0x5cfa99['query']=_['keys'](_0x462457['query']);_0x5cfa99[_0x33ac('0x30')]=_['intersection'](_0x5cfa99['model'],_0x5cfa99[_0x33ac('0x2e')]);_0x537fc8['attributes']=_[_0x33ac('0x31')](_0x5cfa99[_0x33ac('0x2d')],qs[_0x33ac('0x32')](_0x462457[_0x33ac('0x2e')]['fields']));_0x537fc8['attributes']=_0x537fc8['attributes'][_0x33ac('0x34')]?_0x537fc8['attributes']:_0x5cfa99['model'];_0x537fc8[_0x33ac('0x4c')]=qs[_0x33ac('0x37')](_0x462457['query'][_0x33ac('0x37')]);_0x537fc8[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_['pick'](_0x462457['query'],_0x5cfa99[_0x33ac('0x30')]));if(_0x462457[_0x33ac('0x2e')][_0x33ac('0x3a')]){_0x537fc8['where']=_[_0x33ac('0x3b')](_0x537fc8[_0x33ac('0x38')],{'$or':_[_0x33ac('0x28')](_0x537fc8['attributes'],function(_0x1afab6){var _0x4359de={};_0x4359de[_0x1afab6]={'$like':'%'+_0x462457['query'][_0x33ac('0x3a')]+'%'};return _0x4359de;})});}_0x537fc8=_[_0x33ac('0x3b')]({},_0x537fc8,_0x462457['options']);return _0x18795c[_0x33ac('0x4e')](_0x537fc8);}})[_0x33ac('0x23')](function(_0x2fc7fc){if(_0x2fc7fc){_0x5ccbe3=_0x2fc7fc[_0x33ac('0x34')];if(!_0x462457[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x537fc8[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x462457['query'][_0x33ac('0x1c')]);_0x537fc8[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x462457[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0x18795c['getSubjects'](_0x537fc8);}})[_0x33ac('0x23')](function(_0x1c0bd6){if(_0x1c0bd6){return _0x1c0bd6?{'count':_0x5ccbe3,'rows':_0x1c0bd6}:null;}})[_0x33ac('0x23')](respondWithResult(_0x57fff9,null))[_0x33ac('0x43')](handleError(_0x57fff9,null));};exports[_0x33ac('0x4f')]=function(_0xd51f75,_0x4ba36d,_0x1fc85c){var _0x5c2cab={};var _0x4fe50f={};var _0x1851d6;var _0xc3820a;return db['DeskConfiguration'][_0x33ac('0x4a')]({'where':{'id':_0xd51f75[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x4ba36d,null))['then'](function(_0x395519){if(_0x395519){_0x1851d6=_0x395519;_0x4fe50f['model']=_['keys'](db[_0x33ac('0x4b')]['rawAttributes']);_0x4fe50f['query']=_[_0x33ac('0x2f')](_0xd51f75[_0x33ac('0x2e')]);_0x4fe50f[_0x33ac('0x30')]=_[_0x33ac('0x31')](_0x4fe50f[_0x33ac('0x2d')],_0x4fe50f['query']);_0x5c2cab[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x4fe50f[_0x33ac('0x2d')],qs[_0x33ac('0x32')](_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x5c2cab[_0x33ac('0x33')]=_0x5c2cab[_0x33ac('0x33')][_0x33ac('0x34')]?_0x5c2cab[_0x33ac('0x33')]:_0x4fe50f[_0x33ac('0x2d')];_0x5c2cab['order']=qs['sort'](_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x37')]);_0x5c2cab['where']=qs['filters'](_['pick'](_0xd51f75[_0x33ac('0x2e')],_0x4fe50f[_0x33ac('0x30')]));if(_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x3a')]){_0x5c2cab[_0x33ac('0x38')]=_[_0x33ac('0x3b')](_0x5c2cab[_0x33ac('0x38')],{'$or':_[_0x33ac('0x28')](_0x5c2cab[_0x33ac('0x33')],function(_0x361876){var _0x590b99={};_0x590b99[_0x361876]={'$like':'%'+_0xd51f75['query'][_0x33ac('0x3a')]+'%'};return _0x590b99;})});}_0x5c2cab=_[_0x33ac('0x3b')]({},_0x5c2cab,_0xd51f75['options']);return _0x1851d6[_0x33ac('0x4f')](_0x5c2cab);}})[_0x33ac('0x23')](function(_0x40e59f){if(_0x40e59f){_0xc3820a=_0x40e59f['length'];if(!_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x35')]('nolimit')){_0x5c2cab['limit']=qs[_0x33ac('0x1c')](_0xd51f75['query'][_0x33ac('0x1c')]);_0x5c2cab[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0xd51f75[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0x1851d6[_0x33ac('0x4f')](_0x5c2cab);}})[_0x33ac('0x23')](function(_0x33f1ab){if(_0x33f1ab){return _0x33f1ab?{'count':_0xc3820a,'rows':_0x33f1ab}:null;}})[_0x33ac('0x23')](respondWithResult(_0x4ba36d,null))[_0x33ac('0x43')](handleError(_0x4ba36d,null));};exports[_0x33ac('0x50')]=function(_0x4af84b,_0x2baf5d,_0xc1b400){var _0x398f5e={};var _0x759003={};var _0x55d07b;var _0x419c32;return db[_0x33ac('0x3e')]['findOne']({'where':{'id':_0x4af84b[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x2baf5d,null))['then'](function(_0x102665){if(_0x102665){_0x55d07b=_0x102665;_0x759003[_0x33ac('0x2d')]=_['keys'](db[_0x33ac('0x51')][_0x33ac('0x29')]);_0x759003['query']=_['keys'](_0x4af84b[_0x33ac('0x2e')]);_0x759003['filters']=_[_0x33ac('0x31')](_0x759003[_0x33ac('0x2d')],_0x759003[_0x33ac('0x2e')]);_0x398f5e[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x759003[_0x33ac('0x2d')],qs['fields'](_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x32')]));_0x398f5e['attributes']=_0x398f5e[_0x33ac('0x33')][_0x33ac('0x34')]?_0x398f5e[_0x33ac('0x33')]:_0x759003[_0x33ac('0x2d')];_0x398f5e[_0x33ac('0x4c')]=qs[_0x33ac('0x37')](_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x37')]);_0x398f5e[_0x33ac('0x38')]=qs[_0x33ac('0x30')](_[_0x33ac('0x39')](_0x4af84b[_0x33ac('0x2e')],_0x759003[_0x33ac('0x30')]));if(_0x4af84b[_0x33ac('0x2e')]['filter']){_0x398f5e['where']=_[_0x33ac('0x3b')](_0x398f5e['where'],{'$or':_[_0x33ac('0x28')](_0x398f5e[_0x33ac('0x33')],function(_0x1c7e82){var _0x1f5d0b={};_0x1f5d0b[_0x1c7e82]={'$like':'%'+_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x3a')]+'%'};return _0x1f5d0b;})});}_0x398f5e=_[_0x33ac('0x3b')]({},_0x398f5e,_0x4af84b[_0x33ac('0x3d')]);return _0x55d07b[_0x33ac('0x50')](_0x398f5e);}})[_0x33ac('0x23')](function(_0x338531){if(_0x338531){_0x419c32=_0x338531['length'];if(!_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x35')](_0x33ac('0x36'))){_0x398f5e[_0x33ac('0x1c')]=qs[_0x33ac('0x1c')](_0x4af84b['query'][_0x33ac('0x1c')]);_0x398f5e[_0x33ac('0x1b')]=qs['offset'](_0x4af84b[_0x33ac('0x2e')][_0x33ac('0x1b')]);}return _0x55d07b['getTags'](_0x398f5e);}})[_0x33ac('0x23')](function(_0x71aad){if(_0x71aad){return _0x71aad?{'count':_0x419c32,'rows':_0x71aad}:null;}})[_0x33ac('0x23')](respondWithResult(_0x2baf5d,null))[_0x33ac('0x43')](handleError(_0x2baf5d,null));};exports['setTags']=function(_0x476a57,_0x2760b2,_0x2388ad){if(_0x476a57['body']['id']){delete _0x476a57[_0x33ac('0x48')]['id'];}return db[_0x33ac('0x3e')]['findOne']({'where':{'id':_0x476a57[_0x33ac('0x45')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x2760b2,null))['then'](function(_0x2ef565){if(_0x2ef565){return _0x2ef565[_0x33ac('0x52')](_0x476a57[_0x33ac('0x48')]['ids']||[]);}return null;})[_0x33ac('0x23')](respondWithResult(_0x2760b2,null))[_0x33ac('0x43')](handleError(_0x2760b2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5cb9085..1faeb7f 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 _0xb50c=['bluebird','request-promise','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api'];(function(_0xa18f6a,_0x347f46){var _0x4a1150=function(_0x34c8a2){while(--_0x34c8a2){_0xa18f6a['push'](_0xa18f6a['shift']());}};_0x4a1150(++_0x347f46);}(_0xb50c,0x173));var _0xcb50=function(_0x3b8cb6,_0x27e950){_0x3b8cb6=_0x3b8cb6-0x0;var _0x303a1b=_0xb50c[_0x3b8cb6];return _0x303a1b;};'use strict';var _=require(_0xcb50('0x0'));var util=require('util');var logger=require(_0xcb50('0x1'))(_0xcb50('0x2'));var moment=require('moment');var BPromise=require(_0xcb50('0x3'));var rp=require(_0xcb50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb50('0x5'));var config=require(_0xcb50('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xcb50('0x7')]=function(_0x1ca50,_0x5977d2){return _0x1ca50[_0xcb50('0x8')](_0xcb50('0x9'),attributes,{'tableName':_0xcb50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde71=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3d8a92,_0x2bd8aa){var _0x19fb63=function(_0x265f54){while(--_0x265f54){_0x3d8a92['push'](_0x3d8a92['shift']());}};_0x19fb63(++_0x2bd8aa);}(_0xde71,0x1c1));var _0x1de7=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xde71[_0x343e44];return _0xa5130e;};'use strict';var _=require(_0x1de7('0x0'));var util=require(_0x1de7('0x1'));var logger=require(_0x1de7('0x2'))(_0x1de7('0x3'));var moment=require('moment');var BPromise=require(_0x1de7('0x4'));var rp=require(_0x1de7('0x5'));var fs=require('fs');var path=require(_0x1de7('0x6'));var rimraf=require(_0x1de7('0x7'));var config=require(_0x1de7('0x8'));var attributes=require(_0x1de7('0x9'));module['exports']=function(_0x34d17a,_0xd38b7f){return _0x34d17a[_0x1de7('0xa')](_0x1de7('0xb'),attributes,{'tableName':_0x1de7('0xc'),'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 1d6fde5..c7e38bf 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 _0x2905=['../../config/environment','jayson/promise','client','then','info','request\x20sent','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x35d319,_0x46361e){var _0x1dafcb=function(_0x33ef1f){while(--_0x33ef1f){_0x35d319['push'](_0x35d319['shift']());}};_0x1dafcb(++_0x46361e);}(_0x2905,0x19c));var _0x5290=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2905[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5290('0x0'));var util=require(_0x5290('0x1'));var moment=require(_0x5290('0x2'));var BPromise=require('bluebird');var rs=require(_0x5290('0x3'));var fs=require('fs');var Redis=require(_0x5290('0x4'));var db=require(_0x5290('0x5'))['db'];var utils=require(_0x5290('0x6'));var logger=require(_0x5290('0x7'))('rpc');var config=require(_0x5290('0x8'));var jayson=require(_0x5290('0x9'));var client=jayson[_0x5290('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cc8b7,_0x2dcc72,_0x11ef1b){return new BPromise(function(_0x3bfa1a,_0x4c6f1b){return client['request'](_0x5cc8b7,_0x11ef1b)[_0x5290('0xb')](function(_0x22bb06){logger[_0x5290('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2dcc72,_0x5290('0xd'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2dcc72,_0x5290('0xd'),JSON['stringify'](_0x22bb06));if(_0x22bb06[_0x5290('0xe')]){if(_0x22bb06['error'][_0x5290('0xf')]===0x1f4){logger[_0x5290('0xe')](_0x5290('0x10'),_0x2dcc72,_0x22bb06[_0x5290('0xe')][_0x5290('0x11')]);return _0x4c6f1b(_0x22bb06['error'][_0x5290('0x11')]);}logger['error'](_0x5290('0x10'),_0x2dcc72,_0x22bb06[_0x5290('0xe')][_0x5290('0x11')]);return _0x3bfa1a(_0x22bb06[_0x5290('0xe')][_0x5290('0x11')]);}else{logger[_0x5290('0xc')](_0x5290('0x10'),_0x2dcc72,_0x5290('0xd'));_0x3bfa1a(_0x22bb06[_0x5290('0x12')]['message']);}})[_0x5290('0x13')](function(_0x178a3b){logger['error'](_0x5290('0x10'),_0x2dcc72,_0x178a3b);_0x4c6f1b(_0x178a3b);});});} \ No newline at end of file +var _0x4f31=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','bluebird','ioredis'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x4f31,0x13f));var _0x14f3=function(_0x448691,_0x191d08){_0x448691=_0x448691-0x0;var _0x510dde=_0x4f31[_0x448691];return _0x510dde;};'use strict';var _=require(_0x14f3('0x0'));var util=require(_0x14f3('0x1'));var moment=require('moment');var BPromise=require(_0x14f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14f3('0x3'));var db=require(_0x14f3('0x4'))['db'];var utils=require(_0x14f3('0x5'));var logger=require(_0x14f3('0x6'))('rpc');var config=require(_0x14f3('0x7'));var jayson=require(_0x14f3('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x111fd0,_0xcff316,_0xfe48f7){return new BPromise(function(_0x314584,_0x541973){return client['request'](_0x111fd0,_0xfe48f7)['then'](function(_0x22de60){logger[_0x14f3('0x9')](_0x14f3('0xa'),_0xcff316,'request\x20sent');logger[_0x14f3('0xb')](_0x14f3('0xc'),_0xcff316,_0x14f3('0xd'),JSON[_0x14f3('0xe')](_0x22de60));if(_0x22de60['error']){if(_0x22de60['error'][_0x14f3('0xf')]===0x1f4){logger[_0x14f3('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0xcff316,_0x22de60[_0x14f3('0x10')]['message']);return _0x541973(_0x22de60[_0x14f3('0x10')][_0x14f3('0x11')]);}logger[_0x14f3('0x10')](_0x14f3('0xa'),_0xcff316,_0x22de60[_0x14f3('0x10')][_0x14f3('0x11')]);return _0x314584(_0x22de60['error'][_0x14f3('0x11')]);}else{logger[_0x14f3('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0xcff316,'request\x20sent');_0x314584(_0x22de60[_0x14f3('0x12')]['message']);}})['catch'](function(_0xb241bd){logger['error'](_0x14f3('0xa'),_0xcff316,_0xb241bd);_0x541973(_0xb241bd);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2e99b47..757d2ec 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 _0x5a41=['../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4b55d2,_0x562ee2){var _0x14eadd=function(_0x2eb5f6){while(--_0x2eb5f6){_0x4b55d2['push'](_0x4b55d2['shift']());}};_0x14eadd(++_0x562ee2);}(_0x5a41,0x1b1));var _0x15a4=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x5a41[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x15a4('0x0'));var util=require(_0x15a4('0x1'));var path=require(_0x15a4('0x2'));var timeout=require(_0x15a4('0x3'));var express=require(_0x15a4('0x4'));var router=express['Router']();var fs_extra=require(_0x15a4('0x5'));var auth=require(_0x15a4('0x6'));var interaction=require(_0x15a4('0x7'));var config=require(_0x15a4('0x8'));var controller=require(_0x15a4('0x9'));router['get']('/',auth[_0x15a4('0xa')](),controller[_0x15a4('0xb')]);router[_0x15a4('0xc')]('/:id',auth[_0x15a4('0xa')](),controller[_0x15a4('0xd')]);router[_0x15a4('0xe')]('/',auth[_0x15a4('0xa')](),controller[_0x15a4('0xf')]);router[_0x15a4('0x10')](_0x15a4('0x11'),auth['isAuthenticated'](),controller[_0x15a4('0x12')]);router[_0x15a4('0x13')](_0x15a4('0x11'),auth['isAuthenticated'](),controller[_0x15a4('0x14')]);module[_0x15a4('0x15')]=router; \ No newline at end of file +var _0x17c1=['get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3565c7,_0x21db85){var _0x4eb77c=function(_0x13b47b){while(--_0x13b47b){_0x3565c7['push'](_0x3565c7['shift']());}};_0x4eb77c(++_0x21db85);}(_0x17c1,0x184));var _0x117c=function(_0x4aa5d2,_0x2b9544){_0x4aa5d2=_0x4aa5d2-0x0;var _0x363711=_0x17c1[_0x4aa5d2];return _0x363711;};'use strict';var multer=require(_0x117c('0x0'));var util=require(_0x117c('0x1'));var path=require('path');var timeout=require(_0x117c('0x2'));var express=require('express');var router=express[_0x117c('0x3')]();var fs_extra=require(_0x117c('0x4'));var auth=require(_0x117c('0x5'));var interaction=require(_0x117c('0x6'));var config=require(_0x117c('0x7'));var controller=require('./intDeskField.controller');router[_0x117c('0x8')]('/',auth[_0x117c('0x9')](),controller[_0x117c('0xa')]);router[_0x117c('0x8')](_0x117c('0xb'),auth[_0x117c('0x9')](),controller['show']);router[_0x117c('0xc')]('/',auth[_0x117c('0x9')](),controller['create']);router[_0x117c('0xd')]('/:id',auth[_0x117c('0x9')](),controller[_0x117c('0xe')]);router[_0x117c('0xf')](_0x117c('0xb'),auth[_0x117c('0x9')](),controller[_0x117c('0x10')]);module[_0x117c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d42f1f3..fb0cefe 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 _0x6e8c=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x42560f,_0x4f5e27){var _0xd43c91=function(_0x512a8d){while(--_0x512a8d){_0x42560f['push'](_0x42560f['shift']());}};_0xd43c91(++_0x4f5e27);}(_0x6e8c,0xf1));var _0xc6e8=function(_0x15e037,_0x3bdceb){_0x15e037=_0x15e037-0x0;var _0x388850=_0x6e8c[_0x15e037];return _0x388850;};'use strict';var Sequelize=require(_0xc6e8('0x0'));module[_0xc6e8('0x1')]={'type':{'type':Sequelize[_0xc6e8('0x2')](_0xc6e8('0x3'),_0xc6e8('0x4'),_0xc6e8('0x5'),_0xc6e8('0x6'),_0xc6e8('0x7')),'defaultValue':_0xc6e8('0x3')},'content':{'type':Sequelize[_0xc6e8('0x8')]},'key':{'type':Sequelize[_0xc6e8('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xc6e8('0x3'),_0xc6e8('0x4'),_0xc6e8('0x5'))},'keyContent':{'type':Sequelize[_0xc6e8('0x8')]},'idField':{'type':Sequelize[_0xc6e8('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc6e8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6e8('0x8')]}}; \ No newline at end of file +var _0x56cd=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x56cd,0x12c));var _0xd56c=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x56cd[_0x53cf8e];return _0x459197;};'use strict';var Sequelize=require('sequelize');module[_0xd56c('0x0')]={'type':{'type':Sequelize[_0xd56c('0x1')](_0xd56c('0x2'),_0xd56c('0x3'),_0xd56c('0x4'),_0xd56c('0x5'),_0xd56c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd56c('0x7')]},'key':{'type':Sequelize[_0xd56c('0x7')]},'keyType':{'type':Sequelize[_0xd56c('0x1')]('string',_0xd56c('0x3'),_0xd56c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd56c('0x7')]},'nameField':{'type':Sequelize[_0xd56c('0x7')]},'customField':{'type':Sequelize[_0xd56c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5d16852..23f1974 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 _0x1203=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','then','rows','catch','show','keys','DeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5782a3,_0x2d54f3){var _0x5dcae1=function(_0x27e769){while(--_0x27e769){_0x5782a3['push'](_0x5782a3['shift']());}};_0x5dcae1(++_0x2d54f3);}(_0x1203,0x8c));var _0x3120=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1203[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3120('0x0'));var rimraf=require(_0x3120('0x1'));var zipdir=require(_0x3120('0x2'));var jsonpatch=require(_0x3120('0x3'));var rp=require(_0x3120('0x4'));var moment=require(_0x3120('0x5'));var BPromise=require(_0x3120('0x6'));var Mustache=require(_0x3120('0x7'));var util=require(_0x3120('0x8'));var path=require(_0x3120('0x9'));var sox=require(_0x3120('0xa'));var csv=require(_0x3120('0xb'));var ejs=require(_0x3120('0xc'));var fs=require('fs');var fs_extra=require(_0x3120('0xd'));var _=require(_0x3120('0xe'));var squel=require(_0x3120('0xf'));var crypto=require('crypto');var jsforce=require(_0x3120('0x10'));var deskjs=require(_0x3120('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3120('0x12'));var authService=require(_0x3120('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3120('0x14'));var hardwareService=require(_0x3120('0x15'));var logger=require(_0x3120('0x16'))(_0x3120('0x17'));var utils=require('../../config/utils');var config=require(_0x3120('0x18'));var licenseUtil=require(_0x3120('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4312,_0x41a236){_0x41a236=_0x41a236||0xcc;return function(_0x2b1879){if(_0x2b1879){return _0x4a4312[_0x3120('0x1a')](_0x41a236);}return _0x4a4312[_0x3120('0x1b')](_0x41a236)[_0x3120('0x1c')]();};}function respondWithResult(_0x1f05b6,_0x1ef350){_0x1ef350=_0x1ef350||0xc8;return function(_0x4a2b20){if(_0x4a2b20){return _0x1f05b6[_0x3120('0x1b')](_0x1ef350)[_0x3120('0x1d')](_0x4a2b20);}};}function respondWithFilteredResult(_0xcda8,_0x18357e){return function(_0x1d919e){if(_0x1d919e){var _0x335d6b=typeof _0x18357e[_0x3120('0x1e')]==='undefined'&&typeof _0x18357e[_0x3120('0x1f')]==='undefined';var _0x1eb41f=_0x1d919e[_0x3120('0x20')];var _0x2bbdb7=_0x335d6b?0x0:_0x18357e[_0x3120('0x1e')];var _0x3c8c9b=_0x335d6b?_0x1d919e[_0x3120('0x20')]:_0x18357e[_0x3120('0x1e')]+_0x18357e['limit'];var _0xb16dcd;if(_0x3c8c9b>=_0x1eb41f){_0x3c8c9b=_0x1eb41f;_0xb16dcd=0xc8;}else{_0xb16dcd=0xce;}_0xcda8['status'](_0xb16dcd);return _0xcda8[_0x3120('0x21')](_0x3120('0x22'),_0x2bbdb7+'-'+_0x3c8c9b+'/'+_0x1eb41f)[_0x3120('0x1d')](_0x1d919e);}return null;};}function patchUpdates(_0x5bfd37){return function(_0x5a0bce){try{jsonpatch['apply'](_0x5a0bce,_0x5bfd37,!![]);}catch(_0x44a04c){return BPromise[_0x3120('0x23')](_0x44a04c);}return _0x5a0bce['save']();};}function saveUpdates(_0x1358e0,_0x2cf3be){return function(_0x3fbd05){if(_0x3fbd05){return _0x3fbd05[_0x3120('0x24')](_0x1358e0)['then'](function(_0x4739c3){return _0x4739c3;});}return null;};}function removeEntity(_0x5977b2,_0x444b3b){return function(_0xb762e2){if(_0xb762e2){return _0xb762e2[_0x3120('0x25')]()['then'](function(){_0x5977b2['status'](0xcc)[_0x3120('0x1c')]();});}};}function handleEntityNotFound(_0x7d0b5f,_0x5e0f82){return function(_0xc88506){if(!_0xc88506){_0x7d0b5f[_0x3120('0x1a')](0x194);}return _0xc88506;};}function handleError(_0x2493ca,_0x4bc011){_0x4bc011=_0x4bc011||0x1f4;return function(_0x2636b5){logger[_0x3120('0x26')](_0x2636b5[_0x3120('0x27')]);if(_0x2636b5[_0x3120('0x28')]){delete _0x2636b5['name'];}_0x2493ca['status'](_0x4bc011)['send'](_0x2636b5);};}exports[_0x3120('0x29')]=function(_0x5444ec,_0x2bc753){var _0x303055={},_0x3de290={},_0x3399fd={'count':0x0,'rows':[]};var _0x186ace=_[_0x3120('0x2a')](db['DeskField'][_0x3120('0x2b')],function(_0xeed487){return{'name':_0xeed487[_0x3120('0x2c')],'type':_0xeed487[_0x3120('0x2d')][_0x3120('0x2e')]};});_0x3de290[_0x3120('0x2f')]=_[_0x3120('0x2a')](_0x186ace,_0x3120('0x28'));_0x3de290['query']=_['keys'](_0x5444ec[_0x3120('0x30')]);_0x3de290[_0x3120('0x31')]=_[_0x3120('0x32')](_0x3de290[_0x3120('0x2f')],_0x3de290[_0x3120('0x30')]);_0x303055[_0x3120('0x33')]=_['intersection'](_0x3de290[_0x3120('0x2f')],qs[_0x3120('0x34')](_0x5444ec[_0x3120('0x30')][_0x3120('0x34')]));_0x303055[_0x3120('0x33')]=_0x303055[_0x3120('0x33')][_0x3120('0x35')]?_0x303055['attributes']:_0x3de290[_0x3120('0x2f')];if(!_0x5444ec[_0x3120('0x30')][_0x3120('0x36')](_0x3120('0x37'))){_0x303055[_0x3120('0x1f')]=qs[_0x3120('0x1f')](_0x5444ec[_0x3120('0x30')][_0x3120('0x1f')]);_0x303055[_0x3120('0x1e')]=qs[_0x3120('0x1e')](_0x5444ec[_0x3120('0x30')][_0x3120('0x1e')]);}_0x303055[_0x3120('0x38')]=qs['sort'](_0x5444ec['query'][_0x3120('0x39')]);_0x303055[_0x3120('0x3a')]=qs[_0x3120('0x31')](_['pick'](_0x5444ec[_0x3120('0x30')],_0x3de290[_0x3120('0x31')]),_0x186ace);if(_0x5444ec[_0x3120('0x30')]['filter']){_0x303055[_0x3120('0x3a')]=_[_0x3120('0x3b')](_0x303055[_0x3120('0x3a')],{'$or':_[_0x3120('0x2a')](_0x186ace,function(_0x8b0a5a){if(_0x8b0a5a[_0x3120('0x2d')]!=='VIRTUAL'){var _0x5e5200={};_0x5e5200[_0x8b0a5a['name']]={'$like':'%'+_0x5444ec[_0x3120('0x30')]['filter']+'%'};return _0x5e5200;}})});}_0x303055=_[_0x3120('0x3b')]({},_0x303055,_0x5444ec[_0x3120('0x3c')]);var _0x20bde7={'where':_0x303055[_0x3120('0x3a')]};return db['DeskField'][_0x3120('0x20')](_0x20bde7)['then'](function(_0x31bf0f){_0x3399fd[_0x3120('0x20')]=_0x31bf0f;if(_0x5444ec[_0x3120('0x30')][_0x3120('0x3d')]){_0x303055[_0x3120('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x3120('0x3f')](_0x303055);})[_0x3120('0x40')](function(_0x19a317){_0x3399fd[_0x3120('0x41')]=_0x19a317;return _0x3399fd;})['then'](respondWithFilteredResult(_0x2bc753,_0x303055))[_0x3120('0x42')](handleError(_0x2bc753,null));};exports[_0x3120('0x43')]=function(_0x513276,_0x1f7b81){var _0x30dfd1={'raw':!![],'where':{'id':_0x513276['params']['id']}},_0x1680cc={};_0x1680cc[_0x3120('0x2f')]=_[_0x3120('0x44')](db['DeskField'][_0x3120('0x2b')]);_0x1680cc[_0x3120('0x30')]=_['keys'](_0x513276['query']);_0x1680cc[_0x3120('0x31')]=_[_0x3120('0x32')](_0x1680cc[_0x3120('0x2f')],_0x1680cc[_0x3120('0x30')]);_0x30dfd1[_0x3120('0x33')]=_[_0x3120('0x32')](_0x1680cc[_0x3120('0x2f')],qs[_0x3120('0x34')](_0x513276[_0x3120('0x30')][_0x3120('0x34')]));_0x30dfd1['attributes']=_0x30dfd1[_0x3120('0x33')][_0x3120('0x35')]?_0x30dfd1[_0x3120('0x33')]:_0x1680cc[_0x3120('0x2f')];if(_0x513276['query']['includeAll']){_0x30dfd1[_0x3120('0x3e')]=[{'all':!![]}];}_0x30dfd1=_['merge']({},_0x30dfd1,_0x513276[_0x3120('0x3c')]);return db[_0x3120('0x45')][_0x3120('0x46')](_0x30dfd1)[_0x3120('0x40')](handleEntityNotFound(_0x1f7b81,null))[_0x3120('0x40')](respondWithResult(_0x1f7b81,null))[_0x3120('0x42')](handleError(_0x1f7b81,null));};exports[_0x3120('0x47')]=function(_0x22ac87,_0x5a741c){return db[_0x3120('0x45')][_0x3120('0x47')](_0x22ac87[_0x3120('0x48')],{})[_0x3120('0x40')](respondWithResult(_0x5a741c,0xc9))[_0x3120('0x42')](handleError(_0x5a741c,null));};exports['update']=function(_0x4bcb78,_0x5bbe60){if(_0x4bcb78[_0x3120('0x48')]['id']){delete _0x4bcb78[_0x3120('0x48')]['id'];}return db[_0x3120('0x45')][_0x3120('0x46')]({'where':{'id':_0x4bcb78['params']['id']}})[_0x3120('0x40')](handleEntityNotFound(_0x5bbe60,null))[_0x3120('0x40')](saveUpdates(_0x4bcb78[_0x3120('0x48')],null))[_0x3120('0x40')](respondWithResult(_0x5bbe60,null))[_0x3120('0x42')](handleError(_0x5bbe60,null));};exports[_0x3120('0x25')]=function(_0x297134,_0x2f7ae8){return db[_0x3120('0x45')]['find']({'where':{'id':_0x297134['params']['id']}})['then'](handleEntityNotFound(_0x2f7ae8,null))[_0x3120('0x40')](removeEntity(_0x2f7ae8,null))['catch'](handleError(_0x2f7ae8,null));}; \ No newline at end of file +var _0x49fe=['set','json','apply','reject','save','update','then','destroy','stack','name','send','map','DeskField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x49fe,0x75));var _0xe49f=function(_0x2c3b19,_0x120e6e){_0x2c3b19=_0x2c3b19-0x0;var _0xacf5d3=_0x49fe[_0x2c3b19];return _0xacf5d3;};'use strict';var emlformat=require(_0xe49f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x1'));var moment=require(_0xe49f('0x2'));var BPromise=require(_0xe49f('0x3'));var Mustache=require(_0xe49f('0x4'));var util=require(_0xe49f('0x5'));var path=require(_0xe49f('0x6'));var sox=require(_0xe49f('0x7'));var csv=require(_0xe49f('0x8'));var ejs=require(_0xe49f('0x9'));var fs=require('fs');var fs_extra=require(_0xe49f('0xa'));var _=require(_0xe49f('0xb'));var squel=require(_0xe49f('0xc'));var crypto=require(_0xe49f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe49f('0xe'));var toCsv=require(_0xe49f('0x8'));var querystring=require('querystring');var Papa=require(_0xe49f('0xf'));var Redis=require('ioredis');var authService=require(_0xe49f('0x10'));var qs=require(_0xe49f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe49f('0x12'));var logger=require(_0xe49f('0x13'))(_0xe49f('0x14'));var utils=require(_0xe49f('0x15'));var config=require(_0xe49f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe49f('0x17'))['db'];function respondWithStatusCode(_0x3958bd,_0x504081){_0x504081=_0x504081||0xcc;return function(_0x10517d){if(_0x10517d){return _0x3958bd[_0xe49f('0x18')](_0x504081);}return _0x3958bd[_0xe49f('0x19')](_0x504081)[_0xe49f('0x1a')]();};}function respondWithResult(_0x44c7fe,_0x5708d9){_0x5708d9=_0x5708d9||0xc8;return function(_0x3645e8){if(_0x3645e8){return _0x44c7fe[_0xe49f('0x19')](_0x5708d9)['json'](_0x3645e8);}};}function respondWithFilteredResult(_0x4f3550,_0xfe24b7){return function(_0x3e5fb3){if(_0x3e5fb3){var _0x1e8eb8=typeof _0xfe24b7[_0xe49f('0x1b')]===_0xe49f('0x1c')&&typeof _0xfe24b7[_0xe49f('0x1d')]==='undefined';var _0x7831f1=_0x3e5fb3['count'];var _0x6ab378=_0x1e8eb8?0x0:_0xfe24b7['offset'];var _0x58f852=_0x1e8eb8?_0x3e5fb3[_0xe49f('0x1e')]:_0xfe24b7[_0xe49f('0x1b')]+_0xfe24b7['limit'];var _0x7a5643;if(_0x58f852>=_0x7831f1){_0x58f852=_0x7831f1;_0x7a5643=0xc8;}else{_0x7a5643=0xce;}_0x4f3550['status'](_0x7a5643);return _0x4f3550[_0xe49f('0x1f')]('Content-Range',_0x6ab378+'-'+_0x58f852+'/'+_0x7831f1)[_0xe49f('0x20')](_0x3e5fb3);}return null;};}function patchUpdates(_0x47b09a){return function(_0x4c4dcf){try{jsonpatch[_0xe49f('0x21')](_0x4c4dcf,_0x47b09a,!![]);}catch(_0x5b50e0){return BPromise[_0xe49f('0x22')](_0x5b50e0);}return _0x4c4dcf[_0xe49f('0x23')]();};}function saveUpdates(_0x40129c,_0x1647d1){return function(_0x424927){if(_0x424927){return _0x424927[_0xe49f('0x24')](_0x40129c)[_0xe49f('0x25')](function(_0x3d4146){return _0x3d4146;});}return null;};}function removeEntity(_0x233646,_0x2a2926){return function(_0x2bc2b2){if(_0x2bc2b2){return _0x2bc2b2[_0xe49f('0x26')]()[_0xe49f('0x25')](function(){_0x233646['status'](0xcc)[_0xe49f('0x1a')]();});}};}function handleEntityNotFound(_0x298cba,_0xbe357){return function(_0x14d820){if(!_0x14d820){_0x298cba['sendStatus'](0x194);}return _0x14d820;};}function handleError(_0x4ca90a,_0x1ff78c){_0x1ff78c=_0x1ff78c||0x1f4;return function(_0x44b702){logger['error'](_0x44b702[_0xe49f('0x27')]);if(_0x44b702['name']){delete _0x44b702[_0xe49f('0x28')];}_0x4ca90a[_0xe49f('0x19')](_0x1ff78c)[_0xe49f('0x29')](_0x44b702);};}exports['index']=function(_0x557b4e,_0x1357f6){var _0x32406b={},_0x298248={},_0x268f6e={'count':0x0,'rows':[]};var _0x4be6fc=_[_0xe49f('0x2a')](db[_0xe49f('0x2b')][_0xe49f('0x2c')],function(_0x1b3280){return{'name':_0x1b3280[_0xe49f('0x2d')],'type':_0x1b3280[_0xe49f('0x2e')]['key']};});_0x298248[_0xe49f('0x2f')]=_[_0xe49f('0x2a')](_0x4be6fc,_0xe49f('0x28'));_0x298248[_0xe49f('0x30')]=_['keys'](_0x557b4e['query']);_0x298248[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],_0x298248['query']);_0x32406b['attributes']=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0x557b4e['query'][_0xe49f('0x33')]));_0x32406b['attributes']=_0x32406b['attributes'][_0xe49f('0x34')]?_0x32406b[_0xe49f('0x35')]:_0x298248[_0xe49f('0x2f')];if(!_0x557b4e['query'][_0xe49f('0x36')](_0xe49f('0x37'))){_0x32406b['limit']=qs['limit'](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x1d')]);_0x32406b[_0xe49f('0x1b')]=qs[_0xe49f('0x1b')](_0x557b4e['query'][_0xe49f('0x1b')]);}_0x32406b[_0xe49f('0x38')]=qs[_0xe49f('0x39')](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x39')]);_0x32406b[_0xe49f('0x3a')]=qs[_0xe49f('0x31')](_[_0xe49f('0x3b')](_0x557b4e[_0xe49f('0x30')],_0x298248[_0xe49f('0x31')]),_0x4be6fc);if(_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]){_0x32406b[_0xe49f('0x3a')]=_[_0xe49f('0x3d')](_0x32406b[_0xe49f('0x3a')],{'$or':_[_0xe49f('0x2a')](_0x4be6fc,function(_0x1edf31){if(_0x1edf31[_0xe49f('0x2e')]!==_0xe49f('0x3e')){var _0x3d1380={};_0x3d1380[_0x1edf31[_0xe49f('0x28')]]={'$like':'%'+_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]+'%'};return _0x3d1380;}})});}_0x32406b=_['merge']({},_0x32406b,_0x557b4e[_0xe49f('0x3f')]);var _0x2efd45={'where':_0x32406b[_0xe49f('0x3a')]};return db['DeskField'][_0xe49f('0x1e')](_0x2efd45)['then'](function(_0x5cdf86){_0x268f6e[_0xe49f('0x1e')]=_0x5cdf86;if(_0x557b4e[_0xe49f('0x30')]['includeAll']){_0x32406b[_0xe49f('0x40')]=[{'all':!![]}];}return db[_0xe49f('0x2b')][_0xe49f('0x41')](_0x32406b);})[_0xe49f('0x25')](function(_0x36422e){_0x268f6e[_0xe49f('0x42')]=_0x36422e;return _0x268f6e;})[_0xe49f('0x25')](respondWithFilteredResult(_0x1357f6,_0x32406b))['catch'](handleError(_0x1357f6,null));};exports[_0xe49f('0x43')]=function(_0xbe91d2,_0x370162){var _0x2fb5f4={'raw':!![],'where':{'id':_0xbe91d2[_0xe49f('0x44')]['id']}},_0xd4341f={};_0xd4341f['model']=_[_0xe49f('0x45')](db[_0xe49f('0x2b')][_0xe49f('0x2c')]);_0xd4341f[_0xe49f('0x30')]=_[_0xe49f('0x45')](_0xbe91d2[_0xe49f('0x30')]);_0xd4341f[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0xd4341f['model'],_0xd4341f['query']);_0x2fb5f4[_0xe49f('0x35')]=_['intersection'](_0xd4341f[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0xbe91d2[_0xe49f('0x30')][_0xe49f('0x33')]));_0x2fb5f4['attributes']=_0x2fb5f4[_0xe49f('0x35')][_0xe49f('0x34')]?_0x2fb5f4[_0xe49f('0x35')]:_0xd4341f['model'];if(_0xbe91d2[_0xe49f('0x30')]['includeAll']){_0x2fb5f4[_0xe49f('0x40')]=[{'all':!![]}];}_0x2fb5f4=_['merge']({},_0x2fb5f4,_0xbe91d2[_0xe49f('0x3f')]);return db['DeskField'][_0xe49f('0x46')](_0x2fb5f4)[_0xe49f('0x25')](handleEntityNotFound(_0x370162,null))[_0xe49f('0x25')](respondWithResult(_0x370162,null))[_0xe49f('0x47')](handleError(_0x370162,null));};exports[_0xe49f('0x48')]=function(_0x21796d,_0x2f87aa){return db[_0xe49f('0x2b')][_0xe49f('0x48')](_0x21796d['body'],{})['then'](respondWithResult(_0x2f87aa,0xc9))[_0xe49f('0x47')](handleError(_0x2f87aa,null));};exports[_0xe49f('0x24')]=function(_0x3fa5ec,_0x2cd14d){if(_0x3fa5ec[_0xe49f('0x49')]['id']){delete _0x3fa5ec[_0xe49f('0x49')]['id'];}return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x3fa5ec[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x2cd14d,null))[_0xe49f('0x25')](saveUpdates(_0x3fa5ec['body'],null))[_0xe49f('0x25')](respondWithResult(_0x2cd14d,null))['catch'](handleError(_0x2cd14d,null));};exports[_0xe49f('0x26')]=function(_0x1daf27,_0x416807){return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x1daf27[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x416807,null))[_0xe49f('0x25')](removeEntity(_0x416807,null))[_0xe49f('0x47')](handleError(_0x416807,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 24f032c..892079c 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 _0x8233=['path','../../config/environment','./intDeskField.attributes','exports','desk_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4786de,_0x2c8970){var _0x4e67e4=function(_0x52e52b){while(--_0x52e52b){_0x4786de['push'](_0x4786de['shift']());}};_0x4e67e4(++_0x2c8970);}(_0x8233,0x10e));var _0x3823=function(_0x1ada8b,_0x2b4817){_0x1ada8b=_0x1ada8b-0x0;var _0x5ca2e7=_0x8233[_0x1ada8b];return _0x5ca2e7;};'use strict';var _=require(_0x3823('0x0'));var util=require('util');var logger=require(_0x3823('0x1'))(_0x3823('0x2'));var moment=require(_0x3823('0x3'));var BPromise=require(_0x3823('0x4'));var rp=require(_0x3823('0x5'));var fs=require('fs');var path=require(_0x3823('0x6'));var rimraf=require('rimraf');var config=require(_0x3823('0x7'));var attributes=require(_0x3823('0x8'));module[_0x3823('0x9')]=function(_0x1bf6ab,_0x1d4669){return _0x1bf6ab['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3823('0xa'),'fields':['idField',_0x3823('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4812=['./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x21399e,_0xbc6101){var _0x3b7be4=function(_0x2b5747){while(--_0x2b5747){_0x21399e['push'](_0x21399e['shift']());}};_0x3b7be4(++_0xbc6101);}(_0x4812,0x89));var _0x2481=function(_0x38957c,_0x51e872){_0x38957c=_0x38957c-0x0;var _0x1cf301=_0x4812[_0x38957c];return _0x1cf301;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2481('0x0'))(_0x2481('0x1'));var moment=require(_0x2481('0x2'));var BPromise=require(_0x2481('0x3'));var rp=require(_0x2481('0x4'));var fs=require('fs');var path=require(_0x2481('0x5'));var rimraf=require('rimraf');var config=require(_0x2481('0x6'));var attributes=require(_0x2481('0x7'));module['exports']=function(_0x45633b,_0xd7c4e1){return _0x45633b['define'](_0x2481('0x8'),attributes,{'tableName':_0x2481('0x9'),'paranoid':![],'indexes':[{'name':_0x2481('0xa'),'fields':['idField',_0x2481('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 0698c81..330ef1e 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 _0xe9fb=['error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xe9fb,0x17c));var _0xbe9f=function(_0x1ed774,_0x33cf46){_0x1ed774=_0x1ed774-0x0;var _0x3e008d=_0xe9fb[_0x1ed774];return _0x3e008d;};'use strict';var _=require(_0xbe9f('0x0'));var util=require(_0xbe9f('0x1'));var moment=require(_0xbe9f('0x2'));var BPromise=require(_0xbe9f('0x3'));var rs=require(_0xbe9f('0x4'));var fs=require('fs');var Redis=require(_0xbe9f('0x5'));var db=require(_0xbe9f('0x6'))['db'];var utils=require(_0xbe9f('0x7'));var logger=require('../../config/logger')(_0xbe9f('0x8'));var config=require('../../config/environment');var jayson=require(_0xbe9f('0x9'));var client=jayson[_0xbe9f('0xa')][_0xbe9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cb46e,_0xfec849,_0x430875){return new BPromise(function(_0x17e551,_0x52b051){return client['request'](_0x3cb46e,_0x430875)[_0xbe9f('0xc')](function(_0x1837cb){logger['info']('DeskField,\x20%s,\x20%s',_0xfec849,'request\x20sent');logger['debug'](_0xbe9f('0xd'),_0xfec849,_0xbe9f('0xe'),JSON[_0xbe9f('0xf')](_0x1837cb));if(_0x1837cb[_0xbe9f('0x10')]){if(_0x1837cb[_0xbe9f('0x10')][_0xbe9f('0x11')]===0x1f4){logger[_0xbe9f('0x10')](_0xbe9f('0x12'),_0xfec849,_0x1837cb[_0xbe9f('0x10')][_0xbe9f('0x13')]);return _0x52b051(_0x1837cb[_0xbe9f('0x10')]['message']);}logger['error'](_0xbe9f('0x12'),_0xfec849,_0x1837cb[_0xbe9f('0x10')][_0xbe9f('0x13')]);return _0x17e551(_0x1837cb['error']['message']);}else{logger['info'](_0xbe9f('0x12'),_0xfec849,'request\x20sent');_0x17e551(_0x1837cb[_0xbe9f('0x14')]['message']);}})[_0xbe9f('0x15')](function(_0x2fed2a){logger[_0xbe9f('0x10')](_0xbe9f('0x12'),_0xfec849,_0x2fed2a);_0x52b051(_0x2fed2a);});});} \ No newline at end of file +var _0xd006=['client','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3c2bdb,_0x2ed746){var _0x341911=function(_0x22812a){while(--_0x22812a){_0x3c2bdb['push'](_0x3c2bdb['shift']());}};_0x341911(++_0x2ed746);}(_0xd006,0x1b0));var _0x6d00=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xd006[_0x21de89];return _0x290b7e;};'use strict';var _=require('lodash');var util=require(_0x6d00('0x0'));var moment=require(_0x6d00('0x1'));var BPromise=require(_0x6d00('0x2'));var rs=require(_0x6d00('0x3'));var fs=require('fs');var Redis=require(_0x6d00('0x4'));var db=require(_0x6d00('0x5'))['db'];var utils=require(_0x6d00('0x6'));var logger=require('../../config/logger')(_0x6d00('0x7'));var config=require(_0x6d00('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d00('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e5b64,_0x8f2f04,_0x14ec6e){return new BPromise(function(_0x5ecc55,_0x168213){return client[_0x6d00('0xa')](_0x5e5b64,_0x14ec6e)[_0x6d00('0xb')](function(_0x2a4846){logger['info'](_0x6d00('0xc'),_0x8f2f04,_0x6d00('0xd'));logger[_0x6d00('0xe')](_0x6d00('0xf'),_0x8f2f04,'request\x20sent',JSON['stringify'](_0x2a4846));if(_0x2a4846[_0x6d00('0x10')]){if(_0x2a4846[_0x6d00('0x10')][_0x6d00('0x11')]===0x1f4){logger[_0x6d00('0x10')](_0x6d00('0xc'),_0x8f2f04,_0x2a4846[_0x6d00('0x10')]['message']);return _0x168213(_0x2a4846[_0x6d00('0x10')][_0x6d00('0x12')]);}logger['error'](_0x6d00('0xc'),_0x8f2f04,_0x2a4846['error'][_0x6d00('0x12')]);return _0x5ecc55(_0x2a4846[_0x6d00('0x10')][_0x6d00('0x12')]);}else{logger['info'](_0x6d00('0xc'),_0x8f2f04,'request\x20sent');_0x5ecc55(_0x2a4846[_0x6d00('0x13')][_0x6d00('0x12')]);}})[_0x6d00('0x14')](function(_0x1f066b){logger[_0x6d00('0x10')](_0x6d00('0xc'),_0x8f2f04,_0x1f066b);_0x168213(_0x1f066b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 59f81ce..c87e060 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 _0xe24a=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x3c7623,_0x25e6a0){var _0x28528d=function(_0x5b9760){while(--_0x5b9760){_0x3c7623['push'](_0x3c7623['shift']());}};_0x28528d(++_0x25e6a0);}(_0xe24a,0xfb));var _0xae24=function(_0x2b4e80,_0x2c0dab){_0x2b4e80=_0x2b4e80-0x0;var _0x434a1f=_0xe24a[_0x2b4e80];return _0x434a1f;};'use strict';var multer=require('multer');var util=require(_0xae24('0x0'));var path=require(_0xae24('0x1'));var timeout=require(_0xae24('0x2'));var express=require(_0xae24('0x3'));var router=express[_0xae24('0x4')]();var fs_extra=require(_0xae24('0x5'));var auth=require(_0xae24('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae24('0x7'));var controller=require(_0xae24('0x8'));router[_0xae24('0x9')]('/',auth[_0xae24('0xa')](),controller[_0xae24('0xb')]);router[_0xae24('0x9')](_0xae24('0xc'),auth[_0xae24('0xa')](),controller['show']);router[_0xae24('0x9')](_0xae24('0xd'),auth[_0xae24('0xa')](),controller[_0xae24('0xe')]);router[_0xae24('0x9')](_0xae24('0xf'),auth[_0xae24('0xa')](),controller[_0xae24('0x10')]);router[_0xae24('0x11')]('/',auth[_0xae24('0xa')](),controller[_0xae24('0x12')]);router['post']('/:id/configurations',auth[_0xae24('0xa')](),controller[_0xae24('0x13')]);router[_0xae24('0x14')](_0xae24('0xc'),auth[_0xae24('0xa')](),controller[_0xae24('0x15')]);router[_0xae24('0x16')](_0xae24('0xc'),auth[_0xae24('0xa')](),controller[_0xae24('0x17')]);module[_0xae24('0x18')]=router; \ No newline at end of file +var _0x7141=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5e9763,_0x5e9280){var _0x350a99=function(_0x31689f){while(--_0x31689f){_0x5e9763['push'](_0x5e9763['shift']());}};_0x350a99(++_0x5e9280);}(_0x7141,0x18d));var _0x1714=function(_0x1a6246,_0x3f75d8){_0x1a6246=_0x1a6246-0x0;var _0x4a9064=_0x7141[_0x1a6246];return _0x4a9064;};'use strict';var multer=require(_0x1714('0x0'));var util=require(_0x1714('0x1'));var path=require(_0x1714('0x2'));var timeout=require(_0x1714('0x3'));var express=require(_0x1714('0x4'));var router=express[_0x1714('0x5')]();var fs_extra=require(_0x1714('0x6'));var auth=require(_0x1714('0x7'));var interaction=require(_0x1714('0x8'));var config=require(_0x1714('0x9'));var controller=require(_0x1714('0xa'));router[_0x1714('0xb')]('/',auth[_0x1714('0xc')](),controller['index']);router[_0x1714('0xb')](_0x1714('0xd'),auth[_0x1714('0xc')](),controller[_0x1714('0xe')]);router[_0x1714('0xb')](_0x1714('0xf'),auth['isAuthenticated'](),controller[_0x1714('0x10')]);router[_0x1714('0xb')](_0x1714('0x11'),auth['isAuthenticated'](),controller[_0x1714('0x12')]);router[_0x1714('0x13')]('/',auth[_0x1714('0xc')](),controller[_0x1714('0x14')]);router[_0x1714('0x13')](_0x1714('0xf'),auth[_0x1714('0xc')](),controller[_0x1714('0x15')]);router[_0x1714('0x16')](_0x1714('0xd'),auth[_0x1714('0xc')](),controller[_0x1714('0x17')]);router[_0x1714('0x18')](_0x1714('0xd'),auth[_0x1714('0xc')](),controller[_0x1714('0x19')]);module[_0x1714('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b6fb420..2b70f03 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 _0xafb9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x256b76,_0x2fa071){var _0xf63aa1=function(_0x5f1c80){while(--_0x5f1c80){_0x256b76['push'](_0x256b76['shift']());}};_0xf63aa1(++_0x2fa071);}(_0xafb9,0x68));var _0x9afb=function(_0x360e1c,_0x13c5b7){_0x360e1c=_0x360e1c-0x0;var _0x1f21b0=_0xafb9[_0x360e1c];return _0x1f21b0;};'use strict';var Sequelize=require(_0x9afb('0x0'));module[_0x9afb('0x1')]={'name':{'type':Sequelize[_0x9afb('0x2')]},'username':{'type':Sequelize[_0x9afb('0x2')]},'password':{'type':Sequelize[_0x9afb('0x2')]},'remoteUri':{'type':Sequelize[_0x9afb('0x2')]},'tenantId':{'type':Sequelize[_0x9afb('0x2')]},'clientId':{'type':Sequelize[_0x9afb('0x2')]},'clientSecret':{'type':Sequelize[_0x9afb('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x9afb('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xac4f=['STRING','BOOLEAN','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xac4f,0x122));var _0xfac4=function(_0x579681,_0x181f3f){_0x579681=_0x579681-0x0;var _0x3054e0=_0xac4f[_0x579681];return _0x3054e0;};'use strict';var Sequelize=require(_0xfac4('0x0'));module['exports']={'name':{'type':Sequelize[_0xfac4('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfac4('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xfac4('0x1')]},'clientSecret':{'type':Sequelize[_0xfac4('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xfac4('0x1')]},'modernAuthentication':{'type':Sequelize[_0xfac4('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 7f8bd82..e1b9e54 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 _0x0aa0=['username','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','tenantId','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','substring','push','forEach','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','findOne','Dynamics365Configuration','filter','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getSubjects','Descriptions','channel','Dynamics365Field','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat'];(function(_0x50c9b7,_0x14f813){var _0x202f64=function(_0x2d426d){while(--_0x2d426d){_0x50c9b7['push'](_0x50c9b7['shift']());}};_0x202f64(++_0x14f813);}(_0x0aa0,0xf5));var _0x00aa=function(_0x3638c5,_0x200de0){_0x3638c5=_0x3638c5-0x0;var _0x149582=_0x0aa0[_0x3638c5];return _0x149582;};'use strict';var rp=require('request-promise');var util=require(_0x00aa('0x0'));var _=require(_0x00aa('0x1'));var qs=require(_0x00aa('0x2'));var logger=require(_0x00aa('0x3'))('api');var db=require(_0x00aa('0x4'))['db'];var integrations=require(_0x00aa('0x5'));function respondWithResult(_0x5e56c2,_0x272067){_0x272067=_0x272067||0xc8;return function(_0x56349d){if(_0x56349d){return _0x5e56c2[_0x00aa('0x6')](_0x272067)['json'](_0x56349d);}};}function respondWithFilteredResult(_0x32998c,_0x418516){return function(_0x7ac125){if(_0x7ac125){var _0x48ae4c=typeof _0x418516[_0x00aa('0x7')]==='undefined'&&typeof _0x418516['limit']===_0x00aa('0x8');var _0x55e246=_0x7ac125['count'];var _0x2fc075=_0x48ae4c?0x0:_0x418516[_0x00aa('0x7')];var _0x208995=_0x48ae4c?_0x7ac125[_0x00aa('0x9')]:_0x418516[_0x00aa('0x7')]+_0x418516['limit'];var _0xf98e2a;if(_0x208995>=_0x55e246){_0x208995=_0x55e246;_0xf98e2a=0xc8;}else{_0xf98e2a=0xce;}_0x32998c[_0x00aa('0x6')](_0xf98e2a);return _0x32998c[_0x00aa('0xa')](_0x00aa('0xb'),_0x2fc075+'-'+_0x208995+'/'+_0x55e246)[_0x00aa('0xc')](_0x7ac125);}return null;};}function saveUpdates(_0x1a17f4){return function(_0x2e68e2){if(_0x2e68e2){return _0x2e68e2[_0x00aa('0xd')](_0x1a17f4)[_0x00aa('0xe')](function(_0x11a035){return _0x11a035;});}return null;};}function removeEntity(_0x2bdff5){return function(_0x125852){if(_0x125852){return _0x125852[_0x00aa('0xf')]()[_0x00aa('0xe')](function(){_0x2bdff5[_0x00aa('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b181d){return function(_0xfe5def){if(!_0xfe5def){_0x3b181d[_0x00aa('0x10')](0x194);}return _0xfe5def;};}function handleError(_0x3965c4,_0x174cff){_0x174cff=_0x174cff||0x1f4;return function(_0x5a2212){logger[_0x00aa('0x11')](_0x5a2212[_0x00aa('0x12')]);if(_0x5a2212['name']){delete _0x5a2212[_0x00aa('0x13')];}_0x3965c4['status'](_0x174cff)[_0x00aa('0x14')](_0x5a2212);};}exports[_0x00aa('0x15')]=function(_0x4a6473,_0x4b6e45){var _0x190643={},_0x996c29={},_0x5ecaf1={'count':0x0,'rows':[]};var _0x35c669=_[_0x00aa('0x16')](db[_0x00aa('0x17')][_0x00aa('0x18')],function(_0x5b2293){return{'name':_0x5b2293[_0x00aa('0x19')],'type':_0x5b2293['type']['key']};});_0x996c29[_0x00aa('0x1a')]=_['map'](_0x35c669,_0x00aa('0x13'));_0x996c29['query']=_[_0x00aa('0x1b')](_0x4a6473['query']);_0x996c29[_0x00aa('0x1c')]=_['intersection'](_0x996c29[_0x00aa('0x1a')],_0x996c29[_0x00aa('0x1d')]);_0x190643[_0x00aa('0x1e')]=_[_0x00aa('0x1f')](_0x996c29[_0x00aa('0x1a')],qs[_0x00aa('0x20')](_0x4a6473[_0x00aa('0x1d')][_0x00aa('0x20')]));_0x190643[_0x00aa('0x1e')]=_0x190643['attributes'][_0x00aa('0x21')]?_0x190643['attributes']:_0x996c29['model'];if(!_0x4a6473[_0x00aa('0x1d')]['hasOwnProperty'](_0x00aa('0x22'))){_0x190643[_0x00aa('0x23')]=qs[_0x00aa('0x23')](_0x4a6473['query'][_0x00aa('0x23')]);_0x190643[_0x00aa('0x7')]=qs['offset'](_0x4a6473['query'][_0x00aa('0x7')]);}_0x190643[_0x00aa('0x24')]=qs[_0x00aa('0x25')](_0x4a6473['query'][_0x00aa('0x25')]);_0x190643[_0x00aa('0x26')]=qs[_0x00aa('0x1c')](_[_0x00aa('0x27')](_0x4a6473[_0x00aa('0x1d')],_0x996c29['filters']),_0x35c669);if(_0x4a6473[_0x00aa('0x1d')]['filter']){_0x190643['where']=_['merge'](_0x190643['where'],{'$or':_['map'](_0x35c669,function(_0x3ffaad){if(_0x3ffaad[_0x00aa('0x28')]!==_0x00aa('0x29')){var _0x386aeb={};_0x386aeb[_0x3ffaad[_0x00aa('0x13')]]={'$like':'%'+_0x4a6473[_0x00aa('0x1d')]['filter']+'%'};return _0x386aeb;}})});}_0x190643=_['merge']({},_0x190643,_0x4a6473[_0x00aa('0x2a')]);var _0x437f00={'where':_0x190643[_0x00aa('0x26')]};return db[_0x00aa('0x17')][_0x00aa('0x9')](_0x437f00)[_0x00aa('0xe')](function(_0x2a8a3e){_0x5ecaf1[_0x00aa('0x9')]=_0x2a8a3e;if(_0x4a6473[_0x00aa('0x1d')][_0x00aa('0x2b')]){_0x190643[_0x00aa('0x2c')]=[{'all':!![]}];}return db[_0x00aa('0x17')][_0x00aa('0x2d')](_0x190643);})['then'](function(_0x44e69d){_0x5ecaf1['rows']=_0x44e69d;return _0x5ecaf1;})[_0x00aa('0xe')](respondWithFilteredResult(_0x4b6e45,_0x190643))[_0x00aa('0x2e')](handleError(_0x4b6e45,null));};exports[_0x00aa('0x2f')]=function(_0x1b3af1,_0x39e162){var _0x4f9eb1={'raw':![],'where':{'id':_0x1b3af1[_0x00aa('0x30')]['id']}},_0x366d51={};_0x366d51[_0x00aa('0x1a')]=_['keys'](db[_0x00aa('0x17')][_0x00aa('0x18')]);_0x366d51[_0x00aa('0x1d')]=_['keys'](_0x1b3af1[_0x00aa('0x1d')]);_0x366d51[_0x00aa('0x1c')]=_[_0x00aa('0x1f')](_0x366d51[_0x00aa('0x1a')],_0x366d51[_0x00aa('0x1d')]);_0x4f9eb1[_0x00aa('0x1e')]=_[_0x00aa('0x1f')](_0x366d51['model'],qs[_0x00aa('0x20')](_0x1b3af1['query'][_0x00aa('0x20')]));_0x4f9eb1['attributes']=_0x4f9eb1[_0x00aa('0x1e')][_0x00aa('0x21')]?_0x4f9eb1[_0x00aa('0x1e')]:_0x366d51[_0x00aa('0x1a')];if(_0x1b3af1[_0x00aa('0x1d')][_0x00aa('0x2b')]){_0x4f9eb1['include']=[{'all':!![]}];}_0x4f9eb1=_[_0x00aa('0x31')]({},_0x4f9eb1,_0x1b3af1['options']);return db[_0x00aa('0x17')][_0x00aa('0x32')](_0x4f9eb1)[_0x00aa('0xe')](handleEntityNotFound(_0x39e162,null))[_0x00aa('0xe')](respondWithResult(_0x39e162,null))[_0x00aa('0x2e')](handleError(_0x39e162,null));};exports[_0x00aa('0x33')]=function(_0x4435ea,_0x29f9c2){return db[_0x00aa('0x17')][_0x00aa('0x33')](_0x4435ea['body'],{})[_0x00aa('0xe')](respondWithResult(_0x29f9c2,0xc9))[_0x00aa('0x2e')](handleError(_0x29f9c2,null));};exports[_0x00aa('0xd')]=function(_0x59488e,_0x43153e){if(_0x59488e[_0x00aa('0x34')]['id']){delete _0x59488e[_0x00aa('0x34')]['id'];}return db[_0x00aa('0x17')]['find']({'where':{'id':_0x59488e['params']['id']}})['then'](handleEntityNotFound(_0x43153e,null))[_0x00aa('0xe')](saveUpdates(_0x59488e[_0x00aa('0x34')],null))[_0x00aa('0xe')](respondWithResult(_0x43153e,null))[_0x00aa('0x2e')](handleError(_0x43153e,null));};exports['destroy']=function(_0x37f524,_0x3fed33){return db[_0x00aa('0x17')][_0x00aa('0x32')]({'where':{'id':_0x37f524['params']['id']}})[_0x00aa('0xe')](handleEntityNotFound(_0x3fed33,null))['then'](removeEntity(_0x3fed33,null))[_0x00aa('0x2e')](handleError(_0x3fed33,null));};exports['getConfigurations']=function(_0x116f7e,_0x208f2e){var _0xa377df={};var _0x3606a5={};var _0x1a64cf;var _0x4c9ef1;return db[_0x00aa('0x17')][_0x00aa('0x35')]({'where':{'id':_0x116f7e[_0x00aa('0x30')]['id']}})[_0x00aa('0xe')](handleEntityNotFound(_0x208f2e,null))[_0x00aa('0xe')](function(_0xe325d1){if(_0xe325d1){_0x1a64cf=_0xe325d1;_0x3606a5[_0x00aa('0x1a')]=_[_0x00aa('0x1b')](db[_0x00aa('0x36')]['rawAttributes']);_0x3606a5[_0x00aa('0x1d')]=_[_0x00aa('0x1b')](_0x116f7e[_0x00aa('0x1d')]);_0x3606a5['filters']=_[_0x00aa('0x1f')](_0x3606a5['model'],_0x3606a5[_0x00aa('0x1d')]);_0xa377df[_0x00aa('0x1e')]=_[_0x00aa('0x1f')](_0x3606a5['model'],qs[_0x00aa('0x20')](_0x116f7e['query'][_0x00aa('0x20')]));_0xa377df[_0x00aa('0x1e')]=_0xa377df['attributes'][_0x00aa('0x21')]?_0xa377df[_0x00aa('0x1e')]:_0x3606a5[_0x00aa('0x1a')];_0xa377df['order']=qs[_0x00aa('0x25')](_0x116f7e[_0x00aa('0x1d')][_0x00aa('0x25')]);_0xa377df[_0x00aa('0x26')]=qs['filters'](_['pick'](_0x116f7e[_0x00aa('0x1d')],_0x3606a5[_0x00aa('0x1c')]));if(_0x116f7e[_0x00aa('0x1d')][_0x00aa('0x37')]){_0xa377df['where']=_['merge'](_0xa377df[_0x00aa('0x26')],{'$or':_[_0x00aa('0x16')](_0xa377df[_0x00aa('0x1e')],function(_0x46b5c4){var _0x24ec92={};_0x24ec92[_0x46b5c4]={'$like':'%'+_0x116f7e[_0x00aa('0x1d')][_0x00aa('0x37')]+'%'};return _0x24ec92;})});}_0xa377df=_[_0x00aa('0x31')]({},_0xa377df,_0x116f7e[_0x00aa('0x2a')]);return _0x1a64cf[_0x00aa('0x38')](_0xa377df);}})['then'](function(_0x37a51b){if(_0x37a51b){_0x4c9ef1=_0x37a51b[_0x00aa('0x21')];if(!_0x116f7e[_0x00aa('0x1d')][_0x00aa('0x39')](_0x00aa('0x22'))){_0xa377df['limit']=qs[_0x00aa('0x23')](_0x116f7e[_0x00aa('0x1d')][_0x00aa('0x23')]);_0xa377df[_0x00aa('0x7')]=qs[_0x00aa('0x7')](_0x116f7e[_0x00aa('0x1d')][_0x00aa('0x7')]);}return _0x1a64cf[_0x00aa('0x38')](_0xa377df);}})[_0x00aa('0xe')](function(_0x12a079){if(_0x12a079){return _0x12a079?{'count':_0x4c9ef1,'rows':_0x12a079}:null;}})[_0x00aa('0xe')](respondWithResult(_0x208f2e,null))['catch'](handleError(_0x208f2e,null));};exports[_0x00aa('0x3a')]=function(_0x255c71,_0x540b68){if(_0x255c71['body']['id']){delete _0x255c71['body']['id'];}return db[_0x00aa('0x17')]['findOne']({'where':{'id':_0x255c71[_0x00aa('0x30')]['id']}})[_0x00aa('0xe')](handleEntityNotFound(_0x540b68,null))[_0x00aa('0xe')](function(_0x462b){if(_0x462b){_0x255c71['body']['AccountId']=_0x462b['id'];_0x255c71[_0x00aa('0x34')][_0x00aa('0x3b')]=integrations[_0x00aa('0x3c')](_0x255c71[_0x00aa('0x34')]['channel'],_0x255c71[_0x00aa('0x34')][_0x00aa('0x28')]);_0x255c71[_0x00aa('0x34')][_0x00aa('0x3d')]=integrations['getDescriptions'](_0x255c71[_0x00aa('0x34')][_0x00aa('0x3e')],_0x255c71['body'][_0x00aa('0x28')]);return db['Dynamics365Configuration']['create'](_0x255c71[_0x00aa('0x34')],{'include':[{'model':db[_0x00aa('0x3f')],'as':_0x00aa('0x3b')},{'model':db[_0x00aa('0x3f')],'as':_0x00aa('0x3d')}]});}return null;})[_0x00aa('0xe')](respondWithResult(_0x540b68,null))[_0x00aa('0x2e')](handleError(_0x540b68,null));};function sanitizeRemoteUri(_0x2cce26){var _0x4e9eec=_0x2cce26['slice'](-0x1);if(_0x4e9eec==='/')return _0x2cce26['substring'](0x0,_0x2cce26[_0x00aa('0x40')](_0x4e9eec));return _0x2cce26;}function getWebApiUrl(_0x14b830){return util[_0x00aa('0x41')](_0x00aa('0x42'),_0x14b830);}exports[_0x00aa('0x43')]=function(_0x3880e4,_0x2977f1){var _0x546391=_0x3880e4['query'][_0x00aa('0x44')];var _0xf54c0f=_0x546391===_0x00aa('0x45')?_0x00aa('0x46'):_0x00aa('0x47');var _0x4c0d05='';var _0x2a60c3='';var _0x372ee5='';var _0xca1c19='';var _0x3ef21b='';var _0x13ccf4='';var _0x47a125='';var _0xfbe0fc='';var _0x6d84e5=[_0x00aa('0x48'),_0x00aa('0x49'),_0x00aa('0x4a'),_0x00aa('0x4b'),_0x00aa('0x4c'),_0x00aa('0x4d'),_0x00aa('0x4e'),'regardingobjectid',_0x00aa('0x4f'),_0x00aa('0x50')];var _0x1ab89d=[_0x00aa('0x51'),_0x00aa('0x52'),_0x00aa('0x53'),'billedserviceunits',_0x00aa('0x54'),'contactidyominame','contractdetailidname',_0x00aa('0x55'),_0x00aa('0x56'),_0x00aa('0x57'),_0x00aa('0x58'),'createdbyyominame',_0x00aa('0x59'),_0x00aa('0x5a'),_0x00aa('0x5b'),_0x00aa('0x5c'),'customeridtype',_0x00aa('0x5d'),_0x00aa('0x5e'),_0x00aa('0x5f'),_0x00aa('0x60'),_0x00aa('0x61'),'escalatedon',_0x00aa('0x62'),_0x00aa('0x63'),_0x00aa('0x64'),_0x00aa('0x65'),_0x00aa('0x66'),_0x00aa('0x67'),'lastonholdtime','masteridname',_0x00aa('0x68'),_0x00aa('0x69'),_0x00aa('0x6a'),_0x00aa('0x6b'),_0x00aa('0x6c'),_0x00aa('0x6d'),_0x00aa('0x6e'),_0x00aa('0x6f'),_0x00aa('0x70'),_0x00aa('0x71'),_0x00aa('0x72'),_0x00aa('0x73'),'owneridname',_0x00aa('0x74'),_0x00aa('0x75'),'parentcaseidname','primarycontactidname',_0x00aa('0x76'),'prioritycodename',_0x00aa('0x77'),_0x00aa('0x78'),_0x00aa('0x79'),_0x00aa('0x7a'),_0x00aa('0x7b'),_0x00aa('0x7c'),_0x00aa('0x7d'),_0x00aa('0x7e'),_0x00aa('0x7f'),_0x00aa('0x80'),_0x00aa('0x81'),_0x00aa('0x82'),'statuscode',_0x00aa('0x83'),_0x00aa('0x84'),_0x00aa('0x85'),_0x00aa('0x86'),'traversedpath','utcconversiontimezonecode',_0x00aa('0x87')];var _0x2373b9=_0x6d84e5[_0x00aa('0x88')](_0x1ab89d);return db[_0x00aa('0x17')]['findOne']({'where':{'id':_0x3880e4[_0x00aa('0x30')]['id']},'attributes':['id',_0x00aa('0x89'),'password',_0x00aa('0x8a'),'tenantId',_0x00aa('0x8b'),_0x00aa('0x8c'),_0x00aa('0x8d')],'include':[{'model':db[_0x00aa('0x8e')],'as':_0x00aa('0x8e'),'attributes':['id',_0x00aa('0x8f'),_0x00aa('0x90')]}]})[_0x00aa('0xe')](handleEntityNotFound(_0x2977f1,null))['then'](function(_0x36b6e5){if(_0x36b6e5){if(_0x36b6e5[_0x00aa('0x8d')]){_0x36b6e5[_0x00aa('0x91')]=_0x36b6e5[_0x00aa('0x8e')][_0x00aa('0x8f')];_0xfbe0fc=sanitizeRemoteUri(_0x36b6e5['CloudProvider'][_0x00aa('0x90')]);_0x47a125=getWebApiUrl(_0xfbe0fc);return _0x36b6e5;}_0xfbe0fc=sanitizeRemoteUri(_0x36b6e5[_0x00aa('0x8a')]);_0x47a125=getWebApiUrl(_0xfbe0fc);var _0x3a7748={'method':_0x00aa('0x92'),'uri':_0x00aa('0x93')+_0x36b6e5[_0x00aa('0x94')]+'/oauth2/token','form':{'client_id':_0x36b6e5[_0x00aa('0x8b')],'resource':_0xfbe0fc,'username':_0x36b6e5['username'],'password':_0x36b6e5[_0x00aa('0x95')],'grant_type':'password','client_secret':_0x36b6e5['clientSecret']},'json':!![]};return rp(_0x3a7748);}})[_0x00aa('0xe')](function(_0x29ae40){_0x13ccf4=_0x29ae40[_0x00aa('0x91')];var _0x2d2279={'method':_0x00aa('0x96'),'uri':encodeURI(_0x47a125+_0x00aa('0x97')+_0xf54c0f+'\x27'),'headers':{'Authorization':_0x00aa('0x98')+_0x13ccf4,'If-None-Match':null,'OData-Version':_0x00aa('0x99')},'json':!![]};return rp(_0x2d2279);})[_0x00aa('0xe')](function(_0x3840c6){var _0x54b435=_0x3840c6[_0x00aa('0x9a')][0x0];var _0x787a1c=_0x54b435[_0x00aa('0x9b')];var _0x28c24e={'method':'GET','uri':_0x47a125+'EntityDefinitions('+_0x787a1c+_0x00aa('0x9c'),'headers':{'Authorization':_0x00aa('0x98')+_0x13ccf4,'If-None-Match':null,'OData-Version':_0x00aa('0x99')},'json':!![]};return rp(_0x28c24e);})[_0x00aa('0xe')](function(_0xf4ac08){_0x4c0d05=_0xf4ac08;_0x2a60c3=_0x4c0d05[_0x00aa('0x9d')];_0x2a60c3=_[_0x00aa('0x9e')](_0x2a60c3,function(_0x3456cd){return!_0x2373b9[_0x00aa('0x9f')](_0x3456cd[_0x00aa('0xa0')]);});var _0x2d57b2=[];var _0x1f9eb0=[];_0x2a60c3['forEach'](function(_0x109b67){if(_0x109b67[_0x00aa('0xa1')]){var _0x3ff32d=_0x109b67[_0x00aa('0xa1')][_0x00aa('0xa2')](_0x109b67[_0x00aa('0xa1')]['lastIndexOf']('.')+0x1);if(_0x3ff32d==='PicklistAttributeMetadata'){_0x2d57b2[_0x00aa('0xa3')](getSelectList(_0x47a125,_0x546391,_0x1f9eb0,_0x4c0d05[_0x00aa('0x9b')],_0x109b67[_0x00aa('0x9b')],_0x13ccf4));}}});return Promise['all'](_0x2d57b2);})[_0x00aa('0xe')](function(_0x46a8a3){_0x372ee5=_0x46a8a3[0x0];var _0x39d072=[];var _0x15dfa4=[];_0x2a60c3[_0x00aa('0xa4')](function(_0xd2d121){if(!_[_0x00aa('0xa5')](_0xd2d121[_0x00aa('0xa1')])){var _0x42176f=_0xd2d121[_0x00aa('0xa1')][_0x00aa('0xa2')](_0xd2d121[_0x00aa('0xa1')][_0x00aa('0x40')]('.')+0x1);if(_0x42176f===_0x00aa('0xa6')){_0x39d072['push'](getBooleanList(_0x47a125,_0x546391,_0x15dfa4,_0x4c0d05[_0x00aa('0x9b')],_0xd2d121[_0x00aa('0x9b')],_0x13ccf4));}}});return Promise[_0x00aa('0xa7')](_0x39d072);})[_0x00aa('0xe')](function(_0x13ceaa){_0xca1c19=_0x13ceaa[0x0];var _0x1a3df4=[];var _0x2b525d=[];_0x2a60c3[_0x00aa('0xa4')](function(_0x1257cd){if(_0x1257cd[_0x00aa('0xa1')]){var _0x124211=_0x1257cd[_0x00aa('0xa1')][_0x00aa('0xa2')](_0x1257cd[_0x00aa('0xa1')]['lastIndexOf']('.')+0x1);if(_0x124211==='StringAttributeMetadata'||_0x124211===_0x00aa('0xa8')||_0x124211==='BigIntAttributeMetadata'||_0x124211===_0x00aa('0xa9')||_0x124211===_0x00aa('0xaa')||_0x124211==='DateTimeAttributeMetadata'||_0x124211==='StatusAttributeMetadata'||_0x124211===_0x00aa('0xab')||_0x124211===_0x00aa('0xac')||_0x124211==='DecimalAttributeMetadata'){_0x1a3df4[_0x00aa('0xa3')](getInputList(_0x47a125,_0x546391,_0x124211,_0x2b525d,_0x4c0d05[_0x00aa('0x9b')],_0x1257cd[_0x00aa('0x9b')],_0x13ccf4));}}});return Promise[_0x00aa('0xa7')](_0x1a3df4);})[_0x00aa('0xe')](function(_0x186f5a){_0x3ef21b=_0x186f5a[0x0];var _0x70178c=_0x372ee5['concat'](_0xca1c19)['concat'](_0x3ef21b);var _0x5e9c5e={'count':_0x70178c[_0x00aa('0x21')],'rows':_0x70178c};return _0x5e9c5e;})[_0x00aa('0xe')](respondWithResult(_0x2977f1,null))['catch'](function(_0x2b9716){var _0xa89fce=_0x3880e4['query'][_0x00aa('0xad')]?0x1f4:_0x2b9716[_0x00aa('0xae')]||0x1f4;logger[_0x00aa('0x11')](_0x2b9716[_0x00aa('0x12')]);delete _0x2b9716[_0x00aa('0x13')];if(_0xa89fce===0x191){_0xa89fce=0x190;}_0x2977f1[_0x00aa('0x6')](_0xa89fce)['send'](_0x3880e4[_0x00aa('0x1d')][_0x00aa('0xad')]?{'message':_0x00aa('0xaf'),'statusCode':_0x2b9716['statusCode']}:_0x2b9716);});};function getSelectList(_0x16a5b1,_0x19b10f,_0xa0cda2,_0x4f9737,_0x2dfd34,_0x48597e){var _0x1e56e0={'method':_0x00aa('0x96'),'uri':_0x16a5b1+_0x00aa('0xb0')+_0x4f9737+_0x00aa('0xb1')+_0x2dfd34+_0x00aa('0xb2')+_0x00aa('0xb3'),'headers':{'Authorization':_0x00aa('0x98')+_0x48597e,'If-None-Match':null,'OData-Version':_0x00aa('0x99')},'json':!![]};return rp(_0x1e56e0)[_0x00aa('0xe')](function(_0x2be4a6){var _0x1a5a3c=[];var _0x1c39c2=_0x2be4a6[_0x00aa('0xb4')]['Options'];_0x1c39c2[_0x00aa('0xa4')](function(_0x53a4ec){_0x1a5a3c['push']({'name':_0x53a4ec['Label'][_0x00aa('0xb5')][_0x00aa('0xb6')],'value':String(_0x53a4ec['Value'])});});var _0x45d6cc={'id':_0x19b10f+'_'+_0x2be4a6[_0x00aa('0xa0')],'name':_0x2be4a6[_0x00aa('0xb7')][_0x00aa('0xb5')][_0x00aa('0xb6')],'custom':![],'options':_0x1a5a3c};_0xa0cda2['push'](_0x45d6cc);return _0xa0cda2;});}function getBooleanList(_0x2a8842,_0x1dcd76,_0x1a2463,_0x580a08,_0x98df10,_0x208e34){var _0x42c8e0={'method':'GET','uri':_0x2a8842+_0x00aa('0xb0')+_0x580a08+_0x00aa('0xb1')+_0x98df10+_0x00aa('0xb8'),'headers':{'Authorization':_0x00aa('0x98')+_0x208e34,'If-None-Match':null,'OData-Version':_0x00aa('0x99')},'json':!![]};return rp(_0x42c8e0)['then'](function(_0x1d55e9){var _0x1c8986=[];_0x1c8986[_0x00aa('0xa3')]({'name':_0x1d55e9['OptionSet'][_0x00aa('0xb9')][_0x00aa('0xb6')][_0x00aa('0xb5')][_0x00aa('0xb6')],'value':_0x00aa('0xba')},{'name':_0x1d55e9['OptionSet'][_0x00aa('0xbb')]['Label']['UserLocalizedLabel'][_0x00aa('0xb6')],'value':_0x00aa('0xbc')});var _0x178918={'id':_0x1dcd76+'_'+_0x1d55e9[_0x00aa('0xa0')],'name':_0x1d55e9[_0x00aa('0xb7')][_0x00aa('0xb5')][_0x00aa('0xb6')],'custom':![],'options':_0x1c8986};_0x1a2463[_0x00aa('0xa3')](_0x178918);return _0x1a2463;});}function getInputList(_0x10a4dd,_0x2a4f87,_0x354c9f,_0x8491c3,_0x39a749,_0x20c8d3,_0x4457e3){var _0xd7b305={'method':_0x00aa('0x96'),'uri':_0x10a4dd+_0x00aa('0xb0')+_0x39a749+')/Attributes('+_0x20c8d3+_0x00aa('0xbd')+_0x354c9f+_0x00aa('0xbe'),'headers':{'Authorization':_0x00aa('0x98')+_0x4457e3,'If-None-Match':null,'OData-Version':_0x00aa('0x99')},'json':!![]};return rp(_0xd7b305)['then'](function(_0x1032f4){var _0x65def7={'id':_0x2a4f87+'_'+_0x1032f4['LogicalName'],'name':_0x1032f4[_0x00aa('0xb7')]['UserLocalizedLabel']?_0x1032f4[_0x00aa('0xb7')]['UserLocalizedLabel'][_0x00aa('0xb6')]:_0x1032f4['LogicalName'],'custom':![],'options':[]};_0x8491c3['push'](_0x65def7);return _0x8491c3;});} \ No newline at end of file +var _0xc8bd=['timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','Bearer\x20','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','json','update','destroy','then','sendStatus','error','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','body','getConfigurations','findOne','Dynamics365Configuration','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statuscode','ticketnumber'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc8bd,0xf6));var _0xdc8b=function(_0xfc53fc,_0x4204d6){_0xfc53fc=_0xfc53fc-0x0;var _0x423828=_0xc8bd[_0xfc53fc];return _0x423828;};'use strict';var rp=require(_0xdc8b('0x0'));var util=require(_0xdc8b('0x1'));var _=require(_0xdc8b('0x2'));var qs=require(_0xdc8b('0x3'));var logger=require(_0xdc8b('0x4'))(_0xdc8b('0x5'));var db=require(_0xdc8b('0x6'))['db'];var integrations=require(_0xdc8b('0x7'));function respondWithResult(_0xc345ab,_0x1148ca){_0x1148ca=_0x1148ca||0xc8;return function(_0x3c1904){if(_0x3c1904){return _0xc345ab[_0xdc8b('0x8')](_0x1148ca)['json'](_0x3c1904);}};}function respondWithFilteredResult(_0x4ccf43,_0x38458d){return function(_0x3b38cf){if(_0x3b38cf){var _0x26cb70=typeof _0x38458d[_0xdc8b('0x9')]===_0xdc8b('0xa')&&typeof _0x38458d[_0xdc8b('0xb')]===_0xdc8b('0xa');var _0x24cd22=_0x3b38cf[_0xdc8b('0xc')];var _0x5e072a=_0x26cb70?0x0:_0x38458d[_0xdc8b('0x9')];var _0x540ff0=_0x26cb70?_0x3b38cf[_0xdc8b('0xc')]:_0x38458d[_0xdc8b('0x9')]+_0x38458d['limit'];var _0x1093d5;if(_0x540ff0>=_0x24cd22){_0x540ff0=_0x24cd22;_0x1093d5=0xc8;}else{_0x1093d5=0xce;}_0x4ccf43[_0xdc8b('0x8')](_0x1093d5);return _0x4ccf43['set']('Content-Range',_0x5e072a+'-'+_0x540ff0+'/'+_0x24cd22)[_0xdc8b('0xd')](_0x3b38cf);}return null;};}function saveUpdates(_0x33ccaf){return function(_0x1ec695){if(_0x1ec695){return _0x1ec695[_0xdc8b('0xe')](_0x33ccaf)['then'](function(_0x109dc1){return _0x109dc1;});}return null;};}function removeEntity(_0x1182bc){return function(_0x57b1ce){if(_0x57b1ce){return _0x57b1ce[_0xdc8b('0xf')]()[_0xdc8b('0x10')](function(){_0x1182bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2680ef){return function(_0xfbfd66){if(!_0xfbfd66){_0x2680ef[_0xdc8b('0x11')](0x194);}return _0xfbfd66;};}function handleError(_0x41c689,_0x3f59b4){_0x3f59b4=_0x3f59b4||0x1f4;return function(_0x59b1d2){logger[_0xdc8b('0x12')](_0x59b1d2['stack']);if(_0x59b1d2['name']){delete _0x59b1d2[_0xdc8b('0x13')];}_0x41c689[_0xdc8b('0x8')](_0x3f59b4)[_0xdc8b('0x14')](_0x59b1d2);};}exports['index']=function(_0x4b5511,_0x47c9c3){var _0x1b0524={},_0x48c819={},_0x501ccf={'count':0x0,'rows':[]};var _0x386e5b=_[_0xdc8b('0x15')](db[_0xdc8b('0x16')][_0xdc8b('0x17')],function(_0x152f59){return{'name':_0x152f59[_0xdc8b('0x18')],'type':_0x152f59[_0xdc8b('0x19')][_0xdc8b('0x1a')]};});_0x48c819[_0xdc8b('0x1b')]=_[_0xdc8b('0x15')](_0x386e5b,'name');_0x48c819['query']=_['keys'](_0x4b5511[_0xdc8b('0x1c')]);_0x48c819[_0xdc8b('0x1d')]=_[_0xdc8b('0x1e')](_0x48c819['model'],_0x48c819[_0xdc8b('0x1c')]);_0x1b0524['attributes']=_[_0xdc8b('0x1e')](_0x48c819['model'],qs[_0xdc8b('0x1f')](_0x4b5511['query'][_0xdc8b('0x1f')]));_0x1b0524[_0xdc8b('0x20')]=_0x1b0524['attributes'][_0xdc8b('0x21')]?_0x1b0524[_0xdc8b('0x20')]:_0x48c819[_0xdc8b('0x1b')];if(!_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x22')](_0xdc8b('0x23'))){_0x1b0524['limit']=qs[_0xdc8b('0xb')](_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0xb')]);_0x1b0524[_0xdc8b('0x9')]=qs['offset'](_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x9')]);}_0x1b0524[_0xdc8b('0x24')]=qs['sort'](_0x4b5511[_0xdc8b('0x1c')]['sort']);_0x1b0524[_0xdc8b('0x25')]=qs[_0xdc8b('0x1d')](_[_0xdc8b('0x26')](_0x4b5511[_0xdc8b('0x1c')],_0x48c819['filters']),_0x386e5b);if(_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x27')]){_0x1b0524['where']=_[_0xdc8b('0x28')](_0x1b0524['where'],{'$or':_['map'](_0x386e5b,function(_0x44e86b){if(_0x44e86b[_0xdc8b('0x19')]!==_0xdc8b('0x29')){var _0x291e7e={};_0x291e7e[_0x44e86b[_0xdc8b('0x13')]]={'$like':'%'+_0x4b5511[_0xdc8b('0x1c')][_0xdc8b('0x27')]+'%'};return _0x291e7e;}})});}_0x1b0524=_[_0xdc8b('0x28')]({},_0x1b0524,_0x4b5511['options']);var _0xc058e5={'where':_0x1b0524['where']};return db['Dynamics365Account']['count'](_0xc058e5)[_0xdc8b('0x10')](function(_0xe2fb7b){_0x501ccf[_0xdc8b('0xc')]=_0xe2fb7b;if(_0x4b5511['query'][_0xdc8b('0x2a')]){_0x1b0524[_0xdc8b('0x2b')]=[{'all':!![]}];}return db[_0xdc8b('0x16')][_0xdc8b('0x2c')](_0x1b0524);})[_0xdc8b('0x10')](function(_0x4f0e5f){_0x501ccf[_0xdc8b('0x2d')]=_0x4f0e5f;return _0x501ccf;})[_0xdc8b('0x10')](respondWithFilteredResult(_0x47c9c3,_0x1b0524))[_0xdc8b('0x2e')](handleError(_0x47c9c3,null));};exports['show']=function(_0x5f4377,_0x4e0b80){var _0x3c9ff9={'raw':![],'where':{'id':_0x5f4377[_0xdc8b('0x2f')]['id']}},_0xfb54c2={};_0xfb54c2[_0xdc8b('0x1b')]=_[_0xdc8b('0x30')](db[_0xdc8b('0x16')]['rawAttributes']);_0xfb54c2[_0xdc8b('0x1c')]=_[_0xdc8b('0x30')](_0x5f4377[_0xdc8b('0x1c')]);_0xfb54c2['filters']=_[_0xdc8b('0x1e')](_0xfb54c2['model'],_0xfb54c2['query']);_0x3c9ff9[_0xdc8b('0x20')]=_[_0xdc8b('0x1e')](_0xfb54c2['model'],qs['fields'](_0x5f4377[_0xdc8b('0x1c')][_0xdc8b('0x1f')]));_0x3c9ff9[_0xdc8b('0x20')]=_0x3c9ff9[_0xdc8b('0x20')][_0xdc8b('0x21')]?_0x3c9ff9[_0xdc8b('0x20')]:_0xfb54c2['model'];if(_0x5f4377[_0xdc8b('0x1c')][_0xdc8b('0x2a')]){_0x3c9ff9[_0xdc8b('0x2b')]=[{'all':!![]}];}_0x3c9ff9=_[_0xdc8b('0x28')]({},_0x3c9ff9,_0x5f4377[_0xdc8b('0x31')]);return db[_0xdc8b('0x16')][_0xdc8b('0x32')](_0x3c9ff9)[_0xdc8b('0x10')](handleEntityNotFound(_0x4e0b80,null))[_0xdc8b('0x10')](respondWithResult(_0x4e0b80,null))[_0xdc8b('0x2e')](handleError(_0x4e0b80,null));};exports['create']=function(_0xadc15,_0x29fb9f){return db[_0xdc8b('0x16')]['create'](_0xadc15[_0xdc8b('0x33')],{})[_0xdc8b('0x10')](respondWithResult(_0x29fb9f,0xc9))[_0xdc8b('0x2e')](handleError(_0x29fb9f,null));};exports['update']=function(_0x45aacd,_0x5dce0b){if(_0x45aacd[_0xdc8b('0x33')]['id']){delete _0x45aacd[_0xdc8b('0x33')]['id'];}return db[_0xdc8b('0x16')][_0xdc8b('0x32')]({'where':{'id':_0x45aacd['params']['id']}})['then'](handleEntityNotFound(_0x5dce0b,null))[_0xdc8b('0x10')](saveUpdates(_0x45aacd['body'],null))[_0xdc8b('0x10')](respondWithResult(_0x5dce0b,null))[_0xdc8b('0x2e')](handleError(_0x5dce0b,null));};exports[_0xdc8b('0xf')]=function(_0x494bcd,_0x4b41e7){return db[_0xdc8b('0x16')][_0xdc8b('0x32')]({'where':{'id':_0x494bcd[_0xdc8b('0x2f')]['id']}})[_0xdc8b('0x10')](handleEntityNotFound(_0x4b41e7,null))[_0xdc8b('0x10')](removeEntity(_0x4b41e7,null))[_0xdc8b('0x2e')](handleError(_0x4b41e7,null));};exports[_0xdc8b('0x34')]=function(_0x43ac55,_0x5744c0){var _0x529562={};var _0x3bc5a2={};var _0x28105b;var _0x38bdc9;return db['Dynamics365Account'][_0xdc8b('0x35')]({'where':{'id':_0x43ac55[_0xdc8b('0x2f')]['id']}})[_0xdc8b('0x10')](handleEntityNotFound(_0x5744c0,null))[_0xdc8b('0x10')](function(_0x4b04fd){if(_0x4b04fd){_0x28105b=_0x4b04fd;_0x3bc5a2['model']=_[_0xdc8b('0x30')](db[_0xdc8b('0x36')][_0xdc8b('0x17')]);_0x3bc5a2[_0xdc8b('0x1c')]=_['keys'](_0x43ac55[_0xdc8b('0x1c')]);_0x3bc5a2[_0xdc8b('0x1d')]=_['intersection'](_0x3bc5a2['model'],_0x3bc5a2['query']);_0x529562['attributes']=_['intersection'](_0x3bc5a2[_0xdc8b('0x1b')],qs[_0xdc8b('0x1f')](_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x1f')]));_0x529562[_0xdc8b('0x20')]=_0x529562[_0xdc8b('0x20')][_0xdc8b('0x21')]?_0x529562[_0xdc8b('0x20')]:_0x3bc5a2['model'];_0x529562[_0xdc8b('0x24')]=qs[_0xdc8b('0x37')](_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x37')]);_0x529562[_0xdc8b('0x25')]=qs[_0xdc8b('0x1d')](_[_0xdc8b('0x26')](_0x43ac55[_0xdc8b('0x1c')],_0x3bc5a2[_0xdc8b('0x1d')]));if(_0x43ac55[_0xdc8b('0x1c')]['filter']){_0x529562['where']=_[_0xdc8b('0x28')](_0x529562['where'],{'$or':_[_0xdc8b('0x15')](_0x529562[_0xdc8b('0x20')],function(_0x52f621){var _0x41ea99={};_0x41ea99[_0x52f621]={'$like':'%'+_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x27')]+'%'};return _0x41ea99;})});}_0x529562=_['merge']({},_0x529562,_0x43ac55[_0xdc8b('0x31')]);return _0x28105b[_0xdc8b('0x34')](_0x529562);}})[_0xdc8b('0x10')](function(_0x446bb3){if(_0x446bb3){_0x38bdc9=_0x446bb3[_0xdc8b('0x21')];if(!_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0x22')]('nolimit')){_0x529562[_0xdc8b('0xb')]=qs[_0xdc8b('0xb')](_0x43ac55[_0xdc8b('0x1c')][_0xdc8b('0xb')]);_0x529562[_0xdc8b('0x9')]=qs[_0xdc8b('0x9')](_0x43ac55['query'][_0xdc8b('0x9')]);}return _0x28105b[_0xdc8b('0x34')](_0x529562);}})['then'](function(_0x5c5e93){if(_0x5c5e93){return _0x5c5e93?{'count':_0x38bdc9,'rows':_0x5c5e93}:null;}})['then'](respondWithResult(_0x5744c0,null))['catch'](handleError(_0x5744c0,null));};exports[_0xdc8b('0x38')]=function(_0x4c8f4f,_0x1488c0){if(_0x4c8f4f[_0xdc8b('0x33')]['id']){delete _0x4c8f4f[_0xdc8b('0x33')]['id'];}return db[_0xdc8b('0x16')]['findOne']({'where':{'id':_0x4c8f4f[_0xdc8b('0x2f')]['id']}})[_0xdc8b('0x10')](handleEntityNotFound(_0x1488c0,null))[_0xdc8b('0x10')](function(_0xeec6b7){if(_0xeec6b7){_0x4c8f4f[_0xdc8b('0x33')][_0xdc8b('0x39')]=_0xeec6b7['id'];_0x4c8f4f['body'][_0xdc8b('0x3a')]=integrations[_0xdc8b('0x3b')](_0x4c8f4f[_0xdc8b('0x33')]['channel'],_0x4c8f4f['body'][_0xdc8b('0x19')]);_0x4c8f4f['body'][_0xdc8b('0x3c')]=integrations[_0xdc8b('0x3d')](_0x4c8f4f[_0xdc8b('0x33')][_0xdc8b('0x3e')],_0x4c8f4f[_0xdc8b('0x33')][_0xdc8b('0x19')]);return db[_0xdc8b('0x36')][_0xdc8b('0x3f')](_0x4c8f4f['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xdc8b('0x3a')},{'model':db['Dynamics365Field'],'as':_0xdc8b('0x3c')}]});}return null;})['then'](respondWithResult(_0x1488c0,null))['catch'](handleError(_0x1488c0,null));};function sanitizeRemoteUri(_0x514993){var _0x594bfa=_0x514993['slice'](-0x1);if(_0x594bfa==='/')return _0x514993[_0xdc8b('0x40')](0x0,_0x514993[_0xdc8b('0x41')](_0x594bfa));return _0x514993;}function getWebApiUrl(_0x5de29e){return util[_0xdc8b('0x42')](_0xdc8b('0x43'),_0x5de29e);}exports[_0xdc8b('0x44')]=function(_0x113ea8,_0xcab95d){var _0x598252=_0x113ea8[_0xdc8b('0x1c')]['ticketType'];var _0x4cd45c=_0x598252===_0xdc8b('0x45')?_0xdc8b('0x46'):_0xdc8b('0x47');var _0x47e06b='';var _0x5aaa52='';var _0x4bb26a='';var _0x34a9c4='';var _0x4dbc6f='';var _0x3f53ba='';var _0x1134b7='';var _0xd449df='';var _0x5ed629=[_0xdc8b('0x48'),_0xdc8b('0x49'),_0xdc8b('0x4a'),_0xdc8b('0x4b'),_0xdc8b('0x4c'),'subject',_0xdc8b('0x4d'),_0xdc8b('0x4e'),'directioncode',_0xdc8b('0x4f')];var _0x4887cf=[_0xdc8b('0x50'),_0xdc8b('0x51'),_0xdc8b('0x52'),_0xdc8b('0x53'),_0xdc8b('0x54'),_0xdc8b('0x55'),_0xdc8b('0x56'),'contractidname',_0xdc8b('0x57'),_0xdc8b('0x58'),_0xdc8b('0x59'),'createdbyyominame',_0xdc8b('0x5a'),'createdonbehalfbyname',_0xdc8b('0x5b'),_0xdc8b('0x5c'),_0xdc8b('0x5d'),_0xdc8b('0x5e'),_0xdc8b('0x5f'),_0xdc8b('0x60'),_0xdc8b('0x61'),_0xdc8b('0x62'),_0xdc8b('0x63'),_0xdc8b('0x64'),_0xdc8b('0x65'),_0xdc8b('0x66'),_0xdc8b('0x67'),_0xdc8b('0x68'),_0xdc8b('0x69'),_0xdc8b('0x6a'),_0xdc8b('0x6b'),_0xdc8b('0x6c'),'modifiedbyexternalpartyyominame',_0xdc8b('0x6d'),'modifiedbyyominame',_0xdc8b('0x6e'),_0xdc8b('0x6f'),_0xdc8b('0x70'),_0xdc8b('0x71'),_0xdc8b('0x72'),_0xdc8b('0x73'),'onholdtime',_0xdc8b('0x74'),'owneridname','owneridtype','owneridyominame','parentcaseidname',_0xdc8b('0x75'),_0xdc8b('0x76'),_0xdc8b('0x77'),_0xdc8b('0x78'),_0xdc8b('0x79'),_0xdc8b('0x7a'),_0xdc8b('0x7b'),'responseby',_0xdc8b('0x7c'),_0xdc8b('0x7d'),_0xdc8b('0x7e'),'slainvokedidname','slaname',_0xdc8b('0x7f'),'statecode',_0xdc8b('0x80'),'subjectidname',_0xdc8b('0x81'),_0xdc8b('0x82'),_0xdc8b('0x83'),_0xdc8b('0x84'),_0xdc8b('0x85'),'versionnumber'];var _0x542b83=_0x5ed629[_0xdc8b('0x86')](_0x4887cf);return db[_0xdc8b('0x16')]['findOne']({'where':{'id':_0x113ea8[_0xdc8b('0x2f')]['id']},'attributes':['id',_0xdc8b('0x87'),_0xdc8b('0x88'),_0xdc8b('0x89'),_0xdc8b('0x8a'),_0xdc8b('0x8b'),'clientSecret',_0xdc8b('0x8c')],'include':[{'model':db['CloudProvider'],'as':_0xdc8b('0x8d'),'attributes':['id',_0xdc8b('0x8e'),_0xdc8b('0x8f')]}]})[_0xdc8b('0x10')](handleEntityNotFound(_0xcab95d,null))['then'](function(_0x4e25eb){if(_0x4e25eb){if(_0x4e25eb['modernAuthentication']){_0x4e25eb['access_token']=_0x4e25eb[_0xdc8b('0x8d')][_0xdc8b('0x8e')];_0xd449df=sanitizeRemoteUri(_0x4e25eb[_0xdc8b('0x8d')][_0xdc8b('0x8f')]);_0x1134b7=getWebApiUrl(_0xd449df);return _0x4e25eb;}_0xd449df=sanitizeRemoteUri(_0x4e25eb[_0xdc8b('0x89')]);_0x1134b7=getWebApiUrl(_0xd449df);var _0x4b4f50={'method':'POST','uri':_0xdc8b('0x90')+_0x4e25eb[_0xdc8b('0x8a')]+_0xdc8b('0x91'),'form':{'client_id':_0x4e25eb[_0xdc8b('0x8b')],'resource':_0xd449df,'username':_0x4e25eb[_0xdc8b('0x87')],'password':_0x4e25eb[_0xdc8b('0x88')],'grant_type':'password','client_secret':_0x4e25eb[_0xdc8b('0x92')]},'json':!![]};return rp(_0x4b4f50);}})['then'](function(_0x4208e6){_0x3f53ba=_0x4208e6[_0xdc8b('0x93')];var _0x1daa5f={'method':_0xdc8b('0x94'),'uri':encodeURI(_0x1134b7+_0xdc8b('0x95')+_0x4cd45c+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x3f53ba,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1daa5f);})[_0xdc8b('0x10')](function(_0x3aa0c4){var _0x24c01b=_0x3aa0c4['value'][0x0];var _0x30e579=_0x24c01b['MetadataId'];var _0x856809={'method':'GET','uri':_0x1134b7+_0xdc8b('0x96')+_0x30e579+_0xdc8b('0x97'),'headers':{'Authorization':'Bearer\x20'+_0x3f53ba,'If-None-Match':null,'OData-Version':_0xdc8b('0x98')},'json':!![]};return rp(_0x856809);})[_0xdc8b('0x10')](function(_0x1c9b44){_0x47e06b=_0x1c9b44;_0x5aaa52=_0x47e06b[_0xdc8b('0x99')];_0x5aaa52=_['remove'](_0x5aaa52,function(_0x33ffa5){return!_0x542b83[_0xdc8b('0x9a')](_0x33ffa5['LogicalName']);});var _0x44cb5b=[];var _0xd280a1=[];_0x5aaa52[_0xdc8b('0x9b')](function(_0x110eed){if(_0x110eed[_0xdc8b('0x9c')]){var _0x3c305b=_0x110eed[_0xdc8b('0x9c')][_0xdc8b('0x40')](_0x110eed[_0xdc8b('0x9c')]['lastIndexOf']('.')+0x1);if(_0x3c305b===_0xdc8b('0x9d')){_0x44cb5b['push'](getSelectList(_0x1134b7,_0x598252,_0xd280a1,_0x47e06b[_0xdc8b('0x9e')],_0x110eed[_0xdc8b('0x9e')],_0x3f53ba));}}});return Promise[_0xdc8b('0x9f')](_0x44cb5b);})[_0xdc8b('0x10')](function(_0x20483d){_0x4bb26a=_0x20483d[0x0];var _0x10cbcc=[];var _0x27915c=[];_0x5aaa52[_0xdc8b('0x9b')](function(_0x21a2cc){if(!_[_0xdc8b('0xa0')](_0x21a2cc['@odata.type'])){var _0x1002fd=_0x21a2cc[_0xdc8b('0x9c')]['substring'](_0x21a2cc['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1002fd===_0xdc8b('0xa1')){_0x10cbcc[_0xdc8b('0xa2')](getBooleanList(_0x1134b7,_0x598252,_0x27915c,_0x47e06b[_0xdc8b('0x9e')],_0x21a2cc['MetadataId'],_0x3f53ba));}}});return Promise[_0xdc8b('0x9f')](_0x10cbcc);})[_0xdc8b('0x10')](function(_0x10119b){_0x34a9c4=_0x10119b[0x0];var _0xf23b4f=[];var _0x5b1f18=[];_0x5aaa52['forEach'](function(_0x4b1957){if(_0x4b1957[_0xdc8b('0x9c')]){var _0x823429=_0x4b1957[_0xdc8b('0x9c')][_0xdc8b('0x40')](_0x4b1957[_0xdc8b('0x9c')][_0xdc8b('0x41')]('.')+0x1);if(_0x823429==='StringAttributeMetadata'||_0x823429==='DoubleAttributeMetadata'||_0x823429==='BigIntAttributeMetadata'||_0x823429===_0xdc8b('0xa3')||_0x823429==='MemoAttributeMetadata'||_0x823429===_0xdc8b('0xa4')||_0x823429===_0xdc8b('0xa5')||_0x823429===_0xdc8b('0xa6')||_0x823429==='StateAttributeMetadata'||_0x823429===_0xdc8b('0xa7')){_0xf23b4f['push'](getInputList(_0x1134b7,_0x598252,_0x823429,_0x5b1f18,_0x47e06b[_0xdc8b('0x9e')],_0x4b1957[_0xdc8b('0x9e')],_0x3f53ba));}}});return Promise['all'](_0xf23b4f);})['then'](function(_0x36cd97){_0x4dbc6f=_0x36cd97[0x0];var _0x56a40e=_0x4bb26a['concat'](_0x34a9c4)['concat'](_0x4dbc6f);var _0x228c49={'count':_0x56a40e['length'],'rows':_0x56a40e};return _0x228c49;})[_0xdc8b('0x10')](respondWithResult(_0xcab95d,null))[_0xdc8b('0x2e')](function(_0x56a454){var _0xa49d55=_0x113ea8[_0xdc8b('0x1c')][_0xdc8b('0xa8')]?0x1f4:_0x56a454[_0xdc8b('0xa9')]||0x1f4;logger[_0xdc8b('0x12')](_0x56a454[_0xdc8b('0xaa')]);delete _0x56a454[_0xdc8b('0x13')];if(_0xa49d55===0x191){_0xa49d55=0x190;}_0xcab95d[_0xdc8b('0x8')](_0xa49d55)[_0xdc8b('0x14')](_0x113ea8['query'][_0xdc8b('0xa8')]?{'message':_0xdc8b('0xab'),'statusCode':_0x56a454[_0xdc8b('0xa9')]}:_0x56a454);});};function getSelectList(_0x196432,_0x29bf98,_0x29e4a2,_0x5792a0,_0x3c80f2,_0x5f0456){var _0x4dec02={'method':_0xdc8b('0x94'),'uri':_0x196432+_0xdc8b('0x96')+_0x5792a0+_0xdc8b('0xac')+_0x3c80f2+_0xdc8b('0xad')+_0xdc8b('0xae'),'headers':{'Authorization':'Bearer\x20'+_0x5f0456,'If-None-Match':null,'OData-Version':_0xdc8b('0x98')},'json':!![]};return rp(_0x4dec02)[_0xdc8b('0x10')](function(_0x24a9de){var _0x1d714d=[];var _0x7d722c=_0x24a9de[_0xdc8b('0xaf')]['Options'];_0x7d722c[_0xdc8b('0x9b')](function(_0x91824b){_0x1d714d[_0xdc8b('0xa2')]({'name':_0x91824b[_0xdc8b('0xb0')][_0xdc8b('0xb1')][_0xdc8b('0xb0')],'value':String(_0x91824b[_0xdc8b('0xb2')])});});var _0x1d86bc={'id':_0x29bf98+'_'+_0x24a9de[_0xdc8b('0xb3')],'name':_0x24a9de[_0xdc8b('0xb4')][_0xdc8b('0xb1')]['Label'],'custom':![],'options':_0x1d714d};_0x29e4a2['push'](_0x1d86bc);return _0x29e4a2;});}function getBooleanList(_0xfdb179,_0x24538a,_0x53e6ab,_0x4e2916,_0x8353f6,_0x24c08c){var _0x5f24da={'method':_0xdc8b('0x94'),'uri':_0xfdb179+_0xdc8b('0x96')+_0x4e2916+')/Attributes('+_0x8353f6+_0xdc8b('0xb5'),'headers':{'Authorization':_0xdc8b('0xb6')+_0x24c08c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f24da)[_0xdc8b('0x10')](function(_0x27fc90){var _0x3ec13f=[];_0x3ec13f['push']({'name':_0x27fc90[_0xdc8b('0xaf')][_0xdc8b('0xb7')][_0xdc8b('0xb0')][_0xdc8b('0xb1')][_0xdc8b('0xb0')],'value':_0xdc8b('0xb8')},{'name':_0x27fc90[_0xdc8b('0xaf')][_0xdc8b('0xb9')]['Label']['UserLocalizedLabel'][_0xdc8b('0xb0')],'value':_0xdc8b('0xba')});var _0x44fa5f={'id':_0x24538a+'_'+_0x27fc90['LogicalName'],'name':_0x27fc90[_0xdc8b('0xb4')][_0xdc8b('0xb1')][_0xdc8b('0xb0')],'custom':![],'options':_0x3ec13f};_0x53e6ab[_0xdc8b('0xa2')](_0x44fa5f);return _0x53e6ab;});}function getInputList(_0x2b5bb6,_0x3f318d,_0x25a35b,_0x8dcfdf,_0x2b703a,_0x5ba557,_0x1a8045){var _0x452b30={'method':_0xdc8b('0x94'),'uri':_0x2b5bb6+_0xdc8b('0x96')+_0x2b703a+')/Attributes('+_0x5ba557+_0xdc8b('0xbb')+_0x25a35b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xdc8b('0xb6')+_0x1a8045,'If-None-Match':null,'OData-Version':_0xdc8b('0x98')},'json':!![]};return rp(_0x452b30)[_0xdc8b('0x10')](function(_0x1ddfdd){var _0x37046b={'id':_0x3f318d+'_'+_0x1ddfdd[_0xdc8b('0xb3')],'name':_0x1ddfdd[_0xdc8b('0xb4')][_0xdc8b('0xb1')]?_0x1ddfdd['DisplayName'][_0xdc8b('0xb1')]['Label']:_0x1ddfdd[_0xdc8b('0xb3')],'custom':![],'options':[]};_0x8dcfdf[_0xdc8b('0xa2')](_0x37046b);return _0x8dcfdf;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 549feb1..44f0ce5 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4e0e68,_0x38b5d8){var _0x5c44e7=function(_0x1e6559){while(--_0x1e6559){_0x4e0e68['push'](_0x4e0e68['shift']());}};_0x5c44e7(++_0x38b5d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8c52f3f..f35a779 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 _0xb26c=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','Dynamics365Account','findAll','options','where','attributes','limit','map','model','include','then','GetDynamics365Account','ShowDynamics365Account','find'];(function(_0x4ae66b,_0x190df6){var _0xf07d0e=function(_0x531211){while(--_0x531211){_0x4ae66b['push'](_0x4ae66b['shift']());}};_0xf07d0e(++_0x190df6);}(_0xb26c,0x1ba));var _0xcb26=function(_0x411871,_0x3f6641){_0x411871=_0x411871-0x0;var _0x2ab4fc=_0xb26c[_0x411871];return _0x2ab4fc;};'use strict';var _=require(_0xcb26('0x0'));var util=require(_0xcb26('0x1'));var moment=require('moment');var BPromise=require(_0xcb26('0x2'));var rs=require(_0xcb26('0x3'));var fs=require('fs');var Redis=require(_0xcb26('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb26('0x5'));var logger=require('../../config/logger')(_0xcb26('0x6'));var config=require(_0xcb26('0x7'));var jayson=require(_0xcb26('0x8'));var client=jayson[_0xcb26('0x9')][_0xcb26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x476fdc,_0x3797f4,_0x4b3f88){return new BPromise(function(_0x5b0c98,_0x2e5001){return client[_0xcb26('0xb')](_0x476fdc,_0x4b3f88)['then'](function(_0x46bcc5){logger[_0xcb26('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x3797f4,'request\x20sent');logger[_0xcb26('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3797f4,_0xcb26('0xe'),JSON[_0xcb26('0xf')](_0x46bcc5));if(_0x46bcc5[_0xcb26('0x10')]){if(_0x46bcc5[_0xcb26('0x10')][_0xcb26('0x11')]===0x1f4){logger[_0xcb26('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x3797f4,_0x46bcc5[_0xcb26('0x10')][_0xcb26('0x12')]);return _0x2e5001(_0x46bcc5[_0xcb26('0x10')]['message']);}logger[_0xcb26('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x3797f4,_0x46bcc5[_0xcb26('0x10')]['message']);return _0x5b0c98(_0x46bcc5[_0xcb26('0x10')][_0xcb26('0x12')]);}else{logger[_0xcb26('0xc')](_0xcb26('0x13'),_0x3797f4,_0xcb26('0xe'));_0x5b0c98(_0x46bcc5[_0xcb26('0x14')][_0xcb26('0x12')]);}})['catch'](function(_0x3ccc8b){logger[_0xcb26('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x3797f4,_0x3ccc8b);_0x2e5001(_0x3ccc8b);});});}exports['GetDynamics365Account']=function(_0x58092b){var _0x2fa032=this;return new Promise(function(_0x4bc893,_0x6e25eb){return db[_0xcb26('0x15')][_0xcb26('0x16')]({'raw':_0x58092b[_0xcb26('0x17')]?_0x58092b[_0xcb26('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58092b[_0xcb26('0x17')]?_0x58092b[_0xcb26('0x17')][_0xcb26('0x18')]||null:null,'attributes':_0x58092b[_0xcb26('0x17')]?_0x58092b[_0xcb26('0x17')][_0xcb26('0x19')]||null:null,'limit':_0x58092b[_0xcb26('0x17')]?_0x58092b[_0xcb26('0x17')][_0xcb26('0x1a')]||null:null,'include':_0x58092b[_0xcb26('0x17')]?_0x58092b['options']['include']?_[_0xcb26('0x1b')](_0x58092b[_0xcb26('0x17')]['include'],function(_0x28de27){return{'model':db[_0x28de27[_0xcb26('0x1c')]],'as':_0x28de27['as'],'attributes':_0x28de27[_0xcb26('0x19')],'include':_0x28de27[_0xcb26('0x1d')]?_[_0xcb26('0x1b')](_0x28de27['include'],function(_0xe52c0b){return{'model':db[_0xe52c0b[_0xcb26('0x1c')]],'as':_0xe52c0b['as'],'attributes':_0xe52c0b[_0xcb26('0x19')],'include':_0xe52c0b['include']?_[_0xcb26('0x1b')](_0xe52c0b[_0xcb26('0x1d')],function(_0x428110){return{'model':db[_0x428110['model']],'as':_0x428110['as'],'attributes':_0x428110[_0xcb26('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcb26('0x1e')](function(_0xa1e198){logger[_0xcb26('0xc')](_0xcb26('0x1f'),_0x58092b);logger[_0xcb26('0xd')](_0xcb26('0x1f'),_0x58092b,JSON[_0xcb26('0xf')](_0xa1e198));_0x4bc893(_0xa1e198);})['catch'](function(_0x3444fc){logger[_0xcb26('0x10')](_0xcb26('0x1f'),_0x3444fc['message'],_0x58092b);_0x6e25eb(_0x2fa032['error'](0x1f4,_0x3444fc[_0xcb26('0x12')]));});});};exports[_0xcb26('0x20')]=function(_0x3e43a5){var _0x256af3=this;return new Promise(function(_0x21a205,_0x5f0ff0){return db[_0xcb26('0x15')][_0xcb26('0x21')]({'raw':_0x3e43a5['options']?_0x3e43a5[_0xcb26('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3e43a5[_0xcb26('0x17')]?_0x3e43a5[_0xcb26('0x17')][_0xcb26('0x18')]||null:null,'attributes':_0x3e43a5[_0xcb26('0x17')]?_0x3e43a5['options']['attributes']||null:null,'include':_0x3e43a5[_0xcb26('0x17')]?_0x3e43a5[_0xcb26('0x17')][_0xcb26('0x1d')]?_['map'](_0x3e43a5['options'][_0xcb26('0x1d')],function(_0x38ba12){return{'model':db[_0x38ba12[_0xcb26('0x1c')]],'as':_0x38ba12['as'],'attributes':_0x38ba12[_0xcb26('0x19')],'include':_0x38ba12['include']?_[_0xcb26('0x1b')](_0x38ba12[_0xcb26('0x1d')],function(_0x45fe9a){return{'model':db[_0x45fe9a[_0xcb26('0x1c')]],'as':_0x45fe9a['as'],'attributes':_0x45fe9a[_0xcb26('0x19')],'include':_0x45fe9a[_0xcb26('0x1d')]?_[_0xcb26('0x1b')](_0x45fe9a['include'],function(_0x5f408b){return{'model':db[_0x5f408b[_0xcb26('0x1c')]],'as':_0x5f408b['as'],'attributes':_0x5f408b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb26('0x1e')](function(_0x1a37d2){logger[_0xcb26('0xc')]('ShowDynamics365Account',_0x3e43a5);logger[_0xcb26('0xd')](_0xcb26('0x20'),_0x3e43a5,JSON[_0xcb26('0xf')](_0x1a37d2));_0x21a205(_0x1a37d2);})['catch'](function(_0x11a222){logger['error'](_0xcb26('0x20'),_0x11a222[_0xcb26('0x12')],_0x3e43a5);_0x5f0ff0(_0x256af3['error'](0x1f4,_0x11a222[_0xcb26('0x12')]));});});}; \ No newline at end of file +var _0xe69f=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','map','ShowDynamics365Account','Dynamics365Account','find','model','lodash','util'];(function(_0x53fbdd,_0x3de7ed){var _0x5d1ee5=function(_0x382fa2){while(--_0x382fa2){_0x53fbdd['push'](_0x53fbdd['shift']());}};_0x5d1ee5(++_0x3de7ed);}(_0xe69f,0x67));var _0xfe69=function(_0x366951,_0x17490b){_0x366951=_0x366951-0x0;var _0x57c837=_0xe69f[_0x366951];return _0x57c837;};'use strict';var _=require(_0xfe69('0x0'));var util=require(_0xfe69('0x1'));var moment=require(_0xfe69('0x2'));var BPromise=require(_0xfe69('0x3'));var rs=require(_0xfe69('0x4'));var fs=require('fs');var Redis=require(_0xfe69('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe69('0x6'));var logger=require('../../config/logger')(_0xfe69('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfe69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb3b6a4,_0x1f9eda,_0x515f42){return new BPromise(function(_0x2dc12c,_0x3ff876){return client[_0xfe69('0x9')](_0xb3b6a4,_0x515f42)[_0xfe69('0xa')](function(_0x37fde9){logger[_0xfe69('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x1f9eda,_0xfe69('0xc'));logger[_0xfe69('0xd')](_0xfe69('0xe'),_0x1f9eda,_0xfe69('0xc'),JSON[_0xfe69('0xf')](_0x37fde9));if(_0x37fde9[_0xfe69('0x10')]){if(_0x37fde9[_0xfe69('0x10')][_0xfe69('0x11')]===0x1f4){logger['error'](_0xfe69('0x12'),_0x1f9eda,_0x37fde9[_0xfe69('0x10')][_0xfe69('0x13')]);return _0x3ff876(_0x37fde9[_0xfe69('0x10')][_0xfe69('0x13')]);}logger[_0xfe69('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x1f9eda,_0x37fde9[_0xfe69('0x10')][_0xfe69('0x13')]);return _0x2dc12c(_0x37fde9['error'][_0xfe69('0x13')]);}else{logger['info'](_0xfe69('0x12'),_0x1f9eda,_0xfe69('0xc'));_0x2dc12c(_0x37fde9[_0xfe69('0x14')][_0xfe69('0x13')]);}})[_0xfe69('0x15')](function(_0x18f2c0){logger[_0xfe69('0x10')](_0xfe69('0x12'),_0x1f9eda,_0x18f2c0);_0x3ff876(_0x18f2c0);});});}exports[_0xfe69('0x16')]=function(_0x5882c4){var _0x320495=this;return new Promise(function(_0x4cee92,_0x107aef){return db['Dynamics365Account'][_0xfe69('0x17')]({'raw':_0x5882c4[_0xfe69('0x18')]?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x19')]===undefined?!![]:![]:!![],'where':_0x5882c4[_0xfe69('0x18')]?_0x5882c4['options'][_0xfe69('0x1a')]||null:null,'attributes':_0x5882c4[_0xfe69('0x18')]?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1b')]||null:null,'limit':_0x5882c4['options']?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1c')]||null:null,'include':_0x5882c4[_0xfe69('0x18')]?_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1d')]?_['map'](_0x5882c4[_0xfe69('0x18')][_0xfe69('0x1d')],function(_0x51d4d9){return{'model':db[_0x51d4d9['model']],'as':_0x51d4d9['as'],'attributes':_0x51d4d9[_0xfe69('0x1b')],'include':_0x51d4d9['include']?_['map'](_0x51d4d9['include'],function(_0x339109){return{'model':db[_0x339109['model']],'as':_0x339109['as'],'attributes':_0x339109[_0xfe69('0x1b')],'include':_0x339109[_0xfe69('0x1d')]?_[_0xfe69('0x1e')](_0x339109['include'],function(_0x2b85e8){return{'model':db[_0x2b85e8['model']],'as':_0x2b85e8['as'],'attributes':_0x2b85e8[_0xfe69('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfe69('0xa')](function(_0x5c733f){logger[_0xfe69('0xb')]('GetDynamics365Account',_0x5882c4);logger['debug'](_0xfe69('0x16'),_0x5882c4,JSON[_0xfe69('0xf')](_0x5c733f));_0x4cee92(_0x5c733f);})['catch'](function(_0x9df76c){logger[_0xfe69('0x10')](_0xfe69('0x16'),_0x9df76c['message'],_0x5882c4);_0x107aef(_0x320495['error'](0x1f4,_0x9df76c[_0xfe69('0x13')]));});});};exports[_0xfe69('0x1f')]=function(_0x500d38){var _0x15ccdf=this;return new Promise(function(_0xe3491b,_0x373881){return db[_0xfe69('0x20')][_0xfe69('0x21')]({'raw':_0x500d38[_0xfe69('0x18')]?_0x500d38[_0xfe69('0x18')][_0xfe69('0x19')]===undefined?!![]:![]:!![],'where':_0x500d38[_0xfe69('0x18')]?_0x500d38[_0xfe69('0x18')][_0xfe69('0x1a')]||null:null,'attributes':_0x500d38[_0xfe69('0x18')]?_0x500d38[_0xfe69('0x18')][_0xfe69('0x1b')]||null:null,'include':_0x500d38[_0xfe69('0x18')]?_0x500d38['options'][_0xfe69('0x1d')]?_[_0xfe69('0x1e')](_0x500d38[_0xfe69('0x18')][_0xfe69('0x1d')],function(_0x5c0539){return{'model':db[_0x5c0539[_0xfe69('0x22')]],'as':_0x5c0539['as'],'attributes':_0x5c0539[_0xfe69('0x1b')],'include':_0x5c0539[_0xfe69('0x1d')]?_['map'](_0x5c0539[_0xfe69('0x1d')],function(_0x225ed3){return{'model':db[_0x225ed3[_0xfe69('0x22')]],'as':_0x225ed3['as'],'attributes':_0x225ed3[_0xfe69('0x1b')],'include':_0x225ed3[_0xfe69('0x1d')]?_[_0xfe69('0x1e')](_0x225ed3[_0xfe69('0x1d')],function(_0x466307){return{'model':db[_0x466307[_0xfe69('0x22')]],'as':_0x466307['as'],'attributes':_0x466307[_0xfe69('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e883d){logger[_0xfe69('0xb')]('ShowDynamics365Account',_0x500d38);logger[_0xfe69('0xd')]('ShowDynamics365Account',_0x500d38,JSON[_0xfe69('0xf')](_0x5e883d));_0xe3491b(_0x5e883d);})[_0xfe69('0x15')](function(_0x3ddd69){logger[_0xfe69('0x10')](_0xfe69('0x1f'),_0x3ddd69['message'],_0x500d38);_0x373881(_0x15ccdf[_0xfe69('0x10')](0x1f4,_0x3ddd69['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0d54d9a..1f8b9bd 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 _0x9c4a=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x9c4a,0x1dd));var _0xa9c4=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x9c4a[_0x178856];return _0x3c7fe7;};'use strict';var multer=require('multer');var util=require(_0xa9c4('0x0'));var path=require('path');var timeout=require(_0xa9c4('0x1'));var express=require(_0xa9c4('0x2'));var router=express['Router']();var fs_extra=require(_0xa9c4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c4('0x4'));var config=require(_0xa9c4('0x5'));var controller=require(_0xa9c4('0x6'));router[_0xa9c4('0x7')]('/',auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x9')]);router[_0xa9c4('0x7')](_0xa9c4('0xa'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0xb')]);router[_0xa9c4('0x7')](_0xa9c4('0xc'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0xd')]);router[_0xa9c4('0x7')](_0xa9c4('0xe'),auth[_0xa9c4('0x8')](),controller['getSubjects']);router[_0xa9c4('0x7')](_0xa9c4('0xf'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x10')]);router[_0xa9c4('0x11')]('/',auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x12')]);router['put'](_0xa9c4('0xa'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x13')]);router[_0xa9c4('0x14')](_0xa9c4('0xa'),auth[_0xa9c4('0x8')](),controller['destroy']);module[_0xa9c4('0x15')]=router; \ No newline at end of file +var _0x8bc8=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x58ec63,_0x14c361){var _0x1cc1a2=function(_0x55c7e3){while(--_0x55c7e3){_0x58ec63['push'](_0x58ec63['shift']());}};_0x1cc1a2(++_0x14c361);}(_0x8bc8,0x1c0));var _0x88bc=function(_0x13409a,_0x8f949e){_0x13409a=_0x13409a-0x0;var _0x12815b=_0x8bc8[_0x13409a];return _0x12815b;};'use strict';var multer=require('multer');var util=require(_0x88bc('0x0'));var path=require(_0x88bc('0x1'));var timeout=require(_0x88bc('0x2'));var express=require(_0x88bc('0x3'));var router=express[_0x88bc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x88bc('0x5'));var interaction=require(_0x88bc('0x6'));var config=require(_0x88bc('0x7'));var controller=require(_0x88bc('0x8'));router[_0x88bc('0x9')]('/',auth[_0x88bc('0xa')](),controller[_0x88bc('0xb')]);router['get']('/:id',auth[_0x88bc('0xa')](),controller[_0x88bc('0xc')]);router[_0x88bc('0x9')]('/:id/fields',auth[_0x88bc('0xa')](),controller[_0x88bc('0xd')]);router[_0x88bc('0x9')](_0x88bc('0xe'),auth[_0x88bc('0xa')](),controller[_0x88bc('0xf')]);router[_0x88bc('0x9')](_0x88bc('0x10'),auth['isAuthenticated'](),controller[_0x88bc('0x11')]);router['post']('/',auth[_0x88bc('0xa')](),controller['create']);router[_0x88bc('0x12')]('/:id',auth[_0x88bc('0xa')](),controller[_0x88bc('0x13')]);router[_0x88bc('0x14')](_0x88bc('0x15'),auth[_0x88bc('0xa')](),controller['destroy']);module[_0x88bc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 6dfe712..1d75a16 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 _0x05f8=['sequelize','STRING','ENUM','phonecall','incident','nothing','contact'];(function(_0x4ed47e,_0x45554a){var _0x332235=function(_0x55b8a4){while(--_0x55b8a4){_0x4ed47e['push'](_0x4ed47e['shift']());}};_0x332235(++_0x45554a);}(_0x05f8,0x1b2));var _0x805f=function(_0x492194,_0xf7c56f){_0x492194=_0x492194-0x0;var _0x555802=_0x05f8[_0x492194];return _0x555802;};'use strict';var Sequelize=require(_0x805f('0x0'));module['exports']={'name':{'type':Sequelize[_0x805f('0x1')]},'description':{'type':Sequelize[_0x805f('0x1')]},'ticketType':{'type':Sequelize[_0x805f('0x2')]('incident',_0x805f('0x3')),'defaultValue':_0x805f('0x4')},'moduleCreate':{'type':Sequelize[_0x805f('0x2')]('contact',_0x805f('0x5')),'defaultValue':_0x805f('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x8f2e=['exports','incident','phonecall','ENUM','contact','sequelize'];(function(_0x3a2650,_0x2cdddc){var _0x4482e6=function(_0x322125){while(--_0x322125){_0x3a2650['push'](_0x3a2650['shift']());}};_0x4482e6(++_0x2cdddc);}(_0x8f2e,0x1b5));var _0xe8f2=function(_0x59c7cc,_0xb4ca00){_0x59c7cc=_0x59c7cc-0x0;var _0x1dffb7=_0x8f2e[_0x59c7cc];return _0x1dffb7;};'use strict';var Sequelize=require(_0xe8f2('0x0'));module[_0xe8f2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe8f2('0x2'),_0xe8f2('0x3')),'defaultValue':_0xe8f2('0x2')},'moduleCreate':{'type':Sequelize[_0xe8f2('0x4')](_0xe8f2('0x5'),'nothing'),'defaultValue':_0xe8f2('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2fc02e8..46bfad1 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 _0x40b2=['eml-format','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','catch','show','params','create','body','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions'];(function(_0x1644cc,_0xdba138){var _0x404aa9=function(_0x344f19){while(--_0x344f19){_0x1644cc['push'](_0x1644cc['shift']());}};_0x404aa9(++_0xdba138);}(_0x40b2,0x18b));var _0x240b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x40b2[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x240b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x240b('0x1'));var moment=require(_0x240b('0x2'));var BPromise=require(_0x240b('0x3'));var Mustache=require(_0x240b('0x4'));var util=require(_0x240b('0x5'));var path=require(_0x240b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x240b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x240b('0x8'));var squel=require(_0x240b('0x9'));var crypto=require('crypto');var jsforce=require(_0x240b('0xa'));var deskjs=require(_0x240b('0xb'));var toCsv=require(_0x240b('0xc'));var querystring=require(_0x240b('0xd'));var Papa=require(_0x240b('0xe'));var Redis=require(_0x240b('0xf'));var authService=require(_0x240b('0x10'));var qs=require(_0x240b('0x11'));var as=require(_0x240b('0x12'));var hardwareService=require(_0x240b('0x13'));var logger=require('../../config/logger')(_0x240b('0x14'));var utils=require(_0x240b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x240b('0x16'))['db'];function respondWithStatusCode(_0x46da2c,_0x1c5c40){_0x1c5c40=_0x1c5c40||0xcc;return function(_0x176cb7){if(_0x176cb7){return _0x46da2c[_0x240b('0x17')](_0x1c5c40);}return _0x46da2c[_0x240b('0x18')](_0x1c5c40)['end']();};}function respondWithResult(_0x42f799,_0xa383ee){_0xa383ee=_0xa383ee||0xc8;return function(_0x1b023f){if(_0x1b023f){return _0x42f799['status'](_0xa383ee)[_0x240b('0x19')](_0x1b023f);}};}function respondWithFilteredResult(_0x3aef1d,_0x580128){return function(_0x29f135){if(_0x29f135){var _0x3e745b=typeof _0x580128[_0x240b('0x1a')]===_0x240b('0x1b')&&typeof _0x580128[_0x240b('0x1c')]===_0x240b('0x1b');var _0x3913aa=_0x29f135['count'];var _0x4bd9e5=_0x3e745b?0x0:_0x580128['offset'];var _0x53ef41=_0x3e745b?_0x29f135[_0x240b('0x1d')]:_0x580128['offset']+_0x580128['limit'];var _0x3a7429;if(_0x53ef41>=_0x3913aa){_0x53ef41=_0x3913aa;_0x3a7429=0xc8;}else{_0x3a7429=0xce;}_0x3aef1d[_0x240b('0x18')](_0x3a7429);return _0x3aef1d[_0x240b('0x1e')]('Content-Range',_0x4bd9e5+'-'+_0x53ef41+'/'+_0x3913aa)[_0x240b('0x19')](_0x29f135);}return null;};}function patchUpdates(_0x31c48c){return function(_0x5309e9){try{jsonpatch[_0x240b('0x1f')](_0x5309e9,_0x31c48c,!![]);}catch(_0x3f5db4){return BPromise[_0x240b('0x20')](_0x3f5db4);}return _0x5309e9['save']();};}function saveUpdates(_0x536321,_0x2e2366){return function(_0x2fa389){if(_0x2fa389){return _0x2fa389['update'](_0x536321)[_0x240b('0x21')](function(_0x141055){return _0x141055;});}return null;};}function removeEntity(_0x32d6a7,_0x3024f1){return function(_0x3bae65){if(_0x3bae65){return _0x3bae65[_0x240b('0x22')]()[_0x240b('0x21')](function(){_0x32d6a7['status'](0xcc)[_0x240b('0x23')]();});}};}function handleEntityNotFound(_0x33309f,_0x60ba5e){return function(_0x3122f7){if(!_0x3122f7){_0x33309f[_0x240b('0x17')](0x194);}return _0x3122f7;};}function handleError(_0x25db89,_0x13868e){_0x13868e=_0x13868e||0x1f4;return function(_0x14376a){logger[_0x240b('0x24')](_0x14376a[_0x240b('0x25')]);if(_0x14376a[_0x240b('0x26')]){delete _0x14376a[_0x240b('0x26')];}_0x25db89[_0x240b('0x18')](_0x13868e)[_0x240b('0x27')](_0x14376a);};}exports[_0x240b('0x28')]=function(_0x502041,_0x40b7fb){var _0x17f234={},_0x581238={},_0x1870d0={'count':0x0,'rows':[]};var _0x45cb5c=_[_0x240b('0x29')](db['Dynamics365Configuration'][_0x240b('0x2a')],function(_0xae35de){return{'name':_0xae35de[_0x240b('0x2b')],'type':_0xae35de[_0x240b('0x2c')][_0x240b('0x2d')]};});_0x581238[_0x240b('0x2e')]=_[_0x240b('0x29')](_0x45cb5c,_0x240b('0x26'));_0x581238[_0x240b('0x2f')]=_[_0x240b('0x30')](_0x502041[_0x240b('0x2f')]);_0x581238['filters']=_[_0x240b('0x31')](_0x581238[_0x240b('0x2e')],_0x581238['query']);_0x17f234[_0x240b('0x32')]=_[_0x240b('0x31')](_0x581238[_0x240b('0x2e')],qs[_0x240b('0x33')](_0x502041[_0x240b('0x2f')][_0x240b('0x33')]));_0x17f234[_0x240b('0x32')]=_0x17f234['attributes'][_0x240b('0x34')]?_0x17f234[_0x240b('0x32')]:_0x581238[_0x240b('0x2e')];if(!_0x502041['query'][_0x240b('0x35')](_0x240b('0x36'))){_0x17f234['limit']=qs[_0x240b('0x1c')](_0x502041[_0x240b('0x2f')]['limit']);_0x17f234[_0x240b('0x1a')]=qs['offset'](_0x502041['query']['offset']);}_0x17f234[_0x240b('0x37')]=qs['sort'](_0x502041[_0x240b('0x2f')][_0x240b('0x38')]);_0x17f234['where']=qs[_0x240b('0x39')](_[_0x240b('0x3a')](_0x502041[_0x240b('0x2f')],_0x581238[_0x240b('0x39')]),_0x45cb5c);if(_0x502041[_0x240b('0x2f')][_0x240b('0x3b')]){_0x17f234[_0x240b('0x3c')]=_[_0x240b('0x3d')](_0x17f234[_0x240b('0x3c')],{'$or':_[_0x240b('0x29')](_0x45cb5c,function(_0x3a3f7d){if(_0x3a3f7d[_0x240b('0x2c')]!==_0x240b('0x3e')){var _0x2fbf55={};_0x2fbf55[_0x3a3f7d['name']]={'$like':'%'+_0x502041[_0x240b('0x2f')][_0x240b('0x3b')]+'%'};return _0x2fbf55;}})});}_0x17f234=_[_0x240b('0x3d')]({},_0x17f234,_0x502041[_0x240b('0x3f')]);var _0x1cc2fa={'where':_0x17f234['where']};return db[_0x240b('0x40')][_0x240b('0x1d')](_0x1cc2fa)['then'](function(_0x2c19c4){_0x1870d0[_0x240b('0x1d')]=_0x2c19c4;if(_0x502041[_0x240b('0x2f')][_0x240b('0x41')]){_0x17f234[_0x240b('0x42')]=[{'all':!![]}];}return db[_0x240b('0x40')][_0x240b('0x43')](_0x17f234);})[_0x240b('0x21')](function(_0x41ff7c){_0x1870d0['rows']=_0x41ff7c;return _0x1870d0;})['then'](respondWithFilteredResult(_0x40b7fb,_0x17f234))[_0x240b('0x44')](handleError(_0x40b7fb,null));};exports[_0x240b('0x45')]=function(_0x433e26,_0x540f43){var _0x283d18={'raw':![],'where':{'id':_0x433e26[_0x240b('0x46')]['id']}},_0x749fde={};_0x749fde['model']=_[_0x240b('0x30')](db[_0x240b('0x40')]['rawAttributes']);_0x749fde[_0x240b('0x2f')]=_['keys'](_0x433e26[_0x240b('0x2f')]);_0x749fde['filters']=_[_0x240b('0x31')](_0x749fde[_0x240b('0x2e')],_0x749fde[_0x240b('0x2f')]);_0x283d18['attributes']=_[_0x240b('0x31')](_0x749fde['model'],qs['fields'](_0x433e26[_0x240b('0x2f')][_0x240b('0x33')]));_0x283d18['attributes']=_0x283d18[_0x240b('0x32')][_0x240b('0x34')]?_0x283d18[_0x240b('0x32')]:_0x749fde['model'];if(_0x433e26['query']['includeAll']){_0x283d18[_0x240b('0x42')]=[{'all':!![]}];}_0x283d18=_['merge']({},_0x283d18,_0x433e26['options']);return db[_0x240b('0x40')]['find'](_0x283d18)[_0x240b('0x21')](handleEntityNotFound(_0x540f43,null))[_0x240b('0x21')](respondWithResult(_0x540f43,null))[_0x240b('0x44')](handleError(_0x540f43,null));};exports[_0x240b('0x47')]=function(_0x361c64,_0x48b8cc){return db[_0x240b('0x40')][_0x240b('0x47')](_0x361c64['body'],{})[_0x240b('0x21')](respondWithResult(_0x48b8cc,0xc9))[_0x240b('0x44')](handleError(_0x48b8cc,null));};exports['update']=function(_0x5b082c,_0x47661f){if(_0x5b082c[_0x240b('0x48')]['id']){delete _0x5b082c[_0x240b('0x48')]['id'];}return db[_0x240b('0x40')][_0x240b('0x49')]({'where':{'id':_0x5b082c[_0x240b('0x46')]['id']}})[_0x240b('0x21')](handleEntityNotFound(_0x47661f,null))[_0x240b('0x21')](saveUpdates(_0x5b082c['body'],null))[_0x240b('0x21')](respondWithResult(_0x47661f,null))[_0x240b('0x44')](handleError(_0x47661f,null));};exports[_0x240b('0x22')]=function(_0x2d2389,_0x13d94b){return db['Dynamics365Configuration'][_0x240b('0x49')]({'where':{'id':_0x2d2389[_0x240b('0x46')]['id']}})[_0x240b('0x21')](handleEntityNotFound(_0x13d94b,null))[_0x240b('0x21')](removeEntity(_0x13d94b,null))[_0x240b('0x44')](handleError(_0x13d94b,null));};exports[_0x240b('0x4a')]=function(_0x1f8b31,_0xf1171,_0x48d21f){var _0x259065={};var _0x5c4c59={};var _0x25faad;var _0x2d92e0;return db[_0x240b('0x40')][_0x240b('0x4b')]({'where':{'id':_0x1f8b31['params']['id']}})['then'](handleEntityNotFound(_0xf1171,null))[_0x240b('0x21')](function(_0x4a550e){if(_0x4a550e){_0x25faad=_0x4a550e;_0x5c4c59[_0x240b('0x2e')]=_[_0x240b('0x30')](db[_0x240b('0x4c')][_0x240b('0x2a')]);_0x5c4c59[_0x240b('0x2f')]=_[_0x240b('0x30')](_0x1f8b31['query']);_0x5c4c59[_0x240b('0x39')]=_[_0x240b('0x31')](_0x5c4c59[_0x240b('0x2e')],_0x5c4c59[_0x240b('0x2f')]);_0x259065['attributes']=_[_0x240b('0x31')](_0x5c4c59[_0x240b('0x2e')],qs['fields'](_0x1f8b31[_0x240b('0x2f')][_0x240b('0x33')]));_0x259065[_0x240b('0x32')]=_0x259065['attributes']['length']?_0x259065[_0x240b('0x32')]:_0x5c4c59['model'];_0x259065['order']=qs[_0x240b('0x38')](_0x1f8b31['query'][_0x240b('0x38')]);_0x259065['where']=qs[_0x240b('0x39')](_['pick'](_0x1f8b31[_0x240b('0x2f')],_0x5c4c59[_0x240b('0x39')]));if(_0x1f8b31['query'][_0x240b('0x3b')]){_0x259065[_0x240b('0x3c')]=_[_0x240b('0x3d')](_0x259065[_0x240b('0x3c')],{'$or':_[_0x240b('0x29')](_0x259065[_0x240b('0x32')],function(_0x4316de){var _0x4c0044={};_0x4c0044[_0x4316de]={'$like':'%'+_0x1f8b31[_0x240b('0x2f')][_0x240b('0x3b')]+'%'};return _0x4c0044;})});}_0x259065=_[_0x240b('0x3d')]({},_0x259065,_0x1f8b31[_0x240b('0x3f')]);return _0x25faad[_0x240b('0x4a')](_0x259065);}})[_0x240b('0x21')](function(_0x32e4b9){if(_0x32e4b9){_0x2d92e0=_0x32e4b9['length'];if(!_0x1f8b31['query'][_0x240b('0x35')](_0x240b('0x36'))){_0x259065[_0x240b('0x1c')]=qs[_0x240b('0x1c')](_0x1f8b31[_0x240b('0x2f')][_0x240b('0x1c')]);_0x259065[_0x240b('0x1a')]=qs[_0x240b('0x1a')](_0x1f8b31[_0x240b('0x2f')][_0x240b('0x1a')]);}return _0x25faad[_0x240b('0x4a')](_0x259065);}})[_0x240b('0x21')](function(_0x11a341){if(_0x11a341){return _0x11a341?{'count':_0x2d92e0,'rows':_0x11a341}:null;}})[_0x240b('0x21')](respondWithResult(_0xf1171,null))[_0x240b('0x44')](handleError(_0xf1171,null));};exports[_0x240b('0x4d')]=function(_0x25521d,_0x2576a4,_0x50170d){var _0x77846e={};var _0x3f0854={};var _0x589694;var _0x1c7867;return db['Dynamics365Configuration'][_0x240b('0x4b')]({'where':{'id':_0x25521d['params']['id']}})[_0x240b('0x21')](handleEntityNotFound(_0x2576a4,null))[_0x240b('0x21')](function(_0x18d85d){if(_0x18d85d){_0x589694=_0x18d85d;_0x3f0854['model']=_[_0x240b('0x30')](db[_0x240b('0x4c')]['rawAttributes']);_0x3f0854[_0x240b('0x2f')]=_[_0x240b('0x30')](_0x25521d[_0x240b('0x2f')]);_0x3f0854['filters']=_[_0x240b('0x31')](_0x3f0854[_0x240b('0x2e')],_0x3f0854[_0x240b('0x2f')]);_0x77846e[_0x240b('0x32')]=_[_0x240b('0x31')](_0x3f0854[_0x240b('0x2e')],qs[_0x240b('0x33')](_0x25521d[_0x240b('0x2f')][_0x240b('0x33')]));_0x77846e[_0x240b('0x32')]=_0x77846e[_0x240b('0x32')]['length']?_0x77846e[_0x240b('0x32')]:_0x3f0854[_0x240b('0x2e')];_0x77846e['order']=qs[_0x240b('0x38')](_0x25521d['query'][_0x240b('0x38')]);_0x77846e[_0x240b('0x3c')]=qs['filters'](_[_0x240b('0x3a')](_0x25521d[_0x240b('0x2f')],_0x3f0854['filters']));if(_0x25521d['query'][_0x240b('0x3b')]){_0x77846e[_0x240b('0x3c')]=_[_0x240b('0x3d')](_0x77846e[_0x240b('0x3c')],{'$or':_['map'](_0x77846e[_0x240b('0x32')],function(_0x505dbf){var _0x57f537={};_0x57f537[_0x505dbf]={'$like':'%'+_0x25521d[_0x240b('0x2f')][_0x240b('0x3b')]+'%'};return _0x57f537;})});}_0x77846e=_[_0x240b('0x3d')]({},_0x77846e,_0x25521d[_0x240b('0x3f')]);return _0x589694['getSubjects'](_0x77846e);}})[_0x240b('0x21')](function(_0x1e9853){if(_0x1e9853){_0x1c7867=_0x1e9853[_0x240b('0x34')];if(!_0x25521d[_0x240b('0x2f')][_0x240b('0x35')](_0x240b('0x36'))){_0x77846e[_0x240b('0x1c')]=qs[_0x240b('0x1c')](_0x25521d[_0x240b('0x2f')][_0x240b('0x1c')]);_0x77846e[_0x240b('0x1a')]=qs[_0x240b('0x1a')](_0x25521d[_0x240b('0x2f')][_0x240b('0x1a')]);}return _0x589694['getSubjects'](_0x77846e);}})[_0x240b('0x21')](function(_0x3e6965){if(_0x3e6965){return _0x3e6965?{'count':_0x1c7867,'rows':_0x3e6965}:null;}})['then'](respondWithResult(_0x2576a4,null))[_0x240b('0x44')](handleError(_0x2576a4,null));};exports[_0x240b('0x4e')]=function(_0xde3229,_0x5dc6eb,_0x3e608c){var _0x35c040={};var _0x5c786b={};var _0x139e72;var _0x2b23dd;return db[_0x240b('0x40')][_0x240b('0x4b')]({'where':{'id':_0xde3229[_0x240b('0x46')]['id']}})[_0x240b('0x21')](handleEntityNotFound(_0x5dc6eb,null))[_0x240b('0x21')](function(_0xc26379){if(_0xc26379){_0x139e72=_0xc26379;_0x5c786b['model']=_[_0x240b('0x30')](db[_0x240b('0x4c')][_0x240b('0x2a')]);_0x5c786b[_0x240b('0x2f')]=_[_0x240b('0x30')](_0xde3229[_0x240b('0x2f')]);_0x5c786b['filters']=_['intersection'](_0x5c786b['model'],_0x5c786b['query']);_0x35c040['attributes']=_[_0x240b('0x31')](_0x5c786b[_0x240b('0x2e')],qs[_0x240b('0x33')](_0xde3229[_0x240b('0x2f')][_0x240b('0x33')]));_0x35c040['attributes']=_0x35c040[_0x240b('0x32')]['length']?_0x35c040[_0x240b('0x32')]:_0x5c786b[_0x240b('0x2e')];_0x35c040[_0x240b('0x37')]=qs[_0x240b('0x38')](_0xde3229[_0x240b('0x2f')][_0x240b('0x38')]);_0x35c040[_0x240b('0x3c')]=qs[_0x240b('0x39')](_[_0x240b('0x3a')](_0xde3229[_0x240b('0x2f')],_0x5c786b[_0x240b('0x39')]));if(_0xde3229[_0x240b('0x2f')][_0x240b('0x3b')]){_0x35c040[_0x240b('0x3c')]=_[_0x240b('0x3d')](_0x35c040[_0x240b('0x3c')],{'$or':_['map'](_0x35c040['attributes'],function(_0x479aae){var _0x5eed2c={};_0x5eed2c[_0x479aae]={'$like':'%'+_0xde3229[_0x240b('0x2f')][_0x240b('0x3b')]+'%'};return _0x5eed2c;})});}_0x35c040=_[_0x240b('0x3d')]({},_0x35c040,_0xde3229['options']);return _0x139e72[_0x240b('0x4e')](_0x35c040);}})['then'](function(_0x204362){if(_0x204362){_0x2b23dd=_0x204362[_0x240b('0x34')];if(!_0xde3229[_0x240b('0x2f')]['hasOwnProperty'](_0x240b('0x36'))){_0x35c040[_0x240b('0x1c')]=qs['limit'](_0xde3229[_0x240b('0x2f')]['limit']);_0x35c040[_0x240b('0x1a')]=qs[_0x240b('0x1a')](_0xde3229[_0x240b('0x2f')][_0x240b('0x1a')]);}return _0x139e72[_0x240b('0x4e')](_0x35c040);}})['then'](function(_0x4bd1aa){if(_0x4bd1aa){return _0x4bd1aa?{'count':_0x2b23dd,'rows':_0x4bd1aa}:null;}})[_0x240b('0x21')](respondWithResult(_0x5dc6eb,null))[_0x240b('0x44')](handleError(_0x5dc6eb,null));}; \ No newline at end of file +var _0x28dd=['findOne','merge','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','map','Dynamics365Configuration','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','getFields'];(function(_0x26e08d,_0xea5d00){var _0x3dab09=function(_0x434890){while(--_0x434890){_0x26e08d['push'](_0x26e08d['shift']());}};_0x3dab09(++_0xea5d00);}(_0x28dd,0x144));var _0xd28d=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x28dd[_0x326e79];return _0x37eb89;};'use strict';var emlformat=require(_0xd28d('0x0'));var rimraf=require(_0xd28d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd28d('0x2'));var rp=require('request-promise');var moment=require(_0xd28d('0x3'));var BPromise=require(_0xd28d('0x4'));var Mustache=require(_0xd28d('0x5'));var util=require(_0xd28d('0x6'));var path=require(_0xd28d('0x7'));var sox=require('sox');var csv=require(_0xd28d('0x8'));var ejs=require(_0xd28d('0x9'));var fs=require('fs');var fs_extra=require(_0xd28d('0xa'));var _=require('lodash');var squel=require(_0xd28d('0xb'));var crypto=require(_0xd28d('0xc'));var jsforce=require(_0xd28d('0xd'));var deskjs=require(_0xd28d('0xe'));var toCsv=require(_0xd28d('0x8'));var querystring=require(_0xd28d('0xf'));var Papa=require(_0xd28d('0x10'));var Redis=require(_0xd28d('0x11'));var authService=require(_0xd28d('0x12'));var qs=require(_0xd28d('0x13'));var as=require(_0xd28d('0x14'));var hardwareService=require(_0xd28d('0x15'));var logger=require(_0xd28d('0x16'))('api');var utils=require(_0xd28d('0x17'));var config=require(_0xd28d('0x18'));var licenseUtil=require(_0xd28d('0x19'));var db=require(_0xd28d('0x1a'))['db'];function respondWithStatusCode(_0x280ce7,_0x264092){_0x264092=_0x264092||0xcc;return function(_0x5536ee){if(_0x5536ee){return _0x280ce7[_0xd28d('0x1b')](_0x264092);}return _0x280ce7['status'](_0x264092)[_0xd28d('0x1c')]();};}function respondWithResult(_0xb0cd9,_0xa3a727){_0xa3a727=_0xa3a727||0xc8;return function(_0x22ddde){if(_0x22ddde){return _0xb0cd9[_0xd28d('0x1d')](_0xa3a727)[_0xd28d('0x1e')](_0x22ddde);}};}function respondWithFilteredResult(_0x1697a7,_0x866ac8){return function(_0x698da4){if(_0x698da4){var _0x4b6cf8=typeof _0x866ac8[_0xd28d('0x1f')]===_0xd28d('0x20')&&typeof _0x866ac8[_0xd28d('0x21')]===_0xd28d('0x20');var _0x40392e=_0x698da4[_0xd28d('0x22')];var _0xc6c514=_0x4b6cf8?0x0:_0x866ac8[_0xd28d('0x1f')];var _0x268334=_0x4b6cf8?_0x698da4[_0xd28d('0x22')]:_0x866ac8[_0xd28d('0x1f')]+_0x866ac8[_0xd28d('0x21')];var _0x3b0e32;if(_0x268334>=_0x40392e){_0x268334=_0x40392e;_0x3b0e32=0xc8;}else{_0x3b0e32=0xce;}_0x1697a7[_0xd28d('0x1d')](_0x3b0e32);return _0x1697a7[_0xd28d('0x23')](_0xd28d('0x24'),_0xc6c514+'-'+_0x268334+'/'+_0x40392e)[_0xd28d('0x1e')](_0x698da4);}return null;};}function patchUpdates(_0x4cc90a){return function(_0x391a7d){try{jsonpatch[_0xd28d('0x25')](_0x391a7d,_0x4cc90a,!![]);}catch(_0x18935d){return BPromise[_0xd28d('0x26')](_0x18935d);}return _0x391a7d[_0xd28d('0x27')]();};}function saveUpdates(_0xac5027,_0x37e186){return function(_0xa27039){if(_0xa27039){return _0xa27039[_0xd28d('0x28')](_0xac5027)['then'](function(_0xc61c41){return _0xc61c41;});}return null;};}function removeEntity(_0x5d1397,_0x3bd634){return function(_0x242117){if(_0x242117){return _0x242117['destroy']()[_0xd28d('0x29')](function(){_0x5d1397['status'](0xcc)[_0xd28d('0x1c')]();});}};}function handleEntityNotFound(_0x3bf2e2,_0x390930){return function(_0x26ed73){if(!_0x26ed73){_0x3bf2e2[_0xd28d('0x1b')](0x194);}return _0x26ed73;};}function handleError(_0x39c953,_0x310a10){_0x310a10=_0x310a10||0x1f4;return function(_0x5e7e2d){logger['error'](_0x5e7e2d['stack']);if(_0x5e7e2d[_0xd28d('0x2a')]){delete _0x5e7e2d[_0xd28d('0x2a')];}_0x39c953['status'](_0x310a10)[_0xd28d('0x2b')](_0x5e7e2d);};}exports['index']=function(_0x2a9676,_0x250fd3){var _0x1145ed={},_0x221e7b={},_0x2ba32b={'count':0x0,'rows':[]};var _0x12aa01=_[_0xd28d('0x2c')](db[_0xd28d('0x2d')][_0xd28d('0x2e')],function(_0x4a125f){return{'name':_0x4a125f['fieldName'],'type':_0x4a125f[_0xd28d('0x2f')]['key']};});_0x221e7b['model']=_[_0xd28d('0x2c')](_0x12aa01,_0xd28d('0x2a'));_0x221e7b['query']=_['keys'](_0x2a9676[_0xd28d('0x30')]);_0x221e7b[_0xd28d('0x31')]=_['intersection'](_0x221e7b[_0xd28d('0x32')],_0x221e7b[_0xd28d('0x30')]);_0x1145ed[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x221e7b[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x2a9676[_0xd28d('0x30')]['fields']));_0x1145ed[_0xd28d('0x33')]=_0x1145ed[_0xd28d('0x33')][_0xd28d('0x36')]?_0x1145ed[_0xd28d('0x33')]:_0x221e7b[_0xd28d('0x32')];if(!_0x2a9676['query'][_0xd28d('0x37')](_0xd28d('0x38'))){_0x1145ed['limit']=qs[_0xd28d('0x21')](_0x2a9676[_0xd28d('0x30')][_0xd28d('0x21')]);_0x1145ed[_0xd28d('0x1f')]=qs[_0xd28d('0x1f')](_0x2a9676[_0xd28d('0x30')]['offset']);}_0x1145ed[_0xd28d('0x39')]=qs[_0xd28d('0x3a')](_0x2a9676[_0xd28d('0x30')][_0xd28d('0x3a')]);_0x1145ed[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_[_0xd28d('0x3c')](_0x2a9676[_0xd28d('0x30')],_0x221e7b[_0xd28d('0x31')]),_0x12aa01);if(_0x2a9676[_0xd28d('0x30')][_0xd28d('0x3d')]){_0x1145ed[_0xd28d('0x3b')]=_['merge'](_0x1145ed[_0xd28d('0x3b')],{'$or':_[_0xd28d('0x2c')](_0x12aa01,function(_0x46ccab){if(_0x46ccab[_0xd28d('0x2f')]!==_0xd28d('0x3e')){var _0x5bca71={};_0x5bca71[_0x46ccab[_0xd28d('0x2a')]]={'$like':'%'+_0x2a9676[_0xd28d('0x30')]['filter']+'%'};return _0x5bca71;}})});}_0x1145ed=_['merge']({},_0x1145ed,_0x2a9676[_0xd28d('0x3f')]);var _0x39841f={'where':_0x1145ed[_0xd28d('0x3b')]};return db[_0xd28d('0x2d')][_0xd28d('0x22')](_0x39841f)[_0xd28d('0x29')](function(_0x98071){_0x2ba32b['count']=_0x98071;if(_0x2a9676[_0xd28d('0x30')][_0xd28d('0x40')]){_0x1145ed['include']=[{'all':!![]}];}return db[_0xd28d('0x2d')][_0xd28d('0x41')](_0x1145ed);})['then'](function(_0x1be80d){_0x2ba32b[_0xd28d('0x42')]=_0x1be80d;return _0x2ba32b;})[_0xd28d('0x29')](respondWithFilteredResult(_0x250fd3,_0x1145ed))[_0xd28d('0x43')](handleError(_0x250fd3,null));};exports[_0xd28d('0x44')]=function(_0x4a6ac8,_0x4256f6){var _0x23be0b={'raw':![],'where':{'id':_0x4a6ac8[_0xd28d('0x45')]['id']}},_0x99653e={};_0x99653e[_0xd28d('0x32')]=_[_0xd28d('0x46')](db[_0xd28d('0x2d')][_0xd28d('0x2e')]);_0x99653e[_0xd28d('0x30')]=_['keys'](_0x4a6ac8['query']);_0x99653e[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x99653e[_0xd28d('0x32')],_0x99653e[_0xd28d('0x30')]);_0x23be0b[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x99653e[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x4a6ac8[_0xd28d('0x30')][_0xd28d('0x35')]));_0x23be0b[_0xd28d('0x33')]=_0x23be0b[_0xd28d('0x33')]['length']?_0x23be0b[_0xd28d('0x33')]:_0x99653e['model'];if(_0x4a6ac8['query'][_0xd28d('0x40')]){_0x23be0b[_0xd28d('0x47')]=[{'all':!![]}];}_0x23be0b=_['merge']({},_0x23be0b,_0x4a6ac8[_0xd28d('0x3f')]);return db[_0xd28d('0x2d')][_0xd28d('0x48')](_0x23be0b)[_0xd28d('0x29')](handleEntityNotFound(_0x4256f6,null))['then'](respondWithResult(_0x4256f6,null))[_0xd28d('0x43')](handleError(_0x4256f6,null));};exports[_0xd28d('0x49')]=function(_0x500ee4,_0x7f59f6){return db[_0xd28d('0x2d')]['create'](_0x500ee4['body'],{})[_0xd28d('0x29')](respondWithResult(_0x7f59f6,0xc9))[_0xd28d('0x43')](handleError(_0x7f59f6,null));};exports[_0xd28d('0x28')]=function(_0x20a98d,_0x3eb1af){if(_0x20a98d['body']['id']){delete _0x20a98d['body']['id'];}return db[_0xd28d('0x2d')][_0xd28d('0x48')]({'where':{'id':_0x20a98d['params']['id']}})['then'](handleEntityNotFound(_0x3eb1af,null))[_0xd28d('0x29')](saveUpdates(_0x20a98d[_0xd28d('0x4a')],null))[_0xd28d('0x29')](respondWithResult(_0x3eb1af,null))[_0xd28d('0x43')](handleError(_0x3eb1af,null));};exports['destroy']=function(_0x4090ce,_0x1f3a67){return db[_0xd28d('0x2d')][_0xd28d('0x48')]({'where':{'id':_0x4090ce['params']['id']}})[_0xd28d('0x29')](handleEntityNotFound(_0x1f3a67,null))['then'](removeEntity(_0x1f3a67,null))['catch'](handleError(_0x1f3a67,null));};exports[_0xd28d('0x4b')]=function(_0x4d4b0e,_0x45f41a,_0x2f4e27){var _0x28d6fd={};var _0x4b8a62={};var _0xee30dd;var _0x35fff9;return db[_0xd28d('0x2d')][_0xd28d('0x4c')]({'where':{'id':_0x4d4b0e[_0xd28d('0x45')]['id']}})['then'](handleEntityNotFound(_0x45f41a,null))[_0xd28d('0x29')](function(_0x4a7411){if(_0x4a7411){_0xee30dd=_0x4a7411;_0x4b8a62['model']=_[_0xd28d('0x46')](db['Dynamics365Field'][_0xd28d('0x2e')]);_0x4b8a62[_0xd28d('0x30')]=_[_0xd28d('0x46')](_0x4d4b0e[_0xd28d('0x30')]);_0x4b8a62[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x4b8a62['model'],_0x4b8a62[_0xd28d('0x30')]);_0x28d6fd[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x4b8a62[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x35')]));_0x28d6fd[_0xd28d('0x33')]=_0x28d6fd[_0xd28d('0x33')]['length']?_0x28d6fd[_0xd28d('0x33')]:_0x4b8a62[_0xd28d('0x32')];_0x28d6fd[_0xd28d('0x39')]=qs['sort'](_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x3a')]);_0x28d6fd[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_[_0xd28d('0x3c')](_0x4d4b0e[_0xd28d('0x30')],_0x4b8a62[_0xd28d('0x31')]));if(_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x3d')]){_0x28d6fd['where']=_[_0xd28d('0x4d')](_0x28d6fd['where'],{'$or':_[_0xd28d('0x2c')](_0x28d6fd[_0xd28d('0x33')],function(_0x50acd0){var _0x482950={};_0x482950[_0x50acd0]={'$like':'%'+_0x4d4b0e[_0xd28d('0x30')]['filter']+'%'};return _0x482950;})});}_0x28d6fd=_[_0xd28d('0x4d')]({},_0x28d6fd,_0x4d4b0e[_0xd28d('0x3f')]);return _0xee30dd[_0xd28d('0x4b')](_0x28d6fd);}})['then'](function(_0x5255f2){if(_0x5255f2){_0x35fff9=_0x5255f2[_0xd28d('0x36')];if(!_0x4d4b0e[_0xd28d('0x30')][_0xd28d('0x37')](_0xd28d('0x38'))){_0x28d6fd['limit']=qs['limit'](_0x4d4b0e['query'][_0xd28d('0x21')]);_0x28d6fd[_0xd28d('0x1f')]=qs[_0xd28d('0x1f')](_0x4d4b0e['query'][_0xd28d('0x1f')]);}return _0xee30dd[_0xd28d('0x4b')](_0x28d6fd);}})[_0xd28d('0x29')](function(_0x16d1cb){if(_0x16d1cb){return _0x16d1cb?{'count':_0x35fff9,'rows':_0x16d1cb}:null;}})['then'](respondWithResult(_0x45f41a,null))['catch'](handleError(_0x45f41a,null));};exports[_0xd28d('0x4e')]=function(_0x53e50b,_0x4b7327,_0x3b5530){var _0x347e99={};var _0x1ca36c={};var _0x373941;var _0x42d352;return db[_0xd28d('0x2d')][_0xd28d('0x4c')]({'where':{'id':_0x53e50b[_0xd28d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b7327,null))[_0xd28d('0x29')](function(_0x2735ee){if(_0x2735ee){_0x373941=_0x2735ee;_0x1ca36c[_0xd28d('0x32')]=_[_0xd28d('0x46')](db['Dynamics365Field'][_0xd28d('0x2e')]);_0x1ca36c[_0xd28d('0x30')]=_[_0xd28d('0x46')](_0x53e50b[_0xd28d('0x30')]);_0x1ca36c[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x1ca36c[_0xd28d('0x32')],_0x1ca36c['query']);_0x347e99[_0xd28d('0x33')]=_['intersection'](_0x1ca36c[_0xd28d('0x32')],qs['fields'](_0x53e50b[_0xd28d('0x30')][_0xd28d('0x35')]));_0x347e99[_0xd28d('0x33')]=_0x347e99[_0xd28d('0x33')][_0xd28d('0x36')]?_0x347e99[_0xd28d('0x33')]:_0x1ca36c[_0xd28d('0x32')];_0x347e99[_0xd28d('0x39')]=qs[_0xd28d('0x3a')](_0x53e50b[_0xd28d('0x30')]['sort']);_0x347e99[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_['pick'](_0x53e50b[_0xd28d('0x30')],_0x1ca36c[_0xd28d('0x31')]));if(_0x53e50b[_0xd28d('0x30')][_0xd28d('0x3d')]){_0x347e99['where']=_[_0xd28d('0x4d')](_0x347e99[_0xd28d('0x3b')],{'$or':_[_0xd28d('0x2c')](_0x347e99[_0xd28d('0x33')],function(_0x43e00f){var _0x3b6c70={};_0x3b6c70[_0x43e00f]={'$like':'%'+_0x53e50b[_0xd28d('0x30')]['filter']+'%'};return _0x3b6c70;})});}_0x347e99=_['merge']({},_0x347e99,_0x53e50b[_0xd28d('0x3f')]);return _0x373941['getSubjects'](_0x347e99);}})['then'](function(_0x1ee6a4){if(_0x1ee6a4){_0x42d352=_0x1ee6a4['length'];if(!_0x53e50b[_0xd28d('0x30')][_0xd28d('0x37')](_0xd28d('0x38'))){_0x347e99[_0xd28d('0x21')]=qs[_0xd28d('0x21')](_0x53e50b['query'][_0xd28d('0x21')]);_0x347e99['offset']=qs[_0xd28d('0x1f')](_0x53e50b[_0xd28d('0x30')][_0xd28d('0x1f')]);}return _0x373941[_0xd28d('0x4e')](_0x347e99);}})[_0xd28d('0x29')](function(_0x486732){if(_0x486732){return _0x486732?{'count':_0x42d352,'rows':_0x486732}:null;}})[_0xd28d('0x29')](respondWithResult(_0x4b7327,null))[_0xd28d('0x43')](handleError(_0x4b7327,null));};exports[_0xd28d('0x4f')]=function(_0x29b88d,_0x3bfc1d,_0x19bcec){var _0x2edeb7={};var _0x33d02={};var _0x1d2b03;var _0x2f9094;return db[_0xd28d('0x2d')][_0xd28d('0x4c')]({'where':{'id':_0x29b88d[_0xd28d('0x45')]['id']}})[_0xd28d('0x29')](handleEntityNotFound(_0x3bfc1d,null))[_0xd28d('0x29')](function(_0x5b79f9){if(_0x5b79f9){_0x1d2b03=_0x5b79f9;_0x33d02[_0xd28d('0x32')]=_[_0xd28d('0x46')](db['Dynamics365Field'][_0xd28d('0x2e')]);_0x33d02['query']=_['keys'](_0x29b88d[_0xd28d('0x30')]);_0x33d02[_0xd28d('0x31')]=_[_0xd28d('0x34')](_0x33d02[_0xd28d('0x32')],_0x33d02[_0xd28d('0x30')]);_0x2edeb7[_0xd28d('0x33')]=_[_0xd28d('0x34')](_0x33d02[_0xd28d('0x32')],qs[_0xd28d('0x35')](_0x29b88d[_0xd28d('0x30')][_0xd28d('0x35')]));_0x2edeb7[_0xd28d('0x33')]=_0x2edeb7[_0xd28d('0x33')][_0xd28d('0x36')]?_0x2edeb7['attributes']:_0x33d02[_0xd28d('0x32')];_0x2edeb7[_0xd28d('0x39')]=qs[_0xd28d('0x3a')](_0x29b88d['query'][_0xd28d('0x3a')]);_0x2edeb7[_0xd28d('0x3b')]=qs[_0xd28d('0x31')](_[_0xd28d('0x3c')](_0x29b88d[_0xd28d('0x30')],_0x33d02[_0xd28d('0x31')]));if(_0x29b88d['query'][_0xd28d('0x3d')]){_0x2edeb7['where']=_[_0xd28d('0x4d')](_0x2edeb7[_0xd28d('0x3b')],{'$or':_[_0xd28d('0x2c')](_0x2edeb7[_0xd28d('0x33')],function(_0x179103){var _0x328b72={};_0x328b72[_0x179103]={'$like':'%'+_0x29b88d['query'][_0xd28d('0x3d')]+'%'};return _0x328b72;})});}_0x2edeb7=_[_0xd28d('0x4d')]({},_0x2edeb7,_0x29b88d[_0xd28d('0x3f')]);return _0x1d2b03[_0xd28d('0x4f')](_0x2edeb7);}})[_0xd28d('0x29')](function(_0x1cc2b4){if(_0x1cc2b4){_0x2f9094=_0x1cc2b4[_0xd28d('0x36')];if(!_0x29b88d[_0xd28d('0x30')][_0xd28d('0x37')](_0xd28d('0x38'))){_0x2edeb7[_0xd28d('0x21')]=qs[_0xd28d('0x21')](_0x29b88d[_0xd28d('0x30')][_0xd28d('0x21')]);_0x2edeb7['offset']=qs[_0xd28d('0x1f')](_0x29b88d[_0xd28d('0x30')][_0xd28d('0x1f')]);}return _0x1d2b03[_0xd28d('0x4f')](_0x2edeb7);}})[_0xd28d('0x29')](function(_0x4b1712){if(_0x4b1712){return _0x4b1712?{'count':_0x2f9094,'rows':_0x4b1712}:null;}})['then'](respondWithResult(_0x3bfc1d,null))[_0xd28d('0x43')](handleError(_0x3bfc1d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e58429f..32fd62e 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x35e299,_0x160655){var _0x5dccc3=function(_0x45d3e6){while(--_0x45d3e6){_0x35e299['push'](_0x35e299['shift']());}};_0x5dccc3(++_0x160655);}(_0xb43b,0x1b2));var _0xbb43=function(_0x48b914,_0x1be413){_0x48b914=_0x48b914-0x0;var _0x434ee6=_0xb43b[_0x48b914];return _0x434ee6;};'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 +var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x3ae13d,_0x2cf7f9){var _0xf11147=function(_0x367b63){while(--_0x367b63){_0x3ae13d['push'](_0x3ae13d['shift']());}};_0xf11147(++_0x2cf7f9);}(_0xb821,0xa7));var _0x1b82=function(_0x43142c,_0xf069aa){_0x43142c=_0x43142c-0x0;var _0x192979=_0xb821[_0x43142c];return _0x192979;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d24e0ee..2228b2f 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 _0x741e=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3d39cb,_0x3aca5d){var _0x16e86c=function(_0x49f5c9){while(--_0x49f5c9){_0x3d39cb['push'](_0x3d39cb['shift']());}};_0x16e86c(++_0x3aca5d);}(_0x741e,0x9b));var _0xe741=function(_0x272ba7,_0x204649){_0x272ba7=_0x272ba7-0x0;var _0x39e4c2=_0x741e[_0x272ba7];return _0x39e4c2;};'use strict';var _=require(_0xe741('0x0'));var util=require('util');var moment=require(_0xe741('0x1'));var BPromise=require(_0xe741('0x2'));var rs=require(_0xe741('0x3'));var fs=require('fs');var Redis=require(_0xe741('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe741('0x5'));var logger=require(_0xe741('0x6'))(_0xe741('0x7'));var config=require(_0xe741('0x8'));var jayson=require(_0xe741('0x9'));var client=jayson['client'][_0xe741('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59f9bf,_0x35c3a1,_0x35667d){return new BPromise(function(_0x4bc4b4,_0x21199b){return client[_0xe741('0xb')](_0x59f9bf,_0x35667d)['then'](function(_0x365b8b){logger[_0xe741('0xc')](_0xe741('0xd'),_0x35c3a1,_0xe741('0xe'));logger[_0xe741('0xf')](_0xe741('0x10'),_0x35c3a1,'request\x20sent',JSON[_0xe741('0x11')](_0x365b8b));if(_0x365b8b[_0xe741('0x12')]){if(_0x365b8b[_0xe741('0x12')]['code']===0x1f4){logger[_0xe741('0x12')](_0xe741('0xd'),_0x35c3a1,_0x365b8b[_0xe741('0x12')][_0xe741('0x13')]);return _0x21199b(_0x365b8b[_0xe741('0x12')][_0xe741('0x13')]);}logger[_0xe741('0x12')](_0xe741('0xd'),_0x35c3a1,_0x365b8b[_0xe741('0x12')][_0xe741('0x13')]);return _0x4bc4b4(_0x365b8b[_0xe741('0x12')][_0xe741('0x13')]);}else{logger[_0xe741('0xc')](_0xe741('0xd'),_0x35c3a1,_0xe741('0xe'));_0x4bc4b4(_0x365b8b[_0xe741('0x14')][_0xe741('0x13')]);}})[_0xe741('0x15')](function(_0x16f3e2){logger[_0xe741('0x12')](_0xe741('0xd'),_0x35c3a1,_0x16f3e2);_0x21199b(_0x16f3e2);});});} \ No newline at end of file +var _0xc436=['stringify','error','code','message','request\x20sent','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc436,0x193));var _0x6c43=function(_0x192474,_0x2f1866){_0x192474=_0x192474-0x0;var _0xbfd1ed=_0xc436[_0x192474];return _0xbfd1ed;};'use strict';var _=require('lodash');var util=require(_0x6c43('0x0'));var moment=require('moment');var BPromise=require(_0x6c43('0x1'));var rs=require(_0x6c43('0x2'));var fs=require('fs');var Redis=require(_0x6c43('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c43('0x4'));var logger=require(_0x6c43('0x5'))(_0x6c43('0x6'));var config=require(_0x6c43('0x7'));var jayson=require(_0x6c43('0x8'));var client=jayson['client'][_0x6c43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19cc84,_0x5c3856,_0x44caf8){return new BPromise(function(_0x4f585f,_0x41f46a){return client['request'](_0x19cc84,_0x44caf8)[_0x6c43('0xa')](function(_0x36d437){logger[_0x6c43('0xb')](_0x6c43('0xc'),_0x5c3856,'request\x20sent');logger[_0x6c43('0xd')](_0x6c43('0xe'),_0x5c3856,'request\x20sent',JSON[_0x6c43('0xf')](_0x36d437));if(_0x36d437['error']){if(_0x36d437[_0x6c43('0x10')][_0x6c43('0x11')]===0x1f4){logger[_0x6c43('0x10')](_0x6c43('0xc'),_0x5c3856,_0x36d437[_0x6c43('0x10')][_0x6c43('0x12')]);return _0x41f46a(_0x36d437[_0x6c43('0x10')][_0x6c43('0x12')]);}logger[_0x6c43('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5c3856,_0x36d437['error']['message']);return _0x4f585f(_0x36d437[_0x6c43('0x10')][_0x6c43('0x12')]);}else{logger[_0x6c43('0xb')](_0x6c43('0xc'),_0x5c3856,_0x6c43('0x13'));_0x4f585f(_0x36d437[_0x6c43('0x14')]['message']);}})[_0x6c43('0x15')](function(_0x3ddccb){logger[_0x6c43('0x10')](_0x6c43('0xc'),_0x5c3856,_0x3ddccb);_0x41f46a(_0x3ddccb);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 422da93..6f4289e 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 _0xcd08=['put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x1ed511,_0x5bd8f0){var _0x32ab7b=function(_0x46066e){while(--_0x46066e){_0x1ed511['push'](_0x1ed511['shift']());}};_0x32ab7b(++_0x5bd8f0);}(_0xcd08,0x1c6));var _0x8cd0=function(_0x380198,_0x2ff74a){_0x380198=_0x380198-0x0;var _0x222cba=_0xcd08[_0x380198];return _0x222cba;};'use strict';var multer=require(_0x8cd0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8cd0('0x1'));var express=require(_0x8cd0('0x2'));var router=express[_0x8cd0('0x3')]();var fs_extra=require(_0x8cd0('0x4'));var auth=require(_0x8cd0('0x5'));var interaction=require(_0x8cd0('0x6'));var config=require(_0x8cd0('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x8cd0('0x8')]('/',auth[_0x8cd0('0x9')](),controller['index']);router[_0x8cd0('0x8')](_0x8cd0('0xa'),auth[_0x8cd0('0x9')](),controller[_0x8cd0('0xb')]);router[_0x8cd0('0xc')]('/',auth[_0x8cd0('0x9')](),controller[_0x8cd0('0xd')]);router[_0x8cd0('0xe')](_0x8cd0('0xa'),auth[_0x8cd0('0x9')](),controller[_0x8cd0('0xf')]);router['delete'](_0x8cd0('0xa'),auth[_0x8cd0('0x9')](),controller[_0x8cd0('0x10')]);module[_0x8cd0('0x11')]=router; \ No newline at end of file +var _0x6817=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','index','get','/:id','isAuthenticated'];(function(_0x241f85,_0x1b01fd){var _0xcd0a2e=function(_0x48b559){while(--_0x48b559){_0x241f85['push'](_0x241f85['shift']());}};_0xcd0a2e(++_0x1b01fd);}(_0x6817,0xf7));var _0x7681=function(_0x330dcf,_0x5b0f24){_0x330dcf=_0x330dcf-0x0;var _0x322756=_0x6817[_0x330dcf];return _0x322756;};'use strict';var multer=require(_0x7681('0x0'));var util=require(_0x7681('0x1'));var path=require('path');var timeout=require(_0x7681('0x2'));var express=require(_0x7681('0x3'));var router=express[_0x7681('0x4')]();var fs_extra=require(_0x7681('0x5'));var auth=require(_0x7681('0x6'));var interaction=require(_0x7681('0x7'));var config=require('../../config/environment');var controller=require(_0x7681('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7681('0x9')]);router[_0x7681('0xa')](_0x7681('0xb'),auth[_0x7681('0xc')](),controller[_0x7681('0xd')]);router[_0x7681('0xe')]('/',auth['isAuthenticated'](),controller[_0x7681('0xf')]);router[_0x7681('0x10')](_0x7681('0xb'),auth[_0x7681('0xc')](),controller[_0x7681('0x11')]);router[_0x7681('0x12')]('/:id',auth[_0x7681('0xc')](),controller[_0x7681('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fd5e677..0cc51ba 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 _0x3d2f=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x3d2f,0x164));var _0xf3d2=function(_0x2379bd,_0x98d1d3){_0x2379bd=_0x2379bd-0x0;var _0x51bbf1=_0x3d2f[_0x2379bd];return _0x51bbf1;};'use strict';var Sequelize=require(_0xf3d2('0x0'));module[_0xf3d2('0x1')]={'type':{'type':Sequelize[_0xf3d2('0x2')](_0xf3d2('0x3'),_0xf3d2('0x4'),_0xf3d2('0x5'),_0xf3d2('0x6'),_0xf3d2('0x7')),'defaultValue':_0xf3d2('0x3')},'content':{'type':Sequelize[_0xf3d2('0x8')]},'key':{'type':Sequelize[_0xf3d2('0x8')]},'keyType':{'type':Sequelize[_0xf3d2('0x2')](_0xf3d2('0x3'),_0xf3d2('0x4'),_0xf3d2('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf3d2('0x8')]},'nameField':{'type':Sequelize[_0xf3d2('0x8')]},'customField':{'type':Sequelize[_0xf3d2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88a5=['sequelize','exports','ENUM','string','customVariable','picklist','STRING','BOOLEAN'];(function(_0x2feb20,_0x411328){var _0x504215=function(_0x2d3c2a){while(--_0x2d3c2a){_0x2feb20['push'](_0x2feb20['shift']());}};_0x504215(++_0x411328);}(_0x88a5,0x178));var _0x588a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x88a5[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x588a('0x0'));module[_0x588a('0x1')]={'type':{'type':Sequelize[_0x588a('0x2')](_0x588a('0x3'),'variable',_0x588a('0x4'),'keyValue',_0x588a('0x5')),'defaultValue':_0x588a('0x3')},'content':{'type':Sequelize[_0x588a('0x6')]},'key':{'type':Sequelize[_0x588a('0x6')]},'keyType':{'type':Sequelize[_0x588a('0x2')](_0x588a('0x3'),'variable',_0x588a('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x588a('0x6')]},'nameField':{'type':Sequelize[_0x588a('0x6')]},'customField':{'type':Sequelize[_0x588a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x588a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 85e5546..7e6ca3b 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 _0x0db8=['index','Dynamics365Field','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','error','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0db8,0x143));var _0x80db=function(_0x1508e9,_0x5dfaec){_0x1508e9=_0x1508e9-0x0;var _0x5a0bf5=_0x0db8[_0x1508e9];return _0x5a0bf5;};'use strict';var emlformat=require(_0x80db('0x0'));var rimraf=require(_0x80db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80db('0x2'));var rp=require('request-promise');var moment=require(_0x80db('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x80db('0x4'));var path=require(_0x80db('0x5'));var sox=require(_0x80db('0x6'));var csv=require(_0x80db('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x80db('0x8'));var crypto=require(_0x80db('0x9'));var jsforce=require(_0x80db('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x80db('0x7'));var querystring=require('querystring');var Papa=require(_0x80db('0xb'));var Redis=require(_0x80db('0xc'));var authService=require(_0x80db('0xd'));var qs=require(_0x80db('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80db('0xf'));var logger=require(_0x80db('0x10'))(_0x80db('0x11'));var utils=require(_0x80db('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x80db('0x13'));var db=require(_0x80db('0x14'))['db'];function respondWithStatusCode(_0x63b907,_0x595aa1){_0x595aa1=_0x595aa1||0xcc;return function(_0x8e4ebd){if(_0x8e4ebd){return _0x63b907[_0x80db('0x15')](_0x595aa1);}return _0x63b907['status'](_0x595aa1)[_0x80db('0x16')]();};}function respondWithResult(_0x219e44,_0x371eef){_0x371eef=_0x371eef||0xc8;return function(_0x10e218){if(_0x10e218){return _0x219e44[_0x80db('0x17')](_0x371eef)['json'](_0x10e218);}};}function respondWithFilteredResult(_0x19e97f,_0x131f12){return function(_0x8cbf76){if(_0x8cbf76){var _0x217264=typeof _0x131f12[_0x80db('0x18')]==='undefined'&&typeof _0x131f12[_0x80db('0x19')]===_0x80db('0x1a');var _0x4cdaf2=_0x8cbf76[_0x80db('0x1b')];var _0x247797=_0x217264?0x0:_0x131f12[_0x80db('0x18')];var _0x2110b0=_0x217264?_0x8cbf76['count']:_0x131f12[_0x80db('0x18')]+_0x131f12[_0x80db('0x19')];var _0x4fdbd3;if(_0x2110b0>=_0x4cdaf2){_0x2110b0=_0x4cdaf2;_0x4fdbd3=0xc8;}else{_0x4fdbd3=0xce;}_0x19e97f['status'](_0x4fdbd3);return _0x19e97f[_0x80db('0x1c')](_0x80db('0x1d'),_0x247797+'-'+_0x2110b0+'/'+_0x4cdaf2)[_0x80db('0x1e')](_0x8cbf76);}return null;};}function patchUpdates(_0x5077df){return function(_0x21eabe){try{jsonpatch[_0x80db('0x1f')](_0x21eabe,_0x5077df,!![]);}catch(_0x4e1638){return BPromise['reject'](_0x4e1638);}return _0x21eabe[_0x80db('0x20')]();};}function saveUpdates(_0x2de178,_0x290f6d){return function(_0x23fdbf){if(_0x23fdbf){return _0x23fdbf[_0x80db('0x21')](_0x2de178)[_0x80db('0x22')](function(_0x64a9fe){return _0x64a9fe;});}return null;};}function removeEntity(_0x519386,_0x32f881){return function(_0x506ff9){if(_0x506ff9){return _0x506ff9['destroy']()[_0x80db('0x22')](function(){_0x519386[_0x80db('0x17')](0xcc)[_0x80db('0x16')]();});}};}function handleEntityNotFound(_0x53b598,_0xa907c){return function(_0x205c31){if(!_0x205c31){_0x53b598['sendStatus'](0x194);}return _0x205c31;};}function handleError(_0x2e88a2,_0x3d5fbb){_0x3d5fbb=_0x3d5fbb||0x1f4;return function(_0x35f5bb){logger[_0x80db('0x23')](_0x35f5bb['stack']);if(_0x35f5bb[_0x80db('0x24')]){delete _0x35f5bb[_0x80db('0x24')];}_0x2e88a2[_0x80db('0x17')](_0x3d5fbb)['send'](_0x35f5bb);};}exports[_0x80db('0x25')]=function(_0x450f1f,_0x27c640){var _0x2dcd4a={},_0x48ef49={},_0x18ab9b={'count':0x0,'rows':[]};var _0x1f8031=_['map'](db[_0x80db('0x26')][_0x80db('0x27')],function(_0x21868b){return{'name':_0x21868b[_0x80db('0x28')],'type':_0x21868b['type'][_0x80db('0x29')]};});_0x48ef49[_0x80db('0x2a')]=_[_0x80db('0x2b')](_0x1f8031,'name');_0x48ef49[_0x80db('0x2c')]=_[_0x80db('0x2d')](_0x450f1f[_0x80db('0x2c')]);_0x48ef49['filters']=_[_0x80db('0x2e')](_0x48ef49['model'],_0x48ef49[_0x80db('0x2c')]);_0x2dcd4a[_0x80db('0x2f')]=_[_0x80db('0x2e')](_0x48ef49['model'],qs[_0x80db('0x30')](_0x450f1f[_0x80db('0x2c')][_0x80db('0x30')]));_0x2dcd4a[_0x80db('0x2f')]=_0x2dcd4a[_0x80db('0x2f')][_0x80db('0x31')]?_0x2dcd4a[_0x80db('0x2f')]:_0x48ef49['model'];if(!_0x450f1f['query'][_0x80db('0x32')](_0x80db('0x33'))){_0x2dcd4a['limit']=qs['limit'](_0x450f1f['query'][_0x80db('0x19')]);_0x2dcd4a[_0x80db('0x18')]=qs['offset'](_0x450f1f[_0x80db('0x2c')][_0x80db('0x18')]);}_0x2dcd4a[_0x80db('0x34')]=qs[_0x80db('0x35')](_0x450f1f[_0x80db('0x2c')][_0x80db('0x35')]);_0x2dcd4a[_0x80db('0x36')]=qs['filters'](_['pick'](_0x450f1f['query'],_0x48ef49[_0x80db('0x37')]),_0x1f8031);if(_0x450f1f['query']['filter']){_0x2dcd4a[_0x80db('0x36')]=_[_0x80db('0x38')](_0x2dcd4a[_0x80db('0x36')],{'$or':_[_0x80db('0x2b')](_0x1f8031,function(_0x469a90){if(_0x469a90[_0x80db('0x39')]!==_0x80db('0x3a')){var _0x33a357={};_0x33a357[_0x469a90[_0x80db('0x24')]]={'$like':'%'+_0x450f1f[_0x80db('0x2c')][_0x80db('0x3b')]+'%'};return _0x33a357;}})});}_0x2dcd4a=_[_0x80db('0x38')]({},_0x2dcd4a,_0x450f1f[_0x80db('0x3c')]);var _0x48736d={'where':_0x2dcd4a[_0x80db('0x36')]};return db['Dynamics365Field']['count'](_0x48736d)[_0x80db('0x22')](function(_0x2ce9d4){_0x18ab9b[_0x80db('0x1b')]=_0x2ce9d4;if(_0x450f1f[_0x80db('0x2c')][_0x80db('0x3d')]){_0x2dcd4a['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x80db('0x3e')](_0x2dcd4a);})[_0x80db('0x22')](function(_0x47f88b){_0x18ab9b[_0x80db('0x3f')]=_0x47f88b;return _0x18ab9b;})['then'](respondWithFilteredResult(_0x27c640,_0x2dcd4a))[_0x80db('0x40')](handleError(_0x27c640,null));};exports[_0x80db('0x41')]=function(_0x17c88b,_0x1b1ede){var _0xdaf3e4={'raw':!![],'where':{'id':_0x17c88b[_0x80db('0x42')]['id']}},_0x499e0c={};_0x499e0c['model']=_[_0x80db('0x2d')](db[_0x80db('0x26')][_0x80db('0x27')]);_0x499e0c['query']=_[_0x80db('0x2d')](_0x17c88b[_0x80db('0x2c')]);_0x499e0c[_0x80db('0x37')]=_[_0x80db('0x2e')](_0x499e0c['model'],_0x499e0c[_0x80db('0x2c')]);_0xdaf3e4[_0x80db('0x2f')]=_[_0x80db('0x2e')](_0x499e0c['model'],qs['fields'](_0x17c88b[_0x80db('0x2c')]['fields']));_0xdaf3e4[_0x80db('0x2f')]=_0xdaf3e4['attributes'][_0x80db('0x31')]?_0xdaf3e4[_0x80db('0x2f')]:_0x499e0c['model'];if(_0x17c88b['query'][_0x80db('0x3d')]){_0xdaf3e4[_0x80db('0x43')]=[{'all':!![]}];}_0xdaf3e4=_[_0x80db('0x38')]({},_0xdaf3e4,_0x17c88b[_0x80db('0x3c')]);return db[_0x80db('0x26')][_0x80db('0x44')](_0xdaf3e4)[_0x80db('0x22')](handleEntityNotFound(_0x1b1ede,null))[_0x80db('0x22')](respondWithResult(_0x1b1ede,null))[_0x80db('0x40')](handleError(_0x1b1ede,null));};exports[_0x80db('0x45')]=function(_0x37c640,_0x476892){return db[_0x80db('0x26')][_0x80db('0x45')](_0x37c640[_0x80db('0x46')],{})[_0x80db('0x22')](respondWithResult(_0x476892,0xc9))[_0x80db('0x40')](handleError(_0x476892,null));};exports[_0x80db('0x21')]=function(_0x45c3c2,_0x1766c8){if(_0x45c3c2['body']['id']){delete _0x45c3c2['body']['id'];}return db[_0x80db('0x26')][_0x80db('0x44')]({'where':{'id':_0x45c3c2[_0x80db('0x42')]['id']}})[_0x80db('0x22')](handleEntityNotFound(_0x1766c8,null))['then'](saveUpdates(_0x45c3c2[_0x80db('0x46')],null))[_0x80db('0x22')](respondWithResult(_0x1766c8,null))[_0x80db('0x40')](handleError(_0x1766c8,null));};exports[_0x80db('0x47')]=function(_0xeab449,_0x2ea7ed){return db[_0x80db('0x26')][_0x80db('0x44')]({'where':{'id':_0xeab449[_0x80db('0x42')]['id']}})[_0x80db('0x22')](handleEntityNotFound(_0x2ea7ed,null))[_0x80db('0x22')](removeEntity(_0x2ea7ed,null))[_0x80db('0x40')](handleError(_0x2ea7ed,null));}; \ No newline at end of file +var _0x8f4a=['map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','update','find','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send'];(function(_0x4da55f,_0x39cd83){var _0xae8aa1=function(_0xfa2988){while(--_0xfa2988){_0x4da55f['push'](_0x4da55f['shift']());}};_0xae8aa1(++_0x39cd83);}(_0x8f4a,0x199));var _0xa8f4=function(_0x1945be,_0x58c2ac){_0x1945be=_0x1945be-0x0;var _0x583552=_0x8f4a[_0x1945be];return _0x583552;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8f4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8f4('0x1'));var moment=require(_0xa8f4('0x2'));var BPromise=require(_0xa8f4('0x3'));var Mustache=require('mustache');var util=require(_0xa8f4('0x4'));var path=require(_0xa8f4('0x5'));var sox=require(_0xa8f4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8f4('0x7'));var _=require(_0xa8f4('0x8'));var squel=require(_0xa8f4('0x9'));var crypto=require(_0xa8f4('0xa'));var jsforce=require(_0xa8f4('0xb'));var deskjs=require(_0xa8f4('0xc'));var toCsv=require(_0xa8f4('0xd'));var querystring=require('querystring');var Papa=require(_0xa8f4('0xe'));var Redis=require(_0xa8f4('0xf'));var authService=require(_0xa8f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8f4('0x11'));var hardwareService=require(_0xa8f4('0x12'));var logger=require(_0xa8f4('0x13'))(_0xa8f4('0x14'));var utils=require(_0xa8f4('0x15'));var config=require(_0xa8f4('0x16'));var licenseUtil=require(_0xa8f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29b0e0,_0x48c322){_0x48c322=_0x48c322||0xcc;return function(_0x41db11){if(_0x41db11){return _0x29b0e0['sendStatus'](_0x48c322);}return _0x29b0e0[_0xa8f4('0x18')](_0x48c322)['end']();};}function respondWithResult(_0x44575b,_0x484454){_0x484454=_0x484454||0xc8;return function(_0x200fde){if(_0x200fde){return _0x44575b[_0xa8f4('0x18')](_0x484454)[_0xa8f4('0x19')](_0x200fde);}};}function respondWithFilteredResult(_0x5449d2,_0x374974){return function(_0x3f5eff){if(_0x3f5eff){var _0x112566=typeof _0x374974[_0xa8f4('0x1a')]===_0xa8f4('0x1b')&&typeof _0x374974[_0xa8f4('0x1c')]===_0xa8f4('0x1b');var _0x20f279=_0x3f5eff[_0xa8f4('0x1d')];var _0x3317f8=_0x112566?0x0:_0x374974[_0xa8f4('0x1a')];var _0x2509bc=_0x112566?_0x3f5eff[_0xa8f4('0x1d')]:_0x374974['offset']+_0x374974[_0xa8f4('0x1c')];var _0x5b9062;if(_0x2509bc>=_0x20f279){_0x2509bc=_0x20f279;_0x5b9062=0xc8;}else{_0x5b9062=0xce;}_0x5449d2[_0xa8f4('0x18')](_0x5b9062);return _0x5449d2['set'](_0xa8f4('0x1e'),_0x3317f8+'-'+_0x2509bc+'/'+_0x20f279)[_0xa8f4('0x19')](_0x3f5eff);}return null;};}function patchUpdates(_0x527712){return function(_0x16bde1){try{jsonpatch[_0xa8f4('0x1f')](_0x16bde1,_0x527712,!![]);}catch(_0x51dd9a){return BPromise[_0xa8f4('0x20')](_0x51dd9a);}return _0x16bde1[_0xa8f4('0x21')]();};}function saveUpdates(_0x4c4559,_0x600dcf){return function(_0x367383){if(_0x367383){return _0x367383['update'](_0x4c4559)[_0xa8f4('0x22')](function(_0x37e872){return _0x37e872;});}return null;};}function removeEntity(_0x2840ce,_0xa8ab46){return function(_0x2be24e){if(_0x2be24e){return _0x2be24e[_0xa8f4('0x23')]()[_0xa8f4('0x22')](function(){_0x2840ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28de7f,_0x9f4ef){return function(_0x163e5d){if(!_0x163e5d){_0x28de7f[_0xa8f4('0x24')](0x194);}return _0x163e5d;};}function handleError(_0x5cd269,_0xba3604){_0xba3604=_0xba3604||0x1f4;return function(_0x58a489){logger[_0xa8f4('0x25')](_0x58a489[_0xa8f4('0x26')]);if(_0x58a489['name']){delete _0x58a489[_0xa8f4('0x27')];}_0x5cd269[_0xa8f4('0x18')](_0xba3604)[_0xa8f4('0x28')](_0x58a489);};}exports['index']=function(_0x9c61bf,_0x283ae6){var _0x417326={},_0x539701={},_0x3b320b={'count':0x0,'rows':[]};var _0x53673b=_[_0xa8f4('0x29')](db[_0xa8f4('0x2a')]['rawAttributes'],function(_0x2d2409){return{'name':_0x2d2409[_0xa8f4('0x2b')],'type':_0x2d2409[_0xa8f4('0x2c')][_0xa8f4('0x2d')]};});_0x539701[_0xa8f4('0x2e')]=_['map'](_0x53673b,'name');_0x539701[_0xa8f4('0x2f')]=_[_0xa8f4('0x30')](_0x9c61bf[_0xa8f4('0x2f')]);_0x539701[_0xa8f4('0x31')]=_[_0xa8f4('0x32')](_0x539701[_0xa8f4('0x2e')],_0x539701[_0xa8f4('0x2f')]);_0x417326[_0xa8f4('0x33')]=_[_0xa8f4('0x32')](_0x539701[_0xa8f4('0x2e')],qs[_0xa8f4('0x34')](_0x9c61bf['query'][_0xa8f4('0x34')]));_0x417326[_0xa8f4('0x33')]=_0x417326[_0xa8f4('0x33')][_0xa8f4('0x35')]?_0x417326['attributes']:_0x539701[_0xa8f4('0x2e')];if(!_0x9c61bf[_0xa8f4('0x2f')][_0xa8f4('0x36')](_0xa8f4('0x37'))){_0x417326['limit']=qs[_0xa8f4('0x1c')](_0x9c61bf[_0xa8f4('0x2f')]['limit']);_0x417326[_0xa8f4('0x1a')]=qs['offset'](_0x9c61bf[_0xa8f4('0x2f')]['offset']);}_0x417326[_0xa8f4('0x38')]=qs[_0xa8f4('0x39')](_0x9c61bf['query'][_0xa8f4('0x39')]);_0x417326[_0xa8f4('0x3a')]=qs['filters'](_[_0xa8f4('0x3b')](_0x9c61bf['query'],_0x539701[_0xa8f4('0x31')]),_0x53673b);if(_0x9c61bf[_0xa8f4('0x2f')][_0xa8f4('0x3c')]){_0x417326['where']=_[_0xa8f4('0x3d')](_0x417326[_0xa8f4('0x3a')],{'$or':_[_0xa8f4('0x29')](_0x53673b,function(_0x377727){if(_0x377727[_0xa8f4('0x2c')]!==_0xa8f4('0x3e')){var _0x569687={};_0x569687[_0x377727[_0xa8f4('0x27')]]={'$like':'%'+_0x9c61bf['query'][_0xa8f4('0x3c')]+'%'};return _0x569687;}})});}_0x417326=_[_0xa8f4('0x3d')]({},_0x417326,_0x9c61bf[_0xa8f4('0x3f')]);var _0x5084ef={'where':_0x417326[_0xa8f4('0x3a')]};return db['Dynamics365Field'][_0xa8f4('0x1d')](_0x5084ef)[_0xa8f4('0x22')](function(_0xfdaf38){_0x3b320b[_0xa8f4('0x1d')]=_0xfdaf38;if(_0x9c61bf[_0xa8f4('0x2f')][_0xa8f4('0x40')]){_0x417326[_0xa8f4('0x41')]=[{'all':!![]}];}return db[_0xa8f4('0x2a')][_0xa8f4('0x42')](_0x417326);})[_0xa8f4('0x22')](function(_0x33a028){_0x3b320b[_0xa8f4('0x43')]=_0x33a028;return _0x3b320b;})[_0xa8f4('0x22')](respondWithFilteredResult(_0x283ae6,_0x417326))[_0xa8f4('0x44')](handleError(_0x283ae6,null));};exports['show']=function(_0x308650,_0x336de5){var _0x165fe7={'raw':!![],'where':{'id':_0x308650[_0xa8f4('0x45')]['id']}},_0x1ecba={};_0x1ecba[_0xa8f4('0x2e')]=_[_0xa8f4('0x30')](db['Dynamics365Field'][_0xa8f4('0x46')]);_0x1ecba['query']=_[_0xa8f4('0x30')](_0x308650['query']);_0x1ecba['filters']=_[_0xa8f4('0x32')](_0x1ecba[_0xa8f4('0x2e')],_0x1ecba[_0xa8f4('0x2f')]);_0x165fe7[_0xa8f4('0x33')]=_[_0xa8f4('0x32')](_0x1ecba[_0xa8f4('0x2e')],qs[_0xa8f4('0x34')](_0x308650[_0xa8f4('0x2f')]['fields']));_0x165fe7[_0xa8f4('0x33')]=_0x165fe7['attributes'][_0xa8f4('0x35')]?_0x165fe7[_0xa8f4('0x33')]:_0x1ecba['model'];if(_0x308650[_0xa8f4('0x2f')][_0xa8f4('0x40')]){_0x165fe7[_0xa8f4('0x41')]=[{'all':!![]}];}_0x165fe7=_[_0xa8f4('0x3d')]({},_0x165fe7,_0x308650['options']);return db[_0xa8f4('0x2a')]['find'](_0x165fe7)['then'](handleEntityNotFound(_0x336de5,null))[_0xa8f4('0x22')](respondWithResult(_0x336de5,null))[_0xa8f4('0x44')](handleError(_0x336de5,null));};exports[_0xa8f4('0x47')]=function(_0x40569f,_0x4929f2){return db['Dynamics365Field']['create'](_0x40569f[_0xa8f4('0x48')],{})[_0xa8f4('0x22')](respondWithResult(_0x4929f2,0xc9))[_0xa8f4('0x44')](handleError(_0x4929f2,null));};exports[_0xa8f4('0x49')]=function(_0x4fe923,_0x23d7be){if(_0x4fe923['body']['id']){delete _0x4fe923[_0xa8f4('0x48')]['id'];}return db[_0xa8f4('0x2a')][_0xa8f4('0x4a')]({'where':{'id':_0x4fe923[_0xa8f4('0x45')]['id']}})[_0xa8f4('0x22')](handleEntityNotFound(_0x23d7be,null))[_0xa8f4('0x22')](saveUpdates(_0x4fe923[_0xa8f4('0x48')],null))[_0xa8f4('0x22')](respondWithResult(_0x23d7be,null))['catch'](handleError(_0x23d7be,null));};exports[_0xa8f4('0x23')]=function(_0x54c271,_0x331210){return db[_0xa8f4('0x2a')][_0xa8f4('0x4a')]({'where':{'id':_0x54c271[_0xa8f4('0x45')]['id']}})[_0xa8f4('0x22')](handleEntityNotFound(_0x331210,null))[_0xa8f4('0x22')](removeEntity(_0x331210,null))[_0xa8f4('0x44')](handleError(_0x331210,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ddb7ecc..b0480d0 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 _0x550b=['define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','moment','bluebird','request-promise','rimraf','exports'];(function(_0x15d9cf,_0x3c42a0){var _0x263ba0=function(_0x1e536a){while(--_0x1e536a){_0x15d9cf['push'](_0x15d9cf['shift']());}};_0x263ba0(++_0x3c42a0);}(_0x550b,0x18b));var _0xb550=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x550b[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb550('0x0'));var BPromise=require(_0xb550('0x1'));var rp=require(_0xb550('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb550('0x3'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xb550('0x4')]=function(_0x4a7513,_0x5d29c2){return _0x4a7513[_0xb550('0x5')](_0xb550('0x6'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xb550('0x7'),'fields':[_0xb550('0x8'),_0xb550('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09f1=['Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x115850,_0x4bb634){var _0xbad084=function(_0xa14074){while(--_0xa14074){_0x115850['push'](_0x115850['shift']());}};_0xbad084(++_0x4bb634);}(_0x09f1,0x184));var _0x109f=function(_0x2e2562,_0x5607e5){_0x2e2562=_0x2e2562-0x0;var _0x3abd5b=_0x09f1[_0x2e2562];return _0x3abd5b;};'use strict';var _=require(_0x109f('0x0'));var util=require(_0x109f('0x1'));var logger=require(_0x109f('0x2'))(_0x109f('0x3'));var moment=require(_0x109f('0x4'));var BPromise=require(_0x109f('0x5'));var rp=require(_0x109f('0x6'));var fs=require('fs');var path=require(_0x109f('0x7'));var rimraf=require(_0x109f('0x8'));var config=require(_0x109f('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x109f('0xa')]=function(_0x3c0f47,_0x598e5d){return _0x3c0f47[_0x109f('0xb')](_0x109f('0xc'),attributes,{'tableName':_0x109f('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x109f('0xe'),_0x109f('0xf')],'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 a691cd2..49f6d2d 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 _0xb8ca=['../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x444f1c,_0x5ebfe5){var _0x350415=function(_0x4d45ee){while(--_0x4d45ee){_0x444f1c['push'](_0x444f1c['shift']());}};_0x350415(++_0x5ebfe5);}(_0xb8ca,0x187));var _0xab8c=function(_0x16e1c7,_0x37af6c){_0x16e1c7=_0x16e1c7-0x0;var _0x41aa3c=_0xb8ca[_0x16e1c7];return _0x41aa3c;};'use strict';var _=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var moment=require(_0xab8c('0x2'));var BPromise=require('bluebird');var rs=require(_0xab8c('0x3'));var fs=require('fs');var Redis=require(_0xab8c('0x4'));var db=require(_0xab8c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab8c('0x6'))(_0xab8c('0x7'));var config=require(_0xab8c('0x8'));var jayson=require(_0xab8c('0x9'));var client=jayson['client'][_0xab8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2941f4,_0x33bb7b,_0x111dd4){return new BPromise(function(_0x54a79c,_0x37c136){return client[_0xab8c('0xb')](_0x2941f4,_0x111dd4)['then'](function(_0x16ddd9){logger[_0xab8c('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x33bb7b,_0xab8c('0xd'));logger[_0xab8c('0xe')](_0xab8c('0xf'),_0x33bb7b,_0xab8c('0xd'),JSON[_0xab8c('0x10')](_0x16ddd9));if(_0x16ddd9[_0xab8c('0x11')]){if(_0x16ddd9[_0xab8c('0x11')]['code']===0x1f4){logger[_0xab8c('0x11')](_0xab8c('0x12'),_0x33bb7b,_0x16ddd9[_0xab8c('0x11')][_0xab8c('0x13')]);return _0x37c136(_0x16ddd9['error'][_0xab8c('0x13')]);}logger[_0xab8c('0x11')](_0xab8c('0x12'),_0x33bb7b,_0x16ddd9[_0xab8c('0x11')][_0xab8c('0x13')]);return _0x54a79c(_0x16ddd9[_0xab8c('0x11')][_0xab8c('0x13')]);}else{logger[_0xab8c('0xc')](_0xab8c('0x12'),_0x33bb7b,_0xab8c('0xd'));_0x54a79c(_0x16ddd9['result'][_0xab8c('0x13')]);}})[_0xab8c('0x14')](function(_0xd45f25){logger[_0xab8c('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x33bb7b,_0xd45f25);_0x37c136(_0xd45f25);});});} \ No newline at end of file +var _0xb288=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb288,0xdf));var _0x8b28=function(_0xd17fe2,_0x41967c){_0xd17fe2=_0xd17fe2-0x0;var _0x56babf=_0xb288[_0xd17fe2];return _0x56babf;};'use strict';var _=require('lodash');var util=require(_0x8b28('0x0'));var moment=require(_0x8b28('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b28('0x2'));var fs=require('fs');var Redis=require(_0x8b28('0x3'));var db=require(_0x8b28('0x4'))['db'];var utils=require(_0x8b28('0x5'));var logger=require(_0x8b28('0x6'))(_0x8b28('0x7'));var config=require(_0x8b28('0x8'));var jayson=require(_0x8b28('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2679ef,_0x435149,_0x45b308){return new BPromise(function(_0x5da1e6,_0x4c568c){return client[_0x8b28('0xa')](_0x2679ef,_0x45b308)[_0x8b28('0xb')](function(_0x5e2be6){logger[_0x8b28('0xc')](_0x8b28('0xd'),_0x435149,_0x8b28('0xe'));logger[_0x8b28('0xf')](_0x8b28('0x10'),_0x435149,_0x8b28('0xe'),JSON['stringify'](_0x5e2be6));if(_0x5e2be6[_0x8b28('0x11')]){if(_0x5e2be6[_0x8b28('0x11')][_0x8b28('0x12')]===0x1f4){logger[_0x8b28('0x11')](_0x8b28('0xd'),_0x435149,_0x5e2be6['error'][_0x8b28('0x13')]);return _0x4c568c(_0x5e2be6[_0x8b28('0x11')][_0x8b28('0x13')]);}logger[_0x8b28('0x11')](_0x8b28('0xd'),_0x435149,_0x5e2be6[_0x8b28('0x11')][_0x8b28('0x13')]);return _0x5da1e6(_0x5e2be6[_0x8b28('0x11')]['message']);}else{logger['info'](_0x8b28('0xd'),_0x435149,_0x8b28('0xe'));_0x5da1e6(_0x5e2be6[_0x8b28('0x14')][_0x8b28('0x13')]);}})[_0x8b28('0x15')](function(_0x5bc637){logger[_0x8b28('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x435149,_0x5bc637);_0x4c568c(_0x5bc637);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c38987f..6c6f882 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 _0xad22=['index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xad22,0x15c));var _0x2ad2=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xad22[_0x210718];return _0x541bfc;};'use strict';var multer=require(_0x2ad2('0x0'));var util=require('util');var path=require(_0x2ad2('0x1'));var timeout=require(_0x2ad2('0x2'));var express=require('express');var router=express[_0x2ad2('0x3')]();var fs_extra=require(_0x2ad2('0x4'));var auth=require(_0x2ad2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ad2('0x6'));var controller=require(_0x2ad2('0x7'));router[_0x2ad2('0x8')]('/',auth['isAuthenticated'](),controller[_0x2ad2('0x9')]);router[_0x2ad2('0x8')](_0x2ad2('0xa'),auth[_0x2ad2('0xb')](),controller[_0x2ad2('0xc')]);router['get'](_0x2ad2('0xd'),auth[_0x2ad2('0xb')](),controller['getConfigurations']);router[_0x2ad2('0x8')](_0x2ad2('0xe'),auth[_0x2ad2('0xb')](),controller[_0x2ad2('0xf')]);router[_0x2ad2('0x10')]('/',auth[_0x2ad2('0xb')](),controller[_0x2ad2('0x11')]);router[_0x2ad2('0x10')](_0x2ad2('0xd'),auth[_0x2ad2('0xb')](),controller['addConfiguration']);router['put'](_0x2ad2('0xa'),auth[_0x2ad2('0xb')](),controller[_0x2ad2('0x12')]);router[_0x2ad2('0x13')](_0x2ad2('0xa'),auth[_0x2ad2('0xb')](),controller['destroy']);module[_0x2ad2('0x14')]=router; \ No newline at end of file +var _0x913a=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/fields','getFields','create','/:id/configurations','addConfiguration','update','delete','/:id','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x913a,0xc7));var _0xa913=function(_0x8c0e2e,_0x2bed49){_0x8c0e2e=_0x8c0e2e-0x0;var _0x428e94=_0x913a[_0x8c0e2e];return _0x428e94;};'use strict';var multer=require(_0xa913('0x0'));var util=require(_0xa913('0x1'));var path=require(_0xa913('0x2'));var timeout=require(_0xa913('0x3'));var express=require('express');var router=express[_0xa913('0x4')]();var fs_extra=require(_0xa913('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa913('0x6'));var controller=require(_0xa913('0x7'));router[_0xa913('0x8')]('/',auth[_0xa913('0x9')](),controller['index']);router[_0xa913('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa913('0xa')]);router[_0xa913('0x8')]('/:id/configurations',auth[_0xa913('0x9')](),controller['getConfigurations']);router['get'](_0xa913('0xb'),auth['isAuthenticated'](),controller[_0xa913('0xc')]);router['post']('/',auth[_0xa913('0x9')](),controller[_0xa913('0xd')]);router['post'](_0xa913('0xe'),auth['isAuthenticated'](),controller[_0xa913('0xf')]);router['put']('/:id',auth[_0xa913('0x9')](),controller[_0xa913('0x10')]);router[_0xa913('0x11')](_0xa913('0x12'),auth[_0xa913('0x9')](),controller['destroy']);module[_0xa913('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 72ad3da..714417a 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 _0x958a=['sequelize','exports','STRING','username'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x958a,0x128));var _0xa958=function(_0xe1f3e1,_0x2d2c8a){_0xe1f3e1=_0xe1f3e1-0x0;var _0x54c4eb=_0x958a[_0xe1f3e1];return _0x54c4eb;};'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 +var _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x32de4c,_0x33a4f6){var _0x866b67=function(_0x52b46e){while(--_0x52b46e){_0x32de4c['push'](_0x32de4c['shift']());}};_0x866b67(++_0x33a4f6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x0b0e[_0x40b2ed];return _0x18397d;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 87eec02..ec4b242 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 _0xeea4=['hasOwnProperty','sort','where','filters','filter','map','VIRTUAL','merge','includeAll','findAll','rows','params','include','options','catch','update','body','find','destroy','findOne','FreshdeskConfiguration','length','order','pick','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','create','FreshdeskField','getFields','remoteUri','apiKey','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','base64','requester','subject','agent','description','priority','group','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','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','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','then','error','stack','name','FreshdeskAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0xeea4,0x19e));var _0x4eea=function(_0xadfcab,_0x200d45){_0xadfcab=_0xadfcab-0x0;var _0x32e5b0=_0xeea4[_0xadfcab];return _0x32e5b0;};'use strict';var emlformat=require(_0x4eea('0x0'));var rimraf=require(_0x4eea('0x1'));var zipdir=require(_0x4eea('0x2'));var jsonpatch=require(_0x4eea('0x3'));var rp=require(_0x4eea('0x4'));var moment=require(_0x4eea('0x5'));var BPromise=require(_0x4eea('0x6'));var Mustache=require(_0x4eea('0x7'));var util=require(_0x4eea('0x8'));var path=require('path');var sox=require(_0x4eea('0x9'));var csv=require('to-csv');var ejs=require(_0x4eea('0xa'));var fs=require('fs');var fs_extra=require(_0x4eea('0xb'));var _=require(_0x4eea('0xc'));var squel=require('squel');var crypto=require(_0x4eea('0xd'));var jsforce=require(_0x4eea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4eea('0xf'));var querystring=require(_0x4eea('0x10'));var Papa=require(_0x4eea('0x11'));var Redis=require(_0x4eea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4eea('0x13'));var as=require(_0x4eea('0x14'));var hardwareService=require(_0x4eea('0x15'));var logger=require(_0x4eea('0x16'))(_0x4eea('0x17'));var utils=require(_0x4eea('0x18'));var config=require(_0x4eea('0x19'));var licenseUtil=require(_0x4eea('0x1a'));var db=require(_0x4eea('0x1b'))['db'];var integrations=require(_0x4eea('0x1c'));function respondWithStatusCode(_0x47b971,_0x54fa8c){_0x54fa8c=_0x54fa8c||0xcc;return function(_0x3db69c){if(_0x3db69c){return _0x47b971[_0x4eea('0x1d')](_0x54fa8c);}return _0x47b971[_0x4eea('0x1e')](_0x54fa8c)[_0x4eea('0x1f')]();};}function respondWithResult(_0x3327e0,_0x328275){_0x328275=_0x328275||0xc8;return function(_0x10fa37){if(_0x10fa37){return _0x3327e0[_0x4eea('0x1e')](_0x328275)['json'](_0x10fa37);}};}function respondWithFilteredResult(_0x1654c0,_0x34ce09){return function(_0x150d60){if(_0x150d60){var _0xf78777=typeof _0x34ce09['offset']===_0x4eea('0x20')&&typeof _0x34ce09[_0x4eea('0x21')]===_0x4eea('0x20');var _0x33cb40=_0x150d60[_0x4eea('0x22')];var _0x5bd90b=_0xf78777?0x0:_0x34ce09[_0x4eea('0x23')];var _0x29de0e=_0xf78777?_0x150d60['count']:_0x34ce09[_0x4eea('0x23')]+_0x34ce09[_0x4eea('0x21')];var _0x21c7b4;if(_0x29de0e>=_0x33cb40){_0x29de0e=_0x33cb40;_0x21c7b4=0xc8;}else{_0x21c7b4=0xce;}_0x1654c0[_0x4eea('0x1e')](_0x21c7b4);return _0x1654c0[_0x4eea('0x24')](_0x4eea('0x25'),_0x5bd90b+'-'+_0x29de0e+'/'+_0x33cb40)['json'](_0x150d60);}return null;};}function patchUpdates(_0xf054a7){return function(_0x279f95){try{jsonpatch[_0x4eea('0x26')](_0x279f95,_0xf054a7,!![]);}catch(_0x2f5008){return BPromise[_0x4eea('0x27')](_0x2f5008);}return _0x279f95['save']();};}function saveUpdates(_0x4898e8,_0x3b7513){return function(_0x5b2d65){if(_0x5b2d65){return _0x5b2d65['update'](_0x4898e8)['then'](function(_0x37f024){return _0x37f024;});}return null;};}function removeEntity(_0x3be3f3,_0x505e50){return function(_0x12928f){if(_0x12928f){return _0x12928f['destroy']()[_0x4eea('0x28')](function(){_0x3be3f3['status'](0xcc)[_0x4eea('0x1f')]();});}};}function handleEntityNotFound(_0x5a1ec7,_0x1e8f29){return function(_0x10a507){if(!_0x10a507){_0x5a1ec7[_0x4eea('0x1d')](0x194);}return _0x10a507;};}function handleError(_0x430a46,_0xd09e64){_0xd09e64=_0xd09e64||0x1f4;return function(_0x32ade1){logger[_0x4eea('0x29')](_0x32ade1[_0x4eea('0x2a')]);if(_0x32ade1[_0x4eea('0x2b')]){delete _0x32ade1[_0x4eea('0x2b')];}_0x430a46[_0x4eea('0x1e')](_0xd09e64)['send'](_0x32ade1);};}exports['index']=function(_0x3e602c,_0x3eeb41){var _0x591b2f={},_0x4dfd94={},_0x47b5ca={'count':0x0,'rows':[]};var _0x41eb66=_['map'](db[_0x4eea('0x2c')][_0x4eea('0x2d')],function(_0x247d4b){return{'name':_0x247d4b['fieldName'],'type':_0x247d4b[_0x4eea('0x2e')][_0x4eea('0x2f')]};});_0x4dfd94[_0x4eea('0x30')]=_['map'](_0x41eb66,_0x4eea('0x2b'));_0x4dfd94[_0x4eea('0x31')]=_[_0x4eea('0x32')](_0x3e602c['query']);_0x4dfd94['filters']=_[_0x4eea('0x33')](_0x4dfd94[_0x4eea('0x30')],_0x4dfd94['query']);_0x591b2f[_0x4eea('0x34')]=_[_0x4eea('0x33')](_0x4dfd94[_0x4eea('0x30')],qs[_0x4eea('0x35')](_0x3e602c['query'][_0x4eea('0x35')]));_0x591b2f['attributes']=_0x591b2f[_0x4eea('0x34')]['length']?_0x591b2f[_0x4eea('0x34')]:_0x4dfd94[_0x4eea('0x30')];if(!_0x3e602c['query'][_0x4eea('0x36')]('nolimit')){_0x591b2f[_0x4eea('0x21')]=qs[_0x4eea('0x21')](_0x3e602c['query'][_0x4eea('0x21')]);_0x591b2f[_0x4eea('0x23')]=qs[_0x4eea('0x23')](_0x3e602c['query'][_0x4eea('0x23')]);}_0x591b2f['order']=qs['sort'](_0x3e602c[_0x4eea('0x31')][_0x4eea('0x37')]);_0x591b2f[_0x4eea('0x38')]=qs['filters'](_['pick'](_0x3e602c[_0x4eea('0x31')],_0x4dfd94[_0x4eea('0x39')]),_0x41eb66);if(_0x3e602c[_0x4eea('0x31')][_0x4eea('0x3a')]){_0x591b2f[_0x4eea('0x38')]=_['merge'](_0x591b2f[_0x4eea('0x38')],{'$or':_[_0x4eea('0x3b')](_0x41eb66,function(_0x21cce5){if(_0x21cce5[_0x4eea('0x2e')]!==_0x4eea('0x3c')){var _0x3700b0={};_0x3700b0[_0x21cce5[_0x4eea('0x2b')]]={'$like':'%'+_0x3e602c[_0x4eea('0x31')][_0x4eea('0x3a')]+'%'};return _0x3700b0;}})});}_0x591b2f=_[_0x4eea('0x3d')]({},_0x591b2f,_0x3e602c['options']);var _0x1345e1={'where':_0x591b2f[_0x4eea('0x38')]};return db[_0x4eea('0x2c')][_0x4eea('0x22')](_0x1345e1)['then'](function(_0x4ef94f){_0x47b5ca[_0x4eea('0x22')]=_0x4ef94f;if(_0x3e602c['query'][_0x4eea('0x3e')]){_0x591b2f['include']=[{'all':!![]}];}return db[_0x4eea('0x2c')][_0x4eea('0x3f')](_0x591b2f);})[_0x4eea('0x28')](function(_0xfdf8a7){_0x47b5ca[_0x4eea('0x40')]=_0xfdf8a7;return _0x47b5ca;})[_0x4eea('0x28')](respondWithFilteredResult(_0x3eeb41,_0x591b2f))['catch'](handleError(_0x3eeb41,null));};exports['show']=function(_0xd0858,_0x31be59){var _0x835ff3={'raw':![],'where':{'id':_0xd0858[_0x4eea('0x41')]['id']}},_0x30f735={};_0x30f735[_0x4eea('0x30')]=_[_0x4eea('0x32')](db[_0x4eea('0x2c')][_0x4eea('0x2d')]);_0x30f735[_0x4eea('0x31')]=_[_0x4eea('0x32')](_0xd0858[_0x4eea('0x31')]);_0x30f735[_0x4eea('0x39')]=_['intersection'](_0x30f735[_0x4eea('0x30')],_0x30f735[_0x4eea('0x31')]);_0x835ff3[_0x4eea('0x34')]=_[_0x4eea('0x33')](_0x30f735[_0x4eea('0x30')],qs[_0x4eea('0x35')](_0xd0858[_0x4eea('0x31')][_0x4eea('0x35')]));_0x835ff3[_0x4eea('0x34')]=_0x835ff3[_0x4eea('0x34')]['length']?_0x835ff3['attributes']:_0x30f735[_0x4eea('0x30')];if(_0xd0858[_0x4eea('0x31')]['includeAll']){_0x835ff3[_0x4eea('0x42')]=[{'all':!![]}];}_0x835ff3=_[_0x4eea('0x3d')]({},_0x835ff3,_0xd0858[_0x4eea('0x43')]);return db[_0x4eea('0x2c')]['find'](_0x835ff3)[_0x4eea('0x28')](handleEntityNotFound(_0x31be59,null))[_0x4eea('0x28')](respondWithResult(_0x31be59,null))['catch'](handleError(_0x31be59,null));};exports['create']=function(_0x1f2ceb,_0x420b4d){return db[_0x4eea('0x2c')]['create'](_0x1f2ceb['body'],{})[_0x4eea('0x28')](respondWithResult(_0x420b4d,0xc9))[_0x4eea('0x44')](handleError(_0x420b4d,null));};exports[_0x4eea('0x45')]=function(_0x49b789,_0x95ee9d){if(_0x49b789[_0x4eea('0x46')]['id']){delete _0x49b789[_0x4eea('0x46')]['id'];}return db['FreshdeskAccount'][_0x4eea('0x47')]({'where':{'id':_0x49b789[_0x4eea('0x41')]['id']}})['then'](handleEntityNotFound(_0x95ee9d,null))[_0x4eea('0x28')](saveUpdates(_0x49b789['body'],null))[_0x4eea('0x28')](respondWithResult(_0x95ee9d,null))[_0x4eea('0x44')](handleError(_0x95ee9d,null));};exports[_0x4eea('0x48')]=function(_0x26ba32,_0x4f2a6f){return db[_0x4eea('0x2c')][_0x4eea('0x47')]({'where':{'id':_0x26ba32[_0x4eea('0x41')]['id']}})[_0x4eea('0x28')](handleEntityNotFound(_0x4f2a6f,null))[_0x4eea('0x28')](removeEntity(_0x4f2a6f,null))[_0x4eea('0x44')](handleError(_0x4f2a6f,null));};exports['getConfigurations']=function(_0x556440,_0x4842e8,_0x268023){var _0x1f1edc={};var _0x355ea7={};var _0x14886a;var _0x47ab65;return db['FreshdeskAccount'][_0x4eea('0x49')]({'where':{'id':_0x556440[_0x4eea('0x41')]['id']}})[_0x4eea('0x28')](handleEntityNotFound(_0x4842e8,null))[_0x4eea('0x28')](function(_0x1efaad){if(_0x1efaad){_0x14886a=_0x1efaad;_0x355ea7[_0x4eea('0x30')]=_[_0x4eea('0x32')](db[_0x4eea('0x4a')][_0x4eea('0x2d')]);_0x355ea7[_0x4eea('0x31')]=_[_0x4eea('0x32')](_0x556440[_0x4eea('0x31')]);_0x355ea7[_0x4eea('0x39')]=_[_0x4eea('0x33')](_0x355ea7[_0x4eea('0x30')],_0x355ea7[_0x4eea('0x31')]);_0x1f1edc[_0x4eea('0x34')]=_[_0x4eea('0x33')](_0x355ea7['model'],qs[_0x4eea('0x35')](_0x556440[_0x4eea('0x31')]['fields']));_0x1f1edc[_0x4eea('0x34')]=_0x1f1edc[_0x4eea('0x34')][_0x4eea('0x4b')]?_0x1f1edc[_0x4eea('0x34')]:_0x355ea7[_0x4eea('0x30')];_0x1f1edc[_0x4eea('0x4c')]=qs['sort'](_0x556440[_0x4eea('0x31')][_0x4eea('0x37')]);_0x1f1edc[_0x4eea('0x38')]=qs[_0x4eea('0x39')](_[_0x4eea('0x4d')](_0x556440[_0x4eea('0x31')],_0x355ea7[_0x4eea('0x39')]));if(_0x556440[_0x4eea('0x31')][_0x4eea('0x3a')]){_0x1f1edc[_0x4eea('0x38')]=_[_0x4eea('0x3d')](_0x1f1edc[_0x4eea('0x38')],{'$or':_[_0x4eea('0x3b')](_0x1f1edc[_0x4eea('0x34')],function(_0x8aaf17){var _0x5df7be={};_0x5df7be[_0x8aaf17]={'$like':'%'+_0x556440[_0x4eea('0x31')]['filter']+'%'};return _0x5df7be;})});}_0x1f1edc=_[_0x4eea('0x3d')]({},_0x1f1edc,_0x556440[_0x4eea('0x43')]);return _0x14886a[_0x4eea('0x4e')](_0x1f1edc);}})[_0x4eea('0x28')](function(_0x347377){if(_0x347377){_0x47ab65=_0x347377[_0x4eea('0x4b')];if(!_0x556440['query'][_0x4eea('0x36')](_0x4eea('0x4f'))){_0x1f1edc['limit']=qs['limit'](_0x556440[_0x4eea('0x31')]['limit']);_0x1f1edc[_0x4eea('0x23')]=qs[_0x4eea('0x23')](_0x556440[_0x4eea('0x31')][_0x4eea('0x23')]);}return _0x14886a[_0x4eea('0x4e')](_0x1f1edc);}})[_0x4eea('0x28')](function(_0x379772){if(_0x379772){return _0x379772?{'count':_0x47ab65,'rows':_0x379772}:null;}})['then'](respondWithResult(_0x4842e8,null))[_0x4eea('0x44')](handleError(_0x4842e8,null));};exports[_0x4eea('0x50')]=function(_0x7bd1ce,_0x3b0fa9,_0x39a029){if(_0x7bd1ce[_0x4eea('0x46')]['id']){delete _0x7bd1ce['body']['id'];}return db['FreshdeskAccount'][_0x4eea('0x49')]({'where':{'id':_0x7bd1ce[_0x4eea('0x41')]['id']}})[_0x4eea('0x28')](handleEntityNotFound(_0x3b0fa9,null))['then'](function(_0x379b1d){if(_0x379b1d){_0x7bd1ce[_0x4eea('0x46')][_0x4eea('0x51')]=_0x379b1d['id'];_0x7bd1ce[_0x4eea('0x46')]['Subjects']=integrations[_0x4eea('0x52')](_0x7bd1ce[_0x4eea('0x46')][_0x4eea('0x53')],_0x7bd1ce['body'][_0x4eea('0x2e')]);_0x7bd1ce['body'][_0x4eea('0x54')]=integrations[_0x4eea('0x55')](_0x7bd1ce[_0x4eea('0x46')][_0x4eea('0x53')],_0x7bd1ce['body'][_0x4eea('0x2e')]);return db[_0x4eea('0x4a')][_0x4eea('0x56')](_0x7bd1ce[_0x4eea('0x46')],{'include':[{'model':db[_0x4eea('0x57')],'as':'Subjects'},{'model':db[_0x4eea('0x57')],'as':_0x4eea('0x54')}]});}return null;})[_0x4eea('0x28')](respondWithResult(_0x3b0fa9,null))[_0x4eea('0x44')](handleError(_0x3b0fa9,null));};exports[_0x4eea('0x58')]=function(_0x583355,_0x18cc7f,_0x1379c5){var _0x281b04='';return db[_0x4eea('0x2c')][_0x4eea('0x49')]({'where':{'id':_0x583355[_0x4eea('0x41')]['id']},'attributes':['id',_0x4eea('0x59'),_0x4eea('0x5a')]})[_0x4eea('0x28')](handleEntityNotFound(_0x18cc7f,null))[_0x4eea('0x28')](function(_0x27b2da){if(_0x27b2da){_0x281b04=_0x27b2da[_0x4eea('0x59')];var _0x2ac494=_0x281b04['slice'](-0x1);if(_0x2ac494==='/'){_0x281b04=_0x281b04['substring'](0x0,_0x281b04[_0x4eea('0x5b')](_0x2ac494));}return rp({'method':_0x4eea('0x5c'),'uri':util[_0x4eea('0x5d')]('%s/%s',_0x281b04,_0x4eea('0x5e')),'headers':{'Authorization':util[_0x4eea('0x5d')](_0x4eea('0x5f'),new Buffer(util[_0x4eea('0x5d')]('%s:X',_0x27b2da[_0x4eea('0x5a')]))['toString'](_0x4eea('0x60')))},'json':!![]});}})[_0x4eea('0x28')](function(_0x206a81){if(_0x206a81){var _0x80d1d5=[_0x4eea('0x61'),_0x4eea('0x62'),_0x4eea('0x63'),_0x4eea('0x64'),'status',_0x4eea('0x65'),_0x4eea('0x66'),'source',_0x4eea('0x67'),_0x4eea('0x66'),'company'];_[_0x4eea('0x68')](_0x206a81,function(_0xdb26d){return _0x80d1d5[_0x4eea('0x69')](_0xdb26d[_0x4eea('0x2b')])||!_0xdb26d[_0x4eea('0x6a')]&&_0xdb26d['type']!==_0x4eea('0x6b')&&_0xdb26d[_0x4eea('0x2e')]!==_0x4eea('0x6c');});return{'count':_0x206a81['length'],'rows':_[_0x4eea('0x3b')](_0x206a81,function(_0x51b242){return{'id':_0x51b242[_0x4eea('0x2b')],'name':_0x51b242[_0x4eea('0x6d')],'custom':!_0x51b242[_0x4eea('0x6a')],'options':_0x51b242['choices']?_[_0x4eea('0x3b')](_0x51b242[_0x4eea('0x6e')],function(_0x37c9bb){return{'name':_[_0x4eea('0x6f')](_0x37c9bb),'value':_0x37c9bb};}):[]};})};}})[_0x4eea('0x28')](respondWithResult(_0x18cc7f,null))[_0x4eea('0x44')](function(_0x5583a9){var _0x5bfd29=_0x583355[_0x4eea('0x31')][_0x4eea('0x70')]?0x1f4:_0x5583a9[_0x4eea('0x71')]||0x1f4;logger[_0x4eea('0x29')](_0x4eea('0x72'),_0x4eea('0x58'),_0x5bfd29,JSON[_0x4eea('0x73')](_0x5583a9));delete _0x5583a9['name'];if(_0x5bfd29===0x191){_0x5bfd29=0x190;}_0x18cc7f[_0x4eea('0x1e')](_0x5bfd29)['send'](_0x583355[_0x4eea('0x31')]['test']?{'message':_0x4eea('0x74'),'statusCode':_0x5583a9[_0x4eea('0x71')]}:_0x5583a9);});}; \ No newline at end of file +var _0xe5fb=['json','offset','undefined','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','merge','options','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','requester','subject','description','priority','group','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x3639ca,_0x13f27b){var _0x11e409=function(_0xa27dea){while(--_0xa27dea){_0x3639ca['push'](_0x3639ca['shift']());}};_0x11e409(++_0x13f27b);}(_0xe5fb,0xce));var _0xbe5f=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xe5fb[_0x163742];return _0x1152ac;};'use strict';var emlformat=require(_0xbe5f('0x0'));var rimraf=require(_0xbe5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe5f('0x2'));var rp=require(_0xbe5f('0x3'));var moment=require(_0xbe5f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe5f('0x5'));var util=require(_0xbe5f('0x6'));var path=require(_0xbe5f('0x7'));var sox=require(_0xbe5f('0x8'));var csv=require(_0xbe5f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe5f('0xa'));var _=require(_0xbe5f('0xb'));var squel=require(_0xbe5f('0xc'));var crypto=require(_0xbe5f('0xd'));var jsforce=require(_0xbe5f('0xe'));var deskjs=require(_0xbe5f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbe5f('0x10'));var Papa=require(_0xbe5f('0x11'));var Redis=require(_0xbe5f('0x12'));var authService=require(_0xbe5f('0x13'));var qs=require(_0xbe5f('0x14'));var as=require(_0xbe5f('0x15'));var hardwareService=require(_0xbe5f('0x16'));var logger=require(_0xbe5f('0x17'))(_0xbe5f('0x18'));var utils=require(_0xbe5f('0x19'));var config=require(_0xbe5f('0x1a'));var licenseUtil=require(_0xbe5f('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbe5f('0x1c'));function respondWithStatusCode(_0x227ef6,_0x454a41){_0x454a41=_0x454a41||0xcc;return function(_0x5880c3){if(_0x5880c3){return _0x227ef6[_0xbe5f('0x1d')](_0x454a41);}return _0x227ef6[_0xbe5f('0x1e')](_0x454a41)[_0xbe5f('0x1f')]();};}function respondWithResult(_0x19d245,_0x3b753f){_0x3b753f=_0x3b753f||0xc8;return function(_0x5e2862){if(_0x5e2862){return _0x19d245[_0xbe5f('0x1e')](_0x3b753f)[_0xbe5f('0x20')](_0x5e2862);}};}function respondWithFilteredResult(_0x159fa3,_0x77698b){return function(_0x1b8825){if(_0x1b8825){var _0x345f65=typeof _0x77698b[_0xbe5f('0x21')]===_0xbe5f('0x22')&&typeof _0x77698b['limit']==='undefined';var _0x550702=_0x1b8825['count'];var _0x9b274e=_0x345f65?0x0:_0x77698b[_0xbe5f('0x21')];var _0x30f6d2=_0x345f65?_0x1b8825['count']:_0x77698b['offset']+_0x77698b['limit'];var _0x5d8d6c;if(_0x30f6d2>=_0x550702){_0x30f6d2=_0x550702;_0x5d8d6c=0xc8;}else{_0x5d8d6c=0xce;}_0x159fa3[_0xbe5f('0x1e')](_0x5d8d6c);return _0x159fa3[_0xbe5f('0x23')](_0xbe5f('0x24'),_0x9b274e+'-'+_0x30f6d2+'/'+_0x550702)[_0xbe5f('0x20')](_0x1b8825);}return null;};}function patchUpdates(_0x2c6c52){return function(_0x436cd2){try{jsonpatch['apply'](_0x436cd2,_0x2c6c52,!![]);}catch(_0x100b62){return BPromise[_0xbe5f('0x25')](_0x100b62);}return _0x436cd2[_0xbe5f('0x26')]();};}function saveUpdates(_0x306974,_0x1bfed4){return function(_0x3dccd1){if(_0x3dccd1){return _0x3dccd1[_0xbe5f('0x27')](_0x306974)['then'](function(_0x21cfdd){return _0x21cfdd;});}return null;};}function removeEntity(_0x1ab547,_0x4832a7){return function(_0x37b5a9){if(_0x37b5a9){return _0x37b5a9[_0xbe5f('0x28')]()[_0xbe5f('0x29')](function(){_0x1ab547[_0xbe5f('0x1e')](0xcc)[_0xbe5f('0x1f')]();});}};}function handleEntityNotFound(_0x30e1d5,_0x2d4e89){return function(_0x5326a5){if(!_0x5326a5){_0x30e1d5['sendStatus'](0x194);}return _0x5326a5;};}function handleError(_0x5e85f7,_0x55e7c5){_0x55e7c5=_0x55e7c5||0x1f4;return function(_0x11946e){logger[_0xbe5f('0x2a')](_0x11946e[_0xbe5f('0x2b')]);if(_0x11946e[_0xbe5f('0x2c')]){delete _0x11946e[_0xbe5f('0x2c')];}_0x5e85f7[_0xbe5f('0x1e')](_0x55e7c5)[_0xbe5f('0x2d')](_0x11946e);};}exports[_0xbe5f('0x2e')]=function(_0x1f3451,_0x52ff44){var _0xfe0ddc={},_0x443bdb={},_0x12cd38={'count':0x0,'rows':[]};var _0x3a4fd1=_[_0xbe5f('0x2f')](db[_0xbe5f('0x30')][_0xbe5f('0x31')],function(_0x366ae1){return{'name':_0x366ae1[_0xbe5f('0x32')],'type':_0x366ae1[_0xbe5f('0x33')][_0xbe5f('0x34')]};});_0x443bdb[_0xbe5f('0x35')]=_[_0xbe5f('0x2f')](_0x3a4fd1,_0xbe5f('0x2c'));_0x443bdb[_0xbe5f('0x36')]=_['keys'](_0x1f3451['query']);_0x443bdb[_0xbe5f('0x37')]=_[_0xbe5f('0x38')](_0x443bdb[_0xbe5f('0x35')],_0x443bdb[_0xbe5f('0x36')]);_0xfe0ddc[_0xbe5f('0x39')]=_[_0xbe5f('0x38')](_0x443bdb[_0xbe5f('0x35')],qs[_0xbe5f('0x3a')](_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x3a')]));_0xfe0ddc[_0xbe5f('0x39')]=_0xfe0ddc['attributes'][_0xbe5f('0x3b')]?_0xfe0ddc['attributes']:_0x443bdb[_0xbe5f('0x35')];if(!_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x3c')](_0xbe5f('0x3d'))){_0xfe0ddc[_0xbe5f('0x3e')]=qs[_0xbe5f('0x3e')](_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x3e')]);_0xfe0ddc[_0xbe5f('0x21')]=qs[_0xbe5f('0x21')](_0x1f3451['query'][_0xbe5f('0x21')]);}_0xfe0ddc[_0xbe5f('0x3f')]=qs[_0xbe5f('0x40')](_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x40')]);_0xfe0ddc[_0xbe5f('0x41')]=qs['filters'](_[_0xbe5f('0x42')](_0x1f3451[_0xbe5f('0x36')],_0x443bdb['filters']),_0x3a4fd1);if(_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x43')]){_0xfe0ddc['where']=_['merge'](_0xfe0ddc['where'],{'$or':_[_0xbe5f('0x2f')](_0x3a4fd1,function(_0x9ff166){if(_0x9ff166['type']!=='VIRTUAL'){var _0x5f4760={};_0x5f4760[_0x9ff166[_0xbe5f('0x2c')]]={'$like':'%'+_0x1f3451['query'][_0xbe5f('0x43')]+'%'};return _0x5f4760;}})});}_0xfe0ddc=_['merge']({},_0xfe0ddc,_0x1f3451['options']);var _0x40e9a4={'where':_0xfe0ddc[_0xbe5f('0x41')]};return db[_0xbe5f('0x30')][_0xbe5f('0x44')](_0x40e9a4)['then'](function(_0x552997){_0x12cd38['count']=_0x552997;if(_0x1f3451[_0xbe5f('0x36')][_0xbe5f('0x45')]){_0xfe0ddc[_0xbe5f('0x46')]=[{'all':!![]}];}return db[_0xbe5f('0x30')][_0xbe5f('0x47')](_0xfe0ddc);})['then'](function(_0x54102b){_0x12cd38[_0xbe5f('0x48')]=_0x54102b;return _0x12cd38;})[_0xbe5f('0x29')](respondWithFilteredResult(_0x52ff44,_0xfe0ddc))[_0xbe5f('0x49')](handleError(_0x52ff44,null));};exports[_0xbe5f('0x4a')]=function(_0x2e1959,_0x33c554){var _0x2f665d={'raw':![],'where':{'id':_0x2e1959[_0xbe5f('0x4b')]['id']}},_0x1b5e26={};_0x1b5e26[_0xbe5f('0x35')]=_['keys'](db[_0xbe5f('0x30')][_0xbe5f('0x31')]);_0x1b5e26[_0xbe5f('0x36')]=_[_0xbe5f('0x4c')](_0x2e1959[_0xbe5f('0x36')]);_0x1b5e26[_0xbe5f('0x37')]=_[_0xbe5f('0x38')](_0x1b5e26[_0xbe5f('0x35')],_0x1b5e26['query']);_0x2f665d[_0xbe5f('0x39')]=_['intersection'](_0x1b5e26[_0xbe5f('0x35')],qs[_0xbe5f('0x3a')](_0x2e1959[_0xbe5f('0x36')][_0xbe5f('0x3a')]));_0x2f665d[_0xbe5f('0x39')]=_0x2f665d['attributes'][_0xbe5f('0x3b')]?_0x2f665d[_0xbe5f('0x39')]:_0x1b5e26['model'];if(_0x2e1959[_0xbe5f('0x36')][_0xbe5f('0x45')]){_0x2f665d[_0xbe5f('0x46')]=[{'all':!![]}];}_0x2f665d=_['merge']({},_0x2f665d,_0x2e1959['options']);return db[_0xbe5f('0x30')][_0xbe5f('0x4d')](_0x2f665d)[_0xbe5f('0x29')](handleEntityNotFound(_0x33c554,null))[_0xbe5f('0x29')](respondWithResult(_0x33c554,null))[_0xbe5f('0x49')](handleError(_0x33c554,null));};exports[_0xbe5f('0x4e')]=function(_0x47bae0,_0x53a0ab){return db[_0xbe5f('0x30')][_0xbe5f('0x4e')](_0x47bae0['body'],{})[_0xbe5f('0x29')](respondWithResult(_0x53a0ab,0xc9))[_0xbe5f('0x49')](handleError(_0x53a0ab,null));};exports[_0xbe5f('0x27')]=function(_0x674bdd,_0x56c2e7){if(_0x674bdd[_0xbe5f('0x4f')]['id']){delete _0x674bdd[_0xbe5f('0x4f')]['id'];}return db[_0xbe5f('0x30')][_0xbe5f('0x4d')]({'where':{'id':_0x674bdd[_0xbe5f('0x4b')]['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0x56c2e7,null))['then'](saveUpdates(_0x674bdd['body'],null))[_0xbe5f('0x29')](respondWithResult(_0x56c2e7,null))[_0xbe5f('0x49')](handleError(_0x56c2e7,null));};exports[_0xbe5f('0x28')]=function(_0x343f5a,_0x2768f8){return db[_0xbe5f('0x30')][_0xbe5f('0x4d')]({'where':{'id':_0x343f5a[_0xbe5f('0x4b')]['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0x2768f8,null))[_0xbe5f('0x29')](removeEntity(_0x2768f8,null))['catch'](handleError(_0x2768f8,null));};exports[_0xbe5f('0x50')]=function(_0x2fa072,_0xc88e05,_0x1537f0){var _0x1790fb={};var _0xc603a9={};var _0x48dcec;var _0x3aefce;return db[_0xbe5f('0x30')][_0xbe5f('0x51')]({'where':{'id':_0x2fa072[_0xbe5f('0x4b')]['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0xc88e05,null))[_0xbe5f('0x29')](function(_0x140096){if(_0x140096){_0x48dcec=_0x140096;_0xc603a9[_0xbe5f('0x35')]=_[_0xbe5f('0x4c')](db[_0xbe5f('0x52')][_0xbe5f('0x31')]);_0xc603a9[_0xbe5f('0x36')]=_[_0xbe5f('0x4c')](_0x2fa072[_0xbe5f('0x36')]);_0xc603a9[_0xbe5f('0x37')]=_[_0xbe5f('0x38')](_0xc603a9[_0xbe5f('0x35')],_0xc603a9[_0xbe5f('0x36')]);_0x1790fb[_0xbe5f('0x39')]=_[_0xbe5f('0x38')](_0xc603a9[_0xbe5f('0x35')],qs[_0xbe5f('0x3a')](_0x2fa072['query'][_0xbe5f('0x3a')]));_0x1790fb[_0xbe5f('0x39')]=_0x1790fb[_0xbe5f('0x39')][_0xbe5f('0x3b')]?_0x1790fb['attributes']:_0xc603a9[_0xbe5f('0x35')];_0x1790fb[_0xbe5f('0x3f')]=qs[_0xbe5f('0x40')](_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x40')]);_0x1790fb[_0xbe5f('0x41')]=qs[_0xbe5f('0x37')](_[_0xbe5f('0x42')](_0x2fa072[_0xbe5f('0x36')],_0xc603a9['filters']));if(_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x43')]){_0x1790fb[_0xbe5f('0x41')]=_[_0xbe5f('0x53')](_0x1790fb[_0xbe5f('0x41')],{'$or':_[_0xbe5f('0x2f')](_0x1790fb['attributes'],function(_0x339fa6){var _0x2e3b99={};_0x2e3b99[_0x339fa6]={'$like':'%'+_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x43')]+'%'};return _0x2e3b99;})});}_0x1790fb=_[_0xbe5f('0x53')]({},_0x1790fb,_0x2fa072[_0xbe5f('0x54')]);return _0x48dcec['getConfigurations'](_0x1790fb);}})['then'](function(_0x279129){if(_0x279129){_0x3aefce=_0x279129[_0xbe5f('0x3b')];if(!_0x2fa072['query']['hasOwnProperty']('nolimit')){_0x1790fb['limit']=qs['limit'](_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x3e')]);_0x1790fb['offset']=qs[_0xbe5f('0x21')](_0x2fa072[_0xbe5f('0x36')][_0xbe5f('0x21')]);}return _0x48dcec[_0xbe5f('0x50')](_0x1790fb);}})[_0xbe5f('0x29')](function(_0x249a9a){if(_0x249a9a){return _0x249a9a?{'count':_0x3aefce,'rows':_0x249a9a}:null;}})[_0xbe5f('0x29')](respondWithResult(_0xc88e05,null))[_0xbe5f('0x49')](handleError(_0xc88e05,null));};exports['addConfiguration']=function(_0xbfd242,_0xe2a752,_0x4594c1){if(_0xbfd242[_0xbe5f('0x4f')]['id']){delete _0xbfd242[_0xbe5f('0x4f')]['id'];}return db[_0xbe5f('0x30')][_0xbe5f('0x51')]({'where':{'id':_0xbfd242['params']['id']}})[_0xbe5f('0x29')](handleEntityNotFound(_0xe2a752,null))[_0xbe5f('0x29')](function(_0x31a237){if(_0x31a237){_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x55')]=_0x31a237['id'];_0xbfd242['body'][_0xbe5f('0x56')]=integrations[_0xbe5f('0x57')](_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x58')],_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x33')]);_0xbfd242['body'][_0xbe5f('0x59')]=integrations[_0xbe5f('0x5a')](_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x58')],_0xbfd242[_0xbe5f('0x4f')][_0xbe5f('0x33')]);return db[_0xbe5f('0x52')][_0xbe5f('0x4e')](_0xbfd242[_0xbe5f('0x4f')],{'include':[{'model':db['FreshdeskField'],'as':_0xbe5f('0x56')},{'model':db[_0xbe5f('0x5b')],'as':_0xbe5f('0x59')}]});}return null;})[_0xbe5f('0x29')](respondWithResult(_0xe2a752,null))[_0xbe5f('0x49')](handleError(_0xe2a752,null));};exports[_0xbe5f('0x5c')]=function(_0x54956c,_0x2d184e,_0x3a122a){var _0x586aa8='';return db[_0xbe5f('0x30')][_0xbe5f('0x51')]({'where':{'id':_0x54956c[_0xbe5f('0x4b')]['id']},'attributes':['id',_0xbe5f('0x5d'),_0xbe5f('0x5e')]})[_0xbe5f('0x29')](handleEntityNotFound(_0x2d184e,null))[_0xbe5f('0x29')](function(_0x37bc2e){if(_0x37bc2e){_0x586aa8=_0x37bc2e[_0xbe5f('0x5d')];var _0x3852fe=_0x586aa8[_0xbe5f('0x5f')](-0x1);if(_0x3852fe==='/'){_0x586aa8=_0x586aa8['substring'](0x0,_0x586aa8[_0xbe5f('0x60')](_0x3852fe));}return rp({'method':'GET','uri':util['format'](_0xbe5f('0x61'),_0x586aa8,_0xbe5f('0x62')),'headers':{'Authorization':util[_0xbe5f('0x63')](_0xbe5f('0x64'),new Buffer(util['format']('%s:X',_0x37bc2e[_0xbe5f('0x5e')]))[_0xbe5f('0x65')]('base64'))},'json':!![]});}})['then'](function(_0x21b256){if(_0x21b256){var _0x1a94b1=[_0xbe5f('0x66'),_0xbe5f('0x67'),'agent',_0xbe5f('0x68'),_0xbe5f('0x1e'),_0xbe5f('0x69'),'group','source','ticket_type',_0xbe5f('0x6a'),'company'];_[_0xbe5f('0x6b')](_0x21b256,function(_0xa2816){return _0x1a94b1[_0xbe5f('0x6c')](_0xa2816[_0xbe5f('0x2c')])||!_0xa2816[_0xbe5f('0x6d')]&&_0xa2816['type']!==_0xbe5f('0x6e')&&_0xa2816[_0xbe5f('0x33')]!==_0xbe5f('0x6f');});return{'count':_0x21b256[_0xbe5f('0x3b')],'rows':_[_0xbe5f('0x2f')](_0x21b256,function(_0x21f1d8){return{'id':_0x21f1d8['name'],'name':_0x21f1d8[_0xbe5f('0x70')],'custom':!_0x21f1d8[_0xbe5f('0x6d')],'options':_0x21f1d8[_0xbe5f('0x71')]?_[_0xbe5f('0x2f')](_0x21f1d8[_0xbe5f('0x71')],function(_0x4d294e){return{'name':_['capitalize'](_0x4d294e),'value':_0x4d294e};}):[]};})};}})[_0xbe5f('0x29')](respondWithResult(_0x2d184e,null))[_0xbe5f('0x49')](function(_0x59fd19){var _0x24d21d=_0x54956c[_0xbe5f('0x36')][_0xbe5f('0x72')]?0x1f4:_0x59fd19[_0xbe5f('0x73')]||0x1f4;logger[_0xbe5f('0x2a')](_0xbe5f('0x74'),'getFields',_0x24d21d,JSON[_0xbe5f('0x75')](_0x59fd19));delete _0x59fd19[_0xbe5f('0x2c')];if(_0x24d21d===0x191){_0x24d21d=0x190;}_0x2d184e[_0xbe5f('0x1e')](_0x24d21d)[_0xbe5f('0x2d')](_0x54956c['query']['test']?{'message':_0xbe5f('0x76'),'statusCode':_0x59fd19[_0xbe5f('0x73')]}:_0x59fd19);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f3509b1..5328a25 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 _0x334c=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0xf738ad,_0x5e1d7f){var _0x598570=function(_0x35088e){while(--_0x35088e){_0xf738ad['push'](_0xf738ad['shift']());}};_0x598570(++_0x5e1d7f);}(_0x334c,0x1c8));var _0xc334=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x334c[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xc334('0x0'));var util=require(_0xc334('0x1'));var logger=require('../../config/logger')(_0xc334('0x2'));var moment=require(_0xc334('0x3'));var BPromise=require(_0xc334('0x4'));var rp=require(_0xc334('0x5'));var fs=require('fs');var path=require(_0xc334('0x6'));var rimraf=require(_0xc334('0x7'));var config=require(_0xc334('0x8'));var attributes=require(_0xc334('0x9'));var integrations=require(_0xc334('0xa'));module[_0xc334('0xb')]=function(_0x24be7c,_0x2b8152){return _0x24be7c[_0xc334('0xc')]('FreshdeskAccount',attributes,{'tableName':_0xc334('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b5b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3b5b,0x6e));var _0xb3b5=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x3b5b[_0x21c2c8];return _0x4dd745;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3b5('0x0'))('api');var moment=require(_0xb3b5('0x1'));var BPromise=require(_0xb3b5('0x2'));var rp=require(_0xb3b5('0x3'));var fs=require('fs');var path=require(_0xb3b5('0x4'));var rimraf=require(_0xb3b5('0x5'));var config=require(_0xb3b5('0x6'));var attributes=require(_0xb3b5('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xbf81c4,_0x49a4f0){return _0xbf81c4[_0xb3b5('0x8')](_0xb3b5('0x9'),attributes,{'tableName':_0xb3b5('0xa'),'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 bd84b83..6dc92c7 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 _0xc370=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','then','util'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0xc370,0x13a));var _0x0c37=function(_0x1d01de,_0x44c9d2){_0x1d01de=_0x1d01de-0x0;var _0x210517=_0xc370[_0x1d01de];return _0x210517;};'use strict';var _=require('lodash');var util=require(_0x0c37('0x0'));var moment=require('moment');var BPromise=require(_0x0c37('0x1'));var rs=require(_0x0c37('0x2'));var fs=require('fs');var Redis=require(_0x0c37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c37('0x4'));var logger=require(_0x0c37('0x5'))(_0x0c37('0x6'));var config=require('../../config/environment');var jayson=require(_0x0c37('0x7'));var client=jayson[_0x0c37('0x8')][_0x0c37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9095d2,_0x41d4a9,_0x47d43b){return new BPromise(function(_0x220d07,_0x196df3){return client[_0x0c37('0xa')](_0x9095d2,_0x47d43b)['then'](function(_0x51aa22){logger[_0x0c37('0xb')](_0x0c37('0xc'),_0x41d4a9,_0x0c37('0xd'));logger[_0x0c37('0xe')](_0x0c37('0xf'),_0x41d4a9,_0x0c37('0xd'),JSON['stringify'](_0x51aa22));if(_0x51aa22[_0x0c37('0x10')]){if(_0x51aa22[_0x0c37('0x10')][_0x0c37('0x11')]===0x1f4){logger[_0x0c37('0x10')](_0x0c37('0xc'),_0x41d4a9,_0x51aa22[_0x0c37('0x10')]['message']);return _0x196df3(_0x51aa22[_0x0c37('0x10')][_0x0c37('0x12')]);}logger[_0x0c37('0x10')](_0x0c37('0xc'),_0x41d4a9,_0x51aa22[_0x0c37('0x10')][_0x0c37('0x12')]);return _0x220d07(_0x51aa22[_0x0c37('0x10')][_0x0c37('0x12')]);}else{logger[_0x0c37('0xb')](_0x0c37('0xc'),_0x41d4a9,_0x0c37('0xd'));_0x220d07(_0x51aa22[_0x0c37('0x13')][_0x0c37('0x12')]);}})[_0x0c37('0x14')](function(_0x47ed31){logger[_0x0c37('0x10')](_0x0c37('0xc'),_0x41d4a9,_0x47ed31);_0x196df3(_0x47ed31);});});}exports[_0x0c37('0x15')]=function(_0x4961ce){var _0x226153=this;return new Promise(function(_0x4d2f37,_0x1ffba1){return db[_0x0c37('0x16')][_0x0c37('0x17')]({'raw':_0x4961ce[_0x0c37('0x18')]?_0x4961ce[_0x0c37('0x18')][_0x0c37('0x19')]===undefined?!![]:![]:!![],'where':_0x4961ce[_0x0c37('0x18')]?_0x4961ce[_0x0c37('0x18')][_0x0c37('0x1a')]||null:null,'attributes':_0x4961ce[_0x0c37('0x18')]?_0x4961ce['options'][_0x0c37('0x1b')]||null:null,'limit':_0x4961ce[_0x0c37('0x18')]?_0x4961ce['options'][_0x0c37('0x1c')]||null:null,'include':_0x4961ce[_0x0c37('0x18')]?_0x4961ce[_0x0c37('0x18')][_0x0c37('0x1d')]?_[_0x0c37('0x1e')](_0x4961ce[_0x0c37('0x18')][_0x0c37('0x1d')],function(_0x2b8788){return{'model':db[_0x2b8788[_0x0c37('0x1f')]],'as':_0x2b8788['as'],'attributes':_0x2b8788[_0x0c37('0x1b')],'include':_0x2b8788['include']?_[_0x0c37('0x1e')](_0x2b8788['include'],function(_0x344214){return{'model':db[_0x344214[_0x0c37('0x1f')]],'as':_0x344214['as'],'attributes':_0x344214['attributes'],'include':_0x344214[_0x0c37('0x1d')]?_[_0x0c37('0x1e')](_0x344214[_0x0c37('0x1d')],function(_0xe1b422){return{'model':db[_0xe1b422['model']],'as':_0xe1b422['as'],'attributes':_0xe1b422[_0x0c37('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x295ee){logger[_0x0c37('0xb')](_0x0c37('0x15'),_0x4961ce);logger['debug'](_0x0c37('0x15'),_0x4961ce,JSON[_0x0c37('0x20')](_0x295ee));_0x4d2f37(_0x295ee);})[_0x0c37('0x14')](function(_0x4e7293){logger[_0x0c37('0x10')](_0x0c37('0x15'),_0x4e7293['message'],_0x4961ce);_0x1ffba1(_0x226153['error'](0x1f4,_0x4e7293[_0x0c37('0x12')]));});});};exports[_0x0c37('0x21')]=function(_0x58126b){var _0x408ac9=this;return new Promise(function(_0x3141c0,_0x550b57){return db[_0x0c37('0x16')]['find']({'raw':_0x58126b[_0x0c37('0x18')]?_0x58126b[_0x0c37('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58126b[_0x0c37('0x18')]?_0x58126b[_0x0c37('0x18')][_0x0c37('0x1a')]||null:null,'attributes':_0x58126b[_0x0c37('0x18')]?_0x58126b['options'][_0x0c37('0x1b')]||null:null,'include':_0x58126b[_0x0c37('0x18')]?_0x58126b[_0x0c37('0x18')][_0x0c37('0x1d')]?_[_0x0c37('0x1e')](_0x58126b[_0x0c37('0x18')][_0x0c37('0x1d')],function(_0x3926dd){return{'model':db[_0x3926dd[_0x0c37('0x1f')]],'as':_0x3926dd['as'],'attributes':_0x3926dd[_0x0c37('0x1b')],'include':_0x3926dd['include']?_[_0x0c37('0x1e')](_0x3926dd['include'],function(_0x167e36){return{'model':db[_0x167e36[_0x0c37('0x1f')]],'as':_0x167e36['as'],'attributes':_0x167e36[_0x0c37('0x1b')],'include':_0x167e36[_0x0c37('0x1d')]?_[_0x0c37('0x1e')](_0x167e36['include'],function(_0x2bd2fc){return{'model':db[_0x2bd2fc['model']],'as':_0x2bd2fc['as'],'attributes':_0x2bd2fc[_0x0c37('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0c37('0x22')](function(_0x2f3bda){logger[_0x0c37('0xb')](_0x0c37('0x21'),_0x58126b);logger[_0x0c37('0xe')](_0x0c37('0x21'),_0x58126b,JSON[_0x0c37('0x20')](_0x2f3bda));_0x3141c0(_0x2f3bda);})['catch'](function(_0x237cc2){logger['error'](_0x0c37('0x21'),_0x237cc2[_0x0c37('0x12')],_0x58126b);_0x550b57(_0x408ac9[_0x0c37('0x10')](0x1f4,_0x237cc2[_0x0c37('0x12')]));});});}; \ No newline at end of file +var _0xc900=['debug','request\x20sent','stringify','error','code','message','result','GetFreshdeskAccount','findAll','options','raw','attributes','include','map','model','catch','ShowFreshdeskAccount','FreshdeskAccount','where','lodash','util','bluebird','ioredis','../../config/utils','rpc','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x1b352e,_0x3b5e60){var _0x31d1e8=function(_0x3cca4f){while(--_0x3cca4f){_0x1b352e['push'](_0x1b352e['shift']());}};_0x31d1e8(++_0x3b5e60);}(_0xc900,0xc7));var _0x0c90=function(_0xcd35ba,_0x1dd745){_0xcd35ba=_0xcd35ba-0x0;var _0x446b89=_0xc900[_0xcd35ba];return _0x446b89;};'use strict';var _=require(_0x0c90('0x0'));var util=require(_0x0c90('0x1'));var moment=require('moment');var BPromise=require(_0x0c90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c90('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0c90('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34b482,_0x3bf50c,_0x9d243e){return new BPromise(function(_0x5a43df,_0x12e6e0){return client[_0x0c90('0x7')](_0x34b482,_0x9d243e)[_0x0c90('0x8')](function(_0x406d55){logger[_0x0c90('0x9')](_0x0c90('0xa'),_0x3bf50c,'request\x20sent');logger[_0x0c90('0xb')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3bf50c,_0x0c90('0xc'),JSON[_0x0c90('0xd')](_0x406d55));if(_0x406d55[_0x0c90('0xe')]){if(_0x406d55[_0x0c90('0xe')][_0x0c90('0xf')]===0x1f4){logger[_0x0c90('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x3bf50c,_0x406d55[_0x0c90('0xe')][_0x0c90('0x10')]);return _0x12e6e0(_0x406d55[_0x0c90('0xe')]['message']);}logger[_0x0c90('0xe')](_0x0c90('0xa'),_0x3bf50c,_0x406d55[_0x0c90('0xe')]['message']);return _0x5a43df(_0x406d55[_0x0c90('0xe')][_0x0c90('0x10')]);}else{logger[_0x0c90('0x9')](_0x0c90('0xa'),_0x3bf50c,_0x0c90('0xc'));_0x5a43df(_0x406d55[_0x0c90('0x11')][_0x0c90('0x10')]);}})['catch'](function(_0x3bf2a1){logger[_0x0c90('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x3bf50c,_0x3bf2a1);_0x12e6e0(_0x3bf2a1);});});}exports[_0x0c90('0x12')]=function(_0x4e3a61){var _0x4b9383=this;return new Promise(function(_0x4a077c,_0x4596db){return db['FreshdeskAccount'][_0x0c90('0x13')]({'raw':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')][_0x0c90('0x15')]===undefined?!![]:![]:!![],'where':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')]['where']||null:null,'attributes':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61['options'][_0x0c90('0x16')]||null:null,'limit':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')]['limit']||null:null,'include':_0x4e3a61[_0x0c90('0x14')]?_0x4e3a61[_0x0c90('0x14')][_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x4e3a61[_0x0c90('0x14')]['include'],function(_0x21fba6){return{'model':db[_0x21fba6['model']],'as':_0x21fba6['as'],'attributes':_0x21fba6[_0x0c90('0x16')],'include':_0x21fba6['include']?_[_0x0c90('0x18')](_0x21fba6[_0x0c90('0x17')],function(_0xae29b9){return{'model':db[_0xae29b9[_0x0c90('0x19')]],'as':_0xae29b9['as'],'attributes':_0xae29b9[_0x0c90('0x16')],'include':_0xae29b9['include']?_[_0x0c90('0x18')](_0xae29b9[_0x0c90('0x17')],function(_0x121d3a){return{'model':db[_0x121d3a[_0x0c90('0x19')]],'as':_0x121d3a['as'],'attributes':_0x121d3a[_0x0c90('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0c90('0x8')](function(_0xfbed99){logger[_0x0c90('0x9')](_0x0c90('0x12'),_0x4e3a61);logger[_0x0c90('0xb')](_0x0c90('0x12'),_0x4e3a61,JSON[_0x0c90('0xd')](_0xfbed99));_0x4a077c(_0xfbed99);})[_0x0c90('0x1a')](function(_0x49ae1a){logger[_0x0c90('0xe')](_0x0c90('0x12'),_0x49ae1a[_0x0c90('0x10')],_0x4e3a61);_0x4596db(_0x4b9383[_0x0c90('0xe')](0x1f4,_0x49ae1a[_0x0c90('0x10')]));});});};exports[_0x0c90('0x1b')]=function(_0x3f88b1){var _0x16980a=this;return new Promise(function(_0x40304e,_0x27f3b3){return db[_0x0c90('0x1c')]['find']({'raw':_0x3f88b1['options']?_0x3f88b1[_0x0c90('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3f88b1[_0x0c90('0x14')]?_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x1d')]||null:null,'attributes':_0x3f88b1['options']?_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x16')]||null:null,'include':_0x3f88b1[_0x0c90('0x14')]?_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x3f88b1[_0x0c90('0x14')][_0x0c90('0x17')],function(_0x53873b){return{'model':db[_0x53873b[_0x0c90('0x19')]],'as':_0x53873b['as'],'attributes':_0x53873b[_0x0c90('0x16')],'include':_0x53873b[_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x53873b[_0x0c90('0x17')],function(_0x30c48f){return{'model':db[_0x30c48f[_0x0c90('0x19')]],'as':_0x30c48f['as'],'attributes':_0x30c48f[_0x0c90('0x16')],'include':_0x30c48f[_0x0c90('0x17')]?_[_0x0c90('0x18')](_0x30c48f['include'],function(_0x390e55){return{'model':db[_0x390e55[_0x0c90('0x19')]],'as':_0x390e55['as'],'attributes':_0x390e55[_0x0c90('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe2a8f8){logger[_0x0c90('0x9')](_0x0c90('0x1b'),_0x3f88b1);logger[_0x0c90('0xb')]('ShowFreshdeskAccount',_0x3f88b1,JSON[_0x0c90('0xd')](_0xe2a8f8));_0x40304e(_0xe2a8f8);})[_0x0c90('0x1a')](function(_0x5213af){logger[_0x0c90('0xe')](_0x0c90('0x1b'),_0x5213af[_0x0c90('0x10')],_0x3f88b1);_0x27f3b3(_0x16980a[_0x0c90('0xe')](0x1f4,_0x5213af[_0x0c90('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8e21f75..434ad89 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 _0x8db4=['/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','get','/:id','show'];(function(_0x43b124,_0x2fe4bd){var _0x57a27a=function(_0x1645f2){while(--_0x1645f2){_0x43b124['push'](_0x43b124['shift']());}};_0x57a27a(++_0x2fe4bd);}(_0x8db4,0x143));var _0x48db=function(_0x3010a6,_0x37fddd){_0x3010a6=_0x3010a6-0x0;var _0x250c32=_0x8db4[_0x3010a6];return _0x250c32;};'use strict';var multer=require('multer');var util=require(_0x48db('0x0'));var path=require(_0x48db('0x1'));var timeout=require(_0x48db('0x2'));var express=require(_0x48db('0x3'));var router=express[_0x48db('0x4')]();var fs_extra=require(_0x48db('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x48db('0x6'));var config=require(_0x48db('0x7'));var controller=require(_0x48db('0x8'));router['get']('/',auth[_0x48db('0x9')](),controller['index']);router[_0x48db('0xa')](_0x48db('0xb'),auth['isAuthenticated'](),controller[_0x48db('0xc')]);router['get'](_0x48db('0xd'),auth[_0x48db('0x9')](),controller['getFields']);router[_0x48db('0xa')](_0x48db('0xe'),auth[_0x48db('0x9')](),controller[_0x48db('0xf')]);router[_0x48db('0xa')]('/:id/descriptions',auth[_0x48db('0x9')](),controller[_0x48db('0x10')]);router['get'](_0x48db('0x11'),auth[_0x48db('0x9')](),controller[_0x48db('0x12')]);router[_0x48db('0x13')]('/',auth[_0x48db('0x9')](),controller[_0x48db('0x14')]);router[_0x48db('0x13')](_0x48db('0x11'),auth[_0x48db('0x9')](),controller[_0x48db('0x15')]);router[_0x48db('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x48db('0x17')]);router['delete'](_0x48db('0xb'),auth[_0x48db('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf4cb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x3f1676,_0x5e7f1b){var _0x35fd86=function(_0x2d1609){while(--_0x2d1609){_0x3f1676['push'](_0x3f1676['shift']());}};_0x35fd86(++_0x5e7f1b);}(_0xf4cb,0xb7));var _0xbf4c=function(_0x495d3a,_0x367559){_0x495d3a=_0x495d3a-0x0;var _0x31235d=_0xf4cb[_0x495d3a];return _0x31235d;};'use strict';var multer=require(_0xbf4c('0x0'));var util=require(_0xbf4c('0x1'));var path=require(_0xbf4c('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf4c('0x3'));var router=express[_0xbf4c('0x4')]();var fs_extra=require(_0xbf4c('0x5'));var auth=require(_0xbf4c('0x6'));var interaction=require(_0xbf4c('0x7'));var config=require(_0xbf4c('0x8'));var controller=require(_0xbf4c('0x9'));router[_0xbf4c('0xa')]('/',auth[_0xbf4c('0xb')](),controller[_0xbf4c('0xc')]);router[_0xbf4c('0xa')](_0xbf4c('0xd'),auth[_0xbf4c('0xb')](),controller[_0xbf4c('0xe')]);router[_0xbf4c('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbf4c('0xf')]);router['get'](_0xbf4c('0x10'),auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x11')]);router[_0xbf4c('0xa')](_0xbf4c('0x12'),auth[_0xbf4c('0xb')](),controller['getDescriptions']);router[_0xbf4c('0xa')](_0xbf4c('0x13'),auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x14')]);router[_0xbf4c('0x15')]('/',auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x16')]);router[_0xbf4c('0x15')](_0xbf4c('0x13'),auth['isAuthenticated'](),controller[_0xbf4c('0x17')]);router[_0xbf4c('0x18')](_0xbf4c('0xd'),auth[_0xbf4c('0xb')](),controller['update']);router[_0xbf4c('0x19')]('/:id',auth[_0xbf4c('0xb')](),controller[_0xbf4c('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index fd22869..1be40d9 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 _0x330d=['STRING','sequelize','exports'];(function(_0x3ac4e1,_0x3515e5){var _0x590dd4=function(_0x174705){while(--_0x174705){_0x3ac4e1['push'](_0x3ac4e1['shift']());}};_0x590dd4(++_0x3515e5);}(_0x330d,0x1c9));var _0xd330=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x330d[_0x31991b];return _0x307304;};'use strict';var Sequelize=require(_0xd330('0x0'));module[_0xd330('0x1')]={'name':{'type':Sequelize[_0xd330('0x2')]},'description':{'type':Sequelize[_0xd330('0x2')]}}; \ No newline at end of file +var _0x1f5c=['sequelize','STRING'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x1f5c,0x82));var _0xc1f5=function(_0x59dc12,_0x1ec155){_0x59dc12=_0x59dc12-0x0;var _0x20befc=_0x1f5c[_0x59dc12];return _0x20befc;};'use strict';var Sequelize=require(_0xc1f5('0x0'));module['exports']={'name':{'type':Sequelize[_0xc1f5('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b144b31..61ecc4f 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 _0x0885=['undefined','count','offset','limit','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x201f73,_0x42dfd3){var _0x5c6661=function(_0x5e803a){while(--_0x5e803a){_0x201f73['push'](_0x201f73['shift']());}};_0x5c6661(++_0x42dfd3);}(_0x0885,0x1e7));var _0x5088=function(_0x317e30,_0x32ad66){_0x317e30=_0x317e30-0x0;var _0x203788=_0x0885[_0x317e30];return _0x203788;};'use strict';var emlformat=require(_0x5088('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5088('0x1'));var jsonpatch=require(_0x5088('0x2'));var rp=require('request-promise');var moment=require(_0x5088('0x3'));var BPromise=require(_0x5088('0x4'));var Mustache=require(_0x5088('0x5'));var util=require(_0x5088('0x6'));var path=require(_0x5088('0x7'));var sox=require('sox');var csv=require(_0x5088('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5088('0x9'));var _=require(_0x5088('0xa'));var squel=require(_0x5088('0xb'));var crypto=require(_0x5088('0xc'));var jsforce=require(_0x5088('0xd'));var deskjs=require(_0x5088('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5088('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5088('0x10'));var qs=require(_0x5088('0x11'));var as=require(_0x5088('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5088('0x13'))(_0x5088('0x14'));var utils=require(_0x5088('0x15'));var config=require(_0x5088('0x16'));var licenseUtil=require(_0x5088('0x17'));var db=require(_0x5088('0x18'))['db'];function respondWithStatusCode(_0xad358,_0x1804bb){_0x1804bb=_0x1804bb||0xcc;return function(_0x505e3c){if(_0x505e3c){return _0xad358[_0x5088('0x19')](_0x1804bb);}return _0xad358[_0x5088('0x1a')](_0x1804bb)[_0x5088('0x1b')]();};}function respondWithResult(_0x30ec0b,_0x95ec1d){_0x95ec1d=_0x95ec1d||0xc8;return function(_0x31d75a){if(_0x31d75a){return _0x30ec0b[_0x5088('0x1a')](_0x95ec1d)[_0x5088('0x1c')](_0x31d75a);}};}function respondWithFilteredResult(_0x41deab,_0x377b41){return function(_0x4aa369){if(_0x4aa369){var _0x447149=typeof _0x377b41['offset']===_0x5088('0x1d')&&typeof _0x377b41['limit']==='undefined';var _0x57d58d=_0x4aa369[_0x5088('0x1e')];var _0x5e65ff=_0x447149?0x0:_0x377b41[_0x5088('0x1f')];var _0x283e57=_0x447149?_0x4aa369[_0x5088('0x1e')]:_0x377b41[_0x5088('0x1f')]+_0x377b41[_0x5088('0x20')];var _0x17db02;if(_0x283e57>=_0x57d58d){_0x283e57=_0x57d58d;_0x17db02=0xc8;}else{_0x17db02=0xce;}_0x41deab[_0x5088('0x1a')](_0x17db02);return _0x41deab[_0x5088('0x21')]('Content-Range',_0x5e65ff+'-'+_0x283e57+'/'+_0x57d58d)[_0x5088('0x1c')](_0x4aa369);}return null;};}function patchUpdates(_0x5830a5){return function(_0x45eabc){try{jsonpatch[_0x5088('0x22')](_0x45eabc,_0x5830a5,!![]);}catch(_0x479f5a){return BPromise[_0x5088('0x23')](_0x479f5a);}return _0x45eabc[_0x5088('0x24')]();};}function saveUpdates(_0x4e736b,_0x3757ae){return function(_0x4286a5){if(_0x4286a5){return _0x4286a5['update'](_0x4e736b)['then'](function(_0x2e2851){return _0x2e2851;});}return null;};}function removeEntity(_0x40badb,_0x2ccd5f){return function(_0x55d177){if(_0x55d177){return _0x55d177[_0x5088('0x25')]()[_0x5088('0x26')](function(){_0x40badb[_0x5088('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9ff28,_0x3b2e56){return function(_0x107e7d){if(!_0x107e7d){_0xb9ff28[_0x5088('0x19')](0x194);}return _0x107e7d;};}function handleError(_0x33a8bb,_0x5bcf41){_0x5bcf41=_0x5bcf41||0x1f4;return function(_0x1db57a){logger[_0x5088('0x27')](_0x1db57a[_0x5088('0x28')]);if(_0x1db57a[_0x5088('0x29')]){delete _0x1db57a[_0x5088('0x29')];}_0x33a8bb['status'](_0x5bcf41)[_0x5088('0x2a')](_0x1db57a);};}exports[_0x5088('0x2b')]=function(_0xcb0b55,_0x310cf5){var _0x4785a9={},_0x598e9f={},_0x18311a={'count':0x0,'rows':[]};var _0x38c9a9=_[_0x5088('0x2c')](db[_0x5088('0x2d')][_0x5088('0x2e')],function(_0x24841f){return{'name':_0x24841f['fieldName'],'type':_0x24841f[_0x5088('0x2f')]['key']};});_0x598e9f[_0x5088('0x30')]=_[_0x5088('0x2c')](_0x38c9a9,'name');_0x598e9f[_0x5088('0x31')]=_['keys'](_0xcb0b55['query']);_0x598e9f[_0x5088('0x32')]=_[_0x5088('0x33')](_0x598e9f[_0x5088('0x30')],_0x598e9f[_0x5088('0x31')]);_0x4785a9[_0x5088('0x34')]=_[_0x5088('0x33')](_0x598e9f[_0x5088('0x30')],qs[_0x5088('0x35')](_0xcb0b55[_0x5088('0x31')]['fields']));_0x4785a9[_0x5088('0x34')]=_0x4785a9[_0x5088('0x34')]['length']?_0x4785a9[_0x5088('0x34')]:_0x598e9f[_0x5088('0x30')];if(!_0xcb0b55[_0x5088('0x31')]['hasOwnProperty'](_0x5088('0x36'))){_0x4785a9[_0x5088('0x20')]=qs[_0x5088('0x20')](_0xcb0b55[_0x5088('0x31')][_0x5088('0x20')]);_0x4785a9[_0x5088('0x1f')]=qs['offset'](_0xcb0b55[_0x5088('0x31')][_0x5088('0x1f')]);}_0x4785a9[_0x5088('0x37')]=qs[_0x5088('0x38')](_0xcb0b55['query'][_0x5088('0x38')]);_0x4785a9[_0x5088('0x39')]=qs[_0x5088('0x32')](_[_0x5088('0x3a')](_0xcb0b55['query'],_0x598e9f['filters']),_0x38c9a9);if(_0xcb0b55['query'][_0x5088('0x3b')]){_0x4785a9[_0x5088('0x39')]=_['merge'](_0x4785a9['where'],{'$or':_['map'](_0x38c9a9,function(_0x4e9523){if(_0x4e9523['type']!==_0x5088('0x3c')){var _0x462b58={};_0x462b58[_0x4e9523[_0x5088('0x29')]]={'$like':'%'+_0xcb0b55[_0x5088('0x31')][_0x5088('0x3b')]+'%'};return _0x462b58;}})});}_0x4785a9=_[_0x5088('0x3d')]({},_0x4785a9,_0xcb0b55[_0x5088('0x3e')]);var _0x4d7a0e={'where':_0x4785a9[_0x5088('0x39')]};return db[_0x5088('0x2d')][_0x5088('0x1e')](_0x4d7a0e)[_0x5088('0x26')](function(_0x20d8b2){_0x18311a[_0x5088('0x1e')]=_0x20d8b2;if(_0xcb0b55[_0x5088('0x31')][_0x5088('0x3f')]){_0x4785a9[_0x5088('0x40')]=[{'all':!![]}];}return db[_0x5088('0x2d')][_0x5088('0x41')](_0x4785a9);})['then'](function(_0x174b3c){_0x18311a[_0x5088('0x42')]=_0x174b3c;return _0x18311a;})['then'](respondWithFilteredResult(_0x310cf5,_0x4785a9))[_0x5088('0x43')](handleError(_0x310cf5,null));};exports[_0x5088('0x44')]=function(_0x5e5fc8,_0x220a02){var _0x4f6349={'raw':![],'where':{'id':_0x5e5fc8[_0x5088('0x45')]['id']}},_0x4cd52e={};_0x4cd52e[_0x5088('0x30')]=_[_0x5088('0x46')](db['FreshdeskConfiguration'][_0x5088('0x2e')]);_0x4cd52e[_0x5088('0x31')]=_[_0x5088('0x46')](_0x5e5fc8[_0x5088('0x31')]);_0x4cd52e[_0x5088('0x32')]=_[_0x5088('0x33')](_0x4cd52e['model'],_0x4cd52e[_0x5088('0x31')]);_0x4f6349[_0x5088('0x34')]=_[_0x5088('0x33')](_0x4cd52e[_0x5088('0x30')],qs[_0x5088('0x35')](_0x5e5fc8['query']['fields']));_0x4f6349[_0x5088('0x34')]=_0x4f6349[_0x5088('0x34')][_0x5088('0x47')]?_0x4f6349['attributes']:_0x4cd52e[_0x5088('0x30')];if(_0x5e5fc8[_0x5088('0x31')]['includeAll']){_0x4f6349[_0x5088('0x40')]=[{'all':!![]}];}_0x4f6349=_['merge']({},_0x4f6349,_0x5e5fc8['options']);return db[_0x5088('0x2d')][_0x5088('0x48')](_0x4f6349)[_0x5088('0x26')](handleEntityNotFound(_0x220a02,null))['then'](respondWithResult(_0x220a02,null))['catch'](handleError(_0x220a02,null));};exports[_0x5088('0x49')]=function(_0xa3a7a,_0xd8a3c7){return db[_0x5088('0x2d')][_0x5088('0x49')](_0xa3a7a[_0x5088('0x4a')],{})[_0x5088('0x26')](respondWithResult(_0xd8a3c7,0xc9))[_0x5088('0x43')](handleError(_0xd8a3c7,null));};exports[_0x5088('0x4b')]=function(_0x19becd,_0x3627a6){if(_0x19becd[_0x5088('0x4a')]['id']){delete _0x19becd[_0x5088('0x4a')]['id'];}return db[_0x5088('0x2d')][_0x5088('0x48')]({'where':{'id':_0x19becd[_0x5088('0x45')]['id']}})['then'](handleEntityNotFound(_0x3627a6,null))[_0x5088('0x26')](saveUpdates(_0x19becd['body'],null))[_0x5088('0x26')](respondWithResult(_0x3627a6,null))['catch'](handleError(_0x3627a6,null));};exports[_0x5088('0x25')]=function(_0x149ee0,_0x22c2a4){return db[_0x5088('0x2d')][_0x5088('0x48')]({'where':{'id':_0x149ee0[_0x5088('0x45')]['id']}})[_0x5088('0x26')](handleEntityNotFound(_0x22c2a4,null))[_0x5088('0x26')](removeEntity(_0x22c2a4,null))[_0x5088('0x43')](handleError(_0x22c2a4,null));};exports[_0x5088('0x4c')]=function(_0x2316bb,_0x35cdba,_0x39ec3d){var _0x5431dd={};var _0x3472f1={};var _0x52a1c6;var _0x2c1569;return db[_0x5088('0x2d')][_0x5088('0x4d')]({'where':{'id':_0x2316bb[_0x5088('0x45')]['id']}})[_0x5088('0x26')](handleEntityNotFound(_0x35cdba,null))[_0x5088('0x26')](function(_0x36d3a0){if(_0x36d3a0){_0x52a1c6=_0x36d3a0;_0x3472f1['model']=_[_0x5088('0x46')](db[_0x5088('0x4e')][_0x5088('0x2e')]);_0x3472f1['query']=_[_0x5088('0x46')](_0x2316bb[_0x5088('0x31')]);_0x3472f1[_0x5088('0x32')]=_[_0x5088('0x33')](_0x3472f1[_0x5088('0x30')],_0x3472f1[_0x5088('0x31')]);_0x5431dd[_0x5088('0x34')]=_[_0x5088('0x33')](_0x3472f1[_0x5088('0x30')],qs['fields'](_0x2316bb[_0x5088('0x31')][_0x5088('0x35')]));_0x5431dd[_0x5088('0x34')]=_0x5431dd[_0x5088('0x34')][_0x5088('0x47')]?_0x5431dd['attributes']:_0x3472f1[_0x5088('0x30')];_0x5431dd[_0x5088('0x37')]=qs['sort'](_0x2316bb[_0x5088('0x31')][_0x5088('0x38')]);_0x5431dd[_0x5088('0x39')]=qs[_0x5088('0x32')](_['pick'](_0x2316bb['query'],_0x3472f1['filters']));if(_0x2316bb[_0x5088('0x31')][_0x5088('0x3b')]){_0x5431dd['where']=_[_0x5088('0x3d')](_0x5431dd[_0x5088('0x39')],{'$or':_['map'](_0x5431dd[_0x5088('0x34')],function(_0x221291){var _0x5f4e2f={};_0x5f4e2f[_0x221291]={'$like':'%'+_0x2316bb[_0x5088('0x31')][_0x5088('0x3b')]+'%'};return _0x5f4e2f;})});}_0x5431dd=_[_0x5088('0x3d')]({},_0x5431dd,_0x2316bb[_0x5088('0x3e')]);return _0x52a1c6[_0x5088('0x4c')](_0x5431dd);}})[_0x5088('0x26')](function(_0x4c3b03){if(_0x4c3b03){_0x2c1569=_0x4c3b03[_0x5088('0x47')];if(!_0x2316bb[_0x5088('0x31')][_0x5088('0x4f')](_0x5088('0x36'))){_0x5431dd['limit']=qs['limit'](_0x2316bb[_0x5088('0x31')][_0x5088('0x20')]);_0x5431dd[_0x5088('0x1f')]=qs[_0x5088('0x1f')](_0x2316bb[_0x5088('0x31')][_0x5088('0x1f')]);}return _0x52a1c6['getFields'](_0x5431dd);}})[_0x5088('0x26')](function(_0x46742c){if(_0x46742c){return _0x46742c?{'count':_0x2c1569,'rows':_0x46742c}:null;}})[_0x5088('0x26')](respondWithResult(_0x35cdba,null))[_0x5088('0x43')](handleError(_0x35cdba,null));};exports['getSubjects']=function(_0x4a8403,_0x188341,_0x2fdfc0){var _0x522cbc={};var _0x5e0e45={};var _0x4f0cbc;var _0x5a7e4b;return db[_0x5088('0x2d')][_0x5088('0x4d')]({'where':{'id':_0x4a8403['params']['id']}})[_0x5088('0x26')](handleEntityNotFound(_0x188341,null))[_0x5088('0x26')](function(_0x4edd13){if(_0x4edd13){_0x4f0cbc=_0x4edd13;_0x5e0e45[_0x5088('0x30')]=_[_0x5088('0x46')](db[_0x5088('0x4e')][_0x5088('0x2e')]);_0x5e0e45['query']=_['keys'](_0x4a8403[_0x5088('0x31')]);_0x5e0e45[_0x5088('0x32')]=_[_0x5088('0x33')](_0x5e0e45[_0x5088('0x30')],_0x5e0e45[_0x5088('0x31')]);_0x522cbc['attributes']=_[_0x5088('0x33')](_0x5e0e45[_0x5088('0x30')],qs[_0x5088('0x35')](_0x4a8403[_0x5088('0x31')]['fields']));_0x522cbc[_0x5088('0x34')]=_0x522cbc[_0x5088('0x34')][_0x5088('0x47')]?_0x522cbc[_0x5088('0x34')]:_0x5e0e45['model'];_0x522cbc['order']=qs[_0x5088('0x38')](_0x4a8403[_0x5088('0x31')][_0x5088('0x38')]);_0x522cbc[_0x5088('0x39')]=qs[_0x5088('0x32')](_[_0x5088('0x3a')](_0x4a8403['query'],_0x5e0e45[_0x5088('0x32')]));if(_0x4a8403[_0x5088('0x31')][_0x5088('0x3b')]){_0x522cbc[_0x5088('0x39')]=_[_0x5088('0x3d')](_0x522cbc[_0x5088('0x39')],{'$or':_['map'](_0x522cbc['attributes'],function(_0x2dc5de){var _0x359880={};_0x359880[_0x2dc5de]={'$like':'%'+_0x4a8403['query']['filter']+'%'};return _0x359880;})});}_0x522cbc=_['merge']({},_0x522cbc,_0x4a8403['options']);return _0x4f0cbc[_0x5088('0x50')](_0x522cbc);}})[_0x5088('0x26')](function(_0x19db7e){if(_0x19db7e){_0x5a7e4b=_0x19db7e[_0x5088('0x47')];if(!_0x4a8403[_0x5088('0x31')][_0x5088('0x4f')]('nolimit')){_0x522cbc[_0x5088('0x20')]=qs[_0x5088('0x20')](_0x4a8403['query']['limit']);_0x522cbc[_0x5088('0x1f')]=qs[_0x5088('0x1f')](_0x4a8403[_0x5088('0x31')]['offset']);}return _0x4f0cbc[_0x5088('0x50')](_0x522cbc);}})[_0x5088('0x26')](function(_0x40a756){if(_0x40a756){return _0x40a756?{'count':_0x5a7e4b,'rows':_0x40a756}:null;}})[_0x5088('0x26')](respondWithResult(_0x188341,null))[_0x5088('0x43')](handleError(_0x188341,null));};exports['getDescriptions']=function(_0xcfd2a2,_0x26527d,_0x40ef31){var _0x3eba0b={};var _0xdcbf0a={};var _0x41d88c;var _0x571957;return db['FreshdeskConfiguration'][_0x5088('0x4d')]({'where':{'id':_0xcfd2a2[_0x5088('0x45')]['id']}})['then'](handleEntityNotFound(_0x26527d,null))[_0x5088('0x26')](function(_0x682eff){if(_0x682eff){_0x41d88c=_0x682eff;_0xdcbf0a[_0x5088('0x30')]=_[_0x5088('0x46')](db['FreshdeskField']['rawAttributes']);_0xdcbf0a[_0x5088('0x31')]=_[_0x5088('0x46')](_0xcfd2a2['query']);_0xdcbf0a[_0x5088('0x32')]=_[_0x5088('0x33')](_0xdcbf0a[_0x5088('0x30')],_0xdcbf0a[_0x5088('0x31')]);_0x3eba0b[_0x5088('0x34')]=_[_0x5088('0x33')](_0xdcbf0a['model'],qs['fields'](_0xcfd2a2[_0x5088('0x31')]['fields']));_0x3eba0b['attributes']=_0x3eba0b[_0x5088('0x34')]['length']?_0x3eba0b[_0x5088('0x34')]:_0xdcbf0a[_0x5088('0x30')];_0x3eba0b[_0x5088('0x37')]=qs['sort'](_0xcfd2a2[_0x5088('0x31')][_0x5088('0x38')]);_0x3eba0b[_0x5088('0x39')]=qs[_0x5088('0x32')](_['pick'](_0xcfd2a2[_0x5088('0x31')],_0xdcbf0a[_0x5088('0x32')]));if(_0xcfd2a2['query'][_0x5088('0x3b')]){_0x3eba0b[_0x5088('0x39')]=_[_0x5088('0x3d')](_0x3eba0b[_0x5088('0x39')],{'$or':_[_0x5088('0x2c')](_0x3eba0b[_0x5088('0x34')],function(_0x56597f){var _0x342d06={};_0x342d06[_0x56597f]={'$like':'%'+_0xcfd2a2['query'][_0x5088('0x3b')]+'%'};return _0x342d06;})});}_0x3eba0b=_['merge']({},_0x3eba0b,_0xcfd2a2[_0x5088('0x3e')]);return _0x41d88c[_0x5088('0x51')](_0x3eba0b);}})[_0x5088('0x26')](function(_0x56b6a3){if(_0x56b6a3){_0x571957=_0x56b6a3[_0x5088('0x47')];if(!_0xcfd2a2[_0x5088('0x31')]['hasOwnProperty'](_0x5088('0x36'))){_0x3eba0b[_0x5088('0x20')]=qs[_0x5088('0x20')](_0xcfd2a2[_0x5088('0x31')][_0x5088('0x20')]);_0x3eba0b[_0x5088('0x1f')]=qs[_0x5088('0x1f')](_0xcfd2a2[_0x5088('0x31')][_0x5088('0x1f')]);}return _0x41d88c[_0x5088('0x51')](_0x3eba0b);}})['then'](function(_0x44affe){if(_0x44affe){return _0x44affe?{'count':_0x571957,'rows':_0x44affe}:null;}})[_0x5088('0x26')](respondWithResult(_0x26527d,null))[_0x5088('0x43')](handleError(_0x26527d,null));};exports[_0x5088('0x52')]=function(_0x3b8742,_0x912159,_0x52e223){var _0x455b33={};var _0x5e33e5={};var _0x43955e;var _0x1dd9e0;return db['FreshdeskConfiguration'][_0x5088('0x4d')]({'where':{'id':_0x3b8742[_0x5088('0x45')]['id']}})[_0x5088('0x26')](handleEntityNotFound(_0x912159,null))[_0x5088('0x26')](function(_0x2d8b09){if(_0x2d8b09){_0x43955e=_0x2d8b09;_0x5e33e5[_0x5088('0x30')]=_[_0x5088('0x46')](db[_0x5088('0x53')][_0x5088('0x2e')]);_0x5e33e5[_0x5088('0x31')]=_['keys'](_0x3b8742['query']);_0x5e33e5[_0x5088('0x32')]=_[_0x5088('0x33')](_0x5e33e5[_0x5088('0x30')],_0x5e33e5[_0x5088('0x31')]);_0x455b33[_0x5088('0x34')]=_[_0x5088('0x33')](_0x5e33e5['model'],qs[_0x5088('0x35')](_0x3b8742[_0x5088('0x31')][_0x5088('0x35')]));_0x455b33[_0x5088('0x34')]=_0x455b33['attributes'][_0x5088('0x47')]?_0x455b33[_0x5088('0x34')]:_0x5e33e5[_0x5088('0x30')];_0x455b33['order']=qs['sort'](_0x3b8742[_0x5088('0x31')][_0x5088('0x38')]);_0x455b33['where']=qs[_0x5088('0x32')](_[_0x5088('0x3a')](_0x3b8742[_0x5088('0x31')],_0x5e33e5[_0x5088('0x32')]));if(_0x3b8742['query'][_0x5088('0x3b')]){_0x455b33[_0x5088('0x39')]=_[_0x5088('0x3d')](_0x455b33[_0x5088('0x39')],{'$or':_['map'](_0x455b33[_0x5088('0x34')],function(_0x23e984){var _0x43cc68={};_0x43cc68[_0x23e984]={'$like':'%'+_0x3b8742[_0x5088('0x31')][_0x5088('0x3b')]+'%'};return _0x43cc68;})});}_0x455b33=_[_0x5088('0x3d')]({},_0x455b33,_0x3b8742['options']);return _0x43955e[_0x5088('0x52')](_0x455b33);}})[_0x5088('0x26')](function(_0x2c12f2){if(_0x2c12f2){_0x1dd9e0=_0x2c12f2[_0x5088('0x47')];if(!_0x3b8742[_0x5088('0x31')][_0x5088('0x4f')](_0x5088('0x36'))){_0x455b33[_0x5088('0x20')]=qs[_0x5088('0x20')](_0x3b8742[_0x5088('0x31')][_0x5088('0x20')]);_0x455b33[_0x5088('0x1f')]=qs['offset'](_0x3b8742[_0x5088('0x31')][_0x5088('0x1f')]);}return _0x43955e[_0x5088('0x52')](_0x455b33);}})[_0x5088('0x26')](function(_0x383b35){if(_0x383b35){return _0x383b35?{'count':_0x1dd9e0,'rows':_0x383b35}:null;}})[_0x5088('0x26')](respondWithResult(_0x912159,null))['catch'](handleError(_0x912159,null));};exports['setTags']=function(_0xb4b9e9,_0x20819f,_0x5a9445){if(_0xb4b9e9['body']['id']){delete _0xb4b9e9['body']['id'];}return db['FreshdeskConfiguration'][_0x5088('0x4d')]({'where':{'id':_0xb4b9e9['params']['id']}})['then'](handleEntityNotFound(_0x20819f,null))[_0x5088('0x26')](function(_0x398fdc){if(_0x398fdc){return _0x398fdc[_0x5088('0x54')](_0xb4b9e9[_0x5088('0x4a')][_0x5088('0x55')]||[]);}return null;})[_0x5088('0x26')](respondWithResult(_0x20819f,null))[_0x5088('0x43')](handleError(_0x20819f,null));}; \ No newline at end of file +var _0xfd87=['order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','catch','show','params','find','create','body','findOne','FreshdeskField','getFields','getSubjects','pick','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xfd87,0x100));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7fd8('0x0'));var rimraf=require(_0x7fd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fd8('0x2'));var rp=require('request-promise');var moment=require(_0x7fd8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7fd8('0x4'));var util=require(_0x7fd8('0x5'));var path=require(_0x7fd8('0x6'));var sox=require(_0x7fd8('0x7'));var csv=require(_0x7fd8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fd8('0x9'));var _=require(_0x7fd8('0xa'));var squel=require('squel');var crypto=require(_0x7fd8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7fd8('0xc'));var toCsv=require(_0x7fd8('0x8'));var querystring=require(_0x7fd8('0xd'));var Papa=require(_0x7fd8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fd8('0xf'));var as=require(_0x7fd8('0x10'));var hardwareService=require(_0x7fd8('0x11'));var logger=require('../../config/logger')(_0x7fd8('0x12'));var utils=require(_0x7fd8('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7fd8('0x14'))['db'];function respondWithStatusCode(_0x2d7111,_0x4f5a67){_0x4f5a67=_0x4f5a67||0xcc;return function(_0x2d48b2){if(_0x2d48b2){return _0x2d7111[_0x7fd8('0x15')](_0x4f5a67);}return _0x2d7111['status'](_0x4f5a67)[_0x7fd8('0x16')]();};}function respondWithResult(_0x15da1e,_0x510312){_0x510312=_0x510312||0xc8;return function(_0x526c1e){if(_0x526c1e){return _0x15da1e['status'](_0x510312)[_0x7fd8('0x17')](_0x526c1e);}};}function respondWithFilteredResult(_0x9e41,_0x2eeae3){return function(_0x4b3e33){if(_0x4b3e33){var _0x42a2f7=typeof _0x2eeae3['offset']===_0x7fd8('0x18')&&typeof _0x2eeae3[_0x7fd8('0x19')]===_0x7fd8('0x18');var _0x5283bd=_0x4b3e33[_0x7fd8('0x1a')];var _0x507ec2=_0x42a2f7?0x0:_0x2eeae3['offset'];var _0x138311=_0x42a2f7?_0x4b3e33[_0x7fd8('0x1a')]:_0x2eeae3[_0x7fd8('0x1b')]+_0x2eeae3[_0x7fd8('0x19')];var _0x5c8561;if(_0x138311>=_0x5283bd){_0x138311=_0x5283bd;_0x5c8561=0xc8;}else{_0x5c8561=0xce;}_0x9e41[_0x7fd8('0x1c')](_0x5c8561);return _0x9e41[_0x7fd8('0x1d')](_0x7fd8('0x1e'),_0x507ec2+'-'+_0x138311+'/'+_0x5283bd)[_0x7fd8('0x17')](_0x4b3e33);}return null;};}function patchUpdates(_0x2c2ebc){return function(_0x1112d6){try{jsonpatch[_0x7fd8('0x1f')](_0x1112d6,_0x2c2ebc,!![]);}catch(_0x50fd3a){return BPromise[_0x7fd8('0x20')](_0x50fd3a);}return _0x1112d6['save']();};}function saveUpdates(_0x59c11c,_0x43f5a5){return function(_0x2b72b3){if(_0x2b72b3){return _0x2b72b3[_0x7fd8('0x21')](_0x59c11c)['then'](function(_0x427b9a){return _0x427b9a;});}return null;};}function removeEntity(_0x2dc9f0,_0x153374){return function(_0x1c2bcf){if(_0x1c2bcf){return _0x1c2bcf['destroy']()[_0x7fd8('0x22')](function(){_0x2dc9f0['status'](0xcc)[_0x7fd8('0x16')]();});}};}function handleEntityNotFound(_0x7c0414,_0x28f587){return function(_0x5a3892){if(!_0x5a3892){_0x7c0414['sendStatus'](0x194);}return _0x5a3892;};}function handleError(_0xba74da,_0x5892a5){_0x5892a5=_0x5892a5||0x1f4;return function(_0x28d2de){logger['error'](_0x28d2de[_0x7fd8('0x23')]);if(_0x28d2de[_0x7fd8('0x24')]){delete _0x28d2de[_0x7fd8('0x24')];}_0xba74da['status'](_0x5892a5)['send'](_0x28d2de);};}exports[_0x7fd8('0x25')]=function(_0x16d57a,_0x153d26){var _0x28843d={},_0x136769={},_0x4211a1={'count':0x0,'rows':[]};var _0x3c4461=_[_0x7fd8('0x26')](db[_0x7fd8('0x27')][_0x7fd8('0x28')],function(_0x132d55){return{'name':_0x132d55[_0x7fd8('0x29')],'type':_0x132d55[_0x7fd8('0x2a')]['key']};});_0x136769[_0x7fd8('0x2b')]=_[_0x7fd8('0x26')](_0x3c4461,_0x7fd8('0x24'));_0x136769[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x16d57a[_0x7fd8('0x2c')]);_0x136769['filters']=_['intersection'](_0x136769[_0x7fd8('0x2b')],_0x136769[_0x7fd8('0x2c')]);_0x28843d[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x136769[_0x7fd8('0x2b')],qs[_0x7fd8('0x30')](_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x28843d[_0x7fd8('0x2e')]=_0x28843d[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0x28843d[_0x7fd8('0x2e')]:_0x136769[_0x7fd8('0x2b')];if(!_0x16d57a['query'][_0x7fd8('0x32')](_0x7fd8('0x33'))){_0x28843d['limit']=qs[_0x7fd8('0x19')](_0x16d57a[_0x7fd8('0x2c')]['limit']);_0x28843d[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x1b')]);}_0x28843d[_0x7fd8('0x34')]=qs['sort'](_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x35')]);_0x28843d[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_['pick'](_0x16d57a[_0x7fd8('0x2c')],_0x136769['filters']),_0x3c4461);if(_0x16d57a['query']['filter']){_0x28843d[_0x7fd8('0x36')]=_['merge'](_0x28843d[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x3c4461,function(_0x1ede67){if(_0x1ede67['type']!==_0x7fd8('0x38')){var _0x7dcd2c={};_0x7dcd2c[_0x1ede67['name']]={'$like':'%'+_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x39')]+'%'};return _0x7dcd2c;}})});}_0x28843d=_[_0x7fd8('0x3a')]({},_0x28843d,_0x16d57a[_0x7fd8('0x3b')]);var _0x23d6b1={'where':_0x28843d[_0x7fd8('0x36')]};return db['FreshdeskConfiguration'][_0x7fd8('0x1a')](_0x23d6b1)['then'](function(_0x31e102){_0x4211a1[_0x7fd8('0x1a')]=_0x31e102;if(_0x16d57a[_0x7fd8('0x2c')][_0x7fd8('0x3c')]){_0x28843d['include']=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x28843d);})[_0x7fd8('0x22')](function(_0x30b356){_0x4211a1['rows']=_0x30b356;return _0x4211a1;})[_0x7fd8('0x22')](respondWithFilteredResult(_0x153d26,_0x28843d))[_0x7fd8('0x3d')](handleError(_0x153d26,null));};exports[_0x7fd8('0x3e')]=function(_0x4cbf03,_0x440aea){var _0x17708d={'raw':![],'where':{'id':_0x4cbf03[_0x7fd8('0x3f')]['id']}},_0x5c9da5={};_0x5c9da5[_0x7fd8('0x2b')]=_[_0x7fd8('0x2d')](db['FreshdeskConfiguration'][_0x7fd8('0x28')]);_0x5c9da5[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x4cbf03[_0x7fd8('0x2c')]);_0x5c9da5[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x5c9da5[_0x7fd8('0x2b')],_0x5c9da5[_0x7fd8('0x2c')]);_0x17708d[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x5c9da5[_0x7fd8('0x2b')],qs['fields'](_0x4cbf03[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x17708d[_0x7fd8('0x2e')]=_0x17708d[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0x17708d[_0x7fd8('0x2e')]:_0x5c9da5[_0x7fd8('0x2b')];if(_0x4cbf03[_0x7fd8('0x2c')]['includeAll']){_0x17708d['include']=[{'all':!![]}];}_0x17708d=_[_0x7fd8('0x3a')]({},_0x17708d,_0x4cbf03[_0x7fd8('0x3b')]);return db['FreshdeskConfiguration'][_0x7fd8('0x40')](_0x17708d)[_0x7fd8('0x22')](handleEntityNotFound(_0x440aea,null))[_0x7fd8('0x22')](respondWithResult(_0x440aea,null))[_0x7fd8('0x3d')](handleError(_0x440aea,null));};exports[_0x7fd8('0x41')]=function(_0x202423,_0x436850){return db['FreshdeskConfiguration'][_0x7fd8('0x41')](_0x202423[_0x7fd8('0x42')],{})[_0x7fd8('0x22')](respondWithResult(_0x436850,0xc9))[_0x7fd8('0x3d')](handleError(_0x436850,null));};exports[_0x7fd8('0x21')]=function(_0x44beb6,_0x39d522){if(_0x44beb6['body']['id']){delete _0x44beb6[_0x7fd8('0x42')]['id'];}return db[_0x7fd8('0x27')][_0x7fd8('0x40')]({'where':{'id':_0x44beb6[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x39d522,null))[_0x7fd8('0x22')](saveUpdates(_0x44beb6[_0x7fd8('0x42')],null))[_0x7fd8('0x22')](respondWithResult(_0x39d522,null))[_0x7fd8('0x3d')](handleError(_0x39d522,null));};exports['destroy']=function(_0x2d790f,_0x2f410a){return db[_0x7fd8('0x27')][_0x7fd8('0x40')]({'where':{'id':_0x2d790f[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x2f410a,null))[_0x7fd8('0x22')](removeEntity(_0x2f410a,null))[_0x7fd8('0x3d')](handleError(_0x2f410a,null));};exports['getFields']=function(_0x587307,_0xd7bfb3,_0x5a7d0e){var _0x5bcbc0={};var _0x42e815={};var _0x4c5812;var _0x2c6689;return db['FreshdeskConfiguration'][_0x7fd8('0x43')]({'where':{'id':_0x587307[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0xd7bfb3,null))['then'](function(_0x4b1401){if(_0x4b1401){_0x4c5812=_0x4b1401;_0x42e815[_0x7fd8('0x2b')]=_[_0x7fd8('0x2d')](db[_0x7fd8('0x44')][_0x7fd8('0x28')]);_0x42e815[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x587307[_0x7fd8('0x2c')]);_0x42e815[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x42e815[_0x7fd8('0x2b')],_0x42e815[_0x7fd8('0x2c')]);_0x5bcbc0[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x42e815[_0x7fd8('0x2b')],qs['fields'](_0x587307[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x5bcbc0['attributes']=_0x5bcbc0[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0x5bcbc0[_0x7fd8('0x2e')]:_0x42e815[_0x7fd8('0x2b')];_0x5bcbc0['order']=qs['sort'](_0x587307[_0x7fd8('0x2c')][_0x7fd8('0x35')]);_0x5bcbc0[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_['pick'](_0x587307[_0x7fd8('0x2c')],_0x42e815[_0x7fd8('0x37')]));if(_0x587307['query'][_0x7fd8('0x39')]){_0x5bcbc0[_0x7fd8('0x36')]=_[_0x7fd8('0x3a')](_0x5bcbc0[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x5bcbc0[_0x7fd8('0x2e')],function(_0x177026){var _0x3bee3b={};_0x3bee3b[_0x177026]={'$like':'%'+_0x587307['query'][_0x7fd8('0x39')]+'%'};return _0x3bee3b;})});}_0x5bcbc0=_['merge']({},_0x5bcbc0,_0x587307[_0x7fd8('0x3b')]);return _0x4c5812[_0x7fd8('0x45')](_0x5bcbc0);}})[_0x7fd8('0x22')](function(_0x321fc1){if(_0x321fc1){_0x2c6689=_0x321fc1[_0x7fd8('0x31')];if(!_0x587307['query'][_0x7fd8('0x32')](_0x7fd8('0x33'))){_0x5bcbc0[_0x7fd8('0x19')]=qs['limit'](_0x587307['query'][_0x7fd8('0x19')]);_0x5bcbc0[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0x587307['query'][_0x7fd8('0x1b')]);}return _0x4c5812['getFields'](_0x5bcbc0);}})[_0x7fd8('0x22')](function(_0x471330){if(_0x471330){return _0x471330?{'count':_0x2c6689,'rows':_0x471330}:null;}})['then'](respondWithResult(_0xd7bfb3,null))[_0x7fd8('0x3d')](handleError(_0xd7bfb3,null));};exports[_0x7fd8('0x46')]=function(_0xe6a0da,_0x1ac1e9,_0x184482){var _0xa0394f={};var _0x48c1db={};var _0x1f149e;var _0x479e7d;return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0xe6a0da[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x1ac1e9,null))['then'](function(_0x125b2f){if(_0x125b2f){_0x1f149e=_0x125b2f;_0x48c1db[_0x7fd8('0x2b')]=_['keys'](db[_0x7fd8('0x44')][_0x7fd8('0x28')]);_0x48c1db[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0xe6a0da['query']);_0x48c1db[_0x7fd8('0x37')]=_['intersection'](_0x48c1db['model'],_0x48c1db[_0x7fd8('0x2c')]);_0xa0394f['attributes']=_['intersection'](_0x48c1db[_0x7fd8('0x2b')],qs[_0x7fd8('0x30')](_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0xa0394f[_0x7fd8('0x2e')]=_0xa0394f[_0x7fd8('0x2e')][_0x7fd8('0x31')]?_0xa0394f[_0x7fd8('0x2e')]:_0x48c1db[_0x7fd8('0x2b')];_0xa0394f['order']=qs[_0x7fd8('0x35')](_0xe6a0da[_0x7fd8('0x2c')]['sort']);_0xa0394f['where']=qs[_0x7fd8('0x37')](_[_0x7fd8('0x47')](_0xe6a0da['query'],_0x48c1db[_0x7fd8('0x37')]));if(_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x39')]){_0xa0394f[_0x7fd8('0x36')]=_['merge'](_0xa0394f[_0x7fd8('0x36')],{'$or':_['map'](_0xa0394f[_0x7fd8('0x2e')],function(_0x20fd73){var _0x2bb7c0={};_0x2bb7c0[_0x20fd73]={'$like':'%'+_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x39')]+'%'};return _0x2bb7c0;})});}_0xa0394f=_[_0x7fd8('0x3a')]({},_0xa0394f,_0xe6a0da[_0x7fd8('0x3b')]);return _0x1f149e[_0x7fd8('0x46')](_0xa0394f);}})[_0x7fd8('0x22')](function(_0xa211e8){if(_0xa211e8){_0x479e7d=_0xa211e8[_0x7fd8('0x31')];if(!_0xe6a0da['query']['hasOwnProperty'](_0x7fd8('0x33'))){_0xa0394f[_0x7fd8('0x19')]=qs['limit'](_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x19')]);_0xa0394f[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0xe6a0da[_0x7fd8('0x2c')][_0x7fd8('0x1b')]);}return _0x1f149e[_0x7fd8('0x46')](_0xa0394f);}})['then'](function(_0x4bb633){if(_0x4bb633){return _0x4bb633?{'count':_0x479e7d,'rows':_0x4bb633}:null;}})[_0x7fd8('0x22')](respondWithResult(_0x1ac1e9,null))[_0x7fd8('0x3d')](handleError(_0x1ac1e9,null));};exports['getDescriptions']=function(_0x1b4b45,_0xb72d5b,_0x18049a){var _0x2244b3={};var _0x2de605={};var _0x56632b;var _0x5ed26f;return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0x1b4b45[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0xb72d5b,null))[_0x7fd8('0x22')](function(_0x228dc6){if(_0x228dc6){_0x56632b=_0x228dc6;_0x2de605['model']=_['keys'](db[_0x7fd8('0x44')][_0x7fd8('0x28')]);_0x2de605['query']=_[_0x7fd8('0x2d')](_0x1b4b45['query']);_0x2de605[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x2de605[_0x7fd8('0x2b')],_0x2de605[_0x7fd8('0x2c')]);_0x2244b3[_0x7fd8('0x2e')]=_[_0x7fd8('0x2f')](_0x2de605[_0x7fd8('0x2b')],qs[_0x7fd8('0x30')](_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x2244b3[_0x7fd8('0x2e')]=_0x2244b3['attributes'][_0x7fd8('0x31')]?_0x2244b3[_0x7fd8('0x2e')]:_0x2de605[_0x7fd8('0x2b')];_0x2244b3[_0x7fd8('0x34')]=qs[_0x7fd8('0x35')](_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x35')]);_0x2244b3[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_[_0x7fd8('0x47')](_0x1b4b45[_0x7fd8('0x2c')],_0x2de605['filters']));if(_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x39')]){_0x2244b3[_0x7fd8('0x36')]=_['merge'](_0x2244b3[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x2244b3[_0x7fd8('0x2e')],function(_0x1617fa){var _0x56912a={};_0x56912a[_0x1617fa]={'$like':'%'+_0x1b4b45[_0x7fd8('0x2c')]['filter']+'%'};return _0x56912a;})});}_0x2244b3=_['merge']({},_0x2244b3,_0x1b4b45[_0x7fd8('0x3b')]);return _0x56632b[_0x7fd8('0x48')](_0x2244b3);}})['then'](function(_0x14c649){if(_0x14c649){_0x5ed26f=_0x14c649[_0x7fd8('0x31')];if(!_0x1b4b45[_0x7fd8('0x2c')][_0x7fd8('0x32')](_0x7fd8('0x33'))){_0x2244b3[_0x7fd8('0x19')]=qs[_0x7fd8('0x19')](_0x1b4b45['query']['limit']);_0x2244b3[_0x7fd8('0x1b')]=qs[_0x7fd8('0x1b')](_0x1b4b45['query'][_0x7fd8('0x1b')]);}return _0x56632b['getDescriptions'](_0x2244b3);}})[_0x7fd8('0x22')](function(_0x399818){if(_0x399818){return _0x399818?{'count':_0x5ed26f,'rows':_0x399818}:null;}})[_0x7fd8('0x22')](respondWithResult(_0xb72d5b,null))[_0x7fd8('0x3d')](handleError(_0xb72d5b,null));};exports['getTags']=function(_0x5124cb,_0xd69175,_0x4ad687){var _0x124a03={};var _0x1a1d34={};var _0x43415b;var _0x25ccb3;return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0x5124cb[_0x7fd8('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd69175,null))[_0x7fd8('0x22')](function(_0x433fcd){if(_0x433fcd){_0x43415b=_0x433fcd;_0x1a1d34[_0x7fd8('0x2b')]=_['keys'](db[_0x7fd8('0x49')][_0x7fd8('0x28')]);_0x1a1d34[_0x7fd8('0x2c')]=_[_0x7fd8('0x2d')](_0x5124cb['query']);_0x1a1d34[_0x7fd8('0x37')]=_[_0x7fd8('0x2f')](_0x1a1d34['model'],_0x1a1d34[_0x7fd8('0x2c')]);_0x124a03[_0x7fd8('0x2e')]=_['intersection'](_0x1a1d34[_0x7fd8('0x2b')],qs['fields'](_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x30')]));_0x124a03[_0x7fd8('0x2e')]=_0x124a03['attributes'][_0x7fd8('0x31')]?_0x124a03[_0x7fd8('0x2e')]:_0x1a1d34[_0x7fd8('0x2b')];_0x124a03[_0x7fd8('0x34')]=qs[_0x7fd8('0x35')](_0x5124cb['query'][_0x7fd8('0x35')]);_0x124a03[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_[_0x7fd8('0x47')](_0x5124cb[_0x7fd8('0x2c')],_0x1a1d34[_0x7fd8('0x37')]));if(_0x5124cb['query'][_0x7fd8('0x39')]){_0x124a03[_0x7fd8('0x36')]=_[_0x7fd8('0x3a')](_0x124a03[_0x7fd8('0x36')],{'$or':_[_0x7fd8('0x26')](_0x124a03['attributes'],function(_0x3e786d){var _0x40c783={};_0x40c783[_0x3e786d]={'$like':'%'+_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x39')]+'%'};return _0x40c783;})});}_0x124a03=_[_0x7fd8('0x3a')]({},_0x124a03,_0x5124cb[_0x7fd8('0x3b')]);return _0x43415b['getTags'](_0x124a03);}})[_0x7fd8('0x22')](function(_0x1d0769){if(_0x1d0769){_0x25ccb3=_0x1d0769[_0x7fd8('0x31')];if(!_0x5124cb[_0x7fd8('0x2c')]['hasOwnProperty']('nolimit')){_0x124a03[_0x7fd8('0x19')]=qs[_0x7fd8('0x19')](_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x19')]);_0x124a03[_0x7fd8('0x1b')]=qs['offset'](_0x5124cb[_0x7fd8('0x2c')][_0x7fd8('0x1b')]);}return _0x43415b[_0x7fd8('0x4a')](_0x124a03);}})[_0x7fd8('0x22')](function(_0x5f5085){if(_0x5f5085){return _0x5f5085?{'count':_0x25ccb3,'rows':_0x5f5085}:null;}})[_0x7fd8('0x22')](respondWithResult(_0xd69175,null))[_0x7fd8('0x3d')](handleError(_0xd69175,null));};exports[_0x7fd8('0x4b')]=function(_0x297b03,_0x5a9b88,_0x2f9cbc){if(_0x297b03[_0x7fd8('0x42')]['id']){delete _0x297b03[_0x7fd8('0x42')]['id'];}return db[_0x7fd8('0x27')]['findOne']({'where':{'id':_0x297b03[_0x7fd8('0x3f')]['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x5a9b88,null))['then'](function(_0xa2e104){if(_0xa2e104){return _0xa2e104['setTags'](_0x297b03[_0x7fd8('0x42')][_0x7fd8('0x4c')]||[]);}return null;})['then'](respondWithResult(_0x5a9b88,null))['catch'](handleError(_0x5a9b88,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e5c8f1a..8a378b7 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 _0xccee=['request-promise','path','rimraf','../../config/environment','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','api','bluebird'];(function(_0x1e2475,_0x55a8fd){var _0x5e19cb=function(_0x25d2e2){while(--_0x25d2e2){_0x1e2475['push'](_0x1e2475['shift']());}};_0x5e19cb(++_0x55a8fd);}(_0xccee,0xa7));var _0xecce=function(_0x6b7da8,_0x2c663d){_0x6b7da8=_0x6b7da8-0x0;var _0x379699=_0xccee[_0x6b7da8];return _0x379699;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xecce('0x0'))(_0xecce('0x1'));var moment=require('moment');var BPromise=require(_0xecce('0x2'));var rp=require(_0xecce('0x3'));var fs=require('fs');var path=require(_0xecce('0x4'));var rimraf=require(_0xecce('0x5'));var config=require(_0xecce('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0xf6e73,_0x162daf){return _0xf6e73[_0xecce('0x7')](_0xecce('0x8'),attributes,{'tableName':_0xecce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da1=['rimraf','../../config/environment','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4eb24f,_0x9d1734){var _0x2f5de3=function(_0x464b24){while(--_0x464b24){_0x4eb24f['push'](_0x4eb24f['shift']());}};_0x2f5de3(++_0x9d1734);}(_0x7da1,0x19f));var _0x17da=function(_0x4defab,_0x14578a){_0x4defab=_0x4defab-0x0;var _0xb0114=_0x7da1[_0x4defab];return _0xb0114;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x17da('0x0'))('api');var moment=require(_0x17da('0x1'));var BPromise=require(_0x17da('0x2'));var rp=require(_0x17da('0x3'));var fs=require('fs');var path=require(_0x17da('0x4'));var rimraf=require(_0x17da('0x5'));var config=require(_0x17da('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4b8b38,_0xbd7290){return _0x4b8b38[_0x17da('0x7')](_0x17da('0x8'),attributes,{'tableName':_0x17da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 93f6f4e..462e08e 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 _0x597b=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x597b,0x11e));var _0xb597=function(_0x480359,_0x30fc37){_0x480359=_0x480359-0x0;var _0x25650d=_0x597b[_0x480359];return _0x25650d;};'use strict';var _=require('lodash');var util=require(_0xb597('0x0'));var moment=require(_0xb597('0x1'));var BPromise=require(_0xb597('0x2'));var rs=require(_0xb597('0x3'));var fs=require('fs');var Redis=require(_0xb597('0x4'));var db=require(_0xb597('0x5'))['db'];var utils=require(_0xb597('0x6'));var logger=require(_0xb597('0x7'))(_0xb597('0x8'));var config=require('../../config/environment');var jayson=require(_0xb597('0x9'));var client=jayson[_0xb597('0xa')][_0xb597('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13f079,_0x2c75f1,_0x5883ce){return new BPromise(function(_0x2f7360,_0x2114b7){return client['request'](_0x13f079,_0x5883ce)[_0xb597('0xc')](function(_0x239dec){logger[_0xb597('0xd')](_0xb597('0xe'),_0x2c75f1,_0xb597('0xf'));logger[_0xb597('0x10')](_0xb597('0x11'),_0x2c75f1,'request\x20sent',JSON[_0xb597('0x12')](_0x239dec));if(_0x239dec[_0xb597('0x13')]){if(_0x239dec['error'][_0xb597('0x14')]===0x1f4){logger['error'](_0xb597('0xe'),_0x2c75f1,_0x239dec[_0xb597('0x13')][_0xb597('0x15')]);return _0x2114b7(_0x239dec[_0xb597('0x13')][_0xb597('0x15')]);}logger['error'](_0xb597('0xe'),_0x2c75f1,_0x239dec[_0xb597('0x13')][_0xb597('0x15')]);return _0x2f7360(_0x239dec[_0xb597('0x13')][_0xb597('0x15')]);}else{logger[_0xb597('0xd')](_0xb597('0xe'),_0x2c75f1,_0xb597('0xf'));_0x2f7360(_0x239dec['result']['message']);}})[_0xb597('0x16')](function(_0x4cc5c2){logger[_0xb597('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2c75f1,_0x4cc5c2);_0x2114b7(_0x4cc5c2);});});} \ No newline at end of file +var _0x4b2b=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xf64702,_0x200185){var _0x571ba6=function(_0x579fb3){while(--_0x579fb3){_0xf64702['push'](_0xf64702['shift']());}};_0x571ba6(++_0x200185);}(_0x4b2b,0x160));var _0xb4b2=function(_0xcebb08,_0x564b45){_0xcebb08=_0xcebb08-0x0;var _0x593352=_0x4b2b[_0xcebb08];return _0x593352;};'use strict';var _=require(_0xb4b2('0x0'));var util=require(_0xb4b2('0x1'));var moment=require(_0xb4b2('0x2'));var BPromise=require(_0xb4b2('0x3'));var rs=require(_0xb4b2('0x4'));var fs=require('fs');var Redis=require(_0xb4b2('0x5'));var db=require(_0xb4b2('0x6'))['db'];var utils=require(_0xb4b2('0x7'));var logger=require(_0xb4b2('0x8'))(_0xb4b2('0x9'));var config=require('../../config/environment');var jayson=require(_0xb4b2('0xa'));var client=jayson[_0xb4b2('0xb')][_0xb4b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d7156,_0x219709,_0xc603f4){return new BPromise(function(_0x2502da,_0x3d6675){return client[_0xb4b2('0xd')](_0x2d7156,_0xc603f4)[_0xb4b2('0xe')](function(_0x55d5f2){logger[_0xb4b2('0xf')](_0xb4b2('0x10'),_0x219709,'request\x20sent');logger[_0xb4b2('0x11')](_0xb4b2('0x12'),_0x219709,_0xb4b2('0x13'),JSON[_0xb4b2('0x14')](_0x55d5f2));if(_0x55d5f2[_0xb4b2('0x15')]){if(_0x55d5f2['error'][_0xb4b2('0x16')]===0x1f4){logger[_0xb4b2('0x15')](_0xb4b2('0x10'),_0x219709,_0x55d5f2['error'][_0xb4b2('0x17')]);return _0x3d6675(_0x55d5f2[_0xb4b2('0x15')][_0xb4b2('0x17')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x219709,_0x55d5f2['error']['message']);return _0x2502da(_0x55d5f2[_0xb4b2('0x15')][_0xb4b2('0x17')]);}else{logger[_0xb4b2('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x219709,_0xb4b2('0x13'));_0x2502da(_0x55d5f2[_0xb4b2('0x18')]['message']);}})[_0xb4b2('0x19')](function(_0x4eb1ff){logger[_0xb4b2('0x15')](_0xb4b2('0x10'),_0x219709,_0x4eb1ff);_0x3d6675(_0x4eb1ff);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2c23792..c69b855 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 _0x798f=['../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service'];(function(_0x5c46de,_0xdb2620){var _0x502cfa=function(_0x5dc3b9){while(--_0x5dc3b9){_0x5c46de['push'](_0x5c46de['shift']());}};_0x502cfa(++_0xdb2620);}(_0x798f,0x82));var _0xf798=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x798f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf798('0x0'));var util=require(_0xf798('0x1'));var path=require(_0xf798('0x2'));var timeout=require('connect-timeout');var express=require(_0xf798('0x3'));var router=express['Router']();var fs_extra=require(_0xf798('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf798('0x5'));var config=require(_0xf798('0x6'));var controller=require(_0xf798('0x7'));router[_0xf798('0x8')]('/',auth[_0xf798('0x9')](),controller[_0xf798('0xa')]);router[_0xf798('0x8')](_0xf798('0xb'),auth[_0xf798('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf798('0xc')]);router[_0xf798('0xd')](_0xf798('0xb'),auth[_0xf798('0x9')](),controller[_0xf798('0xe')]);router['delete'](_0xf798('0xb'),auth[_0xf798('0x9')](),controller[_0xf798('0xf')]);module[_0xf798('0x10')]=router; \ No newline at end of file +var _0xf91c=['update','delete','exports','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf91c,0xf1));var _0xcf91=function(_0x5fae11,_0x812d2a){_0x5fae11=_0x5fae11-0x0;var _0x22695b=_0xf91c[_0x5fae11];return _0x22695b;};'use strict';var multer=require('multer');var util=require(_0xcf91('0x0'));var path=require(_0xcf91('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf91('0x2'));var router=express['Router']();var fs_extra=require(_0xcf91('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcf91('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xcf91('0x5')]('/',auth[_0xcf91('0x6')](),controller[_0xcf91('0x7')]);router[_0xcf91('0x5')](_0xcf91('0x8'),auth['isAuthenticated'](),controller[_0xcf91('0x9')]);router['post']('/',auth[_0xcf91('0x6')](),controller[_0xcf91('0xa')]);router['put'](_0xcf91('0x8'),auth[_0xcf91('0x6')](),controller[_0xcf91('0xb')]);router[_0xcf91('0xc')](_0xcf91('0x8'),auth[_0xcf91('0x6')](),controller['destroy']);module[_0xcf91('0xd')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ff3b0ac..68a4d53 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 _0xafff=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x8c27a9,_0x4278f9){var _0x55a65d=function(_0x1e3cb5){while(--_0x1e3cb5){_0x8c27a9['push'](_0x8c27a9['shift']());}};_0x55a65d(++_0x4278f9);}(_0xafff,0x161));var _0xfaff=function(_0x57bc53,_0xc4f81b){_0x57bc53=_0x57bc53-0x0;var _0x3812e7=_0xafff[_0x57bc53];return _0x3812e7;};'use strict';var Sequelize=require(_0xfaff('0x0'));module[_0xfaff('0x1')]={'type':{'type':Sequelize[_0xfaff('0x2')](_0xfaff('0x3'),'variable',_0xfaff('0x4'),_0xfaff('0x5'),_0xfaff('0x6')),'defaultValue':_0xfaff('0x3')},'content':{'type':Sequelize[_0xfaff('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xfaff('0x3'),_0xfaff('0x8'),_0xfaff('0x4'))},'keyContent':{'type':Sequelize[_0xfaff('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfaff('0x7')]},'customField':{'type':Sequelize[_0xfaff('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfaff('0x7')]}}; \ No newline at end of file +var _0x30bd=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x30bd,0xf3));var _0xd30b=function(_0x4973ac,_0x114f1c){_0x4973ac=_0x4973ac-0x0;var _0x46b976=_0x30bd[_0x4973ac];return _0x46b976;};'use strict';var Sequelize=require('sequelize');module[_0xd30b('0x0')]={'type':{'type':Sequelize[_0xd30b('0x1')](_0xd30b('0x2'),_0xd30b('0x3'),'customVariable',_0xd30b('0x4'),_0xd30b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd30b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd30b('0x1')](_0xd30b('0x2'),_0xd30b('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd30b('0x6')]},'nameField':{'type':Sequelize[_0xd30b('0x6')]},'customField':{'type':Sequelize[_0xd30b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd30b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index da61e88..08cf0b1 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 _0x235a=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x47bb33,_0x210576){var _0x5e37df=function(_0x1c9849){while(--_0x1c9849){_0x47bb33['push'](_0x47bb33['shift']());}};_0x5e37df(++_0x210576);}(_0x235a,0x1ef));var _0xa235=function(_0x187a7f,_0x21e521){_0x187a7f=_0x187a7f-0x0;var _0x9b436f=_0x235a[_0x187a7f];return _0x9b436f;};'use strict';var emlformat=require(_0xa235('0x0'));var rimraf=require(_0xa235('0x1'));var zipdir=require(_0xa235('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa235('0x3'));var moment=require('moment');var BPromise=require(_0xa235('0x4'));var Mustache=require(_0xa235('0x5'));var util=require(_0xa235('0x6'));var path=require(_0xa235('0x7'));var sox=require(_0xa235('0x8'));var csv=require(_0xa235('0x9'));var ejs=require(_0xa235('0xa'));var fs=require('fs');var fs_extra=require(_0xa235('0xb'));var _=require('lodash');var squel=require(_0xa235('0xc'));var crypto=require(_0xa235('0xd'));var jsforce=require(_0xa235('0xe'));var deskjs=require(_0xa235('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa235('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa235('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa235('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa235('0x13'));var config=require(_0xa235('0x14'));var licenseUtil=require(_0xa235('0x15'));var db=require(_0xa235('0x16'))['db'];function respondWithStatusCode(_0x5330db,_0x5510ff){_0x5510ff=_0x5510ff||0xcc;return function(_0x47aad7){if(_0x47aad7){return _0x5330db[_0xa235('0x17')](_0x5510ff);}return _0x5330db[_0xa235('0x18')](_0x5510ff)[_0xa235('0x19')]();};}function respondWithResult(_0x3bf6fc,_0x36b4b1){_0x36b4b1=_0x36b4b1||0xc8;return function(_0x44ea6a){if(_0x44ea6a){return _0x3bf6fc[_0xa235('0x18')](_0x36b4b1)[_0xa235('0x1a')](_0x44ea6a);}};}function respondWithFilteredResult(_0x1369de,_0x4aceee){return function(_0x352463){if(_0x352463){var _0x20cd67=typeof _0x4aceee[_0xa235('0x1b')]===_0xa235('0x1c')&&typeof _0x4aceee[_0xa235('0x1d')]===_0xa235('0x1c');var _0x5c6e95=_0x352463['count'];var _0x446ea2=_0x20cd67?0x0:_0x4aceee[_0xa235('0x1b')];var _0x2b3769=_0x20cd67?_0x352463['count']:_0x4aceee[_0xa235('0x1b')]+_0x4aceee[_0xa235('0x1d')];var _0x3ca514;if(_0x2b3769>=_0x5c6e95){_0x2b3769=_0x5c6e95;_0x3ca514=0xc8;}else{_0x3ca514=0xce;}_0x1369de[_0xa235('0x18')](_0x3ca514);return _0x1369de[_0xa235('0x1e')](_0xa235('0x1f'),_0x446ea2+'-'+_0x2b3769+'/'+_0x5c6e95)[_0xa235('0x1a')](_0x352463);}return null;};}function patchUpdates(_0x483771){return function(_0x5a3bea){try{jsonpatch[_0xa235('0x20')](_0x5a3bea,_0x483771,!![]);}catch(_0x21940f){return BPromise[_0xa235('0x21')](_0x21940f);}return _0x5a3bea[_0xa235('0x22')]();};}function saveUpdates(_0x2e38e,_0x3deeea){return function(_0x3d9f70){if(_0x3d9f70){return _0x3d9f70[_0xa235('0x23')](_0x2e38e)[_0xa235('0x24')](function(_0x216083){return _0x216083;});}return null;};}function removeEntity(_0x3219f1,_0x20292c){return function(_0xee45e1){if(_0xee45e1){return _0xee45e1[_0xa235('0x25')]()[_0xa235('0x24')](function(){_0x3219f1[_0xa235('0x18')](0xcc)[_0xa235('0x19')]();});}};}function handleEntityNotFound(_0x13c868,_0x976c9f){return function(_0x1cb892){if(!_0x1cb892){_0x13c868[_0xa235('0x17')](0x194);}return _0x1cb892;};}function handleError(_0x57f591,_0xe1176c){_0xe1176c=_0xe1176c||0x1f4;return function(_0x533b15){logger[_0xa235('0x26')](_0x533b15['stack']);if(_0x533b15[_0xa235('0x27')]){delete _0x533b15[_0xa235('0x27')];}_0x57f591[_0xa235('0x18')](_0xe1176c)[_0xa235('0x28')](_0x533b15);};}exports[_0xa235('0x29')]=function(_0x5d811a,_0x2585c7){var _0x612f2={},_0x55a21e={},_0x4b33ef={'count':0x0,'rows':[]};var _0x502df9=_['map'](db[_0xa235('0x2a')][_0xa235('0x2b')],function(_0x2d8073){return{'name':_0x2d8073[_0xa235('0x2c')],'type':_0x2d8073[_0xa235('0x2d')][_0xa235('0x2e')]};});_0x55a21e[_0xa235('0x2f')]=_['map'](_0x502df9,'name');_0x55a21e[_0xa235('0x30')]=_[_0xa235('0x31')](_0x5d811a['query']);_0x55a21e[_0xa235('0x32')]=_[_0xa235('0x33')](_0x55a21e[_0xa235('0x2f')],_0x55a21e[_0xa235('0x30')]);_0x612f2[_0xa235('0x34')]=_[_0xa235('0x33')](_0x55a21e[_0xa235('0x2f')],qs[_0xa235('0x35')](_0x5d811a['query'][_0xa235('0x35')]));_0x612f2['attributes']=_0x612f2[_0xa235('0x34')][_0xa235('0x36')]?_0x612f2[_0xa235('0x34')]:_0x55a21e[_0xa235('0x2f')];if(!_0x5d811a[_0xa235('0x30')][_0xa235('0x37')](_0xa235('0x38'))){_0x612f2[_0xa235('0x1d')]=qs[_0xa235('0x1d')](_0x5d811a[_0xa235('0x30')][_0xa235('0x1d')]);_0x612f2[_0xa235('0x1b')]=qs[_0xa235('0x1b')](_0x5d811a['query']['offset']);}_0x612f2['order']=qs[_0xa235('0x39')](_0x5d811a['query'][_0xa235('0x39')]);_0x612f2[_0xa235('0x3a')]=qs[_0xa235('0x32')](_[_0xa235('0x3b')](_0x5d811a[_0xa235('0x30')],_0x55a21e[_0xa235('0x32')]),_0x502df9);if(_0x5d811a[_0xa235('0x30')]['filter']){_0x612f2[_0xa235('0x3a')]=_[_0xa235('0x3c')](_0x612f2['where'],{'$or':_[_0xa235('0x3d')](_0x502df9,function(_0x3fa927){if(_0x3fa927[_0xa235('0x2d')]!==_0xa235('0x3e')){var _0x45cc55={};_0x45cc55[_0x3fa927[_0xa235('0x27')]]={'$like':'%'+_0x5d811a[_0xa235('0x30')][_0xa235('0x3f')]+'%'};return _0x45cc55;}})});}_0x612f2=_[_0xa235('0x3c')]({},_0x612f2,_0x5d811a['options']);var _0x28c259={'where':_0x612f2[_0xa235('0x3a')]};return db[_0xa235('0x2a')][_0xa235('0x40')](_0x28c259)[_0xa235('0x24')](function(_0x542755){_0x4b33ef[_0xa235('0x40')]=_0x542755;if(_0x5d811a[_0xa235('0x30')][_0xa235('0x41')]){_0x612f2[_0xa235('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa235('0x43')](_0x612f2);})[_0xa235('0x24')](function(_0x47801f){_0x4b33ef[_0xa235('0x44')]=_0x47801f;return _0x4b33ef;})[_0xa235('0x24')](respondWithFilteredResult(_0x2585c7,_0x612f2))[_0xa235('0x45')](handleError(_0x2585c7,null));};exports[_0xa235('0x46')]=function(_0x5c203c,_0x333ed8){var _0x4748d8={'raw':!![],'where':{'id':_0x5c203c[_0xa235('0x47')]['id']}},_0x1e90a9={};_0x1e90a9[_0xa235('0x2f')]=_['keys'](db[_0xa235('0x2a')][_0xa235('0x2b')]);_0x1e90a9[_0xa235('0x30')]=_[_0xa235('0x31')](_0x5c203c[_0xa235('0x30')]);_0x1e90a9['filters']=_[_0xa235('0x33')](_0x1e90a9[_0xa235('0x2f')],_0x1e90a9[_0xa235('0x30')]);_0x4748d8[_0xa235('0x34')]=_[_0xa235('0x33')](_0x1e90a9[_0xa235('0x2f')],qs[_0xa235('0x35')](_0x5c203c[_0xa235('0x30')]['fields']));_0x4748d8[_0xa235('0x34')]=_0x4748d8[_0xa235('0x34')][_0xa235('0x36')]?_0x4748d8[_0xa235('0x34')]:_0x1e90a9[_0xa235('0x2f')];if(_0x5c203c[_0xa235('0x30')][_0xa235('0x41')]){_0x4748d8[_0xa235('0x42')]=[{'all':!![]}];}_0x4748d8=_[_0xa235('0x3c')]({},_0x4748d8,_0x5c203c['options']);return db[_0xa235('0x2a')][_0xa235('0x48')](_0x4748d8)[_0xa235('0x24')](handleEntityNotFound(_0x333ed8,null))[_0xa235('0x24')](respondWithResult(_0x333ed8,null))[_0xa235('0x45')](handleError(_0x333ed8,null));};exports['create']=function(_0x22f11c,_0x11b5e7){return db['FreshdeskField'][_0xa235('0x49')](_0x22f11c[_0xa235('0x4a')],{})[_0xa235('0x24')](respondWithResult(_0x11b5e7,0xc9))[_0xa235('0x45')](handleError(_0x11b5e7,null));};exports['update']=function(_0x16d9e8,_0x4909e9){if(_0x16d9e8[_0xa235('0x4a')]['id']){delete _0x16d9e8[_0xa235('0x4a')]['id'];}return db['FreshdeskField'][_0xa235('0x48')]({'where':{'id':_0x16d9e8[_0xa235('0x47')]['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x4909e9,null))[_0xa235('0x24')](saveUpdates(_0x16d9e8[_0xa235('0x4a')],null))[_0xa235('0x24')](respondWithResult(_0x4909e9,null))[_0xa235('0x45')](handleError(_0x4909e9,null));};exports[_0xa235('0x25')]=function(_0x5ab614,_0x5033dc){return db['FreshdeskField'][_0xa235('0x48')]({'where':{'id':_0x5ab614[_0xa235('0x47')]['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x5033dc,null))[_0xa235('0x24')](removeEntity(_0x5033dc,null))['catch'](handleError(_0x5033dc,null));}; \ No newline at end of file +var _0xfe57=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','name','send','map','FreshdeskField','fieldName','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','destroy','eml-format','rimraf','request-promise'];(function(_0x319192,_0x5cb4d7){var _0x500af8=function(_0x257698){while(--_0x257698){_0x319192['push'](_0x319192['shift']());}};_0x500af8(++_0x5cb4d7);}(_0xfe57,0x195));var _0x7fe5=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xfe57[_0x3e2fcf];return _0x497db7;};'use strict';var emlformat=require(_0x7fe5('0x0'));var rimraf=require(_0x7fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe5('0x2'));var moment=require(_0x7fe5('0x3'));var BPromise=require(_0x7fe5('0x4'));var Mustache=require(_0x7fe5('0x5'));var util=require(_0x7fe5('0x6'));var path=require(_0x7fe5('0x7'));var sox=require(_0x7fe5('0x8'));var csv=require(_0x7fe5('0x9'));var ejs=require(_0x7fe5('0xa'));var fs=require('fs');var fs_extra=require(_0x7fe5('0xb'));var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=typeof _0x39f175[_0x7fe5('0x1b')]===_0x7fe5('0x1c')&&typeof _0x39f175[_0x7fe5('0x1d')]==='undefined';var _0x166e23=_0x221ab2[_0x7fe5('0x1e')];var _0x340d5e=_0xbdf0a4?0x0:_0x39f175[_0x7fe5('0x1b')];var _0x2533db=_0xbdf0a4?_0x221ab2[_0x7fe5('0x1e')]:_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1d')];var _0x478523;if(_0x2533db>=_0x166e23){_0x2533db=_0x166e23;_0x478523=0xc8;}else{_0x478523=0xce;}_0x56e76f[_0x7fe5('0x1f')](_0x478523);return _0x56e76f['set']('Content-Range',_0x340d5e+'-'+_0x2533db+'/'+_0x166e23)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x459c2d){return function(_0x2f6592){try{jsonpatch[_0x7fe5('0x20')](_0x2f6592,_0x459c2d,!![]);}catch(_0x39c560){return BPromise[_0x7fe5('0x21')](_0x39c560);}return _0x2f6592[_0x7fe5('0x22')]();};}function saveUpdates(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x23')](_0xdd9df7)[_0x7fe5('0x24')](function(_0x54ee98){return _0x54ee98;});}return null;};}function removeEntity(_0x3e7340,_0x2f39e0){return function(_0x43e547){if(_0x43e547){return _0x43e547['destroy']()[_0x7fe5('0x24')](function(){_0x3e7340['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x53f522,_0x5c3b37){return function(_0x190355){if(!_0x190355){_0x53f522[_0x7fe5('0x18')](0x194);}return _0x190355;};}function handleError(_0x2a96f4,_0x399c55){_0x399c55=_0x399c55||0x1f4;return function(_0x4393c3){logger['error'](_0x4393c3['stack']);if(_0x4393c3[_0x7fe5('0x25')]){delete _0x4393c3[_0x7fe5('0x25')];}_0x2a96f4[_0x7fe5('0x1f')](_0x399c55)[_0x7fe5('0x26')](_0x4393c3);};}exports['index']=function(_0x46f816,_0x4a77e9){var _0x150ab9={},_0x1420de={},_0x204bc8={'count':0x0,'rows':[]};var _0x28a689=_[_0x7fe5('0x27')](db[_0x7fe5('0x28')]['rawAttributes'],function(_0xe521c6){return{'name':_0xe521c6[_0x7fe5('0x29')],'type':_0xe521c6['type'][_0x7fe5('0x2a')]};});_0x1420de[_0x7fe5('0x2b')]=_[_0x7fe5('0x27')](_0x28a689,_0x7fe5('0x25'));_0x1420de[_0x7fe5('0x2c')]=_['keys'](_0x46f816['query']);_0x1420de[_0x7fe5('0x2d')]=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],_0x1420de[_0x7fe5('0x2c')]);_0x150ab9['attributes']=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],qs[_0x7fe5('0x2f')](_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x2f')]));_0x150ab9[_0x7fe5('0x30')]=_0x150ab9['attributes'][_0x7fe5('0x31')]?_0x150ab9[_0x7fe5('0x30')]:_0x1420de[_0x7fe5('0x2b')];if(!_0x46f816[_0x7fe5('0x2c')]['hasOwnProperty']('nolimit')){_0x150ab9[_0x7fe5('0x1d')]=qs['limit'](_0x46f816[_0x7fe5('0x2c')]['limit']);_0x150ab9[_0x7fe5('0x1b')]=qs['offset'](_0x46f816['query']['offset']);}_0x150ab9['order']=qs[_0x7fe5('0x32')](_0x46f816[_0x7fe5('0x2c')]['sort']);_0x150ab9[_0x7fe5('0x33')]=qs[_0x7fe5('0x2d')](_['pick'](_0x46f816[_0x7fe5('0x2c')],_0x1420de['filters']),_0x28a689);if(_0x46f816['query'][_0x7fe5('0x34')]){_0x150ab9[_0x7fe5('0x33')]=_[_0x7fe5('0x35')](_0x150ab9[_0x7fe5('0x33')],{'$or':_[_0x7fe5('0x27')](_0x28a689,function(_0x4c4b05){if(_0x4c4b05[_0x7fe5('0x36')]!==_0x7fe5('0x37')){var _0x5839b2={};_0x5839b2[_0x4c4b05[_0x7fe5('0x25')]]={'$like':'%'+_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x34')]+'%'};return _0x5839b2;}})});}_0x150ab9=_[_0x7fe5('0x35')]({},_0x150ab9,_0x46f816[_0x7fe5('0x38')]);var _0x1c81c8={'where':_0x150ab9[_0x7fe5('0x33')]};return db['FreshdeskField']['count'](_0x1c81c8)[_0x7fe5('0x24')](function(_0x5f5db0){_0x204bc8[_0x7fe5('0x1e')]=_0x5f5db0;if(_0x46f816[_0x7fe5('0x2c')]['includeAll']){_0x150ab9[_0x7fe5('0x39')]=[{'all':!![]}];}return db[_0x7fe5('0x28')][_0x7fe5('0x3a')](_0x150ab9);})[_0x7fe5('0x24')](function(_0x2fd004){_0x204bc8[_0x7fe5('0x3b')]=_0x2fd004;return _0x204bc8;})[_0x7fe5('0x24')](respondWithFilteredResult(_0x4a77e9,_0x150ab9))['catch'](handleError(_0x4a77e9,null));};exports['show']=function(_0x411002,_0x4f81ca){var _0xad0b05={'raw':!![],'where':{'id':_0x411002[_0x7fe5('0x3c')]['id']}},_0x1a3e0d={};_0x1a3e0d[_0x7fe5('0x2b')]=_['keys'](db[_0x7fe5('0x28')]['rawAttributes']);_0x1a3e0d['query']=_[_0x7fe5('0x3d')](_0x411002[_0x7fe5('0x2c')]);_0x1a3e0d['filters']=_[_0x7fe5('0x2e')](_0x1a3e0d[_0x7fe5('0x2b')],_0x1a3e0d[_0x7fe5('0x2c')]);_0xad0b05[_0x7fe5('0x30')]=_[_0x7fe5('0x2e')](_0x1a3e0d['model'],qs[_0x7fe5('0x2f')](_0x411002[_0x7fe5('0x2c')]['fields']));_0xad0b05[_0x7fe5('0x30')]=_0xad0b05[_0x7fe5('0x30')][_0x7fe5('0x31')]?_0xad0b05[_0x7fe5('0x30')]:_0x1a3e0d['model'];if(_0x411002[_0x7fe5('0x2c')][_0x7fe5('0x3e')]){_0xad0b05[_0x7fe5('0x39')]=[{'all':!![]}];}_0xad0b05=_['merge']({},_0xad0b05,_0x411002[_0x7fe5('0x38')]);return db[_0x7fe5('0x28')][_0x7fe5('0x3f')](_0xad0b05)['then'](handleEntityNotFound(_0x4f81ca,null))[_0x7fe5('0x24')](respondWithResult(_0x4f81ca,null))[_0x7fe5('0x40')](handleError(_0x4f81ca,null));};exports[_0x7fe5('0x41')]=function(_0x4b8642,_0x19c4a6){return db[_0x7fe5('0x28')][_0x7fe5('0x41')](_0x4b8642[_0x7fe5('0x42')],{})[_0x7fe5('0x24')](respondWithResult(_0x19c4a6,0xc9))[_0x7fe5('0x40')](handleError(_0x19c4a6,null));};exports[_0x7fe5('0x23')]=function(_0x447b57,_0x446f01){if(_0x447b57[_0x7fe5('0x42')]['id']){delete _0x447b57[_0x7fe5('0x42')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x447b57['params']['id']}})['then'](handleEntityNotFound(_0x446f01,null))[_0x7fe5('0x24')](saveUpdates(_0x447b57['body'],null))[_0x7fe5('0x24')](respondWithResult(_0x446f01,null))[_0x7fe5('0x40')](handleError(_0x446f01,null));};exports[_0x7fe5('0x43')]=function(_0x1d9ca8,_0x362f33){return db['FreshdeskField'][_0x7fe5('0x3f')]({'where':{'id':_0x1d9ca8[_0x7fe5('0x3c')]['id']}})[_0x7fe5('0x24')](handleEntityNotFound(_0x362f33,null))[_0x7fe5('0x24')](removeEntity(_0x362f33,null))[_0x7fe5('0x40')](handleError(_0x362f33,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index cfeeec7..921ad70 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 _0xff2e=['request-promise','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','../../config/logger','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xff2e,0x198));var _0xeff2=function(_0x4dfad4,_0x33558b){_0x4dfad4=_0x4dfad4-0x0;var _0x47cc1=_0xff2e[_0x4dfad4];return _0x47cc1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeff2('0x0'))('api');var moment=require('moment');var BPromise=require(_0xeff2('0x1'));var rp=require(_0xeff2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeff2('0x3'));module[_0xeff2('0x4')]=function(_0x119e1c,_0x31484e){return _0x119e1c['define'](_0xeff2('0x5'),attributes,{'tableName':_0xeff2('0x6'),'paranoid':![],'indexes':[{'name':_0xeff2('0x7'),'fields':[_0xeff2('0x8'),_0xeff2('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe5d=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xfe5d,0x1ba));var _0xdfe5=function(_0xb520a5,_0x2cef0a){_0xb520a5=_0xb520a5-0x0;var _0xa0f8ef=_0xfe5d[_0xb520a5];return _0xa0f8ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdfe5('0x0'))('api');var moment=require(_0xdfe5('0x1'));var BPromise=require(_0xdfe5('0x2'));var rp=require(_0xdfe5('0x3'));var fs=require('fs');var path=require(_0xdfe5('0x4'));var rimraf=require(_0xdfe5('0x5'));var config=require(_0xdfe5('0x6'));var attributes=require(_0xdfe5('0x7'));module[_0xdfe5('0x8')]=function(_0x283c91,_0x58e02d){return _0x283c91[_0xdfe5('0x9')](_0xdfe5('0xa'),attributes,{'tableName':_0xdfe5('0xb'),'paranoid':![],'indexes':[{'name':_0xdfe5('0xc'),'fields':[_0xdfe5('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c2c0ad4..6e9809b 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 _0x8508=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2e30c7,_0x41de94){var _0x5d0248=function(_0x5384c9){while(--_0x5384c9){_0x2e30c7['push'](_0x2e30c7['shift']());}};_0x5d0248(++_0x41de94);}(_0x8508,0x1b8));var _0x8850=function(_0x2b2ab7,_0x48b0bf){_0x2b2ab7=_0x2b2ab7-0x0;var _0x102968=_0x8508[_0x2b2ab7];return _0x102968;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8850('0x0'));var BPromise=require(_0x8850('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8850('0x2'));var db=require(_0x8850('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8850('0x4'))('rpc');var config=require(_0x8850('0x5'));var jayson=require(_0x8850('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2eae83,_0x3936f9,_0x4b3730){return new BPromise(function(_0x21f7f1,_0x3f0fc4){return client[_0x8850('0x7')](_0x2eae83,_0x4b3730)[_0x8850('0x8')](function(_0x412425){logger[_0x8850('0x9')](_0x8850('0xa'),_0x3936f9,_0x8850('0xb'));logger[_0x8850('0xc')](_0x8850('0xd'),_0x3936f9,'request\x20sent',JSON[_0x8850('0xe')](_0x412425));if(_0x412425[_0x8850('0xf')]){if(_0x412425['error'][_0x8850('0x10')]===0x1f4){logger[_0x8850('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x3936f9,_0x412425[_0x8850('0xf')]['message']);return _0x3f0fc4(_0x412425[_0x8850('0xf')]['message']);}logger[_0x8850('0xf')](_0x8850('0xa'),_0x3936f9,_0x412425['error'][_0x8850('0x11')]);return _0x21f7f1(_0x412425[_0x8850('0xf')][_0x8850('0x11')]);}else{logger[_0x8850('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x3936f9,_0x8850('0xb'));_0x21f7f1(_0x412425[_0x8850('0x12')]['message']);}})[_0x8850('0x13')](function(_0x2b682d){logger['error'](_0x8850('0xa'),_0x3936f9,_0x2b682d);_0x3f0fc4(_0x2b682d);});});} \ No newline at end of file +var _0x41ca=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x34ae48,_0x662ff5){var _0x19b539=function(_0x24a8fe){while(--_0x24a8fe){_0x34ae48['push'](_0x34ae48['shift']());}};_0x19b539(++_0x662ff5);}(_0x41ca,0x90));var _0xa41c=function(_0x2e421e,_0x59b2d8){_0x2e421e=_0x2e421e-0x0;var _0x269a02=_0x41ca[_0x2e421e];return _0x269a02;};'use strict';var _=require(_0xa41c('0x0'));var util=require(_0xa41c('0x1'));var moment=require(_0xa41c('0x2'));var BPromise=require(_0xa41c('0x3'));var rs=require(_0xa41c('0x4'));var fs=require('fs');var Redis=require(_0xa41c('0x5'));var db=require(_0xa41c('0x6'))['db'];var utils=require(_0xa41c('0x7'));var logger=require('../../config/logger')(_0xa41c('0x8'));var config=require(_0xa41c('0x9'));var jayson=require(_0xa41c('0xa'));var client=jayson[_0xa41c('0xb')][_0xa41c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26918a,_0x2ac6f2,_0x2f4bc4){return new BPromise(function(_0x1dedd8,_0xd82c6f){return client[_0xa41c('0xd')](_0x26918a,_0x2f4bc4)[_0xa41c('0xe')](function(_0x1b02ed){logger['info'](_0xa41c('0xf'),_0x2ac6f2,_0xa41c('0x10'));logger[_0xa41c('0x11')](_0xa41c('0x12'),_0x2ac6f2,_0xa41c('0x10'),JSON[_0xa41c('0x13')](_0x1b02ed));if(_0x1b02ed[_0xa41c('0x14')]){if(_0x1b02ed['error'][_0xa41c('0x15')]===0x1f4){logger[_0xa41c('0x14')](_0xa41c('0xf'),_0x2ac6f2,_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);return _0xd82c6f(_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);}logger[_0xa41c('0x14')](_0xa41c('0xf'),_0x2ac6f2,_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);return _0x1dedd8(_0x1b02ed[_0xa41c('0x14')][_0xa41c('0x16')]);}else{logger[_0xa41c('0x17')](_0xa41c('0xf'),_0x2ac6f2,'request\x20sent');_0x1dedd8(_0x1b02ed['result'][_0xa41c('0x16')]);}})[_0xa41c('0x18')](function(_0x2158de){logger[_0xa41c('0x14')](_0xa41c('0xf'),_0x2ac6f2,_0x2158de);_0xd82c6f(_0x2158de);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3d372f5..3d7aee4 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 _0xbf6e=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2beeb9,_0x415c85){var _0x3f7f25=function(_0x1890d1){while(--_0x1890d1){_0x2beeb9['push'](_0x2beeb9['shift']());}};_0x3f7f25(++_0x415c85);}(_0xbf6e,0x149));var _0xebf6=function(_0x329a33,_0x585897){_0x329a33=_0x329a33-0x0;var _0x2bef80=_0xbf6e[_0x329a33];return _0x2bef80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var fs_extra=require(_0xebf6('0x4'));var auth=require(_0xebf6('0x5'));var interaction=require(_0xebf6('0x6'));var config=require('../../config/environment');var controller=require(_0xebf6('0x7'));router[_0xebf6('0x8')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0x8')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['show']);router[_0xebf6('0x8')](_0xebf6('0xc'),auth[_0xebf6('0x9')](),controller['getConfigurations']);router[_0xebf6('0x8')](_0xebf6('0xd'),auth['isAuthenticated'](),controller[_0xebf6('0xe')]);router[_0xebf6('0xf')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0x10')]);router[_0xebf6('0xf')](_0xebf6('0xc'),auth['isAuthenticated'](),controller[_0xebf6('0x11')]);router[_0xebf6('0x12')]('/:id',auth[_0xebf6('0x9')](),controller[_0xebf6('0x13')]);router[_0xebf6('0x14')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4fc2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path'];(function(_0x44e7f6,_0x3b8abb){var _0xa375dd=function(_0x1cd84f){while(--_0x1cd84f){_0x44e7f6['push'](_0x44e7f6['shift']());}};_0xa375dd(++_0x3b8abb);}(_0x4fc2,0x111));var _0x24fc=function(_0x407d0f,_0x5cafa2){_0x407d0f=_0x407d0f-0x0;var _0xdeeb73=_0x4fc2[_0x407d0f];return _0xdeeb73;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getConfigurations']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router[_0x24fc('0x11')]('/:id/configurations',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 09ae103..a801d5f 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 _0x1c9a=['sequelize','STRING','username','remoteUri'];(function(_0x408ebf,_0xfcc9e0){var _0x14a390=function(_0x2c2382){while(--_0x2c2382){_0x408ebf['push'](_0x408ebf['shift']());}};_0x14a390(++_0xfcc9e0);}(_0x1c9a,0x98));var _0xa1c9=function(_0x15fa38,_0x56f428){_0x15fa38=_0x15fa38-0x0;var _0x1b72d7=_0x1c9a[_0x15fa38];return _0x1b72d7;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa1c9('0x1')],'unique':_0xa1c9('0x2')},'apiKey':{'type':Sequelize[_0xa1c9('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa1c9('0x3')},'serverUrl':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x77d4=['exports','STRING','username'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x77d4,0x108));var _0x477d=function(_0x3c33c4,_0x3490ea){_0x3c33c4=_0x3c33c4-0x0;var _0x2c4b73=_0x77d4[_0x3c33c4];return _0x2c4b73;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index cbae708..007f8fa 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 _0x6b4b=['remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','order','sort','where','pick','filters','type','VIRTUAL','filter','options','include','rows','show','params','includeAll','merge','find','catch','create','body','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x6b4b,0x79));var _0xb6b4=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x6b4b[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0xb6b4('0x0'));var rimraf=require(_0xb6b4('0x1'));var zipdir=require(_0xb6b4('0x2'));var jsonpatch=require(_0xb6b4('0x3'));var rp=require(_0xb6b4('0x4'));var moment=require(_0xb6b4('0x5'));var BPromise=require(_0xb6b4('0x6'));var Mustache=require(_0xb6b4('0x7'));var util=require(_0xb6b4('0x8'));var path=require(_0xb6b4('0x9'));var sox=require(_0xb6b4('0xa'));var csv=require(_0xb6b4('0xb'));var ejs=require(_0xb6b4('0xc'));var fs=require('fs');var fs_extra=require(_0xb6b4('0xd'));var _=require(_0xb6b4('0xe'));var squel=require(_0xb6b4('0xf'));var crypto=require(_0xb6b4('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xb6b4('0x11'));var toCsv=require(_0xb6b4('0xb'));var querystring=require(_0xb6b4('0x12'));var Papa=require('papaparse');var Redis=require(_0xb6b4('0x13'));var authService=require(_0xb6b4('0x14'));var qs=require(_0xb6b4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6b4('0x16'))(_0xb6b4('0x17'));var utils=require(_0xb6b4('0x18'));var config=require(_0xb6b4('0x19'));var licenseUtil=require(_0xb6b4('0x1a'));var db=require(_0xb6b4('0x1b'))['db'];var integrations=require(_0xb6b4('0x1c'));function respondWithStatusCode(_0x11d458,_0x206a00){_0x206a00=_0x206a00||0xcc;return function(_0x1b5a11){if(_0x1b5a11){return _0x11d458[_0xb6b4('0x1d')](_0x206a00);}return _0x11d458['status'](_0x206a00)['end']();};}function respondWithResult(_0x56a616,_0x4e5d77){_0x4e5d77=_0x4e5d77||0xc8;return function(_0xb92f17){if(_0xb92f17){return _0x56a616[_0xb6b4('0x1e')](_0x4e5d77)[_0xb6b4('0x1f')](_0xb92f17);}};}function respondWithFilteredResult(_0x3c5558,_0x1a6e4b){return function(_0x136ad9){if(_0x136ad9){var _0x1517ab=typeof _0x1a6e4b[_0xb6b4('0x20')]===_0xb6b4('0x21')&&typeof _0x1a6e4b[_0xb6b4('0x22')]==='undefined';var _0x10c5d6=_0x136ad9[_0xb6b4('0x23')];var _0x524725=_0x1517ab?0x0:_0x1a6e4b[_0xb6b4('0x20')];var _0x2a9559=_0x1517ab?_0x136ad9[_0xb6b4('0x23')]:_0x1a6e4b[_0xb6b4('0x20')]+_0x1a6e4b[_0xb6b4('0x22')];var _0x3e4007;if(_0x2a9559>=_0x10c5d6){_0x2a9559=_0x10c5d6;_0x3e4007=0xc8;}else{_0x3e4007=0xce;}_0x3c5558['status'](_0x3e4007);return _0x3c5558['set'](_0xb6b4('0x24'),_0x524725+'-'+_0x2a9559+'/'+_0x10c5d6)['json'](_0x136ad9);}return null;};}function patchUpdates(_0x111b56){return function(_0x501353){try{jsonpatch[_0xb6b4('0x25')](_0x501353,_0x111b56,!![]);}catch(_0x3a5c7f){return BPromise[_0xb6b4('0x26')](_0x3a5c7f);}return _0x501353[_0xb6b4('0x27')]();};}function saveUpdates(_0x44a32e,_0x41e175){return function(_0x10c818){if(_0x10c818){return _0x10c818[_0xb6b4('0x28')](_0x44a32e)[_0xb6b4('0x29')](function(_0x253ce3){return _0x253ce3;});}return null;};}function removeEntity(_0x3b2cc7,_0xa375f3){return function(_0x14a5df){if(_0x14a5df){return _0x14a5df[_0xb6b4('0x2a')]()['then'](function(){_0x3b2cc7[_0xb6b4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2990ab,_0x443e0c){return function(_0xe3381a){if(!_0xe3381a){_0x2990ab['sendStatus'](0x194);}return _0xe3381a;};}function handleError(_0x2015c0,_0x5372fd){_0x5372fd=_0x5372fd||0x1f4;return function(_0x163080){logger[_0xb6b4('0x2b')](_0x163080['stack']);if(_0x163080[_0xb6b4('0x2c')]){delete _0x163080[_0xb6b4('0x2c')];}_0x2015c0[_0xb6b4('0x1e')](_0x5372fd)['send'](_0x163080);};}exports[_0xb6b4('0x2d')]=function(_0x1d942e,_0xa5c633){var _0x13e2c4={},_0x31257d={},_0x1307ff={'count':0x0,'rows':[]};var _0x210cac=_[_0xb6b4('0x2e')](db[_0xb6b4('0x2f')][_0xb6b4('0x30')],function(_0x360d2a){return{'name':_0x360d2a[_0xb6b4('0x31')],'type':_0x360d2a['type'][_0xb6b4('0x32')]};});_0x31257d['model']=_['map'](_0x210cac,_0xb6b4('0x2c'));_0x31257d[_0xb6b4('0x33')]=_[_0xb6b4('0x34')](_0x1d942e[_0xb6b4('0x33')]);_0x31257d['filters']=_[_0xb6b4('0x35')](_0x31257d[_0xb6b4('0x36')],_0x31257d[_0xb6b4('0x33')]);_0x13e2c4[_0xb6b4('0x37')]=_[_0xb6b4('0x35')](_0x31257d['model'],qs[_0xb6b4('0x38')](_0x1d942e['query'][_0xb6b4('0x38')]));_0x13e2c4[_0xb6b4('0x37')]=_0x13e2c4[_0xb6b4('0x37')][_0xb6b4('0x39')]?_0x13e2c4[_0xb6b4('0x37')]:_0x31257d[_0xb6b4('0x36')];if(!_0x1d942e['query']['hasOwnProperty']('nolimit')){_0x13e2c4[_0xb6b4('0x22')]=qs[_0xb6b4('0x22')](_0x1d942e['query'][_0xb6b4('0x22')]);_0x13e2c4['offset']=qs[_0xb6b4('0x20')](_0x1d942e[_0xb6b4('0x33')][_0xb6b4('0x20')]);}_0x13e2c4[_0xb6b4('0x3a')]=qs['sort'](_0x1d942e[_0xb6b4('0x33')][_0xb6b4('0x3b')]);_0x13e2c4[_0xb6b4('0x3c')]=qs['filters'](_[_0xb6b4('0x3d')](_0x1d942e[_0xb6b4('0x33')],_0x31257d[_0xb6b4('0x3e')]),_0x210cac);if(_0x1d942e[_0xb6b4('0x33')]['filter']){_0x13e2c4['where']=_['merge'](_0x13e2c4[_0xb6b4('0x3c')],{'$or':_[_0xb6b4('0x2e')](_0x210cac,function(_0x158e08){if(_0x158e08[_0xb6b4('0x3f')]!==_0xb6b4('0x40')){var _0x39d6a4={};_0x39d6a4[_0x158e08['name']]={'$like':'%'+_0x1d942e[_0xb6b4('0x33')][_0xb6b4('0x41')]+'%'};return _0x39d6a4;}})});}_0x13e2c4=_['merge']({},_0x13e2c4,_0x1d942e[_0xb6b4('0x42')]);var _0x3a735c={'where':_0x13e2c4[_0xb6b4('0x3c')]};return db['FreshsalesAccount']['count'](_0x3a735c)[_0xb6b4('0x29')](function(_0x483520){_0x1307ff[_0xb6b4('0x23')]=_0x483520;if(_0x1d942e[_0xb6b4('0x33')]['includeAll']){_0x13e2c4[_0xb6b4('0x43')]=[{'all':!![]}];}return db[_0xb6b4('0x2f')]['findAll'](_0x13e2c4);})[_0xb6b4('0x29')](function(_0x2b59a2){_0x1307ff[_0xb6b4('0x44')]=_0x2b59a2;return _0x1307ff;})[_0xb6b4('0x29')](respondWithFilteredResult(_0xa5c633,_0x13e2c4))['catch'](handleError(_0xa5c633,null));};exports[_0xb6b4('0x45')]=function(_0x30e648,_0x1c74ee){var _0x77a718={'raw':![],'where':{'id':_0x30e648[_0xb6b4('0x46')]['id']}},_0x291b11={};_0x291b11['model']=_[_0xb6b4('0x34')](db[_0xb6b4('0x2f')][_0xb6b4('0x30')]);_0x291b11['query']=_[_0xb6b4('0x34')](_0x30e648[_0xb6b4('0x33')]);_0x291b11[_0xb6b4('0x3e')]=_['intersection'](_0x291b11['model'],_0x291b11[_0xb6b4('0x33')]);_0x77a718[_0xb6b4('0x37')]=_[_0xb6b4('0x35')](_0x291b11[_0xb6b4('0x36')],qs[_0xb6b4('0x38')](_0x30e648[_0xb6b4('0x33')][_0xb6b4('0x38')]));_0x77a718['attributes']=_0x77a718[_0xb6b4('0x37')]['length']?_0x77a718[_0xb6b4('0x37')]:_0x291b11[_0xb6b4('0x36')];if(_0x30e648['query'][_0xb6b4('0x47')]){_0x77a718['include']=[{'all':!![]}];}_0x77a718=_[_0xb6b4('0x48')]({},_0x77a718,_0x30e648[_0xb6b4('0x42')]);return db[_0xb6b4('0x2f')][_0xb6b4('0x49')](_0x77a718)[_0xb6b4('0x29')](handleEntityNotFound(_0x1c74ee,null))[_0xb6b4('0x29')](respondWithResult(_0x1c74ee,null))[_0xb6b4('0x4a')](handleError(_0x1c74ee,null));};exports[_0xb6b4('0x4b')]=function(_0x2907aa,_0xf2473){return db['FreshsalesAccount']['create'](_0x2907aa[_0xb6b4('0x4c')],{})['then'](respondWithResult(_0xf2473,0xc9))[_0xb6b4('0x4a')](handleError(_0xf2473,null));};exports[_0xb6b4('0x28')]=function(_0xcc298f,_0x49fdb4){if(_0xcc298f[_0xb6b4('0x4c')]['id']){delete _0xcc298f[_0xb6b4('0x4c')]['id'];}return db[_0xb6b4('0x2f')][_0xb6b4('0x49')]({'where':{'id':_0xcc298f[_0xb6b4('0x46')]['id']}})[_0xb6b4('0x29')](handleEntityNotFound(_0x49fdb4,null))[_0xb6b4('0x29')](saveUpdates(_0xcc298f[_0xb6b4('0x4c')],null))[_0xb6b4('0x29')](respondWithResult(_0x49fdb4,null))[_0xb6b4('0x4a')](handleError(_0x49fdb4,null));};exports[_0xb6b4('0x2a')]=function(_0x141b55,_0x391cb3){return db[_0xb6b4('0x2f')][_0xb6b4('0x49')]({'where':{'id':_0x141b55[_0xb6b4('0x46')]['id']}})[_0xb6b4('0x29')](handleEntityNotFound(_0x391cb3,null))[_0xb6b4('0x29')](removeEntity(_0x391cb3,null))[_0xb6b4('0x4a')](handleError(_0x391cb3,null));};exports[_0xb6b4('0x4d')]=function(_0x57ead0,_0x3d9215,_0xc8347){var _0x4afc36={};var _0x37ac90={};var _0x2fbb3c;var _0x5c6ff1;return db[_0xb6b4('0x2f')]['findOne']({'where':{'id':_0x57ead0['params']['id']}})[_0xb6b4('0x29')](handleEntityNotFound(_0x3d9215,null))[_0xb6b4('0x29')](function(_0x5bc10d){if(_0x5bc10d){_0x2fbb3c=_0x5bc10d;_0x37ac90[_0xb6b4('0x36')]=_[_0xb6b4('0x34')](db[_0xb6b4('0x4e')][_0xb6b4('0x30')]);_0x37ac90[_0xb6b4('0x33')]=_[_0xb6b4('0x34')](_0x57ead0['query']);_0x37ac90['filters']=_[_0xb6b4('0x35')](_0x37ac90[_0xb6b4('0x36')],_0x37ac90['query']);_0x4afc36[_0xb6b4('0x37')]=_[_0xb6b4('0x35')](_0x37ac90[_0xb6b4('0x36')],qs[_0xb6b4('0x38')](_0x57ead0['query']['fields']));_0x4afc36[_0xb6b4('0x37')]=_0x4afc36[_0xb6b4('0x37')][_0xb6b4('0x39')]?_0x4afc36[_0xb6b4('0x37')]:_0x37ac90[_0xb6b4('0x36')];_0x4afc36[_0xb6b4('0x3a')]=qs[_0xb6b4('0x3b')](_0x57ead0[_0xb6b4('0x33')][_0xb6b4('0x3b')]);_0x4afc36[_0xb6b4('0x3c')]=qs[_0xb6b4('0x3e')](_[_0xb6b4('0x3d')](_0x57ead0[_0xb6b4('0x33')],_0x37ac90[_0xb6b4('0x3e')]));if(_0x57ead0[_0xb6b4('0x33')][_0xb6b4('0x41')]){_0x4afc36[_0xb6b4('0x3c')]=_[_0xb6b4('0x48')](_0x4afc36['where'],{'$or':_[_0xb6b4('0x2e')](_0x4afc36[_0xb6b4('0x37')],function(_0x5859e7){var _0x4f7dd3={};_0x4f7dd3[_0x5859e7]={'$like':'%'+_0x57ead0[_0xb6b4('0x33')]['filter']+'%'};return _0x4f7dd3;})});}_0x4afc36=_[_0xb6b4('0x48')]({},_0x4afc36,_0x57ead0[_0xb6b4('0x42')]);return _0x2fbb3c[_0xb6b4('0x4d')](_0x4afc36);}})[_0xb6b4('0x29')](function(_0x5bbaf5){if(_0x5bbaf5){_0x5c6ff1=_0x5bbaf5['length'];if(!_0x57ead0['query']['hasOwnProperty']('nolimit')){_0x4afc36[_0xb6b4('0x22')]=qs[_0xb6b4('0x22')](_0x57ead0[_0xb6b4('0x33')][_0xb6b4('0x22')]);_0x4afc36[_0xb6b4('0x20')]=qs[_0xb6b4('0x20')](_0x57ead0[_0xb6b4('0x33')][_0xb6b4('0x20')]);}return _0x2fbb3c['getConfigurations'](_0x4afc36);}})[_0xb6b4('0x29')](function(_0x547ab4){if(_0x547ab4){return _0x547ab4?{'count':_0x5c6ff1,'rows':_0x547ab4}:null;}})[_0xb6b4('0x29')](respondWithResult(_0x3d9215,null))[_0xb6b4('0x4a')](handleError(_0x3d9215,null));};exports[_0xb6b4('0x4f')]=function(_0x4bdaf7,_0x4a386b,_0x2ec8b1){if(_0x4bdaf7[_0xb6b4('0x4c')]['id']){delete _0x4bdaf7[_0xb6b4('0x4c')]['id'];}return db[_0xb6b4('0x2f')][_0xb6b4('0x50')]({'where':{'id':_0x4bdaf7[_0xb6b4('0x46')]['id']}})[_0xb6b4('0x29')](handleEntityNotFound(_0x4a386b,null))[_0xb6b4('0x29')](function(_0x4552c7){if(_0x4552c7){_0x4bdaf7[_0xb6b4('0x4c')]['AccountId']=_0x4552c7['id'];_0x4bdaf7[_0xb6b4('0x4c')]['Subjects']=integrations[_0xb6b4('0x51')](_0x4bdaf7[_0xb6b4('0x4c')][_0xb6b4('0x52')],_0x4bdaf7[_0xb6b4('0x4c')][_0xb6b4('0x3f')]);_0x4bdaf7['body'][_0xb6b4('0x53')]=integrations[_0xb6b4('0x54')](_0x4bdaf7[_0xb6b4('0x4c')][_0xb6b4('0x52')],_0x4bdaf7[_0xb6b4('0x4c')][_0xb6b4('0x3f')]);return db['FreshsalesConfiguration']['create'](_0x4bdaf7[_0xb6b4('0x4c')],{'include':[{'model':db[_0xb6b4('0x55')],'as':_0xb6b4('0x56')},{'model':db[_0xb6b4('0x55')],'as':_0xb6b4('0x53')}]});}return null;})[_0xb6b4('0x29')](respondWithResult(_0x4a386b,null))['catch'](handleError(_0x4a386b,null));};exports[_0xb6b4('0x57')]=function(_0x596051,_0x243c2c,_0x466375){var _0x19151d='';var _0x289610='';return db[_0xb6b4('0x2f')][_0xb6b4('0x50')]({'where':{'id':_0x596051[_0xb6b4('0x46')]['id']},'attributes':['id',_0xb6b4('0x58'),_0xb6b4('0x59'),'apiKey']})[_0xb6b4('0x29')](handleEntityNotFound(_0x243c2c,null))[_0xb6b4('0x29')](function(_0x127b8e){if(_0x127b8e){_0x289610=_0x127b8e[_0xb6b4('0x58')];_0x19151d=_0x127b8e[_0xb6b4('0x59')];var _0x44ef87=_0x127b8e[_0xb6b4('0x59')][_0xb6b4('0x5a')](-0x1);if(_0x44ef87==='/'){_0x19151d=_0x19151d[_0xb6b4('0x5b')](0x0,_0x19151d['lastIndexOf'](_0x44ef87));}return rp({'method':_0xb6b4('0x5c'),'uri':util[_0xb6b4('0x5d')](_0xb6b4('0x5e'),_0x19151d,_0xb6b4('0x5f')),'headers':{'Authorization':_0xb6b4('0x60')+_0x127b8e[_0xb6b4('0x61')]},'json':!![]});}})[_0xb6b4('0x29')](function(_0xc502a3){if(_0xc502a3){var _0x14c859=_0xc502a3['users'];var _0x3d62a1=![];var _0xb705f9=null;for(_0xb705f9=0x0;_0xb705f9<_0x14c859['length'];_0xb705f9++){if(_0x14c859[_0xb705f9][_0xb6b4('0x62')]===_0x289610){_0x3d62a1=!![];}}if(_0x3d62a1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb6b4('0x63')});}}})['then'](respondWithResult(_0x243c2c,null))[_0xb6b4('0x4a')](function(_0x5e9c6a){var _0x5b6138=_0x596051['query']['test']?0x1f4:_0x5e9c6a[_0xb6b4('0x64')]||0x1f4;logger[_0xb6b4('0x2b')](_0xb6b4('0x65'),'getFields',_0x5b6138,JSON['stringify'](_0x5e9c6a));delete _0x5e9c6a[_0xb6b4('0x2c')];if(_0x5b6138===0x191){_0x5b6138=0x190;}_0x243c2c['status'](_0x5b6138)[_0xb6b4('0x66')](_0x596051[_0xb6b4('0x33')][_0xb6b4('0x67')]?{'message':_0xb6b4('0x68'),'statusCode':_0x5e9c6a['statusCode']}:_0x5e9c6a);});}; \ No newline at end of file +var _0xcc9f=['users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','findOne','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','GET','Token\x20token=','apiKey'];(function(_0xb2454d,_0x291753){var _0x5464fb=function(_0x386805){while(--_0x386805){_0xb2454d['push'](_0xb2454d['shift']());}};_0x5464fb(++_0x291753);}(_0xcc9f,0x1a4));var _0xfcc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc9f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfcc9('0x0'));var rimraf=require(_0xfcc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcc9('0x2'));var rp=require(_0xfcc9('0x3'));var moment=require(_0xfcc9('0x4'));var BPromise=require(_0xfcc9('0x5'));var Mustache=require(_0xfcc9('0x6'));var util=require(_0xfcc9('0x7'));var path=require(_0xfcc9('0x8'));var sox=require(_0xfcc9('0x9'));var csv=require('to-csv');var ejs=require(_0xfcc9('0xa'));var fs=require('fs');var fs_extra=require(_0xfcc9('0xb'));var _=require('lodash');var squel=require(_0xfcc9('0xc'));var crypto=require(_0xfcc9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfcc9('0xe'));var toCsv=require(_0xfcc9('0xf'));var querystring=require(_0xfcc9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcc9('0x11'));var qs=require(_0xfcc9('0x12'));var as=require(_0xfcc9('0x13'));var hardwareService=require(_0xfcc9('0x14'));var logger=require(_0xfcc9('0x15'))('api');var utils=require(_0xfcc9('0x16'));var config=require(_0xfcc9('0x17'));var licenseUtil=require(_0xfcc9('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfcc9('0x19'));function respondWithStatusCode(_0x5d42b6,_0x151545){_0x151545=_0x151545||0xcc;return function(_0x4052b0){if(_0x4052b0){return _0x5d42b6[_0xfcc9('0x1a')](_0x151545);}return _0x5d42b6['status'](_0x151545)[_0xfcc9('0x1b')]();};}function respondWithResult(_0x238ffe,_0x5ed76a){_0x5ed76a=_0x5ed76a||0xc8;return function(_0x286683){if(_0x286683){return _0x238ffe['status'](_0x5ed76a)['json'](_0x286683);}};}function respondWithFilteredResult(_0x556e77,_0x5f0d30){return function(_0x1a8de2){if(_0x1a8de2){var _0x426b12=typeof _0x5f0d30[_0xfcc9('0x1c')]===_0xfcc9('0x1d')&&typeof _0x5f0d30['limit']==='undefined';var _0x247ce2=_0x1a8de2[_0xfcc9('0x1e')];var _0x3eedf6=_0x426b12?0x0:_0x5f0d30[_0xfcc9('0x1c')];var _0x2f0055=_0x426b12?_0x1a8de2[_0xfcc9('0x1e')]:_0x5f0d30[_0xfcc9('0x1c')]+_0x5f0d30[_0xfcc9('0x1f')];var _0x2eddbc;if(_0x2f0055>=_0x247ce2){_0x2f0055=_0x247ce2;_0x2eddbc=0xc8;}else{_0x2eddbc=0xce;}_0x556e77[_0xfcc9('0x20')](_0x2eddbc);return _0x556e77[_0xfcc9('0x21')](_0xfcc9('0x22'),_0x3eedf6+'-'+_0x2f0055+'/'+_0x247ce2)[_0xfcc9('0x23')](_0x1a8de2);}return null;};}function patchUpdates(_0x471f8c){return function(_0x493fb8){try{jsonpatch[_0xfcc9('0x24')](_0x493fb8,_0x471f8c,!![]);}catch(_0x1804e5){return BPromise[_0xfcc9('0x25')](_0x1804e5);}return _0x493fb8[_0xfcc9('0x26')]();};}function saveUpdates(_0x7f5bfd,_0x11bf90){return function(_0x526e19){if(_0x526e19){return _0x526e19[_0xfcc9('0x27')](_0x7f5bfd)[_0xfcc9('0x28')](function(_0x2568f9){return _0x2568f9;});}return null;};}function removeEntity(_0x1ca315,_0x178426){return function(_0x26e1dc){if(_0x26e1dc){return _0x26e1dc[_0xfcc9('0x29')]()['then'](function(){_0x1ca315[_0xfcc9('0x20')](0xcc)[_0xfcc9('0x1b')]();});}};}function handleEntityNotFound(_0x3b6113,_0x1a89ab){return function(_0x32ce1d){if(!_0x32ce1d){_0x3b6113[_0xfcc9('0x1a')](0x194);}return _0x32ce1d;};}function handleError(_0x4fcbb7,_0x2aba31){_0x2aba31=_0x2aba31||0x1f4;return function(_0x2d7c93){logger[_0xfcc9('0x2a')](_0x2d7c93[_0xfcc9('0x2b')]);if(_0x2d7c93[_0xfcc9('0x2c')]){delete _0x2d7c93[_0xfcc9('0x2c')];}_0x4fcbb7[_0xfcc9('0x20')](_0x2aba31)['send'](_0x2d7c93);};}exports[_0xfcc9('0x2d')]=function(_0x140faf,_0x2152bf){var _0x2686aa={},_0x30ce91={},_0x108321={'count':0x0,'rows':[]};var _0xc9ca99=_[_0xfcc9('0x2e')](db[_0xfcc9('0x2f')]['rawAttributes'],function(_0x5d675e){return{'name':_0x5d675e[_0xfcc9('0x30')],'type':_0x5d675e['type'][_0xfcc9('0x31')]};});_0x30ce91['model']=_[_0xfcc9('0x2e')](_0xc9ca99,_0xfcc9('0x2c'));_0x30ce91[_0xfcc9('0x32')]=_[_0xfcc9('0x33')](_0x140faf['query']);_0x30ce91[_0xfcc9('0x34')]=_[_0xfcc9('0x35')](_0x30ce91[_0xfcc9('0x36')],_0x30ce91[_0xfcc9('0x32')]);_0x2686aa['attributes']=_[_0xfcc9('0x35')](_0x30ce91[_0xfcc9('0x36')],qs[_0xfcc9('0x37')](_0x140faf[_0xfcc9('0x32')]['fields']));_0x2686aa[_0xfcc9('0x38')]=_0x2686aa[_0xfcc9('0x38')][_0xfcc9('0x39')]?_0x2686aa['attributes']:_0x30ce91[_0xfcc9('0x36')];if(!_0x140faf[_0xfcc9('0x32')]['hasOwnProperty'](_0xfcc9('0x3a'))){_0x2686aa[_0xfcc9('0x1f')]=qs[_0xfcc9('0x1f')](_0x140faf['query'][_0xfcc9('0x1f')]);_0x2686aa[_0xfcc9('0x1c')]=qs[_0xfcc9('0x1c')](_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x1c')]);}_0x2686aa[_0xfcc9('0x3b')]=qs[_0xfcc9('0x3c')](_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x3c')]);_0x2686aa[_0xfcc9('0x3d')]=qs[_0xfcc9('0x34')](_[_0xfcc9('0x3e')](_0x140faf[_0xfcc9('0x32')],_0x30ce91[_0xfcc9('0x34')]),_0xc9ca99);if(_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x3f')]){_0x2686aa[_0xfcc9('0x3d')]=_[_0xfcc9('0x40')](_0x2686aa[_0xfcc9('0x3d')],{'$or':_[_0xfcc9('0x2e')](_0xc9ca99,function(_0x2f4b57){if(_0x2f4b57[_0xfcc9('0x41')]!=='VIRTUAL'){var _0x236d6a={};_0x236d6a[_0x2f4b57[_0xfcc9('0x2c')]]={'$like':'%'+_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x3f')]+'%'};return _0x236d6a;}})});}_0x2686aa=_[_0xfcc9('0x40')]({},_0x2686aa,_0x140faf[_0xfcc9('0x42')]);var _0x3cc925={'where':_0x2686aa[_0xfcc9('0x3d')]};return db[_0xfcc9('0x2f')][_0xfcc9('0x1e')](_0x3cc925)['then'](function(_0xe62139){_0x108321[_0xfcc9('0x1e')]=_0xe62139;if(_0x140faf[_0xfcc9('0x32')][_0xfcc9('0x43')]){_0x2686aa[_0xfcc9('0x44')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x2686aa);})[_0xfcc9('0x28')](function(_0x36f1fb){_0x108321[_0xfcc9('0x45')]=_0x36f1fb;return _0x108321;})[_0xfcc9('0x28')](respondWithFilteredResult(_0x2152bf,_0x2686aa))[_0xfcc9('0x46')](handleError(_0x2152bf,null));};exports[_0xfcc9('0x47')]=function(_0x57b5ac,_0x4a37bc){var _0x692792={'raw':![],'where':{'id':_0x57b5ac[_0xfcc9('0x48')]['id']}},_0x38e878={};_0x38e878[_0xfcc9('0x36')]=_['keys'](db[_0xfcc9('0x2f')][_0xfcc9('0x49')]);_0x38e878['query']=_[_0xfcc9('0x33')](_0x57b5ac[_0xfcc9('0x32')]);_0x38e878[_0xfcc9('0x34')]=_[_0xfcc9('0x35')](_0x38e878[_0xfcc9('0x36')],_0x38e878['query']);_0x692792[_0xfcc9('0x38')]=_[_0xfcc9('0x35')](_0x38e878['model'],qs['fields'](_0x57b5ac['query']['fields']));_0x692792[_0xfcc9('0x38')]=_0x692792[_0xfcc9('0x38')][_0xfcc9('0x39')]?_0x692792[_0xfcc9('0x38')]:_0x38e878[_0xfcc9('0x36')];if(_0x57b5ac[_0xfcc9('0x32')][_0xfcc9('0x43')]){_0x692792[_0xfcc9('0x44')]=[{'all':!![]}];}_0x692792=_[_0xfcc9('0x40')]({},_0x692792,_0x57b5ac[_0xfcc9('0x42')]);return db[_0xfcc9('0x2f')][_0xfcc9('0x4a')](_0x692792)[_0xfcc9('0x28')](handleEntityNotFound(_0x4a37bc,null))[_0xfcc9('0x28')](respondWithResult(_0x4a37bc,null))[_0xfcc9('0x46')](handleError(_0x4a37bc,null));};exports['create']=function(_0x1f6899,_0x1f9f9f){return db['FreshsalesAccount'][_0xfcc9('0x4b')](_0x1f6899['body'],{})[_0xfcc9('0x28')](respondWithResult(_0x1f9f9f,0xc9))[_0xfcc9('0x46')](handleError(_0x1f9f9f,null));};exports[_0xfcc9('0x27')]=function(_0x3a4227,_0x4fae25){if(_0x3a4227['body']['id']){delete _0x3a4227[_0xfcc9('0x4c')]['id'];}return db[_0xfcc9('0x2f')][_0xfcc9('0x4a')]({'where':{'id':_0x3a4227[_0xfcc9('0x48')]['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x4fae25,null))[_0xfcc9('0x28')](saveUpdates(_0x3a4227['body'],null))[_0xfcc9('0x28')](respondWithResult(_0x4fae25,null))[_0xfcc9('0x46')](handleError(_0x4fae25,null));};exports[_0xfcc9('0x29')]=function(_0x4cfcbf,_0x23628b){return db[_0xfcc9('0x2f')]['find']({'where':{'id':_0x4cfcbf['params']['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x23628b,null))['then'](removeEntity(_0x23628b,null))[_0xfcc9('0x46')](handleError(_0x23628b,null));};exports['getConfigurations']=function(_0x297ca4,_0x52e95d,_0x28002a){var _0x40b583={};var _0x8e4a51={};var _0x1ae087;var _0x5e26b4;return db[_0xfcc9('0x2f')][_0xfcc9('0x4d')]({'where':{'id':_0x297ca4[_0xfcc9('0x48')]['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x52e95d,null))[_0xfcc9('0x28')](function(_0x4059d8){if(_0x4059d8){_0x1ae087=_0x4059d8;_0x8e4a51[_0xfcc9('0x36')]=_[_0xfcc9('0x33')](db['FreshsalesConfiguration']['rawAttributes']);_0x8e4a51[_0xfcc9('0x32')]=_[_0xfcc9('0x33')](_0x297ca4[_0xfcc9('0x32')]);_0x8e4a51[_0xfcc9('0x34')]=_[_0xfcc9('0x35')](_0x8e4a51[_0xfcc9('0x36')],_0x8e4a51[_0xfcc9('0x32')]);_0x40b583[_0xfcc9('0x38')]=_[_0xfcc9('0x35')](_0x8e4a51[_0xfcc9('0x36')],qs['fields'](_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x37')]));_0x40b583['attributes']=_0x40b583[_0xfcc9('0x38')][_0xfcc9('0x39')]?_0x40b583[_0xfcc9('0x38')]:_0x8e4a51[_0xfcc9('0x36')];_0x40b583[_0xfcc9('0x3b')]=qs[_0xfcc9('0x3c')](_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x3c')]);_0x40b583[_0xfcc9('0x3d')]=qs['filters'](_['pick'](_0x297ca4[_0xfcc9('0x32')],_0x8e4a51[_0xfcc9('0x34')]));if(_0x297ca4['query']['filter']){_0x40b583[_0xfcc9('0x3d')]=_[_0xfcc9('0x40')](_0x40b583[_0xfcc9('0x3d')],{'$or':_['map'](_0x40b583[_0xfcc9('0x38')],function(_0x49a43c){var _0x2ae88c={};_0x2ae88c[_0x49a43c]={'$like':'%'+_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x3f')]+'%'};return _0x2ae88c;})});}_0x40b583=_[_0xfcc9('0x40')]({},_0x40b583,_0x297ca4[_0xfcc9('0x42')]);return _0x1ae087[_0xfcc9('0x4e')](_0x40b583);}})[_0xfcc9('0x28')](function(_0x487271){if(_0x487271){_0x5e26b4=_0x487271[_0xfcc9('0x39')];if(!_0x297ca4['query'][_0xfcc9('0x4f')](_0xfcc9('0x3a'))){_0x40b583[_0xfcc9('0x1f')]=qs[_0xfcc9('0x1f')](_0x297ca4[_0xfcc9('0x32')][_0xfcc9('0x1f')]);_0x40b583[_0xfcc9('0x1c')]=qs[_0xfcc9('0x1c')](_0x297ca4['query'][_0xfcc9('0x1c')]);}return _0x1ae087[_0xfcc9('0x4e')](_0x40b583);}})[_0xfcc9('0x28')](function(_0x2c662a){if(_0x2c662a){return _0x2c662a?{'count':_0x5e26b4,'rows':_0x2c662a}:null;}})['then'](respondWithResult(_0x52e95d,null))[_0xfcc9('0x46')](handleError(_0x52e95d,null));};exports['addConfiguration']=function(_0x4ba3ae,_0x25452b,_0x497774){if(_0x4ba3ae[_0xfcc9('0x4c')]['id']){delete _0x4ba3ae[_0xfcc9('0x4c')]['id'];}return db[_0xfcc9('0x2f')][_0xfcc9('0x4d')]({'where':{'id':_0x4ba3ae['params']['id']}})[_0xfcc9('0x28')](handleEntityNotFound(_0x25452b,null))['then'](function(_0x441f5){if(_0x441f5){_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x50')]=_0x441f5['id'];_0x4ba3ae['body'][_0xfcc9('0x51')]=integrations[_0xfcc9('0x52')](_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x53')],_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x41')]);_0x4ba3ae[_0xfcc9('0x4c')][_0xfcc9('0x54')]=integrations['getDescriptions'](_0x4ba3ae['body'][_0xfcc9('0x53')],_0x4ba3ae[_0xfcc9('0x4c')]['type']);return db[_0xfcc9('0x55')][_0xfcc9('0x4b')](_0x4ba3ae[_0xfcc9('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':_0xfcc9('0x51')},{'model':db[_0xfcc9('0x56')],'as':'Descriptions'}]});}return null;})[_0xfcc9('0x28')](respondWithResult(_0x25452b,null))[_0xfcc9('0x46')](handleError(_0x25452b,null));};exports[_0xfcc9('0x57')]=function(_0x3a5af3,_0x40bf45,_0xa2209a){var _0x2f0cd4='';var _0x1227ea='';return db[_0xfcc9('0x2f')][_0xfcc9('0x4d')]({'where':{'id':_0x3a5af3['params']['id']},'attributes':['id',_0xfcc9('0x58'),_0xfcc9('0x59'),'apiKey']})[_0xfcc9('0x28')](handleEntityNotFound(_0x40bf45,null))[_0xfcc9('0x28')](function(_0x1fcc92){if(_0x1fcc92){_0x1227ea=_0x1fcc92[_0xfcc9('0x58')];_0x2f0cd4=_0x1fcc92[_0xfcc9('0x59')];var _0x108e47=_0x1fcc92[_0xfcc9('0x59')][_0xfcc9('0x5a')](-0x1);if(_0x108e47==='/'){_0x2f0cd4=_0x2f0cd4[_0xfcc9('0x5b')](0x0,_0x2f0cd4['lastIndexOf'](_0x108e47));}return rp({'method':_0xfcc9('0x5c'),'uri':util['format']('%s%s',_0x2f0cd4,'/api/selector/owners'),'headers':{'Authorization':_0xfcc9('0x5d')+_0x1fcc92[_0xfcc9('0x5e')]},'json':!![]});}})[_0xfcc9('0x28')](function(_0x3e1de2){if(_0x3e1de2){var _0x477685=_0x3e1de2[_0xfcc9('0x5f')];var _0x140fde=![];var _0xda697b=null;for(_0xda697b=0x0;_0xda697b<_0x477685[_0xfcc9('0x39')];_0xda697b++){if(_0x477685[_0xda697b][_0xfcc9('0x60')]===_0x1227ea){_0x140fde=!![];}}if(_0x140fde){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfcc9('0x61')});}}})['then'](respondWithResult(_0x40bf45,null))['catch'](function(_0x10f002){var _0x23115e=_0x3a5af3['query'][_0xfcc9('0x62')]?0x1f4:_0x10f002['statusCode']||0x1f4;logger['error'](_0xfcc9('0x63'),'getFields',_0x23115e,JSON[_0xfcc9('0x64')](_0x10f002));delete _0x10f002[_0xfcc9('0x2c')];if(_0x23115e===0x191){_0x23115e=0x190;}_0x40bf45[_0xfcc9('0x20')](_0x23115e)[_0xfcc9('0x65')](_0x3a5af3[_0xfcc9('0x32')][_0xfcc9('0x62')]?{'message':_0xfcc9('0x66'),'statusCode':_0x10f002['statusCode']}:_0x10f002);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3f92233..9f97973 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 _0x7278=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2a10ae,_0x5cfe89){var _0x4511d5=function(_0x451c24){while(--_0x451c24){_0x2a10ae['push'](_0x2a10ae['shift']());}};_0x4511d5(++_0x5cfe89);}(_0x7278,0x161));var _0x8727=function(_0x3f98f7,_0x44d507){_0x3f98f7=_0x3f98f7-0x0;var _0x4cbf3c=_0x7278[_0x3f98f7];return _0x4cbf3c;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));var integrations=require(_0x8727('0xa'));module[_0x8727('0xb')]=function(_0x5549d5,_0xfd1902){return _0x5549d5[_0x8727('0xc')](_0x8727('0xd'),attributes,{'tableName':_0x8727('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x103ac3,_0x26c2d5){var _0x269048=function(_0x299575){while(--_0x299575){_0x103ac3['push'](_0x103ac3['shift']());}};_0x269048(++_0x26c2d5);}(_0x25e7,0x1d6));var _0x725e=function(_0x4313b7,_0x48641c){_0x4313b7=_0x4313b7-0x0;var _0x57dbbe=_0x25e7[_0x4313b7];return _0x57dbbe;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('0xd'),'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 23422fa..04ec65d 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 _0x7a54=['http','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ae06b,_0x11d261){var _0x59d3c9=function(_0x23d299){while(--_0x23d299){_0x5ae06b['push'](_0x5ae06b['shift']());}};_0x59d3c9(++_0x11d261);}(_0x7a54,0x106));var _0x47a5=function(_0x284b57,_0x46a2d8){_0x284b57=_0x284b57-0x0;var _0x527618=_0x7a54[_0x284b57];return _0x527618;};'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')]('FreshsalesAccount,\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['GetFreshsalesAccount']=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,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xba34=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x38bf4b,_0x5a907a){var _0x549624=function(_0x10c2c9){while(--_0x10c2c9){_0x38bf4b['push'](_0x38bf4b['shift']());}};_0x549624(++_0x5a907a);}(_0xba34,0x119));var _0x4ba3=function(_0x32b8fe,_0x59c640){_0x32b8fe=_0x32b8fe-0x0;var _0x5cbb49=_0xba34[_0x32b8fe];return _0x5cbb49;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')]({'raw':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ff7ce['options']?_0x5ff7ce['options'][_0x4ba3('0x1d')]||null:null,'attributes':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1f')]||null:null,'include':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce['options'][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x5ff7ce['options'][_0x4ba3('0x20')],function(_0x4ffe39){return{'model':db[_0x4ffe39[_0x4ba3('0x22')]],'as':_0x4ffe39['as'],'attributes':_0x4ffe39[_0x4ba3('0x1e')],'include':_0x4ffe39[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x4ffe39[_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10537e){logger[_0x4ba3('0xd')](_0x4ba3('0x18'),_0x5ff7ce);logger['debug'](_0x4ba3('0x18'),_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x10537e));_0x556290(_0x10537e);})[_0x4ba3('0x17')](function(_0x22394d){logger['error']('GetFreshsalesAccount',_0x22394d[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x22394d[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x23')]=function(_0x2cb5d5){var _0x11f88f=this;return new Promise(function(_0x48b3b7,_0x27444b){return db[_0x4ba3('0x19')][_0x4ba3('0x24')]({'raw':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5['options']['attributes']||null:null,'include':_0x2cb5d5['options']?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x137f9b){return{'model':db[_0x137f9b[_0x4ba3('0x22')]],'as':_0x137f9b['as'],'attributes':_0x137f9b[_0x4ba3('0x1e')],'include':_0x137f9b[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x137f9b[_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xc')](function(_0x426e11){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0x2cb5d5);logger[_0x4ba3('0x10')]('ShowFreshsalesAccount',_0x2cb5d5,JSON[_0x4ba3('0x12')](_0x426e11));_0x48b3b7(_0x426e11);})[_0x4ba3('0x17')](function(_0x2e77d4){logger['error'](_0x4ba3('0x23'),_0x2e77d4[_0x4ba3('0x15')],_0x2cb5d5);_0x27444b(_0x11f88f['error'](0x1f4,_0x2e77d4[_0x4ba3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 96fbc28..e576b98 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 _0x5d7f=['getFields','post','create','put','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','getSubjects','/:id/fields'];(function(_0x140bd7,_0x5f132a){var _0x4d52c9=function(_0x3cadb5){while(--_0x3cadb5){_0x140bd7['push'](_0x140bd7['shift']());}};_0x4d52c9(++_0x5f132a);}(_0x5d7f,0x11e));var _0xf5d7=function(_0x3ed7ae,_0x32db6e){_0x3ed7ae=_0x3ed7ae-0x0;var _0x58b055=_0x5d7f[_0x3ed7ae];return _0x58b055;};'use strict';var multer=require('multer');var util=require(_0xf5d7('0x0'));var path=require('path');var timeout=require(_0xf5d7('0x1'));var express=require('express');var router=express[_0xf5d7('0x2')]();var fs_extra=require(_0xf5d7('0x3'));var auth=require(_0xf5d7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf5d7('0x5'));var controller=require(_0xf5d7('0x6'));router['get']('/',auth[_0xf5d7('0x7')](),controller[_0xf5d7('0x8')]);router[_0xf5d7('0x9')](_0xf5d7('0xa'),auth[_0xf5d7('0x7')](),controller[_0xf5d7('0xb')]);router['get']('/:id/subjects',auth[_0xf5d7('0x7')](),controller[_0xf5d7('0xc')]);router[_0xf5d7('0x9')]('/:id/descriptions',auth[_0xf5d7('0x7')](),controller['getDescriptions']);router['get'](_0xf5d7('0xd'),auth[_0xf5d7('0x7')](),controller[_0xf5d7('0xe')]);router[_0xf5d7('0xf')]('/',auth[_0xf5d7('0x7')](),controller[_0xf5d7('0x10')]);router[_0xf5d7('0x11')](_0xf5d7('0xa'),auth[_0xf5d7('0x7')](),controller['update']);router['delete']('/:id',auth[_0xf5d7('0x7')](),controller[_0xf5d7('0x12')]);module[_0xf5d7('0x13')]=router; \ No newline at end of file +var _0x6f53=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','/:id/descriptions','/:id/fields','getFields','create','update','destroy','multer'];(function(_0x471757,_0x3de4a8){var _0x580ef9=function(_0x2e16ad){while(--_0x2e16ad){_0x471757['push'](_0x471757['shift']());}};_0x580ef9(++_0x3de4a8);}(_0x6f53,0xaa));var _0x36f5=function(_0x1c6f08,_0x58d5c9){_0x1c6f08=_0x1c6f08-0x0;var _0x22e108=_0x6f53[_0x1c6f08];return _0x22e108;};'use strict';var multer=require(_0x36f5('0x0'));var util=require('util');var path=require(_0x36f5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x36f5('0x2')]();var fs_extra=require(_0x36f5('0x3'));var auth=require(_0x36f5('0x4'));var interaction=require(_0x36f5('0x5'));var config=require(_0x36f5('0x6'));var controller=require(_0x36f5('0x7'));router[_0x36f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x36f5('0x9')]);router[_0x36f5('0x8')](_0x36f5('0xa'),auth[_0x36f5('0xb')](),controller['show']);router[_0x36f5('0x8')]('/:id/subjects',auth[_0x36f5('0xb')](),controller[_0x36f5('0xc')]);router[_0x36f5('0x8')](_0x36f5('0xd'),auth[_0x36f5('0xb')](),controller['getDescriptions']);router['get'](_0x36f5('0xe'),auth[_0x36f5('0xb')](),controller[_0x36f5('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x36f5('0x10')]);router['put'](_0x36f5('0xa'),auth[_0x36f5('0xb')](),controller[_0x36f5('0x11')]);router['delete'](_0x36f5('0xa'),auth[_0x36f5('0xb')](),controller[_0x36f5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index ceb398b..77545c0 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 _0x3ae2=['sequelize','exports','STRING'];(function(_0x2c95a4,_0x3bcde1){var _0x117fbe=function(_0x4b19a4){while(--_0x4b19a4){_0x2c95a4['push'](_0x2c95a4['shift']());}};_0x117fbe(++_0x3bcde1);}(_0x3ae2,0x1e0));var _0x23ae=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x3ae2[_0x4bfade];return _0x272465;};'use strict';var Sequelize=require(_0x23ae('0x0'));module[_0x23ae('0x1')]={'name':{'type':Sequelize[_0x23ae('0x2')]},'description':{'type':Sequelize[_0x23ae('0x2')]}}; \ No newline at end of file +var _0xff69=['STRING','sequelize'];(function(_0x4ba63f,_0x3ed400){var _0x3227b3=function(_0x506000){while(--_0x506000){_0x4ba63f['push'](_0x4ba63f['shift']());}};_0x3227b3(++_0x3ed400);}(_0xff69,0x199));var _0x9ff6=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0xff69[_0x34232c];return _0x4d4f4e;};'use strict';var Sequelize=require(_0x9ff6('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ff6('0x1')]},'description':{'type':Sequelize[_0x9ff6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a4c3696..1e53f0c 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 _0x083b=['body','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','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','stack','name','send','index','FreshsalesConfiguration','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','filter','where','map','merge','options','include','findAll','params','rawAttributes','find','catch','create'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x083b,0x197));var _0xb083=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x083b[_0x581249];return _0x284bae;};'use strict';var emlformat=require(_0xb083('0x0'));var rimraf=require(_0xb083('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb083('0x2'));var rp=require(_0xb083('0x3'));var moment=require('moment');var BPromise=require(_0xb083('0x4'));var Mustache=require(_0xb083('0x5'));var util=require(_0xb083('0x6'));var path=require(_0xb083('0x7'));var sox=require(_0xb083('0x8'));var csv=require(_0xb083('0x9'));var ejs=require(_0xb083('0xa'));var fs=require('fs');var fs_extra=require(_0xb083('0xb'));var _=require(_0xb083('0xc'));var squel=require(_0xb083('0xd'));var crypto=require(_0xb083('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb083('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb083('0x10'));var Papa=require('papaparse');var Redis=require(_0xb083('0x11'));var authService=require(_0xb083('0x12'));var qs=require(_0xb083('0x13'));var as=require(_0xb083('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb083('0x15'));var utils=require(_0xb083('0x16'));var config=require(_0xb083('0x17'));var licenseUtil=require(_0xb083('0x18'));var db=require(_0xb083('0x19'))['db'];function respondWithStatusCode(_0x5666d2,_0x35d4fb){_0x35d4fb=_0x35d4fb||0xcc;return function(_0x566ecf){if(_0x566ecf){return _0x5666d2[_0xb083('0x1a')](_0x35d4fb);}return _0x5666d2[_0xb083('0x1b')](_0x35d4fb)[_0xb083('0x1c')]();};}function respondWithResult(_0x12aadb,_0x4d7ee0){_0x4d7ee0=_0x4d7ee0||0xc8;return function(_0x2119d4){if(_0x2119d4){return _0x12aadb[_0xb083('0x1b')](_0x4d7ee0)[_0xb083('0x1d')](_0x2119d4);}};}function respondWithFilteredResult(_0x5d0e63,_0x4ee950){return function(_0x472d3d){if(_0x472d3d){var _0x509672=typeof _0x4ee950[_0xb083('0x1e')]===_0xb083('0x1f')&&typeof _0x4ee950[_0xb083('0x20')]===_0xb083('0x1f');var _0x5364e6=_0x472d3d[_0xb083('0x21')];var _0xf6f4a5=_0x509672?0x0:_0x4ee950[_0xb083('0x1e')];var _0x3f1371=_0x509672?_0x472d3d[_0xb083('0x21')]:_0x4ee950[_0xb083('0x1e')]+_0x4ee950[_0xb083('0x20')];var _0x5e6eef;if(_0x3f1371>=_0x5364e6){_0x3f1371=_0x5364e6;_0x5e6eef=0xc8;}else{_0x5e6eef=0xce;}_0x5d0e63['status'](_0x5e6eef);return _0x5d0e63[_0xb083('0x22')](_0xb083('0x23'),_0xf6f4a5+'-'+_0x3f1371+'/'+_0x5364e6)[_0xb083('0x1d')](_0x472d3d);}return null;};}function patchUpdates(_0x59756f){return function(_0x24cf0a){try{jsonpatch[_0xb083('0x24')](_0x24cf0a,_0x59756f,!![]);}catch(_0x13c25d){return BPromise['reject'](_0x13c25d);}return _0x24cf0a[_0xb083('0x25')]();};}function saveUpdates(_0x12a0c8,_0x3a75a0){return function(_0x22e077){if(_0x22e077){return _0x22e077[_0xb083('0x26')](_0x12a0c8)[_0xb083('0x27')](function(_0x39cb90){return _0x39cb90;});}return null;};}function removeEntity(_0x3f059a,_0x207780){return function(_0x502070){if(_0x502070){return _0x502070[_0xb083('0x28')]()[_0xb083('0x27')](function(){_0x3f059a[_0xb083('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bcb02,_0x49cc7d){return function(_0x21450d){if(!_0x21450d){_0x5bcb02[_0xb083('0x1a')](0x194);}return _0x21450d;};}function handleError(_0x4c6745,_0x460444){_0x460444=_0x460444||0x1f4;return function(_0x55f403){logger['error'](_0x55f403[_0xb083('0x29')]);if(_0x55f403[_0xb083('0x2a')]){delete _0x55f403[_0xb083('0x2a')];}_0x4c6745[_0xb083('0x1b')](_0x460444)[_0xb083('0x2b')](_0x55f403);};}exports[_0xb083('0x2c')]=function(_0xd0b761,_0x106319){var _0xbc6640={},_0x159d8b={},_0x4a898b={'count':0x0,'rows':[]};var _0x2fd890=_['map'](db[_0xb083('0x2d')]['rawAttributes'],function(_0x10246a){return{'name':_0x10246a[_0xb083('0x2e')],'type':_0x10246a[_0xb083('0x2f')][_0xb083('0x30')]};});_0x159d8b[_0xb083('0x31')]=_['map'](_0x2fd890,'name');_0x159d8b['query']=_[_0xb083('0x32')](_0xd0b761['query']);_0x159d8b[_0xb083('0x33')]=_[_0xb083('0x34')](_0x159d8b[_0xb083('0x31')],_0x159d8b['query']);_0xbc6640[_0xb083('0x35')]=_[_0xb083('0x34')](_0x159d8b[_0xb083('0x31')],qs[_0xb083('0x36')](_0xd0b761[_0xb083('0x37')]['fields']));_0xbc6640[_0xb083('0x35')]=_0xbc6640[_0xb083('0x35')][_0xb083('0x38')]?_0xbc6640['attributes']:_0x159d8b[_0xb083('0x31')];if(!_0xd0b761['query'][_0xb083('0x39')]('nolimit')){_0xbc6640['limit']=qs['limit'](_0xd0b761[_0xb083('0x37')][_0xb083('0x20')]);_0xbc6640['offset']=qs[_0xb083('0x1e')](_0xd0b761[_0xb083('0x37')][_0xb083('0x1e')]);}_0xbc6640[_0xb083('0x3a')]=qs[_0xb083('0x3b')](_0xd0b761[_0xb083('0x37')][_0xb083('0x3b')]);_0xbc6640['where']=qs[_0xb083('0x33')](_[_0xb083('0x3c')](_0xd0b761[_0xb083('0x37')],_0x159d8b[_0xb083('0x33')]),_0x2fd890);if(_0xd0b761[_0xb083('0x37')][_0xb083('0x3d')]){_0xbc6640[_0xb083('0x3e')]=_['merge'](_0xbc6640[_0xb083('0x3e')],{'$or':_[_0xb083('0x3f')](_0x2fd890,function(_0x204ad1){if(_0x204ad1[_0xb083('0x2f')]!=='VIRTUAL'){var _0x10b64a={};_0x10b64a[_0x204ad1[_0xb083('0x2a')]]={'$like':'%'+_0xd0b761[_0xb083('0x37')][_0xb083('0x3d')]+'%'};return _0x10b64a;}})});}_0xbc6640=_[_0xb083('0x40')]({},_0xbc6640,_0xd0b761[_0xb083('0x41')]);var _0x1fea76={'where':_0xbc6640[_0xb083('0x3e')]};return db[_0xb083('0x2d')]['count'](_0x1fea76)[_0xb083('0x27')](function(_0x8a2cc7){_0x4a898b[_0xb083('0x21')]=_0x8a2cc7;if(_0xd0b761[_0xb083('0x37')]['includeAll']){_0xbc6640[_0xb083('0x42')]=[{'all':!![]}];}return db[_0xb083('0x2d')][_0xb083('0x43')](_0xbc6640);})['then'](function(_0x21fd43){_0x4a898b['rows']=_0x21fd43;return _0x4a898b;})['then'](respondWithFilteredResult(_0x106319,_0xbc6640))['catch'](handleError(_0x106319,null));};exports['show']=function(_0x546a8c,_0x5b09f4){var _0x4a687b={'raw':![],'where':{'id':_0x546a8c[_0xb083('0x44')]['id']}},_0x24ef54={};_0x24ef54['model']=_['keys'](db['FreshsalesConfiguration'][_0xb083('0x45')]);_0x24ef54[_0xb083('0x37')]=_[_0xb083('0x32')](_0x546a8c[_0xb083('0x37')]);_0x24ef54['filters']=_[_0xb083('0x34')](_0x24ef54['model'],_0x24ef54[_0xb083('0x37')]);_0x4a687b[_0xb083('0x35')]=_[_0xb083('0x34')](_0x24ef54['model'],qs[_0xb083('0x36')](_0x546a8c[_0xb083('0x37')][_0xb083('0x36')]));_0x4a687b[_0xb083('0x35')]=_0x4a687b[_0xb083('0x35')][_0xb083('0x38')]?_0x4a687b[_0xb083('0x35')]:_0x24ef54[_0xb083('0x31')];if(_0x546a8c[_0xb083('0x37')]['includeAll']){_0x4a687b[_0xb083('0x42')]=[{'all':!![]}];}_0x4a687b=_[_0xb083('0x40')]({},_0x4a687b,_0x546a8c[_0xb083('0x41')]);return db[_0xb083('0x2d')][_0xb083('0x46')](_0x4a687b)[_0xb083('0x27')](handleEntityNotFound(_0x5b09f4,null))['then'](respondWithResult(_0x5b09f4,null))[_0xb083('0x47')](handleError(_0x5b09f4,null));};exports['create']=function(_0x2f5209,_0x22efb1){return db['FreshsalesConfiguration'][_0xb083('0x48')](_0x2f5209[_0xb083('0x49')],{})['then'](respondWithResult(_0x22efb1,0xc9))['catch'](handleError(_0x22efb1,null));};exports['update']=function(_0x2a33ee,_0x5b5d86){if(_0x2a33ee[_0xb083('0x49')]['id']){delete _0x2a33ee[_0xb083('0x49')]['id'];}return db['FreshsalesConfiguration'][_0xb083('0x46')]({'where':{'id':_0x2a33ee['params']['id']}})[_0xb083('0x27')](handleEntityNotFound(_0x5b5d86,null))['then'](saveUpdates(_0x2a33ee[_0xb083('0x49')],null))[_0xb083('0x27')](respondWithResult(_0x5b5d86,null))['catch'](handleError(_0x5b5d86,null));};exports['destroy']=function(_0x5be811,_0x2c7b83){return db[_0xb083('0x2d')][_0xb083('0x46')]({'where':{'id':_0x5be811[_0xb083('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c7b83,null))[_0xb083('0x27')](removeEntity(_0x2c7b83,null))[_0xb083('0x47')](handleError(_0x2c7b83,null));};exports[_0xb083('0x4a')]=function(_0x18812b,_0x27ec30,_0x54e819){var _0x1059f0={};var _0x31d3a4={};var _0x44937b;var _0x52c51d;return db[_0xb083('0x2d')][_0xb083('0x4b')]({'where':{'id':_0x18812b[_0xb083('0x44')]['id']}})[_0xb083('0x27')](handleEntityNotFound(_0x27ec30,null))[_0xb083('0x27')](function(_0x2dc62b){if(_0x2dc62b){_0x44937b=_0x2dc62b;_0x31d3a4[_0xb083('0x31')]=_[_0xb083('0x32')](db[_0xb083('0x4c')]['rawAttributes']);_0x31d3a4[_0xb083('0x37')]=_[_0xb083('0x32')](_0x18812b[_0xb083('0x37')]);_0x31d3a4[_0xb083('0x33')]=_[_0xb083('0x34')](_0x31d3a4[_0xb083('0x31')],_0x31d3a4[_0xb083('0x37')]);_0x1059f0[_0xb083('0x35')]=_[_0xb083('0x34')](_0x31d3a4['model'],qs[_0xb083('0x36')](_0x18812b[_0xb083('0x37')][_0xb083('0x36')]));_0x1059f0[_0xb083('0x35')]=_0x1059f0[_0xb083('0x35')][_0xb083('0x38')]?_0x1059f0[_0xb083('0x35')]:_0x31d3a4[_0xb083('0x31')];_0x1059f0['order']=qs['sort'](_0x18812b['query']['sort']);_0x1059f0[_0xb083('0x3e')]=qs[_0xb083('0x33')](_[_0xb083('0x3c')](_0x18812b['query'],_0x31d3a4[_0xb083('0x33')]));if(_0x18812b[_0xb083('0x37')]['filter']){_0x1059f0[_0xb083('0x3e')]=_[_0xb083('0x40')](_0x1059f0['where'],{'$or':_[_0xb083('0x3f')](_0x1059f0[_0xb083('0x35')],function(_0xb75f13){var _0x2b6f4a={};_0x2b6f4a[_0xb75f13]={'$like':'%'+_0x18812b[_0xb083('0x37')][_0xb083('0x3d')]+'%'};return _0x2b6f4a;})});}_0x1059f0=_[_0xb083('0x40')]({},_0x1059f0,_0x18812b['options']);return _0x44937b[_0xb083('0x4a')](_0x1059f0);}})['then'](function(_0x44d574){if(_0x44d574){_0x52c51d=_0x44d574[_0xb083('0x38')];if(!_0x18812b[_0xb083('0x37')][_0xb083('0x39')](_0xb083('0x4d'))){_0x1059f0[_0xb083('0x20')]=qs[_0xb083('0x20')](_0x18812b[_0xb083('0x37')][_0xb083('0x20')]);_0x1059f0[_0xb083('0x1e')]=qs[_0xb083('0x1e')](_0x18812b[_0xb083('0x37')][_0xb083('0x1e')]);}return _0x44937b[_0xb083('0x4a')](_0x1059f0);}})[_0xb083('0x27')](function(_0x7e3b23){if(_0x7e3b23){return _0x7e3b23?{'count':_0x52c51d,'rows':_0x7e3b23}:null;}})['then'](respondWithResult(_0x27ec30,null))[_0xb083('0x47')](handleError(_0x27ec30,null));};exports[_0xb083('0x4e')]=function(_0x52af58,_0x4021f8,_0xee3364){var _0x3a00c4={};var _0x47b82d={};var _0xee85b0;var _0x430b80;return db[_0xb083('0x2d')][_0xb083('0x4b')]({'where':{'id':_0x52af58[_0xb083('0x44')]['id']}})[_0xb083('0x27')](handleEntityNotFound(_0x4021f8,null))['then'](function(_0x2950a6){if(_0x2950a6){_0xee85b0=_0x2950a6;_0x47b82d[_0xb083('0x31')]=_[_0xb083('0x32')](db['FreshsalesField']['rawAttributes']);_0x47b82d[_0xb083('0x37')]=_[_0xb083('0x32')](_0x52af58[_0xb083('0x37')]);_0x47b82d['filters']=_[_0xb083('0x34')](_0x47b82d[_0xb083('0x31')],_0x47b82d[_0xb083('0x37')]);_0x3a00c4['attributes']=_[_0xb083('0x34')](_0x47b82d[_0xb083('0x31')],qs[_0xb083('0x36')](_0x52af58[_0xb083('0x37')]['fields']));_0x3a00c4[_0xb083('0x35')]=_0x3a00c4[_0xb083('0x35')][_0xb083('0x38')]?_0x3a00c4[_0xb083('0x35')]:_0x47b82d[_0xb083('0x31')];_0x3a00c4[_0xb083('0x3a')]=qs[_0xb083('0x3b')](_0x52af58[_0xb083('0x37')][_0xb083('0x3b')]);_0x3a00c4['where']=qs[_0xb083('0x33')](_['pick'](_0x52af58[_0xb083('0x37')],_0x47b82d[_0xb083('0x33')]));if(_0x52af58[_0xb083('0x37')]['filter']){_0x3a00c4[_0xb083('0x3e')]=_['merge'](_0x3a00c4[_0xb083('0x3e')],{'$or':_['map'](_0x3a00c4[_0xb083('0x35')],function(_0x5b1833){var _0x9a3a6a={};_0x9a3a6a[_0x5b1833]={'$like':'%'+_0x52af58[_0xb083('0x37')]['filter']+'%'};return _0x9a3a6a;})});}_0x3a00c4=_['merge']({},_0x3a00c4,_0x52af58[_0xb083('0x41')]);return _0xee85b0[_0xb083('0x4e')](_0x3a00c4);}})['then'](function(_0x569141){if(_0x569141){_0x430b80=_0x569141['length'];if(!_0x52af58['query'][_0xb083('0x39')](_0xb083('0x4d'))){_0x3a00c4[_0xb083('0x20')]=qs[_0xb083('0x20')](_0x52af58[_0xb083('0x37')]['limit']);_0x3a00c4[_0xb083('0x1e')]=qs[_0xb083('0x1e')](_0x52af58[_0xb083('0x37')]['offset']);}return _0xee85b0[_0xb083('0x4e')](_0x3a00c4);}})['then'](function(_0x143a44){if(_0x143a44){return _0x143a44?{'count':_0x430b80,'rows':_0x143a44}:null;}})[_0xb083('0x27')](respondWithResult(_0x4021f8,null))[_0xb083('0x47')](handleError(_0x4021f8,null));};exports['getFields']=function(_0x5e62a7,_0x2088aa,_0xefdd0b){var _0x5f5516={};var _0x51f4fb={};var _0x523fe1;var _0x133da8;return db[_0xb083('0x2d')][_0xb083('0x4b')]({'where':{'id':_0x5e62a7[_0xb083('0x44')]['id']}})[_0xb083('0x27')](handleEntityNotFound(_0x2088aa,null))['then'](function(_0xa15f99){if(_0xa15f99){_0x523fe1=_0xa15f99;_0x51f4fb[_0xb083('0x31')]=_['keys'](db[_0xb083('0x4c')][_0xb083('0x45')]);_0x51f4fb['query']=_[_0xb083('0x32')](_0x5e62a7[_0xb083('0x37')]);_0x51f4fb[_0xb083('0x33')]=_['intersection'](_0x51f4fb[_0xb083('0x31')],_0x51f4fb[_0xb083('0x37')]);_0x5f5516[_0xb083('0x35')]=_[_0xb083('0x34')](_0x51f4fb['model'],qs[_0xb083('0x36')](_0x5e62a7[_0xb083('0x37')][_0xb083('0x36')]));_0x5f5516['attributes']=_0x5f5516[_0xb083('0x35')][_0xb083('0x38')]?_0x5f5516[_0xb083('0x35')]:_0x51f4fb[_0xb083('0x31')];_0x5f5516[_0xb083('0x3a')]=qs[_0xb083('0x3b')](_0x5e62a7[_0xb083('0x37')]['sort']);_0x5f5516['where']=qs[_0xb083('0x33')](_[_0xb083('0x3c')](_0x5e62a7[_0xb083('0x37')],_0x51f4fb[_0xb083('0x33')]));if(_0x5e62a7[_0xb083('0x37')]['filter']){_0x5f5516['where']=_[_0xb083('0x40')](_0x5f5516['where'],{'$or':_[_0xb083('0x3f')](_0x5f5516['attributes'],function(_0x1a2e3c){var _0x5655db={};_0x5655db[_0x1a2e3c]={'$like':'%'+_0x5e62a7[_0xb083('0x37')][_0xb083('0x3d')]+'%'};return _0x5655db;})});}_0x5f5516=_[_0xb083('0x40')]({},_0x5f5516,_0x5e62a7[_0xb083('0x41')]);return _0x523fe1[_0xb083('0x4f')](_0x5f5516);}})[_0xb083('0x27')](function(_0x300b82){if(_0x300b82){_0x133da8=_0x300b82[_0xb083('0x38')];if(!_0x5e62a7[_0xb083('0x37')]['hasOwnProperty']('nolimit')){_0x5f5516[_0xb083('0x20')]=qs[_0xb083('0x20')](_0x5e62a7[_0xb083('0x37')][_0xb083('0x20')]);_0x5f5516[_0xb083('0x1e')]=qs[_0xb083('0x1e')](_0x5e62a7[_0xb083('0x37')][_0xb083('0x1e')]);}return _0x523fe1[_0xb083('0x4f')](_0x5f5516);}})[_0xb083('0x27')](function(_0x3cd7df){if(_0x3cd7df){return _0x3cd7df?{'count':_0x133da8,'rows':_0x3cd7df}:null;}})[_0xb083('0x27')](respondWithResult(_0x2088aa,null))[_0xb083('0x47')](handleError(_0x2088aa,null));}; \ No newline at end of file +var _0x7342=['../../components/parsers/qs','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','stack','name','FreshsalesConfiguration','fieldName','type','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','model','rawAttributes','include','options','find','create','body','destroy','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x4fa107,_0x45715b){var _0x183cc3=function(_0x39bbc5){while(--_0x39bbc5){_0x4fa107['push'](_0x4fa107['shift']());}};_0x183cc3(++_0x45715b);}(_0x7342,0xd4));var _0x2734=function(_0x588a7a,_0x2422ff){_0x588a7a=_0x588a7a-0x0;var _0x2cc8df=_0x7342[_0x588a7a];return _0x2cc8df;};'use strict';var emlformat=require(_0x2734('0x0'));var rimraf=require(_0x2734('0x1'));var zipdir=require(_0x2734('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2734('0x3'));var BPromise=require(_0x2734('0x4'));var Mustache=require(_0x2734('0x5'));var util=require(_0x2734('0x6'));var path=require(_0x2734('0x7'));var sox=require(_0x2734('0x8'));var csv=require(_0x2734('0x9'));var ejs=require(_0x2734('0xa'));var fs=require('fs');var fs_extra=require(_0x2734('0xb'));var _=require(_0x2734('0xc'));var squel=require(_0x2734('0xd'));var crypto=require(_0x2734('0xe'));var jsforce=require(_0x2734('0xf'));var deskjs=require(_0x2734('0x10'));var toCsv=require(_0x2734('0x9'));var querystring=require(_0x2734('0x11'));var Papa=require('papaparse');var Redis=require(_0x2734('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2734('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2734('0x14'));var utils=require('../../config/utils');var config=require(_0x2734('0x15'));var licenseUtil=require(_0x2734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x64e7c4,_0x346682){_0x346682=_0x346682||0xcc;return function(_0x196a1c){if(_0x196a1c){return _0x64e7c4[_0x2734('0x17')](_0x346682);}return _0x64e7c4[_0x2734('0x18')](_0x346682)[_0x2734('0x19')]();};}function respondWithResult(_0x229f38,_0x200a1b){_0x200a1b=_0x200a1b||0xc8;return function(_0x3c3d07){if(_0x3c3d07){return _0x229f38[_0x2734('0x18')](_0x200a1b)[_0x2734('0x1a')](_0x3c3d07);}};}function respondWithFilteredResult(_0x4df926,_0x547f05){return function(_0x17760c){if(_0x17760c){var _0x52e660=typeof _0x547f05[_0x2734('0x1b')]===_0x2734('0x1c')&&typeof _0x547f05['limit']==='undefined';var _0x3850b3=_0x17760c[_0x2734('0x1d')];var _0x5cdad9=_0x52e660?0x0:_0x547f05[_0x2734('0x1b')];var _0x2056df=_0x52e660?_0x17760c[_0x2734('0x1d')]:_0x547f05['offset']+_0x547f05['limit'];var _0x2abe22;if(_0x2056df>=_0x3850b3){_0x2056df=_0x3850b3;_0x2abe22=0xc8;}else{_0x2abe22=0xce;}_0x4df926['status'](_0x2abe22);return _0x4df926['set'](_0x2734('0x1e'),_0x5cdad9+'-'+_0x2056df+'/'+_0x3850b3)[_0x2734('0x1a')](_0x17760c);}return null;};}function patchUpdates(_0x3368bb){return function(_0x50b6c2){try{jsonpatch[_0x2734('0x1f')](_0x50b6c2,_0x3368bb,!![]);}catch(_0x1eab6f){return BPromise['reject'](_0x1eab6f);}return _0x50b6c2[_0x2734('0x20')]();};}function saveUpdates(_0x3fcaaf,_0x190143){return function(_0x41dea4){if(_0x41dea4){return _0x41dea4[_0x2734('0x21')](_0x3fcaaf)['then'](function(_0x5b6a5e){return _0x5b6a5e;});}return null;};}function removeEntity(_0x570255,_0x2e5828){return function(_0x3f8c1d){if(_0x3f8c1d){return _0x3f8c1d['destroy']()[_0x2734('0x22')](function(){_0x570255[_0x2734('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d872b,_0x5a1cf2){return function(_0x5c61c4){if(!_0x5c61c4){_0x1d872b[_0x2734('0x17')](0x194);}return _0x5c61c4;};}function handleError(_0x2d6a79,_0x1b13b1){_0x1b13b1=_0x1b13b1||0x1f4;return function(_0x2104c4){logger['error'](_0x2104c4[_0x2734('0x23')]);if(_0x2104c4['name']){delete _0x2104c4[_0x2734('0x24')];}_0x2d6a79[_0x2734('0x18')](_0x1b13b1)['send'](_0x2104c4);};}exports['index']=function(_0x4d9e92,_0xd2a1a){var _0x1854f1={},_0x464941={},_0x55393e={'count':0x0,'rows':[]};var _0x2a29b7=_['map'](db[_0x2734('0x25')]['rawAttributes'],function(_0x261246){return{'name':_0x261246[_0x2734('0x26')],'type':_0x261246[_0x2734('0x27')]['key']};});_0x464941['model']=_[_0x2734('0x28')](_0x2a29b7,_0x2734('0x24'));_0x464941['query']=_[_0x2734('0x29')](_0x4d9e92['query']);_0x464941[_0x2734('0x2a')]=_[_0x2734('0x2b')](_0x464941['model'],_0x464941[_0x2734('0x2c')]);_0x1854f1['attributes']=_[_0x2734('0x2b')](_0x464941['model'],qs['fields'](_0x4d9e92['query'][_0x2734('0x2d')]));_0x1854f1[_0x2734('0x2e')]=_0x1854f1[_0x2734('0x2e')][_0x2734('0x2f')]?_0x1854f1[_0x2734('0x2e')]:_0x464941['model'];if(!_0x4d9e92[_0x2734('0x2c')][_0x2734('0x30')](_0x2734('0x31'))){_0x1854f1[_0x2734('0x32')]=qs['limit'](_0x4d9e92['query']['limit']);_0x1854f1['offset']=qs[_0x2734('0x1b')](_0x4d9e92[_0x2734('0x2c')][_0x2734('0x1b')]);}_0x1854f1[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x4d9e92[_0x2734('0x2c')][_0x2734('0x34')]);_0x1854f1[_0x2734('0x35')]=qs['filters'](_[_0x2734('0x36')](_0x4d9e92[_0x2734('0x2c')],_0x464941[_0x2734('0x2a')]),_0x2a29b7);if(_0x4d9e92['query'][_0x2734('0x37')]){_0x1854f1['where']=_[_0x2734('0x38')](_0x1854f1[_0x2734('0x35')],{'$or':_[_0x2734('0x28')](_0x2a29b7,function(_0xa19d46){if(_0xa19d46[_0x2734('0x27')]!==_0x2734('0x39')){var _0x48c0f8={};_0x48c0f8[_0xa19d46['name']]={'$like':'%'+_0x4d9e92[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x48c0f8;}})});}_0x1854f1=_[_0x2734('0x38')]({},_0x1854f1,_0x4d9e92['options']);var _0x13022b={'where':_0x1854f1['where']};return db[_0x2734('0x25')]['count'](_0x13022b)['then'](function(_0x14a4ba){_0x55393e['count']=_0x14a4ba;if(_0x4d9e92['query'][_0x2734('0x3a')]){_0x1854f1['include']=[{'all':!![]}];}return db[_0x2734('0x25')][_0x2734('0x3b')](_0x1854f1);})['then'](function(_0x1fea11){_0x55393e[_0x2734('0x3c')]=_0x1fea11;return _0x55393e;})[_0x2734('0x22')](respondWithFilteredResult(_0xd2a1a,_0x1854f1))[_0x2734('0x3d')](handleError(_0xd2a1a,null));};exports[_0x2734('0x3e')]=function(_0x2535a4,_0x586088){var _0x3560c9={'raw':![],'where':{'id':_0x2535a4[_0x2734('0x3f')]['id']}},_0x3527c0={};_0x3527c0[_0x2734('0x40')]=_[_0x2734('0x29')](db['FreshsalesConfiguration'][_0x2734('0x41')]);_0x3527c0[_0x2734('0x2c')]=_[_0x2734('0x29')](_0x2535a4['query']);_0x3527c0['filters']=_[_0x2734('0x2b')](_0x3527c0[_0x2734('0x40')],_0x3527c0['query']);_0x3560c9[_0x2734('0x2e')]=_[_0x2734('0x2b')](_0x3527c0['model'],qs[_0x2734('0x2d')](_0x2535a4[_0x2734('0x2c')]['fields']));_0x3560c9[_0x2734('0x2e')]=_0x3560c9[_0x2734('0x2e')]['length']?_0x3560c9[_0x2734('0x2e')]:_0x3527c0[_0x2734('0x40')];if(_0x2535a4[_0x2734('0x2c')][_0x2734('0x3a')]){_0x3560c9[_0x2734('0x42')]=[{'all':!![]}];}_0x3560c9=_[_0x2734('0x38')]({},_0x3560c9,_0x2535a4[_0x2734('0x43')]);return db[_0x2734('0x25')][_0x2734('0x44')](_0x3560c9)[_0x2734('0x22')](handleEntityNotFound(_0x586088,null))[_0x2734('0x22')](respondWithResult(_0x586088,null))['catch'](handleError(_0x586088,null));};exports[_0x2734('0x45')]=function(_0x414683,_0x248c32){return db[_0x2734('0x25')][_0x2734('0x45')](_0x414683[_0x2734('0x46')],{})['then'](respondWithResult(_0x248c32,0xc9))['catch'](handleError(_0x248c32,null));};exports['update']=function(_0x3bec85,_0x3aa1c0){if(_0x3bec85[_0x2734('0x46')]['id']){delete _0x3bec85['body']['id'];}return db['FreshsalesConfiguration'][_0x2734('0x44')]({'where':{'id':_0x3bec85[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x3aa1c0,null))['then'](saveUpdates(_0x3bec85[_0x2734('0x46')],null))[_0x2734('0x22')](respondWithResult(_0x3aa1c0,null))[_0x2734('0x3d')](handleError(_0x3aa1c0,null));};exports[_0x2734('0x47')]=function(_0x2b6f36,_0x33e75c){return db['FreshsalesConfiguration'][_0x2734('0x44')]({'where':{'id':_0x2b6f36[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x33e75c,null))[_0x2734('0x22')](removeEntity(_0x33e75c,null))[_0x2734('0x3d')](handleError(_0x33e75c,null));};exports[_0x2734('0x48')]=function(_0x3e1d75,_0x527256,_0xcfd6c4){var _0x3150dd={};var _0x50f87c={};var _0x2bee25;var _0x3497ed;return db[_0x2734('0x25')][_0x2734('0x49')]({'where':{'id':_0x3e1d75[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x527256,null))[_0x2734('0x22')](function(_0x3cb4cb){if(_0x3cb4cb){_0x2bee25=_0x3cb4cb;_0x50f87c[_0x2734('0x40')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x50f87c[_0x2734('0x2c')]=_[_0x2734('0x29')](_0x3e1d75[_0x2734('0x2c')]);_0x50f87c[_0x2734('0x2a')]=_[_0x2734('0x2b')](_0x50f87c[_0x2734('0x40')],_0x50f87c['query']);_0x3150dd[_0x2734('0x2e')]=_[_0x2734('0x2b')](_0x50f87c[_0x2734('0x40')],qs[_0x2734('0x2d')](_0x3e1d75['query']['fields']));_0x3150dd['attributes']=_0x3150dd[_0x2734('0x2e')][_0x2734('0x2f')]?_0x3150dd['attributes']:_0x50f87c['model'];_0x3150dd[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x3e1d75[_0x2734('0x2c')]['sort']);_0x3150dd['where']=qs['filters'](_['pick'](_0x3e1d75[_0x2734('0x2c')],_0x50f87c[_0x2734('0x2a')]));if(_0x3e1d75[_0x2734('0x2c')][_0x2734('0x37')]){_0x3150dd[_0x2734('0x35')]=_[_0x2734('0x38')](_0x3150dd['where'],{'$or':_['map'](_0x3150dd[_0x2734('0x2e')],function(_0x2acf07){var _0x3f75f4={};_0x3f75f4[_0x2acf07]={'$like':'%'+_0x3e1d75[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x3f75f4;})});}_0x3150dd=_[_0x2734('0x38')]({},_0x3150dd,_0x3e1d75[_0x2734('0x43')]);return _0x2bee25[_0x2734('0x48')](_0x3150dd);}})[_0x2734('0x22')](function(_0x3ed436){if(_0x3ed436){_0x3497ed=_0x3ed436[_0x2734('0x2f')];if(!_0x3e1d75['query'][_0x2734('0x30')](_0x2734('0x31'))){_0x3150dd[_0x2734('0x32')]=qs[_0x2734('0x32')](_0x3e1d75[_0x2734('0x2c')]['limit']);_0x3150dd[_0x2734('0x1b')]=qs[_0x2734('0x1b')](_0x3e1d75[_0x2734('0x2c')][_0x2734('0x1b')]);}return _0x2bee25[_0x2734('0x48')](_0x3150dd);}})[_0x2734('0x22')](function(_0x210f82){if(_0x210f82){return _0x210f82?{'count':_0x3497ed,'rows':_0x210f82}:null;}})[_0x2734('0x22')](respondWithResult(_0x527256,null))['catch'](handleError(_0x527256,null));};exports[_0x2734('0x4a')]=function(_0x356696,_0x538c84,_0x28e661){var _0x378458={};var _0x205765={};var _0x438fa1;var _0x1394ed;return db[_0x2734('0x25')][_0x2734('0x49')]({'where':{'id':_0x356696[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0x538c84,null))[_0x2734('0x22')](function(_0x5d3f68){if(_0x5d3f68){_0x438fa1=_0x5d3f68;_0x205765[_0x2734('0x40')]=_['keys'](db[_0x2734('0x4b')]['rawAttributes']);_0x205765['query']=_[_0x2734('0x29')](_0x356696[_0x2734('0x2c')]);_0x205765[_0x2734('0x2a')]=_['intersection'](_0x205765['model'],_0x205765['query']);_0x378458['attributes']=_[_0x2734('0x2b')](_0x205765[_0x2734('0x40')],qs[_0x2734('0x2d')](_0x356696[_0x2734('0x2c')]['fields']));_0x378458[_0x2734('0x2e')]=_0x378458[_0x2734('0x2e')]['length']?_0x378458[_0x2734('0x2e')]:_0x205765[_0x2734('0x40')];_0x378458[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x356696['query']['sort']);_0x378458[_0x2734('0x35')]=qs[_0x2734('0x2a')](_[_0x2734('0x36')](_0x356696[_0x2734('0x2c')],_0x205765[_0x2734('0x2a')]));if(_0x356696['query'][_0x2734('0x37')]){_0x378458[_0x2734('0x35')]=_['merge'](_0x378458[_0x2734('0x35')],{'$or':_[_0x2734('0x28')](_0x378458[_0x2734('0x2e')],function(_0x53e2b6){var _0x74b552={};_0x74b552[_0x53e2b6]={'$like':'%'+_0x356696[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x74b552;})});}_0x378458=_['merge']({},_0x378458,_0x356696[_0x2734('0x43')]);return _0x438fa1[_0x2734('0x4a')](_0x378458);}})[_0x2734('0x22')](function(_0x17134c){if(_0x17134c){_0x1394ed=_0x17134c[_0x2734('0x2f')];if(!_0x356696[_0x2734('0x2c')][_0x2734('0x30')](_0x2734('0x31'))){_0x378458[_0x2734('0x32')]=qs[_0x2734('0x32')](_0x356696['query'][_0x2734('0x32')]);_0x378458[_0x2734('0x1b')]=qs[_0x2734('0x1b')](_0x356696[_0x2734('0x2c')]['offset']);}return _0x438fa1[_0x2734('0x4a')](_0x378458);}})['then'](function(_0xe61609){if(_0xe61609){return _0xe61609?{'count':_0x1394ed,'rows':_0xe61609}:null;}})['then'](respondWithResult(_0x538c84,null))['catch'](handleError(_0x538c84,null));};exports[_0x2734('0x4c')]=function(_0x1c222d,_0xa417a9,_0x46bf18){var _0x43b770={};var _0x429d3b={};var _0x582dec;var _0x55fc61;return db[_0x2734('0x25')][_0x2734('0x49')]({'where':{'id':_0x1c222d[_0x2734('0x3f')]['id']}})[_0x2734('0x22')](handleEntityNotFound(_0xa417a9,null))[_0x2734('0x22')](function(_0x13b1b8){if(_0x13b1b8){_0x582dec=_0x13b1b8;_0x429d3b[_0x2734('0x40')]=_[_0x2734('0x29')](db[_0x2734('0x4b')]['rawAttributes']);_0x429d3b[_0x2734('0x2c')]=_[_0x2734('0x29')](_0x1c222d[_0x2734('0x2c')]);_0x429d3b[_0x2734('0x2a')]=_[_0x2734('0x2b')](_0x429d3b[_0x2734('0x40')],_0x429d3b['query']);_0x43b770[_0x2734('0x2e')]=_[_0x2734('0x2b')](_0x429d3b[_0x2734('0x40')],qs[_0x2734('0x2d')](_0x1c222d[_0x2734('0x2c')][_0x2734('0x2d')]));_0x43b770[_0x2734('0x2e')]=_0x43b770[_0x2734('0x2e')]['length']?_0x43b770[_0x2734('0x2e')]:_0x429d3b[_0x2734('0x40')];_0x43b770[_0x2734('0x33')]=qs[_0x2734('0x34')](_0x1c222d[_0x2734('0x2c')][_0x2734('0x34')]);_0x43b770[_0x2734('0x35')]=qs[_0x2734('0x2a')](_['pick'](_0x1c222d['query'],_0x429d3b[_0x2734('0x2a')]));if(_0x1c222d[_0x2734('0x2c')]['filter']){_0x43b770[_0x2734('0x35')]=_['merge'](_0x43b770['where'],{'$or':_[_0x2734('0x28')](_0x43b770[_0x2734('0x2e')],function(_0x13441f){var _0x5896ea={};_0x5896ea[_0x13441f]={'$like':'%'+_0x1c222d[_0x2734('0x2c')][_0x2734('0x37')]+'%'};return _0x5896ea;})});}_0x43b770=_['merge']({},_0x43b770,_0x1c222d[_0x2734('0x43')]);return _0x582dec[_0x2734('0x4c')](_0x43b770);}})[_0x2734('0x22')](function(_0x3d8145){if(_0x3d8145){_0x55fc61=_0x3d8145[_0x2734('0x2f')];if(!_0x1c222d[_0x2734('0x2c')][_0x2734('0x30')](_0x2734('0x31'))){_0x43b770[_0x2734('0x32')]=qs[_0x2734('0x32')](_0x1c222d[_0x2734('0x2c')][_0x2734('0x32')]);_0x43b770[_0x2734('0x1b')]=qs[_0x2734('0x1b')](_0x1c222d['query'][_0x2734('0x1b')]);}return _0x582dec[_0x2734('0x4c')](_0x43b770);}})[_0x2734('0x22')](function(_0x1fdb9b){if(_0x1fdb9b){return _0x1fdb9b?{'count':_0x55fc61,'rows':_0x1fdb9b}:null;}})['then'](respondWithResult(_0xa417a9,null))[_0x2734('0x3d')](handleError(_0xa417a9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d57f900..d204693 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 _0x7aa9=['bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','api','moment'];(function(_0x1b69aa,_0x5aa147){var _0x42647d=function(_0x1743fd){while(--_0x1743fd){_0x1b69aa['push'](_0x1b69aa['shift']());}};_0x42647d(++_0x5aa147);}(_0x7aa9,0x184));var _0x97aa=function(_0x260b6f,_0x1edc36){_0x260b6f=_0x260b6f-0x0;var _0x3f672e=_0x7aa9[_0x260b6f];return _0x3f672e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x97aa('0x0'));var moment=require(_0x97aa('0x1'));var BPromise=require(_0x97aa('0x2'));var rp=require(_0x97aa('0x3'));var fs=require('fs');var path=require(_0x97aa('0x4'));var rimraf=require('rimraf');var config=require(_0x97aa('0x5'));var attributes=require(_0x97aa('0x6'));module[_0x97aa('0x7')]=function(_0xfa2c97,_0x24d2f2){return _0xfa2c97[_0x97aa('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x97aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4269=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4269,0xe9));var _0x9426=function(_0x5519e0,_0xec8f68){_0x5519e0=_0x5519e0-0x0;var _0x14dfb2=_0x4269[_0x5519e0];return _0x14dfb2;};'use strict';var _=require(_0x9426('0x0'));var util=require(_0x9426('0x1'));var logger=require(_0x9426('0x2'))('api');var moment=require(_0x9426('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9426('0x4'));var rimraf=require(_0x9426('0x5'));var config=require(_0x9426('0x6'));var attributes=require(_0x9426('0x7'));module[_0x9426('0x8')]=function(_0x37b2e2,_0x42477d){return _0x37b2e2[_0x9426('0x9')](_0x9426('0xa'),attributes,{'tableName':_0x9426('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 1e88c04..2c6f2f3 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 _0x648e=['../../mysqldb','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis'];(function(_0xf0d35,_0xce9c1c){var _0x5ba3bc=function(_0x3314d3){while(--_0x3314d3){_0xf0d35['push'](_0xf0d35['shift']());}};_0x5ba3bc(++_0xce9c1c);}(_0x648e,0xec));var _0xe648=function(_0x330fa0,_0x3c74f1){_0x330fa0=_0x330fa0-0x0;var _0x2cb882=_0x648e[_0x330fa0];return _0x2cb882;};'use strict';var _=require(_0xe648('0x0'));var util=require(_0xe648('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe648('0x2'));var fs=require('fs');var Redis=require(_0xe648('0x3'));var db=require(_0xe648('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe648('0x5'));var config=require(_0xe648('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe648('0x7')][_0xe648('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2884b1,_0x1b93d8,_0x4718c1){return new BPromise(function(_0x1371b7,_0x49403f){return client[_0xe648('0x9')](_0x2884b1,_0x4718c1)['then'](function(_0x594f73){logger[_0xe648('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b93d8,_0xe648('0xb'));logger[_0xe648('0xc')](_0xe648('0xd'),_0x1b93d8,_0xe648('0xb'),JSON[_0xe648('0xe')](_0x594f73));if(_0x594f73['error']){if(_0x594f73[_0xe648('0xf')][_0xe648('0x10')]===0x1f4){logger[_0xe648('0xf')](_0xe648('0x11'),_0x1b93d8,_0x594f73[_0xe648('0xf')][_0xe648('0x12')]);return _0x49403f(_0x594f73[_0xe648('0xf')][_0xe648('0x12')]);}logger[_0xe648('0xf')](_0xe648('0x11'),_0x1b93d8,_0x594f73[_0xe648('0xf')][_0xe648('0x12')]);return _0x1371b7(_0x594f73[_0xe648('0xf')]['message']);}else{logger['info'](_0xe648('0x11'),_0x1b93d8,'request\x20sent');_0x1371b7(_0x594f73[_0xe648('0x13')][_0xe648('0x12')]);}})['catch'](function(_0x3e8bf6){logger[_0xe648('0xf')](_0xe648('0x11'),_0x1b93d8,_0x3e8bf6);_0x49403f(_0x3e8bf6);});});} \ No newline at end of file +var _0x34fa=['stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x34fa,0x1aa));var _0xa34f=function(_0x537a06,_0x88b891){_0x537a06=_0x537a06-0x0;var _0xcf8a4b=_0x34fa[_0x537a06];return _0xcf8a4b;};'use strict';var _=require(_0xa34f('0x0'));var util=require(_0xa34f('0x1'));var moment=require(_0xa34f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa34f('0x3'));var db=require(_0xa34f('0x4'))['db'];var utils=require(_0xa34f('0x5'));var logger=require(_0xa34f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa34f('0x7'));var client=jayson['client'][_0xa34f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e655d,_0x50b12e,_0x5a63a7){return new BPromise(function(_0x3925dd,_0x1c091f){return client['request'](_0x5e655d,_0x5a63a7)[_0xa34f('0x9')](function(_0x454b91){logger[_0xa34f('0xa')](_0xa34f('0xb'),_0x50b12e,_0xa34f('0xc'));logger[_0xa34f('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x50b12e,_0xa34f('0xc'),JSON[_0xa34f('0xe')](_0x454b91));if(_0x454b91[_0xa34f('0xf')]){if(_0x454b91[_0xa34f('0xf')][_0xa34f('0x10')]===0x1f4){logger[_0xa34f('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x50b12e,_0x454b91[_0xa34f('0xf')][_0xa34f('0x11')]);return _0x1c091f(_0x454b91['error'][_0xa34f('0x11')]);}logger[_0xa34f('0xf')](_0xa34f('0xb'),_0x50b12e,_0x454b91[_0xa34f('0xf')][_0xa34f('0x11')]);return _0x3925dd(_0x454b91['error'][_0xa34f('0x11')]);}else{logger[_0xa34f('0xa')](_0xa34f('0xb'),_0x50b12e,'request\x20sent');_0x3925dd(_0x454b91[_0xa34f('0x12')][_0xa34f('0x11')]);}})[_0xa34f('0x13')](function(_0x498ed3){logger[_0xa34f('0xf')](_0xa34f('0xb'),_0x50b12e,_0x498ed3);_0x1c091f(_0x498ed3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 2176abf..d96121c 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 _0x32ef=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','delete'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0x32ef,0xf9));var _0xf32e=function(_0x1dfab8,_0xb5f32d){_0x1dfab8=_0x1dfab8-0x0;var _0x59688e=_0x32ef[_0x1dfab8];return _0x59688e;};'use strict';var multer=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var path=require(_0xf32e('0x2'));var timeout=require(_0xf32e('0x3'));var express=require(_0xf32e('0x4'));var router=express[_0xf32e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf32e('0x6'));var interaction=require(_0xf32e('0x7'));var config=require('../../config/environment');var controller=require(_0xf32e('0x8'));router[_0xf32e('0x9')]('/',auth[_0xf32e('0xa')](),controller[_0xf32e('0xb')]);router[_0xf32e('0x9')](_0xf32e('0xc'),auth['isAuthenticated'](),controller[_0xf32e('0xd')]);router['post']('/',auth[_0xf32e('0xa')](),controller[_0xf32e('0xe')]);router[_0xf32e('0xf')](_0xf32e('0xc'),auth[_0xf32e('0xa')](),controller['update']);router[_0xf32e('0x10')](_0xf32e('0xc'),auth[_0xf32e('0xa')](),controller[_0xf32e('0x11')]);module[_0xf32e('0x12')]=router; \ No newline at end of file +var _0xf53f=['get','isAuthenticated','show','post','put','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0xe53e44,_0x172df){var _0x1bae8e=function(_0x5b385b){while(--_0x5b385b){_0xe53e44['push'](_0xe53e44['shift']());}};_0x1bae8e(++_0x172df);}(_0xf53f,0x8d));var _0xff53=function(_0x137e11,_0x27a58d){_0x137e11=_0x137e11-0x0;var _0xb2774f=_0xf53f[_0x137e11];return _0xb2774f;};'use strict';var multer=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var path=require(_0xff53('0x2'));var timeout=require(_0xff53('0x3'));var express=require(_0xff53('0x4'));var router=express[_0xff53('0x5')]();var fs_extra=require(_0xff53('0x6'));var auth=require(_0xff53('0x7'));var interaction=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var controller=require(_0xff53('0xa'));router[_0xff53('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff53('0xb')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0xd')]);router[_0xff53('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff53('0xf')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0x10')]);router['delete'](_0xff53('0x11'),auth[_0xff53('0xc')](),controller['destroy']);module[_0xff53('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a9f6858..0587afc 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 _0xf579=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','string'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0xf579,0xcf));var _0x9f57=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xf579[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x9f57('0x0'),_0x9f57('0x1'),_0x9f57('0x2'),_0x9f57('0x3'),_0x9f57('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9f57('0x5')]},'keyType':{'type':Sequelize[_0x9f57('0x6')](_0x9f57('0x0'),'variable',_0x9f57('0x2'))},'keyContent':{'type':Sequelize[_0x9f57('0x5')]},'idField':{'type':Sequelize[_0x9f57('0x5')]},'nameField':{'type':Sequelize[_0x9f57('0x5')]},'customField':{'type':Sequelize[_0x9f57('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb398=['STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','picklist'];(function(_0x7afa09,_0x39bf57){var _0x261bc6=function(_0x4c91e6){while(--_0x4c91e6){_0x7afa09['push'](_0x7afa09['shift']());}};_0x261bc6(++_0x39bf57);}(_0xb398,0x1d3));var _0x8b39=function(_0x5cee2e,_0x4d0d08){_0x5cee2e=_0x5cee2e-0x0;var _0x19d977=_0xb398[_0x5cee2e];return _0x19d977;};'use strict';var Sequelize=require('sequelize');module[_0x8b39('0x0')]={'type':{'type':Sequelize[_0x8b39('0x1')](_0x8b39('0x2'),'variable',_0x8b39('0x3'),'keyValue',_0x8b39('0x4')),'defaultValue':_0x8b39('0x2')},'content':{'type':Sequelize[_0x8b39('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8b39('0x2'),_0x8b39('0x6'),_0x8b39('0x3'))},'keyContent':{'type':Sequelize[_0x8b39('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8b39('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b39('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 73c58c1..82546f0 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 _0x4753=['model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','catch','destroy','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','FreshsalesField','rawAttributes','key'];(function(_0x440f5e,_0x3f755b){var _0xecbd7e=function(_0x414584){while(--_0x414584){_0x440f5e['push'](_0x440f5e['shift']());}};_0xecbd7e(++_0x3f755b);}(_0x4753,0x183));var _0x3475=function(_0x4bd35f,_0x5b44f3){_0x4bd35f=_0x4bd35f-0x0;var _0x4916af=_0x4753[_0x4bd35f];return _0x4916af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3475('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3475('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3475('0x2'));var util=require(_0x3475('0x3'));var path=require(_0x3475('0x4'));var sox=require(_0x3475('0x5'));var csv=require(_0x3475('0x6'));var ejs=require(_0x3475('0x7'));var fs=require('fs');var fs_extra=require(_0x3475('0x8'));var _=require('lodash');var squel=require(_0x3475('0x9'));var crypto=require(_0x3475('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3475('0x6'));var querystring=require(_0x3475('0xb'));var Papa=require(_0x3475('0xc'));var Redis=require(_0x3475('0xd'));var authService=require(_0x3475('0xe'));var qs=require(_0x3475('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3475('0x10'))(_0x3475('0x11'));var utils=require(_0x3475('0x12'));var config=require(_0x3475('0x13'));var licenseUtil=require(_0x3475('0x14'));var db=require(_0x3475('0x15'))['db'];function respondWithStatusCode(_0x4f5004,_0x29ca43){_0x29ca43=_0x29ca43||0xcc;return function(_0x4a9968){if(_0x4a9968){return _0x4f5004[_0x3475('0x16')](_0x29ca43);}return _0x4f5004[_0x3475('0x17')](_0x29ca43)[_0x3475('0x18')]();};}function respondWithResult(_0x4e2e4a,_0x45eb28){_0x45eb28=_0x45eb28||0xc8;return function(_0x1fd88d){if(_0x1fd88d){return _0x4e2e4a[_0x3475('0x17')](_0x45eb28)[_0x3475('0x19')](_0x1fd88d);}};}function respondWithFilteredResult(_0x33d987,_0x2c16be){return function(_0x3e3b46){if(_0x3e3b46){var _0x45195f=typeof _0x2c16be['offset']===_0x3475('0x1a')&&typeof _0x2c16be[_0x3475('0x1b')]===_0x3475('0x1a');var _0x451914=_0x3e3b46[_0x3475('0x1c')];var _0x393dc2=_0x45195f?0x0:_0x2c16be[_0x3475('0x1d')];var _0x4c2162=_0x45195f?_0x3e3b46[_0x3475('0x1c')]:_0x2c16be[_0x3475('0x1d')]+_0x2c16be[_0x3475('0x1b')];var _0x345f18;if(_0x4c2162>=_0x451914){_0x4c2162=_0x451914;_0x345f18=0xc8;}else{_0x345f18=0xce;}_0x33d987['status'](_0x345f18);return _0x33d987[_0x3475('0x1e')](_0x3475('0x1f'),_0x393dc2+'-'+_0x4c2162+'/'+_0x451914)[_0x3475('0x19')](_0x3e3b46);}return null;};}function patchUpdates(_0x18ff98){return function(_0x5d37f9){try{jsonpatch[_0x3475('0x20')](_0x5d37f9,_0x18ff98,!![]);}catch(_0x20e17d){return BPromise[_0x3475('0x21')](_0x20e17d);}return _0x5d37f9[_0x3475('0x22')]();};}function saveUpdates(_0x210798,_0x595319){return function(_0x1e3d1b){if(_0x1e3d1b){return _0x1e3d1b[_0x3475('0x23')](_0x210798)[_0x3475('0x24')](function(_0x4a78fd){return _0x4a78fd;});}return null;};}function removeEntity(_0x57a804,_0x3fac64){return function(_0x16b68b){if(_0x16b68b){return _0x16b68b['destroy']()[_0x3475('0x24')](function(){_0x57a804['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9128,_0x2d7b11){return function(_0x9189c0){if(!_0x9189c0){_0x4f9128[_0x3475('0x16')](0x194);}return _0x9189c0;};}function handleError(_0xa61aed,_0x18993a){_0x18993a=_0x18993a||0x1f4;return function(_0xe7d7f9){logger['error'](_0xe7d7f9[_0x3475('0x25')]);if(_0xe7d7f9[_0x3475('0x26')]){delete _0xe7d7f9[_0x3475('0x26')];}_0xa61aed['status'](_0x18993a)[_0x3475('0x27')](_0xe7d7f9);};}exports[_0x3475('0x28')]=function(_0x349a0d,_0x2b1443){var _0x114c78={},_0x2a0be0={},_0x5d18f0={'count':0x0,'rows':[]};var _0xc8e7ab=_[_0x3475('0x29')](db[_0x3475('0x2a')][_0x3475('0x2b')],function(_0x2e9df0){return{'name':_0x2e9df0['fieldName'],'type':_0x2e9df0['type'][_0x3475('0x2c')]};});_0x2a0be0[_0x3475('0x2d')]=_['map'](_0xc8e7ab,_0x3475('0x26'));_0x2a0be0['query']=_[_0x3475('0x2e')](_0x349a0d[_0x3475('0x2f')]);_0x2a0be0['filters']=_[_0x3475('0x30')](_0x2a0be0[_0x3475('0x2d')],_0x2a0be0[_0x3475('0x2f')]);_0x114c78[_0x3475('0x31')]=_['intersection'](_0x2a0be0[_0x3475('0x2d')],qs[_0x3475('0x32')](_0x349a0d['query'][_0x3475('0x32')]));_0x114c78[_0x3475('0x31')]=_0x114c78[_0x3475('0x31')]['length']?_0x114c78[_0x3475('0x31')]:_0x2a0be0['model'];if(!_0x349a0d[_0x3475('0x2f')][_0x3475('0x33')](_0x3475('0x34'))){_0x114c78['limit']=qs[_0x3475('0x1b')](_0x349a0d[_0x3475('0x2f')][_0x3475('0x1b')]);_0x114c78[_0x3475('0x1d')]=qs[_0x3475('0x1d')](_0x349a0d[_0x3475('0x2f')]['offset']);}_0x114c78[_0x3475('0x35')]=qs[_0x3475('0x36')](_0x349a0d['query'][_0x3475('0x36')]);_0x114c78[_0x3475('0x37')]=qs[_0x3475('0x38')](_['pick'](_0x349a0d[_0x3475('0x2f')],_0x2a0be0[_0x3475('0x38')]),_0xc8e7ab);if(_0x349a0d['query']['filter']){_0x114c78['where']=_[_0x3475('0x39')](_0x114c78[_0x3475('0x37')],{'$or':_[_0x3475('0x29')](_0xc8e7ab,function(_0x5931f1){if(_0x5931f1[_0x3475('0x3a')]!==_0x3475('0x3b')){var _0x9da293={};_0x9da293[_0x5931f1['name']]={'$like':'%'+_0x349a0d[_0x3475('0x2f')][_0x3475('0x3c')]+'%'};return _0x9da293;}})});}_0x114c78=_[_0x3475('0x39')]({},_0x114c78,_0x349a0d[_0x3475('0x3d')]);var _0x1c9d9e={'where':_0x114c78[_0x3475('0x37')]};return db[_0x3475('0x2a')][_0x3475('0x1c')](_0x1c9d9e)[_0x3475('0x24')](function(_0xc02670){_0x5d18f0['count']=_0xc02670;if(_0x349a0d['query'][_0x3475('0x3e')]){_0x114c78[_0x3475('0x3f')]=[{'all':!![]}];}return db[_0x3475('0x2a')][_0x3475('0x40')](_0x114c78);})[_0x3475('0x24')](function(_0x262eaa){_0x5d18f0[_0x3475('0x41')]=_0x262eaa;return _0x5d18f0;})[_0x3475('0x24')](respondWithFilteredResult(_0x2b1443,_0x114c78))['catch'](handleError(_0x2b1443,null));};exports['show']=function(_0x291e0c,_0x5d363b){var _0x5acbbd={'raw':!![],'where':{'id':_0x291e0c[_0x3475('0x42')]['id']}},_0x353ca8={};_0x353ca8['model']=_['keys'](db['FreshsalesField'][_0x3475('0x2b')]);_0x353ca8['query']=_[_0x3475('0x2e')](_0x291e0c[_0x3475('0x2f')]);_0x353ca8['filters']=_[_0x3475('0x30')](_0x353ca8[_0x3475('0x2d')],_0x353ca8['query']);_0x5acbbd[_0x3475('0x31')]=_['intersection'](_0x353ca8[_0x3475('0x2d')],qs[_0x3475('0x32')](_0x291e0c[_0x3475('0x2f')]['fields']));_0x5acbbd[_0x3475('0x31')]=_0x5acbbd['attributes']['length']?_0x5acbbd[_0x3475('0x31')]:_0x353ca8[_0x3475('0x2d')];if(_0x291e0c[_0x3475('0x2f')][_0x3475('0x3e')]){_0x5acbbd[_0x3475('0x3f')]=[{'all':!![]}];}_0x5acbbd=_[_0x3475('0x39')]({},_0x5acbbd,_0x291e0c[_0x3475('0x3d')]);return db[_0x3475('0x2a')][_0x3475('0x43')](_0x5acbbd)['then'](handleEntityNotFound(_0x5d363b,null))[_0x3475('0x24')](respondWithResult(_0x5d363b,null))['catch'](handleError(_0x5d363b,null));};exports[_0x3475('0x44')]=function(_0x134256,_0x9298ef){return db['FreshsalesField'][_0x3475('0x44')](_0x134256[_0x3475('0x45')],{})[_0x3475('0x24')](respondWithResult(_0x9298ef,0xc9))['catch'](handleError(_0x9298ef,null));};exports[_0x3475('0x23')]=function(_0x4f866f,_0x739aa){if(_0x4f866f[_0x3475('0x45')]['id']){delete _0x4f866f[_0x3475('0x45')]['id'];}return db[_0x3475('0x2a')][_0x3475('0x43')]({'where':{'id':_0x4f866f['params']['id']}})[_0x3475('0x24')](handleEntityNotFound(_0x739aa,null))[_0x3475('0x24')](saveUpdates(_0x4f866f[_0x3475('0x45')],null))[_0x3475('0x24')](respondWithResult(_0x739aa,null))[_0x3475('0x46')](handleError(_0x739aa,null));};exports[_0x3475('0x47')]=function(_0x35f9b8,_0x3e026a){return db[_0x3475('0x2a')]['find']({'where':{'id':_0x35f9b8['params']['id']}})['then'](handleEntityNotFound(_0x3e026a,null))[_0x3475('0x24')](removeEntity(_0x3e026a,null))[_0x3475('0x46')](handleError(_0x3e026a,null));}; \ No newline at end of file +var _0xeae8=['eml-format','zip-dir','request-promise','mustache','sox','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','create','body','params','find'];(function(_0x36a3c5,_0x3bd7e6){var _0x369a67=function(_0x54d6ff){while(--_0x54d6ff){_0x36a3c5['push'](_0x36a3c5['shift']());}};_0x369a67(++_0x3bd7e6);}(_0xeae8,0x108));var _0x8eae=function(_0x17f234,_0x2ab699){_0x17f234=_0x17f234-0x0;var _0xf64326=_0xeae8[_0x17f234];return _0xf64326;};'use strict';var emlformat=require(_0x8eae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8eae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8eae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8eae('0x3'));var util=require('util');var path=require('path');var sox=require(_0x8eae('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8eae('0x5'));var _=require(_0x8eae('0x6'));var squel=require('squel');var crypto=require(_0x8eae('0x7'));var jsforce=require(_0x8eae('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x8eae('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8eae('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x8eae('0xb'));var as=require(_0x8eae('0xc'));var hardwareService=require(_0x8eae('0xd'));var logger=require(_0x8eae('0xe'))(_0x8eae('0xf'));var utils=require(_0x8eae('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d961d,_0x1bf216){_0x1bf216=_0x1bf216||0xcc;return function(_0x2891ff){if(_0x2891ff){return _0x4d961d['sendStatus'](_0x1bf216);}return _0x4d961d[_0x8eae('0x11')](_0x1bf216)[_0x8eae('0x12')]();};}function respondWithResult(_0x1b220d,_0x266c5c){_0x266c5c=_0x266c5c||0xc8;return function(_0x154673){if(_0x154673){return _0x1b220d[_0x8eae('0x11')](_0x266c5c)['json'](_0x154673);}};}function respondWithFilteredResult(_0x4de031,_0x3f785c){return function(_0x4aa65c){if(_0x4aa65c){var _0x224538=typeof _0x3f785c[_0x8eae('0x13')]===_0x8eae('0x14')&&typeof _0x3f785c['limit']===_0x8eae('0x14');var _0x4547f7=_0x4aa65c[_0x8eae('0x15')];var _0xaaa325=_0x224538?0x0:_0x3f785c['offset'];var _0x423be5=_0x224538?_0x4aa65c[_0x8eae('0x15')]:_0x3f785c['offset']+_0x3f785c[_0x8eae('0x16')];var _0x28730a;if(_0x423be5>=_0x4547f7){_0x423be5=_0x4547f7;_0x28730a=0xc8;}else{_0x28730a=0xce;}_0x4de031[_0x8eae('0x11')](_0x28730a);return _0x4de031['set'](_0x8eae('0x17'),_0xaaa325+'-'+_0x423be5+'/'+_0x4547f7)['json'](_0x4aa65c);}return null;};}function patchUpdates(_0x300685){return function(_0x5c24df){try{jsonpatch[_0x8eae('0x18')](_0x5c24df,_0x300685,!![]);}catch(_0xa1e8e9){return BPromise['reject'](_0xa1e8e9);}return _0x5c24df[_0x8eae('0x19')]();};}function saveUpdates(_0x4db730,_0x821424){return function(_0x16c510){if(_0x16c510){return _0x16c510[_0x8eae('0x1a')](_0x4db730)[_0x8eae('0x1b')](function(_0x56c924){return _0x56c924;});}return null;};}function removeEntity(_0x29fd1a,_0x3c60a5){return function(_0x211730){if(_0x211730){return _0x211730[_0x8eae('0x1c')]()[_0x8eae('0x1b')](function(){_0x29fd1a['status'](0xcc)[_0x8eae('0x12')]();});}};}function handleEntityNotFound(_0x3cc683,_0x4c75de){return function(_0x52cdc9){if(!_0x52cdc9){_0x3cc683[_0x8eae('0x1d')](0x194);}return _0x52cdc9;};}function handleError(_0x1d51f8,_0x3e07ce){_0x3e07ce=_0x3e07ce||0x1f4;return function(_0x11daeb){logger[_0x8eae('0x1e')](_0x11daeb['stack']);if(_0x11daeb['name']){delete _0x11daeb[_0x8eae('0x1f')];}_0x1d51f8[_0x8eae('0x11')](_0x3e07ce)[_0x8eae('0x20')](_0x11daeb);};}exports[_0x8eae('0x21')]=function(_0x3b2b72,_0x9789c9){var _0x5c1577={},_0x1c2055={},_0x57e6ce={'count':0x0,'rows':[]};var _0x32ad30=_[_0x8eae('0x22')](db[_0x8eae('0x23')][_0x8eae('0x24')],function(_0x29f947){return{'name':_0x29f947[_0x8eae('0x25')],'type':_0x29f947[_0x8eae('0x26')]['key']};});_0x1c2055['model']=_['map'](_0x32ad30,'name');_0x1c2055[_0x8eae('0x27')]=_[_0x8eae('0x28')](_0x3b2b72[_0x8eae('0x27')]);_0x1c2055[_0x8eae('0x29')]=_[_0x8eae('0x2a')](_0x1c2055[_0x8eae('0x2b')],_0x1c2055[_0x8eae('0x27')]);_0x5c1577[_0x8eae('0x2c')]=_[_0x8eae('0x2a')](_0x1c2055[_0x8eae('0x2b')],qs[_0x8eae('0x2d')](_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x2d')]));_0x5c1577[_0x8eae('0x2c')]=_0x5c1577[_0x8eae('0x2c')][_0x8eae('0x2e')]?_0x5c1577['attributes']:_0x1c2055[_0x8eae('0x2b')];if(!_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x2f')](_0x8eae('0x30'))){_0x5c1577['limit']=qs['limit'](_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x16')]);_0x5c1577[_0x8eae('0x13')]=qs[_0x8eae('0x13')](_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x13')]);}_0x5c1577[_0x8eae('0x31')]=qs[_0x8eae('0x32')](_0x3b2b72['query'][_0x8eae('0x32')]);_0x5c1577[_0x8eae('0x33')]=qs[_0x8eae('0x29')](_[_0x8eae('0x34')](_0x3b2b72['query'],_0x1c2055['filters']),_0x32ad30);if(_0x3b2b72[_0x8eae('0x27')][_0x8eae('0x35')]){_0x5c1577[_0x8eae('0x33')]=_[_0x8eae('0x36')](_0x5c1577['where'],{'$or':_[_0x8eae('0x22')](_0x32ad30,function(_0x53b40b){if(_0x53b40b[_0x8eae('0x26')]!==_0x8eae('0x37')){var _0x5b8bec={};_0x5b8bec[_0x53b40b['name']]={'$like':'%'+_0x3b2b72[_0x8eae('0x27')]['filter']+'%'};return _0x5b8bec;}})});}_0x5c1577=_['merge']({},_0x5c1577,_0x3b2b72[_0x8eae('0x38')]);var _0x56015e={'where':_0x5c1577[_0x8eae('0x33')]};return db['FreshsalesField'][_0x8eae('0x15')](_0x56015e)[_0x8eae('0x1b')](function(_0x281607){_0x57e6ce[_0x8eae('0x15')]=_0x281607;if(_0x3b2b72[_0x8eae('0x27')]['includeAll']){_0x5c1577['include']=[{'all':!![]}];}return db[_0x8eae('0x23')]['findAll'](_0x5c1577);})[_0x8eae('0x1b')](function(_0x22e7ed){_0x57e6ce[_0x8eae('0x39')]=_0x22e7ed;return _0x57e6ce;})[_0x8eae('0x1b')](respondWithFilteredResult(_0x9789c9,_0x5c1577))[_0x8eae('0x3a')](handleError(_0x9789c9,null));};exports[_0x8eae('0x3b')]=function(_0x2cb1a9,_0x288136){var _0x8438e0={'raw':!![],'where':{'id':_0x2cb1a9['params']['id']}},_0x5b9473={};_0x5b9473[_0x8eae('0x2b')]=_[_0x8eae('0x28')](db[_0x8eae('0x23')][_0x8eae('0x24')]);_0x5b9473[_0x8eae('0x27')]=_[_0x8eae('0x28')](_0x2cb1a9[_0x8eae('0x27')]);_0x5b9473[_0x8eae('0x29')]=_[_0x8eae('0x2a')](_0x5b9473['model'],_0x5b9473[_0x8eae('0x27')]);_0x8438e0[_0x8eae('0x2c')]=_[_0x8eae('0x2a')](_0x5b9473[_0x8eae('0x2b')],qs[_0x8eae('0x2d')](_0x2cb1a9[_0x8eae('0x27')][_0x8eae('0x2d')]));_0x8438e0[_0x8eae('0x2c')]=_0x8438e0['attributes'][_0x8eae('0x2e')]?_0x8438e0['attributes']:_0x5b9473[_0x8eae('0x2b')];if(_0x2cb1a9[_0x8eae('0x27')][_0x8eae('0x3c')]){_0x8438e0[_0x8eae('0x3d')]=[{'all':!![]}];}_0x8438e0=_[_0x8eae('0x36')]({},_0x8438e0,_0x2cb1a9[_0x8eae('0x38')]);return db[_0x8eae('0x23')]['find'](_0x8438e0)[_0x8eae('0x1b')](handleEntityNotFound(_0x288136,null))[_0x8eae('0x1b')](respondWithResult(_0x288136,null))[_0x8eae('0x3a')](handleError(_0x288136,null));};exports['create']=function(_0x495fc0,_0x4988d9){return db[_0x8eae('0x23')][_0x8eae('0x3e')](_0x495fc0[_0x8eae('0x3f')],{})['then'](respondWithResult(_0x4988d9,0xc9))[_0x8eae('0x3a')](handleError(_0x4988d9,null));};exports[_0x8eae('0x1a')]=function(_0x2023de,_0xbc6a02){if(_0x2023de['body']['id']){delete _0x2023de[_0x8eae('0x3f')]['id'];}return db[_0x8eae('0x23')]['find']({'where':{'id':_0x2023de[_0x8eae('0x40')]['id']}})[_0x8eae('0x1b')](handleEntityNotFound(_0xbc6a02,null))['then'](saveUpdates(_0x2023de[_0x8eae('0x3f')],null))[_0x8eae('0x1b')](respondWithResult(_0xbc6a02,null))['catch'](handleError(_0xbc6a02,null));};exports['destroy']=function(_0x5cdd3e,_0x3ff93c){return db['FreshsalesField'][_0x8eae('0x41')]({'where':{'id':_0x5cdd3e[_0x8eae('0x40')]['id']}})[_0x8eae('0x1b')](handleEntityNotFound(_0x3ff93c,null))[_0x8eae('0x1b')](removeEntity(_0x3ff93c,null))[_0x8eae('0x3a')](handleError(_0x3ff93c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 571f5e1..fd7b0c1 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 _0x5532=['rimraf','./intFreshsalesField.attributes','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x533676,_0x2be01c){var _0x32f7bd=function(_0x5b28fd){while(--_0x5b28fd){_0x533676['push'](_0x533676['shift']());}};_0x32f7bd(++_0x2be01c);}(_0x5532,0x19a));var _0x2553=function(_0x15d16c,_0x4fcd1c){_0x15d16c=_0x15d16c-0x0;var _0x52774c=_0x5532[_0x15d16c];return _0x52774c;};'use strict';var _=require(_0x2553('0x0'));var util=require(_0x2553('0x1'));var logger=require(_0x2553('0x2'))('api');var moment=require(_0x2553('0x3'));var BPromise=require('bluebird');var rp=require(_0x2553('0x4'));var fs=require('fs');var path=require(_0x2553('0x5'));var rimraf=require(_0x2553('0x6'));var config=require('../../config/environment');var attributes=require(_0x2553('0x7'));module['exports']=function(_0x506c9a,_0x45358c){return _0x506c9a[_0x2553('0x8')]('FreshsalesField',attributes,{'tableName':_0x2553('0x9'),'paranoid':![],'indexes':[{'name':_0x2553('0xa'),'fields':[_0x2553('0xb'),_0x2553('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8374=['FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x2da352,_0x5a2291){var _0x1ab378=function(_0x33dacd){while(--_0x33dacd){_0x2da352['push'](_0x2da352['shift']());}};_0x1ab378(++_0x5a2291);}(_0x8374,0x174));var _0x4837=function(_0x1b024e,_0x1cff73){_0x1b024e=_0x1b024e-0x0;var _0x376252=_0x8374[_0x1b024e];return _0x376252;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var logger=require(_0x4837('0x2'))(_0x4837('0x3'));var moment=require(_0x4837('0x4'));var BPromise=require(_0x4837('0x5'));var rp=require(_0x4837('0x6'));var fs=require('fs');var path=require(_0x4837('0x7'));var rimraf=require(_0x4837('0x8'));var config=require(_0x4837('0x9'));var attributes=require(_0x4837('0xa'));module[_0x4837('0xb')]=function(_0x2bd5a7,_0x425c07){return _0x2bd5a7['define'](_0x4837('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x4837('0xd'),'fields':[_0x4837('0xe'),_0x4837('0xf')],'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 74385c1..38fab52 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2e3c05,_0x37dc4a){var _0x24d743=function(_0x513fee){while(--_0x513fee){_0x2e3c05['push'](_0x2e3c05['shift']());}};_0x24d743(++_0x37dc4a);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3f2d7a,_0x539136){_0x3f2d7a=_0x3f2d7a-0x0;var _0x5ad277=_0x3f8a[_0x3f2d7a];return _0x5ad277;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 60171d5..5d3f959 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(_0x354889,_0x16fedf){var _0x374df2=function(_0x1ae7af){while(--_0x1ae7af){_0x354889['push'](_0x354889['shift']());}};_0x374df2(++_0x16fedf);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3234cf,_0x134836){var _0x300532=function(_0x5ca0c9){while(--_0x5ca0c9){_0x3234cf['push'](_0x3234cf['shift']());}};_0x300532(++_0x134836);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 6c5e541..c1721be 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 _0xab00=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x3afb41,_0x4fc724){var _0x4da47c=function(_0x1fb7b1){while(--_0x1fb7b1){_0x3afb41['push'](_0x3afb41['shift']());}};_0x4da47c(++_0x4fc724);}(_0xab00,0x1b9));var _0x0ab0=function(_0x4694b6,_0x33faac){_0x4694b6=_0x4694b6-0x0;var _0x3fb293=_0xab00[_0x4694b6];return _0x3fb293;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module[_0x0ab0('0x1')]={'name':{'type':Sequelize[_0x0ab0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0ab0('0x2')],'unique':_0x0ab0('0x3')},'remoteUri':{'type':Sequelize[_0x0ab0('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x0ab0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x0ab0('0x2')]},'serverUrl':{'type':Sequelize[_0x0ab0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ab0('0x4')](_0x0ab0('0x5'),_0x0ab0('0x6')),'defaultValue':_0x0ab0('0x5')}}; \ No newline at end of file +var _0x8383=['newTab','integrationTab','sequelize','STRING','username','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8383,0x98));var _0x3838=function(_0xdb18de,_0x2d88aa){_0xdb18de=_0xdb18de-0x0;var _0x53679a=_0x8383[_0xdb18de];return _0x53679a;};'use strict';var Sequelize=require(_0x3838('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3838('0x1')]},'username':{'type':Sequelize[_0x3838('0x1')],'unique':_0x3838('0x2')},'remoteUri':{'type':Sequelize[_0x3838('0x1')]},'password':{'type':Sequelize[_0x3838('0x1')]},'clientId':{'type':Sequelize[_0x3838('0x1')]},'clientSecret':{'type':Sequelize[_0x3838('0x1')]},'securityToken':{'type':Sequelize[_0x3838('0x1')]},'serverUrl':{'type':Sequelize[_0x3838('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3838('0x3')]('integrationTab',_0x3838('0x4')),'defaultValue':_0x3838('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 93a6922..241c2a1 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 _0x8a59=['clientId','slice','substring','lastIndexOf','Connection','clientSecret','login','username','password','concat','securityToken','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','email','textarea','includes','label','custom','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','end','error','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','length','sort','where','pick','VIRTUAL','merge','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','destroy','findOne','order','filter','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8a59,0xa2));var _0x98a5=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x8a59[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0x98a5('0x0'));var rimraf=require(_0x98a5('0x1'));var zipdir=require(_0x98a5('0x2'));var jsonpatch=require(_0x98a5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x98a5('0x4'));var util=require(_0x98a5('0x5'));var path=require('path');var sox=require(_0x98a5('0x6'));var csv=require('to-csv');var ejs=require(_0x98a5('0x7'));var fs=require('fs');var fs_extra=require(_0x98a5('0x8'));var _=require('lodash');var squel=require(_0x98a5('0x9'));var crypto=require(_0x98a5('0xa'));var jsforce=require(_0x98a5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x98a5('0xc'));var querystring=require('querystring');var Papa=require(_0x98a5('0xd'));var Redis=require('ioredis');var authService=require(_0x98a5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x98a5('0xf'));var hardwareService=require(_0x98a5('0x10'));var logger=require('../../config/logger')(_0x98a5('0x11'));var utils=require(_0x98a5('0x12'));var config=require(_0x98a5('0x13'));var licenseUtil=require(_0x98a5('0x14'));var db=require(_0x98a5('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x571fea,_0x29c6bb){_0x29c6bb=_0x29c6bb||0xcc;return function(_0xaa1081){if(_0xaa1081){return _0x571fea[_0x98a5('0x16')](_0x29c6bb);}return _0x571fea[_0x98a5('0x17')](_0x29c6bb)['end']();};}function respondWithResult(_0x26058c,_0x4c5c37){_0x4c5c37=_0x4c5c37||0xc8;return function(_0x263044){if(_0x263044){return _0x26058c[_0x98a5('0x17')](_0x4c5c37)[_0x98a5('0x18')](_0x263044);}};}function respondWithFilteredResult(_0x442628,_0x2c2b18){return function(_0x599338){if(_0x599338){var _0x4e97c6=typeof _0x2c2b18['offset']===_0x98a5('0x19')&&typeof _0x2c2b18['limit']==='undefined';var _0x4be040=_0x599338[_0x98a5('0x1a')];var _0x2deeef=_0x4e97c6?0x0:_0x2c2b18[_0x98a5('0x1b')];var _0x545a78=_0x4e97c6?_0x599338[_0x98a5('0x1a')]:_0x2c2b18[_0x98a5('0x1b')]+_0x2c2b18[_0x98a5('0x1c')];var _0x59f83d;if(_0x545a78>=_0x4be040){_0x545a78=_0x4be040;_0x59f83d=0xc8;}else{_0x59f83d=0xce;}_0x442628[_0x98a5('0x17')](_0x59f83d);return _0x442628[_0x98a5('0x1d')](_0x98a5('0x1e'),_0x2deeef+'-'+_0x545a78+'/'+_0x4be040)[_0x98a5('0x18')](_0x599338);}return null;};}function patchUpdates(_0x34f148){return function(_0x3d2bad){try{jsonpatch[_0x98a5('0x1f')](_0x3d2bad,_0x34f148,!![]);}catch(_0xfb992d){return BPromise[_0x98a5('0x20')](_0xfb992d);}return _0x3d2bad['save']();};}function saveUpdates(_0x4c1e88,_0x4d0f51){return function(_0x4acc9e){if(_0x4acc9e){return _0x4acc9e['update'](_0x4c1e88)[_0x98a5('0x21')](function(_0x5f3f2f){return _0x5f3f2f;});}return null;};}function removeEntity(_0x45326d,_0x51cd46){return function(_0x5d0ae3){if(_0x5d0ae3){return _0x5d0ae3['destroy']()[_0x98a5('0x21')](function(){_0x45326d['status'](0xcc)[_0x98a5('0x22')]();});}};}function handleEntityNotFound(_0xc407a5,_0x2a35ba){return function(_0x223a8d){if(!_0x223a8d){_0xc407a5[_0x98a5('0x16')](0x194);}return _0x223a8d;};}function handleError(_0x2e5e23,_0x339213){_0x339213=_0x339213||0x1f4;return function(_0x42abf4){logger[_0x98a5('0x23')](_0x42abf4['stack']);if(_0x42abf4['name']){delete _0x42abf4['name'];}_0x2e5e23[_0x98a5('0x17')](_0x339213)['send'](_0x42abf4);};}exports[_0x98a5('0x24')]=function(_0x27a02b,_0x1dadb0){var _0x19fd5e={},_0x325dec={},_0x45bc8f={'count':0x0,'rows':[]};var _0x539b2e=_[_0x98a5('0x25')](db['SalesforceAccount'][_0x98a5('0x26')],function(_0x39d962){return{'name':_0x39d962[_0x98a5('0x27')],'type':_0x39d962[_0x98a5('0x28')]['key']};});_0x325dec[_0x98a5('0x29')]=_[_0x98a5('0x25')](_0x539b2e,_0x98a5('0x2a'));_0x325dec[_0x98a5('0x2b')]=_[_0x98a5('0x2c')](_0x27a02b[_0x98a5('0x2b')]);_0x325dec[_0x98a5('0x2d')]=_[_0x98a5('0x2e')](_0x325dec[_0x98a5('0x29')],_0x325dec[_0x98a5('0x2b')]);_0x19fd5e[_0x98a5('0x2f')]=_[_0x98a5('0x2e')](_0x325dec['model'],qs['fields'](_0x27a02b[_0x98a5('0x2b')]['fields']));_0x19fd5e['attributes']=_0x19fd5e[_0x98a5('0x2f')][_0x98a5('0x30')]?_0x19fd5e[_0x98a5('0x2f')]:_0x325dec[_0x98a5('0x29')];if(!_0x27a02b[_0x98a5('0x2b')]['hasOwnProperty']('nolimit')){_0x19fd5e['limit']=qs['limit'](_0x27a02b[_0x98a5('0x2b')][_0x98a5('0x1c')]);_0x19fd5e[_0x98a5('0x1b')]=qs['offset'](_0x27a02b[_0x98a5('0x2b')][_0x98a5('0x1b')]);}_0x19fd5e['order']=qs[_0x98a5('0x31')](_0x27a02b[_0x98a5('0x2b')]['sort']);_0x19fd5e[_0x98a5('0x32')]=qs[_0x98a5('0x2d')](_[_0x98a5('0x33')](_0x27a02b['query'],_0x325dec[_0x98a5('0x2d')]),_0x539b2e);if(_0x27a02b['query']['filter']){_0x19fd5e[_0x98a5('0x32')]=_['merge'](_0x19fd5e['where'],{'$or':_[_0x98a5('0x25')](_0x539b2e,function(_0x3b95ed){if(_0x3b95ed[_0x98a5('0x28')]!==_0x98a5('0x34')){var _0x239e9d={};_0x239e9d[_0x3b95ed[_0x98a5('0x2a')]]={'$like':'%'+_0x27a02b[_0x98a5('0x2b')]['filter']+'%'};return _0x239e9d;}})});}_0x19fd5e=_[_0x98a5('0x35')]({},_0x19fd5e,_0x27a02b[_0x98a5('0x36')]);var _0x5e385e={'where':_0x19fd5e[_0x98a5('0x32')]};return db[_0x98a5('0x37')][_0x98a5('0x1a')](_0x5e385e)[_0x98a5('0x21')](function(_0x5e0ae1){_0x45bc8f[_0x98a5('0x1a')]=_0x5e0ae1;if(_0x27a02b[_0x98a5('0x2b')][_0x98a5('0x38')]){_0x19fd5e[_0x98a5('0x39')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x98a5('0x3a')](_0x19fd5e);})[_0x98a5('0x21')](function(_0x3386a5){_0x45bc8f[_0x98a5('0x3b')]=_0x3386a5;return _0x45bc8f;})['then'](respondWithFilteredResult(_0x1dadb0,_0x19fd5e))[_0x98a5('0x3c')](handleError(_0x1dadb0,null));};exports[_0x98a5('0x3d')]=function(_0xd3475,_0x16d65b){var _0x311789={'raw':![],'where':{'id':_0xd3475[_0x98a5('0x3e')]['id']}},_0x5a735b={};_0x5a735b['model']=_[_0x98a5('0x2c')](db['SalesforceAccount']['rawAttributes']);_0x5a735b[_0x98a5('0x2b')]=_[_0x98a5('0x2c')](_0xd3475[_0x98a5('0x2b')]);_0x5a735b[_0x98a5('0x2d')]=_[_0x98a5('0x2e')](_0x5a735b[_0x98a5('0x29')],_0x5a735b[_0x98a5('0x2b')]);_0x311789[_0x98a5('0x2f')]=_['intersection'](_0x5a735b[_0x98a5('0x29')],qs[_0x98a5('0x3f')](_0xd3475[_0x98a5('0x2b')][_0x98a5('0x3f')]));_0x311789[_0x98a5('0x2f')]=_0x311789[_0x98a5('0x2f')]['length']?_0x311789['attributes']:_0x5a735b[_0x98a5('0x29')];if(_0xd3475[_0x98a5('0x2b')][_0x98a5('0x38')]){_0x311789[_0x98a5('0x39')]=[{'all':!![]}];}_0x311789=_[_0x98a5('0x35')]({},_0x311789,_0xd3475[_0x98a5('0x36')]);return db[_0x98a5('0x37')][_0x98a5('0x40')](_0x311789)[_0x98a5('0x21')](handleEntityNotFound(_0x16d65b,null))['then'](respondWithResult(_0x16d65b,null))[_0x98a5('0x3c')](handleError(_0x16d65b,null));};exports[_0x98a5('0x41')]=function(_0x49d2d2,_0x45fb2c){return db[_0x98a5('0x37')][_0x98a5('0x41')](_0x49d2d2[_0x98a5('0x42')],{})[_0x98a5('0x21')](respondWithResult(_0x45fb2c,0xc9))[_0x98a5('0x3c')](handleError(_0x45fb2c,null));};exports[_0x98a5('0x43')]=function(_0x2b8b1f,_0x5f0844){if(_0x2b8b1f['body']['id']){delete _0x2b8b1f[_0x98a5('0x42')]['id'];}return db[_0x98a5('0x37')][_0x98a5('0x40')]({'where':{'id':_0x2b8b1f['params']['id']}})[_0x98a5('0x21')](handleEntityNotFound(_0x5f0844,null))[_0x98a5('0x21')](saveUpdates(_0x2b8b1f[_0x98a5('0x42')],null))[_0x98a5('0x21')](respondWithResult(_0x5f0844,null))['catch'](handleError(_0x5f0844,null));};exports[_0x98a5('0x44')]=function(_0x4c0b2e,_0x409655){return db[_0x98a5('0x37')][_0x98a5('0x40')]({'where':{'id':_0x4c0b2e[_0x98a5('0x3e')]['id']}})[_0x98a5('0x21')](handleEntityNotFound(_0x409655,null))[_0x98a5('0x21')](removeEntity(_0x409655,null))[_0x98a5('0x3c')](handleError(_0x409655,null));};exports['getConfigurations']=function(_0x324e1e,_0x3df5fc,_0x319768){var _0x4c6a32={};var _0x4368bc={};var _0x5a3d08;var _0x4bf19e;return db[_0x98a5('0x37')][_0x98a5('0x45')]({'where':{'id':_0x324e1e['params']['id']}})['then'](handleEntityNotFound(_0x3df5fc,null))['then'](function(_0x5dfd86){if(_0x5dfd86){_0x5a3d08=_0x5dfd86;_0x4368bc['model']=_[_0x98a5('0x2c')](db['SalesforceConfiguration'][_0x98a5('0x26')]);_0x4368bc['query']=_['keys'](_0x324e1e[_0x98a5('0x2b')]);_0x4368bc[_0x98a5('0x2d')]=_[_0x98a5('0x2e')](_0x4368bc[_0x98a5('0x29')],_0x4368bc['query']);_0x4c6a32[_0x98a5('0x2f')]=_['intersection'](_0x4368bc[_0x98a5('0x29')],qs['fields'](_0x324e1e[_0x98a5('0x2b')]['fields']));_0x4c6a32[_0x98a5('0x2f')]=_0x4c6a32[_0x98a5('0x2f')][_0x98a5('0x30')]?_0x4c6a32['attributes']:_0x4368bc['model'];_0x4c6a32[_0x98a5('0x46')]=qs[_0x98a5('0x31')](_0x324e1e[_0x98a5('0x2b')][_0x98a5('0x31')]);_0x4c6a32[_0x98a5('0x32')]=qs[_0x98a5('0x2d')](_[_0x98a5('0x33')](_0x324e1e[_0x98a5('0x2b')],_0x4368bc['filters']));if(_0x324e1e[_0x98a5('0x2b')][_0x98a5('0x47')]){_0x4c6a32[_0x98a5('0x32')]=_[_0x98a5('0x35')](_0x4c6a32['where'],{'$or':_[_0x98a5('0x25')](_0x4c6a32[_0x98a5('0x2f')],function(_0x19e55f){var _0xc9e6a={};_0xc9e6a[_0x19e55f]={'$like':'%'+_0x324e1e[_0x98a5('0x2b')][_0x98a5('0x47')]+'%'};return _0xc9e6a;})});}_0x4c6a32=_['merge']({},_0x4c6a32,_0x324e1e[_0x98a5('0x36')]);return _0x5a3d08['getConfigurations'](_0x4c6a32);}})[_0x98a5('0x21')](function(_0x1b240a){if(_0x1b240a){_0x4bf19e=_0x1b240a[_0x98a5('0x30')];if(!_0x324e1e[_0x98a5('0x2b')][_0x98a5('0x48')]('nolimit')){_0x4c6a32['limit']=qs['limit'](_0x324e1e['query']['limit']);_0x4c6a32[_0x98a5('0x1b')]=qs[_0x98a5('0x1b')](_0x324e1e[_0x98a5('0x2b')]['offset']);}return _0x5a3d08[_0x98a5('0x49')](_0x4c6a32);}})['then'](function(_0xdf52d7){if(_0xdf52d7){return _0xdf52d7?{'count':_0x4bf19e,'rows':_0xdf52d7}:null;}})[_0x98a5('0x21')](respondWithResult(_0x3df5fc,null))['catch'](handleError(_0x3df5fc,null));};exports[_0x98a5('0x4a')]=function(_0x38ba07,_0x1eff00,_0xc26f37){if(_0x38ba07[_0x98a5('0x42')]['id']){delete _0x38ba07[_0x98a5('0x42')]['id'];}return db[_0x98a5('0x37')][_0x98a5('0x45')]({'where':{'id':_0x38ba07[_0x98a5('0x3e')]['id']}})[_0x98a5('0x21')](handleEntityNotFound(_0x1eff00,null))[_0x98a5('0x21')](function(_0x263b72){if(_0x263b72){_0x38ba07['body'][_0x98a5('0x4b')]=_0x263b72['id'];_0x38ba07['body'][_0x98a5('0x4c')]=integrations[_0x98a5('0x4d')](_0x38ba07[_0x98a5('0x42')][_0x98a5('0x4e')],_0x38ba07[_0x98a5('0x42')]['type']);_0x38ba07[_0x98a5('0x42')][_0x98a5('0x4f')]=integrations[_0x98a5('0x50')](_0x38ba07[_0x98a5('0x42')]['channel'],_0x38ba07[_0x98a5('0x42')][_0x98a5('0x28')]);return db[_0x98a5('0x51')][_0x98a5('0x41')](_0x38ba07['body'],{'include':[{'model':db[_0x98a5('0x52')],'as':'Subjects'},{'model':db[_0x98a5('0x52')],'as':_0x98a5('0x4f')}]});}return null;})['then'](respondWithResult(_0x1eff00,null))[_0x98a5('0x3c')](handleError(_0x1eff00,null));};exports[_0x98a5('0x53')]=function(_0x266c21,_0x2522b0,_0x559bed){var _0x5d86fc;var _0x1bd5ed='';var _0x429bb5=_0x98a5('0x54');return db[_0x98a5('0x37')][_0x98a5('0x45')]({'where':{'id':_0x266c21[_0x98a5('0x3e')]['id']},'attributes':['id',_0x98a5('0x55'),_0x98a5('0x56'),'clientSecret','username','password','securityToken']})['then'](handleEntityNotFound(_0x2522b0,null))[_0x98a5('0x21')](function(_0x27f0a2){if(_0x27f0a2){_0x1bd5ed=_0x27f0a2['remoteUri'];var _0x3ea4b9=_0x1bd5ed[_0x98a5('0x57')](-0x1);if(_0x3ea4b9==='/'){_0x1bd5ed=_0x1bd5ed[_0x98a5('0x58')](0x0,_0x1bd5ed[_0x98a5('0x59')](_0x3ea4b9));}_0x5d86fc=new jsforce[(_0x98a5('0x5a'))]({'oauth2':{'loginUrl':_0x1bd5ed,'clientId':_0x27f0a2[_0x98a5('0x56')],'clientSecret':_0x27f0a2[_0x98a5('0x5b')]}});return _0x5d86fc[_0x98a5('0x5c')](_0x27f0a2[_0x98a5('0x5d')],_0x27f0a2[_0x98a5('0x5e')][_0x98a5('0x5f')](_0x27f0a2[_0x98a5('0x60')]));}})[_0x98a5('0x21')](function(_0x383e65){if(_0x383e65){if(!_[_0x98a5('0x61')](_0x266c21[_0x98a5('0x2b')][_0x98a5('0x62')])){_0x429bb5=_0x266c21[_0x98a5('0x2b')]['ticketType'];}return _0x5d86fc[_0x98a5('0x63')](_0x429bb5)[_0x98a5('0x64')]();}})[_0x98a5('0x21')](function(_0x4a90a2){var _0x2bcb37=['OwnerId',_0x98a5('0x65'),_0x98a5('0x66'),_0x98a5('0x67'),'Subject',_0x98a5('0x68')];var _0x3197f0=[_0x98a5('0x69'),_0x98a5('0x6a'),_0x98a5('0x6b'),_0x98a5('0x6c'),_0x98a5('0x6d'),_0x98a5('0x6e'),'phone'];if(_0x4a90a2){_['remove'](_0x4a90a2['fields'],function(_0x5d4a78){return _0x2bcb37[_0x98a5('0x6f')](_0x5d4a78[_0x98a5('0x2a')])||!_0x3197f0[_0x98a5('0x6f')](_0x5d4a78[_0x98a5('0x28')]);});return{'count':_0x4a90a2['fields']['length'],'rows':_[_0x98a5('0x25')](_0x4a90a2[_0x98a5('0x3f')],function(_0x200b18){return{'id':_0x200b18[_0x98a5('0x2a')],'name':_0x200b18[_0x98a5('0x70')],'custom':_0x200b18[_0x98a5('0x71')],'options':_0x200b18['picklistValues'][_0x98a5('0x30')]>0x0?_[_0x98a5('0x25')](_0x200b18['picklistValues'],function(_0x52877b){return{'name':_0x52877b[_0x98a5('0x70')],'value':_0x52877b[_0x98a5('0x72')]};}):_0x200b18[_0x98a5('0x28')]=='boolean'?[{'name':_0x98a5('0x73'),'value':_0x98a5('0x74')},{'name':_0x98a5('0x75'),'value':_0x98a5('0x76')}]:[]};})};}})[_0x98a5('0x21')](respondWithResult(_0x2522b0,null))[_0x98a5('0x3c')](function(_0x1902b2){var _0x1bbf95=_0x266c21[_0x98a5('0x2b')][_0x98a5('0x77')]?0x1f4:_0x1902b2[_0x98a5('0x78')]||0x1f4;logger[_0x98a5('0x23')](_0x98a5('0x79'),'getFields',_0x1bbf95,JSON['stringify'](_0x1902b2));delete _0x1902b2[_0x98a5('0x2a')];if(_0x1bbf95===0x191){_0x1bbf95=0x190;}_0x2522b0['status'](_0x1bbf95)[_0x98a5('0x7a')](_0x266c21[_0x98a5('0x2b')][_0x98a5('0x77')]?{'message':_0x98a5('0x7b'),'statusCode':_0x1902b2[_0x98a5('0x78')]}:_0x1902b2);});}; \ No newline at end of file +var _0x04b4=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','where','includeAll','show','length','options','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','filter','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','password','securityToken','slice','substring','Connection','clientSecret','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined'];(function(_0x58b94c,_0x284e1b){var _0x5def79=function(_0x13b006){while(--_0x13b006){_0x58b94c['push'](_0x58b94c['shift']());}};_0x5def79(++_0x284e1b);}(_0x04b4,0xdd));var _0x404b=function(_0x346697,_0x26caf8){_0x346697=_0x346697-0x0;var _0x95c697=_0x04b4[_0x346697];return _0x95c697;};'use strict';var emlformat=require(_0x404b('0x0'));var rimraf=require(_0x404b('0x1'));var zipdir=require(_0x404b('0x2'));var jsonpatch=require(_0x404b('0x3'));var rp=require(_0x404b('0x4'));var moment=require('moment');var BPromise=require(_0x404b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x404b('0x6'));var sox=require(_0x404b('0x7'));var csv=require(_0x404b('0x8'));var ejs=require(_0x404b('0x9'));var fs=require('fs');var fs_extra=require(_0x404b('0xa'));var _=require(_0x404b('0xb'));var squel=require(_0x404b('0xc'));var crypto=require(_0x404b('0xd'));var jsforce=require(_0x404b('0xe'));var deskjs=require(_0x404b('0xf'));var toCsv=require(_0x404b('0x8'));var querystring=require('querystring');var Papa=require(_0x404b('0x10'));var Redis=require(_0x404b('0x11'));var authService=require(_0x404b('0x12'));var qs=require(_0x404b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x404b('0x14'));var logger=require(_0x404b('0x15'))(_0x404b('0x16'));var utils=require(_0x404b('0x17'));var config=require(_0x404b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x404b('0x19'));function respondWithStatusCode(_0x8f4f5,_0x2853be){_0x2853be=_0x2853be||0xcc;return function(_0x942c4a){if(_0x942c4a){return _0x8f4f5[_0x404b('0x1a')](_0x2853be);}return _0x8f4f5[_0x404b('0x1b')](_0x2853be)['end']();};}function respondWithResult(_0x4a1689,_0x10ad7d){_0x10ad7d=_0x10ad7d||0xc8;return function(_0x3f859b){if(_0x3f859b){return _0x4a1689[_0x404b('0x1b')](_0x10ad7d)[_0x404b('0x1c')](_0x3f859b);}};}function respondWithFilteredResult(_0x189f74,_0x37dc8b){return function(_0x26b848){if(_0x26b848){var _0x18cc9d=typeof _0x37dc8b[_0x404b('0x1d')]===_0x404b('0x1e')&&typeof _0x37dc8b[_0x404b('0x1f')]===_0x404b('0x1e');var _0x175aab=_0x26b848[_0x404b('0x20')];var _0x1e9f69=_0x18cc9d?0x0:_0x37dc8b[_0x404b('0x1d')];var _0x1e5253=_0x18cc9d?_0x26b848[_0x404b('0x20')]:_0x37dc8b[_0x404b('0x1d')]+_0x37dc8b['limit'];var _0x51a154;if(_0x1e5253>=_0x175aab){_0x1e5253=_0x175aab;_0x51a154=0xc8;}else{_0x51a154=0xce;}_0x189f74[_0x404b('0x1b')](_0x51a154);return _0x189f74[_0x404b('0x21')](_0x404b('0x22'),_0x1e9f69+'-'+_0x1e5253+'/'+_0x175aab)['json'](_0x26b848);}return null;};}function patchUpdates(_0x5d2b31){return function(_0x13a1b7){try{jsonpatch[_0x404b('0x23')](_0x13a1b7,_0x5d2b31,!![]);}catch(_0xda07cd){return BPromise[_0x404b('0x24')](_0xda07cd);}return _0x13a1b7[_0x404b('0x25')]();};}function saveUpdates(_0x3d3b54,_0x39e4ab){return function(_0x37d9b1){if(_0x37d9b1){return _0x37d9b1[_0x404b('0x26')](_0x3d3b54)[_0x404b('0x27')](function(_0x35c173){return _0x35c173;});}return null;};}function removeEntity(_0x246399,_0x190616){return function(_0xdf3f47){if(_0xdf3f47){return _0xdf3f47[_0x404b('0x28')]()[_0x404b('0x27')](function(){_0x246399[_0x404b('0x1b')](0xcc)[_0x404b('0x29')]();});}};}function handleEntityNotFound(_0x12cd08,_0xa63746){return function(_0x288cb7){if(!_0x288cb7){_0x12cd08['sendStatus'](0x194);}return _0x288cb7;};}function handleError(_0x5e9603,_0x1d54e1){_0x1d54e1=_0x1d54e1||0x1f4;return function(_0x14e343){logger[_0x404b('0x2a')](_0x14e343[_0x404b('0x2b')]);if(_0x14e343[_0x404b('0x2c')]){delete _0x14e343[_0x404b('0x2c')];}_0x5e9603[_0x404b('0x1b')](_0x1d54e1)[_0x404b('0x2d')](_0x14e343);};}exports[_0x404b('0x2e')]=function(_0x3a306d,_0x4aea91){var _0x2e4920={},_0x3b9ffb={},_0x45ff96={'count':0x0,'rows':[]};var _0x42dda9=_[_0x404b('0x2f')](db[_0x404b('0x30')][_0x404b('0x31')],function(_0x5b07a3){return{'name':_0x5b07a3[_0x404b('0x32')],'type':_0x5b07a3[_0x404b('0x33')][_0x404b('0x34')]};});_0x3b9ffb[_0x404b('0x35')]=_['map'](_0x42dda9,'name');_0x3b9ffb[_0x404b('0x36')]=_[_0x404b('0x37')](_0x3a306d[_0x404b('0x36')]);_0x3b9ffb[_0x404b('0x38')]=_[_0x404b('0x39')](_0x3b9ffb[_0x404b('0x35')],_0x3b9ffb[_0x404b('0x36')]);_0x2e4920[_0x404b('0x3a')]=_[_0x404b('0x39')](_0x3b9ffb[_0x404b('0x35')],qs[_0x404b('0x3b')](_0x3a306d[_0x404b('0x36')][_0x404b('0x3b')]));_0x2e4920[_0x404b('0x3a')]=_0x2e4920[_0x404b('0x3a')]['length']?_0x2e4920['attributes']:_0x3b9ffb[_0x404b('0x35')];if(!_0x3a306d['query'][_0x404b('0x3c')](_0x404b('0x3d'))){_0x2e4920[_0x404b('0x1f')]=qs[_0x404b('0x1f')](_0x3a306d[_0x404b('0x36')][_0x404b('0x1f')]);_0x2e4920[_0x404b('0x1d')]=qs[_0x404b('0x1d')](_0x3a306d[_0x404b('0x36')]['offset']);}_0x2e4920[_0x404b('0x3e')]=qs[_0x404b('0x3f')](_0x3a306d[_0x404b('0x36')][_0x404b('0x3f')]);_0x2e4920['where']=qs[_0x404b('0x38')](_[_0x404b('0x40')](_0x3a306d['query'],_0x3b9ffb[_0x404b('0x38')]),_0x42dda9);if(_0x3a306d['query']['filter']){_0x2e4920['where']=_[_0x404b('0x41')](_0x2e4920['where'],{'$or':_[_0x404b('0x2f')](_0x42dda9,function(_0x549e8c){if(_0x549e8c[_0x404b('0x33')]!==_0x404b('0x42')){var _0x309808={};_0x309808[_0x549e8c[_0x404b('0x2c')]]={'$like':'%'+_0x3a306d[_0x404b('0x36')]['filter']+'%'};return _0x309808;}})});}_0x2e4920=_[_0x404b('0x41')]({},_0x2e4920,_0x3a306d['options']);var _0x4eafe7={'where':_0x2e4920[_0x404b('0x43')]};return db[_0x404b('0x30')][_0x404b('0x20')](_0x4eafe7)[_0x404b('0x27')](function(_0x50d9a5){_0x45ff96[_0x404b('0x20')]=_0x50d9a5;if(_0x3a306d[_0x404b('0x36')][_0x404b('0x44')]){_0x2e4920['include']=[{'all':!![]}];}return db[_0x404b('0x30')]['findAll'](_0x2e4920);})[_0x404b('0x27')](function(_0x201459){_0x45ff96['rows']=_0x201459;return _0x45ff96;})[_0x404b('0x27')](respondWithFilteredResult(_0x4aea91,_0x2e4920))['catch'](handleError(_0x4aea91,null));};exports[_0x404b('0x45')]=function(_0x45ba79,_0xa209b7){var _0x4ab3e4={'raw':![],'where':{'id':_0x45ba79['params']['id']}},_0x4d56a0={};_0x4d56a0[_0x404b('0x35')]=_['keys'](db[_0x404b('0x30')][_0x404b('0x31')]);_0x4d56a0[_0x404b('0x36')]=_['keys'](_0x45ba79['query']);_0x4d56a0[_0x404b('0x38')]=_[_0x404b('0x39')](_0x4d56a0[_0x404b('0x35')],_0x4d56a0[_0x404b('0x36')]);_0x4ab3e4['attributes']=_['intersection'](_0x4d56a0[_0x404b('0x35')],qs[_0x404b('0x3b')](_0x45ba79['query'][_0x404b('0x3b')]));_0x4ab3e4['attributes']=_0x4ab3e4[_0x404b('0x3a')][_0x404b('0x46')]?_0x4ab3e4[_0x404b('0x3a')]:_0x4d56a0['model'];if(_0x45ba79[_0x404b('0x36')][_0x404b('0x44')]){_0x4ab3e4['include']=[{'all':!![]}];}_0x4ab3e4=_['merge']({},_0x4ab3e4,_0x45ba79[_0x404b('0x47')]);return db[_0x404b('0x30')][_0x404b('0x48')](_0x4ab3e4)[_0x404b('0x27')](handleEntityNotFound(_0xa209b7,null))[_0x404b('0x27')](respondWithResult(_0xa209b7,null))[_0x404b('0x49')](handleError(_0xa209b7,null));};exports[_0x404b('0x4a')]=function(_0x126c87,_0x23d27d){return db[_0x404b('0x30')][_0x404b('0x4a')](_0x126c87['body'],{})[_0x404b('0x27')](respondWithResult(_0x23d27d,0xc9))[_0x404b('0x49')](handleError(_0x23d27d,null));};exports[_0x404b('0x26')]=function(_0x2ff6a9,_0x15cda8){if(_0x2ff6a9[_0x404b('0x4b')]['id']){delete _0x2ff6a9['body']['id'];}return db[_0x404b('0x30')][_0x404b('0x48')]({'where':{'id':_0x2ff6a9[_0x404b('0x4c')]['id']}})[_0x404b('0x27')](handleEntityNotFound(_0x15cda8,null))[_0x404b('0x27')](saveUpdates(_0x2ff6a9['body'],null))[_0x404b('0x27')](respondWithResult(_0x15cda8,null))[_0x404b('0x49')](handleError(_0x15cda8,null));};exports[_0x404b('0x28')]=function(_0x338189,_0x39aacf){return db[_0x404b('0x30')][_0x404b('0x48')]({'where':{'id':_0x338189[_0x404b('0x4c')]['id']}})[_0x404b('0x27')](handleEntityNotFound(_0x39aacf,null))['then'](removeEntity(_0x39aacf,null))[_0x404b('0x49')](handleError(_0x39aacf,null));};exports[_0x404b('0x4d')]=function(_0x4f9b34,_0x496977,_0x20d7bc){var _0x3b0e1d={};var _0x400488={};var _0x5664d5;var _0x2fe1b0;return db['SalesforceAccount'][_0x404b('0x4e')]({'where':{'id':_0x4f9b34[_0x404b('0x4c')]['id']}})[_0x404b('0x27')](handleEntityNotFound(_0x496977,null))[_0x404b('0x27')](function(_0x1725dd){if(_0x1725dd){_0x5664d5=_0x1725dd;_0x400488['model']=_['keys'](db[_0x404b('0x4f')][_0x404b('0x31')]);_0x400488['query']=_[_0x404b('0x37')](_0x4f9b34[_0x404b('0x36')]);_0x400488[_0x404b('0x38')]=_[_0x404b('0x39')](_0x400488[_0x404b('0x35')],_0x400488[_0x404b('0x36')]);_0x3b0e1d[_0x404b('0x3a')]=_[_0x404b('0x39')](_0x400488[_0x404b('0x35')],qs['fields'](_0x4f9b34[_0x404b('0x36')][_0x404b('0x3b')]));_0x3b0e1d['attributes']=_0x3b0e1d[_0x404b('0x3a')][_0x404b('0x46')]?_0x3b0e1d['attributes']:_0x400488[_0x404b('0x35')];_0x3b0e1d['order']=qs[_0x404b('0x3f')](_0x4f9b34[_0x404b('0x36')]['sort']);_0x3b0e1d['where']=qs[_0x404b('0x38')](_[_0x404b('0x40')](_0x4f9b34[_0x404b('0x36')],_0x400488[_0x404b('0x38')]));if(_0x4f9b34[_0x404b('0x36')][_0x404b('0x50')]){_0x3b0e1d[_0x404b('0x43')]=_[_0x404b('0x41')](_0x3b0e1d[_0x404b('0x43')],{'$or':_[_0x404b('0x2f')](_0x3b0e1d[_0x404b('0x3a')],function(_0x51eb6b){var _0x2d39d0={};_0x2d39d0[_0x51eb6b]={'$like':'%'+_0x4f9b34[_0x404b('0x36')]['filter']+'%'};return _0x2d39d0;})});}_0x3b0e1d=_['merge']({},_0x3b0e1d,_0x4f9b34['options']);return _0x5664d5[_0x404b('0x4d')](_0x3b0e1d);}})['then'](function(_0xb85f46){if(_0xb85f46){_0x2fe1b0=_0xb85f46[_0x404b('0x46')];if(!_0x4f9b34[_0x404b('0x36')][_0x404b('0x3c')]('nolimit')){_0x3b0e1d[_0x404b('0x1f')]=qs['limit'](_0x4f9b34['query'][_0x404b('0x1f')]);_0x3b0e1d[_0x404b('0x1d')]=qs[_0x404b('0x1d')](_0x4f9b34[_0x404b('0x36')]['offset']);}return _0x5664d5[_0x404b('0x4d')](_0x3b0e1d);}})['then'](function(_0x25e450){if(_0x25e450){return _0x25e450?{'count':_0x2fe1b0,'rows':_0x25e450}:null;}})['then'](respondWithResult(_0x496977,null))['catch'](handleError(_0x496977,null));};exports['addConfiguration']=function(_0x81df19,_0x4bf404,_0x358423){if(_0x81df19[_0x404b('0x4b')]['id']){delete _0x81df19[_0x404b('0x4b')]['id'];}return db['SalesforceAccount'][_0x404b('0x4e')]({'where':{'id':_0x81df19[_0x404b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bf404,null))[_0x404b('0x27')](function(_0xeaafd7){if(_0xeaafd7){_0x81df19[_0x404b('0x4b')]['AccountId']=_0xeaafd7['id'];_0x81df19[_0x404b('0x4b')]['Subjects']=integrations['getSubjects'](_0x81df19[_0x404b('0x4b')][_0x404b('0x51')],_0x81df19['body'][_0x404b('0x33')]);_0x81df19[_0x404b('0x4b')][_0x404b('0x52')]=integrations[_0x404b('0x53')](_0x81df19[_0x404b('0x4b')]['channel'],_0x81df19['body'][_0x404b('0x33')]);return db['SalesforceConfiguration'][_0x404b('0x4a')](_0x81df19[_0x404b('0x4b')],{'include':[{'model':db[_0x404b('0x54')],'as':_0x404b('0x55')},{'model':db['SalesforceField'],'as':_0x404b('0x52')}]});}return null;})[_0x404b('0x27')](respondWithResult(_0x4bf404,null))['catch'](handleError(_0x4bf404,null));};exports[_0x404b('0x56')]=function(_0x1e188e,_0x26ced7,_0x274b91){var _0x1f12e9;var _0x349b5f='';var _0x29f9c7=_0x404b('0x57');return db[_0x404b('0x30')]['findOne']({'where':{'id':_0x1e188e[_0x404b('0x4c')]['id']},'attributes':['id',_0x404b('0x58'),_0x404b('0x59'),'clientSecret','username',_0x404b('0x5a'),_0x404b('0x5b')]})[_0x404b('0x27')](handleEntityNotFound(_0x26ced7,null))[_0x404b('0x27')](function(_0x136e4c){if(_0x136e4c){_0x349b5f=_0x136e4c[_0x404b('0x58')];var _0x37d4fd=_0x349b5f[_0x404b('0x5c')](-0x1);if(_0x37d4fd==='/'){_0x349b5f=_0x349b5f[_0x404b('0x5d')](0x0,_0x349b5f['lastIndexOf'](_0x37d4fd));}_0x1f12e9=new jsforce[(_0x404b('0x5e'))]({'oauth2':{'loginUrl':_0x349b5f,'clientId':_0x136e4c[_0x404b('0x59')],'clientSecret':_0x136e4c[_0x404b('0x5f')]}});return _0x1f12e9['login'](_0x136e4c['username'],_0x136e4c[_0x404b('0x5a')][_0x404b('0x60')](_0x136e4c[_0x404b('0x5b')]));}})[_0x404b('0x27')](function(_0x52e86e){if(_0x52e86e){if(!_[_0x404b('0x61')](_0x1e188e[_0x404b('0x36')]['ticketType'])){_0x29f9c7=_0x1e188e[_0x404b('0x36')][_0x404b('0x62')];}return _0x1f12e9['sobject'](_0x29f9c7)[_0x404b('0x63')]();}})[_0x404b('0x27')](function(_0x529970){var _0x3f2fc4=[_0x404b('0x64'),_0x404b('0x65'),_0x404b('0x66'),_0x404b('0x67'),_0x404b('0x68'),_0x404b('0x69')];var _0x5324d3=[_0x404b('0x6a'),_0x404b('0x6b'),_0x404b('0x6c'),_0x404b('0x6d'),_0x404b('0x6e'),_0x404b('0x6f'),_0x404b('0x70')];if(_0x529970){_['remove'](_0x529970[_0x404b('0x3b')],function(_0x3d0ad){return _0x3f2fc4[_0x404b('0x71')](_0x3d0ad['name'])||!_0x5324d3[_0x404b('0x71')](_0x3d0ad[_0x404b('0x33')]);});return{'count':_0x529970['fields'][_0x404b('0x46')],'rows':_[_0x404b('0x2f')](_0x529970[_0x404b('0x3b')],function(_0x5527f5){return{'id':_0x5527f5[_0x404b('0x2c')],'name':_0x5527f5[_0x404b('0x72')],'custom':_0x5527f5[_0x404b('0x73')],'options':_0x5527f5['picklistValues']['length']>0x0?_[_0x404b('0x2f')](_0x5527f5[_0x404b('0x74')],function(_0x2be626){return{'name':_0x2be626['label'],'value':_0x2be626['value']};}):_0x5527f5[_0x404b('0x33')]==_0x404b('0x6d')?[{'name':_0x404b('0x75'),'value':_0x404b('0x76')},{'name':_0x404b('0x77'),'value':_0x404b('0x78')}]:[]};})};}})[_0x404b('0x27')](respondWithResult(_0x26ced7,null))['catch'](function(_0x7d2372){var _0x517674=_0x1e188e[_0x404b('0x36')][_0x404b('0x79')]?0x1f4:_0x7d2372[_0x404b('0x7a')]||0x1f4;logger[_0x404b('0x2a')](_0x404b('0x7b'),_0x404b('0x56'),_0x517674,JSON[_0x404b('0x7c')](_0x7d2372));delete _0x7d2372[_0x404b('0x2c')];if(_0x517674===0x191){_0x517674=0x190;}_0x26ced7['status'](_0x517674)[_0x404b('0x2d')](_0x1e188e[_0x404b('0x36')][_0x404b('0x79')]?{'message':_0x404b('0x7d'),'statusCode':_0x7d2372['statusCode']}:_0x7d2372);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6b72833..ea3bc33 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 _0xb0d9=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../components/integrations/configuration'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x192c2f,_0xa4c3d5){_0x192c2f=_0x192c2f-0x0;var _0x4a2815=_0xb0d9[_0x192c2f];return _0x4a2815;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var logger=require(_0x9b0d('0x2'))(_0x9b0d('0x3'));var moment=require(_0x9b0d('0x4'));var BPromise=require(_0x9b0d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b0d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x9b0d('0x7'));module[_0x9b0d('0x8')]=function(_0x584dde,_0x438e0a){return _0x584dde[_0x9b0d('0x9')](_0x9b0d('0xa'),attributes,{'tableName':_0x9b0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ff1=['../../config/environment','exports','define','SalesforceAccount','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3d8e8b,_0x15e452){var _0x3112fb=function(_0x2eb194){while(--_0x2eb194){_0x3d8e8b['push'](_0x3d8e8b['shift']());}};_0x3112fb(++_0x15e452);}(_0x7ff1,0x93));var _0x17ff=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x7ff1[_0x285824];return _0x311d7e;};'use strict';var _=require('lodash');var util=require(_0x17ff('0x0'));var logger=require(_0x17ff('0x1'))(_0x17ff('0x2'));var moment=require(_0x17ff('0x3'));var BPromise=require(_0x17ff('0x4'));var rp=require(_0x17ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ff('0x6'));var config=require(_0x17ff('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x17ff('0x8')]=function(_0x176948,_0x1a4e40){return _0x176948[_0x17ff('0x9')](_0x17ff('0xa'),attributes,{'tableName':'int_salesforce_accounts','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 47cb709..518e1e8 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 _0xca6b=['limit','include','map','attributes','model','catch','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where'];(function(_0x55d251,_0x1325af){var _0x1f359b=function(_0xddba3b){while(--_0xddba3b){_0x55d251['push'](_0x55d251['shift']());}};_0x1f359b(++_0x1325af);}(_0xca6b,0xd3));var _0xbca6=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xca6b[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xbca6('0x0'));var util=require(_0xbca6('0x1'));var moment=require(_0xbca6('0x2'));var BPromise=require(_0xbca6('0x3'));var rs=require(_0xbca6('0x4'));var fs=require('fs');var Redis=require(_0xbca6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbca6('0x6'));var logger=require('../../config/logger')(_0xbca6('0x7'));var config=require('../../config/environment');var jayson=require(_0xbca6('0x8'));var client=jayson[_0xbca6('0x9')][_0xbca6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x135ddb,_0x395b38,_0x48dbe0){return new BPromise(function(_0x276d42,_0x183963){return client['request'](_0x135ddb,_0x48dbe0)[_0xbca6('0xb')](function(_0x305246){logger['info'](_0xbca6('0xc'),_0x395b38,_0xbca6('0xd'));logger[_0xbca6('0xe')](_0xbca6('0xf'),_0x395b38,_0xbca6('0xd'),JSON[_0xbca6('0x10')](_0x305246));if(_0x305246['error']){if(_0x305246[_0xbca6('0x11')]['code']===0x1f4){logger[_0xbca6('0x11')](_0xbca6('0xc'),_0x395b38,_0x305246[_0xbca6('0x11')][_0xbca6('0x12')]);return _0x183963(_0x305246[_0xbca6('0x11')]['message']);}logger['error'](_0xbca6('0xc'),_0x395b38,_0x305246[_0xbca6('0x11')][_0xbca6('0x12')]);return _0x276d42(_0x305246[_0xbca6('0x11')]['message']);}else{logger[_0xbca6('0x13')](_0xbca6('0xc'),_0x395b38,'request\x20sent');_0x276d42(_0x305246[_0xbca6('0x14')][_0xbca6('0x12')]);}})['catch'](function(_0x2eb9b1){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x395b38,_0x2eb9b1);_0x183963(_0x2eb9b1);});});}exports[_0xbca6('0x15')]=function(_0x51dd8e){var _0x50b5ff=this;return new Promise(function(_0x440eda,_0x41371f){return db[_0xbca6('0x16')][_0xbca6('0x17')]({'raw':_0x51dd8e['options']?_0x51dd8e[_0xbca6('0x18')][_0xbca6('0x19')]===undefined?!![]:![]:!![],'where':_0x51dd8e[_0xbca6('0x18')]?_0x51dd8e['options'][_0xbca6('0x1a')]||null:null,'attributes':_0x51dd8e['options']?_0x51dd8e[_0xbca6('0x18')]['attributes']||null:null,'limit':_0x51dd8e['options']?_0x51dd8e[_0xbca6('0x18')][_0xbca6('0x1b')]||null:null,'include':_0x51dd8e[_0xbca6('0x18')]?_0x51dd8e['options'][_0xbca6('0x1c')]?_[_0xbca6('0x1d')](_0x51dd8e[_0xbca6('0x18')]['include'],function(_0xf928cb){return{'model':db[_0xf928cb['model']],'as':_0xf928cb['as'],'attributes':_0xf928cb[_0xbca6('0x1e')],'include':_0xf928cb[_0xbca6('0x1c')]?_[_0xbca6('0x1d')](_0xf928cb['include'],function(_0x1f3b7){return{'model':db[_0x1f3b7[_0xbca6('0x1f')]],'as':_0x1f3b7['as'],'attributes':_0x1f3b7[_0xbca6('0x1e')],'include':_0x1f3b7[_0xbca6('0x1c')]?_[_0xbca6('0x1d')](_0x1f3b7[_0xbca6('0x1c')],function(_0x422cfc){return{'model':db[_0x422cfc[_0xbca6('0x1f')]],'as':_0x422cfc['as'],'attributes':_0x422cfc[_0xbca6('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56a4c7){logger[_0xbca6('0x13')](_0xbca6('0x15'),_0x51dd8e);logger[_0xbca6('0xe')](_0xbca6('0x15'),_0x51dd8e,JSON[_0xbca6('0x10')](_0x56a4c7));_0x440eda(_0x56a4c7);})[_0xbca6('0x20')](function(_0x23195f){logger[_0xbca6('0x11')](_0xbca6('0x15'),_0x23195f[_0xbca6('0x12')],_0x51dd8e);_0x41371f(_0x50b5ff[_0xbca6('0x11')](0x1f4,_0x23195f['message']));});});};exports[_0xbca6('0x21')]=function(_0x3c0efc){var _0x436480=this;return new Promise(function(_0x299440,_0x570fde){return db[_0xbca6('0x16')]['find']({'raw':_0x3c0efc['options']?_0x3c0efc[_0xbca6('0x18')][_0xbca6('0x19')]===undefined?!![]:![]:!![],'where':_0x3c0efc[_0xbca6('0x18')]?_0x3c0efc[_0xbca6('0x18')]['where']||null:null,'attributes':_0x3c0efc[_0xbca6('0x18')]?_0x3c0efc['options'][_0xbca6('0x1e')]||null:null,'include':_0x3c0efc['options']?_0x3c0efc['options']['include']?_[_0xbca6('0x1d')](_0x3c0efc[_0xbca6('0x18')][_0xbca6('0x1c')],function(_0x2730c4){return{'model':db[_0x2730c4[_0xbca6('0x1f')]],'as':_0x2730c4['as'],'attributes':_0x2730c4[_0xbca6('0x1e')],'include':_0x2730c4[_0xbca6('0x1c')]?_[_0xbca6('0x1d')](_0x2730c4['include'],function(_0x4f7600){return{'model':db[_0x4f7600['model']],'as':_0x4f7600['as'],'attributes':_0x4f7600[_0xbca6('0x1e')],'include':_0x4f7600['include']?_[_0xbca6('0x1d')](_0x4f7600[_0xbca6('0x1c')],function(_0x5648c6){return{'model':db[_0x5648c6[_0xbca6('0x1f')]],'as':_0x5648c6['as'],'attributes':_0x5648c6[_0xbca6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbca6('0xb')](function(_0x197d5f){logger[_0xbca6('0x13')](_0xbca6('0x21'),_0x3c0efc);logger[_0xbca6('0xe')](_0xbca6('0x21'),_0x3c0efc,JSON['stringify'](_0x197d5f));_0x299440(_0x197d5f);})[_0xbca6('0x20')](function(_0x1677d2){logger[_0xbca6('0x11')]('ShowSalesforceAccount',_0x1677d2['message'],_0x3c0efc);_0x570fde(_0x436480[_0xbca6('0x11')](0x1f4,_0x1677d2[_0xbca6('0x12')]));});});}; \ No newline at end of file +var _0x9613=['message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include','map','attributes','model','where','ShowSalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s'];(function(_0x23ca57,_0x23b25c){var _0x2904b5=function(_0x3c1581){while(--_0x3c1581){_0x23ca57['push'](_0x23ca57['shift']());}};_0x2904b5(++_0x23b25c);}(_0x9613,0x1c9));var _0x3961=function(_0x1712f4,_0x5c7e68){_0x1712f4=_0x1712f4-0x0;var _0x2cac70=_0x9613[_0x1712f4];return _0x2cac70;};'use strict';var _=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var moment=require(_0x3961('0x2'));var BPromise=require(_0x3961('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3961('0x4'));var db=require(_0x3961('0x5'))['db'];var utils=require(_0x3961('0x6'));var logger=require(_0x3961('0x7'))('rpc');var config=require(_0x3961('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3961('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2961c5,_0x263945,_0x519227){return new BPromise(function(_0x3a0772,_0x492ee8){return client[_0x3961('0xa')](_0x2961c5,_0x519227)[_0x3961('0xb')](function(_0x14eba6){logger[_0x3961('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x263945,_0x3961('0xd'));logger[_0x3961('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x263945,_0x3961('0xd'),JSON[_0x3961('0xf')](_0x14eba6));if(_0x14eba6[_0x3961('0x10')]){if(_0x14eba6[_0x3961('0x10')][_0x3961('0x11')]===0x1f4){logger[_0x3961('0x10')](_0x3961('0x12'),_0x263945,_0x14eba6[_0x3961('0x10')]['message']);return _0x492ee8(_0x14eba6[_0x3961('0x10')]['message']);}logger['error'](_0x3961('0x12'),_0x263945,_0x14eba6['error'][_0x3961('0x13')]);return _0x3a0772(_0x14eba6[_0x3961('0x10')][_0x3961('0x13')]);}else{logger[_0x3961('0xc')](_0x3961('0x12'),_0x263945,_0x3961('0xd'));_0x3a0772(_0x14eba6[_0x3961('0x14')][_0x3961('0x13')]);}})[_0x3961('0x15')](function(_0x2c83e6){logger[_0x3961('0x10')](_0x3961('0x12'),_0x263945,_0x2c83e6);_0x492ee8(_0x2c83e6);});});}exports[_0x3961('0x16')]=function(_0x4fce93){var _0x9f301d=this;return new Promise(function(_0x2001eb,_0x59f928){return db[_0x3961('0x17')][_0x3961('0x18')]({'raw':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')][_0x3961('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')]['where']||null:null,'attributes':_0x4fce93['options']?_0x4fce93['options']['attributes']||null:null,'limit':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')][_0x3961('0x1b')]||null:null,'include':_0x4fce93[_0x3961('0x19')]?_0x4fce93[_0x3961('0x19')][_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x4fce93[_0x3961('0x19')][_0x3961('0x1c')],function(_0x255608){return{'model':db[_0x255608['model']],'as':_0x255608['as'],'attributes':_0x255608[_0x3961('0x1e')],'include':_0x255608[_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x255608[_0x3961('0x1c')],function(_0x5c06f3){return{'model':db[_0x5c06f3[_0x3961('0x1f')]],'as':_0x5c06f3['as'],'attributes':_0x5c06f3[_0x3961('0x1e')],'include':_0x5c06f3[_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x5c06f3[_0x3961('0x1c')],function(_0x3aaf90){return{'model':db[_0x3aaf90['model']],'as':_0x3aaf90['as'],'attributes':_0x3aaf90[_0x3961('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3961('0xb')](function(_0x4a806b){logger[_0x3961('0xc')]('GetSalesforceAccount',_0x4fce93);logger[_0x3961('0xe')]('GetSalesforceAccount',_0x4fce93,JSON['stringify'](_0x4a806b));_0x2001eb(_0x4a806b);})[_0x3961('0x15')](function(_0x43767d){logger[_0x3961('0x10')]('GetSalesforceAccount',_0x43767d['message'],_0x4fce93);_0x59f928(_0x9f301d[_0x3961('0x10')](0x1f4,_0x43767d[_0x3961('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x191b7d){var _0x5b7baf=this;return new Promise(function(_0x3104ff,_0x378d7f){return db[_0x3961('0x17')]['find']({'raw':_0x191b7d[_0x3961('0x19')]?_0x191b7d['options']['raw']===undefined?!![]:![]:!![],'where':_0x191b7d['options']?_0x191b7d[_0x3961('0x19')][_0x3961('0x20')]||null:null,'attributes':_0x191b7d[_0x3961('0x19')]?_0x191b7d[_0x3961('0x19')][_0x3961('0x1e')]||null:null,'include':_0x191b7d[_0x3961('0x19')]?_0x191b7d[_0x3961('0x19')][_0x3961('0x1c')]?_['map'](_0x191b7d[_0x3961('0x19')][_0x3961('0x1c')],function(_0x4a0146){return{'model':db[_0x4a0146[_0x3961('0x1f')]],'as':_0x4a0146['as'],'attributes':_0x4a0146[_0x3961('0x1e')],'include':_0x4a0146[_0x3961('0x1c')]?_[_0x3961('0x1d')](_0x4a0146[_0x3961('0x1c')],function(_0x439329){return{'model':db[_0x439329[_0x3961('0x1f')]],'as':_0x439329['as'],'attributes':_0x439329[_0x3961('0x1e')],'include':_0x439329['include']?_[_0x3961('0x1d')](_0x439329[_0x3961('0x1c')],function(_0xd0cb43){return{'model':db[_0xd0cb43[_0x3961('0x1f')]],'as':_0xd0cb43['as'],'attributes':_0xd0cb43[_0x3961('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3961('0xb')](function(_0x5b1b5a){logger['info'](_0x3961('0x21'),_0x191b7d);logger[_0x3961('0xe')](_0x3961('0x21'),_0x191b7d,JSON['stringify'](_0x5b1b5a));_0x3104ff(_0x5b1b5a);})[_0x3961('0x15')](function(_0x364edc){logger['error'](_0x3961('0x21'),_0x364edc['message'],_0x191b7d);_0x378d7f(_0x5b7baf[_0x3961('0x10')](0x1f4,_0x364edc[_0x3961('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f9c2b0e..6e9a801 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 _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0x3c6ec7,_0x4d019a){_0x3c6ec7=_0x3c6ec7-0x0;var _0x5823f4=_0x2032[_0x3c6ec7];return _0x5823f4;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x7f5e50,_0x17c7c9){var _0xfa71ba=function(_0x1a512c){while(--_0x1a512c){_0x7f5e50['push'](_0x7f5e50['shift']());}};_0xfa71ba(++_0x17c7c9);}(_0x2ef3,0xba));var _0x32ef=function(_0x2c0620,_0x3ab922){_0x2c0620=_0x2c0620-0x0;var _0x11dc62=_0x2ef3[_0x2c0620];return _0x11dc62;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d7f0456..f803921 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 _0x02e0=['Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','STRING','ENUM','Task'];(function(_0x22708b,_0x2bee57){var _0x3e0055=function(_0x2215a2){while(--_0x2215a2){_0x22708b['push'](_0x22708b['shift']());}};_0x3e0055(++_0x2bee57);}(_0x02e0,0xe3));var _0x002e=function(_0x2c9d1d,_0x127fe7){_0x2c9d1d=_0x2c9d1d-0x0;var _0x13f47e=_0x02e0[_0x2c9d1d];return _0x13f47e;};'use strict';var Sequelize=require(_0x002e('0x0'));module['exports']={'name':{'type':Sequelize[_0x002e('0x1')]},'description':{'type':Sequelize[_0x002e('0x1')]},'ticketType':{'type':Sequelize[_0x002e('0x2')](_0x002e('0x3'),_0x002e('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x002e('0x5'),_0x002e('0x6'),_0x002e('0x7'),_0x002e('0x8'),_0x002e('0x9')),'defaultValue':_0x002e('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x002e('0xa'),_0x002e('0x6'),_0x002e('0x7'),_0x002e('0x9')),'defaultValue':_0x002e('0x7')},'leadId':{'type':Sequelize[_0x002e('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x002e('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x002e('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x002e('0x1')]}}; \ No newline at end of file +var _0x41cc=['lead','account_contact_lead','sequelize','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x41cc,0x1df));var _0xc41c=function(_0xbca15c,_0x5ac4cc){_0xbca15c=_0xbca15c-0x0;var _0x2f2a88=_0x41cc[_0xbca15c];return _0x2f2a88;};'use strict';var Sequelize=require(_0xc41c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc41c('0x1')]},'description':{'type':Sequelize[_0xc41c('0x1')]},'ticketType':{'type':Sequelize[_0xc41c('0x2')](_0xc41c('0x3'),_0xc41c('0x4')),'defaultValue':_0xc41c('0x3')},'moduleSearch':{'type':Sequelize[_0xc41c('0x2')](_0xc41c('0x5'),_0xc41c('0x6'),_0xc41c('0x7'),_0xc41c('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xc41c('0x2')]('nothing',_0xc41c('0x6'),_0xc41c('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xc41c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 469a31a..63416d0 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 _0x8d37=['fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','length','find','create','body','params','getFields','findOne','getSubjects','getDescriptions','SalesforceField','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0x8d37,0xbc));var _0x78d3=function(_0x55f625,_0x15e16a){_0x55f625=_0x55f625-0x0;var _0xa97721=_0x8d37[_0x55f625];return _0xa97721;};'use strict';var emlformat=require(_0x78d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78d3('0x1'));var jsonpatch=require(_0x78d3('0x2'));var rp=require(_0x78d3('0x3'));var moment=require(_0x78d3('0x4'));var BPromise=require(_0x78d3('0x5'));var Mustache=require(_0x78d3('0x6'));var util=require(_0x78d3('0x7'));var path=require('path');var sox=require(_0x78d3('0x8'));var csv=require(_0x78d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78d3('0xa'));var _=require(_0x78d3('0xb'));var squel=require('squel');var crypto=require(_0x78d3('0xc'));var jsforce=require(_0x78d3('0xd'));var deskjs=require(_0x78d3('0xe'));var toCsv=require(_0x78d3('0x9'));var querystring=require(_0x78d3('0xf'));var Papa=require(_0x78d3('0x10'));var Redis=require('ioredis');var authService=require(_0x78d3('0x11'));var qs=require(_0x78d3('0x12'));var as=require(_0x78d3('0x13'));var hardwareService=require(_0x78d3('0x14'));var logger=require(_0x78d3('0x15'))('api');var utils=require(_0x78d3('0x16'));var config=require(_0x78d3('0x17'));var licenseUtil=require(_0x78d3('0x18'));var db=require(_0x78d3('0x19'))['db'];function respondWithStatusCode(_0x172cf6,_0x215351){_0x215351=_0x215351||0xcc;return function(_0x41d1f5){if(_0x41d1f5){return _0x172cf6['sendStatus'](_0x215351);}return _0x172cf6[_0x78d3('0x1a')](_0x215351)[_0x78d3('0x1b')]();};}function respondWithResult(_0x151d4a,_0x5b7528){_0x5b7528=_0x5b7528||0xc8;return function(_0x442d41){if(_0x442d41){return _0x151d4a['status'](_0x5b7528)[_0x78d3('0x1c')](_0x442d41);}};}function respondWithFilteredResult(_0x5a723f,_0x28152a){return function(_0x5aa7c9){if(_0x5aa7c9){var _0xf0d7fa=typeof _0x28152a[_0x78d3('0x1d')]==='undefined'&&typeof _0x28152a['limit']===_0x78d3('0x1e');var _0x9fedb1=_0x5aa7c9[_0x78d3('0x1f')];var _0x481766=_0xf0d7fa?0x0:_0x28152a['offset'];var _0x4110c6=_0xf0d7fa?_0x5aa7c9['count']:_0x28152a['offset']+_0x28152a['limit'];var _0x428942;if(_0x4110c6>=_0x9fedb1){_0x4110c6=_0x9fedb1;_0x428942=0xc8;}else{_0x428942=0xce;}_0x5a723f[_0x78d3('0x1a')](_0x428942);return _0x5a723f[_0x78d3('0x20')]('Content-Range',_0x481766+'-'+_0x4110c6+'/'+_0x9fedb1)[_0x78d3('0x1c')](_0x5aa7c9);}return null;};}function patchUpdates(_0x131b3d){return function(_0x4d3227){try{jsonpatch[_0x78d3('0x21')](_0x4d3227,_0x131b3d,!![]);}catch(_0x1055ec){return BPromise[_0x78d3('0x22')](_0x1055ec);}return _0x4d3227[_0x78d3('0x23')]();};}function saveUpdates(_0x43b64a,_0x821ed8){return function(_0x2ac0a1){if(_0x2ac0a1){return _0x2ac0a1[_0x78d3('0x24')](_0x43b64a)[_0x78d3('0x25')](function(_0x4184d7){return _0x4184d7;});}return null;};}function removeEntity(_0x55c490,_0x33175c){return function(_0x484ae6){if(_0x484ae6){return _0x484ae6[_0x78d3('0x26')]()[_0x78d3('0x25')](function(){_0x55c490['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b236,_0x213c35){return function(_0x577d87){if(!_0x577d87){_0x51b236['sendStatus'](0x194);}return _0x577d87;};}function handleError(_0x1aa479,_0x361803){_0x361803=_0x361803||0x1f4;return function(_0x111489){logger[_0x78d3('0x27')](_0x111489[_0x78d3('0x28')]);if(_0x111489['name']){delete _0x111489[_0x78d3('0x29')];}_0x1aa479[_0x78d3('0x1a')](_0x361803)[_0x78d3('0x2a')](_0x111489);};}exports[_0x78d3('0x2b')]=function(_0x18dcd4,_0x4300ea){var _0x291fa8={},_0x3aa051={},_0x17e3b8={'count':0x0,'rows':[]};var _0x1e657d=_[_0x78d3('0x2c')](db[_0x78d3('0x2d')][_0x78d3('0x2e')],function(_0xfee079){return{'name':_0xfee079['fieldName'],'type':_0xfee079[_0x78d3('0x2f')][_0x78d3('0x30')]};});_0x3aa051[_0x78d3('0x31')]=_[_0x78d3('0x2c')](_0x1e657d,_0x78d3('0x29'));_0x3aa051[_0x78d3('0x32')]=_[_0x78d3('0x33')](_0x18dcd4['query']);_0x3aa051[_0x78d3('0x34')]=_[_0x78d3('0x35')](_0x3aa051[_0x78d3('0x31')],_0x3aa051['query']);_0x291fa8[_0x78d3('0x36')]=_['intersection'](_0x3aa051[_0x78d3('0x31')],qs[_0x78d3('0x37')](_0x18dcd4[_0x78d3('0x32')][_0x78d3('0x37')]));_0x291fa8['attributes']=_0x291fa8[_0x78d3('0x36')]['length']?_0x291fa8[_0x78d3('0x36')]:_0x3aa051['model'];if(!_0x18dcd4['query'][_0x78d3('0x38')](_0x78d3('0x39'))){_0x291fa8[_0x78d3('0x3a')]=qs['limit'](_0x18dcd4[_0x78d3('0x32')]['limit']);_0x291fa8[_0x78d3('0x1d')]=qs['offset'](_0x18dcd4[_0x78d3('0x32')][_0x78d3('0x1d')]);}_0x291fa8[_0x78d3('0x3b')]=qs['sort'](_0x18dcd4[_0x78d3('0x32')][_0x78d3('0x3c')]);_0x291fa8[_0x78d3('0x3d')]=qs[_0x78d3('0x34')](_[_0x78d3('0x3e')](_0x18dcd4[_0x78d3('0x32')],_0x3aa051[_0x78d3('0x34')]),_0x1e657d);if(_0x18dcd4[_0x78d3('0x32')][_0x78d3('0x3f')]){_0x291fa8[_0x78d3('0x3d')]=_['merge'](_0x291fa8['where'],{'$or':_[_0x78d3('0x2c')](_0x1e657d,function(_0x283956){if(_0x283956[_0x78d3('0x2f')]!==_0x78d3('0x40')){var _0x2d8d88={};_0x2d8d88[_0x283956['name']]={'$like':'%'+_0x18dcd4[_0x78d3('0x32')][_0x78d3('0x3f')]+'%'};return _0x2d8d88;}})});}_0x291fa8=_[_0x78d3('0x41')]({},_0x291fa8,_0x18dcd4[_0x78d3('0x42')]);var _0x22afab={'where':_0x291fa8[_0x78d3('0x3d')]};return db['SalesforceConfiguration']['count'](_0x22afab)[_0x78d3('0x25')](function(_0x109532){_0x17e3b8[_0x78d3('0x1f')]=_0x109532;if(_0x18dcd4[_0x78d3('0x32')][_0x78d3('0x43')]){_0x291fa8[_0x78d3('0x44')]=[{'all':!![]}];}return db[_0x78d3('0x2d')]['findAll'](_0x291fa8);})[_0x78d3('0x25')](function(_0x503261){_0x17e3b8['rows']=_0x503261;return _0x17e3b8;})[_0x78d3('0x25')](respondWithFilteredResult(_0x4300ea,_0x291fa8))[_0x78d3('0x45')](handleError(_0x4300ea,null));};exports[_0x78d3('0x46')]=function(_0x129e53,_0x567c4b){var _0x241eea={'raw':![],'where':{'id':_0x129e53['params']['id']}},_0x208516={};_0x208516['model']=_['keys'](db[_0x78d3('0x2d')]['rawAttributes']);_0x208516[_0x78d3('0x32')]=_[_0x78d3('0x33')](_0x129e53[_0x78d3('0x32')]);_0x208516[_0x78d3('0x34')]=_[_0x78d3('0x35')](_0x208516[_0x78d3('0x31')],_0x208516[_0x78d3('0x32')]);_0x241eea[_0x78d3('0x36')]=_[_0x78d3('0x35')](_0x208516[_0x78d3('0x31')],qs['fields'](_0x129e53[_0x78d3('0x32')][_0x78d3('0x37')]));_0x241eea[_0x78d3('0x36')]=_0x241eea[_0x78d3('0x36')][_0x78d3('0x47')]?_0x241eea[_0x78d3('0x36')]:_0x208516[_0x78d3('0x31')];if(_0x129e53['query'][_0x78d3('0x43')]){_0x241eea[_0x78d3('0x44')]=[{'all':!![]}];}_0x241eea=_[_0x78d3('0x41')]({},_0x241eea,_0x129e53[_0x78d3('0x42')]);return db['SalesforceConfiguration'][_0x78d3('0x48')](_0x241eea)['then'](handleEntityNotFound(_0x567c4b,null))[_0x78d3('0x25')](respondWithResult(_0x567c4b,null))[_0x78d3('0x45')](handleError(_0x567c4b,null));};exports[_0x78d3('0x49')]=function(_0x4d701b,_0x56463e){return db['SalesforceConfiguration'][_0x78d3('0x49')](_0x4d701b[_0x78d3('0x4a')],{})[_0x78d3('0x25')](respondWithResult(_0x56463e,0xc9))[_0x78d3('0x45')](handleError(_0x56463e,null));};exports['update']=function(_0x3537c9,_0x162cc4){if(_0x3537c9[_0x78d3('0x4a')]['id']){delete _0x3537c9[_0x78d3('0x4a')]['id'];}return db[_0x78d3('0x2d')]['find']({'where':{'id':_0x3537c9[_0x78d3('0x4b')]['id']}})[_0x78d3('0x25')](handleEntityNotFound(_0x162cc4,null))[_0x78d3('0x25')](saveUpdates(_0x3537c9[_0x78d3('0x4a')],null))[_0x78d3('0x25')](respondWithResult(_0x162cc4,null))[_0x78d3('0x45')](handleError(_0x162cc4,null));};exports[_0x78d3('0x26')]=function(_0x33cbca,_0x45882b){return db[_0x78d3('0x2d')][_0x78d3('0x48')]({'where':{'id':_0x33cbca[_0x78d3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45882b,null))[_0x78d3('0x25')](removeEntity(_0x45882b,null))[_0x78d3('0x45')](handleError(_0x45882b,null));};exports[_0x78d3('0x4c')]=function(_0x4155e5,_0x212eac,_0x15d3e8){var _0x35314f={};var _0x57ae77={};var _0x14d714;var _0x18da11;return db[_0x78d3('0x2d')][_0x78d3('0x4d')]({'where':{'id':_0x4155e5[_0x78d3('0x4b')]['id']}})[_0x78d3('0x25')](handleEntityNotFound(_0x212eac,null))['then'](function(_0x178b34){if(_0x178b34){_0x14d714=_0x178b34;_0x57ae77[_0x78d3('0x31')]=_['keys'](db['SalesforceField'][_0x78d3('0x2e')]);_0x57ae77['query']=_[_0x78d3('0x33')](_0x4155e5[_0x78d3('0x32')]);_0x57ae77[_0x78d3('0x34')]=_['intersection'](_0x57ae77[_0x78d3('0x31')],_0x57ae77[_0x78d3('0x32')]);_0x35314f[_0x78d3('0x36')]=_[_0x78d3('0x35')](_0x57ae77[_0x78d3('0x31')],qs[_0x78d3('0x37')](_0x4155e5['query'][_0x78d3('0x37')]));_0x35314f[_0x78d3('0x36')]=_0x35314f['attributes']['length']?_0x35314f[_0x78d3('0x36')]:_0x57ae77[_0x78d3('0x31')];_0x35314f[_0x78d3('0x3b')]=qs[_0x78d3('0x3c')](_0x4155e5['query'][_0x78d3('0x3c')]);_0x35314f[_0x78d3('0x3d')]=qs[_0x78d3('0x34')](_[_0x78d3('0x3e')](_0x4155e5[_0x78d3('0x32')],_0x57ae77['filters']));if(_0x4155e5[_0x78d3('0x32')][_0x78d3('0x3f')]){_0x35314f[_0x78d3('0x3d')]=_[_0x78d3('0x41')](_0x35314f[_0x78d3('0x3d')],{'$or':_[_0x78d3('0x2c')](_0x35314f[_0x78d3('0x36')],function(_0x464644){var _0x4196e8={};_0x4196e8[_0x464644]={'$like':'%'+_0x4155e5[_0x78d3('0x32')]['filter']+'%'};return _0x4196e8;})});}_0x35314f=_[_0x78d3('0x41')]({},_0x35314f,_0x4155e5[_0x78d3('0x42')]);return _0x14d714[_0x78d3('0x4c')](_0x35314f);}})[_0x78d3('0x25')](function(_0xc45559){if(_0xc45559){_0x18da11=_0xc45559[_0x78d3('0x47')];if(!_0x4155e5[_0x78d3('0x32')]['hasOwnProperty']('nolimit')){_0x35314f[_0x78d3('0x3a')]=qs[_0x78d3('0x3a')](_0x4155e5[_0x78d3('0x32')][_0x78d3('0x3a')]);_0x35314f[_0x78d3('0x1d')]=qs[_0x78d3('0x1d')](_0x4155e5[_0x78d3('0x32')][_0x78d3('0x1d')]);}return _0x14d714[_0x78d3('0x4c')](_0x35314f);}})[_0x78d3('0x25')](function(_0x1c311f){if(_0x1c311f){return _0x1c311f?{'count':_0x18da11,'rows':_0x1c311f}:null;}})[_0x78d3('0x25')](respondWithResult(_0x212eac,null))[_0x78d3('0x45')](handleError(_0x212eac,null));};exports[_0x78d3('0x4e')]=function(_0x56a251,_0x11427c,_0x1a411d){var _0x466bd8={};var _0x40ba8c={};var _0x435dd3;var _0x148d76;return db[_0x78d3('0x2d')][_0x78d3('0x4d')]({'where':{'id':_0x56a251[_0x78d3('0x4b')]['id']}})[_0x78d3('0x25')](handleEntityNotFound(_0x11427c,null))[_0x78d3('0x25')](function(_0x1236e5){if(_0x1236e5){_0x435dd3=_0x1236e5;_0x40ba8c[_0x78d3('0x31')]=_[_0x78d3('0x33')](db['SalesforceField'][_0x78d3('0x2e')]);_0x40ba8c[_0x78d3('0x32')]=_[_0x78d3('0x33')](_0x56a251[_0x78d3('0x32')]);_0x40ba8c[_0x78d3('0x34')]=_[_0x78d3('0x35')](_0x40ba8c[_0x78d3('0x31')],_0x40ba8c['query']);_0x466bd8['attributes']=_[_0x78d3('0x35')](_0x40ba8c[_0x78d3('0x31')],qs[_0x78d3('0x37')](_0x56a251['query']['fields']));_0x466bd8[_0x78d3('0x36')]=_0x466bd8[_0x78d3('0x36')][_0x78d3('0x47')]?_0x466bd8['attributes']:_0x40ba8c['model'];_0x466bd8[_0x78d3('0x3b')]=qs[_0x78d3('0x3c')](_0x56a251[_0x78d3('0x32')]['sort']);_0x466bd8[_0x78d3('0x3d')]=qs[_0x78d3('0x34')](_[_0x78d3('0x3e')](_0x56a251['query'],_0x40ba8c[_0x78d3('0x34')]));if(_0x56a251[_0x78d3('0x32')]['filter']){_0x466bd8[_0x78d3('0x3d')]=_[_0x78d3('0x41')](_0x466bd8[_0x78d3('0x3d')],{'$or':_[_0x78d3('0x2c')](_0x466bd8[_0x78d3('0x36')],function(_0x187054){var _0x1fa311={};_0x1fa311[_0x187054]={'$like':'%'+_0x56a251[_0x78d3('0x32')][_0x78d3('0x3f')]+'%'};return _0x1fa311;})});}_0x466bd8=_['merge']({},_0x466bd8,_0x56a251[_0x78d3('0x42')]);return _0x435dd3[_0x78d3('0x4e')](_0x466bd8);}})['then'](function(_0x184288){if(_0x184288){_0x148d76=_0x184288[_0x78d3('0x47')];if(!_0x56a251[_0x78d3('0x32')][_0x78d3('0x38')](_0x78d3('0x39'))){_0x466bd8[_0x78d3('0x3a')]=qs[_0x78d3('0x3a')](_0x56a251[_0x78d3('0x32')][_0x78d3('0x3a')]);_0x466bd8[_0x78d3('0x1d')]=qs[_0x78d3('0x1d')](_0x56a251['query']['offset']);}return _0x435dd3[_0x78d3('0x4e')](_0x466bd8);}})[_0x78d3('0x25')](function(_0x5c6dda){if(_0x5c6dda){return _0x5c6dda?{'count':_0x148d76,'rows':_0x5c6dda}:null;}})[_0x78d3('0x25')](respondWithResult(_0x11427c,null))[_0x78d3('0x45')](handleError(_0x11427c,null));};exports[_0x78d3('0x4f')]=function(_0x27745d,_0x324fa5,_0x184ab4){var _0x1bc1d4={};var _0x527d99={};var _0xc740cd;var _0x206c50;return db[_0x78d3('0x2d')][_0x78d3('0x4d')]({'where':{'id':_0x27745d[_0x78d3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x324fa5,null))['then'](function(_0x543478){if(_0x543478){_0xc740cd=_0x543478;_0x527d99[_0x78d3('0x31')]=_[_0x78d3('0x33')](db[_0x78d3('0x50')]['rawAttributes']);_0x527d99['query']=_[_0x78d3('0x33')](_0x27745d[_0x78d3('0x32')]);_0x527d99[_0x78d3('0x34')]=_[_0x78d3('0x35')](_0x527d99[_0x78d3('0x31')],_0x527d99['query']);_0x1bc1d4['attributes']=_[_0x78d3('0x35')](_0x527d99[_0x78d3('0x31')],qs[_0x78d3('0x37')](_0x27745d[_0x78d3('0x32')][_0x78d3('0x37')]));_0x1bc1d4[_0x78d3('0x36')]=_0x1bc1d4[_0x78d3('0x36')][_0x78d3('0x47')]?_0x1bc1d4[_0x78d3('0x36')]:_0x527d99[_0x78d3('0x31')];_0x1bc1d4['order']=qs[_0x78d3('0x3c')](_0x27745d['query']['sort']);_0x1bc1d4[_0x78d3('0x3d')]=qs[_0x78d3('0x34')](_[_0x78d3('0x3e')](_0x27745d[_0x78d3('0x32')],_0x527d99[_0x78d3('0x34')]));if(_0x27745d[_0x78d3('0x32')][_0x78d3('0x3f')]){_0x1bc1d4[_0x78d3('0x3d')]=_[_0x78d3('0x41')](_0x1bc1d4['where'],{'$or':_[_0x78d3('0x2c')](_0x1bc1d4[_0x78d3('0x36')],function(_0x15e511){var _0x4f21a0={};_0x4f21a0[_0x15e511]={'$like':'%'+_0x27745d['query'][_0x78d3('0x3f')]+'%'};return _0x4f21a0;})});}_0x1bc1d4=_[_0x78d3('0x41')]({},_0x1bc1d4,_0x27745d[_0x78d3('0x42')]);return _0xc740cd[_0x78d3('0x4f')](_0x1bc1d4);}})['then'](function(_0x2fd217){if(_0x2fd217){_0x206c50=_0x2fd217['length'];if(!_0x27745d[_0x78d3('0x32')][_0x78d3('0x38')]('nolimit')){_0x1bc1d4[_0x78d3('0x3a')]=qs[_0x78d3('0x3a')](_0x27745d[_0x78d3('0x32')][_0x78d3('0x3a')]);_0x1bc1d4[_0x78d3('0x1d')]=qs[_0x78d3('0x1d')](_0x27745d[_0x78d3('0x32')][_0x78d3('0x1d')]);}return _0xc740cd[_0x78d3('0x4f')](_0x1bc1d4);}})[_0x78d3('0x25')](function(_0x1af7d1){if(_0x1af7d1){return _0x1af7d1?{'count':_0x206c50,'rows':_0x1af7d1}:null;}})[_0x78d3('0x25')](respondWithResult(_0x324fa5,null))[_0x78d3('0x45')](handleError(_0x324fa5,null));}; \ No newline at end of file +var _0x1cbb=['options','include','rows','show','params','keys','includeAll','find','create','body','catch','findOne','rawAttributes','order','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','SalesforceConfiguration','fieldName','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','type','merge'];(function(_0x1fd654,_0x553655){var _0x2bf8e1=function(_0x5c9506){while(--_0x5c9506){_0x1fd654['push'](_0x1fd654['shift']());}};_0x2bf8e1(++_0x553655);}(_0x1cbb,0x105));var _0xb1cb=function(_0x4d3303,_0xae916e){_0x4d3303=_0x4d3303-0x0;var _0x1c3768=_0x1cbb[_0x4d3303];return _0x1c3768;};'use strict';var emlformat=require(_0xb1cb('0x0'));var rimraf=require(_0xb1cb('0x1'));var zipdir=require(_0xb1cb('0x2'));var jsonpatch=require(_0xb1cb('0x3'));var rp=require('request-promise');var moment=require(_0xb1cb('0x4'));var BPromise=require(_0xb1cb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb1cb('0x6'));var sox=require(_0xb1cb('0x7'));var csv=require(_0xb1cb('0x8'));var ejs=require(_0xb1cb('0x9'));var fs=require('fs');var fs_extra=require(_0xb1cb('0xa'));var _=require(_0xb1cb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb1cb('0xc'));var deskjs=require(_0xb1cb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb1cb('0xe'));var Papa=require(_0xb1cb('0xf'));var Redis=require('ioredis');var authService=require(_0xb1cb('0x10'));var qs=require(_0xb1cb('0x11'));var as=require(_0xb1cb('0x12'));var hardwareService=require(_0xb1cb('0x13'));var logger=require(_0xb1cb('0x14'))(_0xb1cb('0x15'));var utils=require(_0xb1cb('0x16'));var config=require(_0xb1cb('0x17'));var licenseUtil=require(_0xb1cb('0x18'));var db=require(_0xb1cb('0x19'))['db'];function respondWithStatusCode(_0x2a42cc,_0x4789c9){_0x4789c9=_0x4789c9||0xcc;return function(_0x56819c){if(_0x56819c){return _0x2a42cc[_0xb1cb('0x1a')](_0x4789c9);}return _0x2a42cc['status'](_0x4789c9)[_0xb1cb('0x1b')]();};}function respondWithResult(_0x3a470f,_0x4e6888){_0x4e6888=_0x4e6888||0xc8;return function(_0x1acbe6){if(_0x1acbe6){return _0x3a470f['status'](_0x4e6888)['json'](_0x1acbe6);}};}function respondWithFilteredResult(_0xda39ae,_0x12bcba){return function(_0x1177c1){if(_0x1177c1){var _0x28f351=typeof _0x12bcba[_0xb1cb('0x1c')]===_0xb1cb('0x1d')&&typeof _0x12bcba[_0xb1cb('0x1e')]===_0xb1cb('0x1d');var _0x183aba=_0x1177c1['count'];var _0xa84e8c=_0x28f351?0x0:_0x12bcba[_0xb1cb('0x1c')];var _0xc286f2=_0x28f351?_0x1177c1[_0xb1cb('0x1f')]:_0x12bcba['offset']+_0x12bcba[_0xb1cb('0x1e')];var _0x5800fe;if(_0xc286f2>=_0x183aba){_0xc286f2=_0x183aba;_0x5800fe=0xc8;}else{_0x5800fe=0xce;}_0xda39ae[_0xb1cb('0x20')](_0x5800fe);return _0xda39ae['set'](_0xb1cb('0x21'),_0xa84e8c+'-'+_0xc286f2+'/'+_0x183aba)[_0xb1cb('0x22')](_0x1177c1);}return null;};}function patchUpdates(_0x15202a){return function(_0x1867f7){try{jsonpatch['apply'](_0x1867f7,_0x15202a,!![]);}catch(_0x5a0acf){return BPromise[_0xb1cb('0x23')](_0x5a0acf);}return _0x1867f7[_0xb1cb('0x24')]();};}function saveUpdates(_0x3a821b,_0x165a04){return function(_0x522403){if(_0x522403){return _0x522403['update'](_0x3a821b)[_0xb1cb('0x25')](function(_0x59784d){return _0x59784d;});}return null;};}function removeEntity(_0x1962b6,_0x47d6f2){return function(_0x37a2cd){if(_0x37a2cd){return _0x37a2cd[_0xb1cb('0x26')]()[_0xb1cb('0x25')](function(){_0x1962b6['status'](0xcc)[_0xb1cb('0x1b')]();});}};}function handleEntityNotFound(_0x410031,_0x38d554){return function(_0x465ac5){if(!_0x465ac5){_0x410031[_0xb1cb('0x1a')](0x194);}return _0x465ac5;};}function handleError(_0x542ca2,_0x271c7c){_0x271c7c=_0x271c7c||0x1f4;return function(_0x3ecd97){logger[_0xb1cb('0x27')](_0x3ecd97[_0xb1cb('0x28')]);if(_0x3ecd97[_0xb1cb('0x29')]){delete _0x3ecd97[_0xb1cb('0x29')];}_0x542ca2[_0xb1cb('0x20')](_0x271c7c)[_0xb1cb('0x2a')](_0x3ecd97);};}exports[_0xb1cb('0x2b')]=function(_0x28560a,_0x5b086e){var _0x50a446={},_0x3073ca={},_0x2cbcb0={'count':0x0,'rows':[]};var _0x32b9e3=_['map'](db[_0xb1cb('0x2c')]['rawAttributes'],function(_0x265aed){return{'name':_0x265aed[_0xb1cb('0x2d')],'type':_0x265aed['type'][_0xb1cb('0x2e')]};});_0x3073ca['model']=_['map'](_0x32b9e3,_0xb1cb('0x29'));_0x3073ca[_0xb1cb('0x2f')]=_['keys'](_0x28560a[_0xb1cb('0x2f')]);_0x3073ca['filters']=_['intersection'](_0x3073ca['model'],_0x3073ca[_0xb1cb('0x2f')]);_0x50a446['attributes']=_[_0xb1cb('0x30')](_0x3073ca[_0xb1cb('0x31')],qs[_0xb1cb('0x32')](_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x32')]));_0x50a446[_0xb1cb('0x33')]=_0x50a446[_0xb1cb('0x33')][_0xb1cb('0x34')]?_0x50a446[_0xb1cb('0x33')]:_0x3073ca[_0xb1cb('0x31')];if(!_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x35')](_0xb1cb('0x36'))){_0x50a446[_0xb1cb('0x1e')]=qs[_0xb1cb('0x1e')](_0x28560a[_0xb1cb('0x2f')]['limit']);_0x50a446[_0xb1cb('0x1c')]=qs[_0xb1cb('0x1c')](_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x1c')]);}_0x50a446['order']=qs[_0xb1cb('0x37')](_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x37')]);_0x50a446[_0xb1cb('0x38')]=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x28560a[_0xb1cb('0x2f')],_0x3073ca[_0xb1cb('0x39')]),_0x32b9e3);if(_0x28560a['query'][_0xb1cb('0x3b')]){_0x50a446['where']=_['merge'](_0x50a446[_0xb1cb('0x38')],{'$or':_[_0xb1cb('0x3c')](_0x32b9e3,function(_0x507c12){if(_0x507c12[_0xb1cb('0x3d')]!=='VIRTUAL'){var _0x303687={};_0x303687[_0x507c12[_0xb1cb('0x29')]]={'$like':'%'+_0x28560a[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x303687;}})});}_0x50a446=_[_0xb1cb('0x3e')]({},_0x50a446,_0x28560a[_0xb1cb('0x3f')]);var _0x462734={'where':_0x50a446[_0xb1cb('0x38')]};return db[_0xb1cb('0x2c')][_0xb1cb('0x1f')](_0x462734)[_0xb1cb('0x25')](function(_0x1162da){_0x2cbcb0[_0xb1cb('0x1f')]=_0x1162da;if(_0x28560a[_0xb1cb('0x2f')]['includeAll']){_0x50a446[_0xb1cb('0x40')]=[{'all':!![]}];}return db[_0xb1cb('0x2c')]['findAll'](_0x50a446);})[_0xb1cb('0x25')](function(_0x5cfa36){_0x2cbcb0[_0xb1cb('0x41')]=_0x5cfa36;return _0x2cbcb0;})[_0xb1cb('0x25')](respondWithFilteredResult(_0x5b086e,_0x50a446))['catch'](handleError(_0x5b086e,null));};exports[_0xb1cb('0x42')]=function(_0x102fe0,_0x1e5d27){var _0x34157d={'raw':![],'where':{'id':_0x102fe0[_0xb1cb('0x43')]['id']}},_0x4a91b2={};_0x4a91b2[_0xb1cb('0x31')]=_[_0xb1cb('0x44')](db[_0xb1cb('0x2c')]['rawAttributes']);_0x4a91b2[_0xb1cb('0x2f')]=_['keys'](_0x102fe0[_0xb1cb('0x2f')]);_0x4a91b2[_0xb1cb('0x39')]=_['intersection'](_0x4a91b2[_0xb1cb('0x31')],_0x4a91b2['query']);_0x34157d[_0xb1cb('0x33')]=_['intersection'](_0x4a91b2[_0xb1cb('0x31')],qs['fields'](_0x102fe0[_0xb1cb('0x2f')]['fields']));_0x34157d[_0xb1cb('0x33')]=_0x34157d[_0xb1cb('0x33')]['length']?_0x34157d[_0xb1cb('0x33')]:_0x4a91b2[_0xb1cb('0x31')];if(_0x102fe0['query'][_0xb1cb('0x45')]){_0x34157d[_0xb1cb('0x40')]=[{'all':!![]}];}_0x34157d=_['merge']({},_0x34157d,_0x102fe0[_0xb1cb('0x3f')]);return db[_0xb1cb('0x2c')][_0xb1cb('0x46')](_0x34157d)[_0xb1cb('0x25')](handleEntityNotFound(_0x1e5d27,null))['then'](respondWithResult(_0x1e5d27,null))['catch'](handleError(_0x1e5d27,null));};exports[_0xb1cb('0x47')]=function(_0x1a1c9c,_0x8bfc4){return db[_0xb1cb('0x2c')][_0xb1cb('0x47')](_0x1a1c9c[_0xb1cb('0x48')],{})['then'](respondWithResult(_0x8bfc4,0xc9))['catch'](handleError(_0x8bfc4,null));};exports['update']=function(_0x10c536,_0x144d10){if(_0x10c536[_0xb1cb('0x48')]['id']){delete _0x10c536[_0xb1cb('0x48')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x10c536[_0xb1cb('0x43')]['id']}})[_0xb1cb('0x25')](handleEntityNotFound(_0x144d10,null))[_0xb1cb('0x25')](saveUpdates(_0x10c536[_0xb1cb('0x48')],null))[_0xb1cb('0x25')](respondWithResult(_0x144d10,null))[_0xb1cb('0x49')](handleError(_0x144d10,null));};exports[_0xb1cb('0x26')]=function(_0x478454,_0x31ea7b){return db['SalesforceConfiguration'][_0xb1cb('0x46')]({'where':{'id':_0x478454[_0xb1cb('0x43')]['id']}})[_0xb1cb('0x25')](handleEntityNotFound(_0x31ea7b,null))[_0xb1cb('0x25')](removeEntity(_0x31ea7b,null))[_0xb1cb('0x49')](handleError(_0x31ea7b,null));};exports['getFields']=function(_0x71bfa9,_0x3226f2,_0x5ec80d){var _0x46d7f9={};var _0x247058={};var _0x1817fd;var _0x353224;return db['SalesforceConfiguration'][_0xb1cb('0x4a')]({'where':{'id':_0x71bfa9[_0xb1cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3226f2,null))[_0xb1cb('0x25')](function(_0x5aa2a8){if(_0x5aa2a8){_0x1817fd=_0x5aa2a8;_0x247058[_0xb1cb('0x31')]=_['keys'](db['SalesforceField'][_0xb1cb('0x4b')]);_0x247058[_0xb1cb('0x2f')]=_[_0xb1cb('0x44')](_0x71bfa9[_0xb1cb('0x2f')]);_0x247058[_0xb1cb('0x39')]=_['intersection'](_0x247058[_0xb1cb('0x31')],_0x247058[_0xb1cb('0x2f')]);_0x46d7f9[_0xb1cb('0x33')]=_['intersection'](_0x247058[_0xb1cb('0x31')],qs[_0xb1cb('0x32')](_0x71bfa9['query'][_0xb1cb('0x32')]));_0x46d7f9[_0xb1cb('0x33')]=_0x46d7f9[_0xb1cb('0x33')]['length']?_0x46d7f9[_0xb1cb('0x33')]:_0x247058['model'];_0x46d7f9[_0xb1cb('0x4c')]=qs[_0xb1cb('0x37')](_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x37')]);_0x46d7f9['where']=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x71bfa9[_0xb1cb('0x2f')],_0x247058[_0xb1cb('0x39')]));if(_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x3b')]){_0x46d7f9[_0xb1cb('0x38')]=_[_0xb1cb('0x3e')](_0x46d7f9['where'],{'$or':_[_0xb1cb('0x3c')](_0x46d7f9['attributes'],function(_0x2d99a1){var _0x36e69c={};_0x36e69c[_0x2d99a1]={'$like':'%'+_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x36e69c;})});}_0x46d7f9=_[_0xb1cb('0x3e')]({},_0x46d7f9,_0x71bfa9[_0xb1cb('0x3f')]);return _0x1817fd[_0xb1cb('0x4d')](_0x46d7f9);}})[_0xb1cb('0x25')](function(_0x124d9a){if(_0x124d9a){_0x353224=_0x124d9a[_0xb1cb('0x34')];if(!_0x71bfa9['query'][_0xb1cb('0x35')](_0xb1cb('0x36'))){_0x46d7f9[_0xb1cb('0x1e')]=qs[_0xb1cb('0x1e')](_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x1e')]);_0x46d7f9[_0xb1cb('0x1c')]=qs[_0xb1cb('0x1c')](_0x71bfa9[_0xb1cb('0x2f')][_0xb1cb('0x1c')]);}return _0x1817fd[_0xb1cb('0x4d')](_0x46d7f9);}})['then'](function(_0x2004f4){if(_0x2004f4){return _0x2004f4?{'count':_0x353224,'rows':_0x2004f4}:null;}})['then'](respondWithResult(_0x3226f2,null))[_0xb1cb('0x49')](handleError(_0x3226f2,null));};exports[_0xb1cb('0x4e')]=function(_0x2c9bea,_0x36ef61,_0xb7e066){var _0x5826e5={};var _0x3568e5={};var _0x39b191;var _0x2b5fc2;return db[_0xb1cb('0x2c')]['findOne']({'where':{'id':_0x2c9bea[_0xb1cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x36ef61,null))[_0xb1cb('0x25')](function(_0x1df971){if(_0x1df971){_0x39b191=_0x1df971;_0x3568e5[_0xb1cb('0x31')]=_[_0xb1cb('0x44')](db[_0xb1cb('0x4f')]['rawAttributes']);_0x3568e5['query']=_[_0xb1cb('0x44')](_0x2c9bea[_0xb1cb('0x2f')]);_0x3568e5[_0xb1cb('0x39')]=_['intersection'](_0x3568e5[_0xb1cb('0x31')],_0x3568e5[_0xb1cb('0x2f')]);_0x5826e5['attributes']=_[_0xb1cb('0x30')](_0x3568e5['model'],qs[_0xb1cb('0x32')](_0x2c9bea['query'][_0xb1cb('0x32')]));_0x5826e5[_0xb1cb('0x33')]=_0x5826e5[_0xb1cb('0x33')][_0xb1cb('0x34')]?_0x5826e5[_0xb1cb('0x33')]:_0x3568e5[_0xb1cb('0x31')];_0x5826e5[_0xb1cb('0x4c')]=qs['sort'](_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x37')]);_0x5826e5[_0xb1cb('0x38')]=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x2c9bea[_0xb1cb('0x2f')],_0x3568e5[_0xb1cb('0x39')]));if(_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x3b')]){_0x5826e5[_0xb1cb('0x38')]=_['merge'](_0x5826e5[_0xb1cb('0x38')],{'$or':_['map'](_0x5826e5[_0xb1cb('0x33')],function(_0x54dd87){var _0x1ec0e1={};_0x1ec0e1[_0x54dd87]={'$like':'%'+_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x1ec0e1;})});}_0x5826e5=_['merge']({},_0x5826e5,_0x2c9bea['options']);return _0x39b191[_0xb1cb('0x4e')](_0x5826e5);}})[_0xb1cb('0x25')](function(_0xfc1a2){if(_0xfc1a2){_0x2b5fc2=_0xfc1a2[_0xb1cb('0x34')];if(!_0x2c9bea['query']['hasOwnProperty'](_0xb1cb('0x36'))){_0x5826e5[_0xb1cb('0x1e')]=qs[_0xb1cb('0x1e')](_0x2c9bea[_0xb1cb('0x2f')][_0xb1cb('0x1e')]);_0x5826e5[_0xb1cb('0x1c')]=qs[_0xb1cb('0x1c')](_0x2c9bea['query'][_0xb1cb('0x1c')]);}return _0x39b191[_0xb1cb('0x4e')](_0x5826e5);}})[_0xb1cb('0x25')](function(_0x6a382){if(_0x6a382){return _0x6a382?{'count':_0x2b5fc2,'rows':_0x6a382}:null;}})[_0xb1cb('0x25')](respondWithResult(_0x36ef61,null))['catch'](handleError(_0x36ef61,null));};exports[_0xb1cb('0x50')]=function(_0x107613,_0x40d061,_0x39681d){var _0x20a99e={};var _0x36099b={};var _0x3ed677;var _0xdd6c90;return db[_0xb1cb('0x2c')][_0xb1cb('0x4a')]({'where':{'id':_0x107613[_0xb1cb('0x43')]['id']}})[_0xb1cb('0x25')](handleEntityNotFound(_0x40d061,null))[_0xb1cb('0x25')](function(_0x2315c6){if(_0x2315c6){_0x3ed677=_0x2315c6;_0x36099b[_0xb1cb('0x31')]=_[_0xb1cb('0x44')](db[_0xb1cb('0x4f')]['rawAttributes']);_0x36099b['query']=_[_0xb1cb('0x44')](_0x107613[_0xb1cb('0x2f')]);_0x36099b['filters']=_[_0xb1cb('0x30')](_0x36099b['model'],_0x36099b[_0xb1cb('0x2f')]);_0x20a99e[_0xb1cb('0x33')]=_[_0xb1cb('0x30')](_0x36099b[_0xb1cb('0x31')],qs[_0xb1cb('0x32')](_0x107613['query']['fields']));_0x20a99e[_0xb1cb('0x33')]=_0x20a99e[_0xb1cb('0x33')][_0xb1cb('0x34')]?_0x20a99e['attributes']:_0x36099b['model'];_0x20a99e[_0xb1cb('0x4c')]=qs['sort'](_0x107613[_0xb1cb('0x2f')]['sort']);_0x20a99e[_0xb1cb('0x38')]=qs[_0xb1cb('0x39')](_[_0xb1cb('0x3a')](_0x107613[_0xb1cb('0x2f')],_0x36099b[_0xb1cb('0x39')]));if(_0x107613[_0xb1cb('0x2f')]['filter']){_0x20a99e[_0xb1cb('0x38')]=_[_0xb1cb('0x3e')](_0x20a99e[_0xb1cb('0x38')],{'$or':_[_0xb1cb('0x3c')](_0x20a99e['attributes'],function(_0x71ba71){var _0x197812={};_0x197812[_0x71ba71]={'$like':'%'+_0x107613[_0xb1cb('0x2f')][_0xb1cb('0x3b')]+'%'};return _0x197812;})});}_0x20a99e=_[_0xb1cb('0x3e')]({},_0x20a99e,_0x107613['options']);return _0x3ed677[_0xb1cb('0x50')](_0x20a99e);}})['then'](function(_0x565685){if(_0x565685){_0xdd6c90=_0x565685['length'];if(!_0x107613[_0xb1cb('0x2f')]['hasOwnProperty'](_0xb1cb('0x36'))){_0x20a99e[_0xb1cb('0x1e')]=qs['limit'](_0x107613[_0xb1cb('0x2f')][_0xb1cb('0x1e')]);_0x20a99e[_0xb1cb('0x1c')]=qs['offset'](_0x107613[_0xb1cb('0x2f')][_0xb1cb('0x1c')]);}return _0x3ed677[_0xb1cb('0x50')](_0x20a99e);}})['then'](function(_0x47fdb1){if(_0x47fdb1){return _0x47fdb1?{'count':_0xdd6c90,'rows':_0x47fdb1}:null;}})['then'](respondWithResult(_0x40d061,null))['catch'](handleError(_0x40d061,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4586a77..7deef56 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 _0x3d7d=['define','SalesforceConfiguration','lodash','util','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x13b09e,_0x41bd34){var _0x548a3c=function(_0x17dca6){while(--_0x17dca6){_0x13b09e['push'](_0x13b09e['shift']());}};_0x548a3c(++_0x41bd34);}(_0x3d7d,0xf5));var _0xd3d7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3d7d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd3d7('0x0'));var util=require(_0xd3d7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd3d7('0x2'));var BPromise=require('bluebird');var rp=require(_0xd3d7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3d7('0x4'));var config=require(_0xd3d7('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd3d7('0x6')]=function(_0x428899,_0x5d386d){return _0x428899[_0xd3d7('0x7')](_0xd3d7('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68f6=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','lodash','util'];(function(_0x551360,_0x3f4dd8){var _0x4cea83=function(_0x50d26e){while(--_0x50d26e){_0x551360['push'](_0x551360['shift']());}};_0x4cea83(++_0x3f4dd8);}(_0x68f6,0x18a));var _0x668f=function(_0x366ac7,_0x3c3744){_0x366ac7=_0x366ac7-0x0;var _0x4fd0d0=_0x68f6[_0x366ac7];return _0x4fd0d0;};'use strict';var _=require(_0x668f('0x0'));var util=require(_0x668f('0x1'));var logger=require(_0x668f('0x2'))(_0x668f('0x3'));var moment=require(_0x668f('0x4'));var BPromise=require(_0x668f('0x5'));var rp=require(_0x668f('0x6'));var fs=require('fs');var path=require(_0x668f('0x7'));var rimraf=require('rimraf');var config=require(_0x668f('0x8'));var attributes=require(_0x668f('0x9'));module[_0x668f('0xa')]=function(_0x4db70f,_0x356ab8){return _0x4db70f[_0x668f('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 86d2d2c..7233a69 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 _0x3b86=['info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x5822fc,_0x3e505b){var _0x258475=function(_0x198ff4){while(--_0x198ff4){_0x5822fc['push'](_0x5822fc['shift']());}};_0x258475(++_0x3e505b);}(_0x3b86,0xd1));var _0x63b8=function(_0x5db569,_0x59ae7c){_0x5db569=_0x5db569-0x0;var _0x3c011b=_0x3b86[_0x5db569];return _0x3c011b;};'use strict';var _=require(_0x63b8('0x0'));var util=require(_0x63b8('0x1'));var moment=require('moment');var BPromise=require(_0x63b8('0x2'));var rs=require(_0x63b8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63b8('0x4'))['db'];var utils=require(_0x63b8('0x5'));var logger=require(_0x63b8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x63b8('0x7'));var client=jayson['client'][_0x63b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x401add,_0x5a0343,_0x13542d){return new BPromise(function(_0x37d52b,_0x1606c9){return client[_0x63b8('0x9')](_0x401add,_0x13542d)[_0x63b8('0xa')](function(_0x491b39){logger[_0x63b8('0xb')](_0x63b8('0xc'),_0x5a0343,'request\x20sent');logger[_0x63b8('0xd')](_0x63b8('0xe'),_0x5a0343,_0x63b8('0xf'),JSON['stringify'](_0x491b39));if(_0x491b39[_0x63b8('0x10')]){if(_0x491b39['error'][_0x63b8('0x11')]===0x1f4){logger[_0x63b8('0x10')](_0x63b8('0xc'),_0x5a0343,_0x491b39[_0x63b8('0x10')][_0x63b8('0x12')]);return _0x1606c9(_0x491b39['error'][_0x63b8('0x12')]);}logger[_0x63b8('0x10')](_0x63b8('0xc'),_0x5a0343,_0x491b39[_0x63b8('0x10')]['message']);return _0x37d52b(_0x491b39[_0x63b8('0x10')]['message']);}else{logger[_0x63b8('0xb')](_0x63b8('0xc'),_0x5a0343,_0x63b8('0xf'));_0x37d52b(_0x491b39[_0x63b8('0x13')][_0x63b8('0x12')]);}})['catch'](function(_0x35746e){logger[_0x63b8('0x10')](_0x63b8('0xc'),_0x5a0343,_0x35746e);_0x1606c9(_0x35746e);});});} \ No newline at end of file +var _0xcb3d=['randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','util','moment','bluebird'];(function(_0x55a4a5,_0x2cd7ab){var _0x57d590=function(_0x14b270){while(--_0x14b270){_0x55a4a5['push'](_0x55a4a5['shift']());}};_0x57d590(++_0x2cd7ab);}(_0xcb3d,0x1c5));var _0xdcb3=function(_0xc655ad,_0xf05e9b){_0xc655ad=_0xc655ad-0x0;var _0x293bd5=_0xcb3d[_0xc655ad];return _0x293bd5;};'use strict';var _=require('lodash');var util=require(_0xdcb3('0x0'));var moment=require(_0xdcb3('0x1'));var BPromise=require(_0xdcb3('0x2'));var rs=require(_0xdcb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdcb3('0x4'));var logger=require('../../config/logger')(_0xdcb3('0x5'));var config=require(_0xdcb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdcb3('0x7')][_0xdcb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30a80f,_0x32f1b4,_0x2dfa7a){return new BPromise(function(_0x4c555e,_0x471e00){return client[_0xdcb3('0x9')](_0x30a80f,_0x2dfa7a)[_0xdcb3('0xa')](function(_0x5729bd){logger['info'](_0xdcb3('0xb'),_0x32f1b4,_0xdcb3('0xc'));logger[_0xdcb3('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x32f1b4,'request\x20sent',JSON[_0xdcb3('0xe')](_0x5729bd));if(_0x5729bd[_0xdcb3('0xf')]){if(_0x5729bd[_0xdcb3('0xf')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x32f1b4,_0x5729bd[_0xdcb3('0xf')][_0xdcb3('0x10')]);return _0x471e00(_0x5729bd[_0xdcb3('0xf')]['message']);}logger[_0xdcb3('0xf')](_0xdcb3('0xb'),_0x32f1b4,_0x5729bd[_0xdcb3('0xf')][_0xdcb3('0x10')]);return _0x4c555e(_0x5729bd[_0xdcb3('0xf')][_0xdcb3('0x10')]);}else{logger[_0xdcb3('0x11')](_0xdcb3('0xb'),_0x32f1b4,_0xdcb3('0xc'));_0x4c555e(_0x5729bd['result'][_0xdcb3('0x10')]);}})[_0xdcb3('0x12')](function(_0x206add){logger['error'](_0xdcb3('0xb'),_0x32f1b4,_0x206add);_0x471e00(_0x206add);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8e861f3..74bca41 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 _0x3fc1=['../../config/environment','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x3fc1,0xac));var _0x13fc=function(_0x1c5aae,_0x3194ef){_0x1c5aae=_0x1c5aae-0x0;var _0xd67034=_0x3fc1[_0x1c5aae];return _0xd67034;};'use strict';var multer=require(_0x13fc('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13fc('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x13fc('0x2'));var interaction=require(_0x13fc('0x3'));var config=require(_0x13fc('0x4'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x13fc('0x5')]);router['get'](_0x13fc('0x6'),auth[_0x13fc('0x7')](),controller[_0x13fc('0x8')]);router[_0x13fc('0x9')]('/',auth[_0x13fc('0x7')](),controller[_0x13fc('0xa')]);router[_0x13fc('0xb')](_0x13fc('0x6'),auth[_0x13fc('0x7')](),controller[_0x13fc('0xc')]);router[_0x13fc('0xd')](_0x13fc('0x6'),auth[_0x13fc('0x7')](),controller[_0x13fc('0xe')]);module[_0x13fc('0xf')]=router; \ No newline at end of file +var _0x54ab=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x54ab,0xab));var _0xb54a=function(_0x1d094c,_0x168326){_0x1d094c=_0x1d094c-0x0;var _0x1e6250=_0x54ab[_0x1d094c];return _0x1e6250;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb54a('0x0'));var timeout=require(_0xb54a('0x1'));var express=require('express');var router=express[_0xb54a('0x2')]();var fs_extra=require(_0xb54a('0x3'));var auth=require(_0xb54a('0x4'));var interaction=require(_0xb54a('0x5'));var config=require(_0xb54a('0x6'));var controller=require(_0xb54a('0x7'));router[_0xb54a('0x8')]('/',auth[_0xb54a('0x9')](),controller[_0xb54a('0xa')]);router[_0xb54a('0x8')](_0xb54a('0xb'),auth[_0xb54a('0x9')](),controller[_0xb54a('0xc')]);router[_0xb54a('0xd')]('/',auth[_0xb54a('0x9')](),controller[_0xb54a('0xe')]);router['put'](_0xb54a('0xb'),auth[_0xb54a('0x9')](),controller[_0xb54a('0xf')]);router[_0xb54a('0x10')](_0xb54a('0xb'),auth[_0xb54a('0x9')](),controller[_0xb54a('0x11')]);module[_0xb54a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 85aa760..40f3f40 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 _0x666b=['ENUM','sequelize','exports','string','variable','customVariable','STRING'];(function(_0x219466,_0x487fd4){var _0x3195be=function(_0x244269){while(--_0x244269){_0x219466['push'](_0x219466['shift']());}};_0x3195be(++_0x487fd4);}(_0x666b,0x166));var _0xb666=function(_0x15744b,_0x215275){_0x15744b=_0x15744b-0x0;var _0x1fc14f=_0x666b[_0x15744b];return _0x1fc14f;};'use strict';var Sequelize=require(_0xb666('0x0'));module[_0xb666('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb666('0x2'),_0xb666('0x3'),_0xb666('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb666('0x5')]},'key':{'type':Sequelize[_0xb666('0x5')]},'keyType':{'type':Sequelize[_0xb666('0x6')](_0xb666('0x2'),'variable',_0xb666('0x4'))},'keyContent':{'type':Sequelize[_0xb666('0x5')]},'idField':{'type':Sequelize[_0xb666('0x5')]},'variableName':{'type':Sequelize[_0xb666('0x5')]}}; \ No newline at end of file +var _0x6a40=['STRING','customVariable','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x18cd36,_0x1d102f){var _0x1158b8=function(_0x3f280f){while(--_0x3f280f){_0x18cd36['push'](_0x18cd36['shift']());}};_0x1158b8(++_0x1d102f);}(_0x6a40,0xf2));var _0x06a4=function(_0x23dea0,_0x9c4c3d){_0x23dea0=_0x23dea0-0x0;var _0x457f66=_0x6a40[_0x23dea0];return _0x457f66;};'use strict';var Sequelize=require('sequelize');module[_0x06a4('0x0')]={'type':{'type':Sequelize[_0x06a4('0x1')]('string',_0x06a4('0x2'),'customVariable',_0x06a4('0x3'),_0x06a4('0x4')),'defaultValue':_0x06a4('0x5')},'content':{'type':Sequelize[_0x06a4('0x6')]},'key':{'type':Sequelize[_0x06a4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x06a4('0x5'),_0x06a4('0x2'),_0x06a4('0x7'))},'keyContent':{'type':Sequelize[_0x06a4('0x6')]},'idField':{'type':Sequelize[_0x06a4('0x6')]},'variableName':{'type':Sequelize[_0x06a4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 13dc776..b17ade5 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 _0x37f0=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','set','apply','reject','save','destroy','then','stack','name','send','map','SalesforceField','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','rawAttributes','include','find','create','body','catch','update','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x287c76,_0x415e8b){var _0x2aa953=function(_0x1e5bca){while(--_0x1e5bca){_0x287c76['push'](_0x287c76['shift']());}};_0x2aa953(++_0x415e8b);}(_0x37f0,0x118));var _0x037f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x37f0[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x037f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x037f('0x1'));var jsonpatch=require(_0x037f('0x2'));var rp=require(_0x037f('0x3'));var moment=require('moment');var BPromise=require(_0x037f('0x4'));var Mustache=require(_0x037f('0x5'));var util=require(_0x037f('0x6'));var path=require(_0x037f('0x7'));var sox=require(_0x037f('0x8'));var csv=require(_0x037f('0x9'));var ejs=require(_0x037f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x037f('0xb'));var squel=require('squel');var crypto=require(_0x037f('0xc'));var jsforce=require(_0x037f('0xd'));var deskjs=require(_0x037f('0xe'));var toCsv=require(_0x037f('0x9'));var querystring=require(_0x037f('0xf'));var Papa=require(_0x037f('0x10'));var Redis=require('ioredis');var authService=require(_0x037f('0x11'));var qs=require(_0x037f('0x12'));var as=require(_0x037f('0x13'));var hardwareService=require(_0x037f('0x14'));var logger=require(_0x037f('0x15'))(_0x037f('0x16'));var utils=require(_0x037f('0x17'));var config=require(_0x037f('0x18'));var licenseUtil=require(_0x037f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548974,_0x85c3f1){_0x85c3f1=_0x85c3f1||0xcc;return function(_0x1206b4){if(_0x1206b4){return _0x548974[_0x037f('0x1a')](_0x85c3f1);}return _0x548974['status'](_0x85c3f1)[_0x037f('0x1b')]();};}function respondWithResult(_0x5e28bd,_0x122790){_0x122790=_0x122790||0xc8;return function(_0xb8db48){if(_0xb8db48){return _0x5e28bd[_0x037f('0x1c')](_0x122790)[_0x037f('0x1d')](_0xb8db48);}};}function respondWithFilteredResult(_0x319041,_0x1be8bd){return function(_0x4dbb25){if(_0x4dbb25){var _0xf06617=typeof _0x1be8bd['offset']==='undefined'&&typeof _0x1be8bd[_0x037f('0x1e')]===_0x037f('0x1f');var _0x54648c=_0x4dbb25[_0x037f('0x20')];var _0x3947ce=_0xf06617?0x0:_0x1be8bd['offset'];var _0x3d29e4=_0xf06617?_0x4dbb25['count']:_0x1be8bd['offset']+_0x1be8bd[_0x037f('0x1e')];var _0x22537e;if(_0x3d29e4>=_0x54648c){_0x3d29e4=_0x54648c;_0x22537e=0xc8;}else{_0x22537e=0xce;}_0x319041[_0x037f('0x1c')](_0x22537e);return _0x319041[_0x037f('0x21')]('Content-Range',_0x3947ce+'-'+_0x3d29e4+'/'+_0x54648c)[_0x037f('0x1d')](_0x4dbb25);}return null;};}function patchUpdates(_0x2f157a){return function(_0x437738){try{jsonpatch[_0x037f('0x22')](_0x437738,_0x2f157a,!![]);}catch(_0x5f4974){return BPromise[_0x037f('0x23')](_0x5f4974);}return _0x437738[_0x037f('0x24')]();};}function saveUpdates(_0xd557fc,_0x59a05e){return function(_0x966a7){if(_0x966a7){return _0x966a7['update'](_0xd557fc)['then'](function(_0x2eda07){return _0x2eda07;});}return null;};}function removeEntity(_0x31151a,_0xe107e4){return function(_0x54890f){if(_0x54890f){return _0x54890f[_0x037f('0x25')]()[_0x037f('0x26')](function(){_0x31151a[_0x037f('0x1c')](0xcc)[_0x037f('0x1b')]();});}};}function handleEntityNotFound(_0x300074,_0x72053b){return function(_0x35de40){if(!_0x35de40){_0x300074[_0x037f('0x1a')](0x194);}return _0x35de40;};}function handleError(_0x457dc8,_0x3bd25d){_0x3bd25d=_0x3bd25d||0x1f4;return function(_0x2d973c){logger['error'](_0x2d973c[_0x037f('0x27')]);if(_0x2d973c[_0x037f('0x28')]){delete _0x2d973c['name'];}_0x457dc8[_0x037f('0x1c')](_0x3bd25d)[_0x037f('0x29')](_0x2d973c);};}exports['index']=function(_0x441f20,_0x5b8056){var _0x53830b={},_0x3588c4={},_0x2ec2ab={'count':0x0,'rows':[]};var _0x1f751b=_[_0x037f('0x2a')](db[_0x037f('0x2b')]['rawAttributes'],function(_0x31fa18){return{'name':_0x31fa18['fieldName'],'type':_0x31fa18[_0x037f('0x2c')][_0x037f('0x2d')]};});_0x3588c4[_0x037f('0x2e')]=_[_0x037f('0x2a')](_0x1f751b,_0x037f('0x28'));_0x3588c4[_0x037f('0x2f')]=_[_0x037f('0x30')](_0x441f20[_0x037f('0x2f')]);_0x3588c4[_0x037f('0x31')]=_['intersection'](_0x3588c4[_0x037f('0x2e')],_0x3588c4['query']);_0x53830b[_0x037f('0x32')]=_[_0x037f('0x33')](_0x3588c4[_0x037f('0x2e')],qs[_0x037f('0x34')](_0x441f20[_0x037f('0x2f')]['fields']));_0x53830b[_0x037f('0x32')]=_0x53830b[_0x037f('0x32')][_0x037f('0x35')]?_0x53830b[_0x037f('0x32')]:_0x3588c4[_0x037f('0x2e')];if(!_0x441f20['query']['hasOwnProperty'](_0x037f('0x36'))){_0x53830b[_0x037f('0x1e')]=qs[_0x037f('0x1e')](_0x441f20[_0x037f('0x2f')]['limit']);_0x53830b[_0x037f('0x37')]=qs[_0x037f('0x37')](_0x441f20[_0x037f('0x2f')]['offset']);}_0x53830b['order']=qs[_0x037f('0x38')](_0x441f20[_0x037f('0x2f')][_0x037f('0x38')]);_0x53830b[_0x037f('0x39')]=qs[_0x037f('0x31')](_[_0x037f('0x3a')](_0x441f20[_0x037f('0x2f')],_0x3588c4[_0x037f('0x31')]),_0x1f751b);if(_0x441f20[_0x037f('0x2f')][_0x037f('0x3b')]){_0x53830b[_0x037f('0x39')]=_[_0x037f('0x3c')](_0x53830b[_0x037f('0x39')],{'$or':_[_0x037f('0x2a')](_0x1f751b,function(_0xd2438c){if(_0xd2438c[_0x037f('0x2c')]!==_0x037f('0x3d')){var _0x3a036b={};_0x3a036b[_0xd2438c[_0x037f('0x28')]]={'$like':'%'+_0x441f20['query'][_0x037f('0x3b')]+'%'};return _0x3a036b;}})});}_0x53830b=_[_0x037f('0x3c')]({},_0x53830b,_0x441f20[_0x037f('0x3e')]);var _0x148695={'where':_0x53830b['where']};return db['SalesforceField']['count'](_0x148695)[_0x037f('0x26')](function(_0x3bf065){_0x2ec2ab[_0x037f('0x20')]=_0x3bf065;if(_0x441f20[_0x037f('0x2f')][_0x037f('0x3f')]){_0x53830b['include']=[{'all':!![]}];}return db[_0x037f('0x2b')][_0x037f('0x40')](_0x53830b);})[_0x037f('0x26')](function(_0x4bbbd0){_0x2ec2ab[_0x037f('0x41')]=_0x4bbbd0;return _0x2ec2ab;})[_0x037f('0x26')](respondWithFilteredResult(_0x5b8056,_0x53830b))['catch'](handleError(_0x5b8056,null));};exports['show']=function(_0x35f880,_0x178c94){var _0x238fc7={'raw':!![],'where':{'id':_0x35f880['params']['id']}},_0x4826cf={};_0x4826cf[_0x037f('0x2e')]=_[_0x037f('0x30')](db[_0x037f('0x2b')][_0x037f('0x42')]);_0x4826cf['query']=_[_0x037f('0x30')](_0x35f880['query']);_0x4826cf['filters']=_[_0x037f('0x33')](_0x4826cf[_0x037f('0x2e')],_0x4826cf[_0x037f('0x2f')]);_0x238fc7[_0x037f('0x32')]=_['intersection'](_0x4826cf[_0x037f('0x2e')],qs[_0x037f('0x34')](_0x35f880[_0x037f('0x2f')][_0x037f('0x34')]));_0x238fc7[_0x037f('0x32')]=_0x238fc7[_0x037f('0x32')][_0x037f('0x35')]?_0x238fc7[_0x037f('0x32')]:_0x4826cf[_0x037f('0x2e')];if(_0x35f880[_0x037f('0x2f')]['includeAll']){_0x238fc7[_0x037f('0x43')]=[{'all':!![]}];}_0x238fc7=_['merge']({},_0x238fc7,_0x35f880[_0x037f('0x3e')]);return db[_0x037f('0x2b')][_0x037f('0x44')](_0x238fc7)[_0x037f('0x26')](handleEntityNotFound(_0x178c94,null))['then'](respondWithResult(_0x178c94,null))['catch'](handleError(_0x178c94,null));};exports[_0x037f('0x45')]=function(_0x4d743d,_0x2c19cf){return db['SalesforceField']['create'](_0x4d743d[_0x037f('0x46')],{})[_0x037f('0x26')](respondWithResult(_0x2c19cf,0xc9))[_0x037f('0x47')](handleError(_0x2c19cf,null));};exports[_0x037f('0x48')]=function(_0x593f8e,_0x2fac05){if(_0x593f8e[_0x037f('0x46')]['id']){delete _0x593f8e[_0x037f('0x46')]['id'];}return db['SalesforceField'][_0x037f('0x44')]({'where':{'id':_0x593f8e['params']['id']}})[_0x037f('0x26')](handleEntityNotFound(_0x2fac05,null))[_0x037f('0x26')](saveUpdates(_0x593f8e[_0x037f('0x46')],null))[_0x037f('0x26')](respondWithResult(_0x2fac05,null))[_0x037f('0x47')](handleError(_0x2fac05,null));};exports[_0x037f('0x25')]=function(_0x9ebd31,_0x164b45){return db[_0x037f('0x2b')][_0x037f('0x44')]({'where':{'id':_0x9ebd31[_0x037f('0x49')]['id']}})[_0x037f('0x26')](handleEntityNotFound(_0x164b45,null))[_0x037f('0x26')](removeEntity(_0x164b45,null))[_0x037f('0x47')](handleError(_0x164b45,null));}; \ No newline at end of file +var _0xd04d=['create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','sendStatus','end','status','offset','limit','count','set','Content-Range','json','reject','update','then','destroy','error','name','send','SalesforceField','rawAttributes','type','key','model','map','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find'];(function(_0x1e3147,_0x58b414){var _0x3c6709=function(_0x2731af){while(--_0x2731af){_0x1e3147['push'](_0x1e3147['shift']());}};_0x3c6709(++_0x58b414);}(_0xd04d,0xda));var _0xdd04=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd04d[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xdd04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd04('0x1'));var jsonpatch=require(_0xdd04('0x2'));var rp=require('request-promise');var moment=require(_0xdd04('0x3'));var BPromise=require(_0xdd04('0x4'));var Mustache=require(_0xdd04('0x5'));var util=require(_0xdd04('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdd04('0x7'));var fs=require('fs');var fs_extra=require(_0xdd04('0x8'));var _=require('lodash');var squel=require(_0xdd04('0x9'));var crypto=require(_0xdd04('0xa'));var jsforce=require(_0xdd04('0xb'));var deskjs=require(_0xdd04('0xc'));var toCsv=require(_0xdd04('0xd'));var querystring=require(_0xdd04('0xe'));var Papa=require(_0xdd04('0xf'));var Redis=require(_0xdd04('0x10'));var authService=require(_0xdd04('0x11'));var qs=require(_0xdd04('0x12'));var as=require(_0xdd04('0x13'));var hardwareService=require(_0xdd04('0x14'));var logger=require(_0xdd04('0x15'))(_0xdd04('0x16'));var utils=require(_0xdd04('0x17'));var config=require(_0xdd04('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2204ce,_0x347cd4){_0x347cd4=_0x347cd4||0xcc;return function(_0x13ee35){if(_0x13ee35){return _0x2204ce[_0xdd04('0x19')](_0x347cd4);}return _0x2204ce['status'](_0x347cd4)[_0xdd04('0x1a')]();};}function respondWithResult(_0x59dbd5,_0x4ed5af){_0x4ed5af=_0x4ed5af||0xc8;return function(_0x5d8e49){if(_0x5d8e49){return _0x59dbd5[_0xdd04('0x1b')](_0x4ed5af)['json'](_0x5d8e49);}};}function respondWithFilteredResult(_0x1ce486,_0x57fde4){return function(_0x2202b8){if(_0x2202b8){var _0x1a3399=typeof _0x57fde4[_0xdd04('0x1c')]==='undefined'&&typeof _0x57fde4[_0xdd04('0x1d')]==='undefined';var _0x5d1a15=_0x2202b8[_0xdd04('0x1e')];var _0x150b75=_0x1a3399?0x0:_0x57fde4['offset'];var _0x3b2c9f=_0x1a3399?_0x2202b8['count']:_0x57fde4[_0xdd04('0x1c')]+_0x57fde4[_0xdd04('0x1d')];var _0x1f4645;if(_0x3b2c9f>=_0x5d1a15){_0x3b2c9f=_0x5d1a15;_0x1f4645=0xc8;}else{_0x1f4645=0xce;}_0x1ce486[_0xdd04('0x1b')](_0x1f4645);return _0x1ce486[_0xdd04('0x1f')](_0xdd04('0x20'),_0x150b75+'-'+_0x3b2c9f+'/'+_0x5d1a15)[_0xdd04('0x21')](_0x2202b8);}return null;};}function patchUpdates(_0x4f139c){return function(_0x7223ce){try{jsonpatch['apply'](_0x7223ce,_0x4f139c,!![]);}catch(_0x7e89a4){return BPromise[_0xdd04('0x22')](_0x7e89a4);}return _0x7223ce['save']();};}function saveUpdates(_0x40e344,_0x5d4741){return function(_0x2a3736){if(_0x2a3736){return _0x2a3736[_0xdd04('0x23')](_0x40e344)[_0xdd04('0x24')](function(_0x3d6dd8){return _0x3d6dd8;});}return null;};}function removeEntity(_0x5472b8,_0x57695e){return function(_0x128a2c){if(_0x128a2c){return _0x128a2c[_0xdd04('0x25')]()[_0xdd04('0x24')](function(){_0x5472b8[_0xdd04('0x1b')](0xcc)[_0xdd04('0x1a')]();});}};}function handleEntityNotFound(_0x3d14c7,_0x416511){return function(_0x5b4b97){if(!_0x5b4b97){_0x3d14c7[_0xdd04('0x19')](0x194);}return _0x5b4b97;};}function handleError(_0x36e5b6,_0x1132c9){_0x1132c9=_0x1132c9||0x1f4;return function(_0x194808){logger[_0xdd04('0x26')](_0x194808['stack']);if(_0x194808[_0xdd04('0x27')]){delete _0x194808[_0xdd04('0x27')];}_0x36e5b6[_0xdd04('0x1b')](_0x1132c9)[_0xdd04('0x28')](_0x194808);};}exports['index']=function(_0x37e665,_0x30fdd9){var _0x2fe3e2={},_0x106455={},_0x23d177={'count':0x0,'rows':[]};var _0x108d7d=_['map'](db[_0xdd04('0x29')][_0xdd04('0x2a')],function(_0x178683){return{'name':_0x178683['fieldName'],'type':_0x178683[_0xdd04('0x2b')][_0xdd04('0x2c')]};});_0x106455[_0xdd04('0x2d')]=_[_0xdd04('0x2e')](_0x108d7d,'name');_0x106455['query']=_['keys'](_0x37e665['query']);_0x106455[_0xdd04('0x2f')]=_[_0xdd04('0x30')](_0x106455['model'],_0x106455[_0xdd04('0x31')]);_0x2fe3e2['attributes']=_[_0xdd04('0x30')](_0x106455[_0xdd04('0x2d')],qs[_0xdd04('0x32')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x32')]));_0x2fe3e2[_0xdd04('0x33')]=_0x2fe3e2[_0xdd04('0x33')]['length']?_0x2fe3e2[_0xdd04('0x33')]:_0x106455['model'];if(!_0x37e665[_0xdd04('0x31')][_0xdd04('0x34')](_0xdd04('0x35'))){_0x2fe3e2[_0xdd04('0x1d')]=qs[_0xdd04('0x1d')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x1d')]);_0x2fe3e2[_0xdd04('0x1c')]=qs[_0xdd04('0x1c')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x1c')]);}_0x2fe3e2[_0xdd04('0x36')]=qs[_0xdd04('0x37')](_0x37e665[_0xdd04('0x31')][_0xdd04('0x37')]);_0x2fe3e2[_0xdd04('0x38')]=qs['filters'](_['pick'](_0x37e665[_0xdd04('0x31')],_0x106455[_0xdd04('0x2f')]),_0x108d7d);if(_0x37e665['query'][_0xdd04('0x39')]){_0x2fe3e2[_0xdd04('0x38')]=_[_0xdd04('0x3a')](_0x2fe3e2[_0xdd04('0x38')],{'$or':_[_0xdd04('0x2e')](_0x108d7d,function(_0x1efca9){if(_0x1efca9[_0xdd04('0x2b')]!=='VIRTUAL'){var _0xda961f={};_0xda961f[_0x1efca9[_0xdd04('0x27')]]={'$like':'%'+_0x37e665['query'][_0xdd04('0x39')]+'%'};return _0xda961f;}})});}_0x2fe3e2=_[_0xdd04('0x3a')]({},_0x2fe3e2,_0x37e665[_0xdd04('0x3b')]);var _0x6e4686={'where':_0x2fe3e2[_0xdd04('0x38')]};return db[_0xdd04('0x29')][_0xdd04('0x1e')](_0x6e4686)['then'](function(_0x17e587){_0x23d177[_0xdd04('0x1e')]=_0x17e587;if(_0x37e665[_0xdd04('0x31')][_0xdd04('0x3c')]){_0x2fe3e2[_0xdd04('0x3d')]=[{'all':!![]}];}return db[_0xdd04('0x29')][_0xdd04('0x3e')](_0x2fe3e2);})['then'](function(_0x3e01a9){_0x23d177[_0xdd04('0x3f')]=_0x3e01a9;return _0x23d177;})[_0xdd04('0x24')](respondWithFilteredResult(_0x30fdd9,_0x2fe3e2))[_0xdd04('0x40')](handleError(_0x30fdd9,null));};exports[_0xdd04('0x41')]=function(_0x3f0b5a,_0x23580b){var _0x27b1b2={'raw':!![],'where':{'id':_0x3f0b5a[_0xdd04('0x42')]['id']}},_0x4d4b7c={};_0x4d4b7c[_0xdd04('0x2d')]=_[_0xdd04('0x43')](db['SalesforceField']['rawAttributes']);_0x4d4b7c[_0xdd04('0x31')]=_['keys'](_0x3f0b5a[_0xdd04('0x31')]);_0x4d4b7c[_0xdd04('0x2f')]=_[_0xdd04('0x30')](_0x4d4b7c[_0xdd04('0x2d')],_0x4d4b7c[_0xdd04('0x31')]);_0x27b1b2[_0xdd04('0x33')]=_[_0xdd04('0x30')](_0x4d4b7c[_0xdd04('0x2d')],qs[_0xdd04('0x32')](_0x3f0b5a[_0xdd04('0x31')][_0xdd04('0x32')]));_0x27b1b2['attributes']=_0x27b1b2[_0xdd04('0x33')][_0xdd04('0x44')]?_0x27b1b2[_0xdd04('0x33')]:_0x4d4b7c[_0xdd04('0x2d')];if(_0x3f0b5a['query'][_0xdd04('0x3c')]){_0x27b1b2[_0xdd04('0x3d')]=[{'all':!![]}];}_0x27b1b2=_[_0xdd04('0x3a')]({},_0x27b1b2,_0x3f0b5a[_0xdd04('0x3b')]);return db[_0xdd04('0x29')][_0xdd04('0x45')](_0x27b1b2)[_0xdd04('0x24')](handleEntityNotFound(_0x23580b,null))[_0xdd04('0x24')](respondWithResult(_0x23580b,null))[_0xdd04('0x40')](handleError(_0x23580b,null));};exports[_0xdd04('0x46')]=function(_0x13550e,_0x56fd35){return db[_0xdd04('0x29')]['create'](_0x13550e[_0xdd04('0x47')],{})[_0xdd04('0x24')](respondWithResult(_0x56fd35,0xc9))[_0xdd04('0x40')](handleError(_0x56fd35,null));};exports[_0xdd04('0x23')]=function(_0x48cf0a,_0x4f741d){if(_0x48cf0a['body']['id']){delete _0x48cf0a[_0xdd04('0x47')]['id'];}return db[_0xdd04('0x29')][_0xdd04('0x45')]({'where':{'id':_0x48cf0a['params']['id']}})[_0xdd04('0x24')](handleEntityNotFound(_0x4f741d,null))[_0xdd04('0x24')](saveUpdates(_0x48cf0a['body'],null))['then'](respondWithResult(_0x4f741d,null))['catch'](handleError(_0x4f741d,null));};exports[_0xdd04('0x25')]=function(_0x29093e,_0x35bed4){return db[_0xdd04('0x29')][_0xdd04('0x45')]({'where':{'id':_0x29093e[_0xdd04('0x42')]['id']}})[_0xdd04('0x24')](handleEntityNotFound(_0x35bed4,null))['then'](removeEntity(_0x35bed4,null))[_0xdd04('0x40')](handleError(_0x35bed4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 46c6404..086a8ec 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 _0xfa4f=['./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x202c0b,_0x525517){var _0x2961b5=function(_0x5001c7){while(--_0x5001c7){_0x202c0b['push'](_0x202c0b['shift']());}};_0x2961b5(++_0x525517);}(_0xfa4f,0x18c));var _0xffa4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xfa4f[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xffa4('0x0'));var util=require(_0xffa4('0x1'));var logger=require(_0xffa4('0x2'))(_0xffa4('0x3'));var moment=require(_0xffa4('0x4'));var BPromise=require(_0xffa4('0x5'));var rp=require(_0xffa4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffa4('0x7'));var config=require(_0xffa4('0x8'));var attributes=require(_0xffa4('0x9'));module[_0xffa4('0xa')]=function(_0xf56bb4,_0xd948ec){return _0xf56bb4[_0xffa4('0xb')]('SalesforceField',attributes,{'tableName':_0xffa4('0xc'),'paranoid':![],'indexes':[{'name':_0xffa4('0xd'),'fields':[_0xffa4('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaca0=['rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xaca0,0x1c8));var _0x0aca=function(_0x5ca0bc,_0x27d70e){_0x5ca0bc=_0x5ca0bc-0x0;var _0x456d4f=_0xaca0[_0x5ca0bc];return _0x456d4f;};'use strict';var _=require(_0x0aca('0x0'));var util=require(_0x0aca('0x1'));var logger=require(_0x0aca('0x2'))(_0x0aca('0x3'));var moment=require(_0x0aca('0x4'));var BPromise=require('bluebird');var rp=require(_0x0aca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0aca('0x6'));var config=require(_0x0aca('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x0aca('0x8')]=function(_0x538402,_0x3e189a){return _0x538402[_0x0aca('0x9')](_0x0aca('0xa'),attributes,{'tableName':_0x0aca('0xb'),'paranoid':![],'indexes':[{'name':_0x0aca('0xc'),'fields':['idField',_0x0aca('0xd')],'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 b9ef349..0a918be 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 _0x4ebd=['rpc','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x377d42,_0x9e888){var _0x3676f2=function(_0x4c0275){while(--_0x4c0275){_0x377d42['push'](_0x377d42['shift']());}};_0x3676f2(++_0x9e888);}(_0x4ebd,0x1dc));var _0xd4eb=function(_0x58f9de,_0x532134){_0x58f9de=_0x58f9de-0x0;var _0x50768b=_0x4ebd[_0x58f9de];return _0x50768b;};'use strict';var _=require(_0xd4eb('0x0'));var util=require(_0xd4eb('0x1'));var moment=require(_0xd4eb('0x2'));var BPromise=require(_0xd4eb('0x3'));var rs=require(_0xd4eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4eb('0x6'))(_0xd4eb('0x7'));var config=require('../../config/environment');var jayson=require(_0xd4eb('0x8'));var client=jayson[_0xd4eb('0x9')][_0xd4eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211cdb,_0x165ac6,_0x5b4ef2){return new BPromise(function(_0x14cdcd,_0x1d46c0){return client[_0xd4eb('0xb')](_0x211cdb,_0x5b4ef2)[_0xd4eb('0xc')](function(_0x161d5f){logger[_0xd4eb('0xd')](_0xd4eb('0xe'),_0x165ac6,'request\x20sent');logger[_0xd4eb('0xf')](_0xd4eb('0x10'),_0x165ac6,_0xd4eb('0x11'),JSON['stringify'](_0x161d5f));if(_0x161d5f[_0xd4eb('0x12')]){if(_0x161d5f[_0xd4eb('0x12')][_0xd4eb('0x13')]===0x1f4){logger['error'](_0xd4eb('0xe'),_0x165ac6,_0x161d5f[_0xd4eb('0x12')]['message']);return _0x1d46c0(_0x161d5f['error'][_0xd4eb('0x14')]);}logger[_0xd4eb('0x12')](_0xd4eb('0xe'),_0x165ac6,_0x161d5f[_0xd4eb('0x12')][_0xd4eb('0x14')]);return _0x14cdcd(_0x161d5f['error']['message']);}else{logger['info'](_0xd4eb('0xe'),_0x165ac6,'request\x20sent');_0x14cdcd(_0x161d5f[_0xd4eb('0x15')][_0xd4eb('0x14')]);}})[_0xd4eb('0x16')](function(_0x4e2c23){logger[_0xd4eb('0x12')](_0xd4eb('0xe'),_0x165ac6,_0x4e2c23);_0x1d46c0(_0x4e2c23);});});} \ No newline at end of file +var _0x6050=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3439c7,_0x1af949){var _0x552961=function(_0x50c031){while(--_0x50c031){_0x3439c7['push'](_0x3439c7['shift']());}};_0x552961(++_0x1af949);}(_0x6050,0xbf));var _0x0605=function(_0xc87400,_0x27bb35){_0xc87400=_0xc87400-0x0;var _0x4ac9a4=_0x6050[_0xc87400];return _0x4ac9a4;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require('moment');var BPromise=require(_0x0605('0x2'));var rs=require(_0x0605('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0605('0x4'))['db'];var utils=require(_0x0605('0x5'));var logger=require(_0x0605('0x6'))(_0x0605('0x7'));var config=require(_0x0605('0x8'));var jayson=require(_0x0605('0x9'));var client=jayson[_0x0605('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ccf6e,_0x1ad980,_0x257a59){return new BPromise(function(_0xd706f8,_0x417182){return client[_0x0605('0xb')](_0x4ccf6e,_0x257a59)[_0x0605('0xc')](function(_0x2ce900){logger[_0x0605('0xd')]('SalesforceField,\x20%s,\x20%s',_0x1ad980,_0x0605('0xe'));logger[_0x0605('0xf')](_0x0605('0x10'),_0x1ad980,_0x0605('0xe'),JSON[_0x0605('0x11')](_0x2ce900));if(_0x2ce900[_0x0605('0x12')]){if(_0x2ce900[_0x0605('0x12')][_0x0605('0x13')]===0x1f4){logger[_0x0605('0x12')](_0x0605('0x14'),_0x1ad980,_0x2ce900[_0x0605('0x12')]['message']);return _0x417182(_0x2ce900['error']['message']);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x1ad980,_0x2ce900[_0x0605('0x12')][_0x0605('0x15')]);return _0xd706f8(_0x2ce900['error']['message']);}else{logger[_0x0605('0xd')](_0x0605('0x14'),_0x1ad980,'request\x20sent');_0xd706f8(_0x2ce900['result'][_0x0605('0x15')]);}})['catch'](function(_0x3e379c){logger[_0x0605('0x12')]('SalesforceField,\x20%s,\x20%s',_0x1ad980,_0x3e379c);_0x417182(_0x3e379c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 7453115..48ea744 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 _0x38a5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2e9007,_0x570f7c){var _0x3dab04=function(_0x2668c7){while(--_0x2668c7){_0x2e9007['push'](_0x2e9007['shift']());}};_0x3dab04(++_0x570f7c);}(_0x38a5,0x69));var _0x538a=function(_0x1bca30,_0x184918){_0x1bca30=_0x1bca30-0x0;var _0x54a8ec=_0x38a5[_0x1bca30];return _0x54a8ec;};'use strict';var multer=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var path=require(_0x538a('0x2'));var timeout=require(_0x538a('0x3'));var express=require('express');var router=express[_0x538a('0x4')]();var fs_extra=require(_0x538a('0x5'));var auth=require(_0x538a('0x6'));var interaction=require(_0x538a('0x7'));var config=require(_0x538a('0x8'));var controller=require(_0x538a('0x9'));router[_0x538a('0xa')]('/',auth[_0x538a('0xb')](),controller[_0x538a('0xc')]);router[_0x538a('0xa')](_0x538a('0xd'),auth[_0x538a('0xb')](),controller[_0x538a('0xe')]);router['get']('/:id/configurations',auth[_0x538a('0xb')](),controller[_0x538a('0xf')]);router[_0x538a('0xa')]('/:id/fields',auth[_0x538a('0xb')](),controller[_0x538a('0x10')]);router[_0x538a('0x11')]('/',auth[_0x538a('0xb')](),controller[_0x538a('0x12')]);router[_0x538a('0x11')](_0x538a('0x13'),auth[_0x538a('0xb')](),controller['addConfiguration']);router['put'](_0x538a('0xd'),auth[_0x538a('0xb')](),controller['update']);router['delete'](_0x538a('0xd'),auth[_0x538a('0xb')](),controller[_0x538a('0x14')]);module[_0x538a('0x15')]=router; \ No newline at end of file +var _0x8728=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put'];(function(_0x32272e,_0xe0ca7b){var _0x4005dd=function(_0x2bd382){while(--_0x2bd382){_0x32272e['push'](_0x32272e['shift']());}};_0x4005dd(++_0xe0ca7b);}(_0x8728,0x14a));var _0x8872=function(_0x2a7272,_0x4d794c){_0x2a7272=_0x2a7272-0x0;var _0x13d9c6=_0x8728[_0x2a7272];return _0x13d9c6;};'use strict';var multer=require(_0x8872('0x0'));var util=require(_0x8872('0x1'));var path=require('path');var timeout=require(_0x8872('0x2'));var express=require('express');var router=express[_0x8872('0x3')]();var fs_extra=require(_0x8872('0x4'));var auth=require(_0x8872('0x5'));var interaction=require(_0x8872('0x6'));var config=require(_0x8872('0x7'));var controller=require(_0x8872('0x8'));router[_0x8872('0x9')]('/',auth[_0x8872('0xa')](),controller[_0x8872('0xb')]);router[_0x8872('0x9')]('/:id',auth[_0x8872('0xa')](),controller[_0x8872('0xc')]);router[_0x8872('0x9')]('/:id/configurations',auth[_0x8872('0xa')](),controller[_0x8872('0xd')]);router[_0x8872('0x9')](_0x8872('0xe'),auth[_0x8872('0xa')](),controller[_0x8872('0xf')]);router[_0x8872('0x10')]('/',auth[_0x8872('0xa')](),controller['create']);router[_0x8872('0x10')](_0x8872('0x11'),auth[_0x8872('0xa')](),controller[_0x8872('0x12')]);router[_0x8872('0x13')]('/:id',auth[_0x8872('0xa')](),controller[_0x8872('0x14')]);router[_0x8872('0x15')](_0x8872('0x16'),auth[_0x8872('0xa')](),controller[_0x8872('0x17')]);module[_0x8872('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index fffcf73..5a55a6e 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 _0x5cff=['STRING','remoteUri','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cff,0x107));var _0xf5cf=function(_0xab766d,_0x607780){_0xab766d=_0xab766d-0x0;var _0x1b57fd=_0x5cff[_0xab766d];return _0x1b57fd;};'use strict';var Sequelize=require('sequelize');module[_0xf5cf('0x0')]={'name':{'type':Sequelize[_0xf5cf('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf5cf('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xf5cf('0x1')]},'email':{'type':Sequelize[_0xf5cf('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf5cf('0x2')},'serverUrl':{'type':Sequelize[_0xf5cf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3867=['sequelize','STRING','remoteUri'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3867,0x198));var _0x7386=function(_0x2ca840,_0x9f3c7){_0x2ca840=_0x2ca840-0x0;var _0x181773=_0x3867[_0x2ca840];return _0x181773;};'use strict';var Sequelize=require(_0x7386('0x0'));module['exports']={'name':{'type':Sequelize[_0x7386('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7386('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x7386('0x1')]},'email':{'type':Sequelize[_0x7386('0x1')]},'remoteUri':{'type':Sequelize[_0x7386('0x1')],'unique':_0x7386('0x2')},'serverUrl':{'type':Sequelize[_0x7386('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 38d0b32..dd5bcbe 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 _0xb602=['find','catch','findOne','ServicenowConfiguration','getConfigurations','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','priority','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','contact_type','reopened_by','company','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','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','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','rows','show','params','includeAll','include','create','body','update'];(function(_0x772b8a,_0x441753){var _0x1aead4=function(_0x4e9de0){while(--_0x4e9de0){_0x772b8a['push'](_0x772b8a['shift']());}};_0x1aead4(++_0x441753);}(_0xb602,0x122));var _0x2b60=function(_0x2d8e23,_0x137866){_0x2d8e23=_0x2d8e23-0x0;var _0x1eb51a=_0xb602[_0x2d8e23];return _0x1eb51a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b60('0x0'));var BPromise=require(_0x2b60('0x1'));var Mustache=require(_0x2b60('0x2'));var util=require(_0x2b60('0x3'));var path=require(_0x2b60('0x4'));var sox=require(_0x2b60('0x5'));var csv=require('to-csv');var ejs=require(_0x2b60('0x6'));var fs=require('fs');var fs_extra=require(_0x2b60('0x7'));var _=require('lodash');var squel=require(_0x2b60('0x8'));var crypto=require('crypto');var jsforce=require(_0x2b60('0x9'));var deskjs=require(_0x2b60('0xa'));var toCsv=require(_0x2b60('0xb'));var querystring=require(_0x2b60('0xc'));var Papa=require(_0x2b60('0xd'));var Redis=require(_0x2b60('0xe'));var authService=require(_0x2b60('0xf'));var qs=require(_0x2b60('0x10'));var as=require(_0x2b60('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b60('0x12'))('api');var utils=require(_0x2b60('0x13'));var config=require(_0x2b60('0x14'));var licenseUtil=require(_0x2b60('0x15'));var db=require(_0x2b60('0x16'))['db'];var integrations=require(_0x2b60('0x17'));function respondWithStatusCode(_0x5693c9,_0x11cf9f){_0x11cf9f=_0x11cf9f||0xcc;return function(_0x3e7509){if(_0x3e7509){return _0x5693c9[_0x2b60('0x18')](_0x11cf9f);}return _0x5693c9[_0x2b60('0x19')](_0x11cf9f)[_0x2b60('0x1a')]();};}function respondWithResult(_0x1fefae,_0x2576e6){_0x2576e6=_0x2576e6||0xc8;return function(_0x1f82f2){if(_0x1f82f2){return _0x1fefae[_0x2b60('0x19')](_0x2576e6)[_0x2b60('0x1b')](_0x1f82f2);}};}function respondWithFilteredResult(_0x2d94bb,_0x589503){return function(_0x58f315){if(_0x58f315){var _0x4389dc=typeof _0x589503['offset']==='undefined'&&typeof _0x589503[_0x2b60('0x1c')]===_0x2b60('0x1d');var _0x5be1a5=_0x58f315['count'];var _0x1415ed=_0x4389dc?0x0:_0x589503['offset'];var _0x4c0d3c=_0x4389dc?_0x58f315[_0x2b60('0x1e')]:_0x589503[_0x2b60('0x1f')]+_0x589503[_0x2b60('0x1c')];var _0x3f341d;if(_0x4c0d3c>=_0x5be1a5){_0x4c0d3c=_0x5be1a5;_0x3f341d=0xc8;}else{_0x3f341d=0xce;}_0x2d94bb[_0x2b60('0x19')](_0x3f341d);return _0x2d94bb[_0x2b60('0x20')](_0x2b60('0x21'),_0x1415ed+'-'+_0x4c0d3c+'/'+_0x5be1a5)['json'](_0x58f315);}return null;};}function patchUpdates(_0x14032b){return function(_0x34acb6){try{jsonpatch[_0x2b60('0x22')](_0x34acb6,_0x14032b,!![]);}catch(_0x524def){return BPromise[_0x2b60('0x23')](_0x524def);}return _0x34acb6['save']();};}function saveUpdates(_0x4189fb,_0xf29c72){return function(_0x95b6d1){if(_0x95b6d1){return _0x95b6d1['update'](_0x4189fb)[_0x2b60('0x24')](function(_0x269724){return _0x269724;});}return null;};}function removeEntity(_0x3d18c7,_0x17c1db){return function(_0x590859){if(_0x590859){return _0x590859[_0x2b60('0x25')]()[_0x2b60('0x24')](function(){_0x3d18c7['status'](0xcc)[_0x2b60('0x1a')]();});}};}function handleEntityNotFound(_0x30e738,_0x11a3c1){return function(_0x210eb6){if(!_0x210eb6){_0x30e738[_0x2b60('0x18')](0x194);}return _0x210eb6;};}function handleError(_0x12174f,_0x36bcab){_0x36bcab=_0x36bcab||0x1f4;return function(_0x134c85){logger[_0x2b60('0x26')](_0x134c85[_0x2b60('0x27')]);if(_0x134c85[_0x2b60('0x28')]){delete _0x134c85['name'];}_0x12174f[_0x2b60('0x19')](_0x36bcab)[_0x2b60('0x29')](_0x134c85);};}exports['index']=function(_0x2f0b85,_0x360116){var _0x4b995c={},_0x57963f={},_0x5a60ce={'count':0x0,'rows':[]};var _0x56ab32=_[_0x2b60('0x2a')](db[_0x2b60('0x2b')][_0x2b60('0x2c')],function(_0x5e7a0f){return{'name':_0x5e7a0f[_0x2b60('0x2d')],'type':_0x5e7a0f[_0x2b60('0x2e')][_0x2b60('0x2f')]};});_0x57963f[_0x2b60('0x30')]=_[_0x2b60('0x2a')](_0x56ab32,_0x2b60('0x28'));_0x57963f[_0x2b60('0x31')]=_[_0x2b60('0x32')](_0x2f0b85[_0x2b60('0x31')]);_0x57963f['filters']=_[_0x2b60('0x33')](_0x57963f[_0x2b60('0x30')],_0x57963f['query']);_0x4b995c[_0x2b60('0x34')]=_[_0x2b60('0x33')](_0x57963f[_0x2b60('0x30')],qs[_0x2b60('0x35')](_0x2f0b85['query'][_0x2b60('0x35')]));_0x4b995c[_0x2b60('0x34')]=_0x4b995c['attributes'][_0x2b60('0x36')]?_0x4b995c['attributes']:_0x57963f[_0x2b60('0x30')];if(!_0x2f0b85[_0x2b60('0x31')][_0x2b60('0x37')](_0x2b60('0x38'))){_0x4b995c[_0x2b60('0x1c')]=qs[_0x2b60('0x1c')](_0x2f0b85[_0x2b60('0x31')][_0x2b60('0x1c')]);_0x4b995c[_0x2b60('0x1f')]=qs[_0x2b60('0x1f')](_0x2f0b85[_0x2b60('0x31')]['offset']);}_0x4b995c[_0x2b60('0x39')]=qs[_0x2b60('0x3a')](_0x2f0b85[_0x2b60('0x31')]['sort']);_0x4b995c[_0x2b60('0x3b')]=qs[_0x2b60('0x3c')](_[_0x2b60('0x3d')](_0x2f0b85['query'],_0x57963f[_0x2b60('0x3c')]),_0x56ab32);if(_0x2f0b85['query']['filter']){_0x4b995c[_0x2b60('0x3b')]=_[_0x2b60('0x3e')](_0x4b995c['where'],{'$or':_[_0x2b60('0x2a')](_0x56ab32,function(_0x347418){if(_0x347418['type']!==_0x2b60('0x3f')){var _0x2c593b={};_0x2c593b[_0x347418[_0x2b60('0x28')]]={'$like':'%'+_0x2f0b85['query'][_0x2b60('0x40')]+'%'};return _0x2c593b;}})});}_0x4b995c=_[_0x2b60('0x3e')]({},_0x4b995c,_0x2f0b85[_0x2b60('0x41')]);var _0x391356={'where':_0x4b995c[_0x2b60('0x3b')]};return db['ServicenowAccount']['count'](_0x391356)['then'](function(_0x5c8056){_0x5a60ce[_0x2b60('0x1e')]=_0x5c8056;if(_0x2f0b85[_0x2b60('0x31')]['includeAll']){_0x4b995c['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x4b995c);})[_0x2b60('0x24')](function(_0x362cc1){_0x5a60ce[_0x2b60('0x42')]=_0x362cc1;return _0x5a60ce;})[_0x2b60('0x24')](respondWithFilteredResult(_0x360116,_0x4b995c))['catch'](handleError(_0x360116,null));};exports[_0x2b60('0x43')]=function(_0x40ff61,_0x1a5d93){var _0x80b1a={'raw':![],'where':{'id':_0x40ff61[_0x2b60('0x44')]['id']}},_0x21ab2d={};_0x21ab2d[_0x2b60('0x30')]=_[_0x2b60('0x32')](db[_0x2b60('0x2b')]['rawAttributes']);_0x21ab2d[_0x2b60('0x31')]=_[_0x2b60('0x32')](_0x40ff61[_0x2b60('0x31')]);_0x21ab2d['filters']=_[_0x2b60('0x33')](_0x21ab2d[_0x2b60('0x30')],_0x21ab2d['query']);_0x80b1a[_0x2b60('0x34')]=_['intersection'](_0x21ab2d[_0x2b60('0x30')],qs['fields'](_0x40ff61[_0x2b60('0x31')][_0x2b60('0x35')]));_0x80b1a[_0x2b60('0x34')]=_0x80b1a[_0x2b60('0x34')][_0x2b60('0x36')]?_0x80b1a[_0x2b60('0x34')]:_0x21ab2d[_0x2b60('0x30')];if(_0x40ff61[_0x2b60('0x31')][_0x2b60('0x45')]){_0x80b1a[_0x2b60('0x46')]=[{'all':!![]}];}_0x80b1a=_[_0x2b60('0x3e')]({},_0x80b1a,_0x40ff61[_0x2b60('0x41')]);return db[_0x2b60('0x2b')]['find'](_0x80b1a)[_0x2b60('0x24')](handleEntityNotFound(_0x1a5d93,null))['then'](respondWithResult(_0x1a5d93,null))['catch'](handleError(_0x1a5d93,null));};exports[_0x2b60('0x47')]=function(_0x10b242,_0x5067b1){return db['ServicenowAccount']['create'](_0x10b242[_0x2b60('0x48')],{})[_0x2b60('0x24')](respondWithResult(_0x5067b1,0xc9))['catch'](handleError(_0x5067b1,null));};exports[_0x2b60('0x49')]=function(_0x317dad,_0x226953){if(_0x317dad[_0x2b60('0x48')]['id']){delete _0x317dad['body']['id'];}return db[_0x2b60('0x2b')][_0x2b60('0x4a')]({'where':{'id':_0x317dad[_0x2b60('0x44')]['id']}})[_0x2b60('0x24')](handleEntityNotFound(_0x226953,null))[_0x2b60('0x24')](saveUpdates(_0x317dad[_0x2b60('0x48')],null))[_0x2b60('0x24')](respondWithResult(_0x226953,null))[_0x2b60('0x4b')](handleError(_0x226953,null));};exports['destroy']=function(_0x1228ff,_0x17ba70){return db[_0x2b60('0x2b')][_0x2b60('0x4a')]({'where':{'id':_0x1228ff[_0x2b60('0x44')]['id']}})['then'](handleEntityNotFound(_0x17ba70,null))[_0x2b60('0x24')](removeEntity(_0x17ba70,null))[_0x2b60('0x4b')](handleError(_0x17ba70,null));};exports['getConfigurations']=function(_0x5ee043,_0x4b9bb0,_0x254f59){var _0x5174da={};var _0x976d48={};var _0x40ac22;var _0x5e6c56;return db[_0x2b60('0x2b')][_0x2b60('0x4c')]({'where':{'id':_0x5ee043['params']['id']}})['then'](handleEntityNotFound(_0x4b9bb0,null))['then'](function(_0x24f79f){if(_0x24f79f){_0x40ac22=_0x24f79f;_0x976d48['model']=_[_0x2b60('0x32')](db[_0x2b60('0x4d')][_0x2b60('0x2c')]);_0x976d48[_0x2b60('0x31')]=_[_0x2b60('0x32')](_0x5ee043[_0x2b60('0x31')]);_0x976d48[_0x2b60('0x3c')]=_[_0x2b60('0x33')](_0x976d48[_0x2b60('0x30')],_0x976d48[_0x2b60('0x31')]);_0x5174da[_0x2b60('0x34')]=_['intersection'](_0x976d48[_0x2b60('0x30')],qs[_0x2b60('0x35')](_0x5ee043[_0x2b60('0x31')][_0x2b60('0x35')]));_0x5174da[_0x2b60('0x34')]=_0x5174da['attributes'][_0x2b60('0x36')]?_0x5174da[_0x2b60('0x34')]:_0x976d48['model'];_0x5174da[_0x2b60('0x39')]=qs[_0x2b60('0x3a')](_0x5ee043[_0x2b60('0x31')][_0x2b60('0x3a')]);_0x5174da[_0x2b60('0x3b')]=qs['filters'](_[_0x2b60('0x3d')](_0x5ee043[_0x2b60('0x31')],_0x976d48[_0x2b60('0x3c')]));if(_0x5ee043[_0x2b60('0x31')][_0x2b60('0x40')]){_0x5174da['where']=_['merge'](_0x5174da['where'],{'$or':_[_0x2b60('0x2a')](_0x5174da[_0x2b60('0x34')],function(_0x528659){var _0x564b0f={};_0x564b0f[_0x528659]={'$like':'%'+_0x5ee043['query']['filter']+'%'};return _0x564b0f;})});}_0x5174da=_['merge']({},_0x5174da,_0x5ee043[_0x2b60('0x41')]);return _0x40ac22[_0x2b60('0x4e')](_0x5174da);}})[_0x2b60('0x24')](function(_0x55980f){if(_0x55980f){_0x5e6c56=_0x55980f[_0x2b60('0x36')];if(!_0x5ee043['query'][_0x2b60('0x37')](_0x2b60('0x38'))){_0x5174da[_0x2b60('0x1c')]=qs[_0x2b60('0x1c')](_0x5ee043[_0x2b60('0x31')]['limit']);_0x5174da[_0x2b60('0x1f')]=qs[_0x2b60('0x1f')](_0x5ee043['query']['offset']);}return _0x40ac22[_0x2b60('0x4e')](_0x5174da);}})[_0x2b60('0x24')](function(_0x28a3ab){if(_0x28a3ab){return _0x28a3ab?{'count':_0x5e6c56,'rows':_0x28a3ab}:null;}})[_0x2b60('0x24')](respondWithResult(_0x4b9bb0,null))[_0x2b60('0x4b')](handleError(_0x4b9bb0,null));};exports['addConfiguration']=function(_0x48c910,_0x51a9b4,_0x465d60){if(_0x48c910[_0x2b60('0x48')]['id']){delete _0x48c910['body']['id'];}return db[_0x2b60('0x2b')][_0x2b60('0x4c')]({'where':{'id':_0x48c910['params']['id']}})[_0x2b60('0x24')](handleEntityNotFound(_0x51a9b4,null))[_0x2b60('0x24')](function(_0x1536a2){if(_0x1536a2){_0x48c910[_0x2b60('0x48')]['AccountId']=_0x1536a2['id'];_0x48c910[_0x2b60('0x48')]['Subjects']=integrations['getSubjects'](_0x48c910[_0x2b60('0x48')][_0x2b60('0x4f')],_0x48c910[_0x2b60('0x48')][_0x2b60('0x2e')]);_0x48c910['body'][_0x2b60('0x50')]=integrations[_0x2b60('0x51')](_0x48c910['body']['channel'],_0x48c910[_0x2b60('0x48')][_0x2b60('0x2e')]);return db[_0x2b60('0x4d')]['create'](_0x48c910[_0x2b60('0x48')],{'include':[{'model':db[_0x2b60('0x52')],'as':_0x2b60('0x53')},{'model':db[_0x2b60('0x52')],'as':_0x2b60('0x50')}]});}return null;})[_0x2b60('0x24')](respondWithResult(_0x51a9b4,null))['catch'](handleError(_0x51a9b4,null));};exports[_0x2b60('0x54')]=function(_0x10cf9d,_0x36573b,_0x4ecfc7){var _0x5a43c7=[_0x2b60('0x55'),_0x2b60('0x56'),_0x2b60('0x57'),_0x2b60('0x58'),'close_code',_0x2b60('0x59'),_0x2b60('0x5a'),'severity',_0x2b60('0x5b')];var _0x298913=[_0x2b60('0x5c'),_0x2b60('0x55'),_0x2b60('0x5d'),_0x2b60('0x5e'),_0x2b60('0x5f'),_0x2b60('0x60'),'child_incidents',_0x2b60('0x56'),_0x2b60('0x61'),_0x2b60('0x62'),_0x2b60('0x63'),'sys_updated_by',_0x2b60('0x64'),_0x2b60('0x65'),_0x2b60('0x66'),_0x2b60('0x67'),_0x2b60('0x68'),_0x2b60('0x69'),_0x2b60('0x57'),_0x2b60('0x39'),'calendar_stc',_0x2b60('0x6a'),_0x2b60('0x6b'),_0x2b60('0x6c'),_0x2b60('0x6d'),_0x2b60('0x6e'),'work_notes_list','business_service',_0x2b60('0x6f'),'sys_domain_path','rfc',_0x2b60('0x70'),_0x2b60('0x71'),'opened_at',_0x2b60('0x72'),_0x2b60('0x73'),_0x2b60('0x74'),_0x2b60('0x75'),_0x2b60('0x76'),_0x2b60('0x77'),_0x2b60('0x78'),_0x2b60('0x58'),_0x2b60('0x79'),'short_description',_0x2b60('0x7a'),_0x2b60('0x7b'),_0x2b60('0x7c'),_0x2b60('0x7d'),_0x2b60('0x7e'),_0x2b60('0x7f'),_0x2b60('0x80'),_0x2b60('0x81'),_0x2b60('0x82'),_0x2b60('0x59'),_0x2b60('0x83'),_0x2b60('0x84'),_0x2b60('0x85'),_0x2b60('0x86'),'parent_incident','sys_id',_0x2b60('0x87'),_0x2b60('0x88'),_0x2b60('0x5a'),'urgency','problem_id',_0x2b60('0x89'),'reassignment_count',_0x2b60('0x8a'),_0x2b60('0x8b'),_0x2b60('0x8c'),_0x2b60('0x8d'),_0x2b60('0x8e'),_0x2b60('0x8f'),_0x2b60('0x90'),_0x2b60('0x91'),_0x2b60('0x92'),_0x2b60('0x93'),'sys_tags',_0x2b60('0x94'),_0x2b60('0x95'),_0x2b60('0x96'),'location',_0x2b60('0x5b')];var _0x47af10='';var _0x553e76='';var _0x96e10d=[];var _0x8dfc4d='';var _0x1532e1='';var _0x576a21=[];var _0x457350='';var _0x193cb2='';var _0x114c4c={};var _0x596a25='';return db[_0x2b60('0x2b')][_0x2b60('0x4c')]({'where':{'id':_0x10cf9d['params']['id']},'attributes':['id',_0x2b60('0x97'),'password','email',_0x2b60('0x98'),_0x2b60('0x99')]})['then'](handleEntityNotFound(_0x36573b,null))['then'](function(_0x5efb07){if(_0x5efb07){_0x596a25=_0x5efb07[_0x2b60('0x98')];var _0x14bb25=_0x596a25[_0x2b60('0x9a')](-0x1);if(_0x14bb25==='/'){_0x596a25=_0x596a25[_0x2b60('0x9b')](0x0,_0x596a25[_0x2b60('0x9c')](_0x14bb25));}_0x193cb2=util[_0x2b60('0x9d')](_0x2b60('0x9e'),_0x596a25);_0x457350=util[_0x2b60('0x9d')]('%s/api/now/table/',_0x596a25);_0x114c4c={'user':_0x5efb07[_0x2b60('0x97')],'pass':_0x5efb07[_0x2b60('0x9f')]};var _0x534d20={'method':_0x2b60('0xa0'),'uri':_0x193cb2+_0x2b60('0xa1'),'auth':_0x114c4c,'json':!![]};return rp(_0x534d20);}})[_0x2b60('0x24')](function(_0x37a51b){if(_0x37a51b['result'][_0x2b60('0x36')]>0x0){_0x47af10=_0x37a51b[_0x2b60('0xa2')];}console['log'](_0x2b60('0xa3'),_0x47af10);_0x576a21=[];_0x553e76=Object[_0x2b60('0xa4')]([],_0x47af10);_[_0x2b60('0xa5')](_0x553e76,function(_0x384445){return!_0x5a43c7[_0x2b60('0xa6')](_0x384445[_0x2b60('0x28')]);});_0x553e76[_0x2b60('0xa7')](function(_0x47b0b1){var _0x4d22f7=createFieldObject(_0x457350,_0x114c4c,_0x47b0b1[_0x2b60('0xa8')],_0x47b0b1[_0x2b60('0x28')],_0x47b0b1[_0x2b60('0xa9')],![]);_0x576a21[_0x2b60('0xaa')](_0x4d22f7);});return Promise[_0x2b60('0xab')](_0x576a21);})[_0x2b60('0x24')](function(_0x4e3a9a){_0x96e10d=_0x4e3a9a;_0x8dfc4d=Object[_0x2b60('0xa4')]([],_0x47af10);console[_0x2b60('0xac')](_0x2b60('0xad'),_0x47af10);_['remove'](_0x8dfc4d,function(_0x277292){return _0x298913['includes'](_0x277292[_0x2b60('0x28')]);});console[_0x2b60('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x8dfc4d);_0x576a21=[];_0x8dfc4d[_0x2b60('0xa7')](function(_0x36f428){var _0x529871=createFieldObject(_0x457350,_0x114c4c,_0x36f428[_0x2b60('0xa8')],_0x36f428[_0x2b60('0x28')],_0x36f428[_0x2b60('0xa9')],!![]);_0x576a21[_0x2b60('0xaa')](_0x529871);});return Promise['all'](_0x576a21);})[_0x2b60('0x24')](function(_0xca0fbc){_0x1532e1=_0xca0fbc;var _0x4bfcc4=_0x96e10d['concat'](_0x1532e1);return{'count':_0x4bfcc4[_0x2b60('0x36')],'rows':_0x4bfcc4};})['then'](respondWithResult(_0x36573b,null))[_0x2b60('0x4b')](function(_0x48a55a){console['log'](_0x2b60('0xae')+_0x48a55a);var _0x44eb0c=_0x10cf9d[_0x2b60('0x31')][_0x2b60('0xaf')]?0x1f4:_0x48a55a['statusCode']||0x1f4;logger[_0x2b60('0x26')](_0x48a55a['stack']);delete _0x48a55a[_0x2b60('0x28')];if(_0x44eb0c===0x191){_0x44eb0c=0x190;}_0x36573b[_0x2b60('0x19')](_0x44eb0c)['send'](_0x10cf9d[_0x2b60('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x48a55a[_0x2b60('0xb0')]}:_0x48a55a);});};function createFieldObject(_0x3f127f,_0x1535fa,_0x350739,_0x56adb1,_0x5ab33b,_0x5e6d9b){return new Promise(function(_0x32cf3a,_0x20e8b9){var _0x206760={'id':_0x56adb1,'name':_0x5ab33b,'custom':_0x5e6d9b};if(_0x350739==='boolean'){_0x206760['options']=[{'name':'True','value':_0x2b60('0xb1')},{'name':_0x2b60('0xb2'),'value':'false'}];_0x32cf3a(_0x206760);}else{var _0x8eeaf9={'method':'GET','uri':_0x3f127f+_0x2b60('0xb3')+_0x56adb1,'auth':_0x1535fa,'json':!![]};return rp(_0x8eeaf9)[_0x2b60('0x24')](function(_0x4c2e0b){var _0x48a095=[];if(_0x4c2e0b['result'][_0x2b60('0x36')]>0x0){_0x4c2e0b[_0x2b60('0xa2')][_0x2b60('0xa7')](function(_0xdadb66){if(_0xdadb66[_0x2b60('0xb4')]==='false'){var _0x1526f6={'name':_0xdadb66['label'],'value':_0xdadb66[_0x2b60('0xb5')]};_0x48a095['push'](_0x1526f6);}});}_0x206760[_0x2b60('0x41')]=_0x48a095;if(_0x206760[_0x2b60('0x41')][_0x2b60('0x36')]>0x0){_0x32cf3a(_0x206760);}else{if(_0x5e6d9b==![]){_0x32cf3a();}else{_0x32cf3a(_0x206760);}}});}});} \ No newline at end of file +var _0x13f2=['incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','parent_incident','contact_type','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','slice','substring','%s/api/now/doc/table/schema/','username','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','forEach','internalType','label','push','all','log','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify'];(function(_0x2ab3e4,_0x113a6d){var _0x10d163=function(_0x3cd648){while(--_0x3cd648){_0x2ab3e4['push'](_0x2ab3e4['shift']());}};_0x10d163(++_0x113a6d);}(_0x13f2,0x1dd));var _0x213f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13f2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x213f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x213f('0x1'));var rp=require('request-promise');var moment=require(_0x213f('0x2'));var BPromise=require(_0x213f('0x3'));var Mustache=require(_0x213f('0x4'));var util=require(_0x213f('0x5'));var path=require(_0x213f('0x6'));var sox=require(_0x213f('0x7'));var csv=require(_0x213f('0x8'));var ejs=require(_0x213f('0x9'));var fs=require('fs');var fs_extra=require(_0x213f('0xa'));var _=require(_0x213f('0xb'));var squel=require('squel');var crypto=require(_0x213f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x213f('0x8'));var querystring=require('querystring');var Papa=require(_0x213f('0xd'));var Redis=require(_0x213f('0xe'));var authService=require(_0x213f('0xf'));var qs=require(_0x213f('0x10'));var as=require(_0x213f('0x11'));var hardwareService=require(_0x213f('0x12'));var logger=require(_0x213f('0x13'))(_0x213f('0x14'));var utils=require('../../config/utils');var config=require(_0x213f('0x15'));var licenseUtil=require(_0x213f('0x16'));var db=require(_0x213f('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3f74c6,_0x435c45){_0x435c45=_0x435c45||0xcc;return function(_0x710156){if(_0x710156){return _0x3f74c6[_0x213f('0x18')](_0x435c45);}return _0x3f74c6[_0x213f('0x19')](_0x435c45)[_0x213f('0x1a')]();};}function respondWithResult(_0x210075,_0x5418a3){_0x5418a3=_0x5418a3||0xc8;return function(_0x2cda86){if(_0x2cda86){return _0x210075[_0x213f('0x19')](_0x5418a3)[_0x213f('0x1b')](_0x2cda86);}};}function respondWithFilteredResult(_0x122487,_0x50dc6a){return function(_0xd96169){if(_0xd96169){var _0x36e25a=typeof _0x50dc6a['offset']===_0x213f('0x1c')&&typeof _0x50dc6a['limit']===_0x213f('0x1c');var _0x59acfb=_0xd96169[_0x213f('0x1d')];var _0x122e8f=_0x36e25a?0x0:_0x50dc6a[_0x213f('0x1e')];var _0x39f4b6=_0x36e25a?_0xd96169[_0x213f('0x1d')]:_0x50dc6a[_0x213f('0x1e')]+_0x50dc6a['limit'];var _0x784969;if(_0x39f4b6>=_0x59acfb){_0x39f4b6=_0x59acfb;_0x784969=0xc8;}else{_0x784969=0xce;}_0x122487[_0x213f('0x19')](_0x784969);return _0x122487[_0x213f('0x1f')]('Content-Range',_0x122e8f+'-'+_0x39f4b6+'/'+_0x59acfb)['json'](_0xd96169);}return null;};}function patchUpdates(_0x511689){return function(_0x28cc6e){try{jsonpatch[_0x213f('0x20')](_0x28cc6e,_0x511689,!![]);}catch(_0x19e55c){return BPromise[_0x213f('0x21')](_0x19e55c);}return _0x28cc6e[_0x213f('0x22')]();};}function saveUpdates(_0x22f9af,_0x137d3e){return function(_0x142537){if(_0x142537){return _0x142537[_0x213f('0x23')](_0x22f9af)[_0x213f('0x24')](function(_0x26fccb){return _0x26fccb;});}return null;};}function removeEntity(_0x5d0ed1,_0x363ea0){return function(_0x5cd3d6){if(_0x5cd3d6){return _0x5cd3d6[_0x213f('0x25')]()[_0x213f('0x24')](function(){_0x5d0ed1[_0x213f('0x19')](0xcc)[_0x213f('0x1a')]();});}};}function handleEntityNotFound(_0x3142db,_0x2a5f5f){return function(_0x481e13){if(!_0x481e13){_0x3142db['sendStatus'](0x194);}return _0x481e13;};}function handleError(_0x53d02a,_0x29d563){_0x29d563=_0x29d563||0x1f4;return function(_0x286a9e){logger[_0x213f('0x26')](_0x286a9e[_0x213f('0x27')]);if(_0x286a9e['name']){delete _0x286a9e[_0x213f('0x28')];}_0x53d02a[_0x213f('0x19')](_0x29d563)[_0x213f('0x29')](_0x286a9e);};}exports['index']=function(_0x524e54,_0x4aec2){var _0x54993a={},_0x4d1ae3={},_0x61f107={'count':0x0,'rows':[]};var _0x3a0ae5=_[_0x213f('0x2a')](db[_0x213f('0x2b')][_0x213f('0x2c')],function(_0x5a5957){return{'name':_0x5a5957[_0x213f('0x2d')],'type':_0x5a5957[_0x213f('0x2e')][_0x213f('0x2f')]};});_0x4d1ae3[_0x213f('0x30')]=_[_0x213f('0x2a')](_0x3a0ae5,'name');_0x4d1ae3[_0x213f('0x31')]=_['keys'](_0x524e54['query']);_0x4d1ae3[_0x213f('0x32')]=_['intersection'](_0x4d1ae3['model'],_0x4d1ae3[_0x213f('0x31')]);_0x54993a[_0x213f('0x33')]=_[_0x213f('0x34')](_0x4d1ae3[_0x213f('0x30')],qs[_0x213f('0x35')](_0x524e54[_0x213f('0x31')][_0x213f('0x35')]));_0x54993a[_0x213f('0x33')]=_0x54993a[_0x213f('0x33')]['length']?_0x54993a[_0x213f('0x33')]:_0x4d1ae3[_0x213f('0x30')];if(!_0x524e54[_0x213f('0x31')][_0x213f('0x36')](_0x213f('0x37'))){_0x54993a[_0x213f('0x38')]=qs[_0x213f('0x38')](_0x524e54[_0x213f('0x31')]['limit']);_0x54993a[_0x213f('0x1e')]=qs[_0x213f('0x1e')](_0x524e54[_0x213f('0x31')][_0x213f('0x1e')]);}_0x54993a[_0x213f('0x39')]=qs[_0x213f('0x3a')](_0x524e54[_0x213f('0x31')]['sort']);_0x54993a[_0x213f('0x3b')]=qs['filters'](_['pick'](_0x524e54['query'],_0x4d1ae3[_0x213f('0x32')]),_0x3a0ae5);if(_0x524e54['query'][_0x213f('0x3c')]){_0x54993a[_0x213f('0x3b')]=_[_0x213f('0x3d')](_0x54993a[_0x213f('0x3b')],{'$or':_[_0x213f('0x2a')](_0x3a0ae5,function(_0x2e3b50){if(_0x2e3b50[_0x213f('0x2e')]!==_0x213f('0x3e')){var _0x18ba0f={};_0x18ba0f[_0x2e3b50['name']]={'$like':'%'+_0x524e54[_0x213f('0x31')]['filter']+'%'};return _0x18ba0f;}})});}_0x54993a=_[_0x213f('0x3d')]({},_0x54993a,_0x524e54[_0x213f('0x3f')]);var _0x2671f3={'where':_0x54993a[_0x213f('0x3b')]};return db[_0x213f('0x2b')]['count'](_0x2671f3)[_0x213f('0x24')](function(_0x1d2450){_0x61f107['count']=_0x1d2450;if(_0x524e54[_0x213f('0x31')][_0x213f('0x40')]){_0x54993a[_0x213f('0x41')]=[{'all':!![]}];}return db[_0x213f('0x2b')][_0x213f('0x42')](_0x54993a);})[_0x213f('0x24')](function(_0x3febee){_0x61f107[_0x213f('0x43')]=_0x3febee;return _0x61f107;})['then'](respondWithFilteredResult(_0x4aec2,_0x54993a))[_0x213f('0x44')](handleError(_0x4aec2,null));};exports[_0x213f('0x45')]=function(_0x3a24a6,_0x174d9a){var _0x5e501d={'raw':![],'where':{'id':_0x3a24a6['params']['id']}},_0x1f2795={};_0x1f2795[_0x213f('0x30')]=_[_0x213f('0x46')](db[_0x213f('0x2b')]['rawAttributes']);_0x1f2795['query']=_['keys'](_0x3a24a6['query']);_0x1f2795[_0x213f('0x32')]=_['intersection'](_0x1f2795['model'],_0x1f2795[_0x213f('0x31')]);_0x5e501d[_0x213f('0x33')]=_[_0x213f('0x34')](_0x1f2795[_0x213f('0x30')],qs[_0x213f('0x35')](_0x3a24a6['query'][_0x213f('0x35')]));_0x5e501d['attributes']=_0x5e501d[_0x213f('0x33')][_0x213f('0x47')]?_0x5e501d[_0x213f('0x33')]:_0x1f2795[_0x213f('0x30')];if(_0x3a24a6[_0x213f('0x31')][_0x213f('0x40')]){_0x5e501d['include']=[{'all':!![]}];}_0x5e501d=_[_0x213f('0x3d')]({},_0x5e501d,_0x3a24a6[_0x213f('0x3f')]);return db[_0x213f('0x2b')][_0x213f('0x48')](_0x5e501d)[_0x213f('0x24')](handleEntityNotFound(_0x174d9a,null))[_0x213f('0x24')](respondWithResult(_0x174d9a,null))[_0x213f('0x44')](handleError(_0x174d9a,null));};exports[_0x213f('0x49')]=function(_0x10dee6,_0x49faf2){return db['ServicenowAccount'][_0x213f('0x49')](_0x10dee6['body'],{})[_0x213f('0x24')](respondWithResult(_0x49faf2,0xc9))[_0x213f('0x44')](handleError(_0x49faf2,null));};exports['update']=function(_0x234e6c,_0x4817f5){if(_0x234e6c[_0x213f('0x4a')]['id']){delete _0x234e6c[_0x213f('0x4a')]['id'];}return db[_0x213f('0x2b')][_0x213f('0x48')]({'where':{'id':_0x234e6c[_0x213f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4817f5,null))[_0x213f('0x24')](saveUpdates(_0x234e6c[_0x213f('0x4a')],null))[_0x213f('0x24')](respondWithResult(_0x4817f5,null))[_0x213f('0x44')](handleError(_0x4817f5,null));};exports[_0x213f('0x25')]=function(_0x5dbf35,_0x5ae87d){return db[_0x213f('0x2b')][_0x213f('0x48')]({'where':{'id':_0x5dbf35['params']['id']}})[_0x213f('0x24')](handleEntityNotFound(_0x5ae87d,null))[_0x213f('0x24')](removeEntity(_0x5ae87d,null))[_0x213f('0x44')](handleError(_0x5ae87d,null));};exports[_0x213f('0x4c')]=function(_0x54315b,_0x2230e1,_0x2417eb){var _0x2761d7={};var _0x2017ac={};var _0x46eeb3;var _0x2defd7;return db[_0x213f('0x2b')][_0x213f('0x4d')]({'where':{'id':_0x54315b[_0x213f('0x4b')]['id']}})[_0x213f('0x24')](handleEntityNotFound(_0x2230e1,null))[_0x213f('0x24')](function(_0xd8f22b){if(_0xd8f22b){_0x46eeb3=_0xd8f22b;_0x2017ac[_0x213f('0x30')]=_[_0x213f('0x46')](db['ServicenowConfiguration'][_0x213f('0x2c')]);_0x2017ac[_0x213f('0x31')]=_['keys'](_0x54315b[_0x213f('0x31')]);_0x2017ac['filters']=_[_0x213f('0x34')](_0x2017ac[_0x213f('0x30')],_0x2017ac['query']);_0x2761d7[_0x213f('0x33')]=_['intersection'](_0x2017ac[_0x213f('0x30')],qs['fields'](_0x54315b['query'][_0x213f('0x35')]));_0x2761d7[_0x213f('0x33')]=_0x2761d7[_0x213f('0x33')][_0x213f('0x47')]?_0x2761d7[_0x213f('0x33')]:_0x2017ac[_0x213f('0x30')];_0x2761d7[_0x213f('0x39')]=qs['sort'](_0x54315b[_0x213f('0x31')][_0x213f('0x3a')]);_0x2761d7[_0x213f('0x3b')]=qs[_0x213f('0x32')](_[_0x213f('0x4e')](_0x54315b['query'],_0x2017ac['filters']));if(_0x54315b[_0x213f('0x31')][_0x213f('0x3c')]){_0x2761d7['where']=_[_0x213f('0x3d')](_0x2761d7['where'],{'$or':_[_0x213f('0x2a')](_0x2761d7[_0x213f('0x33')],function(_0x5c8e0f){var _0x1ad26d={};_0x1ad26d[_0x5c8e0f]={'$like':'%'+_0x54315b['query'][_0x213f('0x3c')]+'%'};return _0x1ad26d;})});}_0x2761d7=_[_0x213f('0x3d')]({},_0x2761d7,_0x54315b[_0x213f('0x3f')]);return _0x46eeb3[_0x213f('0x4c')](_0x2761d7);}})[_0x213f('0x24')](function(_0x5a4775){if(_0x5a4775){_0x2defd7=_0x5a4775['length'];if(!_0x54315b[_0x213f('0x31')][_0x213f('0x36')]('nolimit')){_0x2761d7['limit']=qs[_0x213f('0x38')](_0x54315b[_0x213f('0x31')]['limit']);_0x2761d7[_0x213f('0x1e')]=qs[_0x213f('0x1e')](_0x54315b[_0x213f('0x31')][_0x213f('0x1e')]);}return _0x46eeb3[_0x213f('0x4c')](_0x2761d7);}})[_0x213f('0x24')](function(_0x5b63cb){if(_0x5b63cb){return _0x5b63cb?{'count':_0x2defd7,'rows':_0x5b63cb}:null;}})[_0x213f('0x24')](respondWithResult(_0x2230e1,null))[_0x213f('0x44')](handleError(_0x2230e1,null));};exports[_0x213f('0x4f')]=function(_0x56d4b3,_0x44f650,_0x5638c7){if(_0x56d4b3[_0x213f('0x4a')]['id']){delete _0x56d4b3[_0x213f('0x4a')]['id'];}return db[_0x213f('0x2b')][_0x213f('0x4d')]({'where':{'id':_0x56d4b3[_0x213f('0x4b')]['id']}})[_0x213f('0x24')](handleEntityNotFound(_0x44f650,null))['then'](function(_0x492f1a){if(_0x492f1a){_0x56d4b3['body'][_0x213f('0x50')]=_0x492f1a['id'];_0x56d4b3[_0x213f('0x4a')][_0x213f('0x51')]=integrations[_0x213f('0x52')](_0x56d4b3[_0x213f('0x4a')][_0x213f('0x53')],_0x56d4b3[_0x213f('0x4a')][_0x213f('0x2e')]);_0x56d4b3[_0x213f('0x4a')][_0x213f('0x54')]=integrations[_0x213f('0x55')](_0x56d4b3[_0x213f('0x4a')][_0x213f('0x53')],_0x56d4b3[_0x213f('0x4a')][_0x213f('0x2e')]);return db[_0x213f('0x56')][_0x213f('0x49')](_0x56d4b3['body'],{'include':[{'model':db[_0x213f('0x57')],'as':_0x213f('0x51')},{'model':db[_0x213f('0x57')],'as':_0x213f('0x54')}]});}return null;})[_0x213f('0x24')](respondWithResult(_0x44f650,null))[_0x213f('0x44')](handleError(_0x44f650,null));};exports['getFields']=function(_0x7f766f,_0x4a7a1f,_0x2a4d7e){var _0x225b13=[_0x213f('0x58'),_0x213f('0x59'),_0x213f('0x5a'),'subcategory',_0x213f('0x5b'),_0x213f('0x5c'),_0x213f('0x5d'),_0x213f('0x5e'),_0x213f('0x5f')];var _0x5450d6=[_0x213f('0x60'),_0x213f('0x58'),_0x213f('0x61'),_0x213f('0x62'),_0x213f('0x63'),_0x213f('0x64'),_0x213f('0x65'),'hold_reason','approval_history','number','resolved_by',_0x213f('0x66'),_0x213f('0x67'),_0x213f('0x68'),_0x213f('0x69'),_0x213f('0x6a'),_0x213f('0x6b'),_0x213f('0x6c'),'knowledge','order',_0x213f('0x6d'),_0x213f('0x6e'),_0x213f('0x6f'),_0x213f('0x70'),_0x213f('0x71'),_0x213f('0x72'),_0x213f('0x73'),_0x213f('0x74'),_0x213f('0x75'),_0x213f('0x76'),_0x213f('0x77'),_0x213f('0x78'),_0x213f('0x79'),_0x213f('0x7a'),_0x213f('0x7b'),_0x213f('0x7c'),_0x213f('0x7d'),_0x213f('0x7e'),_0x213f('0x7f'),_0x213f('0x80'),'approval_set',_0x213f('0x81'),_0x213f('0x82'),_0x213f('0x83'),'close_code',_0x213f('0x84'),_0x213f('0x85'),_0x213f('0x86'),_0x213f('0x87'),_0x213f('0x88'),_0x213f('0x89'),_0x213f('0x8a'),'calendar_duration','notify',_0x213f('0x8b'),'close_notes','closed_by','follow_up',_0x213f('0x8c'),'sys_id',_0x213f('0x8d'),'reopened_by','incident_state',_0x213f('0x8e'),_0x213f('0x8f'),_0x213f('0x90'),'reassignment_count',_0x213f('0x91'),_0x213f('0x92'),_0x213f('0x5e'),_0x213f('0x93'),_0x213f('0x94'),_0x213f('0x95'),'comments_and_work_notes',_0x213f('0x96'),_0x213f('0x97'),_0x213f('0x98'),_0x213f('0x99'),_0x213f('0x9a'),_0x213f('0x9b'),_0x213f('0x9c'),_0x213f('0x9d'),_0x213f('0x5f')];var _0x32b7f9='';var _0x5c805a='';var _0x1e722a=[];var _0x4778d7='';var _0x44be15='';var _0x1b2246=[];var _0x22e1be='';var _0x96686c='';var _0x2034ef={};var _0x5642d0='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x7f766f[_0x213f('0x4b')]['id']},'attributes':['id','username',_0x213f('0x9e'),_0x213f('0x9f'),_0x213f('0xa0'),'serverUrl']})[_0x213f('0x24')](handleEntityNotFound(_0x4a7a1f,null))['then'](function(_0x4b9f7a){if(_0x4b9f7a){_0x5642d0=_0x4b9f7a[_0x213f('0xa0')];var _0x54c973=_0x5642d0[_0x213f('0xa1')](-0x1);if(_0x54c973==='/'){_0x5642d0=_0x5642d0[_0x213f('0xa2')](0x0,_0x5642d0['lastIndexOf'](_0x54c973));}_0x96686c=util['format'](_0x213f('0xa3'),_0x5642d0);_0x22e1be=util['format']('%s/api/now/table/',_0x5642d0);_0x2034ef={'user':_0x4b9f7a[_0x213f('0xa4')],'pass':_0x4b9f7a['password']};var _0x5518a6={'method':'GET','uri':_0x96686c+_0x213f('0xa5'),'auth':_0x2034ef,'json':!![]};return rp(_0x5518a6);}})[_0x213f('0x24')](function(_0x12f08b){if(_0x12f08b[_0x213f('0xa6')][_0x213f('0x47')]>0x0){_0x32b7f9=_0x12f08b['result'];}console['log'](_0x213f('0xa7'),_0x32b7f9);_0x1b2246=[];_0x5c805a=Object[_0x213f('0xa8')]([],_0x32b7f9);_['remove'](_0x5c805a,function(_0x50bce6){return!_0x225b13['includes'](_0x50bce6[_0x213f('0x28')]);});_0x5c805a[_0x213f('0xa9')](function(_0x5ccbd7){var _0x5e880f=createFieldObject(_0x22e1be,_0x2034ef,_0x5ccbd7[_0x213f('0xaa')],_0x5ccbd7[_0x213f('0x28')],_0x5ccbd7[_0x213f('0xab')],![]);_0x1b2246[_0x213f('0xac')](_0x5e880f);});return Promise[_0x213f('0xad')](_0x1b2246);})['then'](function(_0x54dd35){_0x1e722a=_0x54dd35;_0x4778d7=Object['assign']([],_0x32b7f9);console[_0x213f('0xae')](_0x213f('0xaf'),_0x32b7f9);_[_0x213f('0xb0')](_0x4778d7,function(_0x23ef3a){return _0x5450d6[_0x213f('0xb1')](_0x23ef3a[_0x213f('0x28')]);});console['log'](_0x213f('0xb2'),_0x4778d7);_0x1b2246=[];_0x4778d7['forEach'](function(_0x2a2434){var _0x36e619=createFieldObject(_0x22e1be,_0x2034ef,_0x2a2434[_0x213f('0xaa')],_0x2a2434[_0x213f('0x28')],_0x2a2434[_0x213f('0xab')],!![]);_0x1b2246['push'](_0x36e619);});return Promise[_0x213f('0xad')](_0x1b2246);})['then'](function(_0xad4edf){_0x44be15=_0xad4edf;var _0x538df3=_0x1e722a[_0x213f('0xb3')](_0x44be15);return{'count':_0x538df3[_0x213f('0x47')],'rows':_0x538df3};})[_0x213f('0x24')](respondWithResult(_0x4a7a1f,null))[_0x213f('0x44')](function(_0x197377){console[_0x213f('0xae')](_0x213f('0xb4')+_0x197377);var _0x1536c3=_0x7f766f['query'][_0x213f('0xb5')]?0x1f4:_0x197377[_0x213f('0xb6')]||0x1f4;logger['error'](_0x197377[_0x213f('0x27')]);delete _0x197377[_0x213f('0x28')];if(_0x1536c3===0x191){_0x1536c3=0x190;}_0x4a7a1f[_0x213f('0x19')](_0x1536c3)['send'](_0x7f766f[_0x213f('0x31')][_0x213f('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x197377[_0x213f('0xb6')]}:_0x197377);});};function createFieldObject(_0x372f1b,_0x4d80ed,_0x4e2227,_0x128088,_0x2a254a,_0x47bf5f){return new Promise(function(_0x54c7d1,_0x322962){var _0x2c0d16={'id':_0x128088,'name':_0x2a254a,'custom':_0x47bf5f};if(_0x4e2227===_0x213f('0xb7')){_0x2c0d16['options']=[{'name':_0x213f('0xb8'),'value':_0x213f('0xb9')},{'name':'False','value':_0x213f('0xba')}];_0x54c7d1(_0x2c0d16);}else{var _0x1bc0bc={'method':_0x213f('0xbb'),'uri':_0x372f1b+_0x213f('0xbc')+_0x128088,'auth':_0x4d80ed,'json':!![]};return rp(_0x1bc0bc)[_0x213f('0x24')](function(_0x207775){var _0x4d5080=[];if(_0x207775[_0x213f('0xa6')][_0x213f('0x47')]>0x0){_0x207775['result'][_0x213f('0xa9')](function(_0x169343){if(_0x169343[_0x213f('0xbd')]===_0x213f('0xba')){var _0x3e419c={'name':_0x169343[_0x213f('0xab')],'value':_0x169343['value']};_0x4d5080[_0x213f('0xac')](_0x3e419c);}});}_0x2c0d16[_0x213f('0x3f')]=_0x4d5080;if(_0x2c0d16[_0x213f('0x3f')][_0x213f('0x47')]>0x0){_0x54c7d1(_0x2c0d16);}else{if(_0x47bf5f==![]){_0x54c7d1();}else{_0x54c7d1(_0x2c0d16);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c2da574..b7ecb30 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x4cfc59,_0x2c710f){var _0x59c36d=function(_0x1974c6){while(--_0x1974c6){_0x4cfc59['push'](_0x4cfc59['shift']());}};_0x59c36d(++_0x2c710f);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'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'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x3f9617,_0x1ce1aa){var _0x1d4bf3=function(_0x4c2da7){while(--_0x4c2da7){_0x3f9617['push'](_0x3f9617['shift']());}};_0x1d4bf3(++_0x1ce1aa);}(_0x8958,0x93));var _0x8895=function(_0x3de2e7,_0x39aa2b){_0x3de2e7=_0x3de2e7-0x0;var _0x116f34=_0x8958[_0x3de2e7];return _0x116f34;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 6f22d40..1f14a78 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 _0x66d7=['catch','GetServicenowAccount','options','raw','where','limit','map','include','model','attributes','ShowServicenowAccount','ServicenowAccount','find','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x66d7,0xfc));var _0x766d=function(_0x5a2e13,_0x38fe38){_0x5a2e13=_0x5a2e13-0x0;var _0x2ec9de=_0x66d7[_0x5a2e13];return _0x2ec9de;};'use strict';var _=require(_0x766d('0x0'));var util=require('util');var moment=require(_0x766d('0x1'));var BPromise=require(_0x766d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x766d('0x3'));var db=require(_0x766d('0x4'))['db'];var utils=require(_0x766d('0x5'));var logger=require(_0x766d('0x6'))(_0x766d('0x7'));var config=require(_0x766d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x766d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ac06a,_0xa04b50,_0x2ae20f){return new BPromise(function(_0x5cf405,_0x4e1815){return client[_0x766d('0xa')](_0x3ac06a,_0x2ae20f)['then'](function(_0x57e367){logger[_0x766d('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0xa04b50,_0x766d('0xc'));logger[_0x766d('0xd')](_0x766d('0xe'),_0xa04b50,_0x766d('0xc'),JSON[_0x766d('0xf')](_0x57e367));if(_0x57e367[_0x766d('0x10')]){if(_0x57e367['error']['code']===0x1f4){logger[_0x766d('0x10')](_0x766d('0x11'),_0xa04b50,_0x57e367[_0x766d('0x10')][_0x766d('0x12')]);return _0x4e1815(_0x57e367[_0x766d('0x10')]['message']);}logger[_0x766d('0x10')](_0x766d('0x11'),_0xa04b50,_0x57e367['error']['message']);return _0x5cf405(_0x57e367[_0x766d('0x10')][_0x766d('0x12')]);}else{logger[_0x766d('0xb')](_0x766d('0x11'),_0xa04b50,_0x766d('0xc'));_0x5cf405(_0x57e367[_0x766d('0x13')]['message']);}})[_0x766d('0x14')](function(_0x14611c){logger[_0x766d('0x10')](_0x766d('0x11'),_0xa04b50,_0x14611c);_0x4e1815(_0x14611c);});});}exports[_0x766d('0x15')]=function(_0x34d50c){var _0x2b040f=this;return new Promise(function(_0x15dca0,_0x1ff5a5){return db['ServicenowAccount']['findAll']({'raw':_0x34d50c[_0x766d('0x16')]?_0x34d50c[_0x766d('0x16')][_0x766d('0x17')]===undefined?!![]:![]:!![],'where':_0x34d50c[_0x766d('0x16')]?_0x34d50c[_0x766d('0x16')][_0x766d('0x18')]||null:null,'attributes':_0x34d50c['options']?_0x34d50c['options']['attributes']||null:null,'limit':_0x34d50c[_0x766d('0x16')]?_0x34d50c['options'][_0x766d('0x19')]||null:null,'include':_0x34d50c['options']?_0x34d50c[_0x766d('0x16')]['include']?_[_0x766d('0x1a')](_0x34d50c[_0x766d('0x16')][_0x766d('0x1b')],function(_0x23a82e){return{'model':db[_0x23a82e[_0x766d('0x1c')]],'as':_0x23a82e['as'],'attributes':_0x23a82e[_0x766d('0x1d')],'include':_0x23a82e[_0x766d('0x1b')]?_[_0x766d('0x1a')](_0x23a82e['include'],function(_0x81a425){return{'model':db[_0x81a425[_0x766d('0x1c')]],'as':_0x81a425['as'],'attributes':_0x81a425[_0x766d('0x1d')],'include':_0x81a425[_0x766d('0x1b')]?_[_0x766d('0x1a')](_0x81a425[_0x766d('0x1b')],function(_0x303fe6){return{'model':db[_0x303fe6[_0x766d('0x1c')]],'as':_0x303fe6['as'],'attributes':_0x303fe6[_0x766d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ed534){logger['info'](_0x766d('0x15'),_0x34d50c);logger[_0x766d('0xd')]('GetServicenowAccount',_0x34d50c,JSON[_0x766d('0xf')](_0x2ed534));_0x15dca0(_0x2ed534);})[_0x766d('0x14')](function(_0x3671aa){logger[_0x766d('0x10')](_0x766d('0x15'),_0x3671aa[_0x766d('0x12')],_0x34d50c);_0x1ff5a5(_0x2b040f['error'](0x1f4,_0x3671aa[_0x766d('0x12')]));});});};exports[_0x766d('0x1e')]=function(_0x33fab4){var _0x13c836=this;return new Promise(function(_0xae58ad,_0x1f738d){return db[_0x766d('0x1f')][_0x766d('0x20')]({'raw':_0x33fab4['options']?_0x33fab4[_0x766d('0x16')][_0x766d('0x17')]===undefined?!![]:![]:!![],'where':_0x33fab4[_0x766d('0x16')]?_0x33fab4['options']['where']||null:null,'attributes':_0x33fab4[_0x766d('0x16')]?_0x33fab4[_0x766d('0x16')]['attributes']||null:null,'include':_0x33fab4[_0x766d('0x16')]?_0x33fab4[_0x766d('0x16')][_0x766d('0x1b')]?_[_0x766d('0x1a')](_0x33fab4['options'][_0x766d('0x1b')],function(_0x9f32b3){return{'model':db[_0x9f32b3[_0x766d('0x1c')]],'as':_0x9f32b3['as'],'attributes':_0x9f32b3[_0x766d('0x1d')],'include':_0x9f32b3[_0x766d('0x1b')]?_[_0x766d('0x1a')](_0x9f32b3['include'],function(_0x305a93){return{'model':db[_0x305a93[_0x766d('0x1c')]],'as':_0x305a93['as'],'attributes':_0x305a93[_0x766d('0x1d')],'include':_0x305a93['include']?_[_0x766d('0x1a')](_0x305a93[_0x766d('0x1b')],function(_0x173dc3){return{'model':db[_0x173dc3[_0x766d('0x1c')]],'as':_0x173dc3['as'],'attributes':_0x173dc3[_0x766d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x766d('0x21')](function(_0x3206b5){logger[_0x766d('0xb')](_0x766d('0x1e'),_0x33fab4);logger[_0x766d('0xd')](_0x766d('0x1e'),_0x33fab4,JSON[_0x766d('0xf')](_0x3206b5));_0xae58ad(_0x3206b5);})['catch'](function(_0x506a28){logger[_0x766d('0x10')]('ShowServicenowAccount',_0x506a28[_0x766d('0x12')],_0x33fab4);_0x1f738d(_0x13c836[_0x766d('0x10')](0x1f4,_0x506a28[_0x766d('0x12')]));});});}; \ No newline at end of file +var _0xad56=['message','result','catch','GetServicenowAccount','ServicenowAccount','options','attributes','limit','include','map','model','debug','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xad56,0x177));var _0x6ad5=function(_0x39f7c8,_0x4bf22e){_0x39f7c8=_0x39f7c8-0x0;var _0x1ce574=_0xad56[_0x39f7c8];return _0x1ce574;};'use strict';var _=require(_0x6ad5('0x0'));var util=require(_0x6ad5('0x1'));var moment=require(_0x6ad5('0x2'));var BPromise=require(_0x6ad5('0x3'));var rs=require(_0x6ad5('0x4'));var fs=require('fs');var Redis=require(_0x6ad5('0x5'));var db=require(_0x6ad5('0x6'))['db'];var utils=require(_0x6ad5('0x7'));var logger=require(_0x6ad5('0x8'))(_0x6ad5('0x9'));var config=require(_0x6ad5('0xa'));var jayson=require(_0x6ad5('0xb'));var client=jayson[_0x6ad5('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd59d,_0x5c2df3,_0x51f8ee){return new BPromise(function(_0xa31667,_0x1ad672){return client[_0x6ad5('0xd')](_0x2dd59d,_0x51f8ee)[_0x6ad5('0xe')](function(_0x46ec46){logger[_0x6ad5('0xf')](_0x6ad5('0x10'),_0x5c2df3,_0x6ad5('0x11'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5c2df3,_0x6ad5('0x11'),JSON[_0x6ad5('0x12')](_0x46ec46));if(_0x46ec46[_0x6ad5('0x13')]){if(_0x46ec46[_0x6ad5('0x13')][_0x6ad5('0x14')]===0x1f4){logger[_0x6ad5('0x13')](_0x6ad5('0x10'),_0x5c2df3,_0x46ec46[_0x6ad5('0x13')][_0x6ad5('0x15')]);return _0x1ad672(_0x46ec46['error']['message']);}logger[_0x6ad5('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5c2df3,_0x46ec46[_0x6ad5('0x13')]['message']);return _0xa31667(_0x46ec46[_0x6ad5('0x13')][_0x6ad5('0x15')]);}else{logger[_0x6ad5('0xf')](_0x6ad5('0x10'),_0x5c2df3,_0x6ad5('0x11'));_0xa31667(_0x46ec46[_0x6ad5('0x16')][_0x6ad5('0x15')]);}})[_0x6ad5('0x17')](function(_0x53d716){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5c2df3,_0x53d716);_0x1ad672(_0x53d716);});});}exports[_0x6ad5('0x18')]=function(_0x279b68){var _0x2dacbc=this;return new Promise(function(_0x15da41,_0x4479f9){return db[_0x6ad5('0x19')]['findAll']({'raw':_0x279b68[_0x6ad5('0x1a')]?_0x279b68[_0x6ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x279b68[_0x6ad5('0x1a')]?_0x279b68[_0x6ad5('0x1a')]['where']||null:null,'attributes':_0x279b68[_0x6ad5('0x1a')]?_0x279b68['options'][_0x6ad5('0x1b')]||null:null,'limit':_0x279b68[_0x6ad5('0x1a')]?_0x279b68['options'][_0x6ad5('0x1c')]||null:null,'include':_0x279b68['options']?_0x279b68[_0x6ad5('0x1a')][_0x6ad5('0x1d')]?_[_0x6ad5('0x1e')](_0x279b68['options']['include'],function(_0x180f21){return{'model':db[_0x180f21[_0x6ad5('0x1f')]],'as':_0x180f21['as'],'attributes':_0x180f21[_0x6ad5('0x1b')],'include':_0x180f21[_0x6ad5('0x1d')]?_[_0x6ad5('0x1e')](_0x180f21['include'],function(_0x4c7a04){return{'model':db[_0x4c7a04[_0x6ad5('0x1f')]],'as':_0x4c7a04['as'],'attributes':_0x4c7a04['attributes'],'include':_0x4c7a04[_0x6ad5('0x1d')]?_['map'](_0x4c7a04[_0x6ad5('0x1d')],function(_0x51040a){return{'model':db[_0x51040a[_0x6ad5('0x1f')]],'as':_0x51040a['as'],'attributes':_0x51040a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ad5('0xe')](function(_0x30ea08){logger[_0x6ad5('0xf')](_0x6ad5('0x18'),_0x279b68);logger[_0x6ad5('0x20')](_0x6ad5('0x18'),_0x279b68,JSON[_0x6ad5('0x12')](_0x30ea08));_0x15da41(_0x30ea08);})[_0x6ad5('0x17')](function(_0x454f48){logger[_0x6ad5('0x13')]('GetServicenowAccount',_0x454f48[_0x6ad5('0x15')],_0x279b68);_0x4479f9(_0x2dacbc['error'](0x1f4,_0x454f48[_0x6ad5('0x15')]));});});};exports[_0x6ad5('0x21')]=function(_0x4a93bc){var _0x321de8=this;return new Promise(function(_0x1255be,_0x123448){return db['ServicenowAccount'][_0x6ad5('0x22')]({'raw':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc[_0x6ad5('0x1a')][_0x6ad5('0x23')]||null:null,'attributes':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc[_0x6ad5('0x1a')][_0x6ad5('0x1b')]||null:null,'include':_0x4a93bc[_0x6ad5('0x1a')]?_0x4a93bc[_0x6ad5('0x1a')]['include']?_[_0x6ad5('0x1e')](_0x4a93bc[_0x6ad5('0x1a')][_0x6ad5('0x1d')],function(_0x492466){return{'model':db[_0x492466[_0x6ad5('0x1f')]],'as':_0x492466['as'],'attributes':_0x492466['attributes'],'include':_0x492466[_0x6ad5('0x1d')]?_[_0x6ad5('0x1e')](_0x492466[_0x6ad5('0x1d')],function(_0x3292ae){return{'model':db[_0x3292ae['model']],'as':_0x3292ae['as'],'attributes':_0x3292ae[_0x6ad5('0x1b')],'include':_0x3292ae['include']?_[_0x6ad5('0x1e')](_0x3292ae[_0x6ad5('0x1d')],function(_0x294d8a){return{'model':db[_0x294d8a[_0x6ad5('0x1f')]],'as':_0x294d8a['as'],'attributes':_0x294d8a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ad5('0xe')](function(_0x4174c0){logger[_0x6ad5('0xf')]('ShowServicenowAccount',_0x4a93bc);logger[_0x6ad5('0x20')](_0x6ad5('0x21'),_0x4a93bc,JSON[_0x6ad5('0x12')](_0x4174c0));_0x1255be(_0x4174c0);})[_0x6ad5('0x17')](function(_0x23672d){logger[_0x6ad5('0x13')](_0x6ad5('0x21'),_0x23672d[_0x6ad5('0x15')],_0x4a93bc);_0x123448(_0x321de8['error'](0x1f4,_0x23672d['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 044b884..180004b 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 _0xfcc7=['index','/:id','show','getFields','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xfcc7,0x1ef));var _0x7fcc=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0xfcc7[_0x3cb530];return _0x4168ea;};'use strict';var multer=require(_0x7fcc('0x0'));var util=require('util');var path=require(_0x7fcc('0x1'));var timeout=require(_0x7fcc('0x2'));var express=require('express');var router=express[_0x7fcc('0x3')]();var fs_extra=require(_0x7fcc('0x4'));var auth=require(_0x7fcc('0x5'));var interaction=require(_0x7fcc('0x6'));var config=require(_0x7fcc('0x7'));var controller=require(_0x7fcc('0x8'));router[_0x7fcc('0x9')]('/',auth[_0x7fcc('0xa')](),controller[_0x7fcc('0xb')]);router[_0x7fcc('0x9')](_0x7fcc('0xc'),auth[_0x7fcc('0xa')](),controller[_0x7fcc('0xd')]);router['get']('/:id/fields',auth[_0x7fcc('0xa')](),controller[_0x7fcc('0xe')]);router[_0x7fcc('0x9')]('/:id/subjects',auth[_0x7fcc('0xa')](),controller['getSubjects']);router[_0x7fcc('0x9')](_0x7fcc('0xf'),auth['isAuthenticated'](),controller[_0x7fcc('0x10')]);router[_0x7fcc('0x11')]('/',auth[_0x7fcc('0xa')](),controller['create']);router[_0x7fcc('0x12')](_0x7fcc('0xc'),auth[_0x7fcc('0xa')](),controller[_0x7fcc('0x13')]);router[_0x7fcc('0x14')](_0x7fcc('0xc'),auth[_0x7fcc('0xa')](),controller[_0x7fcc('0x15')]);module[_0x7fcc('0x16')]=router; \ No newline at end of file +var _0xa9e4=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields'];(function(_0x4101ad,_0x1b7eaf){var _0x3b6244=function(_0x5e7c49){while(--_0x5e7c49){_0x4101ad['push'](_0x4101ad['shift']());}};_0x3b6244(++_0x1b7eaf);}(_0xa9e4,0x138));var _0x4a9e=function(_0x15cdf2,_0x3416a8){_0x15cdf2=_0x15cdf2-0x0;var _0x1488a9=_0xa9e4[_0x15cdf2];return _0x1488a9;};'use strict';var multer=require('multer');var util=require(_0x4a9e('0x0'));var path=require('path');var timeout=require(_0x4a9e('0x1'));var express=require('express');var router=express[_0x4a9e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4a9e('0x4'));var controller=require(_0x4a9e('0x5'));router['get']('/',auth[_0x4a9e('0x6')](),controller[_0x4a9e('0x7')]);router[_0x4a9e('0x8')](_0x4a9e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4a9e('0x8')](_0x4a9e('0xa'),auth[_0x4a9e('0x6')](),controller[_0x4a9e('0xb')]);router['get'](_0x4a9e('0xc'),auth['isAuthenticated'](),controller[_0x4a9e('0xd')]);router[_0x4a9e('0x8')](_0x4a9e('0xe'),auth['isAuthenticated'](),controller[_0x4a9e('0xf')]);router[_0x4a9e('0x10')]('/',auth[_0x4a9e('0x6')](),controller['create']);router[_0x4a9e('0x11')](_0x4a9e('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4a9e('0x9'),auth[_0x4a9e('0x6')](),controller[_0x4a9e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 58dba78..2c67492 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 _0xfd45=['exports','STRING','sequelize'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0xfd45,0xe3));var _0x5fd4=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xfd45[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0x5fd4('0x0'));module[_0x5fd4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5fd4('0x2')]}}; \ No newline at end of file +var _0x334d=['sequelize','STRING'];(function(_0x31bebb,_0x317739){var _0x26928b=function(_0x471539){while(--_0x471539){_0x31bebb['push'](_0x31bebb['shift']());}};_0x26928b(++_0x317739);}(_0x334d,0x1d2));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd334('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd334('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e359d9f..aa1c72f 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 _0xd7c4=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','params','includeAll','find','body','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','rimraf','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0xd7c4,0x133));var _0x4d7c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd7c4[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d7c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d7c('0x1'));var moment=require('moment');var BPromise=require(_0x4d7c('0x2'));var Mustache=require(_0x4d7c('0x3'));var util=require(_0x4d7c('0x4'));var path=require(_0x4d7c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d7c('0x6'));var fs=require('fs');var fs_extra=require(_0x4d7c('0x7'));var _=require(_0x4d7c('0x8'));var squel=require(_0x4d7c('0x9'));var crypto=require(_0x4d7c('0xa'));var jsforce=require(_0x4d7c('0xb'));var deskjs=require(_0x4d7c('0xc'));var toCsv=require(_0x4d7c('0xd'));var querystring=require(_0x4d7c('0xe'));var Papa=require(_0x4d7c('0xf'));var Redis=require(_0x4d7c('0x10'));var authService=require(_0x4d7c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4d7c('0x12'));var hardwareService=require(_0x4d7c('0x13'));var logger=require(_0x4d7c('0x14'))(_0x4d7c('0x15'));var utils=require(_0x4d7c('0x16'));var config=require(_0x4d7c('0x17'));var licenseUtil=require(_0x4d7c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c596d,_0x48eeb2){_0x48eeb2=_0x48eeb2||0xcc;return function(_0x47c922){if(_0x47c922){return _0x4c596d[_0x4d7c('0x19')](_0x48eeb2);}return _0x4c596d[_0x4d7c('0x1a')](_0x48eeb2)[_0x4d7c('0x1b')]();};}function respondWithResult(_0xc597fd,_0x2c0784){_0x2c0784=_0x2c0784||0xc8;return function(_0x391094){if(_0x391094){return _0xc597fd[_0x4d7c('0x1a')](_0x2c0784)[_0x4d7c('0x1c')](_0x391094);}};}function respondWithFilteredResult(_0x595278,_0x455fbd){return function(_0x5348dc){if(_0x5348dc){var _0x5357a8=typeof _0x455fbd[_0x4d7c('0x1d')]===_0x4d7c('0x1e')&&typeof _0x455fbd['limit']==='undefined';var _0x22813b=_0x5348dc[_0x4d7c('0x1f')];var _0x4a32ec=_0x5357a8?0x0:_0x455fbd['offset'];var _0x51573e=_0x5357a8?_0x5348dc[_0x4d7c('0x1f')]:_0x455fbd[_0x4d7c('0x1d')]+_0x455fbd[_0x4d7c('0x20')];var _0x3a428b;if(_0x51573e>=_0x22813b){_0x51573e=_0x22813b;_0x3a428b=0xc8;}else{_0x3a428b=0xce;}_0x595278['status'](_0x3a428b);return _0x595278[_0x4d7c('0x21')]('Content-Range',_0x4a32ec+'-'+_0x51573e+'/'+_0x22813b)[_0x4d7c('0x1c')](_0x5348dc);}return null;};}function patchUpdates(_0x1c039a){return function(_0x1040ef){try{jsonpatch[_0x4d7c('0x22')](_0x1040ef,_0x1c039a,!![]);}catch(_0x504a5a){return BPromise[_0x4d7c('0x23')](_0x504a5a);}return _0x1040ef[_0x4d7c('0x24')]();};}function saveUpdates(_0x1b2d12,_0x351d42){return function(_0x3236c4){if(_0x3236c4){return _0x3236c4[_0x4d7c('0x25')](_0x1b2d12)[_0x4d7c('0x26')](function(_0x20b341){return _0x20b341;});}return null;};}function removeEntity(_0x34b2db,_0x1142e2){return function(_0x5c0f90){if(_0x5c0f90){return _0x5c0f90[_0x4d7c('0x27')]()[_0x4d7c('0x26')](function(){_0x34b2db['status'](0xcc)[_0x4d7c('0x1b')]();});}};}function handleEntityNotFound(_0x36407e,_0x1bac97){return function(_0x223449){if(!_0x223449){_0x36407e[_0x4d7c('0x19')](0x194);}return _0x223449;};}function handleError(_0x17d735,_0x1e16bd){_0x1e16bd=_0x1e16bd||0x1f4;return function(_0x3a5e94){logger['error'](_0x3a5e94[_0x4d7c('0x28')]);if(_0x3a5e94[_0x4d7c('0x29')]){delete _0x3a5e94[_0x4d7c('0x29')];}_0x17d735[_0x4d7c('0x1a')](_0x1e16bd)[_0x4d7c('0x2a')](_0x3a5e94);};}exports[_0x4d7c('0x2b')]=function(_0x346608,_0x1fc559){var _0x5c3f92={},_0x509c94={},_0x3d9857={'count':0x0,'rows':[]};var _0x48100a=_['map'](db[_0x4d7c('0x2c')][_0x4d7c('0x2d')],function(_0x3e3ff0){return{'name':_0x3e3ff0[_0x4d7c('0x2e')],'type':_0x3e3ff0[_0x4d7c('0x2f')]['key']};});_0x509c94[_0x4d7c('0x30')]=_[_0x4d7c('0x31')](_0x48100a,_0x4d7c('0x29'));_0x509c94['query']=_[_0x4d7c('0x32')](_0x346608[_0x4d7c('0x33')]);_0x509c94[_0x4d7c('0x34')]=_[_0x4d7c('0x35')](_0x509c94[_0x4d7c('0x30')],_0x509c94[_0x4d7c('0x33')]);_0x5c3f92['attributes']=_['intersection'](_0x509c94[_0x4d7c('0x30')],qs[_0x4d7c('0x36')](_0x346608[_0x4d7c('0x33')][_0x4d7c('0x36')]));_0x5c3f92[_0x4d7c('0x37')]=_0x5c3f92[_0x4d7c('0x37')][_0x4d7c('0x38')]?_0x5c3f92[_0x4d7c('0x37')]:_0x509c94[_0x4d7c('0x30')];if(!_0x346608[_0x4d7c('0x33')][_0x4d7c('0x39')](_0x4d7c('0x3a'))){_0x5c3f92[_0x4d7c('0x20')]=qs[_0x4d7c('0x20')](_0x346608[_0x4d7c('0x33')][_0x4d7c('0x20')]);_0x5c3f92[_0x4d7c('0x1d')]=qs['offset'](_0x346608['query'][_0x4d7c('0x1d')]);}_0x5c3f92[_0x4d7c('0x3b')]=qs[_0x4d7c('0x3c')](_0x346608[_0x4d7c('0x33')][_0x4d7c('0x3c')]);_0x5c3f92['where']=qs[_0x4d7c('0x34')](_['pick'](_0x346608[_0x4d7c('0x33')],_0x509c94['filters']),_0x48100a);if(_0x346608[_0x4d7c('0x33')][_0x4d7c('0x3d')]){_0x5c3f92['where']=_[_0x4d7c('0x3e')](_0x5c3f92['where'],{'$or':_[_0x4d7c('0x31')](_0x48100a,function(_0x50800d){if(_0x50800d[_0x4d7c('0x2f')]!==_0x4d7c('0x3f')){var _0x4b953a={};_0x4b953a[_0x50800d[_0x4d7c('0x29')]]={'$like':'%'+_0x346608['query']['filter']+'%'};return _0x4b953a;}})});}_0x5c3f92=_[_0x4d7c('0x3e')]({},_0x5c3f92,_0x346608[_0x4d7c('0x40')]);var _0x2c2aa2={'where':_0x5c3f92[_0x4d7c('0x41')]};return db[_0x4d7c('0x2c')][_0x4d7c('0x1f')](_0x2c2aa2)[_0x4d7c('0x26')](function(_0x2244ac){_0x3d9857[_0x4d7c('0x1f')]=_0x2244ac;if(_0x346608[_0x4d7c('0x33')]['includeAll']){_0x5c3f92[_0x4d7c('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x4d7c('0x43')](_0x5c3f92);})[_0x4d7c('0x26')](function(_0x2553f7){_0x3d9857[_0x4d7c('0x44')]=_0x2553f7;return _0x3d9857;})[_0x4d7c('0x26')](respondWithFilteredResult(_0x1fc559,_0x5c3f92))[_0x4d7c('0x45')](handleError(_0x1fc559,null));};exports[_0x4d7c('0x46')]=function(_0x18cabc,_0x33c5d5){var _0xc8b0cf={'raw':![],'where':{'id':_0x18cabc[_0x4d7c('0x47')]['id']}},_0x16512a={};_0x16512a[_0x4d7c('0x30')]=_['keys'](db[_0x4d7c('0x2c')][_0x4d7c('0x2d')]);_0x16512a[_0x4d7c('0x33')]=_[_0x4d7c('0x32')](_0x18cabc[_0x4d7c('0x33')]);_0x16512a[_0x4d7c('0x34')]=_['intersection'](_0x16512a[_0x4d7c('0x30')],_0x16512a['query']);_0xc8b0cf['attributes']=_[_0x4d7c('0x35')](_0x16512a[_0x4d7c('0x30')],qs[_0x4d7c('0x36')](_0x18cabc['query'][_0x4d7c('0x36')]));_0xc8b0cf[_0x4d7c('0x37')]=_0xc8b0cf[_0x4d7c('0x37')][_0x4d7c('0x38')]?_0xc8b0cf['attributes']:_0x16512a[_0x4d7c('0x30')];if(_0x18cabc['query'][_0x4d7c('0x48')]){_0xc8b0cf[_0x4d7c('0x42')]=[{'all':!![]}];}_0xc8b0cf=_[_0x4d7c('0x3e')]({},_0xc8b0cf,_0x18cabc['options']);return db['ServicenowConfiguration'][_0x4d7c('0x49')](_0xc8b0cf)[_0x4d7c('0x26')](handleEntityNotFound(_0x33c5d5,null))[_0x4d7c('0x26')](respondWithResult(_0x33c5d5,null))[_0x4d7c('0x45')](handleError(_0x33c5d5,null));};exports['create']=function(_0x65fd42,_0x52e770){return db[_0x4d7c('0x2c')]['create'](_0x65fd42[_0x4d7c('0x4a')],{})[_0x4d7c('0x26')](respondWithResult(_0x52e770,0xc9))[_0x4d7c('0x45')](handleError(_0x52e770,null));};exports[_0x4d7c('0x25')]=function(_0x186ee6,_0x397a6a){if(_0x186ee6[_0x4d7c('0x4a')]['id']){delete _0x186ee6[_0x4d7c('0x4a')]['id'];}return db[_0x4d7c('0x2c')][_0x4d7c('0x49')]({'where':{'id':_0x186ee6['params']['id']}})[_0x4d7c('0x26')](handleEntityNotFound(_0x397a6a,null))[_0x4d7c('0x26')](saveUpdates(_0x186ee6[_0x4d7c('0x4a')],null))[_0x4d7c('0x26')](respondWithResult(_0x397a6a,null))[_0x4d7c('0x45')](handleError(_0x397a6a,null));};exports[_0x4d7c('0x27')]=function(_0xbff74c,_0x518434){return db[_0x4d7c('0x2c')][_0x4d7c('0x49')]({'where':{'id':_0xbff74c[_0x4d7c('0x47')]['id']}})[_0x4d7c('0x26')](handleEntityNotFound(_0x518434,null))[_0x4d7c('0x26')](removeEntity(_0x518434,null))['catch'](handleError(_0x518434,null));};exports[_0x4d7c('0x4b')]=function(_0x11548f,_0x4b57e2,_0x1d1c35){var _0x5d0d01={};var _0x79b9c0={};var _0x22393c;var _0x341077;return db['ServicenowConfiguration'][_0x4d7c('0x4c')]({'where':{'id':_0x11548f[_0x4d7c('0x47')]['id']}})[_0x4d7c('0x26')](handleEntityNotFound(_0x4b57e2,null))[_0x4d7c('0x26')](function(_0xd5e261){if(_0xd5e261){_0x22393c=_0xd5e261;_0x79b9c0[_0x4d7c('0x30')]=_['keys'](db[_0x4d7c('0x4d')]['rawAttributes']);_0x79b9c0['query']=_[_0x4d7c('0x32')](_0x11548f[_0x4d7c('0x33')]);_0x79b9c0[_0x4d7c('0x34')]=_[_0x4d7c('0x35')](_0x79b9c0[_0x4d7c('0x30')],_0x79b9c0[_0x4d7c('0x33')]);_0x5d0d01[_0x4d7c('0x37')]=_[_0x4d7c('0x35')](_0x79b9c0[_0x4d7c('0x30')],qs[_0x4d7c('0x36')](_0x11548f['query']['fields']));_0x5d0d01[_0x4d7c('0x37')]=_0x5d0d01[_0x4d7c('0x37')]['length']?_0x5d0d01[_0x4d7c('0x37')]:_0x79b9c0[_0x4d7c('0x30')];_0x5d0d01[_0x4d7c('0x3b')]=qs[_0x4d7c('0x3c')](_0x11548f[_0x4d7c('0x33')][_0x4d7c('0x3c')]);_0x5d0d01[_0x4d7c('0x41')]=qs[_0x4d7c('0x34')](_[_0x4d7c('0x4e')](_0x11548f[_0x4d7c('0x33')],_0x79b9c0[_0x4d7c('0x34')]));if(_0x11548f[_0x4d7c('0x33')][_0x4d7c('0x3d')]){_0x5d0d01['where']=_[_0x4d7c('0x3e')](_0x5d0d01[_0x4d7c('0x41')],{'$or':_[_0x4d7c('0x31')](_0x5d0d01[_0x4d7c('0x37')],function(_0x175b23){var _0x11db3f={};_0x11db3f[_0x175b23]={'$like':'%'+_0x11548f['query'][_0x4d7c('0x3d')]+'%'};return _0x11db3f;})});}_0x5d0d01=_['merge']({},_0x5d0d01,_0x11548f[_0x4d7c('0x40')]);return _0x22393c[_0x4d7c('0x4b')](_0x5d0d01);}})['then'](function(_0x32376d){if(_0x32376d){_0x341077=_0x32376d[_0x4d7c('0x38')];if(!_0x11548f[_0x4d7c('0x33')][_0x4d7c('0x39')](_0x4d7c('0x3a'))){_0x5d0d01[_0x4d7c('0x20')]=qs[_0x4d7c('0x20')](_0x11548f[_0x4d7c('0x33')][_0x4d7c('0x20')]);_0x5d0d01['offset']=qs['offset'](_0x11548f[_0x4d7c('0x33')][_0x4d7c('0x1d')]);}return _0x22393c[_0x4d7c('0x4b')](_0x5d0d01);}})[_0x4d7c('0x26')](function(_0xfe9478){if(_0xfe9478){return _0xfe9478?{'count':_0x341077,'rows':_0xfe9478}:null;}})['then'](respondWithResult(_0x4b57e2,null))[_0x4d7c('0x45')](handleError(_0x4b57e2,null));};exports['getSubjects']=function(_0x506fee,_0x487dbe,_0x2718cd){var _0x30ad16={};var _0x3ba941={};var _0xb79302;var _0x333f12;return db[_0x4d7c('0x2c')]['findOne']({'where':{'id':_0x506fee[_0x4d7c('0x47')]['id']}})[_0x4d7c('0x26')](handleEntityNotFound(_0x487dbe,null))[_0x4d7c('0x26')](function(_0x884177){if(_0x884177){_0xb79302=_0x884177;_0x3ba941[_0x4d7c('0x30')]=_[_0x4d7c('0x32')](db[_0x4d7c('0x4d')]['rawAttributes']);_0x3ba941[_0x4d7c('0x33')]=_[_0x4d7c('0x32')](_0x506fee[_0x4d7c('0x33')]);_0x3ba941[_0x4d7c('0x34')]=_[_0x4d7c('0x35')](_0x3ba941[_0x4d7c('0x30')],_0x3ba941[_0x4d7c('0x33')]);_0x30ad16[_0x4d7c('0x37')]=_['intersection'](_0x3ba941[_0x4d7c('0x30')],qs[_0x4d7c('0x36')](_0x506fee[_0x4d7c('0x33')]['fields']));_0x30ad16[_0x4d7c('0x37')]=_0x30ad16[_0x4d7c('0x37')][_0x4d7c('0x38')]?_0x30ad16[_0x4d7c('0x37')]:_0x3ba941[_0x4d7c('0x30')];_0x30ad16[_0x4d7c('0x3b')]=qs[_0x4d7c('0x3c')](_0x506fee[_0x4d7c('0x33')]['sort']);_0x30ad16[_0x4d7c('0x41')]=qs['filters'](_[_0x4d7c('0x4e')](_0x506fee[_0x4d7c('0x33')],_0x3ba941['filters']));if(_0x506fee[_0x4d7c('0x33')]['filter']){_0x30ad16[_0x4d7c('0x41')]=_['merge'](_0x30ad16[_0x4d7c('0x41')],{'$or':_[_0x4d7c('0x31')](_0x30ad16['attributes'],function(_0x191c72){var _0x5e7f88={};_0x5e7f88[_0x191c72]={'$like':'%'+_0x506fee[_0x4d7c('0x33')]['filter']+'%'};return _0x5e7f88;})});}_0x30ad16=_['merge']({},_0x30ad16,_0x506fee[_0x4d7c('0x40')]);return _0xb79302[_0x4d7c('0x4f')](_0x30ad16);}})['then'](function(_0x22819b){if(_0x22819b){_0x333f12=_0x22819b[_0x4d7c('0x38')];if(!_0x506fee[_0x4d7c('0x33')][_0x4d7c('0x39')](_0x4d7c('0x3a'))){_0x30ad16['limit']=qs[_0x4d7c('0x20')](_0x506fee[_0x4d7c('0x33')]['limit']);_0x30ad16[_0x4d7c('0x1d')]=qs['offset'](_0x506fee[_0x4d7c('0x33')][_0x4d7c('0x1d')]);}return _0xb79302[_0x4d7c('0x4f')](_0x30ad16);}})['then'](function(_0x571b6f){if(_0x571b6f){return _0x571b6f?{'count':_0x333f12,'rows':_0x571b6f}:null;}})[_0x4d7c('0x26')](respondWithResult(_0x487dbe,null))['catch'](handleError(_0x487dbe,null));};exports[_0x4d7c('0x50')]=function(_0x3e752a,_0x43545b,_0x10ff41){var _0x733414={};var _0x1eeec1={};var _0x1a77db;var _0x1fd1ec;return db[_0x4d7c('0x2c')][_0x4d7c('0x4c')]({'where':{'id':_0x3e752a['params']['id']}})['then'](handleEntityNotFound(_0x43545b,null))[_0x4d7c('0x26')](function(_0x3015ef){if(_0x3015ef){_0x1a77db=_0x3015ef;_0x1eeec1['model']=_[_0x4d7c('0x32')](db[_0x4d7c('0x4d')][_0x4d7c('0x2d')]);_0x1eeec1[_0x4d7c('0x33')]=_['keys'](_0x3e752a[_0x4d7c('0x33')]);_0x1eeec1[_0x4d7c('0x34')]=_[_0x4d7c('0x35')](_0x1eeec1[_0x4d7c('0x30')],_0x1eeec1[_0x4d7c('0x33')]);_0x733414[_0x4d7c('0x37')]=_[_0x4d7c('0x35')](_0x1eeec1[_0x4d7c('0x30')],qs[_0x4d7c('0x36')](_0x3e752a[_0x4d7c('0x33')][_0x4d7c('0x36')]));_0x733414[_0x4d7c('0x37')]=_0x733414['attributes']['length']?_0x733414['attributes']:_0x1eeec1[_0x4d7c('0x30')];_0x733414['order']=qs[_0x4d7c('0x3c')](_0x3e752a[_0x4d7c('0x33')][_0x4d7c('0x3c')]);_0x733414['where']=qs[_0x4d7c('0x34')](_[_0x4d7c('0x4e')](_0x3e752a['query'],_0x1eeec1[_0x4d7c('0x34')]));if(_0x3e752a[_0x4d7c('0x33')]['filter']){_0x733414[_0x4d7c('0x41')]=_[_0x4d7c('0x3e')](_0x733414[_0x4d7c('0x41')],{'$or':_[_0x4d7c('0x31')](_0x733414[_0x4d7c('0x37')],function(_0x15c8dc){var _0x11436f={};_0x11436f[_0x15c8dc]={'$like':'%'+_0x3e752a[_0x4d7c('0x33')][_0x4d7c('0x3d')]+'%'};return _0x11436f;})});}_0x733414=_[_0x4d7c('0x3e')]({},_0x733414,_0x3e752a[_0x4d7c('0x40')]);return _0x1a77db[_0x4d7c('0x50')](_0x733414);}})['then'](function(_0x684c5e){if(_0x684c5e){_0x1fd1ec=_0x684c5e[_0x4d7c('0x38')];if(!_0x3e752a['query'][_0x4d7c('0x39')](_0x4d7c('0x3a'))){_0x733414[_0x4d7c('0x20')]=qs[_0x4d7c('0x20')](_0x3e752a[_0x4d7c('0x33')][_0x4d7c('0x20')]);_0x733414[_0x4d7c('0x1d')]=qs[_0x4d7c('0x1d')](_0x3e752a['query']['offset']);}return _0x1a77db[_0x4d7c('0x50')](_0x733414);}})['then'](function(_0x1e9be8){if(_0x1e9be8){return _0x1e9be8?{'count':_0x1fd1ec,'rows':_0x1e9be8}:null;}})['then'](respondWithResult(_0x43545b,null))['catch'](handleError(_0x43545b,null));}; \ No newline at end of file +var _0xb7f3=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','length','find','body','params','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0xeef94c,_0x1db3f7){var _0x447522=function(_0x16d3d5){while(--_0x16d3d5){_0xeef94c['push'](_0xeef94c['shift']());}};_0x447522(++_0x1db3f7);}(_0xb7f3,0x81));var _0x3b7f=function(_0x2aade7,_0x5386ee){_0x2aade7=_0x2aade7-0x0;var _0x2a6bfe=_0xb7f3[_0x2aade7];return _0x2a6bfe;};'use strict';var emlformat=require(_0x3b7f('0x0'));var rimraf=require(_0x3b7f('0x1'));var zipdir=require(_0x3b7f('0x2'));var jsonpatch=require(_0x3b7f('0x3'));var rp=require(_0x3b7f('0x4'));var moment=require(_0x3b7f('0x5'));var BPromise=require(_0x3b7f('0x6'));var Mustache=require('mustache');var util=require(_0x3b7f('0x7'));var path=require(_0x3b7f('0x8'));var sox=require(_0x3b7f('0x9'));var csv=require(_0x3b7f('0xa'));var ejs=require(_0x3b7f('0xb'));var fs=require('fs');var fs_extra=require(_0x3b7f('0xc'));var _=require(_0x3b7f('0xd'));var squel=require(_0x3b7f('0xe'));var crypto=require(_0x3b7f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3b7f('0x10'));var toCsv=require(_0x3b7f('0xa'));var querystring=require(_0x3b7f('0x11'));var Papa=require(_0x3b7f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b7f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b7f('0x14'))('api');var utils=require(_0x3b7f('0x15'));var config=require(_0x3b7f('0x16'));var licenseUtil=require(_0x3b7f('0x17'));var db=require(_0x3b7f('0x18'))['db'];function respondWithStatusCode(_0x3e2730,_0x265694){_0x265694=_0x265694||0xcc;return function(_0x3c4bb3){if(_0x3c4bb3){return _0x3e2730['sendStatus'](_0x265694);}return _0x3e2730[_0x3b7f('0x19')](_0x265694)[_0x3b7f('0x1a')]();};}function respondWithResult(_0x393b16,_0x484cc6){_0x484cc6=_0x484cc6||0xc8;return function(_0x6970c9){if(_0x6970c9){return _0x393b16['status'](_0x484cc6)[_0x3b7f('0x1b')](_0x6970c9);}};}function respondWithFilteredResult(_0xfb369c,_0x4edad4){return function(_0x5f1bf5){if(_0x5f1bf5){var _0x40b0b7=typeof _0x4edad4[_0x3b7f('0x1c')]===_0x3b7f('0x1d')&&typeof _0x4edad4[_0x3b7f('0x1e')]===_0x3b7f('0x1d');var _0x1a61c2=_0x5f1bf5[_0x3b7f('0x1f')];var _0x457215=_0x40b0b7?0x0:_0x4edad4['offset'];var _0x19ae31=_0x40b0b7?_0x5f1bf5[_0x3b7f('0x1f')]:_0x4edad4[_0x3b7f('0x1c')]+_0x4edad4[_0x3b7f('0x1e')];var _0x23bc3e;if(_0x19ae31>=_0x1a61c2){_0x19ae31=_0x1a61c2;_0x23bc3e=0xc8;}else{_0x23bc3e=0xce;}_0xfb369c[_0x3b7f('0x19')](_0x23bc3e);return _0xfb369c[_0x3b7f('0x20')](_0x3b7f('0x21'),_0x457215+'-'+_0x19ae31+'/'+_0x1a61c2)[_0x3b7f('0x1b')](_0x5f1bf5);}return null;};}function patchUpdates(_0x2980b6){return function(_0x25ed57){try{jsonpatch[_0x3b7f('0x22')](_0x25ed57,_0x2980b6,!![]);}catch(_0x127d07){return BPromise['reject'](_0x127d07);}return _0x25ed57[_0x3b7f('0x23')]();};}function saveUpdates(_0x426623,_0x5e14fd){return function(_0x2fe259){if(_0x2fe259){return _0x2fe259[_0x3b7f('0x24')](_0x426623)[_0x3b7f('0x25')](function(_0x5555e0){return _0x5555e0;});}return null;};}function removeEntity(_0x1c8edb,_0x3d5ccb){return function(_0x1c3404){if(_0x1c3404){return _0x1c3404[_0x3b7f('0x26')]()[_0x3b7f('0x25')](function(){_0x1c8edb[_0x3b7f('0x19')](0xcc)[_0x3b7f('0x1a')]();});}};}function handleEntityNotFound(_0x51aebb,_0x508a53){return function(_0x17b21a){if(!_0x17b21a){_0x51aebb[_0x3b7f('0x27')](0x194);}return _0x17b21a;};}function handleError(_0x39da1e,_0x5c686f){_0x5c686f=_0x5c686f||0x1f4;return function(_0x355fac){logger[_0x3b7f('0x28')](_0x355fac['stack']);if(_0x355fac[_0x3b7f('0x29')]){delete _0x355fac[_0x3b7f('0x29')];}_0x39da1e['status'](_0x5c686f)[_0x3b7f('0x2a')](_0x355fac);};}exports['index']=function(_0x133aa2,_0x10cf9c){var _0x47bf1e={},_0x219d64={},_0x4bd239={'count':0x0,'rows':[]};var _0x537d34=_[_0x3b7f('0x2b')](db[_0x3b7f('0x2c')][_0x3b7f('0x2d')],function(_0x164af5){return{'name':_0x164af5[_0x3b7f('0x2e')],'type':_0x164af5['type']['key']};});_0x219d64[_0x3b7f('0x2f')]=_[_0x3b7f('0x2b')](_0x537d34,_0x3b7f('0x29'));_0x219d64[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x133aa2[_0x3b7f('0x30')]);_0x219d64[_0x3b7f('0x32')]=_[_0x3b7f('0x33')](_0x219d64[_0x3b7f('0x2f')],_0x219d64[_0x3b7f('0x30')]);_0x47bf1e[_0x3b7f('0x34')]=_['intersection'](_0x219d64['model'],qs['fields'](_0x133aa2['query'][_0x3b7f('0x35')]));_0x47bf1e['attributes']=_0x47bf1e['attributes']['length']?_0x47bf1e[_0x3b7f('0x34')]:_0x219d64[_0x3b7f('0x2f')];if(!_0x133aa2['query'][_0x3b7f('0x36')]('nolimit')){_0x47bf1e[_0x3b7f('0x1e')]=qs[_0x3b7f('0x1e')](_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x1e')]);_0x47bf1e[_0x3b7f('0x1c')]=qs[_0x3b7f('0x1c')](_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}_0x47bf1e[_0x3b7f('0x37')]=qs[_0x3b7f('0x38')](_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x47bf1e[_0x3b7f('0x39')]=qs['filters'](_[_0x3b7f('0x3a')](_0x133aa2[_0x3b7f('0x30')],_0x219d64[_0x3b7f('0x32')]),_0x537d34);if(_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x3b')]){_0x47bf1e[_0x3b7f('0x39')]=_['merge'](_0x47bf1e[_0x3b7f('0x39')],{'$or':_[_0x3b7f('0x2b')](_0x537d34,function(_0x2b4ef1){if(_0x2b4ef1[_0x3b7f('0x3c')]!==_0x3b7f('0x3d')){var _0x416815={};_0x416815[_0x2b4ef1['name']]={'$like':'%'+_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x3b')]+'%'};return _0x416815;}})});}_0x47bf1e=_[_0x3b7f('0x3e')]({},_0x47bf1e,_0x133aa2[_0x3b7f('0x3f')]);var _0x5bc4f1={'where':_0x47bf1e['where']};return db[_0x3b7f('0x2c')]['count'](_0x5bc4f1)[_0x3b7f('0x25')](function(_0x361c4b){_0x4bd239[_0x3b7f('0x1f')]=_0x361c4b;if(_0x133aa2[_0x3b7f('0x30')][_0x3b7f('0x40')]){_0x47bf1e['include']=[{'all':!![]}];}return db[_0x3b7f('0x2c')][_0x3b7f('0x41')](_0x47bf1e);})[_0x3b7f('0x25')](function(_0x571d21){_0x4bd239[_0x3b7f('0x42')]=_0x571d21;return _0x4bd239;})['then'](respondWithFilteredResult(_0x10cf9c,_0x47bf1e))[_0x3b7f('0x43')](handleError(_0x10cf9c,null));};exports[_0x3b7f('0x44')]=function(_0x8777ec,_0x504a4c){var _0x1b17ce={'raw':![],'where':{'id':_0x8777ec['params']['id']}},_0x4882ae={};_0x4882ae['model']=_[_0x3b7f('0x31')](db['ServicenowConfiguration'][_0x3b7f('0x2d')]);_0x4882ae[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x8777ec[_0x3b7f('0x30')]);_0x4882ae['filters']=_[_0x3b7f('0x33')](_0x4882ae[_0x3b7f('0x2f')],_0x4882ae['query']);_0x1b17ce['attributes']=_[_0x3b7f('0x33')](_0x4882ae[_0x3b7f('0x2f')],qs[_0x3b7f('0x35')](_0x8777ec[_0x3b7f('0x30')][_0x3b7f('0x35')]));_0x1b17ce[_0x3b7f('0x34')]=_0x1b17ce[_0x3b7f('0x34')][_0x3b7f('0x45')]?_0x1b17ce['attributes']:_0x4882ae[_0x3b7f('0x2f')];if(_0x8777ec[_0x3b7f('0x30')]['includeAll']){_0x1b17ce['include']=[{'all':!![]}];}_0x1b17ce=_[_0x3b7f('0x3e')]({},_0x1b17ce,_0x8777ec[_0x3b7f('0x3f')]);return db['ServicenowConfiguration'][_0x3b7f('0x46')](_0x1b17ce)[_0x3b7f('0x25')](handleEntityNotFound(_0x504a4c,null))[_0x3b7f('0x25')](respondWithResult(_0x504a4c,null))[_0x3b7f('0x43')](handleError(_0x504a4c,null));};exports['create']=function(_0x131087,_0x30db96){return db[_0x3b7f('0x2c')]['create'](_0x131087[_0x3b7f('0x47')],{})[_0x3b7f('0x25')](respondWithResult(_0x30db96,0xc9))[_0x3b7f('0x43')](handleError(_0x30db96,null));};exports[_0x3b7f('0x24')]=function(_0x92cd9c,_0x531651){if(_0x92cd9c[_0x3b7f('0x47')]['id']){delete _0x92cd9c[_0x3b7f('0x47')]['id'];}return db['ServicenowConfiguration'][_0x3b7f('0x46')]({'where':{'id':_0x92cd9c[_0x3b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x531651,null))[_0x3b7f('0x25')](saveUpdates(_0x92cd9c['body'],null))['then'](respondWithResult(_0x531651,null))['catch'](handleError(_0x531651,null));};exports[_0x3b7f('0x26')]=function(_0x1cfca1,_0x36b739){return db[_0x3b7f('0x2c')][_0x3b7f('0x46')]({'where':{'id':_0x1cfca1[_0x3b7f('0x48')]['id']}})[_0x3b7f('0x25')](handleEntityNotFound(_0x36b739,null))[_0x3b7f('0x25')](removeEntity(_0x36b739,null))[_0x3b7f('0x43')](handleError(_0x36b739,null));};exports[_0x3b7f('0x49')]=function(_0x26524b,_0xefc558,_0x123313){var _0x11cedd={};var _0x1d689a={};var _0x3710b9;var _0x2d69f5;return db[_0x3b7f('0x2c')][_0x3b7f('0x4a')]({'where':{'id':_0x26524b[_0x3b7f('0x48')]['id']}})[_0x3b7f('0x25')](handleEntityNotFound(_0xefc558,null))[_0x3b7f('0x25')](function(_0x397e16){if(_0x397e16){_0x3710b9=_0x397e16;_0x1d689a[_0x3b7f('0x2f')]=_[_0x3b7f('0x31')](db[_0x3b7f('0x4b')]['rawAttributes']);_0x1d689a[_0x3b7f('0x30')]=_['keys'](_0x26524b[_0x3b7f('0x30')]);_0x1d689a['filters']=_['intersection'](_0x1d689a[_0x3b7f('0x2f')],_0x1d689a[_0x3b7f('0x30')]);_0x11cedd[_0x3b7f('0x34')]=_[_0x3b7f('0x33')](_0x1d689a[_0x3b7f('0x2f')],qs[_0x3b7f('0x35')](_0x26524b['query']['fields']));_0x11cedd[_0x3b7f('0x34')]=_0x11cedd[_0x3b7f('0x34')]['length']?_0x11cedd[_0x3b7f('0x34')]:_0x1d689a[_0x3b7f('0x2f')];_0x11cedd[_0x3b7f('0x37')]=qs[_0x3b7f('0x38')](_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x11cedd[_0x3b7f('0x39')]=qs[_0x3b7f('0x32')](_['pick'](_0x26524b[_0x3b7f('0x30')],_0x1d689a['filters']));if(_0x26524b[_0x3b7f('0x30')]['filter']){_0x11cedd['where']=_[_0x3b7f('0x3e')](_0x11cedd['where'],{'$or':_[_0x3b7f('0x2b')](_0x11cedd[_0x3b7f('0x34')],function(_0x16cff7){var _0x44544f={};_0x44544f[_0x16cff7]={'$like':'%'+_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x3b')]+'%'};return _0x44544f;})});}_0x11cedd=_[_0x3b7f('0x3e')]({},_0x11cedd,_0x26524b['options']);return _0x3710b9[_0x3b7f('0x49')](_0x11cedd);}})[_0x3b7f('0x25')](function(_0x4e1e7a){if(_0x4e1e7a){_0x2d69f5=_0x4e1e7a[_0x3b7f('0x45')];if(!_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x36')](_0x3b7f('0x4c'))){_0x11cedd['limit']=qs['limit'](_0x26524b['query']['limit']);_0x11cedd['offset']=qs[_0x3b7f('0x1c')](_0x26524b[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}return _0x3710b9[_0x3b7f('0x49')](_0x11cedd);}})[_0x3b7f('0x25')](function(_0xf4730){if(_0xf4730){return _0xf4730?{'count':_0x2d69f5,'rows':_0xf4730}:null;}})[_0x3b7f('0x25')](respondWithResult(_0xefc558,null))[_0x3b7f('0x43')](handleError(_0xefc558,null));};exports[_0x3b7f('0x4d')]=function(_0x3832c1,_0x97d090,_0x4915f1){var _0x495214={};var _0x4f53f9={};var _0x282798;var _0x58b9eb;return db[_0x3b7f('0x2c')][_0x3b7f('0x4a')]({'where':{'id':_0x3832c1[_0x3b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x97d090,null))['then'](function(_0x175bcb){if(_0x175bcb){_0x282798=_0x175bcb;_0x4f53f9[_0x3b7f('0x2f')]=_['keys'](db[_0x3b7f('0x4b')][_0x3b7f('0x2d')]);_0x4f53f9[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x3832c1[_0x3b7f('0x30')]);_0x4f53f9[_0x3b7f('0x32')]=_['intersection'](_0x4f53f9[_0x3b7f('0x2f')],_0x4f53f9[_0x3b7f('0x30')]);_0x495214[_0x3b7f('0x34')]=_[_0x3b7f('0x33')](_0x4f53f9['model'],qs[_0x3b7f('0x35')](_0x3832c1[_0x3b7f('0x30')]['fields']));_0x495214['attributes']=_0x495214[_0x3b7f('0x34')]['length']?_0x495214[_0x3b7f('0x34')]:_0x4f53f9[_0x3b7f('0x2f')];_0x495214[_0x3b7f('0x37')]=qs[_0x3b7f('0x38')](_0x3832c1[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x495214[_0x3b7f('0x39')]=qs[_0x3b7f('0x32')](_[_0x3b7f('0x3a')](_0x3832c1[_0x3b7f('0x30')],_0x4f53f9['filters']));if(_0x3832c1['query'][_0x3b7f('0x3b')]){_0x495214[_0x3b7f('0x39')]=_['merge'](_0x495214[_0x3b7f('0x39')],{'$or':_['map'](_0x495214[_0x3b7f('0x34')],function(_0x1db32f){var _0x114f67={};_0x114f67[_0x1db32f]={'$like':'%'+_0x3832c1[_0x3b7f('0x30')]['filter']+'%'};return _0x114f67;})});}_0x495214=_['merge']({},_0x495214,_0x3832c1[_0x3b7f('0x3f')]);return _0x282798['getSubjects'](_0x495214);}})[_0x3b7f('0x25')](function(_0x3132a5){if(_0x3132a5){_0x58b9eb=_0x3132a5['length'];if(!_0x3832c1[_0x3b7f('0x30')][_0x3b7f('0x36')](_0x3b7f('0x4c'))){_0x495214[_0x3b7f('0x1e')]=qs[_0x3b7f('0x1e')](_0x3832c1[_0x3b7f('0x30')]['limit']);_0x495214['offset']=qs[_0x3b7f('0x1c')](_0x3832c1[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}return _0x282798[_0x3b7f('0x4d')](_0x495214);}})[_0x3b7f('0x25')](function(_0x2a7324){if(_0x2a7324){return _0x2a7324?{'count':_0x58b9eb,'rows':_0x2a7324}:null;}})[_0x3b7f('0x25')](respondWithResult(_0x97d090,null))['catch'](handleError(_0x97d090,null));};exports[_0x3b7f('0x4e')]=function(_0x5bf7f3,_0x34dd0c,_0x1e65cd){var _0x4ea05a={};var _0x18747a={};var _0x473f93;var _0x732b0f;return db[_0x3b7f('0x2c')][_0x3b7f('0x4a')]({'where':{'id':_0x5bf7f3[_0x3b7f('0x48')]['id']}})[_0x3b7f('0x25')](handleEntityNotFound(_0x34dd0c,null))['then'](function(_0x4f84f4){if(_0x4f84f4){_0x473f93=_0x4f84f4;_0x18747a[_0x3b7f('0x2f')]=_[_0x3b7f('0x31')](db[_0x3b7f('0x4b')][_0x3b7f('0x2d')]);_0x18747a[_0x3b7f('0x30')]=_[_0x3b7f('0x31')](_0x5bf7f3[_0x3b7f('0x30')]);_0x18747a[_0x3b7f('0x32')]=_['intersection'](_0x18747a[_0x3b7f('0x2f')],_0x18747a[_0x3b7f('0x30')]);_0x4ea05a[_0x3b7f('0x34')]=_[_0x3b7f('0x33')](_0x18747a['model'],qs[_0x3b7f('0x35')](_0x5bf7f3['query'][_0x3b7f('0x35')]));_0x4ea05a[_0x3b7f('0x34')]=_0x4ea05a[_0x3b7f('0x34')]['length']?_0x4ea05a[_0x3b7f('0x34')]:_0x18747a[_0x3b7f('0x2f')];_0x4ea05a['order']=qs[_0x3b7f('0x38')](_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x38')]);_0x4ea05a[_0x3b7f('0x39')]=qs['filters'](_[_0x3b7f('0x3a')](_0x5bf7f3[_0x3b7f('0x30')],_0x18747a[_0x3b7f('0x32')]));if(_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x3b')]){_0x4ea05a[_0x3b7f('0x39')]=_[_0x3b7f('0x3e')](_0x4ea05a['where'],{'$or':_['map'](_0x4ea05a[_0x3b7f('0x34')],function(_0x419c05){var _0x5f34a2={};_0x5f34a2[_0x419c05]={'$like':'%'+_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x3b')]+'%'};return _0x5f34a2;})});}_0x4ea05a=_[_0x3b7f('0x3e')]({},_0x4ea05a,_0x5bf7f3['options']);return _0x473f93[_0x3b7f('0x4e')](_0x4ea05a);}})['then'](function(_0xcaf36d){if(_0xcaf36d){_0x732b0f=_0xcaf36d[_0x3b7f('0x45')];if(!_0x5bf7f3['query'][_0x3b7f('0x36')](_0x3b7f('0x4c'))){_0x4ea05a[_0x3b7f('0x1e')]=qs['limit'](_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x1e')]);_0x4ea05a[_0x3b7f('0x1c')]=qs[_0x3b7f('0x1c')](_0x5bf7f3[_0x3b7f('0x30')][_0x3b7f('0x1c')]);}return _0x473f93[_0x3b7f('0x4e')](_0x4ea05a);}})[_0x3b7f('0x25')](function(_0x149120){if(_0x149120){return _0x149120?{'count':_0x732b0f,'rows':_0x149120}:null;}})[_0x3b7f('0x25')](respondWithResult(_0x34dd0c,null))[_0x3b7f('0x43')](handleError(_0x34dd0c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a112b50..938b19d 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 _0x77f1=['util','../../config/logger','api','path','rimraf','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations'];(function(_0x323430,_0x3d2b6d){var _0x9eecd1=function(_0xab855a){while(--_0xab855a){_0x323430['push'](_0x323430['shift']());}};_0x9eecd1(++_0x3d2b6d);}(_0x77f1,0x1dd));var _0x177f=function(_0x47853d,_0x85705e){_0x47853d=_0x47853d-0x0;var _0x311e7b=_0x77f1[_0x47853d];return _0x311e7b;};'use strict';var _=require('lodash');var util=require(_0x177f('0x0'));var logger=require(_0x177f('0x1'))(_0x177f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x177f('0x3'));var rimraf=require(_0x177f('0x4'));var config=require('../../config/environment');var attributes=require(_0x177f('0x5'));module[_0x177f('0x6')]=function(_0x31c4de,_0x3f30a3){return _0x31c4de[_0x177f('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0x177f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd506=['rimraf','define','int_servicenow_configurations','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd506,0x197));var _0x6d50=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xd506[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x6d50('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d50('0x1'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x167f4e,_0x23c343){return _0x167f4e[_0x6d50('0x2')]('ServicenowConfiguration',attributes,{'tableName':_0x6d50('0x3'),'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 a5ea575..d673a47 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 _0x6b52=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0xe7d655,_0x184955){var _0x3e4804=function(_0x5cebfb){while(--_0x5cebfb){_0xe7d655['push'](_0xe7d655['shift']());}};_0x3e4804(++_0x184955);}(_0x6b52,0xdf));var _0x26b5=function(_0x4ddf3b,_0x406e3f){_0x4ddf3b=_0x4ddf3b-0x0;var _0x434dcf=_0x6b52[_0x4ddf3b];return _0x434dcf;};'use strict';var _=require(_0x26b5('0x0'));var util=require(_0x26b5('0x1'));var moment=require(_0x26b5('0x2'));var BPromise=require(_0x26b5('0x3'));var rs=require(_0x26b5('0x4'));var fs=require('fs');var Redis=require(_0x26b5('0x5'));var db=require(_0x26b5('0x6'))['db'];var utils=require(_0x26b5('0x7'));var logger=require(_0x26b5('0x8'))(_0x26b5('0x9'));var config=require('../../config/environment');var jayson=require(_0x26b5('0xa'));var client=jayson[_0x26b5('0xb')][_0x26b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20a9a4,_0x50d289,_0x1be869){return new BPromise(function(_0x35a6f9,_0x325478){return client['request'](_0x20a9a4,_0x1be869)[_0x26b5('0xd')](function(_0x3b034e){logger[_0x26b5('0xe')](_0x26b5('0xf'),_0x50d289,_0x26b5('0x10'));logger[_0x26b5('0x11')](_0x26b5('0x12'),_0x50d289,_0x26b5('0x10'),JSON[_0x26b5('0x13')](_0x3b034e));if(_0x3b034e[_0x26b5('0x14')]){if(_0x3b034e[_0x26b5('0x14')][_0x26b5('0x15')]===0x1f4){logger['error'](_0x26b5('0xf'),_0x50d289,_0x3b034e['error'][_0x26b5('0x16')]);return _0x325478(_0x3b034e[_0x26b5('0x14')]['message']);}logger[_0x26b5('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x50d289,_0x3b034e[_0x26b5('0x14')][_0x26b5('0x16')]);return _0x35a6f9(_0x3b034e[_0x26b5('0x14')][_0x26b5('0x16')]);}else{logger[_0x26b5('0xe')](_0x26b5('0xf'),_0x50d289,_0x26b5('0x10'));_0x35a6f9(_0x3b034e['result'][_0x26b5('0x16')]);}})[_0x26b5('0x17')](function(_0x3dee2c){logger[_0x26b5('0x14')](_0x26b5('0xf'),_0x50d289,_0x3dee2c);_0x325478(_0x3dee2c);});});} \ No newline at end of file +var _0x6afc=['stringify','error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x6afc,0x16b));var _0xc6af=function(_0x3167e6,_0x45b0ec){_0x3167e6=_0x3167e6-0x0;var _0x5cedc7=_0x6afc[_0x3167e6];return _0x5cedc7;};'use strict';var _=require(_0xc6af('0x0'));var util=require('util');var moment=require(_0xc6af('0x1'));var BPromise=require('bluebird');var rs=require(_0xc6af('0x2'));var fs=require('fs');var Redis=require(_0xc6af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6af('0x4'));var logger=require(_0xc6af('0x5'))(_0xc6af('0x6'));var config=require(_0xc6af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc6af('0x8')][_0xc6af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0485,_0x6d4994,_0x3bfb71){return new BPromise(function(_0x117df9,_0x57811b){return client[_0xc6af('0xa')](_0x3c0485,_0x3bfb71)[_0xc6af('0xb')](function(_0x5363c2){logger['info'](_0xc6af('0xc'),_0x6d4994,_0xc6af('0xd'));logger['debug'](_0xc6af('0xe'),_0x6d4994,_0xc6af('0xd'),JSON[_0xc6af('0xf')](_0x5363c2));if(_0x5363c2['error']){if(_0x5363c2[_0xc6af('0x10')]['code']===0x1f4){logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);return _0x57811b(_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);}logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x5363c2['error'][_0xc6af('0x11')]);return _0x117df9(_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);}else{logger[_0xc6af('0x12')](_0xc6af('0xc'),_0x6d4994,_0xc6af('0xd'));_0x117df9(_0x5363c2[_0xc6af('0x13')][_0xc6af('0x11')]);}})[_0xc6af('0x14')](function(_0x125e3f){logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x125e3f);_0x57811b(_0x125e3f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 08000ef..aa2244c 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 _0x7842=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7842,0xb1));var _0x2784=function(_0xc8a02c,_0x4809d3){_0xc8a02c=_0xc8a02c-0x0;var _0x3d89da=_0x7842[_0xc8a02c];return _0x3d89da;};'use strict';var multer=require(_0x2784('0x0'));var util=require(_0x2784('0x1'));var path=require(_0x2784('0x2'));var timeout=require('connect-timeout');var express=require(_0x2784('0x3'));var router=express['Router']();var fs_extra=require(_0x2784('0x4'));var auth=require(_0x2784('0x5'));var interaction=require(_0x2784('0x6'));var config=require(_0x2784('0x7'));var controller=require(_0x2784('0x8'));router[_0x2784('0x9')]('/',auth[_0x2784('0xa')](),controller[_0x2784('0xb')]);router['get'](_0x2784('0xc'),auth[_0x2784('0xa')](),controller[_0x2784('0xd')]);router['post']('/',auth[_0x2784('0xa')](),controller[_0x2784('0xe')]);router[_0x2784('0xf')](_0x2784('0xc'),auth[_0x2784('0xa')](),controller[_0x2784('0x10')]);router[_0x2784('0x11')](_0x2784('0xc'),auth[_0x2784('0xa')](),controller[_0x2784('0x12')]);module[_0x2784('0x13')]=router; \ No newline at end of file +var _0x716f=['./intServicenowField.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5c8be0,_0x2ced5e){var _0x41fbc6=function(_0x9bd4c7){while(--_0x9bd4c7){_0x5c8be0['push'](_0x5c8be0['shift']());}};_0x41fbc6(++_0x2ced5e);}(_0x716f,0x19b));var _0xf716=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x716f[_0x23b655];return _0x364b32;};'use strict';var multer=require(_0xf716('0x0'));var util=require(_0xf716('0x1'));var path=require(_0xf716('0x2'));var timeout=require(_0xf716('0x3'));var express=require(_0xf716('0x4'));var router=express[_0xf716('0x5')]();var fs_extra=require(_0xf716('0x6'));var auth=require(_0xf716('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf716('0x8'));var controller=require(_0xf716('0x9'));router[_0xf716('0xa')]('/',auth['isAuthenticated'](),controller[_0xf716('0xb')]);router[_0xf716('0xa')]('/:id',auth[_0xf716('0xc')](),controller['show']);router[_0xf716('0xd')]('/',auth[_0xf716('0xc')](),controller[_0xf716('0xe')]);router[_0xf716('0xf')](_0xf716('0x10'),auth[_0xf716('0xc')](),controller[_0xf716('0x11')]);router[_0xf716('0x12')]('/:id',auth[_0xf716('0xc')](),controller[_0xf716('0x13')]);module[_0xf716('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 99ddc15..e91664e 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 _0xf234=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf234,0x1ea));var _0x4f23=function(_0x881078,_0x530182){_0x881078=_0x881078-0x0;var _0x10e9ab=_0xf234[_0x881078];return _0x10e9ab;};'use strict';var Sequelize=require(_0x4f23('0x0'));module[_0x4f23('0x1')]={'type':{'type':Sequelize[_0x4f23('0x2')](_0x4f23('0x3'),_0x4f23('0x4'),_0x4f23('0x5'),'keyValue',_0x4f23('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4f23('0x7')]},'key':{'type':Sequelize[_0x4f23('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x4f23('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4f23('0x7')]},'customField':{'type':Sequelize[_0x4f23('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f23('0x7')]}}; \ No newline at end of file +var _0xa6c6=['STRING','customVariable','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x527a6c,_0x15b18d){var _0x4c780d=function(_0xebc03){while(--_0xebc03){_0x527a6c['push'](_0x527a6c['shift']());}};_0x4c780d(++_0x15b18d);}(_0xa6c6,0xba));var _0x6a6c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa6c6[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x6a6c('0x0'));module[_0x6a6c('0x1')]={'type':{'type':Sequelize[_0x6a6c('0x2')](_0x6a6c('0x3'),_0x6a6c('0x4'),'customVariable','keyValue',_0x6a6c('0x5')),'defaultValue':_0x6a6c('0x3')},'content':{'type':Sequelize[_0x6a6c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6a6c('0x2')](_0x6a6c('0x3'),'variable',_0x6a6c('0x7'))},'keyContent':{'type':Sequelize[_0x6a6c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6a6c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1a19e9f..26e5f35 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 _0xf468=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','key','model','keys','filters','query','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','ServicenowField','fields','length','options','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4cd9c6,_0x766862){var _0x53a566=function(_0xfb3fad){while(--_0xfb3fad){_0x4cd9c6['push'](_0x4cd9c6['shift']());}};_0x53a566(++_0x766862);}(_0xf468,0xce));var _0x8f46=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xf468[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require(_0x8f46('0x0'));var rimraf=require(_0x8f46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f46('0x2'));var rp=require('request-promise');var moment=require(_0x8f46('0x3'));var BPromise=require(_0x8f46('0x4'));var Mustache=require(_0x8f46('0x5'));var util=require(_0x8f46('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8f46('0x7'));var ejs=require(_0x8f46('0x8'));var fs=require('fs');var fs_extra=require(_0x8f46('0x9'));var _=require(_0x8f46('0xa'));var squel=require(_0x8f46('0xb'));var crypto=require(_0x8f46('0xc'));var jsforce=require(_0x8f46('0xd'));var deskjs=require(_0x8f46('0xe'));var toCsv=require(_0x8f46('0x7'));var querystring=require(_0x8f46('0xf'));var Papa=require(_0x8f46('0x10'));var Redis=require(_0x8f46('0x11'));var authService=require(_0x8f46('0x12'));var qs=require(_0x8f46('0x13'));var as=require(_0x8f46('0x14'));var hardwareService=require(_0x8f46('0x15'));var logger=require('../../config/logger')(_0x8f46('0x16'));var utils=require(_0x8f46('0x17'));var config=require(_0x8f46('0x18'));var licenseUtil=require(_0x8f46('0x19'));var db=require(_0x8f46('0x1a'))['db'];function respondWithStatusCode(_0x49cd73,_0x3ad3b7){_0x3ad3b7=_0x3ad3b7||0xcc;return function(_0x33185c){if(_0x33185c){return _0x49cd73[_0x8f46('0x1b')](_0x3ad3b7);}return _0x49cd73[_0x8f46('0x1c')](_0x3ad3b7)[_0x8f46('0x1d')]();};}function respondWithResult(_0x37924,_0x30dfc8){_0x30dfc8=_0x30dfc8||0xc8;return function(_0x49f1bc){if(_0x49f1bc){return _0x37924[_0x8f46('0x1c')](_0x30dfc8)[_0x8f46('0x1e')](_0x49f1bc);}};}function respondWithFilteredResult(_0x22d893,_0x1db4db){return function(_0x19fe87){if(_0x19fe87){var _0x2d9865=typeof _0x1db4db['offset']===_0x8f46('0x1f')&&typeof _0x1db4db[_0x8f46('0x20')]===_0x8f46('0x1f');var _0x519d7b=_0x19fe87[_0x8f46('0x21')];var _0x1f6db0=_0x2d9865?0x0:_0x1db4db['offset'];var _0x358c0e=_0x2d9865?_0x19fe87[_0x8f46('0x21')]:_0x1db4db[_0x8f46('0x22')]+_0x1db4db[_0x8f46('0x20')];var _0x5a297b;if(_0x358c0e>=_0x519d7b){_0x358c0e=_0x519d7b;_0x5a297b=0xc8;}else{_0x5a297b=0xce;}_0x22d893['status'](_0x5a297b);return _0x22d893['set'](_0x8f46('0x23'),_0x1f6db0+'-'+_0x358c0e+'/'+_0x519d7b)[_0x8f46('0x1e')](_0x19fe87);}return null;};}function patchUpdates(_0x147b06){return function(_0x586c29){try{jsonpatch[_0x8f46('0x24')](_0x586c29,_0x147b06,!![]);}catch(_0x20db81){return BPromise[_0x8f46('0x25')](_0x20db81);}return _0x586c29[_0x8f46('0x26')]();};}function saveUpdates(_0x4bfae6,_0x116f32){return function(_0xa6991b){if(_0xa6991b){return _0xa6991b[_0x8f46('0x27')](_0x4bfae6)[_0x8f46('0x28')](function(_0x581548){return _0x581548;});}return null;};}function removeEntity(_0x5f51d2,_0x1da0bd){return function(_0x38543e){if(_0x38543e){return _0x38543e[_0x8f46('0x29')]()[_0x8f46('0x28')](function(){_0x5f51d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fffd,_0x3d1326){return function(_0x5a6278){if(!_0x5a6278){_0x56fffd['sendStatus'](0x194);}return _0x5a6278;};}function handleError(_0x518de1,_0x49c836){_0x49c836=_0x49c836||0x1f4;return function(_0x4a03c2){logger['error'](_0x4a03c2['stack']);if(_0x4a03c2[_0x8f46('0x2a')]){delete _0x4a03c2[_0x8f46('0x2a')];}_0x518de1[_0x8f46('0x1c')](_0x49c836)['send'](_0x4a03c2);};}exports[_0x8f46('0x2b')]=function(_0x381074,_0x4c855e){var _0x5d3b58={},_0x3a9798={},_0x390f04={'count':0x0,'rows':[]};var _0x1c3ff8=_[_0x8f46('0x2c')](db['ServicenowField'][_0x8f46('0x2d')],function(_0x59d128){return{'name':_0x59d128[_0x8f46('0x2e')],'type':_0x59d128['type'][_0x8f46('0x2f')]};});_0x3a9798[_0x8f46('0x30')]=_[_0x8f46('0x2c')](_0x1c3ff8,'name');_0x3a9798['query']=_[_0x8f46('0x31')](_0x381074['query']);_0x3a9798[_0x8f46('0x32')]=_['intersection'](_0x3a9798[_0x8f46('0x30')],_0x3a9798[_0x8f46('0x33')]);_0x5d3b58['attributes']=_[_0x8f46('0x34')](_0x3a9798[_0x8f46('0x30')],qs['fields'](_0x381074['query']['fields']));_0x5d3b58[_0x8f46('0x35')]=_0x5d3b58[_0x8f46('0x35')]['length']?_0x5d3b58[_0x8f46('0x35')]:_0x3a9798['model'];if(!_0x381074[_0x8f46('0x33')][_0x8f46('0x36')](_0x8f46('0x37'))){_0x5d3b58[_0x8f46('0x20')]=qs[_0x8f46('0x20')](_0x381074[_0x8f46('0x33')]['limit']);_0x5d3b58[_0x8f46('0x22')]=qs[_0x8f46('0x22')](_0x381074[_0x8f46('0x33')][_0x8f46('0x22')]);}_0x5d3b58['order']=qs[_0x8f46('0x38')](_0x381074['query']['sort']);_0x5d3b58['where']=qs[_0x8f46('0x32')](_[_0x8f46('0x39')](_0x381074[_0x8f46('0x33')],_0x3a9798['filters']),_0x1c3ff8);if(_0x381074[_0x8f46('0x33')][_0x8f46('0x3a')]){_0x5d3b58[_0x8f46('0x3b')]=_['merge'](_0x5d3b58['where'],{'$or':_[_0x8f46('0x2c')](_0x1c3ff8,function(_0x27b74c){if(_0x27b74c['type']!==_0x8f46('0x3c')){var _0x455f9c={};_0x455f9c[_0x27b74c[_0x8f46('0x2a')]]={'$like':'%'+_0x381074[_0x8f46('0x33')][_0x8f46('0x3a')]+'%'};return _0x455f9c;}})});}_0x5d3b58=_[_0x8f46('0x3d')]({},_0x5d3b58,_0x381074['options']);var _0x2d30fc={'where':_0x5d3b58[_0x8f46('0x3b')]};return db['ServicenowField'][_0x8f46('0x21')](_0x2d30fc)[_0x8f46('0x28')](function(_0xe957f6){_0x390f04[_0x8f46('0x21')]=_0xe957f6;if(_0x381074[_0x8f46('0x33')][_0x8f46('0x3e')]){_0x5d3b58[_0x8f46('0x3f')]=[{'all':!![]}];}return db['ServicenowField'][_0x8f46('0x40')](_0x5d3b58);})['then'](function(_0x4b51b5){_0x390f04[_0x8f46('0x41')]=_0x4b51b5;return _0x390f04;})[_0x8f46('0x28')](respondWithFilteredResult(_0x4c855e,_0x5d3b58))[_0x8f46('0x42')](handleError(_0x4c855e,null));};exports[_0x8f46('0x43')]=function(_0x352bc6,_0x193cec){var _0x5de74d={'raw':!![],'where':{'id':_0x352bc6[_0x8f46('0x44')]['id']}},_0x5106b0={};_0x5106b0['model']=_[_0x8f46('0x31')](db[_0x8f46('0x45')]['rawAttributes']);_0x5106b0[_0x8f46('0x33')]=_['keys'](_0x352bc6[_0x8f46('0x33')]);_0x5106b0[_0x8f46('0x32')]=_[_0x8f46('0x34')](_0x5106b0[_0x8f46('0x30')],_0x5106b0[_0x8f46('0x33')]);_0x5de74d[_0x8f46('0x35')]=_['intersection'](_0x5106b0[_0x8f46('0x30')],qs['fields'](_0x352bc6[_0x8f46('0x33')][_0x8f46('0x46')]));_0x5de74d[_0x8f46('0x35')]=_0x5de74d[_0x8f46('0x35')][_0x8f46('0x47')]?_0x5de74d[_0x8f46('0x35')]:_0x5106b0[_0x8f46('0x30')];if(_0x352bc6[_0x8f46('0x33')][_0x8f46('0x3e')]){_0x5de74d[_0x8f46('0x3f')]=[{'all':!![]}];}_0x5de74d=_[_0x8f46('0x3d')]({},_0x5de74d,_0x352bc6[_0x8f46('0x48')]);return db[_0x8f46('0x45')][_0x8f46('0x49')](_0x5de74d)['then'](handleEntityNotFound(_0x193cec,null))[_0x8f46('0x28')](respondWithResult(_0x193cec,null))[_0x8f46('0x42')](handleError(_0x193cec,null));};exports[_0x8f46('0x4a')]=function(_0x4fca3f,_0x58fa6e){return db[_0x8f46('0x45')]['create'](_0x4fca3f[_0x8f46('0x4b')],{})[_0x8f46('0x28')](respondWithResult(_0x58fa6e,0xc9))[_0x8f46('0x42')](handleError(_0x58fa6e,null));};exports[_0x8f46('0x27')]=function(_0x3a5f5e,_0x165ef2){if(_0x3a5f5e['body']['id']){delete _0x3a5f5e[_0x8f46('0x4b')]['id'];}return db[_0x8f46('0x45')]['find']({'where':{'id':_0x3a5f5e['params']['id']}})['then'](handleEntityNotFound(_0x165ef2,null))[_0x8f46('0x28')](saveUpdates(_0x3a5f5e[_0x8f46('0x4b')],null))[_0x8f46('0x28')](respondWithResult(_0x165ef2,null))[_0x8f46('0x42')](handleError(_0x165ef2,null));};exports['destroy']=function(_0x5ddd3a,_0x3e0fea){return db[_0x8f46('0x45')][_0x8f46('0x49')]({'where':{'id':_0x5ddd3a[_0x8f46('0x44')]['id']}})[_0x8f46('0x28')](handleEntityNotFound(_0x3e0fea,null))['then'](removeEntity(_0x3e0fea,null))['catch'](handleError(_0x3e0fea,null));}; \ No newline at end of file +var _0x0362=['squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','rawAttributes','options','find','catch','create','body','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0362,0x8c));var _0x2036=function(_0xf78043,_0x5154d1){_0xf78043=_0xf78043-0x0;var _0xff3a16=_0x0362[_0xf78043];return _0xff3a16;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2036('0x0'));var jsonpatch=require(_0x2036('0x1'));var rp=require(_0x2036('0x2'));var moment=require('moment');var BPromise=require(_0x2036('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2036('0x4'));var sox=require(_0x2036('0x5'));var csv=require(_0x2036('0x6'));var ejs=require(_0x2036('0x7'));var fs=require('fs');var fs_extra=require(_0x2036('0x8'));var _=require(_0x2036('0x9'));var squel=require(_0x2036('0xa'));var crypto=require(_0x2036('0xb'));var jsforce=require(_0x2036('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2036('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2036('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2036('0xf'));var hardwareService=require(_0x2036('0x10'));var logger=require(_0x2036('0x11'))(_0x2036('0x12'));var utils=require(_0x2036('0x13'));var config=require(_0x2036('0x14'));var licenseUtil=require(_0x2036('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dd403,_0x182100){_0x182100=_0x182100||0xcc;return function(_0x33a8de){if(_0x33a8de){return _0x3dd403['sendStatus'](_0x182100);}return _0x3dd403[_0x2036('0x16')](_0x182100)[_0x2036('0x17')]();};}function respondWithResult(_0x2bebbc,_0x12db36){_0x12db36=_0x12db36||0xc8;return function(_0x45d374){if(_0x45d374){return _0x2bebbc[_0x2036('0x16')](_0x12db36)[_0x2036('0x18')](_0x45d374);}};}function respondWithFilteredResult(_0x4f4305,_0x5152db){return function(_0x5a5b4b){if(_0x5a5b4b){var _0x38deae=typeof _0x5152db['offset']===_0x2036('0x19')&&typeof _0x5152db['limit']===_0x2036('0x19');var _0xc7efc9=_0x5a5b4b[_0x2036('0x1a')];var _0xea56c3=_0x38deae?0x0:_0x5152db[_0x2036('0x1b')];var _0xb67e45=_0x38deae?_0x5a5b4b[_0x2036('0x1a')]:_0x5152db[_0x2036('0x1b')]+_0x5152db[_0x2036('0x1c')];var _0x976d71;if(_0xb67e45>=_0xc7efc9){_0xb67e45=_0xc7efc9;_0x976d71=0xc8;}else{_0x976d71=0xce;}_0x4f4305[_0x2036('0x16')](_0x976d71);return _0x4f4305[_0x2036('0x1d')](_0x2036('0x1e'),_0xea56c3+'-'+_0xb67e45+'/'+_0xc7efc9)[_0x2036('0x18')](_0x5a5b4b);}return null;};}function patchUpdates(_0x2bdd9a){return function(_0x166bd4){try{jsonpatch[_0x2036('0x1f')](_0x166bd4,_0x2bdd9a,!![]);}catch(_0x213552){return BPromise[_0x2036('0x20')](_0x213552);}return _0x166bd4[_0x2036('0x21')]();};}function saveUpdates(_0x3302a5,_0x3849a6){return function(_0x4633aa){if(_0x4633aa){return _0x4633aa[_0x2036('0x22')](_0x3302a5)['then'](function(_0x512d01){return _0x512d01;});}return null;};}function removeEntity(_0x20fc26,_0x6f8114){return function(_0x1fe036){if(_0x1fe036){return _0x1fe036[_0x2036('0x23')]()[_0x2036('0x24')](function(){_0x20fc26[_0x2036('0x16')](0xcc)[_0x2036('0x17')]();});}};}function handleEntityNotFound(_0x22c7aa,_0x513ac9){return function(_0x16f8f8){if(!_0x16f8f8){_0x22c7aa[_0x2036('0x25')](0x194);}return _0x16f8f8;};}function handleError(_0x2afdd6,_0x2d518e){_0x2d518e=_0x2d518e||0x1f4;return function(_0x4ba4dc){logger[_0x2036('0x26')](_0x4ba4dc[_0x2036('0x27')]);if(_0x4ba4dc['name']){delete _0x4ba4dc[_0x2036('0x28')];}_0x2afdd6[_0x2036('0x16')](_0x2d518e)[_0x2036('0x29')](_0x4ba4dc);};}exports[_0x2036('0x2a')]=function(_0x11f164,_0x4a699c){var _0x429abf={},_0x56955d={},_0xc48af7={'count':0x0,'rows':[]};var _0x5187af=_['map'](db[_0x2036('0x2b')]['rawAttributes'],function(_0x391343){return{'name':_0x391343[_0x2036('0x2c')],'type':_0x391343[_0x2036('0x2d')][_0x2036('0x2e')]};});_0x56955d[_0x2036('0x2f')]=_[_0x2036('0x30')](_0x5187af,_0x2036('0x28'));_0x56955d[_0x2036('0x31')]=_[_0x2036('0x32')](_0x11f164[_0x2036('0x31')]);_0x56955d[_0x2036('0x33')]=_[_0x2036('0x34')](_0x56955d['model'],_0x56955d['query']);_0x429abf['attributes']=_['intersection'](_0x56955d['model'],qs[_0x2036('0x35')](_0x11f164[_0x2036('0x31')]['fields']));_0x429abf[_0x2036('0x36')]=_0x429abf[_0x2036('0x36')][_0x2036('0x37')]?_0x429abf[_0x2036('0x36')]:_0x56955d[_0x2036('0x2f')];if(!_0x11f164[_0x2036('0x31')][_0x2036('0x38')](_0x2036('0x39'))){_0x429abf[_0x2036('0x1c')]=qs[_0x2036('0x1c')](_0x11f164['query'][_0x2036('0x1c')]);_0x429abf[_0x2036('0x1b')]=qs[_0x2036('0x1b')](_0x11f164[_0x2036('0x31')][_0x2036('0x1b')]);}_0x429abf[_0x2036('0x3a')]=qs['sort'](_0x11f164['query'][_0x2036('0x3b')]);_0x429abf[_0x2036('0x3c')]=qs[_0x2036('0x33')](_[_0x2036('0x3d')](_0x11f164[_0x2036('0x31')],_0x56955d[_0x2036('0x33')]),_0x5187af);if(_0x11f164[_0x2036('0x31')][_0x2036('0x3e')]){_0x429abf[_0x2036('0x3c')]=_[_0x2036('0x3f')](_0x429abf[_0x2036('0x3c')],{'$or':_[_0x2036('0x30')](_0x5187af,function(_0x52a8d1){if(_0x52a8d1[_0x2036('0x2d')]!==_0x2036('0x40')){var _0x3e403b={};_0x3e403b[_0x52a8d1[_0x2036('0x28')]]={'$like':'%'+_0x11f164['query'][_0x2036('0x3e')]+'%'};return _0x3e403b;}})});}_0x429abf=_[_0x2036('0x3f')]({},_0x429abf,_0x11f164['options']);var _0x2b540c={'where':_0x429abf[_0x2036('0x3c')]};return db[_0x2036('0x2b')][_0x2036('0x1a')](_0x2b540c)[_0x2036('0x24')](function(_0x4bcbe4){_0xc48af7[_0x2036('0x1a')]=_0x4bcbe4;if(_0x11f164[_0x2036('0x31')][_0x2036('0x41')]){_0x429abf[_0x2036('0x42')]=[{'all':!![]}];}return db[_0x2036('0x2b')]['findAll'](_0x429abf);})[_0x2036('0x24')](function(_0x4735ac){_0xc48af7['rows']=_0x4735ac;return _0xc48af7;})[_0x2036('0x24')](respondWithFilteredResult(_0x4a699c,_0x429abf))['catch'](handleError(_0x4a699c,null));};exports[_0x2036('0x43')]=function(_0x5936b6,_0x52c528){var _0x9213be={'raw':!![],'where':{'id':_0x5936b6[_0x2036('0x44')]['id']}},_0x5a6192={};_0x5a6192[_0x2036('0x2f')]=_[_0x2036('0x32')](db[_0x2036('0x2b')][_0x2036('0x45')]);_0x5a6192[_0x2036('0x31')]=_['keys'](_0x5936b6[_0x2036('0x31')]);_0x5a6192['filters']=_[_0x2036('0x34')](_0x5a6192['model'],_0x5a6192[_0x2036('0x31')]);_0x9213be[_0x2036('0x36')]=_[_0x2036('0x34')](_0x5a6192[_0x2036('0x2f')],qs[_0x2036('0x35')](_0x5936b6[_0x2036('0x31')]['fields']));_0x9213be[_0x2036('0x36')]=_0x9213be[_0x2036('0x36')][_0x2036('0x37')]?_0x9213be[_0x2036('0x36')]:_0x5a6192['model'];if(_0x5936b6['query'][_0x2036('0x41')]){_0x9213be[_0x2036('0x42')]=[{'all':!![]}];}_0x9213be=_['merge']({},_0x9213be,_0x5936b6[_0x2036('0x46')]);return db[_0x2036('0x2b')][_0x2036('0x47')](_0x9213be)['then'](handleEntityNotFound(_0x52c528,null))['then'](respondWithResult(_0x52c528,null))[_0x2036('0x48')](handleError(_0x52c528,null));};exports[_0x2036('0x49')]=function(_0x4e004f,_0x1510aa){return db[_0x2036('0x2b')][_0x2036('0x49')](_0x4e004f[_0x2036('0x4a')],{})['then'](respondWithResult(_0x1510aa,0xc9))[_0x2036('0x48')](handleError(_0x1510aa,null));};exports[_0x2036('0x22')]=function(_0x3dc272,_0x13002f){if(_0x3dc272['body']['id']){delete _0x3dc272[_0x2036('0x4a')]['id'];}return db[_0x2036('0x2b')][_0x2036('0x47')]({'where':{'id':_0x3dc272[_0x2036('0x44')]['id']}})[_0x2036('0x24')](handleEntityNotFound(_0x13002f,null))[_0x2036('0x24')](saveUpdates(_0x3dc272[_0x2036('0x4a')],null))[_0x2036('0x24')](respondWithResult(_0x13002f,null))['catch'](handleError(_0x13002f,null));};exports[_0x2036('0x23')]=function(_0x2a7715,_0x5bf60f){return db[_0x2036('0x2b')][_0x2036('0x47')]({'where':{'id':_0x2a7715['params']['id']}})[_0x2036('0x24')](handleEntityNotFound(_0x5bf60f,null))[_0x2036('0x24')](removeEntity(_0x5bf60f,null))[_0x2036('0x48')](handleError(_0x5bf60f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index f207967..d422413 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 _0x77f1=['api','bluebird','request-promise','path','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util'];(function(_0x456a01,_0x221b75){var _0x591772=function(_0x29174c){while(--_0x29174c){_0x456a01['push'](_0x456a01['shift']());}};_0x591772(++_0x221b75);}(_0x77f1,0x13e));var _0x177f=function(_0x2b653a,_0xa93a99){_0x2b653a=_0x2b653a-0x0;var _0x46628c=_0x77f1[_0x2b653a];return _0x46628c;};'use strict';var _=require('lodash');var util=require(_0x177f('0x0'));var logger=require('../../config/logger')(_0x177f('0x1'));var moment=require('moment');var BPromise=require(_0x177f('0x2'));var rp=require(_0x177f('0x3'));var fs=require('fs');var path=require(_0x177f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x646046,_0x32dc75){return _0x646046[_0x177f('0x5')](_0x177f('0x6'),attributes,{'tableName':_0x177f('0x7'),'paranoid':![],'indexes':[{'name':_0x177f('0x8'),'fields':[_0x177f('0x9'),_0x177f('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2c1=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','FieldId'];(function(_0x54e4fd,_0x4059d4){var _0x50cbb2=function(_0x47549d){while(--_0x47549d){_0x54e4fd['push'](_0x54e4fd['shift']());}};_0x50cbb2(++_0x4059d4);}(_0xf2c1,0x15e));var _0x1f2c=function(_0x2d9a60,_0x1b5bc1){_0x2d9a60=_0x2d9a60-0x0;var _0x8f442=_0xf2c1[_0x2d9a60];return _0x8f442;};'use strict';var _=require(_0x1f2c('0x0'));var util=require(_0x1f2c('0x1'));var logger=require('../../config/logger')(_0x1f2c('0x2'));var moment=require(_0x1f2c('0x3'));var BPromise=require(_0x1f2c('0x4'));var rp=require(_0x1f2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f2c('0x6'));var config=require(_0x1f2c('0x7'));var attributes=require(_0x1f2c('0x8'));module[_0x1f2c('0x9')]=function(_0x4b7dfa,_0x5ce209){return _0x4b7dfa[_0x1f2c('0xa')]('ServicenowField',attributes,{'tableName':_0x1f2c('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1f2c('0xc'),_0x1f2c('0xd')],'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 fefa6ba..e60f108 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xac4a,0x13f));var _0xaac4=function(_0x15b088,_0x1475b6){_0x15b088=_0x15b088-0x0;var _0x57956b=_0xac4a[_0x15b088];return _0x57956b;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x927617,_0x25e6f8){_0x927617=_0x927617-0x0;var _0x85a341=_0xac4a[_0x927617];return _0x85a341;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b311d09..482a323 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x19812c,_0x4f07cb){var _0x96080a=function(_0x123c0e){while(--_0x123c0e){_0x19812c['push'](_0x19812c['shift']());}};_0x96080a(++_0x4f07cb);}(_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/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xd474e4,_0x1a4804){var _0x314957=function(_0xe1e04){while(--_0xe1e04){_0xd474e4['push'](_0xd474e4['shift']());}};_0x314957(++_0x1a4804);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 1980a29..f0a6199 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(_0x23b21d,_0x36f8cc){var _0x5b9ac4=function(_0x286647){while(--_0x286647){_0x23b21d['push'](_0x23b21d['shift']());}};_0x5b9ac4(++_0x36f8cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x1e9718,_0x1f5555){var _0x491d4f=function(_0x4a01de){while(--_0x4a01de){_0x1e9718['push'](_0x1e9718['shift']());}};_0x491d4f(++_0x1f5555);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 1d04736..1169c76 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 _0x3c2a=['channel','Descriptions','create','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','Password\x20Expired','format','%s%s','stringify','Calls','values','module_fields','endsWith','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','findAll','catch','show','params','rawAttributes','find','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x16621a,_0x3d783e){var _0x385b10=function(_0x4f1639){while(--_0x4f1639){_0x16621a['push'](_0x16621a['shift']());}};_0x385b10(++_0x3d783e);}(_0x3c2a,0x10f));var _0xa3c2=function(_0x76c3be,_0x30cad1){_0x76c3be=_0x76c3be-0x0;var _0x4a92d2=_0x3c2a[_0x76c3be];return _0x4a92d2;};'use strict';var emlformat=require(_0xa3c2('0x0'));var rimraf=require(_0xa3c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3c2('0x2'));var rp=require(_0xa3c2('0x3'));var moment=require(_0xa3c2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa3c2('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa3c2('0x6'));var csv=require(_0xa3c2('0x7'));var ejs=require(_0xa3c2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3c2('0x9'));var squel=require(_0xa3c2('0xa'));var crypto=require(_0xa3c2('0xb'));var jsforce=require(_0xa3c2('0xc'));var deskjs=require(_0xa3c2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa3c2('0xe'));var Papa=require(_0xa3c2('0xf'));var Redis=require('ioredis');var authService=require(_0xa3c2('0x10'));var qs=require(_0xa3c2('0x11'));var as=require(_0xa3c2('0x12'));var hardwareService=require(_0xa3c2('0x13'));var logger=require('../../config/logger')(_0xa3c2('0x14'));var utils=require(_0xa3c2('0x15'));var config=require(_0xa3c2('0x16'));var licenseUtil=require(_0xa3c2('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa3c2('0x18'));function respondWithStatusCode(_0x2990cb,_0x12d4ce){_0x12d4ce=_0x12d4ce||0xcc;return function(_0x55576a){if(_0x55576a){return _0x2990cb[_0xa3c2('0x19')](_0x12d4ce);}return _0x2990cb[_0xa3c2('0x1a')](_0x12d4ce)[_0xa3c2('0x1b')]();};}function respondWithResult(_0x6c4933,_0x4a78e8){_0x4a78e8=_0x4a78e8||0xc8;return function(_0x22dc3a){if(_0x22dc3a){return _0x6c4933[_0xa3c2('0x1a')](_0x4a78e8)[_0xa3c2('0x1c')](_0x22dc3a);}};}function respondWithFilteredResult(_0x3b7454,_0x1e9dd6){return function(_0x1d39c8){if(_0x1d39c8){var _0x510747=typeof _0x1e9dd6[_0xa3c2('0x1d')]===_0xa3c2('0x1e')&&typeof _0x1e9dd6[_0xa3c2('0x1f')]===_0xa3c2('0x1e');var _0x258c83=_0x1d39c8[_0xa3c2('0x20')];var _0x253979=_0x510747?0x0:_0x1e9dd6['offset'];var _0x36207f=_0x510747?_0x1d39c8['count']:_0x1e9dd6[_0xa3c2('0x1d')]+_0x1e9dd6['limit'];var _0x5e38fc;if(_0x36207f>=_0x258c83){_0x36207f=_0x258c83;_0x5e38fc=0xc8;}else{_0x5e38fc=0xce;}_0x3b7454[_0xa3c2('0x1a')](_0x5e38fc);return _0x3b7454[_0xa3c2('0x21')](_0xa3c2('0x22'),_0x253979+'-'+_0x36207f+'/'+_0x258c83)[_0xa3c2('0x1c')](_0x1d39c8);}return null;};}function patchUpdates(_0x30ccb7){return function(_0x1fb9e3){try{jsonpatch[_0xa3c2('0x23')](_0x1fb9e3,_0x30ccb7,!![]);}catch(_0x523f63){return BPromise[_0xa3c2('0x24')](_0x523f63);}return _0x1fb9e3['save']();};}function saveUpdates(_0x37458f,_0x439358){return function(_0x1c3cf6){if(_0x1c3cf6){return _0x1c3cf6[_0xa3c2('0x25')](_0x37458f)[_0xa3c2('0x26')](function(_0x2bcbbc){return _0x2bcbbc;});}return null;};}function removeEntity(_0x18ac8f,_0x243862){return function(_0xf9d3f1){if(_0xf9d3f1){return _0xf9d3f1['destroy']()[_0xa3c2('0x26')](function(){_0x18ac8f['status'](0xcc)[_0xa3c2('0x1b')]();});}};}function handleEntityNotFound(_0x126f5d,_0x3b5186){return function(_0x35c140){if(!_0x35c140){_0x126f5d['sendStatus'](0x194);}return _0x35c140;};}function handleError(_0x3ff46e,_0x17b04b){_0x17b04b=_0x17b04b||0x1f4;return function(_0x435916){logger['error'](_0x435916['stack']);if(_0x435916['name']){delete _0x435916[_0xa3c2('0x27')];}_0x3ff46e[_0xa3c2('0x1a')](_0x17b04b)[_0xa3c2('0x28')](_0x435916);};}exports[_0xa3c2('0x29')]=function(_0x4c5bee,_0xa429ac){var _0x1e7b15={},_0x3ebb85={},_0x20efab={'count':0x0,'rows':[]};var _0x17f16d=_[_0xa3c2('0x2a')](db[_0xa3c2('0x2b')]['rawAttributes'],function(_0xbabfa7){return{'name':_0xbabfa7[_0xa3c2('0x2c')],'type':_0xbabfa7[_0xa3c2('0x2d')][_0xa3c2('0x2e')]};});_0x3ebb85[_0xa3c2('0x2f')]=_[_0xa3c2('0x2a')](_0x17f16d,_0xa3c2('0x27'));_0x3ebb85[_0xa3c2('0x30')]=_[_0xa3c2('0x31')](_0x4c5bee[_0xa3c2('0x30')]);_0x3ebb85['filters']=_[_0xa3c2('0x32')](_0x3ebb85[_0xa3c2('0x2f')],_0x3ebb85[_0xa3c2('0x30')]);_0x1e7b15[_0xa3c2('0x33')]=_[_0xa3c2('0x32')](_0x3ebb85['model'],qs[_0xa3c2('0x34')](_0x4c5bee[_0xa3c2('0x30')]['fields']));_0x1e7b15['attributes']=_0x1e7b15['attributes'][_0xa3c2('0x35')]?_0x1e7b15[_0xa3c2('0x33')]:_0x3ebb85[_0xa3c2('0x2f')];if(!_0x4c5bee[_0xa3c2('0x30')][_0xa3c2('0x36')](_0xa3c2('0x37'))){_0x1e7b15[_0xa3c2('0x1f')]=qs[_0xa3c2('0x1f')](_0x4c5bee[_0xa3c2('0x30')][_0xa3c2('0x1f')]);_0x1e7b15[_0xa3c2('0x1d')]=qs['offset'](_0x4c5bee[_0xa3c2('0x30')][_0xa3c2('0x1d')]);}_0x1e7b15[_0xa3c2('0x38')]=qs[_0xa3c2('0x39')](_0x4c5bee[_0xa3c2('0x30')]['sort']);_0x1e7b15[_0xa3c2('0x3a')]=qs[_0xa3c2('0x3b')](_[_0xa3c2('0x3c')](_0x4c5bee[_0xa3c2('0x30')],_0x3ebb85[_0xa3c2('0x3b')]),_0x17f16d);if(_0x4c5bee[_0xa3c2('0x30')]['filter']){_0x1e7b15['where']=_[_0xa3c2('0x3d')](_0x1e7b15[_0xa3c2('0x3a')],{'$or':_[_0xa3c2('0x2a')](_0x17f16d,function(_0x13d10a){if(_0x13d10a[_0xa3c2('0x2d')]!=='VIRTUAL'){var _0x4ef1e4={};_0x4ef1e4[_0x13d10a['name']]={'$like':'%'+_0x4c5bee[_0xa3c2('0x30')][_0xa3c2('0x3e')]+'%'};return _0x4ef1e4;}})});}_0x1e7b15=_['merge']({},_0x1e7b15,_0x4c5bee[_0xa3c2('0x3f')]);var _0x7903ce={'where':_0x1e7b15[_0xa3c2('0x3a')]};return db[_0xa3c2('0x2b')][_0xa3c2('0x20')](_0x7903ce)['then'](function(_0x54ba69){_0x20efab['count']=_0x54ba69;if(_0x4c5bee[_0xa3c2('0x30')][_0xa3c2('0x40')]){_0x1e7b15['include']=[{'all':!![]}];}return db[_0xa3c2('0x2b')][_0xa3c2('0x41')](_0x1e7b15);})[_0xa3c2('0x26')](function(_0x31f707){_0x20efab['rows']=_0x31f707;return _0x20efab;})[_0xa3c2('0x26')](respondWithFilteredResult(_0xa429ac,_0x1e7b15))[_0xa3c2('0x42')](handleError(_0xa429ac,null));};exports[_0xa3c2('0x43')]=function(_0x28d0b9,_0x100f11){var _0x392cfc={'raw':![],'where':{'id':_0x28d0b9[_0xa3c2('0x44')]['id']}},_0x10a185={};_0x10a185[_0xa3c2('0x2f')]=_[_0xa3c2('0x31')](db[_0xa3c2('0x2b')][_0xa3c2('0x45')]);_0x10a185[_0xa3c2('0x30')]=_[_0xa3c2('0x31')](_0x28d0b9[_0xa3c2('0x30')]);_0x10a185['filters']=_[_0xa3c2('0x32')](_0x10a185[_0xa3c2('0x2f')],_0x10a185[_0xa3c2('0x30')]);_0x392cfc[_0xa3c2('0x33')]=_[_0xa3c2('0x32')](_0x10a185[_0xa3c2('0x2f')],qs[_0xa3c2('0x34')](_0x28d0b9[_0xa3c2('0x30')][_0xa3c2('0x34')]));_0x392cfc['attributes']=_0x392cfc[_0xa3c2('0x33')][_0xa3c2('0x35')]?_0x392cfc['attributes']:_0x10a185[_0xa3c2('0x2f')];if(_0x28d0b9[_0xa3c2('0x30')][_0xa3c2('0x40')]){_0x392cfc['include']=[{'all':!![]}];}_0x392cfc=_['merge']({},_0x392cfc,_0x28d0b9[_0xa3c2('0x3f')]);return db[_0xa3c2('0x2b')][_0xa3c2('0x46')](_0x392cfc)[_0xa3c2('0x26')](handleEntityNotFound(_0x100f11,null))[_0xa3c2('0x26')](respondWithResult(_0x100f11,null))[_0xa3c2('0x42')](handleError(_0x100f11,null));};exports['create']=function(_0x5d9350,_0x277a9b){return db[_0xa3c2('0x2b')]['create'](_0x5d9350[_0xa3c2('0x47')],{})[_0xa3c2('0x26')](respondWithResult(_0x277a9b,0xc9))[_0xa3c2('0x42')](handleError(_0x277a9b,null));};exports['update']=function(_0x261c19,_0x15f93a){if(_0x261c19['body']['id']){delete _0x261c19[_0xa3c2('0x47')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x261c19[_0xa3c2('0x44')]['id']}})[_0xa3c2('0x26')](handleEntityNotFound(_0x15f93a,null))['then'](saveUpdates(_0x261c19[_0xa3c2('0x47')],null))[_0xa3c2('0x26')](respondWithResult(_0x15f93a,null))['catch'](handleError(_0x15f93a,null));};exports[_0xa3c2('0x48')]=function(_0x2035e7,_0x53c7a6){return db[_0xa3c2('0x2b')]['find']({'where':{'id':_0x2035e7[_0xa3c2('0x44')]['id']}})[_0xa3c2('0x26')](handleEntityNotFound(_0x53c7a6,null))[_0xa3c2('0x26')](removeEntity(_0x53c7a6,null))[_0xa3c2('0x42')](handleError(_0x53c7a6,null));};exports[_0xa3c2('0x49')]=function(_0x48ce24,_0x1195c6,_0x56af41){var _0xfe9def={};var _0x378bf5={};var _0xa09ef;var _0x36cbe0;return db[_0xa3c2('0x2b')][_0xa3c2('0x4a')]({'where':{'id':_0x48ce24[_0xa3c2('0x44')]['id']}})['then'](handleEntityNotFound(_0x1195c6,null))[_0xa3c2('0x26')](function(_0x357d0c){if(_0x357d0c){_0xa09ef=_0x357d0c;_0x378bf5[_0xa3c2('0x2f')]=_[_0xa3c2('0x31')](db[_0xa3c2('0x4b')][_0xa3c2('0x45')]);_0x378bf5['query']=_[_0xa3c2('0x31')](_0x48ce24['query']);_0x378bf5[_0xa3c2('0x3b')]=_['intersection'](_0x378bf5['model'],_0x378bf5['query']);_0xfe9def[_0xa3c2('0x33')]=_[_0xa3c2('0x32')](_0x378bf5[_0xa3c2('0x2f')],qs[_0xa3c2('0x34')](_0x48ce24[_0xa3c2('0x30')][_0xa3c2('0x34')]));_0xfe9def[_0xa3c2('0x33')]=_0xfe9def[_0xa3c2('0x33')][_0xa3c2('0x35')]?_0xfe9def[_0xa3c2('0x33')]:_0x378bf5[_0xa3c2('0x2f')];_0xfe9def['order']=qs[_0xa3c2('0x39')](_0x48ce24['query'][_0xa3c2('0x39')]);_0xfe9def[_0xa3c2('0x3a')]=qs[_0xa3c2('0x3b')](_[_0xa3c2('0x3c')](_0x48ce24['query'],_0x378bf5[_0xa3c2('0x3b')]));if(_0x48ce24[_0xa3c2('0x30')][_0xa3c2('0x3e')]){_0xfe9def[_0xa3c2('0x3a')]=_[_0xa3c2('0x3d')](_0xfe9def[_0xa3c2('0x3a')],{'$or':_[_0xa3c2('0x2a')](_0xfe9def[_0xa3c2('0x33')],function(_0x2c9aa4){var _0x33f2f1={};_0x33f2f1[_0x2c9aa4]={'$like':'%'+_0x48ce24[_0xa3c2('0x30')][_0xa3c2('0x3e')]+'%'};return _0x33f2f1;})});}_0xfe9def=_[_0xa3c2('0x3d')]({},_0xfe9def,_0x48ce24[_0xa3c2('0x3f')]);return _0xa09ef[_0xa3c2('0x49')](_0xfe9def);}})[_0xa3c2('0x26')](function(_0x16b115){if(_0x16b115){_0x36cbe0=_0x16b115[_0xa3c2('0x35')];if(!_0x48ce24[_0xa3c2('0x30')][_0xa3c2('0x36')]('nolimit')){_0xfe9def[_0xa3c2('0x1f')]=qs['limit'](_0x48ce24[_0xa3c2('0x30')]['limit']);_0xfe9def['offset']=qs[_0xa3c2('0x1d')](_0x48ce24['query'][_0xa3c2('0x1d')]);}return _0xa09ef[_0xa3c2('0x49')](_0xfe9def);}})[_0xa3c2('0x26')](function(_0x6eb268){if(_0x6eb268){return _0x6eb268?{'count':_0x36cbe0,'rows':_0x6eb268}:null;}})[_0xa3c2('0x26')](respondWithResult(_0x1195c6,null))['catch'](handleError(_0x1195c6,null));};exports[_0xa3c2('0x4c')]=function(_0x93a2e5,_0x342259,_0x4a0d1b){if(_0x93a2e5[_0xa3c2('0x47')]['id']){delete _0x93a2e5[_0xa3c2('0x47')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x93a2e5[_0xa3c2('0x44')]['id']}})[_0xa3c2('0x26')](handleEntityNotFound(_0x342259,null))['then'](function(_0x1f1197){if(_0x1f1197){_0x93a2e5[_0xa3c2('0x47')][_0xa3c2('0x4d')]=_0x1f1197['id'];_0x93a2e5[_0xa3c2('0x47')][_0xa3c2('0x4e')]=integrations[_0xa3c2('0x4f')](_0x93a2e5[_0xa3c2('0x47')][_0xa3c2('0x50')],_0x93a2e5[_0xa3c2('0x47')][_0xa3c2('0x2d')]);_0x93a2e5['body'][_0xa3c2('0x51')]=integrations['getDescriptions'](_0x93a2e5[_0xa3c2('0x47')]['channel'],_0x93a2e5['body'][_0xa3c2('0x2d')]);return db[_0xa3c2('0x4b')][_0xa3c2('0x52')](_0x93a2e5[_0xa3c2('0x47')],{'include':[{'model':db[_0xa3c2('0x53')],'as':'Subjects'},{'model':db[_0xa3c2('0x53')],'as':_0xa3c2('0x51')}]});}return null;})[_0xa3c2('0x26')](respondWithResult(_0x342259,null))['catch'](handleError(_0x342259,null));};exports['getFields']=function(_0x27801e,_0x1aa458,_0x38c55c){var _0x306e1c='';var _0x5b6839=['id',_0xa3c2('0x27'),_0xa3c2('0x54'),_0xa3c2('0x55'),_0xa3c2('0x56'),_0xa3c2('0x57'),'duration_hours',_0xa3c2('0x58'),_0xa3c2('0x59'),_0xa3c2('0x5a'),_0xa3c2('0x5b'),_0xa3c2('0x5c')];return db[_0xa3c2('0x2b')][_0xa3c2('0x4a')]({'where':{'id':_0x27801e[_0xa3c2('0x44')]['id']},'attributes':['id',_0xa3c2('0x5d'),_0xa3c2('0x5e'),_0xa3c2('0x5f')]})[_0xa3c2('0x26')](handleEntityNotFound(_0x1aa458,null))['then'](function(_0x545a4d){if(_0x545a4d){_0x306e1c=_0x545a4d[_0xa3c2('0x5f')];var _0x3a6002=_0x306e1c[_0xa3c2('0x60')](-0x1);if(_0x3a6002==='/'){_0x306e1c=_0x306e1c[_0xa3c2('0x61')](0x0,_0x306e1c[_0xa3c2('0x62')](_0x3a6002));}return rp({'method':_0xa3c2('0x63'),'uri':util['format']('%s%s',_0x306e1c,_0xa3c2('0x64')),'json':!![],'form':{'method':_0xa3c2('0x65'),'input_type':_0xa3c2('0x66'),'response_type':_0xa3c2('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x545a4d[_0xa3c2('0x5d')],'password':_0x545a4d[_0xa3c2('0x5e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x5cd26d){if(_0x5cd26d&&_0x5cd26d['name']!=='Invalid\x20Login'&&_0x5cd26d[_0xa3c2('0x27')]!==_0xa3c2('0x67')){return rp({'method':_0xa3c2('0x63'),'uri':util[_0xa3c2('0x68')](_0xa3c2('0x69'),_0x306e1c,_0xa3c2('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xa3c2('0x66'),'response_type':_0xa3c2('0x66'),'rest_data':JSON[_0xa3c2('0x6a')]({'session':_0x5cd26d['id'],'module_name':_0xa3c2('0x6b')})}})[_0xa3c2('0x26')](function(_0x53a1bf){if(_0x53a1bf){var _0x4860e3=_[_0xa3c2('0x6c')](_0x53a1bf[_0xa3c2('0x6d')]);_['remove'](_0x4860e3,function(_0x45599e){return _0x5b6839['includes'](_0x45599e[_0xa3c2('0x27')]);});return{'count':_0x4860e3[_0xa3c2('0x35')],'rows':_[_0xa3c2('0x2a')](_0x4860e3,function(_0x1a0d4d){return{'id':_0x1a0d4d[_0xa3c2('0x27')],'name':_0x1a0d4d['label'],'custom':_[_0xa3c2('0x6e')](_0x1a0d4d['name'],'_c')?!![]:![],'options':_0x1a0d4d['options']?_['map'](_[_0xa3c2('0x6c')](_0x1a0d4d['options']),function(_0x35b1c1){return{'name':_0x35b1c1['value'],'value':_0x35b1c1['name']};}):[]};})};}})[_0xa3c2('0x26')](respondWithResult(_0x1aa458,null))[_0xa3c2('0x42')](function(_0x598211){var _0x2cdb36=_0x27801e[_0xa3c2('0x30')][_0xa3c2('0x6f')]?0x1f4:_0x598211[_0xa3c2('0x70')]||0x1f4;logger[_0xa3c2('0x71')](_0xa3c2('0x72'),_0xa3c2('0x73'),_0x2cdb36,JSON[_0xa3c2('0x6a')](_0x598211));delete _0x598211[_0xa3c2('0x27')];if(_0x2cdb36===0x191){_0x2cdb36=0x190;}_0x1aa458[_0xa3c2('0x1a')](_0x2cdb36)[_0xa3c2('0x28')](_0x27801e[_0xa3c2('0x30')][_0xa3c2('0x6f')]?{'message':_0xa3c2('0x74'),'statusCode':_0x598211[_0xa3c2('0x70')]}:_0x598211);});}else{var _0x3bb832=0x1f4;_0x1aa458[_0xa3c2('0x1a')](_0x3bb832)[_0xa3c2('0x28')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xa9ed=['values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','findOne','SugarcrmConfiguration','order','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','JSON','Calls','module_fields','remove','includes','endsWith'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9ed,0x187));var _0xda9e=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xa9ed[_0x1d87fc];return _0x492b56;};'use strict';var emlformat=require(_0xda9e('0x0'));var rimraf=require(_0xda9e('0x1'));var zipdir=require(_0xda9e('0x2'));var jsonpatch=require(_0xda9e('0x3'));var rp=require(_0xda9e('0x4'));var moment=require('moment');var BPromise=require(_0xda9e('0x5'));var Mustache=require(_0xda9e('0x6'));var util=require(_0xda9e('0x7'));var path=require(_0xda9e('0x8'));var sox=require(_0xda9e('0x9'));var csv=require(_0xda9e('0xa'));var ejs=require(_0xda9e('0xb'));var fs=require('fs');var fs_extra=require(_0xda9e('0xc'));var _=require(_0xda9e('0xd'));var squel=require(_0xda9e('0xe'));var crypto=require(_0xda9e('0xf'));var jsforce=require(_0xda9e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xda9e('0xa'));var querystring=require(_0xda9e('0x11'));var Papa=require(_0xda9e('0x12'));var Redis=require(_0xda9e('0x13'));var authService=require(_0xda9e('0x14'));var qs=require(_0xda9e('0x15'));var as=require(_0xda9e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda9e('0x17'))(_0xda9e('0x18'));var utils=require(_0xda9e('0x19'));var config=require(_0xda9e('0x1a'));var licenseUtil=require(_0xda9e('0x1b'));var db=require(_0xda9e('0x1c'))['db'];var integrations=require(_0xda9e('0x1d'));function respondWithStatusCode(_0x2a23e6,_0x55ede6){_0x55ede6=_0x55ede6||0xcc;return function(_0x4a43bd){if(_0x4a43bd){return _0x2a23e6[_0xda9e('0x1e')](_0x55ede6);}return _0x2a23e6[_0xda9e('0x1f')](_0x55ede6)[_0xda9e('0x20')]();};}function respondWithResult(_0x27b637,_0x2b8e08){_0x2b8e08=_0x2b8e08||0xc8;return function(_0x29c239){if(_0x29c239){return _0x27b637['status'](_0x2b8e08)[_0xda9e('0x21')](_0x29c239);}};}function respondWithFilteredResult(_0x368003,_0x2d8cef){return function(_0x482da8){if(_0x482da8){var _0x104694=typeof _0x2d8cef[_0xda9e('0x22')]===_0xda9e('0x23')&&typeof _0x2d8cef['limit']===_0xda9e('0x23');var _0x1d316e=_0x482da8[_0xda9e('0x24')];var _0x2871b8=_0x104694?0x0:_0x2d8cef[_0xda9e('0x22')];var _0x5d9678=_0x104694?_0x482da8[_0xda9e('0x24')]:_0x2d8cef[_0xda9e('0x22')]+_0x2d8cef[_0xda9e('0x25')];var _0xf4a7a3;if(_0x5d9678>=_0x1d316e){_0x5d9678=_0x1d316e;_0xf4a7a3=0xc8;}else{_0xf4a7a3=0xce;}_0x368003[_0xda9e('0x1f')](_0xf4a7a3);return _0x368003[_0xda9e('0x26')](_0xda9e('0x27'),_0x2871b8+'-'+_0x5d9678+'/'+_0x1d316e)['json'](_0x482da8);}return null;};}function patchUpdates(_0x589aaa){return function(_0x24d3a4){try{jsonpatch['apply'](_0x24d3a4,_0x589aaa,!![]);}catch(_0x1f522a){return BPromise[_0xda9e('0x28')](_0x1f522a);}return _0x24d3a4[_0xda9e('0x29')]();};}function saveUpdates(_0x1262d1,_0x283ec9){return function(_0x556fb8){if(_0x556fb8){return _0x556fb8[_0xda9e('0x2a')](_0x1262d1)[_0xda9e('0x2b')](function(_0x997bdc){return _0x997bdc;});}return null;};}function removeEntity(_0x54306a,_0x15b53c){return function(_0x402cd1){if(_0x402cd1){return _0x402cd1[_0xda9e('0x2c')]()[_0xda9e('0x2b')](function(){_0x54306a['status'](0xcc)[_0xda9e('0x20')]();});}};}function handleEntityNotFound(_0x40cc15,_0x364ef4){return function(_0x3de0c3){if(!_0x3de0c3){_0x40cc15[_0xda9e('0x1e')](0x194);}return _0x3de0c3;};}function handleError(_0x253d8c,_0x11f03a){_0x11f03a=_0x11f03a||0x1f4;return function(_0xc249ef){logger[_0xda9e('0x2d')](_0xc249ef['stack']);if(_0xc249ef[_0xda9e('0x2e')]){delete _0xc249ef[_0xda9e('0x2e')];}_0x253d8c[_0xda9e('0x1f')](_0x11f03a)[_0xda9e('0x2f')](_0xc249ef);};}exports[_0xda9e('0x30')]=function(_0x279ff8,_0x19a72f){var _0x1daa0b={},_0x5091f5={},_0x4e39b1={'count':0x0,'rows':[]};var _0x38d37f=_[_0xda9e('0x31')](db[_0xda9e('0x32')][_0xda9e('0x33')],function(_0x21ab77){return{'name':_0x21ab77[_0xda9e('0x34')],'type':_0x21ab77[_0xda9e('0x35')]['key']};});_0x5091f5[_0xda9e('0x36')]=_['map'](_0x38d37f,_0xda9e('0x2e'));_0x5091f5[_0xda9e('0x37')]=_[_0xda9e('0x38')](_0x279ff8[_0xda9e('0x37')]);_0x5091f5[_0xda9e('0x39')]=_[_0xda9e('0x3a')](_0x5091f5[_0xda9e('0x36')],_0x5091f5[_0xda9e('0x37')]);_0x1daa0b['attributes']=_['intersection'](_0x5091f5[_0xda9e('0x36')],qs['fields'](_0x279ff8['query'][_0xda9e('0x3b')]));_0x1daa0b[_0xda9e('0x3c')]=_0x1daa0b[_0xda9e('0x3c')]['length']?_0x1daa0b[_0xda9e('0x3c')]:_0x5091f5[_0xda9e('0x36')];if(!_0x279ff8[_0xda9e('0x37')]['hasOwnProperty'](_0xda9e('0x3d'))){_0x1daa0b[_0xda9e('0x25')]=qs[_0xda9e('0x25')](_0x279ff8[_0xda9e('0x37')][_0xda9e('0x25')]);_0x1daa0b[_0xda9e('0x22')]=qs[_0xda9e('0x22')](_0x279ff8[_0xda9e('0x37')][_0xda9e('0x22')]);}_0x1daa0b['order']=qs['sort'](_0x279ff8[_0xda9e('0x37')][_0xda9e('0x3e')]);_0x1daa0b[_0xda9e('0x3f')]=qs[_0xda9e('0x39')](_[_0xda9e('0x40')](_0x279ff8[_0xda9e('0x37')],_0x5091f5['filters']),_0x38d37f);if(_0x279ff8[_0xda9e('0x37')][_0xda9e('0x41')]){_0x1daa0b['where']=_[_0xda9e('0x42')](_0x1daa0b['where'],{'$or':_[_0xda9e('0x31')](_0x38d37f,function(_0x5ab480){if(_0x5ab480[_0xda9e('0x35')]!==_0xda9e('0x43')){var _0x345f4b={};_0x345f4b[_0x5ab480[_0xda9e('0x2e')]]={'$like':'%'+_0x279ff8[_0xda9e('0x37')][_0xda9e('0x41')]+'%'};return _0x345f4b;}})});}_0x1daa0b=_[_0xda9e('0x42')]({},_0x1daa0b,_0x279ff8['options']);var _0x518c71={'where':_0x1daa0b[_0xda9e('0x3f')]};return db['SugarcrmAccount']['count'](_0x518c71)[_0xda9e('0x2b')](function(_0xd42481){_0x4e39b1[_0xda9e('0x24')]=_0xd42481;if(_0x279ff8['query'][_0xda9e('0x44')]){_0x1daa0b[_0xda9e('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xda9e('0x46')](_0x1daa0b);})[_0xda9e('0x2b')](function(_0x565d28){_0x4e39b1[_0xda9e('0x47')]=_0x565d28;return _0x4e39b1;})['then'](respondWithFilteredResult(_0x19a72f,_0x1daa0b))[_0xda9e('0x48')](handleError(_0x19a72f,null));};exports[_0xda9e('0x49')]=function(_0x44b4bc,_0x2e6831){var _0x3c54eb={'raw':![],'where':{'id':_0x44b4bc[_0xda9e('0x4a')]['id']}},_0x4cd5f0={};_0x4cd5f0['model']=_[_0xda9e('0x38')](db[_0xda9e('0x32')]['rawAttributes']);_0x4cd5f0[_0xda9e('0x37')]=_[_0xda9e('0x38')](_0x44b4bc['query']);_0x4cd5f0['filters']=_['intersection'](_0x4cd5f0[_0xda9e('0x36')],_0x4cd5f0[_0xda9e('0x37')]);_0x3c54eb[_0xda9e('0x3c')]=_[_0xda9e('0x3a')](_0x4cd5f0[_0xda9e('0x36')],qs['fields'](_0x44b4bc[_0xda9e('0x37')]['fields']));_0x3c54eb['attributes']=_0x3c54eb[_0xda9e('0x3c')][_0xda9e('0x4b')]?_0x3c54eb[_0xda9e('0x3c')]:_0x4cd5f0[_0xda9e('0x36')];if(_0x44b4bc[_0xda9e('0x37')][_0xda9e('0x44')]){_0x3c54eb[_0xda9e('0x45')]=[{'all':!![]}];}_0x3c54eb=_[_0xda9e('0x42')]({},_0x3c54eb,_0x44b4bc[_0xda9e('0x4c')]);return db['SugarcrmAccount']['find'](_0x3c54eb)[_0xda9e('0x2b')](handleEntityNotFound(_0x2e6831,null))[_0xda9e('0x2b')](respondWithResult(_0x2e6831,null))[_0xda9e('0x48')](handleError(_0x2e6831,null));};exports[_0xda9e('0x4d')]=function(_0x1712ae,_0x3396e8){return db[_0xda9e('0x32')]['create'](_0x1712ae[_0xda9e('0x4e')],{})['then'](respondWithResult(_0x3396e8,0xc9))[_0xda9e('0x48')](handleError(_0x3396e8,null));};exports[_0xda9e('0x2a')]=function(_0xa1636b,_0x9ad231){if(_0xa1636b[_0xda9e('0x4e')]['id']){delete _0xa1636b[_0xda9e('0x4e')]['id'];}return db[_0xda9e('0x32')][_0xda9e('0x4f')]({'where':{'id':_0xa1636b[_0xda9e('0x4a')]['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x9ad231,null))['then'](saveUpdates(_0xa1636b[_0xda9e('0x4e')],null))[_0xda9e('0x2b')](respondWithResult(_0x9ad231,null))[_0xda9e('0x48')](handleError(_0x9ad231,null));};exports[_0xda9e('0x2c')]=function(_0x36c655,_0x9c5a66){return db[_0xda9e('0x32')]['find']({'where':{'id':_0x36c655[_0xda9e('0x4a')]['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x9c5a66,null))[_0xda9e('0x2b')](removeEntity(_0x9c5a66,null))[_0xda9e('0x48')](handleError(_0x9c5a66,null));};exports['getConfigurations']=function(_0x8d14d9,_0x58f46b,_0x351504){var _0x3c4d22={};var _0x3527af={};var _0x277925;var _0x1f27c5;return db[_0xda9e('0x32')][_0xda9e('0x50')]({'where':{'id':_0x8d14d9['params']['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x58f46b,null))[_0xda9e('0x2b')](function(_0x86a73a){if(_0x86a73a){_0x277925=_0x86a73a;_0x3527af['model']=_[_0xda9e('0x38')](db[_0xda9e('0x51')][_0xda9e('0x33')]);_0x3527af[_0xda9e('0x37')]=_['keys'](_0x8d14d9[_0xda9e('0x37')]);_0x3527af[_0xda9e('0x39')]=_[_0xda9e('0x3a')](_0x3527af['model'],_0x3527af[_0xda9e('0x37')]);_0x3c4d22[_0xda9e('0x3c')]=_['intersection'](_0x3527af['model'],qs['fields'](_0x8d14d9['query'][_0xda9e('0x3b')]));_0x3c4d22[_0xda9e('0x3c')]=_0x3c4d22[_0xda9e('0x3c')][_0xda9e('0x4b')]?_0x3c4d22[_0xda9e('0x3c')]:_0x3527af[_0xda9e('0x36')];_0x3c4d22[_0xda9e('0x52')]=qs[_0xda9e('0x3e')](_0x8d14d9['query']['sort']);_0x3c4d22[_0xda9e('0x3f')]=qs[_0xda9e('0x39')](_['pick'](_0x8d14d9['query'],_0x3527af['filters']));if(_0x8d14d9[_0xda9e('0x37')]['filter']){_0x3c4d22[_0xda9e('0x3f')]=_[_0xda9e('0x42')](_0x3c4d22[_0xda9e('0x3f')],{'$or':_[_0xda9e('0x31')](_0x3c4d22['attributes'],function(_0x18f47c){var _0x328f5a={};_0x328f5a[_0x18f47c]={'$like':'%'+_0x8d14d9['query'][_0xda9e('0x41')]+'%'};return _0x328f5a;})});}_0x3c4d22=_['merge']({},_0x3c4d22,_0x8d14d9[_0xda9e('0x4c')]);return _0x277925[_0xda9e('0x53')](_0x3c4d22);}})[_0xda9e('0x2b')](function(_0x7f9511){if(_0x7f9511){_0x1f27c5=_0x7f9511[_0xda9e('0x4b')];if(!_0x8d14d9['query'][_0xda9e('0x54')](_0xda9e('0x3d'))){_0x3c4d22[_0xda9e('0x25')]=qs[_0xda9e('0x25')](_0x8d14d9[_0xda9e('0x37')][_0xda9e('0x25')]);_0x3c4d22['offset']=qs['offset'](_0x8d14d9['query'][_0xda9e('0x22')]);}return _0x277925[_0xda9e('0x53')](_0x3c4d22);}})[_0xda9e('0x2b')](function(_0x26835e){if(_0x26835e){return _0x26835e?{'count':_0x1f27c5,'rows':_0x26835e}:null;}})[_0xda9e('0x2b')](respondWithResult(_0x58f46b,null))[_0xda9e('0x48')](handleError(_0x58f46b,null));};exports[_0xda9e('0x55')]=function(_0x17371f,_0x5651d5,_0x1e5d13){if(_0x17371f[_0xda9e('0x4e')]['id']){delete _0x17371f[_0xda9e('0x4e')]['id'];}return db[_0xda9e('0x32')][_0xda9e('0x50')]({'where':{'id':_0x17371f['params']['id']}})[_0xda9e('0x2b')](handleEntityNotFound(_0x5651d5,null))['then'](function(_0x1e790e){if(_0x1e790e){_0x17371f[_0xda9e('0x4e')][_0xda9e('0x56')]=_0x1e790e['id'];_0x17371f[_0xda9e('0x4e')][_0xda9e('0x57')]=integrations[_0xda9e('0x58')](_0x17371f['body'][_0xda9e('0x59')],_0x17371f[_0xda9e('0x4e')][_0xda9e('0x35')]);_0x17371f[_0xda9e('0x4e')]['Descriptions']=integrations[_0xda9e('0x5a')](_0x17371f[_0xda9e('0x4e')][_0xda9e('0x59')],_0x17371f[_0xda9e('0x4e')][_0xda9e('0x35')]);return db[_0xda9e('0x51')]['create'](_0x17371f['body'],{'include':[{'model':db[_0xda9e('0x5b')],'as':'Subjects'},{'model':db[_0xda9e('0x5b')],'as':_0xda9e('0x5c')}]});}return null;})[_0xda9e('0x2b')](respondWithResult(_0x5651d5,null))[_0xda9e('0x48')](handleError(_0x5651d5,null));};exports[_0xda9e('0x5d')]=function(_0xacf645,_0x45b2bb,_0x2e0e8a){var _0x324c14='';var _0xa57a7e=['id',_0xda9e('0x2e'),_0xda9e('0x5e'),_0xda9e('0x5f'),'description',_0xda9e('0x60'),_0xda9e('0x61'),_0xda9e('0x62'),_0xda9e('0x63'),_0xda9e('0x64'),_0xda9e('0x65'),_0xda9e('0x66')];return db[_0xda9e('0x32')]['findOne']({'where':{'id':_0xacf645[_0xda9e('0x4a')]['id']},'attributes':['id','username',_0xda9e('0x67'),_0xda9e('0x68')]})[_0xda9e('0x2b')](handleEntityNotFound(_0x45b2bb,null))[_0xda9e('0x2b')](function(_0x5cbb80){if(_0x5cbb80){_0x324c14=_0x5cbb80[_0xda9e('0x68')];var _0x3dfdd5=_0x324c14[_0xda9e('0x69')](-0x1);if(_0x3dfdd5==='/'){_0x324c14=_0x324c14[_0xda9e('0x6a')](0x0,_0x324c14[_0xda9e('0x6b')](_0x3dfdd5));}return rp({'method':_0xda9e('0x6c'),'uri':util[_0xda9e('0x6d')](_0xda9e('0x6e'),_0x324c14,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xda9e('0x6f')]({'user_auth':{'user_name':_0x5cbb80[_0xda9e('0x70')],'password':_0x5cbb80[_0xda9e('0x67')],'encryption':_0xda9e('0x71')},'application':_0xda9e('0x72')})}});}})['then'](function(_0x9d13b7){if(_0x9d13b7&&_0x9d13b7[_0xda9e('0x2e')]!==_0xda9e('0x73')&&_0x9d13b7[_0xda9e('0x2e')]!==_0xda9e('0x74')){return rp({'method':_0xda9e('0x6c'),'uri':util['format']('%s%s',_0x324c14,_0xda9e('0x75')),'json':!![],'form':{'method':_0xda9e('0x76'),'input_type':'JSON','response_type':_0xda9e('0x77'),'rest_data':JSON['stringify']({'session':_0x9d13b7['id'],'module_name':_0xda9e('0x78')})}})[_0xda9e('0x2b')](function(_0x1ecad3){if(_0x1ecad3){var _0x4f1737=_['values'](_0x1ecad3[_0xda9e('0x79')]);_[_0xda9e('0x7a')](_0x4f1737,function(_0x1f2b35){return _0xa57a7e[_0xda9e('0x7b')](_0x1f2b35[_0xda9e('0x2e')]);});return{'count':_0x4f1737['length'],'rows':_[_0xda9e('0x31')](_0x4f1737,function(_0x5955ef){return{'id':_0x5955ef[_0xda9e('0x2e')],'name':_0x5955ef['label'],'custom':_[_0xda9e('0x7c')](_0x5955ef[_0xda9e('0x2e')],'_c')?!![]:![],'options':_0x5955ef[_0xda9e('0x4c')]?_[_0xda9e('0x31')](_[_0xda9e('0x7d')](_0x5955ef[_0xda9e('0x4c')]),function(_0x235bfe){return{'name':_0x235bfe['value'],'value':_0x235bfe[_0xda9e('0x2e')]};}):[]};})};}})[_0xda9e('0x2b')](respondWithResult(_0x45b2bb,null))[_0xda9e('0x48')](function(_0x22124b){var _0x579a30=_0xacf645[_0xda9e('0x37')][_0xda9e('0x7e')]?0x1f4:_0x22124b['statusCode']||0x1f4;logger[_0xda9e('0x2d')](_0xda9e('0x7f'),_0xda9e('0x5d'),_0x579a30,JSON[_0xda9e('0x6f')](_0x22124b));delete _0x22124b[_0xda9e('0x2e')];if(_0x579a30===0x191){_0x579a30=0x190;}_0x45b2bb[_0xda9e('0x1f')](_0x579a30)['send'](_0xacf645[_0xda9e('0x37')][_0xda9e('0x7e')]?{'message':_0xda9e('0x80'),'statusCode':_0x22124b['statusCode']}:_0x22124b);});}else{var _0x40b22f=0x1f4;_0x45b2bb[_0xda9e('0x1f')](_0x40b22f)[_0xda9e('0x2f')]({'message':_0xda9e('0x80'),'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 0015d42..9e08cdb 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 _0xb7a5=['path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2896e4,_0x180ca3){var _0xdc0f3d=function(_0xe03bd7){while(--_0xe03bd7){_0x2896e4['push'](_0x2896e4['shift']());}};_0xdc0f3d(++_0x180ca3);}(_0xb7a5,0x67));var _0x5b7a=function(_0x1d0df0,_0x5dfd3e){_0x1d0df0=_0x1d0df0-0x0;var _0x2defc8=_0xb7a5[_0x1d0df0];return _0x2defc8;};'use strict';var _=require(_0x5b7a('0x0'));var util=require(_0x5b7a('0x1'));var logger=require(_0x5b7a('0x2'))('api');var moment=require(_0x5b7a('0x3'));var BPromise=require('bluebird');var rp=require(_0x5b7a('0x4'));var fs=require('fs');var path=require(_0x5b7a('0x5'));var rimraf=require(_0x5b7a('0x6'));var config=require('../../config/environment');var attributes=require(_0x5b7a('0x7'));var integrations=require(_0x5b7a('0x8'));module[_0x5b7a('0x9')]=function(_0x54a7c5,_0x49a10d){return _0x54a7c5[_0x5b7a('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x5b7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd66d=['exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','bluebird','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x1c4e6b,_0x5f4e07){var _0x1b2aac=function(_0x317304){while(--_0x317304){_0x1c4e6b['push'](_0x1c4e6b['shift']());}};_0x1b2aac(++_0x5f4e07);}(_0xd66d,0x12d));var _0xdd66=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xd66d[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xdd66('0x0'));var util=require('util');var logger=require(_0xdd66('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdd66('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd66('0x3'));var rimraf=require(_0xdd66('0x4'));var config=require('../../config/environment');var attributes=require(_0xdd66('0x5'));var integrations=require(_0xdd66('0x6'));module[_0xdd66('0x7')]=function(_0x1f9143,_0x11e1b4){return _0x1f9143[_0xdd66('0x8')](_0xdd66('0x9'),attributes,{'tableName':_0xdd66('0xa'),'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 d930449..dc1a7ad 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 _0xe9b6=['SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','limit','include','map','model','attributes','debug','catch','ShowSugarcrmAccount','raw','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xe9b6,0x119));var _0x6e9b=function(_0x4f57ae,_0x370f46){_0x4f57ae=_0x4f57ae-0x0;var _0x132c92=_0xe9b6[_0x4f57ae];return _0x132c92;};'use strict';var _=require(_0x6e9b('0x0'));var util=require(_0x6e9b('0x1'));var moment=require(_0x6e9b('0x2'));var BPromise=require(_0x6e9b('0x3'));var rs=require(_0x6e9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e9b('0x5'))['db'];var utils=require(_0x6e9b('0x6'));var logger=require(_0x6e9b('0x7'))(_0x6e9b('0x8'));var config=require(_0x6e9b('0x9'));var jayson=require(_0x6e9b('0xa'));var client=jayson['client'][_0x6e9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d0b62,_0x2d2be3,_0x3d0e03){return new BPromise(function(_0x18e0d9,_0xff3d98){return client[_0x6e9b('0xc')](_0x3d0b62,_0x3d0e03)[_0x6e9b('0xd')](function(_0x531610){logger[_0x6e9b('0xe')](_0x6e9b('0xf'),_0x2d2be3,'request\x20sent');logger['debug'](_0x6e9b('0x10'),_0x2d2be3,_0x6e9b('0x11'),JSON[_0x6e9b('0x12')](_0x531610));if(_0x531610[_0x6e9b('0x13')]){if(_0x531610[_0x6e9b('0x13')][_0x6e9b('0x14')]===0x1f4){logger[_0x6e9b('0x13')](_0x6e9b('0xf'),_0x2d2be3,_0x531610[_0x6e9b('0x13')][_0x6e9b('0x15')]);return _0xff3d98(_0x531610[_0x6e9b('0x13')][_0x6e9b('0x15')]);}logger[_0x6e9b('0x13')](_0x6e9b('0xf'),_0x2d2be3,_0x531610[_0x6e9b('0x13')][_0x6e9b('0x15')]);return _0x18e0d9(_0x531610[_0x6e9b('0x13')][_0x6e9b('0x15')]);}else{logger[_0x6e9b('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d2be3,_0x6e9b('0x11'));_0x18e0d9(_0x531610[_0x6e9b('0x16')][_0x6e9b('0x15')]);}})['catch'](function(_0x23f5d1){logger[_0x6e9b('0x13')](_0x6e9b('0xf'),_0x2d2be3,_0x23f5d1);_0xff3d98(_0x23f5d1);});});}exports[_0x6e9b('0x17')]=function(_0x14d2c0){var _0x5987ac=this;return new Promise(function(_0xfe1a25,_0x44b39e){return db[_0x6e9b('0x18')][_0x6e9b('0x19')]({'raw':_0x14d2c0['options']?_0x14d2c0[_0x6e9b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x14d2c0[_0x6e9b('0x1a')]?_0x14d2c0[_0x6e9b('0x1a')]['where']||null:null,'attributes':_0x14d2c0[_0x6e9b('0x1a')]?_0x14d2c0[_0x6e9b('0x1a')]['attributes']||null:null,'limit':_0x14d2c0[_0x6e9b('0x1a')]?_0x14d2c0[_0x6e9b('0x1a')][_0x6e9b('0x1b')]||null:null,'include':_0x14d2c0['options']?_0x14d2c0[_0x6e9b('0x1a')][_0x6e9b('0x1c')]?_[_0x6e9b('0x1d')](_0x14d2c0[_0x6e9b('0x1a')][_0x6e9b('0x1c')],function(_0x585710){return{'model':db[_0x585710[_0x6e9b('0x1e')]],'as':_0x585710['as'],'attributes':_0x585710['attributes'],'include':_0x585710[_0x6e9b('0x1c')]?_[_0x6e9b('0x1d')](_0x585710[_0x6e9b('0x1c')],function(_0x23a3b2){return{'model':db[_0x23a3b2[_0x6e9b('0x1e')]],'as':_0x23a3b2['as'],'attributes':_0x23a3b2[_0x6e9b('0x1f')],'include':_0x23a3b2[_0x6e9b('0x1c')]?_[_0x6e9b('0x1d')](_0x23a3b2['include'],function(_0x1ff327){return{'model':db[_0x1ff327[_0x6e9b('0x1e')]],'as':_0x1ff327['as'],'attributes':_0x1ff327[_0x6e9b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6e9b('0xd')](function(_0x30c8e1){logger[_0x6e9b('0xe')](_0x6e9b('0x17'),_0x14d2c0);logger[_0x6e9b('0x20')](_0x6e9b('0x17'),_0x14d2c0,JSON[_0x6e9b('0x12')](_0x30c8e1));_0xfe1a25(_0x30c8e1);})[_0x6e9b('0x21')](function(_0x117f16){logger[_0x6e9b('0x13')](_0x6e9b('0x17'),_0x117f16[_0x6e9b('0x15')],_0x14d2c0);_0x44b39e(_0x5987ac[_0x6e9b('0x13')](0x1f4,_0x117f16[_0x6e9b('0x15')]));});});};exports[_0x6e9b('0x22')]=function(_0x58aa1d){var _0x3dca21=this;return new Promise(function(_0xa1e721,_0x5c4aea){return db[_0x6e9b('0x18')]['find']({'raw':_0x58aa1d[_0x6e9b('0x1a')]?_0x58aa1d[_0x6e9b('0x1a')][_0x6e9b('0x23')]===undefined?!![]:![]:!![],'where':_0x58aa1d[_0x6e9b('0x1a')]?_0x58aa1d['options'][_0x6e9b('0x24')]||null:null,'attributes':_0x58aa1d[_0x6e9b('0x1a')]?_0x58aa1d[_0x6e9b('0x1a')][_0x6e9b('0x1f')]||null:null,'include':_0x58aa1d['options']?_0x58aa1d[_0x6e9b('0x1a')][_0x6e9b('0x1c')]?_[_0x6e9b('0x1d')](_0x58aa1d[_0x6e9b('0x1a')][_0x6e9b('0x1c')],function(_0x2bf4c5){return{'model':db[_0x2bf4c5[_0x6e9b('0x1e')]],'as':_0x2bf4c5['as'],'attributes':_0x2bf4c5['attributes'],'include':_0x2bf4c5[_0x6e9b('0x1c')]?_[_0x6e9b('0x1d')](_0x2bf4c5[_0x6e9b('0x1c')],function(_0x165a58){return{'model':db[_0x165a58[_0x6e9b('0x1e')]],'as':_0x165a58['as'],'attributes':_0x165a58[_0x6e9b('0x1f')],'include':_0x165a58[_0x6e9b('0x1c')]?_[_0x6e9b('0x1d')](_0x165a58[_0x6e9b('0x1c')],function(_0x59db9a){return{'model':db[_0x59db9a[_0x6e9b('0x1e')]],'as':_0x59db9a['as'],'attributes':_0x59db9a[_0x6e9b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6e9b('0xd')](function(_0x14158f){logger[_0x6e9b('0xe')](_0x6e9b('0x22'),_0x58aa1d);logger['debug'](_0x6e9b('0x22'),_0x58aa1d,JSON['stringify'](_0x14158f));_0xa1e721(_0x14158f);})[_0x6e9b('0x21')](function(_0x305eea){logger[_0x6e9b('0x13')]('ShowSugarcrmAccount',_0x305eea[_0x6e9b('0x15')],_0x58aa1d);_0x5c4aea(_0x3dca21[_0x6e9b('0x13')](0x1f4,_0x305eea[_0x6e9b('0x15')]));});});}; \ No newline at end of file +var _0x012a=['jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','SugarcrmAccount','ShowSugarcrmAccount','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x012a,0x16f));var _0xa012=function(_0xbd56b0,_0x38fe4d){_0xbd56b0=_0xbd56b0-0x0;var _0xb928c=_0x012a[_0xbd56b0];return _0xb928c;};'use strict';var _=require(_0xa012('0x0'));var util=require(_0xa012('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa012('0x2'));var fs=require('fs');var Redis=require(_0xa012('0x3'));var db=require(_0xa012('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa012('0x5'));var config=require(_0xa012('0x6'));var jayson=require(_0xa012('0x7'));var client=jayson[_0xa012('0x8')][_0xa012('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x575145,_0x4e6213,_0x3dd643){return new BPromise(function(_0xdd5e6c,_0xfe0d63){return client[_0xa012('0xa')](_0x575145,_0x3dd643)[_0xa012('0xb')](function(_0x2a3c33){logger[_0xa012('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4e6213,_0xa012('0xd'));logger[_0xa012('0xe')](_0xa012('0xf'),_0x4e6213,_0xa012('0xd'),JSON[_0xa012('0x10')](_0x2a3c33));if(_0x2a3c33[_0xa012('0x11')]){if(_0x2a3c33[_0xa012('0x11')][_0xa012('0x12')]===0x1f4){logger[_0xa012('0x11')](_0xa012('0x13'),_0x4e6213,_0x2a3c33[_0xa012('0x11')]['message']);return _0xfe0d63(_0x2a3c33[_0xa012('0x11')]['message']);}logger['error'](_0xa012('0x13'),_0x4e6213,_0x2a3c33[_0xa012('0x11')][_0xa012('0x14')]);return _0xdd5e6c(_0x2a3c33[_0xa012('0x11')][_0xa012('0x14')]);}else{logger['info'](_0xa012('0x13'),_0x4e6213,_0xa012('0xd'));_0xdd5e6c(_0x2a3c33[_0xa012('0x15')][_0xa012('0x14')]);}})[_0xa012('0x16')](function(_0x4622da){logger[_0xa012('0x11')](_0xa012('0x13'),_0x4e6213,_0x4622da);_0xfe0d63(_0x4622da);});});}exports['GetSugarcrmAccount']=function(_0x31ca8b){var _0x6cf847=this;return new Promise(function(_0xfd485,_0x593b81){return db['SugarcrmAccount'][_0xa012('0x17')]({'raw':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b['options'][_0xa012('0x19')]===undefined?!![]:![]:!![],'where':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b[_0xa012('0x18')]['where']||null:null,'attributes':_0x31ca8b['options']?_0x31ca8b[_0xa012('0x18')][_0xa012('0x1a')]||null:null,'limit':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b[_0xa012('0x18')][_0xa012('0x1b')]||null:null,'include':_0x31ca8b[_0xa012('0x18')]?_0x31ca8b[_0xa012('0x18')][_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x31ca8b[_0xa012('0x18')][_0xa012('0x1c')],function(_0x568463){return{'model':db[_0x568463[_0xa012('0x1e')]],'as':_0x568463['as'],'attributes':_0x568463[_0xa012('0x1a')],'include':_0x568463[_0xa012('0x1c')]?_['map'](_0x568463['include'],function(_0x1b8611){return{'model':db[_0x1b8611['model']],'as':_0x1b8611['as'],'attributes':_0x1b8611[_0xa012('0x1a')],'include':_0x1b8611[_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x1b8611[_0xa012('0x1c')],function(_0x4f4676){return{'model':db[_0x4f4676[_0xa012('0x1e')]],'as':_0x4f4676['as'],'attributes':_0x4f4676[_0xa012('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa012('0xb')](function(_0xbb7c8a){logger[_0xa012('0xc')]('GetSugarcrmAccount',_0x31ca8b);logger['debug'](_0xa012('0x1f'),_0x31ca8b,JSON['stringify'](_0xbb7c8a));_0xfd485(_0xbb7c8a);})[_0xa012('0x16')](function(_0x4717aa){logger['error'](_0xa012('0x1f'),_0x4717aa[_0xa012('0x14')],_0x31ca8b);_0x593b81(_0x6cf847[_0xa012('0x11')](0x1f4,_0x4717aa[_0xa012('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x4b68fa){var _0x1b5be1=this;return new Promise(function(_0x2eb2d5,_0x32df3c){return db[_0xa012('0x20')]['find']({'raw':_0x4b68fa[_0xa012('0x18')]?_0x4b68fa[_0xa012('0x18')][_0xa012('0x19')]===undefined?!![]:![]:!![],'where':_0x4b68fa[_0xa012('0x18')]?_0x4b68fa[_0xa012('0x18')]['where']||null:null,'attributes':_0x4b68fa[_0xa012('0x18')]?_0x4b68fa['options'][_0xa012('0x1a')]||null:null,'include':_0x4b68fa['options']?_0x4b68fa[_0xa012('0x18')][_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x4b68fa[_0xa012('0x18')][_0xa012('0x1c')],function(_0xbc26b){return{'model':db[_0xbc26b[_0xa012('0x1e')]],'as':_0xbc26b['as'],'attributes':_0xbc26b[_0xa012('0x1a')],'include':_0xbc26b['include']?_[_0xa012('0x1d')](_0xbc26b['include'],function(_0x3b93df){return{'model':db[_0x3b93df['model']],'as':_0x3b93df['as'],'attributes':_0x3b93df[_0xa012('0x1a')],'include':_0x3b93df[_0xa012('0x1c')]?_[_0xa012('0x1d')](_0x3b93df[_0xa012('0x1c')],function(_0x181177){return{'model':db[_0x181177[_0xa012('0x1e')]],'as':_0x181177['as'],'attributes':_0x181177[_0xa012('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa012('0xb')](function(_0x23d492){logger[_0xa012('0xc')](_0xa012('0x21'),_0x4b68fa);logger[_0xa012('0xe')](_0xa012('0x21'),_0x4b68fa,JSON['stringify'](_0x23d492));_0x2eb2d5(_0x23d492);})[_0xa012('0x16')](function(_0x344bfe){logger[_0xa012('0x11')](_0xa012('0x21'),_0x344bfe[_0xa012('0x14')],_0x4b68fa);_0x32df3c(_0x1b5be1['error'](0x1f4,_0x344bfe['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 36558cf..c995389 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 _0xbb37=['getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects'];(function(_0x43ad08,_0x4bde9b){var _0x57d003=function(_0x30bad4){while(--_0x30bad4){_0x43ad08['push'](_0x43ad08['shift']());}};_0x57d003(++_0x4bde9b);}(_0xbb37,0x92));var _0x7bb3=function(_0x282aab,_0x4e1d9d){_0x282aab=_0x282aab-0x0;var _0x202e47=_0xbb37[_0x282aab];return _0x202e47;};'use strict';var multer=require(_0x7bb3('0x0'));var util=require(_0x7bb3('0x1'));var path=require('path');var timeout=require(_0x7bb3('0x2'));var express=require(_0x7bb3('0x3'));var router=express[_0x7bb3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7bb3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7bb3('0x6'));var controller=require(_0x7bb3('0x7'));router[_0x7bb3('0x8')]('/',auth[_0x7bb3('0x9')](),controller[_0x7bb3('0xa')]);router[_0x7bb3('0x8')]('/:id',auth[_0x7bb3('0x9')](),controller[_0x7bb3('0xb')]);router[_0x7bb3('0x8')]('/:id/fields',auth[_0x7bb3('0x9')](),controller[_0x7bb3('0xc')]);router[_0x7bb3('0x8')](_0x7bb3('0xd'),auth[_0x7bb3('0x9')](),controller[_0x7bb3('0xe')]);router['get']('/:id/descriptions',auth[_0x7bb3('0x9')](),controller[_0x7bb3('0xf')]);router[_0x7bb3('0x10')]('/',auth[_0x7bb3('0x9')](),controller[_0x7bb3('0x11')]);router[_0x7bb3('0x12')]('/:id',auth[_0x7bb3('0x9')](),controller[_0x7bb3('0x13')]);router[_0x7bb3('0x14')]('/:id',auth[_0x7bb3('0x9')](),controller[_0x7bb3('0x15')]);module[_0x7bb3('0x16')]=router; \ No newline at end of file +var _0x3551=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x211d7b,_0x1960b7){var _0x3b39b6=function(_0x4ee31f){while(--_0x4ee31f){_0x211d7b['push'](_0x211d7b['shift']());}};_0x3b39b6(++_0x1960b7);}(_0x3551,0x1ca));var _0x1355=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0x3551[_0x5de818];return _0x345670;};'use strict';var multer=require(_0x1355('0x0'));var util=require(_0x1355('0x1'));var path=require(_0x1355('0x2'));var timeout=require(_0x1355('0x3'));var express=require(_0x1355('0x4'));var router=express[_0x1355('0x5')]();var fs_extra=require(_0x1355('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1355('0x7'));var config=require(_0x1355('0x8'));var controller=require(_0x1355('0x9'));router[_0x1355('0xa')]('/',auth[_0x1355('0xb')](),controller[_0x1355('0xc')]);router[_0x1355('0xa')](_0x1355('0xd'),auth['isAuthenticated'](),controller[_0x1355('0xe')]);router[_0x1355('0xa')](_0x1355('0xf'),auth[_0x1355('0xb')](),controller[_0x1355('0x10')]);router[_0x1355('0xa')](_0x1355('0x11'),auth[_0x1355('0xb')](),controller[_0x1355('0x12')]);router[_0x1355('0xa')](_0x1355('0x13'),auth['isAuthenticated'](),controller[_0x1355('0x14')]);router[_0x1355('0x15')]('/',auth[_0x1355('0xb')](),controller[_0x1355('0x16')]);router[_0x1355('0x17')](_0x1355('0xd'),auth[_0x1355('0xb')](),controller[_0x1355('0x18')]);router[_0x1355('0x19')](_0x1355('0xd'),auth[_0x1355('0xb')](),controller[_0x1355('0x1a')]);module[_0x1355('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 51a274d..5a4b776 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 _0x5dbc=['exports','sequelize'];(function(_0x110bee,_0x40d394){var _0x27466c=function(_0x5661b9){while(--_0x5661b9){_0x110bee['push'](_0x110bee['shift']());}};_0x27466c(++_0x40d394);}(_0x5dbc,0x75));var _0xc5db=function(_0x477947,_0x926f92){_0x477947=_0x477947-0x0;var _0x504e35=_0x5dbc[_0x477947];return _0x504e35;};'use strict';var Sequelize=require(_0xc5db('0x0'));module[_0xc5db('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb791=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb791,0xb3));var _0x1b79=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xb791[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require(_0x1b79('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b79('0x1')]},'description':{'type':Sequelize[_0x1b79('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6d19c73..9001f05 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 _0x5820=['offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','length','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x2f320c,_0x243a26){var _0x33249b=function(_0x5bc1b7){while(--_0x5bc1b7){_0x2f320c['push'](_0x2f320c['shift']());}};_0x33249b(++_0x243a26);}(_0x5820,0x1ca));var _0x0582=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5820[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0582('0x0'));var rimraf=require(_0x0582('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0582('0x2'));var rp=require(_0x0582('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0582('0x4'));var util=require(_0x0582('0x5'));var path=require(_0x0582('0x6'));var sox=require(_0x0582('0x7'));var csv=require(_0x0582('0x8'));var ejs=require(_0x0582('0x9'));var fs=require('fs');var fs_extra=require(_0x0582('0xa'));var _=require('lodash');var squel=require(_0x0582('0xb'));var crypto=require(_0x0582('0xc'));var jsforce=require(_0x0582('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0582('0x8'));var querystring=require(_0x0582('0xe'));var Papa=require(_0x0582('0xf'));var Redis=require(_0x0582('0x10'));var authService=require(_0x0582('0x11'));var qs=require(_0x0582('0x12'));var as=require(_0x0582('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0582('0x14'))('api');var utils=require(_0x0582('0x15'));var config=require(_0x0582('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0582('0x17'))['db'];function respondWithStatusCode(_0x88d5f9,_0x149ee4){_0x149ee4=_0x149ee4||0xcc;return function(_0x40c97d){if(_0x40c97d){return _0x88d5f9[_0x0582('0x18')](_0x149ee4);}return _0x88d5f9[_0x0582('0x19')](_0x149ee4)[_0x0582('0x1a')]();};}function respondWithResult(_0x427476,_0x5c5d96){_0x5c5d96=_0x5c5d96||0xc8;return function(_0xc41b5a){if(_0xc41b5a){return _0x427476[_0x0582('0x19')](_0x5c5d96)[_0x0582('0x1b')](_0xc41b5a);}};}function respondWithFilteredResult(_0x57df0c,_0x16ea49){return function(_0x16e238){if(_0x16e238){var _0xfe323=typeof _0x16ea49[_0x0582('0x1c')]===_0x0582('0x1d')&&typeof _0x16ea49[_0x0582('0x1e')]==='undefined';var _0x16cf87=_0x16e238[_0x0582('0x1f')];var _0x44dedf=_0xfe323?0x0:_0x16ea49[_0x0582('0x1c')];var _0x5d9613=_0xfe323?_0x16e238['count']:_0x16ea49[_0x0582('0x1c')]+_0x16ea49[_0x0582('0x1e')];var _0x2a957e;if(_0x5d9613>=_0x16cf87){_0x5d9613=_0x16cf87;_0x2a957e=0xc8;}else{_0x2a957e=0xce;}_0x57df0c[_0x0582('0x19')](_0x2a957e);return _0x57df0c[_0x0582('0x20')]('Content-Range',_0x44dedf+'-'+_0x5d9613+'/'+_0x16cf87)[_0x0582('0x1b')](_0x16e238);}return null;};}function patchUpdates(_0x4a78b2){return function(_0x12f908){try{jsonpatch[_0x0582('0x21')](_0x12f908,_0x4a78b2,!![]);}catch(_0x555356){return BPromise[_0x0582('0x22')](_0x555356);}return _0x12f908['save']();};}function saveUpdates(_0x52689a,_0x4a9047){return function(_0x383a1b){if(_0x383a1b){return _0x383a1b[_0x0582('0x23')](_0x52689a)[_0x0582('0x24')](function(_0x399943){return _0x399943;});}return null;};}function removeEntity(_0x162e65,_0x2db1db){return function(_0x5e8fb0){if(_0x5e8fb0){return _0x5e8fb0[_0x0582('0x25')]()['then'](function(){_0x162e65[_0x0582('0x19')](0xcc)[_0x0582('0x1a')]();});}};}function handleEntityNotFound(_0x3c2db2,_0x5d015c){return function(_0x4defe7){if(!_0x4defe7){_0x3c2db2[_0x0582('0x18')](0x194);}return _0x4defe7;};}function handleError(_0x589fc5,_0x236fec){_0x236fec=_0x236fec||0x1f4;return function(_0x557ab9){logger[_0x0582('0x26')](_0x557ab9[_0x0582('0x27')]);if(_0x557ab9[_0x0582('0x28')]){delete _0x557ab9['name'];}_0x589fc5[_0x0582('0x19')](_0x236fec)[_0x0582('0x29')](_0x557ab9);};}exports[_0x0582('0x2a')]=function(_0xfcd1e6,_0x39ceca){var _0x57e2f0={},_0x3892a8={},_0x3dd770={'count':0x0,'rows':[]};var _0x2531fe=_[_0x0582('0x2b')](db[_0x0582('0x2c')]['rawAttributes'],function(_0xd4477a){return{'name':_0xd4477a[_0x0582('0x2d')],'type':_0xd4477a[_0x0582('0x2e')]['key']};});_0x3892a8[_0x0582('0x2f')]=_[_0x0582('0x2b')](_0x2531fe,_0x0582('0x28'));_0x3892a8[_0x0582('0x30')]=_[_0x0582('0x31')](_0xfcd1e6[_0x0582('0x30')]);_0x3892a8[_0x0582('0x32')]=_[_0x0582('0x33')](_0x3892a8[_0x0582('0x2f')],_0x3892a8[_0x0582('0x30')]);_0x57e2f0['attributes']=_[_0x0582('0x33')](_0x3892a8[_0x0582('0x2f')],qs[_0x0582('0x34')](_0xfcd1e6[_0x0582('0x30')][_0x0582('0x34')]));_0x57e2f0[_0x0582('0x35')]=_0x57e2f0['attributes']['length']?_0x57e2f0['attributes']:_0x3892a8[_0x0582('0x2f')];if(!_0xfcd1e6[_0x0582('0x30')][_0x0582('0x36')](_0x0582('0x37'))){_0x57e2f0[_0x0582('0x1e')]=qs[_0x0582('0x1e')](_0xfcd1e6['query'][_0x0582('0x1e')]);_0x57e2f0[_0x0582('0x1c')]=qs[_0x0582('0x1c')](_0xfcd1e6['query'][_0x0582('0x1c')]);}_0x57e2f0['order']=qs[_0x0582('0x38')](_0xfcd1e6[_0x0582('0x30')]['sort']);_0x57e2f0['where']=qs[_0x0582('0x32')](_[_0x0582('0x39')](_0xfcd1e6[_0x0582('0x30')],_0x3892a8[_0x0582('0x32')]),_0x2531fe);if(_0xfcd1e6['query'][_0x0582('0x3a')]){_0x57e2f0[_0x0582('0x3b')]=_[_0x0582('0x3c')](_0x57e2f0[_0x0582('0x3b')],{'$or':_[_0x0582('0x2b')](_0x2531fe,function(_0x45287c){if(_0x45287c['type']!==_0x0582('0x3d')){var _0x35a6d1={};_0x35a6d1[_0x45287c[_0x0582('0x28')]]={'$like':'%'+_0xfcd1e6[_0x0582('0x30')][_0x0582('0x3a')]+'%'};return _0x35a6d1;}})});}_0x57e2f0=_[_0x0582('0x3c')]({},_0x57e2f0,_0xfcd1e6[_0x0582('0x3e')]);var _0x561970={'where':_0x57e2f0[_0x0582('0x3b')]};return db['SugarcrmConfiguration']['count'](_0x561970)['then'](function(_0x2084a0){_0x3dd770[_0x0582('0x1f')]=_0x2084a0;if(_0xfcd1e6[_0x0582('0x30')][_0x0582('0x3f')]){_0x57e2f0[_0x0582('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x0582('0x41')](_0x57e2f0);})[_0x0582('0x24')](function(_0x54a0b7){_0x3dd770[_0x0582('0x42')]=_0x54a0b7;return _0x3dd770;})[_0x0582('0x24')](respondWithFilteredResult(_0x39ceca,_0x57e2f0))[_0x0582('0x43')](handleError(_0x39ceca,null));};exports[_0x0582('0x44')]=function(_0x18e90b,_0xe704cc){var _0x585fcf={'raw':![],'where':{'id':_0x18e90b[_0x0582('0x45')]['id']}},_0x38a14f={};_0x38a14f[_0x0582('0x2f')]=_[_0x0582('0x31')](db[_0x0582('0x2c')][_0x0582('0x46')]);_0x38a14f[_0x0582('0x30')]=_['keys'](_0x18e90b[_0x0582('0x30')]);_0x38a14f[_0x0582('0x32')]=_['intersection'](_0x38a14f['model'],_0x38a14f[_0x0582('0x30')]);_0x585fcf['attributes']=_['intersection'](_0x38a14f[_0x0582('0x2f')],qs[_0x0582('0x34')](_0x18e90b[_0x0582('0x30')][_0x0582('0x34')]));_0x585fcf[_0x0582('0x35')]=_0x585fcf[_0x0582('0x35')]['length']?_0x585fcf[_0x0582('0x35')]:_0x38a14f[_0x0582('0x2f')];if(_0x18e90b[_0x0582('0x30')][_0x0582('0x3f')]){_0x585fcf[_0x0582('0x40')]=[{'all':!![]}];}_0x585fcf=_[_0x0582('0x3c')]({},_0x585fcf,_0x18e90b[_0x0582('0x3e')]);return db[_0x0582('0x2c')][_0x0582('0x47')](_0x585fcf)[_0x0582('0x24')](handleEntityNotFound(_0xe704cc,null))[_0x0582('0x24')](respondWithResult(_0xe704cc,null))['catch'](handleError(_0xe704cc,null));};exports[_0x0582('0x48')]=function(_0x6f561b,_0x184f1f){return db[_0x0582('0x2c')]['create'](_0x6f561b[_0x0582('0x49')],{})[_0x0582('0x24')](respondWithResult(_0x184f1f,0xc9))[_0x0582('0x43')](handleError(_0x184f1f,null));};exports['update']=function(_0x21bfe8,_0x5ecefa){if(_0x21bfe8['body']['id']){delete _0x21bfe8[_0x0582('0x49')]['id'];}return db[_0x0582('0x2c')]['find']({'where':{'id':_0x21bfe8[_0x0582('0x45')]['id']}})[_0x0582('0x24')](handleEntityNotFound(_0x5ecefa,null))['then'](saveUpdates(_0x21bfe8[_0x0582('0x49')],null))[_0x0582('0x24')](respondWithResult(_0x5ecefa,null))[_0x0582('0x43')](handleError(_0x5ecefa,null));};exports['destroy']=function(_0x1736c7,_0x42c517){return db[_0x0582('0x2c')]['find']({'where':{'id':_0x1736c7['params']['id']}})[_0x0582('0x24')](handleEntityNotFound(_0x42c517,null))['then'](removeEntity(_0x42c517,null))[_0x0582('0x43')](handleError(_0x42c517,null));};exports[_0x0582('0x4a')]=function(_0x427ae7,_0x50bca1,_0xfa51d2){var _0x2f5898={};var _0x47a103={};var _0x5a26bf;var _0xc8455d;return db[_0x0582('0x2c')][_0x0582('0x4b')]({'where':{'id':_0x427ae7[_0x0582('0x45')]['id']}})[_0x0582('0x24')](handleEntityNotFound(_0x50bca1,null))['then'](function(_0x1c48ce){if(_0x1c48ce){_0x5a26bf=_0x1c48ce;_0x47a103['model']=_[_0x0582('0x31')](db[_0x0582('0x4c')]['rawAttributes']);_0x47a103[_0x0582('0x30')]=_[_0x0582('0x31')](_0x427ae7[_0x0582('0x30')]);_0x47a103['filters']=_[_0x0582('0x33')](_0x47a103[_0x0582('0x2f')],_0x47a103['query']);_0x2f5898[_0x0582('0x35')]=_[_0x0582('0x33')](_0x47a103[_0x0582('0x2f')],qs[_0x0582('0x34')](_0x427ae7['query'][_0x0582('0x34')]));_0x2f5898[_0x0582('0x35')]=_0x2f5898[_0x0582('0x35')][_0x0582('0x4d')]?_0x2f5898['attributes']:_0x47a103[_0x0582('0x2f')];_0x2f5898[_0x0582('0x4e')]=qs[_0x0582('0x38')](_0x427ae7[_0x0582('0x30')]['sort']);_0x2f5898['where']=qs[_0x0582('0x32')](_[_0x0582('0x39')](_0x427ae7[_0x0582('0x30')],_0x47a103[_0x0582('0x32')]));if(_0x427ae7['query']['filter']){_0x2f5898[_0x0582('0x3b')]=_[_0x0582('0x3c')](_0x2f5898[_0x0582('0x3b')],{'$or':_[_0x0582('0x2b')](_0x2f5898['attributes'],function(_0x2ac118){var _0x577d3f={};_0x577d3f[_0x2ac118]={'$like':'%'+_0x427ae7[_0x0582('0x30')][_0x0582('0x3a')]+'%'};return _0x577d3f;})});}_0x2f5898=_['merge']({},_0x2f5898,_0x427ae7[_0x0582('0x3e')]);return _0x5a26bf[_0x0582('0x4a')](_0x2f5898);}})[_0x0582('0x24')](function(_0x3b13b9){if(_0x3b13b9){_0xc8455d=_0x3b13b9[_0x0582('0x4d')];if(!_0x427ae7[_0x0582('0x30')][_0x0582('0x36')](_0x0582('0x37'))){_0x2f5898[_0x0582('0x1e')]=qs[_0x0582('0x1e')](_0x427ae7[_0x0582('0x30')][_0x0582('0x1e')]);_0x2f5898[_0x0582('0x1c')]=qs[_0x0582('0x1c')](_0x427ae7[_0x0582('0x30')][_0x0582('0x1c')]);}return _0x5a26bf['getFields'](_0x2f5898);}})[_0x0582('0x24')](function(_0xd684fe){if(_0xd684fe){return _0xd684fe?{'count':_0xc8455d,'rows':_0xd684fe}:null;}})[_0x0582('0x24')](respondWithResult(_0x50bca1,null))[_0x0582('0x43')](handleError(_0x50bca1,null));};exports[_0x0582('0x4f')]=function(_0x742347,_0xb0c8ed,_0x5a1f7d){var _0x7bcd37={};var _0x5ec0a1={};var _0xbe07dd;var _0x207a05;return db[_0x0582('0x2c')][_0x0582('0x4b')]({'where':{'id':_0x742347[_0x0582('0x45')]['id']}})['then'](handleEntityNotFound(_0xb0c8ed,null))[_0x0582('0x24')](function(_0xb7012){if(_0xb7012){_0xbe07dd=_0xb7012;_0x5ec0a1['model']=_['keys'](db['SugarcrmField'][_0x0582('0x46')]);_0x5ec0a1[_0x0582('0x30')]=_['keys'](_0x742347[_0x0582('0x30')]);_0x5ec0a1[_0x0582('0x32')]=_['intersection'](_0x5ec0a1['model'],_0x5ec0a1[_0x0582('0x30')]);_0x7bcd37['attributes']=_['intersection'](_0x5ec0a1[_0x0582('0x2f')],qs[_0x0582('0x34')](_0x742347['query'][_0x0582('0x34')]));_0x7bcd37['attributes']=_0x7bcd37[_0x0582('0x35')][_0x0582('0x4d')]?_0x7bcd37[_0x0582('0x35')]:_0x5ec0a1[_0x0582('0x2f')];_0x7bcd37[_0x0582('0x4e')]=qs[_0x0582('0x38')](_0x742347['query'][_0x0582('0x38')]);_0x7bcd37[_0x0582('0x3b')]=qs['filters'](_[_0x0582('0x39')](_0x742347['query'],_0x5ec0a1[_0x0582('0x32')]));if(_0x742347[_0x0582('0x30')][_0x0582('0x3a')]){_0x7bcd37[_0x0582('0x3b')]=_['merge'](_0x7bcd37[_0x0582('0x3b')],{'$or':_[_0x0582('0x2b')](_0x7bcd37['attributes'],function(_0x2577db){var _0x267f76={};_0x267f76[_0x2577db]={'$like':'%'+_0x742347['query']['filter']+'%'};return _0x267f76;})});}_0x7bcd37=_['merge']({},_0x7bcd37,_0x742347[_0x0582('0x3e')]);return _0xbe07dd[_0x0582('0x4f')](_0x7bcd37);}})[_0x0582('0x24')](function(_0x108ba9){if(_0x108ba9){_0x207a05=_0x108ba9[_0x0582('0x4d')];if(!_0x742347[_0x0582('0x30')][_0x0582('0x36')](_0x0582('0x37'))){_0x7bcd37[_0x0582('0x1e')]=qs[_0x0582('0x1e')](_0x742347[_0x0582('0x30')][_0x0582('0x1e')]);_0x7bcd37[_0x0582('0x1c')]=qs[_0x0582('0x1c')](_0x742347[_0x0582('0x30')][_0x0582('0x1c')]);}return _0xbe07dd[_0x0582('0x4f')](_0x7bcd37);}})[_0x0582('0x24')](function(_0x56d512){if(_0x56d512){return _0x56d512?{'count':_0x207a05,'rows':_0x56d512}:null;}})[_0x0582('0x24')](respondWithResult(_0xb0c8ed,null))[_0x0582('0x43')](handleError(_0xb0c8ed,null));};exports[_0x0582('0x50')]=function(_0x50d35c,_0x534bb8,_0x4ccc19){var _0x52f1af={};var _0x1e270a={};var _0x37962b;var _0x352cb6;return db[_0x0582('0x2c')][_0x0582('0x4b')]({'where':{'id':_0x50d35c['params']['id']}})[_0x0582('0x24')](handleEntityNotFound(_0x534bb8,null))[_0x0582('0x24')](function(_0x4c6d9f){if(_0x4c6d9f){_0x37962b=_0x4c6d9f;_0x1e270a[_0x0582('0x2f')]=_['keys'](db[_0x0582('0x4c')][_0x0582('0x46')]);_0x1e270a['query']=_['keys'](_0x50d35c[_0x0582('0x30')]);_0x1e270a[_0x0582('0x32')]=_[_0x0582('0x33')](_0x1e270a[_0x0582('0x2f')],_0x1e270a[_0x0582('0x30')]);_0x52f1af[_0x0582('0x35')]=_[_0x0582('0x33')](_0x1e270a[_0x0582('0x2f')],qs['fields'](_0x50d35c[_0x0582('0x30')][_0x0582('0x34')]));_0x52f1af[_0x0582('0x35')]=_0x52f1af[_0x0582('0x35')][_0x0582('0x4d')]?_0x52f1af[_0x0582('0x35')]:_0x1e270a[_0x0582('0x2f')];_0x52f1af[_0x0582('0x4e')]=qs[_0x0582('0x38')](_0x50d35c[_0x0582('0x30')][_0x0582('0x38')]);_0x52f1af[_0x0582('0x3b')]=qs[_0x0582('0x32')](_['pick'](_0x50d35c['query'],_0x1e270a['filters']));if(_0x50d35c['query'][_0x0582('0x3a')]){_0x52f1af[_0x0582('0x3b')]=_[_0x0582('0x3c')](_0x52f1af[_0x0582('0x3b')],{'$or':_['map'](_0x52f1af['attributes'],function(_0x82ec33){var _0x33ef42={};_0x33ef42[_0x82ec33]={'$like':'%'+_0x50d35c[_0x0582('0x30')][_0x0582('0x3a')]+'%'};return _0x33ef42;})});}_0x52f1af=_[_0x0582('0x3c')]({},_0x52f1af,_0x50d35c[_0x0582('0x3e')]);return _0x37962b['getDescriptions'](_0x52f1af);}})[_0x0582('0x24')](function(_0x18437e){if(_0x18437e){_0x352cb6=_0x18437e[_0x0582('0x4d')];if(!_0x50d35c[_0x0582('0x30')]['hasOwnProperty'](_0x0582('0x37'))){_0x52f1af[_0x0582('0x1e')]=qs[_0x0582('0x1e')](_0x50d35c[_0x0582('0x30')]['limit']);_0x52f1af[_0x0582('0x1c')]=qs[_0x0582('0x1c')](_0x50d35c[_0x0582('0x30')][_0x0582('0x1c')]);}return _0x37962b[_0x0582('0x50')](_0x52f1af);}})[_0x0582('0x24')](function(_0x1a6ced){if(_0x1a6ced){return _0x1a6ced?{'count':_0x352cb6,'rows':_0x1a6ced}:null;}})[_0x0582('0x24')](respondWithResult(_0x534bb8,null))['catch'](handleError(_0x534bb8,null));}; \ No newline at end of file +var _0x9667=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key'];(function(_0x321946,_0x53c4fd){var _0x3ab590=function(_0x17bdb9){while(--_0x17bdb9){_0x321946['push'](_0x321946['shift']());}};_0x3ab590(++_0x53c4fd);}(_0x9667,0xcb));var _0x7966=function(_0x5ef4ac,_0x2c955a){_0x5ef4ac=_0x5ef4ac-0x0;var _0x219f07=_0x9667[_0x5ef4ac];return _0x219f07;};'use strict';var emlformat=require(_0x7966('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7966('0x1'));var jsonpatch=require(_0x7966('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7966('0x3'));var Mustache=require(_0x7966('0x4'));var util=require(_0x7966('0x5'));var path=require(_0x7966('0x6'));var sox=require(_0x7966('0x7'));var csv=require(_0x7966('0x8'));var ejs=require(_0x7966('0x9'));var fs=require('fs');var fs_extra=require(_0x7966('0xa'));var _=require(_0x7966('0xb'));var squel=require(_0x7966('0xc'));var crypto=require(_0x7966('0xd'));var jsforce=require(_0x7966('0xe'));var deskjs=require(_0x7966('0xf'));var toCsv=require(_0x7966('0x8'));var querystring=require(_0x7966('0x10'));var Papa=require(_0x7966('0x11'));var Redis=require('ioredis');var authService=require(_0x7966('0x12'));var qs=require(_0x7966('0x13'));var as=require(_0x7966('0x14'));var hardwareService=require(_0x7966('0x15'));var logger=require(_0x7966('0x16'))(_0x7966('0x17'));var utils=require('../../config/utils');var config=require(_0x7966('0x18'));var licenseUtil=require(_0x7966('0x19'));var db=require(_0x7966('0x1a'))['db'];function respondWithStatusCode(_0x3cb57d,_0x336b80){_0x336b80=_0x336b80||0xcc;return function(_0x133e50){if(_0x133e50){return _0x3cb57d[_0x7966('0x1b')](_0x336b80);}return _0x3cb57d[_0x7966('0x1c')](_0x336b80)['end']();};}function respondWithResult(_0x205153,_0x1a0c56){_0x1a0c56=_0x1a0c56||0xc8;return function(_0x496455){if(_0x496455){return _0x205153[_0x7966('0x1c')](_0x1a0c56)[_0x7966('0x1d')](_0x496455);}};}function respondWithFilteredResult(_0x13fd5b,_0x4aecde){return function(_0x2bae60){if(_0x2bae60){var _0x3e6dd9=typeof _0x4aecde[_0x7966('0x1e')]===_0x7966('0x1f')&&typeof _0x4aecde[_0x7966('0x20')]===_0x7966('0x1f');var _0x4482d8=_0x2bae60[_0x7966('0x21')];var _0x50ec74=_0x3e6dd9?0x0:_0x4aecde[_0x7966('0x1e')];var _0x1cdf4d=_0x3e6dd9?_0x2bae60['count']:_0x4aecde[_0x7966('0x1e')]+_0x4aecde[_0x7966('0x20')];var _0x420ff5;if(_0x1cdf4d>=_0x4482d8){_0x1cdf4d=_0x4482d8;_0x420ff5=0xc8;}else{_0x420ff5=0xce;}_0x13fd5b[_0x7966('0x1c')](_0x420ff5);return _0x13fd5b['set'](_0x7966('0x22'),_0x50ec74+'-'+_0x1cdf4d+'/'+_0x4482d8)['json'](_0x2bae60);}return null;};}function patchUpdates(_0x517be0){return function(_0x5f1802){try{jsonpatch[_0x7966('0x23')](_0x5f1802,_0x517be0,!![]);}catch(_0xc12f28){return BPromise[_0x7966('0x24')](_0xc12f28);}return _0x5f1802['save']();};}function saveUpdates(_0x3ac496,_0xc6062d){return function(_0x5bc69e){if(_0x5bc69e){return _0x5bc69e[_0x7966('0x25')](_0x3ac496)[_0x7966('0x26')](function(_0x11e2b9){return _0x11e2b9;});}return null;};}function removeEntity(_0x61c3c4,_0x3ab3c2){return function(_0x32d05d){if(_0x32d05d){return _0x32d05d[_0x7966('0x27')]()[_0x7966('0x26')](function(){_0x61c3c4[_0x7966('0x1c')](0xcc)[_0x7966('0x28')]();});}};}function handleEntityNotFound(_0x467604,_0x5860e8){return function(_0x743d38){if(!_0x743d38){_0x467604[_0x7966('0x1b')](0x194);}return _0x743d38;};}function handleError(_0x2af629,_0x1c3268){_0x1c3268=_0x1c3268||0x1f4;return function(_0x5477f8){logger[_0x7966('0x29')](_0x5477f8[_0x7966('0x2a')]);if(_0x5477f8['name']){delete _0x5477f8[_0x7966('0x2b')];}_0x2af629['status'](_0x1c3268)[_0x7966('0x2c')](_0x5477f8);};}exports[_0x7966('0x2d')]=function(_0x1480c5,_0x6d14f7){var _0x46d3dd={},_0x289646={},_0xdbef47={'count':0x0,'rows':[]};var _0x3cc683=_[_0x7966('0x2e')](db[_0x7966('0x2f')][_0x7966('0x30')],function(_0x5cabc6){return{'name':_0x5cabc6[_0x7966('0x31')],'type':_0x5cabc6[_0x7966('0x32')][_0x7966('0x33')]};});_0x289646[_0x7966('0x34')]=_[_0x7966('0x2e')](_0x3cc683,_0x7966('0x2b'));_0x289646[_0x7966('0x35')]=_[_0x7966('0x36')](_0x1480c5[_0x7966('0x35')]);_0x289646[_0x7966('0x37')]=_['intersection'](_0x289646[_0x7966('0x34')],_0x289646[_0x7966('0x35')]);_0x46d3dd[_0x7966('0x38')]=_[_0x7966('0x39')](_0x289646[_0x7966('0x34')],qs['fields'](_0x1480c5['query'][_0x7966('0x3a')]));_0x46d3dd[_0x7966('0x38')]=_0x46d3dd[_0x7966('0x38')][_0x7966('0x3b')]?_0x46d3dd['attributes']:_0x289646['model'];if(!_0x1480c5['query'][_0x7966('0x3c')]('nolimit')){_0x46d3dd[_0x7966('0x20')]=qs[_0x7966('0x20')](_0x1480c5[_0x7966('0x35')][_0x7966('0x20')]);_0x46d3dd['offset']=qs[_0x7966('0x1e')](_0x1480c5[_0x7966('0x35')][_0x7966('0x1e')]);}_0x46d3dd[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0x1480c5[_0x7966('0x35')][_0x7966('0x3e')]);_0x46d3dd['where']=qs['filters'](_[_0x7966('0x3f')](_0x1480c5[_0x7966('0x35')],_0x289646[_0x7966('0x37')]),_0x3cc683);if(_0x1480c5[_0x7966('0x35')][_0x7966('0x40')]){_0x46d3dd['where']=_[_0x7966('0x41')](_0x46d3dd[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x3cc683,function(_0x44505d){if(_0x44505d['type']!==_0x7966('0x43')){var _0xd918a2={};_0xd918a2[_0x44505d[_0x7966('0x2b')]]={'$like':'%'+_0x1480c5[_0x7966('0x35')][_0x7966('0x40')]+'%'};return _0xd918a2;}})});}_0x46d3dd=_[_0x7966('0x41')]({},_0x46d3dd,_0x1480c5[_0x7966('0x44')]);var _0x328bae={'where':_0x46d3dd['where']};return db[_0x7966('0x2f')][_0x7966('0x21')](_0x328bae)['then'](function(_0x50393a){_0xdbef47[_0x7966('0x21')]=_0x50393a;if(_0x1480c5['query'][_0x7966('0x45')]){_0x46d3dd[_0x7966('0x46')]=[{'all':!![]}];}return db[_0x7966('0x2f')][_0x7966('0x47')](_0x46d3dd);})[_0x7966('0x26')](function(_0x20df67){_0xdbef47[_0x7966('0x48')]=_0x20df67;return _0xdbef47;})[_0x7966('0x26')](respondWithFilteredResult(_0x6d14f7,_0x46d3dd))[_0x7966('0x49')](handleError(_0x6d14f7,null));};exports[_0x7966('0x4a')]=function(_0x5c54f1,_0x522d8c){var _0x360315={'raw':![],'where':{'id':_0x5c54f1[_0x7966('0x4b')]['id']}},_0x433753={};_0x433753['model']=_[_0x7966('0x36')](db[_0x7966('0x2f')][_0x7966('0x30')]);_0x433753['query']=_[_0x7966('0x36')](_0x5c54f1[_0x7966('0x35')]);_0x433753[_0x7966('0x37')]=_[_0x7966('0x39')](_0x433753[_0x7966('0x34')],_0x433753[_0x7966('0x35')]);_0x360315[_0x7966('0x38')]=_[_0x7966('0x39')](_0x433753['model'],qs[_0x7966('0x3a')](_0x5c54f1[_0x7966('0x35')][_0x7966('0x3a')]));_0x360315[_0x7966('0x38')]=_0x360315[_0x7966('0x38')]['length']?_0x360315[_0x7966('0x38')]:_0x433753[_0x7966('0x34')];if(_0x5c54f1[_0x7966('0x35')][_0x7966('0x45')]){_0x360315[_0x7966('0x46')]=[{'all':!![]}];}_0x360315=_[_0x7966('0x41')]({},_0x360315,_0x5c54f1['options']);return db[_0x7966('0x2f')][_0x7966('0x4c')](_0x360315)[_0x7966('0x26')](handleEntityNotFound(_0x522d8c,null))[_0x7966('0x26')](respondWithResult(_0x522d8c,null))[_0x7966('0x49')](handleError(_0x522d8c,null));};exports[_0x7966('0x4d')]=function(_0x3861b4,_0x15bdf7){return db[_0x7966('0x2f')]['create'](_0x3861b4[_0x7966('0x4e')],{})[_0x7966('0x26')](respondWithResult(_0x15bdf7,0xc9))[_0x7966('0x49')](handleError(_0x15bdf7,null));};exports[_0x7966('0x25')]=function(_0x25baa0,_0x8e2c5d){if(_0x25baa0[_0x7966('0x4e')]['id']){delete _0x25baa0['body']['id'];}return db[_0x7966('0x2f')][_0x7966('0x4c')]({'where':{'id':_0x25baa0[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x8e2c5d,null))['then'](saveUpdates(_0x25baa0[_0x7966('0x4e')],null))[_0x7966('0x26')](respondWithResult(_0x8e2c5d,null))[_0x7966('0x49')](handleError(_0x8e2c5d,null));};exports[_0x7966('0x27')]=function(_0x5a9274,_0x59c36a){return db[_0x7966('0x2f')]['find']({'where':{'id':_0x5a9274[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x59c36a,null))['then'](removeEntity(_0x59c36a,null))[_0x7966('0x49')](handleError(_0x59c36a,null));};exports[_0x7966('0x4f')]=function(_0x52ead2,_0x3b7ed9,_0x3eca13){var _0x226ffd={};var _0x41f21f={};var _0x5a9063;var _0x5ee6ed;return db['SugarcrmConfiguration'][_0x7966('0x50')]({'where':{'id':_0x52ead2[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x3b7ed9,null))[_0x7966('0x26')](function(_0xeecc68){if(_0xeecc68){_0x5a9063=_0xeecc68;_0x41f21f['model']=_[_0x7966('0x36')](db[_0x7966('0x51')][_0x7966('0x30')]);_0x41f21f['query']=_[_0x7966('0x36')](_0x52ead2['query']);_0x41f21f['filters']=_['intersection'](_0x41f21f['model'],_0x41f21f[_0x7966('0x35')]);_0x226ffd[_0x7966('0x38')]=_[_0x7966('0x39')](_0x41f21f[_0x7966('0x34')],qs['fields'](_0x52ead2[_0x7966('0x35')][_0x7966('0x3a')]));_0x226ffd[_0x7966('0x38')]=_0x226ffd[_0x7966('0x38')][_0x7966('0x3b')]?_0x226ffd[_0x7966('0x38')]:_0x41f21f[_0x7966('0x34')];_0x226ffd[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0x52ead2[_0x7966('0x35')][_0x7966('0x3e')]);_0x226ffd[_0x7966('0x42')]=qs[_0x7966('0x37')](_[_0x7966('0x3f')](_0x52ead2[_0x7966('0x35')],_0x41f21f['filters']));if(_0x52ead2['query']['filter']){_0x226ffd['where']=_[_0x7966('0x41')](_0x226ffd[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x226ffd[_0x7966('0x38')],function(_0x26d1e5){var _0x25bd7c={};_0x25bd7c[_0x26d1e5]={'$like':'%'+_0x52ead2[_0x7966('0x35')]['filter']+'%'};return _0x25bd7c;})});}_0x226ffd=_[_0x7966('0x41')]({},_0x226ffd,_0x52ead2['options']);return _0x5a9063['getFields'](_0x226ffd);}})['then'](function(_0x4cbbbf){if(_0x4cbbbf){_0x5ee6ed=_0x4cbbbf[_0x7966('0x3b')];if(!_0x52ead2[_0x7966('0x35')][_0x7966('0x3c')](_0x7966('0x52'))){_0x226ffd[_0x7966('0x20')]=qs[_0x7966('0x20')](_0x52ead2['query'][_0x7966('0x20')]);_0x226ffd[_0x7966('0x1e')]=qs[_0x7966('0x1e')](_0x52ead2[_0x7966('0x35')]['offset']);}return _0x5a9063[_0x7966('0x4f')](_0x226ffd);}})[_0x7966('0x26')](function(_0x332d0f){if(_0x332d0f){return _0x332d0f?{'count':_0x5ee6ed,'rows':_0x332d0f}:null;}})['then'](respondWithResult(_0x3b7ed9,null))[_0x7966('0x49')](handleError(_0x3b7ed9,null));};exports[_0x7966('0x53')]=function(_0xfbda3d,_0x56c0c4,_0x12516e){var _0x27602c={};var _0x22d7be={};var _0x18777c;var _0x1ff81d;return db[_0x7966('0x2f')][_0x7966('0x50')]({'where':{'id':_0xfbda3d[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x56c0c4,null))[_0x7966('0x26')](function(_0x4c7bd2){if(_0x4c7bd2){_0x18777c=_0x4c7bd2;_0x22d7be['model']=_[_0x7966('0x36')](db['SugarcrmField'][_0x7966('0x30')]);_0x22d7be[_0x7966('0x35')]=_[_0x7966('0x36')](_0xfbda3d['query']);_0x22d7be[_0x7966('0x37')]=_[_0x7966('0x39')](_0x22d7be[_0x7966('0x34')],_0x22d7be[_0x7966('0x35')]);_0x27602c[_0x7966('0x38')]=_[_0x7966('0x39')](_0x22d7be[_0x7966('0x34')],qs[_0x7966('0x3a')](_0xfbda3d[_0x7966('0x35')][_0x7966('0x3a')]));_0x27602c[_0x7966('0x38')]=_0x27602c[_0x7966('0x38')][_0x7966('0x3b')]?_0x27602c[_0x7966('0x38')]:_0x22d7be[_0x7966('0x34')];_0x27602c[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0xfbda3d['query'][_0x7966('0x3e')]);_0x27602c[_0x7966('0x42')]=qs['filters'](_[_0x7966('0x3f')](_0xfbda3d[_0x7966('0x35')],_0x22d7be[_0x7966('0x37')]));if(_0xfbda3d[_0x7966('0x35')]['filter']){_0x27602c['where']=_[_0x7966('0x41')](_0x27602c[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x27602c[_0x7966('0x38')],function(_0x296f5d){var _0x1c50ae={};_0x1c50ae[_0x296f5d]={'$like':'%'+_0xfbda3d[_0x7966('0x35')][_0x7966('0x40')]+'%'};return _0x1c50ae;})});}_0x27602c=_[_0x7966('0x41')]({},_0x27602c,_0xfbda3d[_0x7966('0x44')]);return _0x18777c[_0x7966('0x53')](_0x27602c);}})[_0x7966('0x26')](function(_0x464b16){if(_0x464b16){_0x1ff81d=_0x464b16[_0x7966('0x3b')];if(!_0xfbda3d[_0x7966('0x35')][_0x7966('0x3c')](_0x7966('0x52'))){_0x27602c['limit']=qs[_0x7966('0x20')](_0xfbda3d['query'][_0x7966('0x20')]);_0x27602c[_0x7966('0x1e')]=qs['offset'](_0xfbda3d[_0x7966('0x35')][_0x7966('0x1e')]);}return _0x18777c[_0x7966('0x53')](_0x27602c);}})[_0x7966('0x26')](function(_0x2aae23){if(_0x2aae23){return _0x2aae23?{'count':_0x1ff81d,'rows':_0x2aae23}:null;}})['then'](respondWithResult(_0x56c0c4,null))[_0x7966('0x49')](handleError(_0x56c0c4,null));};exports['getDescriptions']=function(_0x3c7f6d,_0x92bf17,_0x7b2c7){var _0x280636={};var _0x37ee72={};var _0x10dc45;var _0x5839f6;return db[_0x7966('0x2f')][_0x7966('0x50')]({'where':{'id':_0x3c7f6d[_0x7966('0x4b')]['id']}})[_0x7966('0x26')](handleEntityNotFound(_0x92bf17,null))[_0x7966('0x26')](function(_0x3b535c){if(_0x3b535c){_0x10dc45=_0x3b535c;_0x37ee72['model']=_[_0x7966('0x36')](db['SugarcrmField'][_0x7966('0x30')]);_0x37ee72[_0x7966('0x35')]=_['keys'](_0x3c7f6d[_0x7966('0x35')]);_0x37ee72[_0x7966('0x37')]=_['intersection'](_0x37ee72[_0x7966('0x34')],_0x37ee72['query']);_0x280636[_0x7966('0x38')]=_[_0x7966('0x39')](_0x37ee72['model'],qs['fields'](_0x3c7f6d[_0x7966('0x35')][_0x7966('0x3a')]));_0x280636['attributes']=_0x280636[_0x7966('0x38')]['length']?_0x280636['attributes']:_0x37ee72[_0x7966('0x34')];_0x280636[_0x7966('0x3d')]=qs[_0x7966('0x3e')](_0x3c7f6d['query'][_0x7966('0x3e')]);_0x280636['where']=qs['filters'](_[_0x7966('0x3f')](_0x3c7f6d[_0x7966('0x35')],_0x37ee72['filters']));if(_0x3c7f6d['query'][_0x7966('0x40')]){_0x280636['where']=_[_0x7966('0x41')](_0x280636[_0x7966('0x42')],{'$or':_[_0x7966('0x2e')](_0x280636[_0x7966('0x38')],function(_0x15b3c2){var _0x2c5279={};_0x2c5279[_0x15b3c2]={'$like':'%'+_0x3c7f6d[_0x7966('0x35')][_0x7966('0x40')]+'%'};return _0x2c5279;})});}_0x280636=_[_0x7966('0x41')]({},_0x280636,_0x3c7f6d[_0x7966('0x44')]);return _0x10dc45[_0x7966('0x54')](_0x280636);}})['then'](function(_0x3f39cf){if(_0x3f39cf){_0x5839f6=_0x3f39cf[_0x7966('0x3b')];if(!_0x3c7f6d[_0x7966('0x35')]['hasOwnProperty'](_0x7966('0x52'))){_0x280636[_0x7966('0x20')]=qs['limit'](_0x3c7f6d[_0x7966('0x35')][_0x7966('0x20')]);_0x280636[_0x7966('0x1e')]=qs[_0x7966('0x1e')](_0x3c7f6d[_0x7966('0x35')][_0x7966('0x1e')]);}return _0x10dc45[_0x7966('0x54')](_0x280636);}})[_0x7966('0x26')](function(_0x451ee7){if(_0x451ee7){return _0x451ee7?{'count':_0x5839f6,'rows':_0x451ee7}:null;}})[_0x7966('0x26')](respondWithResult(_0x92bf17,null))[_0x7966('0x49')](handleError(_0x92bf17,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2c9c859..646bae2 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 _0x59cf=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x17968b,_0xd64399){var _0x4eabd9=function(_0x33d186){while(--_0x33d186){_0x17968b['push'](_0x17968b['shift']());}};_0x4eabd9(++_0xd64399);}(_0x59cf,0xf7));var _0xf59c=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x59cf[_0x9d1e6b];return _0x2b3070;};'use strict';var _=require(_0xf59c('0x0'));var util=require(_0xf59c('0x1'));var logger=require(_0xf59c('0x2'))(_0xf59c('0x3'));var moment=require(_0xf59c('0x4'));var BPromise=require(_0xf59c('0x5'));var rp=require(_0xf59c('0x6'));var fs=require('fs');var path=require(_0xf59c('0x7'));var rimraf=require(_0xf59c('0x8'));var config=require(_0xf59c('0x9'));var attributes=require(_0xf59c('0xa'));module[_0xf59c('0xb')]=function(_0x2247dd,_0x5a9d64){return _0x2247dd['define'](_0xf59c('0xc'),attributes,{'tableName':_0xf59c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5094=['define','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0x5094,0x152));var _0x4509=function(_0xb1b08c,_0x1961a6){_0xb1b08c=_0xb1b08c-0x0;var _0x608518=_0x5094[_0xb1b08c];return _0x608518;};'use strict';var _=require('lodash');var util=require(_0x4509('0x0'));var logger=require(_0x4509('0x1'))(_0x4509('0x2'));var moment=require(_0x4509('0x3'));var BPromise=require(_0x4509('0x4'));var rp=require(_0x4509('0x5'));var fs=require('fs');var path=require(_0x4509('0x6'));var rimraf=require(_0x4509('0x7'));var config=require(_0x4509('0x8'));var attributes=require(_0x4509('0x9'));module['exports']=function(_0x517e31,_0x3ef798){return _0x517e31[_0x4509('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x4509('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 301102e..6b653a8 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 _0xcc2c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SugarcrmConfiguration,\x20%s,\x20%s','lodash','moment'];(function(_0x521aad,_0xda3810){var _0x34a93a=function(_0x3c9454){while(--_0x3c9454){_0x521aad['push'](_0x521aad['shift']());}};_0x34a93a(++_0xda3810);}(_0xcc2c,0x178));var _0xccc2=function(_0x29cb17,_0x5ea69d){_0x29cb17=_0x29cb17-0x0;var _0x4a5d3c=_0xcc2c[_0x29cb17];return _0x4a5d3c;};'use strict';var _=require(_0xccc2('0x0'));var util=require('util');var moment=require(_0xccc2('0x1'));var BPromise=require('bluebird');var rs=require(_0xccc2('0x2'));var fs=require('fs');var Redis=require(_0xccc2('0x3'));var db=require(_0xccc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xccc2('0x5'))(_0xccc2('0x6'));var config=require('../../config/environment');var jayson=require(_0xccc2('0x7'));var client=jayson[_0xccc2('0x8')][_0xccc2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe65536,_0x1fcedd,_0x1226a9){return new BPromise(function(_0x24c44e,_0x442671){return client[_0xccc2('0xa')](_0xe65536,_0x1226a9)[_0xccc2('0xb')](function(_0xcc48f7){logger[_0xccc2('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1fcedd,_0xccc2('0xd'));logger[_0xccc2('0xe')](_0xccc2('0xf'),_0x1fcedd,_0xccc2('0xd'),JSON[_0xccc2('0x10')](_0xcc48f7));if(_0xcc48f7['error']){if(_0xcc48f7['error'][_0xccc2('0x11')]===0x1f4){logger[_0xccc2('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1fcedd,_0xcc48f7[_0xccc2('0x12')]['message']);return _0x442671(_0xcc48f7['error'][_0xccc2('0x13')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1fcedd,_0xcc48f7['error'][_0xccc2('0x13')]);return _0x24c44e(_0xcc48f7[_0xccc2('0x12')]['message']);}else{logger['info'](_0xccc2('0x14'),_0x1fcedd,_0xccc2('0xd'));_0x24c44e(_0xcc48f7['result']['message']);}})['catch'](function(_0xd94b76){logger[_0xccc2('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1fcedd,_0xd94b76);_0x442671(_0xd94b76);});});} \ No newline at end of file +var _0x230f=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird'];(function(_0x4d3ee3,_0x425fb3){var _0x12606e=function(_0x541b8c){while(--_0x541b8c){_0x4d3ee3['push'](_0x4d3ee3['shift']());}};_0x12606e(++_0x425fb3);}(_0x230f,0x147));var _0xf230=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x230f[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0xf230('0x0'));var util=require('util');var moment=require(_0xf230('0x1'));var BPromise=require(_0xf230('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf230('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf230('0x4'));var logger=require(_0xf230('0x5'))(_0xf230('0x6'));var config=require('../../config/environment');var jayson=require(_0xf230('0x7'));var client=jayson[_0xf230('0x8')][_0xf230('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e54b2,_0x439d29,_0xb0648f){return new BPromise(function(_0x1481cf,_0x56e9cf){return client[_0xf230('0xa')](_0x5e54b2,_0xb0648f)[_0xf230('0xb')](function(_0x34bf81){logger['info'](_0xf230('0xc'),_0x439d29,_0xf230('0xd'));logger[_0xf230('0xe')](_0xf230('0xf'),_0x439d29,_0xf230('0xd'),JSON['stringify'](_0x34bf81));if(_0x34bf81['error']){if(_0x34bf81[_0xf230('0x10')][_0xf230('0x11')]===0x1f4){logger[_0xf230('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x439d29,_0x34bf81[_0xf230('0x10')][_0xf230('0x12')]);return _0x56e9cf(_0x34bf81[_0xf230('0x10')][_0xf230('0x12')]);}logger[_0xf230('0x10')](_0xf230('0xc'),_0x439d29,_0x34bf81['error'][_0xf230('0x12')]);return _0x1481cf(_0x34bf81[_0xf230('0x10')]['message']);}else{logger[_0xf230('0x13')](_0xf230('0xc'),_0x439d29,_0xf230('0xd'));_0x1481cf(_0x34bf81[_0xf230('0x14')][_0xf230('0x12')]);}})[_0xf230('0x15')](function(_0x92b364){logger[_0xf230('0x10')](_0xf230('0xc'),_0x439d29,_0x92b364);_0x56e9cf(_0x92b364);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a8334b8..c52aeec 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 _0xc505=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','put','/:id','destroy','multer','util','path'];(function(_0x2ed5f,_0x5edda2){var _0x3c747f=function(_0x2d8429){while(--_0x2d8429){_0x2ed5f['push'](_0x2ed5f['shift']());}};_0x3c747f(++_0x5edda2);}(_0xc505,0x7d));var _0x5c50=function(_0x4f1378,_0x2ae094){_0x4f1378=_0x4f1378-0x0;var _0x1e33d2=_0xc505[_0x4f1378];return _0x1e33d2;};'use strict';var multer=require(_0x5c50('0x0'));var util=require(_0x5c50('0x1'));var path=require(_0x5c50('0x2'));var timeout=require(_0x5c50('0x3'));var express=require(_0x5c50('0x4'));var router=express['Router']();var fs_extra=require(_0x5c50('0x5'));var auth=require(_0x5c50('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5c50('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x5c50('0x8')]('/',auth[_0x5c50('0x9')](),controller[_0x5c50('0xa')]);router[_0x5c50('0x8')]('/:id',auth[_0x5c50('0x9')](),controller[_0x5c50('0xb')]);router[_0x5c50('0xc')]('/',auth[_0x5c50('0x9')](),controller['create']);router[_0x5c50('0xd')](_0x5c50('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5c50('0xe'),auth[_0x5c50('0x9')](),controller[_0x5c50('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8bfd=['create','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x37445c,_0x413b45){var _0x37b861=function(_0x237657){while(--_0x237657){_0x37445c['push'](_0x37445c['shift']());}};_0x37b861(++_0x413b45);}(_0x8bfd,0xbe));var _0xd8bf=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x8bfd[_0x351b46];return _0x1515df;};'use strict';var multer=require(_0xd8bf('0x0'));var util=require('util');var path=require(_0xd8bf('0x1'));var timeout=require(_0xd8bf('0x2'));var express=require(_0xd8bf('0x3'));var router=express[_0xd8bf('0x4')]();var fs_extra=require(_0xd8bf('0x5'));var auth=require(_0xd8bf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd8bf('0x7'));router[_0xd8bf('0x8')]('/',auth['isAuthenticated'](),controller[_0xd8bf('0x9')]);router[_0xd8bf('0x8')](_0xd8bf('0xa'),auth[_0xd8bf('0xb')](),controller[_0xd8bf('0xc')]);router[_0xd8bf('0xd')]('/',auth[_0xd8bf('0xb')](),controller[_0xd8bf('0xe')]);router['put'](_0xd8bf('0xa'),auth[_0xd8bf('0xb')](),controller['update']);router['delete'](_0xd8bf('0xa'),auth['isAuthenticated'](),controller[_0xd8bf('0xf')]);module[_0xd8bf('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 166a9c8..d8d5e7a 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 _0x1191=['variable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0x1191,0x1e7));var _0x1119=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1191[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x1119('0x0'));module['exports']={'type':{'type':Sequelize[_0x1119('0x1')](_0x1119('0x2'),_0x1119('0x3'),'customVariable',_0x1119('0x4'),'picklist'),'defaultValue':_0x1119('0x2')},'content':{'type':Sequelize[_0x1119('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1119('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1119('0x5')]},'idField':{'type':Sequelize[_0x1119('0x5')]},'nameField':{'type':Sequelize[_0x1119('0x5')]},'customField':{'type':Sequelize[_0x1119('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xef2d=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x4fcb4a,_0x33cd8e){var _0x4ff769=function(_0x384338){while(--_0x384338){_0x4fcb4a['push'](_0x4fcb4a['shift']());}};_0x4ff769(++_0x33cd8e);}(_0xef2d,0xb4));var _0xdef2=function(_0xacec5,_0xc6e455){_0xacec5=_0xacec5-0x0;var _0x28fbb6=_0xef2d[_0xacec5];return _0x28fbb6;};'use strict';var Sequelize=require(_0xdef2('0x0'));module[_0xdef2('0x1')]={'type':{'type':Sequelize[_0xdef2('0x2')](_0xdef2('0x3'),_0xdef2('0x4'),'customVariable',_0xdef2('0x5'),'picklist'),'defaultValue':_0xdef2('0x3')},'content':{'type':Sequelize[_0xdef2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdef2('0x2')](_0xdef2('0x3'),_0xdef2('0x4'),_0xdef2('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdef2('0x6')]},'nameField':{'type':Sequelize[_0xdef2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdef2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c5e3957..c008283 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 _0x86a8=['bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../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','apply','reject','save','update','then','destroy','error','stack','name','map','SugarcrmField','rawAttributes','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','catch','show','intersection','find','create','body','params','eml-format','fast-json-patch','request-promise','moment'];(function(_0x23c6fe,_0x528679){var _0x244080=function(_0xe3b354){while(--_0xe3b354){_0x23c6fe['push'](_0x23c6fe['shift']());}};_0x244080(++_0x528679);}(_0x86a8,0x86));var _0x886a=function(_0xbd15d6,_0x444af6){_0xbd15d6=_0xbd15d6-0x0;var _0x2c6eb1=_0x86a8[_0xbd15d6];return _0x2c6eb1;};'use strict';var emlformat=require(_0x886a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x886a('0x1'));var rp=require(_0x886a('0x2'));var moment=require(_0x886a('0x3'));var BPromise=require(_0x886a('0x4'));var Mustache=require('mustache');var util=require(_0x886a('0x5'));var path=require(_0x886a('0x6'));var sox=require(_0x886a('0x7'));var csv=require(_0x886a('0x8'));var ejs=require(_0x886a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x886a('0xa'));var squel=require(_0x886a('0xb'));var crypto=require('crypto');var jsforce=require(_0x886a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x886a('0xd'));var Redis=require('ioredis');var authService=require(_0x886a('0xe'));var qs=require(_0x886a('0xf'));var as=require(_0x886a('0x10'));var hardwareService=require(_0x886a('0x11'));var logger=require('../../config/logger')(_0x886a('0x12'));var utils=require(_0x886a('0x13'));var config=require(_0x886a('0x14'));var licenseUtil=require(_0x886a('0x15'));var db=require(_0x886a('0x16'))['db'];function respondWithStatusCode(_0x4f3816,_0x4cad15){_0x4cad15=_0x4cad15||0xcc;return function(_0x2bed51){if(_0x2bed51){return _0x4f3816[_0x886a('0x17')](_0x4cad15);}return _0x4f3816[_0x886a('0x18')](_0x4cad15)['end']();};}function respondWithResult(_0x155dce,_0x4c1a0d){_0x4c1a0d=_0x4c1a0d||0xc8;return function(_0x49c310){if(_0x49c310){return _0x155dce['status'](_0x4c1a0d)[_0x886a('0x19')](_0x49c310);}};}function respondWithFilteredResult(_0x548569,_0x4d320c){return function(_0xa592e5){if(_0xa592e5){var _0x2c9613=typeof _0x4d320c[_0x886a('0x1a')]===_0x886a('0x1b')&&typeof _0x4d320c[_0x886a('0x1c')]==='undefined';var _0x264ada=_0xa592e5['count'];var _0x883e19=_0x2c9613?0x0:_0x4d320c[_0x886a('0x1a')];var _0x5ce5a5=_0x2c9613?_0xa592e5[_0x886a('0x1d')]:_0x4d320c[_0x886a('0x1a')]+_0x4d320c[_0x886a('0x1c')];var _0x60100f;if(_0x5ce5a5>=_0x264ada){_0x5ce5a5=_0x264ada;_0x60100f=0xc8;}else{_0x60100f=0xce;}_0x548569[_0x886a('0x18')](_0x60100f);return _0x548569['set']('Content-Range',_0x883e19+'-'+_0x5ce5a5+'/'+_0x264ada)['json'](_0xa592e5);}return null;};}function patchUpdates(_0x14555e){return function(_0x597b16){try{jsonpatch[_0x886a('0x1e')](_0x597b16,_0x14555e,!![]);}catch(_0xb6ccd5){return BPromise[_0x886a('0x1f')](_0xb6ccd5);}return _0x597b16[_0x886a('0x20')]();};}function saveUpdates(_0x4e64c1,_0x452855){return function(_0x3b57ef){if(_0x3b57ef){return _0x3b57ef[_0x886a('0x21')](_0x4e64c1)[_0x886a('0x22')](function(_0x42b7ff){return _0x42b7ff;});}return null;};}function removeEntity(_0x5d56e2,_0x15d7fa){return function(_0x50dd06){if(_0x50dd06){return _0x50dd06[_0x886a('0x23')]()['then'](function(){_0x5d56e2[_0x886a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd864,_0x959752){return function(_0x48f1c5){if(!_0x48f1c5){_0x3fd864[_0x886a('0x17')](0x194);}return _0x48f1c5;};}function handleError(_0x3eb07d,_0x39fe98){_0x39fe98=_0x39fe98||0x1f4;return function(_0x3929dc){logger[_0x886a('0x24')](_0x3929dc[_0x886a('0x25')]);if(_0x3929dc[_0x886a('0x26')]){delete _0x3929dc[_0x886a('0x26')];}_0x3eb07d[_0x886a('0x18')](_0x39fe98)['send'](_0x3929dc);};}exports['index']=function(_0x17af50,_0x3d63dd){var _0x3032c0={},_0x3eb249={},_0x360f88={'count':0x0,'rows':[]};var _0x4e576d=_[_0x886a('0x27')](db[_0x886a('0x28')][_0x886a('0x29')],function(_0x5213ea){return{'name':_0x5213ea['fieldName'],'type':_0x5213ea[_0x886a('0x2a')][_0x886a('0x2b')]};});_0x3eb249[_0x886a('0x2c')]=_[_0x886a('0x27')](_0x4e576d,'name');_0x3eb249[_0x886a('0x2d')]=_[_0x886a('0x2e')](_0x17af50[_0x886a('0x2d')]);_0x3eb249['filters']=_['intersection'](_0x3eb249[_0x886a('0x2c')],_0x3eb249['query']);_0x3032c0[_0x886a('0x2f')]=_['intersection'](_0x3eb249[_0x886a('0x2c')],qs[_0x886a('0x30')](_0x17af50[_0x886a('0x2d')][_0x886a('0x30')]));_0x3032c0[_0x886a('0x2f')]=_0x3032c0[_0x886a('0x2f')][_0x886a('0x31')]?_0x3032c0[_0x886a('0x2f')]:_0x3eb249[_0x886a('0x2c')];if(!_0x17af50[_0x886a('0x2d')]['hasOwnProperty'](_0x886a('0x32'))){_0x3032c0[_0x886a('0x1c')]=qs[_0x886a('0x1c')](_0x17af50[_0x886a('0x2d')][_0x886a('0x1c')]);_0x3032c0[_0x886a('0x1a')]=qs[_0x886a('0x1a')](_0x17af50[_0x886a('0x2d')][_0x886a('0x1a')]);}_0x3032c0[_0x886a('0x33')]=qs[_0x886a('0x34')](_0x17af50[_0x886a('0x2d')][_0x886a('0x34')]);_0x3032c0[_0x886a('0x35')]=qs['filters'](_[_0x886a('0x36')](_0x17af50[_0x886a('0x2d')],_0x3eb249[_0x886a('0x37')]),_0x4e576d);if(_0x17af50[_0x886a('0x2d')][_0x886a('0x38')]){_0x3032c0[_0x886a('0x35')]=_[_0x886a('0x39')](_0x3032c0['where'],{'$or':_[_0x886a('0x27')](_0x4e576d,function(_0x555737){if(_0x555737[_0x886a('0x2a')]!=='VIRTUAL'){var _0x501525={};_0x501525[_0x555737[_0x886a('0x26')]]={'$like':'%'+_0x17af50['query']['filter']+'%'};return _0x501525;}})});}_0x3032c0=_['merge']({},_0x3032c0,_0x17af50[_0x886a('0x3a')]);var _0x233165={'where':_0x3032c0[_0x886a('0x35')]};return db[_0x886a('0x28')][_0x886a('0x1d')](_0x233165)['then'](function(_0xd16caf){_0x360f88['count']=_0xd16caf;if(_0x17af50[_0x886a('0x2d')][_0x886a('0x3b')]){_0x3032c0[_0x886a('0x3c')]=[{'all':!![]}];}return db[_0x886a('0x28')][_0x886a('0x3d')](_0x3032c0);})[_0x886a('0x22')](function(_0x124daf){_0x360f88['rows']=_0x124daf;return _0x360f88;})[_0x886a('0x22')](respondWithFilteredResult(_0x3d63dd,_0x3032c0))[_0x886a('0x3e')](handleError(_0x3d63dd,null));};exports[_0x886a('0x3f')]=function(_0x1a5da5,_0x5bd3b9){var _0x7ca987={'raw':!![],'where':{'id':_0x1a5da5['params']['id']}},_0x4204c1={};_0x4204c1[_0x886a('0x2c')]=_[_0x886a('0x2e')](db[_0x886a('0x28')][_0x886a('0x29')]);_0x4204c1['query']=_[_0x886a('0x2e')](_0x1a5da5[_0x886a('0x2d')]);_0x4204c1[_0x886a('0x37')]=_[_0x886a('0x40')](_0x4204c1[_0x886a('0x2c')],_0x4204c1['query']);_0x7ca987[_0x886a('0x2f')]=_['intersection'](_0x4204c1['model'],qs[_0x886a('0x30')](_0x1a5da5['query'][_0x886a('0x30')]));_0x7ca987[_0x886a('0x2f')]=_0x7ca987[_0x886a('0x2f')]['length']?_0x7ca987[_0x886a('0x2f')]:_0x4204c1[_0x886a('0x2c')];if(_0x1a5da5[_0x886a('0x2d')][_0x886a('0x3b')]){_0x7ca987['include']=[{'all':!![]}];}_0x7ca987=_['merge']({},_0x7ca987,_0x1a5da5[_0x886a('0x3a')]);return db[_0x886a('0x28')][_0x886a('0x41')](_0x7ca987)[_0x886a('0x22')](handleEntityNotFound(_0x5bd3b9,null))['then'](respondWithResult(_0x5bd3b9,null))[_0x886a('0x3e')](handleError(_0x5bd3b9,null));};exports[_0x886a('0x42')]=function(_0x52dc7b,_0x52d368){return db[_0x886a('0x28')][_0x886a('0x42')](_0x52dc7b[_0x886a('0x43')],{})['then'](respondWithResult(_0x52d368,0xc9))['catch'](handleError(_0x52d368,null));};exports[_0x886a('0x21')]=function(_0x50ffaa,_0x42d5ca){if(_0x50ffaa[_0x886a('0x43')]['id']){delete _0x50ffaa['body']['id'];}return db['SugarcrmField'][_0x886a('0x41')]({'where':{'id':_0x50ffaa['params']['id']}})[_0x886a('0x22')](handleEntityNotFound(_0x42d5ca,null))[_0x886a('0x22')](saveUpdates(_0x50ffaa[_0x886a('0x43')],null))[_0x886a('0x22')](respondWithResult(_0x42d5ca,null))[_0x886a('0x3e')](handleError(_0x42d5ca,null));};exports['destroy']=function(_0x50176d,_0x2e9f51){return db['SugarcrmField']['find']({'where':{'id':_0x50176d[_0x886a('0x44')]['id']}})[_0x886a('0x22')](handleEntityNotFound(_0x2e9f51,null))['then'](removeEntity(_0x2e9f51,null))[_0x886a('0x3e')](handleError(_0x2e9f51,null));}; \ No newline at end of file +var _0x5256=['then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x31c026,_0x53f703){var _0x1a15b=function(_0xe1c32){while(--_0xe1c32){_0x31c026['push'](_0x31c026['shift']());}};_0x1a15b(++_0x53f703);}(_0x5256,0x1d5));var _0x6525=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5256[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0x6525('0x0'));var rimraf=require(_0x6525('0x1'));var zipdir=require(_0x6525('0x2'));var jsonpatch=require(_0x6525('0x3'));var rp=require(_0x6525('0x4'));var moment=require('moment');var BPromise=require(_0x6525('0x5'));var Mustache=require(_0x6525('0x6'));var util=require(_0x6525('0x7'));var path=require(_0x6525('0x8'));var sox=require(_0x6525('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6525('0xa'));var squel=require(_0x6525('0xb'));var crypto=require(_0x6525('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6525('0xd'));var toCsv=require(_0x6525('0xe'));var querystring=require(_0x6525('0xf'));var Papa=require(_0x6525('0x10'));var Redis=require(_0x6525('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6525('0x12'));var as=require(_0x6525('0x13'));var hardwareService=require(_0x6525('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6525('0x15'));var config=require(_0x6525('0x16'));var licenseUtil=require(_0x6525('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b15c,_0x2255af){_0x2255af=_0x2255af||0xcc;return function(_0x552d06){if(_0x552d06){return _0x35b15c['sendStatus'](_0x2255af);}return _0x35b15c[_0x6525('0x18')](_0x2255af)[_0x6525('0x19')]();};}function respondWithResult(_0xee166,_0x21797f){_0x21797f=_0x21797f||0xc8;return function(_0x531d24){if(_0x531d24){return _0xee166[_0x6525('0x18')](_0x21797f)[_0x6525('0x1a')](_0x531d24);}};}function respondWithFilteredResult(_0x37d887,_0x25fd83){return function(_0x487452){if(_0x487452){var _0x2e54fb=typeof _0x25fd83[_0x6525('0x1b')]===_0x6525('0x1c')&&typeof _0x25fd83['limit']===_0x6525('0x1c');var _0x278804=_0x487452[_0x6525('0x1d')];var _0x6a6475=_0x2e54fb?0x0:_0x25fd83[_0x6525('0x1b')];var _0x5b7528=_0x2e54fb?_0x487452[_0x6525('0x1d')]:_0x25fd83['offset']+_0x25fd83[_0x6525('0x1e')];var _0x1636b1;if(_0x5b7528>=_0x278804){_0x5b7528=_0x278804;_0x1636b1=0xc8;}else{_0x1636b1=0xce;}_0x37d887[_0x6525('0x18')](_0x1636b1);return _0x37d887[_0x6525('0x1f')](_0x6525('0x20'),_0x6a6475+'-'+_0x5b7528+'/'+_0x278804)[_0x6525('0x1a')](_0x487452);}return null;};}function patchUpdates(_0x3cabec){return function(_0x381a3e){try{jsonpatch[_0x6525('0x21')](_0x381a3e,_0x3cabec,!![]);}catch(_0x200cbc){return BPromise['reject'](_0x200cbc);}return _0x381a3e[_0x6525('0x22')]();};}function saveUpdates(_0x3d89f2,_0x2901a6){return function(_0x428deb){if(_0x428deb){return _0x428deb['update'](_0x3d89f2)[_0x6525('0x23')](function(_0x230a77){return _0x230a77;});}return null;};}function removeEntity(_0x17688b,_0xec202a){return function(_0x2cd7a5){if(_0x2cd7a5){return _0x2cd7a5[_0x6525('0x24')]()[_0x6525('0x23')](function(){_0x17688b[_0x6525('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b32a6,_0x3a31b3){return function(_0x14cd8c){if(!_0x14cd8c){_0x2b32a6['sendStatus'](0x194);}return _0x14cd8c;};}function handleError(_0x1ff1e9,_0x32159a){_0x32159a=_0x32159a||0x1f4;return function(_0x30427a){logger[_0x6525('0x25')](_0x30427a[_0x6525('0x26')]);if(_0x30427a[_0x6525('0x27')]){delete _0x30427a['name'];}_0x1ff1e9[_0x6525('0x18')](_0x32159a)[_0x6525('0x28')](_0x30427a);};}exports[_0x6525('0x29')]=function(_0x46773c,_0x5518ae){var _0x5a23f5={},_0x24cdc7={},_0x14fb9b={'count':0x0,'rows':[]};var _0x3466cb=_[_0x6525('0x2a')](db[_0x6525('0x2b')][_0x6525('0x2c')],function(_0x2c10a1){return{'name':_0x2c10a1['fieldName'],'type':_0x2c10a1[_0x6525('0x2d')][_0x6525('0x2e')]};});_0x24cdc7[_0x6525('0x2f')]=_['map'](_0x3466cb,_0x6525('0x27'));_0x24cdc7[_0x6525('0x30')]=_[_0x6525('0x31')](_0x46773c[_0x6525('0x30')]);_0x24cdc7[_0x6525('0x32')]=_[_0x6525('0x33')](_0x24cdc7[_0x6525('0x2f')],_0x24cdc7[_0x6525('0x30')]);_0x5a23f5[_0x6525('0x34')]=_['intersection'](_0x24cdc7[_0x6525('0x2f')],qs[_0x6525('0x35')](_0x46773c[_0x6525('0x30')][_0x6525('0x35')]));_0x5a23f5['attributes']=_0x5a23f5[_0x6525('0x34')][_0x6525('0x36')]?_0x5a23f5[_0x6525('0x34')]:_0x24cdc7['model'];if(!_0x46773c[_0x6525('0x30')][_0x6525('0x37')]('nolimit')){_0x5a23f5[_0x6525('0x1e')]=qs[_0x6525('0x1e')](_0x46773c[_0x6525('0x30')][_0x6525('0x1e')]);_0x5a23f5[_0x6525('0x1b')]=qs['offset'](_0x46773c[_0x6525('0x30')][_0x6525('0x1b')]);}_0x5a23f5[_0x6525('0x38')]=qs['sort'](_0x46773c[_0x6525('0x30')]['sort']);_0x5a23f5[_0x6525('0x39')]=qs['filters'](_['pick'](_0x46773c[_0x6525('0x30')],_0x24cdc7[_0x6525('0x32')]),_0x3466cb);if(_0x46773c[_0x6525('0x30')][_0x6525('0x3a')]){_0x5a23f5['where']=_[_0x6525('0x3b')](_0x5a23f5['where'],{'$or':_[_0x6525('0x2a')](_0x3466cb,function(_0x437603){if(_0x437603[_0x6525('0x2d')]!==_0x6525('0x3c')){var _0xed32bc={};_0xed32bc[_0x437603[_0x6525('0x27')]]={'$like':'%'+_0x46773c['query'][_0x6525('0x3a')]+'%'};return _0xed32bc;}})});}_0x5a23f5=_[_0x6525('0x3b')]({},_0x5a23f5,_0x46773c[_0x6525('0x3d')]);var _0x5f4968={'where':_0x5a23f5[_0x6525('0x39')]};return db[_0x6525('0x2b')]['count'](_0x5f4968)[_0x6525('0x23')](function(_0x4f1b47){_0x14fb9b[_0x6525('0x1d')]=_0x4f1b47;if(_0x46773c[_0x6525('0x30')][_0x6525('0x3e')]){_0x5a23f5[_0x6525('0x3f')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x5a23f5);})[_0x6525('0x23')](function(_0x25a461){_0x14fb9b[_0x6525('0x40')]=_0x25a461;return _0x14fb9b;})[_0x6525('0x23')](respondWithFilteredResult(_0x5518ae,_0x5a23f5))[_0x6525('0x41')](handleError(_0x5518ae,null));};exports[_0x6525('0x42')]=function(_0x1a40fd,_0x13ae0e){var _0x55d802={'raw':!![],'where':{'id':_0x1a40fd[_0x6525('0x43')]['id']}},_0x533f97={};_0x533f97[_0x6525('0x2f')]=_[_0x6525('0x31')](db[_0x6525('0x2b')][_0x6525('0x2c')]);_0x533f97[_0x6525('0x30')]=_[_0x6525('0x31')](_0x1a40fd[_0x6525('0x30')]);_0x533f97[_0x6525('0x32')]=_['intersection'](_0x533f97[_0x6525('0x2f')],_0x533f97[_0x6525('0x30')]);_0x55d802[_0x6525('0x34')]=_[_0x6525('0x33')](_0x533f97[_0x6525('0x2f')],qs['fields'](_0x1a40fd[_0x6525('0x30')][_0x6525('0x35')]));_0x55d802[_0x6525('0x34')]=_0x55d802[_0x6525('0x34')][_0x6525('0x36')]?_0x55d802['attributes']:_0x533f97[_0x6525('0x2f')];if(_0x1a40fd['query']['includeAll']){_0x55d802[_0x6525('0x3f')]=[{'all':!![]}];}_0x55d802=_[_0x6525('0x3b')]({},_0x55d802,_0x1a40fd[_0x6525('0x3d')]);return db[_0x6525('0x2b')][_0x6525('0x44')](_0x55d802)[_0x6525('0x23')](handleEntityNotFound(_0x13ae0e,null))[_0x6525('0x23')](respondWithResult(_0x13ae0e,null))['catch'](handleError(_0x13ae0e,null));};exports[_0x6525('0x45')]=function(_0x3ea381,_0x3b71bb){return db[_0x6525('0x2b')]['create'](_0x3ea381[_0x6525('0x46')],{})[_0x6525('0x23')](respondWithResult(_0x3b71bb,0xc9))[_0x6525('0x41')](handleError(_0x3b71bb,null));};exports[_0x6525('0x47')]=function(_0x19b99e,_0xda9d94){if(_0x19b99e['body']['id']){delete _0x19b99e[_0x6525('0x46')]['id'];}return db[_0x6525('0x2b')][_0x6525('0x44')]({'where':{'id':_0x19b99e[_0x6525('0x43')]['id']}})['then'](handleEntityNotFound(_0xda9d94,null))['then'](saveUpdates(_0x19b99e[_0x6525('0x46')],null))[_0x6525('0x23')](respondWithResult(_0xda9d94,null))['catch'](handleError(_0xda9d94,null));};exports[_0x6525('0x24')]=function(_0x385ed3,_0x203366){return db['SugarcrmField']['find']({'where':{'id':_0x385ed3[_0x6525('0x43')]['id']}})[_0x6525('0x23')](handleEntityNotFound(_0x203366,null))[_0x6525('0x23')](removeEntity(_0x203366,null))[_0x6525('0x41')](handleError(_0x203366,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1ba7a71..67de3ad 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 _0x6a8d=['../../config/environment','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x6a8d,0xc8));var _0xd6a8=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x6a8d[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xd6a8('0x0'));var util=require(_0xd6a8('0x1'));var logger=require('../../config/logger')(_0xd6a8('0x2'));var moment=require(_0xd6a8('0x3'));var BPromise=require(_0xd6a8('0x4'));var rp=require(_0xd6a8('0x5'));var fs=require('fs');var path=require(_0xd6a8('0x6'));var rimraf=require(_0xd6a8('0x7'));var config=require(_0xd6a8('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xd6a8('0x9')]=function(_0x44d01e,_0x245f6a){return _0x44d01e['define'](_0xd6a8('0xa'),attributes,{'tableName':_0xd6a8('0xb'),'paranoid':![],'indexes':[{'name':_0xd6a8('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb5=['sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x7a0dc4,_0x3ad603){var _0x205820=function(_0x540c07){while(--_0x540c07){_0x7a0dc4['push'](_0x7a0dc4['shift']());}};_0x205820(++_0x3ad603);}(_0xdeb5,0x188));var _0x5deb=function(_0x590275,_0x5b9a6a){_0x590275=_0x590275-0x0;var _0x102a13=_0xdeb5[_0x590275];return _0x102a13;};'use strict';var _=require(_0x5deb('0x0'));var util=require(_0x5deb('0x1'));var logger=require(_0x5deb('0x2'))(_0x5deb('0x3'));var moment=require(_0x5deb('0x4'));var BPromise=require(_0x5deb('0x5'));var rp=require(_0x5deb('0x6'));var fs=require('fs');var path=require(_0x5deb('0x7'));var rimraf=require('rimraf');var config=require(_0x5deb('0x8'));var attributes=require(_0x5deb('0x9'));module['exports']=function(_0x28baf7,_0x1cdb07){return _0x28baf7[_0x5deb('0xa')](_0x5deb('0xb'),attributes,{'tableName':_0x5deb('0xc'),'paranoid':![],'indexes':[{'name':_0x5deb('0xd'),'fields':['idField',_0x5deb('0xe')],'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 958e128..c50540d 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 _0xa193=['info','request\x20sent','debug','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','client','http','request','then'];(function(_0x2cf06f,_0x13c1a4){var _0x3365a2=function(_0x57efa0){while(--_0x57efa0){_0x2cf06f['push'](_0x2cf06f['shift']());}};_0x3365a2(++_0x13c1a4);}(_0xa193,0x1ed));var _0x3a19=function(_0xe2acc0,_0x201725){_0xe2acc0=_0xe2acc0-0x0;var _0x25612e=_0xa193[_0xe2acc0];return _0x25612e;};'use strict';var _=require(_0x3a19('0x0'));var util=require(_0x3a19('0x1'));var moment=require(_0x3a19('0x2'));var BPromise=require(_0x3a19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a19('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a19('0x5'));var config=require(_0x3a19('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3a19('0x7')][_0x3a19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c6a78,_0x5c86b3,_0x4c1532){return new BPromise(function(_0x635af0,_0x2dd31d){return client[_0x3a19('0x9')](_0x2c6a78,_0x4c1532)[_0x3a19('0xa')](function(_0xade63a){logger[_0x3a19('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x5c86b3,_0x3a19('0xc'));logger[_0x3a19('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5c86b3,_0x3a19('0xc'),JSON[_0x3a19('0xe')](_0xade63a));if(_0xade63a[_0x3a19('0xf')]){if(_0xade63a[_0x3a19('0xf')][_0x3a19('0x10')]===0x1f4){logger[_0x3a19('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x5c86b3,_0xade63a[_0x3a19('0xf')]['message']);return _0x2dd31d(_0xade63a['error'][_0x3a19('0x11')]);}logger[_0x3a19('0xf')](_0x3a19('0x12'),_0x5c86b3,_0xade63a[_0x3a19('0xf')][_0x3a19('0x11')]);return _0x635af0(_0xade63a[_0x3a19('0xf')][_0x3a19('0x11')]);}else{logger[_0x3a19('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x5c86b3,_0x3a19('0xc'));_0x635af0(_0xade63a[_0x3a19('0x13')][_0x3a19('0x11')]);}})[_0x3a19('0x14')](function(_0x4665b1){logger[_0x3a19('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x5c86b3,_0x4665b1);_0x2dd31d(_0x4665b1);});});} \ No newline at end of file +var _0xbc24=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x237f86,_0x104a7f){var _0x23a496=function(_0x23054f){while(--_0x23054f){_0x237f86['push'](_0x237f86['shift']());}};_0x23a496(++_0x104a7f);}(_0xbc24,0xac));var _0x4bc2=function(_0xfb11e4,_0x5f54d5){_0xfb11e4=_0xfb11e4-0x0;var _0x575b9e=_0xbc24[_0xfb11e4];return _0x575b9e;};'use strict';var _=require('lodash');var util=require(_0x4bc2('0x0'));var moment=require(_0x4bc2('0x1'));var BPromise=require(_0x4bc2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bc2('0x3'))['db'];var utils=require(_0x4bc2('0x4'));var logger=require(_0x4bc2('0x5'))(_0x4bc2('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bc2('0x7'));var client=jayson['client'][_0x4bc2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ee1d5,_0x5c7aae,_0x5c9db9){return new BPromise(function(_0x4d8642,_0x3d9c27){return client[_0x4bc2('0x9')](_0x1ee1d5,_0x5c9db9)[_0x4bc2('0xa')](function(_0x33ffe4){logger['info'](_0x4bc2('0xb'),_0x5c7aae,_0x4bc2('0xc'));logger[_0x4bc2('0xd')](_0x4bc2('0xe'),_0x5c7aae,_0x4bc2('0xc'),JSON[_0x4bc2('0xf')](_0x33ffe4));if(_0x33ffe4[_0x4bc2('0x10')]){if(_0x33ffe4[_0x4bc2('0x10')]['code']===0x1f4){logger[_0x4bc2('0x10')](_0x4bc2('0xb'),_0x5c7aae,_0x33ffe4['error']['message']);return _0x3d9c27(_0x33ffe4['error'][_0x4bc2('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x5c7aae,_0x33ffe4[_0x4bc2('0x10')][_0x4bc2('0x11')]);return _0x4d8642(_0x33ffe4['error'][_0x4bc2('0x11')]);}else{logger[_0x4bc2('0x12')](_0x4bc2('0xb'),_0x5c7aae,_0x4bc2('0xc'));_0x4d8642(_0x33ffe4[_0x4bc2('0x13')][_0x4bc2('0x11')]);}})[_0x4bc2('0x14')](function(_0xf43829){logger[_0x4bc2('0x10')](_0x4bc2('0xb'),_0x5c7aae,_0xf43829);_0x3d9c27(_0xf43829);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 71e6fac..07cc7a0 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 _0xe13a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','/:id','exports','util','path'];(function(_0x58aefa,_0x3ad0d9){var _0x331c0d=function(_0x5d95db){while(--_0x5d95db){_0x58aefa['push'](_0x58aefa['shift']());}};_0x331c0d(++_0x3ad0d9);}(_0xe13a,0x178));var _0xae13=function(_0x462fb5,_0x157f7a){_0x462fb5=_0x462fb5-0x0;var _0x3881ec=_0xe13a[_0x462fb5];return _0x3881ec;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/:id',auth[_0xae13('0xa')](),controller[_0xae13('0xc')]);router[_0xae13('0x9')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0x9')](_0xae13('0xf'),auth[_0xae13('0xa')](),controller['getFields']);router[_0xae13('0x10')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0x11')]);router[_0xae13('0x10')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0x12')]);router['put'](_0xae13('0x13'),auth[_0xae13('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xae13('0x14')]=router; \ No newline at end of file +var _0xa459=['/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get'];(function(_0x27740a,_0x537f2c){var _0x1f7dad=function(_0x28d7f3){while(--_0x28d7f3){_0x27740a['push'](_0x27740a['shift']());}};_0x1f7dad(++_0x537f2c);}(_0xa459,0x1d8));var _0x9a45=function(_0x586fc0,_0x1ca661){_0x586fc0=_0x586fc0-0x0;var _0x2e6a73=_0xa459[_0x586fc0];return _0x2e6a73;};'use strict';var multer=require(_0x9a45('0x0'));var util=require(_0x9a45('0x1'));var path=require(_0x9a45('0x2'));var timeout=require(_0x9a45('0x3'));var express=require(_0x9a45('0x4'));var router=express[_0x9a45('0x5')]();var fs_extra=require(_0x9a45('0x6'));var auth=require(_0x9a45('0x7'));var interaction=require(_0x9a45('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x9a45('0x9')](),controller['index']);router[_0x9a45('0xa')](_0x9a45('0xb'),auth[_0x9a45('0x9')](),controller[_0x9a45('0xc')]);router[_0x9a45('0xa')](_0x9a45('0xd'),auth['isAuthenticated'](),controller[_0x9a45('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x9a45('0xf')]);router[_0x9a45('0x10')]('/',auth[_0x9a45('0x9')](),controller['create']);router[_0x9a45('0x10')](_0x9a45('0xd'),auth[_0x9a45('0x9')](),controller[_0x9a45('0x11')]);router[_0x9a45('0x12')](_0x9a45('0xb'),auth[_0x9a45('0x9')](),controller[_0x9a45('0x13')]);router[_0x9a45('0x14')]('/:id',auth[_0x9a45('0x9')](),controller[_0x9a45('0x15')]);module[_0x9a45('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 6c28978..bfc9a9e 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 _0xebdb=['exports','STRING','HelpDesk','sequelize'];(function(_0x194c10,_0x4e5fbf){var _0x3e425d=function(_0x2a46f8){while(--_0x2a46f8){_0x194c10['push'](_0x194c10['shift']());}};_0x3e425d(++_0x4e5fbf);}(_0xebdb,0xb7));var _0xbebd=function(_0x592b6f,_0x35cb77){_0x592b6f=_0x592b6f-0x0;var _0x142f69=_0xebdb[_0x592b6f];return _0x142f69;};'use strict';var Sequelize=require(_0xbebd('0x0'));module[_0xbebd('0x1')]={'name':{'type':Sequelize[_0xbebd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbebd('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbebd('0x2')],'allowNull':![],'defaultValue':_0xbebd('0x3')},'remoteUri':{'type':Sequelize[_0xbebd('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xbebd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x196f=['STRING','sequelize'];(function(_0x751b64,_0x2a72f7){var _0x38e165=function(_0x14f9f1){while(--_0x14f9f1){_0x751b64['push'](_0x751b64['shift']());}};_0x38e165(++_0x2a72f7);}(_0x196f,0xef));var _0xf196=function(_0xd2ff7a,_0x5ed65c){_0xd2ff7a=_0xd2ff7a-0x0;var _0x2be5d7=_0x196f[_0xd2ff7a];return _0x2be5d7;};'use strict';var Sequelize=require(_0xf196('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf196('0x1')]},'username':{'type':Sequelize[_0xf196('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf196('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xf196('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf196('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf196('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 0360c86..6b6f4a1 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 _0x9f75=['params','rawAttributes','find','create','body','getConfigurations','VtigerConfiguration','length','order','pick','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','GET','getchallenge','login','result','success','describe','sessionName','autogenerated','reference','owner','includes','remove','editable','startsWith','cf_','picklistValues','label','vTiger\x20error:\x20','statusCode','error','stringify','test','eml-format','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','count','limit','set','apply','reject','save','update','then','destroy','stack','map','VtigerAccount','fieldName','model','name','query','keys','filters','intersection','fields','attributes','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9f75,0x176));var _0x59f7=function(_0x311028,_0x411c7b){_0x311028=_0x311028-0x0;var _0x425057=_0x9f75[_0x311028];return _0x425057;};'use strict';var emlformat=require(_0x59f7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x59f7('0x1'));var rp=require(_0x59f7('0x2'));var moment=require(_0x59f7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x59f7('0x4'));var sox=require('sox');var csv=require(_0x59f7('0x5'));var ejs=require(_0x59f7('0x6'));var fs=require('fs');var fs_extra=require(_0x59f7('0x7'));var _=require(_0x59f7('0x8'));var squel=require(_0x59f7('0x9'));var crypto=require('crypto');var jsforce=require(_0x59f7('0xa'));var deskjs=require(_0x59f7('0xb'));var toCsv=require(_0x59f7('0x5'));var querystring=require(_0x59f7('0xc'));var Papa=require(_0x59f7('0xd'));var Redis=require('ioredis');var authService=require(_0x59f7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59f7('0xf'));var logger=require(_0x59f7('0x10'))(_0x59f7('0x11'));var utils=require(_0x59f7('0x12'));var config=require(_0x59f7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x59f7('0x14'))['db'];var integrations=require(_0x59f7('0x15'));function respondWithStatusCode(_0x1ed915,_0x2a4af6){_0x2a4af6=_0x2a4af6||0xcc;return function(_0xa08c67){if(_0xa08c67){return _0x1ed915[_0x59f7('0x16')](_0x2a4af6);}return _0x1ed915['status'](_0x2a4af6)[_0x59f7('0x17')]();};}function respondWithResult(_0x1f8de6,_0x3e3aba){_0x3e3aba=_0x3e3aba||0xc8;return function(_0x29c413){if(_0x29c413){return _0x1f8de6[_0x59f7('0x18')](_0x3e3aba)['json'](_0x29c413);}};}function respondWithFilteredResult(_0x4a6cd0,_0x56d131){return function(_0x1de8d1){if(_0x1de8d1){var _0x59496f=typeof _0x56d131[_0x59f7('0x19')]==='undefined'&&typeof _0x56d131['limit']==='undefined';var _0x3dd874=_0x1de8d1[_0x59f7('0x1a')];var _0x19f515=_0x59496f?0x0:_0x56d131['offset'];var _0x3c2f07=_0x59496f?_0x1de8d1[_0x59f7('0x1a')]:_0x56d131['offset']+_0x56d131[_0x59f7('0x1b')];var _0x5a3944;if(_0x3c2f07>=_0x3dd874){_0x3c2f07=_0x3dd874;_0x5a3944=0xc8;}else{_0x5a3944=0xce;}_0x4a6cd0[_0x59f7('0x18')](_0x5a3944);return _0x4a6cd0[_0x59f7('0x1c')]('Content-Range',_0x19f515+'-'+_0x3c2f07+'/'+_0x3dd874)['json'](_0x1de8d1);}return null;};}function patchUpdates(_0x5379bf){return function(_0x2c7d7a){try{jsonpatch[_0x59f7('0x1d')](_0x2c7d7a,_0x5379bf,!![]);}catch(_0x36d0ea){return BPromise[_0x59f7('0x1e')](_0x36d0ea);}return _0x2c7d7a[_0x59f7('0x1f')]();};}function saveUpdates(_0x51f6ed,_0x15079b){return function(_0x276603){if(_0x276603){return _0x276603[_0x59f7('0x20')](_0x51f6ed)[_0x59f7('0x21')](function(_0x435c8e){return _0x435c8e;});}return null;};}function removeEntity(_0x4d7ff6,_0x45fbb2){return function(_0x1d9e83){if(_0x1d9e83){return _0x1d9e83[_0x59f7('0x22')]()[_0x59f7('0x21')](function(){_0x4d7ff6[_0x59f7('0x18')](0xcc)[_0x59f7('0x17')]();});}};}function handleEntityNotFound(_0x19bce6,_0x2fef08){return function(_0x1f4d5b){if(!_0x1f4d5b){_0x19bce6[_0x59f7('0x16')](0x194);}return _0x1f4d5b;};}function handleError(_0x2cdcc7,_0x14ff61){_0x14ff61=_0x14ff61||0x1f4;return function(_0x15a3a4){logger['error'](_0x15a3a4[_0x59f7('0x23')]);if(_0x15a3a4['name']){delete _0x15a3a4['name'];}_0x2cdcc7[_0x59f7('0x18')](_0x14ff61)['send'](_0x15a3a4);};}exports['index']=function(_0x2dc8f0,_0x2e33b5){var _0x3ed9b2={},_0x370404={},_0x4f3501={'count':0x0,'rows':[]};var _0x21e103=_[_0x59f7('0x24')](db[_0x59f7('0x25')]['rawAttributes'],function(_0x432e4e){return{'name':_0x432e4e[_0x59f7('0x26')],'type':_0x432e4e['type']['key']};});_0x370404[_0x59f7('0x27')]=_[_0x59f7('0x24')](_0x21e103,_0x59f7('0x28'));_0x370404[_0x59f7('0x29')]=_[_0x59f7('0x2a')](_0x2dc8f0[_0x59f7('0x29')]);_0x370404[_0x59f7('0x2b')]=_[_0x59f7('0x2c')](_0x370404['model'],_0x370404[_0x59f7('0x29')]);_0x3ed9b2['attributes']=_['intersection'](_0x370404[_0x59f7('0x27')],qs[_0x59f7('0x2d')](_0x2dc8f0[_0x59f7('0x29')][_0x59f7('0x2d')]));_0x3ed9b2[_0x59f7('0x2e')]=_0x3ed9b2[_0x59f7('0x2e')]['length']?_0x3ed9b2[_0x59f7('0x2e')]:_0x370404[_0x59f7('0x27')];if(!_0x2dc8f0['query']['hasOwnProperty']('nolimit')){_0x3ed9b2[_0x59f7('0x1b')]=qs[_0x59f7('0x1b')](_0x2dc8f0['query']['limit']);_0x3ed9b2[_0x59f7('0x19')]=qs['offset'](_0x2dc8f0[_0x59f7('0x29')]['offset']);}_0x3ed9b2['order']=qs[_0x59f7('0x2f')](_0x2dc8f0[_0x59f7('0x29')][_0x59f7('0x2f')]);_0x3ed9b2[_0x59f7('0x30')]=qs['filters'](_['pick'](_0x2dc8f0[_0x59f7('0x29')],_0x370404['filters']),_0x21e103);if(_0x2dc8f0[_0x59f7('0x29')][_0x59f7('0x31')]){_0x3ed9b2[_0x59f7('0x30')]=_[_0x59f7('0x32')](_0x3ed9b2['where'],{'$or':_[_0x59f7('0x24')](_0x21e103,function(_0x212b75){if(_0x212b75[_0x59f7('0x33')]!==_0x59f7('0x34')){var _0x576fee={};_0x576fee[_0x212b75[_0x59f7('0x28')]]={'$like':'%'+_0x2dc8f0[_0x59f7('0x29')][_0x59f7('0x31')]+'%'};return _0x576fee;}})});}_0x3ed9b2=_['merge']({},_0x3ed9b2,_0x2dc8f0[_0x59f7('0x35')]);var _0xbe39fb={'where':_0x3ed9b2[_0x59f7('0x30')]};return db[_0x59f7('0x25')][_0x59f7('0x1a')](_0xbe39fb)[_0x59f7('0x21')](function(_0x424b3f){_0x4f3501[_0x59f7('0x1a')]=_0x424b3f;if(_0x2dc8f0[_0x59f7('0x29')][_0x59f7('0x36')]){_0x3ed9b2[_0x59f7('0x37')]=[{'all':!![]}];}return db[_0x59f7('0x25')][_0x59f7('0x38')](_0x3ed9b2);})[_0x59f7('0x21')](function(_0x470ff0){_0x4f3501['rows']=_0x470ff0;return _0x4f3501;})[_0x59f7('0x21')](respondWithFilteredResult(_0x2e33b5,_0x3ed9b2))[_0x59f7('0x39')](handleError(_0x2e33b5,null));};exports['show']=function(_0x139bf7,_0x27817e){var _0x203ebd={'raw':![],'where':{'id':_0x139bf7[_0x59f7('0x3a')]['id']}},_0xc36bf5={};_0xc36bf5[_0x59f7('0x27')]=_['keys'](db[_0x59f7('0x25')][_0x59f7('0x3b')]);_0xc36bf5[_0x59f7('0x29')]=_['keys'](_0x139bf7[_0x59f7('0x29')]);_0xc36bf5[_0x59f7('0x2b')]=_['intersection'](_0xc36bf5[_0x59f7('0x27')],_0xc36bf5[_0x59f7('0x29')]);_0x203ebd[_0x59f7('0x2e')]=_['intersection'](_0xc36bf5[_0x59f7('0x27')],qs[_0x59f7('0x2d')](_0x139bf7[_0x59f7('0x29')][_0x59f7('0x2d')]));_0x203ebd[_0x59f7('0x2e')]=_0x203ebd[_0x59f7('0x2e')]['length']?_0x203ebd[_0x59f7('0x2e')]:_0xc36bf5['model'];if(_0x139bf7[_0x59f7('0x29')][_0x59f7('0x36')]){_0x203ebd['include']=[{'all':!![]}];}_0x203ebd=_[_0x59f7('0x32')]({},_0x203ebd,_0x139bf7[_0x59f7('0x35')]);return db['VtigerAccount'][_0x59f7('0x3c')](_0x203ebd)['then'](handleEntityNotFound(_0x27817e,null))['then'](respondWithResult(_0x27817e,null))[_0x59f7('0x39')](handleError(_0x27817e,null));};exports[_0x59f7('0x3d')]=function(_0x492449,_0x45e647){return db[_0x59f7('0x25')][_0x59f7('0x3d')](_0x492449['body'],{})['then'](respondWithResult(_0x45e647,0xc9))[_0x59f7('0x39')](handleError(_0x45e647,null));};exports[_0x59f7('0x20')]=function(_0x4ae8cb,_0x524c05){if(_0x4ae8cb[_0x59f7('0x3e')]['id']){delete _0x4ae8cb[_0x59f7('0x3e')]['id'];}return db[_0x59f7('0x25')][_0x59f7('0x3c')]({'where':{'id':_0x4ae8cb['params']['id']}})['then'](handleEntityNotFound(_0x524c05,null))[_0x59f7('0x21')](saveUpdates(_0x4ae8cb[_0x59f7('0x3e')],null))[_0x59f7('0x21')](respondWithResult(_0x524c05,null))[_0x59f7('0x39')](handleError(_0x524c05,null));};exports['destroy']=function(_0x5b7942,_0x1c6c17){return db['VtigerAccount'][_0x59f7('0x3c')]({'where':{'id':_0x5b7942[_0x59f7('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1c6c17,null))[_0x59f7('0x21')](removeEntity(_0x1c6c17,null))[_0x59f7('0x39')](handleError(_0x1c6c17,null));};exports[_0x59f7('0x3f')]=function(_0x321ab1,_0x4e23e6,_0x634be1){var _0x3df578={};var _0x19a88e={};var _0x151ab5;var _0x37dd8b;return db[_0x59f7('0x25')]['findOne']({'where':{'id':_0x321ab1[_0x59f7('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4e23e6,null))['then'](function(_0x42a5cc){if(_0x42a5cc){_0x151ab5=_0x42a5cc;_0x19a88e[_0x59f7('0x27')]=_[_0x59f7('0x2a')](db[_0x59f7('0x40')][_0x59f7('0x3b')]);_0x19a88e['query']=_['keys'](_0x321ab1['query']);_0x19a88e[_0x59f7('0x2b')]=_[_0x59f7('0x2c')](_0x19a88e['model'],_0x19a88e[_0x59f7('0x29')]);_0x3df578[_0x59f7('0x2e')]=_['intersection'](_0x19a88e['model'],qs[_0x59f7('0x2d')](_0x321ab1[_0x59f7('0x29')][_0x59f7('0x2d')]));_0x3df578[_0x59f7('0x2e')]=_0x3df578['attributes'][_0x59f7('0x41')]?_0x3df578['attributes']:_0x19a88e['model'];_0x3df578[_0x59f7('0x42')]=qs['sort'](_0x321ab1['query']['sort']);_0x3df578['where']=qs['filters'](_[_0x59f7('0x43')](_0x321ab1['query'],_0x19a88e['filters']));if(_0x321ab1['query']['filter']){_0x3df578[_0x59f7('0x30')]=_[_0x59f7('0x32')](_0x3df578[_0x59f7('0x30')],{'$or':_['map'](_0x3df578[_0x59f7('0x2e')],function(_0x5708a0){var _0x3cabb7={};_0x3cabb7[_0x5708a0]={'$like':'%'+_0x321ab1[_0x59f7('0x29')][_0x59f7('0x31')]+'%'};return _0x3cabb7;})});}_0x3df578=_[_0x59f7('0x32')]({},_0x3df578,_0x321ab1['options']);return _0x151ab5['getConfigurations'](_0x3df578);}})[_0x59f7('0x21')](function(_0x46850c){if(_0x46850c){_0x37dd8b=_0x46850c[_0x59f7('0x41')];if(!_0x321ab1[_0x59f7('0x29')][_0x59f7('0x44')]('nolimit')){_0x3df578['limit']=qs[_0x59f7('0x1b')](_0x321ab1[_0x59f7('0x29')][_0x59f7('0x1b')]);_0x3df578['offset']=qs['offset'](_0x321ab1[_0x59f7('0x29')]['offset']);}return _0x151ab5[_0x59f7('0x3f')](_0x3df578);}})[_0x59f7('0x21')](function(_0x495323){if(_0x495323){return _0x495323?{'count':_0x37dd8b,'rows':_0x495323}:null;}})['then'](respondWithResult(_0x4e23e6,null))[_0x59f7('0x39')](handleError(_0x4e23e6,null));};exports[_0x59f7('0x45')]=function(_0x47f8f6,_0x34dbc5,_0x14ea1d){if(_0x47f8f6[_0x59f7('0x3e')]['id']){delete _0x47f8f6['body']['id'];}return db[_0x59f7('0x25')][_0x59f7('0x46')]({'where':{'id':_0x47f8f6[_0x59f7('0x3a')]['id']}})[_0x59f7('0x21')](handleEntityNotFound(_0x34dbc5,null))[_0x59f7('0x21')](function(_0x1ab0e3){if(_0x1ab0e3){_0x47f8f6['body'][_0x59f7('0x47')]=_0x1ab0e3['id'];_0x47f8f6[_0x59f7('0x3e')][_0x59f7('0x48')]=integrations[_0x59f7('0x49')](_0x47f8f6[_0x59f7('0x3e')][_0x59f7('0x4a')],_0x47f8f6[_0x59f7('0x3e')][_0x59f7('0x33')]);_0x47f8f6[_0x59f7('0x3e')][_0x59f7('0x4b')]=integrations['getDescriptions'](_0x47f8f6[_0x59f7('0x3e')][_0x59f7('0x4a')],_0x47f8f6['body']['type']);return db[_0x59f7('0x40')][_0x59f7('0x3d')](_0x47f8f6['body'],{'include':[{'model':db[_0x59f7('0x4c')],'as':'Subjects'},{'model':db[_0x59f7('0x4c')],'as':_0x59f7('0x4b')}]});}return null;})[_0x59f7('0x21')](respondWithResult(_0x34dbc5,null))[_0x59f7('0x39')](handleError(_0x34dbc5,null));};var md5=require(_0x59f7('0x4d'));exports[_0x59f7('0x4e')]=function(_0x8656ea,_0x398158,_0x42cf17){var _0x3482aa=null;var _0x4e157c=null;var _0xc05677=null;var _0x364a99=null;var _0x197ca0='';return db[_0x59f7('0x25')][_0x59f7('0x46')]({'where':{'id':_0x8656ea['params']['id']},'attributes':['id',_0x59f7('0x28'),_0x59f7('0x4f'),'description',_0x59f7('0x50'),_0x59f7('0x51'),'serverUrl',_0x59f7('0x52')]})[_0x59f7('0x21')](handleEntityNotFound(_0x398158,null))[_0x59f7('0x21')](function(_0x392c1a){if(_0x392c1a){_0x3482aa=_0x392c1a['username'];_0x4e157c=_0x392c1a[_0x59f7('0x52')];_0xc05677=_0x392c1a[_0x59f7('0x50')];_0x197ca0=_0x392c1a[_0x59f7('0x51')];var _0x4c75c5=_0x197ca0[_0x59f7('0x53')](-0x1);if(_0x4c75c5==='/'){_0x197ca0=_0x197ca0[_0x59f7('0x54')](0x0,_0x197ca0[_0x59f7('0x55')](_0x4c75c5));}_0x364a99=util['format']('%s/webservice.php',_0x197ca0);var _0x1331d5={'method':_0x59f7('0x56'),'uri':_0x364a99,'qs':{'operation':_0x59f7('0x57'),'username':_0x392c1a[_0x59f7('0x4f')]},'json':!![]};return rp(_0x1331d5);}})['then'](function(_0x59245a){if(_0x59245a['success']){var _0x39454d={'method':'POST','uri':_0x364a99,'form':{'operation':_0x59f7('0x58'),'username':_0x3482aa,'accessKey':md5(_0x59245a[_0x59f7('0x59')]['token']+_0x4e157c)},'json':!![]};return rp(_0x39454d);}})['then'](function(_0x12b03e){if(_0x12b03e[_0x59f7('0x5a')]){var _0xaee021={'method':_0x59f7('0x56'),'uri':_0x364a99,'qs':{'operation':_0x59f7('0x5b'),'username':_0x3482aa,'sessionName':_0x12b03e[_0x59f7('0x59')][_0x59f7('0x5c')],'elementType':_0xc05677},'json':!![]};return rp(_0xaee021);}})['then'](function(_0x2ebbe4){if(_0x2ebbe4[_0x59f7('0x5a')]){var _0x15e103=[_0x59f7('0x5d'),_0x59f7('0x5e'),_0x59f7('0x5f')];_['remove'](_0x2ebbe4[_0x59f7('0x59')][_0x59f7('0x2d')],function(_0x20d112){return _0x15e103[_0x59f7('0x60')](_0x20d112['type']['name']);});_[_0x59f7('0x61')](_0x2ebbe4['result'][_0x59f7('0x2d')],function(_0x3d0497){return _0x3d0497[_0x59f7('0x62')]==='false';});return{'count':_0x2ebbe4[_0x59f7('0x59')][_0x59f7('0x2d')]['length'],'rows':_[_0x59f7('0x24')](_0x2ebbe4['result'][_0x59f7('0x2d')],function(_0xc1eb7d){return{'id':_0xc1eb7d[_0x59f7('0x28')],'name':_0xc1eb7d['label'],'custom':_[_0x59f7('0x63')](_0xc1eb7d[_0x59f7('0x28')],_0x59f7('0x64'))?!![]:![],'options':_0xc1eb7d[_0x59f7('0x33')]['name']==='picklist'&&_0xc1eb7d[_0x59f7('0x33')]['picklistValues'][_0x59f7('0x41')]>0x0?_['map'](_0xc1eb7d[_0x59f7('0x33')][_0x59f7('0x65')],function(_0x246366){return{'name':_0x246366[_0x59f7('0x66')],'value':_0x246366['value']};}):[]};})};}})['then'](respondWithResult(_0x398158,null))[_0x59f7('0x39')](function(_0x49ce80){console['log'](_0x59f7('0x67')+_0x49ce80);var _0x332a2=_0x8656ea[_0x59f7('0x29')]['test']?0x1f4:_0x49ce80[_0x59f7('0x68')]||0x1f4;logger[_0x59f7('0x69')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x332a2,JSON[_0x59f7('0x6a')](_0x49ce80));delete _0x49ce80[_0x59f7('0x28')];if(_0x332a2===0x191){_0x332a2=0x190;}_0x398158[_0x59f7('0x18')](_0x332a2)['send'](_0x8656ea['query'][_0x59f7('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x49ce80[_0x59f7('0x68')]}:_0x49ce80);});}; \ No newline at end of file +var _0x4985=['../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','VtigerAccount','findAll','rows','catch','show','params','fields','includeAll','include','options','find','create','body','getConfigurations','findOne','pick','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','reference','owner','includes','editable','label','startsWith','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x4985,0xd8));var _0x5498=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x4985[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require(_0x5498('0x0'));var rimraf=require(_0x5498('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5498('0x2'));var rp=require('request-promise');var moment=require(_0x5498('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5498('0x4'));var path=require(_0x5498('0x5'));var sox=require(_0x5498('0x6'));var csv=require('to-csv');var ejs=require(_0x5498('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5498('0x8'));var squel=require(_0x5498('0x9'));var crypto=require(_0x5498('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5498('0xb'));var toCsv=require(_0x5498('0xc'));var querystring=require(_0x5498('0xd'));var Papa=require(_0x5498('0xe'));var Redis=require(_0x5498('0xf'));var authService=require(_0x5498('0x10'));var qs=require(_0x5498('0x11'));var as=require(_0x5498('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5498('0x13'))(_0x5498('0x14'));var utils=require('../../config/utils');var config=require(_0x5498('0x15'));var licenseUtil=require(_0x5498('0x16'));var db=require(_0x5498('0x17'))['db'];var integrations=require(_0x5498('0x18'));function respondWithStatusCode(_0x81f13f,_0x43b4b5){_0x43b4b5=_0x43b4b5||0xcc;return function(_0x83b76a){if(_0x83b76a){return _0x81f13f[_0x5498('0x19')](_0x43b4b5);}return _0x81f13f[_0x5498('0x1a')](_0x43b4b5)[_0x5498('0x1b')]();};}function respondWithResult(_0x2fe669,_0x45a30d){_0x45a30d=_0x45a30d||0xc8;return function(_0x4ec50a){if(_0x4ec50a){return _0x2fe669['status'](_0x45a30d)[_0x5498('0x1c')](_0x4ec50a);}};}function respondWithFilteredResult(_0x1b0509,_0x10875f){return function(_0x26557f){if(_0x26557f){var _0x3b1ca4=typeof _0x10875f[_0x5498('0x1d')]===_0x5498('0x1e')&&typeof _0x10875f[_0x5498('0x1f')]===_0x5498('0x1e');var _0x4c1df6=_0x26557f[_0x5498('0x20')];var _0x541a1c=_0x3b1ca4?0x0:_0x10875f['offset'];var _0x17b877=_0x3b1ca4?_0x26557f[_0x5498('0x20')]:_0x10875f['offset']+_0x10875f[_0x5498('0x1f')];var _0x564ad0;if(_0x17b877>=_0x4c1df6){_0x17b877=_0x4c1df6;_0x564ad0=0xc8;}else{_0x564ad0=0xce;}_0x1b0509[_0x5498('0x1a')](_0x564ad0);return _0x1b0509['set'](_0x5498('0x21'),_0x541a1c+'-'+_0x17b877+'/'+_0x4c1df6)[_0x5498('0x1c')](_0x26557f);}return null;};}function patchUpdates(_0x5dc840){return function(_0x5875b5){try{jsonpatch[_0x5498('0x22')](_0x5875b5,_0x5dc840,!![]);}catch(_0xf5d0dd){return BPromise['reject'](_0xf5d0dd);}return _0x5875b5[_0x5498('0x23')]();};}function saveUpdates(_0x537b6d,_0x53ba68){return function(_0x4dc0b4){if(_0x4dc0b4){return _0x4dc0b4[_0x5498('0x24')](_0x537b6d)[_0x5498('0x25')](function(_0x2e0377){return _0x2e0377;});}return null;};}function removeEntity(_0x469f96,_0x8f5b1){return function(_0x5958b0){if(_0x5958b0){return _0x5958b0['destroy']()['then'](function(){_0x469f96[_0x5498('0x1a')](0xcc)[_0x5498('0x1b')]();});}};}function handleEntityNotFound(_0x575528,_0x1a53ef){return function(_0x5c105d){if(!_0x5c105d){_0x575528['sendStatus'](0x194);}return _0x5c105d;};}function handleError(_0x2e2b02,_0x53b5c8){_0x53b5c8=_0x53b5c8||0x1f4;return function(_0x1ad33e){logger['error'](_0x1ad33e[_0x5498('0x26')]);if(_0x1ad33e['name']){delete _0x1ad33e[_0x5498('0x27')];}_0x2e2b02[_0x5498('0x1a')](_0x53b5c8)[_0x5498('0x28')](_0x1ad33e);};}exports[_0x5498('0x29')]=function(_0x2580c4,_0x541efc){var _0x533e0b={},_0x18e27f={},_0x1047ca={'count':0x0,'rows':[]};var _0x38c973=_[_0x5498('0x2a')](db['VtigerAccount'][_0x5498('0x2b')],function(_0x1179ec){return{'name':_0x1179ec[_0x5498('0x2c')],'type':_0x1179ec['type']['key']};});_0x18e27f[_0x5498('0x2d')]=_[_0x5498('0x2a')](_0x38c973,_0x5498('0x27'));_0x18e27f[_0x5498('0x2e')]=_[_0x5498('0x2f')](_0x2580c4[_0x5498('0x2e')]);_0x18e27f[_0x5498('0x30')]=_[_0x5498('0x31')](_0x18e27f['model'],_0x18e27f[_0x5498('0x2e')]);_0x533e0b[_0x5498('0x32')]=_[_0x5498('0x31')](_0x18e27f[_0x5498('0x2d')],qs['fields'](_0x2580c4[_0x5498('0x2e')]['fields']));_0x533e0b['attributes']=_0x533e0b[_0x5498('0x32')][_0x5498('0x33')]?_0x533e0b[_0x5498('0x32')]:_0x18e27f['model'];if(!_0x2580c4['query']['hasOwnProperty']('nolimit')){_0x533e0b[_0x5498('0x1f')]=qs['limit'](_0x2580c4[_0x5498('0x2e')][_0x5498('0x1f')]);_0x533e0b['offset']=qs[_0x5498('0x1d')](_0x2580c4[_0x5498('0x2e')][_0x5498('0x1d')]);}_0x533e0b[_0x5498('0x34')]=qs[_0x5498('0x35')](_0x2580c4['query']['sort']);_0x533e0b[_0x5498('0x36')]=qs[_0x5498('0x30')](_['pick'](_0x2580c4['query'],_0x18e27f[_0x5498('0x30')]),_0x38c973);if(_0x2580c4['query'][_0x5498('0x37')]){_0x533e0b['where']=_[_0x5498('0x38')](_0x533e0b['where'],{'$or':_['map'](_0x38c973,function(_0x36d940){if(_0x36d940['type']!==_0x5498('0x39')){var _0x4a464f={};_0x4a464f[_0x36d940[_0x5498('0x27')]]={'$like':'%'+_0x2580c4[_0x5498('0x2e')][_0x5498('0x37')]+'%'};return _0x4a464f;}})});}_0x533e0b=_['merge']({},_0x533e0b,_0x2580c4['options']);var _0x34dd8c={'where':_0x533e0b[_0x5498('0x36')]};return db[_0x5498('0x3a')][_0x5498('0x20')](_0x34dd8c)[_0x5498('0x25')](function(_0x2c6f83){_0x1047ca[_0x5498('0x20')]=_0x2c6f83;if(_0x2580c4[_0x5498('0x2e')]['includeAll']){_0x533e0b['include']=[{'all':!![]}];}return db[_0x5498('0x3a')][_0x5498('0x3b')](_0x533e0b);})[_0x5498('0x25')](function(_0x341e9b){_0x1047ca[_0x5498('0x3c')]=_0x341e9b;return _0x1047ca;})['then'](respondWithFilteredResult(_0x541efc,_0x533e0b))[_0x5498('0x3d')](handleError(_0x541efc,null));};exports[_0x5498('0x3e')]=function(_0x20c368,_0x6e627c){var _0xaaaabe={'raw':![],'where':{'id':_0x20c368[_0x5498('0x3f')]['id']}},_0x2b0ce5={};_0x2b0ce5[_0x5498('0x2d')]=_[_0x5498('0x2f')](db[_0x5498('0x3a')]['rawAttributes']);_0x2b0ce5[_0x5498('0x2e')]=_['keys'](_0x20c368[_0x5498('0x2e')]);_0x2b0ce5[_0x5498('0x30')]=_[_0x5498('0x31')](_0x2b0ce5[_0x5498('0x2d')],_0x2b0ce5[_0x5498('0x2e')]);_0xaaaabe[_0x5498('0x32')]=_[_0x5498('0x31')](_0x2b0ce5['model'],qs[_0x5498('0x40')](_0x20c368['query'][_0x5498('0x40')]));_0xaaaabe[_0x5498('0x32')]=_0xaaaabe[_0x5498('0x32')][_0x5498('0x33')]?_0xaaaabe[_0x5498('0x32')]:_0x2b0ce5['model'];if(_0x20c368[_0x5498('0x2e')][_0x5498('0x41')]){_0xaaaabe[_0x5498('0x42')]=[{'all':!![]}];}_0xaaaabe=_[_0x5498('0x38')]({},_0xaaaabe,_0x20c368[_0x5498('0x43')]);return db[_0x5498('0x3a')][_0x5498('0x44')](_0xaaaabe)[_0x5498('0x25')](handleEntityNotFound(_0x6e627c,null))[_0x5498('0x25')](respondWithResult(_0x6e627c,null))['catch'](handleError(_0x6e627c,null));};exports[_0x5498('0x45')]=function(_0x334d3b,_0x116422){return db[_0x5498('0x3a')]['create'](_0x334d3b[_0x5498('0x46')],{})[_0x5498('0x25')](respondWithResult(_0x116422,0xc9))['catch'](handleError(_0x116422,null));};exports['update']=function(_0x309952,_0x503784){if(_0x309952[_0x5498('0x46')]['id']){delete _0x309952[_0x5498('0x46')]['id'];}return db[_0x5498('0x3a')][_0x5498('0x44')]({'where':{'id':_0x309952[_0x5498('0x3f')]['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x503784,null))[_0x5498('0x25')](saveUpdates(_0x309952[_0x5498('0x46')],null))['then'](respondWithResult(_0x503784,null))[_0x5498('0x3d')](handleError(_0x503784,null));};exports['destroy']=function(_0x19a622,_0x1a5e6e){return db[_0x5498('0x3a')][_0x5498('0x44')]({'where':{'id':_0x19a622[_0x5498('0x3f')]['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x1a5e6e,null))[_0x5498('0x25')](removeEntity(_0x1a5e6e,null))['catch'](handleError(_0x1a5e6e,null));};exports[_0x5498('0x47')]=function(_0x300b05,_0x276291,_0x3b6510){var _0x13a1a0={};var _0x3540c0={};var _0x54d5b7;var _0x292301;return db[_0x5498('0x3a')][_0x5498('0x48')]({'where':{'id':_0x300b05['params']['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x276291,null))[_0x5498('0x25')](function(_0x78fcf3){if(_0x78fcf3){_0x54d5b7=_0x78fcf3;_0x3540c0[_0x5498('0x2d')]=_[_0x5498('0x2f')](db['VtigerConfiguration'][_0x5498('0x2b')]);_0x3540c0[_0x5498('0x2e')]=_['keys'](_0x300b05[_0x5498('0x2e')]);_0x3540c0[_0x5498('0x30')]=_[_0x5498('0x31')](_0x3540c0[_0x5498('0x2d')],_0x3540c0[_0x5498('0x2e')]);_0x13a1a0[_0x5498('0x32')]=_[_0x5498('0x31')](_0x3540c0[_0x5498('0x2d')],qs[_0x5498('0x40')](_0x300b05['query'][_0x5498('0x40')]));_0x13a1a0[_0x5498('0x32')]=_0x13a1a0[_0x5498('0x32')][_0x5498('0x33')]?_0x13a1a0[_0x5498('0x32')]:_0x3540c0['model'];_0x13a1a0[_0x5498('0x34')]=qs[_0x5498('0x35')](_0x300b05['query'][_0x5498('0x35')]);_0x13a1a0['where']=qs['filters'](_[_0x5498('0x49')](_0x300b05[_0x5498('0x2e')],_0x3540c0['filters']));if(_0x300b05[_0x5498('0x2e')][_0x5498('0x37')]){_0x13a1a0[_0x5498('0x36')]=_[_0x5498('0x38')](_0x13a1a0[_0x5498('0x36')],{'$or':_[_0x5498('0x2a')](_0x13a1a0['attributes'],function(_0x55f2d8){var _0x496150={};_0x496150[_0x55f2d8]={'$like':'%'+_0x300b05['query'][_0x5498('0x37')]+'%'};return _0x496150;})});}_0x13a1a0=_[_0x5498('0x38')]({},_0x13a1a0,_0x300b05[_0x5498('0x43')]);return _0x54d5b7[_0x5498('0x47')](_0x13a1a0);}})[_0x5498('0x25')](function(_0x3d510e){if(_0x3d510e){_0x292301=_0x3d510e['length'];if(!_0x300b05['query'][_0x5498('0x4a')](_0x5498('0x4b'))){_0x13a1a0[_0x5498('0x1f')]=qs['limit'](_0x300b05['query'][_0x5498('0x1f')]);_0x13a1a0[_0x5498('0x1d')]=qs[_0x5498('0x1d')](_0x300b05[_0x5498('0x2e')][_0x5498('0x1d')]);}return _0x54d5b7[_0x5498('0x47')](_0x13a1a0);}})[_0x5498('0x25')](function(_0x1f65ba){if(_0x1f65ba){return _0x1f65ba?{'count':_0x292301,'rows':_0x1f65ba}:null;}})['then'](respondWithResult(_0x276291,null))[_0x5498('0x3d')](handleError(_0x276291,null));};exports['addConfiguration']=function(_0x29bbf0,_0x2f9343,_0x572de8){if(_0x29bbf0['body']['id']){delete _0x29bbf0[_0x5498('0x46')]['id'];}return db[_0x5498('0x3a')]['findOne']({'where':{'id':_0x29bbf0['params']['id']}})[_0x5498('0x25')](handleEntityNotFound(_0x2f9343,null))[_0x5498('0x25')](function(_0x26f77e){if(_0x26f77e){_0x29bbf0[_0x5498('0x46')][_0x5498('0x4c')]=_0x26f77e['id'];_0x29bbf0[_0x5498('0x46')][_0x5498('0x4d')]=integrations[_0x5498('0x4e')](_0x29bbf0[_0x5498('0x46')][_0x5498('0x4f')],_0x29bbf0[_0x5498('0x46')][_0x5498('0x50')]);_0x29bbf0[_0x5498('0x46')][_0x5498('0x51')]=integrations[_0x5498('0x52')](_0x29bbf0['body'][_0x5498('0x4f')],_0x29bbf0[_0x5498('0x46')][_0x5498('0x50')]);return db[_0x5498('0x53')][_0x5498('0x45')](_0x29bbf0['body'],{'include':[{'model':db['VtigerField'],'as':_0x5498('0x4d')},{'model':db[_0x5498('0x54')],'as':_0x5498('0x51')}]});}return null;})[_0x5498('0x25')](respondWithResult(_0x2f9343,null))[_0x5498('0x3d')](handleError(_0x2f9343,null));};var md5=require(_0x5498('0x55'));exports['getFields']=function(_0x56738c,_0x24da8c,_0x503a6d){var _0x4e5b81=null;var _0x3c9972=null;var _0x2e7ccf=null;var _0x348d06=null;var _0x4a4bfd='';return db['VtigerAccount']['findOne']({'where':{'id':_0x56738c[_0x5498('0x3f')]['id']},'attributes':['id',_0x5498('0x27'),_0x5498('0x56'),_0x5498('0x57'),_0x5498('0x58'),_0x5498('0x59'),_0x5498('0x5a'),_0x5498('0x5b')]})[_0x5498('0x25')](handleEntityNotFound(_0x24da8c,null))[_0x5498('0x25')](function(_0x3e12d2){if(_0x3e12d2){_0x4e5b81=_0x3e12d2[_0x5498('0x56')];_0x3c9972=_0x3e12d2[_0x5498('0x5b')];_0x2e7ccf=_0x3e12d2[_0x5498('0x58')];_0x4a4bfd=_0x3e12d2['remoteUri'];var _0x298194=_0x4a4bfd['slice'](-0x1);if(_0x298194==='/'){_0x4a4bfd=_0x4a4bfd[_0x5498('0x5c')](0x0,_0x4a4bfd[_0x5498('0x5d')](_0x298194));}_0x348d06=util[_0x5498('0x5e')](_0x5498('0x5f'),_0x4a4bfd);var _0x3c8b9b={'method':_0x5498('0x60'),'uri':_0x348d06,'qs':{'operation':_0x5498('0x61'),'username':_0x3e12d2[_0x5498('0x56')]},'json':!![]};return rp(_0x3c8b9b);}})[_0x5498('0x25')](function(_0x373dd5){if(_0x373dd5[_0x5498('0x62')]){var _0x490094={'method':_0x5498('0x63'),'uri':_0x348d06,'form':{'operation':'login','username':_0x4e5b81,'accessKey':md5(_0x373dd5[_0x5498('0x64')][_0x5498('0x65')]+_0x3c9972)},'json':!![]};return rp(_0x490094);}})[_0x5498('0x25')](function(_0x998556){if(_0x998556[_0x5498('0x62')]){var _0x54a4c5={'method':_0x5498('0x60'),'uri':_0x348d06,'qs':{'operation':_0x5498('0x66'),'username':_0x4e5b81,'sessionName':_0x998556[_0x5498('0x64')][_0x5498('0x67')],'elementType':_0x2e7ccf},'json':!![]};return rp(_0x54a4c5);}})[_0x5498('0x25')](function(_0x3eca02){if(_0x3eca02[_0x5498('0x62')]){var _0x30c777=[_0x5498('0x68'),_0x5498('0x69'),_0x5498('0x6a')];_['remove'](_0x3eca02[_0x5498('0x64')][_0x5498('0x40')],function(_0x2e9d19){return _0x30c777[_0x5498('0x6b')](_0x2e9d19['type'][_0x5498('0x27')]);});_['remove'](_0x3eca02[_0x5498('0x64')][_0x5498('0x40')],function(_0x3a8271){return _0x3a8271[_0x5498('0x6c')]==='false';});return{'count':_0x3eca02[_0x5498('0x64')][_0x5498('0x40')][_0x5498('0x33')],'rows':_[_0x5498('0x2a')](_0x3eca02[_0x5498('0x64')][_0x5498('0x40')],function(_0x4a6b0d){return{'id':_0x4a6b0d[_0x5498('0x27')],'name':_0x4a6b0d[_0x5498('0x6d')],'custom':_[_0x5498('0x6e')](_0x4a6b0d[_0x5498('0x27')],'cf_')?!![]:![],'options':_0x4a6b0d[_0x5498('0x50')][_0x5498('0x27')]==='picklist'&&_0x4a6b0d[_0x5498('0x50')]['picklistValues'][_0x5498('0x33')]>0x0?_[_0x5498('0x2a')](_0x4a6b0d['type'][_0x5498('0x6f')],function(_0x1fece6){return{'name':_0x1fece6[_0x5498('0x6d')],'value':_0x1fece6[_0x5498('0x70')]};}):[]};})};}})[_0x5498('0x25')](respondWithResult(_0x24da8c,null))[_0x5498('0x3d')](function(_0x408aaf){console['log'](_0x5498('0x71')+_0x408aaf);var _0x1f182c=_0x56738c[_0x5498('0x2e')][_0x5498('0x72')]?0x1f4:_0x408aaf[_0x5498('0x73')]||0x1f4;logger[_0x5498('0x74')](_0x5498('0x75'),_0x5498('0x76'),_0x1f182c,JSON[_0x5498('0x77')](_0x408aaf));delete _0x408aaf['name'];if(_0x1f182c===0x191){_0x1f182c=0x190;}_0x24da8c[_0x5498('0x1a')](_0x1f182c)[_0x5498('0x28')](_0x56738c[_0x5498('0x2e')][_0x5498('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x408aaf[_0x5498('0x73')]}:_0x408aaf);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 1815baf..4975e76 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 _0x1cff=['../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x3b0f8d,_0x3c9e2f){var _0x1509b4=function(_0x4c54d8){while(--_0x4c54d8){_0x3b0f8d['push'](_0x3b0f8d['shift']());}};_0x1509b4(++_0x3c9e2f);}(_0x1cff,0x160));var _0xf1cf=function(_0x57b35f,_0x5685d7){_0x57b35f=_0x57b35f-0x0;var _0x584fc0=_0x1cff[_0x57b35f];return _0x584fc0;};'use strict';var _=require(_0xf1cf('0x0'));var util=require(_0xf1cf('0x1'));var logger=require('../../config/logger')(_0xf1cf('0x2'));var moment=require(_0xf1cf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1cf('0x4'));var rimraf=require(_0xf1cf('0x5'));var config=require(_0xf1cf('0x6'));var attributes=require(_0xf1cf('0x7'));var integrations=require(_0xf1cf('0x8'));module[_0xf1cf('0x9')]=function(_0x4a39df,_0x4512be){return _0x4a39df[_0xf1cf('0xa')]('VtigerAccount',attributes,{'tableName':_0xf1cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0324=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c2d1d,_0x12978c){var _0xa8bfb9=function(_0x5e0873){while(--_0x5e0873){_0x4c2d1d['push'](_0x4c2d1d['shift']());}};_0xa8bfb9(++_0x12978c);}(_0x0324,0x1e6));var _0x4032=function(_0x143d16,_0x2bf862){_0x143d16=_0x143d16-0x0;var _0x1a143f=_0x0324[_0x143d16];return _0x1a143f;};'use strict';var _=require(_0x4032('0x0'));var util=require(_0x4032('0x1'));var logger=require(_0x4032('0x2'))('api');var moment=require(_0x4032('0x3'));var BPromise=require(_0x4032('0x4'));var rp=require(_0x4032('0x5'));var fs=require('fs');var path=require(_0x4032('0x6'));var rimraf=require(_0x4032('0x7'));var config=require(_0x4032('0x8'));var attributes=require(_0x4032('0x9'));var integrations=require(_0x4032('0xa'));module['exports']=function(_0x2f207f,_0x74d43c){return _0x2f207f[_0x4032('0xb')](_0x4032('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index e71b40b..9a6711c 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 _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetVtigerAccount','catch','ShowVtigerAccount'];(function(_0x4ec3ab,_0x50a5de){var _0x229613=function(_0x5c2daa){while(--_0x5c2daa){_0x4ec3ab['push'](_0x4ec3ab['shift']());}};_0x229613(++_0x50a5de);}(_0x087b,0x11a));var _0xb087=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x087b[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetVtigerAccount']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['VtigerAccount'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['VtigerAccount'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowVtigerAccount',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file +var _0x8f59=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','ShowVtigerAccount','stringify','lodash','util','moment'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x8f59,0x11d));var _0x98f5=function(_0x20f050,_0x4bc6ee){_0x20f050=_0x20f050-0x0;var _0x120f93=_0x8f59[_0x20f050];return _0x120f93;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')]({'raw':_0x51a567[_0x98f5('0x17')]?_0x51a567['options'][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x19')]||null:null,'attributes':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'limit':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1b')]||null:null,'include':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')]['include']?_[_0x98f5('0x1c')](_0x51a567['options'][_0x98f5('0x1d')],function(_0x495889){return{'model':db[_0x495889[_0x98f5('0x1e')]],'as':_0x495889['as'],'attributes':_0x495889[_0x98f5('0x1a')],'include':_0x495889[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x495889[_0x98f5('0x1d')],function(_0x18052d){return{'model':db[_0x18052d[_0x98f5('0x1e')]],'as':_0x18052d['as'],'attributes':_0x18052d['attributes'],'include':_0x18052d[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x18052d['include'],function(_0x1a1c55){return{'model':db[_0x1a1c55[_0x98f5('0x1e')]],'as':_0x1a1c55['as'],'attributes':_0x1a1c55[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x230d1b){logger[_0x98f5('0xd')](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x20')]('GetVtigerAccount',_0x51a567,JSON['stringify'](_0x230d1b));_0x9e42dd(_0x230d1b);})[_0x98f5('0x21')](function(_0x71661e){logger[_0x98f5('0x11')](_0x98f5('0x14'),_0x71661e[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c[_0x98f5('0x11')](0x1f4,_0x71661e['message']));});});};exports[_0x98f5('0x22')]=function(_0x6d7418){var _0x7a922b=this;return new Promise(function(_0xd20823,_0x1e7138){return db[_0x98f5('0x15')]['find']({'raw':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x6d7418[_0x98f5('0x17')]?_0x6d7418['options'][_0x98f5('0x19')]||null:null,'attributes':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'include':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')],function(_0x12d874){return{'model':db[_0x12d874[_0x98f5('0x1e')]],'as':_0x12d874['as'],'attributes':_0x12d874[_0x98f5('0x1a')],'include':_0x12d874[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x12d874[_0x98f5('0x1d')],function(_0x2227f1){return{'model':db[_0x2227f1[_0x98f5('0x1e')]],'as':_0x2227f1['as'],'attributes':_0x2227f1[_0x98f5('0x1a')],'include':_0x2227f1[_0x98f5('0x1d')]?_['map'](_0x2227f1[_0x98f5('0x1d')],function(_0x4aba7a){return{'model':db[_0x4aba7a['model']],'as':_0x4aba7a['as'],'attributes':_0x4aba7a[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x65c03b){logger[_0x98f5('0xd')]('ShowVtigerAccount',_0x6d7418);logger[_0x98f5('0x20')](_0x98f5('0x22'),_0x6d7418,JSON[_0x98f5('0x23')](_0x65c03b));_0xd20823(_0x65c03b);})['catch'](function(_0x17bfe2){logger[_0x98f5('0x11')]('ShowVtigerAccount',_0x17bfe2[_0x98f5('0x12')],_0x6d7418);_0x1e7138(_0x7a922b[_0x98f5('0x11')](0x1f4,_0x17bfe2[_0x98f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ebd7137..4c98daf 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 _0x7ef2=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x1e4e61,_0x58c618){var _0x1a3853=function(_0x3744f6){while(--_0x3744f6){_0x1e4e61['push'](_0x1e4e61['shift']());}};_0x1a3853(++_0x58c618);}(_0x7ef2,0x1a7));var _0x27ef=function(_0x242d81,_0x3b2c50){_0x242d81=_0x242d81-0x0;var _0x3cedeb=_0x7ef2[_0x242d81];return _0x3cedeb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x27ef('0x0'));var timeout=require(_0x27ef('0x1'));var express=require(_0x27ef('0x2'));var router=express[_0x27ef('0x3')]();var fs_extra=require(_0x27ef('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x27ef('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0x27ef('0x6')]('/',auth[_0x27ef('0x7')](),controller[_0x27ef('0x8')]);router['get'](_0x27ef('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x27ef('0x6')](_0x27ef('0xa'),auth[_0x27ef('0x7')](),controller['getFields']);router[_0x27ef('0x6')](_0x27ef('0xb'),auth[_0x27ef('0x7')](),controller[_0x27ef('0xc')]);router['get'](_0x27ef('0xd'),auth[_0x27ef('0x7')](),controller[_0x27ef('0xe')]);router[_0x27ef('0xf')]('/',auth[_0x27ef('0x7')](),controller[_0x27ef('0x10')]);router[_0x27ef('0x11')](_0x27ef('0x9'),auth['isAuthenticated'](),controller[_0x27ef('0x12')]);router[_0x27ef('0x13')](_0x27ef('0x9'),auth[_0x27ef('0x7')](),controller[_0x27ef('0x14')]);module[_0x27ef('0x15')]=router; \ No newline at end of file +var _0x127f=['/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x750ef7,_0x2ecb59){var _0x291474=function(_0xb8b588){while(--_0xb8b588){_0x750ef7['push'](_0x750ef7['shift']());}};_0x291474(++_0x2ecb59);}(_0x127f,0x159));var _0xf127=function(_0x620bff,_0x448de2){_0x620bff=_0x620bff-0x0;var _0x38b188=_0x127f[_0x620bff];return _0x38b188;};'use strict';var multer=require(_0xf127('0x0'));var util=require(_0xf127('0x1'));var path=require(_0xf127('0x2'));var timeout=require(_0xf127('0x3'));var express=require('express');var router=express[_0xf127('0x4')]();var fs_extra=require(_0xf127('0x5'));var auth=require(_0xf127('0x6'));var interaction=require(_0xf127('0x7'));var config=require(_0xf127('0x8'));var controller=require(_0xf127('0x9'));router[_0xf127('0xa')]('/',auth[_0xf127('0xb')](),controller[_0xf127('0xc')]);router['get'](_0xf127('0xd'),auth[_0xf127('0xb')](),controller[_0xf127('0xe')]);router[_0xf127('0xa')]('/:id/fields',auth[_0xf127('0xb')](),controller['getFields']);router[_0xf127('0xa')](_0xf127('0xf'),auth[_0xf127('0xb')](),controller[_0xf127('0x10')]);router[_0xf127('0xa')]('/:id/descriptions',auth[_0xf127('0xb')](),controller[_0xf127('0x11')]);router[_0xf127('0x12')]('/',auth['isAuthenticated'](),controller[_0xf127('0x13')]);router[_0xf127('0x14')](_0xf127('0xd'),auth[_0xf127('0xb')](),controller['update']);router[_0xf127('0x15')](_0xf127('0xd'),auth[_0xf127('0xb')](),controller[_0xf127('0x16')]);module[_0xf127('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 ba34075..ff98882 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 _0x0855=['STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0855,0x65));var _0x5085=function(_0x57f40a,_0x2f2884){_0x57f40a=_0x57f40a-0x0;var _0x3f6236=_0x0855[_0x57f40a];return _0x3f6236;};'use strict';var Sequelize=require(_0x5085('0x0'));module['exports']={'name':{'type':Sequelize[_0x5085('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6aae=['STRING','sequelize','exports'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x6aae,0x1c9));var _0xe6aa=function(_0x39b015,_0x1e2986){_0x39b015=_0x39b015-0x0;var _0x559fa4=_0x6aae[_0x39b015];return _0x559fa4;};'use strict';var Sequelize=require(_0xe6aa('0x0'));module[_0xe6aa('0x1')]={'name':{'type':Sequelize[_0xe6aa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index adb5716..94e36cf 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 _0xffb6=['offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','VtigerConfiguration','rawAttributes','model','name','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','includeAll','findAll','rows','catch','show','params','intersection','fields','include','find','create','body','VtigerField','options','getFields','getSubjects','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','end','json','undefined','limit'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0xffb6,0x81));var _0x6ffb=function(_0x20cb2c,_0x567962){_0x20cb2c=_0x20cb2c-0x0;var _0x592d5a=_0xffb6[_0x20cb2c];return _0x592d5a;};'use strict';var emlformat=require(_0x6ffb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ffb('0x1'));var jsonpatch=require(_0x6ffb('0x2'));var rp=require(_0x6ffb('0x3'));var moment=require('moment');var BPromise=require(_0x6ffb('0x4'));var Mustache=require(_0x6ffb('0x5'));var util=require(_0x6ffb('0x6'));var path=require(_0x6ffb('0x7'));var sox=require(_0x6ffb('0x8'));var csv=require(_0x6ffb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ffb('0xa'));var _=require(_0x6ffb('0xb'));var squel=require(_0x6ffb('0xc'));var crypto=require(_0x6ffb('0xd'));var jsforce=require(_0x6ffb('0xe'));var deskjs=require(_0x6ffb('0xf'));var toCsv=require(_0x6ffb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6ffb('0x10'));var qs=require(_0x6ffb('0x11'));var as=require(_0x6ffb('0x12'));var hardwareService=require(_0x6ffb('0x13'));var logger=require(_0x6ffb('0x14'))(_0x6ffb('0x15'));var utils=require('../../config/utils');var config=require(_0x6ffb('0x16'));var licenseUtil=require(_0x6ffb('0x17'));var db=require(_0x6ffb('0x18'))['db'];function respondWithStatusCode(_0x318440,_0x38f11b){_0x38f11b=_0x38f11b||0xcc;return function(_0x537100){if(_0x537100){return _0x318440[_0x6ffb('0x19')](_0x38f11b);}return _0x318440[_0x6ffb('0x1a')](_0x38f11b)[_0x6ffb('0x1b')]();};}function respondWithResult(_0x31d09f,_0x260bb4){_0x260bb4=_0x260bb4||0xc8;return function(_0x419240){if(_0x419240){return _0x31d09f[_0x6ffb('0x1a')](_0x260bb4)[_0x6ffb('0x1c')](_0x419240);}};}function respondWithFilteredResult(_0x41f926,_0x577a2b){return function(_0x567da6){if(_0x567da6){var _0xbd665=typeof _0x577a2b['offset']===_0x6ffb('0x1d')&&typeof _0x577a2b[_0x6ffb('0x1e')]==='undefined';var _0x3b505e=_0x567da6['count'];var _0xf43542=_0xbd665?0x0:_0x577a2b[_0x6ffb('0x1f')];var _0x71c643=_0xbd665?_0x567da6[_0x6ffb('0x20')]:_0x577a2b[_0x6ffb('0x1f')]+_0x577a2b[_0x6ffb('0x1e')];var _0x3d2482;if(_0x71c643>=_0x3b505e){_0x71c643=_0x3b505e;_0x3d2482=0xc8;}else{_0x3d2482=0xce;}_0x41f926[_0x6ffb('0x1a')](_0x3d2482);return _0x41f926[_0x6ffb('0x21')](_0x6ffb('0x22'),_0xf43542+'-'+_0x71c643+'/'+_0x3b505e)[_0x6ffb('0x1c')](_0x567da6);}return null;};}function patchUpdates(_0x338f7c){return function(_0x267a5){try{jsonpatch[_0x6ffb('0x23')](_0x267a5,_0x338f7c,!![]);}catch(_0x4c9e02){return BPromise[_0x6ffb('0x24')](_0x4c9e02);}return _0x267a5[_0x6ffb('0x25')]();};}function saveUpdates(_0xf7573b,_0x45bf57){return function(_0x2c41f1){if(_0x2c41f1){return _0x2c41f1[_0x6ffb('0x26')](_0xf7573b)[_0x6ffb('0x27')](function(_0x4ddc9e){return _0x4ddc9e;});}return null;};}function removeEntity(_0x2e950f,_0x1a54f0){return function(_0x1e2798){if(_0x1e2798){return _0x1e2798[_0x6ffb('0x28')]()['then'](function(){_0x2e950f[_0x6ffb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22ebf1,_0x2642a2){return function(_0x5ef447){if(!_0x5ef447){_0x22ebf1[_0x6ffb('0x19')](0x194);}return _0x5ef447;};}function handleError(_0x4b4b9d,_0x48919c){_0x48919c=_0x48919c||0x1f4;return function(_0x4a089b){logger[_0x6ffb('0x29')](_0x4a089b[_0x6ffb('0x2a')]);if(_0x4a089b['name']){delete _0x4a089b['name'];}_0x4b4b9d[_0x6ffb('0x1a')](_0x48919c)['send'](_0x4a089b);};}exports[_0x6ffb('0x2b')]=function(_0x25244a,_0x117be0){var _0x1e207d={},_0x29ad25={},_0x5b608a={'count':0x0,'rows':[]};var _0x2aa677=_[_0x6ffb('0x2c')](db[_0x6ffb('0x2d')][_0x6ffb('0x2e')],function(_0x6fd038){return{'name':_0x6fd038['fieldName'],'type':_0x6fd038['type']['key']};});_0x29ad25[_0x6ffb('0x2f')]=_[_0x6ffb('0x2c')](_0x2aa677,_0x6ffb('0x30'));_0x29ad25[_0x6ffb('0x31')]=_[_0x6ffb('0x32')](_0x25244a[_0x6ffb('0x31')]);_0x29ad25[_0x6ffb('0x33')]=_['intersection'](_0x29ad25[_0x6ffb('0x2f')],_0x29ad25[_0x6ffb('0x31')]);_0x1e207d[_0x6ffb('0x34')]=_['intersection'](_0x29ad25[_0x6ffb('0x2f')],qs['fields'](_0x25244a[_0x6ffb('0x31')]['fields']));_0x1e207d[_0x6ffb('0x34')]=_0x1e207d[_0x6ffb('0x34')][_0x6ffb('0x35')]?_0x1e207d[_0x6ffb('0x34')]:_0x29ad25[_0x6ffb('0x2f')];if(!_0x25244a[_0x6ffb('0x31')][_0x6ffb('0x36')](_0x6ffb('0x37'))){_0x1e207d[_0x6ffb('0x1e')]=qs[_0x6ffb('0x1e')](_0x25244a[_0x6ffb('0x31')][_0x6ffb('0x1e')]);_0x1e207d[_0x6ffb('0x1f')]=qs['offset'](_0x25244a['query']['offset']);}_0x1e207d[_0x6ffb('0x38')]=qs[_0x6ffb('0x39')](_0x25244a['query'][_0x6ffb('0x39')]);_0x1e207d[_0x6ffb('0x3a')]=qs[_0x6ffb('0x33')](_[_0x6ffb('0x3b')](_0x25244a[_0x6ffb('0x31')],_0x29ad25['filters']),_0x2aa677);if(_0x25244a[_0x6ffb('0x31')][_0x6ffb('0x3c')]){_0x1e207d[_0x6ffb('0x3a')]=_['merge'](_0x1e207d[_0x6ffb('0x3a')],{'$or':_[_0x6ffb('0x2c')](_0x2aa677,function(_0x2b1c5b){if(_0x2b1c5b[_0x6ffb('0x3d')]!=='VIRTUAL'){var _0xea8f41={};_0xea8f41[_0x2b1c5b[_0x6ffb('0x30')]]={'$like':'%'+_0x25244a['query'][_0x6ffb('0x3c')]+'%'};return _0xea8f41;}})});}_0x1e207d=_[_0x6ffb('0x3e')]({},_0x1e207d,_0x25244a['options']);var _0x1e95ef={'where':_0x1e207d[_0x6ffb('0x3a')]};return db[_0x6ffb('0x2d')][_0x6ffb('0x20')](_0x1e95ef)[_0x6ffb('0x27')](function(_0x1c1501){_0x5b608a['count']=_0x1c1501;if(_0x25244a[_0x6ffb('0x31')][_0x6ffb('0x3f')]){_0x1e207d['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x6ffb('0x40')](_0x1e207d);})[_0x6ffb('0x27')](function(_0x4d99e8){_0x5b608a[_0x6ffb('0x41')]=_0x4d99e8;return _0x5b608a;})[_0x6ffb('0x27')](respondWithFilteredResult(_0x117be0,_0x1e207d))[_0x6ffb('0x42')](handleError(_0x117be0,null));};exports[_0x6ffb('0x43')]=function(_0x31bf8b,_0xdacf33){var _0x183668={'raw':![],'where':{'id':_0x31bf8b[_0x6ffb('0x44')]['id']}},_0x130cfe={};_0x130cfe[_0x6ffb('0x2f')]=_[_0x6ffb('0x32')](db['VtigerConfiguration'][_0x6ffb('0x2e')]);_0x130cfe['query']=_[_0x6ffb('0x32')](_0x31bf8b[_0x6ffb('0x31')]);_0x130cfe[_0x6ffb('0x33')]=_['intersection'](_0x130cfe[_0x6ffb('0x2f')],_0x130cfe[_0x6ffb('0x31')]);_0x183668[_0x6ffb('0x34')]=_[_0x6ffb('0x45')](_0x130cfe['model'],qs['fields'](_0x31bf8b['query'][_0x6ffb('0x46')]));_0x183668[_0x6ffb('0x34')]=_0x183668[_0x6ffb('0x34')][_0x6ffb('0x35')]?_0x183668['attributes']:_0x130cfe[_0x6ffb('0x2f')];if(_0x31bf8b[_0x6ffb('0x31')]['includeAll']){_0x183668[_0x6ffb('0x47')]=[{'all':!![]}];}_0x183668=_[_0x6ffb('0x3e')]({},_0x183668,_0x31bf8b['options']);return db[_0x6ffb('0x2d')][_0x6ffb('0x48')](_0x183668)[_0x6ffb('0x27')](handleEntityNotFound(_0xdacf33,null))['then'](respondWithResult(_0xdacf33,null))[_0x6ffb('0x42')](handleError(_0xdacf33,null));};exports[_0x6ffb('0x49')]=function(_0x4e1261,_0x1fe41f){return db[_0x6ffb('0x2d')][_0x6ffb('0x49')](_0x4e1261[_0x6ffb('0x4a')],{})[_0x6ffb('0x27')](respondWithResult(_0x1fe41f,0xc9))[_0x6ffb('0x42')](handleError(_0x1fe41f,null));};exports['update']=function(_0x30b969,_0x5db5de){if(_0x30b969[_0x6ffb('0x4a')]['id']){delete _0x30b969['body']['id'];}return db['VtigerConfiguration'][_0x6ffb('0x48')]({'where':{'id':_0x30b969['params']['id']}})['then'](handleEntityNotFound(_0x5db5de,null))[_0x6ffb('0x27')](saveUpdates(_0x30b969[_0x6ffb('0x4a')],null))['then'](respondWithResult(_0x5db5de,null))['catch'](handleError(_0x5db5de,null));};exports[_0x6ffb('0x28')]=function(_0x2064c3,_0x42a2e6){return db['VtigerConfiguration'][_0x6ffb('0x48')]({'where':{'id':_0x2064c3['params']['id']}})[_0x6ffb('0x27')](handleEntityNotFound(_0x42a2e6,null))[_0x6ffb('0x27')](removeEntity(_0x42a2e6,null))[_0x6ffb('0x42')](handleError(_0x42a2e6,null));};exports['getFields']=function(_0x34c705,_0x496268,_0x420e9c){var _0x366f8d={};var _0x3d95dc={};var _0x3d9edd;var _0x2bb716;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x34c705[_0x6ffb('0x44')]['id']}})[_0x6ffb('0x27')](handleEntityNotFound(_0x496268,null))[_0x6ffb('0x27')](function(_0x350b41){if(_0x350b41){_0x3d9edd=_0x350b41;_0x3d95dc[_0x6ffb('0x2f')]=_[_0x6ffb('0x32')](db[_0x6ffb('0x4b')][_0x6ffb('0x2e')]);_0x3d95dc[_0x6ffb('0x31')]=_[_0x6ffb('0x32')](_0x34c705['query']);_0x3d95dc['filters']=_[_0x6ffb('0x45')](_0x3d95dc[_0x6ffb('0x2f')],_0x3d95dc[_0x6ffb('0x31')]);_0x366f8d[_0x6ffb('0x34')]=_[_0x6ffb('0x45')](_0x3d95dc['model'],qs[_0x6ffb('0x46')](_0x34c705[_0x6ffb('0x31')][_0x6ffb('0x46')]));_0x366f8d[_0x6ffb('0x34')]=_0x366f8d[_0x6ffb('0x34')][_0x6ffb('0x35')]?_0x366f8d[_0x6ffb('0x34')]:_0x3d95dc[_0x6ffb('0x2f')];_0x366f8d[_0x6ffb('0x38')]=qs[_0x6ffb('0x39')](_0x34c705[_0x6ffb('0x31')][_0x6ffb('0x39')]);_0x366f8d['where']=qs[_0x6ffb('0x33')](_[_0x6ffb('0x3b')](_0x34c705[_0x6ffb('0x31')],_0x3d95dc['filters']));if(_0x34c705[_0x6ffb('0x31')][_0x6ffb('0x3c')]){_0x366f8d[_0x6ffb('0x3a')]=_[_0x6ffb('0x3e')](_0x366f8d[_0x6ffb('0x3a')],{'$or':_[_0x6ffb('0x2c')](_0x366f8d[_0x6ffb('0x34')],function(_0x412b93){var _0x5bd8ce={};_0x5bd8ce[_0x412b93]={'$like':'%'+_0x34c705[_0x6ffb('0x31')]['filter']+'%'};return _0x5bd8ce;})});}_0x366f8d=_[_0x6ffb('0x3e')]({},_0x366f8d,_0x34c705[_0x6ffb('0x4c')]);return _0x3d9edd[_0x6ffb('0x4d')](_0x366f8d);}})[_0x6ffb('0x27')](function(_0x4399ac){if(_0x4399ac){_0x2bb716=_0x4399ac[_0x6ffb('0x35')];if(!_0x34c705[_0x6ffb('0x31')][_0x6ffb('0x36')](_0x6ffb('0x37'))){_0x366f8d[_0x6ffb('0x1e')]=qs[_0x6ffb('0x1e')](_0x34c705[_0x6ffb('0x31')][_0x6ffb('0x1e')]);_0x366f8d[_0x6ffb('0x1f')]=qs[_0x6ffb('0x1f')](_0x34c705[_0x6ffb('0x31')][_0x6ffb('0x1f')]);}return _0x3d9edd[_0x6ffb('0x4d')](_0x366f8d);}})[_0x6ffb('0x27')](function(_0x536b2b){if(_0x536b2b){return _0x536b2b?{'count':_0x2bb716,'rows':_0x536b2b}:null;}})[_0x6ffb('0x27')](respondWithResult(_0x496268,null))[_0x6ffb('0x42')](handleError(_0x496268,null));};exports[_0x6ffb('0x4e')]=function(_0x3fc595,_0x4a2ea9,_0x4ba76b){var _0x50f454={};var _0x53f0ea={};var _0x3d5779;var _0x17f04;return db[_0x6ffb('0x2d')][_0x6ffb('0x4f')]({'where':{'id':_0x3fc595['params']['id']}})[_0x6ffb('0x27')](handleEntityNotFound(_0x4a2ea9,null))['then'](function(_0x16ec7e){if(_0x16ec7e){_0x3d5779=_0x16ec7e;_0x53f0ea[_0x6ffb('0x2f')]=_[_0x6ffb('0x32')](db[_0x6ffb('0x4b')][_0x6ffb('0x2e')]);_0x53f0ea['query']=_[_0x6ffb('0x32')](_0x3fc595['query']);_0x53f0ea[_0x6ffb('0x33')]=_[_0x6ffb('0x45')](_0x53f0ea[_0x6ffb('0x2f')],_0x53f0ea[_0x6ffb('0x31')]);_0x50f454[_0x6ffb('0x34')]=_[_0x6ffb('0x45')](_0x53f0ea[_0x6ffb('0x2f')],qs['fields'](_0x3fc595[_0x6ffb('0x31')]['fields']));_0x50f454[_0x6ffb('0x34')]=_0x50f454[_0x6ffb('0x34')]['length']?_0x50f454['attributes']:_0x53f0ea[_0x6ffb('0x2f')];_0x50f454['order']=qs[_0x6ffb('0x39')](_0x3fc595[_0x6ffb('0x31')][_0x6ffb('0x39')]);_0x50f454[_0x6ffb('0x3a')]=qs[_0x6ffb('0x33')](_[_0x6ffb('0x3b')](_0x3fc595['query'],_0x53f0ea[_0x6ffb('0x33')]));if(_0x3fc595[_0x6ffb('0x31')][_0x6ffb('0x3c')]){_0x50f454[_0x6ffb('0x3a')]=_[_0x6ffb('0x3e')](_0x50f454[_0x6ffb('0x3a')],{'$or':_[_0x6ffb('0x2c')](_0x50f454['attributes'],function(_0x4ddcae){var _0x142c49={};_0x142c49[_0x4ddcae]={'$like':'%'+_0x3fc595['query'][_0x6ffb('0x3c')]+'%'};return _0x142c49;})});}_0x50f454=_[_0x6ffb('0x3e')]({},_0x50f454,_0x3fc595[_0x6ffb('0x4c')]);return _0x3d5779[_0x6ffb('0x4e')](_0x50f454);}})['then'](function(_0x10ee9b){if(_0x10ee9b){_0x17f04=_0x10ee9b[_0x6ffb('0x35')];if(!_0x3fc595[_0x6ffb('0x31')][_0x6ffb('0x36')](_0x6ffb('0x37'))){_0x50f454[_0x6ffb('0x1e')]=qs['limit'](_0x3fc595[_0x6ffb('0x31')][_0x6ffb('0x1e')]);_0x50f454[_0x6ffb('0x1f')]=qs[_0x6ffb('0x1f')](_0x3fc595['query']['offset']);}return _0x3d5779['getSubjects'](_0x50f454);}})['then'](function(_0x5ab7bc){if(_0x5ab7bc){return _0x5ab7bc?{'count':_0x17f04,'rows':_0x5ab7bc}:null;}})[_0x6ffb('0x27')](respondWithResult(_0x4a2ea9,null))['catch'](handleError(_0x4a2ea9,null));};exports['getDescriptions']=function(_0x37e74a,_0x1e55f8,_0x5887a8){var _0x5017bd={};var _0x228dec={};var _0xef183c;var _0x602f56;return db[_0x6ffb('0x2d')]['findOne']({'where':{'id':_0x37e74a[_0x6ffb('0x44')]['id']}})[_0x6ffb('0x27')](handleEntityNotFound(_0x1e55f8,null))[_0x6ffb('0x27')](function(_0x13f81e){if(_0x13f81e){_0xef183c=_0x13f81e;_0x228dec[_0x6ffb('0x2f')]=_[_0x6ffb('0x32')](db[_0x6ffb('0x4b')][_0x6ffb('0x2e')]);_0x228dec[_0x6ffb('0x31')]=_[_0x6ffb('0x32')](_0x37e74a[_0x6ffb('0x31')]);_0x228dec[_0x6ffb('0x33')]=_['intersection'](_0x228dec[_0x6ffb('0x2f')],_0x228dec[_0x6ffb('0x31')]);_0x5017bd[_0x6ffb('0x34')]=_['intersection'](_0x228dec[_0x6ffb('0x2f')],qs[_0x6ffb('0x46')](_0x37e74a[_0x6ffb('0x31')][_0x6ffb('0x46')]));_0x5017bd[_0x6ffb('0x34')]=_0x5017bd['attributes'][_0x6ffb('0x35')]?_0x5017bd[_0x6ffb('0x34')]:_0x228dec[_0x6ffb('0x2f')];_0x5017bd['order']=qs[_0x6ffb('0x39')](_0x37e74a[_0x6ffb('0x31')][_0x6ffb('0x39')]);_0x5017bd['where']=qs['filters'](_[_0x6ffb('0x3b')](_0x37e74a[_0x6ffb('0x31')],_0x228dec['filters']));if(_0x37e74a[_0x6ffb('0x31')]['filter']){_0x5017bd[_0x6ffb('0x3a')]=_['merge'](_0x5017bd[_0x6ffb('0x3a')],{'$or':_[_0x6ffb('0x2c')](_0x5017bd[_0x6ffb('0x34')],function(_0x3f0433){var _0x58d939={};_0x58d939[_0x3f0433]={'$like':'%'+_0x37e74a[_0x6ffb('0x31')][_0x6ffb('0x3c')]+'%'};return _0x58d939;})});}_0x5017bd=_[_0x6ffb('0x3e')]({},_0x5017bd,_0x37e74a[_0x6ffb('0x4c')]);return _0xef183c['getDescriptions'](_0x5017bd);}})['then'](function(_0x4144ec){if(_0x4144ec){_0x602f56=_0x4144ec[_0x6ffb('0x35')];if(!_0x37e74a[_0x6ffb('0x31')][_0x6ffb('0x36')](_0x6ffb('0x37'))){_0x5017bd[_0x6ffb('0x1e')]=qs[_0x6ffb('0x1e')](_0x37e74a[_0x6ffb('0x31')][_0x6ffb('0x1e')]);_0x5017bd[_0x6ffb('0x1f')]=qs[_0x6ffb('0x1f')](_0x37e74a['query'][_0x6ffb('0x1f')]);}return _0xef183c['getDescriptions'](_0x5017bd);}})[_0x6ffb('0x27')](function(_0xadab41){if(_0xadab41){return _0xadab41?{'count':_0x602f56,'rows':_0xadab41}:null;}})['then'](respondWithResult(_0x1e55f8,null))['catch'](handleError(_0x1e55f8,null));}; \ No newline at end of file +var _0xaba8=['destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','body','update','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then'];(function(_0xa2d2c1,_0xdb5d56){var _0x164b0c=function(_0x40563b){while(--_0x40563b){_0xa2d2c1['push'](_0xa2d2c1['shift']());}};_0x164b0c(++_0xdb5d56);}(_0xaba8,0x1af));var _0x8aba=function(_0x42dd1d,_0x439075){_0x42dd1d=_0x42dd1d-0x0;var _0x4ce444=_0xaba8[_0x42dd1d];return _0x4ce444;};'use strict';var emlformat=require(_0x8aba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8aba('0x1'));var jsonpatch=require(_0x8aba('0x2'));var rp=require(_0x8aba('0x3'));var moment=require('moment');var BPromise=require(_0x8aba('0x4'));var Mustache=require(_0x8aba('0x5'));var util=require(_0x8aba('0x6'));var path=require('path');var sox=require(_0x8aba('0x7'));var csv=require(_0x8aba('0x8'));var ejs=require(_0x8aba('0x9'));var fs=require('fs');var fs_extra=require(_0x8aba('0xa'));var _=require(_0x8aba('0xb'));var squel=require(_0x8aba('0xc'));var crypto=require(_0x8aba('0xd'));var jsforce=require(_0x8aba('0xe'));var deskjs=require(_0x8aba('0xf'));var toCsv=require(_0x8aba('0x8'));var querystring=require(_0x8aba('0x10'));var Papa=require(_0x8aba('0x11'));var Redis=require(_0x8aba('0x12'));var authService=require(_0x8aba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8aba('0x14'));var hardwareService=require(_0x8aba('0x15'));var logger=require('../../config/logger')(_0x8aba('0x16'));var utils=require(_0x8aba('0x17'));var config=require(_0x8aba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aba('0x19'))['db'];function respondWithStatusCode(_0x5e5ead,_0x498556){_0x498556=_0x498556||0xcc;return function(_0x37688f){if(_0x37688f){return _0x5e5ead[_0x8aba('0x1a')](_0x498556);}return _0x5e5ead[_0x8aba('0x1b')](_0x498556)[_0x8aba('0x1c')]();};}function respondWithResult(_0x30c97f,_0x1da62a){_0x1da62a=_0x1da62a||0xc8;return function(_0x2e1414){if(_0x2e1414){return _0x30c97f[_0x8aba('0x1b')](_0x1da62a)[_0x8aba('0x1d')](_0x2e1414);}};}function respondWithFilteredResult(_0x5ea2db,_0x45498b){return function(_0x35ff3a){if(_0x35ff3a){var _0x59e1f9=typeof _0x45498b[_0x8aba('0x1e')]==='undefined'&&typeof _0x45498b[_0x8aba('0x1f')]===_0x8aba('0x20');var _0x4fb17b=_0x35ff3a[_0x8aba('0x21')];var _0x434bde=_0x59e1f9?0x0:_0x45498b[_0x8aba('0x1e')];var _0x14d75c=_0x59e1f9?_0x35ff3a[_0x8aba('0x21')]:_0x45498b[_0x8aba('0x1e')]+_0x45498b[_0x8aba('0x1f')];var _0x2a3190;if(_0x14d75c>=_0x4fb17b){_0x14d75c=_0x4fb17b;_0x2a3190=0xc8;}else{_0x2a3190=0xce;}_0x5ea2db['status'](_0x2a3190);return _0x5ea2db[_0x8aba('0x22')](_0x8aba('0x23'),_0x434bde+'-'+_0x14d75c+'/'+_0x4fb17b)[_0x8aba('0x1d')](_0x35ff3a);}return null;};}function patchUpdates(_0x42eda9){return function(_0xeae40d){try{jsonpatch['apply'](_0xeae40d,_0x42eda9,!![]);}catch(_0x81e64){return BPromise['reject'](_0x81e64);}return _0xeae40d['save']();};}function saveUpdates(_0x49f2b8,_0x4b62f9){return function(_0x27a181){if(_0x27a181){return _0x27a181['update'](_0x49f2b8)[_0x8aba('0x24')](function(_0x1f365e){return _0x1f365e;});}return null;};}function removeEntity(_0x389c7c,_0x255457){return function(_0x46ea78){if(_0x46ea78){return _0x46ea78[_0x8aba('0x25')]()[_0x8aba('0x24')](function(){_0x389c7c[_0x8aba('0x1b')](0xcc)[_0x8aba('0x1c')]();});}};}function handleEntityNotFound(_0x3a3161,_0x55c3ca){return function(_0x1a1c53){if(!_0x1a1c53){_0x3a3161['sendStatus'](0x194);}return _0x1a1c53;};}function handleError(_0x2b70eb,_0x220cfd){_0x220cfd=_0x220cfd||0x1f4;return function(_0x33439d){logger[_0x8aba('0x26')](_0x33439d[_0x8aba('0x27')]);if(_0x33439d[_0x8aba('0x28')]){delete _0x33439d['name'];}_0x2b70eb[_0x8aba('0x1b')](_0x220cfd)['send'](_0x33439d);};}exports[_0x8aba('0x29')]=function(_0x28be4c,_0x5c3f08){var _0x1d8755={},_0x476a90={},_0x2dc19b={'count':0x0,'rows':[]};var _0x3bc0ea=_[_0x8aba('0x2a')](db[_0x8aba('0x2b')][_0x8aba('0x2c')],function(_0x39c587){return{'name':_0x39c587[_0x8aba('0x2d')],'type':_0x39c587['type'][_0x8aba('0x2e')]};});_0x476a90[_0x8aba('0x2f')]=_[_0x8aba('0x2a')](_0x3bc0ea,_0x8aba('0x28'));_0x476a90[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x28be4c[_0x8aba('0x30')]);_0x476a90[_0x8aba('0x32')]=_[_0x8aba('0x33')](_0x476a90[_0x8aba('0x2f')],_0x476a90[_0x8aba('0x30')]);_0x1d8755[_0x8aba('0x34')]=_[_0x8aba('0x33')](_0x476a90[_0x8aba('0x2f')],qs[_0x8aba('0x35')](_0x28be4c['query'][_0x8aba('0x35')]));_0x1d8755['attributes']=_0x1d8755[_0x8aba('0x34')][_0x8aba('0x36')]?_0x1d8755[_0x8aba('0x34')]:_0x476a90['model'];if(!_0x28be4c[_0x8aba('0x30')][_0x8aba('0x37')](_0x8aba('0x38'))){_0x1d8755[_0x8aba('0x1f')]=qs['limit'](_0x28be4c[_0x8aba('0x30')]['limit']);_0x1d8755[_0x8aba('0x1e')]=qs[_0x8aba('0x1e')](_0x28be4c[_0x8aba('0x30')][_0x8aba('0x1e')]);}_0x1d8755[_0x8aba('0x39')]=qs[_0x8aba('0x3a')](_0x28be4c[_0x8aba('0x30')][_0x8aba('0x3a')]);_0x1d8755[_0x8aba('0x3b')]=qs['filters'](_[_0x8aba('0x3c')](_0x28be4c[_0x8aba('0x30')],_0x476a90[_0x8aba('0x32')]),_0x3bc0ea);if(_0x28be4c[_0x8aba('0x30')][_0x8aba('0x3d')]){_0x1d8755[_0x8aba('0x3b')]=_[_0x8aba('0x3e')](_0x1d8755['where'],{'$or':_['map'](_0x3bc0ea,function(_0xd96212){if(_0xd96212[_0x8aba('0x3f')]!=='VIRTUAL'){var _0x2fe67b={};_0x2fe67b[_0xd96212[_0x8aba('0x28')]]={'$like':'%'+_0x28be4c[_0x8aba('0x30')][_0x8aba('0x3d')]+'%'};return _0x2fe67b;}})});}_0x1d8755=_[_0x8aba('0x3e')]({},_0x1d8755,_0x28be4c[_0x8aba('0x40')]);var _0x2cddf4={'where':_0x1d8755[_0x8aba('0x3b')]};return db[_0x8aba('0x2b')]['count'](_0x2cddf4)[_0x8aba('0x24')](function(_0x279d4c){_0x2dc19b['count']=_0x279d4c;if(_0x28be4c[_0x8aba('0x30')][_0x8aba('0x41')]){_0x1d8755[_0x8aba('0x42')]=[{'all':!![]}];}return db[_0x8aba('0x2b')][_0x8aba('0x43')](_0x1d8755);})[_0x8aba('0x24')](function(_0x592861){_0x2dc19b['rows']=_0x592861;return _0x2dc19b;})[_0x8aba('0x24')](respondWithFilteredResult(_0x5c3f08,_0x1d8755))[_0x8aba('0x44')](handleError(_0x5c3f08,null));};exports[_0x8aba('0x45')]=function(_0x479364,_0x3e69ff){var _0x58be35={'raw':![],'where':{'id':_0x479364[_0x8aba('0x46')]['id']}},_0xabc2ce={};_0xabc2ce[_0x8aba('0x2f')]=_[_0x8aba('0x31')](db[_0x8aba('0x2b')][_0x8aba('0x2c')]);_0xabc2ce[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x479364[_0x8aba('0x30')]);_0xabc2ce['filters']=_[_0x8aba('0x33')](_0xabc2ce[_0x8aba('0x2f')],_0xabc2ce[_0x8aba('0x30')]);_0x58be35['attributes']=_['intersection'](_0xabc2ce[_0x8aba('0x2f')],qs[_0x8aba('0x35')](_0x479364[_0x8aba('0x30')][_0x8aba('0x35')]));_0x58be35[_0x8aba('0x34')]=_0x58be35[_0x8aba('0x34')]['length']?_0x58be35[_0x8aba('0x34')]:_0xabc2ce['model'];if(_0x479364[_0x8aba('0x30')][_0x8aba('0x41')]){_0x58be35[_0x8aba('0x42')]=[{'all':!![]}];}_0x58be35=_['merge']({},_0x58be35,_0x479364[_0x8aba('0x40')]);return db['VtigerConfiguration']['find'](_0x58be35)[_0x8aba('0x24')](handleEntityNotFound(_0x3e69ff,null))[_0x8aba('0x24')](respondWithResult(_0x3e69ff,null))[_0x8aba('0x44')](handleError(_0x3e69ff,null));};exports['create']=function(_0x29ebbf,_0x565d22){return db[_0x8aba('0x2b')]['create'](_0x29ebbf[_0x8aba('0x47')],{})['then'](respondWithResult(_0x565d22,0xc9))[_0x8aba('0x44')](handleError(_0x565d22,null));};exports[_0x8aba('0x48')]=function(_0x30b037,_0x1b2e77){if(_0x30b037[_0x8aba('0x47')]['id']){delete _0x30b037[_0x8aba('0x47')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x30b037['params']['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x1b2e77,null))[_0x8aba('0x24')](saveUpdates(_0x30b037[_0x8aba('0x47')],null))[_0x8aba('0x24')](respondWithResult(_0x1b2e77,null))[_0x8aba('0x44')](handleError(_0x1b2e77,null));};exports[_0x8aba('0x25')]=function(_0xb59f57,_0x3c0c28){return db[_0x8aba('0x2b')]['find']({'where':{'id':_0xb59f57[_0x8aba('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c0c28,null))[_0x8aba('0x24')](removeEntity(_0x3c0c28,null))[_0x8aba('0x44')](handleError(_0x3c0c28,null));};exports['getFields']=function(_0x8581a5,_0x42bfec,_0x4f4f4c){var _0x1fd938={};var _0x415339={};var _0x4b8643;var _0x1b0af6;return db['VtigerConfiguration'][_0x8aba('0x49')]({'where':{'id':_0x8581a5[_0x8aba('0x46')]['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x42bfec,null))['then'](function(_0x22b78c){if(_0x22b78c){_0x4b8643=_0x22b78c;_0x415339[_0x8aba('0x2f')]=_[_0x8aba('0x31')](db[_0x8aba('0x4a')][_0x8aba('0x2c')]);_0x415339[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x8581a5[_0x8aba('0x30')]);_0x415339[_0x8aba('0x32')]=_['intersection'](_0x415339[_0x8aba('0x2f')],_0x415339[_0x8aba('0x30')]);_0x1fd938[_0x8aba('0x34')]=_['intersection'](_0x415339['model'],qs['fields'](_0x8581a5[_0x8aba('0x30')]['fields']));_0x1fd938[_0x8aba('0x34')]=_0x1fd938[_0x8aba('0x34')][_0x8aba('0x36')]?_0x1fd938[_0x8aba('0x34')]:_0x415339['model'];_0x1fd938[_0x8aba('0x39')]=qs['sort'](_0x8581a5['query'][_0x8aba('0x3a')]);_0x1fd938['where']=qs[_0x8aba('0x32')](_[_0x8aba('0x3c')](_0x8581a5[_0x8aba('0x30')],_0x415339['filters']));if(_0x8581a5['query'][_0x8aba('0x3d')]){_0x1fd938[_0x8aba('0x3b')]=_[_0x8aba('0x3e')](_0x1fd938['where'],{'$or':_[_0x8aba('0x2a')](_0x1fd938[_0x8aba('0x34')],function(_0x21d043){var _0x5abf8f={};_0x5abf8f[_0x21d043]={'$like':'%'+_0x8581a5[_0x8aba('0x30')]['filter']+'%'};return _0x5abf8f;})});}_0x1fd938=_[_0x8aba('0x3e')]({},_0x1fd938,_0x8581a5[_0x8aba('0x40')]);return _0x4b8643[_0x8aba('0x4b')](_0x1fd938);}})['then'](function(_0x241e2f){if(_0x241e2f){_0x1b0af6=_0x241e2f[_0x8aba('0x36')];if(!_0x8581a5[_0x8aba('0x30')]['hasOwnProperty']('nolimit')){_0x1fd938[_0x8aba('0x1f')]=qs[_0x8aba('0x1f')](_0x8581a5[_0x8aba('0x30')][_0x8aba('0x1f')]);_0x1fd938['offset']=qs[_0x8aba('0x1e')](_0x8581a5[_0x8aba('0x30')][_0x8aba('0x1e')]);}return _0x4b8643[_0x8aba('0x4b')](_0x1fd938);}})['then'](function(_0xe78c57){if(_0xe78c57){return _0xe78c57?{'count':_0x1b0af6,'rows':_0xe78c57}:null;}})[_0x8aba('0x24')](respondWithResult(_0x42bfec,null))[_0x8aba('0x44')](handleError(_0x42bfec,null));};exports[_0x8aba('0x4c')]=function(_0x333268,_0x2d791e,_0x16b381){var _0x3ed0fd={};var _0x3d892c={};var _0x4e3880;var _0x27416d;return db[_0x8aba('0x2b')]['findOne']({'where':{'id':_0x333268[_0x8aba('0x46')]['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x2d791e,null))[_0x8aba('0x24')](function(_0xf44b2b){if(_0xf44b2b){_0x4e3880=_0xf44b2b;_0x3d892c[_0x8aba('0x2f')]=_['keys'](db[_0x8aba('0x4a')][_0x8aba('0x2c')]);_0x3d892c['query']=_[_0x8aba('0x31')](_0x333268['query']);_0x3d892c[_0x8aba('0x32')]=_[_0x8aba('0x33')](_0x3d892c['model'],_0x3d892c['query']);_0x3ed0fd['attributes']=_[_0x8aba('0x33')](_0x3d892c[_0x8aba('0x2f')],qs[_0x8aba('0x35')](_0x333268['query'][_0x8aba('0x35')]));_0x3ed0fd[_0x8aba('0x34')]=_0x3ed0fd[_0x8aba('0x34')][_0x8aba('0x36')]?_0x3ed0fd['attributes']:_0x3d892c[_0x8aba('0x2f')];_0x3ed0fd[_0x8aba('0x39')]=qs['sort'](_0x333268[_0x8aba('0x30')][_0x8aba('0x3a')]);_0x3ed0fd[_0x8aba('0x3b')]=qs['filters'](_['pick'](_0x333268[_0x8aba('0x30')],_0x3d892c[_0x8aba('0x32')]));if(_0x333268[_0x8aba('0x30')][_0x8aba('0x3d')]){_0x3ed0fd['where']=_[_0x8aba('0x3e')](_0x3ed0fd[_0x8aba('0x3b')],{'$or':_['map'](_0x3ed0fd[_0x8aba('0x34')],function(_0x3aaa4e){var _0x14ee7d={};_0x14ee7d[_0x3aaa4e]={'$like':'%'+_0x333268['query'][_0x8aba('0x3d')]+'%'};return _0x14ee7d;})});}_0x3ed0fd=_['merge']({},_0x3ed0fd,_0x333268['options']);return _0x4e3880['getSubjects'](_0x3ed0fd);}})['then'](function(_0x2e73be){if(_0x2e73be){_0x27416d=_0x2e73be[_0x8aba('0x36')];if(!_0x333268[_0x8aba('0x30')][_0x8aba('0x37')](_0x8aba('0x38'))){_0x3ed0fd[_0x8aba('0x1f')]=qs['limit'](_0x333268[_0x8aba('0x30')][_0x8aba('0x1f')]);_0x3ed0fd[_0x8aba('0x1e')]=qs[_0x8aba('0x1e')](_0x333268[_0x8aba('0x30')][_0x8aba('0x1e')]);}return _0x4e3880['getSubjects'](_0x3ed0fd);}})[_0x8aba('0x24')](function(_0x895376){if(_0x895376){return _0x895376?{'count':_0x27416d,'rows':_0x895376}:null;}})[_0x8aba('0x24')](respondWithResult(_0x2d791e,null))[_0x8aba('0x44')](handleError(_0x2d791e,null));};exports['getDescriptions']=function(_0x53dd5b,_0x413d70,_0x432ef3){var _0xfbcb69={};var _0x14812c={};var _0x114b77;var _0x1bb1f2;return db[_0x8aba('0x2b')][_0x8aba('0x49')]({'where':{'id':_0x53dd5b['params']['id']}})[_0x8aba('0x24')](handleEntityNotFound(_0x413d70,null))[_0x8aba('0x24')](function(_0x46aeab){if(_0x46aeab){_0x114b77=_0x46aeab;_0x14812c[_0x8aba('0x2f')]=_[_0x8aba('0x31')](db[_0x8aba('0x4a')][_0x8aba('0x2c')]);_0x14812c[_0x8aba('0x30')]=_[_0x8aba('0x31')](_0x53dd5b[_0x8aba('0x30')]);_0x14812c[_0x8aba('0x32')]=_[_0x8aba('0x33')](_0x14812c['model'],_0x14812c[_0x8aba('0x30')]);_0xfbcb69[_0x8aba('0x34')]=_[_0x8aba('0x33')](_0x14812c[_0x8aba('0x2f')],qs['fields'](_0x53dd5b[_0x8aba('0x30')][_0x8aba('0x35')]));_0xfbcb69['attributes']=_0xfbcb69[_0x8aba('0x34')][_0x8aba('0x36')]?_0xfbcb69['attributes']:_0x14812c[_0x8aba('0x2f')];_0xfbcb69[_0x8aba('0x39')]=qs['sort'](_0x53dd5b[_0x8aba('0x30')][_0x8aba('0x3a')]);_0xfbcb69['where']=qs[_0x8aba('0x32')](_[_0x8aba('0x3c')](_0x53dd5b[_0x8aba('0x30')],_0x14812c['filters']));if(_0x53dd5b['query'][_0x8aba('0x3d')]){_0xfbcb69[_0x8aba('0x3b')]=_[_0x8aba('0x3e')](_0xfbcb69[_0x8aba('0x3b')],{'$or':_[_0x8aba('0x2a')](_0xfbcb69[_0x8aba('0x34')],function(_0x572739){var _0x5679f6={};_0x5679f6[_0x572739]={'$like':'%'+_0x53dd5b['query'][_0x8aba('0x3d')]+'%'};return _0x5679f6;})});}_0xfbcb69=_[_0x8aba('0x3e')]({},_0xfbcb69,_0x53dd5b[_0x8aba('0x40')]);return _0x114b77[_0x8aba('0x4d')](_0xfbcb69);}})[_0x8aba('0x24')](function(_0x3ae2cb){if(_0x3ae2cb){_0x1bb1f2=_0x3ae2cb[_0x8aba('0x36')];if(!_0x53dd5b[_0x8aba('0x30')][_0x8aba('0x37')](_0x8aba('0x38'))){_0xfbcb69[_0x8aba('0x1f')]=qs[_0x8aba('0x1f')](_0x53dd5b['query'][_0x8aba('0x1f')]);_0xfbcb69[_0x8aba('0x1e')]=qs[_0x8aba('0x1e')](_0x53dd5b[_0x8aba('0x30')]['offset']);}return _0x114b77['getDescriptions'](_0xfbcb69);}})[_0x8aba('0x24')](function(_0x32e819){if(_0x32e819){return _0x32e819?{'count':_0x1bb1f2,'rows':_0x32e819}:null;}})[_0x8aba('0x24')](respondWithResult(_0x413d70,null))[_0x8aba('0x44')](handleError(_0x413d70,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7545096..7fbb7ea 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 _0xce75=['path','rimraf','exports','VtigerConfiguration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10122f,_0x3dfecf){var _0x28d2f5=function(_0x29ef8c){while(--_0x29ef8c){_0x10122f['push'](_0x10122f['shift']());}};_0x28d2f5(++_0x3dfecf);}(_0xce75,0xd6));var _0x5ce7=function(_0x473ac7,_0x3c9171){_0x473ac7=_0x473ac7-0x0;var _0x41e367=_0xce75[_0x473ac7];return _0x41e367;};'use strict';var _=require(_0x5ce7('0x0'));var util=require(_0x5ce7('0x1'));var logger=require(_0x5ce7('0x2'))(_0x5ce7('0x3'));var moment=require(_0x5ce7('0x4'));var BPromise=require(_0x5ce7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ce7('0x6'));var rimraf=require(_0x5ce7('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x5ce7('0x8')]=function(_0x47602a,_0x3c5338){return _0x47602a['define'](_0x5ce7('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa075=['define','VtigerConfiguration','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x452c06,_0x2d6a45){var _0x3c4e54=function(_0x4ad95c){while(--_0x4ad95c){_0x452c06['push'](_0x452c06['shift']());}};_0x3c4e54(++_0x2d6a45);}(_0xa075,0xad));var _0x5a07=function(_0x5bc144,_0x285275){_0x5bc144=_0x5bc144-0x0;var _0x184193=_0xa075[_0x5bc144];return _0x184193;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5a07('0x0'));var moment=require(_0x5a07('0x1'));var BPromise=require(_0x5a07('0x2'));var rp=require(_0x5a07('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a07('0x4'));var config=require(_0x5a07('0x5'));var attributes=require(_0x5a07('0x6'));module['exports']=function(_0x1f6688,_0x4b1a84){return _0x1f6688[_0x5a07('0x7')](_0x5a07('0x8'),attributes,{'tableName':'int_vtiger_configurations','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 0d20bf0..a67993c 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 _0x2d9c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x2d9c,0x137));var _0xc2d9=function(_0x39f494,_0x4ec7b4){_0x39f494=_0x39f494-0x0;var _0x4de43e=_0x2d9c[_0x39f494];return _0x4de43e;};'use strict';var _=require('lodash');var util=require(_0xc2d9('0x0'));var moment=require(_0xc2d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xc2d9('0x2'));var fs=require('fs');var Redis=require(_0xc2d9('0x3'));var db=require(_0xc2d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2d9('0x5'))(_0xc2d9('0x6'));var config=require(_0xc2d9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc2d9('0x8')][_0xc2d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x362456,_0x5773fa,_0x2c8a1e){return new BPromise(function(_0x5bdcf3,_0x31a8e0){return client[_0xc2d9('0xa')](_0x362456,_0x2c8a1e)[_0xc2d9('0xb')](function(_0x239380){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x5773fa,'request\x20sent');logger['debug'](_0xc2d9('0xc'),_0x5773fa,_0xc2d9('0xd'),JSON[_0xc2d9('0xe')](_0x239380));if(_0x239380[_0xc2d9('0xf')]){if(_0x239380[_0xc2d9('0xf')]['code']===0x1f4){logger['error'](_0xc2d9('0x10'),_0x5773fa,_0x239380[_0xc2d9('0xf')]['message']);return _0x31a8e0(_0x239380['error'][_0xc2d9('0x11')]);}logger[_0xc2d9('0xf')](_0xc2d9('0x10'),_0x5773fa,_0x239380[_0xc2d9('0xf')]['message']);return _0x5bdcf3(_0x239380[_0xc2d9('0xf')][_0xc2d9('0x11')]);}else{logger[_0xc2d9('0x12')](_0xc2d9('0x10'),_0x5773fa,'request\x20sent');_0x5bdcf3(_0x239380[_0xc2d9('0x13')][_0xc2d9('0x11')]);}})[_0xc2d9('0x14')](function(_0x4ada3d){logger[_0xc2d9('0xf')](_0xc2d9('0x10'),_0x5773fa,_0x4ada3d);_0x31a8e0(_0x4ada3d);});});} \ No newline at end of file +var _0x99ed=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0x99ed,0x175));var _0xd99e=function(_0x187e17,_0x5e67da){_0x187e17=_0x187e17-0x0;var _0x15db9d=_0x99ed[_0x187e17];return _0x15db9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd99e('0x0'));var BPromise=require(_0xd99e('0x1'));var rs=require(_0xd99e('0x2'));var fs=require('fs');var Redis=require(_0xd99e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd99e('0x4'));var logger=require(_0xd99e('0x5'))(_0xd99e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd99e('0x7'));var client=jayson[_0xd99e('0x8')][_0xd99e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26995f,_0x54d110,_0x494eb7){return new BPromise(function(_0x3853f1,_0x56b02d){return client[_0xd99e('0xa')](_0x26995f,_0x494eb7)[_0xd99e('0xb')](function(_0x58f75a){logger[_0xd99e('0xc')](_0xd99e('0xd'),_0x54d110,'request\x20sent');logger[_0xd99e('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x54d110,_0xd99e('0xf'),JSON[_0xd99e('0x10')](_0x58f75a));if(_0x58f75a[_0xd99e('0x11')]){if(_0x58f75a[_0xd99e('0x11')][_0xd99e('0x12')]===0x1f4){logger[_0xd99e('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x54d110,_0x58f75a[_0xd99e('0x11')][_0xd99e('0x13')]);return _0x56b02d(_0x58f75a['error'][_0xd99e('0x13')]);}logger[_0xd99e('0x11')](_0xd99e('0xd'),_0x54d110,_0x58f75a[_0xd99e('0x11')][_0xd99e('0x13')]);return _0x3853f1(_0x58f75a[_0xd99e('0x11')][_0xd99e('0x13')]);}else{logger[_0xd99e('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x54d110,_0xd99e('0xf'));_0x3853f1(_0x58f75a[_0xd99e('0x14')][_0xd99e('0x13')]);}})[_0xd99e('0x15')](function(_0x45fa08){logger[_0xd99e('0x11')](_0xd99e('0xd'),_0x54d110,_0x45fa08);_0x56b02d(_0x45fa08);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5aa224b..c3dd5f8 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 _0x835c=['../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','show','post','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x32dcd4,_0x4e706d){var _0x3abe78=function(_0x301638){while(--_0x301638){_0x32dcd4['push'](_0x32dcd4['shift']());}};_0x3abe78(++_0x4e706d);}(_0x835c,0x1e8));var _0xc835=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x835c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc835('0x0'));var util=require(_0xc835('0x1'));var path=require('path');var timeout=require(_0xc835('0x2'));var express=require('express');var router=express[_0xc835('0x3')]();var fs_extra=require(_0xc835('0x4'));var auth=require(_0xc835('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc835('0x6'));var controller=require(_0xc835('0x7'));router['get']('/',auth[_0xc835('0x8')](),controller[_0xc835('0x9')]);router[_0xc835('0xa')]('/:id',auth[_0xc835('0x8')](),controller[_0xc835('0xb')]);router[_0xc835('0xc')]('/',auth['isAuthenticated'](),controller[_0xc835('0xd')]);router[_0xc835('0xe')]('/:id',auth[_0xc835('0x8')](),controller[_0xc835('0xf')]);router[_0xc835('0x10')](_0xc835('0x11'),auth['isAuthenticated'](),controller[_0xc835('0x12')]);module['exports']=router; \ No newline at end of file +var _0x75b5=['update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x48eab4,_0x277c00){var _0xae2e9e=function(_0x590f1c){while(--_0x590f1c){_0x48eab4['push'](_0x48eab4['shift']());}};_0xae2e9e(++_0x277c00);}(_0x75b5,0xe8));var _0x575b=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x75b5[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require(_0x575b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x575b('0x1'));var router=express[_0x575b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x575b('0x3'));var interaction=require(_0x575b('0x4'));var config=require(_0x575b('0x5'));var controller=require(_0x575b('0x6'));router[_0x575b('0x7')]('/',auth[_0x575b('0x8')](),controller[_0x575b('0x9')]);router[_0x575b('0x7')]('/:id',auth[_0x575b('0x8')](),controller[_0x575b('0xa')]);router[_0x575b('0xb')]('/',auth['isAuthenticated'](),controller[_0x575b('0xc')]);router[_0x575b('0xd')](_0x575b('0xe'),auth[_0x575b('0x8')](),controller[_0x575b('0xf')]);router[_0x575b('0x10')](_0x575b('0xe'),auth[_0x575b('0x8')](),controller[_0x575b('0x11')]);module[_0x575b('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 7e395a9..d00e5db 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 _0x4c3c=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x4c3c,0xb3));var _0xc4c3=function(_0x451222,_0x1d2018){_0x451222=_0x451222-0x0;var _0x3511f5=_0x4c3c[_0x451222];return _0x3511f5;};'use strict';var Sequelize=require(_0xc4c3('0x0'));module[_0xc4c3('0x1')]={'type':{'type':Sequelize[_0xc4c3('0x2')]('string',_0xc4c3('0x3'),_0xc4c3('0x4'),_0xc4c3('0x5'),_0xc4c3('0x6')),'defaultValue':_0xc4c3('0x7')},'content':{'type':Sequelize[_0xc4c3('0x8')]},'key':{'type':Sequelize[_0xc4c3('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xc4c3('0x7'),_0xc4c3('0x3'),_0xc4c3('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc4c3('0x8')]},'nameField':{'type':Sequelize[_0xc4c3('0x8')]},'customField':{'type':Sequelize[_0xc4c3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4c3('0x8')]}}; \ No newline at end of file +var _0xeb2f=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xeb2f,0x125));var _0xfeb2=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0xeb2f[_0x172660];return _0x83204f;};'use strict';var Sequelize=require(_0xfeb2('0x0'));module[_0xfeb2('0x1')]={'type':{'type':Sequelize[_0xfeb2('0x2')](_0xfeb2('0x3'),_0xfeb2('0x4'),_0xfeb2('0x5'),_0xfeb2('0x6'),'picklist'),'defaultValue':_0xfeb2('0x3')},'content':{'type':Sequelize[_0xfeb2('0x7')]},'key':{'type':Sequelize[_0xfeb2('0x7')]},'keyType':{'type':Sequelize[_0xfeb2('0x2')](_0xfeb2('0x3'),_0xfeb2('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xfeb2('0x7')]},'idField':{'type':Sequelize[_0xfeb2('0x7')]},'nameField':{'type':Sequelize[_0xfeb2('0x7')]},'customField':{'type':Sequelize[_0xfeb2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfeb2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 71aef9a..9c8104c 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 _0xea7f=['../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','VtigerField','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x34ffcf,_0x291e82){var _0x18b64e=function(_0x577d3a){while(--_0x577d3a){_0x34ffcf['push'](_0x34ffcf['shift']());}};_0x18b64e(++_0x291e82);}(_0xea7f,0xc5));var _0xfea7=function(_0x1b0c47,_0x436272){_0x1b0c47=_0x1b0c47-0x0;var _0x3c3a5f=_0xea7f[_0x1b0c47];return _0x3c3a5f;};'use strict';var emlformat=require(_0xfea7('0x0'));var rimraf=require(_0xfea7('0x1'));var zipdir=require(_0xfea7('0x2'));var jsonpatch=require(_0xfea7('0x3'));var rp=require(_0xfea7('0x4'));var moment=require(_0xfea7('0x5'));var BPromise=require(_0xfea7('0x6'));var Mustache=require('mustache');var util=require(_0xfea7('0x7'));var path=require(_0xfea7('0x8'));var sox=require(_0xfea7('0x9'));var csv=require(_0xfea7('0xa'));var ejs=require(_0xfea7('0xb'));var fs=require('fs');var fs_extra=require(_0xfea7('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfea7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfea7('0xe'));var Papa=require(_0xfea7('0xf'));var Redis=require(_0xfea7('0x10'));var authService=require(_0xfea7('0x11'));var qs=require(_0xfea7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfea7('0x13'));var logger=require('../../config/logger')(_0xfea7('0x14'));var utils=require('../../config/utils');var config=require(_0xfea7('0x15'));var licenseUtil=require(_0xfea7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba485,_0x221da8){_0x221da8=_0x221da8||0xcc;return function(_0x5b8a21){if(_0x5b8a21){return _0x5ba485[_0xfea7('0x17')](_0x221da8);}return _0x5ba485[_0xfea7('0x18')](_0x221da8)[_0xfea7('0x19')]();};}function respondWithResult(_0x314224,_0x1be7d4){_0x1be7d4=_0x1be7d4||0xc8;return function(_0x7c06c9){if(_0x7c06c9){return _0x314224['status'](_0x1be7d4)['json'](_0x7c06c9);}};}function respondWithFilteredResult(_0x257030,_0x74fbae){return function(_0x2b3734){if(_0x2b3734){var _0x5433a6=typeof _0x74fbae['offset']===_0xfea7('0x1a')&&typeof _0x74fbae[_0xfea7('0x1b')]===_0xfea7('0x1a');var _0x3422c2=_0x2b3734[_0xfea7('0x1c')];var _0x1b3498=_0x5433a6?0x0:_0x74fbae['offset'];var _0x254107=_0x5433a6?_0x2b3734[_0xfea7('0x1c')]:_0x74fbae[_0xfea7('0x1d')]+_0x74fbae[_0xfea7('0x1b')];var _0x57f747;if(_0x254107>=_0x3422c2){_0x254107=_0x3422c2;_0x57f747=0xc8;}else{_0x57f747=0xce;}_0x257030[_0xfea7('0x18')](_0x57f747);return _0x257030[_0xfea7('0x1e')](_0xfea7('0x1f'),_0x1b3498+'-'+_0x254107+'/'+_0x3422c2)[_0xfea7('0x20')](_0x2b3734);}return null;};}function patchUpdates(_0xaf222d){return function(_0x1d3a57){try{jsonpatch[_0xfea7('0x21')](_0x1d3a57,_0xaf222d,!![]);}catch(_0x9a648f){return BPromise['reject'](_0x9a648f);}return _0x1d3a57[_0xfea7('0x22')]();};}function saveUpdates(_0xe9c019,_0x1e4ffb){return function(_0x3d2194){if(_0x3d2194){return _0x3d2194[_0xfea7('0x23')](_0xe9c019)[_0xfea7('0x24')](function(_0xf0f69f){return _0xf0f69f;});}return null;};}function removeEntity(_0x120bb1,_0xe8a33d){return function(_0xebcefd){if(_0xebcefd){return _0xebcefd[_0xfea7('0x25')]()[_0xfea7('0x24')](function(){_0x120bb1[_0xfea7('0x18')](0xcc)[_0xfea7('0x19')]();});}};}function handleEntityNotFound(_0x30248a,_0x36c3e2){return function(_0x241184){if(!_0x241184){_0x30248a[_0xfea7('0x17')](0x194);}return _0x241184;};}function handleError(_0x5be3ae,_0x3ae68e){_0x3ae68e=_0x3ae68e||0x1f4;return function(_0x2e6057){logger['error'](_0x2e6057[_0xfea7('0x26')]);if(_0x2e6057[_0xfea7('0x27')]){delete _0x2e6057[_0xfea7('0x27')];}_0x5be3ae[_0xfea7('0x18')](_0x3ae68e)[_0xfea7('0x28')](_0x2e6057);};}exports[_0xfea7('0x29')]=function(_0x39bbc6,_0xfabfae){var _0x539e54={},_0x3d0c0e={},_0x29cc21={'count':0x0,'rows':[]};var _0x5497dd=_[_0xfea7('0x2a')](db[_0xfea7('0x2b')]['rawAttributes'],function(_0x160e39){return{'name':_0x160e39[_0xfea7('0x2c')],'type':_0x160e39[_0xfea7('0x2d')]['key']};});_0x3d0c0e[_0xfea7('0x2e')]=_[_0xfea7('0x2a')](_0x5497dd,_0xfea7('0x27'));_0x3d0c0e[_0xfea7('0x2f')]=_[_0xfea7('0x30')](_0x39bbc6['query']);_0x3d0c0e['filters']=_[_0xfea7('0x31')](_0x3d0c0e[_0xfea7('0x2e')],_0x3d0c0e[_0xfea7('0x2f')]);_0x539e54[_0xfea7('0x32')]=_['intersection'](_0x3d0c0e[_0xfea7('0x2e')],qs[_0xfea7('0x33')](_0x39bbc6[_0xfea7('0x2f')][_0xfea7('0x33')]));_0x539e54[_0xfea7('0x32')]=_0x539e54[_0xfea7('0x32')][_0xfea7('0x34')]?_0x539e54['attributes']:_0x3d0c0e[_0xfea7('0x2e')];if(!_0x39bbc6[_0xfea7('0x2f')]['hasOwnProperty'](_0xfea7('0x35'))){_0x539e54[_0xfea7('0x1b')]=qs['limit'](_0x39bbc6[_0xfea7('0x2f')]['limit']);_0x539e54[_0xfea7('0x1d')]=qs[_0xfea7('0x1d')](_0x39bbc6[_0xfea7('0x2f')][_0xfea7('0x1d')]);}_0x539e54['order']=qs[_0xfea7('0x36')](_0x39bbc6[_0xfea7('0x2f')][_0xfea7('0x36')]);_0x539e54[_0xfea7('0x37')]=qs[_0xfea7('0x38')](_[_0xfea7('0x39')](_0x39bbc6[_0xfea7('0x2f')],_0x3d0c0e[_0xfea7('0x38')]),_0x5497dd);if(_0x39bbc6[_0xfea7('0x2f')][_0xfea7('0x3a')]){_0x539e54[_0xfea7('0x37')]=_[_0xfea7('0x3b')](_0x539e54['where'],{'$or':_[_0xfea7('0x2a')](_0x5497dd,function(_0x782105){if(_0x782105['type']!==_0xfea7('0x3c')){var _0x5882ea={};_0x5882ea[_0x782105[_0xfea7('0x27')]]={'$like':'%'+_0x39bbc6['query'][_0xfea7('0x3a')]+'%'};return _0x5882ea;}})});}_0x539e54=_[_0xfea7('0x3b')]({},_0x539e54,_0x39bbc6[_0xfea7('0x3d')]);var _0xe38dfb={'where':_0x539e54['where']};return db[_0xfea7('0x2b')][_0xfea7('0x1c')](_0xe38dfb)[_0xfea7('0x24')](function(_0x54a7cb){_0x29cc21[_0xfea7('0x1c')]=_0x54a7cb;if(_0x39bbc6['query'][_0xfea7('0x3e')]){_0x539e54[_0xfea7('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0xfea7('0x40')](_0x539e54);})['then'](function(_0x4d7df4){_0x29cc21[_0xfea7('0x41')]=_0x4d7df4;return _0x29cc21;})[_0xfea7('0x24')](respondWithFilteredResult(_0xfabfae,_0x539e54))[_0xfea7('0x42')](handleError(_0xfabfae,null));};exports['show']=function(_0x28890e,_0x112175){var _0x2bfdfe={'raw':!![],'where':{'id':_0x28890e[_0xfea7('0x43')]['id']}},_0x58dacc={};_0x58dacc[_0xfea7('0x2e')]=_[_0xfea7('0x30')](db[_0xfea7('0x2b')][_0xfea7('0x44')]);_0x58dacc[_0xfea7('0x2f')]=_[_0xfea7('0x30')](_0x28890e['query']);_0x58dacc[_0xfea7('0x38')]=_[_0xfea7('0x31')](_0x58dacc[_0xfea7('0x2e')],_0x58dacc[_0xfea7('0x2f')]);_0x2bfdfe[_0xfea7('0x32')]=_['intersection'](_0x58dacc[_0xfea7('0x2e')],qs[_0xfea7('0x33')](_0x28890e[_0xfea7('0x2f')][_0xfea7('0x33')]));_0x2bfdfe['attributes']=_0x2bfdfe[_0xfea7('0x32')][_0xfea7('0x34')]?_0x2bfdfe[_0xfea7('0x32')]:_0x58dacc[_0xfea7('0x2e')];if(_0x28890e[_0xfea7('0x2f')][_0xfea7('0x3e')]){_0x2bfdfe['include']=[{'all':!![]}];}_0x2bfdfe=_[_0xfea7('0x3b')]({},_0x2bfdfe,_0x28890e[_0xfea7('0x3d')]);return db[_0xfea7('0x2b')]['find'](_0x2bfdfe)[_0xfea7('0x24')](handleEntityNotFound(_0x112175,null))[_0xfea7('0x24')](respondWithResult(_0x112175,null))[_0xfea7('0x42')](handleError(_0x112175,null));};exports[_0xfea7('0x45')]=function(_0x46155d,_0x46ef68){return db['VtigerField'][_0xfea7('0x45')](_0x46155d['body'],{})[_0xfea7('0x24')](respondWithResult(_0x46ef68,0xc9))[_0xfea7('0x42')](handleError(_0x46ef68,null));};exports[_0xfea7('0x23')]=function(_0x223305,_0x5d62ff){if(_0x223305[_0xfea7('0x46')]['id']){delete _0x223305[_0xfea7('0x46')]['id'];}return db[_0xfea7('0x2b')][_0xfea7('0x47')]({'where':{'id':_0x223305['params']['id']}})[_0xfea7('0x24')](handleEntityNotFound(_0x5d62ff,null))[_0xfea7('0x24')](saveUpdates(_0x223305['body'],null))[_0xfea7('0x24')](respondWithResult(_0x5d62ff,null))['catch'](handleError(_0x5d62ff,null));};exports['destroy']=function(_0xaa6da2,_0x33308b){return db[_0xfea7('0x2b')][_0xfea7('0x47')]({'where':{'id':_0xaa6da2[_0xfea7('0x43')]['id']}})[_0xfea7('0x24')](handleEntityNotFound(_0x33308b,null))[_0xfea7('0x24')](removeEntity(_0x33308b,null))[_0xfea7('0x42')](handleError(_0x33308b,null));}; \ No newline at end of file +var _0x3a74=['count','apply','reject','save','then','destroy','end','error','stack','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','name','options','includeAll','include','findAll','show','params','keys','fields','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit'];(function(_0x3b9703,_0x4ec964){var _0x1bb1cb=function(_0x24622){while(--_0x24622){_0x3b9703['push'](_0x3b9703['shift']());}};_0x1bb1cb(++_0x4ec964);}(_0x3a74,0x198));var _0x43a7=function(_0x264194,_0x48ee77){_0x264194=_0x264194-0x0;var _0x584be0=_0x3a74[_0x264194];return _0x584be0;};'use strict';var emlformat=require(_0x43a7('0x0'));var rimraf=require(_0x43a7('0x1'));var zipdir=require(_0x43a7('0x2'));var jsonpatch=require(_0x43a7('0x3'));var rp=require('request-promise');var moment=require(_0x43a7('0x4'));var BPromise=require(_0x43a7('0x5'));var Mustache=require('mustache');var util=require(_0x43a7('0x6'));var path=require(_0x43a7('0x7'));var sox=require(_0x43a7('0x8'));var csv=require('to-csv');var ejs=require(_0x43a7('0x9'));var fs=require('fs');var fs_extra=require(_0x43a7('0xa'));var _=require(_0x43a7('0xb'));var squel=require(_0x43a7('0xc'));var crypto=require('crypto');var jsforce=require(_0x43a7('0xd'));var deskjs=require(_0x43a7('0xe'));var toCsv=require(_0x43a7('0xf'));var querystring=require(_0x43a7('0x10'));var Papa=require(_0x43a7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43a7('0x12'));var as=require(_0x43a7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43a7('0x14'))(_0x43a7('0x15'));var utils=require(_0x43a7('0x16'));var config=require(_0x43a7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x404686,_0x44fa22){_0x44fa22=_0x44fa22||0xcc;return function(_0x4d80db){if(_0x4d80db){return _0x404686[_0x43a7('0x18')](_0x44fa22);}return _0x404686[_0x43a7('0x19')](_0x44fa22)['end']();};}function respondWithResult(_0x32fbe8,_0x4ef432){_0x4ef432=_0x4ef432||0xc8;return function(_0x4a5e38){if(_0x4a5e38){return _0x32fbe8['status'](_0x4ef432)[_0x43a7('0x1a')](_0x4a5e38);}};}function respondWithFilteredResult(_0x194924,_0x2da1b2){return function(_0x3c7871){if(_0x3c7871){var _0x46d039=typeof _0x2da1b2[_0x43a7('0x1b')]===_0x43a7('0x1c')&&typeof _0x2da1b2[_0x43a7('0x1d')]===_0x43a7('0x1c');var _0x28e02e=_0x3c7871[_0x43a7('0x1e')];var _0x56441a=_0x46d039?0x0:_0x2da1b2[_0x43a7('0x1b')];var _0x260e5d=_0x46d039?_0x3c7871[_0x43a7('0x1e')]:_0x2da1b2[_0x43a7('0x1b')]+_0x2da1b2[_0x43a7('0x1d')];var _0x13896b;if(_0x260e5d>=_0x28e02e){_0x260e5d=_0x28e02e;_0x13896b=0xc8;}else{_0x13896b=0xce;}_0x194924[_0x43a7('0x19')](_0x13896b);return _0x194924['set']('Content-Range',_0x56441a+'-'+_0x260e5d+'/'+_0x28e02e)[_0x43a7('0x1a')](_0x3c7871);}return null;};}function patchUpdates(_0x4c326d){return function(_0x3c1eff){try{jsonpatch[_0x43a7('0x1f')](_0x3c1eff,_0x4c326d,!![]);}catch(_0x50b577){return BPromise[_0x43a7('0x20')](_0x50b577);}return _0x3c1eff[_0x43a7('0x21')]();};}function saveUpdates(_0x40a263,_0x59f517){return function(_0x481667){if(_0x481667){return _0x481667['update'](_0x40a263)[_0x43a7('0x22')](function(_0x3d8c6e){return _0x3d8c6e;});}return null;};}function removeEntity(_0xdc6ab4,_0x4cc402){return function(_0x773acf){if(_0x773acf){return _0x773acf[_0x43a7('0x23')]()[_0x43a7('0x22')](function(){_0xdc6ab4[_0x43a7('0x19')](0xcc)[_0x43a7('0x24')]();});}};}function handleEntityNotFound(_0x486975,_0x185326){return function(_0x3bc73d){if(!_0x3bc73d){_0x486975['sendStatus'](0x194);}return _0x3bc73d;};}function handleError(_0x3b561d,_0x3c98bc){_0x3c98bc=_0x3c98bc||0x1f4;return function(_0x176cfc){logger[_0x43a7('0x25')](_0x176cfc[_0x43a7('0x26')]);if(_0x176cfc['name']){delete _0x176cfc['name'];}_0x3b561d[_0x43a7('0x19')](_0x3c98bc)['send'](_0x176cfc);};}exports['index']=function(_0x1deddd,_0xbb56f2){var _0x41047e={},_0x68310={},_0x1379af={'count':0x0,'rows':[]};var _0x51d69e=_['map'](db[_0x43a7('0x27')][_0x43a7('0x28')],function(_0x1de5ac){return{'name':_0x1de5ac[_0x43a7('0x29')],'type':_0x1de5ac[_0x43a7('0x2a')][_0x43a7('0x2b')]};});_0x68310[_0x43a7('0x2c')]=_['map'](_0x51d69e,'name');_0x68310[_0x43a7('0x2d')]=_['keys'](_0x1deddd['query']);_0x68310[_0x43a7('0x2e')]=_[_0x43a7('0x2f')](_0x68310['model'],_0x68310['query']);_0x41047e['attributes']=_[_0x43a7('0x2f')](_0x68310[_0x43a7('0x2c')],qs['fields'](_0x1deddd[_0x43a7('0x2d')]['fields']));_0x41047e[_0x43a7('0x30')]=_0x41047e[_0x43a7('0x30')][_0x43a7('0x31')]?_0x41047e['attributes']:_0x68310[_0x43a7('0x2c')];if(!_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x32')](_0x43a7('0x33'))){_0x41047e[_0x43a7('0x1d')]=qs[_0x43a7('0x1d')](_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x1d')]);_0x41047e[_0x43a7('0x1b')]=qs[_0x43a7('0x1b')](_0x1deddd['query'][_0x43a7('0x1b')]);}_0x41047e[_0x43a7('0x34')]=qs[_0x43a7('0x35')](_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x35')]);_0x41047e[_0x43a7('0x36')]=qs['filters'](_['pick'](_0x1deddd[_0x43a7('0x2d')],_0x68310[_0x43a7('0x2e')]),_0x51d69e);if(_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x37')]){_0x41047e[_0x43a7('0x36')]=_[_0x43a7('0x38')](_0x41047e[_0x43a7('0x36')],{'$or':_[_0x43a7('0x39')](_0x51d69e,function(_0x47e8d2){if(_0x47e8d2[_0x43a7('0x2a')]!==_0x43a7('0x3a')){var _0x29c997={};_0x29c997[_0x47e8d2[_0x43a7('0x3b')]]={'$like':'%'+_0x1deddd[_0x43a7('0x2d')]['filter']+'%'};return _0x29c997;}})});}_0x41047e=_['merge']({},_0x41047e,_0x1deddd[_0x43a7('0x3c')]);var _0xc4445d={'where':_0x41047e[_0x43a7('0x36')]};return db[_0x43a7('0x27')]['count'](_0xc4445d)['then'](function(_0x4cb7bd){_0x1379af[_0x43a7('0x1e')]=_0x4cb7bd;if(_0x1deddd[_0x43a7('0x2d')][_0x43a7('0x3d')]){_0x41047e[_0x43a7('0x3e')]=[{'all':!![]}];}return db[_0x43a7('0x27')][_0x43a7('0x3f')](_0x41047e);})['then'](function(_0x952b8f){_0x1379af['rows']=_0x952b8f;return _0x1379af;})[_0x43a7('0x22')](respondWithFilteredResult(_0xbb56f2,_0x41047e))['catch'](handleError(_0xbb56f2,null));};exports[_0x43a7('0x40')]=function(_0x4628c1,_0x3ac1f6){var _0x564550={'raw':!![],'where':{'id':_0x4628c1[_0x43a7('0x41')]['id']}},_0x2a321e={};_0x2a321e[_0x43a7('0x2c')]=_[_0x43a7('0x42')](db['VtigerField'][_0x43a7('0x28')]);_0x2a321e[_0x43a7('0x2d')]=_[_0x43a7('0x42')](_0x4628c1[_0x43a7('0x2d')]);_0x2a321e['filters']=_[_0x43a7('0x2f')](_0x2a321e[_0x43a7('0x2c')],_0x2a321e[_0x43a7('0x2d')]);_0x564550[_0x43a7('0x30')]=_[_0x43a7('0x2f')](_0x2a321e['model'],qs[_0x43a7('0x43')](_0x4628c1[_0x43a7('0x2d')][_0x43a7('0x43')]));_0x564550['attributes']=_0x564550['attributes'][_0x43a7('0x31')]?_0x564550[_0x43a7('0x30')]:_0x2a321e['model'];if(_0x4628c1[_0x43a7('0x2d')][_0x43a7('0x3d')]){_0x564550[_0x43a7('0x3e')]=[{'all':!![]}];}_0x564550=_[_0x43a7('0x38')]({},_0x564550,_0x4628c1['options']);return db['VtigerField'][_0x43a7('0x44')](_0x564550)[_0x43a7('0x22')](handleEntityNotFound(_0x3ac1f6,null))[_0x43a7('0x22')](respondWithResult(_0x3ac1f6,null))[_0x43a7('0x45')](handleError(_0x3ac1f6,null));};exports[_0x43a7('0x46')]=function(_0x51810f,_0x26791c){return db['VtigerField'][_0x43a7('0x46')](_0x51810f[_0x43a7('0x47')],{})[_0x43a7('0x22')](respondWithResult(_0x26791c,0xc9))[_0x43a7('0x45')](handleError(_0x26791c,null));};exports[_0x43a7('0x48')]=function(_0x551ece,_0x52a890){if(_0x551ece[_0x43a7('0x47')]['id']){delete _0x551ece[_0x43a7('0x47')]['id'];}return db['VtigerField'][_0x43a7('0x44')]({'where':{'id':_0x551ece[_0x43a7('0x41')]['id']}})['then'](handleEntityNotFound(_0x52a890,null))['then'](saveUpdates(_0x551ece[_0x43a7('0x47')],null))[_0x43a7('0x22')](respondWithResult(_0x52a890,null))[_0x43a7('0x45')](handleError(_0x52a890,null));};exports[_0x43a7('0x23')]=function(_0x2825ea,_0x2ff05c){return db['VtigerField'][_0x43a7('0x44')]({'where':{'id':_0x2825ea[_0x43a7('0x41')]['id']}})[_0x43a7('0x22')](handleEntityNotFound(_0x2ff05c,null))[_0x43a7('0x22')](removeEntity(_0x2ff05c,null))[_0x43a7('0x45')](handleError(_0x2ff05c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9256062..7042d73 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 _0x947c=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x947c,0x13a));var _0xc947=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x947c[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0xc947('0x0'));var util=require(_0xc947('0x1'));var logger=require(_0xc947('0x2'))(_0xc947('0x3'));var moment=require('moment');var BPromise=require(_0xc947('0x4'));var rp=require(_0xc947('0x5'));var fs=require('fs');var path=require(_0xc947('0x6'));var rimraf=require(_0xc947('0x7'));var config=require(_0xc947('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xc947('0x9')]=function(_0x2b1801,_0x5d921d){return _0x2b1801[_0xc947('0xa')](_0xc947('0xb'),attributes,{'tableName':_0xc947('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xc947('0xd'),_0xc947('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d85=['../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x3d85,0xd9));var _0x53d8=function(_0x1b7970,_0x442feb){_0x1b7970=_0x1b7970-0x0;var _0x4926df=_0x3d85[_0x1b7970];return _0x4926df;};'use strict';var _=require(_0x53d8('0x0'));var util=require(_0x53d8('0x1'));var logger=require(_0x53d8('0x2'))(_0x53d8('0x3'));var moment=require(_0x53d8('0x4'));var BPromise=require('bluebird');var rp=require(_0x53d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53d8('0x6'));var config=require(_0x53d8('0x7'));var attributes=require(_0x53d8('0x8'));module[_0x53d8('0x9')]=function(_0x94d5d,_0x3d0111){return _0x94d5d[_0x53d8('0xa')](_0x53d8('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x53d8('0xc'),'fields':['idField',_0x53d8('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 7d1d102..9e1f615 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 _0x3094=['result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x3094,0x86));var _0x4309=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3094[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x4309('0x0'));var moment=require(_0x4309('0x1'));var BPromise=require(_0x4309('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4309('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4309('0x4'));var logger=require(_0x4309('0x5'))(_0x4309('0x6'));var config=require('../../config/environment');var jayson=require(_0x4309('0x7'));var client=jayson[_0x4309('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3567d1,_0x40c048,_0x3b143f){return new BPromise(function(_0x5a19f6,_0x1826d2){return client[_0x4309('0x9')](_0x3567d1,_0x3b143f)[_0x4309('0xa')](function(_0x330e9f){logger[_0x4309('0xb')](_0x4309('0xc'),_0x40c048,_0x4309('0xd'));logger[_0x4309('0xe')](_0x4309('0xf'),_0x40c048,_0x4309('0xd'),JSON[_0x4309('0x10')](_0x330e9f));if(_0x330e9f[_0x4309('0x11')]){if(_0x330e9f[_0x4309('0x11')][_0x4309('0x12')]===0x1f4){logger[_0x4309('0x11')](_0x4309('0xc'),_0x40c048,_0x330e9f['error'][_0x4309('0x13')]);return _0x1826d2(_0x330e9f['error'][_0x4309('0x13')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x40c048,_0x330e9f[_0x4309('0x11')][_0x4309('0x13')]);return _0x5a19f6(_0x330e9f[_0x4309('0x11')][_0x4309('0x13')]);}else{logger[_0x4309('0xb')](_0x4309('0xc'),_0x40c048,'request\x20sent');_0x5a19f6(_0x330e9f[_0x4309('0x14')][_0x4309('0x13')]);}})[_0x4309('0x15')](function(_0x1f4588){logger[_0x4309('0x11')]('VtigerField,\x20%s,\x20%s',_0x40c048,_0x1f4588);_0x1826d2(_0x1f4588);});});} \ No newline at end of file +var _0x1689=['rpc','../../config/environment','jayson/promise','client','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','moment','bluebird','randomstring','../../config/logger'];(function(_0x2e08ee,_0x1ca023){var _0x2c32b1=function(_0x35546f){while(--_0x35546f){_0x2e08ee['push'](_0x2e08ee['shift']());}};_0x2c32b1(++_0x1ca023);}(_0x1689,0x19a));var _0x9168=function(_0x2b5e59,_0x786083){_0x2b5e59=_0x2b5e59-0x0;var _0x319549=_0x1689[_0x2b5e59];return _0x319549;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9168('0x0'));var BPromise=require(_0x9168('0x1'));var rs=require(_0x9168('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9168('0x3'))(_0x9168('0x4'));var config=require(_0x9168('0x5'));var jayson=require(_0x9168('0x6'));var client=jayson[_0x9168('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4880a7,_0x2c1ffc,_0x1bcd5){return new BPromise(function(_0x4c6b38,_0xa9a56a){return client[_0x9168('0x8')](_0x4880a7,_0x1bcd5)['then'](function(_0x50ec6f){logger['info'](_0x9168('0x9'),_0x2c1ffc,_0x9168('0xa'));logger[_0x9168('0xb')](_0x9168('0xc'),_0x2c1ffc,_0x9168('0xa'),JSON[_0x9168('0xd')](_0x50ec6f));if(_0x50ec6f[_0x9168('0xe')]){if(_0x50ec6f[_0x9168('0xe')][_0x9168('0xf')]===0x1f4){logger['error'](_0x9168('0x9'),_0x2c1ffc,_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);return _0xa9a56a(_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);}logger[_0x9168('0xe')](_0x9168('0x9'),_0x2c1ffc,_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);return _0x4c6b38(_0x50ec6f[_0x9168('0xe')][_0x9168('0x10')]);}else{logger[_0x9168('0x11')](_0x9168('0x9'),_0x2c1ffc,_0x9168('0xa'));_0x4c6b38(_0x50ec6f['result'][_0x9168('0x10')]);}})['catch'](function(_0x479fa8){logger[_0x9168('0xe')]('VtigerField,\x20%s,\x20%s',_0x2c1ffc,_0x479fa8);_0xa9a56a(_0x479fa8);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 153f7ad..e2b9491 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 _0xa498=['getConfigurations','getFields','post','create','addConfiguration','update','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/configurations','isAuthenticated'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xa498,0x1d6));var _0x8a49=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xa498[_0x5db657];return _0x2d6e70;};'use strict';var multer=require('multer');var util=require(_0x8a49('0x0'));var path=require(_0x8a49('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8a49('0x2')]();var fs_extra=require(_0x8a49('0x3'));var auth=require(_0x8a49('0x4'));var interaction=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x8a49('0x7')]('/',auth['isAuthenticated'](),controller[_0x8a49('0x8')]);router[_0x8a49('0x7')](_0x8a49('0x9'),auth['isAuthenticated'](),controller[_0x8a49('0xa')]);router[_0x8a49('0x7')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),controller[_0x8a49('0xd')]);router[_0x8a49('0x7')]('/:id/fields',auth[_0x8a49('0xc')](),controller[_0x8a49('0xe')]);router[_0x8a49('0xf')]('/',auth[_0x8a49('0xc')](),controller[_0x8a49('0x10')]);router[_0x8a49('0xf')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x11')]);router['put'](_0x8a49('0x9'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x12')]);router['delete'](_0x8a49('0x9'),auth['isAuthenticated'](),controller[_0x8a49('0x13')]);module[_0x8a49('0x14')]=router; \ No newline at end of file +var _0xdc39=['../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','post','create','put','/:id','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x51937d,_0x45b3c7){var _0x4e1c07=function(_0x4b5990){while(--_0x4b5990){_0x51937d['push'](_0x51937d['shift']());}};_0x4e1c07(++_0x45b3c7);}(_0xdc39,0x12b));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9dc3('0x0'));var path=require('path');var timeout=require(_0x9dc3('0x1'));var express=require('express');var router=express[_0x9dc3('0x2')]();var fs_extra=require(_0x9dc3('0x3'));var auth=require(_0x9dc3('0x4'));var interaction=require(_0x9dc3('0x5'));var config=require('../../config/environment');var controller=require(_0x9dc3('0x6'));router['get']('/',auth[_0x9dc3('0x7')](),controller[_0x9dc3('0x8')]);router[_0x9dc3('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9dc3('0x9')]('/:id/configurations',auth[_0x9dc3('0x7')](),controller[_0x9dc3('0xa')]);router[_0x9dc3('0x9')](_0x9dc3('0xb'),auth[_0x9dc3('0x7')](),controller[_0x9dc3('0xc')]);router[_0x9dc3('0xd')]('/',auth['isAuthenticated'](),controller[_0x9dc3('0xe')]);router['post']('/:id/configurations',auth[_0x9dc3('0x7')](),controller['addConfiguration']);router[_0x9dc3('0xf')](_0x9dc3('0x10'),auth[_0x9dc3('0x7')](),controller['update']);router[_0x9dc3('0x11')](_0x9dc3('0x10'),auth[_0x9dc3('0x7')](),controller[_0x9dc3('0x12')]);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 3443dfe..f4bdee4 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 _0xf96b=['ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x31c3be,_0x5e540f){var _0x48314d=function(_0x65134b){while(--_0x65134b){_0x31c3be['push'](_0x31c3be['shift']());}};_0x48314d(++_0x5e540f);}(_0xf96b,0x109));var _0xbf96=function(_0x2b1987,_0xba86e6){_0x2b1987=_0x2b1987-0x0;var _0x44edb4=_0xf96b[_0x2b1987];return _0x44edb4;};'use strict';var Sequelize=require(_0xbf96('0x0'));module[_0xbf96('0x1')]={'name':{'type':Sequelize[_0xbf96('0x2')]},'description':{'type':Sequelize[_0xbf96('0x2')]},'username':{'type':Sequelize[_0xbf96('0x2')],'unique':_0xbf96('0x3')},'password':{'type':Sequelize[_0xbf96('0x2')]},'token':{'type':Sequelize[_0xbf96('0x2')]},'remoteUri':{'type':Sequelize[_0xbf96('0x2')],'unique':_0xbf96('0x4')},'authType':{'type':Sequelize[_0xbf96('0x5')](_0xbf96('0x6'),_0xbf96('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xbf96('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbf96('0x5')](_0xbf96('0x8'),_0xbf96('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4819=['remoteUri','ENUM','token','integrationTab','newTab','exports','STRING','username'];(function(_0x162081,_0x2b07fa){var _0x3e8bc2=function(_0x3ce576){while(--_0x3ce576){_0x162081['push'](_0x162081['shift']());}};_0x3e8bc2(++_0x2b07fa);}(_0x4819,0xcd));var _0x9481=function(_0x3a9d77,_0xdc466){_0x3a9d77=_0x3a9d77-0x0;var _0x130f80=_0x4819[_0x3a9d77];return _0x130f80;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')]},'description':{'type':Sequelize[_0x9481('0x1')]},'username':{'type':Sequelize[_0x9481('0x1')],'unique':_0x9481('0x2')},'password':{'type':Sequelize[_0x9481('0x1')]},'token':{'type':Sequelize[_0x9481('0x1')]},'remoteUri':{'type':Sequelize[_0x9481('0x1')],'unique':_0x9481('0x3')},'authType':{'type':Sequelize[_0x9481('0x4')]('password',_0x9481('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9481('0x4')](_0x9481('0x6'),_0x9481('0x7')),'defaultValue':_0x9481('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9919d3e..ed6001f 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 _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xd87e,0x1bf));var _0xed87=function(_0x32c48c,_0x5d669e){_0x32c48c=_0x32c48c-0x0;var _0x133729=_0xd87e[_0x32c48c];return _0x133729;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file +var _0x0abf=['eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x54c984,_0x5052e3){var _0x4c8d1c=function(_0x54828e){while(--_0x54828e){_0x54c984['push'](_0x54c984['shift']());}};_0x4c8d1c(++_0x5052e3);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];var integrations=require(_0xf0ab('0x17'));function respondWithStatusCode(_0x34ccdc,_0x4fdd5f){_0x4fdd5f=_0x4fdd5f||0xcc;return function(_0x39b4e7){if(_0x39b4e7){return _0x34ccdc[_0xf0ab('0x18')](_0x4fdd5f);}return _0x34ccdc[_0xf0ab('0x19')](_0x4fdd5f)[_0xf0ab('0x1a')]();};}function respondWithResult(_0x1824ef,_0x36cabe){_0x36cabe=_0x36cabe||0xc8;return function(_0x3d7129){if(_0x3d7129){return _0x1824ef[_0xf0ab('0x19')](_0x36cabe)[_0xf0ab('0x1b')](_0x3d7129);}};}function respondWithFilteredResult(_0x3c5bfd,_0x20f453){return function(_0x221bac){if(_0x221bac){var _0x200cf5=typeof _0x20f453[_0xf0ab('0x1c')]===_0xf0ab('0x1d')&&typeof _0x20f453['limit']===_0xf0ab('0x1d');var _0x9e3b47=_0x221bac[_0xf0ab('0x1e')];var _0x1ffeb5=_0x200cf5?0x0:_0x20f453[_0xf0ab('0x1c')];var _0xb9a33=_0x200cf5?_0x221bac[_0xf0ab('0x1e')]:_0x20f453[_0xf0ab('0x1c')]+_0x20f453[_0xf0ab('0x1f')];var _0x1874a5;if(_0xb9a33>=_0x9e3b47){_0xb9a33=_0x9e3b47;_0x1874a5=0xc8;}else{_0x1874a5=0xce;}_0x3c5bfd[_0xf0ab('0x19')](_0x1874a5);return _0x3c5bfd[_0xf0ab('0x20')](_0xf0ab('0x21'),_0x1ffeb5+'-'+_0xb9a33+'/'+_0x9e3b47)[_0xf0ab('0x1b')](_0x221bac);}return null;};}function patchUpdates(_0x2cd961){return function(_0x45c1c9){try{jsonpatch['apply'](_0x45c1c9,_0x2cd961,!![]);}catch(_0x153492){return BPromise[_0xf0ab('0x22')](_0x153492);}return _0x45c1c9[_0xf0ab('0x23')]();};}function saveUpdates(_0x11ab3a,_0x3bf6a1){return function(_0x374531){if(_0x374531){return _0x374531[_0xf0ab('0x24')](_0x11ab3a)[_0xf0ab('0x25')](function(_0x36ad01){return _0x36ad01;});}return null;};}function removeEntity(_0x18bb37,_0x43119f){return function(_0x5645b2){if(_0x5645b2){return _0x5645b2['destroy']()['then'](function(){_0x18bb37[_0xf0ab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eca32,_0x16b979){return function(_0x51ac90){if(!_0x51ac90){_0x3eca32[_0xf0ab('0x18')](0x194);}return _0x51ac90;};}function handleError(_0x22671e,_0x10bf5f){_0x10bf5f=_0x10bf5f||0x1f4;return function(_0x38fb71){logger[_0xf0ab('0x26')](_0x38fb71['stack']);if(_0x38fb71[_0xf0ab('0x27')]){delete _0x38fb71['name'];}_0x22671e['status'](_0x10bf5f)[_0xf0ab('0x28')](_0x38fb71);};}exports[_0xf0ab('0x29')]=function(_0x1b223d,_0x445160){var _0x43476c={},_0x174052={},_0x367302={'count':0x0,'rows':[]};var _0x14da9c=_[_0xf0ab('0x2a')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')],function(_0x199753){return{'name':_0x199753['fieldName'],'type':_0x199753[_0xf0ab('0x2d')][_0xf0ab('0x2e')]};});_0x174052['model']=_['map'](_0x14da9c,_0xf0ab('0x27'));_0x174052[_0xf0ab('0x2f')]=_[_0xf0ab('0x30')](_0x1b223d['query']);_0x174052['filters']=_[_0xf0ab('0x31')](_0x174052['model'],_0x174052[_0xf0ab('0x2f')]);_0x43476c['attributes']=_[_0xf0ab('0x31')](_0x174052[_0xf0ab('0x32')],qs['fields'](_0x1b223d['query'][_0xf0ab('0x33')]));_0x43476c[_0xf0ab('0x34')]=_0x43476c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x43476c[_0xf0ab('0x34')]:_0x174052[_0xf0ab('0x32')];if(!_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x43476c[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1f')]);_0x43476c[_0xf0ab('0x1c')]=qs['offset'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1c')]);}_0x43476c[_0xf0ab('0x38')]=qs['sort'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x43476c[_0xf0ab('0x3a')]=qs['filters'](_[_0xf0ab('0x3b')](_0x1b223d['query'],_0x174052[_0xf0ab('0x3c')]),_0x14da9c);if(_0x1b223d['query'][_0xf0ab('0x3d')]){_0x43476c[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x43476c[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x14da9c,function(_0x1dfb2e){if(_0x1dfb2e['type']!==_0xf0ab('0x3f')){var _0x683d08={};_0x683d08[_0x1dfb2e['name']]={'$like':'%'+_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x683d08;}})});}_0x43476c=_[_0xf0ab('0x3e')]({},_0x43476c,_0x1b223d[_0xf0ab('0x40')]);var _0x31fa72={'where':_0x43476c[_0xf0ab('0x3a')]};return db[_0xf0ab('0x2b')]['count'](_0x31fa72)[_0xf0ab('0x25')](function(_0x4f6e93){_0x367302[_0xf0ab('0x1e')]=_0x4f6e93;if(_0x1b223d['query'][_0xf0ab('0x41')]){_0x43476c[_0xf0ab('0x42')]=[{'all':!![]}];}return db[_0xf0ab('0x2b')][_0xf0ab('0x43')](_0x43476c);})[_0xf0ab('0x25')](function(_0x553d07){_0x367302[_0xf0ab('0x44')]=_0x553d07;return _0x367302;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x445160,_0x43476c))[_0xf0ab('0x45')](handleError(_0x445160,null));};exports[_0xf0ab('0x46')]=function(_0x191caf,_0x17a73){var _0x45849c={'raw':![],'where':{'id':_0x191caf[_0xf0ab('0x47')]['id']}},_0x413f5c={};_0x413f5c[_0xf0ab('0x32')]=_[_0xf0ab('0x30')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')]);_0x413f5c['query']=_['keys'](_0x191caf[_0xf0ab('0x2f')]);_0x413f5c['filters']=_[_0xf0ab('0x31')](_0x413f5c[_0xf0ab('0x32')],_0x413f5c['query']);_0x45849c[_0xf0ab('0x34')]=_[_0xf0ab('0x31')](_0x413f5c['model'],qs[_0xf0ab('0x33')](_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x45849c[_0xf0ab('0x34')]=_0x45849c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x45849c[_0xf0ab('0x34')]:_0x413f5c[_0xf0ab('0x32')];if(_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x41')]){_0x45849c[_0xf0ab('0x42')]=[{'all':!![]}];}_0x45849c=_[_0xf0ab('0x3e')]({},_0x45849c,_0x191caf[_0xf0ab('0x40')]);return db[_0xf0ab('0x2b')]['find'](_0x45849c)['then'](handleEntityNotFound(_0x17a73,null))[_0xf0ab('0x25')](respondWithResult(_0x17a73,null))['catch'](handleError(_0x17a73,null));};exports['create']=function(_0x4e57d3,_0xc3b68d){return db[_0xf0ab('0x2b')][_0xf0ab('0x48')](_0x4e57d3[_0xf0ab('0x49')],{})[_0xf0ab('0x25')](respondWithResult(_0xc3b68d,0xc9))[_0xf0ab('0x45')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x24')]=function(_0x1a0f21,_0xc6862b){if(_0x1a0f21[_0xf0ab('0x49')]['id']){delete _0x1a0f21[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')]['find']({'where':{'id':_0x1a0f21[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0xc6862b,null))[_0xf0ab('0x25')](saveUpdates(_0x1a0f21[_0xf0ab('0x49')],null))[_0xf0ab('0x25')](respondWithResult(_0xc6862b,null))[_0xf0ab('0x45')](handleError(_0xc6862b,null));};exports[_0xf0ab('0x4a')]=function(_0x2e6c5e,_0x47f564){return db['ZendeskAccount']['find']({'where':{'id':_0x2e6c5e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x47f564,null))['then'](removeEntity(_0x47f564,null))[_0xf0ab('0x45')](handleError(_0x47f564,null));};exports[_0xf0ab('0x4b')]=function(_0x4edb01,_0x1a9981,_0x53d6a4){var _0x1352ac={};var _0xe4ef6d={};var _0x187389;var _0x33112b;return db[_0xf0ab('0x2b')]['findOne']({'where':{'id':_0x4edb01[_0xf0ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a9981,null))[_0xf0ab('0x25')](function(_0x4c9d2b){if(_0x4c9d2b){_0x187389=_0x4c9d2b;_0xe4ef6d[_0xf0ab('0x32')]=_['keys'](db['ZendeskConfiguration'][_0xf0ab('0x2c')]);_0xe4ef6d['query']=_[_0xf0ab('0x30')](_0x4edb01['query']);_0xe4ef6d[_0xf0ab('0x3c')]=_['intersection'](_0xe4ef6d[_0xf0ab('0x32')],_0xe4ef6d[_0xf0ab('0x2f')]);_0x1352ac[_0xf0ab('0x34')]=_['intersection'](_0xe4ef6d['model'],qs['fields'](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x1352ac['attributes']=_0x1352ac['attributes'][_0xf0ab('0x35')]?_0x1352ac[_0xf0ab('0x34')]:_0xe4ef6d[_0xf0ab('0x32')];_0x1352ac[_0xf0ab('0x38')]=qs[_0xf0ab('0x39')](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x1352ac[_0xf0ab('0x3a')]=qs[_0xf0ab('0x3c')](_[_0xf0ab('0x3b')](_0x4edb01[_0xf0ab('0x2f')],_0xe4ef6d['filters']));if(_0x4edb01[_0xf0ab('0x2f')]['filter']){_0x1352ac[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x1352ac[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x1352ac[_0xf0ab('0x34')],function(_0x3c168f){var _0x152e80={};_0x152e80[_0x3c168f]={'$like':'%'+_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x152e80;})});}_0x1352ac=_[_0xf0ab('0x3e')]({},_0x1352ac,_0x4edb01['options']);return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0x4062b7){if(_0x4062b7){_0x33112b=_0x4062b7[_0xf0ab('0x35')];if(!_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x1352ac[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x4edb01['query']['limit']);_0x1352ac[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x4edb01[_0xf0ab('0x2f')]['offset']);}return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0xd61dcf){if(_0xd61dcf){return _0xd61dcf?{'count':_0x33112b,'rows':_0xd61dcf}:null;}})['then'](respondWithResult(_0x1a9981,null))[_0xf0ab('0x45')](handleError(_0x1a9981,null));};exports[_0xf0ab('0x4c')]=function(_0x3fc57e,_0x3d333f,_0x23f4f8){if(_0x3fc57e['body']['id']){delete _0x3fc57e[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')][_0xf0ab('0x4d')]({'where':{'id':_0x3fc57e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x3d333f,null))[_0xf0ab('0x25')](function(_0xe3fc19){if(_0xe3fc19){_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4e')]=_0xe3fc19['id'];_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4f')]=integrations[_0xf0ab('0x50')](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e['body'][_0xf0ab('0x2d')]);_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x51')]=integrations['getDescriptions'](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x2d')]);return db[_0xf0ab('0x52')]['create'](_0x3fc57e[_0xf0ab('0x49')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0xf0ab('0x53')],'as':_0xf0ab('0x51')}]});}return null;})[_0xf0ab('0x25')](respondWithResult(_0x3d333f,null))['catch'](handleError(_0x3d333f,null));};exports[_0xf0ab('0x54')]=function(_0x92ade0,_0x1035b3,_0x122c41){var _0x5b6923='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x92ade0[_0xf0ab('0x47')]['id']},'attributes':['id',_0xf0ab('0x55'),_0xf0ab('0x56'),_0xf0ab('0x57'),_0xf0ab('0x58'),_0xf0ab('0x59')]})[_0xf0ab('0x25')](handleEntityNotFound(_0x1035b3,null))[_0xf0ab('0x25')](function(_0x3119d1){if(_0x3119d1){_0x5b6923=_0x3119d1[_0xf0ab('0x59')];var _0x228334=_0x5b6923['slice'](-0x1);if(_0x228334==='/'){_0x5b6923=_0x5b6923[_0xf0ab('0x5a')](0x0,_0x5b6923[_0xf0ab('0x5b')](_0x228334));}var _0x24e4f5={'method':_0xf0ab('0x5c'),'uri':util[_0xf0ab('0x5d')](_0xf0ab('0x5e'),_0x5b6923,_0xf0ab('0x5f')),'json':!![]};switch(_0x3119d1[_0xf0ab('0x58')]){case'password':_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util[_0xf0ab('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x3119d1[_0xf0ab('0x55')],_0x3119d1[_0xf0ab('0x56')]))[_0xf0ab('0x61')](_0xf0ab('0x62')))};break;case _0xf0ab('0x57'):_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util['format'](_0xf0ab('0x63'),new Buffer(util['format'](_0xf0ab('0x64'),_0x3119d1['username'],_0x3119d1[_0xf0ab('0x57')]))['toString'](_0xf0ab('0x62')))};break;default:throw new db['Sequelize']['ValidationError'](_0xf0ab('0x65'));}return rp(_0x24e4f5);}})[_0xf0ab('0x25')](function(_0x1f37a2){if(_0x1f37a2){var _0xd96ca8=[_0xf0ab('0x66'),_0xf0ab('0x67'),_0xf0ab('0x68'),_0xf0ab('0x69')];_[_0xf0ab('0x6a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x1650c0){return _0xd96ca8[_0xf0ab('0x6b')](_0x1650c0[_0xf0ab('0x2d')]);});return{'count':_0x1f37a2['ticket_fields'][_0xf0ab('0x35')],'rows':_[_0xf0ab('0x2a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x12acef){return{'id':_0x12acef['id'],'name':_0x12acef[_0xf0ab('0x6c')]>0x7?_0x12acef[_0xf0ab('0x6d')]:_0x12acef[_0xf0ab('0x2d')],'custom':_0x12acef[_0xf0ab('0x6c')]>0x7?!![]:![],'options':_0x12acef[_0xf0ab('0x6e')]?_0x12acef[_0xf0ab('0x6e')]:_0x12acef[_0xf0ab('0x6f')]?_0x12acef[_0xf0ab('0x6f')]:[]};})};}})['then'](respondWithResult(_0x1035b3,null))[_0xf0ab('0x45')](function(_0x1f18cd){var _0x3221ff=_0x92ade0[_0xf0ab('0x2f')]['test']?0x1f4:_0x1f18cd[_0xf0ab('0x70')]||0x1f4;logger[_0xf0ab('0x26')](_0xf0ab('0x71'),_0xf0ab('0x54'),_0x3221ff,JSON[_0xf0ab('0x72')](_0x1f18cd));delete _0x1f18cd['name'];if(_0x3221ff===0x191){_0x3221ff=0x190;}_0x1035b3[_0xf0ab('0x19')](_0x3221ff)[_0xf0ab('0x28')](_0x92ade0['query'][_0xf0ab('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1f18cd[_0xf0ab('0x70')]}:_0x1f18cd);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5f2c683..69c3c93 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 _0x35da=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x35f9fd,_0x161f16){var _0x53a02d=function(_0x163ba9){while(--_0x163ba9){_0x35f9fd['push'](_0x35f9fd['shift']());}};_0x53a02d(++_0x161f16);}(_0x35da,0xfe));var _0xa35d=function(_0x85343b,_0x5ad583){_0x85343b=_0x85343b-0x0;var _0x357fed=_0x35da[_0x85343b];return _0x357fed;};'use strict';var _=require(_0xa35d('0x0'));var util=require('util');var logger=require(_0xa35d('0x1'))(_0xa35d('0x2'));var moment=require(_0xa35d('0x3'));var BPromise=require(_0xa35d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa35d('0x5'));var rimraf=require(_0xa35d('0x6'));var config=require(_0xa35d('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa35d('0x8'));module[_0xa35d('0x9')]=function(_0x6d87fe,_0x2e8ed6){return _0x6d87fe[_0xa35d('0xa')](_0xa35d('0xb'),attributes,{'tableName':_0xa35d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c4=['util','api','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','lodash'];(function(_0x20dd00,_0x1a9b17){var _0x1765dc=function(_0x92666d){while(--_0x92666d){_0x20dd00['push'](_0x20dd00['shift']());}};_0x1765dc(++_0x1a9b17);}(_0x81c4,0xe5));var _0x481c=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x81c4[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x481c('0x0'));var util=require(_0x481c('0x1'));var logger=require('../../config/logger')(_0x481c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x481c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x481c('0x4'));var config=require(_0x481c('0x5'));var attributes=require(_0x481c('0x6'));var integrations=require(_0x481c('0x7'));module['exports']=function(_0x6e4139,_0x1f27b2){return _0x6e4139[_0x481c('0x8')]('ZendeskAccount',attributes,{'tableName':_0x481c('0x9'),'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 7708ead..2f6f858 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 _0x2d39=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','ZendeskAccount,\x20%s,\x20%s'];(function(_0x1f3d55,_0x3d88e0){var _0x8aec4c=function(_0x4fd397){while(--_0x4fd397){_0x1f3d55['push'](_0x1f3d55['shift']());}};_0x8aec4c(++_0x3d88e0);}(_0x2d39,0x11e));var _0x92d3=function(_0xef27f0,_0x3448cc){_0xef27f0=_0xef27f0-0x0;var _0x4eb1b0=_0x2d39[_0xef27f0];return _0x4eb1b0;};'use strict';var _=require(_0x92d3('0x0'));var util=require('util');var moment=require(_0x92d3('0x1'));var BPromise=require(_0x92d3('0x2'));var rs=require(_0x92d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d3('0x4'))['db'];var utils=require(_0x92d3('0x5'));var logger=require(_0x92d3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x92d3('0x7'));var client=jayson[_0x92d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfaf8,_0x5cd9aa,_0x40c576){return new BPromise(function(_0x286d8d,_0xa63b22){return client['request'](_0x1cfaf8,_0x40c576)[_0x92d3('0x9')](function(_0x58d51d){logger['info'](_0x92d3('0xa'),_0x5cd9aa,_0x92d3('0xb'));logger[_0x92d3('0xc')](_0x92d3('0xd'),_0x5cd9aa,'request\x20sent',JSON[_0x92d3('0xe')](_0x58d51d));if(_0x58d51d['error']){if(_0x58d51d[_0x92d3('0xf')][_0x92d3('0x10')]===0x1f4){logger[_0x92d3('0xf')](_0x92d3('0xa'),_0x5cd9aa,_0x58d51d[_0x92d3('0xf')][_0x92d3('0x11')]);return _0xa63b22(_0x58d51d[_0x92d3('0xf')][_0x92d3('0x11')]);}logger[_0x92d3('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x5cd9aa,_0x58d51d[_0x92d3('0xf')][_0x92d3('0x11')]);return _0x286d8d(_0x58d51d['error'][_0x92d3('0x11')]);}else{logger[_0x92d3('0x12')](_0x92d3('0xa'),_0x5cd9aa,_0x92d3('0xb'));_0x286d8d(_0x58d51d['result'][_0x92d3('0x11')]);}})[_0x92d3('0x13')](function(_0x10e8e5){logger[_0x92d3('0xf')](_0x92d3('0xa'),_0x5cd9aa,_0x10e8e5);_0xa63b22(_0x10e8e5);});});}exports['GetZendeskAccount']=function(_0x550f23){var _0x36a2b7=this;return new Promise(function(_0x5d36a4,_0x33e76f){return db[_0x92d3('0x14')][_0x92d3('0x15')]({'raw':_0x550f23[_0x92d3('0x16')]?_0x550f23[_0x92d3('0x16')][_0x92d3('0x17')]===undefined?!![]:![]:!![],'where':_0x550f23['options']?_0x550f23[_0x92d3('0x16')][_0x92d3('0x18')]||null:null,'attributes':_0x550f23[_0x92d3('0x16')]?_0x550f23[_0x92d3('0x16')][_0x92d3('0x19')]||null:null,'limit':_0x550f23[_0x92d3('0x16')]?_0x550f23['options'][_0x92d3('0x1a')]||null:null,'include':_0x550f23['options']?_0x550f23[_0x92d3('0x16')]['include']?_[_0x92d3('0x1b')](_0x550f23[_0x92d3('0x16')][_0x92d3('0x1c')],function(_0x1a3d2d){return{'model':db[_0x1a3d2d['model']],'as':_0x1a3d2d['as'],'attributes':_0x1a3d2d[_0x92d3('0x19')],'include':_0x1a3d2d[_0x92d3('0x1c')]?_[_0x92d3('0x1b')](_0x1a3d2d['include'],function(_0x467fab){return{'model':db[_0x467fab['model']],'as':_0x467fab['as'],'attributes':_0x467fab[_0x92d3('0x19')],'include':_0x467fab[_0x92d3('0x1c')]?_['map'](_0x467fab[_0x92d3('0x1c')],function(_0x3f28af){return{'model':db[_0x3f28af[_0x92d3('0x1d')]],'as':_0x3f28af['as'],'attributes':_0x3f28af['attributes']};}):[]};}):[]};}):[]:[]})[_0x92d3('0x9')](function(_0xa0cbe9){logger[_0x92d3('0x12')]('GetZendeskAccount',_0x550f23);logger[_0x92d3('0xc')](_0x92d3('0x1e'),_0x550f23,JSON[_0x92d3('0xe')](_0xa0cbe9));_0x5d36a4(_0xa0cbe9);})['catch'](function(_0x2c0297){logger['error'](_0x92d3('0x1e'),_0x2c0297[_0x92d3('0x11')],_0x550f23);_0x33e76f(_0x36a2b7[_0x92d3('0xf')](0x1f4,_0x2c0297[_0x92d3('0x11')]));});});};exports[_0x92d3('0x1f')]=function(_0x5de832){var _0x3a0489=this;return new Promise(function(_0x3dff06,_0x3d1a26){return db[_0x92d3('0x14')][_0x92d3('0x20')]({'raw':_0x5de832[_0x92d3('0x16')]?_0x5de832['options'][_0x92d3('0x17')]===undefined?!![]:![]:!![],'where':_0x5de832[_0x92d3('0x16')]?_0x5de832[_0x92d3('0x16')]['where']||null:null,'attributes':_0x5de832['options']?_0x5de832[_0x92d3('0x16')]['attributes']||null:null,'include':_0x5de832[_0x92d3('0x16')]?_0x5de832[_0x92d3('0x16')][_0x92d3('0x1c')]?_['map'](_0x5de832[_0x92d3('0x16')][_0x92d3('0x1c')],function(_0x3488f8){return{'model':db[_0x3488f8[_0x92d3('0x1d')]],'as':_0x3488f8['as'],'attributes':_0x3488f8[_0x92d3('0x19')],'include':_0x3488f8[_0x92d3('0x1c')]?_[_0x92d3('0x1b')](_0x3488f8[_0x92d3('0x1c')],function(_0x894793){return{'model':db[_0x894793[_0x92d3('0x1d')]],'as':_0x894793['as'],'attributes':_0x894793[_0x92d3('0x19')],'include':_0x894793[_0x92d3('0x1c')]?_[_0x92d3('0x1b')](_0x894793[_0x92d3('0x1c')],function(_0x11a1c8){return{'model':db[_0x11a1c8[_0x92d3('0x1d')]],'as':_0x11a1c8['as'],'attributes':_0x11a1c8['attributes']};}):[]};}):[]};}):[]:[]})[_0x92d3('0x9')](function(_0x4dd976){logger[_0x92d3('0x12')](_0x92d3('0x1f'),_0x5de832);logger[_0x92d3('0xc')]('ShowZendeskAccount',_0x5de832,JSON[_0x92d3('0xe')](_0x4dd976));_0x3dff06(_0x4dd976);})[_0x92d3('0x13')](function(_0x3a521c){logger[_0x92d3('0xf')](_0x92d3('0x1f'),_0x3a521c[_0x92d3('0x11')],_0x5de832);_0x3d1a26(_0x3a0489[_0x92d3('0xf')](0x1f4,_0x3a521c[_0x92d3('0x11')]));});});}; \ No newline at end of file +var _0xd3fd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','catch','ShowZendeskAccount','where','lodash'];(function(_0x2444db,_0x5c124d){var _0x5866ec=function(_0x253529){while(--_0x253529){_0x2444db['push'](_0x2444db['shift']());}};_0x5866ec(++_0x5c124d);}(_0xd3fd,0x1af));var _0xdd3f=function(_0x8aac94,_0x8b5521){_0x8aac94=_0x8aac94-0x0;var _0x5e3100=_0xd3fd[_0x8aac94];return _0x5e3100;};'use strict';var _=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var moment=require(_0xdd3f('0x2'));var BPromise=require(_0xdd3f('0x3'));var rs=require(_0xdd3f('0x4'));var fs=require('fs');var Redis=require(_0xdd3f('0x5'));var db=require(_0xdd3f('0x6'))['db'];var utils=require(_0xdd3f('0x7'));var logger=require(_0xdd3f('0x8'))(_0xdd3f('0x9'));var config=require(_0xdd3f('0xa'));var jayson=require(_0xdd3f('0xb'));var client=jayson[_0xdd3f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b73e,_0x6c850b,_0x47994f){return new BPromise(function(_0x1d9029,_0x5c3e45){return client[_0xdd3f('0xd')](_0x22b73e,_0x47994f)[_0xdd3f('0xe')](function(_0x2dbb3a){logger[_0xdd3f('0xf')](_0xdd3f('0x10'),_0x6c850b,_0xdd3f('0x11'));logger[_0xdd3f('0x12')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x6c850b,_0xdd3f('0x11'),JSON[_0xdd3f('0x13')](_0x2dbb3a));if(_0x2dbb3a[_0xdd3f('0x14')]){if(_0x2dbb3a[_0xdd3f('0x14')][_0xdd3f('0x15')]===0x1f4){logger[_0xdd3f('0x14')](_0xdd3f('0x10'),_0x6c850b,_0x2dbb3a[_0xdd3f('0x14')]['message']);return _0x5c3e45(_0x2dbb3a['error'][_0xdd3f('0x16')]);}logger['error'](_0xdd3f('0x10'),_0x6c850b,_0x2dbb3a[_0xdd3f('0x14')]['message']);return _0x1d9029(_0x2dbb3a[_0xdd3f('0x14')][_0xdd3f('0x16')]);}else{logger[_0xdd3f('0xf')](_0xdd3f('0x10'),_0x6c850b,_0xdd3f('0x11'));_0x1d9029(_0x2dbb3a[_0xdd3f('0x17')][_0xdd3f('0x16')]);}})['catch'](function(_0x3fd9fc){logger[_0xdd3f('0x14')](_0xdd3f('0x10'),_0x6c850b,_0x3fd9fc);_0x5c3e45(_0x3fd9fc);});});}exports[_0xdd3f('0x18')]=function(_0x1672e0){var _0x31ae1d=this;return new Promise(function(_0x3ab7b3,_0x25b500){return db[_0xdd3f('0x19')][_0xdd3f('0x1a')]({'raw':_0x1672e0[_0xdd3f('0x1b')]?_0x1672e0[_0xdd3f('0x1b')][_0xdd3f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1672e0[_0xdd3f('0x1b')]?_0x1672e0[_0xdd3f('0x1b')]['where']||null:null,'attributes':_0x1672e0[_0xdd3f('0x1b')]?_0x1672e0['options'][_0xdd3f('0x1d')]||null:null,'limit':_0x1672e0['options']?_0x1672e0[_0xdd3f('0x1b')]['limit']||null:null,'include':_0x1672e0['options']?_0x1672e0[_0xdd3f('0x1b')][_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x1672e0[_0xdd3f('0x1b')]['include'],function(_0x27635d){return{'model':db[_0x27635d['model']],'as':_0x27635d['as'],'attributes':_0x27635d[_0xdd3f('0x1d')],'include':_0x27635d[_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x27635d[_0xdd3f('0x1e')],function(_0x4244ef){return{'model':db[_0x4244ef[_0xdd3f('0x20')]],'as':_0x4244ef['as'],'attributes':_0x4244ef[_0xdd3f('0x1d')],'include':_0x4244ef['include']?_[_0xdd3f('0x1f')](_0x4244ef[_0xdd3f('0x1e')],function(_0x30f354){return{'model':db[_0x30f354[_0xdd3f('0x20')]],'as':_0x30f354['as'],'attributes':_0x30f354[_0xdd3f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdd3f('0xe')](function(_0x5845cd){logger[_0xdd3f('0xf')](_0xdd3f('0x18'),_0x1672e0);logger['debug'](_0xdd3f('0x18'),_0x1672e0,JSON[_0xdd3f('0x13')](_0x5845cd));_0x3ab7b3(_0x5845cd);})[_0xdd3f('0x21')](function(_0x78d6c3){logger['error'](_0xdd3f('0x18'),_0x78d6c3[_0xdd3f('0x16')],_0x1672e0);_0x25b500(_0x31ae1d[_0xdd3f('0x14')](0x1f4,_0x78d6c3['message']));});});};exports[_0xdd3f('0x22')]=function(_0x35d6d0){var _0xeb84fa=this;return new Promise(function(_0xafdf0a,_0x3e1420){return db[_0xdd3f('0x19')]['find']({'raw':_0x35d6d0['options']?_0x35d6d0[_0xdd3f('0x1b')][_0xdd3f('0x1c')]===undefined?!![]:![]:!![],'where':_0x35d6d0['options']?_0x35d6d0[_0xdd3f('0x1b')][_0xdd3f('0x23')]||null:null,'attributes':_0x35d6d0[_0xdd3f('0x1b')]?_0x35d6d0['options'][_0xdd3f('0x1d')]||null:null,'include':_0x35d6d0[_0xdd3f('0x1b')]?_0x35d6d0[_0xdd3f('0x1b')][_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x35d6d0['options'][_0xdd3f('0x1e')],function(_0x198ca5){return{'model':db[_0x198ca5[_0xdd3f('0x20')]],'as':_0x198ca5['as'],'attributes':_0x198ca5[_0xdd3f('0x1d')],'include':_0x198ca5[_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x198ca5['include'],function(_0x1c24a9){return{'model':db[_0x1c24a9[_0xdd3f('0x20')]],'as':_0x1c24a9['as'],'attributes':_0x1c24a9['attributes'],'include':_0x1c24a9[_0xdd3f('0x1e')]?_[_0xdd3f('0x1f')](_0x1c24a9[_0xdd3f('0x1e')],function(_0x27e92c){return{'model':db[_0x27e92c[_0xdd3f('0x20')]],'as':_0x27e92c['as'],'attributes':_0x27e92c[_0xdd3f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdd3f('0xe')](function(_0x91394f){logger[_0xdd3f('0xf')](_0xdd3f('0x22'),_0x35d6d0);logger[_0xdd3f('0x12')](_0xdd3f('0x22'),_0x35d6d0,JSON[_0xdd3f('0x13')](_0x91394f));_0xafdf0a(_0x91394f);})[_0xdd3f('0x21')](function(_0x27dbee){logger[_0xdd3f('0x14')](_0xdd3f('0x22'),_0x27dbee[_0xdd3f('0x16')],_0x35d6d0);_0x3e1420(_0xeb84fa[_0xdd3f('0x14')](0x1f4,_0x27dbee[_0xdd3f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 087786e..28af658 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 _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file +var _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6a82abf..b66b99a 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 _0x224c=['exports','STRING'];(function(_0x3b07e4,_0x515c22){var _0x5cdbbd=function(_0x1254c5){while(--_0x1254c5){_0x3b07e4['push'](_0x3b07e4['shift']());}};_0x5cdbbd(++_0x515c22);}(_0x224c,0x1de));var _0xc224=function(_0x590d84,_0x39692c){_0x590d84=_0x590d84-0x0;var _0x472cab=_0x224c[_0x590d84];return _0x472cab;};'use strict';var Sequelize=require('sequelize');module[_0xc224('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc224('0x1')]}}; \ No newline at end of file +var _0x4799=['STRING','exports'];(function(_0x231f14,_0x39d936){var _0x2dea61=function(_0x4d845f){while(--_0x4d845f){_0x231f14['push'](_0x231f14['shift']());}};_0x2dea61(++_0x39d936);}(_0x4799,0x187));var _0x9479=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4799[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x9479('0x0')]={'name':{'type':Sequelize[_0x9479('0x1')]},'description':{'type':Sequelize[_0x9479('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3145558..bc84fe1 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 _0x1038=['end','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getFields','keys','ZendeskField','order','nolimit','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy'];(function(_0x510ebe,_0x150efb){var _0x517dce=function(_0x17a685){while(--_0x17a685){_0x510ebe['push'](_0x510ebe['shift']());}};_0x517dce(++_0x150efb);}(_0x1038,0x1e7));var _0x8103=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x1038[_0x72a33d];return _0x2621d5;};'use strict';var emlformat=require(_0x8103('0x0'));var rimraf=require(_0x8103('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8103('0x2'));var rp=require(_0x8103('0x3'));var moment=require('moment');var BPromise=require(_0x8103('0x4'));var Mustache=require(_0x8103('0x5'));var util=require(_0x8103('0x6'));var path=require('path');var sox=require(_0x8103('0x7'));var csv=require(_0x8103('0x8'));var ejs=require(_0x8103('0x9'));var fs=require('fs');var fs_extra=require(_0x8103('0xa'));var _=require(_0x8103('0xb'));var squel=require(_0x8103('0xc'));var crypto=require(_0x8103('0xd'));var jsforce=require(_0x8103('0xe'));var deskjs=require(_0x8103('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8103('0x10'));var Redis=require(_0x8103('0x11'));var authService=require(_0x8103('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8103('0x13'));var hardwareService=require(_0x8103('0x14'));var logger=require(_0x8103('0x15'))(_0x8103('0x16'));var utils=require(_0x8103('0x17'));var config=require(_0x8103('0x18'));var licenseUtil=require(_0x8103('0x19'));var db=require(_0x8103('0x1a'))['db'];function respondWithStatusCode(_0x2c43da,_0x708eb4){_0x708eb4=_0x708eb4||0xcc;return function(_0xb8bbed){if(_0xb8bbed){return _0x2c43da[_0x8103('0x1b')](_0x708eb4);}return _0x2c43da[_0x8103('0x1c')](_0x708eb4)['end']();};}function respondWithResult(_0x14639f,_0x5e0b73){_0x5e0b73=_0x5e0b73||0xc8;return function(_0x48e972){if(_0x48e972){return _0x14639f[_0x8103('0x1c')](_0x5e0b73)[_0x8103('0x1d')](_0x48e972);}};}function respondWithFilteredResult(_0x2f5140,_0x8f4d1d){return function(_0x26b868){if(_0x26b868){var _0x3388c2=typeof _0x8f4d1d['offset']==='undefined'&&typeof _0x8f4d1d['limit']===_0x8103('0x1e');var _0x21003d=_0x26b868[_0x8103('0x1f')];var _0x5aaccf=_0x3388c2?0x0:_0x8f4d1d[_0x8103('0x20')];var _0xab426e=_0x3388c2?_0x26b868[_0x8103('0x1f')]:_0x8f4d1d[_0x8103('0x20')]+_0x8f4d1d[_0x8103('0x21')];var _0x4e7919;if(_0xab426e>=_0x21003d){_0xab426e=_0x21003d;_0x4e7919=0xc8;}else{_0x4e7919=0xce;}_0x2f5140[_0x8103('0x1c')](_0x4e7919);return _0x2f5140[_0x8103('0x22')]('Content-Range',_0x5aaccf+'-'+_0xab426e+'/'+_0x21003d)[_0x8103('0x1d')](_0x26b868);}return null;};}function patchUpdates(_0x166db3){return function(_0x4366d2){try{jsonpatch[_0x8103('0x23')](_0x4366d2,_0x166db3,!![]);}catch(_0x107ac4){return BPromise[_0x8103('0x24')](_0x107ac4);}return _0x4366d2[_0x8103('0x25')]();};}function saveUpdates(_0x146541,_0x3f63d4){return function(_0x118614){if(_0x118614){return _0x118614[_0x8103('0x26')](_0x146541)[_0x8103('0x27')](function(_0x443a39){return _0x443a39;});}return null;};}function removeEntity(_0x268609,_0x5babd0){return function(_0x456689){if(_0x456689){return _0x456689[_0x8103('0x28')]()[_0x8103('0x27')](function(){_0x268609[_0x8103('0x1c')](0xcc)[_0x8103('0x29')]();});}};}function handleEntityNotFound(_0x220ffb,_0x201def){return function(_0x3a5690){if(!_0x3a5690){_0x220ffb[_0x8103('0x1b')](0x194);}return _0x3a5690;};}function handleError(_0x27093a,_0x3a3bca){_0x3a3bca=_0x3a3bca||0x1f4;return function(_0x785d2){logger['error'](_0x785d2[_0x8103('0x2a')]);if(_0x785d2['name']){delete _0x785d2[_0x8103('0x2b')];}_0x27093a[_0x8103('0x1c')](_0x3a3bca)[_0x8103('0x2c')](_0x785d2);};}exports['index']=function(_0x43103c,_0x4a9f56){var _0x3790ea={},_0x41bbda={},_0x43e572={'count':0x0,'rows':[]};var _0x53db67=_[_0x8103('0x2d')](db[_0x8103('0x2e')][_0x8103('0x2f')],function(_0x4f2593){return{'name':_0x4f2593[_0x8103('0x30')],'type':_0x4f2593[_0x8103('0x31')][_0x8103('0x32')]};});_0x41bbda['model']=_[_0x8103('0x2d')](_0x53db67,'name');_0x41bbda['query']=_['keys'](_0x43103c[_0x8103('0x33')]);_0x41bbda[_0x8103('0x34')]=_[_0x8103('0x35')](_0x41bbda['model'],_0x41bbda[_0x8103('0x33')]);_0x3790ea['attributes']=_[_0x8103('0x35')](_0x41bbda[_0x8103('0x36')],qs['fields'](_0x43103c['query'][_0x8103('0x37')]));_0x3790ea[_0x8103('0x38')]=_0x3790ea[_0x8103('0x38')][_0x8103('0x39')]?_0x3790ea[_0x8103('0x38')]:_0x41bbda[_0x8103('0x36')];if(!_0x43103c[_0x8103('0x33')][_0x8103('0x3a')]('nolimit')){_0x3790ea[_0x8103('0x21')]=qs['limit'](_0x43103c[_0x8103('0x33')][_0x8103('0x21')]);_0x3790ea['offset']=qs[_0x8103('0x20')](_0x43103c[_0x8103('0x33')][_0x8103('0x20')]);}_0x3790ea['order']=qs[_0x8103('0x3b')](_0x43103c['query'][_0x8103('0x3b')]);_0x3790ea[_0x8103('0x3c')]=qs['filters'](_[_0x8103('0x3d')](_0x43103c[_0x8103('0x33')],_0x41bbda[_0x8103('0x34')]),_0x53db67);if(_0x43103c['query'][_0x8103('0x3e')]){_0x3790ea[_0x8103('0x3c')]=_[_0x8103('0x3f')](_0x3790ea['where'],{'$or':_[_0x8103('0x2d')](_0x53db67,function(_0x41e085){if(_0x41e085[_0x8103('0x31')]!==_0x8103('0x40')){var _0xb8805a={};_0xb8805a[_0x41e085[_0x8103('0x2b')]]={'$like':'%'+_0x43103c[_0x8103('0x33')][_0x8103('0x3e')]+'%'};return _0xb8805a;}})});}_0x3790ea=_[_0x8103('0x3f')]({},_0x3790ea,_0x43103c['options']);var _0xd47cfa={'where':_0x3790ea[_0x8103('0x3c')]};return db[_0x8103('0x2e')][_0x8103('0x1f')](_0xd47cfa)['then'](function(_0x58e11e){_0x43e572[_0x8103('0x1f')]=_0x58e11e;if(_0x43103c[_0x8103('0x33')][_0x8103('0x41')]){_0x3790ea['include']=[{'all':!![]}];}return db[_0x8103('0x2e')][_0x8103('0x42')](_0x3790ea);})['then'](function(_0x24b69b){_0x43e572[_0x8103('0x43')]=_0x24b69b;return _0x43e572;})['then'](respondWithFilteredResult(_0x4a9f56,_0x3790ea))[_0x8103('0x44')](handleError(_0x4a9f56,null));};exports[_0x8103('0x45')]=function(_0x4fed79,_0x139646){var _0x20e9aa={'raw':![],'where':{'id':_0x4fed79[_0x8103('0x46')]['id']}},_0x251d47={};_0x251d47[_0x8103('0x36')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x251d47[_0x8103('0x33')]=_['keys'](_0x4fed79[_0x8103('0x33')]);_0x251d47[_0x8103('0x34')]=_['intersection'](_0x251d47[_0x8103('0x36')],_0x251d47[_0x8103('0x33')]);_0x20e9aa['attributes']=_[_0x8103('0x35')](_0x251d47[_0x8103('0x36')],qs[_0x8103('0x37')](_0x4fed79[_0x8103('0x33')][_0x8103('0x37')]));_0x20e9aa['attributes']=_0x20e9aa[_0x8103('0x38')][_0x8103('0x39')]?_0x20e9aa[_0x8103('0x38')]:_0x251d47[_0x8103('0x36')];if(_0x4fed79[_0x8103('0x33')][_0x8103('0x41')]){_0x20e9aa[_0x8103('0x47')]=[{'all':!![]}];}_0x20e9aa=_[_0x8103('0x3f')]({},_0x20e9aa,_0x4fed79[_0x8103('0x48')]);return db[_0x8103('0x2e')][_0x8103('0x49')](_0x20e9aa)['then'](handleEntityNotFound(_0x139646,null))[_0x8103('0x27')](respondWithResult(_0x139646,null))[_0x8103('0x44')](handleError(_0x139646,null));};exports['create']=function(_0x535d5e,_0x48ddaa){return db[_0x8103('0x2e')][_0x8103('0x4a')](_0x535d5e['body'],{})['then'](respondWithResult(_0x48ddaa,0xc9))[_0x8103('0x44')](handleError(_0x48ddaa,null));};exports[_0x8103('0x26')]=function(_0x2b231a,_0x46b7df){if(_0x2b231a['body']['id']){delete _0x2b231a[_0x8103('0x4b')]['id'];}return db[_0x8103('0x2e')]['find']({'where':{'id':_0x2b231a[_0x8103('0x46')]['id']}})[_0x8103('0x27')](handleEntityNotFound(_0x46b7df,null))[_0x8103('0x27')](saveUpdates(_0x2b231a['body'],null))[_0x8103('0x27')](respondWithResult(_0x46b7df,null))[_0x8103('0x44')](handleError(_0x46b7df,null));};exports['destroy']=function(_0x54171e,_0x1fbb6e){return db[_0x8103('0x2e')][_0x8103('0x49')]({'where':{'id':_0x54171e['params']['id']}})['then'](handleEntityNotFound(_0x1fbb6e,null))[_0x8103('0x27')](removeEntity(_0x1fbb6e,null))[_0x8103('0x44')](handleError(_0x1fbb6e,null));};exports[_0x8103('0x4c')]=function(_0x4356cd,_0x49df97,_0x2ba56a){var _0x22f405={};var _0x23bbba={};var _0x129925;var _0x24c8e0;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4356cd[_0x8103('0x46')]['id']}})[_0x8103('0x27')](handleEntityNotFound(_0x49df97,null))['then'](function(_0x5d2711){if(_0x5d2711){_0x129925=_0x5d2711;_0x23bbba[_0x8103('0x36')]=_[_0x8103('0x4d')](db[_0x8103('0x4e')]['rawAttributes']);_0x23bbba[_0x8103('0x33')]=_[_0x8103('0x4d')](_0x4356cd['query']);_0x23bbba[_0x8103('0x34')]=_[_0x8103('0x35')](_0x23bbba['model'],_0x23bbba[_0x8103('0x33')]);_0x22f405[_0x8103('0x38')]=_[_0x8103('0x35')](_0x23bbba[_0x8103('0x36')],qs['fields'](_0x4356cd[_0x8103('0x33')][_0x8103('0x37')]));_0x22f405[_0x8103('0x38')]=_0x22f405[_0x8103('0x38')][_0x8103('0x39')]?_0x22f405[_0x8103('0x38')]:_0x23bbba[_0x8103('0x36')];_0x22f405[_0x8103('0x4f')]=qs['sort'](_0x4356cd[_0x8103('0x33')]['sort']);_0x22f405['where']=qs[_0x8103('0x34')](_[_0x8103('0x3d')](_0x4356cd['query'],_0x23bbba[_0x8103('0x34')]));if(_0x4356cd[_0x8103('0x33')][_0x8103('0x3e')]){_0x22f405[_0x8103('0x3c')]=_[_0x8103('0x3f')](_0x22f405['where'],{'$or':_[_0x8103('0x2d')](_0x22f405[_0x8103('0x38')],function(_0x9a5828){var _0x3f027e={};_0x3f027e[_0x9a5828]={'$like':'%'+_0x4356cd[_0x8103('0x33')]['filter']+'%'};return _0x3f027e;})});}_0x22f405=_[_0x8103('0x3f')]({},_0x22f405,_0x4356cd['options']);return _0x129925[_0x8103('0x4c')](_0x22f405);}})[_0x8103('0x27')](function(_0x5a9481){if(_0x5a9481){_0x24c8e0=_0x5a9481[_0x8103('0x39')];if(!_0x4356cd[_0x8103('0x33')]['hasOwnProperty'](_0x8103('0x50'))){_0x22f405[_0x8103('0x21')]=qs[_0x8103('0x21')](_0x4356cd[_0x8103('0x33')][_0x8103('0x21')]);_0x22f405[_0x8103('0x20')]=qs['offset'](_0x4356cd[_0x8103('0x33')][_0x8103('0x20')]);}return _0x129925[_0x8103('0x4c')](_0x22f405);}})[_0x8103('0x27')](function(_0x8e8f82){if(_0x8e8f82){return _0x8e8f82?{'count':_0x24c8e0,'rows':_0x8e8f82}:null;}})['then'](respondWithResult(_0x49df97,null))[_0x8103('0x44')](handleError(_0x49df97,null));};exports[_0x8103('0x51')]=function(_0x4dbae1,_0x20d8e7,_0x6fd6c8){var _0x6c46f5={};var _0x5b8cf5={};var _0x2c71eb;var _0x50a08f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4dbae1[_0x8103('0x46')]['id']}})[_0x8103('0x27')](handleEntityNotFound(_0x20d8e7,null))[_0x8103('0x27')](function(_0x167faa){if(_0x167faa){_0x2c71eb=_0x167faa;_0x5b8cf5['model']=_[_0x8103('0x4d')](db[_0x8103('0x4e')]['rawAttributes']);_0x5b8cf5[_0x8103('0x33')]=_[_0x8103('0x4d')](_0x4dbae1[_0x8103('0x33')]);_0x5b8cf5[_0x8103('0x34')]=_[_0x8103('0x35')](_0x5b8cf5['model'],_0x5b8cf5[_0x8103('0x33')]);_0x6c46f5[_0x8103('0x38')]=_[_0x8103('0x35')](_0x5b8cf5[_0x8103('0x36')],qs[_0x8103('0x37')](_0x4dbae1[_0x8103('0x33')][_0x8103('0x37')]));_0x6c46f5[_0x8103('0x38')]=_0x6c46f5['attributes'][_0x8103('0x39')]?_0x6c46f5[_0x8103('0x38')]:_0x5b8cf5[_0x8103('0x36')];_0x6c46f5[_0x8103('0x4f')]=qs[_0x8103('0x3b')](_0x4dbae1[_0x8103('0x33')][_0x8103('0x3b')]);_0x6c46f5['where']=qs[_0x8103('0x34')](_[_0x8103('0x3d')](_0x4dbae1[_0x8103('0x33')],_0x5b8cf5[_0x8103('0x34')]));if(_0x4dbae1['query'][_0x8103('0x3e')]){_0x6c46f5[_0x8103('0x3c')]=_['merge'](_0x6c46f5[_0x8103('0x3c')],{'$or':_[_0x8103('0x2d')](_0x6c46f5[_0x8103('0x38')],function(_0x2aed4a){var _0x428c1e={};_0x428c1e[_0x2aed4a]={'$like':'%'+_0x4dbae1[_0x8103('0x33')][_0x8103('0x3e')]+'%'};return _0x428c1e;})});}_0x6c46f5=_[_0x8103('0x3f')]({},_0x6c46f5,_0x4dbae1[_0x8103('0x48')]);return _0x2c71eb[_0x8103('0x51')](_0x6c46f5);}})[_0x8103('0x27')](function(_0x48705c){if(_0x48705c){_0x50a08f=_0x48705c[_0x8103('0x39')];if(!_0x4dbae1[_0x8103('0x33')][_0x8103('0x3a')](_0x8103('0x50'))){_0x6c46f5[_0x8103('0x21')]=qs['limit'](_0x4dbae1[_0x8103('0x33')][_0x8103('0x21')]);_0x6c46f5[_0x8103('0x20')]=qs[_0x8103('0x20')](_0x4dbae1[_0x8103('0x33')]['offset']);}return _0x2c71eb[_0x8103('0x51')](_0x6c46f5);}})[_0x8103('0x27')](function(_0x1bd5b0){if(_0x1bd5b0){return _0x1bd5b0?{'count':_0x50a08f,'rows':_0x1bd5b0}:null;}})['then'](respondWithResult(_0x20d8e7,null))[_0x8103('0x44')](handleError(_0x20d8e7,null));};exports[_0x8103('0x52')]=function(_0x5e82a6,_0x433c40,_0x476d2f){var _0x4382bc={};var _0x47d6c4={};var _0x56e4a9;var _0x5dd980;return db[_0x8103('0x2e')][_0x8103('0x53')]({'where':{'id':_0x5e82a6[_0x8103('0x46')]['id']}})[_0x8103('0x27')](handleEntityNotFound(_0x433c40,null))[_0x8103('0x27')](function(_0x45d2fc){if(_0x45d2fc){_0x56e4a9=_0x45d2fc;_0x47d6c4[_0x8103('0x36')]=_[_0x8103('0x4d')](db[_0x8103('0x4e')][_0x8103('0x2f')]);_0x47d6c4['query']=_['keys'](_0x5e82a6[_0x8103('0x33')]);_0x47d6c4[_0x8103('0x34')]=_[_0x8103('0x35')](_0x47d6c4[_0x8103('0x36')],_0x47d6c4[_0x8103('0x33')]);_0x4382bc[_0x8103('0x38')]=_[_0x8103('0x35')](_0x47d6c4['model'],qs[_0x8103('0x37')](_0x5e82a6[_0x8103('0x33')][_0x8103('0x37')]));_0x4382bc[_0x8103('0x38')]=_0x4382bc[_0x8103('0x38')][_0x8103('0x39')]?_0x4382bc[_0x8103('0x38')]:_0x47d6c4['model'];_0x4382bc[_0x8103('0x4f')]=qs['sort'](_0x5e82a6[_0x8103('0x33')]['sort']);_0x4382bc[_0x8103('0x3c')]=qs[_0x8103('0x34')](_[_0x8103('0x3d')](_0x5e82a6[_0x8103('0x33')],_0x47d6c4[_0x8103('0x34')]));if(_0x5e82a6[_0x8103('0x33')][_0x8103('0x3e')]){_0x4382bc[_0x8103('0x3c')]=_[_0x8103('0x3f')](_0x4382bc[_0x8103('0x3c')],{'$or':_[_0x8103('0x2d')](_0x4382bc[_0x8103('0x38')],function(_0x13becc){var _0x598c17={};_0x598c17[_0x13becc]={'$like':'%'+_0x5e82a6[_0x8103('0x33')]['filter']+'%'};return _0x598c17;})});}_0x4382bc=_[_0x8103('0x3f')]({},_0x4382bc,_0x5e82a6[_0x8103('0x48')]);return _0x56e4a9[_0x8103('0x52')](_0x4382bc);}})[_0x8103('0x27')](function(_0x3906c4){if(_0x3906c4){_0x5dd980=_0x3906c4[_0x8103('0x39')];if(!_0x5e82a6[_0x8103('0x33')][_0x8103('0x3a')](_0x8103('0x50'))){_0x4382bc[_0x8103('0x21')]=qs[_0x8103('0x21')](_0x5e82a6[_0x8103('0x33')][_0x8103('0x21')]);_0x4382bc['offset']=qs[_0x8103('0x20')](_0x5e82a6['query'][_0x8103('0x20')]);}return _0x56e4a9[_0x8103('0x52')](_0x4382bc);}})[_0x8103('0x27')](function(_0x56a953){if(_0x56a953){return _0x56a953?{'count':_0x5dd980,'rows':_0x56a953}:null;}})[_0x8103('0x27')](respondWithResult(_0x433c40,null))[_0x8103('0x44')](handleError(_0x433c40,null));};exports[_0x8103('0x54')]=function(_0x46966e,_0x5a5c99,_0x1bb2ea){var _0x2ec12c={};var _0x44fe9b={};var _0x11cc63;var _0x15f72e;return db[_0x8103('0x2e')][_0x8103('0x53')]({'where':{'id':_0x46966e[_0x8103('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a5c99,null))[_0x8103('0x27')](function(_0x483e0e){if(_0x483e0e){_0x11cc63=_0x483e0e;_0x44fe9b[_0x8103('0x36')]=_['keys'](db[_0x8103('0x55')]['rawAttributes']);_0x44fe9b[_0x8103('0x33')]=_['keys'](_0x46966e['query']);_0x44fe9b[_0x8103('0x34')]=_[_0x8103('0x35')](_0x44fe9b[_0x8103('0x36')],_0x44fe9b['query']);_0x2ec12c[_0x8103('0x38')]=_[_0x8103('0x35')](_0x44fe9b['model'],qs[_0x8103('0x37')](_0x46966e[_0x8103('0x33')][_0x8103('0x37')]));_0x2ec12c[_0x8103('0x38')]=_0x2ec12c['attributes']['length']?_0x2ec12c[_0x8103('0x38')]:_0x44fe9b['model'];_0x2ec12c['order']=qs[_0x8103('0x3b')](_0x46966e[_0x8103('0x33')][_0x8103('0x3b')]);_0x2ec12c[_0x8103('0x3c')]=qs[_0x8103('0x34')](_[_0x8103('0x3d')](_0x46966e[_0x8103('0x33')],_0x44fe9b[_0x8103('0x34')]));if(_0x46966e[_0x8103('0x33')][_0x8103('0x3e')]){_0x2ec12c[_0x8103('0x3c')]=_['merge'](_0x2ec12c['where'],{'$or':_['map'](_0x2ec12c[_0x8103('0x38')],function(_0x1f8fb8){var _0x421bb1={};_0x421bb1[_0x1f8fb8]={'$like':'%'+_0x46966e[_0x8103('0x33')][_0x8103('0x3e')]+'%'};return _0x421bb1;})});}_0x2ec12c=_[_0x8103('0x3f')]({},_0x2ec12c,_0x46966e[_0x8103('0x48')]);return _0x11cc63[_0x8103('0x54')](_0x2ec12c);}})[_0x8103('0x27')](function(_0x18e7d4){if(_0x18e7d4){_0x15f72e=_0x18e7d4[_0x8103('0x39')];if(!_0x46966e[_0x8103('0x33')]['hasOwnProperty'](_0x8103('0x50'))){_0x2ec12c[_0x8103('0x21')]=qs[_0x8103('0x21')](_0x46966e[_0x8103('0x33')][_0x8103('0x21')]);_0x2ec12c[_0x8103('0x20')]=qs[_0x8103('0x20')](_0x46966e[_0x8103('0x33')][_0x8103('0x20')]);}return _0x11cc63[_0x8103('0x54')](_0x2ec12c);}})[_0x8103('0x27')](function(_0x516400){if(_0x516400){return _0x516400?{'count':_0x15f72e,'rows':_0x516400}:null;}})[_0x8103('0x27')](respondWithResult(_0x5a5c99,null))[_0x8103('0x44')](handleError(_0x5a5c99,null));};exports[_0x8103('0x56')]=function(_0x3705ea,_0x24cbbd,_0x15c228){if(_0x3705ea[_0x8103('0x4b')]['id']){delete _0x3705ea[_0x8103('0x4b')]['id'];}return db[_0x8103('0x2e')][_0x8103('0x53')]({'where':{'id':_0x3705ea[_0x8103('0x46')]['id']}})['then'](handleEntityNotFound(_0x24cbbd,null))[_0x8103('0x27')](function(_0x3d9b43){if(_0x3d9b43){return _0x3d9b43['setTags'](_0x3705ea['body'][_0x8103('0x57')]||[]);}return null;})['then'](respondWithResult(_0x24cbbd,null))[_0x8103('0x44')](handleError(_0x24cbbd,null));}; \ No newline at end of file +var _0xde52=['crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','name','merge','options','ZendeskConfiguration','includeAll','findAll','rows','catch','show','include','find','create','body','params','getFields','findOne','ZendeskField','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4152f1,_0x2d0329){var _0x369409=function(_0x467302){while(--_0x467302){_0x4152f1['push'](_0x4152f1['shift']());}};_0x369409(++_0x2d0329);}(_0xde52,0x13b));var _0x2de5=function(_0x35b76f,_0x324c48){_0x35b76f=_0x35b76f-0x0;var _0x582906=_0xde52[_0x35b76f];return _0x582906;};'use strict';var emlformat=require(_0x2de5('0x0'));var rimraf=require(_0x2de5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2de5('0x2'));var rp=require(_0x2de5('0x3'));var moment=require(_0x2de5('0x4'));var BPromise=require(_0x2de5('0x5'));var Mustache=require(_0x2de5('0x6'));var util=require(_0x2de5('0x7'));var path=require('path');var sox=require(_0x2de5('0x8'));var csv=require(_0x2de5('0x9'));var ejs=require(_0x2de5('0xa'));var fs=require('fs');var fs_extra=require(_0x2de5('0xb'));var _=require(_0x2de5('0xc'));var squel=require('squel');var crypto=require(_0x2de5('0xd'));var jsforce=require(_0x2de5('0xe'));var deskjs=require(_0x2de5('0xf'));var toCsv=require(_0x2de5('0x9'));var querystring=require('querystring');var Papa=require(_0x2de5('0x10'));var Redis=require(_0x2de5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2de5('0x12'));var logger=require(_0x2de5('0x13'))('api');var utils=require(_0x2de5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2de5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x78a4ba,_0x51992b){_0x51992b=_0x51992b||0xcc;return function(_0x26126d){if(_0x26126d){return _0x78a4ba[_0x2de5('0x16')](_0x51992b);}return _0x78a4ba[_0x2de5('0x17')](_0x51992b)['end']();};}function respondWithResult(_0x2ea564,_0x39ad1c){_0x39ad1c=_0x39ad1c||0xc8;return function(_0x187746){if(_0x187746){return _0x2ea564['status'](_0x39ad1c)[_0x2de5('0x18')](_0x187746);}};}function respondWithFilteredResult(_0x4128ab,_0x46408b){return function(_0x109cb9){if(_0x109cb9){var _0x36e86f=typeof _0x46408b[_0x2de5('0x19')]===_0x2de5('0x1a')&&typeof _0x46408b[_0x2de5('0x1b')]===_0x2de5('0x1a');var _0x36e04c=_0x109cb9[_0x2de5('0x1c')];var _0x43ee31=_0x36e86f?0x0:_0x46408b[_0x2de5('0x19')];var _0x34f20d=_0x36e86f?_0x109cb9[_0x2de5('0x1c')]:_0x46408b[_0x2de5('0x19')]+_0x46408b[_0x2de5('0x1b')];var _0x728fd1;if(_0x34f20d>=_0x36e04c){_0x34f20d=_0x36e04c;_0x728fd1=0xc8;}else{_0x728fd1=0xce;}_0x4128ab['status'](_0x728fd1);return _0x4128ab[_0x2de5('0x1d')](_0x2de5('0x1e'),_0x43ee31+'-'+_0x34f20d+'/'+_0x36e04c)['json'](_0x109cb9);}return null;};}function patchUpdates(_0x176909){return function(_0x447904){try{jsonpatch['apply'](_0x447904,_0x176909,!![]);}catch(_0x3f2ca0){return BPromise[_0x2de5('0x1f')](_0x3f2ca0);}return _0x447904[_0x2de5('0x20')]();};}function saveUpdates(_0x19047e,_0x39f323){return function(_0x46de2f){if(_0x46de2f){return _0x46de2f[_0x2de5('0x21')](_0x19047e)['then'](function(_0x18a589){return _0x18a589;});}return null;};}function removeEntity(_0x2bb016,_0xf10dce){return function(_0x8ef96){if(_0x8ef96){return _0x8ef96['destroy']()[_0x2de5('0x22')](function(){_0x2bb016['status'](0xcc)[_0x2de5('0x23')]();});}};}function handleEntityNotFound(_0x223877,_0x4351ba){return function(_0x19500a){if(!_0x19500a){_0x223877[_0x2de5('0x16')](0x194);}return _0x19500a;};}function handleError(_0x525006,_0x1644bf){_0x1644bf=_0x1644bf||0x1f4;return function(_0x513b60){logger['error'](_0x513b60[_0x2de5('0x24')]);if(_0x513b60['name']){delete _0x513b60['name'];}_0x525006[_0x2de5('0x17')](_0x1644bf)[_0x2de5('0x25')](_0x513b60);};}exports[_0x2de5('0x26')]=function(_0x335d51,_0x21097a){var _0x2f6b0e={},_0x3eea43={},_0x5abd10={'count':0x0,'rows':[]};var _0x18b574=_[_0x2de5('0x27')](db['ZendeskConfiguration'][_0x2de5('0x28')],function(_0x41adda){return{'name':_0x41adda[_0x2de5('0x29')],'type':_0x41adda[_0x2de5('0x2a')][_0x2de5('0x2b')]};});_0x3eea43[_0x2de5('0x2c')]=_[_0x2de5('0x27')](_0x18b574,'name');_0x3eea43[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x335d51[_0x2de5('0x2d')]);_0x3eea43[_0x2de5('0x2f')]=_[_0x2de5('0x30')](_0x3eea43[_0x2de5('0x2c')],_0x3eea43['query']);_0x2f6b0e[_0x2de5('0x31')]=_['intersection'](_0x3eea43[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x335d51[_0x2de5('0x2d')]['fields']));_0x2f6b0e[_0x2de5('0x31')]=_0x2f6b0e[_0x2de5('0x31')][_0x2de5('0x33')]?_0x2f6b0e['attributes']:_0x3eea43[_0x2de5('0x2c')];if(!_0x335d51[_0x2de5('0x2d')][_0x2de5('0x34')](_0x2de5('0x35'))){_0x2f6b0e[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x335d51[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x2f6b0e[_0x2de5('0x19')]=qs[_0x2de5('0x19')](_0x335d51[_0x2de5('0x2d')][_0x2de5('0x19')]);}_0x2f6b0e[_0x2de5('0x36')]=qs[_0x2de5('0x37')](_0x335d51[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x2f6b0e['where']=qs[_0x2de5('0x2f')](_['pick'](_0x335d51['query'],_0x3eea43['filters']),_0x18b574);if(_0x335d51[_0x2de5('0x2d')][_0x2de5('0x38')]){_0x2f6b0e['where']=_['merge'](_0x2f6b0e[_0x2de5('0x39')],{'$or':_[_0x2de5('0x27')](_0x18b574,function(_0x38f146){if(_0x38f146[_0x2de5('0x2a')]!=='VIRTUAL'){var _0x5ae636={};_0x5ae636[_0x38f146[_0x2de5('0x3a')]]={'$like':'%'+_0x335d51[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x5ae636;}})});}_0x2f6b0e=_[_0x2de5('0x3b')]({},_0x2f6b0e,_0x335d51[_0x2de5('0x3c')]);var _0x580eb8={'where':_0x2f6b0e[_0x2de5('0x39')]};return db[_0x2de5('0x3d')]['count'](_0x580eb8)[_0x2de5('0x22')](function(_0x1e8bf8){_0x5abd10[_0x2de5('0x1c')]=_0x1e8bf8;if(_0x335d51[_0x2de5('0x2d')][_0x2de5('0x3e')]){_0x2f6b0e['include']=[{'all':!![]}];}return db[_0x2de5('0x3d')][_0x2de5('0x3f')](_0x2f6b0e);})[_0x2de5('0x22')](function(_0xe63ef8){_0x5abd10[_0x2de5('0x40')]=_0xe63ef8;return _0x5abd10;})['then'](respondWithFilteredResult(_0x21097a,_0x2f6b0e))[_0x2de5('0x41')](handleError(_0x21097a,null));};exports[_0x2de5('0x42')]=function(_0x34729d,_0x36fbb8){var _0x52ff06={'raw':![],'where':{'id':_0x34729d['params']['id']}},_0x1eb545={};_0x1eb545['model']=_['keys'](db['ZendeskConfiguration'][_0x2de5('0x28')]);_0x1eb545['query']=_['keys'](_0x34729d[_0x2de5('0x2d')]);_0x1eb545[_0x2de5('0x2f')]=_['intersection'](_0x1eb545['model'],_0x1eb545['query']);_0x52ff06['attributes']=_[_0x2de5('0x30')](_0x1eb545[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x34729d[_0x2de5('0x2d')]['fields']));_0x52ff06['attributes']=_0x52ff06[_0x2de5('0x31')][_0x2de5('0x33')]?_0x52ff06['attributes']:_0x1eb545[_0x2de5('0x2c')];if(_0x34729d['query'][_0x2de5('0x3e')]){_0x52ff06[_0x2de5('0x43')]=[{'all':!![]}];}_0x52ff06=_[_0x2de5('0x3b')]({},_0x52ff06,_0x34729d[_0x2de5('0x3c')]);return db[_0x2de5('0x3d')][_0x2de5('0x44')](_0x52ff06)[_0x2de5('0x22')](handleEntityNotFound(_0x36fbb8,null))[_0x2de5('0x22')](respondWithResult(_0x36fbb8,null))[_0x2de5('0x41')](handleError(_0x36fbb8,null));};exports['create']=function(_0x18cf77,_0x3533e9){return db['ZendeskConfiguration'][_0x2de5('0x45')](_0x18cf77[_0x2de5('0x46')],{})[_0x2de5('0x22')](respondWithResult(_0x3533e9,0xc9))[_0x2de5('0x41')](handleError(_0x3533e9,null));};exports['update']=function(_0x344bc2,_0x5556a0){if(_0x344bc2['body']['id']){delete _0x344bc2[_0x2de5('0x46')]['id'];}return db[_0x2de5('0x3d')]['find']({'where':{'id':_0x344bc2['params']['id']}})['then'](handleEntityNotFound(_0x5556a0,null))[_0x2de5('0x22')](saveUpdates(_0x344bc2[_0x2de5('0x46')],null))[_0x2de5('0x22')](respondWithResult(_0x5556a0,null))['catch'](handleError(_0x5556a0,null));};exports['destroy']=function(_0x2bf708,_0x338917){return db[_0x2de5('0x3d')]['find']({'where':{'id':_0x2bf708[_0x2de5('0x47')]['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x338917,null))[_0x2de5('0x22')](removeEntity(_0x338917,null))['catch'](handleError(_0x338917,null));};exports[_0x2de5('0x48')]=function(_0x520c8d,_0x441953,_0x35fae8){var _0x12cded={};var _0x56c4bc={};var _0x4b950f;var _0x1976ef;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x520c8d['params']['id']}})['then'](handleEntityNotFound(_0x441953,null))['then'](function(_0x289326){if(_0x289326){_0x4b950f=_0x289326;_0x56c4bc[_0x2de5('0x2c')]=_[_0x2de5('0x2e')](db[_0x2de5('0x4a')][_0x2de5('0x28')]);_0x56c4bc['query']=_['keys'](_0x520c8d[_0x2de5('0x2d')]);_0x56c4bc[_0x2de5('0x2f')]=_['intersection'](_0x56c4bc[_0x2de5('0x2c')],_0x56c4bc[_0x2de5('0x2d')]);_0x12cded[_0x2de5('0x31')]=_['intersection'](_0x56c4bc['model'],qs[_0x2de5('0x32')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x32')]));_0x12cded['attributes']=_0x12cded[_0x2de5('0x31')][_0x2de5('0x33')]?_0x12cded[_0x2de5('0x31')]:_0x56c4bc[_0x2de5('0x2c')];_0x12cded[_0x2de5('0x36')]=qs[_0x2de5('0x37')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x12cded[_0x2de5('0x39')]=qs['filters'](_['pick'](_0x520c8d['query'],_0x56c4bc[_0x2de5('0x2f')]));if(_0x520c8d[_0x2de5('0x2d')]['filter']){_0x12cded[_0x2de5('0x39')]=_[_0x2de5('0x3b')](_0x12cded[_0x2de5('0x39')],{'$or':_[_0x2de5('0x27')](_0x12cded[_0x2de5('0x31')],function(_0x32301a){var _0x4722aa={};_0x4722aa[_0x32301a]={'$like':'%'+_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x4722aa;})});}_0x12cded=_[_0x2de5('0x3b')]({},_0x12cded,_0x520c8d[_0x2de5('0x3c')]);return _0x4b950f[_0x2de5('0x48')](_0x12cded);}})[_0x2de5('0x22')](function(_0x4f6337){if(_0x4f6337){_0x1976ef=_0x4f6337['length'];if(!_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x34')]('nolimit')){_0x12cded['limit']=qs[_0x2de5('0x1b')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x12cded[_0x2de5('0x19')]=qs[_0x2de5('0x19')](_0x520c8d[_0x2de5('0x2d')][_0x2de5('0x19')]);}return _0x4b950f[_0x2de5('0x48')](_0x12cded);}})[_0x2de5('0x22')](function(_0x37bf15){if(_0x37bf15){return _0x37bf15?{'count':_0x1976ef,'rows':_0x37bf15}:null;}})[_0x2de5('0x22')](respondWithResult(_0x441953,null))[_0x2de5('0x41')](handleError(_0x441953,null));};exports[_0x2de5('0x4b')]=function(_0x5dc4c4,_0x2004af,_0x5eb215){var _0x2a72a9={};var _0x2a847e={};var _0x298f69;var _0x134ab8;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x5dc4c4[_0x2de5('0x47')]['id']}})['then'](handleEntityNotFound(_0x2004af,null))[_0x2de5('0x22')](function(_0xd79258){if(_0xd79258){_0x298f69=_0xd79258;_0x2a847e[_0x2de5('0x2c')]=_[_0x2de5('0x2e')](db['ZendeskField'][_0x2de5('0x28')]);_0x2a847e[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x5dc4c4[_0x2de5('0x2d')]);_0x2a847e['filters']=_[_0x2de5('0x30')](_0x2a847e[_0x2de5('0x2c')],_0x2a847e[_0x2de5('0x2d')]);_0x2a72a9[_0x2de5('0x31')]=_[_0x2de5('0x30')](_0x2a847e[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x32')]));_0x2a72a9['attributes']=_0x2a72a9[_0x2de5('0x31')][_0x2de5('0x33')]?_0x2a72a9[_0x2de5('0x31')]:_0x2a847e[_0x2de5('0x2c')];_0x2a72a9[_0x2de5('0x36')]=qs['sort'](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x2a72a9['where']=qs[_0x2de5('0x2f')](_[_0x2de5('0x4c')](_0x5dc4c4[_0x2de5('0x2d')],_0x2a847e[_0x2de5('0x2f')]));if(_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x38')]){_0x2a72a9['where']=_[_0x2de5('0x3b')](_0x2a72a9[_0x2de5('0x39')],{'$or':_['map'](_0x2a72a9[_0x2de5('0x31')],function(_0x256424){var _0x1d257b={};_0x1d257b[_0x256424]={'$like':'%'+_0x5dc4c4[_0x2de5('0x2d')]['filter']+'%'};return _0x1d257b;})});}_0x2a72a9=_[_0x2de5('0x3b')]({},_0x2a72a9,_0x5dc4c4[_0x2de5('0x3c')]);return _0x298f69[_0x2de5('0x4b')](_0x2a72a9);}})[_0x2de5('0x22')](function(_0x4d470b){if(_0x4d470b){_0x134ab8=_0x4d470b[_0x2de5('0x33')];if(!_0x5dc4c4[_0x2de5('0x2d')]['hasOwnProperty'](_0x2de5('0x35'))){_0x2a72a9[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x2a72a9['offset']=qs[_0x2de5('0x19')](_0x5dc4c4[_0x2de5('0x2d')][_0x2de5('0x19')]);}return _0x298f69[_0x2de5('0x4b')](_0x2a72a9);}})[_0x2de5('0x22')](function(_0x3adc79){if(_0x3adc79){return _0x3adc79?{'count':_0x134ab8,'rows':_0x3adc79}:null;}})[_0x2de5('0x22')](respondWithResult(_0x2004af,null))['catch'](handleError(_0x2004af,null));};exports[_0x2de5('0x4d')]=function(_0x171489,_0x38aa34,_0x1b5acf){var _0x18485c={};var _0x522ede={};var _0x264ada;var _0x4f4b2a;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x171489[_0x2de5('0x47')]['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x38aa34,null))[_0x2de5('0x22')](function(_0x2428fd){if(_0x2428fd){_0x264ada=_0x2428fd;_0x522ede[_0x2de5('0x2c')]=_['keys'](db[_0x2de5('0x4a')][_0x2de5('0x28')]);_0x522ede[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x171489[_0x2de5('0x2d')]);_0x522ede[_0x2de5('0x2f')]=_[_0x2de5('0x30')](_0x522ede['model'],_0x522ede[_0x2de5('0x2d')]);_0x18485c[_0x2de5('0x31')]=_[_0x2de5('0x30')](_0x522ede[_0x2de5('0x2c')],qs[_0x2de5('0x32')](_0x171489['query'][_0x2de5('0x32')]));_0x18485c[_0x2de5('0x31')]=_0x18485c[_0x2de5('0x31')]['length']?_0x18485c['attributes']:_0x522ede['model'];_0x18485c['order']=qs['sort'](_0x171489[_0x2de5('0x2d')]['sort']);_0x18485c['where']=qs[_0x2de5('0x2f')](_[_0x2de5('0x4c')](_0x171489[_0x2de5('0x2d')],_0x522ede['filters']));if(_0x171489[_0x2de5('0x2d')][_0x2de5('0x38')]){_0x18485c[_0x2de5('0x39')]=_[_0x2de5('0x3b')](_0x18485c[_0x2de5('0x39')],{'$or':_[_0x2de5('0x27')](_0x18485c[_0x2de5('0x31')],function(_0x556ddb){var _0x55f863={};_0x55f863[_0x556ddb]={'$like':'%'+_0x171489[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x55f863;})});}_0x18485c=_['merge']({},_0x18485c,_0x171489[_0x2de5('0x3c')]);return _0x264ada[_0x2de5('0x4d')](_0x18485c);}})[_0x2de5('0x22')](function(_0x44cef2){if(_0x44cef2){_0x4f4b2a=_0x44cef2[_0x2de5('0x33')];if(!_0x171489[_0x2de5('0x2d')][_0x2de5('0x34')]('nolimit')){_0x18485c[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x171489[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x18485c[_0x2de5('0x19')]=qs['offset'](_0x171489['query'][_0x2de5('0x19')]);}return _0x264ada[_0x2de5('0x4d')](_0x18485c);}})[_0x2de5('0x22')](function(_0x3bdb5a){if(_0x3bdb5a){return _0x3bdb5a?{'count':_0x4f4b2a,'rows':_0x3bdb5a}:null;}})[_0x2de5('0x22')](respondWithResult(_0x38aa34,null))[_0x2de5('0x41')](handleError(_0x38aa34,null));};exports[_0x2de5('0x4e')]=function(_0x983471,_0x1880b3,_0x356563){var _0x55b490={};var _0x105c67={};var _0x76cdbe;var _0x576287;return db[_0x2de5('0x3d')][_0x2de5('0x49')]({'where':{'id':_0x983471[_0x2de5('0x47')]['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x1880b3,null))[_0x2de5('0x22')](function(_0x252f8d){if(_0x252f8d){_0x76cdbe=_0x252f8d;_0x105c67[_0x2de5('0x2c')]=_[_0x2de5('0x2e')](db[_0x2de5('0x4f')][_0x2de5('0x28')]);_0x105c67[_0x2de5('0x2d')]=_[_0x2de5('0x2e')](_0x983471[_0x2de5('0x2d')]);_0x105c67[_0x2de5('0x2f')]=_[_0x2de5('0x30')](_0x105c67[_0x2de5('0x2c')],_0x105c67[_0x2de5('0x2d')]);_0x55b490[_0x2de5('0x31')]=_[_0x2de5('0x30')](_0x105c67['model'],qs[_0x2de5('0x32')](_0x983471[_0x2de5('0x2d')][_0x2de5('0x32')]));_0x55b490['attributes']=_0x55b490['attributes']['length']?_0x55b490[_0x2de5('0x31')]:_0x105c67['model'];_0x55b490['order']=qs[_0x2de5('0x37')](_0x983471[_0x2de5('0x2d')][_0x2de5('0x37')]);_0x55b490[_0x2de5('0x39')]=qs[_0x2de5('0x2f')](_[_0x2de5('0x4c')](_0x983471[_0x2de5('0x2d')],_0x105c67[_0x2de5('0x2f')]));if(_0x983471['query'][_0x2de5('0x38')]){_0x55b490[_0x2de5('0x39')]=_[_0x2de5('0x3b')](_0x55b490[_0x2de5('0x39')],{'$or':_['map'](_0x55b490['attributes'],function(_0x361e36){var _0x43c950={};_0x43c950[_0x361e36]={'$like':'%'+_0x983471[_0x2de5('0x2d')][_0x2de5('0x38')]+'%'};return _0x43c950;})});}_0x55b490=_['merge']({},_0x55b490,_0x983471[_0x2de5('0x3c')]);return _0x76cdbe['getTags'](_0x55b490);}})[_0x2de5('0x22')](function(_0x2c4ddf){if(_0x2c4ddf){_0x576287=_0x2c4ddf[_0x2de5('0x33')];if(!_0x983471['query'][_0x2de5('0x34')](_0x2de5('0x35'))){_0x55b490[_0x2de5('0x1b')]=qs[_0x2de5('0x1b')](_0x983471[_0x2de5('0x2d')][_0x2de5('0x1b')]);_0x55b490[_0x2de5('0x19')]=qs[_0x2de5('0x19')](_0x983471[_0x2de5('0x2d')]['offset']);}return _0x76cdbe[_0x2de5('0x4e')](_0x55b490);}})[_0x2de5('0x22')](function(_0x4519ef){if(_0x4519ef){return _0x4519ef?{'count':_0x576287,'rows':_0x4519ef}:null;}})[_0x2de5('0x22')](respondWithResult(_0x1880b3,null))['catch'](handleError(_0x1880b3,null));};exports[_0x2de5('0x50')]=function(_0x5c993d,_0x4e3956,_0x4c9688){if(_0x5c993d[_0x2de5('0x46')]['id']){delete _0x5c993d['body']['id'];}return db['ZendeskConfiguration'][_0x2de5('0x49')]({'where':{'id':_0x5c993d['params']['id']}})[_0x2de5('0x22')](handleEntityNotFound(_0x4e3956,null))[_0x2de5('0x22')](function(_0x524eba){if(_0x524eba){return _0x524eba[_0x2de5('0x50')](_0x5c993d[_0x2de5('0x46')][_0x2de5('0x51')]||[]);}return null;})[_0x2de5('0x22')](respondWithResult(_0x4e3956,null))['catch'](handleError(_0x4e3956,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5a18491..e2c4a1c 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 _0x80ed=['api','moment','request-promise','path','rimraf','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x173653,_0x482551){var _0x227512=function(_0x5bf845){while(--_0x5bf845){_0x173653['push'](_0x173653['shift']());}};_0x227512(++_0x482551);}(_0x80ed,0x11c));var _0xd80e=function(_0x3809ad,_0x2dc54c){_0x3809ad=_0x3809ad-0x0;var _0x2672e7=_0x80ed[_0x3809ad];return _0x2672e7;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var logger=require(_0xd80e('0x1'))(_0xd80e('0x2'));var moment=require(_0xd80e('0x3'));var BPromise=require('bluebird');var rp=require(_0xd80e('0x4'));var fs=require('fs');var path=require(_0xd80e('0x5'));var rimraf=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd80e('0x8')]=function(_0x2b4742,_0x252fec){return _0x2b4742['define'](_0xd80e('0x9'),attributes,{'tableName':_0xd80e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3f=['request-promise','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x482a39,_0x5891ce){var _0x123ac6=function(_0x1741c2){while(--_0x1741c2){_0x482a39['push'](_0x482a39['shift']());}};_0x123ac6(++_0x5891ce);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0xf8e3('0xa'),'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 5ec8914..75a7a6f 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 _0xeb2b=['info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x3d8b12,_0x1aedda){var _0x49887f=function(_0x450912){while(--_0x450912){_0x3d8b12['push'](_0x3d8b12['shift']());}};_0x49887f(++_0x1aedda);}(_0xeb2b,0x1ca));var _0xbeb2=function(_0x23cbcc,_0x308eda){_0x23cbcc=_0x23cbcc-0x0;var _0x398f09=_0xeb2b[_0x23cbcc];return _0x398f09;};'use strict';var _=require('lodash');var util=require(_0xbeb2('0x0'));var moment=require(_0xbeb2('0x1'));var BPromise=require('bluebird');var rs=require(_0xbeb2('0x2'));var fs=require('fs');var Redis=require(_0xbeb2('0x3'));var db=require(_0xbeb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbeb2('0x5'))('rpc');var config=require(_0xbeb2('0x6'));var jayson=require(_0xbeb2('0x7'));var client=jayson['client'][_0xbeb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f94ff,_0x5332ba,_0x2ade5c){return new BPromise(function(_0x5c2a23,_0x99369e){return client[_0xbeb2('0x9')](_0x1f94ff,_0x2ade5c)['then'](function(_0x2fd62d){logger[_0xbeb2('0xa')](_0xbeb2('0xb'),_0x5332ba,'request\x20sent');logger[_0xbeb2('0xc')](_0xbeb2('0xd'),_0x5332ba,'request\x20sent',JSON['stringify'](_0x2fd62d));if(_0x2fd62d[_0xbeb2('0xe')]){if(_0x2fd62d[_0xbeb2('0xe')]['code']===0x1f4){logger[_0xbeb2('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5332ba,_0x2fd62d[_0xbeb2('0xe')][_0xbeb2('0xf')]);return _0x99369e(_0x2fd62d['error'][_0xbeb2('0xf')]);}logger[_0xbeb2('0xe')](_0xbeb2('0xb'),_0x5332ba,_0x2fd62d['error'][_0xbeb2('0xf')]);return _0x5c2a23(_0x2fd62d[_0xbeb2('0xe')][_0xbeb2('0xf')]);}else{logger[_0xbeb2('0xa')](_0xbeb2('0xb'),_0x5332ba,_0xbeb2('0x10'));_0x5c2a23(_0x2fd62d[_0xbeb2('0x11')]['message']);}})['catch'](function(_0x174c3){logger[_0xbeb2('0xe')](_0xbeb2('0xb'),_0x5332ba,_0x174c3);_0x99369e(_0x174c3);});});} \ No newline at end of file +var _0xc523=['http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc523,0x1da));var _0x3c52=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xc523[_0x42020e];return _0x561551;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c52('0x0'));var BPromise=require(_0x3c52('0x1'));var rs=require(_0x3c52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c52('0x3'))['db'];var utils=require(_0x3c52('0x4'));var logger=require(_0x3c52('0x5'))(_0x3c52('0x6'));var config=require(_0x3c52('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3c52('0x8')][_0x3c52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4274f6,_0x3157c1,_0x3ce4c3){return new BPromise(function(_0x371952,_0x547a58){return client['request'](_0x4274f6,_0x3ce4c3)[_0x3c52('0xa')](function(_0x577d16){logger[_0x3c52('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3157c1,_0x3c52('0xc'));logger[_0x3c52('0xd')](_0x3c52('0xe'),_0x3157c1,'request\x20sent',JSON[_0x3c52('0xf')](_0x577d16));if(_0x577d16[_0x3c52('0x10')]){if(_0x577d16[_0x3c52('0x10')]['code']===0x1f4){logger[_0x3c52('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3157c1,_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);return _0x547a58(_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);}logger[_0x3c52('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3157c1,_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);return _0x371952(_0x577d16[_0x3c52('0x10')][_0x3c52('0x11')]);}else{logger['info'](_0x3c52('0x12'),_0x3157c1,_0x3c52('0xc'));_0x371952(_0x577d16[_0x3c52('0x13')][_0x3c52('0x11')]);}})[_0x3c52('0x14')](function(_0x57aa38){logger[_0x3c52('0x10')](_0x3c52('0x12'),_0x3157c1,_0x57aa38);_0x547a58(_0x57aa38);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7ce8011..16239c7 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 _0xbcab=['express','Router','fs-extra','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','create','update','delete','multer','path'];(function(_0xab92b5,_0x184d79){var _0x3a758c=function(_0x3eae35){while(--_0x3eae35){_0xab92b5['push'](_0xab92b5['shift']());}};_0x3a758c(++_0x184d79);}(_0xbcab,0x94));var _0xbbca=function(_0x4b5df7,_0x21c8a9){_0x4b5df7=_0x4b5df7-0x0;var _0x2af9d0=_0xbcab[_0x4b5df7];return _0x2af9d0;};'use strict';var multer=require(_0xbbca('0x0'));var util=require('util');var path=require(_0xbbca('0x1'));var timeout=require('connect-timeout');var express=require(_0xbbca('0x2'));var router=express[_0xbbca('0x3')]();var fs_extra=require(_0xbbca('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbbca('0x5'));var controller=require(_0xbbca('0x6'));router[_0xbbca('0x7')]('/',auth['isAuthenticated'](),controller[_0xbbca('0x8')]);router['get'](_0xbbca('0x9'),auth[_0xbbca('0xa')](),controller[_0xbbca('0xb')]);router['post']('/',auth[_0xbbca('0xa')](),controller[_0xbbca('0xc')]);router['put'](_0xbbca('0x9'),auth[_0xbbca('0xa')](),controller[_0xbbca('0xd')]);router[_0xbbca('0xe')]('/:id',auth[_0xbbca('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4112=['delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./intZendeskField.controller','isAuthenticated','index','get','show','/:id','update'];(function(_0x4fbb3e,_0x55785f){var _0x1eb197=function(_0xfda25){while(--_0xfda25){_0x4fbb3e['push'](_0x4fbb3e['shift']());}};_0x1eb197(++_0x55785f);}(_0x4112,0xb6));var _0x2411=function(_0x4768c6,_0xff55d6){_0x4768c6=_0x4768c6-0x0;var _0x41b439=_0x4112[_0x4768c6];return _0x41b439;};'use strict';var multer=require(_0x2411('0x0'));var util=require('util');var path=require(_0x2411('0x1'));var timeout=require('connect-timeout');var express=require(_0x2411('0x2'));var router=express[_0x2411('0x3')]();var fs_extra=require(_0x2411('0x4'));var auth=require(_0x2411('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2411('0x6'));router['get']('/',auth[_0x2411('0x7')](),controller[_0x2411('0x8')]);router[_0x2411('0x9')]('/:id',auth[_0x2411('0x7')](),controller[_0x2411('0xa')]);router['post']('/',auth[_0x2411('0x7')](),controller['create']);router['put'](_0x2411('0xb'),auth[_0x2411('0x7')](),controller[_0x2411('0xc')]);router[_0x2411('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2411('0xe')]);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 917c5e0..2779baf 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 _0xebb6=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x282c01,_0x282eeb){var _0x30a6bf=function(_0x3ba723){while(--_0x3ba723){_0x282c01['push'](_0x282c01['shift']());}};_0x30a6bf(++_0x282eeb);}(_0xebb6,0xf5));var _0x6ebb=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xebb6[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x6ebb('0x0'));module['exports']={'type':{'type':Sequelize[_0x6ebb('0x1')](_0x6ebb('0x2'),_0x6ebb('0x3'),_0x6ebb('0x4'),_0x6ebb('0x5'),_0x6ebb('0x6')),'defaultValue':_0x6ebb('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6ebb('0x7')]},'keyType':{'type':Sequelize[_0x6ebb('0x1')]('string',_0x6ebb('0x3'),_0x6ebb('0x4'))},'keyContent':{'type':Sequelize[_0x6ebb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6ebb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ebb('0x7')]}}; \ No newline at end of file +var _0xba1a=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0xd45d05,_0x52393b){var _0x15940b=function(_0x39afc9){while(--_0x39afc9){_0xd45d05['push'](_0xd45d05['shift']());}};_0x15940b(++_0x52393b);}(_0xba1a,0x9c));var _0xaba1=function(_0x4faaee,_0x467507){_0x4faaee=_0x4faaee-0x0;var _0x2525b6=_0xba1a[_0x4faaee];return _0x2525b6;};'use strict';var Sequelize=require(_0xaba1('0x0'));module[_0xaba1('0x1')]={'type':{'type':Sequelize[_0xaba1('0x2')]('string',_0xaba1('0x3'),_0xaba1('0x4'),_0xaba1('0x5'),'picklist'),'defaultValue':_0xaba1('0x6')},'content':{'type':Sequelize[_0xaba1('0x7')]},'key':{'type':Sequelize[_0xaba1('0x7')]},'keyType':{'type':Sequelize[_0xaba1('0x2')](_0xaba1('0x6'),_0xaba1('0x3'),_0xaba1('0x4'))},'keyContent':{'type':Sequelize[_0xaba1('0x7')]},'idField':{'type':Sequelize[_0xaba1('0x7')]},'nameField':{'type':Sequelize[_0xaba1('0x7')]},'customField':{'type':Sequelize[_0xaba1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaba1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 553b589..713f1db 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 _0x70fe=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70fe,0x1d6));var _0xe70f=function(_0x264306,_0x275a51){_0x264306=_0x264306-0x0;var _0xe3250a=_0x70fe[_0x264306];return _0xe3250a;};'use strict';var emlformat=require(_0xe70f('0x0'));var rimraf=require(_0xe70f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe70f('0x2'));var moment=require(_0xe70f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe70f('0x4'));var util=require(_0xe70f('0x5'));var path=require(_0xe70f('0x6'));var sox=require('sox');var csv=require(_0xe70f('0x7'));var ejs=require(_0xe70f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe70f('0x9'));var squel=require(_0xe70f('0xa'));var crypto=require('crypto');var jsforce=require(_0xe70f('0xb'));var deskjs=require(_0xe70f('0xc'));var toCsv=require(_0xe70f('0x7'));var querystring=require('querystring');var Papa=require(_0xe70f('0xd'));var Redis=require(_0xe70f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe70f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe70f('0x10'));var logger=require(_0xe70f('0x11'))(_0xe70f('0x12'));var utils=require(_0xe70f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe70f('0x14'));var db=require(_0xe70f('0x15'))['db'];function respondWithStatusCode(_0xe1ab13,_0x331d5d){_0x331d5d=_0x331d5d||0xcc;return function(_0x26b083){if(_0x26b083){return _0xe1ab13[_0xe70f('0x16')](_0x331d5d);}return _0xe1ab13[_0xe70f('0x17')](_0x331d5d)['end']();};}function respondWithResult(_0x1fe5d7,_0x138fc8){_0x138fc8=_0x138fc8||0xc8;return function(_0x593c85){if(_0x593c85){return _0x1fe5d7[_0xe70f('0x17')](_0x138fc8)[_0xe70f('0x18')](_0x593c85);}};}function respondWithFilteredResult(_0x198933,_0x47d4aa){return function(_0x1d7a42){if(_0x1d7a42){var _0x20ce1d=typeof _0x47d4aa[_0xe70f('0x19')]==='undefined'&&typeof _0x47d4aa[_0xe70f('0x1a')]==='undefined';var _0x453d12=_0x1d7a42['count'];var _0x516a75=_0x20ce1d?0x0:_0x47d4aa[_0xe70f('0x19')];var _0x2c5d0b=_0x20ce1d?_0x1d7a42[_0xe70f('0x1b')]:_0x47d4aa[_0xe70f('0x19')]+_0x47d4aa[_0xe70f('0x1a')];var _0x12e11f;if(_0x2c5d0b>=_0x453d12){_0x2c5d0b=_0x453d12;_0x12e11f=0xc8;}else{_0x12e11f=0xce;}_0x198933[_0xe70f('0x17')](_0x12e11f);return _0x198933['set']('Content-Range',_0x516a75+'-'+_0x2c5d0b+'/'+_0x453d12)[_0xe70f('0x18')](_0x1d7a42);}return null;};}function patchUpdates(_0x13b94b){return function(_0x517465){try{jsonpatch[_0xe70f('0x1c')](_0x517465,_0x13b94b,!![]);}catch(_0x3d10e2){return BPromise[_0xe70f('0x1d')](_0x3d10e2);}return _0x517465[_0xe70f('0x1e')]();};}function saveUpdates(_0x293e1b,_0x596024){return function(_0x4641a1){if(_0x4641a1){return _0x4641a1[_0xe70f('0x1f')](_0x293e1b)[_0xe70f('0x20')](function(_0x44b244){return _0x44b244;});}return null;};}function removeEntity(_0x53e2b0,_0x1c5073){return function(_0x3d0285){if(_0x3d0285){return _0x3d0285[_0xe70f('0x21')]()[_0xe70f('0x20')](function(){_0x53e2b0[_0xe70f('0x17')](0xcc)[_0xe70f('0x22')]();});}};}function handleEntityNotFound(_0x5c7a09,_0x540a44){return function(_0x35561b){if(!_0x35561b){_0x5c7a09[_0xe70f('0x16')](0x194);}return _0x35561b;};}function handleError(_0x113962,_0x83af8){_0x83af8=_0x83af8||0x1f4;return function(_0x4f5ff7){logger[_0xe70f('0x23')](_0x4f5ff7[_0xe70f('0x24')]);if(_0x4f5ff7[_0xe70f('0x25')]){delete _0x4f5ff7[_0xe70f('0x25')];}_0x113962[_0xe70f('0x17')](_0x83af8)[_0xe70f('0x26')](_0x4f5ff7);};}exports[_0xe70f('0x27')]=function(_0x6d08b7,_0x426611){var _0xe9f002={},_0x50451c={},_0x3bb74c={'count':0x0,'rows':[]};var _0x42a3f1=_[_0xe70f('0x28')](db[_0xe70f('0x29')][_0xe70f('0x2a')],function(_0x36eff8){return{'name':_0x36eff8[_0xe70f('0x2b')],'type':_0x36eff8[_0xe70f('0x2c')]['key']};});_0x50451c[_0xe70f('0x2d')]=_[_0xe70f('0x28')](_0x42a3f1,_0xe70f('0x25'));_0x50451c[_0xe70f('0x2e')]=_[_0xe70f('0x2f')](_0x6d08b7['query']);_0x50451c[_0xe70f('0x30')]=_['intersection'](_0x50451c[_0xe70f('0x2d')],_0x50451c[_0xe70f('0x2e')]);_0xe9f002[_0xe70f('0x31')]=_[_0xe70f('0x32')](_0x50451c[_0xe70f('0x2d')],qs[_0xe70f('0x33')](_0x6d08b7[_0xe70f('0x2e')][_0xe70f('0x33')]));_0xe9f002[_0xe70f('0x31')]=_0xe9f002[_0xe70f('0x31')][_0xe70f('0x34')]?_0xe9f002[_0xe70f('0x31')]:_0x50451c[_0xe70f('0x2d')];if(!_0x6d08b7[_0xe70f('0x2e')][_0xe70f('0x35')]('nolimit')){_0xe9f002['limit']=qs['limit'](_0x6d08b7[_0xe70f('0x2e')][_0xe70f('0x1a')]);_0xe9f002[_0xe70f('0x19')]=qs[_0xe70f('0x19')](_0x6d08b7[_0xe70f('0x2e')][_0xe70f('0x19')]);}_0xe9f002['order']=qs[_0xe70f('0x36')](_0x6d08b7[_0xe70f('0x2e')][_0xe70f('0x36')]);_0xe9f002[_0xe70f('0x37')]=qs[_0xe70f('0x30')](_[_0xe70f('0x38')](_0x6d08b7['query'],_0x50451c[_0xe70f('0x30')]),_0x42a3f1);if(_0x6d08b7[_0xe70f('0x2e')][_0xe70f('0x39')]){_0xe9f002[_0xe70f('0x37')]=_[_0xe70f('0x3a')](_0xe9f002[_0xe70f('0x37')],{'$or':_[_0xe70f('0x28')](_0x42a3f1,function(_0x501138){if(_0x501138[_0xe70f('0x2c')]!==_0xe70f('0x3b')){var _0x17aaa8={};_0x17aaa8[_0x501138[_0xe70f('0x25')]]={'$like':'%'+_0x6d08b7[_0xe70f('0x2e')][_0xe70f('0x39')]+'%'};return _0x17aaa8;}})});}_0xe9f002=_[_0xe70f('0x3a')]({},_0xe9f002,_0x6d08b7['options']);var _0x54e7ec={'where':_0xe9f002[_0xe70f('0x37')]};return db['ZendeskField']['count'](_0x54e7ec)[_0xe70f('0x20')](function(_0x3a6765){_0x3bb74c[_0xe70f('0x1b')]=_0x3a6765;if(_0x6d08b7['query'][_0xe70f('0x3c')]){_0xe9f002[_0xe70f('0x3d')]=[{'all':!![]}];}return db[_0xe70f('0x29')][_0xe70f('0x3e')](_0xe9f002);})['then'](function(_0xbab79e){_0x3bb74c[_0xe70f('0x3f')]=_0xbab79e;return _0x3bb74c;})['then'](respondWithFilteredResult(_0x426611,_0xe9f002))[_0xe70f('0x40')](handleError(_0x426611,null));};exports[_0xe70f('0x41')]=function(_0xae67be,_0x47d348){var _0x5407ea={'raw':!![],'where':{'id':_0xae67be[_0xe70f('0x42')]['id']}},_0x1ec6b3={};_0x1ec6b3[_0xe70f('0x2d')]=_['keys'](db[_0xe70f('0x29')]['rawAttributes']);_0x1ec6b3['query']=_[_0xe70f('0x2f')](_0xae67be[_0xe70f('0x2e')]);_0x1ec6b3[_0xe70f('0x30')]=_['intersection'](_0x1ec6b3['model'],_0x1ec6b3[_0xe70f('0x2e')]);_0x5407ea[_0xe70f('0x31')]=_['intersection'](_0x1ec6b3[_0xe70f('0x2d')],qs[_0xe70f('0x33')](_0xae67be[_0xe70f('0x2e')][_0xe70f('0x33')]));_0x5407ea[_0xe70f('0x31')]=_0x5407ea[_0xe70f('0x31')][_0xe70f('0x34')]?_0x5407ea[_0xe70f('0x31')]:_0x1ec6b3['model'];if(_0xae67be[_0xe70f('0x2e')][_0xe70f('0x3c')]){_0x5407ea[_0xe70f('0x3d')]=[{'all':!![]}];}_0x5407ea=_[_0xe70f('0x3a')]({},_0x5407ea,_0xae67be['options']);return db['ZendeskField'][_0xe70f('0x43')](_0x5407ea)['then'](handleEntityNotFound(_0x47d348,null))[_0xe70f('0x20')](respondWithResult(_0x47d348,null))[_0xe70f('0x40')](handleError(_0x47d348,null));};exports[_0xe70f('0x44')]=function(_0x2f3594,_0x538120){return db['ZendeskField'][_0xe70f('0x44')](_0x2f3594[_0xe70f('0x45')],{})['then'](respondWithResult(_0x538120,0xc9))[_0xe70f('0x40')](handleError(_0x538120,null));};exports[_0xe70f('0x1f')]=function(_0x5ddd3a,_0x2f1576){if(_0x5ddd3a['body']['id']){delete _0x5ddd3a[_0xe70f('0x45')]['id'];}return db[_0xe70f('0x29')][_0xe70f('0x43')]({'where':{'id':_0x5ddd3a[_0xe70f('0x42')]['id']}})[_0xe70f('0x20')](handleEntityNotFound(_0x2f1576,null))['then'](saveUpdates(_0x5ddd3a[_0xe70f('0x45')],null))[_0xe70f('0x20')](respondWithResult(_0x2f1576,null))[_0xe70f('0x40')](handleError(_0x2f1576,null));};exports['destroy']=function(_0x5c1f8a,_0x4cdc6c){return db[_0xe70f('0x29')][_0xe70f('0x43')]({'where':{'id':_0x5c1f8a['params']['id']}})[_0xe70f('0x20')](handleEntityNotFound(_0x4cdc6c,null))[_0xe70f('0x20')](removeEntity(_0x4cdc6c,null))[_0xe70f('0x40')](handleError(_0x4cdc6c,null));}; \ No newline at end of file +var _0x34e1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x34e1,0xdc));var _0x134e=function(_0x108ed5,_0x4948b6){_0x108ed5=_0x108ed5-0x0;var _0x457da4=_0x34e1[_0x108ed5];return _0x457da4;};'use strict';var emlformat=require(_0x134e('0x0'));var rimraf=require(_0x134e('0x1'));var zipdir=require(_0x134e('0x2'));var jsonpatch=require(_0x134e('0x3'));var rp=require(_0x134e('0x4'));var moment=require(_0x134e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x134e('0x6'));var util=require(_0x134e('0x7'));var path=require(_0x134e('0x8'));var sox=require(_0x134e('0x9'));var csv=require('to-csv');var ejs=require(_0x134e('0xa'));var fs=require('fs');var fs_extra=require(_0x134e('0xb'));var _=require(_0x134e('0xc'));var squel=require(_0x134e('0xd'));var crypto=require(_0x134e('0xe'));var jsforce=require(_0x134e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x134e('0x10'));var querystring=require(_0x134e('0x11'));var Papa=require(_0x134e('0x12'));var Redis=require('ioredis');var authService=require(_0x134e('0x13'));var qs=require(_0x134e('0x14'));var as=require(_0x134e('0x15'));var hardwareService=require(_0x134e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x134e('0x17'));var config=require(_0x134e('0x18'));var licenseUtil=require(_0x134e('0x19'));var db=require(_0x134e('0x1a'))['db'];function respondWithStatusCode(_0x47c76f,_0x511809){_0x511809=_0x511809||0xcc;return function(_0x56f328){if(_0x56f328){return _0x47c76f[_0x134e('0x1b')](_0x511809);}return _0x47c76f[_0x134e('0x1c')](_0x511809)[_0x134e('0x1d')]();};}function respondWithResult(_0x4273f6,_0x42878e){_0x42878e=_0x42878e||0xc8;return function(_0x4328a4){if(_0x4328a4){return _0x4273f6[_0x134e('0x1c')](_0x42878e)[_0x134e('0x1e')](_0x4328a4);}};}function respondWithFilteredResult(_0x2e3593,_0x3f8b94){return function(_0x4b6ead){if(_0x4b6ead){var _0x1ef39b=typeof _0x3f8b94[_0x134e('0x1f')]==='undefined'&&typeof _0x3f8b94[_0x134e('0x20')]===_0x134e('0x21');var _0x58829e=_0x4b6ead[_0x134e('0x22')];var _0x266b0c=_0x1ef39b?0x0:_0x3f8b94['offset'];var _0x3ef9ee=_0x1ef39b?_0x4b6ead[_0x134e('0x22')]:_0x3f8b94['offset']+_0x3f8b94[_0x134e('0x20')];var _0x47c497;if(_0x3ef9ee>=_0x58829e){_0x3ef9ee=_0x58829e;_0x47c497=0xc8;}else{_0x47c497=0xce;}_0x2e3593[_0x134e('0x1c')](_0x47c497);return _0x2e3593[_0x134e('0x23')](_0x134e('0x24'),_0x266b0c+'-'+_0x3ef9ee+'/'+_0x58829e)[_0x134e('0x1e')](_0x4b6ead);}return null;};}function patchUpdates(_0x1637b3){return function(_0x2bb46c){try{jsonpatch[_0x134e('0x25')](_0x2bb46c,_0x1637b3,!![]);}catch(_0x228361){return BPromise[_0x134e('0x26')](_0x228361);}return _0x2bb46c[_0x134e('0x27')]();};}function saveUpdates(_0x5cc475,_0x656592){return function(_0x11dbc0){if(_0x11dbc0){return _0x11dbc0[_0x134e('0x28')](_0x5cc475)['then'](function(_0x61577e){return _0x61577e;});}return null;};}function removeEntity(_0x261b82,_0x3348ce){return function(_0x47d932){if(_0x47d932){return _0x47d932[_0x134e('0x29')]()[_0x134e('0x2a')](function(){_0x261b82[_0x134e('0x1c')](0xcc)[_0x134e('0x1d')]();});}};}function handleEntityNotFound(_0x18f933,_0x2b3402){return function(_0x54742e){if(!_0x54742e){_0x18f933[_0x134e('0x1b')](0x194);}return _0x54742e;};}function handleError(_0x421c01,_0x94e500){_0x94e500=_0x94e500||0x1f4;return function(_0x1b4a7a){logger[_0x134e('0x2b')](_0x1b4a7a[_0x134e('0x2c')]);if(_0x1b4a7a[_0x134e('0x2d')]){delete _0x1b4a7a[_0x134e('0x2d')];}_0x421c01[_0x134e('0x1c')](_0x94e500)[_0x134e('0x2e')](_0x1b4a7a);};}exports[_0x134e('0x2f')]=function(_0x201ad0,_0x33f390){var _0x2e8f59={},_0x2adfe1={},_0x328ef5={'count':0x0,'rows':[]};var _0x38135b=_[_0x134e('0x30')](db[_0x134e('0x31')][_0x134e('0x32')],function(_0x31ae71){return{'name':_0x31ae71[_0x134e('0x33')],'type':_0x31ae71[_0x134e('0x34')][_0x134e('0x35')]};});_0x2adfe1[_0x134e('0x36')]=_[_0x134e('0x30')](_0x38135b,_0x134e('0x2d'));_0x2adfe1[_0x134e('0x37')]=_[_0x134e('0x38')](_0x201ad0[_0x134e('0x37')]);_0x2adfe1[_0x134e('0x39')]=_[_0x134e('0x3a')](_0x2adfe1[_0x134e('0x36')],_0x2adfe1[_0x134e('0x37')]);_0x2e8f59['attributes']=_[_0x134e('0x3a')](_0x2adfe1[_0x134e('0x36')],qs[_0x134e('0x3b')](_0x201ad0[_0x134e('0x37')][_0x134e('0x3b')]));_0x2e8f59[_0x134e('0x3c')]=_0x2e8f59['attributes'][_0x134e('0x3d')]?_0x2e8f59[_0x134e('0x3c')]:_0x2adfe1[_0x134e('0x36')];if(!_0x201ad0[_0x134e('0x37')][_0x134e('0x3e')](_0x134e('0x3f'))){_0x2e8f59[_0x134e('0x20')]=qs[_0x134e('0x20')](_0x201ad0['query'][_0x134e('0x20')]);_0x2e8f59[_0x134e('0x1f')]=qs[_0x134e('0x1f')](_0x201ad0[_0x134e('0x37')][_0x134e('0x1f')]);}_0x2e8f59[_0x134e('0x40')]=qs[_0x134e('0x41')](_0x201ad0[_0x134e('0x37')][_0x134e('0x41')]);_0x2e8f59['where']=qs[_0x134e('0x39')](_['pick'](_0x201ad0[_0x134e('0x37')],_0x2adfe1[_0x134e('0x39')]),_0x38135b);if(_0x201ad0[_0x134e('0x37')][_0x134e('0x42')]){_0x2e8f59[_0x134e('0x43')]=_[_0x134e('0x44')](_0x2e8f59[_0x134e('0x43')],{'$or':_[_0x134e('0x30')](_0x38135b,function(_0x73d717){if(_0x73d717[_0x134e('0x34')]!==_0x134e('0x45')){var _0x3765f1={};_0x3765f1[_0x73d717['name']]={'$like':'%'+_0x201ad0[_0x134e('0x37')][_0x134e('0x42')]+'%'};return _0x3765f1;}})});}_0x2e8f59=_['merge']({},_0x2e8f59,_0x201ad0['options']);var _0x37bd25={'where':_0x2e8f59['where']};return db[_0x134e('0x31')][_0x134e('0x22')](_0x37bd25)[_0x134e('0x2a')](function(_0x37edcc){_0x328ef5[_0x134e('0x22')]=_0x37edcc;if(_0x201ad0[_0x134e('0x37')][_0x134e('0x46')]){_0x2e8f59[_0x134e('0x47')]=[{'all':!![]}];}return db['ZendeskField'][_0x134e('0x48')](_0x2e8f59);})[_0x134e('0x2a')](function(_0x2265ea){_0x328ef5[_0x134e('0x49')]=_0x2265ea;return _0x328ef5;})['then'](respondWithFilteredResult(_0x33f390,_0x2e8f59))['catch'](handleError(_0x33f390,null));};exports[_0x134e('0x4a')]=function(_0x48da68,_0x4c4d08){var _0x238420={'raw':!![],'where':{'id':_0x48da68[_0x134e('0x4b')]['id']}},_0x5d9022={};_0x5d9022[_0x134e('0x36')]=_[_0x134e('0x38')](db['ZendeskField'][_0x134e('0x32')]);_0x5d9022[_0x134e('0x37')]=_['keys'](_0x48da68[_0x134e('0x37')]);_0x5d9022[_0x134e('0x39')]=_['intersection'](_0x5d9022['model'],_0x5d9022[_0x134e('0x37')]);_0x238420['attributes']=_['intersection'](_0x5d9022[_0x134e('0x36')],qs[_0x134e('0x3b')](_0x48da68[_0x134e('0x37')][_0x134e('0x3b')]));_0x238420[_0x134e('0x3c')]=_0x238420[_0x134e('0x3c')][_0x134e('0x3d')]?_0x238420['attributes']:_0x5d9022[_0x134e('0x36')];if(_0x48da68[_0x134e('0x37')][_0x134e('0x46')]){_0x238420[_0x134e('0x47')]=[{'all':!![]}];}_0x238420=_[_0x134e('0x44')]({},_0x238420,_0x48da68['options']);return db[_0x134e('0x31')][_0x134e('0x4c')](_0x238420)[_0x134e('0x2a')](handleEntityNotFound(_0x4c4d08,null))[_0x134e('0x2a')](respondWithResult(_0x4c4d08,null))[_0x134e('0x4d')](handleError(_0x4c4d08,null));};exports[_0x134e('0x4e')]=function(_0x2f7a24,_0x5b4de1){return db[_0x134e('0x31')][_0x134e('0x4e')](_0x2f7a24['body'],{})[_0x134e('0x2a')](respondWithResult(_0x5b4de1,0xc9))['catch'](handleError(_0x5b4de1,null));};exports[_0x134e('0x28')]=function(_0x32f7ba,_0x415115){if(_0x32f7ba[_0x134e('0x4f')]['id']){delete _0x32f7ba[_0x134e('0x4f')]['id'];}return db[_0x134e('0x31')]['find']({'where':{'id':_0x32f7ba[_0x134e('0x4b')]['id']}})[_0x134e('0x2a')](handleEntityNotFound(_0x415115,null))[_0x134e('0x2a')](saveUpdates(_0x32f7ba[_0x134e('0x4f')],null))[_0x134e('0x2a')](respondWithResult(_0x415115,null))[_0x134e('0x4d')](handleError(_0x415115,null));};exports[_0x134e('0x29')]=function(_0x1c16e5,_0x29352c){return db[_0x134e('0x31')][_0x134e('0x4c')]({'where':{'id':_0x1c16e5['params']['id']}})[_0x134e('0x2a')](handleEntityNotFound(_0x29352c,null))[_0x134e('0x2a')](removeEntity(_0x29352c,null))[_0x134e('0x4d')](handleError(_0x29352c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a92d322..204ce24 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 _0x58c6=['define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x58c6,0x1f4));var _0x658c=function(_0x1b3f52,_0x4f5b13){_0x1b3f52=_0x1b3f52-0x0;var _0x36bf2c=_0x58c6[_0x1b3f52];return _0x36bf2c;};'use strict';var _=require(_0x658c('0x0'));var util=require(_0x658c('0x1'));var logger=require(_0x658c('0x2'))(_0x658c('0x3'));var moment=require(_0x658c('0x4'));var BPromise=require(_0x658c('0x5'));var rp=require(_0x658c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x658c('0x7'));var config=require(_0x658c('0x8'));var attributes=require(_0x658c('0x9'));module['exports']=function(_0x20013c,_0x3cacac){return _0x20013c[_0x658c('0xa')]('ZendeskField',attributes,{'tableName':_0x658c('0xb'),'paranoid':![],'indexes':[{'name':_0x658c('0xc'),'fields':[_0x658c('0xd'),_0x658c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0382=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','FieldId'];(function(_0x13e6e1,_0x22c6f9){var _0xab9bd6=function(_0x52475e){while(--_0x52475e){_0x13e6e1['push'](_0x13e6e1['shift']());}};_0xab9bd6(++_0x22c6f9);}(_0x0382,0x8c));var _0x2038=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x0382[_0x903228];return _0xcec81d;};'use strict';var _=require(_0x2038('0x0'));var util=require(_0x2038('0x1'));var logger=require(_0x2038('0x2'))(_0x2038('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2038('0x4'));var fs=require('fs');var path=require(_0x2038('0x5'));var rimraf=require(_0x2038('0x6'));var config=require(_0x2038('0x7'));var attributes=require(_0x2038('0x8'));module[_0x2038('0x9')]=function(_0x50943a,_0x16be13){return _0x50943a[_0x2038('0xa')](_0x2038('0xb'),attributes,{'tableName':_0x2038('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x2038('0xd')],'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 ca8e394..301967a 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 _0x9696=['http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xdb5c63,_0x472168){var _0x2b9784=function(_0x48e28e){while(--_0x48e28e){_0xdb5c63['push'](_0xdb5c63['shift']());}};_0x2b9784(++_0x472168);}(_0x9696,0x85));var _0x6969=function(_0x4d2e8d,_0x34bb41){_0x4d2e8d=_0x4d2e8d-0x0;var _0x3cce50=_0x9696[_0x4d2e8d];return _0x3cce50;};'use strict';var _=require(_0x6969('0x0'));var util=require(_0x6969('0x1'));var moment=require('moment');var BPromise=require(_0x6969('0x2'));var rs=require(_0x6969('0x3'));var fs=require('fs');var Redis=require(_0x6969('0x4'));var db=require(_0x6969('0x5'))['db'];var utils=require(_0x6969('0x6'));var logger=require(_0x6969('0x7'))(_0x6969('0x8'));var config=require('../../config/environment');var jayson=require(_0x6969('0x9'));var client=jayson[_0x6969('0xa')][_0x6969('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ab08,_0x1bee70,_0xb8eea5){return new BPromise(function(_0x318098,_0x1ea31b){return client[_0x6969('0xc')](_0x23ab08,_0xb8eea5)[_0x6969('0xd')](function(_0x45c472){logger[_0x6969('0xe')](_0x6969('0xf'),_0x1bee70,'request\x20sent');logger[_0x6969('0x10')](_0x6969('0x11'),_0x1bee70,'request\x20sent',JSON[_0x6969('0x12')](_0x45c472));if(_0x45c472[_0x6969('0x13')]){if(_0x45c472[_0x6969('0x13')][_0x6969('0x14')]===0x1f4){logger[_0x6969('0x13')](_0x6969('0xf'),_0x1bee70,_0x45c472[_0x6969('0x13')][_0x6969('0x15')]);return _0x1ea31b(_0x45c472[_0x6969('0x13')][_0x6969('0x15')]);}logger['error'](_0x6969('0xf'),_0x1bee70,_0x45c472['error'][_0x6969('0x15')]);return _0x318098(_0x45c472[_0x6969('0x13')]['message']);}else{logger[_0x6969('0xe')](_0x6969('0xf'),_0x1bee70,'request\x20sent');_0x318098(_0x45c472[_0x6969('0x16')][_0x6969('0x15')]);}})[_0x6969('0x17')](function(_0x2e746f){logger[_0x6969('0x13')](_0x6969('0xf'),_0x1bee70,_0x2e746f);_0x1ea31b(_0x2e746f);});});} \ No newline at end of file +var _0xbc07=['../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','catch','util','moment','bluebird','../../mysqldb'];(function(_0x2fcab3,_0x56e2a0){var _0x5da536=function(_0xb7325c){while(--_0xb7325c){_0x2fcab3['push'](_0x2fcab3['shift']());}};_0x5da536(++_0x56e2a0);}(_0xbc07,0x183));var _0x7bc0=function(_0x539811,_0x703df8){_0x539811=_0x539811-0x0;var _0x3f653b=_0xbc07[_0x539811];return _0x3f653b;};'use strict';var _=require('lodash');var util=require(_0x7bc0('0x0'));var moment=require(_0x7bc0('0x1'));var BPromise=require(_0x7bc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bc0('0x3'))['db'];var utils=require(_0x7bc0('0x4'));var logger=require(_0x7bc0('0x5'))(_0x7bc0('0x6'));var config=require(_0x7bc0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bc0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x462568,_0x3d16fa,_0x2a2a05){return new BPromise(function(_0x27d8c3,_0x5e2634){return client['request'](_0x462568,_0x2a2a05)['then'](function(_0x56d562){logger[_0x7bc0('0x9')]('ZendeskField,\x20%s,\x20%s',_0x3d16fa,_0x7bc0('0xa'));logger['debug'](_0x7bc0('0xb'),_0x3d16fa,_0x7bc0('0xa'),JSON['stringify'](_0x56d562));if(_0x56d562[_0x7bc0('0xc')]){if(_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xd')]===0x1f4){logger[_0x7bc0('0xc')](_0x7bc0('0xe'),_0x3d16fa,_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xf')]);return _0x5e2634(_0x56d562['error'][_0x7bc0('0xf')]);}logger['error'](_0x7bc0('0xe'),_0x3d16fa,_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xf')]);return _0x27d8c3(_0x56d562[_0x7bc0('0xc')][_0x7bc0('0xf')]);}else{logger[_0x7bc0('0x9')](_0x7bc0('0xe'),_0x3d16fa,_0x7bc0('0xa'));_0x27d8c3(_0x56d562['result'][_0x7bc0('0xf')]);}})[_0x7bc0('0x10')](function(_0x3b27e1){logger[_0x7bc0('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3d16fa,_0x3b27e1);_0x5e2634(_0x3b27e1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index b5e1590..00bdd49 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 _0xe859=['delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update'];(function(_0x50abf5,_0x4701dd){var _0x5e45c9=function(_0x35f2bd){while(--_0x35f2bd){_0x50abf5['push'](_0x50abf5['shift']());}};_0x5e45c9(++_0x4701dd);}(_0xe859,0x162));var _0x9e85=function(_0x2a5aa7,_0x1ed6ed){_0x2a5aa7=_0x2a5aa7-0x0;var _0xf6f328=_0xe859[_0x2a5aa7];return _0xf6f328;};'use strict';var multer=require('multer');var util=require(_0x9e85('0x0'));var path=require(_0x9e85('0x1'));var timeout=require('connect-timeout');var express=require(_0x9e85('0x2'));var router=express[_0x9e85('0x3')]();var fs_extra=require(_0x9e85('0x4'));var auth=require(_0x9e85('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9e85('0x6'));var controller=require(_0x9e85('0x7'));router[_0x9e85('0x8')]('/',auth[_0x9e85('0x9')](),controller['index']);router[_0x9e85('0x8')](_0x9e85('0xa'),auth[_0x9e85('0x9')](),controller[_0x9e85('0xb')]);router[_0x9e85('0x8')](_0x9e85('0xc'),auth[_0x9e85('0x9')](),controller[_0x9e85('0xd')]);router[_0x9e85('0x8')](_0x9e85('0xe'),auth[_0x9e85('0x9')](),controller[_0x9e85('0xf')]);router[_0x9e85('0x10')]('/',auth['isAuthenticated'](),controller[_0x9e85('0x11')]);router['post'](_0x9e85('0xc'),auth[_0x9e85('0x9')](),controller[_0x9e85('0x12')]);router['put'](_0x9e85('0xa'),auth[_0x9e85('0x9')](),controller[_0x9e85('0x13')]);router[_0x9e85('0x14')](_0x9e85('0xa'),auth[_0x9e85('0x9')](),controller['destroy']);module[_0x9e85('0x15')]=router; \ No newline at end of file +var _0xcef3=['/:id','/:id/configurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get'];(function(_0x331ed5,_0x465ece){var _0x187185=function(_0x560827){while(--_0x560827){_0x331ed5['push'](_0x331ed5['shift']());}};_0x187185(++_0x465ece);}(_0xcef3,0x88));var _0x3cef=function(_0x5459c1,_0x36f6f0){_0x5459c1=_0x5459c1-0x0;var _0x3f99b5=_0xcef3[_0x5459c1];return _0x3f99b5;};'use strict';var multer=require(_0x3cef('0x0'));var util=require(_0x3cef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cef('0x2')]();var fs_extra=require(_0x3cef('0x3'));var auth=require(_0x3cef('0x4'));var interaction=require(_0x3cef('0x5'));var config=require(_0x3cef('0x6'));var controller=require(_0x3cef('0x7'));router['get']('/',auth[_0x3cef('0x8')](),controller[_0x3cef('0x9')]);router[_0x3cef('0xa')](_0x3cef('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3cef('0xc'),auth[_0x3cef('0x8')](),controller['getConfigurations']);router[_0x3cef('0xa')]('/:id/fields',auth[_0x3cef('0x8')](),controller[_0x3cef('0xd')]);router[_0x3cef('0xe')]('/',auth[_0x3cef('0x8')](),controller['create']);router[_0x3cef('0xe')]('/:id/configurations',auth[_0x3cef('0x8')](),controller[_0x3cef('0xf')]);router[_0x3cef('0x10')](_0x3cef('0xb'),auth[_0x3cef('0x8')](),controller[_0x3cef('0x11')]);router[_0x3cef('0x12')](_0x3cef('0xb'),auth[_0x3cef('0x8')](),controller[_0x3cef('0x13')]);module[_0x3cef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index bb04bc5..5ebefcd 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 _0x2750=['STRING','sequelize'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x2750,0x13b));var _0x0275=function(_0x119af4,_0x5d9039){_0x119af4=_0x119af4-0x0;var _0x521053=_0x2750[_0x119af4];return _0x521053;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'name':{'type':Sequelize[_0x0275('0x1')]},'description':{'type':Sequelize[_0x0275('0x1')]},'host':{'type':Sequelize[_0x0275('0x1')]},'zone':{'type':Sequelize[_0x0275('0x1')]},'clientId':{'type':Sequelize[_0x0275('0x1')]},'clientSecret':{'type':Sequelize[_0x0275('0x1')]},'serverUrl':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x0275('0x1')]},'refreshToken':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','STRING'];(function(_0x18261f,_0x3eddfa){var _0x1c5910=function(_0x57224e){while(--_0x57224e){_0x18261f['push'](_0x18261f['shift']());}};_0x1c5910(++_0x3eddfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f13dbae..7f1f760 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 _0x141d=['findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','clientSecret','serverUrl','code','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','map','ZohoAccount','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','catch','show','keys','rawAttributes','length','create','body','find','params','getConfigurations','addConfiguration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x141d,0x1be));var _0xd141=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x141d[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0xd141('0x0'));var rimraf=require(_0xd141('0x1'));var zipdir=require(_0xd141('0x2'));var jsonpatch=require(_0xd141('0x3'));var rp=require(_0xd141('0x4'));var moment=require('moment');var BPromise=require(_0xd141('0x5'));var Mustache=require(_0xd141('0x6'));var util=require(_0xd141('0x7'));var path=require(_0xd141('0x8'));var sox=require(_0xd141('0x9'));var csv=require(_0xd141('0xa'));var ejs=require(_0xd141('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd141('0xc'));var crypto=require(_0xd141('0xd'));var jsforce=require(_0xd141('0xe'));var deskjs=require(_0xd141('0xf'));var toCsv=require(_0xd141('0xa'));var querystring=require(_0xd141('0x10'));var Papa=require('papaparse');var Redis=require(_0xd141('0x11'));var authService=require(_0xd141('0x12'));var qs=require(_0xd141('0x13'));var as=require(_0xd141('0x14'));var hardwareService=require(_0xd141('0x15'));var logger=require(_0xd141('0x16'))('api');var utils=require(_0xd141('0x17'));var config=require(_0xd141('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd141('0x19'));function respondWithStatusCode(_0x53c55c,_0x16c651){_0x16c651=_0x16c651||0xcc;return function(_0x2368a){if(_0x2368a){return _0x53c55c[_0xd141('0x1a')](_0x16c651);}return _0x53c55c[_0xd141('0x1b')](_0x16c651)['end']();};}function respondWithResult(_0x329ee0,_0x294040){_0x294040=_0x294040||0xc8;return function(_0x43df31){if(_0x43df31){return _0x329ee0[_0xd141('0x1b')](_0x294040)['json'](_0x43df31);}};}function respondWithFilteredResult(_0x559080,_0x36001f){return function(_0x2c5944){if(_0x2c5944){var _0x2c16fd=typeof _0x36001f[_0xd141('0x1c')]===_0xd141('0x1d')&&typeof _0x36001f[_0xd141('0x1e')]===_0xd141('0x1d');var _0x1b2780=_0x2c5944[_0xd141('0x1f')];var _0x257992=_0x2c16fd?0x0:_0x36001f[_0xd141('0x1c')];var _0x2d1384=_0x2c16fd?_0x2c5944[_0xd141('0x1f')]:_0x36001f[_0xd141('0x1c')]+_0x36001f['limit'];var _0x37a5c0;if(_0x2d1384>=_0x1b2780){_0x2d1384=_0x1b2780;_0x37a5c0=0xc8;}else{_0x37a5c0=0xce;}_0x559080[_0xd141('0x1b')](_0x37a5c0);return _0x559080[_0xd141('0x20')](_0xd141('0x21'),_0x257992+'-'+_0x2d1384+'/'+_0x1b2780)[_0xd141('0x22')](_0x2c5944);}return null;};}function patchUpdates(_0x21dc61){return function(_0x58df08){try{jsonpatch['apply'](_0x58df08,_0x21dc61,!![]);}catch(_0x1796e1){return BPromise[_0xd141('0x23')](_0x1796e1);}return _0x58df08[_0xd141('0x24')]();};}function saveUpdates(_0x4e0f20,_0x55c78e){return function(_0x339f8b){if(_0x339f8b){return _0x339f8b[_0xd141('0x25')](_0x4e0f20)[_0xd141('0x26')](function(_0x1f8ec7){return _0x1f8ec7;});}return null;};}function removeEntity(_0x4f9d9e,_0x4342ce){return function(_0x3e0a11){if(_0x3e0a11){return _0x3e0a11[_0xd141('0x27')]()[_0xd141('0x26')](function(){_0x4f9d9e[_0xd141('0x1b')](0xcc)[_0xd141('0x28')]();});}};}function handleEntityNotFound(_0x540d99,_0x4e226c){return function(_0x5db5cf){if(!_0x5db5cf){_0x540d99[_0xd141('0x1a')](0x194);}return _0x5db5cf;};}function handleError(_0x5c4699,_0x18a9e){_0x18a9e=_0x18a9e||0x1f4;return function(_0x76cc84){logger['error'](_0x76cc84[_0xd141('0x29')]);if(_0x76cc84[_0xd141('0x2a')]){delete _0x76cc84['name'];}_0x5c4699[_0xd141('0x1b')](_0x18a9e)[_0xd141('0x2b')](_0x76cc84);};}exports[_0xd141('0x2c')]=function(_0x47301f,_0x18ac6a){var _0x315973={},_0x38fa89={},_0x2a2684={'count':0x0,'rows':[]};var _0x44ddde=_[_0xd141('0x2d')](db[_0xd141('0x2e')]['rawAttributes'],function(_0x2adf16){return{'name':_0x2adf16[_0xd141('0x2f')],'type':_0x2adf16['type'][_0xd141('0x30')]};});_0x38fa89[_0xd141('0x31')]=_[_0xd141('0x2d')](_0x44ddde,_0xd141('0x2a'));_0x38fa89[_0xd141('0x32')]=_['keys'](_0x47301f[_0xd141('0x32')]);_0x38fa89[_0xd141('0x33')]=_[_0xd141('0x34')](_0x38fa89['model'],_0x38fa89[_0xd141('0x32')]);_0x315973[_0xd141('0x35')]=_[_0xd141('0x34')](_0x38fa89[_0xd141('0x31')],qs['fields'](_0x47301f[_0xd141('0x32')][_0xd141('0x36')]));_0x315973['attributes']=_0x315973[_0xd141('0x35')]['length']?_0x315973[_0xd141('0x35')]:_0x38fa89[_0xd141('0x31')];if(!_0x47301f[_0xd141('0x32')][_0xd141('0x37')](_0xd141('0x38'))){_0x315973[_0xd141('0x1e')]=qs['limit'](_0x47301f[_0xd141('0x32')][_0xd141('0x1e')]);_0x315973[_0xd141('0x1c')]=qs[_0xd141('0x1c')](_0x47301f['query']['offset']);}_0x315973[_0xd141('0x39')]=qs[_0xd141('0x3a')](_0x47301f[_0xd141('0x32')][_0xd141('0x3a')]);_0x315973[_0xd141('0x3b')]=qs[_0xd141('0x33')](_[_0xd141('0x3c')](_0x47301f[_0xd141('0x32')],_0x38fa89[_0xd141('0x33')]),_0x44ddde);if(_0x47301f[_0xd141('0x32')][_0xd141('0x3d')]){_0x315973[_0xd141('0x3b')]=_[_0xd141('0x3e')](_0x315973[_0xd141('0x3b')],{'$or':_['map'](_0x44ddde,function(_0x23cea8){if(_0x23cea8[_0xd141('0x3f')]!=='VIRTUAL'){var _0x466fff={};_0x466fff[_0x23cea8['name']]={'$like':'%'+_0x47301f[_0xd141('0x32')][_0xd141('0x3d')]+'%'};return _0x466fff;}})});}_0x315973=_['merge']({},_0x315973,_0x47301f[_0xd141('0x40')]);var _0x113a63={'where':_0x315973[_0xd141('0x3b')]};return db[_0xd141('0x2e')][_0xd141('0x1f')](_0x113a63)[_0xd141('0x26')](function(_0x97abda){_0x2a2684['count']=_0x97abda;if(_0x47301f[_0xd141('0x32')][_0xd141('0x41')]){_0x315973['include']=[{'all':!![]}];}return db[_0xd141('0x2e')][_0xd141('0x42')](_0x315973);})['then'](function(_0x163c68){_0x2a2684['rows']=_0x163c68;return _0x2a2684;})[_0xd141('0x26')](respondWithFilteredResult(_0x18ac6a,_0x315973))[_0xd141('0x43')](handleError(_0x18ac6a,null));};exports[_0xd141('0x44')]=function(_0x2e4e92,_0x1eb17a){var _0x2b5812={'raw':![],'where':{'id':_0x2e4e92['params']['id']}},_0x13689b={};_0x13689b['model']=_[_0xd141('0x45')](db[_0xd141('0x2e')][_0xd141('0x46')]);_0x13689b[_0xd141('0x32')]=_[_0xd141('0x45')](_0x2e4e92['query']);_0x13689b[_0xd141('0x33')]=_[_0xd141('0x34')](_0x13689b[_0xd141('0x31')],_0x13689b[_0xd141('0x32')]);_0x2b5812[_0xd141('0x35')]=_[_0xd141('0x34')](_0x13689b[_0xd141('0x31')],qs[_0xd141('0x36')](_0x2e4e92[_0xd141('0x32')]['fields']));_0x2b5812[_0xd141('0x35')]=_0x2b5812[_0xd141('0x35')][_0xd141('0x47')]?_0x2b5812['attributes']:_0x13689b[_0xd141('0x31')];if(_0x2e4e92['query'][_0xd141('0x41')]){_0x2b5812['include']=[{'all':!![]}];}_0x2b5812=_[_0xd141('0x3e')]({},_0x2b5812,_0x2e4e92[_0xd141('0x40')]);return db[_0xd141('0x2e')]['find'](_0x2b5812)['then'](handleEntityNotFound(_0x1eb17a,null))[_0xd141('0x26')](respondWithResult(_0x1eb17a,null))['catch'](handleError(_0x1eb17a,null));};exports[_0xd141('0x48')]=function(_0x1ec5ee,_0x56db60){return db[_0xd141('0x2e')]['create'](_0x1ec5ee[_0xd141('0x49')],{})[_0xd141('0x26')](respondWithResult(_0x56db60,0xc9))[_0xd141('0x43')](handleError(_0x56db60,null));};exports[_0xd141('0x25')]=function(_0x277607,_0x5ce259){if(_0x277607[_0xd141('0x49')]['id']){delete _0x277607[_0xd141('0x49')]['id'];}return db[_0xd141('0x2e')][_0xd141('0x4a')]({'where':{'id':_0x277607[_0xd141('0x4b')]['id']}})[_0xd141('0x26')](handleEntityNotFound(_0x5ce259,null))[_0xd141('0x26')](saveUpdates(_0x277607[_0xd141('0x49')],null))[_0xd141('0x26')](respondWithResult(_0x5ce259,null))[_0xd141('0x43')](handleError(_0x5ce259,null));};exports[_0xd141('0x27')]=function(_0xec821b,_0xc7509b){return db[_0xd141('0x2e')][_0xd141('0x4a')]({'where':{'id':_0xec821b[_0xd141('0x4b')]['id']}})[_0xd141('0x26')](handleEntityNotFound(_0xc7509b,null))[_0xd141('0x26')](removeEntity(_0xc7509b,null))['catch'](handleError(_0xc7509b,null));};exports[_0xd141('0x4c')]=function(_0x54de7e,_0x364a50,_0x3f9928){var _0x1269cf={};var _0x4a92ca={};var _0xc05808;var _0x585aaf;return db[_0xd141('0x2e')]['findOne']({'where':{'id':_0x54de7e['params']['id']}})[_0xd141('0x26')](handleEntityNotFound(_0x364a50,null))[_0xd141('0x26')](function(_0x241ac9){if(_0x241ac9){_0xc05808=_0x241ac9;_0x4a92ca['model']=_[_0xd141('0x45')](db['ZohoConfiguration'][_0xd141('0x46')]);_0x4a92ca[_0xd141('0x32')]=_[_0xd141('0x45')](_0x54de7e[_0xd141('0x32')]);_0x4a92ca[_0xd141('0x33')]=_[_0xd141('0x34')](_0x4a92ca[_0xd141('0x31')],_0x4a92ca[_0xd141('0x32')]);_0x1269cf[_0xd141('0x35')]=_[_0xd141('0x34')](_0x4a92ca[_0xd141('0x31')],qs['fields'](_0x54de7e['query']['fields']));_0x1269cf['attributes']=_0x1269cf[_0xd141('0x35')][_0xd141('0x47')]?_0x1269cf['attributes']:_0x4a92ca['model'];_0x1269cf[_0xd141('0x39')]=qs['sort'](_0x54de7e['query']['sort']);_0x1269cf[_0xd141('0x3b')]=qs[_0xd141('0x33')](_['pick'](_0x54de7e['query'],_0x4a92ca[_0xd141('0x33')]));if(_0x54de7e[_0xd141('0x32')][_0xd141('0x3d')]){_0x1269cf[_0xd141('0x3b')]=_[_0xd141('0x3e')](_0x1269cf[_0xd141('0x3b')],{'$or':_[_0xd141('0x2d')](_0x1269cf[_0xd141('0x35')],function(_0x35fac8){var _0x1bec4e={};_0x1bec4e[_0x35fac8]={'$like':'%'+_0x54de7e[_0xd141('0x32')]['filter']+'%'};return _0x1bec4e;})});}_0x1269cf=_['merge']({},_0x1269cf,_0x54de7e[_0xd141('0x40')]);return _0xc05808[_0xd141('0x4c')](_0x1269cf);}})['then'](function(_0x4b74dc){if(_0x4b74dc){_0x585aaf=_0x4b74dc[_0xd141('0x47')];if(!_0x54de7e[_0xd141('0x32')][_0xd141('0x37')]('nolimit')){_0x1269cf[_0xd141('0x1e')]=qs['limit'](_0x54de7e[_0xd141('0x32')][_0xd141('0x1e')]);_0x1269cf[_0xd141('0x1c')]=qs['offset'](_0x54de7e[_0xd141('0x32')][_0xd141('0x1c')]);}return _0xc05808['getConfigurations'](_0x1269cf);}})['then'](function(_0x2253de){if(_0x2253de){return _0x2253de?{'count':_0x585aaf,'rows':_0x2253de}:null;}})[_0xd141('0x26')](respondWithResult(_0x364a50,null))[_0xd141('0x43')](handleError(_0x364a50,null));};exports[_0xd141('0x4d')]=function(_0x581bcc,_0x4ac419,_0x41217a){if(_0x581bcc[_0xd141('0x49')]['id']){delete _0x581bcc[_0xd141('0x49')]['id'];}return db[_0xd141('0x2e')][_0xd141('0x4e')]({'where':{'id':_0x581bcc[_0xd141('0x4b')]['id']}})[_0xd141('0x26')](handleEntityNotFound(_0x4ac419,null))[_0xd141('0x26')](function(_0x4145de){if(_0x4145de){_0x581bcc[_0xd141('0x49')][_0xd141('0x4f')]=_0x4145de['id'];_0x581bcc['body'][_0xd141('0x50')]=integrations[_0xd141('0x51')](_0x581bcc[_0xd141('0x49')][_0xd141('0x52')],_0x581bcc[_0xd141('0x49')]['type']);_0x581bcc[_0xd141('0x49')]['Descriptions']=integrations[_0xd141('0x53')](_0x581bcc[_0xd141('0x49')]['channel'],_0x581bcc[_0xd141('0x49')][_0xd141('0x3f')]);return db[_0xd141('0x54')]['create'](_0x581bcc[_0xd141('0x49')],{'include':[{'model':db[_0xd141('0x55')],'as':'Subjects'},{'model':db[_0xd141('0x55')],'as':_0xd141('0x56')}]});}return null;})[_0xd141('0x26')](respondWithResult(_0x4ac419,null))[_0xd141('0x43')](handleError(_0x4ac419,null));};function getAccessToken(_0x259d5e){return new Promise(function(_0x1082c8,_0x1c77a1){var _0x2e4a3c;switch(_0x259d5e['zone']){case'US':_0x2e4a3c='https://accounts.zoho.com';break;case'AU':_0x2e4a3c=_0xd141('0x57');break;case'EU':_0x2e4a3c='https://accounts.zoho.eu';break;case'IN':_0x2e4a3c='https://accounts.zoho.in';break;case'CN':_0x2e4a3c=_0xd141('0x58');break;default:_0x2e4a3c=_0xd141('0x59');break;}var _0x22c8d7={'method':_0xd141('0x5a'),'uri':_0x2e4a3c+_0xd141('0x5b'),'qs':{'refresh_token':_0x259d5e[_0xd141('0x5c')],'client_id':_0x259d5e[_0xd141('0x5d')],'client_secret':_0x259d5e['clientSecret'],'grant_type':_0xd141('0x5e')},'json':!![]};return rp(_0x22c8d7)['then'](function(_0x2d1785){if(_0x2d1785['access_token']){_0x1082c8(_0x2d1785[_0xd141('0x5f')]);}else{_0x1c77a1('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd141('0x43')](function(_0x363583){_0x1c77a1(_0x363583);});});}exports[_0xd141('0x60')]=function(_0xe2f054,_0x268586,_0x44503b){var _0x51b203,_0x2aef97,_0x45d89f,_0x2150b8,_0x558923;return db[_0xd141('0x2e')][_0xd141('0x4e')]({'where':{'id':_0xe2f054[_0xd141('0x4b')]['id']},'attributes':['id','host','zone','clientId',_0xd141('0x61'),_0xd141('0x62'),_0xd141('0x63'),_0xd141('0x5c')]})[_0xd141('0x26')](handleEntityNotFound(_0x268586,null))[_0xd141('0x26')](function(_0x9bad80){_0x558923=_0x9bad80;_0x51b203=_0x558923[_0xd141('0x64')];_0x2aef97=_0x51b203===_0xd141('0x65')?'eu':_0xd141('0x66');_0x45d89f=_0x558923['serverUrl'];var _0x141fd7=_0x45d89f[_0xd141('0x67')](-0x1);if(_0x141fd7==='/'||_0x141fd7==='\x5c'||_0x141fd7===':'){_0x45d89f=_0x45d89f[_0xd141('0x68')](0x0,_0x45d89f[_0xd141('0x69')](_0x141fd7));}if(!_0x558923[_0xd141('0x5c')]){throw new Error(_0xd141('0x6a'));}return getAccessToken(_0x558923);})[_0xd141('0x26')](function(_0x498314){if(_0x498314){return rp({'method':_0xd141('0x6b'),'uri':util[_0xd141('0x6c')](_0xd141('0x6d'),_0x2aef97),'qs':{'module':_0xd141('0x6e')},'headers':{'Authorization':_0xd141('0x6f')+_0x498314},'json':!![]});}})[_0xd141('0x26')](function(_0x4d08d5){if(_0x4d08d5){if(_0x4d08d5[_0xd141('0x70')]&&_0x4d08d5['response'][_0xd141('0x71')]){throw new Error(_0x4d08d5[_0xd141('0x70')][_0xd141('0x71')][_0xd141('0x72')]);}var _0x940448=[];var _0x55b48b=[];var _0x34e8a1=['Owner',_0xd141('0x73'),_0xd141('0x74'),_0xd141('0x75'),_0xd141('0x76'),_0xd141('0x77'),'Call_Start_Time',_0xd141('0x78')];_0x55b48b=_[_0xd141('0x79')](_0x4d08d5['fields'],function(_0x170eb9){return _0x34e8a1['includes'](_0x170eb9['api_name']);});for(var _0xfe33c9=0x0;_0xfe33c9<_0x55b48b['length'];_0xfe33c9++){if(_0x55b48b[_0xfe33c9][_0xd141('0x7a')]===![]){_0x940448[_0xd141('0x7b')]({'id':_0x55b48b[_0xfe33c9]['id'],'name':_0x55b48b[_0xfe33c9][_0xd141('0x7c')],'custom':_0x55b48b[_0xfe33c9]['custom_field'],'options':_0x55b48b[_0xfe33c9][_0xd141('0x7d')]===_0xd141('0x7e')&&_0x55b48b[_0xfe33c9][_0xd141('0x7f')][_0xd141('0x47')]>-0x1?_[_0xd141('0x2d')](_0x55b48b[_0xfe33c9]['pick_list_values'],function(_0x5ae1cb){return{'name':_0x5ae1cb,'value':_0x5ae1cb};}):[]});}}return{'count':_0x940448[_0xd141('0x47')],'rows':_0x940448};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x268586,null))['catch'](function(_0x783e22){var _0x166ffe=_0xe2f054[_0xd141('0x32')][_0xd141('0x80')]?0x1f4:_0x783e22['statusCode']||0x1f4;logger[_0xd141('0x71')]('getFields,\x20%s,\x20%s,\x20%s',_0xd141('0x60'),_0x166ffe,JSON[_0xd141('0x81')](_0x783e22));delete _0x783e22[_0xd141('0x2a')];if(_0x166ffe===0x191){_0x166ffe=0x190;}_0x268586[_0xd141('0x1b')](_0x166ffe)[_0xd141('0x2b')](_0xe2f054[_0xd141('0x32')][_0xd141('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x783e22[_0xd141('0x82')]}:_0x783e22);});}; \ No newline at end of file +var _0x870c=['filters','intersection','attributes','model','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','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','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientId','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','data_type','pick_list_values','test','statusCode','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','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','error','stack','name','send','map','ZohoAccount','rawAttributes','type','key','query','keys'];(function(_0x3a2f1c,_0x1fb97c){var _0x533dc5=function(_0x578882){while(--_0x578882){_0x3a2f1c['push'](_0x3a2f1c['shift']());}};_0x533dc5(++_0x1fb97c);}(_0x870c,0xd5));var _0xc870=function(_0x544b75,_0x5295cd){_0x544b75=_0x544b75-0x0;var _0x25ee75=_0x870c[_0x544b75];return _0x25ee75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc870('0x0'));var zipdir=require(_0xc870('0x1'));var jsonpatch=require(_0xc870('0x2'));var rp=require(_0xc870('0x3'));var moment=require(_0xc870('0x4'));var BPromise=require(_0xc870('0x5'));var Mustache=require(_0xc870('0x6'));var util=require(_0xc870('0x7'));var path=require(_0xc870('0x8'));var sox=require(_0xc870('0x9'));var csv=require(_0xc870('0xa'));var ejs=require(_0xc870('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc870('0xc'));var squel=require(_0xc870('0xd'));var crypto=require(_0xc870('0xe'));var jsforce=require(_0xc870('0xf'));var deskjs=require(_0xc870('0x10'));var toCsv=require(_0xc870('0xa'));var querystring=require(_0xc870('0x11'));var Papa=require('papaparse');var Redis=require(_0xc870('0x12'));var authService=require(_0xc870('0x13'));var qs=require(_0xc870('0x14'));var as=require(_0xc870('0x15'));var hardwareService=require(_0xc870('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc870('0x17'));var config=require(_0xc870('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc870('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2dcc4b,_0x4bfc19){_0x4bfc19=_0x4bfc19||0xcc;return function(_0x304317){if(_0x304317){return _0x2dcc4b[_0xc870('0x1a')](_0x4bfc19);}return _0x2dcc4b[_0xc870('0x1b')](_0x4bfc19)[_0xc870('0x1c')]();};}function respondWithResult(_0x7c3430,_0x4d0f92){_0x4d0f92=_0x4d0f92||0xc8;return function(_0x20bc02){if(_0x20bc02){return _0x7c3430[_0xc870('0x1b')](_0x4d0f92)[_0xc870('0x1d')](_0x20bc02);}};}function respondWithFilteredResult(_0x34fbdc,_0x1d2408){return function(_0x55a2ec){if(_0x55a2ec){var _0x2d818c=typeof _0x1d2408[_0xc870('0x1e')]===_0xc870('0x1f')&&typeof _0x1d2408[_0xc870('0x20')]===_0xc870('0x1f');var _0x89679e=_0x55a2ec[_0xc870('0x21')];var _0xd998d3=_0x2d818c?0x0:_0x1d2408[_0xc870('0x1e')];var _0x392cf6=_0x2d818c?_0x55a2ec['count']:_0x1d2408[_0xc870('0x1e')]+_0x1d2408[_0xc870('0x20')];var _0xa02655;if(_0x392cf6>=_0x89679e){_0x392cf6=_0x89679e;_0xa02655=0xc8;}else{_0xa02655=0xce;}_0x34fbdc['status'](_0xa02655);return _0x34fbdc[_0xc870('0x22')]('Content-Range',_0xd998d3+'-'+_0x392cf6+'/'+_0x89679e)['json'](_0x55a2ec);}return null;};}function patchUpdates(_0x22e1d5){return function(_0x58d494){try{jsonpatch[_0xc870('0x23')](_0x58d494,_0x22e1d5,!![]);}catch(_0x2be13e){return BPromise[_0xc870('0x24')](_0x2be13e);}return _0x58d494['save']();};}function saveUpdates(_0x44c998,_0x1d072a){return function(_0x49b300){if(_0x49b300){return _0x49b300['update'](_0x44c998)[_0xc870('0x25')](function(_0x4c6132){return _0x4c6132;});}return null;};}function removeEntity(_0x4557ca,_0x59c138){return function(_0x1fb36d){if(_0x1fb36d){return _0x1fb36d['destroy']()[_0xc870('0x25')](function(){_0x4557ca[_0xc870('0x1b')](0xcc)[_0xc870('0x1c')]();});}};}function handleEntityNotFound(_0x4b17fc,_0x31a9fc){return function(_0x45f9a3){if(!_0x45f9a3){_0x4b17fc['sendStatus'](0x194);}return _0x45f9a3;};}function handleError(_0x5a2263,_0x4149de){_0x4149de=_0x4149de||0x1f4;return function(_0xd7b269){logger[_0xc870('0x26')](_0xd7b269[_0xc870('0x27')]);if(_0xd7b269[_0xc870('0x28')]){delete _0xd7b269[_0xc870('0x28')];}_0x5a2263[_0xc870('0x1b')](_0x4149de)[_0xc870('0x29')](_0xd7b269);};}exports['index']=function(_0x3edd42,_0x2973f0){var _0x176f44={},_0x449eb3={},_0x3a5f42={'count':0x0,'rows':[]};var _0x2e9c43=_[_0xc870('0x2a')](db[_0xc870('0x2b')][_0xc870('0x2c')],function(_0x5973e9){return{'name':_0x5973e9['fieldName'],'type':_0x5973e9[_0xc870('0x2d')][_0xc870('0x2e')]};});_0x449eb3['model']=_['map'](_0x2e9c43,_0xc870('0x28'));_0x449eb3[_0xc870('0x2f')]=_[_0xc870('0x30')](_0x3edd42[_0xc870('0x2f')]);_0x449eb3[_0xc870('0x31')]=_[_0xc870('0x32')](_0x449eb3['model'],_0x449eb3['query']);_0x176f44[_0xc870('0x33')]=_[_0xc870('0x32')](_0x449eb3[_0xc870('0x34')],qs[_0xc870('0x35')](_0x3edd42['query']['fields']));_0x176f44[_0xc870('0x33')]=_0x176f44[_0xc870('0x33')][_0xc870('0x36')]?_0x176f44[_0xc870('0x33')]:_0x449eb3['model'];if(!_0x3edd42[_0xc870('0x2f')]['hasOwnProperty'](_0xc870('0x37'))){_0x176f44['limit']=qs['limit'](_0x3edd42[_0xc870('0x2f')][_0xc870('0x20')]);_0x176f44[_0xc870('0x1e')]=qs[_0xc870('0x1e')](_0x3edd42[_0xc870('0x2f')][_0xc870('0x1e')]);}_0x176f44['order']=qs[_0xc870('0x38')](_0x3edd42['query']['sort']);_0x176f44['where']=qs[_0xc870('0x31')](_['pick'](_0x3edd42['query'],_0x449eb3['filters']),_0x2e9c43);if(_0x3edd42[_0xc870('0x2f')][_0xc870('0x39')]){_0x176f44['where']=_[_0xc870('0x3a')](_0x176f44[_0xc870('0x3b')],{'$or':_[_0xc870('0x2a')](_0x2e9c43,function(_0x1e9c57){if(_0x1e9c57[_0xc870('0x2d')]!==_0xc870('0x3c')){var _0x1e13c7={};_0x1e13c7[_0x1e9c57[_0xc870('0x28')]]={'$like':'%'+_0x3edd42[_0xc870('0x2f')]['filter']+'%'};return _0x1e13c7;}})});}_0x176f44=_[_0xc870('0x3a')]({},_0x176f44,_0x3edd42[_0xc870('0x3d')]);var _0x406c08={'where':_0x176f44['where']};return db[_0xc870('0x2b')][_0xc870('0x21')](_0x406c08)['then'](function(_0x5f04b7){_0x3a5f42[_0xc870('0x21')]=_0x5f04b7;if(_0x3edd42['query'][_0xc870('0x3e')]){_0x176f44[_0xc870('0x3f')]=[{'all':!![]}];}return db['ZohoAccount'][_0xc870('0x40')](_0x176f44);})[_0xc870('0x25')](function(_0x2d0b77){_0x3a5f42['rows']=_0x2d0b77;return _0x3a5f42;})[_0xc870('0x25')](respondWithFilteredResult(_0x2973f0,_0x176f44))[_0xc870('0x41')](handleError(_0x2973f0,null));};exports[_0xc870('0x42')]=function(_0x30bfe6,_0x599aea){var _0x4fd963={'raw':![],'where':{'id':_0x30bfe6[_0xc870('0x43')]['id']}},_0x407b89={};_0x407b89[_0xc870('0x34')]=_['keys'](db['ZohoAccount'][_0xc870('0x2c')]);_0x407b89[_0xc870('0x2f')]=_[_0xc870('0x30')](_0x30bfe6[_0xc870('0x2f')]);_0x407b89[_0xc870('0x31')]=_['intersection'](_0x407b89[_0xc870('0x34')],_0x407b89[_0xc870('0x2f')]);_0x4fd963[_0xc870('0x33')]=_[_0xc870('0x32')](_0x407b89[_0xc870('0x34')],qs[_0xc870('0x35')](_0x30bfe6['query'][_0xc870('0x35')]));_0x4fd963[_0xc870('0x33')]=_0x4fd963['attributes'][_0xc870('0x36')]?_0x4fd963[_0xc870('0x33')]:_0x407b89[_0xc870('0x34')];if(_0x30bfe6[_0xc870('0x2f')][_0xc870('0x3e')]){_0x4fd963[_0xc870('0x3f')]=[{'all':!![]}];}_0x4fd963=_[_0xc870('0x3a')]({},_0x4fd963,_0x30bfe6['options']);return db[_0xc870('0x2b')][_0xc870('0x44')](_0x4fd963)[_0xc870('0x25')](handleEntityNotFound(_0x599aea,null))['then'](respondWithResult(_0x599aea,null))['catch'](handleError(_0x599aea,null));};exports[_0xc870('0x45')]=function(_0x3528d8,_0x4bbbbd){return db[_0xc870('0x2b')][_0xc870('0x45')](_0x3528d8[_0xc870('0x46')],{})[_0xc870('0x25')](respondWithResult(_0x4bbbbd,0xc9))['catch'](handleError(_0x4bbbbd,null));};exports['update']=function(_0x12170f,_0x5011a0){if(_0x12170f[_0xc870('0x46')]['id']){delete _0x12170f[_0xc870('0x46')]['id'];}return db[_0xc870('0x2b')][_0xc870('0x44')]({'where':{'id':_0x12170f[_0xc870('0x43')]['id']}})['then'](handleEntityNotFound(_0x5011a0,null))[_0xc870('0x25')](saveUpdates(_0x12170f[_0xc870('0x46')],null))['then'](respondWithResult(_0x5011a0,null))['catch'](handleError(_0x5011a0,null));};exports[_0xc870('0x47')]=function(_0x108a43,_0x70d57){return db[_0xc870('0x2b')][_0xc870('0x44')]({'where':{'id':_0x108a43[_0xc870('0x43')]['id']}})[_0xc870('0x25')](handleEntityNotFound(_0x70d57,null))[_0xc870('0x25')](removeEntity(_0x70d57,null))[_0xc870('0x41')](handleError(_0x70d57,null));};exports[_0xc870('0x48')]=function(_0x2e15a4,_0x4bf737,_0xaf8c4){var _0xe657cf={};var _0x58a871={};var _0x4bf7a9;var _0x3c20ec;return db[_0xc870('0x2b')][_0xc870('0x49')]({'where':{'id':_0x2e15a4[_0xc870('0x43')]['id']}})[_0xc870('0x25')](handleEntityNotFound(_0x4bf737,null))[_0xc870('0x25')](function(_0x8a08ba){if(_0x8a08ba){_0x4bf7a9=_0x8a08ba;_0x58a871[_0xc870('0x34')]=_[_0xc870('0x30')](db[_0xc870('0x4a')][_0xc870('0x2c')]);_0x58a871[_0xc870('0x2f')]=_[_0xc870('0x30')](_0x2e15a4[_0xc870('0x2f')]);_0x58a871[_0xc870('0x31')]=_[_0xc870('0x32')](_0x58a871['model'],_0x58a871[_0xc870('0x2f')]);_0xe657cf['attributes']=_[_0xc870('0x32')](_0x58a871[_0xc870('0x34')],qs[_0xc870('0x35')](_0x2e15a4[_0xc870('0x2f')][_0xc870('0x35')]));_0xe657cf[_0xc870('0x33')]=_0xe657cf[_0xc870('0x33')][_0xc870('0x36')]?_0xe657cf[_0xc870('0x33')]:_0x58a871[_0xc870('0x34')];_0xe657cf[_0xc870('0x4b')]=qs[_0xc870('0x38')](_0x2e15a4[_0xc870('0x2f')][_0xc870('0x38')]);_0xe657cf[_0xc870('0x3b')]=qs[_0xc870('0x31')](_[_0xc870('0x4c')](_0x2e15a4[_0xc870('0x2f')],_0x58a871[_0xc870('0x31')]));if(_0x2e15a4[_0xc870('0x2f')][_0xc870('0x39')]){_0xe657cf[_0xc870('0x3b')]=_[_0xc870('0x3a')](_0xe657cf[_0xc870('0x3b')],{'$or':_[_0xc870('0x2a')](_0xe657cf[_0xc870('0x33')],function(_0x573a12){var _0x45efcf={};_0x45efcf[_0x573a12]={'$like':'%'+_0x2e15a4['query'][_0xc870('0x39')]+'%'};return _0x45efcf;})});}_0xe657cf=_['merge']({},_0xe657cf,_0x2e15a4['options']);return _0x4bf7a9['getConfigurations'](_0xe657cf);}})[_0xc870('0x25')](function(_0x59ab9b){if(_0x59ab9b){_0x3c20ec=_0x59ab9b[_0xc870('0x36')];if(!_0x2e15a4[_0xc870('0x2f')][_0xc870('0x4d')](_0xc870('0x37'))){_0xe657cf[_0xc870('0x20')]=qs['limit'](_0x2e15a4[_0xc870('0x2f')][_0xc870('0x20')]);_0xe657cf[_0xc870('0x1e')]=qs[_0xc870('0x1e')](_0x2e15a4['query'][_0xc870('0x1e')]);}return _0x4bf7a9[_0xc870('0x48')](_0xe657cf);}})[_0xc870('0x25')](function(_0x337e18){if(_0x337e18){return _0x337e18?{'count':_0x3c20ec,'rows':_0x337e18}:null;}})[_0xc870('0x25')](respondWithResult(_0x4bf737,null))[_0xc870('0x41')](handleError(_0x4bf737,null));};exports[_0xc870('0x4e')]=function(_0x537aa2,_0x591b8e,_0x3f0398){if(_0x537aa2[_0xc870('0x46')]['id']){delete _0x537aa2[_0xc870('0x46')]['id'];}return db[_0xc870('0x2b')][_0xc870('0x49')]({'where':{'id':_0x537aa2['params']['id']}})[_0xc870('0x25')](handleEntityNotFound(_0x591b8e,null))['then'](function(_0x548911){if(_0x548911){_0x537aa2[_0xc870('0x46')][_0xc870('0x4f')]=_0x548911['id'];_0x537aa2[_0xc870('0x46')][_0xc870('0x50')]=integrations[_0xc870('0x51')](_0x537aa2['body'][_0xc870('0x52')],_0x537aa2['body'][_0xc870('0x2d')]);_0x537aa2[_0xc870('0x46')][_0xc870('0x53')]=integrations[_0xc870('0x54')](_0x537aa2[_0xc870('0x46')][_0xc870('0x52')],_0x537aa2[_0xc870('0x46')][_0xc870('0x2d')]);return db[_0xc870('0x4a')][_0xc870('0x45')](_0x537aa2[_0xc870('0x46')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xc870('0x55')],'as':'Descriptions'}]});}return null;})[_0xc870('0x25')](respondWithResult(_0x591b8e,null))[_0xc870('0x41')](handleError(_0x591b8e,null));};function getAccessToken(_0x3e9828){return new Promise(function(_0x335d9b,_0x1458da){var _0x269a9e;switch(_0x3e9828['zone']){case'US':_0x269a9e=_0xc870('0x56');break;case'AU':_0x269a9e=_0xc870('0x57');break;case'EU':_0x269a9e=_0xc870('0x58');break;case'IN':_0x269a9e=_0xc870('0x59');break;case'CN':_0x269a9e=_0xc870('0x5a');break;default:_0x269a9e=_0xc870('0x58');break;}var _0x2ec446={'method':_0xc870('0x5b'),'uri':_0x269a9e+_0xc870('0x5c'),'qs':{'refresh_token':_0x3e9828[_0xc870('0x5d')],'client_id':_0x3e9828['clientId'],'client_secret':_0x3e9828['clientSecret'],'grant_type':_0xc870('0x5e')},'json':!![]};return rp(_0x2ec446)[_0xc870('0x25')](function(_0x3f4b09){if(_0x3f4b09[_0xc870('0x5f')]){_0x335d9b(_0x3f4b09['access_token']);}else{_0x1458da(_0xc870('0x60'));}})['catch'](function(_0x2fcf81){_0x1458da(_0x2fcf81);});});}exports[_0xc870('0x61')]=function(_0x4b4cc7,_0x40a5f3,_0x52e5bc){var _0x53551d,_0x3a2c00,_0x5b0613,_0x33ae93,_0x5ac669;return db[_0xc870('0x2b')]['findOne']({'where':{'id':_0x4b4cc7[_0xc870('0x43')]['id']},'attributes':['id',_0xc870('0x62'),_0xc870('0x63'),_0xc870('0x64'),'clientSecret',_0xc870('0x65'),'code',_0xc870('0x5d')]})[_0xc870('0x25')](handleEntityNotFound(_0x40a5f3,null))[_0xc870('0x25')](function(_0xb50563){_0x5ac669=_0xb50563;_0x53551d=_0x5ac669[_0xc870('0x62')];_0x3a2c00=_0x53551d===_0xc870('0x66')?'eu':_0xc870('0x67');_0x5b0613=_0x5ac669['serverUrl'];var _0x35eb8a=_0x5b0613[_0xc870('0x68')](-0x1);if(_0x35eb8a==='/'||_0x35eb8a==='\x5c'||_0x35eb8a===':'){_0x5b0613=_0x5b0613[_0xc870('0x69')](0x0,_0x5b0613[_0xc870('0x6a')](_0x35eb8a));}if(!_0x5ac669[_0xc870('0x5d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5ac669);})['then'](function(_0x45ba62){if(_0x45ba62){return rp({'method':'GET','uri':util[_0xc870('0x6b')](_0xc870('0x6c'),_0x3a2c00),'qs':{'module':'Calls'},'headers':{'Authorization':_0xc870('0x6d')+_0x45ba62},'json':!![]});}})[_0xc870('0x25')](function(_0x165e3f){if(_0x165e3f){if(_0x165e3f['response']&&_0x165e3f[_0xc870('0x6e')][_0xc870('0x26')]){throw new Error(_0x165e3f[_0xc870('0x6e')][_0xc870('0x26')][_0xc870('0x6f')]);}var _0x4bad42=[];var _0x45cb20=[];var _0x3f5a37=[_0xc870('0x70'),_0xc870('0x71'),_0xc870('0x72'),'WhoId',_0xc870('0x73'),_0xc870('0x74'),_0xc870('0x75'),_0xc870('0x76')];_0x45cb20=_[_0xc870('0x77')](_0x165e3f[_0xc870('0x35')],function(_0x4bdc8c){return _0x3f5a37[_0xc870('0x78')](_0x4bdc8c[_0xc870('0x79')]);});for(var _0x91d56e=0x0;_0x91d56e<_0x45cb20[_0xc870('0x36')];_0x91d56e++){if(_0x45cb20[_0x91d56e][_0xc870('0x7a')]===![]){_0x4bad42[_0xc870('0x7b')]({'id':_0x45cb20[_0x91d56e]['id'],'name':_0x45cb20[_0x91d56e]['display_label'],'custom':_0x45cb20[_0x91d56e]['custom_field'],'options':_0x45cb20[_0x91d56e][_0xc870('0x7c')]==='picklist'&&_0x45cb20[_0x91d56e][_0xc870('0x7d')][_0xc870('0x36')]>-0x1?_[_0xc870('0x2a')](_0x45cb20[_0x91d56e]['pick_list_values'],function(_0x23ef29){return{'name':_0x23ef29,'value':_0x23ef29};}):[]});}}return{'count':_0x4bad42[_0xc870('0x36')],'rows':_0x4bad42};}else{return{'count':0x0,'rows':[]};}})[_0xc870('0x25')](respondWithResult(_0x40a5f3,null))[_0xc870('0x41')](function(_0xac7198){var _0x1d7816=_0x4b4cc7[_0xc870('0x2f')][_0xc870('0x7e')]?0x1f4:_0xac7198[_0xc870('0x7f')]||0x1f4;logger['error'](_0xc870('0x80'),_0xc870('0x61'),_0x1d7816,JSON[_0xc870('0x81')](_0xac7198));delete _0xac7198[_0xc870('0x28')];if(_0x1d7816===0x191){_0x1d7816=0x190;}_0x40a5f3[_0xc870('0x1b')](_0x1d7816)['send'](_0x4b4cc7[_0xc870('0x2f')][_0xc870('0x7e')]?{'message':_0xc870('0x82'),'statusCode':_0xac7198['statusCode']}:_0xac7198);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f1d641e..5400666 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 _0x4bac=['../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','clientId','clientSecret','code','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','host','lastIndexOf','https://accounts.zoho.in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x17fed0,_0x281f6f){var _0x49fb26=function(_0x43e431){while(--_0x43e431){_0x17fed0['push'](_0x17fed0['shift']());}};_0x49fb26(++_0x281f6f);}(_0x4bac,0x1c5));var _0xc4ba=function(_0x107ce2,_0x6bb7b7){_0x107ce2=_0x107ce2-0x0;var _0x2d30d0=_0x4bac[_0x107ce2];return _0x2d30d0;};'use strict';var _=require(_0xc4ba('0x0'));var util=require(_0xc4ba('0x1'));var logger=require(_0xc4ba('0x2'))(_0xc4ba('0x3'));var moment=require(_0xc4ba('0x4'));var BPromise=require(_0xc4ba('0x5'));var rp=require(_0xc4ba('0x6'));var fs=require('fs');var path=require(_0xc4ba('0x7'));var rimraf=require(_0xc4ba('0x8'));var config=require(_0xc4ba('0x9'));var attributes=require(_0xc4ba('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xc4ba('0xb')]=function(_0xbd9c5e,_0x52428f){return _0xbd9c5e[_0xc4ba('0xc')]('ZohoAccount',attributes,{'tableName':_0xc4ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x125de2,_0x27e71b,_0x56d7b7){if(_0x125de2[_0xc4ba('0xe')]('zone')||_0x125de2[_0xc4ba('0xe')]('serverUrl')||_0x125de2[_0xc4ba('0xe')](_0xc4ba('0xf'))||_0x125de2['changed'](_0xc4ba('0x10'))||_0x125de2['changed'](_0xc4ba('0x11'))||_0x125de2[_0xc4ba('0xe')]('host')){var _0x248516,_0xf4b815;_0x248516=_0x125de2[_0xc4ba('0x12')];var _0x1c5ca7=_0x248516[_0xc4ba('0x13')](-0x1);if(_0x1c5ca7==='/'||_0x1c5ca7==='\x5c'||_0x1c5ca7===':'){_0x248516=_0x248516[_0xc4ba('0x14')](0x0,_0x248516['lastIndexOf'](_0x1c5ca7));}switch(_0x125de2['zone']){case'US':_0xf4b815=_0xc4ba('0x15');break;case'AU':_0xf4b815=_0xc4ba('0x16');break;case'IN':_0xf4b815='https://accounts.zoho.in';break;case'CN':_0xf4b815=_0xc4ba('0x17');break;default:_0xf4b815=_0xc4ba('0x18');break;}var _0x2ef413={'method':'POST','uri':_0xf4b815+_0xc4ba('0x19'),'form':{'grant_type':_0xc4ba('0x1a'),'client_id':_0x125de2[_0xc4ba('0xf')],'client_secret':_0x125de2['clientSecret'],'redirect_uri':_0x125de2[_0xc4ba('0x12')],'code':_0x125de2[_0xc4ba('0x11')]},'headers':{'Content-Type':_0xc4ba('0x1b')}};return rp(_0x2ef413)[_0xc4ba('0x1c')](function(_0x1156e3){var _0x1d7915=JSON[_0xc4ba('0x1d')](_0x1156e3);if(_0x1d7915['refresh_token']){_0x125de2[_0xc4ba('0x1e')]=_0x1d7915[_0xc4ba('0x1f')];logger['info'](util[_0xc4ba('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x125de2[_0xc4ba('0x21')],_0x125de2['id']));}else{logger[_0xc4ba('0x22')](util[_0xc4ba('0x20')](_0xc4ba('0x23'),_0x125de2[_0xc4ba('0x21')],_0x125de2['id']),util[_0xc4ba('0x24')](_0x1d7915,{'showHidden':![],'depth':null}));}return _0x56d7b7(null,_0x27e71b);})[_0xc4ba('0x25')](function(_0x19bf9b){logger[_0xc4ba('0x22')](util[_0xc4ba('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x125de2['name'],_0x125de2['id']),util[_0xc4ba('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x56d7b7(_0x19bf9b);});}else{return _0x56d7b7(null,_0x27e71b);}},'beforeUpdate':function(_0x4a2237,_0x3702bb,_0x14eec4){if(_0x4a2237[_0xc4ba('0xe')](_0xc4ba('0x26'))||_0x4a2237['changed'](_0xc4ba('0x12'))||_0x4a2237['changed']('clientId')||_0x4a2237['changed'](_0xc4ba('0x10'))||_0x4a2237[_0xc4ba('0xe')](_0xc4ba('0x11'))||_0x4a2237[_0xc4ba('0xe')](_0xc4ba('0x27'))){var _0x4ba930,_0xc19fa5;_0x4ba930=_0x4a2237[_0xc4ba('0x12')];var _0x13c111=_0x4ba930[_0xc4ba('0x13')](-0x1);if(_0x13c111==='/'||_0x13c111==='\x5c'||_0x13c111===':'){_0x4ba930=_0x4ba930['substring'](0x0,_0x4ba930[_0xc4ba('0x28')](_0x13c111));}switch(_0x4a2237[_0xc4ba('0x26')]){case'US':_0xc19fa5=_0xc4ba('0x15');break;case'AU':_0xc19fa5=_0xc4ba('0x16');break;case'IN':_0xc19fa5=_0xc4ba('0x29');break;case'CN':_0xc19fa5=_0xc4ba('0x17');break;default:_0xc19fa5=_0xc4ba('0x18');break;}var _0x2749b1={'method':'POST','uri':_0xc19fa5+'/oauth/v2/token','form':{'grant_type':_0xc4ba('0x1a'),'client_id':_0x4a2237[_0xc4ba('0xf')],'client_secret':_0x4a2237[_0xc4ba('0x10')],'redirect_uri':_0x4a2237['serverUrl'],'code':_0x4a2237[_0xc4ba('0x11')]},'headers':{'Content-Type':_0xc4ba('0x1b')}};return rp(_0x2749b1)[_0xc4ba('0x1c')](function(_0x4d0c8d){var _0x415b23=JSON['parse'](_0x4d0c8d);if(_0x415b23[_0xc4ba('0x1f')]){_0x4a2237[_0xc4ba('0x1e')]=_0x415b23[_0xc4ba('0x1f')];logger['info'](util[_0xc4ba('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a2237[_0xc4ba('0x21')],_0x4a2237['id']));}else{logger[_0xc4ba('0x22')](util['format'](_0xc4ba('0x23'),_0x4a2237['name'],_0x4a2237['id']),util['inspect'](_0x415b23,{'showHidden':![],'depth':null}));}return _0x14eec4(null,_0x3702bb);})['catch'](function(_0x5469ef){logger[_0xc4ba('0x22')](util[_0xc4ba('0x20')](_0xc4ba('0x23'),_0x4a2237[_0xc4ba('0x21')],_0x4a2237['id']),util[_0xc4ba('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x14eec4(_0x5469ef);});}else{return _0x14eec4(null,_0x3702bb);}}}});}; \ No newline at end of file +var _0x1099=['/oauth/v2/token','authorization_code','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','application/x-www-form-urlencoded','then','refreshToken','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST'];(function(_0x414eab,_0x42b14d){var _0x1ddfbd=function(_0x18b6c6){while(--_0x18b6c6){_0x414eab['push'](_0x414eab['shift']());}};_0x1ddfbd(++_0x42b14d);}(_0x1099,0x168));var _0x9109=function(_0x5bb3a2,_0xf19c88){_0x5bb3a2=_0x5bb3a2-0x0;var _0x2c01de=_0x1099[_0x5bb3a2];return _0x2c01de;};'use strict';var _=require(_0x9109('0x0'));var util=require(_0x9109('0x1'));var logger=require('../../config/logger')(_0x9109('0x2'));var moment=require(_0x9109('0x3'));var BPromise=require(_0x9109('0x4'));var rp=require(_0x9109('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9109('0x6'));var config=require(_0x9109('0x7'));var attributes=require(_0x9109('0x8'));var integrations=require(_0x9109('0x9'));module['exports']=function(_0x12e282,_0x5ba0bf){return _0x12e282['define'](_0x9109('0xa'),attributes,{'tableName':_0x9109('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x338e31,_0x2878df,_0x1a2d30){if(_0x338e31[_0x9109('0xc')](_0x9109('0xd'))||_0x338e31['changed'](_0x9109('0xe'))||_0x338e31[_0x9109('0xc')](_0x9109('0xf'))||_0x338e31[_0x9109('0xc')](_0x9109('0x10'))||_0x338e31['changed'](_0x9109('0x11'))||_0x338e31[_0x9109('0xc')](_0x9109('0x12'))){var _0x53ed55,_0x15c4c9;_0x53ed55=_0x338e31[_0x9109('0xe')];var _0x2ceaff=_0x53ed55[_0x9109('0x13')](-0x1);if(_0x2ceaff==='/'||_0x2ceaff==='\x5c'||_0x2ceaff===':'){_0x53ed55=_0x53ed55[_0x9109('0x14')](0x0,_0x53ed55[_0x9109('0x15')](_0x2ceaff));}switch(_0x338e31[_0x9109('0xd')]){case'US':_0x15c4c9='https://accounts.zoho.com';break;case'AU':_0x15c4c9=_0x9109('0x16');break;case'IN':_0x15c4c9=_0x9109('0x17');break;case'CN':_0x15c4c9=_0x9109('0x18');break;default:_0x15c4c9=_0x9109('0x19');break;}var _0x524bf5={'method':_0x9109('0x1a'),'uri':_0x15c4c9+_0x9109('0x1b'),'form':{'grant_type':_0x9109('0x1c'),'client_id':_0x338e31['clientId'],'client_secret':_0x338e31[_0x9109('0x10')],'redirect_uri':_0x338e31[_0x9109('0xe')],'code':_0x338e31[_0x9109('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x524bf5)['then'](function(_0x5dd25b){var _0x1ebccf=JSON[_0x9109('0x1d')](_0x5dd25b);if(_0x1ebccf[_0x9109('0x1e')]){_0x338e31['refreshToken']=_0x1ebccf[_0x9109('0x1e')];logger[_0x9109('0x1f')](util[_0x9109('0x20')](_0x9109('0x21'),_0x338e31[_0x9109('0x22')],_0x338e31['id']));}else{logger[_0x9109('0x23')](util['format'](_0x9109('0x24'),_0x338e31[_0x9109('0x22')],_0x338e31['id']),util[_0x9109('0x25')](_0x1ebccf,{'showHidden':![],'depth':null}));}return _0x1a2d30(null,_0x2878df);})[_0x9109('0x26')](function(_0x390727){logger[_0x9109('0x23')](util['format'](_0x9109('0x24'),_0x338e31[_0x9109('0x22')],_0x338e31['id']),util[_0x9109('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1a2d30(_0x390727);});}else{return _0x1a2d30(null,_0x2878df);}},'beforeUpdate':function(_0xc810be,_0x30573c,_0x30a49b){if(_0xc810be[_0x9109('0xc')](_0x9109('0xd'))||_0xc810be[_0x9109('0xc')](_0x9109('0xe'))||_0xc810be[_0x9109('0xc')](_0x9109('0xf'))||_0xc810be[_0x9109('0xc')](_0x9109('0x10'))||_0xc810be['changed']('code')||_0xc810be[_0x9109('0xc')]('host')){var _0x143c83,_0x489fb9;_0x143c83=_0xc810be[_0x9109('0xe')];var _0x110ca3=_0x143c83['slice'](-0x1);if(_0x110ca3==='/'||_0x110ca3==='\x5c'||_0x110ca3===':'){_0x143c83=_0x143c83[_0x9109('0x14')](0x0,_0x143c83['lastIndexOf'](_0x110ca3));}switch(_0xc810be[_0x9109('0xd')]){case'US':_0x489fb9=_0x9109('0x27');break;case'AU':_0x489fb9=_0x9109('0x16');break;case'IN':_0x489fb9=_0x9109('0x17');break;case'CN':_0x489fb9=_0x9109('0x18');break;default:_0x489fb9='https://accounts.zoho.eu';break;}var _0x34a1a4={'method':_0x9109('0x1a'),'uri':_0x489fb9+_0x9109('0x1b'),'form':{'grant_type':_0x9109('0x1c'),'client_id':_0xc810be['clientId'],'client_secret':_0xc810be[_0x9109('0x10')],'redirect_uri':_0xc810be['serverUrl'],'code':_0xc810be['code']},'headers':{'Content-Type':_0x9109('0x28')}};return rp(_0x34a1a4)[_0x9109('0x29')](function(_0xa1c5c2){var _0x12c43c=JSON[_0x9109('0x1d')](_0xa1c5c2);if(_0x12c43c[_0x9109('0x1e')]){_0xc810be[_0x9109('0x2a')]=_0x12c43c[_0x9109('0x1e')];logger[_0x9109('0x1f')](util[_0x9109('0x20')](_0x9109('0x21'),_0xc810be[_0x9109('0x22')],_0xc810be['id']));}else{logger['error'](util[_0x9109('0x20')](_0x9109('0x24'),_0xc810be[_0x9109('0x22')],_0xc810be['id']),util[_0x9109('0x25')](_0x12c43c,{'showHidden':![],'depth':null}));}return _0x30a49b(null,_0x30573c);})[_0x9109('0x26')](function(_0x58d5b0){logger[_0x9109('0x23')](util[_0x9109('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xc810be[_0x9109('0x22')],_0xc810be['id']),util[_0x9109('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x30a49b(_0x58d5b0);});}else{return _0x30a49b(null,_0x30573c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0d4fcbb..1ea05db 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 _0xcf37=['info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','map','model','include','GetZohoAccount','ShowZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x1e2fd5,_0x1977a8){var _0x57d240=function(_0x416748){while(--_0x416748){_0x1e2fd5['push'](_0x1e2fd5['shift']());}};_0x57d240(++_0x1977a8);}(_0xcf37,0xdc));var _0x7cf3=function(_0x4bada2,_0x2aa522){_0x4bada2=_0x4bada2-0x0;var _0xa70714=_0xcf37[_0x4bada2];return _0xa70714;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var moment=require(_0x7cf3('0x1'));var BPromise=require(_0x7cf3('0x2'));var rs=require(_0x7cf3('0x3'));var fs=require('fs');var Redis=require(_0x7cf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cf3('0x5'));var logger=require(_0x7cf3('0x6'))(_0x7cf3('0x7'));var config=require(_0x7cf3('0x8'));var jayson=require(_0x7cf3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd617,_0x5be340,_0x78b9a4){return new BPromise(function(_0x53502d,_0x110c99){return client['request'](_0x4fd617,_0x78b9a4)[_0x7cf3('0xa')](function(_0x377577){logger[_0x7cf3('0xb')](_0x7cf3('0xc'),_0x5be340,_0x7cf3('0xd'));logger[_0x7cf3('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5be340,_0x7cf3('0xd'),JSON[_0x7cf3('0xf')](_0x377577));if(_0x377577[_0x7cf3('0x10')]){if(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x11')]===0x1f4){logger['error'](_0x7cf3('0xc'),_0x5be340,_0x377577['error'][_0x7cf3('0x12')]);return _0x110c99(_0x377577['error'][_0x7cf3('0x12')]);}logger[_0x7cf3('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x5be340,_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);return _0x53502d(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);}else{logger['info'](_0x7cf3('0xc'),_0x5be340,'request\x20sent');_0x53502d(_0x377577[_0x7cf3('0x13')][_0x7cf3('0x12')]);}})[_0x7cf3('0x14')](function(_0x14aef6){logger[_0x7cf3('0x10')](_0x7cf3('0xc'),_0x5be340,_0x14aef6);_0x110c99(_0x14aef6);});});}exports['GetZohoAccount']=function(_0x59515b){var _0xd7e354=this;return new Promise(function(_0x28895b,_0x1dc831){return db['ZohoAccount'][_0x7cf3('0x15')]({'raw':_0x59515b[_0x7cf3('0x16')]?_0x59515b[_0x7cf3('0x16')][_0x7cf3('0x17')]===undefined?!![]:![]:!![],'where':_0x59515b[_0x7cf3('0x16')]?_0x59515b['options'][_0x7cf3('0x18')]||null:null,'attributes':_0x59515b[_0x7cf3('0x16')]?_0x59515b[_0x7cf3('0x16')][_0x7cf3('0x19')]||null:null,'limit':_0x59515b[_0x7cf3('0x16')]?_0x59515b['options'][_0x7cf3('0x1a')]||null:null,'include':_0x59515b[_0x7cf3('0x16')]?_0x59515b['options']['include']?_['map'](_0x59515b[_0x7cf3('0x16')]['include'],function(_0x35f8b9){return{'model':db[_0x35f8b9['model']],'as':_0x35f8b9['as'],'attributes':_0x35f8b9[_0x7cf3('0x19')],'include':_0x35f8b9['include']?_[_0x7cf3('0x1b')](_0x35f8b9['include'],function(_0x945d95){return{'model':db[_0x945d95[_0x7cf3('0x1c')]],'as':_0x945d95['as'],'attributes':_0x945d95[_0x7cf3('0x19')],'include':_0x945d95[_0x7cf3('0x1d')]?_[_0x7cf3('0x1b')](_0x945d95[_0x7cf3('0x1d')],function(_0x3080dc){return{'model':db[_0x3080dc[_0x7cf3('0x1c')]],'as':_0x3080dc['as'],'attributes':_0x3080dc[_0x7cf3('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cbd7c){logger[_0x7cf3('0xb')](_0x7cf3('0x1e'),_0x59515b);logger[_0x7cf3('0xe')]('GetZohoAccount',_0x59515b,JSON[_0x7cf3('0xf')](_0x4cbd7c));_0x28895b(_0x4cbd7c);})[_0x7cf3('0x14')](function(_0x565ef7){logger[_0x7cf3('0x10')](_0x7cf3('0x1e'),_0x565ef7[_0x7cf3('0x12')],_0x59515b);_0x1dc831(_0xd7e354[_0x7cf3('0x10')](0x1f4,_0x565ef7[_0x7cf3('0x12')]));});});};exports[_0x7cf3('0x1f')]=function(_0x206488){var _0x422582=this;return new Promise(function(_0x41b5c4,_0x1e3ca5){return db['ZohoAccount'][_0x7cf3('0x20')]({'raw':_0x206488['options']?_0x206488[_0x7cf3('0x16')][_0x7cf3('0x17')]===undefined?!![]:![]:!![],'where':_0x206488[_0x7cf3('0x16')]?_0x206488['options'][_0x7cf3('0x18')]||null:null,'attributes':_0x206488[_0x7cf3('0x16')]?_0x206488['options'][_0x7cf3('0x19')]||null:null,'include':_0x206488[_0x7cf3('0x16')]?_0x206488[_0x7cf3('0x16')][_0x7cf3('0x1d')]?_[_0x7cf3('0x1b')](_0x206488[_0x7cf3('0x16')]['include'],function(_0x38fb92){return{'model':db[_0x38fb92[_0x7cf3('0x1c')]],'as':_0x38fb92['as'],'attributes':_0x38fb92[_0x7cf3('0x19')],'include':_0x38fb92[_0x7cf3('0x1d')]?_['map'](_0x38fb92[_0x7cf3('0x1d')],function(_0x14f61c){return{'model':db[_0x14f61c[_0x7cf3('0x1c')]],'as':_0x14f61c['as'],'attributes':_0x14f61c[_0x7cf3('0x19')],'include':_0x14f61c[_0x7cf3('0x1d')]?_[_0x7cf3('0x1b')](_0x14f61c[_0x7cf3('0x1d')],function(_0x1ef775){return{'model':db[_0x1ef775[_0x7cf3('0x1c')]],'as':_0x1ef775['as'],'attributes':_0x1ef775[_0x7cf3('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x528e3c){logger['info'](_0x7cf3('0x1f'),_0x206488);logger[_0x7cf3('0xe')](_0x7cf3('0x1f'),_0x206488,JSON[_0x7cf3('0xf')](_0x528e3c));_0x41b5c4(_0x528e3c);})[_0x7cf3('0x14')](function(_0x3918d6){logger[_0x7cf3('0x10')](_0x7cf3('0x1f'),_0x3918d6[_0x7cf3('0x12')],_0x206488);_0x1e3ca5(_0x422582['error'](0x1f4,_0x3918d6['message']));});});}; \ No newline at end of file +var _0xa057=['../../config/logger','../../config/environment','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','then','find','raw','ShowZohoAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x41eafa,_0x1c154d){var _0x4d5e44=function(_0x5311cb){while(--_0x5311cb){_0x41eafa['push'](_0x41eafa['shift']());}};_0x4d5e44(++_0x1c154d);}(_0xa057,0x123));var _0x7a05=function(_0x1084a5,_0x579890){_0x1084a5=_0x1084a5-0x0;var _0xf18360=_0xa057[_0x1084a5];return _0xf18360;};'use strict';var _=require(_0x7a05('0x0'));var util=require(_0x7a05('0x1'));var moment=require('moment');var BPromise=require(_0x7a05('0x2'));var rs=require(_0x7a05('0x3'));var fs=require('fs');var Redis=require(_0x7a05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a05('0x5'));var logger=require(_0x7a05('0x6'))('rpc');var config=require(_0x7a05('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19e056,_0x2572af,_0x560067){return new BPromise(function(_0x32d32f,_0x2135d2){return client[_0x7a05('0x9')](_0x19e056,_0x560067)['then'](function(_0x31841c){logger[_0x7a05('0xa')](_0x7a05('0xb'),_0x2572af,_0x7a05('0xc'));logger[_0x7a05('0xd')](_0x7a05('0xe'),_0x2572af,'request\x20sent',JSON[_0x7a05('0xf')](_0x31841c));if(_0x31841c[_0x7a05('0x10')]){if(_0x31841c['error']['code']===0x1f4){logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c['error']['message']);return _0x2135d2(_0x31841c['error'][_0x7a05('0x11')]);}logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);return _0x32d32f(_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);}else{logger[_0x7a05('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2572af,'request\x20sent');_0x32d32f(_0x31841c[_0x7a05('0x12')][_0x7a05('0x11')]);}})['catch'](function(_0x5ad0e6){logger[_0x7a05('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2572af,_0x5ad0e6);_0x2135d2(_0x5ad0e6);});});}exports[_0x7a05('0x13')]=function(_0x449d86){var _0x9e6a53=this;return new Promise(function(_0x5a9477,_0x519666){return db[_0x7a05('0x14')]['findAll']({'raw':_0x449d86[_0x7a05('0x15')]?_0x449d86[_0x7a05('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x449d86['options']?_0x449d86['options'][_0x7a05('0x16')]||null:null,'attributes':_0x449d86[_0x7a05('0x15')]?_0x449d86[_0x7a05('0x15')][_0x7a05('0x17')]||null:null,'limit':_0x449d86['options']?_0x449d86[_0x7a05('0x15')][_0x7a05('0x18')]||null:null,'include':_0x449d86[_0x7a05('0x15')]?_0x449d86['options'][_0x7a05('0x19')]?_[_0x7a05('0x1a')](_0x449d86[_0x7a05('0x15')][_0x7a05('0x19')],function(_0x1b62de){return{'model':db[_0x1b62de[_0x7a05('0x1b')]],'as':_0x1b62de['as'],'attributes':_0x1b62de[_0x7a05('0x17')],'include':_0x1b62de[_0x7a05('0x19')]?_[_0x7a05('0x1a')](_0x1b62de[_0x7a05('0x19')],function(_0x2c2390){return{'model':db[_0x2c2390['model']],'as':_0x2c2390['as'],'attributes':_0x2c2390['attributes'],'include':_0x2c2390['include']?_[_0x7a05('0x1a')](_0x2c2390[_0x7a05('0x19')],function(_0x124697){return{'model':db[_0x124697[_0x7a05('0x1b')]],'as':_0x124697['as'],'attributes':_0x124697[_0x7a05('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7a05('0x1c')](function(_0x2fafe7){logger[_0x7a05('0xa')](_0x7a05('0x13'),_0x449d86);logger['debug']('GetZohoAccount',_0x449d86,JSON[_0x7a05('0xf')](_0x2fafe7));_0x5a9477(_0x2fafe7);})['catch'](function(_0x4f26bc){logger[_0x7a05('0x10')](_0x7a05('0x13'),_0x4f26bc[_0x7a05('0x11')],_0x449d86);_0x519666(_0x9e6a53[_0x7a05('0x10')](0x1f4,_0x4f26bc[_0x7a05('0x11')]));});});};exports['ShowZohoAccount']=function(_0x1106ad){var _0x272034=this;return new Promise(function(_0x37dbf1,_0x479c10){return db[_0x7a05('0x14')][_0x7a05('0x1d')]({'raw':_0x1106ad[_0x7a05('0x15')]?_0x1106ad['options'][_0x7a05('0x1e')]===undefined?!![]:![]:!![],'where':_0x1106ad[_0x7a05('0x15')]?_0x1106ad[_0x7a05('0x15')][_0x7a05('0x16')]||null:null,'attributes':_0x1106ad['options']?_0x1106ad[_0x7a05('0x15')]['attributes']||null:null,'include':_0x1106ad[_0x7a05('0x15')]?_0x1106ad[_0x7a05('0x15')]['include']?_[_0x7a05('0x1a')](_0x1106ad[_0x7a05('0x15')][_0x7a05('0x19')],function(_0x4e52bd){return{'model':db[_0x4e52bd[_0x7a05('0x1b')]],'as':_0x4e52bd['as'],'attributes':_0x4e52bd[_0x7a05('0x17')],'include':_0x4e52bd['include']?_[_0x7a05('0x1a')](_0x4e52bd[_0x7a05('0x19')],function(_0x4f0fb6){return{'model':db[_0x4f0fb6['model']],'as':_0x4f0fb6['as'],'attributes':_0x4f0fb6[_0x7a05('0x17')],'include':_0x4f0fb6[_0x7a05('0x19')]?_['map'](_0x4f0fb6[_0x7a05('0x19')],function(_0x39a83c){return{'model':db[_0x39a83c[_0x7a05('0x1b')]],'as':_0x39a83c['as'],'attributes':_0x39a83c[_0x7a05('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ca67){logger[_0x7a05('0xa')](_0x7a05('0x1f'),_0x1106ad);logger[_0x7a05('0xd')]('ShowZohoAccount',_0x1106ad,JSON['stringify'](_0x44ca67));_0x37dbf1(_0x44ca67);})[_0x7a05('0x20')](function(_0x52edc1){logger[_0x7a05('0x10')]('ShowZohoAccount',_0x52edc1['message'],_0x1106ad);_0x479c10(_0x272034[_0x7a05('0x10')](0x1f4,_0x52edc1[_0x7a05('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1fd66fa..1d8bf55 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 _0xc66d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xc66d,0x188));var _0xdc66=function(_0x2e3b20,_0x3b00a3){_0x2e3b20=_0x2e3b20-0x0;var _0x21d9ba=_0xc66d[_0x2e3b20];return _0x21d9ba;};'use strict';var multer=require('multer');var util=require(_0xdc66('0x0'));var path=require('path');var timeout=require(_0xdc66('0x1'));var express=require(_0xdc66('0x2'));var router=express[_0xdc66('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc66('0x4'));var interaction=require(_0xdc66('0x5'));var config=require(_0xdc66('0x6'));var controller=require(_0xdc66('0x7'));router[_0xdc66('0x8')]('/',auth[_0xdc66('0x9')](),controller[_0xdc66('0xa')]);router[_0xdc66('0x8')](_0xdc66('0xb'),auth[_0xdc66('0x9')](),controller[_0xdc66('0xc')]);router[_0xdc66('0x8')]('/:id/fields',auth[_0xdc66('0x9')](),controller[_0xdc66('0xd')]);router[_0xdc66('0x8')]('/:id/subjects',auth[_0xdc66('0x9')](),controller[_0xdc66('0xe')]);router[_0xdc66('0x8')](_0xdc66('0xf'),auth[_0xdc66('0x9')](),controller[_0xdc66('0x10')]);router[_0xdc66('0x11')]('/',auth[_0xdc66('0x9')](),controller['create']);router['put']('/:id',auth[_0xdc66('0x9')](),controller[_0xdc66('0x12')]);router[_0xdc66('0x13')](_0xdc66('0xb'),auth[_0xdc66('0x9')](),controller[_0xdc66('0x14')]);module[_0xdc66('0x15')]=router; \ No newline at end of file +var _0x37b4=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','delete','destroy','multer','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x37b4,0x166));var _0x437b=function(_0x20e79a,_0x322d4e){_0x20e79a=_0x20e79a-0x0;var _0x70801f=_0x37b4[_0x20e79a];return _0x70801f;};'use strict';var multer=require(_0x437b('0x0'));var util=require(_0x437b('0x1'));var path=require(_0x437b('0x2'));var timeout=require(_0x437b('0x3'));var express=require(_0x437b('0x4'));var router=express[_0x437b('0x5')]();var fs_extra=require(_0x437b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x437b('0x7'));var config=require(_0x437b('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0x437b('0x9')]('/',auth[_0x437b('0xa')](),controller['index']);router['get'](_0x437b('0xb'),auth[_0x437b('0xa')](),controller['show']);router['get'](_0x437b('0xc'),auth[_0x437b('0xa')](),controller[_0x437b('0xd')]);router[_0x437b('0x9')](_0x437b('0xe'),auth[_0x437b('0xa')](),controller[_0x437b('0xf')]);router[_0x437b('0x9')]('/:id/descriptions',auth[_0x437b('0xa')](),controller[_0x437b('0x10')]);router['post']('/',auth[_0x437b('0xa')](),controller[_0x437b('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x437b('0x12')](_0x437b('0xb'),auth[_0x437b('0xa')](),controller[_0x437b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 38428e1..787f6b4 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 _0xe715=['contact','nothing','contact_lead','sequelize','STRING','ENUM','lead'];(function(_0x1da56f,_0x9291b9){var _0x21be36=function(_0x2568a5){while(--_0x2568a5){_0x1da56f['push'](_0x1da56f['shift']());}};_0x21be36(++_0x9291b9);}(_0xe715,0x153));var _0x5e71=function(_0x32dfc7,_0x3423b9){_0x32dfc7=_0x32dfc7-0x0;var _0x444651=_0xe715[_0x32dfc7];return _0x444651;};'use strict';var Sequelize=require(_0x5e71('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e71('0x1')]},'moduleCreate':{'type':Sequelize[_0x5e71('0x2')](_0x5e71('0x3'),_0x5e71('0x4'),_0x5e71('0x5')),'defaultValue':_0x5e71('0x3')},'moduleSearch':{'type':Sequelize[_0x5e71('0x2')](_0x5e71('0x6'),_0x5e71('0x4'),_0x5e71('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x27b8=['sequelize','exports','STRING','ENUM','nothing','lead','contact_lead','contact'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x27b8,0x80));var _0x827b=function(_0x45cb0d,_0x3eb821){_0x45cb0d=_0x45cb0d-0x0;var _0x40394b=_0x27b8[_0x45cb0d];return _0x40394b;};'use strict';var Sequelize=require(_0x827b('0x0'));module[_0x827b('0x1')]={'name':{'type':Sequelize[_0x827b('0x2')]},'moduleCreate':{'type':Sequelize[_0x827b('0x3')]('lead','contact',_0x827b('0x4')),'defaultValue':_0x827b('0x5')},'moduleSearch':{'type':Sequelize[_0x827b('0x3')](_0x827b('0x6'),_0x827b('0x7'),_0x827b('0x5')),'defaultValue':_0x827b('0x6')},'description':{'type':Sequelize[_0x827b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 50a8622..659f924 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 _0x66eb=['rows','catch','show','params','rawAttributes','intersection','includeAll','options','create','body','find','findOne','ZohoField','length','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','ZohoConfiguration','fieldName','type','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll'];(function(_0x2098b2,_0x1681f0){var _0xf2c19f=function(_0x18a197){while(--_0x18a197){_0x2098b2['push'](_0x2098b2['shift']());}};_0xf2c19f(++_0x1681f0);}(_0x66eb,0x14d));var _0xb66e=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x66eb[_0x58efa6];return _0x5d643c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb66e('0x0'));var zipdir=require(_0xb66e('0x1'));var jsonpatch=require(_0xb66e('0x2'));var rp=require(_0xb66e('0x3'));var moment=require(_0xb66e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb66e('0x5'));var util=require(_0xb66e('0x6'));var path=require('path');var sox=require(_0xb66e('0x7'));var csv=require(_0xb66e('0x8'));var ejs=require(_0xb66e('0x9'));var fs=require('fs');var fs_extra=require(_0xb66e('0xa'));var _=require(_0xb66e('0xb'));var squel=require(_0xb66e('0xc'));var crypto=require('crypto');var jsforce=require(_0xb66e('0xd'));var deskjs=require(_0xb66e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb66e('0xf'));var Papa=require(_0xb66e('0x10'));var Redis=require(_0xb66e('0x11'));var authService=require(_0xb66e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb66e('0x13'));var hardwareService=require(_0xb66e('0x14'));var logger=require(_0xb66e('0x15'))(_0xb66e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb66e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36ede1,_0x57a158){_0x57a158=_0x57a158||0xcc;return function(_0x3081fe){if(_0x3081fe){return _0x36ede1[_0xb66e('0x18')](_0x57a158);}return _0x36ede1['status'](_0x57a158)[_0xb66e('0x19')]();};}function respondWithResult(_0x12348a,_0x44ff2c){_0x44ff2c=_0x44ff2c||0xc8;return function(_0x270051){if(_0x270051){return _0x12348a[_0xb66e('0x1a')](_0x44ff2c)['json'](_0x270051);}};}function respondWithFilteredResult(_0x196cb3,_0x4b0376){return function(_0x5ea36c){if(_0x5ea36c){var _0x4e6b45=typeof _0x4b0376[_0xb66e('0x1b')]==='undefined'&&typeof _0x4b0376[_0xb66e('0x1c')]==='undefined';var _0x3db451=_0x5ea36c[_0xb66e('0x1d')];var _0xc65a46=_0x4e6b45?0x0:_0x4b0376['offset'];var _0x542115=_0x4e6b45?_0x5ea36c[_0xb66e('0x1d')]:_0x4b0376[_0xb66e('0x1b')]+_0x4b0376[_0xb66e('0x1c')];var _0x51d42e;if(_0x542115>=_0x3db451){_0x542115=_0x3db451;_0x51d42e=0xc8;}else{_0x51d42e=0xce;}_0x196cb3[_0xb66e('0x1a')](_0x51d42e);return _0x196cb3[_0xb66e('0x1e')](_0xb66e('0x1f'),_0xc65a46+'-'+_0x542115+'/'+_0x3db451)[_0xb66e('0x20')](_0x5ea36c);}return null;};}function patchUpdates(_0x3c5f4c){return function(_0x3bf1b1){try{jsonpatch[_0xb66e('0x21')](_0x3bf1b1,_0x3c5f4c,!![]);}catch(_0x59c95e){return BPromise[_0xb66e('0x22')](_0x59c95e);}return _0x3bf1b1[_0xb66e('0x23')]();};}function saveUpdates(_0x4459f5,_0x1fcfba){return function(_0x5ddb1e){if(_0x5ddb1e){return _0x5ddb1e[_0xb66e('0x24')](_0x4459f5)[_0xb66e('0x25')](function(_0x5ded53){return _0x5ded53;});}return null;};}function removeEntity(_0x2c7c8b,_0x4ee69a){return function(_0x1aa1b8){if(_0x1aa1b8){return _0x1aa1b8[_0xb66e('0x26')]()[_0xb66e('0x25')](function(){_0x2c7c8b[_0xb66e('0x1a')](0xcc)[_0xb66e('0x19')]();});}};}function handleEntityNotFound(_0x4d15ab,_0x468b91){return function(_0x3447e8){if(!_0x3447e8){_0x4d15ab[_0xb66e('0x18')](0x194);}return _0x3447e8;};}function handleError(_0x17360,_0x39027a){_0x39027a=_0x39027a||0x1f4;return function(_0x31dbf3){logger['error'](_0x31dbf3['stack']);if(_0x31dbf3[_0xb66e('0x27')]){delete _0x31dbf3['name'];}_0x17360[_0xb66e('0x1a')](_0x39027a)[_0xb66e('0x28')](_0x31dbf3);};}exports[_0xb66e('0x29')]=function(_0x529011,_0x2ea102){var _0x4c754b={},_0x269a15={},_0x54b1a6={'count':0x0,'rows':[]};var _0x18998c=_['map'](db[_0xb66e('0x2a')]['rawAttributes'],function(_0x127137){return{'name':_0x127137[_0xb66e('0x2b')],'type':_0x127137[_0xb66e('0x2c')]['key']};});_0x269a15[_0xb66e('0x2d')]=_[_0xb66e('0x2e')](_0x18998c,_0xb66e('0x27'));_0x269a15[_0xb66e('0x2f')]=_[_0xb66e('0x30')](_0x529011[_0xb66e('0x2f')]);_0x269a15[_0xb66e('0x31')]=_['intersection'](_0x269a15['model'],_0x269a15['query']);_0x4c754b[_0xb66e('0x32')]=_['intersection'](_0x269a15[_0xb66e('0x2d')],qs['fields'](_0x529011['query'][_0xb66e('0x33')]));_0x4c754b[_0xb66e('0x32')]=_0x4c754b[_0xb66e('0x32')]['length']?_0x4c754b[_0xb66e('0x32')]:_0x269a15[_0xb66e('0x2d')];if(!_0x529011[_0xb66e('0x2f')][_0xb66e('0x34')](_0xb66e('0x35'))){_0x4c754b['limit']=qs['limit'](_0x529011['query'][_0xb66e('0x1c')]);_0x4c754b[_0xb66e('0x1b')]=qs[_0xb66e('0x1b')](_0x529011[_0xb66e('0x2f')][_0xb66e('0x1b')]);}_0x4c754b[_0xb66e('0x36')]=qs['sort'](_0x529011[_0xb66e('0x2f')][_0xb66e('0x37')]);_0x4c754b[_0xb66e('0x38')]=qs[_0xb66e('0x31')](_[_0xb66e('0x39')](_0x529011[_0xb66e('0x2f')],_0x269a15[_0xb66e('0x31')]),_0x18998c);if(_0x529011[_0xb66e('0x2f')][_0xb66e('0x3a')]){_0x4c754b[_0xb66e('0x38')]=_[_0xb66e('0x3b')](_0x4c754b[_0xb66e('0x38')],{'$or':_[_0xb66e('0x2e')](_0x18998c,function(_0x9f9363){if(_0x9f9363[_0xb66e('0x2c')]!=='VIRTUAL'){var _0x5ebdf8={};_0x5ebdf8[_0x9f9363[_0xb66e('0x27')]]={'$like':'%'+_0x529011[_0xb66e('0x2f')][_0xb66e('0x3a')]+'%'};return _0x5ebdf8;}})});}_0x4c754b=_[_0xb66e('0x3b')]({},_0x4c754b,_0x529011['options']);var _0x48789f={'where':_0x4c754b[_0xb66e('0x38')]};return db[_0xb66e('0x2a')]['count'](_0x48789f)[_0xb66e('0x25')](function(_0x551ea7){_0x54b1a6[_0xb66e('0x1d')]=_0x551ea7;if(_0x529011[_0xb66e('0x2f')]['includeAll']){_0x4c754b[_0xb66e('0x3c')]=[{'all':!![]}];}return db[_0xb66e('0x2a')][_0xb66e('0x3d')](_0x4c754b);})[_0xb66e('0x25')](function(_0x2643a6){_0x54b1a6[_0xb66e('0x3e')]=_0x2643a6;return _0x54b1a6;})[_0xb66e('0x25')](respondWithFilteredResult(_0x2ea102,_0x4c754b))[_0xb66e('0x3f')](handleError(_0x2ea102,null));};exports[_0xb66e('0x40')]=function(_0x3af080,_0x469f36){var _0x13acbf={'raw':![],'where':{'id':_0x3af080[_0xb66e('0x41')]['id']}},_0x58fcaf={};_0x58fcaf[_0xb66e('0x2d')]=_[_0xb66e('0x30')](db[_0xb66e('0x2a')][_0xb66e('0x42')]);_0x58fcaf[_0xb66e('0x2f')]=_[_0xb66e('0x30')](_0x3af080['query']);_0x58fcaf[_0xb66e('0x31')]=_[_0xb66e('0x43')](_0x58fcaf[_0xb66e('0x2d')],_0x58fcaf[_0xb66e('0x2f')]);_0x13acbf['attributes']=_['intersection'](_0x58fcaf[_0xb66e('0x2d')],qs[_0xb66e('0x33')](_0x3af080[_0xb66e('0x2f')]['fields']));_0x13acbf[_0xb66e('0x32')]=_0x13acbf[_0xb66e('0x32')]['length']?_0x13acbf[_0xb66e('0x32')]:_0x58fcaf['model'];if(_0x3af080['query'][_0xb66e('0x44')]){_0x13acbf['include']=[{'all':!![]}];}_0x13acbf=_['merge']({},_0x13acbf,_0x3af080[_0xb66e('0x45')]);return db[_0xb66e('0x2a')]['find'](_0x13acbf)['then'](handleEntityNotFound(_0x469f36,null))[_0xb66e('0x25')](respondWithResult(_0x469f36,null))[_0xb66e('0x3f')](handleError(_0x469f36,null));};exports['create']=function(_0x3281d1,_0x399e29){return db[_0xb66e('0x2a')][_0xb66e('0x46')](_0x3281d1['body'],{})[_0xb66e('0x25')](respondWithResult(_0x399e29,0xc9))[_0xb66e('0x3f')](handleError(_0x399e29,null));};exports[_0xb66e('0x24')]=function(_0x14684,_0xa66883){if(_0x14684[_0xb66e('0x47')]['id']){delete _0x14684['body']['id'];}return db[_0xb66e('0x2a')]['find']({'where':{'id':_0x14684[_0xb66e('0x41')]['id']}})[_0xb66e('0x25')](handleEntityNotFound(_0xa66883,null))[_0xb66e('0x25')](saveUpdates(_0x14684[_0xb66e('0x47')],null))[_0xb66e('0x25')](respondWithResult(_0xa66883,null))[_0xb66e('0x3f')](handleError(_0xa66883,null));};exports[_0xb66e('0x26')]=function(_0xd0e886,_0x1fe31e){return db['ZohoConfiguration'][_0xb66e('0x48')]({'where':{'id':_0xd0e886['params']['id']}})[_0xb66e('0x25')](handleEntityNotFound(_0x1fe31e,null))[_0xb66e('0x25')](removeEntity(_0x1fe31e,null))[_0xb66e('0x3f')](handleError(_0x1fe31e,null));};exports['getFields']=function(_0x3e0611,_0x56f880,_0x95d896){var _0x466940={};var _0x50e145={};var _0x3efeaf;var _0x1cc5aa;return db['ZohoConfiguration'][_0xb66e('0x49')]({'where':{'id':_0x3e0611[_0xb66e('0x41')]['id']}})[_0xb66e('0x25')](handleEntityNotFound(_0x56f880,null))[_0xb66e('0x25')](function(_0xe7f54e){if(_0xe7f54e){_0x3efeaf=_0xe7f54e;_0x50e145[_0xb66e('0x2d')]=_[_0xb66e('0x30')](db[_0xb66e('0x4a')][_0xb66e('0x42')]);_0x50e145[_0xb66e('0x2f')]=_[_0xb66e('0x30')](_0x3e0611[_0xb66e('0x2f')]);_0x50e145[_0xb66e('0x31')]=_[_0xb66e('0x43')](_0x50e145['model'],_0x50e145[_0xb66e('0x2f')]);_0x466940[_0xb66e('0x32')]=_[_0xb66e('0x43')](_0x50e145[_0xb66e('0x2d')],qs['fields'](_0x3e0611[_0xb66e('0x2f')][_0xb66e('0x33')]));_0x466940[_0xb66e('0x32')]=_0x466940[_0xb66e('0x32')][_0xb66e('0x4b')]?_0x466940[_0xb66e('0x32')]:_0x50e145[_0xb66e('0x2d')];_0x466940[_0xb66e('0x36')]=qs[_0xb66e('0x37')](_0x3e0611['query'][_0xb66e('0x37')]);_0x466940[_0xb66e('0x38')]=qs[_0xb66e('0x31')](_[_0xb66e('0x39')](_0x3e0611[_0xb66e('0x2f')],_0x50e145[_0xb66e('0x31')]));if(_0x3e0611[_0xb66e('0x2f')][_0xb66e('0x3a')]){_0x466940['where']=_['merge'](_0x466940[_0xb66e('0x38')],{'$or':_['map'](_0x466940[_0xb66e('0x32')],function(_0x3f66b3){var _0x2494d9={};_0x2494d9[_0x3f66b3]={'$like':'%'+_0x3e0611[_0xb66e('0x2f')][_0xb66e('0x3a')]+'%'};return _0x2494d9;})});}_0x466940=_[_0xb66e('0x3b')]({},_0x466940,_0x3e0611[_0xb66e('0x45')]);return _0x3efeaf[_0xb66e('0x4c')](_0x466940);}})[_0xb66e('0x25')](function(_0x5212df){if(_0x5212df){_0x1cc5aa=_0x5212df['length'];if(!_0x3e0611[_0xb66e('0x2f')][_0xb66e('0x34')](_0xb66e('0x35'))){_0x466940[_0xb66e('0x1c')]=qs[_0xb66e('0x1c')](_0x3e0611[_0xb66e('0x2f')]['limit']);_0x466940['offset']=qs[_0xb66e('0x1b')](_0x3e0611[_0xb66e('0x2f')]['offset']);}return _0x3efeaf['getFields'](_0x466940);}})['then'](function(_0x5f25c1){if(_0x5f25c1){return _0x5f25c1?{'count':_0x1cc5aa,'rows':_0x5f25c1}:null;}})[_0xb66e('0x25')](respondWithResult(_0x56f880,null))[_0xb66e('0x3f')](handleError(_0x56f880,null));};exports[_0xb66e('0x4d')]=function(_0x3e0072,_0x5f5433,_0x34c121){var _0x432a8f={};var _0x42aaa8={};var _0x2016aa;var _0x3667fa;return db[_0xb66e('0x2a')]['findOne']({'where':{'id':_0x3e0072['params']['id']}})[_0xb66e('0x25')](handleEntityNotFound(_0x5f5433,null))[_0xb66e('0x25')](function(_0x1bb31a){if(_0x1bb31a){_0x2016aa=_0x1bb31a;_0x42aaa8[_0xb66e('0x2d')]=_[_0xb66e('0x30')](db['ZohoField'][_0xb66e('0x42')]);_0x42aaa8[_0xb66e('0x2f')]=_['keys'](_0x3e0072[_0xb66e('0x2f')]);_0x42aaa8['filters']=_['intersection'](_0x42aaa8[_0xb66e('0x2d')],_0x42aaa8[_0xb66e('0x2f')]);_0x432a8f[_0xb66e('0x32')]=_[_0xb66e('0x43')](_0x42aaa8['model'],qs[_0xb66e('0x33')](_0x3e0072['query'][_0xb66e('0x33')]));_0x432a8f[_0xb66e('0x32')]=_0x432a8f[_0xb66e('0x32')]['length']?_0x432a8f[_0xb66e('0x32')]:_0x42aaa8['model'];_0x432a8f[_0xb66e('0x36')]=qs[_0xb66e('0x37')](_0x3e0072['query'][_0xb66e('0x37')]);_0x432a8f[_0xb66e('0x38')]=qs[_0xb66e('0x31')](_[_0xb66e('0x39')](_0x3e0072[_0xb66e('0x2f')],_0x42aaa8['filters']));if(_0x3e0072[_0xb66e('0x2f')][_0xb66e('0x3a')]){_0x432a8f[_0xb66e('0x38')]=_[_0xb66e('0x3b')](_0x432a8f[_0xb66e('0x38')],{'$or':_[_0xb66e('0x2e')](_0x432a8f[_0xb66e('0x32')],function(_0x30be2a){var _0x2f5cec={};_0x2f5cec[_0x30be2a]={'$like':'%'+_0x3e0072['query']['filter']+'%'};return _0x2f5cec;})});}_0x432a8f=_[_0xb66e('0x3b')]({},_0x432a8f,_0x3e0072[_0xb66e('0x45')]);return _0x2016aa['getSubjects'](_0x432a8f);}})[_0xb66e('0x25')](function(_0x15c9f6){if(_0x15c9f6){_0x3667fa=_0x15c9f6[_0xb66e('0x4b')];if(!_0x3e0072['query'][_0xb66e('0x34')](_0xb66e('0x35'))){_0x432a8f[_0xb66e('0x1c')]=qs[_0xb66e('0x1c')](_0x3e0072['query'][_0xb66e('0x1c')]);_0x432a8f['offset']=qs[_0xb66e('0x1b')](_0x3e0072[_0xb66e('0x2f')][_0xb66e('0x1b')]);}return _0x2016aa[_0xb66e('0x4d')](_0x432a8f);}})['then'](function(_0x3e9357){if(_0x3e9357){return _0x3e9357?{'count':_0x3667fa,'rows':_0x3e9357}:null;}})['then'](respondWithResult(_0x5f5433,null))[_0xb66e('0x3f')](handleError(_0x5f5433,null));};exports['getDescriptions']=function(_0x2f23f7,_0x4ad56a,_0x1d3906){var _0x3c6bbc={};var _0x42bfc4={};var _0x5db1b2;var _0x30ef38;return db[_0xb66e('0x2a')][_0xb66e('0x49')]({'where':{'id':_0x2f23f7[_0xb66e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ad56a,null))['then'](function(_0xace10f){if(_0xace10f){_0x5db1b2=_0xace10f;_0x42bfc4[_0xb66e('0x2d')]=_[_0xb66e('0x30')](db[_0xb66e('0x4a')][_0xb66e('0x42')]);_0x42bfc4['query']=_[_0xb66e('0x30')](_0x2f23f7['query']);_0x42bfc4[_0xb66e('0x31')]=_['intersection'](_0x42bfc4[_0xb66e('0x2d')],_0x42bfc4[_0xb66e('0x2f')]);_0x3c6bbc[_0xb66e('0x32')]=_[_0xb66e('0x43')](_0x42bfc4['model'],qs[_0xb66e('0x33')](_0x2f23f7['query']['fields']));_0x3c6bbc[_0xb66e('0x32')]=_0x3c6bbc['attributes'][_0xb66e('0x4b')]?_0x3c6bbc['attributes']:_0x42bfc4[_0xb66e('0x2d')];_0x3c6bbc['order']=qs['sort'](_0x2f23f7[_0xb66e('0x2f')][_0xb66e('0x37')]);_0x3c6bbc[_0xb66e('0x38')]=qs[_0xb66e('0x31')](_['pick'](_0x2f23f7['query'],_0x42bfc4[_0xb66e('0x31')]));if(_0x2f23f7['query'][_0xb66e('0x3a')]){_0x3c6bbc[_0xb66e('0x38')]=_['merge'](_0x3c6bbc[_0xb66e('0x38')],{'$or':_[_0xb66e('0x2e')](_0x3c6bbc[_0xb66e('0x32')],function(_0x1a9b0b){var _0x3edf41={};_0x3edf41[_0x1a9b0b]={'$like':'%'+_0x2f23f7[_0xb66e('0x2f')]['filter']+'%'};return _0x3edf41;})});}_0x3c6bbc=_['merge']({},_0x3c6bbc,_0x2f23f7['options']);return _0x5db1b2[_0xb66e('0x4e')](_0x3c6bbc);}})[_0xb66e('0x25')](function(_0x55c0c1){if(_0x55c0c1){_0x30ef38=_0x55c0c1[_0xb66e('0x4b')];if(!_0x2f23f7[_0xb66e('0x2f')]['hasOwnProperty'](_0xb66e('0x35'))){_0x3c6bbc[_0xb66e('0x1c')]=qs['limit'](_0x2f23f7[_0xb66e('0x2f')][_0xb66e('0x1c')]);_0x3c6bbc[_0xb66e('0x1b')]=qs[_0xb66e('0x1b')](_0x2f23f7[_0xb66e('0x2f')][_0xb66e('0x1b')]);}return _0x5db1b2[_0xb66e('0x4e')](_0x3c6bbc);}})['then'](function(_0x1d1981){if(_0x1d1981){return _0x1d1981?{'count':_0x30ef38,'rows':_0x1d1981}:null;}})[_0xb66e('0x25')](respondWithResult(_0x4ad56a,null))['catch'](handleError(_0x4ad56a,null));}; \ No newline at end of file +var _0xd609=['fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','map','merge','where','ZohoConfiguration','includeAll','include','rows','catch','show','params','find','create','body','findOne','ZohoField','options','getFields','getSubjects','getDescriptions','eml-format','zip-dir'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xd609,0x136));var _0x9d60=function(_0x511bf2,_0x438e43){_0x511bf2=_0x511bf2-0x0;var _0x3212b5=_0xd609[_0x511bf2];return _0x3212b5;};'use strict';var emlformat=require(_0x9d60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d60('0x1'));var jsonpatch=require(_0x9d60('0x2'));var rp=require('request-promise');var moment=require(_0x9d60('0x3'));var BPromise=require(_0x9d60('0x4'));var Mustache=require(_0x9d60('0x5'));var util=require(_0x9d60('0x6'));var path=require('path');var sox=require(_0x9d60('0x7'));var csv=require(_0x9d60('0x8'));var ejs=require(_0x9d60('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d60('0xa'));var squel=require(_0x9d60('0xb'));var crypto=require(_0x9d60('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d60('0xd'));var Redis=require(_0x9d60('0xe'));var authService=require(_0x9d60('0xf'));var qs=require(_0x9d60('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d60('0x11'));var logger=require('../../config/logger')(_0x9d60('0x12'));var utils=require(_0x9d60('0x13'));var config=require(_0x9d60('0x14'));var licenseUtil=require(_0x9d60('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e3b88,_0x461ca4){_0x461ca4=_0x461ca4||0xcc;return function(_0xbe131a){if(_0xbe131a){return _0x1e3b88[_0x9d60('0x16')](_0x461ca4);}return _0x1e3b88[_0x9d60('0x17')](_0x461ca4)[_0x9d60('0x18')]();};}function respondWithResult(_0x209b47,_0x15fe65){_0x15fe65=_0x15fe65||0xc8;return function(_0x712adc){if(_0x712adc){return _0x209b47['status'](_0x15fe65)[_0x9d60('0x19')](_0x712adc);}};}function respondWithFilteredResult(_0x10f4aa,_0x3e6024){return function(_0x47ef6e){if(_0x47ef6e){var _0x3d6bc4=typeof _0x3e6024['offset']===_0x9d60('0x1a')&&typeof _0x3e6024[_0x9d60('0x1b')]===_0x9d60('0x1a');var _0x52a13f=_0x47ef6e['count'];var _0x5d30ba=_0x3d6bc4?0x0:_0x3e6024[_0x9d60('0x1c')];var _0x142f29=_0x3d6bc4?_0x47ef6e[_0x9d60('0x1d')]:_0x3e6024[_0x9d60('0x1c')]+_0x3e6024[_0x9d60('0x1b')];var _0x12aae2;if(_0x142f29>=_0x52a13f){_0x142f29=_0x52a13f;_0x12aae2=0xc8;}else{_0x12aae2=0xce;}_0x10f4aa[_0x9d60('0x17')](_0x12aae2);return _0x10f4aa[_0x9d60('0x1e')](_0x9d60('0x1f'),_0x5d30ba+'-'+_0x142f29+'/'+_0x52a13f)[_0x9d60('0x19')](_0x47ef6e);}return null;};}function patchUpdates(_0x28e5e0){return function(_0x26802b){try{jsonpatch[_0x9d60('0x20')](_0x26802b,_0x28e5e0,!![]);}catch(_0x163b8){return BPromise['reject'](_0x163b8);}return _0x26802b[_0x9d60('0x21')]();};}function saveUpdates(_0xad0d04,_0x234b98){return function(_0x4b1238){if(_0x4b1238){return _0x4b1238[_0x9d60('0x22')](_0xad0d04)[_0x9d60('0x23')](function(_0x34ddbf){return _0x34ddbf;});}return null;};}function removeEntity(_0x3a96a1,_0x5d9349){return function(_0x2638dc){if(_0x2638dc){return _0x2638dc[_0x9d60('0x24')]()[_0x9d60('0x23')](function(){_0x3a96a1[_0x9d60('0x17')](0xcc)[_0x9d60('0x18')]();});}};}function handleEntityNotFound(_0x432f43,_0x12964f){return function(_0x2bf4e6){if(!_0x2bf4e6){_0x432f43[_0x9d60('0x16')](0x194);}return _0x2bf4e6;};}function handleError(_0x46c0ce,_0x3d41c0){_0x3d41c0=_0x3d41c0||0x1f4;return function(_0x4768c4){logger[_0x9d60('0x25')](_0x4768c4[_0x9d60('0x26')]);if(_0x4768c4[_0x9d60('0x27')]){delete _0x4768c4['name'];}_0x46c0ce[_0x9d60('0x17')](_0x3d41c0)[_0x9d60('0x28')](_0x4768c4);};}exports[_0x9d60('0x29')]=function(_0x144a6f,_0x152e6a){var _0x2d4045={},_0x4b86a4={},_0x38022b={'count':0x0,'rows':[]};var _0x1d01ff=_['map'](db['ZohoConfiguration'][_0x9d60('0x2a')],function(_0x468571){return{'name':_0x468571[_0x9d60('0x2b')],'type':_0x468571[_0x9d60('0x2c')][_0x9d60('0x2d')]};});_0x4b86a4[_0x9d60('0x2e')]=_['map'](_0x1d01ff,_0x9d60('0x27'));_0x4b86a4[_0x9d60('0x2f')]=_[_0x9d60('0x30')](_0x144a6f[_0x9d60('0x2f')]);_0x4b86a4[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0x4b86a4['model'],_0x4b86a4[_0x9d60('0x2f')]);_0x2d4045[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x4b86a4['model'],qs[_0x9d60('0x34')](_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x34')]));_0x2d4045[_0x9d60('0x33')]=_0x2d4045[_0x9d60('0x33')][_0x9d60('0x35')]?_0x2d4045[_0x9d60('0x33')]:_0x4b86a4[_0x9d60('0x2e')];if(!_0x144a6f[_0x9d60('0x2f')]['hasOwnProperty'](_0x9d60('0x36'))){_0x2d4045[_0x9d60('0x1b')]=qs[_0x9d60('0x1b')](_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x1b')]);_0x2d4045[_0x9d60('0x1c')]=qs['offset'](_0x144a6f['query'][_0x9d60('0x1c')]);}_0x2d4045[_0x9d60('0x37')]=qs[_0x9d60('0x38')](_0x144a6f[_0x9d60('0x2f')]['sort']);_0x2d4045['where']=qs[_0x9d60('0x31')](_[_0x9d60('0x39')](_0x144a6f[_0x9d60('0x2f')],_0x4b86a4['filters']),_0x1d01ff);if(_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x3a')]){_0x2d4045['where']=_['merge'](_0x2d4045['where'],{'$or':_[_0x9d60('0x3b')](_0x1d01ff,function(_0x314c05){if(_0x314c05[_0x9d60('0x2c')]!=='VIRTUAL'){var _0x1d3e2d={};_0x1d3e2d[_0x314c05['name']]={'$like':'%'+_0x144a6f[_0x9d60('0x2f')]['filter']+'%'};return _0x1d3e2d;}})});}_0x2d4045=_[_0x9d60('0x3c')]({},_0x2d4045,_0x144a6f['options']);var _0x5953a6={'where':_0x2d4045[_0x9d60('0x3d')]};return db[_0x9d60('0x3e')]['count'](_0x5953a6)[_0x9d60('0x23')](function(_0x1eef32){_0x38022b[_0x9d60('0x1d')]=_0x1eef32;if(_0x144a6f[_0x9d60('0x2f')][_0x9d60('0x3f')]){_0x2d4045[_0x9d60('0x40')]=[{'all':!![]}];}return db[_0x9d60('0x3e')]['findAll'](_0x2d4045);})[_0x9d60('0x23')](function(_0x3724fa){_0x38022b[_0x9d60('0x41')]=_0x3724fa;return _0x38022b;})[_0x9d60('0x23')](respondWithFilteredResult(_0x152e6a,_0x2d4045))[_0x9d60('0x42')](handleError(_0x152e6a,null));};exports[_0x9d60('0x43')]=function(_0x1d397b,_0x25d5f3){var _0x366f9f={'raw':![],'where':{'id':_0x1d397b[_0x9d60('0x44')]['id']}},_0x3f3f8f={};_0x3f3f8f['model']=_[_0x9d60('0x30')](db[_0x9d60('0x3e')][_0x9d60('0x2a')]);_0x3f3f8f[_0x9d60('0x2f')]=_[_0x9d60('0x30')](_0x1d397b[_0x9d60('0x2f')]);_0x3f3f8f[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0x3f3f8f[_0x9d60('0x2e')],_0x3f3f8f['query']);_0x366f9f[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x3f3f8f['model'],qs['fields'](_0x1d397b[_0x9d60('0x2f')][_0x9d60('0x34')]));_0x366f9f['attributes']=_0x366f9f[_0x9d60('0x33')][_0x9d60('0x35')]?_0x366f9f[_0x9d60('0x33')]:_0x3f3f8f[_0x9d60('0x2e')];if(_0x1d397b[_0x9d60('0x2f')][_0x9d60('0x3f')]){_0x366f9f[_0x9d60('0x40')]=[{'all':!![]}];}_0x366f9f=_[_0x9d60('0x3c')]({},_0x366f9f,_0x1d397b['options']);return db['ZohoConfiguration'][_0x9d60('0x45')](_0x366f9f)[_0x9d60('0x23')](handleEntityNotFound(_0x25d5f3,null))[_0x9d60('0x23')](respondWithResult(_0x25d5f3,null))[_0x9d60('0x42')](handleError(_0x25d5f3,null));};exports['create']=function(_0x9df8e0,_0x1ac1f1){return db[_0x9d60('0x3e')][_0x9d60('0x46')](_0x9df8e0[_0x9d60('0x47')],{})['then'](respondWithResult(_0x1ac1f1,0xc9))[_0x9d60('0x42')](handleError(_0x1ac1f1,null));};exports[_0x9d60('0x22')]=function(_0x30f451,_0x366f52){if(_0x30f451[_0x9d60('0x47')]['id']){delete _0x30f451[_0x9d60('0x47')]['id'];}return db[_0x9d60('0x3e')]['find']({'where':{'id':_0x30f451[_0x9d60('0x44')]['id']}})['then'](handleEntityNotFound(_0x366f52,null))['then'](saveUpdates(_0x30f451[_0x9d60('0x47')],null))[_0x9d60('0x23')](respondWithResult(_0x366f52,null))['catch'](handleError(_0x366f52,null));};exports[_0x9d60('0x24')]=function(_0x11b124,_0xace9af){return db['ZohoConfiguration'][_0x9d60('0x45')]({'where':{'id':_0x11b124[_0x9d60('0x44')]['id']}})[_0x9d60('0x23')](handleEntityNotFound(_0xace9af,null))[_0x9d60('0x23')](removeEntity(_0xace9af,null))[_0x9d60('0x42')](handleError(_0xace9af,null));};exports['getFields']=function(_0x235299,_0x1a9a4c,_0x1afaef){var _0x11fc69={};var _0xf5edba={};var _0x3efcac;var _0x5f35b5;return db[_0x9d60('0x3e')][_0x9d60('0x48')]({'where':{'id':_0x235299[_0x9d60('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a9a4c,null))[_0x9d60('0x23')](function(_0x4d565f){if(_0x4d565f){_0x3efcac=_0x4d565f;_0xf5edba[_0x9d60('0x2e')]=_[_0x9d60('0x30')](db[_0x9d60('0x49')][_0x9d60('0x2a')]);_0xf5edba[_0x9d60('0x2f')]=_['keys'](_0x235299[_0x9d60('0x2f')]);_0xf5edba[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0xf5edba[_0x9d60('0x2e')],_0xf5edba['query']);_0x11fc69[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0xf5edba[_0x9d60('0x2e')],qs[_0x9d60('0x34')](_0x235299[_0x9d60('0x2f')]['fields']));_0x11fc69[_0x9d60('0x33')]=_0x11fc69[_0x9d60('0x33')][_0x9d60('0x35')]?_0x11fc69[_0x9d60('0x33')]:_0xf5edba['model'];_0x11fc69[_0x9d60('0x37')]=qs['sort'](_0x235299['query'][_0x9d60('0x38')]);_0x11fc69[_0x9d60('0x3d')]=qs[_0x9d60('0x31')](_[_0x9d60('0x39')](_0x235299[_0x9d60('0x2f')],_0xf5edba[_0x9d60('0x31')]));if(_0x235299[_0x9d60('0x2f')]['filter']){_0x11fc69[_0x9d60('0x3d')]=_[_0x9d60('0x3c')](_0x11fc69['where'],{'$or':_[_0x9d60('0x3b')](_0x11fc69[_0x9d60('0x33')],function(_0x3dd32f){var _0xd8e256={};_0xd8e256[_0x3dd32f]={'$like':'%'+_0x235299[_0x9d60('0x2f')][_0x9d60('0x3a')]+'%'};return _0xd8e256;})});}_0x11fc69=_[_0x9d60('0x3c')]({},_0x11fc69,_0x235299[_0x9d60('0x4a')]);return _0x3efcac[_0x9d60('0x4b')](_0x11fc69);}})[_0x9d60('0x23')](function(_0x44c182){if(_0x44c182){_0x5f35b5=_0x44c182['length'];if(!_0x235299[_0x9d60('0x2f')]['hasOwnProperty'](_0x9d60('0x36'))){_0x11fc69['limit']=qs['limit'](_0x235299['query'][_0x9d60('0x1b')]);_0x11fc69['offset']=qs[_0x9d60('0x1c')](_0x235299[_0x9d60('0x2f')][_0x9d60('0x1c')]);}return _0x3efcac['getFields'](_0x11fc69);}})[_0x9d60('0x23')](function(_0xc77e9d){if(_0xc77e9d){return _0xc77e9d?{'count':_0x5f35b5,'rows':_0xc77e9d}:null;}})[_0x9d60('0x23')](respondWithResult(_0x1a9a4c,null))[_0x9d60('0x42')](handleError(_0x1a9a4c,null));};exports[_0x9d60('0x4c')]=function(_0x562cfe,_0x4080ce,_0x59fc91){var _0x45f046={};var _0x2d769c={};var _0x5e4231;var _0x1b6c06;return db[_0x9d60('0x3e')][_0x9d60('0x48')]({'where':{'id':_0x562cfe[_0x9d60('0x44')]['id']}})[_0x9d60('0x23')](handleEntityNotFound(_0x4080ce,null))[_0x9d60('0x23')](function(_0x316eb0){if(_0x316eb0){_0x5e4231=_0x316eb0;_0x2d769c[_0x9d60('0x2e')]=_[_0x9d60('0x30')](db[_0x9d60('0x49')][_0x9d60('0x2a')]);_0x2d769c[_0x9d60('0x2f')]=_['keys'](_0x562cfe['query']);_0x2d769c[_0x9d60('0x31')]=_[_0x9d60('0x32')](_0x2d769c[_0x9d60('0x2e')],_0x2d769c['query']);_0x45f046[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x2d769c[_0x9d60('0x2e')],qs[_0x9d60('0x34')](_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x34')]));_0x45f046[_0x9d60('0x33')]=_0x45f046[_0x9d60('0x33')][_0x9d60('0x35')]?_0x45f046[_0x9d60('0x33')]:_0x2d769c['model'];_0x45f046[_0x9d60('0x37')]=qs[_0x9d60('0x38')](_0x562cfe['query'][_0x9d60('0x38')]);_0x45f046[_0x9d60('0x3d')]=qs[_0x9d60('0x31')](_[_0x9d60('0x39')](_0x562cfe[_0x9d60('0x2f')],_0x2d769c[_0x9d60('0x31')]));if(_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x3a')]){_0x45f046[_0x9d60('0x3d')]=_[_0x9d60('0x3c')](_0x45f046[_0x9d60('0x3d')],{'$or':_[_0x9d60('0x3b')](_0x45f046[_0x9d60('0x33')],function(_0x4487a6){var _0x53ab66={};_0x53ab66[_0x4487a6]={'$like':'%'+_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x3a')]+'%'};return _0x53ab66;})});}_0x45f046=_['merge']({},_0x45f046,_0x562cfe[_0x9d60('0x4a')]);return _0x5e4231[_0x9d60('0x4c')](_0x45f046);}})[_0x9d60('0x23')](function(_0x8075e6){if(_0x8075e6){_0x1b6c06=_0x8075e6[_0x9d60('0x35')];if(!_0x562cfe[_0x9d60('0x2f')]['hasOwnProperty'](_0x9d60('0x36'))){_0x45f046[_0x9d60('0x1b')]=qs[_0x9d60('0x1b')](_0x562cfe['query'][_0x9d60('0x1b')]);_0x45f046[_0x9d60('0x1c')]=qs['offset'](_0x562cfe[_0x9d60('0x2f')][_0x9d60('0x1c')]);}return _0x5e4231[_0x9d60('0x4c')](_0x45f046);}})['then'](function(_0x1be1bd){if(_0x1be1bd){return _0x1be1bd?{'count':_0x1b6c06,'rows':_0x1be1bd}:null;}})[_0x9d60('0x23')](respondWithResult(_0x4080ce,null))[_0x9d60('0x42')](handleError(_0x4080ce,null));};exports[_0x9d60('0x4d')]=function(_0xc966fc,_0x2c8749,_0x358d02){var _0x430733={};var _0x3ff008={};var _0x2d0af8;var _0x197c21;return db[_0x9d60('0x3e')][_0x9d60('0x48')]({'where':{'id':_0xc966fc[_0x9d60('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c8749,null))['then'](function(_0x2e5ba9){if(_0x2e5ba9){_0x2d0af8=_0x2e5ba9;_0x3ff008['model']=_[_0x9d60('0x30')](db['ZohoField'][_0x9d60('0x2a')]);_0x3ff008['query']=_[_0x9d60('0x30')](_0xc966fc['query']);_0x3ff008['filters']=_[_0x9d60('0x32')](_0x3ff008[_0x9d60('0x2e')],_0x3ff008[_0x9d60('0x2f')]);_0x430733[_0x9d60('0x33')]=_[_0x9d60('0x32')](_0x3ff008[_0x9d60('0x2e')],qs[_0x9d60('0x34')](_0xc966fc['query'][_0x9d60('0x34')]));_0x430733[_0x9d60('0x33')]=_0x430733['attributes'][_0x9d60('0x35')]?_0x430733['attributes']:_0x3ff008[_0x9d60('0x2e')];_0x430733[_0x9d60('0x37')]=qs[_0x9d60('0x38')](_0xc966fc[_0x9d60('0x2f')][_0x9d60('0x38')]);_0x430733[_0x9d60('0x3d')]=qs[_0x9d60('0x31')](_['pick'](_0xc966fc[_0x9d60('0x2f')],_0x3ff008['filters']));if(_0xc966fc[_0x9d60('0x2f')][_0x9d60('0x3a')]){_0x430733['where']=_['merge'](_0x430733[_0x9d60('0x3d')],{'$or':_[_0x9d60('0x3b')](_0x430733[_0x9d60('0x33')],function(_0x2cf4b3){var _0x2b06fb={};_0x2b06fb[_0x2cf4b3]={'$like':'%'+_0xc966fc[_0x9d60('0x2f')]['filter']+'%'};return _0x2b06fb;})});}_0x430733=_[_0x9d60('0x3c')]({},_0x430733,_0xc966fc[_0x9d60('0x4a')]);return _0x2d0af8[_0x9d60('0x4d')](_0x430733);}})[_0x9d60('0x23')](function(_0x54612d){if(_0x54612d){_0x197c21=_0x54612d[_0x9d60('0x35')];if(!_0xc966fc['query']['hasOwnProperty'](_0x9d60('0x36'))){_0x430733[_0x9d60('0x1b')]=qs[_0x9d60('0x1b')](_0xc966fc[_0x9d60('0x2f')][_0x9d60('0x1b')]);_0x430733[_0x9d60('0x1c')]=qs[_0x9d60('0x1c')](_0xc966fc['query'][_0x9d60('0x1c')]);}return _0x2d0af8['getDescriptions'](_0x430733);}})['then'](function(_0x1d685c){if(_0x1d685c){return _0x1d685c?{'count':_0x197c21,'rows':_0x1d685c}:null;}})[_0x9d60('0x23')](respondWithResult(_0x2c8749,null))[_0x9d60('0x42')](handleError(_0x2c8749,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fc78668..6b2081d 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 _0xb179=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util'];(function(_0x528ab4,_0x459f50){var _0xcdb379=function(_0x846ca2){while(--_0x846ca2){_0x528ab4['push'](_0x528ab4['shift']());}};_0xcdb379(++_0x459f50);}(_0xb179,0x11e));var _0x9b17=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb179[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x9b17('0x0'));var util=require(_0x9b17('0x1'));var logger=require(_0x9b17('0x2'))(_0x9b17('0x3'));var moment=require(_0x9b17('0x4'));var BPromise=require(_0x9b17('0x5'));var rp=require(_0x9b17('0x6'));var fs=require('fs');var path=require(_0x9b17('0x7'));var rimraf=require('rimraf');var config=require(_0x9b17('0x8'));var attributes=require(_0x9b17('0x9'));module['exports']=function(_0x259c31,_0xe0bc56){return _0x259c31[_0x9b17('0xa')](_0x9b17('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x743e=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0x743e,0xe4));var _0xe743=function(_0x2563f7,_0x4daa86){_0x2563f7=_0x2563f7-0x0;var _0x4d65fd=_0x743e[_0x2563f7];return _0x4d65fd;};'use strict';var _=require(_0xe743('0x0'));var util=require(_0xe743('0x1'));var logger=require(_0xe743('0x2'))('api');var moment=require(_0xe743('0x3'));var BPromise=require('bluebird');var rp=require(_0xe743('0x4'));var fs=require('fs');var path=require(_0xe743('0x5'));var rimraf=require('rimraf');var config=require(_0xe743('0x6'));var attributes=require(_0xe743('0x7'));module[_0xe743('0x8')]=function(_0x3a6261,_0x532524){return _0x3a6261[_0xe743('0x9')](_0xe743('0xa'),attributes,{'tableName':_0xe743('0xb'),'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 013086c..609c690 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 _0xb87a=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5e89d8,_0x30a21a){var _0x5c1153=function(_0x2dcba0){while(--_0x2dcba0){_0x5e89d8['push'](_0x5e89d8['shift']());}};_0x5c1153(++_0x30a21a);}(_0xb87a,0x1ba));var _0xab87=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xb87a[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0xab87('0x0'));var util=require(_0xab87('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab87('0x2'));var fs=require('fs');var Redis=require(_0xab87('0x3'));var db=require(_0xab87('0x4'))['db'];var utils=require(_0xab87('0x5'));var logger=require(_0xab87('0x6'))('rpc');var config=require(_0xab87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab87('0x8')][_0xab87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ce31f,_0x38b3c4,_0x33c268){return new BPromise(function(_0x4171b2,_0x1e3c57){return client['request'](_0x2ce31f,_0x33c268)[_0xab87('0xa')](function(_0x562ddf){logger[_0xab87('0xb')](_0xab87('0xc'),_0x38b3c4,_0xab87('0xd'));logger[_0xab87('0xe')](_0xab87('0xf'),_0x38b3c4,_0xab87('0xd'),JSON[_0xab87('0x10')](_0x562ddf));if(_0x562ddf['error']){if(_0x562ddf[_0xab87('0x11')]['code']===0x1f4){logger['error'](_0xab87('0xc'),_0x38b3c4,_0x562ddf[_0xab87('0x11')][_0xab87('0x12')]);return _0x1e3c57(_0x562ddf['error']['message']);}logger[_0xab87('0x11')](_0xab87('0xc'),_0x38b3c4,_0x562ddf[_0xab87('0x11')][_0xab87('0x12')]);return _0x4171b2(_0x562ddf[_0xab87('0x11')][_0xab87('0x12')]);}else{logger['info'](_0xab87('0xc'),_0x38b3c4,_0xab87('0xd'));_0x4171b2(_0x562ddf[_0xab87('0x13')][_0xab87('0x12')]);}})[_0xab87('0x14')](function(_0x56b222){logger[_0xab87('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x38b3c4,_0x56b222);_0x1e3c57(_0x56b222);});});} \ No newline at end of file +var _0x7108=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2d04b3,_0x3723f6){var _0x5e6bf6=function(_0xa4e13b){while(--_0xa4e13b){_0x2d04b3['push'](_0x2d04b3['shift']());}};_0x5e6bf6(++_0x3723f6);}(_0x7108,0x127));var _0x8710=function(_0x5de924,_0x18fcc0){_0x5de924=_0x5de924-0x0;var _0x4b98d0=_0x7108[_0x5de924];return _0x4b98d0;};'use strict';var _=require(_0x8710('0x0'));var util=require(_0x8710('0x1'));var moment=require(_0x8710('0x2'));var BPromise=require(_0x8710('0x3'));var rs=require(_0x8710('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8710('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8710('0x6'))(_0x8710('0x7'));var config=require(_0x8710('0x8'));var jayson=require(_0x8710('0x9'));var client=jayson[_0x8710('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23fcd9,_0x37309b,_0x26d0cf){return new BPromise(function(_0x19eb5d,_0x17f653){return client[_0x8710('0xb')](_0x23fcd9,_0x26d0cf)[_0x8710('0xc')](function(_0x41554a){logger['info'](_0x8710('0xd'),_0x37309b,_0x8710('0xe'));logger[_0x8710('0xf')](_0x8710('0x10'),_0x37309b,_0x8710('0xe'),JSON['stringify'](_0x41554a));if(_0x41554a[_0x8710('0x11')]){if(_0x41554a[_0x8710('0x11')][_0x8710('0x12')]===0x1f4){logger[_0x8710('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x37309b,_0x41554a[_0x8710('0x11')][_0x8710('0x13')]);return _0x17f653(_0x41554a['error']['message']);}logger[_0x8710('0x11')](_0x8710('0xd'),_0x37309b,_0x41554a[_0x8710('0x11')]['message']);return _0x19eb5d(_0x41554a[_0x8710('0x11')][_0x8710('0x13')]);}else{logger[_0x8710('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x37309b,_0x8710('0xe'));_0x19eb5d(_0x41554a['result'][_0x8710('0x13')]);}})[_0x8710('0x15')](function(_0x1463e1){logger[_0x8710('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x37309b,_0x1463e1);_0x17f653(_0x1463e1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 584a2ea..1e4666f 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 _0x0462=['index','/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0462,0x74));var _0x2046=function(_0x1f1379,_0x5a4203){_0x1f1379=_0x1f1379-0x0;var _0xa95f7f=_0x0462[_0x1f1379];return _0xa95f7f;};'use strict';var multer=require('multer');var util=require(_0x2046('0x0'));var path=require(_0x2046('0x1'));var timeout=require(_0x2046('0x2'));var express=require(_0x2046('0x3'));var router=express[_0x2046('0x4')]();var fs_extra=require(_0x2046('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2046('0x6'));var controller=require(_0x2046('0x7'));router[_0x2046('0x8')]('/',auth[_0x2046('0x9')](),controller[_0x2046('0xa')]);router[_0x2046('0x8')](_0x2046('0xb'),auth['isAuthenticated'](),controller[_0x2046('0xc')]);router[_0x2046('0xd')]('/',auth[_0x2046('0x9')](),controller[_0x2046('0xe')]);router[_0x2046('0xf')](_0x2046('0xb'),auth[_0x2046('0x9')](),controller['update']);router[_0x2046('0x10')]('/:id',auth[_0x2046('0x9')](),controller[_0x2046('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdfb2=['delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x3b1b28,_0x70b837){var _0x401f9d=function(_0x20a747){while(--_0x20a747){_0x3b1b28['push'](_0x3b1b28['shift']());}};_0x401f9d(++_0x70b837);}(_0xdfb2,0x81));var _0x2dfb=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xdfb2[_0x2763f2];return _0x3ef471;};'use strict';var multer=require('multer');var util=require(_0x2dfb('0x0'));var path=require('path');var timeout=require(_0x2dfb('0x1'));var express=require(_0x2dfb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2dfb('0x3'));var interaction=require(_0x2dfb('0x4'));var config=require(_0x2dfb('0x5'));var controller=require(_0x2dfb('0x6'));router['get']('/',auth[_0x2dfb('0x7')](),controller[_0x2dfb('0x8')]);router[_0x2dfb('0x9')](_0x2dfb('0xa'),auth[_0x2dfb('0x7')](),controller[_0x2dfb('0xb')]);router[_0x2dfb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2dfb('0xd')](_0x2dfb('0xa'),auth[_0x2dfb('0x7')](),controller[_0x2dfb('0xe')]);router[_0x2dfb('0xf')](_0x2dfb('0xa'),auth[_0x2dfb('0x7')](),controller[_0x2dfb('0x10')]);module[_0x2dfb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 34afef9..a4249e0 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 _0xdac8=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x445e39,_0x277e73){var _0x288e77=function(_0x281d03){while(--_0x281d03){_0x445e39['push'](_0x445e39['shift']());}};_0x288e77(++_0x277e73);}(_0xdac8,0x1d4));var _0x8dac=function(_0xea54f4,_0x11c814){_0xea54f4=_0xea54f4-0x0;var _0xb8498a=_0xdac8[_0xea54f4];return _0xb8498a;};'use strict';var Sequelize=require(_0x8dac('0x0'));module[_0x8dac('0x1')]={'type':{'type':Sequelize[_0x8dac('0x2')](_0x8dac('0x3'),_0x8dac('0x4'),'customVariable',_0x8dac('0x5'),_0x8dac('0x6')),'defaultValue':_0x8dac('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8dac('0x7')]},'keyType':{'type':Sequelize[_0x8dac('0x2')]('string','variable',_0x8dac('0x8'))},'keyContent':{'type':Sequelize[_0x8dac('0x7')]},'idField':{'type':Sequelize[_0x8dac('0x7')]},'nameField':{'type':Sequelize[_0x8dac('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8dac('0x7')]}}; \ No newline at end of file +var _0x0b7c=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x0b7c,0x66));var _0xc0b7=function(_0x3e1829,_0xc8ccda){_0x3e1829=_0x3e1829-0x0;var _0x129345=_0x0b7c[_0x3e1829];return _0x129345;};'use strict';var Sequelize=require(_0xc0b7('0x0'));module[_0xc0b7('0x1')]={'type':{'type':Sequelize[_0xc0b7('0x2')](_0xc0b7('0x3'),_0xc0b7('0x4'),_0xc0b7('0x5'),_0xc0b7('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc0b7('0x7')]},'key':{'type':Sequelize[_0xc0b7('0x7')]},'keyType':{'type':Sequelize[_0xc0b7('0x2')](_0xc0b7('0x3'),'variable',_0xc0b7('0x5'))},'keyContent':{'type':Sequelize[_0xc0b7('0x7')]},'idField':{'type':Sequelize[_0xc0b7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc0b7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc0b7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2501cba..e6668b8 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 _0xfe1b=['params','length','options','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe1b,0x96));var _0xbfe1=function(_0x1057cd,_0x4fe93d){_0x1057cd=_0x1057cd-0x0;var _0x149799=_0xfe1b[_0x1057cd];return _0x149799;};'use strict';var emlformat=require(_0xbfe1('0x0'));var rimraf=require(_0xbfe1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbfe1('0x2'));var moment=require(_0xbfe1('0x3'));var BPromise=require(_0xbfe1('0x4'));var Mustache=require(_0xbfe1('0x5'));var util=require(_0xbfe1('0x6'));var path=require(_0xbfe1('0x7'));var sox=require('sox');var csv=require(_0xbfe1('0x8'));var ejs=require(_0xbfe1('0x9'));var fs=require('fs');var fs_extra=require(_0xbfe1('0xa'));var _=require('lodash');var squel=require(_0xbfe1('0xb'));var crypto=require('crypto');var jsforce=require(_0xbfe1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbfe1('0x8'));var querystring=require(_0xbfe1('0xd'));var Papa=require(_0xbfe1('0xe'));var Redis=require('ioredis');var authService=require(_0xbfe1('0xf'));var qs=require(_0xbfe1('0x10'));var as=require(_0xbfe1('0x11'));var hardwareService=require(_0xbfe1('0x12'));var logger=require(_0xbfe1('0x13'))(_0xbfe1('0x14'));var utils=require(_0xbfe1('0x15'));var config=require(_0xbfe1('0x16'));var licenseUtil=require(_0xbfe1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5922c0,_0x4c6002){_0x4c6002=_0x4c6002||0xcc;return function(_0x222b22){if(_0x222b22){return _0x5922c0['sendStatus'](_0x4c6002);}return _0x5922c0[_0xbfe1('0x18')](_0x4c6002)[_0xbfe1('0x19')]();};}function respondWithResult(_0x2ebece,_0x1dd9d2){_0x1dd9d2=_0x1dd9d2||0xc8;return function(_0x34de84){if(_0x34de84){return _0x2ebece['status'](_0x1dd9d2)[_0xbfe1('0x1a')](_0x34de84);}};}function respondWithFilteredResult(_0x3ed3c0,_0x1fd693){return function(_0x3a8ed2){if(_0x3a8ed2){var _0x6d8978=typeof _0x1fd693['offset']==='undefined'&&typeof _0x1fd693[_0xbfe1('0x1b')]===_0xbfe1('0x1c');var _0x5d6d22=_0x3a8ed2[_0xbfe1('0x1d')];var _0x2d24c6=_0x6d8978?0x0:_0x1fd693[_0xbfe1('0x1e')];var _0x55f6cf=_0x6d8978?_0x3a8ed2[_0xbfe1('0x1d')]:_0x1fd693[_0xbfe1('0x1e')]+_0x1fd693[_0xbfe1('0x1b')];var _0x53b735;if(_0x55f6cf>=_0x5d6d22){_0x55f6cf=_0x5d6d22;_0x53b735=0xc8;}else{_0x53b735=0xce;}_0x3ed3c0[_0xbfe1('0x18')](_0x53b735);return _0x3ed3c0[_0xbfe1('0x1f')](_0xbfe1('0x20'),_0x2d24c6+'-'+_0x55f6cf+'/'+_0x5d6d22)[_0xbfe1('0x1a')](_0x3a8ed2);}return null;};}function patchUpdates(_0x14cb7e){return function(_0x11c719){try{jsonpatch['apply'](_0x11c719,_0x14cb7e,!![]);}catch(_0x132452){return BPromise[_0xbfe1('0x21')](_0x132452);}return _0x11c719[_0xbfe1('0x22')]();};}function saveUpdates(_0x55eff2,_0x2ba2a0){return function(_0x3ea348){if(_0x3ea348){return _0x3ea348[_0xbfe1('0x23')](_0x55eff2)[_0xbfe1('0x24')](function(_0x19ff37){return _0x19ff37;});}return null;};}function removeEntity(_0x566bc3,_0x57352d){return function(_0x4c762c){if(_0x4c762c){return _0x4c762c['destroy']()[_0xbfe1('0x24')](function(){_0x566bc3['status'](0xcc)[_0xbfe1('0x19')]();});}};}function handleEntityNotFound(_0x1c2e8b,_0x16e413){return function(_0x3c0921){if(!_0x3c0921){_0x1c2e8b[_0xbfe1('0x25')](0x194);}return _0x3c0921;};}function handleError(_0x2cf88d,_0x5cf980){_0x5cf980=_0x5cf980||0x1f4;return function(_0x2dfb74){logger['error'](_0x2dfb74[_0xbfe1('0x26')]);if(_0x2dfb74[_0xbfe1('0x27')]){delete _0x2dfb74[_0xbfe1('0x27')];}_0x2cf88d[_0xbfe1('0x18')](_0x5cf980)[_0xbfe1('0x28')](_0x2dfb74);};}exports[_0xbfe1('0x29')]=function(_0x5c6e17,_0x13f7ac){var _0x57a86b={},_0x2bbf8f={},_0x2bcff5={'count':0x0,'rows':[]};var _0x349927=_[_0xbfe1('0x2a')](db[_0xbfe1('0x2b')][_0xbfe1('0x2c')],function(_0x2b4bd2){return{'name':_0x2b4bd2['fieldName'],'type':_0x2b4bd2[_0xbfe1('0x2d')][_0xbfe1('0x2e')]};});_0x2bbf8f['model']=_[_0xbfe1('0x2a')](_0x349927,_0xbfe1('0x27'));_0x2bbf8f[_0xbfe1('0x2f')]=_[_0xbfe1('0x30')](_0x5c6e17['query']);_0x2bbf8f[_0xbfe1('0x31')]=_[_0xbfe1('0x32')](_0x2bbf8f[_0xbfe1('0x33')],_0x2bbf8f['query']);_0x57a86b[_0xbfe1('0x34')]=_[_0xbfe1('0x32')](_0x2bbf8f[_0xbfe1('0x33')],qs[_0xbfe1('0x35')](_0x5c6e17[_0xbfe1('0x2f')][_0xbfe1('0x35')]));_0x57a86b['attributes']=_0x57a86b[_0xbfe1('0x34')]['length']?_0x57a86b[_0xbfe1('0x34')]:_0x2bbf8f['model'];if(!_0x5c6e17[_0xbfe1('0x2f')]['hasOwnProperty']('nolimit')){_0x57a86b[_0xbfe1('0x1b')]=qs[_0xbfe1('0x1b')](_0x5c6e17[_0xbfe1('0x2f')][_0xbfe1('0x1b')]);_0x57a86b[_0xbfe1('0x1e')]=qs[_0xbfe1('0x1e')](_0x5c6e17[_0xbfe1('0x2f')]['offset']);}_0x57a86b['order']=qs['sort'](_0x5c6e17[_0xbfe1('0x2f')][_0xbfe1('0x36')]);_0x57a86b['where']=qs[_0xbfe1('0x31')](_[_0xbfe1('0x37')](_0x5c6e17[_0xbfe1('0x2f')],_0x2bbf8f[_0xbfe1('0x31')]),_0x349927);if(_0x5c6e17['query']['filter']){_0x57a86b[_0xbfe1('0x38')]=_['merge'](_0x57a86b[_0xbfe1('0x38')],{'$or':_[_0xbfe1('0x2a')](_0x349927,function(_0x4bb34d){if(_0x4bb34d['type']!==_0xbfe1('0x39')){var _0x57989c={};_0x57989c[_0x4bb34d[_0xbfe1('0x27')]]={'$like':'%'+_0x5c6e17[_0xbfe1('0x2f')][_0xbfe1('0x3a')]+'%'};return _0x57989c;}})});}_0x57a86b=_[_0xbfe1('0x3b')]({},_0x57a86b,_0x5c6e17['options']);var _0x2bfb71={'where':_0x57a86b['where']};return db[_0xbfe1('0x2b')][_0xbfe1('0x1d')](_0x2bfb71)[_0xbfe1('0x24')](function(_0x9c076a){_0x2bcff5['count']=_0x9c076a;if(_0x5c6e17[_0xbfe1('0x2f')][_0xbfe1('0x3c')]){_0x57a86b[_0xbfe1('0x3d')]=[{'all':!![]}];}return db['ZohoField'][_0xbfe1('0x3e')](_0x57a86b);})[_0xbfe1('0x24')](function(_0x3af809){_0x2bcff5[_0xbfe1('0x3f')]=_0x3af809;return _0x2bcff5;})[_0xbfe1('0x24')](respondWithFilteredResult(_0x13f7ac,_0x57a86b))[_0xbfe1('0x40')](handleError(_0x13f7ac,null));};exports[_0xbfe1('0x41')]=function(_0x7b200f,_0xceef59){var _0x59e829={'raw':!![],'where':{'id':_0x7b200f[_0xbfe1('0x42')]['id']}},_0x5e4d24={};_0x5e4d24[_0xbfe1('0x33')]=_['keys'](db['ZohoField'][_0xbfe1('0x2c')]);_0x5e4d24['query']=_['keys'](_0x7b200f[_0xbfe1('0x2f')]);_0x5e4d24[_0xbfe1('0x31')]=_[_0xbfe1('0x32')](_0x5e4d24[_0xbfe1('0x33')],_0x5e4d24[_0xbfe1('0x2f')]);_0x59e829[_0xbfe1('0x34')]=_[_0xbfe1('0x32')](_0x5e4d24[_0xbfe1('0x33')],qs[_0xbfe1('0x35')](_0x7b200f[_0xbfe1('0x2f')]['fields']));_0x59e829[_0xbfe1('0x34')]=_0x59e829['attributes'][_0xbfe1('0x43')]?_0x59e829[_0xbfe1('0x34')]:_0x5e4d24[_0xbfe1('0x33')];if(_0x7b200f[_0xbfe1('0x2f')][_0xbfe1('0x3c')]){_0x59e829['include']=[{'all':!![]}];}_0x59e829=_[_0xbfe1('0x3b')]({},_0x59e829,_0x7b200f[_0xbfe1('0x44')]);return db['ZohoField'][_0xbfe1('0x45')](_0x59e829)[_0xbfe1('0x24')](handleEntityNotFound(_0xceef59,null))[_0xbfe1('0x24')](respondWithResult(_0xceef59,null))[_0xbfe1('0x40')](handleError(_0xceef59,null));};exports['create']=function(_0x16e3e1,_0x172cf5){return db[_0xbfe1('0x2b')][_0xbfe1('0x46')](_0x16e3e1['body'],{})[_0xbfe1('0x24')](respondWithResult(_0x172cf5,0xc9))[_0xbfe1('0x40')](handleError(_0x172cf5,null));};exports['update']=function(_0x5d4cfc,_0x2576f1){if(_0x5d4cfc[_0xbfe1('0x47')]['id']){delete _0x5d4cfc['body']['id'];}return db[_0xbfe1('0x2b')][_0xbfe1('0x45')]({'where':{'id':_0x5d4cfc[_0xbfe1('0x42')]['id']}})[_0xbfe1('0x24')](handleEntityNotFound(_0x2576f1,null))[_0xbfe1('0x24')](saveUpdates(_0x5d4cfc[_0xbfe1('0x47')],null))['then'](respondWithResult(_0x2576f1,null))['catch'](handleError(_0x2576f1,null));};exports['destroy']=function(_0x27a37e,_0x24f17d){return db[_0xbfe1('0x2b')]['find']({'where':{'id':_0x27a37e['params']['id']}})[_0xbfe1('0x24')](handleEntityNotFound(_0x24f17d,null))[_0xbfe1('0x24')](removeEntity(_0x24f17d,null))[_0xbfe1('0x40')](handleError(_0x24f17d,null));}; \ No newline at end of file +var _0xcd78=['then','destroy','stack','send','index','ZohoField','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','apply','save'];(function(_0x382a17,_0x29c95d){var _0x329c99=function(_0x4a78ec){while(--_0x4a78ec){_0x382a17['push'](_0x382a17['shift']());}};_0x329c99(++_0x29c95d);}(_0xcd78,0xa9));var _0x8cd7=function(_0x5dc654,_0x337bd6){_0x5dc654=_0x5dc654-0x0;var _0x189859=_0xcd78[_0x5dc654];return _0x189859;};'use strict';var emlformat=require(_0x8cd7('0x0'));var rimraf=require(_0x8cd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cd7('0x2'));var rp=require(_0x8cd7('0x3'));var moment=require(_0x8cd7('0x4'));var BPromise=require(_0x8cd7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8cd7('0x6'));var csv=require('to-csv');var ejs=require(_0x8cd7('0x7'));var fs=require('fs');var fs_extra=require(_0x8cd7('0x8'));var _=require(_0x8cd7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cd7('0xa'));var toCsv=require(_0x8cd7('0xb'));var querystring=require(_0x8cd7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cd7('0xd'));var qs=require(_0x8cd7('0xe'));var as=require(_0x8cd7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8cd7('0x10'));var licenseUtil=require(_0x8cd7('0x11'));var db=require(_0x8cd7('0x12'))['db'];function respondWithStatusCode(_0x1e1816,_0x2d6488){_0x2d6488=_0x2d6488||0xcc;return function(_0x3772ab){if(_0x3772ab){return _0x1e1816[_0x8cd7('0x13')](_0x2d6488);}return _0x1e1816['status'](_0x2d6488)[_0x8cd7('0x14')]();};}function respondWithResult(_0x204f1c,_0x53b4e9){_0x53b4e9=_0x53b4e9||0xc8;return function(_0x273b36){if(_0x273b36){return _0x204f1c['status'](_0x53b4e9)[_0x8cd7('0x15')](_0x273b36);}};}function respondWithFilteredResult(_0x46222c,_0x11eef9){return function(_0x5e800c){if(_0x5e800c){var _0x47eacb=typeof _0x11eef9[_0x8cd7('0x16')]===_0x8cd7('0x17')&&typeof _0x11eef9[_0x8cd7('0x18')]==='undefined';var _0x5207a5=_0x5e800c['count'];var _0x39b142=_0x47eacb?0x0:_0x11eef9[_0x8cd7('0x16')];var _0x4e21a5=_0x47eacb?_0x5e800c['count']:_0x11eef9[_0x8cd7('0x16')]+_0x11eef9[_0x8cd7('0x18')];var _0x51084f;if(_0x4e21a5>=_0x5207a5){_0x4e21a5=_0x5207a5;_0x51084f=0xc8;}else{_0x51084f=0xce;}_0x46222c[_0x8cd7('0x19')](_0x51084f);return _0x46222c[_0x8cd7('0x1a')]('Content-Range',_0x39b142+'-'+_0x4e21a5+'/'+_0x5207a5)[_0x8cd7('0x15')](_0x5e800c);}return null;};}function patchUpdates(_0x5429f5){return function(_0x51b011){try{jsonpatch[_0x8cd7('0x1b')](_0x51b011,_0x5429f5,!![]);}catch(_0x1964e7){return BPromise['reject'](_0x1964e7);}return _0x51b011[_0x8cd7('0x1c')]();};}function saveUpdates(_0x23c0a0,_0x36ae69){return function(_0x593374){if(_0x593374){return _0x593374['update'](_0x23c0a0)[_0x8cd7('0x1d')](function(_0x3d18e3){return _0x3d18e3;});}return null;};}function removeEntity(_0x3e35b9,_0xc5cd33){return function(_0x523455){if(_0x523455){return _0x523455[_0x8cd7('0x1e')]()['then'](function(){_0x3e35b9[_0x8cd7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba3de,_0x359b4d){return function(_0x3dafe4){if(!_0x3dafe4){_0xba3de[_0x8cd7('0x13')](0x194);}return _0x3dafe4;};}function handleError(_0x2eec77,_0x2a0e00){_0x2a0e00=_0x2a0e00||0x1f4;return function(_0x5cbedb){logger['error'](_0x5cbedb[_0x8cd7('0x1f')]);if(_0x5cbedb['name']){delete _0x5cbedb['name'];}_0x2eec77[_0x8cd7('0x19')](_0x2a0e00)[_0x8cd7('0x20')](_0x5cbedb);};}exports[_0x8cd7('0x21')]=function(_0x342c1c,_0x427811){var _0x27fed1={},_0x31ad86={},_0x4331db={'count':0x0,'rows':[]};var _0x387472=_['map'](db[_0x8cd7('0x22')][_0x8cd7('0x23')],function(_0x2dc257){return{'name':_0x2dc257[_0x8cd7('0x24')],'type':_0x2dc257[_0x8cd7('0x25')]['key']};});_0x31ad86[_0x8cd7('0x26')]=_[_0x8cd7('0x27')](_0x387472,_0x8cd7('0x28'));_0x31ad86[_0x8cd7('0x29')]=_[_0x8cd7('0x2a')](_0x342c1c[_0x8cd7('0x29')]);_0x31ad86['filters']=_[_0x8cd7('0x2b')](_0x31ad86[_0x8cd7('0x26')],_0x31ad86[_0x8cd7('0x29')]);_0x27fed1[_0x8cd7('0x2c')]=_[_0x8cd7('0x2b')](_0x31ad86[_0x8cd7('0x26')],qs[_0x8cd7('0x2d')](_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x2d')]));_0x27fed1[_0x8cd7('0x2c')]=_0x27fed1[_0x8cd7('0x2c')][_0x8cd7('0x2e')]?_0x27fed1[_0x8cd7('0x2c')]:_0x31ad86[_0x8cd7('0x26')];if(!_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x2f')](_0x8cd7('0x30'))){_0x27fed1[_0x8cd7('0x18')]=qs[_0x8cd7('0x18')](_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x18')]);_0x27fed1[_0x8cd7('0x16')]=qs['offset'](_0x342c1c['query'][_0x8cd7('0x16')]);}_0x27fed1['order']=qs['sort'](_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x31')]);_0x27fed1['where']=qs['filters'](_[_0x8cd7('0x32')](_0x342c1c[_0x8cd7('0x29')],_0x31ad86[_0x8cd7('0x33')]),_0x387472);if(_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x34')]){_0x27fed1[_0x8cd7('0x35')]=_[_0x8cd7('0x36')](_0x27fed1['where'],{'$or':_[_0x8cd7('0x27')](_0x387472,function(_0x2aca01){if(_0x2aca01[_0x8cd7('0x25')]!==_0x8cd7('0x37')){var _0x1b1028={};_0x1b1028[_0x2aca01[_0x8cd7('0x28')]]={'$like':'%'+_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x34')]+'%'};return _0x1b1028;}})});}_0x27fed1=_[_0x8cd7('0x36')]({},_0x27fed1,_0x342c1c[_0x8cd7('0x38')]);var _0x2db7dc={'where':_0x27fed1[_0x8cd7('0x35')]};return db[_0x8cd7('0x22')][_0x8cd7('0x39')](_0x2db7dc)[_0x8cd7('0x1d')](function(_0x1d5f58){_0x4331db[_0x8cd7('0x39')]=_0x1d5f58;if(_0x342c1c[_0x8cd7('0x29')][_0x8cd7('0x3a')]){_0x27fed1['include']=[{'all':!![]}];}return db[_0x8cd7('0x22')][_0x8cd7('0x3b')](_0x27fed1);})[_0x8cd7('0x1d')](function(_0x17ca18){_0x4331db['rows']=_0x17ca18;return _0x4331db;})['then'](respondWithFilteredResult(_0x427811,_0x27fed1))[_0x8cd7('0x3c')](handleError(_0x427811,null));};exports[_0x8cd7('0x3d')]=function(_0x319b6f,_0x5318ad){var _0x33fca6={'raw':!![],'where':{'id':_0x319b6f[_0x8cd7('0x3e')]['id']}},_0x60e4e2={};_0x60e4e2[_0x8cd7('0x26')]=_['keys'](db[_0x8cd7('0x22')]['rawAttributes']);_0x60e4e2[_0x8cd7('0x29')]=_[_0x8cd7('0x2a')](_0x319b6f[_0x8cd7('0x29')]);_0x60e4e2[_0x8cd7('0x33')]=_[_0x8cd7('0x2b')](_0x60e4e2[_0x8cd7('0x26')],_0x60e4e2['query']);_0x33fca6[_0x8cd7('0x2c')]=_[_0x8cd7('0x2b')](_0x60e4e2[_0x8cd7('0x26')],qs[_0x8cd7('0x2d')](_0x319b6f['query'][_0x8cd7('0x2d')]));_0x33fca6[_0x8cd7('0x2c')]=_0x33fca6[_0x8cd7('0x2c')]['length']?_0x33fca6[_0x8cd7('0x2c')]:_0x60e4e2[_0x8cd7('0x26')];if(_0x319b6f[_0x8cd7('0x29')]['includeAll']){_0x33fca6[_0x8cd7('0x3f')]=[{'all':!![]}];}_0x33fca6=_['merge']({},_0x33fca6,_0x319b6f[_0x8cd7('0x38')]);return db[_0x8cd7('0x22')]['find'](_0x33fca6)['then'](handleEntityNotFound(_0x5318ad,null))[_0x8cd7('0x1d')](respondWithResult(_0x5318ad,null))['catch'](handleError(_0x5318ad,null));};exports[_0x8cd7('0x40')]=function(_0x402008,_0x399ad8){return db[_0x8cd7('0x22')]['create'](_0x402008[_0x8cd7('0x41')],{})[_0x8cd7('0x1d')](respondWithResult(_0x399ad8,0xc9))['catch'](handleError(_0x399ad8,null));};exports['update']=function(_0x286c73,_0x7fa08c){if(_0x286c73['body']['id']){delete _0x286c73[_0x8cd7('0x41')]['id'];}return db[_0x8cd7('0x22')]['find']({'where':{'id':_0x286c73[_0x8cd7('0x3e')]['id']}})[_0x8cd7('0x1d')](handleEntityNotFound(_0x7fa08c,null))[_0x8cd7('0x1d')](saveUpdates(_0x286c73[_0x8cd7('0x41')],null))[_0x8cd7('0x1d')](respondWithResult(_0x7fa08c,null))['catch'](handleError(_0x7fa08c,null));};exports[_0x8cd7('0x1e')]=function(_0x3df7aa,_0x4538e0){return db[_0x8cd7('0x22')]['find']({'where':{'id':_0x3df7aa[_0x8cd7('0x3e')]['id']}})[_0x8cd7('0x1d')](handleEntityNotFound(_0x4538e0,null))[_0x8cd7('0x1d')](removeEntity(_0x4538e0,null))['catch'](handleError(_0x4538e0,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1c61f1e..d0facb6 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 _0x4bd3=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4bd3,0x174));var _0x34bd=function(_0x4d3133,_0x5434a1){_0x4d3133=_0x4d3133-0x0;var _0x534072=_0x4bd3[_0x4d3133];return _0x534072;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intZohoField.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0xa'),_0x34bd('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['path','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x28d7c5,_0x4666bc){var _0x23c9d1=function(_0x4618e2){while(--_0x4618e2){_0x28d7c5['push'](_0x28d7c5['shift']());}};_0x23c9d1(++_0x4666bc);}(_0xa46e,0x8a));var _0xea46=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xa46e[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intZohoField.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('ZohoField',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xb'),_0xea46('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 1ea97ea..8e85f4c 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 _0x386c=['then','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','client','http','request'];(function(_0x307046,_0x45e3a6){var _0x2183b2=function(_0x4f70ba){while(--_0x4f70ba){_0x307046['push'](_0x307046['shift']());}};_0x2183b2(++_0x45e3a6);}(_0x386c,0x1eb));var _0xc386=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x386c[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xc386('0x0'));var util=require(_0xc386('0x1'));var moment=require(_0xc386('0x2'));var BPromise=require('bluebird');var rs=require(_0xc386('0x3'));var fs=require('fs');var Redis=require(_0xc386('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc386('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc386('0x6')][_0xc386('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56b38c,_0x537f68,_0x1e9b66){return new BPromise(function(_0x213ca6,_0x274469){return client[_0xc386('0x8')](_0x56b38c,_0x1e9b66)[_0xc386('0x9')](function(_0x431b4f){logger[_0xc386('0xa')]('ZohoField,\x20%s,\x20%s',_0x537f68,_0xc386('0xb'));logger['debug'](_0xc386('0xc'),_0x537f68,_0xc386('0xb'),JSON[_0xc386('0xd')](_0x431b4f));if(_0x431b4f[_0xc386('0xe')]){if(_0x431b4f[_0xc386('0xe')][_0xc386('0xf')]===0x1f4){logger[_0xc386('0xe')](_0xc386('0x10'),_0x537f68,_0x431b4f[_0xc386('0xe')][_0xc386('0x11')]);return _0x274469(_0x431b4f[_0xc386('0xe')][_0xc386('0x11')]);}logger['error'](_0xc386('0x10'),_0x537f68,_0x431b4f[_0xc386('0xe')][_0xc386('0x11')]);return _0x213ca6(_0x431b4f[_0xc386('0xe')]['message']);}else{logger[_0xc386('0xa')]('ZohoField,\x20%s,\x20%s',_0x537f68,'request\x20sent');_0x213ca6(_0x431b4f[_0xc386('0x12')][_0xc386('0x11')]);}})[_0xc386('0x13')](function(_0x558e32){logger[_0xc386('0xe')]('ZohoField,\x20%s,\x20%s',_0x537f68,_0x558e32);_0x274469(_0x558e32);});});} \ No newline at end of file +var _0x6fee=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0xd4826e,_0x12cd4f){var _0x22457d=function(_0x27397e){while(--_0x27397e){_0xd4826e['push'](_0xd4826e['shift']());}};_0x22457d(++_0x12cd4f);}(_0x6fee,0x77));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe6fe('0x0'));var util=require('util');var moment=require(_0xe6fe('0x1'));var BPromise=require(_0xe6fe('0x2'));var rs=require(_0xe6fe('0x3'));var fs=require('fs');var Redis=require(_0xe6fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6fe('0x5'));var logger=require(_0xe6fe('0x6'))(_0xe6fe('0x7'));var config=require(_0xe6fe('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe6fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3857f2,_0x4ed886,_0x28e9ed){return new BPromise(function(_0x1852e7,_0x4fc4c8){return client[_0xe6fe('0xa')](_0x3857f2,_0x28e9ed)[_0xe6fe('0xb')](function(_0x282cf6){logger['info'](_0xe6fe('0xc'),_0x4ed886,'request\x20sent');logger[_0xe6fe('0xd')](_0xe6fe('0xe'),_0x4ed886,_0xe6fe('0xf'),JSON['stringify'](_0x282cf6));if(_0x282cf6[_0xe6fe('0x10')]){if(_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x11')]===0x1f4){logger[_0xe6fe('0x10')](_0xe6fe('0xc'),_0x4ed886,_0x282cf6[_0xe6fe('0x10')]['message']);return _0x4fc4c8(_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x12')]);}logger[_0xe6fe('0x10')](_0xe6fe('0xc'),_0x4ed886,_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x12')]);return _0x1852e7(_0x282cf6[_0xe6fe('0x10')][_0xe6fe('0x12')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x4ed886,_0xe6fe('0xf'));_0x1852e7(_0x282cf6['result']['message']);}})[_0xe6fe('0x13')](function(_0x2dc207){logger[_0xe6fe('0x10')]('ZohoField,\x20%s,\x20%s',_0x4ed886,_0x2dc207);_0x4fc4c8(_0x2dc207);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0611994..50a7af2 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x33dfbc,_0x255e09){var _0x1455dc=function(_0x11c436){while(--_0x11c436){_0x33dfbc['push'](_0x33dfbc['shift']());}};_0x1455dc(++_0x255e09);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xcb91[_0x29d2d2];return _0x3f6476;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x20d1cf,_0x3bf30a){var _0x3fbc81=function(_0x234335){while(--_0x234335){_0x20d1cf['push'](_0x20d1cf['shift']());}};_0x3fbc81(++_0x3bf30a);}(_0xe706,0xa3));var _0x6e70=function(_0x3b9859,_0x52b534){_0x3b9859=_0x3b9859-0x0;var _0x3bc080=_0xe706[_0x3b9859];return _0x3bc080;};'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 2674100..3fe423c 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 _0xe205=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0xe205,0xa7));var _0x5e20=function(_0x231c9c,_0x5d1af3){_0x231c9c=_0x231c9c-0x0;var _0x378170=_0xe205[_0x231c9c];return _0x378170;};'use strict';var Sequelize=require(_0x5e20('0x0'));module[_0x5e20('0x1')]={'name':{'type':Sequelize[_0x5e20('0x2')],'allowNull':![],'unique':_0x5e20('0x3')},'version':{'type':Sequelize[_0x5e20('0x2')],'allowNull':![],'unique':_0x5e20('0x3')},'main':{'type':Sequelize[_0x5e20('0x2')],'defaultValue':_0x5e20('0x4')},'filename':{'type':Sequelize[_0x5e20('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5e20('0x2')]},'size':{'type':Sequelize[_0x5e20('0x5')]},'active':{'type':Sequelize[_0x5e20('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5e20('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x5e20('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5e20('0x2')]},'link':{'type':Sequelize[_0x5e20('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xafd0=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0xafd0,0x18e));var _0x0afd=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xafd0[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x0afd('0x0'));module[_0x0afd('0x1')]={'name':{'type':Sequelize[_0x0afd('0x2')],'allowNull':![],'unique':_0x0afd('0x3')},'version':{'type':Sequelize[_0x0afd('0x2')],'allowNull':![],'unique':_0x0afd('0x3')},'main':{'type':Sequelize[_0x0afd('0x2')],'defaultValue':_0x0afd('0x4')},'filename':{'type':Sequelize[_0x0afd('0x2')]},'path':{'type':Sequelize[_0x0afd('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x0afd('0x5')]},'active':{'type':Sequelize[_0x0afd('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x0afd('0x2')]},'state':{'type':Sequelize[_0x0afd('0x2')],'unique':_0x0afd('0x7')},'description':{'type':Sequelize[_0x0afd('0x2')]},'title':{'type':Sequelize[_0x0afd('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0afd('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index fc3f6d4..883d990 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 _0x01d9=['map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x342bc3,_0xb913be){var _0x81b722=function(_0x2a9c80){while(--_0x2a9c80){_0x342bc3['push'](_0x342bc3['shift']());}};_0x81b722(++_0xb913be);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['Integration'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['Integration'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file +var _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x448f9d,_0xd4b6b4){var _0x566882=function(_0x92d359){while(--_0x92d359){_0x448f9d['push'](_0x448f9d['shift']());}};_0x566882(++_0xd4b6b4);}(_0xfcf0,0x138));var _0x0fcf=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xfcf0[_0x352d28];return _0x387d7e;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6d34414..85a2710 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 _0x04db=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x04db,0x15c));var _0xb04d=function(_0x163e79,_0x447bfc){_0x163e79=_0x163e79-0x0;var _0x5bcde1=_0x04db[_0x163e79];return _0x5bcde1;};'use strict';var _=require(_0xb04d('0x0'));var util=require(_0xb04d('0x1'));var logger=require('../../config/logger')(_0xb04d('0x2'));var moment=require(_0xb04d('0x3'));var BPromise=require('bluebird');var rp=require(_0xb04d('0x4'));var fs=require('fs');var path=require(_0xb04d('0x5'));var rimraf=require(_0xb04d('0x6'));var config=require(_0xb04d('0x7'));var attributes=require(_0xb04d('0x8'));module[_0xb04d('0x9')]=function(_0x36d261,_0x265ce1){return _0x36d261[_0xb04d('0xa')](_0xb04d('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ab3=['rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x541271,_0x3fa6c8){var _0x4da473=function(_0x5f4e06){while(--_0x5f4e06){_0x541271['push'](_0x541271['shift']());}};_0x4da473(++_0x3fa6c8);}(_0x3ab3,0x95));var _0x33ab=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x3ab3[_0x41d02a];return _0x4c3983;};'use strict';var _=require(_0x33ab('0x0'));var util=require(_0x33ab('0x1'));var logger=require(_0x33ab('0x2'))(_0x33ab('0x3'));var moment=require(_0x33ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x33ab('0x5'));var fs=require('fs');var path=require(_0x33ab('0x6'));var rimraf=require(_0x33ab('0x7'));var config=require(_0x33ab('0x8'));var attributes=require(_0x33ab('0x9'));module[_0x33ab('0xa')]=function(_0x3ded10,_0x145fce){return _0x3ded10['define'](_0x33ab('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ffd8b3c..9346a17 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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2d6ddb,_0x162db6){var _0x42e06f=function(_0x471075){while(--_0x471075){_0x2d6ddb['push'](_0x2d6ddb['shift']());}};_0x42e06f(++_0x162db6);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3b34c7,_0x539a28){_0x3b34c7=_0x3b34c7-0x0;var _0x664756=_0x9f0e[_0x3b34c7];return _0x664756;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x46f25d,_0x1c9a22){var _0x567a8e=function(_0x1fcf40){while(--_0x1fcf40){_0x46f25d['push'](_0x46f25d['shift']());}};_0x567a8e(++_0x1c9a22);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 63ce475..c7fce39 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 _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x5d7803,_0x30e9aa){var _0x1a43b2=function(_0x1359df){while(--_0x1359df){_0x5d7803['push'](_0x5d7803['shift']());}};_0x1a43b2(++_0x30e9aa);}(_0x66fa,0x117));var _0xa66f=function(_0x181078,_0x5f13d5){_0x181078=_0x181078-0x0;var _0x511be1=_0x66fa[_0x181078];return _0x511be1;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4111c5,_0x1b2481){var _0x341819=function(_0xbc4e78){while(--_0xbc4e78){_0x4111c5['push'](_0x4111c5['shift']());}};_0x341819(++_0x1b2481);}(_0x4975,0x86));var _0x5497=function(_0x4c7dd3,_0x4bfc28){_0x4c7dd3=_0x4c7dd3-0x0;var _0x584f73=_0x4975[_0x4c7dd3];return _0x584f73;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2101d05..8696ae5 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 _0xfa2c=['SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x3b553f,_0xb572a6){var _0x3bb5a4=function(_0x3b4d44){while(--_0x3b4d44){_0x3b553f['push'](_0x3b553f['shift']());}};_0x3bb5a4(++_0xb572a6);}(_0xfa2c,0x1d0));var _0xcfa2=function(_0x2703f6,_0x144510){_0x2703f6=_0x2703f6-0x0;var _0x4a1a33=_0xfa2c[_0x2703f6];return _0x4a1a33;};'use strict';var Sequelize=require(_0xcfa2('0x0'));module['exports']={'integration':{'type':Sequelize[_0xcfa2('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcfa2('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xcfa2('0x1')]},'membername':{'type':Sequelize[_0xcfa2('0x1')]},'agentcalledAt':{'type':Sequelize[_0xcfa2('0x2')]},'agentconnectAt':{'type':Sequelize[_0xcfa2('0x2')]},'holdtime':{'type':Sequelize[_0xcfa2('0x3')]},'agentcomplete':{'type':Sequelize[_0xcfa2('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xcfa2('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xcfa2('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xcfa2('0x2')]},'agentdump':{'type':Sequelize[_0xcfa2('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xcfa2('0x2')]},'lastevent':{'type':Sequelize[_0xcfa2('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xcfa2('0x3')]},'channelstatedesc':{'type':Sequelize[_0xcfa2('0x1')]},'connectedlinenum':{'type':Sequelize[_0xcfa2('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcfa2('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xcfa2('0x1')]},'priority':{'type':Sequelize[_0xcfa2('0x1')]},'destchannel':{'type':Sequelize[_0xcfa2('0x1')]},'destchannelstate':{'type':Sequelize[_0xcfa2('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xcfa2('0x1')]},'destcalleridnum':{'type':Sequelize[_0xcfa2('0x1')]},'destcalleridname':{'type':Sequelize[_0xcfa2('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xcfa2('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xcfa2('0x1')]},'destlanguage':{'type':Sequelize[_0xcfa2('0x1')]},'destaccountcode':{'type':Sequelize[_0xcfa2('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xcfa2('0x1')]},'destpriority':{'type':Sequelize[_0xcfa2('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xcfa2('0x1')]},'inReplyTo':{'type':Sequelize[_0xcfa2('0x1')]},'subject':{'type':Sequelize[_0xcfa2('0x1')]},'from':{'type':Sequelize[_0xcfa2('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xcfa2('0x1')]},'attachment':{'type':Sequelize[_0xcfa2('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xcfa2('0x5')]},'status':{'type':Sequelize['ENUM'](_0xcfa2('0x6'),_0xcfa2('0x7'),_0xcfa2('0x8'),_0xcfa2('0x9'))},'url':{'type':Sequelize[_0xcfa2('0x1')]},'app':{'type':Sequelize[_0xcfa2('0x1')]},'appdata':{'type':Sequelize[_0xcfa2('0x1')]},'projectId':{'type':Sequelize[_0xcfa2('0x3')]}}; \ No newline at end of file +var _0x352e=['BOOLEAN','TEXT','SENDING','FAILED','exports','STRING','INTEGER','DATE'];(function(_0x326e1d,_0x360232){var _0x1ad676=function(_0x1bb4d3){while(--_0x1bb4d3){_0x326e1d['push'](_0x326e1d['shift']());}};_0x1ad676(++_0x360232);}(_0x352e,0x1b4));var _0xe352=function(_0xe4af88,_0x22d66f){_0xe4af88=_0xe4af88-0x0;var _0x237fee=_0x352e[_0xe4af88];return _0x237fee;};'use strict';var Sequelize=require('sequelize');module[_0xe352('0x0')]={'integration':{'type':Sequelize[_0xe352('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xe352('0x1')]},'ticketId':{'type':Sequelize[_0xe352('0x1')]},'integrationId':{'type':Sequelize[_0xe352('0x2')]},'contacts':{'type':Sequelize[_0xe352('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe352('0x1')]},'calleridname':{'type':Sequelize[_0xe352('0x1')]},'queue':{'type':Sequelize[_0xe352('0x1')]},'interface':{'type':Sequelize[_0xe352('0x1')]},'membername':{'type':Sequelize[_0xe352('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe352('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe352('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe352('0x3')]},'talktime':{'type':Sequelize[_0xe352('0x2')]},'agentacw':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe352('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe352('0x3')]},'agentdump':{'type':Sequelize[_0xe352('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe352('0x3')]},'lastevent':{'type':Sequelize[_0xe352('0x1')]},'channel':{'type':Sequelize[_0xe352('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe352('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe352('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe352('0x1')]},'context':{'type':Sequelize[_0xe352('0x1')]},'exten':{'type':Sequelize[_0xe352('0x1')]},'priority':{'type':Sequelize[_0xe352('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe352('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe352('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe352('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe352('0x1')]},'destlanguage':{'type':Sequelize[_0xe352('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe352('0x1')]},'destexten':{'type':Sequelize[_0xe352('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xe352('0x1')]},'inReplyTo':{'type':Sequelize[_0xe352('0x1')]},'subject':{'type':Sequelize[_0xe352('0x1')]},'from':{'type':Sequelize[_0xe352('0x1')]},'to':{'type':Sequelize[_0xe352('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xe352('0x5')]},'html':{'type':Sequelize[_0xe352('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT',_0xe352('0x6'),'RECEIVED',_0xe352('0x7'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xe352('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 2388e40..5499e20 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 _0x545b=['params','IntegrationReport','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','error','name','index','map','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x545b,0x1f1));var _0xb545=function(_0x2d08b9,_0x2fee02){_0x2d08b9=_0x2d08b9-0x0;var _0x34c713=_0x545b[_0x2d08b9];return _0x34c713;};'use strict';var emlformat=require(_0xb545('0x0'));var rimraf=require(_0xb545('0x1'));var zipdir=require(_0xb545('0x2'));var jsonpatch=require(_0xb545('0x3'));var rp=require(_0xb545('0x4'));var moment=require('moment');var BPromise=require(_0xb545('0x5'));var Mustache=require(_0xb545('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb545('0x7'));var csv=require(_0xb545('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb545('0x9'));var squel=require(_0xb545('0xa'));var crypto=require('crypto');var jsforce=require(_0xb545('0xb'));var deskjs=require(_0xb545('0xc'));var toCsv=require(_0xb545('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb545('0xd'));var authService=require(_0xb545('0xe'));var qs=require(_0xb545('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb545('0x10'))(_0xb545('0x11'));var utils=require(_0xb545('0x12'));var config=require(_0xb545('0x13'));var licenseUtil=require(_0xb545('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c3a97,_0xb5ee85){_0xb5ee85=_0xb5ee85||0xcc;return function(_0x46b66d){if(_0x46b66d){return _0x3c3a97[_0xb545('0x15')](_0xb5ee85);}return _0x3c3a97[_0xb545('0x16')](_0xb5ee85)[_0xb545('0x17')]();};}function respondWithResult(_0x3f74e6,_0xe92403){_0xe92403=_0xe92403||0xc8;return function(_0x54b628){if(_0x54b628){return _0x3f74e6['status'](_0xe92403)[_0xb545('0x18')](_0x54b628);}};}function respondWithFilteredResult(_0x22ec91,_0x587634){return function(_0x21de11){if(_0x21de11){var _0xac71ef=typeof _0x587634[_0xb545('0x19')]==='undefined'&&typeof _0x587634[_0xb545('0x1a')]===_0xb545('0x1b');var _0x3ea67d=_0x21de11[_0xb545('0x1c')];var _0x3211ca=_0xac71ef?0x0:_0x587634['offset'];var _0x150b2e=_0xac71ef?_0x21de11[_0xb545('0x1c')]:_0x587634[_0xb545('0x19')]+_0x587634[_0xb545('0x1a')];var _0x3dbd84;if(_0x150b2e>=_0x3ea67d){_0x150b2e=_0x3ea67d;_0x3dbd84=0xc8;}else{_0x3dbd84=0xce;}_0x22ec91[_0xb545('0x16')](_0x3dbd84);return _0x22ec91[_0xb545('0x1d')]('Content-Range',_0x3211ca+'-'+_0x150b2e+'/'+_0x3ea67d)[_0xb545('0x18')](_0x21de11);}return null;};}function patchUpdates(_0x52b18d){return function(_0x33d09c){try{jsonpatch['apply'](_0x33d09c,_0x52b18d,!![]);}catch(_0x165aa6){return BPromise[_0xb545('0x1e')](_0x165aa6);}return _0x33d09c[_0xb545('0x1f')]();};}function saveUpdates(_0x5752f6,_0x2ea6a4){return function(_0x22536c){if(_0x22536c){return _0x22536c['update'](_0x5752f6)[_0xb545('0x20')](function(_0x102e91){return _0x102e91;});}return null;};}function removeEntity(_0x3e175f,_0x246c59){return function(_0x4bbb91){if(_0x4bbb91){return _0x4bbb91[_0xb545('0x21')]()['then'](function(){_0x3e175f[_0xb545('0x16')](0xcc)[_0xb545('0x17')]();});}};}function handleEntityNotFound(_0x1d17b5,_0x31a6a8){return function(_0x42db9c){if(!_0x42db9c){_0x1d17b5[_0xb545('0x15')](0x194);}return _0x42db9c;};}function handleError(_0x2cc8c6,_0x13eb19){_0x13eb19=_0x13eb19||0x1f4;return function(_0x490186){logger[_0xb545('0x22')](_0x490186['stack']);if(_0x490186[_0xb545('0x23')]){delete _0x490186[_0xb545('0x23')];}_0x2cc8c6[_0xb545('0x16')](_0x13eb19)['send'](_0x490186);};}exports[_0xb545('0x24')]=function(_0x1d00ec,_0x35e16a){var _0x1fa351={},_0x1761c1={},_0xf3e6b3={'count':0x0,'rows':[]};var _0x519dae=_[_0xb545('0x25')](db['IntegrationReport'][_0xb545('0x26')],function(_0x2dc574){return{'name':_0x2dc574['fieldName'],'type':_0x2dc574[_0xb545('0x27')]['key']};});_0x1761c1['model']=_[_0xb545('0x25')](_0x519dae,_0xb545('0x23'));_0x1761c1[_0xb545('0x28')]=_[_0xb545('0x29')](_0x1d00ec[_0xb545('0x28')]);_0x1761c1['filters']=_[_0xb545('0x2a')](_0x1761c1['model'],_0x1761c1[_0xb545('0x28')]);_0x1fa351[_0xb545('0x2b')]=_[_0xb545('0x2a')](_0x1761c1[_0xb545('0x2c')],qs[_0xb545('0x2d')](_0x1d00ec['query'][_0xb545('0x2d')]));_0x1fa351[_0xb545('0x2b')]=_0x1fa351[_0xb545('0x2b')][_0xb545('0x2e')]?_0x1fa351[_0xb545('0x2b')]:_0x1761c1[_0xb545('0x2c')];if(!_0x1d00ec[_0xb545('0x28')][_0xb545('0x2f')](_0xb545('0x30'))){_0x1fa351[_0xb545('0x1a')]=qs['limit'](_0x1d00ec[_0xb545('0x28')][_0xb545('0x1a')]);_0x1fa351[_0xb545('0x19')]=qs[_0xb545('0x19')](_0x1d00ec[_0xb545('0x28')][_0xb545('0x19')]);}_0x1fa351[_0xb545('0x31')]=qs['sort'](_0x1d00ec[_0xb545('0x28')][_0xb545('0x32')]);_0x1fa351[_0xb545('0x33')]=qs[_0xb545('0x34')](_[_0xb545('0x35')](_0x1d00ec['query'],_0x1761c1[_0xb545('0x34')]),_0x519dae);if(_0x1d00ec['query']['filter']){_0x1fa351[_0xb545('0x33')]=_[_0xb545('0x36')](_0x1fa351[_0xb545('0x33')],{'$or':_[_0xb545('0x25')](_0x519dae,function(_0x3c3d01){if(_0x3c3d01[_0xb545('0x27')]!==_0xb545('0x37')){var _0x344b0a={};_0x344b0a[_0x3c3d01[_0xb545('0x23')]]={'$like':'%'+_0x1d00ec[_0xb545('0x28')][_0xb545('0x38')]+'%'};return _0x344b0a;}})});}_0x1fa351=_[_0xb545('0x36')]({},_0x1fa351,_0x1d00ec[_0xb545('0x39')]);var _0x317cc3={'where':_0x1fa351[_0xb545('0x33')]};return db['IntegrationReport'][_0xb545('0x1c')](_0x317cc3)[_0xb545('0x20')](function(_0x87b4c){_0xf3e6b3[_0xb545('0x1c')]=_0x87b4c;if(_0x1d00ec[_0xb545('0x28')][_0xb545('0x3a')]){_0x1fa351[_0xb545('0x3b')]=[{'all':!![]}];}return db['IntegrationReport'][_0xb545('0x3c')](_0x1fa351);})[_0xb545('0x20')](function(_0xb25a4){_0xf3e6b3['rows']=_0xb25a4;return _0xf3e6b3;})[_0xb545('0x20')](respondWithFilteredResult(_0x35e16a,_0x1fa351))[_0xb545('0x3d')](handleError(_0x35e16a,null));};exports[_0xb545('0x3e')]=function(_0x166e91,_0x3f94cf){var _0x5d0748={'raw':![],'where':{'id':_0x166e91[_0xb545('0x3f')]['id']}},_0x3dbfce={};_0x3dbfce[_0xb545('0x2c')]=_['keys'](db['IntegrationReport'][_0xb545('0x26')]);_0x3dbfce[_0xb545('0x28')]=_[_0xb545('0x29')](_0x166e91[_0xb545('0x28')]);_0x3dbfce[_0xb545('0x34')]=_[_0xb545('0x2a')](_0x3dbfce['model'],_0x3dbfce[_0xb545('0x28')]);_0x5d0748[_0xb545('0x2b')]=_[_0xb545('0x2a')](_0x3dbfce[_0xb545('0x2c')],qs[_0xb545('0x2d')](_0x166e91[_0xb545('0x28')]['fields']));_0x5d0748[_0xb545('0x2b')]=_0x5d0748[_0xb545('0x2b')]['length']?_0x5d0748[_0xb545('0x2b')]:_0x3dbfce[_0xb545('0x2c')];if(_0x166e91[_0xb545('0x28')][_0xb545('0x3a')]){_0x5d0748['include']=[{'all':!![]}];}_0x5d0748=_[_0xb545('0x36')]({},_0x5d0748,_0x166e91[_0xb545('0x39')]);return db[_0xb545('0x40')][_0xb545('0x41')](_0x5d0748)[_0xb545('0x20')](handleEntityNotFound(_0x3f94cf,null))[_0xb545('0x20')](respondWithResult(_0x3f94cf,null))[_0xb545('0x3d')](handleError(_0x3f94cf,null));};exports[_0xb545('0x42')]=function(_0x54e7d8,_0x354b42){return db[_0xb545('0x40')][_0xb545('0x42')](_0x54e7d8[_0xb545('0x43')],{})[_0xb545('0x20')](respondWithResult(_0x354b42,0xc9))[_0xb545('0x3d')](handleError(_0x354b42,null));};exports[_0xb545('0x44')]=function(_0x27fdcf,_0x1b5e07){if(_0x27fdcf['body']['id']){delete _0x27fdcf[_0xb545('0x43')]['id'];}return db['IntegrationReport'][_0xb545('0x41')]({'where':{'id':_0x27fdcf['params']['id']}})[_0xb545('0x20')](handleEntityNotFound(_0x1b5e07,null))[_0xb545('0x20')](saveUpdates(_0x27fdcf['body'],null))['then'](respondWithResult(_0x1b5e07,null))[_0xb545('0x3d')](handleError(_0x1b5e07,null));};exports['destroy']=function(_0x468f05,_0x44fa18){return db[_0xb545('0x40')][_0xb545('0x41')]({'where':{'id':_0x468f05[_0xb545('0x3f')]['id']}})[_0xb545('0x20')](handleEntityNotFound(_0x44fa18,null))[_0xb545('0x20')](removeEntity(_0x44fa18,null))[_0xb545('0x3d')](handleError(_0x44fa18,null));};exports[_0xb545('0x45')]=function(_0xc04fc,_0x527d60){return db['IntegrationReport']['describe']()[_0xb545('0x20')](respondWithResult(_0x527d60,null))['catch'](handleError(_0x527d60,null));}; \ No newline at end of file +var _0x7be6=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x229728,_0x4fd19f){var _0x384549=function(_0x175f2a){while(--_0x175f2a){_0x229728['push'](_0x229728['shift']());}};_0x384549(++_0x4fd19f);}(_0x7be6,0x171));var _0x67be=function(_0x4d2976,_0x26bd1d){_0x4d2976=_0x4d2976-0x0;var _0x35ef5e=_0x7be6[_0x4d2976];return _0x35ef5e;};'use strict';var emlformat=require(_0x67be('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x67be('0x1'));var rp=require(_0x67be('0x2'));var moment=require(_0x67be('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x67be('0x4'));var util=require(_0x67be('0x5'));var path=require(_0x67be('0x6'));var sox=require(_0x67be('0x7'));var csv=require(_0x67be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67be('0x9'));var _=require(_0x67be('0xa'));var squel=require(_0x67be('0xb'));var crypto=require(_0x67be('0xc'));var jsforce=require(_0x67be('0xd'));var deskjs=require(_0x67be('0xe'));var toCsv=require('to-csv');var querystring=require(_0x67be('0xf'));var Papa=require(_0x67be('0x10'));var Redis=require(_0x67be('0x11'));var authService=require(_0x67be('0x12'));var qs=require(_0x67be('0x13'));var as=require(_0x67be('0x14'));var hardwareService=require(_0x67be('0x15'));var logger=require(_0x67be('0x16'))(_0x67be('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67be('0x18'));var db=require(_0x67be('0x19'))['db'];function respondWithStatusCode(_0x43af6d,_0x40f32d){_0x40f32d=_0x40f32d||0xcc;return function(_0x4c9fae){if(_0x4c9fae){return _0x43af6d[_0x67be('0x1a')](_0x40f32d);}return _0x43af6d[_0x67be('0x1b')](_0x40f32d)[_0x67be('0x1c')]();};}function respondWithResult(_0x5bd014,_0x2f656a){_0x2f656a=_0x2f656a||0xc8;return function(_0x31549b){if(_0x31549b){return _0x5bd014[_0x67be('0x1b')](_0x2f656a)[_0x67be('0x1d')](_0x31549b);}};}function respondWithFilteredResult(_0x4c31cb,_0x142eb9){return function(_0x5db127){if(_0x5db127){var _0x468458=typeof _0x142eb9[_0x67be('0x1e')]===_0x67be('0x1f')&&typeof _0x142eb9[_0x67be('0x20')]==='undefined';var _0x60775c=_0x5db127[_0x67be('0x21')];var _0x46efd2=_0x468458?0x0:_0x142eb9['offset'];var _0xa2fe82=_0x468458?_0x5db127[_0x67be('0x21')]:_0x142eb9[_0x67be('0x1e')]+_0x142eb9['limit'];var _0x16a231;if(_0xa2fe82>=_0x60775c){_0xa2fe82=_0x60775c;_0x16a231=0xc8;}else{_0x16a231=0xce;}_0x4c31cb['status'](_0x16a231);return _0x4c31cb[_0x67be('0x22')](_0x67be('0x23'),_0x46efd2+'-'+_0xa2fe82+'/'+_0x60775c)['json'](_0x5db127);}return null;};}function patchUpdates(_0x282425){return function(_0x214fb0){try{jsonpatch[_0x67be('0x24')](_0x214fb0,_0x282425,!![]);}catch(_0x24ad38){return BPromise['reject'](_0x24ad38);}return _0x214fb0[_0x67be('0x25')]();};}function saveUpdates(_0x218abd,_0x51a72f){return function(_0x158468){if(_0x158468){return _0x158468[_0x67be('0x26')](_0x218abd)[_0x67be('0x27')](function(_0x5d5c58){return _0x5d5c58;});}return null;};}function removeEntity(_0x1f3ef3,_0x36513a){return function(_0x6f4da7){if(_0x6f4da7){return _0x6f4da7[_0x67be('0x28')]()[_0x67be('0x27')](function(){_0x1f3ef3[_0x67be('0x1b')](0xcc)[_0x67be('0x1c')]();});}};}function handleEntityNotFound(_0x48ad5a,_0x4259b1){return function(_0xbc24a2){if(!_0xbc24a2){_0x48ad5a[_0x67be('0x1a')](0x194);}return _0xbc24a2;};}function handleError(_0x582a41,_0x107557){_0x107557=_0x107557||0x1f4;return function(_0x3acbfa){logger[_0x67be('0x29')](_0x3acbfa[_0x67be('0x2a')]);if(_0x3acbfa[_0x67be('0x2b')]){delete _0x3acbfa[_0x67be('0x2b')];}_0x582a41[_0x67be('0x1b')](_0x107557)[_0x67be('0x2c')](_0x3acbfa);};}exports[_0x67be('0x2d')]=function(_0x148a13,_0xa32b13){var _0x582eda={},_0xecfd66={},_0x27adc6={'count':0x0,'rows':[]};var _0x6fff6e=_[_0x67be('0x2e')](db[_0x67be('0x2f')][_0x67be('0x30')],function(_0x55fc38){return{'name':_0x55fc38[_0x67be('0x31')],'type':_0x55fc38[_0x67be('0x32')][_0x67be('0x33')]};});_0xecfd66[_0x67be('0x34')]=_[_0x67be('0x2e')](_0x6fff6e,_0x67be('0x2b'));_0xecfd66[_0x67be('0x35')]=_[_0x67be('0x36')](_0x148a13[_0x67be('0x35')]);_0xecfd66['filters']=_[_0x67be('0x37')](_0xecfd66[_0x67be('0x34')],_0xecfd66['query']);_0x582eda[_0x67be('0x38')]=_[_0x67be('0x37')](_0xecfd66[_0x67be('0x34')],qs[_0x67be('0x39')](_0x148a13[_0x67be('0x35')][_0x67be('0x39')]));_0x582eda['attributes']=_0x582eda[_0x67be('0x38')]['length']?_0x582eda[_0x67be('0x38')]:_0xecfd66['model'];if(!_0x148a13[_0x67be('0x35')][_0x67be('0x3a')](_0x67be('0x3b'))){_0x582eda['limit']=qs['limit'](_0x148a13[_0x67be('0x35')][_0x67be('0x20')]);_0x582eda[_0x67be('0x1e')]=qs[_0x67be('0x1e')](_0x148a13[_0x67be('0x35')][_0x67be('0x1e')]);}_0x582eda[_0x67be('0x3c')]=qs[_0x67be('0x3d')](_0x148a13[_0x67be('0x35')]['sort']);_0x582eda[_0x67be('0x3e')]=qs['filters'](_[_0x67be('0x3f')](_0x148a13[_0x67be('0x35')],_0xecfd66[_0x67be('0x40')]),_0x6fff6e);if(_0x148a13['query'][_0x67be('0x41')]){_0x582eda[_0x67be('0x3e')]=_[_0x67be('0x42')](_0x582eda[_0x67be('0x3e')],{'$or':_['map'](_0x6fff6e,function(_0xfd00b9){if(_0xfd00b9[_0x67be('0x32')]!==_0x67be('0x43')){var _0x3b98f8={};_0x3b98f8[_0xfd00b9['name']]={'$like':'%'+_0x148a13[_0x67be('0x35')][_0x67be('0x41')]+'%'};return _0x3b98f8;}})});}_0x582eda=_[_0x67be('0x42')]({},_0x582eda,_0x148a13[_0x67be('0x44')]);var _0x180794={'where':_0x582eda[_0x67be('0x3e')]};return db['IntegrationReport'][_0x67be('0x21')](_0x180794)[_0x67be('0x27')](function(_0x1bbac0){_0x27adc6[_0x67be('0x21')]=_0x1bbac0;if(_0x148a13[_0x67be('0x35')][_0x67be('0x45')]){_0x582eda[_0x67be('0x46')]=[{'all':!![]}];}return db[_0x67be('0x2f')]['findAll'](_0x582eda);})[_0x67be('0x27')](function(_0x485033){_0x27adc6[_0x67be('0x47')]=_0x485033;return _0x27adc6;})['then'](respondWithFilteredResult(_0xa32b13,_0x582eda))[_0x67be('0x48')](handleError(_0xa32b13,null));};exports[_0x67be('0x49')]=function(_0x482578,_0x14c245){var _0x427a00={'raw':![],'where':{'id':_0x482578['params']['id']}},_0x17cc83={};_0x17cc83[_0x67be('0x34')]=_[_0x67be('0x36')](db[_0x67be('0x2f')]['rawAttributes']);_0x17cc83[_0x67be('0x35')]=_[_0x67be('0x36')](_0x482578[_0x67be('0x35')]);_0x17cc83[_0x67be('0x40')]=_[_0x67be('0x37')](_0x17cc83['model'],_0x17cc83[_0x67be('0x35')]);_0x427a00[_0x67be('0x38')]=_[_0x67be('0x37')](_0x17cc83[_0x67be('0x34')],qs[_0x67be('0x39')](_0x482578['query'][_0x67be('0x39')]));_0x427a00[_0x67be('0x38')]=_0x427a00[_0x67be('0x38')][_0x67be('0x4a')]?_0x427a00[_0x67be('0x38')]:_0x17cc83[_0x67be('0x34')];if(_0x482578[_0x67be('0x35')]['includeAll']){_0x427a00[_0x67be('0x46')]=[{'all':!![]}];}_0x427a00=_[_0x67be('0x42')]({},_0x427a00,_0x482578['options']);return db[_0x67be('0x2f')]['find'](_0x427a00)[_0x67be('0x27')](handleEntityNotFound(_0x14c245,null))[_0x67be('0x27')](respondWithResult(_0x14c245,null))[_0x67be('0x48')](handleError(_0x14c245,null));};exports['create']=function(_0x87abf7,_0x2bce54){return db[_0x67be('0x2f')][_0x67be('0x4b')](_0x87abf7[_0x67be('0x4c')],{})['then'](respondWithResult(_0x2bce54,0xc9))[_0x67be('0x48')](handleError(_0x2bce54,null));};exports[_0x67be('0x26')]=function(_0x174fa1,_0x2bb047){if(_0x174fa1['body']['id']){delete _0x174fa1[_0x67be('0x4c')]['id'];}return db[_0x67be('0x2f')]['find']({'where':{'id':_0x174fa1['params']['id']}})[_0x67be('0x27')](handleEntityNotFound(_0x2bb047,null))[_0x67be('0x27')](saveUpdates(_0x174fa1[_0x67be('0x4c')],null))[_0x67be('0x27')](respondWithResult(_0x2bb047,null))[_0x67be('0x48')](handleError(_0x2bb047,null));};exports[_0x67be('0x28')]=function(_0x1e3f43,_0x419cd8){return db[_0x67be('0x2f')][_0x67be('0x4d')]({'where':{'id':_0x1e3f43[_0x67be('0x4e')]['id']}})[_0x67be('0x27')](handleEntityNotFound(_0x419cd8,null))['then'](removeEntity(_0x419cd8,null))[_0x67be('0x48')](handleError(_0x419cd8,null));};exports[_0x67be('0x4f')]=function(_0x4834d8,_0x1dc113){return db[_0x67be('0x2f')]['describe']()[_0x67be('0x27')](respondWithResult(_0x1dc113,null))[_0x67be('0x48')](handleError(_0x1dc113,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9d533bf..3e4ad65 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 _0xc938=['request-promise','path','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1863e2,_0x27fd57){var _0x56288c=function(_0x636950){while(--_0x636950){_0x1863e2['push'](_0x1863e2['shift']());}};_0x56288c(++_0x27fd57);}(_0xc938,0x14c));var _0x8c93=function(_0x771b25,_0x286c5f){_0x771b25=_0x771b25-0x0;var _0x42522f=_0xc938[_0x771b25];return _0x42522f;};'use strict';var _=require(_0x8c93('0x0'));var util=require(_0x8c93('0x1'));var logger=require(_0x8c93('0x2'))(_0x8c93('0x3'));var moment=require(_0x8c93('0x4'));var BPromise=require(_0x8c93('0x5'));var rp=require(_0x8c93('0x6'));var fs=require('fs');var path=require(_0x8c93('0x7'));var rimraf=require('rimraf');var config=require(_0x8c93('0x8'));var attributes=require(_0x8c93('0x9'));module[_0x8c93('0xa')]=function(_0x58d58d,_0x352cca){return _0x58d58d['define'](_0x8c93('0xb'),attributes,{'tableName':_0x8c93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1337=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x492cd9,_0x411d1c){var _0xfe102f=function(_0x2da0b9){while(--_0x2da0b9){_0x492cd9['push'](_0x492cd9['shift']());}};_0xfe102f(++_0x411d1c);}(_0x1337,0x1c0));var _0x7133=function(_0xd13d87,_0x3ca500){_0xd13d87=_0xd13d87-0x0;var _0x3a2004=_0x1337[_0xd13d87];return _0x3a2004;};'use strict';var _=require(_0x7133('0x0'));var util=require(_0x7133('0x1'));var logger=require(_0x7133('0x2'))(_0x7133('0x3'));var moment=require(_0x7133('0x4'));var BPromise=require(_0x7133('0x5'));var rp=require(_0x7133('0x6'));var fs=require('fs');var path=require(_0x7133('0x7'));var rimraf=require(_0x7133('0x8'));var config=require(_0x7133('0x9'));var attributes=require(_0x7133('0xa'));module[_0x7133('0xb')]=function(_0x285ac2,_0x1f14bd){return _0x285ac2[_0x7133('0xc')](_0x7133('0xd'),attributes,{'tableName':_0x7133('0xe'),'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 7311168..35ec98d 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x4975,0x86));var _0x5497=function(_0x1aef70,_0x3a67ed){_0x1aef70=_0x1aef70-0x0;var _0x22c255=_0x4975[_0x1aef70];return _0x22c255;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x48064e,_0x151c47){var _0x549156=function(_0xd4d61c){while(--_0xd4d61c){_0x48064e['push'](_0x48064e['shift']());}};_0x549156(++_0x151c47);}(_0x187d,0x93));var _0xd187=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x187d[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d533c98..9ace23e 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 _0x67e8=['/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','update','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x67e8,0x86));var _0x867e=function(_0x46859a,_0x18e521){_0x46859a=_0x46859a-0x0;var _0x390b9c=_0x67e8[_0x46859a];return _0x390b9c;};'use strict';var multer=require(_0x867e('0x0'));var util=require(_0x867e('0x1'));var path=require(_0x867e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x867e('0x3')]();var fs_extra=require(_0x867e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x867e('0x5'));var controller=require('./interval.controller');router[_0x867e('0x6')]('/',auth[_0x867e('0x7')](),controller['index']);router[_0x867e('0x6')](_0x867e('0x8'),auth[_0x867e('0x7')](),controller[_0x867e('0x9')]);router['get'](_0x867e('0xa'),auth[_0x867e('0x7')](),controller['getIntervals']);router[_0x867e('0xb')]('/',auth['isAuthenticated'](),controller[_0x867e('0xc')]);router[_0x867e('0xb')](_0x867e('0xa'),auth[_0x867e('0x7')](),controller[_0x867e('0xd')]);router[_0x867e('0xb')](_0x867e('0xe'),auth['isAuthenticated'](),controller['addIntervals']);router['put'](_0x867e('0x8'),auth[_0x867e('0x7')](),controller[_0x867e('0xf')]);router[_0x867e('0x10')]('/:id',auth[_0x867e('0x7')](),controller[_0x867e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0d4d=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index','get','getIntervals','post','create','/:id/sub_intervals','addInterval','addIntervals','put','/:id','update','destroy','multer','util'];(function(_0x2820c4,_0x31a325){var _0x5459cd=function(_0x577c3e){while(--_0x577c3e){_0x2820c4['push'](_0x2820c4['shift']());}};_0x5459cd(++_0x31a325);}(_0x0d4d,0x132));var _0xd0d4=function(_0x32587b,_0xf0c910){_0x32587b=_0x32587b-0x0;var _0x4315c7=_0x0d4d[_0x32587b];return _0x4315c7;};'use strict';var multer=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var path=require(_0xd0d4('0x2'));var timeout=require(_0xd0d4('0x3'));var express=require(_0xd0d4('0x4'));var router=express[_0xd0d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd0d4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0d4('0x7'));var controller=require(_0xd0d4('0x8'));router['get']('/',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xa')]);router[_0xd0d4('0xb')]('/:id',auth[_0xd0d4('0x9')](),controller['show']);router[_0xd0d4('0xb')]('/:id/sub_intervals',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xc')]);router[_0xd0d4('0xd')]('/',auth['isAuthenticated'](),controller[_0xd0d4('0xe')]);router[_0xd0d4('0xd')](_0xd0d4('0xf'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x10')]);router[_0xd0d4('0xd')]('/:id/sub_intervals/create_many',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x11')]);router[_0xd0d4('0x12')](_0xd0d4('0x13'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x14')]);router['delete'](_0xd0d4('0x13'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cbe310b..f3fe9a4 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 _0xb58f=['exports','STRING','sequelize'];(function(_0x5242f7,_0x4c57b1){var _0x3717b6=function(_0x58dcf9){while(--_0x58dcf9){_0x5242f7['push'](_0x5242f7['shift']());}};_0x3717b6(++_0x4c57b1);}(_0xb58f,0x65));var _0xfb58=function(_0x1586f7,_0x28f0b5){_0x1586f7=_0x1586f7-0x0;var _0x10937b=_0xb58f[_0x1586f7];return _0x10937b;};'use strict';var Sequelize=require(_0xfb58('0x0'));module[_0xfb58('0x1')]={'name':{'type':Sequelize[_0xfb58('0x2')]},'description':{'type':Sequelize[_0xfb58('0x2')]},'interval':{'type':Sequelize[_0xfb58('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd30a=['sequelize','STRING'];(function(_0x4771f7,_0x3cce17){var _0x386d6a=function(_0x2887ea){while(--_0x2887ea){_0x4771f7['push'](_0x4771f7['shift']());}};_0x386d6a(++_0x3cce17);}(_0xd30a,0x150));var _0xad30=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xd30a[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0xad30('0x0'));module['exports']={'name':{'type':Sequelize[_0xad30('0x1')]},'description':{'type':Sequelize[_0xad30('0x1')]},'interval':{'type':Sequelize[_0xad30('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index d9b47e7..677acde 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 _0x0ea6=['rawAttributes','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','Interval','includeAll','include','findAll','rows','catch','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','IntervalId','getIntervals','findOne','length','addIntervals','sequelize','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','offset','undefined','count','set','json','reject','save','then','destroy','get','Intervals','UserProfileResource','end','error','name','index','map'];(function(_0x5de8b8,_0x1f6dbd){var _0x5ec7cd=function(_0x53361b){while(--_0x53361b){_0x5de8b8['push'](_0x5de8b8['shift']());}};_0x5ec7cd(++_0x1f6dbd);}(_0x0ea6,0x17a));var _0x60ea=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x0ea6[_0x602ca8];return _0x26e8ab;};'use strict';var emlformat=require(_0x60ea('0x0'));var rimraf=require(_0x60ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60ea('0x2'));var rp=require(_0x60ea('0x3'));var moment=require('moment');var BPromise=require(_0x60ea('0x4'));var Mustache=require(_0x60ea('0x5'));var util=require(_0x60ea('0x6'));var path=require('path');var sox=require(_0x60ea('0x7'));var csv=require(_0x60ea('0x8'));var ejs=require(_0x60ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x60ea('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x60ea('0x8'));var querystring=require(_0x60ea('0xb'));var Papa=require(_0x60ea('0xc'));var Redis=require(_0x60ea('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x60ea('0xe'));var as=require(_0x60ea('0xf'));var hardwareService=require(_0x60ea('0x10'));var logger=require(_0x60ea('0x11'))(_0x60ea('0x12'));var utils=require(_0x60ea('0x13'));var config=require(_0x60ea('0x14'));var licenseUtil=require(_0x60ea('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0x60ea('0x16'));function respondWithStatusCode(_0x38ac1b,_0x34f98b){_0x34f98b=_0x34f98b||0xcc;return function(_0x19c406){if(_0x19c406){return _0x38ac1b[_0x60ea('0x17')](_0x34f98b);}return _0x38ac1b[_0x60ea('0x18')](_0x34f98b)['end']();};}function respondWithResult(_0x4984f6,_0x51849f){_0x51849f=_0x51849f||0xc8;return function(_0x2c3020){if(_0x2c3020){return _0x4984f6[_0x60ea('0x18')](_0x51849f)['json'](_0x2c3020);}};}function respondWithFilteredResult(_0x5c887a,_0x35992f){return function(_0x22780d){if(_0x22780d){var _0x3463e6=typeof _0x35992f[_0x60ea('0x19')]===_0x60ea('0x1a')&&typeof _0x35992f['limit']===_0x60ea('0x1a');var _0x46f7e3=_0x22780d[_0x60ea('0x1b')];var _0x4c7130=_0x3463e6?0x0:_0x35992f[_0x60ea('0x19')];var _0xbd3cab=_0x3463e6?_0x22780d[_0x60ea('0x1b')]:_0x35992f[_0x60ea('0x19')]+_0x35992f['limit'];var _0x2c45d9;if(_0xbd3cab>=_0x46f7e3){_0xbd3cab=_0x46f7e3;_0x2c45d9=0xc8;}else{_0x2c45d9=0xce;}_0x5c887a[_0x60ea('0x18')](_0x2c45d9);return _0x5c887a[_0x60ea('0x1c')]('Content-Range',_0x4c7130+'-'+_0xbd3cab+'/'+_0x46f7e3)[_0x60ea('0x1d')](_0x22780d);}return null;};}function patchUpdates(_0x4e207d){return function(_0x2f53b5){try{jsonpatch['apply'](_0x2f53b5,_0x4e207d,!![]);}catch(_0x2bd9ae){return BPromise[_0x60ea('0x1e')](_0x2bd9ae);}return _0x2f53b5[_0x60ea('0x1f')]();};}function saveUpdates(_0x2f7ca7,_0x3a9a0e){return function(_0x1b6a4b){if(_0x1b6a4b){return _0x1b6a4b['update'](_0x2f7ca7)[_0x60ea('0x20')](function(_0x298c51){return _0x298c51;});}return null;};}function removeEntity(_0x10ca27,_0x17f389){return function(_0x273ca1){if(_0x273ca1){return _0x273ca1[_0x60ea('0x21')]()[_0x60ea('0x20')](function(){var _0x526f1d=_0x273ca1[_0x60ea('0x22')]({'plain':!![]});var _0xa114a0=_0x60ea('0x23');return db[_0x60ea('0x24')]['destroy']({'where':{'type':_0xa114a0,'resourceId':_0x526f1d['id']}})['then'](function(){return _0x273ca1;});})['then'](function(){_0x10ca27['status'](0xcc)[_0x60ea('0x25')]();});}};}function handleEntityNotFound(_0xa56f2b,_0x26e478){return function(_0x2bc00d){if(!_0x2bc00d){_0xa56f2b[_0x60ea('0x17')](0x194);}return _0x2bc00d;};}function handleError(_0x5ab13c,_0x33a18f){_0x33a18f=_0x33a18f||0x1f4;return function(_0x50ddca){logger[_0x60ea('0x26')](_0x50ddca['stack']);if(_0x50ddca[_0x60ea('0x27')]){delete _0x50ddca[_0x60ea('0x27')];}_0x5ab13c[_0x60ea('0x18')](_0x33a18f)['send'](_0x50ddca);};}exports[_0x60ea('0x28')]=function(_0x28837f,_0x18ad1d){var _0x18751c={},_0x9887be={},_0x3eed5a={'count':0x0,'rows':[]};var _0x3b0bc1=_[_0x60ea('0x29')](db['Interval'][_0x60ea('0x2a')],function(_0x34ca2f){return{'name':_0x34ca2f['fieldName'],'type':_0x34ca2f[_0x60ea('0x2b')]['key']};});_0x9887be[_0x60ea('0x2c')]=_[_0x60ea('0x29')](_0x3b0bc1,'name');_0x9887be['query']=_[_0x60ea('0x2d')](_0x28837f[_0x60ea('0x2e')]);_0x9887be['filters']=_['intersection'](_0x9887be['model'],_0x9887be[_0x60ea('0x2e')]);_0x18751c[_0x60ea('0x2f')]=_[_0x60ea('0x30')](_0x9887be[_0x60ea('0x2c')],qs[_0x60ea('0x31')](_0x28837f[_0x60ea('0x2e')][_0x60ea('0x31')]));_0x18751c[_0x60ea('0x2f')]=_0x18751c[_0x60ea('0x2f')]['length']?_0x18751c[_0x60ea('0x2f')]:_0x9887be[_0x60ea('0x2c')];if(!_0x28837f[_0x60ea('0x2e')][_0x60ea('0x32')](_0x60ea('0x33'))){_0x18751c[_0x60ea('0x34')]=qs['limit'](_0x28837f[_0x60ea('0x2e')][_0x60ea('0x34')]);_0x18751c[_0x60ea('0x19')]=qs[_0x60ea('0x19')](_0x28837f[_0x60ea('0x2e')]['offset']);}_0x18751c[_0x60ea('0x35')]=qs['sort'](_0x28837f[_0x60ea('0x2e')][_0x60ea('0x36')]);_0x18751c[_0x60ea('0x37')]=qs[_0x60ea('0x38')](_[_0x60ea('0x39')](_0x28837f[_0x60ea('0x2e')],_0x9887be['filters']),_0x3b0bc1);if(_0x28837f[_0x60ea('0x2e')][_0x60ea('0x3a')]){_0x18751c[_0x60ea('0x37')]=_[_0x60ea('0x3b')](_0x18751c[_0x60ea('0x37')],{'$or':_[_0x60ea('0x29')](_0x3b0bc1,function(_0x2fe289){if(_0x2fe289['type']!=='VIRTUAL'){var _0x418e74={};_0x418e74[_0x2fe289[_0x60ea('0x27')]]={'$like':'%'+_0x28837f[_0x60ea('0x2e')][_0x60ea('0x3a')]+'%'};return _0x418e74;}})});}_0x18751c=_[_0x60ea('0x3b')]({},_0x18751c,_0x28837f['options']);var _0x205116={'where':_0x18751c['where']};return db[_0x60ea('0x3c')]['count'](_0x205116)[_0x60ea('0x20')](function(_0x487cbc){_0x3eed5a[_0x60ea('0x1b')]=_0x487cbc;if(_0x28837f[_0x60ea('0x2e')][_0x60ea('0x3d')]){_0x18751c[_0x60ea('0x3e')]=[{'all':!![]}];}return db[_0x60ea('0x3c')][_0x60ea('0x3f')](_0x18751c);})[_0x60ea('0x20')](function(_0x51d7f2){_0x3eed5a[_0x60ea('0x40')]=_0x51d7f2;return _0x3eed5a;})[_0x60ea('0x20')](respondWithFilteredResult(_0x18ad1d,_0x18751c))[_0x60ea('0x41')](handleError(_0x18ad1d,null));};exports['show']=function(_0x2bd781,_0xb8a365){var _0xc18ecc={'raw':!![],'where':{'id':_0x2bd781[_0x60ea('0x42')]['id']}},_0x4b5fad={};_0x4b5fad[_0x60ea('0x2c')]=_['keys'](db[_0x60ea('0x3c')]['rawAttributes']);_0x4b5fad[_0x60ea('0x2e')]=_['keys'](_0x2bd781['query']);_0x4b5fad[_0x60ea('0x38')]=_[_0x60ea('0x30')](_0x4b5fad[_0x60ea('0x2c')],_0x4b5fad['query']);_0xc18ecc[_0x60ea('0x2f')]=_[_0x60ea('0x30')](_0x4b5fad[_0x60ea('0x2c')],qs[_0x60ea('0x31')](_0x2bd781[_0x60ea('0x2e')][_0x60ea('0x31')]));_0xc18ecc[_0x60ea('0x2f')]=_0xc18ecc[_0x60ea('0x2f')]['length']?_0xc18ecc[_0x60ea('0x2f')]:_0x4b5fad[_0x60ea('0x2c')];if(_0x2bd781['query'][_0x60ea('0x3d')]){_0xc18ecc[_0x60ea('0x3e')]=[{'all':!![]}];}_0xc18ecc=_['merge']({},_0xc18ecc,_0x2bd781[_0x60ea('0x43')]);return db[_0x60ea('0x3c')]['find'](_0xc18ecc)[_0x60ea('0x20')](handleEntityNotFound(_0xb8a365,null))['then'](respondWithResult(_0xb8a365,null))[_0x60ea('0x41')](handleError(_0xb8a365,null));};exports['create']=function(_0x402ffe,_0x55def2){return db[_0x60ea('0x3c')][_0x60ea('0x44')](_0x402ffe['body'],{})[_0x60ea('0x20')](function(_0x5f524f){var _0x3614e3=_0x402ffe[_0x60ea('0x45')]['get']({'plain':!![]});if(!_0x3614e3)throw new Error(_0x60ea('0x46'));if(_0x3614e3['role']===_0x60ea('0x45')){var _0x4913e7=_0x5f524f[_0x60ea('0x22')]({'plain':!![]});var _0x4e8445=_0x60ea('0x23');return db[_0x60ea('0x47')][_0x60ea('0x48')]({'where':{'name':_0x4e8445,'userProfileId':_0x3614e3[_0x60ea('0x49')]},'raw':!![]})['then'](function(_0x4b2588){if(_0x4b2588&&_0x4b2588['autoAssociation']===0x0){return db[_0x60ea('0x24')][_0x60ea('0x44')]({'name':_0x4913e7[_0x60ea('0x27')],'resourceId':_0x4913e7['id'],'type':_0x4b2588[_0x60ea('0x27')],'sectionId':_0x4b2588['id']},{})['then'](function(){return _0x5f524f;});}else{return _0x5f524f;}})['catch'](function(_0x3aa338){logger[_0x60ea('0x26')](_0x60ea('0x4a'),_0x3aa338);throw _0x3aa338;});}return _0x5f524f;})[_0x60ea('0x20')](respondWithResult(_0x55def2,0xc9))[_0x60ea('0x41')](handleError(_0x55def2,null));};exports[_0x60ea('0x4b')]=function(_0x596ca1,_0x27acec){if(_0x596ca1[_0x60ea('0x4c')]['id']){delete _0x596ca1[_0x60ea('0x4c')]['id'];}return db[_0x60ea('0x3c')]['find']({'where':{'id':_0x596ca1['params']['id']}})['then'](handleEntityNotFound(_0x27acec,null))[_0x60ea('0x20')](saveUpdates(_0x596ca1[_0x60ea('0x4c')],null))[_0x60ea('0x20')](respondWithResult(_0x27acec,null))['catch'](handleError(_0x27acec,null));};exports[_0x60ea('0x21')]=function(_0x1af272,_0x5a5204){return db[_0x60ea('0x3c')][_0x60ea('0x48')]({'where':{'id':_0x1af272['params']['id']}})[_0x60ea('0x20')](handleEntityNotFound(_0x5a5204,null))[_0x60ea('0x20')](removeEntity(_0x5a5204,null))[_0x60ea('0x41')](handleError(_0x5a5204,null));};exports[_0x60ea('0x4d')]=function(_0x3c67cc,_0x123034,_0x153f64){if(_0x3c67cc['body']['id']){delete _0x3c67cc[_0x60ea('0x4c')]['id'];}return db[_0x60ea('0x3c')][_0x60ea('0x48')]({'where':{'id':_0x3c67cc[_0x60ea('0x42')]['id']}})[_0x60ea('0x20')](handleEntityNotFound(_0x123034,null))[_0x60ea('0x20')](function(_0x2affd9){if(_0x2affd9){_0x3c67cc[_0x60ea('0x4c')][_0x60ea('0x4e')]=_0x2affd9['id'];return db['Interval'][_0x60ea('0x44')](_0x3c67cc[_0x60ea('0x4c')]);}})[_0x60ea('0x20')](respondWithResult(_0x123034,null))['catch'](handleError(_0x123034,null));};exports[_0x60ea('0x4f')]=function(_0x5d05e6,_0x350c68,_0x43d1cd){var _0x1e9532={};var _0x2c841d={};var _0x2de87c;var _0x41397a;return db[_0x60ea('0x3c')][_0x60ea('0x50')]({'where':{'id':_0x5d05e6['params']['id']}})['then'](handleEntityNotFound(_0x350c68,null))['then'](function(_0x3a9a91){if(_0x3a9a91){_0x2de87c=_0x3a9a91;_0x2c841d[_0x60ea('0x2c')]=_['keys'](db[_0x60ea('0x3c')][_0x60ea('0x2a')]);_0x2c841d[_0x60ea('0x2e')]=_['keys'](_0x5d05e6[_0x60ea('0x2e')]);_0x2c841d[_0x60ea('0x38')]=_[_0x60ea('0x30')](_0x2c841d[_0x60ea('0x2c')],_0x2c841d[_0x60ea('0x2e')]);_0x1e9532[_0x60ea('0x2f')]=_[_0x60ea('0x30')](_0x2c841d[_0x60ea('0x2c')],qs['fields'](_0x5d05e6['query'][_0x60ea('0x31')]));_0x1e9532['attributes']=_0x1e9532[_0x60ea('0x2f')][_0x60ea('0x51')]?_0x1e9532[_0x60ea('0x2f')]:_0x2c841d[_0x60ea('0x2c')];_0x1e9532['order']=qs[_0x60ea('0x36')](_0x5d05e6[_0x60ea('0x2e')][_0x60ea('0x36')]);_0x1e9532['where']=qs['filters'](_[_0x60ea('0x39')](_0x5d05e6[_0x60ea('0x2e')],_0x2c841d[_0x60ea('0x38')]));if(_0x5d05e6[_0x60ea('0x2e')][_0x60ea('0x3a')]){_0x1e9532[_0x60ea('0x37')]=_['merge'](_0x1e9532[_0x60ea('0x37')],{'$or':_[_0x60ea('0x29')](_0x1e9532[_0x60ea('0x2f')],function(_0x3f5dd2){var _0x37919a={};_0x37919a[_0x3f5dd2]={'$like':'%'+_0x5d05e6['query']['filter']+'%'};return _0x37919a;})});}_0x1e9532=_['merge']({},_0x1e9532,_0x5d05e6[_0x60ea('0x43')]);return _0x2de87c['getIntervals'](_0x1e9532);}})['then'](function(_0x536534){if(_0x536534){_0x41397a=_0x536534[_0x60ea('0x51')];if(!_0x5d05e6[_0x60ea('0x2e')][_0x60ea('0x32')](_0x60ea('0x33'))){_0x1e9532['limit']=qs[_0x60ea('0x34')](_0x5d05e6[_0x60ea('0x2e')][_0x60ea('0x34')]);_0x1e9532[_0x60ea('0x19')]=qs['offset'](_0x5d05e6[_0x60ea('0x2e')][_0x60ea('0x19')]);}return _0x2de87c[_0x60ea('0x4f')](_0x1e9532);}})[_0x60ea('0x20')](function(_0x5d9827){if(_0x5d9827){return _0x5d9827?{'count':_0x41397a,'rows':_0x5d9827}:null;}})[_0x60ea('0x20')](respondWithResult(_0x350c68,null))[_0x60ea('0x41')](handleError(_0x350c68,null));};exports[_0x60ea('0x52')]=function(_0x4e3edc,_0x347a9f,_0x1021fa){return db['Interval']['findOne']({'where':{'id':_0x4e3edc['params']['id']}})[_0x60ea('0x20')](handleEntityNotFound(_0x347a9f,null))[_0x60ea('0x20')](function(_0x4d2913){if(_0x4d2913){return db[_0x60ea('0x53')]['transaction'](function(_0x41a0d1){return db[_0x60ea('0x3c')]['destroy']({'where':{'IntervalId':_0x4e3edc[_0x60ea('0x42')]['id']},'transaction':_0x41a0d1})['then'](function(_0x182443){var _0x4ec0a3=_[_0x60ea('0x29')](_0x4e3edc[_0x60ea('0x4c')],function(_0x57021e){delete _0x57021e['id'];_0x57021e[_0x60ea('0x4e')]=_0x4e3edc['params']['id'];return _0x57021e;});return db[_0x60ea('0x3c')]['bulkCreate'](_0x4ec0a3,{'transaction':_0x41a0d1});});})[_0x60ea('0x20')](function(){return db['Interval'][_0x60ea('0x3f')]({'where':{'IntervalId':_0x4e3edc[_0x60ea('0x42')]['id']}});});}})[_0x60ea('0x20')](respondWithResult(_0x347a9f,null))[_0x60ea('0x41')](handleError(_0x347a9f,null));}; \ No newline at end of file +var _0x6015=['options','include','findAll','rows','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','sort','hasOwnProperty','transaction','IntervalId','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x173e4a,_0x3e9626){var _0x5a834d=function(_0x6f505c){while(--_0x6f505c){_0x173e4a['push'](_0x173e4a['shift']());}};_0x5a834d(++_0x3e9626);}(_0x6015,0x74));var _0x5601=function(_0x51143a,_0x8cdddd){_0x51143a=_0x51143a-0x0;var _0x5a5b7e=_0x6015[_0x51143a];return _0x5a5b7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5601('0x0'));var jsonpatch=require(_0x5601('0x1'));var rp=require(_0x5601('0x2'));var moment=require(_0x5601('0x3'));var BPromise=require(_0x5601('0x4'));var Mustache=require(_0x5601('0x5'));var util=require(_0x5601('0x6'));var path=require(_0x5601('0x7'));var sox=require('sox');var csv=require(_0x5601('0x8'));var ejs=require(_0x5601('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5601('0xa'));var squel=require(_0x5601('0xb'));var crypto=require(_0x5601('0xc'));var jsforce=require(_0x5601('0xd'));var deskjs=require(_0x5601('0xe'));var toCsv=require(_0x5601('0x8'));var querystring=require(_0x5601('0xf'));var Papa=require(_0x5601('0x10'));var Redis=require(_0x5601('0x11'));var authService=require(_0x5601('0x12'));var qs=require(_0x5601('0x13'));var as=require(_0x5601('0x14'));var hardwareService=require(_0x5601('0x15'));var logger=require(_0x5601('0x16'))('api');var utils=require(_0x5601('0x17'));var config=require(_0x5601('0x18'));var licenseUtil=require(_0x5601('0x19'));var db=require(_0x5601('0x1a'))['db'];var extensions=require(_0x5601('0x1b'));function respondWithStatusCode(_0x102858,_0x171b1c){_0x171b1c=_0x171b1c||0xcc;return function(_0x57e20f){if(_0x57e20f){return _0x102858['sendStatus'](_0x171b1c);}return _0x102858[_0x5601('0x1c')](_0x171b1c)['end']();};}function respondWithResult(_0x5751fc,_0x56260e){_0x56260e=_0x56260e||0xc8;return function(_0x1db7d1){if(_0x1db7d1){return _0x5751fc[_0x5601('0x1c')](_0x56260e)[_0x5601('0x1d')](_0x1db7d1);}};}function respondWithFilteredResult(_0x1cf936,_0xb543b7){return function(_0x1dfe0d){if(_0x1dfe0d){var _0x1ae771=typeof _0xb543b7[_0x5601('0x1e')]===_0x5601('0x1f')&&typeof _0xb543b7['limit']==='undefined';var _0x1834a5=_0x1dfe0d[_0x5601('0x20')];var _0x540016=_0x1ae771?0x0:_0xb543b7[_0x5601('0x1e')];var _0x1433a8=_0x1ae771?_0x1dfe0d[_0x5601('0x20')]:_0xb543b7[_0x5601('0x1e')]+_0xb543b7[_0x5601('0x21')];var _0x1e0068;if(_0x1433a8>=_0x1834a5){_0x1433a8=_0x1834a5;_0x1e0068=0xc8;}else{_0x1e0068=0xce;}_0x1cf936['status'](_0x1e0068);return _0x1cf936[_0x5601('0x22')](_0x5601('0x23'),_0x540016+'-'+_0x1433a8+'/'+_0x1834a5)[_0x5601('0x1d')](_0x1dfe0d);}return null;};}function patchUpdates(_0x1b0d78){return function(_0x529c06){try{jsonpatch[_0x5601('0x24')](_0x529c06,_0x1b0d78,!![]);}catch(_0x34613f){return BPromise[_0x5601('0x25')](_0x34613f);}return _0x529c06[_0x5601('0x26')]();};}function saveUpdates(_0x5983ce,_0x4e4636){return function(_0x2aa170){if(_0x2aa170){return _0x2aa170['update'](_0x5983ce)[_0x5601('0x27')](function(_0x3f526e){return _0x3f526e;});}return null;};}function removeEntity(_0x490111,_0x2c2487){return function(_0x3b2fc3){if(_0x3b2fc3){return _0x3b2fc3['destroy']()['then'](function(){var _0x5e47cc=_0x3b2fc3[_0x5601('0x28')]({'plain':!![]});var _0x4a3372=_0x5601('0x29');return db[_0x5601('0x2a')][_0x5601('0x2b')]({'where':{'type':_0x4a3372,'resourceId':_0x5e47cc['id']}})['then'](function(){return _0x3b2fc3;});})['then'](function(){_0x490111[_0x5601('0x1c')](0xcc)[_0x5601('0x2c')]();});}};}function handleEntityNotFound(_0x59f152,_0x209887){return function(_0x36ba76){if(!_0x36ba76){_0x59f152['sendStatus'](0x194);}return _0x36ba76;};}function handleError(_0x430ba8,_0x6a18b2){_0x6a18b2=_0x6a18b2||0x1f4;return function(_0xf4bb65){logger[_0x5601('0x2d')](_0xf4bb65[_0x5601('0x2e')]);if(_0xf4bb65[_0x5601('0x2f')]){delete _0xf4bb65[_0x5601('0x2f')];}_0x430ba8['status'](_0x6a18b2)[_0x5601('0x30')](_0xf4bb65);};}exports['index']=function(_0x337055,_0x234b34){var _0x45f857={},_0x3e064b={},_0x307b6e={'count':0x0,'rows':[]};var _0x3bf639=_[_0x5601('0x31')](db[_0x5601('0x32')][_0x5601('0x33')],function(_0x441055){return{'name':_0x441055[_0x5601('0x34')],'type':_0x441055[_0x5601('0x35')][_0x5601('0x36')]};});_0x3e064b[_0x5601('0x37')]=_[_0x5601('0x31')](_0x3bf639,'name');_0x3e064b[_0x5601('0x38')]=_[_0x5601('0x39')](_0x337055[_0x5601('0x38')]);_0x3e064b[_0x5601('0x3a')]=_[_0x5601('0x3b')](_0x3e064b['model'],_0x3e064b[_0x5601('0x38')]);_0x45f857['attributes']=_[_0x5601('0x3b')](_0x3e064b['model'],qs[_0x5601('0x3c')](_0x337055[_0x5601('0x38')][_0x5601('0x3c')]));_0x45f857[_0x5601('0x3d')]=_0x45f857[_0x5601('0x3d')][_0x5601('0x3e')]?_0x45f857[_0x5601('0x3d')]:_0x3e064b[_0x5601('0x37')];if(!_0x337055[_0x5601('0x38')]['hasOwnProperty'](_0x5601('0x3f'))){_0x45f857[_0x5601('0x21')]=qs['limit'](_0x337055[_0x5601('0x38')][_0x5601('0x21')]);_0x45f857[_0x5601('0x1e')]=qs[_0x5601('0x1e')](_0x337055[_0x5601('0x38')][_0x5601('0x1e')]);}_0x45f857[_0x5601('0x40')]=qs['sort'](_0x337055[_0x5601('0x38')]['sort']);_0x45f857[_0x5601('0x41')]=qs[_0x5601('0x3a')](_[_0x5601('0x42')](_0x337055[_0x5601('0x38')],_0x3e064b['filters']),_0x3bf639);if(_0x337055[_0x5601('0x38')][_0x5601('0x43')]){_0x45f857[_0x5601('0x41')]=_[_0x5601('0x44')](_0x45f857[_0x5601('0x41')],{'$or':_['map'](_0x3bf639,function(_0x11741b){if(_0x11741b[_0x5601('0x35')]!==_0x5601('0x45')){var _0x1b2038={};_0x1b2038[_0x11741b[_0x5601('0x2f')]]={'$like':'%'+_0x337055['query']['filter']+'%'};return _0x1b2038;}})});}_0x45f857=_['merge']({},_0x45f857,_0x337055[_0x5601('0x46')]);var _0x12f8aa={'where':_0x45f857[_0x5601('0x41')]};return db['Interval'][_0x5601('0x20')](_0x12f8aa)['then'](function(_0x1dfe6b){_0x307b6e[_0x5601('0x20')]=_0x1dfe6b;if(_0x337055['query']['includeAll']){_0x45f857[_0x5601('0x47')]=[{'all':!![]}];}return db['Interval'][_0x5601('0x48')](_0x45f857);})[_0x5601('0x27')](function(_0x44d295){_0x307b6e[_0x5601('0x49')]=_0x44d295;return _0x307b6e;})['then'](respondWithFilteredResult(_0x234b34,_0x45f857))['catch'](handleError(_0x234b34,null));};exports['show']=function(_0x468e82,_0x261211){var _0x7a652a={'raw':!![],'where':{'id':_0x468e82[_0x5601('0x4a')]['id']}},_0x2d218d={};_0x2d218d[_0x5601('0x37')]=_[_0x5601('0x39')](db[_0x5601('0x32')][_0x5601('0x33')]);_0x2d218d[_0x5601('0x38')]=_[_0x5601('0x39')](_0x468e82[_0x5601('0x38')]);_0x2d218d['filters']=_[_0x5601('0x3b')](_0x2d218d[_0x5601('0x37')],_0x2d218d[_0x5601('0x38')]);_0x7a652a[_0x5601('0x3d')]=_[_0x5601('0x3b')](_0x2d218d['model'],qs['fields'](_0x468e82[_0x5601('0x38')][_0x5601('0x3c')]));_0x7a652a['attributes']=_0x7a652a[_0x5601('0x3d')][_0x5601('0x3e')]?_0x7a652a['attributes']:_0x2d218d[_0x5601('0x37')];if(_0x468e82[_0x5601('0x38')][_0x5601('0x4b')]){_0x7a652a[_0x5601('0x47')]=[{'all':!![]}];}_0x7a652a=_[_0x5601('0x44')]({},_0x7a652a,_0x468e82['options']);return db[_0x5601('0x32')][_0x5601('0x4c')](_0x7a652a)[_0x5601('0x27')](handleEntityNotFound(_0x261211,null))[_0x5601('0x27')](respondWithResult(_0x261211,null))[_0x5601('0x4d')](handleError(_0x261211,null));};exports[_0x5601('0x4e')]=function(_0x15c9f2,_0x2479c2){return db[_0x5601('0x32')][_0x5601('0x4e')](_0x15c9f2[_0x5601('0x4f')],{})[_0x5601('0x27')](function(_0x3cbad8){var _0x32981c=_0x15c9f2[_0x5601('0x50')]['get']({'plain':!![]});if(!_0x32981c)throw new Error(_0x5601('0x51'));if(_0x32981c['role']===_0x5601('0x50')){var _0x3ba6b1=_0x3cbad8[_0x5601('0x28')]({'plain':!![]});var _0x55c88c='Intervals';return db[_0x5601('0x52')][_0x5601('0x4c')]({'where':{'name':_0x55c88c,'userProfileId':_0x32981c[_0x5601('0x53')]},'raw':!![]})[_0x5601('0x27')](function(_0x5d511c){if(_0x5d511c&&_0x5d511c[_0x5601('0x54')]===0x0){return db[_0x5601('0x2a')]['create']({'name':_0x3ba6b1['name'],'resourceId':_0x3ba6b1['id'],'type':_0x5d511c[_0x5601('0x2f')],'sectionId':_0x5d511c['id']},{})['then'](function(){return _0x3cbad8;});}else{return _0x3cbad8;}})[_0x5601('0x4d')](function(_0x19f737){logger[_0x5601('0x2d')](_0x5601('0x55'),_0x19f737);throw _0x19f737;});}return _0x3cbad8;})['then'](respondWithResult(_0x2479c2,0xc9))['catch'](handleError(_0x2479c2,null));};exports['update']=function(_0x19d418,_0x3bad94){if(_0x19d418[_0x5601('0x4f')]['id']){delete _0x19d418[_0x5601('0x4f')]['id'];}return db['Interval'][_0x5601('0x4c')]({'where':{'id':_0x19d418[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x3bad94,null))[_0x5601('0x27')](saveUpdates(_0x19d418[_0x5601('0x4f')],null))['then'](respondWithResult(_0x3bad94,null))['catch'](handleError(_0x3bad94,null));};exports['destroy']=function(_0x581b8c,_0x387dd7){return db[_0x5601('0x32')][_0x5601('0x4c')]({'where':{'id':_0x581b8c[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x387dd7,null))[_0x5601('0x27')](removeEntity(_0x387dd7,null))[_0x5601('0x4d')](handleError(_0x387dd7,null));};exports[_0x5601('0x56')]=function(_0x681e87,_0x34cdc3,_0x5d3ce2){if(_0x681e87[_0x5601('0x4f')]['id']){delete _0x681e87[_0x5601('0x4f')]['id'];}return db[_0x5601('0x32')]['find']({'where':{'id':_0x681e87[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x34cdc3,null))['then'](function(_0x4b5b31){if(_0x4b5b31){_0x681e87[_0x5601('0x4f')]['IntervalId']=_0x4b5b31['id'];return db[_0x5601('0x32')][_0x5601('0x4e')](_0x681e87[_0x5601('0x4f')]);}})[_0x5601('0x27')](respondWithResult(_0x34cdc3,null))[_0x5601('0x4d')](handleError(_0x34cdc3,null));};exports[_0x5601('0x57')]=function(_0x599a3b,_0x30f92a,_0xdb4a64){var _0x3064e8={};var _0x38221e={};var _0x1d5ad5;var _0x10f0dd;return db[_0x5601('0x32')][_0x5601('0x58')]({'where':{'id':_0x599a3b[_0x5601('0x4a')]['id']}})[_0x5601('0x27')](handleEntityNotFound(_0x30f92a,null))[_0x5601('0x27')](function(_0x1612a2){if(_0x1612a2){_0x1d5ad5=_0x1612a2;_0x38221e[_0x5601('0x37')]=_[_0x5601('0x39')](db[_0x5601('0x32')][_0x5601('0x33')]);_0x38221e[_0x5601('0x38')]=_[_0x5601('0x39')](_0x599a3b[_0x5601('0x38')]);_0x38221e[_0x5601('0x3a')]=_[_0x5601('0x3b')](_0x38221e[_0x5601('0x37')],_0x38221e['query']);_0x3064e8[_0x5601('0x3d')]=_['intersection'](_0x38221e[_0x5601('0x37')],qs[_0x5601('0x3c')](_0x599a3b[_0x5601('0x38')]['fields']));_0x3064e8[_0x5601('0x3d')]=_0x3064e8[_0x5601('0x3d')][_0x5601('0x3e')]?_0x3064e8[_0x5601('0x3d')]:_0x38221e['model'];_0x3064e8[_0x5601('0x40')]=qs['sort'](_0x599a3b['query'][_0x5601('0x59')]);_0x3064e8[_0x5601('0x41')]=qs[_0x5601('0x3a')](_['pick'](_0x599a3b['query'],_0x38221e['filters']));if(_0x599a3b[_0x5601('0x38')]['filter']){_0x3064e8['where']=_[_0x5601('0x44')](_0x3064e8[_0x5601('0x41')],{'$or':_[_0x5601('0x31')](_0x3064e8[_0x5601('0x3d')],function(_0x36ec54){var _0x1ad1a4={};_0x1ad1a4[_0x36ec54]={'$like':'%'+_0x599a3b[_0x5601('0x38')][_0x5601('0x43')]+'%'};return _0x1ad1a4;})});}_0x3064e8=_[_0x5601('0x44')]({},_0x3064e8,_0x599a3b[_0x5601('0x46')]);return _0x1d5ad5['getIntervals'](_0x3064e8);}})[_0x5601('0x27')](function(_0x389b99){if(_0x389b99){_0x10f0dd=_0x389b99[_0x5601('0x3e')];if(!_0x599a3b[_0x5601('0x38')][_0x5601('0x5a')](_0x5601('0x3f'))){_0x3064e8[_0x5601('0x21')]=qs[_0x5601('0x21')](_0x599a3b['query'][_0x5601('0x21')]);_0x3064e8[_0x5601('0x1e')]=qs[_0x5601('0x1e')](_0x599a3b[_0x5601('0x38')]['offset']);}return _0x1d5ad5['getIntervals'](_0x3064e8);}})[_0x5601('0x27')](function(_0x243068){if(_0x243068){return _0x243068?{'count':_0x10f0dd,'rows':_0x243068}:null;}})['then'](respondWithResult(_0x30f92a,null))[_0x5601('0x4d')](handleError(_0x30f92a,null));};exports['addIntervals']=function(_0x4d20f7,_0x3f2915,_0x3cbfaf){return db[_0x5601('0x32')][_0x5601('0x58')]({'where':{'id':_0x4d20f7[_0x5601('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f2915,null))[_0x5601('0x27')](function(_0xbe0045){if(_0xbe0045){return db['sequelize'][_0x5601('0x5b')](function(_0x48759b){return db[_0x5601('0x32')][_0x5601('0x2b')]({'where':{'IntervalId':_0x4d20f7[_0x5601('0x4a')]['id']},'transaction':_0x48759b})[_0x5601('0x27')](function(_0x330959){var _0x3bb810=_['map'](_0x4d20f7['body'],function(_0x56116c){delete _0x56116c['id'];_0x56116c[_0x5601('0x5c')]=_0x4d20f7[_0x5601('0x4a')]['id'];return _0x56116c;});return db[_0x5601('0x32')]['bulkCreate'](_0x3bb810,{'transaction':_0x48759b});});})[_0x5601('0x27')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x4d20f7[_0x5601('0x4a')]['id']}});});}})[_0x5601('0x27')](respondWithResult(_0x3f2915,null))[_0x5601('0x4d')](handleError(_0x3f2915,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0e748f4..7f157a5 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 _0xe174=['request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird'];(function(_0x545d6d,_0x44f163){var _0x3181a7=function(_0x22fbe5){while(--_0x22fbe5){_0x545d6d['push'](_0x545d6d['shift']());}};_0x3181a7(++_0x44f163);}(_0xe174,0x64));var _0x4e17=function(_0x3df09c,_0x502545){_0x3df09c=_0x3df09c-0x0;var _0x18b371=_0xe174[_0x3df09c];return _0x18b371;};'use strict';var _=require('lodash');var util=require(_0x4e17('0x0'));var logger=require(_0x4e17('0x1'))(_0x4e17('0x2'));var moment=require(_0x4e17('0x3'));var BPromise=require(_0x4e17('0x4'));var rp=require(_0x4e17('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e17('0x6'));var config=require(_0x4e17('0x7'));var attributes=require(_0x4e17('0x8'));var extensions=require(_0x4e17('0x9'));module[_0x4e17('0xa')]=function(_0x374eb3,_0x5ca9b9){return _0x374eb3[_0x4e17('0xb')](_0x4e17('0xc'),attributes,{'tableName':_0x4e17('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3114b2,_0x1a213f){extensions[_0x4e17('0xe')](_0x374eb3,_0x3114b2);},'afterBulkCreate':function(_0x3edfd7,_0x453f92,_0x4dae82){_0x4dae82();extensions['rewrite'](_0x374eb3,_0x3edfd7[0x0]);},'afterUpdate':function(_0x30128a,_0x21c369){extensions[_0x4e17('0xe')](_0x374eb3,_0x30128a);},'afterDestroy':function(_0x28bf98,_0xfedf9c){extensions[_0x4e17('0xe')](_0x374eb3,_0x28bf98);}}});}; \ No newline at end of file +var _0xa765=['./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa765,0xe7));var _0x5a76=function(_0x16a9dc,_0x3c5d02){_0x16a9dc=_0x16a9dc-0x0;var _0xd820c4=_0xa765[_0x16a9dc];return _0xd820c4;};'use strict';var _=require(_0x5a76('0x0'));var util=require(_0x5a76('0x1'));var logger=require(_0x5a76('0x2'))('api');var moment=require(_0x5a76('0x3'));var BPromise=require(_0x5a76('0x4'));var rp=require(_0x5a76('0x5'));var fs=require('fs');var path=require(_0x5a76('0x6'));var rimraf=require(_0x5a76('0x7'));var config=require(_0x5a76('0x8'));var attributes=require(_0x5a76('0x9'));var extensions=require(_0x5a76('0xa'));module[_0x5a76('0xb')]=function(_0x1de31a,_0x36ad9c){return _0x1de31a[_0x5a76('0xc')](_0x5a76('0xd'),attributes,{'tableName':_0x5a76('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17bf3d,_0x2237df){extensions[_0x5a76('0xf')](_0x1de31a,_0x17bf3d);},'afterBulkCreate':function(_0x489bc6,_0xb5a70,_0x49c23a){_0x49c23a();extensions[_0x5a76('0xf')](_0x1de31a,_0x489bc6[0x0]);},'afterUpdate':function(_0x5a4f30,_0x474728){extensions[_0x5a76('0xf')](_0x1de31a,_0x5a4f30);},'afterDestroy':function(_0x4a0b5d,_0x47b7f4){extensions['rewrite'](_0x1de31a,_0x4a0b5d);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 905c66b..8152f9f 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index f038f37..66d0cc6 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x36a671,_0x52b578){var _0x509cf9=function(_0x2fc6e0){while(--_0x2fc6e0){_0x36a671['push'](_0x36a671['shift']());}};_0x509cf9(++_0x52b578);}(_0xadb5,0xad));var _0x5adb=function(_0x16da77,_0x1d786a){_0x16da77=_0x16da77-0x0;var _0x452011=_0xadb5[_0x16da77];return _0x452011;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x257a01,_0x143777){var _0xc2cd98=function(_0x3d1842){while(--_0x3d1842){_0x257a01['push'](_0x257a01['shift']());}};_0xc2cd98(++_0x143777);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3efd09,_0x4b3e6a){_0x3efd09=_0x3efd09-0x0;var _0x2a8b3d=_0x5f2f[_0x3efd09];return _0x2a8b3d;};'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 b62da0e..a36ca35 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 _0x36ce=['reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','base64','request','setEncoding','data','end','status','statusCode','json','parse','error','api.jira','openIssue','send','body','connection','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name'];(function(_0xf33afd,_0x2363b6){var _0x5f432a=function(_0x2599b5){while(--_0x2599b5){_0xf33afd['push'](_0xf33afd['shift']());}};_0x5f432a(++_0x2363b6);}(_0x36ce,0x6a));var _0xe36c=function(_0x1e0b87,_0x38b483){_0x1e0b87=_0x1e0b87-0x0;var _0x474406=_0x36ce[_0x1e0b87];return _0x474406;};'use strict';var BPromise=require(_0xe36c('0x0'));var https=require(_0xe36c('0x1'));var logger=require(_0xe36c('0x2'))('api');var USERNAME='support';var PASSWORD=_0xe36c('0x3');function openIssue(_0x55e094,_0x423748){var _0x1a0a57={'fields':{'project':{'key':_0x55e094[_0xe36c('0x4')]||_0xe36c('0x5')},'summary':(_0x55e094[_0xe36c('0x6')]||_0xe36c('0x7'))+_0xe36c('0x8')+_0x55e094['ip'],'description':_0x55e094[_0xe36c('0x9')]||JSON[_0xe36c('0xa')](_0x55e094),'issuetype':{'name':_0x55e094['issuetype']||'Bug'}}};_0x1a0a57['fields'][_0xe36c('0xb')]=_0x55e094[_0xe36c('0xc')];_0x1a0a57[_0xe36c('0xd')][_0xe36c('0xe')]=_0x55e094[_0xe36c('0xf')];_0x1a0a57[_0xe36c('0xd')][_0xe36c('0x10')]=_0x55e094[_0xe36c('0x11')];_0x1a0a57[_0xe36c('0xd')][_0xe36c('0x12')]=_0x55e094[_0xe36c('0x13')];_0x1a0a57[_0xe36c('0xd')]['customfield_11504']=_0x55e094[_0xe36c('0x14')];_0x1a0a57[_0xe36c('0xd')][_0xe36c('0x15')]=_0x55e094['ip'];var _0x52500c={'host':_0xe36c('0x16'),'port':0x1bb,'path':_0xe36c('0x17'),'method':_0xe36c('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xe36c('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xe36c('0x1a'))}};var _0x3065cb=JSON[_0xe36c('0xa')](_0x1a0a57);var _0x151293=https[_0xe36c('0x1b')](_0x52500c,function(_0x56a4ac){_0x56a4ac[_0xe36c('0x1c')]('utf8');var _0x3ce7a4='';_0x56a4ac['on'](_0xe36c('0x1d'),function(_0x4b2871){_0x3ce7a4+=_0x4b2871;});_0x56a4ac['on'](_0xe36c('0x1e'),function(){if(_0x423748){return _0x423748[_0xe36c('0x1f')](_0x56a4ac[_0xe36c('0x20')])[_0xe36c('0x21')](JSON[_0xe36c('0x22')](_0x3ce7a4));}});});_0x151293['on'](_0xe36c('0x23'),function(_0x45e33f){if(_0x423748){return _0x423748[_0xe36c('0x1f')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xe36c('0x24')}]});}});_0x151293['write'](_0x3065cb);_0x151293[_0xe36c('0x1e')]();}exports[_0xe36c('0x25')]=openIssue;exports[_0xe36c('0x26')]=function(_0x3f4a45,_0x5ab02a){_0x3f4a45[_0xe36c('0x27')]['ip']=_0x3f4a45['headers']['x-forwarded-for']||_0x3f4a45[_0xe36c('0x28')]['remoteAddress']||_0x3f4a45[_0xe36c('0x29')]['remoteAddress']||_0x3f4a45[_0xe36c('0x28')][_0xe36c('0x29')]['remoteAddress'];return openIssue(_0x3f4a45[_0xe36c('0x27')],_0x5ab02a);}; \ No newline at end of file +var _0xc454=['remoteAddress','socket','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','name','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','headers','x-forwarded-for','connection'];(function(_0x1b62b8,_0x3e78d9){var _0x47a5a0=function(_0x479a5b){while(--_0x479a5b){_0x1b62b8['push'](_0x1b62b8['shift']());}};_0x47a5a0(++_0x3e78d9);}(_0xc454,0xbb));var _0x4c45=function(_0x2b6348,_0x1e9358){_0x2b6348=_0x2b6348-0x0;var _0x4324d7=_0xc454[_0x2b6348];return _0x4324d7;};'use strict';var BPromise=require(_0x4c45('0x0'));var https=require(_0x4c45('0x1'));var logger=require(_0x4c45('0x2'))('api');var USERNAME=_0x4c45('0x3');var PASSWORD=_0x4c45('0x4');function openIssue(_0x211612,_0x40650d){var _0x1a09ac={'fields':{'project':{'key':_0x211612[_0x4c45('0x5')]||_0x4c45('0x6')},'summary':(_0x211612['summary']||_0x4c45('0x7'))+_0x4c45('0x8')+_0x211612['ip'],'description':_0x211612[_0x4c45('0x9')]||JSON[_0x4c45('0xa')](_0x211612),'issuetype':{'name':_0x211612[_0x4c45('0xb')]||_0x4c45('0xc')}}};_0x1a09ac[_0x4c45('0xd')][_0x4c45('0xe')]=_0x211612['email'];_0x1a09ac[_0x4c45('0xd')][_0x4c45('0xf')]=_0x211612[_0x4c45('0x10')];_0x1a09ac[_0x4c45('0xd')][_0x4c45('0x11')]=_0x211612['newToken'];_0x1a09ac['fields']['customfield_11503']=_0x211612[_0x4c45('0x12')];_0x1a09ac[_0x4c45('0xd')]['customfield_11504']=_0x211612[_0x4c45('0x13')];_0x1a09ac[_0x4c45('0xd')][_0x4c45('0x14')]=_0x211612['ip'];var _0x3cad03={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x4c45('0x15'),'method':_0x4c45('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x4c45('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x4c45('0x18')](_0x4c45('0x19'))}};var _0x696ebc=JSON[_0x4c45('0xa')](_0x1a09ac);var _0x383d40=https[_0x4c45('0x1a')](_0x3cad03,function(_0x298b89){_0x298b89[_0x4c45('0x1b')](_0x4c45('0x1c'));var _0x5ab5ff='';_0x298b89['on'](_0x4c45('0x1d'),function(_0x4e9180){_0x5ab5ff+=_0x4e9180;});_0x298b89['on'](_0x4c45('0x1e'),function(){if(_0x40650d){return _0x40650d[_0x4c45('0x1f')](_0x298b89[_0x4c45('0x20')])[_0x4c45('0x21')](JSON[_0x4c45('0x22')](_0x5ab5ff));}});});_0x383d40['on'](_0x4c45('0x23'),function(_0x24912c){if(_0x40650d){return _0x40650d[_0x4c45('0x1f')](0x1f4)['json']({'errors':[{'message':_0x4c45('0x24'),'type':_0x4c45('0x25')}]});}});_0x383d40[_0x4c45('0x26')](_0x696ebc);_0x383d40[_0x4c45('0x1e')]();}exports['openIssue']=openIssue;exports[_0x4c45('0x27')]=function(_0x25f368,_0x4fb4a9){_0x25f368['body']['ip']=_0x25f368[_0x4c45('0x28')][_0x4c45('0x29')]||_0x25f368[_0x4c45('0x2a')]['remoteAddress']||_0x25f368['socket'][_0x4c45('0x2b')]||_0x25f368[_0x4c45('0x2a')][_0x4c45('0x2c')][_0x4c45('0x2b')];return openIssue(_0x25f368[_0x4c45('0x2d')],_0x4fb4a9);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 881c528..6e1e06b 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 _0x54ef=['/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index','get'];(function(_0x26d66e,_0xc13f9c){var _0x5d5e01=function(_0x37b8ea){while(--_0x37b8ea){_0x26d66e['push'](_0x26d66e['shift']());}};_0x5d5e01(++_0xc13f9c);}(_0x54ef,0x112));var _0xf54e=function(_0x415c97,_0x26da8e){_0x415c97=_0x415c97-0x0;var _0x53e71c=_0x54ef[_0x415c97];return _0x53e71c;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['get'](_0xf54e('0xe'),auth[_0xf54e('0xf')](),controller['show']);router[_0xf54e('0x10')]('/',auth[_0xf54e('0xf')](),controller[_0xf54e('0x11')]);router[_0xf54e('0x12')]('/:id',auth[_0xf54e('0xf')](),controller[_0xf54e('0x13')]);router[_0xf54e('0x14')](_0xf54e('0xe'),auth['isAuthenticated'](),controller[_0xf54e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x702d,0x147));var _0xd702=function(_0x231749,_0x20f566){_0x231749=_0x231749-0x0;var _0x3311f9=_0x702d[_0x231749];return _0x3311f9;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index fae6030..1619c56 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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x4f426f,_0xb65fa9){_0x4f426f=_0x4f426f-0x0;var _0xf379cc=_0x7a54[_0x4f426f];return _0xf379cc;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x57e862,_0x4851a8){_0x57e862=_0x57e862-0x0;var _0x1a9b80=_0x7a54[_0x57e862];return _0x1a9b80;};'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 43b84c0..a2660b5 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 _0xa1f6=['error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xa1f6[_0x5d1044];return _0x3cd90e;};'use strict';var emlformat=require(_0x6a1f('0x0'));var rimraf=require(_0x6a1f('0x1'));var zipdir=require(_0x6a1f('0x2'));var jsonpatch=require(_0x6a1f('0x3'));var rp=require(_0x6a1f('0x4'));var moment=require(_0x6a1f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6a1f('0x6'));var ejs=require(_0x6a1f('0x7'));var fs=require('fs');var fs_extra=require(_0x6a1f('0x8'));var _=require(_0x6a1f('0x9'));var squel=require(_0x6a1f('0xa'));var crypto=require(_0x6a1f('0xb'));var jsforce=require(_0x6a1f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a1f('0x6'));var querystring=require(_0x6a1f('0xd'));var Papa=require(_0x6a1f('0xe'));var Redis=require(_0x6a1f('0xf'));var authService=require(_0x6a1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a1f('0x11'));var hardwareService=require(_0x6a1f('0x12'));var logger=require(_0x6a1f('0x13'))(_0x6a1f('0x14'));var utils=require('../../config/utils');var config=require(_0x6a1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a1f('0x16'))['db'];function respondWithStatusCode(_0x17edb6,_0x2a4e94){_0x2a4e94=_0x2a4e94||0xcc;return function(_0x442576){if(_0x442576){return _0x17edb6[_0x6a1f('0x17')](_0x2a4e94);}return _0x17edb6[_0x6a1f('0x18')](_0x2a4e94)[_0x6a1f('0x19')]();};}function respondWithResult(_0x8c3a36,_0x1918c6){_0x1918c6=_0x1918c6||0xc8;return function(_0x27d8f8){if(_0x27d8f8){return _0x8c3a36[_0x6a1f('0x18')](_0x1918c6)[_0x6a1f('0x1a')](_0x27d8f8);}};}function respondWithFilteredResult(_0x253305,_0x2677c1){return function(_0x14ecec){if(_0x14ecec){var _0x11ee0e=typeof _0x2677c1[_0x6a1f('0x1b')]===_0x6a1f('0x1c')&&typeof _0x2677c1[_0x6a1f('0x1d')]==='undefined';var _0x392ccb=_0x14ecec[_0x6a1f('0x1e')];var _0x1ccbed=_0x11ee0e?0x0:_0x2677c1[_0x6a1f('0x1b')];var _0x21d268=_0x11ee0e?_0x14ecec[_0x6a1f('0x1e')]:_0x2677c1[_0x6a1f('0x1b')]+_0x2677c1[_0x6a1f('0x1d')];var _0x5cb044;if(_0x21d268>=_0x392ccb){_0x21d268=_0x392ccb;_0x5cb044=0xc8;}else{_0x5cb044=0xce;}_0x253305[_0x6a1f('0x18')](_0x5cb044);return _0x253305['set'](_0x6a1f('0x1f'),_0x1ccbed+'-'+_0x21d268+'/'+_0x392ccb)[_0x6a1f('0x1a')](_0x14ecec);}return null;};}function patchUpdates(_0x3c7ed0){return function(_0x1b5856){try{jsonpatch[_0x6a1f('0x20')](_0x1b5856,_0x3c7ed0,!![]);}catch(_0x4eae7f){return BPromise[_0x6a1f('0x21')](_0x4eae7f);}return _0x1b5856[_0x6a1f('0x22')]();};}function saveUpdates(_0xa43cd5,_0x1be0c3){return function(_0x312e75){if(_0x312e75){return _0x312e75[_0x6a1f('0x23')](_0xa43cd5)[_0x6a1f('0x24')](function(_0x2736ab){return _0x2736ab;});}return null;};}function removeEntity(_0x53229b,_0x1eb146){return function(_0x3d953d){if(_0x3d953d){return _0x3d953d['destroy']()['then'](function(){_0x53229b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea158,_0x5e6013){return function(_0x5abe40){if(!_0x5abe40){_0x3ea158[_0x6a1f('0x17')](0x194);}return _0x5abe40;};}function handleError(_0x286d1d,_0x2b53ca){_0x2b53ca=_0x2b53ca||0x1f4;return function(_0x1e8db8){logger[_0x6a1f('0x25')](_0x1e8db8[_0x6a1f('0x26')]);if(_0x1e8db8[_0x6a1f('0x27')]){delete _0x1e8db8[_0x6a1f('0x27')];}_0x286d1d['status'](_0x2b53ca)[_0x6a1f('0x28')](_0x1e8db8);};}exports[_0x6a1f('0x29')]=function(_0x3f0730,_0x574d80){var _0x1e951c={},_0x155c58={},_0x257cee={'count':0x0,'rows':[]};var _0x113422=_[_0x6a1f('0x2a')](db[_0x6a1f('0x2b')][_0x6a1f('0x2c')],function(_0x58d879){return{'name':_0x58d879['fieldName'],'type':_0x58d879[_0x6a1f('0x2d')][_0x6a1f('0x2e')]};});_0x155c58[_0x6a1f('0x2f')]=_[_0x6a1f('0x2a')](_0x113422,_0x6a1f('0x27'));_0x155c58[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x3f0730['query']);_0x155c58[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x155c58['model'],_0x155c58[_0x6a1f('0x30')]);_0x1e951c[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x155c58['model'],qs['fields'](_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x35')]));_0x1e951c[_0x6a1f('0x34')]=_0x1e951c['attributes']['length']?_0x1e951c[_0x6a1f('0x34')]:_0x155c58[_0x6a1f('0x2f')];if(!_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x36')](_0x6a1f('0x37'))){_0x1e951c[_0x6a1f('0x1d')]=qs[_0x6a1f('0x1d')](_0x3f0730['query'][_0x6a1f('0x1d')]);_0x1e951c['offset']=qs[_0x6a1f('0x1b')](_0x3f0730[_0x6a1f('0x30')]['offset']);}_0x1e951c[_0x6a1f('0x38')]=qs[_0x6a1f('0x39')](_0x3f0730['query'][_0x6a1f('0x39')]);_0x1e951c['where']=qs[_0x6a1f('0x32')](_['pick'](_0x3f0730[_0x6a1f('0x30')],_0x155c58['filters']),_0x113422);if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]){_0x1e951c['where']=_[_0x6a1f('0x3b')](_0x1e951c[_0x6a1f('0x3c')],{'$or':_['map'](_0x113422,function(_0x5beb28){if(_0x5beb28[_0x6a1f('0x2d')]!==_0x6a1f('0x3d')){var _0x314fef={};_0x314fef[_0x5beb28[_0x6a1f('0x27')]]={'$like':'%'+_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]+'%'};return _0x314fef;}})});}_0x1e951c=_['merge']({},_0x1e951c,_0x3f0730[_0x6a1f('0x3e')]);var _0x2da23a={'where':_0x1e951c[_0x6a1f('0x3c')]};return db[_0x6a1f('0x2b')][_0x6a1f('0x1e')](_0x2da23a)[_0x6a1f('0x24')](function(_0x27be0a){_0x257cee[_0x6a1f('0x1e')]=_0x27be0a;if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3f')]){_0x1e951c[_0x6a1f('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6a1f('0x41')](_0x1e951c);})[_0x6a1f('0x24')](function(_0x334fc4){_0x257cee[_0x6a1f('0x42')]=_0x334fc4;return _0x257cee;})[_0x6a1f('0x24')](respondWithFilteredResult(_0x574d80,_0x1e951c))[_0x6a1f('0x43')](handleError(_0x574d80,null));};exports['show']=function(_0x211009,_0x482c3a){var _0x3a6f80={'raw':!![],'where':{'id':_0x211009[_0x6a1f('0x44')]['id']}},_0x33208d={};_0x33208d[_0x6a1f('0x2f')]=_[_0x6a1f('0x31')](db[_0x6a1f('0x2b')]['rawAttributes']);_0x33208d[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x211009[_0x6a1f('0x30')]);_0x33208d[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],_0x33208d[_0x6a1f('0x30')]);_0x3a6f80[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],qs['fields'](_0x211009['query']['fields']));_0x3a6f80[_0x6a1f('0x34')]=_0x3a6f80[_0x6a1f('0x34')][_0x6a1f('0x45')]?_0x3a6f80[_0x6a1f('0x34')]:_0x33208d[_0x6a1f('0x2f')];if(_0x211009[_0x6a1f('0x30')]['includeAll']){_0x3a6f80[_0x6a1f('0x40')]=[{'all':!![]}];}_0x3a6f80=_['merge']({},_0x3a6f80,_0x211009[_0x6a1f('0x3e')]);return db[_0x6a1f('0x2b')]['find'](_0x3a6f80)[_0x6a1f('0x24')](handleEntityNotFound(_0x482c3a,null))['then'](respondWithResult(_0x482c3a,null))[_0x6a1f('0x43')](handleError(_0x482c3a,null));};exports[_0x6a1f('0x46')]=function(_0xa864f3,_0x4318fd){return db[_0x6a1f('0x2b')][_0x6a1f('0x46')](_0xa864f3['body'],{})[_0x6a1f('0x24')](respondWithResult(_0x4318fd,0xc9))[_0x6a1f('0x43')](handleError(_0x4318fd,null));};exports[_0x6a1f('0x23')]=function(_0x2bea1a,_0x34fa17){if(_0x2bea1a[_0x6a1f('0x47')]['id']){delete _0x2bea1a[_0x6a1f('0x47')]['id'];}return db[_0x6a1f('0x2b')]['find']({'where':{'id':_0x2bea1a[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x34fa17,null))[_0x6a1f('0x24')](saveUpdates(_0x2bea1a['body'],null))[_0x6a1f('0x24')](respondWithResult(_0x34fa17,null))['catch'](handleError(_0x34fa17,null));};exports[_0x6a1f('0x48')]=function(_0x52c262,_0x366a60){return db['JscriptyAnswerReport'][_0x6a1f('0x49')]({'where':{'id':_0x52c262[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x366a60,null))['then'](removeEntity(_0x366a60,null))[_0x6a1f('0x43')](handleError(_0x366a60,null));};exports['describe']=function(_0x143873,_0x55d114){return db['JscriptyAnswerReport'][_0x6a1f('0x4a')]()[_0x6a1f('0x24')](respondWithResult(_0x55d114,null))['catch'](handleError(_0x55d114,null));}; \ No newline at end of file +var _0x3f1c=['params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x185a6f,_0x192581){var _0x54ec70=function(_0x13b64e){while(--_0x13b64e){_0x185a6f['push'](_0x185a6f['shift']());}};_0x54ec70(++_0x192581);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x75c0aa,_0x52f100){_0x75c0aa=_0x75c0aa-0x0;var _0x397a4e=_0x3f1c[_0x75c0aa];return _0x397a4e;};'use strict';var emlformat=require(_0xc3f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3f1('0x2'));var Mustache=require(_0xc3f1('0x3'));var util=require(_0xc3f1('0x4'));var path=require(_0xc3f1('0x5'));var sox=require(_0xc3f1('0x6'));var csv=require('to-csv');var ejs=require(_0xc3f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f1('0x8'));var squel=require(_0xc3f1('0x9'));var crypto=require(_0xc3f1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3f1('0xb'));var querystring=require('querystring');var Papa=require(_0xc3f1('0xc'));var Redis=require(_0xc3f1('0xd'));var authService=require(_0xc3f1('0xe'));var qs=require(_0xc3f1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f1('0x10'));var logger=require('../../config/logger')(_0xc3f1('0x11'));var utils=require('../../config/utils');var config=require(_0xc3f1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23bb14,_0x103df5){_0x103df5=_0x103df5||0xcc;return function(_0x25cb9e){if(_0x25cb9e){return _0x23bb14[_0xc3f1('0x13')](_0x103df5);}return _0x23bb14[_0xc3f1('0x14')](_0x103df5)[_0xc3f1('0x15')]();};}function respondWithResult(_0x5bbfb3,_0x5dbe5c){_0x5dbe5c=_0x5dbe5c||0xc8;return function(_0x1d9ea7){if(_0x1d9ea7){return _0x5bbfb3[_0xc3f1('0x14')](_0x5dbe5c)[_0xc3f1('0x16')](_0x1d9ea7);}};}function respondWithFilteredResult(_0x23eb8c,_0x4e8f05){return function(_0x4667af){if(_0x4667af){var _0xee643=typeof _0x4e8f05[_0xc3f1('0x17')]===_0xc3f1('0x18')&&typeof _0x4e8f05['limit']===_0xc3f1('0x18');var _0x59e1e3=_0x4667af[_0xc3f1('0x19')];var _0x420d75=_0xee643?0x0:_0x4e8f05[_0xc3f1('0x17')];var _0x3dc419=_0xee643?_0x4667af['count']:_0x4e8f05[_0xc3f1('0x17')]+_0x4e8f05[_0xc3f1('0x1a')];var _0x3f97b2;if(_0x3dc419>=_0x59e1e3){_0x3dc419=_0x59e1e3;_0x3f97b2=0xc8;}else{_0x3f97b2=0xce;}_0x23eb8c[_0xc3f1('0x14')](_0x3f97b2);return _0x23eb8c[_0xc3f1('0x1b')]('Content-Range',_0x420d75+'-'+_0x3dc419+'/'+_0x59e1e3)[_0xc3f1('0x16')](_0x4667af);}return null;};}function patchUpdates(_0x4f53c1){return function(_0x546627){try{jsonpatch[_0xc3f1('0x1c')](_0x546627,_0x4f53c1,!![]);}catch(_0x1d3ebb){return BPromise[_0xc3f1('0x1d')](_0x1d3ebb);}return _0x546627[_0xc3f1('0x1e')]();};}function saveUpdates(_0x53d054,_0x44d774){return function(_0x2df1a4){if(_0x2df1a4){return _0x2df1a4[_0xc3f1('0x1f')](_0x53d054)[_0xc3f1('0x20')](function(_0x151c8a){return _0x151c8a;});}return null;};}function removeEntity(_0x31a03c,_0x2f4d81){return function(_0x294f50){if(_0x294f50){return _0x294f50['destroy']()['then'](function(){_0x31a03c[_0xc3f1('0x14')](0xcc)[_0xc3f1('0x15')]();});}};}function handleEntityNotFound(_0x3b1eb9,_0x49d98d){return function(_0x5e1b6a){if(!_0x5e1b6a){_0x3b1eb9[_0xc3f1('0x13')](0x194);}return _0x5e1b6a;};}function handleError(_0x41b473,_0x1cf63f){_0x1cf63f=_0x1cf63f||0x1f4;return function(_0x4dd154){logger['error'](_0x4dd154[_0xc3f1('0x21')]);if(_0x4dd154[_0xc3f1('0x22')]){delete _0x4dd154['name'];}_0x41b473['status'](_0x1cf63f)[_0xc3f1('0x23')](_0x4dd154);};}exports[_0xc3f1('0x24')]=function(_0x5cb85d,_0x2d6cc4){var _0x22dac7={},_0x2f925e={},_0x3454a3={'count':0x0,'rows':[]};var _0x4103ef=_[_0xc3f1('0x25')](db[_0xc3f1('0x26')]['rawAttributes'],function(_0x22957c){return{'name':_0x22957c[_0xc3f1('0x27')],'type':_0x22957c[_0xc3f1('0x28')][_0xc3f1('0x29')]};});_0x2f925e[_0xc3f1('0x2a')]=_['map'](_0x4103ef,_0xc3f1('0x22'));_0x2f925e['query']=_[_0xc3f1('0x2b')](_0x5cb85d['query']);_0x2f925e['filters']=_[_0xc3f1('0x2c')](_0x2f925e[_0xc3f1('0x2a')],_0x2f925e['query']);_0x22dac7[_0xc3f1('0x2d')]=_[_0xc3f1('0x2c')](_0x2f925e['model'],qs[_0xc3f1('0x2e')](_0x5cb85d['query'][_0xc3f1('0x2e')]));_0x22dac7[_0xc3f1('0x2d')]=_0x22dac7[_0xc3f1('0x2d')][_0xc3f1('0x2f')]?_0x22dac7[_0xc3f1('0x2d')]:_0x2f925e['model'];if(!_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x31')]('nolimit')){_0x22dac7[_0xc3f1('0x1a')]=qs[_0xc3f1('0x1a')](_0x5cb85d[_0xc3f1('0x30')]['limit']);_0x22dac7[_0xc3f1('0x17')]=qs[_0xc3f1('0x17')](_0x5cb85d['query'][_0xc3f1('0x17')]);}_0x22dac7[_0xc3f1('0x32')]=qs['sort'](_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x33')]);_0x22dac7[_0xc3f1('0x34')]=qs[_0xc3f1('0x35')](_[_0xc3f1('0x36')](_0x5cb85d[_0xc3f1('0x30')],_0x2f925e[_0xc3f1('0x35')]),_0x4103ef);if(_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x37')]){_0x22dac7[_0xc3f1('0x34')]=_[_0xc3f1('0x38')](_0x22dac7['where'],{'$or':_[_0xc3f1('0x25')](_0x4103ef,function(_0x5db660){if(_0x5db660['type']!==_0xc3f1('0x39')){var _0x4420ce={};_0x4420ce[_0x5db660[_0xc3f1('0x22')]]={'$like':'%'+_0x5cb85d['query'][_0xc3f1('0x37')]+'%'};return _0x4420ce;}})});}_0x22dac7=_[_0xc3f1('0x38')]({},_0x22dac7,_0x5cb85d[_0xc3f1('0x3a')]);var _0x29eefa={'where':_0x22dac7[_0xc3f1('0x34')]};return db[_0xc3f1('0x26')]['count'](_0x29eefa)[_0xc3f1('0x20')](function(_0x3afde8){_0x3454a3[_0xc3f1('0x19')]=_0x3afde8;if(_0x5cb85d['query']['includeAll']){_0x22dac7[_0xc3f1('0x3b')]=[{'all':!![]}];}return db[_0xc3f1('0x26')]['findAll'](_0x22dac7);})[_0xc3f1('0x20')](function(_0x30e012){_0x3454a3['rows']=_0x30e012;return _0x3454a3;})['then'](respondWithFilteredResult(_0x2d6cc4,_0x22dac7))['catch'](handleError(_0x2d6cc4,null));};exports['show']=function(_0x4a829c,_0x1904c0){var _0x1e8e55={'raw':!![],'where':{'id':_0x4a829c[_0xc3f1('0x3c')]['id']}},_0xfcf4a6={};_0xfcf4a6['model']=_['keys'](db[_0xc3f1('0x26')][_0xc3f1('0x3d')]);_0xfcf4a6[_0xc3f1('0x30')]=_[_0xc3f1('0x2b')](_0x4a829c[_0xc3f1('0x30')]);_0xfcf4a6[_0xc3f1('0x35')]=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],_0xfcf4a6[_0xc3f1('0x30')]);_0x1e8e55['attributes']=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],qs['fields'](_0x4a829c[_0xc3f1('0x30')][_0xc3f1('0x2e')]));_0x1e8e55[_0xc3f1('0x2d')]=_0x1e8e55[_0xc3f1('0x2d')]['length']?_0x1e8e55['attributes']:_0xfcf4a6['model'];if(_0x4a829c['query'][_0xc3f1('0x3e')]){_0x1e8e55[_0xc3f1('0x3b')]=[{'all':!![]}];}_0x1e8e55=_['merge']({},_0x1e8e55,_0x4a829c[_0xc3f1('0x3a')]);return db[_0xc3f1('0x26')][_0xc3f1('0x3f')](_0x1e8e55)[_0xc3f1('0x20')](handleEntityNotFound(_0x1904c0,null))[_0xc3f1('0x20')](respondWithResult(_0x1904c0,null))[_0xc3f1('0x40')](handleError(_0x1904c0,null));};exports[_0xc3f1('0x41')]=function(_0x581eca,_0x3fdb5c){return db[_0xc3f1('0x26')]['create'](_0x581eca[_0xc3f1('0x42')],{})[_0xc3f1('0x20')](respondWithResult(_0x3fdb5c,0xc9))[_0xc3f1('0x40')](handleError(_0x3fdb5c,null));};exports['update']=function(_0x1a7d8c,_0x2f370b){if(_0x1a7d8c['body']['id']){delete _0x1a7d8c[_0xc3f1('0x42')]['id'];}return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x1a7d8c[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x2f370b,null))[_0xc3f1('0x20')](saveUpdates(_0x1a7d8c[_0xc3f1('0x42')],null))[_0xc3f1('0x20')](respondWithResult(_0x2f370b,null))[_0xc3f1('0x40')](handleError(_0x2f370b,null));};exports['destroy']=function(_0x2966f2,_0x59245c){return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x2966f2[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x59245c,null))[_0xc3f1('0x20')](removeEntity(_0x59245c,null))[_0xc3f1('0x40')](handleError(_0x59245c,null));};exports[_0xc3f1('0x43')]=function(_0x58803a,_0x32aae1){return db[_0xc3f1('0x26')]['describe']()[_0xc3f1('0x20')](respondWithResult(_0x32aae1,null))[_0xc3f1('0x40')](handleError(_0x32aae1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7b6d268..a3b6027 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 _0x25d8=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x25d8,0x126));var _0x825d=function(_0x20e7ff,_0x8790e2){_0x20e7ff=_0x20e7ff-0x0;var _0x4d5f35=_0x25d8[_0x20e7ff];return _0x4d5f35;};'use strict';var _=require('lodash');var util=require(_0x825d('0x0'));var logger=require(_0x825d('0x1'))('api');var moment=require(_0x825d('0x2'));var BPromise=require(_0x825d('0x3'));var rp=require(_0x825d('0x4'));var fs=require('fs');var path=require(_0x825d('0x5'));var rimraf=require(_0x825d('0x6'));var config=require(_0x825d('0x7'));var attributes=require(_0x825d('0x8'));module['exports']=function(_0x4fd3b4,_0x136175){return _0x4fd3b4['define'](_0x825d('0x9'),attributes,{'tableName':_0x825d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc5=['api','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x38a86c,_0xbffba4){var _0x7a5e15=function(_0x4f2ee2){while(--_0x4f2ee2){_0x38a86c['push'](_0x38a86c['shift']());}};_0x7a5e15(++_0xbffba4);}(_0x7cc5,0x82));var _0x57cc=function(_0x26fdfc,_0x5ede52){_0x26fdfc=_0x26fdfc-0x0;var _0x5c9e63=_0x7cc5[_0x26fdfc];return _0x5c9e63;};'use strict';var _=require(_0x57cc('0x0'));var util=require(_0x57cc('0x1'));var logger=require('../../config/logger')(_0x57cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57cc('0x3'));var rimraf=require(_0x57cc('0x4'));var config=require(_0x57cc('0x5'));var attributes=require(_0x57cc('0x6'));module[_0x57cc('0x7')]=function(_0x1ee331,_0x555c20){return _0x1ee331[_0x57cc('0x8')](_0x57cc('0x9'),attributes,{'tableName':_0x57cc('0xa'),'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 122c32b..2b3ab07 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 _0xa579=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x5bb3fb,_0x24d804){var _0xae0ebe=function(_0x4f06cf){while(--_0x4f06cf){_0x5bb3fb['push'](_0x5bb3fb['shift']());}};_0xae0ebe(++_0x24d804);}(_0xa579,0xa5));var _0x9a57=function(_0x577b24,_0x3a486d){_0x577b24=_0x577b24-0x0;var _0x356426=_0xa579[_0x577b24];return _0x356426;};'use strict';var _=require(_0x9a57('0x0'));var util=require(_0x9a57('0x1'));var moment=require(_0x9a57('0x2'));var BPromise=require(_0x9a57('0x3'));var rs=require(_0x9a57('0x4'));var fs=require('fs');var Redis=require(_0x9a57('0x5'));var db=require(_0x9a57('0x6'))['db'];var utils=require(_0x9a57('0x7'));var logger=require('../../config/logger')(_0x9a57('0x8'));var config=require(_0x9a57('0x9'));var jayson=require(_0x9a57('0xa'));var client=jayson[_0x9a57('0xb')][_0x9a57('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40cdf2,_0x17b3bd,_0x392555){return new BPromise(function(_0x1cd4d4,_0xd36570){return client[_0x9a57('0xd')](_0x40cdf2,_0x392555)[_0x9a57('0xe')](function(_0x443181){logger[_0x9a57('0xf')](_0x9a57('0x10'),_0x17b3bd,_0x9a57('0x11'));logger[_0x9a57('0x12')](_0x9a57('0x13'),_0x17b3bd,_0x9a57('0x11'),JSON['stringify'](_0x443181));if(_0x443181['error']){if(_0x443181[_0x9a57('0x14')]['code']===0x1f4){logger[_0x9a57('0x14')](_0x9a57('0x10'),_0x17b3bd,_0x443181[_0x9a57('0x14')][_0x9a57('0x15')]);return _0xd36570(_0x443181[_0x9a57('0x14')][_0x9a57('0x15')]);}logger[_0x9a57('0x14')](_0x9a57('0x10'),_0x17b3bd,_0x443181[_0x9a57('0x14')][_0x9a57('0x15')]);return _0x1cd4d4(_0x443181[_0x9a57('0x14')]['message']);}else{logger[_0x9a57('0xf')](_0x9a57('0x10'),_0x17b3bd,_0x9a57('0x11'));_0x1cd4d4(_0x443181[_0x9a57('0x16')][_0x9a57('0x15')]);}})[_0x9a57('0x17')](function(_0x2237e1){logger['error'](_0x9a57('0x10'),_0x17b3bd,_0x2237e1);_0xd36570(_0x2237e1);});});} \ No newline at end of file +var _0x6c19=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c19,0x1b4));var _0x96c1=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x6c19[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x96c1('0x0'));var util=require(_0x96c1('0x1'));var moment=require('moment');var BPromise=require(_0x96c1('0x2'));var rs=require(_0x96c1('0x3'));var fs=require('fs');var Redis=require(_0x96c1('0x4'));var db=require(_0x96c1('0x5'))['db'];var utils=require(_0x96c1('0x6'));var logger=require(_0x96c1('0x7'))(_0x96c1('0x8'));var config=require(_0x96c1('0x9'));var jayson=require(_0x96c1('0xa'));var client=jayson[_0x96c1('0xb')][_0x96c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbf92c0,_0x5cb4df,_0x2fc7cb){return new BPromise(function(_0x5b174f,_0x86d490){return client[_0x96c1('0xd')](_0xbf92c0,_0x2fc7cb)[_0x96c1('0xe')](function(_0x2da3f7){logger[_0x96c1('0xf')](_0x96c1('0x10'),_0x5cb4df,_0x96c1('0x11'));logger[_0x96c1('0x12')](_0x96c1('0x13'),_0x5cb4df,_0x96c1('0x11'),JSON[_0x96c1('0x14')](_0x2da3f7));if(_0x2da3f7[_0x96c1('0x15')]){if(_0x2da3f7[_0x96c1('0x15')][_0x96c1('0x16')]===0x1f4){logger[_0x96c1('0x15')](_0x96c1('0x10'),_0x5cb4df,_0x2da3f7['error'][_0x96c1('0x17')]);return _0x86d490(_0x2da3f7['error']['message']);}logger[_0x96c1('0x15')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5cb4df,_0x2da3f7[_0x96c1('0x15')]['message']);return _0x5b174f(_0x2da3f7[_0x96c1('0x15')][_0x96c1('0x17')]);}else{logger[_0x96c1('0xf')](_0x96c1('0x10'),_0x5cb4df,'request\x20sent');_0x5b174f(_0x2da3f7[_0x96c1('0x18')][_0x96c1('0x17')]);}})[_0x96c1('0x19')](function(_0x5b2ceb){logger[_0x96c1('0x15')](_0x96c1('0x10'),_0x5cb4df,_0x5b2ceb);_0x86d490(_0x5b2ceb);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5f8e770..ac76328 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 _0xfff9=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','getSessions','getAnswers','/:id/summary','getSummary','post','/:id/clone','clone','put','update','destroy','multer'];(function(_0x26025c,_0x188cfa){var _0x2585b9=function(_0x2df929){while(--_0x2df929){_0x26025c['push'](_0x26025c['shift']());}};_0x2585b9(++_0x188cfa);}(_0xfff9,0x1c7));var _0x9fff=function(_0x3ae38e,_0x3aaa14){_0x3ae38e=_0x3ae38e-0x0;var _0x483595=_0xfff9[_0x3ae38e];return _0x483595;};'use strict';var multer=require(_0x9fff('0x0'));var util=require(_0x9fff('0x1'));var path=require(_0x9fff('0x2'));var timeout=require(_0x9fff('0x3'));var express=require(_0x9fff('0x4'));var router=express[_0x9fff('0x5')]();var fs_extra=require(_0x9fff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9fff('0x7'));var config=require(_0x9fff('0x8'));var controller=require(_0x9fff('0x9'));router[_0x9fff('0xa')]('/',auth[_0x9fff('0xb')](),controller['index']);router[_0x9fff('0xa')](_0x9fff('0xc'),auth['isAuthenticated'](),controller[_0x9fff('0xd')]);router[_0x9fff('0xa')]('/:id/sessions',auth[_0x9fff('0xb')](),controller[_0x9fff('0xe')]);router[_0x9fff('0xa')]('/:id/answers',auth[_0x9fff('0xb')](),controller[_0x9fff('0xf')]);router[_0x9fff('0xa')](_0x9fff('0x10'),auth[_0x9fff('0xb')](),timeout('30s'),controller[_0x9fff('0x11')]);router[_0x9fff('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9fff('0x12')](_0x9fff('0x13'),auth['isAuthenticated'](),controller[_0x9fff('0x14')]);router[_0x9fff('0x15')](_0x9fff('0xc'),auth[_0x9fff('0xb')](),controller[_0x9fff('0x16')]);router['delete'](_0x9fff('0xc'),auth[_0x9fff('0xb')](),controller[_0x9fff('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1bae=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put'];(function(_0x125425,_0x4b6bab){var _0xd04dc4=function(_0x37fc01){while(--_0x37fc01){_0x125425['push'](_0x125425['shift']());}};_0xd04dc4(++_0x4b6bab);}(_0x1bae,0x109));var _0xe1ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bae[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe1ba('0x0'));var util=require(_0xe1ba('0x1'));var path=require(_0xe1ba('0x2'));var timeout=require(_0xe1ba('0x3'));var express=require(_0xe1ba('0x4'));var router=express[_0xe1ba('0x5')]();var fs_extra=require(_0xe1ba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe1ba('0x7'));var config=require(_0xe1ba('0x8'));var controller=require(_0xe1ba('0x9'));router[_0xe1ba('0xa')]('/',auth[_0xe1ba('0xb')](),controller[_0xe1ba('0xc')]);router[_0xe1ba('0xa')]('/:id',auth[_0xe1ba('0xb')](),controller['show']);router['get'](_0xe1ba('0xd'),auth[_0xe1ba('0xb')](),controller[_0xe1ba('0xe')]);router[_0xe1ba('0xa')](_0xe1ba('0xf'),auth['isAuthenticated'](),controller[_0xe1ba('0x10')]);router['get'](_0xe1ba('0x11'),auth[_0xe1ba('0xb')](),timeout(_0xe1ba('0x12')),controller[_0xe1ba('0x13')]);router[_0xe1ba('0x14')]('/',auth['isAuthenticated'](),controller[_0xe1ba('0x15')]);router[_0xe1ba('0x14')](_0xe1ba('0x16'),auth[_0xe1ba('0xb')](),controller[_0xe1ba('0x17')]);router[_0xe1ba('0x18')](_0xe1ba('0x19'),auth['isAuthenticated'](),controller[_0xe1ba('0x1a')]);router['delete'](_0xe1ba('0x19'),auth['isAuthenticated'](),controller[_0xe1ba('0x1b')]);module[_0xe1ba('0x1c')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3c5557b..9a09835 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 _0x45dd=['isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','setDataValue','formData','stringify'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x45dd,0x18a));var _0xd45d=function(_0x53d7fc,_0x12f4b2){_0x53d7fc=_0x53d7fc-0x0;var _0x1af118=_0x45dd[_0x53d7fc];return _0x1af118;};'use strict';var Sequelize=require(_0xd45d('0x0'));var _=require('lodash');var util=require(_0xd45d('0x1'));module[_0xd45d('0x2')]={'name':{'type':Sequelize[_0xd45d('0x3')],'unique':_0xd45d('0x4')},'description':{'type':Sequelize[_0xd45d('0x3')]},'formData':{'type':Sequelize[_0xd45d('0x5')]('long'),'set':function(_0x523a55){if(_['isObjectLike'](_0x523a55)){this[_0xd45d('0x6')](_0xd45d('0x7'),JSON[_0xd45d('0x8')](_0x523a55));}else if(_[_0xd45d('0x9')](_0x523a55)){this[_0xd45d('0x6')]('formData',_0x523a55);}else{this[_0xd45d('0x6')](_0xd45d('0x7'),util['format'](_0xd45d('0xa'),this['getDataValue'](_0xd45d('0x4'))||'',this[_0xd45d('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd45d('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x7501=['util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash'];(function(_0x4772e0,_0x1072a2){var _0x8797f0=function(_0x24d04f){while(--_0x24d04f){_0x4772e0['push'](_0x4772e0['shift']());}};_0x8797f0(++_0x1072a2);}(_0x7501,0x6f));var _0x1750=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7501[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1750('0x0'));var util=require(_0x1750('0x1'));module[_0x1750('0x2')]={'name':{'type':Sequelize[_0x1750('0x3')],'unique':_0x1750('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x1750('0x5')](_0x1750('0x6')),'set':function(_0x26899b){if(_[_0x1750('0x7')](_0x26899b)){this[_0x1750('0x8')](_0x1750('0x9'),JSON[_0x1750('0xa')](_0x26899b));}else if(_[_0x1750('0xb')](_0x26899b)){this['setDataValue'](_0x1750('0x9'),_0x26899b);}else{this[_0x1750('0x8')](_0x1750('0x9'),util['format'](_0x1750('0xc'),this['getDataValue']('name')||'',this[_0x1750('0xd')](_0x1750('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1750('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1750('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 5c6326e..aab78fe 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 _0x065e=['update','then','destroy','UserProfileResource','error','name','send','index','map','JscriptyProject','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','autoAssociation','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','parse','startTime','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x065e,0x1a7));var _0xe065=function(_0x4d80f4,_0x5d05be){_0x4d80f4=_0x4d80f4-0x0;var _0x54a78b=_0x065e[_0x4d80f4];return _0x54a78b;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='Projects';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x4f')]=function(_0x1ea568,_0xe77af6){var _0x2f0ed5={'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}},_0x43480d={};_0x43480d['model']=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x2f0ed5[_0xe065('0x31')]=_['intersection'](_0x43480d[_0xe065('0x30')],qs[_0xe065('0x32')](_0x1ea568[_0xe065('0x2d')][_0xe065('0x32')]));_0x2f0ed5['attributes']=_0x2f0ed5[_0xe065('0x31')][_0xe065('0x33')]?_0x2f0ed5[_0xe065('0x31')]:_0x43480d['model'];if(_0x1ea568[_0xe065('0x2d')][_0xe065('0x3d')]){_0x2f0ed5[_0xe065('0x3e')]=[{'all':!![]}];}_0x2f0ed5=_[_0xe065('0x3b')]({},_0x2f0ed5,_0x1ea568[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x2f0ed5)[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](function(_0x5ec6fe){if(_0x5ec6fe){var _0x2accad=_0x5ec6fe['get']({'plain':!![]});_0x2accad=qs[_0xe065('0x50')](_0x2accad,['id',_0xe065('0x51'),_0xe065('0x52')]);_0x1ea568['body']=_['omit'](_0x1ea568['body'],['id',_0xe065('0x51'),_0xe065('0x52')]);return db[_0xe065('0x2a')][_0xe065('0x46')](_[_0xe065('0x3b')](_0x2accad,_0x1ea568[_0xe065('0x53')]),{'include':_0x1ea568[_0xe065('0x2d')][_0xe065('0x3d')]?[{'all':!![]}]:undefined})[_0xe065('0x22')](function(_0x3169fa){var _0x25ec8a=_0x1ea568['user']['get']({'plain':!![]});if(!_0x25ec8a)throw new Error(_0xe065('0x49'));if(_0x25ec8a[_0xe065('0x4a')]==='user'){var _0x276c17=_0x3169fa['get']({'plain':!![]});var _0x4f4dca=_0xe065('0x4b');return db[_0xe065('0x4c')][_0xe065('0x45')]({'where':{'name':_0x4f4dca,'userProfileId':_0x25ec8a[_0xe065('0x54')]},'raw':!![]})[_0xe065('0x22')](function(_0x817baf){if(_0x817baf&&_0x817baf[_0xe065('0x55')]===0x0){return db['UserProfileResource'][_0xe065('0x46')]({'name':_0x276c17[_0xe065('0x26')],'resourceId':_0x276c17['id'],'type':_0x817baf[_0xe065('0x26')],'sectionId':_0x817baf['id']},{})[_0xe065('0x22')](function(){return _0x3169fa;});}else{return _0x3169fa;}})[_0xe065('0x4d')](function(_0x4f35a6){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x4f35a6);throw _0x4f35a6;});}return _0x3169fa;});}})[_0xe065('0x22')](respondWithResult(_0xe77af6,0xc9))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x21')]=function(_0xfce2e,_0x5af9d5){if(_0xfce2e['body']['id']){delete _0xfce2e['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0xfce2e[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x5af9d5,null))[_0xe065('0x22')](saveUpdates(_0xfce2e[_0xe065('0x53')],null))[_0xe065('0x22')](respondWithResult(_0x5af9d5,null))[_0xe065('0x4d')](handleError(_0x5af9d5,null));};exports[_0xe065('0x23')]=function(_0x4084a0,_0x507fd2){return db['JscriptyProject'][_0xe065('0x45')]({'where':{'id':_0x4084a0[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x507fd2,null))['then'](removeEntity(_0x507fd2,null))[_0xe065('0x4d')](handleError(_0x507fd2,null));};exports[_0xe065('0x56')]=function(_0x113a0f,_0x4765a0,_0x136e40){var _0x2c0b2e={'raw':!![],'where':{}};var _0xac5395={};var _0x199ca3={'count':0x0,'rows':[]};return db[_0xe065('0x2a')][_0xe065('0x57')]({'where':{'id':_0x113a0f[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x4765a0,null))[_0xe065('0x22')](function(_0xc0ebe8){if(_0xc0ebe8){_0xac5395[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x58')][_0xe065('0x44')]);_0xac5395['query']=_[_0xe065('0x43')](_0x113a0f[_0xe065('0x2d')]);_0xac5395[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0xac5395[_0xe065('0x30')],_0xac5395[_0xe065('0x2d')]);_0x2c0b2e[_0xe065('0x31')]=_[_0xe065('0x2f')](_0xac5395[_0xe065('0x30')],qs[_0xe065('0x32')](_0x113a0f[_0xe065('0x2d')][_0xe065('0x32')]));_0x2c0b2e[_0xe065('0x31')]=_0x2c0b2e[_0xe065('0x31')][_0xe065('0x33')]?_0x2c0b2e[_0xe065('0x31')]:_0xac5395[_0xe065('0x30')];if(!_0x113a0f['query'][_0xe065('0x34')](_0xe065('0x35'))){_0x2c0b2e[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x113a0f[_0xe065('0x2d')][_0xe065('0x1b')]);_0x2c0b2e[_0xe065('0x1a')]=qs[_0xe065('0x1a')](_0x113a0f[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x2c0b2e['order']=qs['sort'](_0x113a0f[_0xe065('0x2d')]['sort']);_0x2c0b2e[_0xe065('0x3a')]=qs['filters'](_[_0xe065('0x38')](_0x113a0f[_0xe065('0x2d')],_0xac5395[_0xe065('0x2e')]));_0x2c0b2e[_0xe065('0x3a')][_0xe065('0x59')]=_0xc0ebe8['id'];if(_0x113a0f[_0xe065('0x2d')][_0xe065('0x39')]){_0x2c0b2e[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x2c0b2e['where'],{'$or':_[_0xe065('0x29')](_0x2c0b2e[_0xe065('0x31')],function(_0x134d0a){var _0x3f8e32={};_0x3f8e32[_0x134d0a]={'$like':'%'+_0x113a0f['query'][_0xe065('0x39')]+'%'};return _0x3f8e32;})});}_0x2c0b2e=_[_0xe065('0x3b')]({},_0x2c0b2e,_0x113a0f[_0xe065('0x3c')]);return db['JscriptySessionReport'][_0xe065('0x1d')]({'where':_0x2c0b2e[_0xe065('0x3a')]})[_0xe065('0x22')](function(_0x52f0ac){_0x199ca3[_0xe065('0x1d')]=_0x52f0ac;if(_0x113a0f[_0xe065('0x2d')]['includeAll']){_0x2c0b2e['include']=[{'all':!![]}];}return db[_0xe065('0x58')][_0xe065('0x3f')](_0x2c0b2e);})[_0xe065('0x22')](function(_0x3f3878){_0x199ca3[_0xe065('0x40')]=_0x3f3878;return _0x199ca3;});}})['then'](respondWithFilteredResult(_0x4765a0,_0x2c0b2e))['catch'](handleError(_0x4765a0,null));};exports[_0xe065('0x5a')]=function(_0x1263f7,_0x4bed1d,_0x13e0ed){var _0xb32a44={'raw':!![],'where':{}};var _0x3d9fe8={};var _0x3251df={'count':0x0,'rows':[]};return db[_0xe065('0x2a')][_0xe065('0x57')]({'where':{'id':_0x1263f7[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x4bed1d,null))[_0xe065('0x22')](function(_0x1ec81f){if(_0x1ec81f){_0x3d9fe8['model']=_['keys'](db[_0xe065('0x5b')][_0xe065('0x44')]);_0x3d9fe8[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x1263f7[_0xe065('0x2d')]);_0x3d9fe8['filters']=_[_0xe065('0x2f')](_0x3d9fe8[_0xe065('0x30')],_0x3d9fe8[_0xe065('0x2d')]);_0xb32a44[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x3d9fe8[_0xe065('0x30')],qs[_0xe065('0x32')](_0x1263f7[_0xe065('0x2d')][_0xe065('0x32')]));_0xb32a44[_0xe065('0x31')]=_0xb32a44[_0xe065('0x31')]['length']?_0xb32a44[_0xe065('0x31')]:_0x3d9fe8[_0xe065('0x30')];if(!_0x1263f7[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0xb32a44[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x1263f7[_0xe065('0x2d')][_0xe065('0x1b')]);_0xb32a44[_0xe065('0x1a')]=qs[_0xe065('0x1a')](_0x1263f7[_0xe065('0x2d')]['offset']);}_0xb32a44[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x1263f7[_0xe065('0x2d')][_0xe065('0x37')]);_0xb32a44[_0xe065('0x3a')]=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x1263f7[_0xe065('0x2d')],_0x3d9fe8[_0xe065('0x2e')]));_0xb32a44[_0xe065('0x3a')][_0xe065('0x59')]=_0x1ec81f['id'];if(_0x1263f7[_0xe065('0x2d')][_0xe065('0x39')]){_0xb32a44[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0xb32a44[_0xe065('0x3a')],{'$or':_[_0xe065('0x29')](_0xb32a44[_0xe065('0x31')],function(_0x105eaa){var _0x2052fb={};_0x2052fb[_0x105eaa]={'$like':'%'+_0x1263f7[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x2052fb;})});}_0xb32a44=_[_0xe065('0x3b')]({},_0xb32a44,_0x1263f7[_0xe065('0x3c')]);return db[_0xe065('0x5b')][_0xe065('0x1d')]({'where':_0xb32a44[_0xe065('0x3a')]})[_0xe065('0x22')](function(_0x3a53a4){_0x3251df[_0xe065('0x1d')]=_0x3a53a4;if(_0x1263f7[_0xe065('0x2d')][_0xe065('0x3d')]){_0xb32a44[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x5b')][_0xe065('0x3f')](_0xb32a44);})[_0xe065('0x22')](function(_0x23f071){_0x3251df[_0xe065('0x40')]=_0x23f071;return _0x3251df;});}})[_0xe065('0x22')](respondWithFilteredResult(_0x4bed1d,_0xb32a44))[_0xe065('0x4d')](handleError(_0x4bed1d,null));};function char(_0x4da03f){return _0xe065('0x5c')===typeof _0x4da03f?String[_0xe065('0x5d')][_0xe065('0x5e')](null,arguments):_0x4da03f;}function needsEncapsulation(_0xe199d7){return!!_0xe199d7&&(_0xe199d7[_0xe065('0x5f')]()[_0xe065('0x60')](char(0xd))>=0x0||_0xe199d7[_0xe065('0x5f')]()[_0xe065('0x60')](char(0xa))>=0x0||_0xe199d7['toString']()[_0xe065('0x60')](char(0x2c))>=0x0||_0xe199d7['toString']()[_0xe065('0x60')](char(0x22))>=0x0);}function encapsulate(_0x550c0b){var _0x110f5e=char(0x22),_0x1fed2d='\x5c'+char(0x22),_0x19e3cf=_0x550c0b[_0xe065('0x5f')]()['replace'](new RegExp(_0x110f5e,'g'),_0x1fed2d);return _0x110f5e+_0x19e3cf+_0x110f5e;}exports['getSummary']=function(_0x27606f,_0x40431a,_0x40fe42){var _0x47c3f8,_0x2b7964;var _0x32d7af={'where':{'ProjectId':_0x27606f[_0xe065('0x42')]['id']}};if(_0x27606f['query']['startTime']){_0x32d7af['where']['starttime']=JSON[_0xe065('0x61')](_0x27606f[_0xe065('0x2d')][_0xe065('0x62')]);}return db[_0xe065('0x58')][_0xe065('0x3f')](_0x32d7af)['then'](handleEntityNotFound(_0x40431a,null))[_0xe065('0x22')](function(_0xa524d8){if(_0xa524d8){_0x47c3f8=_0xa524d8;return db['JscriptyQuestionReport'][_0xe065('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x47c3f8,'id')},'ProjectId':_0x27606f[_0xe065('0x42')]['id']},'order':'-createdAt'});}})[_0xe065('0x22')](handleEntityNotFound(_0x40431a,null))[_0xe065('0x22')](function(_0xde5ead){if(_0xde5ead){_0x2b7964=_0xde5ead;var _0x2c1d4c={};for(var _0x201009=0x0,_0x24a944=_0x2b7964[_0xe065('0x33')];_0x201009<_0x24a944;_0x201009++){if(!_0x2c1d4c[_0xe065('0x34')](_0x2b7964[_0x201009][_0xe065('0x63')])){_0x2c1d4c[_0x2b7964[_0x201009][_0xe065('0x63')]]=needsEncapsulation(_0x2b7964[_0x201009][_0xe065('0x64')])?encapsulate(_0x2b7964[_0x201009][_0xe065('0x64')]):_0x2b7964[_0x201009][_0xe065('0x64')];}}var _0x168fd8=[],_0x518683={};for(var _0x4e98f8=0x0,_0x3709ea=_0x47c3f8[_0xe065('0x33')];_0x4e98f8<_0x3709ea;_0x4e98f8++){_0x518683={'ProjectId':_0x27606f['params']['id'],'SessionId':_0x47c3f8[_0x4e98f8]['id'],'StartTime':moment(_0x47c3f8[_0x4e98f8][_0xe065('0x65')])[_0xe065('0x66')](_0xe065('0x67'))};for(var _0x18271d=0x0,_0x368b31=_0x2b7964[_0xe065('0x33')];_0x18271d<_0x368b31;_0x18271d++){if(_0x2b7964[_0x18271d][_0xe065('0x68')]==_0x47c3f8[_0x4e98f8]['id']&&_0x2c1d4c['hasOwnProperty'](_0x2b7964[_0x18271d]['questionId'])){_0x518683[_0x2c1d4c[_0x2b7964[_0x18271d][_0xe065('0x63')]]]=_0x2b7964[_0x18271d][_0xe065('0x69')];}}for(var _0x343413 in _0x2c1d4c){if(!_0x518683[_0xe065('0x34')](_0x2c1d4c[_0x343413])){_0x518683[_0x2c1d4c[_0x343413]]=null;}}_0x168fd8['push'](_0x518683);}return _0x168fd8;}})[_0xe065('0x22')](function(_0x33f41c){if(!_[_0xe065('0x6a')](_0x33f41c)){var _0x444ef8=toCsv(_0x33f41c);var _0x30ff95=Date[_0xe065('0x6b')]();fs['writeFileSync'](util[_0xe065('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x27606f['params']['id'],_0x30ff95),_0x444ef8);_0x40431a[_0xe065('0x6c')](_0xe065('0x6d'),_0xe065('0x6e')+util[_0xe065('0x66')]('Jscripty_Project_%d_Summary_%s.csv',_0x27606f[_0xe065('0x42')]['id'],_0x30ff95));_0x40431a[_0xe065('0x6c')]('Content-type',_0xe065('0x6f'));return _0x40431a[_0xe065('0x70')](util[_0xe065('0x66')](_0xe065('0x71'),_0x27606f[_0xe065('0x42')]['id'],_0x30ff95));}else{return _0x40431a['sendStatus'](0xcc);}})[_0xe065('0x4d')](handleError(_0x40431a,null));}; \ No newline at end of file +var _0x4628=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Projects','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','pick','where','VIRTUAL','filter','merge','options','JscriptyProject','include','rows','params','fields','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','UserProfileSection','findOne','nolimit','order','sort','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','text/csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis'];(function(_0x5561e8,_0x4a5fd3){var _0x56d3bc=function(_0x617385){while(--_0x617385){_0x5561e8['push'](_0x5561e8['shift']());}};_0x56d3bc(++_0x4a5fd3);}(_0x4628,0xd3));var _0x8462=function(_0x398832,_0x3f0efb){_0x398832=_0x398832-0x0;var _0x29e357=_0x4628[_0x398832];return _0x29e357;};'use strict';var emlformat=require(_0x8462('0x0'));var rimraf=require(_0x8462('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8462('0x2'));var rp=require(_0x8462('0x3'));var moment=require(_0x8462('0x4'));var BPromise=require(_0x8462('0x5'));var Mustache=require(_0x8462('0x6'));var util=require('util');var path=require(_0x8462('0x7'));var sox=require(_0x8462('0x8'));var csv=require(_0x8462('0x9'));var ejs=require(_0x8462('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8462('0xb'));var squel=require('squel');var crypto=require(_0x8462('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8462('0xd'));var toCsv=require(_0x8462('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8462('0xe'));var authService=require(_0x8462('0xf'));var qs=require(_0x8462('0x10'));var as=require(_0x8462('0x11'));var hardwareService=require(_0x8462('0x12'));var logger=require(_0x8462('0x13'))('api');var utils=require(_0x8462('0x14'));var config=require(_0x8462('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8462('0x16'))['db'];function respondWithStatusCode(_0x53877d,_0x54a0ff){_0x54a0ff=_0x54a0ff||0xcc;return function(_0x56cca2){if(_0x56cca2){return _0x53877d[_0x8462('0x17')](_0x54a0ff);}return _0x53877d[_0x8462('0x18')](_0x54a0ff)[_0x8462('0x19')]();};}function respondWithResult(_0x57be34,_0x2afbf5){_0x2afbf5=_0x2afbf5||0xc8;return function(_0x14cbd2){if(_0x14cbd2){return _0x57be34[_0x8462('0x18')](_0x2afbf5)[_0x8462('0x1a')](_0x14cbd2);}};}function respondWithFilteredResult(_0x4e6a68,_0x3be4b8){return function(_0x3a19a9){if(_0x3a19a9){var _0x4f3824=typeof _0x3be4b8[_0x8462('0x1b')]===_0x8462('0x1c')&&typeof _0x3be4b8[_0x8462('0x1d')]===_0x8462('0x1c');var _0x49ef1f=_0x3a19a9[_0x8462('0x1e')];var _0x1f5d3e=_0x4f3824?0x0:_0x3be4b8[_0x8462('0x1b')];var _0x105897=_0x4f3824?_0x3a19a9[_0x8462('0x1e')]:_0x3be4b8['offset']+_0x3be4b8['limit'];var _0xf1686c;if(_0x105897>=_0x49ef1f){_0x105897=_0x49ef1f;_0xf1686c=0xc8;}else{_0xf1686c=0xce;}_0x4e6a68[_0x8462('0x18')](_0xf1686c);return _0x4e6a68[_0x8462('0x1f')](_0x8462('0x20'),_0x1f5d3e+'-'+_0x105897+'/'+_0x49ef1f)['json'](_0x3a19a9);}return null;};}function patchUpdates(_0x490dcb){return function(_0xad863d){try{jsonpatch[_0x8462('0x21')](_0xad863d,_0x490dcb,!![]);}catch(_0x2714f1){return BPromise[_0x8462('0x22')](_0x2714f1);}return _0xad863d[_0x8462('0x23')]();};}function saveUpdates(_0x5d64ea,_0x22d1c0){return function(_0x5446b7){if(_0x5446b7){return _0x5446b7['update'](_0x5d64ea)['then'](function(_0x567805){return _0x567805;});}return null;};}function removeEntity(_0x3a09f1,_0x9f0860){return function(_0x3a26bf){if(_0x3a26bf){return _0x3a26bf[_0x8462('0x24')]()[_0x8462('0x25')](function(){var _0x3c3cfb=_0x3a26bf[_0x8462('0x26')]({'plain':!![]});var _0x5ca724=_0x8462('0x27');return db[_0x8462('0x28')][_0x8462('0x24')]({'where':{'type':_0x5ca724,'resourceId':_0x3c3cfb['id']}})[_0x8462('0x25')](function(){return _0x3a26bf;});})[_0x8462('0x25')](function(){_0x3a09f1[_0x8462('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e50a0,_0x593681){return function(_0x3c9d95){if(!_0x3c9d95){_0x5e50a0[_0x8462('0x17')](0x194);}return _0x3c9d95;};}function handleError(_0x5efacd,_0x1eac49){_0x1eac49=_0x1eac49||0x1f4;return function(_0x3e4e30){logger[_0x8462('0x29')](_0x3e4e30[_0x8462('0x2a')]);if(_0x3e4e30['name']){delete _0x3e4e30[_0x8462('0x2b')];}_0x5efacd['status'](_0x1eac49)[_0x8462('0x2c')](_0x3e4e30);};}exports['index']=function(_0x4541c8,_0x52d278){var _0x5994f0={},_0x11cab6={},_0x45efda={'count':0x0,'rows':[]};var _0x397535=_[_0x8462('0x2d')](db['JscriptyProject'][_0x8462('0x2e')],function(_0x321435){return{'name':_0x321435[_0x8462('0x2f')],'type':_0x321435['type'][_0x8462('0x30')]};});_0x11cab6[_0x8462('0x31')]=_['map'](_0x397535,_0x8462('0x2b'));_0x11cab6[_0x8462('0x32')]=_[_0x8462('0x33')](_0x4541c8[_0x8462('0x32')]);_0x11cab6[_0x8462('0x34')]=_[_0x8462('0x35')](_0x11cab6[_0x8462('0x31')],_0x11cab6[_0x8462('0x32')]);_0x5994f0['attributes']=_[_0x8462('0x35')](_0x11cab6[_0x8462('0x31')],qs['fields'](_0x4541c8[_0x8462('0x32')]['fields']));_0x5994f0[_0x8462('0x36')]=_0x5994f0['attributes'][_0x8462('0x37')]?_0x5994f0[_0x8462('0x36')]:_0x11cab6[_0x8462('0x31')];if(!_0x4541c8[_0x8462('0x32')][_0x8462('0x38')]('nolimit')){_0x5994f0[_0x8462('0x1d')]=qs[_0x8462('0x1d')](_0x4541c8[_0x8462('0x32')]['limit']);_0x5994f0[_0x8462('0x1b')]=qs[_0x8462('0x1b')](_0x4541c8['query'][_0x8462('0x1b')]);}_0x5994f0['order']=qs['sort'](_0x4541c8[_0x8462('0x32')]['sort']);_0x5994f0['where']=qs[_0x8462('0x34')](_[_0x8462('0x39')](_0x4541c8[_0x8462('0x32')],_0x11cab6['filters']),_0x397535);if(_0x4541c8[_0x8462('0x32')]['filter']){_0x5994f0[_0x8462('0x3a')]=_['merge'](_0x5994f0[_0x8462('0x3a')],{'$or':_[_0x8462('0x2d')](_0x397535,function(_0xf2a600){if(_0xf2a600['type']!==_0x8462('0x3b')){var _0x180d6b={};_0x180d6b[_0xf2a600[_0x8462('0x2b')]]={'$like':'%'+_0x4541c8[_0x8462('0x32')][_0x8462('0x3c')]+'%'};return _0x180d6b;}})});}_0x5994f0=_[_0x8462('0x3d')]({},_0x5994f0,_0x4541c8[_0x8462('0x3e')]);var _0x43c247={'where':_0x5994f0[_0x8462('0x3a')]};return db[_0x8462('0x3f')][_0x8462('0x1e')](_0x43c247)[_0x8462('0x25')](function(_0x459c6c){_0x45efda[_0x8462('0x1e')]=_0x459c6c;if(_0x4541c8['query']['includeAll']){_0x5994f0[_0x8462('0x40')]=[{'all':!![]}];}return db[_0x8462('0x3f')]['findAll'](_0x5994f0);})[_0x8462('0x25')](function(_0xfa0916){_0x45efda[_0x8462('0x41')]=_0xfa0916;return _0x45efda;})[_0x8462('0x25')](respondWithFilteredResult(_0x52d278,_0x5994f0))['catch'](handleError(_0x52d278,null));};exports['show']=function(_0x228239,_0x359961){var _0x734f2a={'raw':![],'where':{'id':_0x228239[_0x8462('0x42')]['id']}},_0x347d3b={};_0x347d3b[_0x8462('0x31')]=_[_0x8462('0x33')](db['JscriptyProject']['rawAttributes']);_0x347d3b[_0x8462('0x32')]=_['keys'](_0x228239['query']);_0x347d3b['filters']=_[_0x8462('0x35')](_0x347d3b[_0x8462('0x31')],_0x347d3b[_0x8462('0x32')]);_0x734f2a[_0x8462('0x36')]=_[_0x8462('0x35')](_0x347d3b[_0x8462('0x31')],qs[_0x8462('0x43')](_0x228239['query']['fields']));_0x734f2a[_0x8462('0x36')]=_0x734f2a['attributes']['length']?_0x734f2a[_0x8462('0x36')]:_0x347d3b['model'];if(_0x228239['query'][_0x8462('0x44')]){_0x734f2a[_0x8462('0x40')]=[{'all':!![]}];}_0x734f2a=_[_0x8462('0x3d')]({},_0x734f2a,_0x228239[_0x8462('0x3e')]);return db[_0x8462('0x3f')][_0x8462('0x45')](_0x734f2a)[_0x8462('0x25')](handleEntityNotFound(_0x359961,null))[_0x8462('0x25')](respondWithResult(_0x359961,null))[_0x8462('0x46')](handleError(_0x359961,null));};exports['create']=function(_0x362eb9,_0x23f4a2){return db['JscriptyProject'][_0x8462('0x47')](_0x362eb9[_0x8462('0x48')],{})[_0x8462('0x25')](function(_0x11cf22){var _0x4d3a2f=_0x362eb9['user'][_0x8462('0x26')]({'plain':!![]});if(!_0x4d3a2f)throw new Error(_0x8462('0x49'));if(_0x4d3a2f[_0x8462('0x4a')]===_0x8462('0x4b')){var _0x45abbc=_0x11cf22[_0x8462('0x26')]({'plain':!![]});var _0x1f8777=_0x8462('0x27');return db['UserProfileSection'][_0x8462('0x45')]({'where':{'name':_0x1f8777,'userProfileId':_0x4d3a2f[_0x8462('0x4c')]},'raw':!![]})['then'](function(_0x5bc102){if(_0x5bc102&&_0x5bc102[_0x8462('0x4d')]===0x0){return db[_0x8462('0x28')][_0x8462('0x47')]({'name':_0x45abbc[_0x8462('0x2b')],'resourceId':_0x45abbc['id'],'type':_0x5bc102[_0x8462('0x2b')],'sectionId':_0x5bc102['id']},{})[_0x8462('0x25')](function(){return _0x11cf22;});}else{return _0x11cf22;}})[_0x8462('0x46')](function(_0x21d43e){logger[_0x8462('0x29')](_0x8462('0x4e'),_0x21d43e);throw _0x21d43e;});}return _0x11cf22;})[_0x8462('0x25')](respondWithResult(_0x23f4a2,0xc9))['catch'](handleError(_0x23f4a2,null));};exports[_0x8462('0x4f')]=function(_0x550f77,_0x52f3cb){var _0x232537={'where':{'id':_0x550f77['params']['id']}},_0x43bdf5={};_0x43bdf5[_0x8462('0x31')]=_['keys'](db[_0x8462('0x3f')][_0x8462('0x2e')]);_0x232537[_0x8462('0x36')]=_[_0x8462('0x35')](_0x43bdf5[_0x8462('0x31')],qs['fields'](_0x550f77[_0x8462('0x32')][_0x8462('0x43')]));_0x232537[_0x8462('0x36')]=_0x232537['attributes']['length']?_0x232537['attributes']:_0x43bdf5[_0x8462('0x31')];if(_0x550f77[_0x8462('0x32')][_0x8462('0x44')]){_0x232537[_0x8462('0x40')]=[{'all':!![]}];}_0x232537=_['merge']({},_0x232537,_0x550f77[_0x8462('0x3e')]);return db[_0x8462('0x3f')][_0x8462('0x45')](_0x232537)[_0x8462('0x25')](handleEntityNotFound(_0x52f3cb,null))[_0x8462('0x25')](function(_0x51634b){if(_0x51634b){var _0x1a4a14=_0x51634b[_0x8462('0x26')]({'plain':!![]});_0x1a4a14=qs[_0x8462('0x50')](_0x1a4a14,['id','createdAt',_0x8462('0x51')]);_0x550f77[_0x8462('0x48')]=_[_0x8462('0x50')](_0x550f77[_0x8462('0x48')],['id',_0x8462('0x52'),'updatedAt']);return db['JscriptyProject']['create'](_[_0x8462('0x3d')](_0x1a4a14,_0x550f77['body']),{'include':_0x550f77['query'][_0x8462('0x44')]?[{'all':!![]}]:undefined})[_0x8462('0x25')](function(_0x40161f){var _0x3547de=_0x550f77['user'][_0x8462('0x26')]({'plain':!![]});if(!_0x3547de)throw new Error(_0x8462('0x49'));if(_0x3547de['role']==='user'){var _0x38a245=_0x40161f[_0x8462('0x26')]({'plain':!![]});var _0x9b90c3=_0x8462('0x27');return db[_0x8462('0x53')][_0x8462('0x45')]({'where':{'name':_0x9b90c3,'userProfileId':_0x3547de['userProfileId']},'raw':!![]})[_0x8462('0x25')](function(_0x333d4d){if(_0x333d4d&&_0x333d4d[_0x8462('0x4d')]===0x0){return db[_0x8462('0x28')][_0x8462('0x47')]({'name':_0x38a245[_0x8462('0x2b')],'resourceId':_0x38a245['id'],'type':_0x333d4d['name'],'sectionId':_0x333d4d['id']},{})[_0x8462('0x25')](function(){return _0x40161f;});}else{return _0x40161f;}})[_0x8462('0x46')](function(_0x497460){logger[_0x8462('0x29')](_0x8462('0x4e'),_0x497460);throw _0x497460;});}return _0x40161f;});}})['then'](respondWithResult(_0x52f3cb,0xc9))[_0x8462('0x46')](handleError(_0x52f3cb,null));};exports['update']=function(_0x1e0c7d,_0x4868d6){if(_0x1e0c7d['body']['id']){delete _0x1e0c7d[_0x8462('0x48')]['id'];}return db[_0x8462('0x3f')][_0x8462('0x45')]({'where':{'id':_0x1e0c7d['params']['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x4868d6,null))[_0x8462('0x25')](saveUpdates(_0x1e0c7d[_0x8462('0x48')],null))[_0x8462('0x25')](respondWithResult(_0x4868d6,null))['catch'](handleError(_0x4868d6,null));};exports['destroy']=function(_0x5cbe81,_0x506ef0){return db[_0x8462('0x3f')]['find']({'where':{'id':_0x5cbe81[_0x8462('0x42')]['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x506ef0,null))['then'](removeEntity(_0x506ef0,null))['catch'](handleError(_0x506ef0,null));};exports['getSessions']=function(_0x4ebbc0,_0x4f3ba6,_0x28b3c6){var _0x4a1d86={'raw':!![],'where':{}};var _0x2d1cdf={};var _0x5a7b81={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x8462('0x54')]({'where':{'id':_0x4ebbc0['params']['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x4f3ba6,null))[_0x8462('0x25')](function(_0x3df75b){if(_0x3df75b){_0x2d1cdf[_0x8462('0x31')]=_[_0x8462('0x33')](db['JscriptySessionReport'][_0x8462('0x2e')]);_0x2d1cdf[_0x8462('0x32')]=_[_0x8462('0x33')](_0x4ebbc0[_0x8462('0x32')]);_0x2d1cdf[_0x8462('0x34')]=_['intersection'](_0x2d1cdf['model'],_0x2d1cdf[_0x8462('0x32')]);_0x4a1d86['attributes']=_[_0x8462('0x35')](_0x2d1cdf['model'],qs[_0x8462('0x43')](_0x4ebbc0[_0x8462('0x32')][_0x8462('0x43')]));_0x4a1d86[_0x8462('0x36')]=_0x4a1d86[_0x8462('0x36')]['length']?_0x4a1d86['attributes']:_0x2d1cdf[_0x8462('0x31')];if(!_0x4ebbc0[_0x8462('0x32')][_0x8462('0x38')](_0x8462('0x55'))){_0x4a1d86[_0x8462('0x1d')]=qs['limit'](_0x4ebbc0[_0x8462('0x32')][_0x8462('0x1d')]);_0x4a1d86[_0x8462('0x1b')]=qs[_0x8462('0x1b')](_0x4ebbc0[_0x8462('0x32')][_0x8462('0x1b')]);}_0x4a1d86[_0x8462('0x56')]=qs[_0x8462('0x57')](_0x4ebbc0[_0x8462('0x32')]['sort']);_0x4a1d86[_0x8462('0x3a')]=qs[_0x8462('0x34')](_[_0x8462('0x39')](_0x4ebbc0['query'],_0x2d1cdf[_0x8462('0x34')]));_0x4a1d86[_0x8462('0x3a')][_0x8462('0x58')]=_0x3df75b['id'];if(_0x4ebbc0[_0x8462('0x32')]['filter']){_0x4a1d86[_0x8462('0x3a')]=_['merge'](_0x4a1d86[_0x8462('0x3a')],{'$or':_[_0x8462('0x2d')](_0x4a1d86['attributes'],function(_0x30ba22){var _0x38e00f={};_0x38e00f[_0x30ba22]={'$like':'%'+_0x4ebbc0[_0x8462('0x32')][_0x8462('0x3c')]+'%'};return _0x38e00f;})});}_0x4a1d86=_[_0x8462('0x3d')]({},_0x4a1d86,_0x4ebbc0['options']);return db[_0x8462('0x59')][_0x8462('0x1e')]({'where':_0x4a1d86[_0x8462('0x3a')]})[_0x8462('0x25')](function(_0x282223){_0x5a7b81[_0x8462('0x1e')]=_0x282223;if(_0x4ebbc0['query']['includeAll']){_0x4a1d86['include']=[{'all':!![]}];}return db[_0x8462('0x59')][_0x8462('0x5a')](_0x4a1d86);})['then'](function(_0x1fda22){_0x5a7b81['rows']=_0x1fda22;return _0x5a7b81;});}})[_0x8462('0x25')](respondWithFilteredResult(_0x4f3ba6,_0x4a1d86))[_0x8462('0x46')](handleError(_0x4f3ba6,null));};exports[_0x8462('0x5b')]=function(_0x8031c5,_0x1aa232,_0x1354e1){var _0x59c37e={'raw':!![],'where':{}};var _0x461001={};var _0x3fefdd={'count':0x0,'rows':[]};return db[_0x8462('0x3f')][_0x8462('0x54')]({'where':{'id':_0x8031c5[_0x8462('0x42')]['id']}})[_0x8462('0x25')](handleEntityNotFound(_0x1aa232,null))[_0x8462('0x25')](function(_0x63c73d){if(_0x63c73d){_0x461001['model']=_[_0x8462('0x33')](db[_0x8462('0x5c')][_0x8462('0x2e')]);_0x461001[_0x8462('0x32')]=_[_0x8462('0x33')](_0x8031c5[_0x8462('0x32')]);_0x461001['filters']=_['intersection'](_0x461001[_0x8462('0x31')],_0x461001[_0x8462('0x32')]);_0x59c37e[_0x8462('0x36')]=_['intersection'](_0x461001['model'],qs[_0x8462('0x43')](_0x8031c5[_0x8462('0x32')][_0x8462('0x43')]));_0x59c37e['attributes']=_0x59c37e['attributes'][_0x8462('0x37')]?_0x59c37e[_0x8462('0x36')]:_0x461001[_0x8462('0x31')];if(!_0x8031c5[_0x8462('0x32')][_0x8462('0x38')](_0x8462('0x55'))){_0x59c37e[_0x8462('0x1d')]=qs[_0x8462('0x1d')](_0x8031c5[_0x8462('0x32')]['limit']);_0x59c37e['offset']=qs[_0x8462('0x1b')](_0x8031c5[_0x8462('0x32')][_0x8462('0x1b')]);}_0x59c37e[_0x8462('0x56')]=qs[_0x8462('0x57')](_0x8031c5[_0x8462('0x32')][_0x8462('0x57')]);_0x59c37e[_0x8462('0x3a')]=qs[_0x8462('0x34')](_['pick'](_0x8031c5[_0x8462('0x32')],_0x461001['filters']));_0x59c37e[_0x8462('0x3a')][_0x8462('0x58')]=_0x63c73d['id'];if(_0x8031c5[_0x8462('0x32')][_0x8462('0x3c')]){_0x59c37e['where']=_[_0x8462('0x3d')](_0x59c37e[_0x8462('0x3a')],{'$or':_['map'](_0x59c37e[_0x8462('0x36')],function(_0x22307e){var _0x453e61={};_0x453e61[_0x22307e]={'$like':'%'+_0x8031c5[_0x8462('0x32')][_0x8462('0x3c')]+'%'};return _0x453e61;})});}_0x59c37e=_['merge']({},_0x59c37e,_0x8031c5['options']);return db['JscriptyAnswerReport'][_0x8462('0x1e')]({'where':_0x59c37e[_0x8462('0x3a')]})['then'](function(_0x2ca997){_0x3fefdd[_0x8462('0x1e')]=_0x2ca997;if(_0x8031c5[_0x8462('0x32')][_0x8462('0x44')]){_0x59c37e[_0x8462('0x40')]=[{'all':!![]}];}return db[_0x8462('0x5c')][_0x8462('0x5a')](_0x59c37e);})[_0x8462('0x25')](function(_0x2803e2){_0x3fefdd[_0x8462('0x41')]=_0x2803e2;return _0x3fefdd;});}})[_0x8462('0x25')](respondWithFilteredResult(_0x1aa232,_0x59c37e))[_0x8462('0x46')](handleError(_0x1aa232,null));};function char(_0x36b6fe){return _0x8462('0x5d')===typeof _0x36b6fe?String['fromCharCode'][_0x8462('0x21')](null,arguments):_0x36b6fe;}function needsEncapsulation(_0x5ab8dd){return!!_0x5ab8dd&&(_0x5ab8dd[_0x8462('0x5e')]()[_0x8462('0x5f')](char(0xd))>=0x0||_0x5ab8dd[_0x8462('0x5e')]()[_0x8462('0x5f')](char(0xa))>=0x0||_0x5ab8dd['toString']()['indexOf'](char(0x2c))>=0x0||_0x5ab8dd[_0x8462('0x5e')]()[_0x8462('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x2c617d){var _0x1d8ca8=char(0x22),_0x43f789='\x5c'+char(0x22),_0x1cc019=_0x2c617d['toString']()[_0x8462('0x60')](new RegExp(_0x1d8ca8,'g'),_0x43f789);return _0x1d8ca8+_0x1cc019+_0x1d8ca8;}exports[_0x8462('0x61')]=function(_0x357273,_0x4165bc,_0x1f4273){var _0x4410de,_0x425207;var _0x2b5b3a={'where':{'ProjectId':_0x357273[_0x8462('0x42')]['id']}};if(_0x357273[_0x8462('0x32')][_0x8462('0x62')]){_0x2b5b3a[_0x8462('0x3a')]['starttime']=JSON[_0x8462('0x63')](_0x357273[_0x8462('0x32')]['startTime']);}return db[_0x8462('0x59')][_0x8462('0x5a')](_0x2b5b3a)[_0x8462('0x25')](handleEntityNotFound(_0x4165bc,null))[_0x8462('0x25')](function(_0x3d4edc){if(_0x3d4edc){_0x4410de=_0x3d4edc;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x8462('0x2d')](_0x4410de,'id')},'ProjectId':_0x357273[_0x8462('0x42')]['id']},'order':'-createdAt'});}})[_0x8462('0x25')](handleEntityNotFound(_0x4165bc,null))['then'](function(_0x56bf29){if(_0x56bf29){_0x425207=_0x56bf29;var _0x57b650={};for(var _0x4c5257=0x0,_0xc4fd3a=_0x425207['length'];_0x4c5257<_0xc4fd3a;_0x4c5257++){if(!_0x57b650[_0x8462('0x38')](_0x425207[_0x4c5257][_0x8462('0x64')])){_0x57b650[_0x425207[_0x4c5257][_0x8462('0x64')]]=needsEncapsulation(_0x425207[_0x4c5257][_0x8462('0x65')])?encapsulate(_0x425207[_0x4c5257][_0x8462('0x65')]):_0x425207[_0x4c5257][_0x8462('0x65')];}}var _0xa2e61d=[],_0x29163a={};for(var _0x400b9c=0x0,_0x31c049=_0x4410de[_0x8462('0x37')];_0x400b9c<_0x31c049;_0x400b9c++){_0x29163a={'ProjectId':_0x357273['params']['id'],'SessionId':_0x4410de[_0x400b9c]['id'],'StartTime':moment(_0x4410de[_0x400b9c]['starttime'])[_0x8462('0x66')](_0x8462('0x67'))};for(var _0x1ec073=0x0,_0x4b652c=_0x425207[_0x8462('0x37')];_0x1ec073<_0x4b652c;_0x1ec073++){if(_0x425207[_0x1ec073][_0x8462('0x68')]==_0x4410de[_0x400b9c]['id']&&_0x57b650[_0x8462('0x38')](_0x425207[_0x1ec073][_0x8462('0x64')])){_0x29163a[_0x57b650[_0x425207[_0x1ec073][_0x8462('0x64')]]]=_0x425207[_0x1ec073][_0x8462('0x69')];}}for(var _0x3f1d42 in _0x57b650){if(!_0x29163a[_0x8462('0x38')](_0x57b650[_0x3f1d42])){_0x29163a[_0x57b650[_0x3f1d42]]=null;}}_0xa2e61d['push'](_0x29163a);}return _0xa2e61d;}})[_0x8462('0x25')](function(_0x2ee3c8){if(!_[_0x8462('0x6a')](_0x2ee3c8)){var _0x148813=toCsv(_0x2ee3c8);var _0x43fd01=Date[_0x8462('0x6b')]();fs[_0x8462('0x6c')](util[_0x8462('0x66')](_0x8462('0x6d'),_0x357273[_0x8462('0x42')]['id'],_0x43fd01),_0x148813);_0x4165bc['setHeader'](_0x8462('0x6e'),'attachment;\x20filename='+util[_0x8462('0x66')]('Jscripty_Project_%d_Summary_%s.csv',_0x357273[_0x8462('0x42')]['id'],_0x43fd01));_0x4165bc[_0x8462('0x6f')]('Content-type',_0x8462('0x70'));return _0x4165bc['download'](util[_0x8462('0x66')](_0x8462('0x6d'),_0x357273[_0x8462('0x42')]['id'],_0x43fd01));}else{return _0x4165bc[_0x8462('0x17')](0xcc);}})[_0x8462('0x46')](handleError(_0x4165bc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 528e3b1..323a431 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 _0xac21=['jscripty_projects','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','JscriptyProject'];(function(_0x5d2abd,_0x392912){var _0x3e013a=function(_0x5c6d62){while(--_0x5c6d62){_0x5d2abd['push'](_0x5d2abd['shift']());}};_0x3e013a(++_0x392912);}(_0xac21,0x1af));var _0x1ac2=function(_0x207cd8,_0x5db57c){_0x207cd8=_0x207cd8-0x0;var _0x1976ab=_0xac21[_0x207cd8];return _0x1976ab;};'use strict';var _=require('lodash');var util=require(_0x1ac2('0x0'));var logger=require(_0x1ac2('0x1'))('api');var moment=require(_0x1ac2('0x2'));var BPromise=require('bluebird');var rp=require(_0x1ac2('0x3'));var fs=require('fs');var path=require(_0x1ac2('0x4'));var rimraf=require('rimraf');var config=require(_0x1ac2('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x1ac2('0x6')]=function(_0x21a183,_0x2c4cf2){return _0x21a183[_0x1ac2('0x7')](_0x1ac2('0x8'),attributes,{'tableName':_0x1ac2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['path','rimraf','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x417af1,_0x1004cc){var _0xc5af59=function(_0x5c0230){while(--_0x5c0230){_0x417af1['push'](_0x417af1['shift']());}};_0xc5af59(++_0x1004cc);}(_0xb458,0x103));var _0x8b45=function(_0x4df667,_0x2d80ea){_0x4df667=_0x4df667-0x0;var _0x24ff9d=_0xb458[_0x4df667];return _0x24ff9d;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'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 c3b8e7c..86af9f2 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac4a,0x13f));var _0xaac4=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0xac4a[_0x325a08];return _0x436e01;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2528b69..4b2687a 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 _0x604b=['./jscriptyQuestionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x604b,0x113));var _0xb604=function(_0x5b926d,_0x5238de){_0x5b926d=_0x5b926d-0x0;var _0x5aef21=_0x604b[_0x5b926d];return _0x5aef21;};'use strict';var multer=require(_0xb604('0x0'));var util=require(_0xb604('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb604('0x2')]();var fs_extra=require(_0xb604('0x3'));var auth=require(_0xb604('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb604('0x5'));router[_0xb604('0x6')]('/',auth['isAuthenticated'](),controller[_0xb604('0x7')]);router[_0xb604('0x6')](_0xb604('0x8'),auth['isAuthenticated'](),controller[_0xb604('0x9')]);router['get'](_0xb604('0xa'),auth[_0xb604('0xb')](),controller[_0xb604('0xc')]);router[_0xb604('0xd')]('/',auth[_0xb604('0xb')](),controller[_0xb604('0xe')]);router[_0xb604('0xf')](_0xb604('0xa'),auth[_0xb604('0xb')](),controller[_0xb604('0x10')]);router[_0xb604('0x11')]('/:id',auth[_0xb604('0xb')](),controller[_0xb604('0x12')]);module[_0xb604('0x13')]=router; \ No newline at end of file +var _0x1aaf=['put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x19456c,_0x19912e){var _0xab98ef=function(_0x3dfa57){while(--_0x3dfa57){_0x19456c['push'](_0x19456c['shift']());}};_0xab98ef(++_0x19912e);}(_0x1aaf,0x16c));var _0xf1aa=function(_0x2f0e89,_0x2161ca){_0x2f0e89=_0x2f0e89-0x0;var _0x3df90e=_0x1aaf[_0x2f0e89];return _0x3df90e;};'use strict';var multer=require('multer');var util=require(_0xf1aa('0x0'));var path=require(_0xf1aa('0x1'));var timeout=require('connect-timeout');var express=require(_0xf1aa('0x2'));var router=express['Router']();var fs_extra=require(_0xf1aa('0x3'));var auth=require(_0xf1aa('0x4'));var interaction=require(_0xf1aa('0x5'));var config=require(_0xf1aa('0x6'));var controller=require(_0xf1aa('0x7'));router[_0xf1aa('0x8')]('/',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0xa')]);router['get'](_0xf1aa('0xb'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0xc')]);router[_0xf1aa('0x8')](_0xf1aa('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf1aa('0xe')]('/',auth['isAuthenticated'](),controller[_0xf1aa('0xf')]);router[_0xf1aa('0x10')](_0xf1aa('0xd'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x11')]);router[_0xf1aa('0x12')](_0xf1aa('0xd'),auth[_0xf1aa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 78fd543..fda503f 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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x4c08f6,_0x1dc4c7){_0x4c08f6=_0x4c08f6-0x0;var _0x52f9a7=_0x7a54[_0x4c08f6];return _0x52f9a7;};'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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x1ee059,_0x490d88){_0x1ee059=_0x1ee059-0x0;var _0x1b6bda=_0x7a54[_0x1ee059];return _0x1b6bda;};'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 1acd6c9..b746eb4 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 _0xf4cf=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4e27bb,_0x2d3f33){var _0x32794f=function(_0x1d0b43){while(--_0x1d0b43){_0x4e27bb['push'](_0x4e27bb['shift']());}};_0x32794f(++_0x2d3f33);}(_0xf4cf,0x15c));var _0xff4c=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xf4cf[_0x363ef8];return _0x148822;};'use strict';var emlformat=require(_0xff4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff4c('0x1'));var jsonpatch=require(_0xff4c('0x2'));var rp=require('request-promise');var moment=require(_0xff4c('0x3'));var BPromise=require(_0xff4c('0x4'));var Mustache=require(_0xff4c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xff4c('0x6'));var csv=require(_0xff4c('0x7'));var ejs=require(_0xff4c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff4c('0x9'));var squel=require(_0xff4c('0xa'));var crypto=require(_0xff4c('0xb'));var jsforce=require(_0xff4c('0xc'));var deskjs=require(_0xff4c('0xd'));var toCsv=require(_0xff4c('0x7'));var querystring=require(_0xff4c('0xe'));var Papa=require(_0xff4c('0xf'));var Redis=require(_0xff4c('0x10'));var authService=require(_0xff4c('0x11'));var qs=require(_0xff4c('0x12'));var as=require(_0xff4c('0x13'));var hardwareService=require(_0xff4c('0x14'));var logger=require(_0xff4c('0x15'))(_0xff4c('0x16'));var utils=require(_0xff4c('0x17'));var config=require(_0xff4c('0x18'));var licenseUtil=require(_0xff4c('0x19'));var db=require(_0xff4c('0x1a'))['db'];function respondWithStatusCode(_0x140c2a,_0x1b4c9c){_0x1b4c9c=_0x1b4c9c||0xcc;return function(_0x42c1ad){if(_0x42c1ad){return _0x140c2a[_0xff4c('0x1b')](_0x1b4c9c);}return _0x140c2a['status'](_0x1b4c9c)['end']();};}function respondWithResult(_0x4c1c70,_0x53186a){_0x53186a=_0x53186a||0xc8;return function(_0x5743b6){if(_0x5743b6){return _0x4c1c70[_0xff4c('0x1c')](_0x53186a)[_0xff4c('0x1d')](_0x5743b6);}};}function respondWithFilteredResult(_0xbf5957,_0x3058b3){return function(_0x41e8af){if(_0x41e8af){var _0x1e8c41=typeof _0x3058b3[_0xff4c('0x1e')]===_0xff4c('0x1f')&&typeof _0x3058b3[_0xff4c('0x20')]===_0xff4c('0x1f');var _0x4f8717=_0x41e8af[_0xff4c('0x21')];var _0x5ba6fc=_0x1e8c41?0x0:_0x3058b3[_0xff4c('0x1e')];var _0x7dce81=_0x1e8c41?_0x41e8af[_0xff4c('0x21')]:_0x3058b3[_0xff4c('0x1e')]+_0x3058b3[_0xff4c('0x20')];var _0x2229e7;if(_0x7dce81>=_0x4f8717){_0x7dce81=_0x4f8717;_0x2229e7=0xc8;}else{_0x2229e7=0xce;}_0xbf5957['status'](_0x2229e7);return _0xbf5957[_0xff4c('0x22')]('Content-Range',_0x5ba6fc+'-'+_0x7dce81+'/'+_0x4f8717)[_0xff4c('0x1d')](_0x41e8af);}return null;};}function patchUpdates(_0x13a07e){return function(_0x7f677a){try{jsonpatch[_0xff4c('0x23')](_0x7f677a,_0x13a07e,!![]);}catch(_0x1132d6){return BPromise['reject'](_0x1132d6);}return _0x7f677a[_0xff4c('0x24')]();};}function saveUpdates(_0x568c47,_0x4850c8){return function(_0x485497){if(_0x485497){return _0x485497[_0xff4c('0x25')](_0x568c47)[_0xff4c('0x26')](function(_0x2dffd4){return _0x2dffd4;});}return null;};}function removeEntity(_0x16a612,_0x555c73){return function(_0x5a227e){if(_0x5a227e){return _0x5a227e[_0xff4c('0x27')]()[_0xff4c('0x26')](function(){_0x16a612['status'](0xcc)[_0xff4c('0x28')]();});}};}function handleEntityNotFound(_0x2d4647,_0x243270){return function(_0x31b76f){if(!_0x31b76f){_0x2d4647['sendStatus'](0x194);}return _0x31b76f;};}function handleError(_0x415053,_0x2c902b){_0x2c902b=_0x2c902b||0x1f4;return function(_0x1f4719){logger[_0xff4c('0x29')](_0x1f4719[_0xff4c('0x2a')]);if(_0x1f4719[_0xff4c('0x2b')]){delete _0x1f4719[_0xff4c('0x2b')];}_0x415053[_0xff4c('0x1c')](_0x2c902b)[_0xff4c('0x2c')](_0x1f4719);};}exports[_0xff4c('0x2d')]=function(_0x115321,_0xa7af){var _0x382781={},_0x2074f7={},_0x5e9488={'count':0x0,'rows':[]};var _0x15ce37=_[_0xff4c('0x2e')](db[_0xff4c('0x2f')][_0xff4c('0x30')],function(_0x2c9621){return{'name':_0x2c9621['fieldName'],'type':_0x2c9621[_0xff4c('0x31')]['key']};});_0x2074f7[_0xff4c('0x32')]=_[_0xff4c('0x2e')](_0x15ce37,_0xff4c('0x2b'));_0x2074f7[_0xff4c('0x33')]=_[_0xff4c('0x34')](_0x115321['query']);_0x2074f7[_0xff4c('0x35')]=_[_0xff4c('0x36')](_0x2074f7[_0xff4c('0x32')],_0x2074f7[_0xff4c('0x33')]);_0x382781[_0xff4c('0x37')]=_['intersection'](_0x2074f7['model'],qs[_0xff4c('0x38')](_0x115321['query'][_0xff4c('0x38')]));_0x382781[_0xff4c('0x37')]=_0x382781[_0xff4c('0x37')][_0xff4c('0x39')]?_0x382781[_0xff4c('0x37')]:_0x2074f7[_0xff4c('0x32')];if(!_0x115321[_0xff4c('0x33')]['hasOwnProperty'](_0xff4c('0x3a'))){_0x382781[_0xff4c('0x20')]=qs['limit'](_0x115321[_0xff4c('0x33')][_0xff4c('0x20')]);_0x382781[_0xff4c('0x1e')]=qs['offset'](_0x115321[_0xff4c('0x33')][_0xff4c('0x1e')]);}_0x382781['order']=qs[_0xff4c('0x3b')](_0x115321[_0xff4c('0x33')][_0xff4c('0x3b')]);_0x382781[_0xff4c('0x3c')]=qs[_0xff4c('0x35')](_['pick'](_0x115321[_0xff4c('0x33')],_0x2074f7[_0xff4c('0x35')]),_0x15ce37);if(_0x115321[_0xff4c('0x33')]['filter']){_0x382781['where']=_[_0xff4c('0x3d')](_0x382781[_0xff4c('0x3c')],{'$or':_[_0xff4c('0x2e')](_0x15ce37,function(_0x1228f9){if(_0x1228f9[_0xff4c('0x31')]!==_0xff4c('0x3e')){var _0x3f23cc={};_0x3f23cc[_0x1228f9[_0xff4c('0x2b')]]={'$like':'%'+_0x115321[_0xff4c('0x33')][_0xff4c('0x3f')]+'%'};return _0x3f23cc;}})});}_0x382781=_['merge']({},_0x382781,_0x115321['options']);var _0x391a2a={'where':_0x382781['where']};return db[_0xff4c('0x2f')][_0xff4c('0x21')](_0x391a2a)[_0xff4c('0x26')](function(_0x3e2861){_0x5e9488['count']=_0x3e2861;if(_0x115321[_0xff4c('0x33')][_0xff4c('0x40')]){_0x382781[_0xff4c('0x41')]=[{'all':!![]}];}return db[_0xff4c('0x2f')][_0xff4c('0x42')](_0x382781);})[_0xff4c('0x26')](function(_0xca6ae0){_0x5e9488['rows']=_0xca6ae0;return _0x5e9488;})[_0xff4c('0x26')](respondWithFilteredResult(_0xa7af,_0x382781))[_0xff4c('0x43')](handleError(_0xa7af,null));};exports[_0xff4c('0x44')]=function(_0x4b27d6,_0x89c106){var _0x389cb6={'raw':!![],'where':{'id':_0x4b27d6[_0xff4c('0x45')]['id']}},_0x2a41f9={};_0x2a41f9[_0xff4c('0x32')]=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x2a41f9[_0xff4c('0x33')]=_['keys'](_0x4b27d6[_0xff4c('0x33')]);_0x2a41f9['filters']=_[_0xff4c('0x36')](_0x2a41f9[_0xff4c('0x32')],_0x2a41f9[_0xff4c('0x33')]);_0x389cb6[_0xff4c('0x37')]=_[_0xff4c('0x36')](_0x2a41f9[_0xff4c('0x32')],qs['fields'](_0x4b27d6[_0xff4c('0x33')]['fields']));_0x389cb6['attributes']=_0x389cb6[_0xff4c('0x37')]['length']?_0x389cb6['attributes']:_0x2a41f9[_0xff4c('0x32')];if(_0x4b27d6[_0xff4c('0x33')][_0xff4c('0x40')]){_0x389cb6[_0xff4c('0x41')]=[{'all':!![]}];}_0x389cb6=_[_0xff4c('0x3d')]({},_0x389cb6,_0x4b27d6['options']);return db['JscriptyQuestionReport']['find'](_0x389cb6)[_0xff4c('0x26')](handleEntityNotFound(_0x89c106,null))[_0xff4c('0x26')](respondWithResult(_0x89c106,null))[_0xff4c('0x43')](handleError(_0x89c106,null));};exports['create']=function(_0x45c82a,_0x518511){return db[_0xff4c('0x2f')][_0xff4c('0x46')](_0x45c82a[_0xff4c('0x47')],{})[_0xff4c('0x26')](respondWithResult(_0x518511,0xc9))[_0xff4c('0x43')](handleError(_0x518511,null));};exports['update']=function(_0x44dbce,_0x30b19f){if(_0x44dbce[_0xff4c('0x47')]['id']){delete _0x44dbce[_0xff4c('0x47')]['id'];}return db[_0xff4c('0x2f')][_0xff4c('0x48')]({'where':{'id':_0x44dbce[_0xff4c('0x45')]['id']}})[_0xff4c('0x26')](handleEntityNotFound(_0x30b19f,null))[_0xff4c('0x26')](saveUpdates(_0x44dbce[_0xff4c('0x47')],null))[_0xff4c('0x26')](respondWithResult(_0x30b19f,null))['catch'](handleError(_0x30b19f,null));};exports[_0xff4c('0x27')]=function(_0x1677f9,_0x193310){return db[_0xff4c('0x2f')][_0xff4c('0x48')]({'where':{'id':_0x1677f9[_0xff4c('0x45')]['id']}})['then'](handleEntityNotFound(_0x193310,null))[_0xff4c('0x26')](removeEntity(_0x193310,null))[_0xff4c('0x43')](handleError(_0x193310,null));};exports[_0xff4c('0x49')]=function(_0x12360d,_0xe989b2){return db[_0xff4c('0x2f')][_0xff4c('0x49')]()[_0xff4c('0x26')](respondWithResult(_0xe989b2,null))[_0xff4c('0x43')](handleError(_0xe989b2,null));}; \ No newline at end of file +var _0x7797=['set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','keys','length','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','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','end','undefined','count','offset'];(function(_0x5c5d0c,_0x5892ef){var _0x51b085=function(_0x2d5175){while(--_0x2d5175){_0x5c5d0c['push'](_0x5c5d0c['shift']());}};_0x51b085(++_0x5892ef);}(_0x7797,0x10b));var _0x7779=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x7797[_0x329d13];return _0x33efd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7779('0x0'));var zipdir=require(_0x7779('0x1'));var jsonpatch=require(_0x7779('0x2'));var rp=require(_0x7779('0x3'));var moment=require(_0x7779('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7779('0x5'));var util=require(_0x7779('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7779('0x7'));var ejs=require(_0x7779('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7779('0x9'));var squel=require(_0x7779('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7779('0xb'));var toCsv=require(_0x7779('0x7'));var querystring=require(_0x7779('0xc'));var Papa=require(_0x7779('0xd'));var Redis=require(_0x7779('0xe'));var authService=require(_0x7779('0xf'));var qs=require(_0x7779('0x10'));var as=require(_0x7779('0x11'));var hardwareService=require(_0x7779('0x12'));var logger=require('../../config/logger')(_0x7779('0x13'));var utils=require('../../config/utils');var config=require(_0x7779('0x14'));var licenseUtil=require(_0x7779('0x15'));var db=require(_0x7779('0x16'))['db'];function respondWithStatusCode(_0x148060,_0x1bf3e8){_0x1bf3e8=_0x1bf3e8||0xcc;return function(_0x195009){if(_0x195009){return _0x148060[_0x7779('0x17')](_0x1bf3e8);}return _0x148060[_0x7779('0x18')](_0x1bf3e8)[_0x7779('0x19')]();};}function respondWithResult(_0x3f011a,_0x5a3d0a){_0x5a3d0a=_0x5a3d0a||0xc8;return function(_0x46601a){if(_0x46601a){return _0x3f011a[_0x7779('0x18')](_0x5a3d0a)['json'](_0x46601a);}};}function respondWithFilteredResult(_0x664bd6,_0x33c564){return function(_0x113512){if(_0x113512){var _0xadf7d=typeof _0x33c564['offset']===_0x7779('0x1a')&&typeof _0x33c564['limit']===_0x7779('0x1a');var _0x1ad687=_0x113512[_0x7779('0x1b')];var _0x3a1462=_0xadf7d?0x0:_0x33c564[_0x7779('0x1c')];var _0x369207=_0xadf7d?_0x113512[_0x7779('0x1b')]:_0x33c564[_0x7779('0x1c')]+_0x33c564['limit'];var _0x3c279e;if(_0x369207>=_0x1ad687){_0x369207=_0x1ad687;_0x3c279e=0xc8;}else{_0x3c279e=0xce;}_0x664bd6[_0x7779('0x18')](_0x3c279e);return _0x664bd6[_0x7779('0x1d')]('Content-Range',_0x3a1462+'-'+_0x369207+'/'+_0x1ad687)[_0x7779('0x1e')](_0x113512);}return null;};}function patchUpdates(_0x2ddbb4){return function(_0x5687e5){try{jsonpatch[_0x7779('0x1f')](_0x5687e5,_0x2ddbb4,!![]);}catch(_0x4c5d8d){return BPromise[_0x7779('0x20')](_0x4c5d8d);}return _0x5687e5['save']();};}function saveUpdates(_0x4e2d61,_0x336901){return function(_0xb1c1bd){if(_0xb1c1bd){return _0xb1c1bd[_0x7779('0x21')](_0x4e2d61)[_0x7779('0x22')](function(_0xd35d20){return _0xd35d20;});}return null;};}function removeEntity(_0xeaf90a,_0x2a6014){return function(_0x164ec2){if(_0x164ec2){return _0x164ec2[_0x7779('0x23')]()['then'](function(){_0xeaf90a[_0x7779('0x18')](0xcc)[_0x7779('0x19')]();});}};}function handleEntityNotFound(_0xbc0f31,_0x28bb92){return function(_0x4b1f9f){if(!_0x4b1f9f){_0xbc0f31[_0x7779('0x17')](0x194);}return _0x4b1f9f;};}function handleError(_0x51a40d,_0x1c58c2){_0x1c58c2=_0x1c58c2||0x1f4;return function(_0x564f99){logger[_0x7779('0x24')](_0x564f99[_0x7779('0x25')]);if(_0x564f99[_0x7779('0x26')]){delete _0x564f99['name'];}_0x51a40d[_0x7779('0x18')](_0x1c58c2)[_0x7779('0x27')](_0x564f99);};}exports[_0x7779('0x28')]=function(_0x255202,_0x540186){var _0x25f7b4={},_0x54c68e={},_0x80e806={'count':0x0,'rows':[]};var _0x3e3b27=_[_0x7779('0x29')](db['JscriptyQuestionReport'][_0x7779('0x2a')],function(_0x130203){return{'name':_0x130203['fieldName'],'type':_0x130203[_0x7779('0x2b')]['key']};});_0x54c68e[_0x7779('0x2c')]=_[_0x7779('0x29')](_0x3e3b27,_0x7779('0x26'));_0x54c68e[_0x7779('0x2d')]=_['keys'](_0x255202[_0x7779('0x2d')]);_0x54c68e['filters']=_[_0x7779('0x2e')](_0x54c68e['model'],_0x54c68e[_0x7779('0x2d')]);_0x25f7b4[_0x7779('0x2f')]=_[_0x7779('0x2e')](_0x54c68e[_0x7779('0x2c')],qs[_0x7779('0x30')](_0x255202['query'][_0x7779('0x30')]));_0x25f7b4['attributes']=_0x25f7b4['attributes']['length']?_0x25f7b4[_0x7779('0x2f')]:_0x54c68e[_0x7779('0x2c')];if(!_0x255202[_0x7779('0x2d')][_0x7779('0x31')](_0x7779('0x32'))){_0x25f7b4[_0x7779('0x33')]=qs[_0x7779('0x33')](_0x255202[_0x7779('0x2d')][_0x7779('0x33')]);_0x25f7b4['offset']=qs[_0x7779('0x1c')](_0x255202['query'][_0x7779('0x1c')]);}_0x25f7b4[_0x7779('0x34')]=qs['sort'](_0x255202[_0x7779('0x2d')][_0x7779('0x35')]);_0x25f7b4['where']=qs[_0x7779('0x36')](_[_0x7779('0x37')](_0x255202[_0x7779('0x2d')],_0x54c68e['filters']),_0x3e3b27);if(_0x255202[_0x7779('0x2d')][_0x7779('0x38')]){_0x25f7b4[_0x7779('0x39')]=_[_0x7779('0x3a')](_0x25f7b4[_0x7779('0x39')],{'$or':_[_0x7779('0x29')](_0x3e3b27,function(_0x2f3479){if(_0x2f3479[_0x7779('0x2b')]!==_0x7779('0x3b')){var _0x9a1990={};_0x9a1990[_0x2f3479[_0x7779('0x26')]]={'$like':'%'+_0x255202[_0x7779('0x2d')][_0x7779('0x38')]+'%'};return _0x9a1990;}})});}_0x25f7b4=_['merge']({},_0x25f7b4,_0x255202[_0x7779('0x3c')]);var _0x31eac1={'where':_0x25f7b4[_0x7779('0x39')]};return db[_0x7779('0x3d')][_0x7779('0x1b')](_0x31eac1)[_0x7779('0x22')](function(_0x2fdb72){_0x80e806[_0x7779('0x1b')]=_0x2fdb72;if(_0x255202['query'][_0x7779('0x3e')]){_0x25f7b4[_0x7779('0x3f')]=[{'all':!![]}];}return db[_0x7779('0x3d')][_0x7779('0x40')](_0x25f7b4);})[_0x7779('0x22')](function(_0xb97a99){_0x80e806[_0x7779('0x41')]=_0xb97a99;return _0x80e806;})[_0x7779('0x22')](respondWithFilteredResult(_0x540186,_0x25f7b4))[_0x7779('0x42')](handleError(_0x540186,null));};exports['show']=function(_0x1530b4,_0x2a9239){var _0x66ac4f={'raw':!![],'where':{'id':_0x1530b4['params']['id']}},_0x4efe7f={};_0x4efe7f[_0x7779('0x2c')]=_[_0x7779('0x43')](db[_0x7779('0x3d')][_0x7779('0x2a')]);_0x4efe7f['query']=_[_0x7779('0x43')](_0x1530b4[_0x7779('0x2d')]);_0x4efe7f[_0x7779('0x36')]=_[_0x7779('0x2e')](_0x4efe7f[_0x7779('0x2c')],_0x4efe7f['query']);_0x66ac4f['attributes']=_[_0x7779('0x2e')](_0x4efe7f[_0x7779('0x2c')],qs['fields'](_0x1530b4['query'][_0x7779('0x30')]));_0x66ac4f[_0x7779('0x2f')]=_0x66ac4f[_0x7779('0x2f')][_0x7779('0x44')]?_0x66ac4f[_0x7779('0x2f')]:_0x4efe7f[_0x7779('0x2c')];if(_0x1530b4[_0x7779('0x2d')][_0x7779('0x3e')]){_0x66ac4f[_0x7779('0x3f')]=[{'all':!![]}];}_0x66ac4f=_[_0x7779('0x3a')]({},_0x66ac4f,_0x1530b4['options']);return db[_0x7779('0x3d')][_0x7779('0x45')](_0x66ac4f)['then'](handleEntityNotFound(_0x2a9239,null))[_0x7779('0x22')](respondWithResult(_0x2a9239,null))['catch'](handleError(_0x2a9239,null));};exports[_0x7779('0x46')]=function(_0x968a80,_0xbebe13){return db['JscriptyQuestionReport'][_0x7779('0x46')](_0x968a80['body'],{})[_0x7779('0x22')](respondWithResult(_0xbebe13,0xc9))[_0x7779('0x42')](handleError(_0xbebe13,null));};exports[_0x7779('0x21')]=function(_0x4bd448,_0x3e38ea){if(_0x4bd448[_0x7779('0x47')]['id']){delete _0x4bd448[_0x7779('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x7779('0x45')]({'where':{'id':_0x4bd448['params']['id']}})[_0x7779('0x22')](handleEntityNotFound(_0x3e38ea,null))[_0x7779('0x22')](saveUpdates(_0x4bd448[_0x7779('0x47')],null))['then'](respondWithResult(_0x3e38ea,null))[_0x7779('0x42')](handleError(_0x3e38ea,null));};exports[_0x7779('0x23')]=function(_0x3101a8,_0xe2cbc9){return db['JscriptyQuestionReport'][_0x7779('0x45')]({'where':{'id':_0x3101a8[_0x7779('0x48')]['id']}})[_0x7779('0x22')](handleEntityNotFound(_0xe2cbc9,null))[_0x7779('0x22')](removeEntity(_0xe2cbc9,null))['catch'](handleError(_0xe2cbc9,null));};exports[_0x7779('0x49')]=function(_0x3b63ff,_0x57ed65){return db['JscriptyQuestionReport'][_0x7779('0x49')]()[_0x7779('0x22')](respondWithResult(_0x57ed65,null))['catch'](handleError(_0x57ed65,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7ece4b5..48bcd7a 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 _0xc869=['moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api'];(function(_0x2a3916,_0x8eac87){var _0x5cc816=function(_0x1cd3df){while(--_0x1cd3df){_0x2a3916['push'](_0x2a3916['shift']());}};_0x5cc816(++_0x8eac87);}(_0xc869,0x164));var _0x9c86=function(_0x229802,_0x2b8aa7){_0x229802=_0x229802-0x0;var _0x1f507d=_0xc869[_0x229802];return _0x1f507d;};'use strict';var _=require(_0x9c86('0x0'));var util=require(_0x9c86('0x1'));var logger=require(_0x9c86('0x2'))(_0x9c86('0x3'));var moment=require(_0x9c86('0x4'));var BPromise=require('bluebird');var rp=require(_0x9c86('0x5'));var fs=require('fs');var path=require(_0x9c86('0x6'));var rimraf=require(_0x9c86('0x7'));var config=require(_0x9c86('0x8'));var attributes=require(_0x9c86('0x9'));module['exports']=function(_0x1225d6,_0x5aa445){return _0x1225d6['define'](_0x9c86('0xa'),attributes,{'tableName':_0x9c86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef2=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x495de6,_0x3797c1){var _0x5a352f=function(_0x153049){while(--_0x153049){_0x495de6['push'](_0x495de6['shift']());}};_0x5a352f(++_0x3797c1);}(_0x7ef2,0xa4));var _0x27ef=function(_0xe3daf0,_0x53621c){_0xe3daf0=_0xe3daf0-0x0;var _0x415597=_0x7ef2[_0xe3daf0];return _0x415597;};'use strict';var _=require(_0x27ef('0x0'));var util=require('util');var logger=require(_0x27ef('0x1'))('api');var moment=require(_0x27ef('0x2'));var BPromise=require(_0x27ef('0x3'));var rp=require(_0x27ef('0x4'));var fs=require('fs');var path=require(_0x27ef('0x5'));var rimraf=require(_0x27ef('0x6'));var config=require(_0x27ef('0x7'));var attributes=require(_0x27ef('0x8'));module[_0x27ef('0x9')]=function(_0x3239b4,_0x3d1cb7){return _0x3239b4[_0x27ef('0xa')](_0x27ef('0xb'),attributes,{'tableName':_0x27ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 4db625b..0f231c9 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 _0x3855=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','jayson/promise','then','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3855,0x178));var _0x5385=function(_0x50ed5f,_0x2f1599){_0x50ed5f=_0x50ed5f-0x0;var _0x349def=_0x3855[_0x50ed5f];return _0x349def;};'use strict';var _=require(_0x5385('0x0'));var util=require('util');var moment=require(_0x5385('0x1'));var BPromise=require(_0x5385('0x2'));var rs=require(_0x5385('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5385('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5385('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8e4c,_0x577e48,_0x17e225){return new BPromise(function(_0x4f2e2f,_0x45e350){return client['request'](_0x1b8e4c,_0x17e225)[_0x5385('0x6')](function(_0x101e73){logger[_0x5385('0x7')](_0x5385('0x8'),_0x577e48,_0x5385('0x9'));logger[_0x5385('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x577e48,_0x5385('0x9'),JSON['stringify'](_0x101e73));if(_0x101e73[_0x5385('0xb')]){if(_0x101e73[_0x5385('0xb')][_0x5385('0xc')]===0x1f4){logger[_0x5385('0xb')](_0x5385('0x8'),_0x577e48,_0x101e73[_0x5385('0xb')]['message']);return _0x45e350(_0x101e73[_0x5385('0xb')]['message']);}logger[_0x5385('0xb')](_0x5385('0x8'),_0x577e48,_0x101e73[_0x5385('0xb')][_0x5385('0xd')]);return _0x4f2e2f(_0x101e73['error'][_0x5385('0xd')]);}else{logger[_0x5385('0x7')](_0x5385('0x8'),_0x577e48,_0x5385('0x9'));_0x4f2e2f(_0x101e73[_0x5385('0xe')][_0x5385('0xd')]);}})[_0x5385('0xf')](function(_0x4bee31){logger[_0x5385('0xb')](_0x5385('0x8'),_0x577e48,_0x4bee31);_0x45e350(_0x4bee31);});});} \ No newline at end of file +var _0x7f3a=['client','http','then','info','debug','request\x20sent','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4b1936,_0x42bbd5){var _0x5ee8ce=function(_0x8c00c5){while(--_0x8c00c5){_0x4b1936['push'](_0x4b1936['shift']());}};_0x5ee8ce(++_0x42bbd5);}(_0x7f3a,0xee));var _0xa7f3=function(_0x4497b6,_0x38403a){_0x4497b6=_0x4497b6-0x0;var _0x2641a2=_0x7f3a[_0x4497b6];return _0x2641a2;};'use strict';var _=require(_0xa7f3('0x0'));var util=require('util');var moment=require(_0xa7f3('0x1'));var BPromise=require(_0xa7f3('0x2'));var rs=require(_0xa7f3('0x3'));var fs=require('fs');var Redis=require(_0xa7f3('0x4'));var db=require(_0xa7f3('0x5'))['db'];var utils=require(_0xa7f3('0x6'));var logger=require(_0xa7f3('0x7'))('rpc');var config=require(_0xa7f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa7f3('0x9')][_0xa7f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26c99d,_0x2cad2c,_0x20386e){return new BPromise(function(_0x37eb15,_0x341e01){return client['request'](_0x26c99d,_0x20386e)[_0xa7f3('0xb')](function(_0x3f4589){logger[_0xa7f3('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cad2c,'request\x20sent');logger[_0xa7f3('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2cad2c,_0xa7f3('0xe'),JSON[_0xa7f3('0xf')](_0x3f4589));if(_0x3f4589['error']){if(_0x3f4589['error']['code']===0x1f4){logger[_0xa7f3('0x10')](_0xa7f3('0x11'),_0x2cad2c,_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);return _0x341e01(_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);}logger[_0xa7f3('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cad2c,_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);return _0x37eb15(_0x3f4589[_0xa7f3('0x10')][_0xa7f3('0x12')]);}else{logger[_0xa7f3('0xc')](_0xa7f3('0x11'),_0x2cad2c,_0xa7f3('0xe'));_0x37eb15(_0x3f4589['result']['message']);}})['catch'](function(_0x35470d){logger[_0xa7f3('0x10')](_0xa7f3('0x11'),_0x2cad2c,_0x35470d);_0x341e01(_0x35470d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 73cb4bf..ca55b87 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 _0xf131=['isAuthenticated','/:id','/:id/questions','getQuestions','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe'];(function(_0x140ee3,_0x405c93){var _0x270a5e=function(_0x25b606){while(--_0x25b606){_0x140ee3['push'](_0x140ee3['shift']());}};_0x270a5e(++_0x405c93);}(_0xf131,0x1c2));var _0x1f13=function(_0x2c9652,_0x44717d){_0x2c9652=_0x2c9652-0x0;var _0x188472=_0xf131[_0x2c9652];return _0x188472;};'use strict';var multer=require(_0x1f13('0x0'));var util=require(_0x1f13('0x1'));var path=require('path');var timeout=require(_0x1f13('0x2'));var express=require(_0x1f13('0x3'));var router=express[_0x1f13('0x4')]();var fs_extra=require(_0x1f13('0x5'));var auth=require(_0x1f13('0x6'));var interaction=require(_0x1f13('0x7'));var config=require(_0x1f13('0x8'));var controller=require(_0x1f13('0x9'));router[_0x1f13('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f13('0xa')](_0x1f13('0xb'),auth[_0x1f13('0xc')](),controller['describe']);router[_0x1f13('0xa')](_0x1f13('0xd'),auth[_0x1f13('0xc')](),controller['show']);router[_0x1f13('0xa')](_0x1f13('0xe'),auth[_0x1f13('0xc')](),controller[_0x1f13('0xf')]);router[_0x1f13('0x10')]('/',auth[_0x1f13('0xc')](),controller[_0x1f13('0x11')]);router[_0x1f13('0x12')](_0x1f13('0xd'),auth[_0x1f13('0xc')](),controller[_0x1f13('0x13')]);router[_0x1f13('0x14')](_0x1f13('0xd'),auth[_0x1f13('0xc')](),controller['destroy']);module[_0x1f13('0x15')]=router; \ No newline at end of file +var _0x934d=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','delete'];(function(_0x4e025b,_0x1301d3){var _0x217a0a=function(_0x73d2e6){while(--_0x73d2e6){_0x4e025b['push'](_0x4e025b['shift']());}};_0x217a0a(++_0x1301d3);}(_0x934d,0x182));var _0xd934=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x934d[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xd934('0x0'));var util=require(_0xd934('0x1'));var path=require(_0xd934('0x2'));var timeout=require(_0xd934('0x3'));var express=require(_0xd934('0x4'));var router=express[_0xd934('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd934('0x6'));var interaction=require(_0xd934('0x7'));var config=require(_0xd934('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xd934('0x9')]('/',auth['isAuthenticated'](),controller[_0xd934('0xa')]);router[_0xd934('0x9')](_0xd934('0xb'),auth[_0xd934('0xc')](),controller[_0xd934('0xd')]);router[_0xd934('0x9')](_0xd934('0xe'),auth[_0xd934('0xc')](),controller[_0xd934('0xf')]);router['get'](_0xd934('0x10'),auth['isAuthenticated'](),controller[_0xd934('0x11')]);router[_0xd934('0x12')]('/',auth[_0xd934('0xc')](),controller[_0xd934('0x13')]);router[_0xd934('0x14')](_0xd934('0xe'),auth[_0xd934('0xc')](),controller['update']);router[_0xd934('0x15')](_0xd934('0xe'),auth[_0xd934('0xc')](),controller[_0xd934('0x16')]);module[_0xd934('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f9517f9..c7d9fea 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 _0xff29=['STRING','moment','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xf62928,_0x436352){var _0x3e7c1a=function(_0x421c92){while(--_0x421c92){_0xf62928['push'](_0xf62928['shift']());}};_0x3e7c1a(++_0x436352);}(_0xff29,0x1d5));var _0x9ff2=function(_0x5103c0,_0x1da0ef){_0x5103c0=_0x5103c0-0x0;var _0x2bb17e=_0xff29[_0x5103c0];return _0x2bb17e;};'use strict';var moment=require(_0x9ff2('0x0'));var Sequelize=require('sequelize');module[_0x9ff2('0x1')]={'starttime':{'type':Sequelize[_0x9ff2('0x2')],'set':function(_0x40cd09){this[_0x9ff2('0x3')](_0x9ff2('0x4'),_0x40cd09);this[_0x9ff2('0x3')](_0x9ff2('0x5'),moment()[_0x9ff2('0x6')](_0x9ff2('0x7')));}},'endtime':{'type':Sequelize[_0x9ff2('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9ff2('0x8')]},'uniqueid':{'type':Sequelize[_0x9ff2('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9ff2('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2c65=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','endtime'];(function(_0x344c07,_0x25d8fb){var _0x4afd1b=function(_0x9cc65){while(--_0x9cc65){_0x344c07['push'](_0x344c07['shift']());}};_0x4afd1b(++_0x25d8fb);}(_0x2c65,0xca));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x52c6('0x0'));module[_0x52c6('0x1')]={'starttime':{'type':Sequelize[_0x52c6('0x2')],'set':function(_0x637d90){this[_0x52c6('0x3')]('starttime',_0x637d90);this[_0x52c6('0x3')](_0x52c6('0x4'),moment()[_0x52c6('0x5')](_0x52c6('0x6')));}},'endtime':{'type':Sequelize[_0x52c6('0x2')]},'membername':{'type':Sequelize[_0x52c6('0x7')]},'projectname':{'type':Sequelize[_0x52c6('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x52c6('0x7')]},'calleridname':{'type':Sequelize[_0x52c6('0x7')]},'calleridnum':{'type':Sequelize[_0x52c6('0x7')]},'completed':{'type':Sequelize[_0x52c6('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 a5d0fa3..6f648c2 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 _0xdbf6=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','end','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0xdbf6,0x134));var _0x6dbf=function(_0x4aa5b5,_0x5dfd70){_0x4aa5b5=_0x4aa5b5-0x0;var _0x537028=_0xdbf6[_0x4aa5b5];return _0x537028;};'use strict';var emlformat=require(_0x6dbf('0x0'));var rimraf=require(_0x6dbf('0x1'));var zipdir=require(_0x6dbf('0x2'));var jsonpatch=require(_0x6dbf('0x3'));var rp=require(_0x6dbf('0x4'));var moment=require(_0x6dbf('0x5'));var BPromise=require(_0x6dbf('0x6'));var Mustache=require(_0x6dbf('0x7'));var util=require(_0x6dbf('0x8'));var path=require(_0x6dbf('0x9'));var sox=require('sox');var csv=require(_0x6dbf('0xa'));var ejs=require(_0x6dbf('0xb'));var fs=require('fs');var fs_extra=require(_0x6dbf('0xc'));var _=require(_0x6dbf('0xd'));var squel=require('squel');var crypto=require(_0x6dbf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6dbf('0xf'));var toCsv=require(_0x6dbf('0xa'));var querystring=require(_0x6dbf('0x10'));var Papa=require(_0x6dbf('0x11'));var Redis=require(_0x6dbf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6dbf('0x13'));var as=require(_0x6dbf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dbf('0x15'))(_0x6dbf('0x16'));var utils=require(_0x6dbf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6dbf('0x18'));var db=require(_0x6dbf('0x19'))['db'];function respondWithStatusCode(_0xc91d54,_0x4b866c){_0x4b866c=_0x4b866c||0xcc;return function(_0x35c394){if(_0x35c394){return _0xc91d54[_0x6dbf('0x1a')](_0x4b866c);}return _0xc91d54[_0x6dbf('0x1b')](_0x4b866c)['end']();};}function respondWithResult(_0x59a7ed,_0x5a74f0){_0x5a74f0=_0x5a74f0||0xc8;return function(_0x5e3284){if(_0x5e3284){return _0x59a7ed[_0x6dbf('0x1b')](_0x5a74f0)['json'](_0x5e3284);}};}function respondWithFilteredResult(_0x2d324d,_0x5171d7){return function(_0x50cdc6){if(_0x50cdc6){var _0x212eff=typeof _0x5171d7['offset']===_0x6dbf('0x1c')&&typeof _0x5171d7[_0x6dbf('0x1d')]===_0x6dbf('0x1c');var _0x92d995=_0x50cdc6[_0x6dbf('0x1e')];var _0x2980ea=_0x212eff?0x0:_0x5171d7[_0x6dbf('0x1f')];var _0x5ba7a4=_0x212eff?_0x50cdc6[_0x6dbf('0x1e')]:_0x5171d7[_0x6dbf('0x1f')]+_0x5171d7[_0x6dbf('0x1d')];var _0x4a7f13;if(_0x5ba7a4>=_0x92d995){_0x5ba7a4=_0x92d995;_0x4a7f13=0xc8;}else{_0x4a7f13=0xce;}_0x2d324d[_0x6dbf('0x1b')](_0x4a7f13);return _0x2d324d[_0x6dbf('0x20')](_0x6dbf('0x21'),_0x2980ea+'-'+_0x5ba7a4+'/'+_0x92d995)[_0x6dbf('0x22')](_0x50cdc6);}return null;};}function patchUpdates(_0x1e36b7){return function(_0x5298c4){try{jsonpatch[_0x6dbf('0x23')](_0x5298c4,_0x1e36b7,!![]);}catch(_0x27e324){return BPromise['reject'](_0x27e324);}return _0x5298c4[_0x6dbf('0x24')]();};}function saveUpdates(_0x4dc2f6,_0x2bdf75){return function(_0x3d9d77){if(_0x3d9d77){return _0x3d9d77[_0x6dbf('0x25')](_0x4dc2f6)['then'](function(_0x4f3c4d){return _0x4f3c4d;});}return null;};}function removeEntity(_0xe17a20,_0x481f45){return function(_0x574f11){if(_0x574f11){return _0x574f11[_0x6dbf('0x26')]()[_0x6dbf('0x27')](function(){_0xe17a20[_0x6dbf('0x1b')](0xcc)[_0x6dbf('0x28')]();});}};}function handleEntityNotFound(_0x42f023,_0x5ae3c8){return function(_0xd0e0aa){if(!_0xd0e0aa){_0x42f023[_0x6dbf('0x1a')](0x194);}return _0xd0e0aa;};}function handleError(_0x3e28d2,_0x50723d){_0x50723d=_0x50723d||0x1f4;return function(_0x2eba30){logger[_0x6dbf('0x29')](_0x2eba30[_0x6dbf('0x2a')]);if(_0x2eba30[_0x6dbf('0x2b')]){delete _0x2eba30[_0x6dbf('0x2b')];}_0x3e28d2['status'](_0x50723d)[_0x6dbf('0x2c')](_0x2eba30);};}exports[_0x6dbf('0x2d')]=function(_0x28e52b,_0x14e670){var _0x57aefa={},_0x4b68b7={},_0x5477be={'count':0x0,'rows':[]};var _0x1dd557=_[_0x6dbf('0x2e')](db[_0x6dbf('0x2f')][_0x6dbf('0x30')],function(_0x556f6b){return{'name':_0x556f6b[_0x6dbf('0x31')],'type':_0x556f6b[_0x6dbf('0x32')][_0x6dbf('0x33')]};});_0x4b68b7[_0x6dbf('0x34')]=_[_0x6dbf('0x2e')](_0x1dd557,'name');_0x4b68b7['query']=_[_0x6dbf('0x35')](_0x28e52b[_0x6dbf('0x36')]);_0x4b68b7[_0x6dbf('0x37')]=_[_0x6dbf('0x38')](_0x4b68b7['model'],_0x4b68b7[_0x6dbf('0x36')]);_0x57aefa[_0x6dbf('0x39')]=_[_0x6dbf('0x38')](_0x4b68b7[_0x6dbf('0x34')],qs[_0x6dbf('0x3a')](_0x28e52b['query'][_0x6dbf('0x3a')]));_0x57aefa[_0x6dbf('0x39')]=_0x57aefa[_0x6dbf('0x39')][_0x6dbf('0x3b')]?_0x57aefa[_0x6dbf('0x39')]:_0x4b68b7[_0x6dbf('0x34')];if(!_0x28e52b['query']['hasOwnProperty'](_0x6dbf('0x3c'))){_0x57aefa[_0x6dbf('0x1d')]=qs[_0x6dbf('0x1d')](_0x28e52b[_0x6dbf('0x36')]['limit']);_0x57aefa['offset']=qs['offset'](_0x28e52b[_0x6dbf('0x36')][_0x6dbf('0x1f')]);}_0x57aefa[_0x6dbf('0x3d')]=qs[_0x6dbf('0x3e')](_0x28e52b[_0x6dbf('0x36')][_0x6dbf('0x3e')]);_0x57aefa[_0x6dbf('0x3f')]=qs[_0x6dbf('0x37')](_['pick'](_0x28e52b[_0x6dbf('0x36')],_0x4b68b7[_0x6dbf('0x37')]),_0x1dd557);if(_0x28e52b['query'][_0x6dbf('0x40')]){_0x57aefa[_0x6dbf('0x3f')]=_[_0x6dbf('0x41')](_0x57aefa['where'],{'$or':_['map'](_0x1dd557,function(_0x16a985){if(_0x16a985[_0x6dbf('0x32')]!==_0x6dbf('0x42')){var _0xa60f08={};_0xa60f08[_0x16a985[_0x6dbf('0x2b')]]={'$like':'%'+_0x28e52b[_0x6dbf('0x36')]['filter']+'%'};return _0xa60f08;}})});}_0x57aefa=_[_0x6dbf('0x41')]({},_0x57aefa,_0x28e52b[_0x6dbf('0x43')]);var _0x10eae2={'where':_0x57aefa[_0x6dbf('0x3f')]};return db[_0x6dbf('0x2f')][_0x6dbf('0x1e')](_0x10eae2)[_0x6dbf('0x27')](function(_0x304707){_0x5477be[_0x6dbf('0x1e')]=_0x304707;if(_0x28e52b[_0x6dbf('0x36')][_0x6dbf('0x44')]){_0x57aefa[_0x6dbf('0x45')]=[{'all':!![]}];}return db[_0x6dbf('0x2f')]['findAll'](_0x57aefa);})[_0x6dbf('0x27')](function(_0xe2d2e5){_0x5477be[_0x6dbf('0x46')]=_0xe2d2e5;return _0x5477be;})[_0x6dbf('0x27')](respondWithFilteredResult(_0x14e670,_0x57aefa))['catch'](handleError(_0x14e670,null));};exports['show']=function(_0x801322,_0x472ebd){var _0x2a5c5f={'raw':!![],'where':{'id':_0x801322[_0x6dbf('0x47')]['id']}},_0x53ba79={};_0x53ba79[_0x6dbf('0x34')]=_[_0x6dbf('0x35')](db[_0x6dbf('0x2f')][_0x6dbf('0x30')]);_0x53ba79[_0x6dbf('0x36')]=_[_0x6dbf('0x35')](_0x801322['query']);_0x53ba79['filters']=_[_0x6dbf('0x38')](_0x53ba79[_0x6dbf('0x34')],_0x53ba79[_0x6dbf('0x36')]);_0x2a5c5f[_0x6dbf('0x39')]=_[_0x6dbf('0x38')](_0x53ba79[_0x6dbf('0x34')],qs['fields'](_0x801322[_0x6dbf('0x36')]['fields']));_0x2a5c5f[_0x6dbf('0x39')]=_0x2a5c5f[_0x6dbf('0x39')][_0x6dbf('0x3b')]?_0x2a5c5f[_0x6dbf('0x39')]:_0x53ba79[_0x6dbf('0x34')];if(_0x801322[_0x6dbf('0x36')]['includeAll']){_0x2a5c5f[_0x6dbf('0x45')]=[{'all':!![]}];}_0x2a5c5f=_['merge']({},_0x2a5c5f,_0x801322[_0x6dbf('0x43')]);return db[_0x6dbf('0x2f')][_0x6dbf('0x48')](_0x2a5c5f)[_0x6dbf('0x27')](handleEntityNotFound(_0x472ebd,null))['then'](respondWithResult(_0x472ebd,null))[_0x6dbf('0x49')](handleError(_0x472ebd,null));};exports[_0x6dbf('0x4a')]=function(_0x5d6a2e,_0x33f677){return db[_0x6dbf('0x2f')][_0x6dbf('0x4a')](_0x5d6a2e[_0x6dbf('0x4b')],{})[_0x6dbf('0x27')](respondWithResult(_0x33f677,0xc9))[_0x6dbf('0x49')](handleError(_0x33f677,null));};exports[_0x6dbf('0x25')]=function(_0x3f25bb,_0x5767d1){if(_0x3f25bb[_0x6dbf('0x4b')]['id']){delete _0x3f25bb['body']['id'];}return db[_0x6dbf('0x2f')][_0x6dbf('0x48')]({'where':{'id':_0x3f25bb[_0x6dbf('0x47')]['id']}})[_0x6dbf('0x27')](handleEntityNotFound(_0x5767d1,null))[_0x6dbf('0x27')](saveUpdates(_0x3f25bb['body'],null))[_0x6dbf('0x27')](respondWithResult(_0x5767d1,null))[_0x6dbf('0x49')](handleError(_0x5767d1,null));};exports['destroy']=function(_0x5dd98f,_0x34b4d2){return db[_0x6dbf('0x2f')][_0x6dbf('0x48')]({'where':{'id':_0x5dd98f['params']['id']}})[_0x6dbf('0x27')](handleEntityNotFound(_0x34b4d2,null))['then'](removeEntity(_0x34b4d2,null))['catch'](handleError(_0x34b4d2,null));};exports[_0x6dbf('0x4c')]=function(_0x1aefa2,_0x25debb){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x25debb,null))[_0x6dbf('0x49')](handleError(_0x25debb,null));};exports[_0x6dbf('0x4d')]=function(_0x4f034c,_0x57b0f8,_0x2c8e49){var _0x13a64f={'raw':!![],'where':{}};var _0x34bd2d={};var _0x5496db={'count':0x0,'rows':[]};return db[_0x6dbf('0x2f')][_0x6dbf('0x4e')]({'where':{'id':_0x4f034c[_0x6dbf('0x47')]['id']}})['then'](handleEntityNotFound(_0x57b0f8,null))[_0x6dbf('0x27')](function(_0x11552b){if(_0x11552b){_0x34bd2d[_0x6dbf('0x34')]=_[_0x6dbf('0x35')](db[_0x6dbf('0x4f')]['rawAttributes']);_0x34bd2d[_0x6dbf('0x36')]=_['keys'](_0x4f034c[_0x6dbf('0x36')]);_0x34bd2d[_0x6dbf('0x37')]=_[_0x6dbf('0x38')](_0x34bd2d[_0x6dbf('0x34')],_0x34bd2d[_0x6dbf('0x36')]);_0x13a64f['attributes']=_[_0x6dbf('0x38')](_0x34bd2d[_0x6dbf('0x34')],qs[_0x6dbf('0x3a')](_0x4f034c['query'][_0x6dbf('0x3a')]));_0x13a64f[_0x6dbf('0x39')]=_0x13a64f['attributes'][_0x6dbf('0x3b')]?_0x13a64f[_0x6dbf('0x39')]:_0x34bd2d[_0x6dbf('0x34')];if(!_0x4f034c[_0x6dbf('0x36')]['hasOwnProperty'](_0x6dbf('0x3c'))){_0x13a64f[_0x6dbf('0x1d')]=qs[_0x6dbf('0x1d')](_0x4f034c[_0x6dbf('0x36')][_0x6dbf('0x1d')]);_0x13a64f[_0x6dbf('0x1f')]=qs[_0x6dbf('0x1f')](_0x4f034c[_0x6dbf('0x36')]['offset']);}_0x13a64f[_0x6dbf('0x3d')]=qs[_0x6dbf('0x3e')](_0x4f034c[_0x6dbf('0x36')][_0x6dbf('0x3e')]);_0x13a64f['where']=qs[_0x6dbf('0x37')](_['pick'](_0x4f034c[_0x6dbf('0x36')],_0x34bd2d[_0x6dbf('0x37')]));_0x13a64f['where'][_0x6dbf('0x50')]=_0x11552b['id'];if(_0x4f034c[_0x6dbf('0x36')]['filter']){_0x13a64f['where']=_[_0x6dbf('0x41')](_0x13a64f[_0x6dbf('0x3f')],{'$or':_[_0x6dbf('0x2e')](_0x13a64f[_0x6dbf('0x39')],function(_0x1c3fd5){var _0xc9efa9={};_0xc9efa9[_0x1c3fd5]={'$like':'%'+_0x4f034c['query']['filter']+'%'};return _0xc9efa9;})});}_0x13a64f=_[_0x6dbf('0x41')]({},_0x13a64f,_0x4f034c[_0x6dbf('0x43')]);return db[_0x6dbf('0x4f')][_0x6dbf('0x1e')]({'where':_0x13a64f[_0x6dbf('0x3f')]})[_0x6dbf('0x27')](function(_0x2edc31){_0x5496db[_0x6dbf('0x1e')]=_0x2edc31;if(_0x4f034c['query'][_0x6dbf('0x44')]){_0x13a64f[_0x6dbf('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6dbf('0x51')](_0x13a64f);})[_0x6dbf('0x27')](function(_0x127247){_0x5496db[_0x6dbf('0x46')]=_0x127247;return _0x5496db;});}})[_0x6dbf('0x27')](respondWithFilteredResult(_0x57b0f8,_0x13a64f))[_0x6dbf('0x49')](handleError(_0x57b0f8,null));}; \ No newline at end of file +var _0xa4e4=['Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','body','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','rows','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa4e4,0x1c2));var _0x4a4e=function(_0x57a5e5,_0x18b0d6){_0x57a5e5=_0x57a5e5-0x0;var _0x354012=_0xa4e4[_0x57a5e5];return _0x354012;};'use strict';var emlformat=require(_0x4a4e('0x0'));var rimraf=require(_0x4a4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4a4e('0x2'));var moment=require(_0x4a4e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a4e('0x4'));var path=require(_0x4a4e('0x5'));var sox=require(_0x4a4e('0x6'));var csv=require(_0x4a4e('0x7'));var ejs=require(_0x4a4e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a4e('0x9'));var squel=require(_0x4a4e('0xa'));var crypto=require(_0x4a4e('0xb'));var jsforce=require(_0x4a4e('0xc'));var deskjs=require(_0x4a4e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4a4e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a4e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4a4e('0x10'));var hardwareService=require(_0x4a4e('0x11'));var logger=require(_0x4a4e('0x12'))(_0x4a4e('0x13'));var utils=require(_0x4a4e('0x14'));var config=require(_0x4a4e('0x15'));var licenseUtil=require(_0x4a4e('0x16'));var db=require(_0x4a4e('0x17'))['db'];function respondWithStatusCode(_0x513b7a,_0xe8f556){_0xe8f556=_0xe8f556||0xcc;return function(_0x21cadc){if(_0x21cadc){return _0x513b7a['sendStatus'](_0xe8f556);}return _0x513b7a[_0x4a4e('0x18')](_0xe8f556)[_0x4a4e('0x19')]();};}function respondWithResult(_0x17a544,_0x1029ab){_0x1029ab=_0x1029ab||0xc8;return function(_0x4319f7){if(_0x4319f7){return _0x17a544[_0x4a4e('0x18')](_0x1029ab)['json'](_0x4319f7);}};}function respondWithFilteredResult(_0xdfe84,_0x5da935){return function(_0x518d45){if(_0x518d45){var _0x354d5e=typeof _0x5da935[_0x4a4e('0x1a')]===_0x4a4e('0x1b')&&typeof _0x5da935['limit']===_0x4a4e('0x1b');var _0x7bfe29=_0x518d45['count'];var _0x51dc6f=_0x354d5e?0x0:_0x5da935[_0x4a4e('0x1a')];var _0x305e8c=_0x354d5e?_0x518d45[_0x4a4e('0x1c')]:_0x5da935[_0x4a4e('0x1a')]+_0x5da935['limit'];var _0xe783da;if(_0x305e8c>=_0x7bfe29){_0x305e8c=_0x7bfe29;_0xe783da=0xc8;}else{_0xe783da=0xce;}_0xdfe84['status'](_0xe783da);return _0xdfe84[_0x4a4e('0x1d')](_0x4a4e('0x1e'),_0x51dc6f+'-'+_0x305e8c+'/'+_0x7bfe29)[_0x4a4e('0x1f')](_0x518d45);}return null;};}function patchUpdates(_0x2fcf5a){return function(_0x21acf1){try{jsonpatch[_0x4a4e('0x20')](_0x21acf1,_0x2fcf5a,!![]);}catch(_0x37988c){return BPromise[_0x4a4e('0x21')](_0x37988c);}return _0x21acf1[_0x4a4e('0x22')]();};}function saveUpdates(_0x29aa04,_0x82e3ae){return function(_0x5a74b9){if(_0x5a74b9){return _0x5a74b9[_0x4a4e('0x23')](_0x29aa04)[_0x4a4e('0x24')](function(_0x40ad6c){return _0x40ad6c;});}return null;};}function removeEntity(_0x23441b,_0x54f27e){return function(_0x21001f){if(_0x21001f){return _0x21001f[_0x4a4e('0x25')]()[_0x4a4e('0x24')](function(){_0x23441b[_0x4a4e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9d57,_0x49c716){return function(_0x4a92b8){if(!_0x4a92b8){_0x1f9d57[_0x4a4e('0x26')](0x194);}return _0x4a92b8;};}function handleError(_0x3ddc15,_0x20941f){_0x20941f=_0x20941f||0x1f4;return function(_0x32a8b1){logger[_0x4a4e('0x27')](_0x32a8b1[_0x4a4e('0x28')]);if(_0x32a8b1['name']){delete _0x32a8b1[_0x4a4e('0x29')];}_0x3ddc15['status'](_0x20941f)[_0x4a4e('0x2a')](_0x32a8b1);};}exports[_0x4a4e('0x2b')]=function(_0x5b6b4f,_0x3c88d3){var _0x39aff7={},_0xfa416c={},_0x132cb8={'count':0x0,'rows':[]};var _0x39aa01=_[_0x4a4e('0x2c')](db[_0x4a4e('0x2d')][_0x4a4e('0x2e')],function(_0x198742){return{'name':_0x198742[_0x4a4e('0x2f')],'type':_0x198742[_0x4a4e('0x30')]['key']};});_0xfa416c['model']=_['map'](_0x39aa01,'name');_0xfa416c['query']=_[_0x4a4e('0x31')](_0x5b6b4f[_0x4a4e('0x32')]);_0xfa416c[_0x4a4e('0x33')]=_['intersection'](_0xfa416c[_0x4a4e('0x34')],_0xfa416c[_0x4a4e('0x32')]);_0x39aff7[_0x4a4e('0x35')]=_[_0x4a4e('0x36')](_0xfa416c[_0x4a4e('0x34')],qs['fields'](_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x37')]));_0x39aff7[_0x4a4e('0x35')]=_0x39aff7['attributes'][_0x4a4e('0x38')]?_0x39aff7[_0x4a4e('0x35')]:_0xfa416c[_0x4a4e('0x34')];if(!_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x39')](_0x4a4e('0x3a'))){_0x39aff7[_0x4a4e('0x3b')]=qs[_0x4a4e('0x3b')](_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x3b')]);_0x39aff7['offset']=qs['offset'](_0x5b6b4f[_0x4a4e('0x32')]['offset']);}_0x39aff7['order']=qs[_0x4a4e('0x3c')](_0x5b6b4f[_0x4a4e('0x32')]['sort']);_0x39aff7[_0x4a4e('0x3d')]=qs[_0x4a4e('0x33')](_[_0x4a4e('0x3e')](_0x5b6b4f[_0x4a4e('0x32')],_0xfa416c['filters']),_0x39aa01);if(_0x5b6b4f['query'][_0x4a4e('0x3f')]){_0x39aff7[_0x4a4e('0x3d')]=_['merge'](_0x39aff7[_0x4a4e('0x3d')],{'$or':_[_0x4a4e('0x2c')](_0x39aa01,function(_0x4de33f){if(_0x4de33f[_0x4a4e('0x30')]!==_0x4a4e('0x40')){var _0x2be8e={};_0x2be8e[_0x4de33f[_0x4a4e('0x29')]]={'$like':'%'+_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x3f')]+'%'};return _0x2be8e;}})});}_0x39aff7=_[_0x4a4e('0x41')]({},_0x39aff7,_0x5b6b4f[_0x4a4e('0x42')]);var _0x19025a={'where':_0x39aff7[_0x4a4e('0x3d')]};return db[_0x4a4e('0x2d')]['count'](_0x19025a)[_0x4a4e('0x24')](function(_0x12e4f5){_0x132cb8['count']=_0x12e4f5;if(_0x5b6b4f[_0x4a4e('0x32')][_0x4a4e('0x43')]){_0x39aff7[_0x4a4e('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4a4e('0x45')](_0x39aff7);})['then'](function(_0x465ddf){_0x132cb8['rows']=_0x465ddf;return _0x132cb8;})[_0x4a4e('0x24')](respondWithFilteredResult(_0x3c88d3,_0x39aff7))[_0x4a4e('0x46')](handleError(_0x3c88d3,null));};exports['show']=function(_0x255beb,_0x37cd3c){var _0x41e52b={'raw':!![],'where':{'id':_0x255beb[_0x4a4e('0x47')]['id']}},_0x29db53={};_0x29db53['model']=_[_0x4a4e('0x31')](db[_0x4a4e('0x2d')][_0x4a4e('0x2e')]);_0x29db53['query']=_[_0x4a4e('0x31')](_0x255beb[_0x4a4e('0x32')]);_0x29db53[_0x4a4e('0x33')]=_['intersection'](_0x29db53[_0x4a4e('0x34')],_0x29db53[_0x4a4e('0x32')]);_0x41e52b[_0x4a4e('0x35')]=_[_0x4a4e('0x36')](_0x29db53[_0x4a4e('0x34')],qs['fields'](_0x255beb['query'][_0x4a4e('0x37')]));_0x41e52b[_0x4a4e('0x35')]=_0x41e52b[_0x4a4e('0x35')][_0x4a4e('0x38')]?_0x41e52b['attributes']:_0x29db53[_0x4a4e('0x34')];if(_0x255beb[_0x4a4e('0x32')]['includeAll']){_0x41e52b[_0x4a4e('0x44')]=[{'all':!![]}];}_0x41e52b=_[_0x4a4e('0x41')]({},_0x41e52b,_0x255beb[_0x4a4e('0x42')]);return db[_0x4a4e('0x2d')][_0x4a4e('0x48')](_0x41e52b)[_0x4a4e('0x24')](handleEntityNotFound(_0x37cd3c,null))[_0x4a4e('0x24')](respondWithResult(_0x37cd3c,null))[_0x4a4e('0x46')](handleError(_0x37cd3c,null));};exports['create']=function(_0x1b9830,_0x48f01e){return db[_0x4a4e('0x2d')]['create'](_0x1b9830[_0x4a4e('0x49')],{})['then'](respondWithResult(_0x48f01e,0xc9))[_0x4a4e('0x46')](handleError(_0x48f01e,null));};exports[_0x4a4e('0x23')]=function(_0x582add,_0x35e1c2){if(_0x582add['body']['id']){delete _0x582add[_0x4a4e('0x49')]['id'];}return db[_0x4a4e('0x2d')][_0x4a4e('0x48')]({'where':{'id':_0x582add[_0x4a4e('0x47')]['id']}})[_0x4a4e('0x24')](handleEntityNotFound(_0x35e1c2,null))[_0x4a4e('0x24')](saveUpdates(_0x582add[_0x4a4e('0x49')],null))[_0x4a4e('0x24')](respondWithResult(_0x35e1c2,null))[_0x4a4e('0x46')](handleError(_0x35e1c2,null));};exports[_0x4a4e('0x25')]=function(_0x4898e5,_0x405440){return db[_0x4a4e('0x2d')][_0x4a4e('0x48')]({'where':{'id':_0x4898e5['params']['id']}})[_0x4a4e('0x24')](handleEntityNotFound(_0x405440,null))[_0x4a4e('0x24')](removeEntity(_0x405440,null))['catch'](handleError(_0x405440,null));};exports['describe']=function(_0x55f168,_0x32c56d){return db[_0x4a4e('0x2d')][_0x4a4e('0x4a')]()[_0x4a4e('0x24')](respondWithResult(_0x32c56d,null))['catch'](handleError(_0x32c56d,null));};exports[_0x4a4e('0x4b')]=function(_0x132619,_0x569460,_0x556003){var _0x15b19b={'raw':!![],'where':{}};var _0x125f28={};var _0xcdc627={'count':0x0,'rows':[]};return db[_0x4a4e('0x2d')][_0x4a4e('0x4c')]({'where':{'id':_0x132619[_0x4a4e('0x47')]['id']}})[_0x4a4e('0x24')](handleEntityNotFound(_0x569460,null))['then'](function(_0x5a0a84){if(_0x5a0a84){_0x125f28['model']=_[_0x4a4e('0x31')](db['JscriptyQuestionReport'][_0x4a4e('0x2e')]);_0x125f28[_0x4a4e('0x32')]=_[_0x4a4e('0x31')](_0x132619[_0x4a4e('0x32')]);_0x125f28[_0x4a4e('0x33')]=_[_0x4a4e('0x36')](_0x125f28[_0x4a4e('0x34')],_0x125f28[_0x4a4e('0x32')]);_0x15b19b[_0x4a4e('0x35')]=_[_0x4a4e('0x36')](_0x125f28[_0x4a4e('0x34')],qs[_0x4a4e('0x37')](_0x132619[_0x4a4e('0x32')][_0x4a4e('0x37')]));_0x15b19b['attributes']=_0x15b19b[_0x4a4e('0x35')]['length']?_0x15b19b['attributes']:_0x125f28[_0x4a4e('0x34')];if(!_0x132619[_0x4a4e('0x32')][_0x4a4e('0x39')]('nolimit')){_0x15b19b[_0x4a4e('0x3b')]=qs['limit'](_0x132619['query']['limit']);_0x15b19b[_0x4a4e('0x1a')]=qs[_0x4a4e('0x1a')](_0x132619['query'][_0x4a4e('0x1a')]);}_0x15b19b['order']=qs[_0x4a4e('0x3c')](_0x132619[_0x4a4e('0x32')]['sort']);_0x15b19b['where']=qs['filters'](_[_0x4a4e('0x3e')](_0x132619['query'],_0x125f28[_0x4a4e('0x33')]));_0x15b19b[_0x4a4e('0x3d')][_0x4a4e('0x4d')]=_0x5a0a84['id'];if(_0x132619['query'][_0x4a4e('0x3f')]){_0x15b19b['where']=_[_0x4a4e('0x41')](_0x15b19b[_0x4a4e('0x3d')],{'$or':_[_0x4a4e('0x2c')](_0x15b19b['attributes'],function(_0x166575){var _0x508ca8={};_0x508ca8[_0x166575]={'$like':'%'+_0x132619[_0x4a4e('0x32')][_0x4a4e('0x3f')]+'%'};return _0x508ca8;})});}_0x15b19b=_[_0x4a4e('0x41')]({},_0x15b19b,_0x132619[_0x4a4e('0x42')]);return db[_0x4a4e('0x4e')][_0x4a4e('0x1c')]({'where':_0x15b19b[_0x4a4e('0x3d')]})['then'](function(_0x5015d3){_0xcdc627['count']=_0x5015d3;if(_0x132619['query']['includeAll']){_0x15b19b[_0x4a4e('0x44')]=[{'all':!![]}];}return db[_0x4a4e('0x4e')][_0x4a4e('0x45')](_0x15b19b);})[_0x4a4e('0x24')](function(_0xbb97ee){_0xcdc627[_0x4a4e('0x4f')]=_0xbb97ee;return _0xcdc627;});}})[_0x4a4e('0x24')](respondWithFilteredResult(_0x569460,_0x15b19b))[_0x4a4e('0x46')](handleError(_0x569460,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2a3773f..ac2c976 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 _0x1cb9=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xa1991c,_0x5d4bcc){var _0x536b95=function(_0x47a420){while(--_0x47a420){_0xa1991c['push'](_0xa1991c['shift']());}};_0x536b95(++_0x5d4bcc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x469f30,_0x4257f6){_0x469f30=_0x469f30-0x0;var _0x1193f1=_0x1cb9[_0x469f30];return _0x1193f1;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x3baf,0xf7));var _0xf3ba=function(_0x294747,_0x379ea7){_0x294747=_0x294747-0x0;var _0x1a4b30=_0x3baf[_0x294747];return _0x1a4b30;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','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 73ce8af..41be456 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 _0x3d04=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','info'];(function(_0x19bcd7,_0x4a50b1){var _0x2f45e8=function(_0x37ca41){while(--_0x37ca41){_0x19bcd7['push'](_0x19bcd7['shift']());}};_0x2f45e8(++_0x4a50b1);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x3b8787,_0x3f4bc5){var _0x48bd6f=function(_0x41d414){while(--_0x41d414){_0x3b8787['push'](_0x3b8787['shift']());}};_0x48bd6f(++_0x3f4bc5);}(_0xba34,0x119));var _0x4ba3=function(_0x1decce,_0x467bf5){_0x1decce=_0x1decce-0x0;var _0x14f2d5=_0xba34[_0x1decce];return _0x14f2d5;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index edac9eb..4ef6694 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 _0xe1dc=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','index','/:id','update','/download_log_file'];(function(_0x342cb9,_0x42ba68){var _0x9456bc=function(_0xade2e0){while(--_0xade2e0){_0x342cb9['push'](_0x342cb9['shift']());}};_0x9456bc(++_0x42ba68);}(_0xe1dc,0x6a));var _0xce1d=function(_0x392382,_0x2a1483){_0x392382=_0x392382-0x0;var _0x10fccf=_0xe1dc[_0x392382];return _0x10fccf;};'use strict';var multer=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var path=require(_0xce1d('0x2'));var timeout=require(_0xce1d('0x3'));var express=require(_0xce1d('0x4'));var router=express[_0xce1d('0x5')]();var fs_extra=require(_0xce1d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xce1d('0x7'));var config=require(_0xce1d('0x8'));var controller=require(_0xce1d('0x9'));router['get']('/',controller[_0xce1d('0xa')]);router['put'](_0xce1d('0xb'),auth['isAuthenticated'](),controller[_0xce1d('0xc')]);router['get'](_0xce1d('0xd'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xce1d('0xe')]=router; \ No newline at end of file +var _0xd4b7=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','index','put','/:id','isAuthenticated','update','get','downloadLogFile','exports'];(function(_0xc5eb30,_0x356954){var _0x237a8a=function(_0x12c4d6){while(--_0x12c4d6){_0xc5eb30['push'](_0xc5eb30['shift']());}};_0x237a8a(++_0x356954);}(_0xd4b7,0x69));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7d4b('0x0'));var util=require(_0x7d4b('0x1'));var path=require(_0x7d4b('0x2'));var timeout=require(_0x7d4b('0x3'));var express=require('express');var router=express[_0x7d4b('0x4')]();var fs_extra=require(_0x7d4b('0x5'));var auth=require(_0x7d4b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x7d4b('0x7')]);router[_0x7d4b('0x8')](_0x7d4b('0x9'),auth[_0x7d4b('0xa')](),controller[_0x7d4b('0xb')]);router[_0x7d4b('0xc')]('/download_log_file',auth[_0x7d4b('0xa')](),controller[_0x7d4b('0xd')]);module[_0x7d4b('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0a85690..d2438f6 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 _0x1a9d=['STRING','sequelize','exports'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0x1a9d,0x175));var _0xd1a9=function(_0x1dda8f,_0x557dd){_0x1dda8f=_0x1dda8f-0x0;var _0x3fe5cc=_0x1a9d[_0x1dda8f];return _0x3fe5cc;};'use strict';var Sequelize=require(_0xd1a9('0x0'));module[_0xd1a9('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd1a9('0x2')]},'data2':{'type':Sequelize[_0xd1a9('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc4dc=['exports','STRING','INTEGER','sequelize'];(function(_0x225f43,_0x2ba06f){var _0x592761=function(_0xc2e1da){while(--_0xc2e1da){_0x225f43['push'](_0x225f43['shift']());}};_0x592761(++_0x2ba06f);}(_0xc4dc,0x123));var _0xcc4d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc4dc[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xcc4d('0x0'));module[_0xcc4d('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xcc4d('0x2')]},'data2':{'type':Sequelize[_0xcc4d('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xcc4d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 06a8e28..0a616d5 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 _0xde5b=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','query','keys','filters','intersection','attributes','model','fields','length','merge','getLicense','catch','update','body','License','find','params','get','demo','downloadLogFile','license-info.log','join','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xde5b,0x146));var _0xbde5=function(_0x3f719d,_0x41fac2){_0x3f719d=_0x3f719d-0x0;var _0x587759=_0xde5b[_0x3f719d];return _0x587759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbde5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbde5('0x1'));var rp=require(_0xbde5('0x2'));var moment=require(_0xbde5('0x3'));var BPromise=require(_0xbde5('0x4'));var Mustache=require(_0xbde5('0x5'));var util=require(_0xbde5('0x6'));var path=require(_0xbde5('0x7'));var sox=require('sox');var csv=require(_0xbde5('0x8'));var ejs=require(_0xbde5('0x9'));var fs=require('fs');var fs_extra=require(_0xbde5('0xa'));var _=require(_0xbde5('0xb'));var squel=require(_0xbde5('0xc'));var crypto=require(_0xbde5('0xd'));var jsforce=require(_0xbde5('0xe'));var deskjs=require(_0xbde5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbde5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbde5('0x11'));var qs=require(_0xbde5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbde5('0x13'))(_0xbde5('0x14'));var utils=require(_0xbde5('0x15'));var config=require(_0xbde5('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa4da,_0x2ae14e){_0x2ae14e=_0x2ae14e||0xcc;return function(_0x1de520){if(_0x1de520){return _0x1fa4da[_0xbde5('0x17')](_0x2ae14e);}return _0x1fa4da['status'](_0x2ae14e)['end']();};}function respondWithResult(_0x250ebb,_0x6509b8){_0x6509b8=_0x6509b8||0xc8;return function(_0x4f6400){if(_0x4f6400){return _0x250ebb[_0xbde5('0x18')](_0x6509b8)[_0xbde5('0x19')](_0x4f6400);}};}function respondWithFilteredResult(_0x2bd637,_0x1e971f){return function(_0x3a9425){if(_0x3a9425){var _0x18d5ed=typeof _0x1e971f[_0xbde5('0x1a')]===_0xbde5('0x1b')&&typeof _0x1e971f[_0xbde5('0x1c')]===_0xbde5('0x1b');var _0x4fcb8b=_0x3a9425[_0xbde5('0x1d')];var _0x43a7e0=_0x18d5ed?0x0:_0x1e971f[_0xbde5('0x1a')];var _0x54e36e=_0x18d5ed?_0x3a9425[_0xbde5('0x1d')]:_0x1e971f[_0xbde5('0x1a')]+_0x1e971f[_0xbde5('0x1c')];var _0x8a21fc;if(_0x54e36e>=_0x4fcb8b){_0x54e36e=_0x4fcb8b;_0x8a21fc=0xc8;}else{_0x8a21fc=0xce;}_0x2bd637[_0xbde5('0x18')](_0x8a21fc);return _0x2bd637[_0xbde5('0x1e')](_0xbde5('0x1f'),_0x43a7e0+'-'+_0x54e36e+'/'+_0x4fcb8b)[_0xbde5('0x19')](_0x3a9425);}return null;};}function patchUpdates(_0xe01d43){return function(_0x97685){try{jsonpatch[_0xbde5('0x20')](_0x97685,_0xe01d43,!![]);}catch(_0x1c2358){return BPromise[_0xbde5('0x21')](_0x1c2358);}return _0x97685[_0xbde5('0x22')]();};}function saveUpdates(_0x49f187,_0x541370){return function(_0x1c14c6){if(_0x1c14c6){return _0x1c14c6['update'](_0x49f187)[_0xbde5('0x23')](function(_0x5cf006){return _0x5cf006;});}return null;};}function removeEntity(_0x382cd1,_0x56cf07){return function(_0x48ec00){if(_0x48ec00){return _0x48ec00[_0xbde5('0x24')]()[_0xbde5('0x23')](function(){_0x382cd1[_0xbde5('0x18')](0xcc)[_0xbde5('0x25')]();});}};}function handleEntityNotFound(_0x2d5e0a,_0xd071a5){return function(_0xb698a1){if(!_0xb698a1){_0x2d5e0a['sendStatus'](0x194);}return _0xb698a1;};}function handleError(_0x22b7b0,_0x100e6b){_0x100e6b=_0x100e6b||0x1f4;return function(_0x57ecb5){logger[_0xbde5('0x26')](_0x57ecb5['stack']);if(_0x57ecb5[_0xbde5('0x27')]){delete _0x57ecb5[_0xbde5('0x27')];}_0x22b7b0[_0xbde5('0x18')](_0x100e6b)[_0xbde5('0x28')](_0x57ecb5);};}var utilLicense=require('../../config/license/util');exports[_0xbde5('0x29')]=function(_0x1010f1,_0x2dc2f0){var _0x53ad70={'raw':!![],'where':{'id':0x1}},_0x41c242={};_0x41c242['model']=_['keys'](db['License']['rawAttributes']);_0x41c242[_0xbde5('0x2a')]=_[_0xbde5('0x2b')](_0x1010f1[_0xbde5('0x2a')]);_0x41c242[_0xbde5('0x2c')]=_[_0xbde5('0x2d')](_0x41c242['model'],_0x41c242['query']);_0x53ad70[_0xbde5('0x2e')]=_[_0xbde5('0x2d')](_0x41c242[_0xbde5('0x2f')],qs[_0xbde5('0x30')](_0x1010f1[_0xbde5('0x2a')]['fields']));_0x53ad70[_0xbde5('0x2e')]=_0x53ad70['attributes'][_0xbde5('0x31')]?_0x53ad70['attributes']:_0x41c242[_0xbde5('0x2f')];_0x53ad70=_[_0xbde5('0x32')]({},_0x53ad70,_0x1010f1['options']);return utilLicense[_0xbde5('0x33')](_0x53ad70)[_0xbde5('0x23')](respondWithResult(_0x2dc2f0,null))[_0xbde5('0x34')](handleError(_0x2dc2f0,null));};exports[_0xbde5('0x35')]=function(_0x5d0b10,_0x186527){if(_0x5d0b10['body']['id']){delete _0x5d0b10[_0xbde5('0x36')]['id'];}return db[_0xbde5('0x37')][_0xbde5('0x38')]({'where':{'id':_0x5d0b10[_0xbde5('0x39')]['id']}})[_0xbde5('0x23')](handleEntityNotFound(_0x186527,null))['then'](function(_0x3ca3d6){var _0x283313=_0x3ca3d6[_0xbde5('0x3a')]({'plain':!![]});return utilLicense['checkLicense'](_0x283313,_0x5d0b10['body']['key']);})['then'](function(_0x228238){if(!_0x228238[_0xbde5('0x3b')]){return saveUpdates(_0x5d0b10[_0xbde5('0x36')],null);}return _0x228238;})[_0xbde5('0x23')](respondWithResult(_0x186527,null))['catch'](handleError(_0x186527,null));};exports[_0xbde5('0x3c')]=function(_0x404ff1,_0x5b2723){var _0x2aa84e=_0xbde5('0x3d');var _0x4d1418=path[_0xbde5('0x3e')]('/var','log',_0xbde5('0x3f'),_0x2aa84e);_0x5b2723[_0xbde5('0x40')](_0xbde5('0x41'),_0xbde5('0x42')+_0x2aa84e);_0x5b2723[_0xbde5('0x1e')]('Content-Type',_0xbde5('0x43'));_0x5b2723['download'](_0x4d1418);}; \ No newline at end of file +var _0x95a7=['undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x95a7,0x107));var _0x795a=function(_0x32ba07,_0x425202){_0x32ba07=_0x32ba07-0x0;var _0x243999=_0x95a7[_0x32ba07];return _0x243999;};'use strict';var emlformat=require(_0x795a('0x0'));var rimraf=require(_0x795a('0x1'));var zipdir=require(_0x795a('0x2'));var jsonpatch=require(_0x795a('0x3'));var rp=require('request-promise');var moment=require(_0x795a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x795a('0x5'));var util=require(_0x795a('0x6'));var path=require(_0x795a('0x7'));var sox=require(_0x795a('0x8'));var csv=require(_0x795a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x795a('0xa'));var _=require(_0x795a('0xb'));var squel=require('squel');var crypto=require(_0x795a('0xc'));var jsforce=require(_0x795a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x795a('0xe'));var authService=require(_0x795a('0xf'));var qs=require(_0x795a('0x10'));var as=require(_0x795a('0x11'));var hardwareService=require(_0x795a('0x12'));var logger=require(_0x795a('0x13'))(_0x795a('0x14'));var utils=require(_0x795a('0x15'));var config=require(_0x795a('0x16'));var licenseUtil=require(_0x795a('0x17'));var db=require(_0x795a('0x18'))['db'];function respondWithStatusCode(_0x33fdaa,_0x1dc5f5){_0x1dc5f5=_0x1dc5f5||0xcc;return function(_0x5bea2f){if(_0x5bea2f){return _0x33fdaa[_0x795a('0x19')](_0x1dc5f5);}return _0x33fdaa[_0x795a('0x1a')](_0x1dc5f5)['end']();};}function respondWithResult(_0x1c52a2,_0xd8de05){_0xd8de05=_0xd8de05||0xc8;return function(_0x55b102){if(_0x55b102){return _0x1c52a2[_0x795a('0x1a')](_0xd8de05)[_0x795a('0x1b')](_0x55b102);}};}function respondWithFilteredResult(_0x5c38e1,_0x4bf3f5){return function(_0x171e4d){if(_0x171e4d){var _0x5e90a7=typeof _0x4bf3f5[_0x795a('0x1c')]===_0x795a('0x1d')&&typeof _0x4bf3f5[_0x795a('0x1e')]===_0x795a('0x1d');var _0x2d590f=_0x171e4d[_0x795a('0x1f')];var _0x2fa3c9=_0x5e90a7?0x0:_0x4bf3f5[_0x795a('0x1c')];var _0xeb270a=_0x5e90a7?_0x171e4d[_0x795a('0x1f')]:_0x4bf3f5[_0x795a('0x1c')]+_0x4bf3f5[_0x795a('0x1e')];var _0x2a6008;if(_0xeb270a>=_0x2d590f){_0xeb270a=_0x2d590f;_0x2a6008=0xc8;}else{_0x2a6008=0xce;}_0x5c38e1[_0x795a('0x1a')](_0x2a6008);return _0x5c38e1[_0x795a('0x20')](_0x795a('0x21'),_0x2fa3c9+'-'+_0xeb270a+'/'+_0x2d590f)[_0x795a('0x1b')](_0x171e4d);}return null;};}function patchUpdates(_0x3f7a98){return function(_0x170f7c){try{jsonpatch[_0x795a('0x22')](_0x170f7c,_0x3f7a98,!![]);}catch(_0x2cfdb1){return BPromise['reject'](_0x2cfdb1);}return _0x170f7c[_0x795a('0x23')]();};}function saveUpdates(_0x2d305e,_0x590a22){return function(_0x44bbdb){if(_0x44bbdb){return _0x44bbdb['update'](_0x2d305e)[_0x795a('0x24')](function(_0x14e21c){return _0x14e21c;});}return null;};}function removeEntity(_0x290dc2,_0x23329d){return function(_0x5a4e29){if(_0x5a4e29){return _0x5a4e29[_0x795a('0x25')]()[_0x795a('0x24')](function(){_0x290dc2[_0x795a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x453a1f,_0x1bf100){return function(_0x36f226){if(!_0x36f226){_0x453a1f[_0x795a('0x19')](0x194);}return _0x36f226;};}function handleError(_0x5a1553,_0x196388){_0x196388=_0x196388||0x1f4;return function(_0x250071){logger[_0x795a('0x26')](_0x250071[_0x795a('0x27')]);if(_0x250071[_0x795a('0x28')]){delete _0x250071[_0x795a('0x28')];}_0x5a1553[_0x795a('0x1a')](_0x196388)['send'](_0x250071);};}var utilLicense=require(_0x795a('0x17'));exports[_0x795a('0x29')]=function(_0x1c1bda,_0x492316){var _0x22ea4b={'raw':!![],'where':{'id':0x1}},_0x3fb736={};_0x3fb736[_0x795a('0x2a')]=_[_0x795a('0x2b')](db[_0x795a('0x2c')][_0x795a('0x2d')]);_0x3fb736[_0x795a('0x2e')]=_[_0x795a('0x2b')](_0x1c1bda[_0x795a('0x2e')]);_0x3fb736[_0x795a('0x2f')]=_['intersection'](_0x3fb736[_0x795a('0x2a')],_0x3fb736[_0x795a('0x2e')]);_0x22ea4b['attributes']=_[_0x795a('0x30')](_0x3fb736[_0x795a('0x2a')],qs[_0x795a('0x31')](_0x1c1bda[_0x795a('0x2e')][_0x795a('0x31')]));_0x22ea4b['attributes']=_0x22ea4b[_0x795a('0x32')][_0x795a('0x33')]?_0x22ea4b[_0x795a('0x32')]:_0x3fb736[_0x795a('0x2a')];_0x22ea4b=_[_0x795a('0x34')]({},_0x22ea4b,_0x1c1bda[_0x795a('0x35')]);return utilLicense[_0x795a('0x36')](_0x22ea4b)[_0x795a('0x24')](respondWithResult(_0x492316,null))[_0x795a('0x37')](handleError(_0x492316,null));};exports['update']=function(_0x2996e1,_0x51e7b3){if(_0x2996e1['body']['id']){delete _0x2996e1[_0x795a('0x38')]['id'];}return db[_0x795a('0x2c')]['find']({'where':{'id':_0x2996e1[_0x795a('0x39')]['id']}})[_0x795a('0x24')](handleEntityNotFound(_0x51e7b3,null))[_0x795a('0x24')](function(_0x14a8a0){var _0x5f4906=_0x14a8a0[_0x795a('0x3a')]({'plain':!![]});return utilLicense[_0x795a('0x3b')](_0x5f4906,_0x2996e1[_0x795a('0x38')][_0x795a('0x3c')]);})[_0x795a('0x24')](function(_0x52dc90){if(!_0x52dc90[_0x795a('0x3d')]){return saveUpdates(_0x2996e1[_0x795a('0x38')],null);}return _0x52dc90;})[_0x795a('0x24')](respondWithResult(_0x51e7b3,null))[_0x795a('0x37')](handleError(_0x51e7b3,null));};exports[_0x795a('0x3e')]=function(_0x35ea2f,_0x3a4bfc){var _0x2bcd1e=_0x795a('0x3f');var _0x56f7f9=path[_0x795a('0x40')](_0x795a('0x41'),_0x795a('0x42'),'xcally',_0x2bcd1e);_0x3a4bfc[_0x795a('0x43')](_0x795a('0x44'),_0x795a('0x45')+_0x2bcd1e);_0x3a4bfc['set'](_0x795a('0x46'),_0x795a('0x47'));_0x3a4bfc[_0x795a('0x48')](_0x56f7f9);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c5245f8..7ea5d85 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 _0xc551=['define','License','license','util','../../config/logger','api','moment','path','rimraf','./license.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc551,0x1d1));var _0x1c55=function(_0x5f2e12,_0x29ef04){_0x5f2e12=_0x5f2e12-0x0;var _0x4636d0=_0xc551[_0x5f2e12];return _0x4636d0;};'use strict';var _=require('lodash');var util=require(_0x1c55('0x0'));var logger=require(_0x1c55('0x1'))(_0x1c55('0x2'));var moment=require(_0x1c55('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c55('0x4'));var rimraf=require(_0x1c55('0x5'));var config=require('../../config/environment');var attributes=require(_0x1c55('0x6'));module[_0x1c55('0x7')]=function(_0x257358,_0x340700){return _0x257358[_0x1c55('0x8')](_0x1c55('0x9'),attributes,{'tableName':_0x1c55('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e04=['./license.attributes','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45f5aa,_0x4d6ebc){var _0x18aa93=function(_0x1a282e){while(--_0x1a282e){_0x45f5aa['push'](_0x45f5aa['shift']());}};_0x18aa93(++_0x4d6ebc);}(_0x1e04,0xb4));var _0x41e0=function(_0xa4eaad,_0x5d99ee){_0xa4eaad=_0xa4eaad-0x0;var _0xf11a17=_0x1e04[_0xa4eaad];return _0xf11a17;};'use strict';var _=require('lodash');var util=require(_0x41e0('0x0'));var logger=require(_0x41e0('0x1'))(_0x41e0('0x2'));var moment=require(_0x41e0('0x3'));var BPromise=require(_0x41e0('0x4'));var rp=require(_0x41e0('0x5'));var fs=require('fs');var path=require(_0x41e0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x41e0('0x7'));module['exports']=function(_0x38c77f,_0x574046){return _0x38c77f[_0x41e0('0x8')](_0x41e0('0x9'),attributes,{'tableName':_0x41e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 74c1684..23007f4 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 _0x543c=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x782cfa,_0x5c4214){var _0x2515b7=function(_0xab35cc){while(--_0xab35cc){_0x782cfa['push'](_0x782cfa['shift']());}};_0x2515b7(++_0x5c4214);}(_0x543c,0x76));var _0xc543=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x543c[_0x503790];return _0x388092;};'use strict';var _=require(_0xc543('0x0'));var util=require(_0xc543('0x1'));var moment=require(_0xc543('0x2'));var BPromise=require(_0xc543('0x3'));var rs=require(_0xc543('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc543('0x5'));var logger=require(_0xc543('0x6'))(_0xc543('0x7'));var config=require(_0xc543('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc543('0x9')][_0xc543('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa00060,_0x43e461,_0x209d2d){return new BPromise(function(_0xe33c34,_0x53d98f){return client['request'](_0xa00060,_0x209d2d)[_0xc543('0xb')](function(_0x9d84a7){logger['info'](_0xc543('0xc'),_0x43e461,'request\x20sent');logger[_0xc543('0xd')](_0xc543('0xe'),_0x43e461,_0xc543('0xf'),JSON[_0xc543('0x10')](_0x9d84a7));if(_0x9d84a7[_0xc543('0x11')]){if(_0x9d84a7['error'][_0xc543('0x12')]===0x1f4){logger['error'](_0xc543('0xc'),_0x43e461,_0x9d84a7[_0xc543('0x11')]['message']);return _0x53d98f(_0x9d84a7[_0xc543('0x11')][_0xc543('0x13')]);}logger[_0xc543('0x11')](_0xc543('0xc'),_0x43e461,_0x9d84a7['error']['message']);return _0xe33c34(_0x9d84a7['error']['message']);}else{logger[_0xc543('0x14')](_0xc543('0xc'),_0x43e461,'request\x20sent');_0xe33c34(_0x9d84a7[_0xc543('0x15')][_0xc543('0x13')]);}})[_0xc543('0x16')](function(_0x95547d){logger[_0xc543('0x11')](_0xc543('0xc'),_0x43e461,_0x95547d);_0x53d98f(_0x95547d);});});} \ No newline at end of file +var _0x94aa=['../../config/environment','jayson/promise','client','http','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x94aa,0x172));var _0xa94a=function(_0x208ba1,_0x1384db){_0x208ba1=_0x208ba1-0x0;var _0x4bc5fc=_0x94aa[_0x208ba1];return _0x4bc5fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa94a('0x0'));var BPromise=require(_0xa94a('0x1'));var rs=require(_0xa94a('0x2'));var fs=require('fs');var Redis=require(_0xa94a('0x3'));var db=require(_0xa94a('0x4'))['db'];var utils=require(_0xa94a('0x5'));var logger=require(_0xa94a('0x6'))(_0xa94a('0x7'));var config=require(_0xa94a('0x8'));var jayson=require(_0xa94a('0x9'));var client=jayson[_0xa94a('0xa')][_0xa94a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5320c7,_0x8234ba,_0x1f5017){return new BPromise(function(_0x2b88e8,_0x2f511d){return client['request'](_0x5320c7,_0x1f5017)['then'](function(_0x5b99e7){logger[_0xa94a('0xc')]('License,\x20%s,\x20%s',_0x8234ba,_0xa94a('0xd'));logger['debug'](_0xa94a('0xe'),_0x8234ba,'request\x20sent',JSON[_0xa94a('0xf')](_0x5b99e7));if(_0x5b99e7[_0xa94a('0x10')]){if(_0x5b99e7['error'][_0xa94a('0x11')]===0x1f4){logger[_0xa94a('0x10')](_0xa94a('0x12'),_0x8234ba,_0x5b99e7[_0xa94a('0x10')]['message']);return _0x2f511d(_0x5b99e7[_0xa94a('0x10')][_0xa94a('0x13')]);}logger[_0xa94a('0x10')](_0xa94a('0x12'),_0x8234ba,_0x5b99e7['error']['message']);return _0x2b88e8(_0x5b99e7[_0xa94a('0x10')]['message']);}else{logger[_0xa94a('0xc')](_0xa94a('0x12'),_0x8234ba,_0xa94a('0xd'));_0x2b88e8(_0x5b99e7[_0xa94a('0x14')][_0xa94a('0x13')]);}})['catch'](function(_0x38d221){logger[_0xa94a('0x10')](_0xa94a('0x12'),_0x8234ba,_0x38d221);_0x2f511d(_0x38d221);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 43281e2..6e0a16d 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 _0x04ed=['/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeSmtp','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getImap'];(function(_0x2a0824,_0x21d97a){var _0x1a78f7=function(_0x517c4a){while(--_0x517c4a){_0x2a0824['push'](_0x2a0824['shift']());}};_0x1a78f7(++_0x21d97a);}(_0x04ed,0x7a));var _0xd04e=function(_0x2a6c0d,_0x596838){_0x2a6c0d=_0x2a6c0d-0x0;var _0x4c9f43=_0x04ed[_0x2a6c0d];return _0x4c9f43;};'use strict';var multer=require(_0xd04e('0x0'));var util=require(_0xd04e('0x1'));var path=require(_0xd04e('0x2'));var timeout=require(_0xd04e('0x3'));var express=require('express');var router=express[_0xd04e('0x4')]();var fs_extra=require(_0xd04e('0x5'));var auth=require(_0xd04e('0x6'));var interaction=require(_0xd04e('0x7'));var config=require(_0xd04e('0x8'));var controller=require('./mailAccount.controller');router[_0xd04e('0x9')]('/',auth[_0xd04e('0xa')](),controller['index']);router[_0xd04e('0x9')](_0xd04e('0xb'),auth['isAuthenticated'](),controller[_0xd04e('0xc')]);router['get'](_0xd04e('0xd'),auth['isAuthenticated'](),controller[_0xd04e('0xe')]);router[_0xd04e('0x9')](_0xd04e('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xd04e('0x9')](_0xd04e('0x10'),auth['isAuthenticated'](),controller[_0xd04e('0x11')]);router['get']('/:id/in_servers',auth[_0xd04e('0xa')](),controller[_0xd04e('0x12')]);router[_0xd04e('0x9')](_0xd04e('0x13'),auth['isAuthenticated'](),controller[_0xd04e('0x14')]);router[_0xd04e('0x9')](_0xd04e('0x15'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x16')]);router[_0xd04e('0x9')]('/:id/applications',auth[_0xd04e('0xa')](),controller[_0xd04e('0x17')]);router[_0xd04e('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd04e('0x18')]);router[_0xd04e('0x9')]('/:id/verify',auth[_0xd04e('0xa')](),controller[_0xd04e('0x19')]);router[_0xd04e('0x9')](_0xd04e('0x1a'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x1b')]);router[_0xd04e('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd04e('0x1d')]);router[_0xd04e('0x1c')](_0xd04e('0x10'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x1e')]);router['post']('/',auth[_0xd04e('0xa')](),controller[_0xd04e('0x1f')]);router[_0xd04e('0x1c')](_0xd04e('0x20'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x21')]);router[_0xd04e('0x1c')](_0xd04e('0x13'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x22')]);router['post']('/:id/interactions',auth[_0xd04e('0xa')](),controller[_0xd04e('0x23')]);router[_0xd04e('0x1c')](_0xd04e('0x24'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x25')]);router[_0xd04e('0x1c')](_0xd04e('0x26'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x27')]);router[_0xd04e('0x1c')]('/:id/users',auth[_0xd04e('0xa')](),controller['addAgents']);router[_0xd04e('0x28')](_0xd04e('0xd'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x29')]);router[_0xd04e('0x2a')](_0xd04e('0xf'),auth['isAuthenticated'](),controller[_0xd04e('0x2b')]);router[_0xd04e('0x2a')](_0xd04e('0x10'),auth[_0xd04e('0xa')](),controller['removeAnswers']);router[_0xd04e('0x2a')]('/:id/in_servers',auth[_0xd04e('0xa')](),controller['removeImap']);router[_0xd04e('0x2a')](_0xd04e('0x13'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x2c')]);router[_0xd04e('0x2a')](_0xd04e('0xd'),auth[_0xd04e('0xa')](),controller[_0xd04e('0x2d')]);router['delete'](_0xd04e('0x1a'),auth[_0xd04e('0xa')](),controller['removeAgents']);module[_0xd04e('0x2e')]=router; \ No newline at end of file +var _0x6899=['removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/:id/send','send','update','removeDispositions','delete'];(function(_0x89a5f2,_0x1c0cfb){var _0x526482=function(_0x607e9d){while(--_0x607e9d){_0x89a5f2['push'](_0x89a5f2['shift']());}};_0x526482(++_0x1c0cfb);}(_0x6899,0xeb));var _0x9689=function(_0x2dd93f,_0x34b248){_0x2dd93f=_0x2dd93f-0x0;var _0x1bf1b8=_0x6899[_0x2dd93f];return _0x1bf1b8;};'use strict';var multer=require(_0x9689('0x0'));var util=require(_0x9689('0x1'));var path=require(_0x9689('0x2'));var timeout=require(_0x9689('0x3'));var express=require(_0x9689('0x4'));var router=express[_0x9689('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9689('0x6'));var interaction=require(_0x9689('0x7'));var config=require('../../config/environment');var controller=require(_0x9689('0x8'));router[_0x9689('0x9')]('/',auth[_0x9689('0xa')](),controller['index']);router[_0x9689('0x9')]('/describe',auth[_0x9689('0xa')](),controller[_0x9689('0xb')]);router[_0x9689('0x9')](_0x9689('0xc'),auth['isAuthenticated'](),controller[_0x9689('0xd')]);router[_0x9689('0x9')](_0x9689('0xe'),auth['isAuthenticated'](),controller[_0x9689('0xf')]);router['get'](_0x9689('0x10'),auth[_0x9689('0xa')](),controller[_0x9689('0x11')]);router[_0x9689('0x9')](_0x9689('0x12'),auth['isAuthenticated'](),controller[_0x9689('0x13')]);router[_0x9689('0x9')](_0x9689('0x14'),auth[_0x9689('0xa')](),controller[_0x9689('0x15')]);router[_0x9689('0x9')](_0x9689('0x16'),auth[_0x9689('0xa')](),controller['getInteractions']);router[_0x9689('0x9')](_0x9689('0x17'),auth[_0x9689('0xa')](),controller[_0x9689('0x18')]);router[_0x9689('0x9')](_0x9689('0x19'),auth[_0x9689('0xa')](),controller[_0x9689('0x1a')]);router['get'](_0x9689('0x1b'),auth[_0x9689('0xa')](),controller[_0x9689('0x1c')]);router[_0x9689('0x9')](_0x9689('0x1d'),auth['isAuthenticated'](),controller[_0x9689('0x1e')]);router[_0x9689('0x1f')](_0x9689('0xe'),auth[_0x9689('0xa')](),controller[_0x9689('0x20')]);router[_0x9689('0x1f')]('/:id/canned_answers',auth[_0x9689('0xa')](),controller[_0x9689('0x21')]);router[_0x9689('0x1f')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9689('0x1f')](_0x9689('0x12'),auth['isAuthenticated'](),controller['addImap']);router[_0x9689('0x1f')]('/:id/out_servers',auth[_0x9689('0xa')](),controller['addSmtp']);router[_0x9689('0x1f')](_0x9689('0x16'),auth[_0x9689('0xa')](),controller[_0x9689('0x22')]);router['post'](_0x9689('0x17'),auth[_0x9689('0xa')](),controller[_0x9689('0x23')]);router[_0x9689('0x1f')](_0x9689('0x24'),auth[_0x9689('0xa')](),controller[_0x9689('0x25')]);router[_0x9689('0x1f')](_0x9689('0x1d'),auth[_0x9689('0xa')](),controller['addAgents']);router['put'](_0x9689('0xc'),auth['isAuthenticated'](),controller[_0x9689('0x26')]);router['delete'](_0x9689('0xe'),auth[_0x9689('0xa')](),controller[_0x9689('0x27')]);router[_0x9689('0x28')](_0x9689('0x10'),auth[_0x9689('0xa')](),controller[_0x9689('0x29')]);router['delete'](_0x9689('0x12'),auth[_0x9689('0xa')](),controller[_0x9689('0x2a')]);router['delete'](_0x9689('0x14'),auth['isAuthenticated'](),controller[_0x9689('0x2b')]);router[_0x9689('0x28')](_0x9689('0xc'),auth[_0x9689('0xa')](),controller['destroy']);router[_0x9689('0x28')](_0x9689('0x1d'),auth[_0x9689('0xa')](),controller[_0x9689('0x2c')]);module[_0x9689('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 df6968f..70aa460 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 _0x74d0=['getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','hotmail','outlook365'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x74d0,0x17f));var _0x074d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x74d0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x074d('0x0'));module[_0x074d('0x1')]={'description':{'type':Sequelize[_0x074d('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x074d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x074d('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x074d('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x074d('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x074d('0x2')],'allowNull':![],'defaultValue':_0x074d('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x074d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x074d('0x4')],'defaultValue':function(){return _0x074d('0x7');}},'notificationSound':{'type':Sequelize[_0x074d('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x074d('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x074d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x074d('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x074d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x074d('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x074d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x074d('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x074d('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x074d('0x3')],'defaultValue':![],'comment':_0x074d('0xa'),'set':function(_0xff44b){if(!_0xff44b)this[_0x074d('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x074d('0xc'),_0xff44b);}},'provider':{'type':Sequelize[_0x074d('0xd')]('gmail',_0x074d('0xe'),'yahoo',_0x074d('0xf')),'defaultValue':null,'get':function(){if(!this[_0x074d('0x10')](_0x074d('0x11')))return _0x074d('0x12');return this[_0x074d('0x10')](_0x074d('0x11'));},'set':function(_0x5b5235){if(_0x5b5235===_0x074d('0x12'))_0x5b5235=null;return this[_0x074d('0xb')](_0x074d('0x11'),_0x5b5235);}}}; \ No newline at end of file +var _0x0d42=['outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x0d42,0x1a8));var _0x20d4=function(_0x598f1f,_0xa7d1c){_0x598f1f=_0x598f1f-0x0;var _0x26d77d=_0x0d42[_0x598f1f];return _0x26d77d;};'use strict';var Sequelize=require(_0x20d4('0x0'));module[_0x20d4('0x1')]={'description':{'type':Sequelize[_0x20d4('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x20d4('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x20d4('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x20d4('0x4')]},'markAsUnread':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x20d4('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x20d4('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x20d4('0x4')],'defaultValue':function(){return _0x20d4('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x20d4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20d4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20d4('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x20d4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x20d4('0x3')],'defaultValue':![],'comment':_0x20d4('0x8'),'set':function(_0x21382d){if(!_0x21382d)this[_0x20d4('0x9')](_0x20d4('0xa'),null);this['setDataValue'](_0x20d4('0xb'),_0x21382d);}},'provider':{'type':Sequelize[_0x20d4('0xc')](_0x20d4('0xd'),_0x20d4('0xe'),_0x20d4('0xf'),_0x20d4('0x10')),'defaultValue':null,'get':function(){if(!this[_0x20d4('0x11')](_0x20d4('0x12')))return _0x20d4('0x13');return this['getDataValue'](_0x20d4('0x12'));},'set':function(_0x39bf52){if(_0x39bf52==='custom')_0x39bf52=null;return this[_0x20d4('0x9')](_0x20d4('0x12'),_0x39bf52);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 716c7ea..24121cd 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 _0x13b8=['provider','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','finally','options','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','root','server/files/attachments','basename','getSmtpOptions','defaults','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','update','get','MailAccounts','UserProfileResource','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','MailAccount','includeAll','include','logging','rows','show','rawAttributes','find','body','modernAuthentication','CloudProviderId','secure','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','params','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','hotmail','smtp.office365.com','user','pass','password','host','port','service','authentication','username'];(function(_0x5f12c9,_0x999e31){var _0x53cbaf=function(_0x2a47c7){while(--_0x2a47c7){_0x5f12c9['push'](_0x5f12c9['shift']());}};_0x53cbaf(++_0x999e31);}(_0x13b8,0x119));var _0x813b=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x13b8[_0x31cb5f];return _0x586042;};'use strict';var moment=require('moment');var BPromise=require(_0x813b('0x0'));var util=require(_0x813b('0x1'));var path=require('path');var _=require(_0x813b('0x2'));var juice=require(_0x813b('0x3'));var Redis=require(_0x813b('0x4'));var qs=require(_0x813b('0x5'));var logger=require(_0x813b('0x6'))(_0x813b('0x7'));var config=require('../../config/environment');var db=require(_0x813b('0x8'))['db'];config[_0x813b('0x9')]=_['defaults'](config['redis'],{'host':_0x813b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x813b('0x9')]));require(_0x813b('0xb'))[_0x813b('0xc')](socket);var jayson=require(_0x813b('0xd'));var client=jayson[_0x813b('0xe')][_0x813b('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x4a9cdd,_0x582fe7,_0x1d2502,_0x3a4040){return new BPromise(function(_0x398347,_0x5115ec){var _0x34c0fd=_0x3a4040||client;return _0x34c0fd[_0x813b('0x10')](_0x4a9cdd,_0x1d2502)[_0x813b('0x11')](function(_0x8175cb){logger[_0x813b('0x12')]('MailAccount,\x20%s,\x20%s',_0x582fe7,'request\x20sent');logger[_0x813b('0x13')](_0x813b('0x14'),_0x582fe7,'request\x20sent',JSON[_0x813b('0x15')](_0x8175cb));if(_0x8175cb[_0x813b('0x16')]){if(_0x8175cb[_0x813b('0x16')]['code']===0x1f4){logger[_0x813b('0x16')](_0x813b('0x17'),_0x582fe7,_0x8175cb['error'][_0x813b('0x18')]);return _0x5115ec(_0x8175cb[_0x813b('0x16')]['message']);}logger[_0x813b('0x16')]('MailAccount,\x20%s,\x20%s',_0x582fe7,_0x8175cb[_0x813b('0x16')][_0x813b('0x18')]);return _0x398347(_0x8175cb[_0x813b('0x16')][_0x813b('0x18')]);}else{logger['info'](_0x813b('0x17'),_0x582fe7,_0x813b('0x19'));_0x398347(_0x8175cb[_0x813b('0x1a')][_0x813b('0x18')]);}})[_0x813b('0x1b')](function(_0x1b3191){logger[_0x813b('0x16')](_0x813b('0x17'),_0x582fe7,_0x1b3191);_0x5115ec(_0x1b3191);});});}function respondWithStatusCode(_0x50d2bf,_0x4b4ecf){_0x4b4ecf=_0x4b4ecf||0xcc;return function(_0x1581b0){if(_0x1581b0){return _0x50d2bf[_0x813b('0x1c')](_0x4b4ecf);}return _0x50d2bf[_0x813b('0x1d')](_0x4b4ecf)[_0x813b('0x1e')]();};}function respondWithResult(_0x2b114e,_0x4d343d){_0x4d343d=_0x4d343d||0xc8;return function(_0x47ad72){if(_0x47ad72){return _0x2b114e['status'](_0x4d343d)[_0x813b('0x1f')](_0x47ad72);}};}function respondWithFilteredResult(_0x5d3f69,_0x1f014e){return function(_0x1873cd){if(_0x1873cd){var _0x1c6ef6=typeof _0x1f014e['offset']===_0x813b('0x20')&&typeof _0x1f014e['limit']===_0x813b('0x20');var _0x341048=_0x1873cd[_0x813b('0x21')];var _0x3a8bf2=_0x1c6ef6?0x0:_0x1f014e[_0x813b('0x22')];var _0x10e52a=_0x1c6ef6?_0x1873cd[_0x813b('0x21')]:_0x1f014e['offset']+_0x1f014e[_0x813b('0x23')];var _0x2dca9d;if(_0x10e52a>=_0x341048){_0x10e52a=_0x341048;_0x2dca9d=0xc8;}else{_0x2dca9d=0xce;}_0x5d3f69[_0x813b('0x1d')](_0x2dca9d);return _0x5d3f69['set']('Content-Range',_0x3a8bf2+'-'+_0x10e52a+'/'+_0x341048)[_0x813b('0x1f')](_0x1873cd);}return null;};}function saveUpdates(_0x6d18e9){return function(_0x4a5d72){if(_0x4a5d72){return _0x4a5d72[_0x813b('0x24')](_0x6d18e9)[_0x813b('0x11')](function(_0x2f2738){return _0x2f2738;});}return null;};}function removeEntity(_0x422a6f){return function(_0x3f0749){if(_0x3f0749){return _0x3f0749['destroy']()[_0x813b('0x11')](function(){var _0x574db3=_0x3f0749[_0x813b('0x25')]({'plain':!![]});var _0x4198a8=_0x813b('0x26');return db[_0x813b('0x27')]['destroy']({'where':{'type':_0x4198a8,'resourceId':_0x574db3['id']}})[_0x813b('0x11')](function(){return _0x3f0749;});})[_0x813b('0x11')](function(){_0x422a6f[_0x813b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24abea){return function(_0x587910){if(!_0x587910){_0x24abea[_0x813b('0x1c')](0x194);}return _0x587910;};}function handleError(_0x43fe63,_0x40ebee){_0x40ebee=_0x40ebee||0x1f4;return function(_0x3e3dd0){logger[_0x813b('0x16')](_0x3e3dd0['stack']);if(_0x3e3dd0[_0x813b('0x28')]){delete _0x3e3dd0[_0x813b('0x28')];}_0x43fe63[_0x813b('0x1d')](_0x40ebee)[_0x813b('0x29')](_0x3e3dd0);};}exports[_0x813b('0x2a')]=function(_0x5509f8,_0x55dd8d){var _0x1784f3={'include':[{'model':db[_0x813b('0x2b')],'as':_0x813b('0x2c')},{'model':db[_0x813b('0x2d')],'as':_0x813b('0x2e')},{'model':db[_0x813b('0x2f')],'as':_0x813b('0x30')}]},_0x4df64d={},_0x3da7df={'count':0x0,'rows':[]};var _0xa7d870=_['map'](db['MailAccount']['rawAttributes'],function(_0x432fe1){return{'name':_0x432fe1[_0x813b('0x31')],'type':_0x432fe1[_0x813b('0x32')][_0x813b('0x33')]};});_0x4df64d[_0x813b('0x34')]=_['map'](_0xa7d870,_0x813b('0x28'));_0x4df64d[_0x813b('0x35')]=_[_0x813b('0x36')](_0x5509f8[_0x813b('0x35')]);_0x4df64d[_0x813b('0x37')]=_[_0x813b('0x38')](_0x4df64d[_0x813b('0x34')],_0x4df64d['query']);_0x1784f3['attributes']=_[_0x813b('0x38')](_0x4df64d[_0x813b('0x34')],qs[_0x813b('0x39')](_0x5509f8[_0x813b('0x35')][_0x813b('0x39')]));_0x1784f3[_0x813b('0x3a')]=_0x1784f3[_0x813b('0x3a')][_0x813b('0x3b')]?_0x1784f3[_0x813b('0x3a')]:_0x4df64d[_0x813b('0x34')];if(!_0x5509f8[_0x813b('0x35')][_0x813b('0x3c')](_0x813b('0x3d'))){_0x1784f3[_0x813b('0x23')]=qs[_0x813b('0x23')](_0x5509f8[_0x813b('0x35')][_0x813b('0x23')]);_0x1784f3['offset']=qs[_0x813b('0x22')](_0x5509f8[_0x813b('0x35')]['offset']);}_0x1784f3[_0x813b('0x3e')]=qs[_0x813b('0x3f')](_0x5509f8['query'][_0x813b('0x3f')]);_0x1784f3[_0x813b('0x40')]=qs['filters'](_[_0x813b('0x41')](_0x5509f8[_0x813b('0x35')],_0x4df64d[_0x813b('0x37')]),_0xa7d870);if(_0x5509f8[_0x813b('0x35')]['filter']){_0x1784f3[_0x813b('0x40')]=_[_0x813b('0x42')](_0x1784f3[_0x813b('0x40')],{'$or':_[_0x813b('0x43')](_0xa7d870,function(_0x305f98){if(_0x305f98[_0x813b('0x32')]!==_0x813b('0x44')){var _0x770209={};_0x770209[_0x305f98['name']]={'$like':'%'+_0x5509f8[_0x813b('0x35')][_0x813b('0x45')]+'%'};return _0x770209;}})});}_0x1784f3=_['merge']({},_0x1784f3,_0x5509f8['options']);var _0x50ed29={'where':_0x1784f3[_0x813b('0x40')]};return db[_0x813b('0x46')][_0x813b('0x21')](_0x50ed29)[_0x813b('0x11')](function(_0xa976e2){_0x3da7df[_0x813b('0x21')]=_0xa976e2;if(_0x5509f8[_0x813b('0x35')][_0x813b('0x47')]){_0x1784f3[_0x813b('0x48')]=[{'all':!![]}];}_0x1784f3[_0x813b('0x49')]=!![];return db['MailAccount']['findAll'](_0x1784f3);})[_0x813b('0x11')](function(_0x4bd873){_0x3da7df[_0x813b('0x4a')]=_0x4bd873;return _0x3da7df;})[_0x813b('0x11')](respondWithFilteredResult(_0x55dd8d,_0x1784f3))[_0x813b('0x1b')](handleError(_0x55dd8d,null));};exports[_0x813b('0x4b')]=function(_0xfc84ef,_0x554038){var _0x2ccd24={'raw':![],'where':{'id':_0xfc84ef['params']['id']},'include':[{'model':db[_0x813b('0x2b')],'as':_0x813b('0x2c')},{'model':db[_0x813b('0x2d')],'as':_0x813b('0x2e')},{'model':db[_0x813b('0x2f')],'as':_0x813b('0x30')}]},_0x2b229f={};_0x2b229f[_0x813b('0x34')]=_[_0x813b('0x36')](db[_0x813b('0x46')][_0x813b('0x4c')]);_0x2b229f[_0x813b('0x35')]=_[_0x813b('0x36')](_0xfc84ef[_0x813b('0x35')]);_0x2b229f['filters']=_[_0x813b('0x38')](_0x2b229f[_0x813b('0x34')],_0x2b229f['query']);_0x2ccd24[_0x813b('0x3a')]=_[_0x813b('0x38')](_0x2b229f[_0x813b('0x34')],qs[_0x813b('0x39')](_0xfc84ef[_0x813b('0x35')]['fields']));_0x2ccd24[_0x813b('0x3a')]=_0x2ccd24[_0x813b('0x3a')][_0x813b('0x3b')]?_0x2ccd24['attributes']:_0x2b229f[_0x813b('0x34')];if(_0xfc84ef[_0x813b('0x35')]['includeAll']){_0x2ccd24[_0x813b('0x48')]=[{'all':!![]}];}_0x2ccd24=_[_0x813b('0x42')]({},_0x2ccd24,_0xfc84ef['options']);return db[_0x813b('0x46')][_0x813b('0x4d')](_0x2ccd24)[_0x813b('0x11')](handleEntityNotFound(_0x554038,null))[_0x813b('0x11')](respondWithResult(_0x554038,null))[_0x813b('0x1b')](handleError(_0x554038,null));};exports[_0x813b('0x24')]=function(_0x436a8d,_0x3b1807){if(_0x436a8d[_0x813b('0x4e')]['id']){delete _0x436a8d['body']['id'];}if(_0x436a8d[_0x813b('0x4e')][_0x813b('0x2c')]){if(!_0x436a8d[_0x813b('0x4e')][_0x813b('0x2c')][_0x813b('0x4f')]){_0x436a8d['body'][_0x813b('0x2c')][_0x813b('0x50')]=null;}}if(_0x436a8d[_0x813b('0x4e')][_0x813b('0x2e')]){if(_0x436a8d[_0x813b('0x4e')][_0x813b('0x2e')][_0x813b('0x4f')]){_0x436a8d[_0x813b('0x4e')][_0x813b('0x2e')][_0x813b('0x51')]=![];}else{_0x436a8d[_0x813b('0x4e')]['Smtp'][_0x813b('0x50')]=null;}}return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x436a8d['params']['id']},'include':[{'model':db[_0x813b('0x2b')],'as':_0x813b('0x2c')},{'model':db['MailServerOut'],'as':_0x813b('0x2e')},{'model':db[_0x813b('0x2f')],'as':_0x813b('0x30')}]})[_0x813b('0x11')](handleEntityNotFound(_0x3b1807,null))[_0x813b('0x11')](saveUpdates(_0x436a8d[_0x813b('0x4e')],null))[_0x813b('0x11')](function(_0x508884){if(_0x508884&&_0x436a8d[_0x813b('0x4e')]['Imap']){return db[_0x813b('0x2b')][_0x813b('0x24')](_0x436a8d['body'][_0x813b('0x2c')],{'where':{'MailAccountId':_0x508884['id']}})[_0x813b('0x11')](function(){return _0x508884;});}return _0x508884;})[_0x813b('0x11')](function(_0x1d5b44){if(_0x1d5b44&&_0x436a8d[_0x813b('0x4e')][_0x813b('0x2e')]){return db[_0x813b('0x2d')]['update'](_0x436a8d[_0x813b('0x4e')]['Smtp'],{'where':{'MailAccountId':_0x1d5b44['id']}})[_0x813b('0x11')](function(){return _0x1d5b44;});}return _0x1d5b44;})['then'](respondWithResult(_0x3b1807,null))['catch'](handleError(_0x3b1807,null));};exports[_0x813b('0x52')]=function(_0x49a33c,_0x227b10){return db['MailAccount'][_0x813b('0x52')]()[_0x813b('0x11')](respondWithResult(_0x227b10,null))['catch'](handleError(_0x227b10,null));};exports[_0x813b('0x53')]=function(_0x59934f,_0x4d3e19){if(_0x59934f[_0x813b('0x4e')]['id']){delete _0x59934f['body']['id'];}return db['MailAccount'][_0x813b('0x4d')]({'where':{'id':_0x59934f['params']['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x4d3e19,null))[_0x813b('0x11')](function(_0x2fafb9){if(_0x2fafb9){_0x59934f['body'][_0x813b('0x54')]=_0x2fafb9['id'];return db[_0x813b('0x55')][_0x813b('0x56')](_0x59934f[_0x813b('0x4e')]);}})[_0x813b('0x11')](respondWithResult(_0x4d3e19,null))[_0x813b('0x1b')](handleError(_0x4d3e19,null));};exports[_0x813b('0x57')]=function(_0x204cb5,_0x1acfe4){var _0x4b6617={'raw':![],'where':{}};var _0x166443={};var _0x522eda={'count':0x0,'rows':[]};return db['MailAccount'][_0x813b('0x58')]({'where':{'id':_0x204cb5[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x1acfe4,null))[_0x813b('0x11')](function(_0x3b5cbc){if(_0x3b5cbc){_0x166443[_0x813b('0x34')]=_[_0x813b('0x36')](db['Disposition'][_0x813b('0x4c')]);_0x166443[_0x813b('0x35')]=_[_0x813b('0x36')](_0x204cb5[_0x813b('0x35')]);_0x166443[_0x813b('0x37')]=_[_0x813b('0x38')](_0x166443[_0x813b('0x34')],_0x166443['query']);_0x4b6617['attributes']=_['intersection'](_0x166443[_0x813b('0x34')],qs['fields'](_0x204cb5[_0x813b('0x35')]['fields']));_0x4b6617[_0x813b('0x3a')]=_0x4b6617[_0x813b('0x3a')]['length']?_0x4b6617[_0x813b('0x3a')]:_0x166443[_0x813b('0x34')];if(!_0x204cb5['query'][_0x813b('0x3c')](_0x813b('0x3d'))){_0x4b6617[_0x813b('0x23')]=qs[_0x813b('0x23')](_0x204cb5[_0x813b('0x35')][_0x813b('0x23')]);_0x4b6617[_0x813b('0x22')]=qs[_0x813b('0x22')](_0x204cb5[_0x813b('0x35')][_0x813b('0x22')]);}_0x4b6617[_0x813b('0x3e')]=qs[_0x813b('0x3f')](_0x204cb5[_0x813b('0x35')][_0x813b('0x3f')]);_0x4b6617[_0x813b('0x40')]=qs[_0x813b('0x37')](_[_0x813b('0x41')](_0x204cb5['query'],_0x166443[_0x813b('0x37')]));_0x4b6617['where'][_0x813b('0x54')]=_0x3b5cbc['id'];if(_0x204cb5['query'][_0x813b('0x45')]){_0x4b6617[_0x813b('0x40')]=_[_0x813b('0x42')](_0x4b6617['where'],{'$or':_[_0x813b('0x43')](_0x4b6617[_0x813b('0x3a')],function(_0x114d6d){var _0x47ac55={};_0x47ac55[_0x114d6d]={'$like':'%'+_0x204cb5[_0x813b('0x35')][_0x813b('0x45')]+'%'};return _0x47ac55;})});}_0x4b6617=_[_0x813b('0x42')]({},_0x4b6617,_0x204cb5['options']);return db[_0x813b('0x55')][_0x813b('0x21')]({'where':_0x4b6617['where']})[_0x813b('0x11')](function(_0x4a0111){_0x522eda[_0x813b('0x21')]=_0x4a0111;if(_0x204cb5[_0x813b('0x35')][_0x813b('0x47')]){_0x4b6617[_0x813b('0x48')]=[{'all':!![]}];}return db[_0x813b('0x55')][_0x813b('0x5a')](_0x4b6617);})[_0x813b('0x11')](function(_0x512260){_0x522eda[_0x813b('0x4a')]=_0x512260;return _0x522eda;});}})[_0x813b('0x11')](respondWithFilteredResult(_0x1acfe4,_0x4b6617))[_0x813b('0x1b')](handleError(_0x1acfe4,null));};exports['removeDispositions']=function(_0x13fc53,_0x4e9ceb){return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x13fc53[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x4e9ceb,null))['then'](function(_0xd530d3){if(_0xd530d3){return _0xd530d3[_0x813b('0x5b')](_0x13fc53[_0x813b('0x35')][_0x813b('0x5c')]);}})['then'](respondWithStatusCode(_0x4e9ceb,null))[_0x813b('0x1b')](handleError(_0x4e9ceb,null));};exports[_0x813b('0x5d')]=function(_0xef7769,_0x165ed3){if(_0xef7769[_0x813b('0x4e')]['id']){delete _0xef7769['body']['id'];}return db[_0x813b('0x46')]['find']({'where':{'id':_0xef7769[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x165ed3,null))[_0x813b('0x11')](function(_0x3c3328){if(_0x3c3328){_0xef7769[_0x813b('0x4e')]['MailAccountId']=_0x3c3328['id'];return db['CannedAnswer'][_0x813b('0x56')](_0xef7769[_0x813b('0x4e')]);}})[_0x813b('0x11')](respondWithResult(_0x165ed3,null))[_0x813b('0x1b')](handleError(_0x165ed3,null));};exports[_0x813b('0x5e')]=function(_0x18b0d3,_0x3e0437){var _0x54f534={'raw':![],'where':{}};var _0x2ddaf9={};var _0x12844d={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x18b0d3[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x3e0437,null))[_0x813b('0x11')](function(_0x2a1d4d){if(_0x2a1d4d){_0x2ddaf9[_0x813b('0x34')]=_[_0x813b('0x36')](db[_0x813b('0x5f')][_0x813b('0x4c')]);_0x2ddaf9[_0x813b('0x35')]=_['keys'](_0x18b0d3[_0x813b('0x35')]);_0x2ddaf9[_0x813b('0x37')]=_[_0x813b('0x38')](_0x2ddaf9[_0x813b('0x34')],_0x2ddaf9['query']);_0x54f534[_0x813b('0x3a')]=_[_0x813b('0x38')](_0x2ddaf9[_0x813b('0x34')],qs['fields'](_0x18b0d3[_0x813b('0x35')][_0x813b('0x39')]));_0x54f534[_0x813b('0x3a')]=_0x54f534[_0x813b('0x3a')][_0x813b('0x3b')]?_0x54f534[_0x813b('0x3a')]:_0x2ddaf9['model'];if(!_0x18b0d3[_0x813b('0x35')]['hasOwnProperty'](_0x813b('0x3d'))){_0x54f534[_0x813b('0x23')]=qs[_0x813b('0x23')](_0x18b0d3['query'][_0x813b('0x23')]);_0x54f534[_0x813b('0x22')]=qs[_0x813b('0x22')](_0x18b0d3[_0x813b('0x35')][_0x813b('0x22')]);}_0x54f534[_0x813b('0x3e')]=qs['sort'](_0x18b0d3['query']['sort']);_0x54f534[_0x813b('0x40')]=qs['filters'](_[_0x813b('0x41')](_0x18b0d3[_0x813b('0x35')],_0x2ddaf9[_0x813b('0x37')]));_0x54f534['where'][_0x813b('0x54')]=_0x2a1d4d['id'];if(_0x18b0d3[_0x813b('0x35')][_0x813b('0x45')]){_0x54f534[_0x813b('0x40')]=_[_0x813b('0x42')](_0x54f534[_0x813b('0x40')],{'$or':_[_0x813b('0x43')](_0x54f534[_0x813b('0x3a')],function(_0x41cb25){var _0x57dc68={};_0x57dc68[_0x41cb25]={'$like':'%'+_0x18b0d3['query'][_0x813b('0x45')]+'%'};return _0x57dc68;})});}_0x54f534=_['merge']({},_0x54f534,_0x18b0d3['options']);return db[_0x813b('0x5f')][_0x813b('0x21')]({'where':_0x54f534[_0x813b('0x40')]})[_0x813b('0x11')](function(_0x57c99e){_0x12844d[_0x813b('0x21')]=_0x57c99e;if(_0x18b0d3[_0x813b('0x35')]['includeAll']){_0x54f534[_0x813b('0x48')]=[{'all':!![]}];}return db['CannedAnswer'][_0x813b('0x5a')](_0x54f534);})[_0x813b('0x11')](function(_0x2e7cd0){_0x12844d[_0x813b('0x4a')]=_0x2e7cd0;return _0x12844d;});}})[_0x813b('0x11')](respondWithFilteredResult(_0x3e0437,_0x54f534))[_0x813b('0x1b')](handleError(_0x3e0437,null));};exports[_0x813b('0x60')]=function(_0x51de05,_0x2c6ad1){return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x51de05[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x2c6ad1,null))['then'](function(_0x3834d9){if(_0x3834d9){return _0x3834d9['removeAnswers'](_0x51de05[_0x813b('0x35')][_0x813b('0x5c')]);}})[_0x813b('0x11')](respondWithStatusCode(_0x2c6ad1,null))[_0x813b('0x1b')](handleError(_0x2c6ad1,null));};function getImapHost(_0x17e2af){switch(_0x17e2af){case _0x813b('0x61'):return _0x813b('0x62');case'yahoo':return _0x813b('0x63');case'hotmail':return _0x813b('0x64');case _0x813b('0x65'):return _0x813b('0x66');}throw new Error(_0x813b('0x67'),_0x17e2af);}function getSmtpHost(_0x24b4f5){switch(_0x24b4f5){case _0x813b('0x61'):return _0x813b('0x68');case _0x813b('0x69'):return _0x813b('0x6a');case _0x813b('0x6b'):return'smtp-mail.outlook.com';case _0x813b('0x65'):return _0x813b('0x6c');}throw new Error('Unknown\x20email\x20service\x20provider',_0x24b4f5);}function getSmtpPort(_0x2fa3f6,_0x4c4248){switch(_0x2fa3f6){case _0x813b('0x61'):return _0x4c4248===!![]?0x24b:0x1d1;case'yahoo':return 0x1d1;case _0x813b('0x6b'):return 0x24b;case _0x813b('0x65'):return 0x24b;}throw new Error(_0x813b('0x67'),_0x2fa3f6);}function getAuthenticationOptions(_0x189cf7,_0x1db6a6){var _0x445cd0={};var _0x9dcaae={};if(_0x189cf7){_0x445cd0[_0x813b('0x6d')]=_0x9dcaae[_0x813b('0x6d')]=_0x1db6a6['username'];_0x445cd0['password']=_0x9dcaae[_0x813b('0x6e')]=_0x1db6a6[_0x813b('0x6f')];if(_0x1db6a6[_0x813b('0x4f')]){_0x445cd0['modernAuthentication']=_0x9dcaae[_0x813b('0x4f')]=!![];_0x445cd0[_0x813b('0x50')]=_0x9dcaae[_0x813b('0x50')]=_0x1db6a6['CloudProviderId'];_0x445cd0[_0x813b('0x6f')]=_0x9dcaae['pass']=null;}else{_0x445cd0[_0x813b('0x50')]=_0x9dcaae['CloudProviderId']=null;}_0x445cd0[_0x813b('0x70')]=getImapHost(_0x189cf7);_0x445cd0['port']=0x3e1;_0x9dcaae['host']=getSmtpHost(_0x189cf7);_0x9dcaae[_0x813b('0x71')]=getSmtpPort(_0x189cf7,_0x9dcaae[_0x813b('0x51')]);_0x445cd0[_0x813b('0x72')]=_0x9dcaae['service']=null;}else{if(_0x1db6a6[_0x813b('0x73')]){_0x445cd0['user']=_0x9dcaae['user']=_0x1db6a6[_0x813b('0x74')];_0x445cd0['password']=_0x9dcaae[_0x813b('0x6e')]=_0x1db6a6[_0x813b('0x6f')];}else{_0x445cd0[_0x813b('0x73')]=_0x9dcaae[_0x813b('0x73')]=![];_0x445cd0[_0x813b('0x6d')]=_0x9dcaae[_0x813b('0x6d')]=null;_0x445cd0[_0x813b('0x6f')]=_0x9dcaae[_0x813b('0x6e')]=null;}_0x445cd0[_0x813b('0x70')]=_0x1db6a6[_0x813b('0x2c')][_0x813b('0x70')];_0x445cd0[_0x813b('0x71')]=_0x1db6a6[_0x813b('0x2c')]['port'];_0x9dcaae['host']=_0x1db6a6['Smtp'][_0x813b('0x70')];_0x9dcaae[_0x813b('0x71')]=_0x1db6a6[_0x813b('0x2e')][_0x813b('0x71')];}return{'Imap':_0x445cd0,'Smtp':_0x9dcaae};}exports[_0x813b('0x56')]=function(_0x36239e,_0x612571){var _0x42db2e={'name':_0x36239e['body'][_0x813b('0x28')],'key':_0x36239e[_0x813b('0x4e')][_0x813b('0x33')],'provider':_0x36239e[_0x813b('0x4e')][_0x813b('0x75')]===_0x813b('0x76')?null:_0x36239e[_0x813b('0x4e')]['provider'],'email':_0x36239e['body'][_0x813b('0x77')],'ListId':_0x36239e['body'][_0x813b('0x78')],'active':!_[_0x813b('0x79')](_0x36239e['body'][_0x813b('0x7a')])?_0x36239e['body'][_0x813b('0x7a')]:!![],'description':_0x36239e[_0x813b('0x4e')][_0x813b('0x7b')]||null};var _0x47f525=getAuthenticationOptions(_0x42db2e['provider'],_0x36239e[_0x813b('0x4e')]);_0x42db2e[_0x813b('0x2c')]=_0x47f525['Imap'];_0x42db2e[_0x813b('0x2e')]=_0x47f525[_0x813b('0x2e')];return db[_0x813b('0x46')][_0x813b('0x56')](_0x42db2e,{'include':[{'model':db[_0x813b('0x2d')],'as':'Smtp'},{'model':db[_0x813b('0x2b')],'as':_0x813b('0x2c')}]})[_0x813b('0x11')](function(_0x147e77){var _0x3bfe73=_0x36239e[_0x813b('0x6d')][_0x813b('0x25')]({'plain':!![]});if(!_0x3bfe73)throw new Error(_0x813b('0x7c'));if(_0x3bfe73[_0x813b('0x7d')]==='user'){var _0x3b3775=_0x147e77['get']({'plain':!![]});return db[_0x813b('0x7e')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x3bfe73[_0x813b('0x7f')]},'raw':!![]})[_0x813b('0x11')](function(_0x1507da){if(_0x1507da&&_0x1507da[_0x813b('0x80')]===0x0){return db[_0x813b('0x27')][_0x813b('0x56')]({'name':_0x3b3775[_0x813b('0x28')],'resourceId':_0x3b3775['id'],'type':_0x1507da[_0x813b('0x28')],'sectionId':_0x1507da['id']},{})[_0x813b('0x11')](function(){return _0x147e77;});}else{return _0x147e77;}})['catch'](function(_0x2369d9){logger[_0x813b('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2369d9);throw _0x2369d9;});}return _0x147e77;})[_0x813b('0x11')](respondWithResult(_0x612571,0xc9))[_0x813b('0x1b')](handleError(_0x612571,null));};exports[_0x813b('0x81')]=function(_0x53e191,_0x58611b){return db[_0x813b('0x46')][_0x813b('0x58')]({'where':{'id':_0x53e191[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x58611b,null))[_0x813b('0x11')](function(_0x32d16c){if(_0x32d16c){return _0x32d16c[_0x813b('0x81')]();}return null;})[_0x813b('0x11')](respondWithResult(_0x58611b,null))['catch'](handleError(_0x58611b,null));};exports[_0x813b('0x82')]=function(_0x3d4658,_0x6fd152){if(_0x3d4658[_0x813b('0x4e')]['id']){delete _0x3d4658[_0x813b('0x4e')]['id'];}return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x3d4658[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x6fd152,null))[_0x813b('0x11')](function(_0x42e7b0){if(_0x42e7b0){_0x3d4658[_0x813b('0x4e')][_0x813b('0x54')]=_0x42e7b0['id'];return db[_0x813b('0x2b')][_0x813b('0x56')](_0x3d4658[_0x813b('0x4e')]);}})[_0x813b('0x11')](respondWithResult(_0x6fd152,null))[_0x813b('0x1b')](handleError(_0x6fd152,null));};exports[_0x813b('0x83')]=function(_0x3c6ee4,_0x36e8e5){return db[_0x813b('0x46')][_0x813b('0x58')]({'where':{'id':_0x3c6ee4['params']['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x36e8e5,null))[_0x813b('0x11')](function(_0x33e6a5){if(_0x33e6a5){return _0x33e6a5[_0x813b('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x36e8e5,null))[_0x813b('0x1b')](handleError(_0x36e8e5,null));};exports[_0x813b('0x85')]=function(_0x4ead3f,_0x2f8e3d){return db['MailAccount'][_0x813b('0x58')]({'where':{'id':_0x4ead3f[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x2f8e3d,null))[_0x813b('0x11')](function(_0x50dd40){if(_0x50dd40){return _0x50dd40[_0x813b('0x85')]();}return null;})[_0x813b('0x11')](respondWithResult(_0x2f8e3d,null))[_0x813b('0x1b')](handleError(_0x2f8e3d,null));};exports[_0x813b('0x86')]=function(_0x18268b,_0x20ace4){if(_0x18268b[_0x813b('0x4e')]['id']){delete _0x18268b[_0x813b('0x4e')]['id'];}return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x18268b['params']['id']}})['then'](handleEntityNotFound(_0x20ace4,null))[_0x813b('0x11')](function(_0xc0f570){if(_0xc0f570){_0x18268b[_0x813b('0x4e')][_0x813b('0x54')]=_0xc0f570['id'];return db[_0x813b('0x2d')]['create'](_0x18268b['body']);}})[_0x813b('0x11')](respondWithResult(_0x20ace4,null))[_0x813b('0x1b')](handleError(_0x20ace4,null));};exports['removeSmtp']=function(_0x5d302c,_0x30b7c8){return db[_0x813b('0x46')][_0x813b('0x58')]({'where':{'id':_0x5d302c[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x30b7c8,null))[_0x813b('0x11')](function(_0x554cf5){if(_0x554cf5){return _0x554cf5[_0x813b('0x87')](null);}return null;})[_0x813b('0x11')](respondWithStatusCode(_0x30b7c8,null))[_0x813b('0x1b')](handleError(_0x30b7c8,null));};exports[_0x813b('0x88')]=function(_0x3314f5,_0x1bca64){return db[_0x813b('0x89')]['find']({'where':{'id':_0x3314f5[_0x813b('0x59')]['id']}})['then'](handleEntityNotFound(_0x1bca64,null))[_0x813b('0x11')](function(_0x3451f2){if(_0x3451f2){return _0x3451f2['addInteraction'](_0x3314f5['body'][_0x813b('0x5c')],_[_0x813b('0x8a')](_0x3314f5[_0x813b('0x4e')],[_0x813b('0x5c'),'id'])||{});}})[_0x813b('0x11')](respondWithResult(_0x1bca64,null))[_0x813b('0x1b')](handleError(_0x1bca64,null));};exports[_0x813b('0x8b')]=function(_0x387688,_0xf1ef0a){var _0x2538bb={'raw':![],'where':{}};var _0x4d1114={};var _0x34635c={'count':0x0,'rows':[]};return db['MailAccount'][_0x813b('0x58')]({'where':{'id':_0x387688[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0xf1ef0a,null))['then'](function(_0x2f91ad){if(_0x2f91ad){_0x4d1114['model']=_[_0x813b('0x36')](db['MailInteraction'][_0x813b('0x4c')]);_0x4d1114[_0x813b('0x35')]=_[_0x813b('0x36')](_0x387688[_0x813b('0x35')]);_0x4d1114[_0x813b('0x37')]=_[_0x813b('0x38')](_0x4d1114['model'],_0x4d1114[_0x813b('0x35')]);_0x2538bb[_0x813b('0x3a')]=_[_0x813b('0x38')](_0x4d1114[_0x813b('0x34')],qs[_0x813b('0x39')](_0x387688[_0x813b('0x35')][_0x813b('0x39')]));_0x2538bb[_0x813b('0x3a')]=_0x2538bb[_0x813b('0x3a')][_0x813b('0x3b')]?_0x2538bb[_0x813b('0x3a')]:_0x4d1114[_0x813b('0x34')];if(!_0x387688[_0x813b('0x35')]['hasOwnProperty'](_0x813b('0x3d'))){_0x2538bb[_0x813b('0x23')]=qs[_0x813b('0x23')](_0x387688[_0x813b('0x35')][_0x813b('0x23')]);_0x2538bb[_0x813b('0x22')]=qs[_0x813b('0x22')](_0x387688[_0x813b('0x35')][_0x813b('0x22')]);}_0x2538bb['order']=qs[_0x813b('0x3f')](_0x387688[_0x813b('0x35')][_0x813b('0x3f')]);_0x2538bb['where']=qs[_0x813b('0x37')](_[_0x813b('0x41')](_0x387688['query'],_0x4d1114[_0x813b('0x37')]));_0x2538bb[_0x813b('0x40')][_0x813b('0x54')]=_0x2f91ad['id'];if(_0x387688[_0x813b('0x35')][_0x813b('0x45')]){_0x2538bb[_0x813b('0x40')]=_['merge'](_0x2538bb[_0x813b('0x40')],{'$or':_['map'](_0x2538bb[_0x813b('0x3a')],function(_0x40e494){var _0x2604a9={};_0x2604a9[_0x40e494]={'$like':'%'+_0x387688['query'][_0x813b('0x45')]+'%'};return _0x2604a9;})});}_0x2538bb=_['merge']({},_0x2538bb,_0x387688['options']);return db[_0x813b('0x89')]['count']({'where':_0x2538bb['where']})[_0x813b('0x11')](function(_0x5a7359){_0x34635c[_0x813b('0x21')]=_0x5a7359;if(_0x387688[_0x813b('0x35')][_0x813b('0x47')]){_0x2538bb['include']=[{'model':db[_0x813b('0x8c')],'as':'Contact','required':![]},{'model':db[_0x813b('0x8d')],'as':_0x813b('0x8e'),'attributes':[_0x813b('0x28'),'fullname','internal'],'required':![]},{'model':db[_0x813b('0x8f')],'as':_0x813b('0x90'),'attributes':['id',_0x813b('0x28'),_0x813b('0x91')],'where':_0x387688[_0x813b('0x35')][_0x813b('0x92')]?{'id':_0x387688[_0x813b('0x35')][_0x813b('0x92')]}:undefined,'required':_0x387688[_0x813b('0x35')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x813b('0x5a')](_0x2538bb);})[_0x813b('0x11')](function(_0x3d3233){_0x34635c['rows']=_0x3d3233;return _0x34635c;});}})[_0x813b('0x11')](respondWithFilteredResult(_0xf1ef0a,_0x2538bb))[_0x813b('0x1b')](handleError(_0xf1ef0a,null));};exports[_0x813b('0x93')]=function addApplications(_0x3d8086,_0x1e9c43){var _0x5ad4af=_0x3d8086['params']['id'];var _0x1f441c=_0x3d8086[_0x813b('0x4e')];var _0x1480a7=0xc8;var _0x1db2ed=null;return db['sequelize'][_0x813b('0x94')]({'isolationLevel':db[_0x813b('0x95')][_0x813b('0x96')][_0x813b('0x97')][_0x813b('0x98')]},function(_0x142733){return db[_0x813b('0x46')]['findOne']({'where':{'id':_0x5ad4af},'transaction':_0x142733})[_0x813b('0x11')](function(_0x53cf0e){if(_0x53cf0e){return db[_0x813b('0x99')]['destroy']({'where':{'MailAccountId':_0x5ad4af},'transaction':_0x142733})[_0x813b('0x11')](function(){var _0x2e8594=_[_0x813b('0x43')](_0x1f441c,function(_0x5196bf){_0x5196bf[_0x813b('0x54')]=_0x5ad4af;return _0x5196bf;});return db['MailApplication'][_0x813b('0x9a')](_0x2e8594,{'transaction':_0x142733});});}else{_0x1480a7=0x194;_0x1db2ed=[];}});})[_0x813b('0x11')](function(){if(_0x1480a7!==0x194){return db[_0x813b('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0x5ad4af},'order':_0x813b('0x9b')})[_0x813b('0x11')](function(_0x52ecaf){_0x1db2ed=_0x52ecaf;});}})[_0x813b('0x1b')](function(_0x1aed1c){_0x1480a7=0x1f4;logger[_0x813b('0x16')](_0x1aed1c[_0x813b('0x9c')]);if(_0x1aed1c[_0x813b('0x28')]){delete _0x1aed1c[_0x813b('0x28')];}_0x1db2ed=_0x1aed1c;})[_0x813b('0x9d')](function(){if(_0x1db2ed===null){_0x1e9c43[_0x813b('0x1c')](_0x1480a7);}else{if(_0x1480a7===0x1f4){_0x1e9c43[_0x813b('0x1d')](_0x1480a7)[_0x813b('0x29')](_0x1db2ed);}else{_0x1e9c43[_0x813b('0x1d')](_0x1480a7)[_0x813b('0x1f')](_0x1db2ed);}}});};exports['getApplications']=function(_0x3faa1b,_0x3a4542){var _0x24d9d6={};var _0x11b977={};var _0x3c8c48;var _0x5cedbd;return db[_0x813b('0x46')][_0x813b('0x58')]({'where':{'id':_0x3faa1b[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x3a4542,null))[_0x813b('0x11')](function(_0x504864){if(_0x504864){_0x3c8c48=_0x504864;_0x11b977[_0x813b('0x34')]=_[_0x813b('0x36')](db['MailApplication'][_0x813b('0x4c')]);_0x11b977[_0x813b('0x35')]=_[_0x813b('0x36')](_0x3faa1b[_0x813b('0x35')]);_0x11b977['filters']=_[_0x813b('0x38')](_0x11b977['model'],_0x11b977[_0x813b('0x35')]);_0x24d9d6[_0x813b('0x3a')]=_[_0x813b('0x38')](_0x11b977['model'],qs[_0x813b('0x39')](_0x3faa1b[_0x813b('0x35')]['fields']));_0x24d9d6[_0x813b('0x3a')]=_0x24d9d6['attributes'][_0x813b('0x3b')]?_0x24d9d6['attributes']:_0x11b977[_0x813b('0x34')];_0x24d9d6['order']=qs[_0x813b('0x3f')](_0x3faa1b[_0x813b('0x35')][_0x813b('0x3f')]);_0x24d9d6[_0x813b('0x40')]=qs['filters'](_['pick'](_0x3faa1b[_0x813b('0x35')],_0x11b977[_0x813b('0x37')]));if(_0x3faa1b[_0x813b('0x35')]['filter']){_0x24d9d6['where']=_[_0x813b('0x42')](_0x24d9d6[_0x813b('0x40')],{'$or':_[_0x813b('0x43')](_0x24d9d6[_0x813b('0x3a')],function(_0x427a94){var _0x463049={};_0x463049[_0x427a94]={'$like':'%'+_0x3faa1b[_0x813b('0x35')][_0x813b('0x45')]+'%'};return _0x463049;})});}_0x24d9d6=_[_0x813b('0x42')]({},_0x24d9d6,_0x3faa1b[_0x813b('0x9e')]);return _0x3c8c48[_0x813b('0x9f')](_0x24d9d6);}})['then'](function(_0x56d60d){if(_0x56d60d){_0x5cedbd=_0x56d60d[_0x813b('0x3b')];if(!_0x3faa1b[_0x813b('0x35')][_0x813b('0x3c')](_0x813b('0x3d'))){_0x24d9d6[_0x813b('0x23')]=qs[_0x813b('0x23')](_0x3faa1b[_0x813b('0x35')][_0x813b('0x23')]);_0x24d9d6[_0x813b('0x22')]=qs[_0x813b('0x22')](_0x3faa1b[_0x813b('0x35')][_0x813b('0x22')]);}return _0x3c8c48['getApplications'](_0x24d9d6);}})['then'](function(_0x5a0787){if(_0x5a0787){return _0x5a0787?{'count':_0x5cedbd,'rows':_0x5a0787}:null;}})[_0x813b('0x11')](respondWithResult(_0x3a4542,null))[_0x813b('0x1b')](handleError(_0x3a4542,null));};exports[_0x813b('0xa0')]=function(_0xa5f10f,_0x51a273){var _0x27b467={'raw':!![],'where':{}};var _0x4682fa={};var _0x3a1217={'count':0x0,'rows':[]};return db[_0x813b('0x46')][_0x813b('0x58')]({'where':{'id':_0xa5f10f[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x51a273,null))['then'](function(_0xb55c34){if(_0xb55c34){_0x4682fa[_0x813b('0x34')]=_[_0x813b('0x36')](db[_0x813b('0xa1')][_0x813b('0x4c')]);_0x4682fa[_0x813b('0x35')]=_['keys'](_0xa5f10f[_0x813b('0x35')]);_0x4682fa['filters']=_[_0x813b('0x38')](_0x4682fa['model'],_0x4682fa['query']);_0x27b467[_0x813b('0x3a')]=_['intersection'](_0x4682fa[_0x813b('0x34')],qs['fields'](_0xa5f10f[_0x813b('0x35')]['fields']));_0x27b467[_0x813b('0x3a')]=_0x27b467[_0x813b('0x3a')][_0x813b('0x3b')]?_0x27b467[_0x813b('0x3a')]:_0x4682fa[_0x813b('0x34')];if(!_0xa5f10f[_0x813b('0x35')][_0x813b('0x3c')](_0x813b('0x3d'))){_0x27b467[_0x813b('0x23')]=qs['limit'](_0xa5f10f[_0x813b('0x35')][_0x813b('0x23')]);_0x27b467[_0x813b('0x22')]=qs[_0x813b('0x22')](_0xa5f10f[_0x813b('0x35')][_0x813b('0x22')]);}_0x27b467[_0x813b('0x3e')]=qs[_0x813b('0x3f')](_0xa5f10f[_0x813b('0x35')]['sort']);_0x27b467['where']=qs[_0x813b('0x37')](_['pick'](_0xa5f10f[_0x813b('0x35')],_0x4682fa[_0x813b('0x37')]));_0x27b467[_0x813b('0x40')]['MailAccountId']=_0xb55c34['id'];if(_0xa5f10f[_0x813b('0x35')][_0x813b('0x45')]){_0x27b467[_0x813b('0x40')]=_[_0x813b('0x42')](_0x27b467[_0x813b('0x40')],{'$or':_['map'](_0x27b467[_0x813b('0x3a')],function(_0x806bb4){var _0x2f4a39={};_0x2f4a39[_0x806bb4]={'$like':'%'+_0xa5f10f[_0x813b('0x35')][_0x813b('0x45')]+'%'};return _0x2f4a39;})});}if(_0xa5f10f[_0x813b('0x35')][_0x813b('0xa2')]){var _0x553bd2=_0xa5f10f['query']['$gte'][_0x813b('0xa3')](',');var _0x38b762={};_0x38b762[_0x553bd2[0x0]]={'$gte':moment(_0x553bd2[0x1])[_0x813b('0xa4')](_0x813b('0xa5'))};_0x27b467[_0x813b('0x40')]=_['merge'](_0x27b467[_0x813b('0x40')],_0x38b762);}_0x27b467=_['merge']({},_0x27b467,_0xa5f10f[_0x813b('0x9e')]);return db['MailMessage'][_0x813b('0x21')]({'where':_0x27b467[_0x813b('0x40')]})[_0x813b('0x11')](function(_0x55cd74){_0x3a1217[_0x813b('0x21')]=_0x55cd74;if(_0xa5f10f[_0x813b('0x35')][_0x813b('0x47')]){_0x27b467[_0x813b('0x48')]=[{'all':!![]}];}return db[_0x813b('0xa1')][_0x813b('0x5a')](_0x27b467);})['then'](function(_0x431af0){if(_0xa5f10f[_0x813b('0x35')][_0x813b('0xa6')]===_0x813b('0xa7')){for(var _0x7ea94f=0x0;_0x7ea94f<_0x431af0['length'];_0x7ea94f++){_0x431af0[_0x7ea94f][_0x813b('0x4e')]=juice(_0x431af0[_0x7ea94f]['body']);}}_0x3a1217[_0x813b('0x4a')]=_0x431af0;return _0x3a1217;});}})[_0x813b('0x11')](respondWithFilteredResult(_0x51a273,_0x27b467))[_0x813b('0x1b')](handleError(_0x51a273,null));};exports[_0x813b('0x29')]=function(_0x40c94f,_0x4bfb70){var _0x5400e3,_0x50a0e9={},_0x354152;if(_0x40c94f[_0x813b('0x4e')]['to']){_0x354152=_0x40c94f[_0x813b('0x4e')]['to'][_0x813b('0xa3')](',')[0x0];}return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x40c94f[_0x813b('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x813b('0xa8'),'include':[{'model':db[_0x813b('0x8c')],'as':_0x813b('0xa9'),'where':{'email':_0x354152},'limit':0x1,'order':[[_0x813b('0xaa'),_0x813b('0xab')]]}]},{'model':db['MailServerOut'],'as':_0x813b('0x2e'),'raw':!![],'include':[{'model':db[_0x813b('0xac')],'as':'CloudProvider','raw':!![]}]}]})[_0x813b('0x11')](handleEntityNotFound(_0x4bfb70,null))[_0x813b('0x11')](function(_0x215490){if(!_0x215490)return;_0x5400e3=_0x215490;if(!_0x215490[_0x813b('0x2e')])throw new Error(_0x813b('0xad'));if(_['isNil'](_0x40c94f[_0x813b('0x4e')][_0x813b('0xae')])){_0x40c94f['body'][_0x813b('0xae')]=util[_0x813b('0xa4')]('%s\x20<%s>',_0x215490['name'],_0x215490[_0x813b('0x77')]||_0x215490[_0x813b('0x2e')][_0x813b('0x6d')]);}if(_0x40c94f['body'][_0x813b('0xaf')]&&_0x40c94f['body'][_0x813b('0xaf')][_0x813b('0x3b')]){for(var _0x55e9a9=0x0;_0x55e9a9<_0x40c94f[_0x813b('0x4e')][_0x813b('0xaf')]['length'];_0x55e9a9+=0x1){_0x40c94f[_0x813b('0x4e')][_0x813b('0xaf')][_0x55e9a9]={'filename':_0x40c94f[_0x813b('0x4e')][_0x813b('0xaf')][_0x55e9a9][_0x813b('0x28')],'path':path['join'](config[_0x813b('0xb0')],_0x813b('0xb1'),_0x40c94f[_0x813b('0x4e')][_0x813b('0xaf')][_0x55e9a9][_0x813b('0xb2')])};}}var _0x45cecc=_0x215490[_0x813b('0xb3')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x45cecc,'message':_0x40c94f['body']});})['then'](function(_0x3b53c9){if(!_0x3b53c9)return;_0x50a0e9=_0x3b53c9;if(!_0x5400e3[_0x813b('0xa8')])throw new Error('List\x20not\x20found');if(_0x5400e3[_0x813b('0xa8')][_0x813b('0xa9')]['length'])return _0x5400e3[_0x813b('0xa8')][_0x813b('0xa9')][0x0];return db['CmContact'][_0x813b('0x56')](_[_0x813b('0xb4')](_0x40c94f[_0x813b('0x4e')],{'firstName':_0x40c94f[_0x813b('0x4e')]['to'],'email':_0x40c94f['body']['to'],'phone':_0x40c94f[_0x813b('0x4e')]['to'],'ListId':_0x5400e3[_0x813b('0x78')]}));})[_0x813b('0x11')](function(_0x14c8b5){if(!_0x14c8b5)return;var _0x1f2c12={'UserId':_0x40c94f[_0x813b('0x6d')]['id'],'ContactId':_0x14c8b5['id'],'MailAccountId':_0x5400e3['id'],'inReplyTo':_0x50a0e9['messageId'],'to':_0x40c94f['body'][_0x813b('0xae')],'cc':_0x40c94f[_0x813b('0x4e')]['cc'],'subject':_0x40c94f[_0x813b('0x4e')][_0x813b('0xb5')],'attach':_0x40c94f[_0x813b('0x4e')][_0x813b('0xb6')],'firstMsgDirection':_0x813b('0xb7'),'lastMsgAt':moment()[_0x813b('0xa4')](_0x813b('0xa5')),'lastMsgDirection':_0x813b('0xb7'),'Messages':[_['merge'](_0x40c94f[_0x813b('0x4e')],{'messageId':_0x50a0e9[_0x813b('0xb8')],'sentAt':moment()[_0x813b('0xa4')](_0x813b('0xa5')),'read':!![],'MailAccountId':_0x5400e3['id'],'UserId':_0x40c94f['user']['id'],'ContactId':_0x14c8b5['id']})]};if(_0x40c94f[_0x813b('0x4e')][_0x813b('0xb9')]){_0x1f2c12=_[_0x813b('0x42')](_0x1f2c12,_0x40c94f[_0x813b('0x4e')]['Interaction']);}return db['MailInteraction'][_0x813b('0x56')](_0x1f2c12,{'include':[{'model':db[_0x813b('0xa1')],'as':_0x813b('0xba')}]});})['then'](respondWithResult(_0x4bfb70,null))[_0x813b('0x1b')](handleError(_0x4bfb70,null));};exports[_0x813b('0xbb')]=function(_0x5dcec5,_0x193e27){return db['MailAccount'][_0x813b('0x4d')]({'where':{'id':_0x5dcec5[_0x813b('0x59')]['id']},'include':[{'model':db[_0x813b('0x2d')],'as':_0x813b('0x2e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x813b('0xac'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x193e27,null))[_0x813b('0x11')](function(_0xaacb96){if(!_0xaacb96['Smtp'])return;var _0x5b8cf0=_0xaacb96[_0x813b('0xb3')]();return respondWithRpcPromise(_0x813b('0xbc'),_0x813b('0xbb'),{'account':_0x5b8cf0});})[_0x813b('0x11')](respondWithResult(_0x193e27,null))[_0x813b('0x1b')](handleError(_0x193e27,null));};exports['destroy']=function(_0x30f652,_0x4957f6){return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x30f652[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x4957f6,null))[_0x813b('0x11')](function(_0x2e5cc9){if(_0x2e5cc9&&_0x2e5cc9[_0x813b('0x72')]){throw new db['Sequelize'][(_0x813b('0xbd'))](_0x813b('0xbe'));}return _0x2e5cc9;})[_0x813b('0x11')](removeEntity(_0x4957f6,null))['catch'](handleError(_0x4957f6,null));};exports[_0x813b('0xbf')]=function(_0x4426d3,_0x3c3668){return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0x4426d3[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x3c3668,null))[_0x813b('0x11')](function(_0x1b3c2b){if(_0x1b3c2b){return _0x1b3c2b['addAgents'](_0x4426d3[_0x813b('0x4e')][_0x813b('0x5c')],_[_0x813b('0x8a')](_0x4426d3[_0x813b('0x4e')],[_0x813b('0x5c'),'id'])||{})[_0x813b('0xc0')](function(_0x5bbdfd){for(var _0x1b42b7=0x0;_0x1b42b7<_0x4426d3['body'][_0x813b('0x5c')][_0x813b('0x3b')];_0x1b42b7+=0x1){socket['emit'](_0x813b('0xc1'),{'UserId':Number(_0x4426d3[_0x813b('0x4e')][_0x813b('0x5c')][_0x1b42b7]),'MailAccountId':Number(_0x4426d3[_0x813b('0x59')]['id'])});}return _0x5bbdfd;});}})[_0x813b('0x11')](respondWithResult(_0x3c3668,null))[_0x813b('0x1b')](handleError(_0x3c3668,null));};exports['removeAgents']=function(_0xc13966,_0x397d1b){return db[_0x813b('0x46')][_0x813b('0x4d')]({'where':{'id':_0xc13966['params']['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x397d1b,null))[_0x813b('0x11')](function(_0x239fee){if(_0x239fee){return _0x239fee[_0x813b('0xc2')](_0xc13966[_0x813b('0x35')]['ids'])[_0x813b('0x11')](function(){if(_[_0x813b('0xc3')](_0xc13966['query'][_0x813b('0x5c')])){for(var _0x5700ee=0x0;_0x5700ee<_0xc13966[_0x813b('0x35')][_0x813b('0x5c')][_0x813b('0x3b')];_0x5700ee+=0x1){socket[_0x813b('0xc4')]('userMailAccount:remove',{'UserId':Number(_0xc13966['query'][_0x813b('0x5c')][_0x5700ee]),'MailAccountId':Number(_0xc13966[_0x813b('0x59')]['id'])});}}else{socket['emit'](_0x813b('0xc5'),{'UserId':Number(_0xc13966[_0x813b('0x35')]['ids']),'MailAccountId':Number(_0xc13966[_0x813b('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x397d1b,null))[_0x813b('0x1b')](handleError(_0x397d1b,null));};exports[_0x813b('0xc6')]=function(_0x49956c,_0x4b9247){var _0x5674cc={};var _0x417c3b={};var _0x5ca8eb;var _0x59826a;return db['MailAccount'][_0x813b('0x58')]({'where':{'id':_0x49956c[_0x813b('0x59')]['id']}})[_0x813b('0x11')](handleEntityNotFound(_0x4b9247,null))[_0x813b('0x11')](function(_0x5ef703){if(_0x5ef703){_0x5ca8eb=_0x5ef703;_0x417c3b['model']=_[_0x813b('0x36')](db[_0x813b('0x8d')][_0x813b('0x4c')]);_0x417c3b[_0x813b('0x35')]=_[_0x813b('0x36')](_0x49956c[_0x813b('0x35')]);_0x417c3b[_0x813b('0x37')]=_['intersection'](_0x417c3b[_0x813b('0x34')],_0x417c3b[_0x813b('0x35')]);_0x5674cc[_0x813b('0x3a')]=_[_0x813b('0x38')](_0x417c3b[_0x813b('0x34')],qs[_0x813b('0x39')](_0x49956c[_0x813b('0x35')][_0x813b('0x39')]));_0x5674cc[_0x813b('0x3a')]=_0x5674cc[_0x813b('0x3a')][_0x813b('0x3b')]?_0x5674cc['attributes']:_0x417c3b[_0x813b('0x34')];_0x5674cc[_0x813b('0x3e')]=qs[_0x813b('0x3f')](_0x49956c[_0x813b('0x35')]['sort']);_0x5674cc[_0x813b('0x40')]=qs['filters'](_['pick'](_0x49956c[_0x813b('0x35')],_0x417c3b[_0x813b('0x37')]));if(_0x49956c[_0x813b('0x35')]['filter']){_0x5674cc[_0x813b('0x40')]=_[_0x813b('0x42')](_0x5674cc[_0x813b('0x40')],{'$or':_['map'](_0x5674cc['attributes'],function(_0x191cd9){var _0x165ec5={};_0x165ec5[_0x191cd9]={'$like':'%'+_0x49956c[_0x813b('0x35')][_0x813b('0x45')]+'%'};return _0x165ec5;})});}_0x5674cc=_[_0x813b('0x42')]({},_0x5674cc,_0x49956c[_0x813b('0x9e')]);return _0x5ca8eb[_0x813b('0xc6')](_0x5674cc);}})[_0x813b('0x11')](function(_0xc553a1){if(_0xc553a1){_0x59826a=_0xc553a1['length'];if(!_0x49956c[_0x813b('0x35')]['hasOwnProperty']('nolimit')){_0x5674cc['limit']=qs[_0x813b('0x23')](_0x49956c['query'][_0x813b('0x23')]);_0x5674cc[_0x813b('0x22')]=qs[_0x813b('0x22')](_0x49956c[_0x813b('0x35')][_0x813b('0x22')]);}return _0x5ca8eb[_0x813b('0xc6')](_0x5674cc);}})[_0x813b('0x11')](function(_0x23749b){if(_0x23749b){return _0x23749b?{'count':_0x59826a,'rows':_0x23749b}:null;}})[_0x813b('0x11')](respondWithResult(_0x4b9247,null))[_0x813b('0x1b')](handleError(_0x4b9247,null));}; \ No newline at end of file +var _0x5ae2=['email','ListId','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','juice','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','http','request','then','info','request\x20sent','debug','error','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','stack','name','send','index','MailServerOut','Smtp','Pause','map','MailAccount','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','MailServerIn','Imap','mandatoryDispositionPause','rawAttributes','find','body','modernAuthentication','secure','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','smtp.gmail.com','hotmail','smtp-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','user','username','password','pass','CloudProviderId','port','host','service','authentication','key','provider','custom'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5ae2,0x104));var _0x25ae=function(_0x2ac756,_0x33408b){_0x2ac756=_0x2ac756-0x0;var _0xa621fb=_0x5ae2[_0x2ac756];return _0xa621fb;};'use strict';var moment=require(_0x25ae('0x0'));var BPromise=require('bluebird');var util=require(_0x25ae('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0x25ae('0x2'));var Redis=require(_0x25ae('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x25ae('0x4'))('api');var config=require(_0x25ae('0x5'));var db=require(_0x25ae('0x6'))['db'];config[_0x25ae('0x7')]=_['defaults'](config[_0x25ae('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x25ae('0x8'))(new Redis(config[_0x25ae('0x7')]));require(_0x25ae('0x9'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x25ae('0xa')]({'port':0x232b});function respondWithRpcPromise(_0x90f771,_0x1db94e,_0x1904ed,_0x29a974){return new BPromise(function(_0x3e64f8,_0x4314ac){var _0x51bb06=_0x29a974||client;return _0x51bb06[_0x25ae('0xb')](_0x90f771,_0x1904ed)[_0x25ae('0xc')](function(_0xc778d6){logger[_0x25ae('0xd')]('MailAccount,\x20%s,\x20%s',_0x1db94e,_0x25ae('0xe'));logger[_0x25ae('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1db94e,_0x25ae('0xe'),JSON['stringify'](_0xc778d6));if(_0xc778d6[_0x25ae('0x10')]){if(_0xc778d6[_0x25ae('0x10')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x1db94e,_0xc778d6[_0x25ae('0x10')][_0x25ae('0x11')]);return _0x4314ac(_0xc778d6[_0x25ae('0x10')][_0x25ae('0x11')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1db94e,_0xc778d6[_0x25ae('0x10')]['message']);return _0x3e64f8(_0xc778d6[_0x25ae('0x10')][_0x25ae('0x11')]);}else{logger[_0x25ae('0xd')](_0x25ae('0x12'),_0x1db94e,_0x25ae('0xe'));_0x3e64f8(_0xc778d6[_0x25ae('0x13')]['message']);}})[_0x25ae('0x14')](function(_0x18b18a){logger[_0x25ae('0x10')](_0x25ae('0x12'),_0x1db94e,_0x18b18a);_0x4314ac(_0x18b18a);});});}function respondWithStatusCode(_0x4a2c27,_0x445b6e){_0x445b6e=_0x445b6e||0xcc;return function(_0x490aef){if(_0x490aef){return _0x4a2c27[_0x25ae('0x15')](_0x445b6e);}return _0x4a2c27[_0x25ae('0x16')](_0x445b6e)[_0x25ae('0x17')]();};}function respondWithResult(_0x17e936,_0x26973b){_0x26973b=_0x26973b||0xc8;return function(_0x267a5d){if(_0x267a5d){return _0x17e936['status'](_0x26973b)['json'](_0x267a5d);}};}function respondWithFilteredResult(_0x31453d,_0x30fad1){return function(_0x1a80f9){if(_0x1a80f9){var _0x9cc2e1=typeof _0x30fad1[_0x25ae('0x18')]===_0x25ae('0x19')&&typeof _0x30fad1[_0x25ae('0x1a')]===_0x25ae('0x19');var _0x5b6c42=_0x1a80f9[_0x25ae('0x1b')];var _0x597d01=_0x9cc2e1?0x0:_0x30fad1['offset'];var _0x47028b=_0x9cc2e1?_0x1a80f9[_0x25ae('0x1b')]:_0x30fad1['offset']+_0x30fad1['limit'];var _0x480d70;if(_0x47028b>=_0x5b6c42){_0x47028b=_0x5b6c42;_0x480d70=0xc8;}else{_0x480d70=0xce;}_0x31453d[_0x25ae('0x16')](_0x480d70);return _0x31453d[_0x25ae('0x1c')](_0x25ae('0x1d'),_0x597d01+'-'+_0x47028b+'/'+_0x5b6c42)[_0x25ae('0x1e')](_0x1a80f9);}return null;};}function saveUpdates(_0x5e5816){return function(_0x4ca07d){if(_0x4ca07d){return _0x4ca07d[_0x25ae('0x1f')](_0x5e5816)['then'](function(_0x30ab1f){return _0x30ab1f;});}return null;};}function removeEntity(_0x14b482){return function(_0x424c09){if(_0x424c09){return _0x424c09['destroy']()[_0x25ae('0xc')](function(){var _0x212274=_0x424c09[_0x25ae('0x20')]({'plain':!![]});var _0x2a8b6e=_0x25ae('0x21');return db[_0x25ae('0x22')][_0x25ae('0x23')]({'where':{'type':_0x2a8b6e,'resourceId':_0x212274['id']}})['then'](function(){return _0x424c09;});})[_0x25ae('0xc')](function(){_0x14b482[_0x25ae('0x16')](0xcc)[_0x25ae('0x17')]();});}};}function handleEntityNotFound(_0x4ea265){return function(_0x1cc44e){if(!_0x1cc44e){_0x4ea265[_0x25ae('0x15')](0x194);}return _0x1cc44e;};}function handleError(_0x596051,_0x4df295){_0x4df295=_0x4df295||0x1f4;return function(_0x52ffbb){logger[_0x25ae('0x10')](_0x52ffbb[_0x25ae('0x24')]);if(_0x52ffbb[_0x25ae('0x25')]){delete _0x52ffbb[_0x25ae('0x25')];}_0x596051['status'](_0x4df295)[_0x25ae('0x26')](_0x52ffbb);};}exports[_0x25ae('0x27')]=function(_0x3c8da3,_0x5f22bb){var _0x42ba41={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29')},{'model':db[_0x25ae('0x2a')],'as':'mandatoryDispositionPause'}]},_0x3523b5={},_0x4303ed={'count':0x0,'rows':[]};var _0x397f8e=_[_0x25ae('0x2b')](db[_0x25ae('0x2c')]['rawAttributes'],function(_0x4f4be7){return{'name':_0x4f4be7[_0x25ae('0x2d')],'type':_0x4f4be7[_0x25ae('0x2e')]['key']};});_0x3523b5['model']=_[_0x25ae('0x2b')](_0x397f8e,'name');_0x3523b5[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x3c8da3[_0x25ae('0x2f')]);_0x3523b5['filters']=_[_0x25ae('0x31')](_0x3523b5['model'],_0x3523b5[_0x25ae('0x2f')]);_0x42ba41[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x3523b5[_0x25ae('0x33')],qs['fields'](_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x42ba41[_0x25ae('0x32')]=_0x42ba41[_0x25ae('0x32')][_0x25ae('0x35')]?_0x42ba41[_0x25ae('0x32')]:_0x3523b5[_0x25ae('0x33')];if(!_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0x42ba41['limit']=qs['limit'](_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x1a')]);_0x42ba41[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x3c8da3[_0x25ae('0x2f')]['offset']);}_0x42ba41[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x3c8da3['query'][_0x25ae('0x39')]);_0x42ba41[_0x25ae('0x3a')]=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x3c8da3['query'],_0x3523b5[_0x25ae('0x3b')]),_0x397f8e);if(_0x3c8da3['query']['filter']){_0x42ba41[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x42ba41[_0x25ae('0x3a')],{'$or':_['map'](_0x397f8e,function(_0x1f61c6){if(_0x1f61c6['type']!==_0x25ae('0x3e')){var _0x4bbf17={};_0x4bbf17[_0x1f61c6[_0x25ae('0x25')]]={'$like':'%'+_0x3c8da3['query']['filter']+'%'};return _0x4bbf17;}})});}_0x42ba41=_[_0x25ae('0x3d')]({},_0x42ba41,_0x3c8da3[_0x25ae('0x3f')]);var _0x3962ee={'where':_0x42ba41['where']};return db[_0x25ae('0x2c')][_0x25ae('0x1b')](_0x3962ee)[_0x25ae('0xc')](function(_0x5e82a5){_0x4303ed['count']=_0x5e82a5;if(_0x3c8da3[_0x25ae('0x2f')][_0x25ae('0x40')]){_0x42ba41[_0x25ae('0x41')]=[{'all':!![]}];}_0x42ba41['logging']=!![];return db[_0x25ae('0x2c')][_0x25ae('0x42')](_0x42ba41);})['then'](function(_0x212e45){_0x4303ed['rows']=_0x212e45;return _0x4303ed;})['then'](respondWithFilteredResult(_0x5f22bb,_0x42ba41))['catch'](handleError(_0x5f22bb,null));};exports[_0x25ae('0x43')]=function(_0x24a956,_0x211b97){var _0x1e2f1e={'raw':![],'where':{'id':_0x24a956[_0x25ae('0x44')]['id']},'include':[{'model':db[_0x25ae('0x45')],'as':_0x25ae('0x46')},{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29')},{'model':db['Pause'],'as':_0x25ae('0x47')}]},_0x1c7a26={};_0x1c7a26['model']=_[_0x25ae('0x30')](db[_0x25ae('0x2c')][_0x25ae('0x48')]);_0x1c7a26['query']=_[_0x25ae('0x30')](_0x24a956[_0x25ae('0x2f')]);_0x1c7a26[_0x25ae('0x3b')]=_[_0x25ae('0x31')](_0x1c7a26['model'],_0x1c7a26[_0x25ae('0x2f')]);_0x1e2f1e['attributes']=_[_0x25ae('0x31')](_0x1c7a26[_0x25ae('0x33')],qs[_0x25ae('0x34')](_0x24a956[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x1e2f1e[_0x25ae('0x32')]=_0x1e2f1e['attributes']['length']?_0x1e2f1e['attributes']:_0x1c7a26[_0x25ae('0x33')];if(_0x24a956[_0x25ae('0x2f')][_0x25ae('0x40')]){_0x1e2f1e['include']=[{'all':!![]}];}_0x1e2f1e=_[_0x25ae('0x3d')]({},_0x1e2f1e,_0x24a956[_0x25ae('0x3f')]);return db[_0x25ae('0x2c')][_0x25ae('0x49')](_0x1e2f1e)[_0x25ae('0xc')](handleEntityNotFound(_0x211b97,null))['then'](respondWithResult(_0x211b97,null))['catch'](handleError(_0x211b97,null));};exports[_0x25ae('0x1f')]=function(_0x56b5cc,_0x344e09){if(_0x56b5cc[_0x25ae('0x4a')]['id']){delete _0x56b5cc[_0x25ae('0x4a')]['id'];}if(_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]){if(!_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]['modernAuthentication']){_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]['CloudProviderId']=null;}}if(_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')]){if(_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')][_0x25ae('0x4b')]){_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')][_0x25ae('0x4c')]=![];}else{_0x56b5cc[_0x25ae('0x4a')]['Smtp']['CloudProviderId']=null;}}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x56b5cc[_0x25ae('0x44')]['id']},'include':[{'model':db[_0x25ae('0x45')],'as':_0x25ae('0x46')},{'model':db['MailServerOut'],'as':_0x25ae('0x29')},{'model':db[_0x25ae('0x2a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x344e09,null))['then'](saveUpdates(_0x56b5cc[_0x25ae('0x4a')],null))[_0x25ae('0xc')](function(_0x4df7dc){if(_0x4df7dc&&_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')]){return db['MailServerIn']['update'](_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x46')],{'where':{'MailAccountId':_0x4df7dc['id']}})[_0x25ae('0xc')](function(){return _0x4df7dc;});}return _0x4df7dc;})[_0x25ae('0xc')](function(_0x1d8093){if(_0x1d8093&&_0x56b5cc[_0x25ae('0x4a')]['Smtp']){return db['MailServerOut'][_0x25ae('0x1f')](_0x56b5cc[_0x25ae('0x4a')][_0x25ae('0x29')],{'where':{'MailAccountId':_0x1d8093['id']}})[_0x25ae('0xc')](function(){return _0x1d8093;});}return _0x1d8093;})[_0x25ae('0xc')](respondWithResult(_0x344e09,null))[_0x25ae('0x14')](handleError(_0x344e09,null));};exports['describe']=function(_0x39fb9b,_0xbbbd42){return db[_0x25ae('0x2c')][_0x25ae('0x4d')]()['then'](respondWithResult(_0xbbbd42,null))['catch'](handleError(_0xbbbd42,null));};exports[_0x25ae('0x4e')]=function(_0xb64407,_0x1043ea){if(_0xb64407['body']['id']){delete _0xb64407[_0x25ae('0x4a')]['id'];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0xb64407['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x1043ea,null))[_0x25ae('0xc')](function(_0x5ee5ea){if(_0x5ee5ea){_0xb64407[_0x25ae('0x4a')][_0x25ae('0x4f')]=_0x5ee5ea['id'];return db[_0x25ae('0x50')][_0x25ae('0x51')](_0xb64407[_0x25ae('0x4a')]);}})[_0x25ae('0xc')](respondWithResult(_0x1043ea,null))[_0x25ae('0x14')](handleError(_0x1043ea,null));};exports[_0x25ae('0x52')]=function(_0x1c3a84,_0x12baa1){var _0x5b9263={'raw':![],'where':{}};var _0x313b4a={};var _0x2be5ce={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x1c3a84['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x12baa1,null))[_0x25ae('0xc')](function(_0x186eea){if(_0x186eea){_0x313b4a[_0x25ae('0x33')]=_['keys'](db['Disposition'][_0x25ae('0x48')]);_0x313b4a['query']=_[_0x25ae('0x30')](_0x1c3a84[_0x25ae('0x2f')]);_0x313b4a[_0x25ae('0x3b')]=_[_0x25ae('0x31')](_0x313b4a[_0x25ae('0x33')],_0x313b4a[_0x25ae('0x2f')]);_0x5b9263[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x313b4a[_0x25ae('0x33')],qs['fields'](_0x1c3a84['query'][_0x25ae('0x34')]));_0x5b9263[_0x25ae('0x32')]=_0x5b9263[_0x25ae('0x32')]['length']?_0x5b9263['attributes']:_0x313b4a['model'];if(!_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0x5b9263[_0x25ae('0x1a')]=qs[_0x25ae('0x1a')](_0x1c3a84['query'][_0x25ae('0x1a')]);_0x5b9263[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0x5b9263[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x39')]);_0x5b9263['where']=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x1c3a84['query'],_0x313b4a[_0x25ae('0x3b')]));_0x5b9263[_0x25ae('0x3a')]['MailAccountId']=_0x186eea['id'];if(_0x1c3a84['query'][_0x25ae('0x54')]){_0x5b9263[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x5b9263[_0x25ae('0x3a')],{'$or':_[_0x25ae('0x2b')](_0x5b9263[_0x25ae('0x32')],function(_0x24f827){var _0x4bc98f={};_0x4bc98f[_0x24f827]={'$like':'%'+_0x1c3a84[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x4bc98f;})});}_0x5b9263=_[_0x25ae('0x3d')]({},_0x5b9263,_0x1c3a84['options']);return db[_0x25ae('0x50')][_0x25ae('0x1b')]({'where':_0x5b9263[_0x25ae('0x3a')]})[_0x25ae('0xc')](function(_0x496df8){_0x2be5ce[_0x25ae('0x1b')]=_0x496df8;if(_0x1c3a84['query'][_0x25ae('0x40')]){_0x5b9263[_0x25ae('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x25ae('0x42')](_0x5b9263);})['then'](function(_0xf7b094){_0x2be5ce[_0x25ae('0x55')]=_0xf7b094;return _0x2be5ce;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x12baa1,_0x5b9263))['catch'](handleError(_0x12baa1,null));};exports[_0x25ae('0x56')]=function(_0x3d7535,_0x46df1a){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x3d7535['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x46df1a,null))[_0x25ae('0xc')](function(_0x415c19){if(_0x415c19){return _0x415c19[_0x25ae('0x56')](_0x3d7535[_0x25ae('0x2f')][_0x25ae('0x57')]);}})['then'](respondWithStatusCode(_0x46df1a,null))['catch'](handleError(_0x46df1a,null));};exports[_0x25ae('0x58')]=function(_0x23961f,_0x28bb25){if(_0x23961f[_0x25ae('0x4a')]['id']){delete _0x23961f['body']['id'];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x23961f['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x28bb25,null))[_0x25ae('0xc')](function(_0x4ad4bf){if(_0x4ad4bf){_0x23961f['body'][_0x25ae('0x4f')]=_0x4ad4bf['id'];return db[_0x25ae('0x59')]['create'](_0x23961f[_0x25ae('0x4a')]);}})['then'](respondWithResult(_0x28bb25,null))[_0x25ae('0x14')](handleError(_0x28bb25,null));};exports[_0x25ae('0x5a')]=function(_0x39f383,_0x33f48a){var _0x307db5={'raw':![],'where':{}};var _0x27be8c={};var _0x4198b8={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x39f383['params']['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x33f48a,null))[_0x25ae('0xc')](function(_0x48002f){if(_0x48002f){_0x27be8c['model']=_[_0x25ae('0x30')](db[_0x25ae('0x59')]['rawAttributes']);_0x27be8c[_0x25ae('0x2f')]=_['keys'](_0x39f383['query']);_0x27be8c['filters']=_[_0x25ae('0x31')](_0x27be8c[_0x25ae('0x33')],_0x27be8c[_0x25ae('0x2f')]);_0x307db5[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x27be8c['model'],qs['fields'](_0x39f383[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x307db5[_0x25ae('0x32')]=_0x307db5[_0x25ae('0x32')][_0x25ae('0x35')]?_0x307db5[_0x25ae('0x32')]:_0x27be8c[_0x25ae('0x33')];if(!_0x39f383['query'][_0x25ae('0x36')]('nolimit')){_0x307db5[_0x25ae('0x1a')]=qs[_0x25ae('0x1a')](_0x39f383[_0x25ae('0x2f')]['limit']);_0x307db5[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x39f383[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0x307db5[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x39f383[_0x25ae('0x2f')][_0x25ae('0x39')]);_0x307db5['where']=qs[_0x25ae('0x3b')](_['pick'](_0x39f383[_0x25ae('0x2f')],_0x27be8c[_0x25ae('0x3b')]));_0x307db5['where'][_0x25ae('0x4f')]=_0x48002f['id'];if(_0x39f383[_0x25ae('0x2f')]['filter']){_0x307db5[_0x25ae('0x3a')]=_['merge'](_0x307db5[_0x25ae('0x3a')],{'$or':_['map'](_0x307db5[_0x25ae('0x32')],function(_0x586efc){var _0x376e81={};_0x376e81[_0x586efc]={'$like':'%'+_0x39f383[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x376e81;})});}_0x307db5=_[_0x25ae('0x3d')]({},_0x307db5,_0x39f383[_0x25ae('0x3f')]);return db[_0x25ae('0x59')][_0x25ae('0x1b')]({'where':_0x307db5[_0x25ae('0x3a')]})['then'](function(_0x3400f1){_0x4198b8['count']=_0x3400f1;if(_0x39f383[_0x25ae('0x2f')]['includeAll']){_0x307db5[_0x25ae('0x41')]=[{'all':!![]}];}return db[_0x25ae('0x59')][_0x25ae('0x42')](_0x307db5);})['then'](function(_0x29cb80){_0x4198b8['rows']=_0x29cb80;return _0x4198b8;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x33f48a,_0x307db5))[_0x25ae('0x14')](handleError(_0x33f48a,null));};exports['removeAnswers']=function(_0x2ca1d0,_0x43359f){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x2ca1d0[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x43359f,null))['then'](function(_0x229709){if(_0x229709){return _0x229709[_0x25ae('0x5b')](_0x2ca1d0[_0x25ae('0x2f')]['ids']);}})[_0x25ae('0xc')](respondWithStatusCode(_0x43359f,null))[_0x25ae('0x14')](handleError(_0x43359f,null));};function getImapHost(_0x21775b){switch(_0x21775b){case _0x25ae('0x5c'):return _0x25ae('0x5d');case _0x25ae('0x5e'):return _0x25ae('0x5f');case'hotmail':return _0x25ae('0x60');case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x21775b);}function getSmtpHost(_0x5a0ce8){switch(_0x5a0ce8){case _0x25ae('0x5c'):return _0x25ae('0x61');case _0x25ae('0x5e'):return'smtp.mail.yahoo.com';case _0x25ae('0x62'):return _0x25ae('0x63');case _0x25ae('0x64'):return'smtp.office365.com';}throw new Error(_0x25ae('0x65'),_0x5a0ce8);}function getSmtpPort(_0x114ba9,_0x934060){switch(_0x114ba9){case'gmail':return _0x934060===!![]?0x24b:0x1d1;case _0x25ae('0x5e'):return 0x1d1;case _0x25ae('0x62'):return 0x24b;case _0x25ae('0x64'):return 0x24b;}throw new Error(_0x25ae('0x65'),_0x114ba9);}function getAuthenticationOptions(_0xf082e7,_0x574bbb){var _0x44d59e={};var _0x5a464f={};if(_0xf082e7){_0x44d59e[_0x25ae('0x66')]=_0x5a464f[_0x25ae('0x66')]=_0x574bbb[_0x25ae('0x67')];_0x44d59e[_0x25ae('0x68')]=_0x5a464f[_0x25ae('0x69')]=_0x574bbb[_0x25ae('0x68')];if(_0x574bbb[_0x25ae('0x4b')]){_0x44d59e[_0x25ae('0x4b')]=_0x5a464f[_0x25ae('0x4b')]=!![];_0x44d59e[_0x25ae('0x6a')]=_0x5a464f[_0x25ae('0x6a')]=_0x574bbb[_0x25ae('0x6a')];_0x44d59e[_0x25ae('0x68')]=_0x5a464f['pass']=null;}else{_0x44d59e['CloudProviderId']=_0x5a464f[_0x25ae('0x6a')]=null;}_0x44d59e['host']=getImapHost(_0xf082e7);_0x44d59e[_0x25ae('0x6b')]=0x3e1;_0x5a464f[_0x25ae('0x6c')]=getSmtpHost(_0xf082e7);_0x5a464f['port']=getSmtpPort(_0xf082e7,_0x5a464f[_0x25ae('0x4c')]);_0x44d59e[_0x25ae('0x6d')]=_0x5a464f[_0x25ae('0x6d')]=null;}else{if(_0x574bbb[_0x25ae('0x6e')]){_0x44d59e['user']=_0x5a464f[_0x25ae('0x66')]=_0x574bbb['username'];_0x44d59e[_0x25ae('0x68')]=_0x5a464f[_0x25ae('0x69')]=_0x574bbb[_0x25ae('0x68')];}else{_0x44d59e['authentication']=_0x5a464f['authentication']=![];_0x44d59e[_0x25ae('0x66')]=_0x5a464f[_0x25ae('0x66')]=null;_0x44d59e[_0x25ae('0x68')]=_0x5a464f['pass']=null;}_0x44d59e[_0x25ae('0x6c')]=_0x574bbb['Imap']['host'];_0x44d59e[_0x25ae('0x6b')]=_0x574bbb['Imap'][_0x25ae('0x6b')];_0x5a464f[_0x25ae('0x6c')]=_0x574bbb[_0x25ae('0x29')][_0x25ae('0x6c')];_0x5a464f['port']=_0x574bbb[_0x25ae('0x29')]['port'];}return{'Imap':_0x44d59e,'Smtp':_0x5a464f};}exports[_0x25ae('0x51')]=function(_0x522027,_0x1f3f27){var _0x4a8d44={'name':_0x522027[_0x25ae('0x4a')][_0x25ae('0x25')],'key':_0x522027['body'][_0x25ae('0x6f')],'provider':_0x522027[_0x25ae('0x4a')][_0x25ae('0x70')]===_0x25ae('0x71')?null:_0x522027['body'][_0x25ae('0x70')],'email':_0x522027[_0x25ae('0x4a')][_0x25ae('0x72')],'ListId':_0x522027[_0x25ae('0x4a')][_0x25ae('0x73')],'active':!_[_0x25ae('0x74')](_0x522027['body']['active'])?_0x522027['body']['active']:!![],'description':_0x522027[_0x25ae('0x4a')][_0x25ae('0x75')]||null};var _0x45ab37=getAuthenticationOptions(_0x4a8d44[_0x25ae('0x70')],_0x522027['body']);_0x4a8d44[_0x25ae('0x46')]=_0x45ab37['Imap'];_0x4a8d44['Smtp']=_0x45ab37[_0x25ae('0x29')];return db['MailAccount'][_0x25ae('0x51')](_0x4a8d44,{'include':[{'model':db['MailServerOut'],'as':_0x25ae('0x29')},{'model':db[_0x25ae('0x45')],'as':'Imap'}]})[_0x25ae('0xc')](function(_0x25fdfb){var _0x3572c1=_0x522027[_0x25ae('0x66')][_0x25ae('0x20')]({'plain':!![]});if(!_0x3572c1)throw new Error(_0x25ae('0x76'));if(_0x3572c1['role']===_0x25ae('0x66')){var _0x3a2924=_0x25fdfb[_0x25ae('0x20')]({'plain':!![]});return db[_0x25ae('0x77')][_0x25ae('0x49')]({'where':{'name':_0x25ae('0x21'),'userProfileId':_0x3572c1[_0x25ae('0x78')]},'raw':!![]})[_0x25ae('0xc')](function(_0x2603cf){if(_0x2603cf&&_0x2603cf[_0x25ae('0x79')]===0x0){return db[_0x25ae('0x22')]['create']({'name':_0x3a2924[_0x25ae('0x25')],'resourceId':_0x3a2924['id'],'type':_0x2603cf[_0x25ae('0x25')],'sectionId':_0x2603cf['id']},{})[_0x25ae('0xc')](function(){return _0x25fdfb;});}else{return _0x25fdfb;}})[_0x25ae('0x14')](function(_0x311a31){logger[_0x25ae('0x10')](_0x25ae('0x7a'),_0x311a31);throw _0x311a31;});}return _0x25fdfb;})['then'](respondWithResult(_0x1f3f27,0xc9))['catch'](handleError(_0x1f3f27,null));};exports[_0x25ae('0x7b')]=function(_0x595e0d,_0x483bc9){return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x595e0d[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x483bc9,null))[_0x25ae('0xc')](function(_0x4f3b3b){if(_0x4f3b3b){return _0x4f3b3b[_0x25ae('0x7b')]();}return null;})[_0x25ae('0xc')](respondWithResult(_0x483bc9,null))['catch'](handleError(_0x483bc9,null));};exports[_0x25ae('0x7c')]=function(_0x3ebb66,_0x527529){if(_0x3ebb66[_0x25ae('0x4a')]['id']){delete _0x3ebb66[_0x25ae('0x4a')]['id'];}return db[_0x25ae('0x2c')]['find']({'where':{'id':_0x3ebb66[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x527529,null))[_0x25ae('0xc')](function(_0x21a992){if(_0x21a992){_0x3ebb66[_0x25ae('0x4a')][_0x25ae('0x4f')]=_0x21a992['id'];return db[_0x25ae('0x45')][_0x25ae('0x51')](_0x3ebb66[_0x25ae('0x4a')]);}})['then'](respondWithResult(_0x527529,null))['catch'](handleError(_0x527529,null));};exports[_0x25ae('0x7d')]=function(_0x34cc24,_0x3cd563){return db[_0x25ae('0x2c')]['findOne']({'where':{'id':_0x34cc24[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x3cd563,null))[_0x25ae('0xc')](function(_0x591a61){if(_0x591a61){return _0x591a61[_0x25ae('0x7e')](null);}return null;})[_0x25ae('0xc')](respondWithStatusCode(_0x3cd563,null))[_0x25ae('0x14')](handleError(_0x3cd563,null));};exports[_0x25ae('0x7f')]=function(_0x4d023f,_0xbb3a82){return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x4d023f[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0xbb3a82,null))[_0x25ae('0xc')](function(_0x2c8e37){if(_0x2c8e37){return _0x2c8e37[_0x25ae('0x7f')]();}return null;})[_0x25ae('0xc')](respondWithResult(_0xbb3a82,null))['catch'](handleError(_0xbb3a82,null));};exports['addSmtp']=function(_0x423ee4,_0x52414e){if(_0x423ee4[_0x25ae('0x4a')]['id']){delete _0x423ee4[_0x25ae('0x4a')]['id'];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x423ee4[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x52414e,null))[_0x25ae('0xc')](function(_0x4d8d2a){if(_0x4d8d2a){_0x423ee4[_0x25ae('0x4a')][_0x25ae('0x4f')]=_0x4d8d2a['id'];return db[_0x25ae('0x28')]['create'](_0x423ee4['body']);}})[_0x25ae('0xc')](respondWithResult(_0x52414e,null))[_0x25ae('0x14')](handleError(_0x52414e,null));};exports[_0x25ae('0x80')]=function(_0x121be5,_0x4c521c){return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x121be5[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x4c521c,null))[_0x25ae('0xc')](function(_0xea8de7){if(_0xea8de7){return _0xea8de7[_0x25ae('0x81')](null);}return null;})['then'](respondWithStatusCode(_0x4c521c,null))[_0x25ae('0x14')](handleError(_0x4c521c,null));};exports[_0x25ae('0x82')]=function(_0x234c6e,_0x44f1f7){return db[_0x25ae('0x83')][_0x25ae('0x49')]({'where':{'id':_0x234c6e[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x44f1f7,null))['then'](function(_0x5f3325){if(_0x5f3325){return _0x5f3325[_0x25ae('0x82')](_0x234c6e[_0x25ae('0x4a')][_0x25ae('0x57')],_[_0x25ae('0x84')](_0x234c6e[_0x25ae('0x4a')],[_0x25ae('0x57'),'id'])||{});}})[_0x25ae('0xc')](respondWithResult(_0x44f1f7,null))[_0x25ae('0x14')](handleError(_0x44f1f7,null));};exports['getInteractions']=function(_0x152081,_0x127863){var _0xa7916f={'raw':![],'where':{}};var _0x2dc934={};var _0x22e3a3={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x152081[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x127863,null))['then'](function(_0x1b1b53){if(_0x1b1b53){_0x2dc934[_0x25ae('0x33')]=_[_0x25ae('0x30')](db[_0x25ae('0x83')]['rawAttributes']);_0x2dc934[_0x25ae('0x2f')]=_['keys'](_0x152081['query']);_0x2dc934['filters']=_[_0x25ae('0x31')](_0x2dc934[_0x25ae('0x33')],_0x2dc934['query']);_0xa7916f[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x2dc934[_0x25ae('0x33')],qs[_0x25ae('0x34')](_0x152081[_0x25ae('0x2f')][_0x25ae('0x34')]));_0xa7916f[_0x25ae('0x32')]=_0xa7916f['attributes'][_0x25ae('0x35')]?_0xa7916f[_0x25ae('0x32')]:_0x2dc934[_0x25ae('0x33')];if(!_0x152081[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0xa7916f[_0x25ae('0x1a')]=qs['limit'](_0x152081['query']['limit']);_0xa7916f[_0x25ae('0x18')]=qs[_0x25ae('0x18')](_0x152081[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0xa7916f['order']=qs[_0x25ae('0x39')](_0x152081[_0x25ae('0x2f')][_0x25ae('0x39')]);_0xa7916f[_0x25ae('0x3a')]=qs['filters'](_[_0x25ae('0x3c')](_0x152081[_0x25ae('0x2f')],_0x2dc934[_0x25ae('0x3b')]));_0xa7916f[_0x25ae('0x3a')][_0x25ae('0x4f')]=_0x1b1b53['id'];if(_0x152081[_0x25ae('0x2f')][_0x25ae('0x54')]){_0xa7916f[_0x25ae('0x3a')]=_['merge'](_0xa7916f[_0x25ae('0x3a')],{'$or':_[_0x25ae('0x2b')](_0xa7916f[_0x25ae('0x32')],function(_0xddbdc){var _0x3708b7={};_0x3708b7[_0xddbdc]={'$like':'%'+_0x152081['query'][_0x25ae('0x54')]+'%'};return _0x3708b7;})});}_0xa7916f=_['merge']({},_0xa7916f,_0x152081['options']);return db['MailInteraction']['count']({'where':_0xa7916f['where']})[_0x25ae('0xc')](function(_0xc1bcb2){_0x22e3a3['count']=_0xc1bcb2;if(_0x152081[_0x25ae('0x2f')]['includeAll']){_0xa7916f[_0x25ae('0x41')]=[{'model':db[_0x25ae('0x85')],'as':_0x25ae('0x86'),'required':![]},{'model':db[_0x25ae('0x87')],'as':_0x25ae('0x88'),'attributes':[_0x25ae('0x25'),_0x25ae('0x89'),'internal'],'required':![]},{'model':db[_0x25ae('0x8a')],'as':_0x25ae('0x8b'),'attributes':['id',_0x25ae('0x25'),_0x25ae('0x8c')],'where':_0x152081['query']['tag']?{'id':_0x152081['query'][_0x25ae('0x8d')]}:undefined,'required':_0x152081[_0x25ae('0x2f')][_0x25ae('0x8d')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0xa7916f);})[_0x25ae('0xc')](function(_0x27b6f1){_0x22e3a3['rows']=_0x27b6f1;return _0x22e3a3;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x127863,_0xa7916f))['catch'](handleError(_0x127863,null));};exports[_0x25ae('0x8e')]=function addApplications(_0x161034,_0x3501b4){var _0xc56288=_0x161034[_0x25ae('0x44')]['id'];var _0x41f50b=_0x161034[_0x25ae('0x4a')];var _0x44a6d6=0xc8;var _0x42deda=null;return db[_0x25ae('0x8f')][_0x25ae('0x90')]({'isolationLevel':db['sequelize']['Transaction'][_0x25ae('0x91')][_0x25ae('0x92')]},function(_0x3683ca){return db[_0x25ae('0x2c')]['findOne']({'where':{'id':_0xc56288},'transaction':_0x3683ca})[_0x25ae('0xc')](function(_0x12fb03){if(_0x12fb03){return db['MailApplication'][_0x25ae('0x23')]({'where':{'MailAccountId':_0xc56288},'transaction':_0x3683ca})[_0x25ae('0xc')](function(){var _0x2db64a=_[_0x25ae('0x2b')](_0x41f50b,function(_0x34c885){_0x34c885[_0x25ae('0x4f')]=_0xc56288;return _0x34c885;});return db['MailApplication'][_0x25ae('0x93')](_0x2db64a,{'transaction':_0x3683ca});});}else{_0x44a6d6=0x194;_0x42deda=[];}});})['then'](function(){if(_0x44a6d6!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0xc56288},'order':'priority'})[_0x25ae('0xc')](function(_0x3f7f53){_0x42deda=_0x3f7f53;});}})[_0x25ae('0x14')](function(_0x1f3849){_0x44a6d6=0x1f4;logger[_0x25ae('0x10')](_0x1f3849[_0x25ae('0x24')]);if(_0x1f3849['name']){delete _0x1f3849[_0x25ae('0x25')];}_0x42deda=_0x1f3849;})[_0x25ae('0x94')](function(){if(_0x42deda===null){_0x3501b4[_0x25ae('0x15')](_0x44a6d6);}else{if(_0x44a6d6===0x1f4){_0x3501b4[_0x25ae('0x16')](_0x44a6d6)[_0x25ae('0x26')](_0x42deda);}else{_0x3501b4[_0x25ae('0x16')](_0x44a6d6)[_0x25ae('0x1e')](_0x42deda);}}});};exports[_0x25ae('0x95')]=function(_0x5dfdd5,_0x59ef7f){var _0x2f1c50={};var _0x1d235f={};var _0x3903cb;var _0x2c82bd;return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x5dfdd5['params']['id']}})['then'](handleEntityNotFound(_0x59ef7f,null))[_0x25ae('0xc')](function(_0x49cfb5){if(_0x49cfb5){_0x3903cb=_0x49cfb5;_0x1d235f[_0x25ae('0x33')]=_[_0x25ae('0x30')](db['MailApplication'][_0x25ae('0x48')]);_0x1d235f[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x5dfdd5[_0x25ae('0x2f')]);_0x1d235f['filters']=_[_0x25ae('0x31')](_0x1d235f['model'],_0x1d235f['query']);_0x2f1c50[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x1d235f['model'],qs[_0x25ae('0x34')](_0x5dfdd5[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x2f1c50[_0x25ae('0x32')]=_0x2f1c50[_0x25ae('0x32')]['length']?_0x2f1c50[_0x25ae('0x32')]:_0x1d235f[_0x25ae('0x33')];_0x2f1c50[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x5dfdd5[_0x25ae('0x2f')]['sort']);_0x2f1c50['where']=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x5dfdd5[_0x25ae('0x2f')],_0x1d235f[_0x25ae('0x3b')]));if(_0x5dfdd5[_0x25ae('0x2f')][_0x25ae('0x54')]){_0x2f1c50[_0x25ae('0x3a')]=_['merge'](_0x2f1c50['where'],{'$or':_[_0x25ae('0x2b')](_0x2f1c50[_0x25ae('0x32')],function(_0x1d4583){var _0x5f48d1={};_0x5f48d1[_0x1d4583]={'$like':'%'+_0x5dfdd5[_0x25ae('0x2f')]['filter']+'%'};return _0x5f48d1;})});}_0x2f1c50=_[_0x25ae('0x3d')]({},_0x2f1c50,_0x5dfdd5['options']);return _0x3903cb[_0x25ae('0x95')](_0x2f1c50);}})[_0x25ae('0xc')](function(_0x45265e){if(_0x45265e){_0x2c82bd=_0x45265e[_0x25ae('0x35')];if(!_0x5dfdd5['query']['hasOwnProperty'](_0x25ae('0x37'))){_0x2f1c50['limit']=qs[_0x25ae('0x1a')](_0x5dfdd5[_0x25ae('0x2f')][_0x25ae('0x1a')]);_0x2f1c50[_0x25ae('0x18')]=qs['offset'](_0x5dfdd5['query']['offset']);}return _0x3903cb[_0x25ae('0x95')](_0x2f1c50);}})[_0x25ae('0xc')](function(_0x16d5ed){if(_0x16d5ed){return _0x16d5ed?{'count':_0x2c82bd,'rows':_0x16d5ed}:null;}})[_0x25ae('0xc')](respondWithResult(_0x59ef7f,null))[_0x25ae('0x14')](handleError(_0x59ef7f,null));};exports[_0x25ae('0x96')]=function(_0x197ece,_0x197caf){var _0x3c073f={'raw':!![],'where':{}};var _0x4b772f={};var _0x48aa85={'count':0x0,'rows':[]};return db[_0x25ae('0x2c')][_0x25ae('0x53')]({'where':{'id':_0x197ece[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x197caf,null))[_0x25ae('0xc')](function(_0x27a18d){if(_0x27a18d){_0x4b772f['model']=_['keys'](db[_0x25ae('0x97')][_0x25ae('0x48')]);_0x4b772f[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x197ece[_0x25ae('0x2f')]);_0x4b772f['filters']=_[_0x25ae('0x31')](_0x4b772f['model'],_0x4b772f[_0x25ae('0x2f')]);_0x3c073f['attributes']=_[_0x25ae('0x31')](_0x4b772f['model'],qs[_0x25ae('0x34')](_0x197ece[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x3c073f[_0x25ae('0x32')]=_0x3c073f['attributes']['length']?_0x3c073f[_0x25ae('0x32')]:_0x4b772f['model'];if(!_0x197ece[_0x25ae('0x2f')][_0x25ae('0x36')](_0x25ae('0x37'))){_0x3c073f[_0x25ae('0x1a')]=qs['limit'](_0x197ece['query'][_0x25ae('0x1a')]);_0x3c073f['offset']=qs[_0x25ae('0x18')](_0x197ece[_0x25ae('0x2f')][_0x25ae('0x18')]);}_0x3c073f[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x197ece[_0x25ae('0x2f')][_0x25ae('0x39')]);_0x3c073f[_0x25ae('0x3a')]=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x197ece[_0x25ae('0x2f')],_0x4b772f[_0x25ae('0x3b')]));_0x3c073f[_0x25ae('0x3a')][_0x25ae('0x4f')]=_0x27a18d['id'];if(_0x197ece[_0x25ae('0x2f')][_0x25ae('0x54')]){_0x3c073f['where']=_['merge'](_0x3c073f['where'],{'$or':_['map'](_0x3c073f[_0x25ae('0x32')],function(_0x20f910){var _0x47484e={};_0x47484e[_0x20f910]={'$like':'%'+_0x197ece[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x47484e;})});}if(_0x197ece[_0x25ae('0x2f')][_0x25ae('0x98')]){var _0x2c96b9=_0x197ece[_0x25ae('0x2f')][_0x25ae('0x98')][_0x25ae('0x99')](',');var _0xc38b46={};_0xc38b46[_0x2c96b9[0x0]]={'$gte':moment(_0x2c96b9[0x1])[_0x25ae('0x9a')](_0x25ae('0x9b'))};_0x3c073f[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x3c073f[_0x25ae('0x3a')],_0xc38b46);}_0x3c073f=_[_0x25ae('0x3d')]({},_0x3c073f,_0x197ece['options']);return db['MailMessage'][_0x25ae('0x1b')]({'where':_0x3c073f[_0x25ae('0x3a')]})[_0x25ae('0xc')](function(_0x53294b){_0x48aa85[_0x25ae('0x1b')]=_0x53294b;if(_0x197ece[_0x25ae('0x2f')][_0x25ae('0x40')]){_0x3c073f[_0x25ae('0x41')]=[{'all':!![]}];}return db[_0x25ae('0x97')]['findAll'](_0x3c073f);})['then'](function(_0x29f2d1){if(_0x197ece['query']['inlineCss']==='true'){for(var _0x386bab=0x0;_0x386bab<_0x29f2d1[_0x25ae('0x35')];_0x386bab++){_0x29f2d1[_0x386bab]['body']=juice(_0x29f2d1[_0x386bab]['body']);}}_0x48aa85[_0x25ae('0x55')]=_0x29f2d1;return _0x48aa85;});}})[_0x25ae('0xc')](respondWithFilteredResult(_0x197caf,_0x3c073f))['catch'](handleError(_0x197caf,null));};exports[_0x25ae('0x26')]=function(_0x220f62,_0x9c182){var _0x4f61c4,_0x3cdf6b={},_0x4a0352;if(_0x220f62['body']['to']){_0x4a0352=_0x220f62[_0x25ae('0x4a')]['to']['split'](',')[0x0];}return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x220f62[_0x25ae('0x44')]['id']},'include':[{'model':db['CmList'],'as':_0x25ae('0x9c'),'include':[{'model':db[_0x25ae('0x85')],'as':_0x25ae('0x9d'),'where':{'email':_0x4a0352},'limit':0x1,'order':[[_0x25ae('0x9e'),'DESC']]}]},{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x25ae('0x9f'),'raw':!![]}]}]})[_0x25ae('0xc')](handleEntityNotFound(_0x9c182,null))[_0x25ae('0xc')](function(_0xebd14b){if(!_0xebd14b)return;_0x4f61c4=_0xebd14b;if(!_0xebd14b[_0x25ae('0x29')])throw new Error(_0x25ae('0xa0'));if(_['isNil'](_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa1')])){_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa1')]=util['format'](_0x25ae('0xa2'),_0xebd14b[_0x25ae('0x25')],_0xebd14b[_0x25ae('0x72')]||_0xebd14b['Smtp'][_0x25ae('0x66')]);}if(_0x220f62[_0x25ae('0x4a')]['attachments']&&_0x220f62['body'][_0x25ae('0xa3')][_0x25ae('0x35')]){for(var _0x3e3bf6=0x0;_0x3e3bf6<_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa3')][_0x25ae('0x35')];_0x3e3bf6+=0x1){_0x220f62[_0x25ae('0x4a')]['attachments'][_0x3e3bf6]={'filename':_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa3')][_0x3e3bf6][_0x25ae('0x25')],'path':path[_0x25ae('0xa4')](config[_0x25ae('0xa5')],'server/files/attachments',_0x220f62[_0x25ae('0x4a')][_0x25ae('0xa3')][_0x3e3bf6]['basename'])};}}var _0x58fc84=_0xebd14b[_0x25ae('0xa6')]();return respondWithRpcPromise(_0x25ae('0xa7'),_0x25ae('0xa8'),{'account':_0x58fc84,'message':_0x220f62[_0x25ae('0x4a')]});})['then'](function(_0x5ab13f){if(!_0x5ab13f)return;_0x3cdf6b=_0x5ab13f;if(!_0x4f61c4[_0x25ae('0x9c')])throw new Error(_0x25ae('0xa9'));if(_0x4f61c4[_0x25ae('0x9c')][_0x25ae('0x9d')]['length'])return _0x4f61c4[_0x25ae('0x9c')]['Contacts'][0x0];return db[_0x25ae('0x85')]['create'](_[_0x25ae('0xaa')](_0x220f62[_0x25ae('0x4a')],{'firstName':_0x220f62[_0x25ae('0x4a')]['to'],'email':_0x220f62[_0x25ae('0x4a')]['to'],'phone':_0x220f62['body']['to'],'ListId':_0x4f61c4[_0x25ae('0x73')]}));})['then'](function(_0x3d0068){if(!_0x3d0068)return;var _0x3655e8={'UserId':_0x220f62[_0x25ae('0x66')]['id'],'ContactId':_0x3d0068['id'],'MailAccountId':_0x4f61c4['id'],'inReplyTo':_0x3cdf6b[_0x25ae('0xab')],'to':_0x220f62[_0x25ae('0x4a')]['from'],'cc':_0x220f62[_0x25ae('0x4a')]['cc'],'subject':_0x220f62[_0x25ae('0x4a')][_0x25ae('0xac')],'attach':_0x220f62[_0x25ae('0x4a')][_0x25ae('0xad')],'firstMsgDirection':_0x25ae('0xae'),'lastMsgAt':moment()[_0x25ae('0x9a')](_0x25ae('0x9b')),'lastMsgDirection':'out','Messages':[_[_0x25ae('0x3d')](_0x220f62['body'],{'messageId':_0x3cdf6b[_0x25ae('0xab')],'sentAt':moment()[_0x25ae('0x9a')](_0x25ae('0x9b')),'read':!![],'MailAccountId':_0x4f61c4['id'],'UserId':_0x220f62[_0x25ae('0x66')]['id'],'ContactId':_0x3d0068['id']})]};if(_0x220f62[_0x25ae('0x4a')]['Interaction']){_0x3655e8=_[_0x25ae('0x3d')](_0x3655e8,_0x220f62['body']['Interaction']);}return db[_0x25ae('0x83')]['create'](_0x3655e8,{'include':[{'model':db[_0x25ae('0x97')],'as':_0x25ae('0xaf')}]});})['then'](respondWithResult(_0x9c182,null))['catch'](handleError(_0x9c182,null));};exports[_0x25ae('0xb0')]=function(_0xb64b5f,_0x451772){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0xb64b5f[_0x25ae('0x44')]['id']},'include':[{'model':db[_0x25ae('0x28')],'as':_0x25ae('0x29'),'raw':!![],'include':[{'model':db[_0x25ae('0x9f')],'as':'CloudProvider','raw':!![]}]}]})[_0x25ae('0xc')](handleEntityNotFound(_0x451772,null))[_0x25ae('0xc')](function(_0x5a0978){if(!_0x5a0978[_0x25ae('0x29')])return;var _0x5bf9c8=_0x5a0978[_0x25ae('0xa6')]();return respondWithRpcPromise('VerifySmtp',_0x25ae('0xb0'),{'account':_0x5bf9c8});})[_0x25ae('0xc')](respondWithResult(_0x451772,null))[_0x25ae('0x14')](handleError(_0x451772,null));};exports['destroy']=function(_0x2ba73e,_0x533720){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x2ba73e[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x533720,null))[_0x25ae('0xc')](function(_0x390f8f){if(_0x390f8f&&_0x390f8f[_0x25ae('0x6d')]){throw new db['Sequelize'][(_0x25ae('0xb1'))](_0x25ae('0xb2'));}return _0x390f8f;})['then'](removeEntity(_0x533720,null))['catch'](handleError(_0x533720,null));};exports[_0x25ae('0xb3')]=function(_0x1cae53,_0x375810){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x1cae53[_0x25ae('0x44')]['id']}})[_0x25ae('0xc')](handleEntityNotFound(_0x375810,null))['then'](function(_0x174d62){if(_0x174d62){return _0x174d62['addAgents'](_0x1cae53[_0x25ae('0x4a')][_0x25ae('0x57')],_[_0x25ae('0x84')](_0x1cae53[_0x25ae('0x4a')],['ids','id'])||{})[_0x25ae('0xb4')](function(_0x46a39d){for(var _0x621ff1=0x0;_0x621ff1<_0x1cae53[_0x25ae('0x4a')]['ids']['length'];_0x621ff1+=0x1){socket[_0x25ae('0xb5')](_0x25ae('0xb6'),{'UserId':Number(_0x1cae53[_0x25ae('0x4a')][_0x25ae('0x57')][_0x621ff1]),'MailAccountId':Number(_0x1cae53[_0x25ae('0x44')]['id'])});}return _0x46a39d;});}})[_0x25ae('0xc')](respondWithResult(_0x375810,null))[_0x25ae('0x14')](handleError(_0x375810,null));};exports[_0x25ae('0xb7')]=function(_0x138ec3,_0x3fb792){return db[_0x25ae('0x2c')][_0x25ae('0x49')]({'where':{'id':_0x138ec3['params']['id']}})['then'](handleEntityNotFound(_0x3fb792,null))[_0x25ae('0xc')](function(_0x57d06f){if(_0x57d06f){return _0x57d06f[_0x25ae('0xb7')](_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')])[_0x25ae('0xc')](function(){if(_[_0x25ae('0xb8')](_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')])){for(var _0x5c0c1a=0x0;_0x5c0c1a<_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')][_0x25ae('0x35')];_0x5c0c1a+=0x1){socket[_0x25ae('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x138ec3[_0x25ae('0x2f')][_0x25ae('0x57')][_0x5c0c1a]),'MailAccountId':Number(_0x138ec3[_0x25ae('0x44')]['id'])});}}else{socket['emit'](_0x25ae('0xb9'),{'UserId':Number(_0x138ec3['query']['ids']),'MailAccountId':Number(_0x138ec3['params']['id'])});}});}})[_0x25ae('0xc')](respondWithStatusCode(_0x3fb792,null))[_0x25ae('0x14')](handleError(_0x3fb792,null));};exports['getAgents']=function(_0x49e07e,_0x30af54){var _0x57f693={};var _0x2ba7cf={};var _0x389a8e;var _0x4fad91;return db[_0x25ae('0x2c')]['findOne']({'where':{'id':_0x49e07e[_0x25ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x30af54,null))[_0x25ae('0xc')](function(_0x191f4c){if(_0x191f4c){_0x389a8e=_0x191f4c;_0x2ba7cf[_0x25ae('0x33')]=_[_0x25ae('0x30')](db[_0x25ae('0x87')][_0x25ae('0x48')]);_0x2ba7cf[_0x25ae('0x2f')]=_[_0x25ae('0x30')](_0x49e07e[_0x25ae('0x2f')]);_0x2ba7cf[_0x25ae('0x3b')]=_['intersection'](_0x2ba7cf['model'],_0x2ba7cf[_0x25ae('0x2f')]);_0x57f693[_0x25ae('0x32')]=_[_0x25ae('0x31')](_0x2ba7cf[_0x25ae('0x33')],qs['fields'](_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x34')]));_0x57f693['attributes']=_0x57f693[_0x25ae('0x32')][_0x25ae('0x35')]?_0x57f693[_0x25ae('0x32')]:_0x2ba7cf['model'];_0x57f693[_0x25ae('0x38')]=qs[_0x25ae('0x39')](_0x49e07e['query'][_0x25ae('0x39')]);_0x57f693[_0x25ae('0x3a')]=qs[_0x25ae('0x3b')](_[_0x25ae('0x3c')](_0x49e07e[_0x25ae('0x2f')],_0x2ba7cf[_0x25ae('0x3b')]));if(_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x54')]){_0x57f693[_0x25ae('0x3a')]=_[_0x25ae('0x3d')](_0x57f693[_0x25ae('0x3a')],{'$or':_[_0x25ae('0x2b')](_0x57f693[_0x25ae('0x32')],function(_0x56b630){var _0x3af1a7={};_0x3af1a7[_0x56b630]={'$like':'%'+_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x54')]+'%'};return _0x3af1a7;})});}_0x57f693=_['merge']({},_0x57f693,_0x49e07e[_0x25ae('0x3f')]);return _0x389a8e['getAgents'](_0x57f693);}})['then'](function(_0x21f003){if(_0x21f003){_0x4fad91=_0x21f003[_0x25ae('0x35')];if(!_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x36')]('nolimit')){_0x57f693[_0x25ae('0x1a')]=qs['limit'](_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x1a')]);_0x57f693['offset']=qs[_0x25ae('0x18')](_0x49e07e[_0x25ae('0x2f')][_0x25ae('0x18')]);}return _0x389a8e[_0x25ae('0xba')](_0x57f693);}})[_0x25ae('0xc')](function(_0x16cc1f){if(_0x16cc1f){return _0x16cc1f?{'count':_0x4fad91,'rows':_0x16cc1f}:null;}})[_0x25ae('0xc')](respondWithResult(_0x30af54,null))[_0x25ae('0x14')](handleError(_0x30af54,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 032a93e..aa8ed81 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 _0xa945=['events','../../mysqldb','MailAccount','update','emit','hook','exports'];(function(_0x1d94f7,_0x31b17f){var _0x2de986=function(_0x5ad760){while(--_0x5ad760){_0x1d94f7['push'](_0x1d94f7['shift']());}};_0x2de986(++_0x31b17f);}(_0xa945,0x118));var _0x5a94=function(_0x4be91f,_0x178704){_0x4be91f=_0x4be91f-0x0;var _0x9f305e=_0xa945[_0x4be91f];return _0x9f305e;};'use strict';var EventEmitter=require(_0x5a94('0x0'));var MailAccount=require(_0x5a94('0x1'))['db'][_0x5a94('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a94('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4693eb){return function(_0x53b6c7,_0x27c3db,_0x4b5341){MailAccountEvents[_0x5a94('0x4')](_0x4693eb+':'+_0x53b6c7['id'],_0x53b6c7);MailAccountEvents[_0x5a94('0x4')](_0x4693eb,_0x53b6c7);_0x4b5341(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x5a94('0x5')](e,emitEvent(event));}}module[_0x5a94('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x292c=['hook','exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x33f0e4,_0x2d414a){var _0x543c2e=function(_0x2c6571){while(--_0x2c6571){_0x33f0e4['push'](_0x33f0e4['shift']());}};_0x543c2e(++_0x2d414a);}(_0x292c,0x66));var _0xc292=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x292c[_0x15bc81];return _0x59440e;};'use strict';var EventEmitter=require(_0xc292('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xc292('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc292('0x2')](0x0);var events={'afterCreate':_0xc292('0x3'),'afterUpdate':_0xc292('0x4'),'afterDestroy':_0xc292('0x5')};function emitEvent(_0x50b478){return function(_0x1f14f9,_0x536154,_0x516f54){MailAccountEvents[_0xc292('0x6')](_0x50b478+':'+_0x1f14f9['id'],_0x1f14f9);MailAccountEvents[_0xc292('0x6')](_0x50b478,_0x1f14f9);_0x516f54(null);};}for(var e in events){if(events[_0xc292('0x7')](e)){var event=events[e];MailAccount[_0xc292('0x8')](e,emitEvent(event));}}module[_0xc292('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 425f872..617e9fc 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 _0x7785=['mail_accounts','custom','service','provider','Smtp','host','port','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x34ebb5,_0x1b572a){var _0x28a396=function(_0x1770bf){while(--_0x1770bf){_0x34ebb5['push'](_0x34ebb5['shift']());}};_0x28a396(++_0x1b572a);}(_0x7785,0xd9));var _0x5778=function(_0x480b6e,_0xba4dd5){_0x480b6e=_0x480b6e-0x0;var _0x2dd83e=_0x7785[_0x480b6e];return _0x2dd83e;};'use strict';var attributes=require(_0x5778('0x0'));module[_0x5778('0x1')]=function(_0x5531f3){return _0x5531f3[_0x5778('0x2')](_0x5778('0x3'),attributes,{'tableName':_0x5778('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x294056=this;var _0x5c315c={'id':_0x294056['id'],'tls':{'rejectUnauthorized':![]}};if(_0x294056['provider']!==_0x5778('0x5')){_0x5c315c[_0x5778('0x6')]=_0x294056[_0x5778('0x7')];}else{_0x5c315c['host']=_0x294056[_0x5778('0x8')][_0x5778('0x9')];_0x5c315c['port']=_0x294056[_0x5778('0x8')][_0x5778('0xa')];_0x5c315c['secure']=_0x294056['Smtp']['secure'];}if(_0x294056['Smtp'][_0x5778('0xb')]){if(_0x294056[_0x5778('0x8')]['modernAuthentication']){if(!_0x294056['Smtp'][_0x5778('0xc')])throw new Error(_0x5778('0xd'));_0x5c315c['auth']={'type':'OAuth2','user':_0x294056[_0x5778('0x8')]['user'],'accessToken':_0x294056['Smtp'][_0x5778('0xc')][_0x5778('0xe')]};}else{_0x5c315c[_0x5778('0xf')]={'user':_0x294056[_0x5778('0x8')]['user'],'pass':_0x294056[_0x5778('0x8')][_0x5778('0x10')]};}}return _0x5c315c;}}});}; \ No newline at end of file +var _0xc407=['auth','OAuth2','user','pass','exports','mail_accounts','provider','service','host','port','Smtp','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x3bfcdc,_0x31371c){var _0x5e5b02=function(_0x51a445){while(--_0x51a445){_0x3bfcdc['push'](_0x3bfcdc['shift']());}};_0x5e5b02(++_0x31371c);}(_0xc407,0x103));var _0x7c40=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0xc407[_0x14490c];return _0x2f6825;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x7c40('0x0')]=function(_0x515f81){return _0x515f81['define']('MailAccount',attributes,{'tableName':_0x7c40('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2e1e9b=this;var _0x12377d={'id':_0x2e1e9b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e1e9b[_0x7c40('0x2')]!=='custom'){_0x12377d[_0x7c40('0x3')]=_0x2e1e9b[_0x7c40('0x2')];}else{_0x12377d[_0x7c40('0x4')]=_0x2e1e9b['Smtp']['host'];_0x12377d[_0x7c40('0x5')]=_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x5')];_0x12377d['secure']=_0x2e1e9b[_0x7c40('0x6')]['secure'];}if(_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x7')]){if(_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x8')]){if(!_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x9')])throw new Error(_0x7c40('0xa'));_0x12377d[_0x7c40('0xb')]={'type':_0x7c40('0xc'),'user':_0x2e1e9b[_0x7c40('0x6')]['user'],'accessToken':_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0x9')]['data5']};}else{_0x12377d[_0x7c40('0xb')]={'user':_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0xd')],'pass':_0x2e1e9b[_0x7c40('0x6')][_0x7c40('0xe')]};}}return _0x12377d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 707061a..cef36ee 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 _0xdb28=['DESC','MailApplication','Applications','CloudProvider','get','omit','smtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','Contacts','create','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','subject','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','model','map','then','find','smtp','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','difference','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact'];(function(_0x2fa3c0,_0x5126b8){var _0x2f6f5b=function(_0x3e6051){while(--_0x3e6051){_0x2fa3c0['push'](_0x2fa3c0['shift']());}};_0x2f6f5b(++_0x5126b8);}(_0xdb28,0x106));var _0x8db2=function(_0x58923b,_0x4c83a0){_0x58923b=_0x58923b-0x0;var _0x2dde43=_0xdb28[_0x58923b];return _0x2dde43;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var BPromise=require(_0x8db2('0x2'));var rs=require(_0x8db2('0x3'));var Redis=require('ioredis');var db=require(_0x8db2('0x4'))['db'];var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var jayson=require(_0x8db2('0x8'));var client=jayson['client'][_0x8db2('0x9')]({'port':0x232c});config[_0x8db2('0xa')]=_['defaults'](config['redis'],{'host':_0x8db2('0xb'),'port':0x18eb});var socket=require(_0x8db2('0xc'))(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xd'))[_0x8db2('0xe')](socket);function respondWithRpcPromise(_0x1ff362,_0x126c78,_0x4ba340){return new BPromise(function(_0x30dc90,_0x476216){return client[_0x8db2('0xf')](_0x1ff362,_0x4ba340)['then'](function(_0x1d9371){logger[_0x8db2('0x10')]('MailAccount,\x20%s,\x20%s',_0x126c78,_0x8db2('0x11'));logger[_0x8db2('0x12')](_0x8db2('0x13'),_0x126c78,_0x8db2('0x11'),JSON[_0x8db2('0x14')](_0x1d9371));if(_0x1d9371['error']){if(_0x1d9371['error'][_0x8db2('0x15')]===0x1f4){logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x126c78,_0x1d9371[_0x8db2('0x16')][_0x8db2('0x18')]);return _0x476216(_0x1d9371[_0x8db2('0x16')][_0x8db2('0x18')]);}logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x126c78,_0x1d9371[_0x8db2('0x16')]['message']);return _0x30dc90(_0x1d9371[_0x8db2('0x16')][_0x8db2('0x18')]);}else{logger['info'](_0x8db2('0x17'),_0x126c78,_0x8db2('0x11'));_0x30dc90(_0x1d9371[_0x8db2('0x19')][_0x8db2('0x18')]);}})[_0x8db2('0x1a')](function(_0x46ce14){logger['error']('MailAccount,\x20%s,\x20%s',_0x126c78,_0x46ce14);_0x476216(_0x46ce14);});});}exports[_0x8db2('0x1b')]=function(_0x104e33){var _0x1310d3=this;return new Promise(function(_0x1b64e4,_0x58562e){return db[_0x8db2('0x1c')][_0x8db2('0x1d')]({'raw':_0x104e33[_0x8db2('0x1e')]?_0x104e33[_0x8db2('0x1e')][_0x8db2('0x1f')]===undefined?!![]:![]:!![],'where':_0x104e33['options']?_0x104e33[_0x8db2('0x1e')][_0x8db2('0x20')]||null:null,'attributes':_0x104e33[_0x8db2('0x1e')]?_0x104e33[_0x8db2('0x1e')][_0x8db2('0x21')]||null:null,'limit':_0x104e33[_0x8db2('0x1e')]?_0x104e33[_0x8db2('0x1e')]['limit']||null:null,'include':_0x104e33[_0x8db2('0x1e')]?_0x104e33['options']['include']?_['map'](_0x104e33['options'][_0x8db2('0x22')],function(_0x29b5cd){return{'model':db[_0x29b5cd[_0x8db2('0x23')]],'as':_0x29b5cd['as'],'attributes':_0x29b5cd[_0x8db2('0x21')],'include':_0x29b5cd[_0x8db2('0x22')]?_[_0x8db2('0x24')](_0x29b5cd['include'],function(_0x3544ba){return{'model':db[_0x3544ba[_0x8db2('0x23')]],'as':_0x3544ba['as'],'attributes':_0x3544ba[_0x8db2('0x21')],'include':_0x3544ba[_0x8db2('0x22')]?_['map'](_0x3544ba[_0x8db2('0x22')],function(_0x11f398){return{'model':db[_0x11f398[_0x8db2('0x23')]],'as':_0x11f398['as'],'attributes':_0x11f398[_0x8db2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0x25')](function(_0x21bae5){logger[_0x8db2('0x10')](_0x8db2('0x1b'),_0x104e33);logger[_0x8db2('0x12')]('GetMailAccount',_0x104e33,JSON[_0x8db2('0x14')](_0x21bae5));_0x1b64e4(_0x21bae5);})['catch'](function(_0x59cb77){logger[_0x8db2('0x16')](_0x8db2('0x1b'),_0x59cb77[_0x8db2('0x18')],_0x104e33);_0x58562e(_0x1310d3['error'](0x1f4,_0x59cb77[_0x8db2('0x18')]));});});};exports['ShowMailAccount']=function(_0x3f7aac){var _0x2b653b=this;return new Promise(function(_0x14bd12,_0x4d9e26){return db['MailAccount'][_0x8db2('0x26')]({'raw':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac['options']['raw']===undefined?!![]:![]:!![],'where':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x20')]||null:null,'attributes':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x21')]||null:null,'include':_0x3f7aac[_0x8db2('0x1e')]?_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x22')]?_[_0x8db2('0x24')](_0x3f7aac['options'][_0x8db2('0x22')],function(_0x304a72){return{'model':db[_0x304a72['model']],'as':_0x304a72['as'],'attributes':_0x304a72[_0x8db2('0x21')],'include':_0x304a72[_0x8db2('0x22')]?_['map'](_0x304a72['include'],function(_0x3c1983){return{'model':db[_0x3c1983['model']],'as':_0x3c1983['as'],'attributes':_0x3c1983[_0x8db2('0x21')],'include':_0x3c1983[_0x8db2('0x22')]?_[_0x8db2('0x24')](_0x3c1983[_0x8db2('0x22')],function(_0x5cc419){return{'model':db[_0x5cc419[_0x8db2('0x23')]],'as':_0x5cc419['as'],'attributes':_0x5cc419['attributes']};}):[]};}):[]};}):[]:[]})[_0x8db2('0x25')](function(_0xd550ae){if(_0x3f7aac[_0x8db2('0x1e')][_0x8db2('0x27')]===!![])_0xd550ae['setDataValue']('smtpOptions',_0xd550ae[_0x8db2('0x28')]());logger[_0x8db2('0x10')]('ShowMailAccount',_0x3f7aac);logger[_0x8db2('0x12')](_0x8db2('0x29'),_0x3f7aac,JSON[_0x8db2('0x14')](_0xd550ae));_0x14bd12(_0xd550ae);})['catch'](function(_0x152e15){logger[_0x8db2('0x16')](_0x8db2('0x29'),_0x152e15[_0x8db2('0x18')],_0x3f7aac);_0x4d9e26(_0x2b653b[_0x8db2('0x16')](0x1f4,_0x152e15[_0x8db2('0x18')]));});});};exports[_0x8db2('0x2a')]=function(_0x1575ea){var _0x3793a4=this;return new Promise(function(_0x63c561,_0x21cf7c){var _0x20bf0b={'body':_0x1575ea[_0x8db2('0x2b')],'channel':'mail'};var _0x3ee510=_[_0x8db2('0x2c')](_['keys'](db['CmContact'][_0x8db2('0x2d')]),['createdAt',_0x8db2('0x2e'),_0x8db2('0x2f'),_0x8db2('0x30')]);var _0x307783=![];if(_0x1575ea[_0x8db2('0x2b')]['id']){delete _0x1575ea[_0x8db2('0x2b')]['id'];}if(_[_0x8db2('0x31')](_0x1575ea['body'][_0x8db2('0x32')])){return _0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,_0x8db2('0x33')));}if(_[_0x8db2('0x31')](_0x1575ea['body'][_0x8db2('0x2b')])||_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x2b')]===''){return _0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8db2('0x31')](_0x1575ea['body'][_0x8db2('0x34')])){return _0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,_0x8db2('0x35')+_0x3ee510));}if(!_['includes'](_0x3ee510,_0x1575ea['body'][_0x8db2('0x34')])){return _0x21cf7c(_0x3793a4['error'](0x1f4,_0x8db2('0x36')+_0x3ee510));}var _0x467866={};_0x467866[_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x34')]]=_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x32')];return db[_0x8db2('0x1c')][_0x8db2('0x26')]({'where':{'id':_0x1575ea[_0x8db2('0x37')]['id']},'include':[{'model':db[_0x8db2('0x38')],'as':_0x8db2('0x39'),'include':[{'model':db[_0x8db2('0x3a')],'as':'Contacts','where':_0x467866,'limit':0x1,'order':[[_0x8db2('0x2e'),_0x8db2('0x3b')]]}]},{'model':db[_0x8db2('0x3c')],'as':_0x8db2('0x3d')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x8db2('0x3e')],'as':_0x8db2('0x3e')}]}]})[_0x8db2('0x25')](function(_0x4c66e5){if(_0x4c66e5&&_0x4c66e5['List']){var _0x494d6e=_0x4c66e5[_0x8db2('0x3f')]({'plain':!![]});_0x20bf0b[_0x8db2('0x37')]=_[_0x8db2('0x40')](_0x494d6e,[_0x8db2('0x3d'),_0x8db2('0x39')]);_0x20bf0b[_0x8db2('0x37')][_0x8db2('0x41')]=_0x4c66e5['getSmtpOptions']();_0x20bf0b['applications']=_0x494d6e[_0x8db2('0x3d')];_0x20bf0b[_0x8db2('0x42')]=_0x494d6e[_0x8db2('0x39')];_0x20bf0b[_0x8db2('0x43')]=_[_0x8db2('0x44')](_0x20bf0b[_0x8db2('0x43')],[_0x8db2('0x45')],[_0x8db2('0x46')]);if(_0x20bf0b[_0x8db2('0x37')]&&_0x20bf0b[_0x8db2('0x37')][_0x8db2('0x47')]){_0x20bf0b[_0x8db2('0x43')][_0x8db2('0x48')]({'id':0x0,'priority':_0x20bf0b[_0x8db2('0x43')][_0x8db2('0x49')]+0x1,'app':'close','appdata':_0x8db2('0x47'),'interval':_0x8db2('0x4a')});}if(_0x20bf0b['account'][_0x8db2('0x3d')]){delete _0x20bf0b[_0x8db2('0x37')][_0x8db2('0x3d')];}if(_0x20bf0b['account'][_0x8db2('0x39')]){delete _0x20bf0b[_0x8db2('0x37')][_0x8db2('0x39')];}if(_0x494d6e[_0x8db2('0x39')][_0x8db2('0x4b')]['length']){return _0x494d6e[_0x8db2('0x39')][_0x8db2('0x4b')][0x0];}var _0x469bc2=_['defaults'](_0x1575ea[_0x8db2('0x2b')],{'firstName':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x32')],'ListId':_0x494d6e[_0x8db2('0x30')]});_0x469bc2[_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x34')]]=_0x1575ea[_0x8db2('0x2b')]['from'];return db[_0x8db2('0x3a')][_0x8db2('0x4c')](_0x469bc2);}else{throw new Error('List\x20not\x20found');}})[_0x8db2('0x25')](function(_0x1683b8){_0x20bf0b['contact']=_0x1683b8;if(_0x1683b8){if(!_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')]){_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')]=rs[_0x8db2('0x4e')]()+'\x20'+_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x32')];}var _0x12fd12={'ContactId':_0x1683b8['id'],'MailAccountId':_0x1575ea[_0x8db2('0x37')]['id'],'inReplyTo':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')],'to':_0x1575ea[_0x8db2('0x2b')]['message'][_0x8db2('0x32')],'cc':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['cc'],'subject':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['subject'],'attach':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4f')],'lastMsgAt':moment()[_0x8db2('0x50')](_0x8db2('0x51')),'lastMsgDirection':'in'};return db[_0x8db2('0x52')][_0x8db2('0x26')]({'where':{'closed':![],'MailAccountId':_0x1575ea[_0x8db2('0x37')]['id']},'include':[{'model':db[_0x8db2('0x53')],'as':_0x8db2('0x54'),'attributes':[_0x8db2('0x4d')],'where':{'messageId':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x55')]}}]})[_0x8db2('0x25')](function(_0x270fc0){if(_0x270fc0){return[_0x270fc0,![]];}return db[_0x8db2('0x52')][_0x8db2('0x4c')](_0x12fd12)['then'](function(_0x3273dd){return[_0x3273dd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8db2('0x56')](function(_0x570c53,_0x3de11e){if(_0x570c53){_0x307783=_0x3de11e;if(!_0x3de11e){return _0x570c53[_0x8db2('0x57')]({'inReplyTo':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x4d')],'to':_0x1575ea['body']['message'][_0x8db2('0x32')],'cc':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['cc'],'subject':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x58')],'attach':_0x570c53[_0x8db2('0x4f')]?_0x570c53[_0x8db2('0x4f')]:_0x1575ea['body'][_0x8db2('0x18')][_0x8db2('0x4f')],'substatus':null,'substatusAt':moment()[_0x8db2('0x50')](_0x8db2('0x51')),'lastMsgAt':moment()[_0x8db2('0x50')](_0x8db2('0x51')),'lastMsgDirection':'in'});}else{return _0x570c53;}}})[_0x8db2('0x25')](function(_0x20caf0){_0x20bf0b['interaction']=_0x20caf0['get']({'plain':!![]});_0x20bf0b[_0x8db2('0x59')][_0x8db2('0x5a')]=_0x307783;return db[_0x8db2('0x53')][_0x8db2('0x4c')]({'body':_0x1575ea[_0x8db2('0x2b')]['body'],'MailAccountId':_0x1575ea['account']['id'],'MailInteractionId':_0x20caf0['id'],'direction':'in','ContactId':_0x20bf0b[_0x8db2('0x5b')]['id'],'messageId':_0x1575ea[_0x8db2('0x2b')]['message'][_0x8db2('0x4d')],'from':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['from'],'to':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['to'],'cc':_0x1575ea[_0x8db2('0x2b')]['message']['cc'],'subject':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x58')],'attach':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['attach'],'Attachments':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x5c')],'originTo':_0x1575ea['body']['message'][_0x8db2('0x5d')],'originCc':_0x1575ea[_0x8db2('0x2b')]['message'][_0x8db2('0x5e')],'bcc':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x5f')],'ChatWebsiteId':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x60')]||null,'originChannel':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')][_0x8db2('0x61')]||_0x8db2('0x62'),'ChatOfflineMessageId':_0x1575ea[_0x8db2('0x2b')][_0x8db2('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x8db2('0x63')],'as':'Attachments'}]});})[_0x8db2('0x25')](function(_0x3015ab){_0x20bf0b['message']=_0x3015ab;if(_0x20bf0b[_0x8db2('0x59')][_0x8db2('0x64')]){return db['User'][_0x8db2('0x26')]({'attributes':['id',_0x8db2('0x65')],'where':{'id':_0x20bf0b[_0x8db2('0x59')][_0x8db2('0x64')]}})[_0x8db2('0x25')](function(_0x31a095){if(_0x31a095){_0x20bf0b[_0x8db2('0x43')][_0x8db2('0x66')]({'id':0x0,'priority':0x0,'app':_0x8db2('0x67'),'appdata':_0x31a095['name']+','+(_0x20bf0b['account'][_0x8db2('0x68')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8db2('0x69'),_0x8db2('0x6a'),_0x20bf0b);});}return respondWithRpcPromise(_0x8db2('0x69'),'startRouting',_0x20bf0b);})[_0x8db2('0x25')](function(_0x9675c1){_0x63c561(_0x9675c1);})[_0x8db2('0x1a')](function(_0x591c5d){_0x21cf7c(_0x3793a4[_0x8db2('0x16')](0x1f4,_0x591c5d[_0x8db2('0x18')]));});});}; \ No newline at end of file +var _0xba34=['MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','find','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC'];(function(_0x596754,_0x2c95ce){var _0x563055=function(_0x5b10e7){while(--_0x5b10e7){_0x596754['push'](_0x596754['shift']());}};_0x563055(++_0x2c95ce);}(_0xba34,0x119));var _0x4ba3=function(_0x344e26,_0x54b816){_0x344e26=_0x344e26-0x0;var _0x7feb76=_0xba34[_0x344e26];return _0x7feb76;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var BPromise=require(_0x4ba3('0x2'));var rs=require(_0x4ba3('0x3'));var Redis=require(_0x4ba3('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x4ba3('0x5'));var jayson=require(_0x4ba3('0x6'));var client=jayson[_0x4ba3('0x7')][_0x4ba3('0x8')]({'port':0x232c});config[_0x4ba3('0x9')]=_[_0x4ba3('0xa')](config[_0x4ba3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ba3('0xb'))(new Redis(config[_0x4ba3('0x9')]));require(_0x4ba3('0xc'))[_0x4ba3('0xd')](socket);function respondWithRpcPromise(_0x380d60,_0xcf1ec3,_0x292f58){return new BPromise(function(_0x3f653c,_0x2ed106){return client[_0x4ba3('0xe')](_0x380d60,_0x292f58)[_0x4ba3('0xf')](function(_0x51edab){logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0xcf1ec3,'request\x20sent');logger[_0x4ba3('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'),JSON['stringify'](_0x51edab));if(_0x51edab[_0x4ba3('0x14')]){if(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x15')]===0x1f4){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x2ed106(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x3f653c(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}else{logger[_0x4ba3('0x10')]('MailAccount,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'));_0x3f653c(_0x51edab[_0x4ba3('0x17')][_0x4ba3('0x16')]);}})[_0x4ba3('0x18')](function(_0x556290){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x556290);_0x2ed106(_0x556290);});});}exports[_0x4ba3('0x19')]=function(_0x1e2ce5){var _0x184332=this;return new Promise(function(_0x125944,_0x4b2791){return db['MailAccount'][_0x4ba3('0x1a')]({'raw':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1e')]||null:null,'limit':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1f')]||null:null,'include':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')],'include':_0x252f37['include']?_[_0x4ba3('0x21')](_0x252f37[_0x4ba3('0x20')],function(_0x44d78c){return{'model':db[_0x44d78c['model']],'as':_0x44d78c['as'],'attributes':_0x44d78c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x34ecb4){logger[_0x4ba3('0x10')]('GetMailAccount',_0x1e2ce5);logger['debug'](_0x4ba3('0x19'),_0x1e2ce5,JSON[_0x4ba3('0x23')](_0x34ecb4));_0x125944(_0x34ecb4);})[_0x4ba3('0x18')](function(_0x19f039){logger[_0x4ba3('0x14')](_0x4ba3('0x19'),_0x19f039['message'],_0x1e2ce5);_0x4b2791(_0x184332[_0x4ba3('0x14')](0x1f4,_0x19f039[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x24')]=function(_0xbf95b3){var _0x2a6757=this;return new Promise(function(_0x1a7a2c,_0x457236){return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'raw':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf95b3['options']?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'include':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')],'include':_0x188f8c[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x188f8c[_0x4ba3('0x20')],function(_0xf892e1){return{'model':db[_0xf892e1[_0x4ba3('0x22')]],'as':_0xf892e1['as'],'attributes':_0xf892e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x3cf56c){if(_0xbf95b3[_0x4ba3('0x1b')]['smtp']===!![])_0x3cf56c[_0x4ba3('0x27')](_0x4ba3('0x28'),_0x3cf56c['getSmtpOptions']());logger[_0x4ba3('0x10')]('ShowMailAccount',_0xbf95b3);logger['debug'](_0x4ba3('0x24'),_0xbf95b3,JSON[_0x4ba3('0x23')](_0x3cf56c));_0x1a7a2c(_0x3cf56c);})[_0x4ba3('0x18')](function(_0x2b14e1){logger[_0x4ba3('0x14')]('ShowMailAccount',_0x2b14e1[_0x4ba3('0x16')],_0xbf95b3);_0x457236(_0x2a6757[_0x4ba3('0x14')](0x1f4,_0x2b14e1[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x29')]=function(_0xab7983){var _0x2acc92=this;return new Promise(function(_0x349af4,_0x2577be){var _0x553475={'body':_0xab7983[_0x4ba3('0x2a')],'channel':_0x4ba3('0x2b')};var _0x3cb07f=_[_0x4ba3('0x2c')](_[_0x4ba3('0x2d')](db[_0x4ba3('0x2e')][_0x4ba3('0x2f')]),[_0x4ba3('0x30'),_0x4ba3('0x31'),_0x4ba3('0x32'),_0x4ba3('0x33')]);var _0x1c58d2=![];if(_0xab7983[_0x4ba3('0x2a')]['id']){delete _0xab7983[_0x4ba3('0x2a')]['id'];}if(_['isNil'](_0xab7983['body']['from'])){return _0x2577be(_0x2acc92['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4ba3('0x34')](_0xab7983['body'][_0x4ba3('0x2a')])||_0xab7983['body'][_0x4ba3('0x2a')]===''){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x35')));}if(_[_0x4ba3('0x34')](_0xab7983[_0x4ba3('0x2a')]['mapKey'])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb07f));}if(!_[_0x4ba3('0x36')](_0x3cb07f,_0xab7983['body'][_0x4ba3('0x37')])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x38')+_0x3cb07f));}var _0x261a5e={};_0x261a5e[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')]['from'];return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'where':{'id':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x3a')],'as':_0x4ba3('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x261a5e,'limit':0x1,'order':[[_0x4ba3('0x31'),_0x4ba3('0x3c')]]}]},{'model':db[_0x4ba3('0x3d')],'as':'Applications'},{'model':db[_0x4ba3('0x3e')],'as':_0x4ba3('0x3f'),'include':[{'model':db[_0x4ba3('0x40')],'as':'CloudProvider'}]}]})['then'](function(_0x34dc04){if(_0x34dc04&&_0x34dc04['List']){var _0x439acf=_0x34dc04[_0x4ba3('0x41')]({'plain':!![]});_0x553475[_0x4ba3('0x39')]=_[_0x4ba3('0x42')](_0x439acf,[_0x4ba3('0x43'),_0x4ba3('0x3b')]);_0x553475['account'][_0x4ba3('0x28')]=_0x34dc04[_0x4ba3('0x44')]();_0x553475['applications']=_0x439acf[_0x4ba3('0x43')];_0x553475[_0x4ba3('0x45')]=_0x439acf[_0x4ba3('0x3b')];_0x553475[_0x4ba3('0x46')]=_[_0x4ba3('0x47')](_0x553475['applications'],[_0x4ba3('0x48')],[_0x4ba3('0x49')]);if(_0x553475['account']&&_0x553475[_0x4ba3('0x39')][_0x4ba3('0x4a')]){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4b')]({'id':0x0,'priority':_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4c')]+0x1,'app':_0x4ba3('0x4d'),'appdata':_0x4ba3('0x4a'),'interval':_0x4ba3('0x4e')});}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')]){delete _0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')];}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x3b')]){delete _0x553475['account']['List'];}if(_0x439acf['List'][_0x4ba3('0x4f')][_0x4ba3('0x4c')]){return _0x439acf[_0x4ba3('0x3b')][_0x4ba3('0x4f')][0x0];}var _0x40af1d=_['defaults'](_0xab7983[_0x4ba3('0x2a')],{'firstName':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')],'ListId':_0x439acf[_0x4ba3('0x33')]});_0x40af1d[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')];return db[_0x4ba3('0x2e')][_0x4ba3('0x51')](_0x40af1d);}else{throw new Error(_0x4ba3('0x52'));}})[_0x4ba3('0xf')](function(_0x317b9f){_0x553475[_0x4ba3('0x53')]=_0x317b9f;if(_0x317b9f){if(!_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x54')]){_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x54')]=rs[_0x4ba3('0x55')]()+'\x20'+_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['from'];}var _0x8ea419={'ContactId':_0x317b9f['id'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'inReplyTo':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'to':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'lastMsgAt':moment()[_0x4ba3('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x4ba3('0x59')][_0x4ba3('0x26')]({'where':{'closed':![],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x5a')],'as':_0x4ba3('0x5b'),'attributes':[_0x4ba3('0x54')],'where':{'messageId':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x5c')]}}]})[_0x4ba3('0xf')](function(_0x1afc5e){if(_0x1afc5e){return[_0x1afc5e,![]];}return db['MailInteraction'][_0x4ba3('0x51')](_0x8ea419)[_0x4ba3('0xf')](function(_0x55c03c){return[_0x55c03c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4ba3('0x5d')](function(_0x296bf6,_0x5c7c2f){if(_0x296bf6){_0x1c58d2=_0x5c7c2f;if(!_0x5c7c2f){return _0x296bf6[_0x4ba3('0x5e')]({'inReplyTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['messageId'],'to':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0x296bf6[_0x4ba3('0x57')]?_0x296bf6[_0x4ba3('0x57')]:_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x57')],'substatus':null,'substatusAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgDirection':'in'});}else{return _0x296bf6;}}})[_0x4ba3('0xf')](function(_0x424477){_0x553475['interaction']=_0x424477['get']({'plain':!![]});_0x553475[_0x4ba3('0x60')]['created']=_0x1c58d2;return db[_0x4ba3('0x5a')][_0x4ba3('0x51')]({'body':_0xab7983[_0x4ba3('0x2a')]['body'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'MailInteractionId':_0x424477['id'],'direction':'in','ContactId':_0x553475[_0x4ba3('0x53')]['id'],'messageId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'from':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'to':_0xab7983['body'][_0x4ba3('0x16')]['to'],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'Attachments':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x61')],'originTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x62')],'originCc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x63')],'bcc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x64')],'ChatWebsiteId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x65')]||null,'originChannel':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x66')]||_0x4ba3('0x67'),'ChatOfflineMessageId':_0xab7983['body']['message'][_0x4ba3('0x68')]||null},{'include':[{'model':db[_0x4ba3('0x69')],'as':_0x4ba3('0x6a')}]});})[_0x4ba3('0xf')](function(_0x37b966){_0x553475[_0x4ba3('0x16')]=_0x37b966;if(_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]){return db['User'][_0x4ba3('0x26')]({'attributes':['id','name'],'where':{'id':_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]}})[_0x4ba3('0xf')](function(_0x3c3638){if(_0x3c3638){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x6c')]({'id':0x0,'priority':0x0,'app':_0x4ba3('0x6d'),'appdata':_0x3c3638[_0x4ba3('0x6e')]+','+(_0x553475['account'][_0x4ba3('0x6f')]||0xa),'interval':_0x4ba3('0x4e')});}return respondWithRpcPromise(_0x4ba3('0x70'),'startRouting',_0x553475);});}return respondWithRpcPromise(_0x4ba3('0x70'),_0x4ba3('0x71'),_0x553475);})[_0x4ba3('0xf')](function(_0x39d428){_0x349af4(_0x39d428);})[_0x4ba3('0x18')](function(_0x2569bc){_0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x2569bc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a86be18..267f197 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 _0x234b=['register','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x234b,0x8a));var _0xb234=function(_0x4a4634,_0x54e757){_0x4a4634=_0x4a4634-0x0;var _0x190309=_0x234b[_0x4a4634];return _0x190309;};'use strict';var MailAccountEvents=require(_0xb234('0x0'));var events=[_0xb234('0x1'),_0xb234('0x2'),_0xb234('0x3')];function createListener(_0x50ab52,_0x5b154b){return function(_0x5a6ad1){_0x5b154b[_0xb234('0x4')](_0x50ab52,_0x5a6ad1);};}function removeListener(_0x585eb2,_0x140a85){return function(){MailAccountEvents[_0xb234('0x5')](_0x585eb2,_0x140a85);};}exports[_0xb234('0x6')]=function(_0x30ce88){for(var _0x50164c=0x0,_0x4bb51e=events['length'];_0x50164c<_0x4bb51e;_0x50164c++){var _0x184bc7=events[_0x50164c];var _0x1b9afa=createListener(_0xb234('0x7')+_0x184bc7,_0x30ce88);MailAccountEvents['on'](_0x184bc7,_0x1b9afa);}}; \ No newline at end of file +var _0x9c00=['register','length','mailAccount:','./mailAccount.events','save','emit','removeListener'];(function(_0xe6d797,_0x46fdd9){var _0x59828c=function(_0x5acf4e){while(--_0x5acf4e){_0xe6d797['push'](_0xe6d797['shift']());}};_0x59828c(++_0x46fdd9);}(_0x9c00,0x1a0));var _0x09c0=function(_0x597c16,_0x2292fe){_0x597c16=_0x597c16-0x0;var _0x30cc2c=_0x9c00[_0x597c16];return _0x30cc2c;};'use strict';var MailAccountEvents=require(_0x09c0('0x0'));var events=[_0x09c0('0x1'),'remove','update'];function createListener(_0xe0d293,_0x8c9907){return function(_0x5d1967){_0x8c9907[_0x09c0('0x2')](_0xe0d293,_0x5d1967);};}function removeListener(_0x2c702c,_0x2ed715){return function(){MailAccountEvents[_0x09c0('0x3')](_0x2c702c,_0x2ed715);};}exports[_0x09c0('0x4')]=function(_0x5914eb){for(var _0x4d5fc3=0x0,_0x1f3d7e=events[_0x09c0('0x5')];_0x4d5fc3<_0x1f3d7e;_0x4d5fc3++){var _0x1b633b=events[_0x4d5fc3];var _0x3187aa=createListener(_0x09c0('0x6')+_0x1b633b,_0x5914eb);MailAccountEvents['on'](_0x1b633b,_0x3187aa);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 53cbe8b..2c34826 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 _0x19d8=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x19d8,0xd2));var _0x819d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x819d('0x0'));var util=require('util');var path=require(_0x819d('0x1'));var timeout=require(_0x819d('0x2'));var express=require(_0x819d('0x3'));var router=express['Router']();var fs_extra=require(_0x819d('0x4'));var auth=require(_0x819d('0x5'));var interaction=require(_0x819d('0x6'));var config=require(_0x819d('0x7'));var controller=require('./mailApplication.controller');router['get'](_0x819d('0x8'),auth['isAuthenticated'](),controller[_0x819d('0x9')]);router['put'](_0x819d('0x8'),auth[_0x819d('0xa')](),controller[_0x819d('0xb')]);router[_0x819d('0xc')](_0x819d('0x8'),auth['isAuthenticated'](),controller[_0x819d('0xd')]);module['exports']=router; \ No newline at end of file +var _0x408d=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','delete','destroy','multer','path'];(function(_0x5cfdd8,_0x27555c){var _0x4fd729=function(_0x27239c){while(--_0x27239c){_0x5cfdd8['push'](_0x5cfdd8['shift']());}};_0x4fd729(++_0x27555c);}(_0x408d,0x175));var _0xd408=function(_0x5e570c,_0x233990){_0x5e570c=_0x5e570c-0x0;var _0xc62527=_0x408d[_0x5e570c];return _0xc62527;};'use strict';var multer=require(_0xd408('0x0'));var util=require('util');var path=require(_0xd408('0x1'));var timeout=require(_0xd408('0x2'));var express=require('express');var router=express[_0xd408('0x3')]();var fs_extra=require(_0xd408('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd408('0x5'));var config=require(_0xd408('0x6'));var controller=require(_0xd408('0x7'));router[_0xd408('0x8')](_0xd408('0x9'),auth['isAuthenticated'](),controller[_0xd408('0xa')]);router[_0xd408('0xb')](_0xd408('0x9'),auth[_0xd408('0xc')](),controller['update']);router[_0xd408('0xd')](_0xd408('0x9'),auth[_0xd408('0xc')](),controller[_0xd408('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b9fecf9..912b32d 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 _0x2cdf=['TEXT','sequelize','exports','STRING','noop'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2cdf,0xa1));var _0xf2cd=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x2cdf[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xf2cd('0x0'));module[_0xf2cd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf2cd('0x2')],'allowNull':![],'defaultValue':_0xf2cd('0x3')},'appdata':{'type':Sequelize[_0xf2cd('0x4')]()},'description':{'type':Sequelize[_0xf2cd('0x2')]},'interval':{'type':Sequelize[_0xf2cd('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa366=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x53c07d,_0x454e3e){var _0x2a6ec4=function(_0x439f72){while(--_0x439f72){_0x53c07d['push'](_0x53c07d['shift']());}};_0x2a6ec4(++_0x454e3e);}(_0xa366,0x1b0));var _0x6a36=function(_0x4948bd,_0x126fb4){_0x4948bd=_0x4948bd-0x0;var _0x3024ee=_0xa366[_0x4948bd];return _0x3024ee;};'use strict';var Sequelize=require(_0x6a36('0x0'));module[_0x6a36('0x1')]={'priority':{'type':Sequelize[_0x6a36('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6a36('0x3')],'allowNull':![],'defaultValue':_0x6a36('0x4')},'appdata':{'type':Sequelize[_0x6a36('0x5')]()},'description':{'type':Sequelize[_0x6a36('0x3')]},'interval':{'type':Sequelize[_0x6a36('0x3')],'defaultValue':_0x6a36('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7b8e1a7..aeb4489 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x476b6c,_0x445529){var _0x5d4e3c=function(_0x47f5f6){while(--_0x47f5f6){_0x476b6c['push'](_0x476b6c['shift']());}};_0x5d4e3c(++_0x445529);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x309768,_0x1daf54){var _0x34136d=function(_0x5d29e2){while(--_0x5d29e2){_0x309768['push'](_0x309768['shift']());}};_0x34136d(++_0x1daf54);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2e207a,_0x91aef2){_0x2e207a=_0x2e207a-0x0;var _0x18ad79=_0xb43b[_0x2e207a];return _0x18ad79;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c8459bc..5e07a79 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 _0xb368=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3f2d08,_0x1fb29a){var _0x374ac9=function(_0x197974){while(--_0x197974){_0x3f2d08['push'](_0x3f2d08['shift']());}};_0x374ac9(++_0x1fb29a);}(_0xb368,0x1d7));var _0x8b36=function(_0x323221,_0x3ba038){_0x323221=_0x323221-0x0;var _0x3d41d4=_0xb368[_0x323221];return _0x3d41d4;};'use strict';var _=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var logger=require(_0x8b36('0x2'))(_0x8b36('0x3'));var moment=require(_0x8b36('0x4'));var BPromise=require(_0x8b36('0x5'));var rp=require(_0x8b36('0x6'));var fs=require('fs');var path=require(_0x8b36('0x7'));var rimraf=require('rimraf');var config=require(_0x8b36('0x8'));var attributes=require(_0x8b36('0x9'));module[_0x8b36('0xa')]=function(_0x2b6c3a,_0x385105){return _0x2b6c3a[_0x8b36('0xb')](_0x8b36('0xc'),attributes,{'tableName':_0x8b36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b36('0xe'),'collate':_0x8b36('0xf')});}; \ No newline at end of file +var _0xbb15=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x3bd615,_0x11537a){var _0x1d5097=function(_0x3822d5){while(--_0x3822d5){_0x3bd615['push'](_0x3bd615['shift']());}};_0x1d5097(++_0x11537a);}(_0xbb15,0xc4));var _0x5bb1=function(_0x5a5e94,_0x3bd9f3){_0x5a5e94=_0x5a5e94-0x0;var _0x98c0d=_0xbb15[_0x5a5e94];return _0x98c0d;};'use strict';var _=require(_0x5bb1('0x0'));var util=require(_0x5bb1('0x1'));var logger=require(_0x5bb1('0x2'))(_0x5bb1('0x3'));var moment=require(_0x5bb1('0x4'));var BPromise=require(_0x5bb1('0x5'));var rp=require(_0x5bb1('0x6'));var fs=require('fs');var path=require(_0x5bb1('0x7'));var rimraf=require('rimraf');var config=require(_0x5bb1('0x8'));var attributes=require(_0x5bb1('0x9'));module[_0x5bb1('0xa')]=function(_0x5f3e26,_0x485144){return _0x5f3e26[_0x5bb1('0xb')](_0x5bb1('0xc'),attributes,{'tableName':_0x5bb1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bb1('0xe'),'collate':_0x5bb1('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9e1528a..3bf5a1f 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 _0x5776=['UpdateMailApplication','MailApplication','update','body','options','raw','limit','catch','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','MailApplication,\x20%s,\x20%s','result'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0x5776,0xfb));var _0x6577=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5776[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x6577('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6577('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6577('0x2'))['db'];var utils=require(_0x6577('0x3'));var logger=require('../../config/logger')(_0x6577('0x4'));var config=require(_0x6577('0x5'));var jayson=require(_0x6577('0x6'));var client=jayson[_0x6577('0x7')][_0x6577('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d115e,_0x52905a,_0x274b4b){return new BPromise(function(_0x2819b0,_0x2f3933){return client['request'](_0x4d115e,_0x274b4b)[_0x6577('0x9')](function(_0x411eb5){logger[_0x6577('0xa')]('MailApplication,\x20%s,\x20%s',_0x52905a,_0x6577('0xb'));logger[_0x6577('0xc')](_0x6577('0xd'),_0x52905a,_0x6577('0xb'),JSON[_0x6577('0xe')](_0x411eb5));if(_0x411eb5[_0x6577('0xf')]){if(_0x411eb5[_0x6577('0xf')]['code']===0x1f4){logger[_0x6577('0xf')]('MailApplication,\x20%s,\x20%s',_0x52905a,_0x411eb5[_0x6577('0xf')][_0x6577('0x10')]);return _0x2f3933(_0x411eb5[_0x6577('0xf')][_0x6577('0x10')]);}logger['error'](_0x6577('0x11'),_0x52905a,_0x411eb5[_0x6577('0xf')][_0x6577('0x10')]);return _0x2819b0(_0x411eb5[_0x6577('0xf')][_0x6577('0x10')]);}else{logger[_0x6577('0xa')](_0x6577('0x11'),_0x52905a,_0x6577('0xb'));_0x2819b0(_0x411eb5[_0x6577('0x12')][_0x6577('0x10')]);}})['catch'](function(_0x684b5a){logger[_0x6577('0xf')](_0x6577('0x11'),_0x52905a,_0x684b5a);_0x2f3933(_0x684b5a);});});}exports[_0x6577('0x13')]=function(_0x4b8479){var _0x2e9d1c=this;return new Promise(function(_0x2cecbf,_0x52136e){return db[_0x6577('0x14')][_0x6577('0x15')](_0x4b8479[_0x6577('0x16')],{'raw':_0x4b8479['options']?_0x4b8479[_0x6577('0x17')][_0x6577('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8479['options']?_0x4b8479['options']['where']||null:null,'attributes':_0x4b8479[_0x6577('0x17')]?_0x4b8479[_0x6577('0x17')]['attributes']||null:null,'limit':_0x4b8479[_0x6577('0x17')]?_0x4b8479[_0x6577('0x17')][_0x6577('0x19')]||null:null})['then'](function(_0x22602e){logger[_0x6577('0xa')](_0x6577('0x13'),_0x4b8479);logger[_0x6577('0xc')](_0x6577('0x13'),_0x4b8479,JSON[_0x6577('0xe')](_0x22602e));_0x2cecbf(_0x22602e);})[_0x6577('0x1a')](function(_0x14fabe){logger[_0x6577('0xf')](_0x6577('0x13'),_0x14fabe[_0x6577('0x10')],_0x4b8479);_0x52136e(_0x2e9d1c[_0x6577('0xf')](0x1f4,_0x14fabe[_0x6577('0x10')]));});});}; \ No newline at end of file +var _0x22af=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','options','raw','where','attributes','limit','then','UpdateMailApplication'];(function(_0x5ad4d1,_0x162e0b){var _0x32a2cd=function(_0x353d0e){while(--_0x353d0e){_0x5ad4d1['push'](_0x5ad4d1['shift']());}};_0x32a2cd(++_0x162e0b);}(_0x22af,0xe8));var _0xf22a=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x22af[_0xe8129c];return _0x709fc5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf22a('0x0'));var BPromise=require('bluebird');var rs=require(_0xf22a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf22a('0x2'))['db'];var utils=require(_0xf22a('0x3'));var logger=require(_0xf22a('0x4'))(_0xf22a('0x5'));var config=require(_0xf22a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf22a('0x7')][_0xf22a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x410cc7,_0x472da8,_0x530c60){return new BPromise(function(_0x128b1f,_0x42b287){return client['request'](_0x410cc7,_0x530c60)['then'](function(_0xcfbaab){logger[_0xf22a('0x9')](_0xf22a('0xa'),_0x472da8,_0xf22a('0xb'));logger[_0xf22a('0xc')](_0xf22a('0xd'),_0x472da8,_0xf22a('0xb'),JSON[_0xf22a('0xe')](_0xcfbaab));if(_0xcfbaab[_0xf22a('0xf')]){if(_0xcfbaab['error'][_0xf22a('0x10')]===0x1f4){logger[_0xf22a('0xf')]('MailApplication,\x20%s,\x20%s',_0x472da8,_0xcfbaab[_0xf22a('0xf')]['message']);return _0x42b287(_0xcfbaab[_0xf22a('0xf')][_0xf22a('0x11')]);}logger[_0xf22a('0xf')](_0xf22a('0xa'),_0x472da8,_0xcfbaab[_0xf22a('0xf')][_0xf22a('0x11')]);return _0x128b1f(_0xcfbaab['error'][_0xf22a('0x11')]);}else{logger['info'](_0xf22a('0xa'),_0x472da8,'request\x20sent');_0x128b1f(_0xcfbaab[_0xf22a('0x12')][_0xf22a('0x11')]);}})[_0xf22a('0x13')](function(_0x4818dc){logger[_0xf22a('0xf')]('MailApplication,\x20%s,\x20%s',_0x472da8,_0x4818dc);_0x42b287(_0x4818dc);});});}exports['UpdateMailApplication']=function(_0x680c65){var _0x3f25a0=this;return new Promise(function(_0x422354,_0x448ac0){return db[_0xf22a('0x14')][_0xf22a('0x15')](_0x680c65['body'],{'raw':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x18')]||null:null,'attributes':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x19')]||null:null,'limit':_0x680c65[_0xf22a('0x16')]?_0x680c65[_0xf22a('0x16')][_0xf22a('0x1a')]||null:null})[_0xf22a('0x1b')](function(_0xcc69a8){logger['info'](_0xf22a('0x1c'),_0x680c65);logger[_0xf22a('0xc')](_0xf22a('0x1c'),_0x680c65,JSON[_0xf22a('0xe')](_0xcc69a8));_0x422354(_0xcc69a8);})[_0xf22a('0x13')](function(_0x478f27){logger[_0xf22a('0xf')]('UpdateMailApplication',_0x478f27[_0xf22a('0x11')],_0x680c65);_0x448ac0(_0x3f25a0['error'](0x1f4,_0x478f27[_0xf22a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7fe3c77..ba3e27f 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 _0xe961=['/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','destroy','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','download','post','create'];(function(_0x5db485,_0x120e9a){var _0x47e891=function(_0x2a5d9f){while(--_0x2a5d9f){_0x5db485['push'](_0x5db485['shift']());}};_0x47e891(++_0x120e9a);}(_0xe961,0xd1));var _0x1e96=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xe961[_0x37bd26];return _0xe83dc4;};'use strict';var express=require('express');var router=express[_0x1e96('0x0')]();var auth=require(_0x1e96('0x1'));var interaction=require(_0x1e96('0x2'));var controller=require(_0x1e96('0x3'));router[_0x1e96('0x4')]('/',auth[_0x1e96('0x5')](),controller[_0x1e96('0x6')]);router[_0x1e96('0x4')](_0x1e96('0x7'),auth[_0x1e96('0x5')](),controller['describe']);router[_0x1e96('0x4')](_0x1e96('0x8'),auth[_0x1e96('0x5')](),controller[_0x1e96('0x9')]);router[_0x1e96('0x4')]('/:id/messages',auth[_0x1e96('0x5')](),controller[_0x1e96('0xa')]);router[_0x1e96('0x4')](_0x1e96('0xb'),auth[_0x1e96('0x5')](),controller[_0x1e96('0xc')]);router[_0x1e96('0xd')]('/',auth[_0x1e96('0x5')](),controller[_0x1e96('0xe')]);router[_0x1e96('0xd')](_0x1e96('0xf'),auth['isAuthenticated'](),controller[_0x1e96('0x10')]);router['post'](_0x1e96('0x11'),auth['isAuthenticated'](),interaction[_0x1e96('0x12')](_0x1e96('0x13'),_0x1e96('0x14')),controller[_0x1e96('0x15')]);router[_0x1e96('0x16')](_0x1e96('0x8'),auth[_0x1e96('0x5')](),interaction[_0x1e96('0x12')](_0x1e96('0x13'),_0x1e96('0x17')),controller['update']);router[_0x1e96('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x1e96('0x13'),'mailinteraction:destroy'),controller[_0x1e96('0x19')]);router[_0x1e96('0x18')]('/:id/tags',auth[_0x1e96('0x5')](),controller[_0x1e96('0x1a')]);module[_0x1e96('0x1b')]=router; \ No newline at end of file +var _0x025f=['mail','mailinteraction:update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','addTags','put'];(function(_0x50df75,_0x4fa3a3){var _0x8e0b55=function(_0x8f2748){while(--_0x8f2748){_0x50df75['push'](_0x50df75['shift']());}};_0x8e0b55(++_0x4fa3a3);}(_0x025f,0x1d1));var _0xf025=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x025f[_0x2c91e9];return _0x13f0ff;};'use strict';var express=require(_0xf025('0x0'));var router=express[_0xf025('0x1')]();var auth=require(_0xf025('0x2'));var interaction=require(_0xf025('0x3'));var controller=require(_0xf025('0x4'));router['get']('/',auth[_0xf025('0x5')](),controller['index']);router[_0xf025('0x6')](_0xf025('0x7'),auth[_0xf025('0x5')](),controller[_0xf025('0x8')]);router[_0xf025('0x6')](_0xf025('0x9'),auth['isAuthenticated'](),controller[_0xf025('0xa')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xf025('0x6')](_0xf025('0xb'),auth[_0xf025('0x5')](),controller[_0xf025('0xc')]);router[_0xf025('0xd')]('/',auth[_0xf025('0x5')](),controller[_0xf025('0xe')]);router[_0xf025('0xd')](_0xf025('0xf'),auth[_0xf025('0x5')](),controller[_0xf025('0x10')]);router['post'](_0xf025('0x11'),auth[_0xf025('0x5')](),interaction[_0xf025('0x12')]('mail','mailinteraction:addtags'),controller[_0xf025('0x13')]);router[_0xf025('0x14')](_0xf025('0x9'),auth[_0xf025('0x5')](),interaction[_0xf025('0x12')](_0xf025('0x15'),_0xf025('0x16')),controller['update']);router[_0xf025('0x17')](_0xf025('0x9'),auth[_0xf025('0x5')](),interaction['tracked'](_0xf025('0x15'),_0xf025('0x18')),controller['destroy']);router[_0xf025('0x17')](_0xf025('0x11'),auth['isAuthenticated'](),controller[_0xf025('0x19')]);module[_0xf025('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 18fdb30..7683efa 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 _0x9e33=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e33,0x144));var _0x39e3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9e33[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x39e3('0x0'));var iconv=require(_0x39e3('0x1'));module[_0x39e3('0x2')]={'closed':{'type':Sequelize[_0x39e3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x39e3('0x4')]},'disposition':{'type':Sequelize[_0x39e3('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x39e3('0x5')]},'inReplyTo':{'type':Sequelize[_0x39e3('0x5')](0x1fe)},'to':{'type':Sequelize[_0x39e3('0x5')]},'cc':{'type':Sequelize[_0x39e3('0x6')](_0x39e3('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x39e3('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x39e3('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x39e3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x39e3('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x39e3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1629=['ENUM','out','sequelize','iconv','exports','BOOLEAN','STRING','long','TEXT','DATE'];(function(_0x31c7b6,_0x5778bb){var _0x5ea4cc=function(_0xd624b4){while(--_0xd624b4){_0x31c7b6['push'](_0x31c7b6['shift']());}};_0x5ea4cc(++_0x5778bb);}(_0x1629,0x1d8));var _0x9162=function(_0x51b560,_0x465eb0){_0x51b560=_0x51b560-0x0;var _0x25b01e=_0x1629[_0x51b560];return _0x25b01e;};'use strict';var Sequelize=require(_0x9162('0x0'));var iconv=require(_0x9162('0x1'));module[_0x9162('0x2')]={'closed':{'type':Sequelize[_0x9162('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9162('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9162('0x4')]},'inReplyTo':{'type':Sequelize[_0x9162('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x9162('0x5'))},'subject':{'type':Sequelize[_0x9162('0x6')]()},'attach':{'type':Sequelize[_0x9162('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9162('0x7')]},'substatus':{'type':Sequelize[_0x9162('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x9162('0x7')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9162('0x8')]('in',_0x9162('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9162('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 77a422f..4952feb 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 _0x598a=['download','server','files','tmp','join','root','format','transcript-%d-%s.zip','Attachments','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','attachments','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','Users','fullname','TagIds','split','Tags','push','findOne','plainBody','-id','lastMsgText','trimStart','catch','waiting','answered','unmanaged','closed','UserId','talking','map','MailInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','users','mail_interactions','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','search','sqlOperator','conditions','find','value','having','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','text','compact','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','MailInteractionId','Setting','enableEmailPreview','rows','show','params','includeAll','include','merge','options','body','destroy','describe','addMessage','MailMessage','omit','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','addTags','setTags','emit','mailInteractionTags:save','removeTags'];(function(_0x3a50fd,_0x275987){var _0x167328=function(_0x35c723){while(--_0x35c723){_0x3a50fd['push'](_0x3a50fd['shift']());}};_0x167328(++_0x275987);}(_0x598a,0xfb));var _0xa598=function(_0x48f53a,_0xd93ceb){_0x48f53a=_0x48f53a-0x0;var _0x211069=_0x598a[_0x48f53a];return _0x211069;};'use strict';var emlformat=require(_0xa598('0x0'));var rimraf=require(_0xa598('0x1'));var zipdir=require(_0xa598('0x2'));var moment=require(_0xa598('0x3'));var BPromise=require(_0xa598('0x4'));var util=require('util');var path=require(_0xa598('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require('juice');var Redis=require(_0xa598('0x6'));var qs=require(_0xa598('0x7'));var as=require(_0xa598('0x8'));var logger=require(_0xa598('0x9'))(_0xa598('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xa598('0xb'));config[_0xa598('0xc')]=_[_0xa598('0xd')](config[_0xa598('0xc')],{'host':_0xa598('0xe'),'port':0x18eb});var socket=require(_0xa598('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xa598('0x10')](socket);function respondWithStatusCode(_0x3cb7b8,_0x1aae78){_0x1aae78=_0x1aae78||0xcc;return function(_0x2ecad4){if(_0x2ecad4){return _0x3cb7b8[_0xa598('0x11')](_0x1aae78);}return _0x3cb7b8['status'](_0x1aae78)[_0xa598('0x12')]();};}function respondWithResult(_0x4109ff,_0x468710){_0x468710=_0x468710||0xc8;return function(_0x5041d4){if(_0x5041d4){return _0x4109ff[_0xa598('0x13')](_0x468710)['json'](_0x5041d4);}};}function respondWithFilteredResult(_0x3a88f9,_0x23b343){return function(_0xb3288a){if(_0xb3288a){var _0x38afa9=typeof _0x23b343[_0xa598('0x14')]===_0xa598('0x15')&&typeof _0x23b343[_0xa598('0x16')]===_0xa598('0x15');var _0x28534a=_0xb3288a['count'];var _0x88df86=_0x38afa9?0x0:_0x23b343[_0xa598('0x14')];var _0x6e6ff5=_0x38afa9?_0xb3288a[_0xa598('0x17')]:_0x23b343[_0xa598('0x14')]+_0x23b343[_0xa598('0x16')];var _0x3cbb9f;if(_0x6e6ff5>=_0x28534a){_0x6e6ff5=_0x28534a;_0x3cbb9f=0xc8;}else{_0x3cbb9f=0xce;}_0x3a88f9[_0xa598('0x13')](_0x3cbb9f);return _0x3a88f9[_0xa598('0x18')](_0xa598('0x19'),_0x88df86+'-'+_0x6e6ff5+'/'+_0x28534a)['json'](_0xb3288a);}return null;};}function saveUpdates(_0x1ed03f){return function(_0x80e1ad){if(_0x80e1ad){return _0x80e1ad[_0xa598('0x1a')](_0x1ed03f)[_0xa598('0x1b')](function(_0x2ad4ff){return _0x2ad4ff;});}return null;};}function removeEntity(_0xcdf1b6){return function(_0x53d689){if(_0x53d689){return _0x53d689['destroy']()[_0xa598('0x1b')](function(){_0xcdf1b6['status'](0xcc)[_0xa598('0x12')]();});}};}function handleEntityNotFound(_0x31671f){return function(_0x399f23){if(!_0x399f23){_0x31671f[_0xa598('0x11')](0x194);}return _0x399f23;};}function handleError(_0x261868,_0x24f4f0){_0x24f4f0=_0x24f4f0||0x1f4;return function(_0x483556){logger[_0xa598('0x1c')](_0x483556[_0xa598('0x1d')]);if(_0x483556[_0xa598('0x1e')]){delete _0x483556[_0xa598('0x1e')];}_0x261868[_0xa598('0x13')](_0x24f4f0)[_0xa598('0x1f')](_0x483556);};}function getInteractionUsers(_0x2c9a9b,_0xf366b1){return new BPromise(function(_0x50c9d8,_0x473d07){try{if(_0xf366b1[_0x2c9a9b['id']]){_0x2c9a9b[_0xa598('0x20')]=_['map'](_0xf366b1[_0x2c9a9b['id']],function(_0x4ae8b1){return{'id':_0x4ae8b1['id'],'fullname':_0x4ae8b1[_0xa598('0x21')]};});}}catch(_0x559038){_0x473d07(_0x559038);}_0x50c9d8(_0x2c9a9b);});}function getInteractionTags(_0x527c9f,_0x234a98){return new BPromise(function(_0x5918f1,_0x34689e){try{if(_0x527c9f['TagIds']){_0x527c9f['Tags']=[];_0x527c9f[_0xa598('0x22')][_0xa598('0x23')](',')['forEach'](function(_0x16f00d){_0x527c9f[_0xa598('0x24')][_0xa598('0x25')](_0x234a98[_0x16f00d]);});}delete _0x527c9f[_0xa598('0x22')];}catch(_0x523392){_0x34689e(_0x523392);}_0x5918f1(_0x527c9f);});}function getLastMessageText(_0x2fec6e){return new BPromise(function(_0x5ab302,_0x5d70aa){return db['MailMessage'][_0xa598('0x26')]({'where':{'$and':[{'MailInteractionId':_0x2fec6e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xa598('0x27')],'order':_0xa598('0x28'),'raw':!![]})[_0xa598('0x1b')](function(_0x5a18ec){if(_0x5a18ec&&_0x5a18ec[_0xa598('0x27')]){_0x2fec6e[_0xa598('0x29')]=_[_0xa598('0x2a')](_0x5a18ec[_0xa598('0x27')]);}_0x5ab302(_0x2fec6e);})[_0xa598('0x2b')](function(_0x4e5f9b){_0x5d70aa(_0x4e5f9b);});});}function updateMailInteraction(_0x430d21,_0x39a83e,_0x25bc50,_0x3fd327){return new BPromise(function(_0x58e2a6,_0x145fdf){return getInteractionUsers(_0x430d21,_0x25bc50)[_0xa598('0x1b')](function(_0x5088dc){return getInteractionTags(_0x5088dc,_0x39a83e);})['then'](function(_0x3617e0){return getStateInteraction(_0x3617e0);})[_0xa598('0x1b')](function(_0xce832c){if(_0x3fd327){_0x58e2a6(getLastMessageText(_0xce832c));}else{_0x58e2a6(_0xce832c);}})['catch'](function(_0x1fed30){_0x145fdf(_0x1fed30);});});}function getStateInteraction(_0x3928a1){return new BPromise(function(_0x556d2d){_0x3928a1[_0xa598('0x2c')]=0x0;_0x3928a1['talking']=0x0;_0x3928a1[_0xa598('0x2d')]=0x0;_0x3928a1[_0xa598('0x2e')]=0x0;_0x3928a1['total']=0x0;if(!_0x3928a1[_0xa598('0x2f')]&&!_0x3928a1[_0xa598('0x30')]){_0x3928a1['waiting']+=0x1;}if(!_0x3928a1[_0xa598('0x2f')]&&_0x3928a1[_0xa598('0x30')]){_0x3928a1[_0xa598('0x31')]+=0x1;if(_0x3928a1['waiting']){_0x3928a1[_0xa598('0x2c')]-=0x1;}}if(_0x3928a1[_0xa598('0x2f')]&&_0x3928a1[_0xa598('0x30')]){_0x3928a1['answered']+=0x1;if(_0x3928a1[_0xa598('0x31')]){_0x3928a1['talking']-=0x1;}}if(_0x3928a1[_0xa598('0x2f')]&&!_0x3928a1[_0xa598('0x30')]){_0x3928a1[_0xa598('0x2e')]+=0x1;if(_0x3928a1['waiting']){_0x3928a1['waiting']-=0x1;}}_0x3928a1['total']+=0x1;_0x556d2d(_0x3928a1);});}exports['index']=function(_0x3358ad,_0x309228){var _0x220b83={},_0x25281c={},_0x3fd322={'count':0x0,'rows':[]};var _0x3e491a=_[_0xa598('0x32')](db[_0xa598('0x33')][_0xa598('0x34')],function(_0x27d8a1){return{'name':_0x27d8a1['fieldName'],'type':_0x27d8a1[_0xa598('0x35')][_0xa598('0x36')]};});_0x25281c[_0xa598('0x37')]=_['map'](_0x3e491a,_0xa598('0x1e'));_0x25281c[_0xa598('0x38')]=_[_0xa598('0x39')](_0x3358ad[_0xa598('0x38')]);_0x25281c[_0xa598('0x3a')]=_[_0xa598('0x3b')](_0x25281c['model'],_0x25281c['query']);_0x220b83[_0xa598('0x3c')]=_[_0xa598('0x3b')](_0x25281c['model'],qs[_0xa598('0x3d')](_0x3358ad['query']['fields']));_0x220b83[_0xa598('0x3c')]=_0x220b83['attributes'][_0xa598('0x3e')]?_0x220b83[_0xa598('0x3c')]:_0x25281c[_0xa598('0x37')];if(!_0x3358ad[_0xa598('0x38')][_0xa598('0x3f')](_0xa598('0x40'))){_0x220b83[_0xa598('0x16')]=qs[_0xa598('0x16')](_0x3358ad[_0xa598('0x38')][_0xa598('0x16')]);_0x220b83['offset']=qs[_0xa598('0x14')](_0x3358ad[_0xa598('0x38')][_0xa598('0x14')]);}_0x220b83[_0xa598('0x41')]=qs[_0xa598('0x42')](_0x3358ad[_0xa598('0x38')][_0xa598('0x42')]);_0x220b83['where']=qs[_0xa598('0x3a')](_[_0xa598('0x43')](_0x3358ad[_0xa598('0x38')],_0x25281c[_0xa598('0x3a')]),_0x3e491a);var _0x1755b7=[];var _0x1d1379=squel[_0xa598('0x44')]()[_0xa598('0x45')]('id')['field'](_0xa598('0x1e'))['field'](_0xa598('0x46'))[_0xa598('0x47')](_0xa598('0x48'));var _0x19628b=squel[_0xa598('0x44')]()[_0xa598('0x45')](_0xa598('0x49'))[_0xa598('0x45')](_0xa598('0x4a'))['field']('ui.MailInteractionId')[_0xa598('0x47')](_0xa598('0x4b'),'ui')[_0xa598('0x4c')](_0xa598('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x550391=squel['select']()[_0xa598('0x47')](_0xa598('0x4e'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa598('0x4c')](_0xa598('0x4d'),'o',_0xa598('0x4f'))[_0xa598('0x4c')]('mail_accounts','a',_0xa598('0x50'))[_0xa598('0x4c')](_0xa598('0x51'),'me',_0xa598('0x52'))[_0xa598('0x4c')](_0xa598('0x53'),'it',_0xa598('0x54'))[_0xa598('0x4c')](_0xa598('0x48'),'t','t.id\x20=\x20it.TagId');var _0x12860e=squel['expr']();var _0x5bdb02=[];var _0x3eb752=squel['expr']();var _0x5d4129;if(_0x3358ad[_0xa598('0x38')][_0xa598('0x55')]){_0x5d4129=as['parseSearch'](_0x3358ad[_0xa598('0x38')]['search']);var _0x3ef715=_0x5d4129[_0xa598('0x56')];for(var _0x2b87cf=0x0;_0x2b87cf<_0x5d4129[_0xa598('0x57')][_0xa598('0x3e')];_0x2b87cf++){var _0xa4d02b=_0x5d4129[_0xa598('0x57')][_0x2b87cf];var _0x9cc6='i';var _0x1a355e=_[_0xa598('0x58')](_0x3e491a,[_0xa598('0x1e'),_0xa4d02b[_0xa598('0x45')]]);if(!_0x1a355e){switch(_0xa4d02b[_0xa598('0x45')]){case'unreadMessages':if(_0xa4d02b[_0xa598('0x59')]==0x1){_0x550391[_0xa598('0x5a')]('`'+_0xa4d02b[_0xa598('0x45')]+'`\x20=\x200');}else{_0x550391[_0xa598('0x5a')]('`'+_0xa4d02b[_0xa598('0x45')]+_0xa598('0x5b'));}break;case'Contact':if(_0xa4d02b[_0xa598('0x5c')]===_0xa598('0x5d')){if(_0xa4d02b['value']['split']('\x20')[_0xa598('0x3e')]>0x1){_0x12860e[_0x3ef715]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa598('0x5e')](_0xa4d02b[_0xa598('0x59')]),null);}else{var _0x5c9db8='%'+_0xa4d02b[_0xa598('0x59')]+'%';_0x12860e[_0x3ef715](_0xa598('0x5f'),_0x5c9db8,_0x5c9db8,_0x5c9db8);}}else{_0x1a355e=_[_0xa598('0x58')](_0x3e491a,[_0xa598('0x1e'),'ContactId']);_0xa4d02b[_0xa598('0x45')]=_0xa598('0x60');_0x4c197f=as[_0xa598('0x61')](_0x9cc6,_0x1a355e[_0xa598('0x35')],_0xa4d02b);_0x12860e[_0x3ef715](_0x4c197f['text'],_0x4c197f['value'][_0xa598('0x62')],_0x4c197f[_0xa598('0x59')]['end']);}break;case _0xa598('0x63'):var _0x19c134=_0xa4d02b[_0xa598('0x59')]['split'](',')[_0xa598('0x32')](function(_0xee14e4){return Number(_0xee14e4);});_0x19c134[_0xa598('0x64')](function(_0x4b4cdf){_0x3eb752['or'](_0xa598('0x65'),'%,'+_0x4b4cdf+',%');});_0x5bdb02=_[_0xa598('0x66')](_0x5bdb02,_0x19c134);break;case'User':if(_0xa4d02b[_0xa598('0x5c')]==='$substring'){_0x12860e[_0x3ef715]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xa4d02b[_0xa598('0x59')]+'%',null);}else{_0x1a355e=_[_0xa598('0x58')](_0x3e491a,[_0xa598('0x1e'),_0xa598('0x30')]);_0xa4d02b['field']=_0xa598('0x30');_0x4c197f=as[_0xa598('0x61')](_0x9cc6,_0x1a355e[_0xa598('0x35')],_0xa4d02b);_0x12860e[_0x3ef715](_0x4c197f[_0xa598('0x67')],_0x4c197f[_0xa598('0x59')][_0xa598('0x62')],_0x4c197f[_0xa598('0x59')][_0xa598('0x12')]);}break;case _0xa598('0x27'):_0x4c197f=as[_0xa598('0x61')]('me',null,_0xa4d02b);_0x12860e[_0x3ef715](_0x4c197f['text'],_0x4c197f[_0xa598('0x59')][_0xa598('0x62')],_0x4c197f[_0xa598('0x59')][_0xa598('0x12')]);break;}}else{var _0x4c197f=as[_0xa598('0x61')](_0x9cc6,_0x1a355e[_0xa598('0x35')],_0xa4d02b);_0x12860e[_0x3ef715](_0x4c197f['text'],_0x4c197f[_0xa598('0x59')]['start'],_0x4c197f[_0xa598('0x59')]['end']);}}}else{var _0x4c493f=_(_0x3358ad['query'])[_0xa598('0x39')]()[_0xa598('0x32')](function(_0x5bd627){return _['some'](_0x3e491a,[_0xa598('0x1e'),_0x5bd627])?_0x5bd627:undefined;})[_0xa598('0x68')]()[_0xa598('0x59')]();if(!_[_0xa598('0x69')](_0x4c493f)){_0x4c493f['forEach'](function(_0x2f2140){if(_0x2f2140===_0xa598('0x6a')){_0x550391[_0xa598('0x6b')](_0xa598('0x6c'),[][_0xa598('0x6d')](_0x3358ad[_0xa598('0x38')][_0x2f2140]));}else if(_0x2f2140==='createdAt'){var _0x1b7827=JSON[_0xa598('0x6e')](_0x3358ad[_0xa598('0x38')][_0x2f2140])[_0xa598('0x6f')];var _0x2d0007=JSON[_0xa598('0x6e')](_0x3358ad[_0xa598('0x38')][_0x2f2140])[_0xa598('0x70')];_0x550391[_0xa598('0x6b')](_0xa598('0x71'),_0x1b7827,_0x2d0007);}else{if(_0x3358ad[_0xa598('0x38')][_0x2f2140]===_0xa598('0x72')){_0x550391[_0xa598('0x6b')]('i.'+_0x2f2140+_0xa598('0x73'));}else{_0x550391[_0xa598('0x6b')]('i.'+_0x2f2140+'\x20=\x20?',_0x3358ad['query'][_0x2f2140]);}}});}if(_0x3358ad[_0xa598('0x38')][_0xa598('0x74')]){if(_0x3358ad['query'][_0xa598('0x74')]==0x1){_0x550391['having'](_0xa598('0x75'));}else{_0x550391[_0xa598('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x3358ad['query'][_0xa598('0x76')]){_0x5bdb02=_[_0xa598('0x77')](_0x3358ad[_0xa598('0x38')]['tag'])?_0x3358ad[_0xa598('0x38')][_0xa598('0x76')]:new Array(_0x3358ad[_0xa598('0x38')][_0xa598('0x76')]);_0x5bdb02[_0xa598('0x64')](function(_0x11b5e8){_0x3eb752['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x11b5e8+',%');});}if(_0x3358ad[_0xa598('0x38')]['filter']){var _0x177178=_0x3358ad[_0xa598('0x38')][_0xa598('0x78')][_0xa598('0x79')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xa598('0x7a')](_0x177178)){_0x12860e['or']('i.id\x20LIKE\x20?',_0x177178+'%');}else if(qs[_0xa598('0x7b')](_0x177178)){_0x12860e['or'](_0xa598('0x7c'),_0x177178+'%');}else{_0x12860e['or'](_0xa598('0x7d'),qs[_0xa598('0x5e')](_0x177178))['or'](_0xa598('0x7e'),qs[_0xa598('0x5e')](_0x177178));}}}_0x550391[_0xa598('0x6b')](_0x12860e);_0x550391[_0xa598('0x7f')](_0xa598('0x80'));var _0xcddc13={'type':db['Sequelize']['QueryTypes'][_0xa598('0x81')],'raw':!![]};var _0x311cca=_0x550391['clone']();_0x311cca[_0xa598('0x45')]('i.id');_0x311cca[_0xa598('0x45')](_0xa598('0x82'),_0xa598('0x83'));if(_0x220b83[_0xa598('0x41')]){_0x220b83[_0xa598('0x41')][_0xa598('0x64')](function(_0x34aeb0){var _0x1a306a=_0x34aeb0[0x0]===_0xa598('0x84')?_0x34aeb0[0x0]:'i.'+_0x34aeb0[0x0];_0x550391[_0xa598('0x41')](_0x1a306a,_0x34aeb0[0x1]===_0xa598('0x85')?![]:!![]);});}if(!_[_0xa598('0x69')](_0x5bdb02)){_0x550391[_0xa598('0x5a')](_0x3eb752);_0x311cca[_0xa598('0x6b')](_0xa598('0x86'),_0x5bdb02);}BPromise[_0xa598('0x87')]()[_0xa598('0x1b')](function(){if(!_0x5d4129){if(_0x3358ad[_0xa598('0x38')][_0xa598('0x6a')])return;_0x311cca[_0xa598('0x6b')](_0xa598('0x88'));_0x550391[_0xa598('0x6b')](_0xa598('0x88'));return;}if(_0x3358ad[_0xa598('0x89')][_0xa598('0x8a')]!=='agent')return;return _0x3358ad[_0xa598('0x89')][_0xa598('0x8b')]({'attributes':['id'],'raw':!![]})[_0xa598('0x1b')](function(_0x186864){if(_['isEmpty'](_0x186864)){_0x311cca['where'](_0xa598('0x8c'));_0x550391[_0xa598('0x6b')]('i.MailAccountId\x20IS\x20NULL');}else{_0x311cca['where']('i.MailAccountId\x20IN\x20?',_[_0xa598('0x32')](_0x186864,'id'));_0x550391[_0xa598('0x6b')](_0xa598('0x6c'),_['map'](_0x186864,'id'));}});})[_0xa598('0x1b')](function(){if(_0x3358ad[_0xa598('0x89')][_0xa598('0x8a')]==='agent'&&!_0x5d4129&&!_0x3358ad[_0xa598('0x38')][_0xa598('0x6a')])return[];return db[_0xa598('0x8d')][_0xa598('0x38')](_0x311cca['toString'](),_0xcddc13);})['then'](function(_0x5441c6){_0x3fd322[_0xa598('0x17')]=_0x5441c6[_0xa598('0x3e')];if(_0x3fd322['count']===0x0)return[];return db[_0xa598('0x8d')]['query'](_0x1d1379[_0xa598('0x8e')](),_0xcddc13)[_0xa598('0x1b')](function(_0x1efbcf){_0x1755b7=_[_0xa598('0x8f')](_0x1efbcf,'id');_0xcddc13=_['merge'](_0xcddc13,{'model':db[_0xa598('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3358ad[_0xa598('0x38')][_0xa598('0x3d')]){_0x220b83[_0xa598('0x3c')][_0xa598('0x64')](function(_0x7e30c8){_0x550391['field']('i.'+_0x7e30c8);});}else{_0x550391[_0xa598('0x45')](_0xa598('0x82'),'unreadMessages');_0x550391['field'](_0xa598('0x90'),_0xa598('0x91'));_0x550391[_0xa598('0x45')]('a.mandatoryDisposition',_0xa598('0x92'));_0x550391[_0xa598('0x45')](_0xa598('0x93'),_0xa598('0x84'));_0x550391[_0xa598('0x45')]('i.id');_0x550391['field'](_0xa598('0x94'));_0x550391[_0xa598('0x45')](_0xa598('0x95'));_0x550391[_0xa598('0x45')](_0xa598('0x96'));_0x550391[_0xa598('0x45')](_0xa598('0x97'));_0x550391[_0xa598('0x45')]('i.attach');_0x550391[_0xa598('0x45')](_0xa598('0x98'));_0x550391[_0xa598('0x45')](_0xa598('0x99'));_0x550391['field']('i.subject');_0x550391[_0xa598('0x45')](_0xa598('0x9a'));_0x550391['field'](_0xa598('0x9b'));_0x550391[_0xa598('0x45')](_0xa598('0x9c'));_0x550391[_0xa598('0x45')](_0xa598('0x9d'));_0x550391['field'](_0xa598('0x9e'));_0x550391[_0xa598('0x45')]('i.ContactId');_0x550391[_0xa598('0x45')](_0xa598('0x9f'));_0x550391['field'](_0xa598('0xa0'));_0x550391[_0xa598('0x45')](_0xa598('0xa1'),_0xa598('0xa2'));_0x550391[_0xa598('0x45')]('c.lastName','Contact.lastName');_0x550391[_0xa598('0x45')](_0xa598('0xa3'),_0xa598('0xa4'));_0x550391[_0xa598('0x45')](_0xa598('0xa5'),_0xa598('0xa6'));_0x550391[_0xa598('0x45')](_0xa598('0xa7'),_0xa598('0xa8'));_0x550391[_0xa598('0x45')](_0xa598('0xa9'),_0xa598('0xaa'));_0x550391[_0xa598('0x45')](_0xa598('0xab'),'Owner.fullname');_0x550391['field'](_0xa598('0xac'),'Owner.internal');_0x550391['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa598('0x22'));}if(_0x220b83[_0xa598('0x16')])_0x550391[_0xa598('0x16')](_0x220b83[_0xa598('0x16')]);if(_0x220b83[_0xa598('0x14')])_0x550391[_0xa598('0x14')](_0x220b83[_0xa598('0x14')]);return db[_0xa598('0x8d')][_0xa598('0x38')](_0x550391[_0xa598('0x8e')](),_0xcddc13);})['then'](function(_0x109743){if(_0x109743[_0xa598('0x3e')]>0x0)_0x19628b[_0xa598('0x6b')]('ui.MailInteractionId\x20IN\x20?',_[_0xa598('0x32')](_0x109743,'id'));return db[_0xa598('0x8d')][_0xa598('0x38')](_0x19628b[_0xa598('0x8e')](),_0xcddc13)[_0xa598('0x1b')](function(_0x5eba4d){var _0x51fd63=_['groupBy'](_0x5eba4d,_0xa598('0xad'));var _0x2eafb0=[];return db[_0xa598('0xae')][_0xa598('0x26')]({'attributes':[_0xa598('0xaf')],'raw':!![]})[_0xa598('0x1b')](function(_0x1b2115){var _0x132f9c=_0x1b2115['enableEmailPreview'];_0x109743[_0xa598('0x64')](function(_0xa9c64b){_0x2eafb0[_0xa598('0x25')](updateMailInteraction(_0xa9c64b,_0x1755b7,_0x51fd63,_0x132f9c));});return BPromise['all'](_0x2eafb0);});});});})[_0xa598('0x1b')](function(_0x2c539d){_0x3fd322[_0xa598('0xb0')]=_0x2c539d;return _0x3fd322;})[_0xa598('0x1b')](respondWithFilteredResult(_0x309228,_0x220b83))[_0xa598('0x2b')](handleError(_0x309228,null));};exports[_0xa598('0xb1')]=function(_0x5a7695,_0x2882af){var _0x59b6ca={'raw':![],'where':{'id':_0x5a7695[_0xa598('0xb2')]['id']}},_0x285fea={};_0x285fea[_0xa598('0x37')]=_[_0xa598('0x39')](db['MailInteraction'][_0xa598('0x34')]);_0x285fea[_0xa598('0x38')]=_[_0xa598('0x39')](_0x5a7695[_0xa598('0x38')]);_0x285fea['filters']=_[_0xa598('0x3b')](_0x285fea[_0xa598('0x37')],_0x285fea[_0xa598('0x38')]);_0x59b6ca[_0xa598('0x3c')]=_[_0xa598('0x3b')](_0x285fea[_0xa598('0x37')],qs[_0xa598('0x3d')](_0x5a7695[_0xa598('0x38')][_0xa598('0x3d')]));_0x59b6ca[_0xa598('0x3c')]=_0x59b6ca[_0xa598('0x3c')][_0xa598('0x3e')]?_0x59b6ca['attributes']:_0x285fea[_0xa598('0x37')];if(_0x5a7695[_0xa598('0x38')][_0xa598('0xb3')]){_0x59b6ca[_0xa598('0xb4')]=[{'all':!![]}];}_0x59b6ca=_[_0xa598('0xb5')]({},_0x59b6ca,_0x5a7695[_0xa598('0xb6')]);return db[_0xa598('0x33')][_0xa598('0x58')](_0x59b6ca)[_0xa598('0x1b')](handleEntityNotFound(_0x2882af,null))[_0xa598('0x1b')](respondWithResult(_0x2882af,null))[_0xa598('0x2b')](handleError(_0x2882af,null));};exports['create']=function(_0x5397a9,_0x1da5c5){return db[_0xa598('0x33')]['create'](_0x5397a9['body'],{})[_0xa598('0x1b')](respondWithResult(_0x1da5c5,0xc9))['catch'](handleError(_0x1da5c5,null));};exports['update']=function(_0x236bc6,_0x550a71){if(_0x236bc6[_0xa598('0xb7')]['id']){delete _0x236bc6[_0xa598('0xb7')]['id'];}return db[_0xa598('0x33')][_0xa598('0x58')]({'where':{'id':_0x236bc6[_0xa598('0xb2')]['id']}})[_0xa598('0x1b')](handleEntityNotFound(_0x550a71,null))[_0xa598('0x1b')](saveUpdates(_0x236bc6[_0xa598('0xb7')],null))[_0xa598('0x1b')](respondWithResult(_0x550a71,null))[_0xa598('0x2b')](handleError(_0x550a71,null));};exports[_0xa598('0xb8')]=function(_0x351d0f,_0x9f601d){return db[_0xa598('0x33')][_0xa598('0x58')]({'where':{'id':_0x351d0f[_0xa598('0xb2')]['id']}})[_0xa598('0x1b')](handleEntityNotFound(_0x9f601d,null))['then'](removeEntity(_0x9f601d,null))[_0xa598('0x2b')](handleError(_0x9f601d,null));};exports[_0xa598('0xb9')]=function(_0x3dbd2d,_0x1a1204){return db[_0xa598('0x33')][_0xa598('0xb9')]()['then'](respondWithResult(_0x1a1204,null))[_0xa598('0x2b')](handleError(_0x1a1204,null));};exports[_0xa598('0xba')]=function(_0x5d3187,_0x5606fd){return db[_0xa598('0xbb')][_0xa598('0x58')]({'where':{'id':_0x5d3187['params']['id']}})['then'](handleEntityNotFound(_0x5606fd,null))[_0xa598('0x1b')](function(_0x2c4fd7){if(_0x2c4fd7){return _0x2c4fd7[_0xa598('0xba')](_0x5d3187['body']['ids'],_[_0xa598('0xbc')](_0x5d3187[_0xa598('0xb7')],[_0xa598('0xbd'),'id'])||{});}})[_0xa598('0x1b')](respondWithResult(_0x5606fd,null))[_0xa598('0x2b')](handleError(_0x5606fd,null));};exports[_0xa598('0xbe')]=function(_0xfb6bf9,_0x28d30b){var _0x55b5f7={'raw':![],'where':{}};var _0x538568={};var _0x5dbdd4={'count':0x0,'rows':[]};return db[_0xa598('0x33')][_0xa598('0x26')]({'where':{'id':_0xfb6bf9[_0xa598('0xb2')]['id']}})[_0xa598('0x1b')](handleEntityNotFound(_0x28d30b,null))['then'](function(_0x16f34c){if(_0x16f34c){_0x538568[_0xa598('0x37')]=_['keys'](db[_0xa598('0xbb')][_0xa598('0x34')]);_0x538568[_0xa598('0x38')]=_[_0xa598('0x39')](_0xfb6bf9[_0xa598('0x38')]);_0x538568['filters']=_[_0xa598('0x3b')](_0x538568[_0xa598('0x37')],_0x538568[_0xa598('0x38')]);_0x55b5f7[_0xa598('0x3c')]=_['intersection'](_0x538568[_0xa598('0x37')],qs[_0xa598('0x3d')](_0xfb6bf9[_0xa598('0x38')][_0xa598('0x3d')]));_0x55b5f7['attributes']=_0x55b5f7[_0xa598('0x3c')][_0xa598('0x3e')]?_0x55b5f7[_0xa598('0x3c')]:_0x538568['model'];if(!_0xfb6bf9['query']['hasOwnProperty'](_0xa598('0x40'))){_0x55b5f7[_0xa598('0x16')]=qs['limit'](_0xfb6bf9['query'][_0xa598('0x16')]);_0x55b5f7[_0xa598('0x14')]=qs[_0xa598('0x14')](_0xfb6bf9['query'][_0xa598('0x14')]);}_0x55b5f7[_0xa598('0x41')]=qs[_0xa598('0x42')](_0xfb6bf9[_0xa598('0x38')][_0xa598('0x42')]);_0x55b5f7['where']=qs['filters'](_[_0xa598('0x43')](_0xfb6bf9[_0xa598('0x38')],_0x538568[_0xa598('0x3a')]));_0x55b5f7[_0xa598('0x6b')][_0xa598('0xad')]=_0x16f34c['id'];if(_0xfb6bf9[_0xa598('0x38')][_0xa598('0x78')]){_0x55b5f7['where']=_['merge'](_0x55b5f7[_0xa598('0x6b')],{'$or':_['map'](_0x55b5f7['attributes'],function(_0x1b3086){var _0x546f22={};_0x546f22[_0x1b3086]={'$like':'%'+_0xfb6bf9['query'][_0xa598('0x78')]+'%'};return _0x546f22;})});}if(_0xfb6bf9[_0xa598('0x38')][_0xa598('0x6f')]){var _0x3b2dbf=_0xfb6bf9[_0xa598('0x38')][_0xa598('0x6f')][_0xa598('0x23')](',');var _0x4c2289={};_0x4c2289[_0x3b2dbf[0x0]]={'$gte':moment(_0x3b2dbf[0x1])['format'](_0xa598('0xbf'))};_0x55b5f7['where']=_[_0xa598('0xb5')](_0x55b5f7[_0xa598('0x6b')],_0x4c2289);}_0x55b5f7=_['merge']({},_0x55b5f7,_0xfb6bf9[_0xa598('0xb6')]);return db[_0xa598('0xbb')][_0xa598('0x17')]({'where':_0x55b5f7[_0xa598('0x6b')]})[_0xa598('0x1b')](function(_0x66101b){_0x5dbdd4[_0xa598('0x17')]=_0x66101b;if(_0xfb6bf9['query'][_0xa598('0xb3')]){_0x55b5f7[_0xa598('0xb4')]=[{'all':!![]}];}return db[_0xa598('0xbb')][_0xa598('0xc0')](_0x55b5f7);})[_0xa598('0x1b')](function(_0x1b4290){if(_0xfb6bf9[_0xa598('0x38')][_0xa598('0xc1')]==='true'){for(var _0xc77fa6=0x0;_0xc77fa6<_0x1b4290[_0xa598('0x3e')];_0xc77fa6++){_0x1b4290[_0xc77fa6][_0xa598('0xb7')]=juice(_0x1b4290[_0xc77fa6][_0xa598('0xb7')]);}}_0x5dbdd4['rows']=_0x1b4290;return _0x5dbdd4;});}})[_0xa598('0x1b')](respondWithFilteredResult(_0x28d30b,_0x55b5f7))['catch'](handleError(_0x28d30b,null));};exports[_0xa598('0xc2')]=function(_0x3a35bf,_0x23f565){return db[_0xa598('0x33')][_0xa598('0x58')]({'where':{'id':_0x3a35bf['params']['id']}})[_0xa598('0x1b')](handleEntityNotFound(_0x23f565,null))[_0xa598('0x1b')](function(_0x45e515){if(_0x45e515){return _0x45e515[_0xa598('0xc3')](_0x3a35bf[_0xa598('0xb7')]['ids'],_[_0xa598('0xbc')](_0x3a35bf[_0xa598('0xb7')],[_0xa598('0xbd'),'id'])||{})['spread'](function(){return db[_0xa598('0x63')]['findAll']({'attributes':['id',_0xa598('0x1e'),'color'],'where':{'id':_0x3a35bf['body'][_0xa598('0xbd')]}});})[_0xa598('0x1b')](function(_0x47fd28){socket[_0xa598('0xc4')](_0xa598('0xc5'),{'id':Number(_0x3a35bf[_0xa598('0xb2')]['id']),'tags':_0x47fd28||[]});return{'id':Number(_0x3a35bf[_0xa598('0xb2')]['id']),'tags':_0x47fd28||[]};});}})[_0xa598('0x1b')](respondWithResult(_0x23f565,null))[_0xa598('0x2b')](handleError(_0x23f565,null));};exports[_0xa598('0xc6')]=function(_0x2fceaf,_0x15b0b5){return db['MailInteraction'][_0xa598('0x58')]({'where':{'id':_0x2fceaf[_0xa598('0xb2')]['id']}})[_0xa598('0x1b')](handleEntityNotFound(_0x15b0b5,null))[_0xa598('0x1b')](function(_0x6fb95){if(_0x6fb95){return _0x6fb95[_0xa598('0xc6')](_0x2fceaf[_0xa598('0x38')][_0xa598('0xbd')]);}})['then'](respondWithStatusCode(_0x15b0b5,null))[_0xa598('0x2b')](handleError(_0x15b0b5,null));};exports[_0xa598('0xc7')]=function(_0x945d46,_0x5b6d84){var _0x3a7945=moment()['unix']()[_0xa598('0x8e')]();var _0x32cf7a=path['join'](config['root'],_0xa598('0xc8'),_0xa598('0xc9'),_0xa598('0xca'));var _0x4f1b93=path[_0xa598('0xcb')](config[_0xa598('0xcc')],_0xa598('0xc8'),_0xa598('0xc9'),'attachments');var _0x2977ac=path['join'](_0x32cf7a,_0x3a7945);var _0x352e6f=util[_0xa598('0xcd')](_0xa598('0xce'),_0x945d46[_0xa598('0xb2')]['id'],_0x3a7945);var _0x2d755b=path[_0xa598('0xcb')](_0x32cf7a,_0x352e6f);var _0x5f550a=[];if(_0x945d46[_0xa598('0x38')]['attachments']){_0x5f550a['push']({'model':db['Attachment'],'as':_0xa598('0xcf'),'raw':!![]});}var _0x3a27e2=[{'model':db[_0xa598('0xbb')],'as':'Messages','attributes':['id',_0xa598('0xb7'),'from','to','cc',_0xa598('0xd0'),_0xa598('0xd1'),_0xa598('0xd2')],'where':{'secret':![]},'order':qs[_0xa598('0x42')]('id'),'include':_0x5f550a}];return db['MailInteraction'][_0xa598('0x58')]({'where':{'id':_0x945d46['params']['id']},'include':_0x3a27e2})[_0xa598('0x1b')](handleEntityNotFound(_0x5b6d84,null))[_0xa598('0x1b')](function(_0x535f4c){if(_0x535f4c&&_0x535f4c['Messages']){var _0x1f5c04=_0x535f4c[_0xa598('0xd3')]({'plain':!![]});fs[_0xa598('0xd4')](_0x2977ac);return BPromise[_0xa598('0xd5')](_0x1f5c04['Messages'],function(_0x1be477,_0x37444b){var _0x58cbf5={'from':_0x1be477[_0xa598('0x47')],'to':_0x1be477['to'],'subject':_0x1be477[_0xa598('0xd1')],'html':htmlEntities[_0xa598('0xd6')](_0x1be477['body']),'headers':{'Date':moment(_0x1be477[_0xa598('0xd2')])[_0xa598('0xcd')](_0xa598('0xd7'))},'attachments':[]};if(_0x1be477['cc']){_0x58cbf5[_0xa598('0xd8')]['Cc']=_0x1be477['cc'];}if(_0x1be477[_0xa598('0xd0')]){_0x58cbf5['headers'][_0xa598('0xd9')]=_0x1be477[_0xa598('0xd0')];}return new BPromise(function(_0xe9174,_0x2705c0){if(_0x1be477['Attachments']){for(var _0x3d21dc=0x0;_0x3d21dc<_0x1be477[_0xa598('0xcf')][_0xa598('0x3e')];_0x3d21dc++){var _0x44523a=_0x1be477[_0xa598('0xcf')][_0x3d21dc];var _0x41d204=path['join'](_0x4f1b93,_0x44523a['basename']);if(fs[_0xa598('0xda')](_0x41d204)){_0x58cbf5[_0xa598('0xdb')][_0xa598('0x25')]({'name':_0x44523a[_0xa598('0x1e')],'contentType':_0x44523a[_0xa598('0x35')],'data':fs[_0xa598('0xdc')](_0x41d204)});}}}emlformat[_0xa598('0xdd')](_0x58cbf5,function(_0x59e107,_0x42a160){if(_0x59e107)return _0x2705c0(_0x59e107);fs[_0xa598('0xde')](path[_0xa598('0xcb')](_0x2977ac,util[_0xa598('0xcd')](_0xa598('0xdf'),_0x37444b)),_0x42a160);return _0xe9174(_0x42a160);});});})[_0xa598('0x1b')](function(){return new BPromise(function(_0x1824df,_0x73a028){zipdir(_0x2977ac,{'saveTo':_0x2d755b},function(_0x57925b,_0x471b35){if(_0x57925b)return _0x73a028(_0x57925b);return _0x1824df(_0x471b35);});})[_0xa598('0x1b')](function(){return new BPromise(function(_0x5b4614,_0x52d8e8){rimraf(_0x2977ac,function(_0x25585e){if(_0x25585e)_0x52d8e8(_0x25585e);return _0x5b4614();});});})[_0xa598('0x1b')](function(){return _0x5b6d84[_0xa598('0xc7')](_0x2d755b,_0x352e6f,function(_0xeed92f){if(!_0xeed92f)fs[_0xa598('0xe0')](_0x2d755b);});});});}else{return _0x5b6d84['sendStatus'](0xc8);}})[_0xa598('0x2b')](handleError(_0x5b6d84,null));}; \ No newline at end of file +var _0x44c2=['unix','root','server','files','join','attachments','Attachment','Attachments','bcc','subject','createdAt','Messages','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','util','path','lodash','squel','juice','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','./mailInteraction.socket','end','status','json','offset','limit','count','set','destroy','then','sendStatus','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','tools_tags','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','MailAccountId','where','concat','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','MailInteraction','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','show','params','keys','includeAll','include','create','body','describe','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','addTags','setTags','Tag','removeTags','download'];(function(_0x13dd27,_0x4d00f1){var _0x464db9=function(_0x25ccc2){while(--_0x25ccc2){_0x13dd27['push'](_0x13dd27['shift']());}};_0x464db9(++_0x4d00f1);}(_0x44c2,0x100));var _0x244c=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0x44c2[_0x13606d];return _0x1b85b0;};'use strict';var emlformat=require(_0x244c('0x0'));var rimraf=require(_0x244c('0x1'));var zipdir=require(_0x244c('0x2'));var moment=require(_0x244c('0x3'));var BPromise=require('bluebird');var util=require(_0x244c('0x4'));var path=require(_0x244c('0x5'));var fs=require('fs');var _=require(_0x244c('0x6'));var squel=require(_0x244c('0x7'));var juice=require(_0x244c('0x8'));var Redis=require(_0x244c('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x244c('0xa'))('api');var config=require(_0x244c('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x244c('0xc')]=_[_0x244c('0xd')](config['redis'],{'host':_0x244c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x244c('0xf'))['register'](socket);function respondWithStatusCode(_0x16c6f9,_0x590b69){_0x590b69=_0x590b69||0xcc;return function(_0x118c38){if(_0x118c38){return _0x16c6f9['sendStatus'](_0x590b69);}return _0x16c6f9['status'](_0x590b69)[_0x244c('0x10')]();};}function respondWithResult(_0x313368,_0x2440d0){_0x2440d0=_0x2440d0||0xc8;return function(_0x526c3e){if(_0x526c3e){return _0x313368[_0x244c('0x11')](_0x2440d0)[_0x244c('0x12')](_0x526c3e);}};}function respondWithFilteredResult(_0xc2602,_0x2ee162){return function(_0x7785a7){if(_0x7785a7){var _0x4465a9=typeof _0x2ee162[_0x244c('0x13')]==='undefined'&&typeof _0x2ee162[_0x244c('0x14')]==='undefined';var _0x50538b=_0x7785a7[_0x244c('0x15')];var _0x94e7a4=_0x4465a9?0x0:_0x2ee162[_0x244c('0x13')];var _0x31beaa=_0x4465a9?_0x7785a7['count']:_0x2ee162[_0x244c('0x13')]+_0x2ee162[_0x244c('0x14')];var _0x1aaec4;if(_0x31beaa>=_0x50538b){_0x31beaa=_0x50538b;_0x1aaec4=0xc8;}else{_0x1aaec4=0xce;}_0xc2602[_0x244c('0x11')](_0x1aaec4);return _0xc2602[_0x244c('0x16')]('Content-Range',_0x94e7a4+'-'+_0x31beaa+'/'+_0x50538b)[_0x244c('0x12')](_0x7785a7);}return null;};}function saveUpdates(_0x2af7eb){return function(_0xd49d6a){if(_0xd49d6a){return _0xd49d6a['update'](_0x2af7eb)['then'](function(_0x4c7095){return _0x4c7095;});}return null;};}function removeEntity(_0x330719){return function(_0x1d9711){if(_0x1d9711){return _0x1d9711[_0x244c('0x17')]()[_0x244c('0x18')](function(){_0x330719[_0x244c('0x11')](0xcc)[_0x244c('0x10')]();});}};}function handleEntityNotFound(_0x4b55af){return function(_0x2b9691){if(!_0x2b9691){_0x4b55af[_0x244c('0x19')](0x194);}return _0x2b9691;};}function handleError(_0x10316e,_0x536b8e){_0x536b8e=_0x536b8e||0x1f4;return function(_0x375294){logger['error'](_0x375294['stack']);if(_0x375294[_0x244c('0x1a')]){delete _0x375294[_0x244c('0x1a')];}_0x10316e['status'](_0x536b8e)[_0x244c('0x1b')](_0x375294);};}function getInteractionUsers(_0x189e5e,_0x2147bf){return new BPromise(function(_0x161103,_0x54b7ae){try{if(_0x2147bf[_0x189e5e['id']]){_0x189e5e[_0x244c('0x1c')]=_[_0x244c('0x1d')](_0x2147bf[_0x189e5e['id']],function(_0x227c53){return{'id':_0x227c53['id'],'fullname':_0x227c53[_0x244c('0x1e')]};});}}catch(_0x40adde){_0x54b7ae(_0x40adde);}_0x161103(_0x189e5e);});}function getInteractionTags(_0x584d44,_0x5269cd){return new BPromise(function(_0x19c4fc,_0x2f35a5){try{if(_0x584d44[_0x244c('0x1f')]){_0x584d44[_0x244c('0x20')]=[];_0x584d44[_0x244c('0x1f')][_0x244c('0x21')](',')[_0x244c('0x22')](function(_0x3f9b84){_0x584d44[_0x244c('0x20')][_0x244c('0x23')](_0x5269cd[_0x3f9b84]);});}delete _0x584d44['TagIds'];}catch(_0x5e823d){_0x2f35a5(_0x5e823d);}_0x19c4fc(_0x584d44);});}function getLastMessageText(_0x3bb018){return new BPromise(function(_0x27bcfe,_0x41352b){return db[_0x244c('0x24')][_0x244c('0x25')]({'where':{'$and':[{'MailInteractionId':_0x3bb018['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x244c('0x26')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x244c('0x27'),'raw':!![]})[_0x244c('0x18')](function(_0x445a14){if(_0x445a14&&_0x445a14[_0x244c('0x28')]){_0x3bb018[_0x244c('0x29')]=_[_0x244c('0x2a')](_0x445a14[_0x244c('0x28')]);}_0x27bcfe(_0x3bb018);})[_0x244c('0x2b')](function(_0x15aeaf){_0x41352b(_0x15aeaf);});});}function updateMailInteraction(_0x349152,_0x3ed2c1,_0x17f62a,_0x5ab647){return new BPromise(function(_0x3c526e,_0x413d04){return getInteractionUsers(_0x349152,_0x17f62a)[_0x244c('0x18')](function(_0x34e898){return getInteractionTags(_0x34e898,_0x3ed2c1);})[_0x244c('0x18')](function(_0x442ab8){return getStateInteraction(_0x442ab8);})[_0x244c('0x18')](function(_0x18e3a6){if(_0x5ab647){_0x3c526e(getLastMessageText(_0x18e3a6));}else{_0x3c526e(_0x18e3a6);}})['catch'](function(_0x2e6a88){_0x413d04(_0x2e6a88);});});}function getStateInteraction(_0x14c830){return new BPromise(function(_0x4dd3a3){_0x14c830[_0x244c('0x2c')]=0x0;_0x14c830[_0x244c('0x2d')]=0x0;_0x14c830[_0x244c('0x2e')]=0x0;_0x14c830[_0x244c('0x2f')]=0x0;_0x14c830[_0x244c('0x30')]=0x0;if(!_0x14c830[_0x244c('0x31')]&&!_0x14c830[_0x244c('0x32')]){_0x14c830[_0x244c('0x2c')]+=0x1;}if(!_0x14c830[_0x244c('0x31')]&&_0x14c830[_0x244c('0x32')]){_0x14c830['talking']+=0x1;if(_0x14c830[_0x244c('0x2c')]){_0x14c830[_0x244c('0x2c')]-=0x1;}}if(_0x14c830[_0x244c('0x31')]&&_0x14c830[_0x244c('0x32')]){_0x14c830[_0x244c('0x2e')]+=0x1;if(_0x14c830['talking']){_0x14c830['talking']-=0x1;}}if(_0x14c830[_0x244c('0x31')]&&!_0x14c830['UserId']){_0x14c830[_0x244c('0x2f')]+=0x1;if(_0x14c830[_0x244c('0x2c')]){_0x14c830[_0x244c('0x2c')]-=0x1;}}_0x14c830[_0x244c('0x30')]+=0x1;_0x4dd3a3(_0x14c830);});}exports[_0x244c('0x33')]=function(_0x3f52ce,_0x49bff7){var _0x58ba1e={},_0x320272={},_0x28f93a={'count':0x0,'rows':[]};var _0x3fe303=_[_0x244c('0x1d')](db['MailInteraction'][_0x244c('0x34')],function(_0x472662){return{'name':_0x472662['fieldName'],'type':_0x472662[_0x244c('0x35')]['key']};});_0x320272[_0x244c('0x36')]=_[_0x244c('0x1d')](_0x3fe303,_0x244c('0x1a'));_0x320272[_0x244c('0x37')]=_['keys'](_0x3f52ce['query']);_0x320272[_0x244c('0x38')]=_['intersection'](_0x320272[_0x244c('0x36')],_0x320272[_0x244c('0x37')]);_0x58ba1e[_0x244c('0x39')]=_[_0x244c('0x3a')](_0x320272[_0x244c('0x36')],qs[_0x244c('0x3b')](_0x3f52ce[_0x244c('0x37')]['fields']));_0x58ba1e[_0x244c('0x39')]=_0x58ba1e[_0x244c('0x39')][_0x244c('0x3c')]?_0x58ba1e[_0x244c('0x39')]:_0x320272[_0x244c('0x36')];if(!_0x3f52ce[_0x244c('0x37')][_0x244c('0x3d')](_0x244c('0x3e'))){_0x58ba1e[_0x244c('0x14')]=qs[_0x244c('0x14')](_0x3f52ce[_0x244c('0x37')][_0x244c('0x14')]);_0x58ba1e[_0x244c('0x13')]=qs[_0x244c('0x13')](_0x3f52ce[_0x244c('0x37')][_0x244c('0x13')]);}_0x58ba1e[_0x244c('0x3f')]=qs[_0x244c('0x40')](_0x3f52ce[_0x244c('0x37')]['sort']);_0x58ba1e['where']=qs[_0x244c('0x38')](_[_0x244c('0x41')](_0x3f52ce[_0x244c('0x37')],_0x320272[_0x244c('0x38')]),_0x3fe303);var _0x50088c=[];var _0x104823=squel[_0x244c('0x42')]()[_0x244c('0x43')]('id')[_0x244c('0x43')](_0x244c('0x1a'))[_0x244c('0x43')](_0x244c('0x44'))[_0x244c('0x45')]('tools_tags');var _0x88a54b=squel['select']()[_0x244c('0x43')](_0x244c('0x46'))['field'](_0x244c('0x47'))[_0x244c('0x43')](_0x244c('0x48'))[_0x244c('0x45')]('user_has_mail_interactions','ui')[_0x244c('0x49')](_0x244c('0x4a'),'u',_0x244c('0x4b'));var _0x3a2e36=squel[_0x244c('0x42')]()[_0x244c('0x45')]('mail_interactions','i')['left_join'](_0x244c('0x4c'),'c',_0x244c('0x4d'))[_0x244c('0x49')](_0x244c('0x4a'),'o',_0x244c('0x4e'))[_0x244c('0x49')](_0x244c('0x4f'),'a',_0x244c('0x50'))[_0x244c('0x49')](_0x244c('0x51'),'me',_0x244c('0x52'))[_0x244c('0x49')](_0x244c('0x53'),'it','it.MailInteractionId\x20=\x20i.id')[_0x244c('0x49')](_0x244c('0x54'),'t','t.id\x20=\x20it.TagId');var _0x52db08=squel['expr']();var _0xd9a210=[];var _0x5e423a=squel[_0x244c('0x55')]();var _0xfd0bd6;if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x56')]){_0xfd0bd6=as['parseSearch'](_0x3f52ce[_0x244c('0x37')][_0x244c('0x56')]);var _0x37049b=_0xfd0bd6[_0x244c('0x57')];for(var _0x6a2015=0x0;_0x6a2015<_0xfd0bd6[_0x244c('0x58')][_0x244c('0x3c')];_0x6a2015++){var _0x5a0dd7=_0xfd0bd6[_0x244c('0x58')][_0x6a2015];var _0x2c94ce='i';var _0x12f98c=_[_0x244c('0x59')](_0x3fe303,[_0x244c('0x1a'),_0x5a0dd7[_0x244c('0x43')]]);if(!_0x12f98c){switch(_0x5a0dd7[_0x244c('0x43')]){case _0x244c('0x5a'):if(_0x5a0dd7['value']==0x1){_0x3a2e36[_0x244c('0x5b')]('`'+_0x5a0dd7[_0x244c('0x43')]+'`\x20=\x200');}else{_0x3a2e36['having']('`'+_0x5a0dd7[_0x244c('0x43')]+_0x244c('0x5c'));}break;case _0x244c('0x5d'):if(_0x5a0dd7[_0x244c('0x5e')]===_0x244c('0x5f')){if(_0x5a0dd7[_0x244c('0x60')]['split']('\x20')[_0x244c('0x3c')]>0x1){_0x52db08[_0x37049b](_0x244c('0x61'),qs[_0x244c('0x62')](_0x5a0dd7['value']),null);}else{var _0x517bfd='%'+_0x5a0dd7[_0x244c('0x60')]+'%';_0x52db08[_0x37049b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x517bfd,_0x517bfd,_0x517bfd);}}else{_0x12f98c=_[_0x244c('0x59')](_0x3fe303,[_0x244c('0x1a'),_0x244c('0x63')]);_0x5a0dd7[_0x244c('0x43')]=_0x244c('0x63');_0x24669f=as[_0x244c('0x64')](_0x2c94ce,_0x12f98c['type'],_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f[_0x244c('0x65')],_0x24669f[_0x244c('0x60')][_0x244c('0x66')],_0x24669f[_0x244c('0x60')][_0x244c('0x10')]);}break;case'Tag':var _0x338a51=_0x5a0dd7[_0x244c('0x60')]['split'](',')['map'](function(_0x25cd93){return Number(_0x25cd93);});_0x338a51[_0x244c('0x22')](function(_0x13b0b3){_0x5e423a['or'](_0x244c('0x67'),'%,'+_0x13b0b3+',%');});_0xd9a210=_[_0x244c('0x68')](_0xd9a210,_0x338a51);break;case _0x244c('0x69'):if(_0x5a0dd7[_0x244c('0x5e')]===_0x244c('0x5f')){_0x52db08[_0x37049b](_0x244c('0x6a'),'%'+_0x5a0dd7[_0x244c('0x60')]+'%',null);}else{_0x12f98c=_[_0x244c('0x59')](_0x3fe303,['name',_0x244c('0x32')]);_0x5a0dd7[_0x244c('0x43')]='UserId';_0x24669f=as['buildExpression'](_0x2c94ce,_0x12f98c[_0x244c('0x35')],_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f[_0x244c('0x65')],_0x24669f[_0x244c('0x60')]['start'],_0x24669f[_0x244c('0x60')]['end']);}break;case _0x244c('0x28'):_0x24669f=as[_0x244c('0x64')]('me',null,_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f[_0x244c('0x65')],_0x24669f[_0x244c('0x60')][_0x244c('0x66')],_0x24669f[_0x244c('0x60')][_0x244c('0x10')]);break;}}else{var _0x24669f=as['buildExpression'](_0x2c94ce,_0x12f98c[_0x244c('0x35')],_0x5a0dd7);_0x52db08[_0x37049b](_0x24669f['text'],_0x24669f[_0x244c('0x60')][_0x244c('0x66')],_0x24669f[_0x244c('0x60')][_0x244c('0x10')]);}}}else{var _0x303308=_(_0x3f52ce[_0x244c('0x37')])['keys']()[_0x244c('0x1d')](function(_0x585eaa){return _[_0x244c('0x6b')](_0x3fe303,[_0x244c('0x1a'),_0x585eaa])?_0x585eaa:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x303308)){_0x303308[_0x244c('0x22')](function(_0x4d40f5){if(_0x4d40f5===_0x244c('0x6c')){_0x3a2e36[_0x244c('0x6d')]('i.MailAccountId\x20IN\x20?',[][_0x244c('0x6e')](_0x3f52ce[_0x244c('0x37')][_0x4d40f5]));}else if(_0x4d40f5==='createdAt'){var _0x14f922=JSON['parse'](_0x3f52ce[_0x244c('0x37')][_0x4d40f5])[_0x244c('0x6f')];var _0x17ea65=JSON[_0x244c('0x70')](_0x3f52ce[_0x244c('0x37')][_0x4d40f5])['$lte'];_0x3a2e36['where'](_0x244c('0x71'),_0x14f922,_0x17ea65);}else{if(_0x3f52ce[_0x244c('0x37')][_0x4d40f5]==='null'){_0x3a2e36['where']('i.'+_0x4d40f5+_0x244c('0x72'));}else{_0x3a2e36[_0x244c('0x6d')]('i.'+_0x4d40f5+_0x244c('0x73'),_0x3f52ce['query'][_0x4d40f5]);}}});}if(_0x3f52ce['query'][_0x244c('0x74')]){if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x74')]==0x1){_0x3a2e36[_0x244c('0x5b')](_0x244c('0x75'));}else{_0x3a2e36[_0x244c('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x76')]){_0xd9a210=_[_0x244c('0x77')](_0x3f52ce[_0x244c('0x37')]['tag'])?_0x3f52ce['query'][_0x244c('0x76')]:new Array(_0x3f52ce[_0x244c('0x37')][_0x244c('0x76')]);_0xd9a210[_0x244c('0x22')](function(_0x33e7f0){_0x5e423a['or'](_0x244c('0x67'),'%,'+_0x33e7f0+',%');});}if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x78')]){var _0x46ae45=_0x3f52ce['query']['filter'][_0x244c('0x79')]('\x5c','\x5c\x5c')[_0x244c('0x79')](/'/g,'\x27\x27');if(qs[_0x244c('0x7a')](_0x46ae45)){_0x52db08['or'](_0x244c('0x7b'),_0x46ae45+'%');}else if(qs[_0x244c('0x7c')](_0x46ae45)){_0x52db08['or'](_0x244c('0x7d'),_0x46ae45+'%');}else{_0x52db08['or'](_0x244c('0x7e'),qs['getFullTextValue'](_0x46ae45))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x46ae45));}}}_0x3a2e36[_0x244c('0x6d')](_0x52db08);_0x3a2e36[_0x244c('0x7f')](_0x244c('0x80'));var _0x597a25={'type':db[_0x244c('0x81')][_0x244c('0x82')][_0x244c('0x83')],'raw':!![]};var _0xa80983=_0x3a2e36['clone']();_0xa80983['field'](_0x244c('0x80'));_0xa80983[_0x244c('0x43')](_0x244c('0x84'),_0x244c('0x5a'));if(_0x58ba1e[_0x244c('0x3f')]){_0x58ba1e[_0x244c('0x3f')][_0x244c('0x22')](function(_0x44bb0a){var _0x526657=_0x44bb0a[0x0]===_0x244c('0x85')?_0x44bb0a[0x0]:'i.'+_0x44bb0a[0x0];_0x3a2e36[_0x244c('0x3f')](_0x526657,_0x44bb0a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x244c('0x86')](_0xd9a210)){_0x3a2e36[_0x244c('0x5b')](_0x5e423a);_0xa80983['where'](_0x244c('0x87'),_0xd9a210);}BPromise[_0x244c('0x88')]()[_0x244c('0x18')](function(){if(!_0xfd0bd6){if(_0x3f52ce[_0x244c('0x37')][_0x244c('0x6c')])return;_0xa80983['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x3a2e36[_0x244c('0x6d')](_0x244c('0x89'));return;}if(_0x3f52ce[_0x244c('0x8a')][_0x244c('0x8b')]!==_0x244c('0x8c'))return;return _0x3f52ce[_0x244c('0x8a')][_0x244c('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10f519){if(_[_0x244c('0x86')](_0x10f519)){_0xa80983[_0x244c('0x6d')]('i.MailAccountId\x20IS\x20NULL');_0x3a2e36[_0x244c('0x6d')](_0x244c('0x8e'));}else{_0xa80983[_0x244c('0x6d')](_0x244c('0x8f'),_[_0x244c('0x1d')](_0x10f519,'id'));_0x3a2e36[_0x244c('0x6d')](_0x244c('0x8f'),_[_0x244c('0x1d')](_0x10f519,'id'));}});})[_0x244c('0x18')](function(){if(_0x3f52ce[_0x244c('0x8a')][_0x244c('0x8b')]===_0x244c('0x8c')&&!_0xfd0bd6&&!_0x3f52ce[_0x244c('0x37')][_0x244c('0x6c')])return[];return db[_0x244c('0x90')][_0x244c('0x37')](_0xa80983[_0x244c('0x91')](),_0x597a25);})['then'](function(_0x1dd25f){_0x28f93a[_0x244c('0x15')]=_0x1dd25f['length'];if(_0x28f93a[_0x244c('0x15')]===0x0)return[];return db[_0x244c('0x90')][_0x244c('0x37')](_0x104823['toString'](),_0x597a25)[_0x244c('0x18')](function(_0x23312b){_0x50088c=_[_0x244c('0x92')](_0x23312b,'id');_0x597a25=_[_0x244c('0x93')](_0x597a25,{'model':db[_0x244c('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f52ce[_0x244c('0x37')]['fields']){_0x58ba1e[_0x244c('0x39')][_0x244c('0x22')](function(_0x36303d){_0x3a2e36[_0x244c('0x43')]('i.'+_0x36303d);});}else{_0x3a2e36['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3a2e36[_0x244c('0x43')](_0x244c('0x95'),_0x244c('0x96'));_0x3a2e36['field']('a.mandatoryDisposition',_0x244c('0x97'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x98'),_0x244c('0x85'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x80'));_0x3a2e36[_0x244c('0x43')]('i.createdAt');_0x3a2e36['field'](_0x244c('0x99'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x9a'));_0x3a2e36['field'](_0x244c('0x9b'));_0x3a2e36[_0x244c('0x43')]('i.attach');_0x3a2e36[_0x244c('0x43')]('i.lastMsgAt');_0x3a2e36['field'](_0x244c('0x9c'));_0x3a2e36['field'](_0x244c('0x9d'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x9e'));_0x3a2e36[_0x244c('0x43')](_0x244c('0x9f'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa0'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa1'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa2'));_0x3a2e36['field'](_0x244c('0xa3'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa4'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa5'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xa6'),'Contact.firstName');_0x3a2e36['field'](_0x244c('0xa7'),'Contact.lastName');_0x3a2e36[_0x244c('0x43')](_0x244c('0xa8'),_0x244c('0xa9'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xaa'),_0x244c('0xab'));_0x3a2e36[_0x244c('0x43')]('c.mobile','Contact.mobile');_0x3a2e36[_0x244c('0x43')](_0x244c('0xac'),_0x244c('0xad'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xae'),_0x244c('0xaf'));_0x3a2e36[_0x244c('0x43')](_0x244c('0xb0'),'Owner.internal');_0x3a2e36[_0x244c('0x43')](_0x244c('0xb1'),'TagIds');}if(_0x58ba1e[_0x244c('0x14')])_0x3a2e36['limit'](_0x58ba1e[_0x244c('0x14')]);if(_0x58ba1e[_0x244c('0x13')])_0x3a2e36[_0x244c('0x13')](_0x58ba1e[_0x244c('0x13')]);return db['sequelize'][_0x244c('0x37')](_0x3a2e36[_0x244c('0x91')](),_0x597a25);})['then'](function(_0x16b752){if(_0x16b752['length']>0x0)_0x88a54b['where'](_0x244c('0xb2'),_[_0x244c('0x1d')](_0x16b752,'id'));return db[_0x244c('0x90')]['query'](_0x88a54b[_0x244c('0x91')](),_0x597a25)[_0x244c('0x18')](function(_0x50ff0c){var _0x22f704=_[_0x244c('0xb3')](_0x50ff0c,_0x244c('0xb4'));var _0x43df8d=[];return db['Setting']['findOne']({'attributes':[_0x244c('0xb5')],'raw':!![]})[_0x244c('0x18')](function(_0x3438b4){var _0x52a47b=_0x3438b4[_0x244c('0xb5')];_0x16b752[_0x244c('0x22')](function(_0x2c74ae){_0x43df8d[_0x244c('0x23')](updateMailInteraction(_0x2c74ae,_0x50088c,_0x22f704,_0x52a47b));});return BPromise[_0x244c('0xb6')](_0x43df8d);});});});})['then'](function(_0x1d24ae){_0x28f93a[_0x244c('0xb7')]=_0x1d24ae;return _0x28f93a;})[_0x244c('0x18')](respondWithFilteredResult(_0x49bff7,_0x58ba1e))['catch'](handleError(_0x49bff7,null));};exports[_0x244c('0xb8')]=function(_0x41f6c8,_0x122c76){var _0x44d6ef={'raw':![],'where':{'id':_0x41f6c8[_0x244c('0xb9')]['id']}},_0x2e6f6e={};_0x2e6f6e[_0x244c('0x36')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x2e6f6e[_0x244c('0x37')]=_[_0x244c('0xba')](_0x41f6c8[_0x244c('0x37')]);_0x2e6f6e[_0x244c('0x38')]=_['intersection'](_0x2e6f6e[_0x244c('0x36')],_0x2e6f6e[_0x244c('0x37')]);_0x44d6ef[_0x244c('0x39')]=_['intersection'](_0x2e6f6e[_0x244c('0x36')],qs['fields'](_0x41f6c8[_0x244c('0x37')][_0x244c('0x3b')]));_0x44d6ef['attributes']=_0x44d6ef[_0x244c('0x39')]['length']?_0x44d6ef[_0x244c('0x39')]:_0x2e6f6e[_0x244c('0x36')];if(_0x41f6c8[_0x244c('0x37')][_0x244c('0xbb')]){_0x44d6ef[_0x244c('0xbc')]=[{'all':!![]}];}_0x44d6ef=_[_0x244c('0x93')]({},_0x44d6ef,_0x41f6c8['options']);return db[_0x244c('0x94')][_0x244c('0x59')](_0x44d6ef)['then'](handleEntityNotFound(_0x122c76,null))[_0x244c('0x18')](respondWithResult(_0x122c76,null))[_0x244c('0x2b')](handleError(_0x122c76,null));};exports[_0x244c('0xbd')]=function(_0x350e40,_0x40200f){return db[_0x244c('0x94')][_0x244c('0xbd')](_0x350e40['body'],{})[_0x244c('0x18')](respondWithResult(_0x40200f,0xc9))[_0x244c('0x2b')](handleError(_0x40200f,null));};exports['update']=function(_0x5143e3,_0x46b264){if(_0x5143e3[_0x244c('0xbe')]['id']){delete _0x5143e3[_0x244c('0xbe')]['id'];}return db['MailInteraction'][_0x244c('0x59')]({'where':{'id':_0x5143e3['params']['id']}})[_0x244c('0x18')](handleEntityNotFound(_0x46b264,null))[_0x244c('0x18')](saveUpdates(_0x5143e3['body'],null))[_0x244c('0x18')](respondWithResult(_0x46b264,null))['catch'](handleError(_0x46b264,null));};exports['destroy']=function(_0x1367fd,_0xadd8a7){return db[_0x244c('0x94')]['find']({'where':{'id':_0x1367fd['params']['id']}})[_0x244c('0x18')](handleEntityNotFound(_0xadd8a7,null))['then'](removeEntity(_0xadd8a7,null))[_0x244c('0x2b')](handleError(_0xadd8a7,null));};exports[_0x244c('0xbf')]=function(_0x47db61,_0x44e2af){return db[_0x244c('0x94')]['describe']()[_0x244c('0x18')](respondWithResult(_0x44e2af,null))['catch'](handleError(_0x44e2af,null));};exports['addMessage']=function(_0x299fb8,_0x55e94b){return db['MailMessage']['find']({'where':{'id':_0x299fb8['params']['id']}})['then'](handleEntityNotFound(_0x55e94b,null))[_0x244c('0x18')](function(_0x49dc73){if(_0x49dc73){return _0x49dc73['addMessage'](_0x299fb8[_0x244c('0xbe')][_0x244c('0xc0')],_[_0x244c('0xc1')](_0x299fb8[_0x244c('0xbe')],[_0x244c('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x55e94b,null))['catch'](handleError(_0x55e94b,null));};exports[_0x244c('0xc2')]=function(_0x5860a1,_0x457c19){var _0x3c2a78={'raw':![],'where':{}};var _0x5428fa={};var _0x10a9fd={'count':0x0,'rows':[]};return db['MailInteraction'][_0x244c('0x25')]({'where':{'id':_0x5860a1[_0x244c('0xb9')]['id']}})[_0x244c('0x18')](handleEntityNotFound(_0x457c19,null))['then'](function(_0x160f0e){if(_0x160f0e){_0x5428fa['model']=_[_0x244c('0xba')](db[_0x244c('0x24')][_0x244c('0x34')]);_0x5428fa[_0x244c('0x37')]=_[_0x244c('0xba')](_0x5860a1[_0x244c('0x37')]);_0x5428fa[_0x244c('0x38')]=_[_0x244c('0x3a')](_0x5428fa[_0x244c('0x36')],_0x5428fa[_0x244c('0x37')]);_0x3c2a78['attributes']=_['intersection'](_0x5428fa[_0x244c('0x36')],qs[_0x244c('0x3b')](_0x5860a1[_0x244c('0x37')]['fields']));_0x3c2a78[_0x244c('0x39')]=_0x3c2a78['attributes'][_0x244c('0x3c')]?_0x3c2a78[_0x244c('0x39')]:_0x5428fa['model'];if(!_0x5860a1['query'][_0x244c('0x3d')](_0x244c('0x3e'))){_0x3c2a78[_0x244c('0x14')]=qs[_0x244c('0x14')](_0x5860a1['query'][_0x244c('0x14')]);_0x3c2a78[_0x244c('0x13')]=qs[_0x244c('0x13')](_0x5860a1[_0x244c('0x37')][_0x244c('0x13')]);}_0x3c2a78[_0x244c('0x3f')]=qs[_0x244c('0x40')](_0x5860a1[_0x244c('0x37')][_0x244c('0x40')]);_0x3c2a78['where']=qs[_0x244c('0x38')](_[_0x244c('0x41')](_0x5860a1['query'],_0x5428fa[_0x244c('0x38')]));_0x3c2a78[_0x244c('0x6d')][_0x244c('0xb4')]=_0x160f0e['id'];if(_0x5860a1[_0x244c('0x37')][_0x244c('0x78')]){_0x3c2a78[_0x244c('0x6d')]=_[_0x244c('0x93')](_0x3c2a78[_0x244c('0x6d')],{'$or':_['map'](_0x3c2a78[_0x244c('0x39')],function(_0x45c3de){var _0x1a141f={};_0x1a141f[_0x45c3de]={'$like':'%'+_0x5860a1[_0x244c('0x37')]['filter']+'%'};return _0x1a141f;})});}if(_0x5860a1[_0x244c('0x37')][_0x244c('0x6f')]){var _0x322bfb=_0x5860a1[_0x244c('0x37')][_0x244c('0x6f')][_0x244c('0x21')](',');var _0x403704={};_0x403704[_0x322bfb[0x0]]={'$gte':moment(_0x322bfb[0x1])[_0x244c('0xc3')](_0x244c('0xc4'))};_0x3c2a78[_0x244c('0x6d')]=_[_0x244c('0x93')](_0x3c2a78[_0x244c('0x6d')],_0x403704);}_0x3c2a78=_[_0x244c('0x93')]({},_0x3c2a78,_0x5860a1[_0x244c('0xc5')]);return db[_0x244c('0x24')][_0x244c('0x15')]({'where':_0x3c2a78[_0x244c('0x6d')]})[_0x244c('0x18')](function(_0x260f2a){_0x10a9fd['count']=_0x260f2a;if(_0x5860a1['query']['includeAll']){_0x3c2a78[_0x244c('0xbc')]=[{'all':!![]}];}return db[_0x244c('0x24')][_0x244c('0xc6')](_0x3c2a78);})[_0x244c('0x18')](function(_0x2373f5){if(_0x5860a1[_0x244c('0x37')][_0x244c('0xc7')]===_0x244c('0xc8')){for(var _0x112dad=0x0;_0x112dad<_0x2373f5[_0x244c('0x3c')];_0x112dad++){_0x2373f5[_0x112dad][_0x244c('0xbe')]=juice(_0x2373f5[_0x112dad]['body']);}}_0x10a9fd[_0x244c('0xb7')]=_0x2373f5;return _0x10a9fd;});}})[_0x244c('0x18')](respondWithFilteredResult(_0x457c19,_0x3c2a78))[_0x244c('0x2b')](handleError(_0x457c19,null));};exports[_0x244c('0xc9')]=function(_0x4650a6,_0x2d1a9b){return db[_0x244c('0x94')][_0x244c('0x59')]({'where':{'id':_0x4650a6[_0x244c('0xb9')]['id']}})[_0x244c('0x18')](handleEntityNotFound(_0x2d1a9b,null))['then'](function(_0x3158c3){if(_0x3158c3){return _0x3158c3[_0x244c('0xca')](_0x4650a6[_0x244c('0xbe')][_0x244c('0xc0')],_[_0x244c('0xc1')](_0x4650a6[_0x244c('0xbe')],[_0x244c('0xc0'),'id'])||{})['spread'](function(){return db[_0x244c('0xcb')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4650a6[_0x244c('0xbe')]['ids']}});})[_0x244c('0x18')](function(_0x333e48){socket['emit']('mailInteractionTags:save',{'id':Number(_0x4650a6[_0x244c('0xb9')]['id']),'tags':_0x333e48||[]});return{'id':Number(_0x4650a6[_0x244c('0xb9')]['id']),'tags':_0x333e48||[]};});}})[_0x244c('0x18')](respondWithResult(_0x2d1a9b,null))[_0x244c('0x2b')](handleError(_0x2d1a9b,null));};exports[_0x244c('0xcc')]=function(_0x496311,_0xe12c5f){return db[_0x244c('0x94')][_0x244c('0x59')]({'where':{'id':_0x496311['params']['id']}})[_0x244c('0x18')](handleEntityNotFound(_0xe12c5f,null))[_0x244c('0x18')](function(_0x56814b){if(_0x56814b){return _0x56814b[_0x244c('0xcc')](_0x496311[_0x244c('0x37')][_0x244c('0xc0')]);}})[_0x244c('0x18')](respondWithStatusCode(_0xe12c5f,null))[_0x244c('0x2b')](handleError(_0xe12c5f,null));};exports[_0x244c('0xcd')]=function(_0x2d3a79,_0x37737e){var _0x393619=moment()[_0x244c('0xce')]()[_0x244c('0x91')]();var _0x522605=path['join'](config[_0x244c('0xcf')],_0x244c('0xd0'),_0x244c('0xd1'),'tmp');var _0x95094e=path[_0x244c('0xd2')](config[_0x244c('0xcf')],_0x244c('0xd0'),'files','attachments');var _0x40408b=path['join'](_0x522605,_0x393619);var _0x39e52f=util[_0x244c('0xc3')]('transcript-%d-%s.zip',_0x2d3a79['params']['id'],_0x393619);var _0x113ea3=path[_0x244c('0xd2')](_0x522605,_0x39e52f);var _0x37df0b=[];if(_0x2d3a79[_0x244c('0x37')][_0x244c('0xd3')]){_0x37df0b[_0x244c('0x23')]({'model':db[_0x244c('0xd4')],'as':_0x244c('0xd5'),'raw':!![]});}var _0x3a8605=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x244c('0xbe'),_0x244c('0x45'),'to','cc',_0x244c('0xd6'),_0x244c('0xd7'),_0x244c('0xd8')],'where':{'secret':![]},'order':qs[_0x244c('0x40')]('id'),'include':_0x37df0b}];return db[_0x244c('0x94')][_0x244c('0x59')]({'where':{'id':_0x2d3a79['params']['id']},'include':_0x3a8605})['then'](handleEntityNotFound(_0x37737e,null))['then'](function(_0x4fe419){if(_0x4fe419&&_0x4fe419[_0x244c('0xd9')]){var _0x15a616=_0x4fe419[_0x244c('0xda')]({'plain':!![]});fs[_0x244c('0xdb')](_0x40408b);return BPromise[_0x244c('0xdc')](_0x15a616[_0x244c('0xd9')],function(_0x21ec78,_0x3e1cc7){var _0x13804e={'from':_0x21ec78[_0x244c('0x45')],'to':_0x21ec78['to'],'subject':_0x21ec78['subject'],'html':htmlEntities[_0x244c('0xdd')](_0x21ec78['body']),'headers':{'Date':moment(_0x21ec78[_0x244c('0xd8')])['format'](_0x244c('0xde'))},'attachments':[]};if(_0x21ec78['cc']){_0x13804e[_0x244c('0xdf')]['Cc']=_0x21ec78['cc'];}if(_0x21ec78[_0x244c('0xd6')]){_0x13804e[_0x244c('0xdf')][_0x244c('0xe0')]=_0x21ec78['bcc'];}return new BPromise(function(_0x143193,_0x357ee8){if(_0x21ec78[_0x244c('0xd5')]){for(var _0x518d4f=0x0;_0x518d4f<_0x21ec78['Attachments'][_0x244c('0x3c')];_0x518d4f++){var _0xe7ad4b=_0x21ec78[_0x244c('0xd5')][_0x518d4f];var _0x4bc00d=path['join'](_0x95094e,_0xe7ad4b[_0x244c('0xe1')]);if(fs[_0x244c('0xe2')](_0x4bc00d)){_0x13804e[_0x244c('0xd3')]['push']({'name':_0xe7ad4b[_0x244c('0x1a')],'contentType':_0xe7ad4b[_0x244c('0x35')],'data':fs[_0x244c('0xe3')](_0x4bc00d)});}}}emlformat[_0x244c('0xe4')](_0x13804e,function(_0x145a72,_0x9018c1){if(_0x145a72)return _0x357ee8(_0x145a72);fs[_0x244c('0xe5')](path['join'](_0x40408b,util[_0x244c('0xc3')](_0x244c('0xe6'),_0x3e1cc7)),_0x9018c1);return _0x143193(_0x9018c1);});});})[_0x244c('0x18')](function(){return new BPromise(function(_0x697258,_0xc19b5){zipdir(_0x40408b,{'saveTo':_0x113ea3},function(_0x40d9f6,_0x219bc6){if(_0x40d9f6)return _0xc19b5(_0x40d9f6);return _0x697258(_0x219bc6);});})[_0x244c('0x18')](function(){return new BPromise(function(_0x20e666,_0x2f24cf){rimraf(_0x40408b,function(_0xaedc3a){if(_0xaedc3a)_0x2f24cf(_0xaedc3a);return _0x20e666();});});})[_0x244c('0x18')](function(){return _0x37737e[_0x244c('0xcd')](_0x113ea3,_0x39e52f,function(_0x480f66){if(!_0x480f66)fs['unlinkSync'](_0x113ea3);});});});}else{return _0x37737e['sendStatus'](0xc8);}})[_0x244c('0x2b')](handleError(_0x37737e,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2acd7f0..f21c2d0 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 _0xb1b9=['hook','events','../../mysqldb','MailInteraction','MailMessage','save','update','getUsers','then','Users','map','length','emit','catch','hasOwnProperty'];(function(_0x3895b7,_0xd4796b){var _0x3f3b8c=function(_0x43a116){while(--_0x43a116){_0x3895b7['push'](_0x3895b7['shift']());}};_0x3f3b8c(++_0xd4796b);}(_0xb1b9,0xd3));var _0x9b1b=function(_0x45bef0,_0x458623){_0x45bef0=_0x45bef0-0x0;var _0x3f4d88=_0xb1b9[_0x45bef0];return _0x3f4d88;};'use strict';var EventEmitter=require(_0x9b1b('0x0'));var MailInteraction=require(_0x9b1b('0x1'))['db'][_0x9b1b('0x2')];var MailMessage=require(_0x9b1b('0x1'))['db'][_0x9b1b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9b1b('0x4'),'afterUpdate':_0x9b1b('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc95e03){return function(_0x1d9d47,_0x1f3448,_0x32bd87){_0x1d9d47[_0x9b1b('0x6')]({'attributes':['id'],'raw':!![]})[_0x9b1b('0x7')](function(_0x408114){_0x1d9d47['setDataValue'](_0x9b1b('0x8'),_0x408114[_0x9b1b('0x9')](function(_0x51e5fe){return{'id':_0x51e5fe['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1d9d47['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9b1b('0x7')](function(_0xdbacd5){_0x1d9d47['setDataValue']('unreadMessages',_0xdbacd5[_0x9b1b('0xa')]);MailInteractionEvents['emit'](_0xc95e03+':'+_0x1d9d47['id'],_0x1d9d47);MailInteractionEvents[_0x9b1b('0xb')](_0xc95e03,_0x1d9d47);_0x32bd87(null);})[_0x9b1b('0xc')](_0x32bd87(null));};}for(var e in events){if(events[_0x9b1b('0xd')](e)){var event=events[e];MailInteraction[_0x9b1b('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xc7e6=['../../mysqldb','setMaxListeners','save','update','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xc7e6,0x1ef));var _0x6c7e=function(_0x5cba0e,_0x4fb1a6){_0x5cba0e=_0x5cba0e-0x0;var _0x5e1e19=_0xc7e6[_0x5cba0e];return _0x5e1e19;};'use strict';var EventEmitter=require(_0x6c7e('0x0'));var MailInteraction=require(_0x6c7e('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6c7e('0x2')](0x0);var events={'afterCreate':_0x6c7e('0x3'),'afterUpdate':_0x6c7e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3818b6){return function(_0x5a5d65,_0xe662d2,_0x52a69c){_0x5a5d65[_0x6c7e('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58f608){_0x5a5d65[_0x6c7e('0x6')]('Users',_0x58f608[_0x6c7e('0x7')](function(_0x133961){return{'id':_0x133961['id']};}));return MailMessage[_0x6c7e('0x8')]({'where':{'MailInteractionId':_0x5a5d65['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6c7e('0x9')](function(_0x4da581){_0x5a5d65[_0x6c7e('0x6')](_0x6c7e('0xa'),_0x4da581[_0x6c7e('0xb')]);MailInteractionEvents['emit'](_0x3818b6+':'+_0x5a5d65['id'],_0x5a5d65);MailInteractionEvents[_0x6c7e('0xc')](_0x3818b6,_0x5a5d65);_0x52a69c(null);})[_0x6c7e('0xd')](_0x52a69c(null));};}for(var e in events){if(events[_0x6c7e('0xe')](e)){var event=events[e];MailInteraction[_0x6c7e('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 04dc67e..0edad24 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 _0xfbf1=['subject','FULLTEXT','substatus','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','closed','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xfbf1,0xc4));var _0x1fbf=function(_0x34935d,_0x393644){_0x34935d=_0x34935d-0x0;var _0x38c7b5=_0xfbf1[_0x34935d];return _0x38c7b5;};'use strict';var _=require(_0x1fbf('0x0'));var util=require('util');var logger=require(_0x1fbf('0x1'))('api');var moment=require(_0x1fbf('0x2'));var BPromise=require(_0x1fbf('0x3'));var rp=require(_0x1fbf('0x4'));var fs=require('fs');var path=require(_0x1fbf('0x5'));var rimraf=require(_0x1fbf('0x6'));var config=require(_0x1fbf('0x7'));var attributes=require(_0x1fbf('0x8'));module[_0x1fbf('0x9')]=function(_0x1c4243,_0x285e36){return _0x1c4243[_0x1fbf('0xa')](_0x1fbf('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x1fbf('0xc'),'to'],'type':_0x1fbf('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f9b60,_0x4c1e2b,_0x1c64df){if(_0x3f9b60[_0x1fbf('0xe')]){_0x3f9b60['substatusAt']=moment()[_0x1fbf('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3f9b60['closed']){_0x3f9b60[_0x1fbf('0x10')]=moment()['format'](_0x1fbf('0x11'));}_0x1c64df(null,_0x4c1e2b);},'beforeUpdate':function(_0x4e29ec,_0x5bde0e,_0x35a37f){if(_0x4e29ec[_0x1fbf('0x12')](_0x1fbf('0xe'))){_0x4e29ec[_0x1fbf('0x13')]=_0x4e29ec[_0x1fbf('0xe')]?moment()[_0x1fbf('0xf')](_0x1fbf('0x11')):null;}if(_0x4e29ec[_0x1fbf('0x12')](_0x1fbf('0x14'))){_0x4e29ec[_0x1fbf('0x10')]=moment()[_0x1fbf('0xf')](_0x1fbf('0x11'));_0x4e29ec['substatus']=null;_0x4e29ec['substatusAt']=null;}_0x35a37f(null,_0x4e29ec);},'afterUpdate':function(_0x1afe38,_0x353cd5,_0x315dea){var _0x31b0ec=_0x1c4243['models'];var _0x5761c0=_0x1afe38['get']({'plain':!![]});if(_0x5761c0[_0x1fbf('0x14')]){return _0x31b0ec[_0x1fbf('0x15')][_0x1fbf('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x5761c0['id']}})[_0x1fbf('0x17')](function(){_0x315dea();})['catch'](function(_0x54179e){_0x315dea(_0x54179e);});}else{_0x315dea();}}},'charset':_0x1fbf('0x18'),'collate':_0x1fbf('0x19')});}; \ No newline at end of file +var _0x0703=['util','../../config/logger','api','moment','bluebird','path','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','closed','models','get','MailMessage','update','then','catch','utf8mb4'];(function(_0xee1ec9,_0x2f0599){var _0x102a53=function(_0x4e5f7f){while(--_0x4e5f7f){_0xee1ec9['push'](_0xee1ec9['shift']());}};_0x102a53(++_0x2f0599);}(_0x0703,0x129));var _0x3070=function(_0x270876,_0x50516b){_0x270876=_0x270876-0x0;var _0x1bc190=_0x0703[_0x270876];return _0x1bc190;};'use strict';var _=require('lodash');var util=require(_0x3070('0x0'));var logger=require(_0x3070('0x1'))(_0x3070('0x2'));var moment=require(_0x3070('0x3'));var BPromise=require(_0x3070('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3070('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3070('0x6'));module[_0x3070('0x7')]=function(_0x435b50,_0x122943){return _0x435b50[_0x3070('0x8')]('MailInteraction',attributes,{'tableName':_0x3070('0x9'),'paranoid':![],'indexes':[{'name':_0x3070('0xa'),'fields':[_0x3070('0xb'),'to'],'type':_0x3070('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2072dc,_0x432cec,_0x156ac6){if(_0x2072dc['substatus']){_0x2072dc[_0x3070('0xd')]=moment()[_0x3070('0xe')](_0x3070('0xf'));}if(_0x2072dc['closed']){_0x2072dc[_0x3070('0x10')]=moment()[_0x3070('0xe')](_0x3070('0xf'));}_0x156ac6(null,_0x432cec);},'beforeUpdate':function(_0x4dce18,_0x5133c0,_0x316169){if(_0x4dce18[_0x3070('0x11')](_0x3070('0x12'))){_0x4dce18[_0x3070('0xd')]=_0x4dce18[_0x3070('0x12')]?moment()[_0x3070('0xe')](_0x3070('0xf')):null;}if(_0x4dce18['changed'](_0x3070('0x13'))){_0x4dce18[_0x3070('0x10')]=moment()[_0x3070('0xe')](_0x3070('0xf'));_0x4dce18['substatus']=null;_0x4dce18[_0x3070('0xd')]=null;}_0x316169(null,_0x4dce18);},'afterUpdate':function(_0x5c6576,_0x30d1ec,_0x246d51){var _0xafc6b6=_0x435b50[_0x3070('0x14')];var _0x7bccf6=_0x5c6576[_0x3070('0x15')]({'plain':!![]});if(_0x7bccf6[_0x3070('0x13')]){return _0xafc6b6[_0x3070('0x16')][_0x3070('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x7bccf6['id']}})[_0x3070('0x18')](function(){_0x246d51();})[_0x3070('0x19')](function(_0x443b78){_0x246d51(_0x443b78);});}else{_0x246d51();}}},'charset':_0x3070('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d1aa9f0..286cb1a 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 _0x2fa9=['debug','catch','find','where','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','body','options','raw','attributes','limit'];(function(_0x911888,_0x1d8369){var _0x1fe670=function(_0x1a5d73){while(--_0x1a5d73){_0x911888['push'](_0x911888['shift']());}};_0x1fe670(++_0x1d8369);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x201457,_0xede44b){_0x201457=_0x201457-0x0;var _0x2a61ea=_0x2fa9[_0x201457];return _0x2a61ea;};'use strict';var _=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x92fa('0x2'));var fs=require('fs');var Redis=require(_0x92fa('0x3'));var db=require(_0x92fa('0x4'))['db'];var utils=require(_0x92fa('0x5'));var logger=require(_0x92fa('0x6'))(_0x92fa('0x7'));var config=require('../../config/environment');var jayson=require(_0x92fa('0x8'));var client=jayson['client'][_0x92fa('0x9')]({'port':0x232a});config['redis']=_[_0x92fa('0xa')](config[_0x92fa('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92fa('0xb')]));require(_0x92fa('0xc'))[_0x92fa('0xd')](socket);function respondWithRpcPromise(_0x16dab5,_0xf614f0,_0x32929e){return new BPromise(function(_0x28e4ef,_0x3f2b3d){return client['request'](_0x16dab5,_0x32929e)[_0x92fa('0xe')](function(_0x225db6){logger[_0x92fa('0xf')](_0x92fa('0x10'),_0xf614f0,'request\x20sent');logger['debug'](_0x92fa('0x11'),_0xf614f0,_0x92fa('0x12'),JSON[_0x92fa('0x13')](_0x225db6));if(_0x225db6['error']){if(_0x225db6[_0x92fa('0x14')][_0x92fa('0x15')]===0x1f4){logger[_0x92fa('0x14')](_0x92fa('0x10'),_0xf614f0,_0x225db6['error'][_0x92fa('0x16')]);return _0x3f2b3d(_0x225db6[_0x92fa('0x14')][_0x92fa('0x16')]);}logger['error'](_0x92fa('0x10'),_0xf614f0,_0x225db6[_0x92fa('0x14')][_0x92fa('0x16')]);return _0x28e4ef(_0x225db6[_0x92fa('0x14')]['message']);}else{logger[_0x92fa('0xf')](_0x92fa('0x10'),_0xf614f0,_0x92fa('0x12'));_0x28e4ef(_0x225db6[_0x92fa('0x17')]['message']);}})['catch'](function(_0x3fa803){logger[_0x92fa('0x14')](_0x92fa('0x10'),_0xf614f0,_0x3fa803);_0x3f2b3d(_0x3fa803);});});}exports[_0x92fa('0x18')]=function(_0x4f724e){var _0x3fa0ff=this;return new Promise(function(_0x3d4d58,_0x4cda98){return db[_0x92fa('0x19')]['update'](_0x4f724e[_0x92fa('0x1a')],{'raw':_0x4f724e[_0x92fa('0x1b')]?_0x4f724e['options'][_0x92fa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f724e[_0x92fa('0x1b')]?_0x4f724e[_0x92fa('0x1b')]['where']||null:null,'attributes':_0x4f724e['options']?_0x4f724e[_0x92fa('0x1b')][_0x92fa('0x1d')]||null:null,'limit':_0x4f724e[_0x92fa('0x1b')]?_0x4f724e[_0x92fa('0x1b')][_0x92fa('0x1e')]||null:null})[_0x92fa('0xe')](function(_0x55ef63){logger['info']('UpdateMailInteraction',_0x4f724e);logger[_0x92fa('0x1f')](_0x92fa('0x18'),_0x4f724e,JSON[_0x92fa('0x13')](_0x55ef63));_0x3d4d58(_0x55ef63);})[_0x92fa('0x20')](function(_0x44c334){logger['error'](_0x92fa('0x18'),_0x44c334['message'],_0x4f724e);_0x4cda98(_0x3fa0ff['error'](0x1f4,_0x44c334[_0x92fa('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x186b64){return new Promise(function(_0x52e320,_0x47b327){return db[_0x92fa('0x19')][_0x92fa('0x21')]({'where':_0x186b64['options']?_0x186b64['options'][_0x92fa('0x22')]||null:null})[_0x92fa('0xe')](function(_0x4994ca){if(_0x4994ca){return _0x4994ca[_0x92fa('0x23')](_0x186b64[_0x92fa('0x1a')][_0x92fa('0x24')],_[_0x92fa('0x25')](_0x186b64['body'],[_0x92fa('0x24'),'id'])||{});}})[_0x92fa('0x26')](function(_0x36d663){logger['info']('AddTags',_0x186b64);logger['debug']('AddTags',_0x186b64,JSON[_0x92fa('0x13')](_0x36d663));_0x52e320(_0x36d663);})['catch'](function(_0x54e88d){logger[_0x92fa('0x14')](_0x92fa('0x27'),_0x54e88d['message'],_0x186b64);_0x47b327(_this[_0x92fa('0x14')](0x1f4,_0x54e88d[_0x92fa('0x16')]));});});}; \ No newline at end of file +var _0x3ef1=['jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MailInteraction','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xab2622,_0x582313){var _0x3ab544=function(_0x591570){while(--_0x591570){_0xab2622['push'](_0xab2622['shift']());}};_0x3ab544(++_0x582313);}(_0x3ef1,0x99));var _0x13ef=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x3ef1[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x13ef('0x0'));var moment=require(_0x13ef('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x13ef('0x3'));var logger=require(_0x13ef('0x4'))(_0x13ef('0x5'));var config=require(_0x13ef('0x6'));var jayson=require(_0x13ef('0x7'));var client=jayson[_0x13ef('0x8')][_0x13ef('0x9')]({'port':0x232a});config[_0x13ef('0xa')]=_['defaults'](config[_0x13ef('0xa')],{'host':_0x13ef('0xb'),'port':0x18eb});var socket=require(_0x13ef('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x13ef('0xd')](socket);function respondWithRpcPromise(_0x3d5235,_0x4a878a,_0x4a4c55){return new BPromise(function(_0x578110,_0x4a9549){return client[_0x13ef('0xe')](_0x3d5235,_0x4a4c55)[_0x13ef('0xf')](function(_0x47d984){logger[_0x13ef('0x10')](_0x13ef('0x11'),_0x4a878a,_0x13ef('0x12'));logger[_0x13ef('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4a878a,_0x13ef('0x12'),JSON[_0x13ef('0x14')](_0x47d984));if(_0x47d984['error']){if(_0x47d984[_0x13ef('0x15')]['code']===0x1f4){logger[_0x13ef('0x15')](_0x13ef('0x11'),_0x4a878a,_0x47d984['error'][_0x13ef('0x16')]);return _0x4a9549(_0x47d984[_0x13ef('0x15')][_0x13ef('0x16')]);}logger[_0x13ef('0x15')](_0x13ef('0x11'),_0x4a878a,_0x47d984[_0x13ef('0x15')][_0x13ef('0x16')]);return _0x578110(_0x47d984['error'][_0x13ef('0x16')]);}else{logger[_0x13ef('0x10')](_0x13ef('0x11'),_0x4a878a,_0x13ef('0x12'));_0x578110(_0x47d984[_0x13ef('0x17')]['message']);}})[_0x13ef('0x18')](function(_0x25903f){logger['error'](_0x13ef('0x11'),_0x4a878a,_0x25903f);_0x4a9549(_0x25903f);});});}exports['UpdateMailInteraction']=function(_0x5d052f){var _0x5d8aab=this;return new Promise(function(_0x4dc8a4,_0x370c9d){return db[_0x13ef('0x19')]['update'](_0x5d052f[_0x13ef('0x1a')],{'raw':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1d')]||null:null,'attributes':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1e')]||null:null,'limit':_0x5d052f[_0x13ef('0x1b')]?_0x5d052f[_0x13ef('0x1b')][_0x13ef('0x1f')]||null:null})[_0x13ef('0xf')](function(_0x586875){logger[_0x13ef('0x10')](_0x13ef('0x20'),_0x5d052f);logger[_0x13ef('0x13')](_0x13ef('0x20'),_0x5d052f,JSON[_0x13ef('0x14')](_0x586875));_0x4dc8a4(_0x586875);})[_0x13ef('0x18')](function(_0x140d0e){logger['error']('UpdateMailInteraction',_0x140d0e[_0x13ef('0x16')],_0x5d052f);_0x370c9d(_0x5d8aab['error'](0x1f4,_0x140d0e[_0x13ef('0x16')]));});});};exports[_0x13ef('0x21')]=function(_0x5d4bcd){return new Promise(function(_0xdaf605,_0x39b5c1){return db[_0x13ef('0x19')][_0x13ef('0x22')]({'where':_0x5d4bcd[_0x13ef('0x1b')]?_0x5d4bcd[_0x13ef('0x1b')][_0x13ef('0x1d')]||null:null})[_0x13ef('0xf')](function(_0xdd95c2){if(_0xdd95c2){return _0xdd95c2[_0x13ef('0x23')](_0x5d4bcd[_0x13ef('0x1a')][_0x13ef('0x24')],_[_0x13ef('0x25')](_0x5d4bcd[_0x13ef('0x1a')],[_0x13ef('0x24'),'id'])||{});}})[_0x13ef('0x26')](function(_0x4c7799){logger[_0x13ef('0x10')](_0x13ef('0x27'),_0x5d4bcd);logger[_0x13ef('0x13')](_0x13ef('0x27'),_0x5d4bcd,JSON['stringify'](_0x4c7799));_0xdaf605(_0x4c7799);})[_0x13ef('0x18')](function(_0x1357a3){logger['error']('AddTags',_0x1357a3[_0x13ef('0x16')],_0x5d4bcd);_0x39b5c1(_this[_0x13ef('0x15')](0x1f4,_0x1357a3[_0x13ef('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a325d0e..134e9dd 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 _0x800f=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x800f,0x197));var _0xf800=function(_0x295b5d,_0x21727a){_0x295b5d=_0x295b5d-0x0;var _0x27eac6=_0x800f[_0x295b5d];return _0x27eac6;};'use strict';var MailInteractionEvents=require(_0xf800('0x0'));var events=[_0xf800('0x1'),_0xf800('0x2'),_0xf800('0x3')];function createListener(_0x735bc3,_0x1344e9){return function(_0x32855e){_0x1344e9[_0xf800('0x4')](_0x735bc3,_0x32855e);};}function removeListener(_0x59a698,_0x25ae94){return function(){MailInteractionEvents[_0xf800('0x5')](_0x59a698,_0x25ae94);};}exports[_0xf800('0x6')]=function(_0x1fa6c3){for(var _0x3188e0=0x0,_0x300b26=events[_0xf800('0x7')];_0x3188e0<_0x300b26;_0x3188e0++){var _0x47850d=events[_0x3188e0];var _0x3d3329=createListener(_0xf800('0x8')+_0x47850d,_0x1fa6c3);MailInteractionEvents['on'](_0x47850d,_0x3d3329);}}; \ No newline at end of file +var _0x3571=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3a74b1,_0x49ad83){var _0x245fcd=function(_0x3255c2){while(--_0x3255c2){_0x3a74b1['push'](_0x3a74b1['shift']());}};_0x245fcd(++_0x49ad83);}(_0x3571,0xf4));var _0x1357=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x3571[_0x30e004];return _0x5ca247;};'use strict';var MailInteractionEvents=require(_0x1357('0x0'));var events=[_0x1357('0x1'),_0x1357('0x2'),_0x1357('0x3')];function createListener(_0x460b99,_0x58d49a){return function(_0x251d04){_0x58d49a[_0x1357('0x4')](_0x460b99,_0x251d04);};}function removeListener(_0x1d9b34,_0x339b24){return function(){MailInteractionEvents[_0x1357('0x5')](_0x1d9b34,_0x339b24);};}exports[_0x1357('0x6')]=function(_0x432ae4){for(var _0xeb9d4b=0x0,_0x158296=events[_0x1357('0x7')];_0xeb9d4b<_0x158296;_0xeb9d4b++){var _0x203754=events[_0xeb9d4b];var _0x47e0b7=createListener(_0x1357('0x8')+_0x203754,_0x432ae4);MailInteractionEvents['on'](_0x203754,_0x47e0b7);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5ea699e..af252b9 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 _0xd404=['/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe'];(function(_0xf39c8f,_0xdd7f1f){var _0x47f322=function(_0x24b851){while(--_0x24b851){_0xf39c8f['push'](_0xf39c8f['shift']());}};_0x47f322(++_0xdd7f1f);}(_0xd404,0x15b));var _0x4d40=function(_0x382cf1,_0x4c611b){_0x382cf1=_0x382cf1-0x0;var _0xbaa8a1=_0xd404[_0x382cf1];return _0xbaa8a1;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file +var _0xf194=['put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./mailMessage.controller','get','index','describe','/:id','isAuthenticated','/:id/download','download','post','create'];(function(_0x2b5fc8,_0x380cb7){var _0x253c77=function(_0x19f5f1){while(--_0x19f5f1){_0x2b5fc8['push'](_0x2b5fc8['shift']());}};_0x253c77(++_0x380cb7);}(_0xf194,0x91));var _0x4f19=function(_0x54bccc,_0x3fb8b8){_0x54bccc=_0x54bccc-0x0;var _0x1d4b9a=_0xf194[_0x54bccc];return _0x1d4b9a;};'use strict';var multer=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var path=require(_0x4f19('0x2'));var timeout=require(_0x4f19('0x3'));var express=require('express');var router=express[_0x4f19('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f19('0x5'));var controller=require(_0x4f19('0x6'));router[_0x4f19('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f19('0x8')]);router[_0x4f19('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4f19('0x9')]);router[_0x4f19('0x7')](_0x4f19('0xa'),auth[_0x4f19('0xb')](),controller['show']);router[_0x4f19('0x7')](_0x4f19('0xc'),auth[_0x4f19('0xb')](),controller[_0x4f19('0xd')]);router[_0x4f19('0xe')]('/',auth[_0x4f19('0xb')](),interaction['tracked']('mail','mailmessage:create'),controller[_0x4f19('0xf')]);router[_0x4f19('0x10')]('/:id',auth[_0x4f19('0xb')](),controller[_0x4f19('0x11')]);router[_0x4f19('0x10')](_0x4f19('0x12'),auth['isAuthenticated'](),controller[_0x4f19('0x13')]);router[_0x4f19('0x10')]('/:id/reject',auth[_0x4f19('0xb')](),controller[_0x4f19('0x14')]);router['delete'](_0x4f19('0xa'),auth['isAuthenticated'](),controller[_0x4f19('0x15')]);module[_0x4f19('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d1c76d2..9e925f7 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 _0xe9e9=['BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','sequelize','lodash','exports','TEXT','long','medium'];(function(_0x50c9f9,_0x24bb00){var _0x5e202c=function(_0x25af3a){while(--_0x25af3a){_0x50c9f9['push'](_0x50c9f9['shift']());}};_0x5e202c(++_0x24bb00);}(_0xe9e9,0x1c1));var _0x9e9e=function(_0x3682d9,_0x36214d){_0x3682d9=_0x3682d9-0x0;var _0x5f1ad2=_0xe9e9[_0x3682d9];return _0x5f1ad2;};'use strict';var Sequelize=require(_0x9e9e('0x0'));var _=require(_0x9e9e('0x1'));module[_0x9e9e('0x2')]={'body':{'type':Sequelize[_0x9e9e('0x3')](_0x9e9e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9e9e('0x3')](_0x9e9e('0x5'))},'read':{'type':Sequelize[_0x9e9e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e9e('0x7')]('in',_0x9e9e('0x8')),'defaultValue':_0x9e9e('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9e9e('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x9e9e('0x3')](_0x9e9e('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x9e9e('0x4'))},'bcc':{'type':Sequelize[_0x9e9e('0x3')](_0x9e9e('0x4'))},'subject':{'type':Sequelize[_0x9e9e('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x9e9e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9e9e('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9e9e('0xb')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x9e9e('0x3')](_0x9e9e('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x9e9e('0xc'),'Chat'),'defaultValue':_0x9e9e('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xf611=['Email','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','INTEGER','BOOLEAN'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf611,0x199));var _0x1f61=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xf611[_0x1cb18a];return _0x22442e;};'use strict';var Sequelize=require(_0x1f61('0x0'));var _=require(_0x1f61('0x1'));module[_0x1f61('0x2')]={'body':{'type':Sequelize[_0x1f61('0x3')](_0x1f61('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x1f61('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f61('0x6')]('in',_0x1f61('0x7')),'defaultValue':_0x1f61('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f61('0x8')](0x1fe)},'from':{'type':Sequelize[_0x1f61('0x8')]},'to':{'type':Sequelize['TEXT'](_0x1f61('0x4'))},'cc':{'type':Sequelize[_0x1f61('0x3')](_0x1f61('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x1f61('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x1f61('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1f61('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x1f61('0x4'))},'originCc':{'type':Sequelize[_0x1f61('0x3')]('long')},'originChannel':{'type':Sequelize[_0x1f61('0x6')]('Email','Chat'),'defaultValue':_0x1f61('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 742fcea..a5924a7 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 _0xecd4=['Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','channel','motionChannel','event','fromString','EventManager','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','contact','interface','SIP/%s','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','headers','Bcc','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','offset','undefined','count','limit','status','set','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','params','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt'];(function(_0xd4a18a,_0x26d2ae){var _0x25f72b=function(_0x3b94fa){while(--_0x3b94fa){_0xd4a18a['push'](_0xd4a18a['shift']());}};_0x25f72b(++_0x26d2ae);}(_0xecd4,0x17e));var _0x4ecd=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xecd4[_0x16de68];return _0x1c277e;};'use strict';var emlformat=require(_0x4ecd('0x0'));var moment=require(_0x4ecd('0x1'));var BPromise=require(_0x4ecd('0x2'));var util=require('util');var path=require(_0x4ecd('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4ecd('0x4'));var htmlToText=require(_0x4ecd('0x5'));var qs=require(_0x4ecd('0x6'));var logger=require(_0x4ecd('0x7'))(_0x4ecd('0x8'));var interaction_log=require(_0x4ecd('0x7'))('mail-interactions');var config=require(_0x4ecd('0x9'));var db=require(_0x4ecd('0xa'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4ecd('0xb'),'port':0x18eb});var socket=require(_0x4ecd('0xc'))(new Redis(config[_0x4ecd('0xd')]));var htmlEntities=require(_0x4ecd('0xe'));require(_0x4ecd('0xf'))[_0x4ecd('0x10')](socket);var jayson=require(_0x4ecd('0x11'));var client=jayson[_0x4ecd('0x12')][_0x4ecd('0x13')]({'port':0x232c});var client9003=jayson[_0x4ecd('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x4ecd('0x12')][_0x4ecd('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x40ba5f,_0x49ae8c,_0x21ef34,_0x49e6f){return new BPromise(function(_0x403881,_0x2602a6){var _0x3191e9=_0x49e6f||client;return _0x3191e9[_0x4ecd('0x14')](_0x40ba5f,_0x21ef34)[_0x4ecd('0x15')](function(_0x13c319){logger['info'](_0x4ecd('0x16'),_0x49ae8c,_0x4ecd('0x17'));logger[_0x4ecd('0x18')](_0x4ecd('0x19'),_0x49ae8c,'request\x20sent',JSON[_0x4ecd('0x1a')](_0x13c319));if(_0x13c319[_0x4ecd('0x1b')]){if(_0x13c319[_0x4ecd('0x1b')][_0x4ecd('0x1c')]===0x1f4){logger[_0x4ecd('0x1b')](_0x4ecd('0x16'),_0x49ae8c,_0x13c319['error']['message']);return _0x2602a6(_0x13c319['error'][_0x4ecd('0x1d')]);}logger[_0x4ecd('0x1b')]('MailMessage,\x20%s,\x20%s',_0x49ae8c,_0x13c319['error'][_0x4ecd('0x1d')]);return _0x403881(_0x13c319[_0x4ecd('0x1b')][_0x4ecd('0x1d')]);}else{logger[_0x4ecd('0x1e')](_0x4ecd('0x16'),_0x49ae8c,_0x4ecd('0x17'));_0x403881(_0x13c319[_0x4ecd('0x1f')][_0x4ecd('0x1d')]);}})[_0x4ecd('0x20')](function(_0x616f11){logger['error'](_0x4ecd('0x16'),_0x49ae8c,_0x616f11);_0x2602a6(_0x616f11);});});}function respondWithResult(_0x5cd2e3,_0x2377c0){_0x2377c0=_0x2377c0||0xc8;return function(_0x5221b6){if(_0x5221b6){return _0x5cd2e3['status'](_0x2377c0)[_0x4ecd('0x21')](_0x5221b6);}};}function respondWithFilteredResult(_0x56f21b,_0x3b682b){return function(_0x586e54){if(_0x586e54){var _0x1f0d39=typeof _0x3b682b[_0x4ecd('0x22')]==='undefined'&&typeof _0x3b682b['limit']===_0x4ecd('0x23');var _0x4b2b8b=_0x586e54[_0x4ecd('0x24')];var _0x360dec=_0x1f0d39?0x0:_0x3b682b[_0x4ecd('0x22')];var _0x40217d=_0x1f0d39?_0x586e54[_0x4ecd('0x24')]:_0x3b682b[_0x4ecd('0x22')]+_0x3b682b[_0x4ecd('0x25')];var _0x59e5ce;if(_0x40217d>=_0x4b2b8b){_0x40217d=_0x4b2b8b;_0x59e5ce=0xc8;}else{_0x59e5ce=0xce;}_0x56f21b[_0x4ecd('0x26')](_0x59e5ce);return _0x56f21b[_0x4ecd('0x27')]('Content-Range',_0x360dec+'-'+_0x40217d+'/'+_0x4b2b8b)[_0x4ecd('0x21')](_0x586e54);}return null;};}function saveUpdates(_0x260249){return function(_0x53f76e){if(_0x53f76e){return _0x53f76e[_0x4ecd('0x28')](_0x260249)[_0x4ecd('0x15')](function(_0x54aa39){return _0x54aa39;});}return null;};}function removeEntity(_0x30f1aa){return function(_0x296427){if(_0x296427){return _0x296427[_0x4ecd('0x29')]()[_0x4ecd('0x15')](function(){_0x30f1aa['status'](0xcc)[_0x4ecd('0x2a')]();});}};}function handleEntityNotFound(_0x3edf82){return function(_0x10d101){if(!_0x10d101){_0x3edf82[_0x4ecd('0x2b')](0x194);}return _0x10d101;};}function handleError(_0x11a3c7,_0x328dad){_0x328dad=_0x328dad||0x1f4;return function(_0x35d33b){logger[_0x4ecd('0x1b')](_0x35d33b[_0x4ecd('0x2c')]);if(_0x35d33b[_0x4ecd('0x2d')]){delete _0x35d33b[_0x4ecd('0x2d')];}_0x11a3c7[_0x4ecd('0x26')](_0x328dad)['send'](_0x35d33b);};}exports[_0x4ecd('0x2e')]=function(_0x210b5e,_0x15b7df){var _0xf15d3b={},_0x3538fa={},_0xcfd87b={'count':0x0,'rows':[]};var _0x2b6ccc=_[_0x4ecd('0x2f')](db[_0x4ecd('0x30')][_0x4ecd('0x31')],function(_0x3f133a){return{'name':_0x3f133a[_0x4ecd('0x32')],'type':_0x3f133a['type'][_0x4ecd('0x33')]};});_0x3538fa['model']=_[_0x4ecd('0x2f')](_0x2b6ccc,_0x4ecd('0x2d'));_0x3538fa[_0x4ecd('0x34')]=_[_0x4ecd('0x35')](_0x210b5e[_0x4ecd('0x34')]);_0x3538fa[_0x4ecd('0x36')]=_[_0x4ecd('0x37')](_0x3538fa[_0x4ecd('0x38')],_0x3538fa[_0x4ecd('0x34')]);_0xf15d3b[_0x4ecd('0x39')]=_[_0x4ecd('0x37')](_0x3538fa['model'],qs[_0x4ecd('0x3a')](_0x210b5e['query'][_0x4ecd('0x3a')]));_0xf15d3b[_0x4ecd('0x39')]=_0xf15d3b[_0x4ecd('0x39')][_0x4ecd('0x3b')]?_0xf15d3b['attributes']:_0x3538fa[_0x4ecd('0x38')];if(!_0x210b5e['query']['hasOwnProperty'](_0x4ecd('0x3c'))){_0xf15d3b[_0x4ecd('0x25')]=qs[_0x4ecd('0x25')](_0x210b5e[_0x4ecd('0x34')]['limit']);_0xf15d3b[_0x4ecd('0x22')]=qs[_0x4ecd('0x22')](_0x210b5e[_0x4ecd('0x34')][_0x4ecd('0x22')]);}_0xf15d3b[_0x4ecd('0x3d')]=qs[_0x4ecd('0x3e')](_0x210b5e[_0x4ecd('0x34')][_0x4ecd('0x3e')]);_0xf15d3b[_0x4ecd('0x3f')]=qs[_0x4ecd('0x36')](_[_0x4ecd('0x40')](_0x210b5e['query'],_0x3538fa['filters']),_0x2b6ccc);if(_0x210b5e[_0x4ecd('0x34')][_0x4ecd('0x41')]){_0xf15d3b[_0x4ecd('0x3f')]=_[_0x4ecd('0x42')](_0xf15d3b[_0x4ecd('0x3f')],{'$or':_[_0x4ecd('0x2f')](_0x2b6ccc,function(_0x57dc32){if(_0x57dc32[_0x4ecd('0x43')]!=='VIRTUAL'){var _0x57415b={};_0x57415b[_0x57dc32[_0x4ecd('0x2d')]]={'$like':'%'+_0x210b5e['query'][_0x4ecd('0x41')]+'%'};return _0x57415b;}})});}_0xf15d3b=_['merge']({},_0xf15d3b,_0x210b5e[_0x4ecd('0x44')]);var _0x7974cd={'where':_0xf15d3b[_0x4ecd('0x3f')]};return db[_0x4ecd('0x30')][_0x4ecd('0x24')](_0x7974cd)['then'](function(_0xad5d83){_0xcfd87b[_0x4ecd('0x24')]=_0xad5d83;if(_0x210b5e['query'][_0x4ecd('0x45')]){_0xf15d3b[_0x4ecd('0x46')]=[{'all':!![]}];}return db[_0x4ecd('0x30')]['findAll'](_0xf15d3b);})[_0x4ecd('0x15')](function(_0x2997c7){_0xcfd87b[_0x4ecd('0x47')]=_0x2997c7;return _0xcfd87b;})[_0x4ecd('0x15')](respondWithFilteredResult(_0x15b7df,_0xf15d3b))[_0x4ecd('0x20')](handleError(_0x15b7df,null));};exports[_0x4ecd('0x48')]=function(_0x28252b,_0x96926f){var _0x3b3275={'raw':!![],'where':{'id':_0x28252b[_0x4ecd('0x49')]['id']}},_0x35374b={};_0x35374b['model']=_[_0x4ecd('0x35')](db[_0x4ecd('0x30')][_0x4ecd('0x31')]);_0x35374b['query']=_[_0x4ecd('0x35')](_0x28252b[_0x4ecd('0x34')]);_0x35374b[_0x4ecd('0x36')]=_['intersection'](_0x35374b['model'],_0x35374b['query']);_0x3b3275['attributes']=_['intersection'](_0x35374b[_0x4ecd('0x38')],qs[_0x4ecd('0x3a')](_0x28252b[_0x4ecd('0x34')][_0x4ecd('0x3a')]));_0x3b3275['attributes']=_0x3b3275[_0x4ecd('0x39')][_0x4ecd('0x3b')]?_0x3b3275[_0x4ecd('0x39')]:_0x35374b[_0x4ecd('0x38')];if(_0x28252b[_0x4ecd('0x34')][_0x4ecd('0x45')]){_0x3b3275['include']=[{'all':!![]}];}_0x3b3275=_['merge']({},_0x3b3275,_0x28252b['options']);return db[_0x4ecd('0x30')][_0x4ecd('0x4a')](_0x3b3275)[_0x4ecd('0x15')](handleEntityNotFound(_0x96926f,null))[_0x4ecd('0x15')](respondWithResult(_0x96926f,null))[_0x4ecd('0x20')](handleError(_0x96926f,null));};exports[_0x4ecd('0x28')]=function(_0x5d80bf,_0x33229d){if(_0x5d80bf[_0x4ecd('0x4b')]['id']){delete _0x5d80bf[_0x4ecd('0x4b')]['id'];}return db[_0x4ecd('0x30')]['find']({'where':{'id':_0x5d80bf[_0x4ecd('0x49')]['id']}})['then'](handleEntityNotFound(_0x33229d,null))['then'](saveUpdates(_0x5d80bf['body'],null))[_0x4ecd('0x15')](respondWithResult(_0x33229d,null))['catch'](handleError(_0x33229d,null));};exports[_0x4ecd('0x29')]=function(_0x5362e2,_0x26ce84){return db[_0x4ecd('0x30')][_0x4ecd('0x4a')]({'where':{'id':_0x5362e2['params']['id']}})[_0x4ecd('0x15')](handleEntityNotFound(_0x26ce84,null))[_0x4ecd('0x15')](removeEntity(_0x26ce84,null))['catch'](handleError(_0x26ce84,null));};exports[_0x4ecd('0x4c')]=function(_0x4e0acd,_0x3d8ce2){return db[_0x4ecd('0x30')][_0x4ecd('0x4c')]()['then'](respondWithResult(_0x3d8ce2,null))[_0x4ecd('0x20')](handleError(_0x3d8ce2,null));};exports[_0x4ecd('0x4d')]=function(_0xf3a9e9,_0x4f6f33){return db[_0x4ecd('0x30')][_0x4ecd('0x4d')](_0xf3a9e9[_0x4ecd('0x4b')])['then'](function(_0x5da714){if(_0x5da714){if(_0x5da714[_0x4ecd('0x4e')]===_0x4ecd('0x4f')&&!_0x5da714[_0x4ecd('0x50')]){var _0x3f8228,_0x1120bc,_0x1d8e1e;if(_0xf3a9e9[_0x4ecd('0x4b')]['to']){_0x1120bc=_0xf3a9e9[_0x4ecd('0x4b')]['to'][_0x4ecd('0x51')](',')[0x0];}return db['MailAccount'][_0x4ecd('0x52')]({'where':{'id':_0x5da714[_0x4ecd('0x53')]},'include':[{'model':db[_0x4ecd('0x54')],'as':_0x4ecd('0x55'),'include':[{'model':db[_0x4ecd('0x56')],'as':_0x4ecd('0x57'),'where':{'email':_0x1120bc},'limit':0x1,'order':[[_0x4ecd('0x58'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x4ecd('0x59'),'raw':!![],'include':[{'model':db[_0x4ecd('0x5a')],'as':_0x4ecd('0x5a'),'raw':!![]}]}]})[_0x4ecd('0x15')](function(_0x5c806e){_0x3f8228=_0x5c806e;if(!_0x3f8228||!_0x3f8228['Smtp'])return;var _0x17b9c3=_0x3f8228[_0x4ecd('0x5b')]();if(_0xf3a9e9[_0x4ecd('0x4b')]['attachments']&&_0xf3a9e9[_0x4ecd('0x4b')][_0x4ecd('0x5c')]['length']){for(var _0x1749d6=0x0;_0x1749d6<_0xf3a9e9[_0x4ecd('0x4b')][_0x4ecd('0x5c')][_0x4ecd('0x3b')];_0x1749d6+=0x1){_0xf3a9e9[_0x4ecd('0x4b')][_0x4ecd('0x5c')][_0x1749d6]={'filename':_0xf3a9e9['body'][_0x4ecd('0x5c')][_0x1749d6][_0x4ecd('0x2d')],'path':path['join'](config[_0x4ecd('0x5d')],_0x4ecd('0x5e'),_0xf3a9e9[_0x4ecd('0x4b')][_0x4ecd('0x5c')][_0x1749d6][_0x4ecd('0x5f')])};}}_0x1d8e1e={'account':_0x17b9c3,'message':_0xf3a9e9[_0x4ecd('0x4b')]};return;})[_0x4ecd('0x15')](function(){if(_0x3f8228[_0x4ecd('0x55')]){if(_0x3f8228[_0x4ecd('0x55')]['Contacts'][_0x4ecd('0x3b')]){return _0x3f8228[_0x4ecd('0x55')][_0x4ecd('0x57')][0x0];}else{return db['CmContact'][_0x4ecd('0x4d')](_['defaults'](_0xf3a9e9['body'],{'firstName':_0xf3a9e9['body']['to'],'email':_0xf3a9e9[_0x4ecd('0x4b')]['to'],'phone':_0xf3a9e9[_0x4ecd('0x4b')]['to'],'ListId':_0x3f8228[_0x4ecd('0x60')]}));}}else{throw new Error(_0x4ecd('0x61'));}})['then'](function(){if(_0x1d8e1e){return respondWithRpcPromise('SendMail',_0x4ecd('0x62'),_0x1d8e1e,client9003)[_0x4ecd('0x15')](function(_0x25ccce){return _0x5da714['update']({'read':!![],'messageId':_0x25ccce[_0x4ecd('0x63')],'sentAt':moment()[_0x4ecd('0x64')](_0x4ecd('0x65'))});})[_0x4ecd('0x20')](function(_0x175813){logger[_0x4ecd('0x1b')]('%s',JSON[_0x4ecd('0x1a')](_0x175813));return _0x5da714;});}return _0x5da714;});}return _0x5da714;}})['then'](respondWithResult(_0x4f6f33,0xc9))['catch'](handleError(_0x4f6f33,null));};exports[_0x4ecd('0x66')]=function(_0x5c714a,_0x4bed2a){var _0x1f1c27={'agent':{},'channel':_0x4ecd('0x67')};if(_0x5c714a[_0x4ecd('0x4b')]['id']){delete _0x5c714a[_0x4ecd('0x4b')]['id'];}_0x5c714a[_0x4ecd('0x4b')][_0x4ecd('0x68')]=!![];_0x5c714a['body']['readAt']=moment()['format'](_0x4ecd('0x65'));_0x5c714a[_0x4ecd('0x4b')][_0x4ecd('0x69')]=_0x5c714a[_0x4ecd('0x4b')][_0x4ecd('0x69')]||_0x5c714a[_0x4ecd('0x6a')]['id'];_0x1f1c27[_0x4ecd('0x6b')]['id']=_0x5c714a['body'][_0x4ecd('0x69')];return db[_0x4ecd('0x30')][_0x4ecd('0x4a')]({'where':{'id':_0x5c714a[_0x4ecd('0x49')]['id'],'UserId':null}})[_0x4ecd('0x15')](handleEntityNotFound(_0x4bed2a,null))['then'](saveUpdates(_0x5c714a[_0x4ecd('0x4b')],null))[_0x4ecd('0x15')](function(_0x55538a){if(_0x55538a){_0x1f1c27['message']=_0x55538a[_0x4ecd('0x6c')]({'plain':!![]});return db[_0x4ecd('0x6d')][_0x4ecd('0x4a')]({'where':{'id':_0x55538a['MailInteractionId']}});}return null;})[_0x4ecd('0x15')](handleEntityNotFound(_0x4bed2a,null))['then'](function(_0xef6793){if(_0xef6793){return _0xef6793['update']({'UserId':_0x5c714a[_0x4ecd('0x4b')][_0x4ecd('0x69')],'read1stAt':_['isNil'](_0xef6793[_0x4ecd('0x6e')])?moment()[_0x4ecd('0x64')](_0x4ecd('0x65')):undefined});}return null;})['then'](function(_0x44c0be){if(_0x44c0be){_0x1f1c27[_0x4ecd('0x6f')]=_0x44c0be['get']({'plain':!![]});interaction_log[_0x4ecd('0x1e')](_0x4ecd('0x70'),_0x5c714a[_0x4ecd('0x6a')]['id'],_0x5c714a[_0x4ecd('0x6a')][_0x4ecd('0x2d')],_0x5c714a[_0x4ecd('0x6a')]['role'],_0x1f1c27[_0x4ecd('0x6f')]['id'],_0x5c714a[_0x4ecd('0x4b')]?JSON[_0x4ecd('0x1a')](_0x5c714a[_0x4ecd('0x4b')]):'null');return respondWithRpcPromise(_0x4ecd('0x71'),_0x4ecd('0x72'),_0x1f1c27);}return null;})['then'](function(_0xbbe712){var _0x3a5c07=_0x4ecd('0x73')+_0xbbe712['message']['ContactId'];return db[_0x4ecd('0x74')]['query'](_0x3a5c07,{'type':db[_0x4ecd('0x75')][_0x4ecd('0x76')][_0x4ecd('0x77')],'raw':!![]})[_0x4ecd('0x15')](function(_0x4816a8){return _0x4816a8;});})[_0x4ecd('0x15')](function(_0x42bc66){if(_0x42bc66){_0x1f1c27[_0x4ecd('0x1d')]['contact']=_0x42bc66[0x0];if(!_0x5c714a[_0x4ecd('0x4b')][_0x4ecd('0x69')])return;return db[_0x4ecd('0x78')]['find']({'where':{'id':_0x5c714a[_0x4ecd('0x4b')]['UserId'],'role':_0x4ecd('0x6b')},'attributes':['id',_0x4ecd('0x2d'),_0x4ecd('0x79'),_0x4ecd('0x7a'),_0x4ecd('0x7b')],'raw':!![]});}return null;})[_0x4ecd('0x15')](function(_0x48e177){if(!_0x48e177)return null;_0x1f1c27[_0x4ecd('0x1d')][_0x4ecd('0x6b')]=_0x48e177;return _0x1f1c27;})[_0x4ecd('0x15')](function(_0x2911d7){if(_0x2911d7){if(_0x5c714a[_0x4ecd('0x4b')][_0x4ecd('0x7c')]){_0x1f1c27[_0x4ecd('0x1d')]['interface']=util[_0x4ecd('0x64')]('SIP/%s',_0x5c714a[_0x4ecd('0x6a')][_0x4ecd('0x2d')]);_0x1f1c27['message'][_0x4ecd('0x7d')]=_0x1f1c27[_0x4ecd('0x7d')];_0x1f1c27[_0x4ecd('0x1d')][_0x4ecd('0x7e')]=_0x1f1c27[_0x4ecd('0x7d')];_0x1f1c27[_0x4ecd('0x1d')][_0x4ecd('0x7f')]='accept';_0x1f1c27[_0x4ecd('0x1d')][_0x4ecd('0x4b')]=htmlToText[_0x4ecd('0x80')](_0x1f1c27[_0x4ecd('0x1d')][_0x4ecd('0x4b')]);return respondWithRpcPromise(_0x4ecd('0x81'),'EventManager',{'event':'acceptmessage','message':_0x1f1c27[_0x4ecd('0x1d')]},client9002)[_0x4ecd('0x15')](function(){return _0x1f1c27;});}return _0x1f1c27;}return null;})[_0x4ecd('0x15')](respondWithResult(_0x4bed2a,null))[_0x4ecd('0x20')](handleError(_0x4bed2a,null));};exports['reject']=function(_0x11b05b,_0x173c6c){var _0x39cbcc={'agent':{},'channel':'mail'};if(_0x11b05b[_0x4ecd('0x4b')]['id']){delete _0x11b05b[_0x4ecd('0x4b')]['id'];}_0x11b05b[_0x4ecd('0x4b')]['UserId']=_0x11b05b['body'][_0x4ecd('0x69')]||_0x11b05b['user']['id'];_0x39cbcc[_0x4ecd('0x6b')]['id']=_0x11b05b[_0x4ecd('0x4b')][_0x4ecd('0x69')];return db[_0x4ecd('0x30')]['find']({'where':{'id':_0x11b05b[_0x4ecd('0x49')]['id'],'UserId':null}})[_0x4ecd('0x15')](handleEntityNotFound(_0x173c6c,null))[_0x4ecd('0x15')](function(_0x24eca2){if(_0x24eca2){_0x39cbcc['message']=_0x24eca2[_0x4ecd('0x6c')]({'plain':!![]});return db[_0x4ecd('0x6d')][_0x4ecd('0x4a')]({'where':{'id':_0x24eca2[_0x4ecd('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x173c6c,null))[_0x4ecd('0x15')](function(_0x4673c8){if(_0x4673c8){_0x39cbcc[_0x4ecd('0x6f')]=_0x4673c8[_0x4ecd('0x6c')]({'plain':!![]});interaction_log['info'](_0x4ecd('0x83'),_0x11b05b[_0x4ecd('0x6a')]['id'],_0x11b05b['user']['name'],_0x11b05b[_0x4ecd('0x6a')][_0x4ecd('0x84')],_0x39cbcc['interaction']['id'],_0x11b05b[_0x4ecd('0x4b')]?JSON[_0x4ecd('0x1a')](_0x11b05b['body']):'null');return respondWithRpcPromise('RejectMessage',_0x4ecd('0x85'),_0x39cbcc);}return null;})[_0x4ecd('0x15')](function(_0x2cbf3f){var _0x243598=_0x4ecd('0x73')+_0x2cbf3f[_0x4ecd('0x1d')]['ContactId'];return db[_0x4ecd('0x74')]['query'](_0x243598,{'type':db[_0x4ecd('0x75')]['QueryTypes']['SELECT'],'raw':!![]})[_0x4ecd('0x15')](function(_0x59a46d){return _0x59a46d;});})[_0x4ecd('0x15')](function(_0x1358c6){if(_0x1358c6){_0x39cbcc[_0x4ecd('0x1d')][_0x4ecd('0x86')]=_0x1358c6[0x0];if(!_0x11b05b[_0x4ecd('0x4b')][_0x4ecd('0x69')])return;return db[_0x4ecd('0x78')]['find']({'where':{'id':_0x11b05b[_0x4ecd('0x4b')]['UserId'],'role':_0x4ecd('0x6b')},'attributes':['id','name','fullname',_0x4ecd('0x7a'),_0x4ecd('0x7b')],'raw':!![]});}return null;})['then'](function(_0x573b4b){if(!_0x573b4b)return null;_0x39cbcc[_0x4ecd('0x1d')][_0x4ecd('0x6b')]=_0x573b4b;return _0x39cbcc;})[_0x4ecd('0x15')](function(_0x572af7){if(_0x572af7){_0x572af7[_0x4ecd('0x1d')][_0x4ecd('0x87')]=util[_0x4ecd('0x64')](_0x4ecd('0x88'),_0x11b05b[_0x4ecd('0x6a')][_0x4ecd('0x2d')]);_0x572af7[_0x4ecd('0x1d')][_0x4ecd('0x7d')]=_0x39cbcc[_0x4ecd('0x7d')];_0x572af7[_0x4ecd('0x1d')][_0x4ecd('0x7e')]=_0x39cbcc['channel'];_0x572af7[_0x4ecd('0x1d')][_0x4ecd('0x7f')]='reject';_0x572af7[_0x4ecd('0x1d')]['body']=htmlToText[_0x4ecd('0x80')](_0x39cbcc['message'][_0x4ecd('0x4b')]);respondWithRpcPromise(_0x4ecd('0x81'),'EventManager',{'event':'rejectmessage','message':_0x572af7[_0x4ecd('0x1d')]},client9002);return _0x39cbcc;}return null;})[_0x4ecd('0x15')](respondWithResult(_0x173c6c,null))[_0x4ecd('0x20')](handleError(_0x173c6c,null));};exports[_0x4ecd('0x89')]=function(_0x51b6d0,_0x46b9ea){var _0x3b7652=moment()[_0x4ecd('0x8a')]()[_0x4ecd('0x8b')]();var _0x34bd03=path[_0x4ecd('0x8c')](config['root'],_0x4ecd('0x8d'),_0x4ecd('0x8e'),_0x4ecd('0x8f'));var _0x1ac945=path[_0x4ecd('0x8c')](config[_0x4ecd('0x5d')],_0x4ecd('0x8d'),_0x4ecd('0x8e'),_0x4ecd('0x5c'));var _0x51bae4=util[_0x4ecd('0x64')](_0x4ecd('0x90'),_0x3b7652);return db[_0x4ecd('0x30')][_0x4ecd('0x4a')]({'where':{'id':_0x51b6d0['params']['id']},'attributes':['id','body',_0x4ecd('0x91'),'to','cc',_0x4ecd('0x92'),_0x4ecd('0x93'),_0x4ecd('0x94')],'include':_0x51b6d0[_0x4ecd('0x34')][_0x4ecd('0x5c')]?[{'model':db['Attachment'],'as':_0x4ecd('0x95')}]:undefined})[_0x4ecd('0x15')](handleEntityNotFound(_0x46b9ea,null))['then'](function(_0x1124b0){if(_0x1124b0){var _0x3cf57e=_0x1124b0;var _0x781d73={'from':_0x3cf57e['from'],'to':_0x3cf57e['to'],'subject':_0x3cf57e[_0x4ecd('0x93')],'html':htmlEntities[_0x4ecd('0x96')](_0x3cf57e[_0x4ecd('0x4b')]),'headers':{'Date':moment(_0x3cf57e[_0x4ecd('0x94')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1124b0['cc']){_0x781d73[_0x4ecd('0x97')]['Cc']=_0x1124b0['cc'];}if(_0x1124b0[_0x4ecd('0x92')]){_0x781d73[_0x4ecd('0x97')][_0x4ecd('0x98')]=_0x1124b0[_0x4ecd('0x92')];}return new BPromise(function(_0x38eaca,_0x9ee521){if(_0x1124b0[_0x4ecd('0x95')]){for(var _0x85259c=0x0;_0x85259c<_0x1124b0[_0x4ecd('0x95')][_0x4ecd('0x3b')];_0x85259c++){var _0x19da6e=_0x1124b0['Attachments'][_0x85259c];var _0x476744=path[_0x4ecd('0x8c')](_0x1ac945,_0x19da6e[_0x4ecd('0x5f')]);if(fs[_0x4ecd('0x99')](_0x476744)){_0x781d73[_0x4ecd('0x5c')]['push']({'name':_0x19da6e[_0x4ecd('0x2d')],'contentType':_0x19da6e[_0x4ecd('0x43')],'data':fs[_0x4ecd('0x9a')](_0x476744)});}}}emlformat['build'](_0x781d73,function(_0xe5e4df,_0x123e65){if(_0xe5e4df)return _0x9ee521(_0xe5e4df);fs[_0x4ecd('0x9b')](path['join'](_0x34bd03,_0x51bae4),_0x123e65);return _0x38eaca(_0x123e65);});});}})['then'](function(_0x255535){if(_0x255535){return _0x46b9ea[_0x4ecd('0x89')](path[_0x4ecd('0x8c')](_0x34bd03,_0x51bae4),_0x51bae4,function(_0x5a6a2b){if(!_0x5a6a2b)fs[_0x4ecd('0x9c')](path[_0x4ecd('0x8c')](_0x34bd03,_0x51bae4));});}})['catch'](handleError(_0x46b9ea,null));}; \ No newline at end of file +var _0xf60a=['toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','download','unlinkSync','eml-format','util','path','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','fields','body','find','destroy','describe','out','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','basename','CmContact','create','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fromString','rejectmessage','unix'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf60a,0xb7));var _0xaf60=function(_0x3251f7,_0x43d28c){_0x3251f7=_0x3251f7-0x0;var _0x13c104=_0xf60a[_0x3251f7];return _0x13c104;};'use strict';var emlformat=require(_0xaf60('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xaf60('0x1'));var path=require(_0xaf60('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xaf60('0x3'));var qs=require(_0xaf60('0x4'));var logger=require('../../config/logger')(_0xaf60('0x5'));var interaction_log=require(_0xaf60('0x6'))('mail-interactions');var config=require(_0xaf60('0x7'));var db=require(_0xaf60('0x8'))['db'];config[_0xaf60('0x9')]=_[_0xaf60('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf60('0x9')]));var htmlEntities=require('html-entities');require(_0xaf60('0xb'))[_0xaf60('0xc')](socket);var jayson=require(_0xaf60('0xd'));var client=jayson[_0xaf60('0xe')]['http']({'port':0x232c});var client9003=jayson[_0xaf60('0xe')][_0xaf60('0xf')]({'port':0x232b});var client9002=jayson[_0xaf60('0xe')][_0xaf60('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x3c54d6,_0x5bce88,_0xbb23e8,_0x3d980a){return new BPromise(function(_0x3a38d1,_0x2f66b3){var _0x1b7e9a=_0x3d980a||client;return _0x1b7e9a[_0xaf60('0x10')](_0x3c54d6,_0xbb23e8)[_0xaf60('0x11')](function(_0x1cc296){logger[_0xaf60('0x12')](_0xaf60('0x13'),_0x5bce88,_0xaf60('0x14'));logger[_0xaf60('0x15')](_0xaf60('0x16'),_0x5bce88,_0xaf60('0x14'),JSON[_0xaf60('0x17')](_0x1cc296));if(_0x1cc296[_0xaf60('0x18')]){if(_0x1cc296[_0xaf60('0x18')]['code']===0x1f4){logger[_0xaf60('0x18')](_0xaf60('0x13'),_0x5bce88,_0x1cc296[_0xaf60('0x18')]['message']);return _0x2f66b3(_0x1cc296[_0xaf60('0x18')][_0xaf60('0x19')]);}logger[_0xaf60('0x18')](_0xaf60('0x13'),_0x5bce88,_0x1cc296[_0xaf60('0x18')][_0xaf60('0x19')]);return _0x3a38d1(_0x1cc296[_0xaf60('0x18')][_0xaf60('0x19')]);}else{logger['info'](_0xaf60('0x13'),_0x5bce88,_0xaf60('0x14'));_0x3a38d1(_0x1cc296[_0xaf60('0x1a')][_0xaf60('0x19')]);}})[_0xaf60('0x1b')](function(_0x30ea52){logger[_0xaf60('0x18')]('MailMessage,\x20%s,\x20%s',_0x5bce88,_0x30ea52);_0x2f66b3(_0x30ea52);});});}function respondWithResult(_0x536aa3,_0x393181){_0x393181=_0x393181||0xc8;return function(_0x38b718){if(_0x38b718){return _0x536aa3[_0xaf60('0x1c')](_0x393181)[_0xaf60('0x1d')](_0x38b718);}};}function respondWithFilteredResult(_0x1ae187,_0x29e74e){return function(_0x1c95e8){if(_0x1c95e8){var _0x18a497=typeof _0x29e74e[_0xaf60('0x1e')]===_0xaf60('0x1f')&&typeof _0x29e74e[_0xaf60('0x20')]===_0xaf60('0x1f');var _0x2c86a1=_0x1c95e8['count'];var _0x652c68=_0x18a497?0x0:_0x29e74e[_0xaf60('0x1e')];var _0x561ea6=_0x18a497?_0x1c95e8[_0xaf60('0x21')]:_0x29e74e[_0xaf60('0x1e')]+_0x29e74e[_0xaf60('0x20')];var _0x16f275;if(_0x561ea6>=_0x2c86a1){_0x561ea6=_0x2c86a1;_0x16f275=0xc8;}else{_0x16f275=0xce;}_0x1ae187[_0xaf60('0x1c')](_0x16f275);return _0x1ae187[_0xaf60('0x22')](_0xaf60('0x23'),_0x652c68+'-'+_0x561ea6+'/'+_0x2c86a1)[_0xaf60('0x1d')](_0x1c95e8);}return null;};}function saveUpdates(_0xb29c0){return function(_0x52b019){if(_0x52b019){return _0x52b019[_0xaf60('0x24')](_0xb29c0)[_0xaf60('0x11')](function(_0x1b24d9){return _0x1b24d9;});}return null;};}function removeEntity(_0x53dd4e){return function(_0x4de655){if(_0x4de655){return _0x4de655['destroy']()[_0xaf60('0x11')](function(){_0x53dd4e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x383ed4){return function(_0x4b922e){if(!_0x4b922e){_0x383ed4[_0xaf60('0x25')](0x194);}return _0x4b922e;};}function handleError(_0x13df89,_0x294171){_0x294171=_0x294171||0x1f4;return function(_0x5215c6){logger['error'](_0x5215c6[_0xaf60('0x26')]);if(_0x5215c6['name']){delete _0x5215c6[_0xaf60('0x27')];}_0x13df89[_0xaf60('0x1c')](_0x294171)[_0xaf60('0x28')](_0x5215c6);};}exports[_0xaf60('0x29')]=function(_0x15da79,_0x3bbbcf){var _0x5b27eb={},_0x3aeab4={},_0x550821={'count':0x0,'rows':[]};var _0x7e5183=_['map'](db[_0xaf60('0x2a')][_0xaf60('0x2b')],function(_0x15e45b){return{'name':_0x15e45b[_0xaf60('0x2c')],'type':_0x15e45b[_0xaf60('0x2d')][_0xaf60('0x2e')]};});_0x3aeab4[_0xaf60('0x2f')]=_[_0xaf60('0x30')](_0x7e5183,_0xaf60('0x27'));_0x3aeab4[_0xaf60('0x31')]=_[_0xaf60('0x32')](_0x15da79[_0xaf60('0x31')]);_0x3aeab4[_0xaf60('0x33')]=_[_0xaf60('0x34')](_0x3aeab4[_0xaf60('0x2f')],_0x3aeab4[_0xaf60('0x31')]);_0x5b27eb[_0xaf60('0x35')]=_[_0xaf60('0x34')](_0x3aeab4['model'],qs['fields'](_0x15da79[_0xaf60('0x31')]['fields']));_0x5b27eb['attributes']=_0x5b27eb['attributes'][_0xaf60('0x36')]?_0x5b27eb[_0xaf60('0x35')]:_0x3aeab4[_0xaf60('0x2f')];if(!_0x15da79['query'][_0xaf60('0x37')](_0xaf60('0x38'))){_0x5b27eb[_0xaf60('0x20')]=qs[_0xaf60('0x20')](_0x15da79[_0xaf60('0x31')][_0xaf60('0x20')]);_0x5b27eb[_0xaf60('0x1e')]=qs[_0xaf60('0x1e')](_0x15da79[_0xaf60('0x31')][_0xaf60('0x1e')]);}_0x5b27eb[_0xaf60('0x39')]=qs['sort'](_0x15da79[_0xaf60('0x31')][_0xaf60('0x3a')]);_0x5b27eb[_0xaf60('0x3b')]=qs['filters'](_[_0xaf60('0x3c')](_0x15da79['query'],_0x3aeab4[_0xaf60('0x33')]),_0x7e5183);if(_0x15da79[_0xaf60('0x31')][_0xaf60('0x3d')]){_0x5b27eb['where']=_['merge'](_0x5b27eb[_0xaf60('0x3b')],{'$or':_[_0xaf60('0x30')](_0x7e5183,function(_0x3e8c2d){if(_0x3e8c2d['type']!==_0xaf60('0x3e')){var _0x9b552f={};_0x9b552f[_0x3e8c2d[_0xaf60('0x27')]]={'$like':'%'+_0x15da79[_0xaf60('0x31')][_0xaf60('0x3d')]+'%'};return _0x9b552f;}})});}_0x5b27eb=_[_0xaf60('0x3f')]({},_0x5b27eb,_0x15da79[_0xaf60('0x40')]);var _0x10c4f2={'where':_0x5b27eb['where']};return db[_0xaf60('0x2a')]['count'](_0x10c4f2)[_0xaf60('0x11')](function(_0x16c2c7){_0x550821['count']=_0x16c2c7;if(_0x15da79[_0xaf60('0x31')][_0xaf60('0x41')]){_0x5b27eb[_0xaf60('0x42')]=[{'all':!![]}];}return db['MailMessage'][_0xaf60('0x43')](_0x5b27eb);})[_0xaf60('0x11')](function(_0x59f9fc){_0x550821[_0xaf60('0x44')]=_0x59f9fc;return _0x550821;})[_0xaf60('0x11')](respondWithFilteredResult(_0x3bbbcf,_0x5b27eb))['catch'](handleError(_0x3bbbcf,null));};exports[_0xaf60('0x45')]=function(_0x14effc,_0x32080f){var _0xa351c1={'raw':!![],'where':{'id':_0x14effc[_0xaf60('0x46')]['id']}},_0x12a360={};_0x12a360['model']=_['keys'](db[_0xaf60('0x2a')][_0xaf60('0x2b')]);_0x12a360[_0xaf60('0x31')]=_[_0xaf60('0x32')](_0x14effc[_0xaf60('0x31')]);_0x12a360['filters']=_[_0xaf60('0x34')](_0x12a360[_0xaf60('0x2f')],_0x12a360[_0xaf60('0x31')]);_0xa351c1['attributes']=_[_0xaf60('0x34')](_0x12a360[_0xaf60('0x2f')],qs['fields'](_0x14effc[_0xaf60('0x31')][_0xaf60('0x47')]));_0xa351c1[_0xaf60('0x35')]=_0xa351c1['attributes'][_0xaf60('0x36')]?_0xa351c1[_0xaf60('0x35')]:_0x12a360[_0xaf60('0x2f')];if(_0x14effc['query'][_0xaf60('0x41')]){_0xa351c1[_0xaf60('0x42')]=[{'all':!![]}];}_0xa351c1=_[_0xaf60('0x3f')]({},_0xa351c1,_0x14effc['options']);return db[_0xaf60('0x2a')]['find'](_0xa351c1)['then'](handleEntityNotFound(_0x32080f,null))['then'](respondWithResult(_0x32080f,null))['catch'](handleError(_0x32080f,null));};exports[_0xaf60('0x24')]=function(_0x20e575,_0x3ba3ad){if(_0x20e575[_0xaf60('0x48')]['id']){delete _0x20e575[_0xaf60('0x48')]['id'];}return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x20e575['params']['id']}})[_0xaf60('0x11')](handleEntityNotFound(_0x3ba3ad,null))[_0xaf60('0x11')](saveUpdates(_0x20e575['body'],null))[_0xaf60('0x11')](respondWithResult(_0x3ba3ad,null))[_0xaf60('0x1b')](handleError(_0x3ba3ad,null));};exports[_0xaf60('0x4a')]=function(_0x30e5fe,_0x2ffa76){return db['MailMessage'][_0xaf60('0x49')]({'where':{'id':_0x30e5fe[_0xaf60('0x46')]['id']}})[_0xaf60('0x11')](handleEntityNotFound(_0x2ffa76,null))[_0xaf60('0x11')](removeEntity(_0x2ffa76,null))['catch'](handleError(_0x2ffa76,null));};exports[_0xaf60('0x4b')]=function(_0x428bb6,_0xfe28f8){return db[_0xaf60('0x2a')][_0xaf60('0x4b')]()[_0xaf60('0x11')](respondWithResult(_0xfe28f8,null))[_0xaf60('0x1b')](handleError(_0xfe28f8,null));};exports['create']=function(_0x784c25,_0x553363){return db[_0xaf60('0x2a')]['create'](_0x784c25[_0xaf60('0x48')])[_0xaf60('0x11')](function(_0x536a66){if(_0x536a66){if(_0x536a66['direction']===_0xaf60('0x4c')&&!_0x536a66['secret']){var _0x5c21d7,_0x3b3b8d,_0x33910a;if(_0x784c25[_0xaf60('0x48')]['to']){_0x3b3b8d=_0x784c25[_0xaf60('0x48')]['to']['split'](',')[0x0];}return db[_0xaf60('0x4d')][_0xaf60('0x4e')]({'where':{'id':_0x536a66[_0xaf60('0x4f')]},'include':[{'model':db[_0xaf60('0x50')],'as':_0xaf60('0x51'),'include':[{'model':db['CmContact'],'as':_0xaf60('0x52'),'where':{'email':_0x3b3b8d},'limit':0x1,'order':[[_0xaf60('0x53'),_0xaf60('0x54')]]}]},{'model':db[_0xaf60('0x55')],'as':_0xaf60('0x56'),'raw':!![],'include':[{'model':db[_0xaf60('0x57')],'as':'CloudProvider','raw':!![]}]}]})[_0xaf60('0x11')](function(_0x16559e){_0x5c21d7=_0x16559e;if(!_0x5c21d7||!_0x5c21d7[_0xaf60('0x56')])return;var _0x32674f=_0x5c21d7[_0xaf60('0x58')]();if(_0x784c25[_0xaf60('0x48')]['attachments']&&_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0xaf60('0x36')]){for(var _0x17bf41=0x0;_0x17bf41<_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0xaf60('0x36')];_0x17bf41+=0x1){_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0x17bf41]={'filename':_0x784c25[_0xaf60('0x48')][_0xaf60('0x59')][_0x17bf41]['name'],'path':path[_0xaf60('0x5a')](config['root'],'server/files/attachments',_0x784c25[_0xaf60('0x48')]['attachments'][_0x17bf41][_0xaf60('0x5b')])};}}_0x33910a={'account':_0x32674f,'message':_0x784c25[_0xaf60('0x48')]};return;})[_0xaf60('0x11')](function(){if(_0x5c21d7[_0xaf60('0x51')]){if(_0x5c21d7[_0xaf60('0x51')]['Contacts'][_0xaf60('0x36')]){return _0x5c21d7[_0xaf60('0x51')][_0xaf60('0x52')][0x0];}else{return db[_0xaf60('0x5c')][_0xaf60('0x5d')](_[_0xaf60('0xa')](_0x784c25[_0xaf60('0x48')],{'firstName':_0x784c25['body']['to'],'email':_0x784c25[_0xaf60('0x48')]['to'],'phone':_0x784c25[_0xaf60('0x48')]['to'],'ListId':_0x5c21d7[_0xaf60('0x5e')]}));}}else{throw new Error(_0xaf60('0x5f'));}})[_0xaf60('0x11')](function(){if(_0x33910a){return respondWithRpcPromise(_0xaf60('0x60'),_0xaf60('0x61'),_0x33910a,client9003)['then'](function(_0xc9afd2){return _0x536a66[_0xaf60('0x24')]({'read':!![],'messageId':_0xc9afd2[_0xaf60('0x62')],'sentAt':moment()[_0xaf60('0x63')](_0xaf60('0x64'))});})[_0xaf60('0x1b')](function(_0x2b019d){logger['error']('%s',JSON[_0xaf60('0x17')](_0x2b019d));return _0x536a66;});}return _0x536a66;});}return _0x536a66;}})['then'](respondWithResult(_0x553363,0xc9))[_0xaf60('0x1b')](handleError(_0x553363,null));};exports[_0xaf60('0x65')]=function(_0x231f64,_0xcec160){var _0x193b6d={'agent':{},'channel':_0xaf60('0x66')};if(_0x231f64['body']['id']){delete _0x231f64[_0xaf60('0x48')]['id'];}_0x231f64[_0xaf60('0x48')][_0xaf60('0x67')]=!![];_0x231f64[_0xaf60('0x48')][_0xaf60('0x68')]=moment()[_0xaf60('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')]=_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')]||_0x231f64[_0xaf60('0x6a')]['id'];_0x193b6d[_0xaf60('0x6b')]['id']=_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')];return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x231f64[_0xaf60('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xcec160,null))[_0xaf60('0x11')](saveUpdates(_0x231f64['body'],null))['then'](function(_0x4c4b61){if(_0x4c4b61){_0x193b6d['message']=_0x4c4b61[_0xaf60('0x6c')]({'plain':!![]});return db['MailInteraction'][_0xaf60('0x49')]({'where':{'id':_0x4c4b61['MailInteractionId']}});}return null;})[_0xaf60('0x11')](handleEntityNotFound(_0xcec160,null))[_0xaf60('0x11')](function(_0x126bb5){if(_0x126bb5){return _0x126bb5[_0xaf60('0x24')]({'UserId':_0x231f64[_0xaf60('0x48')]['UserId'],'read1stAt':_[_0xaf60('0x6d')](_0x126bb5[_0xaf60('0x6e')])?moment()[_0xaf60('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xaf60('0x11')](function(_0x53b9d6){if(_0x53b9d6){_0x193b6d[_0xaf60('0x6f')]=_0x53b9d6['get']({'plain':!![]});interaction_log['info'](_0xaf60('0x70'),_0x231f64['user']['id'],_0x231f64[_0xaf60('0x6a')][_0xaf60('0x27')],_0x231f64[_0xaf60('0x6a')][_0xaf60('0x71')],_0x193b6d['interaction']['id'],_0x231f64['body']?JSON[_0xaf60('0x17')](_0x231f64[_0xaf60('0x48')]):_0xaf60('0x72'));return respondWithRpcPromise('AcceptMessage',_0xaf60('0x73'),_0x193b6d);}return null;})[_0xaf60('0x11')](function(_0x583793){var _0x5bb586=_0xaf60('0x74')+_0x583793['message'][_0xaf60('0x75')];return db[_0xaf60('0x76')][_0xaf60('0x31')](_0x5bb586,{'type':db[_0xaf60('0x77')][_0xaf60('0x78')]['SELECT'],'raw':!![]})[_0xaf60('0x11')](function(_0x233531){return _0x233531;});})[_0xaf60('0x11')](function(_0x51a94a){if(_0x51a94a){_0x193b6d[_0xaf60('0x19')][_0xaf60('0x79')]=_0x51a94a[0x0];if(!_0x231f64['body']['UserId'])return;return db[_0xaf60('0x7a')][_0xaf60('0x49')]({'where':{'id':_0x231f64[_0xaf60('0x48')][_0xaf60('0x69')],'role':_0xaf60('0x6b')},'attributes':['id','name',_0xaf60('0x7b'),'email',_0xaf60('0x7c')],'raw':!![]});}return null;})[_0xaf60('0x11')](function(_0x308122){if(!_0x308122)return null;_0x193b6d[_0xaf60('0x19')]['agent']=_0x308122;return _0x193b6d;})[_0xaf60('0x11')](function(_0x140de5){if(_0x140de5){if(_0x231f64[_0xaf60('0x48')][_0xaf60('0x7d')]){_0x193b6d[_0xaf60('0x19')][_0xaf60('0x7e')]=util['format'](_0xaf60('0x7f'),_0x231f64[_0xaf60('0x6a')][_0xaf60('0x27')]);_0x193b6d['message']['channel']=_0x193b6d[_0xaf60('0x80')];_0x193b6d[_0xaf60('0x19')][_0xaf60('0x81')]=_0x193b6d[_0xaf60('0x80')];_0x193b6d['message'][_0xaf60('0x82')]=_0xaf60('0x65');_0x193b6d['message'][_0xaf60('0x48')]=htmlToText['fromString'](_0x193b6d[_0xaf60('0x19')][_0xaf60('0x48')]);return respondWithRpcPromise(_0xaf60('0x83'),'EventManager',{'event':_0xaf60('0x84'),'message':_0x193b6d[_0xaf60('0x19')]},client9002)[_0xaf60('0x11')](function(){return _0x193b6d;});}return _0x193b6d;}return null;})[_0xaf60('0x11')](respondWithResult(_0xcec160,null))[_0xaf60('0x1b')](handleError(_0xcec160,null));};exports[_0xaf60('0x85')]=function(_0x15b61e,_0x492724){var _0x136502={'agent':{},'channel':_0xaf60('0x66')};if(_0x15b61e[_0xaf60('0x48')]['id']){delete _0x15b61e[_0xaf60('0x48')]['id'];}_0x15b61e['body'][_0xaf60('0x69')]=_0x15b61e[_0xaf60('0x48')]['UserId']||_0x15b61e[_0xaf60('0x6a')]['id'];_0x136502['agent']['id']=_0x15b61e[_0xaf60('0x48')][_0xaf60('0x69')];return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x15b61e[_0xaf60('0x46')]['id'],'UserId':null}})[_0xaf60('0x11')](handleEntityNotFound(_0x492724,null))[_0xaf60('0x11')](function(_0x286d70){if(_0x286d70){_0x136502[_0xaf60('0x19')]=_0x286d70[_0xaf60('0x6c')]({'plain':!![]});return db[_0xaf60('0x86')][_0xaf60('0x49')]({'where':{'id':_0x286d70[_0xaf60('0x87')]}});}return null;})[_0xaf60('0x11')](handleEntityNotFound(_0x492724,null))['then'](function(_0x3b31ab){if(_0x3b31ab){_0x136502[_0xaf60('0x6f')]=_0x3b31ab[_0xaf60('0x6c')]({'plain':!![]});interaction_log[_0xaf60('0x12')](_0xaf60('0x88'),_0x15b61e['user']['id'],_0x15b61e[_0xaf60('0x6a')][_0xaf60('0x27')],_0x15b61e[_0xaf60('0x6a')][_0xaf60('0x71')],_0x136502[_0xaf60('0x6f')]['id'],_0x15b61e['body']?JSON['stringify'](_0x15b61e[_0xaf60('0x48')]):_0xaf60('0x72'));return respondWithRpcPromise(_0xaf60('0x89'),_0xaf60('0x8a'),_0x136502);}return null;})['then'](function(_0x1cede2){var _0x8431e7=_0xaf60('0x74')+_0x1cede2[_0xaf60('0x19')]['ContactId'];return db['sequelize'][_0xaf60('0x31')](_0x8431e7,{'type':db[_0xaf60('0x77')][_0xaf60('0x78')][_0xaf60('0x8b')],'raw':!![]})[_0xaf60('0x11')](function(_0xb98d69){return _0xb98d69;});})[_0xaf60('0x11')](function(_0x5ef005){if(_0x5ef005){_0x136502['message'][_0xaf60('0x79')]=_0x5ef005[0x0];if(!_0x15b61e['body']['UserId'])return;return db[_0xaf60('0x7a')][_0xaf60('0x49')]({'where':{'id':_0x15b61e[_0xaf60('0x48')][_0xaf60('0x69')],'role':_0xaf60('0x6b')},'attributes':['id','name',_0xaf60('0x7b'),'email',_0xaf60('0x7c')],'raw':!![]});}return null;})[_0xaf60('0x11')](function(_0x1d72e3){if(!_0x1d72e3)return null;_0x136502[_0xaf60('0x19')][_0xaf60('0x6b')]=_0x1d72e3;return _0x136502;})[_0xaf60('0x11')](function(_0x17dc32){if(_0x17dc32){_0x17dc32[_0xaf60('0x19')]['interface']=util['format'](_0xaf60('0x7f'),_0x15b61e['user'][_0xaf60('0x27')]);_0x17dc32[_0xaf60('0x19')][_0xaf60('0x80')]=_0x136502['channel'];_0x17dc32[_0xaf60('0x19')][_0xaf60('0x81')]=_0x136502[_0xaf60('0x80')];_0x17dc32['message'][_0xaf60('0x82')]=_0xaf60('0x85');_0x17dc32[_0xaf60('0x19')][_0xaf60('0x48')]=htmlToText[_0xaf60('0x8c')](_0x136502[_0xaf60('0x19')][_0xaf60('0x48')]);respondWithRpcPromise(_0xaf60('0x83'),'EventManager',{'event':_0xaf60('0x8d'),'message':_0x17dc32[_0xaf60('0x19')]},client9002);return _0x136502;}return null;})[_0xaf60('0x11')](respondWithResult(_0x492724,null))[_0xaf60('0x1b')](handleError(_0x492724,null));};exports['download']=function(_0x4858c4,_0x1fd4d6){var _0x476819=moment()[_0xaf60('0x8e')]()[_0xaf60('0x8f')]();var _0x57c2ca=path['join'](config[_0xaf60('0x90')],_0xaf60('0x91'),_0xaf60('0x92'),_0xaf60('0x93'));var _0x31bef6=path[_0xaf60('0x5a')](config[_0xaf60('0x90')],'server',_0xaf60('0x92'),_0xaf60('0x59'));var _0x506d8a=util['format'](_0xaf60('0x94'),_0x476819);return db[_0xaf60('0x2a')][_0xaf60('0x49')]({'where':{'id':_0x4858c4['params']['id']},'attributes':['id',_0xaf60('0x48'),_0xaf60('0x95'),'to','cc',_0xaf60('0x96'),_0xaf60('0x97'),_0xaf60('0x98')],'include':_0x4858c4[_0xaf60('0x31')]['attachments']?[{'model':db['Attachment'],'as':_0xaf60('0x99')}]:undefined})['then'](handleEntityNotFound(_0x1fd4d6,null))[_0xaf60('0x11')](function(_0x24e4ac){if(_0x24e4ac){var _0x19cab1=_0x24e4ac;var _0x26df50={'from':_0x19cab1[_0xaf60('0x95')],'to':_0x19cab1['to'],'subject':_0x19cab1[_0xaf60('0x97')],'html':htmlEntities[_0xaf60('0x9a')](_0x19cab1[_0xaf60('0x48')]),'headers':{'Date':moment(_0x19cab1[_0xaf60('0x98')])['format'](_0xaf60('0x9b'))},'attachments':[]};if(_0x24e4ac['cc']){_0x26df50['headers']['Cc']=_0x24e4ac['cc'];}if(_0x24e4ac[_0xaf60('0x96')]){_0x26df50[_0xaf60('0x9c')][_0xaf60('0x9d')]=_0x24e4ac[_0xaf60('0x96')];}return new BPromise(function(_0x408994,_0x2f4a7){if(_0x24e4ac[_0xaf60('0x99')]){for(var _0x76279=0x0;_0x76279<_0x24e4ac['Attachments'][_0xaf60('0x36')];_0x76279++){var _0x7398cf=_0x24e4ac[_0xaf60('0x99')][_0x76279];var _0x17e77c=path[_0xaf60('0x5a')](_0x31bef6,_0x7398cf[_0xaf60('0x5b')]);if(fs[_0xaf60('0x9e')](_0x17e77c)){_0x26df50[_0xaf60('0x59')]['push']({'name':_0x7398cf[_0xaf60('0x27')],'contentType':_0x7398cf['type'],'data':fs[_0xaf60('0x9f')](_0x17e77c)});}}}emlformat[_0xaf60('0xa0')](_0x26df50,function(_0x66e70,_0x1f92a9){if(_0x66e70)return _0x2f4a7(_0x66e70);fs['writeFileSync'](path['join'](_0x57c2ca,_0x506d8a),_0x1f92a9);return _0x408994(_0x1f92a9);});});}})[_0xaf60('0x11')](function(_0x168ebf){if(_0x168ebf){return _0x1fd4d6[_0xaf60('0xa1')](path['join'](_0x57c2ca,_0x506d8a),_0x506d8a,function(_0x5ea54a){if(!_0x5ea54a)fs[_0xaf60('0xa2')](path['join'](_0x57c2ca,_0x506d8a));});}})[_0xaf60('0x1b')](handleError(_0x1fd4d6,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 41345f5..6ba134a 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 _0xfe8f=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4da918,_0x2a779c){var _0x4a174a=function(_0x1546b1){while(--_0x1546b1){_0x4da918['push'](_0x4da918['shift']());}};_0x4a174a(++_0x2a779c);}(_0xfe8f,0x1b4));var _0xffe8=function(_0x19f81a,_0x31d4a5){_0x19f81a=_0x19f81a-0x0;var _0x5037ee=_0xfe8f[_0x19f81a];return _0x5037ee;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xffe8('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xffe8('0x1')](0x0);var events={'afterCreate':_0xffe8('0x2'),'afterUpdate':_0xffe8('0x3'),'afterDestroy':_0xffe8('0x4')};function emitEvent(_0x4cafa4){return function(_0x23c67f,_0x58ae61,_0x4a4e84){MailMessageEvents['emit'](_0x4cafa4+':'+_0x23c67f['id'],_0x23c67f);MailMessageEvents[_0xffe8('0x5')](_0x4cafa4,_0x23c67f);_0x4a4e84(null);};}for(var e in events){if(events[_0xffe8('0x6')](e)){var event=events[e];MailMessage[_0xffe8('0x7')](e,emitEvent(event));}}module[_0xffe8('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x3068=['save','update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x1d9ee1,_0x293312){var _0x29ab8b=function(_0x4ec561){while(--_0x4ec561){_0x1d9ee1['push'](_0x1d9ee1['shift']());}};_0x29ab8b(++_0x293312);}(_0x3068,0x93));var _0x8306=function(_0x4b1051,_0xb9d64d){_0x4b1051=_0x4b1051-0x0;var _0x4521e6=_0x3068[_0x4b1051];return _0x4521e6;};'use strict';var EventEmitter=require(_0x8306('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8306('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8306('0x2')](0x0);var events={'afterCreate':_0x8306('0x3'),'afterUpdate':_0x8306('0x4'),'afterDestroy':_0x8306('0x5')};function emitEvent(_0x3c9de5){return function(_0x2e8d2a,_0x4788f5,_0x4f368c){MailMessageEvents[_0x8306('0x6')](_0x3c9de5+':'+_0x2e8d2a['id'],_0x2e8d2a);MailMessageEvents[_0x8306('0x6')](_0x3c9de5,_0x2e8d2a);_0x4f368c(null);};}for(var e in events){if(events[_0x8306('0x7')](e)){var event=events[e];MailMessage[_0x8306('0x8')](e,emitEvent(event));}}module[_0x8306('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d4c2207..bb2ba39 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 _0x4d44=['plainBody','subject','FULLTEXT','fromString','body','models','get','toLowerCase','out','secret','MailInteraction','findOne','MailInteractionId','update','createdAt','direction','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','define','MailMessage','mail_messages','messageId'];(function(_0x31c69b,_0x3f59a9){var _0x42acd3=function(_0x190d29){while(--_0x190d29){_0x31c69b['push'](_0x31c69b['shift']());}};_0x42acd3(++_0x3f59a9);}(_0x4d44,0x1d4));var _0x44d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d44[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x44d4('0x0'));var util=require(_0x44d4('0x1'));var logger=require(_0x44d4('0x2'))(_0x44d4('0x3'));var moment=require('moment');var BPromise=require(_0x44d4('0x4'));var rp=require(_0x44d4('0x5'));var htmlToText=require(_0x44d4('0x6'));var fs=require('fs');var path=require(_0x44d4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module['exports']=function(_0x1daa1b,_0x5d781c){return _0x1daa1b[_0x44d4('0x8')](_0x44d4('0x9'),attributes,{'tableName':_0x44d4('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x44d4('0xb')]},{'name':'fti_mail_messages','fields':[_0x44d4('0xc'),_0x44d4('0xd')],'type':_0x44d4('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x198541,_0x3a12b2,_0x23c168){if(_0x198541['body']){_0x198541['plainBody']=htmlToText[_0x44d4('0xf')](_0x198541[_0x44d4('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x23c168(null,_0x3a12b2);},'afterCreate':function(_0x704bbb,_0x268c4a,_0x3351e6){var _0x34d4b9=_0x1daa1b[_0x44d4('0x11')];var _0x15671e=_0x704bbb[_0x44d4('0x12')]({'plain':!![]});if(_0x15671e['direction'][_0x44d4('0x13')]()==='in'||_0x15671e['direction'][_0x44d4('0x13')]()===_0x44d4('0x14')&&!_0x15671e[_0x44d4('0x15')]&&!_['isNil'](_0x15671e['UserId'])){_0x34d4b9[_0x44d4('0x16')][_0x44d4('0x17')]({'where':{'id':_0x15671e[_0x44d4('0x18')]}})['then'](function(_0x4b3935){if(_0x4b3935){_0x4b3935[_0x44d4('0x19')]({'lastMsgAt':_0x15671e[_0x44d4('0x1a')],'lastMsgDirection':_0x15671e[_0x44d4('0x1b')][_0x44d4('0x13')]()});}})[_0x44d4('0x1c')](function(_0x3d36f4){console['error'](_0x3d36f4);});}_0x3351e6();}},'charset':'utf8mb4','collate':_0x44d4('0x1d')});}; \ No newline at end of file +var _0xf263=['UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x95abe2,_0x2d4fea){var _0x2fc8c4=function(_0x5234b8){while(--_0x5234b8){_0x95abe2['push'](_0x95abe2['shift']());}};_0x2fc8c4(++_0x2d4fea);}(_0xf263,0x92));var _0x3f26=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf263[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f26('0x0'))(_0x3f26('0x1'));var moment=require(_0x3f26('0x2'));var BPromise=require(_0x3f26('0x3'));var rp=require(_0x3f26('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x3f26('0x5'));var rimraf=require(_0x3f26('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f26('0x7'));module[_0x3f26('0x8')]=function(_0x417ff2,_0x4f02f1){return _0x417ff2[_0x3f26('0x9')](_0x3f26('0xa'),attributes,{'tableName':_0x3f26('0xb'),'paranoid':![],'indexes':[{'name':_0x3f26('0xc'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x3f26('0xd'),_0x3f26('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59aac6,_0x531640,_0x387f01){if(_0x59aac6[_0x3f26('0xf')]){_0x59aac6['plainBody']=htmlToText[_0x3f26('0x10')](_0x59aac6[_0x3f26('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x387f01(null,_0x531640);},'afterCreate':function(_0x503ba2,_0x2dd436,_0x40476e){var _0x52a72f=_0x417ff2[_0x3f26('0x11')];var _0x3438ee=_0x503ba2[_0x3f26('0x12')]({'plain':!![]});if(_0x3438ee[_0x3f26('0x13')][_0x3f26('0x14')]()==='in'||_0x3438ee['direction'][_0x3f26('0x14')]()===_0x3f26('0x15')&&!_0x3438ee[_0x3f26('0x16')]&&!_[_0x3f26('0x17')](_0x3438ee[_0x3f26('0x18')])){_0x52a72f[_0x3f26('0x19')][_0x3f26('0x1a')]({'where':{'id':_0x3438ee[_0x3f26('0x1b')]}})[_0x3f26('0x1c')](function(_0x1a83fb){if(_0x1a83fb){_0x1a83fb[_0x3f26('0x1d')]({'lastMsgAt':_0x3438ee[_0x3f26('0x1e')],'lastMsgDirection':_0x3438ee[_0x3f26('0x13')][_0x3f26('0x14')]()});}})['catch'](function(_0x51a282){console[_0x3f26('0x1f')](_0x51a282);});}_0x40476e();}},'charset':_0x3f26('0x20'),'collate':_0x3f26('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ab7e3ce..00c8f59 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 _0x5f66=['stringify','error','code','message','info','result','MailMessage','create','body','options','raw','CreateMailMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x52ed01,_0x5e23d3){var _0x36d4e6=function(_0x31a477){while(--_0x31a477){_0x52ed01['push'](_0x52ed01['shift']());}};_0x36d4e6(++_0x5e23d3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('MailMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('MailMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateMailMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateMailMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x955f=['../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x258313,_0x2f0677){var _0x170572=function(_0xf7ea7){while(--_0xf7ea7){_0x258313['push'](_0x258313['shift']());}};_0x170572(++_0x2f0677);}(_0x955f,0x1eb));var _0xf955=function(_0xe32c98,_0x32717d){_0xe32c98=_0xe32c98-0x0;var _0x456581=_0x955f[_0xe32c98];return _0x456581;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});config['redis']=_[_0xf955('0xa')](config[_0xf955('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf955('0xc'))(new Redis(config[_0xf955('0xb')]));require(_0xf955('0xd'))[_0xf955('0xe')](socket);function respondWithRpcPromise(_0x134c1b,_0x421e4a,_0x186719){return new BPromise(function(_0x4d213a,_0xf7e3e){return client['request'](_0x134c1b,_0x186719)[_0xf955('0xf')](function(_0x5d6211){logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,_0xf955('0x11'));logger['debug'](_0xf955('0x12'),_0x421e4a,'request\x20sent',JSON[_0xf955('0x13')](_0x5d6211));if(_0x5d6211[_0xf955('0x14')]){if(_0x5d6211[_0xf955('0x14')][_0xf955('0x15')]===0x1f4){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);return _0xf7e3e(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}logger['error'](_0xf955('0x16'),_0x421e4a,_0x5d6211['error'][_0xf955('0x17')]);return _0x4d213a(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}else{logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,'request\x20sent');_0x4d213a(_0x5d6211[_0xf955('0x18')][_0xf955('0x17')]);}})[_0xf955('0x19')](function(_0x4d7b5b){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x4d7b5b);_0xf7e3e(_0x4d7b5b);});});}exports[_0xf955('0x1a')]=function(_0x3f960e){var _0x3ae4fb=this;return new Promise(function(_0x5f4d9a,_0x17d86a){return db[_0xf955('0x1b')][_0xf955('0x1c')](_0x3f960e['body'],{'raw':_0x3f960e[_0xf955('0x1d')]?_0x3f960e['options'][_0xf955('0x1e')]===undefined?!![]:![]:!![]})[_0xf955('0xf')](function(_0x37143d){logger[_0xf955('0x10')](_0xf955('0x1a'),_0x3f960e);logger['debug'](_0xf955('0x1a'),_0x3f960e,JSON[_0xf955('0x13')](_0x37143d));_0x5f4d9a(_0x37143d);})[_0xf955('0x19')](function(_0x13a1a7){logger[_0xf955('0x14')](_0xf955('0x1a'),_0x13a1a7[_0xf955('0x17')],_0x3f960e);_0x17d86a(_0x3ae4fb['error'](0x1f4,_0x13a1a7[_0xf955('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 79cb1f9..8a1cdd2 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 _0x5bb1=['mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4722ec,_0x5a706a){var _0x301f80=function(_0x4a1d49){while(--_0x4a1d49){_0x4722ec['push'](_0x4722ec['shift']());}};_0x301f80(++_0x5a706a);}(_0x5bb1,0x1cc));var _0x15bb=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x5bb1[_0x3e44fa];return _0x2a0aba;};'use strict';var MailMessageEvents=require(_0x15bb('0x0'));var events=[_0x15bb('0x1'),_0x15bb('0x2'),_0x15bb('0x3')];function createListener(_0x200c99,_0xe24879){return function(_0x3aa39e){_0xe24879[_0x15bb('0x4')](_0x200c99,_0x3aa39e);};}function removeListener(_0x17f8e7,_0xaeb1d8){return function(){MailMessageEvents[_0x15bb('0x5')](_0x17f8e7,_0xaeb1d8);};}exports[_0x15bb('0x6')]=function(_0x2e9b58){for(var _0x3a90f3=0x0,_0xc6ac2=events[_0x15bb('0x7')];_0x3a90f3<_0xc6ac2;_0x3a90f3++){var _0x28baa6=events[_0x3a90f3];var _0x2ea99d=createListener(_0x15bb('0x8')+_0x28baa6,_0x2e9b58);MailMessageEvents['on'](_0x28baa6,_0x2ea99d);}}; \ No newline at end of file +var _0x408a=['mailMessage:','save','remove','emit','removeListener','register'];(function(_0x299af8,_0x433f59){var _0x262341=function(_0x419180){while(--_0x419180){_0x299af8['push'](_0x299af8['shift']());}};_0x262341(++_0x433f59);}(_0x408a,0x67));var _0xa408=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x408a[_0x2b4411];return _0x8e41ef;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xa408('0x0'),_0xa408('0x1'),'update'];function createListener(_0x81353e,_0x482419){return function(_0x381fc8){_0x482419[_0xa408('0x2')](_0x81353e,_0x381fc8);};}function removeListener(_0x3ed995,_0x4ab052){return function(){MailMessageEvents[_0xa408('0x3')](_0x3ed995,_0x4ab052);};}exports[_0xa408('0x4')]=function(_0x2be7d6){for(var _0x3b5303=0x0,_0x107480=events['length'];_0x3b5303<_0x107480;_0x3b5303++){var _0x592b07=events[_0x3b5303];var _0xdb3829=createListener(_0xa408('0x5')+_0x592b07,_0x2be7d6);MailMessageEvents['on'](_0x592b07,_0xdb3829);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9467153..710a043 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 _0x327b=['destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x327b,0x1d0));var _0xb327=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x327b[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xb327('0x0'));var util=require(_0xb327('0x1'));var path=require(_0xb327('0x2'));var timeout=require(_0xb327('0x3'));var express=require(_0xb327('0x4'));var router=express['Router']();var fs_extra=require(_0xb327('0x5'));var auth=require(_0xb327('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb327('0x7'));router[_0xb327('0x8')]('/',auth['isAuthenticated'](),controller[_0xb327('0x9')]);router[_0xb327('0x8')](_0xb327('0xa'),auth[_0xb327('0xb')](),controller[_0xb327('0xc')]);router[_0xb327('0x8')](_0xb327('0xd'),auth[_0xb327('0xb')](),controller[_0xb327('0xe')]);router[_0xb327('0x8')]('/:id/members',auth[_0xb327('0xb')](),controller[_0xb327('0xf')]);router[_0xb327('0x8')](_0xb327('0x10'),auth['isAuthenticated'](),controller[_0xb327('0x11')]);router[_0xb327('0x8')](_0xb327('0x12'),auth[_0xb327('0xb')](),controller[_0xb327('0x13')]);router[_0xb327('0x14')]('/',auth[_0xb327('0xb')](),controller['create']);router[_0xb327('0x14')](_0xb327('0x10'),auth[_0xb327('0xb')](),controller[_0xb327('0x15')]);router[_0xb327('0x14')](_0xb327('0x12'),auth[_0xb327('0xb')](),controller['addAgents']);router['put']('/:id',auth[_0xb327('0xb')](),controller['update']);router['delete']('/:id',auth[_0xb327('0xb')](),controller[_0xb327('0x16')]);router[_0xb327('0x17')](_0xb327('0x10'),auth[_0xb327('0xb')](),controller[_0xb327('0x18')]);router['delete']('/:id/users',auth[_0xb327('0xb')](),controller[_0xb327('0x19')]);module[_0xb327('0x1a')]=router; \ No newline at end of file +var _0x16fd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util'];(function(_0xb31440,_0x3575cf){var _0x316def=function(_0x30a2aa){while(--_0x30a2aa){_0xb31440['push'](_0xb31440['shift']());}};_0x316def(++_0x3575cf);}(_0x16fd,0x9a));var _0xd16f=function(_0x38782c,_0x5c9fef){_0x38782c=_0x38782c-0x0;var _0x3708bf=_0x16fd[_0x38782c];return _0x3708bf;};'use strict';var multer=require('multer');var util=require(_0xd16f('0x0'));var path=require(_0xd16f('0x1'));var timeout=require(_0xd16f('0x2'));var express=require(_0xd16f('0x3'));var router=express[_0xd16f('0x4')]();var fs_extra=require(_0xd16f('0x5'));var auth=require(_0xd16f('0x6'));var interaction=require(_0xd16f('0x7'));var config=require(_0xd16f('0x8'));var controller=require(_0xd16f('0x9'));router['get']('/',auth[_0xd16f('0xa')](),controller[_0xd16f('0xb')]);router[_0xd16f('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xd16f('0xd')]);router[_0xd16f('0xc')](_0xd16f('0xe'),auth['isAuthenticated'](),controller[_0xd16f('0xf')]);router[_0xd16f('0xc')]('/:id/members',auth['isAuthenticated'](),controller[_0xd16f('0x10')]);router[_0xd16f('0xc')](_0xd16f('0x11'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x12')]);router['get'](_0xd16f('0x13'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x14')]);router['post']('/',auth[_0xd16f('0xa')](),controller['create']);router[_0xd16f('0x15')](_0xd16f('0x11'),auth['isAuthenticated'](),controller[_0xd16f('0x16')]);router[_0xd16f('0x15')](_0xd16f('0x13'),auth['isAuthenticated'](),controller[_0xd16f('0x17')]);router[_0xd16f('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd16f('0x19')]);router['delete'](_0xd16f('0xe'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x1a')]);router[_0xd16f('0x1b')](_0xd16f('0x11'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x1c')]);router['delete'](_0xd16f('0x13'),auth[_0xd16f('0xa')](),controller[_0xd16f('0x1d')]);module[_0xd16f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9bb9128..9c8a940 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 _0x38aa=['rrmemory','sequelize','STRING','INTEGER','ENUM'];(function(_0x499a57,_0x4352b3){var _0x5d6d26=function(_0x3e0c00){while(--_0x3e0c00){_0x499a57['push'](_0x499a57['shift']());}};_0x5d6d26(++_0x4352b3);}(_0x38aa,0xb5));var _0xa38a=function(_0x210715,_0x13057a){_0x210715=_0x210715-0x0;var _0x32c93d=_0x38aa[_0x210715];return _0x32c93d;};'use strict';var Sequelize=require(_0xa38a('0x0'));module['exports']={'name':{'type':Sequelize[_0xa38a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa38a('0x1')]},'timeout':{'type':Sequelize[_0xa38a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa38a('0x3')](_0xa38a('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x3860=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3f68dc,_0x3ae2f8){var _0x8c9e6f=function(_0x32b1cd){while(--_0x32b1cd){_0x3f68dc['push'](_0x3f68dc['shift']());}};_0x8c9e6f(++_0x3ae2f8);}(_0x3860,0x14c));var _0x0386=function(_0x2cc164,_0x5355dc){_0x2cc164=_0x2cc164-0x0;var _0x4663f0=_0x3860[_0x2cc164];return _0x4663f0;};'use strict';var Sequelize=require(_0x0386('0x0'));module[_0x0386('0x1')]={'name':{'type':Sequelize[_0x0386('0x2')],'unique':_0x0386('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0386('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0386('0x5')](_0x0386('0x6'),_0x0386('0x7'),_0x0386('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 91c524d..960fb04 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 _0xd592=['addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','keys','include','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserMailQueue','nolimit','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','addTeams','ids','Team','findAll','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xd592,0x97));var _0x2d59=function(_0x2a8d31,_0x26b329){_0x2a8d31=_0x2a8d31-0x0;var _0x4f1f41=_0xd592[_0x2a8d31];return _0x4f1f41;};'use strict';var emlformat=require(_0x2d59('0x0'));var rimraf=require(_0x2d59('0x1'));var zipdir=require(_0x2d59('0x2'));var jsonpatch=require(_0x2d59('0x3'));var rp=require(_0x2d59('0x4'));var moment=require(_0x2d59('0x5'));var BPromise=require(_0x2d59('0x6'));var Mustache=require(_0x2d59('0x7'));var util=require(_0x2d59('0x8'));var path=require(_0x2d59('0x9'));var sox=require('sox');var csv=require(_0x2d59('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d59('0xb'));var _=require(_0x2d59('0xc'));var squel=require(_0x2d59('0xd'));var crypto=require(_0x2d59('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2d59('0xf'));var toCsv=require(_0x2d59('0xa'));var querystring=require(_0x2d59('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d59('0x11'));var as=require(_0x2d59('0x12'));var hardwareService=require(_0x2d59('0x13'));var logger=require(_0x2d59('0x14'))(_0x2d59('0x15'));var utils=require(_0x2d59('0x16'));var config=require(_0x2d59('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2d59('0x18')]=_[_0x2d59('0x19')](config['redis'],{'host':_0x2d59('0x1a'),'port':0x18eb});var socket=require(_0x2d59('0x1b'))(new Redis(config[_0x2d59('0x18')]));require(_0x2d59('0x1c'))[_0x2d59('0x1d')](socket);function respondWithStatusCode(_0x2ffe68,_0x27f2b2){_0x27f2b2=_0x27f2b2||0xcc;return function(_0x28071b){if(_0x28071b){return _0x2ffe68[_0x2d59('0x1e')](_0x27f2b2);}return _0x2ffe68[_0x2d59('0x1f')](_0x27f2b2)[_0x2d59('0x20')]();};}function respondWithResult(_0x59803b,_0x5913ba){_0x5913ba=_0x5913ba||0xc8;return function(_0x143db7){if(_0x143db7){return _0x59803b[_0x2d59('0x1f')](_0x5913ba)[_0x2d59('0x21')](_0x143db7);}};}function respondWithFilteredResult(_0x12edd4,_0xf1a37d){return function(_0x312729){if(_0x312729){var _0x52d4d6=typeof _0xf1a37d[_0x2d59('0x22')]===_0x2d59('0x23')&&typeof _0xf1a37d[_0x2d59('0x24')]===_0x2d59('0x23');var _0x5da719=_0x312729['count'];var _0x2d3c1e=_0x52d4d6?0x0:_0xf1a37d[_0x2d59('0x22')];var _0x1d1aa6=_0x52d4d6?_0x312729[_0x2d59('0x25')]:_0xf1a37d[_0x2d59('0x22')]+_0xf1a37d[_0x2d59('0x24')];var _0x489ea2;if(_0x1d1aa6>=_0x5da719){_0x1d1aa6=_0x5da719;_0x489ea2=0xc8;}else{_0x489ea2=0xce;}_0x12edd4[_0x2d59('0x1f')](_0x489ea2);return _0x12edd4[_0x2d59('0x26')]('Content-Range',_0x2d3c1e+'-'+_0x1d1aa6+'/'+_0x5da719)['json'](_0x312729);}return null;};}function patchUpdates(_0x7192c){return function(_0x3d1418){try{jsonpatch['apply'](_0x3d1418,_0x7192c,!![]);}catch(_0x2b067e){return BPromise[_0x2d59('0x27')](_0x2b067e);}return _0x3d1418[_0x2d59('0x28')]();};}function saveUpdates(_0x10e9f1,_0x2c2f61){return function(_0x2db0a7){if(_0x2db0a7){return _0x2db0a7['update'](_0x10e9f1)[_0x2d59('0x29')](function(_0x4ba63d){return _0x4ba63d;});}return null;};}function removeEntity(_0x15ad01,_0x444fd3){return function(_0x5c9f1a){if(_0x5c9f1a){return _0x5c9f1a[_0x2d59('0x2a')]()[_0x2d59('0x29')](function(){var _0x5eb14c=_0x5c9f1a['get']({'plain':!![]});var _0x3c2489=_0x2d59('0x2b');return db['UserProfileResource'][_0x2d59('0x2a')]({'where':{'type':_0x3c2489,'resourceId':_0x5eb14c['id']}})[_0x2d59('0x29')](function(){return _0x5c9f1a;});})[_0x2d59('0x29')](function(){_0x15ad01['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3ab4,_0x1ff701){return function(_0x2c7cd8){if(!_0x2c7cd8){_0x1c3ab4[_0x2d59('0x1e')](0x194);}return _0x2c7cd8;};}function handleError(_0x1cd3a2,_0x3cb332){_0x3cb332=_0x3cb332||0x1f4;return function(_0x1056e2){logger[_0x2d59('0x2c')](_0x1056e2[_0x2d59('0x2d')]);if(_0x1056e2[_0x2d59('0x2e')]){delete _0x1056e2[_0x2d59('0x2e')];}_0x1cd3a2[_0x2d59('0x1f')](_0x3cb332)[_0x2d59('0x2f')](_0x1056e2);};}exports[_0x2d59('0x30')]=function(_0x3db22d,_0x54b565){var _0x51e69f={},_0x594d6d={},_0x170d03={'count':0x0,'rows':[]};var _0x1d12cf=_[_0x2d59('0x31')](db[_0x2d59('0x32')][_0x2d59('0x33')],function(_0x121f17){return{'name':_0x121f17[_0x2d59('0x34')],'type':_0x121f17[_0x2d59('0x35')]['key']};});_0x594d6d[_0x2d59('0x36')]=_[_0x2d59('0x31')](_0x1d12cf,_0x2d59('0x2e'));_0x594d6d[_0x2d59('0x37')]=_['keys'](_0x3db22d[_0x2d59('0x37')]);_0x594d6d[_0x2d59('0x38')]=_[_0x2d59('0x39')](_0x594d6d['model'],_0x594d6d['query']);_0x51e69f[_0x2d59('0x3a')]=_[_0x2d59('0x39')](_0x594d6d['model'],qs[_0x2d59('0x3b')](_0x3db22d[_0x2d59('0x37')][_0x2d59('0x3b')]));_0x51e69f[_0x2d59('0x3a')]=_0x51e69f['attributes'][_0x2d59('0x3c')]?_0x51e69f[_0x2d59('0x3a')]:_0x594d6d[_0x2d59('0x36')];if(!_0x3db22d[_0x2d59('0x37')][_0x2d59('0x3d')]('nolimit')){_0x51e69f[_0x2d59('0x24')]=qs['limit'](_0x3db22d[_0x2d59('0x37')][_0x2d59('0x24')]);_0x51e69f[_0x2d59('0x22')]=qs[_0x2d59('0x22')](_0x3db22d['query'][_0x2d59('0x22')]);}_0x51e69f['order']=qs[_0x2d59('0x3e')](_0x3db22d[_0x2d59('0x37')][_0x2d59('0x3e')]);_0x51e69f[_0x2d59('0x3f')]=qs[_0x2d59('0x38')](_['pick'](_0x3db22d[_0x2d59('0x37')],_0x594d6d['filters']),_0x1d12cf);if(_0x3db22d[_0x2d59('0x37')][_0x2d59('0x40')]){_0x51e69f[_0x2d59('0x3f')]=_[_0x2d59('0x41')](_0x51e69f[_0x2d59('0x3f')],{'$or':_['map'](_0x1d12cf,function(_0x5668ec){if(_0x5668ec[_0x2d59('0x35')]!==_0x2d59('0x42')){var _0x31ec3e={};_0x31ec3e[_0x5668ec[_0x2d59('0x2e')]]={'$like':'%'+_0x3db22d[_0x2d59('0x37')][_0x2d59('0x40')]+'%'};return _0x31ec3e;}})});}_0x51e69f=_[_0x2d59('0x41')]({},_0x51e69f,_0x3db22d[_0x2d59('0x43')]);var _0x481c49={'where':_0x51e69f[_0x2d59('0x3f')]};return db[_0x2d59('0x32')][_0x2d59('0x25')](_0x481c49)[_0x2d59('0x29')](function(_0x5f1a0e){_0x170d03[_0x2d59('0x25')]=_0x5f1a0e;if(_0x3db22d[_0x2d59('0x37')][_0x2d59('0x44')]){_0x51e69f['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x51e69f);})[_0x2d59('0x29')](function(_0x25f4f6){_0x170d03['rows']=_0x25f4f6;return _0x170d03;})['then'](respondWithFilteredResult(_0x54b565,_0x51e69f))[_0x2d59('0x45')](handleError(_0x54b565,null));};exports[_0x2d59('0x46')]=function(_0x51ebcd,_0x56791a){var _0x2a0891={'raw':!![],'where':{'id':_0x51ebcd['params']['id']}},_0x1059e5={};_0x1059e5[_0x2d59('0x36')]=_[_0x2d59('0x47')](db[_0x2d59('0x32')][_0x2d59('0x33')]);_0x1059e5[_0x2d59('0x37')]=_[_0x2d59('0x47')](_0x51ebcd['query']);_0x1059e5[_0x2d59('0x38')]=_[_0x2d59('0x39')](_0x1059e5[_0x2d59('0x36')],_0x1059e5[_0x2d59('0x37')]);_0x2a0891[_0x2d59('0x3a')]=_[_0x2d59('0x39')](_0x1059e5[_0x2d59('0x36')],qs[_0x2d59('0x3b')](_0x51ebcd[_0x2d59('0x37')][_0x2d59('0x3b')]));_0x2a0891['attributes']=_0x2a0891[_0x2d59('0x3a')][_0x2d59('0x3c')]?_0x2a0891[_0x2d59('0x3a')]:_0x1059e5[_0x2d59('0x36')];if(_0x51ebcd[_0x2d59('0x37')][_0x2d59('0x44')]){_0x2a0891[_0x2d59('0x48')]=[{'all':!![]}];}_0x2a0891=_[_0x2d59('0x41')]({},_0x2a0891,_0x51ebcd[_0x2d59('0x43')]);return db[_0x2d59('0x32')][_0x2d59('0x49')](_0x2a0891)[_0x2d59('0x29')](handleEntityNotFound(_0x56791a,null))[_0x2d59('0x29')](respondWithResult(_0x56791a,null))['catch'](handleError(_0x56791a,null));};exports['create']=function(_0x2f4aa6,_0x5b9894){return db[_0x2d59('0x32')]['create'](_0x2f4aa6['body'],{})['then'](function(_0x2ae78d){var _0x3f55f9=_0x2f4aa6[_0x2d59('0x4a')][_0x2d59('0x4b')]({'plain':!![]});if(!_0x3f55f9)throw new Error(_0x2d59('0x4c'));if(_0x3f55f9[_0x2d59('0x4d')]==='user'){var _0x523198=_0x2ae78d['get']({'plain':!![]});var _0x270b34=_0x2d59('0x2b');return db[_0x2d59('0x4e')][_0x2d59('0x49')]({'where':{'name':_0x270b34,'userProfileId':_0x3f55f9[_0x2d59('0x4f')]},'raw':!![]})[_0x2d59('0x29')](function(_0x5cf66d){if(_0x5cf66d&&_0x5cf66d[_0x2d59('0x50')]===0x0){return db['UserProfileResource'][_0x2d59('0x51')]({'name':_0x523198[_0x2d59('0x2e')],'resourceId':_0x523198['id'],'type':_0x5cf66d['name'],'sectionId':_0x5cf66d['id']},{})[_0x2d59('0x29')](function(){return _0x2ae78d;});}else{return _0x2ae78d;}})[_0x2d59('0x45')](function(_0x446c99){logger[_0x2d59('0x2c')](_0x2d59('0x52'),_0x446c99);throw _0x446c99;});}return _0x2ae78d;})['then'](respondWithResult(_0x5b9894,0xc9))[_0x2d59('0x45')](handleError(_0x5b9894,null));};exports[_0x2d59('0x53')]=function(_0x178d65,_0x160d7a){if(_0x178d65[_0x2d59('0x54')]['id']){delete _0x178d65[_0x2d59('0x54')]['id'];}return db[_0x2d59('0x32')][_0x2d59('0x49')]({'where':{'id':_0x178d65[_0x2d59('0x55')]['id']}})[_0x2d59('0x29')](handleEntityNotFound(_0x160d7a,null))[_0x2d59('0x29')](saveUpdates(_0x178d65[_0x2d59('0x54')],null))[_0x2d59('0x29')](respondWithResult(_0x160d7a,null))['catch'](handleError(_0x160d7a,null));};exports[_0x2d59('0x2a')]=function(_0x27951a,_0x1e8d99){return db[_0x2d59('0x32')][_0x2d59('0x49')]({'where':{'id':_0x27951a['params']['id']}})[_0x2d59('0x29')](handleEntityNotFound(_0x1e8d99,null))[_0x2d59('0x29')](removeEntity(_0x1e8d99,null))['catch'](handleError(_0x1e8d99,null));};exports[_0x2d59('0x56')]=function(_0x106336,_0x4e6f8b){return db[_0x2d59('0x32')][_0x2d59('0x56')]()[_0x2d59('0x29')](respondWithResult(_0x4e6f8b,null))[_0x2d59('0x45')](handleError(_0x4e6f8b,null));};exports[_0x2d59('0x57')]=function(_0x482e86,_0x3361be,_0x4a855f){var _0x5ff307={'raw':!![],'where':{}},_0x2ce817={},_0x6aabf2;return db[_0x2d59('0x32')][_0x2d59('0x58')]({'where':{'id':_0x482e86[_0x2d59('0x55')]['id']}})[_0x2d59('0x29')](handleEntityNotFound(_0x3361be,null))[_0x2d59('0x29')](function(_0x57af11){if(_0x57af11){_0x6aabf2=_0x57af11['get']({'plain':!![]});_0x2ce817[_0x2d59('0x36')]=_[_0x2d59('0x47')](db[_0x2d59('0x59')][_0x2d59('0x33')]);_0x2ce817[_0x2d59('0x37')]=_[_0x2d59('0x47')](_0x482e86[_0x2d59('0x37')]);_0x2ce817[_0x2d59('0x38')]=_['intersection'](_0x2ce817[_0x2d59('0x36')],_0x2ce817[_0x2d59('0x37')]);_0x5ff307[_0x2d59('0x3a')]=_[_0x2d59('0x39')](_0x2ce817[_0x2d59('0x36')],qs[_0x2d59('0x3b')](_0x482e86[_0x2d59('0x37')][_0x2d59('0x3b')]));_0x5ff307[_0x2d59('0x3a')]=_0x5ff307[_0x2d59('0x3a')][_0x2d59('0x3c')]?_0x5ff307[_0x2d59('0x3a')]:_0x2ce817[_0x2d59('0x36')];if(!_0x482e86[_0x2d59('0x37')][_0x2d59('0x3d')](_0x2d59('0x5a'))){_0x5ff307[_0x2d59('0x24')]=qs[_0x2d59('0x24')](_0x482e86['query'][_0x2d59('0x24')]);_0x5ff307[_0x2d59('0x22')]=qs[_0x2d59('0x22')](_0x482e86['query'][_0x2d59('0x22')]);}_0x5ff307[_0x2d59('0x5b')]=qs['sort'](_0x482e86[_0x2d59('0x37')][_0x2d59('0x3e')]);_0x5ff307['where']=qs[_0x2d59('0x38')](_[_0x2d59('0x5c')](_0x482e86[_0x2d59('0x37')],_0x2ce817[_0x2d59('0x38')]));_0x5ff307[_0x2d59('0x3f')][_0x2d59('0x5d')]=_0x57af11['id'];if(_0x482e86[_0x2d59('0x37')][_0x2d59('0x40')]){_0x5ff307[_0x2d59('0x3f')]=_[_0x2d59('0x41')](_0x5ff307['where'],{'$or':_[_0x2d59('0x31')](_0x5ff307[_0x2d59('0x3a')],function(_0x5abaf9){var _0x5aa226={};_0x5aa226[_0x5abaf9]={'$like':'%'+_0x482e86[_0x2d59('0x37')]['filter']+'%'};return _0x5aa226;})});}_0x5ff307=_['merge']({},_0x5ff307,_0x482e86[_0x2d59('0x43')]);return db[_0x2d59('0x59')]['findAll'](_0x5ff307);}})['then'](function(_0x358f0d){if(_0x358f0d){return db[_0x2d59('0x5e')][_0x2d59('0x5f')]({'where':{'id':_['map'](_0x358f0d,_0x2d59('0x60')),'role':_0x2d59('0x61')},'attributes':['id','name',_0x2d59('0x62'),_0x2d59('0x63'),_0x2d59('0x64')]});}})['then'](function(_0x60ab77){if(_0x60ab77){return{'count':_0x60ab77[_0x2d59('0x25')],'rows':_[_0x2d59('0x31')](_0x60ab77[_0x2d59('0x65')],function(_0x45cb05){return{'membername':_0x45cb05['name'],'UserId':_0x45cb05['id'],'queue_name':_0x6aabf2['name'],'MailQueueId':_0x6aabf2['id'],'interface':util[_0x2d59('0x66')](_0x2d59('0x67'),'SIP',_0x45cb05[_0x2d59('0x2e')]),'penalty':0x0,'paused':_0x45cb05['mailPause'],'createdAt':_0x45cb05[_0x2d59('0x64')],'updatedAt':_0x45cb05[_0x2d59('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2d59('0x29')](respondWithFilteredResult(_0x3361be,_0x5ff307))['catch'](handleError(_0x3361be,null));};exports['getTeams']=function(_0x10b69f,_0x2694ea,_0x349996){var _0x38e5fe={};var _0x3e97b0={};var _0x49b353;var _0x277100;return db[_0x2d59('0x32')][_0x2d59('0x58')]({'where':{'id':_0x10b69f[_0x2d59('0x55')]['id']}})[_0x2d59('0x29')](handleEntityNotFound(_0x2694ea,null))['then'](function(_0x1a1cb0){if(_0x1a1cb0){_0x49b353=_0x1a1cb0;_0x3e97b0['model']=_[_0x2d59('0x47')](db['Team'][_0x2d59('0x33')]);_0x3e97b0[_0x2d59('0x37')]=_[_0x2d59('0x47')](_0x10b69f['query']);_0x3e97b0[_0x2d59('0x38')]=_[_0x2d59('0x39')](_0x3e97b0[_0x2d59('0x36')],_0x3e97b0[_0x2d59('0x37')]);_0x38e5fe[_0x2d59('0x3a')]=_[_0x2d59('0x39')](_0x3e97b0[_0x2d59('0x36')],qs[_0x2d59('0x3b')](_0x10b69f[_0x2d59('0x37')]['fields']));_0x38e5fe[_0x2d59('0x3a')]=_0x38e5fe[_0x2d59('0x3a')][_0x2d59('0x3c')]?_0x38e5fe[_0x2d59('0x3a')]:_0x3e97b0['model'];_0x38e5fe[_0x2d59('0x5b')]=qs[_0x2d59('0x3e')](_0x10b69f['query'][_0x2d59('0x3e')]);_0x38e5fe['where']=qs[_0x2d59('0x38')](_[_0x2d59('0x5c')](_0x10b69f[_0x2d59('0x37')],_0x3e97b0[_0x2d59('0x38')]));if(_0x10b69f[_0x2d59('0x37')]['filter']){_0x38e5fe[_0x2d59('0x3f')]=_[_0x2d59('0x41')](_0x38e5fe[_0x2d59('0x3f')],{'$or':_['map'](_0x38e5fe[_0x2d59('0x3a')],function(_0x1413a1){var _0x5e68d7={};_0x5e68d7[_0x1413a1]={'$like':'%'+_0x10b69f[_0x2d59('0x37')]['filter']+'%'};return _0x5e68d7;})});}_0x38e5fe=_[_0x2d59('0x41')]({},_0x38e5fe,_0x10b69f[_0x2d59('0x43')]);return _0x49b353[_0x2d59('0x68')](_0x38e5fe);}})[_0x2d59('0x29')](function(_0x2e70b1){if(_0x2e70b1){_0x277100=_0x2e70b1[_0x2d59('0x3c')];if(!_0x10b69f[_0x2d59('0x37')][_0x2d59('0x3d')]('nolimit')){_0x38e5fe[_0x2d59('0x24')]=qs[_0x2d59('0x24')](_0x10b69f[_0x2d59('0x37')][_0x2d59('0x24')]);_0x38e5fe[_0x2d59('0x22')]=qs['offset'](_0x10b69f['query']['offset']);}return _0x49b353[_0x2d59('0x68')](_0x38e5fe);}})[_0x2d59('0x29')](function(_0x51e00e){if(_0x51e00e){return _0x51e00e?{'count':_0x277100,'rows':_0x51e00e}:null;}})[_0x2d59('0x29')](respondWithResult(_0x2694ea,null))[_0x2d59('0x45')](handleError(_0x2694ea,null));};exports[_0x2d59('0x69')]=function(_0x303286,_0x510399,_0x44144d){var _0x319e25=_0x303286[_0x2d59('0x54')][_0x2d59('0x6a')];return db[_0x2d59('0x6b')][_0x2d59('0x6c')]({'where':{'id':_0x319e25},'attributes':['id'],'include':[{'model':db[_0x2d59('0x5e')],'as':'Agents','attributes':['id',_0x2d59('0x2e'),'online','voicePause','interface'],'raw':!![]}]})[_0x2d59('0x29')](function(_0x47c6fe){if(_0x47c6fe){var _0x381be4=_[_0x2d59('0x6d')](_0x47c6fe,function(_0x3c8d0d){var _0x2d3fc9=_0x3c8d0d[_0x2d59('0x4b')]({'plain':!![]});return _0x2d3fc9[_0x2d59('0x6e')];});return db[_0x2d59('0x32')]['find']({'where':{'id':_0x303286[_0x2d59('0x55')]['id']}})[_0x2d59('0x29')](function(_0x3d4825){return db[_0x2d59('0x6f')][_0x2d59('0x70')](function(_0x59d099){return _0x3d4825['addTeams'](_0x319e25,{'transaction':_0x59d099})[_0x2d59('0x29')](function(){return BPromise[_0x2d59('0x71')](_0x381be4,function(_0x14debd){return db['UserMailQueue'][_0x2d59('0x72')]({'where':{'UserId':_0x14debd['id'],'MailQueueId':_0x303286[_0x2d59('0x55')]['id']},'transaction':_0x59d099});});})[_0x2d59('0x29')](function(){_0x381be4[_0x2d59('0x73')](function(_0x3bc45f){socket['emit'](_0x2d59('0x74'),{'UserId':_0x3bc45f['id'],'MailQueueId':_0x3d4825['id']});});});});});}})[_0x2d59('0x29')](respondWithStatusCode(_0x510399,null))[_0x2d59('0x45')](handleError(_0x510399,null));};exports[_0x2d59('0x75')]=function(_0x4b0abb,_0x499733,_0x5c8745){return db[_0x2d59('0x6b')][_0x2d59('0x6c')]({'where':{'id':_0x4b0abb['query'][_0x2d59('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x2d59('0x5e')],'as':_0x2d59('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x499733,null))[_0x2d59('0x29')](function(_0x1d4cdb){var _0x2fb46c=_[_0x2d59('0x31')](_0x1d4cdb,'id');var _0x211f63=[];var _0x12344d=[];var _0x1a1fd1=squel[_0x2d59('0x76')]();_0x1a1fd1['field']('tq.TeamId')[_0x2d59('0x77')](_0x2d59('0x78'),'tq')[_0x2d59('0x79')](_0x2d59('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2d59('0x3f')](_0x2d59('0x7b'),_0x4b0abb[_0x2d59('0x55')]['id']);for(var _0x362754=0x0;_0x362754<_0x1d4cdb['length'];_0x362754+=0x1){let _0x41b92d=_0x1d4cdb[_0x362754];for(var _0x4a4024=0x0;_0x4a4024<_0x41b92d['Agents'][_0x2d59('0x3c')];_0x4a4024+=0x1){let _0xb80d9=_0x41b92d[_0x2d59('0x6e')][_0x4a4024];var _0x57dcc4=_0x1a1fd1[_0x2d59('0x7c')]();_0x57dcc4[_0x2d59('0x3f')](_0x2d59('0x7d'),_0xb80d9['id']);_0x12344d[_0x2d59('0x7e')](db[_0x2d59('0x6f')]['query'](_0x57dcc4[_0x2d59('0x7f')](),{'type':db[_0x2d59('0x6f')][_0x2d59('0x80')][_0x2d59('0x81')]})[_0x2d59('0x29')](function(_0x4bfce9){if(_0x4bfce9[_0x2d59('0x3c')]===0x1){return _0xb80d9['id'];}else{var _0x536c27=_[_0x2d59('0x82')](_[_0x2d59('0x31')](_0x4bfce9,_0x2d59('0x83')),function(_0x54c751){return _[_0x2d59('0x84')](_0x2fb46c,_0x54c751);});if(_0x536c27){return _0xb80d9['id'];}}}));}}return BPromise[_0x2d59('0x85')](_0x12344d)['then'](function(_0x4519eb){_0x211f63=_(_0x211f63)[_0x2d59('0x86')](_0x4519eb)[_0x2d59('0x87')]()['value']();return db[_0x2d59('0x32')]['find']({'where':{'id':_0x4b0abb['params']['id']}})[_0x2d59('0x29')](function(_0x104e53){return db[_0x2d59('0x6f')]['transaction'](function(_0x2b15e9){return _0x104e53[_0x2d59('0x75')](_0x4b0abb[_0x2d59('0x37')]['ids'],{'transaction':_0x2b15e9})[_0x2d59('0x29')](function(){if(!_[_0x2d59('0x88')](_0x211f63)){return _0x104e53[_0x2d59('0x89')](_0x211f63,{'transaction':_0x2b15e9});}})[_0x2d59('0x29')](function(){_0x211f63[_0x2d59('0x73')](function(_0x1a2707){socket[_0x2d59('0x8a')]('userMailQueue:remove',{'UserId':_0x1a2707,'MailQueueId':_0x104e53['id']});});});});});});})['then'](respondWithStatusCode(_0x499733,null))[_0x2d59('0x45')](handleError(_0x499733,null));};exports[_0x2d59('0x8b')]=function(_0x40b400,_0xffcbdf,_0x5c36a5){return db[_0x2d59('0x32')][_0x2d59('0x49')]({'where':{'id':_0x40b400['params']['id']}})[_0x2d59('0x29')](handleEntityNotFound(_0xffcbdf,null))[_0x2d59('0x29')](function(_0x8f31d9){if(_0x8f31d9){return _0x8f31d9[_0x2d59('0x8b')](_0x40b400[_0x2d59('0x54')][_0x2d59('0x6a')],_[_0x2d59('0x8c')](_0x40b400[_0x2d59('0x54')],['ids','id'])||{})[_0x2d59('0x8d')](function(_0x1ac3e6){for(var _0x31b06e=0x0;_0x31b06e<_0x40b400[_0x2d59('0x54')][_0x2d59('0x6a')][_0x2d59('0x3c')];_0x31b06e+=0x1){socket[_0x2d59('0x8a')](_0x2d59('0x74'),{'UserId':Number(_0x40b400['body'][_0x2d59('0x6a')][_0x31b06e]),'MailQueueId':Number(_0x40b400['params']['id'])});}return _0x1ac3e6;});}})[_0x2d59('0x29')](respondWithResult(_0xffcbdf,null))[_0x2d59('0x45')](handleError(_0xffcbdf,null));};exports[_0x2d59('0x89')]=function(_0x3c69c8,_0x20eb73,_0x5aa81f){return db[_0x2d59('0x32')]['find']({'where':{'id':_0x3c69c8[_0x2d59('0x55')]['id']}})[_0x2d59('0x29')](handleEntityNotFound(_0x20eb73,null))[_0x2d59('0x29')](function(_0x1f6930){if(_0x1f6930){return _0x1f6930[_0x2d59('0x89')](_0x3c69c8['query']['ids'])[_0x2d59('0x29')](function(){if(_[_0x2d59('0x8e')](_0x3c69c8[_0x2d59('0x37')][_0x2d59('0x6a')])){for(var _0x4132d4=0x0;_0x4132d4<_0x3c69c8['query'][_0x2d59('0x6a')][_0x2d59('0x3c')];_0x4132d4+=0x1){socket[_0x2d59('0x8a')](_0x2d59('0x8f'),{'UserId':Number(_0x3c69c8[_0x2d59('0x37')][_0x2d59('0x6a')][_0x4132d4]),'MailQueueId':Number(_0x3c69c8[_0x2d59('0x55')]['id'])});}}else{socket[_0x2d59('0x8a')](_0x2d59('0x8f'),{'UserId':Number(_0x3c69c8[_0x2d59('0x37')]['ids']),'MailQueueId':Number(_0x3c69c8[_0x2d59('0x55')]['id'])});}});}})[_0x2d59('0x29')](respondWithStatusCode(_0x20eb73,null))[_0x2d59('0x45')](handleError(_0x20eb73,null));};exports[_0x2d59('0x90')]=function(_0x51d1c2,_0x19157f,_0x3f4503){var _0x2b2374={};var _0x1a53ec={};var _0x2bae9f;var _0x10e60e;return db['MailQueue'][_0x2d59('0x58')]({'where':{'id':_0x51d1c2[_0x2d59('0x55')]['id']}})['then'](handleEntityNotFound(_0x19157f,null))[_0x2d59('0x29')](function(_0x23afdb){if(_0x23afdb){_0x2bae9f=_0x23afdb;_0x1a53ec[_0x2d59('0x36')]=_[_0x2d59('0x47')](db[_0x2d59('0x5e')][_0x2d59('0x33')]);_0x1a53ec['query']=_[_0x2d59('0x47')](_0x51d1c2[_0x2d59('0x37')]);_0x1a53ec[_0x2d59('0x38')]=_['intersection'](_0x1a53ec['model'],_0x1a53ec['query']);_0x2b2374[_0x2d59('0x3a')]=_[_0x2d59('0x39')](_0x1a53ec[_0x2d59('0x36')],qs[_0x2d59('0x3b')](_0x51d1c2[_0x2d59('0x37')]['fields']));_0x2b2374['attributes']=_0x2b2374[_0x2d59('0x3a')][_0x2d59('0x3c')]?_0x2b2374[_0x2d59('0x3a')]:_0x1a53ec[_0x2d59('0x36')];_0x2b2374['order']=qs[_0x2d59('0x3e')](_0x51d1c2[_0x2d59('0x37')]['sort']);_0x2b2374[_0x2d59('0x3f')]=qs[_0x2d59('0x38')](_[_0x2d59('0x5c')](_0x51d1c2[_0x2d59('0x37')],_0x1a53ec[_0x2d59('0x38')]));if(_0x51d1c2[_0x2d59('0x37')][_0x2d59('0x40')]){_0x2b2374['where']=_[_0x2d59('0x41')](_0x2b2374[_0x2d59('0x3f')],{'$or':_[_0x2d59('0x31')](_0x2b2374[_0x2d59('0x3a')],function(_0x4d16ee){var _0x58cc70={};_0x58cc70[_0x4d16ee]={'$like':'%'+_0x51d1c2[_0x2d59('0x37')][_0x2d59('0x40')]+'%'};return _0x58cc70;})});}_0x2b2374=_[_0x2d59('0x41')]({},_0x2b2374,_0x51d1c2[_0x2d59('0x43')]);return _0x2bae9f[_0x2d59('0x90')](_0x2b2374);}})[_0x2d59('0x29')](function(_0x2da49d){if(_0x2da49d){_0x10e60e=_0x2da49d[_0x2d59('0x3c')];if(!_0x51d1c2['query']['hasOwnProperty'](_0x2d59('0x5a'))){_0x2b2374[_0x2d59('0x24')]=qs[_0x2d59('0x24')](_0x51d1c2[_0x2d59('0x37')][_0x2d59('0x24')]);_0x2b2374['offset']=qs['offset'](_0x51d1c2['query'][_0x2d59('0x22')]);}return _0x2bae9f[_0x2d59('0x90')](_0x2b2374);}})[_0x2d59('0x29')](function(_0x282915){if(_0x282915){return _0x282915?{'count':_0x10e60e,'rows':_0x282915}:null;}})['then'](respondWithResult(_0x19157f,null))[_0x2d59('0x45')](handleError(_0x19157f,null));}; \ No newline at end of file +var _0xd3d1=['get','MailQueues','stack','name','index','map','MailQueue','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','keys','rawAttributes','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','params','describe','getMembers','findOne','nolimit','order','UserMailQueue','User','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','emit','userMailQueue:save','removeTeams','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userMailQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./mailQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xd3d1[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x1d3d('0x0'));var rimraf=require(_0x1d3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d3d('0x2'));var moment=require(_0x1d3d('0x3'));var BPromise=require(_0x1d3d('0x4'));var Mustache=require(_0x1d3d('0x5'));var util=require(_0x1d3d('0x6'));var path=require(_0x1d3d('0x7'));var sox=require(_0x1d3d('0x8'));var csv=require(_0x1d3d('0x9'));var ejs=require(_0x1d3d('0xa'));var fs=require('fs');var fs_extra=require(_0x1d3d('0xb'));var _=require(_0x1d3d('0xc'));var squel=require(_0x1d3d('0xd'));var crypto=require(_0x1d3d('0xe'));var jsforce=require(_0x1d3d('0xf'));var deskjs=require(_0x1d3d('0x10'));var toCsv=require(_0x1d3d('0x9'));var querystring=require(_0x1d3d('0x11'));var Papa=require('papaparse');var Redis=require(_0x1d3d('0x12'));var authService=require(_0x1d3d('0x13'));var qs=require(_0x1d3d('0x14'));var as=require(_0x1d3d('0x15'));var hardwareService=require(_0x1d3d('0x16'));var logger=require(_0x1d3d('0x17'))(_0x1d3d('0x18'));var utils=require(_0x1d3d('0x19'));var config=require(_0x1d3d('0x1a'));var licenseUtil=require(_0x1d3d('0x1b'));var db=require(_0x1d3d('0x1c'))['db'];config['redis']=_[_0x1d3d('0x1d')](config[_0x1d3d('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d3d('0x1e')]));require(_0x1d3d('0x1f'))[_0x1d3d('0x20')](socket);function respondWithStatusCode(_0x59b907,_0x4098a9){_0x4098a9=_0x4098a9||0xcc;return function(_0x4dcc22){if(_0x4dcc22){return _0x59b907[_0x1d3d('0x21')](_0x4098a9);}return _0x59b907[_0x1d3d('0x22')](_0x4098a9)[_0x1d3d('0x23')]();};}function respondWithResult(_0x24bb8c,_0x21c2e4){_0x21c2e4=_0x21c2e4||0xc8;return function(_0x1bdbdc){if(_0x1bdbdc){return _0x24bb8c[_0x1d3d('0x22')](_0x21c2e4)['json'](_0x1bdbdc);}};}function respondWithFilteredResult(_0x5d3ac9,_0x316ab4){return function(_0xe0a583){if(_0xe0a583){var _0x50bab4=typeof _0x316ab4[_0x1d3d('0x24')]==='undefined'&&typeof _0x316ab4[_0x1d3d('0x25')]===_0x1d3d('0x26');var _0x2cd430=_0xe0a583[_0x1d3d('0x27')];var _0x5a6772=_0x50bab4?0x0:_0x316ab4[_0x1d3d('0x24')];var _0x56db7a=_0x50bab4?_0xe0a583['count']:_0x316ab4[_0x1d3d('0x24')]+_0x316ab4[_0x1d3d('0x25')];var _0x43b14b;if(_0x56db7a>=_0x2cd430){_0x56db7a=_0x2cd430;_0x43b14b=0xc8;}else{_0x43b14b=0xce;}_0x5d3ac9[_0x1d3d('0x22')](_0x43b14b);return _0x5d3ac9[_0x1d3d('0x28')](_0x1d3d('0x29'),_0x5a6772+'-'+_0x56db7a+'/'+_0x2cd430)[_0x1d3d('0x2a')](_0xe0a583);}return null;};}function patchUpdates(_0xa55c43){return function(_0x270b90){try{jsonpatch[_0x1d3d('0x2b')](_0x270b90,_0xa55c43,!![]);}catch(_0x1610a6){return BPromise['reject'](_0x1610a6);}return _0x270b90[_0x1d3d('0x2c')]();};}function saveUpdates(_0x72868d,_0x4a48c5){return function(_0x3639f1){if(_0x3639f1){return _0x3639f1['update'](_0x72868d)[_0x1d3d('0x2d')](function(_0x20ae6d){return _0x20ae6d;});}return null;};}function removeEntity(_0x2bd023,_0x4235fd){return function(_0x44e03e){if(_0x44e03e){return _0x44e03e[_0x1d3d('0x2e')]()[_0x1d3d('0x2d')](function(){var _0x298fd3=_0x44e03e[_0x1d3d('0x2f')]({'plain':!![]});var _0x2df7b7=_0x1d3d('0x30');return db['UserProfileResource'][_0x1d3d('0x2e')]({'where':{'type':_0x2df7b7,'resourceId':_0x298fd3['id']}})['then'](function(){return _0x44e03e;});})[_0x1d3d('0x2d')](function(){_0x2bd023[_0x1d3d('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x185913,_0x16b7b3){return function(_0x3cb011){if(!_0x3cb011){_0x185913[_0x1d3d('0x21')](0x194);}return _0x3cb011;};}function handleError(_0x4abbfc,_0x2d46c2){_0x2d46c2=_0x2d46c2||0x1f4;return function(_0x235ef3){logger['error'](_0x235ef3[_0x1d3d('0x31')]);if(_0x235ef3['name']){delete _0x235ef3[_0x1d3d('0x32')];}_0x4abbfc[_0x1d3d('0x22')](_0x2d46c2)['send'](_0x235ef3);};}exports[_0x1d3d('0x33')]=function(_0x192f60,_0x102b70){var _0x250b03={},_0x3a4c01={},_0x462628={'count':0x0,'rows':[]};var _0x4fc03a=_[_0x1d3d('0x34')](db[_0x1d3d('0x35')]['rawAttributes'],function(_0x2146c3){return{'name':_0x2146c3[_0x1d3d('0x36')],'type':_0x2146c3[_0x1d3d('0x37')][_0x1d3d('0x38')]};});_0x3a4c01['model']=_['map'](_0x4fc03a,_0x1d3d('0x32'));_0x3a4c01[_0x1d3d('0x39')]=_['keys'](_0x192f60[_0x1d3d('0x39')]);_0x3a4c01[_0x1d3d('0x3a')]=_[_0x1d3d('0x3b')](_0x3a4c01[_0x1d3d('0x3c')],_0x3a4c01['query']);_0x250b03['attributes']=_[_0x1d3d('0x3b')](_0x3a4c01['model'],qs[_0x1d3d('0x3d')](_0x192f60[_0x1d3d('0x39')][_0x1d3d('0x3d')]));_0x250b03[_0x1d3d('0x3e')]=_0x250b03[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x250b03[_0x1d3d('0x3e')]:_0x3a4c01[_0x1d3d('0x3c')];if(!_0x192f60['query'][_0x1d3d('0x40')]('nolimit')){_0x250b03[_0x1d3d('0x25')]=qs[_0x1d3d('0x25')](_0x192f60['query'][_0x1d3d('0x25')]);_0x250b03[_0x1d3d('0x24')]=qs[_0x1d3d('0x24')](_0x192f60[_0x1d3d('0x39')]['offset']);}_0x250b03['order']=qs[_0x1d3d('0x41')](_0x192f60['query'][_0x1d3d('0x41')]);_0x250b03[_0x1d3d('0x42')]=qs['filters'](_[_0x1d3d('0x43')](_0x192f60[_0x1d3d('0x39')],_0x3a4c01['filters']),_0x4fc03a);if(_0x192f60[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x250b03[_0x1d3d('0x42')]=_[_0x1d3d('0x45')](_0x250b03[_0x1d3d('0x42')],{'$or':_[_0x1d3d('0x34')](_0x4fc03a,function(_0x502507){if(_0x502507[_0x1d3d('0x37')]!==_0x1d3d('0x46')){var _0x1c9e17={};_0x1c9e17[_0x502507[_0x1d3d('0x32')]]={'$like':'%'+_0x192f60[_0x1d3d('0x39')]['filter']+'%'};return _0x1c9e17;}})});}_0x250b03=_[_0x1d3d('0x45')]({},_0x250b03,_0x192f60[_0x1d3d('0x47')]);var _0x1c0cc6={'where':_0x250b03[_0x1d3d('0x42')]};return db['MailQueue'][_0x1d3d('0x27')](_0x1c0cc6)[_0x1d3d('0x2d')](function(_0x1597fa){_0x462628[_0x1d3d('0x27')]=_0x1597fa;if(_0x192f60[_0x1d3d('0x39')]['includeAll']){_0x250b03['include']=[{'all':!![]}];}return db[_0x1d3d('0x35')][_0x1d3d('0x48')](_0x250b03);})[_0x1d3d('0x2d')](function(_0x66efd){_0x462628[_0x1d3d('0x49')]=_0x66efd;return _0x462628;})['then'](respondWithFilteredResult(_0x102b70,_0x250b03))[_0x1d3d('0x4a')](handleError(_0x102b70,null));};exports['show']=function(_0x26c6fd,_0x13bb96){var _0x84ebb4={'raw':!![],'where':{'id':_0x26c6fd['params']['id']}},_0x1f267b={};_0x1f267b[_0x1d3d('0x3c')]=_[_0x1d3d('0x4b')](db[_0x1d3d('0x35')][_0x1d3d('0x4c')]);_0x1f267b[_0x1d3d('0x39')]=_[_0x1d3d('0x4b')](_0x26c6fd[_0x1d3d('0x39')]);_0x1f267b['filters']=_[_0x1d3d('0x3b')](_0x1f267b['model'],_0x1f267b[_0x1d3d('0x39')]);_0x84ebb4[_0x1d3d('0x3e')]=_['intersection'](_0x1f267b[_0x1d3d('0x3c')],qs['fields'](_0x26c6fd[_0x1d3d('0x39')]['fields']));_0x84ebb4[_0x1d3d('0x3e')]=_0x84ebb4[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x84ebb4[_0x1d3d('0x3e')]:_0x1f267b[_0x1d3d('0x3c')];if(_0x26c6fd[_0x1d3d('0x39')][_0x1d3d('0x4d')]){_0x84ebb4[_0x1d3d('0x4e')]=[{'all':!![]}];}_0x84ebb4=_['merge']({},_0x84ebb4,_0x26c6fd['options']);return db['MailQueue'][_0x1d3d('0x4f')](_0x84ebb4)[_0x1d3d('0x2d')](handleEntityNotFound(_0x13bb96,null))[_0x1d3d('0x2d')](respondWithResult(_0x13bb96,null))[_0x1d3d('0x4a')](handleError(_0x13bb96,null));};exports[_0x1d3d('0x50')]=function(_0x3e5636,_0x47beed){return db['MailQueue']['create'](_0x3e5636['body'],{})[_0x1d3d('0x2d')](function(_0x21620d){var _0x89a16a=_0x3e5636[_0x1d3d('0x51')][_0x1d3d('0x2f')]({'plain':!![]});if(!_0x89a16a)throw new Error(_0x1d3d('0x52'));if(_0x89a16a[_0x1d3d('0x53')]===_0x1d3d('0x51')){var _0x3792ab=_0x21620d[_0x1d3d('0x2f')]({'plain':!![]});var _0xefc84c=_0x1d3d('0x30');return db[_0x1d3d('0x54')][_0x1d3d('0x4f')]({'where':{'name':_0xefc84c,'userProfileId':_0x89a16a[_0x1d3d('0x55')]},'raw':!![]})['then'](function(_0x465e97){if(_0x465e97&&_0x465e97[_0x1d3d('0x56')]===0x0){return db[_0x1d3d('0x57')][_0x1d3d('0x50')]({'name':_0x3792ab['name'],'resourceId':_0x3792ab['id'],'type':_0x465e97[_0x1d3d('0x32')],'sectionId':_0x465e97['id']},{})['then'](function(){return _0x21620d;});}else{return _0x21620d;}})['catch'](function(_0x27b3d9){logger[_0x1d3d('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27b3d9);throw _0x27b3d9;});}return _0x21620d;})[_0x1d3d('0x2d')](respondWithResult(_0x47beed,0xc9))[_0x1d3d('0x4a')](handleError(_0x47beed,null));};exports['update']=function(_0x367290,_0x7af4dd){if(_0x367290[_0x1d3d('0x59')]['id']){delete _0x367290[_0x1d3d('0x59')]['id'];}return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x367290[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x7af4dd,null))[_0x1d3d('0x2d')](saveUpdates(_0x367290['body'],null))[_0x1d3d('0x2d')](respondWithResult(_0x7af4dd,null))['catch'](handleError(_0x7af4dd,null));};exports['destroy']=function(_0x57c8ee,_0x5ed012){return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x57c8ee[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x5ed012,null))['then'](removeEntity(_0x5ed012,null))[_0x1d3d('0x4a')](handleError(_0x5ed012,null));};exports['describe']=function(_0x44273d,_0xd3f336){return db['MailQueue'][_0x1d3d('0x5b')]()[_0x1d3d('0x2d')](respondWithResult(_0xd3f336,null))['catch'](handleError(_0xd3f336,null));};exports[_0x1d3d('0x5c')]=function(_0x4318ed,_0x295145,_0x1abb53){var _0x3bac7f={'raw':!![],'where':{}},_0x16e757={},_0x4e47d5;return db[_0x1d3d('0x35')][_0x1d3d('0x5d')]({'where':{'id':_0x4318ed[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x295145,null))[_0x1d3d('0x2d')](function(_0x4b04a1){if(_0x4b04a1){_0x4e47d5=_0x4b04a1[_0x1d3d('0x2f')]({'plain':!![]});_0x16e757['model']=_[_0x1d3d('0x4b')](db['UserMailQueue'][_0x1d3d('0x4c')]);_0x16e757[_0x1d3d('0x39')]=_[_0x1d3d('0x4b')](_0x4318ed[_0x1d3d('0x39')]);_0x16e757[_0x1d3d('0x3a')]=_[_0x1d3d('0x3b')](_0x16e757[_0x1d3d('0x3c')],_0x16e757['query']);_0x3bac7f[_0x1d3d('0x3e')]=_[_0x1d3d('0x3b')](_0x16e757[_0x1d3d('0x3c')],qs[_0x1d3d('0x3d')](_0x4318ed[_0x1d3d('0x39')][_0x1d3d('0x3d')]));_0x3bac7f['attributes']=_0x3bac7f[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x3bac7f[_0x1d3d('0x3e')]:_0x16e757[_0x1d3d('0x3c')];if(!_0x4318ed[_0x1d3d('0x39')]['hasOwnProperty'](_0x1d3d('0x5e'))){_0x3bac7f[_0x1d3d('0x25')]=qs[_0x1d3d('0x25')](_0x4318ed['query'][_0x1d3d('0x25')]);_0x3bac7f['offset']=qs[_0x1d3d('0x24')](_0x4318ed['query'][_0x1d3d('0x24')]);}_0x3bac7f[_0x1d3d('0x5f')]=qs[_0x1d3d('0x41')](_0x4318ed['query'][_0x1d3d('0x41')]);_0x3bac7f[_0x1d3d('0x42')]=qs[_0x1d3d('0x3a')](_['pick'](_0x4318ed[_0x1d3d('0x39')],_0x16e757[_0x1d3d('0x3a')]));_0x3bac7f[_0x1d3d('0x42')]['MailQueueId']=_0x4b04a1['id'];if(_0x4318ed[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x3bac7f[_0x1d3d('0x42')]=_[_0x1d3d('0x45')](_0x3bac7f[_0x1d3d('0x42')],{'$or':_['map'](_0x3bac7f[_0x1d3d('0x3e')],function(_0xdf0d1f){var _0x25f4e0={};_0x25f4e0[_0xdf0d1f]={'$like':'%'+_0x4318ed['query'][_0x1d3d('0x44')]+'%'};return _0x25f4e0;})});}_0x3bac7f=_[_0x1d3d('0x45')]({},_0x3bac7f,_0x4318ed[_0x1d3d('0x47')]);return db[_0x1d3d('0x60')][_0x1d3d('0x48')](_0x3bac7f);}})['then'](function(_0x21f8ac){if(_0x21f8ac){return db[_0x1d3d('0x61')]['findAndCountAll']({'where':{'id':_[_0x1d3d('0x34')](_0x21f8ac,_0x1d3d('0x62')),'role':'agent'},'attributes':['id',_0x1d3d('0x32'),_0x1d3d('0x63'),_0x1d3d('0x64'),_0x1d3d('0x65')]});}})['then'](function(_0x3fc022){if(_0x3fc022){return{'count':_0x3fc022[_0x1d3d('0x27')],'rows':_[_0x1d3d('0x34')](_0x3fc022[_0x1d3d('0x49')],function(_0x5af94a){return{'membername':_0x5af94a['name'],'UserId':_0x5af94a['id'],'queue_name':_0x4e47d5[_0x1d3d('0x32')],'MailQueueId':_0x4e47d5['id'],'interface':util[_0x1d3d('0x66')](_0x1d3d('0x67'),_0x1d3d('0x68'),_0x5af94a[_0x1d3d('0x32')]),'penalty':0x0,'paused':_0x5af94a[_0x1d3d('0x63')],'createdAt':_0x5af94a[_0x1d3d('0x65')],'updatedAt':_0x5af94a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1d3d('0x2d')](respondWithFilteredResult(_0x295145,_0x3bac7f))[_0x1d3d('0x4a')](handleError(_0x295145,null));};exports['getTeams']=function(_0x164b5d,_0x310d27,_0x3ab561){var _0x5d951f={};var _0x4079ca={};var _0x328032;var _0x29033a;return db[_0x1d3d('0x35')]['findOne']({'where':{'id':_0x164b5d[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x310d27,null))[_0x1d3d('0x2d')](function(_0x63489){if(_0x63489){_0x328032=_0x63489;_0x4079ca['model']=_[_0x1d3d('0x4b')](db[_0x1d3d('0x69')][_0x1d3d('0x4c')]);_0x4079ca['query']=_[_0x1d3d('0x4b')](_0x164b5d[_0x1d3d('0x39')]);_0x4079ca['filters']=_[_0x1d3d('0x3b')](_0x4079ca['model'],_0x4079ca[_0x1d3d('0x39')]);_0x5d951f[_0x1d3d('0x3e')]=_['intersection'](_0x4079ca['model'],qs[_0x1d3d('0x3d')](_0x164b5d[_0x1d3d('0x39')]['fields']));_0x5d951f[_0x1d3d('0x3e')]=_0x5d951f[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x5d951f[_0x1d3d('0x3e')]:_0x4079ca['model'];_0x5d951f[_0x1d3d('0x5f')]=qs[_0x1d3d('0x41')](_0x164b5d[_0x1d3d('0x39')]['sort']);_0x5d951f[_0x1d3d('0x42')]=qs[_0x1d3d('0x3a')](_[_0x1d3d('0x43')](_0x164b5d['query'],_0x4079ca[_0x1d3d('0x3a')]));if(_0x164b5d[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x5d951f[_0x1d3d('0x42')]=_[_0x1d3d('0x45')](_0x5d951f[_0x1d3d('0x42')],{'$or':_['map'](_0x5d951f[_0x1d3d('0x3e')],function(_0x2b5ff2){var _0x5cedcf={};_0x5cedcf[_0x2b5ff2]={'$like':'%'+_0x164b5d[_0x1d3d('0x39')][_0x1d3d('0x44')]+'%'};return _0x5cedcf;})});}_0x5d951f=_[_0x1d3d('0x45')]({},_0x5d951f,_0x164b5d['options']);return _0x328032[_0x1d3d('0x6a')](_0x5d951f);}})['then'](function(_0x49ab17){if(_0x49ab17){_0x29033a=_0x49ab17['length'];if(!_0x164b5d[_0x1d3d('0x39')]['hasOwnProperty'](_0x1d3d('0x5e'))){_0x5d951f[_0x1d3d('0x25')]=qs[_0x1d3d('0x25')](_0x164b5d[_0x1d3d('0x39')]['limit']);_0x5d951f['offset']=qs[_0x1d3d('0x24')](_0x164b5d[_0x1d3d('0x39')]['offset']);}return _0x328032[_0x1d3d('0x6a')](_0x5d951f);}})[_0x1d3d('0x2d')](function(_0x5be307){if(_0x5be307){return _0x5be307?{'count':_0x29033a,'rows':_0x5be307}:null;}})[_0x1d3d('0x2d')](respondWithResult(_0x310d27,null))[_0x1d3d('0x4a')](handleError(_0x310d27,null));};exports['addTeams']=function(_0x329748,_0x59054d,_0x3ac7e6){var _0x347fd8=_0x329748[_0x1d3d('0x59')][_0x1d3d('0x6b')];return db[_0x1d3d('0x69')]['findAll']({'where':{'id':_0x347fd8},'attributes':['id'],'include':[{'model':db[_0x1d3d('0x61')],'as':_0x1d3d('0x6c'),'attributes':['id',_0x1d3d('0x32'),_0x1d3d('0x6d'),_0x1d3d('0x6e'),_0x1d3d('0x6f')],'raw':!![]}]})[_0x1d3d('0x2d')](function(_0x9a3674){if(_0x9a3674){var _0x25fc35=_[_0x1d3d('0x70')](_0x9a3674,function(_0x24b3d8){var _0x123523=_0x24b3d8['get']({'plain':!![]});return _0x123523[_0x1d3d('0x6c')];});return db['MailQueue'][_0x1d3d('0x4f')]({'where':{'id':_0x329748[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](function(_0x1d5518){return db[_0x1d3d('0x71')][_0x1d3d('0x72')](function(_0x3e9c1e){return _0x1d5518[_0x1d3d('0x73')](_0x347fd8,{'transaction':_0x3e9c1e})[_0x1d3d('0x2d')](function(){return BPromise['each'](_0x25fc35,function(_0x55ec07){return db['UserMailQueue'][_0x1d3d('0x74')]({'where':{'UserId':_0x55ec07['id'],'MailQueueId':_0x329748['params']['id']},'transaction':_0x3e9c1e});});})[_0x1d3d('0x2d')](function(){_0x25fc35['forEach'](function(_0x270217){socket[_0x1d3d('0x75')](_0x1d3d('0x76'),{'UserId':_0x270217['id'],'MailQueueId':_0x1d5518['id']});});});});});}})[_0x1d3d('0x2d')](respondWithStatusCode(_0x59054d,null))['catch'](handleError(_0x59054d,null));};exports[_0x1d3d('0x77')]=function(_0x15d0b3,_0x20238b,_0x24f238){return db['Team'][_0x1d3d('0x48')]({'where':{'id':_0x15d0b3[_0x1d3d('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1d3d('0x61')],'as':_0x1d3d('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x20238b,null))['then'](function(_0x5e8bea){var _0x578704=_[_0x1d3d('0x34')](_0x5e8bea,'id');var _0x5cd9ad=[];var _0x26f19e=[];var _0x53bddd=squel['select']();_0x53bddd['field']('tq.TeamId')['from']('team_has_mail_queues','tq')[_0x1d3d('0x78')]('user_has_teams','ut',_0x1d3d('0x79'))[_0x1d3d('0x42')](_0x1d3d('0x7a'),_0x15d0b3[_0x1d3d('0x5a')]['id']);for(var _0x459c4d=0x0;_0x459c4d<_0x5e8bea['length'];_0x459c4d+=0x1){let _0x2dbef6=_0x5e8bea[_0x459c4d];for(var _0x11df10=0x0;_0x11df10<_0x2dbef6[_0x1d3d('0x6c')][_0x1d3d('0x3f')];_0x11df10+=0x1){let _0x1bb879=_0x2dbef6[_0x1d3d('0x6c')][_0x11df10];var _0x4cd9b1=_0x53bddd['clone']();_0x4cd9b1['where'](_0x1d3d('0x7b'),_0x1bb879['id']);_0x26f19e['push'](db['sequelize'][_0x1d3d('0x39')](_0x4cd9b1[_0x1d3d('0x7c')](),{'type':db[_0x1d3d('0x71')][_0x1d3d('0x7d')]['SELECT']})[_0x1d3d('0x2d')](function(_0x35e341){if(_0x35e341['length']===0x1){return _0x1bb879['id'];}else{var _0x5d9eb6=_[_0x1d3d('0x7e')](_['map'](_0x35e341,_0x1d3d('0x7f')),function(_0x34663a){return _['includes'](_0x578704,_0x34663a);});if(_0x5d9eb6){return _0x1bb879['id'];}}}));}}return BPromise[_0x1d3d('0x80')](_0x26f19e)[_0x1d3d('0x2d')](function(_0x46a315){_0x5cd9ad=_(_0x5cd9ad)[_0x1d3d('0x81')](_0x46a315)['compact']()[_0x1d3d('0x82')]();return db['MailQueue'][_0x1d3d('0x4f')]({'where':{'id':_0x15d0b3['params']['id']}})[_0x1d3d('0x2d')](function(_0xf35959){return db[_0x1d3d('0x71')]['transaction'](function(_0x514bdb){return _0xf35959[_0x1d3d('0x77')](_0x15d0b3[_0x1d3d('0x39')][_0x1d3d('0x6b')],{'transaction':_0x514bdb})[_0x1d3d('0x2d')](function(){if(!_[_0x1d3d('0x83')](_0x5cd9ad)){return _0xf35959[_0x1d3d('0x84')](_0x5cd9ad,{'transaction':_0x514bdb});}})['then'](function(){_0x5cd9ad[_0x1d3d('0x85')](function(_0x384c0a){socket[_0x1d3d('0x75')]('userMailQueue:remove',{'UserId':_0x384c0a,'MailQueueId':_0xf35959['id']});});});});});});})[_0x1d3d('0x2d')](respondWithStatusCode(_0x20238b,null))[_0x1d3d('0x4a')](handleError(_0x20238b,null));};exports[_0x1d3d('0x86')]=function(_0x8c6cea,_0x553f42,_0x4672d2){return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x8c6cea['params']['id']}})['then'](handleEntityNotFound(_0x553f42,null))[_0x1d3d('0x2d')](function(_0xfe16f8){if(_0xfe16f8){return _0xfe16f8[_0x1d3d('0x86')](_0x8c6cea[_0x1d3d('0x59')]['ids'],_[_0x1d3d('0x87')](_0x8c6cea[_0x1d3d('0x59')],[_0x1d3d('0x6b'),'id'])||{})[_0x1d3d('0x88')](function(_0x5c4e0a){for(var _0x3700a4=0x0;_0x3700a4<_0x8c6cea['body'][_0x1d3d('0x6b')][_0x1d3d('0x3f')];_0x3700a4+=0x1){socket[_0x1d3d('0x75')]('userMailQueue:save',{'UserId':Number(_0x8c6cea[_0x1d3d('0x59')][_0x1d3d('0x6b')][_0x3700a4]),'MailQueueId':Number(_0x8c6cea[_0x1d3d('0x5a')]['id'])});}return _0x5c4e0a;});}})['then'](respondWithResult(_0x553f42,null))[_0x1d3d('0x4a')](handleError(_0x553f42,null));};exports[_0x1d3d('0x84')]=function(_0x53404d,_0x1b6235,_0x2b4511){return db[_0x1d3d('0x35')][_0x1d3d('0x4f')]({'where':{'id':_0x53404d[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x1b6235,null))['then'](function(_0x104d22){if(_0x104d22){return _0x104d22['removeAgents'](_0x53404d['query'][_0x1d3d('0x6b')])['then'](function(){if(_['isArray'](_0x53404d['query'][_0x1d3d('0x6b')])){for(var _0x16e24f=0x0;_0x16e24f<_0x53404d['query'][_0x1d3d('0x6b')][_0x1d3d('0x3f')];_0x16e24f+=0x1){socket[_0x1d3d('0x75')]('userMailQueue:remove',{'UserId':Number(_0x53404d[_0x1d3d('0x39')][_0x1d3d('0x6b')][_0x16e24f]),'MailQueueId':Number(_0x53404d[_0x1d3d('0x5a')]['id'])});}}else{socket[_0x1d3d('0x75')](_0x1d3d('0x89'),{'UserId':Number(_0x53404d[_0x1d3d('0x39')][_0x1d3d('0x6b')]),'MailQueueId':Number(_0x53404d['params']['id'])});}});}})[_0x1d3d('0x2d')](respondWithStatusCode(_0x1b6235,null))[_0x1d3d('0x4a')](handleError(_0x1b6235,null));};exports[_0x1d3d('0x8a')]=function(_0x43367e,_0x1fbe3e,_0x14138f){var _0x34573b={};var _0x18edd5={};var _0x42af23;var _0x4bb51b;return db[_0x1d3d('0x35')][_0x1d3d('0x5d')]({'where':{'id':_0x43367e[_0x1d3d('0x5a')]['id']}})[_0x1d3d('0x2d')](handleEntityNotFound(_0x1fbe3e,null))[_0x1d3d('0x2d')](function(_0x488ce5){if(_0x488ce5){_0x42af23=_0x488ce5;_0x18edd5['model']=_[_0x1d3d('0x4b')](db[_0x1d3d('0x61')][_0x1d3d('0x4c')]);_0x18edd5[_0x1d3d('0x39')]=_['keys'](_0x43367e[_0x1d3d('0x39')]);_0x18edd5[_0x1d3d('0x3a')]=_[_0x1d3d('0x3b')](_0x18edd5[_0x1d3d('0x3c')],_0x18edd5['query']);_0x34573b['attributes']=_[_0x1d3d('0x3b')](_0x18edd5[_0x1d3d('0x3c')],qs[_0x1d3d('0x3d')](_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x3d')]));_0x34573b[_0x1d3d('0x3e')]=_0x34573b[_0x1d3d('0x3e')][_0x1d3d('0x3f')]?_0x34573b[_0x1d3d('0x3e')]:_0x18edd5[_0x1d3d('0x3c')];_0x34573b[_0x1d3d('0x5f')]=qs[_0x1d3d('0x41')](_0x43367e[_0x1d3d('0x39')]['sort']);_0x34573b[_0x1d3d('0x42')]=qs['filters'](_[_0x1d3d('0x43')](_0x43367e[_0x1d3d('0x39')],_0x18edd5[_0x1d3d('0x3a')]));if(_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x44')]){_0x34573b['where']=_[_0x1d3d('0x45')](_0x34573b[_0x1d3d('0x42')],{'$or':_[_0x1d3d('0x34')](_0x34573b[_0x1d3d('0x3e')],function(_0x5ba897){var _0x23bb10={};_0x23bb10[_0x5ba897]={'$like':'%'+_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x44')]+'%'};return _0x23bb10;})});}_0x34573b=_[_0x1d3d('0x45')]({},_0x34573b,_0x43367e[_0x1d3d('0x47')]);return _0x42af23[_0x1d3d('0x8a')](_0x34573b);}})[_0x1d3d('0x2d')](function(_0x31a234){if(_0x31a234){_0x4bb51b=_0x31a234[_0x1d3d('0x3f')];if(!_0x43367e[_0x1d3d('0x39')][_0x1d3d('0x40')](_0x1d3d('0x5e'))){_0x34573b['limit']=qs['limit'](_0x43367e[_0x1d3d('0x39')]['limit']);_0x34573b[_0x1d3d('0x24')]=qs[_0x1d3d('0x24')](_0x43367e[_0x1d3d('0x39')]['offset']);}return _0x42af23['getAgents'](_0x34573b);}})[_0x1d3d('0x2d')](function(_0x55c8da){if(_0x55c8da){return _0x55c8da?{'count':_0x4bb51b,'rows':_0x55c8da}:null;}})[_0x1d3d('0x2d')](respondWithResult(_0x1fbe3e,null))[_0x1d3d('0x4a')](handleError(_0x1fbe3e,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 50b05d4..c423c68 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 _0xdc33=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x267b16,_0x547075){var _0x41485e=function(_0x54206b){while(--_0x54206b){_0x267b16['push'](_0x267b16['shift']());}};_0x41485e(++_0x547075);}(_0xdc33,0x83));var _0x3dc3=function(_0x268c77,_0x252e05){_0x268c77=_0x268c77-0x0;var _0x15f68d=_0xdc33[_0x268c77];return _0x15f68d;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3dc3('0x0'))['db'][_0x3dc3('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3dc3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dc3('0x3'),'afterDestroy':_0x3dc3('0x4')};function emitEvent(_0xc7dacb){return function(_0x13cee5,_0xf56001,_0x5b80b3){MailQueueEvents[_0x3dc3('0x5')](_0xc7dacb+':'+_0x13cee5['id'],_0x13cee5);MailQueueEvents['emit'](_0xc7dacb,_0x13cee5);_0x5b80b3(null);};}for(var e in events){if(events[_0x3dc3('0x6')](e)){var event=events[e];MailQueue[_0x3dc3('0x7')](e,emitEvent(event));}}module[_0x3dc3('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x1a4f=['MailQueue','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x2f4a79,_0xc0a0f2){var _0x25463f=function(_0x5b84b3){while(--_0x5b84b3){_0x2f4a79['push'](_0x2f4a79['shift']());}};_0x25463f(++_0xc0a0f2);}(_0x1a4f,0x19c));var _0xf1a4=function(_0x5787ca,_0x4f6e1c){_0x5787ca=_0x5787ca-0x0;var _0x4222c8=_0x1a4f[_0x5787ca];return _0x4222c8;};'use strict';var EventEmitter=require(_0xf1a4('0x0'));var MailQueue=require(_0xf1a4('0x1'))['db'][_0xf1a4('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf1a4('0x3')](0x0);var events={'afterCreate':_0xf1a4('0x4'),'afterUpdate':_0xf1a4('0x5'),'afterDestroy':_0xf1a4('0x6')};function emitEvent(_0x132139){return function(_0x297c7f,_0x326878,_0x537cc6){MailQueueEvents[_0xf1a4('0x7')](_0x132139+':'+_0x297c7f['id'],_0x297c7f);MailQueueEvents[_0xf1a4('0x7')](_0x132139,_0x297c7f);_0x537cc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf1a4('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6e41335..b3ac313 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 _0x394e=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1ea6eb,_0x33d3d4){var _0x127200=function(_0x5ef9b8){while(--_0x5ef9b8){_0x1ea6eb['push'](_0x1ea6eb['shift']());}};_0x127200(++_0x33d3d4);}(_0x394e,0x120));var _0xe394=function(_0xd6f5eb,_0x15ac61){_0xd6f5eb=_0xd6f5eb-0x0;var _0x572c12=_0x394e[_0xd6f5eb];return _0x572c12;};'use strict';var _=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var logger=require(_0xe394('0x2'))(_0xe394('0x3'));var moment=require('moment');var BPromise=require(_0xe394('0x4'));var rp=require(_0xe394('0x5'));var fs=require('fs');var path=require(_0xe394('0x6'));var rimraf=require(_0xe394('0x7'));var config=require(_0xe394('0x8'));var attributes=require(_0xe394('0x9'));module[_0xe394('0xa')]=function(_0x2a8f80,_0x45e22c){return _0x2a8f80[_0xe394('0xb')](_0xe394('0xc'),attributes,{'tableName':_0xe394('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d85=['MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','./mailQueue.attributes','define'];(function(_0x2a608d,_0x298459){var _0x1bee3e=function(_0x989a39){while(--_0x989a39){_0x2a608d['push'](_0x2a608d['shift']());}};_0x1bee3e(++_0x298459);}(_0x9d85,0x106));var _0x59d8=function(_0x505707,_0x1022bc){_0x505707=_0x505707-0x0;var _0x43cf38=_0x9d85[_0x505707];return _0x43cf38;};'use strict';var _=require(_0x59d8('0x0'));var util=require(_0x59d8('0x1'));var logger=require(_0x59d8('0x2'))('api');var moment=require(_0x59d8('0x3'));var BPromise=require(_0x59d8('0x4'));var rp=require(_0x59d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x59d8('0x6'));module['exports']=function(_0x1db4e6,_0x485633){return _0x1db4e6[_0x59d8('0x7')](_0x59d8('0x8'),attributes,{'tableName':_0x59d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 2ddb918..a8a34cc 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 _0x296f=['jayson/promise','redis','localhost','socket.io-emitter','./mailQueue.socket','register','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','model','then','debug','stringify','catch','ShowMailQueue','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x103d26,_0x209f98){var _0x5545fb=function(_0xecc121){while(--_0xecc121){_0x103d26['push'](_0x103d26['shift']());}};_0x5545fb(++_0x209f98);}(_0x296f,0x91));var _0xf296=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x296f[_0x4cce65];return _0x4d1b45;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var moment=require(_0xf296('0x2'));var BPromise=require(_0xf296('0x3'));var rs=require(_0xf296('0x4'));var fs=require('fs');var Redis=require(_0xf296('0x5'));var db=require(_0xf296('0x6'))['db'];var utils=require(_0xf296('0x7'));var logger=require(_0xf296('0x8'))(_0xf296('0x9'));var config=require(_0xf296('0xa'));var jayson=require(_0xf296('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xf296('0xc')]=_['defaults'](config[_0xf296('0xc')],{'host':_0xf296('0xd'),'port':0x18eb});var socket=require(_0xf296('0xe'))(new Redis(config[_0xf296('0xc')]));require(_0xf296('0xf'))[_0xf296('0x10')](socket);function respondWithRpcPromise(_0x1cfa10,_0x3d20a4,_0x3a2066){return new BPromise(function(_0x11c33e,_0x566840){return client['request'](_0x1cfa10,_0x3a2066)['then'](function(_0x2f5a88){logger[_0xf296('0x11')](_0xf296('0x12'),_0x3d20a4,_0xf296('0x13'));logger['debug'](_0xf296('0x14'),_0x3d20a4,_0xf296('0x13'),JSON['stringify'](_0x2f5a88));if(_0x2f5a88[_0xf296('0x15')]){if(_0x2f5a88['error']['code']===0x1f4){logger[_0xf296('0x15')](_0xf296('0x12'),_0x3d20a4,_0x2f5a88[_0xf296('0x15')][_0xf296('0x16')]);return _0x566840(_0x2f5a88[_0xf296('0x15')]['message']);}logger['error'](_0xf296('0x12'),_0x3d20a4,_0x2f5a88[_0xf296('0x15')][_0xf296('0x16')]);return _0x11c33e(_0x2f5a88[_0xf296('0x15')][_0xf296('0x16')]);}else{logger[_0xf296('0x11')](_0xf296('0x12'),_0x3d20a4,'request\x20sent');_0x11c33e(_0x2f5a88[_0xf296('0x17')][_0xf296('0x16')]);}})['catch'](function(_0x3298b9){logger[_0xf296('0x15')](_0xf296('0x12'),_0x3d20a4,_0x3298b9);_0x566840(_0x3298b9);});});}exports[_0xf296('0x18')]=function(_0x4e277b){var _0x32c065=this;return new Promise(function(_0x594993,_0x6e5db9){return db[_0xf296('0x19')][_0xf296('0x1a')]({'raw':_0x4e277b[_0xf296('0x1b')]?_0x4e277b[_0xf296('0x1b')][_0xf296('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e277b['options']?_0x4e277b['options'][_0xf296('0x1d')]||null:null,'attributes':_0x4e277b[_0xf296('0x1b')]?_0x4e277b[_0xf296('0x1b')][_0xf296('0x1e')]||null:null,'limit':_0x4e277b[_0xf296('0x1b')]?_0x4e277b['options']['limit']||null:null,'include':_0x4e277b[_0xf296('0x1b')]?_0x4e277b[_0xf296('0x1b')]['include']?_['map'](_0x4e277b[_0xf296('0x1b')][_0xf296('0x1f')],function(_0x3607af){return{'model':db[_0x3607af[_0xf296('0x20')]],'as':_0x3607af['as'],'attributes':_0x3607af[_0xf296('0x1e')],'include':_0x3607af[_0xf296('0x1f')]?_['map'](_0x3607af[_0xf296('0x1f')],function(_0x153850){return{'model':db[_0x153850[_0xf296('0x20')]],'as':_0x153850['as'],'attributes':_0x153850[_0xf296('0x1e')],'include':_0x153850[_0xf296('0x1f')]?_['map'](_0x153850[_0xf296('0x1f')],function(_0x4f5fcc){return{'model':db[_0x4f5fcc['model']],'as':_0x4f5fcc['as'],'attributes':_0x4f5fcc[_0xf296('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf296('0x21')](function(_0x58e4ff){logger[_0xf296('0x11')](_0xf296('0x18'),_0x4e277b);logger[_0xf296('0x22')]('GetMailQueue',_0x4e277b,JSON[_0xf296('0x23')](_0x58e4ff));_0x594993(_0x58e4ff);})[_0xf296('0x24')](function(_0x5516fd){logger['error']('GetMailQueue',_0x5516fd['message'],_0x4e277b);_0x6e5db9(_0x32c065['error'](0x1f4,_0x5516fd[_0xf296('0x16')]));});});};exports[_0xf296('0x25')]=function(_0xcfef50){var _0x110cd1=this;return new Promise(function(_0x277758,_0xcf260d){return db[_0xf296('0x19')]['find']({'raw':_0xcfef50[_0xf296('0x1b')]?_0xcfef50['options']['raw']===undefined?!![]:![]:!![],'where':_0xcfef50['options']?_0xcfef50[_0xf296('0x1b')][_0xf296('0x1d')]||null:null,'attributes':_0xcfef50[_0xf296('0x1b')]?_0xcfef50[_0xf296('0x1b')][_0xf296('0x1e')]||null:null,'include':_0xcfef50[_0xf296('0x1b')]?_0xcfef50[_0xf296('0x1b')]['include']?_[_0xf296('0x26')](_0xcfef50[_0xf296('0x1b')][_0xf296('0x1f')],function(_0x2fa2ee){return{'model':db[_0x2fa2ee[_0xf296('0x20')]],'as':_0x2fa2ee['as'],'attributes':_0x2fa2ee[_0xf296('0x1e')],'include':_0x2fa2ee[_0xf296('0x1f')]?_[_0xf296('0x26')](_0x2fa2ee[_0xf296('0x1f')],function(_0x15791e){return{'model':db[_0x15791e[_0xf296('0x20')]],'as':_0x15791e['as'],'attributes':_0x15791e[_0xf296('0x1e')],'include':_0x15791e[_0xf296('0x1f')]?_['map'](_0x15791e['include'],function(_0x3887ee){return{'model':db[_0x3887ee[_0xf296('0x20')]],'as':_0x3887ee['as'],'attributes':_0x3887ee[_0xf296('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf296('0x21')](function(_0x3ce56f){logger['info'](_0xf296('0x25'),_0xcfef50);logger['debug'](_0xf296('0x25'),_0xcfef50,JSON[_0xf296('0x23')](_0x3ce56f));_0x277758(_0x3ce56f);})[_0xf296('0x24')](function(_0x1b6caa){logger['error']('ShowMailQueue',_0x1b6caa[_0xf296('0x16')],_0xcfef50);_0xcf260d(_0x110cd1[_0xf296('0x15')](0x1f4,_0x1b6caa[_0xf296('0x16')]));});});}; \ No newline at end of file +var _0xd57b=['ShowMailQueue','stringify','lodash','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetMailQueue','findAll','options','raw','where','attributes','include','map','model','catch','MailQueue','find'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd57b,0x1be));var _0xbd57=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0xd57b[_0x127783];return _0x14f298;};'use strict';var _=require(_0xbd57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd57('0x1'));var db=require(_0xbd57('0x2'))['db'];var utils=require(_0xbd57('0x3'));var logger=require('../../config/logger')(_0xbd57('0x4'));var config=require('../../config/environment');var jayson=require(_0xbd57('0x5'));var client=jayson['client'][_0xbd57('0x6')]({'port':0x232a});config[_0xbd57('0x7')]=_[_0xbd57('0x8')](config[_0xbd57('0x7')],{'host':_0xbd57('0x9'),'port':0x18eb});var socket=require(_0xbd57('0xa'))(new Redis(config[_0xbd57('0x7')]));require(_0xbd57('0xb'))[_0xbd57('0xc')](socket);function respondWithRpcPromise(_0x4b0802,_0x558e25,_0x853f7f){return new BPromise(function(_0x21eff0,_0x58c7c3){return client[_0xbd57('0xd')](_0x4b0802,_0x853f7f)[_0xbd57('0xe')](function(_0x3163df){logger[_0xbd57('0xf')](_0xbd57('0x10'),_0x558e25,_0xbd57('0x11'));logger[_0xbd57('0x12')](_0xbd57('0x13'),_0x558e25,_0xbd57('0x11'),JSON['stringify'](_0x3163df));if(_0x3163df[_0xbd57('0x14')]){if(_0x3163df[_0xbd57('0x14')]['code']===0x1f4){logger[_0xbd57('0x14')](_0xbd57('0x10'),_0x558e25,_0x3163df[_0xbd57('0x14')][_0xbd57('0x15')]);return _0x58c7c3(_0x3163df[_0xbd57('0x14')][_0xbd57('0x15')]);}logger[_0xbd57('0x14')]('MailQueue,\x20%s,\x20%s',_0x558e25,_0x3163df['error'][_0xbd57('0x15')]);return _0x21eff0(_0x3163df[_0xbd57('0x14')][_0xbd57('0x15')]);}else{logger[_0xbd57('0xf')]('MailQueue,\x20%s,\x20%s',_0x558e25,_0xbd57('0x11'));_0x21eff0(_0x3163df[_0xbd57('0x16')][_0xbd57('0x15')]);}})['catch'](function(_0x103ab8){logger[_0xbd57('0x14')](_0xbd57('0x10'),_0x558e25,_0x103ab8);_0x58c7c3(_0x103ab8);});});}exports[_0xbd57('0x17')]=function(_0x54a441){var _0xf3d96e=this;return new Promise(function(_0x12c7e2,_0x2048d6){return db['MailQueue'][_0xbd57('0x18')]({'raw':_0x54a441[_0xbd57('0x19')]?_0x54a441['options'][_0xbd57('0x1a')]===undefined?!![]:![]:!![],'where':_0x54a441['options']?_0x54a441['options'][_0xbd57('0x1b')]||null:null,'attributes':_0x54a441[_0xbd57('0x19')]?_0x54a441[_0xbd57('0x19')][_0xbd57('0x1c')]||null:null,'limit':_0x54a441['options']?_0x54a441[_0xbd57('0x19')]['limit']||null:null,'include':_0x54a441[_0xbd57('0x19')]?_0x54a441['options'][_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x54a441[_0xbd57('0x19')][_0xbd57('0x1d')],function(_0x28be5e){return{'model':db[_0x28be5e[_0xbd57('0x1f')]],'as':_0x28be5e['as'],'attributes':_0x28be5e['attributes'],'include':_0x28be5e[_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x28be5e['include'],function(_0x238aea){return{'model':db[_0x238aea[_0xbd57('0x1f')]],'as':_0x238aea['as'],'attributes':_0x238aea[_0xbd57('0x1c')],'include':_0x238aea[_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x238aea[_0xbd57('0x1d')],function(_0x14f784){return{'model':db[_0x14f784[_0xbd57('0x1f')]],'as':_0x14f784['as'],'attributes':_0x14f784[_0xbd57('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c567){logger['info']('GetMailQueue',_0x54a441);logger['debug'](_0xbd57('0x17'),_0x54a441,JSON['stringify'](_0x21c567));_0x12c7e2(_0x21c567);})[_0xbd57('0x20')](function(_0x10253d){logger[_0xbd57('0x14')]('GetMailQueue',_0x10253d['message'],_0x54a441);_0x2048d6(_0xf3d96e[_0xbd57('0x14')](0x1f4,_0x10253d[_0xbd57('0x15')]));});});};exports['ShowMailQueue']=function(_0x60ebcb){var _0x11a718=this;return new Promise(function(_0xc22a07,_0x3e442e){return db[_0xbd57('0x21')][_0xbd57('0x22')]({'raw':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')][_0xbd57('0x1a')]===undefined?!![]:![]:!![],'where':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')]['where']||null:null,'attributes':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')][_0xbd57('0x1c')]||null:null,'include':_0x60ebcb[_0xbd57('0x19')]?_0x60ebcb[_0xbd57('0x19')][_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x60ebcb[_0xbd57('0x19')]['include'],function(_0x1335b2){return{'model':db[_0x1335b2[_0xbd57('0x1f')]],'as':_0x1335b2['as'],'attributes':_0x1335b2[_0xbd57('0x1c')],'include':_0x1335b2[_0xbd57('0x1d')]?_[_0xbd57('0x1e')](_0x1335b2[_0xbd57('0x1d')],function(_0x13c332){return{'model':db[_0x13c332[_0xbd57('0x1f')]],'as':_0x13c332['as'],'attributes':_0x13c332[_0xbd57('0x1c')],'include':_0x13c332['include']?_[_0xbd57('0x1e')](_0x13c332[_0xbd57('0x1d')],function(_0x2f3e9c){return{'model':db[_0x2f3e9c[_0xbd57('0x1f')]],'as':_0x2f3e9c['as'],'attributes':_0x2f3e9c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd57('0xe')](function(_0x50db27){logger['info']('ShowMailQueue',_0x60ebcb);logger[_0xbd57('0x12')](_0xbd57('0x23'),_0x60ebcb,JSON[_0xbd57('0x24')](_0x50db27));_0xc22a07(_0x50db27);})['catch'](function(_0x256df1){logger[_0xbd57('0x14')]('ShowMailQueue',_0x256df1[_0xbd57('0x15')],_0x60ebcb);_0x3e442e(_0x11a718[_0xbd57('0x14')](0x1f4,_0x256df1[_0xbd57('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e87accd..ba07ace 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 _0x4dd2=['mailQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0xadd417,_0x207028){var _0x5c79e7=function(_0xa07df0){while(--_0xa07df0){_0xadd417['push'](_0xadd417['shift']());}};_0x5c79e7(++_0x207028);}(_0x4dd2,0xf1));var _0x24dd=function(_0x3c1b2d,_0x23b1b9){_0x3c1b2d=_0x3c1b2d-0x0;var _0x412475=_0x4dd2[_0x3c1b2d];return _0x412475;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x24dd('0x0'),_0x24dd('0x1'),_0x24dd('0x2')];function createListener(_0x55f2b0,_0x3d8377){return function(_0x5c459c){_0x3d8377[_0x24dd('0x3')](_0x55f2b0,_0x5c459c);};}function removeListener(_0x5c5b1e,_0x168fb0){return function(){MailQueueEvents[_0x24dd('0x4')](_0x5c5b1e,_0x168fb0);};}exports[_0x24dd('0x5')]=function(_0x5d3f24){for(var _0x524c5b=0x0,_0x21b5b4=events[_0x24dd('0x6')];_0x524c5b<_0x21b5b4;_0x524c5b++){var _0x1dd44c=events[_0x524c5b];var _0x424e48=createListener(_0x24dd('0x7')+_0x1dd44c,_0x5d3f24);MailQueueEvents['on'](_0x1dd44c,_0x424e48);}}; \ No newline at end of file +var _0xb464=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','update'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb464,0xad));var _0x4b46=function(_0x530e0e,_0x54d536){_0x530e0e=_0x530e0e-0x0;var _0x2742fb=_0xb464[_0x530e0e];return _0x2742fb;};'use strict';var MailQueueEvents=require(_0x4b46('0x0'));var events=[_0x4b46('0x1'),'remove',_0x4b46('0x2')];function createListener(_0x254da1,_0x5d8605){return function(_0x139975){_0x5d8605[_0x4b46('0x3')](_0x254da1,_0x139975);};}function removeListener(_0x40c389,_0x51afc2){return function(){MailQueueEvents[_0x4b46('0x4')](_0x40c389,_0x51afc2);};}exports[_0x4b46('0x5')]=function(_0x519534){for(var _0x2c074a=0x0,_0x3b9b96=events[_0x4b46('0x6')];_0x2c074a<_0x3b9b96;_0x2c074a++){var _0x127133=events[_0x2c074a];var _0x3dbefc=createListener(_0x4b46('0x7')+_0x127133,_0x519534);MailQueueEvents['on'](_0x127133,_0x3dbefc);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b764185..078123f 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 _0x9cc9=['get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index'];(function(_0x5661c2,_0x5e7748){var _0x460c9f=function(_0x250c08){while(--_0x250c08){_0x5661c2['push'](_0x5661c2['shift']());}};_0x460c9f(++_0x5e7748);}(_0x9cc9,0x1ef));var _0x99cc=function(_0x1a469c,_0x13eb5c){_0x1a469c=_0x1a469c-0x0;var _0x56389a=_0x9cc9[_0x1a469c];return _0x56389a;};'use strict';var multer=require(_0x99cc('0x0'));var util=require(_0x99cc('0x1'));var path=require(_0x99cc('0x2'));var timeout=require(_0x99cc('0x3'));var express=require(_0x99cc('0x4'));var router=express[_0x99cc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99cc('0x6'));var interaction=require(_0x99cc('0x7'));var config=require('../../config/environment');var controller=require(_0x99cc('0x8'));router['get']('/',auth[_0x99cc('0x9')](),controller[_0x99cc('0xa')]);router[_0x99cc('0xb')](_0x99cc('0xc'),auth[_0x99cc('0x9')](),controller[_0x99cc('0xd')]);router['get'](_0x99cc('0xe'),auth[_0x99cc('0x9')](),controller[_0x99cc('0xf')]);router[_0x99cc('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x99cc('0x11')](_0x99cc('0xe'),auth[_0x99cc('0x9')](),controller[_0x99cc('0x12')]);router[_0x99cc('0x13')]('/:id',auth[_0x99cc('0x9')](),controller[_0x99cc('0x14')]);module[_0x99cc('0x15')]=router; \ No newline at end of file +var _0x6c8b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2d45ad,_0x38863b){var _0x54af10=function(_0x87fb27){while(--_0x87fb27){_0x2d45ad['push'](_0x2d45ad['shift']());}};_0x54af10(++_0x38863b);}(_0x6c8b,0x10d));var _0xb6c8=function(_0x481a51,_0x1b1f7a){_0x481a51=_0x481a51-0x0;var _0x5eaac1=_0x6c8b[_0x481a51];return _0x5eaac1;};'use strict';var multer=require('multer');var util=require(_0xb6c8('0x0'));var path=require(_0xb6c8('0x1'));var timeout=require(_0xb6c8('0x2'));var express=require(_0xb6c8('0x3'));var router=express[_0xb6c8('0x4')]();var fs_extra=require(_0xb6c8('0x5'));var auth=require(_0xb6c8('0x6'));var interaction=require(_0xb6c8('0x7'));var config=require('../../config/environment');var controller=require(_0xb6c8('0x8'));router[_0xb6c8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb6c8('0x9')]('/describe',auth[_0xb6c8('0xa')](),controller[_0xb6c8('0xb')]);router[_0xb6c8('0x9')](_0xb6c8('0xc'),auth[_0xb6c8('0xa')](),controller[_0xb6c8('0xd')]);router[_0xb6c8('0xe')]('/',auth[_0xb6c8('0xa')](),controller[_0xb6c8('0xf')]);router[_0xb6c8('0x10')](_0xb6c8('0xc'),auth[_0xb6c8('0xa')](),controller[_0xb6c8('0x11')]);router[_0xb6c8('0x12')](_0xb6c8('0xc'),auth[_0xb6c8('0xa')](),controller[_0xb6c8('0x13')]);module[_0xb6c8('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3abd239..ad7d1c6 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 _0x64be=['exports','STRING','DATE'];(function(_0x57678d,_0x3c656b){var _0x50c88b=function(_0x424b82){while(--_0x424b82){_0x57678d['push'](_0x57678d['shift']());}};_0x50c88b(++_0x3c656b);}(_0x64be,0x120));var _0xe64b=function(_0xec648e,_0x462a12){_0xec648e=_0xec648e-0x0;var _0x488e67=_0x64be[_0xec648e];return _0x488e67;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe64b('0x0')]={'uniqueid':{'type':Sequelize[_0xe64b('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe64b('0x1')]},'joinAt':{'type':Sequelize[_0xe64b('0x2')]},'leaveAt':{'type':Sequelize[_0xe64b('0x2')]},'acceptAt':{'type':Sequelize[_0xe64b('0x2')]},'exitAt':{'type':Sequelize[_0xe64b('0x2')]},'reason':{'type':Sequelize[_0xe64b('0x1')]}}; \ No newline at end of file +var _0x9490=['STRING','DATE'];(function(_0x17b11a,_0x228eb7){var _0x56775e=function(_0x4a633e){while(--_0x4a633e){_0x17b11a['push'](_0x17b11a['shift']());}};_0x56775e(++_0x228eb7);}(_0x9490,0x15c));var _0x0949=function(_0x44d3b4,_0xf4795d){_0x44d3b4=_0x44d3b4-0x0;var _0x200dd4=_0x9490[_0x44d3b4];return _0x200dd4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0949('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0949('0x1')]},'leaveAt':{'type':Sequelize[_0x0949('0x1')]},'acceptAt':{'type':Sequelize[_0x0949('0x1')]},'exitAt':{'type':Sequelize[_0x0949('0x1')]},'reason':{'type':Sequelize[_0x0949('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ec481f8..c94e63a 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 _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x2a9957,_0xf63989){var _0x17b691=function(_0x3ded7c){while(--_0x3ded7c){_0x2a9957['push'](_0x2a9957['shift']());}};_0x17b691(++_0xf63989);}(_0x6050,0x196));var _0x0605=function(_0x556d87,_0x37bca3){_0x556d87=_0x556d87-0x0;var _0x3cc80c=_0x6050[_0x556d87];return _0x3cc80c;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file +var _0x8ace=['keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','rows','params','rawAttributes','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','stack','name','send','map','MailQueueReport','type','query'];(function(_0x323b2b,_0x541754){var _0x25b0c9=function(_0x3a10eb){while(--_0x3a10eb){_0x323b2b['push'](_0x323b2b['shift']());}};_0x25b0c9(++_0x541754);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x18cb0a,_0x172892){_0x18cb0a=_0x18cb0a-0x0;var _0x4c7286=_0x8ace[_0x18cb0a];return _0x4c7286;};'use strict';var emlformat=require(_0xe8ac('0x0'));var rimraf=require(_0xe8ac('0x1'));var zipdir=require(_0xe8ac('0x2'));var jsonpatch=require(_0xe8ac('0x3'));var rp=require(_0xe8ac('0x4'));var moment=require(_0xe8ac('0x5'));var BPromise=require(_0xe8ac('0x6'));var Mustache=require(_0xe8ac('0x7'));var util=require(_0xe8ac('0x8'));var path=require(_0xe8ac('0x9'));var sox=require(_0xe8ac('0xa'));var csv=require(_0xe8ac('0xb'));var ejs=require(_0xe8ac('0xc'));var fs=require('fs');var fs_extra=require(_0xe8ac('0xd'));var _=require('lodash');var squel=require(_0xe8ac('0xe'));var crypto=require(_0xe8ac('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8ac('0xb'));var querystring=require('querystring');var Papa=require(_0xe8ac('0x10'));var Redis=require(_0xe8ac('0x11'));var authService=require(_0xe8ac('0x12'));var qs=require(_0xe8ac('0x13'));var as=require(_0xe8ac('0x14'));var hardwareService=require(_0xe8ac('0x15'));var logger=require('../../config/logger')(_0xe8ac('0x16'));var utils=require(_0xe8ac('0x17'));var config=require(_0xe8ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8ac('0x19'))['db'];function respondWithStatusCode(_0x4735cb,_0x4cc3b1){_0x4cc3b1=_0x4cc3b1||0xcc;return function(_0x183b7d){if(_0x183b7d){return _0x4735cb[_0xe8ac('0x1a')](_0x4cc3b1);}return _0x4735cb[_0xe8ac('0x1b')](_0x4cc3b1)[_0xe8ac('0x1c')]();};}function respondWithResult(_0x268f61,_0x317078){_0x317078=_0x317078||0xc8;return function(_0x1be138){if(_0x1be138){return _0x268f61[_0xe8ac('0x1b')](_0x317078)[_0xe8ac('0x1d')](_0x1be138);}};}function respondWithFilteredResult(_0x369d36,_0x5e4495){return function(_0x224bda){if(_0x224bda){var _0x18ddb3=typeof _0x5e4495['offset']===_0xe8ac('0x1e')&&typeof _0x5e4495[_0xe8ac('0x1f')]===_0xe8ac('0x1e');var _0xe1c52e=_0x224bda[_0xe8ac('0x20')];var _0x36759c=_0x18ddb3?0x0:_0x5e4495['offset'];var _0x59df3d=_0x18ddb3?_0x224bda['count']:_0x5e4495[_0xe8ac('0x21')]+_0x5e4495[_0xe8ac('0x1f')];var _0x4e5d00;if(_0x59df3d>=_0xe1c52e){_0x59df3d=_0xe1c52e;_0x4e5d00=0xc8;}else{_0x4e5d00=0xce;}_0x369d36[_0xe8ac('0x1b')](_0x4e5d00);return _0x369d36['set'](_0xe8ac('0x22'),_0x36759c+'-'+_0x59df3d+'/'+_0xe1c52e)[_0xe8ac('0x1d')](_0x224bda);}return null;};}function patchUpdates(_0x47e63e){return function(_0x6258f8){try{jsonpatch[_0xe8ac('0x23')](_0x6258f8,_0x47e63e,!![]);}catch(_0x13aa7c){return BPromise[_0xe8ac('0x24')](_0x13aa7c);}return _0x6258f8['save']();};}function saveUpdates(_0x6a7dbd,_0x59a9ea){return function(_0x1eb5f1){if(_0x1eb5f1){return _0x1eb5f1[_0xe8ac('0x25')](_0x6a7dbd)[_0xe8ac('0x26')](function(_0x252440){return _0x252440;});}return null;};}function removeEntity(_0x36108c,_0x31956a){return function(_0x38565d){if(_0x38565d){return _0x38565d['destroy']()[_0xe8ac('0x26')](function(){_0x36108c[_0xe8ac('0x1b')](0xcc)[_0xe8ac('0x1c')]();});}};}function handleEntityNotFound(_0x7c3450,_0x340ae0){return function(_0x3a92e1){if(!_0x3a92e1){_0x7c3450[_0xe8ac('0x1a')](0x194);}return _0x3a92e1;};}function handleError(_0x3e3fc2,_0x44b07c){_0x44b07c=_0x44b07c||0x1f4;return function(_0x562e44){logger['error'](_0x562e44[_0xe8ac('0x27')]);if(_0x562e44[_0xe8ac('0x28')]){delete _0x562e44['name'];}_0x3e3fc2[_0xe8ac('0x1b')](_0x44b07c)[_0xe8ac('0x29')](_0x562e44);};}exports['index']=function(_0x4c1d08,_0x1f1e44){var _0x41294e={},_0x3798c5={},_0x5d7562={'count':0x0,'rows':[]};var _0x156550=_[_0xe8ac('0x2a')](db[_0xe8ac('0x2b')]['rawAttributes'],function(_0xc1947d){return{'name':_0xc1947d['fieldName'],'type':_0xc1947d[_0xe8ac('0x2c')]['key']};});_0x3798c5['model']=_['map'](_0x156550,'name');_0x3798c5[_0xe8ac('0x2d')]=_[_0xe8ac('0x2e')](_0x4c1d08[_0xe8ac('0x2d')]);_0x3798c5[_0xe8ac('0x2f')]=_[_0xe8ac('0x30')](_0x3798c5[_0xe8ac('0x31')],_0x3798c5[_0xe8ac('0x2d')]);_0x41294e['attributes']=_[_0xe8ac('0x30')](_0x3798c5['model'],qs['fields'](_0x4c1d08['query'][_0xe8ac('0x32')]));_0x41294e[_0xe8ac('0x33')]=_0x41294e[_0xe8ac('0x33')]['length']?_0x41294e['attributes']:_0x3798c5[_0xe8ac('0x31')];if(!_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x34')](_0xe8ac('0x35'))){_0x41294e['limit']=qs[_0xe8ac('0x1f')](_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x1f')]);_0x41294e[_0xe8ac('0x21')]=qs[_0xe8ac('0x21')](_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x21')]);}_0x41294e['order']=qs[_0xe8ac('0x36')](_0x4c1d08[_0xe8ac('0x2d')]['sort']);_0x41294e[_0xe8ac('0x37')]=qs[_0xe8ac('0x2f')](_[_0xe8ac('0x38')](_0x4c1d08[_0xe8ac('0x2d')],_0x3798c5['filters']),_0x156550);if(_0x4c1d08[_0xe8ac('0x2d')]['filter']){_0x41294e['where']=_[_0xe8ac('0x39')](_0x41294e[_0xe8ac('0x37')],{'$or':_[_0xe8ac('0x2a')](_0x156550,function(_0x7f3445){if(_0x7f3445[_0xe8ac('0x2c')]!==_0xe8ac('0x3a')){var _0x78f1ea={};_0x78f1ea[_0x7f3445[_0xe8ac('0x28')]]={'$like':'%'+_0x4c1d08[_0xe8ac('0x2d')]['filter']+'%'};return _0x78f1ea;}})});}_0x41294e=_['merge']({},_0x41294e,_0x4c1d08[_0xe8ac('0x3b')]);var _0x10a9e8={'where':_0x41294e['where']};return db['MailQueueReport']['count'](_0x10a9e8)[_0xe8ac('0x26')](function(_0x46f291){_0x5d7562[_0xe8ac('0x20')]=_0x46f291;if(_0x4c1d08[_0xe8ac('0x2d')]['includeAll']){_0x41294e[_0xe8ac('0x3c')]=[{'all':!![]}];}return db[_0xe8ac('0x2b')]['findAll'](_0x41294e);})[_0xe8ac('0x26')](function(_0x41bbc2){_0x5d7562[_0xe8ac('0x3d')]=_0x41bbc2;return _0x5d7562;})[_0xe8ac('0x26')](respondWithFilteredResult(_0x1f1e44,_0x41294e))['catch'](handleError(_0x1f1e44,null));};exports['show']=function(_0x4e0f3d,_0x3710f4){var _0x2c2f18={'raw':!![],'where':{'id':_0x4e0f3d[_0xe8ac('0x3e')]['id']}},_0x28a913={};_0x28a913['model']=_['keys'](db[_0xe8ac('0x2b')][_0xe8ac('0x3f')]);_0x28a913[_0xe8ac('0x2d')]=_[_0xe8ac('0x2e')](_0x4e0f3d[_0xe8ac('0x2d')]);_0x28a913[_0xe8ac('0x2f')]=_[_0xe8ac('0x30')](_0x28a913[_0xe8ac('0x31')],_0x28a913[_0xe8ac('0x2d')]);_0x2c2f18[_0xe8ac('0x33')]=_[_0xe8ac('0x30')](_0x28a913[_0xe8ac('0x31')],qs[_0xe8ac('0x32')](_0x4e0f3d[_0xe8ac('0x2d')]['fields']));_0x2c2f18[_0xe8ac('0x33')]=_0x2c2f18['attributes']['length']?_0x2c2f18['attributes']:_0x28a913['model'];if(_0x4e0f3d[_0xe8ac('0x2d')]['includeAll']){_0x2c2f18[_0xe8ac('0x3c')]=[{'all':!![]}];}_0x2c2f18=_['merge']({},_0x2c2f18,_0x4e0f3d[_0xe8ac('0x3b')]);return db[_0xe8ac('0x2b')]['find'](_0x2c2f18)[_0xe8ac('0x26')](handleEntityNotFound(_0x3710f4,null))['then'](respondWithResult(_0x3710f4,null))[_0xe8ac('0x40')](handleError(_0x3710f4,null));};exports[_0xe8ac('0x41')]=function(_0x386aca,_0x5346d8){return db[_0xe8ac('0x2b')][_0xe8ac('0x41')](_0x386aca[_0xe8ac('0x42')],{})['then'](respondWithResult(_0x5346d8,0xc9))[_0xe8ac('0x40')](handleError(_0x5346d8,null));};exports[_0xe8ac('0x25')]=function(_0x2ed574,_0x478a0c){if(_0x2ed574[_0xe8ac('0x42')]['id']){delete _0x2ed574['body']['id'];}return db[_0xe8ac('0x2b')][_0xe8ac('0x43')]({'where':{'id':_0x2ed574[_0xe8ac('0x3e')]['id']}})['then'](handleEntityNotFound(_0x478a0c,null))[_0xe8ac('0x26')](saveUpdates(_0x2ed574[_0xe8ac('0x42')],null))[_0xe8ac('0x26')](respondWithResult(_0x478a0c,null))[_0xe8ac('0x40')](handleError(_0x478a0c,null));};exports[_0xe8ac('0x44')]=function(_0x406eb0,_0x1e7eb5){return db[_0xe8ac('0x2b')][_0xe8ac('0x43')]({'where':{'id':_0x406eb0[_0xe8ac('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e7eb5,null))[_0xe8ac('0x26')](removeEntity(_0x1e7eb5,null))[_0xe8ac('0x40')](handleError(_0x1e7eb5,null));};exports[_0xe8ac('0x45')]=function(_0x5daa4a,_0xce6848){return db[_0xe8ac('0x2b')][_0xe8ac('0x45')]()[_0xe8ac('0x26')](respondWithResult(_0xce6848,null))[_0xe8ac('0x40')](handleError(_0xce6848,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0eb546f..795c618 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 _0x8c30=['./mailQueueReport.attributes','define','report_mail_queue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321b1f,_0x4f16ef){var _0x27d55e=function(_0x47a234){while(--_0x47a234){_0x321b1f['push'](_0x321b1f['shift']());}};_0x27d55e(++_0x4f16ef);}(_0x8c30,0x18f));var _0x08c3=function(_0x53b84c,_0x17561b){_0x53b84c=_0x53b84c-0x0;var _0x148fd7=_0x8c30[_0x53b84c];return _0x148fd7;};'use strict';var _=require(_0x08c3('0x0'));var util=require('util');var logger=require(_0x08c3('0x1'))(_0x08c3('0x2'));var moment=require(_0x08c3('0x3'));var BPromise=require(_0x08c3('0x4'));var rp=require(_0x08c3('0x5'));var fs=require('fs');var path=require(_0x08c3('0x6'));var rimraf=require(_0x08c3('0x7'));var config=require(_0x08c3('0x8'));var attributes=require(_0x08c3('0x9'));module['exports']=function(_0x2ba44f,_0x3aa9e9){return _0x2ba44f[_0x08c3('0xa')]('MailQueueReport',attributes,{'tableName':_0x08c3('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3239=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4c4bc4,_0x1d84f3){var _0x1d3214=function(_0x5dab05){while(--_0x5dab05){_0x4c4bc4['push'](_0x4c4bc4['shift']());}};_0x1d3214(++_0x1d84f3);}(_0x3239,0xcc));var _0x9323=function(_0x334343,_0x28757f){_0x334343=_0x334343-0x0;var _0x2d920a=_0x3239[_0x334343];return _0x2d920a;};'use strict';var _=require(_0x9323('0x0'));var util=require(_0x9323('0x1'));var logger=require(_0x9323('0x2'))(_0x9323('0x3'));var moment=require(_0x9323('0x4'));var BPromise=require(_0x9323('0x5'));var rp=require(_0x9323('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9323('0x7'));var config=require(_0x9323('0x8'));var attributes=require(_0x9323('0x9'));module[_0x9323('0xa')]=function(_0x40e298,_0x5ede09){return _0x40e298[_0x9323('0xb')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x9323('0xc'),'fields':[_0x9323('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index efced3b..609fe16 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa9891c,_0x5866e9){var _0x2e3632=function(_0x4a9e96){while(--_0x4a9e96){_0xa9891c['push'](_0xa9891c['shift']());}};_0x2e3632(++_0x5866e9);}(_0x1261,0x144));var _0x1126=function(_0x788a54,_0x12450b){_0x788a54=_0x788a54-0x0;var _0x8b73a4=_0x1261[_0x788a54];return _0x8b73a4;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x269224,_0x5299cb){var _0x5045ae=function(_0x3a6f77){while(--_0x3a6f77){_0x269224['push'](_0x269224['shift']());}};_0x5045ae(++_0x5299cb);}(_0xadb5,0xad));var _0x5adb=function(_0x1f14f7,_0x590e42){_0x1f14f7=_0x1f14f7-0x0;var _0x12d34d=_0xadb5[_0x1f14f7];return _0x12d34d;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 0451708..a2d6fea 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x451d28,_0x1bca56){var _0x3a4497=function(_0x30bdb5){while(--_0x30bdb5){_0x451d28['push'](_0x451d28['shift']());}};_0x3a4497(++_0x1bca56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 9c0adb0..33f2507 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 _0x1a0a=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3c5a41,_0x558b2c){var _0x5389f5=function(_0x161ae3){while(--_0x161ae3){_0x3c5a41['push'](_0x3c5a41['shift']());}};_0x5389f5(++_0x558b2c);}(_0x1a0a,0xcd));var _0xa1a0=function(_0x1de641,_0x44d464){_0x1de641=_0x1de641-0x0;var _0xccacbc=_0x1a0a[_0x1de641];return _0xccacbc;};'use strict';var Sequelize=require(_0xa1a0('0x0'));module[_0xa1a0('0x1')]={'description':{'type':Sequelize[_0xa1a0('0x2')]},'host':{'type':Sequelize[_0xa1a0('0x2')]},'authentication':{'type':Sequelize[_0xa1a0('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa1a0('0x2')]},'password':{'type':Sequelize[_0xa1a0('0x2')]},'port':{'type':Sequelize[_0xa1a0('0x4')]},'tls':{'type':Sequelize[_0xa1a0('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa1a0('0x2')],'defaultValue':_0xa1a0('0x5')},'connTimeout':{'type':Sequelize[_0xa1a0('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa1a0('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa1a0('0x2')]},'modernAuthentication':{'type':Sequelize[_0xa1a0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2124=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x8b6e83,_0x2cabd6){var _0x21ecd5=function(_0x5c063d){while(--_0x5c063d){_0x8b6e83['push'](_0x8b6e83['shift']());}};_0x21ecd5(++_0x2cabd6);}(_0x2124,0x151));var _0x4212=function(_0x25e401,_0x137231){_0x25e401=_0x25e401-0x0;var _0x2b6ef6=_0x2124[_0x25e401];return _0x2b6ef6;};'use strict';var Sequelize=require(_0x4212('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4212('0x1')]},'authentication':{'type':Sequelize[_0x4212('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4212('0x1')]},'port':{'type':Sequelize[_0x4212('0x3')]},'tls':{'type':Sequelize[_0x4212('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4212('0x1')],'defaultValue':_0x4212('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4212('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9784436..067370f 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 _0x6bd7=['bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bd7,0xcf));var _0x76bd=function(_0x53b37c,_0x1e3dae){_0x53b37c=_0x53b37c-0x0;var _0x912a5=_0x6bd7[_0x53b37c];return _0x912a5;};'use strict';var _=require(_0x76bd('0x0'));var util=require(_0x76bd('0x1'));var logger=require(_0x76bd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x76bd('0x3'));var rp=require(_0x76bd('0x4'));var fs=require('fs');var path=require(_0x76bd('0x5'));var rimraf=require('rimraf');var config=require(_0x76bd('0x6'));var attributes=require(_0x76bd('0x7'));module['exports']=function(_0x339904,_0xc71d6c){return _0x339904['define'](_0x76bd('0x8'),attributes,{'tableName':_0x76bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cfe=['rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4b3007,_0x11ce76){var _0x4ae5f0=function(_0x5ed2d7){while(--_0x5ed2d7){_0x4b3007['push'](_0x4b3007['shift']());}};_0x4ae5f0(++_0x11ce76);}(_0x0cfe,0x124));var _0xe0cf=function(_0x2ccea9,_0x4a7395){_0x2ccea9=_0x2ccea9-0x0;var _0x4a9cdc=_0x0cfe[_0x2ccea9];return _0x4a9cdc;};'use strict';var _=require(_0xe0cf('0x0'));var util=require(_0xe0cf('0x1'));var logger=require(_0xe0cf('0x2'))(_0xe0cf('0x3'));var moment=require(_0xe0cf('0x4'));var BPromise=require(_0xe0cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0cf('0x6'));var rimraf=require(_0xe0cf('0x7'));var config=require(_0xe0cf('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xe0cf('0x9')]=function(_0x40ed8f,_0xf92f36){return _0x40ed8f[_0xe0cf('0xa')](_0xe0cf('0xb'),attributes,{'tableName':_0xe0cf('0xc'),'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 16ec2bf..5458e7b 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 _0xe706=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0x4f4758,_0x33ebe5){var _0x21da73=function(_0x42935a){while(--_0x42935a){_0x4f4758['push'](_0x4f4758['shift']());}};_0x21da73(++_0x33ebe5);}(_0xe706,0xa3));var _0x6e70=function(_0x5cc450,_0xbc6fa8){_0x5cc450=_0x5cc450-0x0;var _0x781ec6=_0xe706[_0x5cc450];return _0x781ec6;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('MailServerIn,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['MailServerIn'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetMailServerIn',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0x4860=['map','then','GetMailServerIn','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','MailServerIn,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','MailServerIn','findAll','options','raw','limit','include','model','attributes'];(function(_0x58a242,_0x803cc6){var _0x375e32=function(_0x72a7d5){while(--_0x72a7d5){_0x58a242['push'](_0x58a242['shift']());}};_0x375e32(++_0x803cc6);}(_0x4860,0x197));var _0x0486=function(_0x6ea54c,_0x37e62e){_0x6ea54c=_0x6ea54c-0x0;var _0x50c588=_0x4860[_0x6ea54c];return _0x50c588;};'use strict';var _=require(_0x0486('0x0'));var util=require(_0x0486('0x1'));var moment=require(_0x0486('0x2'));var BPromise=require('bluebird');var rs=require(_0x0486('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0486('0x4'))['db'];var utils=require(_0x0486('0x5'));var logger=require('../../config/logger')(_0x0486('0x6'));var config=require(_0x0486('0x7'));var jayson=require(_0x0486('0x8'));var client=jayson['client'][_0x0486('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147b1b,_0x550286,_0x3ceb75){return new BPromise(function(_0x61918a,_0x8ff7c7){return client['request'](_0x147b1b,_0x3ceb75)['then'](function(_0x14f579){logger[_0x0486('0xa')](_0x0486('0xb'),_0x550286,'request\x20sent');logger[_0x0486('0xc')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x550286,'request\x20sent',JSON['stringify'](_0x14f579));if(_0x14f579['error']){if(_0x14f579[_0x0486('0xd')][_0x0486('0xe')]===0x1f4){logger[_0x0486('0xd')](_0x0486('0xb'),_0x550286,_0x14f579[_0x0486('0xd')][_0x0486('0xf')]);return _0x8ff7c7(_0x14f579[_0x0486('0xd')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x550286,_0x14f579[_0x0486('0xd')][_0x0486('0xf')]);return _0x61918a(_0x14f579[_0x0486('0xd')]['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x550286,_0x0486('0x10'));_0x61918a(_0x14f579[_0x0486('0x11')][_0x0486('0xf')]);}})[_0x0486('0x12')](function(_0x285675){logger[_0x0486('0xd')](_0x0486('0xb'),_0x550286,_0x285675);_0x8ff7c7(_0x285675);});});}exports['GetMailServerIn']=function(_0x1c1206){var _0xe362ee=this;return new Promise(function(_0x2129ba,_0x178764){return db[_0x0486('0x13')][_0x0486('0x14')]({'raw':_0x1c1206[_0x0486('0x15')]?_0x1c1206['options'][_0x0486('0x16')]===undefined?!![]:![]:!![],'where':_0x1c1206['options']?_0x1c1206[_0x0486('0x15')]['where']||null:null,'attributes':_0x1c1206[_0x0486('0x15')]?_0x1c1206[_0x0486('0x15')]['attributes']||null:null,'limit':_0x1c1206[_0x0486('0x15')]?_0x1c1206[_0x0486('0x15')][_0x0486('0x17')]||null:null,'include':_0x1c1206[_0x0486('0x15')]?_0x1c1206['options'][_0x0486('0x18')]?_['map'](_0x1c1206[_0x0486('0x15')][_0x0486('0x18')],function(_0x1acfc1){return{'model':db[_0x1acfc1[_0x0486('0x19')]],'as':_0x1acfc1['as'],'attributes':_0x1acfc1[_0x0486('0x1a')],'include':_0x1acfc1[_0x0486('0x18')]?_[_0x0486('0x1b')](_0x1acfc1[_0x0486('0x18')],function(_0x3e0356){return{'model':db[_0x3e0356[_0x0486('0x19')]],'as':_0x3e0356['as'],'attributes':_0x3e0356[_0x0486('0x1a')],'include':_0x3e0356[_0x0486('0x18')]?_['map'](_0x3e0356['include'],function(_0x2e32e4){return{'model':db[_0x2e32e4[_0x0486('0x19')]],'as':_0x2e32e4['as'],'attributes':_0x2e32e4[_0x0486('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0486('0x1c')](function(_0x3f454d){logger[_0x0486('0xa')](_0x0486('0x1d'),_0x1c1206);logger[_0x0486('0xc')]('GetMailServerIn',_0x1c1206,JSON[_0x0486('0x1e')](_0x3f454d));_0x2129ba(_0x3f454d);})[_0x0486('0x12')](function(_0x39de52){logger[_0x0486('0xd')]('GetMailServerIn',_0x39de52[_0x0486('0xf')],_0x1c1206);_0x178764(_0xe362ee[_0x0486('0xd')](0x1f4,_0x39de52[_0x0486('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f5841a5..74b1768 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x469c5c,_0x2679ae){_0x469c5c=_0x469c5c-0x0;var _0x263c12=_0x7a54[_0x469c5c];return _0x263c12;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _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(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a54,0x106));var _0x47a5=function(_0x5de0a0,_0x46e53b){_0x5de0a0=_0x5de0a0-0x0;var _0x2ded44=_0x7a54[_0x5de0a0];return _0x2ded44;};'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 67d7eda..8ea26c9 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 _0xea28=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0xea28,0x13a));var _0x8ea2=function(_0x2f9060,_0xde03dc){_0x2f9060=_0x2f9060-0x0;var _0x38df94=_0xea28[_0x2f9060];return _0x38df94;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'description':{'type':Sequelize[_0x8ea2('0x2')]},'host':{'type':Sequelize[_0x8ea2('0x2')]},'user':{'type':Sequelize[_0x8ea2('0x2')]},'pass':{'type':Sequelize[_0x8ea2('0x2')]},'port':{'type':Sequelize[_0x8ea2('0x3')]},'secure':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xbaf0=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x398acc,_0x21f70b){var _0x6a9478=function(_0x57591d){while(--_0x57591d){_0x398acc['push'](_0x398acc['shift']());}};_0x6a9478(++_0x21f70b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'description':{'type':Sequelize[_0x0baf('0x1')]},'host':{'type':Sequelize[_0x0baf('0x1')]},'user':{'type':Sequelize[_0x0baf('0x1')]},'pass':{'type':Sequelize[_0x0baf('0x1')]},'port':{'type':Sequelize[_0x0baf('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0baf('0x1')]},'authentication':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 086ba54..2656d17 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 _0x2602=['order','sort','where','pick','filter','VIRTUAL','options','MailServerOut','includeAll','rows','catch','params','include','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x488fe6,_0xf52c16){var _0x2e53f6=function(_0x797567){while(--_0x797567){_0x488fe6['push'](_0x488fe6['shift']());}};_0x2e53f6(++_0xf52c16);}(_0x2602,0xef));var _0x2260=function(_0xbcd3c2,_0x4e5f51){_0xbcd3c2=_0xbcd3c2-0x0;var _0x9ca908=_0x2602[_0xbcd3c2];return _0x9ca908;};'use strict';var emlformat=require(_0x2260('0x0'));var rimraf=require(_0x2260('0x1'));var zipdir=require(_0x2260('0x2'));var jsonpatch=require(_0x2260('0x3'));var rp=require('request-promise');var moment=require(_0x2260('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2260('0x5'));var util=require(_0x2260('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2260('0x7'));var fs=require('fs');var fs_extra=require(_0x2260('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2260('0x9'));var jsforce=require(_0x2260('0xa'));var deskjs=require(_0x2260('0xb'));var toCsv=require(_0x2260('0xc'));var querystring=require('querystring');var Papa=require(_0x2260('0xd'));var Redis=require(_0x2260('0xe'));var authService=require(_0x2260('0xf'));var qs=require(_0x2260('0x10'));var as=require(_0x2260('0x11'));var hardwareService=require(_0x2260('0x12'));var logger=require(_0x2260('0x13'))(_0x2260('0x14'));var utils=require(_0x2260('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2260('0x16'));var db=require(_0x2260('0x17'))['db'];function respondWithStatusCode(_0x107167,_0x565a69){_0x565a69=_0x565a69||0xcc;return function(_0x548ab2){if(_0x548ab2){return _0x107167['sendStatus'](_0x565a69);}return _0x107167[_0x2260('0x18')](_0x565a69)['end']();};}function respondWithResult(_0x2b8c80,_0xad8cd6){_0xad8cd6=_0xad8cd6||0xc8;return function(_0x367af2){if(_0x367af2){return _0x2b8c80['status'](_0xad8cd6)[_0x2260('0x19')](_0x367af2);}};}function respondWithFilteredResult(_0x41173f,_0x2ec9f5){return function(_0x151031){if(_0x151031){var _0x3201ea=typeof _0x2ec9f5['offset']==='undefined'&&typeof _0x2ec9f5[_0x2260('0x1a')]===_0x2260('0x1b');var _0x4ddcdd=_0x151031[_0x2260('0x1c')];var _0x1010ee=_0x3201ea?0x0:_0x2ec9f5['offset'];var _0x5cf046=_0x3201ea?_0x151031['count']:_0x2ec9f5[_0x2260('0x1d')]+_0x2ec9f5['limit'];var _0xc33fb5;if(_0x5cf046>=_0x4ddcdd){_0x5cf046=_0x4ddcdd;_0xc33fb5=0xc8;}else{_0xc33fb5=0xce;}_0x41173f[_0x2260('0x18')](_0xc33fb5);return _0x41173f[_0x2260('0x1e')](_0x2260('0x1f'),_0x1010ee+'-'+_0x5cf046+'/'+_0x4ddcdd)[_0x2260('0x19')](_0x151031);}return null;};}function patchUpdates(_0xf0a79){return function(_0x5630d6){try{jsonpatch['apply'](_0x5630d6,_0xf0a79,!![]);}catch(_0x27cde1){return BPromise[_0x2260('0x20')](_0x27cde1);}return _0x5630d6[_0x2260('0x21')]();};}function saveUpdates(_0xdec441,_0x3c46f7){return function(_0x558c3b){if(_0x558c3b){return _0x558c3b[_0x2260('0x22')](_0xdec441)['then'](function(_0x151ac8){return _0x151ac8;});}return null;};}function removeEntity(_0x2ac01b,_0x4cdfc3){return function(_0x657977){if(_0x657977){return _0x657977[_0x2260('0x23')]()[_0x2260('0x24')](function(){_0x2ac01b[_0x2260('0x18')](0xcc)[_0x2260('0x25')]();});}};}function handleEntityNotFound(_0x49fe45,_0x45eeb1){return function(_0xeb3e9d){if(!_0xeb3e9d){_0x49fe45[_0x2260('0x26')](0x194);}return _0xeb3e9d;};}function handleError(_0x40fa77,_0x124383){_0x124383=_0x124383||0x1f4;return function(_0x57b021){logger[_0x2260('0x27')](_0x57b021[_0x2260('0x28')]);if(_0x57b021['name']){delete _0x57b021['name'];}_0x40fa77[_0x2260('0x18')](_0x124383)[_0x2260('0x29')](_0x57b021);};}exports[_0x2260('0x2a')]=function(_0x3fa3b5,_0x3c3284){var _0x540ec7={},_0x22e2ee={},_0x1cb153={'count':0x0,'rows':[]};var _0x5b8402=_[_0x2260('0x2b')](db['MailServerOut'][_0x2260('0x2c')],function(_0x1b69f6){return{'name':_0x1b69f6['fieldName'],'type':_0x1b69f6[_0x2260('0x2d')][_0x2260('0x2e')]};});_0x22e2ee[_0x2260('0x2f')]=_['map'](_0x5b8402,_0x2260('0x30'));_0x22e2ee[_0x2260('0x31')]=_[_0x2260('0x32')](_0x3fa3b5['query']);_0x22e2ee[_0x2260('0x33')]=_[_0x2260('0x34')](_0x22e2ee['model'],_0x22e2ee[_0x2260('0x31')]);_0x540ec7['attributes']=_['intersection'](_0x22e2ee['model'],qs[_0x2260('0x35')](_0x3fa3b5['query'][_0x2260('0x35')]));_0x540ec7[_0x2260('0x36')]=_0x540ec7[_0x2260('0x36')][_0x2260('0x37')]?_0x540ec7[_0x2260('0x36')]:_0x22e2ee[_0x2260('0x2f')];if(!_0x3fa3b5[_0x2260('0x31')][_0x2260('0x38')]('nolimit')){_0x540ec7[_0x2260('0x1a')]=qs['limit'](_0x3fa3b5['query'][_0x2260('0x1a')]);_0x540ec7['offset']=qs[_0x2260('0x1d')](_0x3fa3b5[_0x2260('0x31')][_0x2260('0x1d')]);}_0x540ec7[_0x2260('0x39')]=qs[_0x2260('0x3a')](_0x3fa3b5[_0x2260('0x31')][_0x2260('0x3a')]);_0x540ec7[_0x2260('0x3b')]=qs[_0x2260('0x33')](_[_0x2260('0x3c')](_0x3fa3b5[_0x2260('0x31')],_0x22e2ee[_0x2260('0x33')]),_0x5b8402);if(_0x3fa3b5['query'][_0x2260('0x3d')]){_0x540ec7[_0x2260('0x3b')]=_['merge'](_0x540ec7[_0x2260('0x3b')],{'$or':_[_0x2260('0x2b')](_0x5b8402,function(_0x2426ed){if(_0x2426ed[_0x2260('0x2d')]!==_0x2260('0x3e')){var _0x12cdb8={};_0x12cdb8[_0x2426ed[_0x2260('0x30')]]={'$like':'%'+_0x3fa3b5[_0x2260('0x31')]['filter']+'%'};return _0x12cdb8;}})});}_0x540ec7=_['merge']({},_0x540ec7,_0x3fa3b5[_0x2260('0x3f')]);var _0x13685d={'where':_0x540ec7[_0x2260('0x3b')]};return db[_0x2260('0x40')]['count'](_0x13685d)[_0x2260('0x24')](function(_0x1a23db){_0x1cb153['count']=_0x1a23db;if(_0x3fa3b5['query'][_0x2260('0x41')]){_0x540ec7['include']=[{'all':!![]}];}return db[_0x2260('0x40')]['findAll'](_0x540ec7);})[_0x2260('0x24')](function(_0x236e31){_0x1cb153[_0x2260('0x42')]=_0x236e31;return _0x1cb153;})[_0x2260('0x24')](respondWithFilteredResult(_0x3c3284,_0x540ec7))[_0x2260('0x43')](handleError(_0x3c3284,null));};exports['show']=function(_0x28c6c7,_0x30d400){var _0x20d6b7={'raw':!![],'where':{'id':_0x28c6c7[_0x2260('0x44')]['id']}},_0x3c0251={};_0x3c0251[_0x2260('0x2f')]=_['keys'](db[_0x2260('0x40')][_0x2260('0x2c')]);_0x3c0251[_0x2260('0x31')]=_[_0x2260('0x32')](_0x28c6c7['query']);_0x3c0251[_0x2260('0x33')]=_[_0x2260('0x34')](_0x3c0251[_0x2260('0x2f')],_0x3c0251['query']);_0x20d6b7[_0x2260('0x36')]=_[_0x2260('0x34')](_0x3c0251[_0x2260('0x2f')],qs[_0x2260('0x35')](_0x28c6c7[_0x2260('0x31')][_0x2260('0x35')]));_0x20d6b7[_0x2260('0x36')]=_0x20d6b7['attributes'][_0x2260('0x37')]?_0x20d6b7[_0x2260('0x36')]:_0x3c0251[_0x2260('0x2f')];if(_0x28c6c7[_0x2260('0x31')][_0x2260('0x41')]){_0x20d6b7[_0x2260('0x45')]=[{'all':!![]}];}_0x20d6b7=_[_0x2260('0x46')]({},_0x20d6b7,_0x28c6c7[_0x2260('0x3f')]);return db[_0x2260('0x40')][_0x2260('0x47')](_0x20d6b7)[_0x2260('0x24')](handleEntityNotFound(_0x30d400,null))[_0x2260('0x24')](respondWithResult(_0x30d400,null))[_0x2260('0x43')](handleError(_0x30d400,null));};exports['create']=function(_0x4d41ce,_0x184da3){return db[_0x2260('0x40')][_0x2260('0x48')](_0x4d41ce[_0x2260('0x49')],{})[_0x2260('0x24')](respondWithResult(_0x184da3,0xc9))[_0x2260('0x43')](handleError(_0x184da3,null));};exports['update']=function(_0x37b809,_0x528012){if(_0x37b809['body']['id']){delete _0x37b809['body']['id'];}return db[_0x2260('0x40')][_0x2260('0x47')]({'where':{'id':_0x37b809[_0x2260('0x44')]['id']}})[_0x2260('0x24')](handleEntityNotFound(_0x528012,null))['then'](saveUpdates(_0x37b809[_0x2260('0x49')],null))[_0x2260('0x24')](respondWithResult(_0x528012,null))[_0x2260('0x43')](handleError(_0x528012,null));};exports[_0x2260('0x23')]=function(_0x4048f9,_0x333998){return db[_0x2260('0x40')][_0x2260('0x47')]({'where':{'id':_0x4048f9[_0x2260('0x44')]['id']}})['then'](handleEntityNotFound(_0x333998,null))[_0x2260('0x24')](removeEntity(_0x333998,null))[_0x2260('0x43')](handleError(_0x333998,null));}; \ No newline at end of file +var _0x37c9=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','include','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x33589,_0x35d1d3){var _0x455465=function(_0x16ee6b){while(--_0x16ee6b){_0x33589['push'](_0x33589['shift']());}};_0x455465(++_0x35d1d3);}(_0x37c9,0xc7));var _0x937c=function(_0x598004,_0x1bbc94){_0x598004=_0x598004-0x0;var _0x2d2f41=_0x37c9[_0x598004];return _0x2d2f41;};'use strict';var emlformat=require(_0x937c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x937c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x937c('0x2'));var moment=require(_0x937c('0x3'));var BPromise=require(_0x937c('0x4'));var Mustache=require(_0x937c('0x5'));var util=require(_0x937c('0x6'));var path=require('path');var sox=require(_0x937c('0x7'));var csv=require('to-csv');var ejs=require(_0x937c('0x8'));var fs=require('fs');var fs_extra=require(_0x937c('0x9'));var _=require(_0x937c('0xa'));var squel=require(_0x937c('0xb'));var crypto=require(_0x937c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x937c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x937c('0xe'));var Papa=require('papaparse');var Redis=require(_0x937c('0xf'));var authService=require(_0x937c('0x10'));var qs=require(_0x937c('0x11'));var as=require(_0x937c('0x12'));var hardwareService=require(_0x937c('0x13'));var logger=require(_0x937c('0x14'))('api');var utils=require(_0x937c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x937c('0x16'));var db=require(_0x937c('0x17'))['db'];function respondWithStatusCode(_0x3f8ddc,_0x91d8d9){_0x91d8d9=_0x91d8d9||0xcc;return function(_0x233bc8){if(_0x233bc8){return _0x3f8ddc[_0x937c('0x18')](_0x91d8d9);}return _0x3f8ddc[_0x937c('0x19')](_0x91d8d9)['end']();};}function respondWithResult(_0x5e16e9,_0x6282c1){_0x6282c1=_0x6282c1||0xc8;return function(_0x350a18){if(_0x350a18){return _0x5e16e9[_0x937c('0x19')](_0x6282c1)[_0x937c('0x1a')](_0x350a18);}};}function respondWithFilteredResult(_0x185d9d,_0x5e5802){return function(_0x80489e){if(_0x80489e){var _0x266a02=typeof _0x5e5802[_0x937c('0x1b')]===_0x937c('0x1c')&&typeof _0x5e5802[_0x937c('0x1d')]===_0x937c('0x1c');var _0x258d91=_0x80489e[_0x937c('0x1e')];var _0x333201=_0x266a02?0x0:_0x5e5802[_0x937c('0x1b')];var _0x4206a6=_0x266a02?_0x80489e[_0x937c('0x1e')]:_0x5e5802[_0x937c('0x1b')]+_0x5e5802[_0x937c('0x1d')];var _0x5b5f77;if(_0x4206a6>=_0x258d91){_0x4206a6=_0x258d91;_0x5b5f77=0xc8;}else{_0x5b5f77=0xce;}_0x185d9d['status'](_0x5b5f77);return _0x185d9d[_0x937c('0x1f')](_0x937c('0x20'),_0x333201+'-'+_0x4206a6+'/'+_0x258d91)[_0x937c('0x1a')](_0x80489e);}return null;};}function patchUpdates(_0x4452e1){return function(_0x258877){try{jsonpatch['apply'](_0x258877,_0x4452e1,!![]);}catch(_0x1f9122){return BPromise[_0x937c('0x21')](_0x1f9122);}return _0x258877[_0x937c('0x22')]();};}function saveUpdates(_0xfddf65,_0x1cec70){return function(_0x319db3){if(_0x319db3){return _0x319db3[_0x937c('0x23')](_0xfddf65)[_0x937c('0x24')](function(_0x234b33){return _0x234b33;});}return null;};}function removeEntity(_0x514351,_0x243f84){return function(_0xd05080){if(_0xd05080){return _0xd05080[_0x937c('0x25')]()[_0x937c('0x24')](function(){_0x514351[_0x937c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f99d,_0x4fe5f8){return function(_0x4d1123){if(!_0x4d1123){_0x46f99d['sendStatus'](0x194);}return _0x4d1123;};}function handleError(_0x8d152d,_0x1d1c25){_0x1d1c25=_0x1d1c25||0x1f4;return function(_0x5d5bc4){logger[_0x937c('0x26')](_0x5d5bc4[_0x937c('0x27')]);if(_0x5d5bc4[_0x937c('0x28')]){delete _0x5d5bc4[_0x937c('0x28')];}_0x8d152d[_0x937c('0x19')](_0x1d1c25)[_0x937c('0x29')](_0x5d5bc4);};}exports[_0x937c('0x2a')]=function(_0x570c2b,_0x3c2268){var _0x433dba={},_0x4ddb9b={},_0x5d43fc={'count':0x0,'rows':[]};var _0x1a9c80=_['map'](db[_0x937c('0x2b')][_0x937c('0x2c')],function(_0x330424){return{'name':_0x330424[_0x937c('0x2d')],'type':_0x330424[_0x937c('0x2e')][_0x937c('0x2f')]};});_0x4ddb9b[_0x937c('0x30')]=_[_0x937c('0x31')](_0x1a9c80,_0x937c('0x28'));_0x4ddb9b['query']=_['keys'](_0x570c2b[_0x937c('0x32')]);_0x4ddb9b[_0x937c('0x33')]=_[_0x937c('0x34')](_0x4ddb9b[_0x937c('0x30')],_0x4ddb9b[_0x937c('0x32')]);_0x433dba[_0x937c('0x35')]=_[_0x937c('0x34')](_0x4ddb9b[_0x937c('0x30')],qs[_0x937c('0x36')](_0x570c2b[_0x937c('0x32')]['fields']));_0x433dba[_0x937c('0x35')]=_0x433dba[_0x937c('0x35')][_0x937c('0x37')]?_0x433dba[_0x937c('0x35')]:_0x4ddb9b[_0x937c('0x30')];if(!_0x570c2b[_0x937c('0x32')]['hasOwnProperty'](_0x937c('0x38'))){_0x433dba[_0x937c('0x1d')]=qs['limit'](_0x570c2b[_0x937c('0x32')]['limit']);_0x433dba['offset']=qs[_0x937c('0x1b')](_0x570c2b['query'][_0x937c('0x1b')]);}_0x433dba[_0x937c('0x39')]=qs[_0x937c('0x3a')](_0x570c2b[_0x937c('0x32')][_0x937c('0x3a')]);_0x433dba[_0x937c('0x3b')]=qs[_0x937c('0x33')](_['pick'](_0x570c2b[_0x937c('0x32')],_0x4ddb9b[_0x937c('0x33')]),_0x1a9c80);if(_0x570c2b[_0x937c('0x32')][_0x937c('0x3c')]){_0x433dba['where']=_[_0x937c('0x3d')](_0x433dba[_0x937c('0x3b')],{'$or':_[_0x937c('0x31')](_0x1a9c80,function(_0x428edc){if(_0x428edc[_0x937c('0x2e')]!==_0x937c('0x3e')){var _0x4b0c1a={};_0x4b0c1a[_0x428edc[_0x937c('0x28')]]={'$like':'%'+_0x570c2b[_0x937c('0x32')][_0x937c('0x3c')]+'%'};return _0x4b0c1a;}})});}_0x433dba=_[_0x937c('0x3d')]({},_0x433dba,_0x570c2b[_0x937c('0x3f')]);var _0x1e6c1a={'where':_0x433dba[_0x937c('0x3b')]};return db[_0x937c('0x2b')][_0x937c('0x1e')](_0x1e6c1a)[_0x937c('0x24')](function(_0x3472d5){_0x5d43fc[_0x937c('0x1e')]=_0x3472d5;if(_0x570c2b[_0x937c('0x32')]['includeAll']){_0x433dba['include']=[{'all':!![]}];}return db[_0x937c('0x2b')][_0x937c('0x40')](_0x433dba);})[_0x937c('0x24')](function(_0x39595d){_0x5d43fc[_0x937c('0x41')]=_0x39595d;return _0x5d43fc;})[_0x937c('0x24')](respondWithFilteredResult(_0x3c2268,_0x433dba))[_0x937c('0x42')](handleError(_0x3c2268,null));};exports[_0x937c('0x43')]=function(_0xee26ba,_0x1fa9ef){var _0xf6b0d8={'raw':!![],'where':{'id':_0xee26ba[_0x937c('0x44')]['id']}},_0x54c181={};_0x54c181[_0x937c('0x30')]=_['keys'](db[_0x937c('0x2b')][_0x937c('0x2c')]);_0x54c181[_0x937c('0x32')]=_[_0x937c('0x45')](_0xee26ba[_0x937c('0x32')]);_0x54c181[_0x937c('0x33')]=_[_0x937c('0x34')](_0x54c181[_0x937c('0x30')],_0x54c181['query']);_0xf6b0d8[_0x937c('0x35')]=_[_0x937c('0x34')](_0x54c181[_0x937c('0x30')],qs[_0x937c('0x36')](_0xee26ba[_0x937c('0x32')][_0x937c('0x36')]));_0xf6b0d8[_0x937c('0x35')]=_0xf6b0d8[_0x937c('0x35')]['length']?_0xf6b0d8[_0x937c('0x35')]:_0x54c181[_0x937c('0x30')];if(_0xee26ba[_0x937c('0x32')]['includeAll']){_0xf6b0d8[_0x937c('0x46')]=[{'all':!![]}];}_0xf6b0d8=_[_0x937c('0x3d')]({},_0xf6b0d8,_0xee26ba[_0x937c('0x3f')]);return db[_0x937c('0x2b')]['find'](_0xf6b0d8)['then'](handleEntityNotFound(_0x1fa9ef,null))[_0x937c('0x24')](respondWithResult(_0x1fa9ef,null))[_0x937c('0x42')](handleError(_0x1fa9ef,null));};exports[_0x937c('0x47')]=function(_0x19e3c0,_0x4ead0d){return db['MailServerOut']['create'](_0x19e3c0[_0x937c('0x48')],{})[_0x937c('0x24')](respondWithResult(_0x4ead0d,0xc9))[_0x937c('0x42')](handleError(_0x4ead0d,null));};exports[_0x937c('0x23')]=function(_0x5afcee,_0x41157a){if(_0x5afcee[_0x937c('0x48')]['id']){delete _0x5afcee['body']['id'];}return db[_0x937c('0x2b')]['find']({'where':{'id':_0x5afcee['params']['id']}})[_0x937c('0x24')](handleEntityNotFound(_0x41157a,null))['then'](saveUpdates(_0x5afcee[_0x937c('0x48')],null))[_0x937c('0x24')](respondWithResult(_0x41157a,null))[_0x937c('0x42')](handleError(_0x41157a,null));};exports['destroy']=function(_0x12985e,_0x9c9867){return db[_0x937c('0x2b')]['find']({'where':{'id':_0x12985e[_0x937c('0x44')]['id']}})[_0x937c('0x24')](handleEntityNotFound(_0x9c9867,null))[_0x937c('0x24')](removeEntity(_0x9c9867,null))[_0x937c('0x42')](handleError(_0x9c9867,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 8792a87..9ba42bb 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 _0xeaff=['./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util','moment','bluebird','path','../../config/environment'];(function(_0x5a26d5,_0x317a00){var _0x1e6190=function(_0x178b48){while(--_0x178b48){_0x5a26d5['push'](_0x5a26d5['shift']());}};_0x1e6190(++_0x317a00);}(_0xeaff,0x86));var _0xfeaf=function(_0x3c77bd,_0x9c6881){_0x3c77bd=_0x3c77bd-0x0;var _0xfd870d=_0xeaff[_0x3c77bd];return _0xfd870d;};'use strict';var _=require(_0xfeaf('0x0'));var util=require(_0xfeaf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfeaf('0x2'));var BPromise=require(_0xfeaf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfeaf('0x4'));var rimraf=require('rimraf');var config=require(_0xfeaf('0x5'));var attributes=require(_0xfeaf('0x6'));module[_0xfeaf('0x7')]=function(_0x2cbaf2,_0x3c85e){return _0x2cbaf2['define'](_0xfeaf('0x8'),attributes,{'tableName':_0xfeaf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99d5=['mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x99d5,0x1cf));var _0x599d=function(_0x3130cd,_0x23d467){_0x3130cd=_0x3130cd-0x0;var _0x3f658c=_0x99d5[_0x3130cd];return _0x3f658c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x599d('0x0'))(_0x599d('0x1'));var moment=require(_0x599d('0x2'));var BPromise=require(_0x599d('0x3'));var rp=require(_0x599d('0x4'));var fs=require('fs');var path=require(_0x599d('0x5'));var rimraf=require(_0x599d('0x6'));var config=require(_0x599d('0x7'));var attributes=require(_0x599d('0x8'));module['exports']=function(_0x4073f7,_0x18e757){return _0x4073f7[_0x599d('0x9')]('MailServerOut',attributes,{'tableName':_0x599d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index a293344..b6a9e24 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(_0x121e7e,_0x548791){var _0x177553=function(_0x538c03){while(--_0x538c03){_0x121e7e['push'](_0x121e7e['shift']());}};_0x177553(++_0x548791);}(_0xdb28,0x106));var _0x8db2=function(_0x524c7f,_0x43b1ba){_0x524c7f=_0x524c7f-0x0;var _0x5a9780=_0xdb28[_0x524c7f];return _0x5a9780;};'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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x131e60,_0x5352ce){var _0x4bc497=function(_0x2a758e){while(--_0x2a758e){_0x131e60['push'](_0x131e60['shift']());}};_0x4bc497(++_0x5352ce);}(_0x2ef3,0xba));var _0x32ef=function(_0x78ebdb,_0x2193de){_0x78ebdb=_0x78ebdb-0x0;var _0xa93ce2=_0x2ef3[_0x78ebdb];return _0xa93ce2;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c9c8ab8..42cb98a 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 _0x9eba=['index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9eba,0x1c4));var _0xa9eb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9eba[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xa9eb('0x0'));var util=require(_0xa9eb('0x1'));var path=require(_0xa9eb('0x2'));var timeout=require(_0xa9eb('0x3'));var express=require(_0xa9eb('0x4'));var router=express[_0xa9eb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9eb('0x6'));var controller=require(_0xa9eb('0x7'));router[_0xa9eb('0x8')]('/',auth[_0xa9eb('0x9')](),controller[_0xa9eb('0xa')]);router['get'](_0xa9eb('0xb'),auth['isAuthenticated'](),controller[_0xa9eb('0xc')]);router[_0xa9eb('0x8')](_0xa9eb('0xd'),auth['isAuthenticated'](),controller[_0xa9eb('0xe')]);router[_0xa9eb('0xf')]('/',auth[_0xa9eb('0x9')](),controller[_0xa9eb('0x10')]);router['put'](_0xa9eb('0xd'),auth[_0xa9eb('0x9')](),controller[_0xa9eb('0x11')]);router[_0xa9eb('0x12')](_0xa9eb('0xd'),auth[_0xa9eb('0x9')](),controller[_0xa9eb('0x13')]);module[_0xa9eb('0x14')]=router; \ No newline at end of file +var _0xdcfe=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x1a5f94,_0x19b888){var _0x352348=function(_0x16c899){while(--_0x16c899){_0x1a5f94['push'](_0x1a5f94['shift']());}};_0x352348(++_0x19b888);}(_0xdcfe,0x11e));var _0xedcf=function(_0x3bdd38,_0x182678){_0x3bdd38=_0x3bdd38-0x0;var _0x2c9a2e=_0xdcfe[_0x3bdd38];return _0x2c9a2e;};'use strict';var multer=require('multer');var util=require(_0xedcf('0x0'));var path=require(_0xedcf('0x1'));var timeout=require(_0xedcf('0x2'));var express=require(_0xedcf('0x3'));var router=express[_0xedcf('0x4')]();var fs_extra=require(_0xedcf('0x5'));var auth=require(_0xedcf('0x6'));var interaction=require(_0xedcf('0x7'));var config=require(_0xedcf('0x8'));var controller=require(_0xedcf('0x9'));router[_0xedcf('0xa')]('/',auth[_0xedcf('0xb')](),controller['index']);router[_0xedcf('0xa')](_0xedcf('0xc'),auth['isAuthenticated'](),controller[_0xedcf('0xd')]);router['get'](_0xedcf('0xe'),auth[_0xedcf('0xb')](),controller[_0xedcf('0xf')]);router[_0xedcf('0x10')]('/',auth[_0xedcf('0xb')](),controller[_0xedcf('0x11')]);router['put'](_0xedcf('0xe'),auth[_0xedcf('0xb')](),controller[_0xedcf('0x12')]);router[_0xedcf('0x13')]('/:id',auth[_0xedcf('0xb')](),controller[_0xedcf('0x14')]);module[_0xedcf('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e71f238..d782702 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 _0x02a7=['exports','STRING'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x02a7,0x7a));var _0x702a=function(_0x34ab8a,_0xa22dc4){_0x34ab8a=_0x34ab8a-0x0;var _0x11d66b=_0x02a7[_0x34ab8a];return _0x11d66b;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file +var _0x8506=['exports','name'];(function(_0x3709cf,_0x49f163){var _0x53c92d=function(_0x9aee44){while(--_0x9aee44){_0x3709cf['push'](_0x3709cf['shift']());}};_0x53c92d(++_0x49f163);}(_0x8506,0xe8));var _0x6850=function(_0x14e4af,_0x3269f5){_0x14e4af=_0x14e4af-0x0;var _0x1412cb=_0x8506[_0x14e4af];return _0x1412cb;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 628312b..8497fc3 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 _0x1a89=['map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x102f0a,_0x13474d){var _0x35e503=function(_0x104b81){while(--_0x104b81){_0x102f0a['push'](_0x102f0a['shift']());}};_0x35e503(++_0x13474d);}(_0x1a89,0x1de));var _0x91a8=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1a89[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x91a8('0x0'));var jsonpatch=require(_0x91a8('0x1'));var rp=require(_0x91a8('0x2'));var moment=require(_0x91a8('0x3'));var BPromise=require(_0x91a8('0x4'));var Mustache=require('mustache');var util=require(_0x91a8('0x5'));var path=require(_0x91a8('0x6'));var sox=require(_0x91a8('0x7'));var csv=require(_0x91a8('0x8'));var ejs=require(_0x91a8('0x9'));var fs=require('fs');var fs_extra=require(_0x91a8('0xa'));var _=require(_0x91a8('0xb'));var squel=require(_0x91a8('0xc'));var crypto=require(_0x91a8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x91a8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91a8('0xf'));var authService=require(_0x91a8('0x10'));var qs=require(_0x91a8('0x11'));var as=require(_0x91a8('0x12'));var hardwareService=require(_0x91a8('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91a8('0x14'));var licenseUtil=require(_0x91a8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x311291,_0x3b9054){_0x3b9054=_0x3b9054||0xcc;return function(_0x1bee5c){if(_0x1bee5c){return _0x311291[_0x91a8('0x16')](_0x3b9054);}return _0x311291['status'](_0x3b9054)[_0x91a8('0x17')]();};}function respondWithResult(_0xc2d03c,_0x4ca0b8){_0x4ca0b8=_0x4ca0b8||0xc8;return function(_0x4f249e){if(_0x4f249e){return _0xc2d03c[_0x91a8('0x18')](_0x4ca0b8)[_0x91a8('0x19')](_0x4f249e);}};}function respondWithFilteredResult(_0x302967,_0x50805b){return function(_0x846eef){if(_0x846eef){var _0x11a205=typeof _0x50805b['offset']===_0x91a8('0x1a')&&typeof _0x50805b['limit']===_0x91a8('0x1a');var _0x5222c9=_0x846eef[_0x91a8('0x1b')];var _0x39a0e4=_0x11a205?0x0:_0x50805b['offset'];var _0x10b1eb=_0x11a205?_0x846eef['count']:_0x50805b[_0x91a8('0x1c')]+_0x50805b[_0x91a8('0x1d')];var _0x28afbd;if(_0x10b1eb>=_0x5222c9){_0x10b1eb=_0x5222c9;_0x28afbd=0xc8;}else{_0x28afbd=0xce;}_0x302967[_0x91a8('0x18')](_0x28afbd);return _0x302967[_0x91a8('0x1e')](_0x91a8('0x1f'),_0x39a0e4+'-'+_0x10b1eb+'/'+_0x5222c9)[_0x91a8('0x19')](_0x846eef);}return null;};}function patchUpdates(_0x45c213){return function(_0x397b14){try{jsonpatch[_0x91a8('0x20')](_0x397b14,_0x45c213,!![]);}catch(_0x4a254a){return BPromise[_0x91a8('0x21')](_0x4a254a);}return _0x397b14[_0x91a8('0x22')]();};}function saveUpdates(_0x1002ec,_0x46de20){return function(_0x4b277e){if(_0x4b277e){return _0x4b277e[_0x91a8('0x23')](_0x1002ec)[_0x91a8('0x24')](function(_0x4b6cb4){return _0x4b6cb4;});}return null;};}function removeEntity(_0x2ae7c2,_0x5074ef){return function(_0x4b70fd){if(_0x4b70fd){return _0x4b70fd['destroy']()[_0x91a8('0x24')](function(){_0x2ae7c2[_0x91a8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5edc65,_0x3026ab){return function(_0x374f74){if(!_0x374f74){_0x5edc65[_0x91a8('0x16')](0x194);}return _0x374f74;};}function handleError(_0x6d11e6,_0x3af6b6){_0x3af6b6=_0x3af6b6||0x1f4;return function(_0xeab0eb){logger[_0x91a8('0x25')](_0xeab0eb['stack']);if(_0xeab0eb[_0x91a8('0x26')]){delete _0xeab0eb['name'];}_0x6d11e6[_0x91a8('0x18')](_0x3af6b6)[_0x91a8('0x27')](_0xeab0eb);};}exports['index']=function(_0x41d2f6,_0x54e31d){var _0x1a8229={},_0x167be7={},_0x2a694e={'count':0x0,'rows':[]};var _0x2a0065=_[_0x91a8('0x28')](db[_0x91a8('0x29')][_0x91a8('0x2a')],function(_0x125897){return{'name':_0x125897[_0x91a8('0x2b')],'type':_0x125897[_0x91a8('0x2c')][_0x91a8('0x2d')]};});_0x167be7[_0x91a8('0x2e')]=_[_0x91a8('0x28')](_0x2a0065,'name');_0x167be7['query']=_[_0x91a8('0x2f')](_0x41d2f6[_0x91a8('0x30')]);_0x167be7[_0x91a8('0x31')]=_[_0x91a8('0x32')](_0x167be7[_0x91a8('0x2e')],_0x167be7[_0x91a8('0x30')]);_0x1a8229['attributes']=_[_0x91a8('0x32')](_0x167be7['model'],qs[_0x91a8('0x33')](_0x41d2f6[_0x91a8('0x30')][_0x91a8('0x33')]));_0x1a8229[_0x91a8('0x34')]=_0x1a8229[_0x91a8('0x34')]['length']?_0x1a8229[_0x91a8('0x34')]:_0x167be7[_0x91a8('0x2e')];if(!_0x41d2f6[_0x91a8('0x30')][_0x91a8('0x35')](_0x91a8('0x36'))){_0x1a8229['limit']=qs[_0x91a8('0x1d')](_0x41d2f6['query']['limit']);_0x1a8229['offset']=qs[_0x91a8('0x1c')](_0x41d2f6[_0x91a8('0x30')][_0x91a8('0x1c')]);}_0x1a8229[_0x91a8('0x37')]=qs[_0x91a8('0x38')](_0x41d2f6['query'][_0x91a8('0x38')]);_0x1a8229[_0x91a8('0x39')]=qs[_0x91a8('0x31')](_[_0x91a8('0x3a')](_0x41d2f6['query'],_0x167be7[_0x91a8('0x31')]),_0x2a0065);if(_0x41d2f6[_0x91a8('0x30')][_0x91a8('0x3b')]){_0x1a8229[_0x91a8('0x39')]=_[_0x91a8('0x3c')](_0x1a8229[_0x91a8('0x39')],{'$or':_[_0x91a8('0x28')](_0x2a0065,function(_0x933a2){if(_0x933a2[_0x91a8('0x2c')]!==_0x91a8('0x3d')){var _0x1298a8={};_0x1298a8[_0x933a2[_0x91a8('0x26')]]={'$like':'%'+_0x41d2f6[_0x91a8('0x30')]['filter']+'%'};return _0x1298a8;}})});}_0x1a8229=_[_0x91a8('0x3c')]({},_0x1a8229,_0x41d2f6[_0x91a8('0x3e')]);var _0x4eb3b9={'where':_0x1a8229['where']};return db[_0x91a8('0x29')][_0x91a8('0x1b')](_0x4eb3b9)[_0x91a8('0x24')](function(_0x32c924){_0x2a694e['count']=_0x32c924;if(_0x41d2f6[_0x91a8('0x30')][_0x91a8('0x3f')]){_0x1a8229[_0x91a8('0x40')]=[{'all':!![]}];}return db[_0x91a8('0x29')]['findAll'](_0x1a8229);})[_0x91a8('0x24')](function(_0x237147){_0x2a694e[_0x91a8('0x41')]=_0x237147;return _0x2a694e;})[_0x91a8('0x24')](respondWithFilteredResult(_0x54e31d,_0x1a8229))['catch'](handleError(_0x54e31d,null));};exports[_0x91a8('0x42')]=function(_0x4fd01a,_0x3af232){var _0x3424e4={'raw':!![],'where':{'id':_0x4fd01a[_0x91a8('0x43')]['id']}},_0xb2f566={};_0xb2f566['model']=_['keys'](db[_0x91a8('0x29')]['rawAttributes']);_0xb2f566[_0x91a8('0x30')]=_[_0x91a8('0x2f')](_0x4fd01a[_0x91a8('0x30')]);_0xb2f566['filters']=_[_0x91a8('0x32')](_0xb2f566['model'],_0xb2f566[_0x91a8('0x30')]);_0x3424e4[_0x91a8('0x34')]=_[_0x91a8('0x32')](_0xb2f566[_0x91a8('0x2e')],qs[_0x91a8('0x33')](_0x4fd01a['query'][_0x91a8('0x33')]));_0x3424e4[_0x91a8('0x34')]=_0x3424e4[_0x91a8('0x34')]['length']?_0x3424e4['attributes']:_0xb2f566[_0x91a8('0x2e')];if(_0x4fd01a[_0x91a8('0x30')]['includeAll']){_0x3424e4[_0x91a8('0x40')]=[{'all':!![]}];}_0x3424e4=_['merge']({},_0x3424e4,_0x4fd01a[_0x91a8('0x3e')]);return db[_0x91a8('0x29')][_0x91a8('0x44')](_0x3424e4)[_0x91a8('0x24')](handleEntityNotFound(_0x3af232,null))[_0x91a8('0x24')](respondWithResult(_0x3af232,null))[_0x91a8('0x45')](handleError(_0x3af232,null));};exports[_0x91a8('0x46')]=function(_0xd3965a,_0x1951d3){return db[_0x91a8('0x29')][_0x91a8('0x46')](_0xd3965a['body'],{})[_0x91a8('0x24')](respondWithResult(_0x1951d3,0xc9))[_0x91a8('0x45')](handleError(_0x1951d3,null));};exports['update']=function(_0x5d93ec,_0x32b350){if(_0x5d93ec[_0x91a8('0x47')]['id']){delete _0x5d93ec[_0x91a8('0x47')]['id'];}return db[_0x91a8('0x29')][_0x91a8('0x44')]({'where':{'id':_0x5d93ec[_0x91a8('0x43')]['id']}})[_0x91a8('0x24')](handleEntityNotFound(_0x32b350,null))[_0x91a8('0x24')](saveUpdates(_0x5d93ec['body'],null))[_0x91a8('0x24')](respondWithResult(_0x32b350,null))[_0x91a8('0x45')](handleError(_0x32b350,null));};exports[_0x91a8('0x48')]=function(_0x5cfe65,_0x3df2c8){return db[_0x91a8('0x29')][_0x91a8('0x44')]({'where':{'id':_0x5cfe65[_0x91a8('0x43')]['id']}})[_0x91a8('0x24')](handleEntityNotFound(_0x3df2c8,null))[_0x91a8('0x24')](removeEntity(_0x3df2c8,null))[_0x91a8('0x45')](handleError(_0x3df2c8,null));};exports[_0x91a8('0x49')]=function(_0x3bb5ef,_0x326ce0){return db['MailSubstatus'][_0x91a8('0x49')]()[_0x91a8('0x24')](respondWithResult(_0x326ce0,null))[_0x91a8('0x45')](handleError(_0x326ce0,null));}; \ No newline at end of file +var _0xc484=['body','find','params','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','querystring','papaparse','ioredis','../../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','set','Content-Range','apply','update','then','destroy','name','send','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','MailSubstatus','includeAll','findAll','rows','catch','keys','filters','include','options','create'];(function(_0x1501a3,_0x3d927b){var _0x3c0c79=function(_0x508630){while(--_0x508630){_0x1501a3['push'](_0x1501a3['shift']());}};_0x3c0c79(++_0x3d927b);}(_0xc484,0x10f));var _0x4c48=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0xc484[_0x4db46b];return _0x565be8;};'use strict';var emlformat=require(_0x4c48('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c48('0x1'));var rp=require('request-promise');var moment=require(_0x4c48('0x2'));var BPromise=require(_0x4c48('0x3'));var Mustache=require('mustache');var util=require(_0x4c48('0x4'));var path=require(_0x4c48('0x5'));var sox=require(_0x4c48('0x6'));var csv=require(_0x4c48('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c48('0x8'));var _=require(_0x4c48('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c48('0x7'));var querystring=require(_0x4c48('0xa'));var Papa=require(_0x4c48('0xb'));var Redis=require(_0x4c48('0xc'));var authService=require(_0x4c48('0xd'));var qs=require(_0x4c48('0xe'));var as=require(_0x4c48('0xf'));var hardwareService=require(_0x4c48('0x10'));var logger=require(_0x4c48('0x11'))('api');var utils=require(_0x4c48('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4c48('0x13'));var db=require(_0x4c48('0x14'))['db'];function respondWithStatusCode(_0x15adc1,_0x576977){_0x576977=_0x576977||0xcc;return function(_0x200676){if(_0x200676){return _0x15adc1['sendStatus'](_0x576977);}return _0x15adc1[_0x4c48('0x15')](_0x576977)[_0x4c48('0x16')]();};}function respondWithResult(_0x3c5d55,_0x576498){_0x576498=_0x576498||0xc8;return function(_0x571295){if(_0x571295){return _0x3c5d55['status'](_0x576498)[_0x4c48('0x17')](_0x571295);}};}function respondWithFilteredResult(_0x2567a2,_0xfa12ad){return function(_0x274a08){if(_0x274a08){var _0x184d12=typeof _0xfa12ad[_0x4c48('0x18')]==='undefined'&&typeof _0xfa12ad['limit']===_0x4c48('0x19');var _0x2e039e=_0x274a08[_0x4c48('0x1a')];var _0x1375b4=_0x184d12?0x0:_0xfa12ad[_0x4c48('0x18')];var _0x2810d3=_0x184d12?_0x274a08[_0x4c48('0x1a')]:_0xfa12ad[_0x4c48('0x18')]+_0xfa12ad[_0x4c48('0x1b')];var _0x4007c2;if(_0x2810d3>=_0x2e039e){_0x2810d3=_0x2e039e;_0x4007c2=0xc8;}else{_0x4007c2=0xce;}_0x2567a2[_0x4c48('0x15')](_0x4007c2);return _0x2567a2[_0x4c48('0x1c')](_0x4c48('0x1d'),_0x1375b4+'-'+_0x2810d3+'/'+_0x2e039e)[_0x4c48('0x17')](_0x274a08);}return null;};}function patchUpdates(_0xac8c70){return function(_0x393e0d){try{jsonpatch[_0x4c48('0x1e')](_0x393e0d,_0xac8c70,!![]);}catch(_0x2f2579){return BPromise['reject'](_0x2f2579);}return _0x393e0d['save']();};}function saveUpdates(_0x2385b6,_0x126675){return function(_0x25e2f3){if(_0x25e2f3){return _0x25e2f3[_0x4c48('0x1f')](_0x2385b6)[_0x4c48('0x20')](function(_0x918b49){return _0x918b49;});}return null;};}function removeEntity(_0x5ae6df,_0x17651d){return function(_0x1e0a0d){if(_0x1e0a0d){return _0x1e0a0d[_0x4c48('0x21')]()[_0x4c48('0x20')](function(){_0x5ae6df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aca43,_0x522506){return function(_0x36d14d){if(!_0x36d14d){_0x4aca43['sendStatus'](0x194);}return _0x36d14d;};}function handleError(_0xbadf32,_0x497955){_0x497955=_0x497955||0x1f4;return function(_0x34fbf8){logger['error'](_0x34fbf8['stack']);if(_0x34fbf8[_0x4c48('0x22')]){delete _0x34fbf8[_0x4c48('0x22')];}_0xbadf32[_0x4c48('0x15')](_0x497955)[_0x4c48('0x23')](_0x34fbf8);};}exports['index']=function(_0x145878,_0x3e7cbd){var _0x5c14c3={},_0x37d4e3={},_0x4f2ec4={'count':0x0,'rows':[]};var _0x227c7a=_['map'](db['MailSubstatus'][_0x4c48('0x24')],function(_0x1d256b){return{'name':_0x1d256b[_0x4c48('0x25')],'type':_0x1d256b[_0x4c48('0x26')]['key']};});_0x37d4e3[_0x4c48('0x27')]=_['map'](_0x227c7a,_0x4c48('0x22'));_0x37d4e3['query']=_['keys'](_0x145878[_0x4c48('0x28')]);_0x37d4e3['filters']=_[_0x4c48('0x29')](_0x37d4e3[_0x4c48('0x27')],_0x37d4e3['query']);_0x5c14c3[_0x4c48('0x2a')]=_[_0x4c48('0x29')](_0x37d4e3['model'],qs[_0x4c48('0x2b')](_0x145878[_0x4c48('0x28')][_0x4c48('0x2b')]));_0x5c14c3[_0x4c48('0x2a')]=_0x5c14c3[_0x4c48('0x2a')][_0x4c48('0x2c')]?_0x5c14c3['attributes']:_0x37d4e3['model'];if(!_0x145878['query'][_0x4c48('0x2d')](_0x4c48('0x2e'))){_0x5c14c3[_0x4c48('0x1b')]=qs[_0x4c48('0x1b')](_0x145878[_0x4c48('0x28')]['limit']);_0x5c14c3[_0x4c48('0x18')]=qs[_0x4c48('0x18')](_0x145878['query'][_0x4c48('0x18')]);}_0x5c14c3[_0x4c48('0x2f')]=qs['sort'](_0x145878['query'][_0x4c48('0x30')]);_0x5c14c3[_0x4c48('0x31')]=qs['filters'](_[_0x4c48('0x32')](_0x145878[_0x4c48('0x28')],_0x37d4e3['filters']),_0x227c7a);if(_0x145878[_0x4c48('0x28')][_0x4c48('0x33')]){_0x5c14c3[_0x4c48('0x31')]=_[_0x4c48('0x34')](_0x5c14c3[_0x4c48('0x31')],{'$or':_[_0x4c48('0x35')](_0x227c7a,function(_0x1d645b){if(_0x1d645b[_0x4c48('0x26')]!=='VIRTUAL'){var _0x308229={};_0x308229[_0x1d645b[_0x4c48('0x22')]]={'$like':'%'+_0x145878[_0x4c48('0x28')][_0x4c48('0x33')]+'%'};return _0x308229;}})});}_0x5c14c3=_[_0x4c48('0x34')]({},_0x5c14c3,_0x145878['options']);var _0x484e53={'where':_0x5c14c3[_0x4c48('0x31')]};return db[_0x4c48('0x36')]['count'](_0x484e53)[_0x4c48('0x20')](function(_0x13928d){_0x4f2ec4[_0x4c48('0x1a')]=_0x13928d;if(_0x145878[_0x4c48('0x28')][_0x4c48('0x37')]){_0x5c14c3['include']=[{'all':!![]}];}return db[_0x4c48('0x36')][_0x4c48('0x38')](_0x5c14c3);})[_0x4c48('0x20')](function(_0x3ba9c6){_0x4f2ec4[_0x4c48('0x39')]=_0x3ba9c6;return _0x4f2ec4;})['then'](respondWithFilteredResult(_0x3e7cbd,_0x5c14c3))[_0x4c48('0x3a')](handleError(_0x3e7cbd,null));};exports['show']=function(_0x498269,_0x4d85d8){var _0x386b2b={'raw':!![],'where':{'id':_0x498269['params']['id']}},_0x51ac86={};_0x51ac86[_0x4c48('0x27')]=_[_0x4c48('0x3b')](db[_0x4c48('0x36')]['rawAttributes']);_0x51ac86[_0x4c48('0x28')]=_[_0x4c48('0x3b')](_0x498269['query']);_0x51ac86[_0x4c48('0x3c')]=_[_0x4c48('0x29')](_0x51ac86['model'],_0x51ac86['query']);_0x386b2b[_0x4c48('0x2a')]=_[_0x4c48('0x29')](_0x51ac86['model'],qs[_0x4c48('0x2b')](_0x498269['query']['fields']));_0x386b2b[_0x4c48('0x2a')]=_0x386b2b[_0x4c48('0x2a')][_0x4c48('0x2c')]?_0x386b2b[_0x4c48('0x2a')]:_0x51ac86[_0x4c48('0x27')];if(_0x498269['query'][_0x4c48('0x37')]){_0x386b2b[_0x4c48('0x3d')]=[{'all':!![]}];}_0x386b2b=_[_0x4c48('0x34')]({},_0x386b2b,_0x498269[_0x4c48('0x3e')]);return db['MailSubstatus']['find'](_0x386b2b)[_0x4c48('0x20')](handleEntityNotFound(_0x4d85d8,null))['then'](respondWithResult(_0x4d85d8,null))['catch'](handleError(_0x4d85d8,null));};exports[_0x4c48('0x3f')]=function(_0x31fd0b,_0x4dd29b){return db[_0x4c48('0x36')][_0x4c48('0x3f')](_0x31fd0b[_0x4c48('0x40')],{})[_0x4c48('0x20')](respondWithResult(_0x4dd29b,0xc9))['catch'](handleError(_0x4dd29b,null));};exports[_0x4c48('0x1f')]=function(_0x7e4fea,_0x41b29c){if(_0x7e4fea[_0x4c48('0x40')]['id']){delete _0x7e4fea['body']['id'];}return db[_0x4c48('0x36')][_0x4c48('0x41')]({'where':{'id':_0x7e4fea[_0x4c48('0x42')]['id']}})[_0x4c48('0x20')](handleEntityNotFound(_0x41b29c,null))[_0x4c48('0x20')](saveUpdates(_0x7e4fea[_0x4c48('0x40')],null))[_0x4c48('0x20')](respondWithResult(_0x41b29c,null))[_0x4c48('0x3a')](handleError(_0x41b29c,null));};exports[_0x4c48('0x21')]=function(_0x4c8497,_0x49a2d0){return db[_0x4c48('0x36')][_0x4c48('0x41')]({'where':{'id':_0x4c8497[_0x4c48('0x42')]['id']}})[_0x4c48('0x20')](handleEntityNotFound(_0x49a2d0,null))[_0x4c48('0x20')](removeEntity(_0x49a2d0,null))['catch'](handleError(_0x49a2d0,null));};exports['describe']=function(_0x40fe99,_0x37ab4f){return db[_0x4c48('0x36')]['describe']()[_0x4c48('0x20')](respondWithResult(_0x37ab4f,null))[_0x4c48('0x3a')](handleError(_0x37ab4f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d62322d..0763301 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 _0xaaf0=['events','../../mysqldb','setMaxListeners','update','emit','hook','exports'];(function(_0x32df41,_0x5b8eee){var _0x2d0233=function(_0x4da090){while(--_0x4da090){_0x32df41['push'](_0x32df41['shift']());}};_0x2d0233(++_0x5b8eee);}(_0xaaf0,0x13b));var _0x0aaf=function(_0x2d872e,_0x1678ee){_0x2d872e=_0x2d872e-0x0;var _0xa45061=_0xaaf0[_0x2d872e];return _0xa45061;};'use strict';var EventEmitter=require(_0x0aaf('0x0'));var MailSubstatus=require(_0x0aaf('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0aaf('0x2')](0x0);var events={'afterUpdate':_0x0aaf('0x3')};function emitEvent(_0x4e261d){return function(_0x4e693a,_0x3db4c9,_0x51efd6){MailSubstatusEvents['emit'](_0x4e261d+':'+_0x4e693a['id'],_0x4e693a);MailSubstatusEvents[_0x0aaf('0x4')](_0x4e261d,_0x4e693a);_0x51efd6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x0aaf('0x5')](e,emitEvent(event));}}module[_0x0aaf('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x3134=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2c7101,_0x2cff23){var _0x3bb677=function(_0x3c0fa4){while(--_0x3c0fa4){_0x2c7101['push'](_0x2c7101['shift']());}};_0x3bb677(++_0x2cff23);}(_0x3134,0x139));var _0x4313=function(_0x5f1e9e,_0x1a1c01){_0x5f1e9e=_0x5f1e9e-0x0;var _0x114842=_0x3134[_0x5f1e9e];return _0x114842;};'use strict';var EventEmitter=require(_0x4313('0x0'));var MailSubstatus=require(_0x4313('0x1'))['db'][_0x4313('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4313('0x3')](0x0);var events={'afterUpdate':_0x4313('0x4')};function emitEvent(_0x1ef1ad){return function(_0x2116d8,_0x5bc2b8,_0x274d87){MailSubstatusEvents[_0x4313('0x5')](_0x1ef1ad+':'+_0x2116d8['id'],_0x2116d8);MailSubstatusEvents['emit'](_0x1ef1ad,_0x2116d8);_0x274d87(null);};}for(var e in events){if(events[_0x4313('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x4313('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a56e396..bc1d327 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 _0x9e01=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','_previousDataValues','catch'];(function(_0x3ba813,_0x4acfd9){var _0x499b77=function(_0x1aaef8){while(--_0x1aaef8){_0x3ba813['push'](_0x3ba813['shift']());}};_0x499b77(++_0x4acfd9);}(_0x9e01,0x8f));var _0x19e0=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9e01[_0x13d07a];return _0x5ee0ee;};'use strict';var attributes=require(_0x19e0('0x0'));module[_0x19e0('0x1')]=function(_0x2c2b94){var _0x52191c=_0x2c2b94[_0x19e0('0x2')];return _0x2c2b94[_0x19e0('0x3')](_0x19e0('0x4'),attributes,{'tableName':_0x19e0('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2861e4,_0x638c59,_0x335ddd){return _0x52191c[_0x19e0('0x6')][_0x19e0('0x7')]({'value':_0x2861e4[_0x19e0('0x8')]},{'where':{'field':'mailSubstatus','value':_0x2861e4[_0x19e0('0x9')]['name']}})['then'](function(){_0x335ddd();})[_0x19e0('0xa')](function(_0x5819e9){_0x335ddd(_0x5819e9);});}}});}; \ No newline at end of file +var _0x84e7=['mail_substatuses','update','name','mailSubstatus','catch','./mailSubstatus.attributes','models'];(function(_0x14d145,_0x2da870){var _0x566d5d=function(_0x2b522c){while(--_0x2b522c){_0x14d145['push'](_0x14d145['shift']());}};_0x566d5d(++_0x2da870);}(_0x84e7,0x171));var _0x784e=function(_0x2bdff8,_0x624681){_0x2bdff8=_0x2bdff8-0x0;var _0x517b79=_0x84e7[_0x2bdff8];return _0x517b79;};'use strict';var attributes=require(_0x784e('0x0'));module['exports']=function(_0x982717){var _0x4e3419=_0x982717[_0x784e('0x1')];return _0x982717['define']('MailSubstatus',attributes,{'tableName':_0x784e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x339c78,_0x2b5b5a,_0x118c70){return _0x4e3419['Condition'][_0x784e('0x3')]({'value':_0x339c78[_0x784e('0x4')]},{'where':{'field':_0x784e('0x5'),'value':_0x339c78['_previousDataValues']['name']}})['then'](function(){_0x118c70();})[_0x784e('0x6')](function(_0x34ea57){_0x118c70(_0x34ea57);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 9c4d179..c837689 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 _0xf60b=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch'];(function(_0x480e09,_0x3155fb){var _0x360952=function(_0x33b077){while(--_0x33b077){_0x480e09['push'](_0x480e09['shift']());}};_0x360952(++_0x3155fb);}(_0xf60b,0x190));var _0xbf60=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0xf60b[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0xbf60('0x0'));var util=require(_0xbf60('0x1'));var moment=require(_0xbf60('0x2'));var BPromise=require(_0xbf60('0x3'));var rs=require(_0xbf60('0x4'));var fs=require('fs');var Redis=require(_0xbf60('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf60('0x6'));var logger=require(_0xbf60('0x7'))(_0xbf60('0x8'));var config=require(_0xbf60('0x9'));var jayson=require(_0xbf60('0xa'));var client=jayson[_0xbf60('0xb')][_0xbf60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23aef0,_0x24c03f,_0x30eb09){return new BPromise(function(_0x5d8bfd,_0x119b12){return client[_0xbf60('0xd')](_0x23aef0,_0x30eb09)['then'](function(_0x2ea673){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x24c03f,_0xbf60('0xe'));logger[_0xbf60('0xf')](_0xbf60('0x10'),_0x24c03f,_0xbf60('0xe'),JSON[_0xbf60('0x11')](_0x2ea673));if(_0x2ea673[_0xbf60('0x12')]){if(_0x2ea673[_0xbf60('0x12')][_0xbf60('0x13')]===0x1f4){logger['error'](_0xbf60('0x14'),_0x24c03f,_0x2ea673[_0xbf60('0x12')][_0xbf60('0x15')]);return _0x119b12(_0x2ea673[_0xbf60('0x12')]['message']);}logger[_0xbf60('0x12')](_0xbf60('0x14'),_0x24c03f,_0x2ea673[_0xbf60('0x12')][_0xbf60('0x15')]);return _0x5d8bfd(_0x2ea673[_0xbf60('0x12')][_0xbf60('0x15')]);}else{logger[_0xbf60('0x16')]('MailSubstatus,\x20%s,\x20%s',_0x24c03f,_0xbf60('0xe'));_0x5d8bfd(_0x2ea673[_0xbf60('0x17')][_0xbf60('0x15')]);}})[_0xbf60('0x18')](function(_0x4a5381){logger[_0xbf60('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x24c03f,_0x4a5381);_0x119b12(_0x4a5381);});});} \ No newline at end of file +var _0x22f1=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4c8775,_0x3f458c){var _0x4ec743=function(_0x433426){while(--_0x433426){_0x4c8775['push'](_0x4c8775['shift']());}};_0x4ec743(++_0x3f458c);}(_0x22f1,0xbd));var _0x122f=function(_0x5e21fa,_0x501e52){_0x5e21fa=_0x5e21fa-0x0;var _0x11d56d=_0x22f1[_0x5e21fa];return _0x11d56d;};'use strict';var _=require(_0x122f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x122f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x122f('0x2'));var db=require(_0x122f('0x3'))['db'];var utils=require(_0x122f('0x4'));var logger=require(_0x122f('0x5'))(_0x122f('0x6'));var config=require(_0x122f('0x7'));var jayson=require(_0x122f('0x8'));var client=jayson[_0x122f('0x9')][_0x122f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x766b2c,_0x1d95fc,_0x5ea110){return new BPromise(function(_0x261fa6,_0x35f0e9){return client[_0x122f('0xb')](_0x766b2c,_0x5ea110)['then'](function(_0x40eefd){logger['info'](_0x122f('0xc'),_0x1d95fc,_0x122f('0xd'));logger['debug'](_0x122f('0xe'),_0x1d95fc,_0x122f('0xd'),JSON[_0x122f('0xf')](_0x40eefd));if(_0x40eefd[_0x122f('0x10')]){if(_0x40eefd[_0x122f('0x10')][_0x122f('0x11')]===0x1f4){logger['error'](_0x122f('0xc'),_0x1d95fc,_0x40eefd[_0x122f('0x10')][_0x122f('0x12')]);return _0x35f0e9(_0x40eefd['error'][_0x122f('0x12')]);}logger[_0x122f('0x10')](_0x122f('0xc'),_0x1d95fc,_0x40eefd[_0x122f('0x10')][_0x122f('0x12')]);return _0x261fa6(_0x40eefd['error'][_0x122f('0x12')]);}else{logger[_0x122f('0x13')](_0x122f('0xc'),_0x1d95fc,_0x122f('0xd'));_0x261fa6(_0x40eefd[_0x122f('0x14')]['message']);}})['catch'](function(_0x24d3bb){logger[_0x122f('0x10')](_0x122f('0xc'),_0x1d95fc,_0x24d3bb);_0x35f0e9(_0x24d3bb);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c0cbc8a..e5f2c19 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 _0xacc7=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x3e9d1c,_0x434087){var _0x380c88=function(_0x4162ed){while(--_0x4162ed){_0x3e9d1c['push'](_0x3e9d1c['shift']());}};_0x380c88(++_0x434087);}(_0xacc7,0x1a8));var _0x7acc=function(_0x5a8269,_0xfb2f54){_0x5a8269=_0x5a8269-0x0;var _0x539ed7=_0xacc7[_0x5a8269];return _0x539ed7;};'use strict';var multer=require('multer');var util=require(_0x7acc('0x0'));var path=require(_0x7acc('0x1'));var timeout=require(_0x7acc('0x2'));var express=require(_0x7acc('0x3'));var router=express[_0x7acc('0x4')]();var fs_extra=require(_0x7acc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7acc('0x6'));var controller=require(_0x7acc('0x7'));router[_0x7acc('0x8')]('/',auth[_0x7acc('0x9')](),controller[_0x7acc('0xa')]);router[_0x7acc('0x8')](_0x7acc('0xb'),auth[_0x7acc('0x9')](),controller[_0x7acc('0xc')]);router[_0x7acc('0x8')](_0x7acc('0xd'),auth['isAuthenticated'](),controller[_0x7acc('0xe')]);router['post']('/',auth[_0x7acc('0x9')](),controller[_0x7acc('0xf')]);router[_0x7acc('0x10')](_0x7acc('0xd'),auth['isAuthenticated'](),controller[_0x7acc('0x11')]);router[_0x7acc('0x12')](_0x7acc('0xd'),auth['isAuthenticated'](),controller[_0x7acc('0x13')]);module[_0x7acc('0x14')]=router; \ No newline at end of file +var _0xbeba=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','put'];(function(_0x2a32c4,_0x1a097){var _0xc691df=function(_0x50479e){while(--_0x50479e){_0x2a32c4['push'](_0x2a32c4['shift']());}};_0xc691df(++_0x1a097);}(_0xbeba,0x11c));var _0xabeb=function(_0x283251,_0x65a7d1){_0x283251=_0x283251-0x0;var _0xccf556=_0xbeba[_0x283251];return _0xccf556;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require(_0xabeb('0x2'));var timeout=require(_0xabeb('0x3'));var express=require(_0xabeb('0x4'));var router=express[_0xabeb('0x5')]();var fs_extra=require(_0xabeb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xabeb('0x7'));var config=require(_0xabeb('0x8'));var controller=require('./mailTransferReport.controller');router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xabeb('0xc')]);router[_0xabeb('0x9')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['show']);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller['create']);router[_0xabeb('0xf')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x10')]);router[_0xabeb('0x11')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x12')]);module[_0xabeb('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 19b82ef..17e4245 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x30744a,_0x447387){var _0x438da4=function(_0x1a560d){while(--_0x1a560d){_0x30744a['push'](_0x30744a['shift']());}};_0x438da4(++_0x447387);}(_0x00bb,0x1d8));var _0xb00b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00bb[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5214ec,_0x58864e){var _0x40cc3c=function(_0xefa8f7){while(--_0xefa8f7){_0x5214ec['push'](_0x5214ec['shift']());}};_0x40cc3c(++_0x58864e);}(_0xaa88,0x137));var _0x8aa8=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xaa88[_0x4a5494];return _0x57cbb5;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 238d052..be626de 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 _0xde0e=['where','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2fcb09,_0x1f746b){var _0x5690d1=function(_0x1570c8){while(--_0x1570c8){_0x2fcb09['push'](_0x2fcb09['shift']());}};_0x5690d1(++_0x1f746b);}(_0xde0e,0x1cd));var _0xede0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde0e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xede0('0x0'));var zipdir=require(_0xede0('0x1'));var jsonpatch=require(_0xede0('0x2'));var rp=require(_0xede0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xede0('0x4'));var util=require(_0xede0('0x5'));var path=require(_0xede0('0x6'));var sox=require(_0xede0('0x7'));var csv=require(_0xede0('0x8'));var ejs=require(_0xede0('0x9'));var fs=require('fs');var fs_extra=require(_0xede0('0xa'));var _=require(_0xede0('0xb'));var squel=require('squel');var crypto=require(_0xede0('0xc'));var jsforce=require(_0xede0('0xd'));var deskjs=require(_0xede0('0xe'));var toCsv=require(_0xede0('0x8'));var querystring=require(_0xede0('0xf'));var Papa=require('papaparse');var Redis=require(_0xede0('0x10'));var authService=require(_0xede0('0x11'));var qs=require(_0xede0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xede0('0x13'));var logger=require('../../config/logger')(_0xede0('0x14'));var utils=require(_0xede0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xede0('0x16'))['db'];function respondWithStatusCode(_0x18693e,_0x3689c9){_0x3689c9=_0x3689c9||0xcc;return function(_0x3794a7){if(_0x3794a7){return _0x18693e['sendStatus'](_0x3689c9);}return _0x18693e[_0xede0('0x17')](_0x3689c9)[_0xede0('0x18')]();};}function respondWithResult(_0x55c8a3,_0x4f873b){_0x4f873b=_0x4f873b||0xc8;return function(_0xd5ede0){if(_0xd5ede0){return _0x55c8a3[_0xede0('0x17')](_0x4f873b)['json'](_0xd5ede0);}};}function respondWithFilteredResult(_0x518489,_0x355fc9){return function(_0x1f301e){if(_0x1f301e){var _0x47c6f7=typeof _0x355fc9['offset']===_0xede0('0x19')&&typeof _0x355fc9[_0xede0('0x1a')]===_0xede0('0x19');var _0x4e5b6b=_0x1f301e[_0xede0('0x1b')];var _0x7dc614=_0x47c6f7?0x0:_0x355fc9[_0xede0('0x1c')];var _0x281e1c=_0x47c6f7?_0x1f301e[_0xede0('0x1b')]:_0x355fc9['offset']+_0x355fc9[_0xede0('0x1a')];var _0x16cd0b;if(_0x281e1c>=_0x4e5b6b){_0x281e1c=_0x4e5b6b;_0x16cd0b=0xc8;}else{_0x16cd0b=0xce;}_0x518489[_0xede0('0x17')](_0x16cd0b);return _0x518489['set'](_0xede0('0x1d'),_0x7dc614+'-'+_0x281e1c+'/'+_0x4e5b6b)[_0xede0('0x1e')](_0x1f301e);}return null;};}function patchUpdates(_0xa81205){return function(_0x3d7c66){try{jsonpatch[_0xede0('0x1f')](_0x3d7c66,_0xa81205,!![]);}catch(_0x2ab7eb){return BPromise[_0xede0('0x20')](_0x2ab7eb);}return _0x3d7c66['save']();};}function saveUpdates(_0x1692fb,_0x25f37f){return function(_0x4cd72c){if(_0x4cd72c){return _0x4cd72c[_0xede0('0x21')](_0x1692fb)['then'](function(_0x5ef302){return _0x5ef302;});}return null;};}function removeEntity(_0x15f83c,_0xe4fb60){return function(_0x36d9e2){if(_0x36d9e2){return _0x36d9e2['destroy']()[_0xede0('0x22')](function(){_0x15f83c[_0xede0('0x17')](0xcc)[_0xede0('0x18')]();});}};}function handleEntityNotFound(_0x1f8f55,_0x162f2c){return function(_0x18c150){if(!_0x18c150){_0x1f8f55['sendStatus'](0x194);}return _0x18c150;};}function handleError(_0x4effc2,_0x2b0061){_0x2b0061=_0x2b0061||0x1f4;return function(_0x18c3eb){logger[_0xede0('0x23')](_0x18c3eb[_0xede0('0x24')]);if(_0x18c3eb[_0xede0('0x25')]){delete _0x18c3eb[_0xede0('0x25')];}_0x4effc2[_0xede0('0x17')](_0x2b0061)[_0xede0('0x26')](_0x18c3eb);};}exports['index']=function(_0x2141bb,_0x361091){var _0x21d355={},_0x372362={},_0x3af378={'count':0x0,'rows':[]};var _0x593c4d=_[_0xede0('0x27')](db[_0xede0('0x28')][_0xede0('0x29')],function(_0x5b7641){return{'name':_0x5b7641[_0xede0('0x2a')],'type':_0x5b7641[_0xede0('0x2b')][_0xede0('0x2c')]};});_0x372362['model']=_[_0xede0('0x27')](_0x593c4d,'name');_0x372362['query']=_[_0xede0('0x2d')](_0x2141bb[_0xede0('0x2e')]);_0x372362[_0xede0('0x2f')]=_[_0xede0('0x30')](_0x372362[_0xede0('0x31')],_0x372362['query']);_0x21d355['attributes']=_['intersection'](_0x372362['model'],qs[_0xede0('0x32')](_0x2141bb[_0xede0('0x2e')][_0xede0('0x32')]));_0x21d355[_0xede0('0x33')]=_0x21d355[_0xede0('0x33')][_0xede0('0x34')]?_0x21d355[_0xede0('0x33')]:_0x372362[_0xede0('0x31')];if(!_0x2141bb[_0xede0('0x2e')][_0xede0('0x35')](_0xede0('0x36'))){_0x21d355['limit']=qs[_0xede0('0x1a')](_0x2141bb[_0xede0('0x2e')][_0xede0('0x1a')]);_0x21d355[_0xede0('0x1c')]=qs[_0xede0('0x1c')](_0x2141bb['query'][_0xede0('0x1c')]);}_0x21d355[_0xede0('0x37')]=qs[_0xede0('0x38')](_0x2141bb[_0xede0('0x2e')][_0xede0('0x38')]);_0x21d355[_0xede0('0x39')]=qs[_0xede0('0x2f')](_[_0xede0('0x3a')](_0x2141bb[_0xede0('0x2e')],_0x372362[_0xede0('0x2f')]),_0x593c4d);if(_0x2141bb['query']['filter']){_0x21d355[_0xede0('0x39')]=_['merge'](_0x21d355[_0xede0('0x39')],{'$or':_[_0xede0('0x27')](_0x593c4d,function(_0x3121e2){if(_0x3121e2[_0xede0('0x2b')]!==_0xede0('0x3b')){var _0x2bd6a0={};_0x2bd6a0[_0x3121e2[_0xede0('0x25')]]={'$like':'%'+_0x2141bb['query'][_0xede0('0x3c')]+'%'};return _0x2bd6a0;}})});}_0x21d355=_[_0xede0('0x3d')]({},_0x21d355,_0x2141bb[_0xede0('0x3e')]);var _0x58ab07={'where':_0x21d355[_0xede0('0x39')]};return db['MailTransferReport'][_0xede0('0x1b')](_0x58ab07)[_0xede0('0x22')](function(_0x28aee0){_0x3af378[_0xede0('0x1b')]=_0x28aee0;if(_0x2141bb[_0xede0('0x2e')]['includeAll']){_0x21d355['include']=[{'all':!![]}];}return db[_0xede0('0x28')][_0xede0('0x3f')](_0x21d355);})[_0xede0('0x22')](function(_0x33ea5b){_0x3af378[_0xede0('0x40')]=_0x33ea5b;return _0x3af378;})[_0xede0('0x22')](respondWithFilteredResult(_0x361091,_0x21d355))[_0xede0('0x41')](handleError(_0x361091,null));};exports[_0xede0('0x42')]=function(_0x3c42c0,_0x4f60e8){var _0x154d92={'raw':!![],'where':{'id':_0x3c42c0[_0xede0('0x43')]['id']}},_0x4f02d8={};_0x4f02d8['model']=_['keys'](db[_0xede0('0x28')][_0xede0('0x29')]);_0x4f02d8[_0xede0('0x2e')]=_[_0xede0('0x2d')](_0x3c42c0[_0xede0('0x2e')]);_0x4f02d8[_0xede0('0x2f')]=_[_0xede0('0x30')](_0x4f02d8[_0xede0('0x31')],_0x4f02d8[_0xede0('0x2e')]);_0x154d92[_0xede0('0x33')]=_[_0xede0('0x30')](_0x4f02d8['model'],qs[_0xede0('0x32')](_0x3c42c0[_0xede0('0x2e')][_0xede0('0x32')]));_0x154d92[_0xede0('0x33')]=_0x154d92['attributes'][_0xede0('0x34')]?_0x154d92['attributes']:_0x4f02d8[_0xede0('0x31')];if(_0x3c42c0['query'][_0xede0('0x44')]){_0x154d92[_0xede0('0x45')]=[{'all':!![]}];}_0x154d92=_[_0xede0('0x3d')]({},_0x154d92,_0x3c42c0[_0xede0('0x3e')]);return db['MailTransferReport'][_0xede0('0x46')](_0x154d92)['then'](handleEntityNotFound(_0x4f60e8,null))['then'](respondWithResult(_0x4f60e8,null))[_0xede0('0x41')](handleError(_0x4f60e8,null));};exports[_0xede0('0x47')]=function(_0x5a0581,_0x35c88f){return db['MailTransferReport'][_0xede0('0x47')](_0x5a0581[_0xede0('0x48')],{})[_0xede0('0x22')](respondWithResult(_0x35c88f,0xc9))[_0xede0('0x41')](handleError(_0x35c88f,null));};exports[_0xede0('0x21')]=function(_0x21630f,_0x32198d){if(_0x21630f[_0xede0('0x48')]['id']){delete _0x21630f[_0xede0('0x48')]['id'];}return db[_0xede0('0x28')]['find']({'where':{'id':_0x21630f[_0xede0('0x43')]['id']}})[_0xede0('0x22')](handleEntityNotFound(_0x32198d,null))['then'](saveUpdates(_0x21630f[_0xede0('0x48')],null))[_0xede0('0x22')](respondWithResult(_0x32198d,null))[_0xede0('0x41')](handleError(_0x32198d,null));};exports[_0xede0('0x49')]=function(_0x5e4513,_0x431d96){return db[_0xede0('0x28')][_0xede0('0x46')]({'where':{'id':_0x5e4513[_0xede0('0x43')]['id']}})['then'](handleEntityNotFound(_0x431d96,null))[_0xede0('0x22')](removeEntity(_0x431d96,null))[_0xede0('0x41')](handleError(_0x431d96,null));};exports['describe']=function(_0x261f26,_0x322ae8){return db[_0xede0('0x28')]['describe']()[_0xede0('0x22')](respondWithResult(_0x322ae8,null))[_0xede0('0x41')](handleError(_0x322ae8,null));}; \ No newline at end of file +var _0x6bee=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x37acc7,_0x169745){var _0x2b861c=function(_0x5e2e4a){while(--_0x5e2e4a){_0x37acc7['push'](_0x37acc7['shift']());}};_0x2b861c(++_0x169745);}(_0x6bee,0x93));var _0xe6be=function(_0x28fb19,_0x3e5e9a){_0x28fb19=_0x28fb19-0x0;var _0x2b9222=_0x6bee[_0x28fb19];return _0x2b9222;};'use strict';var emlformat=require(_0xe6be('0x0'));var rimraf=require(_0xe6be('0x1'));var zipdir=require(_0xe6be('0x2'));var jsonpatch=require(_0xe6be('0x3'));var rp=require('request-promise');var moment=require(_0xe6be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe6be('0x5'));var util=require(_0xe6be('0x6'));var path=require(_0xe6be('0x7'));var sox=require(_0xe6be('0x8'));var csv=require('to-csv');var ejs=require(_0xe6be('0x9'));var fs=require('fs');var fs_extra=require(_0xe6be('0xa'));var _=require(_0xe6be('0xb'));var squel=require(_0xe6be('0xc'));var crypto=require(_0xe6be('0xd'));var jsforce=require(_0xe6be('0xe'));var deskjs=require(_0xe6be('0xf'));var toCsv=require(_0xe6be('0x10'));var querystring=require(_0xe6be('0x11'));var Papa=require(_0xe6be('0x12'));var Redis=require(_0xe6be('0x13'));var authService=require(_0xe6be('0x14'));var qs=require(_0xe6be('0x15'));var as=require(_0xe6be('0x16'));var hardwareService=require(_0xe6be('0x17'));var logger=require(_0xe6be('0x18'))(_0xe6be('0x19'));var utils=require(_0xe6be('0x1a'));var config=require(_0xe6be('0x1b'));var licenseUtil=require(_0xe6be('0x1c'));var db=require(_0xe6be('0x1d'))['db'];function respondWithStatusCode(_0x51f4a7,_0x5ce338){_0x5ce338=_0x5ce338||0xcc;return function(_0x441146){if(_0x441146){return _0x51f4a7[_0xe6be('0x1e')](_0x5ce338);}return _0x51f4a7[_0xe6be('0x1f')](_0x5ce338)[_0xe6be('0x20')]();};}function respondWithResult(_0x520fc8,_0x12fc15){_0x12fc15=_0x12fc15||0xc8;return function(_0x31c4fb){if(_0x31c4fb){return _0x520fc8[_0xe6be('0x1f')](_0x12fc15)['json'](_0x31c4fb);}};}function respondWithFilteredResult(_0xce03ed,_0x3b9ff0){return function(_0xb1ea07){if(_0xb1ea07){var _0x451b55=typeof _0x3b9ff0[_0xe6be('0x21')]==='undefined'&&typeof _0x3b9ff0[_0xe6be('0x22')]===_0xe6be('0x23');var _0x58caf6=_0xb1ea07[_0xe6be('0x24')];var _0x2c8028=_0x451b55?0x0:_0x3b9ff0['offset'];var _0x2a8c0f=_0x451b55?_0xb1ea07[_0xe6be('0x24')]:_0x3b9ff0[_0xe6be('0x21')]+_0x3b9ff0['limit'];var _0x4f5558;if(_0x2a8c0f>=_0x58caf6){_0x2a8c0f=_0x58caf6;_0x4f5558=0xc8;}else{_0x4f5558=0xce;}_0xce03ed['status'](_0x4f5558);return _0xce03ed[_0xe6be('0x25')](_0xe6be('0x26'),_0x2c8028+'-'+_0x2a8c0f+'/'+_0x58caf6)[_0xe6be('0x27')](_0xb1ea07);}return null;};}function patchUpdates(_0xce86f9){return function(_0x3a5cfe){try{jsonpatch[_0xe6be('0x28')](_0x3a5cfe,_0xce86f9,!![]);}catch(_0x1f66fa){return BPromise[_0xe6be('0x29')](_0x1f66fa);}return _0x3a5cfe[_0xe6be('0x2a')]();};}function saveUpdates(_0x1bc8bc,_0x2c91f2){return function(_0x29022a){if(_0x29022a){return _0x29022a[_0xe6be('0x2b')](_0x1bc8bc)[_0xe6be('0x2c')](function(_0x24c4cd){return _0x24c4cd;});}return null;};}function removeEntity(_0x4e13a6,_0x1cdbaa){return function(_0x2aa745){if(_0x2aa745){return _0x2aa745['destroy']()['then'](function(){_0x4e13a6[_0xe6be('0x1f')](0xcc)[_0xe6be('0x20')]();});}};}function handleEntityNotFound(_0x4ce199,_0x368015){return function(_0x4a1704){if(!_0x4a1704){_0x4ce199[_0xe6be('0x1e')](0x194);}return _0x4a1704;};}function handleError(_0x5d698b,_0x288922){_0x288922=_0x288922||0x1f4;return function(_0x479051){logger[_0xe6be('0x2d')](_0x479051[_0xe6be('0x2e')]);if(_0x479051[_0xe6be('0x2f')]){delete _0x479051[_0xe6be('0x2f')];}_0x5d698b['status'](_0x288922)[_0xe6be('0x30')](_0x479051);};}exports['index']=function(_0x936e9a,_0x13f525){var _0x4d6b3a={},_0x15c6ce={},_0x13c9b4={'count':0x0,'rows':[]};var _0x13921a=_[_0xe6be('0x31')](db[_0xe6be('0x32')][_0xe6be('0x33')],function(_0x8c8fe5){return{'name':_0x8c8fe5[_0xe6be('0x34')],'type':_0x8c8fe5['type'][_0xe6be('0x35')]};});_0x15c6ce[_0xe6be('0x36')]=_[_0xe6be('0x31')](_0x13921a,_0xe6be('0x2f'));_0x15c6ce['query']=_['keys'](_0x936e9a[_0xe6be('0x37')]);_0x15c6ce[_0xe6be('0x38')]=_[_0xe6be('0x39')](_0x15c6ce[_0xe6be('0x36')],_0x15c6ce[_0xe6be('0x37')]);_0x4d6b3a[_0xe6be('0x3a')]=_[_0xe6be('0x39')](_0x15c6ce['model'],qs[_0xe6be('0x3b')](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x3b')]));_0x4d6b3a[_0xe6be('0x3a')]=_0x4d6b3a[_0xe6be('0x3a')][_0xe6be('0x3c')]?_0x4d6b3a[_0xe6be('0x3a')]:_0x15c6ce[_0xe6be('0x36')];if(!_0x936e9a[_0xe6be('0x37')]['hasOwnProperty'](_0xe6be('0x3d'))){_0x4d6b3a[_0xe6be('0x22')]=qs['limit'](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x22')]);_0x4d6b3a['offset']=qs[_0xe6be('0x21')](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x21')]);}_0x4d6b3a[_0xe6be('0x3e')]=qs['sort'](_0x936e9a[_0xe6be('0x37')][_0xe6be('0x3f')]);_0x4d6b3a[_0xe6be('0x40')]=qs['filters'](_['pick'](_0x936e9a[_0xe6be('0x37')],_0x15c6ce[_0xe6be('0x38')]),_0x13921a);if(_0x936e9a[_0xe6be('0x37')][_0xe6be('0x41')]){_0x4d6b3a[_0xe6be('0x40')]=_['merge'](_0x4d6b3a[_0xe6be('0x40')],{'$or':_['map'](_0x13921a,function(_0x49392d){if(_0x49392d['type']!=='VIRTUAL'){var _0x153bb8={};_0x153bb8[_0x49392d[_0xe6be('0x2f')]]={'$like':'%'+_0x936e9a[_0xe6be('0x37')][_0xe6be('0x41')]+'%'};return _0x153bb8;}})});}_0x4d6b3a=_[_0xe6be('0x42')]({},_0x4d6b3a,_0x936e9a[_0xe6be('0x43')]);var _0x3ec9a4={'where':_0x4d6b3a[_0xe6be('0x40')]};return db[_0xe6be('0x32')][_0xe6be('0x24')](_0x3ec9a4)['then'](function(_0xe3ddf5){_0x13c9b4['count']=_0xe3ddf5;if(_0x936e9a[_0xe6be('0x37')][_0xe6be('0x44')]){_0x4d6b3a[_0xe6be('0x45')]=[{'all':!![]}];}return db[_0xe6be('0x32')][_0xe6be('0x46')](_0x4d6b3a);})[_0xe6be('0x2c')](function(_0x3e3fc8){_0x13c9b4[_0xe6be('0x47')]=_0x3e3fc8;return _0x13c9b4;})[_0xe6be('0x2c')](respondWithFilteredResult(_0x13f525,_0x4d6b3a))['catch'](handleError(_0x13f525,null));};exports[_0xe6be('0x48')]=function(_0x16ec48,_0x5502dd){var _0x1de412={'raw':!![],'where':{'id':_0x16ec48[_0xe6be('0x49')]['id']}},_0x1ad37b={};_0x1ad37b['model']=_[_0xe6be('0x4a')](db[_0xe6be('0x32')][_0xe6be('0x33')]);_0x1ad37b[_0xe6be('0x37')]=_['keys'](_0x16ec48[_0xe6be('0x37')]);_0x1ad37b[_0xe6be('0x38')]=_[_0xe6be('0x39')](_0x1ad37b[_0xe6be('0x36')],_0x1ad37b['query']);_0x1de412[_0xe6be('0x3a')]=_['intersection'](_0x1ad37b[_0xe6be('0x36')],qs[_0xe6be('0x3b')](_0x16ec48['query'][_0xe6be('0x3b')]));_0x1de412[_0xe6be('0x3a')]=_0x1de412[_0xe6be('0x3a')]['length']?_0x1de412['attributes']:_0x1ad37b[_0xe6be('0x36')];if(_0x16ec48['query'][_0xe6be('0x44')]){_0x1de412[_0xe6be('0x45')]=[{'all':!![]}];}_0x1de412=_[_0xe6be('0x42')]({},_0x1de412,_0x16ec48[_0xe6be('0x43')]);return db[_0xe6be('0x32')][_0xe6be('0x4b')](_0x1de412)['then'](handleEntityNotFound(_0x5502dd,null))[_0xe6be('0x2c')](respondWithResult(_0x5502dd,null))[_0xe6be('0x4c')](handleError(_0x5502dd,null));};exports[_0xe6be('0x4d')]=function(_0x4cba47,_0x32e471){return db[_0xe6be('0x32')][_0xe6be('0x4d')](_0x4cba47[_0xe6be('0x4e')],{})[_0xe6be('0x2c')](respondWithResult(_0x32e471,0xc9))[_0xe6be('0x4c')](handleError(_0x32e471,null));};exports['update']=function(_0x385802,_0x1ec3a0){if(_0x385802['body']['id']){delete _0x385802[_0xe6be('0x4e')]['id'];}return db[_0xe6be('0x32')][_0xe6be('0x4b')]({'where':{'id':_0x385802[_0xe6be('0x49')]['id']}})[_0xe6be('0x2c')](handleEntityNotFound(_0x1ec3a0,null))['then'](saveUpdates(_0x385802[_0xe6be('0x4e')],null))[_0xe6be('0x2c')](respondWithResult(_0x1ec3a0,null))[_0xe6be('0x4c')](handleError(_0x1ec3a0,null));};exports[_0xe6be('0x4f')]=function(_0x422076,_0x4fd1c1){return db['MailTransferReport'][_0xe6be('0x4b')]({'where':{'id':_0x422076[_0xe6be('0x49')]['id']}})[_0xe6be('0x2c')](handleEntityNotFound(_0x4fd1c1,null))[_0xe6be('0x2c')](removeEntity(_0x4fd1c1,null))[_0xe6be('0x4c')](handleError(_0x4fd1c1,null));};exports[_0xe6be('0x50')]=function(_0x143a66,_0x2bf619){return db[_0xe6be('0x32')][_0xe6be('0x50')]()[_0xe6be('0x2c')](respondWithResult(_0x2bf619,null))[_0xe6be('0x4c')](handleError(_0x2bf619,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index acfd77f..68616a4 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 _0x234f=['exports','uniqueid','lodash','util','../../config/logger','api','moment','../../config/environment','./mailTransferReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x234f,0xb6));var _0xf234=function(_0x58a035,_0x2f3b55){_0x58a035=_0x58a035-0x0;var _0x28e9b1=_0x234f[_0x58a035];return _0x28e9b1;};'use strict';var _=require(_0xf234('0x0'));var util=require(_0xf234('0x1'));var logger=require(_0xf234('0x2'))(_0xf234('0x3'));var moment=require(_0xf234('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(_0xf234('0x5'));var attributes=require(_0xf234('0x6'));module[_0xf234('0x7')]=function(_0x3bfa94,_0x334f1c){return _0x3bfa94['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xf234('0x8'),'fields':[_0xf234('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['define','MailTransferReport','report_mail_transfer','uniqueid','util','api','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x9f62,0x154));var _0x29f6=function(_0x10c676,_0x3afed4){_0x10c676=_0x10c676-0x0;var _0xca206d=_0x9f62[_0x10c676];return _0xca206d;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[{'name':_0x29f6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 28b8721..53357d9 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 _0x6f0c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird'];(function(_0x1b0a37,_0x7e68e0){var _0x442bcb=function(_0x5a0b15){while(--_0x5a0b15){_0x1b0a37['push'](_0x1b0a37['shift']());}};_0x442bcb(++_0x7e68e0);}(_0x6f0c,0x105));var _0xc6f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f0c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc6f0('0x0'));var moment=require(_0xc6f0('0x1'));var BPromise=require(_0xc6f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6f0('0x3'));var db=require(_0xc6f0('0x4'))['db'];var utils=require(_0xc6f0('0x5'));var logger=require(_0xc6f0('0x6'))(_0xc6f0('0x7'));var config=require(_0xc6f0('0x8'));var jayson=require(_0xc6f0('0x9'));var client=jayson[_0xc6f0('0xa')][_0xc6f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af764,_0x538ea7,_0x4f4727){return new BPromise(function(_0x50993d,_0x5a82b2){return client[_0xc6f0('0xc')](_0x3af764,_0x4f4727)[_0xc6f0('0xd')](function(_0x2437ee){logger[_0xc6f0('0xe')](_0xc6f0('0xf'),_0x538ea7,_0xc6f0('0x10'));logger[_0xc6f0('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x538ea7,'request\x20sent',JSON['stringify'](_0x2437ee));if(_0x2437ee['error']){if(_0x2437ee[_0xc6f0('0x12')][_0xc6f0('0x13')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x538ea7,_0x2437ee[_0xc6f0('0x12')][_0xc6f0('0x14')]);return _0x5a82b2(_0x2437ee[_0xc6f0('0x12')][_0xc6f0('0x14')]);}logger[_0xc6f0('0x12')](_0xc6f0('0xf'),_0x538ea7,_0x2437ee['error'][_0xc6f0('0x14')]);return _0x50993d(_0x2437ee['error']['message']);}else{logger[_0xc6f0('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x538ea7,'request\x20sent');_0x50993d(_0x2437ee[_0xc6f0('0x15')][_0xc6f0('0x14')]);}})['catch'](function(_0x5a1a66){logger[_0xc6f0('0x12')](_0xc6f0('0xf'),_0x538ea7,_0x5a1a66);_0x5a82b2(_0x5a1a66);});});} \ No newline at end of file +var _0xdc4f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x3150bf,_0x36fe5a){var _0x2c93e0=function(_0x301cc0){while(--_0x301cc0){_0x3150bf['push'](_0x3150bf['shift']());}};_0x2c93e0(++_0x36fe5a);}(_0xdc4f,0x9d));var _0xfdc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc4f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfdc4('0x0'));var util=require(_0xfdc4('0x1'));var moment=require(_0xfdc4('0x2'));var BPromise=require(_0xfdc4('0x3'));var rs=require(_0xfdc4('0x4'));var fs=require('fs');var Redis=require(_0xfdc4('0x5'));var db=require(_0xfdc4('0x6'))['db'];var utils=require(_0xfdc4('0x7'));var logger=require(_0xfdc4('0x8'))(_0xfdc4('0x9'));var config=require(_0xfdc4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfdc4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195fce,_0x11fada,_0x34f619){return new BPromise(function(_0x579c3a,_0x1cf83c){return client[_0xfdc4('0xc')](_0x195fce,_0x34f619)[_0xfdc4('0xd')](function(_0x1642dc){logger[_0xfdc4('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x11fada,_0xfdc4('0xf'));logger[_0xfdc4('0x10')](_0xfdc4('0x11'),_0x11fada,_0xfdc4('0xf'),JSON['stringify'](_0x1642dc));if(_0x1642dc[_0xfdc4('0x12')]){if(_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x13')]===0x1f4){logger[_0xfdc4('0x12')](_0xfdc4('0x14'),_0x11fada,_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);return _0x1cf83c(_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);}logger[_0xfdc4('0x12')](_0xfdc4('0x14'),_0x11fada,_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);return _0x579c3a(_0x1642dc[_0xfdc4('0x12')][_0xfdc4('0x15')]);}else{logger[_0xfdc4('0xe')](_0xfdc4('0x14'),_0x11fada,_0xfdc4('0xf'));_0x579c3a(_0x1642dc[_0xfdc4('0x16')][_0xfdc4('0x15')]);}})['catch'](function(_0x20795a){logger[_0xfdc4('0x12')](_0xfdc4('0x14'),_0x11fada,_0x20795a);_0x1cf83c(_0x20795a);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ddde1d1..2733f4e 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 _0xddf9=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xddf9,0x117));var _0x9ddf=function(_0x2e8abe,_0x3504a7){_0x2e8abe=_0x2e8abe-0x0;var _0x2838f9=_0xddf9[_0x2e8abe];return _0x2838f9;};'use strict';var multer=require(_0x9ddf('0x0'));var util=require(_0x9ddf('0x1'));var path=require(_0x9ddf('0x2'));var timeout=require(_0x9ddf('0x3'));var express=require(_0x9ddf('0x4'));var router=express['Router']();var fs_extra=require(_0x9ddf('0x5'));var auth=require(_0x9ddf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9ddf('0x7'));var controller=require(_0x9ddf('0x8'));router[_0x9ddf('0x9')]('/',auth[_0x9ddf('0xa')](),controller[_0x9ddf('0xb')]);router[_0x9ddf('0x9')](_0x9ddf('0xc'),auth[_0x9ddf('0xa')](),controller[_0x9ddf('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9ddf('0xe')]);router[_0x9ddf('0xf')]('/',auth[_0x9ddf('0xa')](),controller['create']);router[_0x9ddf('0x10')]('/:id',auth[_0x9ddf('0xa')](),controller[_0x9ddf('0x11')]);router[_0x9ddf('0x12')](_0x9ddf('0x13'),auth['isAuthenticated'](),controller[_0x9ddf('0x14')]);module[_0x9ddf('0x15')]=router; \ No newline at end of file +var _0x703f=['show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2cdf1f,_0x94f532){var _0x3e6af9=function(_0x2680de){while(--_0x2680de){_0x2cdf1f['push'](_0x2cdf1f['shift']());}};_0x3e6af9(++_0x94f532);}(_0x703f,0xf6));var _0xf703=function(_0x3a285d,_0x449b5a){_0x3a285d=_0x3a285d-0x0;var _0x378bfd=_0x703f[_0x3a285d];return _0x378bfd;};'use strict';var multer=require(_0xf703('0x0'));var util=require(_0xf703('0x1'));var path=require('path');var timeout=require(_0xf703('0x2'));var express=require(_0xf703('0x3'));var router=express[_0xf703('0x4')]();var fs_extra=require(_0xf703('0x5'));var auth=require(_0xf703('0x6'));var interaction=require(_0xf703('0x7'));var config=require('../../config/environment');var controller=require(_0xf703('0x8'));router[_0xf703('0x9')]('/',auth[_0xf703('0xa')](),controller['index']);router['get'](_0xf703('0xb'),auth['isAuthenticated'](),controller[_0xf703('0xc')]);router['get'](_0xf703('0xd'),auth['isAuthenticated'](),controller[_0xf703('0xe')]);router[_0xf703('0xf')]('/',auth[_0xf703('0xa')](),controller[_0xf703('0x10')]);router[_0xf703('0x11')]('/:id',auth[_0xf703('0xa')](),controller['update']);router['delete'](_0xf703('0xd'),auth['isAuthenticated'](),controller[_0xf703('0x12')]);module[_0xf703('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 2f2601b..c4c4316 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 _0x58c1=['setDataValue','duration','talk:[start]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','exitAt'];(function(_0x152ffe,_0x7e95d){var _0x35324c=function(_0x113208){while(--_0x113208){_0x152ffe['push'](_0x152ffe['shift']());}};_0x35324c(++_0x7e95d);}(_0x58c1,0xd6));var _0x158c=function(_0x5a535b,_0x168cb9){_0x5a535b=_0x5a535b-0x0;var _0x20a54e=_0x58c1[_0x5a535b];return _0x20a54e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x158c('0x0'));module[_0x158c('0x1')]={'channel':{'type':Sequelize[_0x158c('0x2')]},'membername':{'type':Sequelize[_0x158c('0x2')]},'interface':{'type':Sequelize[_0x158c('0x2')]},'type':{'type':Sequelize[_0x158c('0x2')],'defaultValue':_0x158c('0x3'),'comment':_0x158c('0x4')},'duration':{'type':Sequelize[_0x158c('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x158c('0x6')],'set':function(_0x139e57){var _0x103e77=moment(_0x139e57);var _0x2be2be=moment(this['getDataValue'](_0x158c('0x7')));var _0xd4f97c=_0x103e77[_0x158c('0x8')](_0x2be2be,_0x158c('0x9'));this['setDataValue'](_0x158c('0xa'),_0x139e57);this[_0x158c('0xb')](_0x158c('0xc'),_0xd4f97c>=0x0?_0xd4f97c:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x158c('0xd')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x158c('0xe')},'role':{'type':Sequelize[_0x158c('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x158c('0x2')]}}; \ No newline at end of file +var _0x42d6=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt'];(function(_0x72f0d6,_0x1ba28b){var _0x1a73e8=function(_0x883490){while(--_0x883490){_0x72f0d6['push'](_0x72f0d6['shift']());}};_0x1a73e8(++_0x1ba28b);}(_0x42d6,0x1f4));var _0x642d=function(_0x550ac9,_0x5e8504){_0x550ac9=_0x550ac9-0x0;var _0x54a679=_0x42d6[_0x550ac9];return _0x54a679;};'use strict';var Sequelize=require(_0x642d('0x0'));var moment=require(_0x642d('0x1'));module[_0x642d('0x2')]={'channel':{'type':Sequelize[_0x642d('0x3')]},'membername':{'type':Sequelize[_0x642d('0x3')]},'interface':{'type':Sequelize[_0x642d('0x3')]},'type':{'type':Sequelize[_0x642d('0x3')],'defaultValue':_0x642d('0x4'),'comment':_0x642d('0x5')},'duration':{'type':Sequelize[_0x642d('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x642d('0x7')],'set':function(_0x2f661f){var _0x383ea9=moment(_0x2f661f);var _0x3eb478=moment(this[_0x642d('0x8')](_0x642d('0x9')));var _0x5c868f=_0x383ea9['diff'](_0x3eb478,_0x642d('0xa'));this[_0x642d('0xb')](_0x642d('0xc'),_0x2f661f);this[_0x642d('0xb')](_0x642d('0xd'),_0x5c868f>=0x0?_0x5c868f:null);}},'data1':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0xe')},'data2':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0x642d('0x10')},'data4':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0x11')},'data5':{'type':Sequelize[_0x642d('0x3')],'comment':_0x642d('0x12')},'role':{'type':Sequelize[_0x642d('0x3')]},'internal':{'type':Sequelize[_0x642d('0x6')]},'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 edc6ca5..d43a27a 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x34e8,0x12c));var _0x834e=function(_0x46fd9a,_0x30d955){_0x46fd9a=_0x46fd9a-0x0;var _0x15b0c=_0x34e8[_0x46fd9a];return _0x15b0c;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55ca,0x126));var _0xa55c=function(_0x3dc587,_0x2ebc6c){_0x3dc587=_0x3dc587-0x0;var _0x29f93a=_0x55ca[_0x3dc587];return _0x29f93a;};'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 484771d..8e1d0fa 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 _0x9c51=['report_member','membername_interface','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MemberReport'];(function(_0x1570c3,_0x31a8fe){var _0x284db3=function(_0x42a678){while(--_0x42a678){_0x1570c3['push'](_0x1570c3['shift']());}};_0x284db3(++_0x31a8fe);}(_0x9c51,0x8f));var _0x19c5=function(_0x5cdf4a,_0x13a7d1){_0x5cdf4a=_0x5cdf4a-0x0;var _0x1a3296=_0x9c51[_0x5cdf4a];return _0x1a3296;};'use strict';var _=require(_0x19c5('0x0'));var util=require(_0x19c5('0x1'));var logger=require(_0x19c5('0x2'))(_0x19c5('0x3'));var moment=require('moment');var BPromise=require(_0x19c5('0x4'));var rp=require(_0x19c5('0x5'));var fs=require('fs');var path=require(_0x19c5('0x6'));var rimraf=require(_0x19c5('0x7'));var config=require(_0x19c5('0x8'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x12454a,_0x31ec70){return _0x12454a[_0x19c5('0x9')](_0x19c5('0xa'),attributes,{'tableName':_0x19c5('0xb'),'paranoid':![],'indexes':[{'name':_0x19c5('0xc'),'fields':['membername',_0x19c5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5836=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x72a833,_0x31c60e){var _0x2977ed=function(_0x5a80cd){while(--_0x5a80cd){_0x72a833['push'](_0x72a833['shift']());}};_0x2977ed(++_0x31c60e);}(_0x5836,0x12c));var _0x6583=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x5836[_0x1daaa9];return _0x1dd221;};'use strict';var _=require(_0x6583('0x0'));var util=require('util');var logger=require(_0x6583('0x1'))(_0x6583('0x2'));var moment=require('moment');var BPromise=require(_0x6583('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6583('0x4'));var rimraf=require(_0x6583('0x5'));var config=require(_0x6583('0x6'));var attributes=require(_0x6583('0x7'));module[_0x6583('0x8')]=function(_0x4cd71c,_0x17d685){return _0x4cd71c[_0x6583('0x9')](_0x6583('0xa'),attributes,{'tableName':_0x6583('0xb'),'paranoid':![],'indexes':[{'name':_0x6583('0xc'),'fields':[_0x6583('0xd'),_0x6583('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 389389a..03feb2d 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 _0x9fc5=['info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','MemberReport','findAll','options','where','attributes','limit','include','map','model','GetMemberReport','create','body','raw','CreateMemberReport','UpdateMemberReport','update','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4e87b2,_0x16af79){var _0xddad89=function(_0x4d6f01){while(--_0x4d6f01){_0x4e87b2['push'](_0x4e87b2['shift']());}};_0xddad89(++_0x16af79);}(_0x9fc5,0xb6));var _0x59fc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9fc5[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var moment=require(_0x59fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x59fc('0x2'));var fs=require('fs');var Redis=require(_0x59fc('0x3'));var db=require(_0x59fc('0x4'))['db'];var utils=require(_0x59fc('0x5'));var logger=require(_0x59fc('0x6'))(_0x59fc('0x7'));var config=require(_0x59fc('0x8'));var jayson=require(_0x59fc('0x9'));var client=jayson['client'][_0x59fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13897f,_0x2c47fb,_0x55fa6d){return new BPromise(function(_0xdd2bb9,_0x313063){return client[_0x59fc('0xb')](_0x13897f,_0x55fa6d)[_0x59fc('0xc')](function(_0x39bc72){logger[_0x59fc('0xd')](_0x59fc('0xe'),_0x2c47fb,'request\x20sent');logger[_0x59fc('0xf')](_0x59fc('0x10'),_0x2c47fb,_0x59fc('0x11'),JSON[_0x59fc('0x12')](_0x39bc72));if(_0x39bc72[_0x59fc('0x13')]){if(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x14')]===0x1f4){logger['error'](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0x313063(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0xdd2bb9(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}else{logger['info'](_0x59fc('0xe'),_0x2c47fb,_0x59fc('0x11'));_0xdd2bb9(_0x39bc72['result'][_0x59fc('0x15')]);}})[_0x59fc('0x16')](function(_0x4162c4){logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x4162c4);_0x313063(_0x4162c4);});});}exports['GetMemberReport']=function(_0x4d72f8){var _0x40fe8d=this;return new Promise(function(_0x1ab367,_0x2a4c5f){return db[_0x59fc('0x17')][_0x59fc('0x18')]({'raw':_0x4d72f8[_0x59fc('0x19')]?_0x4d72f8[_0x59fc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4d72f8[_0x59fc('0x19')]?_0x4d72f8['options'][_0x59fc('0x1a')]||null:null,'attributes':_0x4d72f8['options']?_0x4d72f8[_0x59fc('0x19')][_0x59fc('0x1b')]||null:null,'limit':_0x4d72f8[_0x59fc('0x19')]?_0x4d72f8[_0x59fc('0x19')][_0x59fc('0x1c')]||null:null,'include':_0x4d72f8[_0x59fc('0x19')]?_0x4d72f8['options'][_0x59fc('0x1d')]?_[_0x59fc('0x1e')](_0x4d72f8['options']['include'],function(_0x3ccb60){return{'model':db[_0x3ccb60[_0x59fc('0x1f')]],'as':_0x3ccb60['as'],'attributes':_0x3ccb60[_0x59fc('0x1b')],'include':_0x3ccb60[_0x59fc('0x1d')]?_[_0x59fc('0x1e')](_0x3ccb60[_0x59fc('0x1d')],function(_0x11e92e){return{'model':db[_0x11e92e[_0x59fc('0x1f')]],'as':_0x11e92e['as'],'attributes':_0x11e92e[_0x59fc('0x1b')],'include':_0x11e92e['include']?_[_0x59fc('0x1e')](_0x11e92e['include'],function(_0x1975a1){return{'model':db[_0x1975a1['model']],'as':_0x1975a1['as'],'attributes':_0x1975a1[_0x59fc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x59fc('0xc')](function(_0x5573e5){logger[_0x59fc('0xd')](_0x59fc('0x20'),_0x4d72f8);logger['debug'](_0x59fc('0x20'),_0x4d72f8,JSON[_0x59fc('0x12')](_0x5573e5));_0x1ab367(_0x5573e5);})[_0x59fc('0x16')](function(_0x222fe6){logger[_0x59fc('0x13')]('GetMemberReport',_0x222fe6[_0x59fc('0x15')],_0x4d72f8);_0x2a4c5f(_0x40fe8d[_0x59fc('0x13')](0x1f4,_0x222fe6[_0x59fc('0x15')]));});});};exports['CreateMemberReport']=function(_0x15146e){var _0x1dd1a1=this;return new Promise(function(_0x4f5e9f,_0x2059ef){return db[_0x59fc('0x17')][_0x59fc('0x21')](_0x15146e[_0x59fc('0x22')],{'raw':_0x15146e[_0x59fc('0x19')]?_0x15146e['options'][_0x59fc('0x23')]===undefined?!![]:![]:!![]})[_0x59fc('0xc')](function(_0x369829){logger['info'](_0x59fc('0x24'),_0x15146e);logger['debug'](_0x59fc('0x24'),_0x15146e,JSON[_0x59fc('0x12')](_0x369829));_0x4f5e9f(_0x369829);})[_0x59fc('0x16')](function(_0x4a1394){logger['error'](_0x59fc('0x24'),_0x4a1394[_0x59fc('0x15')],_0x15146e);_0x2059ef(_0x1dd1a1[_0x59fc('0x13')](0x1f4,_0x4a1394[_0x59fc('0x15')]));});});};exports[_0x59fc('0x25')]=function(_0x3610d0){var _0xf57e05=this;return new Promise(function(_0x22ef91,_0x28d941){return db[_0x59fc('0x17')][_0x59fc('0x26')](_0x3610d0[_0x59fc('0x22')],{'raw':_0x3610d0[_0x59fc('0x19')]?_0x3610d0[_0x59fc('0x19')][_0x59fc('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3610d0[_0x59fc('0x19')]?_0x3610d0[_0x59fc('0x19')]['where']||null:null,'attributes':_0x3610d0[_0x59fc('0x19')]?_0x3610d0[_0x59fc('0x19')][_0x59fc('0x1b')]||null:null,'limit':_0x3610d0['options']?_0x3610d0['options']['limit']||null:null})['then'](function(_0x9bcea4){logger[_0x59fc('0xd')]('UpdateMemberReport',_0x3610d0);logger[_0x59fc('0xf')](_0x59fc('0x25'),_0x3610d0,JSON[_0x59fc('0x12')](_0x9bcea4));_0x22ef91(_0x9bcea4);})[_0x59fc('0x16')](function(_0x3d1678){logger[_0x59fc('0x13')]('UpdateMemberReport',_0x3d1678['message'],_0x3610d0);_0x28d941(_0xf57e05[_0x59fc('0x13')](0x1f4,_0x3d1678[_0x59fc('0x15')]));});});}; \ No newline at end of file +var _0xae30=['debug','CreateMemberReport','create','body','raw','where','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetMemberReport','findAll','options','attributes','limit','include','model','map'];(function(_0x20b031,_0x2d2893){var _0x3bfebd=function(_0x3bd8d9){while(--_0x3bd8d9){_0x20b031['push'](_0x20b031['shift']());}};_0x3bfebd(++_0x2d2893);}(_0xae30,0x10a));var _0x0ae3=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0xae30[_0x2fe959];return _0x2f6ace;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var moment=require(_0x0ae3('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae3('0x3'));var fs=require('fs');var Redis=require(_0x0ae3('0x4'));var db=require(_0x0ae3('0x5'))['db'];var utils=require(_0x0ae3('0x6'));var logger=require('../../config/logger')(_0x0ae3('0x7'));var config=require(_0x0ae3('0x8'));var jayson=require(_0x0ae3('0x9'));var client=jayson[_0x0ae3('0xa')][_0x0ae3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xda3853,_0x2b81f4,_0x15b7e2){return new BPromise(function(_0x32ea6e,_0x34e783){return client[_0x0ae3('0xc')](_0xda3853,_0x15b7e2)[_0x0ae3('0xd')](function(_0x32ca2c){logger['info'](_0x0ae3('0xe'),_0x2b81f4,_0x0ae3('0xf'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x2b81f4,_0x0ae3('0xf'),JSON[_0x0ae3('0x10')](_0x32ca2c));if(_0x32ca2c[_0x0ae3('0x11')]){if(_0x32ca2c[_0x0ae3('0x11')]['code']===0x1f4){logger['error'](_0x0ae3('0xe'),_0x2b81f4,_0x32ca2c[_0x0ae3('0x11')]['message']);return _0x34e783(_0x32ca2c['error'][_0x0ae3('0x12')]);}logger['error'](_0x0ae3('0xe'),_0x2b81f4,_0x32ca2c[_0x0ae3('0x11')][_0x0ae3('0x12')]);return _0x32ea6e(_0x32ca2c[_0x0ae3('0x11')][_0x0ae3('0x12')]);}else{logger[_0x0ae3('0x13')](_0x0ae3('0xe'),_0x2b81f4,'request\x20sent');_0x32ea6e(_0x32ca2c[_0x0ae3('0x14')]['message']);}})[_0x0ae3('0x15')](function(_0x254a0f){logger[_0x0ae3('0x11')](_0x0ae3('0xe'),_0x2b81f4,_0x254a0f);_0x34e783(_0x254a0f);});});}exports[_0x0ae3('0x16')]=function(_0x40edc6){var _0x146c15=this;return new Promise(function(_0x1bf406,_0x37adcd){return db['MemberReport'][_0x0ae3('0x17')]({'raw':_0x40edc6['options']?_0x40edc6['options']['raw']===undefined?!![]:![]:!![],'where':_0x40edc6['options']?_0x40edc6['options']['where']||null:null,'attributes':_0x40edc6['options']?_0x40edc6[_0x0ae3('0x18')][_0x0ae3('0x19')]||null:null,'limit':_0x40edc6[_0x0ae3('0x18')]?_0x40edc6['options'][_0x0ae3('0x1a')]||null:null,'include':_0x40edc6['options']?_0x40edc6[_0x0ae3('0x18')]['include']?_['map'](_0x40edc6['options'][_0x0ae3('0x1b')],function(_0x3b49a0){return{'model':db[_0x3b49a0[_0x0ae3('0x1c')]],'as':_0x3b49a0['as'],'attributes':_0x3b49a0['attributes'],'include':_0x3b49a0['include']?_[_0x0ae3('0x1d')](_0x3b49a0[_0x0ae3('0x1b')],function(_0x5a76e5){return{'model':db[_0x5a76e5[_0x0ae3('0x1c')]],'as':_0x5a76e5['as'],'attributes':_0x5a76e5[_0x0ae3('0x19')],'include':_0x5a76e5[_0x0ae3('0x1b')]?_['map'](_0x5a76e5[_0x0ae3('0x1b')],function(_0x1f9cde){return{'model':db[_0x1f9cde[_0x0ae3('0x1c')]],'as':_0x1f9cde['as'],'attributes':_0x1f9cde['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ae3('0xd')](function(_0x3edb9f){logger[_0x0ae3('0x13')]('GetMemberReport',_0x40edc6);logger[_0x0ae3('0x1e')](_0x0ae3('0x16'),_0x40edc6,JSON[_0x0ae3('0x10')](_0x3edb9f));_0x1bf406(_0x3edb9f);})[_0x0ae3('0x15')](function(_0x1f8f61){logger[_0x0ae3('0x11')](_0x0ae3('0x16'),_0x1f8f61[_0x0ae3('0x12')],_0x40edc6);_0x37adcd(_0x146c15[_0x0ae3('0x11')](0x1f4,_0x1f8f61[_0x0ae3('0x12')]));});});};exports[_0x0ae3('0x1f')]=function(_0x2567db){var _0x23f213=this;return new Promise(function(_0xecfe38,_0x10a48a){return db['MemberReport'][_0x0ae3('0x20')](_0x2567db[_0x0ae3('0x21')],{'raw':_0x2567db[_0x0ae3('0x18')]?_0x2567db[_0x0ae3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0ae3('0xd')](function(_0xfbae19){logger[_0x0ae3('0x13')](_0x0ae3('0x1f'),_0x2567db);logger[_0x0ae3('0x1e')](_0x0ae3('0x1f'),_0x2567db,JSON['stringify'](_0xfbae19));_0xecfe38(_0xfbae19);})[_0x0ae3('0x15')](function(_0xebfbf6){logger[_0x0ae3('0x11')](_0x0ae3('0x1f'),_0xebfbf6[_0x0ae3('0x12')],_0x2567db);_0x10a48a(_0x23f213[_0x0ae3('0x11')](0x1f4,_0xebfbf6[_0x0ae3('0x12')]));});});};exports['UpdateMemberReport']=function(_0x512045){var _0x34b91a=this;return new Promise(function(_0x45ac7d,_0x104ae9){return db['MemberReport']['update'](_0x512045[_0x0ae3('0x21')],{'raw':_0x512045[_0x0ae3('0x18')]?_0x512045[_0x0ae3('0x18')][_0x0ae3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x512045[_0x0ae3('0x18')]?_0x512045[_0x0ae3('0x18')][_0x0ae3('0x23')]||null:null,'attributes':_0x512045['options']?_0x512045[_0x0ae3('0x18')][_0x0ae3('0x19')]||null:null,'limit':_0x512045[_0x0ae3('0x18')]?_0x512045['options']['limit']||null:null})['then'](function(_0x76fe78){logger[_0x0ae3('0x13')]('UpdateMemberReport',_0x512045);logger[_0x0ae3('0x1e')](_0x0ae3('0x24'),_0x512045,JSON[_0x0ae3('0x10')](_0x76fe78));_0x45ac7d(_0x76fe78);})['catch'](function(_0x2534d3){logger['error'](_0x0ae3('0x24'),_0x2534d3[_0x0ae3('0x12')],_0x512045);_0x104ae9(_0x34b91a['error'](0x1f4,_0x2534d3[_0x0ae3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b33c70f..61fbe7b 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 _0x1298=['../../components/interaction/service','../../config/environment','get','index','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x498aa1,_0x34f6cc){var _0x42acb6=function(_0x3d8189){while(--_0x3d8189){_0x498aa1['push'](_0x498aa1['shift']());}};_0x42acb6(++_0x34f6cc);}(_0x1298,0x19e));var _0x8129=function(_0x3b2e2b,_0x5674d2){_0x3b2e2b=_0x3b2e2b-0x0;var _0x49b75e=_0x1298[_0x3b2e2b];return _0x49b75e;};'use strict';var multer=require('multer');var util=require(_0x8129('0x0'));var path=require('path');var timeout=require(_0x8129('0x1'));var express=require(_0x8129('0x2'));var router=express[_0x8129('0x3')]();var fs_extra=require(_0x8129('0x4'));var auth=require(_0x8129('0x5'));var interaction=require(_0x8129('0x6'));var config=require(_0x8129('0x7'));var controller=require('./migration.controller');router[_0x8129('0x8')]('/',controller[_0x8129('0x9')]);module['exports']=router; \ No newline at end of file +var _0x0fc8=['../../components/auth/service','./migration.controller','get','index','exports','multer','util','path','Router','fs-extra'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0fc8,0xe1));var _0x80fc=function(_0x2c66f0,_0x408c9c){_0x2c66f0=_0x2c66f0-0x0;var _0x545c8b=_0x0fc8[_0x2c66f0];return _0x545c8b;};'use strict';var multer=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var path=require(_0x80fc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x80fc('0x3')]();var fs_extra=require(_0x80fc('0x4'));var auth=require(_0x80fc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x80fc('0x6'));router[_0x80fc('0x7')]('/',controller[_0x80fc('0x8')]);module[_0x80fc('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3753077..a701208 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 _0xf92a=['exports','STRING'];(function(_0x3a391e,_0x30b04a){var _0x43ebf4=function(_0x4399be){while(--_0x4399be){_0x3a391e['push'](_0x3a391e['shift']());}};_0x43ebf4(++_0x30b04a);}(_0xf92a,0xcc));var _0xaf92=function(_0x13508c,_0x18ff95){_0x13508c=_0x13508c-0x0;var _0x3f9f38=_0xf92a[_0x13508c];return _0x3f9f38;};'use strict';var Sequelize=require('sequelize');module[_0xaf92('0x0')]={'version':{'type':Sequelize[_0xaf92('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x78f1=['STRING','version','sequelize'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x78f1,0x1af));var _0x178f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x78f1[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x178f('0x0'));module['exports']={'version':{'type':Sequelize[_0x178f('0x1')],'unique':_0x178f('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 30f7776..a924df4 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 _0x5d07=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','Migration','fieldName','type','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','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','ioredis'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5d07,0x190));var _0x75d0=function(_0x3d7f00,_0x2c06dd){_0x3d7f00=_0x3d7f00-0x0;var _0x4da719=_0x5d07[_0x3d7f00];return _0x4da719;};'use strict';var emlformat=require(_0x75d0('0x0'));var rimraf=require(_0x75d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x75d0('0x2'));var rp=require(_0x75d0('0x3'));var moment=require(_0x75d0('0x4'));var BPromise=require(_0x75d0('0x5'));var Mustache=require(_0x75d0('0x6'));var util=require(_0x75d0('0x7'));var path=require(_0x75d0('0x8'));var sox=require(_0x75d0('0x9'));var csv=require(_0x75d0('0xa'));var ejs=require(_0x75d0('0xb'));var fs=require('fs');var fs_extra=require(_0x75d0('0xc'));var _=require(_0x75d0('0xd'));var squel=require(_0x75d0('0xe'));var crypto=require(_0x75d0('0xf'));var jsforce=require(_0x75d0('0x10'));var deskjs=require(_0x75d0('0x11'));var toCsv=require(_0x75d0('0xa'));var querystring=require(_0x75d0('0x12'));var Papa=require('papaparse');var Redis=require(_0x75d0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x75d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75d0('0x15'));var logger=require(_0x75d0('0x16'))(_0x75d0('0x17'));var utils=require(_0x75d0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x75d0('0x19'));var db=require(_0x75d0('0x1a'))['db'];function respondWithStatusCode(_0x32ed21,_0x19c4a2){_0x19c4a2=_0x19c4a2||0xcc;return function(_0x1c6b91){if(_0x1c6b91){return _0x32ed21[_0x75d0('0x1b')](_0x19c4a2);}return _0x32ed21[_0x75d0('0x1c')](_0x19c4a2)[_0x75d0('0x1d')]();};}function respondWithResult(_0x19991d,_0x33a331){_0x33a331=_0x33a331||0xc8;return function(_0x173468){if(_0x173468){return _0x19991d['status'](_0x33a331)[_0x75d0('0x1e')](_0x173468);}};}function respondWithFilteredResult(_0x107df2,_0x238527){return function(_0x361e1f){if(_0x361e1f){var _0x5648dd=typeof _0x238527[_0x75d0('0x1f')]===_0x75d0('0x20')&&typeof _0x238527['limit']===_0x75d0('0x20');var _0x207953=_0x361e1f['count'];var _0x7383c2=_0x5648dd?0x0:_0x238527['offset'];var _0x57e835=_0x5648dd?_0x361e1f[_0x75d0('0x21')]:_0x238527['offset']+_0x238527[_0x75d0('0x22')];var _0x9fe23b;if(_0x57e835>=_0x207953){_0x57e835=_0x207953;_0x9fe23b=0xc8;}else{_0x9fe23b=0xce;}_0x107df2['status'](_0x9fe23b);return _0x107df2['set'](_0x75d0('0x23'),_0x7383c2+'-'+_0x57e835+'/'+_0x207953)['json'](_0x361e1f);}return null;};}function patchUpdates(_0x107175){return function(_0x8a1ed4){try{jsonpatch[_0x75d0('0x24')](_0x8a1ed4,_0x107175,!![]);}catch(_0x5119b8){return BPromise['reject'](_0x5119b8);}return _0x8a1ed4['save']();};}function saveUpdates(_0x335ab8,_0x596c6b){return function(_0x4d62cd){if(_0x4d62cd){return _0x4d62cd[_0x75d0('0x25')](_0x335ab8)[_0x75d0('0x26')](function(_0x2070d1){return _0x2070d1;});}return null;};}function removeEntity(_0x476f77,_0x297651){return function(_0x1ed1f5){if(_0x1ed1f5){return _0x1ed1f5[_0x75d0('0x27')]()[_0x75d0('0x26')](function(){_0x476f77['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x596f67,_0x4075c1){return function(_0x22d7e1){if(!_0x22d7e1){_0x596f67['sendStatus'](0x194);}return _0x22d7e1;};}function handleError(_0x235ec9,_0x40e0fc){_0x40e0fc=_0x40e0fc||0x1f4;return function(_0x408ccd){logger[_0x75d0('0x28')](_0x408ccd[_0x75d0('0x29')]);if(_0x408ccd[_0x75d0('0x2a')]){delete _0x408ccd['name'];}_0x235ec9[_0x75d0('0x1c')](_0x40e0fc)[_0x75d0('0x2b')](_0x408ccd);};}exports[_0x75d0('0x2c')]=function(_0x2b53c4,_0xe9a324){var _0x4983c6={},_0x117701={},_0x3789c4={'count':0x0,'rows':[]};var _0x59e959=_[_0x75d0('0x2d')](db[_0x75d0('0x2e')]['rawAttributes'],function(_0x3cf0b7){return{'name':_0x3cf0b7[_0x75d0('0x2f')],'type':_0x3cf0b7[_0x75d0('0x30')]['key']};});_0x117701[_0x75d0('0x31')]=_['map'](_0x59e959,_0x75d0('0x2a'));_0x117701['query']=_[_0x75d0('0x32')](_0x2b53c4['query']);_0x117701[_0x75d0('0x33')]=_[_0x75d0('0x34')](_0x117701[_0x75d0('0x31')],_0x117701[_0x75d0('0x35')]);_0x4983c6[_0x75d0('0x36')]=_[_0x75d0('0x34')](_0x117701[_0x75d0('0x31')],qs[_0x75d0('0x37')](_0x2b53c4[_0x75d0('0x35')][_0x75d0('0x37')]));_0x4983c6['attributes']=_0x4983c6[_0x75d0('0x36')]['length']?_0x4983c6[_0x75d0('0x36')]:_0x117701[_0x75d0('0x31')];if(!_0x2b53c4[_0x75d0('0x35')]['hasOwnProperty'](_0x75d0('0x38'))){_0x4983c6[_0x75d0('0x22')]=qs[_0x75d0('0x22')](_0x2b53c4[_0x75d0('0x35')][_0x75d0('0x22')]);_0x4983c6['offset']=qs[_0x75d0('0x1f')](_0x2b53c4['query'][_0x75d0('0x1f')]);}_0x4983c6[_0x75d0('0x39')]=qs[_0x75d0('0x3a')](_0x2b53c4[_0x75d0('0x35')][_0x75d0('0x3a')]);_0x4983c6[_0x75d0('0x3b')]=qs[_0x75d0('0x33')](_[_0x75d0('0x3c')](_0x2b53c4[_0x75d0('0x35')],_0x117701[_0x75d0('0x33')]),_0x59e959);if(_0x2b53c4[_0x75d0('0x35')][_0x75d0('0x3d')]){_0x4983c6['where']=_[_0x75d0('0x3e')](_0x4983c6[_0x75d0('0x3b')],{'$or':_[_0x75d0('0x2d')](_0x59e959,function(_0x582415){if(_0x582415['type']!==_0x75d0('0x3f')){var _0x39c613={};_0x39c613[_0x582415[_0x75d0('0x2a')]]={'$like':'%'+_0x2b53c4[_0x75d0('0x35')][_0x75d0('0x3d')]+'%'};return _0x39c613;}})});}_0x4983c6=_['merge']({},_0x4983c6,_0x2b53c4[_0x75d0('0x40')]);var _0x4bcdb4={'where':_0x4983c6[_0x75d0('0x3b')]};return db[_0x75d0('0x2e')]['count'](_0x4bcdb4)[_0x75d0('0x26')](function(_0x21e39d){_0x3789c4[_0x75d0('0x21')]=_0x21e39d;if(_0x2b53c4[_0x75d0('0x35')][_0x75d0('0x41')]){_0x4983c6[_0x75d0('0x42')]=[{'all':!![]}];}return db[_0x75d0('0x2e')][_0x75d0('0x43')](_0x4983c6);})[_0x75d0('0x26')](function(_0x5a1fa8){_0x3789c4[_0x75d0('0x44')]=_0x5a1fa8;return _0x3789c4;})[_0x75d0('0x26')](respondWithFilteredResult(_0xe9a324,_0x4983c6))[_0x75d0('0x45')](handleError(_0xe9a324,null));}; \ No newline at end of file +var _0x395c=['attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','then','sendStatus','name','send','index','map','Migration','rawAttributes','type','key','model','query','keys','filters'];(function(_0x483aac,_0x36d314){var _0x55bf9e=function(_0x871bf0){while(--_0x871bf0){_0x483aac['push'](_0x483aac['shift']());}};_0x55bf9e(++_0x36d314);}(_0x395c,0x8f));var _0xc395=function(_0x2054a8,_0x120df4){_0x2054a8=_0x2054a8-0x0;var _0xb84987=_0x395c[_0x2054a8];return _0xb84987;};'use strict';var emlformat=require(_0xc395('0x0'));var rimraf=require(_0xc395('0x1'));var zipdir=require(_0xc395('0x2'));var jsonpatch=require(_0xc395('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc395('0x4'));var util=require(_0xc395('0x5'));var path=require('path');var sox=require(_0xc395('0x6'));var csv=require('to-csv');var ejs=require(_0xc395('0x7'));var fs=require('fs');var fs_extra=require(_0xc395('0x8'));var _=require(_0xc395('0x9'));var squel=require(_0xc395('0xa'));var crypto=require(_0xc395('0xb'));var jsforce=require(_0xc395('0xc'));var deskjs=require(_0xc395('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc395('0xe'));var Papa=require('papaparse');var Redis=require(_0xc395('0xf'));var authService=require(_0xc395('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc395('0x11'));var hardwareService=require(_0xc395('0x12'));var logger=require(_0xc395('0x13'))('api');var utils=require(_0xc395('0x14'));var config=require(_0xc395('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc395('0x16'))['db'];function respondWithStatusCode(_0x4d9219,_0x1c1448){_0x1c1448=_0x1c1448||0xcc;return function(_0x3f73d3){if(_0x3f73d3){return _0x4d9219['sendStatus'](_0x1c1448);}return _0x4d9219[_0xc395('0x17')](_0x1c1448)[_0xc395('0x18')]();};}function respondWithResult(_0x295d6d,_0x507dd2){_0x507dd2=_0x507dd2||0xc8;return function(_0x1ae47f){if(_0x1ae47f){return _0x295d6d['status'](_0x507dd2)['json'](_0x1ae47f);}};}function respondWithFilteredResult(_0x4fc5c6,_0x5231df){return function(_0x2eb975){if(_0x2eb975){var _0x3ea937=typeof _0x5231df[_0xc395('0x19')]===_0xc395('0x1a')&&typeof _0x5231df[_0xc395('0x1b')]===_0xc395('0x1a');var _0x5261b7=_0x2eb975[_0xc395('0x1c')];var _0x22750c=_0x3ea937?0x0:_0x5231df['offset'];var _0x6ab3f9=_0x3ea937?_0x2eb975[_0xc395('0x1c')]:_0x5231df[_0xc395('0x19')]+_0x5231df[_0xc395('0x1b')];var _0x428fe3;if(_0x6ab3f9>=_0x5261b7){_0x6ab3f9=_0x5261b7;_0x428fe3=0xc8;}else{_0x428fe3=0xce;}_0x4fc5c6['status'](_0x428fe3);return _0x4fc5c6[_0xc395('0x1d')](_0xc395('0x1e'),_0x22750c+'-'+_0x6ab3f9+'/'+_0x5261b7)[_0xc395('0x1f')](_0x2eb975);}return null;};}function patchUpdates(_0x2838ff){return function(_0x2c4b37){try{jsonpatch['apply'](_0x2c4b37,_0x2838ff,!![]);}catch(_0x5190c1){return BPromise['reject'](_0x5190c1);}return _0x2c4b37[_0xc395('0x20')]();};}function saveUpdates(_0x5d0238,_0x4d076f){return function(_0x3491f9){if(_0x3491f9){return _0x3491f9[_0xc395('0x21')](_0x5d0238)['then'](function(_0x3bc531){return _0x3bc531;});}return null;};}function removeEntity(_0x48e2d7,_0x512894){return function(_0x4380a5){if(_0x4380a5){return _0x4380a5[_0xc395('0x22')]()[_0xc395('0x23')](function(){_0x48e2d7[_0xc395('0x17')](0xcc)[_0xc395('0x18')]();});}};}function handleEntityNotFound(_0x417ea6,_0x462258){return function(_0x5c6ae0){if(!_0x5c6ae0){_0x417ea6[_0xc395('0x24')](0x194);}return _0x5c6ae0;};}function handleError(_0xf9ed78,_0x2b08f8){_0x2b08f8=_0x2b08f8||0x1f4;return function(_0x13cbee){logger['error'](_0x13cbee['stack']);if(_0x13cbee['name']){delete _0x13cbee[_0xc395('0x25')];}_0xf9ed78[_0xc395('0x17')](_0x2b08f8)[_0xc395('0x26')](_0x13cbee);};}exports[_0xc395('0x27')]=function(_0x3c92f9,_0x416b6a){var _0x30b808={},_0x2fea82={},_0x362a10={'count':0x0,'rows':[]};var _0x58f1b1=_[_0xc395('0x28')](db[_0xc395('0x29')][_0xc395('0x2a')],function(_0x256e7b){return{'name':_0x256e7b['fieldName'],'type':_0x256e7b[_0xc395('0x2b')][_0xc395('0x2c')]};});_0x2fea82[_0xc395('0x2d')]=_[_0xc395('0x28')](_0x58f1b1,_0xc395('0x25'));_0x2fea82[_0xc395('0x2e')]=_[_0xc395('0x2f')](_0x3c92f9[_0xc395('0x2e')]);_0x2fea82[_0xc395('0x30')]=_['intersection'](_0x2fea82[_0xc395('0x2d')],_0x2fea82['query']);_0x30b808[_0xc395('0x31')]=_['intersection'](_0x2fea82[_0xc395('0x2d')],qs[_0xc395('0x32')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x32')]));_0x30b808[_0xc395('0x31')]=_0x30b808[_0xc395('0x31')][_0xc395('0x33')]?_0x30b808['attributes']:_0x2fea82[_0xc395('0x2d')];if(!_0x3c92f9[_0xc395('0x2e')]['hasOwnProperty'](_0xc395('0x34'))){_0x30b808[_0xc395('0x1b')]=qs[_0xc395('0x1b')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x1b')]);_0x30b808[_0xc395('0x19')]=qs[_0xc395('0x19')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x19')]);}_0x30b808[_0xc395('0x35')]=qs[_0xc395('0x36')](_0x3c92f9[_0xc395('0x2e')][_0xc395('0x36')]);_0x30b808[_0xc395('0x37')]=qs['filters'](_[_0xc395('0x38')](_0x3c92f9[_0xc395('0x2e')],_0x2fea82['filters']),_0x58f1b1);if(_0x3c92f9[_0xc395('0x2e')][_0xc395('0x39')]){_0x30b808[_0xc395('0x37')]=_[_0xc395('0x3a')](_0x30b808['where'],{'$or':_[_0xc395('0x28')](_0x58f1b1,function(_0x5def4e){if(_0x5def4e[_0xc395('0x2b')]!==_0xc395('0x3b')){var _0x1d4f59={};_0x1d4f59[_0x5def4e[_0xc395('0x25')]]={'$like':'%'+_0x3c92f9[_0xc395('0x2e')][_0xc395('0x39')]+'%'};return _0x1d4f59;}})});}_0x30b808=_[_0xc395('0x3a')]({},_0x30b808,_0x3c92f9[_0xc395('0x3c')]);var _0x4f335d={'where':_0x30b808[_0xc395('0x37')]};return db[_0xc395('0x29')]['count'](_0x4f335d)[_0xc395('0x23')](function(_0x46729b){_0x362a10[_0xc395('0x1c')]=_0x46729b;if(_0x3c92f9[_0xc395('0x2e')]['includeAll']){_0x30b808[_0xc395('0x3d')]=[{'all':!![]}];}return db[_0xc395('0x29')][_0xc395('0x3e')](_0x30b808);})[_0xc395('0x23')](function(_0xb9bf88){_0x362a10['rows']=_0xb9bf88;return _0x362a10;})[_0xc395('0x23')](respondWithFilteredResult(_0x416b6a,_0x30b808))[_0xc395('0x3f')](handleError(_0x416b6a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b17c148..8806937 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 _0x8f1f=['./migration.attributes','define','migrations','bluebird','path','rimraf'];(function(_0x248c97,_0x38742d){var _0x24298e=function(_0x3b6eff){while(--_0x3b6eff){_0x248c97['push'](_0x248c97['shift']());}};_0x24298e(++_0x38742d);}(_0x8f1f,0x195));var _0xf8f1=function(_0x5e3715,_0x55f0ea){_0x5e3715=_0x5e3715-0x0;var _0x3d9464=_0x8f1f[_0x5e3715];return _0x3d9464;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf8f1('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8f1('0x1'));var rimraf=require(_0xf8f1('0x2'));var config=require('../../config/environment');var attributes=require(_0xf8f1('0x3'));module['exports']=function(_0x449511,_0x5d2808){return _0x449511[_0xf8f1('0x4')]('Migration',attributes,{'tableName':_0xf8f1('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa28f=['request-promise','path','rimraf','exports','define','Migration','migrations','lodash','util','api','moment','bluebird'];(function(_0x1bf8cc,_0x118778){var _0x322d20=function(_0x36953d){while(--_0x36953d){_0x1bf8cc['push'](_0x1bf8cc['shift']());}};_0x322d20(++_0x118778);}(_0xa28f,0x1ab));var _0xfa28=function(_0x19117c,_0x2e3a00){_0x19117c=_0x19117c-0x0;var _0x51d580=_0xa28f[_0x19117c];return _0x51d580;};'use strict';var _=require(_0xfa28('0x0'));var util=require(_0xfa28('0x1'));var logger=require('../../config/logger')(_0xfa28('0x2'));var moment=require(_0xfa28('0x3'));var BPromise=require(_0xfa28('0x4'));var rp=require(_0xfa28('0x5'));var fs=require('fs');var path=require(_0xfa28('0x6'));var rimraf=require(_0xfa28('0x7'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xfa28('0x8')]=function(_0x4b2651,_0x33ec65){return _0x4b2651[_0xfa28('0x9')](_0xfa28('0xa'),attributes,{'tableName':_0xfa28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5bf0b63..9e02978 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 _0x43c8=['client','http','then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x43c8,0xaf));var _0x843c=function(_0x51f420,_0x5a2679){_0x51f420=_0x51f420-0x0;var _0x48d513=_0x43c8[_0x51f420];return _0x48d513;};'use strict';var _=require('lodash');var util=require(_0x843c('0x0'));var moment=require('moment');var BPromise=require(_0x843c('0x1'));var rs=require(_0x843c('0x2'));var fs=require('fs');var Redis=require(_0x843c('0x3'));var db=require(_0x843c('0x4'))['db'];var utils=require(_0x843c('0x5'));var logger=require(_0x843c('0x6'))(_0x843c('0x7'));var config=require('../../config/environment');var jayson=require(_0x843c('0x8'));var client=jayson[_0x843c('0x9')][_0x843c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15bb1f,_0xd198e5,_0x49aee7){return new BPromise(function(_0x327327,_0x41f56d){return client['request'](_0x15bb1f,_0x49aee7)[_0x843c('0xb')](function(_0x566777){logger['info'](_0x843c('0xc'),_0xd198e5,'request\x20sent');logger[_0x843c('0xd')](_0x843c('0xe'),_0xd198e5,_0x843c('0xf'),JSON[_0x843c('0x10')](_0x566777));if(_0x566777['error']){if(_0x566777[_0x843c('0x11')][_0x843c('0x12')]===0x1f4){logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x41f56d(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x327327(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}else{logger[_0x843c('0x14')]('Migration,\x20%s,\x20%s',_0xd198e5,_0x843c('0xf'));_0x327327(_0x566777[_0x843c('0x15')][_0x843c('0x13')]);}})[_0x843c('0x16')](function(_0x16e8f6){logger['error'](_0x843c('0xc'),_0xd198e5,_0x16e8f6);_0x41f56d(_0x16e8f6);});});} \ No newline at end of file +var _0x1bd1=['message','catch','lodash','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c61b0,_0x200775){var _0x11b39d=function(_0x1f99b2){while(--_0x1f99b2){_0x2c61b0['push'](_0x2c61b0['shift']());}};_0x11b39d(++_0x200775);}(_0x1bd1,0x123));var _0x11bd=function(_0x4ee461,_0x36191a){_0x4ee461=_0x4ee461-0x0;var _0x451a1e=_0x1bd1[_0x4ee461];return _0x451a1e;};'use strict';var _=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var moment=require(_0x11bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x11bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x11bd('0x4'));var config=require(_0x11bd('0x5'));var jayson=require(_0x11bd('0x6'));var client=jayson[_0x11bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x336255,_0x1f813c,_0x359f21){return new BPromise(function(_0x3940cf,_0x361ecf){return client['request'](_0x336255,_0x359f21)[_0x11bd('0x8')](function(_0x553727){logger['info'](_0x11bd('0x9'),_0x1f813c,_0x11bd('0xa'));logger[_0x11bd('0xb')](_0x11bd('0xc'),_0x1f813c,_0x11bd('0xa'),JSON[_0x11bd('0xd')](_0x553727));if(_0x553727[_0x11bd('0xe')]){if(_0x553727[_0x11bd('0xe')]['code']===0x1f4){logger[_0x11bd('0xe')](_0x11bd('0x9'),_0x1f813c,_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);return _0x361ecf(_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);}logger[_0x11bd('0xe')]('Migration,\x20%s,\x20%s',_0x1f813c,_0x553727['error'][_0x11bd('0xf')]);return _0x3940cf(_0x553727[_0x11bd('0xe')][_0x11bd('0xf')]);}else{logger['info'](_0x11bd('0x9'),_0x1f813c,'request\x20sent');_0x3940cf(_0x553727['result'][_0x11bd('0xf')]);}})[_0x11bd('0x10')](function(_0xab4cde){logger[_0x11bd('0xe')](_0x11bd('0x9'),_0x1f813c,_0xab4cde);_0x361ecf(_0xab4cde);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d8f449f..76f78a0 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 _0xf321=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','update','delete'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xf321,0x1dd));var _0x1f32=function(_0x2ec486,_0x597eda){_0x2ec486=_0x2ec486-0x0;var _0x5b0b5b=_0xf321[_0x2ec486];return _0x5b0b5b;};'use strict';var multer=require('multer');var util=require(_0x1f32('0x0'));var path=require(_0x1f32('0x1'));var timeout=require(_0x1f32('0x2'));var express=require(_0x1f32('0x3'));var router=express[_0x1f32('0x4')]();var fs_extra=require(_0x1f32('0x5'));var auth=require(_0x1f32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f32('0x7'));var controller=require('./network.controller');router['get']('/',auth[_0x1f32('0x8')](),controller['index']);router[_0x1f32('0x9')](_0x1f32('0xa'),auth['isAuthenticated'](),controller[_0x1f32('0xb')]);router[_0x1f32('0xc')]('/',auth[_0x1f32('0x8')](),controller[_0x1f32('0xd')]);router['put'](_0x1f32('0xa'),auth[_0x1f32('0x8')](),controller[_0x1f32('0xe')]);router[_0x1f32('0xf')](_0x1f32('0xa'),auth[_0x1f32('0x8')](),controller['destroy']);module[_0x1f32('0x10')]=router; \ No newline at end of file +var _0x896e=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x896e,0x1e9));var _0xe896=function(_0x1d66f7,_0x28b7e2){_0x1d66f7=_0x1d66f7-0x0;var _0x431c43=_0x896e[_0x1d66f7];return _0x431c43;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['post']('/',auth[_0xe896('0xe')](),controller[_0xe896('0x10')]);router[_0xe896('0x11')]('/:id',auth[_0xe896('0xe')](),controller['update']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);module[_0xe896('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 23ce4c6..2078247 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 _0x0a11=['turn','STRING','exports','ENUM','localnet','externip'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0x0a11,0x1f4));var _0x10a1=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0x0a11[_0x28111f];return _0x5203e6;};'use strict';var Sequelize=require('sequelize');module[_0x10a1('0x0')]={'type':{'type':Sequelize[_0x10a1('0x1')](_0x10a1('0x2'),_0x10a1('0x3'),'stun',_0x10a1('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x10a1('0x5')]}}; \ No newline at end of file +var _0xf2e3=['exports','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x3f5688,_0x22b187){var _0x245cc0=function(_0x3f712b){while(--_0x3f712b){_0x3f5688['push'](_0x3f5688['shift']());}};_0x245cc0(++_0x22b187);}(_0xf2e3,0x1db));var _0x3f2e=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xf2e3[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module[_0x3f2e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3f2e('0x2'),_0x3f2e('0x3'),_0x3f2e('0x4'),_0x3f2e('0x5'))},'value':{'type':Sequelize[_0x3f2e('0x6')]},'username':{'type':Sequelize[_0x3f2e('0x6')]},'password':{'type':Sequelize[_0x3f2e('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index bb77433..c3dd60f 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 _0xc9d8=['body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','toLowerCase','chan_sip.so','update','sequelize','params','server/files/templates/network.ejs','format','destroy','find','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','name','send','index','Network','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','create','transaction'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0xc9d8,0x1de));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8c9d('0x0'));var rimraf=require(_0x8c9d('0x1'));var zipdir=require(_0x8c9d('0x2'));var jsonpatch=require(_0x8c9d('0x3'));var rp=require(_0x8c9d('0x4'));var moment=require(_0x8c9d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8c9d('0x6'));var util=require(_0x8c9d('0x7'));var path=require(_0x8c9d('0x8'));var sox=require(_0x8c9d('0x9'));var csv=require(_0x8c9d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c9d('0xb'));var _=require(_0x8c9d('0xc'));var squel=require(_0x8c9d('0xd'));var crypto=require(_0x8c9d('0xe'));var jsforce=require(_0x8c9d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c9d('0x10'));var Redis=require(_0x8c9d('0x11'));var authService=require(_0x8c9d('0x12'));var qs=require(_0x8c9d('0x13'));var as=require(_0x8c9d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c9d('0x15'))(_0x8c9d('0x16'));var utils=require('../../config/utils');var config=require(_0x8c9d('0x17'));var licenseUtil=require(_0x8c9d('0x18'));var db=require(_0x8c9d('0x19'))['db'];var jayson=require(_0x8c9d('0x1a'));var client=jayson['client'][_0x8c9d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4525aa,_0x34acba,_0x35cf68,_0x247068){return new BPromise(function(_0x5ad77f,_0x4a7805){var _0x5a07ed=_0x247068||client;return _0x5a07ed[_0x8c9d('0x1c')](_0x4525aa,_0x35cf68)[_0x8c9d('0x1d')](function(_0x21f125){logger[_0x8c9d('0x1e')](_0x8c9d('0x1f'),_0x34acba,'request\x20sent');logger[_0x8c9d('0x20')](_0x8c9d('0x21'),_0x34acba,_0x8c9d('0x22'),JSON[_0x8c9d('0x23')](_0x21f125));if(_0x21f125[_0x8c9d('0x24')]){if(_0x21f125[_0x8c9d('0x24')][_0x8c9d('0x25')]===0x1f4){logger[_0x8c9d('0x24')](_0x8c9d('0x1f'),_0x34acba,_0x21f125[_0x8c9d('0x24')][_0x8c9d('0x26')]);return _0x4a7805(_0x21f125[_0x8c9d('0x24')][_0x8c9d('0x26')]);}logger[_0x8c9d('0x24')](_0x8c9d('0x1f'),_0x34acba,_0x21f125[_0x8c9d('0x24')][_0x8c9d('0x26')]);return _0x5ad77f(_0x21f125[_0x8c9d('0x24')]['message']);}else{logger['info'](_0x8c9d('0x1f'),_0x34acba,_0x8c9d('0x22'));_0x5ad77f(_0x21f125[_0x8c9d('0x27')][_0x8c9d('0x26')]);}})[_0x8c9d('0x28')](function(_0x442370){logger[_0x8c9d('0x24')](_0x8c9d('0x1f'),_0x34acba,_0x442370);_0x4a7805(_0x442370);});});}function respondWithStatusCode(_0x1a9fe5,_0x43bad5){_0x43bad5=_0x43bad5||0xcc;return function(_0x5dc2a2){if(_0x5dc2a2){return _0x1a9fe5[_0x8c9d('0x29')](_0x43bad5);}return _0x1a9fe5[_0x8c9d('0x2a')](_0x43bad5)[_0x8c9d('0x2b')]();};}function respondWithResult(_0x38c66d,_0x48de42){_0x48de42=_0x48de42||0xc8;return function(_0x20b5e1){if(_0x20b5e1){return _0x38c66d['status'](_0x48de42)[_0x8c9d('0x2c')](_0x20b5e1);}};}function respondWithFilteredResult(_0x2b20a8,_0x5e737a){return function(_0x726c0f){if(_0x726c0f){var _0x4511d1=typeof _0x5e737a[_0x8c9d('0x2d')]===_0x8c9d('0x2e')&&typeof _0x5e737a['limit']===_0x8c9d('0x2e');var _0x396706=_0x726c0f['count'];var _0x25e966=_0x4511d1?0x0:_0x5e737a[_0x8c9d('0x2d')];var _0xd13247=_0x4511d1?_0x726c0f[_0x8c9d('0x2f')]:_0x5e737a['offset']+_0x5e737a[_0x8c9d('0x30')];var _0x37ed4f;if(_0xd13247>=_0x396706){_0xd13247=_0x396706;_0x37ed4f=0xc8;}else{_0x37ed4f=0xce;}_0x2b20a8['status'](_0x37ed4f);return _0x2b20a8[_0x8c9d('0x31')](_0x8c9d('0x32'),_0x25e966+'-'+_0xd13247+'/'+_0x396706)['json'](_0x726c0f);}return null;};}function patchUpdates(_0x321c2f){return function(_0x31f5ae){try{jsonpatch[_0x8c9d('0x33')](_0x31f5ae,_0x321c2f,!![]);}catch(_0x351509){return BPromise[_0x8c9d('0x34')](_0x351509);}return _0x31f5ae[_0x8c9d('0x35')]();};}function saveUpdates(_0x4c0a8f,_0x18bca1){return function(_0x1e9d19){if(_0x1e9d19){return _0x1e9d19['update'](_0x4c0a8f)[_0x8c9d('0x1d')](function(_0x336b0c){return _0x336b0c;});}return null;};}function removeEntity(_0x5f0348,_0x4cbdfe){return function(_0x1f3b4e){if(_0x1f3b4e){return _0x1f3b4e['destroy']()[_0x8c9d('0x1d')](function(){_0x5f0348[_0x8c9d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x324e50,_0x26f275){return function(_0x46957b){if(!_0x46957b){_0x324e50[_0x8c9d('0x29')](0x194);}return _0x46957b;};}function handleError(_0x1f26d8,_0x10b2ed){_0x10b2ed=_0x10b2ed||0x1f4;return function(_0x40252b){logger['error'](_0x40252b['stack']);if(_0x40252b[_0x8c9d('0x36')]){delete _0x40252b[_0x8c9d('0x36')];}_0x1f26d8[_0x8c9d('0x2a')](_0x10b2ed)[_0x8c9d('0x37')](_0x40252b);};}exports[_0x8c9d('0x38')]=function(_0x3d46e5,_0x4f3c9b){var _0x330887={},_0x2ad036={},_0xe1bdf7={'count':0x0,'rows':[]};var _0x46c9c0=_['map'](db[_0x8c9d('0x39')][_0x8c9d('0x3a')],function(_0x3403a2){return{'name':_0x3403a2[_0x8c9d('0x3b')],'type':_0x3403a2[_0x8c9d('0x3c')][_0x8c9d('0x3d')]};});_0x2ad036[_0x8c9d('0x3e')]=_[_0x8c9d('0x3f')](_0x46c9c0,_0x8c9d('0x36'));_0x2ad036[_0x8c9d('0x40')]=_['keys'](_0x3d46e5[_0x8c9d('0x40')]);_0x2ad036['filters']=_[_0x8c9d('0x41')](_0x2ad036[_0x8c9d('0x3e')],_0x2ad036['query']);_0x330887[_0x8c9d('0x42')]=_[_0x8c9d('0x41')](_0x2ad036[_0x8c9d('0x3e')],qs[_0x8c9d('0x43')](_0x3d46e5[_0x8c9d('0x40')][_0x8c9d('0x43')]));_0x330887[_0x8c9d('0x42')]=_0x330887[_0x8c9d('0x42')][_0x8c9d('0x44')]?_0x330887[_0x8c9d('0x42')]:_0x2ad036[_0x8c9d('0x3e')];if(!_0x3d46e5[_0x8c9d('0x40')][_0x8c9d('0x45')](_0x8c9d('0x46'))){_0x330887[_0x8c9d('0x30')]=qs[_0x8c9d('0x30')](_0x3d46e5[_0x8c9d('0x40')][_0x8c9d('0x30')]);_0x330887[_0x8c9d('0x2d')]=qs[_0x8c9d('0x2d')](_0x3d46e5['query'][_0x8c9d('0x2d')]);}_0x330887[_0x8c9d('0x47')]=qs[_0x8c9d('0x48')](_0x3d46e5[_0x8c9d('0x40')][_0x8c9d('0x48')]);_0x330887['where']=qs[_0x8c9d('0x49')](_['pick'](_0x3d46e5['query'],_0x2ad036[_0x8c9d('0x49')]),_0x46c9c0);if(_0x3d46e5[_0x8c9d('0x40')][_0x8c9d('0x4a')]){_0x330887[_0x8c9d('0x4b')]=_[_0x8c9d('0x4c')](_0x330887[_0x8c9d('0x4b')],{'$or':_[_0x8c9d('0x3f')](_0x46c9c0,function(_0x409fd6){if(_0x409fd6[_0x8c9d('0x3c')]!==_0x8c9d('0x4d')){var _0x22443a={};_0x22443a[_0x409fd6['name']]={'$like':'%'+_0x3d46e5[_0x8c9d('0x40')]['filter']+'%'};return _0x22443a;}})});}_0x330887=_[_0x8c9d('0x4c')]({},_0x330887,_0x3d46e5[_0x8c9d('0x4e')]);var _0x4a1e85={'where':_0x330887[_0x8c9d('0x4b')]};return db[_0x8c9d('0x39')][_0x8c9d('0x2f')](_0x4a1e85)[_0x8c9d('0x1d')](function(_0x438447){_0xe1bdf7[_0x8c9d('0x2f')]=_0x438447;if(_0x3d46e5[_0x8c9d('0x40')][_0x8c9d('0x4f')]){_0x330887[_0x8c9d('0x50')]=[{'all':!![]}];}return db[_0x8c9d('0x39')][_0x8c9d('0x51')](_0x330887);})[_0x8c9d('0x1d')](function(_0x108334){_0xe1bdf7[_0x8c9d('0x52')]=_0x108334;return _0xe1bdf7;})[_0x8c9d('0x1d')](respondWithFilteredResult(_0x4f3c9b,_0x330887))[_0x8c9d('0x28')](handleError(_0x4f3c9b,null));};exports[_0x8c9d('0x53')]=function(_0x2703b8,_0x39f030){var _0x1cd9b5={'raw':!![],'where':{'id':_0x2703b8['params']['id']}},_0x808fb6={};_0x808fb6[_0x8c9d('0x3e')]=_[_0x8c9d('0x54')](db[_0x8c9d('0x39')][_0x8c9d('0x3a')]);_0x808fb6[_0x8c9d('0x40')]=_[_0x8c9d('0x54')](_0x2703b8[_0x8c9d('0x40')]);_0x808fb6[_0x8c9d('0x49')]=_[_0x8c9d('0x41')](_0x808fb6['model'],_0x808fb6[_0x8c9d('0x40')]);_0x1cd9b5['attributes']=_[_0x8c9d('0x41')](_0x808fb6[_0x8c9d('0x3e')],qs[_0x8c9d('0x43')](_0x2703b8[_0x8c9d('0x40')][_0x8c9d('0x43')]));_0x1cd9b5['attributes']=_0x1cd9b5[_0x8c9d('0x42')][_0x8c9d('0x44')]?_0x1cd9b5[_0x8c9d('0x42')]:_0x808fb6['model'];if(_0x2703b8[_0x8c9d('0x40')][_0x8c9d('0x4f')]){_0x1cd9b5['include']=[{'all':!![]}];}_0x1cd9b5=_[_0x8c9d('0x4c')]({},_0x1cd9b5,_0x2703b8[_0x8c9d('0x4e')]);return db[_0x8c9d('0x39')]['find'](_0x1cd9b5)[_0x8c9d('0x1d')](handleEntityNotFound(_0x39f030,null))['then'](respondWithResult(_0x39f030,null))[_0x8c9d('0x28')](handleError(_0x39f030,null));};exports[_0x8c9d('0x55')]=function(_0x3b9b67,_0x32a637,_0x4f4e6f){var _0x3b39a9;return db['sequelize'][_0x8c9d('0x56')](function(_0x9146bc){return db[_0x8c9d('0x39')]['create'](_0x3b9b67[_0x8c9d('0x57')],{'raw':!![]})[_0x8c9d('0x1d')](function(_0x526b0c){_0x3b39a9=_0x526b0c;return db[_0x8c9d('0x39')][_0x8c9d('0x51')]({'where':{'type':_0x3b9b67[_0x8c9d('0x57')][_0x8c9d('0x3c')]},'raw':!![]});})['then'](function(_0x429d76){if(_0x3b39a9['type'][_0x8c9d('0x58')]()==_0x8c9d('0x59')){var _0x368c64=fs[_0x8c9d('0x5a')](path['join'](config[_0x8c9d('0x5b')],_0x8c9d('0x5c')),'utf8');var _0x38733b=ejs['render'](_0x368c64,{'networks':_0x429d76||[]});fs[_0x8c9d('0x5d')](_0x8c9d('0x5e'),_0x38733b);return respondWithRpcPromise(_0x8c9d('0x5f'),'create',{'module':_0x8c9d('0x60')});}else if(_0x3b39a9[_0x8c9d('0x3c')][_0x8c9d('0x58')]()==_0x8c9d('0x61')){var _0x162797=fs[_0x8c9d('0x5a')](path[_0x8c9d('0x62')](config[_0x8c9d('0x5b')],_0x8c9d('0x63')),_0x8c9d('0x64'));var _0xcbf089=ejs[_0x8c9d('0x65')](_0x162797,{'networks':_0x429d76||[]});fs['writeFileSync'](_0x8c9d('0x66'),_0xcbf089);return respondWithRpcPromise(_0x8c9d('0x5f'),_0x8c9d('0x55'),{'module':_0x8c9d('0x60')});}else{var _0x314138=fs['readFileSync'](path[_0x8c9d('0x62')](config[_0x8c9d('0x5b')],'server/files/templates/network.ejs'),'utf8');var _0x1f119b=ejs[_0x8c9d('0x65')](_0x314138,{'networks':_0x429d76||[]});fs[_0x8c9d('0x5d')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3b9b67['body'][_0x8c9d('0x3c')][_0x8c9d('0x67')]()),_0x1f119b);return respondWithRpcPromise(_0x8c9d('0x5f'),_0x8c9d('0x55'),{'module':_0x8c9d('0x68')});}return null;})['then'](function(){return _0x3b39a9;});})[_0x8c9d('0x1d')](respondWithResult(_0x32a637,0xc9))[_0x8c9d('0x28')](handleError(_0x32a637,null));};exports[_0x8c9d('0x69')]=function(_0x3404dd,_0x4cb33c,_0x2329c8){var _0x2ea22c;return db[_0x8c9d('0x6a')][_0x8c9d('0x56')](function(_0x40703d){return db[_0x8c9d('0x39')]['find']({'where':{'id':_0x3404dd[_0x8c9d('0x6b')]['id']}})[_0x8c9d('0x1d')](handleEntityNotFound(_0x4cb33c,null))[_0x8c9d('0x1d')](saveUpdates(_0x3404dd[_0x8c9d('0x57')],null))[_0x8c9d('0x1d')](function(_0x34474f){if(_0x34474f){_0x2ea22c=_0x34474f;return db[_0x8c9d('0x39')][_0x8c9d('0x51')]({'where':{'type':_0x2ea22c['type']},'raw':!![]});}return null;})[_0x8c9d('0x1d')](function(_0x1df7af){if(_0x2ea22c[_0x8c9d('0x3c')][_0x8c9d('0x58')]()=='STUN'){var _0x56b3e0=fs[_0x8c9d('0x5a')](path[_0x8c9d('0x62')](config['root'],_0x8c9d('0x5c')),_0x8c9d('0x64'));var _0x31fb84=ejs[_0x8c9d('0x65')](_0x56b3e0,{'networks':_0x1df7af||[]});fs['writeFileSync'](_0x8c9d('0x5e'),_0x31fb84);return respondWithRpcPromise(_0x8c9d('0x5f'),_0x8c9d('0x69'),{'module':_0x8c9d('0x60')});}else if(_0x2ea22c[_0x8c9d('0x3c')][_0x8c9d('0x58')]()==_0x8c9d('0x61')){var _0x38926c=fs['readFileSync'](path[_0x8c9d('0x62')](config[_0x8c9d('0x5b')],_0x8c9d('0x63')),_0x8c9d('0x64'));var _0xf14ea6=ejs[_0x8c9d('0x65')](_0x38926c,{'networks':_0x1df7af||[]});fs[_0x8c9d('0x5d')](_0x8c9d('0x66'),_0xf14ea6);return respondWithRpcPromise(_0x8c9d('0x5f'),_0x8c9d('0x69'),{'module':'res_stun_monitor.so'});}else{var _0x15e487=fs[_0x8c9d('0x5a')](path[_0x8c9d('0x62')](config[_0x8c9d('0x5b')],_0x8c9d('0x6c')),_0x8c9d('0x64'));var _0x104c8b=ejs[_0x8c9d('0x65')](_0x15e487,{'networks':_0x1df7af||[]});fs[_0x8c9d('0x5d')](util[_0x8c9d('0x6d')]('/etc/asterisk/sip_xcally_%s.conf',_0x3404dd[_0x8c9d('0x57')]['type'][_0x8c9d('0x67')]()),_0x104c8b);return respondWithRpcPromise('Reload',_0x8c9d('0x69'),{'module':_0x8c9d('0x68')});}return null;})[_0x8c9d('0x1d')](function(_0x1a6d03){if(_0x1a6d03){return _0x2ea22c;}return null;});})['then'](respondWithResult(_0x4cb33c,null))['catch'](handleError(_0x4cb33c,null));};exports[_0x8c9d('0x6e')]=function(_0x163621,_0x200c34,_0x10db33){var _0x17fc25;return db[_0x8c9d('0x39')][_0x8c9d('0x6f')]({'where':{'id':_0x163621['params']['id']}})[_0x8c9d('0x1d')](function(_0x402647){_0x17fc25=_0x402647;return _0x402647;})['then'](handleEntityNotFound(_0x200c34,null))[_0x8c9d('0x1d')](removeEntity(_0x200c34,null))[_0x8c9d('0x1d')](function(){if(_0x17fc25){return db['Network'][_0x8c9d('0x51')]({'where':{'type':_0x17fc25[_0x8c9d('0x3c')]},'raw':!![]});}})[_0x8c9d('0x1d')](function(_0x4fa4cd){if(_0x17fc25[_0x8c9d('0x3c')]['toUpperCase']()==_0x8c9d('0x59')){var _0x29aacf=fs[_0x8c9d('0x5a')](path[_0x8c9d('0x62')](config['root'],_0x8c9d('0x5c')),'utf8');var _0x503841=ejs[_0x8c9d('0x65')](_0x29aacf,{'networks':_0x4fa4cd||[]});fs['writeFileSync'](_0x8c9d('0x5e'),_0x503841);return respondWithRpcPromise('Reload',_0x8c9d('0x6e'),{'module':_0x8c9d('0x60')});}else if(_0x17fc25['type'][_0x8c9d('0x58')]()=='TURN'){var _0xfb3e89=fs['readFileSync'](path[_0x8c9d('0x62')](config[_0x8c9d('0x5b')],_0x8c9d('0x63')),_0x8c9d('0x64'));var _0x573899=ejs[_0x8c9d('0x65')](_0xfb3e89,{'networks':_0x4fa4cd||[]});fs[_0x8c9d('0x5d')](_0x8c9d('0x66'),_0x573899);return respondWithRpcPromise('Reload',_0x8c9d('0x6e'),{'module':_0x8c9d('0x60')});}else{var _0xea1885=fs[_0x8c9d('0x5a')](path['join'](config[_0x8c9d('0x5b')],_0x8c9d('0x6c')),_0x8c9d('0x64'));var _0x10debd=ejs['render'](_0xea1885,{'networks':_0x4fa4cd||[]});fs[_0x8c9d('0x5d')](util[_0x8c9d('0x6d')](_0x8c9d('0x70'),_0x163621[_0x8c9d('0x57')][_0x8c9d('0x3c')][_0x8c9d('0x67')]()),_0x10debd);return respondWithRpcPromise('Reload','destroy',{'module':_0x8c9d('0x68')});}return null;})['catch'](handleError(_0x200c34,null));}; \ No newline at end of file +var _0xb4fc=['toLowerCase','chan_sip.so','sequelize','server/files/templates/stun_multiple.ejs','TURN','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','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','Network','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','includeAll','find','transaction','create','body','STUN','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf'];(function(_0x3fa631,_0x24392c){var _0x5c9dec=function(_0x36d01a){while(--_0x36d01a){_0x3fa631['push'](_0x3fa631['shift']());}};_0x5c9dec(++_0x24392c);}(_0xb4fc,0xdd));var _0xcb4f=function(_0x1fc4a0,_0x32e235){_0x1fc4a0=_0x1fc4a0-0x0;var _0x1b08c5=_0xb4fc[_0x1fc4a0];return _0x1b08c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb4f('0x0'));var zipdir=require(_0xcb4f('0x1'));var jsonpatch=require(_0xcb4f('0x2'));var rp=require(_0xcb4f('0x3'));var moment=require(_0xcb4f('0x4'));var BPromise=require(_0xcb4f('0x5'));var Mustache=require(_0xcb4f('0x6'));var util=require(_0xcb4f('0x7'));var path=require(_0xcb4f('0x8'));var sox=require(_0xcb4f('0x9'));var csv=require(_0xcb4f('0xa'));var ejs=require(_0xcb4f('0xb'));var fs=require('fs');var fs_extra=require(_0xcb4f('0xc'));var _=require(_0xcb4f('0xd'));var squel=require('squel');var crypto=require(_0xcb4f('0xe'));var jsforce=require(_0xcb4f('0xf'));var deskjs=require(_0xcb4f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcb4f('0x11'));var Papa=require(_0xcb4f('0x12'));var Redis=require(_0xcb4f('0x13'));var authService=require(_0xcb4f('0x14'));var qs=require(_0xcb4f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb4f('0x16'));var logger=require('../../config/logger')(_0xcb4f('0x17'));var utils=require(_0xcb4f('0x18'));var config=require(_0xcb4f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb4f('0x1a'))['db'];var jayson=require(_0xcb4f('0x1b'));var client=jayson[_0xcb4f('0x1c')][_0xcb4f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x53bcce,_0x10b56d,_0x589fbd,_0x22a32e){return new BPromise(function(_0x169f31,_0x4517dd){var _0x5b2b0f=_0x22a32e||client;return _0x5b2b0f[_0xcb4f('0x1e')](_0x53bcce,_0x589fbd)[_0xcb4f('0x1f')](function(_0x2eed72){logger[_0xcb4f('0x20')]('Network,\x20%s,\x20%s',_0x10b56d,_0xcb4f('0x21'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x10b56d,_0xcb4f('0x21'),JSON[_0xcb4f('0x22')](_0x2eed72));if(_0x2eed72[_0xcb4f('0x23')]){if(_0x2eed72[_0xcb4f('0x23')]['code']===0x1f4){logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x10b56d,_0x2eed72[_0xcb4f('0x23')][_0xcb4f('0x25')]);return _0x4517dd(_0x2eed72['error'][_0xcb4f('0x25')]);}logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x10b56d,_0x2eed72['error'][_0xcb4f('0x25')]);return _0x169f31(_0x2eed72[_0xcb4f('0x23')][_0xcb4f('0x25')]);}else{logger[_0xcb4f('0x20')](_0xcb4f('0x24'),_0x10b56d,_0xcb4f('0x21'));_0x169f31(_0x2eed72[_0xcb4f('0x26')][_0xcb4f('0x25')]);}})[_0xcb4f('0x27')](function(_0xaa939e){logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x10b56d,_0xaa939e);_0x4517dd(_0xaa939e);});});}function respondWithStatusCode(_0x4ee411,_0x50c794){_0x50c794=_0x50c794||0xcc;return function(_0x28cc2b){if(_0x28cc2b){return _0x4ee411[_0xcb4f('0x28')](_0x50c794);}return _0x4ee411['status'](_0x50c794)[_0xcb4f('0x29')]();};}function respondWithResult(_0x481f16,_0x4ca17b){_0x4ca17b=_0x4ca17b||0xc8;return function(_0x4853da){if(_0x4853da){return _0x481f16[_0xcb4f('0x2a')](_0x4ca17b)['json'](_0x4853da);}};}function respondWithFilteredResult(_0x29e9c2,_0x3d4d2a){return function(_0xfd0b4){if(_0xfd0b4){var _0x4624f8=typeof _0x3d4d2a[_0xcb4f('0x2b')]==='undefined'&&typeof _0x3d4d2a[_0xcb4f('0x2c')]===_0xcb4f('0x2d');var _0x128895=_0xfd0b4['count'];var _0x5a3234=_0x4624f8?0x0:_0x3d4d2a['offset'];var _0x57e0bc=_0x4624f8?_0xfd0b4[_0xcb4f('0x2e')]:_0x3d4d2a[_0xcb4f('0x2b')]+_0x3d4d2a[_0xcb4f('0x2c')];var _0x19bd68;if(_0x57e0bc>=_0x128895){_0x57e0bc=_0x128895;_0x19bd68=0xc8;}else{_0x19bd68=0xce;}_0x29e9c2['status'](_0x19bd68);return _0x29e9c2[_0xcb4f('0x2f')](_0xcb4f('0x30'),_0x5a3234+'-'+_0x57e0bc+'/'+_0x128895)[_0xcb4f('0x31')](_0xfd0b4);}return null;};}function patchUpdates(_0x3a832c){return function(_0x202975){try{jsonpatch['apply'](_0x202975,_0x3a832c,!![]);}catch(_0x1127ac){return BPromise[_0xcb4f('0x32')](_0x1127ac);}return _0x202975[_0xcb4f('0x33')]();};}function saveUpdates(_0x436ae8,_0x3dbe3d){return function(_0x145298){if(_0x145298){return _0x145298[_0xcb4f('0x34')](_0x436ae8)[_0xcb4f('0x1f')](function(_0x43bc7f){return _0x43bc7f;});}return null;};}function removeEntity(_0x102efc,_0x1310a7){return function(_0xa5b931){if(_0xa5b931){return _0xa5b931[_0xcb4f('0x35')]()[_0xcb4f('0x1f')](function(){_0x102efc[_0xcb4f('0x2a')](0xcc)[_0xcb4f('0x29')]();});}};}function handleEntityNotFound(_0x18d0e7,_0x5f017f){return function(_0x572031){if(!_0x572031){_0x18d0e7['sendStatus'](0x194);}return _0x572031;};}function handleError(_0x451792,_0x354c8d){_0x354c8d=_0x354c8d||0x1f4;return function(_0x1b3ed6){logger[_0xcb4f('0x23')](_0x1b3ed6[_0xcb4f('0x36')]);if(_0x1b3ed6[_0xcb4f('0x37')]){delete _0x1b3ed6[_0xcb4f('0x37')];}_0x451792[_0xcb4f('0x2a')](_0x354c8d)[_0xcb4f('0x38')](_0x1b3ed6);};}exports[_0xcb4f('0x39')]=function(_0xdf553b,_0x147ba3){var _0x1140e9={},_0x379408={},_0x52806f={'count':0x0,'rows':[]};var _0x26d700=_['map'](db[_0xcb4f('0x3a')][_0xcb4f('0x3b')],function(_0x46001d){return{'name':_0x46001d[_0xcb4f('0x3c')],'type':_0x46001d[_0xcb4f('0x3d')]['key']};});_0x379408[_0xcb4f('0x3e')]=_[_0xcb4f('0x3f')](_0x26d700,_0xcb4f('0x37'));_0x379408[_0xcb4f('0x40')]=_[_0xcb4f('0x41')](_0xdf553b[_0xcb4f('0x40')]);_0x379408[_0xcb4f('0x42')]=_[_0xcb4f('0x43')](_0x379408[_0xcb4f('0x3e')],_0x379408[_0xcb4f('0x40')]);_0x1140e9[_0xcb4f('0x44')]=_['intersection'](_0x379408[_0xcb4f('0x3e')],qs[_0xcb4f('0x45')](_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x45')]));_0x1140e9[_0xcb4f('0x44')]=_0x1140e9[_0xcb4f('0x44')][_0xcb4f('0x46')]?_0x1140e9[_0xcb4f('0x44')]:_0x379408[_0xcb4f('0x3e')];if(!_0xdf553b['query']['hasOwnProperty'](_0xcb4f('0x47'))){_0x1140e9[_0xcb4f('0x2c')]=qs['limit'](_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x2c')]);_0x1140e9[_0xcb4f('0x2b')]=qs[_0xcb4f('0x2b')](_0xdf553b['query'][_0xcb4f('0x2b')]);}_0x1140e9['order']=qs[_0xcb4f('0x48')](_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x48')]);_0x1140e9[_0xcb4f('0x49')]=qs[_0xcb4f('0x42')](_['pick'](_0xdf553b['query'],_0x379408['filters']),_0x26d700);if(_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x4a')]){_0x1140e9['where']=_['merge'](_0x1140e9[_0xcb4f('0x49')],{'$or':_[_0xcb4f('0x3f')](_0x26d700,function(_0x12050c){if(_0x12050c['type']!=='VIRTUAL'){var _0xc1b5b3={};_0xc1b5b3[_0x12050c[_0xcb4f('0x37')]]={'$like':'%'+_0xdf553b[_0xcb4f('0x40')][_0xcb4f('0x4a')]+'%'};return _0xc1b5b3;}})});}_0x1140e9=_[_0xcb4f('0x4b')]({},_0x1140e9,_0xdf553b[_0xcb4f('0x4c')]);var _0x1ab80c={'where':_0x1140e9[_0xcb4f('0x49')]};return db['Network']['count'](_0x1ab80c)[_0xcb4f('0x1f')](function(_0x38fb22){_0x52806f[_0xcb4f('0x2e')]=_0x38fb22;if(_0xdf553b[_0xcb4f('0x40')]['includeAll']){_0x1140e9[_0xcb4f('0x4d')]=[{'all':!![]}];}return db[_0xcb4f('0x3a')][_0xcb4f('0x4e')](_0x1140e9);})['then'](function(_0x433088){_0x52806f[_0xcb4f('0x4f')]=_0x433088;return _0x52806f;})[_0xcb4f('0x1f')](respondWithFilteredResult(_0x147ba3,_0x1140e9))[_0xcb4f('0x27')](handleError(_0x147ba3,null));};exports[_0xcb4f('0x50')]=function(_0x2521c8,_0x1e0c20){var _0x8476ea={'raw':!![],'where':{'id':_0x2521c8[_0xcb4f('0x51')]['id']}},_0xf4b2e5={};_0xf4b2e5[_0xcb4f('0x3e')]=_[_0xcb4f('0x41')](db['Network'][_0xcb4f('0x3b')]);_0xf4b2e5[_0xcb4f('0x40')]=_[_0xcb4f('0x41')](_0x2521c8[_0xcb4f('0x40')]);_0xf4b2e5['filters']=_[_0xcb4f('0x43')](_0xf4b2e5[_0xcb4f('0x3e')],_0xf4b2e5[_0xcb4f('0x40')]);_0x8476ea[_0xcb4f('0x44')]=_['intersection'](_0xf4b2e5[_0xcb4f('0x3e')],qs[_0xcb4f('0x45')](_0x2521c8[_0xcb4f('0x40')][_0xcb4f('0x45')]));_0x8476ea['attributes']=_0x8476ea[_0xcb4f('0x44')][_0xcb4f('0x46')]?_0x8476ea[_0xcb4f('0x44')]:_0xf4b2e5[_0xcb4f('0x3e')];if(_0x2521c8[_0xcb4f('0x40')][_0xcb4f('0x52')]){_0x8476ea[_0xcb4f('0x4d')]=[{'all':!![]}];}_0x8476ea=_[_0xcb4f('0x4b')]({},_0x8476ea,_0x2521c8[_0xcb4f('0x4c')]);return db[_0xcb4f('0x3a')][_0xcb4f('0x53')](_0x8476ea)['then'](handleEntityNotFound(_0x1e0c20,null))[_0xcb4f('0x1f')](respondWithResult(_0x1e0c20,null))[_0xcb4f('0x27')](handleError(_0x1e0c20,null));};exports['create']=function(_0x44f5e7,_0x2d4839,_0x115778){var _0x1f1c5c;return db['sequelize'][_0xcb4f('0x54')](function(_0x1b4367){return db[_0xcb4f('0x3a')][_0xcb4f('0x55')](_0x44f5e7['body'],{'raw':!![]})['then'](function(_0x21f05d){_0x1f1c5c=_0x21f05d;return db['Network'][_0xcb4f('0x4e')]({'where':{'type':_0x44f5e7[_0xcb4f('0x56')][_0xcb4f('0x3d')]},'raw':!![]});})[_0xcb4f('0x1f')](function(_0x2c1266){if(_0x1f1c5c[_0xcb4f('0x3d')]['toUpperCase']()==_0xcb4f('0x57')){var _0x91b993=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],'server/files/templates/stun_multiple.ejs'),_0xcb4f('0x5b'));var _0x307490=ejs['render'](_0x91b993,{'networks':_0x2c1266||[]});fs[_0xcb4f('0x5c')](_0xcb4f('0x5d'),_0x307490);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x55'),{'module':'res_stun_monitor.so'});}else if(_0x1f1c5c[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()=='TURN'){var _0x195172=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config['root'],_0xcb4f('0x60')),'utf8');var _0x222b1f=ejs[_0xcb4f('0x61')](_0x195172,{'networks':_0x2c1266||[]});fs[_0xcb4f('0x5c')](_0xcb4f('0x62'),_0x222b1f);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x55'),{'module':_0xcb4f('0x63')});}else{var _0x2070be=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x64')),_0xcb4f('0x5b'));var _0x48ed0b=ejs[_0xcb4f('0x61')](_0x2070be,{'networks':_0x2c1266||[]});fs['writeFileSync'](util[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x44f5e7[_0xcb4f('0x56')][_0xcb4f('0x3d')][_0xcb4f('0x67')]()),_0x48ed0b);return respondWithRpcPromise(_0xcb4f('0x5e'),'create',{'module':_0xcb4f('0x68')});}return null;})[_0xcb4f('0x1f')](function(){return _0x1f1c5c;});})[_0xcb4f('0x1f')](respondWithResult(_0x2d4839,0xc9))[_0xcb4f('0x27')](handleError(_0x2d4839,null));};exports[_0xcb4f('0x34')]=function(_0x3b23d2,_0x41ceed,_0x10dbfa){var _0x727efc;return db[_0xcb4f('0x69')]['transaction'](function(_0x1ddd46){return db[_0xcb4f('0x3a')][_0xcb4f('0x53')]({'where':{'id':_0x3b23d2[_0xcb4f('0x51')]['id']}})[_0xcb4f('0x1f')](handleEntityNotFound(_0x41ceed,null))[_0xcb4f('0x1f')](saveUpdates(_0x3b23d2[_0xcb4f('0x56')],null))[_0xcb4f('0x1f')](function(_0xaa70b2){if(_0xaa70b2){_0x727efc=_0xaa70b2;return db[_0xcb4f('0x3a')]['findAll']({'where':{'type':_0x727efc[_0xcb4f('0x3d')]},'raw':!![]});}return null;})[_0xcb4f('0x1f')](function(_0x2c73f5){if(_0x727efc[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()==_0xcb4f('0x57')){var _0x5937b9=fs['readFileSync'](path[_0xcb4f('0x59')](config['root'],_0xcb4f('0x6a')),_0xcb4f('0x5b'));var _0x4984c5=ejs[_0xcb4f('0x61')](_0x5937b9,{'networks':_0x2c73f5||[]});fs['writeFileSync'](_0xcb4f('0x5d'),_0x4984c5);return respondWithRpcPromise('Reload',_0xcb4f('0x34'),{'module':_0xcb4f('0x63')});}else if(_0x727efc[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()==_0xcb4f('0x6b')){var _0x9f6c14=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x60')),_0xcb4f('0x5b'));var _0x2ce66e=ejs[_0xcb4f('0x61')](_0x9f6c14,{'networks':_0x2c73f5||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x2ce66e);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x34'),{'module':_0xcb4f('0x63')});}else{var _0x2be64f=fs['readFileSync'](path[_0xcb4f('0x59')](config['root'],_0xcb4f('0x64')),_0xcb4f('0x5b'));var _0x2b9312=ejs[_0xcb4f('0x61')](_0x2be64f,{'networks':_0x2c73f5||[]});fs[_0xcb4f('0x5c')](util[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x3b23d2['body'][_0xcb4f('0x3d')][_0xcb4f('0x67')]()),_0x2b9312);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x34'),{'module':_0xcb4f('0x68')});}return null;})['then'](function(_0x2900c4){if(_0x2900c4){return _0x727efc;}return null;});})['then'](respondWithResult(_0x41ceed,null))[_0xcb4f('0x27')](handleError(_0x41ceed,null));};exports[_0xcb4f('0x35')]=function(_0x302002,_0x358898,_0x126697){var _0x2e41f3;return db[_0xcb4f('0x3a')]['find']({'where':{'id':_0x302002['params']['id']}})[_0xcb4f('0x1f')](function(_0x4765bf){_0x2e41f3=_0x4765bf;return _0x4765bf;})['then'](handleEntityNotFound(_0x358898,null))['then'](removeEntity(_0x358898,null))['then'](function(){if(_0x2e41f3){return db[_0xcb4f('0x3a')][_0xcb4f('0x4e')]({'where':{'type':_0x2e41f3[_0xcb4f('0x3d')]},'raw':!![]});}})[_0xcb4f('0x1f')](function(_0x2be313){if(_0x2e41f3[_0xcb4f('0x3d')][_0xcb4f('0x5f')]()==_0xcb4f('0x57')){var _0xc2a0fc=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x6a')),_0xcb4f('0x5b'));var _0x1f2476=ejs['render'](_0xc2a0fc,{'networks':_0x2be313||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1f2476);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x35'),{'module':_0xcb4f('0x63')});}else if(_0x2e41f3['type']['toUpperCase']()==_0xcb4f('0x6b')){var _0x43c8a8=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],_0xcb4f('0x60')),'utf8');var _0x2f58fd=ejs[_0xcb4f('0x61')](_0x43c8a8,{'networks':_0x2be313||[]});fs[_0xcb4f('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x2f58fd);return respondWithRpcPromise(_0xcb4f('0x5e'),'destroy',{'module':_0xcb4f('0x63')});}else{var _0x177ca8=fs[_0xcb4f('0x58')](path[_0xcb4f('0x59')](config[_0xcb4f('0x5a')],'server/files/templates/network.ejs'),_0xcb4f('0x5b'));var _0x50b88e=ejs['render'](_0x177ca8,{'networks':_0x2be313||[]});fs['writeFileSync'](util[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x302002[_0xcb4f('0x56')][_0xcb4f('0x3d')][_0xcb4f('0x67')]()),_0x50b88e);return respondWithRpcPromise(_0xcb4f('0x5e'),_0xcb4f('0x35'),{'module':'chan_sip.so'});}return null;})[_0xcb4f('0x27')](handleError(_0x358898,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e64b2ac..2fdfbd1 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 _0xa75b=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','api','moment','bluebird'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xa75b,0x170));var _0xba75=function(_0x4b2766,_0xa81312){_0x4b2766=_0x4b2766-0x0;var _0x6e7123=_0xa75b[_0x4b2766];return _0x6e7123;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b29=['lodash','../../config/logger','api','request-promise','path','../../config/environment','exports','define','Network','network'];(function(_0x4902a3,_0x418aac){var _0x52ff3b=function(_0xe5a61f){while(--_0xe5a61f){_0x4902a3['push'](_0x4902a3['shift']());}};_0x52ff3b(++_0x418aac);}(_0x8b29,0xbe));var _0x98b2=function(_0x5f04ea,_0x3b4c1d){_0x5f04ea=_0x5f04ea-0x0;var _0x5ed591=_0x8b29[_0x5f04ea];return _0x5ed591;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var logger=require(_0x98b2('0x1'))(_0x98b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x98b2('0x3'));var fs=require('fs');var path=require(_0x98b2('0x4'));var rimraf=require('rimraf');var config=require(_0x98b2('0x5'));var attributes=require('./network.attributes');module[_0x98b2('0x6')]=function(_0xa3c251,_0xb0082c){return _0xa3c251[_0x98b2('0x7')](_0x98b2('0x8'),attributes,{'tableName':_0x98b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index a6cf567..ff3566f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f006a,_0x426607){var _0x1720a8=function(_0x44f105){while(--_0x44f105){_0x1f006a['push'](_0x1f006a['shift']());}};_0x1720a8(++_0x426607);}(_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 +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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x129af0,_0x943bb6){_0x129af0=_0x129af0-0x0;var _0xc735b2=_0x7a54[_0x129af0];return _0xc735b2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 4467d52..f84c583 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 _0x11e6=['put','update','delete','removeDispositions','/:id/users','exports','multer','util','connect-timeout','express','Router','fs-extra','./openchannelAccount.controller','isAuthenticated','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0x11e6,0xc6));var _0x611e=function(_0x213228,_0x3ff7e9){_0x213228=_0x213228-0x0;var _0x24f3d3=_0x11e6[_0x213228];return _0x24f3d3;};'use strict';var multer=require(_0x611e('0x0'));var util=require(_0x611e('0x1'));var path=require('path');var timeout=require(_0x611e('0x2'));var express=require(_0x611e('0x3'));var router=express[_0x611e('0x4')]();var fs_extra=require(_0x611e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x611e('0x6'));router['get']('/',auth[_0x611e('0x7')](),controller['index']);router[_0x611e('0x8')](_0x611e('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x611e('0x8')](_0x611e('0xa'),auth[_0x611e('0x7')](),controller[_0x611e('0xb')]);router[_0x611e('0x8')](_0x611e('0xc'),auth['isAuthenticated'](),controller[_0x611e('0xd')]);router[_0x611e('0x8')](_0x611e('0xe'),auth[_0x611e('0x7')](),controller[_0x611e('0xf')]);router[_0x611e('0x8')](_0x611e('0x10'),auth[_0x611e('0x7')](),controller['getApplications']);router[_0x611e('0x8')](_0x611e('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x611e('0x12')]('/',auth[_0x611e('0x7')](),controller[_0x611e('0x13')]);router[_0x611e('0x12')](_0x611e('0xc'),auth[_0x611e('0x7')](),controller[_0x611e('0x14')]);router['post']('/:id/canned_answers',auth[_0x611e('0x7')](),controller[_0x611e('0x15')]);router[_0x611e('0x12')](_0x611e('0x16'),controller[_0x611e('0x17')]);router[_0x611e('0x12')]('/:id/applications',auth['isAuthenticated'](),controller[_0x611e('0x18')]);router[_0x611e('0x12')]('/:id/users',auth[_0x611e('0x7')](),controller[_0x611e('0x19')]);router['post']('/:id/send',auth[_0x611e('0x7')](),controller['send']);router[_0x611e('0x1a')]('/:id',auth[_0x611e('0x7')](),controller[_0x611e('0x1b')]);router[_0x611e('0x1c')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x611e('0x1c')]('/:id/dispositions',auth[_0x611e('0x7')](),controller[_0x611e('0x1d')]);router['delete'](_0x611e('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x611e('0x1c')](_0x611e('0x1e'),auth[_0x611e('0x7')](),controller['removeAgents']);module[_0x611e('0x1f')]=router; \ No newline at end of file +var _0x450b=['/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications'];(function(_0x2dadca,_0x56aaba){var _0x1595a7=function(_0x558746){while(--_0x558746){_0x2dadca['push'](_0x2dadca['shift']());}};_0x1595a7(++_0x56aaba);}(_0x450b,0x102));var _0xb450=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x450b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb450('0x0'));var util=require(_0xb450('0x1'));var path=require('path');var timeout=require(_0xb450('0x2'));var express=require(_0xb450('0x3'));var router=express[_0xb450('0x4')]();var fs_extra=require(_0xb450('0x5'));var auth=require(_0xb450('0x6'));var interaction=require(_0xb450('0x7'));var config=require(_0xb450('0x8'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xb450('0x9')](),controller[_0xb450('0xa')]);router[_0xb450('0xb')](_0xb450('0xc'),auth[_0xb450('0x9')](),controller['describe']);router[_0xb450('0xb')](_0xb450('0xd'),auth[_0xb450('0x9')](),controller[_0xb450('0xe')]);router[_0xb450('0xb')](_0xb450('0xf'),auth[_0xb450('0x9')](),controller[_0xb450('0x10')]);router[_0xb450('0xb')](_0xb450('0x11'),auth[_0xb450('0x9')](),controller['getAnswers']);router[_0xb450('0xb')](_0xb450('0x12'),auth[_0xb450('0x9')](),controller[_0xb450('0x13')]);router[_0xb450('0xb')](_0xb450('0x14'),auth[_0xb450('0x9')](),controller[_0xb450('0x15')]);router[_0xb450('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xb450('0x16')]);router[_0xb450('0x17')]('/',auth[_0xb450('0x9')](),controller[_0xb450('0x18')]);router[_0xb450('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xb450('0x17')](_0xb450('0x11'),auth[_0xb450('0x9')](),controller[_0xb450('0x19')]);router[_0xb450('0x17')](_0xb450('0x1a'),controller[_0xb450('0x1b')]);router['post'](_0xb450('0x12'),auth['isAuthenticated'](),controller[_0xb450('0x1c')]);router[_0xb450('0x17')](_0xb450('0x1d'),auth[_0xb450('0x9')](),controller[_0xb450('0x1e')]);router[_0xb450('0x17')](_0xb450('0x1f'),auth[_0xb450('0x9')](),controller[_0xb450('0x20')]);router[_0xb450('0x21')](_0xb450('0xd'),auth['isAuthenticated'](),controller[_0xb450('0x22')]);router[_0xb450('0x23')](_0xb450('0xd'),auth[_0xb450('0x9')](),controller[_0xb450('0x24')]);router[_0xb450('0x23')](_0xb450('0xf'),auth['isAuthenticated'](),controller[_0xb450('0x25')]);router['delete']('/:id/canned_answers',auth[_0xb450('0x9')](),controller[_0xb450('0x26')]);router[_0xb450('0x23')]('/:id/users',auth[_0xb450('0x9')](),controller[_0xb450('0x27')]);module[_0xb450('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 261c8ea..cd03dce 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 _0x5a91=['STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x1a3eef,_0x33a035){var _0x466fd7=function(_0x3ae78c){while(--_0x3ae78c){_0x1a3eef['push'](_0x1a3eef['shift']());}};_0x466fd7(++_0x33a035);}(_0x5a91,0x107));var _0x15a9=function(_0x23e776,_0x453cf4){_0x23e776=_0x23e776-0x0;var _0x52285a=_0x5a91[_0x23e776];return _0x52285a;};'use strict';var Sequelize=require(_0x15a9('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x15a9('0x1')],'unique':_0x15a9('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x15a9('0x1')],'defaultValue':function(){return rs[_0x15a9('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x15a9('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x15a9('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x15a9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x15a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x15a9('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x15a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x15a9('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x15a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x15a9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x15a9('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x15a9('0x5')],'defaultValue':![],'comment':_0x15a9('0x8'),'set':function(_0x29f385){if(!_0x29f385)this[_0x15a9('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x15a9('0xa'),_0x29f385);}}}; \ No newline at end of file +var _0x6d46=['name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','sequelize','randomstring','STRING'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x6d46,0x7f));var _0x66d4=function(_0x508dc5,_0x1aa23c){_0x508dc5=_0x508dc5-0x0;var _0x403554=_0x6d46[_0x508dc5];return _0x403554;};'use strict';var Sequelize=require(_0x66d4('0x0'));var rs=require(_0x66d4('0x1'));module['exports']={'name':{'type':Sequelize[_0x66d4('0x2')],'unique':_0x66d4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x66d4('0x2')]},'token':{'type':Sequelize[_0x66d4('0x2')],'defaultValue':function(){return rs[_0x66d4('0x4')]();}},'replyUri':{'type':Sequelize[_0x66d4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x66d4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x66d4('0x5')],'defaultValue':function(){return _0x66d4('0x6');}},'notificationSound':{'type':Sequelize[_0x66d4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x66d4('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x66d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x66d4('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x66d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x66d4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x66d4('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x66d4('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2efaeb){if(!_0x2efaeb)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x66d4('0x9')]('mandatoryDisposition',_0x2efaeb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d0ba6c7..d05ddd1 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 _0x3a3b=['READ_COMMITTED','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','include','findAll','rows','show','params','includeAll','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','options','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','pick','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x3a3b,0x194));var _0xb3a3=function(_0xe0c346,_0xd10855){_0xe0c346=_0xe0c346-0x0;var _0x4609d9=_0x3a3b[_0xe0c346];return _0x4609d9;};'use strict';var emlformat=require(_0xb3a3('0x0'));var rimraf=require(_0xb3a3('0x1'));var zipdir=require(_0xb3a3('0x2'));var jsonpatch=require(_0xb3a3('0x3'));var rp=require(_0xb3a3('0x4'));var moment=require(_0xb3a3('0x5'));var BPromise=require(_0xb3a3('0x6'));var Mustache=require('mustache');var util=require(_0xb3a3('0x7'));var path=require(_0xb3a3('0x8'));var sox=require(_0xb3a3('0x9'));var csv=require(_0xb3a3('0xa'));var ejs=require(_0xb3a3('0xb'));var fs=require('fs');var fs_extra=require(_0xb3a3('0xc'));var _=require(_0xb3a3('0xd'));var squel=require(_0xb3a3('0xe'));var crypto=require(_0xb3a3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb3a3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb3a3('0x11'));var Papa=require(_0xb3a3('0x12'));var Redis=require(_0xb3a3('0x13'));var authService=require(_0xb3a3('0x14'));var qs=require(_0xb3a3('0x15'));var as=require(_0xb3a3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3a3('0x17'))(_0xb3a3('0x18'));var utils=require(_0xb3a3('0x19'));var config=require(_0xb3a3('0x1a'));var licenseUtil=require(_0xb3a3('0x1b'));var db=require(_0xb3a3('0x1c'))['db'];config[_0xb3a3('0x1d')]=_[_0xb3a3('0x1e')](config[_0xb3a3('0x1d')],{'host':_0xb3a3('0x1f'),'port':0x18eb});var socket=require(_0xb3a3('0x20'))(new Redis(config[_0xb3a3('0x1d')]));require(_0xb3a3('0x21'))[_0xb3a3('0x22')](socket);var jayson=require(_0xb3a3('0x23'));var client=jayson['client'][_0xb3a3('0x24')]({'port':0x232c});var client9002=jayson[_0xb3a3('0x25')][_0xb3a3('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x324613,_0x41a8be,_0x3a1e98,_0x41110f){return new BPromise(function(_0x2f992d,_0x41b662){var _0x41cea4=_0x41110f||client;return _0x41cea4[_0xb3a3('0x26')](_0x324613,_0x3a1e98)[_0xb3a3('0x27')](function(_0x1f0fb1){logger[_0xb3a3('0x28')](_0xb3a3('0x29'),_0x41a8be,_0xb3a3('0x2a'));logger['debug'](_0xb3a3('0x2b'),_0x41a8be,_0xb3a3('0x2a'),JSON[_0xb3a3('0x2c')](_0x1f0fb1));if(_0x1f0fb1[_0xb3a3('0x2d')]){if(_0x1f0fb1[_0xb3a3('0x2d')][_0xb3a3('0x2e')]===0x1f4){logger[_0xb3a3('0x2d')](_0xb3a3('0x29'),_0x41a8be,_0x1f0fb1[_0xb3a3('0x2d')][_0xb3a3('0x2f')]);return _0x41b662(_0x1f0fb1[_0xb3a3('0x2d')][_0xb3a3('0x2f')]);}logger['error'](_0xb3a3('0x29'),_0x41a8be,_0x1f0fb1[_0xb3a3('0x2d')]['message']);return _0x2f992d(_0x1f0fb1['error'][_0xb3a3('0x2f')]);}else{logger[_0xb3a3('0x28')](_0xb3a3('0x29'),_0x41a8be,'request\x20sent');_0x2f992d(_0x1f0fb1[_0xb3a3('0x30')]['message']);}})[_0xb3a3('0x31')](function(_0x3567b0){logger[_0xb3a3('0x2d')](_0xb3a3('0x29'),_0x41a8be,_0x3567b0);_0x41b662(_0x3567b0);});});}function respondWithStatusCode(_0x8d7def,_0x1b0300){_0x1b0300=_0x1b0300||0xcc;return function(_0x47206a){if(_0x47206a){return _0x8d7def[_0xb3a3('0x32')](_0x1b0300);}return _0x8d7def[_0xb3a3('0x33')](_0x1b0300)[_0xb3a3('0x34')]();};}function respondWithResult(_0x357346,_0x255885){_0x255885=_0x255885||0xc8;return function(_0x35360d){if(_0x35360d){return _0x357346[_0xb3a3('0x33')](_0x255885)[_0xb3a3('0x35')](_0x35360d);}};}function respondWithFilteredResult(_0x59828f,_0x50b482){return function(_0x25e32e){if(_0x25e32e){var _0x4bd31f=typeof _0x50b482[_0xb3a3('0x36')]===_0xb3a3('0x37')&&typeof _0x50b482[_0xb3a3('0x38')]==='undefined';var _0x741fd=_0x25e32e[_0xb3a3('0x39')];var _0x518b9b=_0x4bd31f?0x0:_0x50b482[_0xb3a3('0x36')];var _0x1a1fc6=_0x4bd31f?_0x25e32e['count']:_0x50b482[_0xb3a3('0x36')]+_0x50b482[_0xb3a3('0x38')];var _0x4c9622;if(_0x1a1fc6>=_0x741fd){_0x1a1fc6=_0x741fd;_0x4c9622=0xc8;}else{_0x4c9622=0xce;}_0x59828f[_0xb3a3('0x33')](_0x4c9622);return _0x59828f['set']('Content-Range',_0x518b9b+'-'+_0x1a1fc6+'/'+_0x741fd)['json'](_0x25e32e);}return null;};}function patchUpdates(_0x6190e7){return function(_0x58f631){try{jsonpatch['apply'](_0x58f631,_0x6190e7,!![]);}catch(_0x55f73e){return BPromise['reject'](_0x55f73e);}return _0x58f631[_0xb3a3('0x3a')]();};}function saveUpdates(_0x33cc2b,_0x2c2e65){return function(_0x384278){if(_0x384278){return _0x384278[_0xb3a3('0x3b')](_0x33cc2b)[_0xb3a3('0x27')](function(_0x4cee98){return _0x4cee98;});}return null;};}function removeEntity(_0x3c55bd,_0x4de3a9){return function(_0x3f695a){if(_0x3f695a){return _0x3f695a['destroy']()['then'](function(){var _0xc2cc1d=_0x3f695a[_0xb3a3('0x3c')]({'plain':!![]});var _0x2be7d3=_0xb3a3('0x3d');return db[_0xb3a3('0x3e')][_0xb3a3('0x3f')]({'where':{'type':_0x2be7d3,'resourceId':_0xc2cc1d['id']}})['then'](function(){return _0x3f695a;});})[_0xb3a3('0x27')](function(){_0x3c55bd[_0xb3a3('0x33')](0xcc)[_0xb3a3('0x34')]();});}};}function handleEntityNotFound(_0x14fb61,_0xeccff4){return function(_0x4dbe15){if(!_0x4dbe15){_0x14fb61['sendStatus'](0x194);}return _0x4dbe15;};}function handleError(_0x152734,_0x3498e6){_0x3498e6=_0x3498e6||0x1f4;return function(_0x13f36e){logger[_0xb3a3('0x2d')](_0x13f36e[_0xb3a3('0x40')]);if(_0x13f36e[_0xb3a3('0x41')]){delete _0x13f36e['name'];}_0x152734['status'](_0x3498e6)[_0xb3a3('0x42')](_0x13f36e);};}exports['index']=function(_0x3f9f06,_0x257ae){var _0xd8aa3a={'include':[{'model':db[_0xb3a3('0x43')],'as':_0xb3a3('0x44')}]},_0x4e3f51={},_0x20b2ef={'count':0x0,'rows':[]};var _0x55e5f7=_['map'](db[_0xb3a3('0x45')][_0xb3a3('0x46')],function(_0x3b27c4){return{'name':_0x3b27c4[_0xb3a3('0x47')],'type':_0x3b27c4[_0xb3a3('0x48')]['key']};});_0x4e3f51[_0xb3a3('0x49')]=_[_0xb3a3('0x4a')](_0x55e5f7,'name');_0x4e3f51[_0xb3a3('0x4b')]=_[_0xb3a3('0x4c')](_0x3f9f06[_0xb3a3('0x4b')]);_0x4e3f51[_0xb3a3('0x4d')]=_[_0xb3a3('0x4e')](_0x4e3f51[_0xb3a3('0x49')],_0x4e3f51[_0xb3a3('0x4b')]);_0xd8aa3a[_0xb3a3('0x4f')]=_['intersection'](_0x4e3f51[_0xb3a3('0x49')],qs[_0xb3a3('0x50')](_0x3f9f06['query'][_0xb3a3('0x50')]));_0xd8aa3a[_0xb3a3('0x4f')]=_0xd8aa3a[_0xb3a3('0x4f')][_0xb3a3('0x51')]?_0xd8aa3a[_0xb3a3('0x4f')]:_0x4e3f51['model'];if(!_0x3f9f06[_0xb3a3('0x4b')]['hasOwnProperty'](_0xb3a3('0x52'))){_0xd8aa3a[_0xb3a3('0x38')]=qs[_0xb3a3('0x38')](_0x3f9f06[_0xb3a3('0x4b')][_0xb3a3('0x38')]);_0xd8aa3a[_0xb3a3('0x36')]=qs[_0xb3a3('0x36')](_0x3f9f06[_0xb3a3('0x4b')][_0xb3a3('0x36')]);}_0xd8aa3a[_0xb3a3('0x53')]=qs[_0xb3a3('0x54')](_0x3f9f06['query'][_0xb3a3('0x54')]);_0xd8aa3a[_0xb3a3('0x55')]=qs['filters'](_['pick'](_0x3f9f06[_0xb3a3('0x4b')],_0x4e3f51['filters']),_0x55e5f7);if(_0x3f9f06[_0xb3a3('0x4b')]['filter']){_0xd8aa3a[_0xb3a3('0x55')]=_['merge'](_0xd8aa3a['where'],{'$or':_['map'](_0x55e5f7,function(_0x51429d){if(_0x51429d['type']!==_0xb3a3('0x56')){var _0xfe9291={};_0xfe9291[_0x51429d['name']]={'$like':'%'+_0x3f9f06[_0xb3a3('0x4b')][_0xb3a3('0x57')]+'%'};return _0xfe9291;}})});}_0xd8aa3a=_[_0xb3a3('0x58')]({},_0xd8aa3a,_0x3f9f06['options']);var _0x209395={'where':_0xd8aa3a[_0xb3a3('0x55')]};return db[_0xb3a3('0x45')][_0xb3a3('0x39')](_0x209395)['then'](function(_0x1a0927){_0x20b2ef[_0xb3a3('0x39')]=_0x1a0927;if(_0x3f9f06['query']['includeAll']){_0xd8aa3a[_0xb3a3('0x59')]=[{'all':!![]}];}return db[_0xb3a3('0x45')][_0xb3a3('0x5a')](_0xd8aa3a);})[_0xb3a3('0x27')](function(_0x57efd3){_0x20b2ef[_0xb3a3('0x5b')]=_0x57efd3;return _0x20b2ef;})['then'](respondWithFilteredResult(_0x257ae,_0xd8aa3a))[_0xb3a3('0x31')](handleError(_0x257ae,null));};exports[_0xb3a3('0x5c')]=function(_0x114b81,_0x1f9268){var _0x47dbc1={'raw':![],'where':{'id':_0x114b81[_0xb3a3('0x5d')]['id']},'include':[{'model':db[_0xb3a3('0x43')],'as':_0xb3a3('0x44')}]},_0x223630={};_0x223630[_0xb3a3('0x49')]=_[_0xb3a3('0x4c')](db['OpenchannelAccount'][_0xb3a3('0x46')]);_0x223630[_0xb3a3('0x4b')]=_['keys'](_0x114b81[_0xb3a3('0x4b')]);_0x223630[_0xb3a3('0x4d')]=_[_0xb3a3('0x4e')](_0x223630[_0xb3a3('0x49')],_0x223630[_0xb3a3('0x4b')]);_0x47dbc1[_0xb3a3('0x4f')]=_['intersection'](_0x223630['model'],qs[_0xb3a3('0x50')](_0x114b81[_0xb3a3('0x4b')][_0xb3a3('0x50')]));_0x47dbc1['attributes']=_0x47dbc1[_0xb3a3('0x4f')][_0xb3a3('0x51')]?_0x47dbc1[_0xb3a3('0x4f')]:_0x223630[_0xb3a3('0x49')];if(_0x114b81[_0xb3a3('0x4b')][_0xb3a3('0x5e')]){_0x47dbc1[_0xb3a3('0x59')]=[{'all':!![]}];}_0x47dbc1=_[_0xb3a3('0x58')]({},_0x47dbc1,_0x114b81['options']);return db['OpenchannelAccount'][_0xb3a3('0x5f')](_0x47dbc1)['then'](handleEntityNotFound(_0x1f9268,null))['then'](respondWithResult(_0x1f9268,null))['catch'](handleError(_0x1f9268,null));};exports[_0xb3a3('0x60')]=function(_0x88cbe3,_0x4d17a4){return db[_0xb3a3('0x45')]['create'](_0x88cbe3[_0xb3a3('0x61')],{})[_0xb3a3('0x27')](function(_0x3b01ba){var _0x1b20bf=_0x88cbe3[_0xb3a3('0x62')][_0xb3a3('0x3c')]({'plain':!![]});if(!_0x1b20bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b20bf['role']===_0xb3a3('0x62')){var _0x4ec609=_0x3b01ba[_0xb3a3('0x3c')]({'plain':!![]});var _0x319478=_0xb3a3('0x3d');return db[_0xb3a3('0x63')][_0xb3a3('0x5f')]({'where':{'name':_0x319478,'userProfileId':_0x1b20bf[_0xb3a3('0x64')]},'raw':!![]})[_0xb3a3('0x27')](function(_0x5233ab){if(_0x5233ab&&_0x5233ab[_0xb3a3('0x65')]===0x0){return db[_0xb3a3('0x3e')][_0xb3a3('0x60')]({'name':_0x4ec609['name'],'resourceId':_0x4ec609['id'],'type':_0x5233ab['name'],'sectionId':_0x5233ab['id']},{})[_0xb3a3('0x27')](function(){return _0x3b01ba;});}else{return _0x3b01ba;}})[_0xb3a3('0x31')](function(_0x243dc7){logger[_0xb3a3('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x243dc7);throw _0x243dc7;});}return _0x3b01ba;})['then'](respondWithResult(_0x4d17a4,0xc9))[_0xb3a3('0x31')](handleError(_0x4d17a4,null));};exports[_0xb3a3('0x3b')]=function(_0x58d8fd,_0x475935){if(_0x58d8fd[_0xb3a3('0x61')]['id']){delete _0x58d8fd[_0xb3a3('0x61')]['id'];}return db[_0xb3a3('0x45')]['find']({'where':{'id':_0x58d8fd[_0xb3a3('0x5d')]['id']},'include':[{'model':db[_0xb3a3('0x43')],'as':'mandatoryDispositionPause'}]})[_0xb3a3('0x27')](handleEntityNotFound(_0x475935,null))[_0xb3a3('0x27')](saveUpdates(_0x58d8fd[_0xb3a3('0x61')],null))['then'](respondWithResult(_0x475935,null))[_0xb3a3('0x31')](handleError(_0x475935,null));};exports[_0xb3a3('0x3f')]=function(_0x304a0c,_0x4ac57d){return db[_0xb3a3('0x45')][_0xb3a3('0x5f')]({'where':{'id':_0x304a0c[_0xb3a3('0x5d')]['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x4ac57d,null))[_0xb3a3('0x27')](removeEntity(_0x4ac57d,null))[_0xb3a3('0x31')](handleError(_0x4ac57d,null));};exports[_0xb3a3('0x66')]=function(_0x20ef8b,_0x416fcd){return db[_0xb3a3('0x45')][_0xb3a3('0x66')]()['then'](respondWithResult(_0x416fcd,null))[_0xb3a3('0x31')](handleError(_0x416fcd,null));};exports['addDisposition']=function(_0x364a3f,_0xf30d1f,_0x1e706e){if(_0x364a3f['body']['id']){delete _0x364a3f[_0xb3a3('0x61')]['id'];}return db[_0xb3a3('0x45')][_0xb3a3('0x5f')]({'where':{'id':_0x364a3f['params']['id']}})['then'](handleEntityNotFound(_0xf30d1f,null))[_0xb3a3('0x27')](function(_0x56227a){if(_0x56227a){_0x364a3f[_0xb3a3('0x61')][_0xb3a3('0x67')]=_0x56227a['id'];return db[_0xb3a3('0x68')][_0xb3a3('0x60')](_0x364a3f[_0xb3a3('0x61')]);}})[_0xb3a3('0x27')](respondWithResult(_0xf30d1f,null))[_0xb3a3('0x31')](handleError(_0xf30d1f,null));};exports[_0xb3a3('0x69')]=function(_0x4148b1,_0x332404,_0x350956){var _0x350147={'raw':![],'where':{}};var _0x2800ce={};var _0x192ca0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb3a3('0x6a')]({'where':{'id':_0x4148b1[_0xb3a3('0x5d')]['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x332404,null))[_0xb3a3('0x27')](function(_0x4286ca){if(_0x4286ca){_0x2800ce['model']=_['keys'](db[_0xb3a3('0x68')][_0xb3a3('0x46')]);_0x2800ce['query']=_[_0xb3a3('0x4c')](_0x4148b1[_0xb3a3('0x4b')]);_0x2800ce[_0xb3a3('0x4d')]=_[_0xb3a3('0x4e')](_0x2800ce[_0xb3a3('0x49')],_0x2800ce[_0xb3a3('0x4b')]);_0x350147[_0xb3a3('0x4f')]=_[_0xb3a3('0x4e')](_0x2800ce['model'],qs['fields'](_0x4148b1[_0xb3a3('0x4b')][_0xb3a3('0x50')]));_0x350147[_0xb3a3('0x4f')]=_0x350147['attributes']['length']?_0x350147[_0xb3a3('0x4f')]:_0x2800ce[_0xb3a3('0x49')];if(!_0x4148b1[_0xb3a3('0x4b')]['hasOwnProperty'](_0xb3a3('0x52'))){_0x350147[_0xb3a3('0x38')]=qs[_0xb3a3('0x38')](_0x4148b1[_0xb3a3('0x4b')][_0xb3a3('0x38')]);_0x350147[_0xb3a3('0x36')]=qs[_0xb3a3('0x36')](_0x4148b1[_0xb3a3('0x4b')][_0xb3a3('0x36')]);}_0x350147[_0xb3a3('0x53')]=qs[_0xb3a3('0x54')](_0x4148b1[_0xb3a3('0x4b')][_0xb3a3('0x54')]);_0x350147[_0xb3a3('0x55')]=qs[_0xb3a3('0x4d')](_['pick'](_0x4148b1['query'],_0x2800ce[_0xb3a3('0x4d')]));_0x350147[_0xb3a3('0x55')][_0xb3a3('0x67')]=_0x4286ca['id'];if(_0x4148b1['query']['filter']){_0x350147[_0xb3a3('0x55')]=_['merge'](_0x350147[_0xb3a3('0x55')],{'$or':_[_0xb3a3('0x4a')](_0x350147[_0xb3a3('0x4f')],function(_0x4953e4){var _0x691af5={};_0x691af5[_0x4953e4]={'$like':'%'+_0x4148b1[_0xb3a3('0x4b')][_0xb3a3('0x57')]+'%'};return _0x691af5;})});}_0x350147=_[_0xb3a3('0x58')]({},_0x350147,_0x4148b1[_0xb3a3('0x6b')]);return db[_0xb3a3('0x68')][_0xb3a3('0x39')]({'where':_0x350147[_0xb3a3('0x55')]})[_0xb3a3('0x27')](function(_0x5b0359){_0x192ca0[_0xb3a3('0x39')]=_0x5b0359;if(_0x4148b1['query'][_0xb3a3('0x5e')]){_0x350147[_0xb3a3('0x59')]=[{'all':!![]}];}return db[_0xb3a3('0x68')][_0xb3a3('0x5a')](_0x350147);})[_0xb3a3('0x27')](function(_0x44dbb3){_0x192ca0[_0xb3a3('0x5b')]=_0x44dbb3;return _0x192ca0;});}})[_0xb3a3('0x27')](respondWithFilteredResult(_0x332404,_0x350147))[_0xb3a3('0x31')](handleError(_0x332404,null));};exports['removeDispositions']=function(_0x22fe10,_0x585a4b,_0x583a7c){return db[_0xb3a3('0x45')][_0xb3a3('0x5f')]({'where':{'id':_0x22fe10[_0xb3a3('0x5d')]['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x585a4b,null))[_0xb3a3('0x27')](function(_0x4d50a9){if(_0x4d50a9){return _0x4d50a9[_0xb3a3('0x6c')](_0x22fe10[_0xb3a3('0x4b')][_0xb3a3('0x6d')]);}})[_0xb3a3('0x27')](respondWithStatusCode(_0x585a4b,null))[_0xb3a3('0x31')](handleError(_0x585a4b,null));};exports['addAnswer']=function(_0x24c788,_0x12cb75,_0x557abd){if(_0x24c788[_0xb3a3('0x61')]['id']){delete _0x24c788[_0xb3a3('0x61')]['id'];}return db[_0xb3a3('0x45')]['find']({'where':{'id':_0x24c788['params']['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x12cb75,null))['then'](function(_0x55650d){if(_0x55650d){_0x24c788['body'][_0xb3a3('0x67')]=_0x55650d['id'];return db[_0xb3a3('0x6e')][_0xb3a3('0x60')](_0x24c788['body']);}})['then'](respondWithResult(_0x12cb75,null))['catch'](handleError(_0x12cb75,null));};exports[_0xb3a3('0x6f')]=function(_0x3e9d82,_0x749af3,_0x33abf3){var _0x3426e4={'raw':![],'where':{}};var _0x46d268={};var _0x517cc1={'count':0x0,'rows':[]};return db[_0xb3a3('0x45')]['findOne']({'where':{'id':_0x3e9d82[_0xb3a3('0x5d')]['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x749af3,null))[_0xb3a3('0x27')](function(_0x439b9e){if(_0x439b9e){_0x46d268[_0xb3a3('0x49')]=_['keys'](db[_0xb3a3('0x6e')][_0xb3a3('0x46')]);_0x46d268['query']=_['keys'](_0x3e9d82[_0xb3a3('0x4b')]);_0x46d268[_0xb3a3('0x4d')]=_[_0xb3a3('0x4e')](_0x46d268['model'],_0x46d268[_0xb3a3('0x4b')]);_0x3426e4[_0xb3a3('0x4f')]=_[_0xb3a3('0x4e')](_0x46d268[_0xb3a3('0x49')],qs[_0xb3a3('0x50')](_0x3e9d82[_0xb3a3('0x4b')][_0xb3a3('0x50')]));_0x3426e4[_0xb3a3('0x4f')]=_0x3426e4[_0xb3a3('0x4f')][_0xb3a3('0x51')]?_0x3426e4[_0xb3a3('0x4f')]:_0x46d268['model'];if(!_0x3e9d82['query'][_0xb3a3('0x70')](_0xb3a3('0x52'))){_0x3426e4[_0xb3a3('0x38')]=qs[_0xb3a3('0x38')](_0x3e9d82['query'][_0xb3a3('0x38')]);_0x3426e4[_0xb3a3('0x36')]=qs[_0xb3a3('0x36')](_0x3e9d82[_0xb3a3('0x4b')][_0xb3a3('0x36')]);}_0x3426e4[_0xb3a3('0x53')]=qs[_0xb3a3('0x54')](_0x3e9d82['query'][_0xb3a3('0x54')]);_0x3426e4[_0xb3a3('0x55')]=qs[_0xb3a3('0x4d')](_[_0xb3a3('0x71')](_0x3e9d82[_0xb3a3('0x4b')],_0x46d268[_0xb3a3('0x4d')]));_0x3426e4[_0xb3a3('0x55')]['OpenchannelAccountId']=_0x439b9e['id'];if(_0x3e9d82[_0xb3a3('0x4b')]['filter']){_0x3426e4[_0xb3a3('0x55')]=_['merge'](_0x3426e4[_0xb3a3('0x55')],{'$or':_['map'](_0x3426e4['attributes'],function(_0x29bb49){var _0x511aac={};_0x511aac[_0x29bb49]={'$like':'%'+_0x3e9d82[_0xb3a3('0x4b')][_0xb3a3('0x57')]+'%'};return _0x511aac;})});}_0x3426e4=_[_0xb3a3('0x58')]({},_0x3426e4,_0x3e9d82['options']);return db[_0xb3a3('0x6e')][_0xb3a3('0x39')]({'where':_0x3426e4[_0xb3a3('0x55')]})[_0xb3a3('0x27')](function(_0x3850b6){_0x517cc1[_0xb3a3('0x39')]=_0x3850b6;if(_0x3e9d82['query'][_0xb3a3('0x5e')]){_0x3426e4[_0xb3a3('0x59')]=[{'all':!![]}];}return db[_0xb3a3('0x6e')][_0xb3a3('0x5a')](_0x3426e4);})[_0xb3a3('0x27')](function(_0x224ba7){_0x517cc1[_0xb3a3('0x5b')]=_0x224ba7;return _0x517cc1;});}})[_0xb3a3('0x27')](respondWithFilteredResult(_0x749af3,_0x3426e4))[_0xb3a3('0x31')](handleError(_0x749af3,null));};exports[_0xb3a3('0x72')]=function(_0x51b0e6,_0x582963,_0x26d836){return db[_0xb3a3('0x45')]['find']({'where':{'id':_0x51b0e6[_0xb3a3('0x5d')]['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x582963,null))[_0xb3a3('0x27')](function(_0x5e4f70){if(_0x5e4f70){return _0x5e4f70['removeAnswers'](_0x51b0e6['query'][_0xb3a3('0x6d')]);}})['then'](respondWithStatusCode(_0x582963,null))[_0xb3a3('0x31')](handleError(_0x582963,null));};exports[_0xb3a3('0x73')]=function(_0x4fec54,_0x4028a3,_0x20fd3e){var _0x62595c={'body':_0x4fec54[_0xb3a3('0x61')],'channel':_0xb3a3('0x74')};var _0x5e71fb=[];var _0x3b5dcf=[];var _0x5d87aa={};var _0xc4a1df=![];return db[_0xb3a3('0x75')]['describe']()[_0xb3a3('0x27')](function(_0x37c13e){if(!_0x37c13e){throw new db[(_0xb3a3('0x76'))][(_0xb3a3('0x77'))](_0xb3a3('0x78'));}_0x5e71fb=_['difference'](_[_0xb3a3('0x4c')](_0x37c13e),[_0xb3a3('0x79'),_0xb3a3('0x7a')]);_0x3b5dcf=_[_0xb3a3('0x7b')](_[_0xb3a3('0x4c')](_0x37c13e),[_0xb3a3('0x79'),_0xb3a3('0x7a'),_0xb3a3('0x7c'),_0xb3a3('0x7d')]);if(_0x4fec54[_0xb3a3('0x61')]['id']){delete _0x4fec54[_0xb3a3('0x61')]['id'];}if(_['isNil'](_0x4fec54[_0xb3a3('0x61')]['from'])){throw new db[(_0xb3a3('0x76'))][(_0xb3a3('0x77'))](_0xb3a3('0x7e'));}if(_[_0xb3a3('0x7f')](_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x61')])||_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x61')]===''){throw new db['Sequelize'][(_0xb3a3('0x77'))](_0xb3a3('0x80'));}if(_[_0xb3a3('0x7f')](_0x4fec54['body']['mapKey'])){throw new db[(_0xb3a3('0x76'))]['ValidationError'](_0xb3a3('0x81')+_0x3b5dcf);}if(!_[_0xb3a3('0x82')](_0x3b5dcf,_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x83')])){throw new db[(_0xb3a3('0x76'))][(_0xb3a3('0x77'))](_0xb3a3('0x84')+_0x3b5dcf);}_0x5d87aa[_0x4fec54['body']['mapKey']]=_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x85')];})['then'](function(){return db[_0xb3a3('0x45')][_0xb3a3('0x5f')]({'where':{'id':_0x4fec54[_0xb3a3('0x5d')]['id']},'include':[{'model':db[_0xb3a3('0x86')],'as':_0xb3a3('0x87'),'include':[{'model':db[_0xb3a3('0x75')],'as':_0xb3a3('0x88'),'where':_0x5d87aa,'limit':0x1,'order':[[_0xb3a3('0x7a'),_0xb3a3('0x89')]]}]},{'model':db[_0xb3a3('0x8a')],'as':_0xb3a3('0x8b')}]});})[_0xb3a3('0x27')](handleEntityNotFound(_0x4028a3,null))[_0xb3a3('0x27')](function(_0x8b6f7d){if(_0x8b6f7d&&_0x8b6f7d[_0xb3a3('0x87')]){_0x62595c[_0xb3a3('0x8c')]=_0x8b6f7d;_0x62595c[_0xb3a3('0x8d')]=_0x8b6f7d[_0xb3a3('0x8b')];_0x62595c[_0xb3a3('0x8e')]=_0x8b6f7d['List'];_0x62595c[_0xb3a3('0x8d')]=_['orderBy'](_0x62595c[_0xb3a3('0x8d')],[_0xb3a3('0x8f')],[_0xb3a3('0x90')]);if(_0x62595c[_0xb3a3('0x8c')][_0xb3a3('0x8b')]){delete _0x62595c['account']['Applications'];}if(_0x62595c[_0xb3a3('0x8c')]['List']&&_0x62595c[_0xb3a3('0x8c')]['List'][_0xb3a3('0x88')][_0xb3a3('0x51')]){return _0x62595c[_0xb3a3('0x8c')][_0xb3a3('0x87')][_0xb3a3('0x88')][0x0];}var _0x5a2757=_['defaults'](_0x4fec54[_0xb3a3('0x61')],{'firstName':_0x4fec54['body'][_0xb3a3('0x85')],'ListId':_0x8b6f7d[_0xb3a3('0x7d')]});_0x5a2757[_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x83')]]=_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x85')];return db['CmContact']['create'](_0x5a2757,{'fields':_0x5e71fb,'raw':!![]});}})['then'](handleEntityNotFound(_0x4028a3,null))[_0xb3a3('0x27')](function(_0x1bbf7e){_0x62595c[_0xb3a3('0x91')]=_0x1bbf7e;if(_0x1bbf7e){var _0x50798c={'ContactId':_0x1bbf7e['id'],'OpenchannelAccountId':_0x4fec54['params']['id'],'from':(_0x1bbf7e[_0xb3a3('0x92')]||'')+'\x20'+(_0x1bbf7e[_0xb3a3('0x93')]||'')};var _0x4f9edb={'OpenchannelAccountId':_0x4fec54[_0xb3a3('0x5d')]['id'],'closed':![]};if(_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x94')]){_0x4f9edb['threadId']=_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x94')];return db[_0xb3a3('0x95')]['find']({'where':_0x4f9edb})[_0xb3a3('0x27')](function(_0x825f43){if(_0x825f43){return[_0x825f43,![]];}_0x50798c[_0xb3a3('0x94')]=_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x94')];_0x50798c[_0xb3a3('0x96')]=_0x4fec54['body'][_0xb3a3('0x96')];return db[_0xb3a3('0x95')][_0xb3a3('0x60')](_0x50798c)[_0xb3a3('0x27')](function(_0x2ae854){return[_0x2ae854,!![]];});});}else{_0x4f9edb['threadId']=null;}_0x4f9edb['ContactId']=_0x1bbf7e['id'];return db[_0xb3a3('0x95')][_0xb3a3('0x5f')]({'where':_0x4f9edb})[_0xb3a3('0x27')](function(_0x544bb8){if(_0x544bb8){return[_0x544bb8,![]];}return db[_0xb3a3('0x95')][_0xb3a3('0x60')](_0x50798c)[_0xb3a3('0x27')](function(_0x3f36a2){return[_0x3f36a2,!![]];});});}})[_0xb3a3('0x97')](function(_0xcf178,_0x428e52){if(_0xcf178){_0xc4a1df=_0x428e52;if(!_0x428e52){var _0x323170={'from':(_0x62595c[_0xb3a3('0x91')][_0xb3a3('0x92')]||'')+'\x20'+(_0x62595c['contact']['lastName']||'')};if(_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x94')]&&_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x98')]&&_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x94')]!=_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x98')]){_0x323170[_0xb3a3('0x94')]=_0x4fec54[_0xb3a3('0x61')]['messageId'];}return _0xcf178['update'](_0x323170);}else{return _0xcf178;}}})['then'](function(_0x59febb){_0x62595c[_0xb3a3('0x99')]=_0x59febb[_0xb3a3('0x3c')]({'plain':!![]});_0x62595c[_0xb3a3('0x99')][_0xb3a3('0x9a')]=_0xc4a1df;if(_0x62595c[_0xb3a3('0x99')][_0xb3a3('0x9a')]){if(_0x62595c[_0xb3a3('0x8c')][_0xb3a3('0x9b')]){_0x62595c[_0xb3a3('0x8d')]['push']({'id':0x0,'priority':_0x62595c[_0xb3a3('0x8d')][_0xb3a3('0x51')]+0x1,'app':_0xb3a3('0x9c'),'appdata':_0xb3a3('0x9d'),'interval':_0xb3a3('0x9e')});}}return db[_0xb3a3('0x9f')][_0xb3a3('0x60')]({'body':_0x4fec54[_0xb3a3('0x61')][_0xb3a3('0x61')],'OpenchannelAccountId':_0x4fec54[_0xb3a3('0x5d')]['id'],'OpenchannelInteractionId':_0x59febb['id'],'direction':'in','ContactId':_0x62595c[_0xb3a3('0x91')]['id'],'AttachmentId':_0x4fec54[_0xb3a3('0x61')]['AttachmentId']});})['then'](function(_0x402d3d){_0x62595c[_0xb3a3('0x2f')]=_0x402d3d;if(_0x62595c[_0xb3a3('0x99')][_0xb3a3('0xa0')]){return db['User']['find']({'attributes':['id',_0xb3a3('0x41')],'where':{'id':_0x62595c[_0xb3a3('0x99')][_0xb3a3('0xa0')]}})[_0xb3a3('0x27')](function(_0x30b00f){if(_0x30b00f){_0x62595c[_0xb3a3('0x8d')][_0xb3a3('0xa1')]({'id':0x0,'priority':0x0,'app':_0xb3a3('0xa2'),'appdata':_0x30b00f[_0xb3a3('0x41')]+','+(_0x62595c[_0xb3a3('0x8c')]['waitForTheAssignedAgent']||0xa),'interval':_0xb3a3('0x9e')});_0x62595c[_0xb3a3('0xa3')]=![];}return respondWithRpcPromise(_0xb3a3('0xa4'),_0xb3a3('0xa5'),_0x62595c);});}return respondWithRpcPromise('Start','startRouting',_0x62595c);})[_0xb3a3('0x27')](function(_0x334345){respondWithRpcPromise(_0xb3a3('0xa6'),'EventManager',{'event':_0xb3a3('0x73'),'message':_0x334345},client9002);return _0x334345;})['then'](respondWithResult(_0x4028a3,null))[_0xb3a3('0x31')](handleError(_0x4028a3,null));};exports[_0xb3a3('0xa7')]=function(_0x53b977,_0x39bd56){var _0x19ee1b=_0x53b977[_0xb3a3('0x5d')]['id'];var _0x8b20e0=_0x53b977[_0xb3a3('0x61')];var _0x21c182=0xc8;var _0x45de7c=null;return db[_0xb3a3('0xa8')][_0xb3a3('0xa9')]({'isolationLevel':db[_0xb3a3('0xa8')][_0xb3a3('0xaa')][_0xb3a3('0xab')][_0xb3a3('0xac')]},function(_0x5b65e4){return db['OpenchannelAccount'][_0xb3a3('0x6a')]({'where':{'id':_0x19ee1b},'transaction':_0x5b65e4})[_0xb3a3('0x27')](function(_0x1d7f11){if(_0x1d7f11){return db[_0xb3a3('0x8a')]['destroy']({'where':{'OpenchannelAccountId':_0x19ee1b},'transaction':_0x5b65e4})[_0xb3a3('0x27')](function(){var _0x4ae2ff=_[_0xb3a3('0x4a')](_0x8b20e0,function(_0x5cd5e3){_0x5cd5e3[_0xb3a3('0x67')]=_0x19ee1b;return _0x5cd5e3;});return db[_0xb3a3('0x8a')]['bulkCreate'](_0x4ae2ff,{'transaction':_0x5b65e4});});}else{_0x21c182=0x194;_0x45de7c=[];}});})['then'](function(){if(_0x21c182!==0x194){return db[_0xb3a3('0x8a')][_0xb3a3('0xad')]({'where':{'OpenchannelAccountId':_0x19ee1b},'order':_0xb3a3('0x8f')})[_0xb3a3('0x27')](function(_0x3e9dab){_0x45de7c=_0x3e9dab;});}})[_0xb3a3('0x31')](function(_0x4d5314){_0x21c182=0x1f4;logger[_0xb3a3('0x2d')](_0x4d5314[_0xb3a3('0x40')]);if(_0x4d5314[_0xb3a3('0x41')]){delete _0x4d5314[_0xb3a3('0x41')];}_0x45de7c=_0x4d5314;})['finally'](function(){if(_0x45de7c===null){_0x39bd56[_0xb3a3('0x32')](_0x21c182);}else{if(_0x21c182===0x1f4){_0x39bd56[_0xb3a3('0x33')](_0x21c182)['send'](_0x45de7c);}else{_0x39bd56[_0xb3a3('0x33')](_0x21c182)['json'](_0x45de7c);}}});};exports[_0xb3a3('0xae')]=function(_0x183d70,_0x12a80e,_0x52498f){var _0x291c78={};var _0x5e7fd3={};var _0x56c7f9;var _0x268de0;return db[_0xb3a3('0x45')][_0xb3a3('0x6a')]({'where':{'id':_0x183d70[_0xb3a3('0x5d')]['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x12a80e,null))[_0xb3a3('0x27')](function(_0x31e83e){if(_0x31e83e){_0x56c7f9=_0x31e83e;_0x5e7fd3[_0xb3a3('0x49')]=_[_0xb3a3('0x4c')](db[_0xb3a3('0x8a')][_0xb3a3('0x46')]);_0x5e7fd3[_0xb3a3('0x4b')]=_[_0xb3a3('0x4c')](_0x183d70[_0xb3a3('0x4b')]);_0x5e7fd3[_0xb3a3('0x4d')]=_[_0xb3a3('0x4e')](_0x5e7fd3['model'],_0x5e7fd3[_0xb3a3('0x4b')]);_0x291c78[_0xb3a3('0x4f')]=_[_0xb3a3('0x4e')](_0x5e7fd3['model'],qs[_0xb3a3('0x50')](_0x183d70[_0xb3a3('0x4b')][_0xb3a3('0x50')]));_0x291c78[_0xb3a3('0x4f')]=_0x291c78[_0xb3a3('0x4f')]['length']?_0x291c78[_0xb3a3('0x4f')]:_0x5e7fd3['model'];_0x291c78[_0xb3a3('0x53')]=qs[_0xb3a3('0x54')](_0x183d70[_0xb3a3('0x4b')][_0xb3a3('0x54')]);_0x291c78[_0xb3a3('0x55')]=qs['filters'](_[_0xb3a3('0x71')](_0x183d70[_0xb3a3('0x4b')],_0x5e7fd3[_0xb3a3('0x4d')]));if(_0x183d70[_0xb3a3('0x4b')][_0xb3a3('0x57')]){_0x291c78['where']=_[_0xb3a3('0x58')](_0x291c78[_0xb3a3('0x55')],{'$or':_[_0xb3a3('0x4a')](_0x291c78[_0xb3a3('0x4f')],function(_0x483c7a){var _0x44d34e={};_0x44d34e[_0x483c7a]={'$like':'%'+_0x183d70[_0xb3a3('0x4b')][_0xb3a3('0x57')]+'%'};return _0x44d34e;})});}_0x291c78=_['merge']({},_0x291c78,_0x183d70[_0xb3a3('0x6b')]);return _0x56c7f9[_0xb3a3('0xae')](_0x291c78);}})[_0xb3a3('0x27')](function(_0x19bbd7){if(_0x19bbd7){_0x268de0=_0x19bbd7[_0xb3a3('0x51')];if(!_0x183d70[_0xb3a3('0x4b')][_0xb3a3('0x70')](_0xb3a3('0x52'))){_0x291c78[_0xb3a3('0x38')]=qs[_0xb3a3('0x38')](_0x183d70[_0xb3a3('0x4b')][_0xb3a3('0x38')]);_0x291c78[_0xb3a3('0x36')]=qs[_0xb3a3('0x36')](_0x183d70[_0xb3a3('0x4b')][_0xb3a3('0x36')]);}return _0x56c7f9[_0xb3a3('0xae')](_0x291c78);}})['then'](function(_0x3941cd){if(_0x3941cd){return _0x3941cd?{'count':_0x268de0,'rows':_0x3941cd}:null;}})[_0xb3a3('0x27')](respondWithResult(_0x12a80e,null))[_0xb3a3('0x31')](handleError(_0x12a80e,null));};exports[_0xb3a3('0xaf')]=function(_0x2dd5a7,_0x259f00,_0x48c8f3){var _0x5d9365={'raw':![],'where':{}};var _0x4198cb={};var _0x516f0f={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2dd5a7[_0xb3a3('0x5d')]['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x259f00,null))['then'](function(_0x4a7b1e){if(_0x4a7b1e){_0x4198cb[_0xb3a3('0x49')]=_[_0xb3a3('0x4c')](db['OpenchannelInteraction'][_0xb3a3('0x46')]);_0x4198cb['query']=_['keys'](_0x2dd5a7[_0xb3a3('0x4b')]);_0x4198cb[_0xb3a3('0x4d')]=_[_0xb3a3('0x4e')](_0x4198cb['model'],_0x4198cb[_0xb3a3('0x4b')]);_0x5d9365['attributes']=_['intersection'](_0x4198cb[_0xb3a3('0x49')],qs[_0xb3a3('0x50')](_0x2dd5a7['query'][_0xb3a3('0x50')]));_0x5d9365[_0xb3a3('0x4f')]=_0x5d9365['attributes'][_0xb3a3('0x51')]?_0x5d9365['attributes']:_0x4198cb[_0xb3a3('0x49')];if(!_0x2dd5a7[_0xb3a3('0x4b')][_0xb3a3('0x70')](_0xb3a3('0x52'))){_0x5d9365['limit']=qs[_0xb3a3('0x38')](_0x2dd5a7['query'][_0xb3a3('0x38')]);_0x5d9365['offset']=qs[_0xb3a3('0x36')](_0x2dd5a7[_0xb3a3('0x4b')][_0xb3a3('0x36')]);}_0x5d9365[_0xb3a3('0x53')]=qs['sort'](_0x2dd5a7[_0xb3a3('0x4b')][_0xb3a3('0x54')]);_0x5d9365[_0xb3a3('0x55')]=qs[_0xb3a3('0x4d')](_['pick'](_0x2dd5a7[_0xb3a3('0x4b')],_0x4198cb[_0xb3a3('0x4d')]));_0x5d9365[_0xb3a3('0x55')][_0xb3a3('0x67')]=_0x4a7b1e['id'];if(_0x2dd5a7[_0xb3a3('0x4b')][_0xb3a3('0x57')]){_0x5d9365[_0xb3a3('0x55')]=_[_0xb3a3('0x58')](_0x5d9365[_0xb3a3('0x55')],{'$or':_[_0xb3a3('0x4a')](_0x5d9365[_0xb3a3('0x4f')],function(_0x1d6b98){var _0x358053={};_0x358053[_0x1d6b98]={'$like':'%'+_0x2dd5a7['query'][_0xb3a3('0x57')]+'%'};return _0x358053;})});}_0x5d9365=_['merge']({},_0x5d9365,_0x2dd5a7[_0xb3a3('0x6b')]);return db[_0xb3a3('0x95')][_0xb3a3('0x39')]({'where':_0x5d9365[_0xb3a3('0x55')]})[_0xb3a3('0x27')](function(_0xfe656b){_0x516f0f[_0xb3a3('0x39')]=_0xfe656b;if(_0x2dd5a7[_0xb3a3('0x4b')][_0xb3a3('0x5e')]){_0x5d9365[_0xb3a3('0x59')]=[{'model':db[_0xb3a3('0x75')],'as':_0xb3a3('0xb0'),'required':![]},{'model':db[_0xb3a3('0xb1')],'as':_0xb3a3('0xb2'),'attributes':[_0xb3a3('0x41'),_0xb3a3('0xb3'),_0xb3a3('0xb4')],'required':![]},{'model':db[_0xb3a3('0xb5')],'as':'Tags','attributes':['id',_0xb3a3('0x41'),_0xb3a3('0xb6')],'where':_0x2dd5a7[_0xb3a3('0x4b')][_0xb3a3('0xb7')]?{'id':_0x2dd5a7['query']['tag']}:undefined,'required':_0x2dd5a7[_0xb3a3('0x4b')][_0xb3a3('0xb7')]?!![]:![]}];}return db[_0xb3a3('0x95')]['findAll'](_0x5d9365);})[_0xb3a3('0x27')](function(_0x1a8639){_0x516f0f[_0xb3a3('0x5b')]=_0x1a8639;return _0x516f0f;});}})[_0xb3a3('0x27')](respondWithFilteredResult(_0x259f00,_0x5d9365))[_0xb3a3('0x31')](handleError(_0x259f00,null));};exports[_0xb3a3('0xb8')]=function(_0x485976,_0x3cc18f,_0x27f60e){return db[_0xb3a3('0x45')][_0xb3a3('0x5f')]({'where':{'id':_0x485976['params']['id']}})['then'](handleEntityNotFound(_0x3cc18f,null))[_0xb3a3('0x27')](function(_0x4aa5ef){if(_0x4aa5ef){return _0x4aa5ef['addAgents'](_0x485976['body'][_0xb3a3('0x6d')],_[_0xb3a3('0xb9')](_0x485976[_0xb3a3('0x61')],[_0xb3a3('0x6d'),'id'])||{})[_0xb3a3('0x97')](function(_0x2302d8){for(var _0x3497c7=0x0;_0x3497c7<_0x485976[_0xb3a3('0x61')][_0xb3a3('0x6d')][_0xb3a3('0x51')];_0x3497c7+=0x1){socket[_0xb3a3('0xba')]('userOpenchannelAccount:save',{'UserId':Number(_0x485976[_0xb3a3('0x61')]['ids'][_0x3497c7]),'OpenchannelAccountId':Number(_0x485976[_0xb3a3('0x5d')]['id'])});}return _0x2302d8;});}})[_0xb3a3('0x27')](respondWithResult(_0x3cc18f,null))[_0xb3a3('0x31')](handleError(_0x3cc18f,null));};exports[_0xb3a3('0xbb')]=function(_0x58a916,_0x28ef5f,_0x5f04b0){return db['OpenchannelAccount'][_0xb3a3('0x5f')]({'where':{'id':_0x58a916['params']['id']}})[_0xb3a3('0x27')](handleEntityNotFound(_0x28ef5f,null))[_0xb3a3('0x27')](function(_0x5eea2d){if(_0x5eea2d){return _0x5eea2d[_0xb3a3('0xbb')](_0x58a916[_0xb3a3('0x4b')][_0xb3a3('0x6d')])[_0xb3a3('0x27')](function(){if(_[_0xb3a3('0xbc')](_0x58a916[_0xb3a3('0x4b')][_0xb3a3('0x6d')])){for(var _0x5670d8=0x0;_0x5670d8<_0x58a916[_0xb3a3('0x4b')]['ids'][_0xb3a3('0x51')];_0x5670d8+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x58a916[_0xb3a3('0x4b')]['ids'][_0x5670d8]),'OpenchannelAccountId':Number(_0x58a916[_0xb3a3('0x5d')]['id'])});}}else{socket[_0xb3a3('0xba')](_0xb3a3('0xbd'),{'UserId':Number(_0x58a916[_0xb3a3('0x4b')][_0xb3a3('0x6d')]),'OpenchannelAccountId':Number(_0x58a916[_0xb3a3('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x28ef5f,null))['catch'](handleError(_0x28ef5f,null));};exports['getAgents']=function(_0x22dd63,_0x53ffb0,_0x583cd3){var _0x522738={};var _0x87acf5={};var _0x318818;var _0x6ec2cf;return db[_0xb3a3('0x45')][_0xb3a3('0x6a')]({'where':{'id':_0x22dd63['params']['id']}})['then'](handleEntityNotFound(_0x53ffb0,null))[_0xb3a3('0x27')](function(_0x3be65b){if(_0x3be65b){_0x318818=_0x3be65b;_0x87acf5[_0xb3a3('0x49')]=_[_0xb3a3('0x4c')](db[_0xb3a3('0xb1')][_0xb3a3('0x46')]);_0x87acf5['query']=_[_0xb3a3('0x4c')](_0x22dd63[_0xb3a3('0x4b')]);_0x87acf5[_0xb3a3('0x4d')]=_[_0xb3a3('0x4e')](_0x87acf5[_0xb3a3('0x49')],_0x87acf5[_0xb3a3('0x4b')]);_0x522738[_0xb3a3('0x4f')]=_['intersection'](_0x87acf5['model'],qs[_0xb3a3('0x50')](_0x22dd63[_0xb3a3('0x4b')]['fields']));_0x522738['attributes']=_0x522738[_0xb3a3('0x4f')][_0xb3a3('0x51')]?_0x522738[_0xb3a3('0x4f')]:_0x87acf5[_0xb3a3('0x49')];_0x522738[_0xb3a3('0x53')]=qs[_0xb3a3('0x54')](_0x22dd63[_0xb3a3('0x4b')][_0xb3a3('0x54')]);_0x522738[_0xb3a3('0x55')]=qs[_0xb3a3('0x4d')](_[_0xb3a3('0x71')](_0x22dd63[_0xb3a3('0x4b')],_0x87acf5[_0xb3a3('0x4d')]));if(_0x22dd63[_0xb3a3('0x4b')][_0xb3a3('0x57')]){_0x522738[_0xb3a3('0x55')]=_['merge'](_0x522738[_0xb3a3('0x55')],{'$or':_[_0xb3a3('0x4a')](_0x522738[_0xb3a3('0x4f')],function(_0xaab58d){var _0x3e164f={};_0x3e164f[_0xaab58d]={'$like':'%'+_0x22dd63[_0xb3a3('0x4b')]['filter']+'%'};return _0x3e164f;})});}_0x522738=_[_0xb3a3('0x58')]({},_0x522738,_0x22dd63[_0xb3a3('0x6b')]);return _0x318818['getAgents'](_0x522738);}})[_0xb3a3('0x27')](function(_0x11181c){if(_0x11181c){_0x6ec2cf=_0x11181c[_0xb3a3('0x51')];if(!_0x22dd63[_0xb3a3('0x4b')][_0xb3a3('0x70')](_0xb3a3('0x52'))){_0x522738[_0xb3a3('0x38')]=qs[_0xb3a3('0x38')](_0x22dd63[_0xb3a3('0x4b')]['limit']);_0x522738['offset']=qs[_0xb3a3('0x36')](_0x22dd63[_0xb3a3('0x4b')][_0xb3a3('0x36')]);}return _0x318818['getAgents'](_0x522738);}})[_0xb3a3('0x27')](function(_0x196666){if(_0x196666){return _0x196666?{'count':_0x6ec2cf,'rows':_0x196666}:null;}})['then'](respondWithResult(_0x53ffb0,null))[_0xb3a3('0x31')](handleError(_0x53ffb0,null));};exports['send']=function(_0xf32c35,_0x1dc05b,_0xbb34e8){var _0x11824d,_0x3bdf46,_0x39d6dd;if(_[_0xb3a3('0x7f')](_0xf32c35[_0xb3a3('0x61')][_0xb3a3('0x61')])||_0xf32c35[_0xb3a3('0x61')]['body']===''){throw new db[(_0xb3a3('0x76'))][(_0xb3a3('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb3a3('0x7f')](_0xf32c35[_0xb3a3('0x61')]['to'])){}_0x11824d=_0xf32c35['body']['to'];return db[_0xb3a3('0x45')][_0xb3a3('0x6a')]({'where':{'id':_0xf32c35[_0xb3a3('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1dc05b,null))[_0xb3a3('0x27')](function(_0x11e1c3){if(_0x11e1c3){return db[_0xb3a3('0x45')][_0xb3a3('0x5f')]({'where':{'id':_0x11e1c3['id']},'include':[{'model':db[_0xb3a3('0x86')],'as':'List','include':[{'model':db[_0xb3a3('0x75')],'as':'Contacts','where':{[_0x11e1c3[_0xb3a3('0x83')]]:_0x11824d},'limit':0x1,'order':[[_0xb3a3('0x7a'),_0xb3a3('0x89')]]}]}]})['then'](handleEntityNotFound(_0x1dc05b,null))[_0xb3a3('0x27')](function(_0x14a06a){if(_0x14a06a&&_0x14a06a['List']){_0x3bdf46=_0x14a06a[_0xb3a3('0x3c')]({'plain':!![]});if(_0x3bdf46[_0xb3a3('0x87')]&&_0x3bdf46[_0xb3a3('0x87')][_0xb3a3('0x88')][_0xb3a3('0x51')]){return _0x3bdf46[_0xb3a3('0x87')][_0xb3a3('0x88')][0x0];}return db[_0xb3a3('0x75')][_0xb3a3('0x60')](_[_0xb3a3('0x1e')](_0xf32c35['body'],{'firstName':_0x11824d,[_0x14a06a[_0xb3a3('0x83')]]:_0x11824d,'phone':_0x11824d,'ListId':_0x3bdf46['ListId']}));}})['then'](handleEntityNotFound(_0x1dc05b,null))[_0xb3a3('0x27')](function(_0x244c32){if(_0x244c32){_0x39d6dd=_0x244c32;return db[_0xb3a3('0x95')][_0xb3a3('0x5f')]({'where':{'ContactId':_0x39d6dd['id'],'closed':![],'OpenchannelAccountId':_0x3bdf46['id']}})[_0xb3a3('0x27')](function(_0x1600e7){if(_0x1600e7){return[_0x1600e7,![]];}return db['OpenchannelInteraction'][_0xb3a3('0x60')]({'UserId':_0xf32c35['user']['id'],'ContactId':_0x39d6dd['id'],'OpenchannelAccountId':_0x3bdf46['id'],'lastMsgDirection':'out','Messages':[_[_0xb3a3('0x58')](_0xf32c35[_0xb3a3('0x61')],{'read':![],'body':_0xf32c35[_0xb3a3('0x61')][_0xb3a3('0x61')],'OpenchannelAccountId':_0x3bdf46['id'],'UserId':_0xf32c35[_0xb3a3('0x62')]['id'],'ContactId':_0x39d6dd['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xb3a3('0xbe')}]})[_0xb3a3('0x27')](function(_0x10d906){return[_0x10d906,!![]];});});}})[_0xb3a3('0x97')](function(_0x34ca33,_0x499335){if(_0x499335){return _0x34ca33;}return db[_0xb3a3('0x9f')]['create'](_[_0xb3a3('0x58')](_0xf32c35['body'],{'read':![],'body':_0xf32c35['body']['body'],'OpenchannelAccountId':_0x3bdf46['id'],'OpenchannelInteractionId':_0x34ca33['id'],'UserId':_0xf32c35[_0xb3a3('0x62')]['id'],'ContactId':_0x39d6dd['id']}))['then'](function(_0x399df9){_0x34ca33[_0xb3a3('0xbf')][_0xb3a3('0xbe')]=[];_0x34ca33['dataValues'][_0xb3a3('0xbe')]['push'](_0x399df9[_0xb3a3('0xbf')]);return _0x34ca33;});});}})['then'](respondWithResult(_0x1dc05b,null))[_0xb3a3('0x31')](handleError(_0x1dc05b,null));}; \ No newline at end of file +var _0xec13=['transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','finally','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','then','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','map','OpenchannelAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','rawAttributes','Disposition','removeDispositions','ids','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','Applications','account','applications','orderBy','priority','asc','Contacts','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','interaction','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize'];(function(_0x42e538,_0x1eb5bc){var _0x2cc98c=function(_0x8e3239){while(--_0x8e3239){_0x42e538['push'](_0x42e538['shift']());}};_0x2cc98c(++_0x1eb5bc);}(_0xec13,0xcf));var _0x3ec1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xec13[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x3ec1('0x0'));var rimraf=require(_0x3ec1('0x1'));var zipdir=require(_0x3ec1('0x2'));var jsonpatch=require(_0x3ec1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3ec1('0x4'));var Mustache=require(_0x3ec1('0x5'));var util=require(_0x3ec1('0x6'));var path=require(_0x3ec1('0x7'));var sox=require('sox');var csv=require(_0x3ec1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ec1('0x9'));var _=require(_0x3ec1('0xa'));var squel=require(_0x3ec1('0xb'));var crypto=require(_0x3ec1('0xc'));var jsforce=require(_0x3ec1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3ec1('0x8'));var querystring=require(_0x3ec1('0xe'));var Papa=require(_0x3ec1('0xf'));var Redis=require('ioredis');var authService=require(_0x3ec1('0x10'));var qs=require(_0x3ec1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ec1('0x12'));var logger=require(_0x3ec1('0x13'))('api');var utils=require(_0x3ec1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3ec1('0x15'));var db=require(_0x3ec1('0x16'))['db'];config[_0x3ec1('0x17')]=_[_0x3ec1('0x18')](config[_0x3ec1('0x17')],{'host':_0x3ec1('0x19'),'port':0x18eb});var socket=require(_0x3ec1('0x1a'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x3ec1('0x1b'));var client=jayson[_0x3ec1('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x3ec1('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dc7b0,_0x304c0a,_0x49e4b9,_0x2eb340){return new BPromise(function(_0x3cbc18,_0xf2cb7f){var _0x12a8b8=_0x2eb340||client;return _0x12a8b8['request'](_0x1dc7b0,_0x49e4b9)[_0x3ec1('0x1d')](function(_0x47d62d){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x304c0a,'request\x20sent');logger['debug'](_0x3ec1('0x1e'),_0x304c0a,_0x3ec1('0x1f'),JSON[_0x3ec1('0x20')](_0x47d62d));if(_0x47d62d[_0x3ec1('0x21')]){if(_0x47d62d[_0x3ec1('0x21')][_0x3ec1('0x22')]===0x1f4){logger[_0x3ec1('0x21')](_0x3ec1('0x23'),_0x304c0a,_0x47d62d[_0x3ec1('0x21')]['message']);return _0xf2cb7f(_0x47d62d[_0x3ec1('0x21')][_0x3ec1('0x24')]);}logger[_0x3ec1('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x304c0a,_0x47d62d[_0x3ec1('0x21')][_0x3ec1('0x24')]);return _0x3cbc18(_0x47d62d['error']['message']);}else{logger[_0x3ec1('0x25')](_0x3ec1('0x23'),_0x304c0a,_0x3ec1('0x1f'));_0x3cbc18(_0x47d62d[_0x3ec1('0x26')][_0x3ec1('0x24')]);}})[_0x3ec1('0x27')](function(_0x4b2a8d){logger['error'](_0x3ec1('0x23'),_0x304c0a,_0x4b2a8d);_0xf2cb7f(_0x4b2a8d);});});}function respondWithStatusCode(_0x3213c9,_0x578680){_0x578680=_0x578680||0xcc;return function(_0x5c1393){if(_0x5c1393){return _0x3213c9['sendStatus'](_0x578680);}return _0x3213c9[_0x3ec1('0x28')](_0x578680)[_0x3ec1('0x29')]();};}function respondWithResult(_0x556b4e,_0x3c3735){_0x3c3735=_0x3c3735||0xc8;return function(_0xe5ba0){if(_0xe5ba0){return _0x556b4e['status'](_0x3c3735)[_0x3ec1('0x2a')](_0xe5ba0);}};}function respondWithFilteredResult(_0x1b584c,_0x207f93){return function(_0x5cef51){if(_0x5cef51){var _0x2d9d3a=typeof _0x207f93['offset']===_0x3ec1('0x2b')&&typeof _0x207f93[_0x3ec1('0x2c')]===_0x3ec1('0x2b');var _0x411d05=_0x5cef51['count'];var _0x1fa2c8=_0x2d9d3a?0x0:_0x207f93['offset'];var _0x559614=_0x2d9d3a?_0x5cef51[_0x3ec1('0x2d')]:_0x207f93['offset']+_0x207f93['limit'];var _0x595f44;if(_0x559614>=_0x411d05){_0x559614=_0x411d05;_0x595f44=0xc8;}else{_0x595f44=0xce;}_0x1b584c[_0x3ec1('0x28')](_0x595f44);return _0x1b584c[_0x3ec1('0x2e')](_0x3ec1('0x2f'),_0x1fa2c8+'-'+_0x559614+'/'+_0x411d05)[_0x3ec1('0x2a')](_0x5cef51);}return null;};}function patchUpdates(_0x21a62e){return function(_0x3c7559){try{jsonpatch['apply'](_0x3c7559,_0x21a62e,!![]);}catch(_0x21dbe2){return BPromise[_0x3ec1('0x30')](_0x21dbe2);}return _0x3c7559[_0x3ec1('0x31')]();};}function saveUpdates(_0x233be7,_0x58a19f){return function(_0x4e17cb){if(_0x4e17cb){return _0x4e17cb[_0x3ec1('0x32')](_0x233be7)[_0x3ec1('0x1d')](function(_0xb8a1ec){return _0xb8a1ec;});}return null;};}function removeEntity(_0xe99ff1,_0x6ad893){return function(_0x208275){if(_0x208275){return _0x208275['destroy']()['then'](function(){var _0x51c673=_0x208275[_0x3ec1('0x33')]({'plain':!![]});var _0x5c3de6=_0x3ec1('0x34');return db[_0x3ec1('0x35')][_0x3ec1('0x36')]({'where':{'type':_0x5c3de6,'resourceId':_0x51c673['id']}})[_0x3ec1('0x1d')](function(){return _0x208275;});})[_0x3ec1('0x1d')](function(){_0xe99ff1[_0x3ec1('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x151133,_0xfa6d6e){return function(_0x4ff88b){if(!_0x4ff88b){_0x151133[_0x3ec1('0x37')](0x194);}return _0x4ff88b;};}function handleError(_0x5035f6,_0x5dc695){_0x5dc695=_0x5dc695||0x1f4;return function(_0x1bbd08){logger[_0x3ec1('0x21')](_0x1bbd08[_0x3ec1('0x38')]);if(_0x1bbd08[_0x3ec1('0x39')]){delete _0x1bbd08[_0x3ec1('0x39')];}_0x5035f6[_0x3ec1('0x28')](_0x5dc695)[_0x3ec1('0x3a')](_0x1bbd08);};}exports[_0x3ec1('0x3b')]=function(_0x21a936,_0x4bf855){var _0xd19e1f={'include':[{'model':db[_0x3ec1('0x3c')],'as':'mandatoryDispositionPause'}]},_0x268059={},_0x4fdf46={'count':0x0,'rows':[]};var _0x5a2896=_[_0x3ec1('0x3d')](db[_0x3ec1('0x3e')]['rawAttributes'],function(_0x3ce9b1){return{'name':_0x3ce9b1[_0x3ec1('0x3f')],'type':_0x3ce9b1['type'][_0x3ec1('0x40')]};});_0x268059['model']=_[_0x3ec1('0x3d')](_0x5a2896,_0x3ec1('0x39'));_0x268059[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x21a936['query']);_0x268059[_0x3ec1('0x43')]=_[_0x3ec1('0x44')](_0x268059[_0x3ec1('0x45')],_0x268059['query']);_0xd19e1f[_0x3ec1('0x46')]=_[_0x3ec1('0x44')](_0x268059[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0x21a936[_0x3ec1('0x41')]['fields']));_0xd19e1f[_0x3ec1('0x46')]=_0xd19e1f['attributes'][_0x3ec1('0x48')]?_0xd19e1f[_0x3ec1('0x46')]:_0x268059[_0x3ec1('0x45')];if(!_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x49')](_0x3ec1('0x4a'))){_0xd19e1f['limit']=qs[_0x3ec1('0x2c')](_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0xd19e1f[_0x3ec1('0x4b')]=qs['offset'](_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x4b')]);}_0xd19e1f[_0x3ec1('0x4c')]=qs['sort'](_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x4d')]);_0xd19e1f[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x21a936[_0x3ec1('0x41')],_0x268059[_0x3ec1('0x43')]),_0x5a2896);if(_0x21a936['query'][_0x3ec1('0x50')]){_0xd19e1f[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0xd19e1f[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0x5a2896,function(_0x17c73d){if(_0x17c73d['type']!=='VIRTUAL'){var _0x539751={};_0x539751[_0x17c73d[_0x3ec1('0x39')]]={'$like':'%'+_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x50')]+'%'};return _0x539751;}})});}_0xd19e1f=_[_0x3ec1('0x51')]({},_0xd19e1f,_0x21a936[_0x3ec1('0x52')]);var _0x4d8ec7={'where':_0xd19e1f[_0x3ec1('0x4e')]};return db[_0x3ec1('0x3e')][_0x3ec1('0x2d')](_0x4d8ec7)[_0x3ec1('0x1d')](function(_0x47ee31){_0x4fdf46[_0x3ec1('0x2d')]=_0x47ee31;if(_0x21a936[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0xd19e1f[_0x3ec1('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x3ec1('0x55')](_0xd19e1f);})['then'](function(_0x1fe868){_0x4fdf46[_0x3ec1('0x56')]=_0x1fe868;return _0x4fdf46;})[_0x3ec1('0x1d')](respondWithFilteredResult(_0x4bf855,_0xd19e1f))['catch'](handleError(_0x4bf855,null));};exports[_0x3ec1('0x57')]=function(_0x35851a,_0x46456c){var _0x4eba3d={'raw':![],'where':{'id':_0x35851a[_0x3ec1('0x58')]['id']},'include':[{'model':db[_0x3ec1('0x3c')],'as':_0x3ec1('0x59')}]},_0x6083f7={};_0x6083f7[_0x3ec1('0x45')]=_['keys'](db[_0x3ec1('0x3e')]['rawAttributes']);_0x6083f7['query']=_[_0x3ec1('0x42')](_0x35851a[_0x3ec1('0x41')]);_0x6083f7['filters']=_[_0x3ec1('0x44')](_0x6083f7[_0x3ec1('0x45')],_0x6083f7[_0x3ec1('0x41')]);_0x4eba3d['attributes']=_[_0x3ec1('0x44')](_0x6083f7[_0x3ec1('0x45')],qs['fields'](_0x35851a[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x4eba3d[_0x3ec1('0x46')]=_0x4eba3d[_0x3ec1('0x46')][_0x3ec1('0x48')]?_0x4eba3d[_0x3ec1('0x46')]:_0x6083f7[_0x3ec1('0x45')];if(_0x35851a[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0x4eba3d[_0x3ec1('0x54')]=[{'all':!![]}];}_0x4eba3d=_[_0x3ec1('0x51')]({},_0x4eba3d,_0x35851a[_0x3ec1('0x52')]);return db[_0x3ec1('0x3e')]['find'](_0x4eba3d)[_0x3ec1('0x1d')](handleEntityNotFound(_0x46456c,null))[_0x3ec1('0x1d')](respondWithResult(_0x46456c,null))[_0x3ec1('0x27')](handleError(_0x46456c,null));};exports[_0x3ec1('0x5a')]=function(_0x4e8f59,_0x335820){return db['OpenchannelAccount'][_0x3ec1('0x5a')](_0x4e8f59[_0x3ec1('0x5b')],{})[_0x3ec1('0x1d')](function(_0x33d131){var _0xd92f20=_0x4e8f59[_0x3ec1('0x5c')][_0x3ec1('0x33')]({'plain':!![]});if(!_0xd92f20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd92f20['role']===_0x3ec1('0x5c')){var _0x26aee1=_0x33d131[_0x3ec1('0x33')]({'plain':!![]});var _0xb522a3=_0x3ec1('0x34');return db[_0x3ec1('0x5d')][_0x3ec1('0x5e')]({'where':{'name':_0xb522a3,'userProfileId':_0xd92f20['userProfileId']},'raw':!![]})[_0x3ec1('0x1d')](function(_0xa62338){if(_0xa62338&&_0xa62338[_0x3ec1('0x5f')]===0x0){return db[_0x3ec1('0x35')]['create']({'name':_0x26aee1[_0x3ec1('0x39')],'resourceId':_0x26aee1['id'],'type':_0xa62338[_0x3ec1('0x39')],'sectionId':_0xa62338['id']},{})['then'](function(){return _0x33d131;});}else{return _0x33d131;}})[_0x3ec1('0x27')](function(_0x30505b){logger[_0x3ec1('0x21')](_0x3ec1('0x60'),_0x30505b);throw _0x30505b;});}return _0x33d131;})[_0x3ec1('0x1d')](respondWithResult(_0x335820,0xc9))[_0x3ec1('0x27')](handleError(_0x335820,null));};exports['update']=function(_0x5b4ecd,_0x1872be){if(_0x5b4ecd[_0x3ec1('0x5b')]['id']){delete _0x5b4ecd[_0x3ec1('0x5b')]['id'];}return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x5b4ecd[_0x3ec1('0x58')]['id']},'include':[{'model':db[_0x3ec1('0x3c')],'as':_0x3ec1('0x59')}]})['then'](handleEntityNotFound(_0x1872be,null))[_0x3ec1('0x1d')](saveUpdates(_0x5b4ecd['body'],null))[_0x3ec1('0x1d')](respondWithResult(_0x1872be,null))['catch'](handleError(_0x1872be,null));};exports[_0x3ec1('0x36')]=function(_0x43846b,_0x198f76){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x43846b[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x198f76,null))['then'](removeEntity(_0x198f76,null))[_0x3ec1('0x27')](handleError(_0x198f76,null));};exports[_0x3ec1('0x61')]=function(_0xf3a2c6,_0x315b43){return db[_0x3ec1('0x3e')]['describe']()[_0x3ec1('0x1d')](respondWithResult(_0x315b43,null))[_0x3ec1('0x27')](handleError(_0x315b43,null));};exports['addDisposition']=function(_0x575252,_0x81094,_0x437e2b){if(_0x575252[_0x3ec1('0x5b')]['id']){delete _0x575252[_0x3ec1('0x5b')]['id'];}return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x575252[_0x3ec1('0x58')]['id']}})['then'](handleEntityNotFound(_0x81094,null))[_0x3ec1('0x1d')](function(_0x1a0a93){if(_0x1a0a93){_0x575252[_0x3ec1('0x5b')][_0x3ec1('0x62')]=_0x1a0a93['id'];return db['Disposition'][_0x3ec1('0x5a')](_0x575252[_0x3ec1('0x5b')]);}})['then'](respondWithResult(_0x81094,null))[_0x3ec1('0x27')](handleError(_0x81094,null));};exports[_0x3ec1('0x63')]=function(_0x8509d0,_0x9a3f41,_0x25bc4b){var _0x4ba42a={'raw':![],'where':{}};var _0x51ca80={};var _0x2884ac={'count':0x0,'rows':[]};return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x8509d0[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x9a3f41,null))[_0x3ec1('0x1d')](function(_0x44f8bb){if(_0x44f8bb){_0x51ca80[_0x3ec1('0x45')]=_['keys'](db['Disposition'][_0x3ec1('0x65')]);_0x51ca80[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x8509d0['query']);_0x51ca80[_0x3ec1('0x43')]=_[_0x3ec1('0x44')](_0x51ca80[_0x3ec1('0x45')],_0x51ca80['query']);_0x4ba42a[_0x3ec1('0x46')]=_[_0x3ec1('0x44')](_0x51ca80[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x4ba42a['attributes']=_0x4ba42a[_0x3ec1('0x46')]['length']?_0x4ba42a[_0x3ec1('0x46')]:_0x51ca80[_0x3ec1('0x45')];if(!_0x8509d0[_0x3ec1('0x41')]['hasOwnProperty']('nolimit')){_0x4ba42a['limit']=qs[_0x3ec1('0x2c')](_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x4ba42a[_0x3ec1('0x4b')]=qs[_0x3ec1('0x4b')](_0x8509d0[_0x3ec1('0x41')]['offset']);}_0x4ba42a[_0x3ec1('0x4c')]=qs['sort'](_0x8509d0[_0x3ec1('0x41')]['sort']);_0x4ba42a[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x8509d0['query'],_0x51ca80['filters']));_0x4ba42a[_0x3ec1('0x4e')][_0x3ec1('0x62')]=_0x44f8bb['id'];if(_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x50')]){_0x4ba42a[_0x3ec1('0x4e')]=_['merge'](_0x4ba42a[_0x3ec1('0x4e')],{'$or':_['map'](_0x4ba42a['attributes'],function(_0xb24066){var _0x200f61={};_0x200f61[_0xb24066]={'$like':'%'+_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x50')]+'%'};return _0x200f61;})});}_0x4ba42a=_['merge']({},_0x4ba42a,_0x8509d0[_0x3ec1('0x52')]);return db[_0x3ec1('0x66')][_0x3ec1('0x2d')]({'where':_0x4ba42a[_0x3ec1('0x4e')]})[_0x3ec1('0x1d')](function(_0x5b36fc){_0x2884ac['count']=_0x5b36fc;if(_0x8509d0[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0x4ba42a[_0x3ec1('0x54')]=[{'all':!![]}];}return db[_0x3ec1('0x66')]['findAll'](_0x4ba42a);})['then'](function(_0x5c92f8){_0x2884ac[_0x3ec1('0x56')]=_0x5c92f8;return _0x2884ac;});}})['then'](respondWithFilteredResult(_0x9a3f41,_0x4ba42a))[_0x3ec1('0x27')](handleError(_0x9a3f41,null));};exports['removeDispositions']=function(_0x12c6dd,_0x141a97,_0x2e2896){return db['OpenchannelAccount']['find']({'where':{'id':_0x12c6dd[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x141a97,null))['then'](function(_0x4fea4b){if(_0x4fea4b){return _0x4fea4b[_0x3ec1('0x67')](_0x12c6dd['query'][_0x3ec1('0x68')]);}})[_0x3ec1('0x1d')](respondWithStatusCode(_0x141a97,null))[_0x3ec1('0x27')](handleError(_0x141a97,null));};exports['addAnswer']=function(_0xc37026,_0x176e3c,_0x24e674){if(_0xc37026['body']['id']){delete _0xc37026[_0x3ec1('0x5b')]['id'];}return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0xc37026[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x176e3c,null))['then'](function(_0x50bd67){if(_0x50bd67){_0xc37026[_0x3ec1('0x5b')]['OpenchannelAccountId']=_0x50bd67['id'];return db[_0x3ec1('0x69')][_0x3ec1('0x5a')](_0xc37026[_0x3ec1('0x5b')]);}})[_0x3ec1('0x1d')](respondWithResult(_0x176e3c,null))[_0x3ec1('0x27')](handleError(_0x176e3c,null));};exports['getAnswers']=function(_0x9c191c,_0x50a41e,_0x822a1){var _0x473fa9={'raw':![],'where':{}};var _0x5e98a2={};var _0x5687e2={'count':0x0,'rows':[]};return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x9c191c[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x50a41e,null))[_0x3ec1('0x1d')](function(_0x4146d1){if(_0x4146d1){_0x5e98a2[_0x3ec1('0x45')]=_[_0x3ec1('0x42')](db[_0x3ec1('0x69')]['rawAttributes']);_0x5e98a2[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x9c191c[_0x3ec1('0x41')]);_0x5e98a2['filters']=_[_0x3ec1('0x44')](_0x5e98a2[_0x3ec1('0x45')],_0x5e98a2[_0x3ec1('0x41')]);_0x473fa9['attributes']=_[_0x3ec1('0x44')](_0x5e98a2[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x473fa9[_0x3ec1('0x46')]=_0x473fa9['attributes'][_0x3ec1('0x48')]?_0x473fa9[_0x3ec1('0x46')]:_0x5e98a2['model'];if(!_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x49')](_0x3ec1('0x4a'))){_0x473fa9[_0x3ec1('0x2c')]=qs[_0x3ec1('0x2c')](_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x473fa9[_0x3ec1('0x4b')]=qs[_0x3ec1('0x4b')](_0x9c191c[_0x3ec1('0x41')]['offset']);}_0x473fa9[_0x3ec1('0x4c')]=qs[_0x3ec1('0x4d')](_0x9c191c[_0x3ec1('0x41')][_0x3ec1('0x4d')]);_0x473fa9[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x9c191c[_0x3ec1('0x41')],_0x5e98a2[_0x3ec1('0x43')]));_0x473fa9[_0x3ec1('0x4e')][_0x3ec1('0x62')]=_0x4146d1['id'];if(_0x9c191c['query'][_0x3ec1('0x50')]){_0x473fa9[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0x473fa9[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0x473fa9[_0x3ec1('0x46')],function(_0x493e93){var _0x435f88={};_0x435f88[_0x493e93]={'$like':'%'+_0x9c191c['query']['filter']+'%'};return _0x435f88;})});}_0x473fa9=_[_0x3ec1('0x51')]({},_0x473fa9,_0x9c191c[_0x3ec1('0x52')]);return db[_0x3ec1('0x69')]['count']({'where':_0x473fa9[_0x3ec1('0x4e')]})['then'](function(_0x1a3449){_0x5687e2[_0x3ec1('0x2d')]=_0x1a3449;if(_0x9c191c['query'][_0x3ec1('0x53')]){_0x473fa9['include']=[{'all':!![]}];}return db[_0x3ec1('0x69')]['findAll'](_0x473fa9);})[_0x3ec1('0x1d')](function(_0x36f28b){_0x5687e2[_0x3ec1('0x56')]=_0x36f28b;return _0x5687e2;});}})[_0x3ec1('0x1d')](respondWithFilteredResult(_0x50a41e,_0x473fa9))[_0x3ec1('0x27')](handleError(_0x50a41e,null));};exports[_0x3ec1('0x6a')]=function(_0x42c2b4,_0x105cdc,_0x473fd1){return db[_0x3ec1('0x3e')]['find']({'where':{'id':_0x42c2b4['params']['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x105cdc,null))[_0x3ec1('0x1d')](function(_0x2de3fe){if(_0x2de3fe){return _0x2de3fe['removeAnswers'](_0x42c2b4[_0x3ec1('0x41')][_0x3ec1('0x68')]);}})['then'](respondWithStatusCode(_0x105cdc,null))[_0x3ec1('0x27')](handleError(_0x105cdc,null));};exports[_0x3ec1('0x6b')]=function(_0x13c6ec,_0x3ab836,_0x4723fc){var _0x5152cf={'body':_0x13c6ec[_0x3ec1('0x5b')],'channel':'openchannel'};var _0x319450=[];var _0x1647eb=[];var _0x44a228={};var _0x28591f=![];return db[_0x3ec1('0x6c')]['describe']()[_0x3ec1('0x1d')](function(_0x39c878){if(!_0x39c878){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))](_0x3ec1('0x6f'));}_0x319450=_[_0x3ec1('0x70')](_[_0x3ec1('0x42')](_0x39c878),[_0x3ec1('0x71'),_0x3ec1('0x72')]);_0x1647eb=_[_0x3ec1('0x70')](_[_0x3ec1('0x42')](_0x39c878),[_0x3ec1('0x71'),'updatedAt',_0x3ec1('0x73'),_0x3ec1('0x74')]);if(_0x13c6ec['body']['id']){delete _0x13c6ec[_0x3ec1('0x5b')]['id'];}if(_[_0x3ec1('0x75')](_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x76')])){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))]('from\x20is\x20mandatory');}if(_[_0x3ec1('0x75')](_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x5b')])||_0x13c6ec[_0x3ec1('0x5b')]['body']===''){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))](_0x3ec1('0x77'));}if(_[_0x3ec1('0x75')](_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x78')])){throw new db[(_0x3ec1('0x6d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1647eb);}if(!_['includes'](_0x1647eb,_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x78')])){throw new db[(_0x3ec1('0x6d'))][(_0x3ec1('0x6e'))](_0x3ec1('0x79')+_0x1647eb);}_0x44a228[_0x13c6ec['body'][_0x3ec1('0x78')]]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x76')];})['then'](function(){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x13c6ec[_0x3ec1('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x3ec1('0x7a'),'include':[{'model':db[_0x3ec1('0x6c')],'as':'Contacts','where':_0x44a228,'limit':0x1,'order':[[_0x3ec1('0x72'),_0x3ec1('0x7b')]]}]},{'model':db['OpenchannelApplication'],'as':_0x3ec1('0x7c')}]});})[_0x3ec1('0x1d')](handleEntityNotFound(_0x3ab836,null))[_0x3ec1('0x1d')](function(_0x290080){if(_0x290080&&_0x290080[_0x3ec1('0x7a')]){_0x5152cf[_0x3ec1('0x7d')]=_0x290080;_0x5152cf['applications']=_0x290080[_0x3ec1('0x7c')];_0x5152cf['list']=_0x290080[_0x3ec1('0x7a')];_0x5152cf[_0x3ec1('0x7e')]=_[_0x3ec1('0x7f')](_0x5152cf[_0x3ec1('0x7e')],[_0x3ec1('0x80')],[_0x3ec1('0x81')]);if(_0x5152cf[_0x3ec1('0x7d')]['Applications']){delete _0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x7c')];}if(_0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x7a')]&&_0x5152cf['account']['List'][_0x3ec1('0x82')][_0x3ec1('0x48')]){return _0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x7a')][_0x3ec1('0x82')][0x0];}var _0x426cb4=_['defaults'](_0x13c6ec[_0x3ec1('0x5b')],{'firstName':_0x13c6ec['body'][_0x3ec1('0x76')],'ListId':_0x290080[_0x3ec1('0x74')]});_0x426cb4[_0x13c6ec['body'][_0x3ec1('0x78')]]=_0x13c6ec['body'][_0x3ec1('0x76')];return db[_0x3ec1('0x6c')][_0x3ec1('0x5a')](_0x426cb4,{'fields':_0x319450,'raw':!![]});}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x3ab836,null))[_0x3ec1('0x1d')](function(_0x5d1ebd){_0x5152cf[_0x3ec1('0x83')]=_0x5d1ebd;if(_0x5d1ebd){var _0x5d91b5={'ContactId':_0x5d1ebd['id'],'OpenchannelAccountId':_0x13c6ec[_0x3ec1('0x58')]['id'],'from':(_0x5d1ebd['firstName']||'')+'\x20'+(_0x5d1ebd['lastName']||'')};var _0x3f66a9={'OpenchannelAccountId':_0x13c6ec['params']['id'],'closed':![]};if(_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')]){_0x3f66a9[_0x3ec1('0x84')]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')];return db['OpenchannelInteraction'][_0x3ec1('0x5e')]({'where':_0x3f66a9})[_0x3ec1('0x1d')](function(_0x121aaf){if(_0x121aaf){return[_0x121aaf,![]];}_0x5d91b5['threadId']=_0x13c6ec[_0x3ec1('0x5b')]['threadId'];_0x5d91b5[_0x3ec1('0x85')]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x85')];return db[_0x3ec1('0x86')]['create'](_0x5d91b5)[_0x3ec1('0x1d')](function(_0x472591){return[_0x472591,!![]];});});}else{_0x3f66a9['threadId']=null;}_0x3f66a9[_0x3ec1('0x87')]=_0x5d1ebd['id'];return db[_0x3ec1('0x86')]['find']({'where':_0x3f66a9})['then'](function(_0x14d796){if(_0x14d796){return[_0x14d796,![]];}return db[_0x3ec1('0x86')][_0x3ec1('0x5a')](_0x5d91b5)[_0x3ec1('0x1d')](function(_0x397271){return[_0x397271,!![]];});});}})[_0x3ec1('0x88')](function(_0x447446,_0x1b3758){if(_0x447446){_0x28591f=_0x1b3758;if(!_0x1b3758){var _0x945213={'from':(_0x5152cf[_0x3ec1('0x83')]['firstName']||'')+'\x20'+(_0x5152cf[_0x3ec1('0x83')]['lastName']||'')};if(_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')]&&_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x89')]&&_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x84')]!=_0x13c6ec['body'][_0x3ec1('0x89')]){_0x945213[_0x3ec1('0x84')]=_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x89')];}return _0x447446[_0x3ec1('0x32')](_0x945213);}else{return _0x447446;}}})[_0x3ec1('0x1d')](function(_0x1736a5){_0x5152cf['interaction']=_0x1736a5[_0x3ec1('0x33')]({'plain':!![]});_0x5152cf['interaction'][_0x3ec1('0x8a')]=_0x28591f;if(_0x5152cf['interaction'][_0x3ec1('0x8a')]){if(_0x5152cf[_0x3ec1('0x7d')][_0x3ec1('0x8b')]){_0x5152cf['applications'][_0x3ec1('0x8c')]({'id':0x0,'priority':_0x5152cf[_0x3ec1('0x7e')][_0x3ec1('0x48')]+0x1,'app':_0x3ec1('0x8d'),'appdata':_0x3ec1('0x8e'),'interval':_0x3ec1('0x8f')});}}return db[_0x3ec1('0x90')]['create']({'body':_0x13c6ec['body'][_0x3ec1('0x5b')],'OpenchannelAccountId':_0x13c6ec[_0x3ec1('0x58')]['id'],'OpenchannelInteractionId':_0x1736a5['id'],'direction':'in','ContactId':_0x5152cf[_0x3ec1('0x83')]['id'],'AttachmentId':_0x13c6ec[_0x3ec1('0x5b')][_0x3ec1('0x91')]});})['then'](function(_0x4f2a17){_0x5152cf[_0x3ec1('0x24')]=_0x4f2a17;if(_0x5152cf[_0x3ec1('0x92')][_0x3ec1('0x93')]){return db[_0x3ec1('0x94')]['find']({'attributes':['id','name'],'where':{'id':_0x5152cf[_0x3ec1('0x92')][_0x3ec1('0x93')]}})['then'](function(_0x692abf){if(_0x692abf){_0x5152cf[_0x3ec1('0x7e')][_0x3ec1('0x95')]({'id':0x0,'priority':0x0,'app':_0x3ec1('0x96'),'appdata':_0x692abf[_0x3ec1('0x39')]+','+(_0x5152cf[_0x3ec1('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x5152cf[_0x3ec1('0x97')]=![];}return respondWithRpcPromise(_0x3ec1('0x98'),_0x3ec1('0x99'),_0x5152cf);});}return respondWithRpcPromise(_0x3ec1('0x98'),_0x3ec1('0x99'),_0x5152cf);})[_0x3ec1('0x1d')](function(_0x2e2119){respondWithRpcPromise(_0x3ec1('0x9a'),'EventManager',{'event':_0x3ec1('0x6b'),'message':_0x2e2119},client9002);return _0x2e2119;})[_0x3ec1('0x1d')](respondWithResult(_0x3ab836,null))['catch'](handleError(_0x3ab836,null));};exports[_0x3ec1('0x9b')]=function(_0x2b53fb,_0x2be3bd){var _0x4bbc80=_0x2b53fb['params']['id'];var _0x1106ff=_0x2b53fb[_0x3ec1('0x5b')];var _0x48d451=0xc8;var _0x3cf5ae=null;return db[_0x3ec1('0x9c')][_0x3ec1('0x9d')]({'isolationLevel':db[_0x3ec1('0x9c')][_0x3ec1('0x9e')][_0x3ec1('0x9f')][_0x3ec1('0xa0')]},function(_0x566327){return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x4bbc80},'transaction':_0x566327})[_0x3ec1('0x1d')](function(_0x5b150e){if(_0x5b150e){return db[_0x3ec1('0xa1')]['destroy']({'where':{'OpenchannelAccountId':_0x4bbc80},'transaction':_0x566327})['then'](function(){var _0xb8d3d6=_[_0x3ec1('0x3d')](_0x1106ff,function(_0x2b8e3a){_0x2b8e3a[_0x3ec1('0x62')]=_0x4bbc80;return _0x2b8e3a;});return db[_0x3ec1('0xa1')]['bulkCreate'](_0xb8d3d6,{'transaction':_0x566327});});}else{_0x48d451=0x194;_0x3cf5ae=[];}});})['then'](function(){if(_0x48d451!==0x194){return db[_0x3ec1('0xa1')][_0x3ec1('0xa2')]({'where':{'OpenchannelAccountId':_0x4bbc80},'order':_0x3ec1('0x80')})['then'](function(_0x455e3b){_0x3cf5ae=_0x455e3b;});}})[_0x3ec1('0x27')](function(_0x376d9c){_0x48d451=0x1f4;logger[_0x3ec1('0x21')](_0x376d9c[_0x3ec1('0x38')]);if(_0x376d9c[_0x3ec1('0x39')]){delete _0x376d9c[_0x3ec1('0x39')];}_0x3cf5ae=_0x376d9c;})[_0x3ec1('0xa3')](function(){if(_0x3cf5ae===null){_0x2be3bd[_0x3ec1('0x37')](_0x48d451);}else{if(_0x48d451===0x1f4){_0x2be3bd['status'](_0x48d451)[_0x3ec1('0x3a')](_0x3cf5ae);}else{_0x2be3bd[_0x3ec1('0x28')](_0x48d451)[_0x3ec1('0x2a')](_0x3cf5ae);}}});};exports[_0x3ec1('0xa4')]=function(_0x331008,_0x1ebb56,_0xf49b91){var _0xb71f47={};var _0x1993f5={};var _0x15bee4;var _0x1e0686;return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0x331008['params']['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x1ebb56,null))[_0x3ec1('0x1d')](function(_0x7e62d6){if(_0x7e62d6){_0x15bee4=_0x7e62d6;_0x1993f5[_0x3ec1('0x45')]=_[_0x3ec1('0x42')](db['OpenchannelApplication'][_0x3ec1('0x65')]);_0x1993f5[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0x331008[_0x3ec1('0x41')]);_0x1993f5[_0x3ec1('0x43')]=_['intersection'](_0x1993f5[_0x3ec1('0x45')],_0x1993f5['query']);_0xb71f47['attributes']=_[_0x3ec1('0x44')](_0x1993f5['model'],qs['fields'](_0x331008[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0xb71f47[_0x3ec1('0x46')]=_0xb71f47['attributes'][_0x3ec1('0x48')]?_0xb71f47['attributes']:_0x1993f5[_0x3ec1('0x45')];_0xb71f47[_0x3ec1('0x4c')]=qs[_0x3ec1('0x4d')](_0x331008[_0x3ec1('0x41')]['sort']);_0xb71f47[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_[_0x3ec1('0x4f')](_0x331008['query'],_0x1993f5[_0x3ec1('0x43')]));if(_0x331008[_0x3ec1('0x41')][_0x3ec1('0x50')]){_0xb71f47[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0xb71f47[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0xb71f47[_0x3ec1('0x46')],function(_0x1903fe){var _0x12cc36={};_0x12cc36[_0x1903fe]={'$like':'%'+_0x331008[_0x3ec1('0x41')][_0x3ec1('0x50')]+'%'};return _0x12cc36;})});}_0xb71f47=_[_0x3ec1('0x51')]({},_0xb71f47,_0x331008[_0x3ec1('0x52')]);return _0x15bee4[_0x3ec1('0xa4')](_0xb71f47);}})['then'](function(_0x1b1720){if(_0x1b1720){_0x1e0686=_0x1b1720[_0x3ec1('0x48')];if(!_0x331008['query'][_0x3ec1('0x49')]('nolimit')){_0xb71f47[_0x3ec1('0x2c')]=qs[_0x3ec1('0x2c')](_0x331008[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0xb71f47[_0x3ec1('0x4b')]=qs['offset'](_0x331008[_0x3ec1('0x41')][_0x3ec1('0x4b')]);}return _0x15bee4[_0x3ec1('0xa4')](_0xb71f47);}})[_0x3ec1('0x1d')](function(_0x4e4071){if(_0x4e4071){return _0x4e4071?{'count':_0x1e0686,'rows':_0x4e4071}:null;}})[_0x3ec1('0x1d')](respondWithResult(_0x1ebb56,null))[_0x3ec1('0x27')](handleError(_0x1ebb56,null));};exports['getInteractions']=function(_0x5018b7,_0x23888a,_0x29d76d){var _0x40d507={'raw':![],'where':{}};var _0x1eb34e={};var _0x3b15b0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3ec1('0x64')]({'where':{'id':_0x5018b7['params']['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x23888a,null))[_0x3ec1('0x1d')](function(_0x507b4d){if(_0x507b4d){_0x1eb34e[_0x3ec1('0x45')]=_[_0x3ec1('0x42')](db[_0x3ec1('0x86')][_0x3ec1('0x65')]);_0x1eb34e['query']=_['keys'](_0x5018b7[_0x3ec1('0x41')]);_0x1eb34e['filters']=_[_0x3ec1('0x44')](_0x1eb34e[_0x3ec1('0x45')],_0x1eb34e[_0x3ec1('0x41')]);_0x40d507[_0x3ec1('0x46')]=_[_0x3ec1('0x44')](_0x1eb34e['model'],qs[_0x3ec1('0x47')](_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x40d507[_0x3ec1('0x46')]=_0x40d507[_0x3ec1('0x46')][_0x3ec1('0x48')]?_0x40d507['attributes']:_0x1eb34e[_0x3ec1('0x45')];if(!_0x5018b7[_0x3ec1('0x41')]['hasOwnProperty'](_0x3ec1('0x4a'))){_0x40d507[_0x3ec1('0x2c')]=qs['limit'](_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x40d507[_0x3ec1('0x4b')]=qs['offset'](_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x4b')]);}_0x40d507[_0x3ec1('0x4c')]=qs[_0x3ec1('0x4d')](_0x5018b7['query'][_0x3ec1('0x4d')]);_0x40d507[_0x3ec1('0x4e')]=qs[_0x3ec1('0x43')](_['pick'](_0x5018b7[_0x3ec1('0x41')],_0x1eb34e[_0x3ec1('0x43')]));_0x40d507[_0x3ec1('0x4e')][_0x3ec1('0x62')]=_0x507b4d['id'];if(_0x5018b7[_0x3ec1('0x41')]['filter']){_0x40d507[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0x40d507['where'],{'$or':_[_0x3ec1('0x3d')](_0x40d507[_0x3ec1('0x46')],function(_0x1665c0){var _0x189afe={};_0x189afe[_0x1665c0]={'$like':'%'+_0x5018b7['query'][_0x3ec1('0x50')]+'%'};return _0x189afe;})});}_0x40d507=_[_0x3ec1('0x51')]({},_0x40d507,_0x5018b7[_0x3ec1('0x52')]);return db['OpenchannelInteraction']['count']({'where':_0x40d507[_0x3ec1('0x4e')]})[_0x3ec1('0x1d')](function(_0x219c80){_0x3b15b0['count']=_0x219c80;if(_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0x53')]){_0x40d507[_0x3ec1('0x54')]=[{'model':db[_0x3ec1('0x6c')],'as':_0x3ec1('0xa5'),'required':![]},{'model':db[_0x3ec1('0x94')],'as':_0x3ec1('0xa6'),'attributes':[_0x3ec1('0x39'),_0x3ec1('0xa7'),'internal'],'required':![]},{'model':db[_0x3ec1('0xa8')],'as':_0x3ec1('0xa9'),'attributes':['id',_0x3ec1('0x39'),_0x3ec1('0xaa')],'where':_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0xab')]?{'id':_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0xab')]}:undefined,'required':_0x5018b7[_0x3ec1('0x41')][_0x3ec1('0xab')]?!![]:![]}];}return db[_0x3ec1('0x86')]['findAll'](_0x40d507);})['then'](function(_0x5ac8d4){_0x3b15b0[_0x3ec1('0x56')]=_0x5ac8d4;return _0x3b15b0;});}})[_0x3ec1('0x1d')](respondWithFilteredResult(_0x23888a,_0x40d507))[_0x3ec1('0x27')](handleError(_0x23888a,null));};exports[_0x3ec1('0xac')]=function(_0x12c9e5,_0x1a64b0,_0x1f523d){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x12c9e5[_0x3ec1('0x58')]['id']}})['then'](handleEntityNotFound(_0x1a64b0,null))[_0x3ec1('0x1d')](function(_0xe9b538){if(_0xe9b538){return _0xe9b538[_0x3ec1('0xac')](_0x12c9e5['body'][_0x3ec1('0x68')],_[_0x3ec1('0xad')](_0x12c9e5['body'],[_0x3ec1('0x68'),'id'])||{})[_0x3ec1('0x88')](function(_0x278607){for(var _0xb00a5b=0x0;_0xb00a5b<_0x12c9e5[_0x3ec1('0x5b')][_0x3ec1('0x68')][_0x3ec1('0x48')];_0xb00a5b+=0x1){socket[_0x3ec1('0xae')]('userOpenchannelAccount:save',{'UserId':Number(_0x12c9e5[_0x3ec1('0x5b')][_0x3ec1('0x68')][_0xb00a5b]),'OpenchannelAccountId':Number(_0x12c9e5['params']['id'])});}return _0x278607;});}})[_0x3ec1('0x1d')](respondWithResult(_0x1a64b0,null))[_0x3ec1('0x27')](handleError(_0x1a64b0,null));};exports[_0x3ec1('0xaf')]=function(_0x564df2,_0x8c6f5b,_0xf0ffd){return db['OpenchannelAccount'][_0x3ec1('0x5e')]({'where':{'id':_0x564df2[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x8c6f5b,null))[_0x3ec1('0x1d')](function(_0x2a5728){if(_0x2a5728){return _0x2a5728[_0x3ec1('0xaf')](_0x564df2[_0x3ec1('0x41')][_0x3ec1('0x68')])[_0x3ec1('0x1d')](function(){if(_['isArray'](_0x564df2[_0x3ec1('0x41')][_0x3ec1('0x68')])){for(var _0x25e707=0x0;_0x25e707<_0x564df2[_0x3ec1('0x41')][_0x3ec1('0x68')][_0x3ec1('0x48')];_0x25e707+=0x1){socket[_0x3ec1('0xae')](_0x3ec1('0xb0'),{'UserId':Number(_0x564df2['query'][_0x3ec1('0x68')][_0x25e707]),'OpenchannelAccountId':Number(_0x564df2[_0x3ec1('0x58')]['id'])});}}else{socket[_0x3ec1('0xae')](_0x3ec1('0xb0'),{'UserId':Number(_0x564df2[_0x3ec1('0x41')]['ids']),'OpenchannelAccountId':Number(_0x564df2[_0x3ec1('0x58')]['id'])});}});}})[_0x3ec1('0x1d')](respondWithStatusCode(_0x8c6f5b,null))[_0x3ec1('0x27')](handleError(_0x8c6f5b,null));};exports['getAgents']=function(_0xbf60ab,_0x5e73b7,_0x169b39){var _0x4a18da={};var _0x506555={};var _0x111483;var _0x2dd3bc;return db[_0x3ec1('0x3e')][_0x3ec1('0x64')]({'where':{'id':_0xbf60ab[_0x3ec1('0x58')]['id']}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x5e73b7,null))[_0x3ec1('0x1d')](function(_0x1ed047){if(_0x1ed047){_0x111483=_0x1ed047;_0x506555[_0x3ec1('0x45')]=_['keys'](db['User'][_0x3ec1('0x65')]);_0x506555[_0x3ec1('0x41')]=_[_0x3ec1('0x42')](_0xbf60ab['query']);_0x506555['filters']=_['intersection'](_0x506555[_0x3ec1('0x45')],_0x506555[_0x3ec1('0x41')]);_0x4a18da['attributes']=_['intersection'](_0x506555[_0x3ec1('0x45')],qs[_0x3ec1('0x47')](_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x47')]));_0x4a18da[_0x3ec1('0x46')]=_0x4a18da[_0x3ec1('0x46')][_0x3ec1('0x48')]?_0x4a18da['attributes']:_0x506555[_0x3ec1('0x45')];_0x4a18da['order']=qs[_0x3ec1('0x4d')](_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x4d')]);_0x4a18da['where']=qs['filters'](_['pick'](_0xbf60ab[_0x3ec1('0x41')],_0x506555[_0x3ec1('0x43')]));if(_0xbf60ab['query'][_0x3ec1('0x50')]){_0x4a18da[_0x3ec1('0x4e')]=_[_0x3ec1('0x51')](_0x4a18da[_0x3ec1('0x4e')],{'$or':_[_0x3ec1('0x3d')](_0x4a18da[_0x3ec1('0x46')],function(_0x518214){var _0x283162={};_0x283162[_0x518214]={'$like':'%'+_0xbf60ab[_0x3ec1('0x41')]['filter']+'%'};return _0x283162;})});}_0x4a18da=_[_0x3ec1('0x51')]({},_0x4a18da,_0xbf60ab[_0x3ec1('0x52')]);return _0x111483['getAgents'](_0x4a18da);}})['then'](function(_0x47e3d9){if(_0x47e3d9){_0x2dd3bc=_0x47e3d9['length'];if(!_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x49')](_0x3ec1('0x4a'))){_0x4a18da['limit']=qs['limit'](_0xbf60ab[_0x3ec1('0x41')][_0x3ec1('0x2c')]);_0x4a18da[_0x3ec1('0x4b')]=qs['offset'](_0xbf60ab['query'][_0x3ec1('0x4b')]);}return _0x111483[_0x3ec1('0xb1')](_0x4a18da);}})[_0x3ec1('0x1d')](function(_0x3c7fd8){if(_0x3c7fd8){return _0x3c7fd8?{'count':_0x2dd3bc,'rows':_0x3c7fd8}:null;}})[_0x3ec1('0x1d')](respondWithResult(_0x5e73b7,null))[_0x3ec1('0x27')](handleError(_0x5e73b7,null));};exports['send']=function(_0x2d5703,_0x556995,_0x3e6c58){var _0x261a62,_0x7a1b3f,_0x55c9df;if(_[_0x3ec1('0x75')](_0x2d5703['body'][_0x3ec1('0x5b')])||_0x2d5703[_0x3ec1('0x5b')][_0x3ec1('0x5b')]===''){throw new db['Sequelize'][(_0x3ec1('0x6e'))](_0x3ec1('0x77'));}if(_[_0x3ec1('0x75')](_0x2d5703[_0x3ec1('0x5b')]['to'])){}_0x261a62=_0x2d5703[_0x3ec1('0x5b')]['to'];return db['OpenchannelAccount'][_0x3ec1('0x64')]({'where':{'id':_0x2d5703[_0x3ec1('0x58')]['id']}})['then'](handleEntityNotFound(_0x556995,null))['then'](function(_0x16de39){if(_0x16de39){return db[_0x3ec1('0x3e')][_0x3ec1('0x5e')]({'where':{'id':_0x16de39['id']},'include':[{'model':db[_0x3ec1('0xb2')],'as':_0x3ec1('0x7a'),'include':[{'model':db[_0x3ec1('0x6c')],'as':_0x3ec1('0x82'),'where':{[_0x16de39['mapKey']]:_0x261a62},'limit':0x1,'order':[[_0x3ec1('0x72'),_0x3ec1('0x7b')]]}]}]})[_0x3ec1('0x1d')](handleEntityNotFound(_0x556995,null))['then'](function(_0x14fe79){if(_0x14fe79&&_0x14fe79[_0x3ec1('0x7a')]){_0x7a1b3f=_0x14fe79[_0x3ec1('0x33')]({'plain':!![]});if(_0x7a1b3f[_0x3ec1('0x7a')]&&_0x7a1b3f[_0x3ec1('0x7a')][_0x3ec1('0x82')][_0x3ec1('0x48')]){return _0x7a1b3f[_0x3ec1('0x7a')][_0x3ec1('0x82')][0x0];}return db[_0x3ec1('0x6c')][_0x3ec1('0x5a')](_[_0x3ec1('0x18')](_0x2d5703[_0x3ec1('0x5b')],{'firstName':_0x261a62,[_0x14fe79['mapKey']]:_0x261a62,'phone':_0x261a62,'ListId':_0x7a1b3f[_0x3ec1('0x74')]}));}})[_0x3ec1('0x1d')](handleEntityNotFound(_0x556995,null))[_0x3ec1('0x1d')](function(_0x4538d2){if(_0x4538d2){_0x55c9df=_0x4538d2;return db[_0x3ec1('0x86')][_0x3ec1('0x5e')]({'where':{'ContactId':_0x55c9df['id'],'closed':![],'OpenchannelAccountId':_0x7a1b3f['id']}})[_0x3ec1('0x1d')](function(_0x13026a){if(_0x13026a){return[_0x13026a,![]];}return db['OpenchannelInteraction'][_0x3ec1('0x5a')]({'UserId':_0x2d5703[_0x3ec1('0x5c')]['id'],'ContactId':_0x55c9df['id'],'OpenchannelAccountId':_0x7a1b3f['id'],'lastMsgDirection':_0x3ec1('0xb3'),'Messages':[_[_0x3ec1('0x51')](_0x2d5703[_0x3ec1('0x5b')],{'read':![],'body':_0x2d5703[_0x3ec1('0x5b')][_0x3ec1('0x5b')],'OpenchannelAccountId':_0x7a1b3f['id'],'UserId':_0x2d5703[_0x3ec1('0x5c')]['id'],'ContactId':_0x55c9df['id']})]},{'include':[{'model':db[_0x3ec1('0x90')],'as':_0x3ec1('0xb4')}]})['then'](function(_0x11aae7){return[_0x11aae7,!![]];});});}})[_0x3ec1('0x88')](function(_0x2f81d5,_0xf35ac5){if(_0xf35ac5){return _0x2f81d5;}return db[_0x3ec1('0x90')][_0x3ec1('0x5a')](_['merge'](_0x2d5703[_0x3ec1('0x5b')],{'read':![],'body':_0x2d5703[_0x3ec1('0x5b')][_0x3ec1('0x5b')],'OpenchannelAccountId':_0x7a1b3f['id'],'OpenchannelInteractionId':_0x2f81d5['id'],'UserId':_0x2d5703[_0x3ec1('0x5c')]['id'],'ContactId':_0x55c9df['id']}))[_0x3ec1('0x1d')](function(_0x285df3){_0x2f81d5[_0x3ec1('0xb5')][_0x3ec1('0xb4')]=[];_0x2f81d5[_0x3ec1('0xb5')][_0x3ec1('0xb4')][_0x3ec1('0x8c')](_0x285df3['dataValues']);return _0x2f81d5;});});}})[_0x3ec1('0x1d')](respondWithResult(_0x556995,null))[_0x3ec1('0x27')](handleError(_0x556995,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a97d800..be02604 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 _0xdace=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0x40d339,_0xb726c3){var _0x5cbd0b=function(_0xf239d3){while(--_0xf239d3){_0x40d339['push'](_0x40d339['shift']());}};_0x5cbd0b(++_0xb726c3);}(_0xdace,0xc5));var _0xedac=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0xdace[_0x5756f8];return _0x3bb749;};'use strict';var EventEmitter=require(_0xedac('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xedac('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':'update','afterDestroy':_0xedac('0x4')};function emitEvent(_0x36bcd2){return function(_0x15d3bd,_0xefb142,_0x5a97c0){OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2+':'+_0x15d3bd['id'],_0x15d3bd);OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2,_0x15d3bd);_0x5a97c0(null);};}for(var e in events){if(events[_0xedac('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xedac('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x27acbf,_0xe7afec){var _0xf93fc8=function(_0x1a91f7){while(--_0x1a91f7){_0x27acbf['push'](_0x27acbf['shift']());}};_0xf93fc8(++_0xe7afec);}(_0x70e0,0x17b));var _0x070e=function(_0x5cb953,_0x3e1094){_0x5cb953=_0x5cb953-0x0;var _0x2b2d6e=_0x70e0[_0x5cb953];return _0x2b2d6e;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8e620d2..bae930d 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(_0x3b4bb9,_0x17698c){var _0xb59568=function(_0x1e6340){while(--_0x1e6340){_0x3b4bb9['push'](_0x3b4bb9['shift']());}};_0xb59568(++_0x17698c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x4248cb,_0x3d45c4){var _0x404232=function(_0x4f15bc){while(--_0x4f15bc){_0x4248cb['push'](_0x4248cb['shift']());}};_0x404232(++_0x3d45c4);}(_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 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 6e2cb4e..fe70ad3 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 _0x3495=['../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','redis','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18fcdc,_0x50716e){var _0x2a11cc=function(_0x169cad){while(--_0x169cad){_0x18fcdc['push'](_0x18fcdc['shift']());}};_0x2a11cc(++_0x50716e);}(_0x3495,0x1de));var _0x5349=function(_0x33bf37,_0x5b4429){_0x33bf37=_0x33bf37-0x0;var _0x308e70=_0x3495[_0x33bf37];return _0x308e70;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});config['redis']=_[_0x5349('0xc')](config['redis'],{'host':_0x5349('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5349('0xe')]));require(_0x5349('0xf'))[_0x5349('0x10')](socket);function respondWithRpcPromise(_0x23a1c7,_0x21bf91,_0x3a416e){return new BPromise(function(_0x35d425,_0x4bf160){return client[_0x5349('0x11')](_0x23a1c7,_0x3a416e)['then'](function(_0x2cbd83){logger[_0x5349('0x12')](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));logger[_0x5349('0x15')](_0x5349('0x16'),_0x21bf91,_0x5349('0x14'),JSON[_0x5349('0x17')](_0x2cbd83));if(_0x2cbd83[_0x5349('0x18')]){if(_0x2cbd83[_0x5349('0x18')]['code']===0x1f4){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x4bf160(_0x2cbd83[_0x5349('0x18')][_0x5349('0x19')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x35d425(_0x2cbd83['error'][_0x5349('0x19')]);}else{logger['info'](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));_0x35d425(_0x2cbd83[_0x5349('0x1a')][_0x5349('0x19')]);}})['catch'](function(_0x22d1ca){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x22d1ca);_0x4bf160(_0x22d1ca);});});} \ No newline at end of file +var _0x6f2f=['socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x1d5507,_0x48c4d9){var _0x144d50=function(_0x5d81e2){while(--_0x5d81e2){_0x1d5507['push'](_0x1d5507['shift']());}};_0x144d50(++_0x48c4d9);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x6f2f[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});config[_0xf6f2('0x7')]=_[_0xf6f2('0x8')](config[_0xf6f2('0x7')],{'host':_0xf6f2('0x9'),'port':0x18eb});var socket=require(_0xf6f2('0xa'))(new Redis(config[_0xf6f2('0x7')]));require(_0xf6f2('0xb'))[_0xf6f2('0xc')](socket);function respondWithRpcPromise(_0x17ffd2,_0x55a260,_0x109271){return new BPromise(function(_0x266c6e,_0x2a4325){return client[_0xf6f2('0xd')](_0x17ffd2,_0x109271)['then'](function(_0x4ca76a){logger['info'](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));logger[_0xf6f2('0x10')](_0xf6f2('0x11'),_0x55a260,_0xf6f2('0xf'),JSON[_0xf6f2('0x12')](_0x4ca76a));if(_0x4ca76a['error']){if(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x14')]===0x1f4){logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')]['message']);return _0x2a4325(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);return _0x266c6e(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}else{logger[_0xf6f2('0x16')](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));_0x266c6e(_0x4ca76a[_0xf6f2('0x17')][_0xf6f2('0x15')]);}})[_0xf6f2('0x18')](function(_0xb05611){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x55a260,_0xb05611);_0x2a4325(_0xb05611);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 17589d7..7b26760 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 _0x544a=['./openchannelAccount.events','save','remove','emit','openchannelAccount:'];(function(_0x5db76f,_0x24943d){var _0x20ac70=function(_0x3e5084){while(--_0x3e5084){_0x5db76f['push'](_0x5db76f['shift']());}};_0x20ac70(++_0x24943d);}(_0x544a,0x118));var _0xa544=function(_0x5e920a,_0x4e6f91){_0x5e920a=_0x5e920a-0x0;var _0x20050c=_0x544a[_0x5e920a];return _0x20050c;};'use strict';var OpenchannelAccountEvents=require(_0xa544('0x0'));var events=[_0xa544('0x1'),_0xa544('0x2'),'update'];function createListener(_0x56dbc4,_0x32a74a){return function(_0x456f1){_0x32a74a[_0xa544('0x3')](_0x56dbc4,_0x456f1);};}function removeListener(_0xf2d6a0,_0x4b4677){return function(){OpenchannelAccountEvents['removeListener'](_0xf2d6a0,_0x4b4677);};}exports['register']=function(_0x2cb8c5){for(var _0x3690ce=0x0,_0x9609d4=events['length'];_0x3690ce<_0x9609d4;_0x3690ce++){var _0x196f1e=events[_0x3690ce];var _0x13ce7a=createListener(_0xa544('0x4')+_0x196f1e,_0x2cb8c5);OpenchannelAccountEvents['on'](_0x196f1e,_0x13ce7a);}}; \ No newline at end of file +var _0xbe99=['./openchannelAccount.events','save','remove','update','removeListener','register','openchannelAccount:'];(function(_0x23a6a3,_0x1baca8){var _0x6df639=function(_0x2e783f){while(--_0x2e783f){_0x23a6a3['push'](_0x23a6a3['shift']());}};_0x6df639(++_0x1baca8);}(_0xbe99,0x196));var _0x9be9=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xbe99[_0x3f88bc];return _0x4df1c4;};'use strict';var OpenchannelAccountEvents=require(_0x9be9('0x0'));var events=[_0x9be9('0x1'),_0x9be9('0x2'),_0x9be9('0x3')];function createListener(_0x34fc81,_0x598d7e){return function(_0x3a0621){_0x598d7e['emit'](_0x34fc81,_0x3a0621);};}function removeListener(_0x3bc6d5,_0x3cfcaa){return function(){OpenchannelAccountEvents[_0x9be9('0x4')](_0x3bc6d5,_0x3cfcaa);};}exports[_0x9be9('0x5')]=function(_0x52da35){for(var _0x2134e7=0x0,_0x1eccd7=events['length'];_0x2134e7<_0x1eccd7;_0x2134e7++){var _0x49694d=events[_0x2134e7];var _0x7e0cd=createListener(_0x9be9('0x6')+_0x49694d,_0x52da35);OpenchannelAccountEvents['on'](_0x49694d,_0x7e0cd);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 11b889b..5b29381 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 _0x270d=['show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x57aa76,_0x24cbaf){var _0x4a9a52=function(_0x46d4c5){while(--_0x46d4c5){_0x57aa76['push'](_0x57aa76['shift']());}};_0x4a9a52(++_0x24cbaf);}(_0x270d,0x72));var _0xd270=function(_0x19d7a7,_0x1b3ef0){_0x19d7a7=_0x19d7a7-0x0;var _0x9ed94d=_0x270d[_0x19d7a7];return _0x9ed94d;};'use strict';var multer=require(_0xd270('0x0'));var util=require(_0xd270('0x1'));var path=require(_0xd270('0x2'));var timeout=require(_0xd270('0x3'));var express=require('express');var router=express[_0xd270('0x4')]();var fs_extra=require(_0xd270('0x5'));var auth=require(_0xd270('0x6'));var interaction=require(_0xd270('0x7'));var config=require(_0xd270('0x8'));var controller=require('./openchannelApplication.controller');router[_0xd270('0x9')]('/',auth['isAuthenticated'](),controller[_0xd270('0xa')]);router[_0xd270('0x9')]('/:id',auth[_0xd270('0xb')](),controller[_0xd270('0xc')]);router[_0xd270('0xd')]('/',auth[_0xd270('0xb')](),controller[_0xd270('0xe')]);router[_0xd270('0xf')]('/:id',auth[_0xd270('0xb')](),controller[_0xd270('0x10')]);router[_0xd270('0x11')](_0xd270('0x12'),auth['isAuthenticated'](),controller[_0xd270('0x13')]);module[_0xd270('0x14')]=router; \ No newline at end of file +var _0x5e0f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x5e0f,0xcd));var _0xf5e0=function(_0xe12571,_0x3d1192){_0xe12571=_0xe12571-0x0;var _0x5a4cb3=_0x5e0f[_0xe12571];return _0x5a4cb3;};'use strict';var multer=require(_0xf5e0('0x0'));var util=require(_0xf5e0('0x1'));var path=require('path');var timeout=require(_0xf5e0('0x2'));var express=require(_0xf5e0('0x3'));var router=express['Router']();var fs_extra=require(_0xf5e0('0x4'));var auth=require(_0xf5e0('0x5'));var interaction=require(_0xf5e0('0x6'));var config=require(_0xf5e0('0x7'));var controller=require(_0xf5e0('0x8'));router[_0xf5e0('0x9')]('/',auth['isAuthenticated'](),controller[_0xf5e0('0xa')]);router[_0xf5e0('0x9')](_0xf5e0('0xb'),auth[_0xf5e0('0xc')](),controller['show']);router['post']('/',auth[_0xf5e0('0xc')](),controller['create']);router['put'](_0xf5e0('0xb'),auth[_0xf5e0('0xc')](),controller['update']);router['delete'](_0xf5e0('0xb'),auth['isAuthenticated'](),controller[_0xf5e0('0xd')]);module[_0xf5e0('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 20d2013..1c79c22 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 _0x7d9c=['sequelize','TEXT','STRING','*,*,*,*'];(function(_0x5084a5,_0x3d3f05){var _0x29cfd6=function(_0x54e26a){while(--_0x54e26a){_0x5084a5['push'](_0x5084a5['shift']());}};_0x29cfd6(++_0x3d3f05);}(_0x7d9c,0x13c));var _0xc7d9=function(_0xe775fd,_0x59124a){_0xe775fd=_0xe775fd-0x0;var _0x4d118f=_0x7d9c[_0xe775fd];return _0x4d118f;};'use strict';var Sequelize=require(_0xc7d9('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc7d9('0x1')]()},'description':{'type':Sequelize[_0xc7d9('0x2')]},'interval':{'type':Sequelize[_0xc7d9('0x2')],'defaultValue':_0xc7d9('0x3')}}; \ No newline at end of file +var _0x953e=['TEXT','sequelize','STRING','noop'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x953e,0x1b5));var _0xe953=function(_0x4b36b8,_0x4231c3){_0x4b36b8=_0x4b36b8-0x0;var _0x53ef78=_0x953e[_0x4b36b8];return _0x53ef78;};'use strict';var Sequelize=require(_0xe953('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe953('0x1')],'allowNull':![],'defaultValue':_0xe953('0x2')},'appdata':{'type':Sequelize[_0xe953('0x3')]()},'description':{'type':Sequelize[_0xe953('0x1')]},'interval':{'type':Sequelize[_0xe953('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index be874b3..4069cbe 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 _0xbccd=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xbccd,0x137));var _0xdbcc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbccd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdbcc('0x0'));var rimraf=require(_0xdbcc('0x1'));var zipdir=require(_0xdbcc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbcc('0x3'));var moment=require(_0xdbcc('0x4'));var BPromise=require(_0xdbcc('0x5'));var Mustache=require(_0xdbcc('0x6'));var util=require(_0xdbcc('0x7'));var path=require(_0xdbcc('0x8'));var sox=require('sox');var csv=require(_0xdbcc('0x9'));var ejs=require(_0xdbcc('0xa'));var fs=require('fs');var fs_extra=require(_0xdbcc('0xb'));var _=require(_0xdbcc('0xc'));var squel=require(_0xdbcc('0xd'));var crypto=require(_0xdbcc('0xe'));var jsforce=require(_0xdbcc('0xf'));var deskjs=require(_0xdbcc('0x10'));var toCsv=require(_0xdbcc('0x9'));var querystring=require(_0xdbcc('0x11'));var Papa=require('papaparse');var Redis=require(_0xdbcc('0x12'));var authService=require(_0xdbcc('0x13'));var qs=require(_0xdbcc('0x14'));var as=require(_0xdbcc('0x15'));var hardwareService=require(_0xdbcc('0x16'));var logger=require('../../config/logger')(_0xdbcc('0x17'));var utils=require(_0xdbcc('0x18'));var config=require(_0xdbcc('0x19'));var licenseUtil=require(_0xdbcc('0x1a'));var db=require(_0xdbcc('0x1b'))['db'];function respondWithStatusCode(_0x3d6d62,_0x13770d){_0x13770d=_0x13770d||0xcc;return function(_0x293f0b){if(_0x293f0b){return _0x3d6d62['sendStatus'](_0x13770d);}return _0x3d6d62[_0xdbcc('0x1c')](_0x13770d)[_0xdbcc('0x1d')]();};}function respondWithResult(_0x2c4b52,_0x3187b0){_0x3187b0=_0x3187b0||0xc8;return function(_0x337221){if(_0x337221){return _0x2c4b52['status'](_0x3187b0)[_0xdbcc('0x1e')](_0x337221);}};}function respondWithFilteredResult(_0x1917df,_0x32f710){return function(_0x3146cb){if(_0x3146cb){var _0xe8722c=typeof _0x32f710[_0xdbcc('0x1f')]===_0xdbcc('0x20')&&typeof _0x32f710[_0xdbcc('0x21')]==='undefined';var _0x12be9e=_0x3146cb[_0xdbcc('0x22')];var _0x4adef6=_0xe8722c?0x0:_0x32f710[_0xdbcc('0x1f')];var _0x3bb74b=_0xe8722c?_0x3146cb['count']:_0x32f710[_0xdbcc('0x1f')]+_0x32f710[_0xdbcc('0x21')];var _0x5c4212;if(_0x3bb74b>=_0x12be9e){_0x3bb74b=_0x12be9e;_0x5c4212=0xc8;}else{_0x5c4212=0xce;}_0x1917df[_0xdbcc('0x1c')](_0x5c4212);return _0x1917df[_0xdbcc('0x23')](_0xdbcc('0x24'),_0x4adef6+'-'+_0x3bb74b+'/'+_0x12be9e)[_0xdbcc('0x1e')](_0x3146cb);}return null;};}function patchUpdates(_0x2984cb){return function(_0x56aec9){try{jsonpatch[_0xdbcc('0x25')](_0x56aec9,_0x2984cb,!![]);}catch(_0x501549){return BPromise[_0xdbcc('0x26')](_0x501549);}return _0x56aec9[_0xdbcc('0x27')]();};}function saveUpdates(_0x4d2d88,_0x49ca6f){return function(_0x3b439d){if(_0x3b439d){return _0x3b439d['update'](_0x4d2d88)[_0xdbcc('0x28')](function(_0x44563e){return _0x44563e;});}return null;};}function removeEntity(_0xd7aec3,_0xbf75ca){return function(_0x44aa47){if(_0x44aa47){return _0x44aa47[_0xdbcc('0x29')]()[_0xdbcc('0x28')](function(){_0xd7aec3[_0xdbcc('0x1c')](0xcc)[_0xdbcc('0x1d')]();});}};}function handleEntityNotFound(_0x21355b,_0x1cd2c2){return function(_0x512446){if(!_0x512446){_0x21355b[_0xdbcc('0x2a')](0x194);}return _0x512446;};}function handleError(_0x325177,_0x562787){_0x562787=_0x562787||0x1f4;return function(_0x5856bd){logger[_0xdbcc('0x2b')](_0x5856bd[_0xdbcc('0x2c')]);if(_0x5856bd['name']){delete _0x5856bd['name'];}_0x325177[_0xdbcc('0x1c')](_0x562787)[_0xdbcc('0x2d')](_0x5856bd);};}exports[_0xdbcc('0x2e')]=function(_0x9048dc,_0x464027){var _0x157d8e={},_0x202b59={},_0xc86a3c={'count':0x0,'rows':[]};var _0x26e815=_[_0xdbcc('0x2f')](db[_0xdbcc('0x30')][_0xdbcc('0x31')],function(_0x50a5b0){return{'name':_0x50a5b0['fieldName'],'type':_0x50a5b0[_0xdbcc('0x32')][_0xdbcc('0x33')]};});_0x202b59[_0xdbcc('0x34')]=_[_0xdbcc('0x2f')](_0x26e815,_0xdbcc('0x35'));_0x202b59['query']=_['keys'](_0x9048dc['query']);_0x202b59[_0xdbcc('0x36')]=_[_0xdbcc('0x37')](_0x202b59[_0xdbcc('0x34')],_0x202b59[_0xdbcc('0x38')]);_0x157d8e[_0xdbcc('0x39')]=_[_0xdbcc('0x37')](_0x202b59[_0xdbcc('0x34')],qs[_0xdbcc('0x3a')](_0x9048dc[_0xdbcc('0x38')][_0xdbcc('0x3a')]));_0x157d8e[_0xdbcc('0x39')]=_0x157d8e[_0xdbcc('0x39')][_0xdbcc('0x3b')]?_0x157d8e[_0xdbcc('0x39')]:_0x202b59[_0xdbcc('0x34')];if(!_0x9048dc[_0xdbcc('0x38')][_0xdbcc('0x3c')](_0xdbcc('0x3d'))){_0x157d8e['limit']=qs[_0xdbcc('0x21')](_0x9048dc[_0xdbcc('0x38')]['limit']);_0x157d8e[_0xdbcc('0x1f')]=qs[_0xdbcc('0x1f')](_0x9048dc[_0xdbcc('0x38')][_0xdbcc('0x1f')]);}_0x157d8e[_0xdbcc('0x3e')]=qs['sort'](_0x9048dc['query'][_0xdbcc('0x3f')]);_0x157d8e[_0xdbcc('0x40')]=qs[_0xdbcc('0x36')](_[_0xdbcc('0x41')](_0x9048dc[_0xdbcc('0x38')],_0x202b59[_0xdbcc('0x36')]),_0x26e815);if(_0x9048dc[_0xdbcc('0x38')]['filter']){_0x157d8e[_0xdbcc('0x40')]=_[_0xdbcc('0x42')](_0x157d8e[_0xdbcc('0x40')],{'$or':_[_0xdbcc('0x2f')](_0x26e815,function(_0x17602a){if(_0x17602a[_0xdbcc('0x32')]!=='VIRTUAL'){var _0x1edfd9={};_0x1edfd9[_0x17602a[_0xdbcc('0x35')]]={'$like':'%'+_0x9048dc['query'][_0xdbcc('0x43')]+'%'};return _0x1edfd9;}})});}_0x157d8e=_[_0xdbcc('0x42')]({},_0x157d8e,_0x9048dc[_0xdbcc('0x44')]);var _0x20aa48={'where':_0x157d8e[_0xdbcc('0x40')]};return db[_0xdbcc('0x30')][_0xdbcc('0x22')](_0x20aa48)[_0xdbcc('0x28')](function(_0x3d7e33){_0xc86a3c[_0xdbcc('0x22')]=_0x3d7e33;if(_0x9048dc[_0xdbcc('0x38')][_0xdbcc('0x45')]){_0x157d8e[_0xdbcc('0x46')]=[{'all':!![]}];}return db[_0xdbcc('0x30')][_0xdbcc('0x47')](_0x157d8e);})['then'](function(_0x5b6662){_0xc86a3c[_0xdbcc('0x48')]=_0x5b6662;return _0xc86a3c;})[_0xdbcc('0x28')](respondWithFilteredResult(_0x464027,_0x157d8e))[_0xdbcc('0x49')](handleError(_0x464027,null));};exports[_0xdbcc('0x4a')]=function(_0x2687bf,_0x53b32a){var _0x4df5a9={'raw':!![],'where':{'id':_0x2687bf[_0xdbcc('0x4b')]['id']}},_0x1467be={};_0x1467be[_0xdbcc('0x34')]=_[_0xdbcc('0x4c')](db[_0xdbcc('0x30')][_0xdbcc('0x31')]);_0x1467be[_0xdbcc('0x38')]=_[_0xdbcc('0x4c')](_0x2687bf[_0xdbcc('0x38')]);_0x1467be[_0xdbcc('0x36')]=_[_0xdbcc('0x37')](_0x1467be[_0xdbcc('0x34')],_0x1467be[_0xdbcc('0x38')]);_0x4df5a9[_0xdbcc('0x39')]=_['intersection'](_0x1467be[_0xdbcc('0x34')],qs[_0xdbcc('0x3a')](_0x2687bf['query'][_0xdbcc('0x3a')]));_0x4df5a9[_0xdbcc('0x39')]=_0x4df5a9[_0xdbcc('0x39')][_0xdbcc('0x3b')]?_0x4df5a9[_0xdbcc('0x39')]:_0x1467be[_0xdbcc('0x34')];if(_0x2687bf['query'][_0xdbcc('0x45')]){_0x4df5a9[_0xdbcc('0x46')]=[{'all':!![]}];}_0x4df5a9=_[_0xdbcc('0x42')]({},_0x4df5a9,_0x2687bf[_0xdbcc('0x44')]);return db[_0xdbcc('0x30')][_0xdbcc('0x4d')](_0x4df5a9)[_0xdbcc('0x28')](handleEntityNotFound(_0x53b32a,null))[_0xdbcc('0x28')](respondWithResult(_0x53b32a,null))['catch'](handleError(_0x53b32a,null));};exports[_0xdbcc('0x4e')]=function(_0x17b361,_0xcf622b){return db[_0xdbcc('0x30')][_0xdbcc('0x4e')](_0x17b361['body'],{})[_0xdbcc('0x28')](respondWithResult(_0xcf622b,0xc9))['catch'](handleError(_0xcf622b,null));};exports[_0xdbcc('0x4f')]=function(_0xdfdd07,_0x34960b){if(_0xdfdd07['body']['id']){delete _0xdfdd07[_0xdbcc('0x50')]['id'];}return db[_0xdbcc('0x30')]['find']({'where':{'id':_0xdfdd07[_0xdbcc('0x4b')]['id']}})[_0xdbcc('0x28')](handleEntityNotFound(_0x34960b,null))['then'](saveUpdates(_0xdfdd07[_0xdbcc('0x50')],null))[_0xdbcc('0x28')](respondWithResult(_0x34960b,null))['catch'](handleError(_0x34960b,null));};exports['destroy']=function(_0x59dd99,_0x4589da){return db[_0xdbcc('0x30')][_0xdbcc('0x4d')]({'where':{'id':_0x59dd99['params']['id']}})[_0xdbcc('0x28')](handleEntityNotFound(_0x4589da,null))['then'](removeEntity(_0x4589da,null))[_0xdbcc('0x49')](handleError(_0x4589da,null));}; \ No newline at end of file +var _0xaa4e=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x80f5e7,_0x4a63bd){var _0xbcbe0e=function(_0x3658a6){while(--_0x3658a6){_0x80f5e7['push'](_0x80f5e7['shift']());}};_0xbcbe0e(++_0x4a63bd);}(_0xaa4e,0xcc));var _0xeaa4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaa4e[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xeaa4('0x0'));var rimraf=require(_0xeaa4('0x1'));var zipdir=require(_0xeaa4('0x2'));var jsonpatch=require(_0xeaa4('0x3'));var rp=require(_0xeaa4('0x4'));var moment=require(_0xeaa4('0x5'));var BPromise=require(_0xeaa4('0x6'));var Mustache=require('mustache');var util=require(_0xeaa4('0x7'));var path=require(_0xeaa4('0x8'));var sox=require(_0xeaa4('0x9'));var csv=require(_0xeaa4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeaa4('0xb'));var _=require(_0xeaa4('0xc'));var squel=require(_0xeaa4('0xd'));var crypto=require(_0xeaa4('0xe'));var jsforce=require(_0xeaa4('0xf'));var deskjs=require(_0xeaa4('0x10'));var toCsv=require(_0xeaa4('0xa'));var querystring=require(_0xeaa4('0x11'));var Papa=require(_0xeaa4('0x12'));var Redis=require(_0xeaa4('0x13'));var authService=require(_0xeaa4('0x14'));var qs=require(_0xeaa4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeaa4('0x16'));var logger=require(_0xeaa4('0x17'))(_0xeaa4('0x18'));var utils=require('../../config/utils');var config=require(_0xeaa4('0x19'));var licenseUtil=require(_0xeaa4('0x1a'));var db=require(_0xeaa4('0x1b'))['db'];function respondWithStatusCode(_0x1f9dfb,_0x1c04eb){_0x1c04eb=_0x1c04eb||0xcc;return function(_0x28a8e3){if(_0x28a8e3){return _0x1f9dfb[_0xeaa4('0x1c')](_0x1c04eb);}return _0x1f9dfb[_0xeaa4('0x1d')](_0x1c04eb)[_0xeaa4('0x1e')]();};}function respondWithResult(_0x245de5,_0x49bd40){_0x49bd40=_0x49bd40||0xc8;return function(_0xe473a7){if(_0xe473a7){return _0x245de5[_0xeaa4('0x1d')](_0x49bd40)[_0xeaa4('0x1f')](_0xe473a7);}};}function respondWithFilteredResult(_0x3e991e,_0x4df5e2){return function(_0x47d83a){if(_0x47d83a){var _0x3a3611=typeof _0x4df5e2[_0xeaa4('0x20')]===_0xeaa4('0x21')&&typeof _0x4df5e2[_0xeaa4('0x22')]===_0xeaa4('0x21');var _0xc803bd=_0x47d83a['count'];var _0x11fe01=_0x3a3611?0x0:_0x4df5e2[_0xeaa4('0x20')];var _0x16597b=_0x3a3611?_0x47d83a['count']:_0x4df5e2['offset']+_0x4df5e2[_0xeaa4('0x22')];var _0x280356;if(_0x16597b>=_0xc803bd){_0x16597b=_0xc803bd;_0x280356=0xc8;}else{_0x280356=0xce;}_0x3e991e[_0xeaa4('0x1d')](_0x280356);return _0x3e991e[_0xeaa4('0x23')](_0xeaa4('0x24'),_0x11fe01+'-'+_0x16597b+'/'+_0xc803bd)['json'](_0x47d83a);}return null;};}function patchUpdates(_0x2c7acb){return function(_0x1383de){try{jsonpatch[_0xeaa4('0x25')](_0x1383de,_0x2c7acb,!![]);}catch(_0x577b3a){return BPromise['reject'](_0x577b3a);}return _0x1383de['save']();};}function saveUpdates(_0x296c4a,_0x314f8f){return function(_0x2d6dbe){if(_0x2d6dbe){return _0x2d6dbe['update'](_0x296c4a)[_0xeaa4('0x26')](function(_0x3a6f92){return _0x3a6f92;});}return null;};}function removeEntity(_0xf9138a,_0x43cba5){return function(_0x59d145){if(_0x59d145){return _0x59d145[_0xeaa4('0x27')]()['then'](function(){_0xf9138a[_0xeaa4('0x1d')](0xcc)[_0xeaa4('0x1e')]();});}};}function handleEntityNotFound(_0x53fe00,_0x5a1d1d){return function(_0x8d4e40){if(!_0x8d4e40){_0x53fe00[_0xeaa4('0x1c')](0x194);}return _0x8d4e40;};}function handleError(_0x4102f2,_0x53ee2e){_0x53ee2e=_0x53ee2e||0x1f4;return function(_0x170940){logger[_0xeaa4('0x28')](_0x170940[_0xeaa4('0x29')]);if(_0x170940['name']){delete _0x170940[_0xeaa4('0x2a')];}_0x4102f2[_0xeaa4('0x1d')](_0x53ee2e)[_0xeaa4('0x2b')](_0x170940);};}exports[_0xeaa4('0x2c')]=function(_0x111646,_0x37f73c){var _0x21490c={},_0x36fe54={},_0x242f95={'count':0x0,'rows':[]};var _0x14c807=_['map'](db[_0xeaa4('0x2d')][_0xeaa4('0x2e')],function(_0xd8ec59){return{'name':_0xd8ec59['fieldName'],'type':_0xd8ec59[_0xeaa4('0x2f')][_0xeaa4('0x30')]};});_0x36fe54[_0xeaa4('0x31')]=_['map'](_0x14c807,_0xeaa4('0x2a'));_0x36fe54[_0xeaa4('0x32')]=_[_0xeaa4('0x33')](_0x111646[_0xeaa4('0x32')]);_0x36fe54[_0xeaa4('0x34')]=_[_0xeaa4('0x35')](_0x36fe54[_0xeaa4('0x31')],_0x36fe54[_0xeaa4('0x32')]);_0x21490c['attributes']=_[_0xeaa4('0x35')](_0x36fe54[_0xeaa4('0x31')],qs[_0xeaa4('0x36')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x36')]));_0x21490c[_0xeaa4('0x37')]=_0x21490c[_0xeaa4('0x37')][_0xeaa4('0x38')]?_0x21490c['attributes']:_0x36fe54[_0xeaa4('0x31')];if(!_0x111646[_0xeaa4('0x32')]['hasOwnProperty'](_0xeaa4('0x39'))){_0x21490c[_0xeaa4('0x22')]=qs[_0xeaa4('0x22')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x22')]);_0x21490c[_0xeaa4('0x20')]=qs[_0xeaa4('0x20')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x20')]);}_0x21490c['order']=qs[_0xeaa4('0x3a')](_0x111646[_0xeaa4('0x32')][_0xeaa4('0x3a')]);_0x21490c[_0xeaa4('0x3b')]=qs['filters'](_[_0xeaa4('0x3c')](_0x111646[_0xeaa4('0x32')],_0x36fe54[_0xeaa4('0x34')]),_0x14c807);if(_0x111646[_0xeaa4('0x32')][_0xeaa4('0x3d')]){_0x21490c[_0xeaa4('0x3b')]=_[_0xeaa4('0x3e')](_0x21490c[_0xeaa4('0x3b')],{'$or':_[_0xeaa4('0x3f')](_0x14c807,function(_0x22e750){if(_0x22e750[_0xeaa4('0x2f')]!==_0xeaa4('0x40')){var _0x5e2c3f={};_0x5e2c3f[_0x22e750[_0xeaa4('0x2a')]]={'$like':'%'+_0x111646[_0xeaa4('0x32')]['filter']+'%'};return _0x5e2c3f;}})});}_0x21490c=_[_0xeaa4('0x3e')]({},_0x21490c,_0x111646[_0xeaa4('0x41')]);var _0x5c1f63={'where':_0x21490c[_0xeaa4('0x3b')]};return db[_0xeaa4('0x2d')][_0xeaa4('0x42')](_0x5c1f63)[_0xeaa4('0x26')](function(_0x7d026e){_0x242f95[_0xeaa4('0x42')]=_0x7d026e;if(_0x111646['query'][_0xeaa4('0x43')]){_0x21490c['include']=[{'all':!![]}];}return db[_0xeaa4('0x2d')][_0xeaa4('0x44')](_0x21490c);})[_0xeaa4('0x26')](function(_0x57fce7){_0x242f95['rows']=_0x57fce7;return _0x242f95;})[_0xeaa4('0x26')](respondWithFilteredResult(_0x37f73c,_0x21490c))[_0xeaa4('0x45')](handleError(_0x37f73c,null));};exports[_0xeaa4('0x46')]=function(_0x1692db,_0x1c1b3f){var _0x4c81d4={'raw':!![],'where':{'id':_0x1692db[_0xeaa4('0x47')]['id']}},_0x3f3451={};_0x3f3451[_0xeaa4('0x31')]=_[_0xeaa4('0x33')](db[_0xeaa4('0x2d')][_0xeaa4('0x2e')]);_0x3f3451[_0xeaa4('0x32')]=_[_0xeaa4('0x33')](_0x1692db['query']);_0x3f3451[_0xeaa4('0x34')]=_[_0xeaa4('0x35')](_0x3f3451[_0xeaa4('0x31')],_0x3f3451['query']);_0x4c81d4[_0xeaa4('0x37')]=_[_0xeaa4('0x35')](_0x3f3451[_0xeaa4('0x31')],qs['fields'](_0x1692db['query'][_0xeaa4('0x36')]));_0x4c81d4[_0xeaa4('0x37')]=_0x4c81d4[_0xeaa4('0x37')][_0xeaa4('0x38')]?_0x4c81d4[_0xeaa4('0x37')]:_0x3f3451['model'];if(_0x1692db[_0xeaa4('0x32')][_0xeaa4('0x43')]){_0x4c81d4[_0xeaa4('0x48')]=[{'all':!![]}];}_0x4c81d4=_['merge']({},_0x4c81d4,_0x1692db['options']);return db[_0xeaa4('0x2d')][_0xeaa4('0x49')](_0x4c81d4)[_0xeaa4('0x26')](handleEntityNotFound(_0x1c1b3f,null))[_0xeaa4('0x26')](respondWithResult(_0x1c1b3f,null))[_0xeaa4('0x45')](handleError(_0x1c1b3f,null));};exports[_0xeaa4('0x4a')]=function(_0x3e4264,_0x233a24){return db[_0xeaa4('0x2d')]['create'](_0x3e4264[_0xeaa4('0x4b')],{})[_0xeaa4('0x26')](respondWithResult(_0x233a24,0xc9))[_0xeaa4('0x45')](handleError(_0x233a24,null));};exports['update']=function(_0x5b7e6d,_0x411f9d){if(_0x5b7e6d[_0xeaa4('0x4b')]['id']){delete _0x5b7e6d[_0xeaa4('0x4b')]['id'];}return db[_0xeaa4('0x2d')][_0xeaa4('0x49')]({'where':{'id':_0x5b7e6d[_0xeaa4('0x47')]['id']}})['then'](handleEntityNotFound(_0x411f9d,null))[_0xeaa4('0x26')](saveUpdates(_0x5b7e6d[_0xeaa4('0x4b')],null))[_0xeaa4('0x26')](respondWithResult(_0x411f9d,null))[_0xeaa4('0x45')](handleError(_0x411f9d,null));};exports['destroy']=function(_0x368837,_0xd10213){return db[_0xeaa4('0x2d')][_0xeaa4('0x49')]({'where':{'id':_0x368837[_0xeaa4('0x47')]['id']}})[_0xeaa4('0x26')](handleEntityNotFound(_0xd10213,null))[_0xeaa4('0x26')](removeEntity(_0xd10213,null))['catch'](handleError(_0xd10213,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d460da3..8ed4c10 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 _0xb753=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0xecb482,_0x3ee02f){var _0x3003b1=function(_0x509047){while(--_0x509047){_0xecb482['push'](_0xecb482['shift']());}};_0x3003b1(++_0x3ee02f);}(_0xb753,0xf2));var _0x3b75=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0xb753[_0x336376];return _0x1d2a8e;};'use strict';var _=require(_0x3b75('0x0'));var util=require(_0x3b75('0x1'));var logger=require(_0x3b75('0x2'))(_0x3b75('0x3'));var moment=require(_0x3b75('0x4'));var BPromise=require(_0x3b75('0x5'));var rp=require(_0x3b75('0x6'));var fs=require('fs');var path=require(_0x3b75('0x7'));var rimraf=require(_0x3b75('0x8'));var config=require(_0x3b75('0x9'));var attributes=require('./openchannelApplication.attributes');module[_0x3b75('0xa')]=function(_0x8bc37b,_0x4e04c0){return _0x8bc37b[_0x3b75('0xb')](_0x3b75('0xc'),attributes,{'tableName':_0x3b75('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b75('0xe'),'collate':_0x3b75('0xf')});}; \ No newline at end of file +var _0x6d78=['bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x6d78,0xd4));var _0x86d7=function(_0x5d9179,_0x55a8b5){_0x5d9179=_0x5d9179-0x0;var _0x1d2141=_0x6d78[_0x5d9179];return _0x1d2141;};'use strict';var _=require(_0x86d7('0x0'));var util=require(_0x86d7('0x1'));var logger=require(_0x86d7('0x2'))('api');var moment=require(_0x86d7('0x3'));var BPromise=require(_0x86d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86d7('0x5'));var config=require(_0x86d7('0x6'));var attributes=require(_0x86d7('0x7'));module[_0x86d7('0x8')]=function(_0x2b6c17,_0x556f3f){return _0x2b6c17['define'](_0x86d7('0x9'),attributes,{'tableName':_0x86d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86d7('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 21be7d8..3d8b913 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 _0xb3fe=['result','catch','update','body','options','raw','where','attributes','limit','then','UpdateOpenchannelApplication','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x242565,_0x33eec2){var _0x2bac76=function(_0x2d6979){while(--_0x2d6979){_0x242565['push'](_0x242565['shift']());}};_0x2bac76(++_0x33eec2);}(_0xb3fe,0x160));var _0xeb3f=function(_0x3ae3e2,_0x7aa47a){_0x3ae3e2=_0x3ae3e2-0x0;var _0x47d3b5=_0xb3fe[_0x3ae3e2];return _0x47d3b5;};'use strict';var _=require(_0xeb3f('0x0'));var util=require(_0xeb3f('0x1'));var moment=require(_0xeb3f('0x2'));var BPromise=require(_0xeb3f('0x3'));var rs=require(_0xeb3f('0x4'));var fs=require('fs');var Redis=require(_0xeb3f('0x5'));var db=require(_0xeb3f('0x6'))['db'];var utils=require(_0xeb3f('0x7'));var logger=require(_0xeb3f('0x8'))(_0xeb3f('0x9'));var config=require(_0xeb3f('0xa'));var jayson=require(_0xeb3f('0xb'));var client=jayson[_0xeb3f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10fbaf,_0x4cabfc,_0x5b7560){return new BPromise(function(_0x424e87,_0x19a981){return client[_0xeb3f('0xd')](_0x10fbaf,_0x5b7560)['then'](function(_0x2e93db){logger[_0xeb3f('0xe')](_0xeb3f('0xf'),_0x4cabfc,_0xeb3f('0x10'));logger['debug'](_0xeb3f('0x11'),_0x4cabfc,_0xeb3f('0x10'),JSON[_0xeb3f('0x12')](_0x2e93db));if(_0x2e93db[_0xeb3f('0x13')]){if(_0x2e93db['error'][_0xeb3f('0x14')]===0x1f4){logger[_0xeb3f('0x13')](_0xeb3f('0xf'),_0x4cabfc,_0x2e93db[_0xeb3f('0x13')]['message']);return _0x19a981(_0x2e93db[_0xeb3f('0x13')][_0xeb3f('0x15')]);}logger[_0xeb3f('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x4cabfc,_0x2e93db['error'][_0xeb3f('0x15')]);return _0x424e87(_0x2e93db[_0xeb3f('0x13')][_0xeb3f('0x15')]);}else{logger['info'](_0xeb3f('0xf'),_0x4cabfc,'request\x20sent');_0x424e87(_0x2e93db[_0xeb3f('0x16')][_0xeb3f('0x15')]);}})[_0xeb3f('0x17')](function(_0x3b5a08){logger[_0xeb3f('0x13')](_0xeb3f('0xf'),_0x4cabfc,_0x3b5a08);_0x19a981(_0x3b5a08);});});}exports['UpdateOpenchannelApplication']=function(_0x2b0a98){var _0x436aae=this;return new Promise(function(_0x2cdcbd,_0x2034e3){return db['OpenchannelApplication'][_0xeb3f('0x18')](_0x2b0a98[_0xeb3f('0x19')],{'raw':_0x2b0a98[_0xeb3f('0x1a')]?_0x2b0a98[_0xeb3f('0x1a')][_0xeb3f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b0a98[_0xeb3f('0x1a')]?_0x2b0a98['options'][_0xeb3f('0x1c')]||null:null,'attributes':_0x2b0a98['options']?_0x2b0a98[_0xeb3f('0x1a')][_0xeb3f('0x1d')]||null:null,'limit':_0x2b0a98['options']?_0x2b0a98[_0xeb3f('0x1a')][_0xeb3f('0x1e')]||null:null})[_0xeb3f('0x1f')](function(_0x567ae9){logger[_0xeb3f('0xe')](_0xeb3f('0x20'),_0x2b0a98);logger[_0xeb3f('0x21')](_0xeb3f('0x20'),_0x2b0a98,JSON[_0xeb3f('0x12')](_0x567ae9));_0x2cdcbd(_0x567ae9);})[_0xeb3f('0x17')](function(_0x5297c4){logger[_0xeb3f('0x13')]('UpdateOpenchannelApplication',_0x5297c4[_0xeb3f('0x15')],_0x2b0a98);_0x2034e3(_0x436aae[_0xeb3f('0x13')](0x1f4,_0x5297c4[_0xeb3f('0x15')]));});});}; \ No newline at end of file +var _0xae2e=['result','UpdateOpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xae2e,0x190));var _0xeae2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xae2e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xeae2('0x0'));var util=require(_0xeae2('0x1'));var moment=require(_0xeae2('0x2'));var BPromise=require(_0xeae2('0x3'));var rs=require(_0xeae2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeae2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeae2('0x6'))(_0xeae2('0x7'));var config=require(_0xeae2('0x8'));var jayson=require(_0xeae2('0x9'));var client=jayson[_0xeae2('0xa')][_0xeae2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ddd62,_0x2c9ac5,_0x2d40c9){return new BPromise(function(_0x4136ed,_0x326ba7){return client['request'](_0x5ddd62,_0x2d40c9)[_0xeae2('0xc')](function(_0x250471){logger[_0xeae2('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x2c9ac5,_0xeae2('0xe'));logger['debug'](_0xeae2('0xf'),_0x2c9ac5,_0xeae2('0xe'),JSON[_0xeae2('0x10')](_0x250471));if(_0x250471['error']){if(_0x250471[_0xeae2('0x11')]['code']===0x1f4){logger['error'](_0xeae2('0x12'),_0x2c9ac5,_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);return _0x326ba7(_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);}logger[_0xeae2('0x11')](_0xeae2('0x12'),_0x2c9ac5,_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);return _0x4136ed(_0x250471[_0xeae2('0x11')][_0xeae2('0x13')]);}else{logger[_0xeae2('0xd')](_0xeae2('0x12'),_0x2c9ac5,_0xeae2('0xe'));_0x4136ed(_0x250471[_0xeae2('0x14')][_0xeae2('0x13')]);}})['catch'](function(_0x452942){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x2c9ac5,_0x452942);_0x326ba7(_0x452942);});});}exports[_0xeae2('0x15')]=function(_0x2e166a){var _0x56a52a=this;return new Promise(function(_0x30ef33,_0x4773f6){return db['OpenchannelApplication'][_0xeae2('0x16')](_0x2e166a['body'],{'raw':_0x2e166a[_0xeae2('0x17')]?_0x2e166a['options'][_0xeae2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e166a['options']?_0x2e166a[_0xeae2('0x17')][_0xeae2('0x19')]||null:null,'attributes':_0x2e166a[_0xeae2('0x17')]?_0x2e166a['options'][_0xeae2('0x1a')]||null:null,'limit':_0x2e166a['options']?_0x2e166a['options'][_0xeae2('0x1b')]||null:null})[_0xeae2('0xc')](function(_0xc36b94){logger[_0xeae2('0xd')](_0xeae2('0x15'),_0x2e166a);logger[_0xeae2('0x1c')](_0xeae2('0x15'),_0x2e166a,JSON[_0xeae2('0x10')](_0xc36b94));_0x30ef33(_0xc36b94);})[_0xeae2('0x1d')](function(_0x351a34){logger[_0xeae2('0x11')](_0xeae2('0x15'),_0x351a34[_0xeae2('0x13')],_0x2e166a);_0x4773f6(_0x56a52a['error'](0x1f4,_0x351a34[_0xeae2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b6bf232..0e3d868 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 _0x1ecb=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','exports','util'];(function(_0x4c1a4b,_0x3fa5e5){var _0x53d629=function(_0x401951){while(--_0x401951){_0x4c1a4b['push'](_0x4c1a4b['shift']());}};_0x53d629(++_0x3fa5e5);}(_0x1ecb,0xa9));var _0xb1ec=function(_0x5a4841,_0x3c294f){_0x5a4841=_0x5a4841-0x0;var _0x1e620f=_0x1ecb[_0x5a4841];return _0x1e620f;};'use strict';var multer=require('multer');var util=require(_0xb1ec('0x0'));var path=require(_0xb1ec('0x1'));var timeout=require(_0xb1ec('0x2'));var express=require(_0xb1ec('0x3'));var router=express[_0xb1ec('0x4')]();var fs_extra=require(_0xb1ec('0x5'));var auth=require(_0xb1ec('0x6'));var interaction=require(_0xb1ec('0x7'));var config=require(_0xb1ec('0x8'));var controller=require(_0xb1ec('0x9'));router['get']('/',auth[_0xb1ec('0xa')](),controller[_0xb1ec('0xb')]);router[_0xb1ec('0xc')](_0xb1ec('0xd'),auth[_0xb1ec('0xa')](),controller[_0xb1ec('0xe')]);router[_0xb1ec('0xc')]('/:id',auth[_0xb1ec('0xa')](),controller[_0xb1ec('0xf')]);router[_0xb1ec('0xc')](_0xb1ec('0x10'),auth['isAuthenticated'](),controller[_0xb1ec('0x11')]);router[_0xb1ec('0xc')](_0xb1ec('0x12'),auth[_0xb1ec('0xa')](),controller[_0xb1ec('0x13')]);router[_0xb1ec('0x14')]('/',auth['isAuthenticated'](),controller[_0xb1ec('0x15')]);router[_0xb1ec('0x14')]('/:id/messages',auth[_0xb1ec('0xa')](),controller[_0xb1ec('0x16')]);router['post'](_0xb1ec('0x17'),auth[_0xb1ec('0xa')](),interaction[_0xb1ec('0x18')](_0xb1ec('0x19'),_0xb1ec('0x1a')),controller['addTags']);router[_0xb1ec('0x1b')](_0xb1ec('0x1c'),auth['isAuthenticated'](),interaction[_0xb1ec('0x18')]('openchannel',_0xb1ec('0x1d')),controller['update']);router[_0xb1ec('0x1e')](_0xb1ec('0x1c'),auth[_0xb1ec('0xa')](),interaction[_0xb1ec('0x18')](_0xb1ec('0x19'),_0xb1ec('0x1f')),controller['destroy']);router[_0xb1ec('0x1e')](_0xb1ec('0x17'),auth[_0xb1ec('0xa')](),controller[_0xb1ec('0x20')]);module[_0xb1ec('0x21')]=router; \ No newline at end of file +var _0x8fb5=['./openchannelInteraction.controller','get','isAuthenticated','index','show','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','/:id','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x613ebf,_0x14e555){var _0x1a37aa=function(_0x54bc87){while(--_0x54bc87){_0x613ebf['push'](_0x613ebf['shift']());}};_0x1a37aa(++_0x14e555);}(_0x8fb5,0x91));var _0x58fb=function(_0x1dfc98,_0x3264e9){_0x1dfc98=_0x1dfc98-0x0;var _0x57430f=_0x8fb5[_0x1dfc98];return _0x57430f;};'use strict';var multer=require(_0x58fb('0x0'));var util=require(_0x58fb('0x1'));var path=require(_0x58fb('0x2'));var timeout=require(_0x58fb('0x3'));var express=require(_0x58fb('0x4'));var router=express[_0x58fb('0x5')]();var fs_extra=require(_0x58fb('0x6'));var auth=require(_0x58fb('0x7'));var interaction=require(_0x58fb('0x8'));var config=require(_0x58fb('0x9'));var controller=require(_0x58fb('0xa'));router[_0x58fb('0xb')]('/',auth[_0x58fb('0xc')](),controller[_0x58fb('0xd')]);router[_0x58fb('0xb')]('/describe',auth[_0x58fb('0xc')](),controller['describe']);router[_0x58fb('0xb')]('/:id',auth[_0x58fb('0xc')](),controller[_0x58fb('0xe')]);router[_0x58fb('0xb')](_0x58fb('0xf'),auth[_0x58fb('0xc')](),controller['getMessages']);router[_0x58fb('0xb')](_0x58fb('0x10'),auth[_0x58fb('0xc')](),controller[_0x58fb('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x58fb('0x12')]);router[_0x58fb('0x13')](_0x58fb('0xf'),auth[_0x58fb('0xc')](),controller['addMessage']);router[_0x58fb('0x13')](_0x58fb('0x14'),auth[_0x58fb('0xc')](),interaction[_0x58fb('0x15')](_0x58fb('0x16'),_0x58fb('0x17')),controller[_0x58fb('0x18')]);router[_0x58fb('0x19')]('/:id',auth[_0x58fb('0xc')](),interaction['tracked'](_0x58fb('0x16'),_0x58fb('0x1a')),controller['update']);router[_0x58fb('0x1b')](_0x58fb('0x1c'),auth[_0x58fb('0xc')](),interaction[_0x58fb('0x15')](_0x58fb('0x16'),'openchannelinteraction:destroy'),controller[_0x58fb('0x1d')]);router['delete'](_0x58fb('0x14'),auth[_0x58fb('0xc')](),controller[_0x58fb('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index a5c5fe7..8a35566 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 _0xa8ca=['BOOLEAN','STRING','DATE','ENUM','sequelize'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x1a8c9c,_0x502527){_0x1a8c9c=_0x1a8c9c-0x0;var _0x37e197=_0xa8ca[_0x1a8c9c];return _0x37e197;};'use strict';var Sequelize=require(_0xaa8c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xaa8c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaa8c('0x2')]},'secondDisposition':{'type':Sequelize[_0xaa8c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xaa8c('0x2')]},'note':{'type':Sequelize[_0xaa8c('0x2')]},'read1stAt':{'type':Sequelize[_0xaa8c('0x3')]},'threadId':{'type':Sequelize[_0xaa8c('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xaa8c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xaa8c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xaa8c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xabe8=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x1d5da7,_0x33d1b8){var _0x183bd4=function(_0x480b23){while(--_0x480b23){_0x1d5da7['push'](_0x1d5da7['shift']());}};_0x183bd4(++_0x33d1b8);}(_0xabe8,0x8c));var _0x8abe=function(_0x4f9bee,_0x52d982){_0x4f9bee=_0x4f9bee-0x0;var _0x44924f=_0xabe8[_0x4f9bee];return _0x44924f;};'use strict';var Sequelize=require(_0x8abe('0x0'));module[_0x8abe('0x1')]={'closed':{'type':Sequelize[_0x8abe('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8abe('0x3')]},'secondDisposition':{'type':Sequelize[_0x8abe('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8abe('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8abe('0x3')]},'externalUrl':{'type':Sequelize[_0x8abe('0x3')]},'lastMsgAt':{'type':Sequelize[_0x8abe('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8abe('0x5')]('in',_0x8abe('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index c4c7c81..7ca03a5 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 _0x227b=['value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty','concat','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','merge','options','update','describe','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','spread','removeTags','unix','root','server','join','files','attachments','format','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','createdAt','direction','secret','Account','get','mkdirSync','Openchannel','Owner','N.A.','disposition','threadId','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','then','catch','waiting','answered','unmanaged','closed','UserId','talking','total','index','OpenchannelInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','field','color','u.id','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','find','unreadMessages'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x227b,0x90));var _0xb227=function(_0x4ecf2d,_0x21d922){_0x4ecf2d=_0x4ecf2d-0x0;var _0x6139a9=_0x227b[_0x4ecf2d];return _0x6139a9;};'use strict';var emlformat=require(_0xb227('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb227('0x1'));var jsonpatch=require(_0xb227('0x2'));var rp=require(_0xb227('0x3'));var moment=require(_0xb227('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb227('0x5'));var path=require(_0xb227('0x6'));var sox=require(_0xb227('0x7'));var csv=require(_0xb227('0x8'));var ejs=require(_0xb227('0x9'));var fs=require('fs');var fs_extra=require(_0xb227('0xa'));var _=require(_0xb227('0xb'));var squel=require(_0xb227('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb227('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb227('0xe'));var Papa=require(_0xb227('0xf'));var Redis=require(_0xb227('0x10'));var authService=require(_0xb227('0x11'));var qs=require(_0xb227('0x12'));var as=require(_0xb227('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xb227('0x14'));var logger=require('../../config/logger')(_0xb227('0x15'));var utils=require('../../config/utils');var config=require(_0xb227('0x16'));var licenseUtil=require(_0xb227('0x17'));var db=require(_0xb227('0x18'))['db'];config[_0xb227('0x19')]=_[_0xb227('0x1a')](config[_0xb227('0x19')],{'host':_0xb227('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb227('0x19')]));require(_0xb227('0x1c'))[_0xb227('0x1d')](socket);function respondWithStatusCode(_0x2aba06,_0x16a1fd){_0x16a1fd=_0x16a1fd||0xcc;return function(_0xb7504){if(_0xb7504){return _0x2aba06[_0xb227('0x1e')](_0x16a1fd);}return _0x2aba06['status'](_0x16a1fd)[_0xb227('0x1f')]();};}function respondWithResult(_0x5b212e,_0x4b6ba6){_0x4b6ba6=_0x4b6ba6||0xc8;return function(_0x1dc9af){if(_0x1dc9af){return _0x5b212e[_0xb227('0x20')](_0x4b6ba6)['json'](_0x1dc9af);}};}function respondWithFilteredResult(_0x216fee,_0x53a765){return function(_0x2449bb){if(_0x2449bb){var _0x310852=typeof _0x53a765[_0xb227('0x21')]===_0xb227('0x22')&&typeof _0x53a765['limit']===_0xb227('0x22');var _0x5a4509=_0x2449bb[_0xb227('0x23')];var _0xb7a7bc=_0x310852?0x0:_0x53a765[_0xb227('0x21')];var _0x22af76=_0x310852?_0x2449bb[_0xb227('0x23')]:_0x53a765['offset']+_0x53a765[_0xb227('0x24')];var _0x5e1c8b;if(_0x22af76>=_0x5a4509){_0x22af76=_0x5a4509;_0x5e1c8b=0xc8;}else{_0x5e1c8b=0xce;}_0x216fee[_0xb227('0x20')](_0x5e1c8b);return _0x216fee[_0xb227('0x25')](_0xb227('0x26'),_0xb7a7bc+'-'+_0x22af76+'/'+_0x5a4509)[_0xb227('0x27')](_0x2449bb);}return null;};}function patchUpdates(_0x5b2b04){return function(_0x755184){try{jsonpatch[_0xb227('0x28')](_0x755184,_0x5b2b04,!![]);}catch(_0x3c72d6){return BPromise[_0xb227('0x29')](_0x3c72d6);}return _0x755184[_0xb227('0x2a')]();};}function saveUpdates(_0x7ccb70,_0x4dfb1b){return function(_0x3e4abc){if(_0x3e4abc){return _0x3e4abc['update'](_0x7ccb70)['then'](function(_0x4289c6){return _0x4289c6;});}return null;};}function removeEntity(_0x2151ba,_0x1e8f3c){return function(_0xb09f9f){if(_0xb09f9f){return _0xb09f9f[_0xb227('0x2b')]()['then'](function(){_0x2151ba[_0xb227('0x20')](0xcc)[_0xb227('0x1f')]();});}};}function handleEntityNotFound(_0x25d1ce,_0x5ddb6f){return function(_0x53a437){if(!_0x53a437){_0x25d1ce[_0xb227('0x1e')](0x194);}return _0x53a437;};}function handleError(_0x3a0d2c,_0x3ba5ce){_0x3ba5ce=_0x3ba5ce||0x1f4;return function(_0x1a1eba){logger[_0xb227('0x2c')](_0x1a1eba[_0xb227('0x2d')]);if(_0x1a1eba[_0xb227('0x2e')]){delete _0x1a1eba[_0xb227('0x2e')];}_0x3a0d2c[_0xb227('0x20')](_0x3ba5ce)[_0xb227('0x2f')](_0x1a1eba);};}function getInteractionUsers(_0x1238f4,_0x3612f5){return new BPromise(function(_0x46563b,_0xebccb9){try{if(_0x3612f5[_0x1238f4['id']]){_0x1238f4['Users']=_[_0xb227('0x30')](_0x3612f5[_0x1238f4['id']],function(_0x5a40a8){return{'id':_0x5a40a8['id'],'fullname':_0x5a40a8[_0xb227('0x31')]};});}}catch(_0x23fe6a){_0xebccb9(_0x23fe6a);}_0x46563b(_0x1238f4);});}function getInteractionTags(_0x5ca83c,_0x36523d){return new BPromise(function(_0x563b7f,_0x138e8e){try{if(_0x5ca83c[_0xb227('0x32')]){_0x5ca83c[_0xb227('0x33')]=[];_0x5ca83c[_0xb227('0x32')][_0xb227('0x34')](',')[_0xb227('0x35')](function(_0x270b0f){_0x5ca83c[_0xb227('0x33')][_0xb227('0x36')](_0x36523d[_0x270b0f]);});}delete _0x5ca83c['TagIds'];}catch(_0x1639aa){_0x138e8e(_0x1639aa);}_0x563b7f(_0x5ca83c);});}function updateOpenchannelInteraction(_0xa53f7,_0x56c750,_0x126a17){return new BPromise(function(_0x31aba5,_0x394478){return getInteractionUsers(_0xa53f7,_0x126a17)[_0xb227('0x37')](function(_0x17fafc){return getInteractionTags(_0x17fafc,_0x56c750);})['then'](function(_0x22c2a4){return getStateInteraction(_0x22c2a4);})[_0xb227('0x37')](function(_0x222757){_0x31aba5(_0x222757);})[_0xb227('0x38')](function(_0x378531){_0x394478(_0x378531);});});}function getStateInteraction(_0x283585){return new BPromise(function(_0x2894ed){_0x283585[_0xb227('0x39')]=0x0;_0x283585['talking']=0x0;_0x283585[_0xb227('0x3a')]=0x0;_0x283585[_0xb227('0x3b')]=0x0;_0x283585['total']=0x0;if(!_0x283585[_0xb227('0x3c')]&&!_0x283585[_0xb227('0x3d')]){_0x283585[_0xb227('0x39')]+=0x1;}if(!_0x283585[_0xb227('0x3c')]&&_0x283585[_0xb227('0x3d')]){_0x283585[_0xb227('0x3e')]+=0x1;if(_0x283585[_0xb227('0x39')]){_0x283585[_0xb227('0x39')]-=0x1;}}if(_0x283585[_0xb227('0x3c')]&&_0x283585[_0xb227('0x3d')]){_0x283585[_0xb227('0x3a')]+=0x1;if(_0x283585[_0xb227('0x3e')]){_0x283585[_0xb227('0x3e')]-=0x1;}}if(_0x283585[_0xb227('0x3c')]&&!_0x283585[_0xb227('0x3d')]){_0x283585[_0xb227('0x3b')]+=0x1;if(_0x283585[_0xb227('0x39')]){_0x283585[_0xb227('0x39')]-=0x1;}}_0x283585[_0xb227('0x3f')]+=0x1;_0x2894ed(_0x283585);});}exports[_0xb227('0x40')]=function(_0x1e591e,_0xe08f9a){var _0x474efc={},_0x5d2086={},_0x50c97f={'count':0x0,'rows':[]};var _0x35cb8a=_[_0xb227('0x30')](db[_0xb227('0x41')][_0xb227('0x42')],function(_0x5b8a77){return{'name':_0x5b8a77[_0xb227('0x43')],'type':_0x5b8a77[_0xb227('0x44')]['key']};});_0x5d2086['model']=_[_0xb227('0x30')](_0x35cb8a,_0xb227('0x2e'));_0x5d2086[_0xb227('0x45')]=_[_0xb227('0x46')](_0x1e591e['query']);_0x5d2086[_0xb227('0x47')]=_[_0xb227('0x48')](_0x5d2086[_0xb227('0x49')],_0x5d2086[_0xb227('0x45')]);_0x474efc[_0xb227('0x4a')]=_[_0xb227('0x48')](_0x5d2086[_0xb227('0x49')],qs[_0xb227('0x4b')](_0x1e591e[_0xb227('0x45')][_0xb227('0x4b')]));_0x474efc[_0xb227('0x4a')]=_0x474efc[_0xb227('0x4a')][_0xb227('0x4c')]?_0x474efc[_0xb227('0x4a')]:_0x5d2086['model'];if(!_0x1e591e[_0xb227('0x45')][_0xb227('0x4d')]('nolimit')){_0x474efc[_0xb227('0x24')]=qs[_0xb227('0x24')](_0x1e591e[_0xb227('0x45')][_0xb227('0x24')]);_0x474efc[_0xb227('0x21')]=qs[_0xb227('0x21')](_0x1e591e[_0xb227('0x45')][_0xb227('0x21')]);}_0x474efc['order']=qs[_0xb227('0x4e')](_0x1e591e[_0xb227('0x45')][_0xb227('0x4e')]);_0x474efc['where']=qs['filters'](_[_0xb227('0x4f')](_0x1e591e[_0xb227('0x45')],_0x5d2086[_0xb227('0x47')]),_0x35cb8a);var _0x26b8ad=[];var _0x496dcf=squel['select']()[_0xb227('0x50')]('id')[_0xb227('0x50')](_0xb227('0x2e'))[_0xb227('0x50')](_0xb227('0x51'))['from']('tools_tags');var _0x1eff74=squel['select']()[_0xb227('0x50')](_0xb227('0x52'))[_0xb227('0x50')](_0xb227('0x53'))[_0xb227('0x50')](_0xb227('0x54'))[_0xb227('0x55')]('user_has_openchannel_interactions','ui')[_0xb227('0x56')](_0xb227('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x583d10=squel[_0xb227('0x58')]()[_0xb227('0x55')]('openchannel_interactions','i')[_0xb227('0x56')]('cm_contacts','c',_0xb227('0x59'))[_0xb227('0x56')](_0xb227('0x57'),'o',_0xb227('0x5a'))[_0xb227('0x56')](_0xb227('0x5b'),'a',_0xb227('0x5c'))['left_join'](_0xb227('0x5d'),'me',_0xb227('0x5e'))[_0xb227('0x56')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xb227('0x56')](_0xb227('0x5f'),'t',_0xb227('0x60'));var _0x154a88=squel[_0xb227('0x61')]();var _0x17cee6=[];var _0x2e750e=squel[_0xb227('0x61')]();var _0x47545c;if(_0x1e591e[_0xb227('0x45')][_0xb227('0x62')]){_0x47545c=as['parseSearch'](_0x1e591e['query']['search']);var _0x44ca5b=_0x47545c[_0xb227('0x63')];for(var _0x55c669=0x0;_0x55c669<_0x47545c['conditions'][_0xb227('0x4c')];_0x55c669++){var _0x584e05=_0x47545c['conditions'][_0x55c669];var _0xc0a19a='i';var _0x4a9701=_[_0xb227('0x64')](_0x35cb8a,[_0xb227('0x2e'),_0x584e05[_0xb227('0x50')]]);if(!_0x4a9701){switch(_0x584e05['field']){case _0xb227('0x65'):if(_0x584e05[_0xb227('0x66')]==0x1){_0x583d10[_0xb227('0x67')]('`'+_0x584e05[_0xb227('0x50')]+_0xb227('0x68'));}else{_0x583d10['having']('`'+_0x584e05['field']+_0xb227('0x69'));}break;case _0xb227('0x6a'):if(_0x584e05[_0xb227('0x6b')]===_0xb227('0x6c')){if(_0x584e05[_0xb227('0x66')][_0xb227('0x34')]('\x20')[_0xb227('0x4c')]>0x1){_0x154a88[_0x44ca5b](_0xb227('0x6d'),qs[_0xb227('0x6e')](_0x584e05[_0xb227('0x66')]),null);}else{var _0x477ae1='%'+_0x584e05[_0xb227('0x66')]+'%';_0x154a88[_0x44ca5b](_0xb227('0x6f'),_0x477ae1,_0x477ae1,_0x477ae1);}}else{_0x4a9701=_[_0xb227('0x64')](_0x35cb8a,[_0xb227('0x2e'),_0xb227('0x70')]);_0x584e05[_0xb227('0x50')]=_0xb227('0x70');_0x16a40c=as[_0xb227('0x71')](_0xc0a19a,_0x4a9701[_0xb227('0x44')],_0x584e05);_0x154a88[_0x44ca5b](_0x16a40c[_0xb227('0x72')],_0x16a40c['value'][_0xb227('0x73')],_0x16a40c[_0xb227('0x66')][_0xb227('0x1f')]);}break;case _0xb227('0x74'):var _0xf3da6=_0x584e05[_0xb227('0x66')]['split'](',')[_0xb227('0x30')](function(_0x5e880c){return Number(_0x5e880c);});_0xf3da6['forEach'](function(_0x3e5406){_0x2e750e['or'](_0xb227('0x75'),'%,'+_0x3e5406+',%');});_0x17cee6=_[_0xb227('0x76')](_0x17cee6,_0xf3da6);break;case _0xb227('0x77'):if(_0x584e05['operator']===_0xb227('0x6c')){_0x154a88[_0x44ca5b](_0xb227('0x78'),'%'+_0x584e05[_0xb227('0x66')]+'%',null);}else{_0x4a9701=_[_0xb227('0x64')](_0x35cb8a,[_0xb227('0x2e'),'UserId']);_0x584e05[_0xb227('0x50')]=_0xb227('0x3d');_0x16a40c=as[_0xb227('0x71')](_0xc0a19a,_0x4a9701['type'],_0x584e05);_0x154a88[_0x44ca5b](_0x16a40c['text'],_0x16a40c['value'][_0xb227('0x73')],_0x16a40c[_0xb227('0x66')][_0xb227('0x1f')]);}break;case _0xb227('0x79'):_0x16a40c=as[_0xb227('0x71')]('me',null,_0x584e05);_0x154a88[_0x44ca5b](_0x16a40c[_0xb227('0x72')],_0x16a40c[_0xb227('0x66')]['start'],_0x16a40c[_0xb227('0x66')]['end']);break;}}else{var _0x16a40c=as[_0xb227('0x71')](_0xc0a19a,_0x4a9701[_0xb227('0x44')],_0x584e05);_0x154a88[_0x44ca5b](_0x16a40c[_0xb227('0x72')],_0x16a40c['value'][_0xb227('0x73')],_0x16a40c['value']['end']);}}}else{var _0x3a3b96=_(_0x1e591e['query'])[_0xb227('0x46')]()['map'](function(_0x1a7dd8){return _[_0xb227('0x7a')](_0x35cb8a,[_0xb227('0x2e'),_0x1a7dd8])?_0x1a7dd8:undefined;})['compact']()[_0xb227('0x66')]();if(!_[_0xb227('0x7b')](_0x3a3b96)){_0x3a3b96[_0xb227('0x35')](function(_0x3f32ba){if(_0x3f32ba==='OpenchannelAccountId'){_0x583d10['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xb227('0x7c')](_0x1e591e[_0xb227('0x45')][_0x3f32ba]));}else if(_0x3f32ba==='createdAt'){var _0x246d27=JSON[_0xb227('0x7d')](_0x1e591e[_0xb227('0x45')][_0x3f32ba])['$gte'];var _0x5438a8=JSON[_0xb227('0x7d')](_0x1e591e[_0xb227('0x45')][_0x3f32ba])[_0xb227('0x7e')];_0x583d10[_0xb227('0x7f')](_0xb227('0x80'),_0x246d27,_0x5438a8);}else{if(_0x1e591e[_0xb227('0x45')][_0x3f32ba]===_0xb227('0x81')){_0x583d10[_0xb227('0x7f')]('i.'+_0x3f32ba+_0xb227('0x82'));}else{_0x583d10[_0xb227('0x7f')]('i.'+_0x3f32ba+_0xb227('0x83'),_0x1e591e[_0xb227('0x45')][_0x3f32ba]);}}});}if(_0x1e591e[_0xb227('0x45')][_0xb227('0x84')]){if(_0x1e591e[_0xb227('0x45')]['read']==0x1){_0x583d10['having'](_0xb227('0x85'));}else{_0x583d10['having']('`unreadMessages`\x20>\x200');}}if(_0x1e591e[_0xb227('0x45')][_0xb227('0x86')]){_0x17cee6=_[_0xb227('0x87')](_0x1e591e[_0xb227('0x45')][_0xb227('0x86')])?_0x1e591e[_0xb227('0x45')][_0xb227('0x86')]:new Array(_0x1e591e['query'][_0xb227('0x86')]);_0x17cee6[_0xb227('0x35')](function(_0x1bb8f7){_0x2e750e['or'](_0xb227('0x75'),'%,'+_0x1bb8f7+',%');});}if(_0x1e591e[_0xb227('0x45')][_0xb227('0x88')]){var _0x22b14f=_0x1e591e['query']['filter'][_0xb227('0x89')]('\x5c','\x5c\x5c')[_0xb227('0x89')](/'/g,'\x27\x27');if(qs[_0xb227('0x8a')](_0x22b14f)){_0x154a88['or'](_0xb227('0x8b'),_0x22b14f+'%');}else{_0x154a88['or'](_0xb227('0x8c'),qs[_0xb227('0x6e')](_0x22b14f))['or'](_0xb227('0x8d'),_0x22b14f+'%')['or'](_0xb227('0x8e'),_0x22b14f+'%');}}}_0x583d10['where'](_0x154a88);_0x583d10[_0xb227('0x8f')](_0xb227('0x90'));var _0x118422={'type':db['Sequelize']['QueryTypes'][_0xb227('0x91')],'raw':!![]};var _0x51437e=_0x583d10[_0xb227('0x92')]();_0x51437e[_0xb227('0x50')](_0xb227('0x90'));_0x51437e['field'](_0xb227('0x93'),'unreadMessages');if(_0x474efc['order']){_0x474efc[_0xb227('0x94')]['forEach'](function(_0x1def1d){var _0x325872=_0x1def1d[0x0]===_0xb227('0x95')?_0x1def1d[0x0]:'i.'+_0x1def1d[0x0];_0x583d10[_0xb227('0x94')](_0x325872,_0x1def1d[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x17cee6)){_0x583d10['having'](_0x2e750e);_0x51437e[_0xb227('0x7f')](_0xb227('0x96'),_0x17cee6);}BPromise[_0xb227('0x97')]()[_0xb227('0x37')](function(){if(!_0x47545c){if(_0x1e591e['query'][_0xb227('0x98')])return;_0x51437e[_0xb227('0x7f')](_0xb227('0x99'));_0x583d10[_0xb227('0x7f')](_0xb227('0x99'));return;}if(_0x1e591e[_0xb227('0x9a')][_0xb227('0x9b')]!==_0xb227('0x9c'))return;return _0x1e591e[_0xb227('0x9a')][_0xb227('0x9d')]({'attributes':['id'],'raw':!![]})[_0xb227('0x37')](function(_0x23a3bb){if(_[_0xb227('0x7b')](_0x23a3bb)){_0x51437e['where'](_0xb227('0x9e'));_0x583d10[_0xb227('0x7f')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x51437e[_0xb227('0x7f')](_0xb227('0x9f'),_[_0xb227('0x30')](_0x23a3bb,'id'));_0x583d10['where'](_0xb227('0x9f'),_['map'](_0x23a3bb,'id'));}});})[_0xb227('0x37')](function(){if(_0x1e591e['user'][_0xb227('0x9b')]===_0xb227('0x9c')&&!_0x47545c&&!_0x1e591e['query'][_0xb227('0x98')])return[];return db[_0xb227('0xa0')]['query'](_0x51437e[_0xb227('0xa1')](),_0x118422);})[_0xb227('0x37')](function(_0x4abad0){_0x50c97f[_0xb227('0x23')]=_0x4abad0[_0xb227('0x4c')];if(_0x50c97f['count']===0x0)return[];return db['sequelize'][_0xb227('0x45')](_0x496dcf['toString'](),_0x118422)[_0xb227('0x37')](function(_0x3420cb){_0x26b8ad=_[_0xb227('0xa2')](_0x3420cb,'id');_0x118422=_['merge'](_0x118422,{'model':db[_0xb227('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e591e[_0xb227('0x45')][_0xb227('0x4b')]){_0x474efc[_0xb227('0x4a')][_0xb227('0x35')](function(_0xea1dc1){_0x583d10[_0xb227('0x50')]('i.'+_0xea1dc1);});}else{_0x583d10[_0xb227('0x50')](_0xb227('0x93'),'unreadMessages');_0x583d10[_0xb227('0x50')](_0xb227('0xa3'),_0xb227('0xa4'));_0x583d10['field'](_0xb227('0xa5'),_0xb227('0xa6'));_0x583d10[_0xb227('0x50')](_0xb227('0xa7'),_0xb227('0x95'));_0x583d10[_0xb227('0x50')](_0xb227('0xa8'));_0x583d10['field']('c.firstName',_0xb227('0xa9'));_0x583d10[_0xb227('0x50')](_0xb227('0xaa'),_0xb227('0xab'));_0x583d10[_0xb227('0x50')](_0xb227('0xac'),_0xb227('0xad'));_0x583d10[_0xb227('0x50')]('c.phone',_0xb227('0xae'));_0x583d10[_0xb227('0x50')](_0xb227('0xaf'),_0xb227('0xb0'));_0x583d10[_0xb227('0x50')](_0xb227('0xb1'),_0xb227('0xb2'));_0x583d10[_0xb227('0x50')](_0xb227('0xb3'),_0xb227('0xb4'));_0x583d10[_0xb227('0x50')](_0xb227('0xb5'),_0xb227('0xb6'));_0x583d10[_0xb227('0x50')](_0xb227('0xb7'),_0xb227('0x32'));}if(_0x474efc[_0xb227('0x24')])_0x583d10[_0xb227('0x24')](_0x474efc['limit']);if(_0x474efc[_0xb227('0x21')])_0x583d10['offset'](_0x474efc[_0xb227('0x21')]);return db[_0xb227('0xa0')][_0xb227('0x45')](_0x583d10[_0xb227('0xa1')](),_0x118422);})[_0xb227('0x37')](function(_0x395b99){if(_0x395b99[_0xb227('0x4c')]>0x0)_0x1eff74[_0xb227('0x7f')](_0xb227('0xb8'),_[_0xb227('0x30')](_0x395b99,'id'));return db['sequelize'][_0xb227('0x45')](_0x1eff74[_0xb227('0xa1')](),_0x118422)[_0xb227('0x37')](function(_0x1a1051){var _0x4fda28=_[_0xb227('0xb9')](_0x1a1051,_0xb227('0xba'));var _0x548795=[];_0x395b99[_0xb227('0x35')](function(_0x3cd443){_0x548795[_0xb227('0x36')](updateOpenchannelInteraction(_0x3cd443,_0x26b8ad,_0x4fda28));});return BPromise[_0xb227('0xbb')](_0x548795);});});})['then'](function(_0x2bee43){_0x50c97f[_0xb227('0xbc')]=_0x2bee43;return _0x50c97f;})[_0xb227('0x37')](respondWithFilteredResult(_0xe08f9a,_0x474efc))[_0xb227('0x38')](handleError(_0xe08f9a,null));};exports[_0xb227('0xbd')]=function(_0x494907,_0xc150be){var _0x335567={};if(_0x494907[_0xb227('0x45')]['type']&&_0x494907[_0xb227('0x45')][_0xb227('0x44')]==='from'){_0x335567[_0xb227('0x55')]=_0x494907[_0xb227('0xbe')]['id'];}else{_0x335567['id']=_0x494907[_0xb227('0xbe')]['id'];}var _0x15fa84={'raw':![],'where':_0x335567},_0x4b1574={};_0x4b1574['model']=_['keys'](db[_0xb227('0x41')][_0xb227('0x42')]);_0x4b1574[_0xb227('0x45')]=_['keys'](_0x494907[_0xb227('0x45')]);_0x4b1574['filters']=_[_0xb227('0x48')](_0x4b1574[_0xb227('0x49')],_0x4b1574[_0xb227('0x45')]);_0x15fa84[_0xb227('0x4a')]=_[_0xb227('0x48')](_0x4b1574[_0xb227('0x49')],qs['fields'](_0x494907[_0xb227('0x45')][_0xb227('0x4b')]));_0x15fa84[_0xb227('0x4a')]=_0x15fa84[_0xb227('0x4a')][_0xb227('0x4c')]?_0x15fa84[_0xb227('0x4a')]:_0x4b1574[_0xb227('0x49')];if(_0x494907[_0xb227('0x45')]['includeAll']){_0x15fa84[_0xb227('0xbf')]=[{'all':!![]}];}_0x15fa84=_[_0xb227('0xc0')]({},_0x15fa84,_0x494907[_0xb227('0xc1')]);return db[_0xb227('0x41')][_0xb227('0x64')](_0x15fa84)[_0xb227('0x37')](handleEntityNotFound(_0xc150be,null))[_0xb227('0x37')](respondWithResult(_0xc150be,null))['catch'](handleError(_0xc150be,null));};exports['create']=function(_0x44ce4f,_0x3765b8){return db['OpenchannelInteraction']['create'](_0x44ce4f[_0xb227('0x79')],{})[_0xb227('0x37')](respondWithResult(_0x3765b8,0xc9))[_0xb227('0x38')](handleError(_0x3765b8,null));};exports[_0xb227('0xc2')]=function(_0x1cc8fe,_0x4ab8d6){if(_0x1cc8fe[_0xb227('0x79')]['id']){delete _0x1cc8fe[_0xb227('0x79')]['id'];}return db[_0xb227('0x41')][_0xb227('0x64')]({'where':{'id':_0x1cc8fe[_0xb227('0xbe')]['id']}})['then'](handleEntityNotFound(_0x4ab8d6,null))[_0xb227('0x37')](saveUpdates(_0x1cc8fe[_0xb227('0x79')],null))[_0xb227('0x37')](respondWithResult(_0x4ab8d6,null))[_0xb227('0x38')](handleError(_0x4ab8d6,null));};exports[_0xb227('0x2b')]=function(_0x10a468,_0x37357a){return db[_0xb227('0x41')][_0xb227('0x64')]({'where':{'id':_0x10a468[_0xb227('0xbe')]['id']}})[_0xb227('0x37')](handleEntityNotFound(_0x37357a,null))['then'](removeEntity(_0x37357a,null))[_0xb227('0x38')](handleError(_0x37357a,null));};exports['describe']=function(_0x48215e,_0x188885){return db[_0xb227('0x41')][_0xb227('0xc3')]()[_0xb227('0x37')](respondWithResult(_0x188885,null))[_0xb227('0x38')](handleError(_0x188885,null));};exports['addMessage']=function(_0x260326,_0x5a06b6,_0x26e905){return db[_0xb227('0xc4')][_0xb227('0x64')]({'where':{'id':_0x260326[_0xb227('0xbe')]['id']}})['then'](handleEntityNotFound(_0x5a06b6,null))['then'](function(_0x7042af){if(_0x7042af){return _0x7042af['addMessage'](_0x260326[_0xb227('0x79')][_0xb227('0xc5')],_[_0xb227('0xc6')](_0x260326[_0xb227('0x79')],[_0xb227('0xc5'),'id'])||{});}})[_0xb227('0x37')](respondWithResult(_0x5a06b6,null))[_0xb227('0x38')](handleError(_0x5a06b6,null));};exports[_0xb227('0xc7')]=function(_0x14c1fd,_0x2cf274,_0x5470b0){var _0x5a3d35={'raw':![],'where':{}};var _0x42f629={};var _0x9e597={'count':0x0,'rows':[]};return db[_0xb227('0x41')][_0xb227('0xc8')]({'where':{'id':_0x14c1fd[_0xb227('0xbe')]['id']}})[_0xb227('0x37')](handleEntityNotFound(_0x2cf274,null))[_0xb227('0x37')](function(_0x5d65bc){if(_0x5d65bc){_0x42f629['model']=_[_0xb227('0x46')](db[_0xb227('0xc4')][_0xb227('0x42')]);_0x42f629[_0xb227('0x45')]=_[_0xb227('0x46')](_0x14c1fd[_0xb227('0x45')]);_0x42f629[_0xb227('0x47')]=_[_0xb227('0x48')](_0x42f629[_0xb227('0x49')],_0x42f629[_0xb227('0x45')]);_0x5a3d35[_0xb227('0x4a')]=_[_0xb227('0x48')](_0x42f629[_0xb227('0x49')],qs['fields'](_0x14c1fd[_0xb227('0x45')][_0xb227('0x4b')]));_0x5a3d35['attributes']=_0x5a3d35[_0xb227('0x4a')]['length']?_0x5a3d35[_0xb227('0x4a')]:_0x42f629[_0xb227('0x49')];if(!_0x14c1fd['query'][_0xb227('0x4d')](_0xb227('0xc9'))){_0x5a3d35[_0xb227('0x24')]=qs[_0xb227('0x24')](_0x14c1fd[_0xb227('0x45')][_0xb227('0x24')]);_0x5a3d35[_0xb227('0x21')]=qs['offset'](_0x14c1fd[_0xb227('0x45')][_0xb227('0x21')]);}_0x5a3d35[_0xb227('0x94')]=qs['sort'](_0x14c1fd[_0xb227('0x45')]['sort']);_0x5a3d35[_0xb227('0x7f')]=qs[_0xb227('0x47')](_[_0xb227('0x4f')](_0x14c1fd[_0xb227('0x45')],_0x42f629['filters']));_0x5a3d35[_0xb227('0x7f')][_0xb227('0xba')]=_0x5d65bc['id'];if(_0x14c1fd[_0xb227('0x45')][_0xb227('0x88')]){_0x5a3d35['where']=_[_0xb227('0xc0')](_0x5a3d35['where'],{'$or':_[_0xb227('0x30')](_0x5a3d35[_0xb227('0x4a')],function(_0x17551c){var _0x10f39f={};_0x10f39f[_0x17551c]={'$like':'%'+_0x14c1fd['query']['filter']+'%'};return _0x10f39f;})});}if(_0x14c1fd[_0xb227('0x45')][_0xb227('0xca')]){var _0x52705c=_0x14c1fd[_0xb227('0x45')][_0xb227('0xca')][_0xb227('0x34')](',');var _0x20b129={};_0x20b129[_0x52705c[0x0]]={'$gte':moment(_0x52705c[0x1])['format'](_0xb227('0xcb'))};_0x5a3d35['where']=_['merge'](_0x5a3d35['where'],_0x20b129);}_0x5a3d35=_['merge']({},_0x5a3d35,_0x14c1fd['options']);return db[_0xb227('0xc4')][_0xb227('0x23')]({'where':_0x5a3d35[_0xb227('0x7f')]})[_0xb227('0x37')](function(_0x2cd1b3){_0x9e597[_0xb227('0x23')]=_0x2cd1b3;if(_0x14c1fd[_0xb227('0x45')][_0xb227('0xcc')]){_0x5a3d35[_0xb227('0xbf')]=[{'all':!![]}];}return db[_0xb227('0xc4')][_0xb227('0xcd')](_0x5a3d35);})['then'](function(_0x40a471){_0x9e597[_0xb227('0xbc')]=_0x40a471;return _0x9e597;});}})[_0xb227('0x37')](respondWithFilteredResult(_0x2cf274,_0x5a3d35))[_0xb227('0x38')](handleError(_0x2cf274,null));};exports[_0xb227('0xce')]=function(_0x2d780f,_0x327b1f,_0x2e06a3){return db[_0xb227('0x41')][_0xb227('0x64')]({'where':{'id':_0x2d780f[_0xb227('0xbe')]['id']}})[_0xb227('0x37')](handleEntityNotFound(_0x327b1f,null))[_0xb227('0x37')](function(_0x14d1fe){if(_0x14d1fe){return _0x14d1fe['setTags'](_0x2d780f[_0xb227('0x79')][_0xb227('0xc5')],_['omit'](_0x2d780f[_0xb227('0x79')],[_0xb227('0xc5'),'id'])||{})[_0xb227('0xcf')](function(){return db[_0xb227('0x74')][_0xb227('0xcd')]({'attributes':['id','name','color'],'where':{'id':_0x2d780f[_0xb227('0x79')][_0xb227('0xc5')]}});})[_0xb227('0x37')](function(_0x3f74cf){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x2d780f[_0xb227('0xbe')]['id']),'tags':_0x3f74cf||[]});return{'id':Number(_0x2d780f['params']['id']),'tags':_0x3f74cf||[]};});}})[_0xb227('0x37')](respondWithResult(_0x327b1f,null))[_0xb227('0x38')](handleError(_0x327b1f,null));};exports['removeTags']=function(_0xf147e9,_0x222a69,_0x17acbc){return db[_0xb227('0x41')][_0xb227('0x64')]({'where':{'id':_0xf147e9[_0xb227('0xbe')]['id']}})[_0xb227('0x37')](handleEntityNotFound(_0x222a69,null))[_0xb227('0x37')](function(_0x3f278d){if(_0x3f278d){return _0x3f278d[_0xb227('0xd0')](_0xf147e9[_0xb227('0x45')][_0xb227('0xc5')]);}})[_0xb227('0x37')](respondWithStatusCode(_0x222a69,null))[_0xb227('0x38')](handleError(_0x222a69,null));};exports['download']=function(_0x51811a,_0x1bb962){var _0x38f41c=moment()[_0xb227('0xd1')]()[_0xb227('0xa1')]();var _0x15a502=path['join'](config[_0xb227('0xd2')],_0xb227('0xd3'),'files','tmp');var _0x54088d=path[_0xb227('0xd4')](config[_0xb227('0xd2')],_0xb227('0xd3'),_0xb227('0xd5'),_0xb227('0xd6'));var _0x5d5d9=path[_0xb227('0xd4')](_0x15a502,_0x38f41c);var _0x20ae37=util[_0xb227('0xd7')](_0xb227('0xd8'),_0x51811a[_0xb227('0xbe')]['id'],_0x38f41c);var _0x4e0011=path[_0xb227('0xd4')](_0x15a502,_0x20ae37);var _0x2af28d=[];_0x2af28d[_0xb227('0x36')]({'model':db['User'],'as':_0xb227('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x2af28d[_0xb227('0x36')]({'model':db[_0xb227('0xd9')],'as':_0xb227('0x6a'),'attributes':['id',_0xb227('0xda'),'lastName'],'raw':!![]});if(_0x51811a[_0xb227('0x45')][_0xb227('0xd6')]){_0x2af28d['push']({'model':db['Attachment'],'as':_0xb227('0xdb'),'raw':!![]});}var _0x24f850=[{'model':db[_0xb227('0xc4')],'as':_0xb227('0xdc'),'attributes':['id','body',_0xb227('0xdd'),_0xb227('0xde'),_0xb227('0xdf'),_0xb227('0x84')],'include':_0x2af28d}];_0x24f850[_0xb227('0x36')]({'model':db['OpenchannelAccount'],'as':_0xb227('0xe0'),'attributes':['id',_0xb227('0x2e')]});_0x24f850[_0xb227('0x36')]({'model':db['User'],'as':'Owner','attributes':['id',_0xb227('0x31')]});return db['OpenchannelInteraction'][_0xb227('0x64')]({'where':{'id':_0x51811a[_0xb227('0xbe')]['id']},'include':_0x24f850})[_0xb227('0x37')](handleEntityNotFound(_0x1bb962,null))[_0xb227('0x37')](function(_0xb4c135){if(_0xb4c135){var _0x117e44=_0xb4c135[_0xb227('0xe1')]({'plain':!![]});fs[_0xb227('0xe2')](_0x5d5d9);var _0x1d49ee={'channel':_0xb227('0xe3'),'account':_0x117e44[_0xb227('0xe0')][_0xb227('0x2e')],'agent':_0x117e44[_0xb227('0xe4')]?_0x117e44[_0xb227('0xe4')][_0xb227('0x31')]:_0xb227('0xe5'),'createdAt':moment(_0x117e44[_0xb227('0xdd')])[_0xb227('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x117e44[_0xb227('0x3c')]?moment(_0x117e44['closedAt'])[_0xb227('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x117e44[_0xb227('0xe6')],'visibility':_0x117e44[_0xb227('0xe7')]?'Public':'Private','messages':_(_0x117e44[_0xb227('0xdc')])[_0xb227('0x88')]({'secret':![]})[_0xb227('0x30')](function(_0x19cda0){if(_0x19cda0[_0xb227('0xdb')]){var _0x28887e=path['join'](_0x54088d,_0x19cda0[_0xb227('0xdb')][_0xb227('0xe8')]);if(fs[_0xb227('0xe9')](_0x28887e)){fs[_0xb227('0xea')](_0x28887e)[_0xb227('0xeb')](fs[_0xb227('0xec')](path[_0xb227('0xd4')](_0x5d5d9,_0x19cda0['Attachment'][_0xb227('0xe8')])));}}return{'date':moment(_0x19cda0[_0xb227('0xdd')])[_0xb227('0xd7')](_0xb227('0xcb'))['toString'](),'sender':_0x19cda0[_0xb227('0xde')]===_0xb227('0xed')?_0x19cda0['User']?_0x19cda0[_0xb227('0x77')]['fullname']:_0xb227('0xee'):_0x19cda0[_0xb227('0x6a')]['firstName']+(_0x19cda0[_0xb227('0x6a')]['lastName']?'\x20'+_0x19cda0[_0xb227('0x6a')]['lastName']:''),'body':_0x19cda0['Attachment']?_0x19cda0['Attachment'][_0xb227('0xe8')]:_0x19cda0[_0xb227('0x79')],'direction':_0x19cda0[_0xb227('0xde')]==='out'?'A':'C','secret':_0x19cda0[_0xb227('0xdf')],'read':_0x19cda0[_0xb227('0x84')],'attachment':_0x19cda0[_0xb227('0xdb')]};})[_0xb227('0x66')]()};return ejs[_0xb227('0xef')](path[_0xb227('0xd4')](config[_0xb227('0xd2')],_0xb227('0xd3'),_0xb227('0xf0'),_0xb227('0xf1')),{'interaction':_0x1d49ee})['then'](function(_0xaa645c){var _0x10bc92=path['join'](_0x5d5d9,'transcript-'+_0x117e44['id']+'-'+_0x38f41c+_0xb227('0xf2'));var _0xfcf8df={'path':_0x10bc92,'channel':'Openchannel','interactionId':_0x117e44['id']};return pdf[_0xb227('0xf3')](_0xaa645c,_0xfcf8df);})[_0xb227('0x37')](function(){return new BPromise(function(_0x11e36e,_0x482cd6){zipdir(_0x5d5d9,{'saveTo':_0x4e0011},function(_0x5d89ce,_0x20a0ab){if(_0x5d89ce)return _0x482cd6(_0x5d89ce);return _0x11e36e(_0x20a0ab);});})['then'](function(){return new BPromise(function(_0x56a21b,_0x4a4184){rimraf(_0x5d5d9,function(_0x2bbb24){if(_0x2bbb24)_0x4a4184(_0x2bbb24);return _0x56a21b();});});})[_0xb227('0x37')](function(){return _0x1bb962[_0xb227('0xf4')](_0x4e0011,_0x20ae37,function(_0x1d7fda){if(_0x1d7fda){console[_0xb227('0xf5')]('err',_0x1d7fda);}else{fs['unlinkSync'](_0x4e0011);}});});});}else{return _0x1bb962[_0xb227('0x1e')](0xc8);}})[_0xb227('0x38')](handleError(_0x1bb962,null));}; \ No newline at end of file +var _0x1d92=['ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','start','body','buildExpression','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','all','rows','options','create','destroy','params','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','User','firstName','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','get','mkdirSync','Openchannel','Account','N.A.','closedAt','disposition','threadId','Public','Private','basename','createWriteStream','out','System','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/license/util','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','waiting','talking','answered','total','closed','UserId','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','u.id'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1d92,0x9a));var _0x21d9=function(_0x402125,_0x3546a9){_0x402125=_0x402125-0x0;var _0x183c8b=_0x1d92[_0x402125];return _0x183c8b;};'use strict';var emlformat=require(_0x21d9('0x0'));var rimraf=require(_0x21d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21d9('0x2'));var rp=require(_0x21d9('0x3'));var moment=require('moment');var BPromise=require(_0x21d9('0x4'));var Mustache=require(_0x21d9('0x5'));var util=require(_0x21d9('0x6'));var path=require(_0x21d9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x21d9('0x8'));var fs=require('fs');var fs_extra=require(_0x21d9('0x9'));var _=require('lodash');var squel=require(_0x21d9('0xa'));var crypto=require(_0x21d9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x21d9('0xc'));var querystring=require(_0x21d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x21d9('0xe'));var authService=require(_0x21d9('0xf'));var qs=require(_0x21d9('0x10'));var as=require(_0x21d9('0x11'));var pdf=require(_0x21d9('0x12'));var hardwareService=require(_0x21d9('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21d9('0x14'));var db=require('../../mysqldb')['db'];config[_0x21d9('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x21d9('0x16'))(new Redis(config[_0x21d9('0x15')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0xb33b65,_0x547251){_0x547251=_0x547251||0xcc;return function(_0x1cecff){if(_0x1cecff){return _0xb33b65[_0x21d9('0x17')](_0x547251);}return _0xb33b65[_0x21d9('0x18')](_0x547251)[_0x21d9('0x19')]();};}function respondWithResult(_0x1fe285,_0x393840){_0x393840=_0x393840||0xc8;return function(_0x3ba0c6){if(_0x3ba0c6){return _0x1fe285[_0x21d9('0x18')](_0x393840)[_0x21d9('0x1a')](_0x3ba0c6);}};}function respondWithFilteredResult(_0x2aa263,_0xa57e19){return function(_0xa02446){if(_0xa02446){var _0x2fe46c=typeof _0xa57e19[_0x21d9('0x1b')]===_0x21d9('0x1c')&&typeof _0xa57e19[_0x21d9('0x1d')]===_0x21d9('0x1c');var _0x63662b=_0xa02446[_0x21d9('0x1e')];var _0x1bff8e=_0x2fe46c?0x0:_0xa57e19[_0x21d9('0x1b')];var _0x802f5b=_0x2fe46c?_0xa02446[_0x21d9('0x1e')]:_0xa57e19['offset']+_0xa57e19[_0x21d9('0x1d')];var _0x4eec98;if(_0x802f5b>=_0x63662b){_0x802f5b=_0x63662b;_0x4eec98=0xc8;}else{_0x4eec98=0xce;}_0x2aa263[_0x21d9('0x18')](_0x4eec98);return _0x2aa263[_0x21d9('0x1f')](_0x21d9('0x20'),_0x1bff8e+'-'+_0x802f5b+'/'+_0x63662b)[_0x21d9('0x1a')](_0xa02446);}return null;};}function patchUpdates(_0x10efea){return function(_0x11d1f6){try{jsonpatch[_0x21d9('0x21')](_0x11d1f6,_0x10efea,!![]);}catch(_0xa80751){return BPromise['reject'](_0xa80751);}return _0x11d1f6[_0x21d9('0x22')]();};}function saveUpdates(_0x1de86b,_0x5e8051){return function(_0x505f57){if(_0x505f57){return _0x505f57[_0x21d9('0x23')](_0x1de86b)['then'](function(_0x2218b4){return _0x2218b4;});}return null;};}function removeEntity(_0x53cc15,_0x20c225){return function(_0x34d9d1){if(_0x34d9d1){return _0x34d9d1['destroy']()[_0x21d9('0x24')](function(){_0x53cc15['status'](0xcc)[_0x21d9('0x19')]();});}};}function handleEntityNotFound(_0x2e815c,_0x507bfc){return function(_0xecb669){if(!_0xecb669){_0x2e815c['sendStatus'](0x194);}return _0xecb669;};}function handleError(_0x6fdc9d,_0x29eb13){_0x29eb13=_0x29eb13||0x1f4;return function(_0x8c9a4a){logger['error'](_0x8c9a4a[_0x21d9('0x25')]);if(_0x8c9a4a['name']){delete _0x8c9a4a[_0x21d9('0x26')];}_0x6fdc9d[_0x21d9('0x18')](_0x29eb13)[_0x21d9('0x27')](_0x8c9a4a);};}function getInteractionUsers(_0x1a937c,_0x595169){return new BPromise(function(_0xeaf7e0,_0x331fc4){try{if(_0x595169[_0x1a937c['id']]){_0x1a937c[_0x21d9('0x28')]=_['map'](_0x595169[_0x1a937c['id']],function(_0x53cb4c){return{'id':_0x53cb4c['id'],'fullname':_0x53cb4c[_0x21d9('0x29')]};});}}catch(_0x1727d2){_0x331fc4(_0x1727d2);}_0xeaf7e0(_0x1a937c);});}function getInteractionTags(_0x1cbfce,_0x4eebff){return new BPromise(function(_0x2d4f94,_0x3f2319){try{if(_0x1cbfce[_0x21d9('0x2a')]){_0x1cbfce[_0x21d9('0x2b')]=[];_0x1cbfce[_0x21d9('0x2a')][_0x21d9('0x2c')](',')['forEach'](function(_0x217ab0){_0x1cbfce[_0x21d9('0x2b')][_0x21d9('0x2d')](_0x4eebff[_0x217ab0]);});}delete _0x1cbfce[_0x21d9('0x2a')];}catch(_0x1fe530){_0x3f2319(_0x1fe530);}_0x2d4f94(_0x1cbfce);});}function updateOpenchannelInteraction(_0x577008,_0x395762,_0xf6cf91){return new BPromise(function(_0x53d040,_0x1ef0c6){return getInteractionUsers(_0x577008,_0xf6cf91)['then'](function(_0x4d0226){return getInteractionTags(_0x4d0226,_0x395762);})['then'](function(_0x368811){return getStateInteraction(_0x368811);})['then'](function(_0x533c42){_0x53d040(_0x533c42);})[_0x21d9('0x2e')](function(_0x416a19){_0x1ef0c6(_0x416a19);});});}function getStateInteraction(_0x1eed15){return new BPromise(function(_0x2824e0){_0x1eed15[_0x21d9('0x2f')]=0x0;_0x1eed15[_0x21d9('0x30')]=0x0;_0x1eed15[_0x21d9('0x31')]=0x0;_0x1eed15['unmanaged']=0x0;_0x1eed15[_0x21d9('0x32')]=0x0;if(!_0x1eed15[_0x21d9('0x33')]&&!_0x1eed15['UserId']){_0x1eed15[_0x21d9('0x2f')]+=0x1;}if(!_0x1eed15['closed']&&_0x1eed15[_0x21d9('0x34')]){_0x1eed15[_0x21d9('0x30')]+=0x1;if(_0x1eed15[_0x21d9('0x2f')]){_0x1eed15[_0x21d9('0x2f')]-=0x1;}}if(_0x1eed15[_0x21d9('0x33')]&&_0x1eed15['UserId']){_0x1eed15[_0x21d9('0x31')]+=0x1;if(_0x1eed15[_0x21d9('0x30')]){_0x1eed15[_0x21d9('0x30')]-=0x1;}}if(_0x1eed15[_0x21d9('0x33')]&&!_0x1eed15[_0x21d9('0x34')]){_0x1eed15['unmanaged']+=0x1;if(_0x1eed15['waiting']){_0x1eed15['waiting']-=0x1;}}_0x1eed15['total']+=0x1;_0x2824e0(_0x1eed15);});}exports[_0x21d9('0x35')]=function(_0x2d915a,_0x285cb7){var _0x48ac43={},_0xeca65f={},_0x3aa661={'count':0x0,'rows':[]};var _0x56eca2=_[_0x21d9('0x36')](db[_0x21d9('0x37')][_0x21d9('0x38')],function(_0x2574ed){return{'name':_0x2574ed[_0x21d9('0x39')],'type':_0x2574ed['type'][_0x21d9('0x3a')]};});_0xeca65f[_0x21d9('0x3b')]=_['map'](_0x56eca2,_0x21d9('0x26'));_0xeca65f['query']=_[_0x21d9('0x3c')](_0x2d915a['query']);_0xeca65f[_0x21d9('0x3d')]=_[_0x21d9('0x3e')](_0xeca65f[_0x21d9('0x3b')],_0xeca65f[_0x21d9('0x3f')]);_0x48ac43[_0x21d9('0x40')]=_[_0x21d9('0x3e')](_0xeca65f['model'],qs[_0x21d9('0x41')](_0x2d915a['query'][_0x21d9('0x41')]));_0x48ac43[_0x21d9('0x40')]=_0x48ac43['attributes']['length']?_0x48ac43[_0x21d9('0x40')]:_0xeca65f['model'];if(!_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x42')](_0x21d9('0x43'))){_0x48ac43[_0x21d9('0x1d')]=qs[_0x21d9('0x1d')](_0x2d915a['query'][_0x21d9('0x1d')]);_0x48ac43['offset']=qs[_0x21d9('0x1b')](_0x2d915a[_0x21d9('0x3f')]['offset']);}_0x48ac43[_0x21d9('0x44')]=qs[_0x21d9('0x45')](_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x45')]);_0x48ac43[_0x21d9('0x46')]=qs['filters'](_[_0x21d9('0x47')](_0x2d915a[_0x21d9('0x3f')],_0xeca65f[_0x21d9('0x3d')]),_0x56eca2);var _0x24176f=[];var _0x53fb7f=squel[_0x21d9('0x48')]()[_0x21d9('0x49')]('id')['field'](_0x21d9('0x26'))[_0x21d9('0x49')]('color')['from']('tools_tags');var _0x4ade62=squel[_0x21d9('0x48')]()[_0x21d9('0x49')](_0x21d9('0x4a'))[_0x21d9('0x49')]('u.fullname')[_0x21d9('0x49')](_0x21d9('0x4b'))['from'](_0x21d9('0x4c'),'ui')[_0x21d9('0x4d')](_0x21d9('0x4e'),'u',_0x21d9('0x4f'));var _0x11d7f3=squel[_0x21d9('0x48')]()[_0x21d9('0x50')](_0x21d9('0x51'),'i')['left_join'](_0x21d9('0x52'),'c',_0x21d9('0x53'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x21d9('0x54'))[_0x21d9('0x4d')](_0x21d9('0x55'),'me',_0x21d9('0x56'))[_0x21d9('0x4d')](_0x21d9('0x57'),'it',_0x21d9('0x58'))['left_join'](_0x21d9('0x59'),'t',_0x21d9('0x5a'));var _0x47dfd6=squel[_0x21d9('0x5b')]();var _0x59b8be=[];var _0x316a64=squel[_0x21d9('0x5b')]();var _0x5cc49f;if(_0x2d915a['query'][_0x21d9('0x5c')]){_0x5cc49f=as[_0x21d9('0x5d')](_0x2d915a[_0x21d9('0x3f')]['search']);var _0x17380b=_0x5cc49f[_0x21d9('0x5e')];for(var _0x5b059b=0x0;_0x5b059b<_0x5cc49f[_0x21d9('0x5f')][_0x21d9('0x60')];_0x5b059b++){var _0x4b40a3=_0x5cc49f[_0x21d9('0x5f')][_0x5b059b];var _0xaca8e8='i';var _0x27ba59=_[_0x21d9('0x61')](_0x56eca2,['name',_0x4b40a3['field']]);if(!_0x27ba59){switch(_0x4b40a3[_0x21d9('0x49')]){case _0x21d9('0x62'):if(_0x4b40a3[_0x21d9('0x63')]==0x1){_0x11d7f3[_0x21d9('0x64')]('`'+_0x4b40a3['field']+_0x21d9('0x65'));}else{_0x11d7f3[_0x21d9('0x64')]('`'+_0x4b40a3[_0x21d9('0x49')]+_0x21d9('0x66'));}break;case _0x21d9('0x67'):if(_0x4b40a3[_0x21d9('0x68')]==='$substring'){if(_0x4b40a3[_0x21d9('0x63')][_0x21d9('0x2c')]('\x20')[_0x21d9('0x60')]>0x1){_0x47dfd6[_0x17380b](_0x21d9('0x69'),qs[_0x21d9('0x6a')](_0x4b40a3['value']),null);}else{var _0x4aa671='%'+_0x4b40a3[_0x21d9('0x63')]+'%';_0x47dfd6[_0x17380b](_0x21d9('0x6b'),_0x4aa671,_0x4aa671,_0x4aa671);}}else{_0x27ba59=_['find'](_0x56eca2,['name','ContactId']);_0x4b40a3['field']=_0x21d9('0x6c');_0x156b6d=as['buildExpression'](_0xaca8e8,_0x27ba59['type'],_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d['value']['start'],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x19')]);}break;case _0x21d9('0x6e'):var _0x2eba86=_0x4b40a3[_0x21d9('0x63')]['split'](',')[_0x21d9('0x36')](function(_0x8b516d){return Number(_0x8b516d);});_0x2eba86[_0x21d9('0x6f')](function(_0x3f9a6f){_0x316a64['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f9a6f+',%');});_0x59b8be=_[_0x21d9('0x70')](_0x59b8be,_0x2eba86);break;case'User':if(_0x4b40a3[_0x21d9('0x68')]===_0x21d9('0x71')){_0x47dfd6[_0x17380b](_0x21d9('0x72'),'%'+_0x4b40a3[_0x21d9('0x63')]+'%',null);}else{_0x27ba59=_[_0x21d9('0x61')](_0x56eca2,[_0x21d9('0x26'),_0x21d9('0x34')]);_0x4b40a3['field']=_0x21d9('0x34');_0x156b6d=as['buildExpression'](_0xaca8e8,_0x27ba59[_0x21d9('0x73')],_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x74')],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x19')]);}break;case _0x21d9('0x75'):_0x156b6d=as[_0x21d9('0x76')]('me',null,_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d[_0x21d9('0x63')]['start'],_0x156b6d['value'][_0x21d9('0x19')]);break;}}else{var _0x156b6d=as['buildExpression'](_0xaca8e8,_0x27ba59['type'],_0x4b40a3);_0x47dfd6[_0x17380b](_0x156b6d[_0x21d9('0x6d')],_0x156b6d['value'][_0x21d9('0x74')],_0x156b6d[_0x21d9('0x63')][_0x21d9('0x19')]);}}}else{var _0x3f3935=_(_0x2d915a[_0x21d9('0x3f')])[_0x21d9('0x3c')]()[_0x21d9('0x36')](function(_0x3375fe){return _[_0x21d9('0x77')](_0x56eca2,[_0x21d9('0x26'),_0x3375fe])?_0x3375fe:undefined;})[_0x21d9('0x78')]()[_0x21d9('0x63')]();if(!_[_0x21d9('0x79')](_0x3f3935)){_0x3f3935[_0x21d9('0x6f')](function(_0x507aa2){if(_0x507aa2===_0x21d9('0x7a')){_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x7b'),[][_0x21d9('0x7c')](_0x2d915a[_0x21d9('0x3f')][_0x507aa2]));}else if(_0x507aa2===_0x21d9('0x7d')){var _0x1a9a43=JSON['parse'](_0x2d915a[_0x21d9('0x3f')][_0x507aa2])[_0x21d9('0x7e')];var _0x560c71=JSON['parse'](_0x2d915a[_0x21d9('0x3f')][_0x507aa2])['$lte'];_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x7f'),_0x1a9a43,_0x560c71);}else{if(_0x2d915a[_0x21d9('0x3f')][_0x507aa2]===_0x21d9('0x80')){_0x11d7f3[_0x21d9('0x46')]('i.'+_0x507aa2+'\x20IS\x20NULL');}else{_0x11d7f3[_0x21d9('0x46')]('i.'+_0x507aa2+_0x21d9('0x81'),_0x2d915a['query'][_0x507aa2]);}}});}if(_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x82')]){if(_0x2d915a['query'][_0x21d9('0x82')]==0x1){_0x11d7f3['having'](_0x21d9('0x83'));}else{_0x11d7f3[_0x21d9('0x64')](_0x21d9('0x84'));}}if(_0x2d915a['query'][_0x21d9('0x85')]){_0x59b8be=_['isArray'](_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x85')])?_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x85')]:new Array(_0x2d915a[_0x21d9('0x3f')]['tag']);_0x59b8be[_0x21d9('0x6f')](function(_0x495222){_0x316a64['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x495222+',%');});}if(_0x2d915a[_0x21d9('0x3f')][_0x21d9('0x86')]){var _0x230295=_0x2d915a['query'][_0x21d9('0x86')][_0x21d9('0x87')]('\x5c','\x5c\x5c')[_0x21d9('0x87')](/'/g,'\x27\x27');if(qs[_0x21d9('0x88')](_0x230295)){_0x47dfd6['or'](_0x21d9('0x89'),_0x230295+'%');}else{_0x47dfd6['or'](_0x21d9('0x8a'),qs[_0x21d9('0x6a')](_0x230295))['or'](_0x21d9('0x8b'),_0x230295+'%')['or'](_0x21d9('0x8c'),_0x230295+'%');}}}_0x11d7f3['where'](_0x47dfd6);_0x11d7f3['group'](_0x21d9('0x8d'));var _0x5c8abc={'type':db[_0x21d9('0x8e')][_0x21d9('0x8f')]['SELECT'],'raw':!![]};var _0x359e79=_0x11d7f3[_0x21d9('0x90')]();_0x359e79[_0x21d9('0x49')](_0x21d9('0x8d'));_0x359e79['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x48ac43[_0x21d9('0x44')]){_0x48ac43[_0x21d9('0x44')][_0x21d9('0x6f')](function(_0x3f922a){var _0x3fe0e6=_0x3f922a[0x0]==='contactName'?_0x3f922a[0x0]:'i.'+_0x3f922a[0x0];_0x11d7f3['order'](_0x3fe0e6,_0x3f922a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x21d9('0x79')](_0x59b8be)){_0x11d7f3[_0x21d9('0x64')](_0x316a64);_0x359e79[_0x21d9('0x46')](_0x21d9('0x91'),_0x59b8be);}BPromise['resolve']()[_0x21d9('0x24')](function(){if(!_0x5cc49f){if(_0x2d915a[_0x21d9('0x3f')]['OpenchannelAccountId'])return;_0x359e79[_0x21d9('0x46')](_0x21d9('0x92'));_0x11d7f3[_0x21d9('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2d915a[_0x21d9('0x93')][_0x21d9('0x94')]!==_0x21d9('0x95'))return;return _0x2d915a[_0x21d9('0x93')][_0x21d9('0x96')]({'attributes':['id'],'raw':!![]})[_0x21d9('0x24')](function(_0xe326ce){if(_['isEmpty'](_0xe326ce)){_0x359e79['where'](_0x21d9('0x97'));_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x97'));}else{_0x359e79[_0x21d9('0x46')](_0x21d9('0x7b'),_['map'](_0xe326ce,'id'));_0x11d7f3[_0x21d9('0x46')](_0x21d9('0x7b'),_[_0x21d9('0x36')](_0xe326ce,'id'));}});})[_0x21d9('0x24')](function(){if(_0x2d915a[_0x21d9('0x93')][_0x21d9('0x94')]===_0x21d9('0x95')&&!_0x5cc49f&&!_0x2d915a[_0x21d9('0x3f')]['OpenchannelAccountId'])return[];return db[_0x21d9('0x98')]['query'](_0x359e79[_0x21d9('0x99')](),_0x5c8abc);})[_0x21d9('0x24')](function(_0x29df49){_0x3aa661[_0x21d9('0x1e')]=_0x29df49[_0x21d9('0x60')];if(_0x3aa661['count']===0x0)return[];return db[_0x21d9('0x98')][_0x21d9('0x3f')](_0x53fb7f['toString'](),_0x5c8abc)['then'](function(_0x1f86a1){_0x24176f=_['keyBy'](_0x1f86a1,'id');_0x5c8abc=_[_0x21d9('0x9a')](_0x5c8abc,{'model':db[_0x21d9('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d915a['query'][_0x21d9('0x41')]){_0x48ac43[_0x21d9('0x40')][_0x21d9('0x6f')](function(_0x36cb88){_0x11d7f3[_0x21d9('0x49')]('i.'+_0x36cb88);});}else{_0x11d7f3[_0x21d9('0x49')](_0x21d9('0x9b'),'unreadMessages');_0x11d7f3[_0x21d9('0x49')]('a.key',_0x21d9('0x9c'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0x9d'),'Account.mandatoryDisposition');_0x11d7f3[_0x21d9('0x49')](_0x21d9('0x9e'),_0x21d9('0x9f'));_0x11d7f3[_0x21d9('0x49')]('i.*');_0x11d7f3['field']('c.firstName',_0x21d9('0xa0'));_0x11d7f3['field']('c.lastName',_0x21d9('0xa1'));_0x11d7f3[_0x21d9('0x49')]('c.email',_0x21d9('0xa2'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0xa3'),_0x21d9('0xa4'));_0x11d7f3[_0x21d9('0x49')]('c.mobile',_0x21d9('0xa5'));_0x11d7f3['field'](_0x21d9('0xa6'),_0x21d9('0xa7'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0xa8'),_0x21d9('0xa9'));_0x11d7f3[_0x21d9('0x49')](_0x21d9('0xaa'),_0x21d9('0xab'));_0x11d7f3[_0x21d9('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x21d9('0x2a'));}if(_0x48ac43[_0x21d9('0x1d')])_0x11d7f3[_0x21d9('0x1d')](_0x48ac43[_0x21d9('0x1d')]);if(_0x48ac43[_0x21d9('0x1b')])_0x11d7f3[_0x21d9('0x1b')](_0x48ac43[_0x21d9('0x1b')]);return db['sequelize'][_0x21d9('0x3f')](_0x11d7f3['toString'](),_0x5c8abc);})[_0x21d9('0x24')](function(_0x17bc36){if(_0x17bc36[_0x21d9('0x60')]>0x0)_0x4ade62[_0x21d9('0x46')](_0x21d9('0xac'),_['map'](_0x17bc36,'id'));return db['sequelize']['query'](_0x4ade62[_0x21d9('0x99')](),_0x5c8abc)[_0x21d9('0x24')](function(_0x38d2e4){var _0x923bb6=_['groupBy'](_0x38d2e4,'OpenchannelInteractionId');var _0x1ea022=[];_0x17bc36['forEach'](function(_0x5d79cd){_0x1ea022[_0x21d9('0x2d')](updateOpenchannelInteraction(_0x5d79cd,_0x24176f,_0x923bb6));});return BPromise[_0x21d9('0xad')](_0x1ea022);});});})[_0x21d9('0x24')](function(_0x3bbf93){_0x3aa661[_0x21d9('0xae')]=_0x3bbf93;return _0x3aa661;})['then'](respondWithFilteredResult(_0x285cb7,_0x48ac43))['catch'](handleError(_0x285cb7,null));};exports['show']=function(_0x4d8656,_0x480892){var _0x378867={};if(_0x4d8656[_0x21d9('0x3f')][_0x21d9('0x73')]&&_0x4d8656[_0x21d9('0x3f')][_0x21d9('0x73')]===_0x21d9('0x50')){_0x378867[_0x21d9('0x50')]=_0x4d8656['params']['id'];}else{_0x378867['id']=_0x4d8656['params']['id'];}var _0x4f3dfe={'raw':![],'where':_0x378867},_0x230443={};_0x230443['model']=_[_0x21d9('0x3c')](db[_0x21d9('0x37')][_0x21d9('0x38')]);_0x230443[_0x21d9('0x3f')]=_['keys'](_0x4d8656[_0x21d9('0x3f')]);_0x230443['filters']=_['intersection'](_0x230443[_0x21d9('0x3b')],_0x230443[_0x21d9('0x3f')]);_0x4f3dfe[_0x21d9('0x40')]=_[_0x21d9('0x3e')](_0x230443[_0x21d9('0x3b')],qs[_0x21d9('0x41')](_0x4d8656[_0x21d9('0x3f')][_0x21d9('0x41')]));_0x4f3dfe['attributes']=_0x4f3dfe['attributes'][_0x21d9('0x60')]?_0x4f3dfe[_0x21d9('0x40')]:_0x230443[_0x21d9('0x3b')];if(_0x4d8656['query']['includeAll']){_0x4f3dfe['include']=[{'all':!![]}];}_0x4f3dfe=_['merge']({},_0x4f3dfe,_0x4d8656[_0x21d9('0xaf')]);return db[_0x21d9('0x37')][_0x21d9('0x61')](_0x4f3dfe)[_0x21d9('0x24')](handleEntityNotFound(_0x480892,null))['then'](respondWithResult(_0x480892,null))[_0x21d9('0x2e')](handleError(_0x480892,null));};exports[_0x21d9('0xb0')]=function(_0x19e36f,_0x5200a1){return db[_0x21d9('0x37')][_0x21d9('0xb0')](_0x19e36f[_0x21d9('0x75')],{})[_0x21d9('0x24')](respondWithResult(_0x5200a1,0xc9))[_0x21d9('0x2e')](handleError(_0x5200a1,null));};exports[_0x21d9('0x23')]=function(_0x390c90,_0x1eb3b9){if(_0x390c90[_0x21d9('0x75')]['id']){delete _0x390c90[_0x21d9('0x75')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x390c90['params']['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x1eb3b9,null))[_0x21d9('0x24')](saveUpdates(_0x390c90[_0x21d9('0x75')],null))[_0x21d9('0x24')](respondWithResult(_0x1eb3b9,null))[_0x21d9('0x2e')](handleError(_0x1eb3b9,null));};exports[_0x21d9('0xb1')]=function(_0x560191,_0x5be64f){return db[_0x21d9('0x37')]['find']({'where':{'id':_0x560191[_0x21d9('0xb2')]['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x5be64f,null))['then'](removeEntity(_0x5be64f,null))[_0x21d9('0x2e')](handleError(_0x5be64f,null));};exports[_0x21d9('0xb3')]=function(_0x9409ef,_0x42e2c9){return db[_0x21d9('0x37')][_0x21d9('0xb3')]()[_0x21d9('0x24')](respondWithResult(_0x42e2c9,null))[_0x21d9('0x2e')](handleError(_0x42e2c9,null));};exports[_0x21d9('0xb4')]=function(_0x3a544d,_0x3b891d,_0x16411e){return db['OpenchannelMessage']['find']({'where':{'id':_0x3a544d['params']['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x3b891d,null))[_0x21d9('0x24')](function(_0x434bf1){if(_0x434bf1){return _0x434bf1[_0x21d9('0xb4')](_0x3a544d[_0x21d9('0x75')]['ids'],_[_0x21d9('0xb5')](_0x3a544d[_0x21d9('0x75')],[_0x21d9('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x3b891d,null))[_0x21d9('0x2e')](handleError(_0x3b891d,null));};exports[_0x21d9('0xb7')]=function(_0x5aeceb,_0xf719db,_0x3aadca){var _0x5160f3={'raw':![],'where':{}};var _0x251d07={};var _0x39d96a={'count':0x0,'rows':[]};return db[_0x21d9('0x37')][_0x21d9('0xb8')]({'where':{'id':_0x5aeceb[_0x21d9('0xb2')]['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0xf719db,null))[_0x21d9('0x24')](function(_0x49a03c){if(_0x49a03c){_0x251d07['model']=_['keys'](db[_0x21d9('0xb9')][_0x21d9('0x38')]);_0x251d07[_0x21d9('0x3f')]=_['keys'](_0x5aeceb['query']);_0x251d07[_0x21d9('0x3d')]=_[_0x21d9('0x3e')](_0x251d07[_0x21d9('0x3b')],_0x251d07['query']);_0x5160f3['attributes']=_['intersection'](_0x251d07[_0x21d9('0x3b')],qs[_0x21d9('0x41')](_0x5aeceb[_0x21d9('0x3f')]['fields']));_0x5160f3['attributes']=_0x5160f3[_0x21d9('0x40')][_0x21d9('0x60')]?_0x5160f3['attributes']:_0x251d07[_0x21d9('0x3b')];if(!_0x5aeceb['query'][_0x21d9('0x42')]('nolimit')){_0x5160f3[_0x21d9('0x1d')]=qs[_0x21d9('0x1d')](_0x5aeceb[_0x21d9('0x3f')][_0x21d9('0x1d')]);_0x5160f3[_0x21d9('0x1b')]=qs[_0x21d9('0x1b')](_0x5aeceb[_0x21d9('0x3f')]['offset']);}_0x5160f3[_0x21d9('0x44')]=qs[_0x21d9('0x45')](_0x5aeceb[_0x21d9('0x3f')][_0x21d9('0x45')]);_0x5160f3['where']=qs[_0x21d9('0x3d')](_[_0x21d9('0x47')](_0x5aeceb[_0x21d9('0x3f')],_0x251d07[_0x21d9('0x3d')]));_0x5160f3[_0x21d9('0x46')]['OpenchannelInteractionId']=_0x49a03c['id'];if(_0x5aeceb[_0x21d9('0x3f')][_0x21d9('0x86')]){_0x5160f3['where']=_[_0x21d9('0x9a')](_0x5160f3['where'],{'$or':_[_0x21d9('0x36')](_0x5160f3[_0x21d9('0x40')],function(_0x6ba596){var _0x4675a9={};_0x4675a9[_0x6ba596]={'$like':'%'+_0x5aeceb['query']['filter']+'%'};return _0x4675a9;})});}if(_0x5aeceb['query'][_0x21d9('0x7e')]){var _0x4cf3b1=_0x5aeceb['query'][_0x21d9('0x7e')][_0x21d9('0x2c')](',');var _0x4f540f={};_0x4f540f[_0x4cf3b1[0x0]]={'$gte':moment(_0x4cf3b1[0x1])[_0x21d9('0xba')](_0x21d9('0xbb'))};_0x5160f3[_0x21d9('0x46')]=_[_0x21d9('0x9a')](_0x5160f3[_0x21d9('0x46')],_0x4f540f);}_0x5160f3=_[_0x21d9('0x9a')]({},_0x5160f3,_0x5aeceb[_0x21d9('0xaf')]);return db[_0x21d9('0xb9')][_0x21d9('0x1e')]({'where':_0x5160f3['where']})[_0x21d9('0x24')](function(_0x52659c){_0x39d96a['count']=_0x52659c;if(_0x5aeceb[_0x21d9('0x3f')]['includeAll']){_0x5160f3['include']=[{'all':!![]}];}return db[_0x21d9('0xb9')][_0x21d9('0xbc')](_0x5160f3);})[_0x21d9('0x24')](function(_0x31237b){_0x39d96a[_0x21d9('0xae')]=_0x31237b;return _0x39d96a;});}})[_0x21d9('0x24')](respondWithFilteredResult(_0xf719db,_0x5160f3))[_0x21d9('0x2e')](handleError(_0xf719db,null));};exports[_0x21d9('0xbd')]=function(_0x43a30d,_0x1af019,_0x344458){return db[_0x21d9('0x37')][_0x21d9('0x61')]({'where':{'id':_0x43a30d[_0x21d9('0xb2')]['id']}})[_0x21d9('0x24')](handleEntityNotFound(_0x1af019,null))[_0x21d9('0x24')](function(_0x5eaaf5){if(_0x5eaaf5){return _0x5eaaf5['setTags'](_0x43a30d[_0x21d9('0x75')][_0x21d9('0xb6')],_[_0x21d9('0xb5')](_0x43a30d[_0x21d9('0x75')],[_0x21d9('0xb6'),'id'])||{})[_0x21d9('0xbe')](function(){return db['Tag'][_0x21d9('0xbc')]({'attributes':['id',_0x21d9('0x26'),'color'],'where':{'id':_0x43a30d['body'][_0x21d9('0xb6')]}});})[_0x21d9('0x24')](function(_0x2b7e7b){socket[_0x21d9('0xbf')]('openchannelInteractionTags:save',{'id':Number(_0x43a30d[_0x21d9('0xb2')]['id']),'tags':_0x2b7e7b||[]});return{'id':Number(_0x43a30d['params']['id']),'tags':_0x2b7e7b||[]};});}})[_0x21d9('0x24')](respondWithResult(_0x1af019,null))['catch'](handleError(_0x1af019,null));};exports['removeTags']=function(_0x4a35e7,_0xa862c8,_0x490e71){return db[_0x21d9('0x37')][_0x21d9('0x61')]({'where':{'id':_0x4a35e7[_0x21d9('0xb2')]['id']}})['then'](handleEntityNotFound(_0xa862c8,null))[_0x21d9('0x24')](function(_0x7bd763){if(_0x7bd763){return _0x7bd763[_0x21d9('0xc0')](_0x4a35e7[_0x21d9('0x3f')][_0x21d9('0xb6')]);}})[_0x21d9('0x24')](respondWithStatusCode(_0xa862c8,null))[_0x21d9('0x2e')](handleError(_0xa862c8,null));};exports[_0x21d9('0xc1')]=function(_0x74fb19,_0x4d2bed){var _0x3eb03b=moment()[_0x21d9('0xc2')]()[_0x21d9('0x99')]();var _0x4799f3=path[_0x21d9('0xc3')](config[_0x21d9('0xc4')],_0x21d9('0xc5'),_0x21d9('0xc6'),'tmp');var _0x1e0b66=path[_0x21d9('0xc3')](config[_0x21d9('0xc4')],_0x21d9('0xc5'),'files','attachments');var _0x5633ab=path['join'](_0x4799f3,_0x3eb03b);var _0x283c9f=util[_0x21d9('0xba')](_0x21d9('0xc7'),_0x74fb19[_0x21d9('0xb2')]['id'],_0x3eb03b);var _0x4d7a0b=path[_0x21d9('0xc3')](_0x4799f3,_0x283c9f);var _0x33fd93=[];_0x33fd93[_0x21d9('0x2d')]({'model':db[_0x21d9('0xc8')],'as':_0x21d9('0xc8'),'attributes':['id',_0x21d9('0x29')],'raw':!![]});_0x33fd93[_0x21d9('0x2d')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x21d9('0xc9'),_0x21d9('0xca')],'raw':!![]});if(_0x74fb19[_0x21d9('0x3f')][_0x21d9('0xcb')]){_0x33fd93[_0x21d9('0x2d')]({'model':db[_0x21d9('0xcc')],'as':'Attachment','raw':!![]});}var _0x512211=[{'model':db[_0x21d9('0xb9')],'as':_0x21d9('0xcd'),'attributes':['id',_0x21d9('0x75'),_0x21d9('0x7d'),_0x21d9('0xce'),_0x21d9('0xcf'),_0x21d9('0x82')],'include':_0x33fd93}];_0x512211[_0x21d9('0x2d')]({'model':db[_0x21d9('0xd0')],'as':'Account','attributes':['id',_0x21d9('0x26')]});_0x512211[_0x21d9('0x2d')]({'model':db[_0x21d9('0xc8')],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction']['find']({'where':{'id':_0x74fb19[_0x21d9('0xb2')]['id']},'include':_0x512211})[_0x21d9('0x24')](handleEntityNotFound(_0x4d2bed,null))[_0x21d9('0x24')](function(_0xd8a25){if(_0xd8a25){var _0x2d5cd0=_0xd8a25[_0x21d9('0xd1')]({'plain':!![]});fs[_0x21d9('0xd2')](_0x5633ab);var _0x2505c6={'channel':_0x21d9('0xd3'),'account':_0x2d5cd0[_0x21d9('0xd4')][_0x21d9('0x26')],'agent':_0x2d5cd0['Owner']?_0x2d5cd0['Owner'][_0x21d9('0x29')]:_0x21d9('0xd5'),'createdAt':moment(_0x2d5cd0[_0x21d9('0x7d')])[_0x21d9('0xba')](_0x21d9('0xbb'))[_0x21d9('0x99')](),'closedAt':_0x2d5cd0[_0x21d9('0x33')]?moment(_0x2d5cd0[_0x21d9('0xd6')])['format'](_0x21d9('0xbb'))[_0x21d9('0x99')]():'','disposition':_0x2d5cd0[_0x21d9('0xd7')],'visibility':_0x2d5cd0[_0x21d9('0xd8')]?_0x21d9('0xd9'):_0x21d9('0xda'),'messages':_(_0x2d5cd0[_0x21d9('0xcd')])[_0x21d9('0x86')]({'secret':![]})[_0x21d9('0x36')](function(_0x5a0d13){if(_0x5a0d13['Attachment']){var _0x1e83af=path['join'](_0x1e0b66,_0x5a0d13['Attachment'][_0x21d9('0xdb')]);if(fs['existsSync'](_0x1e83af)){fs['createReadStream'](_0x1e83af)['pipe'](fs[_0x21d9('0xdc')](path[_0x21d9('0xc3')](_0x5633ab,_0x5a0d13['Attachment'][_0x21d9('0xdb')])));}}return{'date':moment(_0x5a0d13[_0x21d9('0x7d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x21d9('0x99')](),'sender':_0x5a0d13[_0x21d9('0xce')]===_0x21d9('0xdd')?_0x5a0d13['User']?_0x5a0d13[_0x21d9('0xc8')][_0x21d9('0x29')]:_0x21d9('0xde'):_0x5a0d13['Contact'][_0x21d9('0xc9')]+(_0x5a0d13[_0x21d9('0x67')]['lastName']?'\x20'+_0x5a0d13['Contact']['lastName']:''),'body':_0x5a0d13[_0x21d9('0xcc')]?_0x5a0d13['Attachment'][_0x21d9('0xdb')]:_0x5a0d13['body'],'direction':_0x5a0d13[_0x21d9('0xce')]===_0x21d9('0xdd')?'A':'C','secret':_0x5a0d13[_0x21d9('0xcf')],'read':_0x5a0d13[_0x21d9('0x82')],'attachment':_0x5a0d13[_0x21d9('0xcc')]};})[_0x21d9('0x63')]()};return ejs['renderFile'](path[_0x21d9('0xc3')](config[_0x21d9('0xc4')],'server',_0x21d9('0xdf'),'downloadInteraction.ejs'),{'interaction':_0x2505c6})[_0x21d9('0x24')](function(_0x5454a0){var _0x1a8de3=path['join'](_0x5633ab,_0x21d9('0xe0')+_0x2d5cd0['id']+'-'+_0x3eb03b+_0x21d9('0xe1'));var _0x280bee={'path':_0x1a8de3,'channel':'Openchannel','interactionId':_0x2d5cd0['id']};return pdf[_0x21d9('0xe2')](_0x5454a0,_0x280bee);})['then'](function(){return new BPromise(function(_0x2a3a1f,_0x1a814f){zipdir(_0x5633ab,{'saveTo':_0x4d7a0b},function(_0x8bb7c2,_0x160ce4){if(_0x8bb7c2)return _0x1a814f(_0x8bb7c2);return _0x2a3a1f(_0x160ce4);});})['then'](function(){return new BPromise(function(_0x2ddb06,_0x52bdad){rimraf(_0x5633ab,function(_0x3c3c67){if(_0x3c3c67)_0x52bdad(_0x3c3c67);return _0x2ddb06();});});})[_0x21d9('0x24')](function(){return _0x4d2bed[_0x21d9('0xc1')](_0x4d7a0b,_0x283c9f,function(_0x2b93d0){if(_0x2b93d0){console[_0x21d9('0xe3')]('err',_0x2b93d0);}else{fs[_0x21d9('0xe4')](_0x4d7a0b);}});});});}else{return _0x4d2bed['sendStatus'](0xc8);}})[_0x21d9('0x2e')](handleError(_0x4d2bed,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0f7d8d9..1ca888e 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 _0xf312=['exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','catch','hasOwnProperty','hook'];(function(_0x331ade,_0x149e32){var _0x495b12=function(_0xc28d12){while(--_0xc28d12){_0x331ade['push'](_0x331ade['shift']());}};_0x495b12(++_0x149e32);}(_0xf312,0x122));var _0x2f31=function(_0x35a60d,_0xf78a38){_0x35a60d=_0x35a60d-0x0;var _0x544247=_0xf312[_0x35a60d];return _0x544247;};'use strict';var EventEmitter=require(_0x2f31('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x2f31('0x1')];var OpenchannelMessage=require(_0x2f31('0x2'))['db'][_0x2f31('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2f31('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f31('0x5'),'afterDestroy':'remove'};function emitEvent(_0x19cca7){return function(_0x63ad79,_0xf2706b,_0x5f0b74){_0x63ad79[_0x2f31('0x6')]({'attributes':['id'],'raw':!![]})[_0x2f31('0x7')](function(_0x127601){_0x63ad79[_0x2f31('0x8')](_0x2f31('0x9'),_0x127601['map'](function(_0x2d81e9){return{'id':_0x2d81e9['id']};}));return OpenchannelMessage[_0x2f31('0xa')]({'where':{'OpenchannelInteractionId':_0x63ad79['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2f31('0x7')](function(_0x510f3f){_0x63ad79[_0x2f31('0x8')](_0x2f31('0xb'),_0x510f3f[_0x2f31('0xc')]);OpenchannelInteractionEvents['emit'](_0x19cca7+':'+_0x63ad79['id'],_0x63ad79);OpenchannelInteractionEvents['emit'](_0x19cca7,_0x63ad79);_0x5f0b74(null);})[_0x2f31('0xd')](_0x5f0b74(null));};}for(var e in events){if(events[_0x2f31('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x2f31('0xf')](e,emitEvent(event));}}module[_0x2f31('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5791=['unreadMessages','emit','catch','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue'];(function(_0x147c96,_0x309657){var _0x4ec711=function(_0x3cf7c9){while(--_0x3cf7c9){_0x147c96['push'](_0x147c96['shift']());}};_0x4ec711(++_0x309657);}(_0x5791,0x114));var _0x1579=function(_0x2ed502,_0x3b7fab){_0x2ed502=_0x2ed502-0x0;var _0x191886=_0x5791[_0x2ed502];return _0x191886;};'use strict';var EventEmitter=require(_0x1579('0x0'));var OpenchannelInteraction=require(_0x1579('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x1579('0x1'))['db'][_0x1579('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1579('0x3')](0x0);var events={'afterCreate':_0x1579('0x4'),'afterUpdate':_0x1579('0x5'),'afterDestroy':_0x1579('0x6')};function emitEvent(_0x26299d){return function(_0x418bce,_0x346209,_0xa766b2){_0x418bce[_0x1579('0x7')]({'attributes':['id'],'raw':!![]})[_0x1579('0x8')](function(_0x330085){_0x418bce['setDataValue']('Users',_0x330085[_0x1579('0x9')](function(_0x5c4bf5){return{'id':_0x5c4bf5['id']};}));return OpenchannelMessage[_0x1579('0xa')]({'where':{'OpenchannelInteractionId':_0x418bce['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x957e54){_0x418bce[_0x1579('0xb')](_0x1579('0xc'),_0x957e54['length']);OpenchannelInteractionEvents[_0x1579('0xd')](_0x26299d+':'+_0x418bce['id'],_0x418bce);OpenchannelInteractionEvents[_0x1579('0xd')](_0x26299d,_0x418bce);_0xa766b2(null);})[_0x1579('0xe')](_0xa766b2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1579('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index d109f9c..664fe07 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 _0xc213=['path','rimraf','../../config/environment','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc213,0x19b));var _0x3c21=function(_0xa54d53,_0x5b0c2b){_0xa54d53=_0xa54d53-0x0;var _0x4d0081=_0xc213[_0xa54d53];return _0x4d0081;};'use strict';var _=require(_0x3c21('0x0'));var util=require(_0x3c21('0x1'));var logger=require(_0x3c21('0x2'))(_0x3c21('0x3'));var moment=require(_0x3c21('0x4'));var BPromise=require(_0x3c21('0x5'));var rp=require(_0x3c21('0x6'));var fs=require('fs');var path=require(_0x3c21('0x7'));var rimraf=require(_0x3c21('0x8'));var config=require(_0x3c21('0x9'));var attributes=require('./openchannelInteraction.attributes');module[_0x3c21('0xa')]=function(_0x41ad9e,_0x2f94f6){return _0x41ad9e[_0x3c21('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x3c21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c21('0xd'),'collate':_0x3c21('0xe'),'hooks':{'beforeUpdate':function(_0x2502f9,_0x22836a,_0x5abcbc){if(_0x2502f9[_0x3c21('0xf')]('closed')){_0x2502f9[_0x3c21('0x10')]=moment()[_0x3c21('0x11')](_0x3c21('0x12'));}_0x5abcbc(null,_0x2502f9);}}});}; \ No newline at end of file +var _0xb89a=['format','YYYY-MM-DD\x20HH:mm:ss','util','api','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x287a34,_0x1f8f03){var _0x45f5e2=function(_0x164b96){while(--_0x164b96){_0x287a34['push'](_0x287a34['shift']());}};_0x45f5e2(++_0x1f8f03);}(_0xb89a,0xd4));var _0xab89=function(_0x5a27fe,_0x43993b){_0x5a27fe=_0x5a27fe-0x0;var _0x121c88=_0xb89a[_0x5a27fe];return _0x121c88;};'use strict';var _=require('lodash');var util=require(_0xab89('0x0'));var logger=require('../../config/logger')(_0xab89('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab89('0x2'));var fs=require('fs');var path=require(_0xab89('0x3'));var rimraf=require('rimraf');var config=require(_0xab89('0x4'));var attributes=require(_0xab89('0x5'));module[_0xab89('0x6')]=function(_0x5a938b,_0x2b8c85){return _0x5a938b[_0xab89('0x7')]('OpenchannelInteraction',attributes,{'tableName':_0xab89('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab89('0x9'),'collate':_0xab89('0xa'),'hooks':{'beforeUpdate':function(_0x3633d3,_0x33641b,_0x83a246){if(_0x3633d3[_0xab89('0xb')]('closed')){_0x3633d3['closedAt']=moment()[_0xab89('0xc')](_0xab89('0xd'));}_0x83a246(null,_0x3633d3);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 8e2df5f..d86cd69 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 _0x479f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','body','options','where','attributes','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x479f,0x7a));var _0xf479=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x479f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf479('0x0'));var util=require(_0xf479('0x1'));var moment=require(_0xf479('0x2'));var BPromise=require(_0xf479('0x3'));var rs=require(_0xf479('0x4'));var fs=require('fs');var Redis=require(_0xf479('0x5'));var db=require(_0xf479('0x6'))['db'];var utils=require(_0xf479('0x7'));var logger=require(_0xf479('0x8'))(_0xf479('0x9'));var config=require(_0xf479('0xa'));var jayson=require(_0xf479('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xf479('0xc')]=_['defaults'](config[_0xf479('0xc')],{'host':_0xf479('0xd'),'port':0x18eb});var socket=require(_0xf479('0xe'))(new Redis(config['redis']));require(_0xf479('0xf'))[_0xf479('0x10')](socket);function respondWithRpcPromise(_0x95ca15,_0x3e86ad,_0x770b1c){return new BPromise(function(_0x58203c,_0xb253b0){return client[_0xf479('0x11')](_0x95ca15,_0x770b1c)[_0xf479('0x12')](function(_0x55ef54){logger['info'](_0xf479('0x13'),_0x3e86ad,_0xf479('0x14'));logger[_0xf479('0x15')](_0xf479('0x16'),_0x3e86ad,'request\x20sent',JSON[_0xf479('0x17')](_0x55ef54));if(_0x55ef54[_0xf479('0x18')]){if(_0x55ef54['error'][_0xf479('0x19')]===0x1f4){logger[_0xf479('0x18')](_0xf479('0x13'),_0x3e86ad,_0x55ef54[_0xf479('0x18')][_0xf479('0x1a')]);return _0xb253b0(_0x55ef54[_0xf479('0x18')]['message']);}logger[_0xf479('0x18')](_0xf479('0x13'),_0x3e86ad,_0x55ef54[_0xf479('0x18')][_0xf479('0x1a')]);return _0x58203c(_0x55ef54[_0xf479('0x18')]['message']);}else{logger[_0xf479('0x1b')](_0xf479('0x13'),_0x3e86ad,_0xf479('0x14'));_0x58203c(_0x55ef54[_0xf479('0x1c')][_0xf479('0x1a')]);}})['catch'](function(_0x4488ef){logger['error'](_0xf479('0x13'),_0x3e86ad,_0x4488ef);_0xb253b0(_0x4488ef);});});}exports['UpdateOpenchannelInteraction']=function(_0xa5da8a){var _0xcecde=this;return new Promise(function(_0x12d255,_0x31358f){return db['OpenchannelInteraction'][_0xf479('0x1d')](_0xa5da8a[_0xf479('0x1e')],{'raw':_0xa5da8a['options']?_0xa5da8a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa5da8a[_0xf479('0x1f')]?_0xa5da8a['options'][_0xf479('0x20')]||null:null,'attributes':_0xa5da8a[_0xf479('0x1f')]?_0xa5da8a['options'][_0xf479('0x21')]||null:null,'limit':_0xa5da8a[_0xf479('0x1f')]?_0xa5da8a['options'][_0xf479('0x22')]||null:null})[_0xf479('0x12')](function(_0xf99a5c){logger[_0xf479('0x1b')]('UpdateOpenchannelInteraction',_0xa5da8a);logger[_0xf479('0x15')](_0xf479('0x23'),_0xa5da8a,JSON[_0xf479('0x17')](_0xf99a5c));_0x12d255(_0xf99a5c);})[_0xf479('0x24')](function(_0xdfe9cc){logger[_0xf479('0x18')](_0xf479('0x23'),_0xdfe9cc[_0xf479('0x1a')],_0xa5da8a);_0x31358f(_0xcecde[_0xf479('0x18')](0x1f4,_0xdfe9cc[_0xf479('0x1a')]));});});};exports[_0xf479('0x25')]=function(_0x1a4241){return new Promise(function(_0x3f0570,_0x55ff9c){return db[_0xf479('0x26')]['find']({'where':_0x1a4241[_0xf479('0x1f')]?_0x1a4241[_0xf479('0x1f')][_0xf479('0x20')]||null:null})[_0xf479('0x12')](function(_0x4e38f6){if(_0x4e38f6){return _0x4e38f6[_0xf479('0x27')](_0x1a4241[_0xf479('0x1e')]['ids'],_[_0xf479('0x28')](_0x1a4241[_0xf479('0x1e')],[_0xf479('0x29'),'id'])||{});}})['spread'](function(_0x5b0fd2){logger[_0xf479('0x1b')](_0xf479('0x2a'),_0x1a4241);logger[_0xf479('0x15')](_0xf479('0x2a'),_0x1a4241,JSON['stringify'](_0x5b0fd2));_0x3f0570(_0x5b0fd2);})['catch'](function(_0x3c5a77){logger[_0xf479('0x18')]('AddTags',_0x3c5a77[_0xf479('0x1a')],_0x1a4241);_0x55ff9c(_this['error'](0x1f4,_0x3c5a77[_0xf479('0x1a')]));});});}; \ No newline at end of file +var _0x34df=['where','attributes','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','OpenchannelInteraction','update','body','options','raw'];(function(_0x533d0a,_0x35c5e8){var _0x522822=function(_0x1dd447){while(--_0x1dd447){_0x533d0a['push'](_0x533d0a['shift']());}};_0x522822(++_0x35c5e8);}(_0x34df,0x90));var _0xf34d=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x34df[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0xf34d('0x0'));var util=require(_0xf34d('0x1'));var moment=require(_0xf34d('0x2'));var BPromise=require(_0xf34d('0x3'));var rs=require(_0xf34d('0x4'));var fs=require('fs');var Redis=require(_0xf34d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf34d('0x6'));var logger=require(_0xf34d('0x7'))(_0xf34d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf34d('0x9'));var client=jayson['client'][_0xf34d('0xa')]({'port':0x232a});config[_0xf34d('0xb')]=_[_0xf34d('0xc')](config[_0xf34d('0xb')],{'host':_0xf34d('0xd'),'port':0x18eb});var socket=require(_0xf34d('0xe'))(new Redis(config[_0xf34d('0xb')]));require(_0xf34d('0xf'))['register'](socket);function respondWithRpcPromise(_0x2cd476,_0x19e4c6,_0x1c4ba1){return new BPromise(function(_0x5c96c4,_0x332651){return client['request'](_0x2cd476,_0x1c4ba1)[_0xf34d('0x10')](function(_0x8a0545){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x19e4c6,_0xf34d('0x11'));logger[_0xf34d('0x12')](_0xf34d('0x13'),_0x19e4c6,_0xf34d('0x11'),JSON[_0xf34d('0x14')](_0x8a0545));if(_0x8a0545['error']){if(_0x8a0545[_0xf34d('0x15')][_0xf34d('0x16')]===0x1f4){logger[_0xf34d('0x15')](_0xf34d('0x17'),_0x19e4c6,_0x8a0545['error'][_0xf34d('0x18')]);return _0x332651(_0x8a0545['error'][_0xf34d('0x18')]);}logger[_0xf34d('0x15')](_0xf34d('0x17'),_0x19e4c6,_0x8a0545['error'][_0xf34d('0x18')]);return _0x5c96c4(_0x8a0545[_0xf34d('0x15')]['message']);}else{logger[_0xf34d('0x19')](_0xf34d('0x17'),_0x19e4c6,_0xf34d('0x11'));_0x5c96c4(_0x8a0545[_0xf34d('0x1a')][_0xf34d('0x18')]);}})['catch'](function(_0xce7209){logger[_0xf34d('0x15')](_0xf34d('0x17'),_0x19e4c6,_0xce7209);_0x332651(_0xce7209);});});}exports['UpdateOpenchannelInteraction']=function(_0x2a386c){var _0x1d4e83=this;return new Promise(function(_0x37ff01,_0x3670c9){return db[_0xf34d('0x1b')][_0xf34d('0x1c')](_0x2a386c[_0xf34d('0x1d')],{'raw':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c['options'][_0xf34d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c['options'][_0xf34d('0x20')]||null:null,'attributes':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c[_0xf34d('0x1e')][_0xf34d('0x21')]||null:null,'limit':_0x2a386c[_0xf34d('0x1e')]?_0x2a386c[_0xf34d('0x1e')][_0xf34d('0x22')]||null:null})['then'](function(_0x324036){logger[_0xf34d('0x19')](_0xf34d('0x23'),_0x2a386c);logger[_0xf34d('0x12')](_0xf34d('0x23'),_0x2a386c,JSON[_0xf34d('0x14')](_0x324036));_0x37ff01(_0x324036);})[_0xf34d('0x24')](function(_0x335632){logger['error'](_0xf34d('0x23'),_0x335632[_0xf34d('0x18')],_0x2a386c);_0x3670c9(_0x1d4e83['error'](0x1f4,_0x335632[_0xf34d('0x18')]));});});};exports[_0xf34d('0x25')]=function(_0x23009e){return new Promise(function(_0x3616aa,_0x2f8ea9){return db['OpenchannelInteraction'][_0xf34d('0x26')]({'where':_0x23009e[_0xf34d('0x1e')]?_0x23009e['options'][_0xf34d('0x20')]||null:null})[_0xf34d('0x10')](function(_0x280889){if(_0x280889){return _0x280889[_0xf34d('0x27')](_0x23009e[_0xf34d('0x1d')][_0xf34d('0x28')],_[_0xf34d('0x29')](_0x23009e['body'],[_0xf34d('0x28'),'id'])||{});}})[_0xf34d('0x2a')](function(_0x308ec1){logger['info'](_0xf34d('0x2b'),_0x23009e);logger[_0xf34d('0x12')]('AddTags',_0x23009e,JSON[_0xf34d('0x14')](_0x308ec1));_0x3616aa(_0x308ec1);})[_0xf34d('0x24')](function(_0xdec613){logger[_0xf34d('0x15')](_0xf34d('0x2b'),_0xdec613[_0xf34d('0x18')],_0x23009e);_0x2f8ea9(_this['error'](0x1f4,_0xdec613['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ecfca1f..ab5b640 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 _0xcc50=['openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x2c2f18,_0x1f642c){var _0x21e359=function(_0x2348a7){while(--_0x2348a7){_0x2c2f18['push'](_0x2c2f18['shift']());}};_0x21e359(++_0x1f642c);}(_0xcc50,0x1c9));var _0x0cc5=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0xcc50[_0x3e3d0a];return _0x3fc765;};'use strict';var OpenchannelInteractionEvents=require(_0x0cc5('0x0'));var events=[_0x0cc5('0x1'),_0x0cc5('0x2'),'update'];function createListener(_0x57a484,_0x277aff){return function(_0x578daf){_0x277aff[_0x0cc5('0x3')](_0x57a484,_0x578daf);};}function removeListener(_0xc51c1b,_0x2fadf4){return function(){OpenchannelInteractionEvents[_0x0cc5('0x4')](_0xc51c1b,_0x2fadf4);};}exports[_0x0cc5('0x5')]=function(_0x4f0378){for(var _0xbadd12=0x0,_0x6df9a7=events[_0x0cc5('0x6')];_0xbadd12<_0x6df9a7;_0xbadd12++){var _0x21fd17=events[_0xbadd12];var _0x1b37c7=createListener(_0x0cc5('0x7')+_0x21fd17,_0x4f0378);OpenchannelInteractionEvents['on'](_0x21fd17,_0x1b37c7);}}; \ No newline at end of file +var _0x1855=['emit','register','openchannelInteraction:','save','remove','update'];(function(_0x321f6c,_0x5627aa){var _0x34c3f9=function(_0x50a9bf){while(--_0x50a9bf){_0x321f6c['push'](_0x321f6c['shift']());}};_0x34c3f9(++_0x5627aa);}(_0x1855,0x117));var _0x5185=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x1855[_0x3ce3c];return _0x55a2c9;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x5185('0x0'),_0x5185('0x1'),_0x5185('0x2')];function createListener(_0x4d7359,_0x137b1b){return function(_0x79c3ac){_0x137b1b[_0x5185('0x3')](_0x4d7359,_0x79c3ac);};}function removeListener(_0x16d0dd,_0x27c35b){return function(){OpenchannelInteractionEvents['removeListener'](_0x16d0dd,_0x27c35b);};}exports[_0x5185('0x4')]=function(_0x26ac6c){for(var _0x19da0a=0x0,_0x1fff99=events['length'];_0x19da0a<_0x1fff99;_0x19da0a++){var _0x52ea01=events[_0x19da0a];var _0x4c7ff2=createListener(_0x5185('0x5')+_0x52ea01,_0x26ac6c);OpenchannelInteractionEvents['on'](_0x52ea01,_0x4c7ff2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f48ba84..6f2f70b 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x3945bd,_0x31233d){var _0x1127ea=function(_0x14c71e){while(--_0x14c71e){_0x3945bd['push'](_0x3945bd['shift']());}};_0x1127ea(++_0x31233d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index d0330eb..f65af8f 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 _0xfd3a=['STRING','sequelize','exports','TEXT','medium','ENUM','out','DATE'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xfd3a,0x179));var _0xafd3=function(_0x1ce1e2,_0x1e00ea){_0x1ce1e2=_0x1ce1e2-0x0;var _0xfeba07=_0xfd3a[_0x1ce1e2];return _0xfeba07;};'use strict';var Sequelize=require(_0xafd3('0x0'));module[_0xafd3('0x1')]={'body':{'type':Sequelize[_0xafd3('0x2')](_0xafd3('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xafd3('0x4')]('in',_0xafd3('0x5')),'defaultValue':_0xafd3('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xafd3('0x6')]},'providerName':{'type':Sequelize[_0xafd3('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xae2b=['BOOLEAN','ENUM','out','STRING','sequelize','exports','medium'];(function(_0x5b720e,_0x3c7991){var _0x2193ca=function(_0x3fdcc6){while(--_0x3fdcc6){_0x5b720e['push'](_0x5b720e['shift']());}};_0x2193ca(++_0x3c7991);}(_0xae2b,0xb3));var _0xbae2=function(_0x593121,_0x14080e){_0x593121=_0x593121-0x0;var _0x3185e7=_0xae2b[_0x593121];return _0x3185e7;};'use strict';var Sequelize=require(_0xbae2('0x0'));module[_0xbae2('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbae2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbae2('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbae2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbae2('0x4')]('in',_0xbae2('0x5')),'defaultValue':_0xbae2('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xbae2('0x6')]},'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 57e4295..95af6fd 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 _0x82f8=['info','result','catch','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','isNil','read1stAt','format','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','SIP/%s','channel','motionChannel','EventManager','acceptmessage','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','email','interface','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3884b7,_0x37682d){var _0x598253=function(_0x9b0fca){while(--_0x9b0fca){_0x3884b7['push'](_0x3884b7['shift']());}};_0x598253(++_0x37682d);}(_0x82f8,0x157));var _0x882f=function(_0x2f84b7,_0x558ae9){_0x2f84b7=_0x2f84b7-0x0;var _0x2b2a1c=_0x82f8[_0x2f84b7];return _0x2b2a1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x882f('0x0'));var zipdir=require(_0x882f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882f('0x2'));var moment=require(_0x882f('0x3'));var BPromise=require(_0x882f('0x4'));var Mustache=require(_0x882f('0x5'));var util=require(_0x882f('0x6'));var path=require(_0x882f('0x7'));var sox=require(_0x882f('0x8'));var csv=require(_0x882f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x882f('0xa'));var squel=require(_0x882f('0xb'));var crypto=require(_0x882f('0xc'));var jsforce=require(_0x882f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x882f('0x9'));var querystring=require('querystring');var Papa=require(_0x882f('0xe'));var Redis=require('ioredis');var authService=require(_0x882f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x882f('0x10'));var logger=require(_0x882f('0x11'))(_0x882f('0x12'));var utils=require(_0x882f('0x13'));var config=require(_0x882f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x882f('0x15')]=_[_0x882f('0x16')](config[_0x882f('0x15')],{'host':_0x882f('0x17'),'port':0x18eb});var socket=require(_0x882f('0x18'))(new Redis(config[_0x882f('0x15')]));require(_0x882f('0x19'))['register'](socket);var jayson=require(_0x882f('0x1a'));var client=jayson[_0x882f('0x1b')][_0x882f('0x1c')]({'port':0x232c});var client9002=jayson[_0x882f('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca189,_0x4e9b6e,_0x264da8,_0x187ce1){return new BPromise(function(_0x3357ef,_0x3c2afc){var _0x3f72c2=_0x187ce1||client;return _0x3f72c2[_0x882f('0x1d')](_0x4ca189,_0x264da8)[_0x882f('0x1e')](function(_0x67cc4b){logger['info'](_0x882f('0x1f'),_0x4e9b6e,'request\x20sent');logger['debug'](_0x882f('0x20'),_0x4e9b6e,_0x882f('0x21'),JSON[_0x882f('0x22')](_0x67cc4b));if(_0x67cc4b[_0x882f('0x23')]){if(_0x67cc4b['error'][_0x882f('0x24')]===0x1f4){logger[_0x882f('0x23')](_0x882f('0x1f'),_0x4e9b6e,_0x67cc4b[_0x882f('0x23')][_0x882f('0x25')]);return _0x3c2afc(_0x67cc4b[_0x882f('0x23')][_0x882f('0x25')]);}logger[_0x882f('0x23')](_0x882f('0x1f'),_0x4e9b6e,_0x67cc4b['error']['message']);return _0x3357ef(_0x67cc4b['error'][_0x882f('0x25')]);}else{logger[_0x882f('0x26')](_0x882f('0x1f'),_0x4e9b6e,_0x882f('0x21'));_0x3357ef(_0x67cc4b[_0x882f('0x27')][_0x882f('0x25')]);}})[_0x882f('0x28')](function(_0x2d6f58){logger[_0x882f('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e9b6e,_0x2d6f58);_0x3c2afc(_0x2d6f58);});});}function respondWithStatusCode(_0x42a827,_0x2a8605){_0x2a8605=_0x2a8605||0xcc;return function(_0x51d359){if(_0x51d359){return _0x42a827['sendStatus'](_0x2a8605);}return _0x42a827[_0x882f('0x29')](_0x2a8605)[_0x882f('0x2a')]();};}function respondWithResult(_0xd284e0,_0x4cf987){_0x4cf987=_0x4cf987||0xc8;return function(_0x2ae870){if(_0x2ae870){return _0xd284e0[_0x882f('0x29')](_0x4cf987)[_0x882f('0x2b')](_0x2ae870);}};}function respondWithFilteredResult(_0x29fc23,_0x58d4ce){return function(_0x41605c){if(_0x41605c){var _0x31d0b7=typeof _0x58d4ce[_0x882f('0x2c')]===_0x882f('0x2d')&&typeof _0x58d4ce[_0x882f('0x2e')]===_0x882f('0x2d');var _0x340e9b=_0x41605c[_0x882f('0x2f')];var _0x299f62=_0x31d0b7?0x0:_0x58d4ce[_0x882f('0x2c')];var _0x97706f=_0x31d0b7?_0x41605c[_0x882f('0x2f')]:_0x58d4ce[_0x882f('0x2c')]+_0x58d4ce['limit'];var _0x19c435;if(_0x97706f>=_0x340e9b){_0x97706f=_0x340e9b;_0x19c435=0xc8;}else{_0x19c435=0xce;}_0x29fc23['status'](_0x19c435);return _0x29fc23[_0x882f('0x30')]('Content-Range',_0x299f62+'-'+_0x97706f+'/'+_0x340e9b)['json'](_0x41605c);}return null;};}function patchUpdates(_0x20aa1c){return function(_0x425d28){try{jsonpatch['apply'](_0x425d28,_0x20aa1c,!![]);}catch(_0x206624){return BPromise[_0x882f('0x31')](_0x206624);}return _0x425d28[_0x882f('0x32')]();};}function saveUpdates(_0x394a37,_0x4910ab){return function(_0x19dded){if(_0x19dded){return _0x19dded['update'](_0x394a37)['then'](function(_0x5eba63){return _0x5eba63;});}return null;};}function removeEntity(_0x20f821,_0x55aec8){return function(_0x2080ac){if(_0x2080ac){return _0x2080ac[_0x882f('0x33')]()['then'](function(){_0x20f821['status'](0xcc)[_0x882f('0x2a')]();});}};}function handleEntityNotFound(_0x21a279,_0x5b99a1){return function(_0x277b9e){if(!_0x277b9e){_0x21a279[_0x882f('0x34')](0x194);}return _0x277b9e;};}function handleError(_0x3d9651,_0x383048){_0x383048=_0x383048||0x1f4;return function(_0xafbe46){logger['error'](_0xafbe46[_0x882f('0x35')]);if(_0xafbe46[_0x882f('0x36')]){delete _0xafbe46[_0x882f('0x36')];}_0x3d9651[_0x882f('0x29')](_0x383048)[_0x882f('0x37')](_0xafbe46);};}exports[_0x882f('0x38')]=function(_0x1a6210,_0x328582){var _0x525769={},_0xc25e05={},_0xb16ee9={'count':0x0,'rows':[]};var _0x4290ec=_[_0x882f('0x39')](db[_0x882f('0x3a')][_0x882f('0x3b')],function(_0x281e89){return{'name':_0x281e89[_0x882f('0x3c')],'type':_0x281e89['type'][_0x882f('0x3d')]};});_0xc25e05[_0x882f('0x3e')]=_['map'](_0x4290ec,_0x882f('0x36'));_0xc25e05[_0x882f('0x3f')]=_[_0x882f('0x40')](_0x1a6210['query']);_0xc25e05[_0x882f('0x41')]=_[_0x882f('0x42')](_0xc25e05[_0x882f('0x3e')],_0xc25e05['query']);_0x525769['attributes']=_[_0x882f('0x42')](_0xc25e05[_0x882f('0x3e')],qs[_0x882f('0x43')](_0x1a6210[_0x882f('0x3f')][_0x882f('0x43')]));_0x525769[_0x882f('0x44')]=_0x525769[_0x882f('0x44')][_0x882f('0x45')]?_0x525769[_0x882f('0x44')]:_0xc25e05[_0x882f('0x3e')];if(!_0x1a6210[_0x882f('0x3f')]['hasOwnProperty'](_0x882f('0x46'))){_0x525769[_0x882f('0x2e')]=qs[_0x882f('0x2e')](_0x1a6210[_0x882f('0x3f')][_0x882f('0x2e')]);_0x525769[_0x882f('0x2c')]=qs[_0x882f('0x2c')](_0x1a6210[_0x882f('0x3f')][_0x882f('0x2c')]);}_0x525769['order']=qs['sort'](_0x1a6210['query'][_0x882f('0x47')]);_0x525769['where']=qs['filters'](_[_0x882f('0x48')](_0x1a6210[_0x882f('0x3f')],_0xc25e05[_0x882f('0x41')]),_0x4290ec);if(_0x1a6210[_0x882f('0x3f')]['filter']){_0x525769[_0x882f('0x49')]=_[_0x882f('0x4a')](_0x525769[_0x882f('0x49')],{'$or':_['map'](_0x4290ec,function(_0x1b1a3b){if(_0x1b1a3b[_0x882f('0x4b')]!==_0x882f('0x4c')){var _0x3d6d6e={};_0x3d6d6e[_0x1b1a3b[_0x882f('0x36')]]={'$like':'%'+_0x1a6210['query'][_0x882f('0x4d')]+'%'};return _0x3d6d6e;}})});}_0x525769=_[_0x882f('0x4a')]({},_0x525769,_0x1a6210['options']);var _0x3f0c8a={'where':_0x525769[_0x882f('0x49')]};return db[_0x882f('0x3a')]['count'](_0x3f0c8a)[_0x882f('0x1e')](function(_0x51b5e2){_0xb16ee9[_0x882f('0x2f')]=_0x51b5e2;if(_0x1a6210[_0x882f('0x3f')][_0x882f('0x4e')]){_0x525769[_0x882f('0x4f')]=[{'all':!![]}];}return db[_0x882f('0x3a')][_0x882f('0x50')](_0x525769);})[_0x882f('0x1e')](function(_0x375668){_0xb16ee9[_0x882f('0x51')]=_0x375668;return _0xb16ee9;})['then'](respondWithFilteredResult(_0x328582,_0x525769))[_0x882f('0x28')](handleError(_0x328582,null));};exports[_0x882f('0x52')]=function(_0x369c80,_0x5a3b59){var _0x59e5b3={'raw':!![],'where':{'id':_0x369c80[_0x882f('0x53')]['id']}},_0x574b11={};_0x574b11[_0x882f('0x3e')]=_[_0x882f('0x40')](db[_0x882f('0x3a')][_0x882f('0x3b')]);_0x574b11[_0x882f('0x3f')]=_['keys'](_0x369c80[_0x882f('0x3f')]);_0x574b11['filters']=_[_0x882f('0x42')](_0x574b11[_0x882f('0x3e')],_0x574b11[_0x882f('0x3f')]);_0x59e5b3[_0x882f('0x44')]=_[_0x882f('0x42')](_0x574b11[_0x882f('0x3e')],qs[_0x882f('0x43')](_0x369c80[_0x882f('0x3f')][_0x882f('0x43')]));_0x59e5b3[_0x882f('0x44')]=_0x59e5b3[_0x882f('0x44')][_0x882f('0x45')]?_0x59e5b3[_0x882f('0x44')]:_0x574b11[_0x882f('0x3e')];if(_0x369c80[_0x882f('0x3f')][_0x882f('0x4e')]){_0x59e5b3[_0x882f('0x4f')]=[{'all':!![]}];}_0x59e5b3=_[_0x882f('0x4a')]({},_0x59e5b3,_0x369c80['options']);return db[_0x882f('0x3a')][_0x882f('0x54')](_0x59e5b3)[_0x882f('0x1e')](handleEntityNotFound(_0x5a3b59,null))['then'](respondWithResult(_0x5a3b59,null))[_0x882f('0x28')](handleError(_0x5a3b59,null));};exports['create']=function(_0x28bf3e,_0xb8485){return db[_0x882f('0x3a')][_0x882f('0x55')](_0x28bf3e[_0x882f('0x56')],{})[_0x882f('0x1e')](respondWithResult(_0xb8485,0xc9))['catch'](handleError(_0xb8485,null));};exports[_0x882f('0x57')]=function(_0x144673,_0x3e00e8){if(_0x144673[_0x882f('0x56')]['id']){delete _0x144673[_0x882f('0x56')]['id'];}return db[_0x882f('0x3a')][_0x882f('0x54')]({'where':{'id':_0x144673[_0x882f('0x53')]['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x3e00e8,null))[_0x882f('0x1e')](saveUpdates(_0x144673[_0x882f('0x56')],null))['then'](respondWithResult(_0x3e00e8,null))[_0x882f('0x28')](handleError(_0x3e00e8,null));};exports[_0x882f('0x33')]=function(_0x50208b,_0x14ea8e){return db[_0x882f('0x3a')]['find']({'where':{'id':_0x50208b[_0x882f('0x53')]['id']}})['then'](handleEntityNotFound(_0x14ea8e,null))['then'](removeEntity(_0x14ea8e,null))['catch'](handleError(_0x14ea8e,null));};exports['describe']=function(_0x2044a1,_0x4f4c06){return db[_0x882f('0x3a')][_0x882f('0x58')]()[_0x882f('0x1e')](respondWithResult(_0x4f4c06,null))['catch'](handleError(_0x4f4c06,null));};var interaction_log=require('../../config/logger')(_0x882f('0x59'));exports[_0x882f('0x5a')]=function(_0xcb3d2,_0x5b80f4,_0x22ef2d){var _0x5e5e88={'agent':{},'channel':_0x882f('0x5b')};if(_0xcb3d2[_0x882f('0x56')]['id']){delete _0xcb3d2[_0x882f('0x56')]['id'];}_0xcb3d2[_0x882f('0x56')][_0x882f('0x5c')]=!![];_0xcb3d2[_0x882f('0x56')][_0x882f('0x5d')]=moment()['format'](_0x882f('0x5e'));_0xcb3d2[_0x882f('0x56')]['UserId']=_0xcb3d2['body'][_0x882f('0x5f')]||_0xcb3d2[_0x882f('0x60')]['id'];_0x5e5e88[_0x882f('0x61')]['id']=_0xcb3d2[_0x882f('0x56')][_0x882f('0x5f')];return db['OpenchannelMessage'][_0x882f('0x54')]({'where':{'id':_0xcb3d2[_0x882f('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b80f4,null))[_0x882f('0x1e')](saveUpdates(_0xcb3d2['body'],null))['then'](function(_0x1fa7b2){if(_0x1fa7b2){_0x5e5e88[_0x882f('0x25')]=_0x1fa7b2['get']({'plain':!![]});return db[_0x882f('0x62')]['find']({'where':{'id':_0x1fa7b2['OpenchannelInteractionId']}});}return null;})[_0x882f('0x1e')](handleEntityNotFound(_0x5b80f4,null))[_0x882f('0x1e')](function(_0x1f39e9){if(_0x1f39e9){return _0x1f39e9[_0x882f('0x57')]({'UserId':_0xcb3d2['body'][_0x882f('0x5f')],'read1stAt':_[_0x882f('0x63')](_0x1f39e9[_0x882f('0x64')])?moment()[_0x882f('0x65')](_0x882f('0x5e')):undefined});}return null;})[_0x882f('0x1e')](function(_0x49ad80){if(_0x49ad80){_0x5e5e88['interaction']=_0x49ad80[_0x882f('0x66')]({'plain':!![]});interaction_log['info'](_0x882f('0x67'),_0xcb3d2['user']['id'],_0xcb3d2['user']['name'],_0xcb3d2[_0x882f('0x60')][_0x882f('0x68')],_0x5e5e88['interaction']['id'],_0xcb3d2[_0x882f('0x56')]?JSON[_0x882f('0x22')](_0xcb3d2[_0x882f('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0x882f('0x69'),_0x5e5e88);}return null;})[_0x882f('0x1e')](function(_0x2b6192){var _0x54c11b=_0x882f('0x6a')+_0x2b6192[_0x882f('0x25')][_0x882f('0x6b')];return db[_0x882f('0x6c')][_0x882f('0x3f')](_0x54c11b,{'type':db[_0x882f('0x6d')][_0x882f('0x6e')][_0x882f('0x6f')],'raw':!![]})[_0x882f('0x1e')](function(_0x13706a){return _0x13706a;});})[_0x882f('0x1e')](function(_0xb50aec){if(_0xb50aec){_0x5e5e88['message'][_0x882f('0x70')]=_0xb50aec[0x0];if(!_0xcb3d2[_0x882f('0x56')][_0x882f('0x5f')])return;return db['User'][_0x882f('0x54')]({'where':{'id':_0xcb3d2[_0x882f('0x56')][_0x882f('0x5f')],'role':_0x882f('0x61')},'attributes':['id',_0x882f('0x36'),_0x882f('0x71'),'email',_0x882f('0x72')],'raw':!![]});}return null;})[_0x882f('0x1e')](function(_0x2bb476){if(!_0x2bb476)return null;_0x5e5e88['message']['agent']=_0x2bb476;return _0x5e5e88;})[_0x882f('0x1e')](function(_0x49d0bd){if(_0x49d0bd){if(_0xcb3d2[_0x882f('0x56')]['manual']){_0x5e5e88['message']['interface']=util[_0x882f('0x65')](_0x882f('0x73'),_0xcb3d2[_0x882f('0x60')][_0x882f('0x36')]);_0x5e5e88[_0x882f('0x25')][_0x882f('0x74')]=_0x5e5e88[_0x882f('0x74')];_0x5e5e88['message'][_0x882f('0x75')]=_0x5e5e88[_0x882f('0x74')];_0x5e5e88[_0x882f('0x25')]['event']=_0x882f('0x5a');return respondWithRpcPromise(_0x882f('0x76'),_0x882f('0x76'),{'event':_0x882f('0x77'),'message':_0x5e5e88[_0x882f('0x25')]},client9002)[_0x882f('0x1e')](function(){return _0x5e5e88;});}return _0x5e5e88;}return null;})[_0x882f('0x1e')](respondWithResult(_0x5b80f4,null))[_0x882f('0x28')](handleError(_0x5b80f4,null));};var interaction_log=require(_0x882f('0x11'))(_0x882f('0x59'));exports[_0x882f('0x31')]=function(_0x53f369,_0x27bc37,_0x118de8){var _0x123723={'agent':{},'channel':'openchannel'};if(_0x53f369[_0x882f('0x56')]['id']){delete _0x53f369[_0x882f('0x56')]['id'];}_0x53f369[_0x882f('0x56')][_0x882f('0x5f')]=_0x53f369['body'][_0x882f('0x5f')]||_0x53f369['user']['id'];_0x123723[_0x882f('0x61')]['id']=_0x53f369['body']['UserId'];return db[_0x882f('0x3a')][_0x882f('0x54')]({'where':{'id':_0x53f369[_0x882f('0x53')]['id'],'UserId':null}})[_0x882f('0x1e')](handleEntityNotFound(_0x27bc37,null))['then'](function(_0x1654a2){if(_0x1654a2){_0x123723[_0x882f('0x25')]=_0x1654a2['get']({'plain':!![]});return db[_0x882f('0x62')][_0x882f('0x54')]({'where':{'id':_0x1654a2[_0x882f('0x78')]}});}return null;})[_0x882f('0x1e')](handleEntityNotFound(_0x27bc37,null))[_0x882f('0x1e')](function(_0x1a0612){if(_0x1a0612){_0x123723[_0x882f('0x79')]=_0x1a0612[_0x882f('0x66')]({'plain':!![]});interaction_log[_0x882f('0x26')](_0x882f('0x7a'),_0x53f369[_0x882f('0x60')]['id'],_0x53f369[_0x882f('0x60')][_0x882f('0x36')],_0x53f369[_0x882f('0x60')][_0x882f('0x68')],_0x123723[_0x882f('0x79')]['id'],_0x53f369[_0x882f('0x56')]?JSON['stringify'](_0x53f369[_0x882f('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0x882f('0x7b'),_0x123723);}return null;})[_0x882f('0x1e')](function(_0x59f02b){var _0x540a6a=_0x882f('0x6a')+_0x59f02b['message']['ContactId'];return db[_0x882f('0x6c')][_0x882f('0x3f')](_0x540a6a,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x882f('0x1e')](function(_0x1e8e7b){return _0x1e8e7b;});})[_0x882f('0x1e')](function(_0x15ee21){if(_0x15ee21){_0x123723['message']['contact']=_0x15ee21[0x0];if(!_0x53f369[_0x882f('0x56')]['UserId'])return;return db[_0x882f('0x7c')][_0x882f('0x54')]({'where':{'id':_0x53f369['body'][_0x882f('0x5f')],'role':_0x882f('0x61')},'attributes':['id',_0x882f('0x36'),_0x882f('0x71'),_0x882f('0x7d'),_0x882f('0x72')],'raw':!![]});}return null;})[_0x882f('0x1e')](function(_0x3edbcc){if(!_0x3edbcc)return null;_0x123723[_0x882f('0x25')]['agent']=_0x3edbcc;return _0x123723;})['then'](function(_0x126793){if(_0x126793){_0x126793[_0x882f('0x25')][_0x882f('0x7e')]=util[_0x882f('0x65')](_0x882f('0x73'),_0x53f369[_0x882f('0x60')]['name']);_0x126793[_0x882f('0x25')][_0x882f('0x74')]=_0x123723[_0x882f('0x74')];_0x126793[_0x882f('0x25')][_0x882f('0x75')]=_0x123723[_0x882f('0x74')];_0x126793[_0x882f('0x25')]['event']='reject';respondWithRpcPromise(_0x882f('0x76'),_0x882f('0x76'),{'event':'rejectmessage','message':_0x126793[_0x882f('0x25')]},client9002);return _0x123723;}return null;})['then'](respondWithResult(_0x27bc37,null))[_0x882f('0x28')](handleError(_0x27bc37,null));}; \ No newline at end of file +var _0xe64b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelMessage.socket','jayson/promise','http','client','request','then','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','rows','rawAttributes','find','create','body','update','params','describe','openchannel-interactions','openchannel','read','format','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','rejectmessage','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe64b,0x188));var _0xbe64=function(_0x28d48a,_0x233331){_0x28d48a=_0x28d48a-0x0;var _0x447585=_0xe64b[_0x28d48a];return _0x447585;};'use strict';var emlformat=require(_0xbe64('0x0'));var rimraf=require(_0xbe64('0x1'));var zipdir=require(_0xbe64('0x2'));var jsonpatch=require(_0xbe64('0x3'));var rp=require(_0xbe64('0x4'));var moment=require(_0xbe64('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbe64('0x6'));var util=require('util');var path=require(_0xbe64('0x7'));var sox=require(_0xbe64('0x8'));var csv=require(_0xbe64('0x9'));var ejs=require(_0xbe64('0xa'));var fs=require('fs');var fs_extra=require(_0xbe64('0xb'));var _=require(_0xbe64('0xc'));var squel=require(_0xbe64('0xd'));var crypto=require(_0xbe64('0xe'));var jsforce=require(_0xbe64('0xf'));var deskjs=require(_0xbe64('0x10'));var toCsv=require(_0xbe64('0x9'));var querystring=require(_0xbe64('0x11'));var Papa=require(_0xbe64('0x12'));var Redis=require(_0xbe64('0x13'));var authService=require(_0xbe64('0x14'));var qs=require(_0xbe64('0x15'));var as=require(_0xbe64('0x16'));var hardwareService=require(_0xbe64('0x17'));var logger=require(_0xbe64('0x18'))(_0xbe64('0x19'));var utils=require('../../config/utils');var config=require(_0xbe64('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe64('0x1b'))['db'];config[_0xbe64('0x1c')]=_['defaults'](config[_0xbe64('0x1c')],{'host':_0xbe64('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbe64('0x1e'))['register'](socket);var jayson=require(_0xbe64('0x1f'));var client=jayson['client'][_0xbe64('0x20')]({'port':0x232c});var client9002=jayson[_0xbe64('0x21')][_0xbe64('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x50e7f6,_0x34c3e9,_0x4bc3a3,_0x24b5bb){return new BPromise(function(_0x2fe890,_0x2192e8){var _0x3aaa89=_0x24b5bb||client;return _0x3aaa89[_0xbe64('0x22')](_0x50e7f6,_0x4bc3a3)[_0xbe64('0x23')](function(_0x110a5a){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x34c3e9,'request\x20sent');logger[_0xbe64('0x24')](_0xbe64('0x25'),_0x34c3e9,_0xbe64('0x26'),JSON[_0xbe64('0x27')](_0x110a5a));if(_0x110a5a[_0xbe64('0x28')]){if(_0x110a5a[_0xbe64('0x28')][_0xbe64('0x29')]===0x1f4){logger['error'](_0xbe64('0x2a'),_0x34c3e9,_0x110a5a[_0xbe64('0x28')]['message']);return _0x2192e8(_0x110a5a[_0xbe64('0x28')][_0xbe64('0x2b')]);}logger[_0xbe64('0x28')](_0xbe64('0x2a'),_0x34c3e9,_0x110a5a[_0xbe64('0x28')][_0xbe64('0x2b')]);return _0x2fe890(_0x110a5a[_0xbe64('0x28')]['message']);}else{logger[_0xbe64('0x2c')](_0xbe64('0x2a'),_0x34c3e9,'request\x20sent');_0x2fe890(_0x110a5a[_0xbe64('0x2d')]['message']);}})[_0xbe64('0x2e')](function(_0x38f3a6){logger['error'](_0xbe64('0x2a'),_0x34c3e9,_0x38f3a6);_0x2192e8(_0x38f3a6);});});}function respondWithStatusCode(_0x5558a5,_0x4896a0){_0x4896a0=_0x4896a0||0xcc;return function(_0x448792){if(_0x448792){return _0x5558a5['sendStatus'](_0x4896a0);}return _0x5558a5[_0xbe64('0x2f')](_0x4896a0)[_0xbe64('0x30')]();};}function respondWithResult(_0x3b6ba9,_0x4ef80f){_0x4ef80f=_0x4ef80f||0xc8;return function(_0x3dfbba){if(_0x3dfbba){return _0x3b6ba9['status'](_0x4ef80f)['json'](_0x3dfbba);}};}function respondWithFilteredResult(_0x627fa3,_0x1e54b5){return function(_0x5e6502){if(_0x5e6502){var _0x20cc91=typeof _0x1e54b5[_0xbe64('0x31')]===_0xbe64('0x32')&&typeof _0x1e54b5[_0xbe64('0x33')]==='undefined';var _0x1c673a=_0x5e6502[_0xbe64('0x34')];var _0x197c7c=_0x20cc91?0x0:_0x1e54b5[_0xbe64('0x31')];var _0x52a137=_0x20cc91?_0x5e6502['count']:_0x1e54b5[_0xbe64('0x31')]+_0x1e54b5['limit'];var _0x909a17;if(_0x52a137>=_0x1c673a){_0x52a137=_0x1c673a;_0x909a17=0xc8;}else{_0x909a17=0xce;}_0x627fa3[_0xbe64('0x2f')](_0x909a17);return _0x627fa3[_0xbe64('0x35')](_0xbe64('0x36'),_0x197c7c+'-'+_0x52a137+'/'+_0x1c673a)[_0xbe64('0x37')](_0x5e6502);}return null;};}function patchUpdates(_0x1b2cc){return function(_0x23c0d3){try{jsonpatch[_0xbe64('0x38')](_0x23c0d3,_0x1b2cc,!![]);}catch(_0x3ee91a){return BPromise[_0xbe64('0x39')](_0x3ee91a);}return _0x23c0d3['save']();};}function saveUpdates(_0x31f959,_0xbb2a55){return function(_0x467932){if(_0x467932){return _0x467932['update'](_0x31f959)[_0xbe64('0x23')](function(_0x1e75f8){return _0x1e75f8;});}return null;};}function removeEntity(_0x5a3ee0,_0x3f2195){return function(_0xbd9de9){if(_0xbd9de9){return _0xbd9de9[_0xbe64('0x3a')]()[_0xbe64('0x23')](function(){_0x5a3ee0[_0xbe64('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10e90e,_0x59a935){return function(_0x1f97fb){if(!_0x1f97fb){_0x10e90e['sendStatus'](0x194);}return _0x1f97fb;};}function handleError(_0x49ca6c,_0x1d9eb1){_0x1d9eb1=_0x1d9eb1||0x1f4;return function(_0x9b0757){logger[_0xbe64('0x28')](_0x9b0757['stack']);if(_0x9b0757[_0xbe64('0x3b')]){delete _0x9b0757[_0xbe64('0x3b')];}_0x49ca6c[_0xbe64('0x2f')](_0x1d9eb1)[_0xbe64('0x3c')](_0x9b0757);};}exports[_0xbe64('0x3d')]=function(_0x2e8259,_0x139ad8){var _0x380fbb={},_0x4c330c={},_0x3206bc={'count':0x0,'rows':[]};var _0x171fdb=_[_0xbe64('0x3e')](db[_0xbe64('0x3f')]['rawAttributes'],function(_0x1ca6e1){return{'name':_0x1ca6e1[_0xbe64('0x40')],'type':_0x1ca6e1[_0xbe64('0x41')][_0xbe64('0x42')]};});_0x4c330c[_0xbe64('0x43')]=_[_0xbe64('0x3e')](_0x171fdb,_0xbe64('0x3b'));_0x4c330c[_0xbe64('0x44')]=_[_0xbe64('0x45')](_0x2e8259[_0xbe64('0x44')]);_0x4c330c[_0xbe64('0x46')]=_[_0xbe64('0x47')](_0x4c330c['model'],_0x4c330c[_0xbe64('0x44')]);_0x380fbb[_0xbe64('0x48')]=_[_0xbe64('0x47')](_0x4c330c['model'],qs['fields'](_0x2e8259[_0xbe64('0x44')][_0xbe64('0x49')]));_0x380fbb[_0xbe64('0x48')]=_0x380fbb[_0xbe64('0x48')][_0xbe64('0x4a')]?_0x380fbb[_0xbe64('0x48')]:_0x4c330c[_0xbe64('0x43')];if(!_0x2e8259[_0xbe64('0x44')]['hasOwnProperty']('nolimit')){_0x380fbb[_0xbe64('0x33')]=qs[_0xbe64('0x33')](_0x2e8259[_0xbe64('0x44')][_0xbe64('0x33')]);_0x380fbb[_0xbe64('0x31')]=qs[_0xbe64('0x31')](_0x2e8259[_0xbe64('0x44')]['offset']);}_0x380fbb[_0xbe64('0x4b')]=qs[_0xbe64('0x4c')](_0x2e8259['query']['sort']);_0x380fbb[_0xbe64('0x4d')]=qs[_0xbe64('0x46')](_['pick'](_0x2e8259[_0xbe64('0x44')],_0x4c330c[_0xbe64('0x46')]),_0x171fdb);if(_0x2e8259[_0xbe64('0x44')][_0xbe64('0x4e')]){_0x380fbb['where']=_[_0xbe64('0x4f')](_0x380fbb['where'],{'$or':_[_0xbe64('0x3e')](_0x171fdb,function(_0x11e254){if(_0x11e254[_0xbe64('0x41')]!=='VIRTUAL'){var _0x4d7fd7={};_0x4d7fd7[_0x11e254[_0xbe64('0x3b')]]={'$like':'%'+_0x2e8259[_0xbe64('0x44')][_0xbe64('0x4e')]+'%'};return _0x4d7fd7;}})});}_0x380fbb=_[_0xbe64('0x4f')]({},_0x380fbb,_0x2e8259[_0xbe64('0x50')]);var _0x294b35={'where':_0x380fbb[_0xbe64('0x4d')]};return db[_0xbe64('0x3f')][_0xbe64('0x34')](_0x294b35)['then'](function(_0x54c7a1){_0x3206bc[_0xbe64('0x34')]=_0x54c7a1;if(_0x2e8259[_0xbe64('0x44')][_0xbe64('0x51')]){_0x380fbb[_0xbe64('0x52')]=[{'all':!![]}];}return db[_0xbe64('0x3f')]['findAll'](_0x380fbb);})[_0xbe64('0x23')](function(_0x1a0908){_0x3206bc[_0xbe64('0x53')]=_0x1a0908;return _0x3206bc;})[_0xbe64('0x23')](respondWithFilteredResult(_0x139ad8,_0x380fbb))['catch'](handleError(_0x139ad8,null));};exports['show']=function(_0x536c15,_0x3117a8){var _0x17dfe0={'raw':!![],'where':{'id':_0x536c15['params']['id']}},_0x46762d={};_0x46762d[_0xbe64('0x43')]=_[_0xbe64('0x45')](db['OpenchannelMessage'][_0xbe64('0x54')]);_0x46762d[_0xbe64('0x44')]=_[_0xbe64('0x45')](_0x536c15[_0xbe64('0x44')]);_0x46762d[_0xbe64('0x46')]=_[_0xbe64('0x47')](_0x46762d[_0xbe64('0x43')],_0x46762d[_0xbe64('0x44')]);_0x17dfe0[_0xbe64('0x48')]=_[_0xbe64('0x47')](_0x46762d['model'],qs[_0xbe64('0x49')](_0x536c15[_0xbe64('0x44')][_0xbe64('0x49')]));_0x17dfe0[_0xbe64('0x48')]=_0x17dfe0[_0xbe64('0x48')][_0xbe64('0x4a')]?_0x17dfe0['attributes']:_0x46762d[_0xbe64('0x43')];if(_0x536c15[_0xbe64('0x44')][_0xbe64('0x51')]){_0x17dfe0[_0xbe64('0x52')]=[{'all':!![]}];}_0x17dfe0=_['merge']({},_0x17dfe0,_0x536c15['options']);return db[_0xbe64('0x3f')][_0xbe64('0x55')](_0x17dfe0)['then'](handleEntityNotFound(_0x3117a8,null))[_0xbe64('0x23')](respondWithResult(_0x3117a8,null))[_0xbe64('0x2e')](handleError(_0x3117a8,null));};exports['create']=function(_0x43637a,_0x397ead){return db[_0xbe64('0x3f')][_0xbe64('0x56')](_0x43637a[_0xbe64('0x57')],{})[_0xbe64('0x23')](respondWithResult(_0x397ead,0xc9))[_0xbe64('0x2e')](handleError(_0x397ead,null));};exports[_0xbe64('0x58')]=function(_0xf29db6,_0x4f44a2){if(_0xf29db6[_0xbe64('0x57')]['id']){delete _0xf29db6[_0xbe64('0x57')]['id'];}return db[_0xbe64('0x3f')][_0xbe64('0x55')]({'where':{'id':_0xf29db6[_0xbe64('0x59')]['id']}})[_0xbe64('0x23')](handleEntityNotFound(_0x4f44a2,null))[_0xbe64('0x23')](saveUpdates(_0xf29db6[_0xbe64('0x57')],null))[_0xbe64('0x23')](respondWithResult(_0x4f44a2,null))[_0xbe64('0x2e')](handleError(_0x4f44a2,null));};exports[_0xbe64('0x3a')]=function(_0xfc6613,_0x48e3b3){return db[_0xbe64('0x3f')][_0xbe64('0x55')]({'where':{'id':_0xfc6613[_0xbe64('0x59')]['id']}})[_0xbe64('0x23')](handleEntityNotFound(_0x48e3b3,null))[_0xbe64('0x23')](removeEntity(_0x48e3b3,null))[_0xbe64('0x2e')](handleError(_0x48e3b3,null));};exports[_0xbe64('0x5a')]=function(_0x1326f1,_0x5a98bd){return db[_0xbe64('0x3f')][_0xbe64('0x5a')]()[_0xbe64('0x23')](respondWithResult(_0x5a98bd,null))['catch'](handleError(_0x5a98bd,null));};var interaction_log=require(_0xbe64('0x18'))(_0xbe64('0x5b'));exports['accept']=function(_0x494e6e,_0x13235c,_0x44cf6c){var _0x29e038={'agent':{},'channel':_0xbe64('0x5c')};if(_0x494e6e[_0xbe64('0x57')]['id']){delete _0x494e6e[_0xbe64('0x57')]['id'];}_0x494e6e['body'][_0xbe64('0x5d')]=!![];_0x494e6e['body']['readAt']=moment()[_0xbe64('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x494e6e[_0xbe64('0x57')]['UserId']=_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')]||_0x494e6e[_0xbe64('0x60')]['id'];_0x29e038[_0xbe64('0x61')]['id']=_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')];return db[_0xbe64('0x3f')][_0xbe64('0x55')]({'where':{'id':_0x494e6e[_0xbe64('0x59')]['id'],'UserId':null}})[_0xbe64('0x23')](handleEntityNotFound(_0x13235c,null))[_0xbe64('0x23')](saveUpdates(_0x494e6e[_0xbe64('0x57')],null))[_0xbe64('0x23')](function(_0x41c811){if(_0x41c811){_0x29e038['message']=_0x41c811[_0xbe64('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xbe64('0x55')]({'where':{'id':_0x41c811[_0xbe64('0x63')]}});}return null;})[_0xbe64('0x23')](handleEntityNotFound(_0x13235c,null))['then'](function(_0xd2393){if(_0xd2393){return _0xd2393[_0xbe64('0x58')]({'UserId':_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')],'read1stAt':_[_0xbe64('0x64')](_0xd2393[_0xbe64('0x65')])?moment()[_0xbe64('0x5e')](_0xbe64('0x66')):undefined});}return null;})[_0xbe64('0x23')](function(_0x1c4209){if(_0x1c4209){_0x29e038[_0xbe64('0x67')]=_0x1c4209[_0xbe64('0x62')]({'plain':!![]});interaction_log[_0xbe64('0x2c')](_0xbe64('0x68'),_0x494e6e['user']['id'],_0x494e6e['user'][_0xbe64('0x3b')],_0x494e6e[_0xbe64('0x60')]['role'],_0x29e038[_0xbe64('0x67')]['id'],_0x494e6e[_0xbe64('0x57')]?JSON[_0xbe64('0x27')](_0x494e6e[_0xbe64('0x57')]):_0xbe64('0x69'));return respondWithRpcPromise(_0xbe64('0x6a'),_0xbe64('0x6b'),_0x29e038);}return null;})['then'](function(_0xe4d9c2){var _0x29054a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xe4d9c2[_0xbe64('0x2b')]['ContactId'];return db[_0xbe64('0x6c')][_0xbe64('0x44')](_0x29054a,{'type':db['Sequelize'][_0xbe64('0x6d')][_0xbe64('0x6e')],'raw':!![]})[_0xbe64('0x23')](function(_0x1a3a5b){return _0x1a3a5b;});})['then'](function(_0x5c64b4){if(_0x5c64b4){_0x29e038[_0xbe64('0x2b')][_0xbe64('0x6f')]=_0x5c64b4[0x0];if(!_0x494e6e['body'][_0xbe64('0x5f')])return;return db[_0xbe64('0x70')][_0xbe64('0x55')]({'where':{'id':_0x494e6e[_0xbe64('0x57')][_0xbe64('0x5f')],'role':'agent'},'attributes':['id','name',_0xbe64('0x71'),_0xbe64('0x72'),_0xbe64('0x73')],'raw':!![]});}return null;})[_0xbe64('0x23')](function(_0x291e5b){if(!_0x291e5b)return null;_0x29e038[_0xbe64('0x2b')]['agent']=_0x291e5b;return _0x29e038;})[_0xbe64('0x23')](function(_0xb389f2){if(_0xb389f2){if(_0x494e6e['body'][_0xbe64('0x74')]){_0x29e038['message'][_0xbe64('0x75')]=util[_0xbe64('0x5e')](_0xbe64('0x76'),_0x494e6e[_0xbe64('0x60')][_0xbe64('0x3b')]);_0x29e038[_0xbe64('0x2b')][_0xbe64('0x77')]=_0x29e038[_0xbe64('0x77')];_0x29e038[_0xbe64('0x2b')]['motionChannel']=_0x29e038[_0xbe64('0x77')];_0x29e038[_0xbe64('0x2b')][_0xbe64('0x78')]='accept';return respondWithRpcPromise(_0xbe64('0x79'),_0xbe64('0x79'),{'event':_0xbe64('0x7a'),'message':_0x29e038[_0xbe64('0x2b')]},client9002)['then'](function(){return _0x29e038;});}return _0x29e038;}return null;})['then'](respondWithResult(_0x13235c,null))['catch'](handleError(_0x13235c,null));};var interaction_log=require(_0xbe64('0x18'))('openchannel-interactions');exports[_0xbe64('0x39')]=function(_0x2232d4,_0x3af7b5,_0x4d142d){var _0x745fd6={'agent':{},'channel':_0xbe64('0x5c')};if(_0x2232d4['body']['id']){delete _0x2232d4[_0xbe64('0x57')]['id'];}_0x2232d4[_0xbe64('0x57')]['UserId']=_0x2232d4[_0xbe64('0x57')][_0xbe64('0x5f')]||_0x2232d4['user']['id'];_0x745fd6[_0xbe64('0x61')]['id']=_0x2232d4[_0xbe64('0x57')][_0xbe64('0x5f')];return db['OpenchannelMessage'][_0xbe64('0x55')]({'where':{'id':_0x2232d4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3af7b5,null))[_0xbe64('0x23')](function(_0x4644b8){if(_0x4644b8){_0x745fd6[_0xbe64('0x2b')]=_0x4644b8[_0xbe64('0x62')]({'plain':!![]});return db[_0xbe64('0x7b')][_0xbe64('0x55')]({'where':{'id':_0x4644b8['OpenchannelInteractionId']}});}return null;})[_0xbe64('0x23')](handleEntityNotFound(_0x3af7b5,null))[_0xbe64('0x23')](function(_0x39e35c){if(_0x39e35c){_0x745fd6[_0xbe64('0x67')]=_0x39e35c[_0xbe64('0x62')]({'plain':!![]});interaction_log[_0xbe64('0x2c')](_0xbe64('0x7c'),_0x2232d4[_0xbe64('0x60')]['id'],_0x2232d4[_0xbe64('0x60')]['name'],_0x2232d4[_0xbe64('0x60')][_0xbe64('0x7d')],_0x745fd6[_0xbe64('0x67')]['id'],_0x2232d4[_0xbe64('0x57')]?JSON[_0xbe64('0x27')](_0x2232d4[_0xbe64('0x57')]):_0xbe64('0x69'));return respondWithRpcPromise(_0xbe64('0x7e'),_0xbe64('0x7f'),_0x745fd6);}return null;})['then'](function(_0x2ef917){var _0xee5e3d=_0xbe64('0x80')+_0x2ef917[_0xbe64('0x2b')][_0xbe64('0x81')];return db[_0xbe64('0x6c')][_0xbe64('0x44')](_0xee5e3d,{'type':db['Sequelize'][_0xbe64('0x6d')][_0xbe64('0x6e')],'raw':!![]})[_0xbe64('0x23')](function(_0x498df4){return _0x498df4;});})[_0xbe64('0x23')](function(_0x22827e){if(_0x22827e){_0x745fd6[_0xbe64('0x2b')]['contact']=_0x22827e[0x0];if(!_0x2232d4[_0xbe64('0x57')]['UserId'])return;return db[_0xbe64('0x70')][_0xbe64('0x55')]({'where':{'id':_0x2232d4[_0xbe64('0x57')][_0xbe64('0x5f')],'role':_0xbe64('0x61')},'attributes':['id',_0xbe64('0x3b'),_0xbe64('0x71'),_0xbe64('0x72'),_0xbe64('0x73')],'raw':!![]});}return null;})[_0xbe64('0x23')](function(_0x42dfd9){if(!_0x42dfd9)return null;_0x745fd6[_0xbe64('0x2b')][_0xbe64('0x61')]=_0x42dfd9;return _0x745fd6;})[_0xbe64('0x23')](function(_0x1dfc88){if(_0x1dfc88){_0x1dfc88[_0xbe64('0x2b')]['interface']=util['format'](_0xbe64('0x76'),_0x2232d4[_0xbe64('0x60')][_0xbe64('0x3b')]);_0x1dfc88['message']['channel']=_0x745fd6[_0xbe64('0x77')];_0x1dfc88[_0xbe64('0x2b')]['motionChannel']=_0x745fd6['channel'];_0x1dfc88[_0xbe64('0x2b')][_0xbe64('0x78')]='reject';respondWithRpcPromise(_0xbe64('0x79'),_0xbe64('0x79'),{'event':_0xbe64('0x82'),'message':_0x1dfc88[_0xbe64('0x2b')]},client9002);return _0x745fd6;}return null;})[_0xbe64('0x23')](respondWithResult(_0x3af7b5,null))[_0xbe64('0x2e')](handleError(_0x3af7b5,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index dda2535..c1e6b01 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 _0xdf6c=['hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5abc6e,_0x721897){var _0xc349ce=function(_0x18929c){while(--_0x18929c){_0x5abc6e['push'](_0x5abc6e['shift']());}};_0xc349ce(++_0x721897);}(_0xdf6c,0x14d));var _0xcdf6=function(_0x1bce53,_0x228475){_0x1bce53=_0x1bce53-0x0;var _0x3f6a7f=_0xdf6c[_0x1bce53];return _0x3f6a7f;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xcdf6('0x0'))['db'][_0xcdf6('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcdf6('0x2')](0x0);var events={'afterCreate':_0xcdf6('0x3'),'afterUpdate':_0xcdf6('0x4'),'afterDestroy':_0xcdf6('0x5')};function emitEvent(_0x4a4685){return function(_0x54a534,_0x1ac3cd,_0x3dc9b7){OpenchannelMessageEvents[_0xcdf6('0x6')](_0x4a4685+':'+_0x54a534['id'],_0x54a534);OpenchannelMessageEvents['emit'](_0x4a4685,_0x54a534);_0x3dc9b7(null);};}for(var e in events){if(events[_0xcdf6('0x7')](e)){var event=events[e];OpenchannelMessage[_0xcdf6('0x8')](e,emitEvent(event));}}module[_0xcdf6('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x2e30=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5395a,_0x4bbdbc){var _0x1328e4=function(_0x45954c){while(--_0x45954c){_0x5395a['push'](_0x5395a['shift']());}};_0x1328e4(++_0x4bbdbc);}(_0x2e30,0x18f));var _0x02e3=function(_0x471a02,_0x2dbb8a){_0x471a02=_0x471a02-0x0;var _0xc90727=_0x2e30[_0x471a02];return _0xc90727;};'use strict';var EventEmitter=require(_0x02e3('0x0'));var OpenchannelMessage=require(_0x02e3('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x02e3('0x2')](0x0);var events={'afterCreate':_0x02e3('0x3'),'afterUpdate':_0x02e3('0x4'),'afterDestroy':_0x02e3('0x5')};function emitEvent(_0x216b0a){return function(_0x3dd25e,_0x43b064,_0x5e8f8a){OpenchannelMessageEvents[_0x02e3('0x6')](_0x216b0a+':'+_0x3dd25e['id'],_0x3dd25e);OpenchannelMessageEvents[_0x02e3('0x6')](_0x216b0a,_0x3dd25e);_0x5e8f8a(null);};}for(var e in events){if(events[_0x02e3('0x7')](e)){var event=events[e];OpenchannelMessage[_0x02e3('0x8')](e,emitEvent(event));}}module[_0x02e3('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 71bbf4b..fbc5637 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 _0xb62e=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','then','update','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Interactions','GET','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect'];(function(_0x2a5a60,_0x377074){var _0x3b3223=function(_0x4e6861){while(--_0x4e6861){_0x2a5a60['push'](_0x2a5a60['shift']());}};_0x3b3223(++_0x377074);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[{'name':_0xeb62('0xc'),'fields':[_0xeb62('0xd')],'type':_0xeb62('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4967c0,_0x5cdef3,_0x4693c9){var _0x40584b=_0x3ec879[_0xeb62('0xf')];var _0xf93c21=_0x4967c0[_0xeb62('0x10')]({'plain':!![]});if(_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()==='in'||_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()===_0xeb62('0x13')&&!_0xf93c21['secret']&&!_[_0xeb62('0x14')](_0xf93c21[_0xeb62('0x15')])){_0x40584b[_0xeb62('0x16')][_0xeb62('0x17')]({'where':{'id':_0xf93c21['OpenchannelInteractionId']}})[_0xeb62('0x18')](function(_0x2fbad2){if(_0x2fbad2){_0x2fbad2[_0xeb62('0x19')]({'lastMsgAt':_0xf93c21['createdAt'],'lastMsgDirection':_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()});}})[_0xeb62('0x1a')](function(_0x4ce9fa){console[_0xeb62('0x1b')](_0x4ce9fa);});}if(_0xf93c21[_0xeb62('0x11')]===_0xeb62('0x13')&&!_0xf93c21[_0xeb62('0x1c')]){var _0x3fb280;_0x40584b[_0xeb62('0x1d')][_0xeb62('0x1e')]()[_0xeb62('0x18')](function(_0x39b138){return _0x40584b[_0xeb62('0x1f')][_0xeb62('0x20')]({'where':{'id':_0xf93c21[_0xeb62('0x21')]},'include':[{'model':_0x40584b[_0xeb62('0x16')],'as':'Interactions','where':{'id':_0xf93c21[_0xeb62('0x22')]},'limit':0x1,'include':[{'model':_0x40584b[_0xeb62('0x1d')],'as':_0xeb62('0x23'),'attributes':_[_0xeb62('0x24')](_0x39b138)}]}]});})[_0xeb62('0x18')](function(_0x24cbf3){_0x3fb280=_0x24cbf3[_0xeb62('0x10')]({'plain':!![]});if(_0x3fb280&&_0x3fb280['replyUri']){logger['info'](_0xeb62('0x25'),_0xeb62('0x26'),util[_0xeb62('0x27')](_0xeb62('0x28'),_0xf93c21['id'],_0x3fb280[_0xeb62('0x29')]));if(_0x3fb280['Interactions']&&_0x3fb280['Interactions'][_0xeb62('0x2a')]){_0xf93c21[_0xeb62('0x2b')]=_[_0xeb62('0x2c')](_0x3fb280[_0xeb62('0x2d')][0x0],'Contact');_0xf93c21['Contact']=_0x3fb280[_0xeb62('0x2d')][0x0]['Contact'];}var _0x5cdef3={'method':'POST','uri':encodeURI(_0x3fb280[_0xeb62('0x29')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5cdef3['method']){case _0xeb62('0x2e'):_0x5cdef3['qs']=_0xf93c21;break;case _0xeb62('0x2f'):_0x5cdef3[_0xeb62('0xd')]=_0xf93c21;break;}return rp(_0x5cdef3)['then'](function(_0x3ef784){logger[_0xeb62('0x30')](_0xeb62('0x25'),_0xeb62('0x26'),util[_0xeb62('0x27')](_0xeb62('0x31'),_0xf93c21['id'],_0x3fb280['replyUri']));if(_0x3ef784[_0xeb62('0xd')][_0xeb62('0x32')]&&_0x3ef784['body'][_0xeb62('0x32')]!=_0xf93c21[_0xeb62('0x2b')][_0xeb62('0x32')]){return _0x40584b[_0xeb62('0x16')][_0xeb62('0x19')]({'threadId':_0x3ef784['body']['threadId']},{'logging':!![],'where':{'id':_0xf93c21[_0xeb62('0x2b')]['id']}});}else{return;}})[_0xeb62('0x18')](function(){return _0x4967c0[_0xeb62('0x19')]({'read':!![]});})[_0xeb62('0x1a')](function(_0x42b197){logger[_0xeb62('0x1b')](_0xeb62('0x25'),'afterCreate',util[_0xeb62('0x33')](_0x42b197,{'showHidden':![],'depth':null}));_0x4693c9();});}else{_0x4693c9();}})['finally'](function(){_0x4693c9();});}else{_0x4693c9();}}},'charset':'utf8mb4','collate':_0xeb62('0x34')});}; \ No newline at end of file +var _0x757a=['find','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','OpenchannelMessage,\x20%s,\x20%s','threadId','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','OpenchannelInteractionId','update','createdAt','catch','error','out','secret','CmContact','describe','then'];(function(_0x3b5b94,_0x1b1d80){var _0x507e9e=function(_0x2375e3){while(--_0x2375e3){_0x3b5b94['push'](_0x3b5b94['shift']());}};_0x507e9e(++_0x1b1d80);}(_0x757a,0xde));var _0xa757=function(_0x12fc72,_0x126c43){_0x12fc72=_0x12fc72-0x0;var _0x220a33=_0x757a[_0x12fc72];return _0x220a33;};'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')]('OpenchannelMessage',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xb')],'type':_0xa757('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a3db6,_0x5aef8a,_0x89c630){var _0x2ca96f=_0x5edca8[_0xa757('0xd')];var _0x3e2c9a=_0x3a3db6[_0xa757('0xe')]({'plain':!![]});if(_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()==='in'||_0x3e2c9a['direction']['toLowerCase']()==='out'&&!_0x3e2c9a['secret']&&!_['isNil'](_0x3e2c9a[_0xa757('0x11')])){_0x2ca96f['OpenchannelInteraction']['findOne']({'where':{'id':_0x3e2c9a[_0xa757('0x12')]}})['then'](function(_0x481508){if(_0x481508){_0x481508[_0xa757('0x13')]({'lastMsgAt':_0x3e2c9a[_0xa757('0x14')],'lastMsgDirection':_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()});}})[_0xa757('0x15')](function(_0x31cfd2){console[_0xa757('0x16')](_0x31cfd2);});}if(_0x3e2c9a[_0xa757('0xf')]===_0xa757('0x17')&&!_0x3e2c9a[_0xa757('0x18')]){var _0x50aac1;_0x2ca96f[_0xa757('0x19')][_0xa757('0x1a')]()[_0xa757('0x1b')](function(_0x4d9f58){return _0x2ca96f['OpenchannelAccount'][_0xa757('0x1c')]({'where':{'id':_0x3e2c9a[_0xa757('0x1d')]},'include':[{'model':_0x2ca96f[_0xa757('0x1e')],'as':_0xa757('0x1f'),'where':{'id':_0x3e2c9a[_0xa757('0x12')]},'limit':0x1,'include':[{'model':_0x2ca96f[_0xa757('0x19')],'as':'Contact','attributes':_[_0xa757('0x20')](_0x4d9f58)}]}]});})['then'](function(_0x32c2a1){_0x50aac1=_0x32c2a1[_0xa757('0xe')]({'plain':!![]});if(_0x50aac1&&_0x50aac1[_0xa757('0x21')]){logger[_0xa757('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xa757('0x23')](_0xa757('0x24'),_0x3e2c9a['id'],_0x50aac1[_0xa757('0x21')]));if(_0x50aac1[_0xa757('0x1f')]&&_0x50aac1[_0xa757('0x1f')][_0xa757('0x25')]){_0x3e2c9a[_0xa757('0x26')]=_[_0xa757('0x27')](_0x50aac1[_0xa757('0x1f')][0x0],'Contact');_0x3e2c9a[_0xa757('0x28')]=_0x50aac1['Interactions'][0x0][_0xa757('0x28')];}var _0x5aef8a={'method':_0xa757('0x29'),'uri':encodeURI(_0x50aac1[_0xa757('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5aef8a[_0xa757('0x2a')]){case'GET':_0x5aef8a['qs']=_0x3e2c9a;break;case _0xa757('0x29'):_0x5aef8a[_0xa757('0xb')]=_0x3e2c9a;break;}return rp(_0x5aef8a)[_0xa757('0x1b')](function(_0x3bf7f3){logger['info'](_0xa757('0x2b'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x3e2c9a['id'],_0x50aac1['replyUri']));if(_0x3bf7f3[_0xa757('0xb')]['threadId']&&_0x3bf7f3[_0xa757('0xb')][_0xa757('0x2c')]!=_0x3e2c9a['Interaction'][_0xa757('0x2c')]){return _0x2ca96f['OpenchannelInteraction'][_0xa757('0x13')]({'threadId':_0x3bf7f3[_0xa757('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x3e2c9a[_0xa757('0x26')]['id']}});}else{return;}})['then'](function(){return _0x3a3db6[_0xa757('0x13')]({'read':!![]});})[_0xa757('0x15')](function(_0x458974){logger[_0xa757('0x16')](_0xa757('0x2b'),_0xa757('0x2d'),util[_0xa757('0x2e')](_0x458974,{'showHidden':![],'depth':null}));_0x89c630();});}else{_0x89c630();}})[_0xa757('0x2f')](function(){_0x89c630();});}else{_0x89c630();}}},'charset':_0xa757('0x30'),'collate':_0xa757('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 213d449..1ae0bb4 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(_0x4d7f7e,_0x54b8c4){var _0x469115=function(_0x258aa1){while(--_0x258aa1){_0x4d7f7e['push'](_0x4d7f7e['shift']());}};_0x469115(++_0x54b8c4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x392793,_0x1234c5){_0x392793=_0x392793-0x0;var _0x4aa4ba=_0x5f2f[_0x392793];return _0x4aa4ba;};'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(_0x5aa286,_0x3ec7a5){var _0x12551d=function(_0x3b1633){while(--_0x3b1633){_0x5aa286['push'](_0x5aa286['shift']());}};_0x12551d(++_0x3ec7a5);}(_0x1261,0x144));var _0x1126=function(_0x2d991c,_0x1583d4){_0x2d991c=_0x2d991c-0x0;var _0x3d5af5=_0x1261[_0x2d991c];return _0x3d5af5;};'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 5f8bcfd..d531adb 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 _0x280b=['update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x280b,0xce));var _0xb280=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x280b[_0x432682];return _0x463d05;};'use strict';var OpenchannelMessageEvents=require(_0xb280('0x0'));var events=[_0xb280('0x1'),'remove',_0xb280('0x2')];function createListener(_0x3c4f59,_0x444d16){return function(_0x3a59e1){_0x444d16[_0xb280('0x3')](_0x3c4f59,_0x3a59e1);};}function removeListener(_0x69abb,_0x2fa322){return function(){OpenchannelMessageEvents[_0xb280('0x4')](_0x69abb,_0x2fa322);};}exports[_0xb280('0x5')]=function(_0x5d1991){for(var _0x4d1b2e=0x0,_0x43e0ee=events[_0xb280('0x6')];_0x4d1b2e<_0x43e0ee;_0x4d1b2e++){var _0x5c98b9=events[_0x4d1b2e];var _0x12433f=createListener(_0xb280('0x7')+_0x5c98b9,_0x5d1991);OpenchannelMessageEvents['on'](_0x5c98b9,_0x12433f);}}; \ No newline at end of file +var _0x743d=['update','emit','register','length','openchannelMessage:','remove'];(function(_0x3e223b,_0x407ced){var _0x2b2d3d=function(_0x2f76b1){while(--_0x2f76b1){_0x3e223b['push'](_0x3e223b['shift']());}};_0x2b2d3d(++_0x407ced);}(_0x743d,0xa1));var _0xd743=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x743d[_0x432682];return _0x463d05;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0xd743('0x0'),_0xd743('0x1')];function createListener(_0x35bc6a,_0x284c2b){return function(_0x57eef3){_0x284c2b[_0xd743('0x2')](_0x35bc6a,_0x57eef3);};}function removeListener(_0x513e5c,_0xab6119){return function(){OpenchannelMessageEvents['removeListener'](_0x513e5c,_0xab6119);};}exports[_0xd743('0x3')]=function(_0x5942e6){for(var _0x59b38f=0x0,_0x3a442f=events[_0xd743('0x4')];_0x59b38f<_0x3a442f;_0x59b38f++){var _0x31312e=events[_0x59b38f];var _0x2e4a8f=createListener(_0xd743('0x5')+_0x31312e,_0x5942e6);OpenchannelMessageEvents['on'](_0x31312e,_0x2e4a8f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9c51544..b6d6b7c 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 _0xad75=['express','fs-extra','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','/:id','show','getMembers','/:id/teams','/:id/users','create','addTeams','addAgents','put','update','delete','exports','util','connect-timeout'];(function(_0x4d8f53,_0x5c98a1){var _0x27ac60=function(_0x42289d){while(--_0x42289d){_0x4d8f53['push'](_0x4d8f53['shift']());}};_0x27ac60(++_0x5c98a1);}(_0xad75,0x15e));var _0x5ad7=function(_0x177050,_0x53ff7d){_0x177050=_0x177050-0x0;var _0x2e094f=_0xad75[_0x177050];return _0x2e094f;};'use strict';var multer=require('multer');var util=require(_0x5ad7('0x0'));var path=require('path');var timeout=require(_0x5ad7('0x1'));var express=require(_0x5ad7('0x2'));var router=express['Router']();var fs_extra=require(_0x5ad7('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ad7('0x4'));var controller=require(_0x5ad7('0x5'));router['get']('/',auth[_0x5ad7('0x6')](),controller[_0x5ad7('0x7')]);router[_0x5ad7('0x8')](_0x5ad7('0x9'),auth[_0x5ad7('0x6')](),controller['describe']);router[_0x5ad7('0x8')](_0x5ad7('0xa'),auth[_0x5ad7('0x6')](),controller[_0x5ad7('0xb')]);router[_0x5ad7('0x8')]('/:id/members',auth[_0x5ad7('0x6')](),controller[_0x5ad7('0xc')]);router[_0x5ad7('0x8')](_0x5ad7('0xd'),auth[_0x5ad7('0x6')](),controller['getTeams']);router[_0x5ad7('0x8')](_0x5ad7('0xe'),auth[_0x5ad7('0x6')](),controller['getAgents']);router['post']('/',auth[_0x5ad7('0x6')](),controller[_0x5ad7('0xf')]);router['post'](_0x5ad7('0xd'),auth[_0x5ad7('0x6')](),controller[_0x5ad7('0x10')]);router['post'](_0x5ad7('0xe'),auth[_0x5ad7('0x6')](),controller[_0x5ad7('0x11')]);router[_0x5ad7('0x12')](_0x5ad7('0xa'),auth['isAuthenticated'](),controller[_0x5ad7('0x13')]);router[_0x5ad7('0x14')](_0x5ad7('0xa'),auth[_0x5ad7('0x6')](),controller['destroy']);router[_0x5ad7('0x14')](_0x5ad7('0xd'),auth[_0x5ad7('0x6')](),controller['removeTeams']);router['delete'](_0x5ad7('0xe'),auth[_0x5ad7('0x6')](),controller['removeAgents']);module[_0x5ad7('0x15')]=router; \ No newline at end of file +var _0x7552=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','exports','util','path','connect-timeout'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7552,0xf9));var _0x2755=function(_0x94f1d6,_0x500192){_0x94f1d6=_0x94f1d6-0x0;var _0x5f1f85=_0x7552[_0x94f1d6];return _0x5f1f85;};'use strict';var multer=require('multer');var util=require(_0x2755('0x0'));var path=require(_0x2755('0x1'));var timeout=require(_0x2755('0x2'));var express=require(_0x2755('0x3'));var router=express[_0x2755('0x4')]();var fs_extra=require(_0x2755('0x5'));var auth=require(_0x2755('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2755('0x7'));var controller=require(_0x2755('0x8'));router['get']('/',auth[_0x2755('0x9')](),controller[_0x2755('0xa')]);router[_0x2755('0xb')]('/describe',auth[_0x2755('0x9')](),controller[_0x2755('0xc')]);router[_0x2755('0xb')](_0x2755('0xd'),auth[_0x2755('0x9')](),controller[_0x2755('0xe')]);router[_0x2755('0xb')](_0x2755('0xf'),auth[_0x2755('0x9')](),controller[_0x2755('0x10')]);router['get'](_0x2755('0x11'),auth[_0x2755('0x9')](),controller[_0x2755('0x12')]);router['get'](_0x2755('0x13'),auth['isAuthenticated'](),controller[_0x2755('0x14')]);router[_0x2755('0x15')]('/',auth[_0x2755('0x9')](),controller[_0x2755('0x16')]);router[_0x2755('0x15')](_0x2755('0x11'),auth[_0x2755('0x9')](),controller[_0x2755('0x17')]);router[_0x2755('0x15')](_0x2755('0x13'),auth['isAuthenticated'](),controller[_0x2755('0x18')]);router[_0x2755('0x19')](_0x2755('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2755('0x1a')](_0x2755('0xd'),auth[_0x2755('0x9')](),controller['destroy']);router['delete'](_0x2755('0x11'),auth[_0x2755('0x9')](),controller['removeTeams']);router['delete'](_0x2755('0x13'),auth[_0x2755('0x9')](),controller['removeAgents']);module[_0x2755('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 64bfc4a..a25a97c 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 _0xd266=['INTEGER','rrmemory','sequelize','exports','STRING','name'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xd266,0x92));var _0x6d26=function(_0x5ab2a2,_0x21e9c8){_0x5ab2a2=_0x5ab2a2-0x0;var _0x34e75f=_0xd266[_0x5ab2a2];return _0x34e75f;};'use strict';var Sequelize=require(_0x6d26('0x0'));module[_0x6d26('0x1')]={'name':{'type':Sequelize[_0x6d26('0x2')],'unique':_0x6d26('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6d26('0x2')]},'timeout':{'type':Sequelize[_0x6d26('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6d26('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x49a2=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x470ce2,_0x4b3815){var _0x739076=function(_0x1f16f3){while(--_0x1f16f3){_0x470ce2['push'](_0x470ce2['shift']());}};_0x739076(++_0x4b3815);}(_0x49a2,0x82));var _0x249a=function(_0x484ad6,_0x4efaee){_0x484ad6=_0x484ad6-0x0;var _0x4950d0=_0x49a2[_0x484ad6];return _0x4950d0;};'use strict';var Sequelize=require('sequelize');module[_0x249a('0x0')]={'name':{'type':Sequelize[_0x249a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x249a('0x1')]},'timeout':{'type':Sequelize[_0x249a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x249a('0x3')](_0x249a('0x4'),_0x249a('0x5'),_0x249a('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8cba141..7f08225 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 _0xa11f=['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','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','OpenchannelQueues','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','OpenchannelQueue','includeAll','findAll','rows','catch','show','params','fields','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','online','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring'];(function(_0x32e691,_0x2ebc90){var _0x1e2664=function(_0x2ecc8a){while(--_0x2ecc8a){_0x32e691['push'](_0x32e691['shift']());}};_0x1e2664(++_0x2ebc90);}(_0xa11f,0x11a));var _0xfa11=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0xa11f[_0x128450];return _0x4d80ed;};'use strict';var emlformat=require(_0xfa11('0x0'));var rimraf=require(_0xfa11('0x1'));var zipdir=require(_0xfa11('0x2'));var jsonpatch=require(_0xfa11('0x3'));var rp=require(_0xfa11('0x4'));var moment=require(_0xfa11('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfa11('0x6'));var util=require(_0xfa11('0x7'));var path=require(_0xfa11('0x8'));var sox=require(_0xfa11('0x9'));var csv=require(_0xfa11('0xa'));var ejs=require(_0xfa11('0xb'));var fs=require('fs');var fs_extra=require(_0xfa11('0xc'));var _=require(_0xfa11('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfa11('0xe'));var toCsv=require(_0xfa11('0xa'));var querystring=require(_0xfa11('0xf'));var Papa=require(_0xfa11('0x10'));var Redis=require(_0xfa11('0x11'));var authService=require(_0xfa11('0x12'));var qs=require(_0xfa11('0x13'));var as=require(_0xfa11('0x14'));var hardwareService=require(_0xfa11('0x15'));var logger=require(_0xfa11('0x16'))(_0xfa11('0x17'));var utils=require(_0xfa11('0x18'));var config=require(_0xfa11('0x19'));var licenseUtil=require(_0xfa11('0x1a'));var db=require(_0xfa11('0x1b'))['db'];config[_0xfa11('0x1c')]=_[_0xfa11('0x1d')](config[_0xfa11('0x1c')],{'host':_0xfa11('0x1e'),'port':0x18eb});var socket=require(_0xfa11('0x1f'))(new Redis(config['redis']));require(_0xfa11('0x20'))[_0xfa11('0x21')](socket);function respondWithStatusCode(_0x53c764,_0x3a6520){_0x3a6520=_0x3a6520||0xcc;return function(_0x38b0db){if(_0x38b0db){return _0x53c764[_0xfa11('0x22')](_0x3a6520);}return _0x53c764['status'](_0x3a6520)[_0xfa11('0x23')]();};}function respondWithResult(_0x3b506d,_0x4a7090){_0x4a7090=_0x4a7090||0xc8;return function(_0x1ff11a){if(_0x1ff11a){return _0x3b506d[_0xfa11('0x24')](_0x4a7090)[_0xfa11('0x25')](_0x1ff11a);}};}function respondWithFilteredResult(_0x5e3032,_0x1adbdf){return function(_0x1f2997){if(_0x1f2997){var _0x21a40b=typeof _0x1adbdf[_0xfa11('0x26')]===_0xfa11('0x27')&&typeof _0x1adbdf[_0xfa11('0x28')]===_0xfa11('0x27');var _0x64815f=_0x1f2997['count'];var _0x33b269=_0x21a40b?0x0:_0x1adbdf[_0xfa11('0x26')];var _0x59da06=_0x21a40b?_0x1f2997[_0xfa11('0x29')]:_0x1adbdf[_0xfa11('0x26')]+_0x1adbdf[_0xfa11('0x28')];var _0x5f1afa;if(_0x59da06>=_0x64815f){_0x59da06=_0x64815f;_0x5f1afa=0xc8;}else{_0x5f1afa=0xce;}_0x5e3032[_0xfa11('0x24')](_0x5f1afa);return _0x5e3032['set'](_0xfa11('0x2a'),_0x33b269+'-'+_0x59da06+'/'+_0x64815f)[_0xfa11('0x25')](_0x1f2997);}return null;};}function patchUpdates(_0x4f8c74){return function(_0x5d015c){try{jsonpatch[_0xfa11('0x2b')](_0x5d015c,_0x4f8c74,!![]);}catch(_0x823ede){return BPromise[_0xfa11('0x2c')](_0x823ede);}return _0x5d015c['save']();};}function saveUpdates(_0x4b3a13,_0x19b007){return function(_0x5a900e){if(_0x5a900e){return _0x5a900e[_0xfa11('0x2d')](_0x4b3a13)[_0xfa11('0x2e')](function(_0x5c20c9){return _0x5c20c9;});}return null;};}function removeEntity(_0x1850cb,_0x2c6cdc){return function(_0x2e729f){if(_0x2e729f){return _0x2e729f['destroy']()['then'](function(){var _0x2aef26=_0x2e729f[_0xfa11('0x2f')]({'plain':!![]});var _0xa0099a=_0xfa11('0x30');return db['UserProfileResource'][_0xfa11('0x31')]({'where':{'type':_0xa0099a,'resourceId':_0x2aef26['id']}})['then'](function(){return _0x2e729f;});})[_0xfa11('0x2e')](function(){_0x1850cb[_0xfa11('0x24')](0xcc)[_0xfa11('0x23')]();});}};}function handleEntityNotFound(_0x46549b,_0x150acc){return function(_0x5ccff0){if(!_0x5ccff0){_0x46549b[_0xfa11('0x22')](0x194);}return _0x5ccff0;};}function handleError(_0x3ee9ab,_0x34d0b3){_0x34d0b3=_0x34d0b3||0x1f4;return function(_0x546e07){logger['error'](_0x546e07[_0xfa11('0x32')]);if(_0x546e07[_0xfa11('0x33')]){delete _0x546e07[_0xfa11('0x33')];}_0x3ee9ab[_0xfa11('0x24')](_0x34d0b3)[_0xfa11('0x34')](_0x546e07);};}exports[_0xfa11('0x35')]=function(_0x496746,_0x42ff09){var _0x22d827={},_0x2bef6c={},_0x34aaac={'count':0x0,'rows':[]};var _0x5df612=_[_0xfa11('0x36')](db['OpenchannelQueue'][_0xfa11('0x37')],function(_0x4faea7){return{'name':_0x4faea7[_0xfa11('0x38')],'type':_0x4faea7[_0xfa11('0x39')][_0xfa11('0x3a')]};});_0x2bef6c['model']=_[_0xfa11('0x36')](_0x5df612,_0xfa11('0x33'));_0x2bef6c[_0xfa11('0x3b')]=_[_0xfa11('0x3c')](_0x496746[_0xfa11('0x3b')]);_0x2bef6c[_0xfa11('0x3d')]=_['intersection'](_0x2bef6c[_0xfa11('0x3e')],_0x2bef6c[_0xfa11('0x3b')]);_0x22d827['attributes']=_[_0xfa11('0x3f')](_0x2bef6c[_0xfa11('0x3e')],qs['fields'](_0x496746[_0xfa11('0x3b')]['fields']));_0x22d827[_0xfa11('0x40')]=_0x22d827['attributes'][_0xfa11('0x41')]?_0x22d827['attributes']:_0x2bef6c[_0xfa11('0x3e')];if(!_0x496746[_0xfa11('0x3b')]['hasOwnProperty'](_0xfa11('0x42'))){_0x22d827[_0xfa11('0x28')]=qs[_0xfa11('0x28')](_0x496746[_0xfa11('0x3b')][_0xfa11('0x28')]);_0x22d827[_0xfa11('0x26')]=qs['offset'](_0x496746['query']['offset']);}_0x22d827[_0xfa11('0x43')]=qs['sort'](_0x496746[_0xfa11('0x3b')][_0xfa11('0x44')]);_0x22d827['where']=qs[_0xfa11('0x3d')](_['pick'](_0x496746['query'],_0x2bef6c['filters']),_0x5df612);if(_0x496746[_0xfa11('0x3b')][_0xfa11('0x45')]){_0x22d827[_0xfa11('0x46')]=_['merge'](_0x22d827[_0xfa11('0x46')],{'$or':_[_0xfa11('0x36')](_0x5df612,function(_0x2e4712){if(_0x2e4712[_0xfa11('0x39')]!==_0xfa11('0x47')){var _0x10bbab={};_0x10bbab[_0x2e4712[_0xfa11('0x33')]]={'$like':'%'+_0x496746[_0xfa11('0x3b')][_0xfa11('0x45')]+'%'};return _0x10bbab;}})});}_0x22d827=_[_0xfa11('0x48')]({},_0x22d827,_0x496746['options']);var _0x1b2206={'where':_0x22d827[_0xfa11('0x46')]};return db[_0xfa11('0x49')][_0xfa11('0x29')](_0x1b2206)['then'](function(_0x37fbe1){_0x34aaac[_0xfa11('0x29')]=_0x37fbe1;if(_0x496746[_0xfa11('0x3b')][_0xfa11('0x4a')]){_0x22d827['include']=[{'all':!![]}];}return db[_0xfa11('0x49')][_0xfa11('0x4b')](_0x22d827);})[_0xfa11('0x2e')](function(_0x5390e9){_0x34aaac[_0xfa11('0x4c')]=_0x5390e9;return _0x34aaac;})['then'](respondWithFilteredResult(_0x42ff09,_0x22d827))[_0xfa11('0x4d')](handleError(_0x42ff09,null));};exports[_0xfa11('0x4e')]=function(_0x4b3d71,_0x2667ee){var _0x2d8ddf={'raw':!![],'where':{'id':_0x4b3d71[_0xfa11('0x4f')]['id']}},_0x298498={};_0x298498['model']=_['keys'](db['OpenchannelQueue'][_0xfa11('0x37')]);_0x298498['query']=_[_0xfa11('0x3c')](_0x4b3d71[_0xfa11('0x3b')]);_0x298498[_0xfa11('0x3d')]=_[_0xfa11('0x3f')](_0x298498[_0xfa11('0x3e')],_0x298498[_0xfa11('0x3b')]);_0x2d8ddf[_0xfa11('0x40')]=_[_0xfa11('0x3f')](_0x298498[_0xfa11('0x3e')],qs[_0xfa11('0x50')](_0x4b3d71[_0xfa11('0x3b')][_0xfa11('0x50')]));_0x2d8ddf[_0xfa11('0x40')]=_0x2d8ddf[_0xfa11('0x40')][_0xfa11('0x41')]?_0x2d8ddf[_0xfa11('0x40')]:_0x298498[_0xfa11('0x3e')];if(_0x4b3d71[_0xfa11('0x3b')]['includeAll']){_0x2d8ddf[_0xfa11('0x51')]=[{'all':!![]}];}_0x2d8ddf=_[_0xfa11('0x48')]({},_0x2d8ddf,_0x4b3d71[_0xfa11('0x52')]);return db[_0xfa11('0x49')][_0xfa11('0x53')](_0x2d8ddf)['then'](handleEntityNotFound(_0x2667ee,null))[_0xfa11('0x2e')](respondWithResult(_0x2667ee,null))[_0xfa11('0x4d')](handleError(_0x2667ee,null));};exports[_0xfa11('0x54')]=function(_0x4510c3,_0x4f9a62){return db[_0xfa11('0x49')]['create'](_0x4510c3[_0xfa11('0x55')],{})[_0xfa11('0x2e')](function(_0x457e45){var _0x43ae48=_0x4510c3[_0xfa11('0x56')][_0xfa11('0x2f')]({'plain':!![]});if(!_0x43ae48)throw new Error(_0xfa11('0x57'));if(_0x43ae48['role']===_0xfa11('0x56')){var _0x2260c8=_0x457e45[_0xfa11('0x2f')]({'plain':!![]});var _0x24a788=_0xfa11('0x30');return db[_0xfa11('0x58')][_0xfa11('0x53')]({'where':{'name':_0x24a788,'userProfileId':_0x43ae48['userProfileId']},'raw':!![]})[_0xfa11('0x2e')](function(_0x44ad44){if(_0x44ad44&&_0x44ad44[_0xfa11('0x59')]===0x0){return db['UserProfileResource'][_0xfa11('0x54')]({'name':_0x2260c8[_0xfa11('0x33')],'resourceId':_0x2260c8['id'],'type':_0x44ad44[_0xfa11('0x33')],'sectionId':_0x44ad44['id']},{})[_0xfa11('0x2e')](function(){return _0x457e45;});}else{return _0x457e45;}})['catch'](function(_0x34cb22){logger[_0xfa11('0x5a')](_0xfa11('0x5b'),_0x34cb22);throw _0x34cb22;});}return _0x457e45;})[_0xfa11('0x2e')](respondWithResult(_0x4f9a62,0xc9))[_0xfa11('0x4d')](handleError(_0x4f9a62,null));};exports[_0xfa11('0x2d')]=function(_0x2ac38f,_0xfa7eec){if(_0x2ac38f[_0xfa11('0x55')]['id']){delete _0x2ac38f[_0xfa11('0x55')]['id'];}return db[_0xfa11('0x49')][_0xfa11('0x53')]({'where':{'id':_0x2ac38f['params']['id']}})['then'](handleEntityNotFound(_0xfa7eec,null))['then'](saveUpdates(_0x2ac38f[_0xfa11('0x55')],null))[_0xfa11('0x2e')](respondWithResult(_0xfa7eec,null))['catch'](handleError(_0xfa7eec,null));};exports[_0xfa11('0x31')]=function(_0x5b5de8,_0x51ef0e){return db['OpenchannelQueue']['find']({'where':{'id':_0x5b5de8[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](handleEntityNotFound(_0x51ef0e,null))['then'](removeEntity(_0x51ef0e,null))['catch'](handleError(_0x51ef0e,null));};exports['describe']=function(_0x4dd9ad,_0x3e42c8){return db[_0xfa11('0x49')][_0xfa11('0x5c')]()[_0xfa11('0x2e')](respondWithResult(_0x3e42c8,null))['catch'](handleError(_0x3e42c8,null));};exports[_0xfa11('0x5d')]=function(_0x5db5b9,_0x32a5ad,_0x1f6dac){var _0x206ca2={'raw':!![],'where':{}},_0x5e2a7b={},_0x446577;return db[_0xfa11('0x49')]['findOne']({'where':{'id':_0x5db5b9[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](handleEntityNotFound(_0x32a5ad,null))[_0xfa11('0x2e')](function(_0x55d90d){if(_0x55d90d){_0x446577=_0x55d90d[_0xfa11('0x2f')]({'plain':!![]});_0x5e2a7b[_0xfa11('0x3e')]=_[_0xfa11('0x3c')](db[_0xfa11('0x5e')]['rawAttributes']);_0x5e2a7b['query']=_[_0xfa11('0x3c')](_0x5db5b9[_0xfa11('0x3b')]);_0x5e2a7b[_0xfa11('0x3d')]=_[_0xfa11('0x3f')](_0x5e2a7b[_0xfa11('0x3e')],_0x5e2a7b['query']);_0x206ca2[_0xfa11('0x40')]=_[_0xfa11('0x3f')](_0x5e2a7b[_0xfa11('0x3e')],qs[_0xfa11('0x50')](_0x5db5b9['query']['fields']));_0x206ca2['attributes']=_0x206ca2[_0xfa11('0x40')][_0xfa11('0x41')]?_0x206ca2[_0xfa11('0x40')]:_0x5e2a7b[_0xfa11('0x3e')];if(!_0x5db5b9[_0xfa11('0x3b')]['hasOwnProperty']('nolimit')){_0x206ca2[_0xfa11('0x28')]=qs['limit'](_0x5db5b9['query'][_0xfa11('0x28')]);_0x206ca2[_0xfa11('0x26')]=qs[_0xfa11('0x26')](_0x5db5b9[_0xfa11('0x3b')][_0xfa11('0x26')]);}_0x206ca2[_0xfa11('0x43')]=qs['sort'](_0x5db5b9[_0xfa11('0x3b')][_0xfa11('0x44')]);_0x206ca2[_0xfa11('0x46')]=qs[_0xfa11('0x3d')](_[_0xfa11('0x5f')](_0x5db5b9[_0xfa11('0x3b')],_0x5e2a7b[_0xfa11('0x3d')]));_0x206ca2[_0xfa11('0x46')][_0xfa11('0x60')]=_0x55d90d['id'];if(_0x5db5b9['query'][_0xfa11('0x45')]){_0x206ca2[_0xfa11('0x46')]=_[_0xfa11('0x48')](_0x206ca2[_0xfa11('0x46')],{'$or':_[_0xfa11('0x36')](_0x206ca2[_0xfa11('0x40')],function(_0x9e0b2c){var _0x520937={};_0x520937[_0x9e0b2c]={'$like':'%'+_0x5db5b9['query'][_0xfa11('0x45')]+'%'};return _0x520937;})});}_0x206ca2=_[_0xfa11('0x48')]({},_0x206ca2,_0x5db5b9['options']);return db[_0xfa11('0x5e')]['findAll'](_0x206ca2);}})[_0xfa11('0x2e')](function(_0x43df88){if(_0x43df88){return db[_0xfa11('0x61')][_0xfa11('0x62')]({'where':{'id':_[_0xfa11('0x36')](_0x43df88,_0xfa11('0x63')),'role':_0xfa11('0x64')},'attributes':['id',_0xfa11('0x33'),_0xfa11('0x65'),_0xfa11('0x66'),_0xfa11('0x67')]});}})[_0xfa11('0x2e')](function(_0x173c60){if(_0x173c60){return{'count':_0x173c60[_0xfa11('0x29')],'rows':_[_0xfa11('0x36')](_0x173c60['rows'],function(_0x467538){return{'membername':_0x467538[_0xfa11('0x33')],'UserId':_0x467538['id'],'queue_name':_0x446577[_0xfa11('0x33')],'OpenchannelQueueId':_0x446577['id'],'interface':util[_0xfa11('0x68')](_0xfa11('0x69'),_0xfa11('0x6a'),_0x467538[_0xfa11('0x33')]),'penalty':0x0,'paused':_0x467538[_0xfa11('0x65')],'createdAt':_0x467538['createdAt'],'updatedAt':_0x467538['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa11('0x2e')](respondWithFilteredResult(_0x32a5ad,_0x206ca2))[_0xfa11('0x4d')](handleError(_0x32a5ad,null));};exports[_0xfa11('0x6b')]=function(_0x148401,_0x51ed45,_0x44fccd){var _0x203e27={};var _0xab1bda={};var _0x4bda9c;var _0x57517a;return db[_0xfa11('0x49')][_0xfa11('0x6c')]({'where':{'id':_0x148401[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](handleEntityNotFound(_0x51ed45,null))[_0xfa11('0x2e')](function(_0x5432d0){if(_0x5432d0){_0x4bda9c=_0x5432d0;_0xab1bda[_0xfa11('0x3e')]=_['keys'](db[_0xfa11('0x6d')][_0xfa11('0x37')]);_0xab1bda[_0xfa11('0x3b')]=_[_0xfa11('0x3c')](_0x148401[_0xfa11('0x3b')]);_0xab1bda[_0xfa11('0x3d')]=_[_0xfa11('0x3f')](_0xab1bda['model'],_0xab1bda[_0xfa11('0x3b')]);_0x203e27[_0xfa11('0x40')]=_[_0xfa11('0x3f')](_0xab1bda[_0xfa11('0x3e')],qs[_0xfa11('0x50')](_0x148401[_0xfa11('0x3b')][_0xfa11('0x50')]));_0x203e27['attributes']=_0x203e27[_0xfa11('0x40')][_0xfa11('0x41')]?_0x203e27[_0xfa11('0x40')]:_0xab1bda[_0xfa11('0x3e')];_0x203e27[_0xfa11('0x43')]=qs[_0xfa11('0x44')](_0x148401[_0xfa11('0x3b')]['sort']);_0x203e27[_0xfa11('0x46')]=qs['filters'](_[_0xfa11('0x5f')](_0x148401[_0xfa11('0x3b')],_0xab1bda[_0xfa11('0x3d')]));if(_0x148401[_0xfa11('0x3b')]['filter']){_0x203e27[_0xfa11('0x46')]=_[_0xfa11('0x48')](_0x203e27[_0xfa11('0x46')],{'$or':_[_0xfa11('0x36')](_0x203e27[_0xfa11('0x40')],function(_0x52cdfa){var _0x4f44cf={};_0x4f44cf[_0x52cdfa]={'$like':'%'+_0x148401['query'][_0xfa11('0x45')]+'%'};return _0x4f44cf;})});}_0x203e27=_[_0xfa11('0x48')]({},_0x203e27,_0x148401[_0xfa11('0x52')]);return _0x4bda9c['getTeams'](_0x203e27);}})[_0xfa11('0x2e')](function(_0x1bfa02){if(_0x1bfa02){_0x57517a=_0x1bfa02[_0xfa11('0x41')];if(!_0x148401[_0xfa11('0x3b')][_0xfa11('0x6e')](_0xfa11('0x42'))){_0x203e27[_0xfa11('0x28')]=qs['limit'](_0x148401[_0xfa11('0x3b')]['limit']);_0x203e27['offset']=qs[_0xfa11('0x26')](_0x148401['query'][_0xfa11('0x26')]);}return _0x4bda9c['getTeams'](_0x203e27);}})['then'](function(_0x230bf0){if(_0x230bf0){return _0x230bf0?{'count':_0x57517a,'rows':_0x230bf0}:null;}})[_0xfa11('0x2e')](respondWithResult(_0x51ed45,null))[_0xfa11('0x4d')](handleError(_0x51ed45,null));};exports[_0xfa11('0x6f')]=function(_0x2d131d,_0x106f2f,_0x58bb8d){var _0x73d94=_0x2d131d[_0xfa11('0x55')][_0xfa11('0x70')];return db['Team'][_0xfa11('0x4b')]({'where':{'id':_0x73d94},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xfa11('0x33'),_0xfa11('0x71'),'voicePause','interface'],'raw':!![]}]})[_0xfa11('0x2e')](function(_0x33a3d7){if(_0x33a3d7){var _0x540924=_[_0xfa11('0x72')](_0x33a3d7,function(_0x456f1f){var _0x1154e9=_0x456f1f[_0xfa11('0x2f')]({'plain':!![]});return _0x1154e9[_0xfa11('0x73')];});return db['OpenchannelQueue'][_0xfa11('0x53')]({'where':{'id':_0x2d131d[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](function(_0x27d465){return db[_0xfa11('0x74')]['transaction'](function(_0x48b396){return _0x27d465[_0xfa11('0x6f')](_0x73d94,{'transaction':_0x48b396})[_0xfa11('0x2e')](function(){return BPromise[_0xfa11('0x75')](_0x540924,function(_0xb9d696){return db[_0xfa11('0x5e')][_0xfa11('0x76')]({'where':{'UserId':_0xb9d696['id'],'OpenchannelQueueId':_0x2d131d[_0xfa11('0x4f')]['id']},'transaction':_0x48b396});});})['then'](function(){_0x540924[_0xfa11('0x77')](function(_0xba465d){socket[_0xfa11('0x78')](_0xfa11('0x79'),{'UserId':_0xba465d['id'],'OpenchannelQueueId':_0x27d465['id']});});});});});}})[_0xfa11('0x2e')](respondWithStatusCode(_0x106f2f,null))[_0xfa11('0x4d')](handleError(_0x106f2f,null));};exports['removeTeams']=function(_0x4d3ac3,_0x5674e7,_0x48480d){return db[_0xfa11('0x6d')][_0xfa11('0x4b')]({'where':{'id':_0x4d3ac3[_0xfa11('0x3b')][_0xfa11('0x70')]},'attributes':['id'],'include':[{'model':db[_0xfa11('0x61')],'as':_0xfa11('0x73'),'attributes':['id'],'raw':!![]}]})[_0xfa11('0x2e')](handleEntityNotFound(_0x5674e7,null))[_0xfa11('0x2e')](function(_0x23bd65){var _0x57d27d=_[_0xfa11('0x36')](_0x23bd65,'id');var _0x50caff=[];var _0x5d9ecc=[];var _0x19c598=squel['select']();_0x19c598[_0xfa11('0x7a')](_0xfa11('0x7b'))[_0xfa11('0x7c')](_0xfa11('0x7d'),'tq')[_0xfa11('0x7e')](_0xfa11('0x7f'),'ut',_0xfa11('0x80'))[_0xfa11('0x46')](_0xfa11('0x81'),_0x4d3ac3['params']['id']);for(var _0x264dc1=0x0;_0x264dc1<_0x23bd65[_0xfa11('0x41')];_0x264dc1+=0x1){let _0x57381a=_0x23bd65[_0x264dc1];for(var _0x3400cd=0x0;_0x3400cd<_0x57381a[_0xfa11('0x73')]['length'];_0x3400cd+=0x1){let _0x2b379c=_0x57381a['Agents'][_0x3400cd];var _0xb75d24=_0x19c598[_0xfa11('0x82')]();_0xb75d24[_0xfa11('0x46')](_0xfa11('0x83'),_0x2b379c['id']);_0x5d9ecc['push'](db['sequelize'][_0xfa11('0x3b')](_0xb75d24['toString'](),{'type':db[_0xfa11('0x74')][_0xfa11('0x84')][_0xfa11('0x85')]})['then'](function(_0x8dfda8){if(_0x8dfda8[_0xfa11('0x41')]===0x1){return _0x2b379c['id'];}else{var _0x58f786=_[_0xfa11('0x86')](_[_0xfa11('0x36')](_0x8dfda8,_0xfa11('0x87')),function(_0x5194cc){return _[_0xfa11('0x88')](_0x57d27d,_0x5194cc);});if(_0x58f786){return _0x2b379c['id'];}}}));}}return BPromise[_0xfa11('0x89')](_0x5d9ecc)['then'](function(_0x4dbd62){_0x50caff=_(_0x50caff)[_0xfa11('0x8a')](_0x4dbd62)[_0xfa11('0x8b')]()[_0xfa11('0x8c')]();return db[_0xfa11('0x49')][_0xfa11('0x53')]({'where':{'id':_0x4d3ac3[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](function(_0x2b2a86){return db[_0xfa11('0x74')][_0xfa11('0x8d')](function(_0x51eb77){return _0x2b2a86['removeTeams'](_0x4d3ac3[_0xfa11('0x3b')]['ids'],{'transaction':_0x51eb77})[_0xfa11('0x2e')](function(){if(!_[_0xfa11('0x8e')](_0x50caff)){return _0x2b2a86[_0xfa11('0x8f')](_0x50caff,{'transaction':_0x51eb77});}})[_0xfa11('0x2e')](function(){_0x50caff[_0xfa11('0x77')](function(_0x460121){socket[_0xfa11('0x78')](_0xfa11('0x90'),{'UserId':_0x460121,'OpenchannelQueueId':_0x2b2a86['id']});});});});});});})[_0xfa11('0x2e')](respondWithStatusCode(_0x5674e7,null))[_0xfa11('0x4d')](handleError(_0x5674e7,null));};exports['addAgents']=function(_0xfb2bdf,_0x430dd1,_0x149fec){return db[_0xfa11('0x49')][_0xfa11('0x53')]({'where':{'id':_0xfb2bdf[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](handleEntityNotFound(_0x430dd1,null))[_0xfa11('0x2e')](function(_0x1877f3){if(_0x1877f3){return _0x1877f3[_0xfa11('0x91')](_0xfb2bdf[_0xfa11('0x55')][_0xfa11('0x70')],_[_0xfa11('0x92')](_0xfb2bdf[_0xfa11('0x55')],['ids','id'])||{})[_0xfa11('0x93')](function(_0x1be234){for(var _0x1190f2=0x0;_0x1190f2<_0xfb2bdf['body'][_0xfa11('0x70')][_0xfa11('0x41')];_0x1190f2+=0x1){socket[_0xfa11('0x78')](_0xfa11('0x79'),{'UserId':Number(_0xfb2bdf[_0xfa11('0x55')]['ids'][_0x1190f2]),'OpenchannelQueueId':Number(_0xfb2bdf[_0xfa11('0x4f')]['id'])});}return _0x1be234;});}})[_0xfa11('0x2e')](respondWithResult(_0x430dd1,null))['catch'](handleError(_0x430dd1,null));};exports[_0xfa11('0x8f')]=function(_0x36e390,_0x210d3e,_0x3aad5b){return db[_0xfa11('0x49')][_0xfa11('0x53')]({'where':{'id':_0x36e390[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](handleEntityNotFound(_0x210d3e,null))[_0xfa11('0x2e')](function(_0x28cc16){if(_0x28cc16){return _0x28cc16[_0xfa11('0x8f')](_0x36e390[_0xfa11('0x3b')]['ids'])[_0xfa11('0x2e')](function(){if(_['isArray'](_0x36e390[_0xfa11('0x3b')][_0xfa11('0x70')])){for(var _0x48d16d=0x0;_0x48d16d<_0x36e390[_0xfa11('0x3b')][_0xfa11('0x70')]['length'];_0x48d16d+=0x1){socket[_0xfa11('0x78')](_0xfa11('0x90'),{'UserId':Number(_0x36e390[_0xfa11('0x3b')][_0xfa11('0x70')][_0x48d16d]),'OpenchannelQueueId':Number(_0x36e390[_0xfa11('0x4f')]['id'])});}}else{socket['emit'](_0xfa11('0x90'),{'UserId':Number(_0x36e390[_0xfa11('0x3b')]['ids']),'OpenchannelQueueId':Number(_0x36e390[_0xfa11('0x4f')]['id'])});}});}})[_0xfa11('0x2e')](respondWithStatusCode(_0x210d3e,null))[_0xfa11('0x4d')](handleError(_0x210d3e,null));};exports[_0xfa11('0x94')]=function(_0x578591,_0x478147,_0x547e13){var _0x1f9165={};var _0x38988d={};var _0x1b14d4;var _0x37653c;return db[_0xfa11('0x49')]['findOne']({'where':{'id':_0x578591[_0xfa11('0x4f')]['id']}})[_0xfa11('0x2e')](handleEntityNotFound(_0x478147,null))[_0xfa11('0x2e')](function(_0x3936b2){if(_0x3936b2){_0x1b14d4=_0x3936b2;_0x38988d[_0xfa11('0x3e')]=_[_0xfa11('0x3c')](db[_0xfa11('0x61')]['rawAttributes']);_0x38988d[_0xfa11('0x3b')]=_[_0xfa11('0x3c')](_0x578591['query']);_0x38988d['filters']=_['intersection'](_0x38988d[_0xfa11('0x3e')],_0x38988d[_0xfa11('0x3b')]);_0x1f9165[_0xfa11('0x40')]=_[_0xfa11('0x3f')](_0x38988d[_0xfa11('0x3e')],qs[_0xfa11('0x50')](_0x578591[_0xfa11('0x3b')]['fields']));_0x1f9165[_0xfa11('0x40')]=_0x1f9165[_0xfa11('0x40')][_0xfa11('0x41')]?_0x1f9165[_0xfa11('0x40')]:_0x38988d['model'];_0x1f9165[_0xfa11('0x43')]=qs[_0xfa11('0x44')](_0x578591[_0xfa11('0x3b')][_0xfa11('0x44')]);_0x1f9165[_0xfa11('0x46')]=qs[_0xfa11('0x3d')](_[_0xfa11('0x5f')](_0x578591['query'],_0x38988d[_0xfa11('0x3d')]));if(_0x578591[_0xfa11('0x3b')][_0xfa11('0x45')]){_0x1f9165['where']=_['merge'](_0x1f9165[_0xfa11('0x46')],{'$or':_['map'](_0x1f9165[_0xfa11('0x40')],function(_0x5758bd){var _0x2273dc={};_0x2273dc[_0x5758bd]={'$like':'%'+_0x578591[_0xfa11('0x3b')]['filter']+'%'};return _0x2273dc;})});}_0x1f9165=_['merge']({},_0x1f9165,_0x578591[_0xfa11('0x52')]);return _0x1b14d4[_0xfa11('0x94')](_0x1f9165);}})[_0xfa11('0x2e')](function(_0x53a6c2){if(_0x53a6c2){_0x37653c=_0x53a6c2[_0xfa11('0x41')];if(!_0x578591[_0xfa11('0x3b')]['hasOwnProperty'](_0xfa11('0x42'))){_0x1f9165['limit']=qs[_0xfa11('0x28')](_0x578591[_0xfa11('0x3b')][_0xfa11('0x28')]);_0x1f9165[_0xfa11('0x26')]=qs[_0xfa11('0x26')](_0x578591[_0xfa11('0x3b')][_0xfa11('0x26')]);}return _0x1b14d4[_0xfa11('0x94')](_0x1f9165);}})[_0xfa11('0x2e')](function(_0x2ff022){if(_0x2ff022){return _0x2ff022?{'count':_0x37653c,'rows':_0x2ff022}:null;}})[_0xfa11('0x2e')](respondWithResult(_0x478147,null))['catch'](handleError(_0x478147,null));}; \ No newline at end of file +var _0x4a7e=['push','toString','QueryTypes','every','includes','all','union','compact','value','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','name','filter','options','includeAll','findAll','rows','catch','show','params','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','pick','merge','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','addTeams','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','emit','removeTeams','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone'];(function(_0x436db1,_0x3866f3){var _0x1493c7=function(_0x3424b8){while(--_0x3424b8){_0x436db1['push'](_0x436db1['shift']());}};_0x1493c7(++_0x3866f3);}(_0x4a7e,0x9c));var _0xe4a7=function(_0x43c789,_0x41c25c){_0x43c789=_0x43c789-0x0;var _0x17fd90=_0x4a7e[_0x43c789];return _0x17fd90;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe4a7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4a7('0x1'));var moment=require(_0xe4a7('0x2'));var BPromise=require(_0xe4a7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe4a7('0x4'));var sox=require(_0xe4a7('0x5'));var csv=require('to-csv');var ejs=require(_0xe4a7('0x6'));var fs=require('fs');var fs_extra=require(_0xe4a7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4a7('0x8'));var jsforce=require(_0xe4a7('0x9'));var deskjs=require(_0xe4a7('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe4a7('0xb'));var Papa=require(_0xe4a7('0xc'));var Redis=require(_0xe4a7('0xd'));var authService=require(_0xe4a7('0xe'));var qs=require(_0xe4a7('0xf'));var as=require(_0xe4a7('0x10'));var hardwareService=require(_0xe4a7('0x11'));var logger=require(_0xe4a7('0x12'))('api');var utils=require(_0xe4a7('0x13'));var config=require(_0xe4a7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4a7('0x15'))['db'];config[_0xe4a7('0x16')]=_['defaults'](config[_0xe4a7('0x16')],{'host':_0xe4a7('0x17'),'port':0x18eb});var socket=require(_0xe4a7('0x18'))(new Redis(config[_0xe4a7('0x16')]));require(_0xe4a7('0x19'))[_0xe4a7('0x1a')](socket);function respondWithStatusCode(_0xddd207,_0x11f4af){_0x11f4af=_0x11f4af||0xcc;return function(_0x5610b2){if(_0x5610b2){return _0xddd207[_0xe4a7('0x1b')](_0x11f4af);}return _0xddd207['status'](_0x11f4af)[_0xe4a7('0x1c')]();};}function respondWithResult(_0x6c337b,_0x377467){_0x377467=_0x377467||0xc8;return function(_0x40756b){if(_0x40756b){return _0x6c337b[_0xe4a7('0x1d')](_0x377467)[_0xe4a7('0x1e')](_0x40756b);}};}function respondWithFilteredResult(_0xde2c26,_0x58a734){return function(_0x4b9795){if(_0x4b9795){var _0xc48fa6=typeof _0x58a734[_0xe4a7('0x1f')]===_0xe4a7('0x20')&&typeof _0x58a734[_0xe4a7('0x21')]===_0xe4a7('0x20');var _0x12b0ec=_0x4b9795[_0xe4a7('0x22')];var _0x527481=_0xc48fa6?0x0:_0x58a734[_0xe4a7('0x1f')];var _0x234c20=_0xc48fa6?_0x4b9795[_0xe4a7('0x22')]:_0x58a734[_0xe4a7('0x1f')]+_0x58a734[_0xe4a7('0x21')];var _0x52edf9;if(_0x234c20>=_0x12b0ec){_0x234c20=_0x12b0ec;_0x52edf9=0xc8;}else{_0x52edf9=0xce;}_0xde2c26[_0xe4a7('0x1d')](_0x52edf9);return _0xde2c26[_0xe4a7('0x23')](_0xe4a7('0x24'),_0x527481+'-'+_0x234c20+'/'+_0x12b0ec)[_0xe4a7('0x1e')](_0x4b9795);}return null;};}function patchUpdates(_0x1bfc89){return function(_0x534464){try{jsonpatch[_0xe4a7('0x25')](_0x534464,_0x1bfc89,!![]);}catch(_0x27aa75){return BPromise[_0xe4a7('0x26')](_0x27aa75);}return _0x534464[_0xe4a7('0x27')]();};}function saveUpdates(_0x474a54,_0x26e30e){return function(_0x138a82){if(_0x138a82){return _0x138a82[_0xe4a7('0x28')](_0x474a54)[_0xe4a7('0x29')](function(_0x1dd76d){return _0x1dd76d;});}return null;};}function removeEntity(_0x5fac00,_0x1ab159){return function(_0x43f431){if(_0x43f431){return _0x43f431[_0xe4a7('0x2a')]()[_0xe4a7('0x29')](function(){var _0x483d46=_0x43f431[_0xe4a7('0x2b')]({'plain':!![]});var _0x5bd9b4=_0xe4a7('0x2c');return db['UserProfileResource'][_0xe4a7('0x2a')]({'where':{'type':_0x5bd9b4,'resourceId':_0x483d46['id']}})[_0xe4a7('0x29')](function(){return _0x43f431;});})[_0xe4a7('0x29')](function(){_0x5fac00[_0xe4a7('0x1d')](0xcc)[_0xe4a7('0x1c')]();});}};}function handleEntityNotFound(_0x38e6bf,_0x321979){return function(_0x13494f){if(!_0x13494f){_0x38e6bf[_0xe4a7('0x1b')](0x194);}return _0x13494f;};}function handleError(_0x1fe8a2,_0x60153f){_0x60153f=_0x60153f||0x1f4;return function(_0x329121){logger['error'](_0x329121['stack']);if(_0x329121['name']){delete _0x329121['name'];}_0x1fe8a2[_0xe4a7('0x1d')](_0x60153f)[_0xe4a7('0x2d')](_0x329121);};}exports[_0xe4a7('0x2e')]=function(_0x18946e,_0x580fc2){var _0x340492={},_0x4598df={},_0x39dc69={'count':0x0,'rows':[]};var _0x43ab6f=_[_0xe4a7('0x2f')](db[_0xe4a7('0x30')][_0xe4a7('0x31')],function(_0x2b3148){return{'name':_0x2b3148[_0xe4a7('0x32')],'type':_0x2b3148[_0xe4a7('0x33')][_0xe4a7('0x34')]};});_0x4598df[_0xe4a7('0x35')]=_[_0xe4a7('0x2f')](_0x43ab6f,'name');_0x4598df['query']=_[_0xe4a7('0x36')](_0x18946e[_0xe4a7('0x37')]);_0x4598df[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x4598df[_0xe4a7('0x35')],_0x4598df[_0xe4a7('0x37')]);_0x340492['attributes']=_['intersection'](_0x4598df[_0xe4a7('0x35')],qs['fields'](_0x18946e[_0xe4a7('0x37')]['fields']));_0x340492['attributes']=_0x340492[_0xe4a7('0x3a')][_0xe4a7('0x3b')]?_0x340492[_0xe4a7('0x3a')]:_0x4598df[_0xe4a7('0x35')];if(!_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x3c')](_0xe4a7('0x3d'))){_0x340492[_0xe4a7('0x21')]=qs[_0xe4a7('0x21')](_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x21')]);_0x340492[_0xe4a7('0x1f')]=qs[_0xe4a7('0x1f')](_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}_0x340492['order']=qs[_0xe4a7('0x3e')](_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x3e')]);_0x340492[_0xe4a7('0x3f')]=qs[_0xe4a7('0x38')](_['pick'](_0x18946e[_0xe4a7('0x37')],_0x4598df[_0xe4a7('0x38')]),_0x43ab6f);if(_0x18946e['query']['filter']){_0x340492[_0xe4a7('0x3f')]=_['merge'](_0x340492[_0xe4a7('0x3f')],{'$or':_['map'](_0x43ab6f,function(_0x4cbc2a){if(_0x4cbc2a['type']!==_0xe4a7('0x40')){var _0x235a03={};_0x235a03[_0x4cbc2a[_0xe4a7('0x41')]]={'$like':'%'+_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x42')]+'%'};return _0x235a03;}})});}_0x340492=_['merge']({},_0x340492,_0x18946e[_0xe4a7('0x43')]);var _0x3073a1={'where':_0x340492[_0xe4a7('0x3f')]};return db['OpenchannelQueue']['count'](_0x3073a1)[_0xe4a7('0x29')](function(_0x418205){_0x39dc69[_0xe4a7('0x22')]=_0x418205;if(_0x18946e[_0xe4a7('0x37')][_0xe4a7('0x44')]){_0x340492['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0xe4a7('0x45')](_0x340492);})['then'](function(_0x2455d4){_0x39dc69[_0xe4a7('0x46')]=_0x2455d4;return _0x39dc69;})[_0xe4a7('0x29')](respondWithFilteredResult(_0x580fc2,_0x340492))[_0xe4a7('0x47')](handleError(_0x580fc2,null));};exports[_0xe4a7('0x48')]=function(_0x5b3bab,_0x40acf7){var _0xf28d9e={'raw':!![],'where':{'id':_0x5b3bab[_0xe4a7('0x49')]['id']}},_0x4e82f0={};_0x4e82f0[_0xe4a7('0x35')]=_[_0xe4a7('0x36')](db[_0xe4a7('0x30')][_0xe4a7('0x31')]);_0x4e82f0[_0xe4a7('0x37')]=_[_0xe4a7('0x36')](_0x5b3bab[_0xe4a7('0x37')]);_0x4e82f0[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x4e82f0[_0xe4a7('0x35')],_0x4e82f0[_0xe4a7('0x37')]);_0xf28d9e[_0xe4a7('0x3a')]=_[_0xe4a7('0x39')](_0x4e82f0[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x5b3bab[_0xe4a7('0x37')][_0xe4a7('0x4a')]));_0xf28d9e[_0xe4a7('0x3a')]=_0xf28d9e['attributes'][_0xe4a7('0x3b')]?_0xf28d9e[_0xe4a7('0x3a')]:_0x4e82f0[_0xe4a7('0x35')];if(_0x5b3bab[_0xe4a7('0x37')][_0xe4a7('0x44')]){_0xf28d9e['include']=[{'all':!![]}];}_0xf28d9e=_['merge']({},_0xf28d9e,_0x5b3bab[_0xe4a7('0x43')]);return db['OpenchannelQueue']['find'](_0xf28d9e)[_0xe4a7('0x29')](handleEntityNotFound(_0x40acf7,null))[_0xe4a7('0x29')](respondWithResult(_0x40acf7,null))[_0xe4a7('0x47')](handleError(_0x40acf7,null));};exports[_0xe4a7('0x4b')]=function(_0x3e9117,_0x53cf39){return db[_0xe4a7('0x30')][_0xe4a7('0x4b')](_0x3e9117['body'],{})[_0xe4a7('0x29')](function(_0x5229c7){var _0x43582f=_0x3e9117[_0xe4a7('0x4c')][_0xe4a7('0x2b')]({'plain':!![]});if(!_0x43582f)throw new Error(_0xe4a7('0x4d'));if(_0x43582f[_0xe4a7('0x4e')]===_0xe4a7('0x4c')){var _0x454ae1=_0x5229c7['get']({'plain':!![]});var _0x1c38f2='OpenchannelQueues';return db[_0xe4a7('0x4f')][_0xe4a7('0x50')]({'where':{'name':_0x1c38f2,'userProfileId':_0x43582f[_0xe4a7('0x51')]},'raw':!![]})[_0xe4a7('0x29')](function(_0xaeefe1){if(_0xaeefe1&&_0xaeefe1[_0xe4a7('0x52')]===0x0){return db[_0xe4a7('0x53')][_0xe4a7('0x4b')]({'name':_0x454ae1[_0xe4a7('0x41')],'resourceId':_0x454ae1['id'],'type':_0xaeefe1[_0xe4a7('0x41')],'sectionId':_0xaeefe1['id']},{})['then'](function(){return _0x5229c7;});}else{return _0x5229c7;}})[_0xe4a7('0x47')](function(_0x38aa7d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38aa7d);throw _0x38aa7d;});}return _0x5229c7;})['then'](respondWithResult(_0x53cf39,0xc9))[_0xe4a7('0x47')](handleError(_0x53cf39,null));};exports[_0xe4a7('0x28')]=function(_0x2f63ba,_0x36d26f){if(_0x2f63ba[_0xe4a7('0x54')]['id']){delete _0x2f63ba[_0xe4a7('0x54')]['id'];}return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x2f63ba[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x36d26f,null))[_0xe4a7('0x29')](saveUpdates(_0x2f63ba[_0xe4a7('0x54')],null))[_0xe4a7('0x29')](respondWithResult(_0x36d26f,null))[_0xe4a7('0x47')](handleError(_0x36d26f,null));};exports[_0xe4a7('0x2a')]=function(_0x1c2172,_0x3c514c){return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x1c2172['params']['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x3c514c,null))[_0xe4a7('0x29')](removeEntity(_0x3c514c,null))['catch'](handleError(_0x3c514c,null));};exports[_0xe4a7('0x55')]=function(_0x13036e,_0x2c0f7f){return db[_0xe4a7('0x30')][_0xe4a7('0x55')]()[_0xe4a7('0x29')](respondWithResult(_0x2c0f7f,null))['catch'](handleError(_0x2c0f7f,null));};exports[_0xe4a7('0x56')]=function(_0x7a10dc,_0x220e5a,_0xfb5412){var _0x4a538b={'raw':!![],'where':{}},_0x51869e={},_0x6a515d;return db[_0xe4a7('0x30')]['findOne']({'where':{'id':_0x7a10dc[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x220e5a,null))[_0xe4a7('0x29')](function(_0x1b857d){if(_0x1b857d){_0x6a515d=_0x1b857d[_0xe4a7('0x2b')]({'plain':!![]});_0x51869e[_0xe4a7('0x35')]=_['keys'](db['UserOpenchannelQueue'][_0xe4a7('0x31')]);_0x51869e[_0xe4a7('0x37')]=_['keys'](_0x7a10dc[_0xe4a7('0x37')]);_0x51869e[_0xe4a7('0x38')]=_['intersection'](_0x51869e[_0xe4a7('0x35')],_0x51869e[_0xe4a7('0x37')]);_0x4a538b['attributes']=_[_0xe4a7('0x39')](_0x51869e[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x7a10dc['query'][_0xe4a7('0x4a')]));_0x4a538b[_0xe4a7('0x3a')]=_0x4a538b['attributes'][_0xe4a7('0x3b')]?_0x4a538b[_0xe4a7('0x3a')]:_0x51869e[_0xe4a7('0x35')];if(!_0x7a10dc[_0xe4a7('0x37')][_0xe4a7('0x3c')](_0xe4a7('0x3d'))){_0x4a538b[_0xe4a7('0x21')]=qs[_0xe4a7('0x21')](_0x7a10dc[_0xe4a7('0x37')][_0xe4a7('0x21')]);_0x4a538b[_0xe4a7('0x1f')]=qs[_0xe4a7('0x1f')](_0x7a10dc[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}_0x4a538b['order']=qs[_0xe4a7('0x3e')](_0x7a10dc[_0xe4a7('0x37')]['sort']);_0x4a538b['where']=qs[_0xe4a7('0x38')](_[_0xe4a7('0x57')](_0x7a10dc[_0xe4a7('0x37')],_0x51869e['filters']));_0x4a538b[_0xe4a7('0x3f')]['OpenchannelQueueId']=_0x1b857d['id'];if(_0x7a10dc['query']['filter']){_0x4a538b[_0xe4a7('0x3f')]=_[_0xe4a7('0x58')](_0x4a538b['where'],{'$or':_[_0xe4a7('0x2f')](_0x4a538b[_0xe4a7('0x3a')],function(_0x4cbe78){var _0x45d143={};_0x45d143[_0x4cbe78]={'$like':'%'+_0x7a10dc['query'][_0xe4a7('0x42')]+'%'};return _0x45d143;})});}_0x4a538b=_[_0xe4a7('0x58')]({},_0x4a538b,_0x7a10dc[_0xe4a7('0x43')]);return db['UserOpenchannelQueue'][_0xe4a7('0x45')](_0x4a538b);}})['then'](function(_0x29f096){if(_0x29f096){return db[_0xe4a7('0x59')][_0xe4a7('0x5a')]({'where':{'id':_[_0xe4a7('0x2f')](_0x29f096,_0xe4a7('0x5b')),'role':_0xe4a7('0x5c')},'attributes':['id',_0xe4a7('0x41'),_0xe4a7('0x5d'),'updatedAt',_0xe4a7('0x5e')]});}})[_0xe4a7('0x29')](function(_0x53d1d1){if(_0x53d1d1){return{'count':_0x53d1d1['count'],'rows':_[_0xe4a7('0x2f')](_0x53d1d1[_0xe4a7('0x46')],function(_0x25179c){return{'membername':_0x25179c[_0xe4a7('0x41')],'UserId':_0x25179c['id'],'queue_name':_0x6a515d['name'],'OpenchannelQueueId':_0x6a515d['id'],'interface':util[_0xe4a7('0x5f')](_0xe4a7('0x60'),_0xe4a7('0x61'),_0x25179c[_0xe4a7('0x41')]),'penalty':0x0,'paused':_0x25179c[_0xe4a7('0x5d')],'createdAt':_0x25179c[_0xe4a7('0x5e')],'updatedAt':_0x25179c[_0xe4a7('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4a7('0x29')](respondWithFilteredResult(_0x220e5a,_0x4a538b))[_0xe4a7('0x47')](handleError(_0x220e5a,null));};exports[_0xe4a7('0x63')]=function(_0x76ddb6,_0x16f5ef,_0x7d9da8){var _0x47f3bf={};var _0x313444={};var _0x491941;var _0x1033cc;return db['OpenchannelQueue'][_0xe4a7('0x64')]({'where':{'id':_0x76ddb6[_0xe4a7('0x49')]['id']}})['then'](handleEntityNotFound(_0x16f5ef,null))[_0xe4a7('0x29')](function(_0x34e395){if(_0x34e395){_0x491941=_0x34e395;_0x313444[_0xe4a7('0x35')]=_[_0xe4a7('0x36')](db[_0xe4a7('0x65')][_0xe4a7('0x31')]);_0x313444[_0xe4a7('0x37')]=_[_0xe4a7('0x36')](_0x76ddb6[_0xe4a7('0x37')]);_0x313444[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x313444['model'],_0x313444[_0xe4a7('0x37')]);_0x47f3bf[_0xe4a7('0x3a')]=_[_0xe4a7('0x39')](_0x313444[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x76ddb6['query'][_0xe4a7('0x4a')]));_0x47f3bf[_0xe4a7('0x3a')]=_0x47f3bf[_0xe4a7('0x3a')][_0xe4a7('0x3b')]?_0x47f3bf[_0xe4a7('0x3a')]:_0x313444[_0xe4a7('0x35')];_0x47f3bf[_0xe4a7('0x66')]=qs[_0xe4a7('0x3e')](_0x76ddb6['query'][_0xe4a7('0x3e')]);_0x47f3bf[_0xe4a7('0x3f')]=qs[_0xe4a7('0x38')](_['pick'](_0x76ddb6[_0xe4a7('0x37')],_0x313444['filters']));if(_0x76ddb6[_0xe4a7('0x37')]['filter']){_0x47f3bf[_0xe4a7('0x3f')]=_[_0xe4a7('0x58')](_0x47f3bf[_0xe4a7('0x3f')],{'$or':_[_0xe4a7('0x2f')](_0x47f3bf['attributes'],function(_0x24b939){var _0x55c941={};_0x55c941[_0x24b939]={'$like':'%'+_0x76ddb6['query'][_0xe4a7('0x42')]+'%'};return _0x55c941;})});}_0x47f3bf=_[_0xe4a7('0x58')]({},_0x47f3bf,_0x76ddb6[_0xe4a7('0x43')]);return _0x491941['getTeams'](_0x47f3bf);}})[_0xe4a7('0x29')](function(_0x4ecdcf){if(_0x4ecdcf){_0x1033cc=_0x4ecdcf[_0xe4a7('0x3b')];if(!_0x76ddb6['query']['hasOwnProperty'](_0xe4a7('0x3d'))){_0x47f3bf[_0xe4a7('0x21')]=qs['limit'](_0x76ddb6['query'][_0xe4a7('0x21')]);_0x47f3bf['offset']=qs[_0xe4a7('0x1f')](_0x76ddb6[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}return _0x491941[_0xe4a7('0x63')](_0x47f3bf);}})[_0xe4a7('0x29')](function(_0x26f545){if(_0x26f545){return _0x26f545?{'count':_0x1033cc,'rows':_0x26f545}:null;}})[_0xe4a7('0x29')](respondWithResult(_0x16f5ef,null))[_0xe4a7('0x47')](handleError(_0x16f5ef,null));};exports[_0xe4a7('0x67')]=function(_0x21b882,_0x590a31,_0x3de2a0){var _0x3b5696=_0x21b882[_0xe4a7('0x54')]['ids'];return db[_0xe4a7('0x65')]['findAll']({'where':{'id':_0x3b5696},'attributes':['id'],'include':[{'model':db[_0xe4a7('0x59')],'as':_0xe4a7('0x68'),'attributes':['id',_0xe4a7('0x41'),_0xe4a7('0x69'),_0xe4a7('0x6a'),_0xe4a7('0x6b')],'raw':!![]}]})[_0xe4a7('0x29')](function(_0x121260){if(_0x121260){var _0x55abf2=_['flatMap'](_0x121260,function(_0x219f72){var _0x3d747c=_0x219f72[_0xe4a7('0x2b')]({'plain':!![]});return _0x3d747c[_0xe4a7('0x68')];});return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x21b882[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](function(_0x2d3906){return db[_0xe4a7('0x6c')][_0xe4a7('0x6d')](function(_0x152937){return _0x2d3906['addTeams'](_0x3b5696,{'transaction':_0x152937})[_0xe4a7('0x29')](function(){return BPromise['each'](_0x55abf2,function(_0xe8eb62){return db['UserOpenchannelQueue'][_0xe4a7('0x6e')]({'where':{'UserId':_0xe8eb62['id'],'OpenchannelQueueId':_0x21b882[_0xe4a7('0x49')]['id']},'transaction':_0x152937});});})[_0xe4a7('0x29')](function(){_0x55abf2['forEach'](function(_0x2c10cc){socket[_0xe4a7('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x2c10cc['id'],'OpenchannelQueueId':_0x2d3906['id']});});});});});}})[_0xe4a7('0x29')](respondWithStatusCode(_0x590a31,null))['catch'](handleError(_0x590a31,null));};exports[_0xe4a7('0x70')]=function(_0x500c24,_0x1a6d6e,_0x10a682){return db[_0xe4a7('0x65')][_0xe4a7('0x45')]({'where':{'id':_0x500c24[_0xe4a7('0x37')][_0xe4a7('0x71')]},'attributes':['id'],'include':[{'model':db[_0xe4a7('0x59')],'as':_0xe4a7('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe4a7('0x29')](handleEntityNotFound(_0x1a6d6e,null))[_0xe4a7('0x29')](function(_0x1c85fb){var _0x20b231=_[_0xe4a7('0x2f')](_0x1c85fb,'id');var _0x4bc9d4=[];var _0xfa338a=[];var _0x9d1c81=squel[_0xe4a7('0x72')]();_0x9d1c81[_0xe4a7('0x73')]('tq.TeamId')[_0xe4a7('0x74')](_0xe4a7('0x75'),'tq')[_0xe4a7('0x76')](_0xe4a7('0x77'),'ut',_0xe4a7('0x78'))[_0xe4a7('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x500c24['params']['id']);for(var _0x4a2dc1=0x0;_0x4a2dc1<_0x1c85fb['length'];_0x4a2dc1+=0x1){let _0xffeebe=_0x1c85fb[_0x4a2dc1];for(var _0x323c40=0x0;_0x323c40<_0xffeebe[_0xe4a7('0x68')][_0xe4a7('0x3b')];_0x323c40+=0x1){let _0x331a13=_0xffeebe['Agents'][_0x323c40];var _0x11e217=_0x9d1c81[_0xe4a7('0x79')]();_0x11e217[_0xe4a7('0x3f')]('ut.UserId\x20=\x20?',_0x331a13['id']);_0xfa338a[_0xe4a7('0x7a')](db[_0xe4a7('0x6c')][_0xe4a7('0x37')](_0x11e217[_0xe4a7('0x7b')](),{'type':db[_0xe4a7('0x6c')][_0xe4a7('0x7c')]['SELECT']})[_0xe4a7('0x29')](function(_0x6a32cb){if(_0x6a32cb['length']===0x1){return _0x331a13['id'];}else{var _0x50da0f=_[_0xe4a7('0x7d')](_[_0xe4a7('0x2f')](_0x6a32cb,'TeamId'),function(_0x4d5e7d){return _[_0xe4a7('0x7e')](_0x20b231,_0x4d5e7d);});if(_0x50da0f){return _0x331a13['id'];}}}));}}return BPromise[_0xe4a7('0x7f')](_0xfa338a)[_0xe4a7('0x29')](function(_0x32e24e){_0x4bc9d4=_(_0x4bc9d4)[_0xe4a7('0x80')](_0x32e24e)[_0xe4a7('0x81')]()[_0xe4a7('0x82')]();return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x500c24[_0xe4a7('0x49')]['id']}})['then'](function(_0xd7495c){return db[_0xe4a7('0x6c')][_0xe4a7('0x6d')](function(_0x18118f){return _0xd7495c[_0xe4a7('0x70')](_0x500c24[_0xe4a7('0x37')]['ids'],{'transaction':_0x18118f})[_0xe4a7('0x29')](function(){if(!_['isEmpty'](_0x4bc9d4)){return _0xd7495c[_0xe4a7('0x83')](_0x4bc9d4,{'transaction':_0x18118f});}})[_0xe4a7('0x29')](function(){_0x4bc9d4[_0xe4a7('0x84')](function(_0x335a48){socket[_0xe4a7('0x6f')](_0xe4a7('0x85'),{'UserId':_0x335a48,'OpenchannelQueueId':_0xd7495c['id']});});});});});});})['then'](respondWithStatusCode(_0x1a6d6e,null))[_0xe4a7('0x47')](handleError(_0x1a6d6e,null));};exports[_0xe4a7('0x86')]=function(_0x64fa5e,_0xd9e5ed,_0x18a2d6){return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x64fa5e[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0xd9e5ed,null))[_0xe4a7('0x29')](function(_0x39d6e3){if(_0x39d6e3){return _0x39d6e3[_0xe4a7('0x86')](_0x64fa5e[_0xe4a7('0x54')][_0xe4a7('0x71')],_[_0xe4a7('0x87')](_0x64fa5e[_0xe4a7('0x54')],[_0xe4a7('0x71'),'id'])||{})[_0xe4a7('0x88')](function(_0xf2b3fb){for(var _0x36ad53=0x0;_0x36ad53<_0x64fa5e[_0xe4a7('0x54')]['ids'][_0xe4a7('0x3b')];_0x36ad53+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x64fa5e[_0xe4a7('0x54')][_0xe4a7('0x71')][_0x36ad53]),'OpenchannelQueueId':Number(_0x64fa5e[_0xe4a7('0x49')]['id'])});}return _0xf2b3fb;});}})['then'](respondWithResult(_0xd9e5ed,null))[_0xe4a7('0x47')](handleError(_0xd9e5ed,null));};exports['removeAgents']=function(_0x570654,_0x184710,_0x166a1d){return db[_0xe4a7('0x30')][_0xe4a7('0x50')]({'where':{'id':_0x570654['params']['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x184710,null))['then'](function(_0x2448d4){if(_0x2448d4){return _0x2448d4[_0xe4a7('0x83')](_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')])[_0xe4a7('0x29')](function(){if(_[_0xe4a7('0x89')](_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')])){for(var _0x4b840d=0x0;_0x4b840d<_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')][_0xe4a7('0x3b')];_0x4b840d+=0x1){socket[_0xe4a7('0x6f')](_0xe4a7('0x85'),{'UserId':Number(_0x570654[_0xe4a7('0x37')][_0xe4a7('0x71')][_0x4b840d]),'OpenchannelQueueId':Number(_0x570654[_0xe4a7('0x49')]['id'])});}}else{socket['emit'](_0xe4a7('0x85'),{'UserId':Number(_0x570654['query'][_0xe4a7('0x71')]),'OpenchannelQueueId':Number(_0x570654[_0xe4a7('0x49')]['id'])});}});}})[_0xe4a7('0x29')](respondWithStatusCode(_0x184710,null))[_0xe4a7('0x47')](handleError(_0x184710,null));};exports[_0xe4a7('0x8a')]=function(_0x50ed82,_0x5450c7,_0x5350fd){var _0x3b0706={};var _0x417b0a={};var _0x2fffc1;var _0x361667;return db[_0xe4a7('0x30')]['findOne']({'where':{'id':_0x50ed82[_0xe4a7('0x49')]['id']}})[_0xe4a7('0x29')](handleEntityNotFound(_0x5450c7,null))['then'](function(_0x4104d0){if(_0x4104d0){_0x2fffc1=_0x4104d0;_0x417b0a[_0xe4a7('0x35')]=_[_0xe4a7('0x36')](db['User'][_0xe4a7('0x31')]);_0x417b0a[_0xe4a7('0x37')]=_[_0xe4a7('0x36')](_0x50ed82[_0xe4a7('0x37')]);_0x417b0a[_0xe4a7('0x38')]=_[_0xe4a7('0x39')](_0x417b0a[_0xe4a7('0x35')],_0x417b0a['query']);_0x3b0706[_0xe4a7('0x3a')]=_[_0xe4a7('0x39')](_0x417b0a[_0xe4a7('0x35')],qs[_0xe4a7('0x4a')](_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x4a')]));_0x3b0706[_0xe4a7('0x3a')]=_0x3b0706[_0xe4a7('0x3a')][_0xe4a7('0x3b')]?_0x3b0706[_0xe4a7('0x3a')]:_0x417b0a['model'];_0x3b0706[_0xe4a7('0x66')]=qs[_0xe4a7('0x3e')](_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x3e')]);_0x3b0706[_0xe4a7('0x3f')]=qs[_0xe4a7('0x38')](_['pick'](_0x50ed82['query'],_0x417b0a[_0xe4a7('0x38')]));if(_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x42')]){_0x3b0706['where']=_[_0xe4a7('0x58')](_0x3b0706[_0xe4a7('0x3f')],{'$or':_[_0xe4a7('0x2f')](_0x3b0706['attributes'],function(_0x10c20d){var _0x958082={};_0x958082[_0x10c20d]={'$like':'%'+_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x42')]+'%'};return _0x958082;})});}_0x3b0706=_[_0xe4a7('0x58')]({},_0x3b0706,_0x50ed82['options']);return _0x2fffc1[_0xe4a7('0x8a')](_0x3b0706);}})[_0xe4a7('0x29')](function(_0x1f538c){if(_0x1f538c){_0x361667=_0x1f538c[_0xe4a7('0x3b')];if(!_0x50ed82[_0xe4a7('0x37')]['hasOwnProperty'](_0xe4a7('0x3d'))){_0x3b0706[_0xe4a7('0x21')]=qs[_0xe4a7('0x21')](_0x50ed82[_0xe4a7('0x37')]['limit']);_0x3b0706[_0xe4a7('0x1f')]=qs[_0xe4a7('0x1f')](_0x50ed82[_0xe4a7('0x37')][_0xe4a7('0x1f')]);}return _0x2fffc1[_0xe4a7('0x8a')](_0x3b0706);}})[_0xe4a7('0x29')](function(_0x3103fe){if(_0x3103fe){return _0x3103fe?{'count':_0x361667,'rows':_0x3103fe}:null;}})['then'](respondWithResult(_0x5450c7,null))['catch'](handleError(_0x5450c7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c8c5c24..072b01c 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 _0x23d5=['emit','hook','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23d5,0x1de));var _0x523d=function(_0x531104,_0x28d5e2){_0x531104=_0x531104-0x0;var _0x12c1f9=_0x23d5[_0x531104];return _0x12c1f9;};'use strict';var EventEmitter=require(_0x523d('0x0'));var OpenchannelQueue=require(_0x523d('0x1'))['db'][_0x523d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x523d('0x3'),'afterUpdate':_0x523d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x282fc1){return function(_0x188478,_0x336225,_0x4e668d){OpenchannelQueueEvents[_0x523d('0x5')](_0x282fc1+':'+_0x188478['id'],_0x188478);OpenchannelQueueEvents['emit'](_0x282fc1,_0x188478);_0x4e668d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x523d('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x021c=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hook'];(function(_0x4d6c31,_0xcc39a){var _0x1652bb=function(_0x372824){while(--_0x372824){_0x4d6c31['push'](_0x4d6c31['shift']());}};_0x1652bb(++_0xcc39a);}(_0x021c,0xa3));var _0xc021=function(_0x4a57b0,_0x3ee928){_0x4a57b0=_0x4a57b0-0x0;var _0x5e82c8=_0x021c[_0x4a57b0];return _0x5e82c8;};'use strict';var EventEmitter=require(_0xc021('0x0'));var OpenchannelQueue=require(_0xc021('0x1'))['db'][_0xc021('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc021('0x3')](0x0);var events={'afterCreate':_0xc021('0x4'),'afterUpdate':'update','afterDestroy':_0xc021('0x5')};function emitEvent(_0x1f6e52){return function(_0x151d85,_0x5ce6cd,_0xd7267a){OpenchannelQueueEvents[_0xc021('0x6')](_0x1f6e52+':'+_0x151d85['id'],_0x151d85);OpenchannelQueueEvents[_0xc021('0x6')](_0x1f6e52,_0x151d85);_0xd7267a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xc021('0x7')](e,emitEvent(event));}}module[_0xc021('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index b91883a..535efd6 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 _0x9b44=['api','moment','bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x7df129,_0x3fb12a){var _0x4e64e8=function(_0x59ec8e){while(--_0x59ec8e){_0x7df129['push'](_0x7df129['shift']());}};_0x4e64e8(++_0x3fb12a);}(_0x9b44,0x111));var _0x49b4=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x9b44[_0x59b439];return _0x521ea3;};'use strict';var _=require(_0x49b4('0x0'));var util=require(_0x49b4('0x1'));var logger=require('../../config/logger')(_0x49b4('0x2'));var moment=require(_0x49b4('0x3'));var BPromise=require(_0x49b4('0x4'));var rp=require(_0x49b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x49b4('0x6'));var attributes=require(_0x49b4('0x7'));module['exports']=function(_0x8556da,_0x23efd8){return _0x8556da[_0x49b4('0x8')](_0x49b4('0x9'),attributes,{'tableName':_0x49b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eac=['define','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d7093,_0x360b02){var _0x2ec547=function(_0x96c8eb){while(--_0x96c8eb){_0x5d7093['push'](_0x5d7093['shift']());}};_0x2ec547(++_0x360b02);}(_0x3eac,0x176));var _0xc3ea=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x3eac[_0x284807];return _0x50c774;};'use strict';var _=require(_0xc3ea('0x0'));var util=require(_0xc3ea('0x1'));var logger=require(_0xc3ea('0x2'))('api');var moment=require(_0xc3ea('0x3'));var BPromise=require(_0xc3ea('0x4'));var rp=require(_0xc3ea('0x5'));var fs=require('fs');var path=require(_0xc3ea('0x6'));var rimraf=require(_0xc3ea('0x7'));var config=require(_0xc3ea('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0xc3ea('0x9')]=function(_0x22e88e,_0x15065a){return _0x22e88e[_0xc3ea('0xa')]('OpenchannelQueue',attributes,{'tableName':_0xc3ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 70bf78e..0120495 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 _0xf58d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','limit','include','model','attributes','map','find','where','ShowOpenchannelQueue','lodash','util','moment','randomstring'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xf58d,0xd3));var _0xdf58=function(_0x22a046,_0x2b207d){_0x22a046=_0x22a046-0x0;var _0x599e61=_0xf58d[_0x22a046];return _0x599e61;};'use strict';var _=require(_0xdf58('0x0'));var util=require(_0xdf58('0x1'));var moment=require(_0xdf58('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf58('0x3'));var fs=require('fs');var Redis=require(_0xdf58('0x4'));var db=require(_0xdf58('0x5'))['db'];var utils=require(_0xdf58('0x6'));var logger=require(_0xdf58('0x7'))(_0xdf58('0x8'));var config=require(_0xdf58('0x9'));var jayson=require(_0xdf58('0xa'));var client=jayson[_0xdf58('0xb')][_0xdf58('0xc')]({'port':0x232a});config[_0xdf58('0xd')]=_[_0xdf58('0xe')](config[_0xdf58('0xd')],{'host':_0xdf58('0xf'),'port':0x18eb});var socket=require(_0xdf58('0x10'))(new Redis(config[_0xdf58('0xd')]));require(_0xdf58('0x11'))[_0xdf58('0x12')](socket);function respondWithRpcPromise(_0x1f44c6,_0x25d74b,_0x29fc99){return new BPromise(function(_0x1de441,_0x1aeebd){return client[_0xdf58('0x13')](_0x1f44c6,_0x29fc99)[_0xdf58('0x14')](function(_0x48b7f3){logger[_0xdf58('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x25d74b,_0xdf58('0x16'));logger[_0xdf58('0x17')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x25d74b,'request\x20sent',JSON[_0xdf58('0x18')](_0x48b7f3));if(_0x48b7f3[_0xdf58('0x19')]){if(_0x48b7f3[_0xdf58('0x19')][_0xdf58('0x1a')]===0x1f4){logger[_0xdf58('0x19')](_0xdf58('0x1b'),_0x25d74b,_0x48b7f3[_0xdf58('0x19')]['message']);return _0x1aeebd(_0x48b7f3[_0xdf58('0x19')][_0xdf58('0x1c')]);}logger[_0xdf58('0x19')](_0xdf58('0x1b'),_0x25d74b,_0x48b7f3['error']['message']);return _0x1de441(_0x48b7f3[_0xdf58('0x19')][_0xdf58('0x1c')]);}else{logger[_0xdf58('0x15')](_0xdf58('0x1b'),_0x25d74b,_0xdf58('0x16'));_0x1de441(_0x48b7f3[_0xdf58('0x1d')][_0xdf58('0x1c')]);}})[_0xdf58('0x1e')](function(_0x74b09e){logger[_0xdf58('0x19')](_0xdf58('0x1b'),_0x25d74b,_0x74b09e);_0x1aeebd(_0x74b09e);});});}exports[_0xdf58('0x1f')]=function(_0x34bcc2){var _0x26bde2=this;return new Promise(function(_0x341273,_0x5eed0f){return db[_0xdf58('0x20')][_0xdf58('0x21')]({'raw':_0x34bcc2[_0xdf58('0x22')]?_0x34bcc2[_0xdf58('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x34bcc2[_0xdf58('0x22')]?_0x34bcc2['options']['where']||null:null,'attributes':_0x34bcc2[_0xdf58('0x22')]?_0x34bcc2[_0xdf58('0x22')]['attributes']||null:null,'limit':_0x34bcc2[_0xdf58('0x22')]?_0x34bcc2[_0xdf58('0x22')][_0xdf58('0x23')]||null:null,'include':_0x34bcc2[_0xdf58('0x22')]?_0x34bcc2[_0xdf58('0x22')][_0xdf58('0x24')]?_['map'](_0x34bcc2['options']['include'],function(_0x1a7632){return{'model':db[_0x1a7632[_0xdf58('0x25')]],'as':_0x1a7632['as'],'attributes':_0x1a7632[_0xdf58('0x26')],'include':_0x1a7632[_0xdf58('0x24')]?_[_0xdf58('0x27')](_0x1a7632[_0xdf58('0x24')],function(_0x885b70){return{'model':db[_0x885b70[_0xdf58('0x25')]],'as':_0x885b70['as'],'attributes':_0x885b70[_0xdf58('0x26')],'include':_0x885b70[_0xdf58('0x24')]?_[_0xdf58('0x27')](_0x885b70[_0xdf58('0x24')],function(_0xecdfa9){return{'model':db[_0xecdfa9[_0xdf58('0x25')]],'as':_0xecdfa9['as'],'attributes':_0xecdfa9['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf58('0x14')](function(_0x58efbd){logger['info'](_0xdf58('0x1f'),_0x34bcc2);logger[_0xdf58('0x17')]('GetOpenchannelQueue',_0x34bcc2,JSON[_0xdf58('0x18')](_0x58efbd));_0x341273(_0x58efbd);})[_0xdf58('0x1e')](function(_0x374645){logger['error'](_0xdf58('0x1f'),_0x374645[_0xdf58('0x1c')],_0x34bcc2);_0x5eed0f(_0x26bde2[_0xdf58('0x19')](0x1f4,_0x374645[_0xdf58('0x1c')]));});});};exports['ShowOpenchannelQueue']=function(_0x52a822){var _0x3e121f=this;return new Promise(function(_0x30c99e,_0x26d14c){return db['OpenchannelQueue'][_0xdf58('0x28')]({'raw':_0x52a822['options']?_0x52a822[_0xdf58('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x52a822[_0xdf58('0x22')]?_0x52a822[_0xdf58('0x22')][_0xdf58('0x29')]||null:null,'attributes':_0x52a822['options']?_0x52a822[_0xdf58('0x22')][_0xdf58('0x26')]||null:null,'include':_0x52a822[_0xdf58('0x22')]?_0x52a822[_0xdf58('0x22')][_0xdf58('0x24')]?_['map'](_0x52a822[_0xdf58('0x22')]['include'],function(_0x1dd4ae){return{'model':db[_0x1dd4ae[_0xdf58('0x25')]],'as':_0x1dd4ae['as'],'attributes':_0x1dd4ae[_0xdf58('0x26')],'include':_0x1dd4ae[_0xdf58('0x24')]?_['map'](_0x1dd4ae[_0xdf58('0x24')],function(_0x3a1af2){return{'model':db[_0x3a1af2[_0xdf58('0x25')]],'as':_0x3a1af2['as'],'attributes':_0x3a1af2[_0xdf58('0x26')],'include':_0x3a1af2['include']?_['map'](_0x3a1af2[_0xdf58('0x24')],function(_0x56dd75){return{'model':db[_0x56dd75[_0xdf58('0x25')]],'as':_0x56dd75['as'],'attributes':_0x56dd75[_0xdf58('0x26')]};}):[]};}):[]};}):[]:[]})[_0xdf58('0x14')](function(_0x402c72){logger['info'](_0xdf58('0x2a'),_0x52a822);logger[_0xdf58('0x17')]('ShowOpenchannelQueue',_0x52a822,JSON['stringify'](_0x402c72));_0x30c99e(_0x402c72);})['catch'](function(_0xec1438){logger[_0xdf58('0x19')]('ShowOpenchannelQueue',_0xec1438[_0xdf58('0x1c')],_0x52a822);_0x26d14c(_0x3e121f[_0xdf58('0x19')](0x1f4,_0xec1438[_0xdf58('0x1c')]));});});}; \ No newline at end of file +var _0xb3bf=['options','raw','attributes','limit','include','map','model','find','where','then','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x22154f,_0x1fc734){var _0x4d2d4d=function(_0x400d50){while(--_0x400d50){_0x22154f['push'](_0x22154f['shift']());}};_0x4d2d4d(++_0x1fc734);}(_0xb3bf,0x1ce));var _0xfb3b=function(_0x2fbe5f,_0x4c5c13){_0x2fbe5f=_0x2fbe5f-0x0;var _0x21db60=_0xb3bf[_0x2fbe5f];return _0x21db60;};'use strict';var _=require(_0xfb3b('0x0'));var util=require(_0xfb3b('0x1'));var moment=require(_0xfb3b('0x2'));var BPromise=require(_0xfb3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb3b('0x5'));var logger=require(_0xfb3b('0x6'))(_0xfb3b('0x7'));var config=require(_0xfb3b('0x8'));var jayson=require(_0xfb3b('0x9'));var client=jayson[_0xfb3b('0xa')][_0xfb3b('0xb')]({'port':0x232a});config[_0xfb3b('0xc')]=_['defaults'](config['redis'],{'host':_0xfb3b('0xd'),'port':0x18eb});var socket=require(_0xfb3b('0xe'))(new Redis(config[_0xfb3b('0xc')]));require(_0xfb3b('0xf'))[_0xfb3b('0x10')](socket);function respondWithRpcPromise(_0x3b2ab7,_0x566ff5,_0x3aad92){return new BPromise(function(_0x4f3e82,_0x513e33){return client[_0xfb3b('0x11')](_0x3b2ab7,_0x3aad92)['then'](function(_0x2f34d2){logger[_0xfb3b('0x12')](_0xfb3b('0x13'),_0x566ff5,'request\x20sent');logger[_0xfb3b('0x14')](_0xfb3b('0x15'),_0x566ff5,_0xfb3b('0x16'),JSON[_0xfb3b('0x17')](_0x2f34d2));if(_0x2f34d2[_0xfb3b('0x18')]){if(_0x2f34d2['error'][_0xfb3b('0x19')]===0x1f4){logger[_0xfb3b('0x18')](_0xfb3b('0x13'),_0x566ff5,_0x2f34d2[_0xfb3b('0x18')][_0xfb3b('0x1a')]);return _0x513e33(_0x2f34d2[_0xfb3b('0x18')]['message']);}logger[_0xfb3b('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x566ff5,_0x2f34d2['error'][_0xfb3b('0x1a')]);return _0x4f3e82(_0x2f34d2[_0xfb3b('0x18')]['message']);}else{logger[_0xfb3b('0x12')](_0xfb3b('0x13'),_0x566ff5,_0xfb3b('0x16'));_0x4f3e82(_0x2f34d2['result'][_0xfb3b('0x1a')]);}})[_0xfb3b('0x1b')](function(_0x543558){logger['error'](_0xfb3b('0x13'),_0x566ff5,_0x543558);_0x513e33(_0x543558);});});}exports[_0xfb3b('0x1c')]=function(_0x303c46){var _0x4172b4=this;return new Promise(function(_0x1b5961,_0x38e8c8){return db[_0xfb3b('0x1d')]['findAll']({'raw':_0x303c46['options']?_0x303c46[_0xfb3b('0x1e')][_0xfb3b('0x1f')]===undefined?!![]:![]:!![],'where':_0x303c46[_0xfb3b('0x1e')]?_0x303c46[_0xfb3b('0x1e')]['where']||null:null,'attributes':_0x303c46[_0xfb3b('0x1e')]?_0x303c46[_0xfb3b('0x1e')][_0xfb3b('0x20')]||null:null,'limit':_0x303c46[_0xfb3b('0x1e')]?_0x303c46['options'][_0xfb3b('0x21')]||null:null,'include':_0x303c46['options']?_0x303c46['options'][_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x303c46[_0xfb3b('0x1e')]['include'],function(_0x49d9b8){return{'model':db[_0x49d9b8[_0xfb3b('0x24')]],'as':_0x49d9b8['as'],'attributes':_0x49d9b8[_0xfb3b('0x20')],'include':_0x49d9b8[_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x49d9b8['include'],function(_0x5b2cf7){return{'model':db[_0x5b2cf7[_0xfb3b('0x24')]],'as':_0x5b2cf7['as'],'attributes':_0x5b2cf7['attributes'],'include':_0x5b2cf7[_0xfb3b('0x22')]?_['map'](_0x5b2cf7[_0xfb3b('0x22')],function(_0x286f94){return{'model':db[_0x286f94['model']],'as':_0x286f94['as'],'attributes':_0x286f94[_0xfb3b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c22f1){logger['info']('GetOpenchannelQueue',_0x303c46);logger[_0xfb3b('0x14')](_0xfb3b('0x1c'),_0x303c46,JSON[_0xfb3b('0x17')](_0x5c22f1));_0x1b5961(_0x5c22f1);})['catch'](function(_0x53d5be){logger[_0xfb3b('0x18')](_0xfb3b('0x1c'),_0x53d5be['message'],_0x303c46);_0x38e8c8(_0x4172b4[_0xfb3b('0x18')](0x1f4,_0x53d5be[_0xfb3b('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x145067){var _0xdc4ac7=this;return new Promise(function(_0x5419ab,_0x4b31ef){return db[_0xfb3b('0x1d')][_0xfb3b('0x25')]({'raw':_0x145067[_0xfb3b('0x1e')]?_0x145067[_0xfb3b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x145067[_0xfb3b('0x1e')]?_0x145067['options'][_0xfb3b('0x26')]||null:null,'attributes':_0x145067[_0xfb3b('0x1e')]?_0x145067[_0xfb3b('0x1e')][_0xfb3b('0x20')]||null:null,'include':_0x145067[_0xfb3b('0x1e')]?_0x145067[_0xfb3b('0x1e')][_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x145067[_0xfb3b('0x1e')]['include'],function(_0x1d31f2){return{'model':db[_0x1d31f2[_0xfb3b('0x24')]],'as':_0x1d31f2['as'],'attributes':_0x1d31f2[_0xfb3b('0x20')],'include':_0x1d31f2[_0xfb3b('0x22')]?_[_0xfb3b('0x23')](_0x1d31f2[_0xfb3b('0x22')],function(_0x103dc3){return{'model':db[_0x103dc3[_0xfb3b('0x24')]],'as':_0x103dc3['as'],'attributes':_0x103dc3[_0xfb3b('0x20')],'include':_0x103dc3['include']?_[_0xfb3b('0x23')](_0x103dc3['include'],function(_0x11c231){return{'model':db[_0x11c231['model']],'as':_0x11c231['as'],'attributes':_0x11c231[_0xfb3b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfb3b('0x27')](function(_0x2f0afe){logger[_0xfb3b('0x12')](_0xfb3b('0x28'),_0x145067);logger[_0xfb3b('0x14')]('ShowOpenchannelQueue',_0x145067,JSON[_0xfb3b('0x17')](_0x2f0afe));_0x5419ab(_0x2f0afe);})[_0xfb3b('0x1b')](function(_0x135c99){logger[_0xfb3b('0x18')](_0xfb3b('0x28'),_0x135c99['message'],_0x145067);_0x4b31ef(_0xdc4ac7[_0xfb3b('0x18')](0x1f4,_0x135c99[_0xfb3b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 1aad411..659861d 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 _0x7d9c=['openchannelQueue:','./openchannelQueue.events','emit','register','length'];(function(_0x5870e7,_0x474d3e){var _0x1bf6ec=function(_0x293d60){while(--_0x293d60){_0x5870e7['push'](_0x5870e7['shift']());}};_0x1bf6ec(++_0x474d3e);}(_0x7d9c,0x13c));var _0xc7d9=function(_0x27f789,_0x145ad6){_0x27f789=_0x27f789-0x0;var _0x289880=_0x7d9c[_0x27f789];return _0x289880;};'use strict';var OpenchannelQueueEvents=require(_0xc7d9('0x0'));var events=['save','remove','update'];function createListener(_0x562a94,_0x10e70d){return function(_0x1687b1){_0x10e70d[_0xc7d9('0x1')](_0x562a94,_0x1687b1);};}function removeListener(_0x178983,_0x399a76){return function(){OpenchannelQueueEvents['removeListener'](_0x178983,_0x399a76);};}exports[_0xc7d9('0x2')]=function(_0x45ab3c){for(var _0x1b6d0d=0x0,_0x20e9f3=events[_0xc7d9('0x3')];_0x1b6d0d<_0x20e9f3;_0x1b6d0d++){var _0x4f6963=events[_0x1b6d0d];var _0x13c642=createListener(_0xc7d9('0x4')+_0x4f6963,_0x45ab3c);OpenchannelQueueEvents['on'](_0x4f6963,_0x13c642);}}; \ No newline at end of file +var _0x557d=['./openchannelQueue.events','save','remove','update','emit','register','length'];(function(_0x4c1910,_0x22af21){var _0x38c027=function(_0x5cf615){while(--_0x5cf615){_0x4c1910['push'](_0x4c1910['shift']());}};_0x38c027(++_0x22af21);}(_0x557d,0xcb));var _0xd557=function(_0x30ba07,_0x32e827){_0x30ba07=_0x30ba07-0x0;var _0x17d24a=_0x557d[_0x30ba07];return _0x17d24a;};'use strict';var OpenchannelQueueEvents=require(_0xd557('0x0'));var events=[_0xd557('0x1'),_0xd557('0x2'),_0xd557('0x3')];function createListener(_0x4aa27b,_0x479f66){return function(_0x2ee354){_0x479f66[_0xd557('0x4')](_0x4aa27b,_0x2ee354);};}function removeListener(_0x49f9e8,_0x5f19d7){return function(){OpenchannelQueueEvents['removeListener'](_0x49f9e8,_0x5f19d7);};}exports[_0xd557('0x5')]=function(_0x598348){for(var _0x477de0=0x0,_0x2d3ccd=events[_0xd557('0x6')];_0x477de0<_0x2d3ccd;_0x477de0++){var _0x559202=events[_0x477de0];var _0x37d3ec=createListener('openchannelQueue:'+_0x559202,_0x598348);OpenchannelQueueEvents['on'](_0x559202,_0x37d3ec);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b60d65a..077a111 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 _0x013c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','path'];(function(_0x266945,_0x5c5e8c){var _0x4477d5=function(_0x18c0b2){while(--_0x18c0b2){_0x266945['push'](_0x266945['shift']());}};_0x4477d5(++_0x5c5e8c);}(_0x013c,0x143));var _0xc013=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x013c[_0x1ef547];return _0x1d697b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc013('0x0'));var timeout=require('connect-timeout');var express=require(_0xc013('0x1'));var router=express[_0xc013('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc013('0x3'));var interaction=require(_0xc013('0x4'));var config=require(_0xc013('0x5'));var controller=require(_0xc013('0x6'));router[_0xc013('0x7')]('/',auth[_0xc013('0x8')](),controller['index']);router[_0xc013('0x7')](_0xc013('0x9'),auth[_0xc013('0x8')](),controller[_0xc013('0xa')]);router[_0xc013('0x7')](_0xc013('0xb'),auth['isAuthenticated'](),controller[_0xc013('0xc')]);router[_0xc013('0xd')]('/',auth[_0xc013('0x8')](),controller[_0xc013('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc013('0xf')]);router[_0xc013('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc013('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7414=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x425f19,_0x425977){var _0x4fcd8c=function(_0x595575){while(--_0x595575){_0x425f19['push'](_0x425f19['shift']());}};_0x4fcd8c(++_0x425977);}(_0x7414,0xf1));var _0x4741=function(_0x4c322b,_0x45ffae){_0x4c322b=_0x4c322b-0x0;var _0x534b91=_0x7414[_0x4c322b];return _0x534b91;};'use strict';var multer=require(_0x4741('0x0'));var util=require('util');var path=require(_0x4741('0x1'));var timeout=require(_0x4741('0x2'));var express=require('express');var router=express[_0x4741('0x3')]();var fs_extra=require(_0x4741('0x4'));var auth=require(_0x4741('0x5'));var interaction=require(_0x4741('0x6'));var config=require(_0x4741('0x7'));var controller=require(_0x4741('0x8'));router[_0x4741('0x9')]('/',auth['isAuthenticated'](),controller[_0x4741('0xa')]);router[_0x4741('0x9')](_0x4741('0xb'),auth[_0x4741('0xc')](),controller[_0x4741('0xd')]);router[_0x4741('0x9')](_0x4741('0xe'),auth[_0x4741('0xc')](),controller[_0x4741('0xf')]);router['post']('/',auth[_0x4741('0xc')](),controller[_0x4741('0x10')]);router[_0x4741('0x11')](_0x4741('0xe'),auth[_0x4741('0xc')](),controller[_0x4741('0x12')]);router[_0x4741('0x13')](_0x4741('0xe'),auth['isAuthenticated'](),controller[_0x4741('0x14')]);module[_0x4741('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5a73ec5..454af88 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 _0xa55a=['DATE','moment','sequelize','exports','STRING'];(function(_0xced636,_0x35afe7){var _0x12efe5=function(_0x2dfc1d){while(--_0x2dfc1d){_0xced636['push'](_0xced636['shift']());}};_0x12efe5(++_0x35afe7);}(_0xa55a,0x1b4));var _0xaa55=function(_0x150a01,_0x2f838a){_0x150a01=_0x150a01-0x0;var _0x54a8dc=_0xa55a[_0x150a01];return _0x54a8dc;};'use strict';var moment=require(_0xaa55('0x0'));var Sequelize=require(_0xaa55('0x1'));module[_0xaa55('0x2')]={'uniqueid':{'type':Sequelize[_0xaa55('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xaa55('0x4')]},'leaveAt':{'type':Sequelize[_0xaa55('0x4')]},'acceptAt':{'type':Sequelize[_0xaa55('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd1af=['sequelize','exports','STRING','DATE','moment'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xd1af,0xe5));var _0xfd1a=function(_0x30fe92,_0x31779c){_0x30fe92=_0x30fe92-0x0;var _0xb849c1=_0xd1af[_0x30fe92];return _0xb849c1;};'use strict';var moment=require(_0xfd1a('0x0'));var Sequelize=require(_0xfd1a('0x1'));module[_0xfd1a('0x2')]={'uniqueid':{'type':Sequelize[_0xfd1a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfd1a('0x4')]},'acceptAt':{'type':Sequelize[_0xfd1a('0x4')]},'exitAt':{'type':Sequelize[_0xfd1a('0x4')]},'reason':{'type':Sequelize[_0xfd1a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 69ce699..de4f449 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 _0x4805=['fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x28fbfc,_0x423782){var _0x4feca4=function(_0x11d1f7){while(--_0x11d1f7){_0x28fbfc['push'](_0x28fbfc['shift']());}};_0x4feca4(++_0x423782);}(_0x4805,0xdb));var _0x5480=function(_0x40ca0a,_0x3dd41d){_0x40ca0a=_0x40ca0a-0x0;var _0x248aaf=_0x4805[_0x40ca0a];return _0x248aaf;};'use strict';var emlformat=require(_0x5480('0x0'));var rimraf=require(_0x5480('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5480('0x2'));var moment=require(_0x5480('0x3'));var BPromise=require(_0x5480('0x4'));var Mustache=require('mustache');var util=require(_0x5480('0x5'));var path=require(_0x5480('0x6'));var sox=require(_0x5480('0x7'));var csv=require(_0x5480('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5480('0x9'));var _=require(_0x5480('0xa'));var squel=require('squel');var crypto=require(_0x5480('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5480('0xc'));var toCsv=require(_0x5480('0x8'));var querystring=require('querystring');var Papa=require(_0x5480('0xd'));var Redis=require(_0x5480('0xe'));var authService=require(_0x5480('0xf'));var qs=require(_0x5480('0x10'));var as=require(_0x5480('0x11'));var hardwareService=require(_0x5480('0x12'));var logger=require(_0x5480('0x13'))(_0x5480('0x14'));var utils=require(_0x5480('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5480('0x16'))['db'];function respondWithStatusCode(_0x3f8326,_0x1d804b){_0x1d804b=_0x1d804b||0xcc;return function(_0x5471e2){if(_0x5471e2){return _0x3f8326[_0x5480('0x17')](_0x1d804b);}return _0x3f8326[_0x5480('0x18')](_0x1d804b)[_0x5480('0x19')]();};}function respondWithResult(_0x2e3456,_0x3d9483){_0x3d9483=_0x3d9483||0xc8;return function(_0x22fe2a){if(_0x22fe2a){return _0x2e3456[_0x5480('0x18')](_0x3d9483)['json'](_0x22fe2a);}};}function respondWithFilteredResult(_0x5e6b94,_0x33447d){return function(_0x5bd4d7){if(_0x5bd4d7){var _0x5a2a47=typeof _0x33447d[_0x5480('0x1a')]===_0x5480('0x1b')&&typeof _0x33447d[_0x5480('0x1c')]==='undefined';var _0x25eb2c=_0x5bd4d7[_0x5480('0x1d')];var _0x5d7d14=_0x5a2a47?0x0:_0x33447d[_0x5480('0x1a')];var _0x1d0d3b=_0x5a2a47?_0x5bd4d7['count']:_0x33447d[_0x5480('0x1a')]+_0x33447d['limit'];var _0x23a28c;if(_0x1d0d3b>=_0x25eb2c){_0x1d0d3b=_0x25eb2c;_0x23a28c=0xc8;}else{_0x23a28c=0xce;}_0x5e6b94[_0x5480('0x18')](_0x23a28c);return _0x5e6b94[_0x5480('0x1e')](_0x5480('0x1f'),_0x5d7d14+'-'+_0x1d0d3b+'/'+_0x25eb2c)[_0x5480('0x20')](_0x5bd4d7);}return null;};}function patchUpdates(_0x810a7f){return function(_0x1df225){try{jsonpatch[_0x5480('0x21')](_0x1df225,_0x810a7f,!![]);}catch(_0x2d8578){return BPromise['reject'](_0x2d8578);}return _0x1df225[_0x5480('0x22')]();};}function saveUpdates(_0x12565f,_0x1ffe3c){return function(_0x227f19){if(_0x227f19){return _0x227f19[_0x5480('0x23')](_0x12565f)['then'](function(_0xc2d695){return _0xc2d695;});}return null;};}function removeEntity(_0x5a2c26,_0x470d1d){return function(_0x24049b){if(_0x24049b){return _0x24049b[_0x5480('0x24')]()[_0x5480('0x25')](function(){_0x5a2c26[_0x5480('0x18')](0xcc)[_0x5480('0x19')]();});}};}function handleEntityNotFound(_0x5a8079,_0x2ffefd){return function(_0xd2b897){if(!_0xd2b897){_0x5a8079['sendStatus'](0x194);}return _0xd2b897;};}function handleError(_0x448c18,_0x51717d){_0x51717d=_0x51717d||0x1f4;return function(_0x5b830d){logger[_0x5480('0x26')](_0x5b830d[_0x5480('0x27')]);if(_0x5b830d['name']){delete _0x5b830d[_0x5480('0x28')];}_0x448c18[_0x5480('0x18')](_0x51717d)[_0x5480('0x29')](_0x5b830d);};}exports[_0x5480('0x2a')]=function(_0x1f9ef0,_0x30429b){var _0x3202e6={},_0x31d9be={},_0x1d87f3={'count':0x0,'rows':[]};var _0x3d2129=_[_0x5480('0x2b')](db[_0x5480('0x2c')][_0x5480('0x2d')],function(_0x1c7411){return{'name':_0x1c7411[_0x5480('0x2e')],'type':_0x1c7411['type'][_0x5480('0x2f')]};});_0x31d9be[_0x5480('0x30')]=_['map'](_0x3d2129,_0x5480('0x28'));_0x31d9be[_0x5480('0x31')]=_[_0x5480('0x32')](_0x1f9ef0[_0x5480('0x31')]);_0x31d9be[_0x5480('0x33')]=_[_0x5480('0x34')](_0x31d9be[_0x5480('0x30')],_0x31d9be[_0x5480('0x31')]);_0x3202e6[_0x5480('0x35')]=_[_0x5480('0x34')](_0x31d9be[_0x5480('0x30')],qs[_0x5480('0x36')](_0x1f9ef0['query'][_0x5480('0x36')]));_0x3202e6[_0x5480('0x35')]=_0x3202e6[_0x5480('0x35')]['length']?_0x3202e6[_0x5480('0x35')]:_0x31d9be[_0x5480('0x30')];if(!_0x1f9ef0[_0x5480('0x31')]['hasOwnProperty'](_0x5480('0x37'))){_0x3202e6[_0x5480('0x1c')]=qs[_0x5480('0x1c')](_0x1f9ef0[_0x5480('0x31')][_0x5480('0x1c')]);_0x3202e6[_0x5480('0x1a')]=qs[_0x5480('0x1a')](_0x1f9ef0['query']['offset']);}_0x3202e6[_0x5480('0x38')]=qs[_0x5480('0x39')](_0x1f9ef0[_0x5480('0x31')][_0x5480('0x39')]);_0x3202e6['where']=qs[_0x5480('0x33')](_[_0x5480('0x3a')](_0x1f9ef0[_0x5480('0x31')],_0x31d9be[_0x5480('0x33')]),_0x3d2129);if(_0x1f9ef0['query'][_0x5480('0x3b')]){_0x3202e6[_0x5480('0x3c')]=_[_0x5480('0x3d')](_0x3202e6[_0x5480('0x3c')],{'$or':_[_0x5480('0x2b')](_0x3d2129,function(_0x51ff2f){if(_0x51ff2f[_0x5480('0x3e')]!==_0x5480('0x3f')){var _0x35d687={};_0x35d687[_0x51ff2f[_0x5480('0x28')]]={'$like':'%'+_0x1f9ef0['query'][_0x5480('0x3b')]+'%'};return _0x35d687;}})});}_0x3202e6=_[_0x5480('0x3d')]({},_0x3202e6,_0x1f9ef0['options']);var _0x5700b7={'where':_0x3202e6[_0x5480('0x3c')]};return db['OpenchannelQueueReport']['count'](_0x5700b7)[_0x5480('0x25')](function(_0xa9fb0e){_0x1d87f3['count']=_0xa9fb0e;if(_0x1f9ef0['query'][_0x5480('0x40')]){_0x3202e6[_0x5480('0x41')]=[{'all':!![]}];}return db[_0x5480('0x2c')][_0x5480('0x42')](_0x3202e6);})['then'](function(_0x155b8b){_0x1d87f3[_0x5480('0x43')]=_0x155b8b;return _0x1d87f3;})[_0x5480('0x25')](respondWithFilteredResult(_0x30429b,_0x3202e6))[_0x5480('0x44')](handleError(_0x30429b,null));};exports['show']=function(_0x2f9333,_0x42d475){var _0x27fea1={'raw':!![],'where':{'id':_0x2f9333[_0x5480('0x45')]['id']}},_0x59298a={};_0x59298a[_0x5480('0x30')]=_[_0x5480('0x32')](db[_0x5480('0x2c')][_0x5480('0x2d')]);_0x59298a[_0x5480('0x31')]=_[_0x5480('0x32')](_0x2f9333[_0x5480('0x31')]);_0x59298a[_0x5480('0x33')]=_[_0x5480('0x34')](_0x59298a[_0x5480('0x30')],_0x59298a[_0x5480('0x31')]);_0x27fea1[_0x5480('0x35')]=_[_0x5480('0x34')](_0x59298a[_0x5480('0x30')],qs[_0x5480('0x36')](_0x2f9333['query'][_0x5480('0x36')]));_0x27fea1['attributes']=_0x27fea1[_0x5480('0x35')][_0x5480('0x46')]?_0x27fea1[_0x5480('0x35')]:_0x59298a[_0x5480('0x30')];if(_0x2f9333[_0x5480('0x31')]['includeAll']){_0x27fea1[_0x5480('0x41')]=[{'all':!![]}];}_0x27fea1=_[_0x5480('0x3d')]({},_0x27fea1,_0x2f9333[_0x5480('0x47')]);return db['OpenchannelQueueReport'][_0x5480('0x48')](_0x27fea1)[_0x5480('0x25')](handleEntityNotFound(_0x42d475,null))['then'](respondWithResult(_0x42d475,null))[_0x5480('0x44')](handleError(_0x42d475,null));};exports[_0x5480('0x49')]=function(_0x5aa5c8,_0x364fda){return db[_0x5480('0x2c')][_0x5480('0x49')](_0x5aa5c8[_0x5480('0x4a')],{})[_0x5480('0x25')](respondWithResult(_0x364fda,0xc9))[_0x5480('0x44')](handleError(_0x364fda,null));};exports[_0x5480('0x23')]=function(_0x301133,_0x20338b){if(_0x301133['body']['id']){delete _0x301133[_0x5480('0x4a')]['id'];}return db[_0x5480('0x2c')][_0x5480('0x48')]({'where':{'id':_0x301133['params']['id']}})['then'](handleEntityNotFound(_0x20338b,null))[_0x5480('0x25')](saveUpdates(_0x301133['body'],null))[_0x5480('0x25')](respondWithResult(_0x20338b,null))['catch'](handleError(_0x20338b,null));};exports[_0x5480('0x24')]=function(_0x5b38a0,_0x2d2a3d){return db[_0x5480('0x2c')]['find']({'where':{'id':_0x5b38a0[_0x5480('0x45')]['id']}})[_0x5480('0x25')](handleEntityNotFound(_0x2d2a3d,null))['then'](removeEntity(_0x2d2a3d,null))['catch'](handleError(_0x2d2a3d,null));};exports[_0x5480('0x4b')]=function(_0x3c238f,_0x50745f){return db[_0x5480('0x2c')][_0x5480('0x4b')]()['then'](respondWithResult(_0x50745f,null))[_0x5480('0x44')](handleError(_0x50745f,null));}; \ No newline at end of file +var _0x65cd=['reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','length','options','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x65cd,0x76));var _0xd65c=function(_0x51d4ee,_0xdead36){_0x51d4ee=_0x51d4ee-0x0;var _0x2939b0=_0x65cd[_0x51d4ee];return _0x2939b0;};'use strict';var emlformat=require(_0xd65c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd65c('0x1'));var jsonpatch=require(_0xd65c('0x2'));var rp=require(_0xd65c('0x3'));var moment=require(_0xd65c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd65c('0x5'));var util=require(_0xd65c('0x6'));var path=require(_0xd65c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd65c('0x8'));var fs=require('fs');var fs_extra=require(_0xd65c('0x9'));var _=require(_0xd65c('0xa'));var squel=require(_0xd65c('0xb'));var crypto=require(_0xd65c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd65c('0xd'));var Redis=require(_0xd65c('0xe'));var authService=require(_0xd65c('0xf'));var qs=require(_0xd65c('0x10'));var as=require(_0xd65c('0x11'));var hardwareService=require(_0xd65c('0x12'));var logger=require(_0xd65c('0x13'))(_0xd65c('0x14'));var utils=require(_0xd65c('0x15'));var config=require(_0xd65c('0x16'));var licenseUtil=require(_0xd65c('0x17'));var db=require(_0xd65c('0x18'))['db'];function respondWithStatusCode(_0x1fb24b,_0xdbf34c){_0xdbf34c=_0xdbf34c||0xcc;return function(_0x3d0bbf){if(_0x3d0bbf){return _0x1fb24b[_0xd65c('0x19')](_0xdbf34c);}return _0x1fb24b['status'](_0xdbf34c)[_0xd65c('0x1a')]();};}function respondWithResult(_0x4cd28e,_0x3f8bb0){_0x3f8bb0=_0x3f8bb0||0xc8;return function(_0x2df7c9){if(_0x2df7c9){return _0x4cd28e['status'](_0x3f8bb0)['json'](_0x2df7c9);}};}function respondWithFilteredResult(_0x27b470,_0xb8792b){return function(_0x2fb958){if(_0x2fb958){var _0x27fdd3=typeof _0xb8792b[_0xd65c('0x1b')]===_0xd65c('0x1c')&&typeof _0xb8792b[_0xd65c('0x1d')]===_0xd65c('0x1c');var _0x39c9a9=_0x2fb958[_0xd65c('0x1e')];var _0x29407a=_0x27fdd3?0x0:_0xb8792b['offset'];var _0x1058dc=_0x27fdd3?_0x2fb958['count']:_0xb8792b[_0xd65c('0x1b')]+_0xb8792b[_0xd65c('0x1d')];var _0x489cfb;if(_0x1058dc>=_0x39c9a9){_0x1058dc=_0x39c9a9;_0x489cfb=0xc8;}else{_0x489cfb=0xce;}_0x27b470[_0xd65c('0x1f')](_0x489cfb);return _0x27b470[_0xd65c('0x20')](_0xd65c('0x21'),_0x29407a+'-'+_0x1058dc+'/'+_0x39c9a9)[_0xd65c('0x22')](_0x2fb958);}return null;};}function patchUpdates(_0x415487){return function(_0x5c10fe){try{jsonpatch[_0xd65c('0x23')](_0x5c10fe,_0x415487,!![]);}catch(_0x597aea){return BPromise[_0xd65c('0x24')](_0x597aea);}return _0x5c10fe[_0xd65c('0x25')]();};}function saveUpdates(_0x3ef214,_0x35eed0){return function(_0x5acc89){if(_0x5acc89){return _0x5acc89[_0xd65c('0x26')](_0x3ef214)['then'](function(_0x846a66){return _0x846a66;});}return null;};}function removeEntity(_0x51267c,_0x17c0e3){return function(_0x3a43c4){if(_0x3a43c4){return _0x3a43c4[_0xd65c('0x27')]()[_0xd65c('0x28')](function(){_0x51267c[_0xd65c('0x1f')](0xcc)[_0xd65c('0x1a')]();});}};}function handleEntityNotFound(_0x2ce474,_0x100f21){return function(_0x515a7a){if(!_0x515a7a){_0x2ce474[_0xd65c('0x19')](0x194);}return _0x515a7a;};}function handleError(_0x1f93bc,_0x3529d2){_0x3529d2=_0x3529d2||0x1f4;return function(_0x4deb27){logger[_0xd65c('0x29')](_0x4deb27[_0xd65c('0x2a')]);if(_0x4deb27[_0xd65c('0x2b')]){delete _0x4deb27[_0xd65c('0x2b')];}_0x1f93bc[_0xd65c('0x1f')](_0x3529d2)[_0xd65c('0x2c')](_0x4deb27);};}exports[_0xd65c('0x2d')]=function(_0x36469b,_0x16581f){var _0x34bb35={},_0x3999f2={},_0x3f3671={'count':0x0,'rows':[]};var _0x2759eb=_[_0xd65c('0x2e')](db[_0xd65c('0x2f')]['rawAttributes'],function(_0x22fe6b){return{'name':_0x22fe6b[_0xd65c('0x30')],'type':_0x22fe6b[_0xd65c('0x31')][_0xd65c('0x32')]};});_0x3999f2[_0xd65c('0x33')]=_[_0xd65c('0x2e')](_0x2759eb,'name');_0x3999f2['query']=_[_0xd65c('0x34')](_0x36469b['query']);_0x3999f2[_0xd65c('0x35')]=_[_0xd65c('0x36')](_0x3999f2[_0xd65c('0x33')],_0x3999f2['query']);_0x34bb35['attributes']=_[_0xd65c('0x36')](_0x3999f2['model'],qs[_0xd65c('0x37')](_0x36469b[_0xd65c('0x38')][_0xd65c('0x37')]));_0x34bb35[_0xd65c('0x39')]=_0x34bb35[_0xd65c('0x39')]['length']?_0x34bb35['attributes']:_0x3999f2[_0xd65c('0x33')];if(!_0x36469b[_0xd65c('0x38')][_0xd65c('0x3a')]('nolimit')){_0x34bb35[_0xd65c('0x1d')]=qs[_0xd65c('0x1d')](_0x36469b[_0xd65c('0x38')]['limit']);_0x34bb35[_0xd65c('0x1b')]=qs[_0xd65c('0x1b')](_0x36469b[_0xd65c('0x38')]['offset']);}_0x34bb35[_0xd65c('0x3b')]=qs[_0xd65c('0x3c')](_0x36469b[_0xd65c('0x38')][_0xd65c('0x3c')]);_0x34bb35[_0xd65c('0x3d')]=qs[_0xd65c('0x35')](_[_0xd65c('0x3e')](_0x36469b[_0xd65c('0x38')],_0x3999f2[_0xd65c('0x35')]),_0x2759eb);if(_0x36469b[_0xd65c('0x38')][_0xd65c('0x3f')]){_0x34bb35[_0xd65c('0x3d')]=_[_0xd65c('0x40')](_0x34bb35[_0xd65c('0x3d')],{'$or':_[_0xd65c('0x2e')](_0x2759eb,function(_0x10734e){if(_0x10734e[_0xd65c('0x31')]!==_0xd65c('0x41')){var _0x16db62={};_0x16db62[_0x10734e[_0xd65c('0x2b')]]={'$like':'%'+_0x36469b[_0xd65c('0x38')][_0xd65c('0x3f')]+'%'};return _0x16db62;}})});}_0x34bb35=_[_0xd65c('0x40')]({},_0x34bb35,_0x36469b['options']);var _0xbe31e2={'where':_0x34bb35[_0xd65c('0x3d')]};return db['OpenchannelQueueReport'][_0xd65c('0x1e')](_0xbe31e2)[_0xd65c('0x28')](function(_0x17e949){_0x3f3671[_0xd65c('0x1e')]=_0x17e949;if(_0x36469b['query'][_0xd65c('0x42')]){_0x34bb35[_0xd65c('0x43')]=[{'all':!![]}];}return db[_0xd65c('0x2f')]['findAll'](_0x34bb35);})[_0xd65c('0x28')](function(_0x14801b){_0x3f3671['rows']=_0x14801b;return _0x3f3671;})[_0xd65c('0x28')](respondWithFilteredResult(_0x16581f,_0x34bb35))[_0xd65c('0x44')](handleError(_0x16581f,null));};exports[_0xd65c('0x45')]=function(_0x163c60,_0x3532d3){var _0x5fab24={'raw':!![],'where':{'id':_0x163c60['params']['id']}},_0x27d3b7={};_0x27d3b7['model']=_[_0xd65c('0x34')](db[_0xd65c('0x2f')]['rawAttributes']);_0x27d3b7['query']=_['keys'](_0x163c60[_0xd65c('0x38')]);_0x27d3b7[_0xd65c('0x35')]=_[_0xd65c('0x36')](_0x27d3b7[_0xd65c('0x33')],_0x27d3b7[_0xd65c('0x38')]);_0x5fab24[_0xd65c('0x39')]=_[_0xd65c('0x36')](_0x27d3b7[_0xd65c('0x33')],qs['fields'](_0x163c60[_0xd65c('0x38')][_0xd65c('0x37')]));_0x5fab24[_0xd65c('0x39')]=_0x5fab24[_0xd65c('0x39')][_0xd65c('0x46')]?_0x5fab24[_0xd65c('0x39')]:_0x27d3b7[_0xd65c('0x33')];if(_0x163c60[_0xd65c('0x38')]['includeAll']){_0x5fab24[_0xd65c('0x43')]=[{'all':!![]}];}_0x5fab24=_[_0xd65c('0x40')]({},_0x5fab24,_0x163c60[_0xd65c('0x47')]);return db[_0xd65c('0x2f')]['find'](_0x5fab24)[_0xd65c('0x28')](handleEntityNotFound(_0x3532d3,null))[_0xd65c('0x28')](respondWithResult(_0x3532d3,null))[_0xd65c('0x44')](handleError(_0x3532d3,null));};exports['create']=function(_0xb3ddae,_0x34a074){return db['OpenchannelQueueReport'][_0xd65c('0x48')](_0xb3ddae[_0xd65c('0x49')],{})[_0xd65c('0x28')](respondWithResult(_0x34a074,0xc9))['catch'](handleError(_0x34a074,null));};exports[_0xd65c('0x26')]=function(_0x3fe9e0,_0x2d4285){if(_0x3fe9e0['body']['id']){delete _0x3fe9e0[_0xd65c('0x49')]['id'];}return db[_0xd65c('0x2f')][_0xd65c('0x4a')]({'where':{'id':_0x3fe9e0[_0xd65c('0x4b')]['id']}})[_0xd65c('0x28')](handleEntityNotFound(_0x2d4285,null))[_0xd65c('0x28')](saveUpdates(_0x3fe9e0[_0xd65c('0x49')],null))['then'](respondWithResult(_0x2d4285,null))[_0xd65c('0x44')](handleError(_0x2d4285,null));};exports['destroy']=function(_0x497e63,_0x4a9f0a){return db[_0xd65c('0x2f')][_0xd65c('0x4a')]({'where':{'id':_0x497e63[_0xd65c('0x4b')]['id']}})[_0xd65c('0x28')](handleEntityNotFound(_0x4a9f0a,null))[_0xd65c('0x28')](removeEntity(_0x4a9f0a,null))[_0xd65c('0x44')](handleError(_0x4a9f0a,null));};exports[_0xd65c('0x4c')]=function(_0x4c388b,_0x48219e){return db['OpenchannelQueueReport'][_0xd65c('0x4c')]()[_0xd65c('0x28')](respondWithResult(_0x48219e,null))[_0xd65c('0x44')](handleError(_0x48219e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4fc298a..6ae5112 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(_0x3433fb,_0x3f2f0b){var _0x48d4f0=function(_0x161654){while(--_0x161654){_0x3433fb['push'](_0x3433fb['shift']());}};_0x48d4f0(++_0x3f2f0b);}(_0x1261,0x144));var _0x1126=function(_0x212dad,_0xb862ef){_0x212dad=_0x212dad-0x0;var _0x4fea3f=_0x1261[_0x212dad];return _0x4fea3f;};'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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2f92c3,_0x4e0c44){var _0x1c6859=function(_0x3e1844){while(--_0x3e1844){_0x2f92c3['push'](_0x2f92c3['shift']());}};_0x1c6859(++_0x4e0c44);}(_0x7a54,0x106));var _0x47a5=function(_0x174952,_0x1f703d){_0x174952=_0x174952-0x0;var _0x1ceaee=_0x7a54[_0x174952];return _0x1ceaee;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5963871..e406361 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a95=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x1fcd41,_0x5df664){var _0xdb5abe=function(_0x1c2395){while(--_0x1c2395){_0x1fcd41['push'](_0x1fcd41['shift']());}};_0xdb5abe(++_0x5df664);}(_0x6a95,0x1db));var _0x56a9=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x6a95[_0x521929];return _0x632436;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});};exports[_0x56a9('0x1f')]=function(_0x21ab38){var _0xd029f7=this;return new Promise(function(_0x497d31,_0x52016c){return db[_0x56a9('0x19')][_0x56a9('0x20')](_0x21ab38[_0x56a9('0x1b')],{'raw':_0x21ab38['options']?_0x21ab38[_0x56a9('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x21')]||null:null,'attributes':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x22')]||null:null,'limit':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')]['limit']||null:null})[_0x56a9('0x1e')](function(_0x2bb1eb){logger['info'](_0x56a9('0x1f'),_0x21ab38);logger['debug']('UpdateOpenchannelQueueReport',_0x21ab38,JSON[_0x56a9('0x12')](_0x2bb1eb));_0x497d31(_0x2bb1eb);})['catch'](function(_0x2f933a){logger[_0x56a9('0x13')](_0x56a9('0x1f'),_0x2f933a[_0x56a9('0x15')],_0x21ab38);_0x52016c(_0xd029f7['error'](0x1f4,_0x2f933a[_0x56a9('0x15')]));});});}; \ No newline at end of file +var _0x23a3=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','raw','UpdateOpenchannelQueueReport','body','options','where','attributes','limit','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x23a3,0x131));var _0x323a=function(_0x19a3bf,_0x1acf91){_0x19a3bf=_0x19a3bf-0x0;var _0x38f7a1=_0x23a3[_0x19a3bf];return _0x38f7a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});}exports[_0x323a('0x17')]=function(_0x221ae4){var _0x2feed1=this;return new Promise(function(_0x29dd21,_0x303338){return db[_0x323a('0x18')]['create'](_0x221ae4['body'],{'raw':_0x221ae4['options']?_0x221ae4['options'][_0x323a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xc0f3e4){logger[_0x323a('0xc')](_0x323a('0x17'),_0x221ae4);logger[_0x323a('0xf')]('CreateOpenchannelQueueReport',_0x221ae4,JSON[_0x323a('0x11')](_0xc0f3e4));_0x29dd21(_0xc0f3e4);})['catch'](function(_0x12c8d7){logger[_0x323a('0x12')](_0x323a('0x17'),_0x12c8d7['message'],_0x221ae4);_0x303338(_0x2feed1[_0x323a('0x12')](0x1f4,_0x12c8d7[_0x323a('0x14')]));});});};exports[_0x323a('0x1a')]=function(_0x2960e0){var _0x35f8ec=this;return new Promise(function(_0x204f76,_0x5ba015){return db[_0x323a('0x18')]['update'](_0x2960e0[_0x323a('0x1b')],{'raw':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1d')]||null:null,'attributes':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x1e')]||null:null,'limit':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1f')]||null:null})['then'](function(_0x24747b){logger[_0x323a('0xc')](_0x323a('0x1a'),_0x2960e0);logger[_0x323a('0xf')](_0x323a('0x1a'),_0x2960e0,JSON[_0x323a('0x11')](_0x24747b));_0x204f76(_0x24747b);})['catch'](function(_0x2a1a85){logger[_0x323a('0x12')]('UpdateOpenchannelQueueReport',_0x2a1a85[_0x323a('0x14')],_0x2960e0);_0x5ba015(_0x35f8ec['error'](0x1f4,_0x2a1a85['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 106691b..744daab 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 _0x4e9b=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','create','put'];(function(_0x8b62a9,_0x17b817){var _0x1a9082=function(_0x3a8386){while(--_0x3a8386){_0x8b62a9['push'](_0x8b62a9['shift']());}};_0x1a9082(++_0x17b817);}(_0x4e9b,0x1a1));var _0xb4e9=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x4e9b[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0xb4e9('0x0'));var util=require('util');var path=require(_0xb4e9('0x1'));var timeout=require(_0xb4e9('0x2'));var express=require(_0xb4e9('0x3'));var router=express[_0xb4e9('0x4')]();var fs_extra=require(_0xb4e9('0x5'));var auth=require(_0xb4e9('0x6'));var interaction=require(_0xb4e9('0x7'));var config=require(_0xb4e9('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0xb4e9('0x9')]('/',auth[_0xb4e9('0xa')](),controller['index']);router[_0xb4e9('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb4e9('0xb')]);router[_0xb4e9('0x9')](_0xb4e9('0xc'),auth[_0xb4e9('0xa')](),controller['show']);router['post']('/',auth[_0xb4e9('0xa')](),controller[_0xb4e9('0xd')]);router[_0xb4e9('0xe')](_0xb4e9('0xc'),auth[_0xb4e9('0xa')](),controller['update']);router[_0xb4e9('0xf')](_0xb4e9('0xc'),auth[_0xb4e9('0xa')](),controller[_0xb4e9('0x10')]);module[_0xb4e9('0x11')]=router; \ No newline at end of file +var _0x8ee2=['update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x8ee2,0xae));var _0x28ee=function(_0x5cb87f,_0x5300df){_0x5cb87f=_0x5cb87f-0x0;var _0x397517=_0x8ee2[_0x5cb87f];return _0x397517;};'use strict';var multer=require(_0x28ee('0x0'));var util=require('util');var path=require(_0x28ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x28ee('0x2'));var router=express[_0x28ee('0x3')]();var fs_extra=require(_0x28ee('0x4'));var auth=require(_0x28ee('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28ee('0x6'));router[_0x28ee('0x7')]('/',auth[_0x28ee('0x8')](),controller[_0x28ee('0x9')]);router['get'](_0x28ee('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x28ee('0x7')]('/:id',auth[_0x28ee('0x8')](),controller[_0x28ee('0xb')]);router[_0x28ee('0xc')]('/',auth[_0x28ee('0x8')](),controller[_0x28ee('0xd')]);router[_0x28ee('0xe')](_0x28ee('0xf'),auth[_0x28ee('0x8')](),controller[_0x28ee('0x10')]);router[_0x28ee('0x11')](_0x28ee('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x28ee('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 2e13b30..de18816 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4b2693,_0x29f874){var _0x1957d7=function(_0x57a294){while(--_0x57a294){_0x4b2693['push'](_0x4b2693['shift']());}};_0x1957d7(++_0x29f874);}(_0x54ef,0x112));var _0xf54e=function(_0x1b2a20,_0xb5aab0){_0x1b2a20=_0x1b2a20-0x0;var _0x44eaf6=_0x54ef[_0x1b2a20];return _0x44eaf6;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x25c044,_0xbd05f8){var _0x558ee5=function(_0x5de5d2){while(--_0x5de5d2){_0x25c044['push'](_0x25c044['shift']());}};_0x558ee5(++_0xbd05f8);}(_0x54ef,0x112));var _0xf54e=function(_0x30284d,_0x321080){_0x30284d=_0x30284d-0x0;var _0x548a85=_0x54ef[_0x30284d];return _0x548a85;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4a858c8..be678bb 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 _0x6d24=['end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','map','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','intersection','includeAll','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x4b2adf,_0x36ef21){var _0x1acba6=function(_0x51c78){while(--_0x51c78){_0x4b2adf['push'](_0x4b2adf['shift']());}};_0x1acba6(++_0x36ef21);}(_0x6d24,0x119));var _0x46d2=function(_0x229643,_0x71e2a3){_0x229643=_0x229643-0x0;var _0x15ce21=_0x6d24[_0x229643];return _0x15ce21;};'use strict';var emlformat=require(_0x46d2('0x0'));var rimraf=require(_0x46d2('0x1'));var zipdir=require(_0x46d2('0x2'));var jsonpatch=require(_0x46d2('0x3'));var rp=require(_0x46d2('0x4'));var moment=require(_0x46d2('0x5'));var BPromise=require(_0x46d2('0x6'));var Mustache=require(_0x46d2('0x7'));var util=require('util');var path=require(_0x46d2('0x8'));var sox=require(_0x46d2('0x9'));var csv=require(_0x46d2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46d2('0xb'));var _=require(_0x46d2('0xc'));var squel=require('squel');var crypto=require(_0x46d2('0xd'));var jsforce=require(_0x46d2('0xe'));var deskjs=require(_0x46d2('0xf'));var toCsv=require(_0x46d2('0xa'));var querystring=require(_0x46d2('0x10'));var Papa=require(_0x46d2('0x11'));var Redis=require(_0x46d2('0x12'));var authService=require(_0x46d2('0x13'));var qs=require(_0x46d2('0x14'));var as=require(_0x46d2('0x15'));var hardwareService=require(_0x46d2('0x16'));var logger=require('../../config/logger')(_0x46d2('0x17'));var utils=require(_0x46d2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x46d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419ad0,_0x68cdec){_0x68cdec=_0x68cdec||0xcc;return function(_0x1ade67){if(_0x1ade67){return _0x419ad0[_0x46d2('0x1a')](_0x68cdec);}return _0x419ad0['status'](_0x68cdec)[_0x46d2('0x1b')]();};}function respondWithResult(_0x2cbf8a,_0x2e463b){_0x2e463b=_0x2e463b||0xc8;return function(_0x5ad5ae){if(_0x5ad5ae){return _0x2cbf8a[_0x46d2('0x1c')](_0x2e463b)[_0x46d2('0x1d')](_0x5ad5ae);}};}function respondWithFilteredResult(_0x5cf13d,_0x3c4bd5){return function(_0x28efc1){if(_0x28efc1){var _0x534d2a=typeof _0x3c4bd5[_0x46d2('0x1e')]==='undefined'&&typeof _0x3c4bd5['limit']===_0x46d2('0x1f');var _0x512d46=_0x28efc1[_0x46d2('0x20')];var _0x42c134=_0x534d2a?0x0:_0x3c4bd5['offset'];var _0x68a675=_0x534d2a?_0x28efc1['count']:_0x3c4bd5['offset']+_0x3c4bd5[_0x46d2('0x21')];var _0x45c136;if(_0x68a675>=_0x512d46){_0x68a675=_0x512d46;_0x45c136=0xc8;}else{_0x45c136=0xce;}_0x5cf13d[_0x46d2('0x1c')](_0x45c136);return _0x5cf13d[_0x46d2('0x22')](_0x46d2('0x23'),_0x42c134+'-'+_0x68a675+'/'+_0x512d46)['json'](_0x28efc1);}return null;};}function patchUpdates(_0x493449){return function(_0x3ce213){try{jsonpatch[_0x46d2('0x24')](_0x3ce213,_0x493449,!![]);}catch(_0x555490){return BPromise[_0x46d2('0x25')](_0x555490);}return _0x3ce213['save']();};}function saveUpdates(_0x58442d,_0x18105b){return function(_0x44c320){if(_0x44c320){return _0x44c320[_0x46d2('0x26')](_0x58442d)[_0x46d2('0x27')](function(_0x112700){return _0x112700;});}return null;};}function removeEntity(_0x21982d,_0x27c7d4){return function(_0x508d00){if(_0x508d00){return _0x508d00[_0x46d2('0x28')]()[_0x46d2('0x27')](function(){_0x21982d[_0x46d2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b6958,_0x19b3e9){return function(_0x543a19){if(!_0x543a19){_0x7b6958[_0x46d2('0x1a')](0x194);}return _0x543a19;};}function handleError(_0x169194,_0x2e06db){_0x2e06db=_0x2e06db||0x1f4;return function(_0x44359c){logger[_0x46d2('0x29')](_0x44359c['stack']);if(_0x44359c[_0x46d2('0x2a')]){delete _0x44359c['name'];}_0x169194[_0x46d2('0x1c')](_0x2e06db)['send'](_0x44359c);};}exports[_0x46d2('0x2b')]=function(_0x50062e,_0x500ee5){var _0x1fbeb8={},_0x3fe61b={},_0x82a342={'count':0x0,'rows':[]};var _0x48b44a=_['map'](db[_0x46d2('0x2c')][_0x46d2('0x2d')],function(_0x174bef){return{'name':_0x174bef[_0x46d2('0x2e')],'type':_0x174bef[_0x46d2('0x2f')][_0x46d2('0x30')]};});_0x3fe61b['model']=_[_0x46d2('0x31')](_0x48b44a,_0x46d2('0x2a'));_0x3fe61b[_0x46d2('0x32')]=_['keys'](_0x50062e['query']);_0x3fe61b[_0x46d2('0x33')]=_['intersection'](_0x3fe61b['model'],_0x3fe61b[_0x46d2('0x32')]);_0x1fbeb8[_0x46d2('0x34')]=_['intersection'](_0x3fe61b[_0x46d2('0x35')],qs[_0x46d2('0x36')](_0x50062e[_0x46d2('0x32')]['fields']));_0x1fbeb8['attributes']=_0x1fbeb8[_0x46d2('0x34')][_0x46d2('0x37')]?_0x1fbeb8[_0x46d2('0x34')]:_0x3fe61b['model'];if(!_0x50062e[_0x46d2('0x32')][_0x46d2('0x38')](_0x46d2('0x39'))){_0x1fbeb8[_0x46d2('0x21')]=qs[_0x46d2('0x21')](_0x50062e[_0x46d2('0x32')]['limit']);_0x1fbeb8['offset']=qs[_0x46d2('0x1e')](_0x50062e[_0x46d2('0x32')][_0x46d2('0x1e')]);}_0x1fbeb8[_0x46d2('0x3a')]=qs[_0x46d2('0x3b')](_0x50062e[_0x46d2('0x32')][_0x46d2('0x3b')]);_0x1fbeb8[_0x46d2('0x3c')]=qs[_0x46d2('0x33')](_['pick'](_0x50062e[_0x46d2('0x32')],_0x3fe61b[_0x46d2('0x33')]),_0x48b44a);if(_0x50062e[_0x46d2('0x32')][_0x46d2('0x3d')]){_0x1fbeb8[_0x46d2('0x3c')]=_[_0x46d2('0x3e')](_0x1fbeb8[_0x46d2('0x3c')],{'$or':_[_0x46d2('0x31')](_0x48b44a,function(_0x55d599){if(_0x55d599[_0x46d2('0x2f')]!==_0x46d2('0x3f')){var _0x1f9b6d={};_0x1f9b6d[_0x55d599['name']]={'$like':'%'+_0x50062e[_0x46d2('0x32')][_0x46d2('0x3d')]+'%'};return _0x1f9b6d;}})});}_0x1fbeb8=_[_0x46d2('0x3e')]({},_0x1fbeb8,_0x50062e[_0x46d2('0x40')]);var _0x1fcf10={'where':_0x1fbeb8[_0x46d2('0x3c')]};return db['OpenchannelTransferReport'][_0x46d2('0x20')](_0x1fcf10)['then'](function(_0x31cf27){_0x82a342[_0x46d2('0x20')]=_0x31cf27;if(_0x50062e['query']['includeAll']){_0x1fbeb8[_0x46d2('0x41')]=[{'all':!![]}];}return db[_0x46d2('0x2c')][_0x46d2('0x42')](_0x1fbeb8);})[_0x46d2('0x27')](function(_0x59aa4f){_0x82a342[_0x46d2('0x43')]=_0x59aa4f;return _0x82a342;})[_0x46d2('0x27')](respondWithFilteredResult(_0x500ee5,_0x1fbeb8))[_0x46d2('0x44')](handleError(_0x500ee5,null));};exports[_0x46d2('0x45')]=function(_0x3a4684,_0x1abeb8){var _0x4d8504={'raw':!![],'where':{'id':_0x3a4684[_0x46d2('0x46')]['id']}},_0x589ae6={};_0x589ae6[_0x46d2('0x35')]=_[_0x46d2('0x47')](db[_0x46d2('0x2c')][_0x46d2('0x2d')]);_0x589ae6[_0x46d2('0x32')]=_[_0x46d2('0x47')](_0x3a4684[_0x46d2('0x32')]);_0x589ae6[_0x46d2('0x33')]=_[_0x46d2('0x48')](_0x589ae6[_0x46d2('0x35')],_0x589ae6[_0x46d2('0x32')]);_0x4d8504['attributes']=_[_0x46d2('0x48')](_0x589ae6['model'],qs['fields'](_0x3a4684[_0x46d2('0x32')]['fields']));_0x4d8504[_0x46d2('0x34')]=_0x4d8504[_0x46d2('0x34')][_0x46d2('0x37')]?_0x4d8504[_0x46d2('0x34')]:_0x589ae6['model'];if(_0x3a4684[_0x46d2('0x32')][_0x46d2('0x49')]){_0x4d8504[_0x46d2('0x41')]=[{'all':!![]}];}_0x4d8504=_[_0x46d2('0x3e')]({},_0x4d8504,_0x3a4684[_0x46d2('0x40')]);return db[_0x46d2('0x2c')]['find'](_0x4d8504)['then'](handleEntityNotFound(_0x1abeb8,null))[_0x46d2('0x27')](respondWithResult(_0x1abeb8,null))[_0x46d2('0x44')](handleError(_0x1abeb8,null));};exports['create']=function(_0x44febb,_0x25b884){return db[_0x46d2('0x2c')][_0x46d2('0x4a')](_0x44febb[_0x46d2('0x4b')],{})[_0x46d2('0x27')](respondWithResult(_0x25b884,0xc9))[_0x46d2('0x44')](handleError(_0x25b884,null));};exports['update']=function(_0x39242c,_0x3ec05a){if(_0x39242c[_0x46d2('0x4b')]['id']){delete _0x39242c[_0x46d2('0x4b')]['id'];}return db[_0x46d2('0x2c')]['find']({'where':{'id':_0x39242c['params']['id']}})['then'](handleEntityNotFound(_0x3ec05a,null))[_0x46d2('0x27')](saveUpdates(_0x39242c[_0x46d2('0x4b')],null))[_0x46d2('0x27')](respondWithResult(_0x3ec05a,null))[_0x46d2('0x44')](handleError(_0x3ec05a,null));};exports[_0x46d2('0x28')]=function(_0x37964e,_0x330257){return db[_0x46d2('0x2c')]['find']({'where':{'id':_0x37964e['params']['id']}})['then'](handleEntityNotFound(_0x330257,null))[_0x46d2('0x27')](removeEntity(_0x330257,null))[_0x46d2('0x44')](handleError(_0x330257,null));};exports[_0x46d2('0x4c')]=function(_0x125c94,_0x518fb9){return db['OpenchannelTransferReport']['describe']()[_0x46d2('0x27')](respondWithResult(_0x518fb9,null))[_0x46d2('0x44')](handleError(_0x518fb9,null));}; \ No newline at end of file +var _0xe672=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','OpenchannelTransferReport','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0xe672,0x154));var _0x2e67=function(_0x3df60c,_0x573229){_0x3df60c=_0x3df60c-0x0;var _0x50202b=_0xe672[_0x3df60c];return _0x50202b;};'use strict';var emlformat=require(_0x2e67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e67('0x1'));var jsonpatch=require(_0x2e67('0x2'));var rp=require(_0x2e67('0x3'));var moment=require('moment');var BPromise=require(_0x2e67('0x4'));var Mustache=require('mustache');var util=require(_0x2e67('0x5'));var path=require('path');var sox=require(_0x2e67('0x6'));var csv=require(_0x2e67('0x7'));var ejs=require(_0x2e67('0x8'));var fs=require('fs');var fs_extra=require(_0x2e67('0x9'));var _=require('lodash');var squel=require(_0x2e67('0xa'));var crypto=require(_0x2e67('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2e67('0xc'));var toCsv=require(_0x2e67('0x7'));var querystring=require('querystring');var Papa=require(_0x2e67('0xd'));var Redis=require('ioredis');var authService=require(_0x2e67('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2e67('0xf'));var hardwareService=require(_0x2e67('0x10'));var logger=require(_0x2e67('0x11'))('api');var utils=require(_0x2e67('0x12'));var config=require(_0x2e67('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f0144,_0x28ab11){_0x28ab11=_0x28ab11||0xcc;return function(_0x140fbf){if(_0x140fbf){return _0x4f0144[_0x2e67('0x14')](_0x28ab11);}return _0x4f0144[_0x2e67('0x15')](_0x28ab11)['end']();};}function respondWithResult(_0x1235f9,_0x25391c){_0x25391c=_0x25391c||0xc8;return function(_0xc0a73f){if(_0xc0a73f){return _0x1235f9['status'](_0x25391c)[_0x2e67('0x16')](_0xc0a73f);}};}function respondWithFilteredResult(_0x261365,_0x4cf457){return function(_0x139169){if(_0x139169){var _0x12fb58=typeof _0x4cf457[_0x2e67('0x17')]===_0x2e67('0x18')&&typeof _0x4cf457[_0x2e67('0x19')]==='undefined';var _0xa6ea25=_0x139169[_0x2e67('0x1a')];var _0x46707b=_0x12fb58?0x0:_0x4cf457[_0x2e67('0x17')];var _0x23c4f8=_0x12fb58?_0x139169[_0x2e67('0x1a')]:_0x4cf457['offset']+_0x4cf457[_0x2e67('0x19')];var _0x8d70c1;if(_0x23c4f8>=_0xa6ea25){_0x23c4f8=_0xa6ea25;_0x8d70c1=0xc8;}else{_0x8d70c1=0xce;}_0x261365[_0x2e67('0x15')](_0x8d70c1);return _0x261365[_0x2e67('0x1b')](_0x2e67('0x1c'),_0x46707b+'-'+_0x23c4f8+'/'+_0xa6ea25)[_0x2e67('0x16')](_0x139169);}return null;};}function patchUpdates(_0x1a29e0){return function(_0x318ccd){try{jsonpatch[_0x2e67('0x1d')](_0x318ccd,_0x1a29e0,!![]);}catch(_0x40d614){return BPromise[_0x2e67('0x1e')](_0x40d614);}return _0x318ccd[_0x2e67('0x1f')]();};}function saveUpdates(_0x26557b,_0x241398){return function(_0x40f1bc){if(_0x40f1bc){return _0x40f1bc[_0x2e67('0x20')](_0x26557b)[_0x2e67('0x21')](function(_0x3bc985){return _0x3bc985;});}return null;};}function removeEntity(_0x292272,_0x51dda0){return function(_0x2eae64){if(_0x2eae64){return _0x2eae64[_0x2e67('0x22')]()['then'](function(){_0x292272[_0x2e67('0x15')](0xcc)[_0x2e67('0x23')]();});}};}function handleEntityNotFound(_0x46179e,_0x207df1){return function(_0x1085cf){if(!_0x1085cf){_0x46179e['sendStatus'](0x194);}return _0x1085cf;};}function handleError(_0x7a14fd,_0x94645b){_0x94645b=_0x94645b||0x1f4;return function(_0xca589e){logger['error'](_0xca589e['stack']);if(_0xca589e[_0x2e67('0x24')]){delete _0xca589e[_0x2e67('0x24')];}_0x7a14fd[_0x2e67('0x15')](_0x94645b)[_0x2e67('0x25')](_0xca589e);};}exports[_0x2e67('0x26')]=function(_0xb9411f,_0x45fc2d){var _0x180832={},_0xaba3db={},_0x439856={'count':0x0,'rows':[]};var _0x294ab5=_[_0x2e67('0x27')](db['OpenchannelTransferReport'][_0x2e67('0x28')],function(_0x2cbb9f){return{'name':_0x2cbb9f['fieldName'],'type':_0x2cbb9f['type'][_0x2e67('0x29')]};});_0xaba3db[_0x2e67('0x2a')]=_[_0x2e67('0x27')](_0x294ab5,_0x2e67('0x24'));_0xaba3db[_0x2e67('0x2b')]=_[_0x2e67('0x2c')](_0xb9411f[_0x2e67('0x2b')]);_0xaba3db[_0x2e67('0x2d')]=_[_0x2e67('0x2e')](_0xaba3db[_0x2e67('0x2a')],_0xaba3db[_0x2e67('0x2b')]);_0x180832[_0x2e67('0x2f')]=_['intersection'](_0xaba3db[_0x2e67('0x2a')],qs['fields'](_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x30')]));_0x180832['attributes']=_0x180832[_0x2e67('0x2f')][_0x2e67('0x31')]?_0x180832[_0x2e67('0x2f')]:_0xaba3db[_0x2e67('0x2a')];if(!_0xb9411f['query']['hasOwnProperty'](_0x2e67('0x32'))){_0x180832[_0x2e67('0x19')]=qs[_0x2e67('0x19')](_0xb9411f['query'][_0x2e67('0x19')]);_0x180832[_0x2e67('0x17')]=qs[_0x2e67('0x17')](_0xb9411f['query'][_0x2e67('0x17')]);}_0x180832[_0x2e67('0x33')]=qs[_0x2e67('0x34')](_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x34')]);_0x180832['where']=qs[_0x2e67('0x2d')](_[_0x2e67('0x35')](_0xb9411f[_0x2e67('0x2b')],_0xaba3db[_0x2e67('0x2d')]),_0x294ab5);if(_0xb9411f[_0x2e67('0x2b')]['filter']){_0x180832['where']=_[_0x2e67('0x36')](_0x180832[_0x2e67('0x37')],{'$or':_['map'](_0x294ab5,function(_0x44d05f){if(_0x44d05f[_0x2e67('0x38')]!==_0x2e67('0x39')){var _0x852867={};_0x852867[_0x44d05f[_0x2e67('0x24')]]={'$like':'%'+_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x3a')]+'%'};return _0x852867;}})});}_0x180832=_[_0x2e67('0x36')]({},_0x180832,_0xb9411f[_0x2e67('0x3b')]);var _0x447377={'where':_0x180832[_0x2e67('0x37')]};return db['OpenchannelTransferReport'][_0x2e67('0x1a')](_0x447377)[_0x2e67('0x21')](function(_0x1a0204){_0x439856[_0x2e67('0x1a')]=_0x1a0204;if(_0xb9411f[_0x2e67('0x2b')][_0x2e67('0x3c')]){_0x180832['include']=[{'all':!![]}];}return db[_0x2e67('0x3d')][_0x2e67('0x3e')](_0x180832);})['then'](function(_0x1c702b){_0x439856[_0x2e67('0x3f')]=_0x1c702b;return _0x439856;})[_0x2e67('0x21')](respondWithFilteredResult(_0x45fc2d,_0x180832))['catch'](handleError(_0x45fc2d,null));};exports[_0x2e67('0x40')]=function(_0x46c948,_0x4ca805){var _0x2fe5c2={'raw':!![],'where':{'id':_0x46c948[_0x2e67('0x41')]['id']}},_0x549bc1={};_0x549bc1[_0x2e67('0x2a')]=_[_0x2e67('0x2c')](db[_0x2e67('0x3d')]['rawAttributes']);_0x549bc1[_0x2e67('0x2b')]=_['keys'](_0x46c948[_0x2e67('0x2b')]);_0x549bc1[_0x2e67('0x2d')]=_[_0x2e67('0x2e')](_0x549bc1[_0x2e67('0x2a')],_0x549bc1[_0x2e67('0x2b')]);_0x2fe5c2[_0x2e67('0x2f')]=_[_0x2e67('0x2e')](_0x549bc1['model'],qs[_0x2e67('0x30')](_0x46c948[_0x2e67('0x2b')]['fields']));_0x2fe5c2['attributes']=_0x2fe5c2[_0x2e67('0x2f')]['length']?_0x2fe5c2[_0x2e67('0x2f')]:_0x549bc1[_0x2e67('0x2a')];if(_0x46c948['query']['includeAll']){_0x2fe5c2[_0x2e67('0x42')]=[{'all':!![]}];}_0x2fe5c2=_[_0x2e67('0x36')]({},_0x2fe5c2,_0x46c948[_0x2e67('0x3b')]);return db[_0x2e67('0x3d')][_0x2e67('0x43')](_0x2fe5c2)[_0x2e67('0x21')](handleEntityNotFound(_0x4ca805,null))[_0x2e67('0x21')](respondWithResult(_0x4ca805,null))[_0x2e67('0x44')](handleError(_0x4ca805,null));};exports[_0x2e67('0x45')]=function(_0x4c80ec,_0x60a5f7){return db[_0x2e67('0x3d')]['create'](_0x4c80ec[_0x2e67('0x46')],{})['then'](respondWithResult(_0x60a5f7,0xc9))['catch'](handleError(_0x60a5f7,null));};exports[_0x2e67('0x20')]=function(_0x224120,_0x1e167c){if(_0x224120[_0x2e67('0x46')]['id']){delete _0x224120[_0x2e67('0x46')]['id'];}return db[_0x2e67('0x3d')][_0x2e67('0x43')]({'where':{'id':_0x224120[_0x2e67('0x41')]['id']}})[_0x2e67('0x21')](handleEntityNotFound(_0x1e167c,null))[_0x2e67('0x21')](saveUpdates(_0x224120[_0x2e67('0x46')],null))['then'](respondWithResult(_0x1e167c,null))[_0x2e67('0x44')](handleError(_0x1e167c,null));};exports[_0x2e67('0x22')]=function(_0x3074d9,_0x3d54ef){return db[_0x2e67('0x3d')]['find']({'where':{'id':_0x3074d9[_0x2e67('0x41')]['id']}})[_0x2e67('0x21')](handleEntityNotFound(_0x3d54ef,null))['then'](removeEntity(_0x3d54ef,null))[_0x2e67('0x44')](handleError(_0x3d54ef,null));};exports[_0x2e67('0x47')]=function(_0x55058b,_0x16ae46){return db[_0x2e67('0x3d')][_0x2e67('0x47')]()['then'](respondWithResult(_0x16ae46,null))['catch'](handleError(_0x16ae46,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f4eac4c..527ef81 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 _0x94f5=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x299837,_0x8001fd){var _0x313440=function(_0x484eda){while(--_0x484eda){_0x299837['push'](_0x299837['shift']());}};_0x313440(++_0x8001fd);}(_0x94f5,0x103));var _0x594f=function(_0x33a325,_0x44e68b){_0x33a325=_0x33a325-0x0;var _0x41fead=_0x94f5[_0x33a325];return _0x41fead;};'use strict';var _=require(_0x594f('0x0'));var util=require(_0x594f('0x1'));var logger=require(_0x594f('0x2'))(_0x594f('0x3'));var moment=require(_0x594f('0x4'));var BPromise=require(_0x594f('0x5'));var rp=require(_0x594f('0x6'));var fs=require('fs');var path=require(_0x594f('0x7'));var rimraf=require(_0x594f('0x8'));var config=require(_0x594f('0x9'));var attributes=require(_0x594f('0xa'));module['exports']=function(_0x159487,_0x1e0c85){return _0x159487[_0x594f('0xb')](_0x594f('0xc'),attributes,{'tableName':_0x594f('0xd'),'paranoid':![],'indexes':[{'name':_0x594f('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xacb5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','lodash'];(function(_0x52449f,_0x2a6b98){var _0x12e6ed=function(_0x87f010){while(--_0x87f010){_0x52449f['push'](_0x52449f['shift']());}};_0x12e6ed(++_0x2a6b98);}(_0xacb5,0x197));var _0x5acb=function(_0x3875b1,_0x47cf1a){_0x3875b1=_0x3875b1-0x0;var _0x1e9c55=_0xacb5[_0x3875b1];return _0x1e9c55;};'use strict';var _=require(_0x5acb('0x0'));var util=require('util');var logger=require(_0x5acb('0x1'))(_0x5acb('0x2'));var moment=require(_0x5acb('0x3'));var BPromise=require(_0x5acb('0x4'));var rp=require(_0x5acb('0x5'));var fs=require('fs');var path=require(_0x5acb('0x6'));var rimraf=require(_0x5acb('0x7'));var config=require('../../config/environment');var attributes=require(_0x5acb('0x8'));module[_0x5acb('0x9')]=function(_0x2a9806,_0x4d76bc){return _0x2a9806[_0x5acb('0xa')](_0x5acb('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index ae15b92..c99bc86 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 _0xadf0=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','util','moment','bluebird'];(function(_0x151370,_0xdcac59){var _0x2993ac=function(_0x33d896){while(--_0x33d896){_0x151370['push'](_0x151370['shift']());}};_0x2993ac(++_0xdcac59);}(_0xadf0,0x12d));var _0x0adf=function(_0x6a0cbd,_0x5eb17e){_0x6a0cbd=_0x6a0cbd-0x0;var _0x2d413a=_0xadf0[_0x6a0cbd];return _0x2d413a;};'use strict';var _=require('lodash');var util=require(_0x0adf('0x0'));var moment=require(_0x0adf('0x1'));var BPromise=require(_0x0adf('0x2'));var rs=require(_0x0adf('0x3'));var fs=require('fs');var Redis=require(_0x0adf('0x4'));var db=require(_0x0adf('0x5'))['db'];var utils=require(_0x0adf('0x6'));var logger=require('../../config/logger')(_0x0adf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd1de43,_0x2393f1,_0x514e20){return new BPromise(function(_0x58f618,_0x33e906){return client[_0x0adf('0x8')](_0xd1de43,_0x514e20)['then'](function(_0x357c3b){logger[_0x0adf('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2393f1,_0x0adf('0xa'));logger[_0x0adf('0xb')](_0x0adf('0xc'),_0x2393f1,'request\x20sent',JSON[_0x0adf('0xd')](_0x357c3b));if(_0x357c3b[_0x0adf('0xe')]){if(_0x357c3b[_0x0adf('0xe')][_0x0adf('0xf')]===0x1f4){logger[_0x0adf('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2393f1,_0x357c3b[_0x0adf('0xe')][_0x0adf('0x10')]);return _0x33e906(_0x357c3b['error'][_0x0adf('0x10')]);}logger['error'](_0x0adf('0x11'),_0x2393f1,_0x357c3b['error'][_0x0adf('0x10')]);return _0x58f618(_0x357c3b[_0x0adf('0xe')][_0x0adf('0x10')]);}else{logger[_0x0adf('0x9')](_0x0adf('0x11'),_0x2393f1,_0x0adf('0xa'));_0x58f618(_0x357c3b[_0x0adf('0x12')][_0x0adf('0x10')]);}})['catch'](function(_0x2ee54e){logger[_0x0adf('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2393f1,_0x2ee54e);_0x33e906(_0x2ee54e);});});} \ No newline at end of file +var _0x1db9=['../../config/utils','../../config/logger','jayson/promise','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x454daa,_0x28cb38){var _0x400436=function(_0x307e79){while(--_0x307e79){_0x454daa['push'](_0x454daa['shift']());}};_0x400436(++_0x28cb38);}(_0x1db9,0x176));var _0x91db=function(_0x47b1cb,_0x2ecb31){_0x47b1cb=_0x47b1cb-0x0;var _0x5131e9=_0x1db9[_0x47b1cb];return _0x5131e9;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require(_0x91db('0x3'));var rs=require(_0x91db('0x4'));var fs=require('fs');var Redis=require(_0x91db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91db('0x6'));var logger=require(_0x91db('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433c75,_0x3b0c53,_0x45fea0){return new BPromise(function(_0x2330c2,_0x2d89a1){return client['request'](_0x433c75,_0x45fea0)[_0x91db('0x9')](function(_0x58cda2){logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));logger['debug'](_0x91db('0xd'),_0x3b0c53,'request\x20sent',JSON['stringify'](_0x58cda2));if(_0x58cda2['error']){if(_0x58cda2[_0x91db('0xe')][_0x91db('0xf')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2d89a1(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2330c2(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}else{logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));_0x2330c2(_0x58cda2[_0x91db('0x11')][_0x91db('0x10')]);}})[_0x91db('0x12')](function(_0x1e9679){logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x1e9679);_0x2d89a1(_0x1e9679);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3ff70d3..9c28996 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 _0xb764=['get','isAuthenticated','index','/:id','create','put','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a7455,_0x46b004){var _0x216c72=function(_0xdd775c){while(--_0xdd775c){_0x3a7455['push'](_0x3a7455['shift']());}};_0x216c72(++_0x46b004);}(_0xb764,0x1d8));var _0x4b76=function(_0x41af7e,_0x8da338){_0x41af7e=_0x41af7e-0x0;var _0x5cd3a2=_0xb764[_0x41af7e];return _0x5cd3a2;};'use strict';var multer=require('multer');var util=require(_0x4b76('0x0'));var path=require(_0x4b76('0x1'));var timeout=require(_0x4b76('0x2'));var express=require(_0x4b76('0x3'));var router=express[_0x4b76('0x4')]();var fs_extra=require(_0x4b76('0x5'));var auth=require(_0x4b76('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4b76('0x7'));var controller=require('./pause.controller');router[_0x4b76('0x8')]('/',auth[_0x4b76('0x9')](),controller[_0x4b76('0xa')]);router[_0x4b76('0x8')](_0x4b76('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4b76('0x9')](),controller[_0x4b76('0xc')]);router[_0x4b76('0xd')](_0x4b76('0xb'),auth[_0x4b76('0x9')](),controller['update']);router[_0x4b76('0xe')](_0x4b76('0xb'),auth[_0x4b76('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x28b5=['path','connect-timeout','express','fs-extra','../../config/environment','./pause.controller','get','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer'];(function(_0x415eb1,_0x428fbb){var _0x3457b3=function(_0x1dd4e5){while(--_0x1dd4e5){_0x415eb1['push'](_0x415eb1['shift']());}};_0x3457b3(++_0x428fbb);}(_0x28b5,0x13f));var _0x528b=function(_0x12db5b,_0x17dec0){_0x12db5b=_0x12db5b-0x0;var _0xf0f483=_0x28b5[_0x12db5b];return _0xf0f483;};'use strict';var multer=require(_0x528b('0x0'));var util=require('util');var path=require(_0x528b('0x1'));var timeout=require(_0x528b('0x2'));var express=require(_0x528b('0x3'));var router=express['Router']();var fs_extra=require(_0x528b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x528b('0x5'));var controller=require(_0x528b('0x6'));router[_0x528b('0x7')]('/',auth[_0x528b('0x8')](),controller['index']);router[_0x528b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x528b('0x9')]);router[_0x528b('0xa')]('/',auth[_0x528b('0x8')](),controller['create']);router['put'](_0x528b('0xb'),auth[_0x528b('0x8')](),controller[_0x528b('0xc')]);router[_0x528b('0xd')](_0x528b('0xb'),auth['isAuthenticated'](),controller[_0x528b('0xe')]);module[_0x528b('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index b31b28c..91de850 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 _0x6baa=['name','exports','STRING'];(function(_0x420f22,_0x16b6ea){var _0x573bc9=function(_0x2cfcba){while(--_0x2cfcba){_0x420f22['push'](_0x420f22['shift']());}};_0x573bc9(++_0x16b6ea);}(_0x6baa,0x10f));var _0xa6ba=function(_0x19785d,_0x360486){_0x19785d=_0x19785d-0x0;var _0xde841a=_0x6baa[_0x19785d];return _0xde841a;};'use strict';var Sequelize=require('sequelize');module[_0xa6ba('0x0')]={'name':{'type':Sequelize[_0xa6ba('0x1')],'unique':_0xa6ba('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa6ba('0x1')]}}; \ No newline at end of file +var _0xdec8=['sequelize','exports','STRING'];(function(_0x41ee7c,_0x3a8deb){var _0x54f982=function(_0x265baf){while(--_0x265baf){_0x41ee7c['push'](_0x41ee7c['shift']());}};_0x54f982(++_0x3a8deb);}(_0xdec8,0xcf));var _0x8dec=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xdec8[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x8dec('0x0'));module[_0x8dec('0x1')]={'name':{'type':Sequelize[_0x8dec('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3782b7e..aa7e6f8 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 _0xea2c=['query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','show','length','find','catch','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','Pauses','UserProfileResource','then','sendStatus','error','stack','name','send','map','Pause','rawAttributes','fieldName','key','model','keys'];(function(_0x29dffa,_0x2ba023){var _0x213a54=function(_0x28d874){while(--_0x28d874){_0x29dffa['push'](_0x29dffa['shift']());}};_0x213a54(++_0x2ba023);}(_0xea2c,0x1a8));var _0xcea2=function(_0x579edf,_0x1cba23){_0x579edf=_0x579edf-0x0;var _0x55872e=_0xea2c[_0x579edf];return _0x55872e;};'use strict';var emlformat=require(_0xcea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcea2('0x1'));var jsonpatch=require(_0xcea2('0x2'));var rp=require('request-promise');var moment=require(_0xcea2('0x3'));var BPromise=require(_0xcea2('0x4'));var Mustache=require(_0xcea2('0x5'));var util=require(_0xcea2('0x6'));var path=require(_0xcea2('0x7'));var sox=require('sox');var csv=require(_0xcea2('0x8'));var ejs=require(_0xcea2('0x9'));var fs=require('fs');var fs_extra=require(_0xcea2('0xa'));var _=require(_0xcea2('0xb'));var squel=require(_0xcea2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcea2('0xd'));var toCsv=require(_0xcea2('0x8'));var querystring=require(_0xcea2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcea2('0xf'));var qs=require(_0xcea2('0x10'));var as=require(_0xcea2('0x11'));var hardwareService=require(_0xcea2('0x12'));var logger=require(_0xcea2('0x13'))(_0xcea2('0x14'));var utils=require(_0xcea2('0x15'));var config=require(_0xcea2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3424ee,_0xac3d6c){_0xac3d6c=_0xac3d6c||0xcc;return function(_0x11e470){if(_0x11e470){return _0x3424ee['sendStatus'](_0xac3d6c);}return _0x3424ee[_0xcea2('0x17')](_0xac3d6c)['end']();};}function respondWithResult(_0x5d076a,_0x23f570){_0x23f570=_0x23f570||0xc8;return function(_0xb61a44){if(_0xb61a44){return _0x5d076a['status'](_0x23f570)[_0xcea2('0x18')](_0xb61a44);}};}function respondWithFilteredResult(_0x21355f,_0x3541bb){return function(_0x2fb7b9){if(_0x2fb7b9){var _0x3afb32=typeof _0x3541bb[_0xcea2('0x19')]===_0xcea2('0x1a')&&typeof _0x3541bb[_0xcea2('0x1b')]===_0xcea2('0x1a');var _0x529a8d=_0x2fb7b9[_0xcea2('0x1c')];var _0x743d01=_0x3afb32?0x0:_0x3541bb[_0xcea2('0x19')];var _0x74af37=_0x3afb32?_0x2fb7b9[_0xcea2('0x1c')]:_0x3541bb[_0xcea2('0x19')]+_0x3541bb[_0xcea2('0x1b')];var _0x4c191a;if(_0x74af37>=_0x529a8d){_0x74af37=_0x529a8d;_0x4c191a=0xc8;}else{_0x4c191a=0xce;}_0x21355f['status'](_0x4c191a);return _0x21355f[_0xcea2('0x1d')](_0xcea2('0x1e'),_0x743d01+'-'+_0x74af37+'/'+_0x529a8d)[_0xcea2('0x18')](_0x2fb7b9);}return null;};}function patchUpdates(_0x1358f0){return function(_0x4421fc){try{jsonpatch[_0xcea2('0x1f')](_0x4421fc,_0x1358f0,!![]);}catch(_0x3dc156){return BPromise['reject'](_0x3dc156);}return _0x4421fc[_0xcea2('0x20')]();};}function saveUpdates(_0x116893,_0x57aa9b){return function(_0x4720bb){if(_0x4720bb){return _0x4720bb[_0xcea2('0x21')](_0x116893)['then'](function(_0x1a729d){return _0x1a729d;});}return null;};}function removeEntity(_0x345077,_0x1e7961){return function(_0x1d548d){if(_0x1d548d){return _0x1d548d[_0xcea2('0x22')]()['then'](function(){var _0x5da616=_0x1d548d['get']({'plain':!![]});var _0x35e1c9=_0xcea2('0x23');return db[_0xcea2('0x24')][_0xcea2('0x22')]({'where':{'type':_0x35e1c9,'resourceId':_0x5da616['id']}})['then'](function(){return _0x1d548d;});})[_0xcea2('0x25')](function(){_0x345077[_0xcea2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3447ec,_0x3bee2f){return function(_0x4c300a){if(!_0x4c300a){_0x3447ec[_0xcea2('0x26')](0x194);}return _0x4c300a;};}function handleError(_0x2d192b,_0x1cef97){_0x1cef97=_0x1cef97||0x1f4;return function(_0x415f94){logger[_0xcea2('0x27')](_0x415f94[_0xcea2('0x28')]);if(_0x415f94['name']){delete _0x415f94[_0xcea2('0x29')];}_0x2d192b[_0xcea2('0x17')](_0x1cef97)[_0xcea2('0x2a')](_0x415f94);};}exports['index']=function(_0x5d103d,_0x6084a8){var _0x5112c0={},_0xed6f8f={},_0x515b45={'count':0x0,'rows':[]};var _0x11404a=_[_0xcea2('0x2b')](db[_0xcea2('0x2c')][_0xcea2('0x2d')],function(_0x5a610b){return{'name':_0x5a610b[_0xcea2('0x2e')],'type':_0x5a610b['type'][_0xcea2('0x2f')]};});_0xed6f8f[_0xcea2('0x30')]=_[_0xcea2('0x2b')](_0x11404a,_0xcea2('0x29'));_0xed6f8f['query']=_[_0xcea2('0x31')](_0x5d103d[_0xcea2('0x32')]);_0xed6f8f[_0xcea2('0x33')]=_[_0xcea2('0x34')](_0xed6f8f[_0xcea2('0x30')],_0xed6f8f['query']);_0x5112c0[_0xcea2('0x35')]=_[_0xcea2('0x34')](_0xed6f8f[_0xcea2('0x30')],qs[_0xcea2('0x36')](_0x5d103d['query'][_0xcea2('0x36')]));_0x5112c0[_0xcea2('0x35')]=_0x5112c0[_0xcea2('0x35')]['length']?_0x5112c0[_0xcea2('0x35')]:_0xed6f8f[_0xcea2('0x30')];if(!_0x5d103d[_0xcea2('0x32')]['hasOwnProperty'](_0xcea2('0x37'))){_0x5112c0['limit']=qs['limit'](_0x5d103d[_0xcea2('0x32')][_0xcea2('0x1b')]);_0x5112c0[_0xcea2('0x19')]=qs[_0xcea2('0x19')](_0x5d103d[_0xcea2('0x32')][_0xcea2('0x19')]);}_0x5112c0[_0xcea2('0x38')]=qs['sort'](_0x5d103d[_0xcea2('0x32')][_0xcea2('0x39')]);_0x5112c0['where']=qs[_0xcea2('0x33')](_[_0xcea2('0x3a')](_0x5d103d[_0xcea2('0x32')],_0xed6f8f[_0xcea2('0x33')]),_0x11404a);if(_0x5d103d['query']['filter']){_0x5112c0[_0xcea2('0x3b')]=_[_0xcea2('0x3c')](_0x5112c0[_0xcea2('0x3b')],{'$or':_[_0xcea2('0x2b')](_0x11404a,function(_0x141740){if(_0x141740[_0xcea2('0x3d')]!=='VIRTUAL'){var _0x5d359c={};_0x5d359c[_0x141740[_0xcea2('0x29')]]={'$like':'%'+_0x5d103d[_0xcea2('0x32')][_0xcea2('0x3e')]+'%'};return _0x5d359c;}})});}_0x5112c0=_[_0xcea2('0x3c')]({},_0x5112c0,_0x5d103d[_0xcea2('0x3f')]);var _0x1c78cf={'where':_0x5112c0[_0xcea2('0x3b')]};return db[_0xcea2('0x2c')][_0xcea2('0x1c')](_0x1c78cf)[_0xcea2('0x25')](function(_0x2cadf8){_0x515b45['count']=_0x2cadf8;if(_0x5d103d[_0xcea2('0x32')][_0xcea2('0x40')]){_0x5112c0[_0xcea2('0x41')]=[{'all':!![]}];}return db['Pause'][_0xcea2('0x42')](_0x5112c0);})['then'](function(_0x52a374){_0x515b45['rows']=_0x52a374;return _0x515b45;})[_0xcea2('0x25')](respondWithFilteredResult(_0x6084a8,_0x5112c0))['catch'](handleError(_0x6084a8,null));};exports[_0xcea2('0x43')]=function(_0x59e640,_0x282f37){var _0x546661={'raw':!![],'where':{'id':_0x59e640['params']['id']}},_0x383d5d={};_0x383d5d[_0xcea2('0x30')]=_[_0xcea2('0x31')](db['Pause'][_0xcea2('0x2d')]);_0x383d5d[_0xcea2('0x32')]=_[_0xcea2('0x31')](_0x59e640[_0xcea2('0x32')]);_0x383d5d[_0xcea2('0x33')]=_[_0xcea2('0x34')](_0x383d5d[_0xcea2('0x30')],_0x383d5d[_0xcea2('0x32')]);_0x546661[_0xcea2('0x35')]=_[_0xcea2('0x34')](_0x383d5d['model'],qs[_0xcea2('0x36')](_0x59e640[_0xcea2('0x32')][_0xcea2('0x36')]));_0x546661[_0xcea2('0x35')]=_0x546661[_0xcea2('0x35')][_0xcea2('0x44')]?_0x546661[_0xcea2('0x35')]:_0x383d5d[_0xcea2('0x30')];if(_0x59e640[_0xcea2('0x32')][_0xcea2('0x40')]){_0x546661[_0xcea2('0x41')]=[{'all':!![]}];}_0x546661=_['merge']({},_0x546661,_0x59e640[_0xcea2('0x3f')]);return db[_0xcea2('0x2c')][_0xcea2('0x45')](_0x546661)[_0xcea2('0x25')](handleEntityNotFound(_0x282f37,null))[_0xcea2('0x25')](respondWithResult(_0x282f37,null))[_0xcea2('0x46')](handleError(_0x282f37,null));};exports[_0xcea2('0x47')]=function(_0x3e7b72,_0x757b41){return db[_0xcea2('0x2c')][_0xcea2('0x47')](_0x3e7b72['body'],{})[_0xcea2('0x25')](function(_0x225cb9){var _0x17935f=_0x3e7b72['user'][_0xcea2('0x48')]({'plain':!![]});if(!_0x17935f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17935f[_0xcea2('0x49')]==='user'){var _0x3b2540=_0x225cb9[_0xcea2('0x48')]({'plain':!![]});var _0x33f784=_0xcea2('0x23');return db[_0xcea2('0x4a')][_0xcea2('0x45')]({'where':{'name':_0x33f784,'userProfileId':_0x17935f[_0xcea2('0x4b')]},'raw':!![]})[_0xcea2('0x25')](function(_0xeb4476){if(_0xeb4476&&_0xeb4476['autoAssociation']===0x0){return db[_0xcea2('0x24')]['create']({'name':_0x3b2540['name'],'resourceId':_0x3b2540['id'],'type':_0xeb4476['name'],'sectionId':_0xeb4476['id']},{})[_0xcea2('0x25')](function(){return _0x225cb9;});}else{return _0x225cb9;}})[_0xcea2('0x46')](function(_0x49af7c){logger[_0xcea2('0x27')](_0xcea2('0x4c'),_0x49af7c);throw _0x49af7c;});}return _0x225cb9;})[_0xcea2('0x25')](respondWithResult(_0x757b41,0xc9))['catch'](handleError(_0x757b41,null));};exports[_0xcea2('0x21')]=function(_0x396d4c,_0x503ee6){if(_0x396d4c[_0xcea2('0x4d')]['id']){delete _0x396d4c[_0xcea2('0x4d')]['id'];}return db[_0xcea2('0x2c')][_0xcea2('0x45')]({'where':{'id':_0x396d4c[_0xcea2('0x4e')]['id']}})[_0xcea2('0x25')](handleEntityNotFound(_0x503ee6,null))['then'](saveUpdates(_0x396d4c['body'],null))['then'](respondWithResult(_0x503ee6,null))[_0xcea2('0x46')](handleError(_0x503ee6,null));};exports['destroy']=function(_0x1ab6b8,_0x18f4a3){return db[_0xcea2('0x2c')][_0xcea2('0x45')]({'where':{'id':_0x1ab6b8[_0xcea2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x18f4a3,null))['then'](removeEntity(_0x18f4a3,null))['catch'](handleError(_0x18f4a3,null));}; \ No newline at end of file +var _0x127b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x3ff0c6,_0x497a79){var _0x2ff3ed=function(_0x4d49a3){while(--_0x4d49a3){_0x3ff0c6['push'](_0x3ff0c6['shift']());}};_0x2ff3ed(++_0x497a79);}(_0x127b,0x1a9));var _0xb127=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x127b[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0xb127('0x0'));var rimraf=require(_0xb127('0x1'));var zipdir=require(_0xb127('0x2'));var jsonpatch=require(_0xb127('0x3'));var rp=require(_0xb127('0x4'));var moment=require(_0xb127('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb127('0x6'));var sox=require(_0xb127('0x7'));var csv=require('to-csv');var ejs=require(_0xb127('0x8'));var fs=require('fs');var fs_extra=require(_0xb127('0x9'));var _=require(_0xb127('0xa'));var squel=require(_0xb127('0xb'));var crypto=require('crypto');var jsforce=require(_0xb127('0xc'));var deskjs=require(_0xb127('0xd'));var toCsv=require(_0xb127('0xe'));var querystring=require(_0xb127('0xf'));var Papa=require('papaparse');var Redis=require(_0xb127('0x10'));var authService=require(_0xb127('0x11'));var qs=require(_0xb127('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb127('0x13'));var logger=require(_0xb127('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb127('0x15'));var licenseUtil=require(_0xb127('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x264961,_0x27dcf7){_0x27dcf7=_0x27dcf7||0xcc;return function(_0x47bbde){if(_0x47bbde){return _0x264961[_0xb127('0x17')](_0x27dcf7);}return _0x264961[_0xb127('0x18')](_0x27dcf7)[_0xb127('0x19')]();};}function respondWithResult(_0x1a8e04,_0x56efe7){_0x56efe7=_0x56efe7||0xc8;return function(_0x342551){if(_0x342551){return _0x1a8e04[_0xb127('0x18')](_0x56efe7)[_0xb127('0x1a')](_0x342551);}};}function respondWithFilteredResult(_0x1ad326,_0x368fc5){return function(_0x3bccd8){if(_0x3bccd8){var _0x33f4de=typeof _0x368fc5['offset']===_0xb127('0x1b')&&typeof _0x368fc5[_0xb127('0x1c')]===_0xb127('0x1b');var _0x242d5e=_0x3bccd8[_0xb127('0x1d')];var _0x18f1cd=_0x33f4de?0x0:_0x368fc5[_0xb127('0x1e')];var _0x40b1df=_0x33f4de?_0x3bccd8['count']:_0x368fc5[_0xb127('0x1e')]+_0x368fc5[_0xb127('0x1c')];var _0x364f34;if(_0x40b1df>=_0x242d5e){_0x40b1df=_0x242d5e;_0x364f34=0xc8;}else{_0x364f34=0xce;}_0x1ad326['status'](_0x364f34);return _0x1ad326[_0xb127('0x1f')](_0xb127('0x20'),_0x18f1cd+'-'+_0x40b1df+'/'+_0x242d5e)[_0xb127('0x1a')](_0x3bccd8);}return null;};}function patchUpdates(_0x3148cc){return function(_0xcfe1fc){try{jsonpatch[_0xb127('0x21')](_0xcfe1fc,_0x3148cc,!![]);}catch(_0x58da71){return BPromise[_0xb127('0x22')](_0x58da71);}return _0xcfe1fc[_0xb127('0x23')]();};}function saveUpdates(_0x4b14a2,_0x54ed78){return function(_0x539555){if(_0x539555){return _0x539555[_0xb127('0x24')](_0x4b14a2)[_0xb127('0x25')](function(_0x4a29f9){return _0x4a29f9;});}return null;};}function removeEntity(_0x5d2498,_0x25b1cf){return function(_0x17fe20){if(_0x17fe20){return _0x17fe20[_0xb127('0x26')]()['then'](function(){var _0x3cd555=_0x17fe20[_0xb127('0x27')]({'plain':!![]});var _0x359308=_0xb127('0x28');return db[_0xb127('0x29')][_0xb127('0x26')]({'where':{'type':_0x359308,'resourceId':_0x3cd555['id']}})[_0xb127('0x25')](function(){return _0x17fe20;});})['then'](function(){_0x5d2498['status'](0xcc)[_0xb127('0x19')]();});}};}function handleEntityNotFound(_0x111627,_0x76f0ba){return function(_0x2a0add){if(!_0x2a0add){_0x111627[_0xb127('0x17')](0x194);}return _0x2a0add;};}function handleError(_0x14998d,_0xc13042){_0xc13042=_0xc13042||0x1f4;return function(_0x5e13bb){logger[_0xb127('0x2a')](_0x5e13bb['stack']);if(_0x5e13bb['name']){delete _0x5e13bb[_0xb127('0x2b')];}_0x14998d[_0xb127('0x18')](_0xc13042)[_0xb127('0x2c')](_0x5e13bb);};}exports[_0xb127('0x2d')]=function(_0x2e5065,_0x61d5fd){var _0xb3821c={},_0x55f52b={},_0x270b49={'count':0x0,'rows':[]};var _0x5f23ac=_[_0xb127('0x2e')](db[_0xb127('0x2f')][_0xb127('0x30')],function(_0x3bd83){return{'name':_0x3bd83[_0xb127('0x31')],'type':_0x3bd83[_0xb127('0x32')][_0xb127('0x33')]};});_0x55f52b[_0xb127('0x34')]=_['map'](_0x5f23ac,_0xb127('0x2b'));_0x55f52b[_0xb127('0x35')]=_[_0xb127('0x36')](_0x2e5065[_0xb127('0x35')]);_0x55f52b['filters']=_[_0xb127('0x37')](_0x55f52b['model'],_0x55f52b[_0xb127('0x35')]);_0xb3821c[_0xb127('0x38')]=_[_0xb127('0x37')](_0x55f52b[_0xb127('0x34')],qs[_0xb127('0x39')](_0x2e5065['query'][_0xb127('0x39')]));_0xb3821c[_0xb127('0x38')]=_0xb3821c[_0xb127('0x38')][_0xb127('0x3a')]?_0xb3821c[_0xb127('0x38')]:_0x55f52b[_0xb127('0x34')];if(!_0x2e5065[_0xb127('0x35')][_0xb127('0x3b')](_0xb127('0x3c'))){_0xb3821c['limit']=qs[_0xb127('0x1c')](_0x2e5065[_0xb127('0x35')]['limit']);_0xb3821c[_0xb127('0x1e')]=qs[_0xb127('0x1e')](_0x2e5065[_0xb127('0x35')][_0xb127('0x1e')]);}_0xb3821c[_0xb127('0x3d')]=qs[_0xb127('0x3e')](_0x2e5065[_0xb127('0x35')]['sort']);_0xb3821c[_0xb127('0x3f')]=qs[_0xb127('0x40')](_[_0xb127('0x41')](_0x2e5065[_0xb127('0x35')],_0x55f52b['filters']),_0x5f23ac);if(_0x2e5065[_0xb127('0x35')]['filter']){_0xb3821c[_0xb127('0x3f')]=_[_0xb127('0x42')](_0xb3821c[_0xb127('0x3f')],{'$or':_['map'](_0x5f23ac,function(_0x21e3f4){if(_0x21e3f4[_0xb127('0x32')]!==_0xb127('0x43')){var _0x54db6a={};_0x54db6a[_0x21e3f4['name']]={'$like':'%'+_0x2e5065[_0xb127('0x35')]['filter']+'%'};return _0x54db6a;}})});}_0xb3821c=_[_0xb127('0x42')]({},_0xb3821c,_0x2e5065[_0xb127('0x44')]);var _0x101e8c={'where':_0xb3821c[_0xb127('0x3f')]};return db[_0xb127('0x2f')][_0xb127('0x1d')](_0x101e8c)[_0xb127('0x25')](function(_0x2b02ee){_0x270b49[_0xb127('0x1d')]=_0x2b02ee;if(_0x2e5065['query'][_0xb127('0x45')]){_0xb3821c[_0xb127('0x46')]=[{'all':!![]}];}return db['Pause'][_0xb127('0x47')](_0xb3821c);})[_0xb127('0x25')](function(_0x4b3ac7){_0x270b49[_0xb127('0x48')]=_0x4b3ac7;return _0x270b49;})[_0xb127('0x25')](respondWithFilteredResult(_0x61d5fd,_0xb3821c))[_0xb127('0x49')](handleError(_0x61d5fd,null));};exports[_0xb127('0x4a')]=function(_0xbf7214,_0x465102){var _0x2d90c3={'raw':!![],'where':{'id':_0xbf7214[_0xb127('0x4b')]['id']}},_0x42fdd0={};_0x42fdd0[_0xb127('0x34')]=_[_0xb127('0x36')](db[_0xb127('0x2f')]['rawAttributes']);_0x42fdd0[_0xb127('0x35')]=_[_0xb127('0x36')](_0xbf7214['query']);_0x42fdd0[_0xb127('0x40')]=_[_0xb127('0x37')](_0x42fdd0[_0xb127('0x34')],_0x42fdd0[_0xb127('0x35')]);_0x2d90c3[_0xb127('0x38')]=_[_0xb127('0x37')](_0x42fdd0[_0xb127('0x34')],qs[_0xb127('0x39')](_0xbf7214[_0xb127('0x35')][_0xb127('0x39')]));_0x2d90c3['attributes']=_0x2d90c3[_0xb127('0x38')]['length']?_0x2d90c3[_0xb127('0x38')]:_0x42fdd0['model'];if(_0xbf7214['query'][_0xb127('0x45')]){_0x2d90c3[_0xb127('0x46')]=[{'all':!![]}];}_0x2d90c3=_[_0xb127('0x42')]({},_0x2d90c3,_0xbf7214[_0xb127('0x44')]);return db[_0xb127('0x2f')][_0xb127('0x4c')](_0x2d90c3)[_0xb127('0x25')](handleEntityNotFound(_0x465102,null))[_0xb127('0x25')](respondWithResult(_0x465102,null))[_0xb127('0x49')](handleError(_0x465102,null));};exports[_0xb127('0x4d')]=function(_0xc53a09,_0x3e90ac){return db['Pause'][_0xb127('0x4d')](_0xc53a09['body'],{})[_0xb127('0x25')](function(_0x4ed3ce){var _0x228b94=_0xc53a09[_0xb127('0x4e')][_0xb127('0x27')]({'plain':!![]});if(!_0x228b94)throw new Error(_0xb127('0x4f'));if(_0x228b94[_0xb127('0x50')]==='user'){var _0x10b13d=_0x4ed3ce['get']({'plain':!![]});var _0x272971=_0xb127('0x28');return db['UserProfileSection'][_0xb127('0x4c')]({'where':{'name':_0x272971,'userProfileId':_0x228b94[_0xb127('0x51')]},'raw':!![]})[_0xb127('0x25')](function(_0x500486){if(_0x500486&&_0x500486[_0xb127('0x52')]===0x0){return db[_0xb127('0x29')][_0xb127('0x4d')]({'name':_0x10b13d[_0xb127('0x2b')],'resourceId':_0x10b13d['id'],'type':_0x500486[_0xb127('0x2b')],'sectionId':_0x500486['id']},{})[_0xb127('0x25')](function(){return _0x4ed3ce;});}else{return _0x4ed3ce;}})[_0xb127('0x49')](function(_0x12cf5e){logger['error'](_0xb127('0x53'),_0x12cf5e);throw _0x12cf5e;});}return _0x4ed3ce;})[_0xb127('0x25')](respondWithResult(_0x3e90ac,0xc9))[_0xb127('0x49')](handleError(_0x3e90ac,null));};exports[_0xb127('0x24')]=function(_0x433b0b,_0xda26db){if(_0x433b0b[_0xb127('0x54')]['id']){delete _0x433b0b['body']['id'];}return db[_0xb127('0x2f')][_0xb127('0x4c')]({'where':{'id':_0x433b0b['params']['id']}})['then'](handleEntityNotFound(_0xda26db,null))['then'](saveUpdates(_0x433b0b['body'],null))[_0xb127('0x25')](respondWithResult(_0xda26db,null))[_0xb127('0x49')](handleError(_0xda26db,null));};exports['destroy']=function(_0x3deb59,_0x426cc9){return db[_0xb127('0x2f')][_0xb127('0x4c')]({'where':{'id':_0x3deb59['params']['id']}})['then'](handleEntityNotFound(_0x426cc9,null))[_0xb127('0x25')](removeEntity(_0x426cc9,null))[_0xb127('0x49')](handleError(_0x426cc9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0f99d2b..ac19a97 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 _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0x55ca,0x126));var _0xa55c=function(_0x90cba6,_0x3c97d3){_0x90cba6=_0x90cba6-0x0;var _0x500b97=_0x55ca[_0x90cba6];return _0x500b97;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Pause',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x483540,_0x528036){_0x483540=_0x483540-0x0;var _0x2c8ea3=_0x8ef6[_0x483540];return _0x2c8ea3;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index bce44a1..63bea16 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3da055,_0x3738f7){var _0x38b4ac=function(_0xaa6c37){while(--_0xaa6c37){_0x3da055['push'](_0x3da055['shift']());}};_0x38b4ac(++_0x3738f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x478708,_0x816b6c){_0x478708=_0x478708-0x0;var _0x5c4bf0=_0xb10b[_0x478708];return _0x5c4bf0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x4ea78f,_0x1a2fcf){var _0x3ad3c4=function(_0x2c7f01){while(--_0x2c7f01){_0x4ea78f['push'](_0x4ea78f['shift']());}};_0x3ad3c4(++_0x1a2fcf);}(_0xb10b,0x12a));var _0xbb10=function(_0x45c569,_0x255cd0){_0x45c569=_0x45c569-0x0;var _0x1cc195=_0xb10b[_0x45c569];return _0x1cc195;};'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 4ed8a3d..d61a408 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 _0x68fc=['webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','upload','/webhook'];(function(_0x40b689,_0x3f7eab){var _0x4b3635=function(_0x313e63){while(--_0x313e63){_0x40b689['push'](_0x40b689['shift']());}};_0x4b3635(++_0x3f7eab);}(_0x68fc,0xa5));var _0xc68f=function(_0x48470f,_0x24c89d){_0x48470f=_0x48470f-0x0;var _0x5f5963=_0x68fc[_0x48470f];return _0x5f5963;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/webhook',controller[_0xc68f('0x9')]);router[_0xc68f('0x6')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x6')](_0xc68f('0xc'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xd')]);var upload=multer({'storage':multer[_0xc68f('0xe')]({'destination':function(_0x5777f9,_0x3b1a43,_0x29f1fe){_0x29f1fe(null,path[_0xc68f('0xf')](config[_0xc68f('0x10')],_0xc68f('0x11')));},'filename':function(_0x2a0a52,_0x3ccebe,_0x41aeb8){_0x3ccebe[_0xc68f('0x12')]=_0x3ccebe[_0xc68f('0x12')][_0xc68f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41aeb8(null,util['format'](_0xc68f('0x14'),path[_0xc68f('0x15')](_0x3ccebe[_0xc68f('0x12')],path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])),Date[_0xc68f('0x17')](),path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])));}})});router[_0xc68f('0x18')]('/',upload['single']('file'),controller[_0xc68f('0x19')]);router[_0xc68f('0x18')](_0xc68f('0x1a'),controller[_0xc68f('0x1b')]);router[_0xc68f('0x1c')](_0xc68f('0xa'),auth['isAuthenticated'](),controller[_0xc68f('0x1d')]);router[_0xc68f('0x1e')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0x1e')]);module[_0xc68f('0x1f')]=router; \ No newline at end of file +var _0xaba6=['get','webhookGet','isAuthenticated','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','/webhook','put','/:id','delete','multer','util','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller'];(function(_0x12ba59,_0x139b9d){var _0x147a9c=function(_0xf1804a){while(--_0xf1804a){_0x12ba59['push'](_0x12ba59['shift']());}};_0x147a9c(++_0x139b9d);}(_0xaba6,0xe2));var _0x6aba=function(_0x577169,_0x42e882){_0x577169=_0x577169-0x0;var _0x41e5fb=_0xaba6[_0x577169];return _0x41e5fb;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/webhook',controller[_0x6aba('0x7')]);router[_0x6aba('0x6')]('/:id',auth[_0x6aba('0x8')](),controller[_0x6aba('0x9')]);router['get'](_0x6aba('0xa'),auth[_0x6aba('0x8')](),controller[_0x6aba('0xb')]);var upload=multer({'storage':multer[_0x6aba('0xc')]({'destination':function(_0xdbc119,_0x4089c6,_0x181426){_0x181426(null,path['join'](config[_0x6aba('0xd')],_0x6aba('0xe')));},'filename':function(_0x43867b,_0x254007,_0x53e604){_0x254007[_0x6aba('0xf')]=_0x254007[_0x6aba('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53e604(null,util[_0x6aba('0x10')](_0x6aba('0x11'),path[_0x6aba('0x12')](_0x254007['originalname'],path[_0x6aba('0x13')](_0x254007[_0x6aba('0xf')])),Date[_0x6aba('0x14')](),path['extname'](_0x254007[_0x6aba('0xf')])));}})});router[_0x6aba('0x15')]('/',upload[_0x6aba('0x16')](_0x6aba('0x17')),controller[_0x6aba('0x18')]);router[_0x6aba('0x15')](_0x6aba('0x19'),controller['webhookPost']);router[_0x6aba('0x1a')](_0x6aba('0x1b'),auth[_0x6aba('0x8')](),controller['update']);router[_0x6aba('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x6aba('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f8abe3d..f9a1a4e 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 _0xeb2d=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','script','TEXT','BOOLEAN'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0xeb2d,0x144));var _0xdeb2=function(_0x221ae4,_0xe7c934){_0x221ae4=_0x221ae4-0x0;var _0x3ceeef=_0xeb2d[_0x221ae4];return _0x3ceeef;};'use strict';var Sequelize=require(_0xdeb2('0x0'));module[_0xdeb2('0x1')]={'name':{'type':Sequelize[_0xdeb2('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0xdeb2('0x3'))},'description':{'type':Sequelize[_0xdeb2('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xdeb2('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xdeb2('0x5')],'defaultValue':0x0,'comment':_0xdeb2('0x6')},'sidebar':{'type':Sequelize[_0xdeb2('0x7')]('adminOnly','agentOnly','always',_0xdeb2('0x8')),'defaultValue':'always','comment':_0xdeb2('0x9')},'icon':{'type':Sequelize[_0xdeb2('0x2')]},'adminUrl':{'type':Sequelize[_0xdeb2('0x2')]},'agentUrl':{'type':Sequelize[_0xdeb2('0x2')]},'scriptName':{'type':Sequelize[_0xdeb2('0x2')]},'scriptPath':{'type':Sequelize[_0xdeb2('0x2')]}}; \ No newline at end of file +var _0xc2df=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly'];(function(_0x5d91aa,_0x2e1ffd){var _0x4f54a2=function(_0x2353e9){while(--_0x2353e9){_0x5d91aa['push'](_0x5d91aa['shift']());}};_0x4f54a2(++_0x2e1ffd);}(_0xc2df,0x152));var _0xfc2d=function(_0xc48a3c,_0x2591d6){_0xc48a3c=_0xc48a3c-0x0;var _0x495703=_0xc2df[_0xc48a3c];return _0x495703;};'use strict';var Sequelize=require(_0xfc2d('0x0'));module[_0xfc2d('0x1')]={'name':{'type':Sequelize[_0xfc2d('0x2')]},'type':{'type':Sequelize['ENUM'](_0xfc2d('0x3'),_0xfc2d('0x4'))},'description':{'type':Sequelize[_0xfc2d('0x5')]},'version':{'type':Sequelize[_0xfc2d('0x5')]},'path':{'type':Sequelize[_0xfc2d('0x2')],'comment':_0xfc2d('0x6')},'active':{'type':Sequelize[_0xfc2d('0x7')],'defaultValue':0x0,'comment':_0xfc2d('0x8')},'sidebar':{'type':Sequelize[_0xfc2d('0x9')](_0xfc2d('0xa'),_0xfc2d('0xb'),'always','never'),'defaultValue':_0xfc2d('0xc'),'comment':_0xfc2d('0xd')},'icon':{'type':Sequelize[_0xfc2d('0x2')]},'adminUrl':{'type':Sequelize[_0xfc2d('0x2')]},'agentUrl':{'type':Sequelize[_0xfc2d('0x2')]},'scriptName':{'type':Sequelize[_0xfc2d('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e1b907a..d7e7578 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 _0x076e=['Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptPath','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','http://localhost:','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','Plugins','UserProfileResource','error','name','send','index','Plugin','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','catch','download','find','join','root','server/files/plugins','%s.zip','createWriteStream','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','basename'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0x076e,0x18d));var _0xe076=function(_0x2272a5,_0x12cc1d){_0x2272a5=_0x2272a5-0x0;var _0xcbc51a=_0x076e[_0x2272a5];return _0xcbc51a;};'use strict';var emlformat=require(_0xe076('0x0'));var rimraf=require(_0xe076('0x1'));var zipdir=require(_0xe076('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe076('0x3'));var BPromise=require(_0xe076('0x4'));var Mustache=require(_0xe076('0x5'));var util=require(_0xe076('0x6'));var path=require(_0xe076('0x7'));var sox=require(_0xe076('0x8'));var csv=require(_0xe076('0x9'));var ejs=require(_0xe076('0xa'));var fs=require('fs');var fs_extra=require(_0xe076('0xb'));var _=require(_0xe076('0xc'));var squel=require('squel');var crypto=require(_0xe076('0xd'));var jsforce=require(_0xe076('0xe'));var deskjs=require(_0xe076('0xf'));var toCsv=require(_0xe076('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xe076('0x1'));var archiver=require(_0xe076('0x10'));var Redis=require(_0xe076('0x11'));var authService=require(_0xe076('0x12'));var qs=require(_0xe076('0x13'));var as=require(_0xe076('0x14'));var hardwareService=require(_0xe076('0x15'));var logger=require('../../config/logger')(_0xe076('0x16'));var utils=require(_0xe076('0x17'));var config=require(_0xe076('0x18'));var licenseUtil=require(_0xe076('0x19'));var db=require(_0xe076('0x1a'))['db'];config['redis']=_[_0xe076('0x1b')](config[_0xe076('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xe076('0x1d'))(new Redis(config[_0xe076('0x1c')]));require(_0xe076('0x1e'))[_0xe076('0x1f')](socket);function respondWithStatusCode(_0x597bda,_0x574054){_0x574054=_0x574054||0xcc;return function(_0x329d6e){if(_0x329d6e){return _0x597bda[_0xe076('0x20')](_0x574054);}return _0x597bda[_0xe076('0x21')](_0x574054)[_0xe076('0x22')]();};}function respondWithResult(_0x1e0c28,_0x2c43f8){_0x2c43f8=_0x2c43f8||0xc8;return function(_0x50a42e){if(_0x50a42e){return _0x1e0c28[_0xe076('0x21')](_0x2c43f8)[_0xe076('0x23')](_0x50a42e);}};}function respondWithFilteredResult(_0x2df897,_0x31a420){return function(_0x57ec45){if(_0x57ec45){var _0x99834c=typeof _0x31a420[_0xe076('0x24')]==='undefined'&&typeof _0x31a420[_0xe076('0x25')]===_0xe076('0x26');var _0x2f2b59=_0x57ec45[_0xe076('0x27')];var _0x456641=_0x99834c?0x0:_0x31a420[_0xe076('0x24')];var _0x25ed02=_0x99834c?_0x57ec45[_0xe076('0x27')]:_0x31a420[_0xe076('0x24')]+_0x31a420[_0xe076('0x25')];var _0x48cad4;if(_0x25ed02>=_0x2f2b59){_0x25ed02=_0x2f2b59;_0x48cad4=0xc8;}else{_0x48cad4=0xce;}_0x2df897[_0xe076('0x21')](_0x48cad4);return _0x2df897['set'](_0xe076('0x28'),_0x456641+'-'+_0x25ed02+'/'+_0x2f2b59)['json'](_0x57ec45);}return null;};}function patchUpdates(_0x25f223){return function(_0x2b5476){try{jsonpatch['apply'](_0x2b5476,_0x25f223,!![]);}catch(_0x3a6218){return BPromise[_0xe076('0x29')](_0x3a6218);}return _0x2b5476['save']();};}function saveUpdates(_0x21af5a,_0x4dc9de){return function(_0xc9c529){if(_0xc9c529){return _0xc9c529[_0xe076('0x2a')](_0x21af5a)[_0xe076('0x2b')](function(_0x13af6e){return _0x13af6e;});}return null;};}function removeEntity(_0x47535e,_0x216dcd){return function(_0x412a01){if(_0x412a01){return _0x412a01[_0xe076('0x2c')]()[_0xe076('0x2b')](function(){var _0x449171=_0x412a01['get']({'plain':!![]});var _0x53ad2e=_0xe076('0x2d');return db[_0xe076('0x2e')][_0xe076('0x2c')]({'where':{'type':_0x53ad2e,'resourceId':_0x449171['id']}})[_0xe076('0x2b')](function(){return _0x412a01;});})['then'](function(){_0x47535e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc323,_0x49620b){return function(_0x2f72f7){if(!_0x2f72f7){_0x4dc323['sendStatus'](0x194);}return _0x2f72f7;};}function handleError(_0x3c9036,_0x36366b){_0x36366b=_0x36366b||0x1f4;return function(_0x551702){logger[_0xe076('0x2f')](_0x551702['stack']);if(_0x551702[_0xe076('0x30')]){delete _0x551702[_0xe076('0x30')];}_0x3c9036['status'](_0x36366b)[_0xe076('0x31')](_0x551702);};}exports[_0xe076('0x32')]=function(_0x280368,_0x150718){var _0x556d9e={},_0x451f53={},_0x1bacfa={'count':0x0,'rows':[]};var _0xf9637d=_['map'](db[_0xe076('0x33')]['rawAttributes'],function(_0x1a7b08){return{'name':_0x1a7b08[_0xe076('0x34')],'type':_0x1a7b08[_0xe076('0x35')][_0xe076('0x36')]};});_0x451f53[_0xe076('0x37')]=_[_0xe076('0x38')](_0xf9637d,_0xe076('0x30'));_0x451f53[_0xe076('0x39')]=_[_0xe076('0x3a')](_0x280368['query']);_0x451f53[_0xe076('0x3b')]=_[_0xe076('0x3c')](_0x451f53['model'],_0x451f53['query']);_0x556d9e[_0xe076('0x3d')]=_[_0xe076('0x3c')](_0x451f53[_0xe076('0x37')],qs['fields'](_0x280368[_0xe076('0x39')][_0xe076('0x3e')]));_0x556d9e[_0xe076('0x3d')]=_0x556d9e[_0xe076('0x3d')]['length']?_0x556d9e[_0xe076('0x3d')]:_0x451f53['model'];if(!_0x280368['query'][_0xe076('0x3f')](_0xe076('0x40'))){_0x556d9e[_0xe076('0x25')]=qs['limit'](_0x280368['query'][_0xe076('0x25')]);_0x556d9e[_0xe076('0x24')]=qs['offset'](_0x280368[_0xe076('0x39')][_0xe076('0x24')]);}_0x556d9e[_0xe076('0x41')]=qs[_0xe076('0x42')](_0x280368[_0xe076('0x39')][_0xe076('0x42')]);_0x556d9e[_0xe076('0x43')]=qs['filters'](_['pick'](_0x280368[_0xe076('0x39')],_0x451f53[_0xe076('0x3b')]),_0xf9637d);if(_0x280368[_0xe076('0x39')][_0xe076('0x44')]){_0x556d9e[_0xe076('0x43')]=_[_0xe076('0x45')](_0x556d9e[_0xe076('0x43')],{'$or':_[_0xe076('0x38')](_0xf9637d,function(_0x30cc09){if(_0x30cc09[_0xe076('0x35')]!=='VIRTUAL'){var _0x52720e={};_0x52720e[_0x30cc09[_0xe076('0x30')]]={'$like':'%'+_0x280368['query'][_0xe076('0x44')]+'%'};return _0x52720e;}})});}_0x556d9e=_['merge']({},_0x556d9e,_0x280368[_0xe076('0x46')]);var _0x3a490e={'where':_0x556d9e[_0xe076('0x43')]};return db[_0xe076('0x33')][_0xe076('0x27')](_0x3a490e)[_0xe076('0x2b')](function(_0x3d5a42){_0x1bacfa['count']=_0x3d5a42;if(_0x280368[_0xe076('0x39')][_0xe076('0x47')]){_0x556d9e[_0xe076('0x48')]=[{'all':!![]}];}return db[_0xe076('0x33')][_0xe076('0x49')](_0x556d9e);})['then'](function(_0x165a73){_0x1bacfa[_0xe076('0x4a')]=_0x165a73;return _0x1bacfa;})['then'](respondWithFilteredResult(_0x150718,_0x556d9e))['catch'](handleError(_0x150718,null));};exports[_0xe076('0x4b')]=function(_0x257bae,_0x4b795f){var _0x1388ab={'raw':!![],'where':{'id':_0x257bae[_0xe076('0x4c')]['id']}},_0x36802d={};_0x36802d[_0xe076('0x37')]=_['keys'](db[_0xe076('0x33')]['rawAttributes']);_0x36802d[_0xe076('0x39')]=_['keys'](_0x257bae[_0xe076('0x39')]);_0x36802d[_0xe076('0x3b')]=_[_0xe076('0x3c')](_0x36802d['model'],_0x36802d['query']);_0x1388ab[_0xe076('0x3d')]=_[_0xe076('0x3c')](_0x36802d[_0xe076('0x37')],qs['fields'](_0x257bae['query']['fields']));_0x1388ab[_0xe076('0x3d')]=_0x1388ab[_0xe076('0x3d')][_0xe076('0x4d')]?_0x1388ab[_0xe076('0x3d')]:_0x36802d[_0xe076('0x37')];if(_0x257bae['query'][_0xe076('0x47')]){_0x1388ab['include']=[{'all':!![]}];}_0x1388ab=_[_0xe076('0x45')]({},_0x1388ab,_0x257bae[_0xe076('0x46')]);return db[_0xe076('0x33')]['find'](_0x1388ab)[_0xe076('0x2b')](handleEntityNotFound(_0x4b795f,null))[_0xe076('0x2b')](respondWithResult(_0x4b795f,null))[_0xe076('0x4e')](handleError(_0x4b795f,null));};exports[_0xe076('0x4f')]=function(_0x3fa32d,_0xd1354a,_0x556266){return db['Plugin'][_0xe076('0x50')]({'where':{'id':_0x3fa32d['params']['id']},'attributes':[_0xe076('0x30'),_0xe076('0x7')],'raw':!![]})[_0xe076('0x2b')](handleEntityNotFound(_0xd1354a,null))[_0xe076('0x2b')](function(_0x4b5c59){if(_0x4b5c59){var _0x28d924=path[_0xe076('0x51')](config[_0xe076('0x52')],_0xe076('0x53'),util['format'](_0xe076('0x54'),path['basename'](_0x4b5c59['path'])));var _0x535388=fs[_0xe076('0x55')](_0x28d924);var _0x4bee6b=archiver('zip',{'zlib':{'level':0x9}});_0x4bee6b['on']('warning',function(_0x3ef574){if(_0x3ef574[_0xe076('0x56')]===_0xe076('0x57')){logger[_0xe076('0x2f')](_0x3ef574);}else{throw new db[(_0xe076('0x58'))][(_0xe076('0x59'))](_0xe076('0x5a'));}});_0x4bee6b['on'](_0xe076('0x2f'),function(_0x1f36d5){throw new db[(_0xe076('0x58'))][(_0xe076('0x59'))](_0xe076('0x5a'));});_0x4bee6b[_0xe076('0x5b')](_0x535388);_0x4bee6b[_0xe076('0x5c')](_0xe076('0x5d'),{'cwd':path[_0xe076('0x51')](config[_0xe076('0x52')],'server/files/plugins',path[_0xe076('0x5e')](_0x4b5c59[_0xe076('0x7')])),'ignore':[path[_0xe076('0x51')](path['basename'](_0x4b5c59['path']),'node_modules/**/*'),path['join'](path['basename'](_0x4b5c59[_0xe076('0x7')]),_0xe076('0x5f'))],'nodir':!![]})[_0xe076('0x60')]();_0x535388['on'](_0xe076('0x61'),function(){if(!fs['existsSync'](_0x28d924)){throw new db[(_0xe076('0x58'))][(_0xe076('0x59'))](_0xe076('0x62'));}return _0xd1354a['download'](_0x28d924,util[_0xe076('0x63')](_0xe076('0x54'),path[_0xe076('0x64')](_0x4b5c59['path'])),function(_0x33d4b9){if(_0x33d4b9){throw new db[(_0xe076('0x58'))][(_0xe076('0x59'))](_0xe076('0x65'));}fs[_0xe076('0x66')](_0x28d924);logger[_0xe076('0x67')]('Download\x20completed');logger[_0xe076('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xe076('0x4e')](handleError(_0xd1354a,null));};exports[_0xe076('0x68')]=function(_0x5a9db5,_0x451127,_0x4c6baa){var _0x47b712=path[_0xe076('0x64')](_0x5a9db5[_0xe076('0x69')][_0xe076('0x6a')],path['extname'](_0x5a9db5[_0xe076('0x69')][_0xe076('0x6a')]));var _0x72768c=path[_0xe076('0x51')](config['root'],_0xe076('0x53'),_0x5a9db5[_0xe076('0x69')][_0xe076('0x6a')]);var _0x2518a7=path[_0xe076('0x51')](config[_0xe076('0x52')],_0xe076('0x53'),_0x47b712);logger[_0xe076('0x67')](_0xe076('0x6b'),_0x72768c);logger[_0xe076('0x67')](_0xe076('0x6c'),_0x2518a7);try{fs['chmodSync'](_0x72768c,parseInt('0777',0x8));extract(_0x72768c,{'dir':_0x2518a7},function(_0x5d47eb){if(_0x5d47eb){logger['error'](_0x5d47eb);handleError(_0x5d47eb,!![]);};var _0x1fc864=fs[_0xe076('0x6d')](_0x2518a7);if(_0x1fc864['length']>0x1){removeReferences(_0x72768c,_0x2518a7);logger['error'](_0xe076('0x6e'));return _0x4c6baa(new Error(_0xe076('0x6e')));}var _0x56ff56=fs[_0xe076('0x6f')](path[_0xe076('0x51')](_0x2518a7,_0x1fc864[0x0]));if(_0x56ff56['isFile']()){removeReferences(_0x72768c,_0x2518a7);logger[_0xe076('0x2f')]('Invalid\x20plugin\x20structure');return _0x4c6baa(new Error(_0xe076('0x6e')));}if(_0x56ff56[_0xe076('0x70')]()){var _0x471c32=fs[_0xe076('0x6d')](path['join'](_0x2518a7,_0x1fc864[0x0]));if(_0x471c32[_0xe076('0x4d')]===0x0){removeReferences(_0x72768c,_0x2518a7);logger[_0xe076('0x2f')](_0xe076('0x6e'));return _0x4c6baa(new Error(_0xe076('0x6e')));}var _0x25a763=_0x471c32[_0xe076('0x71')](function(_0x3ac897){return _0x3ac897===_0xe076('0x72');});if(!_0x25a763){return _0x4c6baa(new Error(_0xe076('0x73')));}var _0x51b4c6=fs[_0xe076('0x74')](path[_0xe076('0x51')](_0x2518a7,_0x1fc864[0x0],'manifest.json'));var _0x297f05=JSON['parse'](_0x51b4c6);if(_0xe076('0x26')==typeof _0x297f05[_0xe076('0x30')]){return _0x4c6baa(new Error(_0xe076('0x75')));}if(_0xe076('0x26')==typeof _0x297f05[_0xe076('0x35')]){return _0x4c6baa(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xe076('0x26')==typeof _0x297f05[_0xe076('0x76')]){return _0x4c6baa(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xe076('0x26')==typeof _0x297f05[_0xe076('0x77')]){return _0x4c6baa(new Error(_0xe076('0x78')));}if(_0x297f05[_0xe076('0x35')]==='html'){if(_0xe076('0x26')==typeof _0x297f05['parameters'][_0xe076('0x79')]){return _0x4c6baa(new Error(_0xe076('0x7a')));}if(_0xe076('0x26')==typeof _0x297f05[_0xe076('0x77')]['views'][_0xe076('0x7b')]&&_0xe076('0x26')==typeof _0x297f05['parameters']['views'][_0xe076('0x7c')]){return _0x4c6baa(new Error(_0xe076('0x7d')));}}else if(_0x297f05[_0xe076('0x35')]===_0xe076('0x7e')){if('undefined'==typeof _0x297f05[_0xe076('0x77')][_0xe076('0x7f')]){return _0x4c6baa(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xe076('0x26')==typeof _0x297f05[_0xe076('0x77')]['scriptPath']){return _0x4c6baa(new Error(_0xe076('0x80')));}}else{return _0x4c6baa(new Error(_0xe076('0x81')));}var _0x2783d0=_0x297f05[_0xe076('0x30')];var _0x1f53c0=_0x297f05['description'];var _0x2e5bc5=_0x297f05[_0xe076('0x35')];var _0x382b3d=_0x297f05[_0xe076('0x82')]?_0x297f05[_0xe076('0x82')]:'always';var _0x480c71=_0x297f05[_0xe076('0x83')]?_0x297f05['icon']:_0xe076('0x84');var _0x134def='';var _0x393458='';var _0x2a695d='';var _0x385312='';var _0x1719c3=_0x297f05[_0xe076('0x76')];if(_0x2e5bc5==='html'){if(_0xe076('0x26')!=typeof _0x297f05['parameters'][_0xe076('0x79')][_0xe076('0x7b')]){var _0x499f20=_0x297f05[_0xe076('0x77')]['views'][_0xe076('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xe076('0x85')](_0x499f20)){_0x134def=path['join'](_0xe076('0x86'),_0x47b712,_0x1fc864[0x0],_0x499f20);}else{_0x134def=_0x499f20;}}else{logger[_0xe076('0x67')](_0xe076('0x87'));}if(_0xe076('0x26')!=typeof _0x297f05[_0xe076('0x77')][_0xe076('0x79')][_0xe076('0x7c')]){var _0x4c53ab=_0x297f05[_0xe076('0x77')][_0xe076('0x79')][_0xe076('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xe076('0x85')](_0x4c53ab)){_0x393458=path['join'](_0xe076('0x86'),_0x47b712,_0x1fc864[0x0],_0x4c53ab);}else{_0x393458=_0x4c53ab;}}else{logger[_0xe076('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2e5bc5===_0xe076('0x7e')){_0x2a695d=_0x297f05[_0xe076('0x77')][_0xe076('0x7f')];_0x385312=_0x297f05['parameters'][_0xe076('0x88')];if('undefined'!=typeof _0x297f05[_0xe076('0x77')][_0xe076('0x79')]){if(_0xe076('0x26')!=typeof _0x297f05[_0xe076('0x77')]['views'][_0xe076('0x7b')]){var _0x499f20=_0x297f05['parameters'][_0xe076('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xe076('0x85')](_0x499f20)){_0x134def=path[_0xe076('0x51')](_0xe076('0x86'),_0x47b712,_0x1fc864[0x0],_0x499f20);}else{_0x134def=_0x499f20;}}if(_0xe076('0x26')!=typeof _0x297f05[_0xe076('0x77')][_0xe076('0x79')][_0xe076('0x7c')]){var _0x4c53ab=_0x297f05[_0xe076('0x77')][_0xe076('0x79')][_0xe076('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xe076('0x85')](_0x4c53ab)){_0x393458=path[_0xe076('0x51')](_0xe076('0x86'),_0x47b712,_0x1fc864[0x0],_0x4c53ab);}else{_0x393458=_0x4c53ab;}}}}var _0x2a4d5c={'name':_0x2783d0,'description':_0x1f53c0,'path':path[_0xe076('0x51')](_0x47b712,_0x1fc864[0x0]),'type':_0x2e5bc5,'sidebar':_0x382b3d,'icon':_0x480c71,'adminUrl':_0x134def,'agentUrl':_0x393458,'scriptName':_0x2a695d,'scriptPath':_0x385312,'version':_0x1719c3};removeReferences(_0x72768c,null);return db[_0xe076('0x33')][_0xe076('0x89')](_0x2a4d5c)[_0xe076('0x2b')](function(_0x40309a){var _0x3d6e80={'role':_0x5a9db5[_0xe076('0x8a')]['role'],'userProfileId':_0x5a9db5[_0xe076('0x8a')]['userProfileId']};if(!_0x3d6e80)throw new Error(_0xe076('0x8b'));if(_0x3d6e80['role']===_0xe076('0x8c')){var _0x196c05=_0x40309a[_0xe076('0x8d')]({'plain':!![]});return db[_0xe076('0x8e')][_0xe076('0x50')]({'where':{'name':_0xe076('0x2d'),'userProfileId':_0x3d6e80[_0xe076('0x8f')]},'raw':!![]})[_0xe076('0x2b')](function(_0x36baab){if(_0x36baab&&_0x36baab[_0xe076('0x90')]===0x0){return db[_0xe076('0x2e')][_0xe076('0x89')]({'name':_0x196c05['name'],'resourceId':_0x196c05['id'],'type':_0x36baab['name'],'sectionId':_0x36baab['id']},{})[_0xe076('0x2b')](function(){return _0x40309a;});}else{return _0x40309a;}})[_0xe076('0x4e')](function(_0x5c7209){logger[_0xe076('0x2f')](_0xe076('0x91'),_0x5c7209);throw _0x5c7209;});}return _0x40309a;})[_0xe076('0x2b')](respondWithResult(_0x451127,null))[_0xe076('0x4e')](handleError(_0x451127,null));}});}catch(_0x6400c5){_0x451127['status'](0x1f4)[_0xe076('0x31')](_0x6400c5);}};function removeReferences(_0x29723f,_0x2097f9){try{if(_0x29723f){fs[_0xe076('0x66')](_0x29723f);logger['info'](_0xe076('0x92'));}if(_0x2097f9){rimraf(_0x2097f9,function(){});logger[_0xe076('0x67')](_0xe076('0x93'));}}catch(_0xd1582b){logger['error'](_0xd1582b);}}exports[_0xe076('0x2a')]=function(_0x30fbbb,_0x5a5db3,_0x2e1c38){return db[_0xe076('0x33')][_0xe076('0x50')]({'where':{'id':_0x30fbbb['params']['id']}})[_0xe076('0x2b')](handleEntityNotFound(_0x5a5db3,null))[_0xe076('0x2b')](saveUpdates(_0x30fbbb[_0xe076('0x8a')],null))[_0xe076('0x2b')](respondWithResult(_0x5a5db3,null))[_0xe076('0x4e')](handleError(_0x5a5db3,null));};exports[_0xe076('0x94')]=function(_0x322de9,_0x378147,_0x5de8a0){return db[_0xe076('0x33')]['find']({'where':{'id':_0x322de9['params']['id']}})[_0xe076('0x2b')](function(_0x6e48f2){if(_0x6e48f2){return _0x6e48f2['destroy']();}})[_0xe076('0x2b')](function(_0x3f8624){rimraf(path[_0xe076('0x51')](config[_0xe076('0x52')],_0xe076('0x53'),path[_0xe076('0x5e')](_0x3f8624[_0xe076('0x7')])),function(){});return _0x3f8624;})['then'](handleEntityNotFound(_0x378147,null))[_0xe076('0x2b')](respondWithStatusCode(_0x378147,null))[_0xe076('0x4e')](handleError(_0x378147,null));};exports[_0xe076('0x95')]=function(_0x57ff6d,_0x3295b3,_0x14209a){return BPromise[_0xe076('0x96')]()[_0xe076('0x2b')](function(){if(!_0x57ff6d['query'][_0xe076('0x7')]){throw new Error(_0xe076('0x97'));}if(!_0x57ff6d['query'][_0xe076('0x98')]){throw new Error(_0xe076('0x99'));}var _0x32de8d=_0x57ff6d[_0xe076('0x39')][_0xe076('0x9a')]?_0x57ff6d['query'][_0xe076('0x9a')]+':'+_0x57ff6d['query'][_0xe076('0x98')]:'http://localhost:'+_0x57ff6d[_0xe076('0x39')]['port'];var _0x1257ac=_0x57ff6d[_0xe076('0x39')]['json']?_0x57ff6d[_0xe076('0x39')]['json']:!![];var _0x34bd49=_0x57ff6d[_0xe076('0x39')][_0xe076('0x9b')]?_0x57ff6d[_0xe076('0x39')][_0xe076('0x9b')]:null;var _0x111175={'method':_0x57ff6d[_0xe076('0x9c')],'uri':util[_0xe076('0x63')](_0xe076('0x9d'),_0x32de8d,_0x57ff6d[_0xe076('0x39')]['path']),'json':_0x1257ac,'resolveWithFullResponse':!![],'encoding':_0x34bd49,'qs':_0x57ff6d[_0xe076('0x39')]};if(_0x57ff6d[_0xe076('0x9e')]){_0x111175[_0xe076('0x9e')]=_0x57ff6d[_0xe076('0x9e')];if(_0x111175[_0xe076('0x9e')][_0xe076('0x9f')]){delete _0x111175[_0xe076('0x9e')]['content-length'];}}if(_0x111175[_0xe076('0x9e')]['content-type']){delete _0x111175['headers'][_0xe076('0xa0')];}return rp(_0x111175);})['then'](function(_0x31d548){if(_0x31d548){_0x3295b3[_0xe076('0xa1')](_0x31d548['headers']);logger[_0xe076('0x67')](_0x31d548[_0xe076('0x8a')]);if(_[_0xe076('0xa2')](_0x57ff6d[_0xe076('0x39')]['path'],_0xe076('0x4f'))&&_0x31d548[_0xe076('0xa3')]==0x1f4){return _0x3295b3[_0xe076('0x20')](_0x31d548[_0xe076('0xa3')]);}else{return _0x3295b3['status'](_0x31d548[_0xe076('0xa3')])[_0xe076('0x31')](_0x31d548[_0xe076('0x8a')]);}}else{return _0x3295b3[_0xe076('0x20')](0xc8);}})[_0xe076('0x4e')](handleError(_0x3295b3,null));};exports[_0xe076('0xa4')]=function(_0x3cb47c,_0x374e22,_0x4ba660){return BPromise['resolve']()['then'](function(){if(!_0x3cb47c[_0xe076('0x39')]['path']){throw new Error(_0xe076('0x97'));}if(!_0x3cb47c[_0xe076('0x39')][_0xe076('0x98')]){throw new Error(_0xe076('0x99'));}var _0x44ce7b=_0x3cb47c[_0xe076('0x39')]['hostname']?_0x3cb47c[_0xe076('0x39')][_0xe076('0x9a')]+':'+_0x3cb47c[_0xe076('0x39')]['port']:_0xe076('0xa5')+_0x3cb47c[_0xe076('0x39')][_0xe076('0x98')];var _0x4f9212=_0x3cb47c[_0xe076('0x39')]['json']?_0x3cb47c[_0xe076('0x39')]['json']:!![];var _0x4009f1=_0x3cb47c[_0xe076('0x39')][_0xe076('0x9b')]?_0x3cb47c[_0xe076('0x39')][_0xe076('0x9b')]:null;var _0x3ef3d2={'method':_0x3cb47c[_0xe076('0x9c')],'uri':util['format']('%s%s',_0x44ce7b,_0x3cb47c[_0xe076('0x39')]['path']),'json':_0x4f9212,'resolveWithFullResponse':!![],'encoding':_0x4009f1,'body':_0x3cb47c[_0xe076('0x8a')]};if(_0x3cb47c[_0xe076('0x9e')]){_0x3ef3d2[_0xe076('0x9e')]=_0x3cb47c[_0xe076('0x9e')];if(_0x3ef3d2[_0xe076('0x9e')][_0xe076('0x9f')]){delete _0x3ef3d2[_0xe076('0x9e')][_0xe076('0x9f')];}}if(_0x3ef3d2[_0xe076('0x9e')]['content-type']){delete _0x3ef3d2[_0xe076('0x9e')]['content-type'];}return rp(_0x3ef3d2);})[_0xe076('0x2b')](function(_0x4305cb){if(_0x4305cb){_0x374e22[_0xe076('0xa1')](_0x4305cb[_0xe076('0x9e')]);logger[_0xe076('0x67')](_0x4305cb[_0xe076('0x8a')]);return _0x374e22[_0xe076('0x21')](_0x4305cb['statusCode'])['send'](_0x4305cb['body']);}else{return _0x374e22[_0xe076('0x20')](0xc8);}})[_0xe076('0x4e')](handleError(_0x374e22,null));}; \ No newline at end of file +var _0x26a0=['offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','index','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','Plugin','rawAttributes','find','download','params','path','server/files/plugins','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','pipe','glob','**/*','join','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','html','admin','test','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','encoding','%s%s','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','status','end','json'];(function(_0x565836,_0xd9d455){var _0x5eb222=function(_0xc8d4d3){while(--_0xc8d4d3){_0x565836['push'](_0x565836['shift']());}};_0x5eb222(++_0xd9d455);}(_0x26a0,0x12d));var _0x026a=function(_0x175255,_0x35b47f){_0x175255=_0x175255-0x0;var _0x1b14d1=_0x26a0[_0x175255];return _0x1b14d1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x026a('0x0'));var rp=require(_0x026a('0x1'));var moment=require(_0x026a('0x2'));var BPromise=require(_0x026a('0x3'));var Mustache=require('mustache');var util=require(_0x026a('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x026a('0x5'));var ejs=require(_0x026a('0x6'));var fs=require('fs');var fs_extra=require(_0x026a('0x7'));var _=require(_0x026a('0x8'));var squel=require(_0x026a('0x9'));var crypto=require('crypto');var jsforce=require(_0x026a('0xa'));var deskjs=require(_0x026a('0xb'));var toCsv=require(_0x026a('0x5'));var querystring=require('querystring');var Papa=require(_0x026a('0xc'));var extract=require(_0x026a('0xd'));var rimraf=require(_0x026a('0xe'));var archiver=require(_0x026a('0xf'));var Redis=require(_0x026a('0x10'));var authService=require(_0x026a('0x11'));var qs=require(_0x026a('0x12'));var as=require(_0x026a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x026a('0x14'))(_0x026a('0x15'));var utils=require(_0x026a('0x16'));var config=require(_0x026a('0x17'));var licenseUtil=require(_0x026a('0x18'));var db=require(_0x026a('0x19'))['db'];config[_0x026a('0x1a')]=_['defaults'](config[_0x026a('0x1a')],{'host':_0x026a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x026a('0x1a')]));require(_0x026a('0x1c'))['register'](socket);function respondWithStatusCode(_0x21f7dd,_0x45824f){_0x45824f=_0x45824f||0xcc;return function(_0x4b2fa3){if(_0x4b2fa3){return _0x21f7dd[_0x026a('0x1d')](_0x45824f);}return _0x21f7dd[_0x026a('0x1e')](_0x45824f)[_0x026a('0x1f')]();};}function respondWithResult(_0x2c7c6c,_0x1a267a){_0x1a267a=_0x1a267a||0xc8;return function(_0x69359e){if(_0x69359e){return _0x2c7c6c['status'](_0x1a267a)[_0x026a('0x20')](_0x69359e);}};}function respondWithFilteredResult(_0x455f2b,_0x280909){return function(_0x93bc7e){if(_0x93bc7e){var _0x149a44=typeof _0x280909[_0x026a('0x21')]===_0x026a('0x22')&&typeof _0x280909[_0x026a('0x23')]===_0x026a('0x22');var _0x1557f9=_0x93bc7e[_0x026a('0x24')];var _0x2d7c95=_0x149a44?0x0:_0x280909[_0x026a('0x21')];var _0x40a897=_0x149a44?_0x93bc7e['count']:_0x280909[_0x026a('0x21')]+_0x280909[_0x026a('0x23')];var _0x157f67;if(_0x40a897>=_0x1557f9){_0x40a897=_0x1557f9;_0x157f67=0xc8;}else{_0x157f67=0xce;}_0x455f2b[_0x026a('0x1e')](_0x157f67);return _0x455f2b[_0x026a('0x25')](_0x026a('0x26'),_0x2d7c95+'-'+_0x40a897+'/'+_0x1557f9)[_0x026a('0x20')](_0x93bc7e);}return null;};}function patchUpdates(_0x39c81e){return function(_0x3fcd42){try{jsonpatch['apply'](_0x3fcd42,_0x39c81e,!![]);}catch(_0x147e45){return BPromise[_0x026a('0x27')](_0x147e45);}return _0x3fcd42['save']();};}function saveUpdates(_0x1201c2,_0x1e1fc5){return function(_0x5b93f5){if(_0x5b93f5){return _0x5b93f5[_0x026a('0x28')](_0x1201c2)[_0x026a('0x29')](function(_0x5c6d1f){return _0x5c6d1f;});}return null;};}function removeEntity(_0x28fe89,_0x56b0c2){return function(_0x442692){if(_0x442692){return _0x442692[_0x026a('0x2a')]()[_0x026a('0x29')](function(){var _0x38decc=_0x442692[_0x026a('0x2b')]({'plain':!![]});var _0x16d89c=_0x026a('0x2c');return db[_0x026a('0x2d')]['destroy']({'where':{'type':_0x16d89c,'resourceId':_0x38decc['id']}})[_0x026a('0x29')](function(){return _0x442692;});})['then'](function(){_0x28fe89[_0x026a('0x1e')](0xcc)[_0x026a('0x1f')]();});}};}function handleEntityNotFound(_0x4f4907,_0x1a90e7){return function(_0xe2c43a){if(!_0xe2c43a){_0x4f4907[_0x026a('0x1d')](0x194);}return _0xe2c43a;};}function handleError(_0x2df6b8,_0x44fe4d){_0x44fe4d=_0x44fe4d||0x1f4;return function(_0xbce60){logger[_0x026a('0x2e')](_0xbce60[_0x026a('0x2f')]);if(_0xbce60['name']){delete _0xbce60[_0x026a('0x30')];}_0x2df6b8[_0x026a('0x1e')](_0x44fe4d)['send'](_0xbce60);};}exports[_0x026a('0x31')]=function(_0x5c57be,_0x644f8b){var _0x433f29={},_0xb5a421={},_0x3f3f4f={'count':0x0,'rows':[]};var _0x3603dd=_['map'](db['Plugin']['rawAttributes'],function(_0x421992){return{'name':_0x421992[_0x026a('0x32')],'type':_0x421992[_0x026a('0x33')]['key']};});_0xb5a421[_0x026a('0x34')]=_['map'](_0x3603dd,_0x026a('0x30'));_0xb5a421[_0x026a('0x35')]=_['keys'](_0x5c57be['query']);_0xb5a421['filters']=_['intersection'](_0xb5a421[_0x026a('0x34')],_0xb5a421[_0x026a('0x35')]);_0x433f29['attributes']=_[_0x026a('0x36')](_0xb5a421['model'],qs[_0x026a('0x37')](_0x5c57be[_0x026a('0x35')]['fields']));_0x433f29[_0x026a('0x38')]=_0x433f29['attributes'][_0x026a('0x39')]?_0x433f29[_0x026a('0x38')]:_0xb5a421[_0x026a('0x34')];if(!_0x5c57be[_0x026a('0x35')][_0x026a('0x3a')](_0x026a('0x3b'))){_0x433f29['limit']=qs[_0x026a('0x23')](_0x5c57be[_0x026a('0x35')][_0x026a('0x23')]);_0x433f29[_0x026a('0x21')]=qs['offset'](_0x5c57be['query'][_0x026a('0x21')]);}_0x433f29[_0x026a('0x3c')]=qs[_0x026a('0x3d')](_0x5c57be[_0x026a('0x35')]['sort']);_0x433f29[_0x026a('0x3e')]=qs[_0x026a('0x3f')](_[_0x026a('0x40')](_0x5c57be['query'],_0xb5a421[_0x026a('0x3f')]),_0x3603dd);if(_0x5c57be[_0x026a('0x35')]['filter']){_0x433f29['where']=_[_0x026a('0x41')](_0x433f29['where'],{'$or':_[_0x026a('0x42')](_0x3603dd,function(_0x427b6a){if(_0x427b6a['type']!==_0x026a('0x43')){var _0x300636={};_0x300636[_0x427b6a[_0x026a('0x30')]]={'$like':'%'+_0x5c57be[_0x026a('0x35')][_0x026a('0x44')]+'%'};return _0x300636;}})});}_0x433f29=_[_0x026a('0x41')]({},_0x433f29,_0x5c57be[_0x026a('0x45')]);var _0x58a46c={'where':_0x433f29['where']};return db['Plugin']['count'](_0x58a46c)[_0x026a('0x29')](function(_0x19a5b9){_0x3f3f4f[_0x026a('0x24')]=_0x19a5b9;if(_0x5c57be[_0x026a('0x35')][_0x026a('0x46')]){_0x433f29[_0x026a('0x47')]=[{'all':!![]}];}return db['Plugin'][_0x026a('0x48')](_0x433f29);})[_0x026a('0x29')](function(_0x42360d){_0x3f3f4f[_0x026a('0x49')]=_0x42360d;return _0x3f3f4f;})[_0x026a('0x29')](respondWithFilteredResult(_0x644f8b,_0x433f29))[_0x026a('0x4a')](handleError(_0x644f8b,null));};exports['show']=function(_0x43806a,_0x38a377){var _0x1ee615={'raw':!![],'where':{'id':_0x43806a['params']['id']}},_0xb0ee2c={};_0xb0ee2c[_0x026a('0x34')]=_[_0x026a('0x4b')](db[_0x026a('0x4c')][_0x026a('0x4d')]);_0xb0ee2c[_0x026a('0x35')]=_[_0x026a('0x4b')](_0x43806a[_0x026a('0x35')]);_0xb0ee2c[_0x026a('0x3f')]=_['intersection'](_0xb0ee2c[_0x026a('0x34')],_0xb0ee2c[_0x026a('0x35')]);_0x1ee615[_0x026a('0x38')]=_[_0x026a('0x36')](_0xb0ee2c[_0x026a('0x34')],qs[_0x026a('0x37')](_0x43806a[_0x026a('0x35')]['fields']));_0x1ee615['attributes']=_0x1ee615['attributes'][_0x026a('0x39')]?_0x1ee615[_0x026a('0x38')]:_0xb0ee2c[_0x026a('0x34')];if(_0x43806a[_0x026a('0x35')][_0x026a('0x46')]){_0x1ee615['include']=[{'all':!![]}];}_0x1ee615=_['merge']({},_0x1ee615,_0x43806a[_0x026a('0x45')]);return db[_0x026a('0x4c')][_0x026a('0x4e')](_0x1ee615)[_0x026a('0x29')](handleEntityNotFound(_0x38a377,null))[_0x026a('0x29')](respondWithResult(_0x38a377,null))[_0x026a('0x4a')](handleError(_0x38a377,null));};exports[_0x026a('0x4f')]=function(_0x3d9241,_0x4f4f6f,_0x341920){return db[_0x026a('0x4c')]['find']({'where':{'id':_0x3d9241[_0x026a('0x50')]['id']},'attributes':[_0x026a('0x30'),_0x026a('0x51')],'raw':!![]})[_0x026a('0x29')](handleEntityNotFound(_0x4f4f6f,null))[_0x026a('0x29')](function(_0x1678bb){if(_0x1678bb){var _0x3f4bc4=path['join'](config['root'],_0x026a('0x52'),util['format']('%s.zip',path[_0x026a('0x53')](_0x1678bb[_0x026a('0x51')])));var _0x35f0ae=fs[_0x026a('0x54')](_0x3f4bc4);var _0xcdaa85=archiver(_0x026a('0x55'),{'zlib':{'level':0x9}});_0xcdaa85['on'](_0x026a('0x56'),function(_0x2d0724){if(_0x2d0724[_0x026a('0x57')]===_0x026a('0x58')){logger[_0x026a('0x2e')](_0x2d0724);}else{throw new db[(_0x026a('0x59'))][(_0x026a('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xcdaa85['on']('error',function(_0x475d39){throw new db['Sequelize'][(_0x026a('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xcdaa85[_0x026a('0x5b')](_0x35f0ae);_0xcdaa85[_0x026a('0x5c')](_0x026a('0x5d'),{'cwd':path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),path[_0x026a('0x60')](_0x1678bb[_0x026a('0x51')])),'ignore':[path[_0x026a('0x5e')](path[_0x026a('0x53')](_0x1678bb[_0x026a('0x51')]),_0x026a('0x61')),path[_0x026a('0x5e')](path[_0x026a('0x53')](_0x1678bb[_0x026a('0x51')]),_0x026a('0x62'))],'nodir':!![]})[_0x026a('0x63')]();_0x35f0ae['on'](_0x026a('0x64'),function(){if(!fs['existsSync'](_0x3f4bc4)){throw new db[(_0x026a('0x59'))]['Error'](_0x026a('0x65'));}return _0x4f4f6f[_0x026a('0x4f')](_0x3f4bc4,util[_0x026a('0x66')]('%s.zip',path['basename'](_0x1678bb[_0x026a('0x51')])),function(_0x372fed){if(_0x372fed){throw new db[(_0x026a('0x59'))][(_0x026a('0x5a'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x026a('0x67')](_0x3f4bc4);logger[_0x026a('0x68')](_0x026a('0x69'));logger[_0x026a('0x68')](_0x026a('0x6a'));});});}return null;})[_0x026a('0x4a')](handleError(_0x4f4f6f,null));};exports['upload']=function(_0xf825dc,_0x307292,_0x53e8f3){var _0x40b608=path[_0x026a('0x53')](_0xf825dc[_0x026a('0x6b')]['filename'],path[_0x026a('0x6c')](_0xf825dc[_0x026a('0x6b')][_0x026a('0x6d')]));var _0x550070=path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),_0xf825dc[_0x026a('0x6b')]['filename']);var _0x49c6bd=path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),_0x40b608);logger[_0x026a('0x68')](_0x026a('0x6e'),_0x550070);logger['info'](_0x026a('0x6f'),_0x49c6bd);try{fs['chmodSync'](_0x550070,parseInt('0777',0x8));extract(_0x550070,{'dir':_0x49c6bd},function(_0x240e57){if(_0x240e57){logger[_0x026a('0x2e')](_0x240e57);handleError(_0x240e57,!![]);};var _0x3f6177=fs['readdirSync'](_0x49c6bd);if(_0x3f6177[_0x026a('0x39')]>0x1){removeReferences(_0x550070,_0x49c6bd);logger['error'](_0x026a('0x70'));return _0x53e8f3(new Error(_0x026a('0x70')));}var _0x3df19d=fs['lstatSync'](path[_0x026a('0x5e')](_0x49c6bd,_0x3f6177[0x0]));if(_0x3df19d['isFile']()){removeReferences(_0x550070,_0x49c6bd);logger[_0x026a('0x2e')](_0x026a('0x70'));return _0x53e8f3(new Error(_0x026a('0x70')));}if(_0x3df19d[_0x026a('0x71')]()){var _0x2f0b92=fs[_0x026a('0x72')](path[_0x026a('0x5e')](_0x49c6bd,_0x3f6177[0x0]));if(_0x2f0b92[_0x026a('0x39')]===0x0){removeReferences(_0x550070,_0x49c6bd);logger['error'](_0x026a('0x70'));return _0x53e8f3(new Error(_0x026a('0x70')));}var _0x8c38f1=_0x2f0b92[_0x026a('0x73')](function(_0x175979){return _0x175979===_0x026a('0x74');});if(!_0x8c38f1){return _0x53e8f3(new Error(_0x026a('0x75')));}var _0x2cf5fe=fs[_0x026a('0x76')](path['join'](_0x49c6bd,_0x3f6177[0x0],_0x026a('0x74')));var _0xb5d8d7=JSON[_0x026a('0x77')](_0x2cf5fe);if('undefined'==typeof _0xb5d8d7[_0x026a('0x30')]){return _0x53e8f3(new Error(_0x026a('0x78')));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x33')]){return _0x53e8f3(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x79')]){return _0x53e8f3(new Error(_0x026a('0x7a')));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')]){return _0x53e8f3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0xb5d8d7['type']==='html'){if('undefined'==typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')]){return _0x53e8f3(new Error(_0x026a('0x7d')));}if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')]['admin']&&_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')]['views'][_0x026a('0x7e')]){return _0x53e8f3(new Error(_0x026a('0x7f')));}}else if(_0xb5d8d7[_0x026a('0x33')]===_0x026a('0x80')){if(_0x026a('0x22')==typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x81')]){return _0x53e8f3(new Error(_0x026a('0x82')));}if('undefined'==typeof _0xb5d8d7['parameters'][_0x026a('0x83')]){return _0x53e8f3(new Error(_0x026a('0x84')));}}else{return _0x53e8f3(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xa7c8c5=_0xb5d8d7[_0x026a('0x30')];var _0x66d98=_0xb5d8d7[_0x026a('0x85')];var _0x4ba972=_0xb5d8d7[_0x026a('0x33')];var _0xa8ef5c=_0xb5d8d7[_0x026a('0x86')]?_0xb5d8d7[_0x026a('0x86')]:_0x026a('0x87');var _0xeb0753=_0xb5d8d7[_0x026a('0x88')]?_0xb5d8d7[_0x026a('0x88')]:'icon-apps';var _0x49829c='';var _0xe4ebd3='';var _0x5a47bc='';var _0x209281='';var _0x4d85fe=_0xb5d8d7[_0x026a('0x79')];if(_0x4ba972===_0x026a('0x89')){if(_0x026a('0x22')!=typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x8a')]){var _0x616c3=_0xb5d8d7['parameters'][_0x026a('0x7c')][_0x026a('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x026a('0x8b')](_0x616c3)){_0x49829c=path[_0x026a('0x5e')](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x616c3);}else{_0x49829c=_0x616c3;}}else{logger[_0x026a('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x026a('0x22')!=typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x7e')]){var _0x1cbca7=_0xb5d8d7['parameters'][_0x026a('0x7c')][_0x026a('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x026a('0x8b')](_0x1cbca7)){_0xe4ebd3=path[_0x026a('0x5e')](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x1cbca7);}else{_0xe4ebd3=_0x1cbca7;}}else{logger[_0x026a('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4ba972===_0x026a('0x80')){_0x5a47bc=_0xb5d8d7['parameters']['scriptName'];_0x209281=_0xb5d8d7['parameters'][_0x026a('0x83')];if(_0x026a('0x22')!=typeof _0xb5d8d7['parameters']['views']){if(_0x026a('0x22')!=typeof _0xb5d8d7['parameters'][_0x026a('0x7c')][_0x026a('0x8a')]){var _0x616c3=_0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x616c3)){_0x49829c=path['join'](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x616c3);}else{_0x49829c=_0x616c3;}}if(_0x026a('0x22')!=typeof _0xb5d8d7[_0x026a('0x7b')][_0x026a('0x7c')][_0x026a('0x7e')]){var _0x1cbca7=_0xb5d8d7['parameters']['views'][_0x026a('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1cbca7)){_0xe4ebd3=path[_0x026a('0x5e')](_0x026a('0x8c'),_0x40b608,_0x3f6177[0x0],_0x1cbca7);}else{_0xe4ebd3=_0x1cbca7;}}}}var _0x36b803={'name':_0xa7c8c5,'description':_0x66d98,'path':path[_0x026a('0x5e')](_0x40b608,_0x3f6177[0x0]),'type':_0x4ba972,'sidebar':_0xa8ef5c,'icon':_0xeb0753,'adminUrl':_0x49829c,'agentUrl':_0xe4ebd3,'scriptName':_0x5a47bc,'scriptPath':_0x209281,'version':_0x4d85fe};removeReferences(_0x550070,null);return db[_0x026a('0x4c')][_0x026a('0x8d')](_0x36b803)[_0x026a('0x29')](function(_0x4a25ab){var _0xa2c358={'role':_0xf825dc[_0x026a('0x8e')][_0x026a('0x8f')],'userProfileId':_0xf825dc[_0x026a('0x8e')][_0x026a('0x90')]};if(!_0xa2c358)throw new Error(_0x026a('0x91'));if(_0xa2c358[_0x026a('0x8f')]===_0x026a('0x92')){var _0x156d5e=_0x4a25ab[_0x026a('0x2b')]({'plain':!![]});return db[_0x026a('0x93')]['find']({'where':{'name':_0x026a('0x2c'),'userProfileId':_0xa2c358[_0x026a('0x90')]},'raw':!![]})['then'](function(_0x4183cd){if(_0x4183cd&&_0x4183cd[_0x026a('0x94')]===0x0){return db[_0x026a('0x2d')]['create']({'name':_0x156d5e[_0x026a('0x30')],'resourceId':_0x156d5e['id'],'type':_0x4183cd[_0x026a('0x30')],'sectionId':_0x4183cd['id']},{})[_0x026a('0x29')](function(){return _0x4a25ab;});}else{return _0x4a25ab;}})[_0x026a('0x4a')](function(_0x21c489){logger[_0x026a('0x2e')](_0x026a('0x95'),_0x21c489);throw _0x21c489;});}return _0x4a25ab;})[_0x026a('0x29')](respondWithResult(_0x307292,null))[_0x026a('0x4a')](handleError(_0x307292,null));}});}catch(_0x2f91a8){_0x307292[_0x026a('0x1e')](0x1f4)[_0x026a('0x96')](_0x2f91a8);}};function removeReferences(_0x222aac,_0x5008c3){try{if(_0x222aac){fs[_0x026a('0x67')](_0x222aac);logger['info'](_0x026a('0x97'));}if(_0x5008c3){rimraf(_0x5008c3,function(){});logger[_0x026a('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x1b45a5){logger[_0x026a('0x2e')](_0x1b45a5);}}exports[_0x026a('0x28')]=function(_0x23a03f,_0x2804eb,_0x5f5c5d){return db[_0x026a('0x4c')]['find']({'where':{'id':_0x23a03f[_0x026a('0x50')]['id']}})['then'](handleEntityNotFound(_0x2804eb,null))[_0x026a('0x29')](saveUpdates(_0x23a03f[_0x026a('0x8e')],null))['then'](respondWithResult(_0x2804eb,null))[_0x026a('0x4a')](handleError(_0x2804eb,null));};exports['delete']=function(_0x2c107f,_0x8a21e3,_0x3b59c9){return db[_0x026a('0x4c')]['find']({'where':{'id':_0x2c107f[_0x026a('0x50')]['id']}})[_0x026a('0x29')](function(_0x39a848){if(_0x39a848){return _0x39a848[_0x026a('0x2a')]();}})[_0x026a('0x29')](function(_0x1dc370){rimraf(path[_0x026a('0x5e')](config[_0x026a('0x5f')],_0x026a('0x52'),path[_0x026a('0x60')](_0x1dc370[_0x026a('0x51')])),function(){});return _0x1dc370;})[_0x026a('0x29')](handleEntityNotFound(_0x8a21e3,null))[_0x026a('0x29')](respondWithStatusCode(_0x8a21e3,null))[_0x026a('0x4a')](handleError(_0x8a21e3,null));};exports[_0x026a('0x98')]=function(_0x69425a,_0x412df5,_0x34dfa1){return BPromise['resolve']()[_0x026a('0x29')](function(){if(!_0x69425a['query'][_0x026a('0x51')]){throw new Error(_0x026a('0x99'));}if(!_0x69425a['query'][_0x026a('0x9a')]){throw new Error(_0x026a('0x9b'));}var _0x140305=_0x69425a['query'][_0x026a('0x9c')]?_0x69425a[_0x026a('0x35')][_0x026a('0x9c')]+':'+_0x69425a[_0x026a('0x35')][_0x026a('0x9a')]:_0x026a('0x9d')+_0x69425a['query']['port'];var _0x284602=_0x69425a[_0x026a('0x35')][_0x026a('0x20')]?_0x69425a[_0x026a('0x35')][_0x026a('0x20')]:!![];var _0x382e10=_0x69425a[_0x026a('0x35')]['encoding']?_0x69425a[_0x026a('0x35')]['encoding']:null;var _0x4daa68={'method':_0x69425a['method'],'uri':util[_0x026a('0x66')]('%s%s',_0x140305,_0x69425a[_0x026a('0x35')][_0x026a('0x51')]),'json':_0x284602,'resolveWithFullResponse':!![],'encoding':_0x382e10,'qs':_0x69425a[_0x026a('0x35')]};if(_0x69425a[_0x026a('0x9e')]){_0x4daa68[_0x026a('0x9e')]=_0x69425a[_0x026a('0x9e')];if(_0x4daa68[_0x026a('0x9e')]['content-length']){delete _0x4daa68[_0x026a('0x9e')][_0x026a('0x9f')];}}if(_0x4daa68['headers'][_0x026a('0xa0')]){delete _0x4daa68[_0x026a('0x9e')]['content-type'];}return rp(_0x4daa68);})['then'](function(_0x3822d2){if(_0x3822d2){_0x412df5[_0x026a('0x25')](_0x3822d2[_0x026a('0x9e')]);logger[_0x026a('0x68')](_0x3822d2['body']);if(_[_0x026a('0xa1')](_0x69425a[_0x026a('0x35')]['path'],'download')&&_0x3822d2['statusCode']==0x1f4){return _0x412df5[_0x026a('0x1d')](_0x3822d2['statusCode']);}else{return _0x412df5[_0x026a('0x1e')](_0x3822d2[_0x026a('0xa2')])[_0x026a('0x96')](_0x3822d2[_0x026a('0x8e')]);}}else{return _0x412df5[_0x026a('0x1d')](0xc8);}})[_0x026a('0x4a')](handleError(_0x412df5,null));};exports[_0x026a('0xa3')]=function(_0x4ece18,_0x992ceb,_0x54c133){return BPromise[_0x026a('0xa4')]()['then'](function(){if(!_0x4ece18['query'][_0x026a('0x51')]){throw new Error(_0x026a('0x99'));}if(!_0x4ece18['query']['port']){throw new Error(_0x026a('0x9b'));}var _0x2a1385=_0x4ece18[_0x026a('0x35')][_0x026a('0x9c')]?_0x4ece18[_0x026a('0x35')][_0x026a('0x9c')]+':'+_0x4ece18['query']['port']:_0x026a('0x9d')+_0x4ece18['query'][_0x026a('0x9a')];var _0x39f576=_0x4ece18[_0x026a('0x35')][_0x026a('0x20')]?_0x4ece18['query'][_0x026a('0x20')]:!![];var _0x429749=_0x4ece18['query'][_0x026a('0xa5')]?_0x4ece18[_0x026a('0x35')][_0x026a('0xa5')]:null;var _0x3c2fa6={'method':_0x4ece18['method'],'uri':util[_0x026a('0x66')](_0x026a('0xa6'),_0x2a1385,_0x4ece18[_0x026a('0x35')][_0x026a('0x51')]),'json':_0x39f576,'resolveWithFullResponse':!![],'encoding':_0x429749,'body':_0x4ece18[_0x026a('0x8e')]};if(_0x4ece18['headers']){_0x3c2fa6[_0x026a('0x9e')]=_0x4ece18[_0x026a('0x9e')];if(_0x3c2fa6[_0x026a('0x9e')][_0x026a('0x9f')]){delete _0x3c2fa6[_0x026a('0x9e')][_0x026a('0x9f')];}}if(_0x3c2fa6[_0x026a('0x9e')][_0x026a('0xa0')]){delete _0x3c2fa6[_0x026a('0x9e')][_0x026a('0xa0')];}return rp(_0x3c2fa6);})[_0x026a('0x29')](function(_0x3e25a6){if(_0x3e25a6){_0x992ceb[_0x026a('0x25')](_0x3e25a6['headers']);logger[_0x026a('0x68')](_0x3e25a6[_0x026a('0x8e')]);return _0x992ceb[_0x026a('0x1e')](_0x3e25a6['statusCode'])[_0x026a('0x96')](_0x3e25a6[_0x026a('0x8e')]);}else{return _0x992ceb['sendStatus'](0xc8);}})['catch'](handleError(_0x992ceb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6752e78..8f4625a 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 _0x41ec=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x26544d,_0x27b22b){var _0x3bcc11=function(_0x32a4a0){while(--_0x32a4a0){_0x26544d['push'](_0x26544d['shift']());}};_0x3bcc11(++_0x27b22b);}(_0x41ec,0x143));var _0xc41e=function(_0x3bc362,_0x3bc766){_0x3bc362=_0x3bc362-0x0;var _0x1aa3a4=_0x41ec[_0x3bc362];return _0x1aa3a4;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc41e('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xc41e('0x1')](0x0);var events={'afterCreate':_0xc41e('0x2'),'afterUpdate':'update','afterDestroy':_0xc41e('0x3')};function emitEvent(_0x19ed31){return function(_0xd3f764,_0xf79325,_0xaa14e8){PluginEvents[_0xc41e('0x4')](_0x19ed31+':'+_0xd3f764['id'],_0xd3f764);PluginEvents[_0xc41e('0x4')](_0x19ed31,_0xd3f764);_0xaa14e8(null);};}for(var e in events){if(events[_0xc41e('0x5')](e)){var event=events[e];Plugin[_0xc41e('0x6')](e,emitEvent(event));}}module[_0xc41e('0x7')]=PluginEvents; \ No newline at end of file +var _0xd991=['Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x137cd7,_0x28f679){var _0x9ca7cd=function(_0x37bb60){while(--_0x37bb60){_0x137cd7['push'](_0x137cd7['shift']());}};_0x9ca7cd(++_0x28f679);}(_0xd991,0x115));var _0x1d99=function(_0x5e9122,_0x27e2b1){_0x5e9122=_0x5e9122-0x0;var _0x1e6e4b=_0xd991[_0x5e9122];return _0x1e6e4b;};'use strict';var EventEmitter=require(_0x1d99('0x0'));var Plugin=require(_0x1d99('0x1'))['db'][_0x1d99('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1d99('0x3')](0x0);var events={'afterCreate':_0x1d99('0x4'),'afterUpdate':'update','afterDestroy':_0x1d99('0x5')};function emitEvent(_0xe9aefb){return function(_0xf03459,_0x1f6da3,_0x300c32){PluginEvents[_0x1d99('0x6')](_0xe9aefb+':'+_0xf03459['id'],_0xf03459);PluginEvents['emit'](_0xe9aefb,_0xf03459);_0x300c32(null);};}for(var e in events){if(events[_0x1d99('0x7')](e)){var event=events[e];Plugin[_0x1d99('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 91efc3c..f6a569f 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 _0xa781=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','Plugin','plugins','lodash','util'];(function(_0x288466,_0x4d690c){var _0x441b4f=function(_0x116bdd){while(--_0x116bdd){_0x288466['push'](_0x288466['shift']());}};_0x441b4f(++_0x4d690c);}(_0xa781,0x82));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a78('0x0'));var util=require(_0x1a78('0x1'));var logger=require(_0x1a78('0x2'))(_0x1a78('0x3'));var moment=require(_0x1a78('0x4'));var BPromise=require(_0x1a78('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a78('0x6'));var rimraf=require(_0x1a78('0x7'));var config=require(_0x1a78('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0x236949,_0x50a74c){return _0x236949[_0x1a78('0x9')](_0x1a78('0xa'),attributes,{'tableName':_0x1a78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3322=['api','moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x553a22,_0x447fef){var _0x4edf22=function(_0x8b63e2){while(--_0x8b63e2){_0x553a22['push'](_0x553a22['shift']());}};_0x4edf22(++_0x447fef);}(_0x3322,0x1d9));var _0x2332=function(_0x2c5e5d,_0x3d231b){_0x2c5e5d=_0x2c5e5d-0x0;var _0x15d693=_0x3322[_0x2c5e5d];return _0x15d693;};'use strict';var _=require(_0x2332('0x0'));var util=require(_0x2332('0x1'));var logger=require(_0x2332('0x2'))(_0x2332('0x3'));var moment=require(_0x2332('0x4'));var BPromise=require(_0x2332('0x5'));var rp=require(_0x2332('0x6'));var fs=require('fs');var path=require(_0x2332('0x7'));var rimraf=require('rimraf');var config=require(_0x2332('0x8'));var attributes=require(_0x2332('0x9'));module[_0x2332('0xa')]=function(_0x4d49c0,_0x5b4e33){return _0x4d49c0[_0x2332('0xb')](_0x2332('0xc'),attributes,{'tableName':_0x2332('0xd'),'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 ba28c6f..009fa7e 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 _0x883e=['create','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','Plugin'];(function(_0x26b9d4,_0xfa61eb){var _0x4c770b=function(_0x5e9276){while(--_0x5e9276){_0x26b9d4['push'](_0x26b9d4['shift']());}};_0x4c770b(++_0xfa61eb);}(_0x883e,0xd0));var _0xe883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe883('0x0'));var util=require(_0xe883('0x1'));var moment=require(_0xe883('0x2'));var BPromise=require('bluebird');var rs=require(_0xe883('0x3'));var fs=require('fs');var Redis=require(_0xe883('0x4'));var db=require(_0xe883('0x5'))['db'];var utils=require(_0xe883('0x6'));var logger=require(_0xe883('0x7'))('rpc');var config=require(_0xe883('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe883('0x9')][_0xe883('0xa')]({'port':0x232a});config[_0xe883('0xb')]=_[_0xe883('0xc')](config[_0xe883('0xb')],{'host':_0xe883('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe883('0xb')]));require(_0xe883('0xe'))[_0xe883('0xf')](socket);function respondWithRpcPromise(_0x46282e,_0x38ff61,_0x353a0d){return new BPromise(function(_0x263dfc,_0x40dd24){return client[_0xe883('0x10')](_0x46282e,_0x353a0d)[_0xe883('0x11')](function(_0x5be4f5){logger[_0xe883('0x12')](_0xe883('0x13'),_0x38ff61,_0xe883('0x14'));logger[_0xe883('0x15')](_0xe883('0x16'),_0x38ff61,_0xe883('0x14'),JSON[_0xe883('0x17')](_0x5be4f5));if(_0x5be4f5[_0xe883('0x18')]){if(_0x5be4f5[_0xe883('0x18')][_0xe883('0x19')]===0x1f4){logger[_0xe883('0x18')](_0xe883('0x13'),_0x38ff61,_0x5be4f5['error'][_0xe883('0x1a')]);return _0x40dd24(_0x5be4f5[_0xe883('0x18')][_0xe883('0x1a')]);}logger[_0xe883('0x18')]('Plugin,\x20%s,\x20%s',_0x38ff61,_0x5be4f5[_0xe883('0x18')]['message']);return _0x263dfc(_0x5be4f5[_0xe883('0x18')][_0xe883('0x1a')]);}else{logger[_0xe883('0x12')](_0xe883('0x13'),_0x38ff61,_0xe883('0x14'));_0x263dfc(_0x5be4f5[_0xe883('0x1b')][_0xe883('0x1a')]);}})['catch'](function(_0x203400){logger[_0xe883('0x18')](_0xe883('0x13'),_0x38ff61,_0x203400);_0x40dd24(_0x203400);});});}exports[_0xe883('0x1c')]=function(_0x1a59b2){var _0x5f0189=this;return new Promise(function(_0x212e52,_0x23181c){return db[_0xe883('0x1d')][_0xe883('0x1e')](_0x1a59b2['body'],{'raw':_0x1a59b2['options']?_0x1a59b2[_0xe883('0x1f')][_0xe883('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x58a8a4){logger['info'](_0xe883('0x1c'),_0x1a59b2);logger[_0xe883('0x15')](_0xe883('0x1c'),_0x1a59b2,JSON[_0xe883('0x17')](_0x58a8a4));_0x212e52(_0x58a8a4);})[_0xe883('0x21')](function(_0x9dbff4){logger[_0xe883('0x18')](_0xe883('0x1c'),_0x9dbff4[_0xe883('0x1a')],_0x1a59b2);_0x23181c(_0x5f0189[_0xe883('0x18')](0x1f4,_0x9dbff4[_0xe883('0x1a')]));});});}; \ No newline at end of file +var _0x5e65=['stringify','error','message','CreatePlugin','Plugin','create','options','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5e65,0xcf));var _0x55e6=function(_0x924a2b,_0x477c10){_0x924a2b=_0x924a2b-0x0;var _0x3d701d=_0x5e65[_0x924a2b];return _0x3d701d;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var moment=require('moment');var BPromise=require(_0x55e6('0x2'));var rs=require(_0x55e6('0x3'));var fs=require('fs');var Redis=require(_0x55e6('0x4'));var db=require(_0x55e6('0x5'))['db'];var utils=require(_0x55e6('0x6'));var logger=require(_0x55e6('0x7'))(_0x55e6('0x8'));var config=require(_0x55e6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x55e6('0xa')][_0x55e6('0xb')]({'port':0x232a});config[_0x55e6('0xc')]=_[_0x55e6('0xd')](config[_0x55e6('0xc')],{'host':_0x55e6('0xe'),'port':0x18eb});var socket=require(_0x55e6('0xf'))(new Redis(config[_0x55e6('0xc')]));require(_0x55e6('0x10'))[_0x55e6('0x11')](socket);function respondWithRpcPromise(_0x23aac9,_0x421158,_0x1c3f87){return new BPromise(function(_0x5dc167,_0x3121b5){return client[_0x55e6('0x12')](_0x23aac9,_0x1c3f87)['then'](function(_0x2ef71c){logger[_0x55e6('0x13')](_0x55e6('0x14'),_0x421158,_0x55e6('0x15'));logger[_0x55e6('0x16')](_0x55e6('0x17'),_0x421158,'request\x20sent',JSON[_0x55e6('0x18')](_0x2ef71c));if(_0x2ef71c[_0x55e6('0x19')]){if(_0x2ef71c['error']['code']===0x1f4){logger['error'](_0x55e6('0x14'),_0x421158,_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);return _0x3121b5(_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);}logger['error'](_0x55e6('0x14'),_0x421158,_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);return _0x5dc167(_0x2ef71c[_0x55e6('0x19')][_0x55e6('0x1a')]);}else{logger[_0x55e6('0x13')](_0x55e6('0x14'),_0x421158,_0x55e6('0x15'));_0x5dc167(_0x2ef71c['result'][_0x55e6('0x1a')]);}})['catch'](function(_0xcbb2ab){logger[_0x55e6('0x19')](_0x55e6('0x14'),_0x421158,_0xcbb2ab);_0x3121b5(_0xcbb2ab);});});}exports[_0x55e6('0x1b')]=function(_0x58e5f7){var _0x1dd16d=this;return new Promise(function(_0x4fc98e,_0x35966c){return db[_0x55e6('0x1c')][_0x55e6('0x1d')](_0x58e5f7['body'],{'raw':_0x58e5f7[_0x55e6('0x1e')]?_0x58e5f7[_0x55e6('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x55e6('0x1f')](function(_0x4ffffb){logger[_0x55e6('0x13')](_0x55e6('0x1b'),_0x58e5f7);logger[_0x55e6('0x16')](_0x55e6('0x1b'),_0x58e5f7,JSON[_0x55e6('0x18')](_0x4ffffb));_0x4fc98e(_0x4ffffb);})[_0x55e6('0x20')](function(_0x1e49df){logger[_0x55e6('0x19')](_0x55e6('0x1b'),_0x1e49df[_0x55e6('0x1a')],_0x58e5f7);_0x35966c(_0x1dd16d[_0x55e6('0x19')](0x1f4,_0x1e49df[_0x55e6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index aae52b7..bb9960b 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 _0xdb0f=['./plugin.events','remove','update','emit','register','plugin:'];(function(_0x2a7cf7,_0xba4722){var _0x538fde=function(_0xfec396){while(--_0xfec396){_0x2a7cf7['push'](_0x2a7cf7['shift']());}};_0x538fde(++_0xba4722);}(_0xdb0f,0x198));var _0xfdb0=function(_0x59766f,_0x4a3b4b){_0x59766f=_0x59766f-0x0;var _0x279836=_0xdb0f[_0x59766f];return _0x279836;};'use strict';var PluginEvents=require(_0xfdb0('0x0'));var events=['save',_0xfdb0('0x1'),_0xfdb0('0x2')];function createListener(_0xd8a365,_0x195ee0){return function(_0x27da57){_0x195ee0[_0xfdb0('0x3')](_0xd8a365,_0x27da57);};}function removeListener(_0x5ea863,_0x5ed98c){return function(){PluginEvents['removeListener'](_0x5ea863,_0x5ed98c);};}exports[_0xfdb0('0x4')]=function(_0x5a7d03){for(var _0x4176e3=0x0,_0x2d0576=events['length'];_0x4176e3<_0x2d0576;_0x4176e3++){var _0x5cd37d=events[_0x4176e3];var _0x15649e=createListener(_0xfdb0('0x5')+_0x5cd37d,_0x5a7d03);PluginEvents['on'](_0x5cd37d,_0x15649e);}}; \ No newline at end of file +var _0xc5e6=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x392f26,_0x4a7fa5){var _0x27d0cf=function(_0xec9923){while(--_0xec9923){_0x392f26['push'](_0x392f26['shift']());}};_0x27d0cf(++_0x4a7fa5);}(_0xc5e6,0x165));var _0x6c5e=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xc5e6[_0x101e7b];return _0x4995c0;};'use strict';var PluginEvents=require(_0x6c5e('0x0'));var events=[_0x6c5e('0x1'),_0x6c5e('0x2'),'update'];function createListener(_0xd9e6d2,_0x4032de){return function(_0x41bbff){_0x4032de[_0x6c5e('0x3')](_0xd9e6d2,_0x41bbff);};}function removeListener(_0x4d9bf8,_0xdb0e08){return function(){PluginEvents[_0x6c5e('0x4')](_0x4d9bf8,_0xdb0e08);};}exports[_0x6c5e('0x5')]=function(_0x43b5d4){for(var _0x17959c=0x0,_0x4371a1=events[_0x6c5e('0x6')];_0x17959c<_0x4371a1;_0x17959c++){var _0x50d8e8=events[_0x17959c];var _0x31297d=createListener(_0x6c5e('0x7')+_0x50d8e8,_0x43b5d4);PluginEvents['on'](_0x50d8e8,_0x31297d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 98ba1fa..666a4e7 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(_0x310458,_0x4804be){var _0x4bfea9=function(_0x42b681){while(--_0x42b681){_0x310458['push'](_0x310458['shift']());}};_0x4bfea9(++_0x4804be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x19360a,_0x124f84){var _0x164092=function(_0x526b64){while(--_0x526b64){_0x19360a['push'](_0x19360a['shift']());}};_0x164092(++_0x124f84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 11a0f1d..ef661ab 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 _0xe5b5=['../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','then','reject','motion2','length','show','describe','catch','body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x2f180f,_0x9f30bd){var _0x49b585=function(_0x45f941){while(--_0x45f941){_0x2f180f['push'](_0x2f180f['shift']());}};_0x49b585(++_0x9f30bd);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0xe5b5[_0x2af160];return _0x439d67;};'use strict';var _=require(_0x5e5b('0x0'));var pm2=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var path=require(_0x5e5b('0x4'));var exec=require(_0x5e5b('0x5'))[_0x5e5b('0x6')];var BPromise=require(_0x5e5b('0x7'));function handleEntityNotFound(_0xf20c6a,_0x20a50c){return function(_0xdc6616){if(!_0xdc6616){_0xf20c6a[_0x5e5b('0x8')](0x194);;}return _0xdc6616;};}function respondWithResult(_0xf1fbe2,_0x11e0e0){_0x11e0e0=_0x11e0e0||0xc8;return function(_0x545eb3){if(_0x545eb3){return _0xf1fbe2[_0x5e5b('0x9')](_0x11e0e0)[_0x5e5b('0xa')](_0x545eb3);}return null;};}function handleError(_0xcbd478,_0x258414){_0x258414=_0x258414||0x1f4;return function(_0xb9d72b){logger[_0x5e5b('0xb')](_0xb9d72b[_0x5e5b('0xc')]);if(_0xb9d72b[_0x5e5b('0xd')]){delete _0xb9d72b['name'];}_0xcbd478[_0x5e5b('0x9')](_0x258414)['send'](_0xb9d72b);};}function execChildProcess(){return new BPromise(function(_0x108c34,_0x58185){exec(_0x5e5b('0xe'),function(_0x3f64b6,_0x55c974,_0x4a1424){logger['info'](_0x55c974);logger[_0x5e5b('0xf')](_0x4a1424);if(_0x3f64b6){logger[_0x5e5b('0xb')](_0x3f64b6);return _0x58185(_0x3f64b6);}return _0x108c34(_0x55c974);});});}exports[_0x5e5b('0x10')]=function(_0x1694ff,_0x13a01e){return pm2[_0x5e5b('0x11')]()[_0x5e5b('0x12')](function(_0x49edd0){if(_0x49edd0){var _0x2b37fa=_[_0x5e5b('0x13')](_0x49edd0,function(_0x4ff37b){return _0x4ff37b[_0x5e5b('0xd')]==='express'||_0x4ff37b['name']===_0x5e5b('0x14');});return{'rows':_0x2b37fa,'count':_0x2b37fa[_0x5e5b('0x15')]};}return null;})[_0x5e5b('0x12')](respondWithResult(_0x13a01e,null))['catch'](handleError(_0x13a01e,null));};exports[_0x5e5b('0x16')]=function(_0x4d490c,_0x1796af){return pm2[_0x5e5b('0x17')](_0x4d490c['params']['id'])[_0x5e5b('0x12')](respondWithResult(_0x1796af,null))[_0x5e5b('0x12')](handleEntityNotFound(_0x1796af,null))[_0x5e5b('0x18')](handleError(_0x1796af,null));};exports['create']=function(_0x2bf0b7,_0x3f1103){if(_0x2bf0b7['body'][_0x5e5b('0xd')]&&_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]){var _0x2d8252=path[_0x5e5b('0x1b')](__dirname,_0x5e5b('0x1c'),_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]);var _0x4a78e3=process['cwd']();process[_0x5e5b('0x1d')](path[_0x5e5b('0x1e')](_0x2d8252));return execChildProcess()[_0x5e5b('0x12')](function(_0xe1c268){process[_0x5e5b('0x1d')](_0x4a78e3);return pm2[_0x5e5b('0x1f')]({'name':_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0xd')],'script':_0x2d8252});})[_0x5e5b('0x12')](function(_0x26bc02){pm2[_0x5e5b('0x20')]();return _0x26bc02[0x0];})['then'](respondWithResult(_0x3f1103,0xc9))[_0x5e5b('0x18')](handleError(_0x3f1103,null));}else{return _0x3f1103[_0x5e5b('0x9')](0x1f4)[_0x5e5b('0x21')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5e5b('0x22')]=function(_0xdb2863,_0x5ee866){if(_0xdb2863[_0x5e5b('0x19')]['id']){delete _0xdb2863[_0x5e5b('0x19')]['id'];}var _0x39ce16={'online':_0x5e5b('0x23'),'stopped':_0x5e5b('0x24')};if(_0x39ce16[_0x5e5b('0x25')](_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')])){return pm2[_0x39ce16[_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')]]](_0xdb2863[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](respondWithResult(_0x5ee866,0xc8))['catch'](handleError(_0x5ee866,null));}else{return _0x5ee866['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x27')});}};exports[_0x5e5b('0x28')]=function(_0x3dcdab,_0x12f1ee){if(_0x3dcdab['body']['id']){delete _0x3dcdab[_0x5e5b('0x19')]['id'];}if(_0x3dcdab['params']['id']){return pm2[_0x5e5b('0x29')](_0x3dcdab[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](function(_0xc2bc09){pm2['dump']();return _0xc2bc09[0x0];})[_0x5e5b('0x12')](respondWithResult(_0x12f1ee,null))[_0x5e5b('0x18')](handleError(_0x12f1ee,null));}else{return _0x12f1ee['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x2a')});}}; \ No newline at end of file +var _0x524a=['sendStatus','json','error','stack','name','send','list','express','motion2','length','then','show','describe','params','catch','body','join','../../files/plugins','script','chdir','dirname','start','status','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird'];(function(_0x44bfff,_0x54d6b4){var _0xbefe3d=function(_0x19799f){while(--_0x19799f){_0x44bfff['push'](_0x44bfff['shift']());}};_0xbefe3d(++_0x54d6b4);}(_0x524a,0xf5));var _0xa524=function(_0x57518d,_0xdc27db){_0x57518d=_0x57518d-0x0;var _0x5f1550=_0x524a[_0x57518d];return _0x5f1550;};'use strict';var _=require(_0xa524('0x0'));var pm2=require(_0xa524('0x1'));var logger=require(_0xa524('0x2'))(_0xa524('0x3'));var path=require('path');var exec=require(_0xa524('0x4'))[_0xa524('0x5')];var BPromise=require(_0xa524('0x6'));function handleEntityNotFound(_0x56ab08,_0x50ec75){return function(_0x34a665){if(!_0x34a665){_0x56ab08[_0xa524('0x7')](0x194);;}return _0x34a665;};}function respondWithResult(_0x16227b,_0x5f472f){_0x5f472f=_0x5f472f||0xc8;return function(_0x460738){if(_0x460738){return _0x16227b['status'](_0x5f472f)[_0xa524('0x8')](_0x460738);}return null;};}function handleError(_0x11aa98,_0x56849e){_0x56849e=_0x56849e||0x1f4;return function(_0x1316b0){logger[_0xa524('0x9')](_0x1316b0[_0xa524('0xa')]);if(_0x1316b0[_0xa524('0xb')]){delete _0x1316b0[_0xa524('0xb')];}_0x11aa98['status'](_0x56849e)[_0xa524('0xc')](_0x1316b0);};}function execChildProcess(){return new BPromise(function(_0x2ebea2,_0x59660a){exec('npm\x20install',function(_0x2fc0f9,_0xdbba15,_0x116fb9){logger['info'](_0xdbba15);logger['info'](_0x116fb9);if(_0x2fc0f9){logger[_0xa524('0x9')](_0x2fc0f9);return _0x59660a(_0x2fc0f9);}return _0x2ebea2(_0xdbba15);});});}exports['index']=function(_0x3f4ffc,_0x494cff){return pm2[_0xa524('0xd')]()['then'](function(_0x75bfe8){if(_0x75bfe8){var _0x281137=_['reject'](_0x75bfe8,function(_0x2d8bdb){return _0x2d8bdb[_0xa524('0xb')]===_0xa524('0xe')||_0x2d8bdb[_0xa524('0xb')]===_0xa524('0xf');});return{'rows':_0x281137,'count':_0x281137[_0xa524('0x10')]};}return null;})[_0xa524('0x11')](respondWithResult(_0x494cff,null))['catch'](handleError(_0x494cff,null));};exports[_0xa524('0x12')]=function(_0x3d8494,_0x1fd8f5){return pm2[_0xa524('0x13')](_0x3d8494[_0xa524('0x14')]['id'])[_0xa524('0x11')](respondWithResult(_0x1fd8f5,null))[_0xa524('0x11')](handleEntityNotFound(_0x1fd8f5,null))[_0xa524('0x15')](handleError(_0x1fd8f5,null));};exports['create']=function(_0x304dea,_0x20f8e1){if(_0x304dea[_0xa524('0x16')][_0xa524('0xb')]&&_0x304dea['body']['script']){var _0x40f4bd=path[_0xa524('0x17')](__dirname,_0xa524('0x18'),_0x304dea[_0xa524('0x16')][_0xa524('0x19')]);var _0x3866e2=process['cwd']();process[_0xa524('0x1a')](path[_0xa524('0x1b')](_0x40f4bd));return execChildProcess()[_0xa524('0x11')](function(_0x40fb4b){process[_0xa524('0x1a')](_0x3866e2);return pm2[_0xa524('0x1c')]({'name':_0x304dea[_0xa524('0x16')]['name'],'script':_0x40f4bd});})[_0xa524('0x11')](function(_0x221bf){pm2['dump']();return _0x221bf[0x0];})['then'](respondWithResult(_0x20f8e1,0xc9))[_0xa524('0x15')](handleError(_0x20f8e1,null));}else{return _0x20f8e1[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':_0xa524('0x1e')});}};exports[_0xa524('0x1f')]=function(_0x546060,_0x4f484a){if(_0x546060[_0xa524('0x16')]['id']){delete _0x546060[_0xa524('0x16')]['id'];}var _0x1582fa={'online':_0xa524('0x20'),'stopped':'stop'};if(_0x1582fa[_0xa524('0x21')](_0x546060[_0xa524('0x16')]['status'])){return pm2[_0x1582fa[_0x546060[_0xa524('0x16')][_0xa524('0x1d')]]](_0x546060['params']['id'])[_0xa524('0x11')](respondWithResult(_0x4f484a,0xc8))['catch'](handleError(_0x4f484a,null));}else{return _0x4f484a[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':_0xa524('0x22')});}};exports[_0xa524('0x23')]=function(_0x136e83,_0x1c706b){if(_0x136e83[_0xa524('0x16')]['id']){delete _0x136e83[_0xa524('0x16')]['id'];}if(_0x136e83[_0xa524('0x14')]['id']){return pm2['delete'](_0x136e83['params']['id'])[_0xa524('0x11')](function(_0x52dd9f){pm2['dump']();return _0x52dd9f[0x0];})[_0xa524('0x11')](respondWithResult(_0x1c706b,null))[_0xa524('0x15')](handleError(_0x1c706b,null));}else{return _0x1c706b[_0xa524('0x1d')](0x1f4)[_0xa524('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 693551b..70038d9 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 _0xcf23=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports'];(function(_0x37b117,_0x6a1e8c){var _0x526a0d=function(_0x317389){while(--_0x317389){_0x37b117['push'](_0x37b117['shift']());}};_0x526a0d(++_0x6a1e8c);}(_0xcf23,0xf2));var _0x3cf2=function(_0x90637e,_0x37dc5e){_0x90637e=_0x90637e-0x0;var _0x28b1e7=_0xcf23[_0x90637e];return _0x28b1e7;};'use strict';var express=require(_0x3cf2('0x0'));var router=express[_0x3cf2('0x1')]();var auth=require(_0x3cf2('0x2'));var controller=require(_0x3cf2('0x3'));router[_0x3cf2('0x4')](_0x3cf2('0x5'),auth[_0x3cf2('0x6')](),controller[_0x3cf2('0x7')]);router[_0x3cf2('0x4')](_0x3cf2('0x8'),auth[_0x3cf2('0x6')](),controller[_0x3cf2('0x9')]);module[_0x3cf2('0xa')]=router; \ No newline at end of file +var _0x0f4f=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x0f4f,0xc0));var _0xf0f4=function(_0x4b79da,_0xe5f318){_0x4b79da=_0x4b79da-0x0;var _0x1d221b=_0x0f4f[_0x4b79da];return _0x1d221b;};'use strict';var express=require(_0xf0f4('0x0'));var router=express[_0xf0f4('0x1')]();var auth=require(_0xf0f4('0x2'));var controller=require(_0xf0f4('0x3'));router[_0xf0f4('0x4')](_0xf0f4('0x5'),auth[_0xf0f4('0x6')](),controller[_0xf0f4('0x7')]);router[_0xf0f4('0x4')]('/queues',auth[_0xf0f4('0x6')](),controller[_0xf0f4('0x8')]);module[_0xf0f4('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 78b0705..82f85cc 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 _0x5fab=['pause','every','faxStatus','mailStatus','whatsappStatus','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','internal','address','mailPause','faxPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','smsPause','resolve','fieldName','type','role','agent','query','getOptions','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','sms','openchannel','fax','channel','includes','toLowerCase','rawAttributes','key','QueueCampaigns','all','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','send','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','map','get','agents','busy','pick','filter','queue','toString','find','UserId','accountcode','online','voiceStatus','User','Queue','QueueId','length','loggedInDb','idle','unknown','unavailable','ringing','isNil','chatPause','openchannelPause','voicePause','whatsappPause'];(function(_0x507126,_0x3dd5c3){var _0x5ca642=function(_0x3e56c9){while(--_0x3e56c9){_0x507126['push'](_0x507126['shift']());}};_0x5ca642(++_0x3dd5c3);}(_0x5fab,0x177));var _0xb5fa=function(_0x4c6a7f,_0x452cf6){_0x4c6a7f=_0x4c6a7f-0x0;var _0x1a5474=_0x5fab[_0x4c6a7f];return _0x1a5474;};'use strict';var util=require(_0xb5fa('0x0'));var _=require(_0xb5fa('0x1'));var jayson=require('jayson/promise');var qs=require(_0xb5fa('0x2'));var logger=require(_0xb5fa('0x3'))(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var amiClient=jayson[_0xb5fa('0x6')][_0xb5fa('0x7')]({'port':0x232a});var routingClient=jayson[_0xb5fa('0x6')][_0xb5fa('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x10361d,_0x44df89){return function(_0x4a0249){if(_0x4a0249){var _0x5d70f6=typeof _0x44df89[_0xb5fa('0x8')]===_0xb5fa('0x9')&&typeof _0x44df89[_0xb5fa('0xa')]==='undefined';var _0x410eff=_0x4a0249[_0xb5fa('0xb')];var _0x2cf4a5=_0x5d70f6?0x0:_0x44df89['offset'];var _0x5b5ea8=_0x5d70f6?_0x4a0249[_0xb5fa('0xb')]:_0x44df89[_0xb5fa('0x8')]+_0x44df89[_0xb5fa('0xa')];var _0x44e6c8;if(_0x5b5ea8>=_0x410eff){_0x5b5ea8=_0x410eff;_0x44e6c8=0xc8;}else{_0x44e6c8=0xce;}_0x10361d[_0xb5fa('0xc')](_0x44e6c8);return _0x10361d[_0xb5fa('0xd')](_0xb5fa('0xe'),_0x2cf4a5+'-'+_0x5b5ea8+'/'+_0x410eff)[_0xb5fa('0xf')](_0x4a0249);}return null;};}function handleError(_0x309740,_0x4d3576){_0x4d3576=_0x4d3576||0x1f4;return function(_0x2ad830){logger[_0xb5fa('0x10')](_0x2ad830['stack']);if(_0x2ad830[_0xb5fa('0x11')]){delete _0x2ad830['name'];}_0x309740[_0xb5fa('0xc')](_0x4d3576)[_0xb5fa('0x12')](_0x2ad830);};}function getRealtimeAgents(){return new Promise(function(_0x40c914,_0xca8d82){return amiClient[_0xb5fa('0x13')]('Agents',{})['then'](function(_0x38e964){if(_0x38e964[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x14'));var _0x27c8f7=_0x38e964['result'];return routingClient['request'](_0xb5fa('0x15'),{})[_0xb5fa('0x16')](function(_0x32e9e5){if(_0x32e9e5[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x17'));var _0x13e82b=_0x32e9e5[_0xb5fa('0x18')];return _0x40c914(_[_0xb5fa('0x19')]({},_0x27c8f7,_0x13e82b));});})[_0xb5fa('0x1a')](function(_0x368cb1){_0xca8d82(_0x368cb1);});});}function getRealtimeQueues(_0x3c8d53,_0x1f5064){return new Promise(function(_0x5cd822,_0x432bfa){var _0x519e20=_0x1f5064===_0xb5fa('0x1b')?amiClient:routingClient;return _0x519e20['request'](_[_0xb5fa('0x1c')](_0x1f5064)+_0xb5fa('0x1d'),_0x3c8d53)['then'](function(_0x40dfdf){if(_0x40dfdf[_0xb5fa('0x10')])throw new Error(util[_0xb5fa('0x1e')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1f5064));return _0x5cd822(_0x40dfdf[_0xb5fa('0x18')]);})[_0xb5fa('0x1a')](function(_0x444237){_0x432bfa(_0x444237);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x542348,_0x224ec8){return amiClient['request'](_0xb5fa('0x1f'),{})[_0xb5fa('0x16')](function(_0x11053a){if(_0x11053a[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x20'));return _0x542348(_0x11053a[_0xb5fa('0x18')]);})[_0xb5fa('0x1a')](function(_0x20d649){_0x224ec8(_0x20d649);});});}function initializeQueues(_0x568870,_0x4ec294,_0x5bdf11,_0x5a1c39){var _0x28a350=[_0xb5fa('0x21'),_0xb5fa('0x22'),_0xb5fa('0x23'),_0xb5fa('0x24'),_0xb5fa('0x25')];if(_0x5bdf11===_0xb5fa('0x1b')&&_0x5a1c39===_0xb5fa('0x26')){_0x28a350[_0xb5fa('0x27')](_0xb5fa('0x28'),_0xb5fa('0x29'),_0xb5fa('0x2a'),_0xb5fa('0x2b'),_0xb5fa('0x2c'),_0xb5fa('0x2d'),_0xb5fa('0x2e'),_0xb5fa('0x2f'),_0xb5fa('0x30'),_0xb5fa('0x31'),_0xb5fa('0x32'),_0xb5fa('0x33'),_0xb5fa('0x34'),_0xb5fa('0x35'),_0xb5fa('0x36'),'predictiveIntervalAvailable',_0xb5fa('0x37'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0xb5fa('0x38'),'predictiveIntervalAvgTalktime');}return _0x568870[_0xb5fa('0x39')](function(_0x5876f1){var _0x5518b1=_0x5876f1[_0xb5fa('0x3a')]({'plain':!![]});_0x5518b1[_0xb5fa('0x3b')]=[];_0x5518b1['paused']=0x0;_0x5518b1['loggedInDb']=0x0;_0x5518b1[_0xb5fa('0x21')]=0x0;_0x5518b1[_0xb5fa('0x22')]=0x0;_0x5518b1[_0xb5fa('0x23')]=0x0;if(_0x5bdf11==='voice'){_0x5518b1[_0xb5fa('0x24')]=0x0;_0x5518b1[_0xb5fa('0x3c')]=0x0;if(_0x5a1c39==='outbound'){_0x5518b1[_0xb5fa('0x28')]=0x0;_0x5518b1[_0xb5fa('0x29')]=0x0;}}var _0x204d6b=_['find'](_0x4ec294,['id',_0x5518b1['id']]);if(_0x204d6b)_[_0xb5fa('0x19')](_0x5518b1,_[_0xb5fa('0x3d')](_0x204d6b,_0x28a350));return _0x5518b1;});}function updateAgentVoiceStatus(_0x24ef11,_0x55bdb7,_0x117694){var _0x1c818f=_[_0xb5fa('0x3e')](_0x117694,[_0xb5fa('0x3f'),_0x55bdb7['name']]);if(_0x1c818f['length']===0x0)return _0x24ef11['busy']=!![];if(_['some'](_0x1c818f,['connectedlinenum',_0x24ef11['internal'][_0xb5fa('0x40')]()]))return _0x24ef11['talking']=!![];if(!_0x24ef11[_0xb5fa('0x24')])return _0x24ef11[_0xb5fa('0x3c')]=!![];}function getVoiceQueueAgents(_0x36db1a,_0x30b288,_0x40c1c0,_0x269d21){var _0x4b4c4c=_['find'](_0x30b288,['id',_0x36db1a['id']]);if(!_0x4b4c4c)return _0x36db1a;return _0x4b4c4c['getMembers']({'raw':!![]})[_0xb5fa('0x16')](function(_0x4d23f1){for(var _0x73d425=0x0;_0x73d425<_0x4d23f1['length'];_0x73d425++){var _0x58aa97=_[_0xb5fa('0x41')](_0x40c1c0,['id',_0x4d23f1[_0x73d425][_0xb5fa('0x42')]]);if(!_0x58aa97){_0x58aa97={'id':_0x4d23f1[_0x73d425][_0xb5fa('0x42')],'name':_0x4d23f1[_0x73d425][_0xb5fa('0x42')],'accountcode':'','online':![]};}var _0x5bc93f={'id':_0x58aa97['id'],'name':_0x58aa97[_0xb5fa('0x11')],'internal':_0x58aa97[_0xb5fa('0x43')],'online':Boolean(_0x58aa97[_0xb5fa('0x44')]),'paused':Boolean(_0x4d23f1[_0x73d425][_0xb5fa('0x25')])};if(_0x58aa97[_0xb5fa('0x45')]==='talking')updateAgentVoiceStatus(_0x5bc93f,_0x36db1a,_0x269d21);if(_0x5bc93f[_0xb5fa('0x44')])_0x36db1a['loggedInDb']++;if(_0x5bc93f[_0xb5fa('0x3c')])_0x36db1a[_0xb5fa('0x3c')]++;if(_0x5bc93f[_0xb5fa('0x25')]&&!_0x5bc93f[_0xb5fa('0x3c')]&&!_0x5bc93f[_0xb5fa('0x24')])_0x36db1a[_0xb5fa('0x25')]++;_0x36db1a[_0xb5fa('0x3b')][_0xb5fa('0x27')](_0x5bc93f);}return _0x36db1a;});}function getQueueAgents(_0x4da448,_0x1c3c2c,_0xc03e44){var _0x59ae64=_0xb5fa('0x46')+_['startCase'](_0xc03e44)+_0xb5fa('0x47');var _0x5ae45a=_0xc03e44+'Pause';return db[_0x59ae64]['findAll']({'where':{[_[_0xb5fa('0x1c')](_0xc03e44)+_0xb5fa('0x48')]:_0x4da448['id']},'raw':!![]})[_0xb5fa('0x16')](function(_0x19e662){for(var _0x430f46=0x0;_0x430f46<_0x19e662[_0xb5fa('0x49')];_0x430f46++){var _0x10f354=_[_0xb5fa('0x41')](_0x1c3c2c,['id',_0x19e662[_0x430f46]['UserId']]);if(!_0x10f354){_0x10f354={'id':_0x19e662[_0x430f46][_0xb5fa('0x42')],'name':_0x19e662[_0x430f46][_0xb5fa('0x42')],'online':![],['pauseField']:![]};}var _0x4e0fe7={'id':_0x10f354['id'],'name':_0x10f354[_0xb5fa('0x11')],'online':Boolean(_0x10f354[_0xb5fa('0x44')]),'paused':Boolean(_0x10f354[_0x5ae45a])};if(_0x4e0fe7[_0xb5fa('0x44')])_0x4da448[_0xb5fa('0x4a')]++;_0x4da448[_0xb5fa('0x3b')][_0xb5fa('0x27')](_0x4e0fe7);}return _0x4da448;});}function isIdle(_0x1e1c2){return _0x1e1c2===_0xb5fa('0x4b')||_0x1e1c2===_0xb5fa('0x4c')||_0x1e1c2===_0xb5fa('0x4d')||_0x1e1c2===_0xb5fa('0x4e')||_[_0xb5fa('0x4f')](_0x1e1c2);}function isAgentPaused(_0x6ae261,_0x23be4c){var _0x42a359=[_0x6ae261[_0xb5fa('0x50')],_0x6ae261['faxPause'],_0x6ae261['mailPause'],_0x6ae261[_0xb5fa('0x51')],_0x6ae261['smsPause'],_0x6ae261[_0xb5fa('0x52')],_0x6ae261[_0xb5fa('0x53')]];if(!_0x23be4c)return _['every'](_0x42a359);var _0x4ef1d0=_[_0xb5fa('0x3e')](_0x42a359);return _0x4ef1d0[_0xb5fa('0x49')]>0x0&&_0x4ef1d0[_0xb5fa('0x49')]<_0x42a359[_0xb5fa('0x49')]?!![]:![];}function isAgentIdle(_0x3ffee0){if(_0x3ffee0['voiceStatus']!==_0xb5fa('0x4b')&&_0x3ffee0['voicePause']){_0x3ffee0[_0xb5fa('0x45')]=_0xb5fa('0x54');return![];}return _[_0xb5fa('0x55')]([_0x3ffee0['chatStatus'],_0x3ffee0[_0xb5fa('0x56')],_0x3ffee0[_0xb5fa('0x57')],_0x3ffee0['openchannelStatus'],_0x3ffee0['smsStatus'],_0x3ffee0[_0xb5fa('0x45')],_0x3ffee0[_0xb5fa('0x58')]],isIdle);}function getAgentStatus(_0x320745){var _0x3ffdb5=_0xb5fa('0x4c');if(isAgentPaused(_0x320745))_0x3ffdb5=_0xb5fa('0x54');else if(isAgentPaused(_0x320745,!![]))_0x3ffdb5=_0xb5fa('0x59');else if(isAgentIdle(_0x320745))_0x3ffdb5=_0xb5fa('0x4b');else _0x3ffdb5=_0xb5fa('0x3c');return _0x3ffdb5;}exports[_0xb5fa('0x5a')]=function(_0x25de19,_0x35cf5a){var _0x3ccfd1={'count':0x0,'rows':[]},_0x2799e7={},_0x23f235,_0x42c34f,_0x10830a=['userpic',_0xb5fa('0x44'),_0xb5fa('0x5b'),_0xb5fa('0x5c'),_0xb5fa('0x5d'),_0xb5fa('0x5c'),_0xb5fa('0x5e'),_0xb5fa('0x5f'),_0xb5fa('0x50'),_0xb5fa('0x51'),_0xb5fa('0x60'),'smsPause','whatsappPause',_0xb5fa('0x61'),_0xb5fa('0x52'),_0xb5fa('0x62'),'openchannelCapacity',_0xb5fa('0x63'),_0xb5fa('0x64'),_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68'),_0xb5fa('0x69'),'smsCurrentCapacity',_0xb5fa('0x6a'),_0xb5fa('0x6b'),'chatStatus',_0xb5fa('0x6c'),_0xb5fa('0x57'),'smsStatus',_0xb5fa('0x58'),_0xb5fa('0x56'),_0xb5fa('0x45'),_0xb5fa('0x6d'),_0xb5fa('0x6e'),_0xb5fa('0x6f'),_0xb5fa('0x70'),_0xb5fa('0x71'),_0xb5fa('0x72'),_0xb5fa('0x73'),_0xb5fa('0x3f'),_0xb5fa('0x74'),_0xb5fa('0x75'),_0xb5fa('0x76'),_0xb5fa('0x77'),_0xb5fa('0x78')],_0x24acea=[_0xb5fa('0x50'),_0xb5fa('0x51'),_0xb5fa('0x60'),_0xb5fa('0x79'),_0xb5fa('0x53'),_0xb5fa('0x61'),'voicePause',_0xb5fa('0x44')];Promise[_0xb5fa('0x7a')]()[_0xb5fa('0x16')](function(){var _0x580d1a=_[_0xb5fa('0x39')](db[_0xb5fa('0x46')]['rawAttributes'],function(_0x44fd4a){return{'name':_0x44fd4a[_0xb5fa('0x7b')],'type':_0x44fd4a[_0xb5fa('0x7c')]['key']};});_0x25de19['query'][_0xb5fa('0x7d')]=_0xb5fa('0x7e');_0x25de19[_0xb5fa('0x7f')]['online']=!![];_0x2799e7=qs[_0xb5fa('0x80')](_0x580d1a,_0x25de19);_0x2799e7[_0xb5fa('0x81')]=!![];if(_0x25de19[_0xb5fa('0x82')][_0xb5fa('0x7d')]==='user'){var _0x55000b={'params':{'id':_0x25de19['user'][_0xb5fa('0x83')]},'query':{'section':_0xb5fa('0x15'),'role':_0xb5fa('0x7e'),'online':!![],'nolimit':_0x25de19['query'][_0xb5fa('0x84')],'sort':_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x85')],'filter':_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x3e')],'raw':!![]}};return db[_0xb5fa('0x86')][_0xb5fa('0x87')](_0x55000b);}return db[_0xb5fa('0x46')][_0xb5fa('0x88')](_0x2799e7);})[_0xb5fa('0x16')](function(_0x3a1db9){_0x3ccfd1[_0xb5fa('0xb')]=_0x3a1db9[_0xb5fa('0xb')];_0x23f235=_0x3a1db9[_0xb5fa('0x89')];return getRealtimeAgents();})[_0xb5fa('0x16')](function(_0x5eeaa1){_0x42c34f=_0x5eeaa1[_0xb5fa('0x89')];return _0x23f235['map'](function(_0x47193c){var _0x209213=_[_0xb5fa('0x41')](_0x42c34f,['id',_0x47193c['id']]);if(_0x209213)_[_0xb5fa('0x19')](_0x47193c,_[_0xb5fa('0x3d')](_['omit'](_0x209213,_0x24acea),_0x10830a));_0x47193c[_0xb5fa('0x8a')]=getAgentStatus(_0x47193c);return _0x47193c;});})['then'](function(_0x77a831){if(_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x8b')]){var _0x394386=_['filter'](_0x77a831,['globalStatus',_0x25de19['query'][_0xb5fa('0x8b')]]);if(_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x8c')]){_0x394386=_[_0xb5fa('0x3e')](_0x394386,[_0xb5fa('0x5d'),_0x25de19[_0xb5fa('0x7f')]['pauseTypeFilter']]);}}_0x3ccfd1[_0xb5fa('0x89')]=_0x394386||_0x77a831;return _0x3ccfd1;})['then'](respondWithFilteredResult(_0x35cf5a,_0x2799e7))['catch'](handleError(_0x35cf5a,null));};exports[_0xb5fa('0x8d')]=function(_0x4cba86,_0x5d11bb){var _0x4e2253=[_0xb5fa('0x8e'),'chat',_0xb5fa('0x8f'),_0xb5fa('0x90'),_0xb5fa('0x91'),'whatsapp','voice'];var _0xb1fcac={'count':0x0,'rows':[]},_0x2abe24={},_0x4c70d1,_0x2d0c95,_0x3c7cb4,_0x244892,_0x2aaa2c;Promise['resolve']()[_0xb5fa('0x16')](function(){if(_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x92')]){if(!_[_0xb5fa('0x93')](_0x4e2253,_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x92')][_0xb5fa('0x94')]()))throw new Error('Invalid\x20channel');_0x4c70d1=_0x4cba86[_0xb5fa('0x7f')]['channel'][_0xb5fa('0x94')]();}var _0x45790c=_['startCase'](_0x4c70d1)+_0xb5fa('0x47');var _0x212d4e=_[_0xb5fa('0x39')](db[_0x45790c][_0xb5fa('0x95')],function(_0x3034b0){return{'name':_0x3034b0[_0xb5fa('0x7b')],'type':_0x3034b0[_0xb5fa('0x7c')][_0xb5fa('0x96')]};});_0x2abe24=qs['getOptions'](_0x212d4e,_0x4cba86);if(_0x4cba86[_0xb5fa('0x82')][_0xb5fa('0x7d')]===_0xb5fa('0x82')){var _0x20ffa1={'params':{'id':_0x4cba86['user']['userProfileId']},'query':{'section':_0x4c70d1==='voice'&&_0x4cba86['query'][_0xb5fa('0x7c')]===_0xb5fa('0x26')?_0xb5fa('0x97'):_[_0xb5fa('0x1c')](_0x4c70d1)+'Queues','type':_0x4cba86['query'][_0xb5fa('0x7c')],'nolimit':!![],'sort':'name','filter':_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x3e')]}};return db[_0xb5fa('0x86')][_0xb5fa('0x87')](_0x20ffa1);}return db[_0x45790c]['findAndCountAll'](_0x2abe24);})[_0xb5fa('0x16')](function(_0x5c6b09){_0xb1fcac[_0xb5fa('0xb')]=_0x5c6b09[_0xb5fa('0xb')];_0x2d0c95=_0x5c6b09['rows'];return getRealtimeQueues(_0x4cba86,_0x4c70d1);})['then'](function(_0x391412){_0x244892=_0x391412[_0xb5fa('0x89')];return getRealtimeAgents();})[_0xb5fa('0x16')](function(_0x1bcca7){_0x3c7cb4=_0x1bcca7[_0xb5fa('0x89')];if(_0x4c70d1!=_0xb5fa('0x1b'))return;return getRealtimeVoiceQueueChannels();})[_0xb5fa('0x16')](function(_0x25b278){_0x2aaa2c=_0x25b278?_0x25b278[_0xb5fa('0x89')]:[];return initializeQueues(_0x2d0c95,_0x244892,_0x4c70d1,_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x7c')]);})[_0xb5fa('0x16')](function(_0x86dfe9){var _0x53c7b5=_0x86dfe9['map'](function(_0x3dd9ab){if(_0x4c70d1==='voice')return getVoiceQueueAgents(_0x3dd9ab,_0x2d0c95,_0x3c7cb4,_0x2aaa2c);else return getQueueAgents(_0x3dd9ab,_0x3c7cb4,_0x4c70d1);});return Promise[_0xb5fa('0x98')](_0x53c7b5);})[_0xb5fa('0x16')](function(_0x502946){_0xb1fcac[_0xb5fa('0x89')]=_0x502946;return _0xb1fcac;})[_0xb5fa('0x16')](respondWithFilteredResult(_0x5d11bb,_0x2abe24))['catch'](handleError(_0x5d11bb,null));}; \ No newline at end of file +var _0x5d17=['Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','available','waiting','outbound','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','paused','talking','busy','originated','find','pick','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','push','User','Queue','findAll','QueueId','idle','unknown','unavailable','ringing','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','pause','faxStatus','mailStatus','openchannelStatus','whatsappStatus','getAgents','userpic','lastPauseAt','chatPause','smsPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','rawAttributes','fieldName','type','key','role','agent','query','getOptions','raw','user','userProfileId','sort','UserProfile','getResources','findAndCountAll','count','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','QueueCampaigns','all','util','lodash','../../config/logger','api','../../mysqldb','http','client','offset','undefined','limit','status','set','Content-Range','json','error','stack','name','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x5d17,0x114));var _0x75d1=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0x5d17[_0x26d034];return _0x3015aa;};'use strict';var util=require(_0x75d1('0x0'));var _=require(_0x75d1('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x75d1('0x2'))(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var amiClient=jayson['client'][_0x75d1('0x5')]({'port':0x232a});var routingClient=jayson[_0x75d1('0x6')][_0x75d1('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x32bd45,_0x56ac0a){return function(_0x458681){if(_0x458681){var _0x116a51=typeof _0x56ac0a[_0x75d1('0x7')]===_0x75d1('0x8')&&typeof _0x56ac0a[_0x75d1('0x9')]===_0x75d1('0x8');var _0xf9f8e=_0x458681['count'];var _0x4cf632=_0x116a51?0x0:_0x56ac0a[_0x75d1('0x7')];var _0x4a3bb3=_0x116a51?_0x458681['count']:_0x56ac0a[_0x75d1('0x7')]+_0x56ac0a[_0x75d1('0x9')];var _0x4d4aa1;if(_0x4a3bb3>=_0xf9f8e){_0x4a3bb3=_0xf9f8e;_0x4d4aa1=0xc8;}else{_0x4d4aa1=0xce;}_0x32bd45[_0x75d1('0xa')](_0x4d4aa1);return _0x32bd45[_0x75d1('0xb')](_0x75d1('0xc'),_0x4cf632+'-'+_0x4a3bb3+'/'+_0xf9f8e)[_0x75d1('0xd')](_0x458681);}return null;};}function handleError(_0x6c1265,_0xd089cf){_0xd089cf=_0xd089cf||0x1f4;return function(_0x49667a){logger[_0x75d1('0xe')](_0x49667a[_0x75d1('0xf')]);if(_0x49667a[_0x75d1('0x10')]){delete _0x49667a[_0x75d1('0x10')];}_0x6c1265['status'](_0xd089cf)['send'](_0x49667a);};}function getRealtimeAgents(){return new Promise(function(_0x55b8a0,_0x24ba98){return amiClient[_0x75d1('0x11')](_0x75d1('0x12'),{})['then'](function(_0x1f9620){if(_0x1f9620[_0x75d1('0xe')])throw new Error(_0x75d1('0x13'));var _0x269e82=_0x1f9620[_0x75d1('0x14')];return routingClient[_0x75d1('0x11')](_0x75d1('0x12'),{})[_0x75d1('0x15')](function(_0x1bc5de){if(_0x1bc5de[_0x75d1('0xe')])throw new Error(_0x75d1('0x16'));var _0x5761db=_0x1bc5de['result'];return _0x55b8a0(_[_0x75d1('0x17')]({},_0x269e82,_0x5761db));});})[_0x75d1('0x18')](function(_0x56730d){_0x24ba98(_0x56730d);});});}function getRealtimeQueues(_0x31eb88,_0x406143){return new Promise(function(_0x579731,_0xf6cc70){var _0xa42dbe=_0x406143===_0x75d1('0x19')?amiClient:routingClient;return _0xa42dbe['request'](_[_0x75d1('0x1a')](_0x406143)+_0x75d1('0x1b'),_0x31eb88)['then'](function(_0x1cb58c){if(_0x1cb58c[_0x75d1('0xe')])throw new Error(util['format'](_0x75d1('0x1c'),_0x406143));return _0x579731(_0x1cb58c['result']);})[_0x75d1('0x18')](function(_0xc256af){_0xf6cc70(_0xc256af);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x345cf5,_0x4b2a25){return amiClient['request'](_0x75d1('0x1d'),{})[_0x75d1('0x15')](function(_0x315ce5){if(_0x315ce5[_0x75d1('0xe')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x345cf5(_0x315ce5[_0x75d1('0x14')]);})[_0x75d1('0x18')](function(_0x367238){_0x4b2a25(_0x367238);});});}function initializeQueues(_0x51138e,_0x54095d,_0x57efd6,_0x364dc9){var _0x30d9f3=[_0x75d1('0x1e'),_0x75d1('0x1f'),_0x75d1('0x20'),'talking','paused'];if(_0x57efd6===_0x75d1('0x19')&&_0x364dc9===_0x75d1('0x21')){_0x30d9f3['push'](_0x75d1('0x22'),'originated',_0x75d1('0x23'),_0x75d1('0x24'),_0x75d1('0x25'),_0x75d1('0x26'),_0x75d1('0x27'),'startProgressive',_0x75d1('0x28'),_0x75d1('0x29'),_0x75d1('0x2a'),_0x75d1('0x2b'),'dialPredictiveInterval',_0x75d1('0x2c'),'dialPredictiveIntervalMinThreshold',_0x75d1('0x2d'),_0x75d1('0x2e'),'predictiveIntervalAnsweredCalls',_0x75d1('0x2f'),_0x75d1('0x30'),_0x75d1('0x31'),_0x75d1('0x32'));}return _0x51138e[_0x75d1('0x33')](function(_0x495aa4){var _0x23f94a=_0x495aa4[_0x75d1('0x34')]({'plain':!![]});_0x23f94a[_0x75d1('0x35')]=[];_0x23f94a[_0x75d1('0x36')]=0x0;_0x23f94a['loggedInDb']=0x0;_0x23f94a['loggedIn']=0x0;_0x23f94a['available']=0x0;_0x23f94a[_0x75d1('0x20')]=0x0;if(_0x57efd6===_0x75d1('0x19')){_0x23f94a[_0x75d1('0x37')]=0x0;_0x23f94a[_0x75d1('0x38')]=0x0;if(_0x364dc9===_0x75d1('0x21')){_0x23f94a[_0x75d1('0x22')]=0x0;_0x23f94a[_0x75d1('0x39')]=0x0;}}var _0x2dce68=_[_0x75d1('0x3a')](_0x54095d,['id',_0x23f94a['id']]);if(_0x2dce68)_['merge'](_0x23f94a,_[_0x75d1('0x3b')](_0x2dce68,_0x30d9f3));return _0x23f94a;});}function updateAgentVoiceStatus(_0x429c38,_0x39ac3e,_0x62b37e){var _0x6d48a5=_['filter'](_0x62b37e,['queue',_0x39ac3e['name']]);if(_0x6d48a5[_0x75d1('0x3c')]===0x0)return _0x429c38[_0x75d1('0x38')]=!![];if(_[_0x75d1('0x3d')](_0x6d48a5,[_0x75d1('0x3e'),_0x429c38[_0x75d1('0x3f')][_0x75d1('0x40')]()]))return _0x429c38['talking']=!![];if(!_0x429c38['talking'])return _0x429c38['busy']=!![];}function getVoiceQueueAgents(_0x3f2569,_0x4cb084,_0x53a1af,_0x450aa5){var _0x21bfd8=_[_0x75d1('0x3a')](_0x4cb084,['id',_0x3f2569['id']]);if(!_0x21bfd8)return _0x3f2569;return _0x21bfd8[_0x75d1('0x41')]({'raw':!![]})['then'](function(_0x44e6c2){for(var _0x2acdc8=0x0;_0x2acdc8<_0x44e6c2[_0x75d1('0x3c')];_0x2acdc8++){var _0x3d4137=_[_0x75d1('0x3a')](_0x53a1af,['id',_0x44e6c2[_0x2acdc8][_0x75d1('0x42')]]);if(!_0x3d4137){_0x3d4137={'id':_0x44e6c2[_0x2acdc8][_0x75d1('0x42')],'name':_0x44e6c2[_0x2acdc8][_0x75d1('0x42')],'accountcode':'','online':![]};}var _0x2c88f2={'id':_0x3d4137['id'],'name':_0x3d4137[_0x75d1('0x10')],'internal':_0x3d4137[_0x75d1('0x43')],'online':Boolean(_0x3d4137[_0x75d1('0x44')]),'paused':Boolean(_0x44e6c2[_0x2acdc8][_0x75d1('0x36')])};if(_0x3d4137[_0x75d1('0x45')]===_0x75d1('0x37'))updateAgentVoiceStatus(_0x2c88f2,_0x3f2569,_0x450aa5);if(_0x2c88f2[_0x75d1('0x44')])_0x3f2569[_0x75d1('0x46')]++;if(_0x2c88f2[_0x75d1('0x38')])_0x3f2569[_0x75d1('0x38')]++;if(_0x2c88f2[_0x75d1('0x36')]&&!_0x2c88f2[_0x75d1('0x38')]&&!_0x2c88f2[_0x75d1('0x37')])_0x3f2569['paused']++;_0x3f2569['agents'][_0x75d1('0x47')](_0x2c88f2);}return _0x3f2569;});}function getQueueAgents(_0x40b74e,_0x429909,_0x1d9853){var _0x4af3bb=_0x75d1('0x48')+_[_0x75d1('0x1a')](_0x1d9853)+_0x75d1('0x49');var _0x329cec=_0x1d9853+'Pause';return db[_0x4af3bb][_0x75d1('0x4a')]({'where':{[_[_0x75d1('0x1a')](_0x1d9853)+_0x75d1('0x4b')]:_0x40b74e['id']},'raw':!![]})[_0x75d1('0x15')](function(_0x5b486d){for(var _0x34d132=0x0;_0x34d132<_0x5b486d['length'];_0x34d132++){var _0x130dd3=_[_0x75d1('0x3a')](_0x429909,['id',_0x5b486d[_0x34d132][_0x75d1('0x42')]]);if(!_0x130dd3){_0x130dd3={'id':_0x5b486d[_0x34d132][_0x75d1('0x42')],'name':_0x5b486d[_0x34d132][_0x75d1('0x42')],'online':![],['pauseField']:![]};}var _0x2137e1={'id':_0x130dd3['id'],'name':_0x130dd3['name'],'online':Boolean(_0x130dd3[_0x75d1('0x44')]),'paused':Boolean(_0x130dd3[_0x329cec])};if(_0x2137e1['online'])_0x40b74e['loggedInDb']++;_0x40b74e[_0x75d1('0x35')][_0x75d1('0x47')](_0x2137e1);}return _0x40b74e;});}function isIdle(_0x4760cf){return _0x4760cf===_0x75d1('0x4c')||_0x4760cf===_0x75d1('0x4d')||_0x4760cf===_0x75d1('0x4e')||_0x4760cf===_0x75d1('0x4f')||_['isNil'](_0x4760cf);}function isAgentPaused(_0x5d7ebf,_0x1edc9d){var _0x8ce3d2=[_0x5d7ebf['chatPause'],_0x5d7ebf[_0x75d1('0x50')],_0x5d7ebf[_0x75d1('0x51')],_0x5d7ebf[_0x75d1('0x52')],_0x5d7ebf['smsPause'],_0x5d7ebf[_0x75d1('0x53')],_0x5d7ebf[_0x75d1('0x54')]];if(!_0x1edc9d)return _[_0x75d1('0x55')](_0x8ce3d2);var _0x3be4b5=_[_0x75d1('0x56')](_0x8ce3d2);return _0x3be4b5[_0x75d1('0x3c')]>0x0&&_0x3be4b5[_0x75d1('0x3c')]<_0x8ce3d2['length']?!![]:![];}function isAgentIdle(_0x1eaa66){if(_0x1eaa66[_0x75d1('0x45')]!==_0x75d1('0x4c')&&_0x1eaa66[_0x75d1('0x53')]){_0x1eaa66[_0x75d1('0x45')]=_0x75d1('0x57');return![];}return _[_0x75d1('0x55')]([_0x1eaa66['chatStatus'],_0x1eaa66[_0x75d1('0x58')],_0x1eaa66[_0x75d1('0x59')],_0x1eaa66[_0x75d1('0x5a')],_0x1eaa66['smsStatus'],_0x1eaa66[_0x75d1('0x45')],_0x1eaa66[_0x75d1('0x5b')]],isIdle);}function getAgentStatus(_0x16c51){var _0x382760=_0x75d1('0x4d');if(isAgentPaused(_0x16c51))_0x382760=_0x75d1('0x57');else if(isAgentPaused(_0x16c51,!![]))_0x382760='*pause';else if(isAgentIdle(_0x16c51))_0x382760=_0x75d1('0x4c');else _0x382760=_0x75d1('0x38');return _0x382760;}exports[_0x75d1('0x5c')]=function(_0x46e665,_0x2e746a){var _0x2f6048={'count':0x0,'rows':[]},_0x2d1648={},_0x104a44,_0x131082,_0x43769e=[_0x75d1('0x5d'),'online','lastLoginAt',_0x75d1('0x5e'),'pauseType',_0x75d1('0x5e'),_0x75d1('0x3f'),'address',_0x75d1('0x5f'),_0x75d1('0x52'),_0x75d1('0x51'),_0x75d1('0x60'),_0x75d1('0x54'),_0x75d1('0x50'),_0x75d1('0x53'),'chatCapacity',_0x75d1('0x61'),_0x75d1('0x62'),_0x75d1('0x63'),_0x75d1('0x64'),_0x75d1('0x65'),_0x75d1('0x66'),_0x75d1('0x67'),_0x75d1('0x68'),_0x75d1('0x69'),_0x75d1('0x6a'),'faxCurrentCapacity','chatStatus',_0x75d1('0x5a'),_0x75d1('0x59'),_0x75d1('0x6b'),'whatsappStatus',_0x75d1('0x58'),'voiceStatus',_0x75d1('0x6c'),_0x75d1('0x6d'),_0x75d1('0x6e'),_0x75d1('0x6f'),'whatsappStatusTime',_0x75d1('0x70'),'voiceStatusTime','queue',_0x75d1('0x71'),_0x75d1('0x72'),_0x75d1('0x73'),_0x75d1('0x74'),'routealias'],_0x1038d2=['chatPause',_0x75d1('0x52'),_0x75d1('0x51'),_0x75d1('0x60'),_0x75d1('0x54'),_0x75d1('0x50'),'voicePause',_0x75d1('0x44')];Promise[_0x75d1('0x75')]()[_0x75d1('0x15')](function(){var _0x3c6bd7=_[_0x75d1('0x33')](db[_0x75d1('0x48')][_0x75d1('0x76')],function(_0x1092fb){return{'name':_0x1092fb[_0x75d1('0x77')],'type':_0x1092fb[_0x75d1('0x78')][_0x75d1('0x79')]};});_0x46e665['query'][_0x75d1('0x7a')]=_0x75d1('0x7b');_0x46e665[_0x75d1('0x7c')][_0x75d1('0x44')]=!![];_0x2d1648=qs[_0x75d1('0x7d')](_0x3c6bd7,_0x46e665);_0x2d1648[_0x75d1('0x7e')]=!![];if(_0x46e665[_0x75d1('0x7f')]['role']==='user'){var _0x1b1cc4={'params':{'id':_0x46e665[_0x75d1('0x7f')][_0x75d1('0x80')]},'query':{'section':_0x75d1('0x12'),'role':_0x75d1('0x7b'),'online':!![],'nolimit':_0x46e665['query']['nolimit'],'sort':_0x46e665[_0x75d1('0x7c')][_0x75d1('0x81')],'filter':_0x46e665['query'][_0x75d1('0x56')],'raw':!![]}};return db[_0x75d1('0x82')][_0x75d1('0x83')](_0x1b1cc4);}return db[_0x75d1('0x48')][_0x75d1('0x84')](_0x2d1648);})[_0x75d1('0x15')](function(_0x5a4abc){_0x2f6048['count']=_0x5a4abc[_0x75d1('0x85')];_0x104a44=_0x5a4abc[_0x75d1('0x86')];return getRealtimeAgents();})['then'](function(_0x45e61a){_0x131082=_0x45e61a['rows'];return _0x104a44[_0x75d1('0x33')](function(_0x2730f6){var _0x30fd13=_['find'](_0x131082,['id',_0x2730f6['id']]);if(_0x30fd13)_[_0x75d1('0x17')](_0x2730f6,_[_0x75d1('0x3b')](_[_0x75d1('0x87')](_0x30fd13,_0x1038d2),_0x43769e));_0x2730f6[_0x75d1('0x88')]=getAgentStatus(_0x2730f6);return _0x2730f6;});})[_0x75d1('0x15')](function(_0x50d202){if(_0x46e665['query'][_0x75d1('0x89')]){var _0x58d20b=_[_0x75d1('0x56')](_0x50d202,[_0x75d1('0x88'),_0x46e665[_0x75d1('0x7c')]['globalStatusFilter']]);if(_0x46e665['query'][_0x75d1('0x8a')]){_0x58d20b=_['filter'](_0x58d20b,[_0x75d1('0x8b'),_0x46e665[_0x75d1('0x7c')][_0x75d1('0x8a')]]);}}_0x2f6048['rows']=_0x58d20b||_0x50d202;return _0x2f6048;})[_0x75d1('0x15')](respondWithFilteredResult(_0x2e746a,_0x2d1648))[_0x75d1('0x18')](handleError(_0x2e746a,null));};exports[_0x75d1('0x8c')]=function(_0x41981f,_0x3e2334){var _0x1a40b5=[_0x75d1('0x8d'),_0x75d1('0x8e'),_0x75d1('0x8f'),_0x75d1('0x90'),_0x75d1('0x91'),_0x75d1('0x92'),_0x75d1('0x19')];var _0x44ef76={'count':0x0,'rows':[]},_0x4b4a52={},_0x574cb0,_0x410fa1,_0x1eb55e,_0x58079c,_0xf54f;Promise['resolve']()['then'](function(){if(_0x41981f['query'][_0x75d1('0x93')]){if(!_[_0x75d1('0x94')](_0x1a40b5,_0x41981f[_0x75d1('0x7c')][_0x75d1('0x93')][_0x75d1('0x95')]()))throw new Error('Invalid\x20channel');_0x574cb0=_0x41981f[_0x75d1('0x7c')][_0x75d1('0x93')][_0x75d1('0x95')]();}var _0x13f54a=_[_0x75d1('0x1a')](_0x574cb0)+'Queue';var _0x1113a8=_['map'](db[_0x13f54a][_0x75d1('0x76')],function(_0x26e1ad){return{'name':_0x26e1ad[_0x75d1('0x77')],'type':_0x26e1ad['type']['key']};});_0x4b4a52=qs['getOptions'](_0x1113a8,_0x41981f);if(_0x41981f[_0x75d1('0x7f')][_0x75d1('0x7a')]===_0x75d1('0x7f')){var _0x22caf3={'params':{'id':_0x41981f[_0x75d1('0x7f')][_0x75d1('0x80')]},'query':{'section':_0x574cb0==='voice'&&_0x41981f[_0x75d1('0x7c')][_0x75d1('0x78')]==='outbound'?_0x75d1('0x96'):_['startCase'](_0x574cb0)+'Queues','type':_0x41981f['query'][_0x75d1('0x78')],'nolimit':!![],'sort':'name','filter':_0x41981f['query'][_0x75d1('0x56')]}};return db['UserProfile'][_0x75d1('0x83')](_0x22caf3);}return db[_0x13f54a][_0x75d1('0x84')](_0x4b4a52);})[_0x75d1('0x15')](function(_0xc939c9){_0x44ef76[_0x75d1('0x85')]=_0xc939c9[_0x75d1('0x85')];_0x410fa1=_0xc939c9[_0x75d1('0x86')];return getRealtimeQueues(_0x41981f,_0x574cb0);})[_0x75d1('0x15')](function(_0x51b682){_0x58079c=_0x51b682[_0x75d1('0x86')];return getRealtimeAgents();})['then'](function(_0x9ec663){_0x1eb55e=_0x9ec663[_0x75d1('0x86')];if(_0x574cb0!=_0x75d1('0x19'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x10bc92){_0xf54f=_0x10bc92?_0x10bc92[_0x75d1('0x86')]:[];return initializeQueues(_0x410fa1,_0x58079c,_0x574cb0,_0x41981f[_0x75d1('0x7c')][_0x75d1('0x78')]);})[_0x75d1('0x15')](function(_0x2ee3a0){var _0x1bb574=_0x2ee3a0['map'](function(_0xccae6a){if(_0x574cb0===_0x75d1('0x19'))return getVoiceQueueAgents(_0xccae6a,_0x410fa1,_0x1eb55e,_0xf54f);else return getQueueAgents(_0xccae6a,_0x1eb55e,_0x574cb0);});return Promise[_0x75d1('0x97')](_0x1bb574);})[_0x75d1('0x15')](function(_0x44143e){_0x44ef76['rows']=_0x44143e;return _0x44ef76;})['then'](respondWithFilteredResult(_0x3e2334,_0x4b4a52))[_0x75d1('0x18')](handleError(_0x3e2334,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c0c694e..6f4bc6d 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(_0x3c3f47,_0x23461a){var _0x3b9fd9=function(_0x33c57d){while(--_0x33c57d){_0x3c3f47['push'](_0x3c3f47['shift']());}};_0x3b9fd9(++_0x23461a);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x26190c,_0x39e540){var _0x3ebdc4=function(_0x2c968c){while(--_0x2c968c){_0x26190c['push'](_0x26190c['shift']());}};_0x3ebdc4(++_0x39e540);}(_0xedd9,0xfc));var _0x9edd=function(_0x526137,_0x43ff1c){_0x526137=_0x526137-0x0;var _0x92cec=_0xedd9[_0x526137];return _0x92cec;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index f1cf4d1..308f3c3 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd663=['DATE','sequelize','exports','STRING'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xd663,0x1ed));var _0x3d66=function(_0x1ae261,_0x1e3034){_0x1ae261=_0x1ae261-0x0;var _0x5c0cdb=_0xd663[_0x1ae261];return _0x5c0cdb;};'use strict';var Sequelize=require(_0x3d66('0x0'));module[_0x3d66('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3d66('0x2')]},'scheduledat':{'type':Sequelize[_0x3d66('0x3')]},'uniqueid':{'type':Sequelize[_0x3d66('0x2')]},'starttime':{'type':Sequelize[_0x3d66('0x3')]},'responsetime':{'type':Sequelize[_0x3d66('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3d66('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf96b=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2e7eba,_0x220747){var _0x541058=function(_0x4817c5){while(--_0x4817c5){_0x2e7eba['push'](_0x2e7eba['shift']());}};_0x541058(++_0x220747);}(_0xf96b,0x109));var _0xbf96=function(_0x36f141,_0x246fce){_0x36f141=_0x36f141-0x0;var _0x37920e=_0xf96b[_0x36f141];return _0x37920e;};'use strict';var Sequelize=require(_0xbf96('0x0'));module[_0xbf96('0x1')]={'state':{'type':Sequelize[_0xbf96('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbf96('0x3')]},'scheduledat':{'type':Sequelize[_0xbf96('0x4')]},'uniqueid':{'type':Sequelize[_0xbf96('0x3')]},'starttime':{'type':Sequelize[_0xbf96('0x4')]},'responsetime':{'type':Sequelize[_0xbf96('0x4')]},'ringtime':{'type':Sequelize[_0xbf96('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xbf96('0x3')]},'campaigntype':{'type':Sequelize[_0xbf96('0x3')]},'membername':{'type':Sequelize[_0xbf96('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 862edbb..962bc24 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 _0x2e24=['lodash','util','api','moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e24,0xcc));var _0x42e2=function(_0x232548,_0x233be2){_0x232548=_0x232548-0x0;var _0x2e0e07=_0x2e24[_0x232548];return _0x2e0e07;};'use strict';var _=require(_0x42e2('0x0'));var util=require(_0x42e2('0x1'));var logger=require('../../config/logger')(_0x42e2('0x2'));var moment=require(_0x42e2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x42e2('0x4'));var rimraf=require(_0x42e2('0x5'));var config=require(_0x42e2('0x6'));var attributes=require(_0x42e2('0x7'));module[_0x42e2('0x8')]=function(_0x390035,_0x35e38c){return _0x390035[_0x42e2('0x9')](_0x42e2('0xa'),attributes,{'tableName':_0x42e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9ff=['../../config/logger','moment','request-promise','path','rimraf','exports','define','ReportAgentPreview','lodash','util'];(function(_0x274940,_0xf2816){var _0xc17d01=function(_0x2952da){while(--_0x2952da){_0x274940['push'](_0x274940['shift']());}};_0xc17d01(++_0xf2816);}(_0xa9ff,0x12a));var _0xfa9f=function(_0x12e1fa,_0x2da3b8){_0x12e1fa=_0x12e1fa-0x0;var _0x498b71=_0xa9ff[_0x12e1fa];return _0x498b71;};'use strict';var _=require(_0xfa9f('0x0'));var util=require(_0xfa9f('0x1'));var logger=require(_0xfa9f('0x2'))('api');var moment=require(_0xfa9f('0x3'));var BPromise=require('bluebird');var rp=require(_0xfa9f('0x4'));var fs=require('fs');var path=require(_0xfa9f('0x5'));var rimraf=require(_0xfa9f('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xfa9f('0x7')]=function(_0x238c94,_0x399394){return _0x238c94[_0xfa9f('0x8')](_0xfa9f('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 4c58218..3712dea 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 _0x1320=['ReportAgentPreview','create','body','options','raw','debug','stringify','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateReportAgentPreview'];(function(_0x11703d,_0x3e66f8){var _0x39582c=function(_0x272fcf){while(--_0x272fcf){_0x11703d['push'](_0x11703d['shift']());}};_0x39582c(++_0x3e66f8);}(_0x1320,0x115));var _0x0132=function(_0x3e6a0a,_0x1fc647){_0x3e6a0a=_0x3e6a0a-0x0;var _0x5efda1=_0x1320[_0x3e6a0a];return _0x5efda1;};'use strict';var _=require('lodash');var util=require(_0x0132('0x0'));var moment=require(_0x0132('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0132('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0132('0x3'));var logger=require(_0x0132('0x4'))(_0x0132('0x5'));var config=require(_0x0132('0x6'));var jayson=require(_0x0132('0x7'));var client=jayson[_0x0132('0x8')][_0x0132('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33bf01,_0x26cde6,_0x4b06a2){return new BPromise(function(_0x42ecef,_0x21268e){return client[_0x0132('0xa')](_0x33bf01,_0x4b06a2)[_0x0132('0xb')](function(_0x1b4835){logger[_0x0132('0xc')](_0x0132('0xd'),_0x26cde6,'request\x20sent');logger['debug'](_0x0132('0xe'),_0x26cde6,'request\x20sent',JSON['stringify'](_0x1b4835));if(_0x1b4835[_0x0132('0xf')]){if(_0x1b4835[_0x0132('0xf')]['code']===0x1f4){logger[_0x0132('0xf')](_0x0132('0xd'),_0x26cde6,_0x1b4835[_0x0132('0xf')][_0x0132('0x10')]);return _0x21268e(_0x1b4835[_0x0132('0xf')][_0x0132('0x10')]);}logger[_0x0132('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x26cde6,_0x1b4835[_0x0132('0xf')]['message']);return _0x42ecef(_0x1b4835[_0x0132('0xf')]['message']);}else{logger['info'](_0x0132('0xd'),_0x26cde6,'request\x20sent');_0x42ecef(_0x1b4835[_0x0132('0x11')][_0x0132('0x10')]);}})[_0x0132('0x12')](function(_0x5ecb78){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x26cde6,_0x5ecb78);_0x21268e(_0x5ecb78);});});}exports[_0x0132('0x13')]=function(_0xbd6bc6){var _0x142589=this;return new Promise(function(_0x579ce9,_0x5292dc){return db[_0x0132('0x14')][_0x0132('0x15')](_0xbd6bc6[_0x0132('0x16')],{'raw':_0xbd6bc6[_0x0132('0x17')]?_0xbd6bc6[_0x0132('0x17')][_0x0132('0x18')]===undefined?!![]:![]:!![]})[_0x0132('0xb')](function(_0x571302){logger['info'](_0x0132('0x13'),_0xbd6bc6);logger[_0x0132('0x19')](_0x0132('0x13'),_0xbd6bc6,JSON[_0x0132('0x1a')](_0x571302));_0x579ce9(_0x571302);})['catch'](function(_0x3bb788){logger['error'](_0x0132('0x13'),_0x3bb788[_0x0132('0x10')],_0xbd6bc6);_0x5292dc(_0x142589[_0x0132('0xf')](0x1f4,_0x3bb788[_0x0132('0x10')]));});});}; \ No newline at end of file +var _0x284f=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x489ce5,_0x431c16){var _0x413132=function(_0x4039b8){while(--_0x4039b8){_0x489ce5['push'](_0x489ce5['shift']());}};_0x413132(++_0x431c16);}(_0x284f,0x127));var _0xf284=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x284f[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xf284('0x0'));var util=require(_0xf284('0x1'));var moment=require(_0xf284('0x2'));var BPromise=require(_0xf284('0x3'));var rs=require(_0xf284('0x4'));var fs=require('fs');var Redis=require(_0xf284('0x5'));var db=require(_0xf284('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf284('0x7'))('rpc');var config=require(_0xf284('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf284('0x9')][_0xf284('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x127582,_0x5874ab,_0x201fcd){return new BPromise(function(_0x598f49,_0x1ab66b){return client[_0xf284('0xb')](_0x127582,_0x201fcd)['then'](function(_0x2581d8){logger[_0xf284('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5874ab,'request\x20sent');logger[_0xf284('0xd')](_0xf284('0xe'),_0x5874ab,_0xf284('0xf'),JSON['stringify'](_0x2581d8));if(_0x2581d8['error']){if(_0x2581d8[_0xf284('0x10')][_0xf284('0x11')]===0x1f4){logger[_0xf284('0x10')](_0xf284('0x12'),_0x5874ab,_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);return _0x1ab66b(_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);}logger[_0xf284('0x10')](_0xf284('0x12'),_0x5874ab,_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);return _0x598f49(_0x2581d8[_0xf284('0x10')][_0xf284('0x13')]);}else{logger[_0xf284('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5874ab,_0xf284('0xf'));_0x598f49(_0x2581d8[_0xf284('0x14')][_0xf284('0x13')]);}})['catch'](function(_0xc5715a){logger[_0xf284('0x10')](_0xf284('0x12'),_0x5874ab,_0xc5715a);_0x1ab66b(_0xc5715a);});});}exports[_0xf284('0x15')]=function(_0x37cbf8){var _0x164d7d=this;return new Promise(function(_0x3418c6,_0x24f31b){return db[_0xf284('0x16')][_0xf284('0x17')](_0x37cbf8[_0xf284('0x18')],{'raw':_0x37cbf8[_0xf284('0x19')]?_0x37cbf8[_0xf284('0x19')][_0xf284('0x1a')]===undefined?!![]:![]:!![]})[_0xf284('0x1b')](function(_0x301077){logger[_0xf284('0xc')](_0xf284('0x15'),_0x37cbf8);logger[_0xf284('0xd')](_0xf284('0x15'),_0x37cbf8,JSON[_0xf284('0x1c')](_0x301077));_0x3418c6(_0x301077);})[_0xf284('0x1d')](function(_0x2536a6){logger[_0xf284('0x10')](_0xf284('0x15'),_0x2536a6[_0xf284('0x13')],_0x37cbf8);_0x24f31b(_0x164d7d['error'](0x1f4,_0x2536a6[_0xf284('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 65fb334..4199afc 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 _0x8a1f=['/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/fax/queues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','agents','put','/agents/:id/capacity'];(function(_0xb9b3fc,_0x3be973){var _0x35f7bc=function(_0x4d6d0a){while(--_0x4d6d0a){_0xb9b3fc['push'](_0xb9b3fc['shift']());}};_0x35f7bc(++_0x3be973);}(_0x8a1f,0x1db));var _0xf8a1=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x8a1f[_0x34df4a];return _0x145c69;};'use strict';var multer=require(_0xf8a1('0x0'));var util=require(_0xf8a1('0x1'));var path=require('path');var express=require(_0xf8a1('0x2'));var router=express[_0xf8a1('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xf8a1('0x4'));router['get'](_0xf8a1('0x5'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x7')]);router[_0xf8a1('0x8')](_0xf8a1('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xf8a1('0x8')](_0xf8a1('0xa'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0xb')]);router[_0xf8a1('0x8')](_0xf8a1('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0xf8a1('0xd'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0xe')]);router[_0xf8a1('0x8')](_0xf8a1('0xf'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x10')]);router[_0xf8a1('0x8')](_0xf8a1('0x11'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x12')]);router[_0xf8a1('0x8')](_0xf8a1('0x13'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xf8a1('0x8')](_0xf8a1('0x14'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x15')]);router[_0xf8a1('0x8')]('/whatsapp/queues',auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xf8a1('0x8')](_0xf8a1('0x16'),auth[_0xf8a1('0x6')](),controller['faxQueues']);router[_0xf8a1('0x8')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0xf8a1('0x8')](_0xf8a1('0x17'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x18')]);router[_0xf8a1('0x8')](_0xf8a1('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xf8a1('0x6')](),controller['voiceQueuesChannelHangup']);router[_0xf8a1('0x8')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x1a')]);router[_0xf8a1('0x8')](_0xf8a1('0x1b'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x1c')]);router['put']('/voice/queues/:id',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x1d')]);router[_0xf8a1('0x8')](_0xf8a1('0x1e'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x1f')]);router[_0xf8a1('0x8')](_0xf8a1('0x20'),auth[_0xf8a1('0x6')](),controller['outboundChannels']);router[_0xf8a1('0x8')]('/agents',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x21')]);router[_0xf8a1('0x22')](_0xf8a1('0x23'),auth[_0xf8a1('0x6')](),controller['agentCapacity']);router['get'](_0xf8a1('0x24'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x25')]);router[_0xf8a1('0x8')](_0xf8a1('0x26'),auth['isAuthenticated'](),controller[_0xf8a1('0x27')]);router[_0xf8a1('0x8')](_0xf8a1('0x28'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x29')]);router[_0xf8a1('0x8')](_0xf8a1('0x2a'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x2b')]);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router['get'](_0xf8a1('0x2c'),auth[_0xf8a1('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0xf8a1('0x8')](_0xf8a1('0x2d'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x2e')]);router[_0xf8a1('0x8')](_0xf8a1('0x2f'),auth['isAuthenticated'](),controller[_0xf8a1('0x30')]);router[_0xf8a1('0x8')](_0xf8a1('0x31'),auth[_0xf8a1('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0xf8a1('0x8')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf8a1('0x32')]);router[_0xf8a1('0x8')](_0xf8a1('0x33'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x34')]);router['post'](_0xf8a1('0x35'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x36')](_0xf8a1('0x37')));router[_0xf8a1('0x8')]('/mail/queues/:id',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x38')]);router[_0xf8a1('0x39')](_0xf8a1('0x3a'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x36')](_0xf8a1('0x3b')));router[_0xf8a1('0x8')](_0xf8a1('0x3c'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x3d')]);router[_0xf8a1('0x39')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0xf8a1('0x36')](_0xf8a1('0x3e')));router[_0xf8a1('0x8')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0xf8a1('0x3f')]);router[_0xf8a1('0x39')](_0xf8a1('0x40'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x36')]('openchannel'));router['get'](_0xf8a1('0x41'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x42')]);router[_0xf8a1('0x39')]('/sms/queues/:id/notify',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x36')]('sms'));router[_0xf8a1('0x39')]('/whatsapp/queues/:id/notify',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x36')]('whatsapp'));router[_0xf8a1('0x8')](_0xf8a1('0x43'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x44')]);router['get']('/whatsapp/queues/:id',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x45')]);router[_0xf8a1('0x39')](_0xf8a1('0x46'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x47')]);module[_0xf8a1('0x48')]=router; \ No newline at end of file +var _0xfa76=['put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','../../components/auth/service','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues'];(function(_0x238227,_0x2ec574){var _0xb84c18=function(_0x4ecbfb){while(--_0x4ecbfb){_0x238227['push'](_0x238227['shift']());}};_0xb84c18(++_0x2ec574);}(_0xfa76,0x116));var _0x6fa7=function(_0x52ddf2,_0x2ff25f){_0x52ddf2=_0x52ddf2-0x0;var _0x2dce61=_0xfa76[_0x52ddf2];return _0x2dce61;};'use strict';var multer=require(_0x6fa7('0x0'));var util=require('util');var path=require(_0x6fa7('0x1'));var express=require(_0x6fa7('0x2'));var router=express[_0x6fa7('0x3')]();var auth=require(_0x6fa7('0x4'));var controller=require('./rpc.controller');router[_0x6fa7('0x5')]('/voice/channels',auth['isAuthenticated'](),controller[_0x6fa7('0x6')]);router[_0x6fa7('0x5')](_0x6fa7('0x7'),auth[_0x6fa7('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0x6fa7('0x9'),auth['isAuthenticated'](),controller[_0x6fa7('0xa')]);router['get'](_0x6fa7('0xb'),auth[_0x6fa7('0x8')](),controller['voiceQueues']);router[_0x6fa7('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0x6fa7('0xc')]);router[_0x6fa7('0x5')](_0x6fa7('0xd'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0xe')]);router['get'](_0x6fa7('0xf'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x6fa7('0x5')](_0x6fa7('0x10'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x11')]);router[_0x6fa7('0x5')]('/sms/queues',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x12')]);router[_0x6fa7('0x5')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x6fa7('0x13')]);router[_0x6fa7('0x5')](_0x6fa7('0x14'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x15')]);router['get']('/voice/queues/preview/:id',auth[_0x6fa7('0x8')](),controller['voiceQueuesPreview']);router['get'](_0x6fa7('0x16'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x17')]);router[_0x6fa7('0x5')](_0x6fa7('0x18'),auth['isAuthenticated'](),controller[_0x6fa7('0x19')]);router[_0x6fa7('0x5')](_0x6fa7('0x1a'),auth[_0x6fa7('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x6fa7('0x5')](_0x6fa7('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get'](_0x6fa7('0x1c'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x1d')]);router[_0x6fa7('0x1e')](_0x6fa7('0x1c'),auth[_0x6fa7('0x8')](),controller['updateVoiceQueue']);router['get'](_0x6fa7('0x1f'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x20')]);router[_0x6fa7('0x5')](_0x6fa7('0x21'),auth['isAuthenticated'](),controller[_0x6fa7('0x22')]);router[_0x6fa7('0x5')](_0x6fa7('0x23'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x24')]);router[_0x6fa7('0x1e')](_0x6fa7('0x25'),auth['isAuthenticated'](),controller[_0x6fa7('0x26')]);router[_0x6fa7('0x5')](_0x6fa7('0x27'),auth['isAuthenticated'](),controller['telephones']);router[_0x6fa7('0x5')](_0x6fa7('0x28'),auth[_0x6fa7('0x8')](),controller['trunks']);router[_0x6fa7('0x5')](_0x6fa7('0x29'),auth['isAuthenticated'](),controller[_0x6fa7('0x2a')]);router[_0x6fa7('0x5')](_0x6fa7('0x2b'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x2c')]);router['get'](_0x6fa7('0x2d'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x2e')]);router['get'](_0x6fa7('0x2f'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x30')]);router[_0x6fa7('0x5')](_0x6fa7('0x31'),auth['isAuthenticated'](),controller[_0x6fa7('0x32')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x33')]);router[_0x6fa7('0x5')]('/sms/queues/waitinginteractions',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x34')]);router[_0x6fa7('0x5')](_0x6fa7('0x35'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x36')]);router[_0x6fa7('0x5')](_0x6fa7('0x37'),auth[_0x6fa7('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x6fa7('0x38')]('/mail/queues/:id/notify',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x39')]('mail'));router[_0x6fa7('0x5')](_0x6fa7('0x3a'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x3b')]);router[_0x6fa7('0x38')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6fa7('0x39')](_0x6fa7('0x3c')));router[_0x6fa7('0x5')](_0x6fa7('0x3d'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x3e')]);router[_0x6fa7('0x38')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6fa7('0x39')](_0x6fa7('0x3f')));router[_0x6fa7('0x5')](_0x6fa7('0x40'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x41')]);router[_0x6fa7('0x38')]('/openchannel/queues/:id/notify',auth[_0x6fa7('0x8')](),controller['queueNotify'](_0x6fa7('0x42')));router[_0x6fa7('0x5')]('/openchannel/queues/:id',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x43')]);router[_0x6fa7('0x38')](_0x6fa7('0x44'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x39')](_0x6fa7('0x45')));router['post'](_0x6fa7('0x46'),auth[_0x6fa7('0x8')](),controller['queueNotify']('whatsapp'));router[_0x6fa7('0x5')](_0x6fa7('0x47'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x48')]);router['get'](_0x6fa7('0x49'),auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x4a')]);router['post']('/agents/:id/notify',auth[_0x6fa7('0x8')](),controller[_0x6fa7('0x4b')]);module[_0x6fa7('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index cf208a3..11c5a6e 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 _0xa41a=['name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','hasOwnProperty','MemberReport','findAll','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','user','INTERACTION','interface','SIP/%s','agent','AgentCapacity','capacity','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','MessageId','From','Account','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','status','json','sendStatus','stack'];(function(_0x5babf1,_0x52fde3){var _0x21c46e=function(_0xe23e9c){while(--_0xe23e9c){_0x5babf1['push'](_0x5babf1['shift']());}};_0x21c46e(++_0x52fde3);}(_0xa41a,0x6b));var _0xaa41=function(_0x4e0784,_0x8145ec){_0x4e0784=_0x4e0784-0x0;var _0x4a3ed8=_0xa41a[_0x4e0784];return _0x4a3ed8;};'use strict';var BPromise=require(_0xaa41('0x0'));var moment=require(_0xaa41('0x1'));var _=require('lodash');var util=require(_0xaa41('0x2'));var db=require(_0xaa41('0x3'))['db'];var logger=require(_0xaa41('0x4'))(_0xaa41('0x5'));var jayson=require(_0xaa41('0x6'));var amiClient=jayson[_0xaa41('0x7')][_0xaa41('0x8')]({'port':0x232a});var mailClient=jayson[_0xaa41('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xaa41('0x7')][_0xaa41('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){var _0x31df43=_0x179545?_0x179545:amiClient;return _0x31df43[_0xaa41('0x9')](_0x54bc5a,_0x5b1fff)[_0xaa41('0xa')](function(_0x1cc344){if(_0x1cc344[_0xaa41('0xb')]){if(_0x1cc344[_0xaa41('0xb')][_0xaa41('0xc')]===0x1f4){return _0x588ab4(_0x1cc344[_0xaa41('0xb')][_0xaa41('0xd')]);}return _0x202cce(_0x1cc344['error'][_0xaa41('0xd')]);}else{_0x202cce(_0x1cc344[_0xaa41('0xe')]);}})['catch'](function(_0x54827c){_0x588ab4(_0x54827c);});});}function respondWithResult(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xc8;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0xf')](_0x518b5b)[_0xaa41('0x10')](_0x19bd69);}return _0x1d0a54[_0xaa41('0x11')](0x194);};}function handleError(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0x1f4;return function(_0x1e9d7f){logger[_0xaa41('0xb')](_0x1e9d7f[_0xaa41('0x12')]);if(_0x1e9d7f[_0xaa41('0x13')]){delete _0x1e9d7f[_0xaa41('0x13')];}_0x6f9ade[_0xaa41('0xf')](_0x4eaf81)[_0xaa41('0x14')](_0x1e9d7f);};}function findById(_0x550ad5){return function(_0x2d868a){if(!_[_0xaa41('0x15')](_0x550ad5)&&!_[_0xaa41('0x15')](_0x2d868a)&&!_[_0xaa41('0x15')](_0x2d868a[_0xaa41('0x16')])){return _[_0xaa41('0x17')](_0x2d868a[_0xaa41('0x16')],function(_0x46e6d3){return _0x46e6d3['id']==_0x550ad5;});}return null;};}exports[_0xaa41('0x18')]=function(_0x4fe1a4,_0x5cd936){return respondWithRpcPromise(_0xaa41('0x19'),_0x4fe1a4[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5cd936,null))['catch'](handleError(_0x5cd936,null));};exports[_0xaa41('0x1b')]=function(_0x1f692b,_0x4e768e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xaa41('0x1c')](_0x1f692b['query'],_0x1f692b[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x4e768e,null))[_0xaa41('0x1e')](handleError(_0x4e768e,null));};exports[_0xaa41('0x1f')]=function(_0x1d623c,_0x4eb01f){return respondWithRpcPromise(_0xaa41('0x20'),_[_0xaa41('0x1c')](_0x1d623c[_0xaa41('0x1a')],_0x1d623c[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x4eb01f,null))[_0xaa41('0x1e')](handleError(_0x4eb01f,null));};exports['voiceQueues']=function(_0x5795f4,_0x16aec5){return respondWithRpcPromise('VoiceQueues',_0x5795f4['query'])[_0xaa41('0xa')](respondWithResult(_0x16aec5,null))['catch'](handleError(_0x16aec5,null));};exports['showVoiceQueues']=function(_0x2d0ac0,_0x9c8c21){return respondWithRpcPromise(_0xaa41('0x21'),_0x2d0ac0[_0xaa41('0x1a')])[_0xaa41('0xa')](findById(_0x2d0ac0[_0xaa41('0x1d')]['id']))['then'](respondWithResult(_0x9c8c21,null))[_0xaa41('0x1e')](handleError(_0x9c8c21,null));};exports[_0xaa41('0x22')]=function(_0x63c18c,_0x9a16e3){return respondWithRpcPromise(_0xaa41('0x23'),_[_0xaa41('0x1c')](_0x63c18c[_0xaa41('0x24')],_0x63c18c[_0xaa41('0x1d')]))['then'](respondWithResult(_0x9a16e3,null))[_0xaa41('0x1e')](handleError(_0x9a16e3,null));};exports['voiceQueuesPreview']=function(_0x5dad80,_0x714537){return respondWithRpcPromise(_0xaa41('0x25'),_['merge'](_0x5dad80[_0xaa41('0x1a')],_0x5dad80[_0xaa41('0x1d')]))['then'](respondWithResult(_0x714537,null))['catch'](handleError(_0x714537,null));};exports['voiceQueuesChannels']=function(_0x1cf3da,_0x2f5cc0){return respondWithRpcPromise(_0xaa41('0x26'),_0x1cf3da[_0xaa41('0x1a')])['then'](respondWithResult(_0x2f5cc0,null))[_0xaa41('0x1e')](handleError(_0x2f5cc0,null));};exports[_0xaa41('0x27')]=function(_0x3e0204,_0x4de770){return respondWithRpcPromise(_0xaa41('0x28'),_[_0xaa41('0x1c')](_0x3e0204[_0xaa41('0x1a')],_0x3e0204['params']))[_0xaa41('0xa')](respondWithResult(_0x4de770,null))[_0xaa41('0x1e')](handleError(_0x4de770,null));};exports['voiceQueuesChannelHangup']=function(_0x23eb50,_0x13b6d4){return respondWithRpcPromise(_0xaa41('0x29'),_['merge'](_0x23eb50[_0xaa41('0x1a')],_0x23eb50['params']))[_0xaa41('0xa')](respondWithResult(_0x13b6d4,null))[_0xaa41('0x1e')](handleError(_0x13b6d4,null));};exports[_0xaa41('0x2a')]=function(_0x49b77a,_0x526377){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xaa41('0x1c')](_0x49b77a[_0xaa41('0x1a')],_0x49b77a[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x526377,null))['catch'](handleError(_0x526377,null));};exports['outbound']=function(_0x267999,_0x5673c){return respondWithRpcPromise(_0xaa41('0x2b'),_0x267999[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5673c,null))[_0xaa41('0x1e')](handleError(_0x5673c,null));};exports[_0xaa41('0x2c')]=function(_0x5e9879,_0x3adc28){return respondWithRpcPromise(_0xaa41('0x2d'),_0x5e9879[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x3adc28,null))['catch'](handleError(_0x3adc28,null));};exports['agents']=function(_0x42b759,_0x275fa3){var _0x5eae08;return respondWithRpcPromise(_0xaa41('0x2e'),_0x42b759['query'])[_0xaa41('0xa')](function(_0x25f2df){_0x5eae08=_0x25f2df;return respondWithRpcPromise(_0xaa41('0x2e'),_0x42b759[_0xaa41('0x1a')],routingClient);})[_0xaa41('0xa')](function(_0x12ba1a){return _[_0xaa41('0x1c')]({},_0x12ba1a,_0x5eae08);})[_0xaa41('0xa')](respondWithResult(_0x275fa3,null))['catch'](handleError(_0x275fa3,null));};exports[_0xaa41('0x2f')]=function(_0x2abf39,_0x35c685){if(_0x2abf39[_0xaa41('0x24')]&&_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')]&&_0x2abf39['user']&&_0x2abf39['user'][_0xaa41('0x13')]){for(var _0x4f9086 in _0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')]){if(_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0xaa41('0x31')](_0x4f9086)){db[_0xaa41('0x32')][_0xaa41('0x33')]({'where':{'channel':_0x4f9086,'membername':_0x2abf39['user'][_0xaa41('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2abf39['body'][_0xaa41('0x30')][_0x4f9086]&&_0x2abf39['body']['interaction'][_0x4f9086]['length']?{'$notIn':_0x2abf39[_0xaa41('0x24')]['interaction'][_0x4f9086]}:{'$ne':null}}})[_0xaa41('0xa')](function(_0x198716){var _0x4a6882=moment()['format'](_0xaa41('0x34'));for(var _0x1b7b97=0x0,_0x1bb973=_0x198716[_0xaa41('0x35')];_0x1b7b97<_0x1bb973;_0x1b7b97+=0x1){_0x198716[_0x1b7b97][_0xaa41('0x36')]({'exitAt':_0x4a6882});}});for(var _0x337993=0x0;_0x337993<_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0xaa41('0x35')];_0x337993+=0x1){db['MemberReport'][_0xaa41('0x37')]({'where':{'channel':_0x4f9086,'membername':_0x2abf39[_0xaa41('0x38')][_0xaa41('0x13')],'type':_0xaa41('0x39'),'uniqueid':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0x337993],'exitAt':null},'defaults':{'channel':_0x4f9086,'membername':_0x2abf39['user'][_0xaa41('0x13')],'interface':_[_0xaa41('0x15')](_0x2abf39[_0xaa41('0x38')][_0xaa41('0x3a')])?util['format'](_0xaa41('0x3b'),_0x2abf39['user']['name']):_0x2abf39[_0xaa41('0x38')][_0xaa41('0x3a')],'type':_0xaa41('0x39'),'enterAt':moment()['format'](_0xaa41('0x34')),'role':_0xaa41('0x3c'),'internal':_0x2abf39[_0xaa41('0x38')]['internal'],'uniqueid':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0x337993]}});}}}}return respondWithRpcPromise(_0xaa41('0x3d'),{'id':_0x2abf39[_0xaa41('0x1d')]['id'],'capacity':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x3e')]},routingClient)[_0xaa41('0xa')](respondWithResult(_0x35c685,null))[_0xaa41('0x1e')](handleError(_0x35c685,null));};exports['telephones']=function(_0x9f0a81,_0x5bef5f){return respondWithRpcPromise('Telephones',_0x9f0a81[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5bef5f,null))[_0xaa41('0x1e')](handleError(_0x5bef5f,null));};exports[_0xaa41('0x3f')]=function(_0x14aab0,_0x288db3){return respondWithRpcPromise(_0xaa41('0x40'),_0x14aab0[_0xaa41('0x1a')])['then'](respondWithResult(_0x288db3,null))[_0xaa41('0x1e')](handleError(_0x288db3,null));};exports[_0xaa41('0x41')]=function(_0x1d518f,_0x4f9e92){return respondWithRpcPromise(_0xaa41('0x42'),_0x1d518f[_0xaa41('0x1a')])['then'](respondWithResult(_0x4f9e92,null))[_0xaa41('0x1e')](handleError(_0x4f9e92,null));};exports[_0xaa41('0x43')]=function(_0x283b3b,_0x4e5a2e){return respondWithRpcPromise(_0xaa41('0x44'),_0x283b3b[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x4e5a2e,null))['catch'](handleError(_0x4e5a2e,null));};exports[_0xaa41('0x45')]=function(_0x3cd14f,_0x3a29d2){return respondWithRpcPromise('ChatQueues',_0x3cd14f[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x3cd14f[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x3a29d2,null))[_0xaa41('0x1e')](handleError(_0x3a29d2,null));};exports['mailQueues']=function(_0x2ae70c,_0x57cb70){return respondWithRpcPromise('MailQueues',_0x2ae70c[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x57cb70,null))[_0xaa41('0x1e')](handleError(_0x57cb70,null));};exports[_0xaa41('0x46')]=function(_0x169ddf,_0x5e83e1){return respondWithRpcPromise(_0xaa41('0x47'),_0x169ddf[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x169ddf[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x5e83e1,null))[_0xaa41('0x1e')](handleError(_0x5e83e1,null));};exports[_0xaa41('0x48')]=function(_0x337059,_0x3f91f3){return respondWithRpcPromise('MailAccounts',_0x337059[_0xaa41('0x1a')],mailClient)[_0xaa41('0xa')](respondWithResult(_0x3f91f3,null))[_0xaa41('0x1e')](handleError(_0x3f91f3,null));};exports['openchannelQueues']=function(_0x3fe47a,_0x2caf5c){return respondWithRpcPromise(_0xaa41('0x49'),_0x3fe47a[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x2caf5c,null))[_0xaa41('0x1e')](handleError(_0x2caf5c,null));};exports[_0xaa41('0x4a')]=function(_0x5ea056,_0x55a85c){return respondWithRpcPromise('OpenchannelQueues',_0x5ea056['query'],routingClient)['then'](findById(_0x5ea056['params']['id']))[_0xaa41('0xa')](respondWithResult(_0x55a85c,null))['catch'](handleError(_0x55a85c,null));};exports['smsQueues']=function(_0x24c6f3,_0x40a524){return respondWithRpcPromise(_0xaa41('0x4b'),_0x24c6f3[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x40a524,null))[_0xaa41('0x1e')](handleError(_0x40a524,null));};exports[_0xaa41('0x4c')]=function(_0x1ddb6c,_0x46822f){return respondWithRpcPromise(_0xaa41('0x4b'),_0x1ddb6c[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x1ddb6c[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x46822f,null))['catch'](handleError(_0x46822f,null));};exports[_0xaa41('0x4d')]=function(_0x2d2af8,_0x50170f){return respondWithRpcPromise('WhatsappQueues',_0x2d2af8['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x50170f,null))['catch'](handleError(_0x50170f,null));};exports[_0xaa41('0x4e')]=function(_0x5c8028,_0x5423b6){return respondWithRpcPromise(_0xaa41('0x4f'),_0x5c8028['query'],routingClient)[_0xaa41('0xa')](findById(_0x5c8028[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x5423b6,null))[_0xaa41('0x1e')](handleError(_0x5423b6,null));};exports['faxQueues']=function(_0x5be61b,_0x339db3){return respondWithRpcPromise(_0xaa41('0x50'),_0x5be61b['query'],routingClient)['then'](respondWithResult(_0x339db3,null))[_0xaa41('0x1e')](handleError(_0x339db3,null));};exports[_0xaa41('0x51')]=function(_0x304694,_0xbeafb5){return respondWithRpcPromise(_0xaa41('0x50'),_0x304694['query'],routingClient)[_0xaa41('0xa')](findById(_0x304694['params']['id']))['then'](respondWithResult(_0xbeafb5,null))['catch'](handleError(_0xbeafb5,null));};exports[_0xaa41('0x52')]=function(_0x19ec63,_0x436362){return respondWithRpcPromise('FaxAccounts',_0x19ec63[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x436362,null))[_0xaa41('0x1e')](handleError(_0x436362,null));};exports[_0xaa41('0x53')]=function(_0x457515,_0x3ffbf8){return respondWithRpcPromise(_0xaa41('0x54'),_0x457515['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x3ffbf8,null))[_0xaa41('0x1e')](handleError(_0x3ffbf8,null));};exports[_0xaa41('0x55')]=function(_0x175ca9,_0x51ff61){return respondWithRpcPromise(_0xaa41('0x56'),_0x175ca9['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x51ff61,null))[_0xaa41('0x1e')](handleError(_0x51ff61,null));};exports[_0xaa41('0x57')]=function(_0x143ef0,_0x491cad){return respondWithRpcPromise(_0xaa41('0x58'),_0x143ef0[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x491cad,null))[_0xaa41('0x1e')](handleError(_0x491cad,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x140d78,_0x50197b){return respondWithRpcPromise(_0xaa41('0x58'),_0x140d78[_0xaa41('0x1a')],routingClient)['then'](function(_0x1ac05e){if(_0x140d78[_0xaa41('0x1a')][_0xaa41('0x59')]!==undefined){var _0x582d79=_(_0x1ac05e[_0xaa41('0x16')])[_0xaa41('0x5a')]([_0x140d78[_0xaa41('0x1a')][_0xaa41('0x59')],_0x140d78[_0xaa41('0x1d')]['id']])[_0xaa41('0x5b')](_0xaa41('0x5c'))['uniq']()[_0xaa41('0x5d')]();return _0x1ac05e[_0xaa41('0x16')][_0xaa41('0x5a')](function(_0x530982){return _0x582d79['indexOf'](_0x530982[_0xaa41('0x5c')])>-0x1;});}else{return _0x1ac05e[_0xaa41('0x16')]['filter'](function(_0x1ce957){return _0x1ce957[_0xaa41('0x5c')]===parseInt(_0x140d78['params']['id']);});}})[_0xaa41('0xa')](respondWithResult(_0x50197b,null))[_0xaa41('0x1e')](handleError(_0x50197b,null));};exports[_0xaa41('0x5e')]=function(_0xe8731,_0x46feb2){return respondWithRpcPromise(_0xaa41('0x5f'),_0xe8731[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x46feb2,null))['catch'](handleError(_0x46feb2,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x397526,_0x481db9){return respondWithRpcPromise(_0xaa41('0x60'),_0x397526[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x481db9,null))['catch'](handleError(_0x481db9,null));};exports[_0xaa41('0x61')]=function(_0x404c38,_0x2d7493){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x404c38[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x2d7493,null))['catch'](handleError(_0x2d7493,null));};exports[_0xaa41('0x62')]=function(_0x4de25c){return function(_0x53faf4,_0x3f6a2b){var _0x34d0e4,_0x5eded3;var _0x5a8cb0=_[_0xaa41('0x63')](_0x4de25c);var _0x1726ec=_0x4de25c===_0xaa41('0x64')?_0xaa41('0x65'):'Account';return db[_0x5a8cb0+_0xaa41('0x66')][_0xaa41('0x67')]({'raw':!![],'where':{'id':_0x53faf4[_0xaa41('0x1d')]['id']}})['then'](function(_0x1ad3aa){if(_[_0xaa41('0x15')](_0x1ad3aa)){throw new Error(_0x5a8cb0+_0xaa41('0x68'));}_0x34d0e4=_0x1ad3aa;return db[_0x5a8cb0+'Message'][_0xaa41('0x67')]({'where':{'id':_0x53faf4['body']['messageId']},'include':[{'model':db[_0x5a8cb0+_0xaa41('0x69')],'as':_0xaa41('0x69')},{'model':db[_0x5a8cb0+_0x1726ec],'as':'Account'}]});})[_0xaa41('0xa')](function(_0x9e8ebb){if(_[_0xaa41('0x15')](_0x9e8ebb)){throw new Error(_0x5a8cb0+'\x20Message\x20not\x20found');}_0x5eded3=_0x9e8ebb;return _0x9e8ebb[_0xaa41('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xaa41('0xa')](function(){var _0x1a2deb={'uniqueid':_0x4de25c+'.'+_0x5eded3['id']+'.'+_0x5eded3[_0xaa41('0x69')]['id'],'FromUserId':_0x53faf4[_0xaa41('0x38')]['id'],'type':'queue'};_0x1a2deb[_0x5a8cb0+_0xaa41('0x6b')]=_0x5eded3['id'];_0x1a2deb[_0x5a8cb0+'InteractionId']=_0x5eded3[_0xaa41('0x69')]['id'];_0x1a2deb[_0xaa41('0x6c')+_0x5a8cb0+_0x1726ec+'Id']=_0x5eded3[_0xaa41('0x6d')]['id'];_0x1a2deb['To'+_0x5a8cb0+_0xaa41('0x6e')]=_0x34d0e4['id'];return db[_0x5a8cb0+_0xaa41('0x6f')][_0xaa41('0x70')](_0x1a2deb);})[_0xaa41('0xa')](function(){return respondWithRpcPromise(_0xaa41('0x71'),{'channel':_0x4de25c,'interaction':_0x5eded3[_0xaa41('0x69')],'message':_0x5eded3,'account':_0x5eded3[_0xaa41('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaa41('0x72'),'appdata':_0x34d0e4['name']+','+(_0x5eded3[_0xaa41('0x6d')][_0xaa41('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xaa41('0xa')](respondWithResult(_0x3f6a2b,null))['catch'](handleError(_0x3f6a2b,null));};};exports[_0xaa41('0x74')]=function(_0xb44b1f,_0x472eb3){var _0x38d759,_0x2dc55e;if(_[_0xaa41('0x15')](_0xb44b1f[_0xaa41('0x24')]['channel'])){throw new Error(_0xaa41('0x75'));}var _0x1d50db=_0xb44b1f[_0xaa41('0x24')][_0xaa41('0x76')];var _0x585ce7=_[_0xaa41('0x63')](_0x1d50db);var _0x5c9beb=_0x1d50db===_0xaa41('0x64')?_0xaa41('0x65'):_0xaa41('0x6d');return db[_0xaa41('0x77')][_0xaa41('0x67')]({'raw':!![],'where':{'id':_0xb44b1f['params']['id'],'role':_0xaa41('0x3c')}})[_0xaa41('0xa')](function(_0x5819ac){if(_[_0xaa41('0x15')](_0x5819ac)){throw new Error(_0xaa41('0x78'));}_0x38d759=_0x5819ac;return db[_0x585ce7+_0xaa41('0x79')][_0xaa41('0x67')]({'where':{'id':_0xb44b1f[_0xaa41('0x24')][_0xaa41('0x7a')]},'include':[{'model':db[_0x585ce7+_0xaa41('0x69')],'as':_0xaa41('0x69')},{'model':db[_0x585ce7+_0x5c9beb],'as':'Account'}]});})[_0xaa41('0xa')](function(_0x39d3cc){if(_[_0xaa41('0x15')](_0x39d3cc)){throw new Error(_0x585ce7+_0xaa41('0x7b'));}_0x2dc55e=_0x39d3cc;return _0x39d3cc[_0xaa41('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xaa41('0xa')](function(){var _0x5489be={'uniqueid':_0x1d50db+'.'+_0x2dc55e['id']+'.'+_0x2dc55e['Interaction']['id'],'FromUserId':_0xb44b1f['user']['id'],'type':_0xaa41('0x72'),'ToUserId':_0x38d759['id']};_0x5489be[_0x585ce7+_0xaa41('0x6b')]=_0x2dc55e['id'];_0x5489be[_0x585ce7+'InteractionId']=_0x2dc55e[_0xaa41('0x69')]['id'];_0x5489be[_0xaa41('0x6c')+_0x585ce7+_0x5c9beb+'Id']=_0x2dc55e['Account']['id'];return db[_0x585ce7+_0xaa41('0x6f')][_0xaa41('0x70')](_0x5489be);})[_0xaa41('0xa')](function(){return respondWithRpcPromise(_0xaa41('0x71'),{'channel':_0x1d50db,'interaction':_0x2dc55e['Interaction'],'message':_0x2dc55e,'account':_0x2dc55e[_0xaa41('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x38d759[_0xaa41('0x13')]+','+(_0x2dc55e[_0xaa41('0x6d')][_0xaa41('0x7c')]||0x12c),'interval':_0xaa41('0x7d')}]},routingClient);})[_0xaa41('0xa')](respondWithResult(_0x472eb3,null))[_0xaa41('0x1e')](handleError(_0x472eb3,null));}; \ No newline at end of file +var _0xdc97=['agents','Agents','agentCapacity','user','interaction','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Interaction','update','MessageId','From','TransferReport','create','Start','queue','*,*,*,*','channel','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','InteractionId','bluebird','moment','lodash','../../mysqldb','api','jayson/promise','http','client','request','then','error','code','message','json','sendStatus','name','status','send','isNil','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels'];(function(_0x24d3ab,_0x1e5a77){var _0x3e8c74=function(_0x33c65d){while(--_0x33c65d){_0x24d3ab['push'](_0x24d3ab['shift']());}};_0x3e8c74(++_0x1e5a77);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1c545a,_0x344840){_0x1c545a=_0x1c545a-0x0;var _0x328902=_0xdc97[_0x1c545a];return _0x328902;};'use strict';var BPromise=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var _=require(_0x7dc9('0x2'));var util=require('util');var db=require(_0x7dc9('0x3'))['db'];var logger=require('../../config/logger')(_0x7dc9('0x4'));var jayson=require(_0x7dc9('0x5'));var amiClient=jayson['client'][_0x7dc9('0x6')]({'port':0x232a});var mailClient=jayson[_0x7dc9('0x7')][_0x7dc9('0x6')]({'port':0x232b});var routingClient=jayson[_0x7dc9('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){var _0x3318ea=_0x4b3229?_0x4b3229:amiClient;return _0x3318ea[_0x7dc9('0x8')](_0x2636ef,_0x4f91c7)[_0x7dc9('0x9')](function(_0x5ca05b){if(_0x5ca05b[_0x7dc9('0xa')]){if(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xb')]===0x1f4){return _0x23737d(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}return _0x2ff923(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}else{_0x2ff923(_0x5ca05b['result']);}})['catch'](function(_0x4be1c8){_0x23737d(_0x4be1c8);});});}function respondWithResult(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xc8;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['status'](_0x94c75a)[_0x7dc9('0xd')](_0x14e5db);}return _0x599ef1[_0x7dc9('0xe')](0x194);};}function handleError(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0x1f4;return function(_0x31d43d){logger[_0x7dc9('0xa')](_0x31d43d['stack']);if(_0x31d43d[_0x7dc9('0xf')]){delete _0x31d43d[_0x7dc9('0xf')];}_0xaadf2[_0x7dc9('0x10')](_0xf37bc7)[_0x7dc9('0x11')](_0x31d43d);};}function findById(_0x11606f){return function(_0xbe0437){if(!_[_0x7dc9('0x12')](_0x11606f)&&!_[_0x7dc9('0x12')](_0xbe0437)&&!_[_0x7dc9('0x12')](_0xbe0437['rows'])){return _[_0x7dc9('0x13')](_0xbe0437['rows'],function(_0x1f5906){return _0x1f5906['id']==_0x11606f;});}return null;};}exports[_0x7dc9('0x14')]=function(_0x5d61d7,_0x41f66e){return respondWithRpcPromise(_0x7dc9('0x15'),_0x5d61d7[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x41f66e,null))[_0x7dc9('0x17')](handleError(_0x41f66e,null));};exports[_0x7dc9('0x18')]=function(_0x2dad65,_0x2895f5){return respondWithRpcPromise(_0x7dc9('0x19'),_[_0x7dc9('0x1a')](_0x2dad65['query'],_0x2dad65['params']))[_0x7dc9('0x9')](respondWithResult(_0x2895f5,null))[_0x7dc9('0x17')](handleError(_0x2895f5,null));};exports['voiceChannelStopMixMonitor']=function(_0x349001,_0x27f7fa){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7dc9('0x1a')](_0x349001[_0x7dc9('0x16')],_0x349001[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x27f7fa,null))[_0x7dc9('0x17')](handleError(_0x27f7fa,null));};exports[_0x7dc9('0x1c')]=function(_0xf95336,_0x55a482){return respondWithRpcPromise('VoiceQueues',_0xf95336['query'])[_0x7dc9('0x9')](respondWithResult(_0x55a482,null))[_0x7dc9('0x17')](handleError(_0x55a482,null));};exports['showVoiceQueues']=function(_0x585eef,_0x47771b){return respondWithRpcPromise('VoiceQueues',_0x585eef[_0x7dc9('0x16')])[_0x7dc9('0x9')](findById(_0x585eef[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x47771b,null))[_0x7dc9('0x17')](handleError(_0x47771b,null));};exports[_0x7dc9('0x1d')]=function(_0x236d42,_0x229f8e){return respondWithRpcPromise(_0x7dc9('0x1e'),_[_0x7dc9('0x1a')](_0x236d42[_0x7dc9('0x1f')],_0x236d42[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x229f8e,null))['catch'](handleError(_0x229f8e,null));};exports['voiceQueuesPreview']=function(_0x49a4a5,_0x4a68f0){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x49a4a5['query'],_0x49a4a5[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4a68f0,null))[_0x7dc9('0x17')](handleError(_0x4a68f0,null));};exports[_0x7dc9('0x20')]=function(_0x3300ff,_0x154e22){return respondWithRpcPromise('VoiceQueuesChannels',_0x3300ff['query'])['then'](respondWithResult(_0x154e22,null))[_0x7dc9('0x17')](handleError(_0x154e22,null));};exports['voiceQueuesChannel']=function(_0x2b9ca0,_0x448e46){return respondWithRpcPromise(_0x7dc9('0x21'),_[_0x7dc9('0x1a')](_0x2b9ca0[_0x7dc9('0x16')],_0x2b9ca0[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x448e46,null))[_0x7dc9('0x17')](handleError(_0x448e46,null));};exports['voiceQueuesChannelHangup']=function(_0x2b56d7,_0x4cdec4){return respondWithRpcPromise(_0x7dc9('0x22'),_[_0x7dc9('0x1a')](_0x2b56d7[_0x7dc9('0x16')],_0x2b56d7[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x4cdec4,null))[_0x7dc9('0x17')](handleError(_0x4cdec4,null));};exports['voiceQueuesChannelRedirect']=function(_0x289560,_0x4f47af){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x7dc9('0x1a')](_0x289560[_0x7dc9('0x16')],_0x289560[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4f47af,null))['catch'](handleError(_0x4f47af,null));};exports[_0x7dc9('0x23')]=function(_0x183d87,_0x138f33){return respondWithRpcPromise(_0x7dc9('0x24'),_0x183d87[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x138f33,null))[_0x7dc9('0x17')](handleError(_0x138f33,null));};exports[_0x7dc9('0x25')]=function(_0x166906,_0x21bcfc){return respondWithRpcPromise(_0x7dc9('0x26'),_0x166906[_0x7dc9('0x16')])['then'](respondWithResult(_0x21bcfc,null))[_0x7dc9('0x17')](handleError(_0x21bcfc,null));};exports[_0x7dc9('0x27')]=function(_0x466b02,_0xfd2612){var _0x4bcdce;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')])[_0x7dc9('0x9')](function(_0x3876b6){_0x4bcdce=_0x3876b6;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')],routingClient);})['then'](function(_0x553230){return _[_0x7dc9('0x1a')]({},_0x553230,_0x4bcdce);})[_0x7dc9('0x9')](respondWithResult(_0xfd2612,null))['catch'](handleError(_0xfd2612,null));};exports[_0x7dc9('0x29')]=function(_0x4a37ec,_0x315d65){if(_0x4a37ec[_0x7dc9('0x1f')]&&_0x4a37ec[_0x7dc9('0x1f')]['interaction']&&_0x4a37ec[_0x7dc9('0x2a')]&&_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]){for(var _0x95513c in _0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')]){if(_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x7dc9('0x2c')](_0x95513c)){db['MemberReport']['findAll']({'where':{'channel':_0x95513c,'membername':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')],'type':_0x7dc9('0x2d'),'exitAt':null,'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c]&&_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')]?{'$notIn':_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x95513c]}:{'$ne':null}}})[_0x7dc9('0x9')](function(_0x1971c7){var _0x3c4d4c=moment()[_0x7dc9('0x2f')](_0x7dc9('0x30'));for(var _0x19957f=0x0,_0x575393=_0x1971c7[_0x7dc9('0x2e')];_0x19957f<_0x575393;_0x19957f+=0x1){_0x1971c7[_0x19957f][_0x7dc9('0x31')]({'exitAt':_0x3c4d4c});}});for(var _0x49bffe=0x0;_0x49bffe<_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')];_0x49bffe+=0x1){db['MemberReport'][_0x7dc9('0x32')]({'where':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'type':_0x7dc9('0x2d'),'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe],'exitAt':null},'defaults':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'interface':_[_0x7dc9('0x12')](_0x4a37ec['user'][_0x7dc9('0x33')])?util[_0x7dc9('0x2f')]('SIP/%s',_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]):_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x33')],'type':_0x7dc9('0x2d'),'enterAt':moment()[_0x7dc9('0x2f')](_0x7dc9('0x30')),'role':_0x7dc9('0x34'),'internal':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x35')],'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe]}});}}}}return respondWithRpcPromise(_0x7dc9('0x36'),{'id':_0x4a37ec['params']['id'],'capacity':_0x4a37ec[_0x7dc9('0x1f')]['capacity']},routingClient)['then'](respondWithResult(_0x315d65,null))[_0x7dc9('0x17')](handleError(_0x315d65,null));};exports[_0x7dc9('0x37')]=function(_0x40e382,_0x3902aa){return respondWithRpcPromise(_0x7dc9('0x38'),_0x40e382['query'])[_0x7dc9('0x9')](respondWithResult(_0x3902aa,null))[_0x7dc9('0x17')](handleError(_0x3902aa,null));};exports[_0x7dc9('0x39')]=function(_0x4a9b75,_0x341909){return respondWithRpcPromise(_0x7dc9('0x3a'),_0x4a9b75[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x341909,null))[_0x7dc9('0x17')](handleError(_0x341909,null));};exports[_0x7dc9('0x3b')]=function(_0x593132,_0x366b8b){return respondWithRpcPromise(_0x7dc9('0x3c'),_0x593132[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x17')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x3d')]=function(_0x31baf1,_0x24abb6){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x31baf1[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x24abb6,null))[_0x7dc9('0x17')](handleError(_0x24abb6,null));};exports['showChatQueues']=function(_0x1767b6,_0x39be46){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x1767b6[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x1767b6['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x39be46,null))[_0x7dc9('0x17')](handleError(_0x39be46,null));};exports[_0x7dc9('0x3f')]=function(_0x17ed6c,_0x2a1db8){return respondWithRpcPromise(_0x7dc9('0x40'),_0x17ed6c['query'],routingClient)['then'](respondWithResult(_0x2a1db8,null))['catch'](handleError(_0x2a1db8,null));};exports[_0x7dc9('0x41')]=function(_0x3daf33,_0x32a64f){return respondWithRpcPromise(_0x7dc9('0x40'),_0x3daf33['query'],routingClient)['then'](findById(_0x3daf33[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x32a64f,null))[_0x7dc9('0x17')](handleError(_0x32a64f,null));};exports[_0x7dc9('0x42')]=function(_0x2caf7f,_0x2272ef){return respondWithRpcPromise(_0x7dc9('0x43'),_0x2caf7f['query'],mailClient)[_0x7dc9('0x9')](respondWithResult(_0x2272ef,null))[_0x7dc9('0x17')](handleError(_0x2272ef,null));};exports[_0x7dc9('0x44')]=function(_0x1dad95,_0x4683b3){return respondWithRpcPromise('OpenchannelQueues',_0x1dad95[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x4683b3,null))[_0x7dc9('0x17')](handleError(_0x4683b3,null));};exports[_0x7dc9('0x45')]=function(_0x2454d7,_0x3a93c4){return respondWithRpcPromise(_0x7dc9('0x46'),_0x2454d7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x2454d7[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x3a93c4,null))[_0x7dc9('0x17')](handleError(_0x3a93c4,null));};exports[_0x7dc9('0x47')]=function(_0x5eee27,_0x3485b6){return respondWithRpcPromise('SmsQueues',_0x5eee27[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3485b6,null))['catch'](handleError(_0x3485b6,null));};exports[_0x7dc9('0x48')]=function(_0x24d2c7,_0x50e9a9){return respondWithRpcPromise(_0x7dc9('0x49'),_0x24d2c7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x24d2c7['params']['id']))['then'](respondWithResult(_0x50e9a9,null))[_0x7dc9('0x17')](handleError(_0x50e9a9,null));};exports[_0x7dc9('0x4a')]=function(_0x4ed60e,_0x3aba59){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x4ed60e[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3aba59,null))[_0x7dc9('0x17')](handleError(_0x3aba59,null));};exports[_0x7dc9('0x4c')]=function(_0x51b834,_0x35f31e){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x51b834[_0x7dc9('0x16')],routingClient)['then'](findById(_0x51b834['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x35f31e,null))[_0x7dc9('0x17')](handleError(_0x35f31e,null));};exports[_0x7dc9('0x4d')]=function(_0x2cf485,_0x59f3bd){return respondWithRpcPromise('FaxQueues',_0x2cf485[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x59f3bd,null))[_0x7dc9('0x17')](handleError(_0x59f3bd,null));};exports[_0x7dc9('0x4e')]=function(_0x5d211b,_0xea1728){return respondWithRpcPromise(_0x7dc9('0x4f'),_0x5d211b[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x5d211b[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0xea1728,null))[_0x7dc9('0x17')](handleError(_0xea1728,null));};exports['faxAccounts']=function(_0x2d7c33,_0x2cde0c){return respondWithRpcPromise('FaxAccounts',_0x2d7c33['query'])[_0x7dc9('0x9')](respondWithResult(_0x2cde0c,null))['catch'](handleError(_0x2cde0c,null));};exports[_0x7dc9('0x50')]=function(_0x466602,_0xd99a2){return respondWithRpcPromise(_0x7dc9('0x51'),_0x466602[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0xd99a2,null))[_0x7dc9('0x17')](handleError(_0xd99a2,null));};exports[_0x7dc9('0x52')]=function(_0x25f970,_0x30ce2f){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x25f970[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x30ce2f,null))[_0x7dc9('0x17')](handleError(_0x30ce2f,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x45c1b3,_0x585e42){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x45c1b3[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x585e42,null))['catch'](handleError(_0x585e42,null));};exports[_0x7dc9('0x53')]=function(_0x533738,_0x5a585a){return respondWithRpcPromise(_0x7dc9('0x54'),_0x533738[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](function(_0xb8be9){if(_0x533738['query'][_0x7dc9('0x55')]!==undefined){var _0xe944a4=_(_0xb8be9[_0x7dc9('0x56')])[_0x7dc9('0x57')]([_0x533738[_0x7dc9('0x16')][_0x7dc9('0x55')],_0x533738[_0x7dc9('0x1b')]['id']])[_0x7dc9('0x58')]('queue_id')['uniq']()[_0x7dc9('0x59')]();return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x1da142){return _0xe944a4[_0x7dc9('0x5a')](_0x1da142[_0x7dc9('0x5b')])>-0x1;});}else{return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x51a7e5){return _0x51a7e5['queue_id']===parseInt(_0x533738[_0x7dc9('0x1b')]['id']);});}})[_0x7dc9('0x9')](respondWithResult(_0x5a585a,null))[_0x7dc9('0x17')](handleError(_0x5a585a,null));};exports[_0x7dc9('0x5c')]=function(_0x5bc1c3,_0x2c3434){return respondWithRpcPromise(_0x7dc9('0x5d'),_0x5bc1c3['query'],routingClient)['then'](respondWithResult(_0x2c3434,null))[_0x7dc9('0x17')](handleError(_0x2c3434,null));};exports[_0x7dc9('0x5e')]=function(_0x49d7ef,_0x114078){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x49d7ef[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x114078,null))[_0x7dc9('0x17')](handleError(_0x114078,null));};exports['faxQueuesWaitingInteractions']=function(_0x33d68c,_0x3c7daf){return respondWithRpcPromise(_0x7dc9('0x5f'),_0x33d68c['query'],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3c7daf,null))['catch'](handleError(_0x3c7daf,null));};exports['queueNotify']=function(_0xa899){return function(_0x26244a,_0x31faa4){var _0x3657b6,_0x26d94e;var _0x56a00d=_[_0x7dc9('0x60')](_0xa899);var _0x1daf80=_0xa899===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x56a00d+'Queue'][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x26244a[_0x7dc9('0x1b')]['id']}})[_0x7dc9('0x9')](function(_0x200df7){if(_['isNil'](_0x200df7)){throw new Error(_0x56a00d+_0x7dc9('0x65'));}_0x3657b6=_0x200df7;return db[_0x56a00d+'Message']['findOne']({'where':{'id':_0x26244a[_0x7dc9('0x1f')]['messageId']},'include':[{'model':db[_0x56a00d+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x56a00d+_0x1daf80],'as':_0x7dc9('0x63')}]});})[_0x7dc9('0x9')](function(_0x38dccc){if(_[_0x7dc9('0x12')](_0x38dccc)){throw new Error(_0x56a00d+'\x20Message\x20not\x20found');}_0x26d94e=_0x38dccc;return _0x38dccc[_0x7dc9('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x1a4bfb={'uniqueid':_0xa899+'.'+_0x26d94e['id']+'.'+_0x26d94e[_0x7dc9('0x66')]['id'],'FromUserId':_0x26244a[_0x7dc9('0x2a')]['id'],'type':'queue'};_0x1a4bfb[_0x56a00d+_0x7dc9('0x68')]=_0x26d94e['id'];_0x1a4bfb[_0x56a00d+'InteractionId']=_0x26d94e[_0x7dc9('0x66')]['id'];_0x1a4bfb[_0x7dc9('0x69')+_0x56a00d+_0x1daf80+'Id']=_0x26d94e[_0x7dc9('0x63')]['id'];_0x1a4bfb['To'+_0x56a00d+'QueueId']=_0x3657b6['id'];return db[_0x56a00d+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x1a4bfb);})['then'](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0xa899,'interaction':_0x26d94e[_0x7dc9('0x66')],'message':_0x26d94e,'account':_0x26d94e[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x6d'),'appdata':_0x3657b6['name']+','+(_0x26d94e[_0x7dc9('0x63')]['queueTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})[_0x7dc9('0x9')](respondWithResult(_0x31faa4,null))[_0x7dc9('0x17')](handleError(_0x31faa4,null));};};exports['agentNotify']=function(_0x160bf0,_0x4588a7){var _0x23da2e,_0x568705;if(_['isNil'](_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x573fa9=_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')];var _0x5f3487=_[_0x7dc9('0x60')](_0x573fa9);var _0x5a44a1=_0x573fa9===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x7dc9('0x70')][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x160bf0[_0x7dc9('0x1b')]['id'],'role':'agent'}})[_0x7dc9('0x9')](function(_0x3fb268){if(_[_0x7dc9('0x12')](_0x3fb268)){throw new Error(_0x7dc9('0x71'));}_0x23da2e=_0x3fb268;return db[_0x5f3487+_0x7dc9('0x72')]['findOne']({'where':{'id':_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x73')]},'include':[{'model':db[_0x5f3487+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x5f3487+_0x5a44a1],'as':'Account'}]});})[_0x7dc9('0x9')](function(_0x54bd64){if(_['isNil'](_0x54bd64)){throw new Error(_0x5f3487+_0x7dc9('0x74'));}_0x568705=_0x54bd64;return _0x54bd64['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x19c880={'uniqueid':_0x573fa9+'.'+_0x568705['id']+'.'+_0x568705[_0x7dc9('0x66')]['id'],'FromUserId':_0x160bf0[_0x7dc9('0x2a')]['id'],'type':_0x7dc9('0x6d'),'ToUserId':_0x23da2e['id']};_0x19c880[_0x5f3487+_0x7dc9('0x68')]=_0x568705['id'];_0x19c880[_0x5f3487+_0x7dc9('0x75')]=_0x568705[_0x7dc9('0x66')]['id'];_0x19c880['From'+_0x5f3487+_0x5a44a1+'Id']=_0x568705[_0x7dc9('0x63')]['id'];return db[_0x5f3487+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x19c880);})[_0x7dc9('0x9')](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0x573fa9,'interaction':_0x568705['Interaction'],'message':_0x568705,'account':_0x568705[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x34'),'appdata':_0x23da2e[_0x7dc9('0xf')]+','+(_0x568705[_0x7dc9('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})['then'](respondWithResult(_0x4588a7,null))[_0x7dc9('0x17')](handleError(_0x4588a7,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 32b784e..f4db08d 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 _0x6b07=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','/:id','update'];(function(_0x4ede7a,_0x502b6a){var _0x1e68d0=function(_0x5b87d8){while(--_0x5b87d8){_0x4ede7a['push'](_0x4ede7a['shift']());}};_0x1e68d0(++_0x502b6a);}(_0x6b07,0xf3));var _0x76b0=function(_0x1c67a4,_0x41049a){_0x1c67a4=_0x1c67a4-0x0;var _0x1aace2=_0x6b07[_0x1c67a4];return _0x1aace2;};'use strict';var multer=require(_0x76b0('0x0'));var util=require(_0x76b0('0x1'));var path=require(_0x76b0('0x2'));var timeout=require(_0x76b0('0x3'));var express=require(_0x76b0('0x4'));var router=express[_0x76b0('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x76b0('0x6'));var config=require('../../config/environment');var controller=require(_0x76b0('0x7'));router[_0x76b0('0x8')]('/',auth[_0x76b0('0x9')](),controller[_0x76b0('0xa')]);router[_0x76b0('0x8')]('/:id',auth[_0x76b0('0x9')](),controller[_0x76b0('0xb')]);router[_0x76b0('0x8')](_0x76b0('0xc'),auth['isAuthenticated'](),controller[_0x76b0('0xd')]);router[_0x76b0('0xe')]('/',auth[_0x76b0('0x9')](),controller['create']);router['put'](_0x76b0('0xf'),auth[_0x76b0('0x9')](),controller[_0x76b0('0x10')]);router[_0x76b0('0x11')](_0x76b0('0xf'),auth[_0x76b0('0x9')](),controller[_0x76b0('0x12')]);module[_0x76b0('0x13')]=router; \ No newline at end of file +var _0xa44d=['show','run','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0xabd731,_0x43241d){var _0x9c7930=function(_0x1fc16){while(--_0x1fc16){_0xabd731['push'](_0xabd731['shift']());}};_0x9c7930(++_0x43241d);}(_0xa44d,0x72));var _0xda44=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xa44d[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0xda44('0x0'));var util=require(_0xda44('0x1'));var path=require(_0xda44('0x2'));var timeout=require(_0xda44('0x3'));var express=require(_0xda44('0x4'));var router=express[_0xda44('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xda44('0x6'));var config=require(_0xda44('0x7'));var controller=require(_0xda44('0x8'));router[_0xda44('0x9')]('/',auth[_0xda44('0xa')](),controller[_0xda44('0xb')]);router[_0xda44('0x9')]('/:id',auth[_0xda44('0xa')](),controller[_0xda44('0xc')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xda44('0xd')]);router[_0xda44('0xe')]('/',auth['isAuthenticated'](),controller[_0xda44('0xf')]);router[_0xda44('0x10')](_0xda44('0x11'),auth[_0xda44('0xa')](),controller[_0xda44('0x12')]);router[_0xda44('0x13')](_0xda44('0x11'),auth[_0xda44('0xa')](),controller['destroy']);module[_0xda44('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d1161c1..794da1b 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 _0xdec7=['ENUM','years','quarters','months','weeks','days','minutes','xlsx','csv','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0x3d2914,_0x1f266a){var _0x1dc061=function(_0x4bda16){while(--_0x4bda16){_0x3d2914['push'](_0x3d2914['shift']());}};_0x1dc061(++_0x1f266a);}(_0xdec7,0x13d));var _0x7dec=function(_0x48f939,_0x39b8b5){_0x48f939=_0x48f939-0x0;var _0x3f4442=_0xdec7[_0x48f939];return _0x3f4442;};'use strict';var Sequelize=require(_0x7dec('0x0'));module[_0x7dec('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7dec('0x2')]},'active':{'type':Sequelize[_0x7dec('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7dec('0x2')],'allowNull':![],'defaultValue':_0x7dec('0x4')},'startAt':{'type':Sequelize[_0x7dec('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7dec('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7dec('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7dec('0x7')](_0x7dec('0x8'),_0x7dec('0x9'),_0x7dec('0xa'),_0x7dec('0xb'),_0x7dec('0xc'),'hours',_0x7dec('0xd')),'allowNull':![],'defaultValue':_0x7dec('0xc')},'output':{'type':Sequelize[_0x7dec('0x7')]('csv','pdf',_0x7dec('0xe')),'allowNull':![],'defaultValue':_0x7dec('0xf')},'type':{'type':Sequelize[_0x7dec('0x7')]('custom',_0x7dec('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x7dec('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7dec('0x2')]},'cc':{'type':Sequelize[_0x7dec('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7dec('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x00ef=['days','hours','csv','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x00ef,0x126));var _0xf00e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x00ef[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xf00e('0x0'));module[_0xf00e('0x1')]={'name':{'type':Sequelize[_0xf00e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf00e('0x2')]},'active':{'type':Sequelize[_0xf00e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf00e('0x2')],'allowNull':![],'defaultValue':_0xf00e('0x4')},'startAt':{'type':Sequelize[_0xf00e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf00e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf00e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf00e('0x7')](_0xf00e('0x8'),_0xf00e('0x9'),_0xf00e('0xa'),_0xf00e('0xb'),_0xf00e('0xc'),_0xf00e('0xd'),'minutes'),'allowNull':![],'defaultValue':_0xf00e('0xc')},'output':{'type':Sequelize['ENUM'](_0xf00e('0xe'),'pdf',_0xf00e('0xf')),'allowNull':![],'defaultValue':_0xf00e('0xe')},'type':{'type':Sequelize[_0xf00e('0x7')](_0xf00e('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xf00e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf00e('0x2')]},'cc':{'type':Sequelize[_0xf00e('0x11')]},'bcc':{'type':Sequelize[_0xf00e('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xf00e('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 446990d..867d8c7 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 _0x5c39=['fields','attributes','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','catch','show','keys','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','model','query','filters','intersection'];(function(_0x4127cb,_0x508a52){var _0x2143af=function(_0x3639fd){while(--_0x3639fd){_0x4127cb['push'](_0x4127cb['shift']());}};_0x2143af(++_0x508a52);}(_0x5c39,0x6d));var _0x95c3=function(_0x2b588d,_0x347b8c){_0x2b588d=_0x2b588d-0x0;var _0x1e59fd=_0x5c39[_0x2b588d];return _0x1e59fd;};'use strict';var emlformat=require(_0x95c3('0x0'));var rimraf=require(_0x95c3('0x1'));var zipdir=require(_0x95c3('0x2'));var jsonpatch=require(_0x95c3('0x3'));var rp=require(_0x95c3('0x4'));var moment=require(_0x95c3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95c3('0x6'));var util=require(_0x95c3('0x7'));var path=require(_0x95c3('0x8'));var sox=require(_0x95c3('0x9'));var csv=require(_0x95c3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95c3('0xb'));var _=require(_0x95c3('0xc'));var squel=require(_0x95c3('0xd'));var crypto=require('crypto');var jsforce=require(_0x95c3('0xe'));var deskjs=require(_0x95c3('0xf'));var toCsv=require(_0x95c3('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x95c3('0x10'));var authService=require(_0x95c3('0x11'));var qs=require(_0x95c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95c3('0x13'));var logger=require(_0x95c3('0x14'))(_0x95c3('0x15'));var utils=require(_0x95c3('0x16'));var config=require(_0x95c3('0x17'));var licenseUtil=require(_0x95c3('0x18'));var db=require(_0x95c3('0x19'))['db'];function respondWithStatusCode(_0x4a3f6a,_0x3681ea){_0x3681ea=_0x3681ea||0xcc;return function(_0x168f0a){if(_0x168f0a){return _0x4a3f6a[_0x95c3('0x1a')](_0x3681ea);}return _0x4a3f6a[_0x95c3('0x1b')](_0x3681ea)['end']();};}function respondWithResult(_0x3d746f,_0x10ced5){_0x10ced5=_0x10ced5||0xc8;return function(_0x2ca52f){if(_0x2ca52f){return _0x3d746f['status'](_0x10ced5)[_0x95c3('0x1c')](_0x2ca52f);}};}function respondWithFilteredResult(_0x40f494,_0x676bc){return function(_0x3a7804){if(_0x3a7804){var _0x36ae4a=typeof _0x676bc['offset']===_0x95c3('0x1d')&&typeof _0x676bc[_0x95c3('0x1e')]===_0x95c3('0x1d');var _0x4925ea=_0x3a7804[_0x95c3('0x1f')];var _0x2a698d=_0x36ae4a?0x0:_0x676bc[_0x95c3('0x20')];var _0x6410a0=_0x36ae4a?_0x3a7804[_0x95c3('0x1f')]:_0x676bc['offset']+_0x676bc[_0x95c3('0x1e')];var _0x370e9b;if(_0x6410a0>=_0x4925ea){_0x6410a0=_0x4925ea;_0x370e9b=0xc8;}else{_0x370e9b=0xce;}_0x40f494[_0x95c3('0x1b')](_0x370e9b);return _0x40f494[_0x95c3('0x21')]('Content-Range',_0x2a698d+'-'+_0x6410a0+'/'+_0x4925ea)[_0x95c3('0x1c')](_0x3a7804);}return null;};}function patchUpdates(_0x46da75){return function(_0x110c88){try{jsonpatch[_0x95c3('0x22')](_0x110c88,_0x46da75,!![]);}catch(_0x7e4667){return BPromise['reject'](_0x7e4667);}return _0x110c88['save']();};}function saveUpdates(_0x3a4056,_0x3ef629){return function(_0x3cb511){if(_0x3cb511){return _0x3cb511[_0x95c3('0x23')](_0x3a4056)[_0x95c3('0x24')](function(_0x42d3b9){return _0x42d3b9;});}return null;};}function removeEntity(_0x952c0,_0x5a458d){return function(_0x5bc511){if(_0x5bc511){return _0x5bc511[_0x95c3('0x25')]()[_0x95c3('0x24')](function(){var _0x4291f4=_0x5bc511[_0x95c3('0x26')]({'plain':!![]});var _0x5cc3f9=_0x95c3('0x27');return db[_0x95c3('0x28')]['destroy']({'where':{'type':_0x5cc3f9,'resourceId':_0x4291f4['id']}})[_0x95c3('0x24')](function(){return _0x5bc511;});})['then'](function(){_0x952c0[_0x95c3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d556c,_0x44e435){return function(_0x10fc3e){if(!_0x10fc3e){_0x5d556c[_0x95c3('0x1a')](0x194);}return _0x10fc3e;};}function handleError(_0x569094,_0x111995){_0x111995=_0x111995||0x1f4;return function(_0x3ddc5d){logger[_0x95c3('0x29')](_0x3ddc5d[_0x95c3('0x2a')]);if(_0x3ddc5d[_0x95c3('0x2b')]){delete _0x3ddc5d[_0x95c3('0x2b')];}_0x569094['status'](_0x111995)[_0x95c3('0x2c')](_0x3ddc5d);};}exports[_0x95c3('0x2d')]=function(_0x38ec81,_0x7cd68c){var _0x25ac65={},_0xa827d6={},_0x23955b={'count':0x0,'rows':[]};var _0x272bd4=_[_0x95c3('0x2e')](db[_0x95c3('0x2f')][_0x95c3('0x30')],function(_0x2b93ba){return{'name':_0x2b93ba['fieldName'],'type':_0x2b93ba['type']['key']};});_0xa827d6[_0x95c3('0x31')]=_[_0x95c3('0x2e')](_0x272bd4,_0x95c3('0x2b'));_0xa827d6[_0x95c3('0x32')]=_['keys'](_0x38ec81['query']);_0xa827d6[_0x95c3('0x33')]=_[_0x95c3('0x34')](_0xa827d6[_0x95c3('0x31')],_0xa827d6[_0x95c3('0x32')]);_0x25ac65['attributes']=_[_0x95c3('0x34')](_0xa827d6[_0x95c3('0x31')],qs[_0x95c3('0x35')](_0x38ec81['query'][_0x95c3('0x35')]));_0x25ac65[_0x95c3('0x36')]=_0x25ac65['attributes'][_0x95c3('0x37')]?_0x25ac65['attributes']:_0xa827d6[_0x95c3('0x31')];if(!_0x38ec81['query'][_0x95c3('0x38')]('nolimit')){_0x25ac65[_0x95c3('0x1e')]=qs[_0x95c3('0x1e')](_0x38ec81['query'][_0x95c3('0x1e')]);_0x25ac65[_0x95c3('0x20')]=qs[_0x95c3('0x20')](_0x38ec81[_0x95c3('0x32')][_0x95c3('0x20')]);}_0x25ac65[_0x95c3('0x39')]=qs[_0x95c3('0x3a')](_0x38ec81[_0x95c3('0x32')][_0x95c3('0x3a')]);_0x25ac65[_0x95c3('0x3b')]=qs[_0x95c3('0x33')](_['pick'](_0x38ec81['query'],_0xa827d6[_0x95c3('0x33')]),_0x272bd4);if(_0x38ec81[_0x95c3('0x32')][_0x95c3('0x3c')]){_0x25ac65[_0x95c3('0x3b')]=_['merge'](_0x25ac65[_0x95c3('0x3b')],{'$or':_[_0x95c3('0x2e')](_0x272bd4,function(_0x517bd3){if(_0x517bd3[_0x95c3('0x3d')]!==_0x95c3('0x3e')){var _0x299aef={};_0x299aef[_0x517bd3['name']]={'$like':'%'+_0x38ec81[_0x95c3('0x32')][_0x95c3('0x3c')]+'%'};return _0x299aef;}})});}_0x25ac65=_[_0x95c3('0x3f')]({},_0x25ac65,_0x38ec81[_0x95c3('0x40')]);var _0x561bd4={'where':_0x25ac65['where']};return db[_0x95c3('0x2f')][_0x95c3('0x1f')](_0x561bd4)['then'](function(_0x584786){_0x23955b[_0x95c3('0x1f')]=_0x584786;if(_0x38ec81[_0x95c3('0x32')][_0x95c3('0x41')]){_0x25ac65['include']=[{'all':!![]}];}return db[_0x95c3('0x2f')]['findAll'](_0x25ac65);})[_0x95c3('0x24')](function(_0x6d3cc8){_0x23955b['rows']=_0x6d3cc8;return _0x23955b;})[_0x95c3('0x24')](respondWithFilteredResult(_0x7cd68c,_0x25ac65))[_0x95c3('0x42')](handleError(_0x7cd68c,null));};exports[_0x95c3('0x43')]=function(_0x5313dd,_0x53de02){var _0x1f99e3={'raw':![],'where':{'id':_0x5313dd['params']['id']}},_0x2275ce={};_0x2275ce[_0x95c3('0x31')]=_['keys'](db[_0x95c3('0x2f')]['rawAttributes']);_0x2275ce[_0x95c3('0x32')]=_[_0x95c3('0x44')](_0x5313dd[_0x95c3('0x32')]);_0x2275ce[_0x95c3('0x33')]=_[_0x95c3('0x34')](_0x2275ce[_0x95c3('0x31')],_0x2275ce[_0x95c3('0x32')]);_0x1f99e3[_0x95c3('0x36')]=_['intersection'](_0x2275ce['model'],qs['fields'](_0x5313dd[_0x95c3('0x32')][_0x95c3('0x35')]));_0x1f99e3[_0x95c3('0x36')]=_0x1f99e3[_0x95c3('0x36')][_0x95c3('0x37')]?_0x1f99e3[_0x95c3('0x36')]:_0x2275ce[_0x95c3('0x31')];if(_0x5313dd[_0x95c3('0x32')][_0x95c3('0x41')]){_0x1f99e3['include']=[{'all':!![]}];}_0x1f99e3=_[_0x95c3('0x3f')]({},_0x1f99e3,_0x5313dd[_0x95c3('0x40')]);return db[_0x95c3('0x2f')]['find'](_0x1f99e3)[_0x95c3('0x24')](handleEntityNotFound(_0x53de02,null))[_0x95c3('0x24')](respondWithResult(_0x53de02,null))[_0x95c3('0x42')](handleError(_0x53de02,null));};exports['create']=function(_0x13aaf0,_0x20573c){return db['Schedule']['create'](_0x13aaf0[_0x95c3('0x45')],{})['then'](function(_0x470ee6){var _0x230c4a=_0x13aaf0['user'][_0x95c3('0x26')]({'plain':!![]});if(!_0x230c4a)throw new Error(_0x95c3('0x46'));if(_0x230c4a[_0x95c3('0x47')]==='user'){var _0x557708=_0x470ee6['get']({'plain':!![]});var _0x2ab99d=_0x95c3('0x27');return db[_0x95c3('0x48')][_0x95c3('0x49')]({'where':{'name':_0x2ab99d,'userProfileId':_0x230c4a[_0x95c3('0x4a')]},'raw':!![]})[_0x95c3('0x24')](function(_0x5df177){if(_0x5df177&&_0x5df177[_0x95c3('0x4b')]===0x0){return db[_0x95c3('0x28')][_0x95c3('0x4c')]({'name':_0x557708[_0x95c3('0x2b')],'resourceId':_0x557708['id'],'type':_0x5df177[_0x95c3('0x2b')],'sectionId':_0x5df177['id']},{})[_0x95c3('0x24')](function(){return _0x470ee6;});}else{return _0x470ee6;}})[_0x95c3('0x42')](function(_0xa233cc){logger[_0x95c3('0x29')](_0x95c3('0x4d'),_0xa233cc);throw _0xa233cc;});}return _0x470ee6;})[_0x95c3('0x24')](respondWithResult(_0x20573c,0xc9))[_0x95c3('0x42')](handleError(_0x20573c,null));};exports[_0x95c3('0x23')]=function(_0x473370,_0x34f911){if(_0x473370[_0x95c3('0x45')]['id']){delete _0x473370['body']['id'];}return db['Schedule'][_0x95c3('0x49')]({'where':{'id':_0x473370[_0x95c3('0x4e')]['id']}})[_0x95c3('0x24')](handleEntityNotFound(_0x34f911,null))[_0x95c3('0x24')](saveUpdates(_0x473370['body'],null))[_0x95c3('0x24')](respondWithResult(_0x34f911,null))[_0x95c3('0x42')](handleError(_0x34f911,null));};exports[_0x95c3('0x25')]=function(_0x4cf87f,_0x2c36f4){return db['Schedule']['find']({'where':{'id':_0x4cf87f[_0x95c3('0x4e')]['id']}})[_0x95c3('0x24')](handleEntityNotFound(_0x2c36f4,null))[_0x95c3('0x24')](removeEntity(_0x2c36f4,null))[_0x95c3('0x42')](handleError(_0x2c36f4,null));};exports[_0x95c3('0x4f')]=function(_0x237dcc,_0x1fa3bf,_0x34c51f){var _0x1d4b18=require(_0x95c3('0x50'));return db[_0x95c3('0x2f')][_0x95c3('0x49')]({'where':{'id':_0x237dcc[_0x95c3('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1fa3bf,null))['then'](function(){_0x1d4b18[_0x95c3('0x4f')](_0x237dcc[_0x95c3('0x4e')]['id']);})[_0x95c3('0x24')](respondWithStatusCode(_0x1fa3bf,null))[_0x95c3('0x42')](handleError(_0x1fa3bf,null));}; \ No newline at end of file +var _0xf3bd=['../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','count','status','set','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','map','Schedule','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x4637fa,_0x47a241){var _0x6f7950=function(_0x59cf0b){while(--_0x59cf0b){_0x4637fa['push'](_0x4637fa['shift']());}};_0x6f7950(++_0x47a241);}(_0xf3bd,0x161));var _0xdf3b=function(_0x2377b8,_0x4f7adb){_0x2377b8=_0x2377b8-0x0;var _0xe9b877=_0xf3bd[_0x2377b8];return _0xe9b877;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf3b('0x0'));var jsonpatch=require(_0xdf3b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf3b('0x2'));var Mustache=require(_0xdf3b('0x3'));var util=require(_0xdf3b('0x4'));var path=require(_0xdf3b('0x5'));var sox=require(_0xdf3b('0x6'));var csv=require(_0xdf3b('0x7'));var ejs=require(_0xdf3b('0x8'));var fs=require('fs');var fs_extra=require(_0xdf3b('0x9'));var _=require(_0xdf3b('0xa'));var squel=require(_0xdf3b('0xb'));var crypto=require(_0xdf3b('0xc'));var jsforce=require(_0xdf3b('0xd'));var deskjs=require(_0xdf3b('0xe'));var toCsv=require(_0xdf3b('0x7'));var querystring=require(_0xdf3b('0xf'));var Papa=require(_0xdf3b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdf3b('0x11'));var as=require(_0xdf3b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf3b('0x13'));var utils=require(_0xdf3b('0x14'));var config=require(_0xdf3b('0x15'));var licenseUtil=require(_0xdf3b('0x16'));var db=require(_0xdf3b('0x17'))['db'];function respondWithStatusCode(_0xddd2c1,_0x18f1db){_0x18f1db=_0x18f1db||0xcc;return function(_0xefde15){if(_0xefde15){return _0xddd2c1[_0xdf3b('0x18')](_0x18f1db);}return _0xddd2c1['status'](_0x18f1db)['end']();};}function respondWithResult(_0x184781,_0x43763d){_0x43763d=_0x43763d||0xc8;return function(_0x45c41e){if(_0x45c41e){return _0x184781['status'](_0x43763d)[_0xdf3b('0x19')](_0x45c41e);}};}function respondWithFilteredResult(_0x590e02,_0x2ee055){return function(_0x40b7da){if(_0x40b7da){var _0xba510e=typeof _0x2ee055[_0xdf3b('0x1a')]==='undefined'&&typeof _0x2ee055[_0xdf3b('0x1b')]==='undefined';var _0x5b1340=_0x40b7da[_0xdf3b('0x1c')];var _0x44dff6=_0xba510e?0x0:_0x2ee055[_0xdf3b('0x1a')];var _0xdaf649=_0xba510e?_0x40b7da['count']:_0x2ee055[_0xdf3b('0x1a')]+_0x2ee055[_0xdf3b('0x1b')];var _0x1a6b07;if(_0xdaf649>=_0x5b1340){_0xdaf649=_0x5b1340;_0x1a6b07=0xc8;}else{_0x1a6b07=0xce;}_0x590e02[_0xdf3b('0x1d')](_0x1a6b07);return _0x590e02[_0xdf3b('0x1e')]('Content-Range',_0x44dff6+'-'+_0xdaf649+'/'+_0x5b1340)[_0xdf3b('0x19')](_0x40b7da);}return null;};}function patchUpdates(_0x569804){return function(_0x10f134){try{jsonpatch['apply'](_0x10f134,_0x569804,!![]);}catch(_0x35f27f){return BPromise['reject'](_0x35f27f);}return _0x10f134['save']();};}function saveUpdates(_0x52b326,_0x3dc37b){return function(_0x13afb2){if(_0x13afb2){return _0x13afb2[_0xdf3b('0x1f')](_0x52b326)[_0xdf3b('0x20')](function(_0x4d62c6){return _0x4d62c6;});}return null;};}function removeEntity(_0x545b51,_0x5f37e4){return function(_0xebebd0){if(_0xebebd0){return _0xebebd0[_0xdf3b('0x21')]()[_0xdf3b('0x20')](function(){var _0xa0bd11=_0xebebd0[_0xdf3b('0x22')]({'plain':!![]});var _0x56c70c=_0xdf3b('0x23');return db[_0xdf3b('0x24')][_0xdf3b('0x21')]({'where':{'type':_0x56c70c,'resourceId':_0xa0bd11['id']}})[_0xdf3b('0x20')](function(){return _0xebebd0;});})[_0xdf3b('0x20')](function(){_0x545b51[_0xdf3b('0x1d')](0xcc)[_0xdf3b('0x25')]();});}};}function handleEntityNotFound(_0x457d5a,_0x1f01bb){return function(_0x1d0916){if(!_0x1d0916){_0x457d5a['sendStatus'](0x194);}return _0x1d0916;};}function handleError(_0x4925b4,_0x230cfa){_0x230cfa=_0x230cfa||0x1f4;return function(_0x1d4f00){logger[_0xdf3b('0x26')](_0x1d4f00[_0xdf3b('0x27')]);if(_0x1d4f00[_0xdf3b('0x28')]){delete _0x1d4f00[_0xdf3b('0x28')];}_0x4925b4['status'](_0x230cfa)['send'](_0x1d4f00);};}exports['index']=function(_0x4d49b8,_0x4bd427){var _0x2bccf1={},_0x1178cd={},_0x1296a6={'count':0x0,'rows':[]};var _0x4beb2c=_[_0xdf3b('0x29')](db[_0xdf3b('0x2a')][_0xdf3b('0x2b')],function(_0x247532){return{'name':_0x247532[_0xdf3b('0x2c')],'type':_0x247532[_0xdf3b('0x2d')]['key']};});_0x1178cd[_0xdf3b('0x2e')]=_[_0xdf3b('0x29')](_0x4beb2c,_0xdf3b('0x28'));_0x1178cd[_0xdf3b('0x2f')]=_['keys'](_0x4d49b8['query']);_0x1178cd[_0xdf3b('0x30')]=_[_0xdf3b('0x31')](_0x1178cd[_0xdf3b('0x2e')],_0x1178cd[_0xdf3b('0x2f')]);_0x2bccf1[_0xdf3b('0x32')]=_[_0xdf3b('0x31')](_0x1178cd[_0xdf3b('0x2e')],qs['fields'](_0x4d49b8['query'][_0xdf3b('0x33')]));_0x2bccf1['attributes']=_0x2bccf1['attributes'][_0xdf3b('0x34')]?_0x2bccf1[_0xdf3b('0x32')]:_0x1178cd[_0xdf3b('0x2e')];if(!_0x4d49b8['query'][_0xdf3b('0x35')]('nolimit')){_0x2bccf1[_0xdf3b('0x1b')]=qs[_0xdf3b('0x1b')](_0x4d49b8['query'][_0xdf3b('0x1b')]);_0x2bccf1[_0xdf3b('0x1a')]=qs['offset'](_0x4d49b8[_0xdf3b('0x2f')][_0xdf3b('0x1a')]);}_0x2bccf1[_0xdf3b('0x36')]=qs['sort'](_0x4d49b8['query']['sort']);_0x2bccf1[_0xdf3b('0x37')]=qs[_0xdf3b('0x30')](_['pick'](_0x4d49b8[_0xdf3b('0x2f')],_0x1178cd[_0xdf3b('0x30')]),_0x4beb2c);if(_0x4d49b8['query']['filter']){_0x2bccf1[_0xdf3b('0x37')]=_[_0xdf3b('0x38')](_0x2bccf1['where'],{'$or':_['map'](_0x4beb2c,function(_0x5c1fa2){if(_0x5c1fa2[_0xdf3b('0x2d')]!=='VIRTUAL'){var _0x2981b2={};_0x2981b2[_0x5c1fa2[_0xdf3b('0x28')]]={'$like':'%'+_0x4d49b8[_0xdf3b('0x2f')]['filter']+'%'};return _0x2981b2;}})});}_0x2bccf1=_[_0xdf3b('0x38')]({},_0x2bccf1,_0x4d49b8[_0xdf3b('0x39')]);var _0x38ff73={'where':_0x2bccf1[_0xdf3b('0x37')]};return db[_0xdf3b('0x2a')][_0xdf3b('0x1c')](_0x38ff73)[_0xdf3b('0x20')](function(_0x154136){_0x1296a6[_0xdf3b('0x1c')]=_0x154136;if(_0x4d49b8[_0xdf3b('0x2f')][_0xdf3b('0x3a')]){_0x2bccf1[_0xdf3b('0x3b')]=[{'all':!![]}];}return db['Schedule'][_0xdf3b('0x3c')](_0x2bccf1);})[_0xdf3b('0x20')](function(_0x2bba8f){_0x1296a6['rows']=_0x2bba8f;return _0x1296a6;})[_0xdf3b('0x20')](respondWithFilteredResult(_0x4bd427,_0x2bccf1))[_0xdf3b('0x3d')](handleError(_0x4bd427,null));};exports[_0xdf3b('0x3e')]=function(_0x1ecbd8,_0x2a8efe){var _0x235e35={'raw':![],'where':{'id':_0x1ecbd8[_0xdf3b('0x3f')]['id']}},_0x5dddda={};_0x5dddda[_0xdf3b('0x2e')]=_[_0xdf3b('0x40')](db[_0xdf3b('0x2a')][_0xdf3b('0x2b')]);_0x5dddda[_0xdf3b('0x2f')]=_[_0xdf3b('0x40')](_0x1ecbd8['query']);_0x5dddda[_0xdf3b('0x30')]=_['intersection'](_0x5dddda[_0xdf3b('0x2e')],_0x5dddda[_0xdf3b('0x2f')]);_0x235e35[_0xdf3b('0x32')]=_[_0xdf3b('0x31')](_0x5dddda[_0xdf3b('0x2e')],qs[_0xdf3b('0x33')](_0x1ecbd8[_0xdf3b('0x2f')][_0xdf3b('0x33')]));_0x235e35['attributes']=_0x235e35['attributes'][_0xdf3b('0x34')]?_0x235e35[_0xdf3b('0x32')]:_0x5dddda[_0xdf3b('0x2e')];if(_0x1ecbd8['query']['includeAll']){_0x235e35[_0xdf3b('0x3b')]=[{'all':!![]}];}_0x235e35=_[_0xdf3b('0x38')]({},_0x235e35,_0x1ecbd8['options']);return db[_0xdf3b('0x2a')][_0xdf3b('0x41')](_0x235e35)[_0xdf3b('0x20')](handleEntityNotFound(_0x2a8efe,null))[_0xdf3b('0x20')](respondWithResult(_0x2a8efe,null))[_0xdf3b('0x3d')](handleError(_0x2a8efe,null));};exports[_0xdf3b('0x42')]=function(_0x2cb724,_0x1d4699){return db['Schedule'][_0xdf3b('0x42')](_0x2cb724[_0xdf3b('0x43')],{})[_0xdf3b('0x20')](function(_0x27ae24){var _0x5802d8=_0x2cb724[_0xdf3b('0x44')]['get']({'plain':!![]});if(!_0x5802d8)throw new Error(_0xdf3b('0x45'));if(_0x5802d8[_0xdf3b('0x46')]==='user'){var _0x11d5f4=_0x27ae24['get']({'plain':!![]});var _0x5a4194=_0xdf3b('0x23');return db[_0xdf3b('0x47')][_0xdf3b('0x41')]({'where':{'name':_0x5a4194,'userProfileId':_0x5802d8['userProfileId']},'raw':!![]})[_0xdf3b('0x20')](function(_0x92fc25){if(_0x92fc25&&_0x92fc25['autoAssociation']===0x0){return db['UserProfileResource'][_0xdf3b('0x42')]({'name':_0x11d5f4[_0xdf3b('0x28')],'resourceId':_0x11d5f4['id'],'type':_0x92fc25[_0xdf3b('0x28')],'sectionId':_0x92fc25['id']},{})[_0xdf3b('0x20')](function(){return _0x27ae24;});}else{return _0x27ae24;}})['catch'](function(_0xdf1bed){logger[_0xdf3b('0x26')](_0xdf3b('0x48'),_0xdf1bed);throw _0xdf1bed;});}return _0x27ae24;})['then'](respondWithResult(_0x1d4699,0xc9))['catch'](handleError(_0x1d4699,null));};exports[_0xdf3b('0x1f')]=function(_0x4bac9b,_0x3b0ebb){if(_0x4bac9b[_0xdf3b('0x43')]['id']){delete _0x4bac9b[_0xdf3b('0x43')]['id'];}return db[_0xdf3b('0x2a')][_0xdf3b('0x41')]({'where':{'id':_0x4bac9b[_0xdf3b('0x3f')]['id']}})[_0xdf3b('0x20')](handleEntityNotFound(_0x3b0ebb,null))[_0xdf3b('0x20')](saveUpdates(_0x4bac9b[_0xdf3b('0x43')],null))[_0xdf3b('0x20')](respondWithResult(_0x3b0ebb,null))[_0xdf3b('0x3d')](handleError(_0x3b0ebb,null));};exports[_0xdf3b('0x21')]=function(_0xac220f,_0x3a8019){return db['Schedule']['find']({'where':{'id':_0xac220f[_0xdf3b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3a8019,null))[_0xdf3b('0x20')](removeEntity(_0x3a8019,null))[_0xdf3b('0x3d')](handleError(_0x3a8019,null));};exports['run']=function(_0x176fd5,_0x402b2f,_0x56c84d){var _0x4ba2b1=require(_0xdf3b('0x49'));return db['Schedule'][_0xdf3b('0x41')]({'where':{'id':_0x176fd5[_0xdf3b('0x3f')]['id']},'raw':!![]})[_0xdf3b('0x20')](handleEntityNotFound(_0x402b2f,null))['then'](function(){_0x4ba2b1[_0xdf3b('0x4a')](_0x176fd5[_0xdf3b('0x3f')]['id']);})[_0xdf3b('0x20')](respondWithStatusCode(_0x402b2f,null))['catch'](handleError(_0x402b2f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 5b07aab..253f583 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 _0x37b6=['Schedule','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./schedule.attributes','exports','define'];(function(_0x134350,_0x4052ce){var _0x23ba4e=function(_0x532dd3){while(--_0x532dd3){_0x134350['push'](_0x134350['shift']());}};_0x23ba4e(++_0x4052ce);}(_0x37b6,0x1a3));var _0x637b=function(_0x1e226a,_0x1b9913){_0x1e226a=_0x1e226a-0x0;var _0x22a266=_0x37b6[_0x1e226a];return _0x22a266;};'use strict';var _=require('lodash');var util=require(_0x637b('0x0'));var logger=require(_0x637b('0x1'))(_0x637b('0x2'));var moment=require(_0x637b('0x3'));var BPromise=require(_0x637b('0x4'));var rp=require(_0x637b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x637b('0x6'));var attributes=require(_0x637b('0x7'));module[_0x637b('0x8')]=function(_0x1b6686,_0x5c37dd){return _0x1b6686[_0x637b('0x9')](_0x637b('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33d7=['request-promise','path','../../config/environment','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird'];(function(_0x4617ce,_0x1dc445){var _0x51ca6e=function(_0x26f542){while(--_0x26f542){_0x4617ce['push'](_0x4617ce['shift']());}};_0x51ca6e(++_0x1dc445);}(_0x33d7,0x15b));var _0x733d=function(_0x1b348d,_0x2ab7db){_0x1b348d=_0x1b348d-0x0;var _0x195fd2=_0x33d7[_0x1b348d];return _0x195fd2;};'use strict';var _=require(_0x733d('0x0'));var util=require(_0x733d('0x1'));var logger=require(_0x733d('0x2'))(_0x733d('0x3'));var moment=require('moment');var BPromise=require(_0x733d('0x4'));var rp=require(_0x733d('0x5'));var fs=require('fs');var path=require(_0x733d('0x6'));var rimraf=require('rimraf');var config=require(_0x733d('0x7'));var attributes=require('./schedule.attributes');module['exports']=function(_0x141738,_0x7d4951){return _0x141738[_0x733d('0x8')](_0x733d('0x9'),attributes,{'tableName':_0x733d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index c19454f..a8a4934 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 _0x0b33=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','info'];(function(_0x5227ab,_0x514da4){var _0x3dc702=function(_0x592b15){while(--_0x592b15){_0x5227ab['push'](_0x5227ab['shift']());}};_0x3dc702(++_0x514da4);}(_0x0b33,0xb2));var _0x30b3=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x0b33[_0x52e68e];return _0x3211a4;};'use strict';var _=require('lodash');var util=require(_0x30b3('0x0'));var moment=require(_0x30b3('0x1'));var BPromise=require(_0x30b3('0x2'));var rs=require(_0x30b3('0x3'));var fs=require('fs');var Redis=require(_0x30b3('0x4'));var db=require(_0x30b3('0x5'))['db'];var utils=require(_0x30b3('0x6'));var logger=require(_0x30b3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x30b3('0x8')][_0x30b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2be29c,_0xcf5ebb,_0x2b1781){return new BPromise(function(_0x2b298f,_0x1be6c6){return client['request'](_0x2be29c,_0x2b1781)['then'](function(_0x5844d4){logger[_0x30b3('0xa')](_0x30b3('0xb'),_0xcf5ebb,_0x30b3('0xc'));logger[_0x30b3('0xd')](_0x30b3('0xe'),_0xcf5ebb,_0x30b3('0xc'),JSON[_0x30b3('0xf')](_0x5844d4));if(_0x5844d4[_0x30b3('0x10')]){if(_0x5844d4[_0x30b3('0x10')][_0x30b3('0x11')]===0x1f4){logger[_0x30b3('0x10')](_0x30b3('0xb'),_0xcf5ebb,_0x5844d4['error'][_0x30b3('0x12')]);return _0x1be6c6(_0x5844d4[_0x30b3('0x10')][_0x30b3('0x12')]);}logger[_0x30b3('0x10')]('Schedule,\x20%s,\x20%s',_0xcf5ebb,_0x5844d4[_0x30b3('0x10')][_0x30b3('0x12')]);return _0x2b298f(_0x5844d4[_0x30b3('0x10')][_0x30b3('0x12')]);}else{logger[_0x30b3('0xa')](_0x30b3('0xb'),_0xcf5ebb,_0x30b3('0xc'));_0x2b298f(_0x5844d4[_0x30b3('0x13')]['message']);}})[_0x30b3('0x14')](function(_0x1e692){logger['error']('Schedule,\x20%s,\x20%s',_0xcf5ebb,_0x1e692);_0x1be6c6(_0x1e692);});});} \ No newline at end of file +var _0x407a=['../../config/logger','rpc','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','ioredis'];(function(_0x4cc59b,_0xac7281){var _0x5ac3a2=function(_0x52199b){while(--_0x52199b){_0x4cc59b['push'](_0x4cc59b['shift']());}};_0x5ac3a2(++_0xac7281);}(_0x407a,0x10b));var _0xa407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x407a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa407('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa407('0x1'));var fs=require('fs');var Redis=require(_0xa407('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa407('0x3'))(_0xa407('0x4'));var config=require('../../config/environment');var jayson=require(_0xa407('0x5'));var client=jayson['client'][_0xa407('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1921bc,_0x43f3a5,_0x19ec83){return new BPromise(function(_0x140519,_0x28fa61){return client['request'](_0x1921bc,_0x19ec83)[_0xa407('0x7')](function(_0x1ec02d){logger[_0xa407('0x8')](_0xa407('0x9'),_0x43f3a5,_0xa407('0xa'));logger[_0xa407('0xb')](_0xa407('0xc'),_0x43f3a5,_0xa407('0xa'),JSON[_0xa407('0xd')](_0x1ec02d));if(_0x1ec02d[_0xa407('0xe')]){if(_0x1ec02d['error'][_0xa407('0xf')]===0x1f4){logger[_0xa407('0xe')](_0xa407('0x9'),_0x43f3a5,_0x1ec02d['error']['message']);return _0x28fa61(_0x1ec02d['error'][_0xa407('0x10')]);}logger[_0xa407('0xe')](_0xa407('0x9'),_0x43f3a5,_0x1ec02d[_0xa407('0xe')][_0xa407('0x10')]);return _0x140519(_0x1ec02d['error'][_0xa407('0x10')]);}else{logger[_0xa407('0x8')](_0xa407('0x9'),_0x43f3a5,_0xa407('0xa'));_0x140519(_0x1ec02d['result']['message']);}})[_0xa407('0x11')](function(_0xcb620e){logger[_0xa407('0xe')]('Schedule,\x20%s,\x20%s',_0x43f3a5,_0xcb620e);_0x28fa61(_0xcb620e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 4bfcbd5..153d7d0 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 _0x9057=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x9057,0x119));var _0x7905=function(_0x330d1f,_0x47c710){_0x330d1f=_0x330d1f-0x0;var _0x1df784=_0x9057[_0x330d1f];return _0x1df784;};'use strict';var multer=require('multer');var util=require(_0x7905('0x0'));var path=require('path');var timeout=require(_0x7905('0x1'));var express=require(_0x7905('0x2'));var router=express[_0x7905('0x3')]();var fs_extra=require(_0x7905('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7905('0x5'));var config=require(_0x7905('0x6'));var controller=require(_0x7905('0x7'));router[_0x7905('0x8')]('/',auth[_0x7905('0x9')](),controller[_0x7905('0xa')]);router[_0x7905('0x8')](_0x7905('0xb'),auth[_0x7905('0x9')](),controller[_0x7905('0xc')]);router[_0x7905('0x8')]('/:id',auth[_0x7905('0x9')](),controller[_0x7905('0xd')]);router[_0x7905('0x8')](_0x7905('0xe'),auth['isAuthenticated'](),controller[_0x7905('0xf')]);router['post']('/',auth[_0x7905('0x9')](),controller[_0x7905('0x10')]);router[_0x7905('0x11')]('/:id',auth[_0x7905('0x9')](),controller[_0x7905('0x12')]);router[_0x7905('0x13')]('/:id',auth[_0x7905('0x9')](),controller[_0x7905('0x14')]);module[_0x7905('0x15')]=router; \ No newline at end of file +var _0xa1a6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id/download','download','post','create','put','/:id','delete'];(function(_0x1112bf,_0x43c73a){var _0x2f497c=function(_0x5d1c20){while(--_0x5d1c20){_0x1112bf['push'](_0x1112bf['shift']());}};_0x2f497c(++_0x43c73a);}(_0xa1a6,0x172));var _0x6a1a=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xa1a6[_0x5eb22e];return _0x27fed5;};'use strict';var multer=require(_0x6a1a('0x0'));var util=require(_0x6a1a('0x1'));var path=require(_0x6a1a('0x2'));var timeout=require(_0x6a1a('0x3'));var express=require(_0x6a1a('0x4'));var router=express[_0x6a1a('0x5')]();var fs_extra=require(_0x6a1a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6a1a('0x7'));var config=require(_0x6a1a('0x8'));var controller=require(_0x6a1a('0x9'));router[_0x6a1a('0xa')]('/',auth[_0x6a1a('0xb')](),controller['index']);router[_0x6a1a('0xa')](_0x6a1a('0xc'),auth['isAuthenticated'](),controller[_0x6a1a('0xd')]);router[_0x6a1a('0xa')]('/:id',auth[_0x6a1a('0xb')](),controller['show']);router[_0x6a1a('0xa')](_0x6a1a('0xe'),auth[_0x6a1a('0xb')](),controller[_0x6a1a('0xf')]);router[_0x6a1a('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1a('0x11')]);router[_0x6a1a('0x12')](_0x6a1a('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x6a1a('0x14')](_0x6a1a('0x13'),auth[_0x6a1a('0xb')](),controller[_0x6a1a('0x15')]);module[_0x6a1a('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7715660..970c7a2 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 _0x0c6b=['closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','startedAt','subtract'];(function(_0x280d43,_0x2e7450){var _0x14446d=function(_0xf08837){while(--_0xf08837){_0x280d43['push'](_0x280d43['shift']());}};_0x14446d(++_0x2e7450);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x38ba9e,_0x21ceaa){_0x38ba9e=_0x38ba9e-0x0;var _0xfe5632=_0x0c6b[_0x38ba9e];return _0xfe5632;};'use strict';var Sequelize=require(_0xb0c6('0x0'));var moment=require('moment');var path=require(_0xb0c6('0x1'));var config=require(_0xb0c6('0x2'));module[_0xb0c6('0x3')]={'format':{'type':Sequelize[_0xb0c6('0x4')],'get':function(){return this[_0xb0c6('0x5')](_0xb0c6('0x6'))?path[_0xb0c6('0x7')](this[_0xb0c6('0x5')](_0xb0c6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb0c6('0x8')]},'channel':{'type':Sequelize[_0xb0c6('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x590ef9){var _0x5ec174=_0x590ef9['replace'](/\\/g,'/');this[_0xb0c6('0x9')](_0xb0c6('0x6'),_0x5ec174);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x2beb18){this[_0xb0c6('0x9')](_0xb0c6('0xa'),moment()[_0xb0c6('0xb')](_0x2beb18,'ms'));this[_0xb0c6('0x9')](_0xb0c6('0xc'),moment());this[_0xb0c6('0x9')](_0xb0c6('0xd'),_0x2beb18);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb0c6('0x5')]('startedAt'))[_0xb0c6('0xe')](_0xb0c6('0xf'))[_0xb0c6('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb0c6('0x5')](_0xb0c6('0xc')))[_0xb0c6('0xe')](_0xb0c6('0xf'))[_0xb0c6('0x10')]();}},'createdAt':{'type':Sequelize[_0xb0c6('0x11')],'get':function(){return moment(this[_0xb0c6('0x5')](_0xb0c6('0x12')))['format'](_0xb0c6('0xf'))[_0xb0c6('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb0c6('0x11')],'get':function(){return moment(this[_0xb0c6('0x5')]('updatedAt'))[_0xb0c6('0xe')](_0xb0c6('0xf'))[_0xb0c6('0x10')]();}}}; \ No newline at end of file +var _0x887b=['subtract','closedAt','duration','DATE','toString','format','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','INTEGER','startedAt'];(function(_0x4de8d0,_0x5064d4){var _0x3b01ce=function(_0x228651){while(--_0x228651){_0x4de8d0['push'](_0x4de8d0['shift']());}};_0x3b01ce(++_0x5064d4);}(_0x887b,0x185));var _0xb887=function(_0x43c735,_0x11c07e){_0x43c735=_0x43c735-0x0;var _0x440265=_0x887b[_0x43c735];return _0x440265;};'use strict';var Sequelize=require(_0xb887('0x0'));var moment=require(_0xb887('0x1'));var path=require(_0xb887('0x2'));var config=require(_0xb887('0x3'));module[_0xb887('0x4')]={'format':{'type':Sequelize[_0xb887('0x5')],'get':function(){return this[_0xb887('0x6')](_0xb887('0x7'))?path[_0xb887('0x8')](this['getDataValue'](_0xb887('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x332507){var _0x353587=_0x332507['replace'](/\\/g,'/');this['setDataValue'](_0xb887('0x7'),_0x353587);}},'rating':{'type':Sequelize[_0xb887('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x49962f){this['setDataValue'](_0xb887('0xa'),moment()[_0xb887('0xb')](_0x49962f,'ms'));this['setDataValue'](_0xb887('0xc'),moment());this['setDataValue'](_0xb887('0xd'),_0x49962f);}},'startedAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0xa')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb887('0xf')]();}},'closedAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0xc')))[_0xb887('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb887('0xf')]();}},'createdAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0x11')))[_0xb887('0x10')](_0xb887('0x12'))[_0xb887('0xf')]();}},'updatedAt':{'type':Sequelize[_0xb887('0xe')],'get':function(){return moment(this[_0xb887('0x6')](_0xb887('0x13')))[_0xb887('0x10')](_0xb887('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e2f1b98..09eb416 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 _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x407937,_0x2ad7ca){_0x407937=_0x407937-0x0;var _0x278809=_0xdbf5[_0x407937];return _0x278809;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file +var _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x12295c,_0x4d6d39){var _0x3e9c3b=function(_0x3dd87b){while(--_0x3dd87b){_0x12295c['push'](_0x12295c['shift']());}};_0x3e9c3b(++_0x4d6d39);}(_0xed1f,0x6a));var _0xfed1=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xed1f[_0x576170];return _0x397c70;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 31907d0..96eb7ae 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 _0x54a4=['rimraf','../../config/environment','./screenRecording.attributes','define','interactionid','lodash','util','api','moment','bluebird','path'];(function(_0x4dfd8a,_0x476a02){var _0x5aeac9=function(_0x3aa276){while(--_0x3aa276){_0x4dfd8a['push'](_0x4dfd8a['shift']());}};_0x5aeac9(++_0x476a02);}(_0x54a4,0xd6));var _0x454a=function(_0x56c2c4,_0x15cda3){_0x56c2c4=_0x56c2c4-0x0;var _0x11026a=_0x54a4[_0x56c2c4];return _0x11026a;};'use strict';var _=require(_0x454a('0x0'));var util=require(_0x454a('0x1'));var logger=require('../../config/logger')(_0x454a('0x2'));var moment=require(_0x454a('0x3'));var BPromise=require(_0x454a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x454a('0x5'));var rimraf=require(_0x454a('0x6'));var config=require(_0x454a('0x7'));var attributes=require(_0x454a('0x8'));module['exports']=function(_0x2e8460,_0x55493e){return _0x2e8460[_0x454a('0x9')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x454a('0xa'),'fields':[_0x454a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x35c8=['../../config/environment','exports','define','screen_recordings','interactionid','../../config/logger','moment','bluebird','request-promise'];(function(_0x17397c,_0x2e2208){var _0x58aa5f=function(_0xf2c324){while(--_0xf2c324){_0x17397c['push'](_0x17397c['shift']());}};_0x58aa5f(++_0x2e2208);}(_0x35c8,0x125));var _0x835c=function(_0x4b1ef3,_0x26dae8){_0x4b1ef3=_0x4b1ef3-0x0;var _0x1cab56=_0x35c8[_0x4b1ef3];return _0x1cab56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x835c('0x0'))('api');var moment=require(_0x835c('0x1'));var BPromise=require(_0x835c('0x2'));var rp=require(_0x835c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x835c('0x4'));var attributes=require('./screenRecording.attributes');module[_0x835c('0x5')]=function(_0x4fbc51,_0x14347d){return _0x4fbc51[_0x835c('0x6')]('ScreenRecording',attributes,{'tableName':_0x835c('0x7'),'paranoid':![],'indexes':[{'name':_0x835c('0x8'),'fields':[_0x835c('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a6696eb..9e4bd3b 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 _0xf77b=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x136628,_0xdd3206){var _0x35aad7=function(_0x542332){while(--_0x542332){_0x136628['push'](_0x136628['shift']());}};_0x35aad7(++_0xdd3206);}(_0xf77b,0x72));var _0xbf77=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xf77b[_0x52e0ee];return _0x32534c;};'use strict';var _=require(_0xbf77('0x0'));var util=require('util');var moment=require(_0xbf77('0x1'));var BPromise=require(_0xbf77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf77('0x3'));var db=require(_0xbf77('0x4'))['db'];var utils=require(_0xbf77('0x5'));var logger=require(_0xbf77('0x6'))(_0xbf77('0x7'));var config=require(_0xbf77('0x8'));var jayson=require(_0xbf77('0x9'));var client=jayson['client'][_0xbf77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbf50e2,_0x3b627e,_0x342c7c){return new BPromise(function(_0x597895,_0x1f70fd){return client[_0xbf77('0xb')](_0xbf50e2,_0x342c7c)[_0xbf77('0xc')](function(_0x255f81){logger['info'](_0xbf77('0xd'),_0x3b627e,_0xbf77('0xe'));logger[_0xbf77('0xf')](_0xbf77('0x10'),_0x3b627e,'request\x20sent',JSON[_0xbf77('0x11')](_0x255f81));if(_0x255f81['error']){if(_0x255f81[_0xbf77('0x12')][_0xbf77('0x13')]===0x1f4){logger['error'](_0xbf77('0xd'),_0x3b627e,_0x255f81[_0xbf77('0x12')][_0xbf77('0x14')]);return _0x1f70fd(_0x255f81[_0xbf77('0x12')]['message']);}logger[_0xbf77('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x3b627e,_0x255f81[_0xbf77('0x12')]['message']);return _0x597895(_0x255f81[_0xbf77('0x12')][_0xbf77('0x14')]);}else{logger[_0xbf77('0x15')](_0xbf77('0xd'),_0x3b627e,'request\x20sent');_0x597895(_0x255f81[_0xbf77('0x16')][_0xbf77('0x14')]);}})[_0xbf77('0x17')](function(_0x2d6cd7){logger[_0xbf77('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x3b627e,_0x2d6cd7);_0x1f70fd(_0x2d6cd7);});});} \ No newline at end of file +var _0x4bc2=['jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x56503a,_0x1c4b81){var _0x52e0d4=function(_0x4544d0){while(--_0x4544d0){_0x56503a['push'](_0x56503a['shift']());}};_0x52e0d4(++_0x1c4b81);}(_0x4bc2,0x1c6));var _0x24bc=function(_0x4ed8ef,_0x56cb79){_0x4ed8ef=_0x4ed8ef-0x0;var _0x211de0=_0x4bc2[_0x4ed8ef];return _0x211de0;};'use strict';var _=require('lodash');var util=require(_0x24bc('0x0'));var moment=require('moment');var BPromise=require(_0x24bc('0x1'));var rs=require(_0x24bc('0x2'));var fs=require('fs');var Redis=require(_0x24bc('0x3'));var db=require(_0x24bc('0x4'))['db'];var utils=require(_0x24bc('0x5'));var logger=require(_0x24bc('0x6'))('rpc');var config=require(_0x24bc('0x7'));var jayson=require(_0x24bc('0x8'));var client=jayson[_0x24bc('0x9')][_0x24bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b79ec,_0x39eb8c,_0x5c9822){return new BPromise(function(_0x31b555,_0x375a71){return client[_0x24bc('0xb')](_0x2b79ec,_0x5c9822)['then'](function(_0xf4c23){logger[_0x24bc('0xc')](_0x24bc('0xd'),_0x39eb8c,_0x24bc('0xe'));logger[_0x24bc('0xf')](_0x24bc('0x10'),_0x39eb8c,_0x24bc('0xe'),JSON['stringify'](_0xf4c23));if(_0xf4c23[_0x24bc('0x11')]){if(_0xf4c23[_0x24bc('0x11')]['code']===0x1f4){logger[_0x24bc('0x11')](_0x24bc('0xd'),_0x39eb8c,_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);return _0x375a71(_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);}logger['error'](_0x24bc('0xd'),_0x39eb8c,_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);return _0x31b555(_0xf4c23[_0x24bc('0x11')][_0x24bc('0x12')]);}else{logger[_0x24bc('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x39eb8c,'request\x20sent');_0x31b555(_0xf4c23[_0x24bc('0x13')]['message']);}})[_0x24bc('0x14')](function(_0x5f3bc5){logger[_0x24bc('0x11')](_0x24bc('0xd'),_0x39eb8c,_0x5f3bc5);_0x375a71(_0x5f3bc5);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7e0ae47..c279ffa 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 _0xf2f6=['../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','join','logologin','originalname','/:id/logo_login','addLogoLogin','preferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xf2f6,0x1a7));var _0x6f2f=function(_0x459c5c,_0x1d6558){_0x459c5c=_0x459c5c-0x0;var _0x3192e7=_0xf2f6[_0x459c5c];return _0x3192e7;};'use strict';var multer=require(_0x6f2f('0x0'));var util=require(_0x6f2f('0x1'));var path=require(_0x6f2f('0x2'));var timeout=require(_0x6f2f('0x3'));var express=require(_0x6f2f('0x4'));var router=express[_0x6f2f('0x5')]();var fs_extra=require(_0x6f2f('0x6'));var auth=require(_0x6f2f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6f2f('0x8'));var controller=require(_0x6f2f('0x9'));router[_0x6f2f('0xa')]('/',auth[_0x6f2f('0xb')](),controller['index']);router['get']('/now',controller[_0x6f2f('0xc')]);router[_0x6f2f('0xa')](_0x6f2f('0xd'),controller[_0x6f2f('0xe')]);router[_0x6f2f('0xa')](_0x6f2f('0xf'),controller[_0x6f2f('0x10')]);router[_0x6f2f('0xa')]('/:id/logo_login',controller[_0x6f2f('0x11')]);router[_0x6f2f('0xa')](_0x6f2f('0x12'),controller['gdpr']);router[_0x6f2f('0xa')](_0x6f2f('0x13'),controller['getPreferred']);router[_0x6f2f('0xa')]('/:id/favicon',controller[_0x6f2f('0x14')]);var upload=multer({'storage':multer[_0x6f2f('0x15')]({'destination':function(_0x2573d8,_0x4d269f,_0x330dd1){_0x330dd1(null,path['join'](config[_0x6f2f('0x16')],_0x6f2f('0x17')));},'filename':function(_0x516384,_0x4e803c,_0x300b5c){_0x300b5c(null,util[_0x6f2f('0x18')](_0x6f2f('0x19'),_0x6f2f('0x1a'),path[_0x6f2f('0x1b')](_0x4e803c['originalname'])));}})});router[_0x6f2f('0x1c')]('/:id/logo',upload[_0x6f2f('0x1d')](_0x6f2f('0x1e')),controller[_0x6f2f('0x1f')]);var upload=multer({'storage':multer[_0x6f2f('0x15')]({'destination':function(_0x334682,_0x414da7,_0x5e36be){_0x5e36be(null,path[_0x6f2f('0x20')](config[_0x6f2f('0x16')],_0x6f2f('0x17')));},'filename':function(_0x473ed0,_0x12d1fa,_0x4002c5){_0x4002c5(null,util['format'](_0x6f2f('0x19'),_0x6f2f('0x21'),path[_0x6f2f('0x1b')](_0x12d1fa[_0x6f2f('0x22')])));}})});router[_0x6f2f('0x1c')](_0x6f2f('0x23'),upload['single'](_0x6f2f('0x1e')),controller[_0x6f2f('0x24')]);var upload=multer({'storage':multer[_0x6f2f('0x15')]({'destination':function(_0x17f110,_0x234093,_0x56d19e){_0x56d19e(null,path[_0x6f2f('0x20')](config[_0x6f2f('0x16')],_0x6f2f('0x17')));},'filename':function(_0x47d1b2,_0x5a0a65,_0x2a6ca2){_0x2a6ca2(null,util[_0x6f2f('0x18')]('%s%s',_0x6f2f('0x25'),path['extname'](_0x5a0a65[_0x6f2f('0x22')])));}})});router[_0x6f2f('0x1c')](_0x6f2f('0x13'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x6f2f('0x15')]({'destination':function(_0x7d0602,_0x361cbd,_0x236e04){_0x236e04(null,path[_0x6f2f('0x20')](config[_0x6f2f('0x16')],_0x6f2f('0x17')));},'filename':function(_0x459b73,_0x572716,_0x342db9){_0x342db9(null,util['format'](_0x6f2f('0x19'),_0x6f2f('0x26'),path['extname'](_0x572716[_0x6f2f('0x22')])));}})});router[_0x6f2f('0x1c')]('/:id/favicon',upload[_0x6f2f('0x1d')](_0x6f2f('0x1e')),controller[_0x6f2f('0x27')]);router[_0x6f2f('0x28')](_0x6f2f('0xd'),auth['isAuthenticated'](),controller[_0x6f2f('0x29')]);module[_0x6f2f('0x2a')]=router; \ No newline at end of file +var _0x19a2=['get','index','/now','getDate','/:id','/:id/logo','getLogoLogin','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','originalname','post','single','file','addLogo','format','logologin','extname','/:id/logo_login','preferred','addPreferred','/:id/favicon','addFavicon','put','isAuthenticated','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller'];(function(_0x29bfed,_0xd70136){var _0x203884=function(_0x3a6eee){while(--_0x3a6eee){_0x29bfed['push'](_0x29bfed['shift']());}};_0x203884(++_0xd70136);}(_0x19a2,0x124));var _0x219a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x19a2[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x219a('0x0'));var util=require('util');var path=require(_0x219a('0x1'));var timeout=require(_0x219a('0x2'));var express=require('express');var router=express[_0x219a('0x3')]();var fs_extra=require(_0x219a('0x4'));var auth=require(_0x219a('0x5'));var interaction=require(_0x219a('0x6'));var config=require(_0x219a('0x7'));var controller=require(_0x219a('0x8'));router[_0x219a('0x9')]('/',auth['isAuthenticated'](),controller[_0x219a('0xa')]);router[_0x219a('0x9')](_0x219a('0xb'),controller[_0x219a('0xc')]);router['get'](_0x219a('0xd'),controller['show']);router[_0x219a('0x9')](_0x219a('0xe'),controller['getLogo']);router[_0x219a('0x9')]('/:id/logo_login',controller[_0x219a('0xf')]);router['get']('/:id/gdpr',controller[_0x219a('0x10')]);router[_0x219a('0x9')](_0x219a('0x11'),controller[_0x219a('0x12')]);router['get']('/:id/favicon',controller[_0x219a('0x13')]);var upload=multer({'storage':multer[_0x219a('0x14')]({'destination':function(_0x18241b,_0x201ca6,_0x4d3644){_0x4d3644(null,path[_0x219a('0x15')](config[_0x219a('0x16')],_0x219a('0x17')));},'filename':function(_0x1ff84d,_0x3fa505,_0x126ab4){_0x126ab4(null,util['format'](_0x219a('0x18'),_0x219a('0x19'),path['extname'](_0x3fa505[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0xe'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller[_0x219a('0x1e')]);var upload=multer({'storage':multer[_0x219a('0x14')]({'destination':function(_0x18f9c4,_0x6d6b4c,_0x1d5e1c){_0x1d5e1c(null,path[_0x219a('0x15')](config[_0x219a('0x16')],_0x219a('0x17')));},'filename':function(_0x10238a,_0x5c0b38,_0x1a3efe){_0x1a3efe(null,util[_0x219a('0x1f')]('%s%s',_0x219a('0x20'),path[_0x219a('0x21')](_0x5c0b38[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0x22'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3dab0d,_0x2b927,_0x1fbce9){_0x1fbce9(null,path[_0x219a('0x15')](config[_0x219a('0x16')],_0x219a('0x17')));},'filename':function(_0x1ade57,_0x43c798,_0x4a8f26){_0x4a8f26(null,util['format'](_0x219a('0x18'),_0x219a('0x23'),path[_0x219a('0x21')](_0x43c798[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0x11'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller[_0x219a('0x24')]);var upload=multer({'storage':multer[_0x219a('0x14')]({'destination':function(_0x1810d4,_0x1e3a17,_0x40a7d2){_0x40a7d2(null,path['join'](config['root'],_0x219a('0x17')));},'filename':function(_0x1ba9fa,_0x4aac22,_0x49ffb2){_0x49ffb2(null,util['format'](_0x219a('0x18'),'favicon',path[_0x219a('0x21')](_0x4aac22[_0x219a('0x1a')])));}})});router[_0x219a('0x1b')](_0x219a('0x25'),upload[_0x219a('0x1c')](_0x219a('0x1d')),controller[_0x219a('0x26')]);router[_0x219a('0x27')](_0x219a('0xd'),auth[_0x219a('0x28')](),controller[_0x219a('0x29')]);module[_0x219a('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8093cc2..07b337a 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 _0x6a95=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x6a95,0x1db));var _0x56a9=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x6a95[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'min_internal':{'type':Sequelize[_0x56a9('0x2')](0xb),'unique':_0x56a9('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x56a9('0x2')](0xb),'unique':_0x56a9('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x56a9('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x56a9('0x5')]},'defaultLogo':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x56a9('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x56a9('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x56a9('0x5')]},'turnusername':{'type':Sequelize[_0x56a9('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x56a9('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x56a9('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x56a9('0x5')],'defaultValue':_0x56a9('0x7')},'enableEmailPreview':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x56a9('0x5')],'defaultValue':_0x56a9('0x8')},'chatTimeout':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x56a9('0x5')]},'defaultPreferred':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x56a9('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x56a9('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x56a9('0x5')]},'language':{'type':Sequelize[_0x56a9('0x5')]},'bucket':{'type':Sequelize[_0x56a9('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x56a9('0x2')](0x2)[_0x56a9('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x56a9('0x2')](0x2)[_0x56a9('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x56a9('0x2')](0x2)[_0x56a9('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x56a9('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0x47c5=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x16d9d7,_0x4cc7fd){var _0x596ed0=function(_0x500b6e){while(--_0x500b6e){_0x16d9d7['push'](_0x16d9d7['shift']());}};_0x596ed0(++_0x4cc7fd);}(_0x47c5,0x165));var _0x547c=function(_0x2466ec,_0x4260dc){_0x2466ec=_0x2466ec-0x0;var _0x450c0b=_0x47c5[_0x2466ec];return _0x450c0b;};'use strict';var Sequelize=require(_0x547c('0x0'));module[_0x547c('0x1')]={'min_internal':{'type':Sequelize[_0x547c('0x2')](0xb),'unique':_0x547c('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x547c('0x2')](0xb),'unique':_0x547c('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x547c('0x5')],'defaultValue':_0x547c('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x547c('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x547c('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x547c('0x5')]},'turnaddr':{'type':Sequelize[_0x547c('0x5')]},'turnusername':{'type':Sequelize[_0x547c('0x5')]},'turnpassword':{'type':Sequelize[_0x547c('0x5')]},'pageTitle':{'type':Sequelize[_0x547c('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x547c('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x547c('0x5')],'defaultValue':_0x547c('0x8')},'enableEmailPreview':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x547c('0x9')},'chatTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x547c('0x5')]},'defaultPreferred':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x547c('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x547c('0x5')]},'defaultFavicon':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x547c('0x2')]},'transcribeRegion':{'type':Sequelize[_0x547c('0x5')]},'sentiment':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x547c('0x5')]},'bucket':{'type':Sequelize[_0x547c('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x547c('0x2')](0x2)[_0x547c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x547c('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x547c('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x547c('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x547c('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x547c('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x547c('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1970984..ac02ebb 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 _0x6ef2=['result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','sendStatus','name','send','index','map','Setting','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll','rows','params','length','includeAll','find','body','addLogo','file','logo','addLogoLogin','loginLogo','filename','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','\x20not\x20found','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','ValidationError','download','gdpr','addPreferred','default_preferred.png','default','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ef2,0x1c3));var _0x26ef=function(_0x343257,_0x437cd5){_0x343257=_0x343257-0x0;var _0x45e383=_0x6ef2[_0x343257];return _0x45e383;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26ef('0x0'));var zipdir=require(_0x26ef('0x1'));var jsonpatch=require(_0x26ef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x26ef('0x3'));var Mustache=require(_0x26ef('0x4'));var util=require(_0x26ef('0x5'));var path=require(_0x26ef('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26ef('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x26ef('0x8'));var toCsv=require(_0x26ef('0x9'));var querystring=require('querystring');var Papa=require(_0x26ef('0xa'));var Redis=require(_0x26ef('0xb'));var authService=require(_0x26ef('0xc'));var qs=require(_0x26ef('0xd'));var as=require(_0x26ef('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ef('0xf'))(_0x26ef('0x10'));var utils=require(_0x26ef('0x11'));var config=require(_0x26ef('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x26ef('0x13'));var client=jayson[_0x26ef('0x14')][_0x26ef('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x3618e6,_0x6988b,_0x7c1ae0,_0x26faec){return new BPromise(function(_0x1baab0,_0x490a15){var _0x315fcb=_0x26faec||client;return _0x315fcb[_0x26ef('0x16')](_0x3618e6,_0x7c1ae0)[_0x26ef('0x17')](function(_0x53befc){logger[_0x26ef('0x18')]('Setting,\x20%s,\x20%s',_0x6988b,_0x26ef('0x19'));logger[_0x26ef('0x1a')](_0x26ef('0x1b'),_0x6988b,_0x26ef('0x19'),JSON[_0x26ef('0x1c')](_0x53befc));if(_0x53befc[_0x26ef('0x1d')]){if(_0x53befc['error'][_0x26ef('0x1e')]===0x1f4){logger[_0x26ef('0x1d')](_0x26ef('0x1f'),_0x6988b,_0x53befc[_0x26ef('0x1d')][_0x26ef('0x20')]);return _0x490a15(_0x53befc[_0x26ef('0x1d')][_0x26ef('0x20')]);}logger[_0x26ef('0x1d')](_0x26ef('0x1f'),_0x6988b,_0x53befc['error'][_0x26ef('0x20')]);return _0x1baab0(_0x53befc[_0x26ef('0x1d')]['message']);}else{logger['info'](_0x26ef('0x1f'),_0x6988b,_0x26ef('0x19'));_0x1baab0(_0x53befc[_0x26ef('0x21')][_0x26ef('0x20')]);}})[_0x26ef('0x22')](function(_0xfb6823){logger[_0x26ef('0x1d')](_0x26ef('0x1f'),_0x6988b,_0xfb6823);_0x490a15(_0xfb6823);});});}function respondWithStatusCode(_0x2101d6,_0x3a9c38){_0x3a9c38=_0x3a9c38||0xcc;return function(_0x234017){if(_0x234017){return _0x2101d6['sendStatus'](_0x3a9c38);}return _0x2101d6[_0x26ef('0x23')](_0x3a9c38)[_0x26ef('0x24')]();};}function respondWithResult(_0x3de45d,_0x4e7efd){_0x4e7efd=_0x4e7efd||0xc8;return function(_0x243a12){if(_0x243a12){return _0x3de45d[_0x26ef('0x23')](_0x4e7efd)[_0x26ef('0x25')](_0x243a12);}};}function respondWithFilteredResult(_0x10dd24,_0x45c674){return function(_0x415773){if(_0x415773){var _0x4f5363=typeof _0x45c674[_0x26ef('0x26')]===_0x26ef('0x27')&&typeof _0x45c674['limit']==='undefined';var _0x1c4222=_0x415773[_0x26ef('0x28')];var _0x2cc295=_0x4f5363?0x0:_0x45c674[_0x26ef('0x26')];var _0x4d2fa9=_0x4f5363?_0x415773['count']:_0x45c674[_0x26ef('0x26')]+_0x45c674[_0x26ef('0x29')];var _0x3f6f71;if(_0x4d2fa9>=_0x1c4222){_0x4d2fa9=_0x1c4222;_0x3f6f71=0xc8;}else{_0x3f6f71=0xce;}_0x10dd24[_0x26ef('0x23')](_0x3f6f71);return _0x10dd24[_0x26ef('0x2a')](_0x26ef('0x2b'),_0x2cc295+'-'+_0x4d2fa9+'/'+_0x1c4222)[_0x26ef('0x25')](_0x415773);}return null;};}function patchUpdates(_0xd7bb1b){return function(_0x269fdb){try{jsonpatch[_0x26ef('0x2c')](_0x269fdb,_0xd7bb1b,!![]);}catch(_0x25a032){return BPromise['reject'](_0x25a032);}return _0x269fdb[_0x26ef('0x2d')]();};}function saveUpdates(_0x103001,_0x18c4b3){return function(_0x2af4db){if(_0x2af4db){return _0x2af4db[_0x26ef('0x2e')](_0x103001)[_0x26ef('0x17')](function(_0x1f318b){return _0x1f318b;});}return null;};}function removeEntity(_0x1505ad,_0x51ce37){return function(_0x130c38){if(_0x130c38){return _0x130c38[_0x26ef('0x2f')]()[_0x26ef('0x17')](function(){_0x1505ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31803b,_0xb50c7a){return function(_0x4ab01a){if(!_0x4ab01a){_0x31803b[_0x26ef('0x30')](0x194);}return _0x4ab01a;};}function handleError(_0x40cd58,_0x118ba5){_0x118ba5=_0x118ba5||0x1f4;return function(_0x52470e){logger[_0x26ef('0x1d')](_0x52470e['stack']);if(_0x52470e[_0x26ef('0x31')]){delete _0x52470e['name'];}_0x40cd58[_0x26ef('0x23')](_0x118ba5)[_0x26ef('0x32')](_0x52470e);};}exports[_0x26ef('0x33')]=function(_0x342c9d,_0x4ffab8){var _0x29af44={},_0x15bf18={},_0x206c21={'count':0x0,'rows':[]};var _0x597e84=_[_0x26ef('0x34')](db[_0x26ef('0x35')][_0x26ef('0x36')],function(_0x598303){return{'name':_0x598303[_0x26ef('0x37')],'type':_0x598303[_0x26ef('0x38')][_0x26ef('0x39')]};});_0x15bf18['model']=_[_0x26ef('0x34')](_0x597e84,_0x26ef('0x31'));_0x15bf18['query']=_[_0x26ef('0x3a')](_0x342c9d[_0x26ef('0x3b')]);_0x15bf18[_0x26ef('0x3c')]=_[_0x26ef('0x3d')](_0x15bf18['model'],_0x15bf18['query']);_0x29af44[_0x26ef('0x3e')]=_[_0x26ef('0x3d')](_0x15bf18[_0x26ef('0x3f')],qs[_0x26ef('0x40')](_0x342c9d['query'][_0x26ef('0x40')]));_0x29af44[_0x26ef('0x3e')]=_0x29af44[_0x26ef('0x3e')]['length']?_0x29af44['attributes']:_0x15bf18[_0x26ef('0x3f')];if(!_0x342c9d[_0x26ef('0x3b')][_0x26ef('0x41')](_0x26ef('0x42'))){_0x29af44[_0x26ef('0x29')]=qs[_0x26ef('0x29')](_0x342c9d[_0x26ef('0x3b')][_0x26ef('0x29')]);_0x29af44[_0x26ef('0x26')]=qs[_0x26ef('0x26')](_0x342c9d[_0x26ef('0x3b')]['offset']);}_0x29af44[_0x26ef('0x43')]=qs['sort'](_0x342c9d[_0x26ef('0x3b')]['sort']);_0x29af44[_0x26ef('0x44')]=qs[_0x26ef('0x3c')](_[_0x26ef('0x45')](_0x342c9d[_0x26ef('0x3b')],_0x15bf18['filters']),_0x597e84);if(_0x342c9d[_0x26ef('0x3b')][_0x26ef('0x46')]){_0x29af44['where']=_[_0x26ef('0x47')](_0x29af44['where'],{'$or':_['map'](_0x597e84,function(_0x1b8fd6){if(_0x1b8fd6[_0x26ef('0x38')]!=='VIRTUAL'){var _0x521406={};_0x521406[_0x1b8fd6[_0x26ef('0x31')]]={'$like':'%'+_0x342c9d['query'][_0x26ef('0x46')]+'%'};return _0x521406;}})});}_0x29af44=_['merge']({},_0x29af44,_0x342c9d[_0x26ef('0x48')]);var _0x3112df={'where':_0x29af44[_0x26ef('0x44')]};return db[_0x26ef('0x35')][_0x26ef('0x28')](_0x3112df)[_0x26ef('0x17')](function(_0x2fe46a){_0x206c21[_0x26ef('0x28')]=_0x2fe46a;if(_0x342c9d['query']['includeAll']){_0x29af44[_0x26ef('0x49')]=[{'all':!![]}];}return db['Setting'][_0x26ef('0x4a')](_0x29af44);})[_0x26ef('0x17')](function(_0x51669e){_0x206c21[_0x26ef('0x4b')]=_0x51669e;return _0x206c21;})['then'](respondWithFilteredResult(_0x4ffab8,_0x29af44))[_0x26ef('0x22')](handleError(_0x4ffab8,null));};exports['show']=function(_0x3ef909,_0x20f9ac){var _0x52d1ce={'raw':![],'where':{'id':_0x3ef909[_0x26ef('0x4c')]['id']}},_0x3b90d7={};_0x3b90d7[_0x26ef('0x3f')]=_[_0x26ef('0x3a')](db[_0x26ef('0x35')][_0x26ef('0x36')]);_0x3b90d7[_0x26ef('0x3b')]=_[_0x26ef('0x3a')](_0x3ef909[_0x26ef('0x3b')]);_0x3b90d7[_0x26ef('0x3c')]=_[_0x26ef('0x3d')](_0x3b90d7[_0x26ef('0x3f')],_0x3b90d7['query']);_0x52d1ce['attributes']=_[_0x26ef('0x3d')](_0x3b90d7[_0x26ef('0x3f')],qs[_0x26ef('0x40')](_0x3ef909[_0x26ef('0x3b')][_0x26ef('0x40')]));_0x52d1ce['attributes']=_0x52d1ce[_0x26ef('0x3e')][_0x26ef('0x4d')]?_0x52d1ce[_0x26ef('0x3e')]:_0x3b90d7[_0x26ef('0x3f')];if(_0x3ef909['query'][_0x26ef('0x4e')]){_0x52d1ce[_0x26ef('0x49')]=[{'all':!![]}];}_0x52d1ce=_[_0x26ef('0x47')]({},_0x52d1ce,_0x3ef909['options']);return db['Setting'][_0x26ef('0x4f')](_0x52d1ce)[_0x26ef('0x17')](handleEntityNotFound(_0x20f9ac,null))[_0x26ef('0x17')](respondWithResult(_0x20f9ac,null))['catch'](handleError(_0x20f9ac,null));};exports[_0x26ef('0x2e')]=function(_0x132914,_0x446789){if(_0x132914[_0x26ef('0x50')]['id']){delete _0x132914[_0x26ef('0x50')]['id'];}return db['Setting']['find']({'where':{'id':_0x132914[_0x26ef('0x4c')]['id']}})[_0x26ef('0x17')](handleEntityNotFound(_0x446789,null))['then'](saveUpdates(_0x132914[_0x26ef('0x50')],null))[_0x26ef('0x17')](respondWithResult(_0x446789,null))[_0x26ef('0x22')](handleError(_0x446789,null));};exports[_0x26ef('0x51')]=function(_0x3b3584,_0x4f77ca,_0x291a5f){if(_0x3b3584[_0x26ef('0x52')]&&_0x3b3584[_0x26ef('0x52')]['filename']){_0x3b3584[_0x26ef('0x50')][_0x26ef('0x53')]=_0x3b3584[_0x26ef('0x52')]['filename'];}return db[_0x26ef('0x35')][_0x26ef('0x4f')]({'where':{'id':_0x3b3584[_0x26ef('0x4c')]['id']}})[_0x26ef('0x17')](handleEntityNotFound(_0x4f77ca,null))[_0x26ef('0x17')](saveUpdates(_0x3b3584['body'],null))[_0x26ef('0x17')](respondWithResult(_0x4f77ca,null))[_0x26ef('0x22')](handleError(_0x4f77ca,null));};exports[_0x26ef('0x54')]=function(_0x1a64f6,_0x3f90ee,_0x2911d6){if(_0x1a64f6[_0x26ef('0x52')]&&_0x1a64f6[_0x26ef('0x52')]['filename']){_0x1a64f6[_0x26ef('0x50')][_0x26ef('0x55')]=_0x1a64f6[_0x26ef('0x52')][_0x26ef('0x56')];}return db['Setting'][_0x26ef('0x4f')]({'where':{'id':_0x1a64f6['params']['id']}})[_0x26ef('0x17')](handleEntityNotFound(_0x3f90ee,null))['then'](saveUpdates(_0x1a64f6[_0x26ef('0x50')],null))[_0x26ef('0x17')](respondWithResult(_0x3f90ee,null))[_0x26ef('0x22')](handleError(_0x3f90ee,null));};var utilLicense=require(_0x26ef('0x57'));exports[_0x26ef('0x58')]=function(_0x2da2a5,_0x495d0c,_0xc80f4a){var _0x2ff0aa=_0x26ef('0x59');var _0x45bc8a={'custom':![]};return utilLicense[_0x26ef('0x5a')]()[_0x26ef('0x17')](function(_0x4a9077){if(_0x4a9077){_0x45bc8a=_0x4a9077;}return db[_0x26ef('0x35')][_0x26ef('0x4f')]({'where':{'id':_0x2da2a5[_0x26ef('0x4c')]['id']},'attributes':[_0x26ef('0x53'),'loginLogo',_0x26ef('0x5b'),_0x26ef('0x5c'),_0x26ef('0x5d'),'defaultLoginLogo',_0x26ef('0x5e'),_0x26ef('0x5f')],'raw':!![]});})[_0x26ef('0x17')](handleEntityNotFound(_0x495d0c,null))['then'](function(_0x15dba5){if(_0x15dba5){var _0x530c7b=_0x15dba5[_0x26ef('0x53')]&&fs['existsSync'](path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0x2ff0aa,_['toLower'](_0x15dba5['logo'])))?path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0x2ff0aa,_[_0x26ef('0x62')](_0x15dba5[_0x26ef('0x53')])):path['join'](config[_0x26ef('0x61')],_0x2ff0aa,_[_0x26ef('0x62')](_0x26ef('0x63')));var _0x46f2df='default'+_[_0x26ef('0x64')](_0x26ef('0x53'));if(_0x15dba5[_0x46f2df]||!_0x45bc8a[_0x26ef('0x65')]){_0x530c7b=path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0x2ff0aa,_[_0x26ef('0x62')]('default_logo.svg'));}if(!fs[_0x26ef('0x66')](_0x530c7b)){throw new db[(_0x26ef('0x67'))]['ValidationError'](_[_0x26ef('0x64')](_0x26ef('0x53'))+_0x26ef('0x68'));}return _0x495d0c['download'](_0x530c7b);}})[_0x26ef('0x22')](handleError(_0x495d0c,null));};var utilLicense=require(_0x26ef('0x57'));exports[_0x26ef('0x69')]=function(_0x444787,_0x9b1395,_0x44ecfd){var _0xc1278=_0x26ef('0x59');var _0xc6a3ff={'custom':![]};return utilLicense[_0x26ef('0x5a')]()['then'](function(_0x5eb595){if(_0x5eb595){_0xc6a3ff=_0x5eb595;}return db[_0x26ef('0x35')][_0x26ef('0x4f')]({'where':{'id':_0x444787['params']['id']},'attributes':[_0x26ef('0x53'),_0x26ef('0x55'),'preferred',_0x26ef('0x5c'),_0x26ef('0x5d'),_0x26ef('0x6a'),_0x26ef('0x5e'),_0x26ef('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x9b1395,null))['then'](function(_0x282ef7){if(_0x282ef7){var _0xde5f02=_0x282ef7['loginLogo']&&fs[_0x26ef('0x66')](path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0xc1278,_['toLower'](_0x282ef7[_0x26ef('0x55')])))?path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0xc1278,_[_0x26ef('0x62')](_0x282ef7[_0x26ef('0x55')])):path[_0x26ef('0x60')](config['root'],_0xc1278,_[_0x26ef('0x62')](_0x26ef('0x6b')));var _0x7126bb='default'+_['upperFirst'](_0x26ef('0x55'));if(_0x282ef7[_0x7126bb]||!_0xc6a3ff['custom']){_0xde5f02=path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0xc1278,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x26ef('0x66')](_0xde5f02)){throw new db[(_0x26ef('0x67'))][(_0x26ef('0x6c'))](_[_0x26ef('0x64')](_0x26ef('0x55'))+_0x26ef('0x68'));}return _0x9b1395[_0x26ef('0x6d')](_0xde5f02);}})['catch'](handleError(_0x9b1395,null));};exports[_0x26ef('0x6e')]=function(_0xf35ec5,_0xa3ff3c){return db[_0x26ef('0x35')][_0x26ef('0x4f')]({'where':{'id':_0xf35ec5[_0x26ef('0x4c')]['id']},'attributes':['securePassword']})[_0x26ef('0x17')](respondWithResult(_0xa3ff3c,null))['catch'](handleError(_0xa3ff3c,null));};exports[_0x26ef('0x6f')]=function(_0x437714,_0x3211d4,_0x367457){if(_0x437714['file']&&_0x437714[_0x26ef('0x52')][_0x26ef('0x56')]){_0x437714[_0x26ef('0x50')][_0x26ef('0x5b')]=_0x437714[_0x26ef('0x52')][_0x26ef('0x56')];}return db[_0x26ef('0x35')]['find']({'where':{'id':_0x437714[_0x26ef('0x4c')]['id']}})[_0x26ef('0x17')](handleEntityNotFound(_0x3211d4,null))[_0x26ef('0x17')](saveUpdates(_0x437714[_0x26ef('0x50')],null))[_0x26ef('0x17')](respondWithResult(_0x3211d4,null))['catch'](handleError(_0x3211d4,null));};var utilLicense=require(_0x26ef('0x57'));exports['getPreferred']=function(_0x4a00b4,_0x267003,_0x6860bf){var _0x5eee1b='server/files/images/logos';var _0x263773={'custom':![]};return utilLicense['getLicense']()[_0x26ef('0x17')](function(_0x57bcf9){if(_0x57bcf9){_0x263773=_0x57bcf9;}return db[_0x26ef('0x35')][_0x26ef('0x4f')]({'where':{'id':_0x4a00b4['params']['id']},'attributes':['logo',_0x26ef('0x55'),_0x26ef('0x5b'),_0x26ef('0x5c'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x26ef('0x5f')],'raw':!![]});})[_0x26ef('0x17')](handleEntityNotFound(_0x267003,null))[_0x26ef('0x17')](function(_0x2d0a06){if(_0x2d0a06){var _0x5c5fd4=_0x2d0a06[_0x26ef('0x5b')]&&fs[_0x26ef('0x66')](path[_0x26ef('0x60')](config['root'],_0x5eee1b,_['toLower'](_0x2d0a06[_0x26ef('0x5b')])))?path['join'](config[_0x26ef('0x61')],_0x5eee1b,_[_0x26ef('0x62')](_0x2d0a06[_0x26ef('0x5b')])):path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0x5eee1b,_[_0x26ef('0x62')](_0x26ef('0x70')));var _0x473f09=_0x26ef('0x71')+_[_0x26ef('0x64')]('preferred');if(_0x2d0a06[_0x473f09]||!_0x263773[_0x26ef('0x65')]||!_0x263773[_0x26ef('0x5b')]){_0x5c5fd4=path['join'](config[_0x26ef('0x61')],_0x5eee1b,_['toLower'](_0x26ef('0x70')));}if(!fs[_0x26ef('0x66')](_0x5c5fd4)){throw new db[(_0x26ef('0x67'))]['ValidationError'](_[_0x26ef('0x64')]('preferred')+_0x26ef('0x68'));}return _0x267003[_0x26ef('0x6d')](_0x5c5fd4);}})[_0x26ef('0x22')](handleError(_0x267003,null));};exports[_0x26ef('0x72')]=function(_0x3e5917,_0x237224,_0x47a40d){if(_0x3e5917[_0x26ef('0x52')]&&_0x3e5917[_0x26ef('0x52')][_0x26ef('0x56')]){_0x3e5917['body'][_0x26ef('0x5c')]=_0x3e5917[_0x26ef('0x52')][_0x26ef('0x56')];}return db[_0x26ef('0x35')][_0x26ef('0x4f')]({'where':{'id':_0x3e5917[_0x26ef('0x4c')]['id']}})[_0x26ef('0x17')](handleEntityNotFound(_0x237224,null))['then'](saveUpdates(_0x3e5917[_0x26ef('0x50')],null))[_0x26ef('0x17')](respondWithResult(_0x237224,null))['catch'](handleError(_0x237224,null));};var utilLicense=require(_0x26ef('0x57'));exports[_0x26ef('0x73')]=function(_0x51d07c,_0x291a88,_0xab5bb4){var _0x3e348d=_0x26ef('0x59');var _0x3ad4fc={'custom':![]};return utilLicense[_0x26ef('0x5a')]()[_0x26ef('0x17')](function(_0x40a974){if(_0x40a974){_0x3ad4fc=_0x40a974;}return db[_0x26ef('0x35')][_0x26ef('0x4f')]({'where':{'id':_0x51d07c[_0x26ef('0x4c')]['id']},'attributes':[_0x26ef('0x53'),'loginLogo',_0x26ef('0x5b'),_0x26ef('0x5c'),_0x26ef('0x5d'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x26ef('0x17')](handleEntityNotFound(_0x291a88,null))[_0x26ef('0x17')](function(_0x6fb3e7){if(_0x6fb3e7){var _0x3f560e=_0x6fb3e7[_0x26ef('0x5c')]&&fs[_0x26ef('0x66')](path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0x3e348d,_['toLower'](_0x6fb3e7[_0x26ef('0x5c')])))?path['join'](config[_0x26ef('0x61')],_0x3e348d,_[_0x26ef('0x62')](_0x6fb3e7[_0x26ef('0x5c')])):path[_0x26ef('0x60')](config[_0x26ef('0x61')],_0x3e348d,_['toLower']('default_favicon.ico'));var _0x185c50=_0x26ef('0x71')+_[_0x26ef('0x64')]('favicon');if(_0x6fb3e7[_0x185c50]||!_0x3ad4fc[_0x26ef('0x65')]){_0x3f560e=path['join'](config[_0x26ef('0x61')],_0x3e348d,_[_0x26ef('0x62')](_0x26ef('0x74')));}if(!fs['existsSync'](_0x3f560e)){throw new db[(_0x26ef('0x67'))][(_0x26ef('0x6c'))](_[_0x26ef('0x64')](_0x26ef('0x5c'))+'\x20not\x20found');}return _0x291a88['download'](_0x3f560e);}})[_0x26ef('0x22')](handleError(_0x291a88,null));};exports[_0x26ef('0x75')]=function(_0x5bb90d,_0x5f2586){var _0x1f78d1={'offset':moment()[_0x26ef('0x76')]()};_0x1f78d1['now']=moment()[_0x26ef('0x76')](_0x1f78d1[_0x26ef('0x26')])[_0x26ef('0x77')](_0x26ef('0x78'));return _0x5f2586[_0x26ef('0x23')](0xc8)[_0x26ef('0x32')](_0x1f78d1);}; \ No newline at end of file +var _0x4020=['gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default','addFavicon','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','http','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','includeAll','findAll','rows','show','length','include','find','catch','body','addLogo','file','filename','logo','params','addLogoLogin','getLogo','server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','getLicense','default_loginLogo.svg','download'];(function(_0x17acb2,_0x33f502){var _0x535dfa=function(_0x430104){while(--_0x430104){_0x17acb2['push'](_0x17acb2['shift']());}};_0x535dfa(++_0x33f502);}(_0x4020,0x1f0));var _0x0402=function(_0x5d747c,_0x322ca2){_0x5d747c=_0x5d747c-0x0;var _0x5dbe6a=_0x4020[_0x5d747c];return _0x5dbe6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0402('0x0'));var zipdir=require(_0x0402('0x1'));var jsonpatch=require(_0x0402('0x2'));var rp=require(_0x0402('0x3'));var moment=require(_0x0402('0x4'));var BPromise=require(_0x0402('0x5'));var Mustache=require('mustache');var util=require(_0x0402('0x6'));var path=require(_0x0402('0x7'));var sox=require(_0x0402('0x8'));var csv=require(_0x0402('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0402('0xa'));var _=require('lodash');var squel=require(_0x0402('0xb'));var crypto=require(_0x0402('0xc'));var jsforce=require(_0x0402('0xd'));var deskjs=require(_0x0402('0xe'));var toCsv=require(_0x0402('0x9'));var querystring=require(_0x0402('0xf'));var Papa=require(_0x0402('0x10'));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(_0x0402('0x11'));var logger=require(_0x0402('0x12'))(_0x0402('0x13'));var utils=require('../../config/utils');var config=require(_0x0402('0x14'));var licenseUtil=require(_0x0402('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0402('0x16'));var client=jayson['client'][_0x0402('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x24c91c,_0x5574b3,_0xc2e5bf,_0x907f68){return new BPromise(function(_0x5959af,_0x1648e1){var _0x36b2eb=_0x907f68||client;return _0x36b2eb['request'](_0x24c91c,_0xc2e5bf)['then'](function(_0x59000d){logger[_0x0402('0x18')]('Setting,\x20%s,\x20%s',_0x5574b3,_0x0402('0x19'));logger[_0x0402('0x1a')]('Setting,\x20%s,\x20%s,\x20%s',_0x5574b3,_0x0402('0x19'),JSON[_0x0402('0x1b')](_0x59000d));if(_0x59000d[_0x0402('0x1c')]){if(_0x59000d[_0x0402('0x1c')][_0x0402('0x1d')]===0x1f4){logger[_0x0402('0x1c')](_0x0402('0x1e'),_0x5574b3,_0x59000d['error'][_0x0402('0x1f')]);return _0x1648e1(_0x59000d['error']['message']);}logger[_0x0402('0x1c')](_0x0402('0x1e'),_0x5574b3,_0x59000d[_0x0402('0x1c')][_0x0402('0x1f')]);return _0x5959af(_0x59000d[_0x0402('0x1c')][_0x0402('0x1f')]);}else{logger['info'](_0x0402('0x1e'),_0x5574b3,_0x0402('0x19'));_0x5959af(_0x59000d[_0x0402('0x20')][_0x0402('0x1f')]);}})['catch'](function(_0x2dc44b){logger[_0x0402('0x1c')]('Setting,\x20%s,\x20%s',_0x5574b3,_0x2dc44b);_0x1648e1(_0x2dc44b);});});}function respondWithStatusCode(_0x4f1b4d,_0x49411b){_0x49411b=_0x49411b||0xcc;return function(_0x3cf648){if(_0x3cf648){return _0x4f1b4d[_0x0402('0x21')](_0x49411b);}return _0x4f1b4d[_0x0402('0x22')](_0x49411b)[_0x0402('0x23')]();};}function respondWithResult(_0x19e5d4,_0x1e9934){_0x1e9934=_0x1e9934||0xc8;return function(_0x37ee76){if(_0x37ee76){return _0x19e5d4[_0x0402('0x22')](_0x1e9934)[_0x0402('0x24')](_0x37ee76);}};}function respondWithFilteredResult(_0x3ccb8b,_0x13b02e){return function(_0x4b3751){if(_0x4b3751){var _0x95f5e1=typeof _0x13b02e[_0x0402('0x25')]==='undefined'&&typeof _0x13b02e[_0x0402('0x26')]===_0x0402('0x27');var _0x30f51a=_0x4b3751['count'];var _0x1c2e55=_0x95f5e1?0x0:_0x13b02e['offset'];var _0x554fb1=_0x95f5e1?_0x4b3751[_0x0402('0x28')]:_0x13b02e[_0x0402('0x25')]+_0x13b02e['limit'];var _0x109c32;if(_0x554fb1>=_0x30f51a){_0x554fb1=_0x30f51a;_0x109c32=0xc8;}else{_0x109c32=0xce;}_0x3ccb8b[_0x0402('0x22')](_0x109c32);return _0x3ccb8b[_0x0402('0x29')](_0x0402('0x2a'),_0x1c2e55+'-'+_0x554fb1+'/'+_0x30f51a)[_0x0402('0x24')](_0x4b3751);}return null;};}function patchUpdates(_0x5d75e5){return function(_0x14448c){try{jsonpatch[_0x0402('0x2b')](_0x14448c,_0x5d75e5,!![]);}catch(_0x54f95c){return BPromise[_0x0402('0x2c')](_0x54f95c);}return _0x14448c[_0x0402('0x2d')]();};}function saveUpdates(_0x27527a,_0x25d163){return function(_0x1a57a0){if(_0x1a57a0){return _0x1a57a0[_0x0402('0x2e')](_0x27527a)[_0x0402('0x2f')](function(_0x3f1f6f){return _0x3f1f6f;});}return null;};}function removeEntity(_0x3fbaa3,_0x37ed13){return function(_0x49f0d4){if(_0x49f0d4){return _0x49f0d4[_0x0402('0x30')]()[_0x0402('0x2f')](function(){_0x3fbaa3[_0x0402('0x22')](0xcc)[_0x0402('0x23')]();});}};}function handleEntityNotFound(_0x528413,_0x32a95e){return function(_0x25b16f){if(!_0x25b16f){_0x528413['sendStatus'](0x194);}return _0x25b16f;};}function handleError(_0x544ac9,_0x4fc90f){_0x4fc90f=_0x4fc90f||0x1f4;return function(_0x26add6){logger[_0x0402('0x1c')](_0x26add6['stack']);if(_0x26add6['name']){delete _0x26add6[_0x0402('0x31')];}_0x544ac9[_0x0402('0x22')](_0x4fc90f)[_0x0402('0x32')](_0x26add6);};}exports[_0x0402('0x33')]=function(_0xdd363f,_0xbec02f){var _0x35093d={},_0x5ee01e={},_0x405dca={'count':0x0,'rows':[]};var _0x27a940=_[_0x0402('0x34')](db['Setting'][_0x0402('0x35')],function(_0x31cf30){return{'name':_0x31cf30['fieldName'],'type':_0x31cf30[_0x0402('0x36')]['key']};});_0x5ee01e[_0x0402('0x37')]=_['map'](_0x27a940,_0x0402('0x31'));_0x5ee01e['query']=_[_0x0402('0x38')](_0xdd363f[_0x0402('0x39')]);_0x5ee01e[_0x0402('0x3a')]=_[_0x0402('0x3b')](_0x5ee01e[_0x0402('0x37')],_0x5ee01e[_0x0402('0x39')]);_0x35093d[_0x0402('0x3c')]=_['intersection'](_0x5ee01e['model'],qs[_0x0402('0x3d')](_0xdd363f[_0x0402('0x39')][_0x0402('0x3d')]));_0x35093d[_0x0402('0x3c')]=_0x35093d['attributes']['length']?_0x35093d['attributes']:_0x5ee01e[_0x0402('0x37')];if(!_0xdd363f[_0x0402('0x39')][_0x0402('0x3e')]('nolimit')){_0x35093d[_0x0402('0x26')]=qs['limit'](_0xdd363f[_0x0402('0x39')][_0x0402('0x26')]);_0x35093d[_0x0402('0x25')]=qs[_0x0402('0x25')](_0xdd363f['query'][_0x0402('0x25')]);}_0x35093d[_0x0402('0x3f')]=qs['sort'](_0xdd363f[_0x0402('0x39')][_0x0402('0x40')]);_0x35093d[_0x0402('0x41')]=qs[_0x0402('0x3a')](_[_0x0402('0x42')](_0xdd363f[_0x0402('0x39')],_0x5ee01e[_0x0402('0x3a')]),_0x27a940);if(_0xdd363f[_0x0402('0x39')][_0x0402('0x43')]){_0x35093d[_0x0402('0x41')]=_[_0x0402('0x44')](_0x35093d['where'],{'$or':_[_0x0402('0x34')](_0x27a940,function(_0x15fc05){if(_0x15fc05['type']!==_0x0402('0x45')){var _0x20a577={};_0x20a577[_0x15fc05[_0x0402('0x31')]]={'$like':'%'+_0xdd363f[_0x0402('0x39')][_0x0402('0x43')]+'%'};return _0x20a577;}})});}_0x35093d=_[_0x0402('0x44')]({},_0x35093d,_0xdd363f[_0x0402('0x46')]);var _0x153588={'where':_0x35093d[_0x0402('0x41')]};return db[_0x0402('0x47')][_0x0402('0x28')](_0x153588)[_0x0402('0x2f')](function(_0x1e7cbe){_0x405dca[_0x0402('0x28')]=_0x1e7cbe;if(_0xdd363f[_0x0402('0x39')][_0x0402('0x48')]){_0x35093d['include']=[{'all':!![]}];}return db[_0x0402('0x47')][_0x0402('0x49')](_0x35093d);})[_0x0402('0x2f')](function(_0x572e24){_0x405dca[_0x0402('0x4a')]=_0x572e24;return _0x405dca;})['then'](respondWithFilteredResult(_0xbec02f,_0x35093d))['catch'](handleError(_0xbec02f,null));};exports[_0x0402('0x4b')]=function(_0x3d2dec,_0x34855a){var _0xb0e03f={'raw':![],'where':{'id':_0x3d2dec['params']['id']}},_0x2b3d31={};_0x2b3d31[_0x0402('0x37')]=_[_0x0402('0x38')](db[_0x0402('0x47')][_0x0402('0x35')]);_0x2b3d31[_0x0402('0x39')]=_[_0x0402('0x38')](_0x3d2dec[_0x0402('0x39')]);_0x2b3d31[_0x0402('0x3a')]=_[_0x0402('0x3b')](_0x2b3d31[_0x0402('0x37')],_0x2b3d31[_0x0402('0x39')]);_0xb0e03f[_0x0402('0x3c')]=_[_0x0402('0x3b')](_0x2b3d31[_0x0402('0x37')],qs['fields'](_0x3d2dec[_0x0402('0x39')]['fields']));_0xb0e03f[_0x0402('0x3c')]=_0xb0e03f[_0x0402('0x3c')][_0x0402('0x4c')]?_0xb0e03f[_0x0402('0x3c')]:_0x2b3d31[_0x0402('0x37')];if(_0x3d2dec[_0x0402('0x39')][_0x0402('0x48')]){_0xb0e03f[_0x0402('0x4d')]=[{'all':!![]}];}_0xb0e03f=_[_0x0402('0x44')]({},_0xb0e03f,_0x3d2dec['options']);return db[_0x0402('0x47')][_0x0402('0x4e')](_0xb0e03f)['then'](handleEntityNotFound(_0x34855a,null))[_0x0402('0x2f')](respondWithResult(_0x34855a,null))[_0x0402('0x4f')](handleError(_0x34855a,null));};exports[_0x0402('0x2e')]=function(_0xc6b310,_0x307eeb){if(_0xc6b310[_0x0402('0x50')]['id']){delete _0xc6b310[_0x0402('0x50')]['id'];}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0xc6b310['params']['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x307eeb,null))[_0x0402('0x2f')](saveUpdates(_0xc6b310[_0x0402('0x50')],null))[_0x0402('0x2f')](respondWithResult(_0x307eeb,null))[_0x0402('0x4f')](handleError(_0x307eeb,null));};exports[_0x0402('0x51')]=function(_0x348978,_0x4c5f82,_0x37b1ef){if(_0x348978[_0x0402('0x52')]&&_0x348978[_0x0402('0x52')][_0x0402('0x53')]){_0x348978[_0x0402('0x50')][_0x0402('0x54')]=_0x348978[_0x0402('0x52')][_0x0402('0x53')];}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x348978[_0x0402('0x55')]['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x4c5f82,null))[_0x0402('0x2f')](saveUpdates(_0x348978[_0x0402('0x50')],null))['then'](respondWithResult(_0x4c5f82,null))['catch'](handleError(_0x4c5f82,null));};exports[_0x0402('0x56')]=function(_0x5cc3ac,_0x330c2e,_0x554feb){if(_0x5cc3ac[_0x0402('0x52')]&&_0x5cc3ac[_0x0402('0x52')]['filename']){_0x5cc3ac[_0x0402('0x50')]['loginLogo']=_0x5cc3ac[_0x0402('0x52')]['filename'];}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0x5cc3ac['params']['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x330c2e,null))['then'](saveUpdates(_0x5cc3ac[_0x0402('0x50')],null))[_0x0402('0x2f')](respondWithResult(_0x330c2e,null))[_0x0402('0x4f')](handleError(_0x330c2e,null));};var utilLicense=require(_0x0402('0x15'));exports[_0x0402('0x57')]=function(_0x29379a,_0x5d77ec,_0x3b4415){var _0x20fc14=_0x0402('0x58');var _0x1a68b9={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xd0d0c8){if(_0xd0d0c8){_0x1a68b9=_0xd0d0c8;}return db[_0x0402('0x47')]['find']({'where':{'id':_0x29379a['params']['id']},'attributes':[_0x0402('0x54'),_0x0402('0x59'),_0x0402('0x5a'),_0x0402('0x5b'),_0x0402('0x5c'),_0x0402('0x5d'),_0x0402('0x5e'),_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d77ec,null))[_0x0402('0x2f')](function(_0x1a83b2){if(_0x1a83b2){var _0x433ddb=_0x1a83b2[_0x0402('0x54')]&&fs[_0x0402('0x60')](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x20fc14,_['toLower'](_0x1a83b2[_0x0402('0x54')])))?path[_0x0402('0x61')](config[_0x0402('0x62')],_0x20fc14,_[_0x0402('0x63')](_0x1a83b2['logo'])):path['join'](config[_0x0402('0x62')],_0x20fc14,_[_0x0402('0x63')]('default_logo.svg'));var _0x3be8a5='default'+_[_0x0402('0x64')](_0x0402('0x54'));if(_0x1a83b2[_0x3be8a5]||!_0x1a68b9[_0x0402('0x65')]){_0x433ddb=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x20fc14,_[_0x0402('0x63')]('default_logo.svg'));}if(!fs[_0x0402('0x60')](_0x433ddb)){throw new db[(_0x0402('0x66'))][(_0x0402('0x67'))](_['upperFirst'](_0x0402('0x54'))+_0x0402('0x68'));}return _0x5d77ec['download'](_0x433ddb);}})[_0x0402('0x4f')](handleError(_0x5d77ec,null));};var utilLicense=require(_0x0402('0x15'));exports[_0x0402('0x69')]=function(_0x5c4faa,_0xc64633,_0x11b6f5){var _0x7252c9='server/files/images/logos';var _0x2d567f={'custom':![]};return utilLicense[_0x0402('0x6a')]()['then'](function(_0x242b99){if(_0x242b99){_0x2d567f=_0x242b99;}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0x5c4faa[_0x0402('0x55')]['id']},'attributes':[_0x0402('0x54'),_0x0402('0x59'),_0x0402('0x5a'),_0x0402('0x5b'),_0x0402('0x5c'),_0x0402('0x5d'),_0x0402('0x5e'),_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xc64633,null))[_0x0402('0x2f')](function(_0x1dcec0){if(_0x1dcec0){var _0x8aa484=_0x1dcec0['loginLogo']&&fs['existsSync'](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x7252c9,_[_0x0402('0x63')](_0x1dcec0[_0x0402('0x59')])))?path[_0x0402('0x61')](config['root'],_0x7252c9,_[_0x0402('0x63')](_0x1dcec0[_0x0402('0x59')])):path['join'](config[_0x0402('0x62')],_0x7252c9,_[_0x0402('0x63')](_0x0402('0x6b')));var _0x292ace='default'+_[_0x0402('0x64')]('loginLogo');if(_0x1dcec0[_0x292ace]||!_0x2d567f[_0x0402('0x65')]){_0x8aa484=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x7252c9,_[_0x0402('0x63')](_0x0402('0x6b')));}if(!fs['existsSync'](_0x8aa484)){throw new db[(_0x0402('0x66'))][(_0x0402('0x67'))](_[_0x0402('0x64')](_0x0402('0x59'))+_0x0402('0x68'));}return _0xc64633[_0x0402('0x6c')](_0x8aa484);}})[_0x0402('0x4f')](handleError(_0xc64633,null));};exports[_0x0402('0x6d')]=function(_0x44e4bd,_0x52e3fb){return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x44e4bd[_0x0402('0x55')]['id']},'attributes':[_0x0402('0x6e')]})[_0x0402('0x2f')](respondWithResult(_0x52e3fb,null))[_0x0402('0x4f')](handleError(_0x52e3fb,null));};exports[_0x0402('0x6f')]=function(_0x21e87c,_0x24ed10,_0x3ef58a){if(_0x21e87c['file']&&_0x21e87c[_0x0402('0x52')][_0x0402('0x53')]){_0x21e87c[_0x0402('0x50')]['preferred']=_0x21e87c[_0x0402('0x52')][_0x0402('0x53')];}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x21e87c[_0x0402('0x55')]['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x24ed10,null))[_0x0402('0x2f')](saveUpdates(_0x21e87c[_0x0402('0x50')],null))[_0x0402('0x2f')](respondWithResult(_0x24ed10,null))['catch'](handleError(_0x24ed10,null));};var utilLicense=require(_0x0402('0x15'));exports[_0x0402('0x70')]=function(_0x9c75f5,_0xce6f3f,_0x214567){var _0x2f4690=_0x0402('0x58');var _0x410f2e={'custom':![]};return utilLicense[_0x0402('0x6a')]()['then'](function(_0x5e2984){if(_0x5e2984){_0x410f2e=_0x5e2984;}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0x9c75f5[_0x0402('0x55')]['id']},'attributes':[_0x0402('0x54'),'loginLogo',_0x0402('0x5a'),_0x0402('0x5b'),_0x0402('0x5c'),_0x0402('0x5d'),'defaultPreferred',_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xce6f3f,null))[_0x0402('0x2f')](function(_0x49e425){if(_0x49e425){var _0x4902a1=_0x49e425[_0x0402('0x5a')]&&fs[_0x0402('0x60')](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_['toLower'](_0x49e425['preferred'])))?path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_['toLower'](_0x49e425['preferred'])):path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_[_0x0402('0x63')](_0x0402('0x71')));var _0x59145f=_0x0402('0x72')+_[_0x0402('0x64')](_0x0402('0x5a'));if(_0x49e425[_0x59145f]||!_0x410f2e[_0x0402('0x65')]||!_0x410f2e[_0x0402('0x5a')]){_0x4902a1=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x2f4690,_['toLower']('default_preferred.png'));}if(!fs[_0x0402('0x60')](_0x4902a1)){throw new db['Sequelize'][(_0x0402('0x67'))](_[_0x0402('0x64')](_0x0402('0x5a'))+_0x0402('0x68'));}return _0xce6f3f[_0x0402('0x6c')](_0x4902a1);}})['catch'](handleError(_0xce6f3f,null));};exports[_0x0402('0x73')]=function(_0xeaa965,_0x2d2461,_0x4a135b){if(_0xeaa965[_0x0402('0x52')]&&_0xeaa965[_0x0402('0x52')][_0x0402('0x53')]){_0xeaa965[_0x0402('0x50')][_0x0402('0x5b')]=_0xeaa965['file'][_0x0402('0x53')];}return db[_0x0402('0x47')][_0x0402('0x4e')]({'where':{'id':_0xeaa965[_0x0402('0x55')]['id']}})[_0x0402('0x2f')](handleEntityNotFound(_0x2d2461,null))[_0x0402('0x2f')](saveUpdates(_0xeaa965['body'],null))[_0x0402('0x2f')](respondWithResult(_0x2d2461,null))[_0x0402('0x4f')](handleError(_0x2d2461,null));};var utilLicense=require(_0x0402('0x15'));exports['getFavicon']=function(_0x8dae95,_0x5a0b3c,_0x3dca98){var _0x414fc0=_0x0402('0x58');var _0x17bbf3={'custom':![]};return utilLicense['getLicense']()[_0x0402('0x2f')](function(_0x3053d3){if(_0x3053d3){_0x17bbf3=_0x3053d3;}return db['Setting'][_0x0402('0x4e')]({'where':{'id':_0x8dae95[_0x0402('0x55')]['id']},'attributes':['logo',_0x0402('0x59'),_0x0402('0x5a'),_0x0402('0x5b'),'defaultLogo',_0x0402('0x5d'),_0x0402('0x5e'),_0x0402('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5a0b3c,null))[_0x0402('0x2f')](function(_0x193060){if(_0x193060){var _0x3c812f=_0x193060[_0x0402('0x5b')]&&fs[_0x0402('0x60')](path[_0x0402('0x61')](config[_0x0402('0x62')],_0x414fc0,_[_0x0402('0x63')](_0x193060[_0x0402('0x5b')])))?path[_0x0402('0x61')](config['root'],_0x414fc0,_[_0x0402('0x63')](_0x193060[_0x0402('0x5b')])):path[_0x0402('0x61')](config[_0x0402('0x62')],_0x414fc0,_[_0x0402('0x63')]('default_favicon.ico'));var _0x4b4653='default'+_[_0x0402('0x64')](_0x0402('0x5b'));if(_0x193060[_0x4b4653]||!_0x17bbf3[_0x0402('0x65')]){_0x3c812f=path[_0x0402('0x61')](config[_0x0402('0x62')],_0x414fc0,_[_0x0402('0x63')]('default_favicon.ico'));}if(!fs[_0x0402('0x60')](_0x3c812f)){throw new db['Sequelize'][(_0x0402('0x67'))](_[_0x0402('0x64')](_0x0402('0x5b'))+'\x20not\x20found');}return _0x5a0b3c[_0x0402('0x6c')](_0x3c812f);}})[_0x0402('0x4f')](handleError(_0x5a0b3c,null));};exports[_0x0402('0x74')]=function(_0x255353,_0x3528d7){var _0x21431a={'offset':moment()[_0x0402('0x75')]()};_0x21431a[_0x0402('0x76')]=moment()[_0x0402('0x75')](_0x21431a[_0x0402('0x25')])[_0x0402('0x77')](_0x0402('0x78'));return _0x3528d7[_0x0402('0x22')](0xc8)[_0x0402('0x32')](_0x21431a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9599fdb..2129921 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x3ad9b3,_0x5c76e9){var _0x4ef8d1=function(_0x239036){while(--_0x239036){_0x3ad9b3['push'](_0x3ad9b3['shift']());}};_0x4ef8d1(++_0x5c76e9);}(_0x3e74,0x175));var _0x43e7=function(_0x3d5ef6,_0x8c0478){_0x3d5ef6=_0x3d5ef6-0x0;var _0x13ceea=_0x3e74[_0x3d5ef6];return _0x13ceea;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x3e74,0x175));var _0x43e7=function(_0x6f6db7,_0xd14453){_0x6f6db7=_0x6f6db7-0x0;var _0x4f598a=_0x3e74[_0x6f6db7];return _0x4f598a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c53a5a7..fd8eead 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 _0x50cb=['Setting','find','options','raw','where','attributes','include','map','model','ShowSetting','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x50cb,0x82));var _0xb50c=function(_0x320f93,_0x26e4aa){_0x320f93=_0x320f93-0x0;var _0x558890=_0x50cb[_0x320f93];return _0x558890;};'use strict';var _=require(_0xb50c('0x0'));var util=require('util');var moment=require(_0xb50c('0x1'));var BPromise=require(_0xb50c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb50c('0x3'));var logger=require('../../config/logger')(_0xb50c('0x4'));var config=require(_0xb50c('0x5'));var jayson=require(_0xb50c('0x6'));var client=jayson[_0xb50c('0x7')][_0xb50c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58db3f,_0x29145f,_0x2a9e3b){return new BPromise(function(_0x21e513,_0x8cc6f8){return client[_0xb50c('0x9')](_0x58db3f,_0x2a9e3b)['then'](function(_0x49cb82){logger[_0xb50c('0xa')](_0xb50c('0xb'),_0x29145f,'request\x20sent');logger[_0xb50c('0xc')](_0xb50c('0xd'),_0x29145f,'request\x20sent',JSON[_0xb50c('0xe')](_0x49cb82));if(_0x49cb82[_0xb50c('0xf')]){if(_0x49cb82[_0xb50c('0xf')]['code']===0x1f4){logger[_0xb50c('0xf')]('Setting,\x20%s,\x20%s',_0x29145f,_0x49cb82[_0xb50c('0xf')][_0xb50c('0x10')]);return _0x8cc6f8(_0x49cb82['error'][_0xb50c('0x10')]);}logger['error'](_0xb50c('0xb'),_0x29145f,_0x49cb82[_0xb50c('0xf')][_0xb50c('0x10')]);return _0x21e513(_0x49cb82['error']['message']);}else{logger['info'](_0xb50c('0xb'),_0x29145f,_0xb50c('0x11'));_0x21e513(_0x49cb82[_0xb50c('0x12')][_0xb50c('0x10')]);}})[_0xb50c('0x13')](function(_0x2acf3c){logger['error'](_0xb50c('0xb'),_0x29145f,_0x2acf3c);_0x8cc6f8(_0x2acf3c);});});}exports['ShowSetting']=function(_0x2eec4e){var _0x13f83f=this;return new Promise(function(_0x4605cd,_0x179ba3){return db[_0xb50c('0x14')][_0xb50c('0x15')]({'raw':_0x2eec4e[_0xb50c('0x16')]?_0x2eec4e[_0xb50c('0x16')][_0xb50c('0x17')]===undefined?!![]:![]:!![],'where':_0x2eec4e[_0xb50c('0x16')]?_0x2eec4e['options'][_0xb50c('0x18')]||null:null,'attributes':_0x2eec4e['options']?_0x2eec4e[_0xb50c('0x16')][_0xb50c('0x19')]||null:null,'include':_0x2eec4e[_0xb50c('0x16')]?_0x2eec4e[_0xb50c('0x16')][_0xb50c('0x1a')]?_[_0xb50c('0x1b')](_0x2eec4e[_0xb50c('0x16')][_0xb50c('0x1a')],function(_0xbdcf25){return{'model':db[_0xbdcf25[_0xb50c('0x1c')]],'as':_0xbdcf25['as'],'attributes':_0xbdcf25[_0xb50c('0x19')],'include':_0xbdcf25[_0xb50c('0x1a')]?_[_0xb50c('0x1b')](_0xbdcf25[_0xb50c('0x1a')],function(_0x630102){return{'model':db[_0x630102[_0xb50c('0x1c')]],'as':_0x630102['as'],'attributes':_0x630102[_0xb50c('0x19')],'include':_0x630102['include']?_[_0xb50c('0x1b')](_0x630102[_0xb50c('0x1a')],function(_0x4baac0){return{'model':db[_0x4baac0['model']],'as':_0x4baac0['as'],'attributes':_0x4baac0[_0xb50c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd97ac5){logger[_0xb50c('0xa')](_0xb50c('0x1d'),_0x2eec4e);logger[_0xb50c('0xc')](_0xb50c('0x1d'),_0x2eec4e,JSON[_0xb50c('0xe')](_0xd97ac5));_0x4605cd(_0xd97ac5);})[_0xb50c('0x13')](function(_0x69de5c){logger[_0xb50c('0xf')]('ShowSetting',_0x69de5c[_0xb50c('0x10')],_0x2eec4e);_0x179ba3(_0x13f83f[_0xb50c('0xf')](0x1f4,_0x69de5c[_0xb50c('0x10')]));});});}; \ No newline at end of file +var _0x2863=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3df238,_0x2e1000){var _0x356824=function(_0x359d1e){while(--_0x359d1e){_0x3df238['push'](_0x3df238['shift']());}};_0x356824(++_0x2e1000);}(_0x2863,0xcf));var _0x3286=function(_0x381f3d,_0x3730e0){_0x381f3d=_0x381f3d-0x0;var _0x1b7eed=_0x2863[_0x381f3d];return _0x1b7eed;};'use strict';var _=require('lodash');var util=require(_0x3286('0x0'));var moment=require(_0x3286('0x1'));var BPromise=require(_0x3286('0x2'));var rs=require(_0x3286('0x3'));var fs=require('fs');var Redis=require(_0x3286('0x4'));var db=require(_0x3286('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3286('0x6'))(_0x3286('0x7'));var config=require(_0x3286('0x8'));var jayson=require(_0x3286('0x9'));var client=jayson[_0x3286('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfaa969,_0xd3debf,_0x5120f8){return new BPromise(function(_0x1c7bd4,_0x3b2ae2){return client[_0x3286('0xb')](_0xfaa969,_0x5120f8)[_0x3286('0xc')](function(_0x2f05d6){logger[_0x3286('0xd')](_0x3286('0xe'),_0xd3debf,_0x3286('0xf'));logger[_0x3286('0x10')](_0x3286('0x11'),_0xd3debf,'request\x20sent',JSON[_0x3286('0x12')](_0x2f05d6));if(_0x2f05d6['error']){if(_0x2f05d6[_0x3286('0x13')][_0x3286('0x14')]===0x1f4){logger['error'](_0x3286('0xe'),_0xd3debf,_0x2f05d6[_0x3286('0x13')][_0x3286('0x15')]);return _0x3b2ae2(_0x2f05d6['error'][_0x3286('0x15')]);}logger['error']('Setting,\x20%s,\x20%s',_0xd3debf,_0x2f05d6[_0x3286('0x13')][_0x3286('0x15')]);return _0x1c7bd4(_0x2f05d6[_0x3286('0x13')][_0x3286('0x15')]);}else{logger['info'](_0x3286('0xe'),_0xd3debf,'request\x20sent');_0x1c7bd4(_0x2f05d6[_0x3286('0x16')][_0x3286('0x15')]);}})[_0x3286('0x17')](function(_0x2088e8){logger[_0x3286('0x13')](_0x3286('0xe'),_0xd3debf,_0x2088e8);_0x3b2ae2(_0x2088e8);});});}exports[_0x3286('0x18')]=function(_0x3f2075){var _0x496210=this;return new Promise(function(_0x1e3731,_0x42c9dc){return db['Setting'][_0x3286('0x19')]({'raw':_0x3f2075[_0x3286('0x1a')]?_0x3f2075['options'][_0x3286('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f2075[_0x3286('0x1a')]?_0x3f2075[_0x3286('0x1a')]['where']||null:null,'attributes':_0x3f2075['options']?_0x3f2075[_0x3286('0x1a')][_0x3286('0x1c')]||null:null,'include':_0x3f2075[_0x3286('0x1a')]?_0x3f2075[_0x3286('0x1a')][_0x3286('0x1d')]?_[_0x3286('0x1e')](_0x3f2075[_0x3286('0x1a')][_0x3286('0x1d')],function(_0x132556){return{'model':db[_0x132556[_0x3286('0x1f')]],'as':_0x132556['as'],'attributes':_0x132556['attributes'],'include':_0x132556['include']?_[_0x3286('0x1e')](_0x132556[_0x3286('0x1d')],function(_0x2f38ad){return{'model':db[_0x2f38ad[_0x3286('0x1f')]],'as':_0x2f38ad['as'],'attributes':_0x2f38ad[_0x3286('0x1c')],'include':_0x2f38ad['include']?_[_0x3286('0x1e')](_0x2f38ad['include'],function(_0x4d7fb2){return{'model':db[_0x4d7fb2['model']],'as':_0x4d7fb2['as'],'attributes':_0x4d7fb2[_0x3286('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5575f5){logger['info'](_0x3286('0x18'),_0x3f2075);logger[_0x3286('0x10')](_0x3286('0x18'),_0x3f2075,JSON['stringify'](_0x5575f5));_0x1e3731(_0x5575f5);})[_0x3286('0x17')](function(_0x380bea){logger[_0x3286('0x13')](_0x3286('0x18'),_0x380bea[_0x3286('0x15')],_0x3f2075);_0x42c9dc(_0x496210['error'](0x1f4,_0x380bea[_0x3286('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 2f6fb15..e5369a5 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 _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x264e46,_0x5284f9){var _0xbb7c52=function(_0x10a1d7){while(--_0x10a1d7){_0x264e46['push'](_0x264e46['shift']());}};_0xbb7c52(++_0x5284f9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x5fc3[_0x32b993];return _0x482780;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x455a15,_0xc76064){_0x455a15=_0x455a15-0x0;var _0x82c420=_0xf494[_0x455a15];return _0x82c420;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e443124..0f30486 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 _0x88e5=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x88e5,0x185));var _0x588e=function(_0x1715f2,_0x4b0c5c){_0x1715f2=_0x1715f2-0x0;var _0x3cf037=_0x88e5[_0x1715f2];return _0x3cf037;};'use strict';var Sequelize=require(_0x588e('0x0'));var rs=require(_0x588e('0x1'));module[_0x588e('0x2')]={'name':{'type':Sequelize[_0x588e('0x3')],'unique':_0x588e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x588e('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x588e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x588e('0x3')],'defaultValue':function(){return rs[_0x588e('0x5')]();}},'phone':{'type':Sequelize[_0x588e('0x3')]},'type':{'type':Sequelize[_0x588e('0x6')](_0x588e('0x7'),_0x588e('0x8'),_0x588e('0x9'),'clicksend',_0x588e('0xa'),_0x588e('0xb'),_0x588e('0xc'),_0x588e('0xd'),_0x588e('0xe'),_0x588e('0xf'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x588e('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x588e('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x588e('0x3')]},'password':{'type':Sequelize[_0x588e('0x3')]},'apiKey':{'type':Sequelize[_0x588e('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x588e('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x588e('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x588e('0x11')],'defaultValue':function(){return _0x588e('0x12');}},'notificationSound':{'type':Sequelize[_0x588e('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x588e('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x588e('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x588e('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x588e('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x588e('0x13')],'comment':_0x588e('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x588e('0x10')],'defaultValue':![],'comment':_0x588e('0x15'),'set':function(_0x585a44){if(!_0x585a44)this[_0x588e('0x16')](_0x588e('0x17'),null);this[_0x588e('0x16')]('mandatoryDisposition',_0x585a44);}}}; \ No newline at end of file +var _0x4bc0=['connectel','clicksend','plivo','bandwidth','csc','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','twilio','skebby'];(function(_0x65605f,_0x3c1119){var _0x5f421a=function(_0x365a50){while(--_0x365a50){_0x65605f['push'](_0x65605f['shift']());}};_0x5f421a(++_0x3c1119);}(_0x4bc0,0x1c8));var _0x04bc=function(_0x117343,_0x14a8e0){_0x117343=_0x117343-0x0;var _0x542aa7=_0x4bc0[_0x117343];return _0x542aa7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x04bc('0x0'));module[_0x04bc('0x1')]={'name':{'type':Sequelize[_0x04bc('0x2')],'unique':_0x04bc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x04bc('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x04bc('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x04bc('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x04bc('0x2')]},'type':{'type':Sequelize['ENUM'](_0x04bc('0x4'),_0x04bc('0x5'),_0x04bc('0x6'),_0x04bc('0x7'),_0x04bc('0x8'),'clickatell',_0x04bc('0x9'),_0x04bc('0xa'),'infobip',_0x04bc('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x04bc('0x2')]},'smsMethod':{'type':Sequelize[_0x04bc('0xc')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x04bc('0x2')]},'accountId':{'type':Sequelize[_0x04bc('0x2')]},'senderString':{'type':Sequelize[_0x04bc('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x04bc('0xd')],'defaultValue':function(){return _0x04bc('0xe');}},'notificationSound':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04bc('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x04bc('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x04bc('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x04bc('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04bc('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x04bc('0xf')],'defaultValue':![],'comment':_0x04bc('0x11'),'set':function(_0x1b81d6){if(!_0x1b81d6)this[_0x04bc('0x12')](_0x04bc('0x13'),null);this[_0x04bc('0x12')](_0x04bc('0x14'),_0x1b81d6);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index eac6cc5..06b76b6 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 _0x78a8=['defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','type','key','map','query','keys','model','attributes','intersection','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','fields','pick','removeDispositions','ids','CannedAnswer','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','plivo','Text','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','list','omit','Contacts','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','getInteractions','Contact','internal','Tags','color','tag','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','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'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x78a8,0x1b0));var _0x878a=function(_0x25bf6d,_0x1064d9){_0x25bf6d=_0x25bf6d-0x0;var _0xf14c=_0x78a8[_0x25bf6d];return _0xf14c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x878a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x878a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x878a('0x2'));var Mustache=require(_0x878a('0x3'));var util=require(_0x878a('0x4'));var path=require(_0x878a('0x5'));var sox=require('sox');var csv=require(_0x878a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x878a('0x7'));var _=require(_0x878a('0x8'));var squel=require('squel');var crypto=require(_0x878a('0x9'));var jsforce=require(_0x878a('0xa'));var deskjs=require(_0x878a('0xb'));var toCsv=require(_0x878a('0x6'));var querystring=require(_0x878a('0xc'));var Papa=require(_0x878a('0xd'));var Redis=require(_0x878a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x878a('0xf'));var as=require(_0x878a('0x10'));var hardwareService=require(_0x878a('0x11'));var logger=require(_0x878a('0x12'))(_0x878a('0x13'));var utils=require(_0x878a('0x14'));var config=require(_0x878a('0x15'));var licenseUtil=require(_0x878a('0x16'));var db=require(_0x878a('0x17'))['db'];config['redis']=_[_0x878a('0x18')](config[_0x878a('0x19')],{'host':_0x878a('0x1a'),'port':0x18eb});var socket=require(_0x878a('0x1b'))(new Redis(config[_0x878a('0x19')]));require(_0x878a('0x1c'))['register'](socket);var jayson=require(_0x878a('0x1d'));var client=jayson[_0x878a('0x1e')][_0x878a('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x50817e,_0x200d3f,_0x25e670,_0x1edfbf){return new BPromise(function(_0x29e70c,_0x3a6a3c){var _0x244190=_0x1edfbf||client;return _0x244190[_0x878a('0x20')](_0x50817e,_0x25e670)[_0x878a('0x21')](function(_0x4e72c5){logger['info'](_0x878a('0x22'),_0x200d3f,_0x878a('0x23'));logger[_0x878a('0x24')](_0x878a('0x25'),_0x200d3f,_0x878a('0x23'),JSON[_0x878a('0x26')](_0x4e72c5));if(_0x4e72c5[_0x878a('0x27')]){if(_0x4e72c5[_0x878a('0x27')][_0x878a('0x28')]===0x1f4){logger['error'](_0x878a('0x22'),_0x200d3f,_0x4e72c5['error'][_0x878a('0x29')]);return _0x3a6a3c(_0x4e72c5[_0x878a('0x27')][_0x878a('0x29')]);}logger[_0x878a('0x27')](_0x878a('0x22'),_0x200d3f,_0x4e72c5[_0x878a('0x27')][_0x878a('0x29')]);return _0x29e70c(_0x4e72c5[_0x878a('0x27')][_0x878a('0x29')]);}else{logger[_0x878a('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x200d3f,_0x878a('0x23'));_0x29e70c(_0x4e72c5[_0x878a('0x2b')][_0x878a('0x29')]);}})[_0x878a('0x2c')](function(_0x48f291){logger[_0x878a('0x27')](_0x878a('0x22'),_0x200d3f,_0x48f291);_0x3a6a3c(_0x48f291);});});}function respondWithStatusCode(_0x563587,_0x37d108){_0x37d108=_0x37d108||0xcc;return function(_0x1bcdbb){if(_0x1bcdbb){return _0x563587[_0x878a('0x2d')](_0x37d108);}return _0x563587[_0x878a('0x2e')](_0x37d108)['end']();};}function respondWithResult(_0x1f8d8e,_0x51a614){_0x51a614=_0x51a614||0xc8;return function(_0x7c4f2a){if(_0x7c4f2a){return _0x1f8d8e[_0x878a('0x2e')](_0x51a614)[_0x878a('0x2f')](_0x7c4f2a);}};}function respondWithFilteredResult(_0x53b21e,_0x49955c){return function(_0xc7d781){if(_0xc7d781){var _0x2c9bde=typeof _0x49955c['offset']===_0x878a('0x30')&&typeof _0x49955c[_0x878a('0x31')]===_0x878a('0x30');var _0x4e0b92=_0xc7d781[_0x878a('0x32')];var _0x1f3200=_0x2c9bde?0x0:_0x49955c[_0x878a('0x33')];var _0x8d877=_0x2c9bde?_0xc7d781[_0x878a('0x32')]:_0x49955c['offset']+_0x49955c[_0x878a('0x31')];var _0x1d5534;if(_0x8d877>=_0x4e0b92){_0x8d877=_0x4e0b92;_0x1d5534=0xc8;}else{_0x1d5534=0xce;}_0x53b21e[_0x878a('0x2e')](_0x1d5534);return _0x53b21e[_0x878a('0x34')](_0x878a('0x35'),_0x1f3200+'-'+_0x8d877+'/'+_0x4e0b92)[_0x878a('0x2f')](_0xc7d781);}return null;};}function patchUpdates(_0x5eff67){return function(_0x16a1e4){try{jsonpatch[_0x878a('0x36')](_0x16a1e4,_0x5eff67,!![]);}catch(_0x3412f2){return BPromise['reject'](_0x3412f2);}return _0x16a1e4[_0x878a('0x37')]();};}function saveUpdates(_0x56b21a,_0x66972c){return function(_0x457211){if(_0x457211){return _0x457211[_0x878a('0x38')](_0x56b21a)[_0x878a('0x21')](function(_0x2b22a4){return _0x2b22a4;});}return null;};}function removeEntity(_0x4d6807,_0x37ab07){return function(_0x1fbb39){if(_0x1fbb39){return _0x1fbb39[_0x878a('0x39')]()[_0x878a('0x21')](function(){var _0x524cca=_0x1fbb39[_0x878a('0x3a')]({'plain':!![]});var _0x59d3bb=_0x878a('0x3b');return db[_0x878a('0x3c')]['destroy']({'where':{'type':_0x59d3bb,'resourceId':_0x524cca['id']}})['then'](function(){return _0x1fbb39;});})[_0x878a('0x21')](function(){_0x4d6807[_0x878a('0x2e')](0xcc)[_0x878a('0x3d')]();});}};}function handleEntityNotFound(_0x1d6849,_0x52532d){return function(_0x24bddb){if(!_0x24bddb){_0x1d6849[_0x878a('0x2d')](0x194);}return _0x24bddb;};}function handleError(_0x49a9bb,_0x16cbbf){_0x16cbbf=_0x16cbbf||0x1f4;return function(_0x16a21b){logger[_0x878a('0x27')](_0x16a21b[_0x878a('0x3e')]);if(_0x16a21b[_0x878a('0x3f')]){delete _0x16a21b['name'];}_0x49a9bb[_0x878a('0x2e')](_0x16cbbf)['send'](_0x16a21b);};}exports[_0x878a('0x40')]=function(_0xf2ac53,_0x323251){var _0x523b35={'include':[{'model':db[_0x878a('0x41')],'as':_0x878a('0x42')}]},_0x52ca4a={},_0x33162d={'count':0x0,'rows':[]};var _0x259ecd=_['map'](db[_0x878a('0x43')]['rawAttributes'],function(_0x25771c){return{'name':_0x25771c['fieldName'],'type':_0x25771c[_0x878a('0x44')][_0x878a('0x45')]};});_0x52ca4a['model']=_[_0x878a('0x46')](_0x259ecd,_0x878a('0x3f'));_0x52ca4a[_0x878a('0x47')]=_[_0x878a('0x48')](_0xf2ac53[_0x878a('0x47')]);_0x52ca4a['filters']=_['intersection'](_0x52ca4a[_0x878a('0x49')],_0x52ca4a['query']);_0x523b35[_0x878a('0x4a')]=_[_0x878a('0x4b')](_0x52ca4a[_0x878a('0x49')],qs['fields'](_0xf2ac53[_0x878a('0x47')]['fields']));_0x523b35['attributes']=_0x523b35[_0x878a('0x4a')][_0x878a('0x4c')]?_0x523b35[_0x878a('0x4a')]:_0x52ca4a['model'];if(!_0xf2ac53[_0x878a('0x47')][_0x878a('0x4d')]('nolimit')){_0x523b35['limit']=qs['limit'](_0xf2ac53[_0x878a('0x47')][_0x878a('0x31')]);_0x523b35[_0x878a('0x33')]=qs['offset'](_0xf2ac53[_0x878a('0x47')][_0x878a('0x33')]);}_0x523b35[_0x878a('0x4e')]=qs['sort'](_0xf2ac53[_0x878a('0x47')][_0x878a('0x4f')]);_0x523b35[_0x878a('0x50')]=qs[_0x878a('0x51')](_['pick'](_0xf2ac53[_0x878a('0x47')],_0x52ca4a[_0x878a('0x51')]),_0x259ecd);if(_0xf2ac53[_0x878a('0x47')][_0x878a('0x52')]){_0x523b35[_0x878a('0x50')]=_[_0x878a('0x53')](_0x523b35['where'],{'$or':_['map'](_0x259ecd,function(_0x240616){if(_0x240616[_0x878a('0x44')]!==_0x878a('0x54')){var _0x21f8b0={};_0x21f8b0[_0x240616[_0x878a('0x3f')]]={'$like':'%'+_0xf2ac53[_0x878a('0x47')][_0x878a('0x52')]+'%'};return _0x21f8b0;}})});}_0x523b35=_[_0x878a('0x53')]({},_0x523b35,_0xf2ac53['options']);var _0x31c49c={'where':_0x523b35[_0x878a('0x50')]};return db['SmsAccount'][_0x878a('0x32')](_0x31c49c)[_0x878a('0x21')](function(_0x262157){_0x33162d[_0x878a('0x32')]=_0x262157;if(_0xf2ac53['query'][_0x878a('0x55')]){_0x523b35[_0x878a('0x56')]=[{'all':!![]}];}return db['SmsAccount'][_0x878a('0x57')](_0x523b35);})[_0x878a('0x21')](function(_0x5b06cf){_0x33162d[_0x878a('0x58')]=_0x5b06cf;return _0x33162d;})[_0x878a('0x21')](respondWithFilteredResult(_0x323251,_0x523b35))[_0x878a('0x2c')](handleError(_0x323251,null));};exports[_0x878a('0x59')]=function(_0x5cf5bd,_0x18cd42){var _0x272f7e={'raw':![],'where':{'id':_0x5cf5bd['params']['id']},'include':[{'model':db[_0x878a('0x41')],'as':_0x878a('0x42')}]},_0x18c0de={};_0x18c0de[_0x878a('0x49')]=_['keys'](db[_0x878a('0x43')][_0x878a('0x5a')]);_0x18c0de[_0x878a('0x47')]=_[_0x878a('0x48')](_0x5cf5bd['query']);_0x18c0de[_0x878a('0x51')]=_[_0x878a('0x4b')](_0x18c0de['model'],_0x18c0de[_0x878a('0x47')]);_0x272f7e[_0x878a('0x4a')]=_[_0x878a('0x4b')](_0x18c0de[_0x878a('0x49')],qs['fields'](_0x5cf5bd[_0x878a('0x47')]['fields']));_0x272f7e[_0x878a('0x4a')]=_0x272f7e[_0x878a('0x4a')][_0x878a('0x4c')]?_0x272f7e['attributes']:_0x18c0de[_0x878a('0x49')];if(_0x5cf5bd[_0x878a('0x47')][_0x878a('0x55')]){_0x272f7e[_0x878a('0x56')]=[{'all':!![]}];}_0x272f7e=_['merge']({},_0x272f7e,_0x5cf5bd[_0x878a('0x5b')]);return db[_0x878a('0x43')][_0x878a('0x5c')](_0x272f7e)['then'](handleEntityNotFound(_0x18cd42,null))[_0x878a('0x21')](respondWithResult(_0x18cd42,null))['catch'](handleError(_0x18cd42,null));};exports['create']=function(_0x2ccd11,_0x2b0531){return db[_0x878a('0x43')][_0x878a('0x5d')](_0x2ccd11['body'],{})[_0x878a('0x21')](function(_0x477c9d){var _0x3b1fa0=_0x2ccd11[_0x878a('0x5e')][_0x878a('0x3a')]({'plain':!![]});if(!_0x3b1fa0)throw new Error(_0x878a('0x5f'));if(_0x3b1fa0['role']===_0x878a('0x5e')){var _0x163494=_0x477c9d[_0x878a('0x3a')]({'plain':!![]});var _0x131e31=_0x878a('0x3b');return db['UserProfileSection']['find']({'where':{'name':_0x131e31,'userProfileId':_0x3b1fa0[_0x878a('0x60')]},'raw':!![]})[_0x878a('0x21')](function(_0x437bf3){if(_0x437bf3&&_0x437bf3[_0x878a('0x61')]===0x0){return db[_0x878a('0x3c')][_0x878a('0x5d')]({'name':_0x163494['name'],'resourceId':_0x163494['id'],'type':_0x437bf3[_0x878a('0x3f')],'sectionId':_0x437bf3['id']},{})[_0x878a('0x21')](function(){return _0x477c9d;});}else{return _0x477c9d;}})[_0x878a('0x2c')](function(_0x430913){logger[_0x878a('0x27')](_0x878a('0x62'),_0x430913);throw _0x430913;});}return _0x477c9d;})[_0x878a('0x21')](respondWithResult(_0x2b0531,0xc9))[_0x878a('0x2c')](handleError(_0x2b0531,null));};exports[_0x878a('0x38')]=function(_0x1eb09c,_0x3a8ded){if(_0x1eb09c[_0x878a('0x63')]['id']){delete _0x1eb09c[_0x878a('0x63')]['id'];}return db[_0x878a('0x43')]['find']({'where':{'id':_0x1eb09c[_0x878a('0x64')]['id']},'include':[{'model':db[_0x878a('0x41')],'as':'mandatoryDispositionPause'}]})[_0x878a('0x21')](handleEntityNotFound(_0x3a8ded,null))[_0x878a('0x21')](saveUpdates(_0x1eb09c[_0x878a('0x63')],null))['then'](respondWithResult(_0x3a8ded,null))[_0x878a('0x2c')](handleError(_0x3a8ded,null));};exports['destroy']=function(_0x1b973d,_0x16dce7){return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x1b973d['params']['id']}})['then'](handleEntityNotFound(_0x16dce7,null))['then'](removeEntity(_0x16dce7,null))[_0x878a('0x2c')](handleError(_0x16dce7,null));};exports[_0x878a('0x65')]=function(_0x18e99c,_0x53324e){return db[_0x878a('0x43')][_0x878a('0x65')]()[_0x878a('0x21')](respondWithResult(_0x53324e,null))[_0x878a('0x2c')](handleError(_0x53324e,null));};exports[_0x878a('0x66')]=function(_0x8c86a8,_0x4656a9,_0x30d5a9){if(_0x8c86a8[_0x878a('0x63')]['id']){delete _0x8c86a8[_0x878a('0x63')]['id'];}return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x8c86a8[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x4656a9,null))['then'](function(_0x31787a){if(_0x31787a){_0x8c86a8[_0x878a('0x63')][_0x878a('0x67')]=_0x31787a['id'];return db[_0x878a('0x68')][_0x878a('0x5d')](_0x8c86a8['body']);}})[_0x878a('0x21')](respondWithResult(_0x4656a9,null))['catch'](handleError(_0x4656a9,null));};exports[_0x878a('0x69')]=function(_0x299977,_0x2252e1,_0x1148d8){var _0x187f9b={'raw':![],'where':{}};var _0x371559={};var _0x39dccb={'count':0x0,'rows':[]};return db[_0x878a('0x43')][_0x878a('0x6a')]({'where':{'id':_0x299977[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x2252e1,null))['then'](function(_0xbc8797){if(_0xbc8797){_0x371559[_0x878a('0x49')]=_['keys'](db[_0x878a('0x68')][_0x878a('0x5a')]);_0x371559[_0x878a('0x47')]=_[_0x878a('0x48')](_0x299977[_0x878a('0x47')]);_0x371559[_0x878a('0x51')]=_[_0x878a('0x4b')](_0x371559[_0x878a('0x49')],_0x371559[_0x878a('0x47')]);_0x187f9b[_0x878a('0x4a')]=_['intersection'](_0x371559[_0x878a('0x49')],qs['fields'](_0x299977[_0x878a('0x47')][_0x878a('0x6b')]));_0x187f9b[_0x878a('0x4a')]=_0x187f9b[_0x878a('0x4a')][_0x878a('0x4c')]?_0x187f9b['attributes']:_0x371559[_0x878a('0x49')];if(!_0x299977[_0x878a('0x47')][_0x878a('0x4d')]('nolimit')){_0x187f9b[_0x878a('0x31')]=qs[_0x878a('0x31')](_0x299977['query'][_0x878a('0x31')]);_0x187f9b[_0x878a('0x33')]=qs[_0x878a('0x33')](_0x299977[_0x878a('0x47')][_0x878a('0x33')]);}_0x187f9b[_0x878a('0x4e')]=qs['sort'](_0x299977['query']['sort']);_0x187f9b[_0x878a('0x50')]=qs['filters'](_[_0x878a('0x6c')](_0x299977[_0x878a('0x47')],_0x371559[_0x878a('0x51')]));_0x187f9b[_0x878a('0x50')]['SmsAccountId']=_0xbc8797['id'];if(_0x299977[_0x878a('0x47')][_0x878a('0x52')]){_0x187f9b[_0x878a('0x50')]=_[_0x878a('0x53')](_0x187f9b[_0x878a('0x50')],{'$or':_[_0x878a('0x46')](_0x187f9b['attributes'],function(_0x240dbc){var _0x1baa7a={};_0x1baa7a[_0x240dbc]={'$like':'%'+_0x299977[_0x878a('0x47')][_0x878a('0x52')]+'%'};return _0x1baa7a;})});}_0x187f9b=_[_0x878a('0x53')]({},_0x187f9b,_0x299977['options']);return db['Disposition']['count']({'where':_0x187f9b[_0x878a('0x50')]})['then'](function(_0xd14775){_0x39dccb['count']=_0xd14775;if(_0x299977[_0x878a('0x47')][_0x878a('0x55')]){_0x187f9b[_0x878a('0x56')]=[{'all':!![]}];}return db[_0x878a('0x68')]['findAll'](_0x187f9b);})['then'](function(_0x33953e){_0x39dccb['rows']=_0x33953e;return _0x39dccb;});}})[_0x878a('0x21')](respondWithFilteredResult(_0x2252e1,_0x187f9b))[_0x878a('0x2c')](handleError(_0x2252e1,null));};exports[_0x878a('0x6d')]=function(_0x557151,_0x2b2beb,_0x2e275a){return db['SmsAccount'][_0x878a('0x5c')]({'where':{'id':_0x557151[_0x878a('0x64')]['id']}})['then'](handleEntityNotFound(_0x2b2beb,null))[_0x878a('0x21')](function(_0x4099eb){if(_0x4099eb){return _0x4099eb['removeDispositions'](_0x557151[_0x878a('0x47')][_0x878a('0x6e')]);}})[_0x878a('0x21')](respondWithStatusCode(_0x2b2beb,null))[_0x878a('0x2c')](handleError(_0x2b2beb,null));};exports['addAnswer']=function(_0x2723d7,_0x36c01e,_0x4eb4d5){if(_0x2723d7['body']['id']){delete _0x2723d7[_0x878a('0x63')]['id'];}return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x2723d7['params']['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x36c01e,null))[_0x878a('0x21')](function(_0x50f5db){if(_0x50f5db){_0x2723d7[_0x878a('0x63')]['SmsAccountId']=_0x50f5db['id'];return db[_0x878a('0x6f')][_0x878a('0x5d')](_0x2723d7[_0x878a('0x63')]);}})['then'](respondWithResult(_0x36c01e,null))[_0x878a('0x2c')](handleError(_0x36c01e,null));};exports['getAnswers']=function(_0x24345a,_0x4b8112,_0x19d05a){var _0x49f9a8={'raw':![],'where':{}};var _0xe9997f={};var _0x51dd0f={'count':0x0,'rows':[]};return db[_0x878a('0x43')]['findOne']({'where':{'id':_0x24345a[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x4b8112,null))[_0x878a('0x21')](function(_0x2838c5){if(_0x2838c5){_0xe9997f[_0x878a('0x49')]=_[_0x878a('0x48')](db[_0x878a('0x6f')][_0x878a('0x5a')]);_0xe9997f[_0x878a('0x47')]=_[_0x878a('0x48')](_0x24345a[_0x878a('0x47')]);_0xe9997f[_0x878a('0x51')]=_[_0x878a('0x4b')](_0xe9997f[_0x878a('0x49')],_0xe9997f[_0x878a('0x47')]);_0x49f9a8['attributes']=_[_0x878a('0x4b')](_0xe9997f[_0x878a('0x49')],qs[_0x878a('0x6b')](_0x24345a[_0x878a('0x47')][_0x878a('0x6b')]));_0x49f9a8[_0x878a('0x4a')]=_0x49f9a8['attributes'][_0x878a('0x4c')]?_0x49f9a8[_0x878a('0x4a')]:_0xe9997f[_0x878a('0x49')];if(!_0x24345a['query'][_0x878a('0x4d')](_0x878a('0x70'))){_0x49f9a8[_0x878a('0x31')]=qs['limit'](_0x24345a['query'][_0x878a('0x31')]);_0x49f9a8['offset']=qs[_0x878a('0x33')](_0x24345a[_0x878a('0x47')]['offset']);}_0x49f9a8[_0x878a('0x4e')]=qs['sort'](_0x24345a[_0x878a('0x47')]['sort']);_0x49f9a8['where']=qs[_0x878a('0x51')](_[_0x878a('0x6c')](_0x24345a['query'],_0xe9997f[_0x878a('0x51')]));_0x49f9a8['where'][_0x878a('0x67')]=_0x2838c5['id'];if(_0x24345a[_0x878a('0x47')][_0x878a('0x52')]){_0x49f9a8[_0x878a('0x50')]=_[_0x878a('0x53')](_0x49f9a8[_0x878a('0x50')],{'$or':_[_0x878a('0x46')](_0x49f9a8[_0x878a('0x4a')],function(_0x2ef79e){var _0x1dcadf={};_0x1dcadf[_0x2ef79e]={'$like':'%'+_0x24345a[_0x878a('0x47')]['filter']+'%'};return _0x1dcadf;})});}_0x49f9a8=_[_0x878a('0x53')]({},_0x49f9a8,_0x24345a[_0x878a('0x5b')]);return db[_0x878a('0x6f')][_0x878a('0x32')]({'where':_0x49f9a8['where']})['then'](function(_0x13ea8b){_0x51dd0f[_0x878a('0x32')]=_0x13ea8b;if(_0x24345a[_0x878a('0x47')][_0x878a('0x55')]){_0x49f9a8[_0x878a('0x56')]=[{'all':!![]}];}return db[_0x878a('0x6f')][_0x878a('0x57')](_0x49f9a8);})[_0x878a('0x21')](function(_0x54e0a0){_0x51dd0f[_0x878a('0x58')]=_0x54e0a0;return _0x51dd0f;});}})[_0x878a('0x21')](respondWithFilteredResult(_0x4b8112,_0x49f9a8))[_0x878a('0x2c')](handleError(_0x4b8112,null));};exports[_0x878a('0x71')]=function(_0x58ab8f,_0x4e1302,_0xea1228){return db[_0x878a('0x43')]['find']({'where':{'id':_0x58ab8f[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x4e1302,null))['then'](function(_0x3af42f){if(_0x3af42f){return _0x3af42f[_0x878a('0x71')](_0x58ab8f['query']['ids']);}})[_0x878a('0x21')](respondWithStatusCode(_0x4e1302,null))[_0x878a('0x2c')](handleError(_0x4e1302,null));};exports[_0x878a('0x72')]=function(_0x34c202,_0x57a9f9,_0x26e806){var _0x13e6b0={'channel':_0x878a('0x73')};var _0x56b77e=[];var _0x4df2be=[];var _0x36b4c3={};return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x34c202['params']['id']},'include':[{'model':db[_0x878a('0x74')],'as':_0x878a('0x75')}]})['then'](handleEntityNotFound(_0x57a9f9,null))['then'](function(_0x172305){_0x13e6b0[_0x878a('0x76')]=_0x172305;_0x13e6b0[_0x878a('0x77')]=_[_0x878a('0x78')](_0x172305[_0x878a('0x75')],['priority'],['asc']);if(_0x13e6b0[_0x878a('0x76')]['Applications']){delete _0x13e6b0[_0x878a('0x76')]['Applications'];}return db[_0x878a('0x79')]['describe']();})[_0x878a('0x21')](function(_0x4d72f1){if(!_0x4d72f1){throw new db[(_0x878a('0x7a'))]['ValidationError']('no\x20available\x20attributes');}_0x56b77e=_[_0x878a('0x7b')](_[_0x878a('0x48')](_0x4d72f1),[_0x878a('0x7c'),_0x878a('0x7d')]);_0x4df2be=_[_0x878a('0x7b')](_[_0x878a('0x48')](_0x4d72f1),[_0x878a('0x7c'),_0x878a('0x7d'),_0x878a('0x7e'),_0x878a('0x7f')]);_0x13e6b0[_0x878a('0x63')]={'mapKey':_0x878a('0x80')};if(_0x13e6b0[_0x878a('0x76')]['type']){switch(_0x13e6b0[_0x878a('0x76')][_0x878a('0x44')]){case _0x878a('0x81'):_0x13e6b0['body'][_0x878a('0x82')]=_0x34c202[_0x878a('0x63')][_0x878a('0x83')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')]=_0x34c202['body'][_0x878a('0x84')];_0x13e6b0['body']['messageId']=_0x34c202[_0x878a('0x63')][_0x878a('0x85')];break;case _0x878a('0x86'):_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')]='+'+_0x34c202[_0x878a('0x63')][_0x878a('0x87')];_0x13e6b0[_0x878a('0x63')]['body']=_0x34c202['body'][_0x878a('0x88')];break;case _0x878a('0x89'):_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')]=_0x34c202[_0x878a('0x63')][_0x878a('0x82')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')]=_0x34c202[_0x878a('0x63')][_0x878a('0x29')];break;case _0x878a('0x8a'):_0x13e6b0['body']['from']=_0x34c202[_0x878a('0x63')][_0x878a('0x82')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')]=_0x34c202[_0x878a('0x63')][_0x878a('0x63')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x8b')]=_0x34c202[_0x878a('0x63')][_0x878a('0x8c')];break;case _0x878a('0x8d'):_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')]=_0x34c202[_0x878a('0x63')]['From'];_0x13e6b0[_0x878a('0x63')]['body']=_0x34c202['body'][_0x878a('0x8e')];_0x13e6b0['body'][_0x878a('0x8b')]=_0x34c202[_0x878a('0x63')]['MessageUUID'];break;case'infobip':_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')]='+'+_0x34c202[_0x878a('0x63')]['results'][0x0][_0x878a('0x82')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')]=_0x34c202[_0x878a('0x63')][_0x878a('0x8f')][0x0][_0x878a('0x88')];_0x13e6b0['body'][_0x878a('0x8b')]=_0x34c202[_0x878a('0x63')][_0x878a('0x8f')][0x0][_0x878a('0x8b')];break;case _0x878a('0x90'):_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')]=_0x34c202[_0x878a('0x63')][_0x878a('0x91')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')]=_0x34c202[_0x878a('0x63')]['segmentedMessage'][_0x878a('0x29')];break;case _0x878a('0x92'):_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')]=_0x34c202['body'][_0x878a('0x93')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')]=_0x34c202['body'][_0x878a('0x88')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x8b')]=_0x34c202['body'][_0x878a('0x94')];break;case _0x878a('0x95'):_0x13e6b0['body'][_0x878a('0x8b')]=_0x34c202['body'][0x0]['message']['id'];_0x13e6b0['body'][_0x878a('0x82')]=_0x34c202[_0x878a('0x63')][0x0][_0x878a('0x29')][_0x878a('0x82')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')]=_0x34c202[_0x878a('0x63')][0x0]['message'][_0x878a('0x88')];break;case'intelepeer':_0x13e6b0[_0x878a('0x63')]['from']=_0x34c202['body']['from'];_0x13e6b0['body'][_0x878a('0x63')]=_0x34c202['body'][_0x878a('0x29')];_0x13e6b0[_0x878a('0x63')][_0x878a('0x8b')]=_0x34c202[_0x878a('0x63')]['refid'];break;}}if(_0x13e6b0['body']['id']){delete _0x13e6b0[_0x878a('0x63')]['id'];}if(_['isNil'](_0x13e6b0['body'][_0x878a('0x82')])){throw new db[(_0x878a('0x7a'))][(_0x878a('0x96'))](_0x878a('0x97'));}if(_[_0x878a('0x98')](_0x13e6b0[_0x878a('0x63')][_0x878a('0x63')])||_0x13e6b0[_0x878a('0x63')]['body']===''){throw new db[(_0x878a('0x7a'))]['ValidationError'](_0x878a('0x99'));}if(_[_0x878a('0x98')](_0x13e6b0[_0x878a('0x63')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x878a('0x9a')+_0x4df2be);}if(!_[_0x878a('0x9b')](_0x4df2be,_0x13e6b0[_0x878a('0x63')][_0x878a('0x9c')])){throw new db[(_0x878a('0x7a'))]['ValidationError'](_0x878a('0x9d')+_0x4df2be);}_0x36b4c3[_0x13e6b0['body'][_0x878a('0x9c')]]=_0x13e6b0[_0x878a('0x63')]['from'];return db['CmList'][_0x878a('0x5c')]({'where':{'id':_0x13e6b0['account'][_0x878a('0x7f')]},'include':[{'model':db[_0x878a('0x79')],'as':'Contacts','where':_0x36b4c3,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x878a('0x21')](handleEntityNotFound(_0x57a9f9,null))[_0x878a('0x21')](function(_0x3d991c){if(_0x3d991c){_0x13e6b0[_0x878a('0x9e')]=_[_0x878a('0x9f')](_0x3d991c,[_0x878a('0xa0')]);if(_0x3d991c[_0x878a('0xa0')][_0x878a('0x4c')]){return _0x3d991c[_0x878a('0xa0')][0x0];}var _0x42d196=_[_0x878a('0x18')](_0x13e6b0['body'],{'firstName':_0x13e6b0[_0x878a('0x63')]['from'],'ListId':_0x3d991c['id']});_0x42d196[_0x13e6b0[_0x878a('0x63')][_0x878a('0x9c')]]=_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')];return db[_0x878a('0x79')]['create'](_0x42d196,{'fields':_0x56b77e,'raw':!![]});}})[_0x878a('0x21')](handleEntityNotFound(_0x57a9f9,null))[_0x878a('0x21')](function(_0x44cab3){if(_0x44cab3){_0x13e6b0['contact']=_0x44cab3;var _0x2fd9c3={'ContactId':_0x44cab3['id'],'phone':_0x13e6b0[_0x878a('0x63')]['from'],'SmsAccountId':_0x34c202[_0x878a('0x64')]['id']};var _0x15754d={'ContactId':_0x44cab3['id'],'SmsAccountId':_0x34c202[_0x878a('0x64')]['id'],'closed':![]};return db[_0x878a('0xa1')][_0x878a('0x5c')]({'where':_0x15754d})[_0x878a('0x21')](function(_0x1526b0){if(_0x1526b0){return[_0x1526b0,![]];}return db[_0x878a('0xa1')]['create'](_0x2fd9c3)[_0x878a('0x21')](function(_0x466e43){return[_0x466e43,!![]];});});}})[_0x878a('0xa2')](function(_0x46e8a6,_0x29d21e){_0x13e6b0['interaction']=_0x46e8a6[_0x878a('0x3a')]({'plain':!![]});_0x13e6b0[_0x878a('0xa3')][_0x878a('0xa4')]=![];if(_0x29d21e){if(_0x13e6b0[_0x878a('0x76')]['autoclose']){_0x13e6b0[_0x878a('0x77')][_0x878a('0xa5')]({'id':0x0,'priority':_0x13e6b0[_0x878a('0x77')][_0x878a('0x4c')]+0x1,'app':_0x878a('0xa6'),'appdata':_0x878a('0xa7'),'interval':_0x878a('0xa8')});}_0x13e6b0[_0x878a('0xa3')][_0x878a('0xa4')]=!![];}return db[_0x878a('0xa9')][_0x878a('0x5d')]({'phone':_0x13e6b0[_0x878a('0x63')][_0x878a('0x82')],'messageId':_0x13e6b0[_0x878a('0x63')][_0x878a('0x8b')],'body':_0x13e6b0['body'][_0x878a('0x63')],'SmsAccountId':_0x34c202[_0x878a('0x64')]['id'],'SmsInteractionId':_0x46e8a6['id'],'direction':'in','ContactId':_0x46e8a6[_0x878a('0xaa')],'AttachmentId':_0x13e6b0[_0x878a('0x63')][_0x878a('0xab')]});})[_0x878a('0x21')](function(_0x5ed651){_0x13e6b0[_0x878a('0x29')]=_0x5ed651;if(_0x13e6b0['interaction']['UserId']){return db[_0x878a('0xac')][_0x878a('0x5c')]({'attributes':['id','name'],'where':{'id':_0x13e6b0[_0x878a('0xa3')][_0x878a('0xad')]}})[_0x878a('0x21')](function(_0x52af63){if(_0x52af63){_0x13e6b0['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x52af63[_0x878a('0x3f')]+','+(_0x13e6b0[_0x878a('0x76')][_0x878a('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x878a('0xaf'),_0x878a('0xb0'),_0x13e6b0);});}return respondWithRpcPromise(_0x878a('0xaf'),_0x878a('0xb0'),_0x13e6b0);})[_0x878a('0x21')](function(_0x4f5486){if(_0x4f5486){var _0x3a9ed6=0xc8;var _0xd8ca5=_0x878a('0xb1');logger[_0x878a('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd8ca5,_0x3a9ed6,_0x878a('0xb2'));logger[_0x878a('0x24')](_0x878a('0xb3'),_0xd8ca5,_0x3a9ed6,_0x878a('0xb2'),JSON['stringify'](_0x4f5486));if(_0x13e6b0[_0x878a('0x76')]['type']===_0x878a('0x81')){return _0x57a9f9[_0x878a('0x2e')](_0x3a9ed6)[_0x878a('0x34')](_0x878a('0xb4'),_0x878a('0xb5'))[_0x878a('0xb6')](_0x878a('0xb7'));}else{return _0x57a9f9[_0x878a('0x2e')](_0x3a9ed6)[_0x878a('0x2f')](_0x4f5486);}}})[_0x878a('0x2c')](handleError(_0x57a9f9,null));};exports['addApplications']=function(_0x482cb5,_0x143b2e){var _0x1ec2f5=_0x482cb5[_0x878a('0x64')]['id'];var _0xac1f76=_0x482cb5['body'];var _0x5abd94=0xc8;var _0x52f37d=null;return db[_0x878a('0xb8')]['transaction']({'isolationLevel':db[_0x878a('0xb8')][_0x878a('0xb9')][_0x878a('0xba')][_0x878a('0xbb')]},function(_0x10158b){return db[_0x878a('0x43')]['findOne']({'where':{'id':_0x1ec2f5},'transaction':_0x10158b})[_0x878a('0x21')](function(_0x4ac03f){if(_0x4ac03f){return db[_0x878a('0x74')][_0x878a('0x39')]({'where':{'SmsAccountId':_0x1ec2f5},'transaction':_0x10158b})['then'](function(){var _0x2403c1=_['map'](_0xac1f76,function(_0x42c872){_0x42c872[_0x878a('0x67')]=_0x1ec2f5;return _0x42c872;});return db[_0x878a('0x74')][_0x878a('0xbc')](_0x2403c1,{'transaction':_0x10158b});});}else{_0x5abd94=0x194;_0x52f37d=[];}});})[_0x878a('0x21')](function(){if(_0x5abd94!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x1ec2f5},'order':'priority'})['then'](function(_0x4101c0){_0x52f37d=_0x4101c0;});}})[_0x878a('0x2c')](function(_0x14c153){_0x5abd94=0x1f4;logger['error'](_0x14c153[_0x878a('0x3e')]);if(_0x14c153[_0x878a('0x3f')]){delete _0x14c153[_0x878a('0x3f')];}_0x52f37d=_0x14c153;})['finally'](function(){if(_0x52f37d===null){_0x143b2e[_0x878a('0x2d')](_0x5abd94);}else{if(_0x5abd94===0x1f4){_0x143b2e[_0x878a('0x2e')](_0x5abd94)[_0x878a('0xb6')](_0x52f37d);}else{_0x143b2e[_0x878a('0x2e')](_0x5abd94)[_0x878a('0x2f')](_0x52f37d);}}});};exports[_0x878a('0xbd')]=function(_0x1c5358,_0x148f86,_0x9e4f77){var _0x1c54ff={};var _0x269fa3={};var _0x3446e2;var _0x92054b;return db[_0x878a('0x43')][_0x878a('0x6a')]({'where':{'id':_0x1c5358[_0x878a('0x64')]['id']}})['then'](handleEntityNotFound(_0x148f86,null))[_0x878a('0x21')](function(_0x33d2ab){if(_0x33d2ab){_0x3446e2=_0x33d2ab;_0x269fa3[_0x878a('0x49')]=_['keys'](db[_0x878a('0x74')][_0x878a('0x5a')]);_0x269fa3[_0x878a('0x47')]=_['keys'](_0x1c5358[_0x878a('0x47')]);_0x269fa3[_0x878a('0x51')]=_[_0x878a('0x4b')](_0x269fa3[_0x878a('0x49')],_0x269fa3[_0x878a('0x47')]);_0x1c54ff[_0x878a('0x4a')]=_[_0x878a('0x4b')](_0x269fa3[_0x878a('0x49')],qs['fields'](_0x1c5358['query']['fields']));_0x1c54ff[_0x878a('0x4a')]=_0x1c54ff['attributes'][_0x878a('0x4c')]?_0x1c54ff[_0x878a('0x4a')]:_0x269fa3[_0x878a('0x49')];_0x1c54ff['order']=qs[_0x878a('0x4f')](_0x1c5358[_0x878a('0x47')]['sort']);_0x1c54ff['where']=qs[_0x878a('0x51')](_[_0x878a('0x6c')](_0x1c5358[_0x878a('0x47')],_0x269fa3[_0x878a('0x51')]));if(_0x1c5358[_0x878a('0x47')][_0x878a('0x52')]){_0x1c54ff[_0x878a('0x50')]=_[_0x878a('0x53')](_0x1c54ff[_0x878a('0x50')],{'$or':_[_0x878a('0x46')](_0x1c54ff['attributes'],function(_0x678a18){var _0x5dd3fc={};_0x5dd3fc[_0x678a18]={'$like':'%'+_0x1c5358[_0x878a('0x47')]['filter']+'%'};return _0x5dd3fc;})});}_0x1c54ff=_[_0x878a('0x53')]({},_0x1c54ff,_0x1c5358['options']);return _0x3446e2['getApplications'](_0x1c54ff);}})[_0x878a('0x21')](function(_0x1ce968){if(_0x1ce968){_0x92054b=_0x1ce968[_0x878a('0x4c')];if(!_0x1c5358['query'][_0x878a('0x4d')](_0x878a('0x70'))){_0x1c54ff[_0x878a('0x31')]=qs[_0x878a('0x31')](_0x1c5358[_0x878a('0x47')]['limit']);_0x1c54ff[_0x878a('0x33')]=qs[_0x878a('0x33')](_0x1c5358[_0x878a('0x47')]['offset']);}return _0x3446e2[_0x878a('0xbd')](_0x1c54ff);}})['then'](function(_0x55993f){if(_0x55993f){return _0x55993f?{'count':_0x92054b,'rows':_0x55993f}:null;}})['then'](respondWithResult(_0x148f86,null))[_0x878a('0x2c')](handleError(_0x148f86,null));};exports[_0x878a('0xbe')]=function(_0x41f113,_0x54d663,_0x2c1794){var _0x35d6a4={'raw':![],'where':{}};var _0x34cffc={};var _0x253ccf={'count':0x0,'rows':[]};return db[_0x878a('0x43')][_0x878a('0x6a')]({'where':{'id':_0x41f113['params']['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x54d663,null))['then'](function(_0x3e4c77){if(_0x3e4c77){_0x34cffc[_0x878a('0x49')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x34cffc['query']=_[_0x878a('0x48')](_0x41f113['query']);_0x34cffc[_0x878a('0x51')]=_[_0x878a('0x4b')](_0x34cffc[_0x878a('0x49')],_0x34cffc[_0x878a('0x47')]);_0x35d6a4[_0x878a('0x4a')]=_['intersection'](_0x34cffc[_0x878a('0x49')],qs[_0x878a('0x6b')](_0x41f113['query']['fields']));_0x35d6a4[_0x878a('0x4a')]=_0x35d6a4[_0x878a('0x4a')][_0x878a('0x4c')]?_0x35d6a4[_0x878a('0x4a')]:_0x34cffc[_0x878a('0x49')];if(!_0x41f113[_0x878a('0x47')][_0x878a('0x4d')](_0x878a('0x70'))){_0x35d6a4['limit']=qs[_0x878a('0x31')](_0x41f113['query']['limit']);_0x35d6a4['offset']=qs[_0x878a('0x33')](_0x41f113['query'][_0x878a('0x33')]);}_0x35d6a4['order']=qs[_0x878a('0x4f')](_0x41f113[_0x878a('0x47')][_0x878a('0x4f')]);_0x35d6a4[_0x878a('0x50')]=qs[_0x878a('0x51')](_[_0x878a('0x6c')](_0x41f113['query'],_0x34cffc['filters']));_0x35d6a4[_0x878a('0x50')][_0x878a('0x67')]=_0x3e4c77['id'];if(_0x41f113[_0x878a('0x47')][_0x878a('0x52')]){_0x35d6a4[_0x878a('0x50')]=_['merge'](_0x35d6a4[_0x878a('0x50')],{'$or':_['map'](_0x35d6a4[_0x878a('0x4a')],function(_0x26ea25){var _0x3ae385={};_0x3ae385[_0x26ea25]={'$like':'%'+_0x41f113['query']['filter']+'%'};return _0x3ae385;})});}_0x35d6a4=_['merge']({},_0x35d6a4,_0x41f113['options']);return db[_0x878a('0xa1')]['count']({'where':_0x35d6a4[_0x878a('0x50')]})[_0x878a('0x21')](function(_0x477ebe){_0x253ccf[_0x878a('0x32')]=_0x477ebe;if(_0x41f113[_0x878a('0x47')]['includeAll']){_0x35d6a4[_0x878a('0x56')]=[{'model':db['CmContact'],'as':_0x878a('0xbf'),'required':![]},{'model':db[_0x878a('0xac')],'as':'Owner','attributes':[_0x878a('0x3f'),'fullname',_0x878a('0xc0')],'required':![]},{'model':db['Tag'],'as':_0x878a('0xc1'),'attributes':['id',_0x878a('0x3f'),_0x878a('0xc2')],'where':_0x41f113['query'][_0x878a('0xc3')]?{'id':_0x41f113['query']['tag']}:undefined,'required':_0x41f113['query'][_0x878a('0xc3')]?!![]:![]}];}return db['SmsInteraction'][_0x878a('0x57')](_0x35d6a4);})['then'](function(_0x28e91b){_0x253ccf[_0x878a('0x58')]=_0x28e91b;return _0x253ccf;});}})['then'](respondWithFilteredResult(_0x54d663,_0x35d6a4))[_0x878a('0x2c')](handleError(_0x54d663,null));};exports[_0x878a('0xb6')]=function(_0x4787b4,_0x29b461,_0x488468){var _0x62c6f6,_0xdd695e,_0x319467;if(_[_0x878a('0x98')](_0x4787b4[_0x878a('0x63')][_0x878a('0x63')])||_0x4787b4[_0x878a('0x63')][_0x878a('0x63')]===''){throw new db[(_0x878a('0x7a'))][(_0x878a('0x96'))](_0x878a('0x99'));}if(_[_0x878a('0x98')](_0x4787b4[_0x878a('0x63')]['to'])){throw new db['Sequelize'][(_0x878a('0x96'))](_0x878a('0xc4'));}_0x62c6f6=_0x4787b4['body']['to'];return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x4787b4['params']['id']},'include':[{'model':db[_0x878a('0xc5')],'as':_0x878a('0xc6'),'include':[{'model':db[_0x878a('0x79')],'as':_0x878a('0xa0'),'where':{'mobile':_0x62c6f6},'limit':0x1,'order':[[_0x878a('0x7d'),_0x878a('0xc7')]]}]}]})[_0x878a('0x21')](handleEntityNotFound(_0x29b461,null))['then'](function(_0x2f856c){if(_0x2f856c&&_0x2f856c[_0x878a('0xc6')]){_0xdd695e=_0x2f856c[_0x878a('0x3a')]({'plain':!![]});if(_0xdd695e['List']&&_0xdd695e[_0x878a('0xc6')]['Contacts']['length']){return _0xdd695e['List'][_0x878a('0xa0')][0x0];}return db[_0x878a('0x79')][_0x878a('0x5d')](_[_0x878a('0x18')](_0x4787b4[_0x878a('0x63')],{'firstName':_0x62c6f6,'mobile':_0x62c6f6,'phone':_0x62c6f6,'ListId':_0xdd695e[_0x878a('0x7f')]}));}})['then'](handleEntityNotFound(_0x29b461,null))['then'](function(_0x5f4193){if(_0x5f4193){_0x319467=_0x5f4193;return db[_0x878a('0xa1')][_0x878a('0x5c')]({'where':{'ContactId':_0x319467['id'],'closed':![],'SmsAccountId':_0xdd695e['id']}})[_0x878a('0x21')](function(_0xf0fda6){if(_0xf0fda6){return[_0xf0fda6,![]];}return db['SmsInteraction'][_0x878a('0x5d')]({'UserId':_0x4787b4[_0x878a('0x5e')]['id'],'ContactId':_0x319467['id'],'SmsAccountId':_0xdd695e['id'],'phone':_0x62c6f6,'firstMsgDirection':_0x878a('0xc8'),'Messages':[_[_0x878a('0x53')](_0x4787b4['body'],{'read':![],'body':_0x4787b4[_0x878a('0x63')][_0x878a('0x63')],'phone':_0x62c6f6,'SmsAccountId':_0xdd695e['id'],'UserId':_0x4787b4[_0x878a('0x5e')]['id'],'ContactId':_0x319467['id']})]},{'include':[{'model':db[_0x878a('0xa9')],'as':_0x878a('0xc9')}]})[_0x878a('0x21')](function(_0x3c76c2){return[_0x3c76c2,!![]];});});}})[_0x878a('0xa2')](function(_0x535df5,_0x5a655a){if(_0x5a655a){return _0x535df5;}return db[_0x878a('0xa9')]['create'](_[_0x878a('0x53')](_0x4787b4[_0x878a('0x63')],{'read':![],'body':_0x4787b4[_0x878a('0x63')]['body'],'phone':_0x62c6f6,'SmsAccountId':_0xdd695e['id'],'SmsInteractionId':_0x535df5['id'],'UserId':_0x4787b4[_0x878a('0x5e')]['id'],'ContactId':_0x319467['id']}))[_0x878a('0x21')](function(_0x22051e){_0x535df5[_0x878a('0xca')][_0x878a('0xc9')]=[];_0x535df5[_0x878a('0xca')][_0x878a('0xc9')][_0x878a('0xa5')](_0x22051e[_0x878a('0xca')]);return _0x535df5;});})[_0x878a('0x21')](respondWithResult(_0x29b461,null))[_0x878a('0x2c')](handleError(_0x29b461,null));};exports[_0x878a('0x2e')]=function(_0x472231,_0x5b00f5,_0x207429){if(_0x472231[_0x878a('0x63')]['id']){delete _0x472231[_0x878a('0x63')]['id'];}var _0x4993b8,_0x3bbd33,_0x180596;return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x472231[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x5b00f5,null))[_0x878a('0x21')](function(_0x153f5f){if(_0x153f5f){_0x180596=_0x153f5f;logger[_0x878a('0x24')](_0x878a('0x25'),_0x878a('0x2e'),'received\x20delivery\x20report\x20from',_0x153f5f['type'],util[_0x878a('0xcb')](_0x472231['body'],{'showHidden':![],'depth':null}));switch(_0x153f5f[_0x878a('0x44')]){case _0x878a('0x86'):if(_0x472231[_0x878a('0x63')][_0x878a('0xcc')]&&_0x472231[_0x878a('0x63')]['status']){_0x3bbd33=_0x472231[_0x878a('0x63')][_0x878a('0x2e')];return db[_0x878a('0xa9')][_0x878a('0x5c')]({'where':{'messageId':_0x472231[_0x878a('0x63')][_0x878a('0xcc')]}});}break;case _0x878a('0x89'):if(_0x472231[_0x878a('0x63')][_0x878a('0xcd')]&&_0x472231[_0x878a('0x63')]['statusInt']){_0x3bbd33=_0x472231[_0x878a('0x63')][_0x878a('0xce')];return db[_0x878a('0xa9')][_0x878a('0x5c')]({'where':{'messageId':_0x472231['body'][_0x878a('0xcd')]}});}break;case _0x878a('0x8a'):if(_0x472231[_0x878a('0x63')][_0x878a('0x8c')]&&_0x472231[_0x878a('0x63')][_0x878a('0xcf')]){_0x3bbd33=_0x472231[_0x878a('0x63')]['status_code'];return db[_0x878a('0xa9')][_0x878a('0x5c')]({'where':{'messageId':_0x472231[_0x878a('0x63')][_0x878a('0x8c')]}});}break;case _0x878a('0xd0'):var _0x3c4691=_0x472231[_0x878a('0x63')][_0x878a('0x8f')][0x0];if(_0x3c4691[_0x878a('0x8b')]&&_0x3c4691[_0x878a('0x2e')][_0x878a('0xd1')]==='DELIVERED'){_0x3bbd33=_0x3c4691['status'][_0x878a('0xd1')];return db[_0x878a('0xa9')][_0x878a('0x5c')]({'where':{'messageId':_0x3c4691[_0x878a('0x8b')]}});}break;case _0x878a('0x92'):if(_0x472231[_0x878a('0x63')]['messageId']&&_0x472231['body'][_0x878a('0x2e')]){_0x3bbd33=_0x472231[_0x878a('0x63')]['status'];return db['SmsMessage'][_0x878a('0x5c')]({'where':{'messageId':_0x472231[_0x878a('0x63')][_0x878a('0x8b')]}});}break;case _0x878a('0x95'):if(_0x472231[_0x878a('0x63')][0x0][_0x878a('0x29')]['id']){_0x3bbd33=_0x472231['body'][0x0][_0x878a('0x44')];return db[_0x878a('0xa9')]['find']({'where':{'messageId':_0x472231['body'][0x0][_0x878a('0x29')]['id']}});}break;case'intelepeer':if(_0x472231[_0x878a('0x63')]['redif']&&_0x472231['body'][_0x878a('0x2e')]){_0x3bbd33=_0x472231['body'][_0x878a('0x2e')];return db[_0x878a('0xa9')][_0x878a('0x5c')]({'where':{'messageId':_0x472231['body'][_0x878a('0xd2')]}});}break;}}})[_0x878a('0x21')](handleEntityNotFound(_0x5b00f5,null))[_0x878a('0x21')](function(_0x58f3b5){if(_0x58f3b5){_0x4993b8=_0x58f3b5;switch(_0x180596[_0x878a('0x44')]){case _0x878a('0x86'):if(_0x3bbd33==='DELIVERED'){return _0x4993b8[_0x878a('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x878a('0x2e'),_0x878a('0x86'),util['inspect'](_0x472231['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3bbd33==='1'){return _0x4993b8['update']({'read':!![]});}else{logger[_0x878a('0x27')](_0x878a('0x25'),_0x878a('0x2e'),_0x878a('0x86'),util[_0x878a('0xcb')](_0x472231[_0x878a('0x63')],{'showHidden':![],'depth':null}));}break;case _0x878a('0x8a'):if(!_0x472231[_0x878a('0x63')][_0x878a('0xd3')]&&_0x3bbd33>=0xc8&&_0x3bbd33<=0xce){return _0x4993b8['update']({'read':!![]});}else{logger[_0x878a('0x27')](_0x878a('0x25'),_0x878a('0x2e'),'clicksend',util[_0x878a('0xcb')](_0x472231[_0x878a('0x63')],{'showHidden':![],'depth':null}));}break;case _0x878a('0xd0'):var _0x573729=_0x472231[_0x878a('0x63')]['results'][0x0];if(_0x573729[_0x878a('0x2e')]['groupName']===_0x878a('0xd4')){return _0x4993b8['update']({'read':!![]});}else{logger[_0x878a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x878a('0x2e'),_0x878a('0xd0'),util[_0x878a('0xcb')](_0x472231['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3bbd33==_0x878a('0xd5')||_0x3bbd33==_0x878a('0xd6')){return _0x4993b8['update']({'read':!![]});}else{logger[_0x878a('0x27')](_0x878a('0x25'),_0x878a('0x2e'),_0x878a('0x92'),util[_0x878a('0xcb')](_0x472231['body'],{'showHidden':![],'depth':null}));}break;case _0x878a('0x95'):if(_0x3bbd33==_0x878a('0xd7')){return _0x4993b8[_0x878a('0x38')]({'read':!![]});}else{logger[_0x878a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x878a('0x95'),util[_0x878a('0xcb')](_0x472231[_0x878a('0x63')],{'showHidden':![],'depth':null}));}break;case _0x878a('0xd8'):if(_0x3bbd33===_0x878a('0xd9')||_0x3bbd33===_0x878a('0xda')){return _0x4993b8['update']({'read':!![]});}else{logger[_0x878a('0x27')](_0x878a('0x25'),_0x878a('0x2e'),_0x878a('0xd8'),util[_0x878a('0xcb')](_0x472231[_0x878a('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x4993b8;}})[_0x878a('0x21')](respondWithResult(_0x5b00f5,null))[_0x878a('0x2c')](handleError(_0x5b00f5,null));};exports['statusGet']=function(_0x5b51db,_0x27d435,_0x2641c4){var _0x464cd1,_0x36bf03,_0x172db8;return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x5b51db[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x27d435,null))['then'](function(_0x3482ec){if(_0x3482ec){_0x172db8=_0x3482ec;logger[_0x878a('0x24')](_0x878a('0x25'),_0x878a('0x2e'),'received\x20delivery\x20report\x20from',_0x3482ec['type'],util[_0x878a('0xcb')](_0x5b51db['query'],{'showHidden':![],'depth':null}));switch(_0x3482ec[_0x878a('0x44')]){case _0x878a('0x90'):if(_0x5b51db[_0x878a('0x47')][_0x878a('0xdb')]&&_0x5b51db[_0x878a('0x47')]['state']){_0x36bf03=_0x5b51db[_0x878a('0x47')][_0x878a('0xdc')];return db[_0x878a('0xa9')][_0x878a('0x5c')]({'where':{'messageId':_0x5b51db['query'][_0x878a('0xdb')]}});}break;}}})[_0x878a('0x21')](handleEntityNotFound(_0x27d435,null))['then'](function(_0x37ac5b){if(_0x37ac5b){_0x464cd1=_0x37ac5b;switch(_0x172db8[_0x878a('0x44')]){case'csc':if(_0x36bf03==='2'||_0x36bf03==='6'){return _0x464cd1[_0x878a('0x38')]({'read':!![]});}else{logger[_0x878a('0x27')](_0x878a('0x25'),_0x878a('0x2e'),_0x878a('0x90'),util[_0x878a('0xcb')](_0x5b51db[_0x878a('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x464cd1;}})['then'](respondWithResult(_0x27d435,null))[_0x878a('0x2c')](handleError(_0x27d435,null));};exports[_0x878a('0xdd')]=function(_0x3b80e9,_0xc0a24b,_0x43ba9a){return db[_0x878a('0x43')][_0x878a('0x5c')]({'where':{'id':_0x3b80e9[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0xc0a24b,null))[_0x878a('0x21')](function(_0xd7523){if(_0xd7523){return _0xd7523[_0x878a('0xdd')](_0x3b80e9[_0x878a('0x63')][_0x878a('0x6e')],_[_0x878a('0x9f')](_0x3b80e9[_0x878a('0x63')],[_0x878a('0x6e'),'id'])||{})[_0x878a('0xa2')](function(_0x55b2b5){for(var _0x30b81c=0x0;_0x30b81c<_0x3b80e9['body'][_0x878a('0x6e')][_0x878a('0x4c')];_0x30b81c+=0x1){socket[_0x878a('0xde')](_0x878a('0xdf'),{'UserId':Number(_0x3b80e9['body'][_0x878a('0x6e')][_0x30b81c]),'SmsAccountId':Number(_0x3b80e9[_0x878a('0x64')]['id'])});}return _0x55b2b5;});}})[_0x878a('0x21')](respondWithResult(_0xc0a24b,null))['catch'](handleError(_0xc0a24b,null));};exports[_0x878a('0xe0')]=function(_0x238a8c,_0x1346d9,_0x419112){return db['SmsAccount'][_0x878a('0x5c')]({'where':{'id':_0x238a8c[_0x878a('0x64')]['id']}})[_0x878a('0x21')](handleEntityNotFound(_0x1346d9,null))[_0x878a('0x21')](function(_0xd31c0f){if(_0xd31c0f){return _0xd31c0f[_0x878a('0xe0')](_0x238a8c['query'][_0x878a('0x6e')])[_0x878a('0x21')](function(){if(_[_0x878a('0xe1')](_0x238a8c['query']['ids'])){for(var _0x18d530=0x0;_0x18d530<_0x238a8c[_0x878a('0x47')]['ids'][_0x878a('0x4c')];_0x18d530+=0x1){socket['emit'](_0x878a('0xe2'),{'UserId':Number(_0x238a8c[_0x878a('0x47')][_0x878a('0x6e')][_0x18d530]),'SmsAccountId':Number(_0x238a8c[_0x878a('0x64')]['id'])});}}else{socket[_0x878a('0xde')](_0x878a('0xe2'),{'UserId':Number(_0x238a8c[_0x878a('0x47')]['ids']),'SmsAccountId':Number(_0x238a8c['params']['id'])});}});}})[_0x878a('0x21')](respondWithStatusCode(_0x1346d9,null))[_0x878a('0x2c')](handleError(_0x1346d9,null));};exports['getAgents']=function(_0x6512c4,_0x5e90eb,_0x39725c){var _0x305d02={};var _0x18c630={};var _0x4ffe81;var _0x26b079;return db[_0x878a('0x43')][_0x878a('0x6a')]({'where':{'id':_0x6512c4[_0x878a('0x64')]['id']}})['then'](handleEntityNotFound(_0x5e90eb,null))[_0x878a('0x21')](function(_0x392d54){if(_0x392d54){_0x4ffe81=_0x392d54;_0x18c630[_0x878a('0x49')]=_[_0x878a('0x48')](db['User']['rawAttributes']);_0x18c630[_0x878a('0x47')]=_[_0x878a('0x48')](_0x6512c4[_0x878a('0x47')]);_0x18c630['filters']=_[_0x878a('0x4b')](_0x18c630[_0x878a('0x49')],_0x18c630['query']);_0x305d02['attributes']=_['intersection'](_0x18c630[_0x878a('0x49')],qs[_0x878a('0x6b')](_0x6512c4['query'][_0x878a('0x6b')]));_0x305d02[_0x878a('0x4a')]=_0x305d02['attributes'][_0x878a('0x4c')]?_0x305d02[_0x878a('0x4a')]:_0x18c630[_0x878a('0x49')];_0x305d02[_0x878a('0x4e')]=qs[_0x878a('0x4f')](_0x6512c4[_0x878a('0x47')][_0x878a('0x4f')]);_0x305d02[_0x878a('0x50')]=qs[_0x878a('0x51')](_['pick'](_0x6512c4[_0x878a('0x47')],_0x18c630[_0x878a('0x51')]));if(_0x6512c4['query'][_0x878a('0x52')]){_0x305d02[_0x878a('0x50')]=_[_0x878a('0x53')](_0x305d02[_0x878a('0x50')],{'$or':_[_0x878a('0x46')](_0x305d02[_0x878a('0x4a')],function(_0x3d8058){var _0xabb07={};_0xabb07[_0x3d8058]={'$like':'%'+_0x6512c4[_0x878a('0x47')][_0x878a('0x52')]+'%'};return _0xabb07;})});}_0x305d02=_[_0x878a('0x53')]({},_0x305d02,_0x6512c4['options']);return _0x4ffe81[_0x878a('0xe3')](_0x305d02);}})[_0x878a('0x21')](function(_0x301fc8){if(_0x301fc8){_0x26b079=_0x301fc8[_0x878a('0x4c')];if(!_0x6512c4[_0x878a('0x47')][_0x878a('0x4d')](_0x878a('0x70'))){_0x305d02['limit']=qs['limit'](_0x6512c4[_0x878a('0x47')]['limit']);_0x305d02['offset']=qs[_0x878a('0x33')](_0x6512c4[_0x878a('0x47')][_0x878a('0x33')]);}return _0x4ffe81[_0x878a('0xe3')](_0x305d02);}})[_0x878a('0x21')](function(_0x45aa06){if(_0x45aa06){return _0x45aa06?{'count':_0x26b079,'rows':_0x45aa06}:null;}})['then'](respondWithResult(_0x5e90eb,null))['catch'](handleError(_0x5e90eb,null));}; \ No newline at end of file +var _0xa4e3=['defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','end','json','undefined','offset','count','status','set','reject','save','update','destroy','get','stack','name','send','index','mandatoryDispositionPause','SmsAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','rows','show','Pause','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','text','clicksend','message_id','plivo','Text','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','pick','getInteractions','Owner','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x5a109f,_0x32ff07){var _0x38c441=function(_0x2210b7){while(--_0x2210b7){_0x5a109f['push'](_0x5a109f['shift']());}};_0x38c441(++_0x32ff07);}(_0xa4e3,0x1b5));var _0x3a4e=function(_0x57ac45,_0x4b408e){_0x57ac45=_0x57ac45-0x0;var _0x72340c=_0xa4e3[_0x57ac45];return _0x72340c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a4e('0x0'));var zipdir=require(_0x3a4e('0x1'));var jsonpatch=require(_0x3a4e('0x2'));var rp=require(_0x3a4e('0x3'));var moment=require(_0x3a4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3a4e('0x5'));var util=require(_0x3a4e('0x6'));var path=require(_0x3a4e('0x7'));var sox=require(_0x3a4e('0x8'));var csv=require(_0x3a4e('0x9'));var ejs=require(_0x3a4e('0xa'));var fs=require('fs');var fs_extra=require(_0x3a4e('0xb'));var _=require(_0x3a4e('0xc'));var squel=require(_0x3a4e('0xd'));var crypto=require(_0x3a4e('0xe'));var jsforce=require(_0x3a4e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3a4e('0x9'));var querystring=require(_0x3a4e('0x10'));var Papa=require(_0x3a4e('0x11'));var Redis=require(_0x3a4e('0x12'));var authService=require(_0x3a4e('0x13'));var qs=require(_0x3a4e('0x14'));var as=require(_0x3a4e('0x15'));var hardwareService=require(_0x3a4e('0x16'));var logger=require('../../config/logger')(_0x3a4e('0x17'));var utils=require(_0x3a4e('0x18'));var config=require(_0x3a4e('0x19'));var licenseUtil=require(_0x3a4e('0x1a'));var db=require(_0x3a4e('0x1b'))['db'];config[_0x3a4e('0x1c')]=_[_0x3a4e('0x1d')](config['redis'],{'host':_0x3a4e('0x1e'),'port':0x18eb});var socket=require(_0x3a4e('0x1f'))(new Redis(config[_0x3a4e('0x1c')]));require(_0x3a4e('0x20'))['register'](socket);var jayson=require(_0x3a4e('0x21'));var client=jayson[_0x3a4e('0x22')][_0x3a4e('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x12b5c6,_0x245133,_0x323b45,_0x209fe3){return new BPromise(function(_0x44d8a7,_0x4fe4ea){var _0x585092=_0x209fe3||client;return _0x585092[_0x3a4e('0x24')](_0x12b5c6,_0x323b45)[_0x3a4e('0x25')](function(_0x7b3d66){logger['info'](_0x3a4e('0x26'),_0x245133,_0x3a4e('0x27'));logger[_0x3a4e('0x28')](_0x3a4e('0x29'),_0x245133,_0x3a4e('0x27'),JSON['stringify'](_0x7b3d66));if(_0x7b3d66[_0x3a4e('0x2a')]){if(_0x7b3d66['error'][_0x3a4e('0x2b')]===0x1f4){logger[_0x3a4e('0x2a')](_0x3a4e('0x26'),_0x245133,_0x7b3d66[_0x3a4e('0x2a')][_0x3a4e('0x2c')]);return _0x4fe4ea(_0x7b3d66['error'][_0x3a4e('0x2c')]);}logger[_0x3a4e('0x2a')](_0x3a4e('0x26'),_0x245133,_0x7b3d66[_0x3a4e('0x2a')][_0x3a4e('0x2c')]);return _0x44d8a7(_0x7b3d66[_0x3a4e('0x2a')]['message']);}else{logger[_0x3a4e('0x2d')]('SmsAccount,\x20%s,\x20%s',_0x245133,'request\x20sent');_0x44d8a7(_0x7b3d66[_0x3a4e('0x2e')][_0x3a4e('0x2c')]);}})['catch'](function(_0x5e6e6a){logger[_0x3a4e('0x2a')](_0x3a4e('0x26'),_0x245133,_0x5e6e6a);_0x4fe4ea(_0x5e6e6a);});});}function respondWithStatusCode(_0x17f1fe,_0x14ccfb){_0x14ccfb=_0x14ccfb||0xcc;return function(_0x205a94){if(_0x205a94){return _0x17f1fe[_0x3a4e('0x2f')](_0x14ccfb);}return _0x17f1fe['status'](_0x14ccfb)[_0x3a4e('0x30')]();};}function respondWithResult(_0x5bb67c,_0x5ddccf){_0x5ddccf=_0x5ddccf||0xc8;return function(_0x188bf7){if(_0x188bf7){return _0x5bb67c['status'](_0x5ddccf)[_0x3a4e('0x31')](_0x188bf7);}};}function respondWithFilteredResult(_0x363fda,_0x20aa51){return function(_0x1e250b){if(_0x1e250b){var _0x41da44=typeof _0x20aa51['offset']===_0x3a4e('0x32')&&typeof _0x20aa51['limit']===_0x3a4e('0x32');var _0x2d9589=_0x1e250b['count'];var _0x1647af=_0x41da44?0x0:_0x20aa51[_0x3a4e('0x33')];var _0x3cdf68=_0x41da44?_0x1e250b[_0x3a4e('0x34')]:_0x20aa51[_0x3a4e('0x33')]+_0x20aa51['limit'];var _0x135490;if(_0x3cdf68>=_0x2d9589){_0x3cdf68=_0x2d9589;_0x135490=0xc8;}else{_0x135490=0xce;}_0x363fda[_0x3a4e('0x35')](_0x135490);return _0x363fda[_0x3a4e('0x36')]('Content-Range',_0x1647af+'-'+_0x3cdf68+'/'+_0x2d9589)[_0x3a4e('0x31')](_0x1e250b);}return null;};}function patchUpdates(_0x436bf2){return function(_0x391caa){try{jsonpatch['apply'](_0x391caa,_0x436bf2,!![]);}catch(_0x37389){return BPromise[_0x3a4e('0x37')](_0x37389);}return _0x391caa[_0x3a4e('0x38')]();};}function saveUpdates(_0x301731,_0x175ed6){return function(_0x15f2dd){if(_0x15f2dd){return _0x15f2dd[_0x3a4e('0x39')](_0x301731)['then'](function(_0x387a18){return _0x387a18;});}return null;};}function removeEntity(_0x34836e,_0x488961){return function(_0x3adba9){if(_0x3adba9){return _0x3adba9[_0x3a4e('0x3a')]()[_0x3a4e('0x25')](function(){var _0x350548=_0x3adba9[_0x3a4e('0x3b')]({'plain':!![]});var _0x42d367='SmsAccounts';return db['UserProfileResource'][_0x3a4e('0x3a')]({'where':{'type':_0x42d367,'resourceId':_0x350548['id']}})[_0x3a4e('0x25')](function(){return _0x3adba9;});})[_0x3a4e('0x25')](function(){_0x34836e[_0x3a4e('0x35')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e01e,_0x2b4b22){return function(_0x4f66ee){if(!_0x4f66ee){_0x34e01e[_0x3a4e('0x2f')](0x194);}return _0x4f66ee;};}function handleError(_0x4f0791,_0x47dd67){_0x47dd67=_0x47dd67||0x1f4;return function(_0xe8e2cf){logger[_0x3a4e('0x2a')](_0xe8e2cf[_0x3a4e('0x3c')]);if(_0xe8e2cf[_0x3a4e('0x3d')]){delete _0xe8e2cf[_0x3a4e('0x3d')];}_0x4f0791[_0x3a4e('0x35')](_0x47dd67)[_0x3a4e('0x3e')](_0xe8e2cf);};}exports[_0x3a4e('0x3f')]=function(_0x2235a2,_0x740af6){var _0x496895={'include':[{'model':db['Pause'],'as':_0x3a4e('0x40')}]},_0x1169ad={},_0x1b11af={'count':0x0,'rows':[]};var _0x81bdac=_['map'](db[_0x3a4e('0x41')]['rawAttributes'],function(_0x13ccd8){return{'name':_0x13ccd8[_0x3a4e('0x42')],'type':_0x13ccd8[_0x3a4e('0x43')][_0x3a4e('0x44')]};});_0x1169ad['model']=_[_0x3a4e('0x45')](_0x81bdac,_0x3a4e('0x3d'));_0x1169ad[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x2235a2['query']);_0x1169ad[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x1169ad[_0x3a4e('0x4a')],_0x1169ad[_0x3a4e('0x46')]);_0x496895[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x1169ad[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x2235a2[_0x3a4e('0x46')]['fields']));_0x496895[_0x3a4e('0x4b')]=_0x496895[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x496895[_0x3a4e('0x4b')]:_0x1169ad[_0x3a4e('0x4a')];if(!_0x2235a2['query'][_0x3a4e('0x4e')](_0x3a4e('0x4f'))){_0x496895[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x50')]);_0x496895[_0x3a4e('0x33')]=qs[_0x3a4e('0x33')](_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x33')]);}_0x496895[_0x3a4e('0x51')]=qs[_0x3a4e('0x52')](_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x496895[_0x3a4e('0x53')]=qs[_0x3a4e('0x48')](_['pick'](_0x2235a2[_0x3a4e('0x46')],_0x1169ad[_0x3a4e('0x48')]),_0x81bdac);if(_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x496895[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x496895[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x81bdac,function(_0x4c428d){if(_0x4c428d[_0x3a4e('0x43')]!==_0x3a4e('0x56')){var _0x551c0e={};_0x551c0e[_0x4c428d['name']]={'$like':'%'+_0x2235a2[_0x3a4e('0x46')][_0x3a4e('0x54')]+'%'};return _0x551c0e;}})});}_0x496895=_[_0x3a4e('0x55')]({},_0x496895,_0x2235a2[_0x3a4e('0x57')]);var _0x569a99={'where':_0x496895[_0x3a4e('0x53')]};return db[_0x3a4e('0x41')][_0x3a4e('0x34')](_0x569a99)['then'](function(_0x1ebaff){_0x1b11af[_0x3a4e('0x34')]=_0x1ebaff;if(_0x2235a2[_0x3a4e('0x46')]['includeAll']){_0x496895['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x496895);})[_0x3a4e('0x25')](function(_0x3550b7){_0x1b11af[_0x3a4e('0x58')]=_0x3550b7;return _0x1b11af;})[_0x3a4e('0x25')](respondWithFilteredResult(_0x740af6,_0x496895))['catch'](handleError(_0x740af6,null));};exports[_0x3a4e('0x59')]=function(_0x599a72,_0x34bd83){var _0x45a078={'raw':![],'where':{'id':_0x599a72['params']['id']},'include':[{'model':db[_0x3a4e('0x5a')],'as':_0x3a4e('0x40')}]},_0x59ac3e={};_0x59ac3e[_0x3a4e('0x4a')]=_[_0x3a4e('0x47')](db[_0x3a4e('0x41')][_0x3a4e('0x5b')]);_0x59ac3e['query']=_[_0x3a4e('0x47')](_0x599a72[_0x3a4e('0x46')]);_0x59ac3e[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x59ac3e[_0x3a4e('0x4a')],_0x59ac3e[_0x3a4e('0x46')]);_0x45a078[_0x3a4e('0x4b')]=_['intersection'](_0x59ac3e[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x599a72[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x45a078['attributes']=_0x45a078['attributes'][_0x3a4e('0x4d')]?_0x45a078['attributes']:_0x59ac3e['model'];if(_0x599a72[_0x3a4e('0x46')][_0x3a4e('0x5c')]){_0x45a078[_0x3a4e('0x5d')]=[{'all':!![]}];}_0x45a078=_['merge']({},_0x45a078,_0x599a72[_0x3a4e('0x57')]);return db[_0x3a4e('0x41')][_0x3a4e('0x5e')](_0x45a078)[_0x3a4e('0x25')](handleEntityNotFound(_0x34bd83,null))[_0x3a4e('0x25')](respondWithResult(_0x34bd83,null))['catch'](handleError(_0x34bd83,null));};exports[_0x3a4e('0x5f')]=function(_0x110aa4,_0x1575b5){return db[_0x3a4e('0x41')][_0x3a4e('0x5f')](_0x110aa4[_0x3a4e('0x60')],{})[_0x3a4e('0x25')](function(_0x58e49c){var _0x256366=_0x110aa4[_0x3a4e('0x61')][_0x3a4e('0x3b')]({'plain':!![]});if(!_0x256366)throw new Error(_0x3a4e('0x62'));if(_0x256366['role']===_0x3a4e('0x61')){var _0x3916b6=_0x58e49c[_0x3a4e('0x3b')]({'plain':!![]});var _0x45ec63=_0x3a4e('0x63');return db[_0x3a4e('0x64')][_0x3a4e('0x5e')]({'where':{'name':_0x45ec63,'userProfileId':_0x256366[_0x3a4e('0x65')]},'raw':!![]})[_0x3a4e('0x25')](function(_0x4fcf20){if(_0x4fcf20&&_0x4fcf20['autoAssociation']===0x0){return db[_0x3a4e('0x66')]['create']({'name':_0x3916b6[_0x3a4e('0x3d')],'resourceId':_0x3916b6['id'],'type':_0x4fcf20['name'],'sectionId':_0x4fcf20['id']},{})[_0x3a4e('0x25')](function(){return _0x58e49c;});}else{return _0x58e49c;}})[_0x3a4e('0x67')](function(_0x4b2b5f){logger[_0x3a4e('0x2a')](_0x3a4e('0x68'),_0x4b2b5f);throw _0x4b2b5f;});}return _0x58e49c;})[_0x3a4e('0x25')](respondWithResult(_0x1575b5,0xc9))[_0x3a4e('0x67')](handleError(_0x1575b5,null));};exports['update']=function(_0x2eb2c2,_0x52efdd){if(_0x2eb2c2[_0x3a4e('0x60')]['id']){delete _0x2eb2c2[_0x3a4e('0x60')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2eb2c2[_0x3a4e('0x69')]['id']},'include':[{'model':db[_0x3a4e('0x5a')],'as':_0x3a4e('0x40')}]})[_0x3a4e('0x25')](handleEntityNotFound(_0x52efdd,null))[_0x3a4e('0x25')](saveUpdates(_0x2eb2c2[_0x3a4e('0x60')],null))[_0x3a4e('0x25')](respondWithResult(_0x52efdd,null))['catch'](handleError(_0x52efdd,null));};exports[_0x3a4e('0x3a')]=function(_0xd94516,_0x11273a){return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0xd94516['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x11273a,null))[_0x3a4e('0x25')](removeEntity(_0x11273a,null))[_0x3a4e('0x67')](handleError(_0x11273a,null));};exports['describe']=function(_0x212073,_0x362505){return db['SmsAccount'][_0x3a4e('0x6a')]()[_0x3a4e('0x25')](respondWithResult(_0x362505,null))[_0x3a4e('0x67')](handleError(_0x362505,null));};exports[_0x3a4e('0x6b')]=function(_0x12494f,_0x4f9fda,_0x1cd1b0){if(_0x12494f[_0x3a4e('0x60')]['id']){delete _0x12494f[_0x3a4e('0x60')]['id'];}return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x12494f['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x4f9fda,null))[_0x3a4e('0x25')](function(_0x250c8d){if(_0x250c8d){_0x12494f[_0x3a4e('0x60')]['SmsAccountId']=_0x250c8d['id'];return db[_0x3a4e('0x6c')][_0x3a4e('0x5f')](_0x12494f[_0x3a4e('0x60')]);}})['then'](respondWithResult(_0x4f9fda,null))['catch'](handleError(_0x4f9fda,null));};exports['getDispositions']=function(_0x448a45,_0x1490cb,_0x27cec6){var _0x21ced2={'raw':![],'where':{}};var _0x57f4dd={};var _0x99e2dc={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x448a45[_0x3a4e('0x69')]['id']}})['then'](handleEntityNotFound(_0x1490cb,null))[_0x3a4e('0x25')](function(_0x19c7ec){if(_0x19c7ec){_0x57f4dd['model']=_[_0x3a4e('0x47')](db['Disposition'][_0x3a4e('0x5b')]);_0x57f4dd['query']=_[_0x3a4e('0x47')](_0x448a45[_0x3a4e('0x46')]);_0x57f4dd['filters']=_['intersection'](_0x57f4dd[_0x3a4e('0x4a')],_0x57f4dd[_0x3a4e('0x46')]);_0x21ced2[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x57f4dd[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x21ced2[_0x3a4e('0x4b')]=_0x21ced2[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x21ced2[_0x3a4e('0x4b')]:_0x57f4dd['model'];if(!_0x448a45['query'][_0x3a4e('0x4e')]('nolimit')){_0x21ced2[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x448a45['query'][_0x3a4e('0x50')]);_0x21ced2['offset']=qs[_0x3a4e('0x33')](_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x33')]);}_0x21ced2['order']=qs[_0x3a4e('0x52')](_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x21ced2[_0x3a4e('0x53')]=qs[_0x3a4e('0x48')](_['pick'](_0x448a45[_0x3a4e('0x46')],_0x57f4dd[_0x3a4e('0x48')]));_0x21ced2[_0x3a4e('0x53')][_0x3a4e('0x6e')]=_0x19c7ec['id'];if(_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x21ced2[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x21ced2['where'],{'$or':_[_0x3a4e('0x45')](_0x21ced2['attributes'],function(_0x170fe0){var _0x5d021c={};_0x5d021c[_0x170fe0]={'$like':'%'+_0x448a45[_0x3a4e('0x46')]['filter']+'%'};return _0x5d021c;})});}_0x21ced2=_['merge']({},_0x21ced2,_0x448a45[_0x3a4e('0x57')]);return db[_0x3a4e('0x6c')][_0x3a4e('0x34')]({'where':_0x21ced2[_0x3a4e('0x53')]})[_0x3a4e('0x25')](function(_0x1f08cb){_0x99e2dc[_0x3a4e('0x34')]=_0x1f08cb;if(_0x448a45[_0x3a4e('0x46')][_0x3a4e('0x5c')]){_0x21ced2['include']=[{'all':!![]}];}return db['Disposition'][_0x3a4e('0x6f')](_0x21ced2);})[_0x3a4e('0x25')](function(_0x190436){_0x99e2dc['rows']=_0x190436;return _0x99e2dc;});}})[_0x3a4e('0x25')](respondWithFilteredResult(_0x1490cb,_0x21ced2))[_0x3a4e('0x67')](handleError(_0x1490cb,null));};exports[_0x3a4e('0x70')]=function(_0xd1599b,_0x38a0e1,_0x8d003b){return db[_0x3a4e('0x41')]['find']({'where':{'id':_0xd1599b[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x38a0e1,null))[_0x3a4e('0x25')](function(_0x330100){if(_0x330100){return _0x330100[_0x3a4e('0x70')](_0xd1599b[_0x3a4e('0x46')][_0x3a4e('0x71')]);}})[_0x3a4e('0x25')](respondWithStatusCode(_0x38a0e1,null))[_0x3a4e('0x67')](handleError(_0x38a0e1,null));};exports[_0x3a4e('0x72')]=function(_0x153c40,_0x1264c8,_0x25e6cb){if(_0x153c40['body']['id']){delete _0x153c40['body']['id'];}return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0x153c40['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x1264c8,null))['then'](function(_0x3ba7e0){if(_0x3ba7e0){_0x153c40[_0x3a4e('0x60')]['SmsAccountId']=_0x3ba7e0['id'];return db[_0x3a4e('0x73')][_0x3a4e('0x5f')](_0x153c40['body']);}})[_0x3a4e('0x25')](respondWithResult(_0x1264c8,null))[_0x3a4e('0x67')](handleError(_0x1264c8,null));};exports['getAnswers']=function(_0x535446,_0x36fd21,_0x3feee6){var _0x1d511c={'raw':![],'where':{}};var _0x2ff44f={};var _0x51def2={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x535446['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x36fd21,null))[_0x3a4e('0x25')](function(_0x220597){if(_0x220597){_0x2ff44f[_0x3a4e('0x4a')]=_[_0x3a4e('0x47')](db['CannedAnswer'][_0x3a4e('0x5b')]);_0x2ff44f[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x535446[_0x3a4e('0x46')]);_0x2ff44f[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x2ff44f['model'],_0x2ff44f[_0x3a4e('0x46')]);_0x1d511c[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x2ff44f[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x535446[_0x3a4e('0x46')]['fields']));_0x1d511c[_0x3a4e('0x4b')]=_0x1d511c[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x1d511c[_0x3a4e('0x4b')]:_0x2ff44f[_0x3a4e('0x4a')];if(!_0x535446[_0x3a4e('0x46')][_0x3a4e('0x4e')]('nolimit')){_0x1d511c[_0x3a4e('0x50')]=qs['limit'](_0x535446[_0x3a4e('0x46')][_0x3a4e('0x50')]);_0x1d511c[_0x3a4e('0x33')]=qs['offset'](_0x535446[_0x3a4e('0x46')]['offset']);}_0x1d511c[_0x3a4e('0x51')]=qs[_0x3a4e('0x52')](_0x535446['query'][_0x3a4e('0x52')]);_0x1d511c['where']=qs[_0x3a4e('0x48')](_['pick'](_0x535446['query'],_0x2ff44f[_0x3a4e('0x48')]));_0x1d511c['where'][_0x3a4e('0x6e')]=_0x220597['id'];if(_0x535446['query'][_0x3a4e('0x54')]){_0x1d511c[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x1d511c['where'],{'$or':_[_0x3a4e('0x45')](_0x1d511c[_0x3a4e('0x4b')],function(_0x4b45c8){var _0x2bdb64={};_0x2bdb64[_0x4b45c8]={'$like':'%'+_0x535446['query']['filter']+'%'};return _0x2bdb64;})});}_0x1d511c=_[_0x3a4e('0x55')]({},_0x1d511c,_0x535446[_0x3a4e('0x57')]);return db[_0x3a4e('0x73')]['count']({'where':_0x1d511c[_0x3a4e('0x53')]})['then'](function(_0x161fd8){_0x51def2[_0x3a4e('0x34')]=_0x161fd8;if(_0x535446[_0x3a4e('0x46')][_0x3a4e('0x5c')]){_0x1d511c[_0x3a4e('0x5d')]=[{'all':!![]}];}return db[_0x3a4e('0x73')][_0x3a4e('0x6f')](_0x1d511c);})['then'](function(_0x3a50c6){_0x51def2['rows']=_0x3a50c6;return _0x51def2;});}})[_0x3a4e('0x25')](respondWithFilteredResult(_0x36fd21,_0x1d511c))['catch'](handleError(_0x36fd21,null));};exports['removeAnswers']=function(_0x30008c,_0x46f143,_0x225ec8){return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x30008c[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x46f143,null))[_0x3a4e('0x25')](function(_0xc98502){if(_0xc98502){return _0xc98502[_0x3a4e('0x74')](_0x30008c[_0x3a4e('0x46')][_0x3a4e('0x71')]);}})['then'](respondWithStatusCode(_0x46f143,null))[_0x3a4e('0x67')](handleError(_0x46f143,null));};exports['notify']=function(_0x1c2b67,_0x3d588c,_0x531e3b){var _0x206d27={'channel':'sms'};var _0xb8aaa6=[];var _0x328e9f=[];var _0x304f55={};return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x1c2b67[_0x3a4e('0x69')]['id']},'include':[{'model':db[_0x3a4e('0x75')],'as':_0x3a4e('0x76')}]})[_0x3a4e('0x25')](handleEntityNotFound(_0x3d588c,null))[_0x3a4e('0x25')](function(_0x2c20b0){_0x206d27[_0x3a4e('0x77')]=_0x2c20b0;_0x206d27[_0x3a4e('0x78')]=_[_0x3a4e('0x79')](_0x2c20b0['Applications'],[_0x3a4e('0x7a')],[_0x3a4e('0x7b')]);if(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0x76')]){delete _0x206d27[_0x3a4e('0x77')][_0x3a4e('0x76')];}return db[_0x3a4e('0x7c')]['describe']();})[_0x3a4e('0x25')](function(_0x11f052){if(!_0x11f052){throw new db['Sequelize'][(_0x3a4e('0x7d'))](_0x3a4e('0x7e'));}_0xb8aaa6=_[_0x3a4e('0x7f')](_[_0x3a4e('0x47')](_0x11f052),[_0x3a4e('0x80'),'updatedAt']);_0x328e9f=_[_0x3a4e('0x7f')](_[_0x3a4e('0x47')](_0x11f052),[_0x3a4e('0x80'),_0x3a4e('0x81'),_0x3a4e('0x82'),_0x3a4e('0x83')]);_0x206d27[_0x3a4e('0x60')]={'mapKey':_0x3a4e('0x84')};if(_0x206d27['account'][_0x3a4e('0x43')]){switch(_0x206d27['account'][_0x3a4e('0x43')]){case _0x3a4e('0x85'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x87')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')]['Body'];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x89')];break;case _0x3a4e('0x8a'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]='+'+_0x1c2b67[_0x3a4e('0x60')]['sender'];_0x206d27[_0x3a4e('0x60')]['body']=_0x1c2b67['body'][_0x3a4e('0x8b')];break;case'connectel':_0x206d27['body'][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x86')];_0x206d27['body']['body']=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x2c')];break;case _0x3a4e('0x8c'):_0x206d27['body'][_0x3a4e('0x86')]=_0x1c2b67['body'][_0x3a4e('0x86')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x60')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x8d')];break;case _0x3a4e('0x8e'):_0x206d27[_0x3a4e('0x60')]['from']=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x87')];_0x206d27['body'][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x8f')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67['body']['MessageUUID'];break;case'infobip':_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]='+'+_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x90')][0x0][_0x3a4e('0x86')];_0x206d27[_0x3a4e('0x60')]['body']=_0x1c2b67[_0x3a4e('0x60')]['results'][0x0]['text'];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')]['results'][0x0][_0x3a4e('0x88')];break;case _0x3a4e('0x91'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67['body'][_0x3a4e('0x92')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x93')][_0x3a4e('0x2c')];break;case _0x3a4e('0x94'):_0x206d27['body'][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x95')];_0x206d27['body']['body']=_0x1c2b67['body'][_0x3a4e('0x8b')];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][_0x3a4e('0x96')];break;case _0x3a4e('0x97'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x88')]=_0x1c2b67[_0x3a4e('0x60')][0x0][_0x3a4e('0x2c')]['id'];_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67[_0x3a4e('0x60')][0x0][_0x3a4e('0x2c')]['from'];_0x206d27['body'][_0x3a4e('0x60')]=_0x1c2b67[_0x3a4e('0x60')][0x0]['message'][_0x3a4e('0x8b')];break;case _0x3a4e('0x98'):_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')]=_0x1c2b67['body'][_0x3a4e('0x86')];_0x206d27[_0x3a4e('0x60')]['body']=_0x1c2b67['body'][_0x3a4e('0x2c')];_0x206d27[_0x3a4e('0x60')]['messageId']=_0x1c2b67['body'][_0x3a4e('0x99')];break;}}if(_0x206d27[_0x3a4e('0x60')]['id']){delete _0x206d27[_0x3a4e('0x60')]['id'];}if(_[_0x3a4e('0x9a')](_0x206d27[_0x3a4e('0x60')]['from'])){throw new db[(_0x3a4e('0x9b'))]['ValidationError'](_0x3a4e('0x9c'));}if(_[_0x3a4e('0x9a')](_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')])||_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x60')]===''){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))](_0x3a4e('0x9d'));}if(_['isNil'](_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x9e')])){throw new db[(_0x3a4e('0x9b'))]['ValidationError'](_0x3a4e('0x9f')+_0x328e9f);}if(!_[_0x3a4e('0xa0')](_0x328e9f,_0x206d27['body'][_0x3a4e('0x9e')])){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))](_0x3a4e('0xa1')+_0x328e9f);}_0x304f55[_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x9e')]]=_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')];return db[_0x3a4e('0xa2')][_0x3a4e('0x5e')]({'where':{'id':_0x206d27['account'][_0x3a4e('0x83')]},'include':[{'model':db['CmContact'],'as':_0x3a4e('0xa3'),'where':_0x304f55,'limit':0x1,'order':[['updatedAt',_0x3a4e('0xa4')]]}]});})[_0x3a4e('0x25')](handleEntityNotFound(_0x3d588c,null))[_0x3a4e('0x25')](function(_0x1218d8){if(_0x1218d8){_0x206d27[_0x3a4e('0xa5')]=_[_0x3a4e('0xa6')](_0x1218d8,[_0x3a4e('0xa3')]);if(_0x1218d8['Contacts'][_0x3a4e('0x4d')]){return _0x1218d8[_0x3a4e('0xa3')][0x0];}var _0x1f40cf=_['defaults'](_0x206d27['body'],{'firstName':_0x206d27[_0x3a4e('0x60')]['from'],'ListId':_0x1218d8['id']});_0x1f40cf[_0x206d27[_0x3a4e('0x60')]['mapKey']]=_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')];return db[_0x3a4e('0x7c')]['create'](_0x1f40cf,{'fields':_0xb8aaa6,'raw':!![]});}})[_0x3a4e('0x25')](handleEntityNotFound(_0x3d588c,null))[_0x3a4e('0x25')](function(_0x33ef1f){if(_0x33ef1f){_0x206d27[_0x3a4e('0xa7')]=_0x33ef1f;var _0xad74a9={'ContactId':_0x33ef1f['id'],'phone':_0x206d27['body'][_0x3a4e('0x86')],'SmsAccountId':_0x1c2b67['params']['id']};var _0x45b37a={'ContactId':_0x33ef1f['id'],'SmsAccountId':_0x1c2b67['params']['id'],'closed':![]};return db['SmsInteraction'][_0x3a4e('0x5e')]({'where':_0x45b37a})[_0x3a4e('0x25')](function(_0x1f72a5){if(_0x1f72a5){return[_0x1f72a5,![]];}return db[_0x3a4e('0xa8')][_0x3a4e('0x5f')](_0xad74a9)[_0x3a4e('0x25')](function(_0x259eca){return[_0x259eca,!![]];});});}})[_0x3a4e('0xa9')](function(_0x5e8fe6,_0x4b9197){_0x206d27['interaction']=_0x5e8fe6[_0x3a4e('0x3b')]({'plain':!![]});_0x206d27[_0x3a4e('0xaa')][_0x3a4e('0xab')]=![];if(_0x4b9197){if(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0xac')]){_0x206d27[_0x3a4e('0x78')][_0x3a4e('0xad')]({'id':0x0,'priority':_0x206d27[_0x3a4e('0x78')][_0x3a4e('0x4d')]+0x1,'app':_0x3a4e('0xae'),'appdata':_0x3a4e('0xaf'),'interval':'*,*,*,*'});}_0x206d27[_0x3a4e('0xaa')][_0x3a4e('0xab')]=!![];}return db[_0x3a4e('0xb0')][_0x3a4e('0x5f')]({'phone':_0x206d27[_0x3a4e('0x60')][_0x3a4e('0x86')],'messageId':_0x206d27[_0x3a4e('0x60')]['messageId'],'body':_0x206d27['body']['body'],'SmsAccountId':_0x1c2b67[_0x3a4e('0x69')]['id'],'SmsInteractionId':_0x5e8fe6['id'],'direction':'in','ContactId':_0x5e8fe6[_0x3a4e('0xb1')],'AttachmentId':_0x206d27[_0x3a4e('0x60')][_0x3a4e('0xb2')]});})[_0x3a4e('0x25')](function(_0x46675f){_0x206d27['message']=_0x46675f;if(_0x206d27['interaction'][_0x3a4e('0xb3')]){return db[_0x3a4e('0xb4')][_0x3a4e('0x5e')]({'attributes':['id',_0x3a4e('0x3d')],'where':{'id':_0x206d27[_0x3a4e('0xaa')][_0x3a4e('0xb3')]}})[_0x3a4e('0x25')](function(_0x35526b){if(_0x35526b){_0x206d27[_0x3a4e('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3a4e('0xb5'),'appdata':_0x35526b['name']+','+(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0xb6')]||0xa),'interval':_0x3a4e('0xb7')});}return respondWithRpcPromise('Start','startRouting',_0x206d27);});}return respondWithRpcPromise(_0x3a4e('0xb8'),_0x3a4e('0xb9'),_0x206d27);})[_0x3a4e('0x25')](function(_0x13df4c){if(_0x13df4c){var _0x50f97e=0xc8;var _0x3ff45f='receiveMessage';logger[_0x3a4e('0x2d')](_0x3a4e('0x29'),_0x3ff45f,_0x50f97e,'entity\x20found');logger[_0x3a4e('0x28')](_0x3a4e('0xba'),_0x3ff45f,_0x50f97e,_0x3a4e('0xbb'),JSON[_0x3a4e('0xbc')](_0x13df4c));if(_0x206d27[_0x3a4e('0x77')][_0x3a4e('0x43')]===_0x3a4e('0x85')){return _0x3d588c[_0x3a4e('0x35')](_0x50f97e)[_0x3a4e('0x36')](_0x3a4e('0xbd'),_0x3a4e('0xbe'))[_0x3a4e('0x3e')](_0x3a4e('0xbf'));}else{return _0x3d588c['status'](_0x50f97e)['json'](_0x13df4c);}}})[_0x3a4e('0x67')](handleError(_0x3d588c,null));};exports[_0x3a4e('0xc0')]=function(_0x381ccd,_0x5a37ec){var _0x2bdc51=_0x381ccd[_0x3a4e('0x69')]['id'];var _0x449779=_0x381ccd[_0x3a4e('0x60')];var _0x182913=0xc8;var _0x386e38=null;return db[_0x3a4e('0xc1')][_0x3a4e('0xc2')]({'isolationLevel':db[_0x3a4e('0xc1')]['Transaction']['ISOLATION_LEVELS'][_0x3a4e('0xc3')]},function(_0xddcab){return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x2bdc51},'transaction':_0xddcab})[_0x3a4e('0x25')](function(_0x56b665){if(_0x56b665){return db[_0x3a4e('0x75')]['destroy']({'where':{'SmsAccountId':_0x2bdc51},'transaction':_0xddcab})['then'](function(){var _0x4b54fc=_[_0x3a4e('0x45')](_0x449779,function(_0x4f76f7){_0x4f76f7['SmsAccountId']=_0x2bdc51;return _0x4f76f7;});return db['SmsApplication'][_0x3a4e('0xc4')](_0x4b54fc,{'transaction':_0xddcab});});}else{_0x182913=0x194;_0x386e38=[];}});})[_0x3a4e('0x25')](function(){if(_0x182913!==0x194){return db['SmsApplication'][_0x3a4e('0xc5')]({'where':{'SmsAccountId':_0x2bdc51},'order':_0x3a4e('0x7a')})[_0x3a4e('0x25')](function(_0x41144f){_0x386e38=_0x41144f;});}})[_0x3a4e('0x67')](function(_0x218f69){_0x182913=0x1f4;logger['error'](_0x218f69[_0x3a4e('0x3c')]);if(_0x218f69['name']){delete _0x218f69[_0x3a4e('0x3d')];}_0x386e38=_0x218f69;})['finally'](function(){if(_0x386e38===null){_0x5a37ec[_0x3a4e('0x2f')](_0x182913);}else{if(_0x182913===0x1f4){_0x5a37ec[_0x3a4e('0x35')](_0x182913)[_0x3a4e('0x3e')](_0x386e38);}else{_0x5a37ec[_0x3a4e('0x35')](_0x182913)[_0x3a4e('0x31')](_0x386e38);}}});};exports[_0x3a4e('0xc6')]=function(_0x40e1a8,_0x5e2298,_0x49b2db){var _0x54f3aa={};var _0x4b30e9={};var _0x1418ab;var _0x2d76c9;return db[_0x3a4e('0x41')][_0x3a4e('0x6d')]({'where':{'id':_0x40e1a8[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x5e2298,null))[_0x3a4e('0x25')](function(_0x52fa5f){if(_0x52fa5f){_0x1418ab=_0x52fa5f;_0x4b30e9['model']=_[_0x3a4e('0x47')](db[_0x3a4e('0x75')][_0x3a4e('0x5b')]);_0x4b30e9[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x40e1a8['query']);_0x4b30e9[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x4b30e9[_0x3a4e('0x4a')],_0x4b30e9[_0x3a4e('0x46')]);_0x54f3aa[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x4b30e9[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x54f3aa['attributes']=_0x54f3aa[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x54f3aa[_0x3a4e('0x4b')]:_0x4b30e9['model'];_0x54f3aa['order']=qs[_0x3a4e('0x52')](_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x54f3aa[_0x3a4e('0x53')]=qs['filters'](_[_0x3a4e('0xc7')](_0x40e1a8[_0x3a4e('0x46')],_0x4b30e9[_0x3a4e('0x48')]));if(_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x54f3aa[_0x3a4e('0x53')]=_['merge'](_0x54f3aa[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x54f3aa[_0x3a4e('0x4b')],function(_0x42c4dc){var _0x37a8ad={};_0x37a8ad[_0x42c4dc]={'$like':'%'+_0x40e1a8['query']['filter']+'%'};return _0x37a8ad;})});}_0x54f3aa=_['merge']({},_0x54f3aa,_0x40e1a8[_0x3a4e('0x57')]);return _0x1418ab['getApplications'](_0x54f3aa);}})['then'](function(_0x2a786b){if(_0x2a786b){_0x2d76c9=_0x2a786b[_0x3a4e('0x4d')];if(!_0x40e1a8['query']['hasOwnProperty'](_0x3a4e('0x4f'))){_0x54f3aa[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x40e1a8[_0x3a4e('0x46')]['limit']);_0x54f3aa[_0x3a4e('0x33')]=qs[_0x3a4e('0x33')](_0x40e1a8[_0x3a4e('0x46')][_0x3a4e('0x33')]);}return _0x1418ab[_0x3a4e('0xc6')](_0x54f3aa);}})[_0x3a4e('0x25')](function(_0x53e058){if(_0x53e058){return _0x53e058?{'count':_0x2d76c9,'rows':_0x53e058}:null;}})[_0x3a4e('0x25')](respondWithResult(_0x5e2298,null))['catch'](handleError(_0x5e2298,null));};exports[_0x3a4e('0xc8')]=function(_0x4a730b,_0x54f269,_0x4b5828){var _0x125ed8={'raw':![],'where':{}};var _0x45e776={};var _0x12b15c={'count':0x0,'rows':[]};return db[_0x3a4e('0x41')][_0x3a4e('0x6d')]({'where':{'id':_0x4a730b['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x54f269,null))['then'](function(_0x351211){if(_0x351211){_0x45e776['model']=_[_0x3a4e('0x47')](db[_0x3a4e('0xa8')]['rawAttributes']);_0x45e776[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x4a730b[_0x3a4e('0x46')]);_0x45e776[_0x3a4e('0x48')]=_['intersection'](_0x45e776[_0x3a4e('0x4a')],_0x45e776[_0x3a4e('0x46')]);_0x125ed8[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x45e776[_0x3a4e('0x4a')],qs[_0x3a4e('0x4c')](_0x4a730b['query'][_0x3a4e('0x4c')]));_0x125ed8['attributes']=_0x125ed8['attributes'][_0x3a4e('0x4d')]?_0x125ed8[_0x3a4e('0x4b')]:_0x45e776['model'];if(!_0x4a730b[_0x3a4e('0x46')]['hasOwnProperty'](_0x3a4e('0x4f'))){_0x125ed8[_0x3a4e('0x50')]=qs[_0x3a4e('0x50')](_0x4a730b['query']['limit']);_0x125ed8['offset']=qs[_0x3a4e('0x33')](_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x33')]);}_0x125ed8[_0x3a4e('0x51')]=qs['sort'](_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x125ed8[_0x3a4e('0x53')]=qs[_0x3a4e('0x48')](_[_0x3a4e('0xc7')](_0x4a730b[_0x3a4e('0x46')],_0x45e776[_0x3a4e('0x48')]));_0x125ed8[_0x3a4e('0x53')][_0x3a4e('0x6e')]=_0x351211['id'];if(_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x125ed8[_0x3a4e('0x53')]=_['merge'](_0x125ed8[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x125ed8['attributes'],function(_0x231624){var _0x59c99d={};_0x59c99d[_0x231624]={'$like':'%'+_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0x54')]+'%'};return _0x59c99d;})});}_0x125ed8=_[_0x3a4e('0x55')]({},_0x125ed8,_0x4a730b['options']);return db[_0x3a4e('0xa8')][_0x3a4e('0x34')]({'where':_0x125ed8[_0x3a4e('0x53')]})['then'](function(_0x3bee19){_0x12b15c['count']=_0x3bee19;if(_0x4a730b[_0x3a4e('0x46')]['includeAll']){_0x125ed8[_0x3a4e('0x5d')]=[{'model':db[_0x3a4e('0x7c')],'as':'Contact','required':![]},{'model':db[_0x3a4e('0xb4')],'as':_0x3a4e('0xc9'),'attributes':[_0x3a4e('0x3d'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x3a4e('0xca'),'attributes':['id','name',_0x3a4e('0xcb')],'where':_0x4a730b['query'][_0x3a4e('0xcc')]?{'id':_0x4a730b['query'][_0x3a4e('0xcc')]}:undefined,'required':_0x4a730b[_0x3a4e('0x46')][_0x3a4e('0xcc')]?!![]:![]}];}return db[_0x3a4e('0xa8')]['findAll'](_0x125ed8);})[_0x3a4e('0x25')](function(_0x6d4724){_0x12b15c[_0x3a4e('0x58')]=_0x6d4724;return _0x12b15c;});}})[_0x3a4e('0x25')](respondWithFilteredResult(_0x54f269,_0x125ed8))[_0x3a4e('0x67')](handleError(_0x54f269,null));};exports[_0x3a4e('0x3e')]=function(_0x51a26c,_0x10bf0e,_0x5c24f4){var _0x239368,_0x33c607,_0x376c31;if(_[_0x3a4e('0x9a')](_0x51a26c[_0x3a4e('0x60')]['body'])||_0x51a26c[_0x3a4e('0x60')][_0x3a4e('0x60')]===''){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))](_0x3a4e('0x9d'));}if(_[_0x3a4e('0x9a')](_0x51a26c[_0x3a4e('0x60')]['to'])){throw new db[(_0x3a4e('0x9b'))][(_0x3a4e('0x7d'))]('to\x20is\x20mandatory');}_0x239368=_0x51a26c['body']['to'];return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0x51a26c[_0x3a4e('0x69')]['id']},'include':[{'model':db[_0x3a4e('0xa2')],'as':'List','include':[{'model':db[_0x3a4e('0x7c')],'as':'Contacts','where':{'mobile':_0x239368},'limit':0x1,'order':[[_0x3a4e('0x81'),'DESC']]}]}]})[_0x3a4e('0x25')](handleEntityNotFound(_0x10bf0e,null))[_0x3a4e('0x25')](function(_0x154c79){if(_0x154c79&&_0x154c79[_0x3a4e('0xcd')]){_0x33c607=_0x154c79[_0x3a4e('0x3b')]({'plain':!![]});if(_0x33c607['List']&&_0x33c607['List']['Contacts'][_0x3a4e('0x4d')]){return _0x33c607[_0x3a4e('0xcd')][_0x3a4e('0xa3')][0x0];}return db[_0x3a4e('0x7c')][_0x3a4e('0x5f')](_['defaults'](_0x51a26c['body'],{'firstName':_0x239368,'mobile':_0x239368,'phone':_0x239368,'ListId':_0x33c607['ListId']}));}})[_0x3a4e('0x25')](handleEntityNotFound(_0x10bf0e,null))[_0x3a4e('0x25')](function(_0x42fc62){if(_0x42fc62){_0x376c31=_0x42fc62;return db[_0x3a4e('0xa8')][_0x3a4e('0x5e')]({'where':{'ContactId':_0x376c31['id'],'closed':![],'SmsAccountId':_0x33c607['id']}})['then'](function(_0x220699){if(_0x220699){return[_0x220699,![]];}return db[_0x3a4e('0xa8')][_0x3a4e('0x5f')]({'UserId':_0x51a26c['user']['id'],'ContactId':_0x376c31['id'],'SmsAccountId':_0x33c607['id'],'phone':_0x239368,'firstMsgDirection':_0x3a4e('0xce'),'Messages':[_['merge'](_0x51a26c[_0x3a4e('0x60')],{'read':![],'body':_0x51a26c[_0x3a4e('0x60')][_0x3a4e('0x60')],'phone':_0x239368,'SmsAccountId':_0x33c607['id'],'UserId':_0x51a26c[_0x3a4e('0x61')]['id'],'ContactId':_0x376c31['id']})]},{'include':[{'model':db[_0x3a4e('0xb0')],'as':_0x3a4e('0xcf')}]})[_0x3a4e('0x25')](function(_0x492e00){return[_0x492e00,!![]];});});}})[_0x3a4e('0xa9')](function(_0x7c1872,_0x1d0886){if(_0x1d0886){return _0x7c1872;}return db[_0x3a4e('0xb0')][_0x3a4e('0x5f')](_[_0x3a4e('0x55')](_0x51a26c['body'],{'read':![],'body':_0x51a26c[_0x3a4e('0x60')][_0x3a4e('0x60')],'phone':_0x239368,'SmsAccountId':_0x33c607['id'],'SmsInteractionId':_0x7c1872['id'],'UserId':_0x51a26c[_0x3a4e('0x61')]['id'],'ContactId':_0x376c31['id']}))[_0x3a4e('0x25')](function(_0x2b63f7){_0x7c1872[_0x3a4e('0xd0')]['Messages']=[];_0x7c1872[_0x3a4e('0xd0')][_0x3a4e('0xcf')][_0x3a4e('0xad')](_0x2b63f7['dataValues']);return _0x7c1872;});})['then'](respondWithResult(_0x10bf0e,null))['catch'](handleError(_0x10bf0e,null));};exports['status']=function(_0x1b914b,_0x506e13,_0x2e0a05){if(_0x1b914b[_0x3a4e('0x60')]['id']){delete _0x1b914b['body']['id'];}var _0x290eb5,_0x6331ad,_0x56b030;return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x1b914b[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x506e13,null))['then'](function(_0x5cc73){if(_0x5cc73){_0x56b030=_0x5cc73;logger[_0x3a4e('0x28')](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0xd1'),_0x5cc73['type'],util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));switch(_0x5cc73[_0x3a4e('0x43')]){case'skebby':if(_0x1b914b['body']['skebby_dispatch_id']&&_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b['body'][_0x3a4e('0xd3')]}});}break;case _0x3a4e('0xd4'):if(_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xd5')]&&_0x1b914b[_0x3a4e('0x60')]['statusInt']){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xd6')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b['body'][_0x3a4e('0xd5')]}});}break;case _0x3a4e('0x8c'):if(_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x8d')]&&_0x1b914b['body'][_0x3a4e('0xd7')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x8d')]}});}break;case _0x3a4e('0xd8'):var _0x1bf09f=_0x1b914b['body'][_0x3a4e('0x90')][0x0];if(_0x1bf09f[_0x3a4e('0x88')]&&_0x1bf09f['status'][_0x3a4e('0xd9')]==='DELIVERED'){_0x6331ad=_0x1bf09f['status'][_0x3a4e('0xd9')];return db[_0x3a4e('0xb0')]['find']({'where':{'messageId':_0x1bf09f[_0x3a4e('0x88')]}});}break;case _0x3a4e('0x94'):if(_0x1b914b[_0x3a4e('0x60')]['messageId']&&_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')]['status'];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b['body'][_0x3a4e('0x88')]}});}break;case _0x3a4e('0x97'):if(_0x1b914b['body'][0x0][_0x3a4e('0x2c')]['id']){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][0x0][_0x3a4e('0x43')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x1b914b[_0x3a4e('0x60')][0x0][_0x3a4e('0x2c')]['id']}});}break;case'intelepeer':if(_0x1b914b['body'][_0x3a4e('0xda')]&&_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')]){_0x6331ad=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x35')];return db['SmsMessage']['find']({'where':{'messageId':_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xda')]}});}break;}}})[_0x3a4e('0x25')](handleEntityNotFound(_0x506e13,null))[_0x3a4e('0x25')](function(_0x4560ff){if(_0x4560ff){_0x290eb5=_0x4560ff;switch(_0x56b030[_0x3a4e('0x43')]){case _0x3a4e('0x8a'):if(_0x6331ad===_0x3a4e('0xdb')){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger[_0x3a4e('0x2a')](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x8a'),util['inspect'](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0xd4'):if(_0x6331ad==='1'){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),'status',_0x3a4e('0x8a'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x8c'):if(!_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0xdc')]&&_0x6331ad>=0xc8&&_0x6331ad<=0xce){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x8c'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1e8a1c=_0x1b914b[_0x3a4e('0x60')][_0x3a4e('0x90')][0x0];if(_0x1e8a1c[_0x3a4e('0x35')][_0x3a4e('0xd9')]==='DELIVERED'){return _0x290eb5['update']({'read':!![]});}else{logger[_0x3a4e('0x2a')](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0xd8'),util['inspect'](_0x1b914b['body'],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x94'):if(_0x6331ad==_0x3a4e('0xdd')||_0x6331ad==_0x3a4e('0xde')){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger[_0x3a4e('0x2a')](_0x3a4e('0x29'),'status',_0x3a4e('0x94'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x97'):if(_0x6331ad=='message-delivered'){return _0x290eb5[_0x3a4e('0x39')]({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x97'),util[_0x3a4e('0xd2')](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x3a4e('0x98'):if(_0x6331ad===_0x3a4e('0xdf')||_0x6331ad===_0x3a4e('0xe0')){return _0x290eb5['update']({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),'intelepeer',util['inspect'](_0x1b914b[_0x3a4e('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x290eb5;}})[_0x3a4e('0x25')](respondWithResult(_0x506e13,null))['catch'](handleError(_0x506e13,null));};exports['statusGet']=function(_0x319c65,_0x309d95,_0x4fbb35){var _0x223ef7,_0x3c8b7d,_0x2d882e;return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x319c65['params']['id']}})['then'](handleEntityNotFound(_0x309d95,null))[_0x3a4e('0x25')](function(_0x5217d1){if(_0x5217d1){_0x2d882e=_0x5217d1;logger[_0x3a4e('0x28')](_0x3a4e('0x29'),_0x3a4e('0x35'),'received\x20delivery\x20report\x20from',_0x5217d1['type'],util[_0x3a4e('0xd2')](_0x319c65[_0x3a4e('0x46')],{'showHidden':![],'depth':null}));switch(_0x5217d1['type']){case'csc':if(_0x319c65[_0x3a4e('0x46')][_0x3a4e('0xe1')]&&_0x319c65['query'][_0x3a4e('0xe2')]){_0x3c8b7d=_0x319c65[_0x3a4e('0x46')][_0x3a4e('0xe2')];return db[_0x3a4e('0xb0')][_0x3a4e('0x5e')]({'where':{'messageId':_0x319c65['query'][_0x3a4e('0xe1')]}});}break;}}})[_0x3a4e('0x25')](handleEntityNotFound(_0x309d95,null))[_0x3a4e('0x25')](function(_0x41b211){if(_0x41b211){_0x223ef7=_0x41b211;switch(_0x2d882e[_0x3a4e('0x43')]){case _0x3a4e('0x91'):if(_0x3c8b7d==='2'||_0x3c8b7d==='6'){return _0x223ef7['update']({'read':!![]});}else{logger['error'](_0x3a4e('0x29'),_0x3a4e('0x35'),_0x3a4e('0x91'),util['inspect'](_0x319c65[_0x3a4e('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x223ef7;}})[_0x3a4e('0x25')](respondWithResult(_0x309d95,null))[_0x3a4e('0x67')](handleError(_0x309d95,null));};exports[_0x3a4e('0xe3')]=function(_0x15f3ac,_0x1fcb88,_0x28601e){return db['SmsAccount'][_0x3a4e('0x5e')]({'where':{'id':_0x15f3ac[_0x3a4e('0x69')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x1fcb88,null))[_0x3a4e('0x25')](function(_0x482086){if(_0x482086){return _0x482086[_0x3a4e('0xe3')](_0x15f3ac['body']['ids'],_['omit'](_0x15f3ac[_0x3a4e('0x60')],[_0x3a4e('0x71'),'id'])||{})[_0x3a4e('0xa9')](function(_0x28bf37){for(var _0x577952=0x0;_0x577952<_0x15f3ac[_0x3a4e('0x60')][_0x3a4e('0x71')][_0x3a4e('0x4d')];_0x577952+=0x1){socket[_0x3a4e('0xe4')](_0x3a4e('0xe5'),{'UserId':Number(_0x15f3ac[_0x3a4e('0x60')][_0x3a4e('0x71')][_0x577952]),'SmsAccountId':Number(_0x15f3ac[_0x3a4e('0x69')]['id'])});}return _0x28bf37;});}})[_0x3a4e('0x25')](respondWithResult(_0x1fcb88,null))[_0x3a4e('0x67')](handleError(_0x1fcb88,null));};exports[_0x3a4e('0xe6')]=function(_0x39928d,_0x493501,_0x44afb5){return db[_0x3a4e('0x41')][_0x3a4e('0x5e')]({'where':{'id':_0x39928d[_0x3a4e('0x69')]['id']}})['then'](handleEntityNotFound(_0x493501,null))[_0x3a4e('0x25')](function(_0x2376a7){if(_0x2376a7){return _0x2376a7[_0x3a4e('0xe6')](_0x39928d[_0x3a4e('0x46')]['ids'])[_0x3a4e('0x25')](function(){if(_['isArray'](_0x39928d[_0x3a4e('0x46')]['ids'])){for(var _0x578ae4=0x0;_0x578ae4<_0x39928d[_0x3a4e('0x46')][_0x3a4e('0x71')][_0x3a4e('0x4d')];_0x578ae4+=0x1){socket['emit'](_0x3a4e('0xe7'),{'UserId':Number(_0x39928d[_0x3a4e('0x46')]['ids'][_0x578ae4]),'SmsAccountId':Number(_0x39928d['params']['id'])});}}else{socket[_0x3a4e('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x39928d['query']['ids']),'SmsAccountId':Number(_0x39928d[_0x3a4e('0x69')]['id'])});}});}})[_0x3a4e('0x25')](respondWithStatusCode(_0x493501,null))['catch'](handleError(_0x493501,null));};exports[_0x3a4e('0xe8')]=function(_0x17bdd1,_0x12470f,_0x522bb9){var _0x1e7e39={};var _0x4d075a={};var _0x5e0a9f;var _0x2b9a26;return db['SmsAccount'][_0x3a4e('0x6d')]({'where':{'id':_0x17bdd1[_0x3a4e('0x69')]['id']}})['then'](handleEntityNotFound(_0x12470f,null))[_0x3a4e('0x25')](function(_0x36c8ea){if(_0x36c8ea){_0x5e0a9f=_0x36c8ea;_0x4d075a['model']=_['keys'](db[_0x3a4e('0xb4')]['rawAttributes']);_0x4d075a[_0x3a4e('0x46')]=_[_0x3a4e('0x47')](_0x17bdd1[_0x3a4e('0x46')]);_0x4d075a[_0x3a4e('0x48')]=_[_0x3a4e('0x49')](_0x4d075a[_0x3a4e('0x4a')],_0x4d075a[_0x3a4e('0x46')]);_0x1e7e39[_0x3a4e('0x4b')]=_[_0x3a4e('0x49')](_0x4d075a[_0x3a4e('0x4a')],qs['fields'](_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x4c')]));_0x1e7e39[_0x3a4e('0x4b')]=_0x1e7e39[_0x3a4e('0x4b')][_0x3a4e('0x4d')]?_0x1e7e39[_0x3a4e('0x4b')]:_0x4d075a[_0x3a4e('0x4a')];_0x1e7e39[_0x3a4e('0x51')]=qs[_0x3a4e('0x52')](_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x52')]);_0x1e7e39['where']=qs[_0x3a4e('0x48')](_[_0x3a4e('0xc7')](_0x17bdd1[_0x3a4e('0x46')],_0x4d075a[_0x3a4e('0x48')]));if(_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x54')]){_0x1e7e39[_0x3a4e('0x53')]=_[_0x3a4e('0x55')](_0x1e7e39[_0x3a4e('0x53')],{'$or':_[_0x3a4e('0x45')](_0x1e7e39[_0x3a4e('0x4b')],function(_0x5cc170){var _0x20d1d4={};_0x20d1d4[_0x5cc170]={'$like':'%'+_0x17bdd1[_0x3a4e('0x46')]['filter']+'%'};return _0x20d1d4;})});}_0x1e7e39=_[_0x3a4e('0x55')]({},_0x1e7e39,_0x17bdd1[_0x3a4e('0x57')]);return _0x5e0a9f[_0x3a4e('0xe8')](_0x1e7e39);}})['then'](function(_0x55a0ee){if(_0x55a0ee){_0x2b9a26=_0x55a0ee['length'];if(!_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x4e')](_0x3a4e('0x4f'))){_0x1e7e39[_0x3a4e('0x50')]=qs['limit'](_0x17bdd1['query'][_0x3a4e('0x50')]);_0x1e7e39[_0x3a4e('0x33')]=qs[_0x3a4e('0x33')](_0x17bdd1[_0x3a4e('0x46')][_0x3a4e('0x33')]);}return _0x5e0a9f['getAgents'](_0x1e7e39);}})[_0x3a4e('0x25')](function(_0x2af152){if(_0x2af152){return _0x2af152?{'count':_0x2b9a26,'rows':_0x2af152}:null;}})[_0x3a4e('0x25')](respondWithResult(_0x12470f,null))[_0x3a4e('0x67')](handleError(_0x12470f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 017273a..2b8eef3 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 _0xb04f=['hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x48dfc7,_0x28410f){var _0x553cbf=function(_0x56f3f7){while(--_0x56f3f7){_0x48dfc7['push'](_0x48dfc7['shift']());}};_0x553cbf(++_0x28410f);}(_0xb04f,0x89));var _0xfb04=function(_0x223c63,_0x35f3fb){_0x223c63=_0x223c63-0x0;var _0x180d0e=_0xb04f[_0x223c63];return _0x180d0e;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xfb04('0x0'))['db'][_0xfb04('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfb04('0x2')](0x0);var events={'afterCreate':_0xfb04('0x3'),'afterUpdate':_0xfb04('0x4'),'afterDestroy':_0xfb04('0x5')};function emitEvent(_0x3387ed){return function(_0xe9c3a,_0x31d6f7,_0x1404a9){SmsAccountEvents['emit'](_0x3387ed+':'+_0xe9c3a['id'],_0xe9c3a);SmsAccountEvents[_0xfb04('0x6')](_0x3387ed,_0xe9c3a);_0x1404a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xfb04('0x7')](e,emitEvent(event));}}module[_0xfb04('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xdc46=['exports','events','../../mysqldb','SmsAccount','save','remove','emit','hasOwnProperty'];(function(_0x1e6e07,_0x372e98){var _0x4b3b9d=function(_0xb87b93){while(--_0xb87b93){_0x1e6e07['push'](_0x1e6e07['shift']());}};_0x4b3b9d(++_0x372e98);}(_0xdc46,0x141));var _0x6dc4=function(_0x54c87f,_0x815985){_0x54c87f=_0x54c87f-0x0;var _0x524173=_0xdc46[_0x54c87f];return _0x524173;};'use strict';var EventEmitter=require(_0x6dc4('0x0'));var SmsAccount=require(_0x6dc4('0x1'))['db'][_0x6dc4('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6dc4('0x3'),'afterUpdate':'update','afterDestroy':_0x6dc4('0x4')};function emitEvent(_0x387ccb){return function(_0x42bebe,_0x4b1d37,_0x5015b5){SmsAccountEvents['emit'](_0x387ccb+':'+_0x42bebe['id'],_0x42bebe);SmsAccountEvents[_0x6dc4('0x5')](_0x387ccb,_0x42bebe);_0x5015b5(null);};}for(var e in events){if(events[_0x6dc4('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x6dc4('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index dc9195c..f80ceda 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 _0x3353=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x2d807d,_0x52dba0){var _0x844473=function(_0x53f052){while(--_0x53f052){_0x2d807d['push'](_0x2d807d['shift']());}};_0x844473(++_0x52dba0);}(_0x3353,0x1ce));var _0x3335=function(_0x36433c,_0x5f4691){_0x36433c=_0x36433c-0x0;var _0x58832e=_0x3353[_0x36433c];return _0x58832e;};'use strict';var _=require(_0x3335('0x0'));var util=require(_0x3335('0x1'));var logger=require(_0x3335('0x2'))(_0x3335('0x3'));var moment=require('moment');var BPromise=require(_0x3335('0x4'));var rp=require(_0x3335('0x5'));var fs=require('fs');var path=require(_0x3335('0x6'));var rimraf=require(_0x3335('0x7'));var config=require(_0x3335('0x8'));var attributes=require(_0x3335('0x9'));module[_0x3335('0xa')]=function(_0xf25766,_0x33f0eb){return _0xf25766[_0x3335('0xb')](_0x3335('0xc'),attributes,{'tableName':_0x3335('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1544=['exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x146915,_0x32dda1){var _0x1a463a=function(_0x173c96){while(--_0x173c96){_0x146915['push'](_0x146915['shift']());}};_0x1a463a(++_0x32dda1);}(_0x1544,0x115));var _0x4154=function(_0x4f6610,_0x11d9ae){_0x4f6610=_0x4f6610-0x0;var _0x44e7d3=_0x1544[_0x4f6610];return _0x44e7d3;};'use strict';var _=require(_0x4154('0x0'));var util=require(_0x4154('0x1'));var logger=require(_0x4154('0x2'))(_0x4154('0x3'));var moment=require(_0x4154('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4154('0x5'));var rimraf=require(_0x4154('0x6'));var config=require(_0x4154('0x7'));var attributes=require(_0x4154('0x8'));module[_0x4154('0x9')]=function(_0x75049c,_0x37e3f2){return _0x75049c[_0x4154('0xa')](_0x4154('0xb'),attributes,{'tableName':_0x4154('0xc'),'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 d104a32..c45fe8a 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 _0x4670=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4670,0x12a));var _0x0467=function(_0x39ee42,_0x22930b){_0x39ee42=_0x39ee42-0x0;var _0x1b654a=_0x4670[_0x39ee42];return _0x1b654a;};'use strict';var _=require('lodash');var util=require(_0x0467('0x0'));var moment=require(_0x0467('0x1'));var BPromise=require(_0x0467('0x2'));var rs=require(_0x0467('0x3'));var fs=require('fs');var Redis=require(_0x0467('0x4'));var db=require(_0x0467('0x5'))['db'];var utils=require(_0x0467('0x6'));var logger=require(_0x0467('0x7'))(_0x0467('0x8'));var config=require(_0x0467('0x9'));var jayson=require(_0x0467('0xa'));var client=jayson[_0x0467('0xb')][_0x0467('0xc')]({'port':0x232a});config[_0x0467('0xd')]=_[_0x0467('0xe')](config['redis'],{'host':_0x0467('0xf'),'port':0x18eb});var socket=require(_0x0467('0x10'))(new Redis(config[_0x0467('0xd')]));require('./smsAccount.socket')[_0x0467('0x11')](socket);function respondWithRpcPromise(_0x2fcceb,_0x624f14,_0x4263c3){return new BPromise(function(_0x49e620,_0x1560e3){return client['request'](_0x2fcceb,_0x4263c3)[_0x0467('0x12')](function(_0x403b27){logger['info'](_0x0467('0x13'),_0x624f14,'request\x20sent');logger[_0x0467('0x14')](_0x0467('0x15'),_0x624f14,_0x0467('0x16'),JSON[_0x0467('0x17')](_0x403b27));if(_0x403b27[_0x0467('0x18')]){if(_0x403b27[_0x0467('0x18')][_0x0467('0x19')]===0x1f4){logger[_0x0467('0x18')](_0x0467('0x13'),_0x624f14,_0x403b27[_0x0467('0x18')][_0x0467('0x1a')]);return _0x1560e3(_0x403b27['error'][_0x0467('0x1a')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x624f14,_0x403b27['error'][_0x0467('0x1a')]);return _0x49e620(_0x403b27[_0x0467('0x18')]['message']);}else{logger['info'](_0x0467('0x13'),_0x624f14,_0x0467('0x16'));_0x49e620(_0x403b27[_0x0467('0x1b')]['message']);}})[_0x0467('0x1c')](function(_0x44cca2){logger[_0x0467('0x18')](_0x0467('0x13'),_0x624f14,_0x44cca2);_0x1560e3(_0x44cca2);});});}exports[_0x0467('0x1d')]=function(_0x3e2bc9){var _0x60004b=this;return new Promise(function(_0x36a5ce,_0x1f95fa){return db['SmsAccount'][_0x0467('0x1e')]({'raw':_0x3e2bc9[_0x0467('0x1f')]?_0x3e2bc9[_0x0467('0x1f')][_0x0467('0x20')]===undefined?!![]:![]:!![],'where':_0x3e2bc9['options']?_0x3e2bc9[_0x0467('0x1f')][_0x0467('0x21')]||null:null,'attributes':_0x3e2bc9[_0x0467('0x1f')]?_0x3e2bc9[_0x0467('0x1f')][_0x0467('0x22')]||null:null,'include':_0x3e2bc9[_0x0467('0x1f')]?_0x3e2bc9['options'][_0x0467('0x23')]?_[_0x0467('0x24')](_0x3e2bc9[_0x0467('0x1f')][_0x0467('0x23')],function(_0x4db5c8){return{'model':db[_0x4db5c8[_0x0467('0x25')]],'as':_0x4db5c8['as'],'attributes':_0x4db5c8['attributes'],'include':_0x4db5c8[_0x0467('0x23')]?_[_0x0467('0x24')](_0x4db5c8[_0x0467('0x23')],function(_0x2087d7){return{'model':db[_0x2087d7['model']],'as':_0x2087d7['as'],'attributes':_0x2087d7[_0x0467('0x22')],'include':_0x2087d7[_0x0467('0x23')]?_[_0x0467('0x24')](_0x2087d7[_0x0467('0x23')],function(_0x2d72a6){return{'model':db[_0x2d72a6[_0x0467('0x25')]],'as':_0x2d72a6['as'],'attributes':_0x2d72a6[_0x0467('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0467('0x12')](function(_0xbb6964){logger['info'](_0x0467('0x1d'),_0x3e2bc9);logger[_0x0467('0x14')](_0x0467('0x1d'),_0x3e2bc9,JSON[_0x0467('0x17')](_0xbb6964));_0x36a5ce(_0xbb6964);})[_0x0467('0x1c')](function(_0x13507d){logger[_0x0467('0x18')]('ShowSmsAccount',_0x13507d[_0x0467('0x1a')],_0x3e2bc9);_0x1f95fa(_0x60004b[_0x0467('0x18')](0x1f4,_0x13507d['message']));});});}; \ No newline at end of file +var _0x1219=['include','map','model','attributes','ShowSmsAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','register','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','info','SmsAccount','find','options','where'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x1219,0x137));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var util=require('util');var moment=require(_0x9121('0x1'));var BPromise=require(_0x9121('0x2'));var rs=require(_0x9121('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9121('0x4'))['db'];var utils=require(_0x9121('0x5'));var logger=require(_0x9121('0x6'))('rpc');var config=require(_0x9121('0x7'));var jayson=require(_0x9121('0x8'));var client=jayson['client'][_0x9121('0x9')]({'port':0x232a});config[_0x9121('0xa')]=_[_0x9121('0xb')](config[_0x9121('0xa')],{'host':_0x9121('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9121('0xa')]));require(_0x9121('0xd'))[_0x9121('0xe')](socket);function respondWithRpcPromise(_0x13ed43,_0x53b861,_0x37f4bf){return new BPromise(function(_0xaa0c1e,_0x58ad7b){return client['request'](_0x13ed43,_0x37f4bf)[_0x9121('0xf')](function(_0x1c7575){logger['info']('SmsAccount,\x20%s,\x20%s',_0x53b861,_0x9121('0x10'));logger[_0x9121('0x11')](_0x9121('0x12'),_0x53b861,_0x9121('0x10'),JSON[_0x9121('0x13')](_0x1c7575));if(_0x1c7575[_0x9121('0x14')]){if(_0x1c7575[_0x9121('0x14')][_0x9121('0x15')]===0x1f4){logger[_0x9121('0x14')]('SmsAccount,\x20%s,\x20%s',_0x53b861,_0x1c7575[_0x9121('0x14')][_0x9121('0x16')]);return _0x58ad7b(_0x1c7575[_0x9121('0x14')][_0x9121('0x16')]);}logger['error'](_0x9121('0x17'),_0x53b861,_0x1c7575['error'][_0x9121('0x16')]);return _0xaa0c1e(_0x1c7575['error'][_0x9121('0x16')]);}else{logger[_0x9121('0x18')](_0x9121('0x17'),_0x53b861,_0x9121('0x10'));_0xaa0c1e(_0x1c7575['result'][_0x9121('0x16')]);}})['catch'](function(_0x3b393a){logger[_0x9121('0x14')](_0x9121('0x17'),_0x53b861,_0x3b393a);_0x58ad7b(_0x3b393a);});});}exports['ShowSmsAccount']=function(_0x4a24aa){var _0x1d1753=this;return new Promise(function(_0x416b12,_0x4fa367){return db[_0x9121('0x19')][_0x9121('0x1a')]({'raw':_0x4a24aa['options']?_0x4a24aa['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a24aa[_0x9121('0x1b')]?_0x4a24aa[_0x9121('0x1b')][_0x9121('0x1c')]||null:null,'attributes':_0x4a24aa[_0x9121('0x1b')]?_0x4a24aa[_0x9121('0x1b')]['attributes']||null:null,'include':_0x4a24aa[_0x9121('0x1b')]?_0x4a24aa[_0x9121('0x1b')][_0x9121('0x1d')]?_[_0x9121('0x1e')](_0x4a24aa[_0x9121('0x1b')][_0x9121('0x1d')],function(_0x42b673){return{'model':db[_0x42b673[_0x9121('0x1f')]],'as':_0x42b673['as'],'attributes':_0x42b673['attributes'],'include':_0x42b673[_0x9121('0x1d')]?_[_0x9121('0x1e')](_0x42b673[_0x9121('0x1d')],function(_0x3d2264){return{'model':db[_0x3d2264['model']],'as':_0x3d2264['as'],'attributes':_0x3d2264[_0x9121('0x20')],'include':_0x3d2264[_0x9121('0x1d')]?_['map'](_0x3d2264[_0x9121('0x1d')],function(_0x12eb49){return{'model':db[_0x12eb49['model']],'as':_0x12eb49['as'],'attributes':_0x12eb49[_0x9121('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x571b10){logger['info']('ShowSmsAccount',_0x4a24aa);logger[_0x9121('0x11')](_0x9121('0x21'),_0x4a24aa,JSON[_0x9121('0x13')](_0x571b10));_0x416b12(_0x571b10);})['catch'](function(_0x484df4){logger[_0x9121('0x14')]('ShowSmsAccount',_0x484df4[_0x9121('0x16')],_0x4a24aa);_0x4fa367(_0x1d1753[_0x9121('0x14')](0x1f4,_0x484df4[_0x9121('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c265ce2..b1d07f4 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 590ff0f..e26fffb 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x28f0b6,_0x290a14){var _0x44156e=function(_0x4e57de){while(--_0x4e57de){_0x28f0b6['push'](_0x28f0b6['shift']());}};_0x44156e(++_0x290a14);}(_0x3e74,0x175));var _0x43e7=function(_0x17f2bc,_0x3b5027){_0x17f2bc=_0x17f2bc-0x0;var _0x32742b=_0x3e74[_0x17f2bc];return _0x32742b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3db005,_0x3c0c4f){var _0x2738ad=function(_0x43c5c7){while(--_0x43c5c7){_0x3db005['push'](_0x3db005['shift']());}};_0x2738ad(++_0x3c0c4f);}(_0xedd9,0xfc));var _0x9edd=function(_0x10715d,_0x17ebdb){_0x10715d=_0x10715d-0x0;var _0x51b210=_0xedd9[_0x10715d];return _0x51b210;};'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('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3fb6710..23791a9 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 _0xb75f=['INTEGER','STRING','noop','exports'];(function(_0x2b5ddd,_0x544039){var _0x4a7950=function(_0x7325be){while(--_0x7325be){_0x2b5ddd['push'](_0x2b5ddd['shift']());}};_0x4a7950(++_0x544039);}(_0xb75f,0x93));var _0xfb75=function(_0x24e71b,_0x2f73f5){_0x24e71b=_0x24e71b-0x0;var _0x303be8=_0xb75f[_0x24e71b];return _0x303be8;};'use strict';var Sequelize=require('sequelize');module[_0xfb75('0x0')]={'priority':{'type':Sequelize[_0xfb75('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfb75('0x2')],'allowNull':![],'defaultValue':_0xfb75('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfb75('0x2')]},'interval':{'type':Sequelize[_0xfb75('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x16af=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x16af,0xca));var _0xf16a=function(_0x541a68,_0x3fdb9){_0x541a68=_0x541a68-0x0;var _0x38dc56=_0x16af[_0x541a68];return _0x38dc56;};'use strict';var Sequelize=require(_0xf16a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf16a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf16a('0x2')],'allowNull':![],'defaultValue':_0xf16a('0x3')},'appdata':{'type':Sequelize[_0xf16a('0x4')]()},'description':{'type':Sequelize[_0xf16a('0x2')]},'interval':{'type':Sequelize[_0xf16a('0x2')],'defaultValue':_0xf16a('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8cda4ba..aed19bf 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 _0x6739=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then','destroy','error','stack','name','SmsApplication','rawAttributes','fieldName'];(function(_0xbb12fb,_0x4929b6){var _0x47b600=function(_0x548b0f){while(--_0x548b0f){_0xbb12fb['push'](_0xbb12fb['shift']());}};_0x47b600(++_0x4929b6);}(_0x6739,0x18f));var _0x9673=function(_0x3eaa91,_0x4ff36d){_0x3eaa91=_0x3eaa91-0x0;var _0x43ddbb=_0x6739[_0x3eaa91];return _0x43ddbb;};'use strict';var emlformat=require(_0x9673('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9673('0x1'));var jsonpatch=require(_0x9673('0x2'));var rp=require(_0x9673('0x3'));var moment=require(_0x9673('0x4'));var BPromise=require(_0x9673('0x5'));var Mustache=require(_0x9673('0x6'));var util=require(_0x9673('0x7'));var path=require(_0x9673('0x8'));var sox=require(_0x9673('0x9'));var csv=require(_0x9673('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9673('0xb'));var _=require(_0x9673('0xc'));var squel=require(_0x9673('0xd'));var crypto=require(_0x9673('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9673('0xf'));var toCsv=require(_0x9673('0xa'));var querystring=require(_0x9673('0x10'));var Papa=require(_0x9673('0x11'));var Redis=require('ioredis');var authService=require(_0x9673('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9673('0x13'));var logger=require(_0x9673('0x14'))(_0x9673('0x15'));var utils=require(_0x9673('0x16'));var config=require(_0x9673('0x17'));var licenseUtil=require(_0x9673('0x18'));var db=require(_0x9673('0x19'))['db'];function respondWithStatusCode(_0xa110dc,_0x432953){_0x432953=_0x432953||0xcc;return function(_0x1fad80){if(_0x1fad80){return _0xa110dc[_0x9673('0x1a')](_0x432953);}return _0xa110dc[_0x9673('0x1b')](_0x432953)[_0x9673('0x1c')]();};}function respondWithResult(_0x5465b8,_0x396f0f){_0x396f0f=_0x396f0f||0xc8;return function(_0x1b487e){if(_0x1b487e){return _0x5465b8[_0x9673('0x1b')](_0x396f0f)['json'](_0x1b487e);}};}function respondWithFilteredResult(_0x308a64,_0x24a4b8){return function(_0x423df5){if(_0x423df5){var _0x3b24f6=typeof _0x24a4b8[_0x9673('0x1d')]===_0x9673('0x1e')&&typeof _0x24a4b8[_0x9673('0x1f')]===_0x9673('0x1e');var _0x7cb89=_0x423df5[_0x9673('0x20')];var _0xe1a2fe=_0x3b24f6?0x0:_0x24a4b8[_0x9673('0x1d')];var _0x488575=_0x3b24f6?_0x423df5[_0x9673('0x20')]:_0x24a4b8['offset']+_0x24a4b8[_0x9673('0x1f')];var _0x1af76b;if(_0x488575>=_0x7cb89){_0x488575=_0x7cb89;_0x1af76b=0xc8;}else{_0x1af76b=0xce;}_0x308a64[_0x9673('0x1b')](_0x1af76b);return _0x308a64['set'](_0x9673('0x21'),_0xe1a2fe+'-'+_0x488575+'/'+_0x7cb89)[_0x9673('0x22')](_0x423df5);}return null;};}function patchUpdates(_0x1b6b7c){return function(_0x264b83){try{jsonpatch[_0x9673('0x23')](_0x264b83,_0x1b6b7c,!![]);}catch(_0x3d2c2b){return BPromise['reject'](_0x3d2c2b);}return _0x264b83[_0x9673('0x24')]();};}function saveUpdates(_0x3fb24f,_0x271936){return function(_0xb74a71){if(_0xb74a71){return _0xb74a71['update'](_0x3fb24f)[_0x9673('0x25')](function(_0xca8f34){return _0xca8f34;});}return null;};}function removeEntity(_0x211773,_0x35017f){return function(_0x11efd0){if(_0x11efd0){return _0x11efd0[_0x9673('0x26')]()[_0x9673('0x25')](function(){_0x211773[_0x9673('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x83922,_0x26dd77){return function(_0x4f3d55){if(!_0x4f3d55){_0x83922[_0x9673('0x1a')](0x194);}return _0x4f3d55;};}function handleError(_0x115791,_0x30d447){_0x30d447=_0x30d447||0x1f4;return function(_0x2eb8e3){logger[_0x9673('0x27')](_0x2eb8e3[_0x9673('0x28')]);if(_0x2eb8e3[_0x9673('0x29')]){delete _0x2eb8e3[_0x9673('0x29')];}_0x115791[_0x9673('0x1b')](_0x30d447)['send'](_0x2eb8e3);};}exports['index']=function(_0x51ae05,_0x451994){var _0x46a999={},_0x320537={},_0x36f450={'count':0x0,'rows':[]};var _0x1144fb=_['map'](db[_0x9673('0x2a')][_0x9673('0x2b')],function(_0x1af925){return{'name':_0x1af925[_0x9673('0x2c')],'type':_0x1af925[_0x9673('0x2d')][_0x9673('0x2e')]};});_0x320537[_0x9673('0x2f')]=_[_0x9673('0x30')](_0x1144fb,_0x9673('0x29'));_0x320537[_0x9673('0x31')]=_[_0x9673('0x32')](_0x51ae05[_0x9673('0x31')]);_0x320537[_0x9673('0x33')]=_[_0x9673('0x34')](_0x320537['model'],_0x320537[_0x9673('0x31')]);_0x46a999[_0x9673('0x35')]=_[_0x9673('0x34')](_0x320537[_0x9673('0x2f')],qs[_0x9673('0x36')](_0x51ae05[_0x9673('0x31')][_0x9673('0x36')]));_0x46a999[_0x9673('0x35')]=_0x46a999['attributes'][_0x9673('0x37')]?_0x46a999['attributes']:_0x320537[_0x9673('0x2f')];if(!_0x51ae05[_0x9673('0x31')][_0x9673('0x38')](_0x9673('0x39'))){_0x46a999[_0x9673('0x1f')]=qs['limit'](_0x51ae05['query']['limit']);_0x46a999[_0x9673('0x1d')]=qs[_0x9673('0x1d')](_0x51ae05[_0x9673('0x31')][_0x9673('0x1d')]);}_0x46a999[_0x9673('0x3a')]=qs['sort'](_0x51ae05['query'][_0x9673('0x3b')]);_0x46a999[_0x9673('0x3c')]=qs[_0x9673('0x33')](_[_0x9673('0x3d')](_0x51ae05[_0x9673('0x31')],_0x320537[_0x9673('0x33')]),_0x1144fb);if(_0x51ae05[_0x9673('0x31')]['filter']){_0x46a999[_0x9673('0x3c')]=_['merge'](_0x46a999[_0x9673('0x3c')],{'$or':_['map'](_0x1144fb,function(_0x589607){if(_0x589607[_0x9673('0x2d')]!==_0x9673('0x3e')){var _0x329119={};_0x329119[_0x589607[_0x9673('0x29')]]={'$like':'%'+_0x51ae05[_0x9673('0x31')][_0x9673('0x3f')]+'%'};return _0x329119;}})});}_0x46a999=_[_0x9673('0x40')]({},_0x46a999,_0x51ae05[_0x9673('0x41')]);var _0x5691a8={'where':_0x46a999[_0x9673('0x3c')]};return db['SmsApplication']['count'](_0x5691a8)[_0x9673('0x25')](function(_0x240d3c){_0x36f450['count']=_0x240d3c;if(_0x51ae05[_0x9673('0x31')][_0x9673('0x42')]){_0x46a999['include']=[{'all':!![]}];}return db[_0x9673('0x2a')][_0x9673('0x43')](_0x46a999);})[_0x9673('0x25')](function(_0x1155ad){_0x36f450[_0x9673('0x44')]=_0x1155ad;return _0x36f450;})[_0x9673('0x25')](respondWithFilteredResult(_0x451994,_0x46a999))[_0x9673('0x45')](handleError(_0x451994,null));};exports[_0x9673('0x46')]=function(_0x19a882,_0x116208){var _0xf7ef8f={'raw':!![],'where':{'id':_0x19a882['params']['id']}},_0x331f5b={};_0x331f5b[_0x9673('0x2f')]=_[_0x9673('0x32')](db['SmsApplication']['rawAttributes']);_0x331f5b['query']=_[_0x9673('0x32')](_0x19a882['query']);_0x331f5b[_0x9673('0x33')]=_[_0x9673('0x34')](_0x331f5b[_0x9673('0x2f')],_0x331f5b[_0x9673('0x31')]);_0xf7ef8f[_0x9673('0x35')]=_[_0x9673('0x34')](_0x331f5b['model'],qs[_0x9673('0x36')](_0x19a882[_0x9673('0x31')][_0x9673('0x36')]));_0xf7ef8f[_0x9673('0x35')]=_0xf7ef8f[_0x9673('0x35')][_0x9673('0x37')]?_0xf7ef8f[_0x9673('0x35')]:_0x331f5b[_0x9673('0x2f')];if(_0x19a882[_0x9673('0x31')]['includeAll']){_0xf7ef8f[_0x9673('0x47')]=[{'all':!![]}];}_0xf7ef8f=_['merge']({},_0xf7ef8f,_0x19a882[_0x9673('0x41')]);return db['SmsApplication'][_0x9673('0x48')](_0xf7ef8f)[_0x9673('0x25')](handleEntityNotFound(_0x116208,null))['then'](respondWithResult(_0x116208,null))['catch'](handleError(_0x116208,null));};exports['create']=function(_0x63db9d,_0x44d700){return db['SmsApplication']['create'](_0x63db9d['body'],{})[_0x9673('0x25')](respondWithResult(_0x44d700,0xc9))[_0x9673('0x45')](handleError(_0x44d700,null));};exports['update']=function(_0x3f2e43,_0x2c5a93){if(_0x3f2e43['body']['id']){delete _0x3f2e43[_0x9673('0x49')]['id'];}return db['SmsApplication'][_0x9673('0x48')]({'where':{'id':_0x3f2e43['params']['id']}})[_0x9673('0x25')](handleEntityNotFound(_0x2c5a93,null))['then'](saveUpdates(_0x3f2e43['body'],null))['then'](respondWithResult(_0x2c5a93,null))[_0x9673('0x45')](handleError(_0x2c5a93,null));};exports[_0x9673('0x26')]=function(_0x1ab45e,_0x23c4ca){return db[_0x9673('0x2a')]['find']({'where':{'id':_0x1ab45e['params']['id']}})[_0x9673('0x25')](handleEntityNotFound(_0x23c4ca,null))[_0x9673('0x25')](removeEntity(_0x23c4ca,null))[_0x9673('0x45')](handleError(_0x23c4ca,null));}; \ No newline at end of file +var _0x835a=['name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','show','params','catch','create','body','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x835a,0x156));var _0xa835=function(_0x589163,_0x20abf4){_0x589163=_0x589163-0x0;var _0x463fd3=_0x835a[_0x589163];return _0x463fd3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa835('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa835('0x1'));var rp=require(_0xa835('0x2'));var moment=require('moment');var BPromise=require(_0xa835('0x3'));var Mustache=require(_0xa835('0x4'));var util=require(_0xa835('0x5'));var path=require(_0xa835('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa835('0x7'));var _=require(_0xa835('0x8'));var squel=require(_0xa835('0x9'));var crypto=require(_0xa835('0xa'));var jsforce=require(_0xa835('0xb'));var deskjs=require(_0xa835('0xc'));var toCsv=require(_0xa835('0xd'));var querystring=require(_0xa835('0xe'));var Papa=require('papaparse');var Redis=require(_0xa835('0xf'));var authService=require(_0xa835('0x10'));var qs=require(_0xa835('0x11'));var as=require(_0xa835('0x12'));var hardwareService=require(_0xa835('0x13'));var logger=require(_0xa835('0x14'))(_0xa835('0x15'));var utils=require(_0xa835('0x16'));var config=require(_0xa835('0x17'));var licenseUtil=require(_0xa835('0x18'));var db=require(_0xa835('0x19'))['db'];function respondWithStatusCode(_0xb86b5a,_0x501256){_0x501256=_0x501256||0xcc;return function(_0x16a9fe){if(_0x16a9fe){return _0xb86b5a['sendStatus'](_0x501256);}return _0xb86b5a[_0xa835('0x1a')](_0x501256)[_0xa835('0x1b')]();};}function respondWithResult(_0x252cea,_0x5dbcd4){_0x5dbcd4=_0x5dbcd4||0xc8;return function(_0x59edc5){if(_0x59edc5){return _0x252cea[_0xa835('0x1a')](_0x5dbcd4)[_0xa835('0x1c')](_0x59edc5);}};}function respondWithFilteredResult(_0x1e9414,_0x111bd5){return function(_0x354134){if(_0x354134){var _0x1659ed=typeof _0x111bd5[_0xa835('0x1d')]==='undefined'&&typeof _0x111bd5[_0xa835('0x1e')]===_0xa835('0x1f');var _0x3e249d=_0x354134[_0xa835('0x20')];var _0x3236d5=_0x1659ed?0x0:_0x111bd5[_0xa835('0x1d')];var _0x1e9bd2=_0x1659ed?_0x354134[_0xa835('0x20')]:_0x111bd5[_0xa835('0x1d')]+_0x111bd5[_0xa835('0x1e')];var _0x19e28b;if(_0x1e9bd2>=_0x3e249d){_0x1e9bd2=_0x3e249d;_0x19e28b=0xc8;}else{_0x19e28b=0xce;}_0x1e9414[_0xa835('0x1a')](_0x19e28b);return _0x1e9414['set'](_0xa835('0x21'),_0x3236d5+'-'+_0x1e9bd2+'/'+_0x3e249d)[_0xa835('0x1c')](_0x354134);}return null;};}function patchUpdates(_0x383d37){return function(_0x1ef12f){try{jsonpatch[_0xa835('0x22')](_0x1ef12f,_0x383d37,!![]);}catch(_0x206d3f){return BPromise[_0xa835('0x23')](_0x206d3f);}return _0x1ef12f[_0xa835('0x24')]();};}function saveUpdates(_0x4f3f23,_0x55ede5){return function(_0x374221){if(_0x374221){return _0x374221[_0xa835('0x25')](_0x4f3f23)[_0xa835('0x26')](function(_0x2de323){return _0x2de323;});}return null;};}function removeEntity(_0x3a5570,_0x1a6f4e){return function(_0x330250){if(_0x330250){return _0x330250[_0xa835('0x27')]()[_0xa835('0x26')](function(){_0x3a5570[_0xa835('0x1a')](0xcc)[_0xa835('0x1b')]();});}};}function handleEntityNotFound(_0x41b934,_0x4ab755){return function(_0x1b5733){if(!_0x1b5733){_0x41b934[_0xa835('0x28')](0x194);}return _0x1b5733;};}function handleError(_0xb36269,_0x39bf9f){_0x39bf9f=_0x39bf9f||0x1f4;return function(_0x4e6eae){logger[_0xa835('0x29')](_0x4e6eae[_0xa835('0x2a')]);if(_0x4e6eae[_0xa835('0x2b')]){delete _0x4e6eae[_0xa835('0x2b')];}_0xb36269[_0xa835('0x1a')](_0x39bf9f)[_0xa835('0x2c')](_0x4e6eae);};}exports[_0xa835('0x2d')]=function(_0x508c8f,_0xb6a5e3){var _0x4b2977={},_0x285166={},_0x5d74e8={'count':0x0,'rows':[]};var _0x14a3bb=_[_0xa835('0x2e')](db['SmsApplication'][_0xa835('0x2f')],function(_0x46d61f){return{'name':_0x46d61f[_0xa835('0x30')],'type':_0x46d61f[_0xa835('0x31')]['key']};});_0x285166[_0xa835('0x32')]=_[_0xa835('0x2e')](_0x14a3bb,_0xa835('0x2b'));_0x285166[_0xa835('0x33')]=_[_0xa835('0x34')](_0x508c8f['query']);_0x285166['filters']=_[_0xa835('0x35')](_0x285166['model'],_0x285166[_0xa835('0x33')]);_0x4b2977['attributes']=_[_0xa835('0x35')](_0x285166['model'],qs[_0xa835('0x36')](_0x508c8f[_0xa835('0x33')][_0xa835('0x36')]));_0x4b2977[_0xa835('0x37')]=_0x4b2977['attributes'][_0xa835('0x38')]?_0x4b2977[_0xa835('0x37')]:_0x285166[_0xa835('0x32')];if(!_0x508c8f[_0xa835('0x33')][_0xa835('0x39')](_0xa835('0x3a'))){_0x4b2977[_0xa835('0x1e')]=qs['limit'](_0x508c8f[_0xa835('0x33')][_0xa835('0x1e')]);_0x4b2977['offset']=qs[_0xa835('0x1d')](_0x508c8f['query']['offset']);}_0x4b2977['order']=qs['sort'](_0x508c8f[_0xa835('0x33')][_0xa835('0x3b')]);_0x4b2977[_0xa835('0x3c')]=qs[_0xa835('0x3d')](_[_0xa835('0x3e')](_0x508c8f[_0xa835('0x33')],_0x285166[_0xa835('0x3d')]),_0x14a3bb);if(_0x508c8f[_0xa835('0x33')][_0xa835('0x3f')]){_0x4b2977['where']=_['merge'](_0x4b2977['where'],{'$or':_[_0xa835('0x2e')](_0x14a3bb,function(_0x420e31){if(_0x420e31[_0xa835('0x31')]!==_0xa835('0x40')){var _0x45dbd8={};_0x45dbd8[_0x420e31['name']]={'$like':'%'+_0x508c8f[_0xa835('0x33')]['filter']+'%'};return _0x45dbd8;}})});}_0x4b2977=_['merge']({},_0x4b2977,_0x508c8f[_0xa835('0x41')]);var _0x45f6cb={'where':_0x4b2977['where']};return db[_0xa835('0x42')][_0xa835('0x20')](_0x45f6cb)[_0xa835('0x26')](function(_0x1fbf3b){_0x5d74e8[_0xa835('0x20')]=_0x1fbf3b;if(_0x508c8f['query'][_0xa835('0x43')]){_0x4b2977[_0xa835('0x44')]=[{'all':!![]}];}return db['SmsApplication'][_0xa835('0x45')](_0x4b2977);})[_0xa835('0x26')](function(_0x4144b3){_0x5d74e8[_0xa835('0x46')]=_0x4144b3;return _0x5d74e8;})[_0xa835('0x26')](respondWithFilteredResult(_0xb6a5e3,_0x4b2977))['catch'](handleError(_0xb6a5e3,null));};exports[_0xa835('0x47')]=function(_0x115cde,_0x2f707c){var _0xc3dbdc={'raw':!![],'where':{'id':_0x115cde[_0xa835('0x48')]['id']}},_0x146b18={};_0x146b18['model']=_[_0xa835('0x34')](db['SmsApplication'][_0xa835('0x2f')]);_0x146b18[_0xa835('0x33')]=_[_0xa835('0x34')](_0x115cde[_0xa835('0x33')]);_0x146b18[_0xa835('0x3d')]=_[_0xa835('0x35')](_0x146b18[_0xa835('0x32')],_0x146b18['query']);_0xc3dbdc['attributes']=_[_0xa835('0x35')](_0x146b18[_0xa835('0x32')],qs[_0xa835('0x36')](_0x115cde[_0xa835('0x33')]['fields']));_0xc3dbdc[_0xa835('0x37')]=_0xc3dbdc[_0xa835('0x37')]['length']?_0xc3dbdc['attributes']:_0x146b18[_0xa835('0x32')];if(_0x115cde['query'][_0xa835('0x43')]){_0xc3dbdc[_0xa835('0x44')]=[{'all':!![]}];}_0xc3dbdc=_['merge']({},_0xc3dbdc,_0x115cde['options']);return db['SmsApplication']['find'](_0xc3dbdc)['then'](handleEntityNotFound(_0x2f707c,null))[_0xa835('0x26')](respondWithResult(_0x2f707c,null))[_0xa835('0x49')](handleError(_0x2f707c,null));};exports[_0xa835('0x4a')]=function(_0x283110,_0x5cb15a){return db[_0xa835('0x42')][_0xa835('0x4a')](_0x283110['body'],{})[_0xa835('0x26')](respondWithResult(_0x5cb15a,0xc9))[_0xa835('0x49')](handleError(_0x5cb15a,null));};exports[_0xa835('0x25')]=function(_0x13d8dc,_0x43c12e){if(_0x13d8dc['body']['id']){delete _0x13d8dc[_0xa835('0x4b')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x13d8dc['params']['id']}})[_0xa835('0x26')](handleEntityNotFound(_0x43c12e,null))[_0xa835('0x26')](saveUpdates(_0x13d8dc[_0xa835('0x4b')],null))[_0xa835('0x26')](respondWithResult(_0x43c12e,null))[_0xa835('0x49')](handleError(_0x43c12e,null));};exports[_0xa835('0x27')]=function(_0xec2114,_0x3b66b8){return db[_0xa835('0x42')][_0xa835('0x4c')]({'where':{'id':_0xec2114['params']['id']}})[_0xa835('0x26')](handleEntityNotFound(_0x3b66b8,null))[_0xa835('0x26')](removeEntity(_0x3b66b8,null))[_0xa835('0x49')](handleError(_0x3b66b8,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a7cc717..b74f0e7 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 _0xb25b=['SmsApplication','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x8d475f,_0x2e4053){var _0x409fde=function(_0x3d75a5){while(--_0x3d75a5){_0x8d475f['push'](_0x8d475f['shift']());}};_0x409fde(++_0x2e4053);}(_0xb25b,0x83));var _0xbb25=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb25b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb25('0x0'));var util=require(_0xbb25('0x1'));var logger=require(_0xbb25('0x2'))('api');var moment=require(_0xbb25('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb25('0x4'));var fs=require('fs');var path=require(_0xbb25('0x5'));var rimraf=require('rimraf');var config=require(_0xbb25('0x6'));var attributes=require('./smsApplication.attributes');module[_0xbb25('0x7')]=function(_0x5aa3dc,_0x5717cc){return _0x5aa3dc[_0xbb25('0x8')](_0xbb25('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb56a=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xb56a,0xab));var _0xab56=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xb56a[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0xab56('0x0'));var logger=require(_0xab56('0x1'))(_0xab56('0x2'));var moment=require(_0xab56('0x3'));var BPromise=require(_0xab56('0x4'));var rp=require(_0xab56('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab56('0x6'));var config=require(_0xab56('0x7'));var attributes=require(_0xab56('0x8'));module['exports']=function(_0x2c4a9e,_0x25b929){return _0x2c4a9e['define'](_0xab56('0x9'),attributes,{'tableName':_0xab56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab56('0xb'),'collate':_0xab56('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index cea3a2e..c02cf53 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 _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SmsApplication,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb03e,0x1eb));var _0xeb03=function(_0x22aa8a,_0x398d06){_0x22aa8a=_0x22aa8a-0x0;var _0x20c8cc=_0xb03e[_0x22aa8a];return _0x20c8cc;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('SmsApplication,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});} \ No newline at end of file +var _0x4d5a=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x1a367e,_0x3f1d49){var _0x2be23d=function(_0x5bf4d2){while(--_0x5bf4d2){_0x1a367e['push'](_0x1a367e['shift']());}};_0x2be23d(++_0x3f1d49);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d5a[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xa4d5('0x0'));var moment=require(_0xa4d5('0x1'));var BPromise=require(_0xa4d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d5('0x3'));var db=require(_0xa4d5('0x4'))['db'];var utils=require(_0xa4d5('0x5'));var logger=require(_0xa4d5('0x6'))('rpc');var config=require(_0xa4d5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa4d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1856aa,_0x166db3,_0x318315){return new BPromise(function(_0x408db0,_0x3bed6b){return client[_0xa4d5('0x9')](_0x1856aa,_0x318315)['then'](function(_0x5586de){logger[_0xa4d5('0xa')](_0xa4d5('0xb'),_0x166db3,_0xa4d5('0xc'));logger[_0xa4d5('0xd')](_0xa4d5('0xe'),_0x166db3,_0xa4d5('0xc'),JSON[_0xa4d5('0xf')](_0x5586de));if(_0x5586de[_0xa4d5('0x10')]){if(_0x5586de['error']['code']===0x1f4){logger[_0xa4d5('0x10')](_0xa4d5('0xb'),_0x166db3,_0x5586de[_0xa4d5('0x10')][_0xa4d5('0x11')]);return _0x3bed6b(_0x5586de['error']['message']);}logger[_0xa4d5('0x10')](_0xa4d5('0xb'),_0x166db3,_0x5586de[_0xa4d5('0x10')][_0xa4d5('0x11')]);return _0x408db0(_0x5586de[_0xa4d5('0x10')][_0xa4d5('0x11')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x166db3,_0xa4d5('0xc'));_0x408db0(_0x5586de[_0xa4d5('0x12')]['message']);}})[_0xa4d5('0x13')](function(_0x31eed7){logger[_0xa4d5('0x10')](_0xa4d5('0xb'),_0x166db3,_0x31eed7);_0x3bed6b(_0x31eed7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index e9642c4..6610c6f 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 _0x34b7=['/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','delete','destroy'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x34b7,0x196));var _0x734b=function(_0x4c5e74,_0x319d00){_0x4c5e74=_0x4c5e74-0x0;var _0x48b7f6=_0x34b7[_0x4c5e74];return _0x48b7f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x734b('0x7')]('/:id/messages',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0x7')](_0x734b('0xd'),auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xf')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0xf')](_0x734b('0x11'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0xf')]('/:id/tags',auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x15')),controller[_0x734b('0x16')]);router[_0x734b('0x17')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x19')),controller['update']);router[_0x734b('0x1a')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')]('sms','smsinteraction:destroy'),controller[_0x734b('0x1b')]);router[_0x734b('0x1a')](_0x734b('0x1c'),auth[_0x734b('0x8')](),controller[_0x734b('0x1d')]);module[_0x734b('0x1e')]=router; \ No newline at end of file +var _0xac4a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','get','describe','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x265519,_0x520522){var _0x25c349=function(_0x3918f1){while(--_0x3918f1){_0x265519['push'](_0x265519['shift']());}};_0x25c349(++_0x520522);}(_0xac4a,0x13f));var _0xaac4=function(_0x2f66ff,_0x24197e){_0x2f66ff=_0x2f66ff-0x0;var _0x1c6359=_0xac4a[_0x2f66ff];return _0x1c6359;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x15')),controller[_0xaac4('0x16')]);router[_0xaac4('0x17')](_0xaac4('0x18'),auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x19')),controller[_0xaac4('0x1a')]);router[_0xaac4('0x1b')]('/:id',auth[_0xaac4('0x9')](),interaction['tracked'](_0xaac4('0x14'),'smsinteraction:destroy'),controller[_0xaac4('0x1c')]);router[_0xaac4('0x1b')](_0xaac4('0x1d'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x1e')]);module[_0xaac4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 127ab9b..9a5d4a8 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 _0x46cb=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x402d7e,_0x58f34a){var _0x85584d=function(_0x124447){while(--_0x124447){_0x402d7e['push'](_0x402d7e['shift']());}};_0x85584d(++_0x58f34a);}(_0x46cb,0xd6));var _0xb46c=function(_0x4caade,_0x549ce1){_0x4caade=_0x4caade-0x0;var _0x2041ff=_0x46cb[_0x4caade];return _0x2041ff;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xb46c('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb46c('0x1')]},'disposition':{'type':Sequelize[_0xb46c('0x2')]},'secondDisposition':{'type':Sequelize[_0xb46c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb46c('0x2')]},'note':{'type':Sequelize[_0xb46c('0x2')]},'phone':{'type':Sequelize[_0xb46c('0x2')]},'read1stAt':{'type':Sequelize[_0xb46c('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xb46c('0x3')]('in',_0xb46c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb46c('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xb46c('0x3')]('in',_0xb46c('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb46c('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0xb079=['ENUM','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x2ca249,_0x5cb677){var _0x526cda=function(_0x10d8cf){while(--_0x10d8cf){_0x2ca249['push'](_0x2ca249['shift']());}};_0x526cda(++_0x5cb677);}(_0xb079,0x1c9));var _0x9b07=function(_0x4e730e,_0x4c367a){_0x4e730e=_0x4e730e-0x0;var _0x28c3af=_0xb079[_0x4e730e];return _0x28c3af;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9b07('0x0'));module[_0x9b07('0x1')]={'closed':{'type':Sequelize[_0x9b07('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9b07('0x3')]},'disposition':{'type':Sequelize[_0x9b07('0x4')]},'secondDisposition':{'type':Sequelize[_0x9b07('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9b07('0x4')]},'note':{'type':Sequelize[_0x9b07('0x4')]},'phone':{'type':Sequelize[_0x9b07('0x4')]},'read1stAt':{'type':Sequelize[_0x9b07('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9b07('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9b07('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9b07('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9b07('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ea0bb65..0af78cb 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 _0x1b95=['format','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','firstName','lastName','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','direction','out','System','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','map','TagIds','Tags','split','forEach','push','waiting','talking','answered','unmanaged','total','UserId','closed','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','from','tools_tags','u.fullname','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','some','compact','isEmpty','SmsAccountId','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','catch','show','params','keys','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','findOne'];(function(_0x34bf1d,_0x4f87f9){var _0x2a56a3=function(_0x49640e){while(--_0x49640e){_0x34bf1d['push'](_0x34bf1d['shift']());}};_0x2a56a3(++_0x4f87f9);}(_0x1b95,0x115));var _0x51b9=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x1b95[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0x51b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x51b9('0x1'));var BPromise=require(_0x51b9('0x2'));var Mustache=require(_0x51b9('0x3'));var util=require(_0x51b9('0x4'));var path=require(_0x51b9('0x5'));var sox=require(_0x51b9('0x6'));var csv=require('to-csv');var ejs=require(_0x51b9('0x7'));var fs=require('fs');var fs_extra=require(_0x51b9('0x8'));var _=require(_0x51b9('0x9'));var squel=require(_0x51b9('0xa'));var crypto=require(_0x51b9('0xb'));var jsforce=require(_0x51b9('0xc'));var deskjs=require(_0x51b9('0xd'));var toCsv=require(_0x51b9('0xe'));var querystring=require(_0x51b9('0xf'));var Papa=require(_0x51b9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51b9('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x51b9('0x12'));var hardwareService=require(_0x51b9('0x13'));var logger=require(_0x51b9('0x14'))(_0x51b9('0x15'));var utils=require(_0x51b9('0x16'));var config=require(_0x51b9('0x17'));var licenseUtil=require(_0x51b9('0x18'));var db=require(_0x51b9('0x19'))['db'];config[_0x51b9('0x1a')]=_['defaults'](config[_0x51b9('0x1a')],{'host':_0x51b9('0x1b'),'port':0x18eb});var socket=require(_0x51b9('0x1c'))(new Redis(config[_0x51b9('0x1a')]));require(_0x51b9('0x1d'))[_0x51b9('0x1e')](socket);function respondWithStatusCode(_0x26f0aa,_0x118faa){_0x118faa=_0x118faa||0xcc;return function(_0xa2ef46){if(_0xa2ef46){return _0x26f0aa[_0x51b9('0x1f')](_0x118faa);}return _0x26f0aa['status'](_0x118faa)['end']();};}function respondWithResult(_0x3fd964,_0x56d968){_0x56d968=_0x56d968||0xc8;return function(_0x115aac){if(_0x115aac){return _0x3fd964['status'](_0x56d968)[_0x51b9('0x20')](_0x115aac);}};}function respondWithFilteredResult(_0x39d666,_0x3fc5e4){return function(_0x3feeac){if(_0x3feeac){var _0x3db862=typeof _0x3fc5e4[_0x51b9('0x21')]==='undefined'&&typeof _0x3fc5e4[_0x51b9('0x22')]===_0x51b9('0x23');var _0x4d512e=_0x3feeac[_0x51b9('0x24')];var _0x236902=_0x3db862?0x0:_0x3fc5e4[_0x51b9('0x21')];var _0x31584e=_0x3db862?_0x3feeac[_0x51b9('0x24')]:_0x3fc5e4[_0x51b9('0x21')]+_0x3fc5e4['limit'];var _0x3b7018;if(_0x31584e>=_0x4d512e){_0x31584e=_0x4d512e;_0x3b7018=0xc8;}else{_0x3b7018=0xce;}_0x39d666[_0x51b9('0x25')](_0x3b7018);return _0x39d666[_0x51b9('0x26')](_0x51b9('0x27'),_0x236902+'-'+_0x31584e+'/'+_0x4d512e)['json'](_0x3feeac);}return null;};}function patchUpdates(_0x46faa5){return function(_0x447a61){try{jsonpatch[_0x51b9('0x28')](_0x447a61,_0x46faa5,!![]);}catch(_0x2a235b){return BPromise[_0x51b9('0x29')](_0x2a235b);}return _0x447a61[_0x51b9('0x2a')]();};}function saveUpdates(_0x4bfe1f,_0x463f4c){return function(_0x24ac3d){if(_0x24ac3d){return _0x24ac3d['update'](_0x4bfe1f)['then'](function(_0x1bd3db){return _0x1bd3db;});}return null;};}function removeEntity(_0x4d33f9,_0x2145b6){return function(_0x2d51ff){if(_0x2d51ff){return _0x2d51ff[_0x51b9('0x2b')]()[_0x51b9('0x2c')](function(){_0x4d33f9['status'](0xcc)[_0x51b9('0x2d')]();});}};}function handleEntityNotFound(_0x2e137a,_0x1ad99f){return function(_0x4a98f7){if(!_0x4a98f7){_0x2e137a[_0x51b9('0x1f')](0x194);}return _0x4a98f7;};}function handleError(_0x12bc81,_0x1181a4){_0x1181a4=_0x1181a4||0x1f4;return function(_0x1dd064){logger[_0x51b9('0x2e')](_0x1dd064[_0x51b9('0x2f')]);if(_0x1dd064[_0x51b9('0x30')]){delete _0x1dd064[_0x51b9('0x30')];}_0x12bc81[_0x51b9('0x25')](_0x1181a4)[_0x51b9('0x31')](_0x1dd064);};}function getInteractionUsers(_0x22ec68,_0x3cc47f){return new BPromise(function(_0x2c52c7,_0x2bd773){try{if(_0x3cc47f[_0x22ec68['id']]){_0x22ec68['Users']=_[_0x51b9('0x32')](_0x3cc47f[_0x22ec68['id']],function(_0x23c5ec){return{'id':_0x23c5ec['id'],'fullname':_0x23c5ec['fullname']};});}}catch(_0x69924d){_0x2bd773(_0x69924d);}_0x2c52c7(_0x22ec68);});}function getInteractionTags(_0x5b18e8,_0x18ad6b){return new BPromise(function(_0x5c13c0,_0x4cd9de){try{if(_0x5b18e8[_0x51b9('0x33')]){_0x5b18e8[_0x51b9('0x34')]=[];_0x5b18e8[_0x51b9('0x33')][_0x51b9('0x35')](',')[_0x51b9('0x36')](function(_0x416feb){_0x5b18e8[_0x51b9('0x34')][_0x51b9('0x37')](_0x18ad6b[_0x416feb]);});}delete _0x5b18e8[_0x51b9('0x33')];}catch(_0x4f582b){_0x4cd9de(_0x4f582b);}_0x5c13c0(_0x5b18e8);});}function updateSmsInteraction(_0x59e902,_0x5ae5d9,_0x159834){return new BPromise(function(_0x267a51,_0x4bd56b){return getInteractionUsers(_0x59e902,_0x159834)[_0x51b9('0x2c')](function(_0x3a46dd){return getInteractionTags(_0x3a46dd,_0x5ae5d9);})[_0x51b9('0x2c')](function(_0x58ce97){return getStateInteraction(_0x58ce97);})['then'](function(_0x1a29b4){_0x267a51(_0x1a29b4);})['catch'](function(_0x3a9403){_0x4bd56b(_0x3a9403);});});}function getStateInteraction(_0xb40c03){return new BPromise(function(_0x2422f2){_0xb40c03[_0x51b9('0x38')]=0x0;_0xb40c03[_0x51b9('0x39')]=0x0;_0xb40c03[_0x51b9('0x3a')]=0x0;_0xb40c03[_0x51b9('0x3b')]=0x0;_0xb40c03[_0x51b9('0x3c')]=0x0;if(!_0xb40c03['closed']&&!_0xb40c03['UserId']){_0xb40c03[_0x51b9('0x38')]+=0x1;}if(!_0xb40c03['closed']&&_0xb40c03[_0x51b9('0x3d')]){_0xb40c03[_0x51b9('0x39')]+=0x1;if(_0xb40c03[_0x51b9('0x38')]){_0xb40c03[_0x51b9('0x38')]-=0x1;}}if(_0xb40c03[_0x51b9('0x3e')]&&_0xb40c03[_0x51b9('0x3d')]){_0xb40c03[_0x51b9('0x3a')]+=0x1;if(_0xb40c03[_0x51b9('0x39')]){_0xb40c03['talking']-=0x1;}}if(_0xb40c03['closed']&&!_0xb40c03['UserId']){_0xb40c03['unmanaged']+=0x1;if(_0xb40c03['waiting']){_0xb40c03[_0x51b9('0x38')]-=0x1;}}_0xb40c03['total']+=0x1;_0x2422f2(_0xb40c03);});}exports[_0x51b9('0x3f')]=function(_0xcb557f,_0x186257){var _0x3f3edf={},_0x4a5a31={},_0x557196={'count':0x0,'rows':[]};var _0x18d49f=_[_0x51b9('0x32')](db[_0x51b9('0x40')][_0x51b9('0x41')],function(_0x181d6e){return{'name':_0x181d6e[_0x51b9('0x42')],'type':_0x181d6e[_0x51b9('0x43')][_0x51b9('0x44')]};});_0x4a5a31[_0x51b9('0x45')]=_[_0x51b9('0x32')](_0x18d49f,_0x51b9('0x30'));_0x4a5a31[_0x51b9('0x46')]=_['keys'](_0xcb557f[_0x51b9('0x46')]);_0x4a5a31[_0x51b9('0x47')]=_[_0x51b9('0x48')](_0x4a5a31[_0x51b9('0x45')],_0x4a5a31[_0x51b9('0x46')]);_0x3f3edf['attributes']=_[_0x51b9('0x48')](_0x4a5a31[_0x51b9('0x45')],qs[_0x51b9('0x49')](_0xcb557f[_0x51b9('0x46')][_0x51b9('0x49')]));_0x3f3edf[_0x51b9('0x4a')]=_0x3f3edf[_0x51b9('0x4a')][_0x51b9('0x4b')]?_0x3f3edf[_0x51b9('0x4a')]:_0x4a5a31[_0x51b9('0x45')];if(!_0xcb557f[_0x51b9('0x46')][_0x51b9('0x4c')](_0x51b9('0x4d'))){_0x3f3edf[_0x51b9('0x22')]=qs[_0x51b9('0x22')](_0xcb557f[_0x51b9('0x46')][_0x51b9('0x22')]);_0x3f3edf['offset']=qs[_0x51b9('0x21')](_0xcb557f[_0x51b9('0x46')]['offset']);}_0x3f3edf[_0x51b9('0x4e')]=qs[_0x51b9('0x4f')](_0xcb557f[_0x51b9('0x46')][_0x51b9('0x4f')]);_0x3f3edf[_0x51b9('0x50')]=qs[_0x51b9('0x47')](_['pick'](_0xcb557f[_0x51b9('0x46')],_0x4a5a31[_0x51b9('0x47')]),_0x18d49f);var _0x921e4e=[];var _0x9813bf=squel[_0x51b9('0x51')]()[_0x51b9('0x52')]('id')['field'](_0x51b9('0x30'))[_0x51b9('0x52')]('color')[_0x51b9('0x53')](_0x51b9('0x54'));var _0x1eaf66=squel[_0x51b9('0x51')]()[_0x51b9('0x52')]('u.id')[_0x51b9('0x52')](_0x51b9('0x55'))[_0x51b9('0x52')]('ui.SmsInteractionId')[_0x51b9('0x53')](_0x51b9('0x56'),'ui')['left_join']('users','u',_0x51b9('0x57'));var _0x4bceeb=squel[_0x51b9('0x51')]()[_0x51b9('0x53')](_0x51b9('0x58'),'i')['left_join'](_0x51b9('0x59'),'c',_0x51b9('0x5a'))[_0x51b9('0x5b')](_0x51b9('0x5c'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x51b9('0x5d'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me',_0x51b9('0x5e'))[_0x51b9('0x5b')](_0x51b9('0x5f'),'it',_0x51b9('0x60'))[_0x51b9('0x5b')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x10e12f=squel[_0x51b9('0x61')]();var _0x18b824=[];var _0x2203a4=squel['expr']();var _0x41dc12;if(_0xcb557f[_0x51b9('0x46')][_0x51b9('0x62')]){_0x41dc12=as[_0x51b9('0x63')](_0xcb557f['query'][_0x51b9('0x62')]);var _0x961c71=_0x41dc12['sqlOperator'];for(var _0x2e4781=0x0;_0x2e4781<_0x41dc12[_0x51b9('0x64')][_0x51b9('0x4b')];_0x2e4781++){var _0x3e2a12=_0x41dc12[_0x51b9('0x64')][_0x2e4781];var _0x5683b3='i';var _0xcfc023=_[_0x51b9('0x65')](_0x18d49f,[_0x51b9('0x30'),_0x3e2a12[_0x51b9('0x52')]]);if(!_0xcfc023){switch(_0x3e2a12[_0x51b9('0x52')]){case _0x51b9('0x66'):if(_0x3e2a12[_0x51b9('0x67')]==0x1){_0x4bceeb[_0x51b9('0x68')]('`'+_0x3e2a12[_0x51b9('0x52')]+_0x51b9('0x69'));}else{_0x4bceeb['having']('`'+_0x3e2a12[_0x51b9('0x52')]+_0x51b9('0x6a'));}break;case _0x51b9('0x6b'):if(_0x3e2a12[_0x51b9('0x6c')]===_0x51b9('0x6d')){if(_0x3e2a12[_0x51b9('0x67')][_0x51b9('0x35')]('\x20')[_0x51b9('0x4b')]>0x1){_0x10e12f[_0x961c71]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x51b9('0x6e')](_0x3e2a12[_0x51b9('0x67')]),null);}else{var _0xd7bbfa='%'+_0x3e2a12[_0x51b9('0x67')]+'%';_0x10e12f[_0x961c71]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xd7bbfa,_0xd7bbfa,_0xd7bbfa);}}else{_0xcfc023=_[_0x51b9('0x65')](_0x18d49f,[_0x51b9('0x30'),'ContactId']);_0x3e2a12[_0x51b9('0x52')]=_0x51b9('0x6f');_0x56b18a=as['buildExpression'](_0x5683b3,_0xcfc023[_0x51b9('0x43')],_0x3e2a12);_0x10e12f[_0x961c71](_0x56b18a['text'],_0x56b18a[_0x51b9('0x67')][_0x51b9('0x70')],_0x56b18a[_0x51b9('0x67')]['end']);}break;case _0x51b9('0x71'):var _0xb91413=_0x3e2a12[_0x51b9('0x67')]['split'](',')[_0x51b9('0x32')](function(_0x4ec250){return Number(_0x4ec250);});_0xb91413[_0x51b9('0x36')](function(_0x3a86b1){_0x2203a4['or'](_0x51b9('0x72'),'%,'+_0x3a86b1+',%');});_0x18b824=_[_0x51b9('0x73')](_0x18b824,_0xb91413);break;case'User':if(_0x3e2a12[_0x51b9('0x6c')]===_0x51b9('0x6d')){_0x10e12f[_0x961c71](_0x51b9('0x74'),'%'+_0x3e2a12[_0x51b9('0x67')]+'%',null);}else{_0xcfc023=_[_0x51b9('0x65')](_0x18d49f,[_0x51b9('0x30'),_0x51b9('0x3d')]);_0x3e2a12[_0x51b9('0x52')]=_0x51b9('0x3d');_0x56b18a=as[_0x51b9('0x75')](_0x5683b3,_0xcfc023[_0x51b9('0x43')],_0x3e2a12);_0x10e12f[_0x961c71](_0x56b18a[_0x51b9('0x76')],_0x56b18a['value'][_0x51b9('0x70')],_0x56b18a[_0x51b9('0x67')][_0x51b9('0x2d')]);}break;case _0x51b9('0x77'):_0x56b18a=as[_0x51b9('0x75')]('me',null,_0x3e2a12);_0x10e12f[_0x961c71](_0x56b18a[_0x51b9('0x76')],_0x56b18a['value'][_0x51b9('0x70')],_0x56b18a[_0x51b9('0x67')][_0x51b9('0x2d')]);break;}}else{var _0x56b18a=as[_0x51b9('0x75')](_0x5683b3,_0xcfc023[_0x51b9('0x43')],_0x3e2a12);_0x10e12f[_0x961c71](_0x56b18a[_0x51b9('0x76')],_0x56b18a[_0x51b9('0x67')][_0x51b9('0x70')],_0x56b18a[_0x51b9('0x67')]['end']);}}}else{var _0xba7d82=_(_0xcb557f[_0x51b9('0x46')])['keys']()[_0x51b9('0x32')](function(_0x12515d){return _[_0x51b9('0x78')](_0x18d49f,[_0x51b9('0x30'),_0x12515d])?_0x12515d:undefined;})[_0x51b9('0x79')]()[_0x51b9('0x67')]();if(!_[_0x51b9('0x7a')](_0xba7d82)){_0xba7d82['forEach'](function(_0x4ebd6e){if(_0x4ebd6e===_0x51b9('0x7b')){_0x4bceeb[_0x51b9('0x50')]('i.SmsAccountId\x20IN\x20?',[][_0x51b9('0x7c')](_0xcb557f[_0x51b9('0x46')][_0x4ebd6e]));}else if(_0x4ebd6e===_0x51b9('0x7d')){var _0x213999=JSON[_0x51b9('0x7e')](_0xcb557f[_0x51b9('0x46')][_0x4ebd6e])['$gte'];var _0x375d95=JSON['parse'](_0xcb557f['query'][_0x4ebd6e])[_0x51b9('0x7f')];_0x4bceeb[_0x51b9('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x213999,_0x375d95);}else{if(_0xcb557f[_0x51b9('0x46')][_0x4ebd6e]===_0x51b9('0x80')){_0x4bceeb[_0x51b9('0x50')]('i.'+_0x4ebd6e+_0x51b9('0x81'));}else{_0x4bceeb[_0x51b9('0x50')]('i.'+_0x4ebd6e+_0x51b9('0x82'),_0xcb557f[_0x51b9('0x46')][_0x4ebd6e]);}}});}if(_0xcb557f[_0x51b9('0x46')][_0x51b9('0x83')]){if(_0xcb557f[_0x51b9('0x46')][_0x51b9('0x83')]==0x1){_0x4bceeb[_0x51b9('0x68')](_0x51b9('0x84'));}else{_0x4bceeb[_0x51b9('0x68')](_0x51b9('0x85'));}}if(_0xcb557f[_0x51b9('0x46')]['tag']){_0x18b824=_[_0x51b9('0x86')](_0xcb557f[_0x51b9('0x46')]['tag'])?_0xcb557f[_0x51b9('0x46')][_0x51b9('0x87')]:new Array(_0xcb557f[_0x51b9('0x46')][_0x51b9('0x87')]);_0x18b824[_0x51b9('0x36')](function(_0x3a548e){_0x2203a4['or'](_0x51b9('0x72'),'%,'+_0x3a548e+',%');});}if(_0xcb557f[_0x51b9('0x46')][_0x51b9('0x88')]){var _0x2a4ec1=_0xcb557f['query']['filter'][_0x51b9('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x51b9('0x8a')](_0x2a4ec1)){_0x10e12f['or'](_0x51b9('0x8b'),_0x2a4ec1+'%')['or']('i.phone\x20LIKE\x20?',_0x2a4ec1+'%');}else{_0x10e12f['or'](_0x51b9('0x8c'),qs['getFullTextValue'](_0x2a4ec1))['or'](_0x51b9('0x8d'),_0x2a4ec1+'%');}}}_0x4bceeb[_0x51b9('0x50')](_0x10e12f);_0x4bceeb[_0x51b9('0x8e')](_0x51b9('0x8f'));var _0xbd50ea={'type':db['Sequelize'][_0x51b9('0x90')][_0x51b9('0x91')],'raw':!![]};var _0x358950=_0x4bceeb[_0x51b9('0x92')]();_0x358950['field'](_0x51b9('0x8f'));_0x358950[_0x51b9('0x52')](_0x51b9('0x93'),_0x51b9('0x66'));if(_0x3f3edf[_0x51b9('0x4e')]){_0x3f3edf[_0x51b9('0x4e')][_0x51b9('0x36')](function(_0x47b381){var _0x2d7c81=_0x47b381[0x0]===_0x51b9('0x94')?_0x47b381[0x0]:'i.'+_0x47b381[0x0];_0x4bceeb[_0x51b9('0x4e')](_0x2d7c81,_0x47b381[0x1]===_0x51b9('0x95')?![]:!![]);});}if(!_[_0x51b9('0x7a')](_0x18b824)){_0x4bceeb[_0x51b9('0x68')](_0x2203a4);_0x358950[_0x51b9('0x50')](_0x51b9('0x96'),_0x18b824);}BPromise[_0x51b9('0x97')]()[_0x51b9('0x2c')](function(){if(!_0x41dc12){if(_0xcb557f['query'][_0x51b9('0x7b')])return;_0x358950[_0x51b9('0x50')](_0x51b9('0x98'));_0x4bceeb[_0x51b9('0x50')](_0x51b9('0x98'));return;}if(_0xcb557f[_0x51b9('0x99')][_0x51b9('0x9a')]!==_0x51b9('0x9b'))return;return _0xcb557f[_0x51b9('0x99')][_0x51b9('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x127504){if(_['isEmpty'](_0x127504)){_0x358950[_0x51b9('0x50')]('i.SmsAccountId\x20IS\x20NULL');_0x4bceeb[_0x51b9('0x50')](_0x51b9('0x9d'));}else{_0x358950['where'](_0x51b9('0x9e'),_['map'](_0x127504,'id'));_0x4bceeb[_0x51b9('0x50')](_0x51b9('0x9e'),_[_0x51b9('0x32')](_0x127504,'id'));}});})[_0x51b9('0x2c')](function(){if(_0xcb557f[_0x51b9('0x99')]['role']==='agent'&&!_0x41dc12&&!_0xcb557f['query'][_0x51b9('0x7b')])return[];return db[_0x51b9('0x9f')][_0x51b9('0x46')](_0x358950[_0x51b9('0xa0')](),_0xbd50ea);})[_0x51b9('0x2c')](function(_0x16390d){_0x557196[_0x51b9('0x24')]=_0x16390d[_0x51b9('0x4b')];if(_0x557196[_0x51b9('0x24')]===0x0)return[];return db[_0x51b9('0x9f')][_0x51b9('0x46')](_0x9813bf[_0x51b9('0xa0')](),_0xbd50ea)[_0x51b9('0x2c')](function(_0x1afefb){_0x921e4e=_[_0x51b9('0xa1')](_0x1afefb,'id');_0xbd50ea=_[_0x51b9('0xa2')](_0xbd50ea,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xcb557f[_0x51b9('0x46')]['fields']){_0x3f3edf['attributes'][_0x51b9('0x36')](function(_0x1d5943){_0x4bceeb[_0x51b9('0x52')]('i.'+_0x1d5943);});}else{_0x4bceeb[_0x51b9('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x51b9('0x66'));_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xa3'),'Account.key');_0x4bceeb[_0x51b9('0x52')]('a.mandatoryDisposition',_0x51b9('0xa4'));_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xa5'),_0x51b9('0x94'));_0x4bceeb['field'](_0x51b9('0xa6'));_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xa7'),'Contact.firstName');_0x4bceeb['field'](_0x51b9('0xa8'),'Contact.lastName');_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xa9'),_0x51b9('0xaa'));_0x4bceeb[_0x51b9('0x52')]('c.phone',_0x51b9('0xab'));_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xac'),_0x51b9('0xad'));_0x4bceeb[_0x51b9('0x52')]('c.fax',_0x51b9('0xae'));_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xaf'),_0x51b9('0xb0'));_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xb1'),_0x51b9('0xb2'));_0x4bceeb[_0x51b9('0x52')](_0x51b9('0xb3'),_0x51b9('0x33'));}if(_0x3f3edf['limit'])_0x4bceeb[_0x51b9('0x22')](_0x3f3edf[_0x51b9('0x22')]);if(_0x3f3edf[_0x51b9('0x21')])_0x4bceeb['offset'](_0x3f3edf[_0x51b9('0x21')]);return db[_0x51b9('0x9f')][_0x51b9('0x46')](_0x4bceeb[_0x51b9('0xa0')](),_0xbd50ea);})[_0x51b9('0x2c')](function(_0x248f03){if(_0x248f03['length']>0x0)_0x1eaf66[_0x51b9('0x50')](_0x51b9('0xb4'),_['map'](_0x248f03,'id'));return db['sequelize'][_0x51b9('0x46')](_0x1eaf66[_0x51b9('0xa0')](),_0xbd50ea)[_0x51b9('0x2c')](function(_0x162e01){var _0x5e1725=_[_0x51b9('0xb5')](_0x162e01,_0x51b9('0xb6'));var _0x5d3a58=[];_0x248f03[_0x51b9('0x36')](function(_0x25dc7c){_0x5d3a58['push'](updateSmsInteraction(_0x25dc7c,_0x921e4e,_0x5e1725));});return BPromise['all'](_0x5d3a58);});});})['then'](function(_0x1258da){_0x557196['rows']=_0x1258da;return _0x557196;})[_0x51b9('0x2c')](respondWithFilteredResult(_0x186257,_0x3f3edf))[_0x51b9('0xb7')](handleError(_0x186257,null));};exports[_0x51b9('0xb8')]=function(_0x36e80f,_0x267dd9){var _0x3b79d4={'raw':![],'where':{'id':_0x36e80f[_0x51b9('0xb9')]['id']}},_0x2c3349={};_0x2c3349[_0x51b9('0x45')]=_[_0x51b9('0xba')](db[_0x51b9('0x40')][_0x51b9('0x41')]);_0x2c3349[_0x51b9('0x46')]=_[_0x51b9('0xba')](_0x36e80f[_0x51b9('0x46')]);_0x2c3349[_0x51b9('0x47')]=_[_0x51b9('0x48')](_0x2c3349[_0x51b9('0x45')],_0x2c3349[_0x51b9('0x46')]);_0x3b79d4[_0x51b9('0x4a')]=_[_0x51b9('0x48')](_0x2c3349[_0x51b9('0x45')],qs[_0x51b9('0x49')](_0x36e80f['query'][_0x51b9('0x49')]));_0x3b79d4[_0x51b9('0x4a')]=_0x3b79d4[_0x51b9('0x4a')][_0x51b9('0x4b')]?_0x3b79d4[_0x51b9('0x4a')]:_0x2c3349[_0x51b9('0x45')];if(_0x36e80f[_0x51b9('0x46')][_0x51b9('0xbb')]){_0x3b79d4[_0x51b9('0xbc')]=[{'all':!![]}];}_0x3b79d4=_[_0x51b9('0xa2')]({},_0x3b79d4,_0x36e80f[_0x51b9('0xbd')]);return db[_0x51b9('0x40')][_0x51b9('0x65')](_0x3b79d4)['then'](handleEntityNotFound(_0x267dd9,null))[_0x51b9('0x2c')](respondWithResult(_0x267dd9,null))[_0x51b9('0xb7')](handleError(_0x267dd9,null));};exports[_0x51b9('0xbe')]=function(_0x1e1a53,_0x2b7087){return db[_0x51b9('0x40')]['create'](_0x1e1a53[_0x51b9('0x77')],{})['then'](respondWithResult(_0x2b7087,0xc9))[_0x51b9('0xb7')](handleError(_0x2b7087,null));};exports['update']=function(_0x31d678,_0x24295a){if(_0x31d678[_0x51b9('0x77')]['id']){delete _0x31d678[_0x51b9('0x77')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x31d678[_0x51b9('0xb9')]['id']}})[_0x51b9('0x2c')](handleEntityNotFound(_0x24295a,null))[_0x51b9('0x2c')](saveUpdates(_0x31d678[_0x51b9('0x77')],null))[_0x51b9('0x2c')](respondWithResult(_0x24295a,null))[_0x51b9('0xb7')](handleError(_0x24295a,null));};exports[_0x51b9('0x2b')]=function(_0x5c175e,_0x1af04a){return db['SmsInteraction'][_0x51b9('0x65')]({'where':{'id':_0x5c175e[_0x51b9('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1af04a,null))[_0x51b9('0x2c')](removeEntity(_0x1af04a,null))[_0x51b9('0xb7')](handleError(_0x1af04a,null));};exports[_0x51b9('0xbf')]=function(_0x41d542,_0x295f1a){return db[_0x51b9('0x40')][_0x51b9('0xbf')]()[_0x51b9('0x2c')](respondWithResult(_0x295f1a,null))['catch'](handleError(_0x295f1a,null));};exports[_0x51b9('0xc0')]=function(_0x226762,_0x1bc3bc,_0x233587){return db[_0x51b9('0xc1')][_0x51b9('0x65')]({'where':{'id':_0x226762['params']['id']}})[_0x51b9('0x2c')](handleEntityNotFound(_0x1bc3bc,null))['then'](function(_0x1b80ad){if(_0x1b80ad){return _0x1b80ad[_0x51b9('0xc0')](_0x226762[_0x51b9('0x77')][_0x51b9('0xc2')],_[_0x51b9('0xc3')](_0x226762[_0x51b9('0x77')],[_0x51b9('0xc2'),'id'])||{});}})[_0x51b9('0x2c')](respondWithResult(_0x1bc3bc,null))['catch'](handleError(_0x1bc3bc,null));};exports['getMessages']=function(_0x41bd89,_0x31ab57,_0x405ca0){var _0xf4eb7={'raw':![],'where':{}};var _0x502add={};var _0x5213fe={'count':0x0,'rows':[]};return db[_0x51b9('0x40')][_0x51b9('0xc4')]({'where':{'id':_0x41bd89[_0x51b9('0xb9')]['id']}})[_0x51b9('0x2c')](handleEntityNotFound(_0x31ab57,null))[_0x51b9('0x2c')](function(_0x8164de){if(_0x8164de){_0x502add['model']=_[_0x51b9('0xba')](db['SmsMessage'][_0x51b9('0x41')]);_0x502add[_0x51b9('0x46')]=_[_0x51b9('0xba')](_0x41bd89[_0x51b9('0x46')]);_0x502add[_0x51b9('0x47')]=_['intersection'](_0x502add['model'],_0x502add[_0x51b9('0x46')]);_0xf4eb7[_0x51b9('0x4a')]=_[_0x51b9('0x48')](_0x502add['model'],qs[_0x51b9('0x49')](_0x41bd89[_0x51b9('0x46')][_0x51b9('0x49')]));_0xf4eb7['attributes']=_0xf4eb7['attributes'][_0x51b9('0x4b')]?_0xf4eb7[_0x51b9('0x4a')]:_0x502add['model'];if(!_0x41bd89['query'][_0x51b9('0x4c')](_0x51b9('0x4d'))){_0xf4eb7[_0x51b9('0x22')]=qs[_0x51b9('0x22')](_0x41bd89[_0x51b9('0x46')]['limit']);_0xf4eb7[_0x51b9('0x21')]=qs[_0x51b9('0x21')](_0x41bd89[_0x51b9('0x46')][_0x51b9('0x21')]);}_0xf4eb7[_0x51b9('0x4e')]=qs[_0x51b9('0x4f')](_0x41bd89['query'][_0x51b9('0x4f')]);_0xf4eb7[_0x51b9('0x50')]=qs[_0x51b9('0x47')](_['pick'](_0x41bd89[_0x51b9('0x46')],_0x502add['filters']));_0xf4eb7[_0x51b9('0x50')]['SmsInteractionId']=_0x8164de['id'];if(_0x41bd89[_0x51b9('0x46')][_0x51b9('0x88')]){_0xf4eb7['where']=_[_0x51b9('0xa2')](_0xf4eb7[_0x51b9('0x50')],{'$or':_['map'](_0xf4eb7[_0x51b9('0x4a')],function(_0x1ad690){var _0x4ae647={};_0x4ae647[_0x1ad690]={'$like':'%'+_0x41bd89[_0x51b9('0x46')][_0x51b9('0x88')]+'%'};return _0x4ae647;})});}if(_0x41bd89[_0x51b9('0x46')]['$gte']){var _0x576b47=_0x41bd89[_0x51b9('0x46')]['$gte'][_0x51b9('0x35')](',');var _0x2b3a0={};_0x2b3a0[_0x576b47[0x0]]={'$gte':moment(_0x576b47[0x1])[_0x51b9('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0xf4eb7['where']=_['merge'](_0xf4eb7[_0x51b9('0x50')],_0x2b3a0);}_0xf4eb7=_[_0x51b9('0xa2')]({},_0xf4eb7,_0x41bd89[_0x51b9('0xbd')]);return db[_0x51b9('0xc1')][_0x51b9('0x24')]({'where':_0xf4eb7['where']})[_0x51b9('0x2c')](function(_0xe9d47a){_0x5213fe[_0x51b9('0x24')]=_0xe9d47a;if(_0x41bd89[_0x51b9('0x46')][_0x51b9('0xbb')]){_0xf4eb7[_0x51b9('0xbc')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0xf4eb7);})['then'](function(_0x3d1d28){_0x5213fe['rows']=_0x3d1d28;return _0x5213fe;});}})['then'](respondWithFilteredResult(_0x31ab57,_0xf4eb7))[_0x51b9('0xb7')](handleError(_0x31ab57,null));};exports['addTags']=function(_0x4d18ca,_0x2fe04b,_0x18fc76){return db[_0x51b9('0x40')][_0x51b9('0x65')]({'where':{'id':_0x4d18ca[_0x51b9('0xb9')]['id']}})[_0x51b9('0x2c')](handleEntityNotFound(_0x2fe04b,null))['then'](function(_0x29b164){if(_0x29b164){return _0x29b164[_0x51b9('0xc6')](_0x4d18ca[_0x51b9('0x77')]['ids'],_[_0x51b9('0xc3')](_0x4d18ca[_0x51b9('0x77')],[_0x51b9('0xc2'),'id'])||{})[_0x51b9('0xc7')](function(){return db[_0x51b9('0x71')]['findAll']({'attributes':['id',_0x51b9('0x30'),_0x51b9('0xc8')],'where':{'id':_0x4d18ca[_0x51b9('0x77')]['ids']}});})[_0x51b9('0x2c')](function(_0x560c4b){socket[_0x51b9('0xc9')](_0x51b9('0xca'),{'id':Number(_0x4d18ca[_0x51b9('0xb9')]['id']),'tags':_0x560c4b||[]});return{'id':Number(_0x4d18ca[_0x51b9('0xb9')]['id']),'tags':_0x560c4b||[]};});}})[_0x51b9('0x2c')](respondWithResult(_0x2fe04b,null))[_0x51b9('0xb7')](handleError(_0x2fe04b,null));};exports[_0x51b9('0xcb')]=function(_0x153ba5,_0x2634ff,_0x145425){return db[_0x51b9('0x40')][_0x51b9('0x65')]({'where':{'id':_0x153ba5[_0x51b9('0xb9')]['id']}})[_0x51b9('0x2c')](handleEntityNotFound(_0x2634ff,null))[_0x51b9('0x2c')](function(_0x19dad8){if(_0x19dad8){return _0x19dad8['removeTags'](_0x153ba5[_0x51b9('0x46')]['ids']);}})[_0x51b9('0x2c')](respondWithStatusCode(_0x2634ff,null))[_0x51b9('0xb7')](handleError(_0x2634ff,null));};exports[_0x51b9('0xcc')]=function(_0x12ff39,_0x4cc2a7){var _0x3c0f5d=moment()['unix']()[_0x51b9('0xa0')]();var _0x3e8076=path[_0x51b9('0xcd')](config[_0x51b9('0xce')],_0x51b9('0xcf'),_0x51b9('0xd0'),_0x51b9('0xd1'));var _0x93fbb8=path[_0x51b9('0xcd')](config[_0x51b9('0xce')],_0x51b9('0xcf'),'files',_0x51b9('0xd2'));var _0x233843=path[_0x51b9('0xcd')](_0x3e8076,_0x3c0f5d);var _0x3e5b1b=util[_0x51b9('0xc5')](_0x51b9('0xd3'),_0x12ff39['params']['id'],_0x3c0f5d);var _0x24136b=path[_0x51b9('0xcd')](_0x3e8076,_0x3e5b1b);var _0x1517cf=[];_0x1517cf[_0x51b9('0x37')]({'model':db[_0x51b9('0xd4')],'as':_0x51b9('0xd4'),'attributes':['id',_0x51b9('0xd5')],'raw':!![]});_0x1517cf[_0x51b9('0x37')]({'model':db['CmContact'],'as':_0x51b9('0x6b'),'attributes':['id',_0x51b9('0xd6'),_0x51b9('0xd7')],'raw':!![]});var _0x2a493b=[{'model':db[_0x51b9('0xc1')],'as':'Messages','attributes':['id',_0x51b9('0x77'),'createdAt','direction',_0x51b9('0xd8'),_0x51b9('0x83')],'include':_0x1517cf}];_0x2a493b['push']({'model':db[_0x51b9('0xd9')],'as':_0x51b9('0xda'),'attributes':['id','name']});_0x2a493b[_0x51b9('0x37')]({'model':db[_0x51b9('0xd4')],'as':_0x51b9('0xdb'),'attributes':['id','fullname']});return db[_0x51b9('0x40')][_0x51b9('0x65')]({'where':{'id':_0x12ff39[_0x51b9('0xb9')]['id']},'include':_0x2a493b})['then'](handleEntityNotFound(_0x4cc2a7,null))[_0x51b9('0x2c')](function(_0x20387f){if(_0x20387f){var _0xbee0d8=_0x20387f[_0x51b9('0xdc')]({'plain':!![]});fs[_0x51b9('0xdd')](_0x233843);var _0x4c0431={'channel':_0x51b9('0xde'),'account':_0xbee0d8['Account'][_0x51b9('0x30')],'agent':_0xbee0d8[_0x51b9('0xdb')]?_0xbee0d8[_0x51b9('0xdb')][_0x51b9('0xd5')]:_0x51b9('0xdf'),'createdAt':moment(_0xbee0d8[_0x51b9('0x7d')])['format'](_0x51b9('0xe0'))[_0x51b9('0xa0')](),'closedAt':_0xbee0d8[_0x51b9('0x3e')]?moment(_0xbee0d8[_0x51b9('0xe1')])[_0x51b9('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x51b9('0xa0')]():'','disposition':_0xbee0d8[_0x51b9('0xe2')],'messages':_(_0xbee0d8['Messages'])['filter']({'secret':![]})[_0x51b9('0x32')](function(_0x2e4d64){return{'date':moment(_0x2e4d64[_0x51b9('0x7d')])[_0x51b9('0xc5')](_0x51b9('0xe0'))[_0x51b9('0xa0')](),'sender':_0x2e4d64[_0x51b9('0xe3')]===_0x51b9('0xe4')?_0x2e4d64['User']?_0x2e4d64[_0x51b9('0xd4')][_0x51b9('0xd5')]:_0x51b9('0xe5'):_0x2e4d64['Contact'][_0x51b9('0xd6')]+(_0x2e4d64['Contact']['lastName']?'\x20'+_0x2e4d64[_0x51b9('0x6b')][_0x51b9('0xd7')]:''),'body':_0x2e4d64[_0x51b9('0x77')],'direction':_0x2e4d64[_0x51b9('0xe3')]==='out'?'A':'C','secret':_0x2e4d64[_0x51b9('0xd8')],'read':_0x2e4d64['read']};})[_0x51b9('0x67')]()};return ejs[_0x51b9('0xe6')](path[_0x51b9('0xcd')](config[_0x51b9('0xce')],_0x51b9('0xcf'),_0x51b9('0xe7'),_0x51b9('0xe8')),{'interaction':_0x4c0431})[_0x51b9('0x2c')](function(_0x3d25e4){var _0x2f6864=path[_0x51b9('0xcd')](_0x233843,'transcript-'+_0xbee0d8['id']+'-'+_0x3c0f5d+'.pdf');var _0x567941={'path':_0x2f6864,'channel':_0x51b9('0xde'),'interactionId':_0xbee0d8['id']};return pdf[_0x51b9('0xe9')](_0x3d25e4,_0x567941);})[_0x51b9('0x2c')](function(){return new BPromise(function(_0x212625,_0x21c486){zipdir(_0x233843,{'saveTo':_0x24136b},function(_0x496ec0,_0x4517d7){if(_0x496ec0)return _0x21c486(_0x496ec0);return _0x212625(_0x4517d7);});})[_0x51b9('0x2c')](function(){return new BPromise(function(_0x5ed781,_0x5e9d0b){rimraf(_0x233843,function(_0x4741b7){if(_0x4741b7)_0x5e9d0b(_0x4741b7);return _0x5ed781();});});})[_0x51b9('0x2c')](function(){return _0x4cc2a7['download'](_0x24136b,_0x3e5b1b,function(_0x4cac81){if(_0x4cac81){console[_0x51b9('0xea')](_0x51b9('0xeb'),_0x4cac81);}else{fs[_0x51b9('0xec')](_0x24136b);}});});});}else{return _0x4cc2a7[_0x51b9('0x1f')](0xc8);}})['catch'](handleError(_0x4cc2a7,null));}; \ No newline at end of file +var _0x0237=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','split','forEach','push','catch','waiting','unmanaged','total','closed','talking','UserId','answered','index','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','start','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','show','params','keys','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','removeTags','download','join','server','files','root','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','createdAt','direction','secret','Sms','Account','Owner','N.A.','disposition','out','System','read','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf'];(function(_0x8ee7ac,_0x5735fa){var _0x368f73=function(_0x4220b3){while(--_0x4220b3){_0x8ee7ac['push'](_0x8ee7ac['shift']());}};_0x368f73(++_0x5735fa);}(_0x0237,0xda));var _0x7023=function(_0x3f8f46,_0x362cd4){_0x3f8f46=_0x3f8f46-0x0;var _0x496f4e=_0x0237[_0x3f8f46];return _0x496f4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7023('0x0'));var zipdir=require(_0x7023('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7023('0x2'));var moment=require(_0x7023('0x3'));var BPromise=require(_0x7023('0x4'));var Mustache=require('mustache');var util=require(_0x7023('0x5'));var path=require('path');var sox=require(_0x7023('0x6'));var csv=require(_0x7023('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7023('0x8'));var squel=require('squel');var crypto=require(_0x7023('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7023('0xa'));var toCsv=require(_0x7023('0x7'));var querystring=require('querystring');var Papa=require(_0x7023('0xb'));var Redis=require('ioredis');var authService=require(_0x7023('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x7023('0xd'));var pdf=require(_0x7023('0xe'));var hardwareService=require(_0x7023('0xf'));var logger=require(_0x7023('0x10'))('api');var utils=require(_0x7023('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7023('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7023('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7023('0x14'))(new Redis(config[_0x7023('0x15')]));require(_0x7023('0x16'))[_0x7023('0x17')](socket);function respondWithStatusCode(_0x1bf3ec,_0x425431){_0x425431=_0x425431||0xcc;return function(_0x3d841d){if(_0x3d841d){return _0x1bf3ec[_0x7023('0x18')](_0x425431);}return _0x1bf3ec[_0x7023('0x19')](_0x425431)[_0x7023('0x1a')]();};}function respondWithResult(_0x1c302a,_0x52d35b){_0x52d35b=_0x52d35b||0xc8;return function(_0x2df13e){if(_0x2df13e){return _0x1c302a[_0x7023('0x19')](_0x52d35b)[_0x7023('0x1b')](_0x2df13e);}};}function respondWithFilteredResult(_0x9543af,_0x40eee9){return function(_0x4d4716){if(_0x4d4716){var _0x14a7a5=typeof _0x40eee9[_0x7023('0x1c')]===_0x7023('0x1d')&&typeof _0x40eee9[_0x7023('0x1e')]===_0x7023('0x1d');var _0x3be4f4=_0x4d4716[_0x7023('0x1f')];var _0x18d41c=_0x14a7a5?0x0:_0x40eee9[_0x7023('0x1c')];var _0x439cc0=_0x14a7a5?_0x4d4716[_0x7023('0x1f')]:_0x40eee9['offset']+_0x40eee9[_0x7023('0x1e')];var _0x4582c3;if(_0x439cc0>=_0x3be4f4){_0x439cc0=_0x3be4f4;_0x4582c3=0xc8;}else{_0x4582c3=0xce;}_0x9543af[_0x7023('0x19')](_0x4582c3);return _0x9543af['set'](_0x7023('0x20'),_0x18d41c+'-'+_0x439cc0+'/'+_0x3be4f4)[_0x7023('0x1b')](_0x4d4716);}return null;};}function patchUpdates(_0x502d2e){return function(_0xc8d798){try{jsonpatch[_0x7023('0x21')](_0xc8d798,_0x502d2e,!![]);}catch(_0x718485){return BPromise['reject'](_0x718485);}return _0xc8d798[_0x7023('0x22')]();};}function saveUpdates(_0x16f84f,_0x24197a){return function(_0x34f372){if(_0x34f372){return _0x34f372[_0x7023('0x23')](_0x16f84f)[_0x7023('0x24')](function(_0x1316e6){return _0x1316e6;});}return null;};}function removeEntity(_0x4175da,_0x455340){return function(_0x24e12e){if(_0x24e12e){return _0x24e12e[_0x7023('0x25')]()[_0x7023('0x24')](function(){_0x4175da[_0x7023('0x19')](0xcc)[_0x7023('0x1a')]();});}};}function handleEntityNotFound(_0x6e3c32,_0x5f23cb){return function(_0x346ec2){if(!_0x346ec2){_0x6e3c32[_0x7023('0x18')](0x194);}return _0x346ec2;};}function handleError(_0x401497,_0x23d4e){_0x23d4e=_0x23d4e||0x1f4;return function(_0x143a7f){logger['error'](_0x143a7f[_0x7023('0x26')]);if(_0x143a7f[_0x7023('0x27')]){delete _0x143a7f['name'];}_0x401497['status'](_0x23d4e)[_0x7023('0x28')](_0x143a7f);};}function getInteractionUsers(_0x19f0a0,_0x1a1da4){return new BPromise(function(_0x544f53,_0x5336b5){try{if(_0x1a1da4[_0x19f0a0['id']]){_0x19f0a0[_0x7023('0x29')]=_[_0x7023('0x2a')](_0x1a1da4[_0x19f0a0['id']],function(_0x6b045c){return{'id':_0x6b045c['id'],'fullname':_0x6b045c[_0x7023('0x2b')]};});}}catch(_0x5940d3){_0x5336b5(_0x5940d3);}_0x544f53(_0x19f0a0);});}function getInteractionTags(_0x36c185,_0x312393){return new BPromise(function(_0x3d2fd8,_0x36c8e2){try{if(_0x36c185[_0x7023('0x2c')]){_0x36c185['Tags']=[];_0x36c185[_0x7023('0x2c')][_0x7023('0x2d')](',')[_0x7023('0x2e')](function(_0x32b560){_0x36c185['Tags'][_0x7023('0x2f')](_0x312393[_0x32b560]);});}delete _0x36c185[_0x7023('0x2c')];}catch(_0x20d362){_0x36c8e2(_0x20d362);}_0x3d2fd8(_0x36c185);});}function updateSmsInteraction(_0x15d31d,_0x5a50e6,_0x276e67){return new BPromise(function(_0x29b864,_0x2f89a5){return getInteractionUsers(_0x15d31d,_0x276e67)[_0x7023('0x24')](function(_0x1d736c){return getInteractionTags(_0x1d736c,_0x5a50e6);})[_0x7023('0x24')](function(_0x179451){return getStateInteraction(_0x179451);})[_0x7023('0x24')](function(_0x35b2d3){_0x29b864(_0x35b2d3);})[_0x7023('0x30')](function(_0x135327){_0x2f89a5(_0x135327);});});}function getStateInteraction(_0x47c38e){return new BPromise(function(_0x2a51e9){_0x47c38e[_0x7023('0x31')]=0x0;_0x47c38e['talking']=0x0;_0x47c38e['answered']=0x0;_0x47c38e[_0x7023('0x32')]=0x0;_0x47c38e[_0x7023('0x33')]=0x0;if(!_0x47c38e[_0x7023('0x34')]&&!_0x47c38e['UserId']){_0x47c38e[_0x7023('0x31')]+=0x1;}if(!_0x47c38e[_0x7023('0x34')]&&_0x47c38e['UserId']){_0x47c38e[_0x7023('0x35')]+=0x1;if(_0x47c38e[_0x7023('0x31')]){_0x47c38e['waiting']-=0x1;}}if(_0x47c38e[_0x7023('0x34')]&&_0x47c38e[_0x7023('0x36')]){_0x47c38e[_0x7023('0x37')]+=0x1;if(_0x47c38e[_0x7023('0x35')]){_0x47c38e[_0x7023('0x35')]-=0x1;}}if(_0x47c38e[_0x7023('0x34')]&&!_0x47c38e['UserId']){_0x47c38e[_0x7023('0x32')]+=0x1;if(_0x47c38e[_0x7023('0x31')]){_0x47c38e['waiting']-=0x1;}}_0x47c38e['total']+=0x1;_0x2a51e9(_0x47c38e);});}exports[_0x7023('0x38')]=function(_0x4430a0,_0x2df9fa){var _0x5e6544={},_0x8e246c={},_0x8e11aa={'count':0x0,'rows':[]};var _0x419099=_[_0x7023('0x2a')](db['SmsInteraction'][_0x7023('0x39')],function(_0x551955){return{'name':_0x551955[_0x7023('0x3a')],'type':_0x551955['type']['key']};});_0x8e246c[_0x7023('0x3b')]=_[_0x7023('0x2a')](_0x419099,_0x7023('0x27'));_0x8e246c[_0x7023('0x3c')]=_['keys'](_0x4430a0['query']);_0x8e246c[_0x7023('0x3d')]=_[_0x7023('0x3e')](_0x8e246c['model'],_0x8e246c[_0x7023('0x3c')]);_0x5e6544['attributes']=_[_0x7023('0x3e')](_0x8e246c[_0x7023('0x3b')],qs[_0x7023('0x3f')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x3f')]));_0x5e6544[_0x7023('0x40')]=_0x5e6544['attributes'][_0x7023('0x41')]?_0x5e6544[_0x7023('0x40')]:_0x8e246c[_0x7023('0x3b')];if(!_0x4430a0[_0x7023('0x3c')][_0x7023('0x42')](_0x7023('0x43'))){_0x5e6544[_0x7023('0x1e')]=qs[_0x7023('0x1e')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x1e')]);_0x5e6544[_0x7023('0x1c')]=qs[_0x7023('0x1c')](_0x4430a0['query'][_0x7023('0x1c')]);}_0x5e6544[_0x7023('0x44')]=qs[_0x7023('0x45')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x45')]);_0x5e6544['where']=qs[_0x7023('0x3d')](_[_0x7023('0x46')](_0x4430a0[_0x7023('0x3c')],_0x8e246c[_0x7023('0x3d')]),_0x419099);var _0x58f4a2=[];var _0x2a947a=squel[_0x7023('0x47')]()[_0x7023('0x48')]('id')[_0x7023('0x48')](_0x7023('0x27'))[_0x7023('0x48')]('color')[_0x7023('0x49')](_0x7023('0x4a'));var _0x162ce7=squel['select']()[_0x7023('0x48')](_0x7023('0x4b'))['field'](_0x7023('0x4c'))[_0x7023('0x48')](_0x7023('0x4d'))[_0x7023('0x49')](_0x7023('0x4e'),'ui')[_0x7023('0x4f')](_0x7023('0x50'),'u',_0x7023('0x51'));var _0x31796d=squel[_0x7023('0x47')]()['from'](_0x7023('0x52'),'i')[_0x7023('0x4f')]('cm_contacts','c',_0x7023('0x53'))[_0x7023('0x4f')](_0x7023('0x50'),'o',_0x7023('0x54'))[_0x7023('0x4f')](_0x7023('0x55'),'a',_0x7023('0x56'))[_0x7023('0x4f')](_0x7023('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x7023('0x4f')](_0x7023('0x58'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x7023('0x4a'),'t',_0x7023('0x59'));var _0x59c821=squel[_0x7023('0x5a')]();var _0x147041=[];var _0x76af88=squel[_0x7023('0x5a')]();var _0x3470e6;if(_0x4430a0[_0x7023('0x3c')][_0x7023('0x5b')]){_0x3470e6=as[_0x7023('0x5c')](_0x4430a0['query'][_0x7023('0x5b')]);var _0x9fbcb5=_0x3470e6[_0x7023('0x5d')];for(var _0x406e23=0x0;_0x406e23<_0x3470e6[_0x7023('0x5e')][_0x7023('0x41')];_0x406e23++){var _0x4a930d=_0x3470e6[_0x7023('0x5e')][_0x406e23];var _0x32eacc='i';var _0x1e6237=_['find'](_0x419099,[_0x7023('0x27'),_0x4a930d['field']]);if(!_0x1e6237){switch(_0x4a930d[_0x7023('0x48')]){case _0x7023('0x5f'):if(_0x4a930d[_0x7023('0x60')]==0x1){_0x31796d[_0x7023('0x61')]('`'+_0x4a930d[_0x7023('0x48')]+_0x7023('0x62'));}else{_0x31796d['having']('`'+_0x4a930d['field']+_0x7023('0x63'));}break;case _0x7023('0x64'):if(_0x4a930d[_0x7023('0x65')]===_0x7023('0x66')){if(_0x4a930d['value'][_0x7023('0x2d')]('\x20')[_0x7023('0x41')]>0x1){_0x59c821[_0x9fbcb5](_0x7023('0x67'),qs[_0x7023('0x68')](_0x4a930d[_0x7023('0x60')]),null);}else{var _0x44ef02='%'+_0x4a930d[_0x7023('0x60')]+'%';_0x59c821[_0x9fbcb5](_0x7023('0x69'),_0x44ef02,_0x44ef02,_0x44ef02);}}else{_0x1e6237=_[_0x7023('0x6a')](_0x419099,[_0x7023('0x27'),_0x7023('0x6b')]);_0x4a930d['field']='ContactId';_0x229724=as[_0x7023('0x6c')](_0x32eacc,_0x1e6237[_0x7023('0x6d')],_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724[_0x7023('0x6e')],_0x229724[_0x7023('0x60')]['start'],_0x229724['value'][_0x7023('0x1a')]);}break;case'Tag':var _0x1020a7=_0x4a930d['value'][_0x7023('0x2d')](',')[_0x7023('0x2a')](function(_0x5e92f4){return Number(_0x5e92f4);});_0x1020a7[_0x7023('0x2e')](function(_0x17196d){_0x76af88['or'](_0x7023('0x6f'),'%,'+_0x17196d+',%');});_0x147041=_[_0x7023('0x70')](_0x147041,_0x1020a7);break;case _0x7023('0x71'):if(_0x4a930d[_0x7023('0x65')]===_0x7023('0x66')){_0x59c821[_0x9fbcb5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4a930d[_0x7023('0x60')]+'%',null);}else{_0x1e6237=_[_0x7023('0x6a')](_0x419099,[_0x7023('0x27'),_0x7023('0x36')]);_0x4a930d[_0x7023('0x48')]=_0x7023('0x36');_0x229724=as[_0x7023('0x6c')](_0x32eacc,_0x1e6237[_0x7023('0x6d')],_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724['text'],_0x229724['value']['start'],_0x229724['value'][_0x7023('0x1a')]);}break;case _0x7023('0x72'):_0x229724=as[_0x7023('0x6c')]('me',null,_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724['text'],_0x229724[_0x7023('0x60')][_0x7023('0x73')],_0x229724[_0x7023('0x60')][_0x7023('0x1a')]);break;}}else{var _0x229724=as[_0x7023('0x6c')](_0x32eacc,_0x1e6237[_0x7023('0x6d')],_0x4a930d);_0x59c821[_0x9fbcb5](_0x229724[_0x7023('0x6e')],_0x229724['value'][_0x7023('0x73')],_0x229724[_0x7023('0x60')][_0x7023('0x1a')]);}}}else{var _0xc77919=_(_0x4430a0[_0x7023('0x3c')])['keys']()[_0x7023('0x2a')](function(_0x11c464){return _['some'](_0x419099,[_0x7023('0x27'),_0x11c464])?_0x11c464:undefined;})[_0x7023('0x74')]()[_0x7023('0x60')]();if(!_['isEmpty'](_0xc77919)){_0xc77919[_0x7023('0x2e')](function(_0x164bee){if(_0x164bee===_0x7023('0x75')){_0x31796d[_0x7023('0x76')](_0x7023('0x77'),[][_0x7023('0x78')](_0x4430a0[_0x7023('0x3c')][_0x164bee]));}else if(_0x164bee==='createdAt'){var _0x251b4f=JSON[_0x7023('0x79')](_0x4430a0[_0x7023('0x3c')][_0x164bee])[_0x7023('0x7a')];var _0x3d78b1=JSON['parse'](_0x4430a0[_0x7023('0x3c')][_0x164bee])[_0x7023('0x7b')];_0x31796d[_0x7023('0x76')](_0x7023('0x7c'),_0x251b4f,_0x3d78b1);}else{if(_0x4430a0[_0x7023('0x3c')][_0x164bee]==='null'){_0x31796d['where']('i.'+_0x164bee+'\x20IS\x20NULL');}else{_0x31796d['where']('i.'+_0x164bee+'\x20=\x20?',_0x4430a0['query'][_0x164bee]);}}});}if(_0x4430a0[_0x7023('0x3c')]['read']){if(_0x4430a0[_0x7023('0x3c')]['read']==0x1){_0x31796d[_0x7023('0x61')]('`unreadMessages`\x20=\x200');}else{_0x31796d['having'](_0x7023('0x7d'));}}if(_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')]){_0x147041=_[_0x7023('0x7f')](_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')])?_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')]:new Array(_0x4430a0[_0x7023('0x3c')][_0x7023('0x7e')]);_0x147041['forEach'](function(_0xfdd239){_0x76af88['or'](_0x7023('0x6f'),'%,'+_0xfdd239+',%');});}if(_0x4430a0['query']['filter']){var _0x1e8381=_0x4430a0['query'][_0x7023('0x80')][_0x7023('0x81')]('\x5c','\x5c\x5c')[_0x7023('0x81')](/'/g,'\x27\x27');if(qs[_0x7023('0x82')](_0x1e8381)){_0x59c821['or']('i.id\x20LIKE\x20?',_0x1e8381+'%')['or'](_0x7023('0x83'),_0x1e8381+'%');}else{_0x59c821['or'](_0x7023('0x84'),qs[_0x7023('0x68')](_0x1e8381))['or'](_0x7023('0x85'),_0x1e8381+'%');}}}_0x31796d[_0x7023('0x76')](_0x59c821);_0x31796d[_0x7023('0x86')](_0x7023('0x87'));var _0xe015be={'type':db[_0x7023('0x88')][_0x7023('0x89')][_0x7023('0x8a')],'raw':!![]};var _0x25fe20=_0x31796d[_0x7023('0x8b')]();_0x25fe20[_0x7023('0x48')](_0x7023('0x87'));_0x25fe20[_0x7023('0x48')](_0x7023('0x8c'),'unreadMessages');if(_0x5e6544[_0x7023('0x44')]){_0x5e6544[_0x7023('0x44')]['forEach'](function(_0x25e03b){var _0x50cc74=_0x25e03b[0x0]===_0x7023('0x8d')?_0x25e03b[0x0]:'i.'+_0x25e03b[0x0];_0x31796d[_0x7023('0x44')](_0x50cc74,_0x25e03b[0x1]===_0x7023('0x8e')?![]:!![]);});}if(!_[_0x7023('0x8f')](_0x147041)){_0x31796d[_0x7023('0x61')](_0x76af88);_0x25fe20[_0x7023('0x76')]('t.id\x20IN\x20?',_0x147041);}BPromise['resolve']()[_0x7023('0x24')](function(){if(!_0x3470e6){if(_0x4430a0['query'][_0x7023('0x75')])return;_0x25fe20[_0x7023('0x76')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x31796d['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4430a0[_0x7023('0x90')][_0x7023('0x91')]!=='agent')return;return _0x4430a0[_0x7023('0x90')][_0x7023('0x92')]({'attributes':['id'],'raw':!![]})[_0x7023('0x24')](function(_0x3fdadc){if(_[_0x7023('0x8f')](_0x3fdadc)){_0x25fe20['where'](_0x7023('0x93'));_0x31796d[_0x7023('0x76')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x25fe20[_0x7023('0x76')](_0x7023('0x77'),_['map'](_0x3fdadc,'id'));_0x31796d['where'](_0x7023('0x77'),_['map'](_0x3fdadc,'id'));}});})[_0x7023('0x24')](function(){if(_0x4430a0[_0x7023('0x90')]['role']===_0x7023('0x94')&&!_0x3470e6&&!_0x4430a0['query'][_0x7023('0x75')])return[];return db['sequelize'][_0x7023('0x3c')](_0x25fe20[_0x7023('0x95')](),_0xe015be);})['then'](function(_0x2ad1b9){_0x8e11aa[_0x7023('0x1f')]=_0x2ad1b9[_0x7023('0x41')];if(_0x8e11aa[_0x7023('0x1f')]===0x0)return[];return db[_0x7023('0x96')][_0x7023('0x3c')](_0x2a947a['toString'](),_0xe015be)[_0x7023('0x24')](function(_0x241593){_0x58f4a2=_[_0x7023('0x97')](_0x241593,'id');_0xe015be=_[_0x7023('0x98')](_0xe015be,{'model':db[_0x7023('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4430a0[_0x7023('0x3c')][_0x7023('0x3f')]){_0x5e6544['attributes'][_0x7023('0x2e')](function(_0x49cc80){_0x31796d['field']('i.'+_0x49cc80);});}else{_0x31796d[_0x7023('0x48')](_0x7023('0x8c'),_0x7023('0x5f'));_0x31796d[_0x7023('0x48')](_0x7023('0x9a'),_0x7023('0x9b'));_0x31796d['field'](_0x7023('0x9c'),_0x7023('0x9d'));_0x31796d['field'](_0x7023('0x9e'),_0x7023('0x8d'));_0x31796d[_0x7023('0x48')](_0x7023('0x9f'));_0x31796d[_0x7023('0x48')](_0x7023('0xa0'),_0x7023('0xa1'));_0x31796d[_0x7023('0x48')](_0x7023('0xa2'),_0x7023('0xa3'));_0x31796d[_0x7023('0x48')](_0x7023('0xa4'),_0x7023('0xa5'));_0x31796d[_0x7023('0x48')](_0x7023('0xa6'),_0x7023('0xa7'));_0x31796d[_0x7023('0x48')](_0x7023('0xa8'),_0x7023('0xa9'));_0x31796d[_0x7023('0x48')](_0x7023('0xaa'),_0x7023('0xab'));_0x31796d[_0x7023('0x48')](_0x7023('0xac'),_0x7023('0xad'));_0x31796d[_0x7023('0x48')](_0x7023('0xae'),_0x7023('0xaf'));_0x31796d[_0x7023('0x48')](_0x7023('0xb0'),_0x7023('0x2c'));}if(_0x5e6544[_0x7023('0x1e')])_0x31796d[_0x7023('0x1e')](_0x5e6544['limit']);if(_0x5e6544['offset'])_0x31796d[_0x7023('0x1c')](_0x5e6544[_0x7023('0x1c')]);return db[_0x7023('0x96')]['query'](_0x31796d[_0x7023('0x95')](),_0xe015be);})[_0x7023('0x24')](function(_0x3d69be){if(_0x3d69be[_0x7023('0x41')]>0x0)_0x162ce7[_0x7023('0x76')]('ui.SmsInteractionId\x20IN\x20?',_[_0x7023('0x2a')](_0x3d69be,'id'));return db[_0x7023('0x96')][_0x7023('0x3c')](_0x162ce7[_0x7023('0x95')](),_0xe015be)[_0x7023('0x24')](function(_0x5eaa4e){var _0x4fb664=_[_0x7023('0xb1')](_0x5eaa4e,'SmsInteractionId');var _0xa3eb9=[];_0x3d69be[_0x7023('0x2e')](function(_0x2615e4){_0xa3eb9[_0x7023('0x2f')](updateSmsInteraction(_0x2615e4,_0x58f4a2,_0x4fb664));});return BPromise[_0x7023('0xb2')](_0xa3eb9);});});})[_0x7023('0x24')](function(_0x41be54){_0x8e11aa['rows']=_0x41be54;return _0x8e11aa;})[_0x7023('0x24')](respondWithFilteredResult(_0x2df9fa,_0x5e6544))[_0x7023('0x30')](handleError(_0x2df9fa,null));};exports[_0x7023('0xb3')]=function(_0x594616,_0x3594b4){var _0x146150={'raw':![],'where':{'id':_0x594616[_0x7023('0xb4')]['id']}},_0x2d6109={};_0x2d6109[_0x7023('0x3b')]=_[_0x7023('0xb5')](db['SmsInteraction'][_0x7023('0x39')]);_0x2d6109[_0x7023('0x3c')]=_[_0x7023('0xb5')](_0x594616[_0x7023('0x3c')]);_0x2d6109[_0x7023('0x3d')]=_[_0x7023('0x3e')](_0x2d6109['model'],_0x2d6109['query']);_0x146150[_0x7023('0x40')]=_['intersection'](_0x2d6109[_0x7023('0x3b')],qs[_0x7023('0x3f')](_0x594616[_0x7023('0x3c')]['fields']));_0x146150['attributes']=_0x146150[_0x7023('0x40')]['length']?_0x146150[_0x7023('0x40')]:_0x2d6109[_0x7023('0x3b')];if(_0x594616[_0x7023('0x3c')][_0x7023('0xb6')]){_0x146150[_0x7023('0xb7')]=[{'all':!![]}];}_0x146150=_[_0x7023('0x98')]({},_0x146150,_0x594616[_0x7023('0xb8')]);return db[_0x7023('0x99')][_0x7023('0x6a')](_0x146150)[_0x7023('0x24')](handleEntityNotFound(_0x3594b4,null))[_0x7023('0x24')](respondWithResult(_0x3594b4,null))[_0x7023('0x30')](handleError(_0x3594b4,null));};exports[_0x7023('0xb9')]=function(_0x106687,_0x13dfe4){return db[_0x7023('0x99')]['create'](_0x106687[_0x7023('0x72')],{})[_0x7023('0x24')](respondWithResult(_0x13dfe4,0xc9))['catch'](handleError(_0x13dfe4,null));};exports[_0x7023('0x23')]=function(_0x3d5c65,_0x1ec000){if(_0x3d5c65[_0x7023('0x72')]['id']){delete _0x3d5c65['body']['id'];}return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x3d5c65[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x1ec000,null))[_0x7023('0x24')](saveUpdates(_0x3d5c65[_0x7023('0x72')],null))[_0x7023('0x24')](respondWithResult(_0x1ec000,null))[_0x7023('0x30')](handleError(_0x1ec000,null));};exports[_0x7023('0x25')]=function(_0x25454e,_0x59a8c0){return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x25454e[_0x7023('0xb4')]['id']}})['then'](handleEntityNotFound(_0x59a8c0,null))['then'](removeEntity(_0x59a8c0,null))['catch'](handleError(_0x59a8c0,null));};exports[_0x7023('0xba')]=function(_0xe6cb08,_0x4a3f0e){return db[_0x7023('0x99')][_0x7023('0xba')]()[_0x7023('0x24')](respondWithResult(_0x4a3f0e,null))[_0x7023('0x30')](handleError(_0x4a3f0e,null));};exports[_0x7023('0xbb')]=function(_0x49c7a3,_0x38ac93,_0x1e14db){return db[_0x7023('0xbc')][_0x7023('0x6a')]({'where':{'id':_0x49c7a3[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x38ac93,null))[_0x7023('0x24')](function(_0xe4a76e){if(_0xe4a76e){return _0xe4a76e[_0x7023('0xbb')](_0x49c7a3[_0x7023('0x72')][_0x7023('0xbd')],_[_0x7023('0xbe')](_0x49c7a3[_0x7023('0x72')],[_0x7023('0xbd'),'id'])||{});}})[_0x7023('0x24')](respondWithResult(_0x38ac93,null))[_0x7023('0x30')](handleError(_0x38ac93,null));};exports[_0x7023('0xbf')]=function(_0x28234c,_0x4c5915,_0x3bc613){var _0x502e17={'raw':![],'where':{}};var _0x2d6125={};var _0x533403={'count':0x0,'rows':[]};return db[_0x7023('0x99')][_0x7023('0xc0')]({'where':{'id':_0x28234c[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x4c5915,null))[_0x7023('0x24')](function(_0x1c4ac0){if(_0x1c4ac0){_0x2d6125[_0x7023('0x3b')]=_[_0x7023('0xb5')](db[_0x7023('0xbc')]['rawAttributes']);_0x2d6125[_0x7023('0x3c')]=_['keys'](_0x28234c[_0x7023('0x3c')]);_0x2d6125['filters']=_['intersection'](_0x2d6125[_0x7023('0x3b')],_0x2d6125['query']);_0x502e17[_0x7023('0x40')]=_[_0x7023('0x3e')](_0x2d6125['model'],qs['fields'](_0x28234c[_0x7023('0x3c')][_0x7023('0x3f')]));_0x502e17['attributes']=_0x502e17[_0x7023('0x40')][_0x7023('0x41')]?_0x502e17[_0x7023('0x40')]:_0x2d6125[_0x7023('0x3b')];if(!_0x28234c[_0x7023('0x3c')][_0x7023('0x42')](_0x7023('0x43'))){_0x502e17['limit']=qs[_0x7023('0x1e')](_0x28234c[_0x7023('0x3c')][_0x7023('0x1e')]);_0x502e17[_0x7023('0x1c')]=qs['offset'](_0x28234c['query'][_0x7023('0x1c')]);}_0x502e17[_0x7023('0x44')]=qs[_0x7023('0x45')](_0x28234c[_0x7023('0x3c')][_0x7023('0x45')]);_0x502e17['where']=qs[_0x7023('0x3d')](_[_0x7023('0x46')](_0x28234c[_0x7023('0x3c')],_0x2d6125['filters']));_0x502e17[_0x7023('0x76')][_0x7023('0xc1')]=_0x1c4ac0['id'];if(_0x28234c[_0x7023('0x3c')]['filter']){_0x502e17[_0x7023('0x76')]=_[_0x7023('0x98')](_0x502e17[_0x7023('0x76')],{'$or':_[_0x7023('0x2a')](_0x502e17[_0x7023('0x40')],function(_0x3c89a){var _0xab9388={};_0xab9388[_0x3c89a]={'$like':'%'+_0x28234c['query']['filter']+'%'};return _0xab9388;})});}if(_0x28234c[_0x7023('0x3c')]['$gte']){var _0x1c714b=_0x28234c[_0x7023('0x3c')][_0x7023('0x7a')]['split'](',');var _0x4c30f2={};_0x4c30f2[_0x1c714b[0x0]]={'$gte':moment(_0x1c714b[0x1])[_0x7023('0xc2')](_0x7023('0xc3'))};_0x502e17[_0x7023('0x76')]=_[_0x7023('0x98')](_0x502e17[_0x7023('0x76')],_0x4c30f2);}_0x502e17=_['merge']({},_0x502e17,_0x28234c['options']);return db[_0x7023('0xbc')][_0x7023('0x1f')]({'where':_0x502e17[_0x7023('0x76')]})['then'](function(_0x5d5476){_0x533403['count']=_0x5d5476;if(_0x28234c[_0x7023('0x3c')][_0x7023('0xb6')]){_0x502e17['include']=[{'all':!![]}];}return db[_0x7023('0xbc')][_0x7023('0xc4')](_0x502e17);})[_0x7023('0x24')](function(_0x51586b){_0x533403[_0x7023('0xc5')]=_0x51586b;return _0x533403;});}})[_0x7023('0x24')](respondWithFilteredResult(_0x4c5915,_0x502e17))[_0x7023('0x30')](handleError(_0x4c5915,null));};exports[_0x7023('0xc6')]=function(_0x47ca02,_0x53b5d4,_0x3bd72c){return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x47ca02[_0x7023('0xb4')]['id']}})[_0x7023('0x24')](handleEntityNotFound(_0x53b5d4,null))[_0x7023('0x24')](function(_0x5c5979){if(_0x5c5979){return _0x5c5979[_0x7023('0xc7')](_0x47ca02[_0x7023('0x72')]['ids'],_[_0x7023('0xbe')](_0x47ca02[_0x7023('0x72')],['ids','id'])||{})[_0x7023('0xc8')](function(){return db['Tag'][_0x7023('0xc4')]({'attributes':['id','name',_0x7023('0xc9')],'where':{'id':_0x47ca02['body'][_0x7023('0xbd')]}});})[_0x7023('0x24')](function(_0x179317){socket[_0x7023('0xca')]('smsInteractionTags:save',{'id':Number(_0x47ca02['params']['id']),'tags':_0x179317||[]});return{'id':Number(_0x47ca02[_0x7023('0xb4')]['id']),'tags':_0x179317||[]};});}})[_0x7023('0x24')](respondWithResult(_0x53b5d4,null))[_0x7023('0x30')](handleError(_0x53b5d4,null));};exports['removeTags']=function(_0x424b08,_0x2b9608,_0x506799){return db[_0x7023('0x99')]['find']({'where':{'id':_0x424b08[_0x7023('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2b9608,null))['then'](function(_0x22d888){if(_0x22d888){return _0x22d888[_0x7023('0xcb')](_0x424b08['query'][_0x7023('0xbd')]);}})[_0x7023('0x24')](respondWithStatusCode(_0x2b9608,null))[_0x7023('0x30')](handleError(_0x2b9608,null));};exports[_0x7023('0xcc')]=function(_0x487790,_0x1659f7){var _0xe34a81=moment()['unix']()[_0x7023('0x95')]();var _0x489554=path[_0x7023('0xcd')](config['root'],_0x7023('0xce'),_0x7023('0xcf'),'tmp');var _0xd01639=path[_0x7023('0xcd')](config[_0x7023('0xd0')],_0x7023('0xce'),_0x7023('0xcf'),_0x7023('0xd1'));var _0x3e0b54=path[_0x7023('0xcd')](_0x489554,_0xe34a81);var _0x1b3706=util[_0x7023('0xc2')](_0x7023('0xd2'),_0x487790[_0x7023('0xb4')]['id'],_0xe34a81);var _0x1a6d36=path[_0x7023('0xcd')](_0x489554,_0x1b3706);var _0x254666=[];_0x254666[_0x7023('0x2f')]({'model':db['User'],'as':_0x7023('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x254666[_0x7023('0x2f')]({'model':db[_0x7023('0xd3')],'as':_0x7023('0x64'),'attributes':['id',_0x7023('0xd4'),_0x7023('0xd5')],'raw':!![]});var _0x2850e6=[{'model':db['SmsMessage'],'as':_0x7023('0xd6'),'attributes':['id',_0x7023('0x72'),_0x7023('0xd7'),_0x7023('0xd8'),_0x7023('0xd9'),'read'],'include':_0x254666}];_0x2850e6[_0x7023('0x2f')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x2850e6['push']({'model':db[_0x7023('0x71')],'as':'Owner','attributes':['id',_0x7023('0x2b')]});return db[_0x7023('0x99')][_0x7023('0x6a')]({'where':{'id':_0x487790[_0x7023('0xb4')]['id']},'include':_0x2850e6})[_0x7023('0x24')](handleEntityNotFound(_0x1659f7,null))[_0x7023('0x24')](function(_0x514c4e){if(_0x514c4e){var _0x3f3a4b=_0x514c4e['get']({'plain':!![]});fs['mkdirSync'](_0x3e0b54);var _0x310f83={'channel':_0x7023('0xda'),'account':_0x3f3a4b[_0x7023('0xdb')][_0x7023('0x27')],'agent':_0x3f3a4b[_0x7023('0xdc')]?_0x3f3a4b[_0x7023('0xdc')][_0x7023('0x2b')]:_0x7023('0xdd'),'createdAt':moment(_0x3f3a4b[_0x7023('0xd7')])[_0x7023('0xc2')](_0x7023('0xc3'))[_0x7023('0x95')](),'closedAt':_0x3f3a4b[_0x7023('0x34')]?moment(_0x3f3a4b['closedAt'])[_0x7023('0xc2')](_0x7023('0xc3'))[_0x7023('0x95')]():'','disposition':_0x3f3a4b[_0x7023('0xde')],'messages':_(_0x3f3a4b[_0x7023('0xd6')])[_0x7023('0x80')]({'secret':![]})[_0x7023('0x2a')](function(_0x4cfb60){return{'date':moment(_0x4cfb60[_0x7023('0xd7')])['format'](_0x7023('0xc3'))[_0x7023('0x95')](),'sender':_0x4cfb60[_0x7023('0xd8')]===_0x7023('0xdf')?_0x4cfb60[_0x7023('0x71')]?_0x4cfb60[_0x7023('0x71')][_0x7023('0x2b')]:_0x7023('0xe0'):_0x4cfb60['Contact'][_0x7023('0xd4')]+(_0x4cfb60[_0x7023('0x64')][_0x7023('0xd5')]?'\x20'+_0x4cfb60[_0x7023('0x64')][_0x7023('0xd5')]:''),'body':_0x4cfb60[_0x7023('0x72')],'direction':_0x4cfb60['direction']==='out'?'A':'C','secret':_0x4cfb60[_0x7023('0xd9')],'read':_0x4cfb60[_0x7023('0xe1')]};})[_0x7023('0x60')]()};return ejs[_0x7023('0xe2')](path[_0x7023('0xcd')](config['root'],_0x7023('0xce'),_0x7023('0xe3'),'downloadInteraction.ejs'),{'interaction':_0x310f83})['then'](function(_0x13e200){var _0x72667b=path['join'](_0x3e0b54,_0x7023('0xe4')+_0x3f3a4b['id']+'-'+_0xe34a81+_0x7023('0xe5'));var _0x484361={'path':_0x72667b,'channel':_0x7023('0xda'),'interactionId':_0x3f3a4b['id']};return pdf[_0x7023('0xe6')](_0x13e200,_0x484361);})[_0x7023('0x24')](function(){return new BPromise(function(_0x45d22a,_0x92b399){zipdir(_0x3e0b54,{'saveTo':_0x1a6d36},function(_0x4e87df,_0x13ac41){if(_0x4e87df)return _0x92b399(_0x4e87df);return _0x45d22a(_0x13ac41);});})[_0x7023('0x24')](function(){return new BPromise(function(_0x94b3f4,_0x324012){rimraf(_0x3e0b54,function(_0x26dc30){if(_0x26dc30)_0x324012(_0x26dc30);return _0x94b3f4();});});})[_0x7023('0x24')](function(){return _0x1659f7[_0x7023('0xcc')](_0x1a6d36,_0x1b3706,function(_0xcd5b7f){if(_0xcd5b7f){console['log'](_0x7023('0xe7'),_0xcd5b7f);}else{fs[_0x7023('0xe8')](_0x1a6d36);}});});});}else{return _0x1659f7[_0x7023('0x18')](0xc8);}})[_0x7023('0x30')](handleError(_0x1659f7,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9ae5474..b846b9f 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 _0x1c7c=['../../mysqldb','SmsInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x5aa008,_0x43b780){var _0x5d0a2f=function(_0x461709){while(--_0x461709){_0x5aa008['push'](_0x5aa008['shift']());}};_0x5d0a2f(++_0x43b780);}(_0x1c7c,0x164));var _0xc1c7=function(_0x589565,_0x379f70){_0x589565=_0x589565-0x0;var _0x24c394=_0x1c7c[_0x589565];return _0x24c394;};'use strict';var EventEmitter=require(_0xc1c7('0x0'));var SmsInteraction=require(_0xc1c7('0x1'))['db'][_0xc1c7('0x2')];var SmsMessage=require(_0xc1c7('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc1c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1c7('0x4'),'afterDestroy':_0xc1c7('0x5')};function emitEvent(_0xbb9da0){return function(_0x2a0383,_0x42e930,_0x364dde){_0x2a0383[_0xc1c7('0x6')]({'attributes':['id'],'raw':!![]})[_0xc1c7('0x7')](function(_0xce5bcd){_0x2a0383[_0xc1c7('0x8')](_0xc1c7('0x9'),_0xce5bcd[_0xc1c7('0xa')](function(_0x92e892){return{'id':_0x92e892['id']};}));return SmsMessage[_0xc1c7('0xb')]({'where':{'SmsInteractionId':_0x2a0383['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1c7('0x7')](function(_0x301abf){_0x2a0383[_0xc1c7('0x8')]('unreadMessages',_0x301abf[_0xc1c7('0xc')]);SmsInteractionEvents[_0xc1c7('0xd')](_0xbb9da0+':'+_0x2a0383['id'],_0x2a0383);SmsInteractionEvents['emit'](_0xbb9da0,_0x2a0383);_0x364dde(null);})[_0xc1c7('0xe')](_0x364dde(null));};}for(var e in events){if(events[_0xc1c7('0xf')](e)){var event=events[e];SmsInteraction[_0xc1c7('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x1be180,_0xd744bd){var _0x253a07=function(_0x3477ac){while(--_0x3477ac){_0x1be180['push'](_0x1be180['shift']());}};_0x253a07(++_0xd744bd);}(_0xadb5,0xad));var _0x5adb=function(_0x412b5b,_0x2019cd){_0x412b5b=_0x412b5b-0x0;var _0x56fc24=_0xadb5[_0x412b5b];return _0x56fc24;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 988f3a1..9e422db 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 _0x701d=['util','api','moment','request-promise','path','../../config/environment','define','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2948d3,_0x142698){var _0x1646c6=function(_0x1ed85d){while(--_0x1ed85d){_0x2948d3['push'](_0x2948d3['shift']());}};_0x1646c6(++_0x142698);}(_0x701d,0xcf));var _0xd701=function(_0x3ab0bc,_0xc5a476){_0x3ab0bc=_0x3ab0bc-0x0;var _0x4625b4=_0x701d[_0x3ab0bc];return _0x4625b4;};'use strict';var _=require(_0xd701('0x0'));var util=require(_0xd701('0x1'));var logger=require('../../config/logger')(_0xd701('0x2'));var moment=require(_0xd701('0x3'));var BPromise=require('bluebird');var rp=require(_0xd701('0x4'));var fs=require('fs');var path=require(_0xd701('0x5'));var rimraf=require('rimraf');var config=require(_0xd701('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x235893,_0x2a4f1c){return _0x235893[_0xd701('0x7')]('SmsInteraction',attributes,{'tableName':_0xd701('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c619a,_0xa6a1c6,_0x56b0d3){if(_0x4c619a[_0xd701('0x9')](_0xd701('0xa'))){_0x4c619a['closedAt']=moment()[_0xd701('0xb')](_0xd701('0xc'));}_0x56b0d3(null,_0x4c619a);}}});}; \ No newline at end of file +var _0x305c=['exports','define','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes'];(function(_0x900ae2,_0x3b6c0c){var _0x2eef08=function(_0x17ceb7){while(--_0x17ceb7){_0x900ae2['push'](_0x900ae2['shift']());}};_0x2eef08(++_0x3b6c0c);}(_0x305c,0x95));var _0xc305=function(_0x41c44d,_0x31d1eb){_0x41c44d=_0x41c44d-0x0;var _0x5e00f5=_0x305c[_0x41c44d];return _0x5e00f5;};'use strict';var _=require(_0xc305('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc305('0x1'));var moment=require('moment');var BPromise=require(_0xc305('0x2'));var rp=require(_0xc305('0x3'));var fs=require('fs');var path=require(_0xc305('0x4'));var rimraf=require('rimraf');var config=require(_0xc305('0x5'));var attributes=require(_0xc305('0x6'));module[_0xc305('0x7')]=function(_0x348b2c,_0x336b08){return _0x348b2c[_0xc305('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xeb8cd1,_0x4b1038,_0x36b79a){if(_0xeb8cd1['changed'](_0xc305('0x9'))){_0xeb8cd1[_0xc305('0xa')]=moment()['format'](_0xc305('0xb'));}_0x36b79a(null,_0xeb8cd1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 441072e..3b85dd2 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 _0x854d=['raw','where','debug','stringify','AddTagsToSmsInteraction','find','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options'];(function(_0x3e8a07,_0x3c10be){var _0x1b83ce=function(_0x1884fc){while(--_0x1884fc){_0x3e8a07['push'](_0x3e8a07['shift']());}};_0x1b83ce(++_0x3c10be);}(_0x854d,0x130));var _0xd854=function(_0x4b441c,_0xceaedc){_0x4b441c=_0x4b441c-0x0;var _0x5e1fe3=_0x854d[_0x4b441c];return _0x5e1fe3;};'use strict';var _=require(_0xd854('0x0'));var util=require(_0xd854('0x1'));var moment=require(_0xd854('0x2'));var BPromise=require(_0xd854('0x3'));var rs=require(_0xd854('0x4'));var fs=require('fs');var Redis=require(_0xd854('0x5'));var db=require(_0xd854('0x6'))['db'];var utils=require(_0xd854('0x7'));var logger=require(_0xd854('0x8'))(_0xd854('0x9'));var config=require(_0xd854('0xa'));var jayson=require(_0xd854('0xb'));var client=jayson[_0xd854('0xc')][_0xd854('0xd')]({'port':0x232a});config['redis']=_[_0xd854('0xe')](config[_0xd854('0xf')],{'host':_0xd854('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd854('0xf')]));require('./smsInteraction.socket')[_0xd854('0x11')](socket);function respondWithRpcPromise(_0x509def,_0x2b81c2,_0x1cba91){return new BPromise(function(_0x505e58,_0x673a5f){return client['request'](_0x509def,_0x1cba91)[_0xd854('0x12')](function(_0x4be75c){logger[_0xd854('0x13')](_0xd854('0x14'),_0x2b81c2,'request\x20sent');logger['debug'](_0xd854('0x15'),_0x2b81c2,_0xd854('0x16'),JSON['stringify'](_0x4be75c));if(_0x4be75c[_0xd854('0x17')]){if(_0x4be75c['error'][_0xd854('0x18')]===0x1f4){logger[_0xd854('0x17')](_0xd854('0x14'),_0x2b81c2,_0x4be75c[_0xd854('0x17')]['message']);return _0x673a5f(_0x4be75c[_0xd854('0x17')][_0xd854('0x19')]);}logger[_0xd854('0x17')](_0xd854('0x14'),_0x2b81c2,_0x4be75c['error']['message']);return _0x505e58(_0x4be75c[_0xd854('0x17')]['message']);}else{logger[_0xd854('0x13')](_0xd854('0x14'),_0x2b81c2,'request\x20sent');_0x505e58(_0x4be75c[_0xd854('0x1a')]['message']);}})[_0xd854('0x1b')](function(_0x548c37){logger[_0xd854('0x17')](_0xd854('0x14'),_0x2b81c2,_0x548c37);_0x673a5f(_0x548c37);});});}exports[_0xd854('0x1c')]=function(_0x5f23cd){var _0x25a95d=this;return new Promise(function(_0x2d868f,_0x5b326b){return db[_0xd854('0x1d')][_0xd854('0x1e')](_0x5f23cd['body'],{'raw':_0x5f23cd[_0xd854('0x1f')]?_0x5f23cd[_0xd854('0x1f')][_0xd854('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f23cd[_0xd854('0x1f')]?_0x5f23cd[_0xd854('0x1f')][_0xd854('0x21')]||null:null,'attributes':_0x5f23cd[_0xd854('0x1f')]?_0x5f23cd['options']['attributes']||null:null,'limit':_0x5f23cd[_0xd854('0x1f')]?_0x5f23cd[_0xd854('0x1f')]['limit']||null:null})['then'](function(_0x28e7ca){logger[_0xd854('0x13')]('UpdateSmsInteraction',_0x5f23cd);logger[_0xd854('0x22')](_0xd854('0x1c'),_0x5f23cd,JSON[_0xd854('0x23')](_0x28e7ca));_0x2d868f(_0x28e7ca);})[_0xd854('0x1b')](function(_0x43ea93){logger['error']('UpdateSmsInteraction',_0x43ea93[_0xd854('0x19')],_0x5f23cd);_0x5b326b(_0x25a95d[_0xd854('0x17')](0x1f4,_0x43ea93[_0xd854('0x19')]));});});};exports[_0xd854('0x24')]=function(_0xa0ed54){return new Promise(function(_0x12e818,_0x1b13f2){return db['SmsInteraction'][_0xd854('0x25')]({'where':_0xa0ed54[_0xd854('0x1f')]?_0xa0ed54[_0xd854('0x1f')][_0xd854('0x21')]||null:null})[_0xd854('0x12')](function(_0x139109){if(_0x139109){return _0x139109['addTags'](_0xa0ed54[_0xd854('0x26')][_0xd854('0x27')],_[_0xd854('0x28')](_0xa0ed54[_0xd854('0x26')],['ids','id'])||{});}})['spread'](function(_0xcb8472){logger[_0xd854('0x13')](_0xd854('0x29'),_0xa0ed54);logger[_0xd854('0x22')]('AddTags',_0xa0ed54,JSON['stringify'](_0xcb8472));_0x12e818(_0xcb8472);})[_0xd854('0x1b')](function(_0x283758){logger[_0xd854('0x17')](_0xd854('0x29'),_0x283758[_0xd854('0x19')],_0xa0ed54);_0x1b13f2(_this[_0xd854('0x17')](0x1f4,_0x283758[_0xd854('0x19')]));});});}; \ No newline at end of file +var _0x357d=['SmsInteraction','options','raw','attributes','limit','UpdateSmsInteraction','debug','find','then','body','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x5e79db,_0x22b81f){var _0x2bc823=function(_0x4ffafd){while(--_0x4ffafd){_0x5e79db['push'](_0x5e79db['shift']());}};_0x2bc823(++_0x22b81f);}(_0x357d,0xae));var _0xd357=function(_0x5e428a,_0x1cf613){_0x5e428a=_0x5e428a-0x0;var _0x13cbc2=_0x357d[_0x5e428a];return _0x13cbc2;};'use strict';var _=require(_0xd357('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd357('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd357('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd357('0x3'));var logger=require(_0xd357('0x4'))(_0xd357('0x5'));var config=require(_0xd357('0x6'));var jayson=require(_0xd357('0x7'));var client=jayson[_0xd357('0x8')][_0xd357('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd357('0xa'),'port':0x18eb});var socket=require(_0xd357('0xb'))(new Redis(config[_0xd357('0xc')]));require(_0xd357('0xd'))[_0xd357('0xe')](socket);function respondWithRpcPromise(_0x81f92e,_0x468aef,_0x1fbefc){return new BPromise(function(_0xc35e1f,_0x11a818){return client[_0xd357('0xf')](_0x81f92e,_0x1fbefc)['then'](function(_0x5f5aa9){logger['info'](_0xd357('0x10'),_0x468aef,_0xd357('0x11'));logger['debug'](_0xd357('0x12'),_0x468aef,_0xd357('0x11'),JSON[_0xd357('0x13')](_0x5f5aa9));if(_0x5f5aa9['error']){if(_0x5f5aa9[_0xd357('0x14')][_0xd357('0x15')]===0x1f4){logger['error'](_0xd357('0x10'),_0x468aef,_0x5f5aa9[_0xd357('0x14')][_0xd357('0x16')]);return _0x11a818(_0x5f5aa9[_0xd357('0x14')]['message']);}logger[_0xd357('0x14')](_0xd357('0x10'),_0x468aef,_0x5f5aa9[_0xd357('0x14')][_0xd357('0x16')]);return _0xc35e1f(_0x5f5aa9[_0xd357('0x14')]['message']);}else{logger[_0xd357('0x17')](_0xd357('0x10'),_0x468aef,_0xd357('0x11'));_0xc35e1f(_0x5f5aa9[_0xd357('0x18')][_0xd357('0x16')]);}})[_0xd357('0x19')](function(_0x26396b){logger[_0xd357('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x468aef,_0x26396b);_0x11a818(_0x26396b);});});}exports['UpdateSmsInteraction']=function(_0x3f852c){var _0x3dc6c8=this;return new Promise(function(_0x4378b3,_0x5e9d30){return db[_0xd357('0x1a')]['update'](_0x3f852c['body'],{'raw':_0x3f852c[_0xd357('0x1b')]?_0x3f852c[_0xd357('0x1b')][_0xd357('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f852c[_0xd357('0x1b')]?_0x3f852c['options']['where']||null:null,'attributes':_0x3f852c[_0xd357('0x1b')]?_0x3f852c[_0xd357('0x1b')][_0xd357('0x1d')]||null:null,'limit':_0x3f852c[_0xd357('0x1b')]?_0x3f852c['options'][_0xd357('0x1e')]||null:null})['then'](function(_0x3a44dc){logger[_0xd357('0x17')](_0xd357('0x1f'),_0x3f852c);logger[_0xd357('0x20')](_0xd357('0x1f'),_0x3f852c,JSON['stringify'](_0x3a44dc));_0x4378b3(_0x3a44dc);})[_0xd357('0x19')](function(_0xdf47e2){logger[_0xd357('0x14')](_0xd357('0x1f'),_0xdf47e2[_0xd357('0x16')],_0x3f852c);_0x5e9d30(_0x3dc6c8[_0xd357('0x14')](0x1f4,_0xdf47e2[_0xd357('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4c73b9){return new Promise(function(_0x2e04f0,_0x426cd0){return db[_0xd357('0x1a')][_0xd357('0x21')]({'where':_0x4c73b9[_0xd357('0x1b')]?_0x4c73b9[_0xd357('0x1b')]['where']||null:null})[_0xd357('0x22')](function(_0x1758b5){if(_0x1758b5){return _0x1758b5['addTags'](_0x4c73b9[_0xd357('0x23')][_0xd357('0x24')],_[_0xd357('0x25')](_0x4c73b9[_0xd357('0x23')],[_0xd357('0x24'),'id'])||{});}})[_0xd357('0x26')](function(_0x3bac1c){logger[_0xd357('0x17')](_0xd357('0x27'),_0x4c73b9);logger[_0xd357('0x20')](_0xd357('0x27'),_0x4c73b9,JSON[_0xd357('0x13')](_0x3bac1c));_0x2e04f0(_0x3bac1c);})['catch'](function(_0x4b67ac){logger[_0xd357('0x14')](_0xd357('0x27'),_0x4b67ac['message'],_0x4c73b9);_0x426cd0(_this[_0xd357('0x14')](0x1f4,_0x4b67ac[_0xd357('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c89d9d2..d801fcc 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 _0x0ea6=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x4c26d5,_0x3c2b96){var _0x1f5058=function(_0x5af0fd){while(--_0x5af0fd){_0x4c26d5['push'](_0x4c26d5['shift']());}};_0x1f5058(++_0x3c2b96);}(_0x0ea6,0x1b7));var _0x60ea=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x0ea6[_0x75f869];return _0x10af8b;};'use strict';var SmsInteractionEvents=require(_0x60ea('0x0'));var events=['save',_0x60ea('0x1'),'update'];function createListener(_0x11e8ab,_0x226e50){return function(_0x285120){_0x226e50[_0x60ea('0x2')](_0x11e8ab,_0x285120);};}function removeListener(_0x428058,_0x576dc7){return function(){SmsInteractionEvents[_0x60ea('0x3')](_0x428058,_0x576dc7);};}exports[_0x60ea('0x4')]=function(_0x4e793d){for(var _0x248ec0=0x0,_0x2595dd=events['length'];_0x248ec0<_0x2595dd;_0x248ec0++){var _0x40babb=events[_0x248ec0];var _0x5adff0=createListener(_0x60ea('0x5')+_0x40babb,_0x4e793d);SmsInteractionEvents['on'](_0x40babb,_0x5adff0);}}; \ No newline at end of file +var _0xdf49=['smsInteraction:','./smsInteraction.events','save','remove','removeListener','register','length'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdf49,0xc5));var _0x9df4=function(_0x355adc,_0xac51ab){_0x355adc=_0x355adc-0x0;var _0x4df04f=_0xdf49[_0x355adc];return _0x4df04f;};'use strict';var SmsInteractionEvents=require(_0x9df4('0x0'));var events=[_0x9df4('0x1'),_0x9df4('0x2'),'update'];function createListener(_0x1e824f,_0x393e24){return function(_0x1471c1){_0x393e24['emit'](_0x1e824f,_0x1471c1);};}function removeListener(_0x255023,_0x56123c){return function(){SmsInteractionEvents[_0x9df4('0x3')](_0x255023,_0x56123c);};}exports[_0x9df4('0x4')]=function(_0x14974e){for(var _0x56c7ee=0x0,_0x1d8444=events[_0x9df4('0x5')];_0x56c7ee<_0x1d8444;_0x56c7ee++){var _0x4df4dc=events[_0x56c7ee];var _0x32a0e7=createListener(_0x9df4('0x6')+_0x4df4dc,_0x14974e);SmsInteractionEvents['on'](_0x4df4dc,_0x32a0e7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9dbfb4c..a87d07c 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 _0x7f8c=['isAuthenticated','index','/describe','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id','update','accept','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get'];(function(_0x35b7f3,_0x5a71bc){var _0x373395=function(_0x912f72){while(--_0x912f72){_0x35b7f3['push'](_0x35b7f3['shift']());}};_0x373395(++_0x5a71bc);}(_0x7f8c,0x139));var _0xc7f8=function(_0x199e5d,_0x3c5240){_0x199e5d=_0x199e5d-0x0;var _0x24df43=_0x7f8c[_0x199e5d];return _0x24df43;};'use strict';var multer=require(_0xc7f8('0x0'));var util=require(_0xc7f8('0x1'));var path=require(_0xc7f8('0x2'));var timeout=require(_0xc7f8('0x3'));var express=require(_0xc7f8('0x4'));var router=express[_0xc7f8('0x5')]();var fs_extra=require(_0xc7f8('0x6'));var auth=require(_0xc7f8('0x7'));var interaction=require(_0xc7f8('0x8'));var config=require('../../config/environment');var controller=require(_0xc7f8('0x9'));router[_0xc7f8('0xa')]('/',auth[_0xc7f8('0xb')](),controller[_0xc7f8('0xc')]);router[_0xc7f8('0xa')](_0xc7f8('0xd'),auth[_0xc7f8('0xb')](),controller['describe']);router[_0xc7f8('0xa')]('/:id',auth[_0xc7f8('0xb')](),controller['show']);router[_0xc7f8('0xe')]('/',auth['isAuthenticated'](),interaction[_0xc7f8('0xf')](_0xc7f8('0x10'),_0xc7f8('0x11')),controller['create']);router[_0xc7f8('0xe')](_0xc7f8('0x12'),controller[_0xc7f8('0x13')]);router[_0xc7f8('0x14')](_0xc7f8('0x15'),auth[_0xc7f8('0xb')](),controller[_0xc7f8('0x16')]);router['put']('/:id/accept',auth[_0xc7f8('0xb')](),controller[_0xc7f8('0x17')]);router['put']('/:id/reject',auth[_0xc7f8('0xb')](),controller[_0xc7f8('0x18')]);router[_0xc7f8('0x19')](_0xc7f8('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0xc7f8('0x1a')]=router; \ No newline at end of file +var _0x0dd9=['show','tracked','sms','smsmessage:create','create','post','/:id/status','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x468493,_0x475605){var _0x4164dd=function(_0xf865cb){while(--_0xf865cb){_0x468493['push'](_0x468493['shift']());}};_0x4164dd(++_0x475605);}(_0x0dd9,0x84));var _0x90dd=function(_0x642acf,_0x3f3893){_0x642acf=_0x642acf-0x0;var _0x5cceb3=_0x0dd9[_0x642acf];return _0x5cceb3;};'use strict';var multer=require(_0x90dd('0x0'));var util=require(_0x90dd('0x1'));var path=require('path');var timeout=require(_0x90dd('0x2'));var express=require(_0x90dd('0x3'));var router=express['Router']();var fs_extra=require(_0x90dd('0x4'));var auth=require(_0x90dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x90dd('0x6'));var controller=require(_0x90dd('0x7'));router[_0x90dd('0x8')]('/',auth[_0x90dd('0x9')](),controller[_0x90dd('0xa')]);router[_0x90dd('0x8')](_0x90dd('0xb'),auth['isAuthenticated'](),controller[_0x90dd('0xc')]);router[_0x90dd('0x8')]('/:id',auth[_0x90dd('0x9')](),controller[_0x90dd('0xd')]);router['post']('/',auth[_0x90dd('0x9')](),interaction[_0x90dd('0xe')](_0x90dd('0xf'),_0x90dd('0x10')),controller[_0x90dd('0x11')]);router[_0x90dd('0x12')](_0x90dd('0x13'),controller['status']);router['put'](_0x90dd('0x14'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x15')]);router[_0x90dd('0x16')](_0x90dd('0x17'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x18')]);router[_0x90dd('0x16')](_0x90dd('0x19'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x1a')]);router[_0x90dd('0x1b')](_0x90dd('0x14'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ec846b8..837e5b8 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 _0x29a3=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports','medium'];(function(_0xadc5a1,_0x3c7534){var _0x13e6d3=function(_0x5c025f){while(--_0x5c025f){_0xadc5a1['push'](_0xadc5a1['shift']());}};_0x13e6d3(++_0x3c7534);}(_0x29a3,0x141));var _0x329a=function(_0x483430,_0x42af86){_0x483430=_0x483430-0x0;var _0x393080=_0x29a3[_0x483430];return _0x393080;};'use strict';var Sequelize=require(_0x329a('0x0'));module[_0x329a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x329a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x329a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x329a('0x4')]('in','out'),'defaultValue':_0x329a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x329a('0x6')](0xbe)},'phone':{'type':Sequelize[_0x329a('0x6')]},'readAt':{'type':Sequelize[_0x329a('0x7')]},'secret':{'type':Sequelize[_0x329a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x329a('0x6')]},'providerResponse':{'type':Sequelize[_0x329a('0x8')]}}; \ No newline at end of file +var _0xb4a0=['medium','BOOLEAN','ENUM','out','STRING','sequelize','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb4a0,0x1e8));var _0x0b4a=function(_0x485610,_0x3e4b0a){_0x485610=_0x485610-0x0;var _0x4245d2=_0xb4a0[_0x485610];return _0x4245d2;};'use strict';var Sequelize=require(_0x0b4a('0x0'));module['exports']={'body':{'type':Sequelize[_0x0b4a('0x1')](_0x0b4a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0b4a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0b4a('0x4')]('in',_0x0b4a('0x5')),'defaultValue':_0x0b4a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0b4a('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0b4a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0b4a('0x6')]},'providerResponse':{'type':Sequelize[_0x0b4a('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 8dfd20b..9b0e655 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 _0x3166=['Sequelize','SELECT','contact','agent','email','internal','interface','channel','event','EventManager','acceptmessage','SmsInteractionId','RejectMessage','rejectMessage','QueryTypes','User','fullname','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','type','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','SmsMessage','include','findAll','show','params','length','includeAll','find','create','body','update','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3166,0xbb));var _0x6316=function(_0x4d0a6f,_0x500edd){_0x4d0a6f=_0x4d0a6f-0x0;var _0x256248=_0x3166[_0x4d0a6f];return _0x256248;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6316('0x0'));var zipdir=require(_0x6316('0x1'));var jsonpatch=require(_0x6316('0x2'));var rp=require('request-promise');var moment=require(_0x6316('0x3'));var BPromise=require(_0x6316('0x4'));var Mustache=require('mustache');var util=require(_0x6316('0x5'));var path=require(_0x6316('0x6'));var sox=require('sox');var csv=require(_0x6316('0x7'));var ejs=require(_0x6316('0x8'));var fs=require('fs');var fs_extra=require(_0x6316('0x9'));var _=require(_0x6316('0xa'));var squel=require('squel');var crypto=require(_0x6316('0xb'));var jsforce=require(_0x6316('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6316('0x7'));var querystring=require(_0x6316('0xd'));var Papa=require(_0x6316('0xe'));var Redis=require(_0x6316('0xf'));var authService=require(_0x6316('0x10'));var qs=require(_0x6316('0x11'));var as=require(_0x6316('0x12'));var hardwareService=require(_0x6316('0x13'));var logger=require(_0x6316('0x14'))(_0x6316('0x15'));var utils=require(_0x6316('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6316('0x17'));var db=require(_0x6316('0x18'))['db'];config[_0x6316('0x19')]=_[_0x6316('0x1a')](config[_0x6316('0x19')],{'host':_0x6316('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6316('0x19')]));require(_0x6316('0x1c'))[_0x6316('0x1d')](socket);var jayson=require(_0x6316('0x1e'));var client=jayson['client'][_0x6316('0x1f')]({'port':0x232c});var client9002=jayson[_0x6316('0x20')][_0x6316('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x493139,_0x22348f,_0x5583fb,_0x5cc9c6){return new BPromise(function(_0x31b704,_0x4105d9){var _0x3f9e07=_0x5cc9c6||client;return _0x3f9e07[_0x6316('0x21')](_0x493139,_0x5583fb)['then'](function(_0x485ee8){logger[_0x6316('0x22')](_0x6316('0x23'),_0x22348f,_0x6316('0x24'));logger[_0x6316('0x25')](_0x6316('0x26'),_0x22348f,_0x6316('0x24'),JSON[_0x6316('0x27')](_0x485ee8));if(_0x485ee8[_0x6316('0x28')]){if(_0x485ee8[_0x6316('0x28')][_0x6316('0x29')]===0x1f4){logger[_0x6316('0x28')]('SmsMessage,\x20%s,\x20%s',_0x22348f,_0x485ee8[_0x6316('0x28')][_0x6316('0x2a')]);return _0x4105d9(_0x485ee8[_0x6316('0x28')][_0x6316('0x2a')]);}logger[_0x6316('0x28')](_0x6316('0x23'),_0x22348f,_0x485ee8[_0x6316('0x28')][_0x6316('0x2a')]);return _0x31b704(_0x485ee8['error'][_0x6316('0x2a')]);}else{logger[_0x6316('0x22')](_0x6316('0x23'),_0x22348f,_0x6316('0x24'));_0x31b704(_0x485ee8['result'][_0x6316('0x2a')]);}})[_0x6316('0x2b')](function(_0x11a2b1){logger['error'](_0x6316('0x23'),_0x22348f,_0x11a2b1);_0x4105d9(_0x11a2b1);});});}function respondWithStatusCode(_0x443260,_0x271379){_0x271379=_0x271379||0xcc;return function(_0x16a64b){if(_0x16a64b){return _0x443260[_0x6316('0x2c')](_0x271379);}return _0x443260[_0x6316('0x2d')](_0x271379)[_0x6316('0x2e')]();};}function respondWithResult(_0x40b04f,_0xed60e){_0xed60e=_0xed60e||0xc8;return function(_0x575e0e){if(_0x575e0e){return _0x40b04f[_0x6316('0x2d')](_0xed60e)[_0x6316('0x2f')](_0x575e0e);}};}function respondWithFilteredResult(_0x546eae,_0x30b984){return function(_0x49a51c){if(_0x49a51c){var _0x33c001=typeof _0x30b984[_0x6316('0x30')]==='undefined'&&typeof _0x30b984['limit']===_0x6316('0x31');var _0x4f97fc=_0x49a51c['count'];var _0x48d6f6=_0x33c001?0x0:_0x30b984['offset'];var _0x14f449=_0x33c001?_0x49a51c[_0x6316('0x32')]:_0x30b984[_0x6316('0x30')]+_0x30b984['limit'];var _0x813c7e;if(_0x14f449>=_0x4f97fc){_0x14f449=_0x4f97fc;_0x813c7e=0xc8;}else{_0x813c7e=0xce;}_0x546eae[_0x6316('0x2d')](_0x813c7e);return _0x546eae[_0x6316('0x33')](_0x6316('0x34'),_0x48d6f6+'-'+_0x14f449+'/'+_0x4f97fc)[_0x6316('0x2f')](_0x49a51c);}return null;};}function patchUpdates(_0x33a062){return function(_0xdcfc65){try{jsonpatch[_0x6316('0x35')](_0xdcfc65,_0x33a062,!![]);}catch(_0x5b8e34){return BPromise[_0x6316('0x36')](_0x5b8e34);}return _0xdcfc65[_0x6316('0x37')]();};}function saveUpdates(_0x338b19,_0x3d624e){return function(_0x2913a9){if(_0x2913a9){return _0x2913a9['update'](_0x338b19)[_0x6316('0x38')](function(_0x470118){return _0x470118;});}return null;};}function removeEntity(_0x5c9ae3,_0x3e7c4a){return function(_0x3ae0fa){if(_0x3ae0fa){return _0x3ae0fa[_0x6316('0x39')]()[_0x6316('0x38')](function(){_0x5c9ae3['status'](0xcc)[_0x6316('0x2e')]();});}};}function handleEntityNotFound(_0x1585c5,_0x576352){return function(_0x41fe95){if(!_0x41fe95){_0x1585c5[_0x6316('0x2c')](0x194);}return _0x41fe95;};}function handleError(_0x1b48e3,_0x2df171){_0x2df171=_0x2df171||0x1f4;return function(_0x1e1c7c){logger[_0x6316('0x28')](_0x1e1c7c[_0x6316('0x3a')]);if(_0x1e1c7c['name']){delete _0x1e1c7c[_0x6316('0x3b')];}_0x1b48e3[_0x6316('0x2d')](_0x2df171)[_0x6316('0x3c')](_0x1e1c7c);};}exports[_0x6316('0x3d')]=function(_0x1c8bde,_0x4eb3a9){var _0x4719a1={},_0x26f946={},_0x3094a4={'count':0x0,'rows':[]};var _0x2bba06=_[_0x6316('0x3e')](db['SmsMessage'][_0x6316('0x3f')],function(_0x483873){return{'name':_0x483873['fieldName'],'type':_0x483873['type'][_0x6316('0x40')]};});_0x26f946['model']=_['map'](_0x2bba06,_0x6316('0x3b'));_0x26f946[_0x6316('0x41')]=_[_0x6316('0x42')](_0x1c8bde['query']);_0x26f946[_0x6316('0x43')]=_[_0x6316('0x44')](_0x26f946[_0x6316('0x45')],_0x26f946[_0x6316('0x41')]);_0x4719a1[_0x6316('0x46')]=_[_0x6316('0x44')](_0x26f946['model'],qs[_0x6316('0x47')](_0x1c8bde['query'][_0x6316('0x47')]));_0x4719a1[_0x6316('0x46')]=_0x4719a1[_0x6316('0x46')]['length']?_0x4719a1['attributes']:_0x26f946[_0x6316('0x45')];if(!_0x1c8bde['query'][_0x6316('0x48')]('nolimit')){_0x4719a1['limit']=qs['limit'](_0x1c8bde[_0x6316('0x41')][_0x6316('0x49')]);_0x4719a1['offset']=qs[_0x6316('0x30')](_0x1c8bde[_0x6316('0x41')][_0x6316('0x30')]);}_0x4719a1[_0x6316('0x4a')]=qs[_0x6316('0x4b')](_0x1c8bde[_0x6316('0x41')]['sort']);_0x4719a1['where']=qs[_0x6316('0x43')](_[_0x6316('0x4c')](_0x1c8bde[_0x6316('0x41')],_0x26f946[_0x6316('0x43')]),_0x2bba06);if(_0x1c8bde[_0x6316('0x41')][_0x6316('0x4d')]){_0x4719a1[_0x6316('0x4e')]=_[_0x6316('0x4f')](_0x4719a1[_0x6316('0x4e')],{'$or':_[_0x6316('0x3e')](_0x2bba06,function(_0x10ed4b){if(_0x10ed4b['type']!=='VIRTUAL'){var _0xac392={};_0xac392[_0x10ed4b[_0x6316('0x3b')]]={'$like':'%'+_0x1c8bde[_0x6316('0x41')]['filter']+'%'};return _0xac392;}})});}_0x4719a1=_['merge']({},_0x4719a1,_0x1c8bde[_0x6316('0x50')]);var _0x505163={'where':_0x4719a1['where']};return db[_0x6316('0x51')]['count'](_0x505163)[_0x6316('0x38')](function(_0x1a2065){_0x3094a4[_0x6316('0x32')]=_0x1a2065;if(_0x1c8bde[_0x6316('0x41')]['includeAll']){_0x4719a1[_0x6316('0x52')]=[{'all':!![]}];}return db[_0x6316('0x51')][_0x6316('0x53')](_0x4719a1);})[_0x6316('0x38')](function(_0x2d4c59){_0x3094a4['rows']=_0x2d4c59;return _0x3094a4;})['then'](respondWithFilteredResult(_0x4eb3a9,_0x4719a1))[_0x6316('0x2b')](handleError(_0x4eb3a9,null));};exports[_0x6316('0x54')]=function(_0x30ace8,_0x3d8ca1){var _0x565dc3={'raw':!![],'where':{'id':_0x30ace8[_0x6316('0x55')]['id']}},_0x1a4efc={};_0x1a4efc[_0x6316('0x45')]=_['keys'](db[_0x6316('0x51')]['rawAttributes']);_0x1a4efc[_0x6316('0x41')]=_[_0x6316('0x42')](_0x30ace8[_0x6316('0x41')]);_0x1a4efc['filters']=_[_0x6316('0x44')](_0x1a4efc[_0x6316('0x45')],_0x1a4efc['query']);_0x565dc3[_0x6316('0x46')]=_[_0x6316('0x44')](_0x1a4efc[_0x6316('0x45')],qs[_0x6316('0x47')](_0x30ace8['query']['fields']));_0x565dc3[_0x6316('0x46')]=_0x565dc3[_0x6316('0x46')][_0x6316('0x56')]?_0x565dc3[_0x6316('0x46')]:_0x1a4efc[_0x6316('0x45')];if(_0x30ace8[_0x6316('0x41')][_0x6316('0x57')]){_0x565dc3[_0x6316('0x52')]=[{'all':!![]}];}_0x565dc3=_[_0x6316('0x4f')]({},_0x565dc3,_0x30ace8['options']);return db[_0x6316('0x51')][_0x6316('0x58')](_0x565dc3)[_0x6316('0x38')](handleEntityNotFound(_0x3d8ca1,null))[_0x6316('0x38')](respondWithResult(_0x3d8ca1,null))[_0x6316('0x2b')](handleError(_0x3d8ca1,null));};exports['create']=function(_0x10bd6d,_0x513426){return db[_0x6316('0x51')][_0x6316('0x59')](_0x10bd6d[_0x6316('0x5a')],{})[_0x6316('0x38')](respondWithResult(_0x513426,0xc9))['catch'](handleError(_0x513426,null));};exports[_0x6316('0x5b')]=function(_0x6bc9bd,_0x4cc49e){if(_0x6bc9bd[_0x6316('0x5a')]['id']){delete _0x6bc9bd[_0x6316('0x5a')]['id'];}return db[_0x6316('0x51')][_0x6316('0x58')]({'where':{'id':_0x6bc9bd[_0x6316('0x55')]['id']}})[_0x6316('0x38')](handleEntityNotFound(_0x4cc49e,null))[_0x6316('0x38')](saveUpdates(_0x6bc9bd['body'],null))['then'](respondWithResult(_0x4cc49e,null))[_0x6316('0x2b')](handleError(_0x4cc49e,null));};exports[_0x6316('0x39')]=function(_0x523d7d,_0x573af8){return db['SmsMessage'][_0x6316('0x58')]({'where':{'id':_0x523d7d[_0x6316('0x55')]['id']}})[_0x6316('0x38')](handleEntityNotFound(_0x573af8,null))['then'](removeEntity(_0x573af8,null))[_0x6316('0x2b')](handleError(_0x573af8,null));};exports[_0x6316('0x5c')]=function(_0x23ae59,_0x225ab3){return db['SmsMessage'][_0x6316('0x5c')]()[_0x6316('0x38')](respondWithResult(_0x225ab3,null))['catch'](handleError(_0x225ab3,null));};var interaction_log=require('../../config/logger')(_0x6316('0x5d'));exports[_0x6316('0x5e')]=function(_0x2b5af0,_0xaf0e04,_0x194300){var _0x51f3db={'agent':{},'channel':_0x6316('0x5f')};if(_0x2b5af0[_0x6316('0x5a')]['id']){delete _0x2b5af0[_0x6316('0x5a')]['id'];}_0x2b5af0[_0x6316('0x5a')][_0x6316('0x60')]=!![];_0x2b5af0[_0x6316('0x5a')][_0x6316('0x61')]=moment()['format'](_0x6316('0x62'));_0x2b5af0[_0x6316('0x5a')][_0x6316('0x63')]=_0x2b5af0[_0x6316('0x5a')][_0x6316('0x63')]||_0x2b5af0[_0x6316('0x64')]['id'];_0x51f3db['agent']['id']=_0x2b5af0[_0x6316('0x5a')][_0x6316('0x63')];return db[_0x6316('0x51')][_0x6316('0x58')]({'where':{'id':_0x2b5af0[_0x6316('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xaf0e04,null))[_0x6316('0x38')](saveUpdates(_0x2b5af0['body'],null))[_0x6316('0x38')](function(_0x5aac94){if(_0x5aac94){_0x51f3db['message']=_0x5aac94[_0x6316('0x65')]({'plain':!![]});return db[_0x6316('0x66')][_0x6316('0x58')]({'where':{'id':_0x5aac94['SmsInteractionId']}});}return null;})[_0x6316('0x38')](handleEntityNotFound(_0xaf0e04,null))['then'](function(_0x359323){if(_0x359323){return _0x359323[_0x6316('0x5b')]({'UserId':_0x2b5af0[_0x6316('0x5a')]['UserId'],'read1stAt':_[_0x6316('0x67')](_0x359323[_0x6316('0x68')])?moment()[_0x6316('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6316('0x38')](function(_0x2a9060){if(_0x2a9060){_0x51f3db[_0x6316('0x6a')]=_0x2a9060['get']({'plain':!![]});interaction_log[_0x6316('0x22')](_0x6316('0x6b'),_0x2b5af0['user']['id'],_0x2b5af0[_0x6316('0x64')][_0x6316('0x3b')],_0x2b5af0[_0x6316('0x64')][_0x6316('0x6c')],_0x51f3db['interaction']['id'],_0x2b5af0[_0x6316('0x5a')]?JSON[_0x6316('0x27')](_0x2b5af0[_0x6316('0x5a')]):_0x6316('0x6d'));return respondWithRpcPromise(_0x6316('0x6e'),_0x6316('0x6f'),_0x51f3db);}return null;})[_0x6316('0x38')](function(_0x1fb3f3){var _0x4c1f66=_0x6316('0x70')+_0x1fb3f3[_0x6316('0x2a')][_0x6316('0x71')];return db[_0x6316('0x72')][_0x6316('0x41')](_0x4c1f66,{'type':db[_0x6316('0x73')]['QueryTypes'][_0x6316('0x74')],'raw':!![]})['then'](function(_0x1d8170){return _0x1d8170;});})[_0x6316('0x38')](function(_0x50db9f){if(_0x50db9f){_0x51f3db['message'][_0x6316('0x75')]=_0x50db9f[0x0];if(!_0x2b5af0[_0x6316('0x5a')]['UserId'])return;return db['User'][_0x6316('0x58')]({'where':{'id':_0x2b5af0['body'][_0x6316('0x63')],'role':_0x6316('0x76')},'attributes':['id','name','fullname',_0x6316('0x77'),_0x6316('0x78')],'raw':!![]});}return null;})[_0x6316('0x38')](function(_0x2eee75){if(!_0x2eee75)return null;_0x51f3db['message'][_0x6316('0x76')]=_0x2eee75;return _0x51f3db;})[_0x6316('0x38')](function(_0x5d0375){if(_0x5d0375){if(_0x2b5af0[_0x6316('0x5a')]['manual']){_0x51f3db['message'][_0x6316('0x79')]=util[_0x6316('0x69')]('SIP/%s',_0x2b5af0[_0x6316('0x64')][_0x6316('0x3b')]);_0x51f3db[_0x6316('0x2a')][_0x6316('0x7a')]=_0x51f3db[_0x6316('0x7a')];_0x51f3db['message']['motionChannel']=_0x51f3db['channel'];_0x51f3db[_0x6316('0x2a')][_0x6316('0x7b')]=_0x6316('0x5e');return respondWithRpcPromise(_0x6316('0x7c'),_0x6316('0x7c'),{'event':_0x6316('0x7d'),'message':_0x51f3db[_0x6316('0x2a')]},client9002)[_0x6316('0x38')](function(){return _0x51f3db;});}return _0x51f3db;}return null;})['then'](respondWithResult(_0xaf0e04,null))[_0x6316('0x2b')](handleError(_0xaf0e04,null));};var interaction_log=require(_0x6316('0x14'))(_0x6316('0x5d'));exports[_0x6316('0x36')]=function(_0x1a025e,_0x38cb1b,_0x24629e){var _0x4da695={'agent':{},'channel':'sms'};if(_0x1a025e['body']['id']){delete _0x1a025e[_0x6316('0x5a')]['id'];}_0x1a025e['body'][_0x6316('0x63')]=_0x1a025e['body'][_0x6316('0x63')]||_0x1a025e['user']['id'];_0x4da695[_0x6316('0x76')]['id']=_0x1a025e[_0x6316('0x5a')]['UserId'];return db[_0x6316('0x51')][_0x6316('0x58')]({'where':{'id':_0x1a025e[_0x6316('0x55')]['id'],'UserId':null}})[_0x6316('0x38')](handleEntityNotFound(_0x38cb1b,null))[_0x6316('0x38')](function(_0x291cff){if(_0x291cff){_0x4da695[_0x6316('0x2a')]=_0x291cff[_0x6316('0x65')]({'plain':!![]});return db[_0x6316('0x66')][_0x6316('0x58')]({'where':{'id':_0x291cff[_0x6316('0x7e')]}});}return null;})[_0x6316('0x38')](handleEntityNotFound(_0x38cb1b,null))[_0x6316('0x38')](function(_0x34f474){if(_0x34f474){_0x4da695[_0x6316('0x6a')]=_0x34f474['get']({'plain':!![]});interaction_log[_0x6316('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a025e[_0x6316('0x64')]['id'],_0x1a025e['user'][_0x6316('0x3b')],_0x1a025e['user'][_0x6316('0x6c')],_0x4da695[_0x6316('0x6a')]['id'],_0x1a025e[_0x6316('0x5a')]?JSON['stringify'](_0x1a025e['body']):'null');return respondWithRpcPromise(_0x6316('0x7f'),_0x6316('0x80'),_0x4da695);}return null;})[_0x6316('0x38')](function(_0x41ef09){var _0x1eb3ec=_0x6316('0x70')+_0x41ef09[_0x6316('0x2a')]['ContactId'];return db[_0x6316('0x72')][_0x6316('0x41')](_0x1eb3ec,{'type':db[_0x6316('0x73')][_0x6316('0x81')][_0x6316('0x74')],'raw':!![]})['then'](function(_0x3b82b6){return _0x3b82b6;});})[_0x6316('0x38')](function(_0xaa5a49){if(_0xaa5a49){_0x4da695[_0x6316('0x2a')][_0x6316('0x75')]=_0xaa5a49[0x0];if(!_0x1a025e['body']['UserId'])return;return db[_0x6316('0x82')][_0x6316('0x58')]({'where':{'id':_0x1a025e[_0x6316('0x5a')][_0x6316('0x63')],'role':_0x6316('0x76')},'attributes':['id',_0x6316('0x3b'),_0x6316('0x83'),_0x6316('0x77'),_0x6316('0x78')],'raw':!![]});}return null;})['then'](function(_0x6b3b11){if(!_0x6b3b11)return null;_0x4da695[_0x6316('0x2a')][_0x6316('0x76')]=_0x6b3b11;return _0x4da695;})[_0x6316('0x38')](function(_0x1f9b1a){if(_0x1f9b1a){_0x1f9b1a[_0x6316('0x2a')][_0x6316('0x79')]=util[_0x6316('0x69')]('SIP/%s',_0x1a025e[_0x6316('0x64')]['name']);_0x1f9b1a[_0x6316('0x2a')][_0x6316('0x7a')]=_0x4da695['channel'];_0x1f9b1a[_0x6316('0x2a')]['motionChannel']=_0x4da695[_0x6316('0x7a')];_0x1f9b1a['message'][_0x6316('0x7b')]=_0x6316('0x36');respondWithRpcPromise(_0x6316('0x7c'),_0x6316('0x7c'),{'event':_0x6316('0x84'),'message':_0x1f9b1a[_0x6316('0x2a')]},client9002);return _0x4da695;}return null;})[_0x6316('0x38')](respondWithResult(_0x38cb1b,null))[_0x6316('0x2b')](handleError(_0x38cb1b,null));};exports[_0x6316('0x2d')]=function(_0x33b928,_0x214b09,_0x1d09a7){if(_0x33b928[_0x6316('0x5a')]['id']){delete _0x33b928[_0x6316('0x5a')]['id'];}var _0x156bd4;return db[_0x6316('0x51')][_0x6316('0x58')]({'where':{'id':_0x33b928['params']['id']}})['then'](handleEntityNotFound(_0x214b09,null))['then'](function(_0x308b17){if(_0x308b17){_0x156bd4=_0x308b17;return db[_0x6316('0x85')][_0x6316('0x58')]({'where':{'id':_0x308b17[_0x6316('0x86')]}});}})['then'](handleEntityNotFound(_0x214b09,null))[_0x6316('0x38')](function(_0x2d9eef){if(_0x2d9eef){logger[_0x6316('0x25')](_0x6316('0x26'),_0x6316('0x2d'),_0x6316('0x87'),_0x2d9eef['type'],util[_0x6316('0x88')](_0x33b928['body'],{'showHidden':![],'depth':null}));switch(_0x2d9eef[_0x6316('0x89')]){case _0x6316('0x8a'):if(_0x33b928[_0x6316('0x5a')]['MessageSid']&&_0x33b928[_0x6316('0x5a')][_0x6316('0x8b')]===_0x156bd4[_0x6316('0x8c')]){return _0x156bd4['update']({'read':!![]});}else{logger[_0x6316('0x28')](_0x6316('0x8d'),_0x6316('0x2d'),_0x6316('0x8a'),util[_0x6316('0x88')](_0x33b928['body'],{'showHidden':![],'depth':null}));}break;case _0x6316('0x8e'):if(_0x33b928[_0x6316('0x5a')][_0x6316('0x8f')]&&_0x33b928[_0x6316('0x5a')][_0x6316('0x8f')]===_0x156bd4[_0x6316('0x8c')]&&_[_0x6316('0x90')]([_0x6316('0x91'),_0x6316('0x92')],_0x33b928['body']['Status'])>=0x0){return _0x156bd4[_0x6316('0x5b')]({'read':!![]});}else{logger[_0x6316('0x28')](_0x6316('0x8d'),_0x6316('0x2d'),'plivio',util['inspect'](_0x33b928['body'],{'showHidden':![],'depth':null}));}break;case _0x6316('0x93'):var _0x22f1d1=_0x33b928[_0x6316('0x5a')][_0x6316('0x94')][0x0];if(_0x22f1d1[_0x6316('0x2d')][_0x6316('0x95')]===_0x6316('0x96')){return _0x156bd4[_0x6316('0x5b')]({'read':!![]});}else{logger[_0x6316('0x28')](_0x6316('0x8d'),'status',_0x6316('0x93'),util[_0x6316('0x88')](_0x33b928[_0x6316('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x156bd4;}})[_0x6316('0x38')](respondWithResult(_0x214b09,null))[_0x6316('0x2b')](handleError(_0x214b09,null));}; \ No newline at end of file +var _0xc17d=['delivered','Status','infobip','results','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','reject','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','create','body','update','describe','sms-interactions','accept','sms','read','UserId','user','agent','SmsInteraction','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','MessageUUID','indexOf','sent'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0xc17d,0x96));var _0xdc17=function(_0x27a68e,_0x1eaf96){_0x27a68e=_0x27a68e-0x0;var _0x5eb387=_0xc17d[_0x27a68e];return _0x5eb387;};'use strict';var emlformat=require(_0xdc17('0x0'));var rimraf=require(_0xdc17('0x1'));var zipdir=require(_0xdc17('0x2'));var jsonpatch=require(_0xdc17('0x3'));var rp=require('request-promise');var moment=require(_0xdc17('0x4'));var BPromise=require(_0xdc17('0x5'));var Mustache=require(_0xdc17('0x6'));var util=require(_0xdc17('0x7'));var path=require('path');var sox=require(_0xdc17('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc17('0x9'));var _=require('lodash');var squel=require(_0xdc17('0xa'));var crypto=require(_0xdc17('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc17('0xc'));var querystring=require(_0xdc17('0xd'));var Papa=require(_0xdc17('0xe'));var Redis=require(_0xdc17('0xf'));var authService=require(_0xdc17('0x10'));var qs=require(_0xdc17('0x11'));var as=require(_0xdc17('0x12'));var hardwareService=require(_0xdc17('0x13'));var logger=require('../../config/logger')(_0xdc17('0x14'));var utils=require(_0xdc17('0x15'));var config=require(_0xdc17('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc17('0x17'))['db'];config['redis']=_[_0xdc17('0x18')](config[_0xdc17('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc17('0x1a'))(new Redis(config[_0xdc17('0x19')]));require('./smsMessage.socket')[_0xdc17('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdc17('0x1c')][_0xdc17('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xdc17('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x428c8c,_0x17ff01,_0x30f50a,_0x5d847f){return new BPromise(function(_0x3adc90,_0x50eadc){var _0x324272=_0x5d847f||client;return _0x324272[_0xdc17('0x1e')](_0x428c8c,_0x30f50a)[_0xdc17('0x1f')](function(_0x3f578b){logger[_0xdc17('0x20')](_0xdc17('0x21'),_0x17ff01,'request\x20sent');logger[_0xdc17('0x22')](_0xdc17('0x23'),_0x17ff01,_0xdc17('0x24'),JSON[_0xdc17('0x25')](_0x3f578b));if(_0x3f578b[_0xdc17('0x26')]){if(_0x3f578b[_0xdc17('0x26')]['code']===0x1f4){logger[_0xdc17('0x26')](_0xdc17('0x21'),_0x17ff01,_0x3f578b['error'][_0xdc17('0x27')]);return _0x50eadc(_0x3f578b[_0xdc17('0x26')][_0xdc17('0x27')]);}logger[_0xdc17('0x26')](_0xdc17('0x21'),_0x17ff01,_0x3f578b['error'][_0xdc17('0x27')]);return _0x3adc90(_0x3f578b[_0xdc17('0x26')]['message']);}else{logger['info'](_0xdc17('0x21'),_0x17ff01,'request\x20sent');_0x3adc90(_0x3f578b[_0xdc17('0x28')]['message']);}})[_0xdc17('0x29')](function(_0x519795){logger['error'](_0xdc17('0x21'),_0x17ff01,_0x519795);_0x50eadc(_0x519795);});});}function respondWithStatusCode(_0x443ddb,_0x25930f){_0x25930f=_0x25930f||0xcc;return function(_0x177ee){if(_0x177ee){return _0x443ddb[_0xdc17('0x2a')](_0x25930f);}return _0x443ddb[_0xdc17('0x2b')](_0x25930f)[_0xdc17('0x2c')]();};}function respondWithResult(_0x2aede3,_0x20f45b){_0x20f45b=_0x20f45b||0xc8;return function(_0x573f37){if(_0x573f37){return _0x2aede3[_0xdc17('0x2b')](_0x20f45b)['json'](_0x573f37);}};}function respondWithFilteredResult(_0x879d4b,_0xc167e5){return function(_0x10f197){if(_0x10f197){var _0x49fd56=typeof _0xc167e5[_0xdc17('0x2d')]===_0xdc17('0x2e')&&typeof _0xc167e5['limit']===_0xdc17('0x2e');var _0x4b0212=_0x10f197[_0xdc17('0x2f')];var _0x593265=_0x49fd56?0x0:_0xc167e5['offset'];var _0x1863da=_0x49fd56?_0x10f197['count']:_0xc167e5['offset']+_0xc167e5[_0xdc17('0x30')];var _0x8b3d82;if(_0x1863da>=_0x4b0212){_0x1863da=_0x4b0212;_0x8b3d82=0xc8;}else{_0x8b3d82=0xce;}_0x879d4b['status'](_0x8b3d82);return _0x879d4b['set']('Content-Range',_0x593265+'-'+_0x1863da+'/'+_0x4b0212)['json'](_0x10f197);}return null;};}function patchUpdates(_0xfe067){return function(_0x5ba44a){try{jsonpatch['apply'](_0x5ba44a,_0xfe067,!![]);}catch(_0x5b38a5){return BPromise[_0xdc17('0x31')](_0x5b38a5);}return _0x5ba44a['save']();};}function saveUpdates(_0x3ee4ce,_0x3d7e3f){return function(_0x14a1cb){if(_0x14a1cb){return _0x14a1cb['update'](_0x3ee4ce)[_0xdc17('0x1f')](function(_0x4ad744){return _0x4ad744;});}return null;};}function removeEntity(_0xc794fc,_0x1ef572){return function(_0x3082ac){if(_0x3082ac){return _0x3082ac[_0xdc17('0x32')]()[_0xdc17('0x1f')](function(){_0xc794fc[_0xdc17('0x2b')](0xcc)[_0xdc17('0x2c')]();});}};}function handleEntityNotFound(_0x478711,_0x2e1dcf){return function(_0xaddd44){if(!_0xaddd44){_0x478711['sendStatus'](0x194);}return _0xaddd44;};}function handleError(_0x488a26,_0x33527c){_0x33527c=_0x33527c||0x1f4;return function(_0x10f5a4){logger['error'](_0x10f5a4[_0xdc17('0x33')]);if(_0x10f5a4[_0xdc17('0x34')]){delete _0x10f5a4[_0xdc17('0x34')];}_0x488a26[_0xdc17('0x2b')](_0x33527c)[_0xdc17('0x35')](_0x10f5a4);};}exports[_0xdc17('0x36')]=function(_0x1b34a8,_0x1881a5){var _0x338a34={},_0x1c106c={},_0x31cc9a={'count':0x0,'rows':[]};var _0x4682f4=_[_0xdc17('0x37')](db[_0xdc17('0x38')][_0xdc17('0x39')],function(_0x1dcf3b){return{'name':_0x1dcf3b[_0xdc17('0x3a')],'type':_0x1dcf3b[_0xdc17('0x3b')]['key']};});_0x1c106c[_0xdc17('0x3c')]=_['map'](_0x4682f4,_0xdc17('0x34'));_0x1c106c['query']=_[_0xdc17('0x3d')](_0x1b34a8[_0xdc17('0x3e')]);_0x1c106c[_0xdc17('0x3f')]=_[_0xdc17('0x40')](_0x1c106c[_0xdc17('0x3c')],_0x1c106c[_0xdc17('0x3e')]);_0x338a34['attributes']=_[_0xdc17('0x40')](_0x1c106c[_0xdc17('0x3c')],qs[_0xdc17('0x41')](_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x41')]));_0x338a34[_0xdc17('0x42')]=_0x338a34[_0xdc17('0x42')][_0xdc17('0x43')]?_0x338a34[_0xdc17('0x42')]:_0x1c106c['model'];if(!_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x44')]('nolimit')){_0x338a34[_0xdc17('0x30')]=qs[_0xdc17('0x30')](_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x30')]);_0x338a34['offset']=qs['offset'](_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x2d')]);}_0x338a34[_0xdc17('0x45')]=qs[_0xdc17('0x46')](_0x1b34a8[_0xdc17('0x3e')]['sort']);_0x338a34[_0xdc17('0x47')]=qs[_0xdc17('0x3f')](_[_0xdc17('0x48')](_0x1b34a8[_0xdc17('0x3e')],_0x1c106c[_0xdc17('0x3f')]),_0x4682f4);if(_0x1b34a8[_0xdc17('0x3e')][_0xdc17('0x49')]){_0x338a34[_0xdc17('0x47')]=_[_0xdc17('0x4a')](_0x338a34[_0xdc17('0x47')],{'$or':_['map'](_0x4682f4,function(_0x21a632){if(_0x21a632[_0xdc17('0x3b')]!==_0xdc17('0x4b')){var _0x4f913b={};_0x4f913b[_0x21a632[_0xdc17('0x34')]]={'$like':'%'+_0x1b34a8[_0xdc17('0x3e')]['filter']+'%'};return _0x4f913b;}})});}_0x338a34=_[_0xdc17('0x4a')]({},_0x338a34,_0x1b34a8[_0xdc17('0x4c')]);var _0x467a53={'where':_0x338a34['where']};return db[_0xdc17('0x38')][_0xdc17('0x2f')](_0x467a53)['then'](function(_0x43a1f6){_0x31cc9a[_0xdc17('0x2f')]=_0x43a1f6;if(_0x1b34a8['query']['includeAll']){_0x338a34[_0xdc17('0x4d')]=[{'all':!![]}];}return db[_0xdc17('0x38')]['findAll'](_0x338a34);})[_0xdc17('0x1f')](function(_0xe2411){_0x31cc9a[_0xdc17('0x4e')]=_0xe2411;return _0x31cc9a;})[_0xdc17('0x1f')](respondWithFilteredResult(_0x1881a5,_0x338a34))[_0xdc17('0x29')](handleError(_0x1881a5,null));};exports[_0xdc17('0x4f')]=function(_0x3118c2,_0x5aaa2d){var _0x433f51={'raw':!![],'where':{'id':_0x3118c2[_0xdc17('0x50')]['id']}},_0x2abfd8={};_0x2abfd8[_0xdc17('0x3c')]=_[_0xdc17('0x3d')](db[_0xdc17('0x38')]['rawAttributes']);_0x2abfd8[_0xdc17('0x3e')]=_[_0xdc17('0x3d')](_0x3118c2[_0xdc17('0x3e')]);_0x2abfd8[_0xdc17('0x3f')]=_[_0xdc17('0x40')](_0x2abfd8[_0xdc17('0x3c')],_0x2abfd8[_0xdc17('0x3e')]);_0x433f51[_0xdc17('0x42')]=_['intersection'](_0x2abfd8['model'],qs[_0xdc17('0x41')](_0x3118c2[_0xdc17('0x3e')][_0xdc17('0x41')]));_0x433f51[_0xdc17('0x42')]=_0x433f51[_0xdc17('0x42')][_0xdc17('0x43')]?_0x433f51['attributes']:_0x2abfd8[_0xdc17('0x3c')];if(_0x3118c2[_0xdc17('0x3e')][_0xdc17('0x51')]){_0x433f51[_0xdc17('0x4d')]=[{'all':!![]}];}_0x433f51=_[_0xdc17('0x4a')]({},_0x433f51,_0x3118c2[_0xdc17('0x4c')]);return db[_0xdc17('0x38')][_0xdc17('0x52')](_0x433f51)[_0xdc17('0x1f')](handleEntityNotFound(_0x5aaa2d,null))[_0xdc17('0x1f')](respondWithResult(_0x5aaa2d,null))[_0xdc17('0x29')](handleError(_0x5aaa2d,null));};exports[_0xdc17('0x53')]=function(_0x357d34,_0x40bd27){return db[_0xdc17('0x38')][_0xdc17('0x53')](_0x357d34[_0xdc17('0x54')],{})[_0xdc17('0x1f')](respondWithResult(_0x40bd27,0xc9))[_0xdc17('0x29')](handleError(_0x40bd27,null));};exports[_0xdc17('0x55')]=function(_0x21955a,_0x136859){if(_0x21955a[_0xdc17('0x54')]['id']){delete _0x21955a[_0xdc17('0x54')]['id'];}return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0x21955a[_0xdc17('0x50')]['id']}})['then'](handleEntityNotFound(_0x136859,null))[_0xdc17('0x1f')](saveUpdates(_0x21955a[_0xdc17('0x54')],null))[_0xdc17('0x1f')](respondWithResult(_0x136859,null))[_0xdc17('0x29')](handleError(_0x136859,null));};exports[_0xdc17('0x32')]=function(_0xa06b0b,_0x2b293b){return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0xa06b0b['params']['id']}})['then'](handleEntityNotFound(_0x2b293b,null))[_0xdc17('0x1f')](removeEntity(_0x2b293b,null))[_0xdc17('0x29')](handleError(_0x2b293b,null));};exports[_0xdc17('0x56')]=function(_0xce6d5b,_0xf29943){return db[_0xdc17('0x38')][_0xdc17('0x56')]()[_0xdc17('0x1f')](respondWithResult(_0xf29943,null))[_0xdc17('0x29')](handleError(_0xf29943,null));};var interaction_log=require('../../config/logger')(_0xdc17('0x57'));exports[_0xdc17('0x58')]=function(_0x55415d,_0x1dfb48,_0x44736c){var _0x1a735a={'agent':{},'channel':_0xdc17('0x59')};if(_0x55415d[_0xdc17('0x54')]['id']){delete _0x55415d[_0xdc17('0x54')]['id'];}_0x55415d[_0xdc17('0x54')][_0xdc17('0x5a')]=!![];_0x55415d[_0xdc17('0x54')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55415d[_0xdc17('0x54')]['UserId']=_0x55415d[_0xdc17('0x54')][_0xdc17('0x5b')]||_0x55415d[_0xdc17('0x5c')]['id'];_0x1a735a[_0xdc17('0x5d')]['id']=_0x55415d[_0xdc17('0x54')][_0xdc17('0x5b')];return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0x55415d[_0xdc17('0x50')]['id'],'UserId':null}})[_0xdc17('0x1f')](handleEntityNotFound(_0x1dfb48,null))['then'](saveUpdates(_0x55415d['body'],null))[_0xdc17('0x1f')](function(_0x227ba0){if(_0x227ba0){_0x1a735a[_0xdc17('0x27')]=_0x227ba0['get']({'plain':!![]});return db[_0xdc17('0x5e')][_0xdc17('0x52')]({'where':{'id':_0x227ba0[_0xdc17('0x5f')]}});}return null;})[_0xdc17('0x1f')](handleEntityNotFound(_0x1dfb48,null))[_0xdc17('0x1f')](function(_0x3fce8d){if(_0x3fce8d){return _0x3fce8d[_0xdc17('0x55')]({'UserId':_0x55415d[_0xdc17('0x54')][_0xdc17('0x5b')],'read1stAt':_['isNil'](_0x3fce8d[_0xdc17('0x60')])?moment()['format'](_0xdc17('0x61')):undefined});}return null;})[_0xdc17('0x1f')](function(_0x43a782){if(_0x43a782){_0x1a735a[_0xdc17('0x62')]=_0x43a782[_0xdc17('0x63')]({'plain':!![]});interaction_log[_0xdc17('0x20')](_0xdc17('0x64'),_0x55415d[_0xdc17('0x5c')]['id'],_0x55415d[_0xdc17('0x5c')]['name'],_0x55415d[_0xdc17('0x5c')]['role'],_0x1a735a[_0xdc17('0x62')]['id'],_0x55415d[_0xdc17('0x54')]?JSON['stringify'](_0x55415d[_0xdc17('0x54')]):_0xdc17('0x65'));return respondWithRpcPromise(_0xdc17('0x66'),_0xdc17('0x67'),_0x1a735a);}return null;})['then'](function(_0x3016b1){var _0x450c88=_0xdc17('0x68')+_0x3016b1[_0xdc17('0x27')][_0xdc17('0x69')];return db[_0xdc17('0x6a')]['query'](_0x450c88,{'type':db[_0xdc17('0x6b')]['QueryTypes'][_0xdc17('0x6c')],'raw':!![]})[_0xdc17('0x1f')](function(_0x3afcbc){return _0x3afcbc;});})[_0xdc17('0x1f')](function(_0x187cc3){if(_0x187cc3){_0x1a735a[_0xdc17('0x27')][_0xdc17('0x6d')]=_0x187cc3[0x0];if(!_0x55415d['body'][_0xdc17('0x5b')])return;return db[_0xdc17('0x6e')][_0xdc17('0x52')]({'where':{'id':_0x55415d[_0xdc17('0x54')]['UserId'],'role':_0xdc17('0x5d')},'attributes':['id',_0xdc17('0x34'),_0xdc17('0x6f'),_0xdc17('0x70'),_0xdc17('0x71')],'raw':!![]});}return null;})[_0xdc17('0x1f')](function(_0xcd9b4){if(!_0xcd9b4)return null;_0x1a735a[_0xdc17('0x27')]['agent']=_0xcd9b4;return _0x1a735a;})[_0xdc17('0x1f')](function(_0x2ed4c1){if(_0x2ed4c1){if(_0x55415d['body'][_0xdc17('0x72')]){_0x1a735a[_0xdc17('0x27')][_0xdc17('0x73')]=util[_0xdc17('0x74')](_0xdc17('0x75'),_0x55415d[_0xdc17('0x5c')][_0xdc17('0x34')]);_0x1a735a[_0xdc17('0x27')][_0xdc17('0x76')]=_0x1a735a[_0xdc17('0x76')];_0x1a735a[_0xdc17('0x27')][_0xdc17('0x77')]=_0x1a735a['channel'];_0x1a735a['message'][_0xdc17('0x78')]=_0xdc17('0x58');return respondWithRpcPromise(_0xdc17('0x79'),'EventManager',{'event':'acceptmessage','message':_0x1a735a['message']},client9002)[_0xdc17('0x1f')](function(){return _0x1a735a;});}return _0x1a735a;}return null;})['then'](respondWithResult(_0x1dfb48,null))[_0xdc17('0x29')](handleError(_0x1dfb48,null));};var interaction_log=require(_0xdc17('0x7a'))(_0xdc17('0x57'));exports[_0xdc17('0x31')]=function(_0x4f2557,_0x28e60d,_0x4ba6b6){var _0x194fdc={'agent':{},'channel':_0xdc17('0x59')};if(_0x4f2557[_0xdc17('0x54')]['id']){delete _0x4f2557[_0xdc17('0x54')]['id'];}_0x4f2557['body'][_0xdc17('0x5b')]=_0x4f2557[_0xdc17('0x54')][_0xdc17('0x5b')]||_0x4f2557[_0xdc17('0x5c')]['id'];_0x194fdc[_0xdc17('0x5d')]['id']=_0x4f2557[_0xdc17('0x54')]['UserId'];return db[_0xdc17('0x38')]['find']({'where':{'id':_0x4f2557[_0xdc17('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28e60d,null))[_0xdc17('0x1f')](function(_0x5d0d8b){if(_0x5d0d8b){_0x194fdc[_0xdc17('0x27')]=_0x5d0d8b[_0xdc17('0x63')]({'plain':!![]});return db[_0xdc17('0x5e')]['find']({'where':{'id':_0x5d0d8b[_0xdc17('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x28e60d,null))[_0xdc17('0x1f')](function(_0x24fee6){if(_0x24fee6){_0x194fdc[_0xdc17('0x62')]=_0x24fee6[_0xdc17('0x63')]({'plain':!![]});interaction_log['info'](_0xdc17('0x7b'),_0x4f2557[_0xdc17('0x5c')]['id'],_0x4f2557[_0xdc17('0x5c')][_0xdc17('0x34')],_0x4f2557[_0xdc17('0x5c')][_0xdc17('0x7c')],_0x194fdc[_0xdc17('0x62')]['id'],_0x4f2557[_0xdc17('0x54')]?JSON[_0xdc17('0x25')](_0x4f2557[_0xdc17('0x54')]):_0xdc17('0x65'));return respondWithRpcPromise(_0xdc17('0x7d'),_0xdc17('0x7e'),_0x194fdc);}return null;})[_0xdc17('0x1f')](function(_0x26843a){var _0x5b2a98=_0xdc17('0x68')+_0x26843a[_0xdc17('0x27')][_0xdc17('0x69')];return db[_0xdc17('0x6a')][_0xdc17('0x3e')](_0x5b2a98,{'type':db[_0xdc17('0x6b')][_0xdc17('0x7f')][_0xdc17('0x6c')],'raw':!![]})[_0xdc17('0x1f')](function(_0x2a1dd7){return _0x2a1dd7;});})[_0xdc17('0x1f')](function(_0x4eeae8){if(_0x4eeae8){_0x194fdc[_0xdc17('0x27')][_0xdc17('0x6d')]=_0x4eeae8[0x0];if(!_0x4f2557[_0xdc17('0x54')][_0xdc17('0x5b')])return;return db['User']['find']({'where':{'id':_0x4f2557['body'][_0xdc17('0x5b')],'role':_0xdc17('0x5d')},'attributes':['id',_0xdc17('0x34'),_0xdc17('0x6f'),_0xdc17('0x70'),_0xdc17('0x71')],'raw':!![]});}return null;})[_0xdc17('0x1f')](function(_0x5dbe82){if(!_0x5dbe82)return null;_0x194fdc['message']['agent']=_0x5dbe82;return _0x194fdc;})[_0xdc17('0x1f')](function(_0x27d124){if(_0x27d124){_0x27d124['message'][_0xdc17('0x73')]=util[_0xdc17('0x74')](_0xdc17('0x75'),_0x4f2557[_0xdc17('0x5c')][_0xdc17('0x34')]);_0x27d124['message'][_0xdc17('0x76')]=_0x194fdc[_0xdc17('0x76')];_0x27d124[_0xdc17('0x27')][_0xdc17('0x77')]=_0x194fdc['channel'];_0x27d124[_0xdc17('0x27')][_0xdc17('0x78')]=_0xdc17('0x31');respondWithRpcPromise(_0xdc17('0x79'),_0xdc17('0x79'),{'event':_0xdc17('0x80'),'message':_0x27d124[_0xdc17('0x27')]},client9002);return _0x194fdc;}return null;})[_0xdc17('0x1f')](respondWithResult(_0x28e60d,null))[_0xdc17('0x29')](handleError(_0x28e60d,null));};exports[_0xdc17('0x2b')]=function(_0x5c789b,_0x5ee1c9,_0x292002){if(_0x5c789b[_0xdc17('0x54')]['id']){delete _0x5c789b[_0xdc17('0x54')]['id'];}var _0x2a9e67;return db[_0xdc17('0x38')][_0xdc17('0x52')]({'where':{'id':_0x5c789b[_0xdc17('0x50')]['id']}})[_0xdc17('0x1f')](handleEntityNotFound(_0x5ee1c9,null))[_0xdc17('0x1f')](function(_0x56156b){if(_0x56156b){_0x2a9e67=_0x56156b;return db[_0xdc17('0x81')]['find']({'where':{'id':_0x56156b['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x5ee1c9,null))['then'](function(_0x47ede9){if(_0x47ede9){logger[_0xdc17('0x22')](_0xdc17('0x23'),'status',_0xdc17('0x82'),_0x47ede9[_0xdc17('0x3b')],util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));switch(_0x47ede9[_0xdc17('0x3b')]){case'twilio':if(_0x5c789b[_0xdc17('0x54')][_0xdc17('0x84')]&&_0x5c789b['body'][_0xdc17('0x84')]===_0x2a9e67[_0xdc17('0x85')]){return _0x2a9e67['update']({'read':!![]});}else{logger[_0xdc17('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdc17('0x2b'),_0xdc17('0x86'),util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5c789b[_0xdc17('0x54')][_0xdc17('0x87')]&&_0x5c789b[_0xdc17('0x54')][_0xdc17('0x87')]===_0x2a9e67[_0xdc17('0x85')]&&_[_0xdc17('0x88')]([_0xdc17('0x89'),_0xdc17('0x8a')],_0x5c789b[_0xdc17('0x54')][_0xdc17('0x8b')])>=0x0){return _0x2a9e67['update']({'read':!![]});}else{logger[_0xdc17('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','plivio',util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));}break;case _0xdc17('0x8c'):var _0x1e8ad4=_0x5c789b[_0xdc17('0x54')][_0xdc17('0x8d')][0x0];if(_0x1e8ad4[_0xdc17('0x2b')][_0xdc17('0x8e')]==='DELIVERED'){return _0x2a9e67[_0xdc17('0x55')]({'read':!![]});}else{logger[_0xdc17('0x26')](_0xdc17('0x8f'),_0xdc17('0x2b'),_0xdc17('0x8c'),util[_0xdc17('0x83')](_0x5c789b[_0xdc17('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x2a9e67;}})['then'](respondWithResult(_0x5ee1c9,null))[_0xdc17('0x29')](handleError(_0x5ee1c9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 86e34d7..6515bcd 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 _0x0ec1=['events','../../mysqldb','SmsMessage','save','hasOwnProperty','hook','exports'];(function(_0x378ec9,_0x1f58c9){var _0x4c4e73=function(_0x5a1d47){while(--_0x5a1d47){_0x378ec9['push'](_0x378ec9['shift']());}};_0x4c4e73(++_0x1f58c9);}(_0x0ec1,0x1ce));var _0x10ec=function(_0x4759af,_0x5be717){_0x4759af=_0x4759af-0x0;var _0x1c3331=_0x0ec1[_0x4759af];return _0x1c3331;};'use strict';var EventEmitter=require(_0x10ec('0x0'));var SmsMessage=require(_0x10ec('0x1'))['db'][_0x10ec('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x10ec('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2a404e){return function(_0x196d7d,_0x4c8ee8,_0x99b6){SmsMessageEvents['emit'](_0x2a404e+':'+_0x196d7d['id'],_0x196d7d);SmsMessageEvents['emit'](_0x2a404e,_0x196d7d);_0x99b6(null);};}for(var e in events){if(events[_0x10ec('0x4')](e)){var event=events[e];SmsMessage[_0x10ec('0x5')](e,emitEvent(event));}}module[_0x10ec('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xa8aa=['setMaxListeners','update','emit','hasOwnProperty','exports','events','SmsMessage'];(function(_0x3cac51,_0x4ef11b){var _0xcd7854=function(_0x419d56){while(--_0x419d56){_0x3cac51['push'](_0x3cac51['shift']());}};_0xcd7854(++_0x4ef11b);}(_0xa8aa,0x1d3));var _0xaa8a=function(_0x9009df,_0x5d10e4){_0x9009df=_0x9009df-0x0;var _0x3f6eeb=_0xa8aa[_0x9009df];return _0x3f6eeb;};'use strict';var EventEmitter=require(_0xaa8a('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xaa8a('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xaa8a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa8a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f9778){return function(_0x5c22ea,_0x52a466,_0x59fc00){SmsMessageEvents[_0xaa8a('0x4')](_0x3f9778+':'+_0x5c22ea['id'],_0x5c22ea);SmsMessageEvents['emit'](_0x3f9778,_0x5c22ea);_0x59fc00(null);};}for(var e in events){if(events[_0xaa8a('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xaa8a('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index b6ef809..64c7a6d 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 _0x5235=['%s:%s','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','authId','token','base64','message_uuid','plivo','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','text','sort','length','createHash','hex','GET','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','findOne','SmsInteractionId','then','catch','SmsAccount','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','sid','error','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','POST','user_key','total_sent','internal_order_id','deliveryReport','read','update','SmsMessage,\x20%s,\x20%s,\x20%s','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format'];(function(_0x4a0624,_0x4dd7ea){var _0x39b6bb=function(_0x1c37db){while(--_0x1c37db){_0x4a0624['push'](_0x4a0624['shift']());}};_0x39b6bb(++_0x4dd7ea);}(_0x5235,0x10b));var _0x5523=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x5235[_0x261b8a];return _0x3455e8;};'use strict';var _=require(_0x5523('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5523('0x1'));var moment=require(_0x5523('0x2'));var BPromise=require(_0x5523('0x3'));var rp=require(_0x5523('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5523('0x5'));var config=require(_0x5523('0x6'));var attributes=require(_0x5523('0x7'));module['exports']=function(_0x14a1a7,_0x4de788){return _0x14a1a7[_0x5523('0x8')]('SmsMessage',attributes,{'tableName':_0x5523('0x9'),'paranoid':![],'indexes':[{'name':_0x5523('0xa'),'fields':[_0x5523('0xa')]},{'name':'fti_sms_messages','fields':[_0x5523('0xb')],'type':_0x5523('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ec45f,_0x5567c0,_0x459171){var _0x1c301c=_0x14a1a7[_0x5523('0xd')];var _0x4e10af=_0x4ec45f[_0x5523('0xe')]({'plain':!![]});if(_0x4e10af['direction'][_0x5523('0xf')]()==='in'||_0x4e10af[_0x5523('0x10')][_0x5523('0xf')]()===_0x5523('0x11')&&!_0x4e10af[_0x5523('0x12')]&&!_['isNil'](_0x4e10af[_0x5523('0x13')])&&!_['isNil'](_0x4e10af['SmsInteractionId'])){_0x1c301c['SmsInteraction'][_0x5523('0x14')]({'where':{'id':_0x4e10af[_0x5523('0x15')]}})[_0x5523('0x16')](function(_0x12ee24){if(_0x12ee24){_0x12ee24['update']({'lastMsgAt':_0x4e10af['createdAt'],'lastMsgDirection':_0x4e10af[_0x5523('0x10')][_0x5523('0xf')]()});}})[_0x5523('0x17')](function(_0x1dee5d){console['error'](_0x1dee5d);});}if(_0x4e10af['direction']===_0x5523('0x11')&&!_0x4e10af[_0x5523('0x12')]){var _0x2ee3f8;_0x1c301c[_0x5523('0x18')]['find']({'where':{'id':_0x4e10af['SmsAccountId']},'raw':!![]})[_0x5523('0x16')](function(_0xeda598){_0x2ee3f8=_0xeda598;if(_0x2ee3f8&&_0x2ee3f8['type']){switch(_0x2ee3f8[_0x5523('0x19')]){case _0x5523('0x1a'):var _0xd9c612=require('twilio');if(_0x2ee3f8[_0x5523('0x1b')]&&_0x2ee3f8[_0x5523('0x1c')]&&_0x2ee3f8[_0x5523('0x1d')]){var _0xb7805=new _0xd9c612(_0x2ee3f8[_0x5523('0x1b')],_0x2ee3f8[_0x5523('0x1c')]);_0xb7805['messages'][_0x5523('0x1e')]({'body':_0x4e10af[_0x5523('0xb')],'to':_0x4e10af[_0x5523('0x1d')],'from':_0x2ee3f8[_0x5523('0x1d')],'statusCallback':_0x2ee3f8[_0x5523('0x1f')]+_0x5523('0x20')+_0x4e10af['id']+_0x5523('0x21')+_0x2ee3f8['token']})[_0x5523('0x16')](function(_0xa7bdda){if(_0xa7bdda[_0x5523('0x22')]){return _0x4ec45f['update']({'messageId':_0xa7bdda[_0x5523('0x22')]});}})[_0x5523('0x17')](function(_0x1eff0b){logger[_0x5523('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5523('0x24'),_0x5523('0x1a'),util[_0x5523('0x25')](_0x1eff0b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5523('0x26'):var _0x4330b7=_0x5523('0x27');if(_0x2ee3f8[_0x5523('0x28')]&&_0x2ee3f8['password']){var _0x58f4b7={'recipient':[_0x4e10af[_0x5523('0x1d')]],'message':_0x4e10af[_0x5523('0xb')],'message_type':_0x2ee3f8[_0x5523('0x29')]};if(_0x2ee3f8[_0x5523('0x29')]&&_0x2ee3f8[_0x5523('0x29')]!=='SI'){_0x58f4b7[_0x5523('0x2a')]=_0x2ee3f8[_0x5523('0x1d')];}var _0x53bd7a={'url':_0x4330b7+'login?username='+_0x2ee3f8['username']+_0x5523('0x2b')+_0x2ee3f8[_0x5523('0x2c')],'method':'GET'};rp(_0x53bd7a)['then'](function(_0x543e0a){var _0x30d9f4=_0x543e0a['split'](';');var _0x43636f={'user_key':_0x30d9f4[0x0],'session_key':_0x30d9f4[0x1]};_0x53bd7a={'url':_0x4330b7+'sms','method':_0x5523('0x2d'),'headers':{'user_key':_0x43636f[_0x5523('0x2e')],'Session_key':_0x43636f['session_key']},'json':!![],'body':_0x58f4b7};return rp(_0x53bd7a);})[_0x5523('0x16')](function(_0x33f35f){if(_0x33f35f[_0x5523('0x2f')]>=0x1){var _0x334311={'messageId':_0x33f35f[_0x5523('0x30')]};if(_0x2ee3f8[_0x5523('0x29')]!=='GP'||!_0x2ee3f8[_0x5523('0x31')]){_0x334311[_0x5523('0x32')]=!![];}return _0x4ec45f[_0x5523('0x33')](_0x334311);}else{return logger[_0x5523('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5523('0x24'),'skebby',util[_0x5523('0x25')](_0x33f35f,{'showHidden':![],'depth':null}));}})[_0x5523('0x17')](function(_0x228b7d){return logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x26'),util['inspect'](_0x228b7d,{'showHidden':![],'depth':null}));});}else{logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x26'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5523('0x35'):if(_0x2ee3f8[_0x5523('0x1c')]){var _0x1043a3={'recipient':_0x4e10af[_0x5523('0x1d')],'message':_0x4e10af[_0x5523('0xb')],'sender':_0x2ee3f8[_0x5523('0x36')]||_0x2ee3f8['phone'],'authorization':_0x2ee3f8['authToken']};var _0x5567c0={'method':_0x5523('0x2d'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x1043a3,'json':!![]};rp(_0x5567c0)[_0x5523('0x16')](function(_0x310527){var _0x353f53={'messageId':_0x310527[_0x5523('0x37')]};if(!_0x2ee3f8['deliveryReport']){_0x353f53[_0x5523('0x32')]=!![];}return _0x4ec45f[_0x5523('0x33')](_0x353f53);})['catch'](function(_0x42136d){logger[_0x5523('0x23')](_0x5523('0x34'),'afterCreate',_0x5523('0x35'),util[_0x5523('0x25')](_0x42136d,{'showHidden':![],'depth':null}));});}else{logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x35'),_0x5523('0x38'));}break;case _0x5523('0x39'):if(_0x2ee3f8[_0x5523('0x28')]&&_0x2ee3f8['password']){var _0x1043a3={'messages':[{'source':_0x5523('0x3a'),'to':_0x4e10af['phone'],'body':_0x4e10af[_0x5523('0xb')],'from':_0x2ee3f8[_0x5523('0x36')]||_0x2ee3f8[_0x5523('0x1d')]}]};var _0x19b115=util[_0x5523('0x3b')](_0x5523('0x3c'),_0x2ee3f8['username'],_0x2ee3f8[_0x5523('0x2c')]);var _0x5567c0={'method':_0x5523('0x2d'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x1043a3,'headers':{'Authorization':util[_0x5523('0x3b')](_0x5523('0x3d'),new Buffer(_0x19b115)[_0x5523('0x3e')]('base64'))},'json':!![]};rp(_0x5567c0)[_0x5523('0x16')](function(_0x31b8de){if(_0x31b8de[_0x5523('0x3f')]>=0xc8&&_0x31b8de[_0x5523('0x3f')]<=0xce){if(_0x31b8de[_0x5523('0x40')]&&_0x31b8de[_0x5523('0x40')][_0x5523('0x41')]>0x0){var _0x37d8fe=_[_0x5523('0x42')](_0x31b8de[_0x5523('0x40')]['messages']);var _0x10c3c3={'messageId':_0x37d8fe[_0x5523('0x43')]};if(!_0x2ee3f8[_0x5523('0x31')]){_0x10c3c3['read']=!![];}return _0x4ec45f[_0x5523('0x33')](_0x10c3c3);}else{logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x44'),util['inspect'](_0x31b8de,{'showHidden':![],'depth':null}));}}else{logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x44'),util[_0x5523('0x25')](_0x31b8de,{'showHidden':![],'depth':null}));}})[_0x5523('0x17')](function(_0x20d290){logger[_0x5523('0x23')](_0x5523('0x34'),'afterCreate',_0x5523('0x44'),util[_0x5523('0x25')](_0x20d290,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x44'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x2ee3f8[_0x5523('0x45')]&&_0x2ee3f8['authToken']){var _0x1043a3={'dst':_0x4e10af[_0x5523('0x1d')],'text':_0x4e10af[_0x5523('0xb')],'src':_0x2ee3f8[_0x5523('0x36')]||_0x2ee3f8[_0x5523('0x1d')],'url':_0x2ee3f8[_0x5523('0x1f')]+_0x5523('0x20')+_0x4e10af['id']+'/status?token='+_0x2ee3f8[_0x5523('0x46')]};var _0x19b115=util[_0x5523('0x3b')](_0x5523('0x3c'),_0x2ee3f8['authId'],_0x2ee3f8[_0x5523('0x1c')]);var _0x5567c0={'method':_0x5523('0x2d'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x2ee3f8['authId']),'body':_0x1043a3,'headers':{'Authorization':util['format'](_0x5523('0x3d'),new Buffer(_0x19b115)[_0x5523('0x3e')](_0x5523('0x47')))},'json':!![]};rp(_0x5567c0)[_0x5523('0x16')](function(_0x51c719){var _0x2a23d0={'messageId':_0x51c719[_0x5523('0x48')][0x0]};return _0x4ec45f[_0x5523('0x33')](_0x2a23d0);})[_0x5523('0x17')](function(_0x32a1cf){logger['error'](_0x5523('0x34'),_0x5523('0x24'),'plivo',util[_0x5523('0x25')](_0x32a1cf,{'showHidden':![],'depth':null}));});}else{logger[_0x5523('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5523('0x24'),_0x5523('0x49'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x5523('0x4a'):if(_0x2ee3f8['username']&&_0x2ee3f8[_0x5523('0x2c')]){if(_0x2ee3f8[_0x5523('0x4b')]){var _0x30e2a2={'method':'POST','uri':_0x2ee3f8[_0x5523('0x4b')]+_0x5523('0x4c'),'body':{'username':_0x2ee3f8['username'],'password':_0x2ee3f8[_0x5523('0x2c')]},'json':!![]};return rp(_0x30e2a2)[_0x5523('0x16')](function(_0x4f50b3){var _0x1d9b3e={'method':'POST','uri':_0x2ee3f8[_0x5523('0x4b')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2ee3f8[_0x5523('0x1d')],'destinations':[{'to':_0x4e10af['phone']}],'text':_0x4e10af['body'],'notifyUrl':_0x2ee3f8[_0x5523('0x1f')]+_0x5523('0x20')+_0x4e10af['id']+'/status?token='+_0x2ee3f8[_0x5523('0x46')],'notifyContentType':_0x5523('0x4d'),'callbackData':_0x2ee3f8['phone']+';'+_0x4e10af[_0x5523('0xb')]}]},'headers':{'Authorization':_0x5523('0x4e')+_0x4f50b3['token']},'json':!![]};return rp(_0x1d9b3e)[_0x5523('0x16')](function(_0x46fc11){if(_0x46fc11[_0x5523('0x4f')]){var _0x5d5c7e={'messageId':_0x46fc11[_0x5523('0x4f')][0x0][_0x5523('0xa')]};if(!_0x2ee3f8[_0x5523('0x31')]){_0x5d5c7e[_0x5523('0x32')]=!![];}return _0x4ec45f[_0x5523('0x33')](_0x5d5c7e);}else{return logger[_0x5523('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5523('0x24'),_0x5523('0x4a'),util['inspect'](_0x46fc11,{'showHidden':![],'depth':null}));}});})[_0x5523('0x17')](function(_0x4f90be){return logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x4a'),util['inspect'](_0x4f90be,{'showHidden':![],'depth':null}));});}else{logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x4a'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x5523('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5523('0x24'),'infobip',_0x5523('0x50'));}break;case _0x5523('0x51'):var _0x1525be=require(_0x5523('0x52'));if(_0x2ee3f8[_0x5523('0x53')]){var _0x5e9341={};_0x5e9341[_0x5523('0x54')]=_0x2ee3f8['username'];_0x5e9341[_0x5523('0x1d')]=_0x4e10af[_0x5523('0x1d')];_0x5e9341[_0x5523('0x2a')]=_0x2ee3f8['phone'];_0x5e9341[_0x5523('0x55')]=_0x4e10af['body'];_0x5e9341['timestamp']=+new Date();var _0x19d3cd='';var _0x21ed69='';var _0x535c8b=Object['keys'](_0x5e9341);_0x535c8b[_0x5523('0x56')]();for(var _0x5e7531=0x0;_0x5e7531<_0x535c8b[_0x5523('0x57')];_0x5e7531++){if(_0x19d3cd!=''){_0x19d3cd+='&';}_0x19d3cd+=_0x535c8b[_0x5e7531]+'='+encodeURIComponent(_0x5e9341[_0x535c8b[_0x5e7531]]);_0x21ed69+=_0x5e9341[_0x535c8b[_0x5e7531]];}_0x21ed69+=_0x2ee3f8['apiKey'];_0x21ed69=_0x1525be[_0x5523('0x58')]('md5')[_0x5523('0x33')](_0x21ed69)['digest'](_0x5523('0x59'));if(_0x19d3cd!==''){_0x19d3cd+='&';}_0x19d3cd+='signature='+_0x21ed69;var _0x53bd7a={'method':_0x5523('0x5a'),'uri':_0x2ee3f8[_0x5523('0x4b')]+'/external/get/send.php?'+_0x19d3cd,'json':!![]};return rp(_0x53bd7a)[_0x5523('0x16')](function(_0x39b284){var _0x567f24=Object['keys'](_0x39b284);if(_0x39b284[_0x567f24[0x0]]['error']&&parseInt(_0x39b284[_0x567f24[0x0]][_0x5523('0x23')])===0x0){var _0x23946b={'messageId':_0x39b284[_0x567f24[0x0]]['id_sms']};if(!_0x2ee3f8[_0x5523('0x31')]){_0x23946b[_0x5523('0x32')]=!![];}return _0x4ec45f['update'](_0x23946b);}else{return logger[_0x5523('0x23')](_0x5523('0x34'),'afterCreate',_0x5523('0x51'),util[_0x5523('0x25')](_0x39b284[_0x5523('0x23')],{'showHidden':![],'depth':null}));}})[_0x5523('0x17')](function(_0x44570a){return logger[_0x5523('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5523('0x24'),'csc',util[_0x5523('0x25')](_0x44570a,{'showHidden':![],'depth':null}));});}else{logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x51'),_0x5523('0x5b'));}break;case'clickatell':if(_0x2ee3f8[_0x5523('0x53')]){var _0x3e3a78={'method':_0x5523('0x2d'),'uri':_0x5523('0x5c'),'headers':{'Authorization':_0x2ee3f8[_0x5523('0x53')]},'body':{'content':_0x4e10af[_0x5523('0xb')],'to':[_0x4e10af[_0x5523('0x1d')]],'from':_0x2ee3f8['phone'],'binary':![],'clientMessageId':_0x5523('0x5d'),'charset':'UTF-8'},'json':!![]};rp(_0x3e3a78)[_0x5523('0x16')](function(_0x4c095b){if(!_0x4c095b[_0x5523('0x23')]){var _0x53a213={'messageId':_0x4c095b[_0x5523('0x4f')][0x0][_0x5523('0x5e')]};if(!_0x2ee3f8[_0x5523('0x31')]){_0x53a213[_0x5523('0x32')]=!![];}return _0x4ec45f[_0x5523('0x33')](_0x53a213);}else{return logger[_0x5523('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x5523('0x25')](_0x4c095b[_0x5523('0x23')],{'showHidden':![],'depth':null}));}})[_0x5523('0x17')](function(_0x189aa7){return logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x5f'),util[_0x5523('0x25')](_0x189aa7,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5523('0x24'),_0x5523('0x5f'),_0x5523('0x5b'));}break;case _0x5523('0x60'):if(_0x2ee3f8['username']&&_0x2ee3f8[_0x5523('0x2c')]){var _0x19b115=util[_0x5523('0x3b')]('%s:%s',_0x2ee3f8[_0x5523('0x28')],_0x2ee3f8['password']);var _0x5567c0={'method':_0x5523('0x2d'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2ee3f8[_0x5523('0x61')]+_0x5523('0x62'),'body':{'to':[_0x4e10af['phone']],'text':_0x4e10af[_0x5523('0xb')],'from':_0x2ee3f8['phone'],'applicationId':_0x2ee3f8['applicationId']},'headers':{'Authorization':util[_0x5523('0x3b')](_0x5523('0x3d'),new Buffer(_0x19b115)[_0x5523('0x3e')](_0x5523('0x47')))},'json':!![]};rp(_0x5567c0)[_0x5523('0x16')](function(_0x3412ff){if(_0x3412ff['id']){var _0x379abe={'messageId':_0x3412ff['id']};return _0x4ec45f['update'](_0x379abe);}else{logger['error'](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x60'),util[_0x5523('0x25')](_0x3412ff,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5a9e74){logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x60'),util['inspect'](_0x5a9e74,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x60'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5523('0x63'):if(_0x2ee3f8['apiKey']){var _0x2c6b66={};var _0x53bd7a={'method':_0x5523('0x2d'),'uri':_0x5523('0x64'),'headers':{'Authorization':_0x5523('0x65')+_0x2ee3f8[_0x5523('0x53')],'Content-Type':_0x5523('0x4d')},'body':{'from':_0x2ee3f8[_0x5523('0x1d')],'to':_0x4e10af[_0x5523('0x1d')],'text':_0x4e10af[_0x5523('0xb')]},'json':!![]};return rp(_0x53bd7a)[_0x5523('0x16')](function(_0x5a9dc0){if(_0x5a9dc0[_0x5523('0x66')]==0xca){_0x2c6b66[_0x5523('0x67')]=_0x5a9dc0;var _0x4ced0e={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x5523('0x65')+_0x2ee3f8['apiKey'],'Content-Type':_0x5523('0x4d')},'body':{'refid':_0x2c6b66[_0x5523('0x67')][_0x5523('0x68')]},'json':!![]};return rp(_0x4ced0e)[_0x5523('0x16')](function(_0x3c65c5){_0x2c6b66[_0x5523('0x69')]=_0x3c65c5;var _0x810770={'messageId':_0x2c6b66[_0x5523('0x67')][_0x5523('0x68')],'read':!![]};return _0x4ec45f[_0x5523('0x33')](_0x810770);});}else{return logger[_0x5523('0x23')](_0x5523('0x34'),'afterCreate','intelepeer',util[_0x5523('0x25')](_0x5a9dc0,{'showHidden':![],'depth':null}));}})[_0x5523('0x17')](function(_0x3f66a3){return logger[_0x5523('0x23')](_0x5523('0x34'),'afterCreate',_0x5523('0x63'),util['inspect'](_0x3f66a3,{'showHidden':![],'depth':null}));});}else{return logger[_0x5523('0x23')](_0x5523('0x34'),_0x5523('0x24'),_0x5523('0x63'),_0x5523('0x6a'));}break;}}})[_0x5523('0x6b')](function(){_0x459171();});}else{_0x459171();}}},'charset':'utf8mb4','collate':_0x5523('0x6c')});}; \ No newline at end of file +var _0x14ff=['text','timestamp','length','md5','digest','hex','signature=','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','smsMethod','login?username=','username','&password=','password','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','read','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender'];(function(_0x3ec879,_0x16c654){var _0x2dce22=function(_0x17fb2d){while(--_0x17fb2d){_0x3ec879['push'](_0x3ec879['shift']());}};_0x2dce22(++_0x16c654);}(_0x14ff,0x194));var _0xf14f=function(_0x3b86a2,_0x682008){_0x3b86a2=_0x3b86a2-0x0;var _0x3eeca7=_0x14ff[_0x3b86a2];return _0x3eeca7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf14f('0x0'))(_0xf14f('0x1'));var moment=require(_0xf14f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf14f('0x3'));var fs=require('fs');var path=require(_0xf14f('0x4'));var rimraf=require(_0xf14f('0x5'));var config=require(_0xf14f('0x6'));var attributes=require('./smsMessage.attributes');module[_0xf14f('0x7')]=function(_0x583403,_0x136ea5){return _0x583403[_0xf14f('0x8')]('SmsMessage',attributes,{'tableName':_0xf14f('0x9'),'paranoid':![],'indexes':[{'name':_0xf14f('0xa'),'fields':['messageId']},{'name':_0xf14f('0xb'),'fields':[_0xf14f('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a8602,_0xd69bbb,_0x49daa7){var _0x392f84=_0x583403[_0xf14f('0xd')];var _0xc72b62=_0x5a8602[_0xf14f('0xe')]({'plain':!![]});if(_0xc72b62[_0xf14f('0xf')][_0xf14f('0x10')]()==='in'||_0xc72b62[_0xf14f('0xf')][_0xf14f('0x10')]()===_0xf14f('0x11')&&!_0xc72b62['secret']&&!_[_0xf14f('0x12')](_0xc72b62[_0xf14f('0x13')])&&!_[_0xf14f('0x12')](_0xc72b62[_0xf14f('0x14')])){_0x392f84[_0xf14f('0x15')][_0xf14f('0x16')]({'where':{'id':_0xc72b62[_0xf14f('0x14')]}})[_0xf14f('0x17')](function(_0x46ba58){if(_0x46ba58){_0x46ba58[_0xf14f('0x18')]({'lastMsgAt':_0xc72b62[_0xf14f('0x19')],'lastMsgDirection':_0xc72b62[_0xf14f('0xf')][_0xf14f('0x10')]()});}})[_0xf14f('0x1a')](function(_0x436156){console[_0xf14f('0x1b')](_0x436156);});}if(_0xc72b62[_0xf14f('0xf')]===_0xf14f('0x11')&&!_0xc72b62[_0xf14f('0x1c')]){var _0x36fb49;_0x392f84[_0xf14f('0x1d')][_0xf14f('0x1e')]({'where':{'id':_0xc72b62[_0xf14f('0x1f')]},'raw':!![]})[_0xf14f('0x17')](function(_0x205bf5){_0x36fb49=_0x205bf5;if(_0x36fb49&&_0x36fb49[_0xf14f('0x20')]){switch(_0x36fb49['type']){case _0xf14f('0x21'):var _0x4daca2=require(_0xf14f('0x21'));if(_0x36fb49[_0xf14f('0x22')]&&_0x36fb49[_0xf14f('0x23')]&&_0x36fb49[_0xf14f('0x24')]){var _0x29c191=new _0x4daca2(_0x36fb49[_0xf14f('0x22')],_0x36fb49[_0xf14f('0x23')]);_0x29c191[_0xf14f('0x25')][_0xf14f('0x26')]({'body':_0xc72b62[_0xf14f('0xc')],'to':_0xc72b62['phone'],'from':_0x36fb49[_0xf14f('0x24')],'statusCallback':_0x36fb49[_0xf14f('0x27')]+_0xf14f('0x28')+_0xc72b62['id']+_0xf14f('0x29')+_0x36fb49[_0xf14f('0x2a')]})[_0xf14f('0x17')](function(_0x277d06){if(_0x277d06[_0xf14f('0x2b')]){return _0x5a8602[_0xf14f('0x18')]({'messageId':_0x277d06[_0xf14f('0x2b')]});}})[_0xf14f('0x1a')](function(_0x51e3e7){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'twilio',util['inspect'](_0x51e3e7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'twilio',_0xf14f('0x2e'));}break;case'skebby':var _0x4d5152=_0xf14f('0x2f');if(_0x36fb49['username']&&_0x36fb49['password']){var _0x86ec49={'recipient':[_0xc72b62[_0xf14f('0x24')]],'message':_0xc72b62['body'],'message_type':_0x36fb49[_0xf14f('0x30')]};if(_0x36fb49['smsMethod']&&_0x36fb49[_0xf14f('0x30')]!=='SI'){_0x86ec49['sender']=_0x36fb49[_0xf14f('0x24')];}var _0x499bed={'url':_0x4d5152+_0xf14f('0x31')+_0x36fb49[_0xf14f('0x32')]+_0xf14f('0x33')+_0x36fb49[_0xf14f('0x34')],'method':_0xf14f('0x35')};rp(_0x499bed)[_0xf14f('0x17')](function(_0x4a6dbc){var _0x3002e7=_0x4a6dbc['split'](';');var _0x2d3344={'user_key':_0x3002e7[0x0],'session_key':_0x3002e7[0x1]};_0x499bed={'url':_0x4d5152+_0xf14f('0x36'),'method':_0xf14f('0x37'),'headers':{'user_key':_0x2d3344[_0xf14f('0x38')],'Session_key':_0x2d3344[_0xf14f('0x39')]},'json':!![],'body':_0x86ec49};return rp(_0x499bed);})[_0xf14f('0x17')](function(_0x1b63b6){if(_0x1b63b6[_0xf14f('0x3a')]>=0x1){var _0x390f38={'messageId':_0x1b63b6['internal_order_id']};if(_0x36fb49['smsMethod']!=='GP'||!_0x36fb49[_0xf14f('0x3b')]){_0x390f38['read']=!![];}return _0x5a8602[_0xf14f('0x18')](_0x390f38);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x3c'),util['inspect'](_0x1b63b6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5b8648){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x3c'),util[_0xf14f('0x3d')](_0x5b8648,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),_0xf14f('0x3c'),_0xf14f('0x3e'));}break;case'connectel':if(_0x36fb49['authToken']){var _0x2273c6={'recipient':_0xc72b62[_0xf14f('0x24')],'message':_0xc72b62[_0xf14f('0xc')],'sender':_0x36fb49[_0xf14f('0x3f')]||_0x36fb49[_0xf14f('0x24')],'authorization':_0x36fb49['authToken']};var _0xd69bbb={'method':'POST','uri':_0xf14f('0x40'),'body':_0x2273c6,'json':!![]};rp(_0xd69bbb)['then'](function(_0xfdd5e6){var _0x5e3e0c={'messageId':_0xfdd5e6[_0xf14f('0x41')]};if(!_0x36fb49[_0xf14f('0x3b')]){_0x5e3e0c['read']=!![];}return _0x5a8602['update'](_0x5e3e0c);})[_0xf14f('0x1a')](function(_0x48afa2){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x42'),util[_0xf14f('0x3d')](_0x48afa2,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),'connectel',_0xf14f('0x43'));}break;case'clicksend':if(_0x36fb49['username']&&_0x36fb49[_0xf14f('0x34')]){var _0x2273c6={'messages':[{'source':_0xf14f('0x44'),'to':_0xc72b62['phone'],'body':_0xc72b62[_0xf14f('0xc')],'from':_0x36fb49['senderString']||_0x36fb49[_0xf14f('0x24')]}]};var _0x387e3a=util[_0xf14f('0x45')](_0xf14f('0x46'),_0x36fb49['username'],_0x36fb49['password']);var _0xd69bbb={'method':_0xf14f('0x37'),'uri':_0xf14f('0x47'),'body':_0x2273c6,'headers':{'Authorization':util[_0xf14f('0x45')](_0xf14f('0x48'),new Buffer(_0x387e3a)[_0xf14f('0x49')]('base64'))},'json':!![]};rp(_0xd69bbb)['then'](function(_0x26f7a7){if(_0x26f7a7[_0xf14f('0x4a')]>=0xc8&&_0x26f7a7['http_code']<=0xce){if(_0x26f7a7[_0xf14f('0x4b')]&&_0x26f7a7[_0xf14f('0x4b')]['queued_count']>0x0){var _0xb24c82=_[_0xf14f('0x4c')](_0x26f7a7[_0xf14f('0x4b')][_0xf14f('0x25')]);var _0x581e31={'messageId':_0xb24c82[_0xf14f('0x4d')]};if(!_0x36fb49[_0xf14f('0x3b')]){_0x581e31['read']=!![];}return _0x5a8602[_0xf14f('0x18')](_0x581e31);}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x4e'),util[_0xf14f('0x3d')](_0x26f7a7,{'showHidden':![],'depth':null}));}}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),'afterCreate',_0xf14f('0x4e'),util[_0xf14f('0x3d')](_0x26f7a7,{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x251d34){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'clickSend',util[_0xf14f('0x3d')](_0x251d34,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x4e'),_0xf14f('0x3e'));}break;case _0xf14f('0x4f'):if(_0x36fb49[_0xf14f('0x50')]&&_0x36fb49[_0xf14f('0x23')]){var _0x2273c6={'dst':_0xc72b62[_0xf14f('0x24')],'text':_0xc72b62[_0xf14f('0xc')],'src':_0x36fb49[_0xf14f('0x3f')]||_0x36fb49[_0xf14f('0x24')],'url':_0x36fb49[_0xf14f('0x27')]+'/api/sms/messages/'+_0xc72b62['id']+_0xf14f('0x29')+_0x36fb49[_0xf14f('0x2a')]};var _0x387e3a=util['format'](_0xf14f('0x46'),_0x36fb49[_0xf14f('0x50')],_0x36fb49['authToken']);var _0xd69bbb={'method':_0xf14f('0x37'),'uri':util['format'](_0xf14f('0x51'),_0x36fb49[_0xf14f('0x50')]),'body':_0x2273c6,'headers':{'Authorization':util[_0xf14f('0x45')]('Basic\x20%s',new Buffer(_0x387e3a)[_0xf14f('0x49')](_0xf14f('0x52')))},'json':!![]};rp(_0xd69bbb)[_0xf14f('0x17')](function(_0x3521f7){var _0xf09c5b={'messageId':_0x3521f7[_0xf14f('0x53')][0x0]};return _0x5a8602[_0xf14f('0x18')](_0xf09c5b);})['catch'](function(_0xce18cb){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf14f('0x4f'),util[_0xf14f('0x3d')](_0xce18cb,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf14f('0x54'):if(_0x36fb49['username']&&_0x36fb49[_0xf14f('0x34')]){if(_0x36fb49['baseUrl']){var _0xdf65e7={'method':_0xf14f('0x37'),'uri':_0x36fb49[_0xf14f('0x55')]+_0xf14f('0x56'),'body':{'username':_0x36fb49[_0xf14f('0x32')],'password':_0x36fb49[_0xf14f('0x34')]},'json':!![]};return rp(_0xdf65e7)[_0xf14f('0x17')](function(_0x197c17){var _0x4e41d9={'method':_0xf14f('0x37'),'uri':_0x36fb49[_0xf14f('0x55')]+_0xf14f('0x57'),'body':{'messages':[{'from':_0x36fb49[_0xf14f('0x24')],'destinations':[{'to':_0xc72b62[_0xf14f('0x24')]}],'text':_0xc72b62['body'],'notifyUrl':_0x36fb49['remote']+_0xf14f('0x28')+_0xc72b62['id']+_0xf14f('0x29')+_0x36fb49['token'],'notifyContentType':_0xf14f('0x58'),'callbackData':_0x36fb49[_0xf14f('0x24')]+';'+_0xc72b62[_0xf14f('0xc')]}]},'headers':{'Authorization':_0xf14f('0x59')+_0x197c17[_0xf14f('0x2a')]},'json':!![]};return rp(_0x4e41d9)[_0xf14f('0x17')](function(_0x1bc49c){if(_0x1bc49c['messages']){var _0x573126={'messageId':_0x1bc49c[_0xf14f('0x25')][0x0]['messageId']};if(!_0x36fb49[_0xf14f('0x3b')]){_0x573126[_0xf14f('0x5a')]=!![];}return _0x5a8602['update'](_0x573126);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),'infobip',util['inspect'](_0x1bc49c,{'showHidden':![],'depth':null}));}});})[_0xf14f('0x1a')](function(_0x2ece29){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x54'),util[_0xf14f('0x3d')](_0x2ece29,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x54'),_0xf14f('0x5b'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),_0xf14f('0x54'),_0xf14f('0x3e'));}break;case'csc':var _0x4f3ac5=require(_0xf14f('0x5c'));if(_0x36fb49[_0xf14f('0x5d')]){var _0x3180a4={};_0x3180a4[_0xf14f('0x5e')]=_0x36fb49[_0xf14f('0x32')];_0x3180a4[_0xf14f('0x24')]=_0xc72b62[_0xf14f('0x24')];_0x3180a4[_0xf14f('0x5f')]=_0x36fb49['phone'];_0x3180a4[_0xf14f('0x60')]=_0xc72b62[_0xf14f('0xc')];_0x3180a4[_0xf14f('0x61')]=+new Date();var _0x4f331c='';var _0x59ece8='';var _0x3a0f04=Object['keys'](_0x3180a4);_0x3a0f04['sort']();for(var _0x82a10e=0x0;_0x82a10e<_0x3a0f04[_0xf14f('0x62')];_0x82a10e++){if(_0x4f331c!=''){_0x4f331c+='&';}_0x4f331c+=_0x3a0f04[_0x82a10e]+'='+encodeURIComponent(_0x3180a4[_0x3a0f04[_0x82a10e]]);_0x59ece8+=_0x3180a4[_0x3a0f04[_0x82a10e]];}_0x59ece8+=_0x36fb49[_0xf14f('0x5d')];_0x59ece8=_0x4f3ac5['createHash'](_0xf14f('0x63'))['update'](_0x59ece8)[_0xf14f('0x64')](_0xf14f('0x65'));if(_0x4f331c!==''){_0x4f331c+='&';}_0x4f331c+=_0xf14f('0x66')+_0x59ece8;var _0x499bed={'method':'GET','uri':_0x36fb49[_0xf14f('0x55')]+'/external/get/send.php?'+_0x4f331c,'json':!![]};return rp(_0x499bed)[_0xf14f('0x17')](function(_0x211c9f){var _0x593845=Object['keys'](_0x211c9f);if(_0x211c9f[_0x593845[0x0]][_0xf14f('0x1b')]&&parseInt(_0x211c9f[_0x593845[0x0]][_0xf14f('0x1b')])===0x0){var _0x431d8b={'messageId':_0x211c9f[_0x593845[0x0]]['id_sms']};if(!_0x36fb49['deliveryReport']){_0x431d8b[_0xf14f('0x5a')]=!![];}return _0x5a8602[_0xf14f('0x18')](_0x431d8b);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),'csc',util['inspect'](_0x211c9f[_0xf14f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x58ac77){return logger[_0xf14f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),'csc',util[_0xf14f('0x3d')](_0x58ac77,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x67'),_0xf14f('0x68'));}break;case'clickatell':if(_0x36fb49['apiKey']){var _0x34b204={'method':_0xf14f('0x37'),'uri':_0xf14f('0x69'),'headers':{'Authorization':_0x36fb49['apiKey']},'body':{'content':_0xc72b62[_0xf14f('0xc')],'to':[_0xc72b62['phone']],'from':_0x36fb49[_0xf14f('0x24')],'binary':![],'clientMessageId':_0xf14f('0x6a'),'charset':_0xf14f('0x6b')},'json':!![]};rp(_0x34b204)['then'](function(_0x76e426){if(!_0x76e426['error']){var _0x535644={'messageId':_0x76e426[_0xf14f('0x25')][0x0][_0xf14f('0x6c')]};if(!_0x36fb49[_0xf14f('0x3b')]){_0x535644[_0xf14f('0x5a')]=!![];}return _0x5a8602[_0xf14f('0x18')](_0x535644);}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6d'),util[_0xf14f('0x3d')](_0x76e426[_0xf14f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x6e5251){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6d'),util[_0xf14f('0x3d')](_0x6e5251,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),'clickatell',_0xf14f('0x68'));}break;case _0xf14f('0x6e'):if(_0x36fb49['username']&&_0x36fb49[_0xf14f('0x34')]){var _0x387e3a=util['format']('%s:%s',_0x36fb49[_0xf14f('0x32')],_0x36fb49['password']);var _0xd69bbb={'method':_0xf14f('0x37'),'uri':_0xf14f('0x6f')+_0x36fb49[_0xf14f('0x70')]+_0xf14f('0x71'),'body':{'to':[_0xc72b62['phone']],'text':_0xc72b62[_0xf14f('0xc')],'from':_0x36fb49['phone'],'applicationId':_0x36fb49['applicationId']},'headers':{'Authorization':util[_0xf14f('0x45')](_0xf14f('0x48'),new Buffer(_0x387e3a)[_0xf14f('0x49')]('base64'))},'json':!![]};rp(_0xd69bbb)['then'](function(_0xf83754){if(_0xf83754['id']){var _0x5658d2={'messageId':_0xf83754['id']};return _0x5a8602[_0xf14f('0x18')](_0x5658d2);}else{logger['error'](_0xf14f('0x2c'),'afterCreate',_0xf14f('0x6e'),util[_0xf14f('0x3d')](_0xf83754,{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x12a952){logger['error'](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6e'),util[_0xf14f('0x3d')](_0x12a952,{'showHidden':![],'depth':null}));});}else{logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x6e'),_0xf14f('0x3e'));}break;case _0xf14f('0x72'):if(_0x36fb49[_0xf14f('0x5d')]){var _0x47318c={};var _0x499bed={'method':_0xf14f('0x37'),'uri':_0xf14f('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x36fb49[_0xf14f('0x5d')],'Content-Type':_0xf14f('0x58')},'body':{'from':_0x36fb49[_0xf14f('0x24')],'to':_0xc72b62[_0xf14f('0x24')],'text':_0xc72b62[_0xf14f('0xc')]},'json':!![]};return rp(_0x499bed)['then'](function(_0x1ecb54){if(_0x1ecb54['code']==0xca){_0x47318c[_0xf14f('0x74')]=_0x1ecb54;var _0x5e88d1={'method':_0xf14f('0x37'),'uri':_0xf14f('0x75'),'headers':{'Authorization':_0xf14f('0x76')+_0x36fb49[_0xf14f('0x5d')],'Content-Type':_0xf14f('0x58')},'body':{'refid':_0x47318c[_0xf14f('0x74')]['refid']},'json':!![]};return rp(_0x5e88d1)['then'](function(_0x55a1e9){_0x47318c[_0xf14f('0x77')]=_0x55a1e9;var _0x269594={'messageId':_0x47318c[_0xf14f('0x74')][_0xf14f('0x78')],'read':!![]};return _0x5a8602[_0xf14f('0x18')](_0x269594);});}else{return logger[_0xf14f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf14f('0x2d'),_0xf14f('0x72'),util[_0xf14f('0x3d')](_0x1ecb54,{'showHidden':![],'depth':null}));}})[_0xf14f('0x1a')](function(_0x2e682){return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x72'),util[_0xf14f('0x3d')](_0x2e682,{'showHidden':![],'depth':null}));});}else{return logger[_0xf14f('0x1b')](_0xf14f('0x2c'),_0xf14f('0x2d'),_0xf14f('0x72'),_0xf14f('0x79'));}break;}}})[_0xf14f('0x7a')](function(){_0x49daa7();});}else{_0x49daa7();}}},'charset':_0xf14f('0x7b'),'collate':_0xf14f('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4ad1ad0..16fbe74 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 _0x3802=['register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsMessage','create','body','options','raw','then','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x12c0b1,_0x1b5fb8){var _0x10b2ec=function(_0x3ce764){while(--_0x3ce764){_0x12c0b1['push'](_0x12c0b1['shift']());}};_0x10b2ec(++_0x1b5fb8);}(_0x3802,0x19f));var _0x2380=function(_0x6b2a7d,_0xb6085){_0x6b2a7d=_0x6b2a7d-0x0;var _0x2053a6=_0x3802[_0x6b2a7d];return _0x2053a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2380('0x0'));var BPromise=require(_0x2380('0x1'));var rs=require(_0x2380('0x2'));var fs=require('fs');var Redis=require(_0x2380('0x3'));var db=require(_0x2380('0x4'))['db'];var utils=require(_0x2380('0x5'));var logger=require('../../config/logger')(_0x2380('0x6'));var config=require(_0x2380('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2380('0x8')][_0x2380('0x9')]({'port':0x232a});config[_0x2380('0xa')]=_[_0x2380('0xb')](config[_0x2380('0xa')],{'host':_0x2380('0xc'),'port':0x18eb});var socket=require(_0x2380('0xd'))(new Redis(config[_0x2380('0xa')]));require('./smsMessage.socket')[_0x2380('0xe')](socket);function respondWithRpcPromise(_0x5a4777,_0x178c09,_0x26559f){return new BPromise(function(_0x1b517b,_0x10d50e){return client[_0x2380('0xf')](_0x5a4777,_0x26559f)['then'](function(_0x534e7e){logger[_0x2380('0x10')](_0x2380('0x11'),_0x178c09,_0x2380('0x12'));logger[_0x2380('0x13')](_0x2380('0x14'),_0x178c09,_0x2380('0x12'),JSON[_0x2380('0x15')](_0x534e7e));if(_0x534e7e['error']){if(_0x534e7e[_0x2380('0x16')]['code']===0x1f4){logger['error'](_0x2380('0x11'),_0x178c09,_0x534e7e[_0x2380('0x16')][_0x2380('0x17')]);return _0x10d50e(_0x534e7e[_0x2380('0x16')][_0x2380('0x17')]);}logger[_0x2380('0x16')]('SmsMessage,\x20%s,\x20%s',_0x178c09,_0x534e7e['error']['message']);return _0x1b517b(_0x534e7e[_0x2380('0x16')][_0x2380('0x17')]);}else{logger[_0x2380('0x10')](_0x2380('0x11'),_0x178c09,_0x2380('0x12'));_0x1b517b(_0x534e7e[_0x2380('0x18')][_0x2380('0x17')]);}})[_0x2380('0x19')](function(_0x294075){logger[_0x2380('0x16')](_0x2380('0x11'),_0x178c09,_0x294075);_0x10d50e(_0x294075);});});}exports['CreateSmsMessage']=function(_0x3156ae){var _0x424f26=this;return new Promise(function(_0x47caed,_0x131a19){return db[_0x2380('0x1a')][_0x2380('0x1b')](_0x3156ae[_0x2380('0x1c')],{'raw':_0x3156ae[_0x2380('0x1d')]?_0x3156ae[_0x2380('0x1d')][_0x2380('0x1e')]===undefined?!![]:![]:!![]})[_0x2380('0x1f')](function(_0x3e1e49){logger[_0x2380('0x10')](_0x2380('0x20'),_0x3156ae);logger['debug'](_0x2380('0x20'),_0x3156ae,JSON[_0x2380('0x15')](_0x3e1e49));_0x47caed(_0x3e1e49);})['catch'](function(_0x2acaa3){logger[_0x2380('0x16')](_0x2380('0x20'),_0x2acaa3[_0x2380('0x17')],_0x3156ae);_0x131a19(_0x424f26[_0x2380('0x16')](0x1f4,_0x2acaa3['message']));});});}; \ No newline at end of file +var _0x8f05=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','create','body','options','CreateSmsMessage','debug','catch','lodash','util','moment'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x8f05,0x1bf));var _0x58f0=function(_0x4e4c39,_0x3a894d){_0x4e4c39=_0x4e4c39-0x0;var _0x11306e=_0x8f05[_0x4e4c39];return _0x11306e;};'use strict';var _=require(_0x58f0('0x0'));var util=require(_0x58f0('0x1'));var moment=require(_0x58f0('0x2'));var BPromise=require(_0x58f0('0x3'));var rs=require(_0x58f0('0x4'));var fs=require('fs');var Redis=require(_0x58f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x58f0('0x6'));var logger=require('../../config/logger')(_0x58f0('0x7'));var config=require(_0x58f0('0x8'));var jayson=require(_0x58f0('0x9'));var client=jayson['client'][_0x58f0('0xa')]({'port':0x232a});config[_0x58f0('0xb')]=_[_0x58f0('0xc')](config[_0x58f0('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58f0('0xb')]));require('./smsMessage.socket')[_0x58f0('0xd')](socket);function respondWithRpcPromise(_0x3873d7,_0x3646dc,_0x34554b){return new BPromise(function(_0x480b21,_0x4b590c){return client['request'](_0x3873d7,_0x34554b)[_0x58f0('0xe')](function(_0x3beae5){logger[_0x58f0('0xf')]('SmsMessage,\x20%s,\x20%s',_0x3646dc,_0x58f0('0x10'));logger['debug'](_0x58f0('0x11'),_0x3646dc,_0x58f0('0x10'),JSON[_0x58f0('0x12')](_0x3beae5));if(_0x3beae5['error']){if(_0x3beae5[_0x58f0('0x13')][_0x58f0('0x14')]===0x1f4){logger[_0x58f0('0x13')](_0x58f0('0x15'),_0x3646dc,_0x3beae5[_0x58f0('0x13')][_0x58f0('0x16')]);return _0x4b590c(_0x3beae5[_0x58f0('0x13')]['message']);}logger[_0x58f0('0x13')](_0x58f0('0x15'),_0x3646dc,_0x3beae5[_0x58f0('0x13')]['message']);return _0x480b21(_0x3beae5[_0x58f0('0x13')]['message']);}else{logger[_0x58f0('0xf')](_0x58f0('0x15'),_0x3646dc,_0x58f0('0x10'));_0x480b21(_0x3beae5[_0x58f0('0x17')][_0x58f0('0x16')]);}})['catch'](function(_0x2255bb){logger[_0x58f0('0x13')]('SmsMessage,\x20%s,\x20%s',_0x3646dc,_0x2255bb);_0x4b590c(_0x2255bb);});});}exports['CreateSmsMessage']=function(_0xbff732){var _0x2b2050=this;return new Promise(function(_0x2d6c44,_0x324d29){return db['SmsMessage'][_0x58f0('0x18')](_0xbff732[_0x58f0('0x19')],{'raw':_0xbff732[_0x58f0('0x1a')]?_0xbff732['options']['raw']===undefined?!![]:![]:!![]})[_0x58f0('0xe')](function(_0x387616){logger[_0x58f0('0xf')](_0x58f0('0x1b'),_0xbff732);logger[_0x58f0('0x1c')]('CreateSmsMessage',_0xbff732,JSON[_0x58f0('0x12')](_0x387616));_0x2d6c44(_0x387616);})[_0x58f0('0x1d')](function(_0x5c59aa){logger['error'](_0x58f0('0x1b'),_0x5c59aa['message'],_0xbff732);_0x324d29(_0x2b2050['error'](0x1f4,_0x5c59aa['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 11b592b..0c2cd01 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 _0x382c=['length','save','remove','emit','register'];(function(_0x362e4f,_0x474af5){var _0x195981=function(_0x19957b){while(--_0x19957b){_0x362e4f['push'](_0x362e4f['shift']());}};_0x195981(++_0x474af5);}(_0x382c,0x169));var _0xc382=function(_0x2b76c9,_0x46eaee){_0x2b76c9=_0x2b76c9-0x0;var _0x230b98=_0x382c[_0x2b76c9];return _0x230b98;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xc382('0x0'),_0xc382('0x1'),'update'];function createListener(_0x51dc8d,_0x3a8c7b){return function(_0x592f37){_0x3a8c7b[_0xc382('0x2')](_0x51dc8d,_0x592f37);};}function removeListener(_0x2a888a,_0x2f6fff){return function(){SmsMessageEvents['removeListener'](_0x2a888a,_0x2f6fff);};}exports[_0xc382('0x3')]=function(_0x4b39db){for(var _0x425e88=0x0,_0x3cd589=events[_0xc382('0x4')];_0x425e88<_0x3cd589;_0x425e88++){var _0x4e843a=events[_0x425e88];var _0x5076ae=createListener('smsMessage:'+_0x4e843a,_0x4b39db);SmsMessageEvents['on'](_0x4e843a,_0x5076ae);}}; \ No newline at end of file +var _0x3d91=['./smsMessage.events','save','remove','update','smsMessage:'];(function(_0x204a82,_0x1c4d74){var _0x46a603=function(_0xce4dce){while(--_0xce4dce){_0x204a82['push'](_0x204a82['shift']());}};_0x46a603(++_0x1c4d74);}(_0x3d91,0x172));var _0x13d9=function(_0x49b076,_0x4fb74e){_0x49b076=_0x49b076-0x0;var _0xa3609=_0x3d91[_0x49b076];return _0xa3609;};'use strict';var SmsMessageEvents=require(_0x13d9('0x0'));var events=[_0x13d9('0x1'),_0x13d9('0x2'),_0x13d9('0x3')];function createListener(_0x948021,_0x4e1623){return function(_0x2aa1b4){_0x4e1623['emit'](_0x948021,_0x2aa1b4);};}function removeListener(_0x3e1378,_0x1bfefa){return function(){SmsMessageEvents['removeListener'](_0x3e1378,_0x1bfefa);};}exports['register']=function(_0x3c402d){for(var _0x4f445b=0x0,_0x3e043f=events['length'];_0x4f445b<_0x3e043f;_0x4f445b++){var _0x28055f=events[_0x4f445b];var _0x5f9132=createListener(_0x13d9('0x4')+_0x28055f,_0x3c402d);SmsMessageEvents['on'](_0x28055f,_0x5f9132);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 03ab07d..1d81322 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 _0x71ba=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/teams','getTeams','/:id/users','getAgents','post','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x35e4af,_0x28237a){var _0x15411e=function(_0x2edda4){while(--_0x2edda4){_0x35e4af['push'](_0x35e4af['shift']());}};_0x15411e(++_0x28237a);}(_0x71ba,0x8f));var _0xa71b=function(_0x223248,_0x2d555d){_0x223248=_0x223248-0x0;var _0x286608=_0x71ba[_0x223248];return _0x286608;};'use strict';var multer=require(_0xa71b('0x0'));var util=require(_0xa71b('0x1'));var path=require(_0xa71b('0x2'));var timeout=require(_0xa71b('0x3'));var express=require(_0xa71b('0x4'));var router=express[_0xa71b('0x5')]();var fs_extra=require(_0xa71b('0x6'));var auth=require(_0xa71b('0x7'));var interaction=require(_0xa71b('0x8'));var config=require(_0xa71b('0x9'));var controller=require(_0xa71b('0xa'));router[_0xa71b('0xb')]('/',auth['isAuthenticated'](),controller[_0xa71b('0xc')]);router[_0xa71b('0xb')](_0xa71b('0xd'),auth[_0xa71b('0xe')](),controller[_0xa71b('0xf')]);router[_0xa71b('0xb')]('/:id',auth[_0xa71b('0xe')](),controller[_0xa71b('0x10')]);router[_0xa71b('0xb')]('/:id/members',auth[_0xa71b('0xe')](),controller['getMembers']);router[_0xa71b('0xb')](_0xa71b('0x11'),auth[_0xa71b('0xe')](),controller[_0xa71b('0x12')]);router[_0xa71b('0xb')](_0xa71b('0x13'),auth[_0xa71b('0xe')](),controller[_0xa71b('0x14')]);router[_0xa71b('0x15')]('/',auth[_0xa71b('0xe')](),controller['create']);router['post'](_0xa71b('0x11'),auth[_0xa71b('0xe')](),controller['addTeams']);router[_0xa71b('0x15')](_0xa71b('0x13'),auth[_0xa71b('0xe')](),controller['addAgents']);router[_0xa71b('0x16')](_0xa71b('0x17'),auth['isAuthenticated'](),controller[_0xa71b('0x18')]);router[_0xa71b('0x19')](_0xa71b('0x17'),auth[_0xa71b('0xe')](),controller[_0xa71b('0x1a')]);router[_0xa71b('0x19')](_0xa71b('0x11'),auth[_0xa71b('0xe')](),controller[_0xa71b('0x1b')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa71b('0x1c')]);module[_0xa71b('0x1d')]=router; \ No newline at end of file +var _0x3a52=['removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3a52,0x1b5));var _0x23a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a52[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x23a5('0x0'));var timeout=require(_0x23a5('0x1'));var express=require(_0x23a5('0x2'));var router=express[_0x23a5('0x3')]();var fs_extra=require(_0x23a5('0x4'));var auth=require(_0x23a5('0x5'));var interaction=require(_0x23a5('0x6'));var config=require(_0x23a5('0x7'));var controller=require(_0x23a5('0x8'));router['get']('/',auth[_0x23a5('0x9')](),controller[_0x23a5('0xa')]);router[_0x23a5('0xb')](_0x23a5('0xc'),auth[_0x23a5('0x9')](),controller['describe']);router[_0x23a5('0xb')](_0x23a5('0xd'),auth[_0x23a5('0x9')](),controller['show']);router[_0x23a5('0xb')](_0x23a5('0xe'),auth[_0x23a5('0x9')](),controller[_0x23a5('0xf')]);router[_0x23a5('0xb')](_0x23a5('0x10'),auth[_0x23a5('0x9')](),controller[_0x23a5('0x11')]);router['get'](_0x23a5('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x23a5('0x13')]('/',auth[_0x23a5('0x9')](),controller[_0x23a5('0x14')]);router[_0x23a5('0x13')](_0x23a5('0x10'),auth[_0x23a5('0x9')](),controller['addTeams']);router[_0x23a5('0x13')](_0x23a5('0x12'),auth[_0x23a5('0x9')](),controller[_0x23a5('0x15')]);router[_0x23a5('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x23a5('0x17')]);router[_0x23a5('0x18')]('/:id',auth[_0x23a5('0x9')](),controller[_0x23a5('0x19')]);router[_0x23a5('0x18')]('/:id/teams',auth[_0x23a5('0x9')](),controller[_0x23a5('0x1a')]);router[_0x23a5('0x18')](_0x23a5('0x12'),auth[_0x23a5('0x9')](),controller[_0x23a5('0x1b')]);module[_0x23a5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 2534c5d..b9382c0 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 _0x30c8=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x1704dc,_0x4c1dd9){var _0xe3ab26=function(_0x314e8c){while(--_0x314e8c){_0x1704dc['push'](_0x1704dc['shift']());}};_0xe3ab26(++_0x4c1dd9);}(_0x30c8,0x86));var _0x830c=function(_0x423449,_0x104ac2){_0x423449=_0x423449-0x0;var _0x4da0d8=_0x30c8[_0x423449];return _0x4da0d8;};'use strict';var Sequelize=require(_0x830c('0x0'));module['exports']={'name':{'type':Sequelize[_0x830c('0x1')],'unique':_0x830c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x830c('0x1')]},'timeout':{'type':Sequelize[_0x830c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x830c('0x4')]('rrmemory',_0x830c('0x5'),_0x830c('0x6'))}}; \ No newline at end of file +var _0xb309=['STRING','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb309,0x89));var _0x9b30=function(_0x3b6278,_0x2deeea){_0x3b6278=_0x3b6278-0x0;var _0xfa3347=_0xb309[_0x3b6278];return _0xfa3347;};'use strict';var Sequelize=require(_0x9b30('0x0'));module[_0x9b30('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9b30('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b30('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b30('0x4')](_0x9b30('0x5'),'beepall',_0x9b30('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3cf61cf..400417f 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 _0xf333=['filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','intersection','find','body','user','get','role','create','params','describe','getMembers','findOne','pick','SmsQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','SIP','smsPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','userSmsQueue:save','removeTeams','User','field','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','forEach','emit','addAgents','omit','spread','removeAgents','isArray','userSmsQueue:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','then','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3546d0,_0x5a1808){var _0x166590=function(_0x476488){while(--_0x476488){_0x3546d0['push'](_0x3546d0['shift']());}};_0x166590(++_0x5a1808);}(_0xf333,0x1d4));var _0x3f33=function(_0x2fbd69,_0x3b75c3){_0x2fbd69=_0x2fbd69-0x0;var _0x19d9a1=_0xf333[_0x2fbd69];return _0x19d9a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f33('0x0'));var zipdir=require(_0x3f33('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f33('0x2'));var moment=require('moment');var BPromise=require(_0x3f33('0x3'));var Mustache=require(_0x3f33('0x4'));var util=require('util');var path=require(_0x3f33('0x5'));var sox=require(_0x3f33('0x6'));var csv=require(_0x3f33('0x7'));var ejs=require(_0x3f33('0x8'));var fs=require('fs');var fs_extra=require(_0x3f33('0x9'));var _=require('lodash');var squel=require(_0x3f33('0xa'));var crypto=require(_0x3f33('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3f33('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f33('0xd'));var Papa=require(_0x3f33('0xe'));var Redis=require(_0x3f33('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3f33('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f33('0x11'));var logger=require(_0x3f33('0x12'))('api');var utils=require(_0x3f33('0x13'));var config=require(_0x3f33('0x14'));var licenseUtil=require(_0x3f33('0x15'));var db=require('../../mysqldb')['db'];config[_0x3f33('0x16')]=_['defaults'](config[_0x3f33('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f33('0x17'))(new Redis(config[_0x3f33('0x16')]));require('./smsQueue.socket')[_0x3f33('0x18')](socket);function respondWithStatusCode(_0x170656,_0x45e37a){_0x45e37a=_0x45e37a||0xcc;return function(_0x5d249d){if(_0x5d249d){return _0x170656[_0x3f33('0x19')](_0x45e37a);}return _0x170656[_0x3f33('0x1a')](_0x45e37a)[_0x3f33('0x1b')]();};}function respondWithResult(_0x4c43a5,_0x3652a3){_0x3652a3=_0x3652a3||0xc8;return function(_0x4d9f8c){if(_0x4d9f8c){return _0x4c43a5[_0x3f33('0x1a')](_0x3652a3)['json'](_0x4d9f8c);}};}function respondWithFilteredResult(_0x5d58d9,_0xb80424){return function(_0x31b330){if(_0x31b330){var _0x2fc97f=typeof _0xb80424[_0x3f33('0x1c')]===_0x3f33('0x1d')&&typeof _0xb80424[_0x3f33('0x1e')]===_0x3f33('0x1d');var _0x324ba9=_0x31b330[_0x3f33('0x1f')];var _0x239011=_0x2fc97f?0x0:_0xb80424[_0x3f33('0x1c')];var _0x556a72=_0x2fc97f?_0x31b330[_0x3f33('0x1f')]:_0xb80424[_0x3f33('0x1c')]+_0xb80424[_0x3f33('0x1e')];var _0x23519d;if(_0x556a72>=_0x324ba9){_0x556a72=_0x324ba9;_0x23519d=0xc8;}else{_0x23519d=0xce;}_0x5d58d9[_0x3f33('0x1a')](_0x23519d);return _0x5d58d9['set']('Content-Range',_0x239011+'-'+_0x556a72+'/'+_0x324ba9)[_0x3f33('0x20')](_0x31b330);}return null;};}function patchUpdates(_0x4350e6){return function(_0xbcd74f){try{jsonpatch[_0x3f33('0x21')](_0xbcd74f,_0x4350e6,!![]);}catch(_0x254e40){return BPromise[_0x3f33('0x22')](_0x254e40);}return _0xbcd74f[_0x3f33('0x23')]();};}function saveUpdates(_0x23fc67,_0x1cc760){return function(_0x32fecf){if(_0x32fecf){return _0x32fecf[_0x3f33('0x24')](_0x23fc67)['then'](function(_0x26fb9d){return _0x26fb9d;});}return null;};}function removeEntity(_0x514b31,_0x3f7209){return function(_0x400de5){if(_0x400de5){return _0x400de5[_0x3f33('0x25')]()[_0x3f33('0x26')](function(){var _0x2c88f6=_0x400de5['get']({'plain':!![]});var _0x287b99=_0x3f33('0x27');return db[_0x3f33('0x28')]['destroy']({'where':{'type':_0x287b99,'resourceId':_0x2c88f6['id']}})[_0x3f33('0x26')](function(){return _0x400de5;});})[_0x3f33('0x26')](function(){_0x514b31[_0x3f33('0x1a')](0xcc)[_0x3f33('0x1b')]();});}};}function handleEntityNotFound(_0x2962d7,_0x4330bc){return function(_0x2adf92){if(!_0x2adf92){_0x2962d7[_0x3f33('0x19')](0x194);}return _0x2adf92;};}function handleError(_0x4afe1a,_0x17537b){_0x17537b=_0x17537b||0x1f4;return function(_0x1ed247){logger[_0x3f33('0x29')](_0x1ed247[_0x3f33('0x2a')]);if(_0x1ed247[_0x3f33('0x2b')]){delete _0x1ed247[_0x3f33('0x2b')];}_0x4afe1a[_0x3f33('0x1a')](_0x17537b)['send'](_0x1ed247);};}exports['index']=function(_0x3ecfb5,_0x17c35a){var _0x101942={},_0x177283={},_0x3a947d={'count':0x0,'rows':[]};var _0x218f25=_[_0x3f33('0x2c')](db[_0x3f33('0x2d')][_0x3f33('0x2e')],function(_0x305db3){return{'name':_0x305db3['fieldName'],'type':_0x305db3[_0x3f33('0x2f')][_0x3f33('0x30')]};});_0x177283[_0x3f33('0x31')]=_[_0x3f33('0x2c')](_0x218f25,_0x3f33('0x2b'));_0x177283[_0x3f33('0x32')]=_[_0x3f33('0x33')](_0x3ecfb5['query']);_0x177283[_0x3f33('0x34')]=_['intersection'](_0x177283['model'],_0x177283[_0x3f33('0x32')]);_0x101942[_0x3f33('0x35')]=_['intersection'](_0x177283[_0x3f33('0x31')],qs['fields'](_0x3ecfb5[_0x3f33('0x32')][_0x3f33('0x36')]));_0x101942[_0x3f33('0x35')]=_0x101942['attributes'][_0x3f33('0x37')]?_0x101942[_0x3f33('0x35')]:_0x177283[_0x3f33('0x31')];if(!_0x3ecfb5[_0x3f33('0x32')][_0x3f33('0x38')](_0x3f33('0x39'))){_0x101942[_0x3f33('0x1e')]=qs[_0x3f33('0x1e')](_0x3ecfb5[_0x3f33('0x32')][_0x3f33('0x1e')]);_0x101942[_0x3f33('0x1c')]=qs[_0x3f33('0x1c')](_0x3ecfb5[_0x3f33('0x32')][_0x3f33('0x1c')]);}_0x101942[_0x3f33('0x3a')]=qs[_0x3f33('0x3b')](_0x3ecfb5[_0x3f33('0x32')][_0x3f33('0x3b')]);_0x101942['where']=qs[_0x3f33('0x34')](_['pick'](_0x3ecfb5[_0x3f33('0x32')],_0x177283['filters']),_0x218f25);if(_0x3ecfb5[_0x3f33('0x32')][_0x3f33('0x3c')]){_0x101942['where']=_[_0x3f33('0x3d')](_0x101942['where'],{'$or':_[_0x3f33('0x2c')](_0x218f25,function(_0x52c5b8){if(_0x52c5b8[_0x3f33('0x2f')]!==_0x3f33('0x3e')){var _0x36cc8a={};_0x36cc8a[_0x52c5b8[_0x3f33('0x2b')]]={'$like':'%'+_0x3ecfb5['query']['filter']+'%'};return _0x36cc8a;}})});}_0x101942=_[_0x3f33('0x3d')]({},_0x101942,_0x3ecfb5[_0x3f33('0x3f')]);var _0x104efa={'where':_0x101942[_0x3f33('0x40')]};return db['SmsQueue'][_0x3f33('0x1f')](_0x104efa)[_0x3f33('0x26')](function(_0x489f73){_0x3a947d[_0x3f33('0x1f')]=_0x489f73;if(_0x3ecfb5['query'][_0x3f33('0x41')]){_0x101942[_0x3f33('0x42')]=[{'all':!![]}];}return db[_0x3f33('0x2d')][_0x3f33('0x43')](_0x101942);})[_0x3f33('0x26')](function(_0x2bde7a){_0x3a947d[_0x3f33('0x44')]=_0x2bde7a;return _0x3a947d;})['then'](respondWithFilteredResult(_0x17c35a,_0x101942))[_0x3f33('0x45')](handleError(_0x17c35a,null));};exports[_0x3f33('0x46')]=function(_0xf3f2e2,_0x23af4a){var _0x2deccf={'raw':!![],'where':{'id':_0xf3f2e2['params']['id']}},_0x58bf2e={};_0x58bf2e[_0x3f33('0x31')]=_[_0x3f33('0x33')](db[_0x3f33('0x2d')][_0x3f33('0x2e')]);_0x58bf2e[_0x3f33('0x32')]=_['keys'](_0xf3f2e2[_0x3f33('0x32')]);_0x58bf2e[_0x3f33('0x34')]=_[_0x3f33('0x47')](_0x58bf2e[_0x3f33('0x31')],_0x58bf2e[_0x3f33('0x32')]);_0x2deccf[_0x3f33('0x35')]=_['intersection'](_0x58bf2e['model'],qs[_0x3f33('0x36')](_0xf3f2e2['query']['fields']));_0x2deccf[_0x3f33('0x35')]=_0x2deccf[_0x3f33('0x35')]['length']?_0x2deccf[_0x3f33('0x35')]:_0x58bf2e['model'];if(_0xf3f2e2['query'][_0x3f33('0x41')]){_0x2deccf[_0x3f33('0x42')]=[{'all':!![]}];}_0x2deccf=_['merge']({},_0x2deccf,_0xf3f2e2[_0x3f33('0x3f')]);return db['SmsQueue'][_0x3f33('0x48')](_0x2deccf)[_0x3f33('0x26')](handleEntityNotFound(_0x23af4a,null))[_0x3f33('0x26')](respondWithResult(_0x23af4a,null))[_0x3f33('0x45')](handleError(_0x23af4a,null));};exports['create']=function(_0x581a72,_0x833f98){return db[_0x3f33('0x2d')]['create'](_0x581a72[_0x3f33('0x49')],{})[_0x3f33('0x26')](function(_0x2d4ae6){var _0x92eb06=_0x581a72[_0x3f33('0x4a')][_0x3f33('0x4b')]({'plain':!![]});if(!_0x92eb06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x92eb06[_0x3f33('0x4c')]==='user'){var _0x3a986e=_0x2d4ae6[_0x3f33('0x4b')]({'plain':!![]});var _0x3f56b6=_0x3f33('0x27');return db['UserProfileSection'][_0x3f33('0x48')]({'where':{'name':_0x3f56b6,'userProfileId':_0x92eb06['userProfileId']},'raw':!![]})[_0x3f33('0x26')](function(_0x4d7be3){if(_0x4d7be3&&_0x4d7be3['autoAssociation']===0x0){return db[_0x3f33('0x28')][_0x3f33('0x4d')]({'name':_0x3a986e[_0x3f33('0x2b')],'resourceId':_0x3a986e['id'],'type':_0x4d7be3[_0x3f33('0x2b')],'sectionId':_0x4d7be3['id']},{})['then'](function(){return _0x2d4ae6;});}else{return _0x2d4ae6;}})[_0x3f33('0x45')](function(_0x40ad50){logger[_0x3f33('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40ad50);throw _0x40ad50;});}return _0x2d4ae6;})[_0x3f33('0x26')](respondWithResult(_0x833f98,0xc9))[_0x3f33('0x45')](handleError(_0x833f98,null));};exports[_0x3f33('0x24')]=function(_0x67adbc,_0x5b194d){if(_0x67adbc[_0x3f33('0x49')]['id']){delete _0x67adbc[_0x3f33('0x49')]['id'];}return db[_0x3f33('0x2d')][_0x3f33('0x48')]({'where':{'id':_0x67adbc[_0x3f33('0x4e')]['id']}})[_0x3f33('0x26')](handleEntityNotFound(_0x5b194d,null))[_0x3f33('0x26')](saveUpdates(_0x67adbc['body'],null))[_0x3f33('0x26')](respondWithResult(_0x5b194d,null))[_0x3f33('0x45')](handleError(_0x5b194d,null));};exports['destroy']=function(_0xad48de,_0x11c417){return db[_0x3f33('0x2d')][_0x3f33('0x48')]({'where':{'id':_0xad48de['params']['id']}})[_0x3f33('0x26')](handleEntityNotFound(_0x11c417,null))['then'](removeEntity(_0x11c417,null))[_0x3f33('0x45')](handleError(_0x11c417,null));};exports[_0x3f33('0x4f')]=function(_0x8365b8,_0x57750d){return db['SmsQueue'][_0x3f33('0x4f')]()['then'](respondWithResult(_0x57750d,null))[_0x3f33('0x45')](handleError(_0x57750d,null));};exports[_0x3f33('0x50')]=function(_0x4de85e,_0x1ae1fc,_0x5169fc){var _0x234e1c={'raw':!![],'where':{}},_0x7a326c={},_0x2bfea7;return db[_0x3f33('0x2d')][_0x3f33('0x51')]({'where':{'id':_0x4de85e['params']['id']}})[_0x3f33('0x26')](handleEntityNotFound(_0x1ae1fc,null))[_0x3f33('0x26')](function(_0x55dfae){if(_0x55dfae){_0x2bfea7=_0x55dfae[_0x3f33('0x4b')]({'plain':!![]});_0x7a326c[_0x3f33('0x31')]=_['keys'](db['UserSmsQueue'][_0x3f33('0x2e')]);_0x7a326c[_0x3f33('0x32')]=_[_0x3f33('0x33')](_0x4de85e['query']);_0x7a326c[_0x3f33('0x34')]=_['intersection'](_0x7a326c[_0x3f33('0x31')],_0x7a326c[_0x3f33('0x32')]);_0x234e1c[_0x3f33('0x35')]=_[_0x3f33('0x47')](_0x7a326c[_0x3f33('0x31')],qs['fields'](_0x4de85e[_0x3f33('0x32')][_0x3f33('0x36')]));_0x234e1c['attributes']=_0x234e1c[_0x3f33('0x35')][_0x3f33('0x37')]?_0x234e1c[_0x3f33('0x35')]:_0x7a326c[_0x3f33('0x31')];if(!_0x4de85e[_0x3f33('0x32')][_0x3f33('0x38')](_0x3f33('0x39'))){_0x234e1c[_0x3f33('0x1e')]=qs[_0x3f33('0x1e')](_0x4de85e[_0x3f33('0x32')]['limit']);_0x234e1c[_0x3f33('0x1c')]=qs[_0x3f33('0x1c')](_0x4de85e[_0x3f33('0x32')][_0x3f33('0x1c')]);}_0x234e1c[_0x3f33('0x3a')]=qs[_0x3f33('0x3b')](_0x4de85e[_0x3f33('0x32')][_0x3f33('0x3b')]);_0x234e1c[_0x3f33('0x40')]=qs['filters'](_[_0x3f33('0x52')](_0x4de85e[_0x3f33('0x32')],_0x7a326c['filters']));_0x234e1c['where'][_0x3f33('0x53')]=_0x55dfae['id'];if(_0x4de85e['query'][_0x3f33('0x3c')]){_0x234e1c[_0x3f33('0x40')]=_[_0x3f33('0x3d')](_0x234e1c[_0x3f33('0x40')],{'$or':_[_0x3f33('0x2c')](_0x234e1c[_0x3f33('0x35')],function(_0x267512){var _0x28e26a={};_0x28e26a[_0x267512]={'$like':'%'+_0x4de85e[_0x3f33('0x32')][_0x3f33('0x3c')]+'%'};return _0x28e26a;})});}_0x234e1c=_[_0x3f33('0x3d')]({},_0x234e1c,_0x4de85e['options']);return db['UserSmsQueue']['findAll'](_0x234e1c);}})[_0x3f33('0x26')](function(_0x30212d){if(_0x30212d){return db['User'][_0x3f33('0x54')]({'where':{'id':_[_0x3f33('0x2c')](_0x30212d,_0x3f33('0x55')),'role':_0x3f33('0x56')},'attributes':['id',_0x3f33('0x2b'),'smsPause',_0x3f33('0x57'),_0x3f33('0x58')]});}})[_0x3f33('0x26')](function(_0x152222){if(_0x152222){return{'count':_0x152222[_0x3f33('0x1f')],'rows':_['map'](_0x152222[_0x3f33('0x44')],function(_0x505936){return{'membername':_0x505936[_0x3f33('0x2b')],'UserId':_0x505936['id'],'queue_name':_0x2bfea7['name'],'SmsQueueId':_0x2bfea7['id'],'interface':util['format']('%s/%s',_0x3f33('0x59'),_0x505936[_0x3f33('0x2b')]),'penalty':0x0,'paused':_0x505936[_0x3f33('0x5a')],'createdAt':_0x505936[_0x3f33('0x58')],'updatedAt':_0x505936[_0x3f33('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3f33('0x26')](respondWithFilteredResult(_0x1ae1fc,_0x234e1c))['catch'](handleError(_0x1ae1fc,null));};exports[_0x3f33('0x5b')]=function(_0x5e30bb,_0x1c97e8,_0x5ce26f){var _0xe5bdfc={};var _0x7c84ed={};var _0x560b18;var _0x32440b;return db['SmsQueue']['findOne']({'where':{'id':_0x5e30bb['params']['id']}})[_0x3f33('0x26')](handleEntityNotFound(_0x1c97e8,null))[_0x3f33('0x26')](function(_0x341bb4){if(_0x341bb4){_0x560b18=_0x341bb4;_0x7c84ed[_0x3f33('0x31')]=_[_0x3f33('0x33')](db[_0x3f33('0x5c')]['rawAttributes']);_0x7c84ed[_0x3f33('0x32')]=_[_0x3f33('0x33')](_0x5e30bb[_0x3f33('0x32')]);_0x7c84ed[_0x3f33('0x34')]=_[_0x3f33('0x47')](_0x7c84ed['model'],_0x7c84ed[_0x3f33('0x32')]);_0xe5bdfc[_0x3f33('0x35')]=_[_0x3f33('0x47')](_0x7c84ed[_0x3f33('0x31')],qs[_0x3f33('0x36')](_0x5e30bb['query'][_0x3f33('0x36')]));_0xe5bdfc[_0x3f33('0x35')]=_0xe5bdfc[_0x3f33('0x35')][_0x3f33('0x37')]?_0xe5bdfc[_0x3f33('0x35')]:_0x7c84ed['model'];_0xe5bdfc[_0x3f33('0x3a')]=qs['sort'](_0x5e30bb[_0x3f33('0x32')][_0x3f33('0x3b')]);_0xe5bdfc['where']=qs[_0x3f33('0x34')](_[_0x3f33('0x52')](_0x5e30bb[_0x3f33('0x32')],_0x7c84ed[_0x3f33('0x34')]));if(_0x5e30bb[_0x3f33('0x32')][_0x3f33('0x3c')]){_0xe5bdfc[_0x3f33('0x40')]=_[_0x3f33('0x3d')](_0xe5bdfc[_0x3f33('0x40')],{'$or':_[_0x3f33('0x2c')](_0xe5bdfc[_0x3f33('0x35')],function(_0x14e2f0){var _0x36315e={};_0x36315e[_0x14e2f0]={'$like':'%'+_0x5e30bb[_0x3f33('0x32')]['filter']+'%'};return _0x36315e;})});}_0xe5bdfc=_[_0x3f33('0x3d')]({},_0xe5bdfc,_0x5e30bb[_0x3f33('0x3f')]);return _0x560b18[_0x3f33('0x5b')](_0xe5bdfc);}})[_0x3f33('0x26')](function(_0x4133cc){if(_0x4133cc){_0x32440b=_0x4133cc[_0x3f33('0x37')];if(!_0x5e30bb[_0x3f33('0x32')][_0x3f33('0x38')](_0x3f33('0x39'))){_0xe5bdfc[_0x3f33('0x1e')]=qs[_0x3f33('0x1e')](_0x5e30bb['query']['limit']);_0xe5bdfc[_0x3f33('0x1c')]=qs[_0x3f33('0x1c')](_0x5e30bb[_0x3f33('0x32')][_0x3f33('0x1c')]);}return _0x560b18['getTeams'](_0xe5bdfc);}})[_0x3f33('0x26')](function(_0x318bbf){if(_0x318bbf){return _0x318bbf?{'count':_0x32440b,'rows':_0x318bbf}:null;}})[_0x3f33('0x26')](respondWithResult(_0x1c97e8,null))[_0x3f33('0x45')](handleError(_0x1c97e8,null));};exports[_0x3f33('0x5d')]=function(_0x2d5cda,_0x492d42,_0x10ee7b){var _0x1736d8=_0x2d5cda[_0x3f33('0x49')][_0x3f33('0x5e')];return db[_0x3f33('0x5c')][_0x3f33('0x43')]({'where':{'id':_0x1736d8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3f33('0x5f'),'attributes':['id','name',_0x3f33('0x60'),_0x3f33('0x61'),_0x3f33('0x62')],'raw':!![]}]})[_0x3f33('0x26')](function(_0x8cd7b5){if(_0x8cd7b5){var _0xf9e8c2=_[_0x3f33('0x63')](_0x8cd7b5,function(_0x49a17b){var _0x2910ad=_0x49a17b['get']({'plain':!![]});return _0x2910ad[_0x3f33('0x5f')];});return db[_0x3f33('0x2d')]['find']({'where':{'id':_0x2d5cda[_0x3f33('0x4e')]['id']}})['then'](function(_0x19fd06){return db[_0x3f33('0x64')]['transaction'](function(_0x3e3138){return _0x19fd06[_0x3f33('0x5d')](_0x1736d8,{'transaction':_0x3e3138})['then'](function(){return BPromise[_0x3f33('0x65')](_0xf9e8c2,function(_0x34a6c8){return db['UserSmsQueue'][_0x3f33('0x66')]({'where':{'UserId':_0x34a6c8['id'],'SmsQueueId':_0x2d5cda[_0x3f33('0x4e')]['id']},'transaction':_0x3e3138});});})[_0x3f33('0x26')](function(){_0xf9e8c2['forEach'](function(_0x1eaddb){socket['emit'](_0x3f33('0x67'),{'UserId':_0x1eaddb['id'],'SmsQueueId':_0x19fd06['id']});});});});});}})[_0x3f33('0x26')](respondWithStatusCode(_0x492d42,null))[_0x3f33('0x45')](handleError(_0x492d42,null));};exports[_0x3f33('0x68')]=function(_0x252e49,_0x52bc7c,_0x55132c){return db[_0x3f33('0x5c')][_0x3f33('0x43')]({'where':{'id':_0x252e49[_0x3f33('0x32')][_0x3f33('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x3f33('0x69')],'as':_0x3f33('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x3f33('0x26')](handleEntityNotFound(_0x52bc7c,null))[_0x3f33('0x26')](function(_0x157a99){var _0xd20f19=_[_0x3f33('0x2c')](_0x157a99,'id');var _0x5e6099=[];var _0x56af79=[];var _0x4d82b4=squel['select']();_0x4d82b4[_0x3f33('0x6a')](_0x3f33('0x6b'))['from'](_0x3f33('0x6c'),'tq')['join'](_0x3f33('0x6d'),'ut',_0x3f33('0x6e'))[_0x3f33('0x40')]('SmsQueueId\x20=\x20?',_0x252e49[_0x3f33('0x4e')]['id']);for(var _0x5e6e7c=0x0;_0x5e6e7c<_0x157a99[_0x3f33('0x37')];_0x5e6e7c+=0x1){let _0x5ef33b=_0x157a99[_0x5e6e7c];for(var _0x37a4e1=0x0;_0x37a4e1<_0x5ef33b[_0x3f33('0x5f')][_0x3f33('0x37')];_0x37a4e1+=0x1){let _0x904f35=_0x5ef33b[_0x3f33('0x5f')][_0x37a4e1];var _0x215fcb=_0x4d82b4[_0x3f33('0x6f')]();_0x215fcb[_0x3f33('0x40')](_0x3f33('0x70'),_0x904f35['id']);_0x56af79['push'](db[_0x3f33('0x64')]['query'](_0x215fcb[_0x3f33('0x71')](),{'type':db[_0x3f33('0x64')]['QueryTypes'][_0x3f33('0x72')]})[_0x3f33('0x26')](function(_0x2cbcb9){if(_0x2cbcb9[_0x3f33('0x37')]===0x1){return _0x904f35['id'];}else{var _0x4a4afb=_[_0x3f33('0x73')](_['map'](_0x2cbcb9,_0x3f33('0x74')),function(_0x564d97){return _[_0x3f33('0x75')](_0xd20f19,_0x564d97);});if(_0x4a4afb){return _0x904f35['id'];}}}));}}return BPromise[_0x3f33('0x76')](_0x56af79)[_0x3f33('0x26')](function(_0x1bdfb8){_0x5e6099=_(_0x5e6099)[_0x3f33('0x77')](_0x1bdfb8)[_0x3f33('0x78')]()[_0x3f33('0x79')]();return db[_0x3f33('0x2d')][_0x3f33('0x48')]({'where':{'id':_0x252e49[_0x3f33('0x4e')]['id']}})[_0x3f33('0x26')](function(_0x3e5765){return db[_0x3f33('0x64')][_0x3f33('0x7a')](function(_0x3d8f35){return _0x3e5765['removeTeams'](_0x252e49['query'][_0x3f33('0x5e')],{'transaction':_0x3d8f35})[_0x3f33('0x26')](function(){if(!_['isEmpty'](_0x5e6099)){return _0x3e5765['removeAgents'](_0x5e6099,{'transaction':_0x3d8f35});}})[_0x3f33('0x26')](function(){_0x5e6099[_0x3f33('0x7b')](function(_0x2ad904){socket[_0x3f33('0x7c')]('userSmsQueue:remove',{'UserId':_0x2ad904,'SmsQueueId':_0x3e5765['id']});});});});});});})[_0x3f33('0x26')](respondWithStatusCode(_0x52bc7c,null))[_0x3f33('0x45')](handleError(_0x52bc7c,null));};exports[_0x3f33('0x7d')]=function(_0x51b579,_0x392284,_0x572fd5){return db[_0x3f33('0x2d')][_0x3f33('0x48')]({'where':{'id':_0x51b579[_0x3f33('0x4e')]['id']}})[_0x3f33('0x26')](handleEntityNotFound(_0x392284,null))['then'](function(_0x16dd5a){if(_0x16dd5a){return _0x16dd5a[_0x3f33('0x7d')](_0x51b579[_0x3f33('0x49')][_0x3f33('0x5e')],_[_0x3f33('0x7e')](_0x51b579[_0x3f33('0x49')],[_0x3f33('0x5e'),'id'])||{})[_0x3f33('0x7f')](function(_0x56702e){for(var _0x3a5b0b=0x0;_0x3a5b0b<_0x51b579[_0x3f33('0x49')]['ids'][_0x3f33('0x37')];_0x3a5b0b+=0x1){socket['emit'](_0x3f33('0x67'),{'UserId':Number(_0x51b579[_0x3f33('0x49')][_0x3f33('0x5e')][_0x3a5b0b]),'SmsQueueId':Number(_0x51b579[_0x3f33('0x4e')]['id'])});}return _0x56702e;});}})[_0x3f33('0x26')](respondWithResult(_0x392284,null))[_0x3f33('0x45')](handleError(_0x392284,null));};exports['removeAgents']=function(_0x41fe7d,_0x271718,_0x427756){return db['SmsQueue'][_0x3f33('0x48')]({'where':{'id':_0x41fe7d[_0x3f33('0x4e')]['id']}})[_0x3f33('0x26')](handleEntityNotFound(_0x271718,null))['then'](function(_0x31d120){if(_0x31d120){return _0x31d120[_0x3f33('0x80')](_0x41fe7d[_0x3f33('0x32')][_0x3f33('0x5e')])[_0x3f33('0x26')](function(){if(_[_0x3f33('0x81')](_0x41fe7d[_0x3f33('0x32')][_0x3f33('0x5e')])){for(var _0x3e1046=0x0;_0x3e1046<_0x41fe7d[_0x3f33('0x32')]['ids']['length'];_0x3e1046+=0x1){socket[_0x3f33('0x7c')](_0x3f33('0x82'),{'UserId':Number(_0x41fe7d['query']['ids'][_0x3e1046]),'SmsQueueId':Number(_0x41fe7d[_0x3f33('0x4e')]['id'])});}}else{socket['emit'](_0x3f33('0x82'),{'UserId':Number(_0x41fe7d['query'][_0x3f33('0x5e')]),'SmsQueueId':Number(_0x41fe7d[_0x3f33('0x4e')]['id'])});}});}})[_0x3f33('0x26')](respondWithStatusCode(_0x271718,null))['catch'](handleError(_0x271718,null));};exports[_0x3f33('0x83')]=function(_0x5c3f1e,_0xb29cf8,_0x436482){var _0x5933e2={};var _0x1f8a9a={};var _0x588eb7;var _0x40a4e3;return db[_0x3f33('0x2d')][_0x3f33('0x51')]({'where':{'id':_0x5c3f1e[_0x3f33('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb29cf8,null))['then'](function(_0x5f609a){if(_0x5f609a){_0x588eb7=_0x5f609a;_0x1f8a9a['model']=_['keys'](db[_0x3f33('0x69')][_0x3f33('0x2e')]);_0x1f8a9a[_0x3f33('0x32')]=_[_0x3f33('0x33')](_0x5c3f1e['query']);_0x1f8a9a[_0x3f33('0x34')]=_[_0x3f33('0x47')](_0x1f8a9a[_0x3f33('0x31')],_0x1f8a9a[_0x3f33('0x32')]);_0x5933e2[_0x3f33('0x35')]=_['intersection'](_0x1f8a9a[_0x3f33('0x31')],qs[_0x3f33('0x36')](_0x5c3f1e[_0x3f33('0x32')][_0x3f33('0x36')]));_0x5933e2[_0x3f33('0x35')]=_0x5933e2[_0x3f33('0x35')][_0x3f33('0x37')]?_0x5933e2[_0x3f33('0x35')]:_0x1f8a9a[_0x3f33('0x31')];_0x5933e2['order']=qs[_0x3f33('0x3b')](_0x5c3f1e[_0x3f33('0x32')]['sort']);_0x5933e2[_0x3f33('0x40')]=qs[_0x3f33('0x34')](_[_0x3f33('0x52')](_0x5c3f1e['query'],_0x1f8a9a[_0x3f33('0x34')]));if(_0x5c3f1e[_0x3f33('0x32')][_0x3f33('0x3c')]){_0x5933e2[_0x3f33('0x40')]=_[_0x3f33('0x3d')](_0x5933e2[_0x3f33('0x40')],{'$or':_['map'](_0x5933e2[_0x3f33('0x35')],function(_0x29426b){var _0x1ed9e4={};_0x1ed9e4[_0x29426b]={'$like':'%'+_0x5c3f1e[_0x3f33('0x32')][_0x3f33('0x3c')]+'%'};return _0x1ed9e4;})});}_0x5933e2=_[_0x3f33('0x3d')]({},_0x5933e2,_0x5c3f1e[_0x3f33('0x3f')]);return _0x588eb7[_0x3f33('0x83')](_0x5933e2);}})['then'](function(_0x1342e9){if(_0x1342e9){_0x40a4e3=_0x1342e9['length'];if(!_0x5c3f1e[_0x3f33('0x32')]['hasOwnProperty']('nolimit')){_0x5933e2[_0x3f33('0x1e')]=qs[_0x3f33('0x1e')](_0x5c3f1e['query'][_0x3f33('0x1e')]);_0x5933e2[_0x3f33('0x1c')]=qs['offset'](_0x5c3f1e[_0x3f33('0x32')]['offset']);}return _0x588eb7[_0x3f33('0x83')](_0x5933e2);}})[_0x3f33('0x26')](function(_0xfd256d){if(_0xfd256d){return _0xfd256d?{'count':_0x40a4e3,'rows':_0xfd256d}:null;}})[_0x3f33('0x26')](respondWithResult(_0xb29cf8,null))[_0x3f33('0x45')](handleError(_0xb29cf8,null));}; \ No newline at end of file +var _0xfc5c=['UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','SmsQueue','findAll','catch','show','find','create','body','user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','smsPause','getTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userSmsQueue:save','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xfc5c,0x185));var _0xcfc5=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xfc5c[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfc5('0x0'));var zipdir=require(_0xcfc5('0x1'));var jsonpatch=require(_0xcfc5('0x2'));var rp=require('request-promise');var moment=require(_0xcfc5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcfc5('0x4'));var util=require('util');var path=require(_0xcfc5('0x5'));var sox=require(_0xcfc5('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfc5('0x7'));var _=require(_0xcfc5('0x8'));var squel=require(_0xcfc5('0x9'));var crypto=require(_0xcfc5('0xa'));var jsforce=require(_0xcfc5('0xb'));var deskjs=require(_0xcfc5('0xc'));var toCsv=require(_0xcfc5('0xd'));var querystring=require(_0xcfc5('0xe'));var Papa=require(_0xcfc5('0xf'));var Redis=require(_0xcfc5('0x10'));var authService=require(_0xcfc5('0x11'));var qs=require(_0xcfc5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfc5('0x13'));var logger=require(_0xcfc5('0x14'))(_0xcfc5('0x15'));var utils=require('../../config/utils');var config=require(_0xcfc5('0x16'));var licenseUtil=require(_0xcfc5('0x17'));var db=require(_0xcfc5('0x18'))['db'];config['redis']=_[_0xcfc5('0x19')](config['redis'],{'host':_0xcfc5('0x1a'),'port':0x18eb});var socket=require(_0xcfc5('0x1b'))(new Redis(config[_0xcfc5('0x1c')]));require(_0xcfc5('0x1d'))[_0xcfc5('0x1e')](socket);function respondWithStatusCode(_0x5e2778,_0x52a024){_0x52a024=_0x52a024||0xcc;return function(_0x1a3069){if(_0x1a3069){return _0x5e2778[_0xcfc5('0x1f')](_0x52a024);}return _0x5e2778[_0xcfc5('0x20')](_0x52a024)[_0xcfc5('0x21')]();};}function respondWithResult(_0x3343f1,_0x291b9a){_0x291b9a=_0x291b9a||0xc8;return function(_0x5bc849){if(_0x5bc849){return _0x3343f1['status'](_0x291b9a)[_0xcfc5('0x22')](_0x5bc849);}};}function respondWithFilteredResult(_0xd000c4,_0x3cb546){return function(_0x1757c9){if(_0x1757c9){var _0x24d6c1=typeof _0x3cb546[_0xcfc5('0x23')]===_0xcfc5('0x24')&&typeof _0x3cb546[_0xcfc5('0x25')]===_0xcfc5('0x24');var _0xc58856=_0x1757c9[_0xcfc5('0x26')];var _0x165cee=_0x24d6c1?0x0:_0x3cb546['offset'];var _0x254033=_0x24d6c1?_0x1757c9[_0xcfc5('0x26')]:_0x3cb546['offset']+_0x3cb546[_0xcfc5('0x25')];var _0x4506f7;if(_0x254033>=_0xc58856){_0x254033=_0xc58856;_0x4506f7=0xc8;}else{_0x4506f7=0xce;}_0xd000c4[_0xcfc5('0x20')](_0x4506f7);return _0xd000c4[_0xcfc5('0x27')](_0xcfc5('0x28'),_0x165cee+'-'+_0x254033+'/'+_0xc58856)[_0xcfc5('0x22')](_0x1757c9);}return null;};}function patchUpdates(_0xfb5148){return function(_0x5f59fe){try{jsonpatch[_0xcfc5('0x29')](_0x5f59fe,_0xfb5148,!![]);}catch(_0x1f0d69){return BPromise['reject'](_0x1f0d69);}return _0x5f59fe['save']();};}function saveUpdates(_0x1805a5,_0x3667d2){return function(_0x1cae10){if(_0x1cae10){return _0x1cae10[_0xcfc5('0x2a')](_0x1805a5)[_0xcfc5('0x2b')](function(_0x13eb68){return _0x13eb68;});}return null;};}function removeEntity(_0x49b842,_0x3d758b){return function(_0x5d8e79){if(_0x5d8e79){return _0x5d8e79[_0xcfc5('0x2c')]()[_0xcfc5('0x2b')](function(){var _0x1a87d5=_0x5d8e79[_0xcfc5('0x2d')]({'plain':!![]});var _0x29f89c='SmsQueues';return db[_0xcfc5('0x2e')][_0xcfc5('0x2c')]({'where':{'type':_0x29f89c,'resourceId':_0x1a87d5['id']}})['then'](function(){return _0x5d8e79;});})[_0xcfc5('0x2b')](function(){_0x49b842[_0xcfc5('0x20')](0xcc)[_0xcfc5('0x21')]();});}};}function handleEntityNotFound(_0x3a5c2c,_0x51435a){return function(_0x101061){if(!_0x101061){_0x3a5c2c[_0xcfc5('0x1f')](0x194);}return _0x101061;};}function handleError(_0x53097b,_0xb54a81){_0xb54a81=_0xb54a81||0x1f4;return function(_0x3cc56d){logger[_0xcfc5('0x2f')](_0x3cc56d['stack']);if(_0x3cc56d['name']){delete _0x3cc56d[_0xcfc5('0x30')];}_0x53097b[_0xcfc5('0x20')](_0xb54a81)[_0xcfc5('0x31')](_0x3cc56d);};}exports['index']=function(_0x4a3787,_0x4b79f3){var _0x797fe9={},_0x53c504={},_0x224dc7={'count':0x0,'rows':[]};var _0x142e25=_[_0xcfc5('0x32')](db['SmsQueue'][_0xcfc5('0x33')],function(_0x169fe7){return{'name':_0x169fe7[_0xcfc5('0x34')],'type':_0x169fe7[_0xcfc5('0x35')][_0xcfc5('0x36')]};});_0x53c504[_0xcfc5('0x37')]=_['map'](_0x142e25,_0xcfc5('0x30'));_0x53c504[_0xcfc5('0x38')]=_[_0xcfc5('0x39')](_0x4a3787[_0xcfc5('0x38')]);_0x53c504[_0xcfc5('0x3a')]=_[_0xcfc5('0x3b')](_0x53c504[_0xcfc5('0x37')],_0x53c504[_0xcfc5('0x38')]);_0x797fe9[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x53c504[_0xcfc5('0x37')],qs['fields'](_0x4a3787['query'][_0xcfc5('0x3d')]));_0x797fe9['attributes']=_0x797fe9[_0xcfc5('0x3c')][_0xcfc5('0x3e')]?_0x797fe9[_0xcfc5('0x3c')]:_0x53c504[_0xcfc5('0x37')];if(!_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x3f')](_0xcfc5('0x40'))){_0x797fe9['limit']=qs[_0xcfc5('0x25')](_0x4a3787['query'][_0xcfc5('0x25')]);_0x797fe9[_0xcfc5('0x23')]=qs[_0xcfc5('0x23')](_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x23')]);}_0x797fe9[_0xcfc5('0x41')]=qs['sort'](_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x797fe9[_0xcfc5('0x43')]=qs['filters'](_[_0xcfc5('0x44')](_0x4a3787[_0xcfc5('0x38')],_0x53c504[_0xcfc5('0x3a')]),_0x142e25);if(_0x4a3787['query'][_0xcfc5('0x45')]){_0x797fe9[_0xcfc5('0x43')]=_['merge'](_0x797fe9[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x142e25,function(_0x29dee9){if(_0x29dee9[_0xcfc5('0x35')]!==_0xcfc5('0x46')){var _0x59d102={};_0x59d102[_0x29dee9[_0xcfc5('0x30')]]={'$like':'%'+_0x4a3787[_0xcfc5('0x38')]['filter']+'%'};return _0x59d102;}})});}_0x797fe9=_[_0xcfc5('0x47')]({},_0x797fe9,_0x4a3787[_0xcfc5('0x48')]);var _0x3ab52b={'where':_0x797fe9['where']};return db['SmsQueue']['count'](_0x3ab52b)[_0xcfc5('0x2b')](function(_0x2a597e){_0x224dc7['count']=_0x2a597e;if(_0x4a3787[_0xcfc5('0x38')][_0xcfc5('0x49')]){_0x797fe9[_0xcfc5('0x4a')]=[{'all':!![]}];}return db[_0xcfc5('0x4b')][_0xcfc5('0x4c')](_0x797fe9);})[_0xcfc5('0x2b')](function(_0x429aa0){_0x224dc7['rows']=_0x429aa0;return _0x224dc7;})[_0xcfc5('0x2b')](respondWithFilteredResult(_0x4b79f3,_0x797fe9))[_0xcfc5('0x4d')](handleError(_0x4b79f3,null));};exports[_0xcfc5('0x4e')]=function(_0x34bc5c,_0x535a62){var _0x21aa84={'raw':!![],'where':{'id':_0x34bc5c['params']['id']}},_0x287611={};_0x287611[_0xcfc5('0x37')]=_[_0xcfc5('0x39')](db['SmsQueue'][_0xcfc5('0x33')]);_0x287611[_0xcfc5('0x38')]=_['keys'](_0x34bc5c[_0xcfc5('0x38')]);_0x287611['filters']=_[_0xcfc5('0x3b')](_0x287611['model'],_0x287611['query']);_0x21aa84[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x287611['model'],qs['fields'](_0x34bc5c[_0xcfc5('0x38')]['fields']));_0x21aa84[_0xcfc5('0x3c')]=_0x21aa84[_0xcfc5('0x3c')][_0xcfc5('0x3e')]?_0x21aa84[_0xcfc5('0x3c')]:_0x287611['model'];if(_0x34bc5c[_0xcfc5('0x38')][_0xcfc5('0x49')]){_0x21aa84[_0xcfc5('0x4a')]=[{'all':!![]}];}_0x21aa84=_[_0xcfc5('0x47')]({},_0x21aa84,_0x34bc5c[_0xcfc5('0x48')]);return db['SmsQueue'][_0xcfc5('0x4f')](_0x21aa84)[_0xcfc5('0x2b')](handleEntityNotFound(_0x535a62,null))[_0xcfc5('0x2b')](respondWithResult(_0x535a62,null))[_0xcfc5('0x4d')](handleError(_0x535a62,null));};exports[_0xcfc5('0x50')]=function(_0xd88e6a,_0x5f4457){return db[_0xcfc5('0x4b')][_0xcfc5('0x50')](_0xd88e6a[_0xcfc5('0x51')],{})[_0xcfc5('0x2b')](function(_0x3a3518){var _0x24d6fa=_0xd88e6a[_0xcfc5('0x52')][_0xcfc5('0x2d')]({'plain':!![]});if(!_0x24d6fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d6fa[_0xcfc5('0x53')]===_0xcfc5('0x52')){var _0x5d8f9e=_0x3a3518['get']({'plain':!![]});var _0x46eadf=_0xcfc5('0x54');return db[_0xcfc5('0x55')][_0xcfc5('0x4f')]({'where':{'name':_0x46eadf,'userProfileId':_0x24d6fa[_0xcfc5('0x56')]},'raw':!![]})[_0xcfc5('0x2b')](function(_0x305a45){if(_0x305a45&&_0x305a45[_0xcfc5('0x57')]===0x0){return db[_0xcfc5('0x2e')][_0xcfc5('0x50')]({'name':_0x5d8f9e[_0xcfc5('0x30')],'resourceId':_0x5d8f9e['id'],'type':_0x305a45[_0xcfc5('0x30')],'sectionId':_0x305a45['id']},{})['then'](function(){return _0x3a3518;});}else{return _0x3a3518;}})[_0xcfc5('0x4d')](function(_0x376020){logger[_0xcfc5('0x2f')](_0xcfc5('0x58'),_0x376020);throw _0x376020;});}return _0x3a3518;})[_0xcfc5('0x2b')](respondWithResult(_0x5f4457,0xc9))[_0xcfc5('0x4d')](handleError(_0x5f4457,null));};exports[_0xcfc5('0x2a')]=function(_0x1afde2,_0x4e12fb){if(_0x1afde2[_0xcfc5('0x51')]['id']){delete _0x1afde2[_0xcfc5('0x51')]['id'];}return db[_0xcfc5('0x4b')]['find']({'where':{'id':_0x1afde2[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x4e12fb,null))[_0xcfc5('0x2b')](saveUpdates(_0x1afde2[_0xcfc5('0x51')],null))[_0xcfc5('0x2b')](respondWithResult(_0x4e12fb,null))[_0xcfc5('0x4d')](handleError(_0x4e12fb,null));};exports[_0xcfc5('0x2c')]=function(_0x4a166c,_0x54f135){return db['SmsQueue']['find']({'where':{'id':_0x4a166c[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x54f135,null))['then'](removeEntity(_0x54f135,null))['catch'](handleError(_0x54f135,null));};exports['describe']=function(_0x309bb3,_0x15f312){return db['SmsQueue']['describe']()['then'](respondWithResult(_0x15f312,null))[_0xcfc5('0x4d')](handleError(_0x15f312,null));};exports[_0xcfc5('0x5a')]=function(_0x21ff12,_0x39d7f5,_0x156cae){var _0x5f0406={'raw':!![],'where':{}},_0x2d5d1e={},_0x16a779;return db[_0xcfc5('0x4b')][_0xcfc5('0x5b')]({'where':{'id':_0x21ff12[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x39d7f5,null))['then'](function(_0x49e354){if(_0x49e354){_0x16a779=_0x49e354[_0xcfc5('0x2d')]({'plain':!![]});_0x2d5d1e['model']=_[_0xcfc5('0x39')](db[_0xcfc5('0x5c')]['rawAttributes']);_0x2d5d1e[_0xcfc5('0x38')]=_['keys'](_0x21ff12[_0xcfc5('0x38')]);_0x2d5d1e['filters']=_[_0xcfc5('0x3b')](_0x2d5d1e[_0xcfc5('0x37')],_0x2d5d1e[_0xcfc5('0x38')]);_0x5f0406[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x2d5d1e[_0xcfc5('0x37')],qs[_0xcfc5('0x3d')](_0x21ff12[_0xcfc5('0x38')]['fields']));_0x5f0406[_0xcfc5('0x3c')]=_0x5f0406['attributes']['length']?_0x5f0406[_0xcfc5('0x3c')]:_0x2d5d1e['model'];if(!_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x3f')](_0xcfc5('0x40'))){_0x5f0406[_0xcfc5('0x25')]=qs[_0xcfc5('0x25')](_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x25')]);_0x5f0406['offset']=qs['offset'](_0x21ff12['query'][_0xcfc5('0x23')]);}_0x5f0406[_0xcfc5('0x41')]=qs['sort'](_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x5f0406[_0xcfc5('0x43')]=qs[_0xcfc5('0x3a')](_[_0xcfc5('0x44')](_0x21ff12[_0xcfc5('0x38')],_0x2d5d1e[_0xcfc5('0x3a')]));_0x5f0406[_0xcfc5('0x43')][_0xcfc5('0x5d')]=_0x49e354['id'];if(_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x45')]){_0x5f0406['where']=_['merge'](_0x5f0406[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x5f0406[_0xcfc5('0x3c')],function(_0x56505e){var _0x430398={};_0x430398[_0x56505e]={'$like':'%'+_0x21ff12[_0xcfc5('0x38')][_0xcfc5('0x45')]+'%'};return _0x430398;})});}_0x5f0406=_[_0xcfc5('0x47')]({},_0x5f0406,_0x21ff12['options']);return db['UserSmsQueue'][_0xcfc5('0x4c')](_0x5f0406);}})[_0xcfc5('0x2b')](function(_0x2675c7){if(_0x2675c7){return db[_0xcfc5('0x5e')][_0xcfc5('0x5f')]({'where':{'id':_[_0xcfc5('0x32')](_0x2675c7,_0xcfc5('0x60')),'role':'agent'},'attributes':['id',_0xcfc5('0x30'),'smsPause',_0xcfc5('0x61'),_0xcfc5('0x62')]});}})[_0xcfc5('0x2b')](function(_0xd4bfff){if(_0xd4bfff){return{'count':_0xd4bfff[_0xcfc5('0x26')],'rows':_[_0xcfc5('0x32')](_0xd4bfff[_0xcfc5('0x63')],function(_0x13c4f6){return{'membername':_0x13c4f6[_0xcfc5('0x30')],'UserId':_0x13c4f6['id'],'queue_name':_0x16a779[_0xcfc5('0x30')],'SmsQueueId':_0x16a779['id'],'interface':util[_0xcfc5('0x64')](_0xcfc5('0x65'),_0xcfc5('0x66'),_0x13c4f6[_0xcfc5('0x30')]),'penalty':0x0,'paused':_0x13c4f6[_0xcfc5('0x67')],'createdAt':_0x13c4f6['createdAt'],'updatedAt':_0x13c4f6[_0xcfc5('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcfc5('0x2b')](respondWithFilteredResult(_0x39d7f5,_0x5f0406))['catch'](handleError(_0x39d7f5,null));};exports[_0xcfc5('0x68')]=function(_0x1c61c5,_0x5a10cf,_0x42afe1){var _0x3bb36f={};var _0x26c2d5={};var _0x395219;var _0x590ae3;return db[_0xcfc5('0x4b')][_0xcfc5('0x5b')]({'where':{'id':_0x1c61c5[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x5a10cf,null))['then'](function(_0x11b795){if(_0x11b795){_0x395219=_0x11b795;_0x26c2d5[_0xcfc5('0x37')]=_[_0xcfc5('0x39')](db['Team'][_0xcfc5('0x33')]);_0x26c2d5[_0xcfc5('0x38')]=_[_0xcfc5('0x39')](_0x1c61c5[_0xcfc5('0x38')]);_0x26c2d5[_0xcfc5('0x3a')]=_[_0xcfc5('0x3b')](_0x26c2d5['model'],_0x26c2d5['query']);_0x3bb36f[_0xcfc5('0x3c')]=_[_0xcfc5('0x3b')](_0x26c2d5['model'],qs[_0xcfc5('0x3d')](_0x1c61c5['query'][_0xcfc5('0x3d')]));_0x3bb36f['attributes']=_0x3bb36f[_0xcfc5('0x3c')]['length']?_0x3bb36f[_0xcfc5('0x3c')]:_0x26c2d5[_0xcfc5('0x37')];_0x3bb36f[_0xcfc5('0x41')]=qs['sort'](_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x3bb36f[_0xcfc5('0x43')]=qs['filters'](_[_0xcfc5('0x44')](_0x1c61c5[_0xcfc5('0x38')],_0x26c2d5[_0xcfc5('0x3a')]));if(_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x45')]){_0x3bb36f[_0xcfc5('0x43')]=_['merge'](_0x3bb36f[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x3bb36f['attributes'],function(_0xc53b44){var _0x709519={};_0x709519[_0xc53b44]={'$like':'%'+_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x45')]+'%'};return _0x709519;})});}_0x3bb36f=_[_0xcfc5('0x47')]({},_0x3bb36f,_0x1c61c5[_0xcfc5('0x48')]);return _0x395219['getTeams'](_0x3bb36f);}})[_0xcfc5('0x2b')](function(_0x1c91d0){if(_0x1c91d0){_0x590ae3=_0x1c91d0[_0xcfc5('0x3e')];if(!_0x1c61c5[_0xcfc5('0x38')]['hasOwnProperty']('nolimit')){_0x3bb36f['limit']=qs[_0xcfc5('0x25')](_0x1c61c5['query'][_0xcfc5('0x25')]);_0x3bb36f[_0xcfc5('0x23')]=qs['offset'](_0x1c61c5[_0xcfc5('0x38')][_0xcfc5('0x23')]);}return _0x395219[_0xcfc5('0x68')](_0x3bb36f);}})[_0xcfc5('0x2b')](function(_0x2d618c){if(_0x2d618c){return _0x2d618c?{'count':_0x590ae3,'rows':_0x2d618c}:null;}})[_0xcfc5('0x2b')](respondWithResult(_0x5a10cf,null))[_0xcfc5('0x4d')](handleError(_0x5a10cf,null));};exports['addTeams']=function(_0x42d626,_0x391b95,_0x5a51c3){var _0xbd0dd=_0x42d626[_0xcfc5('0x51')][_0xcfc5('0x69')];return db[_0xcfc5('0x6a')]['findAll']({'where':{'id':_0xbd0dd},'attributes':['id'],'include':[{'model':db[_0xcfc5('0x5e')],'as':_0xcfc5('0x6b'),'attributes':['id',_0xcfc5('0x30'),_0xcfc5('0x6c'),_0xcfc5('0x6d'),_0xcfc5('0x6e')],'raw':!![]}]})['then'](function(_0x51a029){if(_0x51a029){var _0x2b64f6=_[_0xcfc5('0x6f')](_0x51a029,function(_0x5ad256){var _0x4a580b=_0x5ad256[_0xcfc5('0x2d')]({'plain':!![]});return _0x4a580b[_0xcfc5('0x6b')];});return db['SmsQueue'][_0xcfc5('0x4f')]({'where':{'id':_0x42d626[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](function(_0x1e4fa3){return db[_0xcfc5('0x70')][_0xcfc5('0x71')](function(_0x394f55){return _0x1e4fa3['addTeams'](_0xbd0dd,{'transaction':_0x394f55})[_0xcfc5('0x2b')](function(){return BPromise[_0xcfc5('0x72')](_0x2b64f6,function(_0x565813){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x565813['id'],'SmsQueueId':_0x42d626[_0xcfc5('0x59')]['id']},'transaction':_0x394f55});});})['then'](function(){_0x2b64f6[_0xcfc5('0x73')](function(_0x35b7f7){socket['emit'](_0xcfc5('0x74'),{'UserId':_0x35b7f7['id'],'SmsQueueId':_0x1e4fa3['id']});});});});});}})[_0xcfc5('0x2b')](respondWithStatusCode(_0x391b95,null))[_0xcfc5('0x4d')](handleError(_0x391b95,null));};exports['removeTeams']=function(_0x1b72a3,_0xf79cbe,_0x464d36){return db[_0xcfc5('0x6a')][_0xcfc5('0x4c')]({'where':{'id':_0x1b72a3['query'][_0xcfc5('0x69')]},'attributes':['id'],'include':[{'model':db[_0xcfc5('0x5e')],'as':_0xcfc5('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xcfc5('0x2b')](handleEntityNotFound(_0xf79cbe,null))[_0xcfc5('0x2b')](function(_0x53ad43){var _0x57069a=_[_0xcfc5('0x32')](_0x53ad43,'id');var _0x5b1598=[];var _0x508494=[];var _0x1058ba=squel['select']();_0x1058ba[_0xcfc5('0x75')](_0xcfc5('0x76'))[_0xcfc5('0x77')](_0xcfc5('0x78'),'tq')[_0xcfc5('0x79')](_0xcfc5('0x7a'),'ut',_0xcfc5('0x7b'))['where'](_0xcfc5('0x7c'),_0x1b72a3[_0xcfc5('0x59')]['id']);for(var _0x1e3ade=0x0;_0x1e3ade<_0x53ad43[_0xcfc5('0x3e')];_0x1e3ade+=0x1){let _0x8f1cd=_0x53ad43[_0x1e3ade];for(var _0x3ea874=0x0;_0x3ea874<_0x8f1cd[_0xcfc5('0x6b')][_0xcfc5('0x3e')];_0x3ea874+=0x1){let _0xe783ac=_0x8f1cd[_0xcfc5('0x6b')][_0x3ea874];var _0x419a26=_0x1058ba[_0xcfc5('0x7d')]();_0x419a26[_0xcfc5('0x43')](_0xcfc5('0x7e'),_0xe783ac['id']);_0x508494[_0xcfc5('0x7f')](db[_0xcfc5('0x70')][_0xcfc5('0x38')](_0x419a26[_0xcfc5('0x80')](),{'type':db[_0xcfc5('0x70')][_0xcfc5('0x81')][_0xcfc5('0x82')]})['then'](function(_0x5989a4){if(_0x5989a4['length']===0x1){return _0xe783ac['id'];}else{var _0x41b844=_['every'](_[_0xcfc5('0x32')](_0x5989a4,_0xcfc5('0x83')),function(_0x501899){return _['includes'](_0x57069a,_0x501899);});if(_0x41b844){return _0xe783ac['id'];}}}));}}return BPromise[_0xcfc5('0x84')](_0x508494)['then'](function(_0x5463a3){_0x5b1598=_(_0x5b1598)[_0xcfc5('0x85')](_0x5463a3)['compact']()[_0xcfc5('0x86')]();return db[_0xcfc5('0x4b')]['find']({'where':{'id':_0x1b72a3['params']['id']}})['then'](function(_0x7a3ab4){return db[_0xcfc5('0x70')][_0xcfc5('0x71')](function(_0x3c081e){return _0x7a3ab4[_0xcfc5('0x87')](_0x1b72a3[_0xcfc5('0x38')]['ids'],{'transaction':_0x3c081e})[_0xcfc5('0x2b')](function(){if(!_[_0xcfc5('0x88')](_0x5b1598)){return _0x7a3ab4[_0xcfc5('0x89')](_0x5b1598,{'transaction':_0x3c081e});}})[_0xcfc5('0x2b')](function(){_0x5b1598['forEach'](function(_0x5df35e){socket[_0xcfc5('0x8a')](_0xcfc5('0x8b'),{'UserId':_0x5df35e,'SmsQueueId':_0x7a3ab4['id']});});});});});});})[_0xcfc5('0x2b')](respondWithStatusCode(_0xf79cbe,null))[_0xcfc5('0x4d')](handleError(_0xf79cbe,null));};exports[_0xcfc5('0x8c')]=function(_0x51f352,_0x21d3cd,_0x57c2f6){return db['SmsQueue'][_0xcfc5('0x4f')]({'where':{'id':_0x51f352[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x21d3cd,null))['then'](function(_0xbddfcf){if(_0xbddfcf){return _0xbddfcf[_0xcfc5('0x8c')](_0x51f352[_0xcfc5('0x51')][_0xcfc5('0x69')],_[_0xcfc5('0x8d')](_0x51f352['body'],[_0xcfc5('0x69'),'id'])||{})[_0xcfc5('0x8e')](function(_0x4201db){for(var _0x4a58f5=0x0;_0x4a58f5<_0x51f352[_0xcfc5('0x51')][_0xcfc5('0x69')][_0xcfc5('0x3e')];_0x4a58f5+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x51f352[_0xcfc5('0x51')][_0xcfc5('0x69')][_0x4a58f5]),'SmsQueueId':Number(_0x51f352[_0xcfc5('0x59')]['id'])});}return _0x4201db;});}})[_0xcfc5('0x2b')](respondWithResult(_0x21d3cd,null))[_0xcfc5('0x4d')](handleError(_0x21d3cd,null));};exports['removeAgents']=function(_0x847868,_0x35b1cf,_0x228bdd){return db[_0xcfc5('0x4b')][_0xcfc5('0x4f')]({'where':{'id':_0x847868[_0xcfc5('0x59')]['id']}})[_0xcfc5('0x2b')](handleEntityNotFound(_0x35b1cf,null))[_0xcfc5('0x2b')](function(_0x21de0c){if(_0x21de0c){return _0x21de0c['removeAgents'](_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')])[_0xcfc5('0x2b')](function(){if(_[_0xcfc5('0x8f')](_0x847868['query'][_0xcfc5('0x69')])){for(var _0x1e762e=0x0;_0x1e762e<_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')]['length'];_0x1e762e+=0x1){socket[_0xcfc5('0x8a')](_0xcfc5('0x8b'),{'UserId':Number(_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')][_0x1e762e]),'SmsQueueId':Number(_0x847868[_0xcfc5('0x59')]['id'])});}}else{socket[_0xcfc5('0x8a')](_0xcfc5('0x8b'),{'UserId':Number(_0x847868[_0xcfc5('0x38')][_0xcfc5('0x69')]),'SmsQueueId':Number(_0x847868['params']['id'])});}});}})[_0xcfc5('0x2b')](respondWithStatusCode(_0x35b1cf,null))[_0xcfc5('0x4d')](handleError(_0x35b1cf,null));};exports[_0xcfc5('0x90')]=function(_0x403ca5,_0x60dfb1,_0x48cc8d){var _0x224005={};var _0x9e736e={};var _0x35aa9a;var _0x1f911f;return db[_0xcfc5('0x4b')]['findOne']({'where':{'id':_0x403ca5['params']['id']}})['then'](handleEntityNotFound(_0x60dfb1,null))['then'](function(_0x31928e){if(_0x31928e){_0x35aa9a=_0x31928e;_0x9e736e[_0xcfc5('0x37')]=_[_0xcfc5('0x39')](db['User'][_0xcfc5('0x33')]);_0x9e736e[_0xcfc5('0x38')]=_[_0xcfc5('0x39')](_0x403ca5['query']);_0x9e736e[_0xcfc5('0x3a')]=_['intersection'](_0x9e736e['model'],_0x9e736e[_0xcfc5('0x38')]);_0x224005[_0xcfc5('0x3c')]=_['intersection'](_0x9e736e[_0xcfc5('0x37')],qs[_0xcfc5('0x3d')](_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x3d')]));_0x224005[_0xcfc5('0x3c')]=_0x224005[_0xcfc5('0x3c')]['length']?_0x224005[_0xcfc5('0x3c')]:_0x9e736e['model'];_0x224005[_0xcfc5('0x41')]=qs[_0xcfc5('0x42')](_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x42')]);_0x224005[_0xcfc5('0x43')]=qs[_0xcfc5('0x3a')](_['pick'](_0x403ca5[_0xcfc5('0x38')],_0x9e736e[_0xcfc5('0x3a')]));if(_0x403ca5[_0xcfc5('0x38')]['filter']){_0x224005[_0xcfc5('0x43')]=_[_0xcfc5('0x47')](_0x224005[_0xcfc5('0x43')],{'$or':_[_0xcfc5('0x32')](_0x224005[_0xcfc5('0x3c')],function(_0x39c5b9){var _0xd9bcd9={};_0xd9bcd9[_0x39c5b9]={'$like':'%'+_0x403ca5['query'][_0xcfc5('0x45')]+'%'};return _0xd9bcd9;})});}_0x224005=_[_0xcfc5('0x47')]({},_0x224005,_0x403ca5[_0xcfc5('0x48')]);return _0x35aa9a[_0xcfc5('0x90')](_0x224005);}})['then'](function(_0xe3bd0){if(_0xe3bd0){_0x1f911f=_0xe3bd0['length'];if(!_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x3f')](_0xcfc5('0x40'))){_0x224005[_0xcfc5('0x25')]=qs[_0xcfc5('0x25')](_0x403ca5[_0xcfc5('0x38')]['limit']);_0x224005['offset']=qs[_0xcfc5('0x23')](_0x403ca5[_0xcfc5('0x38')][_0xcfc5('0x23')]);}return _0x35aa9a[_0xcfc5('0x90')](_0x224005);}})[_0xcfc5('0x2b')](function(_0x2de679){if(_0x2de679){return _0x2de679?{'count':_0x1f911f,'rows':_0x2de679}:null;}})['then'](respondWithResult(_0x60dfb1,null))['catch'](handleError(_0x60dfb1,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index dc3b658..c29d7c7 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 _0x46d0=['emit','hasOwnProperty','hook','events','setMaxListeners','save','update','remove'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x46d0,0xab));var _0x046d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46d0[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x046d('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x046d('0x1')](0x0);var events={'afterCreate':_0x046d('0x2'),'afterUpdate':_0x046d('0x3'),'afterDestroy':_0x046d('0x4')};function emitEvent(_0x4c6423){return function(_0x6a61e0,_0x1017af,_0x257e04){SmsQueueEvents[_0x046d('0x5')](_0x4c6423+':'+_0x6a61e0['id'],_0x6a61e0);SmsQueueEvents[_0x046d('0x5')](_0x4c6423,_0x6a61e0);_0x257e04(null);};}for(var e in events){if(events[_0x046d('0x6')](e)){var event=events[e];SmsQueue[_0x046d('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x82e4=['update','remove','emit','hasOwnProperty','exports','events','save'];(function(_0x3b4091,_0x5b8285){var _0x2a1d99=function(_0x1b0828){while(--_0x1b0828){_0x3b4091['push'](_0x3b4091['shift']());}};_0x2a1d99(++_0x5b8285);}(_0x82e4,0x147));var _0x482e=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x82e4[_0x368fb9];return _0x4892fb;};'use strict';var EventEmitter=require(_0x482e('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x482e('0x1'),'afterUpdate':_0x482e('0x2'),'afterDestroy':_0x482e('0x3')};function emitEvent(_0x2284b5){return function(_0x32a404,_0xbb1ecd,_0x5c1a51){SmsQueueEvents[_0x482e('0x4')](_0x2284b5+':'+_0x32a404['id'],_0x32a404);SmsQueueEvents['emit'](_0x2284b5,_0x32a404);_0x5c1a51(null);};}for(var e in events){if(events[_0x482e('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x482e('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a81af03..24e8cac 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 _0xc938=['./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4526a0,_0x17da38){var _0x2a69e9=function(_0x3a539c){while(--_0x3a539c){_0x4526a0['push'](_0x4526a0['shift']());}};_0x2a69e9(++_0x17da38);}(_0xc938,0x160));var _0x8c93=function(_0x5a3cc4,_0x3e22cb){_0x5a3cc4=_0x5a3cc4-0x0;var _0x1ececc=_0xc938[_0x5a3cc4];return _0x1ececc;};'use strict';var _=require(_0x8c93('0x0'));var util=require(_0x8c93('0x1'));var logger=require(_0x8c93('0x2'))(_0x8c93('0x3'));var moment=require(_0x8c93('0x4'));var BPromise=require(_0x8c93('0x5'));var rp=require(_0x8c93('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c93('0x7'));var attributes=require(_0x8c93('0x8'));module[_0x8c93('0x9')]=function(_0x15da6a,_0x3561a2){return _0x15da6a[_0x8c93('0xa')](_0x8c93('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c0=['path','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x23c6fb,_0x2cc1fd){var _0x2cb154=function(_0x599b02){while(--_0x599b02){_0x23c6fb['push'](_0x23c6fb['shift']());}};_0x2cb154(++_0x2cc1fd);}(_0xc3c0,0x115));var _0x0c3c=function(_0x1c5b6a,_0x2e6947){_0x1c5b6a=_0x1c5b6a-0x0;var _0x56c83b=_0xc3c0[_0x1c5b6a];return _0x56c83b;};'use strict';var _=require(_0x0c3c('0x0'));var util=require(_0x0c3c('0x1'));var logger=require(_0x0c3c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c3c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x0c3c('0x4')]=function(_0x2d7a02,_0x3a642f){return _0x2d7a02[_0x0c3c('0x5')](_0x0c3c('0x6'),attributes,{'tableName':_0x0c3c('0x7'),'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 d6e1b22..367d8cd 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 _0x4a6b=['ShowSmsQueue','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','where','attributes','limit','include','map','model','find','raw'];(function(_0x35a6ef,_0x44903c){var _0x7c1ad0=function(_0x232523){while(--_0x232523){_0x35a6ef['push'](_0x35a6ef['shift']());}};_0x7c1ad0(++_0x44903c);}(_0x4a6b,0x19b));var _0xb4a6=function(_0x1765d5,_0x3be12){_0x1765d5=_0x1765d5-0x0;var _0x1c9ad4=_0x4a6b[_0x1765d5];return _0x1c9ad4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4a6('0x0'));var BPromise=require(_0xb4a6('0x1'));var rs=require(_0xb4a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4a6('0x3'))['db'];var utils=require(_0xb4a6('0x4'));var logger=require(_0xb4a6('0x5'))(_0xb4a6('0x6'));var config=require(_0xb4a6('0x7'));var jayson=require(_0xb4a6('0x8'));var client=jayson[_0xb4a6('0x9')][_0xb4a6('0xa')]({'port':0x232a});config[_0xb4a6('0xb')]=_[_0xb4a6('0xc')](config[_0xb4a6('0xb')],{'host':_0xb4a6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4a6('0xb')]));require(_0xb4a6('0xe'))[_0xb4a6('0xf')](socket);function respondWithRpcPromise(_0xb812f7,_0x3216ea,_0x1cd1a4){return new BPromise(function(_0x41293d,_0x29cf0d){return client[_0xb4a6('0x10')](_0xb812f7,_0x1cd1a4)[_0xb4a6('0x11')](function(_0x694098){logger[_0xb4a6('0x12')](_0xb4a6('0x13'),_0x3216ea,_0xb4a6('0x14'));logger[_0xb4a6('0x15')](_0xb4a6('0x16'),_0x3216ea,_0xb4a6('0x14'),JSON[_0xb4a6('0x17')](_0x694098));if(_0x694098['error']){if(_0x694098[_0xb4a6('0x18')][_0xb4a6('0x19')]===0x1f4){logger[_0xb4a6('0x18')](_0xb4a6('0x13'),_0x3216ea,_0x694098['error'][_0xb4a6('0x1a')]);return _0x29cf0d(_0x694098[_0xb4a6('0x18')]['message']);}logger[_0xb4a6('0x18')](_0xb4a6('0x13'),_0x3216ea,_0x694098['error']['message']);return _0x41293d(_0x694098['error']['message']);}else{logger[_0xb4a6('0x12')](_0xb4a6('0x13'),_0x3216ea,_0xb4a6('0x14'));_0x41293d(_0x694098[_0xb4a6('0x1b')][_0xb4a6('0x1a')]);}})[_0xb4a6('0x1c')](function(_0x26abea){logger[_0xb4a6('0x18')](_0xb4a6('0x13'),_0x3216ea,_0x26abea);_0x29cf0d(_0x26abea);});});}exports[_0xb4a6('0x1d')]=function(_0x85fbc4){var _0x55e37e=this;return new Promise(function(_0x24823d,_0x1c0dc8){return db['SmsQueue'][_0xb4a6('0x1e')]({'raw':_0x85fbc4['options']?_0x85fbc4[_0xb4a6('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x85fbc4[_0xb4a6('0x1f')]?_0x85fbc4[_0xb4a6('0x1f')][_0xb4a6('0x20')]||null:null,'attributes':_0x85fbc4[_0xb4a6('0x1f')]?_0x85fbc4[_0xb4a6('0x1f')][_0xb4a6('0x21')]||null:null,'limit':_0x85fbc4['options']?_0x85fbc4[_0xb4a6('0x1f')][_0xb4a6('0x22')]||null:null,'include':_0x85fbc4['options']?_0x85fbc4[_0xb4a6('0x1f')][_0xb4a6('0x23')]?_['map'](_0x85fbc4[_0xb4a6('0x1f')][_0xb4a6('0x23')],function(_0x357aa9){return{'model':db[_0x357aa9['model']],'as':_0x357aa9['as'],'attributes':_0x357aa9[_0xb4a6('0x21')],'include':_0x357aa9[_0xb4a6('0x23')]?_[_0xb4a6('0x24')](_0x357aa9[_0xb4a6('0x23')],function(_0x5a65e1){return{'model':db[_0x5a65e1[_0xb4a6('0x25')]],'as':_0x5a65e1['as'],'attributes':_0x5a65e1['attributes'],'include':_0x5a65e1[_0xb4a6('0x23')]?_['map'](_0x5a65e1[_0xb4a6('0x23')],function(_0x1a7c19){return{'model':db[_0x1a7c19[_0xb4a6('0x25')]],'as':_0x1a7c19['as'],'attributes':_0x1a7c19[_0xb4a6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb4a6('0x11')](function(_0x4a6ccc){logger[_0xb4a6('0x12')](_0xb4a6('0x1d'),_0x85fbc4);logger[_0xb4a6('0x15')](_0xb4a6('0x1d'),_0x85fbc4,JSON[_0xb4a6('0x17')](_0x4a6ccc));_0x24823d(_0x4a6ccc);})['catch'](function(_0x25f1e4){logger[_0xb4a6('0x18')]('GetSmsQueue',_0x25f1e4[_0xb4a6('0x1a')],_0x85fbc4);_0x1c0dc8(_0x55e37e[_0xb4a6('0x18')](0x1f4,_0x25f1e4['message']));});});};exports['ShowSmsQueue']=function(_0xa524cd){var _0x3d6327=this;return new Promise(function(_0x26649e,_0x4ecbee){return db['SmsQueue'][_0xb4a6('0x26')]({'raw':_0xa524cd[_0xb4a6('0x1f')]?_0xa524cd['options'][_0xb4a6('0x27')]===undefined?!![]:![]:!![],'where':_0xa524cd[_0xb4a6('0x1f')]?_0xa524cd['options'][_0xb4a6('0x20')]||null:null,'attributes':_0xa524cd[_0xb4a6('0x1f')]?_0xa524cd[_0xb4a6('0x1f')]['attributes']||null:null,'include':_0xa524cd[_0xb4a6('0x1f')]?_0xa524cd[_0xb4a6('0x1f')][_0xb4a6('0x23')]?_[_0xb4a6('0x24')](_0xa524cd['options'][_0xb4a6('0x23')],function(_0x4b7535){return{'model':db[_0x4b7535['model']],'as':_0x4b7535['as'],'attributes':_0x4b7535[_0xb4a6('0x21')],'include':_0x4b7535[_0xb4a6('0x23')]?_[_0xb4a6('0x24')](_0x4b7535['include'],function(_0x4e8ca7){return{'model':db[_0x4e8ca7['model']],'as':_0x4e8ca7['as'],'attributes':_0x4e8ca7['attributes'],'include':_0x4e8ca7[_0xb4a6('0x23')]?_['map'](_0x4e8ca7['include'],function(_0x28a79f){return{'model':db[_0x28a79f[_0xb4a6('0x25')]],'as':_0x28a79f['as'],'attributes':_0x28a79f[_0xb4a6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb4a6('0x11')](function(_0x4b5885){logger[_0xb4a6('0x12')]('ShowSmsQueue',_0xa524cd);logger['debug'](_0xb4a6('0x28'),_0xa524cd,JSON[_0xb4a6('0x17')](_0x4b5885));_0x26649e(_0x4b5885);})[_0xb4a6('0x1c')](function(_0x39aa30){logger[_0xb4a6('0x18')](_0xb4a6('0x28'),_0x39aa30[_0xb4a6('0x1a')],_0xa524cd);_0x4ecbee(_0x3d6327[_0xb4a6('0x18')](0x1f4,_0x39aa30[_0xb4a6('0x1a')]));});});}; \ No newline at end of file +var _0x10ec=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','raw','options','attributes','include','map','model','catch','ShowSmsQueue','find','where','info'];(function(_0xeefec5,_0x4c9f98){var _0x38ea5d=function(_0x11c629){while(--_0x11c629){_0xeefec5['push'](_0xeefec5['shift']());}};_0x38ea5d(++_0x4c9f98);}(_0x10ec,0x98));var _0xc10e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x10ec[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0xc10e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc10e('0x1'));var db=require(_0xc10e('0x2'))['db'];var utils=require(_0xc10e('0x3'));var logger=require(_0xc10e('0x4'))(_0xc10e('0x5'));var config=require(_0xc10e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc10e('0x7')][_0xc10e('0x8')]({'port':0x232a});config[_0xc10e('0x9')]=_[_0xc10e('0xa')](config[_0xc10e('0x9')],{'host':_0xc10e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc10e('0xc'))[_0xc10e('0xd')](socket);function respondWithRpcPromise(_0x5804d4,_0x14b956,_0x196499){return new BPromise(function(_0x849eec,_0x1a5482){return client[_0xc10e('0xe')](_0x5804d4,_0x196499)[_0xc10e('0xf')](function(_0x1b1a53){logger['info'](_0xc10e('0x10'),_0x14b956,'request\x20sent');logger[_0xc10e('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x14b956,_0xc10e('0x12'),JSON[_0xc10e('0x13')](_0x1b1a53));if(_0x1b1a53[_0xc10e('0x14')]){if(_0x1b1a53['error'][_0xc10e('0x15')]===0x1f4){logger[_0xc10e('0x14')]('SmsQueue,\x20%s,\x20%s',_0x14b956,_0x1b1a53[_0xc10e('0x14')][_0xc10e('0x16')]);return _0x1a5482(_0x1b1a53['error']['message']);}logger[_0xc10e('0x14')](_0xc10e('0x10'),_0x14b956,_0x1b1a53[_0xc10e('0x14')]['message']);return _0x849eec(_0x1b1a53[_0xc10e('0x14')]['message']);}else{logger['info'](_0xc10e('0x10'),_0x14b956,_0xc10e('0x12'));_0x849eec(_0x1b1a53[_0xc10e('0x17')][_0xc10e('0x16')]);}})['catch'](function(_0x1cfc6e){logger['error']('SmsQueue,\x20%s,\x20%s',_0x14b956,_0x1cfc6e);_0x1a5482(_0x1cfc6e);});});}exports[_0xc10e('0x18')]=function(_0xc71a09){var _0x4884f4=this;return new Promise(function(_0x3df795,_0x4b9606){return db[_0xc10e('0x19')][_0xc10e('0x1a')]({'raw':_0xc71a09['options']?_0xc71a09['options'][_0xc10e('0x1b')]===undefined?!![]:![]:!![],'where':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09[_0xc10e('0x1c')]['where']||null:null,'attributes':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09[_0xc10e('0x1c')][_0xc10e('0x1d')]||null:null,'limit':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09[_0xc10e('0x1c')]['limit']||null:null,'include':_0xc71a09[_0xc10e('0x1c')]?_0xc71a09['options'][_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0xc71a09[_0xc10e('0x1c')][_0xc10e('0x1e')],function(_0x14ff9d){return{'model':db[_0x14ff9d[_0xc10e('0x20')]],'as':_0x14ff9d['as'],'attributes':_0x14ff9d[_0xc10e('0x1d')],'include':_0x14ff9d['include']?_[_0xc10e('0x1f')](_0x14ff9d[_0xc10e('0x1e')],function(_0x12eadd){return{'model':db[_0x12eadd['model']],'as':_0x12eadd['as'],'attributes':_0x12eadd['attributes'],'include':_0x12eadd['include']?_[_0xc10e('0x1f')](_0x12eadd[_0xc10e('0x1e')],function(_0xd2ca87){return{'model':db[_0xd2ca87[_0xc10e('0x20')]],'as':_0xd2ca87['as'],'attributes':_0xd2ca87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab6a3){logger['info'](_0xc10e('0x18'),_0xc71a09);logger['debug']('GetSmsQueue',_0xc71a09,JSON[_0xc10e('0x13')](_0x5ab6a3));_0x3df795(_0x5ab6a3);})[_0xc10e('0x21')](function(_0x2f0132){logger[_0xc10e('0x14')](_0xc10e('0x18'),_0x2f0132['message'],_0xc71a09);_0x4b9606(_0x4884f4['error'](0x1f4,_0x2f0132[_0xc10e('0x16')]));});});};exports[_0xc10e('0x22')]=function(_0x1aaf01){var _0x107daf=this;return new Promise(function(_0x5ae636,_0x58ace6){return db[_0xc10e('0x19')][_0xc10e('0x23')]({'raw':_0x1aaf01[_0xc10e('0x1c')]?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1aaf01[_0xc10e('0x1c')]?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x24')]||null:null,'attributes':_0x1aaf01['options']?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1d')]||null:null,'include':_0x1aaf01[_0xc10e('0x1c')]?_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0x1aaf01[_0xc10e('0x1c')][_0xc10e('0x1e')],function(_0x24dd49){return{'model':db[_0x24dd49['model']],'as':_0x24dd49['as'],'attributes':_0x24dd49[_0xc10e('0x1d')],'include':_0x24dd49[_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0x24dd49['include'],function(_0x5d84b8){return{'model':db[_0x5d84b8['model']],'as':_0x5d84b8['as'],'attributes':_0x5d84b8[_0xc10e('0x1d')],'include':_0x5d84b8[_0xc10e('0x1e')]?_[_0xc10e('0x1f')](_0x5d84b8[_0xc10e('0x1e')],function(_0x4c2213){return{'model':db[_0x4c2213[_0xc10e('0x20')]],'as':_0x4c2213['as'],'attributes':_0x4c2213[_0xc10e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc10e('0xf')](function(_0x28d18b){logger[_0xc10e('0x25')]('ShowSmsQueue',_0x1aaf01);logger['debug'](_0xc10e('0x22'),_0x1aaf01,JSON[_0xc10e('0x13')](_0x28d18b));_0x5ae636(_0x28d18b);})['catch'](function(_0x123e66){logger[_0xc10e('0x14')]('ShowSmsQueue',_0x123e66[_0xc10e('0x16')],_0x1aaf01);_0x58ace6(_0x107daf[_0xc10e('0x14')](0x1f4,_0x123e66[_0xc10e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c1304a6..35ada6f 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 _0x8bcf=['emit','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x37d9f1,_0x6f01d6){var _0x263586=function(_0x4c989b){while(--_0x4c989b){_0x37d9f1['push'](_0x37d9f1['shift']());}};_0x263586(++_0x6f01d6);}(_0x8bcf,0x135));var _0xf8bc=function(_0x373799,_0x4bac92){_0x373799=_0x373799-0x0;var _0x4eee03=_0x8bcf[_0x373799];return _0x4eee03;};'use strict';var SmsQueueEvents=require(_0xf8bc('0x0'));var events=['save',_0xf8bc('0x1'),_0xf8bc('0x2')];function createListener(_0x213de7,_0x28bb25){return function(_0x3375bb){_0x28bb25[_0xf8bc('0x3')](_0x213de7,_0x3375bb);};}function removeListener(_0x54e3f6,_0x314d7f){return function(){SmsQueueEvents['removeListener'](_0x54e3f6,_0x314d7f);};}exports['register']=function(_0x527e0c){for(var _0x23885f=0x0,_0x1378c1=events[_0xf8bc('0x4')];_0x23885f<_0x1378c1;_0x23885f++){var _0x2503de=events[_0x23885f];var _0x5c2800=createListener(_0xf8bc('0x5')+_0x2503de,_0x527e0c);SmsQueueEvents['on'](_0x2503de,_0x5c2800);}}; \ No newline at end of file +var _0x8d0d=['smsQueue:','save','remove','emit','removeListener','register','length'];(function(_0x496cdc,_0x9d6db3){var _0x103a8e=function(_0x1c625a){while(--_0x1c625a){_0x496cdc['push'](_0x496cdc['shift']());}};_0x103a8e(++_0x9d6db3);}(_0x8d0d,0x1c1));var _0xd8d0=function(_0x4fefca,_0x1a74df){_0x4fefca=_0x4fefca-0x0;var _0x2a21d3=_0x8d0d[_0x4fefca];return _0x2a21d3;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xd8d0('0x0'),_0xd8d0('0x1'),'update'];function createListener(_0x1ed02d,_0x1a34b8){return function(_0x3ca226){_0x1a34b8[_0xd8d0('0x2')](_0x1ed02d,_0x3ca226);};}function removeListener(_0xba221c,_0x41a202){return function(){SmsQueueEvents[_0xd8d0('0x3')](_0xba221c,_0x41a202);};}exports[_0xd8d0('0x4')]=function(_0x232614){for(var _0x13e0c3=0x0,_0x3854b3=events[_0xd8d0('0x5')];_0x13e0c3<_0x3854b3;_0x13e0c3++){var _0x25d4a8=events[_0x13e0c3];var _0x1c06f6=createListener(_0xd8d0('0x6')+_0x25d4a8,_0x232614);SmsQueueEvents['on'](_0x25d4a8,_0x1c06f6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6a76b38..06322f1 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 _0x2882=['show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x1c8abb,_0x4fe2f9){var _0x58eb71=function(_0x5ee26a){while(--_0x5ee26a){_0x1c8abb['push'](_0x1c8abb['shift']());}};_0x58eb71(++_0x4fe2f9);}(_0x2882,0x1db));var _0x2288=function(_0x3b7960,_0x219693){_0x3b7960=_0x3b7960-0x0;var _0x1c20ff=_0x2882[_0x3b7960];return _0x1c20ff;};'use strict';var multer=require(_0x2288('0x0'));var util=require('util');var path=require(_0x2288('0x1'));var timeout=require(_0x2288('0x2'));var express=require(_0x2288('0x3'));var router=express[_0x2288('0x4')]();var fs_extra=require(_0x2288('0x5'));var auth=require(_0x2288('0x6'));var interaction=require(_0x2288('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x2288('0x8')](),controller['index']);router[_0x2288('0x9')](_0x2288('0xa'),auth[_0x2288('0x8')](),controller['describe']);router[_0x2288('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2288('0xb')]);router[_0x2288('0xc')]('/',auth[_0x2288('0x8')](),controller[_0x2288('0xd')]);router[_0x2288('0xe')]('/:id',auth[_0x2288('0x8')](),controller['update']);router['delete'](_0x2288('0xf'),auth[_0x2288('0x8')](),controller[_0x2288('0x10')]);module[_0x2288('0x11')]=router; \ No newline at end of file +var _0x3dc1=['post','put','/:id','update','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show'];(function(_0x6d8070,_0x37866b){var _0x3ae618=function(_0x3ca55d){while(--_0x3ca55d){_0x6d8070['push'](_0x6d8070['shift']());}};_0x3ae618(++_0x37866b);}(_0x3dc1,0x127));var _0x13dc=function(_0x41ee6a,_0x300f6a){_0x41ee6a=_0x41ee6a-0x0;var _0x471405=_0x3dc1[_0x41ee6a];return _0x471405;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x13dc('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13dc('0x1')]();var fs_extra=require(_0x13dc('0x2'));var auth=require(_0x13dc('0x3'));var interaction=require(_0x13dc('0x4'));var config=require(_0x13dc('0x5'));var controller=require('./smsQueueReport.controller');router[_0x13dc('0x6')]('/',auth[_0x13dc('0x7')](),controller['index']);router['get'](_0x13dc('0x8'),auth['isAuthenticated'](),controller[_0x13dc('0x9')]);router[_0x13dc('0x6')]('/:id',auth[_0x13dc('0x7')](),controller[_0x13dc('0xa')]);router[_0x13dc('0xb')]('/',auth[_0x13dc('0x7')](),controller['create']);router[_0x13dc('0xc')](_0x13dc('0xd'),auth['isAuthenticated'](),controller[_0x13dc('0xe')]);router[_0x13dc('0xf')](_0x13dc('0xd'),auth['isAuthenticated'](),controller[_0x13dc('0x10')]);module[_0x13dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 94914da..23fef09 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 _0xee5c=['DATE','moment','sequelize','STRING'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xee5c,0xcd));var _0xcee5=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xee5c[_0x5416db];return _0x243e35;};'use strict';var moment=require(_0xcee5('0x0'));var Sequelize=require(_0xcee5('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcee5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcee5('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcee5('0x3')]},'acceptAt':{'type':Sequelize[_0xcee5('0x3')]},'exitAt':{'type':Sequelize[_0xcee5('0x3')]},'reason':{'type':Sequelize[_0xcee5('0x2')]}}; \ No newline at end of file +var _0xe103=['sequelize','STRING','DATE','moment'];(function(_0x20a1cf,_0x48ea4e){var _0x27b3dc=function(_0x366c88){while(--_0x366c88){_0x20a1cf['push'](_0x20a1cf['shift']());}};_0x27b3dc(++_0x48ea4e);}(_0xe103,0x12f));var _0x3e10=function(_0x15f287,_0x511407){_0x15f287=_0x15f287-0x0;var _0x3c858a=_0xe103[_0x15f287];return _0x3c858a;};'use strict';var moment=require(_0x3e10('0x0'));var Sequelize=require(_0x3e10('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3e10('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3e10('0x2')]},'joinAt':{'type':Sequelize[_0x3e10('0x3')]},'leaveAt':{'type':Sequelize[_0x3e10('0x3')]},'acceptAt':{'type':Sequelize[_0x3e10('0x3')]},'exitAt':{'type':Sequelize[_0x3e10('0x3')]},'reason':{'type':Sequelize[_0x3e10('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 203ead5..5d74781 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 _0x8039=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x43bc6b,_0x2b577c){var _0x114255=function(_0x2310e2){while(--_0x2310e2){_0x43bc6b['push'](_0x43bc6b['shift']());}};_0x114255(++_0x2b577c);}(_0x8039,0x14a));var _0x9803=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x8039[_0x3f3f40];return _0x403b7a;};'use strict';var emlformat=require(_0x9803('0x0'));var rimraf=require(_0x9803('0x1'));var zipdir=require(_0x9803('0x2'));var jsonpatch=require(_0x9803('0x3'));var rp=require(_0x9803('0x4'));var moment=require(_0x9803('0x5'));var BPromise=require(_0x9803('0x6'));var Mustache=require(_0x9803('0x7'));var util=require(_0x9803('0x8'));var path=require(_0x9803('0x9'));var sox=require('sox');var csv=require(_0x9803('0xa'));var ejs=require(_0x9803('0xb'));var fs=require('fs');var fs_extra=require(_0x9803('0xc'));var _=require(_0x9803('0xd'));var squel=require(_0x9803('0xe'));var crypto=require(_0x9803('0xf'));var jsforce=require(_0x9803('0x10'));var deskjs=require(_0x9803('0x11'));var toCsv=require(_0x9803('0xa'));var querystring=require(_0x9803('0x12'));var Papa=require(_0x9803('0x13'));var Redis=require(_0x9803('0x14'));var authService=require(_0x9803('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x9803('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9803('0x17'));var utils=require(_0x9803('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9803('0x19'))['db'];function respondWithStatusCode(_0x2e0870,_0x35817a){_0x35817a=_0x35817a||0xcc;return function(_0x416161){if(_0x416161){return _0x2e0870[_0x9803('0x1a')](_0x35817a);}return _0x2e0870['status'](_0x35817a)[_0x9803('0x1b')]();};}function respondWithResult(_0x1e1519,_0x341c9f){_0x341c9f=_0x341c9f||0xc8;return function(_0x4e9c6d){if(_0x4e9c6d){return _0x1e1519[_0x9803('0x1c')](_0x341c9f)[_0x9803('0x1d')](_0x4e9c6d);}};}function respondWithFilteredResult(_0xdaeb9b,_0x12830a){return function(_0x16d172){if(_0x16d172){var _0x531ebd=typeof _0x12830a[_0x9803('0x1e')]==='undefined'&&typeof _0x12830a['limit']===_0x9803('0x1f');var _0x5c9598=_0x16d172[_0x9803('0x20')];var _0x57e015=_0x531ebd?0x0:_0x12830a['offset'];var _0x2747eb=_0x531ebd?_0x16d172[_0x9803('0x20')]:_0x12830a[_0x9803('0x1e')]+_0x12830a[_0x9803('0x21')];var _0x48aa87;if(_0x2747eb>=_0x5c9598){_0x2747eb=_0x5c9598;_0x48aa87=0xc8;}else{_0x48aa87=0xce;}_0xdaeb9b[_0x9803('0x1c')](_0x48aa87);return _0xdaeb9b[_0x9803('0x22')](_0x9803('0x23'),_0x57e015+'-'+_0x2747eb+'/'+_0x5c9598)[_0x9803('0x1d')](_0x16d172);}return null;};}function patchUpdates(_0x34f4c9){return function(_0x2109b7){try{jsonpatch[_0x9803('0x24')](_0x2109b7,_0x34f4c9,!![]);}catch(_0x25d011){return BPromise[_0x9803('0x25')](_0x25d011);}return _0x2109b7[_0x9803('0x26')]();};}function saveUpdates(_0x5c1c07,_0x32e18b){return function(_0xcc6ab0){if(_0xcc6ab0){return _0xcc6ab0['update'](_0x5c1c07)[_0x9803('0x27')](function(_0x1e1d93){return _0x1e1d93;});}return null;};}function removeEntity(_0xa3b6c5,_0x1798d2){return function(_0x42566f){if(_0x42566f){return _0x42566f[_0x9803('0x28')]()['then'](function(){_0xa3b6c5[_0x9803('0x1c')](0xcc)[_0x9803('0x1b')]();});}};}function handleEntityNotFound(_0x4e9d34,_0x695cf){return function(_0x51b44e){if(!_0x51b44e){_0x4e9d34['sendStatus'](0x194);}return _0x51b44e;};}function handleError(_0x348719,_0x4044e4){_0x4044e4=_0x4044e4||0x1f4;return function(_0x3f3c47){logger[_0x9803('0x29')](_0x3f3c47['stack']);if(_0x3f3c47[_0x9803('0x2a')]){delete _0x3f3c47[_0x9803('0x2a')];}_0x348719[_0x9803('0x1c')](_0x4044e4)[_0x9803('0x2b')](_0x3f3c47);};}exports[_0x9803('0x2c')]=function(_0x3b729f,_0x52b45e){var _0x18d1bf={},_0x3a562b={},_0x4d6c50={'count':0x0,'rows':[]};var _0x5f71be=_[_0x9803('0x2d')](db[_0x9803('0x2e')][_0x9803('0x2f')],function(_0x551155){return{'name':_0x551155[_0x9803('0x30')],'type':_0x551155[_0x9803('0x31')][_0x9803('0x32')]};});_0x3a562b[_0x9803('0x33')]=_[_0x9803('0x2d')](_0x5f71be,_0x9803('0x2a'));_0x3a562b[_0x9803('0x34')]=_[_0x9803('0x35')](_0x3b729f[_0x9803('0x34')]);_0x3a562b[_0x9803('0x36')]=_[_0x9803('0x37')](_0x3a562b[_0x9803('0x33')],_0x3a562b[_0x9803('0x34')]);_0x18d1bf[_0x9803('0x38')]=_[_0x9803('0x37')](_0x3a562b[_0x9803('0x33')],qs[_0x9803('0x39')](_0x3b729f[_0x9803('0x34')][_0x9803('0x39')]));_0x18d1bf['attributes']=_0x18d1bf['attributes'][_0x9803('0x3a')]?_0x18d1bf[_0x9803('0x38')]:_0x3a562b[_0x9803('0x33')];if(!_0x3b729f[_0x9803('0x34')][_0x9803('0x3b')](_0x9803('0x3c'))){_0x18d1bf['limit']=qs[_0x9803('0x21')](_0x3b729f['query']['limit']);_0x18d1bf[_0x9803('0x1e')]=qs[_0x9803('0x1e')](_0x3b729f[_0x9803('0x34')][_0x9803('0x1e')]);}_0x18d1bf[_0x9803('0x3d')]=qs[_0x9803('0x3e')](_0x3b729f[_0x9803('0x34')]['sort']);_0x18d1bf[_0x9803('0x3f')]=qs[_0x9803('0x36')](_['pick'](_0x3b729f[_0x9803('0x34')],_0x3a562b['filters']),_0x5f71be);if(_0x3b729f[_0x9803('0x34')]['filter']){_0x18d1bf[_0x9803('0x3f')]=_[_0x9803('0x40')](_0x18d1bf[_0x9803('0x3f')],{'$or':_[_0x9803('0x2d')](_0x5f71be,function(_0x252f37){if(_0x252f37['type']!==_0x9803('0x41')){var _0x269e7c={};_0x269e7c[_0x252f37[_0x9803('0x2a')]]={'$like':'%'+_0x3b729f['query'][_0x9803('0x42')]+'%'};return _0x269e7c;}})});}_0x18d1bf=_[_0x9803('0x40')]({},_0x18d1bf,_0x3b729f['options']);var _0x2c5114={'where':_0x18d1bf[_0x9803('0x3f')]};return db[_0x9803('0x2e')][_0x9803('0x20')](_0x2c5114)[_0x9803('0x27')](function(_0x402378){_0x4d6c50['count']=_0x402378;if(_0x3b729f[_0x9803('0x34')][_0x9803('0x43')]){_0x18d1bf[_0x9803('0x44')]=[{'all':!![]}];}return db[_0x9803('0x2e')]['findAll'](_0x18d1bf);})[_0x9803('0x27')](function(_0x39cf0f){_0x4d6c50[_0x9803('0x45')]=_0x39cf0f;return _0x4d6c50;})[_0x9803('0x27')](respondWithFilteredResult(_0x52b45e,_0x18d1bf))[_0x9803('0x46')](handleError(_0x52b45e,null));};exports['show']=function(_0x5612ba,_0x19946e){var _0x5be6eb={'raw':!![],'where':{'id':_0x5612ba['params']['id']}},_0x47c7e6={};_0x47c7e6[_0x9803('0x33')]=_[_0x9803('0x35')](db[_0x9803('0x2e')][_0x9803('0x2f')]);_0x47c7e6[_0x9803('0x34')]=_[_0x9803('0x35')](_0x5612ba[_0x9803('0x34')]);_0x47c7e6[_0x9803('0x36')]=_[_0x9803('0x37')](_0x47c7e6['model'],_0x47c7e6[_0x9803('0x34')]);_0x5be6eb['attributes']=_[_0x9803('0x37')](_0x47c7e6[_0x9803('0x33')],qs['fields'](_0x5612ba[_0x9803('0x34')]['fields']));_0x5be6eb[_0x9803('0x38')]=_0x5be6eb[_0x9803('0x38')][_0x9803('0x3a')]?_0x5be6eb['attributes']:_0x47c7e6['model'];if(_0x5612ba[_0x9803('0x34')][_0x9803('0x43')]){_0x5be6eb['include']=[{'all':!![]}];}_0x5be6eb=_[_0x9803('0x40')]({},_0x5be6eb,_0x5612ba['options']);return db[_0x9803('0x2e')][_0x9803('0x47')](_0x5be6eb)['then'](handleEntityNotFound(_0x19946e,null))[_0x9803('0x27')](respondWithResult(_0x19946e,null))['catch'](handleError(_0x19946e,null));};exports[_0x9803('0x48')]=function(_0x3587b9,_0x577755){return db[_0x9803('0x2e')]['create'](_0x3587b9[_0x9803('0x49')],{})[_0x9803('0x27')](respondWithResult(_0x577755,0xc9))[_0x9803('0x46')](handleError(_0x577755,null));};exports[_0x9803('0x4a')]=function(_0x452e05,_0x326569){if(_0x452e05[_0x9803('0x49')]['id']){delete _0x452e05[_0x9803('0x49')]['id'];}return db[_0x9803('0x2e')][_0x9803('0x47')]({'where':{'id':_0x452e05[_0x9803('0x4b')]['id']}})['then'](handleEntityNotFound(_0x326569,null))[_0x9803('0x27')](saveUpdates(_0x452e05[_0x9803('0x49')],null))[_0x9803('0x27')](respondWithResult(_0x326569,null))[_0x9803('0x46')](handleError(_0x326569,null));};exports['destroy']=function(_0x1e7d8c,_0x1f8eab){return db[_0x9803('0x2e')][_0x9803('0x47')]({'where':{'id':_0x1e7d8c['params']['id']}})[_0x9803('0x27')](handleEntityNotFound(_0x1f8eab,null))[_0x9803('0x27')](removeEntity(_0x1f8eab,null))[_0x9803('0x46')](handleError(_0x1f8eab,null));};exports['describe']=function(_0x339689,_0x112fbf){return db[_0x9803('0x2e')][_0x9803('0x4c')]()[_0x9803('0x27')](respondWithResult(_0x112fbf,null))[_0x9803('0x46')](handleError(_0x112fbf,null));}; \ No newline at end of file +var _0x46db=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields'];(function(_0x3bd45c,_0x4782d0){var _0x1d559f=function(_0x3cfe35){while(--_0x3cfe35){_0x3bd45c['push'](_0x3bd45c['shift']());}};_0x1d559f(++_0x4782d0);}(_0x46db,0x193));var _0xb46d=function(_0xcb706d,_0x6d20c6){_0xcb706d=_0xcb706d-0x0;var _0x351a95=_0x46db[_0xcb706d];return _0x351a95;};'use strict';var emlformat=require(_0xb46d('0x0'));var rimraf=require(_0xb46d('0x1'));var zipdir=require(_0xb46d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb46d('0x3'));var moment=require(_0xb46d('0x4'));var BPromise=require(_0xb46d('0x5'));var Mustache=require(_0xb46d('0x6'));var util=require(_0xb46d('0x7'));var path=require(_0xb46d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb46d('0x9'));var _=require(_0xb46d('0xa'));var squel=require(_0xb46d('0xb'));var crypto=require(_0xb46d('0xc'));var jsforce=require(_0xb46d('0xd'));var deskjs=require(_0xb46d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb46d('0xf'));var Papa=require(_0xb46d('0x10'));var Redis=require(_0xb46d('0x11'));var authService=require(_0xb46d('0x12'));var qs=require(_0xb46d('0x13'));var as=require(_0xb46d('0x14'));var hardwareService=require(_0xb46d('0x15'));var logger=require(_0xb46d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb46d('0x17'));var licenseUtil=require(_0xb46d('0x18'));var db=require(_0xb46d('0x19'))['db'];function respondWithStatusCode(_0x5f4573,_0x53a2a2){_0x53a2a2=_0x53a2a2||0xcc;return function(_0x4b6704){if(_0x4b6704){return _0x5f4573[_0xb46d('0x1a')](_0x53a2a2);}return _0x5f4573[_0xb46d('0x1b')](_0x53a2a2)[_0xb46d('0x1c')]();};}function respondWithResult(_0x56d9bc,_0x44474d){_0x44474d=_0x44474d||0xc8;return function(_0x33e25f){if(_0x33e25f){return _0x56d9bc[_0xb46d('0x1b')](_0x44474d)[_0xb46d('0x1d')](_0x33e25f);}};}function respondWithFilteredResult(_0x44bf8f,_0x3e93d4){return function(_0x48bce0){if(_0x48bce0){var _0x81e55c=typeof _0x3e93d4[_0xb46d('0x1e')]==='undefined'&&typeof _0x3e93d4[_0xb46d('0x1f')]===_0xb46d('0x20');var _0x25b654=_0x48bce0[_0xb46d('0x21')];var _0x7dfc55=_0x81e55c?0x0:_0x3e93d4[_0xb46d('0x1e')];var _0x4a78cc=_0x81e55c?_0x48bce0['count']:_0x3e93d4[_0xb46d('0x1e')]+_0x3e93d4[_0xb46d('0x1f')];var _0x43d26b;if(_0x4a78cc>=_0x25b654){_0x4a78cc=_0x25b654;_0x43d26b=0xc8;}else{_0x43d26b=0xce;}_0x44bf8f[_0xb46d('0x1b')](_0x43d26b);return _0x44bf8f[_0xb46d('0x22')](_0xb46d('0x23'),_0x7dfc55+'-'+_0x4a78cc+'/'+_0x25b654)['json'](_0x48bce0);}return null;};}function patchUpdates(_0x58ad00){return function(_0x56f8c3){try{jsonpatch[_0xb46d('0x24')](_0x56f8c3,_0x58ad00,!![]);}catch(_0x584fa4){return BPromise[_0xb46d('0x25')](_0x584fa4);}return _0x56f8c3[_0xb46d('0x26')]();};}function saveUpdates(_0x45ffdf,_0x4e0439){return function(_0x9f143f){if(_0x9f143f){return _0x9f143f[_0xb46d('0x27')](_0x45ffdf)[_0xb46d('0x28')](function(_0x410ba2){return _0x410ba2;});}return null;};}function removeEntity(_0x5831aa,_0x5b7332){return function(_0xc5943e){if(_0xc5943e){return _0xc5943e[_0xb46d('0x29')]()[_0xb46d('0x28')](function(){_0x5831aa[_0xb46d('0x1b')](0xcc)[_0xb46d('0x1c')]();});}};}function handleEntityNotFound(_0x13658a,_0x24038a){return function(_0x4b4f5d){if(!_0x4b4f5d){_0x13658a[_0xb46d('0x1a')](0x194);}return _0x4b4f5d;};}function handleError(_0xd0513c,_0x34820d){_0x34820d=_0x34820d||0x1f4;return function(_0x3cba87){logger[_0xb46d('0x2a')](_0x3cba87[_0xb46d('0x2b')]);if(_0x3cba87[_0xb46d('0x2c')]){delete _0x3cba87[_0xb46d('0x2c')];}_0xd0513c[_0xb46d('0x1b')](_0x34820d)['send'](_0x3cba87);};}exports[_0xb46d('0x2d')]=function(_0x33715e,_0x5ac606){var _0x2b1b9={},_0x47c06e={},_0x24ddd2={'count':0x0,'rows':[]};var _0xc918ce=_['map'](db[_0xb46d('0x2e')][_0xb46d('0x2f')],function(_0x4f9a04){return{'name':_0x4f9a04[_0xb46d('0x30')],'type':_0x4f9a04[_0xb46d('0x31')][_0xb46d('0x32')]};});_0x47c06e['model']=_[_0xb46d('0x33')](_0xc918ce,_0xb46d('0x2c'));_0x47c06e[_0xb46d('0x34')]=_[_0xb46d('0x35')](_0x33715e[_0xb46d('0x34')]);_0x47c06e[_0xb46d('0x36')]=_[_0xb46d('0x37')](_0x47c06e['model'],_0x47c06e[_0xb46d('0x34')]);_0x2b1b9[_0xb46d('0x38')]=_[_0xb46d('0x37')](_0x47c06e[_0xb46d('0x39')],qs['fields'](_0x33715e['query'][_0xb46d('0x3a')]));_0x2b1b9[_0xb46d('0x38')]=_0x2b1b9[_0xb46d('0x38')]['length']?_0x2b1b9[_0xb46d('0x38')]:_0x47c06e[_0xb46d('0x39')];if(!_0x33715e['query'][_0xb46d('0x3b')]('nolimit')){_0x2b1b9[_0xb46d('0x1f')]=qs[_0xb46d('0x1f')](_0x33715e['query'][_0xb46d('0x1f')]);_0x2b1b9[_0xb46d('0x1e')]=qs[_0xb46d('0x1e')](_0x33715e[_0xb46d('0x34')][_0xb46d('0x1e')]);}_0x2b1b9[_0xb46d('0x3c')]=qs[_0xb46d('0x3d')](_0x33715e[_0xb46d('0x34')][_0xb46d('0x3d')]);_0x2b1b9[_0xb46d('0x3e')]=qs[_0xb46d('0x36')](_[_0xb46d('0x3f')](_0x33715e[_0xb46d('0x34')],_0x47c06e[_0xb46d('0x36')]),_0xc918ce);if(_0x33715e[_0xb46d('0x34')][_0xb46d('0x40')]){_0x2b1b9['where']=_[_0xb46d('0x41')](_0x2b1b9[_0xb46d('0x3e')],{'$or':_['map'](_0xc918ce,function(_0x3b6df7){if(_0x3b6df7[_0xb46d('0x31')]!==_0xb46d('0x42')){var _0x578892={};_0x578892[_0x3b6df7[_0xb46d('0x2c')]]={'$like':'%'+_0x33715e[_0xb46d('0x34')][_0xb46d('0x40')]+'%'};return _0x578892;}})});}_0x2b1b9=_['merge']({},_0x2b1b9,_0x33715e['options']);var _0x5e66c9={'where':_0x2b1b9[_0xb46d('0x3e')]};return db[_0xb46d('0x2e')][_0xb46d('0x21')](_0x5e66c9)[_0xb46d('0x28')](function(_0x1cf7c7){_0x24ddd2['count']=_0x1cf7c7;if(_0x33715e['query']['includeAll']){_0x2b1b9[_0xb46d('0x43')]=[{'all':!![]}];}return db[_0xb46d('0x2e')][_0xb46d('0x44')](_0x2b1b9);})[_0xb46d('0x28')](function(_0x2c599f){_0x24ddd2['rows']=_0x2c599f;return _0x24ddd2;})[_0xb46d('0x28')](respondWithFilteredResult(_0x5ac606,_0x2b1b9))[_0xb46d('0x45')](handleError(_0x5ac606,null));};exports[_0xb46d('0x46')]=function(_0x887675,_0x32449f){var _0x21bdb6={'raw':!![],'where':{'id':_0x887675['params']['id']}},_0x5ebe0e={};_0x5ebe0e['model']=_[_0xb46d('0x35')](db[_0xb46d('0x2e')][_0xb46d('0x2f')]);_0x5ebe0e['query']=_['keys'](_0x887675[_0xb46d('0x34')]);_0x5ebe0e[_0xb46d('0x36')]=_[_0xb46d('0x37')](_0x5ebe0e[_0xb46d('0x39')],_0x5ebe0e[_0xb46d('0x34')]);_0x21bdb6['attributes']=_[_0xb46d('0x37')](_0x5ebe0e['model'],qs[_0xb46d('0x3a')](_0x887675['query'][_0xb46d('0x3a')]));_0x21bdb6[_0xb46d('0x38')]=_0x21bdb6[_0xb46d('0x38')]['length']?_0x21bdb6[_0xb46d('0x38')]:_0x5ebe0e['model'];if(_0x887675[_0xb46d('0x34')][_0xb46d('0x47')]){_0x21bdb6[_0xb46d('0x43')]=[{'all':!![]}];}_0x21bdb6=_[_0xb46d('0x41')]({},_0x21bdb6,_0x887675['options']);return db['SmsQueueReport'][_0xb46d('0x48')](_0x21bdb6)[_0xb46d('0x28')](handleEntityNotFound(_0x32449f,null))[_0xb46d('0x28')](respondWithResult(_0x32449f,null))[_0xb46d('0x45')](handleError(_0x32449f,null));};exports['create']=function(_0x6db5ae,_0x589b4a){return db[_0xb46d('0x2e')][_0xb46d('0x49')](_0x6db5ae[_0xb46d('0x4a')],{})[_0xb46d('0x28')](respondWithResult(_0x589b4a,0xc9))[_0xb46d('0x45')](handleError(_0x589b4a,null));};exports[_0xb46d('0x27')]=function(_0x22a626,_0x19f83d){if(_0x22a626['body']['id']){delete _0x22a626[_0xb46d('0x4a')]['id'];}return db['SmsQueueReport'][_0xb46d('0x48')]({'where':{'id':_0x22a626[_0xb46d('0x4b')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x19f83d,null))[_0xb46d('0x28')](saveUpdates(_0x22a626[_0xb46d('0x4a')],null))[_0xb46d('0x28')](respondWithResult(_0x19f83d,null))[_0xb46d('0x45')](handleError(_0x19f83d,null));};exports[_0xb46d('0x29')]=function(_0x2b1e4c,_0x2e228d){return db[_0xb46d('0x2e')]['find']({'where':{'id':_0x2b1e4c[_0xb46d('0x4b')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x2e228d,null))[_0xb46d('0x28')](removeEntity(_0x2e228d,null))[_0xb46d('0x45')](handleError(_0x2e228d,null));};exports['describe']=function(_0x34ef0a,_0x444089){return db[_0xb46d('0x2e')][_0xb46d('0x4c')]()[_0xb46d('0x28')](respondWithResult(_0x444089,null))[_0xb46d('0x45')](handleError(_0x444089,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5128c32..b32caff 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c3babc5..abca249 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 _0x0b88=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CreateSmsQueueReport','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x15beeb,_0x32bd4f){var _0x5b681a=function(_0x2f9b5c){while(--_0x2f9b5c){_0x15beeb['push'](_0x15beeb['shift']());}};_0x5b681a(++_0x32bd4f);}(_0x0b88,0x142));var _0x80b8=function(_0x5b61f6,_0x52ac9e){_0x5b61f6=_0x5b61f6-0x0;var _0x3d7202=_0x0b88[_0x5b61f6];return _0x3d7202;};'use strict';var _=require(_0x80b8('0x0'));var util=require('util');var moment=require(_0x80b8('0x1'));var BPromise=require(_0x80b8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80b8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80b8('0x4'));var logger=require('../../config/logger')(_0x80b8('0x5'));var config=require(_0x80b8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x80b8('0x7')][_0x80b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25d067,_0x55be9e,_0x1e746f){return new BPromise(function(_0x15fd05,_0x556004){return client[_0x80b8('0x9')](_0x25d067,_0x1e746f)[_0x80b8('0xa')](function(_0x312c02){logger[_0x80b8('0xb')](_0x80b8('0xc'),_0x55be9e,'request\x20sent');logger[_0x80b8('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x55be9e,_0x80b8('0xe'),JSON[_0x80b8('0xf')](_0x312c02));if(_0x312c02[_0x80b8('0x10')]){if(_0x312c02[_0x80b8('0x10')][_0x80b8('0x11')]===0x1f4){logger[_0x80b8('0x10')](_0x80b8('0xc'),_0x55be9e,_0x312c02[_0x80b8('0x10')]['message']);return _0x556004(_0x312c02[_0x80b8('0x10')]['message']);}logger[_0x80b8('0x10')](_0x80b8('0xc'),_0x55be9e,_0x312c02[_0x80b8('0x10')][_0x80b8('0x12')]);return _0x15fd05(_0x312c02[_0x80b8('0x10')][_0x80b8('0x12')]);}else{logger[_0x80b8('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x55be9e,'request\x20sent');_0x15fd05(_0x312c02['result'][_0x80b8('0x12')]);}})[_0x80b8('0x13')](function(_0x241d5e){logger['error'](_0x80b8('0xc'),_0x55be9e,_0x241d5e);_0x556004(_0x241d5e);});});}exports[_0x80b8('0x14')]=function(_0x26a709){var _0x4e6cf3=this;return new Promise(function(_0x1b9171,_0x1b9a76){return db['SmsQueueReport']['create'](_0x26a709[_0x80b8('0x15')],{'raw':_0x26a709['options']?_0x26a709[_0x80b8('0x16')][_0x80b8('0x17')]===undefined?!![]:![]:!![]})[_0x80b8('0xa')](function(_0x57b049){logger['info'](_0x80b8('0x14'),_0x26a709);logger['debug'](_0x80b8('0x14'),_0x26a709,JSON[_0x80b8('0xf')](_0x57b049));_0x1b9171(_0x57b049);})[_0x80b8('0x13')](function(_0x1bd7d0){logger[_0x80b8('0x10')](_0x80b8('0x14'),_0x1bd7d0[_0x80b8('0x12')],_0x26a709);_0x1b9a76(_0x4e6cf3[_0x80b8('0x10')](0x1f4,_0x1bd7d0[_0x80b8('0x12')]));});});};exports[_0x80b8('0x18')]=function(_0x219f30){var _0x440b0a=this;return new Promise(function(_0x313a9a,_0x5a48a4){return db[_0x80b8('0x19')][_0x80b8('0x1a')](_0x219f30[_0x80b8('0x15')],{'raw':_0x219f30[_0x80b8('0x16')]?_0x219f30[_0x80b8('0x16')][_0x80b8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x219f30[_0x80b8('0x16')]?_0x219f30[_0x80b8('0x16')][_0x80b8('0x1b')]||null:null,'attributes':_0x219f30[_0x80b8('0x16')]?_0x219f30[_0x80b8('0x16')][_0x80b8('0x1c')]||null:null,'limit':_0x219f30[_0x80b8('0x16')]?_0x219f30[_0x80b8('0x16')][_0x80b8('0x1d')]||null:null})[_0x80b8('0xa')](function(_0x44c374){logger[_0x80b8('0xb')](_0x80b8('0x18'),_0x219f30);logger[_0x80b8('0xd')](_0x80b8('0x18'),_0x219f30,JSON['stringify'](_0x44c374));_0x313a9a(_0x44c374);})[_0x80b8('0x13')](function(_0x40ce39){logger['error'](_0x80b8('0x18'),_0x40ce39[_0x80b8('0x12')],_0x219f30);_0x5a48a4(_0x440b0a[_0x80b8('0x10')](0x1f4,_0x40ce39['message']));});});}; \ No newline at end of file +var _0x0ab2=['catch','UpdateSmsQueueReport','where','attributes','limit','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueueReport,\x20%s,\x20%s','message','info','result','CreateSmsQueueReport','create','body','options','raw'];(function(_0x1a7d87,_0x523f81){var _0x26dd0b=function(_0x53fff9){while(--_0x53fff9){_0x1a7d87['push'](_0x1a7d87['shift']());}};_0x26dd0b(++_0x523f81);}(_0x0ab2,0xb3));var _0x20ab=function(_0x39100d,_0x2f566f){_0x39100d=_0x39100d-0x0;var _0x498812=_0x0ab2[_0x39100d];return _0x498812;};'use strict';var _=require(_0x20ab('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(_0x20ab('0x1'))['db'];var utils=require(_0x20ab('0x2'));var logger=require(_0x20ab('0x3'))(_0x20ab('0x4'));var config=require(_0x20ab('0x5'));var jayson=require(_0x20ab('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x891da,_0x2efdf4,_0x4c2316){return new BPromise(function(_0xbce0d,_0x247fa5){return client[_0x20ab('0x7')](_0x891da,_0x4c2316)[_0x20ab('0x8')](function(_0xff52c2){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2efdf4,_0x20ab('0x9'));logger[_0x20ab('0xa')](_0x20ab('0xb'),_0x2efdf4,_0x20ab('0x9'),JSON[_0x20ab('0xc')](_0xff52c2));if(_0xff52c2['error']){if(_0xff52c2['error'][_0x20ab('0xd')]===0x1f4){logger[_0x20ab('0xe')](_0x20ab('0xf'),_0x2efdf4,_0xff52c2[_0x20ab('0xe')]['message']);return _0x247fa5(_0xff52c2[_0x20ab('0xe')]['message']);}logger[_0x20ab('0xe')](_0x20ab('0xf'),_0x2efdf4,_0xff52c2[_0x20ab('0xe')][_0x20ab('0x10')]);return _0xbce0d(_0xff52c2['error'][_0x20ab('0x10')]);}else{logger[_0x20ab('0x11')](_0x20ab('0xf'),_0x2efdf4,'request\x20sent');_0xbce0d(_0xff52c2[_0x20ab('0x12')][_0x20ab('0x10')]);}})['catch'](function(_0xd89dc0){logger['error'](_0x20ab('0xf'),_0x2efdf4,_0xd89dc0);_0x247fa5(_0xd89dc0);});});}exports[_0x20ab('0x13')]=function(_0x2f9092){var _0x128acd=this;return new Promise(function(_0x35a6e4,_0x43d13f){return db['SmsQueueReport'][_0x20ab('0x14')](_0x2f9092[_0x20ab('0x15')],{'raw':_0x2f9092['options']?_0x2f9092[_0x20ab('0x16')][_0x20ab('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5c468f){logger[_0x20ab('0x11')](_0x20ab('0x13'),_0x2f9092);logger[_0x20ab('0xa')](_0x20ab('0x13'),_0x2f9092,JSON['stringify'](_0x5c468f));_0x35a6e4(_0x5c468f);})[_0x20ab('0x18')](function(_0x46263e){logger[_0x20ab('0xe')]('CreateSmsQueueReport',_0x46263e[_0x20ab('0x10')],_0x2f9092);_0x43d13f(_0x128acd[_0x20ab('0xe')](0x1f4,_0x46263e[_0x20ab('0x10')]));});});};exports[_0x20ab('0x19')]=function(_0x16ad2b){var _0x31bec9=this;return new Promise(function(_0x301ec1,_0x5139c9){return db['SmsQueueReport']['update'](_0x16ad2b[_0x20ab('0x15')],{'raw':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b[_0x20ab('0x16')][_0x20ab('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b[_0x20ab('0x16')][_0x20ab('0x1a')]||null:null,'attributes':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b['options'][_0x20ab('0x1b')]||null:null,'limit':_0x16ad2b[_0x20ab('0x16')]?_0x16ad2b[_0x20ab('0x16')][_0x20ab('0x1c')]||null:null})[_0x20ab('0x8')](function(_0x28989c){logger[_0x20ab('0x11')]('UpdateSmsQueueReport',_0x16ad2b);logger[_0x20ab('0xa')](_0x20ab('0x19'),_0x16ad2b,JSON[_0x20ab('0xc')](_0x28989c));_0x301ec1(_0x28989c);})[_0x20ab('0x18')](function(_0x4380ce){logger[_0x20ab('0xe')](_0x20ab('0x19'),_0x4380ce[_0x20ab('0x10')],_0x16ad2b);_0x5139c9(_0x31bec9[_0x20ab('0xe')](0x1f4,_0x4380ce[_0x20ab('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 99b2f2c..0df5d79 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 _0x008c=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','show','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x008c,0x188));var _0xc008=function(_0x262a2a,_0x33aaca){_0x262a2a=_0x262a2a-0x0;var _0x4cc510=_0x008c[_0x262a2a];return _0x4cc510;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['update']);router[_0xc008('0x10')](_0xc008('0xf'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);module[_0xc008('0x12')]=router; \ No newline at end of file +var _0x4873=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6fe380,_0x147f69){var _0x251d29=function(_0x393ef6){while(--_0x393ef6){_0x6fe380['push'](_0x6fe380['shift']());}};_0x251d29(++_0x147f69);}(_0x4873,0x1df));var _0x3487=function(_0x1cf80c,_0x46a677){_0x1cf80c=_0x1cf80c-0x0;var _0x3f8e4c=_0x4873[_0x1cf80c];return _0x3f8e4c;};'use strict';var multer=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var path=require(_0x3487('0x2'));var timeout=require('connect-timeout');var express=require(_0x3487('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3487('0x4'));var interaction=require(_0x3487('0x5'));var config=require(_0x3487('0x6'));var controller=require(_0x3487('0x7'));router[_0x3487('0x8')]('/',auth[_0x3487('0x9')](),controller[_0x3487('0xa')]);router[_0x3487('0x8')]('/describe',auth[_0x3487('0x9')](),controller[_0x3487('0xb')]);router[_0x3487('0x8')](_0x3487('0xc'),auth[_0x3487('0x9')](),controller['show']);router[_0x3487('0xd')]('/',auth['isAuthenticated'](),controller[_0x3487('0xe')]);router[_0x3487('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3487('0x10')]);router[_0x3487('0x11')]('/:id',auth[_0x3487('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 984e40b..7470cff 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x247ea2,_0x263d45){var _0x18b7c1=function(_0x56340d){while(--_0x56340d){_0x247ea2['push'](_0x247ea2['shift']());}};_0x18b7c1(++_0x263d45);}(_0x00bb,0x1d8));var _0xb00b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x00bb[_0x29b609];return _0x54c952;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4aaabd,_0x549448){var _0x58a4de=function(_0x55ce1f){while(--_0x55ce1f){_0x4aaabd['push'](_0x4aaabd['shift']());}};_0x58a4de(++_0x549448);}(_0xf4eb,0xec));var _0xbf4e=function(_0xab9df9,_0x157cc5){_0xab9df9=_0xab9df9-0x0;var _0x2cf1b5=_0xf4eb[_0xab9df9];return _0x2cf1b5;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 9e94cb1..cfd3c2a 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 _0xe2c1=['count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','SmsTransferReport','type','keys','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit'];(function(_0xca5595,_0x36ad22){var _0x53013b=function(_0x1dcfea){while(--_0x1dcfea){_0xca5595['push'](_0xca5595['shift']());}};_0x53013b(++_0x36ad22);}(_0xe2c1,0xfd));var _0x1e2c=function(_0x4c46d6,_0x26f13f){_0x4c46d6=_0x4c46d6-0x0;var _0xddb3d5=_0xe2c1[_0x4c46d6];return _0xddb3d5;};'use strict';var emlformat=require(_0x1e2c('0x0'));var rimraf=require(_0x1e2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e2c('0x2'));var rp=require(_0x1e2c('0x3'));var moment=require(_0x1e2c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1e2c('0x5'));var sox=require(_0x1e2c('0x6'));var csv=require(_0x1e2c('0x7'));var ejs=require(_0x1e2c('0x8'));var fs=require('fs');var fs_extra=require(_0x1e2c('0x9'));var _=require(_0x1e2c('0xa'));var squel=require(_0x1e2c('0xb'));var crypto=require(_0x1e2c('0xc'));var jsforce=require(_0x1e2c('0xd'));var deskjs=require(_0x1e2c('0xe'));var toCsv=require(_0x1e2c('0x7'));var querystring=require(_0x1e2c('0xf'));var Papa=require('papaparse');var Redis=require(_0x1e2c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e2c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e2c('0x12'));var utils=require(_0x1e2c('0x13'));var config=require(_0x1e2c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e2c('0x15'))['db'];function respondWithStatusCode(_0x45016e,_0x2b3b87){_0x2b3b87=_0x2b3b87||0xcc;return function(_0x13c63d){if(_0x13c63d){return _0x45016e['sendStatus'](_0x2b3b87);}return _0x45016e['status'](_0x2b3b87)[_0x1e2c('0x16')]();};}function respondWithResult(_0xb5a756,_0x1f7c9f){_0x1f7c9f=_0x1f7c9f||0xc8;return function(_0x2a14a8){if(_0x2a14a8){return _0xb5a756[_0x1e2c('0x17')](_0x1f7c9f)[_0x1e2c('0x18')](_0x2a14a8);}};}function respondWithFilteredResult(_0x334d5a,_0x4c2acc){return function(_0x4c84bd){if(_0x4c84bd){var _0x27d0dc=typeof _0x4c2acc[_0x1e2c('0x19')]==='undefined'&&typeof _0x4c2acc[_0x1e2c('0x1a')]==='undefined';var _0x5a9b5f=_0x4c84bd[_0x1e2c('0x1b')];var _0x12705f=_0x27d0dc?0x0:_0x4c2acc[_0x1e2c('0x19')];var _0x19102c=_0x27d0dc?_0x4c84bd[_0x1e2c('0x1b')]:_0x4c2acc[_0x1e2c('0x19')]+_0x4c2acc[_0x1e2c('0x1a')];var _0x265a3c;if(_0x19102c>=_0x5a9b5f){_0x19102c=_0x5a9b5f;_0x265a3c=0xc8;}else{_0x265a3c=0xce;}_0x334d5a['status'](_0x265a3c);return _0x334d5a[_0x1e2c('0x1c')](_0x1e2c('0x1d'),_0x12705f+'-'+_0x19102c+'/'+_0x5a9b5f)[_0x1e2c('0x18')](_0x4c84bd);}return null;};}function patchUpdates(_0x538588){return function(_0x2fefd7){try{jsonpatch[_0x1e2c('0x1e')](_0x2fefd7,_0x538588,!![]);}catch(_0x7175ae){return BPromise[_0x1e2c('0x1f')](_0x7175ae);}return _0x2fefd7[_0x1e2c('0x20')]();};}function saveUpdates(_0x3fa681,_0x461a3a){return function(_0x23674c){if(_0x23674c){return _0x23674c['update'](_0x3fa681)[_0x1e2c('0x21')](function(_0x5a9d4a){return _0x5a9d4a;});}return null;};}function removeEntity(_0x2701d8,_0x4acf29){return function(_0x1a9e29){if(_0x1a9e29){return _0x1a9e29[_0x1e2c('0x22')]()[_0x1e2c('0x21')](function(){_0x2701d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5ba2,_0x1fd250){return function(_0x684e0c){if(!_0x684e0c){_0x3e5ba2[_0x1e2c('0x23')](0x194);}return _0x684e0c;};}function handleError(_0x8e4cca,_0x48c975){_0x48c975=_0x48c975||0x1f4;return function(_0x3288e8){logger[_0x1e2c('0x24')](_0x3288e8[_0x1e2c('0x25')]);if(_0x3288e8['name']){delete _0x3288e8[_0x1e2c('0x26')];}_0x8e4cca[_0x1e2c('0x17')](_0x48c975)['send'](_0x3288e8);};}exports['index']=function(_0xd84968,_0x504ca6){var _0x140bbe={},_0x4dabf6={},_0x49fbf5={'count':0x0,'rows':[]};var _0x8ff04d=_[_0x1e2c('0x27')](db[_0x1e2c('0x28')]['rawAttributes'],function(_0x566e02){return{'name':_0x566e02['fieldName'],'type':_0x566e02[_0x1e2c('0x29')]['key']};});_0x4dabf6['model']=_['map'](_0x8ff04d,_0x1e2c('0x26'));_0x4dabf6['query']=_[_0x1e2c('0x2a')](_0xd84968['query']);_0x4dabf6['filters']=_['intersection'](_0x4dabf6[_0x1e2c('0x2b')],_0x4dabf6[_0x1e2c('0x2c')]);_0x140bbe['attributes']=_[_0x1e2c('0x2d')](_0x4dabf6[_0x1e2c('0x2b')],qs['fields'](_0xd84968['query'][_0x1e2c('0x2e')]));_0x140bbe[_0x1e2c('0x2f')]=_0x140bbe[_0x1e2c('0x2f')][_0x1e2c('0x30')]?_0x140bbe[_0x1e2c('0x2f')]:_0x4dabf6[_0x1e2c('0x2b')];if(!_0xd84968[_0x1e2c('0x2c')][_0x1e2c('0x31')](_0x1e2c('0x32'))){_0x140bbe[_0x1e2c('0x1a')]=qs[_0x1e2c('0x1a')](_0xd84968[_0x1e2c('0x2c')][_0x1e2c('0x1a')]);_0x140bbe['offset']=qs['offset'](_0xd84968['query'][_0x1e2c('0x19')]);}_0x140bbe[_0x1e2c('0x33')]=qs[_0x1e2c('0x34')](_0xd84968[_0x1e2c('0x2c')][_0x1e2c('0x34')]);_0x140bbe[_0x1e2c('0x35')]=qs[_0x1e2c('0x36')](_[_0x1e2c('0x37')](_0xd84968[_0x1e2c('0x2c')],_0x4dabf6[_0x1e2c('0x36')]),_0x8ff04d);if(_0xd84968[_0x1e2c('0x2c')][_0x1e2c('0x38')]){_0x140bbe[_0x1e2c('0x35')]=_[_0x1e2c('0x39')](_0x140bbe[_0x1e2c('0x35')],{'$or':_[_0x1e2c('0x27')](_0x8ff04d,function(_0x2df98f){if(_0x2df98f[_0x1e2c('0x29')]!==_0x1e2c('0x3a')){var _0x6edc7d={};_0x6edc7d[_0x2df98f[_0x1e2c('0x26')]]={'$like':'%'+_0xd84968[_0x1e2c('0x2c')][_0x1e2c('0x38')]+'%'};return _0x6edc7d;}})});}_0x140bbe=_['merge']({},_0x140bbe,_0xd84968[_0x1e2c('0x3b')]);var _0x57740b={'where':_0x140bbe[_0x1e2c('0x35')]};return db['SmsTransferReport']['count'](_0x57740b)['then'](function(_0x42a1b7){_0x49fbf5[_0x1e2c('0x1b')]=_0x42a1b7;if(_0xd84968['query']['includeAll']){_0x140bbe[_0x1e2c('0x3c')]=[{'all':!![]}];}return db[_0x1e2c('0x28')][_0x1e2c('0x3d')](_0x140bbe);})['then'](function(_0x1de5e2){_0x49fbf5['rows']=_0x1de5e2;return _0x49fbf5;})[_0x1e2c('0x21')](respondWithFilteredResult(_0x504ca6,_0x140bbe))[_0x1e2c('0x3e')](handleError(_0x504ca6,null));};exports['show']=function(_0x2b354d,_0x48d7eb){var _0x101e2a={'raw':!![],'where':{'id':_0x2b354d[_0x1e2c('0x3f')]['id']}},_0x282290={};_0x282290[_0x1e2c('0x2b')]=_[_0x1e2c('0x2a')](db[_0x1e2c('0x28')][_0x1e2c('0x40')]);_0x282290['query']=_['keys'](_0x2b354d[_0x1e2c('0x2c')]);_0x282290[_0x1e2c('0x36')]=_[_0x1e2c('0x2d')](_0x282290[_0x1e2c('0x2b')],_0x282290[_0x1e2c('0x2c')]);_0x101e2a['attributes']=_[_0x1e2c('0x2d')](_0x282290[_0x1e2c('0x2b')],qs[_0x1e2c('0x2e')](_0x2b354d['query'][_0x1e2c('0x2e')]));_0x101e2a[_0x1e2c('0x2f')]=_0x101e2a[_0x1e2c('0x2f')][_0x1e2c('0x30')]?_0x101e2a[_0x1e2c('0x2f')]:_0x282290[_0x1e2c('0x2b')];if(_0x2b354d[_0x1e2c('0x2c')][_0x1e2c('0x41')]){_0x101e2a[_0x1e2c('0x3c')]=[{'all':!![]}];}_0x101e2a=_[_0x1e2c('0x39')]({},_0x101e2a,_0x2b354d[_0x1e2c('0x3b')]);return db[_0x1e2c('0x28')][_0x1e2c('0x42')](_0x101e2a)[_0x1e2c('0x21')](handleEntityNotFound(_0x48d7eb,null))['then'](respondWithResult(_0x48d7eb,null))['catch'](handleError(_0x48d7eb,null));};exports[_0x1e2c('0x43')]=function(_0x54236b,_0x5460a4){return db[_0x1e2c('0x28')][_0x1e2c('0x43')](_0x54236b[_0x1e2c('0x44')],{})[_0x1e2c('0x21')](respondWithResult(_0x5460a4,0xc9))[_0x1e2c('0x3e')](handleError(_0x5460a4,null));};exports['update']=function(_0x1e92cb,_0x258fef){if(_0x1e92cb[_0x1e2c('0x44')]['id']){delete _0x1e92cb[_0x1e2c('0x44')]['id'];}return db[_0x1e2c('0x28')][_0x1e2c('0x42')]({'where':{'id':_0x1e92cb[_0x1e2c('0x3f')]['id']}})[_0x1e2c('0x21')](handleEntityNotFound(_0x258fef,null))[_0x1e2c('0x21')](saveUpdates(_0x1e92cb['body'],null))[_0x1e2c('0x21')](respondWithResult(_0x258fef,null))[_0x1e2c('0x3e')](handleError(_0x258fef,null));};exports[_0x1e2c('0x22')]=function(_0x4121f8,_0x4a9d7e){return db['SmsTransferReport'][_0x1e2c('0x42')]({'where':{'id':_0x4121f8[_0x1e2c('0x3f')]['id']}})[_0x1e2c('0x21')](handleEntityNotFound(_0x4a9d7e,null))[_0x1e2c('0x21')](removeEntity(_0x4a9d7e,null))[_0x1e2c('0x3e')](handleError(_0x4a9d7e,null));};exports[_0x1e2c('0x45')]=function(_0x4ddfe0,_0x28083b){return db['SmsTransferReport'][_0x1e2c('0x45')]()['then'](respondWithResult(_0x28083b,null))[_0x1e2c('0x3e')](handleError(_0x28083b,null));}; \ No newline at end of file +var _0xa484=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','then','includeAll','findAll','rows','catch','rawAttributes','length','include','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x14df80,_0xdedde9){var _0x2fa5cd=function(_0x670151){while(--_0x670151){_0x14df80['push'](_0x14df80['shift']());}};_0x2fa5cd(++_0xdedde9);}(_0xa484,0x128));var _0x4a48=function(_0x3c9c6d,_0x4f3cfb){_0x3c9c6d=_0x3c9c6d-0x0;var _0x4d5bbb=_0xa484[_0x3c9c6d];return _0x4d5bbb;};'use strict';var emlformat=require(_0x4a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a48('0x1'));var jsonpatch=require(_0x4a48('0x2'));var rp=require(_0x4a48('0x3'));var moment=require(_0x4a48('0x4'));var BPromise=require(_0x4a48('0x5'));var Mustache=require('mustache');var util=require(_0x4a48('0x6'));var path=require('path');var sox=require(_0x4a48('0x7'));var csv=require(_0x4a48('0x8'));var ejs=require(_0x4a48('0x9'));var fs=require('fs');var fs_extra=require(_0x4a48('0xa'));var _=require(_0x4a48('0xb'));var squel=require(_0x4a48('0xc'));var crypto=require(_0x4a48('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4a48('0xe'));var toCsv=require(_0x4a48('0x8'));var querystring=require(_0x4a48('0xf'));var Papa=require(_0x4a48('0x10'));var Redis=require(_0x4a48('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4a48('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a48('0x13'));var utils=require(_0x4a48('0x14'));var config=require(_0x4a48('0x15'));var licenseUtil=require(_0x4a48('0x16'));var db=require(_0x4a48('0x17'))['db'];function respondWithStatusCode(_0x55b51a,_0x4f48f0){_0x4f48f0=_0x4f48f0||0xcc;return function(_0x49391f){if(_0x49391f){return _0x55b51a['sendStatus'](_0x4f48f0);}return _0x55b51a['status'](_0x4f48f0)[_0x4a48('0x18')]();};}function respondWithResult(_0x3e1c8a,_0x5ae242){_0x5ae242=_0x5ae242||0xc8;return function(_0x36ed95){if(_0x36ed95){return _0x3e1c8a[_0x4a48('0x19')](_0x5ae242)['json'](_0x36ed95);}};}function respondWithFilteredResult(_0xbd957b,_0x4377e3){return function(_0x44d19d){if(_0x44d19d){var _0x27d0b7=typeof _0x4377e3[_0x4a48('0x1a')]===_0x4a48('0x1b')&&typeof _0x4377e3['limit']===_0x4a48('0x1b');var _0x27f326=_0x44d19d['count'];var _0x2b5dc2=_0x27d0b7?0x0:_0x4377e3[_0x4a48('0x1a')];var _0x5a9243=_0x27d0b7?_0x44d19d['count']:_0x4377e3[_0x4a48('0x1a')]+_0x4377e3[_0x4a48('0x1c')];var _0x49790c;if(_0x5a9243>=_0x27f326){_0x5a9243=_0x27f326;_0x49790c=0xc8;}else{_0x49790c=0xce;}_0xbd957b[_0x4a48('0x19')](_0x49790c);return _0xbd957b[_0x4a48('0x1d')](_0x4a48('0x1e'),_0x2b5dc2+'-'+_0x5a9243+'/'+_0x27f326)[_0x4a48('0x1f')](_0x44d19d);}return null;};}function patchUpdates(_0xbcdb75){return function(_0x10cb4e){try{jsonpatch['apply'](_0x10cb4e,_0xbcdb75,!![]);}catch(_0x3bd444){return BPromise[_0x4a48('0x20')](_0x3bd444);}return _0x10cb4e[_0x4a48('0x21')]();};}function saveUpdates(_0x204acf,_0x528839){return function(_0x3dc67e){if(_0x3dc67e){return _0x3dc67e[_0x4a48('0x22')](_0x204acf)['then'](function(_0x560742){return _0x560742;});}return null;};}function removeEntity(_0x16e66c,_0x317fe4){return function(_0x5b956e){if(_0x5b956e){return _0x5b956e[_0x4a48('0x23')]()['then'](function(){_0x16e66c[_0x4a48('0x19')](0xcc)[_0x4a48('0x18')]();});}};}function handleEntityNotFound(_0x1a0432,_0x3bdbb0){return function(_0x49c13c){if(!_0x49c13c){_0x1a0432[_0x4a48('0x24')](0x194);}return _0x49c13c;};}function handleError(_0x4b7a2c,_0x2565a8){_0x2565a8=_0x2565a8||0x1f4;return function(_0x44bca6){logger[_0x4a48('0x25')](_0x44bca6[_0x4a48('0x26')]);if(_0x44bca6[_0x4a48('0x27')]){delete _0x44bca6['name'];}_0x4b7a2c[_0x4a48('0x19')](_0x2565a8)[_0x4a48('0x28')](_0x44bca6);};}exports['index']=function(_0x4310b7,_0x322b66){var _0x57ad14={},_0x2ea573={},_0x332a24={'count':0x0,'rows':[]};var _0x41ecd8=_[_0x4a48('0x29')](db[_0x4a48('0x2a')]['rawAttributes'],function(_0x50f232){return{'name':_0x50f232[_0x4a48('0x2b')],'type':_0x50f232[_0x4a48('0x2c')][_0x4a48('0x2d')]};});_0x2ea573[_0x4a48('0x2e')]=_[_0x4a48('0x29')](_0x41ecd8,_0x4a48('0x27'));_0x2ea573[_0x4a48('0x2f')]=_[_0x4a48('0x30')](_0x4310b7[_0x4a48('0x2f')]);_0x2ea573[_0x4a48('0x31')]=_[_0x4a48('0x32')](_0x2ea573[_0x4a48('0x2e')],_0x2ea573[_0x4a48('0x2f')]);_0x57ad14[_0x4a48('0x33')]=_['intersection'](_0x2ea573[_0x4a48('0x2e')],qs[_0x4a48('0x34')](_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x34')]));_0x57ad14[_0x4a48('0x33')]=_0x57ad14[_0x4a48('0x33')]['length']?_0x57ad14['attributes']:_0x2ea573[_0x4a48('0x2e')];if(!_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x35')](_0x4a48('0x36'))){_0x57ad14[_0x4a48('0x1c')]=qs[_0x4a48('0x1c')](_0x4310b7['query']['limit']);_0x57ad14['offset']=qs[_0x4a48('0x1a')](_0x4310b7['query'][_0x4a48('0x1a')]);}_0x57ad14[_0x4a48('0x37')]=qs[_0x4a48('0x38')](_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x38')]);_0x57ad14[_0x4a48('0x39')]=qs[_0x4a48('0x31')](_[_0x4a48('0x3a')](_0x4310b7[_0x4a48('0x2f')],_0x2ea573[_0x4a48('0x31')]),_0x41ecd8);if(_0x4310b7[_0x4a48('0x2f')][_0x4a48('0x3b')]){_0x57ad14[_0x4a48('0x39')]=_['merge'](_0x57ad14[_0x4a48('0x39')],{'$or':_[_0x4a48('0x29')](_0x41ecd8,function(_0x46d4f1){if(_0x46d4f1[_0x4a48('0x2c')]!==_0x4a48('0x3c')){var _0x43462f={};_0x43462f[_0x46d4f1[_0x4a48('0x27')]]={'$like':'%'+_0x4310b7['query'][_0x4a48('0x3b')]+'%'};return _0x43462f;}})});}_0x57ad14=_[_0x4a48('0x3d')]({},_0x57ad14,_0x4310b7[_0x4a48('0x3e')]);var _0x413258={'where':_0x57ad14[_0x4a48('0x39')]};return db['SmsTransferReport'][_0x4a48('0x3f')](_0x413258)[_0x4a48('0x40')](function(_0x4bd3de){_0x332a24[_0x4a48('0x3f')]=_0x4bd3de;if(_0x4310b7['query'][_0x4a48('0x41')]){_0x57ad14['include']=[{'all':!![]}];}return db[_0x4a48('0x2a')][_0x4a48('0x42')](_0x57ad14);})['then'](function(_0x22df0d){_0x332a24[_0x4a48('0x43')]=_0x22df0d;return _0x332a24;})['then'](respondWithFilteredResult(_0x322b66,_0x57ad14))[_0x4a48('0x44')](handleError(_0x322b66,null));};exports['show']=function(_0x2e4f39,_0x466ce0){var _0x221247={'raw':!![],'where':{'id':_0x2e4f39['params']['id']}},_0xdc76ba={};_0xdc76ba[_0x4a48('0x2e')]=_['keys'](db[_0x4a48('0x2a')][_0x4a48('0x45')]);_0xdc76ba[_0x4a48('0x2f')]=_[_0x4a48('0x30')](_0x2e4f39['query']);_0xdc76ba['filters']=_[_0x4a48('0x32')](_0xdc76ba[_0x4a48('0x2e')],_0xdc76ba[_0x4a48('0x2f')]);_0x221247['attributes']=_[_0x4a48('0x32')](_0xdc76ba['model'],qs[_0x4a48('0x34')](_0x2e4f39[_0x4a48('0x2f')][_0x4a48('0x34')]));_0x221247['attributes']=_0x221247[_0x4a48('0x33')][_0x4a48('0x46')]?_0x221247['attributes']:_0xdc76ba[_0x4a48('0x2e')];if(_0x2e4f39[_0x4a48('0x2f')][_0x4a48('0x41')]){_0x221247[_0x4a48('0x47')]=[{'all':!![]}];}_0x221247=_[_0x4a48('0x3d')]({},_0x221247,_0x2e4f39[_0x4a48('0x3e')]);return db['SmsTransferReport']['find'](_0x221247)['then'](handleEntityNotFound(_0x466ce0,null))['then'](respondWithResult(_0x466ce0,null))[_0x4a48('0x44')](handleError(_0x466ce0,null));};exports[_0x4a48('0x48')]=function(_0x500051,_0x1e74f6){return db['SmsTransferReport'][_0x4a48('0x48')](_0x500051[_0x4a48('0x49')],{})[_0x4a48('0x40')](respondWithResult(_0x1e74f6,0xc9))['catch'](handleError(_0x1e74f6,null));};exports['update']=function(_0xf55a5f,_0x32e94c){if(_0xf55a5f[_0x4a48('0x49')]['id']){delete _0xf55a5f[_0x4a48('0x49')]['id'];}return db[_0x4a48('0x2a')][_0x4a48('0x4a')]({'where':{'id':_0xf55a5f['params']['id']}})[_0x4a48('0x40')](handleEntityNotFound(_0x32e94c,null))['then'](saveUpdates(_0xf55a5f['body'],null))['then'](respondWithResult(_0x32e94c,null))[_0x4a48('0x44')](handleError(_0x32e94c,null));};exports[_0x4a48('0x23')]=function(_0x26081c,_0x1047e7){return db[_0x4a48('0x2a')][_0x4a48('0x4a')]({'where':{'id':_0x26081c[_0x4a48('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1047e7,null))[_0x4a48('0x40')](removeEntity(_0x1047e7,null))[_0x4a48('0x44')](handleError(_0x1047e7,null));};exports[_0x4a48('0x4c')]=function(_0xd1b052,_0x2276b4){return db[_0x4a48('0x2a')][_0x4a48('0x4c')]()['then'](respondWithResult(_0x2276b4,null))[_0x4a48('0x44')](handleError(_0x2276b4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b2223fc..afa47c9 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 _0xaf93=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid','lodash','util','moment','bluebird'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xaf93,0x151));var _0x3af9=function(_0x168241,_0x4a38ea){_0x168241=_0x168241-0x0;var _0x7c350=_0xaf93[_0x168241];return _0x7c350;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3af9('0x2'));var BPromise=require(_0x3af9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3af9('0x4'));var rimraf=require(_0x3af9('0x5'));var config=require(_0x3af9('0x6'));var attributes=require(_0x3af9('0x7'));module[_0x3af9('0x8')]=function(_0x1ad446,_0x333abb){return _0x1ad446['define'](_0x3af9('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x3af9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5270=['define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x1706cc,_0x2e3a7d){var _0x2dda99=function(_0x3f18ef){while(--_0x3f18ef){_0x1706cc['push'](_0x1706cc['shift']());}};_0x2dda99(++_0x2e3a7d);}(_0x5270,0xab));var _0x0527=function(_0x586e17,_0x23d62a){_0x586e17=_0x586e17-0x0;var _0x261c59=_0x5270[_0x586e17];return _0x261c59;};'use strict';var _=require(_0x0527('0x0'));var util=require(_0x0527('0x1'));var logger=require('../../config/logger')(_0x0527('0x2'));var moment=require(_0x0527('0x3'));var BPromise=require(_0x0527('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0527('0x5'));var rimraf=require(_0x0527('0x6'));var config=require(_0x0527('0x7'));var attributes=require(_0x0527('0x8'));module['exports']=function(_0x3dd3b9,_0x3dd735){return _0x3dd3b9[_0x0527('0x9')](_0x0527('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0527('0xb'),'fields':[_0x0527('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 ad7996a..17f0c38 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 _0xf185=['SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x5d01d1,_0x511ae8){var _0x1526dd=function(_0x5b6ba7){while(--_0x5b6ba7){_0x5d01d1['push'](_0x5d01d1['shift']());}};_0x1526dd(++_0x511ae8);}(_0xf185,0x1be));var _0x5f18=function(_0xc932e7,_0x40e588){_0xc932e7=_0xc932e7-0x0;var _0x59fecc=_0xf185[_0xc932e7];return _0x59fecc;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var moment=require(_0x5f18('0x1'));var BPromise=require(_0x5f18('0x2'));var rs=require(_0x5f18('0x3'));var fs=require('fs');var Redis=require(_0x5f18('0x4'));var db=require(_0x5f18('0x5'))['db'];var utils=require(_0x5f18('0x6'));var logger=require('../../config/logger')(_0x5f18('0x7'));var config=require(_0x5f18('0x8'));var jayson=require(_0x5f18('0x9'));var client=jayson[_0x5f18('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2982d6,_0x3c69ee,_0x47e05a){return new BPromise(function(_0x15b931,_0x4f7c62){return client[_0x5f18('0xb')](_0x2982d6,_0x47e05a)[_0x5f18('0xc')](function(_0x5d84b3){logger[_0x5f18('0xd')](_0x5f18('0xe'),_0x3c69ee,'request\x20sent');logger[_0x5f18('0xf')](_0x5f18('0x10'),_0x3c69ee,'request\x20sent',JSON['stringify'](_0x5d84b3));if(_0x5d84b3[_0x5f18('0x11')]){if(_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x12')]===0x1f4){logger['error'](_0x5f18('0xe'),_0x3c69ee,_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);return _0x4f7c62(_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);}logger[_0x5f18('0x11')](_0x5f18('0xe'),_0x3c69ee,_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);return _0x15b931(_0x5d84b3['error'][_0x5f18('0x13')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3c69ee,_0x5f18('0x14'));_0x15b931(_0x5d84b3[_0x5f18('0x15')][_0x5f18('0x13')]);}})[_0x5f18('0x16')](function(_0x337ec1){logger['error'](_0x5f18('0xe'),_0x3c69ee,_0x337ec1);_0x4f7c62(_0x337ec1);});});} \ No newline at end of file +var _0xce1a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xce1a,0xbf));var _0xace1=function(_0x2dae76,_0x4e28bf){_0x2dae76=_0x2dae76-0x0;var _0xb15a55=_0xce1a[_0x2dae76];return _0xb15a55;};'use strict';var _=require(_0xace1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xace1('0x1'));var fs=require('fs');var Redis=require(_0xace1('0x2'));var db=require(_0xace1('0x3'))['db'];var utils=require(_0xace1('0x4'));var logger=require(_0xace1('0x5'))('rpc');var config=require(_0xace1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xace1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7c8f64,_0x2203ef,_0x7f3613){return new BPromise(function(_0x576b34,_0x495cff){return client[_0xace1('0x8')](_0x7c8f64,_0x7f3613)['then'](function(_0x3c8579){logger[_0xace1('0x9')](_0xace1('0xa'),_0x2203ef,_0xace1('0xb'));logger['debug'](_0xace1('0xc'),_0x2203ef,_0xace1('0xb'),JSON['stringify'](_0x3c8579));if(_0x3c8579[_0xace1('0xd')]){if(_0x3c8579[_0xace1('0xd')]['code']===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x2203ef,_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);return _0x495cff(_0x3c8579[_0xace1('0xd')]['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x2203ef,_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);return _0x576b34(_0x3c8579[_0xace1('0xd')][_0xace1('0xe')]);}else{logger[_0xace1('0x9')](_0xace1('0xa'),_0x2203ef,_0xace1('0xb'));_0x576b34(_0x3c8579[_0xace1('0xf')]['message']);}})['catch'](function(_0x42dd0e){logger[_0xace1('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x2203ef,_0x42dd0e);_0x495cff(_0x42dd0e);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index eb6a50a..e8c13ed 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 _0xdd99=['server/files/sounds/original/','originalname','replace','format','basename','post','single','file','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xdd99,0x119));var _0x9dd9=function(_0x252b38,_0xb90bfd){_0x252b38=_0x252b38-0x0;var _0x25eb48=_0xdd99[_0x252b38];return _0x25eb48;};'use strict';var multer=require(_0x9dd9('0x0'));var util=require('util');var path=require(_0x9dd9('0x1'));var timeout=require('connect-timeout');var express=require(_0x9dd9('0x2'));var router=express[_0x9dd9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9dd9('0x4'));var interaction=require(_0x9dd9('0x5'));var config=require(_0x9dd9('0x6'));var controller=require(_0x9dd9('0x7'));router[_0x9dd9('0x8')]('/',auth[_0x9dd9('0x9')](),controller[_0x9dd9('0xa')]);router['get'](_0x9dd9('0xb'),auth[_0x9dd9('0x9')](),controller[_0x9dd9('0xc')]);router['get'](_0x9dd9('0xd'),auth['isAuthenticated'](),controller[_0x9dd9('0xe')]);var upload=multer({'storage':multer[_0x9dd9('0xf')]({'destination':function(_0x3d5010,_0x2a3472,_0x4249ac){_0x4249ac(null,path['join'](config['root'],_0x9dd9('0x10')));},'filename':function(_0x3b0ffd,_0x5d64f7,_0x4a0959){_0x5d64f7['originalname']=_0x5d64f7[_0x9dd9('0x11')][_0x9dd9('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4a0959(null,util[_0x9dd9('0x13')]('%s-%s%s',path[_0x9dd9('0x14')](_0x5d64f7[_0x9dd9('0x11')],path['extname'](_0x5d64f7[_0x9dd9('0x11')])),Date['now'](),path['extname'](_0x5d64f7[_0x9dd9('0x11')])));}})});router[_0x9dd9('0x15')]('/',upload[_0x9dd9('0x16')](_0x9dd9('0x17')),controller['create']);router['put'](_0x9dd9('0xb'),auth['isAuthenticated'](),controller[_0x9dd9('0x18')]);router[_0x9dd9('0x19')](_0x9dd9('0xb'),auth[_0x9dd9('0x9')](),controller[_0x9dd9('0x19')]);module[_0x9dd9('0x1a')]=router; \ No newline at end of file +var _0xcefe=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','get','/:id','show','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update','delete','exports'];(function(_0x41d52c,_0x361699){var _0x4f30ba=function(_0x367fa1){while(--_0x367fa1){_0x41d52c['push'](_0x41d52c['shift']());}};_0x4f30ba(++_0x361699);}(_0xcefe,0xd2));var _0xecef=function(_0x103aef,_0x17a372){_0x103aef=_0x103aef-0x0;var _0x5dea5c=_0xcefe[_0x103aef];return _0x5dea5c;};'use strict';var multer=require(_0xecef('0x0'));var util=require(_0xecef('0x1'));var path=require('path');var timeout=require(_0xecef('0x2'));var express=require(_0xecef('0x3'));var router=express['Router']();var fs_extra=require(_0xecef('0x4'));var auth=require(_0xecef('0x5'));var interaction=require(_0xecef('0x6'));var config=require('../../config/environment');var controller=require(_0xecef('0x7'));router['get']('/',auth[_0xecef('0x8')](),controller['index']);router[_0xecef('0x9')](_0xecef('0xa'),auth[_0xecef('0x8')](),controller[_0xecef('0xb')]);router[_0xecef('0x9')]('/:id/download',auth[_0xecef('0x8')](),controller[_0xecef('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e7dce,_0xcf84c0,_0x5802c9){_0x5802c9(null,path[_0xecef('0xd')](config[_0xecef('0xe')],_0xecef('0xf')));},'filename':function(_0x36a9d2,_0x37fe0c,_0x25deb0){_0x37fe0c[_0xecef('0x10')]=_0x37fe0c[_0xecef('0x10')][_0xecef('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25deb0(null,util[_0xecef('0x12')](_0xecef('0x13'),path[_0xecef('0x14')](_0x37fe0c[_0xecef('0x10')],path[_0xecef('0x15')](_0x37fe0c[_0xecef('0x10')])),Date['now'](),path['extname'](_0x37fe0c['originalname'])));}})});router[_0xecef('0x16')]('/',upload[_0xecef('0x17')](_0xecef('0x18')),controller[_0xecef('0x19')]);router[_0xecef('0x1a')](_0xecef('0xa'),auth[_0xecef('0x8')](),controller[_0xecef('0x1b')]);router[_0xecef('0x1c')](_0xecef('0xa'),auth['isAuthenticated'](),controller[_0xecef('0x1c')]);module[_0xecef('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 2d07c6d..5da7ae7 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 _0xbdea=['BIGINT','INTEGER','sequelize','name','STRING','FLOAT'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xbdea,0x8c));var _0xabde=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0xbdea[_0x513119];return _0x587511;};'use strict';var Sequelize=require(_0xabde('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xabde('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xabde('0x2')]},'display_name':{'type':Sequelize[_0xabde('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xabde('0x2')]},'original_format':{'type':Sequelize[_0xabde('0x2')]},'original_duration':{'type':Sequelize[_0xabde('0x3')]},'original_sampleCount':{'type':Sequelize[_0xabde('0x4')]},'original_channelCount':{'type':Sequelize[_0xabde('0x5')]},'original_bitRate':{'type':Sequelize[_0xabde('0x4')]},'original_sampleRate':{'type':Sequelize[_0xabde('0x5')]},'converted_format':{'type':Sequelize[_0xabde('0x2')]},'converted_duration':{'type':Sequelize[_0xabde('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xabde('0x4')]},'converted_channelCount':{'type':Sequelize[_0xabde('0x5')]},'converted_bitRate':{'type':Sequelize[_0xabde('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xabde('0x5')]}}; \ No newline at end of file +var _0xf7e3=['STRING','FLOAT','BIGINT','INTEGER','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf7e3,0x171));var _0x3f7e=function(_0x27435a,_0x4f94e7){_0x27435a=_0x27435a-0x0;var _0x1f93de=_0xf7e3[_0x27435a];return _0x1f93de;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3f7e('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3f7e('0x1')]},'display_name':{'type':Sequelize[_0x3f7e('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x3f7e('0x1')]},'original_format':{'type':Sequelize[_0x3f7e('0x1')]},'original_duration':{'type':Sequelize[_0x3f7e('0x2')]},'original_sampleCount':{'type':Sequelize[_0x3f7e('0x3')]},'original_channelCount':{'type':Sequelize[_0x3f7e('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x3f7e('0x1')]},'converted_duration':{'type':Sequelize[_0x3f7e('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x3f7e('0x3')]},'converted_channelCount':{'type':Sequelize[_0x3f7e('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x3f7e('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index f9f7116..dfe8c99 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 _0xeed6=['where','filter','type','VIRTUAL','options','count','includeAll','include','findAll','rows','params','rawAttributes','fields','length','merge','find','download','save_name','converted_format','existsSync','root','Sequelize','Sound\x20not\x20found','join','format','catch','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','%s.%s','original_format','server/files/sounds/converted','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','end','json','offset','limit','undefined','status','set','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','map','Sound','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xeed6,0xbe));var _0x6eed=function(_0x4e707e,_0x208eb5){_0x4e707e=_0x4e707e-0x0;var _0x3d346e=_0xeed6[_0x4e707e];return _0x3d346e;};'use strict';var emlformat=require(_0x6eed('0x0'));var rimraf=require(_0x6eed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6eed('0x2'));var rp=require(_0x6eed('0x3'));var moment=require(_0x6eed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6eed('0x5'));var util=require(_0x6eed('0x6'));var path=require(_0x6eed('0x7'));var sox=require(_0x6eed('0x8'));var csv=require(_0x6eed('0x9'));var ejs=require(_0x6eed('0xa'));var fs=require('fs');var fs_extra=require(_0x6eed('0xb'));var _=require('lodash');var squel=require(_0x6eed('0xc'));var crypto=require(_0x6eed('0xd'));var jsforce=require(_0x6eed('0xe'));var deskjs=require(_0x6eed('0xf'));var toCsv=require(_0x6eed('0x9'));var querystring=require(_0x6eed('0x10'));var Papa=require(_0x6eed('0x11'));var Redis=require('ioredis');var authService=require(_0x6eed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6eed('0x13'));var hardwareService=require(_0x6eed('0x14'));var logger=require(_0x6eed('0x15'))(_0x6eed('0x16'));var utils=require(_0x6eed('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6eed('0x18'));var db=require(_0x6eed('0x19'))['db'];function respondWithStatusCode(_0x519e23,_0x425a55){_0x425a55=_0x425a55||0xcc;return function(_0x3645e4){if(_0x3645e4){return _0x519e23[_0x6eed('0x1a')](_0x425a55);}return _0x519e23['status'](_0x425a55)[_0x6eed('0x1b')]();};}function respondWithResult(_0x4b4d28,_0x79c46b){_0x79c46b=_0x79c46b||0xc8;return function(_0x7cf36f){if(_0x7cf36f){return _0x4b4d28['status'](_0x79c46b)[_0x6eed('0x1c')](_0x7cf36f);}};}function respondWithFilteredResult(_0x3d2d0e,_0x496ec2){return function(_0x335f6d){if(_0x335f6d){var _0x2919fe=typeof _0x496ec2[_0x6eed('0x1d')]==='undefined'&&typeof _0x496ec2[_0x6eed('0x1e')]===_0x6eed('0x1f');var _0x134487=_0x335f6d['count'];var _0x38b52e=_0x2919fe?0x0:_0x496ec2[_0x6eed('0x1d')];var _0xc5fa8c=_0x2919fe?_0x335f6d['count']:_0x496ec2[_0x6eed('0x1d')]+_0x496ec2[_0x6eed('0x1e')];var _0x780ba9;if(_0xc5fa8c>=_0x134487){_0xc5fa8c=_0x134487;_0x780ba9=0xc8;}else{_0x780ba9=0xce;}_0x3d2d0e[_0x6eed('0x20')](_0x780ba9);return _0x3d2d0e[_0x6eed('0x21')](_0x6eed('0x22'),_0x38b52e+'-'+_0xc5fa8c+'/'+_0x134487)['json'](_0x335f6d);}return null;};}function patchUpdates(_0x382c9f){return function(_0x59491d){try{jsonpatch[_0x6eed('0x23')](_0x59491d,_0x382c9f,!![]);}catch(_0x62c230){return BPromise[_0x6eed('0x24')](_0x62c230);}return _0x59491d[_0x6eed('0x25')]();};}function saveUpdates(_0x39dbd2,_0x78350f){return function(_0x10ff0b){if(_0x10ff0b){return _0x10ff0b[_0x6eed('0x26')](_0x39dbd2)['then'](function(_0xc4d69c){return _0xc4d69c;});}return null;};}function removeEntity(_0x4b9fc7,_0x382435){return function(_0x484d8c){if(_0x484d8c){return _0x484d8c[_0x6eed('0x27')]()[_0x6eed('0x28')](function(){var _0x22eaca=_0x484d8c[_0x6eed('0x29')]({'plain':!![]});var _0x409669=_0x6eed('0x2a');return db[_0x6eed('0x2b')][_0x6eed('0x27')]({'where':{'type':_0x409669,'resourceId':_0x22eaca['id']}})[_0x6eed('0x28')](function(){return _0x484d8c;});})[_0x6eed('0x28')](function(){_0x4b9fc7[_0x6eed('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d07d4,_0x32d58f){return function(_0x5d9a3f){if(!_0x5d9a3f){_0x3d07d4[_0x6eed('0x1a')](0x194);}return _0x5d9a3f;};}function handleError(_0x3a05de,_0x33dea9){_0x33dea9=_0x33dea9||0x1f4;return function(_0x4b272a){logger[_0x6eed('0x2c')](_0x4b272a[_0x6eed('0x2d')]);if(_0x4b272a[_0x6eed('0x2e')]){delete _0x4b272a[_0x6eed('0x2e')];}_0x3a05de[_0x6eed('0x20')](_0x33dea9)[_0x6eed('0x2f')](_0x4b272a);};}exports['index']=function(_0xd22632,_0x2f6258){var _0xc49a3a={},_0x1c2de5={},_0x39157c={'count':0x0,'rows':[]};var _0x1c0233=_[_0x6eed('0x30')](db[_0x6eed('0x31')]['rawAttributes'],function(_0x96c16d){return{'name':_0x96c16d[_0x6eed('0x32')],'type':_0x96c16d['type'][_0x6eed('0x33')]};});_0x1c2de5['model']=_['map'](_0x1c0233,_0x6eed('0x2e'));_0x1c2de5[_0x6eed('0x34')]=_[_0x6eed('0x35')](_0xd22632['query']);_0x1c2de5[_0x6eed('0x36')]=_[_0x6eed('0x37')](_0x1c2de5[_0x6eed('0x38')],_0x1c2de5[_0x6eed('0x34')]);_0xc49a3a[_0x6eed('0x39')]=_[_0x6eed('0x37')](_0x1c2de5[_0x6eed('0x38')],qs['fields'](_0xd22632[_0x6eed('0x34')]['fields']));_0xc49a3a['attributes']=_0xc49a3a[_0x6eed('0x39')]['length']?_0xc49a3a[_0x6eed('0x39')]:_0x1c2de5['model'];if(!_0xd22632['query'][_0x6eed('0x3a')](_0x6eed('0x3b'))){_0xc49a3a[_0x6eed('0x1e')]=qs[_0x6eed('0x1e')](_0xd22632[_0x6eed('0x34')][_0x6eed('0x1e')]);_0xc49a3a['offset']=qs[_0x6eed('0x1d')](_0xd22632[_0x6eed('0x34')][_0x6eed('0x1d')]);}_0xc49a3a[_0x6eed('0x3c')]=qs[_0x6eed('0x3d')](_0xd22632[_0x6eed('0x34')][_0x6eed('0x3d')]);_0xc49a3a[_0x6eed('0x3e')]=qs['filters'](_['pick'](_0xd22632[_0x6eed('0x34')],_0x1c2de5[_0x6eed('0x36')]),_0x1c0233);if(_0xd22632[_0x6eed('0x34')][_0x6eed('0x3f')]){_0xc49a3a['where']=_['merge'](_0xc49a3a[_0x6eed('0x3e')],{'$or':_[_0x6eed('0x30')](_0x1c0233,function(_0x4ef95c){if(_0x4ef95c[_0x6eed('0x40')]!==_0x6eed('0x41')){var _0x455a20={};_0x455a20[_0x4ef95c[_0x6eed('0x2e')]]={'$like':'%'+_0xd22632[_0x6eed('0x34')][_0x6eed('0x3f')]+'%'};return _0x455a20;}})});}_0xc49a3a=_['merge']({},_0xc49a3a,_0xd22632[_0x6eed('0x42')]);var _0x33ac7d={'where':_0xc49a3a[_0x6eed('0x3e')]};return db[_0x6eed('0x31')][_0x6eed('0x43')](_0x33ac7d)[_0x6eed('0x28')](function(_0x4a6bf1){_0x39157c[_0x6eed('0x43')]=_0x4a6bf1;if(_0xd22632['query'][_0x6eed('0x44')]){_0xc49a3a[_0x6eed('0x45')]=[{'all':!![]}];}return db[_0x6eed('0x31')][_0x6eed('0x46')](_0xc49a3a);})[_0x6eed('0x28')](function(_0x20bf4a){_0x39157c[_0x6eed('0x47')]=_0x20bf4a;return _0x39157c;})[_0x6eed('0x28')](respondWithFilteredResult(_0x2f6258,_0xc49a3a))['catch'](handleError(_0x2f6258,null));};exports['show']=function(_0x32f9fa,_0x2dc518){var _0x16a371={'raw':!![],'where':{'id':_0x32f9fa[_0x6eed('0x48')]['id']}},_0x4a0e27={};_0x4a0e27[_0x6eed('0x38')]=_[_0x6eed('0x35')](db[_0x6eed('0x31')][_0x6eed('0x49')]);_0x4a0e27['query']=_[_0x6eed('0x35')](_0x32f9fa[_0x6eed('0x34')]);_0x4a0e27[_0x6eed('0x36')]=_[_0x6eed('0x37')](_0x4a0e27[_0x6eed('0x38')],_0x4a0e27[_0x6eed('0x34')]);_0x16a371[_0x6eed('0x39')]=_[_0x6eed('0x37')](_0x4a0e27[_0x6eed('0x38')],qs[_0x6eed('0x4a')](_0x32f9fa[_0x6eed('0x34')][_0x6eed('0x4a')]));_0x16a371[_0x6eed('0x39')]=_0x16a371[_0x6eed('0x39')][_0x6eed('0x4b')]?_0x16a371[_0x6eed('0x39')]:_0x4a0e27[_0x6eed('0x38')];if(_0x32f9fa[_0x6eed('0x34')][_0x6eed('0x44')]){_0x16a371[_0x6eed('0x45')]=[{'all':!![]}];}_0x16a371=_[_0x6eed('0x4c')]({},_0x16a371,_0x32f9fa[_0x6eed('0x42')]);return db[_0x6eed('0x31')][_0x6eed('0x4d')](_0x16a371)[_0x6eed('0x28')](handleEntityNotFound(_0x2dc518,null))[_0x6eed('0x28')](respondWithResult(_0x2dc518,null))['catch'](handleError(_0x2dc518,null));};exports[_0x6eed('0x4e')]=function(_0x33e4f5,_0x10edd3,_0xccb312){return db['Sound'][_0x6eed('0x4d')]({'where':{'id':_0x33e4f5['params']['id']},'attributes':[_0x6eed('0x2e'),_0x6eed('0x4f'),_0x6eed('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x10edd3,null))[_0x6eed('0x28')](function(_0x56fba3){if(_0x56fba3){if(!fs[_0x6eed('0x51')](path['join'](config[_0x6eed('0x52')],'server/files/sounds/converted',_0x56fba3[_0x6eed('0x4f')]+'.'+_0x56fba3[_0x6eed('0x50')]))){throw new db[(_0x6eed('0x53'))]['ValidationError'](_0x6eed('0x54'));}return _0x10edd3[_0x6eed('0x4e')](path[_0x6eed('0x55')](config['root'],'server/files/sounds/converted',util[_0x6eed('0x56')]('%s.%s',_0x56fba3[_0x6eed('0x4f')],_0x56fba3[_0x6eed('0x50')])),util[_0x6eed('0x56')]('%s.%s',_0x56fba3['name'],_0x56fba3[_0x6eed('0x50')]));}return null;})[_0x6eed('0x57')](handleError(_0x10edd3,null));};exports[_0x6eed('0x58')]=function(_0x447cf9,_0x1bcefd,_0x149ddc){var _0x3c5607={'name':path[_0x6eed('0x59')](_0x447cf9[_0x6eed('0x5a')][_0x6eed('0x5b')],path['extname'](_0x447cf9[_0x6eed('0x5a')][_0x6eed('0x5b')])),'save_name':path[_0x6eed('0x59')](_0x447cf9[_0x6eed('0x5a')][_0x6eed('0x5c')],path[_0x6eed('0x5d')](_0x447cf9[_0x6eed('0x5a')][_0x6eed('0x5c')])),'original_format':path[_0x6eed('0x5d')](_0x447cf9['file'][_0x6eed('0x5b')])[_0x6eed('0x5e')](0x1),'converted_format':_0x6eed('0x5f')};var _0x2a883c=path[_0x6eed('0x55')](config[_0x6eed('0x52')],_0x6eed('0x60'),_0x447cf9['file']['filename']);var _0x330e33=path[_0x6eed('0x55')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',path['basename'](_0x447cf9[_0x6eed('0x5a')][_0x6eed('0x5c')],path[_0x6eed('0x5d')](_0x447cf9[_0x6eed('0x5a')][_0x6eed('0x5c')])),_0x3c5607[_0x6eed('0x50')]));logger[_0x6eed('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x2a883c);logger[_0x6eed('0x61')](_0x6eed('0x62'),_0x330e33);try{fs['chmodSync'](_0x2a883c,parseInt(_0x6eed('0x63'),0x8));var _0x30e39e=sox[_0x6eed('0x64')](_0x2a883c,_0x330e33,{'sampleRate':0x1f40,'format':_0x6eed('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x30e39e['on'](_0x6eed('0x2c'),function(_0x438002){fs[_0x6eed('0x65')](_0x2a883c);_0x1bcefd['status'](0x1f4)['send'](_0x438002);});_0x30e39e['on'](_0x6eed('0x66'),function(_0x2f8f87){_0x3c5607[_0x6eed('0x67')]=isNaN(_0x2f8f87[_0x6eed('0x68')])?null:_0x2f8f87[_0x6eed('0x68')]*0x3e8;_0x3c5607[_0x6eed('0x69')]=isNaN(_0x2f8f87[_0x6eed('0x6a')])?null:_0x2f8f87[_0x6eed('0x6a')];_0x3c5607[_0x6eed('0x6b')]=isNaN(_0x2f8f87[_0x6eed('0x6c')])?null:_0x2f8f87['channelCount'];_0x3c5607[_0x6eed('0x6d')]=isNaN(_0x2f8f87[_0x6eed('0x6e')])?null:_0x2f8f87[_0x6eed('0x6e')];_0x3c5607[_0x6eed('0x6f')]=isNaN(_0x2f8f87[_0x6eed('0x70')])?null:_0x2f8f87['sampleRate'];});_0x30e39e['on'](_0x6eed('0x71'),function(_0x6cd154){_0x3c5607['converted_duration']=isNaN(_0x6cd154[_0x6eed('0x68')])?null:_0x6cd154['duration']*0x3e8;_0x3c5607['converted_sampleCount']=isNaN(_0x6cd154[_0x6eed('0x6a')])?null:_0x6cd154[_0x6eed('0x6a')];_0x3c5607[_0x6eed('0x72')]=isNaN(_0x6cd154['channelCount'])?null:_0x6cd154[_0x6eed('0x6c')];_0x3c5607[_0x6eed('0x73')]=isNaN(_0x6cd154['bitRate'])?null:_0x6cd154[_0x6eed('0x6e')];_0x3c5607[_0x6eed('0x74')]=isNaN(_0x6cd154[_0x6eed('0x70')])?null:_0x6cd154[_0x6eed('0x70')];});_0x30e39e['on'](_0x6eed('0x1b'),function(){fs['chmodSync'](_0x330e33,parseInt(_0x6eed('0x63'),0x8));return db[_0x6eed('0x31')][_0x6eed('0x58')](_0x3c5607)[_0x6eed('0x28')](function(_0x14bc18){var _0x6ad132={'role':_0x447cf9[_0x6eed('0x75')]['role'],'userProfileId':_0x447cf9[_0x6eed('0x75')]['userProfileId']};if(!_0x6ad132)throw new Error(_0x6eed('0x76'));if(_0x6ad132[_0x6eed('0x77')]==='user'){var _0x33badd=_0x14bc18[_0x6eed('0x29')]({'plain':!![]});return db[_0x6eed('0x78')]['find']({'where':{'name':'Sounds','userProfileId':_0x6ad132[_0x6eed('0x79')]},'raw':!![]})['then'](function(_0x9ee596){if(_0x9ee596&&_0x9ee596[_0x6eed('0x7a')]===0x0){return db[_0x6eed('0x2b')][_0x6eed('0x58')]({'name':_0x33badd[_0x6eed('0x2e')],'resourceId':_0x33badd['id'],'type':_0x9ee596[_0x6eed('0x2e')],'sectionId':_0x9ee596['id']},{})['then'](function(){return _0x14bc18;});}else{return _0x14bc18;}})[_0x6eed('0x57')](function(_0xd8a90){logger[_0x6eed('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd8a90);throw _0xd8a90;});}return _0x14bc18;})[_0x6eed('0x28')](respondWithResult(_0x1bcefd,null))[_0x6eed('0x57')](handleError(_0x1bcefd,null));});_0x30e39e['start']();}catch(_0x577b97){_0x1bcefd['status'](0x1f4)[_0x6eed('0x2f')](_0x577b97);}};exports['update']=function(_0x5d548a,_0x197752,_0xa7c0fa){return db['Sound'][_0x6eed('0x4d')]({'where':{'id':_0x5d548a[_0x6eed('0x48')]['id']}})[_0x6eed('0x28')](handleEntityNotFound(_0x197752,null))[_0x6eed('0x28')](saveUpdates(_['pick'](_0x5d548a['body'],[_0x6eed('0x2e'),'description']),null))[_0x6eed('0x28')](respondWithResult(_0x197752,null))[_0x6eed('0x57')](handleError(_0x197752,null));};exports['delete']=function(_0x50fb88,_0x312003,_0x4652ee){return db['Sound'][_0x6eed('0x4d')]({'where':{'id':_0x50fb88['params']['id']}})['then'](function(_0x15b8fd){if(_0x15b8fd){return _0x15b8fd['destroy']();}})['then'](function(_0xe3f0f){var _0x220db9=path[_0x6eed('0x55')](config['root'],_0x6eed('0x60'),util[_0x6eed('0x56')](_0x6eed('0x7b'),_0xe3f0f[_0x6eed('0x4f')],_0xe3f0f[_0x6eed('0x7c')]));var _0x444f13=path['join'](config[_0x6eed('0x52')],_0x6eed('0x7d'),util[_0x6eed('0x56')](_0x6eed('0x7b'),_0xe3f0f[_0x6eed('0x4f')],_0xe3f0f[_0x6eed('0x50')]));fs['unlinkSync'](_0x220db9);fs[_0x6eed('0x65')](_0x444f13);return _0xe3f0f;})['then'](function(_0x521210){if(_0x521210){return _0x312003[_0x6eed('0x20')](0xcc)[_0x6eed('0x1b')]();}})[_0x6eed('0x28')](handleEntityNotFound(_0x312003,null))['catch'](handleError(_0x312003,null));}; \ No newline at end of file +var _0x12f6=['converted_channelCount','converted_bitRate','converted_sampleRate','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','options','Sound','includeAll','findAll','catch','show','include','merge','download','find','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','basename','file','originalname','extname','substring','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount'];(function(_0x565160,_0x406323){var _0x44ef98=function(_0x1ec0be){while(--_0x1ec0be){_0x565160['push'](_0x565160['shift']());}};_0x44ef98(++_0x406323);}(_0x12f6,0x10b));var _0x612f=function(_0x17c56a,_0x329fc8){_0x17c56a=_0x17c56a-0x0;var _0x15cbfc=_0x12f6[_0x17c56a];return _0x15cbfc;};'use strict';var emlformat=require(_0x612f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x612f('0x1'));var rp=require(_0x612f('0x2'));var moment=require(_0x612f('0x3'));var BPromise=require(_0x612f('0x4'));var Mustache=require(_0x612f('0x5'));var util=require(_0x612f('0x6'));var path=require(_0x612f('0x7'));var sox=require(_0x612f('0x8'));var csv=require(_0x612f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x612f('0xa'));var _=require(_0x612f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x612f('0xc'));var deskjs=require(_0x612f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x612f('0xe'));var Papa=require(_0x612f('0xf'));var Redis=require(_0x612f('0x10'));var authService=require(_0x612f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x612f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x612f('0x13'))('api');var utils=require(_0x612f('0x14'));var config=require(_0x612f('0x15'));var licenseUtil=require(_0x612f('0x16'));var db=require(_0x612f('0x17'))['db'];function respondWithStatusCode(_0x10793d,_0x385f0f){_0x385f0f=_0x385f0f||0xcc;return function(_0x144a52){if(_0x144a52){return _0x10793d[_0x612f('0x18')](_0x385f0f);}return _0x10793d[_0x612f('0x19')](_0x385f0f)[_0x612f('0x1a')]();};}function respondWithResult(_0x11166b,_0x336f38){_0x336f38=_0x336f38||0xc8;return function(_0x16ebeb){if(_0x16ebeb){return _0x11166b[_0x612f('0x19')](_0x336f38)[_0x612f('0x1b')](_0x16ebeb);}};}function respondWithFilteredResult(_0x4e9592,_0x176443){return function(_0x4480ea){if(_0x4480ea){var _0x3369fd=typeof _0x176443['offset']===_0x612f('0x1c')&&typeof _0x176443['limit']===_0x612f('0x1c');var _0x503c84=_0x4480ea['count'];var _0x328172=_0x3369fd?0x0:_0x176443[_0x612f('0x1d')];var _0x13b08d=_0x3369fd?_0x4480ea[_0x612f('0x1e')]:_0x176443[_0x612f('0x1d')]+_0x176443[_0x612f('0x1f')];var _0x2d353c;if(_0x13b08d>=_0x503c84){_0x13b08d=_0x503c84;_0x2d353c=0xc8;}else{_0x2d353c=0xce;}_0x4e9592[_0x612f('0x19')](_0x2d353c);return _0x4e9592[_0x612f('0x20')](_0x612f('0x21'),_0x328172+'-'+_0x13b08d+'/'+_0x503c84)[_0x612f('0x1b')](_0x4480ea);}return null;};}function patchUpdates(_0x4910b7){return function(_0x3a2b6b){try{jsonpatch[_0x612f('0x22')](_0x3a2b6b,_0x4910b7,!![]);}catch(_0x3db440){return BPromise[_0x612f('0x23')](_0x3db440);}return _0x3a2b6b[_0x612f('0x24')]();};}function saveUpdates(_0x277d00,_0x58df15){return function(_0x597b8a){if(_0x597b8a){return _0x597b8a[_0x612f('0x25')](_0x277d00)[_0x612f('0x26')](function(_0x46fb1f){return _0x46fb1f;});}return null;};}function removeEntity(_0x3386cc,_0x2c91ff){return function(_0x4ef90f){if(_0x4ef90f){return _0x4ef90f['destroy']()[_0x612f('0x26')](function(){var _0x4d25a4=_0x4ef90f[_0x612f('0x27')]({'plain':!![]});var _0x46af04=_0x612f('0x28');return db[_0x612f('0x29')][_0x612f('0x2a')]({'where':{'type':_0x46af04,'resourceId':_0x4d25a4['id']}})[_0x612f('0x26')](function(){return _0x4ef90f;});})['then'](function(){_0x3386cc[_0x612f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5237a0,_0x2aa83c){return function(_0x1927c7){if(!_0x1927c7){_0x5237a0[_0x612f('0x18')](0x194);}return _0x1927c7;};}function handleError(_0x57d384,_0x439410){_0x439410=_0x439410||0x1f4;return function(_0x36069d){logger[_0x612f('0x2b')](_0x36069d[_0x612f('0x2c')]);if(_0x36069d['name']){delete _0x36069d[_0x612f('0x2d')];}_0x57d384[_0x612f('0x19')](_0x439410)[_0x612f('0x2e')](_0x36069d);};}exports['index']=function(_0x2a4974,_0x4d32db){var _0x139acc={},_0x55454f={},_0x33e9e9={'count':0x0,'rows':[]};var _0x50fb59=_['map'](db['Sound'][_0x612f('0x2f')],function(_0x577a65){return{'name':_0x577a65[_0x612f('0x30')],'type':_0x577a65[_0x612f('0x31')][_0x612f('0x32')]};});_0x55454f[_0x612f('0x33')]=_[_0x612f('0x34')](_0x50fb59,'name');_0x55454f[_0x612f('0x35')]=_[_0x612f('0x36')](_0x2a4974['query']);_0x55454f['filters']=_[_0x612f('0x37')](_0x55454f[_0x612f('0x33')],_0x55454f['query']);_0x139acc[_0x612f('0x38')]=_[_0x612f('0x37')](_0x55454f[_0x612f('0x33')],qs['fields'](_0x2a4974[_0x612f('0x35')][_0x612f('0x39')]));_0x139acc[_0x612f('0x38')]=_0x139acc['attributes'][_0x612f('0x3a')]?_0x139acc['attributes']:_0x55454f['model'];if(!_0x2a4974[_0x612f('0x35')][_0x612f('0x3b')]('nolimit')){_0x139acc[_0x612f('0x1f')]=qs[_0x612f('0x1f')](_0x2a4974[_0x612f('0x35')][_0x612f('0x1f')]);_0x139acc[_0x612f('0x1d')]=qs[_0x612f('0x1d')](_0x2a4974[_0x612f('0x35')][_0x612f('0x1d')]);}_0x139acc['order']=qs[_0x612f('0x3c')](_0x2a4974[_0x612f('0x35')][_0x612f('0x3c')]);_0x139acc[_0x612f('0x3d')]=qs[_0x612f('0x3e')](_[_0x612f('0x3f')](_0x2a4974[_0x612f('0x35')],_0x55454f[_0x612f('0x3e')]),_0x50fb59);if(_0x2a4974[_0x612f('0x35')][_0x612f('0x40')]){_0x139acc[_0x612f('0x3d')]=_['merge'](_0x139acc[_0x612f('0x3d')],{'$or':_[_0x612f('0x34')](_0x50fb59,function(_0x12a44d){if(_0x12a44d['type']!==_0x612f('0x41')){var _0x263fbf={};_0x263fbf[_0x12a44d[_0x612f('0x2d')]]={'$like':'%'+_0x2a4974[_0x612f('0x35')][_0x612f('0x40')]+'%'};return _0x263fbf;}})});}_0x139acc=_['merge']({},_0x139acc,_0x2a4974[_0x612f('0x42')]);var _0x967271={'where':_0x139acc[_0x612f('0x3d')]};return db[_0x612f('0x43')][_0x612f('0x1e')](_0x967271)[_0x612f('0x26')](function(_0x58ffc6){_0x33e9e9[_0x612f('0x1e')]=_0x58ffc6;if(_0x2a4974[_0x612f('0x35')][_0x612f('0x44')]){_0x139acc['include']=[{'all':!![]}];}return db[_0x612f('0x43')][_0x612f('0x45')](_0x139acc);})[_0x612f('0x26')](function(_0x103b1a){_0x33e9e9['rows']=_0x103b1a;return _0x33e9e9;})[_0x612f('0x26')](respondWithFilteredResult(_0x4d32db,_0x139acc))[_0x612f('0x46')](handleError(_0x4d32db,null));};exports[_0x612f('0x47')]=function(_0x4594ab,_0x36c5ef){var _0x582e01={'raw':!![],'where':{'id':_0x4594ab['params']['id']}},_0x2ae621={};_0x2ae621[_0x612f('0x33')]=_['keys'](db['Sound'][_0x612f('0x2f')]);_0x2ae621[_0x612f('0x35')]=_[_0x612f('0x36')](_0x4594ab[_0x612f('0x35')]);_0x2ae621[_0x612f('0x3e')]=_[_0x612f('0x37')](_0x2ae621[_0x612f('0x33')],_0x2ae621['query']);_0x582e01[_0x612f('0x38')]=_[_0x612f('0x37')](_0x2ae621[_0x612f('0x33')],qs[_0x612f('0x39')](_0x4594ab[_0x612f('0x35')]['fields']));_0x582e01[_0x612f('0x38')]=_0x582e01['attributes'][_0x612f('0x3a')]?_0x582e01[_0x612f('0x38')]:_0x2ae621['model'];if(_0x4594ab['query'][_0x612f('0x44')]){_0x582e01[_0x612f('0x48')]=[{'all':!![]}];}_0x582e01=_[_0x612f('0x49')]({},_0x582e01,_0x4594ab[_0x612f('0x42')]);return db[_0x612f('0x43')]['find'](_0x582e01)[_0x612f('0x26')](handleEntityNotFound(_0x36c5ef,null))[_0x612f('0x26')](respondWithResult(_0x36c5ef,null))[_0x612f('0x46')](handleError(_0x36c5ef,null));};exports[_0x612f('0x4a')]=function(_0x312ace,_0x2b6a58,_0x4d58cf){return db[_0x612f('0x43')][_0x612f('0x4b')]({'where':{'id':_0x312ace[_0x612f('0x4c')]['id']},'attributes':[_0x612f('0x2d'),_0x612f('0x4d'),_0x612f('0x4e')],'raw':!![]})[_0x612f('0x26')](handleEntityNotFound(_0x2b6a58,null))['then'](function(_0x38390c){if(_0x38390c){if(!fs[_0x612f('0x4f')](path[_0x612f('0x50')](config[_0x612f('0x51')],_0x612f('0x52'),_0x38390c['save_name']+'.'+_0x38390c[_0x612f('0x4e')]))){throw new db[(_0x612f('0x53'))][(_0x612f('0x54'))]('Sound\x20not\x20found');}return _0x2b6a58[_0x612f('0x4a')](path['join'](config['root'],'server/files/sounds/converted',util[_0x612f('0x55')](_0x612f('0x56'),_0x38390c[_0x612f('0x4d')],_0x38390c[_0x612f('0x4e')])),util['format'](_0x612f('0x56'),_0x38390c[_0x612f('0x2d')],_0x38390c[_0x612f('0x4e')]));}return null;})[_0x612f('0x46')](handleError(_0x2b6a58,null));};exports['create']=function(_0x523254,_0x431b2c,_0x6a3303){var _0x36ffc1={'name':path[_0x612f('0x57')](_0x523254[_0x612f('0x58')][_0x612f('0x59')],path['extname'](_0x523254[_0x612f('0x58')][_0x612f('0x59')])),'save_name':path['basename'](_0x523254[_0x612f('0x58')]['filename'],path[_0x612f('0x5a')](_0x523254[_0x612f('0x58')]['filename'])),'original_format':path[_0x612f('0x5a')](_0x523254['file'][_0x612f('0x59')])[_0x612f('0x5b')](0x1),'converted_format':'wav'};var _0x6d3f3e=path[_0x612f('0x50')](config['root'],'server/files/sounds/original',_0x523254[_0x612f('0x58')][_0x612f('0x5c')]);var _0x4a2703=path[_0x612f('0x50')](config[_0x612f('0x51')],_0x612f('0x52'),util[_0x612f('0x55')](_0x612f('0x56'),path[_0x612f('0x57')](_0x523254[_0x612f('0x58')][_0x612f('0x5c')],path[_0x612f('0x5a')](_0x523254[_0x612f('0x58')]['filename'])),_0x36ffc1[_0x612f('0x4e')]));logger[_0x612f('0x5d')](_0x612f('0x5e'),_0x6d3f3e);logger[_0x612f('0x5d')](_0x612f('0x5f'),_0x4a2703);try{fs[_0x612f('0x60')](_0x6d3f3e,parseInt(_0x612f('0x61'),0x8));var _0x1a5232=sox['transcode'](_0x6d3f3e,_0x4a2703,{'sampleRate':0x1f40,'format':_0x612f('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a5232['on'](_0x612f('0x2b'),function(_0x2be81c){fs['unlinkSync'](_0x6d3f3e);_0x431b2c[_0x612f('0x19')](0x1f4)[_0x612f('0x2e')](_0x2be81c);});_0x1a5232['on'](_0x612f('0x63'),function(_0x2cd4d8){_0x36ffc1[_0x612f('0x64')]=isNaN(_0x2cd4d8[_0x612f('0x65')])?null:_0x2cd4d8[_0x612f('0x65')]*0x3e8;_0x36ffc1['original_sampleCount']=isNaN(_0x2cd4d8[_0x612f('0x66')])?null:_0x2cd4d8[_0x612f('0x66')];_0x36ffc1[_0x612f('0x67')]=isNaN(_0x2cd4d8[_0x612f('0x68')])?null:_0x2cd4d8['channelCount'];_0x36ffc1[_0x612f('0x69')]=isNaN(_0x2cd4d8[_0x612f('0x6a')])?null:_0x2cd4d8[_0x612f('0x6a')];_0x36ffc1[_0x612f('0x6b')]=isNaN(_0x2cd4d8[_0x612f('0x6c')])?null:_0x2cd4d8['sampleRate'];});_0x1a5232['on']('dest',function(_0x255967){_0x36ffc1[_0x612f('0x6d')]=isNaN(_0x255967[_0x612f('0x65')])?null:_0x255967[_0x612f('0x65')]*0x3e8;_0x36ffc1[_0x612f('0x6e')]=isNaN(_0x255967[_0x612f('0x66')])?null:_0x255967[_0x612f('0x66')];_0x36ffc1[_0x612f('0x6f')]=isNaN(_0x255967[_0x612f('0x68')])?null:_0x255967[_0x612f('0x68')];_0x36ffc1[_0x612f('0x70')]=isNaN(_0x255967[_0x612f('0x6a')])?null:_0x255967[_0x612f('0x6a')];_0x36ffc1[_0x612f('0x71')]=isNaN(_0x255967['sampleRate'])?null:_0x255967['sampleRate'];});_0x1a5232['on'](_0x612f('0x1a'),function(){fs[_0x612f('0x60')](_0x4a2703,parseInt(_0x612f('0x61'),0x8));return db[_0x612f('0x43')][_0x612f('0x72')](_0x36ffc1)[_0x612f('0x26')](function(_0x2b0d33){var _0x12a660={'role':_0x523254['body'][_0x612f('0x73')],'userProfileId':_0x523254[_0x612f('0x74')]['userProfileId']};if(!_0x12a660)throw new Error(_0x612f('0x75'));if(_0x12a660[_0x612f('0x73')]==='user'){var _0x424b50=_0x2b0d33[_0x612f('0x27')]({'plain':!![]});return db[_0x612f('0x76')]['find']({'where':{'name':_0x612f('0x28'),'userProfileId':_0x12a660[_0x612f('0x77')]},'raw':!![]})['then'](function(_0x404ad8){if(_0x404ad8&&_0x404ad8[_0x612f('0x78')]===0x0){return db['UserProfileResource'][_0x612f('0x72')]({'name':_0x424b50['name'],'resourceId':_0x424b50['id'],'type':_0x404ad8[_0x612f('0x2d')],'sectionId':_0x404ad8['id']},{})[_0x612f('0x26')](function(){return _0x2b0d33;});}else{return _0x2b0d33;}})['catch'](function(_0x48373c){logger['error'](_0x612f('0x79'),_0x48373c);throw _0x48373c;});}return _0x2b0d33;})[_0x612f('0x26')](respondWithResult(_0x431b2c,null))['catch'](handleError(_0x431b2c,null));});_0x1a5232[_0x612f('0x7a')]();}catch(_0x1c024e){_0x431b2c['status'](0x1f4)[_0x612f('0x2e')](_0x1c024e);}};exports[_0x612f('0x25')]=function(_0x1f484b,_0xb1142e,_0x585675){return db[_0x612f('0x43')]['find']({'where':{'id':_0x1f484b[_0x612f('0x4c')]['id']}})[_0x612f('0x26')](handleEntityNotFound(_0xb1142e,null))[_0x612f('0x26')](saveUpdates(_[_0x612f('0x3f')](_0x1f484b[_0x612f('0x74')],[_0x612f('0x2d'),_0x612f('0x7b')]),null))[_0x612f('0x26')](respondWithResult(_0xb1142e,null))['catch'](handleError(_0xb1142e,null));};exports[_0x612f('0x7c')]=function(_0x287635,_0x584094,_0x323e01){return db[_0x612f('0x43')][_0x612f('0x4b')]({'where':{'id':_0x287635[_0x612f('0x4c')]['id']}})['then'](function(_0x4abb4c){if(_0x4abb4c){return _0x4abb4c[_0x612f('0x2a')]();}})[_0x612f('0x26')](function(_0x288379){var _0x44d6dd=path['join'](config[_0x612f('0x51')],'server/files/sounds/original',util['format'](_0x612f('0x56'),_0x288379['save_name'],_0x288379['original_format']));var _0x459c5e=path['join'](config['root'],'server/files/sounds/converted',util[_0x612f('0x55')](_0x612f('0x56'),_0x288379[_0x612f('0x4d')],_0x288379[_0x612f('0x4e')]));fs[_0x612f('0x7d')](_0x44d6dd);fs[_0x612f('0x7d')](_0x459c5e);return _0x288379;})[_0x612f('0x26')](function(_0x49b9f9){if(_0x49b9f9){return _0x584094[_0x612f('0x19')](0xcc)[_0x612f('0x1a')]();}})[_0x612f('0x26')](handleEntityNotFound(_0x584094,null))['catch'](handleError(_0x584094,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5d6b1ca..ae0aa98 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 _0x3266=['path','../../config/environment','Sound','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x4eb0a3,_0x1938a4){var _0x3b4012=function(_0x53e59e){while(--_0x53e59e){_0x4eb0a3['push'](_0x4eb0a3['shift']());}};_0x3b4012(++_0x1938a4);}(_0x3266,0x6c));var _0x6326=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x3266[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0x6326('0x0'));var util=require('util');var logger=require(_0x6326('0x1'))(_0x6326('0x2'));var moment=require(_0x6326('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6326('0x4'));var rimraf=require('rimraf');var config=require(_0x6326('0x5'));var attributes=require('./sound.attributes');module['exports']=function(_0xa7410f,_0x242319){return _0xa7410f['define'](_0x6326('0x6'),attributes,{'tableName':_0x6326('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0476=['rimraf','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0476,0x6e));var _0x6047=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x0476[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0x6047('0x0'));var logger=require(_0x6047('0x1'))(_0x6047('0x2'));var moment=require(_0x6047('0x3'));var BPromise=require(_0x6047('0x4'));var rp=require(_0x6047('0x5'));var fs=require('fs');var path=require(_0x6047('0x6'));var rimraf=require(_0x6047('0x7'));var config=require('../../config/environment');var attributes=require(_0x6047('0x8'));module[_0x6047('0x9')]=function(_0x94d054,_0xb0b14a){return _0x94d054[_0x6047('0xa')](_0x6047('0xb'),attributes,{'tableName':_0x6047('0xc'),'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 6f39fd1..de9405c 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 _0x6706=['include','map','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','ShowSound','Sound','find','options','raw','where','attributes'];(function(_0x688e5c,_0x2175e6){var _0x2d04c4=function(_0x7931e6){while(--_0x7931e6){_0x688e5c['push'](_0x688e5c['shift']());}};_0x2d04c4(++_0x2175e6);}(_0x6706,0x1c4));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6670('0x0'));var util=require(_0x6670('0x1'));var moment=require(_0x6670('0x2'));var BPromise=require(_0x6670('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6670('0x4'));var db=require(_0x6670('0x5'))['db'];var utils=require(_0x6670('0x6'));var logger=require(_0x6670('0x7'))(_0x6670('0x8'));var config=require(_0x6670('0x9'));var jayson=require(_0x6670('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57dd36,_0x51b66b,_0x409928){return new BPromise(function(_0x4f8736,_0xa37295){return client[_0x6670('0xb')](_0x57dd36,_0x409928)[_0x6670('0xc')](function(_0x3b8392){logger[_0x6670('0xd')]('Sound,\x20%s,\x20%s',_0x51b66b,_0x6670('0xe'));logger[_0x6670('0xf')](_0x6670('0x10'),_0x51b66b,_0x6670('0xe'),JSON['stringify'](_0x3b8392));if(_0x3b8392[_0x6670('0x11')]){if(_0x3b8392[_0x6670('0x11')][_0x6670('0x12')]===0x1f4){logger[_0x6670('0x11')](_0x6670('0x13'),_0x51b66b,_0x3b8392['error'][_0x6670('0x14')]);return _0xa37295(_0x3b8392[_0x6670('0x11')][_0x6670('0x14')]);}logger['error']('Sound,\x20%s,\x20%s',_0x51b66b,_0x3b8392['error'][_0x6670('0x14')]);return _0x4f8736(_0x3b8392['error'][_0x6670('0x14')]);}else{logger['info'](_0x6670('0x13'),_0x51b66b,'request\x20sent');_0x4f8736(_0x3b8392['result'][_0x6670('0x14')]);}})['catch'](function(_0x4ef3d5){logger[_0x6670('0x11')]('Sound,\x20%s,\x20%s',_0x51b66b,_0x4ef3d5);_0xa37295(_0x4ef3d5);});});}exports[_0x6670('0x15')]=function(_0x3201da){var _0x1148bf=this;return new Promise(function(_0x53efc9,_0x4c77ce){return db[_0x6670('0x16')][_0x6670('0x17')]({'raw':_0x3201da[_0x6670('0x18')]?_0x3201da['options'][_0x6670('0x19')]===undefined?!![]:![]:!![],'where':_0x3201da[_0x6670('0x18')]?_0x3201da[_0x6670('0x18')][_0x6670('0x1a')]||null:null,'attributes':_0x3201da['options']?_0x3201da[_0x6670('0x18')][_0x6670('0x1b')]||null:null,'include':_0x3201da[_0x6670('0x18')]?_0x3201da[_0x6670('0x18')][_0x6670('0x1c')]?_[_0x6670('0x1d')](_0x3201da['options'][_0x6670('0x1c')],function(_0x35191f){return{'model':db[_0x35191f[_0x6670('0x1e')]],'as':_0x35191f['as'],'attributes':_0x35191f[_0x6670('0x1b')],'include':_0x35191f[_0x6670('0x1c')]?_[_0x6670('0x1d')](_0x35191f[_0x6670('0x1c')],function(_0x221f98){return{'model':db[_0x221f98[_0x6670('0x1e')]],'as':_0x221f98['as'],'attributes':_0x221f98[_0x6670('0x1b')],'include':_0x221f98['include']?_['map'](_0x221f98['include'],function(_0x145914){return{'model':db[_0x145914[_0x6670('0x1e')]],'as':_0x145914['as'],'attributes':_0x145914[_0x6670('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a9e7a){logger[_0x6670('0xd')](_0x6670('0x15'),_0x3201da);logger[_0x6670('0xf')](_0x6670('0x15'),_0x3201da,JSON['stringify'](_0x5a9e7a));_0x53efc9(_0x5a9e7a);})[_0x6670('0x1f')](function(_0xa2a677){logger['error'](_0x6670('0x15'),_0xa2a677[_0x6670('0x14')],_0x3201da);_0x4c77ce(_0x1148bf[_0x6670('0x11')](0x1f4,_0xa2a677[_0x6670('0x14')]));});});}; \ No newline at end of file +var _0xd4c6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','info','catch','ShowSound','options','where','attributes','map','model','include','then','lodash','bluebird','randomstring','ioredis'];(function(_0x5615d7,_0x57a510){var _0x553ab0=function(_0x181cb6){while(--_0x181cb6){_0x5615d7['push'](_0x5615d7['shift']());}};_0x553ab0(++_0x57a510);}(_0xd4c6,0x11e));var _0x6d4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4c6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d4c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6d4c('0x1'));var rs=require(_0x6d4c('0x2'));var fs=require('fs');var Redis=require(_0x6d4c('0x3'));var db=require(_0x6d4c('0x4'))['db'];var utils=require(_0x6d4c('0x5'));var logger=require(_0x6d4c('0x6'))('rpc');var config=require(_0x6d4c('0x7'));var jayson=require(_0x6d4c('0x8'));var client=jayson['client'][_0x6d4c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x847629,_0x2bceb7,_0x34e03b){return new BPromise(function(_0x37669d,_0x22cf68){return client[_0x6d4c('0xa')](_0x847629,_0x34e03b)['then'](function(_0x2eb959){logger['info']('Sound,\x20%s,\x20%s',_0x2bceb7,'request\x20sent');logger[_0x6d4c('0xb')](_0x6d4c('0xc'),_0x2bceb7,_0x6d4c('0xd'),JSON[_0x6d4c('0xe')](_0x2eb959));if(_0x2eb959[_0x6d4c('0xf')]){if(_0x2eb959[_0x6d4c('0xf')][_0x6d4c('0x10')]===0x1f4){logger[_0x6d4c('0xf')](_0x6d4c('0x11'),_0x2bceb7,_0x2eb959['error'][_0x6d4c('0x12')]);return _0x22cf68(_0x2eb959[_0x6d4c('0xf')][_0x6d4c('0x12')]);}logger['error'](_0x6d4c('0x11'),_0x2bceb7,_0x2eb959[_0x6d4c('0xf')][_0x6d4c('0x12')]);return _0x37669d(_0x2eb959[_0x6d4c('0xf')]['message']);}else{logger[_0x6d4c('0x13')](_0x6d4c('0x11'),_0x2bceb7,_0x6d4c('0xd'));_0x37669d(_0x2eb959['result'][_0x6d4c('0x12')]);}})[_0x6d4c('0x14')](function(_0x24a391){logger[_0x6d4c('0xf')](_0x6d4c('0x11'),_0x2bceb7,_0x24a391);_0x22cf68(_0x24a391);});});}exports[_0x6d4c('0x15')]=function(_0x2e82c9){var _0x158a62=this;return new Promise(function(_0x19760a,_0xfe817c){return db['Sound']['find']({'raw':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')][_0x6d4c('0x17')]||null:null,'attributes':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')][_0x6d4c('0x18')]||null:null,'include':_0x2e82c9[_0x6d4c('0x16')]?_0x2e82c9[_0x6d4c('0x16')]['include']?_[_0x6d4c('0x19')](_0x2e82c9['options']['include'],function(_0x199048){return{'model':db[_0x199048[_0x6d4c('0x1a')]],'as':_0x199048['as'],'attributes':_0x199048[_0x6d4c('0x18')],'include':_0x199048[_0x6d4c('0x1b')]?_[_0x6d4c('0x19')](_0x199048[_0x6d4c('0x1b')],function(_0x1c7584){return{'model':db[_0x1c7584[_0x6d4c('0x1a')]],'as':_0x1c7584['as'],'attributes':_0x1c7584[_0x6d4c('0x18')],'include':_0x1c7584[_0x6d4c('0x1b')]?_[_0x6d4c('0x19')](_0x1c7584['include'],function(_0x26f3ed){return{'model':db[_0x26f3ed[_0x6d4c('0x1a')]],'as':_0x26f3ed['as'],'attributes':_0x26f3ed[_0x6d4c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6d4c('0x1c')](function(_0x1dfe22){logger['info'](_0x6d4c('0x15'),_0x2e82c9);logger[_0x6d4c('0xb')]('ShowSound',_0x2e82c9,JSON[_0x6d4c('0xe')](_0x1dfe22));_0x19760a(_0x1dfe22);})[_0x6d4c('0x14')](function(_0x53f1c6){logger[_0x6d4c('0xf')]('ShowSound',_0x53f1c6[_0x6d4c('0x12')],_0x2e82c9);_0xfe817c(_0x158a62['error'](0x1f4,_0x53f1c6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index eb95562..51564e6 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4b7899,_0xaca5c8){_0x4b7899=_0x4b7899-0x0;var _0x28d344=_0x9ffd[_0x4b7899];return _0x28d344;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4605a6,_0x4ee25f){var _0x18bc7a=function(_0x2f1228){while(--_0x2f1228){_0x4605a6['push'](_0x4605a6['shift']());}};_0x18bc7a(++_0x4ee25f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x0b0e[_0x967959];return _0x5c4489;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9c98fca..ff169b2 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 _0xb184=['out','STRING','sequelize','TEXT','ENUM'];(function(_0x2b70dc,_0x230af9){var _0x40ce04=function(_0x237cd9){while(--_0x237cd9){_0x2b70dc['push'](_0x2b70dc['shift']());}};_0x40ce04(++_0x230af9);}(_0xb184,0x11a));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4b18('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x4b18('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x4b18('0x2')]('in',_0x4b18('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x4b18('0x4')]},'providerResponse':{'type':Sequelize[_0x4b18('0x1')]}}; \ No newline at end of file +var _0xb1b5=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb1b5,0xe8));var _0x5b1b=function(_0x7c228e,_0x443a8c){_0x7c228e=_0x7c228e-0x0;var _0x56091c=_0xb1b5[_0x7c228e];return _0x56091c;};'use strict';var Sequelize=require(_0x5b1b('0x0'));module[_0x5b1b('0x1')]={'uniqueid':{'type':Sequelize[_0x5b1b('0x2')]},'body':{'type':Sequelize[_0x5b1b('0x3')](_0x5b1b('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x5b1b('0x5')]('in',_0x5b1b('0x6')),'defaultValue':_0x5b1b('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index bc66682..065b2f3 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 _0xabf9=['model','name','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','SquareMessage','rawAttributes','find','create','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','destroy','then','error','send','index','map','type','key'];(function(_0x3396cd,_0x4047f0){var _0x2d6b4a=function(_0x389663){while(--_0x389663){_0x3396cd['push'](_0x3396cd['shift']());}};_0x2d6b4a(++_0x4047f0);}(_0xabf9,0x1e4));var _0x9abf=function(_0x69676f,_0x232db2){_0x69676f=_0x69676f-0x0;var _0xa03e0=_0xabf9[_0x69676f];return _0xa03e0;};'use strict';var emlformat=require(_0x9abf('0x0'));var rimraf=require(_0x9abf('0x1'));var zipdir=require(_0x9abf('0x2'));var jsonpatch=require(_0x9abf('0x3'));var rp=require(_0x9abf('0x4'));var moment=require(_0x9abf('0x5'));var BPromise=require(_0x9abf('0x6'));var Mustache=require(_0x9abf('0x7'));var util=require(_0x9abf('0x8'));var path=require(_0x9abf('0x9'));var sox=require(_0x9abf('0xa'));var csv=require(_0x9abf('0xb'));var ejs=require(_0x9abf('0xc'));var fs=require('fs');var fs_extra=require(_0x9abf('0xd'));var _=require(_0x9abf('0xe'));var squel=require(_0x9abf('0xf'));var crypto=require(_0x9abf('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x9abf('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9abf('0x12'));var Papa=require(_0x9abf('0x13'));var Redis=require(_0x9abf('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x9abf('0x15'));var as=require(_0x9abf('0x16'));var hardwareService=require(_0x9abf('0x17'));var logger=require(_0x9abf('0x18'))(_0x9abf('0x19'));var utils=require(_0x9abf('0x1a'));var config=require(_0x9abf('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9abf('0x1c'))['db'];function respondWithStatusCode(_0x220301,_0x117352){_0x117352=_0x117352||0xcc;return function(_0x521c97){if(_0x521c97){return _0x220301[_0x9abf('0x1d')](_0x117352);}return _0x220301[_0x9abf('0x1e')](_0x117352)[_0x9abf('0x1f')]();};}function respondWithResult(_0x37417a,_0x3b6d17){_0x3b6d17=_0x3b6d17||0xc8;return function(_0x1fdfbe){if(_0x1fdfbe){return _0x37417a['status'](_0x3b6d17)[_0x9abf('0x20')](_0x1fdfbe);}};}function respondWithFilteredResult(_0x26de81,_0x4d7a5a){return function(_0x2abd31){if(_0x2abd31){var _0x1f1eb9=typeof _0x4d7a5a['offset']===_0x9abf('0x21')&&typeof _0x4d7a5a[_0x9abf('0x22')]===_0x9abf('0x21');var _0x462642=_0x2abd31[_0x9abf('0x23')];var _0x48e44e=_0x1f1eb9?0x0:_0x4d7a5a[_0x9abf('0x24')];var _0xcc4a3b=_0x1f1eb9?_0x2abd31['count']:_0x4d7a5a[_0x9abf('0x24')]+_0x4d7a5a[_0x9abf('0x22')];var _0x562bd7;if(_0xcc4a3b>=_0x462642){_0xcc4a3b=_0x462642;_0x562bd7=0xc8;}else{_0x562bd7=0xce;}_0x26de81[_0x9abf('0x1e')](_0x562bd7);return _0x26de81['set'](_0x9abf('0x25'),_0x48e44e+'-'+_0xcc4a3b+'/'+_0x462642)['json'](_0x2abd31);}return null;};}function patchUpdates(_0x11e19e){return function(_0x14e868){try{jsonpatch['apply'](_0x14e868,_0x11e19e,!![]);}catch(_0x1c418d){return BPromise[_0x9abf('0x26')](_0x1c418d);}return _0x14e868[_0x9abf('0x27')]();};}function saveUpdates(_0x3b8e43,_0x409bd8){return function(_0x55c919){if(_0x55c919){return _0x55c919['update'](_0x3b8e43)['then'](function(_0x50b4e0){return _0x50b4e0;});}return null;};}function removeEntity(_0x4cd046,_0x367fd5){return function(_0x24c17e){if(_0x24c17e){return _0x24c17e[_0x9abf('0x28')]()[_0x9abf('0x29')](function(){_0x4cd046[_0x9abf('0x1e')](0xcc)[_0x9abf('0x1f')]();});}};}function handleEntityNotFound(_0x4268fc,_0x2c8981){return function(_0x49bec0){if(!_0x49bec0){_0x4268fc[_0x9abf('0x1d')](0x194);}return _0x49bec0;};}function handleError(_0xa5edc7,_0x3009ce){_0x3009ce=_0x3009ce||0x1f4;return function(_0x17ffa3){logger[_0x9abf('0x2a')](_0x17ffa3['stack']);if(_0x17ffa3['name']){delete _0x17ffa3['name'];}_0xa5edc7[_0x9abf('0x1e')](_0x3009ce)[_0x9abf('0x2b')](_0x17ffa3);};}exports[_0x9abf('0x2c')]=function(_0x3468cc,_0x2fbb00){var _0xabbce8={},_0x22a6bb={},_0x5422af={'count':0x0,'rows':[]};var _0x2d3448=_[_0x9abf('0x2d')](db['SquareMessage']['rawAttributes'],function(_0x275920){return{'name':_0x275920['fieldName'],'type':_0x275920[_0x9abf('0x2e')][_0x9abf('0x2f')]};});_0x22a6bb[_0x9abf('0x30')]=_[_0x9abf('0x2d')](_0x2d3448,_0x9abf('0x31'));_0x22a6bb[_0x9abf('0x32')]=_['keys'](_0x3468cc[_0x9abf('0x32')]);_0x22a6bb[_0x9abf('0x33')]=_[_0x9abf('0x34')](_0x22a6bb[_0x9abf('0x30')],_0x22a6bb[_0x9abf('0x32')]);_0xabbce8[_0x9abf('0x35')]=_[_0x9abf('0x34')](_0x22a6bb['model'],qs[_0x9abf('0x36')](_0x3468cc[_0x9abf('0x32')]['fields']));_0xabbce8['attributes']=_0xabbce8[_0x9abf('0x35')][_0x9abf('0x37')]?_0xabbce8[_0x9abf('0x35')]:_0x22a6bb[_0x9abf('0x30')];if(!_0x3468cc[_0x9abf('0x32')]['hasOwnProperty'](_0x9abf('0x38'))){_0xabbce8['limit']=qs['limit'](_0x3468cc[_0x9abf('0x32')][_0x9abf('0x22')]);_0xabbce8[_0x9abf('0x24')]=qs[_0x9abf('0x24')](_0x3468cc['query'][_0x9abf('0x24')]);}_0xabbce8['order']=qs['sort'](_0x3468cc['query'][_0x9abf('0x39')]);_0xabbce8[_0x9abf('0x3a')]=qs[_0x9abf('0x33')](_[_0x9abf('0x3b')](_0x3468cc[_0x9abf('0x32')],_0x22a6bb[_0x9abf('0x33')]),_0x2d3448);if(_0x3468cc[_0x9abf('0x32')][_0x9abf('0x3c')]){_0xabbce8[_0x9abf('0x3a')]=_[_0x9abf('0x3d')](_0xabbce8['where'],{'$or':_[_0x9abf('0x2d')](_0x2d3448,function(_0x56bfc9){if(_0x56bfc9[_0x9abf('0x2e')]!==_0x9abf('0x3e')){var _0x45b58e={};_0x45b58e[_0x56bfc9['name']]={'$like':'%'+_0x3468cc[_0x9abf('0x32')][_0x9abf('0x3c')]+'%'};return _0x45b58e;}})});}_0xabbce8=_['merge']({},_0xabbce8,_0x3468cc[_0x9abf('0x3f')]);var _0x35db86={'where':_0xabbce8['where']};return db['SquareMessage'][_0x9abf('0x23')](_0x35db86)[_0x9abf('0x29')](function(_0x2d4044){_0x5422af[_0x9abf('0x23')]=_0x2d4044;if(_0x3468cc[_0x9abf('0x32')][_0x9abf('0x40')]){_0xabbce8[_0x9abf('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0x9abf('0x42')](_0xabbce8);})[_0x9abf('0x29')](function(_0x489ca3){_0x5422af['rows']=_0x489ca3;return _0x5422af;})['then'](respondWithFilteredResult(_0x2fbb00,_0xabbce8))[_0x9abf('0x43')](handleError(_0x2fbb00,null));};exports[_0x9abf('0x44')]=function(_0x4b54c2,_0x52580e){var _0x202bd1={'raw':!![],'where':{'id':_0x4b54c2[_0x9abf('0x45')]['id']}},_0x49e4ae={};_0x49e4ae[_0x9abf('0x30')]=_[_0x9abf('0x46')](db[_0x9abf('0x47')][_0x9abf('0x48')]);_0x49e4ae[_0x9abf('0x32')]=_[_0x9abf('0x46')](_0x4b54c2[_0x9abf('0x32')]);_0x49e4ae['filters']=_[_0x9abf('0x34')](_0x49e4ae[_0x9abf('0x30')],_0x49e4ae[_0x9abf('0x32')]);_0x202bd1[_0x9abf('0x35')]=_[_0x9abf('0x34')](_0x49e4ae[_0x9abf('0x30')],qs[_0x9abf('0x36')](_0x4b54c2['query'][_0x9abf('0x36')]));_0x202bd1[_0x9abf('0x35')]=_0x202bd1[_0x9abf('0x35')][_0x9abf('0x37')]?_0x202bd1['attributes']:_0x49e4ae[_0x9abf('0x30')];if(_0x4b54c2['query']['includeAll']){_0x202bd1['include']=[{'all':!![]}];}_0x202bd1=_[_0x9abf('0x3d')]({},_0x202bd1,_0x4b54c2[_0x9abf('0x3f')]);return db['SquareMessage'][_0x9abf('0x49')](_0x202bd1)[_0x9abf('0x29')](handleEntityNotFound(_0x52580e,null))['then'](respondWithResult(_0x52580e,null))[_0x9abf('0x43')](handleError(_0x52580e,null));};exports['create']=function(_0x2f56ce,_0xabbb69){return db[_0x9abf('0x47')][_0x9abf('0x4a')](_0x2f56ce[_0x9abf('0x4b')],{})[_0x9abf('0x29')](respondWithResult(_0xabbb69,0xc9))[_0x9abf('0x43')](handleError(_0xabbb69,null));};exports['update']=function(_0x101931,_0x4e773a){if(_0x101931[_0x9abf('0x4b')]['id']){delete _0x101931[_0x9abf('0x4b')]['id'];}return db[_0x9abf('0x47')][_0x9abf('0x49')]({'where':{'id':_0x101931[_0x9abf('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e773a,null))[_0x9abf('0x29')](saveUpdates(_0x101931['body'],null))[_0x9abf('0x29')](respondWithResult(_0x4e773a,null))[_0x9abf('0x43')](handleError(_0x4e773a,null));};exports['destroy']=function(_0x7c6312,_0x4f836f){return db['SquareMessage']['find']({'where':{'id':_0x7c6312[_0x9abf('0x45')]['id']}})[_0x9abf('0x29')](handleEntityNotFound(_0x4f836f,null))['then'](removeEntity(_0x4f836f,null))[_0x9abf('0x43')](handleError(_0x4f836f,null));}; \ No newline at end of file +var _0x0c19=['pick','filters','filter','merge','where','SquareMessage','include','findAll','rows','params','includeAll','options','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x48fe25,_0x15851b){var _0x1f3abe=function(_0x3f605a){while(--_0x3f605a){_0x48fe25['push'](_0x48fe25['shift']());}};_0x1f3abe(++_0x15851b);}(_0x0c19,0xf5));var _0x90c1=function(_0x43d43d,_0x5e8c3d){_0x43d43d=_0x43d43d-0x0;var _0x1494ee=_0x0c19[_0x43d43d];return _0x1494ee;};'use strict';var emlformat=require(_0x90c1('0x0'));var rimraf=require(_0x90c1('0x1'));var zipdir=require(_0x90c1('0x2'));var jsonpatch=require(_0x90c1('0x3'));var rp=require(_0x90c1('0x4'));var moment=require(_0x90c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x90c1('0x6'));var util=require(_0x90c1('0x7'));var path=require(_0x90c1('0x8'));var sox=require('sox');var csv=require(_0x90c1('0x9'));var ejs=require(_0x90c1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90c1('0xb'));var squel=require(_0x90c1('0xc'));var crypto=require(_0x90c1('0xd'));var jsforce=require(_0x90c1('0xe'));var deskjs=require(_0x90c1('0xf'));var toCsv=require(_0x90c1('0x9'));var querystring=require(_0x90c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x90c1('0x11'));var authService=require(_0x90c1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x90c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90c1('0x14'));var utils=require('../../config/utils');var config=require(_0x90c1('0x15'));var licenseUtil=require(_0x90c1('0x16'));var db=require(_0x90c1('0x17'))['db'];function respondWithStatusCode(_0x2d9964,_0x4aa112){_0x4aa112=_0x4aa112||0xcc;return function(_0x59a0ca){if(_0x59a0ca){return _0x2d9964[_0x90c1('0x18')](_0x4aa112);}return _0x2d9964[_0x90c1('0x19')](_0x4aa112)[_0x90c1('0x1a')]();};}function respondWithResult(_0x3a8b82,_0x52a659){_0x52a659=_0x52a659||0xc8;return function(_0xaaab35){if(_0xaaab35){return _0x3a8b82[_0x90c1('0x19')](_0x52a659)[_0x90c1('0x1b')](_0xaaab35);}};}function respondWithFilteredResult(_0x139c67,_0x38fcea){return function(_0x1cfb86){if(_0x1cfb86){var _0x4f77bf=typeof _0x38fcea[_0x90c1('0x1c')]===_0x90c1('0x1d')&&typeof _0x38fcea[_0x90c1('0x1e')]===_0x90c1('0x1d');var _0x2fefb9=_0x1cfb86[_0x90c1('0x1f')];var _0x3b6671=_0x4f77bf?0x0:_0x38fcea[_0x90c1('0x1c')];var _0x372949=_0x4f77bf?_0x1cfb86[_0x90c1('0x1f')]:_0x38fcea[_0x90c1('0x1c')]+_0x38fcea['limit'];var _0x302ca2;if(_0x372949>=_0x2fefb9){_0x372949=_0x2fefb9;_0x302ca2=0xc8;}else{_0x302ca2=0xce;}_0x139c67[_0x90c1('0x19')](_0x302ca2);return _0x139c67[_0x90c1('0x20')](_0x90c1('0x21'),_0x3b6671+'-'+_0x372949+'/'+_0x2fefb9)[_0x90c1('0x1b')](_0x1cfb86);}return null;};}function patchUpdates(_0x3c8cc6){return function(_0x5a8358){try{jsonpatch[_0x90c1('0x22')](_0x5a8358,_0x3c8cc6,!![]);}catch(_0x5bfe28){return BPromise[_0x90c1('0x23')](_0x5bfe28);}return _0x5a8358['save']();};}function saveUpdates(_0x4b0480,_0x18323c){return function(_0x512cd9){if(_0x512cd9){return _0x512cd9['update'](_0x4b0480)[_0x90c1('0x24')](function(_0x5f4c05){return _0x5f4c05;});}return null;};}function removeEntity(_0x4d53fd,_0x36fe37){return function(_0x5e7258){if(_0x5e7258){return _0x5e7258[_0x90c1('0x25')]()['then'](function(){_0x4d53fd[_0x90c1('0x19')](0xcc)[_0x90c1('0x1a')]();});}};}function handleEntityNotFound(_0x309f83,_0x2625af){return function(_0x174506){if(!_0x174506){_0x309f83[_0x90c1('0x18')](0x194);}return _0x174506;};}function handleError(_0x2a60fb,_0x5b38f5){_0x5b38f5=_0x5b38f5||0x1f4;return function(_0x26ee39){logger[_0x90c1('0x26')](_0x26ee39[_0x90c1('0x27')]);if(_0x26ee39[_0x90c1('0x28')]){delete _0x26ee39[_0x90c1('0x28')];}_0x2a60fb[_0x90c1('0x19')](_0x5b38f5)[_0x90c1('0x29')](_0x26ee39);};}exports[_0x90c1('0x2a')]=function(_0x40c45d,_0x1ed79c){var _0x17b923={},_0x2f85dc={},_0x46c65b={'count':0x0,'rows':[]};var _0x39f856=_[_0x90c1('0x2b')](db['SquareMessage'][_0x90c1('0x2c')],function(_0x435e56){return{'name':_0x435e56[_0x90c1('0x2d')],'type':_0x435e56[_0x90c1('0x2e')][_0x90c1('0x2f')]};});_0x2f85dc[_0x90c1('0x30')]=_[_0x90c1('0x2b')](_0x39f856,_0x90c1('0x28'));_0x2f85dc[_0x90c1('0x31')]=_[_0x90c1('0x32')](_0x40c45d[_0x90c1('0x31')]);_0x2f85dc['filters']=_[_0x90c1('0x33')](_0x2f85dc[_0x90c1('0x30')],_0x2f85dc[_0x90c1('0x31')]);_0x17b923['attributes']=_[_0x90c1('0x33')](_0x2f85dc[_0x90c1('0x30')],qs[_0x90c1('0x34')](_0x40c45d[_0x90c1('0x31')][_0x90c1('0x34')]));_0x17b923[_0x90c1('0x35')]=_0x17b923[_0x90c1('0x35')][_0x90c1('0x36')]?_0x17b923[_0x90c1('0x35')]:_0x2f85dc[_0x90c1('0x30')];if(!_0x40c45d[_0x90c1('0x31')][_0x90c1('0x37')](_0x90c1('0x38'))){_0x17b923[_0x90c1('0x1e')]=qs['limit'](_0x40c45d[_0x90c1('0x31')][_0x90c1('0x1e')]);_0x17b923[_0x90c1('0x1c')]=qs[_0x90c1('0x1c')](_0x40c45d['query']['offset']);}_0x17b923[_0x90c1('0x39')]=qs[_0x90c1('0x3a')](_0x40c45d[_0x90c1('0x31')][_0x90c1('0x3a')]);_0x17b923['where']=qs['filters'](_[_0x90c1('0x3b')](_0x40c45d[_0x90c1('0x31')],_0x2f85dc[_0x90c1('0x3c')]),_0x39f856);if(_0x40c45d[_0x90c1('0x31')][_0x90c1('0x3d')]){_0x17b923['where']=_['merge'](_0x17b923['where'],{'$or':_[_0x90c1('0x2b')](_0x39f856,function(_0x18c35d){if(_0x18c35d[_0x90c1('0x2e')]!=='VIRTUAL'){var _0x32bc3d={};_0x32bc3d[_0x18c35d['name']]={'$like':'%'+_0x40c45d['query'][_0x90c1('0x3d')]+'%'};return _0x32bc3d;}})});}_0x17b923=_[_0x90c1('0x3e')]({},_0x17b923,_0x40c45d['options']);var _0x3ace43={'where':_0x17b923[_0x90c1('0x3f')]};return db[_0x90c1('0x40')][_0x90c1('0x1f')](_0x3ace43)[_0x90c1('0x24')](function(_0x275731){_0x46c65b['count']=_0x275731;if(_0x40c45d[_0x90c1('0x31')]['includeAll']){_0x17b923[_0x90c1('0x41')]=[{'all':!![]}];}return db[_0x90c1('0x40')][_0x90c1('0x42')](_0x17b923);})[_0x90c1('0x24')](function(_0x8c47ec){_0x46c65b[_0x90c1('0x43')]=_0x8c47ec;return _0x46c65b;})[_0x90c1('0x24')](respondWithFilteredResult(_0x1ed79c,_0x17b923))['catch'](handleError(_0x1ed79c,null));};exports['show']=function(_0x2cd0fa,_0x118104){var _0x1699a1={'raw':!![],'where':{'id':_0x2cd0fa[_0x90c1('0x44')]['id']}},_0x4175d1={};_0x4175d1['model']=_['keys'](db[_0x90c1('0x40')][_0x90c1('0x2c')]);_0x4175d1['query']=_[_0x90c1('0x32')](_0x2cd0fa['query']);_0x4175d1['filters']=_[_0x90c1('0x33')](_0x4175d1['model'],_0x4175d1[_0x90c1('0x31')]);_0x1699a1['attributes']=_['intersection'](_0x4175d1[_0x90c1('0x30')],qs[_0x90c1('0x34')](_0x2cd0fa[_0x90c1('0x31')][_0x90c1('0x34')]));_0x1699a1['attributes']=_0x1699a1[_0x90c1('0x35')][_0x90c1('0x36')]?_0x1699a1[_0x90c1('0x35')]:_0x4175d1[_0x90c1('0x30')];if(_0x2cd0fa['query'][_0x90c1('0x45')]){_0x1699a1[_0x90c1('0x41')]=[{'all':!![]}];}_0x1699a1=_['merge']({},_0x1699a1,_0x2cd0fa[_0x90c1('0x46')]);return db[_0x90c1('0x40')][_0x90c1('0x47')](_0x1699a1)[_0x90c1('0x24')](handleEntityNotFound(_0x118104,null))[_0x90c1('0x24')](respondWithResult(_0x118104,null))['catch'](handleError(_0x118104,null));};exports[_0x90c1('0x48')]=function(_0x4bde8e,_0x304011){return db['SquareMessage'][_0x90c1('0x48')](_0x4bde8e[_0x90c1('0x49')],{})[_0x90c1('0x24')](respondWithResult(_0x304011,0xc9))[_0x90c1('0x4a')](handleError(_0x304011,null));};exports[_0x90c1('0x4b')]=function(_0x3aa812,_0x1d00e4){if(_0x3aa812[_0x90c1('0x49')]['id']){delete _0x3aa812[_0x90c1('0x49')]['id'];}return db['SquareMessage'][_0x90c1('0x47')]({'where':{'id':_0x3aa812['params']['id']}})[_0x90c1('0x24')](handleEntityNotFound(_0x1d00e4,null))[_0x90c1('0x24')](saveUpdates(_0x3aa812[_0x90c1('0x49')],null))[_0x90c1('0x24')](respondWithResult(_0x1d00e4,null))[_0x90c1('0x4a')](handleError(_0x1d00e4,null));};exports[_0x90c1('0x25')]=function(_0x201674,_0x177a53){return db[_0x90c1('0x40')][_0x90c1('0x47')]({'where':{'id':_0x201674[_0x90c1('0x44')]['id']}})['then'](handleEntityNotFound(_0x177a53,null))[_0x90c1('0x24')](removeEntity(_0x177a53,null))[_0x90c1('0x4a')](handleError(_0x177a53,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f41e344..cce924a 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 _0x75c1=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','square_messages','util','../../config/logger'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x75c1,0x169));var _0x175c=function(_0x221874,_0x556d39){_0x221874=_0x221874-0x0;var _0x586aec=_0x75c1[_0x221874];return _0x586aec;};'use strict';var _=require('lodash');var util=require(_0x175c('0x0'));var logger=require(_0x175c('0x1'))(_0x175c('0x2'));var moment=require(_0x175c('0x3'));var BPromise=require(_0x175c('0x4'));var rp=require(_0x175c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x175c('0x6'));var config=require(_0x175c('0x7'));var attributes=require('./squareMessage.attributes');module[_0x175c('0x8')]=function(_0xdbb0d9,_0x239859){return _0xdbb0d9[_0x175c('0x9')]('SquareMessage',attributes,{'tableName':_0x175c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebf0=['api','bluebird','path','./squareMessage.attributes','exports','define','lodash','../../config/logger'];(function(_0x5c028d,_0x546f2c){var _0x216864=function(_0x41ec43){while(--_0x41ec43){_0x5c028d['push'](_0x5c028d['shift']());}};_0x216864(++_0x546f2c);}(_0xebf0,0x10e));var _0x0ebf=function(_0xe2e7e0,_0x21c042){_0xe2e7e0=_0xe2e7e0-0x0;var _0x1b734a=_0xebf0[_0xe2e7e0];return _0x1b734a;};'use strict';var _=require(_0x0ebf('0x0'));var util=require('util');var logger=require(_0x0ebf('0x1'))(_0x0ebf('0x2'));var moment=require('moment');var BPromise=require(_0x0ebf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ebf('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ebf('0x5'));module[_0x0ebf('0x6')]=function(_0x56fca5,_0x513c6f){return _0x56fca5[_0x0ebf('0x7')]('SquareMessage',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 a6b712e..d1aeef4 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 _0x6857=['client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1691c0,_0x3e69b9){var _0x2da8ae=function(_0x41ca08){while(--_0x41ca08){_0x1691c0['push'](_0x1691c0['shift']());}};_0x2da8ae(++_0x3e69b9);}(_0x6857,0xb4));var _0x7685=function(_0x2819a3,_0x36dcf6){_0x2819a3=_0x2819a3-0x0;var _0x93f321=_0x6857[_0x2819a3];return _0x93f321;};'use strict';var _=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var moment=require(_0x7685('0x2'));var BPromise=require(_0x7685('0x3'));var rs=require(_0x7685('0x4'));var fs=require('fs');var Redis=require(_0x7685('0x5'));var db=require(_0x7685('0x6'))['db'];var utils=require(_0x7685('0x7'));var logger=require(_0x7685('0x8'))(_0x7685('0x9'));var config=require(_0x7685('0xa'));var jayson=require(_0x7685('0xb'));var client=jayson[_0x7685('0xc')][_0x7685('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4d84fd,_0x500dd6,_0x476bdb){return new BPromise(function(_0x5278a8,_0x5c9334){return client['request'](_0x4d84fd,_0x476bdb)[_0x7685('0xe')](function(_0x29f15b){logger[_0x7685('0xf')](_0x7685('0x10'),_0x500dd6,_0x7685('0x11'));logger[_0x7685('0x12')](_0x7685('0x13'),_0x500dd6,'request\x20sent',JSON[_0x7685('0x14')](_0x29f15b));if(_0x29f15b[_0x7685('0x15')]){if(_0x29f15b[_0x7685('0x15')][_0x7685('0x16')]===0x1f4){logger[_0x7685('0x15')]('SquareMessage,\x20%s,\x20%s',_0x500dd6,_0x29f15b[_0x7685('0x15')][_0x7685('0x17')]);return _0x5c9334(_0x29f15b[_0x7685('0x15')][_0x7685('0x17')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x500dd6,_0x29f15b['error']['message']);return _0x5278a8(_0x29f15b[_0x7685('0x15')][_0x7685('0x17')]);}else{logger['info'](_0x7685('0x10'),_0x500dd6,_0x7685('0x11'));_0x5278a8(_0x29f15b[_0x7685('0x18')]['message']);}})[_0x7685('0x19')](function(_0x59a963){logger[_0x7685('0x15')](_0x7685('0x10'),_0x500dd6,_0x59a963);_0x5c9334(_0x59a963);});});}exports[_0x7685('0x1a')]=function(_0x554b84){var _0x418465=this;return new Promise(function(_0x4003e6,_0x107c39){return db[_0x7685('0x1b')][_0x7685('0x1c')](_0x554b84[_0x7685('0x1d')],{'raw':_0x554b84[_0x7685('0x1e')]?_0x554b84[_0x7685('0x1e')][_0x7685('0x1f')]===undefined?!![]:![]:!![]})[_0x7685('0xe')](function(_0x98f89b){logger['info']('CreateSquareMessage',_0x554b84);logger['debug']('CreateSquareMessage',_0x554b84,JSON['stringify'](_0x98f89b));_0x4003e6(_0x98f89b);})[_0x7685('0x19')](function(_0x859d50){logger['error'](_0x7685('0x1a'),_0x859d50[_0x7685('0x17')],_0x554b84);_0x107c39(_0x418465[_0x7685('0x15')](0x1f4,_0x859d50[_0x7685('0x17')]));});});}; \ No newline at end of file +var _0xefb6=['rpc','jayson/promise','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SquareMessage','body','options','raw','CreateSquareMessage','lodash','util','randomstring','ioredis','../../config/logger'];(function(_0xadf34d,_0x54e631){var _0xedf1bc=function(_0x4e9fa6){while(--_0x4e9fa6){_0xadf34d['push'](_0xadf34d['shift']());}};_0xedf1bc(++_0x54e631);}(_0xefb6,0x19d));var _0x6efb=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xefb6[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x6efb('0x0'));var util=require(_0x6efb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6efb('0x2'));var fs=require('fs');var Redis=require(_0x6efb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6efb('0x4'))(_0x6efb('0x5'));var config=require('../../config/environment');var jayson=require(_0x6efb('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46998b,_0x206a3a,_0x2b46ec){return new BPromise(function(_0x3c133b,_0x34db34){return client[_0x6efb('0x7')](_0x46998b,_0x2b46ec)[_0x6efb('0x8')](function(_0x295767){logger['info'](_0x6efb('0x9'),_0x206a3a,_0x6efb('0xa'));logger[_0x6efb('0xb')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x206a3a,_0x6efb('0xa'),JSON[_0x6efb('0xc')](_0x295767));if(_0x295767['error']){if(_0x295767[_0x6efb('0xd')][_0x6efb('0xe')]===0x1f4){logger[_0x6efb('0xd')](_0x6efb('0x9'),_0x206a3a,_0x295767[_0x6efb('0xd')][_0x6efb('0xf')]);return _0x34db34(_0x295767[_0x6efb('0xd')][_0x6efb('0xf')]);}logger['error'](_0x6efb('0x9'),_0x206a3a,_0x295767['error'][_0x6efb('0xf')]);return _0x3c133b(_0x295767[_0x6efb('0xd')]['message']);}else{logger['info'](_0x6efb('0x9'),_0x206a3a,_0x6efb('0xa'));_0x3c133b(_0x295767['result'][_0x6efb('0xf')]);}})[_0x6efb('0x10')](function(_0x379658){logger['error'](_0x6efb('0x9'),_0x206a3a,_0x379658);_0x34db34(_0x379658);});});}exports['CreateSquareMessage']=function(_0x26480e){var _0x42fe1e=this;return new Promise(function(_0x3429ba,_0x497483){return db[_0x6efb('0x11')]['create'](_0x26480e[_0x6efb('0x12')],{'raw':_0x26480e[_0x6efb('0x13')]?_0x26480e[_0x6efb('0x13')][_0x6efb('0x14')]===undefined?!![]:![]:!![]})[_0x6efb('0x8')](function(_0x2a5709){logger['info'](_0x6efb('0x15'),_0x26480e);logger[_0x6efb('0xb')](_0x6efb('0x15'),_0x26480e,JSON[_0x6efb('0xc')](_0x2a5709));_0x3429ba(_0x2a5709);})[_0x6efb('0x10')](function(_0x442437){logger['error']('CreateSquareMessage',_0x442437[_0x6efb('0xf')],_0x26480e);_0x497483(_0x42fe1e['error'](0x1f4,_0x442437[_0x6efb('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3a48e27..582662b 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 _0x0310=['get','/:id','isAuthenticated','/:id/test','15s','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0310,0x190));var _0x0031=function(_0x4c7ddb,_0x5d6c0f){_0x4c7ddb=_0x4c7ddb-0x0;var _0x457110=_0x0310[_0x4c7ddb];return _0x457110;};'use strict';var multer=require(_0x0031('0x0'));var util=require(_0x0031('0x1'));var path=require(_0x0031('0x2'));var timeout=require(_0x0031('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0031('0x4'));var interaction=require(_0x0031('0x5'));var config=require(_0x0031('0x6'));var controller=require(_0x0031('0x7'));router[_0x0031('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0031('0x8')](_0x0031('0x9'),auth[_0x0031('0xa')](),controller['show']);router[_0x0031('0x8')](_0x0031('0xb'),auth['isAuthenticated'](),timeout(_0x0031('0xc')),controller['test']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0031('0xd')](_0x0031('0x9'),auth[_0x0031('0xa')](),controller[_0x0031('0xe')]);router['delete'](_0x0031('0x9'),auth[_0x0031('0xa')](),controller[_0x0031('0xf')]);module[_0x0031('0x10')]=router; \ No newline at end of file +var _0x0224=['/:id/test','15s','test','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0xa1291,_0x60ad1f){var _0x5946d8=function(_0x25ca4b){while(--_0x25ca4b){_0xa1291['push'](_0xa1291['shift']());}};_0x5946d8(++_0x60ad1f);}(_0x0224,0x130));var _0x4022=function(_0x22ba6,_0x18dc12){_0x22ba6=_0x22ba6-0x0;var _0x4dca2e=_0x0224[_0x22ba6];return _0x4dca2e;};'use strict';var multer=require('multer');var util=require(_0x4022('0x0'));var path=require('path');var timeout=require(_0x4022('0x1'));var express=require(_0x4022('0x2'));var router=express[_0x4022('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4022('0x4'));var config=require(_0x4022('0x5'));var controller=require(_0x4022('0x6'));router[_0x4022('0x7')]('/',auth[_0x4022('0x8')](),controller[_0x4022('0x9')]);router[_0x4022('0x7')](_0x4022('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4022('0x7')](_0x4022('0xb'),auth['isAuthenticated'](),timeout(_0x4022('0xc')),controller[_0x4022('0xd')]);router[_0x4022('0xe')]('/',auth['isAuthenticated'](),controller[_0x4022('0xf')]);router[_0x4022('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4022('0x11')]);router[_0x4022('0x12')](_0x4022('0xa'),auth['isAuthenticated'](),controller[_0x4022('0x13')]);module[_0x4022('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 66393ac..ca7d506 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 _0x6d57=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d57,0xdd));var _0x76d5=function(_0x44e3e0,_0x4b9658){_0x44e3e0=_0x44e3e0-0x0;var _0x3204ad=_0x6d57[_0x44e3e0];return _0x3204ad;};'use strict';var Sequelize=require('sequelize');module[_0x76d5('0x0')]={'name':{'type':Sequelize[_0x76d5('0x1')],'unique':_0x76d5('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x76d5('0x1')]},'description':{'type':Sequelize[_0x76d5('0x1')]}}; \ No newline at end of file +var _0x8db0=['sequelize','exports','name','STRING'];(function(_0x2dcfe1,_0x3feb2a){var _0x3732f0=function(_0x1b4f10){while(--_0x1b4f10){_0x2dcfe1['push'](_0x2dcfe1['shift']());}};_0x3732f0(++_0x3feb2a);}(_0x8db0,0xec));var _0x08db=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x8db0[_0x5c2a2b];return _0x19921f;};'use strict';var Sequelize=require(_0x08db('0x0'));module[_0x08db('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x08db('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x08db('0x3')]},'description':{'type':Sequelize[_0x08db('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index db5071c..6d11f10 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 _0xda77=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','destroy','get','ODBC','UserProfileResource','then','error','name','send','SquareOdbc','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','order','sort','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','closeSync','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xda77,0xea));var _0x7da7=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xda77[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7da7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7da7('0x1'));var moment=require('moment');var BPromise=require(_0x7da7('0x2'));var Mustache=require(_0x7da7('0x3'));var util=require(_0x7da7('0x4'));var path=require('path');var sox=require(_0x7da7('0x5'));var csv=require(_0x7da7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7da7('0x7'));var squel=require(_0x7da7('0x8'));var crypto=require(_0x7da7('0x9'));var jsforce=require(_0x7da7('0xa'));var deskjs=require(_0x7da7('0xb'));var toCsv=require(_0x7da7('0x6'));var querystring=require(_0x7da7('0xc'));var Papa=require('papaparse');var Redis=require(_0x7da7('0xd'));var authService=require(_0x7da7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7da7('0xf'));var hardwareService=require(_0x7da7('0x10'));var logger=require(_0x7da7('0x11'))(_0x7da7('0x12'));var utils=require(_0x7da7('0x13'));var config=require(_0x7da7('0x14'));var licenseUtil=require(_0x7da7('0x15'));var db=require(_0x7da7('0x16'))['db'];function respondWithStatusCode(_0x4109ba,_0x341d39){_0x341d39=_0x341d39||0xcc;return function(_0x57e0df){if(_0x57e0df){return _0x4109ba[_0x7da7('0x17')](_0x341d39);}return _0x4109ba[_0x7da7('0x18')](_0x341d39)[_0x7da7('0x19')]();};}function respondWithResult(_0x5882a9,_0x55b185){_0x55b185=_0x55b185||0xc8;return function(_0x159062){if(_0x159062){return _0x5882a9['status'](_0x55b185)['json'](_0x159062);}};}function respondWithFilteredResult(_0x3f90e1,_0x13046b){return function(_0x3ae0a3){if(_0x3ae0a3){var _0x999c00=typeof _0x13046b[_0x7da7('0x1a')]===_0x7da7('0x1b')&&typeof _0x13046b[_0x7da7('0x1c')]===_0x7da7('0x1b');var _0x43d307=_0x3ae0a3['count'];var _0x1c335e=_0x999c00?0x0:_0x13046b[_0x7da7('0x1a')];var _0x2114b1=_0x999c00?_0x3ae0a3['count']:_0x13046b['offset']+_0x13046b[_0x7da7('0x1c')];var _0x12b4c7;if(_0x2114b1>=_0x43d307){_0x2114b1=_0x43d307;_0x12b4c7=0xc8;}else{_0x12b4c7=0xce;}_0x3f90e1[_0x7da7('0x18')](_0x12b4c7);return _0x3f90e1[_0x7da7('0x1d')]('Content-Range',_0x1c335e+'-'+_0x2114b1+'/'+_0x43d307)[_0x7da7('0x1e')](_0x3ae0a3);}return null;};}function patchUpdates(_0x28b2d5){return function(_0x539f5e){try{jsonpatch[_0x7da7('0x1f')](_0x539f5e,_0x28b2d5,!![]);}catch(_0x5b4e74){return BPromise[_0x7da7('0x20')](_0x5b4e74);}return _0x539f5e[_0x7da7('0x21')]();};}function saveUpdates(_0x2fd085,_0x56323d){return function(_0x59017c){if(_0x59017c){return _0x59017c[_0x7da7('0x22')](_0x2fd085)['then'](function(_0x31c835){return _0x31c835;});}return null;};}function removeEntity(_0x5f252d,_0x1ac853){return function(_0x3428f7){if(_0x3428f7){return _0x3428f7[_0x7da7('0x23')]()['then'](function(){var _0x28af89=_0x3428f7[_0x7da7('0x24')]({'plain':!![]});var _0x4f0688=_0x7da7('0x25');return db[_0x7da7('0x26')][_0x7da7('0x23')]({'where':{'type':_0x4f0688,'resourceId':_0x28af89['id']}})[_0x7da7('0x27')](function(){return _0x3428f7;});})[_0x7da7('0x27')](function(){_0x5f252d[_0x7da7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e12f,_0x2b230e){return function(_0x169d5e){if(!_0x169d5e){_0x49e12f[_0x7da7('0x17')](0x194);}return _0x169d5e;};}function handleError(_0x5632ff,_0x40780c){_0x40780c=_0x40780c||0x1f4;return function(_0x1e0480){logger[_0x7da7('0x28')](_0x1e0480['stack']);if(_0x1e0480[_0x7da7('0x29')]){delete _0x1e0480[_0x7da7('0x29')];}_0x5632ff['status'](_0x40780c)[_0x7da7('0x2a')](_0x1e0480);};}exports['index']=function(_0x1677e7,_0x42fbd2){var _0x14643c={},_0x1e5901={},_0x33e860={'count':0x0,'rows':[]};var _0x3a9f9f=_['map'](db[_0x7da7('0x2b')][_0x7da7('0x2c')],function(_0x2dbcb6){return{'name':_0x2dbcb6[_0x7da7('0x2d')],'type':_0x2dbcb6['type']['key']};});_0x1e5901[_0x7da7('0x2e')]=_[_0x7da7('0x2f')](_0x3a9f9f,_0x7da7('0x29'));_0x1e5901[_0x7da7('0x30')]=_['keys'](_0x1677e7[_0x7da7('0x30')]);_0x1e5901[_0x7da7('0x31')]=_[_0x7da7('0x32')](_0x1e5901[_0x7da7('0x2e')],_0x1e5901['query']);_0x14643c['attributes']=_[_0x7da7('0x32')](_0x1e5901[_0x7da7('0x2e')],qs[_0x7da7('0x33')](_0x1677e7['query']['fields']));_0x14643c['attributes']=_0x14643c[_0x7da7('0x34')][_0x7da7('0x35')]?_0x14643c[_0x7da7('0x34')]:_0x1e5901['model'];if(!_0x1677e7['query']['hasOwnProperty']('nolimit')){_0x14643c['limit']=qs[_0x7da7('0x1c')](_0x1677e7[_0x7da7('0x30')][_0x7da7('0x1c')]);_0x14643c[_0x7da7('0x1a')]=qs[_0x7da7('0x1a')](_0x1677e7[_0x7da7('0x30')][_0x7da7('0x1a')]);}_0x14643c[_0x7da7('0x36')]=qs[_0x7da7('0x37')](_0x1677e7['query'][_0x7da7('0x37')]);_0x14643c[_0x7da7('0x38')]=qs[_0x7da7('0x31')](_['pick'](_0x1677e7[_0x7da7('0x30')],_0x1e5901['filters']),_0x3a9f9f);if(_0x1677e7[_0x7da7('0x30')]['filter']){_0x14643c['where']=_[_0x7da7('0x39')](_0x14643c[_0x7da7('0x38')],{'$or':_[_0x7da7('0x2f')](_0x3a9f9f,function(_0x568239){if(_0x568239[_0x7da7('0x3a')]!==_0x7da7('0x3b')){var _0x48d345={};_0x48d345[_0x568239[_0x7da7('0x29')]]={'$like':'%'+_0x1677e7[_0x7da7('0x30')]['filter']+'%'};return _0x48d345;}})});}_0x14643c=_[_0x7da7('0x39')]({},_0x14643c,_0x1677e7[_0x7da7('0x3c')]);var _0x5357a={'where':_0x14643c[_0x7da7('0x38')]};return db[_0x7da7('0x2b')][_0x7da7('0x3d')](_0x5357a)[_0x7da7('0x27')](function(_0x498e8c){_0x33e860['count']=_0x498e8c;if(_0x1677e7['query'][_0x7da7('0x3e')]){_0x14643c[_0x7da7('0x3f')]=[{'all':!![]}];}return db[_0x7da7('0x2b')][_0x7da7('0x40')](_0x14643c);})[_0x7da7('0x27')](function(_0x28ce87){_0x33e860[_0x7da7('0x41')]=_0x28ce87;return _0x33e860;})[_0x7da7('0x27')](respondWithFilteredResult(_0x42fbd2,_0x14643c))[_0x7da7('0x42')](handleError(_0x42fbd2,null));};exports[_0x7da7('0x43')]=function(_0x2f3d00,_0x4803c8){var _0xda7654={'raw':!![],'where':{'id':_0x2f3d00['params']['id']}},_0x361856={};_0x361856['model']=_[_0x7da7('0x44')](db[_0x7da7('0x2b')]['rawAttributes']);_0x361856[_0x7da7('0x30')]=_[_0x7da7('0x44')](_0x2f3d00['query']);_0x361856[_0x7da7('0x31')]=_['intersection'](_0x361856['model'],_0x361856['query']);_0xda7654[_0x7da7('0x34')]=_['intersection'](_0x361856[_0x7da7('0x2e')],qs[_0x7da7('0x33')](_0x2f3d00[_0x7da7('0x30')][_0x7da7('0x33')]));_0xda7654[_0x7da7('0x34')]=_0xda7654[_0x7da7('0x34')][_0x7da7('0x35')]?_0xda7654['attributes']:_0x361856['model'];if(_0x2f3d00[_0x7da7('0x30')][_0x7da7('0x3e')]){_0xda7654[_0x7da7('0x3f')]=[{'all':!![]}];}_0xda7654=_[_0x7da7('0x39')]({},_0xda7654,_0x2f3d00['options']);return db['SquareOdbc'][_0x7da7('0x45')](_0xda7654)[_0x7da7('0x27')](handleEntityNotFound(_0x4803c8,null))[_0x7da7('0x27')](respondWithResult(_0x4803c8,null))[_0x7da7('0x42')](handleError(_0x4803c8,null));};exports[_0x7da7('0x46')]=function(_0x9d36e8,_0xd626fb){return db[_0x7da7('0x2b')][_0x7da7('0x46')](_0x9d36e8[_0x7da7('0x47')],{})[_0x7da7('0x27')](function(_0x30f9e5){var _0x146fe4=_0x9d36e8[_0x7da7('0x48')][_0x7da7('0x24')]({'plain':!![]});if(!_0x146fe4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x146fe4[_0x7da7('0x49')]===_0x7da7('0x48')){var _0x211693=_0x30f9e5['get']({'plain':!![]});var _0x4c9691=_0x7da7('0x25');return db['UserProfileSection'][_0x7da7('0x45')]({'where':{'name':_0x4c9691,'userProfileId':_0x146fe4[_0x7da7('0x4a')]},'raw':!![]})[_0x7da7('0x27')](function(_0x5d5e8d){if(_0x5d5e8d&&_0x5d5e8d[_0x7da7('0x4b')]===0x0){return db['UserProfileResource'][_0x7da7('0x46')]({'name':_0x211693[_0x7da7('0x29')],'resourceId':_0x211693['id'],'type':_0x5d5e8d['name'],'sectionId':_0x5d5e8d['id']},{})[_0x7da7('0x27')](function(){return _0x30f9e5;});}else{return _0x30f9e5;}})[_0x7da7('0x42')](function(_0x2f1bec){logger[_0x7da7('0x28')](_0x7da7('0x4c'),_0x2f1bec);throw _0x2f1bec;});}return _0x30f9e5;})['then'](respondWithResult(_0xd626fb,0xc9))[_0x7da7('0x42')](handleError(_0xd626fb,null));};exports['update']=function(_0x462d3c,_0x418001){if(_0x462d3c[_0x7da7('0x47')]['id']){delete _0x462d3c['body']['id'];}return db[_0x7da7('0x2b')][_0x7da7('0x45')]({'where':{'id':_0x462d3c[_0x7da7('0x4d')]['id']}})[_0x7da7('0x27')](handleEntityNotFound(_0x418001,null))[_0x7da7('0x27')](saveUpdates(_0x462d3c[_0x7da7('0x47')],null))[_0x7da7('0x27')](respondWithResult(_0x418001,null))[_0x7da7('0x42')](handleError(_0x418001,null));};exports['destroy']=function(_0x2aacd8,_0x33cb65){return db[_0x7da7('0x2b')][_0x7da7('0x45')]({'where':{'id':_0x2aacd8[_0x7da7('0x4d')]['id']}})[_0x7da7('0x27')](handleEntityNotFound(_0x33cb65,null))[_0x7da7('0x27')](removeEntity(_0x33cb65,null))[_0x7da7('0x42')](handleError(_0x33cb65,null));};exports[_0x7da7('0x4e')]=function(_0x33fa28,_0x4f9a0b,_0x6b6902){var _0x2c1401;return db[_0x7da7('0x2b')][_0x7da7('0x45')]({'where':{'id':_0x33fa28['params']['id']},'attributes':['id',_0x7da7('0x4f')]})[_0x7da7('0x27')](handleEntityNotFound(_0x4f9a0b,null))[_0x7da7('0x27')](function(_0x23f4ee){if(_0x23f4ee){var _0x4fb241=require(_0x7da7('0x50'))();_0x4fb241['openSync'](_0x23f4ee[_0x7da7('0x4f')]);_0x4fb241[_0x7da7('0x51')]();return _0x23f4ee;}})[_0x7da7('0x27')](respondWithResult(_0x4f9a0b,null))[_0x7da7('0x42')](handleError(_0x4f9a0b,null));}; \ No newline at end of file +var _0xa5b0=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','keys','rawAttributes','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x5553b3,_0x337912){var _0x52d9a3=function(_0x4d4b56){while(--_0x4d4b56){_0x5553b3['push'](_0x5553b3['shift']());}};_0x52d9a3(++_0x337912);}(_0xa5b0,0xf7));var _0x0a5b=function(_0x540041,_0x388ca0){_0x540041=_0x540041-0x0;var _0x5a4898=_0xa5b0[_0x540041];return _0x5a4898;};'use strict';var emlformat=require(_0x0a5b('0x0'));var rimraf=require(_0x0a5b('0x1'));var zipdir=require(_0x0a5b('0x2'));var jsonpatch=require(_0x0a5b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a5b('0x4'));var Mustache=require('mustache');var util=require(_0x0a5b('0x5'));var path=require('path');var sox=require(_0x0a5b('0x6'));var csv=require(_0x0a5b('0x7'));var ejs=require(_0x0a5b('0x8'));var fs=require('fs');var fs_extra=require(_0x0a5b('0x9'));var _=require(_0x0a5b('0xa'));var squel=require(_0x0a5b('0xb'));var crypto=require(_0x0a5b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0a5b('0x7'));var querystring=require(_0x0a5b('0xd'));var Papa=require(_0x0a5b('0xe'));var Redis=require('ioredis');var authService=require(_0x0a5b('0xf'));var qs=require(_0x0a5b('0x10'));var as=require(_0x0a5b('0x11'));var hardwareService=require(_0x0a5b('0x12'));var logger=require(_0x0a5b('0x13'))(_0x0a5b('0x14'));var utils=require(_0x0a5b('0x15'));var config=require(_0x0a5b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6a71,_0x49be80){_0x49be80=_0x49be80||0xcc;return function(_0xcc1c88){if(_0xcc1c88){return _0x2e6a71[_0x0a5b('0x17')](_0x49be80);}return _0x2e6a71['status'](_0x49be80)[_0x0a5b('0x18')]();};}function respondWithResult(_0xb7a801,_0x12bd5d){_0x12bd5d=_0x12bd5d||0xc8;return function(_0xf82cf){if(_0xf82cf){return _0xb7a801[_0x0a5b('0x19')](_0x12bd5d)[_0x0a5b('0x1a')](_0xf82cf);}};}function respondWithFilteredResult(_0x411f56,_0x41e055){return function(_0x433f22){if(_0x433f22){var _0x304b24=typeof _0x41e055[_0x0a5b('0x1b')]===_0x0a5b('0x1c')&&typeof _0x41e055[_0x0a5b('0x1d')]==='undefined';var _0x496708=_0x433f22[_0x0a5b('0x1e')];var _0x333074=_0x304b24?0x0:_0x41e055[_0x0a5b('0x1b')];var _0x3c50fa=_0x304b24?_0x433f22[_0x0a5b('0x1e')]:_0x41e055[_0x0a5b('0x1b')]+_0x41e055['limit'];var _0x104f95;if(_0x3c50fa>=_0x496708){_0x3c50fa=_0x496708;_0x104f95=0xc8;}else{_0x104f95=0xce;}_0x411f56[_0x0a5b('0x19')](_0x104f95);return _0x411f56[_0x0a5b('0x1f')]('Content-Range',_0x333074+'-'+_0x3c50fa+'/'+_0x496708)[_0x0a5b('0x1a')](_0x433f22);}return null;};}function patchUpdates(_0x585c66){return function(_0x23fb2f){try{jsonpatch[_0x0a5b('0x20')](_0x23fb2f,_0x585c66,!![]);}catch(_0x5d2c26){return BPromise[_0x0a5b('0x21')](_0x5d2c26);}return _0x23fb2f[_0x0a5b('0x22')]();};}function saveUpdates(_0x2d5bd7,_0x24794e){return function(_0x55af61){if(_0x55af61){return _0x55af61[_0x0a5b('0x23')](_0x2d5bd7)['then'](function(_0x5a2d76){return _0x5a2d76;});}return null;};}function removeEntity(_0x19f29c,_0x30827e){return function(_0xd25313){if(_0xd25313){return _0xd25313['destroy']()[_0x0a5b('0x24')](function(){var _0x1b3112=_0xd25313[_0x0a5b('0x25')]({'plain':!![]});var _0x3b519d=_0x0a5b('0x26');return db[_0x0a5b('0x27')][_0x0a5b('0x28')]({'where':{'type':_0x3b519d,'resourceId':_0x1b3112['id']}})[_0x0a5b('0x24')](function(){return _0xd25313;});})['then'](function(){_0x19f29c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5122ba,_0x4839ce){return function(_0x4ceb23){if(!_0x4ceb23){_0x5122ba[_0x0a5b('0x17')](0x194);}return _0x4ceb23;};}function handleError(_0x987a9e,_0x20872b){_0x20872b=_0x20872b||0x1f4;return function(_0x4c98d9){logger[_0x0a5b('0x29')](_0x4c98d9['stack']);if(_0x4c98d9[_0x0a5b('0x2a')]){delete _0x4c98d9[_0x0a5b('0x2a')];}_0x987a9e[_0x0a5b('0x19')](_0x20872b)[_0x0a5b('0x2b')](_0x4c98d9);};}exports[_0x0a5b('0x2c')]=function(_0x7d3a88,_0x346d32){var _0x1afe43={},_0x257461={},_0x569263={'count':0x0,'rows':[]};var _0x33bc52=_[_0x0a5b('0x2d')](db[_0x0a5b('0x2e')]['rawAttributes'],function(_0x528cb3){return{'name':_0x528cb3['fieldName'],'type':_0x528cb3['type']['key']};});_0x257461[_0x0a5b('0x2f')]=_[_0x0a5b('0x2d')](_0x33bc52,_0x0a5b('0x2a'));_0x257461[_0x0a5b('0x30')]=_['keys'](_0x7d3a88[_0x0a5b('0x30')]);_0x257461[_0x0a5b('0x31')]=_['intersection'](_0x257461['model'],_0x257461[_0x0a5b('0x30')]);_0x1afe43[_0x0a5b('0x32')]=_[_0x0a5b('0x33')](_0x257461[_0x0a5b('0x2f')],qs[_0x0a5b('0x34')](_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x34')]));_0x1afe43[_0x0a5b('0x32')]=_0x1afe43[_0x0a5b('0x32')][_0x0a5b('0x35')]?_0x1afe43[_0x0a5b('0x32')]:_0x257461['model'];if(!_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x36')](_0x0a5b('0x37'))){_0x1afe43[_0x0a5b('0x1d')]=qs[_0x0a5b('0x1d')](_0x7d3a88[_0x0a5b('0x30')]['limit']);_0x1afe43[_0x0a5b('0x1b')]=qs[_0x0a5b('0x1b')](_0x7d3a88['query']['offset']);}_0x1afe43[_0x0a5b('0x38')]=qs['sort'](_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x39')]);_0x1afe43[_0x0a5b('0x3a')]=qs['filters'](_['pick'](_0x7d3a88[_0x0a5b('0x30')],_0x257461[_0x0a5b('0x31')]),_0x33bc52);if(_0x7d3a88['query']['filter']){_0x1afe43['where']=_[_0x0a5b('0x3b')](_0x1afe43['where'],{'$or':_[_0x0a5b('0x2d')](_0x33bc52,function(_0x1d2da9){if(_0x1d2da9['type']!==_0x0a5b('0x3c')){var _0x4fd0ac={};_0x4fd0ac[_0x1d2da9['name']]={'$like':'%'+_0x7d3a88[_0x0a5b('0x30')][_0x0a5b('0x3d')]+'%'};return _0x4fd0ac;}})});}_0x1afe43=_[_0x0a5b('0x3b')]({},_0x1afe43,_0x7d3a88[_0x0a5b('0x3e')]);var _0x44a5b2={'where':_0x1afe43[_0x0a5b('0x3a')]};return db['SquareOdbc'][_0x0a5b('0x1e')](_0x44a5b2)[_0x0a5b('0x24')](function(_0x3b9834){_0x569263[_0x0a5b('0x1e')]=_0x3b9834;if(_0x7d3a88['query'][_0x0a5b('0x3f')]){_0x1afe43['include']=[{'all':!![]}];}return db[_0x0a5b('0x2e')][_0x0a5b('0x40')](_0x1afe43);})[_0x0a5b('0x24')](function(_0x22ac66){_0x569263['rows']=_0x22ac66;return _0x569263;})['then'](respondWithFilteredResult(_0x346d32,_0x1afe43))['catch'](handleError(_0x346d32,null));};exports[_0x0a5b('0x41')]=function(_0x4eb0db,_0xcca97d){var _0x3593a7={'raw':!![],'where':{'id':_0x4eb0db['params']['id']}},_0x1c0269={};_0x1c0269[_0x0a5b('0x2f')]=_[_0x0a5b('0x42')](db[_0x0a5b('0x2e')][_0x0a5b('0x43')]);_0x1c0269[_0x0a5b('0x30')]=_['keys'](_0x4eb0db['query']);_0x1c0269[_0x0a5b('0x31')]=_['intersection'](_0x1c0269[_0x0a5b('0x2f')],_0x1c0269[_0x0a5b('0x30')]);_0x3593a7[_0x0a5b('0x32')]=_['intersection'](_0x1c0269[_0x0a5b('0x2f')],qs[_0x0a5b('0x34')](_0x4eb0db[_0x0a5b('0x30')][_0x0a5b('0x34')]));_0x3593a7[_0x0a5b('0x32')]=_0x3593a7[_0x0a5b('0x32')][_0x0a5b('0x35')]?_0x3593a7[_0x0a5b('0x32')]:_0x1c0269[_0x0a5b('0x2f')];if(_0x4eb0db[_0x0a5b('0x30')][_0x0a5b('0x3f')]){_0x3593a7[_0x0a5b('0x44')]=[{'all':!![]}];}_0x3593a7=_[_0x0a5b('0x3b')]({},_0x3593a7,_0x4eb0db[_0x0a5b('0x3e')]);return db[_0x0a5b('0x2e')][_0x0a5b('0x45')](_0x3593a7)[_0x0a5b('0x24')](handleEntityNotFound(_0xcca97d,null))[_0x0a5b('0x24')](respondWithResult(_0xcca97d,null))[_0x0a5b('0x46')](handleError(_0xcca97d,null));};exports['create']=function(_0x1ec45a,_0x38ed3d){return db['SquareOdbc']['create'](_0x1ec45a[_0x0a5b('0x47')],{})[_0x0a5b('0x24')](function(_0x45bcdf){var _0x72981e=_0x1ec45a[_0x0a5b('0x48')][_0x0a5b('0x25')]({'plain':!![]});if(!_0x72981e)throw new Error(_0x0a5b('0x49'));if(_0x72981e[_0x0a5b('0x4a')]===_0x0a5b('0x48')){var _0x5a4966=_0x45bcdf['get']({'plain':!![]});var _0x545758=_0x0a5b('0x26');return db[_0x0a5b('0x4b')]['find']({'where':{'name':_0x545758,'userProfileId':_0x72981e[_0x0a5b('0x4c')]},'raw':!![]})[_0x0a5b('0x24')](function(_0x3bb90e){if(_0x3bb90e&&_0x3bb90e['autoAssociation']===0x0){return db[_0x0a5b('0x27')][_0x0a5b('0x4d')]({'name':_0x5a4966[_0x0a5b('0x2a')],'resourceId':_0x5a4966['id'],'type':_0x3bb90e[_0x0a5b('0x2a')],'sectionId':_0x3bb90e['id']},{})[_0x0a5b('0x24')](function(){return _0x45bcdf;});}else{return _0x45bcdf;}})[_0x0a5b('0x46')](function(_0xc00d78){logger[_0x0a5b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc00d78);throw _0xc00d78;});}return _0x45bcdf;})[_0x0a5b('0x24')](respondWithResult(_0x38ed3d,0xc9))[_0x0a5b('0x46')](handleError(_0x38ed3d,null));};exports['update']=function(_0x3638ae,_0x4c1603){if(_0x3638ae[_0x0a5b('0x47')]['id']){delete _0x3638ae[_0x0a5b('0x47')]['id'];}return db[_0x0a5b('0x2e')][_0x0a5b('0x45')]({'where':{'id':_0x3638ae['params']['id']}})[_0x0a5b('0x24')](handleEntityNotFound(_0x4c1603,null))[_0x0a5b('0x24')](saveUpdates(_0x3638ae[_0x0a5b('0x47')],null))[_0x0a5b('0x24')](respondWithResult(_0x4c1603,null))['catch'](handleError(_0x4c1603,null));};exports[_0x0a5b('0x28')]=function(_0x4829a0,_0x2f3d2e){return db[_0x0a5b('0x2e')][_0x0a5b('0x45')]({'where':{'id':_0x4829a0[_0x0a5b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2f3d2e,null))[_0x0a5b('0x24')](removeEntity(_0x2f3d2e,null))[_0x0a5b('0x46')](handleError(_0x2f3d2e,null));};exports[_0x0a5b('0x4f')]=function(_0x5b86ff,_0x179da4,_0x229f2f){var _0x4c0662;return db[_0x0a5b('0x2e')][_0x0a5b('0x45')]({'where':{'id':_0x5b86ff[_0x0a5b('0x4e')]['id']},'attributes':['id',_0x0a5b('0x50')]})[_0x0a5b('0x24')](handleEntityNotFound(_0x179da4,null))['then'](function(_0x4312de){if(_0x4312de){var _0x5a22b6=require(_0x0a5b('0x51'))();_0x5a22b6[_0x0a5b('0x52')](_0x4312de['dsn']);_0x5a22b6[_0x0a5b('0x53')]();return _0x4312de;}})[_0x0a5b('0x24')](respondWithResult(_0x179da4,null))['catch'](handleError(_0x179da4,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0e8544b..4dcc226 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 _0x3ca4=['api','request-promise','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger'];(function(_0x41e2af,_0x3662f8){var _0x41df19=function(_0x3b307e){while(--_0x3b307e){_0x41e2af['push'](_0x41e2af['shift']());}};_0x41df19(++_0x3662f8);}(_0x3ca4,0x73));var _0x43ca=function(_0x390256,_0x1f9ae8){_0x390256=_0x390256-0x0;var _0x1548ce=_0x3ca4[_0x390256];return _0x1548ce;};'use strict';var _=require('lodash');var util=require(_0x43ca('0x0'));var logger=require(_0x43ca('0x1'))(_0x43ca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x43ca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x43ca('0x4'));module[_0x43ca('0x5')]=function(_0x39a6b3,_0x39c20d){return _0x39a6b3[_0x43ca('0x6')](_0x43ca('0x7'),attributes,{'tableName':_0x43ca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2e6=['exports','square_odbc','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2e6,0x70));var _0x6d2e=function(_0x411a91,_0x32b137){_0x411a91=_0x411a91-0x0;var _0x4446c5=_0xd2e6[_0x411a91];return _0x4446c5;};'use strict';var _=require('lodash');var util=require(_0x6d2e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6d2e('0x1'));var BPromise=require(_0x6d2e('0x2'));var rp=require(_0x6d2e('0x3'));var fs=require('fs');var path=require(_0x6d2e('0x4'));var rimraf=require(_0x6d2e('0x5'));var config=require(_0x6d2e('0x6'));var attributes=require(_0x6d2e('0x7'));module[_0x6d2e('0x8')]=function(_0x28e18a,_0x493018){return _0x28e18a['define']('SquareOdbc',attributes,{'tableName':_0x6d2e('0x9'),'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 f9ae608..5085fdb 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 _0xaa6c=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','ShowSquareOdbc','options','raw','where','attributes','include','map','model','lodash','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xaa6c,0x19e));var _0xcaa6=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xaa6c[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xcaa6('0x0'));var util=require(_0xcaa6('0x1'));var moment=require(_0xcaa6('0x2'));var BPromise=require(_0xcaa6('0x3'));var rs=require(_0xcaa6('0x4'));var fs=require('fs');var Redis=require(_0xcaa6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaa6('0x6'));var logger=require(_0xcaa6('0x7'))('rpc');var config=require(_0xcaa6('0x8'));var jayson=require(_0xcaa6('0x9'));var client=jayson[_0xcaa6('0xa')][_0xcaa6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5412b3,_0x13d5bc,_0x55abd5){return new BPromise(function(_0x476132,_0x533411){return client[_0xcaa6('0xc')](_0x5412b3,_0x55abd5)[_0xcaa6('0xd')](function(_0x51716b){logger['info'](_0xcaa6('0xe'),_0x13d5bc,_0xcaa6('0xf'));logger[_0xcaa6('0x10')](_0xcaa6('0x11'),_0x13d5bc,_0xcaa6('0xf'),JSON['stringify'](_0x51716b));if(_0x51716b['error']){if(_0x51716b['error'][_0xcaa6('0x12')]===0x1f4){logger[_0xcaa6('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x13d5bc,_0x51716b['error'][_0xcaa6('0x14')]);return _0x533411(_0x51716b['error'][_0xcaa6('0x14')]);}logger[_0xcaa6('0x13')](_0xcaa6('0xe'),_0x13d5bc,_0x51716b[_0xcaa6('0x13')][_0xcaa6('0x14')]);return _0x476132(_0x51716b[_0xcaa6('0x13')][_0xcaa6('0x14')]);}else{logger[_0xcaa6('0x15')](_0xcaa6('0xe'),_0x13d5bc,_0xcaa6('0xf'));_0x476132(_0x51716b[_0xcaa6('0x16')][_0xcaa6('0x14')]);}})[_0xcaa6('0x17')](function(_0x44e384){logger[_0xcaa6('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x13d5bc,_0x44e384);_0x533411(_0x44e384);});});}exports[_0xcaa6('0x18')]=function(_0x171a3f){var _0x2f4070=this;return new Promise(function(_0x25c8e2,_0x5223ab){return db['SquareOdbc']['find']({'raw':_0x171a3f['options']?_0x171a3f[_0xcaa6('0x19')][_0xcaa6('0x1a')]===undefined?!![]:![]:!![],'where':_0x171a3f[_0xcaa6('0x19')]?_0x171a3f[_0xcaa6('0x19')][_0xcaa6('0x1b')]||null:null,'attributes':_0x171a3f[_0xcaa6('0x19')]?_0x171a3f[_0xcaa6('0x19')][_0xcaa6('0x1c')]||null:null,'include':_0x171a3f['options']?_0x171a3f[_0xcaa6('0x19')][_0xcaa6('0x1d')]?_[_0xcaa6('0x1e')](_0x171a3f[_0xcaa6('0x19')][_0xcaa6('0x1d')],function(_0x5d60fd){return{'model':db[_0x5d60fd[_0xcaa6('0x1f')]],'as':_0x5d60fd['as'],'attributes':_0x5d60fd[_0xcaa6('0x1c')],'include':_0x5d60fd['include']?_[_0xcaa6('0x1e')](_0x5d60fd[_0xcaa6('0x1d')],function(_0x5d361a){return{'model':db[_0x5d361a[_0xcaa6('0x1f')]],'as':_0x5d361a['as'],'attributes':_0x5d361a[_0xcaa6('0x1c')],'include':_0x5d361a[_0xcaa6('0x1d')]?_[_0xcaa6('0x1e')](_0x5d361a['include'],function(_0x1f3a14){return{'model':db[_0x1f3a14[_0xcaa6('0x1f')]],'as':_0x1f3a14['as'],'attributes':_0x1f3a14[_0xcaa6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcaa6('0xd')](function(_0xf3acbf){logger['info']('ShowSquareOdbc',_0x171a3f);logger[_0xcaa6('0x10')](_0xcaa6('0x18'),_0x171a3f,JSON['stringify'](_0xf3acbf));_0x25c8e2(_0xf3acbf);})[_0xcaa6('0x17')](function(_0x5acd18){logger[_0xcaa6('0x13')](_0xcaa6('0x18'),_0x5acd18[_0xcaa6('0x14')],_0x171a3f);_0x5223ab(_0x2f4070[_0xcaa6('0x13')](0x1f4,_0x5acd18[_0xcaa6('0x14')]));});});}; \ No newline at end of file +var _0x36f7=['attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model'];(function(_0x50b955,_0x4600e){var _0x28241b=function(_0x4cd2d6){while(--_0x4cd2d6){_0x50b955['push'](_0x50b955['shift']());}};_0x28241b(++_0x4600e);}(_0x36f7,0x1e1));var _0x736f=function(_0x5c8391,_0x197b5b){_0x5c8391=_0x5c8391-0x0;var _0xbf46e7=_0x36f7[_0x5c8391];return _0xbf46e7;};'use strict';var _=require(_0x736f('0x0'));var util=require(_0x736f('0x1'));var moment=require(_0x736f('0x2'));var BPromise=require(_0x736f('0x3'));var rs=require(_0x736f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x736f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x736f('0x6'))(_0x736f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x736f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0ca0,_0x4ad2ba,_0x48b811){return new BPromise(function(_0x244fce,_0x747d6d){return client[_0x736f('0x9')](_0x3a0ca0,_0x48b811)[_0x736f('0xa')](function(_0x17be10){logger[_0x736f('0xb')](_0x736f('0xc'),_0x4ad2ba,_0x736f('0xd'));logger[_0x736f('0xe')](_0x736f('0xf'),_0x4ad2ba,_0x736f('0xd'),JSON[_0x736f('0x10')](_0x17be10));if(_0x17be10[_0x736f('0x11')]){if(_0x17be10['error'][_0x736f('0x12')]===0x1f4){logger[_0x736f('0x11')](_0x736f('0xc'),_0x4ad2ba,_0x17be10['error']['message']);return _0x747d6d(_0x17be10['error']['message']);}logger['error'](_0x736f('0xc'),_0x4ad2ba,_0x17be10[_0x736f('0x11')][_0x736f('0x13')]);return _0x244fce(_0x17be10['error']['message']);}else{logger[_0x736f('0xb')](_0x736f('0xc'),_0x4ad2ba,_0x736f('0xd'));_0x244fce(_0x17be10[_0x736f('0x14')][_0x736f('0x13')]);}})[_0x736f('0x15')](function(_0xd2a632){logger['error'](_0x736f('0xc'),_0x4ad2ba,_0xd2a632);_0x747d6d(_0xd2a632);});});}exports[_0x736f('0x16')]=function(_0x2a9e39){var _0x322da7=this;return new Promise(function(_0x44f45f,_0x38636f){return db[_0x736f('0x17')][_0x736f('0x18')]({'raw':_0x2a9e39[_0x736f('0x19')]?_0x2a9e39[_0x736f('0x19')][_0x736f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a9e39['options']?_0x2a9e39['options'][_0x736f('0x1b')]||null:null,'attributes':_0x2a9e39[_0x736f('0x19')]?_0x2a9e39[_0x736f('0x19')]['attributes']||null:null,'include':_0x2a9e39[_0x736f('0x19')]?_0x2a9e39[_0x736f('0x19')][_0x736f('0x1c')]?_[_0x736f('0x1d')](_0x2a9e39['options'][_0x736f('0x1c')],function(_0x869fab){return{'model':db[_0x869fab[_0x736f('0x1e')]],'as':_0x869fab['as'],'attributes':_0x869fab[_0x736f('0x1f')],'include':_0x869fab['include']?_[_0x736f('0x1d')](_0x869fab[_0x736f('0x1c')],function(_0x1b5c89){return{'model':db[_0x1b5c89[_0x736f('0x1e')]],'as':_0x1b5c89['as'],'attributes':_0x1b5c89[_0x736f('0x1f')],'include':_0x1b5c89[_0x736f('0x1c')]?_[_0x736f('0x1d')](_0x1b5c89[_0x736f('0x1c')],function(_0x3f6cf4){return{'model':db[_0x3f6cf4['model']],'as':_0x3f6cf4['as'],'attributes':_0x3f6cf4[_0x736f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x736f('0xa')](function(_0xc70cc9){logger[_0x736f('0xb')](_0x736f('0x16'),_0x2a9e39);logger[_0x736f('0xe')](_0x736f('0x16'),_0x2a9e39,JSON[_0x736f('0x10')](_0xc70cc9));_0x44f45f(_0xc70cc9);})[_0x736f('0x15')](function(_0x4df553){logger[_0x736f('0x11')](_0x736f('0x16'),_0x4df553[_0x736f('0x13')],_0x2a9e39);_0x38636f(_0x322da7['error'](0x1f4,_0x4df553['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3ddb6bd..12a5626 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 _0x7cfa=['/:id/users','post','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x7cfa,0x137));var _0xa7cf=function(_0x5b7261,_0x3924bf){_0x5b7261=_0x5b7261-0x0;var _0x4950b7=_0x7cfa[_0x5b7261];return _0x4950b7;};'use strict';var multer=require(_0xa7cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa7cf('0x1'));var express=require(_0xa7cf('0x2'));var router=express[_0xa7cf('0x3')]();var fs_extra=require(_0xa7cf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa7cf('0x5'));var config=require('../../config/environment');var controller=require(_0xa7cf('0x6'));router[_0xa7cf('0x7')]('/',auth[_0xa7cf('0x8')](),controller[_0xa7cf('0x9')]);router[_0xa7cf('0x7')](_0xa7cf('0xa'),auth[_0xa7cf('0x8')](),controller[_0xa7cf('0xb')]);router[_0xa7cf('0x7')](_0xa7cf('0xc'),auth[_0xa7cf('0x8')](),controller['getUsers']);router[_0xa7cf('0xd')]('/',auth[_0xa7cf('0x8')](),controller['create']);router[_0xa7cf('0xd')](_0xa7cf('0xc'),auth[_0xa7cf('0x8')](),controller['addUsers']);router['put'](_0xa7cf('0xa'),auth[_0xa7cf('0x8')](),controller[_0xa7cf('0xe')]);router['delete'](_0xa7cf('0xa'),auth['isAuthenticated'](),controller[_0xa7cf('0xf')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeUsers']);module[_0xa7cf('0x10')]=router; \ No newline at end of file +var _0xcdc2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','/:id/users','addUsers','put','/:id','destroy','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x45a04b,_0x5d5fa6){_0x45a04b=_0x45a04b-0x0;var _0x275bc6=_0xcdc2[_0x45a04b];return _0x275bc6;};'use strict';var multer=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var path=require(_0x2cdc('0x2'));var timeout=require(_0x2cdc('0x3'));var express=require(_0x2cdc('0x4'));var router=express[_0x2cdc('0x5')]();var fs_extra=require(_0x2cdc('0x6'));var auth=require(_0x2cdc('0x7'));var interaction=require(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var controller=require(_0x2cdc('0xa'));router[_0x2cdc('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2cdc('0xb')]('/:id',auth[_0x2cdc('0xc')](),controller[_0x2cdc('0xd')]);router[_0x2cdc('0xb')]('/:id/users',auth[_0x2cdc('0xc')](),controller['getUsers']);router['post']('/',auth[_0x2cdc('0xc')](),controller['create']);router['post'](_0x2cdc('0xe'),auth['isAuthenticated'](),controller[_0x2cdc('0xf')]);router[_0x2cdc('0x10')](_0x2cdc('0x11'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2cdc('0x12')]);router[_0x2cdc('0x13')](_0x2cdc('0xe'),auth[_0x2cdc('0xc')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 42fff2e..09c70e5 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 _0x61c0=['preproduction','utf8','production','DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x3f44f9,_0xba54c7){var _0x1e78d8=function(_0x1f3046){while(--_0x1f3046){_0x3f44f9['push'](_0x3f44f9['shift']());}};_0x1e78d8(++_0xba54c7);}(_0x61c0,0x1b1));var _0x061c=function(_0x33f260,_0x157b6b){_0x33f260=_0x33f260-0x0;var _0x5793be=_0x61c0[_0x33f260];return _0x5793be;};'use strict';var Sequelize=require(_0x061c('0x0'));module['exports']={'name':{'type':Sequelize[_0x061c('0x1')],'unique':_0x061c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x061c('0x1')]},'notes':{'type':Sequelize[_0x061c('0x3')]},'preproduction':{'type':Sequelize[_0x061c('0x4')](_0x061c('0x5')),'get':function(){if(this[_0x061c('0x6')](_0x061c('0x7'))){return this['getDataValue'](_0x061c('0x7'))['toString'](_0x061c('0x8'));}}},'production':{'type':Sequelize[_0x061c('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x061c('0x9'))){return this[_0x061c('0x6')](_0x061c('0x9'))['toString'](_0x061c('0x8'));}}},'savedAt':{'type':Sequelize[_0x061c('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xba34=['preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','name','getDataValue'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xba34,0x119));var _0x4ba3=function(_0x35d2b3,_0x283554){_0x35d2b3=_0x35d2b3-0x0;var _0x2f6f9b=_0xba34[_0x35d2b3];return _0x2f6f9b;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'name':{'type':Sequelize[_0x4ba3('0x2')],'unique':_0x4ba3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4ba3('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x4ba3('0x4')](_0x4ba3('0x5'))){return this[_0x4ba3('0x4')](_0x4ba3('0x5'))[_0x4ba3('0x6')](_0x4ba3('0x7'));}}},'production':{'type':Sequelize[_0x4ba3('0x8')]('long'),'get':function(){if(this[_0x4ba3('0x4')](_0x4ba3('0x9'))){return this[_0x4ba3('0x4')](_0x4ba3('0x9'))[_0x4ba3('0x6')](_0x4ba3('0x7'));}}},'savedAt':{'type':Sequelize[_0x4ba3('0xa')]},'publishedAt':{'type':Sequelize[_0x4ba3('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b256e6a..703640d 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 _0x97b3=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','ids','omit','removeUsers','isArray','getUsers','findOne','User','pick','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','SquareProjects','UserProfileResource','destroy','error','stack','name','send','index','SquareProject','fieldName','key','model','map','query'];(function(_0x244604,_0x3b8e5f){var _0x1a51b8=function(_0x4fe875){while(--_0x4fe875){_0x244604['push'](_0x244604['shift']());}};_0x1a51b8(++_0x3b8e5f);}(_0x97b3,0x152));var _0x397b=function(_0x50a44b,_0x2bea0a){_0x50a44b=_0x50a44b-0x0;var _0x372b56=_0x97b3[_0x50a44b];return _0x372b56;};'use strict';var emlformat=require(_0x397b('0x0'));var rimraf=require(_0x397b('0x1'));var zipdir=require(_0x397b('0x2'));var jsonpatch=require(_0x397b('0x3'));var rp=require(_0x397b('0x4'));var moment=require(_0x397b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x397b('0x6'));var util=require(_0x397b('0x7'));var path=require(_0x397b('0x8'));var sox=require('sox');var csv=require(_0x397b('0x9'));var ejs=require(_0x397b('0xa'));var fs=require('fs');var fs_extra=require(_0x397b('0xb'));var _=require(_0x397b('0xc'));var squel=require(_0x397b('0xd'));var crypto=require('crypto');var jsforce=require(_0x397b('0xe'));var deskjs=require(_0x397b('0xf'));var toCsv=require(_0x397b('0x9'));var querystring=require(_0x397b('0x10'));var Papa=require('papaparse');var Redis=require(_0x397b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x397b('0x12'));var hardwareService=require(_0x397b('0x13'));var logger=require('../../config/logger')(_0x397b('0x14'));var utils=require(_0x397b('0x15'));var config=require(_0x397b('0x16'));var licenseUtil=require(_0x397b('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x397b('0x18'),'port':0x18eb});var socket=require(_0x397b('0x19'))(new Redis(config[_0x397b('0x1a')]));require(_0x397b('0x1b'))[_0x397b('0x1c')](socket);function respondWithStatusCode(_0x467759,_0x36c60d){_0x36c60d=_0x36c60d||0xcc;return function(_0x26cf57){if(_0x26cf57){return _0x467759[_0x397b('0x1d')](_0x36c60d);}return _0x467759[_0x397b('0x1e')](_0x36c60d)[_0x397b('0x1f')]();};}function respondWithResult(_0x188bd0,_0x88b08b){_0x88b08b=_0x88b08b||0xc8;return function(_0x39e8c5){if(_0x39e8c5){return _0x188bd0[_0x397b('0x1e')](_0x88b08b)[_0x397b('0x20')](_0x39e8c5);}};}function respondWithFilteredResult(_0x27415b,_0x102c6b){return function(_0xacc776){if(_0xacc776){var _0x2dcb49=typeof _0x102c6b[_0x397b('0x21')]===_0x397b('0x22')&&typeof _0x102c6b[_0x397b('0x23')]==='undefined';var _0x14c7f3=_0xacc776[_0x397b('0x24')];var _0x11bdaf=_0x2dcb49?0x0:_0x102c6b[_0x397b('0x21')];var _0x3b3058=_0x2dcb49?_0xacc776[_0x397b('0x24')]:_0x102c6b['offset']+_0x102c6b[_0x397b('0x23')];var _0x1f0cea;if(_0x3b3058>=_0x14c7f3){_0x3b3058=_0x14c7f3;_0x1f0cea=0xc8;}else{_0x1f0cea=0xce;}_0x27415b[_0x397b('0x1e')](_0x1f0cea);return _0x27415b[_0x397b('0x25')](_0x397b('0x26'),_0x11bdaf+'-'+_0x3b3058+'/'+_0x14c7f3)[_0x397b('0x20')](_0xacc776);}return null;};}function patchUpdates(_0x3a8bb0){return function(_0x4e69ba){try{jsonpatch[_0x397b('0x27')](_0x4e69ba,_0x3a8bb0,!![]);}catch(_0x297e1e){return BPromise[_0x397b('0x28')](_0x297e1e);}return _0x4e69ba[_0x397b('0x29')]();};}function saveUpdates(_0x5c7ff6,_0xf4bd85){return function(_0x3ab75a){if(_0x3ab75a){return _0x3ab75a['update'](_0x5c7ff6)['then'](function(_0x2d0793){return _0x2d0793;});}return null;};}function removeEntity(_0x1b7bbf,_0x44a2ab){return function(_0x165d63){if(_0x165d63){return _0x165d63['destroy']()[_0x397b('0x2a')](function(){var _0x496aa9=_0x165d63[_0x397b('0x2b')]({'plain':!![]});var _0x5b3991=_0x397b('0x2c');return db[_0x397b('0x2d')][_0x397b('0x2e')]({'where':{'type':_0x5b3991,'resourceId':_0x496aa9['id']}})[_0x397b('0x2a')](function(){return _0x165d63;});})[_0x397b('0x2a')](function(){_0x1b7bbf[_0x397b('0x1e')](0xcc)[_0x397b('0x1f')]();});}};}function handleEntityNotFound(_0x4eb485,_0x216824){return function(_0x30fe69){if(!_0x30fe69){_0x4eb485[_0x397b('0x1d')](0x194);}return _0x30fe69;};}function handleError(_0x2c2c05,_0x1dfb8c){_0x1dfb8c=_0x1dfb8c||0x1f4;return function(_0x514610){logger[_0x397b('0x2f')](_0x514610[_0x397b('0x30')]);if(_0x514610[_0x397b('0x31')]){delete _0x514610[_0x397b('0x31')];}_0x2c2c05[_0x397b('0x1e')](_0x1dfb8c)[_0x397b('0x32')](_0x514610);};}exports[_0x397b('0x33')]=function(_0x3bd845,_0x4309ab){var _0x23fd59={},_0x24a130={},_0x2eb414={'count':0x0,'rows':[]};var _0x3ca7d0=_['map'](db[_0x397b('0x34')]['rawAttributes'],function(_0x39ba65){return{'name':_0x39ba65[_0x397b('0x35')],'type':_0x39ba65['type'][_0x397b('0x36')]};});_0x24a130[_0x397b('0x37')]=_[_0x397b('0x38')](_0x3ca7d0,_0x397b('0x31'));_0x24a130[_0x397b('0x39')]=_[_0x397b('0x3a')](_0x3bd845[_0x397b('0x39')]);_0x24a130[_0x397b('0x3b')]=_[_0x397b('0x3c')](_0x24a130['model'],_0x24a130[_0x397b('0x39')]);_0x23fd59[_0x397b('0x3d')]=_[_0x397b('0x3c')](_0x24a130[_0x397b('0x37')],qs['fields'](_0x3bd845[_0x397b('0x39')]['fields']));_0x23fd59[_0x397b('0x3d')]=_0x23fd59[_0x397b('0x3d')][_0x397b('0x3e')]?_0x23fd59[_0x397b('0x3d')]:_0x24a130[_0x397b('0x37')];if(!_0x3bd845[_0x397b('0x39')][_0x397b('0x3f')](_0x397b('0x40'))){_0x23fd59[_0x397b('0x23')]=qs[_0x397b('0x23')](_0x3bd845[_0x397b('0x39')][_0x397b('0x23')]);_0x23fd59['offset']=qs['offset'](_0x3bd845[_0x397b('0x39')][_0x397b('0x21')]);}_0x23fd59[_0x397b('0x41')]=qs[_0x397b('0x42')](_0x3bd845['query'][_0x397b('0x42')]);_0x23fd59['where']=qs['filters'](_['pick'](_0x3bd845[_0x397b('0x39')],_0x24a130[_0x397b('0x3b')]),_0x3ca7d0);if(_0x3bd845[_0x397b('0x39')]['filter']){_0x23fd59[_0x397b('0x43')]=_[_0x397b('0x44')](_0x23fd59[_0x397b('0x43')],{'$or':_['map'](_0x3ca7d0,function(_0x190b5a){if(_0x190b5a[_0x397b('0x45')]!=='VIRTUAL'){var _0x210d54={};_0x210d54[_0x190b5a[_0x397b('0x31')]]={'$like':'%'+_0x3bd845[_0x397b('0x39')]['filter']+'%'};return _0x210d54;}})});}_0x23fd59=_[_0x397b('0x44')]({},_0x23fd59,_0x3bd845[_0x397b('0x46')]);var _0x3a9530={'where':_0x23fd59[_0x397b('0x43')]};return db['SquareProject'][_0x397b('0x24')](_0x3a9530)[_0x397b('0x2a')](function(_0xc895b3){_0x2eb414[_0x397b('0x24')]=_0xc895b3;if(_0x3bd845[_0x397b('0x39')][_0x397b('0x47')]){_0x23fd59[_0x397b('0x48')]=[{'all':!![]}];}return db[_0x397b('0x34')][_0x397b('0x49')](_0x23fd59);})[_0x397b('0x2a')](function(_0x11e26c){_0x2eb414['rows']=_0x11e26c;return _0x2eb414;})[_0x397b('0x2a')](respondWithFilteredResult(_0x4309ab,_0x23fd59))[_0x397b('0x4a')](handleError(_0x4309ab,null));};exports[_0x397b('0x4b')]=function(_0xa77668,_0x2bbcb3){var _0x3d5506={'raw':![],'where':{'id':_0xa77668[_0x397b('0x4c')]['id']}},_0x376c40={};_0x376c40[_0x397b('0x37')]=_[_0x397b('0x3a')](db[_0x397b('0x34')][_0x397b('0x4d')]);_0x376c40['query']=_[_0x397b('0x3a')](_0xa77668['query']);_0x376c40[_0x397b('0x3b')]=_[_0x397b('0x3c')](_0x376c40[_0x397b('0x37')],_0x376c40[_0x397b('0x39')]);_0x3d5506['attributes']=_['intersection'](_0x376c40['model'],qs[_0x397b('0x4e')](_0xa77668[_0x397b('0x39')][_0x397b('0x4e')]));_0x3d5506['attributes']=_0x3d5506[_0x397b('0x3d')][_0x397b('0x3e')]?_0x3d5506[_0x397b('0x3d')]:_0x376c40[_0x397b('0x37')];if(_0xa77668[_0x397b('0x39')][_0x397b('0x47')]){_0x3d5506[_0x397b('0x48')]=[{'all':!![]}];}_0x3d5506=_[_0x397b('0x44')]({},_0x3d5506,_0xa77668['options']);return db[_0x397b('0x34')][_0x397b('0x4f')](_0x3d5506)[_0x397b('0x2a')](handleEntityNotFound(_0x2bbcb3,null))[_0x397b('0x2a')](respondWithResult(_0x2bbcb3,null))['catch'](handleError(_0x2bbcb3,null));};exports['create']=function(_0x1d65c5,_0x40b0f8){return db[_0x397b('0x34')][_0x397b('0x50')](_0x1d65c5['body'],{})['then'](function(_0x28df97){var _0x555cdc=_0x1d65c5['user']['get']({'plain':!![]});if(!_0x555cdc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x555cdc[_0x397b('0x51')]===_0x397b('0x52')){var _0x1b8f9b=_0x28df97[_0x397b('0x2b')]({'plain':!![]});var _0x5d0c68='SquareProjects';return db[_0x397b('0x53')][_0x397b('0x4f')]({'where':{'name':_0x5d0c68,'userProfileId':_0x555cdc[_0x397b('0x54')]},'raw':!![]})['then'](function(_0x542f77){if(_0x542f77&&_0x542f77[_0x397b('0x55')]===0x0){return db[_0x397b('0x2d')][_0x397b('0x50')]({'name':_0x1b8f9b[_0x397b('0x31')],'resourceId':_0x1b8f9b['id'],'type':_0x542f77[_0x397b('0x31')],'sectionId':_0x542f77['id']},{})[_0x397b('0x2a')](function(){return _0x28df97;});}else{return _0x28df97;}})['catch'](function(_0xc07ff5){logger['error'](_0x397b('0x56'),_0xc07ff5);throw _0xc07ff5;});}return _0x28df97;})['then'](respondWithResult(_0x40b0f8,0xc9))[_0x397b('0x4a')](handleError(_0x40b0f8,null));};exports[_0x397b('0x57')]=function(_0x4ad05d,_0x29b9b4){if(_0x4ad05d['body']['id']){delete _0x4ad05d[_0x397b('0x58')]['id'];}return db[_0x397b('0x34')][_0x397b('0x4f')]({'where':{'id':_0x4ad05d[_0x397b('0x4c')]['id']}})[_0x397b('0x2a')](handleEntityNotFound(_0x29b9b4,null))[_0x397b('0x2a')](saveUpdates(_0x4ad05d['body'],null))['then'](respondWithResult(_0x29b9b4,null))['catch'](handleError(_0x29b9b4,null));};exports[_0x397b('0x2e')]=function(_0x40e648,_0x59f335){return db['SquareProject'][_0x397b('0x4f')]({'where':{'id':_0x40e648[_0x397b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59f335,null))['then'](removeEntity(_0x59f335,null))['catch'](handleError(_0x59f335,null));};exports[_0x397b('0x59')]=function(_0x25a9e3,_0x39073b,_0x41caa1){return db[_0x397b('0x34')][_0x397b('0x4f')]({'where':{'id':_0x25a9e3[_0x397b('0x4c')]['id']}})[_0x397b('0x2a')](handleEntityNotFound(_0x39073b,null))[_0x397b('0x2a')](function(_0x5f184e){if(_0x5f184e){return _0x5f184e[_0x397b('0x59')](_0x25a9e3['body'][_0x397b('0x5a')],_[_0x397b('0x5b')](_0x25a9e3[_0x397b('0x58')],[_0x397b('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x39073b,null))['catch'](handleError(_0x39073b,null));};exports[_0x397b('0x5c')]=function(_0x24e541,_0x4b5b77,_0x30008d){return db[_0x397b('0x34')][_0x397b('0x4f')]({'where':{'id':_0x24e541['params']['id']}})[_0x397b('0x2a')](handleEntityNotFound(_0x4b5b77,null))[_0x397b('0x2a')](function(_0x58cdc4){if(_0x58cdc4){return _0x58cdc4[_0x397b('0x5c')](_0x24e541[_0x397b('0x39')][_0x397b('0x5a')])[_0x397b('0x2a')](function(){if(_[_0x397b('0x5d')](_0x24e541[_0x397b('0x39')][_0x397b('0x5a')])){for(var _0x5e93e1=0x0;_0x5e93e1<_0x24e541[_0x397b('0x39')]['ids'][_0x397b('0x3e')];_0x5e93e1+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x24e541[_0x397b('0x39')]['ids'][_0x5e93e1]),'SquareProjectId':Number(_0x24e541['params']['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x24e541[_0x397b('0x39')][_0x397b('0x5a')]),'SquareProjectId':Number(_0x24e541[_0x397b('0x4c')]['id'])});}});}})[_0x397b('0x2a')](respondWithStatusCode(_0x4b5b77,null))[_0x397b('0x4a')](handleError(_0x4b5b77,null));};exports[_0x397b('0x5e')]=function(_0x1e3b22,_0x390e0e,_0x2aebe3){var _0x3c620a={};var _0x448d8d={};var _0x33451f;var _0x3ba919;return db[_0x397b('0x34')][_0x397b('0x5f')]({'where':{'id':_0x1e3b22['params']['id']}})['then'](handleEntityNotFound(_0x390e0e,null))[_0x397b('0x2a')](function(_0x18f770){if(_0x18f770){_0x33451f=_0x18f770;_0x448d8d[_0x397b('0x37')]=_[_0x397b('0x3a')](db[_0x397b('0x60')][_0x397b('0x4d')]);_0x448d8d[_0x397b('0x39')]=_[_0x397b('0x3a')](_0x1e3b22['query']);_0x448d8d[_0x397b('0x3b')]=_[_0x397b('0x3c')](_0x448d8d[_0x397b('0x37')],_0x448d8d[_0x397b('0x39')]);_0x3c620a[_0x397b('0x3d')]=_[_0x397b('0x3c')](_0x448d8d[_0x397b('0x37')],qs[_0x397b('0x4e')](_0x1e3b22[_0x397b('0x39')][_0x397b('0x4e')]));_0x3c620a[_0x397b('0x3d')]=_0x3c620a['attributes']['length']?_0x3c620a[_0x397b('0x3d')]:_0x448d8d[_0x397b('0x37')];_0x3c620a[_0x397b('0x41')]=qs['sort'](_0x1e3b22[_0x397b('0x39')][_0x397b('0x42')]);_0x3c620a[_0x397b('0x43')]=qs[_0x397b('0x3b')](_[_0x397b('0x61')](_0x1e3b22[_0x397b('0x39')],_0x448d8d[_0x397b('0x3b')]));if(_0x1e3b22[_0x397b('0x39')]['filter']){_0x3c620a[_0x397b('0x43')]=_[_0x397b('0x44')](_0x3c620a['where'],{'$or':_[_0x397b('0x38')](_0x3c620a[_0x397b('0x3d')],function(_0x49aa7d){var _0xe3d198={};_0xe3d198[_0x49aa7d]={'$like':'%'+_0x1e3b22[_0x397b('0x39')][_0x397b('0x62')]+'%'};return _0xe3d198;})});}_0x3c620a=_['merge']({},_0x3c620a,_0x1e3b22[_0x397b('0x46')]);return _0x33451f[_0x397b('0x5e')](_0x3c620a);}})[_0x397b('0x2a')](function(_0x4dd4ef){if(_0x4dd4ef){_0x3ba919=_0x4dd4ef[_0x397b('0x3e')];if(!_0x1e3b22[_0x397b('0x39')][_0x397b('0x3f')](_0x397b('0x40'))){_0x3c620a['limit']=qs[_0x397b('0x23')](_0x1e3b22['query'][_0x397b('0x23')]);_0x3c620a['offset']=qs[_0x397b('0x21')](_0x1e3b22['query']['offset']);}return _0x33451f[_0x397b('0x5e')](_0x3c620a);}})['then'](function(_0x2df380){if(_0x2df380){return _0x2df380?{'count':_0x3ba919,'rows':_0x2df380}:null;}})['then'](respondWithResult(_0x390e0e,null))[_0x397b('0x4a')](handleError(_0x390e0e,null));}; \ No newline at end of file +var _0x21da=['User','order','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','SquareProjects','UserProfileResource','then','stack','name','send','SquareProject','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne'];(function(_0x5e2290,_0x24d2d8){var _0x1bbfa2=function(_0x17d018){while(--_0x17d018){_0x5e2290['push'](_0x5e2290['shift']());}};_0x1bbfa2(++_0x24d2d8);}(_0x21da,0x6a));var _0xa21d=function(_0x1774ee,_0x590e9f){_0x1774ee=_0x1774ee-0x0;var _0x2d8b53=_0x21da[_0x1774ee];return _0x2d8b53;};'use strict';var emlformat=require(_0xa21d('0x0'));var rimraf=require(_0xa21d('0x1'));var zipdir=require(_0xa21d('0x2'));var jsonpatch=require(_0xa21d('0x3'));var rp=require(_0xa21d('0x4'));var moment=require(_0xa21d('0x5'));var BPromise=require(_0xa21d('0x6'));var Mustache=require(_0xa21d('0x7'));var util=require(_0xa21d('0x8'));var path=require(_0xa21d('0x9'));var sox=require(_0xa21d('0xa'));var csv=require(_0xa21d('0xb'));var ejs=require(_0xa21d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa21d('0xd'));var squel=require(_0xa21d('0xe'));var crypto=require(_0xa21d('0xf'));var jsforce=require(_0xa21d('0x10'));var deskjs=require(_0xa21d('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa21d('0x12'));var Papa=require(_0xa21d('0x13'));var Redis=require(_0xa21d('0x14'));var authService=require(_0xa21d('0x15'));var qs=require(_0xa21d('0x16'));var as=require(_0xa21d('0x17'));var hardwareService=require(_0xa21d('0x18'));var logger=require(_0xa21d('0x19'))(_0xa21d('0x1a'));var utils=require('../../config/utils');var config=require(_0xa21d('0x1b'));var licenseUtil=require(_0xa21d('0x1c'));var db=require(_0xa21d('0x1d'))['db'];config[_0xa21d('0x1e')]=_[_0xa21d('0x1f')](config['redis'],{'host':_0xa21d('0x20'),'port':0x18eb});var socket=require(_0xa21d('0x21'))(new Redis(config[_0xa21d('0x1e')]));require('./squareProject.socket')[_0xa21d('0x22')](socket);function respondWithStatusCode(_0x5532e9,_0x174a28){_0x174a28=_0x174a28||0xcc;return function(_0x5d8009){if(_0x5d8009){return _0x5532e9[_0xa21d('0x23')](_0x174a28);}return _0x5532e9[_0xa21d('0x24')](_0x174a28)['end']();};}function respondWithResult(_0x808873,_0x4127bc){_0x4127bc=_0x4127bc||0xc8;return function(_0x277970){if(_0x277970){return _0x808873[_0xa21d('0x24')](_0x4127bc)[_0xa21d('0x25')](_0x277970);}};}function respondWithFilteredResult(_0xaefd24,_0x3652e0){return function(_0x1ac3b6){if(_0x1ac3b6){var _0x5204ba=typeof _0x3652e0[_0xa21d('0x26')]===_0xa21d('0x27')&&typeof _0x3652e0[_0xa21d('0x28')]==='undefined';var _0x3b2992=_0x1ac3b6[_0xa21d('0x29')];var _0x51b773=_0x5204ba?0x0:_0x3652e0[_0xa21d('0x26')];var _0x20eb19=_0x5204ba?_0x1ac3b6['count']:_0x3652e0[_0xa21d('0x26')]+_0x3652e0[_0xa21d('0x28')];var _0x46c224;if(_0x20eb19>=_0x3b2992){_0x20eb19=_0x3b2992;_0x46c224=0xc8;}else{_0x46c224=0xce;}_0xaefd24[_0xa21d('0x24')](_0x46c224);return _0xaefd24[_0xa21d('0x2a')]('Content-Range',_0x51b773+'-'+_0x20eb19+'/'+_0x3b2992)['json'](_0x1ac3b6);}return null;};}function patchUpdates(_0xda5553){return function(_0x13a2ff){try{jsonpatch[_0xa21d('0x2b')](_0x13a2ff,_0xda5553,!![]);}catch(_0x6f27cd){return BPromise[_0xa21d('0x2c')](_0x6f27cd);}return _0x13a2ff[_0xa21d('0x2d')]();};}function saveUpdates(_0x224652,_0x412be4){return function(_0x5e01c8){if(_0x5e01c8){return _0x5e01c8[_0xa21d('0x2e')](_0x224652)['then'](function(_0x32e63a){return _0x32e63a;});}return null;};}function removeEntity(_0x226d65,_0x4b8f47){return function(_0x41e498){if(_0x41e498){return _0x41e498[_0xa21d('0x2f')]()['then'](function(){var _0x5746a6=_0x41e498[_0xa21d('0x30')]({'plain':!![]});var _0x522669=_0xa21d('0x31');return db[_0xa21d('0x32')]['destroy']({'where':{'type':_0x522669,'resourceId':_0x5746a6['id']}})[_0xa21d('0x33')](function(){return _0x41e498;});})['then'](function(){_0x226d65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x454a07,_0x51e677){return function(_0x12a2f0){if(!_0x12a2f0){_0x454a07[_0xa21d('0x23')](0x194);}return _0x12a2f0;};}function handleError(_0x2fab2a,_0xbfbc8f){_0xbfbc8f=_0xbfbc8f||0x1f4;return function(_0x2553aa){logger['error'](_0x2553aa[_0xa21d('0x34')]);if(_0x2553aa[_0xa21d('0x35')]){delete _0x2553aa[_0xa21d('0x35')];}_0x2fab2a[_0xa21d('0x24')](_0xbfbc8f)[_0xa21d('0x36')](_0x2553aa);};}exports['index']=function(_0x1aea79,_0x3bbab7){var _0x5f3d1a={},_0x21eb06={},_0x45e78b={'count':0x0,'rows':[]};var _0x3bda4e=_['map'](db[_0xa21d('0x37')]['rawAttributes'],function(_0x443cd3){return{'name':_0x443cd3[_0xa21d('0x38')],'type':_0x443cd3[_0xa21d('0x39')][_0xa21d('0x3a')]};});_0x21eb06[_0xa21d('0x3b')]=_[_0xa21d('0x3c')](_0x3bda4e,'name');_0x21eb06[_0xa21d('0x3d')]=_['keys'](_0x1aea79['query']);_0x21eb06[_0xa21d('0x3e')]=_[_0xa21d('0x3f')](_0x21eb06[_0xa21d('0x3b')],_0x21eb06[_0xa21d('0x3d')]);_0x5f3d1a[_0xa21d('0x40')]=_[_0xa21d('0x3f')](_0x21eb06[_0xa21d('0x3b')],qs['fields'](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x41')]));_0x5f3d1a['attributes']=_0x5f3d1a[_0xa21d('0x40')][_0xa21d('0x42')]?_0x5f3d1a[_0xa21d('0x40')]:_0x21eb06['model'];if(!_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x43')](_0xa21d('0x44'))){_0x5f3d1a[_0xa21d('0x28')]=qs[_0xa21d('0x28')](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x28')]);_0x5f3d1a[_0xa21d('0x26')]=qs[_0xa21d('0x26')](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x26')]);}_0x5f3d1a['order']=qs[_0xa21d('0x45')](_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x45')]);_0x5f3d1a[_0xa21d('0x46')]=qs[_0xa21d('0x3e')](_[_0xa21d('0x47')](_0x1aea79['query'],_0x21eb06[_0xa21d('0x3e')]),_0x3bda4e);if(_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x48')]){_0x5f3d1a['where']=_[_0xa21d('0x49')](_0x5f3d1a[_0xa21d('0x46')],{'$or':_[_0xa21d('0x3c')](_0x3bda4e,function(_0x5c97db){if(_0x5c97db['type']!=='VIRTUAL'){var _0x571d3f={};_0x571d3f[_0x5c97db['name']]={'$like':'%'+_0x1aea79[_0xa21d('0x3d')][_0xa21d('0x48')]+'%'};return _0x571d3f;}})});}_0x5f3d1a=_[_0xa21d('0x49')]({},_0x5f3d1a,_0x1aea79[_0xa21d('0x4a')]);var _0x153c1c={'where':_0x5f3d1a[_0xa21d('0x46')]};return db[_0xa21d('0x37')][_0xa21d('0x29')](_0x153c1c)[_0xa21d('0x33')](function(_0x371821){_0x45e78b[_0xa21d('0x29')]=_0x371821;if(_0x1aea79['query'][_0xa21d('0x4b')]){_0x5f3d1a['include']=[{'all':!![]}];}return db[_0xa21d('0x37')][_0xa21d('0x4c')](_0x5f3d1a);})[_0xa21d('0x33')](function(_0x5ef15a){_0x45e78b[_0xa21d('0x4d')]=_0x5ef15a;return _0x45e78b;})[_0xa21d('0x33')](respondWithFilteredResult(_0x3bbab7,_0x5f3d1a))[_0xa21d('0x4e')](handleError(_0x3bbab7,null));};exports[_0xa21d('0x4f')]=function(_0x47c2e3,_0x5069ef){var _0x69dff3={'raw':![],'where':{'id':_0x47c2e3[_0xa21d('0x50')]['id']}},_0x44fad9={};_0x44fad9[_0xa21d('0x3b')]=_[_0xa21d('0x51')](db[_0xa21d('0x37')][_0xa21d('0x52')]);_0x44fad9[_0xa21d('0x3d')]=_[_0xa21d('0x51')](_0x47c2e3[_0xa21d('0x3d')]);_0x44fad9[_0xa21d('0x3e')]=_[_0xa21d('0x3f')](_0x44fad9['model'],_0x44fad9[_0xa21d('0x3d')]);_0x69dff3[_0xa21d('0x40')]=_['intersection'](_0x44fad9[_0xa21d('0x3b')],qs[_0xa21d('0x41')](_0x47c2e3[_0xa21d('0x3d')][_0xa21d('0x41')]));_0x69dff3['attributes']=_0x69dff3[_0xa21d('0x40')][_0xa21d('0x42')]?_0x69dff3['attributes']:_0x44fad9[_0xa21d('0x3b')];if(_0x47c2e3[_0xa21d('0x3d')][_0xa21d('0x4b')]){_0x69dff3[_0xa21d('0x53')]=[{'all':!![]}];}_0x69dff3=_['merge']({},_0x69dff3,_0x47c2e3[_0xa21d('0x4a')]);return db[_0xa21d('0x37')][_0xa21d('0x54')](_0x69dff3)['then'](handleEntityNotFound(_0x5069ef,null))[_0xa21d('0x33')](respondWithResult(_0x5069ef,null))['catch'](handleError(_0x5069ef,null));};exports[_0xa21d('0x55')]=function(_0x1c2112,_0xf12731){return db[_0xa21d('0x37')][_0xa21d('0x55')](_0x1c2112[_0xa21d('0x56')],{})[_0xa21d('0x33')](function(_0x438cc6){var _0x3f2bcb=_0x1c2112[_0xa21d('0x57')][_0xa21d('0x30')]({'plain':!![]});if(!_0x3f2bcb)throw new Error(_0xa21d('0x58'));if(_0x3f2bcb[_0xa21d('0x59')]===_0xa21d('0x57')){var _0x165e59=_0x438cc6[_0xa21d('0x30')]({'plain':!![]});var _0x2c693c=_0xa21d('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x2c693c,'userProfileId':_0x3f2bcb[_0xa21d('0x5a')]},'raw':!![]})[_0xa21d('0x33')](function(_0x50bd10){if(_0x50bd10&&_0x50bd10[_0xa21d('0x5b')]===0x0){return db[_0xa21d('0x32')][_0xa21d('0x55')]({'name':_0x165e59[_0xa21d('0x35')],'resourceId':_0x165e59['id'],'type':_0x50bd10[_0xa21d('0x35')],'sectionId':_0x50bd10['id']},{})[_0xa21d('0x33')](function(){return _0x438cc6;});}else{return _0x438cc6;}})['catch'](function(_0x57da30){logger['error'](_0xa21d('0x5c'),_0x57da30);throw _0x57da30;});}return _0x438cc6;})['then'](respondWithResult(_0xf12731,0xc9))['catch'](handleError(_0xf12731,null));};exports[_0xa21d('0x2e')]=function(_0x33190f,_0x41ab77){if(_0x33190f[_0xa21d('0x56')]['id']){delete _0x33190f[_0xa21d('0x56')]['id'];}return db[_0xa21d('0x37')]['find']({'where':{'id':_0x33190f['params']['id']}})['then'](handleEntityNotFound(_0x41ab77,null))['then'](saveUpdates(_0x33190f[_0xa21d('0x56')],null))[_0xa21d('0x33')](respondWithResult(_0x41ab77,null))[_0xa21d('0x4e')](handleError(_0x41ab77,null));};exports[_0xa21d('0x2f')]=function(_0x36c258,_0x3f8df3){return db[_0xa21d('0x37')]['find']({'where':{'id':_0x36c258[_0xa21d('0x50')]['id']}})[_0xa21d('0x33')](handleEntityNotFound(_0x3f8df3,null))[_0xa21d('0x33')](removeEntity(_0x3f8df3,null))[_0xa21d('0x4e')](handleError(_0x3f8df3,null));};exports['addUsers']=function(_0xf5e5d0,_0x45ac20,_0x17b87d){return db[_0xa21d('0x37')]['find']({'where':{'id':_0xf5e5d0[_0xa21d('0x50')]['id']}})['then'](handleEntityNotFound(_0x45ac20,null))['then'](function(_0x24f671){if(_0x24f671){return _0x24f671[_0xa21d('0x5d')](_0xf5e5d0[_0xa21d('0x56')][_0xa21d('0x5e')],_[_0xa21d('0x5f')](_0xf5e5d0['body'],[_0xa21d('0x5e'),'id'])||{});}})[_0xa21d('0x33')](respondWithResult(_0x45ac20,null))[_0xa21d('0x4e')](handleError(_0x45ac20,null));};exports[_0xa21d('0x60')]=function(_0x18aed0,_0x406d37,_0x2e4319){return db[_0xa21d('0x37')][_0xa21d('0x54')]({'where':{'id':_0x18aed0[_0xa21d('0x50')]['id']}})[_0xa21d('0x33')](handleEntityNotFound(_0x406d37,null))['then'](function(_0x468284){if(_0x468284){return _0x468284['removeUsers'](_0x18aed0[_0xa21d('0x3d')][_0xa21d('0x5e')])[_0xa21d('0x33')](function(){if(_[_0xa21d('0x61')](_0x18aed0['query'][_0xa21d('0x5e')])){for(var _0x269917=0x0;_0x269917<_0x18aed0['query']['ids'][_0xa21d('0x42')];_0x269917+=0x1){socket[_0xa21d('0x62')](_0xa21d('0x63'),{'UserId':Number(_0x18aed0['query'][_0xa21d('0x5e')][_0x269917]),'SquareProjectId':Number(_0x18aed0['params']['id'])});}}else{socket[_0xa21d('0x62')]('userSquareProject:remove',{'UserId':Number(_0x18aed0['query'][_0xa21d('0x5e')]),'SquareProjectId':Number(_0x18aed0[_0xa21d('0x50')]['id'])});}});}})[_0xa21d('0x33')](respondWithStatusCode(_0x406d37,null))[_0xa21d('0x4e')](handleError(_0x406d37,null));};exports[_0xa21d('0x64')]=function(_0x246a48,_0x3e08c9,_0x4ced51){var _0x3c1ab1={};var _0x4015ca={};var _0x41b63d;var _0x56323d;return db[_0xa21d('0x37')][_0xa21d('0x65')]({'where':{'id':_0x246a48[_0xa21d('0x50')]['id']}})[_0xa21d('0x33')](handleEntityNotFound(_0x3e08c9,null))[_0xa21d('0x33')](function(_0x19d307){if(_0x19d307){_0x41b63d=_0x19d307;_0x4015ca[_0xa21d('0x3b')]=_['keys'](db[_0xa21d('0x66')]['rawAttributes']);_0x4015ca[_0xa21d('0x3d')]=_[_0xa21d('0x51')](_0x246a48[_0xa21d('0x3d')]);_0x4015ca[_0xa21d('0x3e')]=_[_0xa21d('0x3f')](_0x4015ca[_0xa21d('0x3b')],_0x4015ca[_0xa21d('0x3d')]);_0x3c1ab1[_0xa21d('0x40')]=_[_0xa21d('0x3f')](_0x4015ca[_0xa21d('0x3b')],qs[_0xa21d('0x41')](_0x246a48[_0xa21d('0x3d')][_0xa21d('0x41')]));_0x3c1ab1[_0xa21d('0x40')]=_0x3c1ab1[_0xa21d('0x40')]['length']?_0x3c1ab1[_0xa21d('0x40')]:_0x4015ca['model'];_0x3c1ab1[_0xa21d('0x67')]=qs[_0xa21d('0x45')](_0x246a48[_0xa21d('0x3d')][_0xa21d('0x45')]);_0x3c1ab1[_0xa21d('0x46')]=qs[_0xa21d('0x3e')](_[_0xa21d('0x47')](_0x246a48[_0xa21d('0x3d')],_0x4015ca['filters']));if(_0x246a48[_0xa21d('0x3d')]['filter']){_0x3c1ab1[_0xa21d('0x46')]=_[_0xa21d('0x49')](_0x3c1ab1[_0xa21d('0x46')],{'$or':_[_0xa21d('0x3c')](_0x3c1ab1['attributes'],function(_0x140bfe){var _0x55a88b={};_0x55a88b[_0x140bfe]={'$like':'%'+_0x246a48[_0xa21d('0x3d')][_0xa21d('0x48')]+'%'};return _0x55a88b;})});}_0x3c1ab1=_[_0xa21d('0x49')]({},_0x3c1ab1,_0x246a48[_0xa21d('0x4a')]);return _0x41b63d[_0xa21d('0x64')](_0x3c1ab1);}})[_0xa21d('0x33')](function(_0x376865){if(_0x376865){_0x56323d=_0x376865[_0xa21d('0x42')];if(!_0x246a48['query'][_0xa21d('0x43')](_0xa21d('0x44'))){_0x3c1ab1['limit']=qs[_0xa21d('0x28')](_0x246a48[_0xa21d('0x3d')]['limit']);_0x3c1ab1[_0xa21d('0x26')]=qs[_0xa21d('0x26')](_0x246a48[_0xa21d('0x3d')][_0xa21d('0x26')]);}return _0x41b63d[_0xa21d('0x64')](_0x3c1ab1);}})['then'](function(_0x142e43){if(_0x142e43){return _0x142e43?{'count':_0x56323d,'rows':_0x142e43}:null;}})[_0xa21d('0x33')](respondWithResult(_0x3e08c9,null))[_0xa21d('0x4e')](handleError(_0x3e08c9,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 600112f..eb8b0fd 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 _0x4849=['emit','hasOwnProperty','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x2e7c7a,_0x2c134f){var _0x52c66e=function(_0x4f70fb){while(--_0x4f70fb){_0x2e7c7a['push'](_0x2e7c7a['shift']());}};_0x52c66e(++_0x2c134f);}(_0x4849,0xda));var _0x9484=function(_0x48a7c1,_0x1bd397){_0x48a7c1=_0x48a7c1-0x0;var _0x346e5a=_0x4849[_0x48a7c1];return _0x346e5a;};'use strict';var EventEmitter=require(_0x9484('0x0'));var SquareProject=require(_0x9484('0x1'))['db'][_0x9484('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9484('0x3')](0x0);var events={'afterCreate':_0x9484('0x4'),'afterUpdate':_0x9484('0x5'),'afterDestroy':_0x9484('0x6')};function emitEvent(_0x578400){return function(_0x4040b9,_0xc4b930,_0x3b071a){SquareProjectEvents[_0x9484('0x7')](_0x578400+':'+_0x4040b9['id'],_0x4040b9);SquareProjectEvents[_0x9484('0x7')](_0x578400,_0x4040b9);_0x3b071a(null);};}for(var e in events){if(events[_0x9484('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x5d40=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x5d40,0x109));var _0x05d4=function(_0x787cfc,_0x3e4816){_0x787cfc=_0x787cfc-0x0;var _0x55cd95=_0x5d40[_0x787cfc];return _0x55cd95;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x05d4('0x0'))['db'][_0x05d4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x05d4('0x2')](0x0);var events={'afterCreate':_0x05d4('0x3'),'afterUpdate':_0x05d4('0x4'),'afterDestroy':_0x05d4('0x5')};function emitEvent(_0x4611e3){return function(_0x594cd9,_0x3e21af,_0x1caeba){SquareProjectEvents[_0x05d4('0x6')](_0x4611e3+':'+_0x594cd9['id'],_0x594cd9);SquareProjectEvents[_0x05d4('0x6')](_0x4611e3,_0x594cd9);_0x1caeba(null);};}for(var e in events){if(events[_0x05d4('0x7')](e)){var event=events[e];SquareProject[_0x05d4('0x8')](e,emitEvent(event));}}module[_0x05d4('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d2fbee9..7a7a87f 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 _0x03c9=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','square_projects','changed','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x2ffd7c,_0x87dc05){var _0x240010=function(_0x815c7d){while(--_0x815c7d){_0x2ffd7c['push'](_0x2ffd7c['shift']());}};_0x240010(++_0x87dc05);}(_0x03c9,0x10a));var _0x903c=function(_0x4b05e7,_0x441ca1){_0x4b05e7=_0x4b05e7-0x0;var _0x472aba=_0x03c9[_0x4b05e7];return _0x472aba;};'use strict';var _=require(_0x903c('0x0'));var util=require(_0x903c('0x1'));var logger=require(_0x903c('0x2'))(_0x903c('0x3'));var moment=require('moment');var BPromise=require(_0x903c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x903c('0x5'));var config=require(_0x903c('0x6'));var attributes=require('./squareProject.attributes');module[_0x903c('0x7')]=function(_0x51dc23,_0x3b0936){return _0x51dc23[_0x903c('0x8')]('SquareProject',attributes,{'tableName':_0x903c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x261462,_0x2fd280,_0x3f15bd){if(_0x261462[_0x903c('0xa')]('preproduction')){_0x261462['savedAt']=moment()[_0x903c('0xb')](_0x903c('0xc'));}if(_0x261462['changed'](_0x903c('0xd'))){_0x261462['publishedAt']=moment()[_0x903c('0xb')](_0x903c('0xc'));}_0x3f15bd(null,_0x261462);}}});}; \ No newline at end of file +var _0x5625=['lodash','util','../../config/logger','api','bluebird','rimraf','./squareProject.attributes','square_projects','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x5625,0x1a4));var _0x5562=function(_0x32bd17,_0x380944){_0x32bd17=_0x32bd17-0x0;var _0x539989=_0x5625[_0x32bd17];return _0x539989;};'use strict';var _=require(_0x5562('0x0'));var util=require(_0x5562('0x1'));var logger=require(_0x5562('0x2'))(_0x5562('0x3'));var moment=require('moment');var BPromise=require(_0x5562('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5562('0x5'));var config=require('../../config/environment');var attributes=require(_0x5562('0x6'));module['exports']=function(_0x49d4b0,_0x56d781){return _0x49d4b0['define']('SquareProject',attributes,{'tableName':_0x5562('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x422a86,_0x2ffcd7,_0x2fa36b){if(_0x422a86['changed']('preproduction')){_0x422a86[_0x5562('0x8')]=moment()[_0x5562('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x422a86['changed']('production')){_0x422a86[_0x5562('0xa')]=moment()[_0x5562('0x9')](_0x5562('0xb'));}_0x2fa36b(null,_0x422a86);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index fef7469..90819f3 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 _0x9b9e=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','find','options','raw','where','attributes','include','model','map','then','lodash','util','bluebird'];(function(_0x24b783,_0x40e2d1){var _0x5ab308=function(_0x308016){while(--_0x308016){_0x24b783['push'](_0x24b783['shift']());}};_0x5ab308(++_0x40e2d1);}(_0x9b9e,0x165));var _0xe9b9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9b9e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe9b9('0x0'));var util=require(_0xe9b9('0x1'));var moment=require('moment');var BPromise=require(_0xe9b9('0x2'));var rs=require(_0xe9b9('0x3'));var fs=require('fs');var Redis=require(_0xe9b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9b9('0x5'));var logger=require(_0xe9b9('0x6'))('rpc');var config=require(_0xe9b9('0x7'));var jayson=require(_0xe9b9('0x8'));var client=jayson['client'][_0xe9b9('0x9')]({'port':0x232a});config[_0xe9b9('0xa')]=_[_0xe9b9('0xb')](config[_0xe9b9('0xa')],{'host':_0xe9b9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe9b9('0xa')]));require(_0xe9b9('0xd'))[_0xe9b9('0xe')](socket);function respondWithRpcPromise(_0x33e022,_0x460e48,_0x3dbf66){return new BPromise(function(_0x3aaf9a,_0x5ab469){return client['request'](_0x33e022,_0x3dbf66)['then'](function(_0x33f1b6){logger[_0xe9b9('0xf')](_0xe9b9('0x10'),_0x460e48,_0xe9b9('0x11'));logger[_0xe9b9('0x12')](_0xe9b9('0x13'),_0x460e48,_0xe9b9('0x11'),JSON[_0xe9b9('0x14')](_0x33f1b6));if(_0x33f1b6[_0xe9b9('0x15')]){if(_0x33f1b6[_0xe9b9('0x15')][_0xe9b9('0x16')]===0x1f4){logger[_0xe9b9('0x15')](_0xe9b9('0x10'),_0x460e48,_0x33f1b6[_0xe9b9('0x15')]['message']);return _0x5ab469(_0x33f1b6['error'][_0xe9b9('0x17')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x460e48,_0x33f1b6['error'][_0xe9b9('0x17')]);return _0x3aaf9a(_0x33f1b6['error'][_0xe9b9('0x17')]);}else{logger['info'](_0xe9b9('0x10'),_0x460e48,_0xe9b9('0x11'));_0x3aaf9a(_0x33f1b6[_0xe9b9('0x18')]['message']);}})[_0xe9b9('0x19')](function(_0x40f75f){logger[_0xe9b9('0x15')](_0xe9b9('0x10'),_0x460e48,_0x40f75f);_0x5ab469(_0x40f75f);});});}exports[_0xe9b9('0x1a')]=function(_0x58e166){var _0x202ed7=this;return new Promise(function(_0x4c095d,_0x6694a7){return db['SquareProject'][_0xe9b9('0x1b')]({'raw':_0x58e166[_0xe9b9('0x1c')]?_0x58e166[_0xe9b9('0x1c')][_0xe9b9('0x1d')]===undefined?!![]:![]:!![],'where':_0x58e166[_0xe9b9('0x1c')]?_0x58e166[_0xe9b9('0x1c')][_0xe9b9('0x1e')]||null:null,'attributes':_0x58e166[_0xe9b9('0x1c')]?_0x58e166[_0xe9b9('0x1c')][_0xe9b9('0x1f')]||null:null,'include':_0x58e166[_0xe9b9('0x1c')]?_0x58e166['options'][_0xe9b9('0x20')]?_['map'](_0x58e166[_0xe9b9('0x1c')][_0xe9b9('0x20')],function(_0x1ad164){return{'model':db[_0x1ad164[_0xe9b9('0x21')]],'as':_0x1ad164['as'],'attributes':_0x1ad164[_0xe9b9('0x1f')],'include':_0x1ad164['include']?_[_0xe9b9('0x22')](_0x1ad164[_0xe9b9('0x20')],function(_0x39a4e4){return{'model':db[_0x39a4e4[_0xe9b9('0x21')]],'as':_0x39a4e4['as'],'attributes':_0x39a4e4[_0xe9b9('0x1f')],'include':_0x39a4e4[_0xe9b9('0x20')]?_['map'](_0x39a4e4[_0xe9b9('0x20')],function(_0x1ce01d){return{'model':db[_0x1ce01d['model']],'as':_0x1ce01d['as'],'attributes':_0x1ce01d[_0xe9b9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9b9('0x23')](function(_0x2465ea){logger['info'](_0xe9b9('0x1a'),_0x58e166);logger[_0xe9b9('0x12')]('ShowSquareProject',_0x58e166,JSON[_0xe9b9('0x14')](_0x2465ea));_0x4c095d(_0x2465ea);})['catch'](function(_0x4277e0){logger[_0xe9b9('0x15')]('ShowSquareProject',_0x4277e0[_0xe9b9('0x17')],_0x58e166);_0x6694a7(_0x202ed7[_0xe9b9('0x15')](0x1f4,_0x4277e0[_0xe9b9('0x17')]));});});}; \ No newline at end of file +var _0x9de1=['include','model','map','ShowSquareProject','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareProject','find','options','where','attributes'];(function(_0x49e0e5,_0x1f1f6b){var _0x249c90=function(_0x2851ea){while(--_0x2851ea){_0x49e0e5['push'](_0x49e0e5['shift']());}};_0x249c90(++_0x1f1f6b);}(_0x9de1,0x124));var _0x19de=function(_0x28e72b,_0x5e16ab){_0x28e72b=_0x28e72b-0x0;var _0x77418f=_0x9de1[_0x28e72b];return _0x77418f;};'use strict';var _=require(_0x19de('0x0'));var util=require(_0x19de('0x1'));var moment=require(_0x19de('0x2'));var BPromise=require('bluebird');var rs=require(_0x19de('0x3'));var fs=require('fs');var Redis=require(_0x19de('0x4'));var db=require(_0x19de('0x5'))['db'];var utils=require(_0x19de('0x6'));var logger=require(_0x19de('0x7'))('rpc');var config=require(_0x19de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x19de('0x9')][_0x19de('0xa')]({'port':0x232a});config[_0x19de('0xb')]=_[_0x19de('0xc')](config['redis'],{'host':_0x19de('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19de('0xb')]));require('./squareProject.socket')[_0x19de('0xe')](socket);function respondWithRpcPromise(_0x11eaf9,_0x400c79,_0x2436c4){return new BPromise(function(_0x57a4a2,_0x1e2fba){return client[_0x19de('0xf')](_0x11eaf9,_0x2436c4)[_0x19de('0x10')](function(_0x3571bd){logger[_0x19de('0x11')](_0x19de('0x12'),_0x400c79,_0x19de('0x13'));logger[_0x19de('0x14')](_0x19de('0x15'),_0x400c79,'request\x20sent',JSON['stringify'](_0x3571bd));if(_0x3571bd[_0x19de('0x16')]){if(_0x3571bd[_0x19de('0x16')][_0x19de('0x17')]===0x1f4){logger[_0x19de('0x16')](_0x19de('0x12'),_0x400c79,_0x3571bd[_0x19de('0x16')]['message']);return _0x1e2fba(_0x3571bd[_0x19de('0x16')][_0x19de('0x18')]);}logger['error'](_0x19de('0x12'),_0x400c79,_0x3571bd[_0x19de('0x16')]['message']);return _0x57a4a2(_0x3571bd['error'][_0x19de('0x18')]);}else{logger[_0x19de('0x11')](_0x19de('0x12'),_0x400c79,_0x19de('0x13'));_0x57a4a2(_0x3571bd[_0x19de('0x19')]['message']);}})[_0x19de('0x1a')](function(_0x523a36){logger[_0x19de('0x16')](_0x19de('0x12'),_0x400c79,_0x523a36);_0x1e2fba(_0x523a36);});});}exports['ShowSquareProject']=function(_0x5a8bf3){var _0x1b7b5c=this;return new Promise(function(_0x4b9752,_0x85b38c){return db[_0x19de('0x1b')][_0x19de('0x1c')]({'raw':_0x5a8bf3['options']?_0x5a8bf3[_0x19de('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a8bf3[_0x19de('0x1d')]?_0x5a8bf3[_0x19de('0x1d')][_0x19de('0x1e')]||null:null,'attributes':_0x5a8bf3[_0x19de('0x1d')]?_0x5a8bf3[_0x19de('0x1d')][_0x19de('0x1f')]||null:null,'include':_0x5a8bf3[_0x19de('0x1d')]?_0x5a8bf3[_0x19de('0x1d')][_0x19de('0x20')]?_['map'](_0x5a8bf3[_0x19de('0x1d')]['include'],function(_0x4f42c3){return{'model':db[_0x4f42c3[_0x19de('0x21')]],'as':_0x4f42c3['as'],'attributes':_0x4f42c3[_0x19de('0x1f')],'include':_0x4f42c3[_0x19de('0x20')]?_[_0x19de('0x22')](_0x4f42c3[_0x19de('0x20')],function(_0x494524){return{'model':db[_0x494524['model']],'as':_0x494524['as'],'attributes':_0x494524[_0x19de('0x1f')],'include':_0x494524[_0x19de('0x20')]?_[_0x19de('0x22')](_0x494524['include'],function(_0x37944d){return{'model':db[_0x37944d[_0x19de('0x21')]],'as':_0x37944d['as'],'attributes':_0x37944d[_0x19de('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x19de('0x10')](function(_0x4b3fa6){logger[_0x19de('0x11')]('ShowSquareProject',_0x5a8bf3);logger[_0x19de('0x14')](_0x19de('0x23'),_0x5a8bf3,JSON['stringify'](_0x4b3fa6));_0x4b9752(_0x4b3fa6);})['catch'](function(_0x3f2bc1){logger['error']('ShowSquareProject',_0x3f2bc1[_0x19de('0x18')],_0x5a8bf3);_0x85b38c(_0x1b7b5c[_0x19de('0x16')](0x1f4,_0x3f2bc1[_0x19de('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 536f447..b5e8937 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 _0x090d=['update','removeListener','register','squareProject:'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x090d,0x17c));var _0xd090=function(_0x1717ed,_0x63e632){_0x1717ed=_0x1717ed-0x0;var _0x53e9c0=_0x090d[_0x1717ed];return _0x53e9c0;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove',_0xd090('0x0')];function createListener(_0x5cc40d,_0x26a20f){return function(_0x1e5616){_0x26a20f['emit'](_0x5cc40d,_0x1e5616);};}function removeListener(_0x2851b9,_0x1feafe){return function(){SquareProjectEvents[_0xd090('0x1')](_0x2851b9,_0x1feafe);};}exports[_0xd090('0x2')]=function(_0x5c5eb1){for(var _0x323b14=0x0,_0x35ac7b=events['length'];_0x323b14<_0x35ac7b;_0x323b14++){var _0x570858=events[_0x323b14];var _0x3ce3b9=createListener(_0xd090('0x3')+_0x570858,_0x5c5eb1);SquareProjectEvents['on'](_0x570858,_0x3ce3b9);}}; \ No newline at end of file +var _0xb706=['length','squareProject:','./squareProject.events','save','remove','update','removeListener','register'];(function(_0x122ee3,_0x19a860){var _0x4581ad=function(_0x4e9b2c){while(--_0x4e9b2c){_0x122ee3['push'](_0x122ee3['shift']());}};_0x4581ad(++_0x19a860);}(_0xb706,0x12a));var _0x6b70=function(_0x24c118,_0x2f2da9){_0x24c118=_0x24c118-0x0;var _0x3c8110=_0xb706[_0x24c118];return _0x3c8110;};'use strict';var SquareProjectEvents=require(_0x6b70('0x0'));var events=[_0x6b70('0x1'),_0x6b70('0x2'),_0x6b70('0x3')];function createListener(_0x23b80b,_0x550c60){return function(_0x10cad9){_0x550c60['emit'](_0x23b80b,_0x10cad9);};}function removeListener(_0x3a3734,_0xe99425){return function(){SquareProjectEvents[_0x6b70('0x4')](_0x3a3734,_0xe99425);};}exports[_0x6b70('0x5')]=function(_0x4a6bb1){for(var _0x2df126=0x0,_0xef1996=events[_0x6b70('0x6')];_0x2df126<_0xef1996;_0x2df126++){var _0x2bfdfd=events[_0x2df126];var _0x1bb1b7=createListener(_0x6b70('0x7')+_0x2bfdfd,_0x4a6bb1);SquareProjectEvents['on'](_0x2bfdfd,_0x1bb1b7);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4e958b6..cf551dd 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x3e1062,_0x1c6a5b){var _0x379ff4=function(_0x6283bf){while(--_0x6283bf){_0x3e1062['push'](_0x3e1062['shift']());}};_0x379ff4(++_0x1c6a5b);}(_0x53ec,0x192));var _0xc53e=function(_0x1b26ac,_0x5ea577){_0x1b26ac=_0x1b26ac-0x0;var _0x2d88ec=_0x53ec[_0x1b26ac];return _0x2d88ec;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x4ad095,_0x5f4d18){var _0x168ddf=function(_0x3600af){while(--_0x3600af){_0x4ad095['push'](_0x4ad095['shift']());}};_0x168ddf(++_0x5f4d18);}(_0x326f,0xd1));var _0xf326=function(_0x3f0caf,_0x51bef2){_0x3f0caf=_0x3f0caf-0x0;var _0x36d2da=_0x326f[_0x3f0caf];return _0x36d2da;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9ded13e..e676080 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 _0xdc97=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdc97,0x13b));var _0x7dc9=function(_0x26359e,_0x5a1b6b){_0x26359e=_0x26359e-0x0;var _0x4b03b9=_0xdc97[_0x26359e];return _0x4b03b9;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'uniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7dc9('0x2')]},'priority':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7dc9('0x2')]},'projectName':{'type':Sequelize[_0x7dc9('0x2')]},'saveName':{'type':Sequelize[_0x7dc9('0x2')]},'filename':{'type':Sequelize[_0x7dc9('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7dc9('0x3')],'get':function(){var _0x4f91c7='';var _0x4b3229=this[_0x7dc9('0x4')](_0x7dc9('0x5'));if(_0x4b3229){_0x4f91c7=_0x4b3229[_0x7dc9('0x6')](_0x4b3229[_0x7dc9('0x7')]('.'));}return _0x4f91c7;}}}; \ No newline at end of file +var _0x425d=['getDataValue','savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x50e27e,_0x1e226c){var _0x357b3a=function(_0x15732e){while(--_0x15732e){_0x50e27e['push'](_0x50e27e['shift']());}};_0x357b3a(++_0x1e226c);}(_0x425d,0x1e0));var _0xd425=function(_0x402dbb,_0x22a80f){_0x402dbb=_0x402dbb-0x0;var _0x69b4b=_0x425d[_0x402dbb];return _0x69b4b;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'callerid':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'extension':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd425('0x1')]},'saveName':{'type':Sequelize[_0xd425('0x1')]},'filename':{'type':Sequelize[_0xd425('0x1')]},'savePath':{'type':Sequelize[_0xd425('0x1')]},'format':{'type':Sequelize[_0xd425('0x2')],'get':function(){var _0x1d2ed0='';var _0x50b061=this[_0xd425('0x3')](_0xd425('0x4'));if(_0x50b061){_0x1d2ed0=_0x50b061[_0xd425('0x5')](_0x50b061[_0xd425('0x6')]('.'));}return _0x1d2ed0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index de7e863..a84284c 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 _0x6032=['../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','SquareRecording\x20not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x520729,_0xdde25d){var _0x3debf5=function(_0x52de36){while(--_0x52de36){_0x520729['push'](_0x520729['shift']());}};_0x3debf5(++_0xdde25d);}(_0x6032,0xaf));var _0x2603=function(_0x7c013d,_0x1d58f8){_0x7c013d=_0x7c013d-0x0;var _0x2f7a44=_0x6032[_0x7c013d];return _0x2f7a44;};'use strict';var emlformat=require(_0x2603('0x0'));var rimraf=require(_0x2603('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2603('0x2'));var rp=require(_0x2603('0x3'));var moment=require(_0x2603('0x4'));var BPromise=require(_0x2603('0x5'));var Mustache=require(_0x2603('0x6'));var util=require(_0x2603('0x7'));var path=require(_0x2603('0x8'));var sox=require('sox');var csv=require(_0x2603('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2603('0xa'));var _=require(_0x2603('0xb'));var squel=require(_0x2603('0xc'));var crypto=require(_0x2603('0xd'));var jsforce=require(_0x2603('0xe'));var deskjs=require(_0x2603('0xf'));var toCsv=require(_0x2603('0x9'));var querystring=require('querystring');var Papa=require(_0x2603('0x10'));var Redis=require(_0x2603('0x11'));var authService=require(_0x2603('0x12'));var qs=require(_0x2603('0x13'));var as=require(_0x2603('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2603('0x15'))(_0x2603('0x16'));var utils=require(_0x2603('0x17'));var config=require(_0x2603('0x18'));var licenseUtil=require(_0x2603('0x19'));var db=require(_0x2603('0x1a'))['db'];function respondWithStatusCode(_0x31ea23,_0x5690b3){_0x5690b3=_0x5690b3||0xcc;return function(_0x1f3426){if(_0x1f3426){return _0x31ea23['sendStatus'](_0x5690b3);}return _0x31ea23[_0x2603('0x1b')](_0x5690b3)[_0x2603('0x1c')]();};}function respondWithResult(_0x564ac1,_0x520e7a){_0x520e7a=_0x520e7a||0xc8;return function(_0x39a71e){if(_0x39a71e){return _0x564ac1['status'](_0x520e7a)['json'](_0x39a71e);}};}function respondWithFilteredResult(_0x52ad61,_0x29b27d){return function(_0x267c83){if(_0x267c83){var _0x4fb60c=typeof _0x29b27d[_0x2603('0x1d')]===_0x2603('0x1e')&&typeof _0x29b27d[_0x2603('0x1f')]==='undefined';var _0x133c60=_0x267c83[_0x2603('0x20')];var _0x38a602=_0x4fb60c?0x0:_0x29b27d[_0x2603('0x1d')];var _0x2c1e28=_0x4fb60c?_0x267c83['count']:_0x29b27d['offset']+_0x29b27d[_0x2603('0x1f')];var _0x3c0f56;if(_0x2c1e28>=_0x133c60){_0x2c1e28=_0x133c60;_0x3c0f56=0xc8;}else{_0x3c0f56=0xce;}_0x52ad61['status'](_0x3c0f56);return _0x52ad61[_0x2603('0x21')](_0x2603('0x22'),_0x38a602+'-'+_0x2c1e28+'/'+_0x133c60)[_0x2603('0x23')](_0x267c83);}return null;};}function patchUpdates(_0xcb33b7){return function(_0x2613c0){try{jsonpatch[_0x2603('0x24')](_0x2613c0,_0xcb33b7,!![]);}catch(_0x2217a7){return BPromise[_0x2603('0x25')](_0x2217a7);}return _0x2613c0[_0x2603('0x26')]();};}function saveUpdates(_0x4c3c7e,_0x56ca76){return function(_0x544ec1){if(_0x544ec1){return _0x544ec1['update'](_0x4c3c7e)[_0x2603('0x27')](function(_0x1ce2dd){return _0x1ce2dd;});}return null;};}function removeEntity(_0x3029d3,_0x177fe6){return function(_0x203bf7){if(_0x203bf7){return _0x203bf7[_0x2603('0x28')]()[_0x2603('0x27')](function(){_0x3029d3[_0x2603('0x1b')](0xcc)[_0x2603('0x1c')]();});}};}function handleEntityNotFound(_0x37b5d8,_0x55de1f){return function(_0x50f63b){if(!_0x50f63b){_0x37b5d8[_0x2603('0x29')](0x194);}return _0x50f63b;};}function handleError(_0x279004,_0x118cf5){_0x118cf5=_0x118cf5||0x1f4;return function(_0x5a4042){logger['error'](_0x5a4042[_0x2603('0x2a')]);if(_0x5a4042[_0x2603('0x2b')]){delete _0x5a4042['name'];}_0x279004['status'](_0x118cf5)[_0x2603('0x2c')](_0x5a4042);};}exports[_0x2603('0x2d')]=function(_0x37cee5,_0x5889e0){var _0x54669e={},_0x15d6ac={},_0x1d7bf2={'count':0x0,'rows':[]};var _0x44f526=_['map'](db[_0x2603('0x2e')][_0x2603('0x2f')],function(_0x471721){return{'name':_0x471721[_0x2603('0x30')],'type':_0x471721[_0x2603('0x31')][_0x2603('0x32')]};});_0x15d6ac[_0x2603('0x33')]=_['map'](_0x44f526,_0x2603('0x2b'));_0x15d6ac[_0x2603('0x34')]=_[_0x2603('0x35')](_0x37cee5[_0x2603('0x34')]);_0x15d6ac['filters']=_['intersection'](_0x15d6ac['model'],_0x15d6ac[_0x2603('0x34')]);_0x54669e[_0x2603('0x36')]=_[_0x2603('0x37')](_0x15d6ac[_0x2603('0x33')],qs['fields'](_0x37cee5[_0x2603('0x34')][_0x2603('0x38')]));_0x54669e['attributes']=_0x54669e[_0x2603('0x36')][_0x2603('0x39')]?_0x54669e[_0x2603('0x36')]:_0x15d6ac[_0x2603('0x33')];if(!_0x37cee5[_0x2603('0x34')][_0x2603('0x3a')]('nolimit')){_0x54669e[_0x2603('0x1f')]=qs[_0x2603('0x1f')](_0x37cee5['query'][_0x2603('0x1f')]);_0x54669e[_0x2603('0x1d')]=qs[_0x2603('0x1d')](_0x37cee5['query']['offset']);}_0x54669e[_0x2603('0x3b')]=qs[_0x2603('0x3c')](_0x37cee5['query'][_0x2603('0x3c')]);_0x54669e[_0x2603('0x3d')]=qs[_0x2603('0x3e')](_[_0x2603('0x3f')](_0x37cee5[_0x2603('0x34')],_0x15d6ac['filters']),_0x44f526);if(_0x37cee5['query'][_0x2603('0x40')]){_0x54669e[_0x2603('0x3d')]=_[_0x2603('0x41')](_0x54669e[_0x2603('0x3d')],{'$or':_[_0x2603('0x42')](_0x44f526,function(_0x5c6b7f){if(_0x5c6b7f[_0x2603('0x31')]!==_0x2603('0x43')){var _0x15d29f={};_0x15d29f[_0x5c6b7f['name']]={'$like':'%'+_0x37cee5[_0x2603('0x34')][_0x2603('0x40')]+'%'};return _0x15d29f;}})});}_0x54669e=_['merge']({},_0x54669e,_0x37cee5[_0x2603('0x44')]);var _0x1ec802={'where':_0x54669e[_0x2603('0x3d')]};return db['SquareRecording'][_0x2603('0x20')](_0x1ec802)['then'](function(_0x22929b){_0x1d7bf2[_0x2603('0x20')]=_0x22929b;if(_0x37cee5[_0x2603('0x34')][_0x2603('0x45')]){_0x54669e[_0x2603('0x46')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x54669e);})[_0x2603('0x27')](function(_0x26528c){_0x1d7bf2[_0x2603('0x47')]=_0x26528c;return _0x1d7bf2;})[_0x2603('0x27')](respondWithFilteredResult(_0x5889e0,_0x54669e))[_0x2603('0x48')](handleError(_0x5889e0,null));};exports[_0x2603('0x49')]=function(_0x40c490,_0x372d26){var _0xe110cd={'raw':!![],'where':{'id':_0x40c490[_0x2603('0x4a')]['id']}},_0x52b9c7={};_0x52b9c7[_0x2603('0x33')]=_[_0x2603('0x35')](db[_0x2603('0x2e')][_0x2603('0x2f')]);_0x52b9c7[_0x2603('0x34')]=_[_0x2603('0x35')](_0x40c490[_0x2603('0x34')]);_0x52b9c7[_0x2603('0x3e')]=_[_0x2603('0x37')](_0x52b9c7[_0x2603('0x33')],_0x52b9c7[_0x2603('0x34')]);_0xe110cd['attributes']=_[_0x2603('0x37')](_0x52b9c7['model'],qs[_0x2603('0x38')](_0x40c490['query']['fields']));_0xe110cd[_0x2603('0x36')]=_0xe110cd['attributes'][_0x2603('0x39')]?_0xe110cd[_0x2603('0x36')]:_0x52b9c7[_0x2603('0x33')];if(_0x40c490['query'][_0x2603('0x45')]){_0xe110cd['include']=[{'all':!![]}];}_0xe110cd=_['merge']({},_0xe110cd,_0x40c490['options']);return db[_0x2603('0x2e')][_0x2603('0x4b')](_0xe110cd)['then'](handleEntityNotFound(_0x372d26,null))[_0x2603('0x27')](respondWithResult(_0x372d26,null))[_0x2603('0x48')](handleError(_0x372d26,null));};exports['create']=function(_0x41a3d5,_0x17bb8b){return db[_0x2603('0x2e')][_0x2603('0x4c')](_0x41a3d5[_0x2603('0x4d')],{})[_0x2603('0x27')](respondWithResult(_0x17bb8b,0xc9))[_0x2603('0x48')](handleError(_0x17bb8b,null));};exports['update']=function(_0x5df8ea,_0x2c37ad){if(_0x5df8ea[_0x2603('0x4d')]['id']){delete _0x5df8ea[_0x2603('0x4d')]['id'];}return db[_0x2603('0x2e')]['find']({'where':{'id':_0x5df8ea[_0x2603('0x4a')]['id']}})[_0x2603('0x27')](handleEntityNotFound(_0x2c37ad,null))[_0x2603('0x27')](saveUpdates(_0x5df8ea[_0x2603('0x4d')],null))['then'](respondWithResult(_0x2c37ad,null))['catch'](handleError(_0x2c37ad,null));};exports[_0x2603('0x4e')]=function(_0x18da98,_0x5053bb,_0x1e4dc8){var _0x31cac0=require(_0x2603('0x4f'));var _0x33f599=![];var _0x38c746={};if(_0x18da98[_0x2603('0x34')][_0x2603('0x31')]&&_0x18da98[_0x2603('0x34')][_0x2603('0x31')]===_0x2603('0x50')){_0x38c746[_0x2603('0x50')]=_0x18da98[_0x2603('0x4a')]['id'];}else{_0x38c746['id']=_0x18da98[_0x2603('0x4a')]['id'];}return db['SquareRecording'][_0x2603('0x4b')]({'where':_0x38c746,'attributes':['id',_0x2603('0x51'),_0x2603('0x52')],'raw':!![]})[_0x2603('0x27')](handleEntityNotFound(_0x5053bb,null))[_0x2603('0x27')](function(_0x2755e3){if(_0x2755e3){var _0x441797=_0x2755e3[_0x2603('0x51')];var _0x3e9eaa=util[_0x2603('0x53')](_0x2603('0x54'),_0x441797);if(fs[_0x2603('0x55')](_0x3e9eaa)){_0x33f599=!![];return _0x31cac0[_0x2603('0x56')](_0x3e9eaa,_0x441797,config[_0x2603('0x57')][_0x2603('0x58')])[_0x2603('0x27')](function(){return _0x2755e3;});}return _0x2755e3;}})[_0x2603('0x27')](function(_0x257b3b){if(_0x257b3b){var _0x4a544d=_0x257b3b['savePath'];if(!fs[_0x2603('0x55')](_0x4a544d)){throw new db[(_0x2603('0x59'))][(_0x2603('0x5a'))]('SquareRecording\x20not\x20found');}if(_0x257b3b[_0x2603('0x52')]){return _0x5053bb[_0x2603('0x4e')](_0x4a544d,_0x257b3b[_0x2603('0x52')]+path[_0x2603('0x5b')](_0x4a544d),function(){if(_0x33f599){fs[_0x2603('0x5c')](_0x4a544d);}});}else{return _0x5053bb['download'](_0x4a544d,function(_0x3a1a32){if(_0x33f599){fs['unlink'](_0x4a544d);}});}}})['catch'](function(_0x3e1dcc){if(_0x3e1dcc['message']===_0x2603('0x5d')){_0x5053bb['status'](0x194)[_0x2603('0x2c')]('Not\x20found');}else{return handleError(_0x5053bb,null);}});};exports[_0x2603('0x28')]=function(_0x2a32c8,_0x5d59e1){return db['SquareRecording'][_0x2603('0x4b')]({'where':{'id':_0x2a32c8['params']['id']}})[_0x2603('0x27')](function(_0x1dda30){if(_[_0x2603('0x5e')](_0x1dda30)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1dda30;})[_0x2603('0x27')](function(_0x1ccd1f){var _0x52b1a1=_0x1ccd1f[_0x2603('0x51')];logger['info'](_0x2603('0x5f'),_0x52b1a1);if(!_[_0x2603('0x5e')](_0x1ccd1f[_0x2603('0x51')])&&fs[_0x2603('0x55')](_0x52b1a1)){logger[_0x2603('0x60')](_0x2603('0x61')+_0x52b1a1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2603('0x62')](_0x52b1a1);}_0x52b1a1=_0x52b1a1+_0x2603('0x63');if(!_[_0x2603('0x5e')](_0x1ccd1f[_0x2603('0x51')])&&fs[_0x2603('0x55')](_0x52b1a1)){logger[_0x2603('0x60')](_0x2603('0x61')+_0x52b1a1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2603('0x62')](_0x52b1a1);}return _0x1ccd1f;})['then'](function(_0x3959c5){if(!_0x3959c5)throw new InternalError();return _0x3959c5[_0x2603('0x28')]();})[_0x2603('0x27')](function(){_0x5d59e1[_0x2603('0x1b')](0xcc)[_0x2603('0x1c')]();})['catch'](handleError(_0x5d59e1,null));}; \ No newline at end of file +var _0x080c=['stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','SquareRecording','rows','catch','show','params','fields','include','find','create','body','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x080c,0x155));var _0xc080=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x080c[_0x5093e9];return _0x4c9a22;};'use strict';var emlformat=require(_0xc080('0x0'));var rimraf=require(_0xc080('0x1'));var zipdir=require(_0xc080('0x2'));var jsonpatch=require(_0xc080('0x3'));var rp=require(_0xc080('0x4'));var moment=require(_0xc080('0x5'));var BPromise=require(_0xc080('0x6'));var Mustache=require(_0xc080('0x7'));var util=require(_0xc080('0x8'));var path=require(_0xc080('0x9'));var sox=require(_0xc080('0xa'));var csv=require(_0xc080('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc080('0xc'));var squel=require(_0xc080('0xd'));var crypto=require(_0xc080('0xe'));var jsforce=require(_0xc080('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc080('0xb'));var querystring=require(_0xc080('0x10'));var Papa=require(_0xc080('0x11'));var Redis=require(_0xc080('0x12'));var authService=require(_0xc080('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc080('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc080('0x15'))(_0xc080('0x16'));var utils=require(_0xc080('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc080('0x18'))['db'];function respondWithStatusCode(_0x5a3988,_0x59cb41){_0x59cb41=_0x59cb41||0xcc;return function(_0x5f1136){if(_0x5f1136){return _0x5a3988[_0xc080('0x19')](_0x59cb41);}return _0x5a3988['status'](_0x59cb41)[_0xc080('0x1a')]();};}function respondWithResult(_0x13aa3e,_0x3079e4){_0x3079e4=_0x3079e4||0xc8;return function(_0x5e56bf){if(_0x5e56bf){return _0x13aa3e[_0xc080('0x1b')](_0x3079e4)[_0xc080('0x1c')](_0x5e56bf);}};}function respondWithFilteredResult(_0x64a53b,_0x2ea43d){return function(_0x114991){if(_0x114991){var _0x16106e=typeof _0x2ea43d[_0xc080('0x1d')]===_0xc080('0x1e')&&typeof _0x2ea43d[_0xc080('0x1f')]===_0xc080('0x1e');var _0x5ee09f=_0x114991[_0xc080('0x20')];var _0x52c621=_0x16106e?0x0:_0x2ea43d[_0xc080('0x1d')];var _0xf80622=_0x16106e?_0x114991[_0xc080('0x20')]:_0x2ea43d[_0xc080('0x1d')]+_0x2ea43d[_0xc080('0x1f')];var _0x21849e;if(_0xf80622>=_0x5ee09f){_0xf80622=_0x5ee09f;_0x21849e=0xc8;}else{_0x21849e=0xce;}_0x64a53b[_0xc080('0x1b')](_0x21849e);return _0x64a53b['set'](_0xc080('0x21'),_0x52c621+'-'+_0xf80622+'/'+_0x5ee09f)[_0xc080('0x1c')](_0x114991);}return null;};}function patchUpdates(_0x565c15){return function(_0x329d5c){try{jsonpatch[_0xc080('0x22')](_0x329d5c,_0x565c15,!![]);}catch(_0x57825a){return BPromise[_0xc080('0x23')](_0x57825a);}return _0x329d5c[_0xc080('0x24')]();};}function saveUpdates(_0x19d41a,_0xf2454c){return function(_0x3d2a6a){if(_0x3d2a6a){return _0x3d2a6a[_0xc080('0x25')](_0x19d41a)[_0xc080('0x26')](function(_0x536f4a){return _0x536f4a;});}return null;};}function removeEntity(_0x5187a3,_0x218aea){return function(_0x4d4d9d){if(_0x4d4d9d){return _0x4d4d9d['destroy']()['then'](function(){_0x5187a3['status'](0xcc)[_0xc080('0x1a')]();});}};}function handleEntityNotFound(_0x252b46,_0x41664a){return function(_0x292965){if(!_0x292965){_0x252b46[_0xc080('0x19')](0x194);}return _0x292965;};}function handleError(_0x542919,_0x3c5354){_0x3c5354=_0x3c5354||0x1f4;return function(_0x33c0fe){logger['error'](_0x33c0fe[_0xc080('0x27')]);if(_0x33c0fe[_0xc080('0x28')]){delete _0x33c0fe[_0xc080('0x28')];}_0x542919[_0xc080('0x1b')](_0x3c5354)[_0xc080('0x29')](_0x33c0fe);};}exports[_0xc080('0x2a')]=function(_0x594f7e,_0x2398fc){var _0x554166={},_0x562eff={},_0x3f700b={'count':0x0,'rows':[]};var _0x2dbf91=_[_0xc080('0x2b')](db['SquareRecording'][_0xc080('0x2c')],function(_0x197251){return{'name':_0x197251['fieldName'],'type':_0x197251['type'][_0xc080('0x2d')]};});_0x562eff[_0xc080('0x2e')]=_[_0xc080('0x2b')](_0x2dbf91,_0xc080('0x28'));_0x562eff[_0xc080('0x2f')]=_[_0xc080('0x30')](_0x594f7e[_0xc080('0x2f')]);_0x562eff[_0xc080('0x31')]=_[_0xc080('0x32')](_0x562eff['model'],_0x562eff[_0xc080('0x2f')]);_0x554166['attributes']=_[_0xc080('0x32')](_0x562eff['model'],qs['fields'](_0x594f7e[_0xc080('0x2f')]['fields']));_0x554166['attributes']=_0x554166[_0xc080('0x33')]['length']?_0x554166[_0xc080('0x33')]:_0x562eff[_0xc080('0x2e')];if(!_0x594f7e['query'][_0xc080('0x34')](_0xc080('0x35'))){_0x554166[_0xc080('0x1f')]=qs[_0xc080('0x1f')](_0x594f7e[_0xc080('0x2f')][_0xc080('0x1f')]);_0x554166['offset']=qs['offset'](_0x594f7e[_0xc080('0x2f')]['offset']);}_0x554166['order']=qs['sort'](_0x594f7e[_0xc080('0x2f')]['sort']);_0x554166[_0xc080('0x36')]=qs[_0xc080('0x31')](_[_0xc080('0x37')](_0x594f7e['query'],_0x562eff[_0xc080('0x31')]),_0x2dbf91);if(_0x594f7e['query'][_0xc080('0x38')]){_0x554166[_0xc080('0x36')]=_[_0xc080('0x39')](_0x554166[_0xc080('0x36')],{'$or':_[_0xc080('0x2b')](_0x2dbf91,function(_0x58423d){if(_0x58423d[_0xc080('0x3a')]!==_0xc080('0x3b')){var _0x47394c={};_0x47394c[_0x58423d[_0xc080('0x28')]]={'$like':'%'+_0x594f7e[_0xc080('0x2f')][_0xc080('0x38')]+'%'};return _0x47394c;}})});}_0x554166=_[_0xc080('0x39')]({},_0x554166,_0x594f7e[_0xc080('0x3c')]);var _0x199faa={'where':_0x554166[_0xc080('0x36')]};return db[_0xc080('0x3d')][_0xc080('0x20')](_0x199faa)[_0xc080('0x26')](function(_0x76c95e){_0x3f700b[_0xc080('0x20')]=_0x76c95e;if(_0x594f7e[_0xc080('0x2f')]['includeAll']){_0x554166['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x554166);})[_0xc080('0x26')](function(_0x558d42){_0x3f700b[_0xc080('0x3e')]=_0x558d42;return _0x3f700b;})[_0xc080('0x26')](respondWithFilteredResult(_0x2398fc,_0x554166))[_0xc080('0x3f')](handleError(_0x2398fc,null));};exports[_0xc080('0x40')]=function(_0xd73258,_0x5f4d70){var _0x150058={'raw':!![],'where':{'id':_0xd73258[_0xc080('0x41')]['id']}},_0x38562f={};_0x38562f[_0xc080('0x2e')]=_[_0xc080('0x30')](db['SquareRecording'][_0xc080('0x2c')]);_0x38562f['query']=_[_0xc080('0x30')](_0xd73258[_0xc080('0x2f')]);_0x38562f[_0xc080('0x31')]=_[_0xc080('0x32')](_0x38562f[_0xc080('0x2e')],_0x38562f[_0xc080('0x2f')]);_0x150058[_0xc080('0x33')]=_[_0xc080('0x32')](_0x38562f[_0xc080('0x2e')],qs[_0xc080('0x42')](_0xd73258['query']['fields']));_0x150058[_0xc080('0x33')]=_0x150058[_0xc080('0x33')]['length']?_0x150058[_0xc080('0x33')]:_0x38562f[_0xc080('0x2e')];if(_0xd73258[_0xc080('0x2f')]['includeAll']){_0x150058[_0xc080('0x43')]=[{'all':!![]}];}_0x150058=_[_0xc080('0x39')]({},_0x150058,_0xd73258[_0xc080('0x3c')]);return db['SquareRecording'][_0xc080('0x44')](_0x150058)[_0xc080('0x26')](handleEntityNotFound(_0x5f4d70,null))[_0xc080('0x26')](respondWithResult(_0x5f4d70,null))[_0xc080('0x3f')](handleError(_0x5f4d70,null));};exports[_0xc080('0x45')]=function(_0x28d3ca,_0x221efb){return db[_0xc080('0x3d')][_0xc080('0x45')](_0x28d3ca[_0xc080('0x46')],{})[_0xc080('0x26')](respondWithResult(_0x221efb,0xc9))[_0xc080('0x3f')](handleError(_0x221efb,null));};exports[_0xc080('0x25')]=function(_0x776a88,_0x1e6c37){if(_0x776a88['body']['id']){delete _0x776a88[_0xc080('0x46')]['id'];}return db[_0xc080('0x3d')][_0xc080('0x44')]({'where':{'id':_0x776a88['params']['id']}})[_0xc080('0x26')](handleEntityNotFound(_0x1e6c37,null))[_0xc080('0x26')](saveUpdates(_0x776a88[_0xc080('0x46')],null))['then'](respondWithResult(_0x1e6c37,null))[_0xc080('0x3f')](handleError(_0x1e6c37,null));};exports[_0xc080('0x47')]=function(_0x1f351c,_0x344a81,_0x48bf1f){var _0xca5f5=require(_0xc080('0x48'));var _0x226760=![];var _0x234394={};if(_0x1f351c[_0xc080('0x2f')][_0xc080('0x3a')]&&_0x1f351c[_0xc080('0x2f')]['type']===_0xc080('0x49')){_0x234394['uniqueid']=_0x1f351c[_0xc080('0x41')]['id'];}else{_0x234394['id']=_0x1f351c[_0xc080('0x41')]['id'];}return db[_0xc080('0x3d')][_0xc080('0x44')]({'where':_0x234394,'attributes':['id','savePath',_0xc080('0x4a')],'raw':!![]})[_0xc080('0x26')](handleEntityNotFound(_0x344a81,null))['then'](function(_0x10e4ae){if(_0x10e4ae){var _0x1943ea=_0x10e4ae[_0xc080('0x4b')];var _0x1fc60a=util[_0xc080('0x4c')]('%s.cypher',_0x1943ea);if(fs[_0xc080('0x4d')](_0x1fc60a)){_0x226760=!![];return _0xca5f5[_0xc080('0x4e')](_0x1fc60a,_0x1943ea,config[_0xc080('0x4f')][_0xc080('0x50')])['then'](function(){return _0x10e4ae;});}return _0x10e4ae;}})['then'](function(_0x557014){if(_0x557014){var _0x2ef9a3=_0x557014[_0xc080('0x4b')];if(!fs['existsSync'](_0x2ef9a3)){throw new db[(_0xc080('0x51'))]['ValidationError'](_0xc080('0x52'));}if(_0x557014[_0xc080('0x4a')]){return _0x344a81[_0xc080('0x47')](_0x2ef9a3,_0x557014[_0xc080('0x4a')]+path[_0xc080('0x53')](_0x2ef9a3),function(){if(_0x226760){fs['unlink'](_0x2ef9a3);}});}else{return _0x344a81[_0xc080('0x47')](_0x2ef9a3,function(_0x28c2cb){if(_0x226760){fs[_0xc080('0x54')](_0x2ef9a3);}});}}})['catch'](function(_0xbf06a4){if(_0xbf06a4[_0xc080('0x55')]===_0xc080('0x52')){_0x344a81['status'](0x194)[_0xc080('0x29')]('Not\x20found');}else{return handleError(_0x344a81,null);}});};exports['destroy']=function(_0x2ef0b5,_0x4391d1){return db['SquareRecording'][_0xc080('0x44')]({'where':{'id':_0x2ef0b5[_0xc080('0x41')]['id']}})[_0xc080('0x26')](function(_0x176ddc){if(_['isNil'](_0x176ddc)){throw new ReferenceError(_0xc080('0x56'));}return _0x176ddc;})['then'](function(_0x1e4e28){var _0x2710f4=_0x1e4e28[_0xc080('0x4b')];logger[_0xc080('0x57')](_0xc080('0x58'),_0x2710f4);if(!_[_0xc080('0x59')](_0x1e4e28[_0xc080('0x4b')])&&fs[_0xc080('0x4d')](_0x2710f4)){logger[_0xc080('0x57')]('File:\x20\x22'+_0x2710f4+_0xc080('0x5a'));fs[_0xc080('0x5b')](_0x2710f4);}_0x2710f4=_0x2710f4+_0xc080('0x5c');if(!_[_0xc080('0x59')](_0x1e4e28[_0xc080('0x4b')])&&fs[_0xc080('0x4d')](_0x2710f4)){logger[_0xc080('0x57')](_0xc080('0x5d')+_0x2710f4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc080('0x5b')](_0x2710f4);}return _0x1e4e28;})[_0xc080('0x26')](function(_0x2c0fb1){if(!_0x2c0fb1)throw new InternalError();return _0x2c0fb1[_0xc080('0x5e')]();})['then'](function(){_0x4391d1['status'](0xcc)[_0xc080('0x1a')]();})['catch'](handleError(_0x4391d1,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b5f1896..a2b3ed1 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 _0x3b74=['bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','../../config/logger','api'];(function(_0x100bcd,_0x4be6bc){var _0x330cec=function(_0x10a03c){while(--_0x10a03c){_0x100bcd['push'](_0x100bcd['shift']());}};_0x330cec(++_0x4be6bc);}(_0x3b74,0x80));var _0x43b7=function(_0xb8dc44,_0x226016){_0xb8dc44=_0xb8dc44-0x0;var _0x1698ec=_0x3b74[_0xb8dc44];return _0x1698ec;};'use strict';var _=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var logger=require(_0x43b7('0x2'))(_0x43b7('0x3'));var moment=require('moment');var BPromise=require(_0x43b7('0x4'));var rp=require(_0x43b7('0x5'));var fs=require('fs');var path=require(_0x43b7('0x6'));var rimraf=require(_0x43b7('0x7'));var config=require('../../config/environment');var attributes=require(_0x43b7('0x8'));module[_0x43b7('0x9')]=function(_0x3e62b0,_0x444109){return _0x3e62b0[_0x43b7('0xa')](_0x43b7('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee87=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','util','../../config/logger','api','moment'];(function(_0x554f86,_0x1d8bd3){var _0x17dd87=function(_0x35114a){while(--_0x35114a){_0x554f86['push'](_0x554f86['shift']());}};_0x17dd87(++_0x1d8bd3);}(_0xee87,0x10d));var _0x7ee8=function(_0x3ba172,_0x59d170){_0x3ba172=_0x3ba172-0x0;var _0x2c5673=_0xee87[_0x3ba172];return _0x2c5673;};'use strict';var _=require('lodash');var util=require(_0x7ee8('0x0'));var logger=require(_0x7ee8('0x1'))(_0x7ee8('0x2'));var moment=require(_0x7ee8('0x3'));var BPromise=require(_0x7ee8('0x4'));var rp=require(_0x7ee8('0x5'));var fs=require('fs');var path=require(_0x7ee8('0x6'));var rimraf=require(_0x7ee8('0x7'));var config=require(_0x7ee8('0x8'));var attributes=require(_0x7ee8('0x9'));module['exports']=function(_0x6bd09d,_0x516d9e){return _0x6bd09d[_0x7ee8('0xa')](_0x7ee8('0xb'),attributes,{'tableName':_0x7ee8('0xc'),'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 1d2f6c5..eac364f 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 _0x6dd3=['client','http','request','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','create','body','options','raw','CreateSquareRecording','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3da34f,_0x4040de){var _0x273019=function(_0x324f60){while(--_0x324f60){_0x3da34f['push'](_0x3da34f['shift']());}};_0x273019(++_0x4040de);}(_0x6dd3,0x105));var _0x36dd=function(_0xc48539,_0x4f5a61){_0xc48539=_0xc48539-0x0;var _0x17314a=_0x6dd3[_0xc48539];return _0x17314a;};'use strict';var _=require(_0x36dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x36dd('0x1'));var fs=require('fs');var Redis=require(_0x36dd('0x2'));var db=require(_0x36dd('0x3'))['db'];var utils=require(_0x36dd('0x4'));var logger=require(_0x36dd('0x5'))(_0x36dd('0x6'));var config=require(_0x36dd('0x7'));var jayson=require(_0x36dd('0x8'));var client=jayson[_0x36dd('0x9')][_0x36dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5c3f,_0x4301c0,_0x4fddda){return new BPromise(function(_0x988ff0,_0x1bce40){return client[_0x36dd('0xb')](_0x3f5c3f,_0x4fddda)[_0x36dd('0xc')](function(_0x5b993c){logger[_0x36dd('0xd')](_0x36dd('0xe'),_0x4301c0,'request\x20sent');logger['debug'](_0x36dd('0xf'),_0x4301c0,_0x36dd('0x10'),JSON[_0x36dd('0x11')](_0x5b993c));if(_0x5b993c[_0x36dd('0x12')]){if(_0x5b993c[_0x36dd('0x12')][_0x36dd('0x13')]===0x1f4){logger[_0x36dd('0x12')](_0x36dd('0xe'),_0x4301c0,_0x5b993c['error'][_0x36dd('0x14')]);return _0x1bce40(_0x5b993c['error']['message']);}logger[_0x36dd('0x12')]('SquareRecording,\x20%s,\x20%s',_0x4301c0,_0x5b993c['error'][_0x36dd('0x14')]);return _0x988ff0(_0x5b993c[_0x36dd('0x12')]['message']);}else{logger[_0x36dd('0xd')]('SquareRecording,\x20%s,\x20%s',_0x4301c0,_0x36dd('0x10'));_0x988ff0(_0x5b993c[_0x36dd('0x15')][_0x36dd('0x14')]);}})['catch'](function(_0x11da9d){logger[_0x36dd('0x12')](_0x36dd('0xe'),_0x4301c0,_0x11da9d);_0x1bce40(_0x11da9d);});});}exports['CreateSquareRecording']=function(_0x232738){var _0x48e3ce=this;return new Promise(function(_0x599f64,_0x3edf5c){return db['SquareRecording'][_0x36dd('0x16')](_0x232738[_0x36dd('0x17')],{'raw':_0x232738[_0x36dd('0x18')]?_0x232738[_0x36dd('0x18')][_0x36dd('0x19')]===undefined?!![]:![]:!![]})[_0x36dd('0xc')](function(_0x45f416){logger[_0x36dd('0xd')](_0x36dd('0x1a'),_0x232738);logger['debug'](_0x36dd('0x1a'),_0x232738,JSON['stringify'](_0x45f416));_0x599f64(_0x45f416);})['catch'](function(_0x2e33dd){logger[_0x36dd('0x12')](_0x36dd('0x1a'),_0x2e33dd['message'],_0x232738);_0x3edf5c(_0x48e3ce[_0x36dd('0x12')](0x1f4,_0x2e33dd[_0x36dd('0x14')]));});});}; \ No newline at end of file +var _0x8e07=['result','CreateSquareRecording','SquareRecording','create','options','raw','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4f0b38,_0x51b9ba){var _0x128aab=function(_0x299a2b){while(--_0x299a2b){_0x4f0b38['push'](_0x4f0b38['shift']());}};_0x128aab(++_0x51b9ba);}(_0x8e07,0x1d8));var _0x78e0=function(_0x2df8be,_0x273551){_0x2df8be=_0x2df8be-0x0;var _0x559687=_0x8e07[_0x2df8be];return _0x559687;};'use strict';var _=require(_0x78e0('0x0'));var util=require(_0x78e0('0x1'));var moment=require('moment');var BPromise=require(_0x78e0('0x2'));var rs=require(_0x78e0('0x3'));var fs=require('fs');var Redis=require(_0x78e0('0x4'));var db=require(_0x78e0('0x5'))['db'];var utils=require(_0x78e0('0x6'));var logger=require(_0x78e0('0x7'))(_0x78e0('0x8'));var config=require(_0x78e0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x78e0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b2cd,_0x33b14a,_0x23c287){return new BPromise(function(_0x1ba95c,_0x1ed475){return client[_0x78e0('0xb')](_0x31b2cd,_0x23c287)[_0x78e0('0xc')](function(_0x3416f6){logger['info'](_0x78e0('0xd'),_0x33b14a,_0x78e0('0xe'));logger['debug'](_0x78e0('0xf'),_0x33b14a,'request\x20sent',JSON[_0x78e0('0x10')](_0x3416f6));if(_0x3416f6['error']){if(_0x3416f6[_0x78e0('0x11')][_0x78e0('0x12')]===0x1f4){logger[_0x78e0('0x11')]('SquareRecording,\x20%s,\x20%s',_0x33b14a,_0x3416f6[_0x78e0('0x11')][_0x78e0('0x13')]);return _0x1ed475(_0x3416f6[_0x78e0('0x11')]['message']);}logger[_0x78e0('0x11')]('SquareRecording,\x20%s,\x20%s',_0x33b14a,_0x3416f6[_0x78e0('0x11')][_0x78e0('0x13')]);return _0x1ba95c(_0x3416f6['error'][_0x78e0('0x13')]);}else{logger[_0x78e0('0x14')](_0x78e0('0xd'),_0x33b14a,_0x78e0('0xe'));_0x1ba95c(_0x3416f6[_0x78e0('0x15')][_0x78e0('0x13')]);}})['catch'](function(_0x29a760){logger['error'](_0x78e0('0xd'),_0x33b14a,_0x29a760);_0x1ed475(_0x29a760);});});}exports[_0x78e0('0x16')]=function(_0x31394f){var _0x1b1ac4=this;return new Promise(function(_0x242d21,_0x3a9a31){return db[_0x78e0('0x17')][_0x78e0('0x18')](_0x31394f['body'],{'raw':_0x31394f['options']?_0x31394f[_0x78e0('0x19')][_0x78e0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1a9610){logger[_0x78e0('0x14')](_0x78e0('0x16'),_0x31394f);logger[_0x78e0('0x1b')](_0x78e0('0x16'),_0x31394f,JSON['stringify'](_0x1a9610));_0x242d21(_0x1a9610);})[_0x78e0('0x1c')](function(_0x2b19e7){logger[_0x78e0('0x11')]('CreateSquareRecording',_0x2b19e7[_0x78e0('0x13')],_0x31394f);_0x3a9a31(_0x1b1ac4['error'](0x1f4,_0x2b19e7[_0x78e0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 35afc5d..be0be98 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xd0448e,_0x2d3d92){var _0x3563cb=function(_0x19ccf3){while(--_0x19ccf3){_0xd0448e['push'](_0xd0448e['shift']());}};_0x3563cb(++_0x2d3d92);}(_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 +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(_0x1b2c59,_0x4cde7f){var _0x4e029=function(_0x54f95e){while(--_0x54f95e){_0x1b2c59['push'](_0x1b2c59['shift']());}};_0x4e029(++_0x4cde7f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4c54ee2..2a79c3c 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 _0xe806=['STRING','BOOLEAN','sequelize','exports'];(function(_0x56e386,_0x2d7403){var _0x38b2db=function(_0x36c7c9){while(--_0x36c7c9){_0x56e386['push'](_0x56e386['shift']());}};_0x38b2db(++_0x2d7403);}(_0xe806,0x15a));var _0x6e80=function(_0x5cb696,_0x17449e){_0x5cb696=_0x5cb696-0x0;var _0x37a116=_0xe806[_0x5cb696];return _0x37a116;};'use strict';var Sequelize=require(_0x6e80('0x0'));module[_0x6e80('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6e80('0x2')]},'language':{'type':Sequelize[_0x6e80('0x2')]},'type':{'type':Sequelize[_0x6e80('0x2')]},'uniqueid':{'type':Sequelize[_0x6e80('0x2')]},'version':{'type':Sequelize[_0x6e80('0x2')]},'callerid':{'type':Sequelize[_0x6e80('0x2')]},'calleridname':{'type':Sequelize[_0x6e80('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x6e80('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6e80('0x2')]},'rdnis':{'type':Sequelize[_0x6e80('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6e80('0x2')]},'priority':{'type':Sequelize[_0x6e80('0x2')]},'enhanced':{'type':Sequelize[_0x6e80('0x2')]},'accountcode':{'type':Sequelize[_0x6e80('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x6e80('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6e80('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x13ef=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x13ef,0x19c));var _0xf13e=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x13ef[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0xf13e('0x0'));module[_0xf13e('0x1')]={'network':{'type':Sequelize[_0xf13e('0x2')]},'network_script':{'type':Sequelize[_0xf13e('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf13e('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xf13e('0x2')]},'callerid':{'type':Sequelize[_0xf13e('0x2')]},'calleridname':{'type':Sequelize[_0xf13e('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf13e('0x2')]},'callington':{'type':Sequelize[_0xf13e('0x2')]},'callingtns':{'type':Sequelize[_0xf13e('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf13e('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf13e('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xf13e('0x2')]},'accountcode':{'type':Sequelize[_0xf13e('0x2')]},'threadid':{'type':Sequelize[_0xf13e('0x2')]},'project_name':{'type':Sequelize[_0xf13e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf13e('0x3')]},'bot':{'type':Sequelize[_0xf13e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f9d5afb..232df10 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 _0x8b4d=['offset','limit','count','set','Content-Range','apply','update','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','options','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x8b4d,0x102));var _0xd8b4=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x8b4d[_0x1597e2];return _0x4c8c0a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd8b4('0x0'));var jsonpatch=require(_0xd8b4('0x1'));var rp=require(_0xd8b4('0x2'));var moment=require(_0xd8b4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd8b4('0x4'));var util=require(_0xd8b4('0x5'));var path=require(_0xd8b4('0x6'));var sox=require(_0xd8b4('0x7'));var csv=require(_0xd8b4('0x8'));var ejs=require(_0xd8b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd8b4('0xa'));var squel=require(_0xd8b4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8b4('0xc'));var Redis=require(_0xd8b4('0xd'));var authService=require(_0xd8b4('0xe'));var qs=require(_0xd8b4('0xf'));var as=require(_0xd8b4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8b4('0x11'))(_0xd8b4('0x12'));var utils=require(_0xd8b4('0x13'));var config=require(_0xd8b4('0x14'));var licenseUtil=require(_0xd8b4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25418b,_0x16a74b){_0x16a74b=_0x16a74b||0xcc;return function(_0x414cfd){if(_0x414cfd){return _0x25418b[_0xd8b4('0x16')](_0x16a74b);}return _0x25418b['status'](_0x16a74b)[_0xd8b4('0x17')]();};}function respondWithResult(_0x7e35c9,_0xe3218d){_0xe3218d=_0xe3218d||0xc8;return function(_0x4393c9){if(_0x4393c9){return _0x7e35c9[_0xd8b4('0x18')](_0xe3218d)[_0xd8b4('0x19')](_0x4393c9);}};}function respondWithFilteredResult(_0x3114df,_0x3f1939){return function(_0x11d1e6){if(_0x11d1e6){var _0x553deb=typeof _0x3f1939[_0xd8b4('0x1a')]==='undefined'&&typeof _0x3f1939[_0xd8b4('0x1b')]==='undefined';var _0x55da05=_0x11d1e6['count'];var _0x3aeabe=_0x553deb?0x0:_0x3f1939['offset'];var _0x10cdec=_0x553deb?_0x11d1e6[_0xd8b4('0x1c')]:_0x3f1939[_0xd8b4('0x1a')]+_0x3f1939[_0xd8b4('0x1b')];var _0x4e7d99;if(_0x10cdec>=_0x55da05){_0x10cdec=_0x55da05;_0x4e7d99=0xc8;}else{_0x4e7d99=0xce;}_0x3114df['status'](_0x4e7d99);return _0x3114df[_0xd8b4('0x1d')](_0xd8b4('0x1e'),_0x3aeabe+'-'+_0x10cdec+'/'+_0x55da05)[_0xd8b4('0x19')](_0x11d1e6);}return null;};}function patchUpdates(_0x4280fc){return function(_0x4841f7){try{jsonpatch[_0xd8b4('0x1f')](_0x4841f7,_0x4280fc,!![]);}catch(_0x145460){return BPromise['reject'](_0x145460);}return _0x4841f7['save']();};}function saveUpdates(_0x1f5c13,_0x5d66b8){return function(_0x2d3fb5){if(_0x2d3fb5){return _0x2d3fb5[_0xd8b4('0x20')](_0x1f5c13)['then'](function(_0x7428a7){return _0x7428a7;});}return null;};}function removeEntity(_0x4aa124,_0x3bd3d9){return function(_0x2ef688){if(_0x2ef688){return _0x2ef688['destroy']()['then'](function(){_0x4aa124[_0xd8b4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0ea7,_0x89cd11){return function(_0x19ae8b){if(!_0x19ae8b){_0x2a0ea7[_0xd8b4('0x16')](0x194);}return _0x19ae8b;};}function handleError(_0x119a68,_0x257db2){_0x257db2=_0x257db2||0x1f4;return function(_0x5a4887){logger['error'](_0x5a4887[_0xd8b4('0x21')]);if(_0x5a4887[_0xd8b4('0x22')]){delete _0x5a4887['name'];}_0x119a68[_0xd8b4('0x18')](_0x257db2)[_0xd8b4('0x23')](_0x5a4887);};}exports[_0xd8b4('0x24')]=function(_0x22af4b,_0x1bd138){var _0x2ab0bc={},_0x1fa81d={},_0x396298={'count':0x0,'rows':[]};var _0x141469=_[_0xd8b4('0x25')](db[_0xd8b4('0x26')][_0xd8b4('0x27')],function(_0x19daa8){return{'name':_0x19daa8[_0xd8b4('0x28')],'type':_0x19daa8['type'][_0xd8b4('0x29')]};});_0x1fa81d[_0xd8b4('0x2a')]=_['map'](_0x141469,_0xd8b4('0x22'));_0x1fa81d[_0xd8b4('0x2b')]=_[_0xd8b4('0x2c')](_0x22af4b[_0xd8b4('0x2b')]);_0x1fa81d[_0xd8b4('0x2d')]=_[_0xd8b4('0x2e')](_0x1fa81d[_0xd8b4('0x2a')],_0x1fa81d[_0xd8b4('0x2b')]);_0x2ab0bc[_0xd8b4('0x2f')]=_[_0xd8b4('0x2e')](_0x1fa81d[_0xd8b4('0x2a')],qs[_0xd8b4('0x30')](_0x22af4b[_0xd8b4('0x2b')][_0xd8b4('0x30')]));_0x2ab0bc[_0xd8b4('0x2f')]=_0x2ab0bc[_0xd8b4('0x2f')][_0xd8b4('0x31')]?_0x2ab0bc['attributes']:_0x1fa81d[_0xd8b4('0x2a')];if(!_0x22af4b[_0xd8b4('0x2b')][_0xd8b4('0x32')]('nolimit')){_0x2ab0bc[_0xd8b4('0x1b')]=qs['limit'](_0x22af4b['query']['limit']);_0x2ab0bc[_0xd8b4('0x1a')]=qs[_0xd8b4('0x1a')](_0x22af4b['query']['offset']);}_0x2ab0bc['order']=qs[_0xd8b4('0x33')](_0x22af4b['query']['sort']);_0x2ab0bc[_0xd8b4('0x34')]=qs[_0xd8b4('0x2d')](_[_0xd8b4('0x35')](_0x22af4b['query'],_0x1fa81d['filters']),_0x141469);if(_0x22af4b[_0xd8b4('0x2b')]['filter']){_0x2ab0bc[_0xd8b4('0x34')]=_[_0xd8b4('0x36')](_0x2ab0bc[_0xd8b4('0x34')],{'$or':_['map'](_0x141469,function(_0x3c08c4){if(_0x3c08c4[_0xd8b4('0x37')]!==_0xd8b4('0x38')){var _0x145302={};_0x145302[_0x3c08c4['name']]={'$like':'%'+_0x22af4b[_0xd8b4('0x2b')]['filter']+'%'};return _0x145302;}})});}_0x2ab0bc=_[_0xd8b4('0x36')]({},_0x2ab0bc,_0x22af4b[_0xd8b4('0x39')]);var _0x982fde={'where':_0x2ab0bc[_0xd8b4('0x34')]};return db[_0xd8b4('0x26')][_0xd8b4('0x1c')](_0x982fde)[_0xd8b4('0x3a')](function(_0x4245ce){_0x396298['count']=_0x4245ce;if(_0x22af4b[_0xd8b4('0x2b')]['includeAll']){_0x2ab0bc[_0xd8b4('0x3b')]=[{'all':!![]}];}return db[_0xd8b4('0x26')][_0xd8b4('0x3c')](_0x2ab0bc);})['then'](function(_0x564272){_0x396298[_0xd8b4('0x3d')]=_0x564272;return _0x396298;})[_0xd8b4('0x3a')](respondWithFilteredResult(_0x1bd138,_0x2ab0bc))[_0xd8b4('0x3e')](handleError(_0x1bd138,null));};exports[_0xd8b4('0x3f')]=function(_0x2f403c,_0x4d50e1){var _0x292e7c={'raw':!![],'where':{'id':_0x2f403c[_0xd8b4('0x40')]['id']}},_0x289555={};_0x289555[_0xd8b4('0x2a')]=_['keys'](db[_0xd8b4('0x26')][_0xd8b4('0x27')]);_0x289555['query']=_[_0xd8b4('0x2c')](_0x2f403c[_0xd8b4('0x2b')]);_0x289555[_0xd8b4('0x2d')]=_[_0xd8b4('0x2e')](_0x289555['model'],_0x289555['query']);_0x292e7c[_0xd8b4('0x2f')]=_['intersection'](_0x289555['model'],qs[_0xd8b4('0x30')](_0x2f403c[_0xd8b4('0x2b')][_0xd8b4('0x30')]));_0x292e7c['attributes']=_0x292e7c['attributes']['length']?_0x292e7c['attributes']:_0x289555[_0xd8b4('0x2a')];if(_0x2f403c[_0xd8b4('0x2b')][_0xd8b4('0x41')]){_0x292e7c[_0xd8b4('0x3b')]=[{'all':!![]}];}_0x292e7c=_[_0xd8b4('0x36')]({},_0x292e7c,_0x2f403c[_0xd8b4('0x39')]);return db['SquareReport'][_0xd8b4('0x42')](_0x292e7c)['then'](handleEntityNotFound(_0x4d50e1,null))['then'](respondWithResult(_0x4d50e1,null))[_0xd8b4('0x3e')](handleError(_0x4d50e1,null));};exports[_0xd8b4('0x43')]=function(_0x55a54e,_0x34ae74){return db[_0xd8b4('0x26')][_0xd8b4('0x43')](_0x55a54e[_0xd8b4('0x44')],{})[_0xd8b4('0x3a')](respondWithResult(_0x34ae74,0xc9))[_0xd8b4('0x3e')](handleError(_0x34ae74,null));};exports[_0xd8b4('0x20')]=function(_0x16d71e,_0xfb7c86){if(_0x16d71e[_0xd8b4('0x44')]['id']){delete _0x16d71e[_0xd8b4('0x44')]['id'];}return db[_0xd8b4('0x26')]['find']({'where':{'id':_0x16d71e[_0xd8b4('0x40')]['id']}})['then'](handleEntityNotFound(_0xfb7c86,null))['then'](saveUpdates(_0x16d71e[_0xd8b4('0x44')],null))[_0xd8b4('0x3a')](respondWithResult(_0xfb7c86,null))[_0xd8b4('0x3e')](handleError(_0xfb7c86,null));};exports[_0xd8b4('0x45')]=function(_0x5354e1,_0x1d61ae){return db[_0xd8b4('0x26')][_0xd8b4('0x42')]({'where':{'id':_0x5354e1['params']['id']}})[_0xd8b4('0x3a')](handleEntityNotFound(_0x1d61ae,null))[_0xd8b4('0x3a')](removeEntity(_0x1d61ae,null))['catch'](handleError(_0x1d61ae,null));};exports['describe']=function(_0x457981,_0x576ca7){return db[_0xd8b4('0x26')][_0xd8b4('0x46')]()['then'](respondWithResult(_0x576ca7,null))[_0xd8b4('0x3e')](handleError(_0x576ca7,null));}; \ No newline at end of file +var _0x76bf=['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','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SquareReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x15d084,_0x5b0d80){var _0x52e4e7=function(_0x16adae){while(--_0x16adae){_0x15d084['push'](_0x15d084['shift']());}};_0x52e4e7(++_0x5b0d80);}(_0x76bf,0x170));var _0xf76b=function(_0x465a31,_0x59ce9a){_0x465a31=_0x465a31-0x0;var _0x3ebc40=_0x76bf[_0x465a31];return _0x3ebc40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf76b('0x0'));var zipdir=require(_0xf76b('0x1'));var jsonpatch=require(_0xf76b('0x2'));var rp=require(_0xf76b('0x3'));var moment=require(_0xf76b('0x4'));var BPromise=require(_0xf76b('0x5'));var Mustache=require(_0xf76b('0x6'));var util=require(_0xf76b('0x7'));var path=require(_0xf76b('0x8'));var sox=require(_0xf76b('0x9'));var csv=require(_0xf76b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf76b('0xb'));var _=require(_0xf76b('0xc'));var squel=require('squel');var crypto=require(_0xf76b('0xd'));var jsforce=require(_0xf76b('0xe'));var deskjs=require(_0xf76b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf76b('0x10'));var Papa=require('papaparse');var Redis=require(_0xf76b('0x11'));var authService=require(_0xf76b('0x12'));var qs=require(_0xf76b('0x13'));var as=require(_0xf76b('0x14'));var hardwareService=require(_0xf76b('0x15'));var logger=require(_0xf76b('0x16'))(_0xf76b('0x17'));var utils=require(_0xf76b('0x18'));var config=require(_0xf76b('0x19'));var licenseUtil=require(_0xf76b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23fb00,_0x205a08){_0x205a08=_0x205a08||0xcc;return function(_0x3fbef1){if(_0x3fbef1){return _0x23fb00[_0xf76b('0x1b')](_0x205a08);}return _0x23fb00[_0xf76b('0x1c')](_0x205a08)['end']();};}function respondWithResult(_0x2ba736,_0x1fdb74){_0x1fdb74=_0x1fdb74||0xc8;return function(_0x2178c0){if(_0x2178c0){return _0x2ba736[_0xf76b('0x1c')](_0x1fdb74)[_0xf76b('0x1d')](_0x2178c0);}};}function respondWithFilteredResult(_0x39f4e2,_0x2cbf37){return function(_0x3da095){if(_0x3da095){var _0xc7f277=typeof _0x2cbf37['offset']===_0xf76b('0x1e')&&typeof _0x2cbf37[_0xf76b('0x1f')]===_0xf76b('0x1e');var _0x56119d=_0x3da095[_0xf76b('0x20')];var _0x1914ca=_0xc7f277?0x0:_0x2cbf37[_0xf76b('0x21')];var _0x4a6cfb=_0xc7f277?_0x3da095[_0xf76b('0x20')]:_0x2cbf37[_0xf76b('0x21')]+_0x2cbf37[_0xf76b('0x1f')];var _0x45c92b;if(_0x4a6cfb>=_0x56119d){_0x4a6cfb=_0x56119d;_0x45c92b=0xc8;}else{_0x45c92b=0xce;}_0x39f4e2['status'](_0x45c92b);return _0x39f4e2[_0xf76b('0x22')](_0xf76b('0x23'),_0x1914ca+'-'+_0x4a6cfb+'/'+_0x56119d)[_0xf76b('0x1d')](_0x3da095);}return null;};}function patchUpdates(_0x2cc4b7){return function(_0x309739){try{jsonpatch[_0xf76b('0x24')](_0x309739,_0x2cc4b7,!![]);}catch(_0x4abf32){return BPromise[_0xf76b('0x25')](_0x4abf32);}return _0x309739[_0xf76b('0x26')]();};}function saveUpdates(_0x5603a8,_0x2bbdc0){return function(_0x52bdf4){if(_0x52bdf4){return _0x52bdf4[_0xf76b('0x27')](_0x5603a8)['then'](function(_0x1e60b5){return _0x1e60b5;});}return null;};}function removeEntity(_0x5d6e38,_0x21eec7){return function(_0x287d6c){if(_0x287d6c){return _0x287d6c['destroy']()[_0xf76b('0x28')](function(){_0x5d6e38[_0xf76b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf9ae,_0x2848b5){return function(_0x2bb4ba){if(!_0x2bb4ba){_0x1cf9ae['sendStatus'](0x194);}return _0x2bb4ba;};}function handleError(_0x2d54a9,_0x2b876c){_0x2b876c=_0x2b876c||0x1f4;return function(_0x827776){logger[_0xf76b('0x29')](_0x827776[_0xf76b('0x2a')]);if(_0x827776[_0xf76b('0x2b')]){delete _0x827776[_0xf76b('0x2b')];}_0x2d54a9[_0xf76b('0x1c')](_0x2b876c)[_0xf76b('0x2c')](_0x827776);};}exports[_0xf76b('0x2d')]=function(_0x14d91e,_0x237e45){var _0x18f25f={},_0x10979e={},_0x58c43a={'count':0x0,'rows':[]};var _0x5ccad3=_['map'](db[_0xf76b('0x2e')][_0xf76b('0x2f')],function(_0x10d675){return{'name':_0x10d675['fieldName'],'type':_0x10d675[_0xf76b('0x30')][_0xf76b('0x31')]};});_0x10979e[_0xf76b('0x32')]=_[_0xf76b('0x33')](_0x5ccad3,_0xf76b('0x2b'));_0x10979e[_0xf76b('0x34')]=_[_0xf76b('0x35')](_0x14d91e[_0xf76b('0x34')]);_0x10979e[_0xf76b('0x36')]=_[_0xf76b('0x37')](_0x10979e[_0xf76b('0x32')],_0x10979e['query']);_0x18f25f[_0xf76b('0x38')]=_[_0xf76b('0x37')](_0x10979e['model'],qs[_0xf76b('0x39')](_0x14d91e[_0xf76b('0x34')]['fields']));_0x18f25f[_0xf76b('0x38')]=_0x18f25f[_0xf76b('0x38')]['length']?_0x18f25f[_0xf76b('0x38')]:_0x10979e[_0xf76b('0x32')];if(!_0x14d91e['query']['hasOwnProperty'](_0xf76b('0x3a'))){_0x18f25f[_0xf76b('0x1f')]=qs[_0xf76b('0x1f')](_0x14d91e['query'][_0xf76b('0x1f')]);_0x18f25f['offset']=qs[_0xf76b('0x21')](_0x14d91e['query']['offset']);}_0x18f25f[_0xf76b('0x3b')]=qs[_0xf76b('0x3c')](_0x14d91e[_0xf76b('0x34')][_0xf76b('0x3c')]);_0x18f25f[_0xf76b('0x3d')]=qs['filters'](_['pick'](_0x14d91e[_0xf76b('0x34')],_0x10979e['filters']),_0x5ccad3);if(_0x14d91e[_0xf76b('0x34')][_0xf76b('0x3e')]){_0x18f25f[_0xf76b('0x3d')]=_[_0xf76b('0x3f')](_0x18f25f['where'],{'$or':_[_0xf76b('0x33')](_0x5ccad3,function(_0x399ceb){if(_0x399ceb[_0xf76b('0x30')]!==_0xf76b('0x40')){var _0x3a2853={};_0x3a2853[_0x399ceb[_0xf76b('0x2b')]]={'$like':'%'+_0x14d91e[_0xf76b('0x34')]['filter']+'%'};return _0x3a2853;}})});}_0x18f25f=_[_0xf76b('0x3f')]({},_0x18f25f,_0x14d91e[_0xf76b('0x41')]);var _0x4cc594={'where':_0x18f25f[_0xf76b('0x3d')]};return db['SquareReport'][_0xf76b('0x20')](_0x4cc594)[_0xf76b('0x28')](function(_0x16316d){_0x58c43a[_0xf76b('0x20')]=_0x16316d;if(_0x14d91e[_0xf76b('0x34')]['includeAll']){_0x18f25f[_0xf76b('0x42')]=[{'all':!![]}];}return db[_0xf76b('0x2e')]['findAll'](_0x18f25f);})['then'](function(_0x5e352c){_0x58c43a[_0xf76b('0x43')]=_0x5e352c;return _0x58c43a;})['then'](respondWithFilteredResult(_0x237e45,_0x18f25f))['catch'](handleError(_0x237e45,null));};exports[_0xf76b('0x44')]=function(_0x396886,_0x368ea5){var _0x585d47={'raw':!![],'where':{'id':_0x396886[_0xf76b('0x45')]['id']}},_0x4a9b8f={};_0x4a9b8f[_0xf76b('0x32')]=_[_0xf76b('0x35')](db[_0xf76b('0x2e')][_0xf76b('0x2f')]);_0x4a9b8f[_0xf76b('0x34')]=_[_0xf76b('0x35')](_0x396886[_0xf76b('0x34')]);_0x4a9b8f[_0xf76b('0x36')]=_[_0xf76b('0x37')](_0x4a9b8f[_0xf76b('0x32')],_0x4a9b8f[_0xf76b('0x34')]);_0x585d47['attributes']=_['intersection'](_0x4a9b8f['model'],qs['fields'](_0x396886[_0xf76b('0x34')][_0xf76b('0x39')]));_0x585d47[_0xf76b('0x38')]=_0x585d47[_0xf76b('0x38')][_0xf76b('0x46')]?_0x585d47[_0xf76b('0x38')]:_0x4a9b8f[_0xf76b('0x32')];if(_0x396886[_0xf76b('0x34')][_0xf76b('0x47')]){_0x585d47['include']=[{'all':!![]}];}_0x585d47=_[_0xf76b('0x3f')]({},_0x585d47,_0x396886[_0xf76b('0x41')]);return db['SquareReport'][_0xf76b('0x48')](_0x585d47)[_0xf76b('0x28')](handleEntityNotFound(_0x368ea5,null))[_0xf76b('0x28')](respondWithResult(_0x368ea5,null))[_0xf76b('0x49')](handleError(_0x368ea5,null));};exports[_0xf76b('0x4a')]=function(_0x13671c,_0x316a39){return db[_0xf76b('0x2e')]['create'](_0x13671c['body'],{})[_0xf76b('0x28')](respondWithResult(_0x316a39,0xc9))[_0xf76b('0x49')](handleError(_0x316a39,null));};exports['update']=function(_0x513af2,_0xa64024){if(_0x513af2[_0xf76b('0x4b')]['id']){delete _0x513af2[_0xf76b('0x4b')]['id'];}return db[_0xf76b('0x2e')]['find']({'where':{'id':_0x513af2[_0xf76b('0x45')]['id']}})['then'](handleEntityNotFound(_0xa64024,null))['then'](saveUpdates(_0x513af2[_0xf76b('0x4b')],null))[_0xf76b('0x28')](respondWithResult(_0xa64024,null))['catch'](handleError(_0xa64024,null));};exports['destroy']=function(_0x9360fa,_0x467538){return db[_0xf76b('0x2e')]['find']({'where':{'id':_0x9360fa['params']['id']}})['then'](handleEntityNotFound(_0x467538,null))[_0xf76b('0x28')](removeEntity(_0x467538,null))[_0xf76b('0x49')](handleError(_0x467538,null));};exports[_0xf76b('0x4c')]=function(_0x5c4bad,_0x5c074e){return db[_0xf76b('0x2e')][_0xf76b('0x4c')]()[_0xf76b('0x28')](respondWithResult(_0x5c074e,null))[_0xf76b('0x49')](handleError(_0x5c074e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7ce0d67..bc627de 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 _0x9713=['report_square','uid_pname','project_name','leaveAt','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./squareReport.attributes','exports','SquareReport'];(function(_0x149749,_0xe82f6d){var _0x3afa66=function(_0x4d1398){while(--_0x4d1398){_0x149749['push'](_0x149749['shift']());}};_0x3afa66(++_0xe82f6d);}(_0x9713,0xba));var _0x3971=function(_0x2e9910,_0x13fc34){_0x2e9910=_0x2e9910-0x0;var _0x407f09=_0x9713[_0x2e9910];return _0x407f09;};'use strict';var _=require(_0x3971('0x0'));var util=require('util');var logger=require(_0x3971('0x1'))(_0x3971('0x2'));var moment=require(_0x3971('0x3'));var BPromise=require('bluebird');var rp=require(_0x3971('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3971('0x5'));var attributes=require(_0x3971('0x6'));module[_0x3971('0x7')]=function(_0x55df2d,_0x5938fc){return _0x55df2d['define'](_0x3971('0x8'),attributes,{'tableName':_0x3971('0x9'),'paranoid':![],'indexes':[{'name':_0x3971('0xa'),'fields':['uniqueid',_0x3971('0xb')]},{'name':'leaveAt','fields':[_0x3971('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ab5=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x115039,_0x4059e4){var _0x3df66c=function(_0x23ad4f){while(--_0x23ad4f){_0x115039['push'](_0x115039['shift']());}};_0x3df66c(++_0x4059e4);}(_0x5ab5,0x1dc));var _0x55ab=function(_0x366d80,_0x188aa6){_0x366d80=_0x366d80-0x0;var _0xacbcb4=_0x5ab5[_0x366d80];return _0xacbcb4;};'use strict';var _=require(_0x55ab('0x0'));var util=require('util');var logger=require(_0x55ab('0x1'))(_0x55ab('0x2'));var moment=require(_0x55ab('0x3'));var BPromise=require('bluebird');var rp=require(_0x55ab('0x4'));var fs=require('fs');var path=require(_0x55ab('0x5'));var rimraf=require(_0x55ab('0x6'));var config=require(_0x55ab('0x7'));var attributes=require(_0x55ab('0x8'));module[_0x55ab('0x9')]=function(_0x462177,_0xb24ba2){return _0x462177[_0x55ab('0xa')](_0x55ab('0xb'),attributes,{'tableName':_0x55ab('0xc'),'paranoid':![],'indexes':[{'name':_0x55ab('0xd'),'fields':[_0x55ab('0xe'),_0x55ab('0xf')]},{'name':_0x55ab('0x10'),'fields':[_0x55ab('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 9677d47..d3f3210 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 _0x5d28=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareReport','body','options','raw','then','stringify','UpdateSquareReport','attributes','limit','catch','lodash'];(function(_0x585072,_0x2505c8){var _0x1acf5b=function(_0x3b42e9){while(--_0x3b42e9){_0x585072['push'](_0x585072['shift']());}};_0x1acf5b(++_0x2505c8);}(_0x5d28,0x104));var _0x85d2=function(_0x365984,_0x254927){_0x365984=_0x365984-0x0;var _0x125642=_0x5d28[_0x365984];return _0x125642;};'use strict';var _=require(_0x85d2('0x0'));var util=require(_0x85d2('0x1'));var moment=require('moment');var BPromise=require(_0x85d2('0x2'));var rs=require(_0x85d2('0x3'));var fs=require('fs');var Redis=require(_0x85d2('0x4'));var db=require(_0x85d2('0x5'))['db'];var utils=require(_0x85d2('0x6'));var logger=require('../../config/logger')(_0x85d2('0x7'));var config=require(_0x85d2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x85d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc1414e,_0x135f08,_0x209133){return new BPromise(function(_0x4a864d,_0x32c811){return client['request'](_0xc1414e,_0x209133)['then'](function(_0x2aea07){logger[_0x85d2('0xa')](_0x85d2('0xb'),_0x135f08,_0x85d2('0xc'));logger[_0x85d2('0xd')](_0x85d2('0xe'),_0x135f08,_0x85d2('0xc'),JSON['stringify'](_0x2aea07));if(_0x2aea07[_0x85d2('0xf')]){if(_0x2aea07[_0x85d2('0xf')][_0x85d2('0x10')]===0x1f4){logger['error'](_0x85d2('0xb'),_0x135f08,_0x2aea07[_0x85d2('0xf')][_0x85d2('0x11')]);return _0x32c811(_0x2aea07[_0x85d2('0xf')]['message']);}logger[_0x85d2('0xf')](_0x85d2('0xb'),_0x135f08,_0x2aea07['error'][_0x85d2('0x11')]);return _0x4a864d(_0x2aea07['error']['message']);}else{logger[_0x85d2('0xa')](_0x85d2('0xb'),_0x135f08,_0x85d2('0xc'));_0x4a864d(_0x2aea07[_0x85d2('0x12')][_0x85d2('0x11')]);}})['catch'](function(_0x3b788e){logger['error']('SquareReport,\x20%s,\x20%s',_0x135f08,_0x3b788e);_0x32c811(_0x3b788e);});});}exports[_0x85d2('0x13')]=function(_0x4e7d78){var _0x406779=this;return new Promise(function(_0x1fbcbd,_0x3f62d0){return db['SquareReport']['create'](_0x4e7d78[_0x85d2('0x14')],{'raw':_0x4e7d78[_0x85d2('0x15')]?_0x4e7d78[_0x85d2('0x15')][_0x85d2('0x16')]===undefined?!![]:![]:!![]})[_0x85d2('0x17')](function(_0x5ebedb){logger[_0x85d2('0xa')](_0x85d2('0x13'),_0x4e7d78);logger[_0x85d2('0xd')]('CreateSquareReport',_0x4e7d78,JSON[_0x85d2('0x18')](_0x5ebedb));_0x1fbcbd(_0x5ebedb);})['catch'](function(_0xb63896){logger[_0x85d2('0xf')](_0x85d2('0x13'),_0xb63896[_0x85d2('0x11')],_0x4e7d78);_0x3f62d0(_0x406779['error'](0x1f4,_0xb63896['message']));});});};exports[_0x85d2('0x19')]=function(_0x3d7103){var _0x2e3383=this;return new Promise(function(_0x542c6a,_0xbf71d7){return db['SquareReport']['update'](_0x3d7103['body'],{'raw':_0x3d7103[_0x85d2('0x15')]?_0x3d7103[_0x85d2('0x15')][_0x85d2('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d7103['options']?_0x3d7103[_0x85d2('0x15')]['where']||null:null,'attributes':_0x3d7103['options']?_0x3d7103[_0x85d2('0x15')][_0x85d2('0x1a')]||null:null,'limit':_0x3d7103[_0x85d2('0x15')]?_0x3d7103[_0x85d2('0x15')][_0x85d2('0x1b')]||null:null})[_0x85d2('0x17')](function(_0x1e5f43){logger[_0x85d2('0xa')](_0x85d2('0x19'),_0x3d7103);logger[_0x85d2('0xd')]('UpdateSquareReport',_0x3d7103,JSON[_0x85d2('0x18')](_0x1e5f43));_0x542c6a(_0x1e5f43);})[_0x85d2('0x1c')](function(_0xbaa133){logger[_0x85d2('0xf')](_0x85d2('0x19'),_0xbaa133[_0x85d2('0x11')],_0x3d7103);_0xbf71d7(_0x2e3383[_0x85d2('0xf')](0x1f4,_0xbaa133[_0x85d2('0x11')]));});});}; \ No newline at end of file +var _0xb9a0=['util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','options','raw','CreateSquareReport','UpdateSquareReport','update','body','attributes','limit'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xb9a0,0xd2));var _0x0b9a=function(_0x1abc8d,_0x1e9760){_0x1abc8d=_0x1abc8d-0x0;var _0xa3c72f=_0xb9a0[_0x1abc8d];return _0xa3c72f;};'use strict';var _=require('lodash');var util=require(_0x0b9a('0x0'));var moment=require(_0x0b9a('0x1'));var BPromise=require('bluebird');var rs=require(_0x0b9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b9a('0x4'))(_0x0b9a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0b9a('0x6')][_0x0b9a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bb01a,_0x1e9511,_0x918c2e){return new BPromise(function(_0x42b4c6,_0x4edada){return client['request'](_0x1bb01a,_0x918c2e)[_0x0b9a('0x8')](function(_0x5a7478){logger[_0x0b9a('0x9')](_0x0b9a('0xa'),_0x1e9511,_0x0b9a('0xb'));logger[_0x0b9a('0xc')](_0x0b9a('0xd'),_0x1e9511,_0x0b9a('0xb'),JSON[_0x0b9a('0xe')](_0x5a7478));if(_0x5a7478['error']){if(_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x10')]===0x1f4){logger[_0x0b9a('0xf')]('SquareReport,\x20%s,\x20%s',_0x1e9511,_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x11')]);return _0x4edada(_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x11')]);}logger[_0x0b9a('0xf')](_0x0b9a('0xa'),_0x1e9511,_0x5a7478[_0x0b9a('0xf')]['message']);return _0x42b4c6(_0x5a7478[_0x0b9a('0xf')][_0x0b9a('0x11')]);}else{logger[_0x0b9a('0x9')](_0x0b9a('0xa'),_0x1e9511,_0x0b9a('0xb'));_0x42b4c6(_0x5a7478[_0x0b9a('0x12')]['message']);}})[_0x0b9a('0x13')](function(_0x25954c){logger[_0x0b9a('0xf')]('SquareReport,\x20%s,\x20%s',_0x1e9511,_0x25954c);_0x4edada(_0x25954c);});});}exports['CreateSquareReport']=function(_0x5b5d54){var _0x2f25b7=this;return new Promise(function(_0x1054dd,_0x6b080c){return db[_0x0b9a('0x14')][_0x0b9a('0x15')](_0x5b5d54['body'],{'raw':_0x5b5d54[_0x0b9a('0x16')]?_0x5b5d54['options'][_0x0b9a('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x25e205){logger[_0x0b9a('0x9')](_0x0b9a('0x18'),_0x5b5d54);logger[_0x0b9a('0xc')](_0x0b9a('0x18'),_0x5b5d54,JSON[_0x0b9a('0xe')](_0x25e205));_0x1054dd(_0x25e205);})[_0x0b9a('0x13')](function(_0x26c7d8){logger[_0x0b9a('0xf')]('CreateSquareReport',_0x26c7d8['message'],_0x5b5d54);_0x6b080c(_0x2f25b7['error'](0x1f4,_0x26c7d8[_0x0b9a('0x11')]));});});};exports[_0x0b9a('0x19')]=function(_0x58118a){var _0x2fab16=this;return new Promise(function(_0x39e66b,_0x328680){return db[_0x0b9a('0x14')][_0x0b9a('0x1a')](_0x58118a[_0x0b9a('0x1b')],{'raw':_0x58118a[_0x0b9a('0x16')]?_0x58118a[_0x0b9a('0x16')][_0x0b9a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58118a['options']?_0x58118a['options']['where']||null:null,'attributes':_0x58118a['options']?_0x58118a[_0x0b9a('0x16')][_0x0b9a('0x1c')]||null:null,'limit':_0x58118a[_0x0b9a('0x16')]?_0x58118a[_0x0b9a('0x16')][_0x0b9a('0x1d')]||null:null})[_0x0b9a('0x8')](function(_0x3bc742){logger[_0x0b9a('0x9')]('UpdateSquareReport',_0x58118a);logger[_0x0b9a('0xc')](_0x0b9a('0x19'),_0x58118a,JSON[_0x0b9a('0xe')](_0x3bc742));_0x39e66b(_0x3bc742);})[_0x0b9a('0x13')](function(_0xf143d0){logger['error'](_0x0b9a('0x19'),_0xf143d0[_0x0b9a('0x11')],_0x58118a);_0x328680(_0x2fab16[_0x0b9a('0xf')](0x1f4,_0xf143d0[_0x0b9a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ad6eb81..469e60a 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 _0xbb0b=['/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x194d22,_0xf0427d){var _0x53e234=function(_0x18d659){while(--_0x18d659){_0x194d22['push'](_0x194d22['shift']());}};_0x53e234(++_0xf0427d);}(_0xbb0b,0xd8));var _0xbbb0=function(_0x50843d,_0x48a030){_0x50843d=_0x50843d-0x0;var _0x37936c=_0xbb0b[_0x50843d];return _0x37936c;};'use strict';var multer=require(_0xbbb0('0x0'));var util=require(_0xbbb0('0x1'));var path=require(_0xbbb0('0x2'));var timeout=require(_0xbbb0('0x3'));var express=require(_0xbbb0('0x4'));var router=express[_0xbbb0('0x5')]();var fs_extra=require(_0xbbb0('0x6'));var auth=require(_0xbbb0('0x7'));var interaction=require(_0xbbb0('0x8'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xbbb0('0x9')]('/',auth[_0xbbb0('0xa')](),controller['index']);router[_0xbbb0('0x9')](_0xbbb0('0xb'),auth[_0xbbb0('0xa')](),controller['describe']);router[_0xbbb0('0x9')](_0xbbb0('0xc'),auth[_0xbbb0('0xa')](),controller['show']);router['post']('/',auth[_0xbbb0('0xa')](),controller[_0xbbb0('0xd')]);router[_0xbbb0('0xe')]('/:id',auth[_0xbbb0('0xa')](),controller[_0xbbb0('0xf')]);router[_0xbbb0('0x10')](_0xbbb0('0xc'),auth[_0xbbb0('0xa')](),controller[_0xbbb0('0x11')]);module[_0xbbb0('0x12')]=router; \ No newline at end of file +var _0x9eca=['../../components/auth/service','../../config/environment','./squareReportDetail.controller','index','/describe','isAuthenticated','get','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9eca,0x1ee));var _0xa9ec=function(_0x51a65c,_0x41dc34){_0x51a65c=_0x51a65c-0x0;var _0x31e6e0=_0x9eca[_0x51a65c];return _0x31e6e0;};'use strict';var multer=require(_0xa9ec('0x0'));var util=require(_0xa9ec('0x1'));var path=require(_0xa9ec('0x2'));var timeout=require(_0xa9ec('0x3'));var express=require(_0xa9ec('0x4'));var router=express[_0xa9ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9ec('0x7'));var controller=require(_0xa9ec('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa9ec('0x9')]);router['get'](_0xa9ec('0xa'),auth[_0xa9ec('0xb')](),controller['describe']);router[_0xa9ec('0xc')]('/:id',auth[_0xa9ec('0xb')](),controller[_0xa9ec('0xd')]);router[_0xa9ec('0xe')]('/',auth[_0xa9ec('0xb')](),controller[_0xa9ec('0xf')]);router[_0xa9ec('0x10')](_0xa9ec('0x11'),auth[_0xa9ec('0xb')](),controller[_0xa9ec('0x12')]);router['delete'](_0xa9ec('0x11'),auth[_0xa9ec('0xb')](),controller['destroy']);module[_0xa9ec('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8403f28..3feb07c 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 _0xbe5f=['STRING','TEXT','sequelize','exports'];(function(_0x423608,_0x462bcc){var _0x55d260=function(_0x1ab076){while(--_0x1ab076){_0x423608['push'](_0x423608['shift']());}};_0x55d260(++_0x462bcc);}(_0xbe5f,0x11a));var _0xfbe5=function(_0x3cc5c9,_0x5314a3){_0x3cc5c9=_0x3cc5c9-0x0;var _0x173819=_0xbe5f[_0x3cc5c9];return _0x173819;};'use strict';var Sequelize=require(_0xfbe5('0x0'));module[_0xfbe5('0x1')]={'uniqueid':{'type':Sequelize[_0xfbe5('0x2')]},'node':{'type':Sequelize[_0xfbe5('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xfbe5('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfbe5('0x2')]}}; \ No newline at end of file +var _0xbae3=['STRING','TEXT','sequelize','exports'];(function(_0x5a6f23,_0x2c4383){var _0xb521c=function(_0x4b0cf1){while(--_0x4b0cf1){_0x5a6f23['push'](_0x5a6f23['shift']());}};_0xb521c(++_0x2c4383);}(_0xbae3,0xa6));var _0x3bae=function(_0x351f05,_0x37394d){_0x351f05=_0x351f05-0x0;var _0x27ab39=_0xbae3[_0x351f05];return _0x27ab39;};'use strict';var Sequelize=require(_0x3bae('0x0'));module[_0x3bae('0x1')]={'uniqueid':{'type':Sequelize[_0x3bae('0x2')]},'node':{'type':Sequelize[_0x3bae('0x2')]},'application':{'type':Sequelize[_0x3bae('0x2')]},'data':{'type':Sequelize[_0x3bae('0x3')]},'project_name':{'type':Sequelize[_0x3bae('0x2')]},'callerid':{'type':Sequelize[_0x3bae('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 37eb124..a53e0ca 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 _0x7466=['options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','nolimit','order','where','filters','filter','VIRTUAL','merge'];(function(_0x44f66d,_0x19d0bd){var _0x8d1778=function(_0xc4a829){while(--_0xc4a829){_0x44f66d['push'](_0x44f66d['shift']());}};_0x8d1778(++_0x19d0bd);}(_0x7466,0x9f));var _0x6746=function(_0x1b15cd,_0x399821){_0x1b15cd=_0x1b15cd-0x0;var _0x5d6987=_0x7466[_0x1b15cd];return _0x5d6987;};'use strict';var emlformat=require(_0x6746('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6746('0x1'));var jsonpatch=require(_0x6746('0x2'));var rp=require(_0x6746('0x3'));var moment=require(_0x6746('0x4'));var BPromise=require(_0x6746('0x5'));var Mustache=require(_0x6746('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6746('0x7'));var ejs=require(_0x6746('0x8'));var fs=require('fs');var fs_extra=require(_0x6746('0x9'));var _=require(_0x6746('0xa'));var squel=require('squel');var crypto=require(_0x6746('0xb'));var jsforce=require(_0x6746('0xc'));var deskjs=require(_0x6746('0xd'));var toCsv=require(_0x6746('0x7'));var querystring=require('querystring');var Papa=require(_0x6746('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6746('0xf'));var as=require(_0x6746('0x10'));var hardwareService=require(_0x6746('0x11'));var logger=require('../../config/logger')(_0x6746('0x12'));var utils=require(_0x6746('0x13'));var config=require(_0x6746('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6746('0x15'))['db'];function respondWithStatusCode(_0x5d2d4e,_0x1ce01c){_0x1ce01c=_0x1ce01c||0xcc;return function(_0x197066){if(_0x197066){return _0x5d2d4e[_0x6746('0x16')](_0x1ce01c);}return _0x5d2d4e[_0x6746('0x17')](_0x1ce01c)[_0x6746('0x18')]();};}function respondWithResult(_0x226694,_0x375ec9){_0x375ec9=_0x375ec9||0xc8;return function(_0x1c4b39){if(_0x1c4b39){return _0x226694[_0x6746('0x17')](_0x375ec9)[_0x6746('0x19')](_0x1c4b39);}};}function respondWithFilteredResult(_0x15e623,_0x37be52){return function(_0x4c93a3){if(_0x4c93a3){var _0x3dec00=typeof _0x37be52[_0x6746('0x1a')]==='undefined'&&typeof _0x37be52[_0x6746('0x1b')]===_0x6746('0x1c');var _0x212304=_0x4c93a3[_0x6746('0x1d')];var _0x5eb0a1=_0x3dec00?0x0:_0x37be52[_0x6746('0x1a')];var _0x209370=_0x3dec00?_0x4c93a3[_0x6746('0x1d')]:_0x37be52['offset']+_0x37be52[_0x6746('0x1b')];var _0x46dfb0;if(_0x209370>=_0x212304){_0x209370=_0x212304;_0x46dfb0=0xc8;}else{_0x46dfb0=0xce;}_0x15e623['status'](_0x46dfb0);return _0x15e623[_0x6746('0x1e')](_0x6746('0x1f'),_0x5eb0a1+'-'+_0x209370+'/'+_0x212304)[_0x6746('0x19')](_0x4c93a3);}return null;};}function patchUpdates(_0x3fa557){return function(_0x5c100b){try{jsonpatch[_0x6746('0x20')](_0x5c100b,_0x3fa557,!![]);}catch(_0x42eadc){return BPromise[_0x6746('0x21')](_0x42eadc);}return _0x5c100b[_0x6746('0x22')]();};}function saveUpdates(_0x515e4b,_0xa7d372){return function(_0x49db8f){if(_0x49db8f){return _0x49db8f[_0x6746('0x23')](_0x515e4b)[_0x6746('0x24')](function(_0x10b2dc){return _0x10b2dc;});}return null;};}function removeEntity(_0x5cd47a,_0x190ab2){return function(_0x1c3a14){if(_0x1c3a14){return _0x1c3a14[_0x6746('0x25')]()[_0x6746('0x24')](function(){_0x5cd47a[_0x6746('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3262,_0x47ef12){return function(_0x104c53){if(!_0x104c53){_0x4b3262[_0x6746('0x16')](0x194);}return _0x104c53;};}function handleError(_0x54d14f,_0x16aaa0){_0x16aaa0=_0x16aaa0||0x1f4;return function(_0x290bf2){logger[_0x6746('0x26')](_0x290bf2[_0x6746('0x27')]);if(_0x290bf2[_0x6746('0x28')]){delete _0x290bf2[_0x6746('0x28')];}_0x54d14f['status'](_0x16aaa0)[_0x6746('0x29')](_0x290bf2);};}exports[_0x6746('0x2a')]=function(_0x28834c,_0x2f4cb5){var _0x59b291={},_0x50a86a={},_0x909973={'count':0x0,'rows':[]};var _0x51118b=_[_0x6746('0x2b')](db['SquareDetailsReport'][_0x6746('0x2c')],function(_0x12332a){return{'name':_0x12332a[_0x6746('0x2d')],'type':_0x12332a[_0x6746('0x2e')]['key']};});_0x50a86a[_0x6746('0x2f')]=_['map'](_0x51118b,_0x6746('0x28'));_0x50a86a['query']=_[_0x6746('0x30')](_0x28834c[_0x6746('0x31')]);_0x50a86a['filters']=_[_0x6746('0x32')](_0x50a86a[_0x6746('0x2f')],_0x50a86a[_0x6746('0x31')]);_0x59b291[_0x6746('0x33')]=_['intersection'](_0x50a86a[_0x6746('0x2f')],qs[_0x6746('0x34')](_0x28834c[_0x6746('0x31')]['fields']));_0x59b291[_0x6746('0x33')]=_0x59b291[_0x6746('0x33')]['length']?_0x59b291[_0x6746('0x33')]:_0x50a86a[_0x6746('0x2f')];if(!_0x28834c[_0x6746('0x31')]['hasOwnProperty'](_0x6746('0x35'))){_0x59b291[_0x6746('0x1b')]=qs[_0x6746('0x1b')](_0x28834c[_0x6746('0x31')]['limit']);_0x59b291[_0x6746('0x1a')]=qs[_0x6746('0x1a')](_0x28834c[_0x6746('0x31')]['offset']);}_0x59b291[_0x6746('0x36')]=qs['sort'](_0x28834c[_0x6746('0x31')]['sort']);_0x59b291[_0x6746('0x37')]=qs['filters'](_['pick'](_0x28834c[_0x6746('0x31')],_0x50a86a[_0x6746('0x38')]),_0x51118b);if(_0x28834c[_0x6746('0x31')][_0x6746('0x39')]){_0x59b291[_0x6746('0x37')]=_['merge'](_0x59b291['where'],{'$or':_[_0x6746('0x2b')](_0x51118b,function(_0x573ce4){if(_0x573ce4['type']!==_0x6746('0x3a')){var _0x13600a={};_0x13600a[_0x573ce4[_0x6746('0x28')]]={'$like':'%'+_0x28834c[_0x6746('0x31')][_0x6746('0x39')]+'%'};return _0x13600a;}})});}_0x59b291=_[_0x6746('0x3b')]({},_0x59b291,_0x28834c[_0x6746('0x3c')]);var _0xadf87a={'where':_0x59b291[_0x6746('0x37')]};return db[_0x6746('0x3d')][_0x6746('0x1d')](_0xadf87a)['then'](function(_0x26bc26){_0x909973['count']=_0x26bc26;if(_0x28834c[_0x6746('0x31')][_0x6746('0x3e')]){_0x59b291[_0x6746('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x6746('0x40')](_0x59b291);})[_0x6746('0x24')](function(_0x17bfbc){_0x909973[_0x6746('0x41')]=_0x17bfbc;return _0x909973;})['then'](respondWithFilteredResult(_0x2f4cb5,_0x59b291))[_0x6746('0x42')](handleError(_0x2f4cb5,null));};exports[_0x6746('0x43')]=function(_0x4c805b,_0x40582d){var _0x234509={'raw':!![],'where':{'id':_0x4c805b['params']['id']}},_0x3c335f={};_0x3c335f['model']=_[_0x6746('0x30')](db['SquareDetailsReport'][_0x6746('0x2c')]);_0x3c335f['query']=_[_0x6746('0x30')](_0x4c805b[_0x6746('0x31')]);_0x3c335f[_0x6746('0x38')]=_[_0x6746('0x32')](_0x3c335f['model'],_0x3c335f[_0x6746('0x31')]);_0x234509[_0x6746('0x33')]=_['intersection'](_0x3c335f[_0x6746('0x2f')],qs[_0x6746('0x34')](_0x4c805b[_0x6746('0x31')][_0x6746('0x34')]));_0x234509[_0x6746('0x33')]=_0x234509[_0x6746('0x33')]['length']?_0x234509[_0x6746('0x33')]:_0x3c335f[_0x6746('0x2f')];if(_0x4c805b[_0x6746('0x31')][_0x6746('0x3e')]){_0x234509[_0x6746('0x3f')]=[{'all':!![]}];}_0x234509=_[_0x6746('0x3b')]({},_0x234509,_0x4c805b[_0x6746('0x3c')]);return db[_0x6746('0x3d')][_0x6746('0x44')](_0x234509)[_0x6746('0x24')](handleEntityNotFound(_0x40582d,null))['then'](respondWithResult(_0x40582d,null))[_0x6746('0x42')](handleError(_0x40582d,null));};exports[_0x6746('0x45')]=function(_0x10613a,_0x48ddff){return db['SquareDetailsReport']['create'](_0x10613a[_0x6746('0x46')],{})[_0x6746('0x24')](respondWithResult(_0x48ddff,0xc9))['catch'](handleError(_0x48ddff,null));};exports['update']=function(_0x2c94d4,_0x2573de){if(_0x2c94d4[_0x6746('0x46')]['id']){delete _0x2c94d4[_0x6746('0x46')]['id'];}return db[_0x6746('0x3d')]['find']({'where':{'id':_0x2c94d4[_0x6746('0x47')]['id']}})['then'](handleEntityNotFound(_0x2573de,null))[_0x6746('0x24')](saveUpdates(_0x2c94d4[_0x6746('0x46')],null))[_0x6746('0x24')](respondWithResult(_0x2573de,null))[_0x6746('0x42')](handleError(_0x2573de,null));};exports['destroy']=function(_0x23b04e,_0x152c00){return db[_0x6746('0x3d')][_0x6746('0x44')]({'where':{'id':_0x23b04e['params']['id']}})[_0x6746('0x24')](handleEntityNotFound(_0x152c00,null))[_0x6746('0x24')](removeEntity(_0x152c00,null))['catch'](handleError(_0x152c00,null));};exports['describe']=function(_0x240df9,_0x3c2728){return db['SquareDetailsReport'][_0x6746('0x48')]()[_0x6746('0x24')](respondWithResult(_0x3c2728,null))[_0x6746('0x42')](handleError(_0x3c2728,null));}; \ No newline at end of file +var _0x53f8=['to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','Content-Range','save','update','then','destroy','sendStatus','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','nolimit','order','sort','pick','filters','filter','where','merge','count','includeAll','findAll','catch','show','keys','intersection','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x53f8,0x15a));var _0x853f=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x53f8[_0x166742];return _0xb7814a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x853f('0x0'));var zipdir=require(_0x853f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x853f('0x2'));var moment=require(_0x853f('0x3'));var BPromise=require(_0x853f('0x4'));var Mustache=require(_0x853f('0x5'));var util=require(_0x853f('0x6'));var path=require(_0x853f('0x7'));var sox=require(_0x853f('0x8'));var csv=require(_0x853f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x853f('0xa'));var _=require(_0x853f('0xb'));var squel=require('squel');var crypto=require(_0x853f('0xc'));var jsforce=require(_0x853f('0xd'));var deskjs=require(_0x853f('0xe'));var toCsv=require(_0x853f('0x9'));var querystring=require(_0x853f('0xf'));var Papa=require(_0x853f('0x10'));var Redis=require(_0x853f('0x11'));var authService=require(_0x853f('0x12'));var qs=require(_0x853f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x853f('0x14'));var logger=require(_0x853f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x853f('0x16'));var licenseUtil=require(_0x853f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x117b55,_0x26f173){_0x26f173=_0x26f173||0xcc;return function(_0x5d30f3){if(_0x5d30f3){return _0x117b55['sendStatus'](_0x26f173);}return _0x117b55[_0x853f('0x18')](_0x26f173)[_0x853f('0x19')]();};}function respondWithResult(_0x250300,_0x4fe21c){_0x4fe21c=_0x4fe21c||0xc8;return function(_0x54b07d){if(_0x54b07d){return _0x250300['status'](_0x4fe21c)[_0x853f('0x1a')](_0x54b07d);}};}function respondWithFilteredResult(_0x3c7c02,_0x55f46a){return function(_0x2b1235){if(_0x2b1235){var _0x50dce1=typeof _0x55f46a[_0x853f('0x1b')]==='undefined'&&typeof _0x55f46a[_0x853f('0x1c')]===_0x853f('0x1d');var _0x3546ba=_0x2b1235['count'];var _0x207eed=_0x50dce1?0x0:_0x55f46a['offset'];var _0x185b26=_0x50dce1?_0x2b1235['count']:_0x55f46a['offset']+_0x55f46a[_0x853f('0x1c')];var _0x16aefe;if(_0x185b26>=_0x3546ba){_0x185b26=_0x3546ba;_0x16aefe=0xc8;}else{_0x16aefe=0xce;}_0x3c7c02[_0x853f('0x18')](_0x16aefe);return _0x3c7c02['set'](_0x853f('0x1e'),_0x207eed+'-'+_0x185b26+'/'+_0x3546ba)['json'](_0x2b1235);}return null;};}function patchUpdates(_0x5cfa60){return function(_0x5172c0){try{jsonpatch['apply'](_0x5172c0,_0x5cfa60,!![]);}catch(_0x378409){return BPromise['reject'](_0x378409);}return _0x5172c0[_0x853f('0x1f')]();};}function saveUpdates(_0x4bdfe0,_0x5b08e8){return function(_0x51d0d5){if(_0x51d0d5){return _0x51d0d5[_0x853f('0x20')](_0x4bdfe0)[_0x853f('0x21')](function(_0x2801f5){return _0x2801f5;});}return null;};}function removeEntity(_0x2cc0a7,_0x3565fe){return function(_0x34bc2a){if(_0x34bc2a){return _0x34bc2a[_0x853f('0x22')]()[_0x853f('0x21')](function(){_0x2cc0a7[_0x853f('0x18')](0xcc)[_0x853f('0x19')]();});}};}function handleEntityNotFound(_0x232d81,_0x1403f0){return function(_0x3f9eeb){if(!_0x3f9eeb){_0x232d81[_0x853f('0x23')](0x194);}return _0x3f9eeb;};}function handleError(_0x5bde5a,_0x3d69ac){_0x3d69ac=_0x3d69ac||0x1f4;return function(_0x711a64){logger[_0x853f('0x24')](_0x711a64['stack']);if(_0x711a64[_0x853f('0x25')]){delete _0x711a64[_0x853f('0x25')];}_0x5bde5a[_0x853f('0x18')](_0x3d69ac)[_0x853f('0x26')](_0x711a64);};}exports['index']=function(_0x19aca7,_0x35c0c7){var _0x41524b={},_0x19264a={},_0x32f4e0={'count':0x0,'rows':[]};var _0x3f6409=_[_0x853f('0x27')](db[_0x853f('0x28')][_0x853f('0x29')],function(_0x30bde3){return{'name':_0x30bde3[_0x853f('0x2a')],'type':_0x30bde3[_0x853f('0x2b')][_0x853f('0x2c')]};});_0x19264a[_0x853f('0x2d')]=_['map'](_0x3f6409,'name');_0x19264a['query']=_['keys'](_0x19aca7[_0x853f('0x2e')]);_0x19264a['filters']=_['intersection'](_0x19264a[_0x853f('0x2d')],_0x19264a['query']);_0x41524b[_0x853f('0x2f')]=_['intersection'](_0x19264a[_0x853f('0x2d')],qs['fields'](_0x19aca7[_0x853f('0x2e')][_0x853f('0x30')]));_0x41524b[_0x853f('0x2f')]=_0x41524b['attributes'][_0x853f('0x31')]?_0x41524b['attributes']:_0x19264a[_0x853f('0x2d')];if(!_0x19aca7[_0x853f('0x2e')]['hasOwnProperty'](_0x853f('0x32'))){_0x41524b['limit']=qs[_0x853f('0x1c')](_0x19aca7[_0x853f('0x2e')][_0x853f('0x1c')]);_0x41524b[_0x853f('0x1b')]=qs[_0x853f('0x1b')](_0x19aca7[_0x853f('0x2e')][_0x853f('0x1b')]);}_0x41524b[_0x853f('0x33')]=qs[_0x853f('0x34')](_0x19aca7[_0x853f('0x2e')][_0x853f('0x34')]);_0x41524b['where']=qs['filters'](_[_0x853f('0x35')](_0x19aca7[_0x853f('0x2e')],_0x19264a[_0x853f('0x36')]),_0x3f6409);if(_0x19aca7[_0x853f('0x2e')][_0x853f('0x37')]){_0x41524b[_0x853f('0x38')]=_[_0x853f('0x39')](_0x41524b[_0x853f('0x38')],{'$or':_[_0x853f('0x27')](_0x3f6409,function(_0x8ceb7e){if(_0x8ceb7e['type']!=='VIRTUAL'){var _0x1ad801={};_0x1ad801[_0x8ceb7e[_0x853f('0x25')]]={'$like':'%'+_0x19aca7[_0x853f('0x2e')][_0x853f('0x37')]+'%'};return _0x1ad801;}})});}_0x41524b=_[_0x853f('0x39')]({},_0x41524b,_0x19aca7['options']);var _0x18ed68={'where':_0x41524b['where']};return db[_0x853f('0x28')]['count'](_0x18ed68)[_0x853f('0x21')](function(_0x50f1cd){_0x32f4e0[_0x853f('0x3a')]=_0x50f1cd;if(_0x19aca7[_0x853f('0x2e')][_0x853f('0x3b')]){_0x41524b['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x853f('0x3c')](_0x41524b);})[_0x853f('0x21')](function(_0x1f296d){_0x32f4e0['rows']=_0x1f296d;return _0x32f4e0;})[_0x853f('0x21')](respondWithFilteredResult(_0x35c0c7,_0x41524b))[_0x853f('0x3d')](handleError(_0x35c0c7,null));};exports[_0x853f('0x3e')]=function(_0x5d15af,_0x4b72d9){var _0x3a84f7={'raw':!![],'where':{'id':_0x5d15af['params']['id']}},_0x30066c={};_0x30066c['model']=_[_0x853f('0x3f')](db[_0x853f('0x28')][_0x853f('0x29')]);_0x30066c[_0x853f('0x2e')]=_[_0x853f('0x3f')](_0x5d15af[_0x853f('0x2e')]);_0x30066c['filters']=_[_0x853f('0x40')](_0x30066c[_0x853f('0x2d')],_0x30066c[_0x853f('0x2e')]);_0x3a84f7[_0x853f('0x2f')]=_[_0x853f('0x40')](_0x30066c[_0x853f('0x2d')],qs['fields'](_0x5d15af[_0x853f('0x2e')][_0x853f('0x30')]));_0x3a84f7[_0x853f('0x2f')]=_0x3a84f7['attributes'][_0x853f('0x31')]?_0x3a84f7['attributes']:_0x30066c[_0x853f('0x2d')];if(_0x5d15af['query'][_0x853f('0x3b')]){_0x3a84f7['include']=[{'all':!![]}];}_0x3a84f7=_[_0x853f('0x39')]({},_0x3a84f7,_0x5d15af[_0x853f('0x41')]);return db[_0x853f('0x28')][_0x853f('0x42')](_0x3a84f7)[_0x853f('0x21')](handleEntityNotFound(_0x4b72d9,null))[_0x853f('0x21')](respondWithResult(_0x4b72d9,null))['catch'](handleError(_0x4b72d9,null));};exports['create']=function(_0x48a3fd,_0x5b4a2a){return db[_0x853f('0x28')][_0x853f('0x43')](_0x48a3fd[_0x853f('0x44')],{})[_0x853f('0x21')](respondWithResult(_0x5b4a2a,0xc9))[_0x853f('0x3d')](handleError(_0x5b4a2a,null));};exports['update']=function(_0x21e92c,_0x55c119){if(_0x21e92c[_0x853f('0x44')]['id']){delete _0x21e92c[_0x853f('0x44')]['id'];}return db[_0x853f('0x28')][_0x853f('0x42')]({'where':{'id':_0x21e92c[_0x853f('0x45')]['id']}})[_0x853f('0x21')](handleEntityNotFound(_0x55c119,null))[_0x853f('0x21')](saveUpdates(_0x21e92c[_0x853f('0x44')],null))['then'](respondWithResult(_0x55c119,null))[_0x853f('0x3d')](handleError(_0x55c119,null));};exports[_0x853f('0x22')]=function(_0x407d05,_0x311ef6){return db['SquareDetailsReport'][_0x853f('0x42')]({'where':{'id':_0x407d05['params']['id']}})[_0x853f('0x21')](handleEntityNotFound(_0x311ef6,null))[_0x853f('0x21')](removeEntity(_0x311ef6,null))[_0x853f('0x3d')](handleError(_0x311ef6,null));};exports[_0x853f('0x46')]=function(_0x536939,_0x518c99){return db[_0x853f('0x28')]['describe']()['then'](respondWithResult(_0x518c99,null))['catch'](handleError(_0x518c99,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ca5f3ec..e43be2f 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 _0x03f1=['api','moment','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash'];(function(_0x193c7e,_0x4d2154){var _0x352098=function(_0x13c24c){while(--_0x13c24c){_0x193c7e['push'](_0x193c7e['shift']());}};_0x352098(++_0x4d2154);}(_0x03f1,0xb3));var _0x103f=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x03f1[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x103f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x103f('0x1'));var moment=require(_0x103f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x103f('0x3'));var config=require(_0x103f('0x4'));var attributes=require(_0x103f('0x5'));module['exports']=function(_0x16fb0d,_0x4a1de2){return _0x16fb0d[_0x103f('0x6')](_0x103f('0x7'),attributes,{'tableName':_0x103f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe63c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','report_square_details','util'];(function(_0x333ebb,_0x36693a){var _0x1d8f86=function(_0x31b6f5){while(--_0x31b6f5){_0x333ebb['push'](_0x333ebb['shift']());}};_0x1d8f86(++_0x36693a);}(_0xe63c,0x1a3));var _0xce63=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xe63c[_0x1f0724];return _0x253ffb;};'use strict';var _=require('lodash');var util=require(_0xce63('0x0'));var logger=require(_0xce63('0x1'))(_0xce63('0x2'));var moment=require(_0xce63('0x3'));var BPromise=require(_0xce63('0x4'));var rp=require(_0xce63('0x5'));var fs=require('fs');var path=require(_0xce63('0x6'));var rimraf=require(_0xce63('0x7'));var config=require(_0xce63('0x8'));var attributes=require(_0xce63('0x9'));module['exports']=function(_0xe3755e,_0xf7f998){return _0xe3755e[_0xce63('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xce63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index b30d52a..0c88b1d 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 _0x4b17=['SquareDetailsReport,\x20%s,\x20%s','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x4b17,0x10f));var _0x74b1=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x4b17[_0x20845e];return _0x28cf2b;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371c3b,_0x191d2b,_0x16761b){return new BPromise(function(_0x4c293c,_0x287e3e){return client[_0x74b1('0x9')](_0x371c3b,_0x16761b)[_0x74b1('0xa')](function(_0x25382b){logger[_0x74b1('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'));logger[_0x74b1('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'),JSON[_0x74b1('0xe')](_0x25382b));if(_0x25382b[_0x74b1('0xf')]){if(_0x25382b[_0x74b1('0xf')]['code']===0x1f4){logger[_0x74b1('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x191d2b,_0x25382b['error'][_0x74b1('0x10')]);return _0x287e3e(_0x25382b[_0x74b1('0xf')]['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x191d2b,_0x25382b[_0x74b1('0xf')]['message']);return _0x4c293c(_0x25382b['error'][_0x74b1('0x10')]);}else{logger[_0x74b1('0xb')](_0x74b1('0x11'),_0x191d2b,_0x74b1('0xc'));_0x4c293c(_0x25382b[_0x74b1('0x12')][_0x74b1('0x10')]);}})['catch'](function(_0x6237be){logger[_0x74b1('0xf')](_0x74b1('0x11'),_0x191d2b,_0x6237be);_0x287e3e(_0x6237be);});});}exports[_0x74b1('0x13')]=function(_0xde2736){var _0x8c9510=this;return new Promise(function(_0x1ab838,_0x4bb3d2){return db[_0x74b1('0x14')][_0x74b1('0x15')](_0xde2736['body'],{'raw':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![]})[_0x74b1('0xa')](function(_0x13bb44){logger[_0x74b1('0xb')](_0x74b1('0x13'),_0xde2736);logger[_0x74b1('0xd')]('CreateSquareDetailsReport',_0xde2736,JSON[_0x74b1('0xe')](_0x13bb44));_0x1ab838(_0x13bb44);})['catch'](function(_0x5da0f7){logger['error'](_0x74b1('0x13'),_0x5da0f7[_0x74b1('0x10')],_0xde2736);_0x4bb3d2(_0x8c9510[_0x74b1('0xf')](0x1f4,_0x5da0f7[_0x74b1('0x10')]));});});}; \ No newline at end of file +var _0xe493=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','create','options','raw','lodash','util','moment','bluebird'];(function(_0x15e80a,_0x530b9d){var _0xeba70e=function(_0x5a5e68){while(--_0x5a5e68){_0x15e80a['push'](_0x15e80a['shift']());}};_0xeba70e(++_0x530b9d);}(_0xe493,0x7e));var _0x3e49=function(_0x35db52,_0x1fd62c){_0x35db52=_0x35db52-0x0;var _0x448118=_0xe493[_0x35db52];return _0x448118;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});}exports[_0x3e49('0x16')]=function(_0x3ae5f4){var _0x448c36=this;return new Promise(function(_0x4e1cdf,_0xf33205){return db['SquareDetailsReport'][_0x3e49('0x17')](_0x3ae5f4['body'],{'raw':_0x3ae5f4[_0x3e49('0x18')]?_0x3ae5f4['options'][_0x3e49('0x19')]===undefined?!![]:![]:!![]})[_0x3e49('0xb')](function(_0x420d7b){logger['info'](_0x3e49('0x16'),_0x3ae5f4);logger['debug'](_0x3e49('0x16'),_0x3ae5f4,JSON[_0x3e49('0x11')](_0x420d7b));_0x4e1cdf(_0x420d7b);})[_0x3e49('0x15')](function(_0x5e0f1d){logger['error'](_0x3e49('0x16'),_0x5e0f1d['message'],_0x3ae5f4);_0xf33205(_0x448c36[_0x3e49('0x12')](0x1f4,_0x5e0f1d[_0x3e49('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1d23a19..d158214 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 _0xbea3=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x4db4f8,_0xe4b5ca){var _0x48fd0b=function(_0x1cad3b){while(--_0x1cad3b){_0x4db4f8['push'](_0x4db4f8['shift']());}};_0x48fd0b(++_0xe4b5ca);}(_0xbea3,0x1c2));var _0x3bea=function(_0xf5500a,_0x23ba50){_0xf5500a=_0xf5500a-0x0;var _0x5192f1=_0xbea3[_0xf5500a];return _0x5192f1;};'use strict';var express=require(_0x3bea('0x0'));var router=express[_0x3bea('0x1')]();var auth=require(_0x3bea('0x2'));var controller=require(_0x3bea('0x3'));router[_0x3bea('0x4')]('/',auth[_0x3bea('0x5')](),controller[_0x3bea('0x6')]);router[_0x3bea('0x4')](_0x3bea('0x7'),auth['isAuthenticated'](),controller[_0x3bea('0x8')]);module['exports']=router; \ No newline at end of file +var _0x4e28=['exports','express','./system.controller','get','isAuthenticated','index','killProcess'];(function(_0x3e9832,_0x37e43f){var _0x20b148=function(_0x42a334){while(--_0x42a334){_0x3e9832['push'](_0x3e9832['shift']());}};_0x20b148(++_0x37e43f);}(_0x4e28,0xda));var _0x84e2=function(_0x7b87e7,_0x4d5fcb){_0x7b87e7=_0x7b87e7-0x0;var _0x2f812c=_0x4e28[_0x7b87e7];return _0x2f812c;};'use strict';var express=require(_0x84e2('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x84e2('0x1'));router[_0x84e2('0x2')]('/',auth[_0x84e2('0x3')](),controller[_0x84e2('0x4')]);router['get']('/process/:pid/kill',auth[_0x84e2('0x3')](),controller[_0x84e2('0x5')]);module[_0x84e2('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6c62a70..f261174 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 _0xb4d0=['catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json'];(function(_0x2d9359,_0x52473b){var _0x3fe0ef=function(_0x4560ab){while(--_0x4560ab){_0x2d9359['push'](_0x2d9359['shift']());}};_0x3fe0ef(++_0x52473b);}(_0xb4d0,0x1cd));var _0x0b4d=function(_0x5d5695,_0x3307cf){_0x5d5695=_0x5d5695-0x0;var _0x103413=_0xb4d0[_0x5d5695];return _0x103413;};'use strict';var info=require(_0x0b4d('0x0'));var exec=require(_0x0b4d('0x1'))['exec'];var logger=require(_0x0b4d('0x2'))('api');var util=require(_0x0b4d('0x3'));var BPromise=require(_0x0b4d('0x4'));var _=require('lodash');function handleError(_0x40c5f5,_0xd47b36,_0x1ac7bf){_0xd47b36=_0xd47b36||0x1f4;return function(_0x535356){logger[_0x0b4d('0x5')](_0x0b4d('0x6'),_0x1ac7bf,_0xd47b36,util[_0x0b4d('0x7')](_0x535356,{'showHidden':![],'depth':null}));delete _0x535356[_0x0b4d('0x8')];_0x40c5f5[_0x0b4d('0x9')](_0xd47b36)['send'](_0x535356);};}exports[_0x0b4d('0xa')]=function(_0x5daa4d,_0x35fc6c){return info[_0x0b4d('0xb')]()[_0x0b4d('0xc')](function(_0x35353c){return _0x35fc6c[_0x0b4d('0x9')](0xc8)[_0x0b4d('0xd')](_0x35353c);})[_0x0b4d('0xe')](function(_0x5f5805){return _0x35fc6c[_0x0b4d('0x9')](0x1f4)[_0x0b4d('0xd')](_0x5f5805);});};exports[_0x0b4d('0xf')]=function(_0x4c69c4,_0x40ed5b){var _0x5d4a6a=['components/import/cm'];return new BPromise(function(_0x12d86c,_0x2d9fc0){return exec(util[_0x0b4d('0x10')](_0x0b4d('0x11'),_0x4c69c4[_0x0b4d('0x12')][_0x0b4d('0x13')]),function(_0x4bd477,_0x2b28aa,_0x1a196f){if(_0x4bd477){return _0x2d9fc0(_0x4bd477);}return _0x12d86c(_0x2b28aa);});})[_0x0b4d('0xc')](function(_0x38f378){var _0x39dd7e=![];var _0x5d1ce5=_0x38f378[_0x0b4d('0x14')](/\n/);for(var _0x256be4=0x0,_0x1bbd4e=_0x5d4a6a[_0x0b4d('0x15')];_0x256be4<_0x1bbd4e,_0x39dd7e===![];_0x256be4+=0x1){if(_0x38f378[_0x0b4d('0x16')](_0x5d4a6a[_0x256be4])>=0x0){_0x39dd7e=!![];}}if(!_0x39dd7e){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4c69c4['params'][_0x0b4d('0x13')]));}process['kill'](_0x4c69c4['params']['pid'],_0x0b4d('0x17'));return _0x40ed5b['status'](0xc8)[_0x0b4d('0xd')]({'message':util['format'](_0x0b4d('0x18'),_0x4c69c4[_0x0b4d('0x12')][_0x0b4d('0x13')])});})[_0x0b4d('0xe')](handleError(_0x40ed5b,null,_0x0b4d('0xf')));}; \ No newline at end of file +var _0xb378=['status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','pid','split','length','indexOf','kill','SIGINT','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x8f536c,_0x49dbba){var _0x26aac9=function(_0x34ebd8){while(--_0x34ebd8){_0x8f536c['push'](_0x8f536c['shift']());}};_0x26aac9(++_0x49dbba);}(_0xb378,0xad));var _0x8b37=function(_0x5b8a3a,_0x55e356){_0x5b8a3a=_0x5b8a3a-0x0;var _0x5a95f7=_0xb378[_0x5b8a3a];return _0x5a95f7;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x8b37('0x0')];var logger=require(_0x8b37('0x1'))(_0x8b37('0x2'));var util=require('util');var BPromise=require(_0x8b37('0x3'));var _=require(_0x8b37('0x4'));function handleError(_0x5e5443,_0x16612a,_0x259b05){_0x16612a=_0x16612a||0x1f4;return function(_0x245311){logger[_0x8b37('0x5')](_0x8b37('0x6'),_0x259b05,_0x16612a,util[_0x8b37('0x7')](_0x245311,{'showHidden':![],'depth':null}));delete _0x245311[_0x8b37('0x8')];_0x5e5443[_0x8b37('0x9')](_0x16612a)[_0x8b37('0xa')](_0x245311);};}exports[_0x8b37('0xb')]=function(_0x3c8e0f,_0x5f3083){return info[_0x8b37('0xc')]()[_0x8b37('0xd')](function(_0x2fbd15){return _0x5f3083[_0x8b37('0x9')](0xc8)[_0x8b37('0xe')](_0x2fbd15);})[_0x8b37('0xf')](function(_0x5939d0){return _0x5f3083[_0x8b37('0x9')](0x1f4)[_0x8b37('0xe')](_0x5939d0);});};exports[_0x8b37('0x10')]=function(_0x99be3a,_0x3f663d){var _0x2f57d0=[_0x8b37('0x11')];return new BPromise(function(_0x1b0b68,_0x39f3fa){return exec(util[_0x8b37('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')]),function(_0x1781a5,_0x3acc4c,_0x138f3a){if(_0x1781a5){return _0x39f3fa(_0x1781a5);}return _0x1b0b68(_0x3acc4c);});})['then'](function(_0x50abc3){var _0x15e54c=![];var _0x282cbb=_0x50abc3[_0x8b37('0x15')](/\n/);for(var _0x2a1caa=0x0,_0x2bcf27=_0x2f57d0[_0x8b37('0x16')];_0x2a1caa<_0x2bcf27,_0x15e54c===![];_0x2a1caa+=0x1){if(_0x50abc3[_0x8b37('0x17')](_0x2f57d0[_0x2a1caa])>=0x0){_0x15e54c=!![];}}if(!_0x15e54c){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')]));}process[_0x8b37('0x18')](_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')],_0x8b37('0x19'));return _0x3f663d['status'](0xc8)[_0x8b37('0xe')]({'message':util[_0x8b37('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x99be3a[_0x8b37('0x13')][_0x8b37('0x14')])});})[_0x8b37('0xf')](handleError(_0x3f663d,null,_0x8b37('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b987514..6469ee2 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 _0xb077=['index','get','/:id','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./tag.controller','isAuthenticated'];(function(_0x9b51a7,_0xe90272){var _0x5ce09f=function(_0x1b5848){while(--_0x1b5848){_0x9b51a7['push'](_0x9b51a7['shift']());}};_0x5ce09f(++_0xe90272);}(_0xb077,0x1c6));var _0x7b07=function(_0x538364,_0x2c1b35){_0x538364=_0x538364-0x0;var _0x13505d=_0xb077[_0x538364];return _0x13505d;};'use strict';var multer=require(_0x7b07('0x0'));var util=require(_0x7b07('0x1'));var path=require(_0x7b07('0x2'));var timeout=require(_0x7b07('0x3'));var express=require(_0x7b07('0x4'));var router=express[_0x7b07('0x5')]();var fs_extra=require(_0x7b07('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7b07('0x7'));var controller=require(_0x7b07('0x8'));router['get']('/',auth[_0x7b07('0x9')](),controller[_0x7b07('0xa')]);router[_0x7b07('0xb')](_0x7b07('0xc'),auth[_0x7b07('0x9')](),controller['show']);router['post']('/',auth[_0x7b07('0x9')](),controller[_0x7b07('0xd')]);router['put'](_0x7b07('0xc'),auth[_0x7b07('0x9')](),controller[_0x7b07('0xe')]);router['delete'](_0x7b07('0xc'),auth[_0x7b07('0x9')](),controller[_0x7b07('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf65d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','isAuthenticated','show','post','create','put','delete','/:id','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf65d,0x9f));var _0xdf65=function(_0x3e0e6c,_0x4757cd){_0x3e0e6c=_0x3e0e6c-0x0;var _0xad2be9=_0xf65d[_0x3e0e6c];return _0xad2be9;};'use strict';var multer=require(_0xdf65('0x0'));var util=require('util');var path=require(_0xdf65('0x1'));var timeout=require(_0xdf65('0x2'));var express=require(_0xdf65('0x3'));var router=express[_0xdf65('0x4')]();var fs_extra=require(_0xdf65('0x5'));var auth=require(_0xdf65('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./tag.controller');router[_0xdf65('0x7')]('/',auth['isAuthenticated'](),controller[_0xdf65('0x8')]);router[_0xdf65('0x7')]('/:id',auth[_0xdf65('0x9')](),controller[_0xdf65('0xa')]);router[_0xdf65('0xb')]('/',auth[_0xdf65('0x9')](),controller[_0xdf65('0xc')]);router[_0xdf65('0xd')]('/:id',auth[_0xdf65('0x9')](),controller['update']);router[_0xdf65('0xe')](_0xdf65('0xf'),auth[_0xdf65('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 805b53a..baaca20 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 _0xa249=['exports','name','STRING','sequelize'];(function(_0x3a4b24,_0x35ef80){var _0x446d38=function(_0x2daee0){while(--_0x2daee0){_0x3a4b24['push'](_0x3a4b24['shift']());}};_0x446d38(++_0x35ef80);}(_0xa249,0x183));var _0x9a24=function(_0x10075b,_0x457f17){_0x10075b=_0x10075b-0x0;var _0x3718e1=_0xa249[_0x10075b];return _0x3718e1;};'use strict';var Sequelize=require(_0x9a24('0x0'));module[_0x9a24('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9a24('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9a24('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x9a24('0x3')]}}; \ No newline at end of file +var _0x7c59=['exports','STRING','name'];(function(_0x1af103,_0x589885){var _0x324769=function(_0x576c11){while(--_0x576c11){_0x1af103['push'](_0x1af103['shift']());}};_0x324769(++_0x589885);}(_0x7c59,0x147));var _0x97c5=function(_0x10063c,_0x3a8814){_0x10063c=_0x10063c-0x0;var _0x581d02=_0x7c59[_0x10063c];return _0x581d02;};'use strict';var Sequelize=require('sequelize');module[_0x97c5('0x0')]={'name':{'type':Sequelize[_0x97c5('0x1')],'unique':_0x97c5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x97c5('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x97c5('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d24def0..57b7093 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 _0x0bb5=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0xcf669d,_0x3769ae){var _0x4cfe39=function(_0x30f70b){while(--_0x30f70b){_0xcf669d['push'](_0xcf669d['shift']());}};_0x4cfe39(++_0x3769ae);}(_0x0bb5,0x148));var _0x50bb=function(_0x50b37f,_0x9a68e5){_0x50b37f=_0x50b37f-0x0;var _0x5dccd2=_0x0bb5[_0x50b37f];return _0x5dccd2;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){var _0xad17ac=_0x846311[_0x50bb('0x26')]({'plain':!![]});var _0x284a76=_0x50bb('0x27');return db['UserProfileResource'][_0x50bb('0x25')]({'where':{'type':_0x284a76,'resourceId':_0xad17ac['id']}})['then'](function(){return _0x846311;});})['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfe4b,_0x41fd89){return function(_0x12ee2c){if(!_0x12ee2c){_0x5cfe4b[_0x50bb('0x19')](0x194);}return _0x12ee2c;};}function handleError(_0x1b74f9,_0x17c158){_0x17c158=_0x17c158||0x1f4;return function(_0x269479){logger[_0x50bb('0x28')](_0x269479[_0x50bb('0x29')]);if(_0x269479['name']){delete _0x269479[_0x50bb('0x2a')];}_0x1b74f9[_0x50bb('0x1a')](_0x17c158)[_0x50bb('0x2b')](_0x269479);};}exports[_0x50bb('0x2c')]=function(_0x560b07,_0x13dc3c){var _0x1a62fb={},_0xc38da5={},_0xb3c3ba={'count':0x0,'rows':[]};var _0x3fd5f6=_[_0x50bb('0x2d')](db[_0x50bb('0x2e')][_0x50bb('0x2f')],function(_0x5cfdd5){return{'name':_0x5cfdd5[_0x50bb('0x30')],'type':_0x5cfdd5[_0x50bb('0x31')][_0x50bb('0x32')]};});_0xc38da5['model']=_[_0x50bb('0x2d')](_0x3fd5f6,_0x50bb('0x2a'));_0xc38da5[_0x50bb('0x33')]=_[_0x50bb('0x34')](_0x560b07[_0x50bb('0x33')]);_0xc38da5[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0xc38da5[_0x50bb('0x37')],_0xc38da5[_0x50bb('0x33')]);_0x1a62fb[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0xc38da5['model'],qs[_0x50bb('0x39')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x39')]));_0x1a62fb[_0x50bb('0x38')]=_0x1a62fb[_0x50bb('0x38')][_0x50bb('0x3a')]?_0x1a62fb['attributes']:_0xc38da5['model'];if(!_0x560b07[_0x50bb('0x33')]['hasOwnProperty'](_0x50bb('0x3b'))){_0x1a62fb[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1a62fb['offset']=qs[_0x50bb('0x1c')](_0x560b07['query'][_0x50bb('0x1c')]);}_0x1a62fb[_0x50bb('0x3d')]=qs[_0x50bb('0x3e')](_0x560b07['query']['sort']);_0x1a62fb[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x560b07[_0x50bb('0x33')],_0xc38da5['filters']),_0x3fd5f6);if(_0x560b07[_0x50bb('0x33')]['filter']){_0x1a62fb['where']=_[_0x50bb('0x41')](_0x1a62fb['where'],{'$or':_[_0x50bb('0x2d')](_0x3fd5f6,function(_0x3d94b8){if(_0x3d94b8[_0x50bb('0x31')]!==_0x50bb('0x42')){var _0x3a9fe4={};_0x3a9fe4[_0x3d94b8[_0x50bb('0x2a')]]={'$like':'%'+_0x560b07[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0x3a9fe4;}})});}_0x1a62fb=_[_0x50bb('0x41')]({},_0x1a62fb,_0x560b07[_0x50bb('0x44')]);var _0x594f16={'where':_0x1a62fb['where']};return db[_0x50bb('0x2e')][_0x50bb('0x1e')](_0x594f16)[_0x50bb('0x24')](function(_0x1d929d){_0xb3c3ba['count']=_0x1d929d;if(_0x560b07[_0x50bb('0x33')]['includeAll']){_0x1a62fb[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2e')][_0x50bb('0x46')](_0x1a62fb);})[_0x50bb('0x24')](function(_0x1c438b){_0xb3c3ba[_0x50bb('0x47')]=_0x1c438b;return _0xb3c3ba;})[_0x50bb('0x24')](respondWithFilteredResult(_0x13dc3c,_0x1a62fb))[_0x50bb('0x48')](handleError(_0x13dc3c,null));};exports[_0x50bb('0x49')]=function(_0x46c1c3,_0x349474){var _0x24e375={'raw':!![],'where':{'id':_0x46c1c3[_0x50bb('0x4a')]['id']}},_0x85b0ff={};_0x85b0ff[_0x50bb('0x37')]=_[_0x50bb('0x34')](db['Tag'][_0x50bb('0x2f')]);_0x85b0ff['query']=_[_0x50bb('0x34')](_0x46c1c3[_0x50bb('0x33')]);_0x85b0ff[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],_0x85b0ff[_0x50bb('0x33')]);_0x24e375[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x39')]));_0x24e375[_0x50bb('0x38')]=_0x24e375[_0x50bb('0x38')]['length']?_0x24e375[_0x50bb('0x38')]:_0x85b0ff['model'];if(_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x4b')]){_0x24e375[_0x50bb('0x45')]=[{'all':!![]}];}_0x24e375=_[_0x50bb('0x41')]({},_0x24e375,_0x46c1c3[_0x50bb('0x44')]);return db[_0x50bb('0x2e')][_0x50bb('0x4c')](_0x24e375)[_0x50bb('0x24')](handleEntityNotFound(_0x349474,null))['then'](respondWithResult(_0x349474,null))[_0x50bb('0x48')](handleError(_0x349474,null));};exports[_0x50bb('0x4d')]=function(_0xf52a22,_0x13afe2){return db[_0x50bb('0x2e')]['create'](_0xf52a22[_0x50bb('0x4e')],{})[_0x50bb('0x24')](function(_0x2a411d){var _0x154ff8=_0xf52a22[_0x50bb('0x4f')]['get']({'plain':!![]});if(!_0x154ff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154ff8[_0x50bb('0x50')]==='user'){var _0x357d08=_0x2a411d['get']({'plain':!![]});var _0x4316e4=_0x50bb('0x27');return db[_0x50bb('0x51')]['find']({'where':{'name':_0x4316e4,'userProfileId':_0x154ff8[_0x50bb('0x52')]},'raw':!![]})[_0x50bb('0x24')](function(_0x588dfe){if(_0x588dfe&&_0x588dfe[_0x50bb('0x53')]===0x0){return db[_0x50bb('0x54')][_0x50bb('0x4d')]({'name':_0x357d08[_0x50bb('0x2a')],'resourceId':_0x357d08['id'],'type':_0x588dfe['name'],'sectionId':_0x588dfe['id']},{})[_0x50bb('0x24')](function(){return _0x2a411d;});}else{return _0x2a411d;}})[_0x50bb('0x48')](function(_0x2e0032){logger[_0x50bb('0x28')](_0x50bb('0x55'),_0x2e0032);throw _0x2e0032;});}return _0x2a411d;})['then'](respondWithResult(_0x13afe2,0xc9))[_0x50bb('0x48')](handleError(_0x13afe2,null));};exports['update']=function(_0x38a775,_0x50216f){if(_0x38a775['body']['id']){delete _0x38a775[_0x50bb('0x4e')]['id'];}return db['Tag']['find']({'where':{'id':_0x38a775[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x50216f,null))[_0x50bb('0x24')](saveUpdates(_0x38a775[_0x50bb('0x4e')],null))[_0x50bb('0x24')](respondWithResult(_0x50216f,null))[_0x50bb('0x48')](handleError(_0x50216f,null));};exports[_0x50bb('0x25')]=function(_0x1408fa,_0x57d749){return db['Tag'][_0x50bb('0x4c')]({'where':{'id':_0x1408fa[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x57d749,null))[_0x50bb('0x24')](removeEntity(_0x57d749,null))[_0x50bb('0x48')](handleError(_0x57d749,null));}; \ No newline at end of file +var _0xe600=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Tag','includeAll','include','catch','show','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','fast-json-patch','request-promise'];(function(_0x4ea61a,_0x1eb61b){var _0x46c957=function(_0x591f24){while(--_0x591f24){_0x4ea61a['push'](_0x4ea61a['shift']());}};_0x46c957(++_0x1eb61b);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){var _0x4ba1a8=_0x41642c[_0x0e60('0x2a')]({'plain':!![]});var _0x41ad9a='Tags';return db[_0x0e60('0x2b')]['destroy']({'where':{'type':_0x41ad9a,'resourceId':_0x4ba1a8['id']}})[_0x0e60('0x28')](function(){return _0x41642c;});})['then'](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x39dae2,_0x526aaa){return function(_0x4eb9b8){if(!_0x4eb9b8){_0x39dae2[_0x0e60('0x1b')](0x194);}return _0x4eb9b8;};}function handleError(_0x54d7ce,_0x73e732){_0x73e732=_0x73e732||0x1f4;return function(_0x548919){logger['error'](_0x548919[_0x0e60('0x2c')]);if(_0x548919[_0x0e60('0x2d')]){delete _0x548919[_0x0e60('0x2d')];}_0x54d7ce['status'](_0x73e732)[_0x0e60('0x2e')](_0x548919);};}exports['index']=function(_0x2e22eb,_0x1d54c0){var _0x5beb5f={},_0x540c2c={},_0xc4a74c={'count':0x0,'rows':[]};var _0x1de60a=_[_0x0e60('0x2f')](db['Tag'][_0x0e60('0x30')],function(_0x3ea4ac){return{'name':_0x3ea4ac[_0x0e60('0x31')],'type':_0x3ea4ac[_0x0e60('0x32')][_0x0e60('0x33')]};});_0x540c2c['model']=_[_0x0e60('0x2f')](_0x1de60a,'name');_0x540c2c[_0x0e60('0x34')]=_['keys'](_0x2e22eb[_0x0e60('0x34')]);_0x540c2c[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x540c2c['model'],_0x540c2c[_0x0e60('0x34')]);_0x5beb5f[_0x0e60('0x37')]=_[_0x0e60('0x36')](_0x540c2c[_0x0e60('0x38')],qs[_0x0e60('0x39')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x39')]));_0x5beb5f[_0x0e60('0x37')]=_0x5beb5f[_0x0e60('0x37')][_0x0e60('0x3a')]?_0x5beb5f[_0x0e60('0x37')]:_0x540c2c[_0x0e60('0x38')];if(!_0x2e22eb['query'][_0x0e60('0x3b')](_0x0e60('0x3c'))){_0x5beb5f[_0x0e60('0x20')]=qs[_0x0e60('0x20')](_0x2e22eb['query']['limit']);_0x5beb5f[_0x0e60('0x1e')]=qs['offset'](_0x2e22eb[_0x0e60('0x34')]['offset']);}_0x5beb5f[_0x0e60('0x3d')]=qs[_0x0e60('0x3e')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x3e')]);_0x5beb5f[_0x0e60('0x3f')]=qs[_0x0e60('0x35')](_[_0x0e60('0x40')](_0x2e22eb[_0x0e60('0x34')],_0x540c2c[_0x0e60('0x35')]),_0x1de60a);if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x41')]){_0x5beb5f[_0x0e60('0x3f')]=_['merge'](_0x5beb5f[_0x0e60('0x3f')],{'$or':_['map'](_0x1de60a,function(_0x345a12){if(_0x345a12[_0x0e60('0x32')]!=='VIRTUAL'){var _0x482583={};_0x482583[_0x345a12[_0x0e60('0x2d')]]={'$like':'%'+_0x2e22eb[_0x0e60('0x34')]['filter']+'%'};return _0x482583;}})});}_0x5beb5f=_[_0x0e60('0x42')]({},_0x5beb5f,_0x2e22eb[_0x0e60('0x43')]);var _0x50090c={'where':_0x5beb5f[_0x0e60('0x3f')]};return db[_0x0e60('0x44')][_0x0e60('0x21')](_0x50090c)[_0x0e60('0x28')](function(_0x3ac0f0){_0xc4a74c[_0x0e60('0x21')]=_0x3ac0f0;if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x45')]){_0x5beb5f[_0x0e60('0x46')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x5beb5f);})['then'](function(_0x39c7d4){_0xc4a74c['rows']=_0x39c7d4;return _0xc4a74c;})[_0x0e60('0x28')](respondWithFilteredResult(_0x1d54c0,_0x5beb5f))[_0x0e60('0x47')](handleError(_0x1d54c0,null));};exports[_0x0e60('0x48')]=function(_0x4bfebf,_0x2b2354){var _0x2432a8={'raw':!![],'where':{'id':_0x4bfebf['params']['id']}},_0x4ce029={};_0x4ce029[_0x0e60('0x38')]=_[_0x0e60('0x49')](db[_0x0e60('0x44')][_0x0e60('0x30')]);_0x4ce029[_0x0e60('0x34')]=_[_0x0e60('0x49')](_0x4bfebf['query']);_0x4ce029[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x4ce029[_0x0e60('0x38')],_0x4ce029[_0x0e60('0x34')]);_0x2432a8[_0x0e60('0x37')]=_['intersection'](_0x4ce029['model'],qs['fields'](_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x39')]));_0x2432a8[_0x0e60('0x37')]=_0x2432a8[_0x0e60('0x37')]['length']?_0x2432a8['attributes']:_0x4ce029['model'];if(_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x45')]){_0x2432a8[_0x0e60('0x46')]=[{'all':!![]}];}_0x2432a8=_[_0x0e60('0x42')]({},_0x2432a8,_0x4bfebf[_0x0e60('0x43')]);return db['Tag']['find'](_0x2432a8)[_0x0e60('0x28')](handleEntityNotFound(_0x2b2354,null))[_0x0e60('0x28')](respondWithResult(_0x2b2354,null))[_0x0e60('0x47')](handleError(_0x2b2354,null));};exports[_0x0e60('0x4a')]=function(_0x4ad156,_0x36a999){return db[_0x0e60('0x44')][_0x0e60('0x4a')](_0x4ad156['body'],{})[_0x0e60('0x28')](function(_0xc6cee0){var _0x5e710d=_0x4ad156[_0x0e60('0x4b')]['get']({'plain':!![]});if(!_0x5e710d)throw new Error(_0x0e60('0x4c'));if(_0x5e710d[_0x0e60('0x4d')]===_0x0e60('0x4b')){var _0x2e887c=_0xc6cee0[_0x0e60('0x2a')]({'plain':!![]});var _0x4caeed=_0x0e60('0x4e');return db[_0x0e60('0x4f')][_0x0e60('0x50')]({'where':{'name':_0x4caeed,'userProfileId':_0x5e710d[_0x0e60('0x51')]},'raw':!![]})['then'](function(_0x19d7bc){if(_0x19d7bc&&_0x19d7bc[_0x0e60('0x52')]===0x0){return db[_0x0e60('0x2b')][_0x0e60('0x4a')]({'name':_0x2e887c['name'],'resourceId':_0x2e887c['id'],'type':_0x19d7bc[_0x0e60('0x2d')],'sectionId':_0x19d7bc['id']},{})['then'](function(){return _0xc6cee0;});}else{return _0xc6cee0;}})[_0x0e60('0x47')](function(_0x707dc6){logger[_0x0e60('0x53')](_0x0e60('0x54'),_0x707dc6);throw _0x707dc6;});}return _0xc6cee0;})[_0x0e60('0x28')](respondWithResult(_0x36a999,0xc9))[_0x0e60('0x47')](handleError(_0x36a999,null));};exports[_0x0e60('0x27')]=function(_0x49daf6,_0x124b8e){if(_0x49daf6['body']['id']){delete _0x49daf6[_0x0e60('0x55')]['id'];}return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x49daf6[_0x0e60('0x56')]['id']}})['then'](handleEntityNotFound(_0x124b8e,null))['then'](saveUpdates(_0x49daf6[_0x0e60('0x55')],null))['then'](respondWithResult(_0x124b8e,null))[_0x0e60('0x47')](handleError(_0x124b8e,null));};exports[_0x0e60('0x29')]=function(_0x313dd2,_0x24ada9){return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x313dd2[_0x0e60('0x56')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x24ada9,null))['then'](removeEntity(_0x24ada9,null))[_0x0e60('0x47')](handleError(_0x24ada9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f037500..2ded2fc 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 _0x0735=['define','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','rimraf','./tag.attributes','exports'];(function(_0x55bd20,_0x3d4bdc){var _0x428064=function(_0x2248c8){while(--_0x2248c8){_0x55bd20['push'](_0x55bd20['shift']());}};_0x428064(++_0x3d4bdc);}(_0x0735,0x1a5));var _0x5073=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0735[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5073('0x0'));var util=require('util');var logger=require(_0x5073('0x1'))(_0x5073('0x2'));var moment=require(_0x5073('0x3'));var BPromise=require(_0x5073('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5073('0x5'));var config=require('../../config/environment');var attributes=require(_0x5073('0x6'));module[_0x5073('0x7')]=function(_0x283844,_0x5a9b00){return _0x283844[_0x5073('0x8')](_0x5073('0x9'),attributes,{'tableName':_0x5073('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a1f=['util','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x7e48b3,_0x51dae5){var _0xabaa46=function(_0x3c63a8){while(--_0x3c63a8){_0x7e48b3['push'](_0x7e48b3['shift']());}};_0xabaa46(++_0x51dae5);}(_0x1a1f,0x180));var _0xf1a1=function(_0x468f0e,_0x1462a0){_0x468f0e=_0x468f0e-0x0;var _0x19a66b=_0x1a1f[_0x468f0e];return _0x19a66b;};'use strict';var _=require('lodash');var util=require(_0xf1a1('0x0'));var logger=require('../../config/logger')(_0xf1a1('0x1'));var moment=require(_0xf1a1('0x2'));var BPromise=require(_0xf1a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1a1('0x4'));var rimraf=require(_0xf1a1('0x5'));var config=require(_0xf1a1('0x6'));var attributes=require(_0xf1a1('0x7'));module[_0xf1a1('0x8')]=function(_0x5a25e2,_0x316fd8){return _0x5a25e2[_0xf1a1('0x9')](_0xf1a1('0xa'),attributes,{'tableName':_0xf1a1('0xb'),'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 0b6213d..bdf1ce1 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 _0x4b19=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x4e31dd,_0x233512){var _0x255239=function(_0x4990b8){while(--_0x4990b8){_0x4e31dd['push'](_0x4e31dd['shift']());}};_0x255239(++_0x233512);}(_0x4b19,0x195));var _0x94b1=function(_0x41f3c7,_0x291a10){_0x41f3c7=_0x41f3c7-0x0;var _0x4127b7=_0x4b19[_0x41f3c7];return _0x4127b7;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var rs=require(_0x94b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94b1('0x4'))['db'];var utils=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))('rpc');var config=require(_0x94b1('0x7'));var jayson=require(_0x94b1('0x8'));var client=jayson['client'][_0x94b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110a52,_0x4ea1f9,_0x40c69c){return new BPromise(function(_0x201a02,_0xad0a85){return client['request'](_0x110a52,_0x40c69c)[_0x94b1('0xa')](function(_0x4f948b){logger['info'](_0x94b1('0xb'),_0x4ea1f9,_0x94b1('0xc'));logger[_0x94b1('0xd')](_0x94b1('0xe'),_0x4ea1f9,_0x94b1('0xc'),JSON[_0x94b1('0xf')](_0x4f948b));if(_0x4f948b['error']){if(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x11')]===0x1f4){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x4f948b['error']['message']);return _0xad0a85(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);}logger['error']('Tag,\x20%s,\x20%s',_0x4ea1f9,_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);return _0x201a02(_0x4f948b['error'][_0x94b1('0x12')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x4ea1f9,_0x94b1('0xc'));_0x201a02(_0x4f948b[_0x94b1('0x13')][_0x94b1('0x12')]);}})[_0x94b1('0x14')](function(_0x494138){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x494138);_0xad0a85(_0x494138);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','Tag,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2f9310,_0x2856a8){var _0xe4d8e6=function(_0x3d9135){while(--_0x3d9135){_0x2f9310['push'](_0x2f9310['shift']());}};_0xe4d8e6(++_0x2856a8);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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']('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('Tag,\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')]('Tag,\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')]('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index cf2e8bb..3ef9b8c 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 aa31a91..e792fdc 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 _0xb7e7=['STRING','sequelize'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x215082,_0x521b61){var _0x2152cd=function(_0x379971){while(--_0x379971){_0x215082['push'](_0x215082['shift']());}};_0x2152cd(++_0x521b61);}(_0xb10b,0x12a));var _0xbb10=function(_0x18b56f,_0x2d8823){_0x18b56f=_0x18b56f-0x0;var _0x4df0e0=_0xb10b[_0x18b56f];return _0x4df0e0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a2b0cf3..0c98333 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 _0xb62f=['add','ids','remove','addAgents','isArray','Voice','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','Queue','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','Chat','Queue:remove','UserVoicePrefix','getAgents','eml-format','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','index','map','Team','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','destroy','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','VoicePrefixId','getQueues','findOne','isValidChannel','ValidationError','Unknown\x20channel','channel','rawAttributes','order','capitalize','toLowerCase','Queues','addQueues'];(function(_0x23a49a,_0x45fd99){var _0x2e0cb8=function(_0x11a7e4){while(--_0x11a7e4){_0x23a49a['push'](_0x23a49a['shift']());}};_0x2e0cb8(++_0x45fd99);}(_0xb62f,0xbf));var _0xfb62=function(_0x25aa80,_0x4562ec){_0x25aa80=_0x25aa80-0x0;var _0x4e77c1=_0xb62f[_0x25aa80];return _0x4e77c1;};'use strict';var emlformat=require(_0xfb62('0x0'));var rimraf=require(_0xfb62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb62('0x2'));var rp=require(_0xfb62('0x3'));var moment=require(_0xfb62('0x4'));var BPromise=require(_0xfb62('0x5'));var Mustache=require('mustache');var util=require(_0xfb62('0x6'));var path=require(_0xfb62('0x7'));var sox=require(_0xfb62('0x8'));var csv=require('to-csv');var ejs=require(_0xfb62('0x9'));var fs=require('fs');var fs_extra=require(_0xfb62('0xa'));var _=require('lodash');var squel=require(_0xfb62('0xb'));var crypto=require(_0xfb62('0xc'));var jsforce=require(_0xfb62('0xd'));var deskjs=require(_0xfb62('0xe'));var toCsv=require(_0xfb62('0xf'));var querystring=require(_0xfb62('0x10'));var Papa=require(_0xfb62('0x11'));var Redis=require('ioredis');var authService=require(_0xfb62('0x12'));var qs=require(_0xfb62('0x13'));var as=require(_0xfb62('0x14'));var hardwareService=require(_0xfb62('0x15'));var logger=require(_0xfb62('0x16'))(_0xfb62('0x17'));var utils=require(_0xfb62('0x18'));var config=require(_0xfb62('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb62('0x1a'))['db'];config[_0xfb62('0x1b')]=_[_0xfb62('0x1c')](config[_0xfb62('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb62('0x1b')]));require('./team.socket')[_0xfb62('0x1d')](socket);function respondWithStatusCode(_0x21e7e2,_0x49605b){_0x49605b=_0x49605b||0xcc;return function(_0x386824){if(_0x386824){return _0x21e7e2[_0xfb62('0x1e')](_0x49605b);}return _0x21e7e2[_0xfb62('0x1f')](_0x49605b)['end']();};}function respondWithResult(_0x1d3546,_0x43bbcd){_0x43bbcd=_0x43bbcd||0xc8;return function(_0x171077){if(_0x171077){return _0x1d3546['status'](_0x43bbcd)[_0xfb62('0x20')](_0x171077);}};}function respondWithFilteredResult(_0xad80ae,_0x13e9d9){return function(_0x2a6614){if(_0x2a6614){var _0x208f2b=typeof _0x13e9d9[_0xfb62('0x21')]==='undefined'&&typeof _0x13e9d9[_0xfb62('0x22')]===_0xfb62('0x23');var _0x3a73b2=_0x2a6614[_0xfb62('0x24')];var _0x13610f=_0x208f2b?0x0:_0x13e9d9[_0xfb62('0x21')];var _0x187fb7=_0x208f2b?_0x2a6614['count']:_0x13e9d9['offset']+_0x13e9d9['limit'];var _0x34d470;if(_0x187fb7>=_0x3a73b2){_0x187fb7=_0x3a73b2;_0x34d470=0xc8;}else{_0x34d470=0xce;}_0xad80ae[_0xfb62('0x1f')](_0x34d470);return _0xad80ae[_0xfb62('0x25')](_0xfb62('0x26'),_0x13610f+'-'+_0x187fb7+'/'+_0x3a73b2)[_0xfb62('0x20')](_0x2a6614);}return null;};}function patchUpdates(_0xc5ee57){return function(_0x3f3c23){try{jsonpatch[_0xfb62('0x27')](_0x3f3c23,_0xc5ee57,!![]);}catch(_0x2ee52b){return BPromise['reject'](_0x2ee52b);}return _0x3f3c23['save']();};}function saveUpdates(_0x22bc66,_0x42478b){return function(_0x1641ee){if(_0x1641ee){return _0x1641ee[_0xfb62('0x28')](_0x22bc66)[_0xfb62('0x29')](function(_0x579cf5){return _0x579cf5;});}return null;};}function handleEntityNotFound(_0x1c9d86,_0x29ffa8){return function(_0x2a32df){if(!_0x2a32df){_0x1c9d86[_0xfb62('0x1e')](0x194);}return _0x2a32df;};}function handleError(_0x5aabd2,_0x353483){_0x353483=_0x353483||0x1f4;return function(_0x2d2c9e){logger[_0xfb62('0x2a')](_0x2d2c9e[_0xfb62('0x2b')]);if(_0x2d2c9e[_0xfb62('0x2c')]){delete _0x2d2c9e[_0xfb62('0x2c')];}_0x5aabd2[_0xfb62('0x1f')](_0x353483)[_0xfb62('0x2d')](_0x2d2c9e);};}exports[_0xfb62('0x2e')]=function(_0x27a23d,_0x1d75c7){var _0x4e4a25={},_0x30745b={},_0x3ff576={'count':0x0,'rows':[]};var _0x604c56=_[_0xfb62('0x2f')](db[_0xfb62('0x30')]['rawAttributes'],function(_0x17eec3){return{'name':_0x17eec3[_0xfb62('0x31')],'type':_0x17eec3[_0xfb62('0x32')]['key']};});_0x30745b['model']=_[_0xfb62('0x2f')](_0x604c56,_0xfb62('0x2c'));_0x30745b['query']=_[_0xfb62('0x33')](_0x27a23d[_0xfb62('0x34')]);_0x30745b[_0xfb62('0x35')]=_[_0xfb62('0x36')](_0x30745b[_0xfb62('0x37')],_0x30745b[_0xfb62('0x34')]);_0x4e4a25['attributes']=_[_0xfb62('0x36')](_0x30745b['model'],qs[_0xfb62('0x38')](_0x27a23d[_0xfb62('0x34')][_0xfb62('0x38')]));_0x4e4a25[_0xfb62('0x39')]=_0x4e4a25[_0xfb62('0x39')][_0xfb62('0x3a')]?_0x4e4a25['attributes']:_0x30745b['model'];if(!_0x27a23d[_0xfb62('0x34')][_0xfb62('0x3b')](_0xfb62('0x3c'))){_0x4e4a25[_0xfb62('0x22')]=qs[_0xfb62('0x22')](_0x27a23d[_0xfb62('0x34')][_0xfb62('0x22')]);_0x4e4a25['offset']=qs['offset'](_0x27a23d[_0xfb62('0x34')]['offset']);}_0x4e4a25['order']=qs[_0xfb62('0x3d')](_0x27a23d[_0xfb62('0x34')]['sort']);_0x4e4a25[_0xfb62('0x3e')]=qs[_0xfb62('0x35')](_[_0xfb62('0x3f')](_0x27a23d[_0xfb62('0x34')],_0x30745b[_0xfb62('0x35')]),_0x604c56);if(_0x27a23d[_0xfb62('0x34')][_0xfb62('0x40')]){_0x4e4a25[_0xfb62('0x3e')]=_[_0xfb62('0x41')](_0x4e4a25[_0xfb62('0x3e')],{'$or':_[_0xfb62('0x2f')](_0x604c56,function(_0x3f63a9){if(_0x3f63a9[_0xfb62('0x32')]!=='VIRTUAL'){var _0x4607fd={};_0x4607fd[_0x3f63a9[_0xfb62('0x2c')]]={'$like':'%'+_0x27a23d[_0xfb62('0x34')]['filter']+'%'};return _0x4607fd;}})});}_0x4e4a25=_[_0xfb62('0x41')]({},_0x4e4a25,_0x27a23d['options']);var _0x29bae7={'where':_0x4e4a25[_0xfb62('0x3e')]};return db['Team'][_0xfb62('0x24')](_0x29bae7)[_0xfb62('0x29')](function(_0x539aac){_0x3ff576[_0xfb62('0x24')]=_0x539aac;if(_0x27a23d['query'][_0xfb62('0x42')]){_0x4e4a25[_0xfb62('0x43')]=[{'all':!![]}];}return db[_0xfb62('0x30')]['findAll'](_0x4e4a25);})[_0xfb62('0x29')](function(_0x58d09e){_0x3ff576[_0xfb62('0x44')]=_0x58d09e;return _0x3ff576;})['then'](respondWithFilteredResult(_0x1d75c7,_0x4e4a25))[_0xfb62('0x45')](handleError(_0x1d75c7,null));};exports[_0xfb62('0x46')]=function(_0x5b8cbb,_0x42fe63){var _0x280094={'raw':![],'where':{'id':_0x5b8cbb[_0xfb62('0x47')]['id']}},_0x2ec357={};_0x2ec357[_0xfb62('0x37')]=_['keys'](db[_0xfb62('0x30')]['rawAttributes']);_0x2ec357[_0xfb62('0x34')]=_[_0xfb62('0x33')](_0x5b8cbb[_0xfb62('0x34')]);_0x2ec357[_0xfb62('0x35')]=_[_0xfb62('0x36')](_0x2ec357[_0xfb62('0x37')],_0x2ec357[_0xfb62('0x34')]);_0x280094[_0xfb62('0x39')]=_['intersection'](_0x2ec357[_0xfb62('0x37')],qs[_0xfb62('0x38')](_0x5b8cbb[_0xfb62('0x34')][_0xfb62('0x38')]));_0x280094[_0xfb62('0x39')]=_0x280094['attributes'][_0xfb62('0x3a')]?_0x280094['attributes']:_0x2ec357[_0xfb62('0x37')];if(_0x5b8cbb['query']['includeAll']){_0x280094[_0xfb62('0x43')]=[{'all':!![]}];}_0x280094=_['merge']({},_0x280094,_0x5b8cbb[_0xfb62('0x48')]);return db[_0xfb62('0x30')]['find'](_0x280094)[_0xfb62('0x29')](handleEntityNotFound(_0x42fe63,null))[_0xfb62('0x29')](respondWithResult(_0x42fe63,null))[_0xfb62('0x45')](handleError(_0x42fe63,null));};exports[_0xfb62('0x49')]=function(_0x21202b,_0xef243d){return db[_0xfb62('0x30')][_0xfb62('0x49')](_0x21202b[_0xfb62('0x4a')],{})[_0xfb62('0x29')](function(_0x3cca2b){var _0x22ca3f=_0x21202b[_0xfb62('0x4b')][_0xfb62('0x4c')]({'plain':!![]});if(!_0x22ca3f)throw new Error(_0xfb62('0x4d'));if(_0x22ca3f[_0xfb62('0x4e')]===_0xfb62('0x4b')){var _0x5205c1=_0x3cca2b[_0xfb62('0x4c')]({'plain':!![]});var _0x21eefe=_0xfb62('0x4f');return db[_0xfb62('0x50')][_0xfb62('0x51')]({'where':{'name':_0x21eefe,'userProfileId':_0x22ca3f['userProfileId']},'raw':!![]})['then'](function(_0x26533f){if(_0x26533f&&_0x26533f['autoAssociation']===0x0){return db[_0xfb62('0x52')]['create']({'name':_0x5205c1[_0xfb62('0x2c')],'resourceId':_0x5205c1['id'],'type':_0x26533f[_0xfb62('0x2c')],'sectionId':_0x26533f['id']},{})[_0xfb62('0x29')](function(){return _0x3cca2b;});}else{return _0x3cca2b;}})[_0xfb62('0x45')](function(_0x59020d){logger[_0xfb62('0x2a')](_0xfb62('0x53'),_0x59020d);throw _0x59020d;});}return _0x3cca2b;})[_0xfb62('0x29')](respondWithResult(_0xef243d,0xc9))[_0xfb62('0x45')](handleError(_0xef243d,null));};exports[_0xfb62('0x28')]=function(_0x3dbca5,_0x48f8cb){if(_0x3dbca5['body']['id']){delete _0x3dbca5[_0xfb62('0x4a')]['id'];}return db[_0xfb62('0x30')][_0xfb62('0x51')]({'where':{'id':_0x3dbca5['params']['id']}})[_0xfb62('0x29')](handleEntityNotFound(_0x48f8cb,null))[_0xfb62('0x29')](saveUpdates(_0x3dbca5[_0xfb62('0x4a')],null))[_0xfb62('0x29')](respondWithResult(_0x48f8cb,null))[_0xfb62('0x45')](handleError(_0x48f8cb,null));};exports['destroy']=function(_0xb0ac94,_0xecc538){var _0x934414=_0xb0ac94[_0xfb62('0x47')]['id'];var _0xe85764=[];return db[_0xfb62('0x54')][_0xfb62('0x55')](function(_0x22520c){var _0x3270c8=_0xfb62('0x56')+_0x934414;return db[_0xfb62('0x54')][_0xfb62('0x34')](_0x3270c8,{'type':db[_0xfb62('0x57')][_0xfb62('0x58')][_0xfb62('0x59')],'raw':!![],'transaction':_0x22520c})['then'](function(_0x372c47){_0xe85764=_[_0xfb62('0x2f')](_0x372c47,function(_0x49846a){return Number(_0x49846a['UserId']);});})[_0xfb62('0x29')](function(){var _0x1fbf99=_0xfb62('0x5a')+_0x934414;return db[_0xfb62('0x54')][_0xfb62('0x34')](_0x1fbf99,{'type':db[_0xfb62('0x57')][_0xfb62('0x58')][_0xfb62('0x59')],'raw':!![],'transaction':_0x22520c});})[_0xfb62('0x29')](function(_0x26d4be){var _0x2e5d7a=_[_0xfb62('0x2f')](_0x26d4be,function(_0x282eef){return Number(_0x282eef[_0xfb62('0x5b')]);});return db[_0xfb62('0x5c')]['destroy']({'where':{'UserId':{'$in':_0xe85764},'VoiceQueueId':{'$in':_0x2e5d7a}},'transaction':_0x22520c});})[_0xfb62('0x29')](function(){var _0x5b8fa9=_0xfb62('0x5d')+_0x934414;return db[_0xfb62('0x54')][_0xfb62('0x34')](_0x5b8fa9,{'type':db[_0xfb62('0x57')][_0xfb62('0x58')]['SELECT'],'raw':!![],'transaction':_0x22520c});})['then'](function(_0x4c98de){var _0x52a71f=_['map'](_0x4c98de,function(_0x19971c){return Number(_0x19971c['MailQueueId']);});return db[_0xfb62('0x5e')]['destroy']({'where':{'UserId':{'$in':_0xe85764},'MailQueueId':{'$in':_0x52a71f}},'transaction':_0x22520c});})['then'](function(){var _0x1f2696=_0xfb62('0x5f')+_0x934414;return db[_0xfb62('0x54')][_0xfb62('0x34')](_0x1f2696,{'type':db[_0xfb62('0x57')]['QueryTypes'][_0xfb62('0x59')],'raw':!![],'transaction':_0x22520c});})['then'](function(_0x32dd87){var _0x58d0d5=_['map'](_0x32dd87,function(_0x2622e6){return Number(_0x2622e6[_0xfb62('0x60')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0xe85764},'SmsQueueId':{'$in':_0x58d0d5}},'transaction':_0x22520c});})[_0xfb62('0x29')](function(){var _0x4bb003=_0xfb62('0x61')+_0x934414;return db['sequelize'][_0xfb62('0x34')](_0x4bb003,{'type':db['Sequelize']['QueryTypes'][_0xfb62('0x59')],'raw':!![],'transaction':_0x22520c});})['then'](function(_0x455a0c){var _0x12cf0c=_['map'](_0x455a0c,function(_0x5cc3b0){return Number(_0x5cc3b0[_0xfb62('0x62')]);});return db['UserChatQueue'][_0xfb62('0x63')]({'where':{'UserId':{'$in':_0xe85764},'ChatQueueId':{'$in':_0x12cf0c}},'transaction':_0x22520c});})[_0xfb62('0x29')](function(){var _0x3f5adb='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x934414;return db[_0xfb62('0x54')]['query'](_0x3f5adb,{'type':db[_0xfb62('0x57')][_0xfb62('0x58')][_0xfb62('0x59')],'raw':!![],'transaction':_0x22520c});})[_0xfb62('0x29')](function(_0x39b173){var _0x2cc52e=_['map'](_0x39b173,function(_0x3a914d){return Number(_0x3a914d[_0xfb62('0x64')]);});return db[_0xfb62('0x65')][_0xfb62('0x63')]({'where':{'UserId':{'$in':_0xe85764},'FaxQueueId':{'$in':_0x2cc52e}},'transaction':_0x22520c});})[_0xfb62('0x29')](function(){var _0x4665ad=_0xfb62('0x66')+_0x934414;return db[_0xfb62('0x54')][_0xfb62('0x34')](_0x4665ad,{'type':db[_0xfb62('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x22520c});})[_0xfb62('0x29')](function(_0x2bda10){var _0xb8c194=_[_0xfb62('0x2f')](_0x2bda10,function(_0x2ce367){return Number(_0x2ce367[_0xfb62('0x67')]);});return db[_0xfb62('0x68')][_0xfb62('0x63')]({'where':{'UserId':{'$in':_0xe85764},'OpenchannelQueueId':{'$in':_0xb8c194}},'transaction':_0x22520c});})[_0xfb62('0x29')](function(){var _0x44bb44=_0xfb62('0x69')+_0x934414;return db[_0xfb62('0x54')]['query'](_0x44bb44,{'type':db['Sequelize'][_0xfb62('0x58')][_0xfb62('0x59')],'raw':!![],'transaction':_0x22520c});})[_0xfb62('0x29')](function(_0x2f8d9a){var _0x3f580d=_[_0xfb62('0x2f')](_0x2f8d9a,function(_0x17c855){return Number(_0x17c855[_0xfb62('0x6a')]);});return db[_0xfb62('0x6b')][_0xfb62('0x63')]({'where':{'UserId':{'$in':_0xe85764},'WhatsappQueueId':{'$in':_0x3f580d}},'transaction':_0x22520c});})[_0xfb62('0x29')](function(){return db['TeamVoicePrefix'][_0xfb62('0x51')]({'where':{'TeamId':_0x934414}});})['then'](function(_0x36181d){if(_0x36181d===null){return;}return db['UserVoicePrefix'][_0xfb62('0x63')]({'where':{'UserId':{'$in':_0xe85764},'VoicePrefixId':_0x36181d[_0xfb62('0x6c')]},'transaction':_0x22520c});})[_0xfb62('0x29')](function(){return db[_0xfb62('0x30')]['destroy']({'where':{'id':_0x934414},'cascade':!![],'transaction':_0x22520c});})[_0xfb62('0x29')](function(_0x5ee671){if(_0x5ee671===0x0){_0xecc538['sendStatus'](0x194);}else{return db[_0xfb62('0x52')][_0xfb62('0x63')]({'where':{'type':_0xfb62('0x4f'),'resourceId':_0x934414},'cascade':!![],'transaction':_0x22520c})[_0xfb62('0x29')](function(){_0xecc538['status'](0xcc)['end']();});}})[_0xfb62('0x45')](function(_0x270d29){_0xecc538[_0xfb62('0x1f')](0x1f4)[_0xfb62('0x2d')](_0x270d29);});});};exports[_0xfb62('0x6d')]=function(_0x5c1fd7,_0x2e00e4,_0x173170){return db[_0xfb62('0x30')][_0xfb62('0x6e')]({'where':{'id':_0x5c1fd7['params']['id']}})[_0xfb62('0x29')](handleEntityNotFound(_0x2e00e4,null))[_0xfb62('0x29')](function(_0xb2869a){if(!_0x5c1fd7[_0xfb62('0x34')]['channel']||!utils[_0xfb62('0x6f')](_0x5c1fd7['query']['channel'])){throw new db[(_0xfb62('0x57'))][(_0xfb62('0x70'))](_0xfb62('0x71'));}var _0x2b025d={};var _0x3e7a72={};_0x3e7a72[_0xfb62('0x37')]=_[_0xfb62('0x33')](db[_['capitalize'](_0x5c1fd7['query'][_0xfb62('0x72')]['toLowerCase']())+'Queue'][_0xfb62('0x73')]);_0x3e7a72[_0xfb62('0x34')]=_['keys'](_0x5c1fd7[_0xfb62('0x34')]);_0x3e7a72[_0xfb62('0x35')]=_[_0xfb62('0x36')](_0x3e7a72['model'],_0x3e7a72[_0xfb62('0x34')]);_0x2b025d[_0xfb62('0x39')]=_['intersection'](_0x3e7a72[_0xfb62('0x37')],qs['fields'](_0x5c1fd7[_0xfb62('0x34')]['fields']));_0x2b025d['attributes']=_0x2b025d['attributes']['length']?_0x2b025d[_0xfb62('0x39')]:_0x3e7a72[_0xfb62('0x37')];_0x2b025d[_0xfb62('0x22')]=qs['limit'](_0x5c1fd7[_0xfb62('0x34')][_0xfb62('0x22')]);_0x2b025d[_0xfb62('0x21')]=qs['offset'](_0x5c1fd7['query'][_0xfb62('0x21')]);_0x2b025d[_0xfb62('0x74')]=qs['sort'](_0x5c1fd7[_0xfb62('0x34')][_0xfb62('0x3d')]);_0x2b025d[_0xfb62('0x3e')]=qs[_0xfb62('0x35')](_['pick'](_0x5c1fd7['query'],_0x3e7a72[_0xfb62('0x35')]));_0x2b025d=_[_0xfb62('0x41')]({},_0x2b025d,_0x5c1fd7[_0xfb62('0x48')]);return _0xb2869a[_0xfb62('0x4c')+_[_0xfb62('0x75')](_0x5c1fd7[_0xfb62('0x34')][_0xfb62('0x72')][_0xfb62('0x76')]())+_0xfb62('0x77')](_0x2b025d);})[_0xfb62('0x29')](respondWithResult(_0x2e00e4,null))[_0xfb62('0x45')](handleError(_0x2e00e4,null));};exports[_0xfb62('0x78')]=function(_0x2274da,_0x47e314,_0x3a4e7d){return db[_0xfb62('0x30')][_0xfb62('0x6e')]({'where':{'id':_0x2274da['params']['id']}})['then'](function(_0x270a98){if(_0x270a98){if(!_0x2274da[_0xfb62('0x4a')][_0xfb62('0x72')]||!utils['isValidChannel'](_0x2274da[_0xfb62('0x4a')][_0xfb62('0x72')])){throw new db[(_0xfb62('0x57'))]['ValidationError'](_0xfb62('0x71'));}return _0x270a98[_0xfb62('0x79')+_['capitalize'](_0x2274da[_0xfb62('0x4a')][_0xfb62('0x72')][_0xfb62('0x76')]())+_0xfb62('0x77')](_0x2274da[_0xfb62('0x4a')][_0xfb62('0x7a')]);}return null;})[_0xfb62('0x29')](handleEntityNotFound(_0x47e314,null))['then'](respondWithStatusCode(_0x47e314,null))[_0xfb62('0x45')](handleError(_0x47e314,null));};exports['removeQueues']=function(_0x4dd77d,_0x30c7e6,_0x3cd9d1){return db[_0xfb62('0x30')]['findOne']({'where':{'id':_0x4dd77d[_0xfb62('0x47')]['id']}})[_0xfb62('0x29')](function(_0x3d4f65){if(_0x3d4f65){if(!_0x4dd77d[_0xfb62('0x34')][_0xfb62('0x72')]||!utils['isValidChannel'](_0x4dd77d[_0xfb62('0x34')][_0xfb62('0x72')])){throw new db['Sequelize'][(_0xfb62('0x70'))]('Unknown\x20channel');}return _0x3d4f65[_0xfb62('0x7b')+_[_0xfb62('0x75')](_0x4dd77d[_0xfb62('0x34')][_0xfb62('0x72')][_0xfb62('0x76')]())+_0xfb62('0x77')](_0x4dd77d[_0xfb62('0x34')][_0xfb62('0x7a')]);}return null;})[_0xfb62('0x29')](handleEntityNotFound(_0x30c7e6,null))[_0xfb62('0x29')](respondWithStatusCode(_0x30c7e6,null))[_0xfb62('0x45')](handleError(_0x30c7e6,null));};exports[_0xfb62('0x7c')]=function(_0x2d552a,_0x55e2c4){var _0x4602d5=_[_0xfb62('0x7d')](_0x2d552a[_0xfb62('0x4a')][_0xfb62('0x7a')])?_0x2d552a[_0xfb62('0x4a')][_0xfb62('0x7a')]:[_0x2d552a[_0xfb62('0x4a')][_0xfb62('0x7a')]];var _0x66b0eb=_0x2d552a[_0xfb62('0x47')]['id'];return db['Team'][_0xfb62('0x51')]({'where':{'id':_0x66b0eb}})[_0xfb62('0x29')](handleEntityNotFound(_0x55e2c4,null))[_0xfb62('0x29')](function(_0x3c68bf){if(_0x3c68bf){var _0x1166f2=[_0xfb62('0x7e'),'Chat',_0xfb62('0x7f'),_0xfb62('0x80'),'Fax',_0xfb62('0x81'),_0xfb62('0x82')];return db['sequelize']['transaction'](function(_0x4dcd3a){var _0x5d297e=_[_0xfb62('0x2f')](_0x1166f2,function(_0x416f3b){var _0x328eef={'attributes':['id',_0xfb62('0x2c')]};if(_0x416f3b===_0xfb62('0x7e')){_0x328eef[_0xfb62('0x83')]={'attributes':[_0xfb62('0x84')]};}return _0x3c68bf[_0xfb62('0x4c')+_0x416f3b+_0xfb62('0x77')](_0x328eef)[_0xfb62('0x29')](function(_0x3600df){var _0x5ad377=_[_0xfb62('0x2f')](_0x3600df,function(_0x39cbf4){var _0x199ea3=_['map'](_0x4602d5,function(_0x3beddf){var _0x27336c={'where':{'UserId':_0x3beddf,[_0x416f3b+_0xfb62('0x85')]:_0x39cbf4['id']},'transaction':_0x4dcd3a};if(_0x416f3b===_0xfb62('0x7e')){_0x27336c[_0xfb62('0x1c')]={'penalty':_0x39cbf4[_0xfb62('0x86')][_0xfb62('0x84')]};}return db[_0xfb62('0x87')+_0x416f3b+_0xfb62('0x88')]['findOrCreate'](_0x27336c)[_0xfb62('0x29')](function(){socket[_0xfb62('0x89')]('user'+_0x416f3b+_0xfb62('0x8a'),{'UserId':_0x3beddf,[_0x416f3b+'QueueId']:_0x39cbf4['id']});if(_0x416f3b!==_0xfb62('0x7e')){return;}return db[_0xfb62('0x87')][_0xfb62('0x8b')]({'where':{'id':_0x4602d5,'online':0x1},'attributes':['id',_0xfb62('0x2c'),_0xfb62('0x8c'),_0xfb62('0x8d'),_0xfb62('0x8e')],'raw':!![]})[_0xfb62('0x29')](function(_0x4c3b61){var _0x4ac78b=_[_0xfb62('0x2f')](_0x4c3b61,function(_0x94494c){return db[_0xfb62('0x8f')][_0xfb62('0x90')]({'membername':_0x94494c[_0xfb62('0x2c')],'UserId':_0x94494c['id'],'queue_name':_0x39cbf4['name'],'VoiceQueueId':_0x39cbf4['id'],'interface':_[_0xfb62('0x91')](_0x94494c['interface'])?util[_0xfb62('0x92')](_0xfb62('0x93'),_0x94494c['name']):_0x94494c[_0xfb62('0x8e')],'paused':_0x94494c[_0xfb62('0x8d')]||![],'penalty':_0x39cbf4[_0xfb62('0x86')][_0xfb62('0x84')]},{'transaction':_0x4dcd3a});});return Promise['all'](_0x4ac78b);});});});return Promise[_0xfb62('0x94')](_0x199ea3);});return Promise[_0xfb62('0x94')](_0x5ad377);})['then'](function(){return db[_0xfb62('0x95')][_0xfb62('0x6e')]({'where':{'teamId':_0x66b0eb}})[_0xfb62('0x29')](function(_0x2e7267){if(_0x2e7267){var _0x2eaf6f=_[_0xfb62('0x2f')](_0x4602d5,function(_0x1bb15d){db['UserVoicePrefix'][_0xfb62('0x90')]({'UserId':_0x1bb15d,'VoicePrefixId':_0x2e7267[_0xfb62('0x6c')]});});return Promise[_0xfb62('0x94')](_0x2eaf6f);}});});});return Promise['all'](_0x5d297e)[_0xfb62('0x29')](function(){return _0x3c68bf[_0xfb62('0x7c')](_0x4602d5,{'transaction':_0x4dcd3a})[_0xfb62('0x96')](function(_0x47a6ae){return _0x47a6ae;});});});}})[_0xfb62('0x29')](respondWithResult(_0x55e2c4,null))[_0xfb62('0x45')](handleError(_0x55e2c4,null));};exports[_0xfb62('0x97')]=function(_0x3c074d,_0x170da0){var _0x465336=_[_0xfb62('0x7d')](_0x3c074d['query'][_0xfb62('0x7a')])?_0x3c074d['query']['ids']:[_0x3c074d['query'][_0xfb62('0x7a')]];var _0xaed4c7=_0x3c074d[_0xfb62('0x47')]['id'];return db[_0xfb62('0x30')]['find']({'where':{'id':_0xaed4c7}})[_0xfb62('0x29')](handleEntityNotFound(_0x170da0,null))[_0xfb62('0x29')](function(_0x2f9c8b){if(_0x2f9c8b){var _0x9b99a7=[_0xfb62('0x7e'),_0xfb62('0x98'),_0xfb62('0x7f'),_0xfb62('0x80'),'Fax',_0xfb62('0x81'),_0xfb62('0x82')];return db[_0xfb62('0x54')][_0xfb62('0x55')](function(_0x3453e4){var _0x51b062=_['map'](_0x9b99a7,function(_0x552a5a){var _0x26c263={'attributes':['id','name']};return _0x2f9c8b['get'+_0x552a5a+'Queues'](_0x26c263)[_0xfb62('0x29')](function(_0x3548ae){var _0x2d6a99=_[_0xfb62('0x2f')](_0x3548ae,function(_0x483ad2){return _0x483ad2[_0xfb62('0x97')](_0x465336,{'transaction':_0x3453e4})[_0xfb62('0x29')](function(){var _0x1a6087=_[_0xfb62('0x2f')](_0x465336,function(_0x3ef8cc){socket['emit'](_0xfb62('0x4b')+_0x552a5a+_0xfb62('0x99'),{'UserId':Number(_0x3ef8cc),[_0x552a5a+'QueueId']:_0x483ad2['id']});if(_0x552a5a!=='Voice'){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x483ad2['id'],'UserId':_0x3ef8cc},'transaction':_0x3453e4});});return Promise[_0xfb62('0x94')](_0x1a6087);});});return Promise['all'](_0x2d6a99);});});return Promise[_0xfb62('0x94')](_0x51b062)[_0xfb62('0x29')](function(){return _0x2f9c8b[_0xfb62('0x97')](_0x465336,{'transaction':_0x3453e4});})['then'](function(){return db[_0xfb62('0x95')]['findOne']({'where':{'teamId':_0xaed4c7}})[_0xfb62('0x29')](function(_0x2e7b58){if(_0x2e7b58){var _0x351bd2=_[_0xfb62('0x2f')](_0x465336,function(_0x48a80b){db[_0xfb62('0x9a')][_0xfb62('0x63')]({'where':{'UserId':_0x48a80b,'VoicePrefixId':_0x2e7b58[_0xfb62('0x6c')]}});});return Promise['all'](_0x351bd2);}});});});}})[_0xfb62('0x29')](respondWithStatusCode(_0x170da0,null))[_0xfb62('0x45')](handleError(_0x170da0,null));};exports[_0xfb62('0x9b')]=function(_0x570715,_0x194d09,_0x141230){var _0x1efed2={};var _0x21cb14={};var _0x573fd6;var _0x62151;return db['Team'][_0xfb62('0x6e')]({'where':{'id':_0x570715[_0xfb62('0x47')]['id']}})['then'](handleEntityNotFound(_0x194d09,null))[_0xfb62('0x29')](function(_0x4e3fde){if(_0x4e3fde){_0x573fd6=_0x4e3fde;_0x21cb14['model']=_[_0xfb62('0x33')](db['User'][_0xfb62('0x73')]);_0x21cb14[_0xfb62('0x34')]=_['keys'](_0x570715[_0xfb62('0x34')]);_0x21cb14['filters']=_[_0xfb62('0x36')](_0x21cb14[_0xfb62('0x37')],_0x21cb14[_0xfb62('0x34')]);_0x1efed2[_0xfb62('0x39')]=_['intersection'](_0x21cb14[_0xfb62('0x37')],qs[_0xfb62('0x38')](_0x570715[_0xfb62('0x34')][_0xfb62('0x38')]));_0x1efed2[_0xfb62('0x39')]=_0x1efed2[_0xfb62('0x39')]['length']?_0x1efed2['attributes']:_0x21cb14[_0xfb62('0x37')];_0x1efed2[_0xfb62('0x74')]=qs[_0xfb62('0x3d')](_0x570715['query']['sort']);_0x1efed2[_0xfb62('0x3e')]=qs[_0xfb62('0x35')](_[_0xfb62('0x3f')](_0x570715['query'],_0x21cb14['filters']));if(_0x570715[_0xfb62('0x34')][_0xfb62('0x40')]){_0x1efed2[_0xfb62('0x3e')]=_[_0xfb62('0x41')](_0x1efed2['where'],{'$or':_['map'](_0x1efed2['attributes'],function(_0x35fafa){var _0x44898a={};_0x44898a[_0x35fafa]={'$like':'%'+_0x570715[_0xfb62('0x34')]['filter']+'%'};return _0x44898a;})});}_0x1efed2=_['merge']({},_0x1efed2,_0x570715[_0xfb62('0x48')]);return _0x573fd6[_0xfb62('0x9b')](_0x1efed2);}})[_0xfb62('0x29')](function(_0x4d2073){if(_0x4d2073){_0x62151=_0x4d2073[_0xfb62('0x3a')];if(!_0x570715['query'][_0xfb62('0x3b')](_0xfb62('0x3c'))){_0x1efed2[_0xfb62('0x22')]=qs['limit'](_0x570715[_0xfb62('0x34')][_0xfb62('0x22')]);_0x1efed2['offset']=qs[_0xfb62('0x21')](_0x570715[_0xfb62('0x34')][_0xfb62('0x21')]);}return _0x573fd6[_0xfb62('0x9b')](_0x1efed2);}})['then'](function(_0x4ef283){if(_0x4ef283){return _0x4ef283?{'count':_0x62151,'rows':_0x4ef283}:null;}})['then'](respondWithResult(_0x194d09,null))[_0xfb62('0x45')](handleError(_0x194d09,null));}; \ No newline at end of file +var _0x6f88=['key','name','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','VIRTUAL','options','Team','then','includeAll','include','findAll','catch','show','params','model','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','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','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','order','toLowerCase','Queues','removeQueues','remove','ids','addAgents','isArray','Voice','Sms','Openchannel','through','penalty','QueueId','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','Chat','Mail','Fax','Queue:remove','pick','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x6f88,0x1a8));var _0x86f8=function(_0x2bf5c0,_0x116255){_0x2bf5c0=_0x2bf5c0-0x0;var _0x36c63c=_0x6f88[_0x2bf5c0];return _0x36c63c;};'use strict';var emlformat=require(_0x86f8('0x0'));var rimraf=require(_0x86f8('0x1'));var zipdir=require(_0x86f8('0x2'));var jsonpatch=require(_0x86f8('0x3'));var rp=require(_0x86f8('0x4'));var moment=require('moment');var BPromise=require(_0x86f8('0x5'));var Mustache=require(_0x86f8('0x6'));var util=require(_0x86f8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x86f8('0x8'));var ejs=require(_0x86f8('0x9'));var fs=require('fs');var fs_extra=require(_0x86f8('0xa'));var _=require('lodash');var squel=require(_0x86f8('0xb'));var crypto=require('crypto');var jsforce=require(_0x86f8('0xc'));var deskjs=require(_0x86f8('0xd'));var toCsv=require(_0x86f8('0x8'));var querystring=require(_0x86f8('0xe'));var Papa=require('papaparse');var Redis=require(_0x86f8('0xf'));var authService=require(_0x86f8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x86f8('0x11'));var hardwareService=require(_0x86f8('0x12'));var logger=require(_0x86f8('0x13'))('api');var utils=require(_0x86f8('0x14'));var config=require(_0x86f8('0x15'));var licenseUtil=require(_0x86f8('0x16'));var db=require('../../mysqldb')['db'];config[_0x86f8('0x17')]=_[_0x86f8('0x18')](config[_0x86f8('0x17')],{'host':_0x86f8('0x19'),'port':0x18eb});var socket=require(_0x86f8('0x1a'))(new Redis(config[_0x86f8('0x17')]));require(_0x86f8('0x1b'))[_0x86f8('0x1c')](socket);function respondWithStatusCode(_0x5eaa43,_0x425c5b){_0x425c5b=_0x425c5b||0xcc;return function(_0x21a772){if(_0x21a772){return _0x5eaa43['sendStatus'](_0x425c5b);}return _0x5eaa43[_0x86f8('0x1d')](_0x425c5b)['end']();};}function respondWithResult(_0x4ec96a,_0x545f8c){_0x545f8c=_0x545f8c||0xc8;return function(_0x5d36d9){if(_0x5d36d9){return _0x4ec96a[_0x86f8('0x1d')](_0x545f8c)[_0x86f8('0x1e')](_0x5d36d9);}};}function respondWithFilteredResult(_0x47db25,_0x5e53ae){return function(_0x43db4f){if(_0x43db4f){var _0x2d5b36=typeof _0x5e53ae[_0x86f8('0x1f')]===_0x86f8('0x20')&&typeof _0x5e53ae[_0x86f8('0x21')]===_0x86f8('0x20');var _0x3154b5=_0x43db4f['count'];var _0x25c042=_0x2d5b36?0x0:_0x5e53ae['offset'];var _0x13af26=_0x2d5b36?_0x43db4f[_0x86f8('0x22')]:_0x5e53ae['offset']+_0x5e53ae[_0x86f8('0x21')];var _0xc20320;if(_0x13af26>=_0x3154b5){_0x13af26=_0x3154b5;_0xc20320=0xc8;}else{_0xc20320=0xce;}_0x47db25[_0x86f8('0x1d')](_0xc20320);return _0x47db25[_0x86f8('0x23')](_0x86f8('0x24'),_0x25c042+'-'+_0x13af26+'/'+_0x3154b5)[_0x86f8('0x1e')](_0x43db4f);}return null;};}function patchUpdates(_0x339787){return function(_0x1fde5e){try{jsonpatch[_0x86f8('0x25')](_0x1fde5e,_0x339787,!![]);}catch(_0x3c0767){return BPromise[_0x86f8('0x26')](_0x3c0767);}return _0x1fde5e[_0x86f8('0x27')]();};}function saveUpdates(_0xbcf9b5,_0x1a7413){return function(_0x5e3f3e){if(_0x5e3f3e){return _0x5e3f3e[_0x86f8('0x28')](_0xbcf9b5)['then'](function(_0xbdd944){return _0xbdd944;});}return null;};}function handleEntityNotFound(_0xa55878,_0x562e79){return function(_0x1bda64){if(!_0x1bda64){_0xa55878[_0x86f8('0x29')](0x194);}return _0x1bda64;};}function handleError(_0x5880db,_0x352734){_0x352734=_0x352734||0x1f4;return function(_0x6dbb5e){logger[_0x86f8('0x2a')](_0x6dbb5e[_0x86f8('0x2b')]);if(_0x6dbb5e['name']){delete _0x6dbb5e['name'];}_0x5880db[_0x86f8('0x1d')](_0x352734)[_0x86f8('0x2c')](_0x6dbb5e);};}exports[_0x86f8('0x2d')]=function(_0x31ed90,_0x30eb71){var _0x566184={},_0x3f366d={},_0x4b17f5={'count':0x0,'rows':[]};var _0x1603dd=_[_0x86f8('0x2e')](db['Team'][_0x86f8('0x2f')],function(_0xde0899){return{'name':_0xde0899[_0x86f8('0x30')],'type':_0xde0899[_0x86f8('0x31')][_0x86f8('0x32')]};});_0x3f366d['model']=_[_0x86f8('0x2e')](_0x1603dd,_0x86f8('0x33'));_0x3f366d[_0x86f8('0x34')]=_[_0x86f8('0x35')](_0x31ed90[_0x86f8('0x34')]);_0x3f366d[_0x86f8('0x36')]=_[_0x86f8('0x37')](_0x3f366d['model'],_0x3f366d['query']);_0x566184[_0x86f8('0x38')]=_[_0x86f8('0x37')](_0x3f366d['model'],qs[_0x86f8('0x39')](_0x31ed90['query'][_0x86f8('0x39')]));_0x566184['attributes']=_0x566184[_0x86f8('0x38')][_0x86f8('0x3a')]?_0x566184[_0x86f8('0x38')]:_0x3f366d['model'];if(!_0x31ed90[_0x86f8('0x34')]['hasOwnProperty']('nolimit')){_0x566184[_0x86f8('0x21')]=qs['limit'](_0x31ed90[_0x86f8('0x34')][_0x86f8('0x21')]);_0x566184[_0x86f8('0x1f')]=qs[_0x86f8('0x1f')](_0x31ed90['query'][_0x86f8('0x1f')]);}_0x566184['order']=qs['sort'](_0x31ed90[_0x86f8('0x34')][_0x86f8('0x3b')]);_0x566184['where']=qs[_0x86f8('0x36')](_['pick'](_0x31ed90['query'],_0x3f366d[_0x86f8('0x36')]),_0x1603dd);if(_0x31ed90[_0x86f8('0x34')][_0x86f8('0x3c')]){_0x566184[_0x86f8('0x3d')]=_['merge'](_0x566184[_0x86f8('0x3d')],{'$or':_[_0x86f8('0x2e')](_0x1603dd,function(_0x10b254){if(_0x10b254['type']!==_0x86f8('0x3e')){var _0x55e615={};_0x55e615[_0x10b254['name']]={'$like':'%'+_0x31ed90[_0x86f8('0x34')][_0x86f8('0x3c')]+'%'};return _0x55e615;}})});}_0x566184=_['merge']({},_0x566184,_0x31ed90[_0x86f8('0x3f')]);var _0x19b350={'where':_0x566184['where']};return db[_0x86f8('0x40')][_0x86f8('0x22')](_0x19b350)[_0x86f8('0x41')](function(_0x463cfc){_0x4b17f5[_0x86f8('0x22')]=_0x463cfc;if(_0x31ed90['query'][_0x86f8('0x42')]){_0x566184[_0x86f8('0x43')]=[{'all':!![]}];}return db[_0x86f8('0x40')][_0x86f8('0x44')](_0x566184);})['then'](function(_0x438c78){_0x4b17f5['rows']=_0x438c78;return _0x4b17f5;})['then'](respondWithFilteredResult(_0x30eb71,_0x566184))[_0x86f8('0x45')](handleError(_0x30eb71,null));};exports[_0x86f8('0x46')]=function(_0x32384c,_0x5d1700){var _0x23d4e1={'raw':![],'where':{'id':_0x32384c[_0x86f8('0x47')]['id']}},_0x2035d3={};_0x2035d3[_0x86f8('0x48')]=_[_0x86f8('0x35')](db[_0x86f8('0x40')][_0x86f8('0x2f')]);_0x2035d3[_0x86f8('0x34')]=_['keys'](_0x32384c['query']);_0x2035d3[_0x86f8('0x36')]=_[_0x86f8('0x37')](_0x2035d3['model'],_0x2035d3[_0x86f8('0x34')]);_0x23d4e1['attributes']=_[_0x86f8('0x37')](_0x2035d3[_0x86f8('0x48')],qs[_0x86f8('0x39')](_0x32384c[_0x86f8('0x34')][_0x86f8('0x39')]));_0x23d4e1[_0x86f8('0x38')]=_0x23d4e1[_0x86f8('0x38')][_0x86f8('0x3a')]?_0x23d4e1[_0x86f8('0x38')]:_0x2035d3[_0x86f8('0x48')];if(_0x32384c[_0x86f8('0x34')][_0x86f8('0x42')]){_0x23d4e1[_0x86f8('0x43')]=[{'all':!![]}];}_0x23d4e1=_[_0x86f8('0x49')]({},_0x23d4e1,_0x32384c[_0x86f8('0x3f')]);return db[_0x86f8('0x40')][_0x86f8('0x4a')](_0x23d4e1)[_0x86f8('0x41')](handleEntityNotFound(_0x5d1700,null))['then'](respondWithResult(_0x5d1700,null))[_0x86f8('0x45')](handleError(_0x5d1700,null));};exports[_0x86f8('0x4b')]=function(_0xb4d74d,_0x9e483e){return db['Team'][_0x86f8('0x4b')](_0xb4d74d[_0x86f8('0x4c')],{})[_0x86f8('0x41')](function(_0x4b2c68){var _0x23f61c=_0xb4d74d[_0x86f8('0x4d')][_0x86f8('0x4e')]({'plain':!![]});if(!_0x23f61c)throw new Error(_0x86f8('0x4f'));if(_0x23f61c[_0x86f8('0x50')]===_0x86f8('0x4d')){var _0x3e1d64=_0x4b2c68[_0x86f8('0x4e')]({'plain':!![]});var _0xa9f2de=_0x86f8('0x51');return db[_0x86f8('0x52')][_0x86f8('0x4a')]({'where':{'name':_0xa9f2de,'userProfileId':_0x23f61c['userProfileId']},'raw':!![]})[_0x86f8('0x41')](function(_0x36ab2b){if(_0x36ab2b&&_0x36ab2b['autoAssociation']===0x0){return db[_0x86f8('0x53')]['create']({'name':_0x3e1d64[_0x86f8('0x33')],'resourceId':_0x3e1d64['id'],'type':_0x36ab2b['name'],'sectionId':_0x36ab2b['id']},{})[_0x86f8('0x41')](function(){return _0x4b2c68;});}else{return _0x4b2c68;}})[_0x86f8('0x45')](function(_0x4507f7){logger[_0x86f8('0x2a')](_0x86f8('0x54'),_0x4507f7);throw _0x4507f7;});}return _0x4b2c68;})[_0x86f8('0x41')](respondWithResult(_0x9e483e,0xc9))['catch'](handleError(_0x9e483e,null));};exports[_0x86f8('0x28')]=function(_0x4fb3d9,_0xccf497){if(_0x4fb3d9[_0x86f8('0x4c')]['id']){delete _0x4fb3d9[_0x86f8('0x4c')]['id'];}return db['Team']['find']({'where':{'id':_0x4fb3d9[_0x86f8('0x47')]['id']}})[_0x86f8('0x41')](handleEntityNotFound(_0xccf497,null))[_0x86f8('0x41')](saveUpdates(_0x4fb3d9[_0x86f8('0x4c')],null))['then'](respondWithResult(_0xccf497,null))[_0x86f8('0x45')](handleError(_0xccf497,null));};exports[_0x86f8('0x55')]=function(_0x565c41,_0x28da10){var _0x417341=_0x565c41['params']['id'];var _0xc05376=[];return db[_0x86f8('0x56')][_0x86f8('0x57')](function(_0x26ad47){var _0x4153e9='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x417341;return db['sequelize'][_0x86f8('0x34')](_0x4153e9,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47})[_0x86f8('0x41')](function(_0x5cf52f){_0xc05376=_[_0x86f8('0x2e')](_0x5cf52f,function(_0x2cfc59){return Number(_0x2cfc59[_0x86f8('0x5b')]);});})[_0x86f8('0x41')](function(){var _0x17f8bf=_0x86f8('0x5c')+_0x417341;return db['sequelize'][_0x86f8('0x34')](_0x17f8bf,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x1552cc){var _0x81f9a7=_[_0x86f8('0x2e')](_0x1552cc,function(_0x1d280e){return Number(_0x1d280e['VoiceQueueId']);});return db[_0x86f8('0x5d')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'VoiceQueueId':{'$in':_0x81f9a7}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x3a9d82=_0x86f8('0x5e')+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x3a9d82,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')]['SELECT'],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x5c7770){var _0xefd79e=_[_0x86f8('0x2e')](_0x5c7770,function(_0x320199){return Number(_0x320199[_0x86f8('0x5f')]);});return db[_0x86f8('0x60')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'MailQueueId':{'$in':_0xefd79e}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x50fe2e='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x50fe2e,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})['then'](function(_0x1de55f){var _0x227eef=_[_0x86f8('0x2e')](_0x1de55f,function(_0x2dd6e2){return Number(_0x2dd6e2[_0x86f8('0x61')]);});return db[_0x86f8('0x62')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'SmsQueueId':{'$in':_0x227eef}},'transaction':_0x26ad47});})['then'](function(){var _0x542b81='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x542b81,{'type':db['Sequelize'][_0x86f8('0x59')]['SELECT'],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x21c942){var _0x4166c5=_[_0x86f8('0x2e')](_0x21c942,function(_0x22c18b){return Number(_0x22c18b[_0x86f8('0x63')]);});return db[_0x86f8('0x64')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'ChatQueueId':{'$in':_0x4166c5}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x78c41d=_0x86f8('0x65')+_0x417341;return db['sequelize'][_0x86f8('0x34')](_0x78c41d,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x2baa00){var _0x55625b=_[_0x86f8('0x2e')](_0x2baa00,function(_0x78fb6b){return Number(_0x78fb6b[_0x86f8('0x66')]);});return db[_0x86f8('0x67')]['destroy']({'where':{'UserId':{'$in':_0xc05376},'FaxQueueId':{'$in':_0x55625b}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){var _0x50f2ab=_0x86f8('0x68')+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x50f2ab,{'type':db['Sequelize'][_0x86f8('0x59')][_0x86f8('0x5a')],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x47519e){var _0x363941=_[_0x86f8('0x2e')](_0x47519e,function(_0x4f7c19){return Number(_0x4f7c19[_0x86f8('0x69')]);});return db['UserOpenchannelQueue'][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'OpenchannelQueueId':{'$in':_0x363941}},'transaction':_0x26ad47});})['then'](function(){var _0x374bd6=_0x86f8('0x6a')+_0x417341;return db[_0x86f8('0x56')][_0x86f8('0x34')](_0x374bd6,{'type':db[_0x86f8('0x58')][_0x86f8('0x59')]['SELECT'],'raw':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x3dc02d){var _0x5816e5=_[_0x86f8('0x2e')](_0x3dc02d,function(_0x505bd5){return Number(_0x505bd5[_0x86f8('0x6b')]);});return db['UserWhatsappQueue'][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'WhatsappQueueId':{'$in':_0x5816e5}},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){return db['TeamVoicePrefix'][_0x86f8('0x4a')]({'where':{'TeamId':_0x417341}});})[_0x86f8('0x41')](function(_0x556679){if(_0x556679===null){return;}return db[_0x86f8('0x6c')][_0x86f8('0x55')]({'where':{'UserId':{'$in':_0xc05376},'VoicePrefixId':_0x556679[_0x86f8('0x6d')]},'transaction':_0x26ad47});})[_0x86f8('0x41')](function(){return db[_0x86f8('0x40')]['destroy']({'where':{'id':_0x417341},'cascade':!![],'transaction':_0x26ad47});})[_0x86f8('0x41')](function(_0x5e62c2){if(_0x5e62c2===0x0){_0x28da10[_0x86f8('0x29')](0x194);}else{return db['UserProfileResource'][_0x86f8('0x55')]({'where':{'type':_0x86f8('0x51'),'resourceId':_0x417341},'cascade':!![],'transaction':_0x26ad47})[_0x86f8('0x41')](function(){_0x28da10[_0x86f8('0x1d')](0xcc)[_0x86f8('0x6e')]();});}})[_0x86f8('0x45')](function(_0x55b3bd){_0x28da10['status'](0x1f4)['send'](_0x55b3bd);});});};exports[_0x86f8('0x6f')]=function(_0x396b86,_0x121419,_0x18919d){return db[_0x86f8('0x40')][_0x86f8('0x70')]({'where':{'id':_0x396b86[_0x86f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x121419,null))['then'](function(_0x3a8263){if(!_0x396b86['query'][_0x86f8('0x71')]||!utils[_0x86f8('0x72')](_0x396b86[_0x86f8('0x34')][_0x86f8('0x71')])){throw new db['Sequelize'][(_0x86f8('0x73'))](_0x86f8('0x74'));}var _0x1ccf2e={};var _0x536eab={};_0x536eab[_0x86f8('0x48')]=_['keys'](db[_[_0x86f8('0x75')](_0x396b86[_0x86f8('0x34')]['channel']['toLowerCase']())+_0x86f8('0x76')][_0x86f8('0x2f')]);_0x536eab[_0x86f8('0x34')]=_[_0x86f8('0x35')](_0x396b86[_0x86f8('0x34')]);_0x536eab[_0x86f8('0x36')]=_[_0x86f8('0x37')](_0x536eab[_0x86f8('0x48')],_0x536eab['query']);_0x1ccf2e[_0x86f8('0x38')]=_['intersection'](_0x536eab[_0x86f8('0x48')],qs['fields'](_0x396b86[_0x86f8('0x34')][_0x86f8('0x39')]));_0x1ccf2e['attributes']=_0x1ccf2e[_0x86f8('0x38')][_0x86f8('0x3a')]?_0x1ccf2e[_0x86f8('0x38')]:_0x536eab[_0x86f8('0x48')];_0x1ccf2e[_0x86f8('0x21')]=qs[_0x86f8('0x21')](_0x396b86[_0x86f8('0x34')][_0x86f8('0x21')]);_0x1ccf2e[_0x86f8('0x1f')]=qs[_0x86f8('0x1f')](_0x396b86['query'][_0x86f8('0x1f')]);_0x1ccf2e[_0x86f8('0x77')]=qs['sort'](_0x396b86['query'][_0x86f8('0x3b')]);_0x1ccf2e[_0x86f8('0x3d')]=qs['filters'](_['pick'](_0x396b86['query'],_0x536eab[_0x86f8('0x36')]));_0x1ccf2e=_['merge']({},_0x1ccf2e,_0x396b86[_0x86f8('0x3f')]);return _0x3a8263['get'+_[_0x86f8('0x75')](_0x396b86[_0x86f8('0x34')]['channel'][_0x86f8('0x78')]())+_0x86f8('0x79')](_0x1ccf2e);})[_0x86f8('0x41')](respondWithResult(_0x121419,null))[_0x86f8('0x45')](handleError(_0x121419,null));};exports['addQueues']=function(_0x5c2bc7,_0x43aeb3,_0x3ebc04){return db[_0x86f8('0x40')][_0x86f8('0x70')]({'where':{'id':_0x5c2bc7['params']['id']}})[_0x86f8('0x41')](function(_0x210816){if(_0x210816){if(!_0x5c2bc7['body']['channel']||!utils[_0x86f8('0x72')](_0x5c2bc7[_0x86f8('0x4c')]['channel'])){throw new db[(_0x86f8('0x58'))][(_0x86f8('0x73'))](_0x86f8('0x74'));}return _0x210816['add'+_[_0x86f8('0x75')](_0x5c2bc7['body'][_0x86f8('0x71')][_0x86f8('0x78')]())+_0x86f8('0x79')](_0x5c2bc7[_0x86f8('0x4c')]['ids']);}return null;})[_0x86f8('0x41')](handleEntityNotFound(_0x43aeb3,null))[_0x86f8('0x41')](respondWithStatusCode(_0x43aeb3,null))['catch'](handleError(_0x43aeb3,null));};exports[_0x86f8('0x7a')]=function(_0x24e760,_0x21fd14,_0xa9dc08){return db[_0x86f8('0x40')]['findOne']({'where':{'id':_0x24e760['params']['id']}})[_0x86f8('0x41')](function(_0x52a685){if(_0x52a685){if(!_0x24e760[_0x86f8('0x34')][_0x86f8('0x71')]||!utils[_0x86f8('0x72')](_0x24e760['query'][_0x86f8('0x71')])){throw new db[(_0x86f8('0x58'))][(_0x86f8('0x73'))](_0x86f8('0x74'));}return _0x52a685[_0x86f8('0x7b')+_[_0x86f8('0x75')](_0x24e760[_0x86f8('0x34')][_0x86f8('0x71')][_0x86f8('0x78')]())+'Queues'](_0x24e760[_0x86f8('0x34')][_0x86f8('0x7c')]);}return null;})[_0x86f8('0x41')](handleEntityNotFound(_0x21fd14,null))[_0x86f8('0x41')](respondWithStatusCode(_0x21fd14,null))[_0x86f8('0x45')](handleError(_0x21fd14,null));};exports[_0x86f8('0x7d')]=function(_0x5f4613,_0x51d77b){var _0x4ba208=_[_0x86f8('0x7e')](_0x5f4613[_0x86f8('0x4c')][_0x86f8('0x7c')])?_0x5f4613[_0x86f8('0x4c')][_0x86f8('0x7c')]:[_0x5f4613['body'][_0x86f8('0x7c')]];var _0x4868ac=_0x5f4613[_0x86f8('0x47')]['id'];return db[_0x86f8('0x40')]['find']({'where':{'id':_0x4868ac}})['then'](handleEntityNotFound(_0x51d77b,null))[_0x86f8('0x41')](function(_0x23481b){if(_0x23481b){var _0x493c12=[_0x86f8('0x7f'),'Chat','Mail',_0x86f8('0x80'),'Fax',_0x86f8('0x81'),'Whatsapp'];return db[_0x86f8('0x56')][_0x86f8('0x57')](function(_0x2e4872){var _0x4fe442=_[_0x86f8('0x2e')](_0x493c12,function(_0x2963b4){var _0x4d2460={'attributes':['id',_0x86f8('0x33')]};if(_0x2963b4===_0x86f8('0x7f')){_0x4d2460[_0x86f8('0x82')]={'attributes':[_0x86f8('0x83')]};}return _0x23481b['get'+_0x2963b4+_0x86f8('0x79')](_0x4d2460)[_0x86f8('0x41')](function(_0x561884){var _0x1503ae=_[_0x86f8('0x2e')](_0x561884,function(_0x11834f){var _0x294cf2=_['map'](_0x4ba208,function(_0x319566){var _0x308f07={'where':{'UserId':_0x319566,[_0x2963b4+_0x86f8('0x84')]:_0x11834f['id']},'transaction':_0x2e4872};if(_0x2963b4===_0x86f8('0x7f')){_0x308f07[_0x86f8('0x18')]={'penalty':_0x11834f['TeamVoiceQueue'][_0x86f8('0x83')]};}return db[_0x86f8('0x85')+_0x2963b4+'Queue'][_0x86f8('0x86')](_0x308f07)['then'](function(){socket[_0x86f8('0x87')](_0x86f8('0x4d')+_0x2963b4+_0x86f8('0x88'),{'UserId':_0x319566,[_0x2963b4+_0x86f8('0x84')]:_0x11834f['id']});if(_0x2963b4!==_0x86f8('0x7f')){return;}return db[_0x86f8('0x85')][_0x86f8('0x44')]({'where':{'id':_0x4ba208,'online':0x1},'attributes':['id',_0x86f8('0x33'),_0x86f8('0x89'),_0x86f8('0x8a'),'interface'],'raw':!![]})['then'](function(_0x247c02){var _0x390f42=_[_0x86f8('0x2e')](_0x247c02,function(_0x428c34){return db[_0x86f8('0x8b')][_0x86f8('0x8c')]({'membername':_0x428c34[_0x86f8('0x33')],'UserId':_0x428c34['id'],'queue_name':_0x11834f[_0x86f8('0x33')],'VoiceQueueId':_0x11834f['id'],'interface':_[_0x86f8('0x8d')](_0x428c34['interface'])?util[_0x86f8('0x8e')](_0x86f8('0x8f'),_0x428c34['name']):_0x428c34[_0x86f8('0x90')],'paused':_0x428c34[_0x86f8('0x8a')]||![],'penalty':_0x11834f[_0x86f8('0x91')][_0x86f8('0x83')]},{'transaction':_0x2e4872});});return Promise['all'](_0x390f42);});});});return Promise['all'](_0x294cf2);});return Promise[_0x86f8('0x92')](_0x1503ae);})[_0x86f8('0x41')](function(){return db[_0x86f8('0x93')]['findOne']({'where':{'teamId':_0x4868ac}})[_0x86f8('0x41')](function(_0x1b28ba){if(_0x1b28ba){var _0x4d66f9=_[_0x86f8('0x2e')](_0x4ba208,function(_0x4c9474){db[_0x86f8('0x6c')][_0x86f8('0x8c')]({'UserId':_0x4c9474,'VoicePrefixId':_0x1b28ba[_0x86f8('0x6d')]});});return Promise[_0x86f8('0x92')](_0x4d66f9);}});});});return Promise[_0x86f8('0x92')](_0x4fe442)['then'](function(){return _0x23481b[_0x86f8('0x7d')](_0x4ba208,{'transaction':_0x2e4872})[_0x86f8('0x94')](function(_0x5167e9){return _0x5167e9;});});});}})[_0x86f8('0x41')](respondWithResult(_0x51d77b,null))[_0x86f8('0x45')](handleError(_0x51d77b,null));};exports[_0x86f8('0x95')]=function(_0x5c0dda,_0x32790e){var _0x2951e8=_[_0x86f8('0x7e')](_0x5c0dda[_0x86f8('0x34')][_0x86f8('0x7c')])?_0x5c0dda[_0x86f8('0x34')][_0x86f8('0x7c')]:[_0x5c0dda['query'][_0x86f8('0x7c')]];var _0x5e6b2c=_0x5c0dda['params']['id'];return db[_0x86f8('0x40')][_0x86f8('0x4a')]({'where':{'id':_0x5e6b2c}})['then'](handleEntityNotFound(_0x32790e,null))[_0x86f8('0x41')](function(_0x135312){if(_0x135312){var _0x536666=[_0x86f8('0x7f'),_0x86f8('0x96'),_0x86f8('0x97'),_0x86f8('0x80'),_0x86f8('0x98'),_0x86f8('0x81'),'Whatsapp'];return db[_0x86f8('0x56')][_0x86f8('0x57')](function(_0x4d9243){var _0x5979a4=_[_0x86f8('0x2e')](_0x536666,function(_0x381f62){var _0x41b5ca={'attributes':['id','name']};return _0x135312[_0x86f8('0x4e')+_0x381f62+_0x86f8('0x79')](_0x41b5ca)[_0x86f8('0x41')](function(_0x49f3c0){var _0x13d834=_[_0x86f8('0x2e')](_0x49f3c0,function(_0xd34407){return _0xd34407['removeAgents'](_0x2951e8,{'transaction':_0x4d9243})[_0x86f8('0x41')](function(){var _0x1c039d=_['map'](_0x2951e8,function(_0x53c790){socket[_0x86f8('0x87')](_0x86f8('0x4d')+_0x381f62+_0x86f8('0x99'),{'UserId':Number(_0x53c790),[_0x381f62+_0x86f8('0x84')]:_0xd34407['id']});if(_0x381f62!==_0x86f8('0x7f')){return;}return db[_0x86f8('0x8b')]['destroy']({'where':{'VoiceQueueId':_0xd34407['id'],'UserId':_0x53c790},'transaction':_0x4d9243});});return Promise[_0x86f8('0x92')](_0x1c039d);});});return Promise['all'](_0x13d834);});});return Promise['all'](_0x5979a4)[_0x86f8('0x41')](function(){return _0x135312['removeAgents'](_0x2951e8,{'transaction':_0x4d9243});})['then'](function(){return db[_0x86f8('0x93')][_0x86f8('0x70')]({'where':{'teamId':_0x5e6b2c}})[_0x86f8('0x41')](function(_0x450209){if(_0x450209){var _0x323394=_[_0x86f8('0x2e')](_0x2951e8,function(_0x1468a1){db['UserVoicePrefix'][_0x86f8('0x55')]({'where':{'UserId':_0x1468a1,'VoicePrefixId':_0x450209[_0x86f8('0x6d')]}});});return Promise['all'](_0x323394);}});});});}})['then'](respondWithStatusCode(_0x32790e,null))['catch'](handleError(_0x32790e,null));};exports['getAgents']=function(_0x55d089,_0x4b7b88,_0x21745b){var _0xfb7ec8={};var _0x5dbd31={};var _0x3e6517;var _0x4821da;return db['Team']['findOne']({'where':{'id':_0x55d089[_0x86f8('0x47')]['id']}})[_0x86f8('0x41')](handleEntityNotFound(_0x4b7b88,null))[_0x86f8('0x41')](function(_0x313af1){if(_0x313af1){_0x3e6517=_0x313af1;_0x5dbd31[_0x86f8('0x48')]=_[_0x86f8('0x35')](db['User'][_0x86f8('0x2f')]);_0x5dbd31['query']=_[_0x86f8('0x35')](_0x55d089[_0x86f8('0x34')]);_0x5dbd31[_0x86f8('0x36')]=_['intersection'](_0x5dbd31[_0x86f8('0x48')],_0x5dbd31[_0x86f8('0x34')]);_0xfb7ec8[_0x86f8('0x38')]=_['intersection'](_0x5dbd31[_0x86f8('0x48')],qs[_0x86f8('0x39')](_0x55d089['query'][_0x86f8('0x39')]));_0xfb7ec8[_0x86f8('0x38')]=_0xfb7ec8['attributes'][_0x86f8('0x3a')]?_0xfb7ec8[_0x86f8('0x38')]:_0x5dbd31[_0x86f8('0x48')];_0xfb7ec8[_0x86f8('0x77')]=qs['sort'](_0x55d089[_0x86f8('0x34')]['sort']);_0xfb7ec8[_0x86f8('0x3d')]=qs[_0x86f8('0x36')](_[_0x86f8('0x9a')](_0x55d089[_0x86f8('0x34')],_0x5dbd31[_0x86f8('0x36')]));if(_0x55d089[_0x86f8('0x34')][_0x86f8('0x3c')]){_0xfb7ec8[_0x86f8('0x3d')]=_['merge'](_0xfb7ec8[_0x86f8('0x3d')],{'$or':_[_0x86f8('0x2e')](_0xfb7ec8['attributes'],function(_0x317bc3){var _0x38b205={};_0x38b205[_0x317bc3]={'$like':'%'+_0x55d089[_0x86f8('0x34')][_0x86f8('0x3c')]+'%'};return _0x38b205;})});}_0xfb7ec8=_['merge']({},_0xfb7ec8,_0x55d089[_0x86f8('0x3f')]);return _0x3e6517[_0x86f8('0x9b')](_0xfb7ec8);}})[_0x86f8('0x41')](function(_0x7dd757){if(_0x7dd757){_0x4821da=_0x7dd757[_0x86f8('0x3a')];if(!_0x55d089[_0x86f8('0x34')][_0x86f8('0x9c')](_0x86f8('0x9d'))){_0xfb7ec8[_0x86f8('0x21')]=qs['limit'](_0x55d089[_0x86f8('0x34')][_0x86f8('0x21')]);_0xfb7ec8['offset']=qs[_0x86f8('0x1f')](_0x55d089['query']['offset']);}return _0x3e6517[_0x86f8('0x9b')](_0xfb7ec8);}})[_0x86f8('0x41')](function(_0x5180a5){if(_0x5180a5){return _0x5180a5?{'count':_0x4821da,'rows':_0x5180a5}:null;}})[_0x86f8('0x41')](respondWithResult(_0x4b7b88,null))[_0x86f8('0x45')](handleError(_0x4b7b88,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c041d54..eb6c13a 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 _0xfe8b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe8b,0xae));var _0xbfe8=function(_0x42e887,_0xd64733){_0x42e887=_0x42e887-0x0;var _0x226761=_0xfe8b[_0x42e887];return _0x226761;};'use strict';var EventEmitter=require(_0xbfe8('0x0'));var Team=require(_0xbfe8('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbfe8('0x2'),'afterUpdate':_0xbfe8('0x3'),'afterDestroy':_0xbfe8('0x4')};function emitEvent(_0x28de73){return function(_0x171079,_0x5493cb,_0x487aa8){TeamEvents[_0xbfe8('0x5')](_0x28de73+':'+_0x171079['id'],_0x171079);TeamEvents['emit'](_0x28de73,_0x171079);_0x487aa8(null);};}for(var e in events){if(events[_0xbfe8('0x6')](e)){var event=events[e];Team[_0xbfe8('0x7')](e,emitEvent(event));}}module[_0xbfe8('0x8')]=TeamEvents; \ No newline at end of file +var _0x1407=['hook','Team','setMaxListeners','update','remove','emit'];(function(_0xaeb047,_0x9fd6ea){var _0x4cfc83=function(_0x2e086c){while(--_0x2e086c){_0xaeb047['push'](_0xaeb047['shift']());}};_0x4cfc83(++_0x9fd6ea);}(_0x1407,0x1b1));var _0x7140=function(_0xfd144e,_0x18ef55){_0xfd144e=_0xfd144e-0x0;var _0x13e4d3=_0x1407[_0xfd144e];return _0x13e4d3;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x7140('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x7140('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7140('0x2'),'afterDestroy':_0x7140('0x3')};function emitEvent(_0x1de9f7){return function(_0x508b82,_0x4c190e,_0x1f6d9f){TeamEvents[_0x7140('0x4')](_0x1de9f7+':'+_0x508b82['id'],_0x508b82);TeamEvents[_0x7140('0x4')](_0x1de9f7,_0x508b82);_0x1f6d9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x7140('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c6b5281..d5317b9 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 _0x0c39=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Team','teams','lodash','util','../../config/logger','api','moment'];(function(_0x34ec21,_0x339812){var _0x278f94=function(_0x1df4b6){while(--_0x1df4b6){_0x34ec21['push'](_0x34ec21['shift']());}};_0x278f94(++_0x339812);}(_0x0c39,0x14d));var _0x90c3=function(_0x26b374,_0x1a419a){_0x26b374=_0x26b374-0x0;var _0x2f3c21=_0x0c39[_0x26b374];return _0x2f3c21;};'use strict';var _=require(_0x90c3('0x0'));var util=require(_0x90c3('0x1'));var logger=require(_0x90c3('0x2'))(_0x90c3('0x3'));var moment=require(_0x90c3('0x4'));var BPromise=require(_0x90c3('0x5'));var rp=require(_0x90c3('0x6'));var fs=require('fs');var path=require(_0x90c3('0x7'));var rimraf=require(_0x90c3('0x8'));var config=require(_0x90c3('0x9'));var attributes=require('./team.attributes');module[_0x90c3('0xa')]=function(_0x36012b,_0x4fea4f){return _0x36012b['define'](_0x90c3('0xb'),attributes,{'tableName':_0x90c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6d4=['util','../../config/logger','moment','bluebird','path','rimraf','exports','Team','teams','lodash'];(function(_0x56a7e3,_0x3cbd6d){var _0x5210cc=function(_0x299298){while(--_0x299298){_0x56a7e3['push'](_0x56a7e3['shift']());}};_0x5210cc(++_0x3cbd6d);}(_0xe6d4,0x153));var _0x4e6d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe6d4[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x4e6d('0x0'));var util=require(_0x4e6d('0x1'));var logger=require(_0x4e6d('0x2'))('api');var moment=require(_0x4e6d('0x3'));var BPromise=require(_0x4e6d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e6d('0x5'));var rimraf=require(_0x4e6d('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x4e6d('0x7')]=function(_0x6173b1,_0x4dd4d4){return _0x6173b1['define'](_0x4e6d('0x8'),attributes,{'tableName':_0x4e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 37916d7..de2cd79 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 _0x85d8=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x85d8,0x1b0));var _0x885d=function(_0x1884c4,_0x12c560){_0x1884c4=_0x1884c4-0x0;var _0xc58ea4=_0x85d8[_0x1884c4];return _0xc58ea4;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var moment=require(_0x885d('0x2'));var BPromise=require(_0x885d('0x3'));var rs=require(_0x885d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x885d('0x5'))['db'];var utils=require(_0x885d('0x6'));var logger=require(_0x885d('0x7'))(_0x885d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x885d('0x9')][_0x885d('0xa')]({'port':0x232a});config[_0x885d('0xb')]=_[_0x885d('0xc')](config[_0x885d('0xb')],{'host':_0x885d('0xd'),'port':0x18eb});var socket=require(_0x885d('0xe'))(new Redis(config[_0x885d('0xb')]));require(_0x885d('0xf'))[_0x885d('0x10')](socket);function respondWithRpcPromise(_0x11e4e7,_0x125db6,_0x3ce28f){return new BPromise(function(_0x1e5761,_0x19c903){return client[_0x885d('0x11')](_0x11e4e7,_0x3ce28f)[_0x885d('0x12')](function(_0x2c680b){logger[_0x885d('0x13')]('Team,\x20%s,\x20%s',_0x125db6,'request\x20sent');logger[_0x885d('0x14')](_0x885d('0x15'),_0x125db6,'request\x20sent',JSON[_0x885d('0x16')](_0x2c680b));if(_0x2c680b[_0x885d('0x17')]){if(_0x2c680b['error']['code']===0x1f4){logger[_0x885d('0x17')](_0x885d('0x18'),_0x125db6,_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);return _0x19c903(_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);}logger['error']('Team,\x20%s,\x20%s',_0x125db6,_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);return _0x1e5761(_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);}else{logger[_0x885d('0x13')](_0x885d('0x18'),_0x125db6,_0x885d('0x1a'));_0x1e5761(_0x2c680b[_0x885d('0x1b')]['message']);}})[_0x885d('0x1c')](function(_0x35dfcc){logger[_0x885d('0x17')](_0x885d('0x18'),_0x125db6,_0x35dfcc);_0x19c903(_0x35dfcc);});});} \ No newline at end of file +var _0x4036=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','result','lodash','moment','ioredis','../../mysqldb'];(function(_0x51dada,_0x4ddb59){var _0x209d74=function(_0x2e1892){while(--_0x2e1892){_0x51dada['push'](_0x51dada['shift']());}};_0x209d74(++_0x4ddb59);}(_0x4036,0xa4));var _0x6403=function(_0x1e2a66,_0x1bbeed){_0x1e2a66=_0x1e2a66-0x0;var _0xde23fe=_0x4036[_0x1e2a66];return _0xde23fe;};'use strict';var _=require(_0x6403('0x0'));var util=require('util');var moment=require(_0x6403('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6403('0x2'));var db=require(_0x6403('0x3'))['db'];var utils=require(_0x6403('0x4'));var logger=require(_0x6403('0x5'))(_0x6403('0x6'));var config=require(_0x6403('0x7'));var jayson=require(_0x6403('0x8'));var client=jayson[_0x6403('0x9')][_0x6403('0xa')]({'port':0x232a});config[_0x6403('0xb')]=_[_0x6403('0xc')](config[_0x6403('0xb')],{'host':_0x6403('0xd'),'port':0x18eb});var socket=require(_0x6403('0xe'))(new Redis(config[_0x6403('0xb')]));require(_0x6403('0xf'))[_0x6403('0x10')](socket);function respondWithRpcPromise(_0x38748d,_0x341b86,_0x3288c2){return new BPromise(function(_0x56fd53,_0x1074ea){return client[_0x6403('0x11')](_0x38748d,_0x3288c2)[_0x6403('0x12')](function(_0x329731){logger[_0x6403('0x13')]('Team,\x20%s,\x20%s',_0x341b86,_0x6403('0x14'));logger[_0x6403('0x15')](_0x6403('0x16'),_0x341b86,'request\x20sent',JSON['stringify'](_0x329731));if(_0x329731['error']){if(_0x329731[_0x6403('0x17')][_0x6403('0x18')]===0x1f4){logger[_0x6403('0x17')](_0x6403('0x19'),_0x341b86,_0x329731['error'][_0x6403('0x1a')]);return _0x1074ea(_0x329731[_0x6403('0x17')][_0x6403('0x1a')]);}logger[_0x6403('0x17')]('Team,\x20%s,\x20%s',_0x341b86,_0x329731['error'][_0x6403('0x1a')]);return _0x56fd53(_0x329731[_0x6403('0x17')][_0x6403('0x1a')]);}else{logger[_0x6403('0x13')](_0x6403('0x19'),_0x341b86,_0x6403('0x14'));_0x56fd53(_0x329731[_0x6403('0x1b')][_0x6403('0x1a')]);}})['catch'](function(_0x464ab8){logger[_0x6403('0x17')](_0x6403('0x19'),_0x341b86,_0x464ab8);_0x1074ea(_0x464ab8);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0d865d6..b647203 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 _0x67c8=['save','remove','emit','removeListener','register','length','team:','./team.events'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x67c8,0x1c7));var _0x867c=function(_0x504c2d,_0x23b75a){_0x504c2d=_0x504c2d-0x0;var _0xfaea80=_0x67c8[_0x504c2d];return _0xfaea80;};'use strict';var TeamEvents=require(_0x867c('0x0'));var events=[_0x867c('0x1'),_0x867c('0x2'),'update'];function createListener(_0x666e2c,_0x36a888){return function(_0x3f4f86){_0x36a888[_0x867c('0x3')](_0x666e2c,_0x3f4f86);};}function removeListener(_0x5448ea,_0x27c5bf){return function(){TeamEvents[_0x867c('0x4')](_0x5448ea,_0x27c5bf);};}exports[_0x867c('0x5')]=function(_0x3f6d05){for(var _0x205358=0x0,_0x3785e4=events[_0x867c('0x6')];_0x205358<_0x3785e4;_0x205358++){var _0x144c79=events[_0x205358];var _0x1c2c91=createListener(_0x867c('0x7')+_0x144c79,_0x3f6d05);TeamEvents['on'](_0x144c79,_0x1c2c91);}}; \ No newline at end of file +var _0x0482=['emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x5d7b3e,_0x58f3c5){var _0x27b17d=function(_0x5a5b06){while(--_0x5a5b06){_0x5d7b3e['push'](_0x5d7b3e['shift']());}};_0x27b17d(++_0x58f3c5);}(_0x0482,0xc5));var _0x2048=function(_0x1dfdd3,_0x3e1a05){_0x1dfdd3=_0x1dfdd3-0x0;var _0x4dbacf=_0x0482[_0x1dfdd3];return _0x4dbacf;};'use strict';var TeamEvents=require(_0x2048('0x0'));var events=[_0x2048('0x1'),_0x2048('0x2'),'update'];function createListener(_0x25b14b,_0x2d8711){return function(_0x184551){_0x2d8711[_0x2048('0x3')](_0x25b14b,_0x184551);};}function removeListener(_0x4429b6,_0x25ea42){return function(){TeamEvents[_0x2048('0x4')](_0x4429b6,_0x25ea42);};}exports[_0x2048('0x5')]=function(_0x56fbb2){for(var _0x3e7b8f=0x0,_0x4755e9=events[_0x2048('0x6')];_0x3e7b8f<_0x4755e9;_0x3e7b8f++){var _0x37ddbd=events[_0x3e7b8f];var _0x62239=createListener(_0x2048('0x7')+_0x37ddbd,_0x56fbb2);TeamEvents['on'](_0x37ddbd,_0x62239);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index bc6a7c2..059a35f 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 _0xb248=['sequelize','INTEGER'];(function(_0x30032d,_0x380072){var _0x11407a=function(_0x19dfcf){while(--_0x19dfcf){_0x30032d['push'](_0x30032d['shift']());}};_0x11407a(++_0x380072);}(_0xb248,0xc6));var _0x8b24=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb248[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x8b24('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x8b24('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8b24('0x1')]}}; \ No newline at end of file +var _0x16e3=['sequelize','INTEGER'];(function(_0x2bd440,_0xfb5a9d){var _0x58f325=function(_0x19847f){while(--_0x19847f){_0x2bd440['push'](_0x2bd440['shift']());}};_0x58f325(++_0xfb5a9d);}(_0x16e3,0x168));var _0x316e=function(_0x575977,_0x3c80b5){_0x575977=_0x575977-0x0;var _0x37739e=_0x16e3[_0x575977];return _0x37739e;};'use strict';var Sequelize=require(_0x316e('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x316e('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index d6802f4..360a703 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 _0x4bde=['team_has_voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x21107b,_0x1506c3){_0x21107b=_0x21107b-0x0;var _0xb9810b=_0x4bde[_0x21107b];return _0xb9810b;};'use strict';var _=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var logger=require(_0xe4bd('0x2'))('api');var moment=require(_0xe4bd('0x3'));var BPromise=require(_0xe4bd('0x4'));var rp=require(_0xe4bd('0x5'));var fs=require('fs');var path=require(_0xe4bd('0x6'));var rimraf=require('rimraf');var config=require(_0xe4bd('0x7'));var attributes=require(_0xe4bd('0x8'));module[_0xe4bd('0x9')]=function(_0x226a63,_0x1db6d2){return _0x226a63[_0xe4bd('0xa')]('TeamVoicePrefix',attributes,{'tableName':_0xe4bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81fa=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x3f02c8,_0xab2666){var _0x5c54ed=function(_0x56b2db){while(--_0x56b2db){_0x3f02c8['push'](_0x3f02c8['shift']());}};_0x5c54ed(++_0xab2666);}(_0x81fa,0xdd));var _0xa81f=function(_0x5b78fe,_0x44542c){_0x5b78fe=_0x5b78fe-0x0;var _0x24ac3c=_0x81fa[_0x5b78fe];return _0x24ac3c;};'use strict';var _=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var logger=require('../../config/logger')(_0xa81f('0x2'));var moment=require(_0xa81f('0x3'));var BPromise=require(_0xa81f('0x4'));var rp=require(_0xa81f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa81f('0x6'));var config=require(_0xa81f('0x7'));var attributes=require(_0xa81f('0x8'));module[_0xa81f('0x9')]=function(_0x1dc233,_0x158719){return _0x1dc233[_0xa81f('0xa')](_0xa81f('0xb'),attributes,{'tableName':_0xa81f('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 b0d0a8e..a81b224 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5e9c85,_0x461674){var _0xcbdcf7=function(_0x2680d9){while(--_0x2680d9){_0x5e9c85['push'](_0x5e9c85['shift']());}};_0xcbdcf7(++_0x461674);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c249a,_0x4a6096){var _0x3edb89=function(_0x46f832){while(--_0x46f832){_0x2c249a['push'](_0x2c249a['shift']());}};_0x3edb89(++_0x4a6096);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index b2d816f..999a08a 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 _0xc7b9=['sequelize','exports'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xc7b9,0x1da));var _0x9c7b=function(_0x6f3157,_0xbc1403){_0x6f3157=_0x6f3157-0x0;var _0x50056d=_0xc7b9[_0x6f3157];return _0x50056d;};'use strict';var Sequelize=require(_0x9c7b('0x0'));module[_0x9c7b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8c04=['sequelize','exports','INTEGER'];(function(_0x1db811,_0x5b5d0e){var _0x1b1ac7=function(_0x4639be){while(--_0x4639be){_0x1db811['push'](_0x1db811['shift']());}};_0x1b1ac7(++_0x5b5d0e);}(_0x8c04,0x1a7));var _0x48c0=function(_0xe929f1,_0x27af72){_0xe929f1=_0xe929f1-0x0;var _0x2d625b=_0x8c04[_0xe929f1];return _0x2d625b;};'use strict';var Sequelize=require(_0x48c0('0x0'));module[_0x48c0('0x1')]={'penalty':{'type':Sequelize[_0x48c0('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 79b7de4..e6fb7c4 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 _0xcb81=['lodash','util','api','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues'];(function(_0x47d4cd,_0x41be7f){var _0x3f3700=function(_0x26e8f0){while(--_0x26e8f0){_0x47d4cd['push'](_0x47d4cd['shift']());}};_0x3f3700(++_0x41be7f);}(_0xcb81,0x154));var _0x1cb8=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xcb81[_0xf34b0a];return _0x5021e1;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb8('0x3'));var rimraf=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var attributes=require(_0x1cb8('0x6'));module[_0x1cb8('0x7')]=function(_0x4e5c19,_0x98d682){return _0x4e5c19[_0x1cb8('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0x1cb8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1e1=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x356670,_0x32ff4b){var _0x5931b3=function(_0x13b343){while(--_0x13b343){_0x356670['push'](_0x356670['shift']());}};_0x5931b3(++_0x32ff4b);}(_0xf1e1,0x102));var _0x1f1e=function(_0x256cc1,_0x568424){_0x256cc1=_0x256cc1-0x0;var _0x330d0a=_0xf1e1[_0x256cc1];return _0x330d0a;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var logger=require(_0x1f1e('0x1'))('api');var moment=require(_0x1f1e('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f1e('0x3'));var fs=require('fs');var path=require(_0x1f1e('0x4'));var rimraf=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var attributes=require(_0x1f1e('0x7'));module[_0x1f1e('0x8')]=function(_0x1bdcee,_0x3242af){return _0x1bdcee[_0x1f1e('0x9')](_0x1f1e('0xa'),attributes,{'tableName':_0x1f1e('0xb'),'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 ff27984..cfa775c 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 _0x04a8=['http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5be223,_0x3d5033){var _0x47e066=function(_0x586244){while(--_0x586244){_0x5be223['push'](_0x5be223['shift']());}};_0x47e066(++_0x3d5033);}(_0x04a8,0x153));var _0x804a=function(_0x4602a8,_0x491497){_0x4602a8=_0x4602a8-0x0;var _0x237cba=_0x04a8[_0x4602a8];return _0x237cba;};'use strict';var _=require(_0x804a('0x0'));var util=require('util');var moment=require(_0x804a('0x1'));var BPromise=require(_0x804a('0x2'));var rs=require(_0x804a('0x3'));var fs=require('fs');var Redis=require(_0x804a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x804a('0x5'));var logger=require(_0x804a('0x6'))(_0x804a('0x7'));var config=require(_0x804a('0x8'));var jayson=require(_0x804a('0x9'));var client=jayson[_0x804a('0xa')][_0x804a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c35b6,_0x2f02c3,_0x5a12c1){return new BPromise(function(_0x3f470f,_0x1bd66a){return client[_0x804a('0xc')](_0x5c35b6,_0x5a12c1)[_0x804a('0xd')](function(_0x745417){logger[_0x804a('0xe')](_0x804a('0xf'),_0x2f02c3,_0x804a('0x10'));logger[_0x804a('0x11')](_0x804a('0x12'),_0x2f02c3,_0x804a('0x10'),JSON[_0x804a('0x13')](_0x745417));if(_0x745417['error']){if(_0x745417[_0x804a('0x14')][_0x804a('0x15')]===0x1f4){logger[_0x804a('0x14')](_0x804a('0xf'),_0x2f02c3,_0x745417[_0x804a('0x14')][_0x804a('0x16')]);return _0x1bd66a(_0x745417[_0x804a('0x14')]['message']);}logger[_0x804a('0x14')](_0x804a('0xf'),_0x2f02c3,_0x745417[_0x804a('0x14')][_0x804a('0x16')]);return _0x3f470f(_0x745417['error'][_0x804a('0x16')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x2f02c3,'request\x20sent');_0x3f470f(_0x745417[_0x804a('0x17')][_0x804a('0x16')]);}})[_0x804a('0x18')](function(_0x4823cc){logger[_0x804a('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2f02c3,_0x4823cc);_0x1bd66a(_0x4823cc);});});} \ No newline at end of file +var _0x6ede=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x23e210,_0x443911){var _0x1ffd85=function(_0x35acc4){while(--_0x35acc4){_0x23e210['push'](_0x23e210['shift']());}};_0x1ffd85(++_0x443911);}(_0x6ede,0x140));var _0xe6ed=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x6ede[_0x516ffb];return _0x319667;};'use strict';var _=require('lodash');var util=require(_0xe6ed('0x0'));var moment=require('moment');var BPromise=require(_0xe6ed('0x1'));var rs=require(_0xe6ed('0x2'));var fs=require('fs');var Redis=require(_0xe6ed('0x3'));var db=require(_0xe6ed('0x4'))['db'];var utils=require(_0xe6ed('0x5'));var logger=require(_0xe6ed('0x6'))(_0xe6ed('0x7'));var config=require('../../config/environment');var jayson=require(_0xe6ed('0x8'));var client=jayson[_0xe6ed('0x9')][_0xe6ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22e03b,_0x2e8e4b,_0x2910af){return new BPromise(function(_0x1831f5,_0x33afd9){return client['request'](_0x22e03b,_0x2910af)['then'](function(_0x579126){logger[_0xe6ed('0xb')](_0xe6ed('0xc'),_0x2e8e4b,_0xe6ed('0xd'));logger[_0xe6ed('0xe')](_0xe6ed('0xf'),_0x2e8e4b,_0xe6ed('0xd'),JSON['stringify'](_0x579126));if(_0x579126['error']){if(_0x579126[_0xe6ed('0x10')]['code']===0x1f4){logger[_0xe6ed('0x10')](_0xe6ed('0xc'),_0x2e8e4b,_0x579126['error']['message']);return _0x33afd9(_0x579126['error'][_0xe6ed('0x11')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x2e8e4b,_0x579126[_0xe6ed('0x10')][_0xe6ed('0x11')]);return _0x1831f5(_0x579126[_0xe6ed('0x10')][_0xe6ed('0x11')]);}else{logger[_0xe6ed('0xb')](_0xe6ed('0xc'),_0x2e8e4b,_0xe6ed('0xd'));_0x1831f5(_0x579126[_0xe6ed('0x12')][_0xe6ed('0x11')]);}})[_0xe6ed('0x13')](function(_0x40444d){logger[_0xe6ed('0x10')](_0xe6ed('0xc'),_0x2e8e4b,_0x40444d);_0x33afd9(_0x40444d);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d67c6fc..07bf252 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 _0xd824=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','update','destroy','exports','multer','util'];(function(_0x3ce708,_0x246cb6){var _0x414859=function(_0xb0c728){while(--_0xb0c728){_0x3ce708['push'](_0x3ce708['shift']());}};_0x414859(++_0x246cb6);}(_0xd824,0xc2));var _0x4d82=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd824[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d82('0x2'));var router=express[_0x4d82('0x3')]();var fs_extra=require(_0x4d82('0x4'));var auth=require(_0x4d82('0x5'));var interaction=require(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var controller=require('./template.controller');router['get']('/',auth[_0x4d82('0x8')](),controller['index']);router['get'](_0x4d82('0x9'),auth[_0x4d82('0x8')](),controller[_0x4d82('0xa')]);router['post']('/',auth[_0x4d82('0x8')](),controller['create']);router['put'](_0x4d82('0x9'),auth[_0x4d82('0x8')](),controller[_0x4d82('0xb')]);router['delete'](_0x4d82('0x9'),auth['isAuthenticated'](),controller[_0x4d82('0xc')]);module[_0x4d82('0xd')]=router; \ No newline at end of file +var _0xd916=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./template.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xd916,0x18a));var _0x6d91=function(_0x1fea02,_0x2bd088){_0x1fea02=_0x1fea02-0x0;var _0x4ed396=_0xd916[_0x1fea02];return _0x4ed396;};'use strict';var multer=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var path=require(_0x6d91('0x2'));var timeout=require(_0x6d91('0x3'));var express=require(_0x6d91('0x4'));var router=express['Router']();var fs_extra=require(_0x6d91('0x5'));var auth=require(_0x6d91('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d91('0x7'));router[_0x6d91('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d91('0x9')]);router[_0x6d91('0x8')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0xc')]);router[_0x6d91('0xd')]('/',auth[_0x6d91('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d91('0xe')]);router[_0x6d91('0xf')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c9eb168..be93676 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 _0x948b=['exports','STRING','TEXT'];(function(_0x1a769c,_0x1551bc){var _0x1d792a=function(_0x593989){while(--_0x593989){_0x1a769c['push'](_0x1a769c['shift']());}};_0x1d792a(++_0x1551bc);}(_0x948b,0xc0));var _0xb948=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x948b[_0x179b53];return _0x38a146;};'use strict';var Sequelize=require('sequelize');module[_0xb948('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb948('0x1')]},'html':{'type':Sequelize[_0xb948('0x2')]}}; \ No newline at end of file +var _0xfa62=['sequelize','exports','STRING','TEXT'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xfa62,0x198));var _0x2fa6=function(_0x1f2f53,_0x3780e5){_0x1f2f53=_0x1f2f53-0x0;var _0x4f5953=_0xfa62[_0x1f2f53];return _0x4f5953;};'use strict';var Sequelize=require(_0x2fa6('0x0'));module[_0x2fa6('0x1')]={'name':{'type':Sequelize[_0x2fa6('0x2')]},'description':{'type':Sequelize[_0x2fa6('0x2')]},'html':{'type':Sequelize[_0x2fa6('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ab913d5..8e33355 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 _0x18a3=['get','Templates','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x18a3,0x7e));var _0x318a=function(_0x551f63,_0x2ba420){_0x551f63=_0x551f63-0x0;var _0x2db7aa=_0x18a3[_0x551f63];return _0x2db7aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x318a('0x0'));var zipdir=require(_0x318a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x318a('0x2'));var moment=require(_0x318a('0x3'));var BPromise=require(_0x318a('0x4'));var Mustache=require(_0x318a('0x5'));var util=require(_0x318a('0x6'));var path=require(_0x318a('0x7'));var sox=require(_0x318a('0x8'));var csv=require('to-csv');var ejs=require(_0x318a('0x9'));var fs=require('fs');var fs_extra=require(_0x318a('0xa'));var _=require(_0x318a('0xb'));var squel=require(_0x318a('0xc'));var crypto=require(_0x318a('0xd'));var jsforce=require(_0x318a('0xe'));var deskjs=require(_0x318a('0xf'));var toCsv=require(_0x318a('0x10'));var querystring=require(_0x318a('0x11'));var Papa=require(_0x318a('0x12'));var Redis=require(_0x318a('0x13'));var authService=require(_0x318a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x318a('0x15'));var hardwareService=require(_0x318a('0x16'));var logger=require(_0x318a('0x17'))('api');var utils=require(_0x318a('0x18'));var config=require(_0x318a('0x19'));var licenseUtil=require(_0x318a('0x1a'));var db=require(_0x318a('0x1b'))['db'];function respondWithStatusCode(_0x6a5db7,_0xdeadee){_0xdeadee=_0xdeadee||0xcc;return function(_0x26486e){if(_0x26486e){return _0x6a5db7[_0x318a('0x1c')](_0xdeadee);}return _0x6a5db7[_0x318a('0x1d')](_0xdeadee)[_0x318a('0x1e')]();};}function respondWithResult(_0xe5b326,_0x18739b){_0x18739b=_0x18739b||0xc8;return function(_0xfd3782){if(_0xfd3782){return _0xe5b326['status'](_0x18739b)[_0x318a('0x1f')](_0xfd3782);}};}function respondWithFilteredResult(_0x3620ec,_0x5c0694){return function(_0x316861){if(_0x316861){var _0x723e76=typeof _0x5c0694[_0x318a('0x20')]==='undefined'&&typeof _0x5c0694[_0x318a('0x21')]==='undefined';var _0x277f0f=_0x316861['count'];var _0x35cb95=_0x723e76?0x0:_0x5c0694[_0x318a('0x20')];var _0x443448=_0x723e76?_0x316861[_0x318a('0x22')]:_0x5c0694[_0x318a('0x20')]+_0x5c0694[_0x318a('0x21')];var _0x373a97;if(_0x443448>=_0x277f0f){_0x443448=_0x277f0f;_0x373a97=0xc8;}else{_0x373a97=0xce;}_0x3620ec['status'](_0x373a97);return _0x3620ec[_0x318a('0x23')](_0x318a('0x24'),_0x35cb95+'-'+_0x443448+'/'+_0x277f0f)[_0x318a('0x1f')](_0x316861);}return null;};}function patchUpdates(_0x20b5d5){return function(_0x203f55){try{jsonpatch[_0x318a('0x25')](_0x203f55,_0x20b5d5,!![]);}catch(_0x28591d){return BPromise['reject'](_0x28591d);}return _0x203f55[_0x318a('0x26')]();};}function saveUpdates(_0x40add6,_0x2f3457){return function(_0x6c27e){if(_0x6c27e){return _0x6c27e[_0x318a('0x27')](_0x40add6)[_0x318a('0x28')](function(_0x412d0a){return _0x412d0a;});}return null;};}function removeEntity(_0x118b68,_0x3bddc6){return function(_0x3f5a3d){if(_0x3f5a3d){return _0x3f5a3d[_0x318a('0x29')]()[_0x318a('0x28')](function(){var _0x4b3df3=_0x3f5a3d[_0x318a('0x2a')]({'plain':!![]});var _0x12eec4=_0x318a('0x2b');return db['UserProfileResource'][_0x318a('0x29')]({'where':{'type':_0x12eec4,'resourceId':_0x4b3df3['id']}})[_0x318a('0x28')](function(){return _0x3f5a3d;});})['then'](function(){_0x118b68[_0x318a('0x1d')](0xcc)[_0x318a('0x1e')]();});}};}function handleEntityNotFound(_0x4407d7,_0x417f93){return function(_0x1d418e){if(!_0x1d418e){_0x4407d7[_0x318a('0x1c')](0x194);}return _0x1d418e;};}function handleError(_0x777aa,_0x4753c6){_0x4753c6=_0x4753c6||0x1f4;return function(_0x266415){logger[_0x318a('0x2c')](_0x266415[_0x318a('0x2d')]);if(_0x266415[_0x318a('0x2e')]){delete _0x266415[_0x318a('0x2e')];}_0x777aa[_0x318a('0x1d')](_0x4753c6)['send'](_0x266415);};}exports[_0x318a('0x2f')]=function(_0x425db0,_0x1b13a3){var _0xe77f43={},_0x26f895={},_0x1134c3={'count':0x0,'rows':[]};var _0x1bd3d9=_[_0x318a('0x30')](db[_0x318a('0x31')][_0x318a('0x32')],function(_0x2a0c10){return{'name':_0x2a0c10[_0x318a('0x33')],'type':_0x2a0c10[_0x318a('0x34')][_0x318a('0x35')]};});_0x26f895[_0x318a('0x36')]=_[_0x318a('0x30')](_0x1bd3d9,_0x318a('0x2e'));_0x26f895[_0x318a('0x37')]=_[_0x318a('0x38')](_0x425db0['query']);_0x26f895[_0x318a('0x39')]=_[_0x318a('0x3a')](_0x26f895[_0x318a('0x36')],_0x26f895[_0x318a('0x37')]);_0xe77f43['attributes']=_[_0x318a('0x3a')](_0x26f895[_0x318a('0x36')],qs['fields'](_0x425db0[_0x318a('0x37')]['fields']));_0xe77f43[_0x318a('0x3b')]=_0xe77f43[_0x318a('0x3b')]['length']?_0xe77f43['attributes']:_0x26f895['model'];if(!_0x425db0[_0x318a('0x37')][_0x318a('0x3c')](_0x318a('0x3d'))){_0xe77f43[_0x318a('0x21')]=qs[_0x318a('0x21')](_0x425db0[_0x318a('0x37')][_0x318a('0x21')]);_0xe77f43[_0x318a('0x20')]=qs[_0x318a('0x20')](_0x425db0[_0x318a('0x37')]['offset']);}_0xe77f43[_0x318a('0x3e')]=qs['sort'](_0x425db0['query'][_0x318a('0x3f')]);_0xe77f43[_0x318a('0x40')]=qs[_0x318a('0x39')](_[_0x318a('0x41')](_0x425db0[_0x318a('0x37')],_0x26f895[_0x318a('0x39')]),_0x1bd3d9);if(_0x425db0[_0x318a('0x37')][_0x318a('0x42')]){_0xe77f43['where']=_[_0x318a('0x43')](_0xe77f43[_0x318a('0x40')],{'$or':_[_0x318a('0x30')](_0x1bd3d9,function(_0x8a42ee){if(_0x8a42ee[_0x318a('0x34')]!=='VIRTUAL'){var _0x1d6f03={};_0x1d6f03[_0x8a42ee[_0x318a('0x2e')]]={'$like':'%'+_0x425db0[_0x318a('0x37')]['filter']+'%'};return _0x1d6f03;}})});}_0xe77f43=_[_0x318a('0x43')]({},_0xe77f43,_0x425db0[_0x318a('0x44')]);var _0x23d5e3={'where':_0xe77f43[_0x318a('0x40')]};return db[_0x318a('0x31')]['count'](_0x23d5e3)[_0x318a('0x28')](function(_0x21724e){_0x1134c3[_0x318a('0x22')]=_0x21724e;if(_0x425db0[_0x318a('0x37')][_0x318a('0x45')]){_0xe77f43['include']=[{'all':!![]}];}return db[_0x318a('0x31')][_0x318a('0x46')](_0xe77f43);})[_0x318a('0x28')](function(_0x56d131){_0x1134c3['rows']=_0x56d131;return _0x1134c3;})[_0x318a('0x28')](respondWithFilteredResult(_0x1b13a3,_0xe77f43))[_0x318a('0x47')](handleError(_0x1b13a3,null));};exports[_0x318a('0x48')]=function(_0x31ae73,_0x2a96a0){var _0x52faa7={'raw':!![],'where':{'id':_0x31ae73[_0x318a('0x49')]['id']}},_0x3e8f52={};_0x3e8f52['model']=_[_0x318a('0x38')](db['Template'][_0x318a('0x32')]);_0x3e8f52[_0x318a('0x37')]=_['keys'](_0x31ae73[_0x318a('0x37')]);_0x3e8f52[_0x318a('0x39')]=_[_0x318a('0x3a')](_0x3e8f52[_0x318a('0x36')],_0x3e8f52[_0x318a('0x37')]);_0x52faa7[_0x318a('0x3b')]=_[_0x318a('0x3a')](_0x3e8f52[_0x318a('0x36')],qs[_0x318a('0x4a')](_0x31ae73[_0x318a('0x37')][_0x318a('0x4a')]));_0x52faa7['attributes']=_0x52faa7[_0x318a('0x3b')][_0x318a('0x4b')]?_0x52faa7[_0x318a('0x3b')]:_0x3e8f52['model'];if(_0x31ae73[_0x318a('0x37')]['includeAll']){_0x52faa7[_0x318a('0x4c')]=[{'all':!![]}];}_0x52faa7=_[_0x318a('0x43')]({},_0x52faa7,_0x31ae73['options']);return db['Template'][_0x318a('0x4d')](_0x52faa7)['then'](handleEntityNotFound(_0x2a96a0,null))[_0x318a('0x28')](respondWithResult(_0x2a96a0,null))[_0x318a('0x47')](handleError(_0x2a96a0,null));};exports[_0x318a('0x4e')]=function(_0x1f553e,_0x482449){return db['Template']['create'](_0x1f553e[_0x318a('0x4f')],{})[_0x318a('0x28')](function(_0x12a3c8){var _0x261b54=_0x1f553e[_0x318a('0x50')][_0x318a('0x2a')]({'plain':!![]});if(!_0x261b54)throw new Error(_0x318a('0x51'));if(_0x261b54['role']==='user'){var _0x262730=_0x12a3c8[_0x318a('0x2a')]({'plain':!![]});var _0x1354a6=_0x318a('0x2b');return db[_0x318a('0x52')][_0x318a('0x4d')]({'where':{'name':_0x1354a6,'userProfileId':_0x261b54['userProfileId']},'raw':!![]})[_0x318a('0x28')](function(_0x267be7){if(_0x267be7&&_0x267be7['autoAssociation']===0x0){return db['UserProfileResource'][_0x318a('0x4e')]({'name':_0x262730[_0x318a('0x2e')],'resourceId':_0x262730['id'],'type':_0x267be7[_0x318a('0x2e')],'sectionId':_0x267be7['id']},{})[_0x318a('0x28')](function(){return _0x12a3c8;});}else{return _0x12a3c8;}})['catch'](function(_0x26a0d8){logger[_0x318a('0x2c')](_0x318a('0x53'),_0x26a0d8);throw _0x26a0d8;});}return _0x12a3c8;})[_0x318a('0x28')](respondWithResult(_0x482449,0xc9))[_0x318a('0x47')](handleError(_0x482449,null));};exports[_0x318a('0x27')]=function(_0x9fcc9c,_0x47e110){if(_0x9fcc9c[_0x318a('0x4f')]['id']){delete _0x9fcc9c[_0x318a('0x4f')]['id'];}return db[_0x318a('0x31')][_0x318a('0x4d')]({'where':{'id':_0x9fcc9c[_0x318a('0x49')]['id']}})['then'](handleEntityNotFound(_0x47e110,null))[_0x318a('0x28')](saveUpdates(_0x9fcc9c[_0x318a('0x4f')],null))[_0x318a('0x28')](respondWithResult(_0x47e110,null))[_0x318a('0x47')](handleError(_0x47e110,null));};exports['destroy']=function(_0x232bcd,_0xdcfc1c){return db[_0x318a('0x31')]['find']({'where':{'id':_0x232bcd[_0x318a('0x49')]['id']}})['then'](handleEntityNotFound(_0xdcfc1c,null))['then'](removeEntity(_0xdcfc1c,null))['catch'](handleError(_0xdcfc1c,null));}; \ No newline at end of file +var _0x04a5=['includeAll','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','Templates','UserProfileResource','error','name','send','map','Template','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','rawAttributes'];(function(_0x526795,_0x22c832){var _0x56fc28=function(_0x31023f){while(--_0x31023f){_0x526795['push'](_0x526795['shift']());}};_0x56fc28(++_0x22c832);}(_0x04a5,0x158));var _0x504a=function(_0xfcdda0,_0x32479b){_0xfcdda0=_0xfcdda0-0x0;var _0x17ebe3=_0x04a5[_0xfcdda0];return _0x17ebe3;};'use strict';var emlformat=require(_0x504a('0x0'));var rimraf=require(_0x504a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x504a('0x2'));var rp=require(_0x504a('0x3'));var moment=require('moment');var BPromise=require(_0x504a('0x4'));var Mustache=require(_0x504a('0x5'));var util=require(_0x504a('0x6'));var path=require(_0x504a('0x7'));var sox=require(_0x504a('0x8'));var csv=require(_0x504a('0x9'));var ejs=require(_0x504a('0xa'));var fs=require('fs');var fs_extra=require(_0x504a('0xb'));var _=require(_0x504a('0xc'));var squel=require(_0x504a('0xd'));var crypto=require(_0x504a('0xe'));var jsforce=require(_0x504a('0xf'));var deskjs=require(_0x504a('0x10'));var toCsv=require(_0x504a('0x9'));var querystring=require(_0x504a('0x11'));var Papa=require(_0x504a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x504a('0x13'));var hardwareService=require(_0x504a('0x14'));var logger=require(_0x504a('0x15'))(_0x504a('0x16'));var utils=require(_0x504a('0x17'));var config=require(_0x504a('0x18'));var licenseUtil=require(_0x504a('0x19'));var db=require(_0x504a('0x1a'))['db'];function respondWithStatusCode(_0x2d5f21,_0x4deef4){_0x4deef4=_0x4deef4||0xcc;return function(_0x22b1d1){if(_0x22b1d1){return _0x2d5f21['sendStatus'](_0x4deef4);}return _0x2d5f21['status'](_0x4deef4)[_0x504a('0x1b')]();};}function respondWithResult(_0x34d92b,_0x2b84fe){_0x2b84fe=_0x2b84fe||0xc8;return function(_0x326abb){if(_0x326abb){return _0x34d92b[_0x504a('0x1c')](_0x2b84fe)[_0x504a('0x1d')](_0x326abb);}};}function respondWithFilteredResult(_0x2ddc93,_0x3aa320){return function(_0x45bc99){if(_0x45bc99){var _0x4d68c9=typeof _0x3aa320[_0x504a('0x1e')]===_0x504a('0x1f')&&typeof _0x3aa320[_0x504a('0x20')]==='undefined';var _0x5b6a3c=_0x45bc99[_0x504a('0x21')];var _0x1e4398=_0x4d68c9?0x0:_0x3aa320['offset'];var _0x41afee=_0x4d68c9?_0x45bc99[_0x504a('0x21')]:_0x3aa320['offset']+_0x3aa320['limit'];var _0x5ab39b;if(_0x41afee>=_0x5b6a3c){_0x41afee=_0x5b6a3c;_0x5ab39b=0xc8;}else{_0x5ab39b=0xce;}_0x2ddc93[_0x504a('0x1c')](_0x5ab39b);return _0x2ddc93[_0x504a('0x22')](_0x504a('0x23'),_0x1e4398+'-'+_0x41afee+'/'+_0x5b6a3c)[_0x504a('0x1d')](_0x45bc99);}return null;};}function patchUpdates(_0x273680){return function(_0x4f5cfb){try{jsonpatch[_0x504a('0x24')](_0x4f5cfb,_0x273680,!![]);}catch(_0x4784ae){return BPromise['reject'](_0x4784ae);}return _0x4f5cfb[_0x504a('0x25')]();};}function saveUpdates(_0x4eb782,_0x247453){return function(_0x5d2d7f){if(_0x5d2d7f){return _0x5d2d7f[_0x504a('0x26')](_0x4eb782)['then'](function(_0xde5cbe){return _0xde5cbe;});}return null;};}function removeEntity(_0x150076,_0x156cac){return function(_0x162a38){if(_0x162a38){return _0x162a38[_0x504a('0x27')]()[_0x504a('0x28')](function(){var _0x339624=_0x162a38['get']({'plain':!![]});var _0xc3fead=_0x504a('0x29');return db[_0x504a('0x2a')]['destroy']({'where':{'type':_0xc3fead,'resourceId':_0x339624['id']}})[_0x504a('0x28')](function(){return _0x162a38;});})[_0x504a('0x28')](function(){_0x150076['status'](0xcc)[_0x504a('0x1b')]();});}};}function handleEntityNotFound(_0x5b1b78,_0x14bf22){return function(_0x56829f){if(!_0x56829f){_0x5b1b78['sendStatus'](0x194);}return _0x56829f;};}function handleError(_0x13a6e1,_0x55a4e8){_0x55a4e8=_0x55a4e8||0x1f4;return function(_0x4400b4){logger[_0x504a('0x2b')](_0x4400b4['stack']);if(_0x4400b4[_0x504a('0x2c')]){delete _0x4400b4['name'];}_0x13a6e1[_0x504a('0x1c')](_0x55a4e8)[_0x504a('0x2d')](_0x4400b4);};}exports['index']=function(_0x11ef7d,_0x59a267){var _0x4d94e9={},_0x3e1a10={},_0x33412c={'count':0x0,'rows':[]};var _0xc2108c=_[_0x504a('0x2e')](db[_0x504a('0x2f')]['rawAttributes'],function(_0x1e78d1){return{'name':_0x1e78d1[_0x504a('0x30')],'type':_0x1e78d1[_0x504a('0x31')][_0x504a('0x32')]};});_0x3e1a10[_0x504a('0x33')]=_[_0x504a('0x2e')](_0xc2108c,_0x504a('0x2c'));_0x3e1a10['query']=_[_0x504a('0x34')](_0x11ef7d[_0x504a('0x35')]);_0x3e1a10[_0x504a('0x36')]=_[_0x504a('0x37')](_0x3e1a10['model'],_0x3e1a10[_0x504a('0x35')]);_0x4d94e9['attributes']=_[_0x504a('0x37')](_0x3e1a10[_0x504a('0x33')],qs[_0x504a('0x38')](_0x11ef7d['query'][_0x504a('0x38')]));_0x4d94e9['attributes']=_0x4d94e9['attributes'][_0x504a('0x39')]?_0x4d94e9[_0x504a('0x3a')]:_0x3e1a10[_0x504a('0x33')];if(!_0x11ef7d[_0x504a('0x35')]['hasOwnProperty'](_0x504a('0x3b'))){_0x4d94e9[_0x504a('0x20')]=qs[_0x504a('0x20')](_0x11ef7d[_0x504a('0x35')]['limit']);_0x4d94e9[_0x504a('0x1e')]=qs[_0x504a('0x1e')](_0x11ef7d['query']['offset']);}_0x4d94e9['order']=qs['sort'](_0x11ef7d[_0x504a('0x35')]['sort']);_0x4d94e9[_0x504a('0x3c')]=qs['filters'](_[_0x504a('0x3d')](_0x11ef7d[_0x504a('0x35')],_0x3e1a10['filters']),_0xc2108c);if(_0x11ef7d[_0x504a('0x35')][_0x504a('0x3e')]){_0x4d94e9[_0x504a('0x3c')]=_[_0x504a('0x3f')](_0x4d94e9['where'],{'$or':_[_0x504a('0x2e')](_0xc2108c,function(_0x5cc759){if(_0x5cc759[_0x504a('0x31')]!==_0x504a('0x40')){var _0x22b705={};_0x22b705[_0x5cc759['name']]={'$like':'%'+_0x11ef7d[_0x504a('0x35')][_0x504a('0x3e')]+'%'};return _0x22b705;}})});}_0x4d94e9=_[_0x504a('0x3f')]({},_0x4d94e9,_0x11ef7d['options']);var _0x3b98a3={'where':_0x4d94e9[_0x504a('0x3c')]};return db['Template'][_0x504a('0x21')](_0x3b98a3)['then'](function(_0x1709ba){_0x33412c[_0x504a('0x21')]=_0x1709ba;if(_0x11ef7d['query']['includeAll']){_0x4d94e9[_0x504a('0x41')]=[{'all':!![]}];}return db[_0x504a('0x2f')][_0x504a('0x42')](_0x4d94e9);})[_0x504a('0x28')](function(_0x161e63){_0x33412c[_0x504a('0x43')]=_0x161e63;return _0x33412c;})[_0x504a('0x28')](respondWithFilteredResult(_0x59a267,_0x4d94e9))['catch'](handleError(_0x59a267,null));};exports[_0x504a('0x44')]=function(_0x47f77a,_0x448887){var _0x38495={'raw':!![],'where':{'id':_0x47f77a[_0x504a('0x45')]['id']}},_0x34f04c={};_0x34f04c['model']=_['keys'](db[_0x504a('0x2f')][_0x504a('0x46')]);_0x34f04c[_0x504a('0x35')]=_[_0x504a('0x34')](_0x47f77a[_0x504a('0x35')]);_0x34f04c[_0x504a('0x36')]=_[_0x504a('0x37')](_0x34f04c[_0x504a('0x33')],_0x34f04c[_0x504a('0x35')]);_0x38495['attributes']=_[_0x504a('0x37')](_0x34f04c['model'],qs[_0x504a('0x38')](_0x47f77a[_0x504a('0x35')]['fields']));_0x38495['attributes']=_0x38495['attributes']['length']?_0x38495[_0x504a('0x3a')]:_0x34f04c[_0x504a('0x33')];if(_0x47f77a[_0x504a('0x35')][_0x504a('0x47')]){_0x38495[_0x504a('0x41')]=[{'all':!![]}];}_0x38495=_['merge']({},_0x38495,_0x47f77a[_0x504a('0x48')]);return db[_0x504a('0x2f')][_0x504a('0x49')](_0x38495)[_0x504a('0x28')](handleEntityNotFound(_0x448887,null))[_0x504a('0x28')](respondWithResult(_0x448887,null))[_0x504a('0x4a')](handleError(_0x448887,null));};exports[_0x504a('0x4b')]=function(_0x2b885e,_0x3600c8){return db[_0x504a('0x2f')][_0x504a('0x4b')](_0x2b885e[_0x504a('0x4c')],{})[_0x504a('0x28')](function(_0x1735d5){var _0x177a05=_0x2b885e[_0x504a('0x4d')][_0x504a('0x4e')]({'plain':!![]});if(!_0x177a05)throw new Error(_0x504a('0x4f'));if(_0x177a05['role']==='user'){var _0x5df0d3=_0x1735d5['get']({'plain':!![]});var _0x1a1c55=_0x504a('0x29');return db[_0x504a('0x50')][_0x504a('0x49')]({'where':{'name':_0x1a1c55,'userProfileId':_0x177a05['userProfileId']},'raw':!![]})[_0x504a('0x28')](function(_0x5a4521){if(_0x5a4521&&_0x5a4521[_0x504a('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x5df0d3[_0x504a('0x2c')],'resourceId':_0x5df0d3['id'],'type':_0x5a4521['name'],'sectionId':_0x5a4521['id']},{})['then'](function(){return _0x1735d5;});}else{return _0x1735d5;}})[_0x504a('0x4a')](function(_0x2f4901){logger[_0x504a('0x2b')](_0x504a('0x52'),_0x2f4901);throw _0x2f4901;});}return _0x1735d5;})[_0x504a('0x28')](respondWithResult(_0x3600c8,0xc9))['catch'](handleError(_0x3600c8,null));};exports[_0x504a('0x26')]=function(_0x232a5c,_0x7bf206){if(_0x232a5c[_0x504a('0x4c')]['id']){delete _0x232a5c[_0x504a('0x4c')]['id'];}return db[_0x504a('0x2f')][_0x504a('0x49')]({'where':{'id':_0x232a5c[_0x504a('0x45')]['id']}})[_0x504a('0x28')](handleEntityNotFound(_0x7bf206,null))[_0x504a('0x28')](saveUpdates(_0x232a5c[_0x504a('0x4c')],null))[_0x504a('0x28')](respondWithResult(_0x7bf206,null))['catch'](handleError(_0x7bf206,null));};exports[_0x504a('0x27')]=function(_0x348cb3,_0x36d4a1){return db[_0x504a('0x2f')][_0x504a('0x49')]({'where':{'id':_0x348cb3[_0x504a('0x45')]['id']}})[_0x504a('0x28')](handleEntityNotFound(_0x36d4a1,null))[_0x504a('0x28')](removeEntity(_0x36d4a1,null))[_0x504a('0x4a')](handleError(_0x36d4a1,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6ac71f9..e324df4 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 _0xc57b=['moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0xb9afb4,_0x39f1d8){var _0x4ab950=function(_0x37ae2b){while(--_0x37ae2b){_0xb9afb4['push'](_0xb9afb4['shift']());}};_0x4ab950(++_0x39f1d8);}(_0xc57b,0xec));var _0xbc57=function(_0x469bff,_0x2aad22){_0x469bff=_0x469bff-0x0;var _0x47bff2=_0xc57b[_0x469bff];return _0x47bff2;};'use strict';var _=require(_0xbc57('0x0'));var util=require(_0xbc57('0x1'));var logger=require(_0xbc57('0x2'))(_0xbc57('0x3'));var moment=require(_0xbc57('0x4'));var BPromise=require(_0xbc57('0x5'));var rp=require(_0xbc57('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc57('0x7'));var config=require(_0xbc57('0x8'));var attributes=require(_0xbc57('0x9'));module[_0xbc57('0xa')]=function(_0x50c7c7,_0x275cb3){return _0x50c7c7[_0xbc57('0xb')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc56c=['lodash','moment','bluebird','path','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x4fd0e1,_0x402971){var _0x536d96=function(_0x9303a4){while(--_0x9303a4){_0x4fd0e1['push'](_0x4fd0e1['shift']());}};_0x536d96(++_0x402971);}(_0xc56c,0x99));var _0xcc56=function(_0x27313c,_0x4ab54b){_0x27313c=_0x27313c-0x0;var _0x3aaaf5=_0xc56c[_0x27313c];return _0x3aaaf5;};'use strict';var _=require(_0xcc56('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcc56('0x1'));var BPromise=require(_0xcc56('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc56('0x3'));var rimraf=require(_0xcc56('0x4'));var config=require(_0xcc56('0x5'));var attributes=require(_0xcc56('0x6'));module[_0xcc56('0x7')]=function(_0xbf8a86,_0x3f8866){return _0xbf8a86[_0xcc56('0x8')]('Template',attributes,{'tableName':'tools_templates','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 7379e9a..bb7127a 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 _0xcf99=['limit','include','model','map','then','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetTemplate','findAll','raw','options','where','attributes'];(function(_0x3ba69b,_0x105691){var _0x555a75=function(_0xf01862){while(--_0xf01862){_0x3ba69b['push'](_0x3ba69b['shift']());}};_0x555a75(++_0x105691);}(_0xcf99,0x151));var _0x9cf9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf99[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9cf9('0x0'));var util=require(_0x9cf9('0x1'));var moment=require(_0x9cf9('0x2'));var BPromise=require(_0x9cf9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cf9('0x4'));var db=require(_0x9cf9('0x5'))['db'];var utils=require(_0x9cf9('0x6'));var logger=require(_0x9cf9('0x7'))(_0x9cf9('0x8'));var config=require(_0x9cf9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9cf9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16349b,_0x1295c3,_0x34fabf){return new BPromise(function(_0x539acf,_0x18198c){return client[_0x9cf9('0xb')](_0x16349b,_0x34fabf)['then'](function(_0xcc981c){logger['info'](_0x9cf9('0xc'),_0x1295c3,_0x9cf9('0xd'));logger['debug'](_0x9cf9('0xe'),_0x1295c3,_0x9cf9('0xd'),JSON['stringify'](_0xcc981c));if(_0xcc981c[_0x9cf9('0xf')]){if(_0xcc981c[_0x9cf9('0xf')]['code']===0x1f4){logger[_0x9cf9('0xf')](_0x9cf9('0xc'),_0x1295c3,_0xcc981c[_0x9cf9('0xf')][_0x9cf9('0x10')]);return _0x18198c(_0xcc981c[_0x9cf9('0xf')][_0x9cf9('0x10')]);}logger[_0x9cf9('0xf')]('Template,\x20%s,\x20%s',_0x1295c3,_0xcc981c[_0x9cf9('0xf')][_0x9cf9('0x10')]);return _0x539acf(_0xcc981c['error'][_0x9cf9('0x10')]);}else{logger[_0x9cf9('0x11')](_0x9cf9('0xc'),_0x1295c3,'request\x20sent');_0x539acf(_0xcc981c[_0x9cf9('0x12')]['message']);}})[_0x9cf9('0x13')](function(_0x53d316){logger[_0x9cf9('0xf')](_0x9cf9('0xc'),_0x1295c3,_0x53d316);_0x18198c(_0x53d316);});});}exports[_0x9cf9('0x14')]=function(_0x4efb83){var _0x4e3468=this;return new Promise(function(_0xfc334c,_0x8616e9){return db['Template'][_0x9cf9('0x15')]({'raw':_0x4efb83['options']?_0x4efb83['options'][_0x9cf9('0x16')]===undefined?!![]:![]:!![],'where':_0x4efb83['options']?_0x4efb83[_0x9cf9('0x17')][_0x9cf9('0x18')]||null:null,'attributes':_0x4efb83[_0x9cf9('0x17')]?_0x4efb83[_0x9cf9('0x17')][_0x9cf9('0x19')]||null:null,'limit':_0x4efb83[_0x9cf9('0x17')]?_0x4efb83[_0x9cf9('0x17')][_0x9cf9('0x1a')]||null:null,'include':_0x4efb83['options']?_0x4efb83['options'][_0x9cf9('0x1b')]?_['map'](_0x4efb83[_0x9cf9('0x17')][_0x9cf9('0x1b')],function(_0x4cd351){return{'model':db[_0x4cd351[_0x9cf9('0x1c')]],'as':_0x4cd351['as'],'attributes':_0x4cd351[_0x9cf9('0x19')],'include':_0x4cd351[_0x9cf9('0x1b')]?_[_0x9cf9('0x1d')](_0x4cd351[_0x9cf9('0x1b')],function(_0x40edb5){return{'model':db[_0x40edb5[_0x9cf9('0x1c')]],'as':_0x40edb5['as'],'attributes':_0x40edb5[_0x9cf9('0x19')],'include':_0x40edb5[_0x9cf9('0x1b')]?_[_0x9cf9('0x1d')](_0x40edb5[_0x9cf9('0x1b')],function(_0x25f78d){return{'model':db[_0x25f78d[_0x9cf9('0x1c')]],'as':_0x25f78d['as'],'attributes':_0x25f78d[_0x9cf9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9cf9('0x1e')](function(_0x189274){logger[_0x9cf9('0x11')](_0x9cf9('0x14'),_0x4efb83);logger[_0x9cf9('0x1f')](_0x9cf9('0x14'),_0x4efb83,JSON[_0x9cf9('0x20')](_0x189274));_0xfc334c(_0x189274);})[_0x9cf9('0x13')](function(_0x2aea45){logger[_0x9cf9('0xf')](_0x9cf9('0x14'),_0x2aea45[_0x9cf9('0x10')],_0x4efb83);_0x8616e9(_0x4e3468[_0x9cf9('0xf')](0x1f4,_0x2aea45['message']));});});}; \ No newline at end of file +var _0x4e24=['include','map','model','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x4e24,0x1ef));var _0x44e2=function(_0x48fc96,_0x40c465){_0x48fc96=_0x48fc96-0x0;var _0x4ac64=_0x4e24[_0x48fc96];return _0x4ac64;};'use strict';var _=require(_0x44e2('0x0'));var util=require(_0x44e2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44e2('0x2'));var fs=require('fs');var Redis=require(_0x44e2('0x3'));var db=require(_0x44e2('0x4'))['db'];var utils=require(_0x44e2('0x5'));var logger=require(_0x44e2('0x6'))(_0x44e2('0x7'));var config=require(_0x44e2('0x8'));var jayson=require(_0x44e2('0x9'));var client=jayson[_0x44e2('0xa')][_0x44e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dff02,_0x551990,_0x47b695){return new BPromise(function(_0x45df1b,_0x17f310){return client[_0x44e2('0xc')](_0x3dff02,_0x47b695)['then'](function(_0x490cfb){logger[_0x44e2('0xd')](_0x44e2('0xe'),_0x551990,_0x44e2('0xf'));logger['debug'](_0x44e2('0x10'),_0x551990,_0x44e2('0xf'),JSON[_0x44e2('0x11')](_0x490cfb));if(_0x490cfb[_0x44e2('0x12')]){if(_0x490cfb[_0x44e2('0x12')][_0x44e2('0x13')]===0x1f4){logger['error'](_0x44e2('0xe'),_0x551990,_0x490cfb['error'][_0x44e2('0x14')]);return _0x17f310(_0x490cfb[_0x44e2('0x12')][_0x44e2('0x14')]);}logger['error'](_0x44e2('0xe'),_0x551990,_0x490cfb[_0x44e2('0x12')]['message']);return _0x45df1b(_0x490cfb[_0x44e2('0x12')][_0x44e2('0x14')]);}else{logger[_0x44e2('0xd')](_0x44e2('0xe'),_0x551990,_0x44e2('0xf'));_0x45df1b(_0x490cfb[_0x44e2('0x15')][_0x44e2('0x14')]);}})[_0x44e2('0x16')](function(_0x5bdf64){logger[_0x44e2('0x12')]('Template,\x20%s,\x20%s',_0x551990,_0x5bdf64);_0x17f310(_0x5bdf64);});});}exports[_0x44e2('0x17')]=function(_0x3364b3){var _0x3610b4=this;return new Promise(function(_0x1b2e9c,_0x3f2a95){return db[_0x44e2('0x18')][_0x44e2('0x19')]({'raw':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3['options']['where']||null:null,'attributes':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1c')]||null:null,'limit':_0x3364b3[_0x44e2('0x1a')]?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1d')]||null:null,'include':_0x3364b3['options']?_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1e')]?_[_0x44e2('0x1f')](_0x3364b3[_0x44e2('0x1a')][_0x44e2('0x1e')],function(_0x53f874){return{'model':db[_0x53f874[_0x44e2('0x20')]],'as':_0x53f874['as'],'attributes':_0x53f874[_0x44e2('0x1c')],'include':_0x53f874[_0x44e2('0x1e')]?_[_0x44e2('0x1f')](_0x53f874[_0x44e2('0x1e')],function(_0x5886d9){return{'model':db[_0x5886d9[_0x44e2('0x20')]],'as':_0x5886d9['as'],'attributes':_0x5886d9[_0x44e2('0x1c')],'include':_0x5886d9[_0x44e2('0x1e')]?_[_0x44e2('0x1f')](_0x5886d9[_0x44e2('0x1e')],function(_0x52aa12){return{'model':db[_0x52aa12[_0x44e2('0x20')]],'as':_0x52aa12['as'],'attributes':_0x52aa12[_0x44e2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x44e2('0x21')](function(_0x283323){logger['info'](_0x44e2('0x17'),_0x3364b3);logger[_0x44e2('0x22')]('GetTemplate',_0x3364b3,JSON[_0x44e2('0x11')](_0x283323));_0x1b2e9c(_0x283323);})[_0x44e2('0x16')](function(_0x51303f){logger[_0x44e2('0x12')](_0x44e2('0x17'),_0x51303f[_0x44e2('0x14')],_0x3364b3);_0x3f2a95(_0x3610b4[_0x44e2('0x12')](0x1f4,_0x51303f[_0x44e2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index f75b1b5..c77b7de 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 _0x5d36=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','get','/:id/actions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete'];(function(_0x307dc7,_0x3149ef){var _0x56db85=function(_0x3a5245){while(--_0x3a5245){_0x307dc7['push'](_0x307dc7['shift']());}};_0x56db85(++_0x3149ef);}(_0x5d36,0x11a));var _0x65d3=function(_0x36d20f,_0x133196){_0x36d20f=_0x36d20f-0x0;var _0x324a71=_0x5d36[_0x36d20f];return _0x324a71;};'use strict';var multer=require(_0x65d3('0x0'));var util=require(_0x65d3('0x1'));var path=require(_0x65d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65d3('0x3')]();var fs_extra=require(_0x65d3('0x4'));var auth=require(_0x65d3('0x5'));var interaction=require(_0x65d3('0x6'));var config=require(_0x65d3('0x7'));var controller=require(_0x65d3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x65d3('0x9')]);router['get'](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller[_0x65d3('0xc')]);router['get'](_0x65d3('0xd'),auth[_0x65d3('0xb')](),controller[_0x65d3('0xe')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x65d3('0xf')](_0x65d3('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x65d3('0x11')]('/',auth['isAuthenticated'](),controller[_0x65d3('0x12')]);router[_0x65d3('0x11')](_0x65d3('0xd'),auth[_0x65d3('0xb')](),controller[_0x65d3('0x13')]);router['post'](_0x65d3('0x14'),auth[_0x65d3('0xb')](),controller[_0x65d3('0x15')]);router[_0x65d3('0x11')]('/:id/actions',auth[_0x65d3('0xb')](),controller[_0x65d3('0x16')]);router[_0x65d3('0x17')](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller[_0x65d3('0x18')]);router[_0x65d3('0x19')](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller[_0x65d3('0x1a')]);module[_0x65d3('0x1b')]=router; \ No newline at end of file +var _0x6739=['addAnyCondition','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./trigger.controller','index','get','/:id','/:id/all_conditions','isAuthenticated','/:id/any_conditions','/:id/actions','getActions','create','post','addAllCondition'];(function(_0x1f2835,_0x41e610){var _0x40990f=function(_0x559286){while(--_0x559286){_0x1f2835['push'](_0x1f2835['shift']());}};_0x40990f(++_0x41e610);}(_0x6739,0xd3));var _0x9673=function(_0x46d0f5,_0x40703a){_0x46d0f5=_0x46d0f5-0x0;var _0x1e8730=_0x6739[_0x46d0f5];return _0x1e8730;};'use strict';var multer=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var path=require(_0x9673('0x2'));var timeout=require(_0x9673('0x3'));var express=require(_0x9673('0x4'));var router=express[_0x9673('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9673('0x6'));var config=require('../../config/environment');var controller=require(_0x9673('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9673('0x8')]);router[_0x9673('0x9')](_0x9673('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9673('0x9')](_0x9673('0xb'),auth[_0x9673('0xc')](),controller['getAllConditions']);router[_0x9673('0x9')](_0x9673('0xd'),auth[_0x9673('0xc')](),controller['getAnyConditions']);router[_0x9673('0x9')](_0x9673('0xe'),auth[_0x9673('0xc')](),controller[_0x9673('0xf')]);router['post']('/',auth[_0x9673('0xc')](),controller[_0x9673('0x10')]);router[_0x9673('0x11')](_0x9673('0xb'),auth['isAuthenticated'](),controller[_0x9673('0x12')]);router[_0x9673('0x11')]('/:id/any_conditions',auth[_0x9673('0xc')](),controller[_0x9673('0x13')]);router[_0x9673('0x11')]('/:id/actions',auth[_0x9673('0xc')](),controller['addAction']);router[_0x9673('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9673('0x15')]);router['delete'](_0x9673('0xa'),auth[_0x9673('0xc')](),controller['destroy']);module[_0x9673('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index b504a9f..49498cb 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 _0xe116=['exports','STRING','BOOLEAN'];(function(_0x438e18,_0x52e2c5){var _0x50c6ea=function(_0x7ae358){while(--_0x7ae358){_0x438e18['push'](_0x438e18['shift']());}};_0x50c6ea(++_0x52e2c5);}(_0xe116,0x159));var _0x6e11=function(_0x41eff0,_0x2f7dd1){_0x41eff0=_0x41eff0-0x0;var _0x3ae1a9=_0xe116[_0x41eff0];return _0x3ae1a9;};'use strict';var Sequelize=require('sequelize');module[_0x6e11('0x0')]={'name':{'type':Sequelize[_0x6e11('0x1')]},'channel':{'type':Sequelize[_0x6e11('0x1')]},'description':{'type':Sequelize[_0x6e11('0x1')]},'status':{'type':Sequelize[_0x6e11('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8c79=['exports','STRING','BOOLEAN'];(function(_0x5dfed8,_0x2574db){var _0x37d3d1=function(_0x38c154){while(--_0x38c154){_0x5dfed8['push'](_0x5dfed8['shift']());}};_0x37d3d1(++_0x2574db);}(_0x8c79,0xa5));var _0x98c7=function(_0x35ecfc,_0xa522ae){_0x35ecfc=_0x35ecfc-0x0;var _0x5d759d=_0x8c79[_0x35ecfc];return _0x5d759d;};'use strict';var Sequelize=require('sequelize');module[_0x98c7('0x0')]={'name':{'type':Sequelize[_0x98c7('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98c7('0x1')]},'status':{'type':Sequelize[_0x98c7('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 3b70a73..e6dfa94 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 _0x68d7=['hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','body','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','TriggerId','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Triggers','end','sendStatus','stack','name','send','index','Trigger','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length'];(function(_0x23775d,_0x24ef43){var _0x3adfcb=function(_0x31302e){while(--_0x31302e){_0x23775d['push'](_0x23775d['shift']());}};_0x3adfcb(++_0x24ef43);}(_0x68d7,0x83));var _0x768d=function(_0x100246,_0x47ab09){_0x100246=_0x100246-0x0;var _0x3e734e=_0x68d7[_0x100246];return _0x3e734e;};'use strict';var emlformat=require(_0x768d('0x0'));var rimraf=require(_0x768d('0x1'));var zipdir=require(_0x768d('0x2'));var jsonpatch=require(_0x768d('0x3'));var rp=require(_0x768d('0x4'));var moment=require(_0x768d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x768d('0x6'));var path=require('path');var sox=require(_0x768d('0x7'));var csv=require(_0x768d('0x8'));var ejs=require(_0x768d('0x9'));var fs=require('fs');var fs_extra=require(_0x768d('0xa'));var _=require(_0x768d('0xb'));var squel=require(_0x768d('0xc'));var crypto=require(_0x768d('0xd'));var jsforce=require(_0x768d('0xe'));var deskjs=require(_0x768d('0xf'));var toCsv=require(_0x768d('0x8'));var querystring=require('querystring');var Papa=require(_0x768d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x768d('0x11'));var as=require(_0x768d('0x12'));var hardwareService=require(_0x768d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x768d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x768d('0x15'))['db'];function respondWithStatusCode(_0x34ced7,_0x59ea37){_0x59ea37=_0x59ea37||0xcc;return function(_0x22edf9){if(_0x22edf9){return _0x34ced7['sendStatus'](_0x59ea37);}return _0x34ced7[_0x768d('0x16')](_0x59ea37)['end']();};}function respondWithResult(_0x2ab6ef,_0x411bb8){_0x411bb8=_0x411bb8||0xc8;return function(_0x48d1c9){if(_0x48d1c9){return _0x2ab6ef[_0x768d('0x16')](_0x411bb8)['json'](_0x48d1c9);}};}function respondWithFilteredResult(_0x191c86,_0x5426c3){return function(_0x476894){if(_0x476894){var _0x5a1a47=typeof _0x5426c3['offset']===_0x768d('0x17')&&typeof _0x5426c3[_0x768d('0x18')]===_0x768d('0x17');var _0x519d45=_0x476894['count'];var _0xca569b=_0x5a1a47?0x0:_0x5426c3[_0x768d('0x19')];var _0x10d36f=_0x5a1a47?_0x476894[_0x768d('0x1a')]:_0x5426c3['offset']+_0x5426c3['limit'];var _0x19d352;if(_0x10d36f>=_0x519d45){_0x10d36f=_0x519d45;_0x19d352=0xc8;}else{_0x19d352=0xce;}_0x191c86[_0x768d('0x16')](_0x19d352);return _0x191c86[_0x768d('0x1b')](_0x768d('0x1c'),_0xca569b+'-'+_0x10d36f+'/'+_0x519d45)[_0x768d('0x1d')](_0x476894);}return null;};}function patchUpdates(_0xf24218){return function(_0x572a7d){try{jsonpatch[_0x768d('0x1e')](_0x572a7d,_0xf24218,!![]);}catch(_0x330603){return BPromise[_0x768d('0x1f')](_0x330603);}return _0x572a7d[_0x768d('0x20')]();};}function saveUpdates(_0x4ad9c5,_0x125c60){return function(_0x2268a3){if(_0x2268a3){return _0x2268a3[_0x768d('0x21')](_0x4ad9c5)[_0x768d('0x22')](function(_0x4d7b90){return _0x4d7b90;});}return null;};}function removeEntity(_0x190dcf,_0x22b3af){return function(_0x58c378){if(_0x58c378){return _0x58c378[_0x768d('0x23')]()[_0x768d('0x22')](function(){var _0x29cbb1=_0x58c378[_0x768d('0x24')]({'plain':!![]});var _0x38a40b=_0x768d('0x25');return db['UserProfileResource'][_0x768d('0x23')]({'where':{'type':_0x38a40b,'resourceId':_0x29cbb1['id']}})['then'](function(){return _0x58c378;});})[_0x768d('0x22')](function(){_0x190dcf[_0x768d('0x16')](0xcc)[_0x768d('0x26')]();});}};}function handleEntityNotFound(_0x5deab1,_0x3e6309){return function(_0x4c52a1){if(!_0x4c52a1){_0x5deab1[_0x768d('0x27')](0x194);}return _0x4c52a1;};}function handleError(_0x325153,_0x151697){_0x151697=_0x151697||0x1f4;return function(_0x321e22){logger['error'](_0x321e22[_0x768d('0x28')]);if(_0x321e22[_0x768d('0x29')]){delete _0x321e22['name'];}_0x325153['status'](_0x151697)[_0x768d('0x2a')](_0x321e22);};}exports[_0x768d('0x2b')]=function(_0x12e0d3,_0x466030){var _0x8993d5={},_0xea2f46={},_0x3afcbd={'count':0x0,'rows':[]};var _0x814c5f=_['map'](db[_0x768d('0x2c')][_0x768d('0x2d')],function(_0x1c5776){return{'name':_0x1c5776['fieldName'],'type':_0x1c5776[_0x768d('0x2e')][_0x768d('0x2f')]};});_0xea2f46[_0x768d('0x30')]=_['map'](_0x814c5f,'name');_0xea2f46['query']=_[_0x768d('0x31')](_0x12e0d3['query']);_0xea2f46['filters']=_[_0x768d('0x32')](_0xea2f46[_0x768d('0x30')],_0xea2f46[_0x768d('0x33')]);_0x8993d5[_0x768d('0x34')]=_[_0x768d('0x32')](_0xea2f46[_0x768d('0x30')],qs[_0x768d('0x35')](_0x12e0d3[_0x768d('0x33')][_0x768d('0x35')]));_0x8993d5[_0x768d('0x34')]=_0x8993d5[_0x768d('0x34')][_0x768d('0x36')]?_0x8993d5['attributes']:_0xea2f46[_0x768d('0x30')];if(!_0x12e0d3[_0x768d('0x33')][_0x768d('0x37')](_0x768d('0x38'))){_0x8993d5[_0x768d('0x18')]=qs[_0x768d('0x18')](_0x12e0d3['query'][_0x768d('0x18')]);_0x8993d5[_0x768d('0x19')]=qs['offset'](_0x12e0d3['query']['offset']);}_0x8993d5[_0x768d('0x39')]=qs['sort'](_0x12e0d3[_0x768d('0x33')][_0x768d('0x3a')]);_0x8993d5[_0x768d('0x3b')]=qs['filters'](_['pick'](_0x12e0d3['query'],_0xea2f46[_0x768d('0x3c')]),_0x814c5f);if(_0x12e0d3['query'][_0x768d('0x3d')]){_0x8993d5['where']=_[_0x768d('0x3e')](_0x8993d5[_0x768d('0x3b')],{'$or':_[_0x768d('0x3f')](_0x814c5f,function(_0x37ce1e){if(_0x37ce1e['type']!==_0x768d('0x40')){var _0xd6ba6b={};_0xd6ba6b[_0x37ce1e[_0x768d('0x29')]]={'$like':'%'+_0x12e0d3[_0x768d('0x33')][_0x768d('0x3d')]+'%'};return _0xd6ba6b;}})});}_0x8993d5=_[_0x768d('0x3e')]({},_0x8993d5,_0x12e0d3[_0x768d('0x41')]);var _0x1600bc={'where':_0x8993d5[_0x768d('0x3b')]};return db[_0x768d('0x2c')][_0x768d('0x1a')](_0x1600bc)[_0x768d('0x22')](function(_0x46345f){_0x3afcbd['count']=_0x46345f;if(_0x12e0d3[_0x768d('0x33')][_0x768d('0x42')]){_0x8993d5[_0x768d('0x43')]=[{'all':!![]}];}return db[_0x768d('0x2c')][_0x768d('0x44')](_0x8993d5);})['then'](function(_0x38a985){_0x3afcbd[_0x768d('0x45')]=_0x38a985;return _0x3afcbd;})[_0x768d('0x22')](respondWithFilteredResult(_0x466030,_0x8993d5))['catch'](handleError(_0x466030,null));};exports['show']=function(_0x29d782,_0x557c73){var _0xac149e={'raw':![],'where':{'id':_0x29d782[_0x768d('0x46')]['id']}},_0x1d7af3={};_0x1d7af3[_0x768d('0x30')]=_[_0x768d('0x31')](db[_0x768d('0x2c')]['rawAttributes']);_0x1d7af3[_0x768d('0x33')]=_[_0x768d('0x31')](_0x29d782[_0x768d('0x33')]);_0x1d7af3[_0x768d('0x3c')]=_[_0x768d('0x32')](_0x1d7af3[_0x768d('0x30')],_0x1d7af3[_0x768d('0x33')]);_0xac149e[_0x768d('0x34')]=_[_0x768d('0x32')](_0x1d7af3[_0x768d('0x30')],qs[_0x768d('0x35')](_0x29d782['query'][_0x768d('0x35')]));_0xac149e[_0x768d('0x34')]=_0xac149e['attributes'][_0x768d('0x36')]?_0xac149e['attributes']:_0x1d7af3[_0x768d('0x30')];if(_0x29d782['query'][_0x768d('0x42')]){_0xac149e[_0x768d('0x43')]=[{'all':!![]}];}_0xac149e=_[_0x768d('0x3e')]({},_0xac149e,_0x29d782[_0x768d('0x41')]);return db['Trigger']['find'](_0xac149e)[_0x768d('0x22')](handleEntityNotFound(_0x557c73,null))[_0x768d('0x22')](respondWithResult(_0x557c73,null))['catch'](handleError(_0x557c73,null));};exports[_0x768d('0x47')]=function(_0xd53e5a,_0x364764){return db[_0x768d('0x2c')][_0x768d('0x47')](_0xd53e5a['body'],{})[_0x768d('0x22')](function(_0x1787b7){var _0x408b69=_0xd53e5a[_0x768d('0x48')]['get']({'plain':!![]});if(!_0x408b69)throw new Error(_0x768d('0x49'));if(_0x408b69['role']===_0x768d('0x48')){var _0x400456=_0x1787b7[_0x768d('0x24')]({'plain':!![]});var _0x2e6a56=_0x768d('0x25');return db[_0x768d('0x4a')]['find']({'where':{'name':_0x2e6a56,'userProfileId':_0x408b69[_0x768d('0x4b')]},'raw':!![]})[_0x768d('0x22')](function(_0x11fe76){if(_0x11fe76&&_0x11fe76[_0x768d('0x4c')]===0x0){return db[_0x768d('0x4d')][_0x768d('0x47')]({'name':_0x400456[_0x768d('0x29')],'resourceId':_0x400456['id'],'type':_0x11fe76[_0x768d('0x29')],'sectionId':_0x11fe76['id']},{})[_0x768d('0x22')](function(){return _0x1787b7;});}else{return _0x1787b7;}})[_0x768d('0x4e')](function(_0x5d4c53){logger[_0x768d('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d4c53);throw _0x5d4c53;});}return _0x1787b7;})[_0x768d('0x22')](respondWithResult(_0x364764,0xc9))['catch'](handleError(_0x364764,null));};exports['update']=function(_0x3cc50a,_0x1d1242){if(_0x3cc50a[_0x768d('0x50')]['id']){delete _0x3cc50a[_0x768d('0x50')]['id'];}return db['Trigger'][_0x768d('0x51')]({'where':{'id':_0x3cc50a[_0x768d('0x46')]['id']}})[_0x768d('0x22')](handleEntityNotFound(_0x1d1242,null))['then'](saveUpdates(_0x3cc50a[_0x768d('0x50')],null))['then'](respondWithResult(_0x1d1242,null))[_0x768d('0x4e')](handleError(_0x1d1242,null));};exports[_0x768d('0x23')]=function(_0x173d01,_0x5b4259){return db[_0x768d('0x2c')][_0x768d('0x51')]({'where':{'id':_0x173d01['params']['id']}})['then'](handleEntityNotFound(_0x5b4259,null))[_0x768d('0x22')](removeEntity(_0x5b4259,null))[_0x768d('0x4e')](handleError(_0x5b4259,null));};exports[_0x768d('0x52')]=function(_0x4e4410,_0x15fbaf,_0x3532c0){if(_0x4e4410['body']['id']){delete _0x4e4410['body']['id'];}return db[_0x768d('0x2c')][_0x768d('0x51')]({'where':{'id':_0x4e4410[_0x768d('0x46')]['id']}})[_0x768d('0x22')](handleEntityNotFound(_0x15fbaf,null))['then'](function(_0x3a3524){if(_0x3a3524){_0x4e4410[_0x768d('0x50')][_0x768d('0x53')]=_0x3a3524['id'];return db[_0x768d('0x54')][_0x768d('0x47')](_0x4e4410['body']);}})[_0x768d('0x22')](respondWithResult(_0x15fbaf,null))[_0x768d('0x4e')](handleError(_0x15fbaf,null));};exports[_0x768d('0x55')]=function(_0x5820c7,_0x499fe6,_0x4645d9){if(_0x5820c7[_0x768d('0x50')]['id']){delete _0x5820c7[_0x768d('0x50')]['id'];}return db[_0x768d('0x2c')][_0x768d('0x51')]({'where':{'id':_0x5820c7[_0x768d('0x46')]['id']}})[_0x768d('0x22')](handleEntityNotFound(_0x499fe6,null))['then'](function(_0x1cc1c9){if(_0x1cc1c9){_0x5820c7[_0x768d('0x50')][_0x768d('0x56')]=_0x1cc1c9['id'];return db[_0x768d('0x54')]['create'](_0x5820c7['body']);}})['then'](respondWithResult(_0x499fe6,null))[_0x768d('0x4e')](handleError(_0x499fe6,null));};exports[_0x768d('0x57')]=function(_0x3a35f9,_0xfa87f3,_0x135608){var _0x427fcf={};var _0x36391a={};var _0xb3d363;var _0x22cee6;return db['Trigger'][_0x768d('0x58')]({'where':{'id':_0x3a35f9[_0x768d('0x46')]['id']}})[_0x768d('0x22')](handleEntityNotFound(_0xfa87f3,null))[_0x768d('0x22')](function(_0x218e06){if(_0x218e06){_0xb3d363=_0x218e06;_0x36391a[_0x768d('0x30')]=_[_0x768d('0x31')](db[_0x768d('0x54')][_0x768d('0x2d')]);_0x36391a[_0x768d('0x33')]=_[_0x768d('0x31')](_0x3a35f9[_0x768d('0x33')]);_0x36391a['filters']=_[_0x768d('0x32')](_0x36391a['model'],_0x36391a[_0x768d('0x33')]);_0x427fcf[_0x768d('0x34')]=_[_0x768d('0x32')](_0x36391a['model'],qs[_0x768d('0x35')](_0x3a35f9['query']['fields']));_0x427fcf[_0x768d('0x34')]=_0x427fcf['attributes'][_0x768d('0x36')]?_0x427fcf[_0x768d('0x34')]:_0x36391a[_0x768d('0x30')];_0x427fcf[_0x768d('0x39')]=qs[_0x768d('0x3a')](_0x3a35f9[_0x768d('0x33')][_0x768d('0x3a')]);_0x427fcf[_0x768d('0x3b')]=qs[_0x768d('0x3c')](_[_0x768d('0x59')](_0x3a35f9[_0x768d('0x33')],_0x36391a[_0x768d('0x3c')]));if(_0x3a35f9[_0x768d('0x33')][_0x768d('0x3d')]){_0x427fcf[_0x768d('0x3b')]=_[_0x768d('0x3e')](_0x427fcf['where'],{'$or':_['map'](_0x427fcf['attributes'],function(_0x339591){var _0x289ff2={};_0x289ff2[_0x339591]={'$like':'%'+_0x3a35f9['query'][_0x768d('0x3d')]+'%'};return _0x289ff2;})});}_0x427fcf=_[_0x768d('0x3e')]({},_0x427fcf,_0x3a35f9[_0x768d('0x41')]);return _0xb3d363[_0x768d('0x57')](_0x427fcf);}})[_0x768d('0x22')](function(_0x4506d2){if(_0x4506d2){_0x22cee6=_0x4506d2['length'];if(!_0x3a35f9[_0x768d('0x33')][_0x768d('0x37')](_0x768d('0x38'))){_0x427fcf['limit']=qs[_0x768d('0x18')](_0x3a35f9[_0x768d('0x33')][_0x768d('0x18')]);_0x427fcf[_0x768d('0x19')]=qs[_0x768d('0x19')](_0x3a35f9['query']['offset']);}return _0xb3d363[_0x768d('0x57')](_0x427fcf);}})['then'](function(_0x18b44d){if(_0x18b44d){return _0x18b44d?{'count':_0x22cee6,'rows':_0x18b44d}:null;}})[_0x768d('0x22')](respondWithResult(_0xfa87f3,null))[_0x768d('0x4e')](handleError(_0xfa87f3,null));};exports['getAnyConditions']=function(_0x427c2f,_0x37066d,_0x56be2d){var _0x440764={};var _0x3bff64={};var _0x3afbc5;var _0x410528;return db[_0x768d('0x2c')][_0x768d('0x58')]({'where':{'id':_0x427c2f[_0x768d('0x46')]['id']}})[_0x768d('0x22')](handleEntityNotFound(_0x37066d,null))[_0x768d('0x22')](function(_0x57ae55){if(_0x57ae55){_0x3afbc5=_0x57ae55;_0x3bff64[_0x768d('0x30')]=_['keys'](db[_0x768d('0x54')][_0x768d('0x2d')]);_0x3bff64[_0x768d('0x33')]=_['keys'](_0x427c2f[_0x768d('0x33')]);_0x3bff64[_0x768d('0x3c')]=_['intersection'](_0x3bff64[_0x768d('0x30')],_0x3bff64[_0x768d('0x33')]);_0x440764[_0x768d('0x34')]=_[_0x768d('0x32')](_0x3bff64['model'],qs['fields'](_0x427c2f[_0x768d('0x33')][_0x768d('0x35')]));_0x440764[_0x768d('0x34')]=_0x440764[_0x768d('0x34')]['length']?_0x440764[_0x768d('0x34')]:_0x3bff64['model'];_0x440764[_0x768d('0x39')]=qs[_0x768d('0x3a')](_0x427c2f['query']['sort']);_0x440764['where']=qs[_0x768d('0x3c')](_['pick'](_0x427c2f['query'],_0x3bff64[_0x768d('0x3c')]));if(_0x427c2f[_0x768d('0x33')][_0x768d('0x3d')]){_0x440764[_0x768d('0x3b')]=_[_0x768d('0x3e')](_0x440764[_0x768d('0x3b')],{'$or':_[_0x768d('0x3f')](_0x440764[_0x768d('0x34')],function(_0x33e78e){var _0x3f494a={};_0x3f494a[_0x33e78e]={'$like':'%'+_0x427c2f[_0x768d('0x33')]['filter']+'%'};return _0x3f494a;})});}_0x440764=_[_0x768d('0x3e')]({},_0x440764,_0x427c2f[_0x768d('0x41')]);return _0x3afbc5[_0x768d('0x5a')](_0x440764);}})['then'](function(_0x25a5a9){if(_0x25a5a9){_0x410528=_0x25a5a9[_0x768d('0x36')];if(!_0x427c2f[_0x768d('0x33')][_0x768d('0x37')](_0x768d('0x38'))){_0x440764[_0x768d('0x18')]=qs[_0x768d('0x18')](_0x427c2f['query'][_0x768d('0x18')]);_0x440764[_0x768d('0x19')]=qs[_0x768d('0x19')](_0x427c2f[_0x768d('0x33')][_0x768d('0x19')]);}return _0x3afbc5['getAnyConditions'](_0x440764);}})['then'](function(_0x284f8c){if(_0x284f8c){return _0x284f8c?{'count':_0x410528,'rows':_0x284f8c}:null;}})[_0x768d('0x22')](respondWithResult(_0x37066d,null))[_0x768d('0x4e')](handleError(_0x37066d,null));};exports['addAction']=function(_0xe9bc95,_0x46a8d9,_0x2a8dc7){if(_0xe9bc95['body']['id']){delete _0xe9bc95[_0x768d('0x50')]['id'];}return db[_0x768d('0x2c')][_0x768d('0x51')]({'where':{'id':_0xe9bc95[_0x768d('0x46')]['id']}})['then'](handleEntityNotFound(_0x46a8d9,null))[_0x768d('0x22')](function(_0x515e8e){if(_0x515e8e){_0xe9bc95[_0x768d('0x50')][_0x768d('0x5b')]=_0x515e8e['id'];return db['Action'][_0x768d('0x47')](_0xe9bc95[_0x768d('0x50')]);}})[_0x768d('0x22')](respondWithResult(_0x46a8d9,null))[_0x768d('0x4e')](handleError(_0x46a8d9,null));};exports['getActions']=function(_0x22b0dd,_0x2cab98,_0x291e32){var _0x3fefb5={};var _0x4f0e80={};var _0x6db7b4;var _0x4dcfdd;return db[_0x768d('0x2c')][_0x768d('0x58')]({'where':{'id':_0x22b0dd[_0x768d('0x46')]['id']}})[_0x768d('0x22')](handleEntityNotFound(_0x2cab98,null))[_0x768d('0x22')](function(_0x1faaf2){if(_0x1faaf2){_0x6db7b4=_0x1faaf2;_0x4f0e80[_0x768d('0x30')]=_[_0x768d('0x31')](db[_0x768d('0x5c')][_0x768d('0x2d')]);_0x4f0e80[_0x768d('0x33')]=_[_0x768d('0x31')](_0x22b0dd['query']);_0x4f0e80['filters']=_[_0x768d('0x32')](_0x4f0e80[_0x768d('0x30')],_0x4f0e80[_0x768d('0x33')]);_0x3fefb5[_0x768d('0x34')]=_[_0x768d('0x32')](_0x4f0e80[_0x768d('0x30')],qs[_0x768d('0x35')](_0x22b0dd[_0x768d('0x33')][_0x768d('0x35')]));_0x3fefb5[_0x768d('0x34')]=_0x3fefb5['attributes'][_0x768d('0x36')]?_0x3fefb5[_0x768d('0x34')]:_0x4f0e80['model'];_0x3fefb5[_0x768d('0x39')]=qs[_0x768d('0x3a')](_0x22b0dd[_0x768d('0x33')][_0x768d('0x3a')]);_0x3fefb5[_0x768d('0x3b')]=qs[_0x768d('0x3c')](_['pick'](_0x22b0dd[_0x768d('0x33')],_0x4f0e80[_0x768d('0x3c')]));if(_0x22b0dd['query']['filter']){_0x3fefb5[_0x768d('0x3b')]=_[_0x768d('0x3e')](_0x3fefb5['where'],{'$or':_[_0x768d('0x3f')](_0x3fefb5[_0x768d('0x34')],function(_0x3eb5c5){var _0x4b893d={};_0x4b893d[_0x3eb5c5]={'$like':'%'+_0x22b0dd[_0x768d('0x33')][_0x768d('0x3d')]+'%'};return _0x4b893d;})});}_0x3fefb5=_[_0x768d('0x3e')]({},_0x3fefb5,_0x22b0dd[_0x768d('0x41')]);return _0x6db7b4['getActions'](_0x3fefb5);}})[_0x768d('0x22')](function(_0x21bc95){if(_0x21bc95){_0x4dcfdd=_0x21bc95[_0x768d('0x36')];if(!_0x22b0dd[_0x768d('0x33')]['hasOwnProperty']('nolimit')){_0x3fefb5[_0x768d('0x18')]=qs[_0x768d('0x18')](_0x22b0dd['query'][_0x768d('0x18')]);_0x3fefb5[_0x768d('0x19')]=qs[_0x768d('0x19')](_0x22b0dd['query'][_0x768d('0x19')]);}return _0x6db7b4['getActions'](_0x3fefb5);}})['then'](function(_0x5138d0){if(_0x5138d0){return _0x5138d0?{'count':_0x4dcfdd,'rows':_0x5138d0}:null;}})[_0x768d('0x22')](respondWithResult(_0x2cab98,null))[_0x768d('0x4e')](handleError(_0x2cab98,null));}; \ No newline at end of file +var _0xb212=['destroy','end','error','stack','name','send','map','Trigger','rawAttributes','key','keys','query','intersection','attributes','model','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','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','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','nolimit','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','get','Triggers','UserProfileResource'];(function(_0x30e819,_0x2e7a53){var _0x4313c0=function(_0x591b3a){while(--_0x591b3a){_0x30e819['push'](_0x30e819['shift']());}};_0x4313c0(++_0x2e7a53);}(_0xb212,0x1af));var _0x2b21=function(_0x2d3bfb,_0x24a350){_0x2d3bfb=_0x2d3bfb-0x0;var _0x58ce66=_0xb212[_0x2d3bfb];return _0x58ce66;};'use strict';var emlformat=require(_0x2b21('0x0'));var rimraf=require(_0x2b21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b21('0x2'));var rp=require(_0x2b21('0x3'));var moment=require(_0x2b21('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b21('0x5'));var path=require(_0x2b21('0x6'));var sox=require(_0x2b21('0x7'));var csv=require(_0x2b21('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2b21('0x9'));var crypto=require(_0x2b21('0xa'));var jsforce=require(_0x2b21('0xb'));var deskjs=require(_0x2b21('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2b21('0xd'));var Papa=require(_0x2b21('0xe'));var Redis=require(_0x2b21('0xf'));var authService=require(_0x2b21('0x10'));var qs=require(_0x2b21('0x11'));var as=require(_0x2b21('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b21('0x13'))(_0x2b21('0x14'));var utils=require(_0x2b21('0x15'));var config=require(_0x2b21('0x16'));var licenseUtil=require(_0x2b21('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2ec7,_0x1ef493){_0x1ef493=_0x1ef493||0xcc;return function(_0x5e2730){if(_0x5e2730){return _0x5b2ec7[_0x2b21('0x18')](_0x1ef493);}return _0x5b2ec7[_0x2b21('0x19')](_0x1ef493)['end']();};}function respondWithResult(_0x5ccc75,_0x3cbc0f){_0x3cbc0f=_0x3cbc0f||0xc8;return function(_0x22a45c){if(_0x22a45c){return _0x5ccc75[_0x2b21('0x19')](_0x3cbc0f)[_0x2b21('0x1a')](_0x22a45c);}};}function respondWithFilteredResult(_0x5dafd6,_0x37da93){return function(_0x3aa77d){if(_0x3aa77d){var _0x1f4595=typeof _0x37da93[_0x2b21('0x1b')]===_0x2b21('0x1c')&&typeof _0x37da93[_0x2b21('0x1d')]==='undefined';var _0x368574=_0x3aa77d[_0x2b21('0x1e')];var _0x32085e=_0x1f4595?0x0:_0x37da93[_0x2b21('0x1b')];var _0x189958=_0x1f4595?_0x3aa77d[_0x2b21('0x1e')]:_0x37da93[_0x2b21('0x1b')]+_0x37da93[_0x2b21('0x1d')];var _0x20981c;if(_0x189958>=_0x368574){_0x189958=_0x368574;_0x20981c=0xc8;}else{_0x20981c=0xce;}_0x5dafd6[_0x2b21('0x19')](_0x20981c);return _0x5dafd6[_0x2b21('0x1f')]('Content-Range',_0x32085e+'-'+_0x189958+'/'+_0x368574)[_0x2b21('0x1a')](_0x3aa77d);}return null;};}function patchUpdates(_0x1dff6d){return function(_0x53032f){try{jsonpatch[_0x2b21('0x20')](_0x53032f,_0x1dff6d,!![]);}catch(_0x3ba133){return BPromise[_0x2b21('0x21')](_0x3ba133);}return _0x53032f['save']();};}function saveUpdates(_0x2972ac,_0x4798ef){return function(_0x448e4f){if(_0x448e4f){return _0x448e4f[_0x2b21('0x22')](_0x2972ac)[_0x2b21('0x23')](function(_0x3cb307){return _0x3cb307;});}return null;};}function removeEntity(_0x2605ae,_0x44446e){return function(_0x5126c0){if(_0x5126c0){return _0x5126c0['destroy']()[_0x2b21('0x23')](function(){var _0x558075=_0x5126c0[_0x2b21('0x24')]({'plain':!![]});var _0x22325d=_0x2b21('0x25');return db[_0x2b21('0x26')][_0x2b21('0x27')]({'where':{'type':_0x22325d,'resourceId':_0x558075['id']}})[_0x2b21('0x23')](function(){return _0x5126c0;});})[_0x2b21('0x23')](function(){_0x2605ae[_0x2b21('0x19')](0xcc)[_0x2b21('0x28')]();});}};}function handleEntityNotFound(_0x1577fb,_0x1a2c29){return function(_0x43201f){if(!_0x43201f){_0x1577fb[_0x2b21('0x18')](0x194);}return _0x43201f;};}function handleError(_0x5314b1,_0x12bc16){_0x12bc16=_0x12bc16||0x1f4;return function(_0x3219b4){logger[_0x2b21('0x29')](_0x3219b4[_0x2b21('0x2a')]);if(_0x3219b4[_0x2b21('0x2b')]){delete _0x3219b4['name'];}_0x5314b1[_0x2b21('0x19')](_0x12bc16)[_0x2b21('0x2c')](_0x3219b4);};}exports['index']=function(_0x1f26cc,_0x2352da){var _0x3b50d6={},_0x495c6f={},_0x43997d={'count':0x0,'rows':[]};var _0x4e2a68=_[_0x2b21('0x2d')](db[_0x2b21('0x2e')][_0x2b21('0x2f')],function(_0x107899){return{'name':_0x107899['fieldName'],'type':_0x107899['type'][_0x2b21('0x30')]};});_0x495c6f['model']=_[_0x2b21('0x2d')](_0x4e2a68,_0x2b21('0x2b'));_0x495c6f['query']=_[_0x2b21('0x31')](_0x1f26cc[_0x2b21('0x32')]);_0x495c6f['filters']=_[_0x2b21('0x33')](_0x495c6f['model'],_0x495c6f[_0x2b21('0x32')]);_0x3b50d6[_0x2b21('0x34')]=_[_0x2b21('0x33')](_0x495c6f[_0x2b21('0x35')],qs[_0x2b21('0x36')](_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x36')]));_0x3b50d6[_0x2b21('0x34')]=_0x3b50d6[_0x2b21('0x34')]['length']?_0x3b50d6[_0x2b21('0x34')]:_0x495c6f['model'];if(!_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x37')]('nolimit')){_0x3b50d6[_0x2b21('0x1d')]=qs[_0x2b21('0x1d')](_0x1f26cc['query']['limit']);_0x3b50d6[_0x2b21('0x1b')]=qs[_0x2b21('0x1b')](_0x1f26cc['query'][_0x2b21('0x1b')]);}_0x3b50d6[_0x2b21('0x38')]=qs[_0x2b21('0x39')](_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x39')]);_0x3b50d6['where']=qs[_0x2b21('0x3a')](_['pick'](_0x1f26cc[_0x2b21('0x32')],_0x495c6f[_0x2b21('0x3a')]),_0x4e2a68);if(_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x3b')]){_0x3b50d6[_0x2b21('0x3c')]=_[_0x2b21('0x3d')](_0x3b50d6[_0x2b21('0x3c')],{'$or':_[_0x2b21('0x2d')](_0x4e2a68,function(_0x115c27){if(_0x115c27['type']!==_0x2b21('0x3e')){var _0x45570b={};_0x45570b[_0x115c27[_0x2b21('0x2b')]]={'$like':'%'+_0x1f26cc[_0x2b21('0x32')]['filter']+'%'};return _0x45570b;}})});}_0x3b50d6=_['merge']({},_0x3b50d6,_0x1f26cc[_0x2b21('0x3f')]);var _0x51c07f={'where':_0x3b50d6[_0x2b21('0x3c')]};return db[_0x2b21('0x2e')][_0x2b21('0x1e')](_0x51c07f)['then'](function(_0x5d7cf3){_0x43997d['count']=_0x5d7cf3;if(_0x1f26cc[_0x2b21('0x32')][_0x2b21('0x40')]){_0x3b50d6[_0x2b21('0x41')]=[{'all':!![]}];}return db[_0x2b21('0x2e')][_0x2b21('0x42')](_0x3b50d6);})[_0x2b21('0x23')](function(_0x3d647e){_0x43997d[_0x2b21('0x43')]=_0x3d647e;return _0x43997d;})[_0x2b21('0x23')](respondWithFilteredResult(_0x2352da,_0x3b50d6))[_0x2b21('0x44')](handleError(_0x2352da,null));};exports['show']=function(_0x3a03c2,_0x40cd4a){var _0x58b217={'raw':![],'where':{'id':_0x3a03c2[_0x2b21('0x45')]['id']}},_0x4eb208={};_0x4eb208['model']=_[_0x2b21('0x31')](db[_0x2b21('0x2e')][_0x2b21('0x2f')]);_0x4eb208[_0x2b21('0x32')]=_[_0x2b21('0x31')](_0x3a03c2[_0x2b21('0x32')]);_0x4eb208[_0x2b21('0x3a')]=_['intersection'](_0x4eb208[_0x2b21('0x35')],_0x4eb208[_0x2b21('0x32')]);_0x58b217[_0x2b21('0x34')]=_[_0x2b21('0x33')](_0x4eb208[_0x2b21('0x35')],qs[_0x2b21('0x36')](_0x3a03c2[_0x2b21('0x32')][_0x2b21('0x36')]));_0x58b217[_0x2b21('0x34')]=_0x58b217['attributes'][_0x2b21('0x46')]?_0x58b217['attributes']:_0x4eb208[_0x2b21('0x35')];if(_0x3a03c2[_0x2b21('0x32')][_0x2b21('0x40')]){_0x58b217['include']=[{'all':!![]}];}_0x58b217=_[_0x2b21('0x3d')]({},_0x58b217,_0x3a03c2[_0x2b21('0x3f')]);return db[_0x2b21('0x2e')][_0x2b21('0x47')](_0x58b217)[_0x2b21('0x23')](handleEntityNotFound(_0x40cd4a,null))['then'](respondWithResult(_0x40cd4a,null))[_0x2b21('0x44')](handleError(_0x40cd4a,null));};exports[_0x2b21('0x48')]=function(_0x532c3e,_0x156170){return db[_0x2b21('0x2e')]['create'](_0x532c3e[_0x2b21('0x49')],{})['then'](function(_0x1f696c){var _0x127659=_0x532c3e[_0x2b21('0x4a')]['get']({'plain':!![]});if(!_0x127659)throw new Error(_0x2b21('0x4b'));if(_0x127659[_0x2b21('0x4c')]===_0x2b21('0x4a')){var _0x5c058a=_0x1f696c[_0x2b21('0x24')]({'plain':!![]});var _0xde4440=_0x2b21('0x25');return db[_0x2b21('0x4d')][_0x2b21('0x47')]({'where':{'name':_0xde4440,'userProfileId':_0x127659[_0x2b21('0x4e')]},'raw':!![]})[_0x2b21('0x23')](function(_0x83d70d){if(_0x83d70d&&_0x83d70d[_0x2b21('0x4f')]===0x0){return db['UserProfileResource'][_0x2b21('0x48')]({'name':_0x5c058a[_0x2b21('0x2b')],'resourceId':_0x5c058a['id'],'type':_0x83d70d['name'],'sectionId':_0x83d70d['id']},{})['then'](function(){return _0x1f696c;});}else{return _0x1f696c;}})[_0x2b21('0x44')](function(_0x479ddd){logger[_0x2b21('0x29')](_0x2b21('0x50'),_0x479ddd);throw _0x479ddd;});}return _0x1f696c;})['then'](respondWithResult(_0x156170,0xc9))[_0x2b21('0x44')](handleError(_0x156170,null));};exports[_0x2b21('0x22')]=function(_0x167af3,_0xccbe7b){if(_0x167af3[_0x2b21('0x49')]['id']){delete _0x167af3[_0x2b21('0x49')]['id'];}return db[_0x2b21('0x2e')]['find']({'where':{'id':_0x167af3['params']['id']}})['then'](handleEntityNotFound(_0xccbe7b,null))[_0x2b21('0x23')](saveUpdates(_0x167af3[_0x2b21('0x49')],null))['then'](respondWithResult(_0xccbe7b,null))[_0x2b21('0x44')](handleError(_0xccbe7b,null));};exports[_0x2b21('0x27')]=function(_0x41425d,_0x17d4bc){return db[_0x2b21('0x2e')][_0x2b21('0x47')]({'where':{'id':_0x41425d[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x17d4bc,null))[_0x2b21('0x23')](removeEntity(_0x17d4bc,null))[_0x2b21('0x44')](handleError(_0x17d4bc,null));};exports[_0x2b21('0x51')]=function(_0x3dd773,_0x51fdca,_0x213fd7){if(_0x3dd773['body']['id']){delete _0x3dd773[_0x2b21('0x49')]['id'];}return db[_0x2b21('0x2e')][_0x2b21('0x47')]({'where':{'id':_0x3dd773['params']['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x51fdca,null))['then'](function(_0x2ec8b3){if(_0x2ec8b3){_0x3dd773[_0x2b21('0x49')][_0x2b21('0x52')]=_0x2ec8b3['id'];return db[_0x2b21('0x53')][_0x2b21('0x48')](_0x3dd773[_0x2b21('0x49')]);}})[_0x2b21('0x23')](respondWithResult(_0x51fdca,null))[_0x2b21('0x44')](handleError(_0x51fdca,null));};exports[_0x2b21('0x54')]=function(_0x554867,_0x1fb03d,_0x2c10f6){if(_0x554867[_0x2b21('0x49')]['id']){delete _0x554867[_0x2b21('0x49')]['id'];}return db[_0x2b21('0x2e')][_0x2b21('0x47')]({'where':{'id':_0x554867[_0x2b21('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fb03d,null))[_0x2b21('0x23')](function(_0x168de){if(_0x168de){_0x554867[_0x2b21('0x49')]['TriggerAnyId']=_0x168de['id'];return db[_0x2b21('0x53')][_0x2b21('0x48')](_0x554867[_0x2b21('0x49')]);}})[_0x2b21('0x23')](respondWithResult(_0x1fb03d,null))[_0x2b21('0x44')](handleError(_0x1fb03d,null));};exports['getAllConditions']=function(_0x550215,_0x54779d,_0x103829){var _0x4c927e={};var _0x183d6c={};var _0x51d773;var _0x50b8da;return db['Trigger']['findOne']({'where':{'id':_0x550215[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x54779d,null))[_0x2b21('0x23')](function(_0x59d78c){if(_0x59d78c){_0x51d773=_0x59d78c;_0x183d6c['model']=_[_0x2b21('0x31')](db[_0x2b21('0x53')][_0x2b21('0x2f')]);_0x183d6c[_0x2b21('0x32')]=_[_0x2b21('0x31')](_0x550215[_0x2b21('0x32')]);_0x183d6c[_0x2b21('0x3a')]=_[_0x2b21('0x33')](_0x183d6c[_0x2b21('0x35')],_0x183d6c['query']);_0x4c927e[_0x2b21('0x34')]=_['intersection'](_0x183d6c[_0x2b21('0x35')],qs['fields'](_0x550215[_0x2b21('0x32')][_0x2b21('0x36')]));_0x4c927e[_0x2b21('0x34')]=_0x4c927e[_0x2b21('0x34')][_0x2b21('0x46')]?_0x4c927e['attributes']:_0x183d6c[_0x2b21('0x35')];_0x4c927e[_0x2b21('0x38')]=qs[_0x2b21('0x39')](_0x550215['query'][_0x2b21('0x39')]);_0x4c927e[_0x2b21('0x3c')]=qs['filters'](_['pick'](_0x550215[_0x2b21('0x32')],_0x183d6c[_0x2b21('0x3a')]));if(_0x550215[_0x2b21('0x32')][_0x2b21('0x3b')]){_0x4c927e[_0x2b21('0x3c')]=_[_0x2b21('0x3d')](_0x4c927e['where'],{'$or':_[_0x2b21('0x2d')](_0x4c927e['attributes'],function(_0x549705){var _0x40bf9e={};_0x40bf9e[_0x549705]={'$like':'%'+_0x550215[_0x2b21('0x32')][_0x2b21('0x3b')]+'%'};return _0x40bf9e;})});}_0x4c927e=_['merge']({},_0x4c927e,_0x550215[_0x2b21('0x3f')]);return _0x51d773[_0x2b21('0x55')](_0x4c927e);}})[_0x2b21('0x23')](function(_0x1d41e7){if(_0x1d41e7){_0x50b8da=_0x1d41e7[_0x2b21('0x46')];if(!_0x550215['query']['hasOwnProperty'](_0x2b21('0x56'))){_0x4c927e['limit']=qs[_0x2b21('0x1d')](_0x550215[_0x2b21('0x32')][_0x2b21('0x1d')]);_0x4c927e[_0x2b21('0x1b')]=qs[_0x2b21('0x1b')](_0x550215['query'][_0x2b21('0x1b')]);}return _0x51d773[_0x2b21('0x55')](_0x4c927e);}})[_0x2b21('0x23')](function(_0x4f2cbc){if(_0x4f2cbc){return _0x4f2cbc?{'count':_0x50b8da,'rows':_0x4f2cbc}:null;}})['then'](respondWithResult(_0x54779d,null))[_0x2b21('0x44')](handleError(_0x54779d,null));};exports['getAnyConditions']=function(_0x5db2d7,_0xb96d00,_0x15cc00){var _0x50202f={};var _0x4b1a41={};var _0x2962a9;var _0x3eaba9;return db['Trigger'][_0x2b21('0x57')]({'where':{'id':_0x5db2d7[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0xb96d00,null))[_0x2b21('0x23')](function(_0x1079ef){if(_0x1079ef){_0x2962a9=_0x1079ef;_0x4b1a41[_0x2b21('0x35')]=_[_0x2b21('0x31')](db['Condition'][_0x2b21('0x2f')]);_0x4b1a41[_0x2b21('0x32')]=_['keys'](_0x5db2d7['query']);_0x4b1a41[_0x2b21('0x3a')]=_[_0x2b21('0x33')](_0x4b1a41['model'],_0x4b1a41[_0x2b21('0x32')]);_0x50202f[_0x2b21('0x34')]=_[_0x2b21('0x33')](_0x4b1a41[_0x2b21('0x35')],qs[_0x2b21('0x36')](_0x5db2d7[_0x2b21('0x32')][_0x2b21('0x36')]));_0x50202f[_0x2b21('0x34')]=_0x50202f[_0x2b21('0x34')]['length']?_0x50202f[_0x2b21('0x34')]:_0x4b1a41[_0x2b21('0x35')];_0x50202f[_0x2b21('0x38')]=qs[_0x2b21('0x39')](_0x5db2d7[_0x2b21('0x32')]['sort']);_0x50202f[_0x2b21('0x3c')]=qs[_0x2b21('0x3a')](_[_0x2b21('0x58')](_0x5db2d7['query'],_0x4b1a41[_0x2b21('0x3a')]));if(_0x5db2d7['query'][_0x2b21('0x3b')]){_0x50202f['where']=_[_0x2b21('0x3d')](_0x50202f[_0x2b21('0x3c')],{'$or':_[_0x2b21('0x2d')](_0x50202f[_0x2b21('0x34')],function(_0x20c903){var _0x5aa71f={};_0x5aa71f[_0x20c903]={'$like':'%'+_0x5db2d7[_0x2b21('0x32')]['filter']+'%'};return _0x5aa71f;})});}_0x50202f=_[_0x2b21('0x3d')]({},_0x50202f,_0x5db2d7[_0x2b21('0x3f')]);return _0x2962a9[_0x2b21('0x59')](_0x50202f);}})[_0x2b21('0x23')](function(_0xe7191d){if(_0xe7191d){_0x3eaba9=_0xe7191d[_0x2b21('0x46')];if(!_0x5db2d7['query'][_0x2b21('0x37')]('nolimit')){_0x50202f[_0x2b21('0x1d')]=qs[_0x2b21('0x1d')](_0x5db2d7['query'][_0x2b21('0x1d')]);_0x50202f[_0x2b21('0x1b')]=qs['offset'](_0x5db2d7[_0x2b21('0x32')][_0x2b21('0x1b')]);}return _0x2962a9[_0x2b21('0x59')](_0x50202f);}})[_0x2b21('0x23')](function(_0x5ccf32){if(_0x5ccf32){return _0x5ccf32?{'count':_0x3eaba9,'rows':_0x5ccf32}:null;}})['then'](respondWithResult(_0xb96d00,null))[_0x2b21('0x44')](handleError(_0xb96d00,null));};exports[_0x2b21('0x5a')]=function(_0x992f5,_0x4e9568,_0x191bf5){if(_0x992f5['body']['id']){delete _0x992f5[_0x2b21('0x49')]['id'];}return db['Trigger'][_0x2b21('0x47')]({'where':{'id':_0x992f5[_0x2b21('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e9568,null))[_0x2b21('0x23')](function(_0x277e5b){if(_0x277e5b){_0x992f5[_0x2b21('0x49')][_0x2b21('0x5b')]=_0x277e5b['id'];return db[_0x2b21('0x5c')][_0x2b21('0x48')](_0x992f5['body']);}})[_0x2b21('0x23')](respondWithResult(_0x4e9568,null))[_0x2b21('0x44')](handleError(_0x4e9568,null));};exports[_0x2b21('0x5d')]=function(_0x79f272,_0x25afde,_0x2ea0e3){var _0x6e7c6={};var _0xde9e8c={};var _0x4ecfef;var _0x32d36f;return db[_0x2b21('0x2e')]['findOne']({'where':{'id':_0x79f272[_0x2b21('0x45')]['id']}})[_0x2b21('0x23')](handleEntityNotFound(_0x25afde,null))['then'](function(_0x1f1ec1){if(_0x1f1ec1){_0x4ecfef=_0x1f1ec1;_0xde9e8c[_0x2b21('0x35')]=_[_0x2b21('0x31')](db[_0x2b21('0x5c')]['rawAttributes']);_0xde9e8c[_0x2b21('0x32')]=_[_0x2b21('0x31')](_0x79f272['query']);_0xde9e8c[_0x2b21('0x3a')]=_[_0x2b21('0x33')](_0xde9e8c['model'],_0xde9e8c[_0x2b21('0x32')]);_0x6e7c6['attributes']=_[_0x2b21('0x33')](_0xde9e8c['model'],qs[_0x2b21('0x36')](_0x79f272[_0x2b21('0x32')][_0x2b21('0x36')]));_0x6e7c6[_0x2b21('0x34')]=_0x6e7c6[_0x2b21('0x34')][_0x2b21('0x46')]?_0x6e7c6[_0x2b21('0x34')]:_0xde9e8c[_0x2b21('0x35')];_0x6e7c6['order']=qs[_0x2b21('0x39')](_0x79f272[_0x2b21('0x32')]['sort']);_0x6e7c6[_0x2b21('0x3c')]=qs['filters'](_[_0x2b21('0x58')](_0x79f272[_0x2b21('0x32')],_0xde9e8c[_0x2b21('0x3a')]));if(_0x79f272[_0x2b21('0x32')]['filter']){_0x6e7c6[_0x2b21('0x3c')]=_['merge'](_0x6e7c6[_0x2b21('0x3c')],{'$or':_['map'](_0x6e7c6[_0x2b21('0x34')],function(_0xdae6fd){var _0x49dce2={};_0x49dce2[_0xdae6fd]={'$like':'%'+_0x79f272['query'][_0x2b21('0x3b')]+'%'};return _0x49dce2;})});}_0x6e7c6=_[_0x2b21('0x3d')]({},_0x6e7c6,_0x79f272[_0x2b21('0x3f')]);return _0x4ecfef[_0x2b21('0x5d')](_0x6e7c6);}})[_0x2b21('0x23')](function(_0x2931ff){if(_0x2931ff){_0x32d36f=_0x2931ff[_0x2b21('0x46')];if(!_0x79f272[_0x2b21('0x32')][_0x2b21('0x37')](_0x2b21('0x56'))){_0x6e7c6[_0x2b21('0x1d')]=qs[_0x2b21('0x1d')](_0x79f272[_0x2b21('0x32')][_0x2b21('0x1d')]);_0x6e7c6[_0x2b21('0x1b')]=qs[_0x2b21('0x1b')](_0x79f272[_0x2b21('0x32')]['offset']);}return _0x4ecfef[_0x2b21('0x5d')](_0x6e7c6);}})[_0x2b21('0x23')](function(_0x3c131a){if(_0x3c131a){return _0x3c131a?{'count':_0x32d36f,'rows':_0x3c131a}:null;}})['then'](respondWithResult(_0x25afde,null))[_0x2b21('0x44')](handleError(_0x25afde,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 3533d5b..d1513d4 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 _0xde9d=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./trigger.attributes'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xde9d,0x156));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var moment=require(_0xdde9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdde9('0x5'));var fs=require('fs');var path=require(_0xdde9('0x6'));var rimraf=require(_0xdde9('0x7'));var config=require('../../config/environment');var attributes=require(_0xdde9('0x8'));module[_0xdde9('0x9')]=function(_0x1ea43e,_0x4c10e9){return _0x1ea43e[_0xdde9('0xa')](_0xdde9('0xb'),attributes,{'tableName':_0xdde9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1da6=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1da6,0x7c));var _0x61da=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x1da6[_0x446f11];return _0x385cb5;};'use strict';var _=require(_0x61da('0x0'));var util=require(_0x61da('0x1'));var logger=require(_0x61da('0x2'))(_0x61da('0x3'));var moment=require(_0x61da('0x4'));var BPromise=require(_0x61da('0x5'));var rp=require(_0x61da('0x6'));var fs=require('fs');var path=require(_0x61da('0x7'));var rimraf=require(_0x61da('0x8'));var config=require(_0x61da('0x9'));var attributes=require(_0x61da('0xa'));module[_0x61da('0xb')]=function(_0x16cd66,_0x2c40c6){return _0x16cd66[_0x61da('0xc')](_0x61da('0xd'),attributes,{'tableName':_0x61da('0xe'),'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 b677e21..7ccbaaa 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 _0x2484=['raw','where','attributes','limit','include','map','model','debug','GetTrigger','Trigger','ShowTrigger','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x2484,0xb0));var _0x4248=function(_0x34db7f,_0x3e22f8){_0x34db7f=_0x34db7f-0x0;var _0x509554=_0x2484[_0x34db7f];return _0x509554;};'use strict';var _=require('lodash');var util=require(_0x4248('0x0'));var moment=require(_0x4248('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4248('0x2'));var db=require(_0x4248('0x3'))['db'];var utils=require(_0x4248('0x4'));var logger=require(_0x4248('0x5'))(_0x4248('0x6'));var config=require('../../config/environment');var jayson=require(_0x4248('0x7'));var client=jayson[_0x4248('0x8')][_0x4248('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fc671,_0x689b3d,_0x3e3e1b){return new BPromise(function(_0x571d99,_0x1c4240){return client[_0x4248('0xa')](_0x1fc671,_0x3e3e1b)[_0x4248('0xb')](function(_0x466a70){logger[_0x4248('0xc')](_0x4248('0xd'),_0x689b3d,_0x4248('0xe'));logger['debug'](_0x4248('0xf'),_0x689b3d,_0x4248('0xe'),JSON[_0x4248('0x10')](_0x466a70));if(_0x466a70[_0x4248('0x11')]){if(_0x466a70[_0x4248('0x11')]['code']===0x1f4){logger[_0x4248('0x11')](_0x4248('0xd'),_0x689b3d,_0x466a70[_0x4248('0x11')]['message']);return _0x1c4240(_0x466a70['error'][_0x4248('0x12')]);}logger[_0x4248('0x11')](_0x4248('0xd'),_0x689b3d,_0x466a70[_0x4248('0x11')]['message']);return _0x571d99(_0x466a70[_0x4248('0x11')][_0x4248('0x12')]);}else{logger[_0x4248('0xc')]('Trigger,\x20%s,\x20%s',_0x689b3d,_0x4248('0xe'));_0x571d99(_0x466a70[_0x4248('0x13')][_0x4248('0x12')]);}})[_0x4248('0x14')](function(_0x1d1d35){logger[_0x4248('0x11')](_0x4248('0xd'),_0x689b3d,_0x1d1d35);_0x1c4240(_0x1d1d35);});});}exports['GetTrigger']=function(_0x154c07){var _0x2a2237=this;return new Promise(function(_0x579bf2,_0x5f1bc6){return db['Trigger']['findAll']({'raw':_0x154c07[_0x4248('0x15')]?_0x154c07[_0x4248('0x15')][_0x4248('0x16')]===undefined?!![]:![]:!![],'where':_0x154c07[_0x4248('0x15')]?_0x154c07[_0x4248('0x15')][_0x4248('0x17')]||null:null,'attributes':_0x154c07['options']?_0x154c07[_0x4248('0x15')][_0x4248('0x18')]||null:null,'limit':_0x154c07[_0x4248('0x15')]?_0x154c07[_0x4248('0x15')][_0x4248('0x19')]||null:null,'include':_0x154c07[_0x4248('0x15')]?_0x154c07[_0x4248('0x15')][_0x4248('0x1a')]?_[_0x4248('0x1b')](_0x154c07[_0x4248('0x15')][_0x4248('0x1a')],function(_0x33818f){return{'model':db[_0x33818f[_0x4248('0x1c')]],'as':_0x33818f['as'],'attributes':_0x33818f[_0x4248('0x18')],'include':_0x33818f[_0x4248('0x1a')]?_['map'](_0x33818f[_0x4248('0x1a')],function(_0x404e2b){return{'model':db[_0x404e2b[_0x4248('0x1c')]],'as':_0x404e2b['as'],'attributes':_0x404e2b[_0x4248('0x18')],'include':_0x404e2b[_0x4248('0x1a')]?_[_0x4248('0x1b')](_0x404e2b[_0x4248('0x1a')],function(_0x5d07aa){return{'model':db[_0x5d07aa['model']],'as':_0x5d07aa['as'],'attributes':_0x5d07aa['attributes']};}):[]};}):[]};}):[]:[]})[_0x4248('0xb')](function(_0x92f037){logger[_0x4248('0xc')]('GetTrigger',_0x154c07);logger[_0x4248('0x1d')](_0x4248('0x1e'),_0x154c07,JSON[_0x4248('0x10')](_0x92f037));_0x579bf2(_0x92f037);})[_0x4248('0x14')](function(_0x28bfd7){logger['error']('GetTrigger',_0x28bfd7[_0x4248('0x12')],_0x154c07);_0x5f1bc6(_0x2a2237['error'](0x1f4,_0x28bfd7[_0x4248('0x12')]));});});};exports['ShowTrigger']=function(_0xf3d90e){var _0xa53615=this;return new Promise(function(_0x2872f2,_0x2e75b4){return db[_0x4248('0x1f')]['find']({'raw':_0xf3d90e[_0x4248('0x15')]?_0xf3d90e[_0x4248('0x15')][_0x4248('0x16')]===undefined?!![]:![]:!![],'where':_0xf3d90e[_0x4248('0x15')]?_0xf3d90e[_0x4248('0x15')]['where']||null:null,'attributes':_0xf3d90e['options']?_0xf3d90e[_0x4248('0x15')][_0x4248('0x18')]||null:null,'include':_0xf3d90e['options']?_0xf3d90e[_0x4248('0x15')]['include']?_[_0x4248('0x1b')](_0xf3d90e[_0x4248('0x15')]['include'],function(_0x5b4bd2){return{'model':db[_0x5b4bd2[_0x4248('0x1c')]],'as':_0x5b4bd2['as'],'attributes':_0x5b4bd2[_0x4248('0x18')],'include':_0x5b4bd2[_0x4248('0x1a')]?_[_0x4248('0x1b')](_0x5b4bd2[_0x4248('0x1a')],function(_0x5a358b){return{'model':db[_0x5a358b[_0x4248('0x1c')]],'as':_0x5a358b['as'],'attributes':_0x5a358b[_0x4248('0x18')],'include':_0x5a358b[_0x4248('0x1a')]?_[_0x4248('0x1b')](_0x5a358b[_0x4248('0x1a')],function(_0x36fa29){return{'model':db[_0x36fa29['model']],'as':_0x36fa29['as'],'attributes':_0x36fa29[_0x4248('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4248('0xb')](function(_0x412fcc){logger[_0x4248('0xc')](_0x4248('0x20'),_0xf3d90e);logger[_0x4248('0x1d')](_0x4248('0x20'),_0xf3d90e,JSON[_0x4248('0x10')](_0x412fcc));_0x2872f2(_0x412fcc);})[_0x4248('0x14')](function(_0x539e8d){logger[_0x4248('0x11')]('ShowTrigger',_0x539e8d[_0x4248('0x12')],_0xf3d90e);_0x2e75b4(_0xa53615[_0x4248('0x11')](0x1f4,_0x539e8d[_0x4248('0x12')]));});});}; \ No newline at end of file +var _0x3117=['options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll'];(function(_0x398859,_0x53e02b){var _0x1d349d=function(_0x130565){while(--_0x130565){_0x398859['push'](_0x398859['shift']());}};_0x1d349d(++_0x53e02b);}(_0x3117,0x1af));var _0x7311=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x3117[_0xb3b452];return _0x238983;};'use strict';var _=require(_0x7311('0x0'));var util=require('util');var moment=require(_0x7311('0x1'));var BPromise=require('bluebird');var rs=require(_0x7311('0x2'));var fs=require('fs');var Redis=require(_0x7311('0x3'));var db=require(_0x7311('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7311('0x5'))(_0x7311('0x6'));var config=require('../../config/environment');var jayson=require(_0x7311('0x7'));var client=jayson['client'][_0x7311('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39dcf2,_0x4e788c,_0x48e726){return new BPromise(function(_0x4a15fb,_0x2f3f7c){return client[_0x7311('0x9')](_0x39dcf2,_0x48e726)[_0x7311('0xa')](function(_0x3e7dd2){logger[_0x7311('0xb')]('Trigger,\x20%s,\x20%s',_0x4e788c,_0x7311('0xc'));logger[_0x7311('0xd')](_0x7311('0xe'),_0x4e788c,_0x7311('0xc'),JSON[_0x7311('0xf')](_0x3e7dd2));if(_0x3e7dd2[_0x7311('0x10')]){if(_0x3e7dd2[_0x7311('0x10')][_0x7311('0x11')]===0x1f4){logger[_0x7311('0x10')](_0x7311('0x12'),_0x4e788c,_0x3e7dd2['error'][_0x7311('0x13')]);return _0x2f3f7c(_0x3e7dd2[_0x7311('0x10')][_0x7311('0x13')]);}logger[_0x7311('0x10')](_0x7311('0x12'),_0x4e788c,_0x3e7dd2[_0x7311('0x10')][_0x7311('0x13')]);return _0x4a15fb(_0x3e7dd2['error'][_0x7311('0x13')]);}else{logger[_0x7311('0xb')]('Trigger,\x20%s,\x20%s',_0x4e788c,_0x7311('0xc'));_0x4a15fb(_0x3e7dd2[_0x7311('0x14')][_0x7311('0x13')]);}})['catch'](function(_0x3001bc){logger[_0x7311('0x10')](_0x7311('0x12'),_0x4e788c,_0x3001bc);_0x2f3f7c(_0x3001bc);});});}exports[_0x7311('0x15')]=function(_0x1042c4){var _0x5a24fe=this;return new Promise(function(_0x2c2cff,_0x99b7){return db[_0x7311('0x16')][_0x7311('0x17')]({'raw':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x19')]===undefined?!![]:![]:!![],'where':_0x1042c4['options']?_0x1042c4[_0x7311('0x18')][_0x7311('0x1a')]||null:null,'attributes':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x1b')]||null:null,'limit':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x1c')]||null:null,'include':_0x1042c4[_0x7311('0x18')]?_0x1042c4[_0x7311('0x18')][_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x1042c4[_0x7311('0x18')][_0x7311('0x1d')],function(_0xf2cc8d){return{'model':db[_0xf2cc8d[_0x7311('0x1f')]],'as':_0xf2cc8d['as'],'attributes':_0xf2cc8d[_0x7311('0x1b')],'include':_0xf2cc8d[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0xf2cc8d[_0x7311('0x1d')],function(_0x2df9da){return{'model':db[_0x2df9da[_0x7311('0x1f')]],'as':_0x2df9da['as'],'attributes':_0x2df9da[_0x7311('0x1b')],'include':_0x2df9da[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x2df9da[_0x7311('0x1d')],function(_0xe2dcac){return{'model':db[_0xe2dcac[_0x7311('0x1f')]],'as':_0xe2dcac['as'],'attributes':_0xe2dcac[_0x7311('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7311('0xa')](function(_0x3148d7){logger[_0x7311('0xb')](_0x7311('0x15'),_0x1042c4);logger[_0x7311('0xd')]('GetTrigger',_0x1042c4,JSON[_0x7311('0xf')](_0x3148d7));_0x2c2cff(_0x3148d7);})['catch'](function(_0x336436){logger[_0x7311('0x10')](_0x7311('0x15'),_0x336436[_0x7311('0x13')],_0x1042c4);_0x99b7(_0x5a24fe[_0x7311('0x10')](0x1f4,_0x336436[_0x7311('0x13')]));});});};exports[_0x7311('0x20')]=function(_0x13c914){var _0x246504=this;return new Promise(function(_0x415830,_0x3867cf){return db[_0x7311('0x16')][_0x7311('0x21')]({'raw':_0x13c914[_0x7311('0x18')]?_0x13c914['options'][_0x7311('0x19')]===undefined?!![]:![]:!![],'where':_0x13c914['options']?_0x13c914[_0x7311('0x18')][_0x7311('0x1a')]||null:null,'attributes':_0x13c914[_0x7311('0x18')]?_0x13c914['options'][_0x7311('0x1b')]||null:null,'include':_0x13c914[_0x7311('0x18')]?_0x13c914['options'][_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x13c914[_0x7311('0x18')][_0x7311('0x1d')],function(_0x512340){return{'model':db[_0x512340[_0x7311('0x1f')]],'as':_0x512340['as'],'attributes':_0x512340[_0x7311('0x1b')],'include':_0x512340[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x512340[_0x7311('0x1d')],function(_0x15f889){return{'model':db[_0x15f889[_0x7311('0x1f')]],'as':_0x15f889['as'],'attributes':_0x15f889[_0x7311('0x1b')],'include':_0x15f889[_0x7311('0x1d')]?_[_0x7311('0x1e')](_0x15f889[_0x7311('0x1d')],function(_0xa4a8ef){return{'model':db[_0xa4a8ef[_0x7311('0x1f')]],'as':_0xa4a8ef['as'],'attributes':_0xa4a8ef[_0x7311('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7311('0xa')](function(_0x13b42b){logger[_0x7311('0xb')](_0x7311('0x20'),_0x13c914);logger[_0x7311('0xd')](_0x7311('0x20'),_0x13c914,JSON[_0x7311('0xf')](_0x13b42b));_0x415830(_0x13b42b);})[_0x7311('0x22')](function(_0x52c027){logger[_0x7311('0x10')](_0x7311('0x20'),_0x52c027[_0x7311('0x13')],_0x13c914);_0x3867cf(_0x246504[_0x7311('0x10')](0x1f4,_0x52c027[_0x7311('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 852d645..0b962de 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 _0x34f1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','clone','create','put','update','destroy','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x34f1,0xa1));var _0x134f=function(_0x2a52ad,_0x4fea99){_0x2a52ad=_0x2a52ad-0x0;var _0x35ef84=_0x34f1[_0x2a52ad];return _0x35ef84;};'use strict';var multer=require(_0x134f('0x0'));var util=require(_0x134f('0x1'));var path=require(_0x134f('0x2'));var timeout=require(_0x134f('0x3'));var express=require(_0x134f('0x4'));var router=express[_0x134f('0x5')]();var fs_extra=require(_0x134f('0x6'));var auth=require(_0x134f('0x7'));var interaction=require(_0x134f('0x8'));var config=require(_0x134f('0x9'));var controller=require(_0x134f('0xa'));router[_0x134f('0xb')]('/',auth[_0x134f('0xc')](),controller['index']);router[_0x134f('0xb')](_0x134f('0xd'),auth[_0x134f('0xc')](),controller[_0x134f('0xe')]);router[_0x134f('0xf')](_0x134f('0x10'),auth[_0x134f('0xc')](),controller[_0x134f('0x11')]);router[_0x134f('0xf')]('/',auth['isAuthenticated'](),controller[_0x134f('0x12')]);router[_0x134f('0x13')](_0x134f('0xd'),auth[_0x134f('0xc')](),controller[_0x134f('0x14')]);router['delete'](_0x134f('0xd'),auth[_0x134f('0xc')](),controller[_0x134f('0x15')]);module[_0x134f('0x16')]=router; \ No newline at end of file +var _0xb595=['../../components/auth/service','../../components/interaction/service','get','show','post','/:id/clone','isAuthenticated','/:id','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0xb595,0xca));var _0x5b59=function(_0x451231,_0x574bff){_0x451231=_0x451231-0x0;var _0x1b7821=_0xb595[_0x451231];return _0x1b7821;};'use strict';var multer=require(_0x5b59('0x0'));var util=require(_0x5b59('0x1'));var path=require(_0x5b59('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b59('0x3'));var router=express[_0x5b59('0x4')]();var fs_extra=require(_0x5b59('0x5'));var auth=require(_0x5b59('0x6'));var interaction=require(_0x5b59('0x7'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x5b59('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5b59('0x9')]);router[_0x5b59('0xa')](_0x5b59('0xb'),auth[_0x5b59('0xc')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5b59('0xd'),auth[_0x5b59('0xc')](),controller['update']);router[_0x5b59('0xe')]('/:id',auth[_0x5b59('0xc')](),controller[_0x5b59('0xf')]);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 4a43342..9ce9704 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 _0x3584=['outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','pai','fingerprint','certificate','active','actpass','dynamic','nonat','sequelize','exports','STRING','name','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update'];(function(_0x2a5de6,_0x78861c){var _0x74adcd=function(_0x263d29){while(--_0x263d29){_0x2a5de6['push'](_0x2a5de6['shift']());}};_0x74adcd(++_0x78861c);}(_0x3584,0x15e));var _0x4358=function(_0x4b855a,_0x55f24e){_0x4b855a=_0x4b855a-0x0;var _0x480e62=_0x3584[_0x4b855a];return _0x480e62;};'use strict';var Sequelize=require(_0x4358('0x0'));module[_0x4358('0x1')]={'name':{'type':Sequelize[_0x4358('0x2')],'allowNull':![],'unique':_0x4358('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4358('0x4')]('friend',_0x4358('0x5'),'peer'),'allowNull':![],'defaultValue':_0x4358('0x6')},'context':{'type':Sequelize[_0x4358('0x2')],'allowNull':![],'defaultValue':_0x4358('0x7')},'callingpres':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x8'),_0x4358('0x9'),_0x4358('0xa'),'ALLOWED',_0x4358('0xb'),_0x4358('0xc'),_0x4358('0xd'),_0x4358('0xe'))},'deny':{'type':Sequelize[_0x4358('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x4358('0x2')]},'md5secret':{'type':Sequelize[_0x4358('0x2')]},'remotesecret':{'type':Sequelize[_0x4358('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x4358('0xf'),'set':function(_0x392e12){this['setDataValue'](_0x4358('0x10'),_0x392e12?_0x392e12[_0x4358('0x11')](','):null);},'get':function(){return this[_0x4358('0x12')]('transport')?this[_0x4358('0x12')](_0x4358('0x10'))[_0x4358('0x13')](','):null;},'comment':_0x4358('0x14')},'dtmfmode':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x15'),_0x4358('0x16'),_0x4358('0x17'),_0x4358('0x18'),_0x4358('0x19')),'defaultValue':_0x4358('0x15')},'directmedia':{'type':Sequelize['ENUM'](_0x4358('0x1a'),'no','nonat',_0x4358('0x1b'),_0x4358('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4358('0x2')]},'directmediadeny':{'type':Sequelize[_0x4358('0x2')]},'nat':{'type':Sequelize[_0x4358('0x2')],'defaultValue':_0x4358('0x1d'),'set':function(_0x5cdf5b){this['setDataValue']('nat',_0x5cdf5b?_0x5cdf5b['join'](','):null);},'get':function(){return this[_0x4358('0x12')](_0x4358('0x1e'))?this['getDataValue'](_0x4358('0x1e'))[_0x4358('0x13')](','):null;},'comment':_0x4358('0x1f')},'callgroup':{'type':Sequelize[_0x4358('0x2')]},'namedcallgroup':{'type':Sequelize[_0x4358('0x2')]},'pickupgroup':{'type':Sequelize[_0x4358('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x4358('0x2')]},'language':{'type':Sequelize[_0x4358('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4358('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x4358('0x20')},'allow':{'type':Sequelize[_0x4358('0x2')],'allowNull':![],'defaultValue':_0x4358('0x21'),'set':function(_0x4f76bd){this['setDataValue'](_0x4358('0x22'),_0x4f76bd?_0x4f76bd['join'](';'):_0x4358('0x21'));},'get':function(){return this['getDataValue'](_0x4358('0x22'))?this[_0x4358('0x12')](_0x4358('0x22'))[_0x4358('0x13')](';'):null;},'comment':_0x4358('0x23')},'autoframing':{'type':Sequelize[_0x4358('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x4358('0x2')],'defaultValue':_0x4358('0x24'),'set':function(_0x11a4b8){this[_0x4358('0x25')](_0x4358('0x26'),_0x11a4b8?_0x11a4b8[_0x4358('0x11')](','):null);},'get':function(){return this[_0x4358('0x12')]('insecure')?this[_0x4358('0x12')](_0x4358('0x26'))[_0x4358('0x13')](','):null;},'comment':_0x4358('0x27')},'trustrpid':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x4358('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4358('0x4')]('yes','no',_0x4358('0x28'))},'promiscredir':{'type':Sequelize[_0x4358('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x4358('0x29')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4358('0x2')],'defaultValue':_0x4358('0x2a')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x4358('0x4')]('yes','no'),'defaultValue':_0x4358('0x1a')},'busylevel':{'type':Sequelize[_0x4358('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x4358('0x2')]},'videosupport':{'type':Sequelize[_0x4358('0x4')]('yes','no',_0x4358('0x2b')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4358('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x4358('0x2')]},'session_timers':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x2c'),_0x4358('0x2d'),'originate')},'session_expires':{'type':Sequelize[_0x4358('0x29')](0xb)},'session_minse':{'type':Sequelize[_0x4358('0x29')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x4358('0x2e')),'defaultValue':_0x4358('0x2e')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x4358('0x2')]},'fromdomain':{'type':Sequelize[_0x4358('0x2')]},'fromuser':{'type':Sequelize[_0x4358('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no'),'defaultValue':_0x4358('0x1a')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x4358('0x2')]},'defaultuser':{'type':Sequelize[_0x4358('0x2')]},'rtptimeout':{'type':Sequelize[_0x4358('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4358('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no',_0x4358('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4358('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4358('0x29')](0xb)},'timerb':{'type':Sequelize[_0x4358('0x29')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x4358('0x2')]},'contactdeny':{'type':Sequelize[_0x4358('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x4358('0x2')]},'use_q850_reason':{'type':Sequelize[_0x4358('0x2')]},'maxforwards':{'type':Sequelize[_0x4358('0x29')](0xb)},'encryption':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4358('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x4358('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no',_0x4358('0x30'),_0x4358('0x31'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x4358('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x4358('0x2')]},'dtlscipher':{'type':Sequelize[_0x4358('0x2')]},'dtlscafile':{'type':Sequelize[_0x4358('0x2')]},'dtlscapath':{'type':Sequelize[_0x4358('0x2')]},'dtlssetup':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x32'),'passive',_0x4358('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4358('0x2')]},'usereqphone':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x4358('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4358('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x4358('0x4')](_0x4358('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x4358('0x2')]},'mohinterpret':{'type':Sequelize[_0x4358('0x2')]},'mohsuggest':{'type':Sequelize[_0x4358('0x2')]},'parkinglot':{'type':Sequelize[_0x4358('0x2')]},'description':{'type':Sequelize[_0x4358('0x2')]},'host':{'type':Sequelize[_0x4358('0x2')],'defaultValue':_0x4358('0x34')},'canreinvite':{'type':Sequelize['ENUM'](_0x4358('0x1a'),'no',_0x4358('0x35'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4358('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4358('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7587=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','force_rport,comedia','nat','ulaw;alaw;gsm','join','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','accept','refuse','originate','uac','uas','pai','fingerprint','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','user','peer','friend','STRING','from-voip-provider'];(function(_0x15cbdb,_0x350048){var _0x71bb55=function(_0x16622c){while(--_0x16622c){_0x15cbdb['push'](_0x15cbdb['shift']());}};_0x71bb55(++_0x350048);}(_0x7587,0xc3));var _0x7758=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7587[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x7758('0x0'));module[_0x7758('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7758('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7758('0x3')]('friend',_0x7758('0x4'),_0x7758('0x5')),'allowNull':![],'defaultValue':_0x7758('0x6')},'context':{'type':Sequelize[_0x7758('0x7')],'allowNull':![],'defaultValue':_0x7758('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0x7758('0x9'),_0x7758('0xa'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x7758('0xb'),_0x7758('0xc'),_0x7758('0xd'))},'deny':{'type':Sequelize[_0x7758('0x7')]},'permit':{'type':Sequelize[_0x7758('0x7')]},'secret':{'type':Sequelize[_0x7758('0x7')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x7758('0x7')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x2ac33a){this[_0x7758('0xe')]('transport',_0x2ac33a?_0x2ac33a['join'](','):null);},'get':function(){return this['getDataValue'](_0x7758('0xf'))?this[_0x7758('0x10')](_0x7758('0xf'))[_0x7758('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x12'),_0x7758('0x13'),_0x7758('0x14'),_0x7758('0x15'),_0x7758('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7758('0x3')]('yes','no','nonat',_0x7758('0x17'),_0x7758('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7758('0x7')]},'directmediadeny':{'type':Sequelize[_0x7758('0x7')]},'nat':{'type':Sequelize[_0x7758('0x7')],'defaultValue':_0x7758('0x1a'),'set':function(_0x53842a){this[_0x7758('0xe')](_0x7758('0x1b'),_0x53842a?_0x53842a['join'](','):null);},'get':function(){return this['getDataValue'](_0x7758('0x1b'))?this[_0x7758('0x10')](_0x7758('0x1b'))[_0x7758('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x7758('0x7')]},'pickupgroup':{'type':Sequelize[_0x7758('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x7758('0x7')]},'language':{'type':Sequelize[_0x7758('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7758('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x7758('0x7')],'allowNull':![],'defaultValue':_0x7758('0x1c'),'set':function(_0x3ec965){this['setDataValue']('allow',_0x3ec965?_0x3ec965[_0x7758('0x1d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7758('0x10')](_0x7758('0x1e'))?this[_0x7758('0x10')]('allow')[_0x7758('0x11')](';'):null;},'comment':_0x7758('0x1f')},'autoframing':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'insecure':{'type':Sequelize[_0x7758('0x7')],'defaultValue':'port,invite','set':function(_0x5b54e0){this[_0x7758('0xe')](_0x7758('0x20'),_0x5b54e0?_0x5b54e0[_0x7758('0x1d')](','):null);},'get':function(){return this[_0x7758('0x10')]('insecure')?this[_0x7758('0x10')](_0x7758('0x20'))[_0x7758('0x11')](','):null;},'comment':_0x7758('0x21')},'trustrpid':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x22'))},'promiscredir':{'type':Sequelize[_0x7758('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x7758('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x7758('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7758('0x7')],'defaultValue':_0x7758('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7758('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x7758('0x7')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no')},'mailbox':{'type':Sequelize[_0x7758('0x7')]},'session_timers':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x26'),_0x7758('0x27'),_0x7758('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x29'),_0x7758('0x2a')),'defaultValue':_0x7758('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x7758('0x7')]},'regexten':{'type':Sequelize[_0x7758('0x7')]},'fromdomain':{'type':Sequelize[_0x7758('0x7')]},'fromuser':{'type':Sequelize[_0x7758('0x7')]},'port':{'type':Sequelize[_0x7758('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no'),'defaultValue':_0x7758('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7758('0x7')]},'defaultuser':{'type':Sequelize[_0x7758('0x7')]},'rtptimeout':{'type':Sequelize[_0x7758('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7758('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7758('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7758('0x7')]},'timert1':{'type':Sequelize[_0x7758('0x23')](0xb)},'timerb':{'type':Sequelize[_0x7758('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7758('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x7758('0x7')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7758('0x7')]},'unsolicited_mailbox':{'type':Sequelize[_0x7758('0x7')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7758('0x23')](0xb)},'encryption':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'force_avp':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x7758('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x7758('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no',_0x7758('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x7758('0x7')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x7758('0x7')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7758('0x7')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x7758('0x2d'),_0x7758('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7758('0x7')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7758('0x7')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x7758('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x7758('0x3')](_0x7758('0x19'),'no')},'vmexten':{'type':Sequelize[_0x7758('0x7')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x7758('0x7')]},'parkinglot':{'type':Sequelize[_0x7758('0x7')]},'description':{'type':Sequelize[_0x7758('0x7')]},'host':{'type':Sequelize[_0x7758('0x7')],'defaultValue':_0x7758('0x2f')},'canreinvite':{'type':Sequelize[_0x7758('0x3')]('yes','no',_0x7758('0x30'),_0x7758('0x17'),_0x7758('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7758('0x7')]},'otherFields':{'type':Sequelize[_0x7758('0x7')]},'active':{'type':Sequelize[_0x7758('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7758('0x7')],'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 126a15b..64c79e8 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 _0xf2ca=['omit','createdAt','body','updatedAt','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','get','Trunks','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','Trunk','find','clone'];(function(_0x37fb19,_0x156fc7){var _0xe22027=function(_0x1538fd){while(--_0x1538fd){_0x37fb19['push'](_0x37fb19['shift']());}};_0xe22027(++_0x156fc7);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0xf2ca[_0x557f5f];return _0x196eba;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];var jayson=require(_0xaf2c('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15ccb4,_0x8eaf9b,_0x935959,_0x18a8a5){return new BPromise(function(_0x293ca6,_0x152c73){var _0x214f47=_0x18a8a5||client;return _0x214f47[_0xaf2c('0x19')](_0x15ccb4,_0x935959)[_0xaf2c('0x1a')](function(_0x1d0633){logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,_0xaf2c('0x1d'));logger[_0xaf2c('0x1e')](_0xaf2c('0x1f'),_0x8eaf9b,'request\x20sent',JSON[_0xaf2c('0x20')](_0x1d0633));if(_0x1d0633['error']){if(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x22')]===0x1f4){logger[_0xaf2c('0x21')]('Trunk,\x20%s,\x20%s',_0x8eaf9b,_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);return _0x152c73(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}logger[_0xaf2c('0x21')](_0xaf2c('0x1c'),_0x8eaf9b,_0x1d0633['error'][_0xaf2c('0x23')]);return _0x293ca6(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}else{logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,'request\x20sent');_0x293ca6(_0x1d0633[_0xaf2c('0x24')][_0xaf2c('0x23')]);}})[_0xaf2c('0x25')](function(_0x4be6ed){logger['error'](_0xaf2c('0x1c'),_0x8eaf9b,_0x4be6ed);_0x152c73(_0x4be6ed);});});}function respondWithStatusCode(_0x303546,_0x1cafad){_0x1cafad=_0x1cafad||0xcc;return function(_0x99f78d){if(_0x99f78d){return _0x303546['sendStatus'](_0x1cafad);}return _0x303546[_0xaf2c('0x26')](_0x1cafad)[_0xaf2c('0x27')]();};}function respondWithResult(_0x3a0145,_0x3c1ae6){_0x3c1ae6=_0x3c1ae6||0xc8;return function(_0xe929b5){if(_0xe929b5){return _0x3a0145[_0xaf2c('0x26')](_0x3c1ae6)[_0xaf2c('0x28')](_0xe929b5);}};}function respondWithFilteredResult(_0x4a8dd8,_0x29f8b0){return function(_0x2051be){if(_0x2051be){var _0x36f37c=typeof _0x29f8b0[_0xaf2c('0x29')]==='undefined'&&typeof _0x29f8b0[_0xaf2c('0x2a')]==='undefined';var _0x38db1b=_0x2051be[_0xaf2c('0x2b')];var _0x15466b=_0x36f37c?0x0:_0x29f8b0['offset'];var _0x2747bb=_0x36f37c?_0x2051be[_0xaf2c('0x2b')]:_0x29f8b0[_0xaf2c('0x29')]+_0x29f8b0['limit'];var _0xe18ba7;if(_0x2747bb>=_0x38db1b){_0x2747bb=_0x38db1b;_0xe18ba7=0xc8;}else{_0xe18ba7=0xce;}_0x4a8dd8[_0xaf2c('0x26')](_0xe18ba7);return _0x4a8dd8[_0xaf2c('0x2c')](_0xaf2c('0x2d'),_0x15466b+'-'+_0x2747bb+'/'+_0x38db1b)['json'](_0x2051be);}return null;};}function patchUpdates(_0x3da072){return function(_0x4072ff){try{jsonpatch[_0xaf2c('0x2e')](_0x4072ff,_0x3da072,!![]);}catch(_0x51a49c){return BPromise['reject'](_0x51a49c);}return _0x4072ff[_0xaf2c('0x2f')]();};}function saveUpdates(_0x4c9b4f,_0x39c0ed){return function(_0x5e7247){if(_0x5e7247){return _0x5e7247[_0xaf2c('0x30')](_0x4c9b4f)[_0xaf2c('0x1a')](function(_0x4ffbb9){return _0x4ffbb9;});}return null;};}function removeEntity(_0x1408e3,_0x5403f8){return function(_0x54db57){if(_0x54db57){return _0x54db57[_0xaf2c('0x31')]()[_0xaf2c('0x1a')](function(){var _0x211a69=_0x54db57[_0xaf2c('0x32')]({'plain':!![]});var _0x2d6ed7=_0xaf2c('0x33');return db['UserProfileResource'][_0xaf2c('0x31')]({'where':{'type':_0x2d6ed7,'resourceId':_0x211a69['id']}})['then'](function(){return _0x54db57;});})[_0xaf2c('0x1a')](function(){_0x1408e3['status'](0xcc)[_0xaf2c('0x27')]();});}};}function handleEntityNotFound(_0x59f686,_0x2f3d16){return function(_0x4e877e){if(!_0x4e877e){_0x59f686[_0xaf2c('0x34')](0x194);}return _0x4e877e;};}function handleError(_0x4b9c6b,_0x30fd87){_0x30fd87=_0x30fd87||0x1f4;return function(_0x356402){logger[_0xaf2c('0x21')](_0x356402[_0xaf2c('0x35')]);if(_0x356402[_0xaf2c('0x36')]){delete _0x356402['name'];}_0x4b9c6b['status'](_0x30fd87)[_0xaf2c('0x37')](_0x356402);};}exports[_0xaf2c('0x38')]=function(_0x409700,_0xa44813){var _0x4eeecf={},_0x316238={},_0x573db3={'count':0x0,'rows':[]};var _0xa1248e=_[_0xaf2c('0x39')](db['Trunk'][_0xaf2c('0x3a')],function(_0x24668d){return{'name':_0x24668d[_0xaf2c('0x3b')],'type':_0x24668d[_0xaf2c('0x3c')][_0xaf2c('0x3d')]};});_0x316238[_0xaf2c('0x3e')]=_[_0xaf2c('0x39')](_0xa1248e,_0xaf2c('0x36'));_0x316238[_0xaf2c('0x3f')]=_[_0xaf2c('0x40')](_0x409700[_0xaf2c('0x3f')]);_0x316238[_0xaf2c('0x41')]=_[_0xaf2c('0x42')](_0x316238['model'],_0x316238['query']);_0x4eeecf['attributes']=_[_0xaf2c('0x42')](_0x316238[_0xaf2c('0x3e')],qs[_0xaf2c('0x43')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x4eeecf[_0xaf2c('0x44')]=_0x4eeecf['attributes'][_0xaf2c('0x45')]?_0x4eeecf[_0xaf2c('0x44')]:_0x316238[_0xaf2c('0x3e')];if(!_0x409700['query']['hasOwnProperty'](_0xaf2c('0x46'))){_0x4eeecf['limit']=qs[_0xaf2c('0x2a')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x2a')]);_0x4eeecf[_0xaf2c('0x29')]=qs['offset'](_0x409700[_0xaf2c('0x3f')]['offset']);}_0x4eeecf[_0xaf2c('0x47')]=qs[_0xaf2c('0x48')](_0x409700['query'][_0xaf2c('0x48')]);_0x4eeecf['where']=qs[_0xaf2c('0x41')](_[_0xaf2c('0x49')](_0x409700[_0xaf2c('0x3f')],_0x316238[_0xaf2c('0x41')]),_0xa1248e);if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]){_0x4eeecf[_0xaf2c('0x4b')]=_[_0xaf2c('0x4c')](_0x4eeecf[_0xaf2c('0x4b')],{'$or':_['map'](_0xa1248e,function(_0x51d751){if(_0x51d751[_0xaf2c('0x3c')]!=='VIRTUAL'){var _0x4ad36e={};_0x4ad36e[_0x51d751['name']]={'$like':'%'+_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]+'%'};return _0x4ad36e;}})});}_0x4eeecf=_[_0xaf2c('0x4c')]({},_0x4eeecf,_0x409700[_0xaf2c('0x4d')]);var _0x599b2d={'where':_0x4eeecf[_0xaf2c('0x4b')]};return db['Trunk'][_0xaf2c('0x2b')](_0x599b2d)['then'](function(_0x166c26){_0x573db3[_0xaf2c('0x2b')]=_0x166c26;if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x4eeecf[_0xaf2c('0x4f')]=[{'all':!![]}];}return db['Trunk'][_0xaf2c('0x50')](_0x4eeecf);})[_0xaf2c('0x1a')](function(_0x4b3ca4){_0x573db3['rows']=_0x4b3ca4;return _0x573db3;})[_0xaf2c('0x1a')](respondWithFilteredResult(_0xa44813,_0x4eeecf))['catch'](handleError(_0xa44813,null));};exports[_0xaf2c('0x51')]=function(_0x23642b,_0x17b9ec){var _0x315b9f={'raw':![],'where':{'id':_0x23642b[_0xaf2c('0x52')]['id']}},_0x367112={};_0x367112[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x367112[_0xaf2c('0x3f')]=_['keys'](_0x23642b[_0xaf2c('0x3f')]);_0x367112[_0xaf2c('0x41')]=_['intersection'](_0x367112['model'],_0x367112['query']);_0x315b9f[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x367112['model'],qs[_0xaf2c('0x43')](_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x315b9f[_0xaf2c('0x44')]=_0x315b9f[_0xaf2c('0x44')][_0xaf2c('0x45')]?_0x315b9f[_0xaf2c('0x44')]:_0x367112['model'];if(_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x315b9f['include']=[{'all':!![]}];}_0x315b9f=_[_0xaf2c('0x4c')]({},_0x315b9f,_0x23642b[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x315b9f)[_0xaf2c('0x1a')](handleEntityNotFound(_0x17b9ec,null))[_0xaf2c('0x1a')](respondWithResult(_0x17b9ec,null))[_0xaf2c('0x25')](handleError(_0x17b9ec,null));};exports[_0xaf2c('0x55')]=function(_0x19b82d,_0x300254){var _0x133678={'where':{'id':_0x19b82d[_0xaf2c('0x52')]['id']}},_0x10a270={};_0x10a270[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x133678[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x10a270[_0xaf2c('0x3e')],qs['fields'](_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x133678[_0xaf2c('0x44')]=_0x133678['attributes'][_0xaf2c('0x45')]?_0x133678['attributes']:_0x10a270[_0xaf2c('0x3e')];if(_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x133678[_0xaf2c('0x4f')]=[{'all':!![]}];}_0x133678=_[_0xaf2c('0x4c')]({},_0x133678,_0x19b82d[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x133678)[_0xaf2c('0x1a')](handleEntityNotFound(_0x300254,null))['then'](function(_0x41d08b){if(_0x41d08b){var _0x400dcd=_0x41d08b[_0xaf2c('0x32')]({'plain':!![]});_0x400dcd=qs[_0xaf2c('0x56')](_0x400dcd,['id',_0xaf2c('0x57'),'updatedAt']);_0x19b82d[_0xaf2c('0x58')]=_[_0xaf2c('0x56')](_0x19b82d['body'],['id',_0xaf2c('0x57'),_0xaf2c('0x59')]);return db['Trunk']['create'](_[_0xaf2c('0x4c')](_0x400dcd,_0x19b82d[_0xaf2c('0x58')]),{'include':_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x36b6f0){var _0x3f48f1=_0x19b82d['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3f48f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f48f1[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x16e9f4=_0x36b6f0[_0xaf2c('0x32')]({'plain':!![]});var _0x1a297e=_0xaf2c('0x33');return db[_0xaf2c('0x5c')][_0xaf2c('0x54')]({'where':{'name':_0x1a297e,'userProfileId':_0x3f48f1[_0xaf2c('0x5d')]},'raw':!![]})[_0xaf2c('0x1a')](function(_0x53ba41){if(_0x53ba41&&_0x53ba41[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')][_0xaf2c('0x60')]({'name':_0x16e9f4[_0xaf2c('0x36')],'resourceId':_0x16e9f4['id'],'type':_0x53ba41[_0xaf2c('0x36')],'sectionId':_0x53ba41['id']},{})['then'](function(){return _0x36b6f0;});}else{return _0x36b6f0;}})[_0xaf2c('0x25')](function(_0x28b09f){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x28b09f);throw _0x28b09f;});}return _0x36b6f0;});}})[_0xaf2c('0x1a')](respondWithResult(_0x300254,0xc9))['catch'](handleError(_0x300254,null));};exports['create']=function(_0x1166c9,_0x1ead61,_0x5849f8){var _0xf96361;return db[_0xaf2c('0x53')][_0xaf2c('0x60')](_0x1166c9['body'],{'raw':!![]})[_0xaf2c('0x1a')](function(_0x2bd845){_0xf96361=_0x2bd845;return db[_0xaf2c('0x53')][_0xaf2c('0x50')]({'raw':!![]});})['then'](function(_0x32d552){var _0x26129c=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2767c7=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x5d965c=ejs[_0xaf2c('0x67')](_0x26129c,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5d965c);if(_0xf96361[_0xaf2c('0x69')]){var _0x5a95ac=ejs['render'](_0x2767c7,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6a'),_0x5a95ac);}})[_0xaf2c('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xaf2c('0x1a')](function(){var _0x3e972c=_0x1166c9['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3e972c)throw new Error(_0xaf2c('0x6b'));if(_0x3e972c[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x6e1837=_0xf96361[_0xaf2c('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xaf2c('0x54')]({'where':{'name':_0xaf2c('0x33'),'userProfileId':_0x3e972c[_0xaf2c('0x5d')]},'raw':!![]})['then'](function(_0xc9dd21){if(_0xc9dd21&&_0xc9dd21[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')]['create']({'name':_0x6e1837[_0xaf2c('0x36')],'resourceId':_0x6e1837['id'],'type':_0xc9dd21[_0xaf2c('0x36')],'sectionId':_0xc9dd21['id']},{})[_0xaf2c('0x1a')](function(){return _0xf96361;});}else{return _0xf96361;}})[_0xaf2c('0x25')](function(_0x491160){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x491160);throw _0x491160;});}return _0xf96361;})[_0xaf2c('0x1a')](respondWithResult(_0x1ead61,0xc9))['catch'](handleError(_0x1ead61,null));};exports['update']=function(_0x427ece,_0x1b7dc1,_0x5571eb){var _0x3675d9;return db[_0xaf2c('0x53')]['find']({'where':{'id':_0x427ece[_0xaf2c('0x52')]['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1b7dc1,null))[_0xaf2c('0x1a')](saveUpdates(_0x427ece[_0xaf2c('0x58')],null))[_0xaf2c('0x1a')](function(_0x4af252){if(_0x4af252){_0x3675d9=_0x4af252;return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});}})[_0xaf2c('0x1a')](function(_0x55b568){if(_0x55b568){var _0x4f378e=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x4b9fdc=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x6c')),_0xaf2c('0x66'));var _0x41c707=ejs['render'](_0x4f378e,{'trunks':_0x55b568||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x41c707);var _0x483774=ejs['render'](_0x4b9fdc,{'trunks':_0x55b568||[]});fs['writeFileSync'](_0xaf2c('0x6a'),_0x483774);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x30'),{'module':_0xaf2c('0x6f')});}return null;})['then'](function(_0x19fbd5){if(_0x19fbd5){return _0x3675d9;}})[_0xaf2c('0x1a')](respondWithResult(_0x1b7dc1,null))[_0xaf2c('0x25')](handleError(_0x1b7dc1,null));};exports[_0xaf2c('0x31')]=function(_0x4ddf95,_0x1e8fc0,_0x23aeac){var _0x41590;return db[_0xaf2c('0x53')][_0xaf2c('0x54')]({'where':{'id':_0x4ddf95['params']['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1e8fc0,null))[_0xaf2c('0x1a')](removeEntity(_0x1e8fc0,null))['then'](function(){return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});})[_0xaf2c('0x1a')](function(_0x5bce65){var _0x1e6a12=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2a3cb4=fs[_0xaf2c('0x62')](path['join'](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x7724cc=ejs['render'](_0x1e6a12,{'trunks':_0x5bce65});var _0x4a9ea8=ejs[_0xaf2c('0x67')](_0x2a3cb4,{'trunks':_0x5bce65});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x7724cc);fs['writeFileSync'](_0xaf2c('0x6a'),_0x4a9ea8);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x1e8fc0,null));}; \ No newline at end of file +var _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','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','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0x55e9e9,_0x1afc74){var _0x39cb0c=function(_0x4c02f3){while(--_0x4c02f3){_0x55e9e9['push'](_0x55e9e9['shift']());}};_0x39cb0c(++_0x1afc74);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index efcb7c5..df17255 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 _0x2348=['rimraf','exports','Trunk','tools_trunks','lodash','api','bluebird','request-promise','path'];(function(_0x59e82c,_0x2ca8f6){var _0x5ce2e0=function(_0x592281){while(--_0x592281){_0x59e82c['push'](_0x59e82c['shift']());}};_0x5ce2e0(++_0x2ca8f6);}(_0x2348,0x136));var _0x8234=function(_0x4cab1e,_0xfc5cde){_0x4cab1e=_0x4cab1e-0x0;var _0x1a8cd8=_0x2348[_0x4cab1e];return _0x1a8cd8;};'use strict';var _=require(_0x8234('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8234('0x1'));var moment=require('moment');var BPromise=require(_0x8234('0x2'));var rp=require(_0x8234('0x3'));var fs=require('fs');var path=require(_0x8234('0x4'));var rimraf=require(_0x8234('0x5'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0x8234('0x6')]=function(_0x14955d,_0x3f0ea1){return _0x14955d['define'](_0x8234('0x7'),attributes,{'tableName':_0x8234('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb247=['exports','define','Trunk','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb247,0x1cb));var _0x7b24=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xb247[_0x469ac7];return _0x22f3b0;};'use strict';var _=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var logger=require(_0x7b24('0x2'))(_0x7b24('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7b24('0x4'));var fs=require('fs');var path=require(_0x7b24('0x5'));var rimraf=require(_0x7b24('0x6'));var config=require(_0x7b24('0x7'));var attributes=require(_0x7b24('0x8'));module[_0x7b24('0x9')]=function(_0x17c892,_0x3dd321){return _0x17c892[_0x7b24('0xa')](_0x7b24('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 7dc595e..d27a9a5 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 _0xde6c=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowTrunk','Trunk','find','lodash'];(function(_0x51b078,_0x59fba5){var _0x5637f4=function(_0x81f812){while(--_0x81f812){_0x51b078['push'](_0x51b078['shift']());}};_0x5637f4(++_0x59fba5);}(_0xde6c,0xd1));var _0xcde6=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0xde6c[_0x163977];return _0x28bf3a;};'use strict';var _=require(_0xcde6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcde6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcde6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcde6('0x3'));var logger=require(_0xcde6('0x4'))(_0xcde6('0x5'));var config=require(_0xcde6('0x6'));var jayson=require(_0xcde6('0x7'));var client=jayson[_0xcde6('0x8')][_0xcde6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb685f8,_0x3efb09,_0x3bc81b){return new BPromise(function(_0x82a570,_0x5bdf81){return client[_0xcde6('0xa')](_0xb685f8,_0x3bc81b)['then'](function(_0x147e13){logger[_0xcde6('0xb')](_0xcde6('0xc'),_0x3efb09,_0xcde6('0xd'));logger[_0xcde6('0xe')](_0xcde6('0xf'),_0x3efb09,_0xcde6('0xd'),JSON['stringify'](_0x147e13));if(_0x147e13[_0xcde6('0x10')]){if(_0x147e13[_0xcde6('0x10')][_0xcde6('0x11')]===0x1f4){logger['error'](_0xcde6('0xc'),_0x3efb09,_0x147e13[_0xcde6('0x10')][_0xcde6('0x12')]);return _0x5bdf81(_0x147e13[_0xcde6('0x10')][_0xcde6('0x12')]);}logger[_0xcde6('0x10')](_0xcde6('0xc'),_0x3efb09,_0x147e13[_0xcde6('0x10')][_0xcde6('0x12')]);return _0x82a570(_0x147e13[_0xcde6('0x10')][_0xcde6('0x12')]);}else{logger['info'](_0xcde6('0xc'),_0x3efb09,'request\x20sent');_0x82a570(_0x147e13[_0xcde6('0x13')][_0xcde6('0x12')]);}})[_0xcde6('0x14')](function(_0x2ff7eb){logger[_0xcde6('0x10')]('Trunk,\x20%s,\x20%s',_0x3efb09,_0x2ff7eb);_0x5bdf81(_0x2ff7eb);});});}exports[_0xcde6('0x15')]=function(_0x3cb203){var _0x340dc8=this;return new Promise(function(_0x118adf,_0x515252){return db['Trunk'][_0xcde6('0x16')]({'raw':_0x3cb203[_0xcde6('0x17')]?_0x3cb203['options'][_0xcde6('0x18')]===undefined?!![]:![]:!![],'where':_0x3cb203[_0xcde6('0x17')]?_0x3cb203['options'][_0xcde6('0x19')]||null:null,'attributes':_0x3cb203[_0xcde6('0x17')]?_0x3cb203[_0xcde6('0x17')][_0xcde6('0x1a')]||null:null,'limit':_0x3cb203[_0xcde6('0x17')]?_0x3cb203['options'][_0xcde6('0x1b')]||null:null,'include':_0x3cb203[_0xcde6('0x17')]?_0x3cb203['options'][_0xcde6('0x1c')]?_[_0xcde6('0x1d')](_0x3cb203['options']['include'],function(_0x1db2b6){return{'model':db[_0x1db2b6[_0xcde6('0x1e')]],'as':_0x1db2b6['as'],'attributes':_0x1db2b6[_0xcde6('0x1a')],'include':_0x1db2b6[_0xcde6('0x1c')]?_[_0xcde6('0x1d')](_0x1db2b6[_0xcde6('0x1c')],function(_0x3423ee){return{'model':db[_0x3423ee[_0xcde6('0x1e')]],'as':_0x3423ee['as'],'attributes':_0x3423ee['attributes'],'include':_0x3423ee[_0xcde6('0x1c')]?_[_0xcde6('0x1d')](_0x3423ee['include'],function(_0x67fd75){return{'model':db[_0x67fd75[_0xcde6('0x1e')]],'as':_0x67fd75['as'],'attributes':_0x67fd75[_0xcde6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcde6('0x1f')](function(_0x4c33e0){logger[_0xcde6('0xb')](_0xcde6('0x15'),_0x3cb203);logger['debug']('GetTrunk',_0x3cb203,JSON['stringify'](_0x4c33e0));_0x118adf(_0x4c33e0);})[_0xcde6('0x14')](function(_0x5b3c65){logger[_0xcde6('0x10')](_0xcde6('0x15'),_0x5b3c65[_0xcde6('0x12')],_0x3cb203);_0x515252(_0x340dc8[_0xcde6('0x10')](0x1f4,_0x5b3c65[_0xcde6('0x12')]));});});};exports[_0xcde6('0x20')]=function(_0x2cb792){var _0x17553a=this;return new Promise(function(_0x237747,_0x537b13){return db[_0xcde6('0x21')][_0xcde6('0x22')]({'raw':_0x2cb792['options']?_0x2cb792[_0xcde6('0x17')][_0xcde6('0x18')]===undefined?!![]:![]:!![],'where':_0x2cb792['options']?_0x2cb792['options']['where']||null:null,'attributes':_0x2cb792[_0xcde6('0x17')]?_0x2cb792[_0xcde6('0x17')]['attributes']||null:null,'include':_0x2cb792[_0xcde6('0x17')]?_0x2cb792[_0xcde6('0x17')][_0xcde6('0x1c')]?_[_0xcde6('0x1d')](_0x2cb792['options'][_0xcde6('0x1c')],function(_0x4d7910){return{'model':db[_0x4d7910['model']],'as':_0x4d7910['as'],'attributes':_0x4d7910[_0xcde6('0x1a')],'include':_0x4d7910[_0xcde6('0x1c')]?_['map'](_0x4d7910[_0xcde6('0x1c')],function(_0x207507){return{'model':db[_0x207507['model']],'as':_0x207507['as'],'attributes':_0x207507[_0xcde6('0x1a')],'include':_0x207507[_0xcde6('0x1c')]?_[_0xcde6('0x1d')](_0x207507[_0xcde6('0x1c')],function(_0x4ce67a){return{'model':db[_0x4ce67a['model']],'as':_0x4ce67a['as'],'attributes':_0x4ce67a[_0xcde6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcde6('0x1f')](function(_0x2e0a56){logger[_0xcde6('0xb')](_0xcde6('0x20'),_0x2cb792);logger[_0xcde6('0xe')](_0xcde6('0x20'),_0x2cb792,JSON['stringify'](_0x2e0a56));_0x237747(_0x2e0a56);})['catch'](function(_0x24aed8){logger[_0xcde6('0x10')](_0xcde6('0x20'),_0x24aed8[_0xcde6('0x12')],_0x2cb792);_0x537b13(_0x17553a[_0xcde6('0x10')](0x1f4,_0x24aed8[_0xcde6('0x12')]));});});}; \ No newline at end of file +var _0x5e7f=['then','request\x20sent','debug','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x5e7f,0x11a));var _0xf5e7=function(_0x1e9552,_0x5a4e94){_0x1e9552=_0x1e9552-0x0;var _0x36db8b=_0x5e7f[_0x1e9552];return _0x36db8b;};'use strict';var _=require(_0xf5e7('0x0'));var util=require(_0xf5e7('0x1'));var moment=require(_0xf5e7('0x2'));var BPromise=require(_0xf5e7('0x3'));var rs=require(_0xf5e7('0x4'));var fs=require('fs');var Redis=require(_0xf5e7('0x5'));var db=require(_0xf5e7('0x6'))['db'];var utils=require(_0xf5e7('0x7'));var logger=require(_0xf5e7('0x8'))(_0xf5e7('0x9'));var config=require(_0xf5e7('0xa'));var jayson=require(_0xf5e7('0xb'));var client=jayson[_0xf5e7('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52eddd,_0x2556dc,_0x1f589d){return new BPromise(function(_0x1df46a,_0x513bb6){return client[_0xf5e7('0xd')](_0x52eddd,_0x1f589d)[_0xf5e7('0xe')](function(_0x361c79){logger['info']('Trunk,\x20%s,\x20%s',_0x2556dc,_0xf5e7('0xf'));logger[_0xf5e7('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2556dc,_0xf5e7('0xf'),JSON[_0xf5e7('0x11')](_0x361c79));if(_0x361c79[_0xf5e7('0x12')]){if(_0x361c79[_0xf5e7('0x12')][_0xf5e7('0x13')]===0x1f4){logger[_0xf5e7('0x12')](_0xf5e7('0x14'),_0x2556dc,_0x361c79[_0xf5e7('0x12')][_0xf5e7('0x15')]);return _0x513bb6(_0x361c79[_0xf5e7('0x12')]['message']);}logger['error'](_0xf5e7('0x14'),_0x2556dc,_0x361c79[_0xf5e7('0x12')][_0xf5e7('0x15')]);return _0x1df46a(_0x361c79[_0xf5e7('0x12')]['message']);}else{logger[_0xf5e7('0x16')](_0xf5e7('0x14'),_0x2556dc,'request\x20sent');_0x1df46a(_0x361c79[_0xf5e7('0x17')][_0xf5e7('0x15')]);}})[_0xf5e7('0x18')](function(_0x339dd1){logger['error'](_0xf5e7('0x14'),_0x2556dc,_0x339dd1);_0x513bb6(_0x339dd1);});});}exports[_0xf5e7('0x19')]=function(_0x3556a6){var _0x15a4a6=this;return new Promise(function(_0x25652c,_0x3cdb1a){return db[_0xf5e7('0x1a')][_0xf5e7('0x1b')]({'raw':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6[_0xf5e7('0x1c')][_0xf5e7('0x1d')]===undefined?!![]:![]:!![],'where':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6[_0xf5e7('0x1c')]['where']||null:null,'attributes':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6['options'][_0xf5e7('0x1e')]||null:null,'limit':_0x3556a6['options']?_0x3556a6[_0xf5e7('0x1c')][_0xf5e7('0x1f')]||null:null,'include':_0x3556a6[_0xf5e7('0x1c')]?_0x3556a6['options'][_0xf5e7('0x20')]?_[_0xf5e7('0x21')](_0x3556a6['options']['include'],function(_0x11acfc){return{'model':db[_0x11acfc[_0xf5e7('0x22')]],'as':_0x11acfc['as'],'attributes':_0x11acfc[_0xf5e7('0x1e')],'include':_0x11acfc[_0xf5e7('0x20')]?_['map'](_0x11acfc[_0xf5e7('0x20')],function(_0x5acde8){return{'model':db[_0x5acde8['model']],'as':_0x5acde8['as'],'attributes':_0x5acde8[_0xf5e7('0x1e')],'include':_0x5acde8['include']?_['map'](_0x5acde8[_0xf5e7('0x20')],function(_0x5d4531){return{'model':db[_0x5d4531[_0xf5e7('0x22')]],'as':_0x5d4531['as'],'attributes':_0x5d4531['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11a38b){logger[_0xf5e7('0x16')]('GetTrunk',_0x3556a6);logger[_0xf5e7('0x10')](_0xf5e7('0x19'),_0x3556a6,JSON['stringify'](_0x11a38b));_0x25652c(_0x11a38b);})[_0xf5e7('0x18')](function(_0x46395c){logger['error']('GetTrunk',_0x46395c['message'],_0x3556a6);_0x3cdb1a(_0x15a4a6[_0xf5e7('0x12')](0x1f4,_0x46395c['message']));});});};exports[_0xf5e7('0x23')]=function(_0xd73ffa){var _0x3ded0d=this;return new Promise(function(_0x534cb4,_0x2279a2){return db[_0xf5e7('0x1a')]['find']({'raw':_0xd73ffa[_0xf5e7('0x1c')]?_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x1d')]===undefined?!![]:![]:!![],'where':_0xd73ffa['options']?_0xd73ffa['options'][_0xf5e7('0x24')]||null:null,'attributes':_0xd73ffa[_0xf5e7('0x1c')]?_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x1e')]||null:null,'include':_0xd73ffa['options']?_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x20')]?_[_0xf5e7('0x21')](_0xd73ffa[_0xf5e7('0x1c')][_0xf5e7('0x20')],function(_0x534da7){return{'model':db[_0x534da7[_0xf5e7('0x22')]],'as':_0x534da7['as'],'attributes':_0x534da7[_0xf5e7('0x1e')],'include':_0x534da7[_0xf5e7('0x20')]?_['map'](_0x534da7[_0xf5e7('0x20')],function(_0x38629d){return{'model':db[_0x38629d[_0xf5e7('0x22')]],'as':_0x38629d['as'],'attributes':_0x38629d[_0xf5e7('0x1e')],'include':_0x38629d['include']?_['map'](_0x38629d[_0xf5e7('0x20')],function(_0x217ea5){return{'model':db[_0x217ea5[_0xf5e7('0x22')]],'as':_0x217ea5['as'],'attributes':_0x217ea5['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5e7('0xe')](function(_0xd302a0){logger[_0xf5e7('0x16')]('ShowTrunk',_0xd73ffa);logger[_0xf5e7('0x10')](_0xf5e7('0x23'),_0xd73ffa,JSON[_0xf5e7('0x11')](_0xd302a0));_0x534cb4(_0xd302a0);})['catch'](function(_0x2d8410){logger[_0xf5e7('0x12')]('ShowTrunk',_0x2d8410[_0xf5e7('0x15')],_0xd73ffa);_0x2279a2(_0x3ded0d[_0xf5e7('0x12')](0x1f4,_0x2d8410[_0xf5e7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 9df2b76..a65bd8d 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 _0xd537=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x344b70,_0x3bcddc){var _0x32df12=function(_0x50bf9f){while(--_0x50bf9f){_0x344b70['push'](_0x344b70['shift']());}};_0x32df12(++_0x3bcddc);}(_0xd537,0x107));var _0x7d53=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xd537[_0xaa1b3e];return _0x454d7d;};'use strict';var express=require(_0x7d53('0x0'));var router=express[_0x7d53('0x1')]();var auth=require(_0x7d53('0x2'));var controller=require(_0x7d53('0x3'));router[_0x7d53('0x4')](_0x7d53('0x5'),auth[_0x7d53('0x6')](),controller[_0x7d53('0x7')]);module[_0x7d53('0x8')]=router; \ No newline at end of file +var _0xe128=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x3e6093,_0x2c0d44){var _0x414fd2=function(_0x325596){while(--_0x325596){_0x3e6093['push'](_0x3e6093['shift']());}};_0x414fd2(++_0x2c0d44);}(_0xe128,0x80));var _0x8e12=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0xe128[_0x18ea8a];return _0x19c99a;};'use strict';var express=require(_0x8e12('0x0'));var router=express[_0x8e12('0x1')]();var auth=require(_0x8e12('0x2'));var controller=require(_0x8e12('0x3'));router[_0x8e12('0x4')](_0x8e12('0x5'),auth[_0x8e12('0x6')](),controller[_0x8e12('0x7')]);module[_0x8e12('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 0ab2bdf..4d066e4 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 _0x065a=['BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','info','debug','exports','ENUM'];(function(_0xea2068,_0x25f4ea){var _0x118634=function(_0x1a4e61){while(--_0x1a4e61){_0xea2068['push'](_0xea2068['shift']());}};_0x118634(++_0x25f4ea);}(_0x065a,0x1c8));var _0xa065=function(_0x20603c,_0x33198b){_0x20603c=_0x20603c-0x0;var _0x19b4e6=_0x065a[_0x20603c];return _0x19b4e6;};'use strict';var Sequelize=require(_0xa065('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xa065('0x1'),'warning',_0xa065('0x2'),_0xa065('0x3')];module[_0xa065('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xa065('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xa065('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa065('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xa065('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xa065('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa065('0x9')],'unique':_0xa065('0xa')}}; \ No newline at end of file +var _0xd52c=['exports','ENUM','TEXT','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xd52c,0x19d));var _0xcd52=function(_0xf58288,_0x35333c){_0xf58288=_0xf58288-0x0;var _0x196e87=_0xd52c[_0xf58288];return _0x196e87;};'use strict';var Sequelize=require(_0xcd52('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xcd52('0x1'),_0xcd52('0x2'),_0xcd52('0x3'),_0xcd52('0x4')];module[_0xcd52('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xcd52('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xcd52('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xcd52('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcd52('0x9')],'unique':_0xcd52('0xa')}}; \ 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 1ceb626..3df87d1 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 _0xacfe=['send','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','params','then','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','sendStatus','error','stack','name'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xacfe,0xfd));var _0xeacf=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xacfe[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var config=require(_0xeacf('0x2'));var db=require(_0xeacf('0x3'))['db'];var socket=require(_0xeacf('0x4'))(new Redis(config[_0xeacf('0x5')]));require(_0xeacf('0x6'))[_0xeacf('0x7')](socket);config[_0xeacf('0x5')]=_[_0xeacf('0x8')](config[_0xeacf('0x5')],{'host':_0xeacf('0x9'),'port':0x18eb});function respondWithResult(_0x13cba2,_0x5eb516){_0x5eb516=_0x5eb516||0xc8;return function(_0x411634){if(_0x411634){return _0x13cba2[_0xeacf('0xa')](_0x5eb516)[_0xeacf('0xb')](_0x411634);}};}function saveUpdates(_0xf5c2e4){return function(_0x48acc3){if(_0x48acc3){return _0x48acc3[_0xeacf('0xc')](_0xf5c2e4)['then'](function(_0x41f6ed){return _0x41f6ed;});}return null;};}function handleEntityNotFound(_0x20e7d7){return function(_0x355070){if(!_0x355070){_0x20e7d7[_0xeacf('0xd')](0x194);}return _0x355070;};}function handleError(_0x3935a4,_0x3a0dd9){_0x3a0dd9=_0x3a0dd9||0x1f4;return function(_0x107c58){logger[_0xeacf('0xe')](_0x107c58[_0xeacf('0xf')]);if(_0x107c58[_0xeacf('0x10')]){delete _0x107c58['name'];}_0x3935a4[_0xeacf('0xa')](_0x3a0dd9)[_0xeacf('0x11')](_0x107c58);};}exports[_0xeacf('0xc')]=function(_0x2466d7,_0x56ec79){if(_0x2466d7[_0xeacf('0x12')][_0xeacf('0x13')]!==_0xeacf('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x2466d7['params']['id'])))throw new Error(_0xeacf('0x15'));return db[_0xeacf('0x16')]['find']({'where':{'id':_0x2466d7[_0xeacf('0x17')]['id']}})['then'](handleEntityNotFound(_0x56ec79,null))[_0xeacf('0x18')](saveUpdates(_0x2466d7[_0xeacf('0x19')],null))['then'](respondWithResult(_0x56ec79,null))[_0xeacf('0x1a')](handleError(_0x56ec79,null));}; \ No newline at end of file +var _0xc820=['redis','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0xc820,0x13f));var _0x0c82=function(_0x17a8cf,_0x14a102){_0x17a8cf=_0x17a8cf-0x0;var _0x28ca77=_0xc820[_0x17a8cf];return _0x28ca77;};'use strict';var _=require('lodash');var Redis=require(_0x0c82('0x0'));var logger=require(_0x0c82('0x1'))(_0x0c82('0x2'));var config=require(_0x0c82('0x3'));var db=require(_0x0c82('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0c82('0x5')]));require('./user-setting.socket')[_0x0c82('0x6')](socket);config[_0x0c82('0x5')]=_[_0x0c82('0x7')](config[_0x0c82('0x5')],{'host':_0x0c82('0x8'),'port':0x18eb});function respondWithResult(_0x23f783,_0x2d2567){_0x2d2567=_0x2d2567||0xc8;return function(_0x32e9ee){if(_0x32e9ee){return _0x23f783[_0x0c82('0x9')](_0x2d2567)[_0x0c82('0xa')](_0x32e9ee);}};}function saveUpdates(_0x72116){return function(_0x4773de){if(_0x4773de){return _0x4773de[_0x0c82('0xb')](_0x72116)[_0x0c82('0xc')](function(_0x4d14b1){return _0x4d14b1;});}return null;};}function handleEntityNotFound(_0x8c568){return function(_0xc0790d){if(!_0xc0790d){_0x8c568[_0x0c82('0xd')](0x194);}return _0xc0790d;};}function handleError(_0x1d2373,_0xbe6336){_0xbe6336=_0xbe6336||0x1f4;return function(_0xc9ad4f){logger[_0x0c82('0xe')](_0xc9ad4f[_0x0c82('0xf')]);if(_0xc9ad4f[_0x0c82('0x10')]){delete _0xc9ad4f[_0x0c82('0x10')];}_0x1d2373['status'](_0xbe6336)[_0x0c82('0x11')](_0xc9ad4f);};}exports['update']=function(_0x548cf5,_0x2098ae){if(_0x548cf5[_0x0c82('0x12')][_0x0c82('0x13')]!==_0x0c82('0x14'))throw new Error(_0x0c82('0x15'));if(isNaN(Number(_0x548cf5['params']['id'])))throw new Error(_0x0c82('0x16'));return db[_0x0c82('0x17')][_0x0c82('0x18')]({'where':{'id':_0x548cf5['params']['id']}})[_0x0c82('0xc')](handleEntityNotFound(_0x2098ae,null))['then'](saveUpdates(_0x548cf5[_0x0c82('0x19')],null))[_0x0c82('0xc')](respondWithResult(_0x2098ae,null))[_0x0c82('0x1a')](handleError(_0x2098ae,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 ea0fc34..ef9b053 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 _0x67c3=['../../mysqldb','UserSetting','save','update','remove','emit','hook','exports'];(function(_0x26434e,_0xd7e437){var _0x17d3a9=function(_0x31dc6d){while(--_0x31dc6d){_0x26434e['push'](_0x26434e['shift']());}};_0x17d3a9(++_0xd7e437);}(_0x67c3,0x1d0));var _0x367c=function(_0x239eaf,_0x1968b4){_0x239eaf=_0x239eaf-0x0;var _0x8863f7=_0x67c3[_0x239eaf];return _0x8863f7;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x367c('0x0'))['db'][_0x367c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x367c('0x2'),'afterUpdate':_0x367c('0x3'),'afterDestroy':_0x367c('0x4')};function emitEvent(_0x7741a2){return function(_0x2fc385,_0x2d30d8,_0x46077e){UserSettingEvents[_0x367c('0x5')](_0x7741a2+':'+_0x2fc385['id'],_0x2fc385);UserSettingEvents[_0x367c('0x5')](_0x7741a2,_0x2fc385);_0x46077e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x367c('0x6')](e,emitEvent(event));}}module[_0x367c('0x7')]=UserSettingEvents; \ No newline at end of file +var _0xa1df=['events','UserSetting','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x484fdc,_0x53715a){var _0xcbdb51=function(_0x1f6801){while(--_0x1f6801){_0x484fdc['push'](_0x484fdc['shift']());}};_0xcbdb51(++_0x53715a);}(_0xa1df,0xf8));var _0xfa1d=function(_0x399067,_0x5f3c08){_0x399067=_0x399067-0x0;var _0x239894=_0xa1df[_0x399067];return _0x239894;};'use strict';var EventEmitter=require(_0xfa1d('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xfa1d('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa1d('0x2'),'afterUpdate':_0xfa1d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1dfc9e){return function(_0xb1062b,_0x2a6462,_0x22475c){UserSettingEvents[_0xfa1d('0x4')](_0x1dfc9e+':'+_0xb1062b['id'],_0xb1062b);UserSettingEvents[_0xfa1d('0x4')](_0x1dfc9e,_0xb1062b);_0x22475c(null);};}for(var e in events){if(events[_0xfa1d('0x5')](e)){var event=events[e];UserSetting[_0xfa1d('0x6')](e,emitEvent(event));}}module[_0xfa1d('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 eb68d03..8c032df 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 _0x8f59=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0x8f59,0x11d));var _0x98f5=function(_0x2ec13e,_0x2ea526){_0x2ec13e=_0x2ec13e-0x0;var _0xb48415=_0x8f59[_0x2ec13e];return _0xb48415;};'use strict';var attributes=require(_0x98f5('0x0'));module[_0x98f5('0x1')]=function(_0x2fd35a){return _0x2fd35a[_0x98f5('0x2')](_0x98f5('0x3'),attributes,{'tableName':_0x98f5('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f53a9){if(!_0x5f53a9[_0x98f5('0x5')])_0x5f53a9[_0x98f5('0x6')]=null;else if(_0x5f53a9[_0x98f5('0x6')]===null)_0x5f53a9[_0x98f5('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x536f=['./user-setting.attributes','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4b2c25,_0x184835){var _0x168b99=function(_0x3339d8){while(--_0x3339d8){_0x4b2c25['push'](_0x4b2c25['shift']());}};_0x168b99(++_0x184835);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0xf536('0x0'));module['exports']=function(_0x4e4212){return _0x4e4212['define']('UserSetting',attributes,{'tableName':_0xf536('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5e49){if(!_0x1e5e49[_0xf536('0x2')])_0x1e5e49[_0xf536('0x3')]=null;else if(_0x1e5e49['clientSideLoggingEnabledSince']===null)_0x1e5e49[_0xf536('0x3')]=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 afac740..32f09d5 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 _0x95c2=['emit','register','length','user-setting:','./user-setting.events','save','remove','user-setting:update'];(function(_0x1fbfc9,_0x425bc9){var _0x1d1c98=function(_0x4fe96d){while(--_0x4fe96d){_0x1fbfc9['push'](_0x1fbfc9['shift']());}};_0x1d1c98(++_0x425bc9);}(_0x95c2,0x1bc));var _0x295c=function(_0x20d0b0,_0x788cdd){_0x20d0b0=_0x20d0b0-0x0;var _0x458d48=_0x95c2[_0x20d0b0];return _0x458d48;};'use strict';var UserSettingEvents=require(_0x295c('0x0'));var events=[_0x295c('0x1'),_0x295c('0x2'),'update'];function createListener(_0xe703ed,_0x8b8ebd){return function(_0x8516bd){_0x8b8ebd['emit'](_0xe703ed,_0x8516bd);if(_0xe703ed===_0x295c('0x3')){_0x8b8ebd[_0x295c('0x4')]('user-setting:update:user-'+_0x8516bd['UserId'],_0x8516bd);}};}exports[_0x295c('0x5')]=function(_0x3aa96e){for(var _0x5b7867=0x0,_0x2b5564=events[_0x295c('0x6')];_0x5b7867<_0x2b5564;_0x5b7867++){var _0x1e9cfa=events[_0x5b7867];var _0x46aacf=createListener(_0x295c('0x7')+_0x1e9cfa,_0x3aa96e);UserSettingEvents['on'](_0x1e9cfa,_0x46aacf);}}; \ No newline at end of file +var _0x64ae=['remove','emit','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events'];(function(_0x21d6fa,_0x5e623a){var _0x405b62=function(_0x54f24a){while(--_0x54f24a){_0x21d6fa['push'](_0x21d6fa['shift']());}};_0x405b62(++_0x5e623a);}(_0x64ae,0x10f));var _0xe64a=function(_0x51ea8e,_0x5da983){_0x51ea8e=_0x51ea8e-0x0;var _0x4abe88=_0x64ae[_0x51ea8e];return _0x4abe88;};'use strict';var UserSettingEvents=require(_0xe64a('0x0'));var events=['save',_0xe64a('0x1'),'update'];function createListener(_0x51c29b,_0x3bc041){return function(_0x206af0){_0x3bc041[_0xe64a('0x2')](_0x51c29b,_0x206af0);if(_0x51c29b==='user-setting:update'){_0x3bc041['emit'](_0xe64a('0x3')+_0x206af0[_0xe64a('0x4')],_0x206af0);}};}exports[_0xe64a('0x5')]=function(_0xfdace6){for(var _0x3eac27=0x0,_0x491bf3=events[_0xe64a('0x6')];_0x3eac27<_0x491bf3;_0x3eac27++){var _0x4f10b8=events[_0x3eac27];var _0x26fa5e=createListener(_0xe64a('0x7')+_0x4f10b8,_0xfdace6);UserSettingEvents['on'](_0x4f10b8,_0x26fa5e);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e00da7a..2293dce 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 _0x36f3=['/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','%s-%s','now','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','/:id/api_key','put','/:id','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/:id/contacts','addContacts','create'];(function(_0x283127,_0x54d4d5){var _0x43da5d=function(_0x10947f){while(--_0x10947f){_0x283127['push'](_0x283127['shift']());}};_0x43da5d(++_0x54d4d5);}(_0x36f3,0x180));var _0x336f=function(_0x46bb87,_0x5a88fa){_0x46bb87=_0x46bb87-0x0;var _0x304cdc=_0x36f3[_0x46bb87];return _0x304cdc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x336f('0x0'));var timeout=require(_0x336f('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x336f('0x2'));var auth=require(_0x336f('0x3'));var interaction=require(_0x336f('0x4'));var config=require(_0x336f('0x5'));var controller=require(_0x336f('0x6'));router[_0x336f('0x7')]('/',auth[_0x336f('0x8')](),controller[_0x336f('0x9')]);router[_0x336f('0x7')](_0x336f('0xa'),auth[_0x336f('0x8')](),controller[_0x336f('0xb')]);router[_0x336f('0x7')]('/whoami',auth[_0x336f('0x8')](),controller['whoami']);router[_0x336f('0x7')](_0x336f('0xc'),auth[_0x336f('0x8')](),controller[_0x336f('0xd')]);router['get']('/:id',auth[_0x336f('0x8')](),controller[_0x336f('0xe')]);router[_0x336f('0x7')](_0x336f('0xf'),controller[_0x336f('0x10')]);router[_0x336f('0x7')](_0x336f('0x11'),auth[_0x336f('0x8')](),controller['getOpenTabs']);router[_0x336f('0x7')]('/:id/contacts',auth[_0x336f('0x8')](),controller['getContacts']);router['get'](_0x336f('0x12'),auth[_0x336f('0x8')](),controller[_0x336f('0x13')]);router[_0x336f('0x7')]('/:id/queues_rt',auth[_0x336f('0x8')](),controller[_0x336f('0x14')]);router[_0x336f('0x7')]('/:id/groups',auth['isAuthenticated'](),controller[_0x336f('0x15')]);router[_0x336f('0x7')](_0x336f('0x16'),auth['isAuthenticated'](),controller[_0x336f('0x17')]);router[_0x336f('0x7')]('/:id/screen_recordings',auth[_0x336f('0x8')](),controller[_0x336f('0x18')]);router[_0x336f('0x7')](_0x336f('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x336f('0x7')](_0x336f('0x1a'),auth[_0x336f('0x8')](),controller[_0x336f('0x1b')]);router[_0x336f('0x7')](_0x336f('0x1c'),auth[_0x336f('0x8')](),controller[_0x336f('0x1d')]);router[_0x336f('0x7')](_0x336f('0x1e'),auth[_0x336f('0x8')](),controller[_0x336f('0x1f')]);router[_0x336f('0x7')](_0x336f('0x20'),auth[_0x336f('0x8')](),controller[_0x336f('0x21')]);router['get']('/:id/whatsapp/interactions',auth[_0x336f('0x8')](),controller[_0x336f('0x22')]);router[_0x336f('0x7')](_0x336f('0x23'),auth[_0x336f('0x8')](),controller['getTeams']);router[_0x336f('0x7')](_0x336f('0x24'),auth['isAuthenticated'](),controller[_0x336f('0x25')]);router[_0x336f('0x7')](_0x336f('0x26'),auth[_0x336f('0x8')](),controller[_0x336f('0x27')]);router[_0x336f('0x7')](_0x336f('0x28'),auth['isAuthenticated'](),controller[_0x336f('0x29')]);router[_0x336f('0x7')](_0x336f('0x2a'),auth[_0x336f('0x8')](),controller[_0x336f('0x2b')]);router[_0x336f('0x7')]('/:id/mail_accounts',auth[_0x336f('0x8')](),controller[_0x336f('0x2c')]);router[_0x336f('0x7')](_0x336f('0x2d'),auth[_0x336f('0x8')](),controller[_0x336f('0x2e')]);router[_0x336f('0x7')](_0x336f('0x2f'),auth[_0x336f('0x8')](),controller[_0x336f('0x30')]);router['get'](_0x336f('0x31'),auth[_0x336f('0x8')](),controller[_0x336f('0x32')]);router[_0x336f('0x7')](_0x336f('0x33'),auth[_0x336f('0x8')](),controller[_0x336f('0x34')]);router[_0x336f('0x7')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x336f('0x35')]);router[_0x336f('0x7')](_0x336f('0x36'),auth['isAuthenticated'](),controller[_0x336f('0x37')]);router['get']('/:id/api_key',auth[_0x336f('0x8')](),controller['getApiKey']);router[_0x336f('0x38')](_0x336f('0x39'),auth[_0x336f('0x8')](),controller[_0x336f('0x3a')]);router['post']('/',auth[_0x336f('0x8')](),controller[_0x336f('0x3b')]);router[_0x336f('0x38')](_0x336f('0x3c'),auth[_0x336f('0x8')](),controller[_0x336f('0x3d')]);router[_0x336f('0x38')]('/:id/queues',auth['isAuthenticated'](),controller[_0x336f('0x3e')]);var upload=multer({'storage':multer[_0x336f('0x3f')]({'destination':function(_0x81cffa,_0x3459d4,_0x2a9bca){_0x2a9bca(null,path[_0x336f('0x40')](config['root'],_0x336f('0x41')));},'filename':function(_0x21734c,_0x575226,_0x3b295e){_0x3b295e(null,util['format'](_0x336f('0x42'),Date[_0x336f('0x43')](),_0x575226[_0x336f('0x44')]));}})});router['post'](_0x336f('0xf'),upload[_0x336f('0x45')]('file'),controller[_0x336f('0x46')]);router[_0x336f('0x38')](_0x336f('0x47'),auth[_0x336f('0x8')](),controller[_0x336f('0x48')]);router[_0x336f('0x38')]('/:id/logout',auth['isAuthenticated'](),controller[_0x336f('0x49')]);router[_0x336f('0x38')](_0x336f('0x4a'),auth[_0x336f('0x8')](),controller[_0x336f('0x4b')]);router[_0x336f('0x38')](_0x336f('0x4c'),auth[_0x336f('0x8')](),controller['unpause']);router[_0x336f('0x38')]('/:id/teams',auth[_0x336f('0x8')](),controller[_0x336f('0x4d')]);router[_0x336f('0x38')](_0x336f('0x4e'),auth['isAuthenticated'](),controller[_0x336f('0x4f')]);router[_0x336f('0x38')](_0x336f('0x50'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x336f('0x8')](),controller[_0x336f('0x51')]);router[_0x336f('0x38')]('/:id/sms_interactions',auth[_0x336f('0x8')](),controller['addSmsInteractions']);router[_0x336f('0x38')]('/:id/openchannel_interactions',auth[_0x336f('0x8')](),controller['addOpenchannelInteractions']);router[_0x336f('0x38')](_0x336f('0x52'),auth['isAuthenticated'](),controller[_0x336f('0x53')]);router[_0x336f('0x38')](_0x336f('0x2a'),auth[_0x336f('0x8')](),controller['addFaxAccounts']);router[_0x336f('0x38')](_0x336f('0x54'),auth[_0x336f('0x8')](),controller[_0x336f('0x55')]);router[_0x336f('0x38')](_0x336f('0x2d'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post'](_0x336f('0x2f'),auth[_0x336f('0x8')](),controller[_0x336f('0x56')]);router[_0x336f('0x38')](_0x336f('0x31'),auth['isAuthenticated'](),controller[_0x336f('0x57')]);router[_0x336f('0x38')](_0x336f('0x33'),auth[_0x336f('0x8')](),controller[_0x336f('0x58')]);router[_0x336f('0x38')](_0x336f('0x59'),auth[_0x336f('0x8')](),controller['addSquareProjects']);router[_0x336f('0x38')](_0x336f('0x5a'),auth[_0x336f('0x8')](),controller['createApiKey']);router[_0x336f('0x5b')](_0x336f('0x5c'),auth[_0x336f('0x8')](),controller[_0x336f('0x5d')]);router[_0x336f('0x5b')](_0x336f('0x5e'),auth[_0x336f('0x8')](),controller[_0x336f('0x5f')]);router[_0x336f('0x60')](_0x336f('0x12'),auth['isAuthenticated'](),controller[_0x336f('0x61')]);router['delete'](_0x336f('0x23'),auth['isAuthenticated'](),controller[_0x336f('0x62')]);router[_0x336f('0x60')](_0x336f('0x5c'),auth[_0x336f('0x8')](),controller['destroy']);router[_0x336f('0x60')](_0x336f('0x4e'),auth[_0x336f('0x8')](),controller[_0x336f('0x63')]);router['delete'](_0x336f('0x50'),auth[_0x336f('0x8')](),controller[_0x336f('0x64')]);router['delete'](_0x336f('0x65'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x336f('0x60')](_0x336f('0x66'),auth[_0x336f('0x8')](),controller[_0x336f('0x67')]);router['delete']('/:id/openchannel_interactions',auth[_0x336f('0x8')](),controller[_0x336f('0x68')]);router[_0x336f('0x60')](_0x336f('0x52'),auth[_0x336f('0x8')](),controller['removeWhatsappInteractions']);router['delete'](_0x336f('0x2a'),auth[_0x336f('0x8')](),controller[_0x336f('0x69')]);router['delete'](_0x336f('0x54'),auth[_0x336f('0x8')](),controller[_0x336f('0x6a')]);router[_0x336f('0x60')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x336f('0x60')](_0x336f('0x2f'),auth[_0x336f('0x8')](),controller[_0x336f('0x6b')]);router['delete'](_0x336f('0x31'),auth[_0x336f('0x8')](),controller['removeChatWebsites']);router[_0x336f('0x60')](_0x336f('0x33'),auth['isAuthenticated'](),controller[_0x336f('0x6c')]);router[_0x336f('0x60')](_0x336f('0x59'),auth[_0x336f('0x8')](),controller[_0x336f('0x6d')]);router[_0x336f('0x60')](_0x336f('0x5a'),auth[_0x336f('0x8')](),controller[_0x336f('0x6e')]);module['exports']=router; \ No newline at end of file +var _0x4994=['removeTeams','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/: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/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','addQueues','join','server/files/images/','now','originalname','single','file','addAvatar','/:id/login','login','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','createApiKey','put','delete','removeQueues','/:id/teams'];(function(_0x1de1d6,_0x23743d){var _0x637b54=function(_0x19b3ea){while(--_0x19b3ea){_0x1de1d6['push'](_0x1de1d6['shift']());}};_0x637b54(++_0x23743d);}(_0x4994,0x1c2));var _0x4499=function(_0x406885,_0x1a8203){_0x406885=_0x406885-0x0;var _0x538659=_0x4994[_0x406885];return _0x538659;};'use strict';var multer=require(_0x4499('0x0'));var util=require(_0x4499('0x1'));var path=require(_0x4499('0x2'));var timeout=require(_0x4499('0x3'));var express=require(_0x4499('0x4'));var router=express[_0x4499('0x5')]();var fs_extra=require(_0x4499('0x6'));var auth=require(_0x4499('0x7'));var interaction=require(_0x4499('0x8'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x4499('0x9')]('/',auth[_0x4499('0xa')](),controller['index']);router[_0x4499('0x9')](_0x4499('0xb'),auth[_0x4499('0xa')](),controller[_0x4499('0xc')]);router[_0x4499('0x9')](_0x4499('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0x4499('0x9')]('/presence',auth[_0x4499('0xa')](),controller[_0x4499('0xe')]);router[_0x4499('0x9')](_0x4499('0xf'),auth['isAuthenticated'](),controller[_0x4499('0x10')]);router[_0x4499('0x9')](_0x4499('0x11'),controller[_0x4499('0x12')]);router['get'](_0x4499('0x13'),auth[_0x4499('0xa')](),controller['getOpenTabs']);router[_0x4499('0x9')](_0x4499('0x14'),auth[_0x4499('0xa')](),controller[_0x4499('0x15')]);router['get'](_0x4499('0x16'),auth[_0x4499('0xa')](),controller[_0x4499('0x17')]);router[_0x4499('0x9')](_0x4499('0x18'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x4499('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0x4499('0x19')]);router[_0x4499('0x9')](_0x4499('0x1a'),auth['isAuthenticated'](),controller[_0x4499('0x1b')]);router[_0x4499('0x9')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x4499('0x1c')]);router['get'](_0x4499('0x1d'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x4499('0x9')](_0x4499('0x1e'),auth['isAuthenticated'](),controller[_0x4499('0x1f')]);router[_0x4499('0x9')](_0x4499('0x20'),auth[_0x4499('0xa')](),controller[_0x4499('0x21')]);router[_0x4499('0x9')](_0x4499('0x22'),auth[_0x4499('0xa')](),controller['getSmsInteractions']);router[_0x4499('0x9')]('/:id/fax/interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x23')]);router[_0x4499('0x9')](_0x4499('0x24'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x4499('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4499('0x25')]);router[_0x4499('0x9')](_0x4499('0x26'),auth['isAuthenticated'](),controller[_0x4499('0x27')]);router[_0x4499('0x9')](_0x4499('0x28'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4499('0x9')](_0x4499('0x29'),auth['isAuthenticated'](),controller[_0x4499('0x2a')]);router[_0x4499('0x9')](_0x4499('0x2b'),auth[_0x4499('0xa')](),controller[_0x4499('0x2c')]);router[_0x4499('0x9')](_0x4499('0x2d'),auth[_0x4499('0xa')](),controller[_0x4499('0x2e')]);router[_0x4499('0x9')](_0x4499('0x2f'),auth[_0x4499('0xa')](),controller[_0x4499('0x30')]);router['get'](_0x4499('0x31'),auth[_0x4499('0xa')](),controller[_0x4499('0x32')]);router['get'](_0x4499('0x33'),auth[_0x4499('0xa')](),controller[_0x4499('0x34')]);router[_0x4499('0x9')](_0x4499('0x35'),auth[_0x4499('0xa')](),controller[_0x4499('0x36')]);router[_0x4499('0x9')](_0x4499('0x37'),auth[_0x4499('0xa')](),controller[_0x4499('0x38')]);router[_0x4499('0x9')](_0x4499('0x39'),auth['isAuthenticated'](),controller[_0x4499('0x3a')]);router[_0x4499('0x9')](_0x4499('0x3b'),auth[_0x4499('0xa')](),controller[_0x4499('0x3c')]);router[_0x4499('0x3d')](_0x4499('0x14'),auth[_0x4499('0xa')](),controller['addContacts']);router['post']('/',auth[_0x4499('0xa')](),controller['create']);router['post'](_0x4499('0x3e'),auth[_0x4499('0xa')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0x4499('0xa')](),controller[_0x4499('0x3f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xdb0a1,_0x57fd37,_0x58cf31){_0x58cf31(null,path[_0x4499('0x40')](config['root'],_0x4499('0x41')));},'filename':function(_0x117923,_0x20b6f7,_0x1389f5){_0x1389f5(null,util['format']('%s-%s',Date[_0x4499('0x42')](),_0x20b6f7[_0x4499('0x43')]));}})});router[_0x4499('0x3d')]('/:id/avatar',upload[_0x4499('0x44')](_0x4499('0x45')),controller[_0x4499('0x46')]);router[_0x4499('0x3d')](_0x4499('0x47'),auth['isAuthenticated'](),controller[_0x4499('0x48')]);router[_0x4499('0x3d')]('/:id/logout',auth[_0x4499('0xa')](),controller[_0x4499('0x49')]);router[_0x4499('0x3d')]('/:id/pause',auth['isAuthenticated'](),controller[_0x4499('0x4a')]);router[_0x4499('0x3d')]('/:id/unpause',auth[_0x4499('0xa')](),controller[_0x4499('0x4b')]);router[_0x4499('0x3d')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4499('0x4c')]);router[_0x4499('0x3d')](_0x4499('0x4d'),auth[_0x4499('0xa')](),controller[_0x4499('0x4e')]);router[_0x4499('0x3d')]('/:id/mail_interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x4f')]);router[_0x4499('0x3d')](_0x4499('0x50'),auth[_0x4499('0xa')](),controller[_0x4499('0x51')]);router[_0x4499('0x3d')](_0x4499('0x52'),auth[_0x4499('0xa')](),controller[_0x4499('0x53')]);router[_0x4499('0x3d')](_0x4499('0x54'),auth['isAuthenticated'](),controller[_0x4499('0x55')]);router['post'](_0x4499('0x56'),auth[_0x4499('0xa')](),controller['addWhatsappInteractions']);router[_0x4499('0x3d')](_0x4499('0x2b'),auth['isAuthenticated'](),controller[_0x4499('0x57')]);router[_0x4499('0x3d')](_0x4499('0x2d'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0x4499('0x2f'),auth[_0x4499('0xa')](),controller[_0x4499('0x58')]);router[_0x4499('0x3d')](_0x4499('0x31'),auth['isAuthenticated'](),controller[_0x4499('0x59')]);router[_0x4499('0x3d')](_0x4499('0x33'),auth[_0x4499('0xa')](),controller['addChatWebsites']);router[_0x4499('0x3d')](_0x4499('0x35'),auth[_0x4499('0xa')](),controller['addWhatsappAccounts']);router[_0x4499('0x3d')](_0x4499('0x37'),auth[_0x4499('0xa')](),controller['addSquareProjects']);router[_0x4499('0x3d')](_0x4499('0x3b'),auth[_0x4499('0xa')](),controller[_0x4499('0x5a')]);router[_0x4499('0x5b')](_0x4499('0xf'),auth[_0x4499('0xa')](),controller['update']);router['put']('/:id/password',auth[_0x4499('0xa')](),controller['changePassword']);router[_0x4499('0x5c')](_0x4499('0x16'),auth[_0x4499('0xa')](),controller[_0x4499('0x5d')]);router[_0x4499('0x5c')](_0x4499('0x5e'),auth[_0x4499('0xa')](),controller[_0x4499('0x5f')]);router[_0x4499('0x5c')](_0x4499('0xf'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/chat_interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x60')]);router[_0x4499('0x5c')](_0x4499('0x61'),auth[_0x4499('0xa')](),controller[_0x4499('0x62')]);router[_0x4499('0x5c')](_0x4499('0x50'),auth[_0x4499('0xa')](),controller[_0x4499('0x63')]);router[_0x4499('0x5c')](_0x4499('0x52'),auth[_0x4499('0xa')](),controller[_0x4499('0x64')]);router[_0x4499('0x5c')](_0x4499('0x54'),auth[_0x4499('0xa')](),controller[_0x4499('0x65')]);router[_0x4499('0x5c')]('/:id/whatsapp_interactions',auth[_0x4499('0xa')](),controller[_0x4499('0x66')]);router[_0x4499('0x5c')](_0x4499('0x2b'),auth['isAuthenticated'](),controller[_0x4499('0x67')]);router[_0x4499('0x5c')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x4499('0xa')](),controller[_0x4499('0x68')]);router[_0x4499('0x5c')]('/:id/sms_accounts',auth[_0x4499('0xa')](),controller['removeSmsAccounts']);router[_0x4499('0x5c')](_0x4499('0x33'),auth['isAuthenticated'](),controller[_0x4499('0x69')]);router[_0x4499('0x5c')](_0x4499('0x35'),auth[_0x4499('0xa')](),controller[_0x4499('0x6a')]);router['delete'](_0x4499('0x37'),auth[_0x4499('0xa')](),controller['removeSquareProjects']);router[_0x4499('0x5c')](_0x4499('0x3b'),auth[_0x4499('0xa')](),controller[_0x4499('0x6b')]);module[_0x4499('0x6c')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 7c3da27..392dcc8 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 _0x09a4=['exports','name','setDataValue','defaultuser','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','agent','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','friend','peer','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','always','accept','refuse','uac','uas','fingerprint','certificate','passive','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','moment','lodash'];(function(_0x124291,_0x396c2b){var _0x172988=function(_0x4929f6){while(--_0x4929f6){_0x124291['push'](_0x124291['shift']());}};_0x172988(++_0x396c2b);}(_0x09a4,0x1a7));var _0x409a=function(_0xf8bd36,_0x100a9e){_0xf8bd36=_0xf8bd36-0x0;var _0x1ad6b4=_0x09a4[_0xf8bd36];return _0x1ad6b4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x409a('0x0'));var util=require('util');var _=require(_0x409a('0x1'));module[_0x409a('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x409a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x520174){this[_0x409a('0x4')](_0x409a('0x3'),_0x520174);this[_0x409a('0x4')](_0x409a('0x5'),_0x520174);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x409a('0x6')],'allowNull':![],'set':function(_0xfa840b){this[_0x409a('0x4')](_0x409a('0x7'),_0xfa840b);this['setDataValue'](_0x409a('0x8'),util[_0x409a('0x9')](_0x409a('0xa'),_0xfa840b,this[_0x409a('0xb')](_0x409a('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x409a('0x6')],'allowNull':![],'unique':_0x409a('0xd'),'validate':{'isEmail':!![]},'set':function(_0x154313){if(_0x154313){this[_0x409a('0x4')](_0x409a('0xd'),_0x154313['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x409a('0xe'),'user',_0x409a('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x409a('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':![],'unique':_0x409a('0xc'),'set':function(_0x42d90b){this[_0x409a('0x4')](_0x409a('0xc'),_0x42d90b);this[_0x409a('0x4')](_0x409a('0x11'),_0x42d90b);this[_0x409a('0x4')](_0x409a('0x8'),util[_0x409a('0x9')](_0x409a('0xa'),this[_0x409a('0xb')](_0x409a('0x7')),_0x42d90b));}},'salt':{'type':Sequelize[_0x409a('0x6')]},'phone':{'type':Sequelize[_0x409a('0x6')]},'mobile':{'type':Sequelize[_0x409a('0x6')]},'address':{'type':Sequelize[_0x409a('0x6')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x409a('0x6')]},'city':{'type':Sequelize[_0x409a('0x6')]},'country':{'type':Sequelize[_0x409a('0x6')]},'online':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x409a('0x13')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x409a('0x6')],'defaultValue':_0x409a('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x409a('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x409a('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x16'),'user',_0x409a('0x17')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![],'defaultValue':_0x409a('0x18')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x409a('0x19'),_0x409a('0x1a'),_0x409a('0x1b'),_0x409a('0x1c'),_0x409a('0x1d'),_0x409a('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![],'defaultValue':_0x409a('0x1f'),'set':function(_0x139282){this[_0x409a('0x4')](_0x409a('0x20'),_0x139282?_0x139282[_0x409a('0x21')](','):null);},'get':function(){return this[_0x409a('0xb')](_0x409a('0x20'))?this[_0x409a('0xb')]('transport')[_0x409a('0x22')](','):null;},'comment':_0x409a('0x23')},'dtmfmode':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x24'),'info',_0x409a('0x25'),_0x409a('0x26'),_0x409a('0x27')),'allowNull':!![],'defaultValue':_0x409a('0x24')},'directmedia':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no','nonat',_0x409a('0x29'),_0x409a('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x409a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![],'defaultValue':_0x409a('0x2b'),'set':function(_0xa010b9){this[_0x409a('0x4')](_0x409a('0x2c'),_0xa010b9?_0xa010b9[_0x409a('0x21')](','):null);},'get':function(){return this[_0x409a('0xb')]('nat')?this[_0x409a('0xb')](_0x409a('0x2c'))['split'](','):null;},'comment':_0x409a('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x409a('0x6')]},'pickupgroup':{'type':Sequelize[_0x409a('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x409a('0x6')]},'language':{'type':Sequelize[_0x409a('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x409a('0x6')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x409a('0x2e')},'allow':{'type':Sequelize[_0x409a('0x6')],'allowNull':![],'defaultValue':_0x409a('0x2f'),'set':function(_0x3bcca6){this[_0x409a('0x4')](_0x409a('0x30'),_0x3bcca6?_0x3bcca6[_0x409a('0x21')](';'):_0x409a('0x2f'));},'get':function(){return this[_0x409a('0xb')](_0x409a('0x30'))?this[_0x409a('0xb')](_0x409a('0x30'))['split'](';'):null;},'comment':_0x409a('0x31')},'autoframing':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3eb909){this['setDataValue'](_0x409a('0x32'),_0x3eb909?_0x3eb909['join'](','):null);},'get':function(){return this['getDataValue'](_0x409a('0x32'))?this[_0x409a('0xb')](_0x409a('0x32'))[_0x409a('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x409a('0x15')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x409a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no',_0x409a('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x409a('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x409a('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x409a('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no',_0x409a('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x35'),_0x409a('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x409a('0x37'),_0x409a('0x38')),'allowNull':!![],'defaultValue':_0x409a('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x409a('0x28')},'keepalive':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x409a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x409a('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x409a('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no',_0x409a('0x39'),_0x409a('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x409a('0x15')]('active',_0x409a('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x409a('0x15')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x409a('0x15')](_0x409a('0x28'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x409a('0x13')]},'passwordResetAt':{'type':Sequelize[_0x409a('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x409a('0x3c')]},'showWebBar':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0,'set':function(_0x4cfa0b){this[_0x409a('0x4')](_0x409a('0x3d'),_0x4cfa0b);var _0x43f18d=this[_0x409a('0x3e')]({'plain':!![]});switch(_0x4cfa0b){case 0x0:case 0x1:var _0x423652=_0x43f18d[_0x409a('0x20')]?_[_0x409a('0x3f')](_0x43f18d[_0x409a('0x20')])?_0x43f18d[_0x409a('0x20')]['join']():_0x43f18d[_0x409a('0x20')]:'udp';if(_0x423652===_0x409a('0x40')){_0x423652=_0x409a('0x1f');}this['setDataValue'](_0x409a('0x20'),_0x423652);this[_0x409a('0x4')]('encryption','no');this[_0x409a('0x4')](_0x409a('0x41'),null);this['setDataValue'](_0x409a('0x42'),null);this[_0x409a('0x4')]('icesupport',null);this[_0x409a('0x4')]('dtlsenable',null);this[_0x409a('0x4')]('dtlsverify',null);this['setDataValue'](_0x409a('0x43'),null);this[_0x409a('0x4')](_0x409a('0x44'),null);this['setDataValue'](_0x409a('0x45'),null);this[_0x409a('0x4')](_0x409a('0x46'),'no');break;case 0x2:this[_0x409a('0x4')](_0x409a('0x20'),_0x409a('0x40'));this[_0x409a('0x4')]('encryption',_0x409a('0x28'));this[_0x409a('0x4')](_0x409a('0x41'),_0x409a('0x28'));this['setDataValue'](_0x409a('0x42'),_0x409a('0x28'));this[_0x409a('0x4')](_0x409a('0x47'),_0x409a('0x28'));this[_0x409a('0x4')]('dtlsenable',_0x409a('0x28'));this[_0x409a('0x4')]('dtlsverify','no');this[_0x409a('0x4')](_0x409a('0x43'),_0x409a('0x48'));this[_0x409a('0x4')](_0x409a('0x44'),_0x43f18d[_0x409a('0x44')]||_0x409a('0x49'));this['setDataValue'](_0x409a('0x45'),_0x43f18d[_0x409a('0x45')]||_0x409a('0x4a'));this['setDataValue']('rtcp_mux',_0x409a('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x409a('0x3c')],'set':function(_0x240f29){this['setDataValue']('permissions',_0x240f29?_0x240f29[_0x409a('0x21')](','):[]);},'get':function(){return this[_0x409a('0xb')](_0x409a('0x4b'))?_[_0x409a('0x4c')](this[_0x409a('0xb')](_0x409a('0x4b'))[_0x409a('0x22')](','),function(_0x3c74f7){return parseInt(_0x3c74f7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x409a('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x409a('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x409a('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x409a('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x409a('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x409a('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x409a('0x15')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x409a('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x409a('0x4d')],'get':function(){return this[_0x409a('0xb')](_0x409a('0x4e'))?this['getDataValue'](_0x409a('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x409a('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x409a('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2e390d){if(typeof _0x2e390d==='string'){var _0x1cbeda=_0x2e390d==='1'?!![]:_0x2e390d==='0'?![]:_0x2e390d===_0x409a('0x4f')?!![]:_0x2e390d===_0x409a('0x50')?![]:![];this[_0x409a('0x4')](_0x409a('0x51'),_0x1cbeda);}else{this[_0x409a('0x4')](_0x409a('0x51'),_0x2e390d);}}},'blocked':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![],'set':function(_0x4f6e3a){this[_0x409a('0x4')]('blocked',_0x4f6e3a);if(_0x4f6e3a===!![]){this[_0x409a('0x4')](_0x409a('0x52'),moment());this[_0x409a('0x4')](_0x409a('0x53'),0x0);}else{this[_0x409a('0x4')](_0x409a('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0x409a('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x409a('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x409a('0x12')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x409a('0x10')](0x5)[_0x409a('0x54')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x409a('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x409a('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x409a('0x12')],'defaultValue':![]}}; \ No newline at end of file +var _0x4bc6=['loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','accept','refuse','originate','uas','fingerprint','active','passive','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt'];(function(_0x19e032,_0x2c4dd7){var _0x109dfc=function(_0x5edc1){while(--_0x5edc1){_0x19e032['push'](_0x19e032['shift']());}};_0x109dfc(++_0x2c4dd7);}(_0x4bc6,0xb6));var _0x64bc=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4bc6[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x64bc('0x0'));var moment=require(_0x64bc('0x1'));var util=require(_0x64bc('0x2'));var _=require(_0x64bc('0x3'));module[_0x64bc('0x4')]={'name':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1eaa62){this[_0x64bc('0x6')]('name',_0x1eaa62);this[_0x64bc('0x6')]('defaultuser',_0x1eaa62);},'comment':_0x64bc('0x7')},'fullname':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'set':function(_0xea688b){this['setDataValue'](_0x64bc('0x8'),_0xea688b);this[_0x64bc('0x6')](_0x64bc('0x9'),util['format'](_0x64bc('0xa'),_0xea688b,this[_0x64bc('0xb')](_0x64bc('0xc'))));}},'alias':{'type':Sequelize[_0x64bc('0x5')]},'email':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'unique':_0x64bc('0xd'),'validate':{'isEmail':!![]},'set':function(_0x120d3c){if(_0x120d3c){this[_0x64bc('0x6')](_0x64bc('0xd'),_0x120d3c[_0x64bc('0xe')]());}}},'role':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x10'),_0x64bc('0x11'),_0x64bc('0x12'),_0x64bc('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x64bc('0x14')},'internal':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x3178e6){this[_0x64bc('0x6')](_0x64bc('0xc'),_0x3178e6);this[_0x64bc('0x6')](_0x64bc('0x16'),_0x3178e6);this[_0x64bc('0x6')](_0x64bc('0x9'),util['format'](_0x64bc('0xa'),this[_0x64bc('0xb')]('fullname'),_0x3178e6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x64bc('0x5')]},'address':{'type':Sequelize[_0x64bc('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x64bc('0x5')]},'city':{'type':Sequelize[_0x64bc('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x64bc('0x18')]},'voicePause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':_0x64bc('0x19')},'lastPauseAt':{'type':Sequelize[_0x64bc('0x18')]},'chatCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x64bc('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x64bc('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'defaultValue':_0x64bc('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x64bc('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x1b'),_0x64bc('0x11'),'peer'),'allowNull':!![],'defaultValue':_0x64bc('0x1b')},'context':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'defaultValue':_0x64bc('0x1c')},'callingpres':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x1d'),_0x64bc('0x1e'),'ALLOWED_FAILED_SCREEN',_0x64bc('0x1f'),_0x64bc('0x20'),_0x64bc('0x21'),'PROHIB_FAILED_SCREEN',_0x64bc('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x64bc('0x23'),'set':function(_0x435c54){this[_0x64bc('0x6')](_0x64bc('0x24'),_0x435c54?_0x435c54[_0x64bc('0x25')](','):null);},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x24'))?this[_0x64bc('0xb')]('transport')[_0x64bc('0x26')](','):null;},'comment':_0x64bc('0x27')},'dtmfmode':{'type':Sequelize[_0x64bc('0xf')]('rfc2833',_0x64bc('0x28'),_0x64bc('0x29'),_0x64bc('0x2a'),_0x64bc('0x2b')),'allowNull':!![],'defaultValue':_0x64bc('0x2c')},'directmedia':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no',_0x64bc('0x2e'),_0x64bc('0x2f'),_0x64bc('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x64bc('0x31'),'set':function(_0x43fff5){this[_0x64bc('0x6')](_0x64bc('0x32'),_0x43fff5?_0x43fff5[_0x64bc('0x25')](','):null);},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x32'))?this[_0x64bc('0xb')](_0x64bc('0x32'))[_0x64bc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x64bc('0x5')]},'namedcallgroup':{'type':Sequelize[_0x64bc('0x5')]},'pickupgroup':{'type':Sequelize[_0x64bc('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x64bc('0x5')]},'language':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x64bc('0x5')]},'disallow':{'type':Sequelize[_0x64bc('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5b61f1){this[_0x64bc('0x6')](_0x64bc('0x33'),_0x5b61f1?_0x5b61f1[_0x64bc('0x25')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x33'))?this[_0x64bc('0xb')](_0x64bc('0x33'))[_0x64bc('0x26')](';'):null;},'comment':_0x64bc('0x34')},'autoframing':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'set':function(_0x1220ae){this[_0x64bc('0x6')]('insecure',_0x1220ae?_0x1220ae[_0x64bc('0x25')](','):null);},'get':function(){return this[_0x64bc('0xb')]('insecure')?this[_0x64bc('0xb')](_0x64bc('0x35'))[_0x64bc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x36'),_0x64bc('0x37'),_0x64bc('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x64bc('0xf')]('uac','uas'),'allowNull':!![],'defaultValue':_0x64bc('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x64bc('0x2d')},'keepalive':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x64bc('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no',_0x64bc('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x64bc('0x3b'),_0x64bc('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x64bc('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x64bc('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x64bc('0xf')](_0x64bc('0x2d'),'no',_0x64bc('0x2e'),_0x64bc('0x2f'),_0x64bc('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x64bc('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x64bc('0x3e')]},'showWebBar':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0,'set':function(_0x10c382){this[_0x64bc('0x6')](_0x64bc('0x3f'),_0x10c382);var _0x1ad00e=this[_0x64bc('0x40')]({'plain':!![]});switch(_0x10c382){case 0x0:case 0x1:var _0x138fe3=_0x1ad00e[_0x64bc('0x24')]?_[_0x64bc('0x41')](_0x1ad00e[_0x64bc('0x24')])?_0x1ad00e[_0x64bc('0x24')][_0x64bc('0x25')]():_0x1ad00e[_0x64bc('0x24')]:_0x64bc('0x23');if(_0x138fe3===_0x64bc('0x42')){_0x138fe3=_0x64bc('0x23');}this[_0x64bc('0x6')](_0x64bc('0x24'),_0x138fe3);this[_0x64bc('0x6')](_0x64bc('0x43'),'no');this[_0x64bc('0x6')](_0x64bc('0x44'),null);this[_0x64bc('0x6')](_0x64bc('0x45'),null);this[_0x64bc('0x6')](_0x64bc('0x46'),null);this['setDataValue'](_0x64bc('0x47'),null);this[_0x64bc('0x6')]('dtlsverify',null);this[_0x64bc('0x6')](_0x64bc('0x48'),null);this['setDataValue'](_0x64bc('0x49'),null);this[_0x64bc('0x6')](_0x64bc('0x4a'),null);this[_0x64bc('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x64bc('0x6')](_0x64bc('0x24'),'wss');this[_0x64bc('0x6')]('encryption','yes');this[_0x64bc('0x6')](_0x64bc('0x44'),_0x64bc('0x2d'));this[_0x64bc('0x6')](_0x64bc('0x45'),'yes');this[_0x64bc('0x6')](_0x64bc('0x46'),_0x64bc('0x2d'));this[_0x64bc('0x6')](_0x64bc('0x47'),'yes');this['setDataValue'](_0x64bc('0x4b'),'no');this['setDataValue']('dtlssetup',_0x64bc('0x4c'));this[_0x64bc('0x6')](_0x64bc('0x49'),_0x1ad00e['dtlscertfile']||_0x64bc('0x4d'));this[_0x64bc('0x6')](_0x64bc('0x4a'),_0x1ad00e[_0x64bc('0x4a')]||_0x64bc('0x4e'));this[_0x64bc('0x6')](_0x64bc('0x4f'),_0x64bc('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x64bc('0x3e')],'set':function(_0x360a3d){this['setDataValue']('permissions',_0x360a3d?_0x360a3d[_0x64bc('0x25')](','):[]);},'get':function(){return this[_0x64bc('0xb')](_0x64bc('0x50'))?_[_0x64bc('0x51')](this[_0x64bc('0xb')](_0x64bc('0x50'))['split'](','),function(_0x3c6e09){return parseInt(_0x3c6e09,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x64bc('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x64bc('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x64bc('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x64bc('0x52')],'get':function(){return this['getDataValue'](_0x64bc('0x53'))?this[_0x64bc('0xb')](_0x64bc('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x64bc('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4efa50){if(typeof _0x4efa50==='string'){var _0x4e1d55=_0x4efa50==='1'?!![]:_0x4efa50==='0'?![]:_0x4efa50==='true'?!![]:_0x4efa50===_0x64bc('0x54')?![]:![];this['setDataValue']('screenrecording',_0x4e1d55);}else{this[_0x64bc('0x6')](_0x64bc('0x55'),_0x4efa50);}}},'blocked':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![],'set':function(_0x50684b){this[_0x64bc('0x6')](_0x64bc('0x56'),_0x50684b);if(_0x50684b===!![]){this[_0x64bc('0x6')](_0x64bc('0x57'),moment());this[_0x64bc('0x6')](_0x64bc('0x58'),0x0);}else{this[_0x64bc('0x6')](_0x64bc('0x57'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x64bc('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x64bc('0x15')](0x5)[_0x64bc('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x64bc('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 46a92b9..7fcf1f9 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 _0x807b=['dialActive','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','lower','toString','asc','desc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','busy','slice','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','OpenTabs','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','socket.io-emitter','redis','./user.socket','defaults','client','http','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','destroy','get','role','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','name','send','fieldName','key','password','User','include','query','userSetting','UserSetting','attributes','push','rows','openTabs','true','length','sms','dataValues','fax','mail','openchannel','whatsapp','all','show','model','rawAttributes','salt','filters','intersection','fields','merge','chat','update','body','describe','addContacts','params','ids','Setting','findById','validatePasswordPattern','max','internal','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','agent','permissions','101','103','113','110','104','105','106','107','108','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','userProfileId','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','findAll','isEmpty','autoAssociation','compact','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','voice','VoiceQueue','online','format','SIP/%s','each','UserVoiceQueueRt','removeQueues','remove','emit','Queue:remove','addAvatar','userpic','file','getAvatar','server/files/images/logos/default_profile.png','download','join','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','keys','sort','where','hasOwnProperty','includeAll','CmList','List','Tags','color','tag','nolimit','Queue','order','pick','options','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','resolve','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','%s%s','Pause','manual','getTeams','Team','addTeams','getVoiceQueues','Voice','getChatQueues','setDataValue','Chat','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','getDataValue','Queue:save','TeamVoicePrefix','getSmsQueues','removeAgent','UserVoicePrefix','VoicePrefixId','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','omit','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','lastName','CmContact','Contact'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0x807b,0x1c1));var _0xb807=function(_0x5f45bf,_0x29322e){_0x5f45bf=_0x5f45bf-0x0;var _0x385e0d=_0x807b[_0x5f45bf];return _0x385e0d;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xb807('0x0'));var path=require(_0xb807('0x1'));var fs=require('fs');var _=require(_0xb807('0x2'));var squel=require(_0xb807('0x3'));var jayson=require(_0xb807('0x4'));var Redis=require('ioredis');var authService=require(_0xb807('0x5'));var qs=require(_0xb807('0x6'));var logger=require(_0xb807('0x7'))(_0xb807('0x8'));var utils=require(_0xb807('0x9'));var config=require('../../config/environment');var licenseUtil=require(_0xb807('0xa'));var db=require('../../mysqldb')['db'];var socket=require(_0xb807('0xb'))(new Redis(config[_0xb807('0xc')]));require(_0xb807('0xd'))['register'](socket);config[_0xb807('0xc')]=_[_0xb807('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var client=jayson[_0xb807('0xf')][_0xb807('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4f8565,_0x1cca21,_0x4017db,_0x39fef3){return new BPromise(function(_0x36a3f7,_0x493873){var _0x11c307=_0x39fef3||client;return _0x11c307[_0xb807('0x11')](_0x4f8565,_0x4017db)[_0xb807('0x12')](function(_0x4e4d0c){logger[_0xb807('0x13')]('User,\x20%s,\x20%s',_0x1cca21,_0xb807('0x14'));logger[_0xb807('0x15')](_0xb807('0x16'),_0x1cca21,'request\x20sent',JSON[_0xb807('0x17')](_0x4e4d0c));if(_0x4e4d0c[_0xb807('0x18')]){if(_0x4e4d0c[_0xb807('0x18')][_0xb807('0x19')]===0x1f4){logger[_0xb807('0x18')](_0xb807('0x1a'),_0x1cca21,_0x4e4d0c[_0xb807('0x18')][_0xb807('0x1b')]);return _0x493873(_0x4e4d0c[_0xb807('0x18')]['message']);}logger[_0xb807('0x18')](_0xb807('0x1a'),_0x1cca21,_0x4e4d0c[_0xb807('0x18')][_0xb807('0x1b')]);return _0x36a3f7(_0x4e4d0c[_0xb807('0x18')][_0xb807('0x1b')]);}else{logger[_0xb807('0x13')]('User,\x20%s,\x20%s',_0x1cca21,_0xb807('0x14'));_0x36a3f7(_0x4e4d0c[_0xb807('0x1c')][_0xb807('0x1b')]);}})[_0xb807('0x1d')](function(_0x1316de){logger['error']('User,\x20%s,\x20%s',_0x1cca21,_0x1316de);_0x493873(_0x1316de);});});}function respondWithStatusCode(_0x10a803,_0x21857){_0x21857=_0x21857||0xcc;return function(_0x59d1f7){if(_0x59d1f7){return _0x10a803[_0xb807('0x1e')](_0x21857);}return _0x10a803[_0xb807('0x1f')](_0x21857)[_0xb807('0x20')]();};}function respondWithResult(_0x1b1026,_0x5e1367){_0x5e1367=_0x5e1367||0xc8;return function(_0x8369){if(_0x8369){return _0x1b1026[_0xb807('0x1f')](_0x5e1367)[_0xb807('0x21')](_0x8369);}};}function respondWithFilteredResult(_0x2ecc02,_0x106070){return function(_0x56a8ed){if(_0x56a8ed){var _0x5f0af1=typeof _0x106070[_0xb807('0x22')]===_0xb807('0x23')&&typeof _0x106070['limit']===_0xb807('0x23');var _0x45fab5=_0x56a8ed[_0xb807('0x24')];var _0x114779=_0x5f0af1?0x0:_0x106070['offset'];var _0x3792af=_0x5f0af1?_0x56a8ed[_0xb807('0x24')]:_0x106070[_0xb807('0x22')]+_0x106070[_0xb807('0x25')];var _0x3a3dd1;if(_0x3792af>=_0x45fab5){_0x3792af=_0x45fab5;_0x3a3dd1=0xc8;}else{_0x3a3dd1=0xce;}_0x2ecc02['status'](_0x3a3dd1);return _0x2ecc02[_0xb807('0x26')](_0xb807('0x27'),_0x114779+'-'+_0x3792af+'/'+_0x45fab5)['json'](_0x56a8ed);}return null;};}function saveUpdates(_0x5065be){return function(_0x393d5f){if(_0x393d5f){return _0x393d5f['update'](_0x5065be)[_0xb807('0x12')](function(_0x3123df){return _0x3123df;});}return null;};}function removeEntity(_0x4634ae){return function(_0x101154){if(_0x101154){return _0x101154[_0xb807('0x28')]()[_0xb807('0x12')](function(){var _0x34e798=_0x101154[_0xb807('0x29')]({'plain':!![]});if(_0x34e798[_0xb807('0x2a')]===_0xb807('0x2b'))return;var _0xf833e0=[{'name':_0xb807('0x2c'),'value':_0xb807('0x2d'),'ignore':!![]},{'name':_0xb807('0x2e'),'value':'agent','ignore':![]},{'name':_0xb807('0x2f'),'value':_0xb807('0x30'),'ignore':![]}];var _0x343c2a=_(_0xf833e0)[_0xb807('0x31')](_0xb807('0x32'))[_0xb807('0x33')]('value')[_0xb807('0x34')]();if(_[_0xb807('0x35')](_0x343c2a,_0x34e798[_0xb807('0x2a')])){return;}var _0xfa28c3=_[_0xb807('0x36')](_0xf833e0,[_0xb807('0x34'),_0x34e798[_0xb807('0x2a')]])['name'];return db[_0xb807('0x37')][_0xb807('0x28')]({'where':{'type':_0xfa28c3,'resourceId':_0x34e798['id']}})['then'](function(){return _0x101154;});})[_0xb807('0x12')](function(){_0x4634ae[_0xb807('0x1f')](0xcc)[_0xb807('0x20')]();});}};}function handleEntityNotFound(_0x37ae5b){return function(_0x2f0718){if(!_0x2f0718){_0x37ae5b[_0xb807('0x1e')](0x194);}return _0x2f0718;};}function handleError(_0x1825c3,_0x781f7d){_0x781f7d=_0x781f7d||0x1f4;return function(_0x270c8a){logger[_0xb807('0x18')](_0x270c8a['stack']);if(_0x270c8a[_0xb807('0x38')]){delete _0x270c8a['name'];}_0x1825c3[_0xb807('0x1f')](_0x781f7d)[_0xb807('0x39')](_0x270c8a);};}exports['index']=function(_0x118abc,_0x1f988f){var _0x3b1e5e={},_0x1a551d={'count':0x0,'rows':[]};var _0x2bf57d=_(db['User']['rawAttributes'])[_0xb807('0x33')](function(_0xb27f8b){return{'name':_0xb27f8b[_0xb807('0x3a')],'type':_0xb27f8b['type'][_0xb807('0x3b')]};})['filter'](function(_0x168aaf){return!_[_0xb807('0x35')]([_0xb807('0x3c'),'salt'],_0x168aaf[_0xb807('0x38')]);})[_0xb807('0x34')]();_0x3b1e5e=qs['getOptions'](_0x2bf57d,_0x118abc);var _0x392100={'where':_0x3b1e5e['where']};return db[_0xb807('0x3d')][_0xb807('0x24')](_0x392100)[_0xb807('0x12')](function(_0x17fde6){_0x1a551d[_0xb807('0x24')]=_0x17fde6;if(_0x118abc['query']['includeAll']){_0x3b1e5e[_0xb807('0x3e')]=[{'all':!![]}];}if(_0x118abc[_0xb807('0x3f')][_0xb807('0x40')]==='true'){_0x3b1e5e[_0xb807('0x3e')]=[{'model':db[_0xb807('0x41')],'as':_0xb807('0x40')}];}if(!_['includes'](_0x3b1e5e['attributes'],'id')){_0x3b1e5e[_0xb807('0x42')][_0xb807('0x43')]('id');}return db[_0xb807('0x3d')]['findAll'](_0x3b1e5e);})['then'](function(_0x38ce02){_0x1a551d[_0xb807('0x44')]=_0x38ce02;if(_0x118abc[_0xb807('0x3f')][_0xb807('0x45')]===_0xb807('0x46')){var _0x48817f=[];for(var _0x477516=0x0;_0x477516<_0x1a551d[_0xb807('0x44')][_0xb807('0x47')];_0x477516++){_0x48817f[_0xb807('0x43')](get_open_tabs('chat',_0x1a551d['rows'][_0x477516]['dataValues']));_0x48817f[_0xb807('0x43')](get_open_tabs(_0xb807('0x48'),_0x1a551d['rows'][_0x477516][_0xb807('0x49')]));_0x48817f[_0xb807('0x43')](get_open_tabs(_0xb807('0x4a'),_0x1a551d[_0xb807('0x44')][_0x477516][_0xb807('0x49')]));_0x48817f[_0xb807('0x43')](get_open_tabs(_0xb807('0x4b'),_0x1a551d['rows'][_0x477516][_0xb807('0x49')]));_0x48817f[_0xb807('0x43')](get_open_tabs(_0xb807('0x4c'),_0x1a551d[_0xb807('0x44')][_0x477516][_0xb807('0x49')]));_0x48817f[_0xb807('0x43')](get_open_tabs(_0xb807('0x4d'),_0x1a551d['rows'][_0x477516]['dataValues']));}return BPromise[_0xb807('0x4e')](_0x48817f)['then'](function(){return _0x1a551d;});}else{return _0x1a551d;}})[_0xb807('0x12')](respondWithFilteredResult(_0x1f988f,_0x3b1e5e))[_0xb807('0x1d')](handleError(_0x1f988f,null));};exports[_0xb807('0x4f')]=function(_0x2df5cc,_0x387a16){var _0x5f058e={'raw':![],'where':{'id':_0x2df5cc['params']['id']}},_0x52edfb={};_0x52edfb[_0xb807('0x50')]=_['differenceBy'](_['keys'](db[_0xb807('0x3d')][_0xb807('0x51')]),[_0xb807('0x3c'),_0xb807('0x52')]);_0x52edfb['query']=_['keys'](_0x2df5cc[_0xb807('0x3f')]);_0x52edfb[_0xb807('0x53')]=_[_0xb807('0x54')](_0x52edfb[_0xb807('0x50')],_0x52edfb[_0xb807('0x3f')]);_0x5f058e[_0xb807('0x42')]=_['intersection'](_0x52edfb['model'],qs[_0xb807('0x55')](_0x2df5cc[_0xb807('0x3f')][_0xb807('0x55')]));_0x5f058e['attributes']=_0x5f058e[_0xb807('0x42')][_0xb807('0x47')]?_0x5f058e[_0xb807('0x42')]:_0x52edfb[_0xb807('0x50')];if(_0x2df5cc['query']['includeAll']){_0x5f058e[_0xb807('0x3e')]=[{'all':!![]}];}if(_0x2df5cc[_0xb807('0x3f')]['userSetting']===_0xb807('0x46')){_0x5f058e[_0xb807('0x3e')]=[{'model':db[_0xb807('0x41')],'as':_0xb807('0x40')}];}_0x5f058e=_[_0xb807('0x56')]({},_0x5f058e,_0x2df5cc['options']);if(!_[_0xb807('0x35')](_0x5f058e[_0xb807('0x42')],'id')){_0x5f058e[_0xb807('0x42')][_0xb807('0x43')]('id');}return db[_0xb807('0x3d')][_0xb807('0x36')](_0x5f058e)[_0xb807('0x12')](handleEntityNotFound(_0x387a16,null))[_0xb807('0x12')](function(_0x3ed9a7){var _0x4dab73=[];values=_0x3ed9a7;if(_0x2df5cc[_0xb807('0x3f')][_0xb807('0x45')]===_0xb807('0x46')){_0x4dab73[_0xb807('0x43')](get_open_tabs(_0xb807('0x57'),_0x3ed9a7['dataValues']));_0x4dab73[_0xb807('0x43')](get_open_tabs('sms',_0x3ed9a7[_0xb807('0x49')]));_0x4dab73[_0xb807('0x43')](get_open_tabs(_0xb807('0x4c'),_0x3ed9a7['dataValues']));_0x4dab73[_0xb807('0x43')](get_open_tabs('whatsapp',_0x3ed9a7[_0xb807('0x49')]));_0x4dab73[_0xb807('0x43')](get_open_tabs(_0xb807('0x4a'),_0x3ed9a7[_0xb807('0x49')]));_0x4dab73[_0xb807('0x43')](get_open_tabs(_0xb807('0x4b'),_0x3ed9a7['dataValues']));return BPromise['all'](_0x4dab73);}else{return values;}})[_0xb807('0x12')](function(){return values;})['then'](respondWithResult(_0x387a16,null))[_0xb807('0x1d')](handleError(_0x387a16,null));};exports[_0xb807('0x58')]=function(_0x334ce3,_0x3b0ca3){if(_0x334ce3['body']['id']){delete _0x334ce3['body']['id'];}delete _0x334ce3['body'][_0xb807('0x2a')];return db[_0xb807('0x3d')][_0xb807('0x36')]({'where':{'id':_0x334ce3['params']['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x3b0ca3,null))[_0xb807('0x12')](saveUpdates(_0x334ce3[_0xb807('0x59')],null))[_0xb807('0x12')](respondWithResult(_0x3b0ca3,null))['catch'](handleError(_0x3b0ca3,null));};exports[_0xb807('0x5a')]=function(_0x313c3d,_0x58abb1){return db[_0xb807('0x3d')][_0xb807('0x5a')]()[_0xb807('0x12')](respondWithResult(_0x58abb1,null))[_0xb807('0x1d')](handleError(_0x58abb1,null));};exports[_0xb807('0x5b')]=function(_0x52c414,_0x201717){return db[_0xb807('0x3d')]['find']({'where':{'id':_0x52c414[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x201717,null))[_0xb807('0x12')](function(_0x1fc7ac){if(_0x1fc7ac){return _0x1fc7ac[_0xb807('0x5b')](_0x52c414['body'][_0xb807('0x5d')],_['omit'](_0x52c414[_0xb807('0x59')],[_0xb807('0x5d'),'id'])||{});}})[_0xb807('0x12')](respondWithResult(_0x201717,null))[_0xb807('0x1d')](handleError(_0x201717,null));};function validateUser(_0x2186e0){return new BPromise(function(_0x266ba9,_0x57716d){if(_0x2186e0['internal'])return _0x266ba9(_0x2186e0);return db[_0xb807('0x5e')][_0xb807('0x5f')](0x1)[_0xb807('0x12')](function(_0x43164b){if(_0x43164b['securePassword'])authService[_0xb807('0x60')](_0x2186e0[_0xb807('0x3c')]);db[_0xb807('0x3d')][_0xb807('0x61')](_0xb807('0x62'))[_0xb807('0x12')](function(_0x965fe0){if(_[_0xb807('0x63')](_0x965fe0)){_0x2186e0[_0xb807('0x62')]=_0x43164b['min_internal']||0x1;return;}if(_[_0xb807('0x63')](_0x43164b[_0xb807('0x64')])||_0x43164b['min_internal']===_0x965fe0){_0x2186e0['internal']=_0x965fe0+0x1;return;}if(_0x43164b[_0xb807('0x64')]>_0x965fe0){_0x2186e0[_0xb807('0x62')]=_0x43164b[_0xb807('0x64')];return;}return db['sequelize'][_0xb807('0x3f')](_0xb807('0x65'),{'type':db[_0xb807('0x66')][_0xb807('0x67')][_0xb807('0x68')]})[_0xb807('0x12')](function(_0x32db9f){if(_0x32db9f&&_0x32db9f[_0xb807('0x47')]){for(var _0x145aaf=0x0,_0x29ef9a=_0x32db9f[_0xb807('0x47')];_0x145aaf<_0x29ef9a&&_['isNil'](_0x2186e0['internal']);_0x145aaf++){if(_0x43164b[_0xb807('0x64')]<=_0x32db9f[_0x145aaf][_0xb807('0x69')]){_0x2186e0[_0xb807('0x62')]=_0x32db9f[_0x145aaf]['from'];}else if(_0x43164b['min_internal']>_0x32db9f[_0x145aaf][_0xb807('0x69')]&&_0x43164b[_0xb807('0x64')]<=_0x32db9f[_0x145aaf]['to']){_0x2186e0[_0xb807('0x62')]=_0x43164b[_0xb807('0x64')];}}}if(_[_0xb807('0x63')](_0x2186e0['internal'])){_0x2186e0['internal']=_0x965fe0+0x1;}return _0x266ba9(_0x2186e0);});});})['catch'](function(_0x1c3502){_0x57716d(_0x1c3502);});});}function updateUser(_0x509ec9){return new BPromise(function(_0x23e1bf,_0x402b77){try{if(_0x509ec9['voicemail']){_0x509ec9[_0xb807('0x6a')]=_0x509ec9[_0xb807('0x62')];_0x509ec9[_0xb807('0x6b')]={'mailbox':_0x509ec9['internal'],'password':_0x509ec9[_0xb807('0x3c')],'fullname':_0x509ec9[_0xb807('0x6c')],'email':_0x509ec9['email']};}if(_0x509ec9[_0xb807('0x2a')]===_0xb807('0x6d')){if(!_0x509ec9[_0xb807('0x6e')])_0x509ec9[_0xb807('0x6e')]=[_0xb807('0x6f'),'102',_0xb807('0x70'),_0xb807('0x71'),_0xb807('0x72'),_0xb807('0x73'),_0xb807('0x74'),_0xb807('0x75'),_0xb807('0x76'),_0xb807('0x77'),'109',_0xb807('0x78'),_0xb807('0x79'),_0xb807('0x7a'),_0xb807('0x7b')];}_0x23e1bf(_0x509ec9);}catch(_0x2d3c3c){_0x402b77(_0x2d3c3c);}});}exports[_0xb807('0x7c')]=function(_0x4833c6,_0x179e06){if(_0x4833c6['user'][_0xb807('0x2a')]==='agent')throw new Error(_0xb807('0x7d'));if(_0x4833c6['body'][_0xb807('0x2a')]===_0xb807('0x2d')&&_0x4833c6['user'][_0xb807('0x2a')]!==_0xb807('0x2b')){throw new Error(_0xb807('0x7e'));}if(_0x4833c6[_0xb807('0x59')][_0xb807('0x2a')]===_0xb807('0x2b')&&_0x4833c6['user'][_0xb807('0x2a')]!==_0xb807('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xb807('0x7f')]([_0x4833c6[_0xb807('0x59')]])[_0xb807('0x12')](function(){return validateUser(_0x4833c6['body']);})['then'](function(_0x2622fe){return updateUser(_0x2622fe)[_0xb807('0x12')](function(_0x51f584){if(_0x51f584[_0xb807('0x2a')]===_0xb807('0x2b')){_0x51f584['settingsEnabled']=_0x4833c6['user']['settingsEnabled'];delete _0x51f584[_0xb807('0x80')];}return _0x51f584;});})[_0xb807('0x12')](function(_0x2587b3){return db[_0xb807('0x3d')][_0xb807('0x7c')](_0x2587b3,{'include':[{'model':db[_0xb807('0x6b')],'as':_0xb807('0x6b')}]});})[_0xb807('0x12')](function(_0xaa49be){if(_0x4833c6[_0xb807('0x59')]['role']==='user')return _0xaa49be;if(_0x4833c6[_0xb807('0x2d')][_0xb807('0x2a')]!==_0xb807('0x2d'))return _0xaa49be;return db[_0xb807('0x81')]['find']({'where':{'name':_0xaa49be[_0xb807('0x2a')]===_0xb807('0x6d')?_0xb807('0x2e'):_0xb807('0x2f'),'userProfileId':_0x4833c6[_0xb807('0x2d')]['userProfileId']},'raw':!![]})[_0xb807('0x12')](function(_0x4515c5){if(!_0x4515c5||_0x4515c5['autoAssociation']!=0x0)return _0xaa49be;return db[_0xb807('0x37')][_0xb807('0x7c')]({'name':_0xaa49be['name'],'resourceId':_0xaa49be['id'],'type':_0x4515c5['name'],'sectionId':_0x4515c5['id']},{})[_0xb807('0x12')](function(){return _0xaa49be;});})['catch'](function(_0x1d676c){logger[_0xb807('0x18')](_0xb807('0x82'),_0x1d676c);throw _0x1d676c;});})[_0xb807('0x12')](respondWithResult(_0x179e06,0xc9))[_0xb807('0x1d')](handleError(_0x179e06,null));};exports[_0xb807('0x83')]=function(_0x3a6abc,_0xd64518){var _0x413946=_0x3a6abc[_0xb807('0x59')];var _0x31f75b=[];if(_0x3a6abc[_0xb807('0x2d')]['role']==='agent')throw new Error('Unauthorized');if(_[_0xb807('0x84')](_0x413946,[_0xb807('0x2a'),_0xb807('0x2d')])&&_0x3a6abc[_0xb807('0x2d')][_0xb807('0x2a')]!=='admin'){throw new Error(_0xb807('0x7e'));}if(_[_0xb807('0x84')](_0x413946,['role','admin'])&&_0x3a6abc[_0xb807('0x2d')]['role']!==_0xb807('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x413946)[_0xb807('0x12')](function(){return validateUser(_0x413946[0x0]);})['then'](function(){for(var _0x34b91c=0x1;_0x34b91c<_0x413946[_0xb807('0x47')];_0x34b91c++){var _0x3f06bb=_0x413946[_0x34b91c-0x1]['internal'];if(!_0x413946[_0x34b91c][_0xb807('0x62')])_0x413946[_0x34b91c][_0xb807('0x62')]=_0x3f06bb+0x1;_0x31f75b[_0xb807('0x43')](validateUser(_0x413946[_0x34b91c]));}return BPromise['all'](_0x31f75b);})[_0xb807('0x12')](function(){_0x31f75b=[];for(var _0x156d98=0x0;_0x156d98<_0x413946[_0xb807('0x47')];_0x156d98++){_0x31f75b[_0xb807('0x43')](updateUser(_0x413946[_0x156d98]));}return BPromise[_0xb807('0x4e')](_0x31f75b);})[_0xb807('0x12')](function(){return BPromise['each'](_0x413946,function(_0x3eb153){return db[_0xb807('0x3d')][_0xb807('0x7c')](_0x3eb153,{'include':[{'model':db[_0xb807('0x6b')],'as':_0xb807('0x6b')}]})['then'](function(_0x48f53a){_0x3eb153['id']=_0x48f53a['id'];return _0x3eb153;});});})['then'](function(_0x57b5ec){if(_0x3a6abc[_0xb807('0x59')][_0xb807('0x2a')]==='user')return _0x57b5ec;if(_0x3a6abc['user'][_0xb807('0x2a')]!==_0xb807('0x2d'))return _0x57b5ec;var _0xab1a3f=_[_0xb807('0x84')](_0x57b5ec,function(_0x181c4d){return _0x181c4d[_0xb807('0x2a')]===_0xb807('0x6d')||_0x181c4d['role']==='telephone';});if(!_0xab1a3f)return _0x57b5ec;return db['UserProfileSection'][_0xb807('0x85')]({'where':{'name':{'$or':['Agents',_0xb807('0x2f')]},'userProfileId':_0x3a6abc[_0xb807('0x2d')][_0xb807('0x80')]},'raw':!![]})[_0xb807('0x12')](function(_0x44e9da){if(_[_0xb807('0x86')](_0x44e9da)||!_[_0xb807('0x84')](_0x44e9da,[_0xb807('0x87'),0x0]))return _0x57b5ec;_0x31f75b=[];var _0x43e7d5=_(_0x44e9da)[_0xb807('0x33')](function(_0x5daf1b){if(_0x5daf1b[_0xb807('0x87')]===0x1)return;return _0x5daf1b[_0xb807('0x38')]===_0xb807('0x2e')?_0xb807('0x6d'):_0xb807('0x30');})[_0xb807('0x88')]()[_0xb807('0x34')]();for(var _0x1ac299=0x0;_0x1ac299<_0x57b5ec['length'];_0x1ac299++){if(!_[_0xb807('0x35')](_0x43e7d5,_0x57b5ec[_0x1ac299][_0xb807('0x2a')]))return;var _0x1cb57b=_0x57b5ec[_0x1ac299][_0xb807('0x2a')]===_0xb807('0x6d')?'Agents':_0xb807('0x2f');_0x31f75b[_0xb807('0x43')](db[_0xb807('0x37')][_0xb807('0x7c')]({'name':_0x57b5ec[_0x1ac299][_0xb807('0x38')],'resourceId':_0x57b5ec[_0x1ac299]['id'],'type':_0x1cb57b,'sectionId':_[_0xb807('0x36')](_0x44e9da,[_0xb807('0x38'),_0x1cb57b])['id']},{}));}return BPromise[_0xb807('0x4e')](_0x31f75b);});})[_0xb807('0x12')](respondWithResult(_0xd64518,0xc9))['catch'](handleError(_0xd64518,null));};exports['changePassword']=function(_0x4ab29c,_0x20f5a0){if(_0x4ab29c['body']['id']){delete _0x4ab29c['body']['id'];}return db['User']['find']({'where':{'id':_0x4ab29c[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](function(_0x316497){if(!_0x316497)return null;if(_0x316497['id']===_0x4ab29c[_0xb807('0x2d')]['id']){if(!_0x4ab29c[_0xb807('0x59')]['oldPassword']||!_0x4ab29c[_0xb807('0x59')][_0xb807('0x89')]){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x8c'));}if(!_0x316497[_0xb807('0x8d')](_0x4ab29c[_0xb807('0x59')][_0xb807('0x8e')])){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x8f'));}if(_0x4ab29c[_0xb807('0x59')][_0xb807('0x8e')]===_0x4ab29c[_0xb807('0x59')][_0xb807('0x89')]){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x90'));}}else if(_0x4ab29c[_0xb807('0x2d')]['role']==='admin'){if(!_0x4ab29c[_0xb807('0x59')]['newPassword']){throw new db[(_0xb807('0x8a'))]['ValidationError'](_0xb807('0x91'));}}else if(_0x4ab29c[_0xb807('0x2d')][_0xb807('0x2a')]===_0xb807('0x2d')){if(!_0x4ab29c[_0xb807('0x59')][_0xb807('0x89')]){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x91'));}if(_0x316497[_0xb807('0x2a')]!==_0xb807('0x6d')){throw new db[(_0xb807('0x8a'))]['ValidationError'](_0xb807('0x7d'));}}else{throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x7d'));}return _0x316497;})['then'](handleEntityNotFound(_0x20f5a0,null))['then'](function(_0x32eb94){return db['Setting']['findOne']({'attributes':['id',_0xb807('0x92'),'enforcePasswordHistory',_0xb807('0x93')]})[_0xb807('0x12')](function(_0x2ce670){if(_0x2ce670[_0xb807('0x92')])authService['validatePasswordPattern'](_0x4ab29c['body'][_0xb807('0x89')]);if(!_0x2ce670[_0xb807('0x94')]||!_0x32eb94[_0xb807('0x95')])return _0x32eb94;authService[_0xb807('0x96')](_0x4ab29c['body'][_0xb807('0x89')],_0x32eb94[_0xb807('0x95')],_0x2ce670['passwordHistoryLimit']);return _0x32eb94;})[_0xb807('0x12')](saveUpdates({'password':_0x4ab29c['body'][_0xb807('0x89')],'passwordResetAt':_0x4ab29c[_0xb807('0x2d')]['id']==_0x4ab29c[_0xb807('0x5c')]['id']?moment():null,'previousPasswords':authService[_0xb807('0x97')](_0x4ab29c[_0xb807('0x59')][_0xb807('0x89')],_0x32eb94[_0xb807('0x95')])},null));})[_0xb807('0x12')](respondWithResult(_0x20f5a0,null))[_0xb807('0x1d')](handleError(_0x20f5a0,null));};exports['addQueues']=function(_0x2da150,_0x1adcaf){var _0x573a73=_0x2da150['body'][_0xb807('0x98')];return db['User'][_0xb807('0x36')]({'where':{'id':_0x2da150[_0xb807('0x5c')]['id']},'attributes':['id',_0xb807('0x38'),_0xb807('0x2a'),'online',_0xb807('0x99'),_0xb807('0x9a'),_0xb807('0x9b')]})[_0xb807('0x12')](handleEntityNotFound(_0x1adcaf,null))[_0xb807('0x12')](function(_0x3b1e4c){if(_0x3b1e4c){if(!utils[_0xb807('0x9c')](_0x573a73)){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x9d'));}return _0x3b1e4c[_0xb807('0x9e')+_[_0xb807('0x9f')](_0x573a73[_0xb807('0xa0')]())+_0xb807('0xa1')](_0x2da150[_0xb807('0x59')][_0xb807('0x5d')],{'penalty':_0x2da150[_0xb807('0x59')][_0xb807('0xa2')]||0x0})[_0xb807('0xa3')](function(_0x1c3205){for(var _0x5d05ff=0x0;_0x5d05ff<_0x2da150['body'][_0xb807('0x5d')][_0xb807('0x47')];_0x5d05ff+=0x1){var _0x9ce754={'UserId':Number(_0x2da150[_0xb807('0x5c')]['id'])};_0x9ce754[_[_0xb807('0x9f')](_0x573a73[_0xb807('0xa0')]())+_0xb807('0xa4')]=Number(_0x2da150[_0xb807('0x59')]['ids'][_0x5d05ff]);socket['emit']('user'+_['capitalize'](_0x573a73[_0xb807('0xa0')]())+'Queue:save',_0x9ce754);}return _0x1c3205;})[_0xb807('0x12')](function(){if(_0x573a73===_0xb807('0xa5')){return db[_0xb807('0xa6')]['findAll']({'where':{'id':_0x2da150[_0xb807('0x59')][_0xb807('0x5d')]||[]},'raw':!![],'attributes':['id',_0xb807('0x38')]});}})['then'](function(_0x391631){var _0x434cf9=_0x3b1e4c[_0xb807('0x29')]({'plain':!![]});var _0x345892=[];if(_0x573a73===_0xb807('0xa5')&&_0x434cf9[_0xb807('0x2a')]===_0xb807('0x6d')&&_0x434cf9[_0xb807('0xa7')]){for(var _0x15a33e=0x0;_0x15a33e<_0x391631[_0xb807('0x47')];_0x15a33e+=0x1){_0x345892['push']({'membername':_0x434cf9[_0xb807('0x38')],'UserId':_0x434cf9['id'],'queue_name':_0x391631[_0x15a33e][_0xb807('0x38')],'VoiceQueueId':_0x391631[_0x15a33e]['id'],'interface':_[_0xb807('0x63')](_0x434cf9['interface'])?util[_0xb807('0xa8')](_0xb807('0xa9'),_0x434cf9['name']):_0x434cf9[_0xb807('0x9b')],'paused':_0x434cf9['voicePause']||![],'penalty':_0x2da150[_0xb807('0x59')][_0xb807('0xa2')]||0x0});}return BPromise[_0xb807('0xaa')](_0x345892,function(_0x3e1ed3){return db[_0xb807('0xab')]['upsert'](_0x3e1ed3);});}return _0x3b1e4c;});}})['then'](respondWithStatusCode(_0x1adcaf,null))['catch'](handleError(_0x1adcaf,null));};exports[_0xb807('0xac')]=function(_0x676bc8,_0x1770cd){var _0xc982e9,_0x54cf4a;return db[_0xb807('0x3d')][_0xb807('0x36')]({'where':{'id':_0x676bc8[_0xb807('0x5c')]['id']},'attributes':['id',_0xb807('0x38'),_0xb807('0x2a')]})[_0xb807('0x12')](handleEntityNotFound(_0x1770cd,null))['then'](function(_0x89ef46){if(_0x89ef46){_0xc982e9=_0x89ef46;if(!_0x676bc8['query']['channel']||!utils['isValidChannel'](_0x676bc8[_0xb807('0x3f')][_0xb807('0x98')])){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x9d'));}return _0x89ef46[_0xb807('0xad')+_['capitalize'](_0x676bc8[_0xb807('0x3f')][_0xb807('0x98')]['toLowerCase']())+_0xb807('0xa1')](_0x676bc8[_0xb807('0x3f')]['ids']);}})[_0xb807('0x12')](function(_0x3ed835){if(_['isArray'](_0x676bc8['query'][_0xb807('0x5d')])){for(var _0x254cb4=0x0;_0x254cb4<_0x676bc8[_0xb807('0x3f')][_0xb807('0x5d')][_0xb807('0x47')];_0x254cb4+=0x1){_0x54cf4a={'UserId':Number(_0x676bc8[_0xb807('0x5c')]['id'])};_0x54cf4a[_[_0xb807('0x9f')](_0x676bc8[_0xb807('0x3f')][_0xb807('0x98')][_0xb807('0xa0')]())+_0xb807('0xa4')]=Number(_0x676bc8[_0xb807('0x3f')][_0xb807('0x5d')][_0x254cb4]);socket['emit'](_0xb807('0x2d')+_[_0xb807('0x9f')](_0x676bc8['query'][_0xb807('0x98')][_0xb807('0xa0')]())+'Queue:remove',_0x54cf4a);}}else{_0x54cf4a={'UserId':Number(_0x676bc8[_0xb807('0x5c')]['id'])};_0x54cf4a[_[_0xb807('0x9f')](_0x676bc8[_0xb807('0x3f')][_0xb807('0x98')][_0xb807('0xa0')]())+'QueueId']=Number(_0x676bc8[_0xb807('0x3f')]['ids']);socket[_0xb807('0xae')]('user'+_[_0xb807('0x9f')](_0x676bc8['query'][_0xb807('0x98')][_0xb807('0xa0')]())+_0xb807('0xaf'),_0x54cf4a);}return _0x3ed835;})[_0xb807('0x12')](function(){if(_0x676bc8[_0xb807('0x3f')][_0xb807('0x98')]===_0xb807('0xa5')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x676bc8[_0xb807('0x5c')]['id'],'VoiceQueueId':_0x676bc8[_0xb807('0x3f')][_0xb807('0x5d')]},'individualHooks':!![]})[_0xb807('0x12')](function(){return _0xc982e9;});}return _0xc982e9;})['then'](respondWithStatusCode(_0x1770cd,null))[_0xb807('0x1d')](handleError(_0x1770cd,null));};exports[_0xb807('0xb0')]=function(_0x2d929a,_0x46840d){_0x2d929a['body'][_0xb807('0xb1')]=_0x2d929a[_0xb807('0xb2')]['filename'];return db['User'][_0xb807('0x36')]({'where':{'id':_0x2d929a[_0xb807('0x5c')]['id']}})['then'](handleEntityNotFound(_0x46840d,null))['then'](saveUpdates(_0x2d929a[_0xb807('0x59')],null))[_0xb807('0x12')](respondWithResult(_0x46840d,null))['catch'](handleError(_0x46840d,null));};exports[_0xb807('0xb3')]=function(_0x4195bd,_0xf69f93){var _0x52adb3=path['join'](config['root'],_0xb807('0xb4'));return db[_0xb807('0x3d')][_0xb807('0x36')]({'where':{'id':_0x4195bd['params']['id']},'attributes':['id',_0xb807('0xb1')],'raw':!![]})[_0xb807('0x12')](handleEntityNotFound(_0xf69f93,null))['then'](function(_0x1386f6){if(_0x1386f6){if(_['isNil'](_0x1386f6[_0xb807('0xb1')])){return _0xf69f93[_0xb807('0xb5')](_0x52adb3);}else{if(!fs['existsSync'](path[_0xb807('0xb6')](config[_0xb807('0xb7')],_0xb807('0xb8'),_0x1386f6['userpic']))){return _0xf69f93[_0xb807('0xb5')](_0x52adb3);}return _0xf69f93['download'](path[_0xb807('0xb6')](config[_0xb807('0xb7')],_0xb807('0xb8'),_0x1386f6[_0xb807('0xb1')]));}}})['catch'](handleError(_0xf69f93,null));};exports[_0xb807('0xb9')]=function(_0x560c36,_0x3410b1){return db[_0xb807('0x3d')][_0xb807('0x36')]({'where':{'id':_0x560c36[_0xb807('0x5c')]['id']},'attributes':['id']})[_0xb807('0x12')](handleEntityNotFound(_0x3410b1,null))[_0xb807('0x12')](function(_0x5299b3){var _0xac396e=[];values=_0x5299b3[_0xb807('0x49')];_0xac396e['push'](get_open_tabs('chat',_0x5299b3['dataValues']));_0xac396e[_0xb807('0x43')](get_open_tabs(_0xb807('0x48'),_0x5299b3[_0xb807('0x49')]));_0xac396e[_0xb807('0x43')](get_open_tabs('openchannel',_0x5299b3['dataValues']));_0xac396e[_0xb807('0x43')](get_open_tabs(_0xb807('0x4d'),_0x5299b3[_0xb807('0x49')]));_0xac396e[_0xb807('0x43')](get_open_tabs(_0xb807('0x4a'),_0x5299b3[_0xb807('0x49')]));_0xac396e[_0xb807('0x43')](get_open_tabs('mail',_0x5299b3['dataValues']));return BPromise[_0xb807('0x4e')](_0xac396e);})[_0xb807('0x12')](function(_0x3c82fc){if(_0x3c82fc){var _0x44ddf9=_['map'](values[_0xb807('0xba')],function(_0x5630ce){return{'channel':_0xb807('0xbb'),'id':_0x5630ce['id'],'createdAt':_0x5630ce[_0xb807('0xbc')]};});var _0x48a31b=_[_0xb807('0x33')](values[_0xb807('0xbd')],function(_0x306a63){return{'channel':_0xb807('0xbe'),'id':_0x306a63['id'],'createdAt':_0x306a63[_0xb807('0xbc')]};});var _0x3c1a19=_[_0xb807('0x33')](values[_0xb807('0xbf')],function(_0x28c6e6){return{'channel':_0xb807('0xc0'),'id':_0x28c6e6['id'],'createdAt':_0x28c6e6['createdAt']};});var _0x2b536a=_[_0xb807('0x33')](values[_0xb807('0xc1')],function(_0x468358){return{'channel':'MAIL','id':_0x468358['id'],'createdAt':_0x468358[_0xb807('0xbc')]};});var _0x4cc6b9=_[_0xb807('0x33')](values[_0xb807('0xc2')],function(_0x5a6145){return{'channel':_0xb807('0xc3'),'id':_0x5a6145['id'],'createdAt':_0x5a6145[_0xb807('0xbc')]};});var _0x4dcf74=_[_0xb807('0x33')](values[_0xb807('0xc4')],function(_0x406f3e){return{'channel':_0xb807('0xc5'),'id':_0x406f3e['id'],'createdAt':_0x406f3e[_0xb807('0xbc')]};});var _0x1b17c9=_[_0xb807('0xc6')](_0x44ddf9,_0x48a31b,_0x3c1a19,_0x2b536a,_0x4cc6b9,_0x4dcf74);var _0x58113d={'count':_0x1b17c9[_0xb807('0x47')],'rows':_0x1b17c9};return _0x58113d;}else return null;})[_0xb807('0x12')](respondWithResult(_0x3410b1,null))[_0xb807('0x1d')](handleError(_0x3410b1,null));};exports[_0xb807('0xc7')]=function(_0xf137f0,_0x44a5a5){var _0x467ebc={};var _0x5e6736={};var _0x24853f;var _0xff6ce0;return db['User'][_0xb807('0xc8')]({'where':{'id':_0xf137f0[_0xb807('0x5c')]['id']}})['then'](handleEntityNotFound(_0x44a5a5,null))[_0xb807('0x12')](function(_0xa0ae04){if(_0xa0ae04){_0x24853f=_0xa0ae04;_0x5e6736[_0xb807('0x50')]=_[_0xb807('0xc9')](db['CmContact'][_0xb807('0x51')]);_0x5e6736[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0xf137f0[_0xb807('0x3f')]);_0x5e6736[_0xb807('0x53')]=_[_0xb807('0x54')](_0x5e6736[_0xb807('0x50')],_0x5e6736[_0xb807('0x3f')]);_0x467ebc['attributes']=_[_0xb807('0x54')](_0x5e6736[_0xb807('0x50')],qs[_0xb807('0x55')](_0xf137f0['query'][_0xb807('0x55')]));_0x467ebc[_0xb807('0x42')]=_0x467ebc['attributes'][_0xb807('0x47')]?_0x467ebc[_0xb807('0x42')]:_0x5e6736['model'];_0x467ebc['order']=qs[_0xb807('0xca')](_0xf137f0[_0xb807('0x3f')]['sort']);_0x467ebc[_0xb807('0xcb')]=qs[_0xb807('0x53')](_['pick'](_0xf137f0[_0xb807('0x3f')],_0x5e6736[_0xb807('0x53')]));if(_0xf137f0[_0xb807('0x3f')]['filter']){_0x467ebc[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x467ebc[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x467ebc[_0xb807('0x42')],function(_0x152bad){var _0x1f7d5d={};_0x1f7d5d[_0x152bad]={'$like':'%'+_0xf137f0['query'][_0xb807('0x31')]+'%'};return _0x1f7d5d;})});}_0x467ebc=_['merge']({},_0x467ebc,_0xf137f0['options']);return _0x24853f['getContacts'](_0x467ebc);}})[_0xb807('0x12')](function(_0x2eff3f){if(_0x2eff3f){_0xff6ce0=_0x2eff3f[_0xb807('0x47')];if(_0xf137f0[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xcd'))){_0x467ebc[_0xb807('0x3e')]=[{'model':db[_0xb807('0xce')],'as':_0xb807('0xcf'),'required':![]},{'model':db['Tag'],'as':_0xb807('0xd0'),'attributes':['id',_0xb807('0x38'),_0xb807('0xd1')],'where':_0xf137f0[_0xb807('0x3f')][_0xb807('0xd2')]?{'id':_0xf137f0[_0xb807('0x3f')][_0xb807('0xd2')]}:undefined,'required':_0xf137f0[_0xb807('0x3f')][_0xb807('0xd2')]?!![]:![]}];}if(!_0xf137f0[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x467ebc[_0xb807('0x25')]=qs[_0xb807('0x25')](_0xf137f0[_0xb807('0x3f')][_0xb807('0x25')]);_0x467ebc['offset']=qs['offset'](_0xf137f0['query'][_0xb807('0x22')]);}return _0x24853f[_0xb807('0xc7')](_0x467ebc);}})[_0xb807('0x12')](function(_0x2a918d){if(_0x2a918d){return _0x2a918d?{'count':_0xff6ce0,'rows':_0x2a918d}:null;}})['then'](respondWithResult(_0x44a5a5,null))[_0xb807('0x1d')](handleError(_0x44a5a5,null));};exports['getQueues']=function(_0x10cdea,_0x4ecf61){var _0x4813e0;var _0x279567={};var _0x25aab8;return db['User'][_0xb807('0xc8')]({'where':{'id':_0x10cdea[_0xb807('0x5c')]['id']},'attributes':['id',_0xb807('0x38'),_0xb807('0x2a')]})[_0xb807('0x12')](handleEntityNotFound(_0x4ecf61,null))['then'](function(_0x188378){if(!utils[_0xb807('0x9c')](_0x10cdea['query'][_0xb807('0x98')])){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x9d'));}_0x4813e0=_0x188378;var _0x131420={};_0x131420['model']=_['keys'](db[_[_0xb807('0x9f')](_0x10cdea[_0xb807('0x3f')][_0xb807('0x98')])+_0xb807('0xd4')][_0xb807('0x51')]);_0x131420[_0xb807('0x3f')]=_['keys'](_0x10cdea['query']);_0x131420[_0xb807('0x53')]=_['intersection'](_0x131420[_0xb807('0x50')],_0x131420[_0xb807('0x3f')]);_0x279567[_0xb807('0x42')]=_[_0xb807('0x54')](_0x131420[_0xb807('0x50')],qs[_0xb807('0x55')](_0x10cdea[_0xb807('0x3f')][_0xb807('0x55')]));_0x279567[_0xb807('0x42')]=_0x279567[_0xb807('0x42')][_0xb807('0x47')]?_0x279567[_0xb807('0x42')]:_0x131420[_0xb807('0x50')];_0x279567[_0xb807('0xd5')]=qs['sort'](_0x10cdea['query']['sort']);_0x279567[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x10cdea['query'],_0x131420['filters']));if(_0x10cdea[_0xb807('0x3f')][_0xb807('0x31')]){_0x279567[_0xb807('0xcb')]=_['merge'](_0x279567[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x279567[_0xb807('0x42')],function(_0x17bad7){var _0x3c4c19={};_0x3c4c19[_0x17bad7]={'$like':'%'+_0x10cdea[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0x3c4c19;})});}_0x279567=_[_0xb807('0x56')]({},_0x279567,_0x10cdea[_0xb807('0xd7')]);switch(_0x4813e0[_0xb807('0x2a')]){case'admin':return db[_[_0xb807('0x9f')](_0x10cdea[_0xb807('0x3f')][_0xb807('0x98')])+_0xb807('0xd4')]['findAll'](_0x279567);case _0xb807('0x2d'):case _0xb807('0x6d'):return _0x4813e0['get'+_['capitalize'](_0x10cdea['query'][_0xb807('0x98')])+'Queues'](_0x279567);default:throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0xd8'));}})[_0xb807('0x12')](function(_0x322276){_0x25aab8=_0x322276['length'];if(!_0x10cdea[_0xb807('0x3f')]['hasOwnProperty'](_0xb807('0xd3'))){_0x279567[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x10cdea[_0xb807('0x3f')]['limit']);_0x279567['offset']=qs[_0xb807('0x22')](_0x10cdea['query']['offset']);}switch(_0x4813e0[_0xb807('0x2a')]){case _0xb807('0x2b'):return db[_[_0xb807('0x9f')](_0x10cdea[_0xb807('0x3f')][_0xb807('0x98')])+_0xb807('0xd4')]['findAll'](_0x279567);case _0xb807('0x2d'):case'agent':return _0x4813e0[_0xb807('0x29')+_[_0xb807('0x9f')](_0x10cdea['query'][_0xb807('0x98')])+'Queues'](_0x279567);}})['then'](function(_0x30f8ae){return{'count':_0x25aab8,'rows':_0x30f8ae};})[_0xb807('0x12')](respondWithResult(_0x4ecf61,null))[_0xb807('0x1d')](handleError(_0x4ecf61,null));};exports[_0xb807('0xd9')]=function(_0x51459d,_0x3cacbb){var _0x56c753={};var _0x4e7283={};var _0x2e11b7;var _0x14475f;return db[_0xb807('0x3d')]['findOne']({'where':{'id':_0x51459d[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x3cacbb,null))['then'](function(_0x2d1fd7){if(_0x2d1fd7){_0x2e11b7=_0x2d1fd7;_0x4e7283['model']=_[_0xb807('0xc9')](db[_0xb807('0xab')][_0xb807('0x51')]);_0x4e7283[_0xb807('0x3f')]=_['keys'](_0x51459d['query']);_0x4e7283[_0xb807('0x53')]=_[_0xb807('0x54')](_0x4e7283['model'],_0x4e7283[_0xb807('0x3f')]);_0x56c753[_0xb807('0x42')]=_[_0xb807('0x54')](_0x4e7283[_0xb807('0x50')],qs[_0xb807('0x55')](_0x51459d[_0xb807('0x3f')][_0xb807('0x55')]));_0x56c753[_0xb807('0x42')]=_0x56c753[_0xb807('0x42')][_0xb807('0x47')]?_0x56c753[_0xb807('0x42')]:_0x4e7283['model'];_0x56c753['order']=qs[_0xb807('0xca')](_0x51459d['query'][_0xb807('0xca')]);_0x56c753['where']=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x51459d[_0xb807('0x3f')],_0x4e7283[_0xb807('0x53')]));if(_0x51459d[_0xb807('0x3f')][_0xb807('0x31')]){_0x56c753[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x56c753[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x56c753['attributes'],function(_0x4064c3){var _0x4d5d7c={};_0x4d5d7c[_0x4064c3]={'$like':'%'+_0x51459d[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0x4d5d7c;})});}_0x56c753=_[_0xb807('0x56')]({},_0x56c753,_0x51459d['options']);return _0x2e11b7[_0xb807('0xd9')](_0x56c753);}})[_0xb807('0x12')](function(_0x28d7ca){if(_0x28d7ca){_0x14475f=_0x28d7ca[_0xb807('0x47')];if(!_0x51459d['query'][_0xb807('0xcc')]('nolimit')){_0x56c753[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x51459d[_0xb807('0x3f')][_0xb807('0x25')]);_0x56c753['offset']=qs[_0xb807('0x22')](_0x51459d[_0xb807('0x3f')][_0xb807('0x22')]);}return _0x2e11b7[_0xb807('0xd9')](_0x56c753);}})['then'](function(_0x56f95f){if(_0x56f95f){return _0x56f95f?{'count':_0x14475f,'rows':_0x56f95f}:null;}})['then'](respondWithResult(_0x3cacbb,null))['catch'](handleError(_0x3cacbb,null));};exports[_0xb807('0xda')]=function(_0x3bc99a,_0x49b3f4){var _0x227fca={};var _0x319e93={};var _0x111aa6;var _0x5f1821;return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x3bc99a[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x49b3f4,null))[_0xb807('0x12')](function(_0x3138f4){if(_0x3138f4){_0x111aa6=_0x3138f4;_0x319e93[_0xb807('0x50')]=_[_0xb807('0xc9')](db[_0xb807('0xdb')][_0xb807('0x51')]);_0x319e93[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x3bc99a[_0xb807('0x3f')]);_0x319e93[_0xb807('0x53')]=_[_0xb807('0x54')](_0x319e93[_0xb807('0x50')],_0x319e93['query']);_0x227fca[_0xb807('0x42')]=_[_0xb807('0x54')](_0x319e93[_0xb807('0x50')],qs['fields'](_0x3bc99a[_0xb807('0x3f')]['fields']));_0x227fca[_0xb807('0x42')]=_0x227fca[_0xb807('0x42')][_0xb807('0x47')]?_0x227fca[_0xb807('0x42')]:_0x319e93[_0xb807('0x50')];_0x227fca[_0xb807('0xd5')]=qs[_0xb807('0xca')](_0x3bc99a[_0xb807('0x3f')][_0xb807('0xca')]);_0x227fca['where']=qs['filters'](_[_0xb807('0xd6')](_0x3bc99a[_0xb807('0x3f')],_0x319e93[_0xb807('0x53')]));if(_0x3bc99a[_0xb807('0x3f')][_0xb807('0x31')]){_0x227fca[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x227fca[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x227fca[_0xb807('0x42')],function(_0x5818ba){var _0x37285f={};_0x37285f[_0x5818ba]={'$like':'%'+_0x3bc99a[_0xb807('0x3f')]['filter']+'%'};return _0x37285f;})});}_0x227fca=_[_0xb807('0x56')]({},_0x227fca,_0x3bc99a[_0xb807('0xd7')]);return _0x111aa6[_0xb807('0xda')](_0x227fca);}})[_0xb807('0x12')](function(_0x55101f){if(_0x55101f){_0x5f1821=_0x55101f[_0xb807('0x47')];if(!_0x3bc99a[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x227fca[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x3bc99a['query'][_0xb807('0x25')]);_0x227fca[_0xb807('0x22')]=qs[_0xb807('0x22')](_0x3bc99a[_0xb807('0x3f')]['offset']);}return _0x111aa6['getGroups'](_0x227fca);}})[_0xb807('0x12')](function(_0x2cffe3){if(_0x2cffe3){return _0x2cffe3?{'count':_0x5f1821,'rows':_0x2cffe3}:null;}})[_0xb807('0x12')](respondWithResult(_0x49b3f4,null))[_0xb807('0x1d')](handleError(_0x49b3f4,null));};exports['getRecordings']=function(_0x40ecb9,_0x528c16){var _0x4b3dd0={'raw':!![],'where':{}};var _0x435467={};var _0x19a03f={'count':0x0,'rows':[]};return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x40ecb9['params']['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x528c16,null))[_0xb807('0x12')](function(_0x2ea349){if(_0x2ea349){_0x435467[_0xb807('0x50')]=_[_0xb807('0xc9')](db['VoiceRecording'][_0xb807('0x51')]);_0x435467[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x40ecb9[_0xb807('0x3f')]);_0x435467['filters']=_[_0xb807('0x54')](_0x435467[_0xb807('0x50')],_0x435467[_0xb807('0x3f')]);_0x4b3dd0[_0xb807('0x42')]=_['intersection'](_0x435467[_0xb807('0x50')],qs['fields'](_0x40ecb9[_0xb807('0x3f')][_0xb807('0x55')]));_0x4b3dd0['attributes']=_0x4b3dd0[_0xb807('0x42')]['length']?_0x4b3dd0['attributes']:_0x435467[_0xb807('0x50')];if(!_0x40ecb9[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x4b3dd0[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x40ecb9[_0xb807('0x3f')][_0xb807('0x25')]);_0x4b3dd0[_0xb807('0x22')]=qs[_0xb807('0x22')](_0x40ecb9['query'][_0xb807('0x22')]);}_0x4b3dd0[_0xb807('0xd5')]=qs[_0xb807('0xca')](_0x40ecb9[_0xb807('0x3f')][_0xb807('0xca')]);_0x4b3dd0[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x40ecb9[_0xb807('0x3f')],_0x435467[_0xb807('0x53')]));_0x4b3dd0[_0xb807('0xcb')][_0xb807('0xdc')]=_0x2ea349['id'];if(_0x40ecb9[_0xb807('0x3f')][_0xb807('0x31')]){_0x4b3dd0[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x4b3dd0[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x4b3dd0['attributes'],function(_0x53b05f){var _0x149408={};_0x149408[_0x53b05f]={'$like':'%'+_0x40ecb9['query']['filter']+'%'};return _0x149408;})});}_0x4b3dd0=_[_0xb807('0x56')]({},_0x4b3dd0,_0x40ecb9[_0xb807('0xd7')]);return db['VoiceRecording'][_0xb807('0x24')]({'where':_0x4b3dd0['where']})[_0xb807('0x12')](function(_0x53c7ed){_0x19a03f[_0xb807('0x24')]=_0x53c7ed;if(_0x40ecb9[_0xb807('0x3f')][_0xb807('0xcd')]){_0x4b3dd0[_0xb807('0x3e')]=[{'all':!![]}];}return db[_0xb807('0xdd')]['findAll'](_0x4b3dd0);})[_0xb807('0x12')](function(_0x4c36ef){_0x19a03f[_0xb807('0x44')]=_0x4c36ef;return _0x19a03f;});}})[_0xb807('0x12')](respondWithFilteredResult(_0x528c16,_0x4b3dd0))['catch'](handleError(_0x528c16,null));};exports[_0xb807('0xde')]=function(_0x5a1f13,_0x554f94){var _0x1b0551={'raw':!![],'where':{}};var _0x3afa17={};var _0x5d8bbb={'count':0x0,'rows':[]};return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x5a1f13[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x554f94,null))[_0xb807('0x12')](function(_0x56ba61){if(_0x56ba61){_0x3afa17[_0xb807('0x50')]=_[_0xb807('0xc9')](db[_0xb807('0xdf')][_0xb807('0x51')]);_0x3afa17[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x5a1f13['query']);_0x3afa17[_0xb807('0x53')]=_[_0xb807('0x54')](_0x3afa17[_0xb807('0x50')],_0x3afa17[_0xb807('0x3f')]);_0x1b0551[_0xb807('0x42')]=_['intersection'](_0x3afa17['model'],qs[_0xb807('0x55')](_0x5a1f13[_0xb807('0x3f')][_0xb807('0x55')]));_0x1b0551['attributes']=_0x1b0551[_0xb807('0x42')]['length']?_0x1b0551['attributes']:_0x3afa17[_0xb807('0x50')];if(!_0x5a1f13[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x1b0551['limit']=qs[_0xb807('0x25')](_0x5a1f13[_0xb807('0x3f')][_0xb807('0x25')]);_0x1b0551[_0xb807('0x22')]=qs[_0xb807('0x22')](_0x5a1f13[_0xb807('0x3f')][_0xb807('0x22')]);}_0x1b0551['order']=qs['sort'](_0x5a1f13['query'][_0xb807('0xca')]);_0x1b0551[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x5a1f13[_0xb807('0x3f')],_0x3afa17['filters']));_0x1b0551[_0xb807('0xcb')][_0xb807('0xdc')]=_0x56ba61['id'];if(_0x5a1f13[_0xb807('0x3f')][_0xb807('0x31')]){_0x1b0551['where']=_[_0xb807('0x56')](_0x1b0551[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x1b0551[_0xb807('0x42')],function(_0xddedb4){var _0xa7c1e7={};_0xa7c1e7[_0xddedb4]={'$like':'%'+_0x5a1f13[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0xa7c1e7;})});}_0x1b0551=_[_0xb807('0x56')]({},_0x1b0551,_0x5a1f13['options']);return db['ScreenRecording'][_0xb807('0x24')]({'where':_0x1b0551[_0xb807('0xcb')]})[_0xb807('0x12')](function(_0xa2f0a8){_0x5d8bbb[_0xb807('0x24')]=_0xa2f0a8;if(_0x5a1f13['query'][_0xb807('0xcd')]){_0x1b0551[_0xb807('0x3e')]=[{'all':!![]}];}return db[_0xb807('0xdf')][_0xb807('0x85')](_0x1b0551);})[_0xb807('0x12')](function(_0x387e8e){_0x5d8bbb['rows']=_0x387e8e;return _0x5d8bbb;});}})[_0xb807('0x12')](respondWithFilteredResult(_0x554f94,_0x1b0551))[_0xb807('0x1d')](handleError(_0x554f94,null));};exports[_0xb807('0xe0')]=function(_0x414dfa,_0x4b2d65){var _0x23bddc={};var _0x5636f3={};var _0x3910ea;var _0x604387;return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x414dfa['params']['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x4b2d65,null))['then'](function(_0x33adb8){if(_0x33adb8){_0x3910ea=_0x33adb8;_0x5636f3['model']=_[_0xb807('0xc9')](db['ChatInteraction']['rawAttributes']);_0x5636f3[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x414dfa['query']);_0x5636f3[_0xb807('0x53')]=_[_0xb807('0x54')](_0x5636f3['model'],_0x5636f3[_0xb807('0x3f')]);_0x23bddc[_0xb807('0x42')]=_[_0xb807('0x54')](_0x5636f3['model'],qs[_0xb807('0x55')](_0x414dfa[_0xb807('0x3f')][_0xb807('0x55')]));_0x23bddc['attributes']=_0x23bddc[_0xb807('0x42')][_0xb807('0x47')]?_0x23bddc[_0xb807('0x42')]:_0x5636f3['model'];_0x23bddc[_0xb807('0xd5')]=qs[_0xb807('0xca')](_0x414dfa[_0xb807('0x3f')][_0xb807('0xca')]);_0x23bddc[_0xb807('0xcb')]=qs['filters'](_[_0xb807('0xd6')](_0x414dfa[_0xb807('0x3f')],_0x5636f3[_0xb807('0x53')]));if(_0x414dfa[_0xb807('0x3f')][_0xb807('0x31')]){_0x23bddc[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x23bddc[_0xb807('0xcb')],{'$or':_['map'](_0x23bddc[_0xb807('0x42')],function(_0x5701e8){var _0x3f5b9c={};_0x3f5b9c[_0x5701e8]={'$like':'%'+_0x414dfa[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0x3f5b9c;})});}_0x23bddc=_[_0xb807('0x56')]({},_0x23bddc,_0x414dfa[_0xb807('0xd7')]);return _0x3910ea[_0xb807('0xe0')](_0x23bddc);}})[_0xb807('0x12')](function(_0x316a9b){if(_0x316a9b){_0x604387=_0x316a9b[_0xb807('0x47')];if(!_0x414dfa[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x23bddc['limit']=qs[_0xb807('0x25')](_0x414dfa['query']['limit']);_0x23bddc[_0xb807('0x22')]=qs[_0xb807('0x22')](_0x414dfa[_0xb807('0x3f')]['offset']);}return _0x3910ea[_0xb807('0xe0')](_0x23bddc);}})[_0xb807('0x12')](function(_0x362e9a){if(_0x362e9a){return _0x362e9a?{'count':_0x604387,'rows':_0x362e9a}:null;}})[_0xb807('0x12')](respondWithResult(_0x4b2d65,null))[_0xb807('0x1d')](handleError(_0x4b2d65,null));};exports['getOpenchannelInteractions']=function(_0x2beb6e,_0x44f0bb){var _0x1299ed={};var _0x213c6b={};var _0x32fa0e;var _0x550c40;return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x2beb6e['params']['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x44f0bb,null))[_0xb807('0x12')](function(_0x47581d){if(_0x47581d){_0x32fa0e=_0x47581d;_0x213c6b[_0xb807('0x50')]=_[_0xb807('0xc9')](db[_0xb807('0xe1')]['rawAttributes']);_0x213c6b[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x2beb6e[_0xb807('0x3f')]);_0x213c6b[_0xb807('0x53')]=_['intersection'](_0x213c6b[_0xb807('0x50')],_0x213c6b[_0xb807('0x3f')]);_0x1299ed['attributes']=_[_0xb807('0x54')](_0x213c6b[_0xb807('0x50')],qs[_0xb807('0x55')](_0x2beb6e[_0xb807('0x3f')]['fields']));_0x1299ed[_0xb807('0x42')]=_0x1299ed[_0xb807('0x42')][_0xb807('0x47')]?_0x1299ed[_0xb807('0x42')]:_0x213c6b['model'];_0x1299ed[_0xb807('0xd5')]=qs['sort'](_0x2beb6e[_0xb807('0x3f')][_0xb807('0xca')]);_0x1299ed[_0xb807('0xcb')]=qs[_0xb807('0x53')](_['pick'](_0x2beb6e[_0xb807('0x3f')],_0x213c6b[_0xb807('0x53')]));if(_0x2beb6e['query']['filter']){_0x1299ed['where']=_[_0xb807('0x56')](_0x1299ed[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x1299ed['attributes'],function(_0x1b96e3){var _0x214089={};_0x214089[_0x1b96e3]={'$like':'%'+_0x2beb6e[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0x214089;})});}_0x1299ed=_[_0xb807('0x56')]({},_0x1299ed,_0x2beb6e[_0xb807('0xd7')]);return _0x32fa0e['getOpenchannelInteractions'](_0x1299ed);}})[_0xb807('0x12')](function(_0xd4d51f){if(_0xd4d51f){_0x550c40=_0xd4d51f[_0xb807('0x47')];if(!_0x2beb6e[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x1299ed[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x2beb6e[_0xb807('0x3f')][_0xb807('0x25')]);_0x1299ed['offset']=qs[_0xb807('0x22')](_0x2beb6e[_0xb807('0x3f')][_0xb807('0x22')]);}return _0x32fa0e[_0xb807('0xe2')](_0x1299ed);}})[_0xb807('0x12')](function(_0xb8ca5){if(_0xb8ca5){return _0xb8ca5?{'count':_0x550c40,'rows':_0xb8ca5}:null;}})[_0xb807('0x12')](respondWithResult(_0x44f0bb,null))[_0xb807('0x1d')](handleError(_0x44f0bb,null));};exports[_0xb807('0xe3')]=function(_0x332384,_0x49fc32){var _0xed4279={'raw':!![],'where':{}};var _0x91f41b={};var _0x393655={'count':0x0,'rows':[]};return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x332384[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x49fc32,null))[_0xb807('0x12')](function(_0x3fd128){if(_0x3fd128){_0x91f41b['model']=_[_0xb807('0xc9')](db[_0xb807('0xe4')]['rawAttributes']);_0x91f41b[_0xb807('0x3f')]=_['keys'](_0x332384[_0xb807('0x3f')]);_0x91f41b[_0xb807('0x53')]=_[_0xb807('0x54')](_0x91f41b['model'],_0x91f41b[_0xb807('0x3f')]);_0xed4279[_0xb807('0x42')]=_['intersection'](_0x91f41b[_0xb807('0x50')],qs[_0xb807('0x55')](_0x332384[_0xb807('0x3f')][_0xb807('0x55')]));_0xed4279[_0xb807('0x42')]=_0xed4279['attributes']['length']?_0xed4279[_0xb807('0x42')]:_0x91f41b['model'];if(!_0x332384['query']['hasOwnProperty'](_0xb807('0xd3'))){_0xed4279[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x332384[_0xb807('0x3f')]['limit']);_0xed4279['offset']=qs[_0xb807('0x22')](_0x332384[_0xb807('0x3f')][_0xb807('0x22')]);}_0xed4279['order']=qs['sort'](_0x332384[_0xb807('0x3f')][_0xb807('0xca')]);_0xed4279['where']=qs['filters'](_[_0xb807('0xd6')](_0x332384[_0xb807('0x3f')],_0x91f41b['filters']));_0xed4279[_0xb807('0xcb')][_0xb807('0xdc')]=_0x3fd128['id'];if(_0x332384[_0xb807('0x3f')][_0xb807('0x31')]){_0xed4279['where']=_[_0xb807('0x56')](_0xed4279[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0xed4279[_0xb807('0x42')],function(_0x4227e7){var _0x3a78b7={};_0x3a78b7[_0x4227e7]={'$like':'%'+_0x332384['query'][_0xb807('0x31')]+'%'};return _0x3a78b7;})});}_0xed4279=_[_0xb807('0x56')]({},_0xed4279,_0x332384['options']);return db[_0xb807('0xe4')][_0xb807('0x24')]({'where':_0xed4279[_0xb807('0xcb')]})[_0xb807('0x12')](function(_0x25a641){_0x393655[_0xb807('0x24')]=_0x25a641;if(_0x332384[_0xb807('0x3f')][_0xb807('0xcd')]){_0xed4279[_0xb807('0x3e')]=[{'all':!![]}];}return db[_0xb807('0xe4')][_0xb807('0x85')](_0xed4279);})['then'](function(_0x2f0474){_0x393655[_0xb807('0x44')]=_0x2f0474;return _0x393655;});}})['then'](respondWithFilteredResult(_0x49fc32,_0xed4279))[_0xb807('0x1d')](handleError(_0x49fc32,null));};exports[_0xb807('0xe5')]=function(_0x5dd616,_0x398e8a){var _0x3d3fd7={};var _0xe56ecc={};var _0x3438c3;var _0x572cf3;return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x5dd616[_0xb807('0x5c')]['id']}})['then'](handleEntityNotFound(_0x398e8a,null))['then'](function(_0x2df287){if(_0x2df287){_0x3438c3=_0x2df287;_0xe56ecc[_0xb807('0x50')]=_[_0xb807('0xc9')](db[_0xb807('0xe6')][_0xb807('0x51')]);_0xe56ecc[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x5dd616[_0xb807('0x3f')]);_0xe56ecc[_0xb807('0x53')]=_[_0xb807('0x54')](_0xe56ecc[_0xb807('0x50')],_0xe56ecc[_0xb807('0x3f')]);_0x3d3fd7[_0xb807('0x42')]=_[_0xb807('0x54')](_0xe56ecc[_0xb807('0x50')],qs[_0xb807('0x55')](_0x5dd616[_0xb807('0x3f')][_0xb807('0x55')]));_0x3d3fd7[_0xb807('0x42')]=_0x3d3fd7['attributes']['length']?_0x3d3fd7['attributes']:_0xe56ecc[_0xb807('0x50')];_0x3d3fd7[_0xb807('0xd5')]=qs['sort'](_0x5dd616[_0xb807('0x3f')][_0xb807('0xca')]);_0x3d3fd7[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x5dd616['query'],_0xe56ecc['filters']));if(_0x5dd616[_0xb807('0x3f')]['filter']){_0x3d3fd7[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x3d3fd7[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x3d3fd7[_0xb807('0x42')],function(_0x579ac9){var _0x8a7cf4={};_0x8a7cf4[_0x579ac9]={'$like':'%'+_0x5dd616[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0x8a7cf4;})});}_0x3d3fd7=_[_0xb807('0x56')]({},_0x3d3fd7,_0x5dd616[_0xb807('0xd7')]);return _0x3438c3[_0xb807('0xe5')](_0x3d3fd7);}})[_0xb807('0x12')](function(_0x3b5baa){if(_0x3b5baa){_0x572cf3=_0x3b5baa['length'];if(!_0x5dd616[_0xb807('0x3f')]['hasOwnProperty'](_0xb807('0xd3'))){_0x3d3fd7[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x5dd616[_0xb807('0x3f')][_0xb807('0x25')]);_0x3d3fd7['offset']=qs[_0xb807('0x22')](_0x5dd616['query'][_0xb807('0x22')]);}return _0x3438c3[_0xb807('0xe5')](_0x3d3fd7);}})[_0xb807('0x12')](function(_0x5cd349){if(_0x5cd349){return _0x5cd349?{'count':_0x572cf3,'rows':_0x5cd349}:null;}})[_0xb807('0x12')](respondWithResult(_0x398e8a,null))[_0xb807('0x1d')](handleError(_0x398e8a,null));};exports['getFaxInteractions']=function(_0x5b5491,_0x5ac4aa){var _0x2b33e7={};var _0x7d3612={};var _0x44f829;var _0x3bbeac;return db['User'][_0xb807('0xc8')]({'where':{'id':_0x5b5491[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x5ac4aa,null))[_0xb807('0x12')](function(_0x55fe1b){if(_0x55fe1b){_0x44f829=_0x55fe1b;_0x7d3612[_0xb807('0x50')]=_[_0xb807('0xc9')](db[_0xb807('0xe7')][_0xb807('0x51')]);_0x7d3612[_0xb807('0x3f')]=_['keys'](_0x5b5491[_0xb807('0x3f')]);_0x7d3612[_0xb807('0x53')]=_[_0xb807('0x54')](_0x7d3612['model'],_0x7d3612[_0xb807('0x3f')]);_0x2b33e7[_0xb807('0x42')]=_['intersection'](_0x7d3612[_0xb807('0x50')],qs['fields'](_0x5b5491[_0xb807('0x3f')][_0xb807('0x55')]));_0x2b33e7[_0xb807('0x42')]=_0x2b33e7[_0xb807('0x42')][_0xb807('0x47')]?_0x2b33e7['attributes']:_0x7d3612[_0xb807('0x50')];_0x2b33e7['order']=qs[_0xb807('0xca')](_0x5b5491[_0xb807('0x3f')][_0xb807('0xca')]);_0x2b33e7[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x5b5491[_0xb807('0x3f')],_0x7d3612[_0xb807('0x53')]));if(_0x5b5491[_0xb807('0x3f')][_0xb807('0x31')]){_0x2b33e7[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x2b33e7[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x2b33e7[_0xb807('0x42')],function(_0x19a929){var _0x57e0c2={};_0x57e0c2[_0x19a929]={'$like':'%'+_0x5b5491[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0x57e0c2;})});}_0x2b33e7=_[_0xb807('0x56')]({},_0x2b33e7,_0x5b5491[_0xb807('0xd7')]);return _0x44f829[_0xb807('0xe8')](_0x2b33e7);}})[_0xb807('0x12')](function(_0x45c0f0){if(_0x45c0f0){_0x3bbeac=_0x45c0f0['length'];if(!_0x5b5491[_0xb807('0x3f')]['hasOwnProperty']('nolimit')){_0x2b33e7[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x5b5491[_0xb807('0x3f')][_0xb807('0x25')]);_0x2b33e7['offset']=qs[_0xb807('0x22')](_0x5b5491[_0xb807('0x3f')][_0xb807('0x22')]);}return _0x44f829[_0xb807('0xe8')](_0x2b33e7);}})[_0xb807('0x12')](function(_0x17ace3){if(_0x17ace3){return _0x17ace3?{'count':_0x3bbeac,'rows':_0x17ace3}:null;}})['then'](respondWithResult(_0x5ac4aa,null))['catch'](handleError(_0x5ac4aa,null));};exports[_0xb807('0xe9')]=function(_0x5598b3,_0x35efed){var _0x562f12={};var _0x2261c6={};var _0x10a2d1;var _0x254594;return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x5598b3[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x35efed,null))['then'](function(_0x3fc238){if(_0x3fc238){_0x10a2d1=_0x3fc238;_0x2261c6['model']=_[_0xb807('0xc9')](db['WhatsappInteraction'][_0xb807('0x51')]);_0x2261c6[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x5598b3['query']);_0x2261c6['filters']=_['intersection'](_0x2261c6['model'],_0x2261c6[_0xb807('0x3f')]);_0x562f12['attributes']=_[_0xb807('0x54')](_0x2261c6[_0xb807('0x50')],qs[_0xb807('0x55')](_0x5598b3[_0xb807('0x3f')]['fields']));_0x562f12[_0xb807('0x42')]=_0x562f12[_0xb807('0x42')][_0xb807('0x47')]?_0x562f12[_0xb807('0x42')]:_0x2261c6[_0xb807('0x50')];_0x562f12[_0xb807('0xd5')]=qs['sort'](_0x5598b3['query']['sort']);_0x562f12[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x5598b3[_0xb807('0x3f')],_0x2261c6['filters']));if(_0x5598b3[_0xb807('0x3f')]['filter']){_0x562f12[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x562f12[_0xb807('0xcb')],{'$or':_['map'](_0x562f12[_0xb807('0x42')],function(_0x1acd28){var _0x8f2c4c={};_0x8f2c4c[_0x1acd28]={'$like':'%'+_0x5598b3[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0x8f2c4c;})});}_0x562f12=_[_0xb807('0x56')]({},_0x562f12,_0x5598b3[_0xb807('0xd7')]);return _0x10a2d1[_0xb807('0xe9')](_0x562f12);}})[_0xb807('0x12')](function(_0x381ab6){if(_0x381ab6){_0x254594=_0x381ab6[_0xb807('0x47')];if(!_0x5598b3[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x562f12[_0xb807('0x25')]=qs[_0xb807('0x25')](_0x5598b3[_0xb807('0x3f')]['limit']);_0x562f12[_0xb807('0x22')]=qs[_0xb807('0x22')](_0x5598b3['query'][_0xb807('0x22')]);}return _0x10a2d1['getWhatsappInteractions'](_0x562f12);}})['then'](function(_0x7df495){if(_0x7df495){return _0x7df495?{'count':_0x254594,'rows':_0x7df495}:null;}})['then'](respondWithResult(_0x35efed,null))[_0xb807('0x1d')](handleError(_0x35efed,null));};exports['login']=function(_0x2d238c,_0x1d87a2,_0x4a4a05){var _0x1ab7e2;var _0x1b377f;var _0x579cdf;var _0x22e110=!_['isNil'](_0x2d238c[_0xb807('0x5c')]['id'])?_0x2d238c[_0xb807('0x5c')]['id']:!_['isNil'](_0x2d238c[_0xb807('0x2d')]['id'])?_0x2d238c[_0xb807('0x2d')]['id']:null;return db['User'][_0xb807('0x36')]({'where':{'id':_0x22e110,'role':{'$or':[_0xb807('0x2b'),_0xb807('0x2d'),_0xb807('0x6d')]}},'attributes':['id',_0xb807('0x38'),'phone','mobile',_0xb807('0x2a'),'internal','loginInPause']})['then'](function(_0x2ac308){if(_0x2ac308){if(_0x2ac308[_0xb807('0x2a')]===_0xb807('0x6d')){_0x1ab7e2=_0x2ac308;if(_0x2d238c[_0xb807('0x59')][_0xb807('0x9b')]){_0x579cdf=util[_0xb807('0xa8')](_0xb807('0xea'),_0x1ab7e2[_0x2d238c[_0xb807('0x59')][_0xb807('0x9b')]]);}else if(_0x2d238c[_0xb807('0x59')]['intrf']){_0x579cdf=util[_0xb807('0xa8')]('SIP/%s',_0x2d238c['body'][_0xb807('0xeb')]);}else{_0x579cdf=util['format'](_0xb807('0xa9'),_0x1ab7e2[_0xb807('0x38')]);}socket['to'](util[_0xb807('0xa8')]('user:%s',_0x1ab7e2[_0xb807('0x38')]))[_0xb807('0xae')](_0xb807('0xec'),{'user':{'id':_0x1ab7e2['id'],'name':_0x1ab7e2[_0xb807('0x38')]},'ip':_0x2d238c[_0xb807('0xed')]['x-forwarded-for']||_0x2d238c[_0xb807('0xee')][_0xb807('0xef')]||_0x2d238c['socket']['remoteAddress']||_0x2d238c[_0xb807('0xee')][_0xb807('0xf0')][_0xb807('0xef')]});return db[_0xb807('0xab')][_0xb807('0x28')]({'where':{'membername':_0x1ab7e2[_0xb807('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0xf1'));}})['then'](function(){if(_0x1ab7e2){return _0x1ab7e2['getVoiceQueues']({'raw':!![]});}})[_0xb807('0x12')](function(_0xdc1b24){if(_0x1ab7e2){var _0xf6a534=[];if(_0xdc1b24){_0x1b377f=_0xdc1b24;if(_0x1b377f['length']){for(var _0x32dd33=0x0;_0x32dd33<_0x1b377f[_0xb807('0x47')];_0x32dd33++){_0xf6a534[_0xb807('0x43')]({'membername':_0x1ab7e2[_0xb807('0x38')],'UserId':_0x1ab7e2['id'],'queue_name':_0x1b377f[_0x32dd33]['name'],'VoiceQueueId':_0x1b377f[_0x32dd33]['id'],'interface':_0x579cdf,'paused':_0x1ab7e2[_0xb807('0x99')]||![],'penalty':_0x1b377f[_0x32dd33][_0xb807('0xf2')]||0x0});}return BPromise[_0xb807('0xaa')](_0xf6a534,function(_0x26f2f3){return db['UserVoiceQueueRt'][_0xb807('0xf3')](_0x26f2f3);});}}}})[_0xb807('0x12')](function(){if(_0x1ab7e2){return db[_0xb807('0xf4')]['findAll']({'where':{'membername':_0x1ab7e2[_0xb807('0x38')],'exitAt':null}});}})[_0xb807('0x12')](function(_0x3b4cc5){if(_0x1ab7e2){var _0x1983d1=[];_0x3b4cc5[_0xb807('0xf5')](function(_0x94364b){_0x1983d1[_0xb807('0x43')](_0x94364b[_0xb807('0x58')]({'exitAt':moment()[_0xb807('0xa8')](_0xb807('0xf6'))}));});return BPromise[_0xb807('0x4e')](_0x1983d1);}})[_0xb807('0x12')](function(){if(_0x1ab7e2){var _0x3ee691=[];var _0x2fc9c1=[];var _0x11b918=utils[_0xb807('0xf7')]();var _0x33eabc={'membername':_0x1ab7e2[_0xb807('0x38')],'interface':_0x579cdf,'enterAt':moment()[_0xb807('0xa8')](_0xb807('0xf6')),'role':_0x1ab7e2['role'],'internal':_0x1ab7e2[_0xb807('0x62')]};_0x11b918[_0xb807('0xf5')](function(_0x1e4279){_0x3ee691[_0xb807('0x43')](_[_0xb807('0x56')]({'channel':_0x1e4279,'type':_0xb807('0xf8'),'data1':_0x2d238c['body'][_0xb807('0xf9')],'data2':_0x579cdf},_0x33eabc));if(_0x1ab7e2[_0xb807('0x99')]){_0x2fc9c1[_0xb807('0x43')](_['merge']({'channel':_0x1e4279,'type':_0xb807('0xfa'),'data1':'LOGININPAUSE'},_0x33eabc));}});return db['MemberReport'][_0xb807('0x83')](_0x3ee691[_0xb807('0xc6')](_0x2fc9c1),{'individualHooks':!![]});}})[_0xb807('0x12')](function(){if(_0x1ab7e2){return _0x1ab7e2[_0xb807('0x58')]({'online':!![],'lastLoginAt':moment()[_0xb807('0xa8')](_0xb807('0xf6')),'voicePause':_0x1ab7e2[_0xb807('0x99')]||![],'mailPause':_0x1ab7e2[_0xb807('0x99')]||![],'chatPause':_0x1ab7e2[_0xb807('0x99')]||![],'faxPause':_0x1ab7e2[_0xb807('0x99')]||![],'smsPause':_0x1ab7e2[_0xb807('0x99')]||![],'openchannelPause':_0x1ab7e2[_0xb807('0x99')]||![],'whatsappPause':_0x1ab7e2[_0xb807('0x99')]||![],'pauseType':_0x1ab7e2[_0xb807('0x99')]?_0xb807('0xfb'):null,'interface':_0x579cdf,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb807('0x12')](function(_0x3bee12){if(_0x2d238c['isMiddleware']){return _0x4a4a05();}else{return BPromise[_0xb807('0xfc')](_0x3bee12)[_0xb807('0x12')](respondWithResult(_0x1d87a2,null));}})['catch'](handleError(_0x1d87a2,null));};exports[_0xb807('0xfd')]=function(_0x557bbf,_0x34fe57){var _0x1920ef;return db['User'][_0xb807('0x36')]({'where':{'id':_0x557bbf['params']['id'],'role':_0xb807('0x6d')},'attributes':['id',_0xb807('0x38'),'role']})['then'](handleEntityNotFound(_0x34fe57,null))[_0xb807('0x12')](function(_0x238578){if(_0x238578){_0x1920ef=_0x238578;return db[_0xb807('0xab')]['destroy']({'where':{'membername':_0x1920ef[_0xb807('0x38')]},'individualHooks':!![]});}})[_0xb807('0x12')](function(){return db[_0xb807('0xf4')][_0xb807('0x85')]({'where':{'membername':_0x1920ef[_0xb807('0x38')],'exitAt':null}});})[_0xb807('0x12')](function(_0x2fad29){var _0x364860=[];_0x2fad29['forEach'](function(_0x2c86a5){_0x364860[_0xb807('0x43')](_0x2c86a5[_0xb807('0x58')]({'exitAt':moment()[_0xb807('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x364860);})[_0xb807('0x12')](function(){return _0x1920ef[_0xb807('0x58')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb807('0x12')](respondWithResult(_0x34fe57,null))[_0xb807('0x1d')](handleError(_0x34fe57,null));};exports[_0xb807('0xfe')]=function(_0x2caf8b,_0x4cb687){var _0x51eaa9;return db[_0xb807('0xab')]['update']({'paused':0x1},{'where':{'UserId':_0x2caf8b[_0xb807('0x5c')]['id']},'individualHooks':!![]})[_0xb807('0x12')](function(){return db[_0xb807('0x3d')][_0xb807('0x36')]({'where':{'id':_0x2caf8b['params']['id'],'role':_0xb807('0x6d')},'attributes':['id',_0xb807('0x38'),_0xb807('0x2a'),'internal','interface']});})[_0xb807('0x12')](handleEntityNotFound(_0x4cb687,null))[_0xb807('0x12')](function(_0x4500a6){if(_0x4500a6){_0x51eaa9=_0x4500a6;return respondWithRpcPromise(_0xb807('0xff'),_0xb807('0xfe'),{'id':_0x51eaa9['id'],'name':_0x51eaa9[_0xb807('0x38')],'pause':!![]});}})[_0xb807('0x12')](function(){if(_0x51eaa9){return db[_0xb807('0xf4')][_0xb807('0x85')]({'where':{'membername':_0x51eaa9['name'],'type':_0xb807('0xfa'),'exitAt':null}});}})[_0xb807('0x12')](function(_0x2ab784){if(_0x2ab784[_0xb807('0x47')]){var _0x10921a=moment()[_0xb807('0xa8')](_0xb807('0xf6'));for(var _0xbe8d39=0x0,_0x4c0a2a=_0x2ab784[_0xb807('0x47')];_0xbe8d39<_0x4c0a2a;_0xbe8d39++){_0x2ab784[_0xbe8d39][_0xb807('0x100')]({'exitAt':_0x10921a});}}})[_0xb807('0x12')](function(){var _0x2c6961=[];var _0x1b946c=utils[_0xb807('0xf7')]();_0x1b946c[_0xb807('0xf5')](function(_0x2c8413){_0x2c6961[_0xb807('0x43')]({'channel':_0x2c8413,'membername':_0x51eaa9[_0xb807('0x38')],'interface':_[_0xb807('0x63')](_0x51eaa9[_0xb807('0x9b')])?util[_0xb807('0xa8')]('SIP/%s',_0x51eaa9['name']):_0x51eaa9[_0xb807('0x9b')],'type':_0xb807('0xfa'),'enterAt':moment()[_0xb807('0xa8')](_0xb807('0xf6')),'data1':_0x2caf8b[_0xb807('0x59')][_0xb807('0x101')]||_0xb807('0x102'),'role':_0x51eaa9[_0xb807('0x2a')],'internal':_0x51eaa9[_0xb807('0x62')]});});return db[_0xb807('0xf4')]['bulkCreate'](_0x2c6961,{'individualHooks':!![]});})[_0xb807('0x12')](function(){return _0x51eaa9[_0xb807('0x58')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2caf8b[_0xb807('0x59')][_0xb807('0x101')]||_0xb807('0x102'),'lastPauseAt':moment()[_0xb807('0xa8')](_0xb807('0xf6'))});})[_0xb807('0x12')](respondWithResult(_0x4cb687,null))[_0xb807('0x1d')](handleError(_0x4cb687,null));};exports[_0xb807('0x103')]=function(_0x171d60,_0xd9dd0){var _0x5512ef;return db[_0xb807('0x3d')][_0xb807('0x36')]({'where':{'id':_0x171d60[_0xb807('0x5c')]['id']},'attributes':['id',_0xb807('0x38'),_0xb807('0x2a'),'voicePause',_0xb807('0x104'),_0xb807('0x105'),_0xb807('0x106'),_0xb807('0x107'),_0xb807('0x108'),_0xb807('0x109'),'pauseType','lastPauseAt']})[_0xb807('0x12')](handleEntityNotFound(_0xd9dd0,null))[_0xb807('0x12')](function(_0x5798db){if(_0x5798db){_0x5512ef=_0x5798db;if(_0x171d60[_0xb807('0x59')][_0xb807('0x98')]&&!utils[_0xb807('0x9c')](_0x171d60[_0xb807('0x59')][_0xb807('0x98')])){throw new db[(_0xb807('0x8a'))][(_0xb807('0x8b'))](_0xb807('0x9d'));}switch(_0x171d60[_0xb807('0x59')][_0xb807('0x98')]){case _0xb807('0xa5'):return respondWithRpcPromise(_0xb807('0xff'),_0xb807('0x103'),{'id':_0x5512ef['id'],'name':_0x5512ef[_0xb807('0x38')],'pause':![]})[_0xb807('0x12')](function(){return db[_0xb807('0xab')][_0xb807('0x58')]({'paused':0x0},{'where':{'UserId':_0x5512ef['id']},'individualHooks':!![]});})[_0xb807('0x12')](function(){return db['MemberReport'][_0xb807('0x36')]({'where':{'channel':_0x171d60['body'][_0xb807('0x98')],'membername':_0x5512ef['name'],'type':'PAUSE','exitAt':null}});})[_0xb807('0x12')](function(_0x586d5c){if(_0x586d5c){return _0x586d5c[_0xb807('0x58')]({'exitAt':moment()[_0xb807('0xa8')](_0xb807('0xf6')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xb807('0x12')](function(){return _0x5512ef[_0xb807('0x58')]({'voicePause':![]});});case'mail':case _0xb807('0x57'):case _0xb807('0x4a'):case'sms':case _0xb807('0x4d'):case _0xb807('0x4c'):return db['MemberReport'][_0xb807('0x36')]({'where':{'channel':_0x171d60[_0xb807('0x59')][_0xb807('0x98')],'membername':_0x5512ef[_0xb807('0x38')],'type':_0xb807('0xfa'),'exitAt':null}})['then'](function(_0x4e9cc9){if(_0x4e9cc9){return _0x4e9cc9[_0xb807('0x58')]({'exitAt':moment()[_0xb807('0xa8')](_0xb807('0xf6')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xb807('0x12')](function(){var _0x1cf9f3={};_['set'](_0x1cf9f3,util[_0xb807('0xa8')](_0xb807('0x10a'),_0x171d60[_0xb807('0x59')][_0xb807('0x98')],_0xb807('0x10b')),![]);return _0x5512ef[_0xb807('0x58')](_0x1cf9f3);});default:return respondWithRpcPromise(_0xb807('0xff'),_0xb807('0x103'),{'id':_0x5512ef['id'],'name':_0x5512ef[_0xb807('0x38')],'pause':![]})[_0xb807('0x12')](function(){return db[_0xb807('0xab')][_0xb807('0x58')]({'paused':0x0},{'where':{'UserId':_0x5512ef['id']}});})[_0xb807('0x12')](function(){return db['MemberReport'][_0xb807('0x85')]({'where':{'membername':_0x5512ef[_0xb807('0x38')],'type':_0xb807('0xfa'),'exitAt':null}});})[_0xb807('0x12')](function(_0x35aaec){var _0x540159=[];_0x35aaec[_0xb807('0xf5')](function(_0x930cd4){_0x540159[_0xb807('0x43')](_0x930cd4[_0xb807('0x58')]({'exitAt':moment()[_0xb807('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xb807('0x10c')}));});return BPromise[_0xb807('0x4e')](_0x540159);})['then'](function(){return _0x5512ef[_0xb807('0x58')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xb807('0x12')](respondWithResult(_0xd9dd0,null))[_0xb807('0x1d')](handleError(_0xd9dd0,null));};exports[_0xb807('0x10d')]=function(_0x32f547,_0x57824b){var _0x4e1804={};var _0x4906ef={};var _0x509675;var _0x53dc55;return db[_0xb807('0x3d')]['findOne']({'where':{'id':_0x32f547[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x57824b,null))[_0xb807('0x12')](function(_0x557ca0){if(_0x557ca0){_0x509675=_0x557ca0;_0x4906ef[_0xb807('0x50')]=_[_0xb807('0xc9')](db[_0xb807('0x10e')]['rawAttributes']);_0x4906ef[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0x32f547['query']);_0x4906ef[_0xb807('0x53')]=_[_0xb807('0x54')](_0x4906ef[_0xb807('0x50')],_0x4906ef['query']);_0x4e1804[_0xb807('0x42')]=_[_0xb807('0x54')](_0x4906ef[_0xb807('0x50')],qs[_0xb807('0x55')](_0x32f547[_0xb807('0x3f')][_0xb807('0x55')]));_0x4e1804['attributes']=_0x4e1804[_0xb807('0x42')]['length']?_0x4e1804['attributes']:_0x4906ef[_0xb807('0x50')];_0x4e1804[_0xb807('0xd5')]=qs[_0xb807('0xca')](_0x32f547[_0xb807('0x3f')][_0xb807('0xca')]);_0x4e1804[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x32f547['query'],_0x4906ef[_0xb807('0x53')]));if(_0x32f547['query']['filter']){_0x4e1804[_0xb807('0xcb')]=_['merge'](_0x4e1804[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x4e1804[_0xb807('0x42')],function(_0x455d0f){var _0xf49054={};_0xf49054[_0x455d0f]={'$like':'%'+_0x32f547[_0xb807('0x3f')][_0xb807('0x31')]+'%'};return _0xf49054;})});}_0x4e1804=_['merge']({},_0x4e1804,_0x32f547[_0xb807('0xd7')]);return _0x509675[_0xb807('0x10d')](_0x4e1804);}})[_0xb807('0x12')](function(_0xd1aaaa){if(_0xd1aaaa){_0x53dc55=_0xd1aaaa[_0xb807('0x47')];if(!_0x32f547[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x4e1804['limit']=qs[_0xb807('0x25')](_0x32f547[_0xb807('0x3f')]['limit']);_0x4e1804[_0xb807('0x22')]=qs[_0xb807('0x22')](_0x32f547['query'][_0xb807('0x22')]);}return _0x509675[_0xb807('0x10d')](_0x4e1804);}})[_0xb807('0x12')](function(_0x2dd173){if(_0x2dd173){return _0x2dd173?{'count':_0x53dc55,'rows':_0x2dd173}:null;}})['then'](respondWithResult(_0x57824b,null))['catch'](handleError(_0x57824b,null));};exports[_0xb807('0x10f')]=function(_0x3e3464,_0x2d4784){return db[_0xb807('0x3d')][_0xb807('0x36')]({'where':{'id':_0x3e3464[_0xb807('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2d4784,null))[_0xb807('0x12')](function(_0xc19c7e){if(_0xc19c7e){var _0x5f0c9f=_0xc19c7e['get']({'plain':!![]});return _0xc19c7e[_0xb807('0x10f')](_0x3e3464[_0xb807('0x59')][_0xb807('0x5d')],_['omit'](_0x3e3464[_0xb807('0x59')],[_0xb807('0x5d'),'id'])||{})['then'](function(){for(var _0x3e8b9e=0x0;_0x3e8b9e<_0x3e3464[_0xb807('0x59')][_0xb807('0x5d')][_0xb807('0x47')];_0x3e8b9e++){var _0x4fe51f=[];var _0x4317a6={};db[_0xb807('0x10e')]['findOne']({'where':{'id':_0x3e3464[_0xb807('0x59')][_0xb807('0x5d')][_0x3e8b9e]}})[_0xb807('0x12')](function(_0x4898c9){_0x4317a6=_0x4898c9[_0xb807('0x49')];_0x4fe51f['push'](_0x4898c9[_0xb807('0x110')]()['then'](function(_0x2ca4cf){for(var _0x385aac=0x0;_0x385aac<_0x2ca4cf[_0xb807('0x47')];_0x385aac++){_0x2ca4cf[_0x385aac]['setDataValue'](_0xb807('0x98'),_0xb807('0x111'));}return _0x2ca4cf;}));_0x4fe51f[_0xb807('0x43')](_0x4898c9[_0xb807('0x112')]()['then'](function(_0x34b092){for(var _0x5cca5f=0x0;_0x5cca5f<_0x34b092['length'];_0x5cca5f++){_0x34b092[_0x5cca5f][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x114'));}return _0x34b092;}));_0x4fe51f['push'](_0x4898c9['getMailQueues']()[_0xb807('0x12')](function(_0x4dd287){for(var _0x2027aa=0x0;_0x2027aa<_0x4dd287[_0xb807('0x47')];_0x2027aa++){_0x4dd287[_0x2027aa][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x115'));}return _0x4dd287;}));_0x4fe51f[_0xb807('0x43')](_0x4898c9['getSmsQueues']()['then'](function(_0x243d2d){for(var _0x4005d3=0x0;_0x4005d3<_0x243d2d[_0xb807('0x47')];_0x4005d3++){_0x243d2d[_0x4005d3][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x116'));}return _0x243d2d;}));_0x4fe51f['push'](_0x4898c9[_0xb807('0x117')]()['then'](function(_0x1c6e3f){for(var _0x58e8dc=0x0;_0x58e8dc<_0x1c6e3f['length'];_0x58e8dc++){_0x1c6e3f[_0x58e8dc][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x118'));}return _0x1c6e3f;}));_0x4fe51f['push'](_0x4898c9[_0xb807('0x119')]()[_0xb807('0x12')](function(_0x28d789){for(var _0x35345e=0x0;_0x35345e<_0x28d789['length'];_0x35345e++){_0x28d789[_0x35345e][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x11a'));}return _0x28d789;}));_0x4fe51f[_0xb807('0x43')](_0x4898c9[_0xb807('0x11b')]()[_0xb807('0x12')](function(_0x1958aa){for(var _0x476df9=0x0;_0x476df9<_0x1958aa[_0xb807('0x47')];_0x476df9++){_0x1958aa[_0x476df9][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x11c'));}return _0x1958aa;}));return BPromise[_0xb807('0x4e')](_0x4fe51f);})['then'](function(_0x1b8177){var _0x585278=_[_0xb807('0x11d')](_0x1b8177);_0x4fe51f=[];return db[_0xb807('0x66')][_0xb807('0x11e')](function(_0x3606e3){for(var _0x3aab1b=0x0;_0x3aab1b<_0x585278[_0xb807('0x47')];_0x3aab1b++){_0x4fe51f['push'](_0x585278[_0x3aab1b]['addAgent'](_0x5f0c9f['id']),{'transaction':_0x3606e3});}return BPromise[_0xb807('0x4e')](_0x4fe51f)[_0xb807('0x12')](function(){if(_0x5f0c9f[_0xb807('0xa7')]){return BPromise[_0xb807('0xaa')](_[_0xb807('0x31')](_0x585278,function(_0x4d9e7f){return _0x4d9e7f[_0xb807('0x11f')](_0xb807('0x98'))==='Voice';}),function(_0x33c12d){return db[_0xb807('0xab')][_0xb807('0xf3')]({'membername':_0x5f0c9f[_0xb807('0x38')],'UserId':_0x5f0c9f['id'],'queue_name':_0x33c12d[_0xb807('0x38')],'VoiceQueueId':_0x33c12d['id'],'interface':_[_0xb807('0x63')](_0x5f0c9f['interface'])?util[_0xb807('0xa8')](_0xb807('0xa9'),_0x5f0c9f[_0xb807('0x38')]):_0x5f0c9f[_0xb807('0x9b')],'paused':_0x5f0c9f['voicePause']||![],'penalty':_0x5f0c9f[_0xb807('0xa2')]},{'transaction':_0x3606e3});});}else{return;}})[_0xb807('0x12')](function(){for(var _0x545911=0x0;_0x545911<_0x585278[_0xb807('0x47')];_0x545911++){var _0x185573=_0x585278[_0x545911][_0xb807('0x11f')](_0xb807('0x98'));var _0x13f848=_0x185573+_0xb807('0xa4');socket['emit'](_0xb807('0x2d')+_0x185573+_0xb807('0x120'),{'UserId':_0x5f0c9f['id'],['queueField']:_0x585278[_0x545911]['id']});}});});})['then'](function(){db[_0xb807('0x121')][_0xb807('0xc8')]({'where':{'teamId':_0x4317a6['id']}})[_0xb807('0x12')](function(_0x4fb0e5){if(_0x4fb0e5){db['UserVoicePrefix'][_0xb807('0x7c')]({'UserId':_0x3e3464[_0xb807('0x5c')]['id'],'VoicePrefixId':_0x4fb0e5['VoicePrefixId']});}});});}});}})[_0xb807('0x12')](respondWithStatusCode(_0x2d4784,null))[_0xb807('0x1d')](handleError(_0x2d4784,null));};exports['removeTeams']=function(_0x32d450,_0x44f2b0){return db['User'][_0xb807('0xc8')]({'where':{'id':_0x32d450[_0xb807('0x5c')]['id']}})[_0xb807('0x12')](handleEntityNotFound(_0x44f2b0,null))[_0xb807('0x12')](function(_0x588022){if(_0x588022){var _0xa650dc=_0x588022[_0xb807('0x29')]({'plain':!![]});var _0x1a643c=_0x32d450[_0xb807('0x3f')]['ids'];return _0x588022['removeTeams'](_0x1a643c)[_0xb807('0x12')](function(){for(var _0x25fd74=0x0;_0x25fd74<_0x1a643c[_0xb807('0x47')];_0x25fd74++){var _0x5c0302=[];var _0x547434={};db['Team'][_0xb807('0xc8')]({'where':{'id':_0x1a643c[_0x25fd74]}})['then'](function(_0x1945ea){_0x547434=_0x1945ea[_0xb807('0x49')];_0x5c0302['push'](_0x1945ea[_0xb807('0x110')]()[_0xb807('0x12')](function(_0x33fb0c){for(var _0x28509a=0x0;_0x28509a<_0x33fb0c['length'];_0x28509a++){_0x33fb0c[_0x28509a][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x111'));}return _0x33fb0c;}));_0x5c0302['push'](_0x1945ea['getChatQueues']()[_0xb807('0x12')](function(_0xb2e8ab){for(var _0x1c558b=0x0;_0x1c558b<_0xb2e8ab[_0xb807('0x47')];_0x1c558b++){_0xb2e8ab[_0x1c558b]['setDataValue']('channel',_0xb807('0x114'));}return _0xb2e8ab;}));_0x5c0302[_0xb807('0x43')](_0x1945ea['getMailQueues']()[_0xb807('0x12')](function(_0x415c12){for(var _0xb1a072=0x0;_0xb1a072<_0x415c12[_0xb807('0x47')];_0xb1a072++){_0x415c12[_0xb1a072][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x115'));}return _0x415c12;}));_0x5c0302[_0xb807('0x43')](_0x1945ea[_0xb807('0x122')]()[_0xb807('0x12')](function(_0x134819){for(var _0x13921e=0x0;_0x13921e<_0x134819[_0xb807('0x47')];_0x13921e++){_0x134819[_0x13921e][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x116'));}return _0x134819;}));_0x5c0302[_0xb807('0x43')](_0x1945ea['getWhatsappQueues']()[_0xb807('0x12')](function(_0x5a4598){for(var _0x251942=0x0;_0x251942<_0x5a4598[_0xb807('0x47')];_0x251942++){_0x5a4598[_0x251942][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x118'));}return _0x5a4598;}));_0x5c0302[_0xb807('0x43')](_0x1945ea['getFaxQueues']()[_0xb807('0x12')](function(_0x4d67d7){for(var _0x244ce2=0x0;_0x244ce2<_0x4d67d7[_0xb807('0x47')];_0x244ce2++){_0x4d67d7[_0x244ce2][_0xb807('0x113')](_0xb807('0x98'),'Fax');}return _0x4d67d7;}));_0x5c0302[_0xb807('0x43')](_0x1945ea[_0xb807('0x11b')]()[_0xb807('0x12')](function(_0x1c85f8){for(var _0x575fb8=0x0;_0x575fb8<_0x1c85f8['length'];_0x575fb8++){_0x1c85f8[_0x575fb8][_0xb807('0x113')](_0xb807('0x98'),_0xb807('0x11c'));}return _0x1c85f8;}));return BPromise[_0xb807('0x4e')](_0x5c0302);})[_0xb807('0x12')](function(_0x2370a8){var _0x2c7067=_[_0xb807('0x11d')](_0x2370a8);_0x5c0302=[];return db[_0xb807('0x66')][_0xb807('0x11e')](function(_0x42251c){for(var _0x1895b9=0x0;_0x1895b9<_0x2c7067[_0xb807('0x47')];_0x1895b9++){_0x5c0302[_0xb807('0x43')](_0x2c7067[_0x1895b9][_0xb807('0x123')](_0xa650dc['id']),{'transaction':_0x42251c});}return BPromise[_0xb807('0x4e')](_0x5c0302)[_0xb807('0x12')](function(){if(_0xa650dc['online']){return BPromise[_0xb807('0xaa')](_[_0xb807('0x31')](_0x2c7067,function(_0x438f53){return _0x438f53['getDataValue']('channel')==='Voice';}),function(_0x52130a){return db[_0xb807('0xab')][_0xb807('0x28')]({'where':{'VoiceQueueId':_0x52130a['id'],'UserId':_0xa650dc['id']},'transaction':_0x42251c});});}else{return;}})[_0xb807('0x12')](function(){db[_0xb807('0x121')][_0xb807('0xc8')]({'where':{'teamId':_0x547434['id']}})['then'](function(_0x329a89){if(_0x329a89){return db[_0xb807('0x124')][_0xb807('0x28')]({'where':{'UserId':_0xa650dc['id'],'VoicePrefixId':_0x329a89[_0xb807('0x49')][_0xb807('0x125')]}});}});})['then'](function(){for(var _0xd24810=0x0;_0xd24810<_0x2c7067[_0xb807('0x47')];_0xd24810++){var _0x35aec7=_0x2c7067[_0xd24810]['getDataValue'](_0xb807('0x98'));var _0x555411=_0x35aec7+_0xb807('0xa4');socket[_0xb807('0xae')]('user'+_0x35aec7+_0xb807('0xaf'),{'UserId':_0xa650dc['id'],['queueField']:_0x2c7067[_0xd24810]['id']});}});});});}});}})[_0xb807('0x12')](respondWithStatusCode(_0x44f2b0,null))['catch'](handleError(_0x44f2b0,null));};exports[_0xb807('0x126')]=function(_0xf829ce,_0x47ca63){var _0x2eb8c9={};var _0x1ab382={};var _0x4939a3;var _0x34ada4;return db['User'][_0xb807('0xc8')]({'where':{'id':_0xf829ce[_0xb807('0x5c')]['id']}})['then'](handleEntityNotFound(_0x47ca63,null))[_0xb807('0x12')](function(_0x27fa02){if(_0x27fa02){_0x4939a3=_0x27fa02;_0x1ab382[_0xb807('0x50')]=_[_0xb807('0xc9')](db[_0xb807('0xce')][_0xb807('0x51')]);_0x1ab382[_0xb807('0x3f')]=_[_0xb807('0xc9')](_0xf829ce[_0xb807('0x3f')]);_0x1ab382[_0xb807('0x53')]=_['intersection'](_0x1ab382[_0xb807('0x50')],_0x1ab382[_0xb807('0x3f')]);_0x2eb8c9[_0xb807('0x42')]=_[_0xb807('0x54')](_0x1ab382[_0xb807('0x50')],qs[_0xb807('0x55')](_0xf829ce[_0xb807('0x3f')]['fields']));_0x2eb8c9[_0xb807('0x42')]=_0x2eb8c9[_0xb807('0x42')][_0xb807('0x47')]?_0x2eb8c9[_0xb807('0x42')]:_0x1ab382[_0xb807('0x50')];_0x2eb8c9[_0xb807('0xd5')]=qs[_0xb807('0xca')](_0xf829ce[_0xb807('0x3f')][_0xb807('0xca')]);_0x2eb8c9[_0xb807('0xcb')]=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0xf829ce[_0xb807('0x3f')],_0x1ab382[_0xb807('0x53')]));if(_0xf829ce['query'][_0xb807('0x31')]){_0x2eb8c9[_0xb807('0xcb')]=_[_0xb807('0x56')](_0x2eb8c9[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x2eb8c9[_0xb807('0x42')],function(_0x4ddbbf){var _0x1c2b23={};_0x1c2b23[_0x4ddbbf]={'$like':'%'+_0xf829ce['query'][_0xb807('0x31')]+'%'};return _0x1c2b23;})});}_0x2eb8c9=_['merge']({},_0x2eb8c9,_0xf829ce[_0xb807('0xd7')]);return _0x4939a3[_0xb807('0x126')](_0x2eb8c9);}})[_0xb807('0x12')](function(_0x5121d4){if(_0x5121d4){_0x34ada4=_0x5121d4[_0xb807('0x47')];if(!_0xf829ce[_0xb807('0x3f')][_0xb807('0xcc')](_0xb807('0xd3'))){_0x2eb8c9['limit']=qs[_0xb807('0x25')](_0xf829ce[_0xb807('0x3f')][_0xb807('0x25')]);_0x2eb8c9[_0xb807('0x22')]=qs['offset'](_0xf829ce[_0xb807('0x3f')]['offset']);}return _0x4939a3['getLists'](_0x2eb8c9);}})['then'](function(_0x213c3e){if(_0x213c3e){return _0x213c3e?{'count':_0x34ada4,'rows':_0x213c3e}:null;}})[_0xb807('0x12')](respondWithResult(_0x47ca63,null))[_0xb807('0x1d')](handleError(_0x47ca63,null));};exports[_0xb807('0x127')]=function(_0x292e13,_0x417f7d){var _0x36d6d0={};var _0x2ff73b={};var _0x3b319b;return db[_0xb807('0x3d')][_0xb807('0xc8')]({'where':{'id':_0x292e13[_0xb807('0x5c')]['id']}})['then'](handleEntityNotFound(_0x417f7d,null))[_0xb807('0x12')](function(_0x1eb86a){if(_0x1eb86a){_0x3b319b=_0x1eb86a;_0x2ff73b['model']=_[_0xb807('0xc9')](db[_0xb807('0x3d')][_0xb807('0x51')]);_0x2ff73b['query']=_[_0xb807('0xc9')](_0x292e13['query']);_0x2ff73b['filters']=_['intersection'](_0x2ff73b[_0xb807('0x50')],_0x2ff73b[_0xb807('0x3f')]);_0x36d6d0[_0xb807('0x42')]=_['intersection'](_0x2ff73b[_0xb807('0x50')],qs[_0xb807('0x55')](_0x292e13['query'][_0xb807('0x55')]));_0x36d6d0[_0xb807('0x42')]=_0x36d6d0[_0xb807('0x42')][_0xb807('0x47')]?_0x36d6d0[_0xb807('0x42')]:_0x2ff73b[_0xb807('0x50')];_0x36d6d0[_0xb807('0xd5')]=qs['sort'](_0x292e13['query']['sort']);_0x36d6d0['where']=qs[_0xb807('0x53')](_[_0xb807('0xd6')](_0x292e13[_0xb807('0x3f')],_0x2ff73b['filters']));if(_0x292e13[_0xb807('0x3f')][_0xb807('0x31')]){_0x36d6d0[_0xb807('0xcb')]=_['merge'](_0x36d6d0[_0xb807('0xcb')],{'$or':_[_0xb807('0x33')](_0x36d6d0['attributes'],function(_0x7eb7b){var _0x1cc2ac={};_0x1cc2ac[_0x7eb7b]={'$like':'%'+_0x292e13[_0xb807('0x3f')]['filter']+'%'};return _0x1cc2ac;})});}_0x36d6d0[_0xb807('0x50')]=db[_0xb807('0x3d')];_0x36d6d0['as']=_0xb807('0x2e');_0x36d6d0=_[_0xb807('0x56')]({},_0x36d6d0,_0x292e13['options']);return _0x3b319b[_0xb807('0x110')]({'include':[_0x36d6d0]});}})['then'](function(_0x28f867){if(_0x28f867){var _0x588534={},_0x23e92b=[];for(var _0xb82b=0x0;_0xb82b<_0x28f867['length'];_0xb82b+=0x1){for(var _0xc55b81=0x0,_0x5eaa2b;_0xc55b81<_0x28f867[_0xb82b]['Agents'][_0xb807('0x47')];_0xc55b81+=0x1){_0x5eaa2b=_0x28f867[_0xb82b]['Agents'][_0xc55b81][_0xb807('0x29')]({'plain':!![]});_0x588534[_0x5eaa2b['id']]=_0x5eaa2b;}}_0x588534=_[_0xb807('0x128')](_0x588534);for(var _0x1fd163=qs[_0xb807('0x22')](_0x292e13['query'][_0xb807('0x22')]);_0x1fd163<_0x588534['length']&&_0x23e92b[_0xb807('0x47')]=_0x560531){_0xb9ae49=_0x560531;_0x2390e9=0xc8;}else{_0x2390e9=0xce;}_0x2b8bb0[_0xb373('0x1d')](_0x2390e9);return _0x2b8bb0[_0xb373('0x23')](_0xb373('0x24'),_0xf7de58+'-'+_0xb9ae49+'/'+_0x560531)['json'](_0x4bbaa1);}return null;};}function saveUpdates(_0x38e233){return function(_0x81b2d8){if(_0x81b2d8){return _0x81b2d8[_0xb373('0x25')](_0x38e233)['then'](function(_0x358d7d){return _0x358d7d;});}return null;};}function removeEntity(_0x2cd383){return function(_0x139068){if(_0x139068){return _0x139068[_0xb373('0x26')]()[_0xb373('0x27')](function(){var _0x287d7b=_0x139068['get']({'plain':!![]});if(_0x287d7b['role']==='admin')return;var _0x283af5=[{'name':_0xb373('0x28'),'value':'user','ignore':!![]},{'name':'Agents','value':_0xb373('0x29'),'ignore':![]},{'name':_0xb373('0x2a'),'value':'telephone','ignore':![]}];var _0x17f73d=_(_0x283af5)[_0xb373('0x2b')](_0xb373('0x2c'))[_0xb373('0x2d')](_0xb373('0x2e'))[_0xb373('0x2e')]();if(_[_0xb373('0x2f')](_0x17f73d,_0x287d7b[_0xb373('0x30')])){return;}var _0x3d1585=_['find'](_0x283af5,[_0xb373('0x2e'),_0x287d7b['role']])['name'];return db[_0xb373('0x31')][_0xb373('0x26')]({'where':{'type':_0x3d1585,'resourceId':_0x287d7b['id']}})[_0xb373('0x27')](function(){return _0x139068;});})[_0xb373('0x27')](function(){_0x2cd383[_0xb373('0x1d')](0xcc)[_0xb373('0x32')]();});}};}function handleEntityNotFound(_0x56bc33){return function(_0x1ec180){if(!_0x1ec180){_0x56bc33['sendStatus'](0x194);}return _0x1ec180;};}function handleError(_0x589a6e,_0x28fcb9){_0x28fcb9=_0x28fcb9||0x1f4;return function(_0x4e8377){logger[_0xb373('0x19')](_0x4e8377[_0xb373('0x33')]);if(_0x4e8377['name']){delete _0x4e8377[_0xb373('0x34')];}_0x589a6e[_0xb373('0x1d')](_0x28fcb9)[_0xb373('0x35')](_0x4e8377);};}exports['index']=function(_0x4cb227,_0x506e6e){var _0x52f3b5={},_0x122c2b={'count':0x0,'rows':[]};var _0xf57bc8=_(db[_0xb373('0x36')][_0xb373('0x37')])[_0xb373('0x2d')](function(_0x570629){return{'name':_0x570629['fieldName'],'type':_0x570629['type']['key']};})['filter'](function(_0x166a81){return!_[_0xb373('0x2f')]([_0xb373('0x38'),_0xb373('0x39')],_0x166a81[_0xb373('0x34')]);})['value']();_0x52f3b5=qs[_0xb373('0x3a')](_0xf57bc8,_0x4cb227);var _0xa6794b={'where':_0x52f3b5[_0xb373('0x3b')]};return db[_0xb373('0x36')][_0xb373('0x22')](_0xa6794b)[_0xb373('0x27')](function(_0x73c06){_0x122c2b[_0xb373('0x22')]=_0x73c06;if(_0x4cb227[_0xb373('0x3c')][_0xb373('0x3d')]){_0x52f3b5[_0xb373('0x3e')]=[{'all':!![]}];}if(_0x4cb227[_0xb373('0x3c')]['userSetting']===_0xb373('0x3f')){_0x52f3b5['include']=[{'model':db[_0xb373('0x40')],'as':_0xb373('0x41')}];}if(!_['includes'](_0x52f3b5[_0xb373('0x42')],'id')){_0x52f3b5['attributes'][_0xb373('0x43')]('id');}return db[_0xb373('0x36')][_0xb373('0x44')](_0x52f3b5);})[_0xb373('0x27')](function(_0x45835b){_0x122c2b[_0xb373('0x45')]=_0x45835b;if(_0x4cb227[_0xb373('0x3c')][_0xb373('0x46')]===_0xb373('0x3f')){var _0x2c7a7d=[];for(var _0x4c0fd2=0x0;_0x4c0fd2<_0x122c2b[_0xb373('0x45')][_0xb373('0x47')];_0x4c0fd2++){_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x48'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2]['dataValues']));_0x2c7a7d['push'](get_open_tabs(_0xb373('0x49'),_0x122c2b['rows'][_0x4c0fd2][_0xb373('0x4a')]));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4b'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2][_0xb373('0x4a')]));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4c'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2][_0xb373('0x4a')]));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4d'),_0x122c2b['rows'][_0x4c0fd2]['dataValues']));_0x2c7a7d[_0xb373('0x43')](get_open_tabs(_0xb373('0x4e'),_0x122c2b[_0xb373('0x45')][_0x4c0fd2][_0xb373('0x4a')]));}return BPromise['all'](_0x2c7a7d)['then'](function(){return _0x122c2b;});}else{return _0x122c2b;}})[_0xb373('0x27')](respondWithFilteredResult(_0x506e6e,_0x52f3b5))[_0xb373('0x1c')](handleError(_0x506e6e,null));};exports['show']=function(_0x285b97,_0x496659){var _0x144b5d={'raw':![],'where':{'id':_0x285b97['params']['id']}},_0x81fe4f={};_0x81fe4f['model']=_['differenceBy'](_[_0xb373('0x4f')](db[_0xb373('0x36')][_0xb373('0x37')]),[_0xb373('0x38'),_0xb373('0x39')]);_0x81fe4f[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x285b97[_0xb373('0x3c')]);_0x81fe4f['filters']=_[_0xb373('0x50')](_0x81fe4f['model'],_0x81fe4f[_0xb373('0x3c')]);_0x144b5d[_0xb373('0x42')]=_['intersection'](_0x81fe4f[_0xb373('0x51')],qs['fields'](_0x285b97[_0xb373('0x3c')][_0xb373('0x52')]));_0x144b5d[_0xb373('0x42')]=_0x144b5d['attributes'][_0xb373('0x47')]?_0x144b5d['attributes']:_0x81fe4f[_0xb373('0x51')];if(_0x285b97['query'][_0xb373('0x3d')]){_0x144b5d[_0xb373('0x3e')]=[{'all':!![]}];}if(_0x285b97[_0xb373('0x3c')]['userSetting']===_0xb373('0x3f')){_0x144b5d['include']=[{'model':db[_0xb373('0x40')],'as':'userSetting'}];}_0x144b5d=_['merge']({},_0x144b5d,_0x285b97[_0xb373('0x53')]);if(!_['includes'](_0x144b5d[_0xb373('0x42')],'id')){_0x144b5d[_0xb373('0x42')][_0xb373('0x43')]('id');}return db[_0xb373('0x36')][_0xb373('0x54')](_0x144b5d)[_0xb373('0x27')](handleEntityNotFound(_0x496659,null))['then'](function(_0x4fa750){var _0x3ddfe3=[];values=_0x4fa750;if(_0x285b97[_0xb373('0x3c')][_0xb373('0x46')]===_0xb373('0x3f')){_0x3ddfe3['push'](get_open_tabs(_0xb373('0x48'),_0x4fa750['dataValues']));_0x3ddfe3[_0xb373('0x43')](get_open_tabs(_0xb373('0x49'),_0x4fa750['dataValues']));_0x3ddfe3[_0xb373('0x43')](get_open_tabs(_0xb373('0x4d'),_0x4fa750[_0xb373('0x4a')]));_0x3ddfe3[_0xb373('0x43')](get_open_tabs('whatsapp',_0x4fa750[_0xb373('0x4a')]));_0x3ddfe3['push'](get_open_tabs(_0xb373('0x4b'),_0x4fa750[_0xb373('0x4a')]));_0x3ddfe3[_0xb373('0x43')](get_open_tabs(_0xb373('0x4c'),_0x4fa750[_0xb373('0x4a')]));return BPromise['all'](_0x3ddfe3);}else{return values;}})[_0xb373('0x27')](function(){return values;})['then'](respondWithResult(_0x496659,null))['catch'](handleError(_0x496659,null));};exports[_0xb373('0x25')]=function(_0x4853a2,_0x16863b){if(_0x4853a2[_0xb373('0x55')]['id']){delete _0x4853a2['body']['id'];}delete _0x4853a2[_0xb373('0x55')][_0xb373('0x30')];return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x4853a2[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x16863b,null))['then'](saveUpdates(_0x4853a2[_0xb373('0x55')],null))[_0xb373('0x27')](respondWithResult(_0x16863b,null))[_0xb373('0x1c')](handleError(_0x16863b,null));};exports[_0xb373('0x57')]=function(_0x3abcae,_0x379944){return db['User'][_0xb373('0x57')]()['then'](respondWithResult(_0x379944,null))['catch'](handleError(_0x379944,null));};exports['addContacts']=function(_0x2af4a5,_0x55eb7f){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2af4a5[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x55eb7f,null))[_0xb373('0x27')](function(_0x4ee169){if(_0x4ee169){return _0x4ee169[_0xb373('0x58')](_0x2af4a5[_0xb373('0x55')][_0xb373('0x59')],_[_0xb373('0x5a')](_0x2af4a5[_0xb373('0x55')],[_0xb373('0x59'),'id'])||{});}})[_0xb373('0x27')](respondWithResult(_0x55eb7f,null))[_0xb373('0x1c')](handleError(_0x55eb7f,null));};function validateUser(_0x5f42b3){return new BPromise(function(_0x3e92c0,_0x19cc6e){if(_0x5f42b3['internal'])return _0x3e92c0(_0x5f42b3);return db[_0xb373('0x5b')][_0xb373('0x5c')](0x1)['then'](function(_0x516229){if(_0x516229[_0xb373('0x5d')])authService[_0xb373('0x5e')](_0x5f42b3[_0xb373('0x38')]);db['User'][_0xb373('0x5f')]('internal')[_0xb373('0x27')](function(_0x101d35){if(_[_0xb373('0x60')](_0x101d35)){_0x5f42b3[_0xb373('0x61')]=_0x516229[_0xb373('0x62')]||0x1;return;}if(_[_0xb373('0x60')](_0x516229[_0xb373('0x62')])||_0x516229[_0xb373('0x62')]===_0x101d35){_0x5f42b3[_0xb373('0x61')]=_0x101d35+0x1;return;}if(_0x516229[_0xb373('0x62')]>_0x101d35){_0x5f42b3['internal']=_0x516229[_0xb373('0x62')];return;}return db['sequelize'][_0xb373('0x3c')](_0xb373('0x63'),{'type':db[_0xb373('0x64')][_0xb373('0x65')][_0xb373('0x66')]})[_0xb373('0x27')](function(_0x1a2d09){if(_0x1a2d09&&_0x1a2d09[_0xb373('0x47')]){for(var _0x4eaecf=0x0,_0x35b9eb=_0x1a2d09[_0xb373('0x47')];_0x4eaecf<_0x35b9eb&&_['isNil'](_0x5f42b3[_0xb373('0x61')]);_0x4eaecf++){if(_0x516229[_0xb373('0x62')]<=_0x1a2d09[_0x4eaecf][_0xb373('0x67')]){_0x5f42b3[_0xb373('0x61')]=_0x1a2d09[_0x4eaecf][_0xb373('0x67')];}else if(_0x516229[_0xb373('0x62')]>_0x1a2d09[_0x4eaecf][_0xb373('0x67')]&&_0x516229[_0xb373('0x62')]<=_0x1a2d09[_0x4eaecf]['to']){_0x5f42b3[_0xb373('0x61')]=_0x516229[_0xb373('0x62')];}}}if(_['isNil'](_0x5f42b3[_0xb373('0x61')])){_0x5f42b3[_0xb373('0x61')]=_0x101d35+0x1;}return _0x3e92c0(_0x5f42b3);});});})['catch'](function(_0x512790){_0x19cc6e(_0x512790);});});}function updateUser(_0x39dae3){return new BPromise(function(_0x43d93d,_0x4e10b8){try{if(_0x39dae3[_0xb373('0x68')]){_0x39dae3[_0xb373('0x69')]=_0x39dae3[_0xb373('0x61')];_0x39dae3[_0xb373('0x6a')]={'mailbox':_0x39dae3['internal'],'password':_0x39dae3[_0xb373('0x38')],'fullname':_0x39dae3['fullname'],'email':_0x39dae3[_0xb373('0x6b')]};}if(_0x39dae3[_0xb373('0x30')]===_0xb373('0x29')){if(!_0x39dae3[_0xb373('0x6c')])_0x39dae3['permissions']=[_0xb373('0x6d'),'102',_0xb373('0x6e'),'113',_0xb373('0x6f'),_0xb373('0x70'),_0xb373('0x71'),'106',_0xb373('0x72'),_0xb373('0x73'),'109',_0xb373('0x74'),_0xb373('0x75'),_0xb373('0x76'),'115'];}_0x43d93d(_0x39dae3);}catch(_0x7fa7e6){_0x4e10b8(_0x7fa7e6);}});}exports[_0xb373('0x77')]=function(_0x146b48,_0x3789d0){if(_0x146b48['user'][_0xb373('0x30')]===_0xb373('0x29'))throw new Error(_0xb373('0x78'));if(_0x146b48['body'][_0xb373('0x30')]===_0xb373('0x79')&&_0x146b48['user'][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error(_0xb373('0x7b'));}if(_0x146b48[_0xb373('0x55')][_0xb373('0x30')]==='admin'&&_0x146b48[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error(_0xb373('0x7c'));}return licenseUtil[_0xb373('0x7d')]([_0x146b48['body']])[_0xb373('0x27')](function(){return validateUser(_0x146b48[_0xb373('0x55')]);})[_0xb373('0x27')](function(_0x53cf58){return updateUser(_0x53cf58)[_0xb373('0x27')](function(_0x32127a){if(_0x32127a[_0xb373('0x30')]===_0xb373('0x7a')){_0x32127a[_0xb373('0x7e')]=_0x146b48[_0xb373('0x79')][_0xb373('0x7e')];delete _0x32127a[_0xb373('0x7f')];}return _0x32127a;});})[_0xb373('0x27')](function(_0x2e12e1){return db['User'][_0xb373('0x77')](_0x2e12e1,{'include':[{'model':db[_0xb373('0x6a')],'as':_0xb373('0x6a')}]});})[_0xb373('0x27')](function(_0x27370e){if(_0x146b48[_0xb373('0x55')][_0xb373('0x30')]===_0xb373('0x79'))return _0x27370e;if(_0x146b48[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x79'))return _0x27370e;return db['UserProfileSection'][_0xb373('0x54')]({'where':{'name':_0x27370e['role']==='agent'?'Agents':'Telephones','userProfileId':_0x146b48[_0xb373('0x79')][_0xb373('0x7f')]},'raw':!![]})['then'](function(_0x5337aa){if(!_0x5337aa||_0x5337aa[_0xb373('0x80')]!=0x0)return _0x27370e;return db[_0xb373('0x31')][_0xb373('0x77')]({'name':_0x27370e[_0xb373('0x34')],'resourceId':_0x27370e['id'],'type':_0x5337aa[_0xb373('0x34')],'sectionId':_0x5337aa['id']},{})[_0xb373('0x27')](function(){return _0x27370e;});})['catch'](function(_0x14e505){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14e505);throw _0x14e505;});})[_0xb373('0x27')](respondWithResult(_0x3789d0,0xc9))[_0xb373('0x1c')](handleError(_0x3789d0,null));};exports[_0xb373('0x81')]=function(_0x173eaa,_0x46c645){var _0x4e68f3=_0x173eaa[_0xb373('0x55')];var _0x3d2c10=[];if(_0x173eaa[_0xb373('0x79')]['role']===_0xb373('0x29'))throw new Error(_0xb373('0x78'));if(_[_0xb373('0x82')](_0x4e68f3,[_0xb373('0x30'),_0xb373('0x79')])&&_0x173eaa[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xb373('0x82')](_0x4e68f3,[_0xb373('0x30'),'admin'])&&_0x173eaa[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x7a')){throw new Error(_0xb373('0x83'));}return licenseUtil[_0xb373('0x7d')](_0x4e68f3)[_0xb373('0x27')](function(){return validateUser(_0x4e68f3[0x0]);})[_0xb373('0x27')](function(){for(var _0x35d9ed=0x1;_0x35d9ed<_0x4e68f3['length'];_0x35d9ed++){var _0xbafd61=_0x4e68f3[_0x35d9ed-0x1]['internal'];if(!_0x4e68f3[_0x35d9ed]['internal'])_0x4e68f3[_0x35d9ed]['internal']=_0xbafd61+0x1;_0x3d2c10[_0xb373('0x43')](validateUser(_0x4e68f3[_0x35d9ed]));}return BPromise['all'](_0x3d2c10);})['then'](function(){_0x3d2c10=[];for(var _0x3afde2=0x0;_0x3afde2<_0x4e68f3['length'];_0x3afde2++){_0x3d2c10[_0xb373('0x43')](updateUser(_0x4e68f3[_0x3afde2]));}return BPromise['all'](_0x3d2c10);})[_0xb373('0x27')](function(){return BPromise['each'](_0x4e68f3,function(_0x25df81){return db['User'][_0xb373('0x77')](_0x25df81,{'include':[{'model':db[_0xb373('0x6a')],'as':_0xb373('0x6a')}]})[_0xb373('0x27')](function(_0x51c95a){_0x25df81['id']=_0x51c95a['id'];return _0x25df81;});});})['then'](function(_0x23247d){if(_0x173eaa['body'][_0xb373('0x30')]===_0xb373('0x79'))return _0x23247d;if(_0x173eaa[_0xb373('0x79')][_0xb373('0x30')]!==_0xb373('0x79'))return _0x23247d;var _0x2ab2d9=_[_0xb373('0x82')](_0x23247d,function(_0x292372){return _0x292372[_0xb373('0x30')]===_0xb373('0x29')||_0x292372[_0xb373('0x30')]==='telephone';});if(!_0x2ab2d9)return _0x23247d;return db[_0xb373('0x84')][_0xb373('0x44')]({'where':{'name':{'$or':[_0xb373('0x85'),_0xb373('0x2a')]},'userProfileId':_0x173eaa[_0xb373('0x79')]['userProfileId']},'raw':!![]})[_0xb373('0x27')](function(_0x5748ba){if(_[_0xb373('0x86')](_0x5748ba)||!_[_0xb373('0x82')](_0x5748ba,[_0xb373('0x80'),0x0]))return _0x23247d;_0x3d2c10=[];var _0x4930e5=_(_0x5748ba)['map'](function(_0x63ecdd){if(_0x63ecdd[_0xb373('0x80')]===0x1)return;return _0x63ecdd[_0xb373('0x34')]===_0xb373('0x85')?_0xb373('0x29'):_0xb373('0x87');})[_0xb373('0x88')]()[_0xb373('0x2e')]();for(var _0x46d15e=0x0;_0x46d15e<_0x23247d[_0xb373('0x47')];_0x46d15e++){if(!_[_0xb373('0x2f')](_0x4930e5,_0x23247d[_0x46d15e]['role']))return;var _0x2c6308=_0x23247d[_0x46d15e]['role']===_0xb373('0x29')?_0xb373('0x85'):'Telephones';_0x3d2c10[_0xb373('0x43')](db[_0xb373('0x31')]['create']({'name':_0x23247d[_0x46d15e][_0xb373('0x34')],'resourceId':_0x23247d[_0x46d15e]['id'],'type':_0x2c6308,'sectionId':_[_0xb373('0x54')](_0x5748ba,[_0xb373('0x34'),_0x2c6308])['id']},{}));}return BPromise[_0xb373('0x89')](_0x3d2c10);});})['then'](respondWithResult(_0x46c645,0xc9))[_0xb373('0x1c')](handleError(_0x46c645,null));};exports[_0xb373('0x8a')]=function(_0x2527f3,_0x2624f4){if(_0x2527f3[_0xb373('0x55')]['id']){delete _0x2527f3[_0xb373('0x55')]['id'];}return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2527f3[_0xb373('0x56')]['id']}})['then'](function(_0x4f6d9a){if(!_0x4f6d9a)return null;if(_0x4f6d9a['id']===_0x2527f3[_0xb373('0x79')]['id']){if(!_0x2527f3['body'][_0xb373('0x8b')]||!_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]){throw new db[(_0xb373('0x8d'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4f6d9a[_0xb373('0x8e')](_0x2527f3[_0xb373('0x55')][_0xb373('0x8b')])){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x90'));}if(_0x2527f3[_0xb373('0x55')][_0xb373('0x8b')]===_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]){throw new db['Sequelize']['ValidationError'](_0xb373('0x91'));}}else if(_0x2527f3[_0xb373('0x79')][_0xb373('0x30')]===_0xb373('0x7a')){if(!_0x2527f3[_0xb373('0x55')]['newPassword']){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x92'));}}else if(_0x2527f3[_0xb373('0x79')][_0xb373('0x30')]==='user'){if(!_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]){throw new db[(_0xb373('0x8d'))]['ValidationError'](_0xb373('0x92'));}if(_0x4f6d9a[_0xb373('0x30')]!=='agent'){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0xb373('0x8f'))](_0xb373('0x78'));}return _0x4f6d9a;})[_0xb373('0x27')](handleEntityNotFound(_0x2624f4,null))['then'](function(_0x16cc52){return db[_0xb373('0x5b')][_0xb373('0x93')]({'attributes':['id','securePassword',_0xb373('0x94'),_0xb373('0x95')]})[_0xb373('0x27')](function(_0x43c6bf){if(_0x43c6bf[_0xb373('0x5d')])authService['validatePasswordPattern'](_0x2527f3[_0xb373('0x55')][_0xb373('0x8c')]);if(!_0x43c6bf[_0xb373('0x94')]||!_0x16cc52[_0xb373('0x96')])return _0x16cc52;authService[_0xb373('0x97')](_0x2527f3[_0xb373('0x55')]['newPassword'],_0x16cc52[_0xb373('0x96')],_0x43c6bf[_0xb373('0x95')]);return _0x16cc52;})['then'](saveUpdates({'password':_0x2527f3[_0xb373('0x55')]['newPassword'],'passwordResetAt':_0x2527f3[_0xb373('0x79')]['id']==_0x2527f3[_0xb373('0x56')]['id']?moment():null,'previousPasswords':authService[_0xb373('0x98')](_0x2527f3['body']['newPassword'],_0x16cc52[_0xb373('0x96')])},null));})[_0xb373('0x27')](respondWithResult(_0x2624f4,null))[_0xb373('0x1c')](handleError(_0x2624f4,null));};exports['addQueues']=function(_0x5c3fce,_0x20908a){var _0x35bc9f=_0x5c3fce['body'][_0xb373('0x99')];return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x5c3fce[_0xb373('0x56')]['id']},'attributes':['id','name','role','online',_0xb373('0x9a'),'voicePause',_0xb373('0x9b')]})['then'](handleEntityNotFound(_0x20908a,null))[_0xb373('0x27')](function(_0x51fed9){if(_0x51fed9){if(!utils[_0xb373('0x9c')](_0x35bc9f)){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x9d'));}return _0x51fed9['add'+_[_0xb373('0x9e')](_0x35bc9f[_0xb373('0x9f')]())+_0xb373('0xa0')](_0x5c3fce[_0xb373('0x55')][_0xb373('0x59')],{'penalty':_0x5c3fce[_0xb373('0x55')][_0xb373('0xa1')]||0x0})[_0xb373('0xa2')](function(_0x340bfd){for(var _0x39a9c4=0x0;_0x39a9c4<_0x5c3fce[_0xb373('0x55')]['ids']['length'];_0x39a9c4+=0x1){var _0x1fc2dc={'UserId':Number(_0x5c3fce[_0xb373('0x56')]['id'])};_0x1fc2dc[_[_0xb373('0x9e')](_0x35bc9f[_0xb373('0x9f')]())+_0xb373('0xa3')]=Number(_0x5c3fce['body'][_0xb373('0x59')][_0x39a9c4]);socket[_0xb373('0xa4')](_0xb373('0x79')+_[_0xb373('0x9e')](_0x35bc9f[_0xb373('0x9f')]())+_0xb373('0xa5'),_0x1fc2dc);}return _0x340bfd;})[_0xb373('0x27')](function(){if(_0x35bc9f===_0xb373('0xa6')){return db[_0xb373('0xa7')][_0xb373('0x44')]({'where':{'id':_0x5c3fce[_0xb373('0x55')][_0xb373('0x59')]||[]},'raw':!![],'attributes':['id',_0xb373('0x34')]});}})[_0xb373('0x27')](function(_0x315874){var _0x38c7df=_0x51fed9['get']({'plain':!![]});var _0x291149=[];if(_0x35bc9f==='voice'&&_0x38c7df[_0xb373('0x30')]===_0xb373('0x29')&&_0x38c7df[_0xb373('0xa8')]){for(var _0x206631=0x0;_0x206631<_0x315874[_0xb373('0x47')];_0x206631+=0x1){_0x291149['push']({'membername':_0x38c7df[_0xb373('0x34')],'UserId':_0x38c7df['id'],'queue_name':_0x315874[_0x206631][_0xb373('0x34')],'VoiceQueueId':_0x315874[_0x206631]['id'],'interface':_[_0xb373('0x60')](_0x38c7df[_0xb373('0x9b')])?util['format'](_0xb373('0xa9'),_0x38c7df[_0xb373('0x34')]):_0x38c7df[_0xb373('0x9b')],'paused':_0x38c7df['voicePause']||![],'penalty':_0x5c3fce[_0xb373('0x55')]['penalty']||0x0});}return BPromise[_0xb373('0xaa')](_0x291149,function(_0x53cb03){return db['UserVoiceQueueRt'][_0xb373('0xab')](_0x53cb03);});}return _0x51fed9;});}})[_0xb373('0x27')](respondWithStatusCode(_0x20908a,null))[_0xb373('0x1c')](handleError(_0x20908a,null));};exports[_0xb373('0xac')]=function(_0xbeef42,_0x301e1f){var _0x44e5e0,_0xef7714;return db['User'][_0xb373('0x54')]({'where':{'id':_0xbeef42[_0xb373('0x56')]['id']},'attributes':['id',_0xb373('0x34'),_0xb373('0x30')]})[_0xb373('0x27')](handleEntityNotFound(_0x301e1f,null))[_0xb373('0x27')](function(_0x2e172e){if(_0x2e172e){_0x44e5e0=_0x2e172e;if(!_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')]||!utils[_0xb373('0x9c')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')])){throw new db['Sequelize']['ValidationError'](_0xb373('0x9d'));}return _0x2e172e['remove'+_[_0xb373('0x9e')](_0xbeef42['query'][_0xb373('0x99')][_0xb373('0x9f')]())+_0xb373('0xa0')](_0xbeef42[_0xb373('0x3c')]['ids']);}})[_0xb373('0x27')](function(_0xb2df2){if(_[_0xb373('0xad')](_0xbeef42['query'][_0xb373('0x59')])){for(var _0xe9c959=0x0;_0xe9c959<_0xbeef42['query'][_0xb373('0x59')][_0xb373('0x47')];_0xe9c959+=0x1){_0xef7714={'UserId':Number(_0xbeef42['params']['id'])};_0xef7714[_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')][_0xb373('0x9f')]())+'QueueId']=Number(_0xbeef42[_0xb373('0x3c')][_0xb373('0x59')][_0xe9c959]);socket['emit'](_0xb373('0x79')+_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')]['toLowerCase']())+_0xb373('0xae'),_0xef7714);}}else{_0xef7714={'UserId':Number(_0xbeef42[_0xb373('0x56')]['id'])};_0xef7714[_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')][_0xb373('0x9f')]())+_0xb373('0xa3')]=Number(_0xbeef42[_0xb373('0x3c')][_0xb373('0x59')]);socket[_0xb373('0xa4')](_0xb373('0x79')+_[_0xb373('0x9e')](_0xbeef42[_0xb373('0x3c')]['channel']['toLowerCase']())+_0xb373('0xae'),_0xef7714);}return _0xb2df2;})[_0xb373('0x27')](function(){if(_0xbeef42[_0xb373('0x3c')][_0xb373('0x99')]==='voice'){return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'UserId':_0xbeef42[_0xb373('0x56')]['id'],'VoiceQueueId':_0xbeef42[_0xb373('0x3c')][_0xb373('0x59')]},'individualHooks':!![]})[_0xb373('0x27')](function(){return _0x44e5e0;});}return _0x44e5e0;})['then'](respondWithStatusCode(_0x301e1f,null))[_0xb373('0x1c')](handleError(_0x301e1f,null));};exports[_0xb373('0xb0')]=function(_0x2d02cc,_0x54fce3){_0x2d02cc[_0xb373('0x55')][_0xb373('0xb1')]=_0x2d02cc['file'][_0xb373('0xb2')];return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2d02cc[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x54fce3,null))[_0xb373('0x27')](saveUpdates(_0x2d02cc['body'],null))[_0xb373('0x27')](respondWithResult(_0x54fce3,null))[_0xb373('0x1c')](handleError(_0x54fce3,null));};exports['getAvatar']=function(_0x2fca2e,_0x5c6b6b){var _0x5d9fdd=path[_0xb373('0xb3')](config[_0xb373('0xb4')],_0xb373('0xb5'));return db[_0xb373('0x36')]['find']({'where':{'id':_0x2fca2e[_0xb373('0x56')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xb373('0x27')](handleEntityNotFound(_0x5c6b6b,null))[_0xb373('0x27')](function(_0x103a31){if(_0x103a31){if(_['isNil'](_0x103a31[_0xb373('0xb1')])){return _0x5c6b6b[_0xb373('0xb6')](_0x5d9fdd);}else{if(!fs[_0xb373('0xb7')](path[_0xb373('0xb3')](config[_0xb373('0xb4')],_0xb373('0xb8'),_0x103a31[_0xb373('0xb1')]))){return _0x5c6b6b[_0xb373('0xb6')](_0x5d9fdd);}return _0x5c6b6b[_0xb373('0xb6')](path[_0xb373('0xb3')](config[_0xb373('0xb4')],'server/files/images/',_0x103a31[_0xb373('0xb1')]));}}})[_0xb373('0x1c')](handleError(_0x5c6b6b,null));};exports[_0xb373('0xb9')]=function(_0x4df320,_0x3953f8){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x4df320[_0xb373('0x56')]['id']},'attributes':['id']})[_0xb373('0x27')](handleEntityNotFound(_0x3953f8,null))['then'](function(_0x1946d8){var _0x28af12=[];values=_0x1946d8[_0xb373('0x4a')];_0x28af12[_0xb373('0x43')](get_open_tabs('chat',_0x1946d8['dataValues']));_0x28af12['push'](get_open_tabs(_0xb373('0x49'),_0x1946d8[_0xb373('0x4a')]));_0x28af12[_0xb373('0x43')](get_open_tabs(_0xb373('0x4d'),_0x1946d8[_0xb373('0x4a')]));_0x28af12['push'](get_open_tabs(_0xb373('0x4e'),_0x1946d8['dataValues']));_0x28af12['push'](get_open_tabs('fax',_0x1946d8[_0xb373('0x4a')]));_0x28af12[_0xb373('0x43')](get_open_tabs(_0xb373('0x4c'),_0x1946d8[_0xb373('0x4a')]));return BPromise['all'](_0x28af12);})['then'](function(_0x25b6e7){if(_0x25b6e7){var _0x340306=_[_0xb373('0x2d')](values[_0xb373('0xba')],function(_0x4ca066){return{'channel':_0xb373('0xbb'),'id':_0x4ca066['id'],'createdAt':_0x4ca066[_0xb373('0xbc')]};});var _0x425bd2=_[_0xb373('0x2d')](values[_0xb373('0xbd')],function(_0x924e46){return{'channel':_0xb373('0xbe'),'id':_0x924e46['id'],'createdAt':_0x924e46[_0xb373('0xbc')]};});var _0x26c7dd=_[_0xb373('0x2d')](values[_0xb373('0xbf')],function(_0x5cc85e){return{'channel':_0xb373('0xc0'),'id':_0x5cc85e['id'],'createdAt':_0x5cc85e['createdAt']};});var _0x5ac91e=_[_0xb373('0x2d')](values['MailOpenTabs'],function(_0x4b7e03){return{'channel':_0xb373('0xc1'),'id':_0x4b7e03['id'],'createdAt':_0x4b7e03['createdAt']};});var _0x362c15=_[_0xb373('0x2d')](values[_0xb373('0xc2')],function(_0x67cb17){return{'channel':_0xb373('0xc3'),'id':_0x67cb17['id'],'createdAt':_0x67cb17[_0xb373('0xbc')]};});var _0xde702a=_['map'](values[_0xb373('0xc4')],function(_0x54ada9){return{'channel':_0xb373('0xc5'),'id':_0x54ada9['id'],'createdAt':_0x54ada9['createdAt']};});var _0x30470e=_[_0xb373('0xc6')](_0x340306,_0x425bd2,_0x26c7dd,_0x5ac91e,_0x362c15,_0xde702a);var _0x5ac8d2={'count':_0x30470e['length'],'rows':_0x30470e};return _0x5ac8d2;}else return null;})[_0xb373('0x27')](respondWithResult(_0x3953f8,null))[_0xb373('0x1c')](handleError(_0x3953f8,null));};exports[_0xb373('0xc7')]=function(_0x16cc74,_0x5abe34){var _0x205f28={};var _0x4e239c={};var _0x238ce7;var _0xcbf35c;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x16cc74[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x5abe34,null))[_0xb373('0x27')](function(_0x7549a1){if(_0x7549a1){_0x238ce7=_0x7549a1;_0x4e239c['model']=_[_0xb373('0x4f')](db[_0xb373('0xc8')]['rawAttributes']);_0x4e239c[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x16cc74[_0xb373('0x3c')]);_0x4e239c[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x4e239c[_0xb373('0x51')],_0x4e239c['query']);_0x205f28['attributes']=_['intersection'](_0x4e239c[_0xb373('0x51')],qs['fields'](_0x16cc74['query'][_0xb373('0x52')]));_0x205f28[_0xb373('0x42')]=_0x205f28['attributes'][_0xb373('0x47')]?_0x205f28[_0xb373('0x42')]:_0x4e239c[_0xb373('0x51')];_0x205f28[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x16cc74[_0xb373('0x3c')]['sort']);_0x205f28[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x16cc74[_0xb373('0x3c')],_0x4e239c[_0xb373('0xc9')]));if(_0x16cc74[_0xb373('0x3c')]['filter']){_0x205f28[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x205f28['where'],{'$or':_['map'](_0x205f28['attributes'],function(_0x428306){var _0x4e455c={};_0x4e455c[_0x428306]={'$like':'%'+_0x16cc74['query'][_0xb373('0x2b')]+'%'};return _0x4e455c;})});}_0x205f28=_['merge']({},_0x205f28,_0x16cc74['options']);return _0x238ce7[_0xb373('0xc7')](_0x205f28);}})[_0xb373('0x27')](function(_0x4d10bb){if(_0x4d10bb){_0xcbf35c=_0x4d10bb['length'];if(_0x16cc74[_0xb373('0x3c')][_0xb373('0xcd')]('includeAll')){_0x205f28[_0xb373('0x3e')]=[{'model':db[_0xb373('0xce')],'as':_0xb373('0xcf'),'required':![]},{'model':db[_0xb373('0xd0')],'as':_0xb373('0xd1'),'attributes':['id',_0xb373('0x34'),_0xb373('0xd2')],'where':_0x16cc74[_0xb373('0x3c')]['tag']?{'id':_0x16cc74[_0xb373('0x3c')][_0xb373('0xd3')]}:undefined,'required':_0x16cc74[_0xb373('0x3c')][_0xb373('0xd3')]?!![]:![]}];}if(!_0x16cc74[_0xb373('0x3c')][_0xb373('0xcd')]('nolimit')){_0x205f28[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x16cc74[_0xb373('0x3c')][_0xb373('0x21')]);_0x205f28[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x16cc74[_0xb373('0x3c')]['offset']);}return _0x238ce7[_0xb373('0xc7')](_0x205f28);}})[_0xb373('0x27')](function(_0x54b9ad){if(_0x54b9ad){return _0x54b9ad?{'count':_0xcbf35c,'rows':_0x54b9ad}:null;}})['then'](respondWithResult(_0x5abe34,null))[_0xb373('0x1c')](handleError(_0x5abe34,null));};exports[_0xb373('0xd4')]=function(_0x76cb94,_0x3c141e){var _0x66ea41;var _0x16a8d8={};var _0x110752;return db['User'][_0xb373('0x93')]({'where':{'id':_0x76cb94[_0xb373('0x56')]['id']},'attributes':['id',_0xb373('0x34'),_0xb373('0x30')]})[_0xb373('0x27')](handleEntityNotFound(_0x3c141e,null))[_0xb373('0x27')](function(_0x4a2e92){if(!utils[_0xb373('0x9c')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])){throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0x9d'));}_0x66ea41=_0x4a2e92;var _0x33fe4b={};_0x33fe4b['model']=_[_0xb373('0x4f')](db[_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])+'Queue'][_0xb373('0x37')]);_0x33fe4b[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x76cb94['query']);_0x33fe4b[_0xb373('0xc9')]=_['intersection'](_0x33fe4b[_0xb373('0x51')],_0x33fe4b['query']);_0x16a8d8[_0xb373('0x42')]=_[_0xb373('0x50')](_0x33fe4b['model'],qs['fields'](_0x76cb94[_0xb373('0x3c')][_0xb373('0x52')]));_0x16a8d8[_0xb373('0x42')]=_0x16a8d8[_0xb373('0x42')][_0xb373('0x47')]?_0x16a8d8[_0xb373('0x42')]:_0x33fe4b['model'];_0x16a8d8['order']=qs[_0xb373('0xcb')](_0x76cb94[_0xb373('0x3c')]['sort']);_0x16a8d8['where']=qs['filters'](_[_0xb373('0xd5')](_0x76cb94['query'],_0x33fe4b[_0xb373('0xc9')]));if(_0x76cb94['query'][_0xb373('0x2b')]){_0x16a8d8[_0xb373('0x3b')]=_['merge'](_0x16a8d8[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x16a8d8['attributes'],function(_0x97f807){var _0x23ec4a={};_0x23ec4a[_0x97f807]={'$like':'%'+_0x76cb94[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x23ec4a;})});}_0x16a8d8=_['merge']({},_0x16a8d8,_0x76cb94[_0xb373('0x53')]);switch(_0x66ea41[_0xb373('0x30')]){case'admin':return db[_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])+_0xb373('0xd6')][_0xb373('0x44')](_0x16a8d8);case _0xb373('0x79'):case'agent':return _0x66ea41[_0xb373('0xd7')+_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')]['channel'])+'Queues'](_0x16a8d8);default:throw new db[(_0xb373('0x8d'))][(_0xb373('0x8f'))](_0xb373('0xd8'));}})[_0xb373('0x27')](function(_0x433c0a){_0x110752=_0x433c0a[_0xb373('0x47')];if(!_0x76cb94['query'][_0xb373('0xcd')](_0xb373('0xd9'))){_0x16a8d8[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x21')]);_0x16a8d8['offset']=qs['offset'](_0x76cb94['query']['offset']);}switch(_0x66ea41[_0xb373('0x30')]){case'admin':return db[_[_0xb373('0x9e')](_0x76cb94[_0xb373('0x3c')][_0xb373('0x99')])+_0xb373('0xd6')][_0xb373('0x44')](_0x16a8d8);case'user':case'agent':return _0x66ea41[_0xb373('0xd7')+_['capitalize'](_0x76cb94[_0xb373('0x3c')]['channel'])+_0xb373('0xa0')](_0x16a8d8);}})[_0xb373('0x27')](function(_0xfa3364){return{'count':_0x110752,'rows':_0xfa3364};})[_0xb373('0x27')](respondWithResult(_0x3c141e,null))[_0xb373('0x1c')](handleError(_0x3c141e,null));};exports[_0xb373('0xda')]=function(_0x373e9e,_0x53c021){var _0x4a3c84={};var _0x24496a={};var _0x59615b;var _0x580a36;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x373e9e[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x53c021,null))[_0xb373('0x27')](function(_0x1449fb){if(_0x1449fb){_0x59615b=_0x1449fb;_0x24496a['model']=_[_0xb373('0x4f')](db[_0xb373('0xaf')][_0xb373('0x37')]);_0x24496a['query']=_['keys'](_0x373e9e[_0xb373('0x3c')]);_0x24496a[_0xb373('0xc9')]=_['intersection'](_0x24496a[_0xb373('0x51')],_0x24496a[_0xb373('0x3c')]);_0x4a3c84['attributes']=_['intersection'](_0x24496a[_0xb373('0x51')],qs['fields'](_0x373e9e[_0xb373('0x3c')][_0xb373('0x52')]));_0x4a3c84['attributes']=_0x4a3c84[_0xb373('0x42')][_0xb373('0x47')]?_0x4a3c84[_0xb373('0x42')]:_0x24496a['model'];_0x4a3c84[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x373e9e[_0xb373('0x3c')][_0xb373('0xcb')]);_0x4a3c84[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x373e9e[_0xb373('0x3c')],_0x24496a[_0xb373('0xc9')]));if(_0x373e9e[_0xb373('0x3c')][_0xb373('0x2b')]){_0x4a3c84[_0xb373('0x3b')]=_['merge'](_0x4a3c84['where'],{'$or':_[_0xb373('0x2d')](_0x4a3c84[_0xb373('0x42')],function(_0xe831d6){var _0x3813d1={};_0x3813d1[_0xe831d6]={'$like':'%'+_0x373e9e[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x3813d1;})});}_0x4a3c84=_[_0xb373('0xcc')]({},_0x4a3c84,_0x373e9e[_0xb373('0x53')]);return _0x59615b[_0xb373('0xda')](_0x4a3c84);}})[_0xb373('0x27')](function(_0x48afae){if(_0x48afae){_0x580a36=_0x48afae[_0xb373('0x47')];if(!_0x373e9e[_0xb373('0x3c')]['hasOwnProperty'](_0xb373('0xd9'))){_0x4a3c84[_0xb373('0x21')]=qs['limit'](_0x373e9e[_0xb373('0x3c')][_0xb373('0x21')]);_0x4a3c84['offset']=qs[_0xb373('0x1f')](_0x373e9e[_0xb373('0x3c')][_0xb373('0x1f')]);}return _0x59615b[_0xb373('0xda')](_0x4a3c84);}})[_0xb373('0x27')](function(_0xa481f7){if(_0xa481f7){return _0xa481f7?{'count':_0x580a36,'rows':_0xa481f7}:null;}})[_0xb373('0x27')](respondWithResult(_0x53c021,null))[_0xb373('0x1c')](handleError(_0x53c021,null));};exports[_0xb373('0xdb')]=function(_0x60c3c9,_0x1fddba){var _0x5c2637={};var _0x1d1b68={};var _0x5bb8c8;var _0x570e6b;return db['User'][_0xb373('0x93')]({'where':{'id':_0x60c3c9[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x1fddba,null))[_0xb373('0x27')](function(_0x1e28d9){if(_0x1e28d9){_0x5bb8c8=_0x1e28d9;_0x1d1b68[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xdc')][_0xb373('0x37')]);_0x1d1b68[_0xb373('0x3c')]=_['keys'](_0x60c3c9[_0xb373('0x3c')]);_0x1d1b68['filters']=_['intersection'](_0x1d1b68[_0xb373('0x51')],_0x1d1b68[_0xb373('0x3c')]);_0x5c2637[_0xb373('0x42')]=_['intersection'](_0x1d1b68[_0xb373('0x51')],qs['fields'](_0x60c3c9['query'][_0xb373('0x52')]));_0x5c2637[_0xb373('0x42')]=_0x5c2637[_0xb373('0x42')][_0xb373('0x47')]?_0x5c2637[_0xb373('0x42')]:_0x1d1b68['model'];_0x5c2637[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x60c3c9[_0xb373('0x3c')]['sort']);_0x5c2637[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x60c3c9[_0xb373('0x3c')],_0x1d1b68['filters']));if(_0x60c3c9[_0xb373('0x3c')][_0xb373('0x2b')]){_0x5c2637[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x5c2637[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x5c2637[_0xb373('0x42')],function(_0x55eb82){var _0x1b9231={};_0x1b9231[_0x55eb82]={'$like':'%'+_0x60c3c9[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x1b9231;})});}_0x5c2637=_['merge']({},_0x5c2637,_0x60c3c9[_0xb373('0x53')]);return _0x5bb8c8[_0xb373('0xdb')](_0x5c2637);}})['then'](function(_0x452d71){if(_0x452d71){_0x570e6b=_0x452d71['length'];if(!_0x60c3c9[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x5c2637[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x60c3c9[_0xb373('0x3c')][_0xb373('0x21')]);_0x5c2637[_0xb373('0x1f')]=qs['offset'](_0x60c3c9[_0xb373('0x3c')][_0xb373('0x1f')]);}return _0x5bb8c8['getGroups'](_0x5c2637);}})[_0xb373('0x27')](function(_0x1b88ad){if(_0x1b88ad){return _0x1b88ad?{'count':_0x570e6b,'rows':_0x1b88ad}:null;}})[_0xb373('0x27')](respondWithResult(_0x1fddba,null))[_0xb373('0x1c')](handleError(_0x1fddba,null));};exports[_0xb373('0xdd')]=function(_0x19a21a,_0x113f48){var _0x506e61={'raw':!![],'where':{}};var _0x3b5cc7={};var _0x6daade={'count':0x0,'rows':[]};return db['User'][_0xb373('0x93')]({'where':{'id':_0x19a21a['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x113f48,null))[_0xb373('0x27')](function(_0x824681){if(_0x824681){_0x3b5cc7[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xde')][_0xb373('0x37')]);_0x3b5cc7['query']=_[_0xb373('0x4f')](_0x19a21a['query']);_0x3b5cc7[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x3b5cc7[_0xb373('0x51')],_0x3b5cc7['query']);_0x506e61[_0xb373('0x42')]=_[_0xb373('0x50')](_0x3b5cc7[_0xb373('0x51')],qs[_0xb373('0x52')](_0x19a21a[_0xb373('0x3c')][_0xb373('0x52')]));_0x506e61[_0xb373('0x42')]=_0x506e61[_0xb373('0x42')][_0xb373('0x47')]?_0x506e61[_0xb373('0x42')]:_0x3b5cc7[_0xb373('0x51')];if(!_0x19a21a[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x506e61[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x19a21a[_0xb373('0x3c')][_0xb373('0x21')]);_0x506e61['offset']=qs[_0xb373('0x1f')](_0x19a21a[_0xb373('0x3c')]['offset']);}_0x506e61['order']=qs[_0xb373('0xcb')](_0x19a21a[_0xb373('0x3c')][_0xb373('0xcb')]);_0x506e61[_0xb373('0x3b')]=qs['filters'](_['pick'](_0x19a21a['query'],_0x3b5cc7[_0xb373('0xc9')]));_0x506e61[_0xb373('0x3b')][_0xb373('0xdf')]=_0x824681['id'];if(_0x19a21a['query']['filter']){_0x506e61[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x506e61[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x506e61[_0xb373('0x42')],function(_0x4be6ce){var _0x254d4d={};_0x254d4d[_0x4be6ce]={'$like':'%'+_0x19a21a[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x254d4d;})});}_0x506e61=_[_0xb373('0xcc')]({},_0x506e61,_0x19a21a[_0xb373('0x53')]);return db['VoiceRecording'][_0xb373('0x22')]({'where':_0x506e61[_0xb373('0x3b')]})[_0xb373('0x27')](function(_0x3d9ac1){_0x6daade[_0xb373('0x22')]=_0x3d9ac1;if(_0x19a21a['query'][_0xb373('0x3d')]){_0x506e61[_0xb373('0x3e')]=[{'all':!![]}];}return db[_0xb373('0xde')][_0xb373('0x44')](_0x506e61);})[_0xb373('0x27')](function(_0x139fa7){_0x6daade['rows']=_0x139fa7;return _0x6daade;});}})[_0xb373('0x27')](respondWithFilteredResult(_0x113f48,_0x506e61))[_0xb373('0x1c')](handleError(_0x113f48,null));};exports[_0xb373('0xe0')]=function(_0x5563e8,_0x25224d){var _0x399a2a={'raw':!![],'where':{}};var _0x1dc978={};var _0x2fb6d2={'count':0x0,'rows':[]};return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x5563e8['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x25224d,null))['then'](function(_0x31fab9){if(_0x31fab9){_0x1dc978['model']=_['keys'](db[_0xb373('0xe1')][_0xb373('0x37')]);_0x1dc978['query']=_['keys'](_0x5563e8[_0xb373('0x3c')]);_0x1dc978[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x1dc978['model'],_0x1dc978['query']);_0x399a2a[_0xb373('0x42')]=_['intersection'](_0x1dc978[_0xb373('0x51')],qs['fields'](_0x5563e8['query'][_0xb373('0x52')]));_0x399a2a[_0xb373('0x42')]=_0x399a2a[_0xb373('0x42')]['length']?_0x399a2a[_0xb373('0x42')]:_0x1dc978[_0xb373('0x51')];if(!_0x5563e8[_0xb373('0x3c')]['hasOwnProperty']('nolimit')){_0x399a2a[_0xb373('0x21')]=qs['limit'](_0x5563e8['query'][_0xb373('0x21')]);_0x399a2a['offset']=qs['offset'](_0x5563e8[_0xb373('0x3c')][_0xb373('0x1f')]);}_0x399a2a['order']=qs[_0xb373('0xcb')](_0x5563e8[_0xb373('0x3c')][_0xb373('0xcb')]);_0x399a2a[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x5563e8[_0xb373('0x3c')],_0x1dc978[_0xb373('0xc9')]));_0x399a2a['where'][_0xb373('0xdf')]=_0x31fab9['id'];if(_0x5563e8[_0xb373('0x3c')][_0xb373('0x2b')]){_0x399a2a[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x399a2a[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x399a2a[_0xb373('0x42')],function(_0x554655){var _0xeb3609={};_0xeb3609[_0x554655]={'$like':'%'+_0x5563e8[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0xeb3609;})});}_0x399a2a=_[_0xb373('0xcc')]({},_0x399a2a,_0x5563e8[_0xb373('0x53')]);return db[_0xb373('0xe1')][_0xb373('0x22')]({'where':_0x399a2a[_0xb373('0x3b')]})['then'](function(_0x71dfd7){_0x2fb6d2[_0xb373('0x22')]=_0x71dfd7;if(_0x5563e8[_0xb373('0x3c')]['includeAll']){_0x399a2a['include']=[{'all':!![]}];}return db[_0xb373('0xe1')][_0xb373('0x44')](_0x399a2a);})[_0xb373('0x27')](function(_0x2e7704){_0x2fb6d2['rows']=_0x2e7704;return _0x2fb6d2;});}})['then'](respondWithFilteredResult(_0x25224d,_0x399a2a))[_0xb373('0x1c')](handleError(_0x25224d,null));};exports[_0xb373('0xe2')]=function(_0x325e5a,_0x5ab1f1){var _0x4707d6={};var _0x4acb13={};var _0x53c524;var _0x45faa0;return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x325e5a['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x5ab1f1,null))[_0xb373('0x27')](function(_0x1c37fb){if(_0x1c37fb){_0x53c524=_0x1c37fb;_0x4acb13[_0xb373('0x51')]=_['keys'](db[_0xb373('0xe3')][_0xb373('0x37')]);_0x4acb13[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x325e5a[_0xb373('0x3c')]);_0x4acb13[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x4acb13[_0xb373('0x51')],_0x4acb13[_0xb373('0x3c')]);_0x4707d6[_0xb373('0x42')]=_[_0xb373('0x50')](_0x4acb13['model'],qs[_0xb373('0x52')](_0x325e5a[_0xb373('0x3c')][_0xb373('0x52')]));_0x4707d6[_0xb373('0x42')]=_0x4707d6[_0xb373('0x42')]['length']?_0x4707d6[_0xb373('0x42')]:_0x4acb13[_0xb373('0x51')];_0x4707d6[_0xb373('0xca')]=qs['sort'](_0x325e5a[_0xb373('0x3c')][_0xb373('0xcb')]);_0x4707d6[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x325e5a[_0xb373('0x3c')],_0x4acb13[_0xb373('0xc9')]));if(_0x325e5a[_0xb373('0x3c')]['filter']){_0x4707d6[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x4707d6[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x4707d6['attributes'],function(_0x1ecacc){var _0x384fc1={};_0x384fc1[_0x1ecacc]={'$like':'%'+_0x325e5a['query'][_0xb373('0x2b')]+'%'};return _0x384fc1;})});}_0x4707d6=_['merge']({},_0x4707d6,_0x325e5a[_0xb373('0x53')]);return _0x53c524[_0xb373('0xe2')](_0x4707d6);}})[_0xb373('0x27')](function(_0x1ede3c){if(_0x1ede3c){_0x45faa0=_0x1ede3c['length'];if(!_0x325e5a[_0xb373('0x3c')]['hasOwnProperty']('nolimit')){_0x4707d6[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x325e5a['query'][_0xb373('0x21')]);_0x4707d6[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x325e5a[_0xb373('0x3c')]['offset']);}return _0x53c524['getChatInteractions'](_0x4707d6);}})[_0xb373('0x27')](function(_0x4c2214){if(_0x4c2214){return _0x4c2214?{'count':_0x45faa0,'rows':_0x4c2214}:null;}})[_0xb373('0x27')](respondWithResult(_0x5ab1f1,null))[_0xb373('0x1c')](handleError(_0x5ab1f1,null));};exports[_0xb373('0xe4')]=function(_0x434a3b,_0x295eec){var _0xe22838={};var _0x451b38={};var _0x45afd9;var _0x10903e;return db['User'][_0xb373('0x93')]({'where':{'id':_0x434a3b[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x295eec,null))[_0xb373('0x27')](function(_0x3f783e){if(_0x3f783e){_0x45afd9=_0x3f783e;_0x451b38[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xe5')]['rawAttributes']);_0x451b38[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x434a3b['query']);_0x451b38[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x451b38['model'],_0x451b38[_0xb373('0x3c')]);_0xe22838[_0xb373('0x42')]=_[_0xb373('0x50')](_0x451b38[_0xb373('0x51')],qs['fields'](_0x434a3b['query'][_0xb373('0x52')]));_0xe22838[_0xb373('0x42')]=_0xe22838[_0xb373('0x42')][_0xb373('0x47')]?_0xe22838[_0xb373('0x42')]:_0x451b38['model'];_0xe22838[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x434a3b[_0xb373('0x3c')][_0xb373('0xcb')]);_0xe22838[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_['pick'](_0x434a3b[_0xb373('0x3c')],_0x451b38[_0xb373('0xc9')]));if(_0x434a3b['query'][_0xb373('0x2b')]){_0xe22838['where']=_[_0xb373('0xcc')](_0xe22838[_0xb373('0x3b')],{'$or':_['map'](_0xe22838[_0xb373('0x42')],function(_0x19bf69){var _0x575126={};_0x575126[_0x19bf69]={'$like':'%'+_0x434a3b[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x575126;})});}_0xe22838=_[_0xb373('0xcc')]({},_0xe22838,_0x434a3b[_0xb373('0x53')]);return _0x45afd9[_0xb373('0xe4')](_0xe22838);}})[_0xb373('0x27')](function(_0x12ce13){if(_0x12ce13){_0x10903e=_0x12ce13[_0xb373('0x47')];if(!_0x434a3b[_0xb373('0x3c')]['hasOwnProperty']('nolimit')){_0xe22838[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x434a3b['query']['limit']);_0xe22838[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x434a3b[_0xb373('0x3c')]['offset']);}return _0x45afd9[_0xb373('0xe4')](_0xe22838);}})['then'](function(_0x6d9404){if(_0x6d9404){return _0x6d9404?{'count':_0x10903e,'rows':_0x6d9404}:null;}})['then'](respondWithResult(_0x295eec,null))[_0xb373('0x1c')](handleError(_0x295eec,null));};exports[_0xb373('0xe6')]=function(_0x1e7763,_0xb69cec){var _0x4ded5c={'raw':!![],'where':{}};var _0x97e882={};var _0x209bb0={'count':0x0,'rows':[]};return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x1e7763[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0xb69cec,null))[_0xb373('0x27')](function(_0x22fc82){if(_0x22fc82){_0x97e882['model']=_[_0xb373('0x4f')](db[_0xb373('0xe7')]['rawAttributes']);_0x97e882[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x1e7763[_0xb373('0x3c')]);_0x97e882[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x97e882[_0xb373('0x51')],_0x97e882[_0xb373('0x3c')]);_0x4ded5c[_0xb373('0x42')]=_['intersection'](_0x97e882[_0xb373('0x51')],qs[_0xb373('0x52')](_0x1e7763[_0xb373('0x3c')][_0xb373('0x52')]));_0x4ded5c[_0xb373('0x42')]=_0x4ded5c[_0xb373('0x42')]['length']?_0x4ded5c['attributes']:_0x97e882[_0xb373('0x51')];if(!_0x1e7763[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x4ded5c[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x1e7763['query'][_0xb373('0x21')]);_0x4ded5c[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x1e7763[_0xb373('0x3c')]['offset']);}_0x4ded5c[_0xb373('0xca')]=qs['sort'](_0x1e7763[_0xb373('0x3c')][_0xb373('0xcb')]);_0x4ded5c['where']=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x1e7763[_0xb373('0x3c')],_0x97e882[_0xb373('0xc9')]));_0x4ded5c[_0xb373('0x3b')][_0xb373('0xdf')]=_0x22fc82['id'];if(_0x1e7763[_0xb373('0x3c')][_0xb373('0x2b')]){_0x4ded5c[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x4ded5c[_0xb373('0x3b')],{'$or':_['map'](_0x4ded5c['attributes'],function(_0x5af532){var _0x261879={};_0x261879[_0x5af532]={'$like':'%'+_0x1e7763[_0xb373('0x3c')]['filter']+'%'};return _0x261879;})});}_0x4ded5c=_['merge']({},_0x4ded5c,_0x1e7763[_0xb373('0x53')]);return db[_0xb373('0xe7')][_0xb373('0x22')]({'where':_0x4ded5c[_0xb373('0x3b')]})[_0xb373('0x27')](function(_0x43ff8d){_0x209bb0[_0xb373('0x22')]=_0x43ff8d;if(_0x1e7763[_0xb373('0x3c')][_0xb373('0x3d')]){_0x4ded5c[_0xb373('0x3e')]=[{'all':!![]}];}return db[_0xb373('0xe7')][_0xb373('0x44')](_0x4ded5c);})['then'](function(_0x409f81){_0x209bb0[_0xb373('0x45')]=_0x409f81;return _0x209bb0;});}})[_0xb373('0x27')](respondWithFilteredResult(_0xb69cec,_0x4ded5c))['catch'](handleError(_0xb69cec,null));};exports['getSmsInteractions']=function(_0x1a75ec,_0x3bcfa5){var _0x298979={};var _0xeed09b={};var _0x59508c;var _0x44d451;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x1a75ec[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x3bcfa5,null))[_0xb373('0x27')](function(_0xa1244){if(_0xa1244){_0x59508c=_0xa1244;_0xeed09b['model']=_[_0xb373('0x4f')](db[_0xb373('0xe8')][_0xb373('0x37')]);_0xeed09b[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x1a75ec[_0xb373('0x3c')]);_0xeed09b[_0xb373('0xc9')]=_[_0xb373('0x50')](_0xeed09b[_0xb373('0x51')],_0xeed09b[_0xb373('0x3c')]);_0x298979[_0xb373('0x42')]=_[_0xb373('0x50')](_0xeed09b[_0xb373('0x51')],qs[_0xb373('0x52')](_0x1a75ec[_0xb373('0x3c')][_0xb373('0x52')]));_0x298979[_0xb373('0x42')]=_0x298979[_0xb373('0x42')]['length']?_0x298979['attributes']:_0xeed09b['model'];_0x298979[_0xb373('0xca')]=qs['sort'](_0x1a75ec[_0xb373('0x3c')][_0xb373('0xcb')]);_0x298979[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x1a75ec[_0xb373('0x3c')],_0xeed09b[_0xb373('0xc9')]));if(_0x1a75ec[_0xb373('0x3c')][_0xb373('0x2b')]){_0x298979[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x298979[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x298979[_0xb373('0x42')],function(_0x1c06d6){var _0x28c985={};_0x28c985[_0x1c06d6]={'$like':'%'+_0x1a75ec[_0xb373('0x3c')]['filter']+'%'};return _0x28c985;})});}_0x298979=_[_0xb373('0xcc')]({},_0x298979,_0x1a75ec[_0xb373('0x53')]);return _0x59508c[_0xb373('0xe9')](_0x298979);}})[_0xb373('0x27')](function(_0x30f499){if(_0x30f499){_0x44d451=_0x30f499['length'];if(!_0x1a75ec['query'][_0xb373('0xcd')](_0xb373('0xd9'))){_0x298979[_0xb373('0x21')]=qs['limit'](_0x1a75ec['query'][_0xb373('0x21')]);_0x298979[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x1a75ec[_0xb373('0x3c')]['offset']);}return _0x59508c[_0xb373('0xe9')](_0x298979);}})[_0xb373('0x27')](function(_0x5752b6){if(_0x5752b6){return _0x5752b6?{'count':_0x44d451,'rows':_0x5752b6}:null;}})[_0xb373('0x27')](respondWithResult(_0x3bcfa5,null))[_0xb373('0x1c')](handleError(_0x3bcfa5,null));};exports['getFaxInteractions']=function(_0x5a048e,_0x31935b){var _0x1a2cf9={};var _0x50951b={};var _0x1d4b23;var _0x430d3e;return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x5a048e[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x31935b,null))[_0xb373('0x27')](function(_0x14af35){if(_0x14af35){_0x1d4b23=_0x14af35;_0x50951b['model']=_['keys'](db[_0xb373('0xea')][_0xb373('0x37')]);_0x50951b[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x5a048e[_0xb373('0x3c')]);_0x50951b[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x50951b['model'],_0x50951b[_0xb373('0x3c')]);_0x1a2cf9['attributes']=_[_0xb373('0x50')](_0x50951b['model'],qs[_0xb373('0x52')](_0x5a048e['query']['fields']));_0x1a2cf9[_0xb373('0x42')]=_0x1a2cf9[_0xb373('0x42')]['length']?_0x1a2cf9[_0xb373('0x42')]:_0x50951b['model'];_0x1a2cf9[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x5a048e[_0xb373('0x3c')]['sort']);_0x1a2cf9[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x5a048e[_0xb373('0x3c')],_0x50951b[_0xb373('0xc9')]));if(_0x5a048e[_0xb373('0x3c')][_0xb373('0x2b')]){_0x1a2cf9[_0xb373('0x3b')]=_['merge'](_0x1a2cf9[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x1a2cf9[_0xb373('0x42')],function(_0x32f14c){var _0x5a7190={};_0x5a7190[_0x32f14c]={'$like':'%'+_0x5a048e[_0xb373('0x3c')]['filter']+'%'};return _0x5a7190;})});}_0x1a2cf9=_[_0xb373('0xcc')]({},_0x1a2cf9,_0x5a048e[_0xb373('0x53')]);return _0x1d4b23[_0xb373('0xeb')](_0x1a2cf9);}})['then'](function(_0x4d5f18){if(_0x4d5f18){_0x430d3e=_0x4d5f18[_0xb373('0x47')];if(!_0x5a048e['query'][_0xb373('0xcd')](_0xb373('0xd9'))){_0x1a2cf9[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x5a048e[_0xb373('0x3c')][_0xb373('0x21')]);_0x1a2cf9[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x5a048e[_0xb373('0x3c')][_0xb373('0x1f')]);}return _0x1d4b23[_0xb373('0xeb')](_0x1a2cf9);}})[_0xb373('0x27')](function(_0x327ef7){if(_0x327ef7){return _0x327ef7?{'count':_0x430d3e,'rows':_0x327ef7}:null;}})[_0xb373('0x27')](respondWithResult(_0x31935b,null))[_0xb373('0x1c')](handleError(_0x31935b,null));};exports[_0xb373('0xec')]=function(_0x82b174,_0x2a8dc2){var _0x138bdf={};var _0x485204={};var _0x3b4c74;var _0x186f0a;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x82b174[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x2a8dc2,null))[_0xb373('0x27')](function(_0x35bf39){if(_0x35bf39){_0x3b4c74=_0x35bf39;_0x485204[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0xed')][_0xb373('0x37')]);_0x485204[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x82b174[_0xb373('0x3c')]);_0x485204[_0xb373('0xc9')]=_['intersection'](_0x485204[_0xb373('0x51')],_0x485204[_0xb373('0x3c')]);_0x138bdf[_0xb373('0x42')]=_[_0xb373('0x50')](_0x485204[_0xb373('0x51')],qs[_0xb373('0x52')](_0x82b174['query']['fields']));_0x138bdf[_0xb373('0x42')]=_0x138bdf[_0xb373('0x42')][_0xb373('0x47')]?_0x138bdf['attributes']:_0x485204['model'];_0x138bdf[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x82b174[_0xb373('0x3c')][_0xb373('0xcb')]);_0x138bdf[_0xb373('0x3b')]=qs[_0xb373('0xc9')](_[_0xb373('0xd5')](_0x82b174[_0xb373('0x3c')],_0x485204['filters']));if(_0x82b174[_0xb373('0x3c')]['filter']){_0x138bdf['where']=_['merge'](_0x138bdf['where'],{'$or':_[_0xb373('0x2d')](_0x138bdf['attributes'],function(_0x527d0f){var _0x1615c2={};_0x1615c2[_0x527d0f]={'$like':'%'+_0x82b174[_0xb373('0x3c')][_0xb373('0x2b')]+'%'};return _0x1615c2;})});}_0x138bdf=_[_0xb373('0xcc')]({},_0x138bdf,_0x82b174['options']);return _0x3b4c74[_0xb373('0xec')](_0x138bdf);}})[_0xb373('0x27')](function(_0x54641d){if(_0x54641d){_0x186f0a=_0x54641d['length'];if(!_0x82b174[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0x138bdf[_0xb373('0x21')]=qs['limit'](_0x82b174['query'][_0xb373('0x21')]);_0x138bdf[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x82b174[_0xb373('0x3c')]['offset']);}return _0x3b4c74[_0xb373('0xec')](_0x138bdf);}})['then'](function(_0x470590){if(_0x470590){return _0x470590?{'count':_0x186f0a,'rows':_0x470590}:null;}})[_0xb373('0x27')](respondWithResult(_0x2a8dc2,null))[_0xb373('0x1c')](handleError(_0x2a8dc2,null));};exports['login']=function(_0x20c7d3,_0xa21f14,_0x2b2a38){var _0x56e151;var _0x365b19;var _0xf37531;var _0x50c815=!_[_0xb373('0x60')](_0x20c7d3[_0xb373('0x56')]['id'])?_0x20c7d3['params']['id']:!_['isNil'](_0x20c7d3[_0xb373('0x79')]['id'])?_0x20c7d3[_0xb373('0x79')]['id']:null;return db['User'][_0xb373('0x54')]({'where':{'id':_0x50c815,'role':{'$or':[_0xb373('0x7a'),_0xb373('0x79'),'agent']}},'attributes':['id',_0xb373('0x34'),_0xb373('0xee'),_0xb373('0xef'),_0xb373('0x30'),'internal',_0xb373('0x9a')]})['then'](function(_0x23a080){if(_0x23a080){if(_0x23a080['role']===_0xb373('0x29')){_0x56e151=_0x23a080;if(_0x20c7d3['body'][_0xb373('0x9b')]){_0xf37531=util[_0xb373('0xf0')](_0xb373('0xf1'),_0x56e151[_0x20c7d3['body'][_0xb373('0x9b')]]);}else if(_0x20c7d3[_0xb373('0x55')]['intrf']){_0xf37531=util[_0xb373('0xf0')](_0xb373('0xa9'),_0x20c7d3['body'][_0xb373('0xf2')]);}else{_0xf37531=util['format'](_0xb373('0xa9'),_0x56e151[_0xb373('0x34')]);}socket['to'](util[_0xb373('0xf0')](_0xb373('0xf3'),_0x56e151[_0xb373('0x34')]))[_0xb373('0xa4')](_0xb373('0xf4'),{'user':{'id':_0x56e151['id'],'name':_0x56e151['name']},'ip':_0x20c7d3['headers']['x-forwarded-for']||_0x20c7d3[_0xb373('0xf5')][_0xb373('0xf6')]||_0x20c7d3['socket'][_0xb373('0xf6')]||_0x20c7d3[_0xb373('0xf5')]['socket'][_0xb373('0xf6')]});return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'membername':_0x56e151[_0xb373('0x34')]},'individualHooks':!![]});}}else{throw new db[(_0xb373('0x8d'))]['ValidationError'](_0xb373('0xf7'));}})[_0xb373('0x27')](function(){if(_0x56e151){return _0x56e151['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x80a3ee){if(_0x56e151){var _0x500c79=[];if(_0x80a3ee){_0x365b19=_0x80a3ee;if(_0x365b19[_0xb373('0x47')]){for(var _0x40a9af=0x0;_0x40a9af<_0x365b19[_0xb373('0x47')];_0x40a9af++){_0x500c79[_0xb373('0x43')]({'membername':_0x56e151['name'],'UserId':_0x56e151['id'],'queue_name':_0x365b19[_0x40a9af][_0xb373('0x34')],'VoiceQueueId':_0x365b19[_0x40a9af]['id'],'interface':_0xf37531,'paused':_0x56e151[_0xb373('0x9a')]||![],'penalty':_0x365b19[_0x40a9af][_0xb373('0xf8')]||0x0});}return BPromise[_0xb373('0xaa')](_0x500c79,function(_0x5d2b6a){return db[_0xb373('0xaf')][_0xb373('0xab')](_0x5d2b6a);});}}}})[_0xb373('0x27')](function(){if(_0x56e151){return db[_0xb373('0xf9')]['findAll']({'where':{'membername':_0x56e151['name'],'exitAt':null}});}})['then'](function(_0x3c42b2){if(_0x56e151){var _0x3bd67f=[];_0x3c42b2['forEach'](function(_0x14b14b){_0x3bd67f[_0xb373('0x43')](_0x14b14b[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb373('0x89')](_0x3bd67f);}})['then'](function(){if(_0x56e151){var _0xba94e8=[];var _0x51250f=[];var _0x752e21=utils[_0xb373('0xfa')]();var _0x13b1f4={'membername':_0x56e151[_0xb373('0x34')],'interface':_0xf37531,'enterAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x56e151['role'],'internal':_0x56e151[_0xb373('0x61')]};_0x752e21[_0xb373('0xfb')](function(_0x2f9a69){_0xba94e8[_0xb373('0x43')](_[_0xb373('0xcc')]({'channel':_0x2f9a69,'type':_0xb373('0xfc'),'data1':_0x20c7d3[_0xb373('0x55')][_0xb373('0xfd')],'data2':_0xf37531},_0x13b1f4));if(_0x56e151['loginInPause']){_0x51250f[_0xb373('0x43')](_['merge']({'channel':_0x2f9a69,'type':_0xb373('0xfe'),'data1':_0xb373('0xff')},_0x13b1f4));}});return db['MemberReport'][_0xb373('0x81')](_0xba94e8[_0xb373('0xc6')](_0x51250f),{'individualHooks':!![]});}})[_0xb373('0x27')](function(){if(_0x56e151){return _0x56e151[_0xb373('0x25')]({'online':!![],'lastLoginAt':moment()[_0xb373('0xf0')](_0xb373('0x100')),'voicePause':_0x56e151['loginInPause']||![],'mailPause':_0x56e151[_0xb373('0x9a')]||![],'chatPause':_0x56e151[_0xb373('0x9a')]||![],'faxPause':_0x56e151['loginInPause']||![],'smsPause':_0x56e151[_0xb373('0x9a')]||![],'openchannelPause':_0x56e151[_0xb373('0x9a')]||![],'whatsappPause':_0x56e151['loginInPause']||![],'pauseType':_0x56e151[_0xb373('0x9a')]?_0xb373('0xff'):null,'interface':_0xf37531,'lastPauseAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb373('0x27')](function(_0x34258c){if(_0x20c7d3[_0xb373('0x101')]){return _0x2b2a38();}else{return BPromise[_0xb373('0x102')](_0x34258c)[_0xb373('0x27')](respondWithResult(_0xa21f14,null));}})['catch'](handleError(_0xa21f14,null));};exports['logout']=function(_0x1ff2aa,_0x307d57){var _0x5a07aa;return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x1ff2aa[_0xb373('0x56')]['id'],'role':_0xb373('0x29')},'attributes':['id',_0xb373('0x34'),'role']})[_0xb373('0x27')](handleEntityNotFound(_0x307d57,null))[_0xb373('0x27')](function(_0x52215b){if(_0x52215b){_0x5a07aa=_0x52215b;return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'membername':_0x5a07aa['name']},'individualHooks':!![]});}})['then'](function(){return db[_0xb373('0xf9')]['findAll']({'where':{'membername':_0x5a07aa['name'],'exitAt':null}});})[_0xb373('0x27')](function(_0x28f682){var _0x391049=[];_0x28f682[_0xb373('0xfb')](function(_0x1addb4){_0x391049[_0xb373('0x43')](_0x1addb4[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')](_0xb373('0x100'))}));});return BPromise[_0xb373('0x89')](_0x391049);})[_0xb373('0x27')](function(){return _0x5a07aa[_0xb373('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb373('0x27')](respondWithResult(_0x307d57,null))['catch'](handleError(_0x307d57,null));};exports[_0xb373('0x103')]=function(_0x2e0fd1,_0x2f2a17){var _0x5cf94d;return db[_0xb373('0xaf')][_0xb373('0x25')]({'paused':0x1},{'where':{'UserId':_0x2e0fd1['params']['id']},'individualHooks':!![]})[_0xb373('0x27')](function(){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x2e0fd1[_0xb373('0x56')]['id'],'role':_0xb373('0x29')},'attributes':['id','name',_0xb373('0x30'),_0xb373('0x61'),_0xb373('0x9b')]});})['then'](handleEntityNotFound(_0x2f2a17,null))[_0xb373('0x27')](function(_0x3b74e1){if(_0x3b74e1){_0x5cf94d=_0x3b74e1;return respondWithRpcPromise(_0xb373('0x104'),_0xb373('0x103'),{'id':_0x5cf94d['id'],'name':_0x5cf94d[_0xb373('0x34')],'pause':!![]});}})[_0xb373('0x27')](function(){if(_0x5cf94d){return db[_0xb373('0xf9')][_0xb373('0x44')]({'where':{'membername':_0x5cf94d[_0xb373('0x34')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x2e289d){if(_0x2e289d[_0xb373('0x47')]){var _0x5b9dfa=moment()['format'](_0xb373('0x100'));for(var _0x1d7cee=0x0,_0x11c630=_0x2e289d[_0xb373('0x47')];_0x1d7cee<_0x11c630;_0x1d7cee++){_0x2e289d[_0x1d7cee][_0xb373('0x105')]({'exitAt':_0x5b9dfa});}}})[_0xb373('0x27')](function(){var _0x51e474=[];var _0x181f79=utils[_0xb373('0xfa')]();_0x181f79[_0xb373('0xfb')](function(_0x534195){_0x51e474[_0xb373('0x43')]({'channel':_0x534195,'membername':_0x5cf94d[_0xb373('0x34')],'interface':_['isNil'](_0x5cf94d[_0xb373('0x9b')])?util[_0xb373('0xf0')](_0xb373('0xa9'),_0x5cf94d[_0xb373('0x34')]):_0x5cf94d[_0xb373('0x9b')],'type':_0xb373('0xfe'),'enterAt':moment()['format'](_0xb373('0x100')),'data1':_0x2e0fd1[_0xb373('0x55')]['type']||_0xb373('0x106'),'role':_0x5cf94d['role'],'internal':_0x5cf94d[_0xb373('0x61')]});});return db[_0xb373('0xf9')][_0xb373('0x81')](_0x51e474,{'individualHooks':!![]});})['then'](function(){return _0x5cf94d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2e0fd1[_0xb373('0x55')][_0xb373('0x107')]||_0xb373('0x106'),'lastPauseAt':moment()[_0xb373('0xf0')](_0xb373('0x100'))});})['then'](respondWithResult(_0x2f2a17,null))[_0xb373('0x1c')](handleError(_0x2f2a17,null));};exports['unpause']=function(_0x101544,_0x216e00){var _0x546acc;return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x101544[_0xb373('0x56')]['id']},'attributes':['id',_0xb373('0x34'),_0xb373('0x30'),'voicePause',_0xb373('0x108'),'chatPause','faxPause',_0xb373('0x109'),_0xb373('0x10a'),'whatsapppause',_0xb373('0x10b'),_0xb373('0x10c')]})[_0xb373('0x27')](handleEntityNotFound(_0x216e00,null))[_0xb373('0x27')](function(_0x2a6eed){if(_0x2a6eed){_0x546acc=_0x2a6eed;if(_0x101544[_0xb373('0x55')]['channel']&&!utils[_0xb373('0x9c')](_0x101544['body']['channel'])){throw new db['Sequelize'][(_0xb373('0x8f'))](_0xb373('0x9d'));}switch(_0x101544[_0xb373('0x55')][_0xb373('0x99')]){case _0xb373('0xa6'):return respondWithRpcPromise(_0xb373('0x104'),'unpause',{'id':_0x546acc['id'],'name':_0x546acc[_0xb373('0x34')],'pause':![]})[_0xb373('0x27')](function(){return db[_0xb373('0xaf')][_0xb373('0x25')]({'paused':0x0},{'where':{'UserId':_0x546acc['id']},'individualHooks':!![]});})[_0xb373('0x27')](function(){return db[_0xb373('0xf9')]['find']({'where':{'channel':_0x101544[_0xb373('0x55')][_0xb373('0x99')],'membername':_0x546acc['name'],'type':_0xb373('0xfe'),'exitAt':null}});})[_0xb373('0x27')](function(_0x39b3f2){if(_0x39b3f2){return _0x39b3f2[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xb373('0x27')](function(){return _0x546acc[_0xb373('0x25')]({'voicePause':![]});});case'mail':case _0xb373('0x48'):case _0xb373('0x4b'):case'sms':case _0xb373('0x4e'):case _0xb373('0x4d'):return db[_0xb373('0xf9')][_0xb373('0x54')]({'where':{'channel':_0x101544[_0xb373('0x55')][_0xb373('0x99')],'membername':_0x546acc[_0xb373('0x34')],'type':_0xb373('0xfe'),'exitAt':null}})[_0xb373('0x27')](function(_0x1fbd8d){if(_0x1fbd8d){return _0x1fbd8d[_0xb373('0x25')]({'exitAt':moment()[_0xb373('0xf0')](_0xb373('0x100')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x330cf6={};_[_0xb373('0x23')](_0x330cf6,util['format'](_0xb373('0x10d'),_0x101544[_0xb373('0x55')][_0xb373('0x99')],_0xb373('0x10e')),![]);return _0x546acc[_0xb373('0x25')](_0x330cf6);});default:return respondWithRpcPromise(_0xb373('0x104'),_0xb373('0x10f'),{'id':_0x546acc['id'],'name':_0x546acc[_0xb373('0x34')],'pause':![]})[_0xb373('0x27')](function(){return db[_0xb373('0xaf')][_0xb373('0x25')]({'paused':0x0},{'where':{'UserId':_0x546acc['id']}});})[_0xb373('0x27')](function(){return db[_0xb373('0xf9')][_0xb373('0x44')]({'where':{'membername':_0x546acc[_0xb373('0x34')],'type':_0xb373('0xfe'),'exitAt':null}});})[_0xb373('0x27')](function(_0x306a1d){var _0x10d953=[];_0x306a1d[_0xb373('0xfb')](function(_0x2467a7){_0x10d953['push'](_0x2467a7['update']({'exitAt':moment()[_0xb373('0xf0')](_0xb373('0x100')),'data2':_0xb373('0x110')}));});return BPromise[_0xb373('0x89')](_0x10d953);})['then'](function(){return _0x546acc[_0xb373('0x25')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xb373('0x27')](respondWithResult(_0x216e00,null))[_0xb373('0x1c')](handleError(_0x216e00,null));};exports[_0xb373('0x111')]=function(_0x16a4ff,_0x4af8f4){var _0x1d6f1b={};var _0x59b21a={};var _0x98fb03;var _0x10daef;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x16a4ff[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x4af8f4,null))[_0xb373('0x27')](function(_0x1ad2e5){if(_0x1ad2e5){_0x98fb03=_0x1ad2e5;_0x59b21a[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0x112')]['rawAttributes']);_0x59b21a['query']=_[_0xb373('0x4f')](_0x16a4ff[_0xb373('0x3c')]);_0x59b21a['filters']=_[_0xb373('0x50')](_0x59b21a['model'],_0x59b21a['query']);_0x1d6f1b[_0xb373('0x42')]=_[_0xb373('0x50')](_0x59b21a[_0xb373('0x51')],qs[_0xb373('0x52')](_0x16a4ff[_0xb373('0x3c')][_0xb373('0x52')]));_0x1d6f1b['attributes']=_0x1d6f1b['attributes'][_0xb373('0x47')]?_0x1d6f1b[_0xb373('0x42')]:_0x59b21a[_0xb373('0x51')];_0x1d6f1b['order']=qs[_0xb373('0xcb')](_0x16a4ff[_0xb373('0x3c')][_0xb373('0xcb')]);_0x1d6f1b[_0xb373('0x3b')]=qs['filters'](_[_0xb373('0xd5')](_0x16a4ff[_0xb373('0x3c')],_0x59b21a[_0xb373('0xc9')]));if(_0x16a4ff[_0xb373('0x3c')][_0xb373('0x2b')]){_0x1d6f1b[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x1d6f1b['where'],{'$or':_[_0xb373('0x2d')](_0x1d6f1b[_0xb373('0x42')],function(_0x4bc402){var _0x3c3bb2={};_0x3c3bb2[_0x4bc402]={'$like':'%'+_0x16a4ff['query']['filter']+'%'};return _0x3c3bb2;})});}_0x1d6f1b=_['merge']({},_0x1d6f1b,_0x16a4ff[_0xb373('0x53')]);return _0x98fb03[_0xb373('0x111')](_0x1d6f1b);}})[_0xb373('0x27')](function(_0x54c166){if(_0x54c166){_0x10daef=_0x54c166['length'];if(!_0x16a4ff[_0xb373('0x3c')]['hasOwnProperty'](_0xb373('0xd9'))){_0x1d6f1b[_0xb373('0x21')]=qs[_0xb373('0x21')](_0x16a4ff[_0xb373('0x3c')]['limit']);_0x1d6f1b[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x16a4ff[_0xb373('0x3c')]['offset']);}return _0x98fb03[_0xb373('0x111')](_0x1d6f1b);}})[_0xb373('0x27')](function(_0x2f7212){if(_0x2f7212){return _0x2f7212?{'count':_0x10daef,'rows':_0x2f7212}:null;}})['then'](respondWithResult(_0x4af8f4,null))[_0xb373('0x1c')](handleError(_0x4af8f4,null));};exports[_0xb373('0x113')]=function(_0x104165,_0x51656a){return db[_0xb373('0x36')][_0xb373('0x54')]({'where':{'id':_0x104165[_0xb373('0x56')]['id']}})['then'](handleEntityNotFound(_0x51656a,null))[_0xb373('0x27')](function(_0x5f1ade){if(_0x5f1ade){var _0x540ea5=_0x5f1ade['get']({'plain':!![]});return _0x5f1ade[_0xb373('0x113')](_0x104165['body'][_0xb373('0x59')],_['omit'](_0x104165['body'],[_0xb373('0x59'),'id'])||{})[_0xb373('0x27')](function(){for(var _0x325b12=0x0;_0x325b12<_0x104165[_0xb373('0x55')][_0xb373('0x59')][_0xb373('0x47')];_0x325b12++){var _0x2401ee=[];var _0x3cc09a={};db[_0xb373('0x112')][_0xb373('0x93')]({'where':{'id':_0x104165[_0xb373('0x55')][_0xb373('0x59')][_0x325b12]}})[_0xb373('0x27')](function(_0x4550c7){_0x3cc09a=_0x4550c7[_0xb373('0x4a')];_0x2401ee[_0xb373('0x43')](_0x4550c7['getVoiceQueues']()[_0xb373('0x27')](function(_0x3ca3a0){for(var _0x17f456=0x0;_0x17f456<_0x3ca3a0[_0xb373('0x47')];_0x17f456++){_0x3ca3a0[_0x17f456][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x115'));}return _0x3ca3a0;}));_0x2401ee[_0xb373('0x43')](_0x4550c7[_0xb373('0x116')]()['then'](function(_0x3a2109){for(var _0x741db9=0x0;_0x741db9<_0x3a2109[_0xb373('0x47')];_0x741db9++){_0x3a2109[_0x741db9][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x117'));}return _0x3a2109;}));_0x2401ee[_0xb373('0x43')](_0x4550c7[_0xb373('0x118')]()[_0xb373('0x27')](function(_0x3a84d8){for(var _0x274d21=0x0;_0x274d21<_0x3a84d8['length'];_0x274d21++){_0x3a84d8[_0x274d21][_0xb373('0x114')](_0xb373('0x99'),'Mail');}return _0x3a84d8;}));_0x2401ee[_0xb373('0x43')](_0x4550c7['getSmsQueues']()[_0xb373('0x27')](function(_0x558a31){for(var _0x118579=0x0;_0x118579<_0x558a31[_0xb373('0x47')];_0x118579++){_0x558a31[_0x118579]['setDataValue']('channel',_0xb373('0x119'));}return _0x558a31;}));_0x2401ee[_0xb373('0x43')](_0x4550c7[_0xb373('0x11a')]()[_0xb373('0x27')](function(_0x218fb7){for(var _0x368ef3=0x0;_0x368ef3<_0x218fb7[_0xb373('0x47')];_0x368ef3++){_0x218fb7[_0x368ef3]['setDataValue'](_0xb373('0x99'),'Whatsapp');}return _0x218fb7;}));_0x2401ee[_0xb373('0x43')](_0x4550c7['getFaxQueues']()['then'](function(_0x1e1280){for(var _0x32681c=0x0;_0x32681c<_0x1e1280[_0xb373('0x47')];_0x32681c++){_0x1e1280[_0x32681c][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x11b'));}return _0x1e1280;}));_0x2401ee[_0xb373('0x43')](_0x4550c7['getOpenchannelQueues']()[_0xb373('0x27')](function(_0x5afaa1){for(var _0x179eaa=0x0;_0x179eaa<_0x5afaa1[_0xb373('0x47')];_0x179eaa++){_0x5afaa1[_0x179eaa]['setDataValue'](_0xb373('0x99'),_0xb373('0x11c'));}return _0x5afaa1;}));return BPromise[_0xb373('0x89')](_0x2401ee);})[_0xb373('0x27')](function(_0x2001cd){var _0xb3ab60=_['flatten'](_0x2001cd);_0x2401ee=[];return db[_0xb373('0x64')][_0xb373('0x11d')](function(_0xff7f80){for(var _0x5d5174=0x0;_0x5d5174<_0xb3ab60[_0xb373('0x47')];_0x5d5174++){_0x2401ee[_0xb373('0x43')](_0xb3ab60[_0x5d5174][_0xb373('0x11e')](_0x540ea5['id']),{'transaction':_0xff7f80});}return BPromise[_0xb373('0x89')](_0x2401ee)[_0xb373('0x27')](function(){if(_0x540ea5[_0xb373('0xa8')]){return BPromise[_0xb373('0xaa')](_[_0xb373('0x2b')](_0xb3ab60,function(_0xd83cf8){return _0xd83cf8[_0xb373('0x11f')](_0xb373('0x99'))===_0xb373('0x115');}),function(_0x3f2216){return db[_0xb373('0xaf')]['upsert']({'membername':_0x540ea5['name'],'UserId':_0x540ea5['id'],'queue_name':_0x3f2216[_0xb373('0x34')],'VoiceQueueId':_0x3f2216['id'],'interface':_[_0xb373('0x60')](_0x540ea5['interface'])?util[_0xb373('0xf0')]('SIP/%s',_0x540ea5[_0xb373('0x34')]):_0x540ea5['interface'],'paused':_0x540ea5[_0xb373('0x120')]||![],'penalty':_0x540ea5[_0xb373('0xa1')]},{'transaction':_0xff7f80});});}else{return;}})['then'](function(){for(var _0x3b6d5f=0x0;_0x3b6d5f<_0xb3ab60['length'];_0x3b6d5f++){var _0x228f79=_0xb3ab60[_0x3b6d5f][_0xb373('0x11f')]('channel');var _0x1159b5=_0x228f79+_0xb373('0xa3');socket[_0xb373('0xa4')](_0xb373('0x79')+_0x228f79+_0xb373('0xa5'),{'UserId':_0x540ea5['id'],['queueField']:_0xb3ab60[_0x3b6d5f]['id']});}});});})[_0xb373('0x27')](function(){db['TeamVoicePrefix'][_0xb373('0x93')]({'where':{'teamId':_0x3cc09a['id']}})[_0xb373('0x27')](function(_0x1ebe52){if(_0x1ebe52){db[_0xb373('0x121')]['create']({'UserId':_0x104165[_0xb373('0x56')]['id'],'VoicePrefixId':_0x1ebe52[_0xb373('0x122')]});}});});}});}})[_0xb373('0x27')](respondWithStatusCode(_0x51656a,null))[_0xb373('0x1c')](handleError(_0x51656a,null));};exports[_0xb373('0x123')]=function(_0x5559a5,_0x49a68a){return db[_0xb373('0x36')]['findOne']({'where':{'id':_0x5559a5[_0xb373('0x56')]['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x49a68a,null))[_0xb373('0x27')](function(_0x8115d1){if(_0x8115d1){var _0x27ee05=_0x8115d1[_0xb373('0xd7')]({'plain':!![]});var _0x564774=_0x5559a5[_0xb373('0x3c')][_0xb373('0x59')];return _0x8115d1['removeTeams'](_0x564774)[_0xb373('0x27')](function(){for(var _0x3db67d=0x0;_0x3db67d<_0x564774[_0xb373('0x47')];_0x3db67d++){var _0x2073f3=[];var _0xa0dc7a={};db[_0xb373('0x112')][_0xb373('0x93')]({'where':{'id':_0x564774[_0x3db67d]}})['then'](function(_0x494b7b){_0xa0dc7a=_0x494b7b[_0xb373('0x4a')];_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x124')]()[_0xb373('0x27')](function(_0x493ca5){for(var _0x5163e1=0x0;_0x5163e1<_0x493ca5[_0xb373('0x47')];_0x5163e1++){_0x493ca5[_0x5163e1][_0xb373('0x114')](_0xb373('0x99'),'Voice');}return _0x493ca5;}));_0x2073f3[_0xb373('0x43')](_0x494b7b['getChatQueues']()[_0xb373('0x27')](function(_0x5854f4){for(var _0x37aee6=0x0;_0x37aee6<_0x5854f4[_0xb373('0x47')];_0x37aee6++){_0x5854f4[_0x37aee6]['setDataValue'](_0xb373('0x99'),'Chat');}return _0x5854f4;}));_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x118')]()[_0xb373('0x27')](function(_0x6eb8f4){for(var _0x38a012=0x0;_0x38a012<_0x6eb8f4[_0xb373('0x47')];_0x38a012++){_0x6eb8f4[_0x38a012]['setDataValue'](_0xb373('0x99'),_0xb373('0x125'));}return _0x6eb8f4;}));_0x2073f3['push'](_0x494b7b[_0xb373('0x126')]()[_0xb373('0x27')](function(_0x370be0){for(var _0x1765d1=0x0;_0x1765d1<_0x370be0['length'];_0x1765d1++){_0x370be0[_0x1765d1][_0xb373('0x114')](_0xb373('0x99'),'Sms');}return _0x370be0;}));_0x2073f3['push'](_0x494b7b[_0xb373('0x11a')]()[_0xb373('0x27')](function(_0x37204d){for(var _0x4c719e=0x0;_0x4c719e<_0x37204d[_0xb373('0x47')];_0x4c719e++){_0x37204d[_0x4c719e][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x127'));}return _0x37204d;}));_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x128')]()[_0xb373('0x27')](function(_0x5c44f7){for(var _0x4a3b71=0x0;_0x4a3b71<_0x5c44f7[_0xb373('0x47')];_0x4a3b71++){_0x5c44f7[_0x4a3b71][_0xb373('0x114')](_0xb373('0x99'),_0xb373('0x11b'));}return _0x5c44f7;}));_0x2073f3[_0xb373('0x43')](_0x494b7b[_0xb373('0x129')]()[_0xb373('0x27')](function(_0x5bac1e){for(var _0x51bcfa=0x0;_0x51bcfa<_0x5bac1e[_0xb373('0x47')];_0x51bcfa++){_0x5bac1e[_0x51bcfa]['setDataValue'](_0xb373('0x99'),_0xb373('0x11c'));}return _0x5bac1e;}));return BPromise[_0xb373('0x89')](_0x2073f3);})['then'](function(_0x4ca275){var _0x14f231=_[_0xb373('0x12a')](_0x4ca275);_0x2073f3=[];return db[_0xb373('0x64')][_0xb373('0x11d')](function(_0x1d6861){for(var _0x54474e=0x0;_0x54474e<_0x14f231[_0xb373('0x47')];_0x54474e++){_0x2073f3[_0xb373('0x43')](_0x14f231[_0x54474e]['removeAgent'](_0x27ee05['id']),{'transaction':_0x1d6861});}return BPromise[_0xb373('0x89')](_0x2073f3)[_0xb373('0x27')](function(){if(_0x27ee05[_0xb373('0xa8')]){return BPromise[_0xb373('0xaa')](_['filter'](_0x14f231,function(_0x4fdeac){return _0x4fdeac[_0xb373('0x11f')](_0xb373('0x99'))===_0xb373('0x115');}),function(_0x4517b8){return db[_0xb373('0xaf')][_0xb373('0x26')]({'where':{'VoiceQueueId':_0x4517b8['id'],'UserId':_0x27ee05['id']},'transaction':_0x1d6861});});}else{return;}})[_0xb373('0x27')](function(){db['TeamVoicePrefix'][_0xb373('0x93')]({'where':{'teamId':_0xa0dc7a['id']}})[_0xb373('0x27')](function(_0x17bf0b){if(_0x17bf0b){return db['UserVoicePrefix'][_0xb373('0x26')]({'where':{'UserId':_0x27ee05['id'],'VoicePrefixId':_0x17bf0b[_0xb373('0x4a')][_0xb373('0x122')]}});}});})['then'](function(){for(var _0x261483=0x0;_0x261483<_0x14f231[_0xb373('0x47')];_0x261483++){var _0x58a48d=_0x14f231[_0x261483]['getDataValue'](_0xb373('0x99'));var _0x59b85f=_0x58a48d+'QueueId';socket['emit'](_0xb373('0x79')+_0x58a48d+_0xb373('0xae'),{'UserId':_0x27ee05['id'],['queueField']:_0x14f231[_0x261483]['id']});}});});});}});}})[_0xb373('0x27')](respondWithStatusCode(_0x49a68a,null))[_0xb373('0x1c')](handleError(_0x49a68a,null));};exports[_0xb373('0x12b')]=function(_0x55a5e8,_0x3e170c){var _0xed65c5={};var _0x63ae4f={};var _0x1dc74b;var _0x3550a4;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x55a5e8['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x3e170c,null))[_0xb373('0x27')](function(_0x337045){if(_0x337045){_0x1dc74b=_0x337045;_0x63ae4f[_0xb373('0x51')]=_['keys'](db[_0xb373('0xce')][_0xb373('0x37')]);_0x63ae4f[_0xb373('0x3c')]=_[_0xb373('0x4f')](_0x55a5e8[_0xb373('0x3c')]);_0x63ae4f[_0xb373('0xc9')]=_[_0xb373('0x50')](_0x63ae4f[_0xb373('0x51')],_0x63ae4f[_0xb373('0x3c')]);_0xed65c5[_0xb373('0x42')]=_[_0xb373('0x50')](_0x63ae4f[_0xb373('0x51')],qs[_0xb373('0x52')](_0x55a5e8['query']['fields']));_0xed65c5['attributes']=_0xed65c5[_0xb373('0x42')][_0xb373('0x47')]?_0xed65c5['attributes']:_0x63ae4f[_0xb373('0x51')];_0xed65c5[_0xb373('0xca')]=qs[_0xb373('0xcb')](_0x55a5e8[_0xb373('0x3c')][_0xb373('0xcb')]);_0xed65c5['where']=qs[_0xb373('0xc9')](_['pick'](_0x55a5e8['query'],_0x63ae4f[_0xb373('0xc9')]));if(_0x55a5e8[_0xb373('0x3c')][_0xb373('0x2b')]){_0xed65c5[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0xed65c5[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0xed65c5['attributes'],function(_0x4a1448){var _0x3515fb={};_0x3515fb[_0x4a1448]={'$like':'%'+_0x55a5e8[_0xb373('0x3c')]['filter']+'%'};return _0x3515fb;})});}_0xed65c5=_[_0xb373('0xcc')]({},_0xed65c5,_0x55a5e8[_0xb373('0x53')]);return _0x1dc74b['getLists'](_0xed65c5);}})[_0xb373('0x27')](function(_0xcd2eed){if(_0xcd2eed){_0x3550a4=_0xcd2eed[_0xb373('0x47')];if(!_0x55a5e8[_0xb373('0x3c')][_0xb373('0xcd')](_0xb373('0xd9'))){_0xed65c5['limit']=qs[_0xb373('0x21')](_0x55a5e8[_0xb373('0x3c')]['limit']);_0xed65c5[_0xb373('0x1f')]=qs[_0xb373('0x1f')](_0x55a5e8[_0xb373('0x3c')]['offset']);}return _0x1dc74b[_0xb373('0x12b')](_0xed65c5);}})[_0xb373('0x27')](function(_0x5c41bf){if(_0x5c41bf){return _0x5c41bf?{'count':_0x3550a4,'rows':_0x5c41bf}:null;}})[_0xb373('0x27')](respondWithResult(_0x3e170c,null))[_0xb373('0x1c')](handleError(_0x3e170c,null));};exports[_0xb373('0x12c')]=function(_0x292b24,_0x4e1839){var _0x2aeeab={};var _0xea4a56={};var _0x168ccc;return db[_0xb373('0x36')][_0xb373('0x93')]({'where':{'id':_0x292b24['params']['id']}})[_0xb373('0x27')](handleEntityNotFound(_0x4e1839,null))[_0xb373('0x27')](function(_0x30f033){if(_0x30f033){_0x168ccc=_0x30f033;_0xea4a56[_0xb373('0x51')]=_[_0xb373('0x4f')](db[_0xb373('0x36')][_0xb373('0x37')]);_0xea4a56[_0xb373('0x3c')]=_['keys'](_0x292b24[_0xb373('0x3c')]);_0xea4a56[_0xb373('0xc9')]=_['intersection'](_0xea4a56[_0xb373('0x51')],_0xea4a56[_0xb373('0x3c')]);_0x2aeeab[_0xb373('0x42')]=_[_0xb373('0x50')](_0xea4a56[_0xb373('0x51')],qs[_0xb373('0x52')](_0x292b24[_0xb373('0x3c')][_0xb373('0x52')]));_0x2aeeab[_0xb373('0x42')]=_0x2aeeab[_0xb373('0x42')]['length']?_0x2aeeab[_0xb373('0x42')]:_0xea4a56[_0xb373('0x51')];_0x2aeeab[_0xb373('0xca')]=qs['sort'](_0x292b24[_0xb373('0x3c')][_0xb373('0xcb')]);_0x2aeeab['where']=qs['filters'](_[_0xb373('0xd5')](_0x292b24[_0xb373('0x3c')],_0xea4a56[_0xb373('0xc9')]));if(_0x292b24['query'][_0xb373('0x2b')]){_0x2aeeab[_0xb373('0x3b')]=_[_0xb373('0xcc')](_0x2aeeab[_0xb373('0x3b')],{'$or':_[_0xb373('0x2d')](_0x2aeeab[_0xb373('0x42')],function(_0x10bce0){var _0x4b2e9a={};_0x4b2e9a[_0x10bce0]={'$like':'%'+_0x292b24[_0xb373('0x3c')]['filter']+'%'};return _0x4b2e9a;})});}_0x2aeeab[_0xb373('0x51')]=db[_0xb373('0x36')];_0x2aeeab['as']=_0xb373('0x85');_0x2aeeab=_[_0xb373('0xcc')]({},_0x2aeeab,_0x292b24['options']);return _0x168ccc['getVoiceQueues']({'include':[_0x2aeeab]});}})['then'](function(_0x2e4a9c){if(_0x2e4a9c){var _0xe5aeb5={},_0x1188e9=[];for(var _0x2754d7=0x0;_0x2754d7<_0x2e4a9c['length'];_0x2754d7+=0x1){for(var _0x3da17f=0x0,_0x390aa3;_0x3da17f<_0x2e4a9c[_0x2754d7][_0xb373('0x85')][_0xb373('0x47')];_0x3da17f+=0x1){_0x390aa3=_0x2e4a9c[_0x2754d7][_0xb373('0x85')][_0x3da17f][_0xb373('0xd7')]({'plain':!![]});_0xe5aeb5[_0x390aa3['id']]=_0x390aa3;}}_0xe5aeb5=_['values'](_0xe5aeb5);for(var _0x1b51eb=qs['offset'](_0x292b24['query'][_0xb373('0x1f')]);_0x1b51eb<_0xe5aeb5['length']&&_0x1188e9['length']=_0x5aa666[_0xf8fd('0x50')]){throw new Error(_0xf8fd('0x51'));}})[_0xf8fd('0xd')](function(){if(_0x7dff33){return db[_0xf8fd('0x28')][_0xf8fd('0x52')]({'where':{'membername':_0x7dff33[_0xf8fd('0x24')]},'individualHooks':!![]});}})['then'](function(){if(_0x7dff33){return _0x7dff33[_0xf8fd('0x53')]({'raw':!![]});}})[_0xf8fd('0xd')](function(_0x314600){if(_0x7dff33){if(_0x314600){var _0x2dbe75=[];_0xc37427=_0x314600;if(_0xc37427[_0xf8fd('0x2d')]){for(var _0x5c299a=0x0;_0x5c299a<_0xc37427[_0xf8fd('0x2d')];_0x5c299a++){_0x2dbe75[_0xf8fd('0x47')](db[_0xf8fd('0x28')][_0xf8fd('0x54')]({'membername':_0x7dff33[_0xf8fd('0x24')],'UserId':_0x7dff33['id'],'queue_name':_0xc37427[_0x5c299a][_0xf8fd('0x24')],'VoiceQueueId':_0xc37427[_0x5c299a]['id'],'interface':_0x282e30,'paused':_0x7dff33[_0xf8fd('0x55')]||![],'penalty':_0xc37427[_0x5c299a][_0xf8fd('0x56')]||0x0}));}return BPromise[_0xf8fd('0x44')](_0x2dbe75);}}}})[_0xf8fd('0xd')](function(){if(_0x7dff33){return db[_0xf8fd('0x2a')][_0xf8fd('0x2b')]({'where':{'membername':_0x7dff33[_0xf8fd('0x24')],'exitAt':null}});}})[_0xf8fd('0xd')](function(_0x5b0d72){if(_0x7dff33){if(_0x5b0d72&&_0x5b0d72[_0xf8fd('0x2d')]){var _0x397a9e=[];_0x5b0d72[_0xf8fd('0x32')](function(_0x4995ae){_0x397a9e[_0xf8fd('0x47')](_0x4995ae[_0xf8fd('0x29')]({'exitAt':moment()[_0xf8fd('0x2e')](_0xf8fd('0x2f'))}));});return BPromise[_0xf8fd('0x44')](_0x397a9e);}}})[_0xf8fd('0xd')](function(_0x2ff944){if(_0x7dff33){var _0x4d48e1=[];var _0x849afc=[];var _0x163c72=utils['getChannels']();var _0x458870={'membername':_0x7dff33[_0xf8fd('0x24')],'interface':_0x282e30,'enterAt':moment()[_0xf8fd('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x7dff33[_0xf8fd('0x25')],'internal':_0x7dff33[_0xf8fd('0x26')]};_0x163c72['forEach'](function(_0x3cf1cb){_0x4d48e1[_0xf8fd('0x47')](_['merge']({'channel':_0x3cf1cb,'type':_0xf8fd('0x57'),'data1':_0xf8fd('0x58'),'data2':_0x282e30},_0x458870));if(_0x7dff33['loginInPause']){_0x849afc[_0xf8fd('0x47')](_[_0xf8fd('0x59')]({'channel':_0x3cf1cb,'type':_0xf8fd('0x2c'),'data1':_0xf8fd('0x5a')},_0x458870));}});return db[_0xf8fd('0x2a')][_0xf8fd('0x5b')](_0x4d48e1[_0xf8fd('0x5c')](_0x849afc),{'individualHooks':!![]});}})[_0xf8fd('0xd')](function(){if(_0x7dff33){return _0x7dff33[_0xf8fd('0x29')]({'online':!![],'lastLoginAt':moment()[_0xf8fd('0x2e')](_0xf8fd('0x2f')),'voicePause':_0x7dff33[_0xf8fd('0x55')]||![],'mailPause':_0x7dff33[_0xf8fd('0x55')]||![],'chatPause':_0x7dff33[_0xf8fd('0x55')]||![],'faxPause':_0x7dff33[_0xf8fd('0x55')]||![],'smsPause':_0x7dff33[_0xf8fd('0x55')]||![],'openchannelPause':_0x7dff33[_0xf8fd('0x55')]||![],'pauseType':_0x7dff33['loginInPause']?_0xf8fd('0x5a'):null,'lastPauseAt':moment()[_0xf8fd('0x2e')](_0xf8fd('0x2f')),'interface':_0x282e30});}})[_0xf8fd('0xd')](function(_0x2825bd){_0xb381d1(_0x2825bd);})['catch'](function(_0x3485a9){_0x45eebc(_0x4d0eaf[_0xf8fd('0x14')](0x1f4,_0x3485a9[_0xf8fd('0x15')]));});});}; \ No newline at end of file +var _0x6eac=['register','request','then','info','request\x20sent','debug','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','raw','options','where','attributes','limit','include','model','map','ShowUser','find','role','interface','update','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','SIP/%s','body','type','internal','MemberReport','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','voice','UserVoiceQueueRt','mail','fax','sms','openchannel','whatsapp','system','set','%s%s','Pause','all','LoginUser','mobile','loginInPause','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','merge','LOGININPAUSE','concat','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./user.socket'];(function(_0x181195,_0x1de6da){var _0x455281=function(_0x1ddb93){while(--_0x1ddb93){_0x181195['push'](_0x181195['shift']());}};_0x455281(++_0x1de6da);}(_0x6eac,0x1a5));var _0xc6ea=function(_0x666d50,_0x2b150a){_0x666d50=_0x666d50-0x0;var _0x4ab9e8=_0x6eac[_0x666d50];return _0x4ab9e8;};'use strict';var _=require(_0xc6ea('0x0'));var util=require(_0xc6ea('0x1'));var moment=require('moment');var BPromise=require(_0xc6ea('0x2'));var rs=require(_0xc6ea('0x3'));var fs=require('fs');var Redis=require(_0xc6ea('0x4'));var db=require(_0xc6ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6ea('0x6'));var config=require('../../config/environment');var jayson=require(_0xc6ea('0x7'));var client=jayson[_0xc6ea('0x8')]['http']({'port':0x232a});config[_0xc6ea('0x9')]=_[_0xc6ea('0xa')](config['redis'],{'host':_0xc6ea('0xb'),'port':0x18eb});var socket=require(_0xc6ea('0xc'))(new Redis(config[_0xc6ea('0x9')]));require(_0xc6ea('0xd'))[_0xc6ea('0xe')](socket);function respondWithRpcPromise(_0x2329db,_0x3e6dd2,_0x20e86f){return new BPromise(function(_0x519e9e,_0x93cf19){return client[_0xc6ea('0xf')](_0x2329db,_0x20e86f)[_0xc6ea('0x10')](function(_0x499ee5){logger[_0xc6ea('0x11')]('User,\x20%s,\x20%s',_0x3e6dd2,_0xc6ea('0x12'));logger[_0xc6ea('0x13')]('User,\x20%s,\x20%s,\x20%s',_0x3e6dd2,_0xc6ea('0x12'),JSON[_0xc6ea('0x14')](_0x499ee5));if(_0x499ee5[_0xc6ea('0x15')]){if(_0x499ee5[_0xc6ea('0x15')][_0xc6ea('0x16')]===0x1f4){logger['error'](_0xc6ea('0x17'),_0x3e6dd2,_0x499ee5[_0xc6ea('0x15')][_0xc6ea('0x18')]);return _0x93cf19(_0x499ee5[_0xc6ea('0x15')][_0xc6ea('0x18')]);}logger[_0xc6ea('0x15')](_0xc6ea('0x17'),_0x3e6dd2,_0x499ee5[_0xc6ea('0x15')][_0xc6ea('0x18')]);return _0x519e9e(_0x499ee5[_0xc6ea('0x15')][_0xc6ea('0x18')]);}else{logger[_0xc6ea('0x11')](_0xc6ea('0x17'),_0x3e6dd2,'request\x20sent');_0x519e9e(_0x499ee5[_0xc6ea('0x19')][_0xc6ea('0x18')]);}})[_0xc6ea('0x1a')](function(_0x354039){logger['error'](_0xc6ea('0x17'),_0x3e6dd2,_0x354039);_0x93cf19(_0x354039);});});}exports[_0xc6ea('0x1b')]=function(_0x5b8b49){var _0x355220=this;return new Promise(function(_0x12b8cf,_0x59cb2b){return db[_0xc6ea('0x1c')][_0xc6ea('0x1d')]({'raw':_0x5b8b49['options']?_0x5b8b49['options'][_0xc6ea('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b8b49[_0xc6ea('0x1f')]?_0x5b8b49[_0xc6ea('0x1f')][_0xc6ea('0x20')]||null:null,'attributes':_0x5b8b49['options']?_0x5b8b49['options'][_0xc6ea('0x21')]||null:null,'limit':_0x5b8b49[_0xc6ea('0x1f')]?_0x5b8b49[_0xc6ea('0x1f')][_0xc6ea('0x22')]||null:null,'include':_0x5b8b49['options']?_0x5b8b49[_0xc6ea('0x1f')][_0xc6ea('0x23')]?_['map'](_0x5b8b49[_0xc6ea('0x1f')][_0xc6ea('0x23')],function(_0x59db25){return{'model':db[_0x59db25[_0xc6ea('0x24')]],'as':_0x59db25['as'],'attributes':_0x59db25[_0xc6ea('0x21')],'include':_0x59db25[_0xc6ea('0x23')]?_['map'](_0x59db25[_0xc6ea('0x23')],function(_0x3abdc1){return{'model':db[_0x3abdc1[_0xc6ea('0x24')]],'as':_0x3abdc1['as'],'attributes':_0x3abdc1[_0xc6ea('0x21')],'include':_0x3abdc1[_0xc6ea('0x23')]?_[_0xc6ea('0x25')](_0x3abdc1[_0xc6ea('0x23')],function(_0x36cfa4){return{'model':db[_0x36cfa4[_0xc6ea('0x24')]],'as':_0x36cfa4['as'],'attributes':_0x36cfa4[_0xc6ea('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc6ea('0x10')](function(_0x360e68){logger[_0xc6ea('0x11')](_0xc6ea('0x1b'),_0x5b8b49);logger[_0xc6ea('0x13')]('GetUser',_0x5b8b49,JSON[_0xc6ea('0x14')](_0x360e68));_0x12b8cf(_0x360e68);})['catch'](function(_0x3a7f8d){logger[_0xc6ea('0x15')](_0xc6ea('0x1b'),_0x3a7f8d[_0xc6ea('0x18')],_0x5b8b49);_0x59cb2b(_0x355220[_0xc6ea('0x15')](0x1f4,_0x3a7f8d[_0xc6ea('0x18')]));});});};exports[_0xc6ea('0x26')]=function(_0x427e67){var _0x5456c3=this;return new Promise(function(_0x4cdcf5,_0x40e16a){return db[_0xc6ea('0x1c')][_0xc6ea('0x27')]({'raw':_0x427e67[_0xc6ea('0x1f')]?_0x427e67[_0xc6ea('0x1f')][_0xc6ea('0x1e')]===undefined?!![]:![]:!![],'where':_0x427e67['options']?_0x427e67['options'][_0xc6ea('0x20')]||null:null,'attributes':_0x427e67['options']?_0x427e67[_0xc6ea('0x1f')][_0xc6ea('0x21')]||null:null,'include':_0x427e67[_0xc6ea('0x1f')]?_0x427e67[_0xc6ea('0x1f')][_0xc6ea('0x23')]?_[_0xc6ea('0x25')](_0x427e67[_0xc6ea('0x1f')][_0xc6ea('0x23')],function(_0x45274a){return{'model':db[_0x45274a[_0xc6ea('0x24')]],'as':_0x45274a['as'],'attributes':_0x45274a['attributes'],'include':_0x45274a[_0xc6ea('0x23')]?_[_0xc6ea('0x25')](_0x45274a[_0xc6ea('0x23')],function(_0x487fcd){return{'model':db[_0x487fcd[_0xc6ea('0x24')]],'as':_0x487fcd['as'],'attributes':_0x487fcd[_0xc6ea('0x21')],'include':_0x487fcd[_0xc6ea('0x23')]?_['map'](_0x487fcd[_0xc6ea('0x23')],function(_0x505522){return{'model':db[_0x505522[_0xc6ea('0x24')]],'as':_0x505522['as'],'attributes':_0x505522[_0xc6ea('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc6ea('0x10')](function(_0x448e5){logger[_0xc6ea('0x11')]('ShowUser',_0x427e67);logger[_0xc6ea('0x13')](_0xc6ea('0x26'),_0x427e67,JSON[_0xc6ea('0x14')](_0x448e5));_0x4cdcf5(_0x448e5);})[_0xc6ea('0x1a')](function(_0x31693a){logger['error']('ShowUser',_0x31693a[_0xc6ea('0x18')],_0x427e67);_0x40e16a(_0x5456c3[_0xc6ea('0x15')](0x1f4,_0x31693a[_0xc6ea('0x18')]));});});};exports['PauseUser']=function(_0x55052c){var _0x507b86=this;return new Promise(function(_0x980ba,_0xc08e66){var _0x43f11b;return db['User'][_0xc6ea('0x27')]({'where':_0x55052c['options'][_0xc6ea('0x20')]||{},'attributes':['id','name',_0xc6ea('0x28'),'internal',_0xc6ea('0x29')]})[_0xc6ea('0x10')](function(_0x35d2f6){if(_0x35d2f6){_0x43f11b=_0x35d2f6;return db['UserVoiceQueueRt'][_0xc6ea('0x2a')]({'paused':0x1},{'where':{'UserId':_0x43f11b['id']},'individualHooks':!![]});}})[_0xc6ea('0x10')](function(){if(_0x43f11b){return db['MemberReport'][_0xc6ea('0x1d')]({'where':{'membername':_0x43f11b[_0xc6ea('0x2b')],'type':_0xc6ea('0x2c'),'exitAt':null}});}})[_0xc6ea('0x10')](function(_0x557080){if(_0x43f11b){if(_0x557080&&_0x557080[_0xc6ea('0x2d')]){var _0x32b7ad=moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f'));for(var _0xb1d109=0x0,_0x535430=_0x557080[_0xc6ea('0x2d')];_0xb1d109<_0x535430;_0xb1d109++){_0x557080[_0xb1d109][_0xc6ea('0x30')]({'exitAt':_0x32b7ad});}}}})[_0xc6ea('0x10')](function(){if(_0x43f11b){var _0x5607ec=[];var _0x592a84=utils[_0xc6ea('0x31')]();_0x592a84[_0xc6ea('0x32')](function(_0x2aba12){_0x5607ec[_0xc6ea('0x33')]({'channel':_0x2aba12,'membername':_0x43f11b[_0xc6ea('0x2b')],'interface':_['isNil'](_0x43f11b[_0xc6ea('0x29')])?util[_0xc6ea('0x2e')](_0xc6ea('0x34'),_0x43f11b['name']):_0x43f11b['interface'],'type':_0xc6ea('0x2c'),'enterAt':moment()['format'](_0xc6ea('0x2f')),'data1':_0x55052c[_0xc6ea('0x35')][_0xc6ea('0x36')]||'DEFAULT\x20PAUSE','role':_0x43f11b[_0xc6ea('0x28')],'internal':_0x43f11b[_0xc6ea('0x37')],'uniqueid':_0x55052c[_0xc6ea('0x35')]['uniqueid']||null});});return db[_0xc6ea('0x38')][_0xc6ea('0x39')](_0x5607ec,{'individualHooks':!![]});}})[_0xc6ea('0x10')](function(){if(_0x43f11b){return _0x43f11b[_0xc6ea('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x55052c[_0xc6ea('0x35')][_0xc6ea('0x36')]||_0xc6ea('0x3a'),'lastPauseAt':moment()[_0xc6ea('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xc6ea('0x10')](function(_0x24b950){_0x980ba(_0x24b950);})[_0xc6ea('0x1a')](function(_0x7c94d4){_0xc08e66(_0x507b86[_0xc6ea('0x15')](0x1f4,_0x7c94d4['message']));});});};exports[_0xc6ea('0x3b')]=function(_0x371c2b){var _0x3e0854=this;return new Promise(function(_0x37d446,_0x3fc15d){var _0x2b181f;return db[_0xc6ea('0x1c')][_0xc6ea('0x3c')]({'where':_0x371c2b[_0xc6ea('0x1f')][_0xc6ea('0x20')]||{},'attributes':['id',_0xc6ea('0x2b')]})[_0xc6ea('0x10')](function(_0x3fde50){if(_0x3fde50){_0x2b181f=_0x3fde50;if(_0x371c2b[_0xc6ea('0x35')][_0xc6ea('0x3d')]&&!utils['isValidChannel'](_0x371c2b[_0xc6ea('0x35')][_0xc6ea('0x3d')])){throw new Error('Unknown\x20channel');}switch(_0x371c2b[_0xc6ea('0x35')][_0xc6ea('0x3d')]){case _0xc6ea('0x3e'):return db[_0xc6ea('0x3f')]['update']({'paused':0x0},{'where':{'UserId':_0x2b181f['id']}})['then'](function(){return db[_0xc6ea('0x38')][_0xc6ea('0x27')]({'where':{'channel':_0x371c2b[_0xc6ea('0x35')][_0xc6ea('0x3d')],'membername':_0x2b181f[_0xc6ea('0x2b')],'type':_0xc6ea('0x2c'),'exitAt':null}});})[_0xc6ea('0x10')](function(_0x330c91){if(_0x330c91){return _0x330c91[_0xc6ea('0x2a')]({'exitAt':moment()['format'](_0xc6ea('0x2f')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xc6ea('0x10')](function(){return _0x2b181f[_0xc6ea('0x2a')]({'voicePause':![]});});case _0xc6ea('0x40'):case'chat':case _0xc6ea('0x41'):case _0xc6ea('0x42'):case _0xc6ea('0x43'):case _0xc6ea('0x44'):return db[_0xc6ea('0x38')][_0xc6ea('0x27')]({'where':{'channel':_0x371c2b[_0xc6ea('0x35')][_0xc6ea('0x3d')],'membername':_0x2b181f['name'],'type':_0xc6ea('0x2c'),'exitAt':null}})['then'](function(_0x1bdc14){return _0x1bdc14[_0xc6ea('0x2a')]({'exitAt':moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f')),'data2':_0xc6ea('0x45')},{'individualHooks':!![]});})[_0xc6ea('0x10')](function(){var _0x5bf58a={};_[_0xc6ea('0x46')](_0x5bf58a,util[_0xc6ea('0x2e')](_0xc6ea('0x47'),_0x371c2b[_0xc6ea('0x35')][_0xc6ea('0x3d')],_0xc6ea('0x48')),![]);return _0x2b181f[_0xc6ea('0x2a')](_0x5bf58a);});default:return db[_0xc6ea('0x3f')][_0xc6ea('0x2a')]({'paused':0x0},{'where':{'UserId':_0x2b181f['id']}})[_0xc6ea('0x10')](function(){return db['MemberReport'][_0xc6ea('0x1d')]({'where':{'membername':_0x2b181f['name'],'type':_0xc6ea('0x2c'),'exitAt':null}});})[_0xc6ea('0x10')](function(_0xb38094){var _0x4a5be8=[];_0xb38094[_0xc6ea('0x32')](function(_0x1387ef){_0x4a5be8['push'](_0x1387ef[_0xc6ea('0x2a')]({'exitAt':moment()['format'](_0xc6ea('0x2f')),'data2':_0xc6ea('0x45')}));});return BPromise[_0xc6ea('0x49')](_0x4a5be8);})[_0xc6ea('0x10')](function(){return _0x2b181f[_0xc6ea('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc6ea('0x10')](function(_0x243b69){_0x37d446(_0x243b69);})[_0xc6ea('0x1a')](function(_0x5e8a18){_0x3fc15d(_0x3e0854['error'](0x1f4,_0x5e8a18[_0xc6ea('0x18')]));});});};exports['LogoutUser']=function(_0x14e6f6){var _0x2b0451=this;return new Promise(function(_0x4ec0ed,_0x16c887){var _0x1820d2;return db[_0xc6ea('0x1c')]['findOne']({'where':_0x14e6f6['options']['where']||{},'attributes':['id',_0xc6ea('0x2b')]})['then'](function(_0x2d5bf9){if(_0x2d5bf9){_0x1820d2=_0x2d5bf9;return db[_0xc6ea('0x3f')]['destroy']({'where':{'membername':_0x1820d2[_0xc6ea('0x2b')]},'individualHooks':!![]});}})[_0xc6ea('0x10')](function(){if(_0x1820d2){return db['MemberReport'][_0xc6ea('0x1d')]({'where':{'membername':_0x1820d2[_0xc6ea('0x2b')],'exitAt':null}});}})[_0xc6ea('0x10')](function(_0x889adb){if(_0x1820d2){if(_0x889adb&&_0x889adb[_0xc6ea('0x2d')]){var _0x4bd3db=[];_0x889adb[_0xc6ea('0x32')](function(_0x3a1eb9){_0x4bd3db[_0xc6ea('0x33')](_0x3a1eb9[_0xc6ea('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc6ea('0x49')](_0x4bd3db);}}})['then'](function(){if(_0x1820d2){return _0x1820d2[_0xc6ea('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xb0caf2){_0x4ec0ed(_0xb0caf2);})[_0xc6ea('0x1a')](function(_0x43c274){_0x16c887(_0x2b0451[_0xc6ea('0x15')](0x1f4,_0x43c274[_0xc6ea('0x18')]));});});};exports[_0xc6ea('0x4a')]=function(_0x40060b){var _0x33248c=this;return new Promise(function(_0x5008f5,_0xdc54e1){var _0x29b0f7;var _0x1cb10f;var _0x4ed997;var _0x537d1f;return db[_0xc6ea('0x1c')][_0xc6ea('0x3c')]({'where':_0x40060b[_0xc6ea('0x1f')][_0xc6ea('0x20')]||{},'attributes':['id',_0xc6ea('0x2b'),'role',_0xc6ea('0x4b'),'phone',_0xc6ea('0x37'),_0xc6ea('0x4c'),_0xc6ea('0x29')]})['then'](function(_0x4dcf9c){if(_0x4dcf9c){_0x29b0f7=_0x4dcf9c;_0x537d1f=_0x40060b['body'][_0xc6ea('0x29')]?_0x40060b[_0xc6ea('0x35')][_0xc6ea('0x29')]:util[_0xc6ea('0x2e')](_0xc6ea('0x34'),_0x29b0f7[_0xc6ea('0x2b')]);return db[_0xc6ea('0x1c')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x29b0f7['id']}}});}})[_0xc6ea('0x10')](function(_0x4a134e){if(_0x4a134e){_0x4ed997=_0x4a134e;return require('../../config/license/util')['getLicense']();}})[_0xc6ea('0x10')](function(_0x59adc1){if(_0x59adc1&&_0x59adc1[_0xc6ea('0x4d')]&&_0x4ed997>=_0x59adc1[_0xc6ea('0x4d')]){throw new Error(_0xc6ea('0x4e'));}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return db['UserVoiceQueueRt'][_0xc6ea('0x4f')]({'where':{'membername':_0x29b0f7['name']},'individualHooks':!![]});}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return _0x29b0f7[_0xc6ea('0x50')]({'raw':!![]});}})[_0xc6ea('0x10')](function(_0xc091fd){if(_0x29b0f7){if(_0xc091fd){var _0x8d8965=[];_0x1cb10f=_0xc091fd;if(_0x1cb10f[_0xc6ea('0x2d')]){for(var _0x4e567f=0x0;_0x4e567f<_0x1cb10f['length'];_0x4e567f++){_0x8d8965['push'](db['UserVoiceQueueRt'][_0xc6ea('0x51')]({'membername':_0x29b0f7[_0xc6ea('0x2b')],'UserId':_0x29b0f7['id'],'queue_name':_0x1cb10f[_0x4e567f][_0xc6ea('0x2b')],'VoiceQueueId':_0x1cb10f[_0x4e567f]['id'],'interface':_0x537d1f,'paused':_0x29b0f7['loginInPause']||![],'penalty':_0x1cb10f[_0x4e567f][_0xc6ea('0x52')]||0x0}));}return BPromise[_0xc6ea('0x49')](_0x8d8965);}}}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return db[_0xc6ea('0x38')][_0xc6ea('0x1d')]({'where':{'membername':_0x29b0f7[_0xc6ea('0x2b')],'exitAt':null}});}})[_0xc6ea('0x10')](function(_0x3bdb7a){if(_0x29b0f7){if(_0x3bdb7a&&_0x3bdb7a[_0xc6ea('0x2d')]){var _0x3ccee1=[];_0x3bdb7a['forEach'](function(_0xad2f95){_0x3ccee1[_0xc6ea('0x33')](_0xad2f95['update']({'exitAt':moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f'))}));});return BPromise['all'](_0x3ccee1);}}})[_0xc6ea('0x10')](function(_0x151609){if(_0x29b0f7){var _0x29373d=[];var _0x558807=[];var _0x5a6a0b=utils['getChannels']();var _0x587b2d={'membername':_0x29b0f7[_0xc6ea('0x2b')],'interface':_0x537d1f,'enterAt':moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f')),'role':_0x29b0f7[_0xc6ea('0x28')],'internal':_0x29b0f7[_0xc6ea('0x37')]};_0x5a6a0b[_0xc6ea('0x32')](function(_0xfb041f){_0x29373d[_0xc6ea('0x33')](_['merge']({'channel':_0xfb041f,'type':_0xc6ea('0x53'),'data1':'callysquare','data2':_0x537d1f},_0x587b2d));if(_0x29b0f7[_0xc6ea('0x4c')]){_0x558807['push'](_[_0xc6ea('0x54')]({'channel':_0xfb041f,'type':_0xc6ea('0x2c'),'data1':_0xc6ea('0x55')},_0x587b2d));}});return db[_0xc6ea('0x38')][_0xc6ea('0x39')](_0x29373d[_0xc6ea('0x56')](_0x558807),{'individualHooks':!![]});}})[_0xc6ea('0x10')](function(){if(_0x29b0f7){return _0x29b0f7[_0xc6ea('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xc6ea('0x2e')](_0xc6ea('0x2f')),'voicePause':_0x29b0f7[_0xc6ea('0x4c')]||![],'mailPause':_0x29b0f7[_0xc6ea('0x4c')]||![],'chatPause':_0x29b0f7['loginInPause']||![],'faxPause':_0x29b0f7[_0xc6ea('0x4c')]||![],'smsPause':_0x29b0f7['loginInPause']||![],'openchannelPause':_0x29b0f7[_0xc6ea('0x4c')]||![],'pauseType':_0x29b0f7[_0xc6ea('0x4c')]?_0xc6ea('0x55'):null,'lastPauseAt':moment()[_0xc6ea('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x537d1f});}})[_0xc6ea('0x10')](function(_0x33a34a){_0x5008f5(_0x33a34a);})['catch'](function(_0x41971e){_0xdc54e1(_0x33248c[_0xc6ea('0x15')](0x1f4,_0x41971e['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f67867c..e2775b4 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 _0x867f=['emit','removeListener','register','length','user:','save','remove'];(function(_0x559267,_0x2d8d68){var _0x2e4d65=function(_0x33b8d4){while(--_0x33b8d4){_0x559267['push'](_0x559267['shift']());}};_0x2e4d65(++_0x2d8d68);}(_0x867f,0xf3));var _0xf867=function(_0x42e5bc,_0x58d89e){_0x42e5bc=_0x42e5bc-0x0;var _0x9d3c30=_0x867f[_0x42e5bc];return _0x9d3c30;};'use strict';var UserEvents=require('./user.events');var events=[_0xf867('0x0'),_0xf867('0x1'),'update'];function createListener(_0x341017,_0x510e9b){return function(_0x4f3325){_0x510e9b[_0xf867('0x2')](_0x341017,_0x4f3325);};}function removeListener(_0x27c08f,_0x209b7b){return function(){UserEvents[_0xf867('0x3')](_0x27c08f,_0x209b7b);};}exports[_0xf867('0x4')]=function(_0x5bebd0){for(var _0x509932=0x0,_0x46df4b=events[_0xf867('0x5')];_0x509932<_0x46df4b;_0x509932++){var _0x2f7120=events[_0x509932];var _0x4ca5d7=createListener(_0xf867('0x6')+_0x2f7120,_0x5bebd0);UserEvents['on'](_0x2f7120,_0x4ca5d7);}}; \ No newline at end of file +var _0xe497=['user:','./user.events','save','remove','update','emit','register','length'];(function(_0x5c605d,_0x500761){var _0x1bc14c=function(_0x2ae017){while(--_0x2ae017){_0x5c605d['push'](_0x5c605d['shift']());}};_0x1bc14c(++_0x500761);}(_0xe497,0x139));var _0x7e49=function(_0x1ac727,_0x13b5ea){_0x1ac727=_0x1ac727-0x0;var _0xc633c4=_0xe497[_0x1ac727];return _0xc633c4;};'use strict';var UserEvents=require(_0x7e49('0x0'));var events=[_0x7e49('0x1'),_0x7e49('0x2'),_0x7e49('0x3')];function createListener(_0x50d4ca,_0x3cf546){return function(_0xb1063b){_0x3cf546[_0x7e49('0x4')](_0x50d4ca,_0xb1063b);};}function removeListener(_0x5a9b78,_0x3bc44d){return function(){UserEvents['removeListener'](_0x5a9b78,_0x3bc44d);};}exports[_0x7e49('0x5')]=function(_0x4722ee){for(var _0x8cd483=0x0,_0x260072=events[_0x7e49('0x6')];_0x8cd483<_0x260072;_0x8cd483++){var _0x446d6d=events[_0x8cd483];var _0x2481d1=createListener(_0x7e49('0x7')+_0x446d6d,_0x4722ee);UserEvents['on'](_0x446d6d,_0x2481d1);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 10ee9f5..60ec2de 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2e557b,_0x3dbb36){var _0x4fe470=function(_0x325502){while(--_0x325502){_0x2e557b['push'](_0x2e557b['shift']());}};_0x4fe470(++_0x3dbb36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x69d3ef,_0x4e03ef){var _0x31c788=function(_0x2bb81e){while(--_0x2bb81e){_0x69d3ef['push'](_0x69d3ef['shift']());}};_0x31c788(++_0x4e03ef);}(_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 e78b823..f2a68fe 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 _0x638d=['INTEGER','sequelize','exports'];(function(_0x10afb2,_0x431e94){var _0x23c228=function(_0x1b8b2a){while(--_0x1b8b2a){_0x10afb2['push'](_0x10afb2['shift']());}};_0x23c228(++_0x431e94);}(_0x638d,0xb8));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd638('0x0'));module[_0xd638('0x1')]={'penalty':{'type':Sequelize[_0xd638('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4855=['exports','INTEGER','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4855,0x1d9));var _0x5485=function(_0x3b7a06,_0x41f79e){_0x3b7a06=_0x3b7a06-0x0;var _0x363e31=_0x4855[_0x3b7a06];return _0x363e31;};'use strict';var Sequelize=require(_0x5485('0x0'));module[_0x5485('0x1')]={'penalty':{'type':Sequelize[_0x5485('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 3fdc610..3a6ea9b 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 _0x034f=['exports','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x434a90,_0x463cba){var _0x2366d0=function(_0x70f2d4){while(--_0x70f2d4){_0x434a90['push'](_0x434a90['shift']());}};_0x2366d0(++_0x463cba);}(_0x034f,0x12f));var _0xf034=function(_0x2341b9,_0xdc7c78){_0x2341b9=_0x2341b9-0x0;var _0x339c0a=_0x034f[_0x2341b9];return _0x339c0a;};'use strict';var _=require('lodash');var util=require(_0xf034('0x0'));var logger=require(_0xf034('0x1'))(_0xf034('0x2'));var moment=require('moment');var BPromise=require(_0xf034('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf034('0x4'));var rimraf=require(_0xf034('0x5'));var config=require(_0xf034('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xf034('0x7')]=function(_0x4172e9,_0x3d22d4){return _0x4172e9['define'](_0xf034('0x8'),attributes,{'tableName':_0xf034('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x972d=['exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x972d,0xb7));var _0xd972=function(_0x244a95,_0x495cdf){_0x244a95=_0x244a95-0x0;var _0x20428e=_0x972d[_0x244a95];return _0x20428e;};'use strict';var _=require(_0xd972('0x0'));var util=require(_0xd972('0x1'));var logger=require(_0xd972('0x2'))(_0xd972('0x3'));var moment=require(_0xd972('0x4'));var BPromise=require('bluebird');var rp=require(_0xd972('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xd972('0x6')]=function(_0x503400,_0x2ceb90){return _0x503400[_0xd972('0x7')]('UserChatQueue',attributes,{'tableName':_0xd972('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 4df94a4..e765e28 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 _0x5cfd=['../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x391a41,_0x343c7f){var _0x99e12=function(_0x10d929){while(--_0x10d929){_0x391a41['push'](_0x391a41['shift']());}};_0x99e12(++_0x343c7f);}(_0x5cfd,0x177));var _0xd5cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd5cf('0x0'));var moment=require(_0xd5cf('0x1'));var BPromise=require(_0xd5cf('0x2'));var rs=require(_0xd5cf('0x3'));var fs=require('fs');var Redis=require(_0xd5cf('0x4'));var db=require(_0xd5cf('0x5'))['db'];var utils=require(_0xd5cf('0x6'));var logger=require(_0xd5cf('0x7'))(_0xd5cf('0x8'));var config=require(_0xd5cf('0x9'));var jayson=require(_0xd5cf('0xa'));var client=jayson[_0xd5cf('0xb')][_0xd5cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281aba,_0x9ad5fc,_0x385aa2){return new BPromise(function(_0x480ee9,_0x1c4996){return client[_0xd5cf('0xd')](_0x281aba,_0x385aa2)[_0xd5cf('0xe')](function(_0x3e6239){logger[_0xd5cf('0xf')](_0xd5cf('0x10'),_0x9ad5fc,_0xd5cf('0x11'));logger[_0xd5cf('0x12')](_0xd5cf('0x13'),_0x9ad5fc,_0xd5cf('0x11'),JSON['stringify'](_0x3e6239));if(_0x3e6239[_0xd5cf('0x14')]){if(_0x3e6239[_0xd5cf('0x14')][_0xd5cf('0x15')]===0x1f4){logger[_0xd5cf('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x9ad5fc,_0x3e6239[_0xd5cf('0x14')][_0xd5cf('0x16')]);return _0x1c4996(_0x3e6239[_0xd5cf('0x14')][_0xd5cf('0x16')]);}logger[_0xd5cf('0x14')](_0xd5cf('0x10'),_0x9ad5fc,_0x3e6239[_0xd5cf('0x14')][_0xd5cf('0x16')]);return _0x480ee9(_0x3e6239[_0xd5cf('0x14')][_0xd5cf('0x16')]);}else{logger[_0xd5cf('0xf')](_0xd5cf('0x10'),_0x9ad5fc,'request\x20sent');_0x480ee9(_0x3e6239[_0xd5cf('0x17')]['message']);}})['catch'](function(_0x4d0ae5){logger[_0xd5cf('0x14')](_0xd5cf('0x10'),_0x9ad5fc,_0x4d0ae5);_0x1c4996(_0x4d0ae5);});});} \ No newline at end of file +var _0x59a9=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x59a9,0xa3));var _0x959a=function(_0x3e0295,_0x1361cd){_0x3e0295=_0x3e0295-0x0;var _0x4c3735=_0x59a9[_0x3e0295];return _0x4c3735;};'use strict';var _=require(_0x959a('0x0'));var util=require('util');var moment=require(_0x959a('0x1'));var BPromise=require(_0x959a('0x2'));var rs=require(_0x959a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x959a('0x4'))['db'];var utils=require(_0x959a('0x5'));var logger=require(_0x959a('0x6'))('rpc');var config=require(_0x959a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x959a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c1455,_0x20b63f,_0xa93e44){return new BPromise(function(_0x3a1dc7,_0x386c06){return client[_0x959a('0x9')](_0x2c1455,_0xa93e44)['then'](function(_0x25b13c){logger[_0x959a('0xa')](_0x959a('0xb'),_0x20b63f,_0x959a('0xc'));logger[_0x959a('0xd')](_0x959a('0xe'),_0x20b63f,_0x959a('0xc'),JSON['stringify'](_0x25b13c));if(_0x25b13c[_0x959a('0xf')]){if(_0x25b13c[_0x959a('0xf')][_0x959a('0x10')]===0x1f4){logger[_0x959a('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x20b63f,_0x25b13c[_0x959a('0xf')][_0x959a('0x11')]);return _0x386c06(_0x25b13c[_0x959a('0xf')][_0x959a('0x11')]);}logger[_0x959a('0xf')](_0x959a('0xb'),_0x20b63f,_0x25b13c['error'][_0x959a('0x11')]);return _0x3a1dc7(_0x25b13c['error'][_0x959a('0x11')]);}else{logger[_0x959a('0xa')](_0x959a('0xb'),_0x20b63f,_0x959a('0xc'));_0x3a1dc7(_0x25b13c[_0x959a('0x12')]['message']);}})[_0x959a('0x13')](function(_0x2504da){logger[_0x959a('0xf')](_0x959a('0xb'),_0x20b63f,_0x2504da);_0x386c06(_0x2504da);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ae9f29d..8479ee8 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(_0x511d24,_0x385080){var _0x5b7d4e=function(_0x4a5d55){while(--_0x4a5d55){_0x511d24['push'](_0x511d24['shift']());}};_0x5b7d4e(++_0x385080);}(_0x70e0,0x17b));var _0x070e=function(_0xde5f87,_0x575c1e){_0xde5f87=_0xde5f87-0x0;var _0x58f747=_0x70e0[_0xde5f87];return _0x58f747;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4eeb21,_0xe28a97){var _0x209775=function(_0x310d42){while(--_0x310d42){_0x4eeb21['push'](_0x4eeb21['shift']());}};_0x209775(++_0xe28a97);}(_0x70e0,0x17b));var _0x070e=function(_0xa03fed,_0x574c43){_0xa03fed=_0xa03fed-0x0;var _0x34cdfe=_0x70e0[_0xa03fed];return _0x34cdfe;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8158a76..474f963 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 _0x8a35=['STRING','sequelize','exports','INTEGER'];(function(_0x4bdc80,_0x143ac7){var _0x782250=function(_0x206ba9){while(--_0x206ba9){_0x4bdc80['push'](_0x4bdc80['shift']());}};_0x782250(++_0x143ac7);}(_0x8a35,0x1c9));var _0x58a3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8a35[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x58a3('0x0'));module[_0x58a3('0x1')]={'penalty':{'type':Sequelize[_0x58a3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x58a3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x58a3('0x3')]}}; \ No newline at end of file +var _0x2808=['INTEGER','STRING','sequelize'];(function(_0x2a5d7a,_0x47b143){var _0x231c09=function(_0x48a2a6){while(--_0x48a2a6){_0x2a5d7a['push'](_0x2a5d7a['shift']());}};_0x231c09(++_0x47b143);}(_0x2808,0x104));var _0x8280=function(_0x1b984a,_0x1f4cac){_0x1b984a=_0x1b984a-0x0;var _0x48dd75=_0x2808[_0x1b984a];return _0x48dd75;};'use strict';var Sequelize=require(_0x8280('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8280('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8280('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8280('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 72c1f31..296a330 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 _0x9795=['bluebird','rimraf','./userFaxQueue.attributes','define','lodash','util','../../config/logger','api'];(function(_0x246573,_0x856eb9){var _0x441c04=function(_0x2a28bb){while(--_0x2a28bb){_0x246573['push'](_0x246573['shift']());}};_0x441c04(++_0x856eb9);}(_0x9795,0x74));var _0x5979=function(_0x11d619,_0x365e45){_0x11d619=_0x11d619-0x0;var _0x3757ad=_0x9795[_0x11d619];return _0x3757ad;};'use strict';var _=require(_0x5979('0x0'));var util=require(_0x5979('0x1'));var logger=require(_0x5979('0x2'))(_0x5979('0x3'));var moment=require('moment');var BPromise=require(_0x5979('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5979('0x5'));var config=require('../../config/environment');var attributes=require(_0x5979('0x6'));module['exports']=function(_0x496adb,_0x446f83){return _0x496adb[_0x5979('0x7')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9d7=['exports','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x59c8fe,_0x2f65ef){var _0x1b9b22=function(_0x2b5ba6){while(--_0x2b5ba6){_0x59c8fe['push'](_0x59c8fe['shift']());}};_0x1b9b22(++_0x2f65ef);}(_0xa9d7,0x15e));var _0x7a9d=function(_0x45bec0,_0x573804){_0x45bec0=_0x45bec0-0x0;var _0x2123c4=_0xa9d7[_0x45bec0];return _0x2123c4;};'use strict';var _=require(_0x7a9d('0x0'));var util=require(_0x7a9d('0x1'));var logger=require(_0x7a9d('0x2'))('api');var moment=require(_0x7a9d('0x3'));var BPromise=require(_0x7a9d('0x4'));var rp=require(_0x7a9d('0x5'));var fs=require('fs');var path=require(_0x7a9d('0x6'));var rimraf=require(_0x7a9d('0x7'));var config=require(_0x7a9d('0x8'));var attributes=require(_0x7a9d('0x9'));module[_0x7a9d('0xa')]=function(_0x4a643e,_0x5be0c7){return _0x4a643e['define']('UserFaxQueue',attributes,{'tableName':_0x7a9d('0xb'),'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 2f8c0e3..9814b9c 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 _0x93a1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x93a1,0x80));var _0x193a=function(_0x542cb7,_0x36c426){_0x542cb7=_0x542cb7-0x0;var _0x3d6313=_0x93a1[_0x542cb7];return _0x3d6313;};'use strict';var _=require('lodash');var util=require(_0x193a('0x0'));var moment=require('moment');var BPromise=require(_0x193a('0x1'));var rs=require(_0x193a('0x2'));var fs=require('fs');var Redis=require(_0x193a('0x3'));var db=require(_0x193a('0x4'))['db'];var utils=require(_0x193a('0x5'));var logger=require(_0x193a('0x6'))(_0x193a('0x7'));var config=require(_0x193a('0x8'));var jayson=require(_0x193a('0x9'));var client=jayson[_0x193a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ac4ed,_0x58eea9,_0x11fcd3){return new BPromise(function(_0x49d2e9,_0x56ca31){return client[_0x193a('0xb')](_0x4ac4ed,_0x11fcd3)[_0x193a('0xc')](function(_0x55717e){logger[_0x193a('0xd')](_0x193a('0xe'),_0x58eea9,_0x193a('0xf'));logger[_0x193a('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x58eea9,_0x193a('0xf'),JSON[_0x193a('0x11')](_0x55717e));if(_0x55717e[_0x193a('0x12')]){if(_0x55717e[_0x193a('0x12')][_0x193a('0x13')]===0x1f4){logger[_0x193a('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x58eea9,_0x55717e[_0x193a('0x12')][_0x193a('0x14')]);return _0x56ca31(_0x55717e[_0x193a('0x12')][_0x193a('0x14')]);}logger[_0x193a('0x12')](_0x193a('0xe'),_0x58eea9,_0x55717e[_0x193a('0x12')]['message']);return _0x49d2e9(_0x55717e[_0x193a('0x12')][_0x193a('0x14')]);}else{logger['info'](_0x193a('0xe'),_0x58eea9,_0x193a('0xf'));_0x49d2e9(_0x55717e['result'][_0x193a('0x14')]);}})[_0x193a('0x15')](function(_0x5149a8){logger[_0x193a('0x12')](_0x193a('0xe'),_0x58eea9,_0x5149a8);_0x56ca31(_0x5149a8);});});} \ No newline at end of file +var _0x1e9f=['request\x20sent','debug','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x46f6c6,_0x5f337d){var _0x462bb8=function(_0x30c708){while(--_0x30c708){_0x46f6c6['push'](_0x46f6c6['shift']());}};_0x462bb8(++_0x5f337d);}(_0x1e9f,0x16e));var _0xf1e9=function(_0x5b4059,_0x5d27f6){_0x5b4059=_0x5b4059-0x0;var _0x2215f5=_0x1e9f[_0x5b4059];return _0x2215f5;};'use strict';var _=require(_0xf1e9('0x0'));var util=require('util');var moment=require(_0xf1e9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1e9('0x2'));var db=require(_0xf1e9('0x3'))['db'];var utils=require(_0xf1e9('0x4'));var logger=require(_0xf1e9('0x5'))(_0xf1e9('0x6'));var config=require(_0xf1e9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf1e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28a4eb,_0x1248f1,_0x44abcd){return new BPromise(function(_0x5f52,_0x1c75fc){return client['request'](_0x28a4eb,_0x44abcd)[_0xf1e9('0x9')](function(_0x3a9a27){logger[_0xf1e9('0xa')](_0xf1e9('0xb'),_0x1248f1,_0xf1e9('0xc'));logger[_0xf1e9('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1248f1,_0xf1e9('0xc'),JSON['stringify'](_0x3a9a27));if(_0x3a9a27[_0xf1e9('0xe')]){if(_0x3a9a27['error'][_0xf1e9('0xf')]===0x1f4){logger['error'](_0xf1e9('0xb'),_0x1248f1,_0x3a9a27[_0xf1e9('0xe')][_0xf1e9('0x10')]);return _0x1c75fc(_0x3a9a27['error'][_0xf1e9('0x10')]);}logger[_0xf1e9('0xe')](_0xf1e9('0xb'),_0x1248f1,_0x3a9a27['error']['message']);return _0x5f52(_0x3a9a27[_0xf1e9('0xe')][_0xf1e9('0x10')]);}else{logger[_0xf1e9('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x1248f1,_0xf1e9('0xc'));_0x5f52(_0x3a9a27['result'][_0xf1e9('0x10')]);}})[_0xf1e9('0x11')](function(_0x364fb5){logger[_0xf1e9('0xe')](_0xf1e9('0xb'),_0x1248f1,_0x364fb5);_0x1c75fc(_0x364fb5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1428f5d..f4fc7d1 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3baf22,_0x24fa9d){var _0x32df7a=function(_0x25bb08){while(--_0x25bb08){_0x3baf22['push'](_0x3baf22['shift']());}};_0x32df7a(++_0x24fa9d);}(_0xedd9,0xfc));var _0x9edd=function(_0x151188,_0x2e00b5){_0x151188=_0x151188-0x0;var _0xf86c2b=_0xedd9[_0x151188];return _0xf86c2b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5252ce,_0x133319){var _0x1f0fec=function(_0x1a7403){while(--_0x1a7403){_0x5252ce['push'](_0x5252ce['shift']());}};_0x1f0fec(++_0x133319);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9dee1fa..1cf41ce 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 _0x01a5=['exports','INTEGER'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x01a5,0x1a8));var _0x501a=function(_0x202d5,_0x2544f7){_0x202d5=_0x202d5-0x0;var _0x2c0344=_0x01a5[_0x202d5];return _0x2c0344;};'use strict';var Sequelize=require('sequelize');module[_0x501a('0x0')]={'penalty':{'type':Sequelize[_0x501a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x73f4=['sequelize','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x73f4,0x1b0));var _0x473f=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x73f4[_0x872b02];return _0x1a6b24;};'use strict';var Sequelize=require(_0x473f('0x0'));module[_0x473f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index e9d0e40..47d7b87 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 _0x3bee=['exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5a6271,_0xb3f4e6){var _0x44b197=function(_0x1b9fa3){while(--_0x1b9fa3){_0x5a6271['push'](_0x5a6271['shift']());}};_0x44b197(++_0xb3f4e6);}(_0x3bee,0x17d));var _0xe3be=function(_0x303734,_0x1c5d4b){_0x303734=_0x303734-0x0;var _0x6a2b2c=_0x3bee[_0x303734];return _0x6a2b2c;};'use strict';var _=require(_0xe3be('0x0'));var util=require(_0xe3be('0x1'));var logger=require(_0xe3be('0x2'))(_0xe3be('0x3'));var moment=require(_0xe3be('0x4'));var BPromise=require(_0xe3be('0x5'));var rp=require(_0xe3be('0x6'));var fs=require('fs');var path=require(_0xe3be('0x7'));var rimraf=require('rimraf');var config=require(_0xe3be('0x8'));var attributes=require('./userMailQueue.attributes');module[_0xe3be('0x9')]=function(_0x3d8687,_0x48014f){return _0x3d8687[_0xe3be('0xa')](_0xe3be('0xb'),attributes,{'tableName':_0xe3be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf223=['exports','UserMailQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x7033ad,_0x4f191a){var _0x4117fb=function(_0x537976){while(--_0x537976){_0x7033ad['push'](_0x7033ad['shift']());}};_0x4117fb(++_0x4f191a);}(_0xf223,0xc2));var _0x3f22=function(_0x893e48,_0x31660c){_0x893e48=_0x893e48-0x0;var _0x4a9a22=_0xf223[_0x893e48];return _0x4a9a22;};'use strict';var _=require(_0x3f22('0x0'));var util=require(_0x3f22('0x1'));var logger=require(_0x3f22('0x2'))(_0x3f22('0x3'));var moment=require('moment');var BPromise=require(_0x3f22('0x4'));var rp=require(_0x3f22('0x5'));var fs=require('fs');var path=require(_0x3f22('0x6'));var rimraf=require(_0x3f22('0x7'));var config=require(_0x3f22('0x8'));var attributes=require(_0x3f22('0x9'));module[_0x3f22('0xa')]=function(_0x504296,_0x4c864a){return _0x504296['define'](_0x3f22('0xb'),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 b1ad064..d6d8200 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4842b8,_0x3dc334){var _0x50efc9=function(_0x25512d){while(--_0x25512d){_0x4842b8['push'](_0x4842b8['shift']());}};_0x50efc9(++_0x3dc334);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x447260,_0x5d2baa){var _0xfd1cc4=function(_0x4e52f3){while(--_0x4e52f3){_0x447260['push'](_0x447260['shift']());}};_0xfd1cc4(++_0x5d2baa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3050b5,_0x182c6a){_0x3050b5=_0x3050b5-0x0;var _0x37cceb=_0xf3cd[_0x3050b5];return _0x37cceb;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3fa868f..1ac11c6 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 _0x6f9b=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x21c8df,_0x1d57ab){var _0x417bb9=function(_0x77cb58){while(--_0x77cb58){_0x21c8df['push'](_0x21c8df['shift']());}};_0x417bb9(++_0x1d57ab);}(_0x6f9b,0xf5));var _0xb6f9=function(_0x5861a3,_0x335c19){_0x5861a3=_0x5861a3-0x0;var _0x5c94b7=_0x6f9b[_0x5861a3];return _0x5c94b7;};'use strict';var multer=require(_0xb6f9('0x0'));var util=require(_0xb6f9('0x1'));var path=require(_0xb6f9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb6f9('0x3')]();var fs_extra=require(_0xb6f9('0x4'));var auth=require(_0xb6f9('0x5'));var interaction=require(_0xb6f9('0x6'));var config=require(_0xb6f9('0x7'));var controller=require(_0xb6f9('0x8'));router[_0xb6f9('0x9')]('/',auth[_0xb6f9('0xa')](),controller[_0xb6f9('0xb')]);module[_0xb6f9('0xc')]=router; \ No newline at end of file +var _0x311f=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','util'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x311f,0x11d));var _0xf311=function(_0x26c75a,_0x5c96b2){_0x26c75a=_0x26c75a-0x0;var _0x4fe968=_0x311f[_0x26c75a];return _0x4fe968;};'use strict';var multer=require('multer');var util=require(_0xf311('0x0'));var path=require('path');var timeout=require(_0xf311('0x1'));var express=require(_0xf311('0x2'));var router=express[_0xf311('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf311('0x4'));var interaction=require(_0xf311('0x5'));var config=require(_0xf311('0x6'));var controller=require('./userNotification.controller');router[_0xf311('0x7')]('/',auth[_0xf311('0x8')](),controller[_0xf311('0x9')]);module[_0xf311('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3c4e5cd..320c3f2 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 _0x575d=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x4a7d02,_0x3f00ec){var _0x436c10=function(_0x2150a3){while(--_0x2150a3){_0x4a7d02['push'](_0x4a7d02['shift']());}};_0x436c10(++_0x3f00ec);}(_0x575d,0xe0));var _0xd575=function(_0x5af475,_0x4ac10f){_0x5af475=_0x5af475-0x0;var _0x587dda=_0x575d[_0x5af475];return _0x587dda;};'use strict';var Sequelize=require(_0xd575('0x0'));module['exports']={'body':{'type':Sequelize[_0xd575('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xd575('0x1')]},'recipientsDescription':{'type':Sequelize[_0xd575('0x2')]},'beep':{'type':Sequelize[_0xd575('0x3')]}}; \ No newline at end of file +var _0x4914=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x401c88,_0x5c9ef9){var _0x3126a0=function(_0x56f75c){while(--_0x56f75c){_0x401c88['push'](_0x401c88['shift']());}};_0x3126a0(++_0x5c9ef9);}(_0x4914,0x11d));var _0x4491=function(_0x3b94fc,_0x44fef4){_0x3b94fc=_0x3b94fc-0x0;var _0x27b1af=_0x4914[_0x3b94fc];return _0x27b1af;};'use strict';var Sequelize=require(_0x4491('0x0'));module[_0x4491('0x1')]={'body':{'type':Sequelize[_0x4491('0x2')]},'senderName':{'type':Sequelize[_0x4491('0x3')]},'recipientsId':{'type':Sequelize[_0x4491('0x2')]},'recipientsDescription':{'type':Sequelize[_0x4491('0x3')]},'beep':{'type':Sequelize[_0x4491('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 42e1520..2d2c512 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 _0xc1ae=['faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','forEach','emit','catch','text','Template','findOne','html','render','startCase','User','replace','queue','all','union','getAgents','map','zip-dir','moment','bluebird','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','apply','save','update','then','destroy','stack','name','send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error'];(function(_0x1a6ca9,_0x5105e9){var _0x65abaf=function(_0x2939d2){while(--_0x2939d2){_0x1a6ca9['push'](_0x1a6ca9['shift']());}};_0x65abaf(++_0x5105e9);}(_0xc1ae,0x186));var _0xec1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ae[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec1a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xec1a('0x1'));var BPromise=require(_0xec1a('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xec1a('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec1a('0x4'));var _=require('lodash');var squel=require(_0xec1a('0x5'));var crypto=require(_0xec1a('0x6'));var jsforce=require(_0xec1a('0x7'));var deskjs=require(_0xec1a('0x8'));var toCsv=require(_0xec1a('0x9'));var querystring=require(_0xec1a('0xa'));var Papa=require(_0xec1a('0xb'));var Redis=require(_0xec1a('0xc'));var authService=require(_0xec1a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xec1a('0xe'));var hardwareService=require(_0xec1a('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xec1a('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xec1a('0x11'));var db=require(_0xec1a('0x12'))['db'];config[_0xec1a('0x13')]=_['defaults'](config[_0xec1a('0x13')],{'host':_0xec1a('0x14'),'port':0x18eb});var socket=require(_0xec1a('0x15'))(new Redis(config[_0xec1a('0x13')]));require(_0xec1a('0x16'))[_0xec1a('0x17')](socket);function respondWithStatusCode(_0x523d87,_0x33b8a3){_0x33b8a3=_0x33b8a3||0xcc;return function(_0x2eb51a){if(_0x2eb51a){return _0x523d87[_0xec1a('0x18')](_0x33b8a3);}return _0x523d87[_0xec1a('0x19')](_0x33b8a3)[_0xec1a('0x1a')]();};}function respondWithResult(_0x300bad,_0xc11baf){_0xc11baf=_0xc11baf||0xc8;return function(_0x4ec11f){if(_0x4ec11f){return _0x300bad[_0xec1a('0x19')](_0xc11baf)[_0xec1a('0x1b')](_0x4ec11f);}};}function respondWithFilteredResult(_0x4a8e6a,_0x41ed69){return function(_0x279e2c){if(_0x279e2c){var _0x242aec=typeof _0x41ed69['offset']===_0xec1a('0x1c')&&typeof _0x41ed69[_0xec1a('0x1d')]==='undefined';var _0x3bc831=_0x279e2c['count'];var _0x331770=_0x242aec?0x0:_0x41ed69[_0xec1a('0x1e')];var _0x17a242=_0x242aec?_0x279e2c['count']:_0x41ed69['offset']+_0x41ed69[_0xec1a('0x1d')];var _0x39eeb8;if(_0x17a242>=_0x3bc831){_0x17a242=_0x3bc831;_0x39eeb8=0xc8;}else{_0x39eeb8=0xce;}_0x4a8e6a['status'](_0x39eeb8);return _0x4a8e6a[_0xec1a('0x1f')]('Content-Range',_0x331770+'-'+_0x17a242+'/'+_0x3bc831)[_0xec1a('0x1b')](_0x279e2c);}return null;};}function patchUpdates(_0x27bcf0){return function(_0x388eba){try{jsonpatch[_0xec1a('0x20')](_0x388eba,_0x27bcf0,!![]);}catch(_0xe18dfb){return BPromise['reject'](_0xe18dfb);}return _0x388eba[_0xec1a('0x21')]();};}function saveUpdates(_0x370071,_0x30c50f){return function(_0x375043){if(_0x375043){return _0x375043[_0xec1a('0x22')](_0x370071)[_0xec1a('0x23')](function(_0x26c733){return _0x26c733;});}return null;};}function removeEntity(_0x54ba3c,_0x2848f5){return function(_0x42e425){if(_0x42e425){return _0x42e425[_0xec1a('0x24')]()[_0xec1a('0x23')](function(){_0x54ba3c[_0xec1a('0x19')](0xcc)[_0xec1a('0x1a')]();});}};}function handleEntityNotFound(_0x49f7d8,_0xce9e9d){return function(_0x335650){if(!_0x335650){_0x49f7d8[_0xec1a('0x18')](0x194);}return _0x335650;};}function handleError(_0x528765,_0x2a2cea){_0x2a2cea=_0x2a2cea||0x1f4;return function(_0x20a147){logger['error'](_0x20a147[_0xec1a('0x25')]);if(_0x20a147['name']){delete _0x20a147[_0xec1a('0x26')];}_0x528765[_0xec1a('0x19')](_0x2a2cea)[_0xec1a('0x27')](_0x20a147);};}exports['sendUserNotification']=function(_0x3d03b8,_0x354367,_0x15f632){if(!_0x3d03b8[_0xec1a('0x28')][_0xec1a('0x29')]('text')&&!_0x3d03b8['body']['hasOwnProperty'](_0xec1a('0x2a'))){throw new db[(_0xec1a('0x2b'))][(_0xec1a('0x2c'))](_0xec1a('0x2d'));}else{if(_0x3d03b8[_0xec1a('0x28')]['hasOwnProperty'](_0xec1a('0x2a'))&&!_0x3d03b8[_0xec1a('0x28')][_0xec1a('0x29')]('view')){throw new db['Sequelize'][(_0xec1a('0x2c'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3d03b8[_0xec1a('0x28')][_0xec1a('0x29')]('recipients')){throw new db[(_0xec1a('0x2b'))][(_0xec1a('0x2c'))](_0xec1a('0x2e'));}else{try{var _0x32607f=JSON[_0xec1a('0x2f')](_0x3d03b8[_0xec1a('0x28')][_0xec1a('0x30')]);}catch(_0x109eca){logger[_0xec1a('0x31')](_0x109eca);throw new db[(_0xec1a('0x2b'))][(_0xec1a('0x2c'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x3ad255=['chatqueue',_0xec1a('0x32'),'mailqueue',_0xec1a('0x33'),_0xec1a('0x34'),_0xec1a('0x35'),_0xec1a('0x36'),_0xec1a('0x37'),_0xec1a('0x38')];if(_[_0xec1a('0x39')](_0x32607f,function(_0x11ec14){return!_[_0xec1a('0x3a')](_0x3ad255,_0x11ec14[_0xec1a('0x3b')][_0xec1a('0x3c')]());})){throw new db[(_0xec1a('0x2b'))][(_0xec1a('0x2c'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x17b06b={};_0x17b06b[_0xec1a('0x3d')]=_0x3d03b8['body']['hasOwnProperty'](_0xec1a('0x3d'))?_0x3d03b8['body'][_0xec1a('0x3d')]:_0x3d03b8[_0xec1a('0x38')][_0xec1a('0x3e')];_0x17b06b[_0xec1a('0x3f')]=_[_0xec1a('0x40')](_0x3d03b8['body'][_0xec1a('0x3f')])?null:_0x3d03b8['body'][_0xec1a('0x3f')];_0x17b06b['beep']=_0x3d03b8[_0xec1a('0x28')][_0xec1a('0x41')]||![];_0x17b06b[_0xec1a('0x42')]=_0x3d03b8['user']['id'];return getContent(_0x3d03b8[_0xec1a('0x28')])['then'](function(_0x5c96d8){_0x17b06b['body']=_0x5c96d8;return getRecipients(_0x32607f);})[_0xec1a('0x23')](function(_0x1e4be3){_0x17b06b['recipientsId']=_[_0xec1a('0x43')](_0x1e4be3)[_0xec1a('0x44')](',');return db[_0xec1a('0x45')][_0xec1a('0x46')](function(_0x5b5924){return db[_0xec1a('0x47')]['create'](_0x17b06b,{'raw':!![],'transaction':_0x5b5924})['then'](function(_0x403c14){var _0x3cab63={'sender':_0x17b06b[_0xec1a('0x3d')],'description':_0x17b06b['recipientsDescription'],'content':_0x17b06b[_0xec1a('0x28')],'beep':_0x17b06b[_0xec1a('0x41')]};_0x1e4be3[_0xec1a('0x48')](function(_0x11e6da){_0x3cab63['recipient']=_0x11e6da;socket[_0xec1a('0x49')]('userNotification:send',_0x3cab63);});return _0x403c14;});});})[_0xec1a('0x23')](respondWithResult(_0x354367,0xc9))[_0xec1a('0x4a')](handleError(_0x354367,null));};function getContent(_0x359750){return new BPromise(function(_0x542644,_0x36f898){if(_0x359750[_0xec1a('0x4b')]){_0x542644(_0x359750[_0xec1a('0x4b')]);return;}return db[_0xec1a('0x4c')][_0xec1a('0x4d')]({'attributes':[_0xec1a('0x4e')],'where':{'id':_0x359750[_0xec1a('0x2a')]},'raw':!![]})[_0xec1a('0x23')](function(_0xb67e8){if(!_0xb67e8)throw new db[(_0xec1a('0x2b'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x42cee8=Mustache[_0xec1a('0x4f')](_0xb67e8['html'],_0x359750['view']);_0x542644(_0x42cee8);})[_0xec1a('0x4a')](function(_0x10bb44){_0x36f898(_0x10bb44);});});}function getRecipients(_0x3512a){return new BPromise(function(_0x11ee06,_0x29c00e){var _0x362b46=[];var _0x437a4a=[];_0x3512a[_0xec1a('0x48')](function(_0x4eb00e){var _0x26f82a=_[_0xec1a('0x50')](_0x4eb00e[_0xec1a('0x3b')][_0xec1a('0x3c')]());if(_0x26f82a===_0xec1a('0x51')){_0x362b46=_['union'](_0x362b46,_0x4eb00e['ids']);}else{if(_[_0xec1a('0x3a')](_0x26f82a,'queue'))_0x26f82a=_0x26f82a[_0xec1a('0x52')](_0xec1a('0x53'),'Queue');_0x4eb00e['ids'][_0xec1a('0x48')](function(_0x4b57ed){_0x437a4a['push'](getAgents(_0x26f82a,_0x4b57ed));});}});return BPromise[_0xec1a('0x54')](_0x437a4a)[_0xec1a('0x23')](function(_0x385ab1){_0x362b46=_[_0xec1a('0x55')](_0x362b46,_['flatten'](_0x385ab1));_0x11ee06(_0x362b46);})['catch'](function(_0x270716){_0x29c00e(_0x270716);});});}function getAgents(_0x59cfa2,_0x1521be){return new BPromise(function(_0x32478c,_0x19f385){return db[_0x59cfa2][_0xec1a('0x4d')]({'where':{'id':_0x1521be}})[_0xec1a('0x23')](function(_0x13ec95){return _0x13ec95[_0xec1a('0x56')]({'attributes':['id'],'raw':!![]})[_0xec1a('0x23')](function(_0x386a3c){var _0x221acf=_[_0xec1a('0x57')](_0x386a3c,'id');_0x32478c(_0x221acf);});})[_0xec1a('0x4a')](function(_0x358373){_0x19f385(_0x358373);});});} \ No newline at end of file +var _0xea67=['includes','model','toLowerCase','senderName','user','recipientsDescription','beep','recipientsId','sortBy','join','UserNotification','create','forEach','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','queue','Queue','push','all','flatten','getAgents','map','rimraf','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','name','send','hasOwnProperty','text','body','TemplateId','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','voicequeue','whatsappqueue','team','some'];(function(_0x9efc39,_0x1be234){var _0x2c5051=function(_0x19e7c7){while(--_0x19e7c7){_0x9efc39['push'](_0x9efc39['shift']());}};_0x2c5051(++_0x1be234);}(_0xea67,0x1d0));var _0x7ea6=function(_0x52d4ee,_0x64e207){_0x52d4ee=_0x52d4ee-0x0;var _0x51d053=_0xea67[_0x52d4ee];return _0x51d053;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ea6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ea6('0x1'));var BPromise=require(_0x7ea6('0x2'));var Mustache=require(_0x7ea6('0x3'));var util=require(_0x7ea6('0x4'));var path=require(_0x7ea6('0x5'));var sox=require(_0x7ea6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ea6('0x7'));var squel=require(_0x7ea6('0x8'));var crypto=require(_0x7ea6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7ea6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7ea6('0xb'));var Papa=require(_0x7ea6('0xc'));var Redis=require(_0x7ea6('0xd'));var authService=require(_0x7ea6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7ea6('0xf'));var utils=require(_0x7ea6('0x10'));var config=require(_0x7ea6('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ea6('0x12'))['db'];config['redis']=_['defaults'](config[_0x7ea6('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x7ea6('0x14'))(new Redis(config[_0x7ea6('0x13')]));require(_0x7ea6('0x15'))[_0x7ea6('0x16')](socket);function respondWithStatusCode(_0xb84438,_0x22c980){_0x22c980=_0x22c980||0xcc;return function(_0x2351ec){if(_0x2351ec){return _0xb84438[_0x7ea6('0x17')](_0x22c980);}return _0xb84438[_0x7ea6('0x18')](_0x22c980)[_0x7ea6('0x19')]();};}function respondWithResult(_0xe18989,_0x151c45){_0x151c45=_0x151c45||0xc8;return function(_0x268aac){if(_0x268aac){return _0xe18989[_0x7ea6('0x18')](_0x151c45)['json'](_0x268aac);}};}function respondWithFilteredResult(_0x24d4ad,_0x4c00e2){return function(_0x41267c){if(_0x41267c){var _0x5a309a=typeof _0x4c00e2[_0x7ea6('0x1a')]===_0x7ea6('0x1b')&&typeof _0x4c00e2[_0x7ea6('0x1c')]===_0x7ea6('0x1b');var _0x21c02d=_0x41267c['count'];var _0x1a10f0=_0x5a309a?0x0:_0x4c00e2['offset'];var _0xdeed7c=_0x5a309a?_0x41267c['count']:_0x4c00e2[_0x7ea6('0x1a')]+_0x4c00e2[_0x7ea6('0x1c')];var _0x1e11b1;if(_0xdeed7c>=_0x21c02d){_0xdeed7c=_0x21c02d;_0x1e11b1=0xc8;}else{_0x1e11b1=0xce;}_0x24d4ad['status'](_0x1e11b1);return _0x24d4ad[_0x7ea6('0x1d')](_0x7ea6('0x1e'),_0x1a10f0+'-'+_0xdeed7c+'/'+_0x21c02d)[_0x7ea6('0x1f')](_0x41267c);}return null;};}function patchUpdates(_0x360e8a){return function(_0x472f03){try{jsonpatch[_0x7ea6('0x20')](_0x472f03,_0x360e8a,!![]);}catch(_0xa71686){return BPromise['reject'](_0xa71686);}return _0x472f03[_0x7ea6('0x21')]();};}function saveUpdates(_0x4798ef,_0x23f230){return function(_0x4287c4){if(_0x4287c4){return _0x4287c4[_0x7ea6('0x22')](_0x4798ef)[_0x7ea6('0x23')](function(_0xbb1081){return _0xbb1081;});}return null;};}function removeEntity(_0x4b7e12,_0x154efa){return function(_0x12b2e2){if(_0x12b2e2){return _0x12b2e2[_0x7ea6('0x24')]()[_0x7ea6('0x23')](function(){_0x4b7e12[_0x7ea6('0x18')](0xcc)[_0x7ea6('0x19')]();});}};}function handleEntityNotFound(_0x49d845,_0x29c326){return function(_0x393f9b){if(!_0x393f9b){_0x49d845[_0x7ea6('0x17')](0x194);}return _0x393f9b;};}function handleError(_0x4bd894,_0x38f736){_0x38f736=_0x38f736||0x1f4;return function(_0x2788af){logger['error'](_0x2788af['stack']);if(_0x2788af[_0x7ea6('0x25')]){delete _0x2788af[_0x7ea6('0x25')];}_0x4bd894[_0x7ea6('0x18')](_0x38f736)[_0x7ea6('0x26')](_0x2788af);};}exports['sendUserNotification']=function(_0x1d4fb3,_0x48841d,_0x4c5dfa){if(!_0x1d4fb3['body'][_0x7ea6('0x27')](_0x7ea6('0x28'))&&!_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')](_0x7ea6('0x2a'))){throw new db['Sequelize'][(_0x7ea6('0x2b'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')](_0x7ea6('0x2a'))&&!_0x1d4fb3['body'][_0x7ea6('0x27')](_0x7ea6('0x2c'))){throw new db['Sequelize']['ValidationError'](_0x7ea6('0x2d'));}if(!_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')]('recipients')){throw new db[(_0x7ea6('0x2e'))][(_0x7ea6('0x2b'))](_0x7ea6('0x2f'));}else{try{var _0x55e44f=JSON[_0x7ea6('0x30')](_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x31')]);}catch(_0x249b73){logger[_0x7ea6('0x32')](_0x249b73);throw new db[(_0x7ea6('0x2e'))]['ValidationError'](_0x7ea6('0x33'));}var _0xe9b0e4=['chatqueue',_0x7ea6('0x34'),_0x7ea6('0x35'),'openchannelqueue','smsqueue',_0x7ea6('0x36'),_0x7ea6('0x37'),_0x7ea6('0x38'),'user'];if(_[_0x7ea6('0x39')](_0x55e44f,function(_0x3df9b7){return!_[_0x7ea6('0x3a')](_0xe9b0e4,_0x3df9b7[_0x7ea6('0x3b')][_0x7ea6('0x3c')]());})){throw new db['Sequelize'][(_0x7ea6('0x2b'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x385bc9={};_0x385bc9[_0x7ea6('0x3d')]=_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x27')]('senderName')?_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x3d')]:_0x1d4fb3[_0x7ea6('0x3e')]['fullname'];_0x385bc9[_0x7ea6('0x3f')]=_['isEmpty'](_0x1d4fb3['body'][_0x7ea6('0x3f')])?null:_0x1d4fb3[_0x7ea6('0x29')][_0x7ea6('0x3f')];_0x385bc9['beep']=_0x1d4fb3['body'][_0x7ea6('0x40')]||![];_0x385bc9['SenderId']=_0x1d4fb3['user']['id'];return getContent(_0x1d4fb3['body'])[_0x7ea6('0x23')](function(_0x360f80){_0x385bc9[_0x7ea6('0x29')]=_0x360f80;return getRecipients(_0x55e44f);})['then'](function(_0x2f1555){_0x385bc9[_0x7ea6('0x41')]=_[_0x7ea6('0x42')](_0x2f1555)[_0x7ea6('0x43')](',');return db['sequelize']['transaction'](function(_0x26729a){return db[_0x7ea6('0x44')][_0x7ea6('0x45')](_0x385bc9,{'raw':!![],'transaction':_0x26729a})[_0x7ea6('0x23')](function(_0x217ed9){var _0x31142c={'sender':_0x385bc9['senderName'],'description':_0x385bc9[_0x7ea6('0x3f')],'content':_0x385bc9[_0x7ea6('0x29')],'beep':_0x385bc9['beep']};_0x2f1555[_0x7ea6('0x46')](function(_0x4f3da3){_0x31142c['recipient']=_0x4f3da3;socket['emit'](_0x7ea6('0x47'),_0x31142c);});return _0x217ed9;});});})[_0x7ea6('0x23')](respondWithResult(_0x48841d,0xc9))[_0x7ea6('0x48')](handleError(_0x48841d,null));};function getContent(_0x49944d){return new BPromise(function(_0x226fbe,_0x12ca29){if(_0x49944d[_0x7ea6('0x28')]){_0x226fbe(_0x49944d[_0x7ea6('0x28')]);return;}return db['Template'][_0x7ea6('0x49')]({'attributes':[_0x7ea6('0x4a')],'where':{'id':_0x49944d['TemplateId']},'raw':!![]})['then'](function(_0x334481){if(!_0x334481)throw new db['Sequelize'][(_0x7ea6('0x2b'))](_0x7ea6('0x4b'));var _0x3238e5=Mustache[_0x7ea6('0x4c')](_0x334481[_0x7ea6('0x4a')],_0x49944d['view']);_0x226fbe(_0x3238e5);})[_0x7ea6('0x48')](function(_0x3ac36a){_0x12ca29(_0x3ac36a);});});}function getRecipients(_0x373e8e){return new BPromise(function(_0x584fd5,_0x2dbccf){var _0x5bafe5=[];var _0x47daea=[];_0x373e8e['forEach'](function(_0x44cc5f){var _0xd6d775=_[_0x7ea6('0x4d')](_0x44cc5f['model']['toLowerCase']());if(_0xd6d775===_0x7ea6('0x4e')){_0x5bafe5=_['union'](_0x5bafe5,_0x44cc5f[_0x7ea6('0x4f')]);}else{if(_[_0x7ea6('0x3a')](_0xd6d775,_0x7ea6('0x50')))_0xd6d775=_0xd6d775['replace'](_0x7ea6('0x50'),_0x7ea6('0x51'));_0x44cc5f[_0x7ea6('0x4f')][_0x7ea6('0x46')](function(_0x284a55){_0x47daea[_0x7ea6('0x52')](getAgents(_0xd6d775,_0x284a55));});}});return BPromise[_0x7ea6('0x53')](_0x47daea)[_0x7ea6('0x23')](function(_0x2559b4){_0x5bafe5=_['union'](_0x5bafe5,_[_0x7ea6('0x54')](_0x2559b4));_0x584fd5(_0x5bafe5);})[_0x7ea6('0x48')](function(_0xabebb){_0x2dbccf(_0xabebb);});});}function getAgents(_0x3f925a,_0x3d7e99){return new BPromise(function(_0x4913b5,_0xb9ca40){return db[_0x3f925a][_0x7ea6('0x49')]({'where':{'id':_0x3d7e99}})[_0x7ea6('0x23')](function(_0x2ff598){return _0x2ff598[_0x7ea6('0x55')]({'attributes':['id'],'raw':!![]})[_0x7ea6('0x23')](function(_0x56ded7){var _0x1f47a4=_[_0x7ea6('0x56')](_0x56ded7,'id');_0x4913b5(_0x1f47a4);});})[_0x7ea6('0x48')](function(_0x20912d){_0xb9ca40(_0x20912d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 5048bb0..3775035 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 _0x2db5=['events','../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2db5,0x13b));var _0x52db=function(_0x131e60,_0x5352ce){_0x131e60=_0x131e60-0x0;var _0x4bc497=_0x2db5[_0x131e60];return _0x4bc497;};'use strict';var EventEmitter=require(_0x52db('0x0'));var UserNotification=require(_0x52db('0x1'))['db'][_0x52db('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x52db('0x3')](0x0);var events={'afterCreate':_0x52db('0x4'),'afterUpdate':_0x52db('0x5'),'afterDestroy':'remove'};function emitEvent(_0x13ab92){return function(_0x29c2f5,_0x2ac572,_0x45e73d){UserNotificationEvents[_0x52db('0x6')](_0x13ab92+':'+_0x29c2f5['id'],_0x29c2f5);UserNotificationEvents[_0x52db('0x6')](_0x13ab92,_0x29c2f5);_0x45e73d(null);};}for(var e in events){if(events[_0x52db('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x52db('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x740b=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x2ca403,_0x5d8d9f){var _0x578940=function(_0x2b756c){while(--_0x2b756c){_0x2ca403['push'](_0x2ca403['shift']());}};_0x578940(++_0x5d8d9f);}(_0x740b,0xc4));var _0xb740=function(_0x3d6a87,_0x4cd23c){_0x3d6a87=_0x3d6a87-0x0;var _0x1e37fc=_0x740b[_0x3d6a87];return _0x1e37fc;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xb740('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb740('0x1')](0x0);var events={'afterCreate':_0xb740('0x2'),'afterUpdate':'update','afterDestroy':_0xb740('0x3')};function emitEvent(_0x50f40b){return function(_0x5ca3e5,_0x306c14,_0x3bb39e){UserNotificationEvents[_0xb740('0x4')](_0x50f40b+':'+_0x5ca3e5['id'],_0x5ca3e5);UserNotificationEvents[_0xb740('0x4')](_0x50f40b,_0x5ca3e5);_0x3bb39e(null);};}for(var e in events){if(events[_0xb740('0x5')](e)){var event=events[e];UserNotification[_0xb740('0x6')](e,emitEvent(event));}}module[_0xb740('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f71af7d..c9db4de 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 _0xc24c=['exports','define','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5b2b34,_0xe14d30){var _0x31db59=function(_0xfdb941){while(--_0xfdb941){_0x5b2b34['push'](_0x5b2b34['shift']());}};_0x31db59(++_0xe14d30);}(_0xc24c,0x1ed));var _0xcc24=function(_0x1e9f29,_0x26714e){_0x1e9f29=_0x1e9f29-0x0;var _0x50c718=_0xc24c[_0x1e9f29];return _0x50c718;};'use strict';var _=require('lodash');var util=require(_0xcc24('0x0'));var logger=require('../../config/logger')(_0xcc24('0x1'));var moment=require(_0xcc24('0x2'));var BPromise=require(_0xcc24('0x3'));var rp=require(_0xcc24('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc24('0x5'));var config=require(_0xcc24('0x6'));var attributes=require('./userNotification.attributes');module[_0xcc24('0x7')]=function(_0x25318f,_0x508e13){return _0x25318f[_0xcc24('0x8')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcc24('0x9')});}; \ No newline at end of file +var _0x95de=['utf8mb4','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3862c4,_0x4de9da){var _0x14d461=function(_0x1ec200){while(--_0x1ec200){_0x3862c4['push'](_0x3862c4['shift']());}};_0x14d461(++_0x4de9da);}(_0x95de,0xd9));var _0xe95d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x95de[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xe95d('0x0'));var util=require(_0xe95d('0x1'));var logger=require('../../config/logger')(_0xe95d('0x2'));var moment=require(_0xe95d('0x3'));var BPromise=require(_0xe95d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe95d('0x5'));var rimraf=require(_0xe95d('0x6'));var config=require(_0xe95d('0x7'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x21d67f,_0x355478){return _0x21d67f['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe95d('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b80e724..5bbee3d 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 _0xe47f=['defaults','socket.io-emitter','register','request','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe47f,0x75));var _0xfe47=function(_0x5cc118,_0x479136){_0x5cc118=_0x5cc118-0x0;var _0x87ff2b=_0xe47f[_0x5cc118];return _0x87ff2b;};'use strict';var _=require('lodash');var util=require(_0xfe47('0x0'));var moment=require(_0xfe47('0x1'));var BPromise=require(_0xfe47('0x2'));var rs=require(_0xfe47('0x3'));var fs=require('fs');var Redis=require(_0xfe47('0x4'));var db=require(_0xfe47('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe47('0x6'))(_0xfe47('0x7'));var config=require(_0xfe47('0x8'));var jayson=require(_0xfe47('0x9'));var client=jayson[_0xfe47('0xa')][_0xfe47('0xb')]({'port':0x232a});config[_0xfe47('0xc')]=_[_0xfe47('0xd')](config[_0xfe47('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe47('0xe'))(new Redis(config[_0xfe47('0xc')]));require('./userNotification.socket')[_0xfe47('0xf')](socket);function respondWithRpcPromise(_0x457f47,_0x3dedbb,_0x4c4ba7){return new BPromise(function(_0x5c7d53,_0x2f76aa){return client[_0xfe47('0x10')](_0x457f47,_0x4c4ba7)[_0xfe47('0x11')](function(_0x5aee28){logger['info'](_0xfe47('0x12'),_0x3dedbb,'request\x20sent');logger[_0xfe47('0x13')](_0xfe47('0x14'),_0x3dedbb,'request\x20sent',JSON['stringify'](_0x5aee28));if(_0x5aee28[_0xfe47('0x15')]){if(_0x5aee28[_0xfe47('0x15')]['code']===0x1f4){logger[_0xfe47('0x15')](_0xfe47('0x12'),_0x3dedbb,_0x5aee28[_0xfe47('0x15')][_0xfe47('0x16')]);return _0x2f76aa(_0x5aee28[_0xfe47('0x15')][_0xfe47('0x16')]);}logger[_0xfe47('0x15')](_0xfe47('0x12'),_0x3dedbb,_0x5aee28[_0xfe47('0x15')]['message']);return _0x5c7d53(_0x5aee28[_0xfe47('0x15')][_0xfe47('0x16')]);}else{logger[_0xfe47('0x17')](_0xfe47('0x12'),_0x3dedbb,_0xfe47('0x18'));_0x5c7d53(_0x5aee28[_0xfe47('0x19')][_0xfe47('0x16')]);}})['catch'](function(_0x566e92){logger[_0xfe47('0x15')]('UserNotification,\x20%s,\x20%s',_0x3dedbb,_0x566e92);_0x2f76aa(_0x566e92);});});} \ No newline at end of file +var _0xf4b5=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xf4b5,0x14b));var _0x5f4b=function(_0x59d073,_0x55b8fc){_0x59d073=_0x59d073-0x0;var _0x46d3df=_0xf4b5[_0x59d073];return _0x46d3df;};'use strict';var _=require(_0x5f4b('0x0'));var util=require('util');var moment=require(_0x5f4b('0x1'));var BPromise=require(_0x5f4b('0x2'));var rs=require(_0x5f4b('0x3'));var fs=require('fs');var Redis=require(_0x5f4b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f4b('0x5'))(_0x5f4b('0x6'));var config=require(_0x5f4b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5f4b('0x8')][_0x5f4b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5f4b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f4b('0xb'))(new Redis(config[_0x5f4b('0xa')]));require(_0x5f4b('0xc'))[_0x5f4b('0xd')](socket);function respondWithRpcPromise(_0x2903f9,_0x3ce4f8,_0x40afe5){return new BPromise(function(_0x161b7a,_0x54f7b3){return client['request'](_0x2903f9,_0x40afe5)[_0x5f4b('0xe')](function(_0x452ce9){logger[_0x5f4b('0xf')](_0x5f4b('0x10'),_0x3ce4f8,_0x5f4b('0x11'));logger[_0x5f4b('0x12')](_0x5f4b('0x13'),_0x3ce4f8,_0x5f4b('0x11'),JSON[_0x5f4b('0x14')](_0x452ce9));if(_0x452ce9[_0x5f4b('0x15')]){if(_0x452ce9[_0x5f4b('0x15')][_0x5f4b('0x16')]===0x1f4){logger[_0x5f4b('0x15')](_0x5f4b('0x10'),_0x3ce4f8,_0x452ce9['error']['message']);return _0x54f7b3(_0x452ce9[_0x5f4b('0x15')]['message']);}logger[_0x5f4b('0x15')](_0x5f4b('0x10'),_0x3ce4f8,_0x452ce9['error']['message']);return _0x161b7a(_0x452ce9[_0x5f4b('0x15')][_0x5f4b('0x17')]);}else{logger[_0x5f4b('0xf')](_0x5f4b('0x10'),_0x3ce4f8,_0x5f4b('0x11'));_0x161b7a(_0x452ce9['result'][_0x5f4b('0x17')]);}})[_0x5f4b('0x18')](function(_0x605949){logger['error'](_0x5f4b('0x10'),_0x3ce4f8,_0x605949);_0x54f7b3(_0x605949);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index e9d9d93..4007258 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 _0xbf26=['emit','removeListener','register','length','save','remove','update'];(function(_0x3af80c,_0x38f0e5){var _0x1603a9=function(_0x27f786){while(--_0x27f786){_0x3af80c['push'](_0x3af80c['shift']());}};_0x1603a9(++_0x38f0e5);}(_0xbf26,0x107));var _0x6bf2=function(_0x366da5,_0x1f2101){_0x366da5=_0x366da5-0x0;var _0x4a7086=_0xbf26[_0x366da5];return _0x4a7086;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x6bf2('0x0'),_0x6bf2('0x1'),_0x6bf2('0x2')];function createListener(_0x24951b,_0x48e5e2){return function(_0x516ab3){_0x48e5e2[_0x6bf2('0x3')](_0x24951b,_0x516ab3);};}function removeListener(_0x48b878,_0xeea63c){return function(){UserNotificationEvents[_0x6bf2('0x4')](_0x48b878,_0xeea63c);};}exports[_0x6bf2('0x5')]=function(_0x4cccd4){for(var _0x29bc81=0x0,_0x2cfda6=events[_0x6bf2('0x6')];_0x29bc81<_0x2cfda6;_0x29bc81++){var _0x4cd19a=events[_0x29bc81];var _0x4cdbff=createListener('userNotification:'+_0x4cd19a,_0x4cccd4);UserNotificationEvents['on'](_0x4cd19a,_0x4cdbff);}}; \ No newline at end of file +var _0xbcb4=['update','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0xb9924a,_0x2b5bb5){var _0x42deac=function(_0x1cdcf4){while(--_0x1cdcf4){_0xb9924a['push'](_0xb9924a['shift']());}};_0x42deac(++_0x2b5bb5);}(_0xbcb4,0x185));var _0x4bcb=function(_0xc3f6bf,_0x543611){_0xc3f6bf=_0xc3f6bf-0x0;var _0x3a615a=_0xbcb4[_0xc3f6bf];return _0x3a615a;};'use strict';var UserNotificationEvents=require(_0x4bcb('0x0'));var events=[_0x4bcb('0x1'),_0x4bcb('0x2'),_0x4bcb('0x3')];function createListener(_0x117be1,_0x4d2ac3){return function(_0x19f54d){_0x4d2ac3['emit'](_0x117be1,_0x19f54d);};}function removeListener(_0x207058,_0x3bd447){return function(){UserNotificationEvents['removeListener'](_0x207058,_0x3bd447);};}exports[_0x4bcb('0x4')]=function(_0xd13283){for(var _0x823015=0x0,_0x573146=events[_0x4bcb('0x5')];_0x823015<_0x573146;_0x823015++){var _0x528f40=events[_0x823015];var _0x1d5b2b=createListener(_0x4bcb('0x6')+_0x528f40,_0xd13283);UserNotificationEvents['on'](_0x528f40,_0x1d5b2b);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 40cfcfa..1c3ba6b 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x158015,_0x55d7cc){var _0x2439fe=function(_0x16b190){while(--_0x16b190){_0x158015['push'](_0x158015['shift']());}};_0x2439fe(++_0x55d7cc);}(_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'));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(_0x371040,_0x11ead3){var _0x2d6194=function(_0x3f5136){while(--_0x3f5136){_0x371040['push'](_0x371040['shift']());}};_0x2d6194(++_0x11ead3);}(_0xe706,0xa3));var _0x6e70=function(_0x533bcc,_0x1ba26f){_0x533bcc=_0x533bcc-0x0;var _0x364d38=_0xe706[_0x533bcc];return _0x364d38;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8106bc4..1b91ca2 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 _0x1b21=['sequelize'];(function(_0x4064e0,_0x3cfbb4){var _0x2e644c=function(_0x4dfbaf){while(--_0x4dfbaf){_0x4064e0['push'](_0x4064e0['shift']());}};_0x2e644c(++_0x3cfbb4);}(_0x1b21,0x1b6));var _0x11b2=function(_0x139ee1,_0x4865ab){_0x139ee1=_0x139ee1-0x0;var _0x4b035c=_0x1b21[_0x139ee1];return _0x4b035c;};'use strict';var Sequelize=require(_0x11b2('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a35=['INTEGER','sequelize','exports'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x6a35,0xeb));var _0x56a3=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x6a35[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x56a3('0x0'));module[_0x56a3('0x1')]={'penalty':{'type':Sequelize[_0x56a3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index bfa88f4..6bd8e88 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 _0xdec8=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x445199,_0x50daf7){var _0x1cc1a4=function(_0x9d8481){while(--_0x9d8481){_0x445199['push'](_0x445199['shift']());}};_0x1cc1a4(++_0x50daf7);}(_0xdec8,0xe5));var _0x8dec=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xdec8[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8dec('0x0'));var util=require(_0x8dec('0x1'));var logger=require(_0x8dec('0x2'))(_0x8dec('0x3'));var moment=require(_0x8dec('0x4'));var BPromise=require(_0x8dec('0x5'));var rp=require(_0x8dec('0x6'));var fs=require('fs');var path=require(_0x8dec('0x7'));var rimraf=require('rimraf');var config=require(_0x8dec('0x8'));var attributes=require(_0x8dec('0x9'));module[_0x8dec('0xa')]=function(_0xd4fa28,_0x2ae26f){return _0xd4fa28[_0x8dec('0xb')](_0x8dec('0xc'),attributes,{'tableName':_0x8dec('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43bd=['user_has_openchannel_queues','util','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue'];(function(_0x5bd4fc,_0x4fbd8c){var _0x14b56e=function(_0x361e5c){while(--_0x361e5c){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x14b56e(++_0x4fbd8c);}(_0x43bd,0x10f));var _0xd43b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x43bd[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xd43b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd43b('0x1'));var fs=require('fs');var path=require(_0xd43b('0x2'));var rimraf=require(_0xd43b('0x3'));var config=require(_0xd43b('0x4'));var attributes=require(_0xd43b('0x5'));module[_0xd43b('0x6')]=function(_0x1e96f2,_0x4bb4f4){return _0x1e96f2['define'](_0xd43b('0x7'),attributes,{'tableName':_0xd43b('0x8'),'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 adb0faa..527914e 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 _0x51ba=['request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x104764,_0x336c8d){var _0x4c0158=function(_0x36df31){while(--_0x36df31){_0x104764['push'](_0x104764['shift']());}};_0x4c0158(++_0x336c8d);}(_0x51ba,0xd1));var _0xa51b=function(_0x5b1379,_0x179684){_0x5b1379=_0x5b1379-0x0;var _0x5b5e78=_0x51ba[_0x5b1379];return _0x5b5e78;};'use strict';var _=require('lodash');var util=require(_0xa51b('0x0'));var moment=require(_0xa51b('0x1'));var BPromise=require(_0xa51b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa51b('0x3'));var db=require(_0xa51b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa51b('0x5'))(_0xa51b('0x6'));var config=require(_0xa51b('0x7'));var jayson=require(_0xa51b('0x8'));var client=jayson[_0xa51b('0x9')][_0xa51b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4add8e,_0x4c9c04,_0x45c79b){return new BPromise(function(_0x4efcbc,_0x26ee93){return client[_0xa51b('0xb')](_0x4add8e,_0x45c79b)[_0xa51b('0xc')](function(_0x27b9b6){logger[_0xa51b('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4c9c04,_0xa51b('0xe'));logger[_0xa51b('0xf')](_0xa51b('0x10'),_0x4c9c04,'request\x20sent',JSON[_0xa51b('0x11')](_0x27b9b6));if(_0x27b9b6[_0xa51b('0x12')]){if(_0x27b9b6['error']['code']===0x1f4){logger[_0xa51b('0x12')](_0xa51b('0x13'),_0x4c9c04,_0x27b9b6[_0xa51b('0x12')]['message']);return _0x26ee93(_0x27b9b6[_0xa51b('0x12')][_0xa51b('0x14')]);}logger[_0xa51b('0x12')](_0xa51b('0x13'),_0x4c9c04,_0x27b9b6[_0xa51b('0x12')][_0xa51b('0x14')]);return _0x4efcbc(_0x27b9b6['error']['message']);}else{logger[_0xa51b('0xd')](_0xa51b('0x13'),_0x4c9c04,_0xa51b('0xe'));_0x4efcbc(_0x27b9b6[_0xa51b('0x15')]['message']);}})['catch'](function(_0x1912e9){logger[_0xa51b('0x12')](_0xa51b('0x13'),_0x4c9c04,_0x1912e9);_0x26ee93(_0x1912e9);});});} \ No newline at end of file +var _0x8cc2=['rpc','jayson/promise','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3c488f,_0x2ba807){var _0x132d22=function(_0x185e43){while(--_0x185e43){_0x3c488f['push'](_0x3c488f['shift']());}};_0x132d22(++_0x2ba807);}(_0x8cc2,0x1d8));var _0x28cc=function(_0x141115,_0x2e7dca){_0x141115=_0x141115-0x0;var _0x320ba9=_0x8cc2[_0x141115];return _0x320ba9;};'use strict';var _=require(_0x28cc('0x0'));var util=require(_0x28cc('0x1'));var moment=require(_0x28cc('0x2'));var BPromise=require(_0x28cc('0x3'));var rs=require(_0x28cc('0x4'));var fs=require('fs');var Redis=require(_0x28cc('0x5'));var db=require(_0x28cc('0x6'))['db'];var utils=require(_0x28cc('0x7'));var logger=require('../../config/logger')(_0x28cc('0x8'));var config=require('../../config/environment');var jayson=require(_0x28cc('0x9'));var client=jayson[_0x28cc('0xa')][_0x28cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ac662,_0x37cc6b,_0x157241){return new BPromise(function(_0x422a95,_0x4f3c7b){return client['request'](_0x1ac662,_0x157241)['then'](function(_0x30a971){logger['info'](_0x28cc('0xc'),_0x37cc6b,_0x28cc('0xd'));logger[_0x28cc('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x37cc6b,_0x28cc('0xd'),JSON[_0x28cc('0xf')](_0x30a971));if(_0x30a971[_0x28cc('0x10')]){if(_0x30a971[_0x28cc('0x10')][_0x28cc('0x11')]===0x1f4){logger[_0x28cc('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x37cc6b,_0x30a971[_0x28cc('0x10')][_0x28cc('0x12')]);return _0x4f3c7b(_0x30a971[_0x28cc('0x10')]['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x37cc6b,_0x30a971['error'][_0x28cc('0x12')]);return _0x422a95(_0x30a971[_0x28cc('0x10')][_0x28cc('0x12')]);}else{logger[_0x28cc('0x13')](_0x28cc('0xc'),_0x37cc6b,_0x28cc('0xd'));_0x422a95(_0x30a971['result'][_0x28cc('0x12')]);}})['catch'](function(_0x32545f){logger['error'](_0x28cc('0xc'),_0x37cc6b,_0x32545f);_0x4f3c7b(_0x32545f);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 18862e7..9499ebb 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 _0xf670=['index','get','/describe','/:id','show','/:id/sections','/:id/resources','getResources','post','/:id/clone','addSections','addResources','update','delete','removeSections','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2547c0,_0x54342d){var _0x6d888e=function(_0x217718){while(--_0x217718){_0x2547c0['push'](_0x2547c0['shift']());}};_0x6d888e(++_0x54342d);}(_0xf670,0x8d));var _0x0f67=function(_0x1dd78b,_0x213fd9){_0x1dd78b=_0x1dd78b-0x0;var _0x2d9bf6=_0xf670[_0x1dd78b];return _0x2d9bf6;};'use strict';var multer=require('multer');var util=require(_0x0f67('0x0'));var path=require(_0x0f67('0x1'));var timeout=require(_0x0f67('0x2'));var express=require(_0x0f67('0x3'));var router=express[_0x0f67('0x4')]();var fs_extra=require(_0x0f67('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0f67('0x6'));var config=require(_0x0f67('0x7'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x0f67('0x8')](),controller[_0x0f67('0x9')]);router[_0x0f67('0xa')](_0x0f67('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0f67('0xa')](_0x0f67('0xc'),auth[_0x0f67('0x8')](),controller[_0x0f67('0xd')]);router[_0x0f67('0xa')](_0x0f67('0xe'),auth[_0x0f67('0x8')](),controller['getSections']);router['get'](_0x0f67('0xf'),auth['isAuthenticated'](),controller[_0x0f67('0x10')]);router['post']('/',auth[_0x0f67('0x8')](),controller['create']);router[_0x0f67('0x11')](_0x0f67('0x12'),auth[_0x0f67('0x8')](),controller['clone']);router[_0x0f67('0x11')](_0x0f67('0xe'),auth[_0x0f67('0x8')](),controller[_0x0f67('0x13')]);router[_0x0f67('0x11')](_0x0f67('0xf'),auth[_0x0f67('0x8')](),controller[_0x0f67('0x14')]);router['put'](_0x0f67('0xc'),auth[_0x0f67('0x8')](),controller[_0x0f67('0x15')]);router[_0x0f67('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x0f67('0x16')]('/:id/sections',auth[_0x0f67('0x8')](),controller[_0x0f67('0x17')]);router[_0x0f67('0x16')](_0x0f67('0xf'),auth[_0x0f67('0x8')](),controller[_0x0f67('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8d29=['update','destroy','delete','/:id/resources','removeResources','exports','express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','/describe','getSections','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','/:id'];(function(_0xa29c6d,_0x355c0f){var _0x477451=function(_0x8c3491){while(--_0x8c3491){_0xa29c6d['push'](_0xa29c6d['shift']());}};_0x477451(++_0x355c0f);}(_0x8d29,0x156));var _0x98d2=function(_0x301fc9,_0x445cb9){_0x301fc9=_0x301fc9-0x0;var _0x395b28=_0x8d29[_0x301fc9];return _0x395b28;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98d2('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98d2('0x1'));var interaction=require(_0x98d2('0x2'));var config=require('../../config/environment');var controller=require(_0x98d2('0x3'));router[_0x98d2('0x4')]('/',auth[_0x98d2('0x5')](),controller['index']);router[_0x98d2('0x4')](_0x98d2('0x6'),auth[_0x98d2('0x5')](),controller['describe']);router[_0x98d2('0x4')]('/:id',auth[_0x98d2('0x5')](),controller['show']);router[_0x98d2('0x4')]('/:id/sections',auth[_0x98d2('0x5')](),controller[_0x98d2('0x7')]);router[_0x98d2('0x4')]('/:id/resources',auth[_0x98d2('0x5')](),controller[_0x98d2('0x8')]);router[_0x98d2('0x9')]('/',auth[_0x98d2('0x5')](),controller[_0x98d2('0xa')]);router[_0x98d2('0x9')](_0x98d2('0xb'),auth['isAuthenticated'](),controller[_0x98d2('0xc')]);router[_0x98d2('0x9')](_0x98d2('0xd'),auth[_0x98d2('0x5')](),controller[_0x98d2('0xe')]);router['post']('/:id/resources',auth[_0x98d2('0x5')](),controller[_0x98d2('0xf')]);router[_0x98d2('0x10')](_0x98d2('0x11'),auth['isAuthenticated'](),controller[_0x98d2('0x12')]);router['delete'](_0x98d2('0x11'),auth['isAuthenticated'](),controller[_0x98d2('0x13')]);router[_0x98d2('0x14')](_0x98d2('0xd'),auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0x98d2('0x15'),auth[_0x98d2('0x5')](),controller[_0x98d2('0x16')]);module[_0x98d2('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7266e70..142681d 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 _0xa407=['setDataValue','crudPermissions','getDataValue','BOOLEAN','sequelize','exports','name','STRING'];(function(_0x2f5cf4,_0x16396d){var _0x418b7f=function(_0x20be99){while(--_0x20be99){_0x2f5cf4['push'](_0x2f5cf4['shift']());}};_0x418b7f(++_0x16396d);}(_0xa407,0xb4));var _0x7a40=function(_0x3bb627,_0xe6ea44){_0x3bb627=_0x3bb627-0x0;var _0x3123f5=_0xa407[_0x3bb627];return _0x3123f5;};'use strict';var Sequelize=require(_0x7a40('0x0'));module[_0x7a40('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7a40('0x2')},'crudPermissions':{'type':Sequelize[_0x7a40('0x3')],'set':function(_0x1696a0){this[_0x7a40('0x4')](_0x7a40('0x5'),_0x1696a0?_0x1696a0['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x7a40('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7a40('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7a40('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7a40('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7a40('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7a40('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xdf60=['STRING','name','setDataValue','crudPermissions','getDataValue','split','BOOLEAN','exports'];(function(_0x4637ba,_0x3a3e88){var _0x281d2f=function(_0x208055){while(--_0x208055){_0x4637ba['push'](_0x4637ba['shift']());}};_0x281d2f(++_0x3a3e88);}(_0xdf60,0x14f));var _0x0df6=function(_0x64642b,_0x11f886){_0x64642b=_0x64642b-0x0;var _0xc515e9=_0xdf60[_0x64642b];return _0xc515e9;};'use strict';var Sequelize=require('sequelize');module[_0x0df6('0x0')]={'name':{'type':Sequelize[_0x0df6('0x1')],'allowNull':![],'unique':_0x0df6('0x2')},'crudPermissions':{'type':Sequelize[_0x0df6('0x1')],'set':function(_0x4a5c59){this[_0x0df6('0x3')](_0x0df6('0x4'),_0x4a5c59?_0x4a5c59['join'](''):[]);},'get':function(){return this[_0x0df6('0x5')]('crudPermissions')?this[_0x0df6('0x5')](_0x0df6('0x4'))[_0x0df6('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0df6('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0df6('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9ee9360..043e99b 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 _0xc23d=['findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','rows','catch','show','params','rawAttributes','find','create','body','clone','include','get','omit','updatedAt','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','transaction','ids','includes','isEmpty','subsections','enabled','push'];(function(_0x3bae51,_0x25e192){var _0xee8c63=function(_0x1e8c1b){while(--_0x1e8c1b){_0x3bae51['push'](_0x3bae51['shift']());}};_0xee8c63(++_0x25e192);}(_0xc23d,0x7f));var _0xdc23=function(_0x4df69e,_0x5131d5){_0x4df69e=_0x4df69e-0x0;var _0x1f9041=_0xc23d[_0x4df69e];return _0x1f9041;};'use strict';var emlformat=require(_0xdc23('0x0'));var rimraf=require(_0xdc23('0x1'));var zipdir=require(_0xdc23('0x2'));var jsonpatch=require(_0xdc23('0x3'));var rp=require(_0xdc23('0x4'));var moment=require(_0xdc23('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc23('0x6'));var util=require(_0xdc23('0x7'));var path=require(_0xdc23('0x8'));var sox=require(_0xdc23('0x9'));var csv=require(_0xdc23('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc23('0xb'));var squel=require('squel');var crypto=require(_0xdc23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdc23('0xd'));var toCsv=require(_0xdc23('0xa'));var querystring=require(_0xdc23('0xe'));var Papa=require(_0xdc23('0xf'));var Redis=require(_0xdc23('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdc23('0x11'));var as=require(_0xdc23('0x12'));var hardwareService=require(_0xdc23('0x13'));var logger=require(_0xdc23('0x14'))(_0xdc23('0x15'));var utils=require(_0xdc23('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdc23('0x17'));var db=require(_0xdc23('0x18'))['db'];config[_0xdc23('0x19')]=_[_0xdc23('0x1a')](config['redis'],{'host':_0xdc23('0x1b'),'port':0x18eb});var socket=require(_0xdc23('0x1c'))(new Redis(config[_0xdc23('0x19')]));require(_0xdc23('0x1d'))[_0xdc23('0x1e')](socket);function respondWithStatusCode(_0xc0f0a2,_0x4908de){_0x4908de=_0x4908de||0xcc;return function(_0x134037){if(_0x134037){return _0xc0f0a2['sendStatus'](_0x4908de);}return _0xc0f0a2[_0xdc23('0x1f')](_0x4908de)[_0xdc23('0x20')]();};}function respondWithResult(_0x2ba40a,_0x5b99f5){_0x5b99f5=_0x5b99f5||0xc8;return function(_0x26573a){if(_0x26573a){return _0x2ba40a[_0xdc23('0x1f')](_0x5b99f5)[_0xdc23('0x21')](_0x26573a);}};}function respondWithFilteredResult(_0x436e4a,_0x4eaad7){return function(_0x258f61){if(_0x258f61){var _0x4472b3=typeof _0x4eaad7[_0xdc23('0x22')]==='undefined'&&typeof _0x4eaad7['limit']===_0xdc23('0x23');var _0x21bd43=_0x258f61[_0xdc23('0x24')];var _0x21ec4a=_0x4472b3?0x0:_0x4eaad7[_0xdc23('0x22')];var _0x3c7d4c=_0x4472b3?_0x258f61[_0xdc23('0x24')]:_0x4eaad7['offset']+_0x4eaad7[_0xdc23('0x25')];var _0x535926;if(_0x3c7d4c>=_0x21bd43){_0x3c7d4c=_0x21bd43;_0x535926=0xc8;}else{_0x535926=0xce;}_0x436e4a[_0xdc23('0x1f')](_0x535926);return _0x436e4a[_0xdc23('0x26')](_0xdc23('0x27'),_0x21ec4a+'-'+_0x3c7d4c+'/'+_0x21bd43)[_0xdc23('0x21')](_0x258f61);}return null;};}function patchUpdates(_0x42c77e){return function(_0x5f02cb){try{jsonpatch['apply'](_0x5f02cb,_0x42c77e,!![]);}catch(_0x4e8054){return BPromise[_0xdc23('0x28')](_0x4e8054);}return _0x5f02cb[_0xdc23('0x29')]();};}function saveUpdates(_0x276fb4,_0x163700){return function(_0xa5abb3){if(_0xa5abb3){return _0xa5abb3[_0xdc23('0x2a')](_0x276fb4)[_0xdc23('0x2b')](function(_0x26e4ed){return _0x26e4ed;});}return null;};}function removeEntity(_0x168411,_0x210237){return function(_0x4696bb){if(_0x4696bb){return _0x4696bb['destroy']()[_0xdc23('0x2b')](function(){_0x168411['status'](0xcc)[_0xdc23('0x20')]();});}};}function handleEntityNotFound(_0x2545b4,_0x37871){return function(_0x3c0647){if(!_0x3c0647){_0x2545b4[_0xdc23('0x2c')](0x194);}return _0x3c0647;};}function handleError(_0xb932ff,_0x2fe0a4){_0x2fe0a4=_0x2fe0a4||0x1f4;return function(_0x553f03){logger[_0xdc23('0x2d')](_0x553f03[_0xdc23('0x2e')]);if(_0x553f03['name']){delete _0x553f03[_0xdc23('0x2f')];}_0xb932ff[_0xdc23('0x1f')](_0x2fe0a4)[_0xdc23('0x30')](_0x553f03);};}exports[_0xdc23('0x31')]=function(_0xafd0e1,_0x2337f3){var _0x43e483={},_0x40becf={},_0xc20b91={'count':0x0,'rows':[]};var _0x501c9a=_[_0xdc23('0x32')](db['UserProfile']['rawAttributes'],function(_0x1c13b8){return{'name':_0x1c13b8[_0xdc23('0x33')],'type':_0x1c13b8[_0xdc23('0x34')]['key']};});_0x40becf[_0xdc23('0x35')]=_[_0xdc23('0x32')](_0x501c9a,'name');_0x40becf[_0xdc23('0x36')]=_[_0xdc23('0x37')](_0xafd0e1[_0xdc23('0x36')]);_0x40becf[_0xdc23('0x38')]=_['intersection'](_0x40becf[_0xdc23('0x35')],_0x40becf[_0xdc23('0x36')]);_0x43e483['attributes']=_[_0xdc23('0x39')](_0x40becf[_0xdc23('0x35')],qs[_0xdc23('0x3a')](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x3a')]));_0x43e483[_0xdc23('0x3b')]=_0x43e483[_0xdc23('0x3b')][_0xdc23('0x3c')]?_0x43e483[_0xdc23('0x3b')]:_0x40becf[_0xdc23('0x35')];if(!_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x3d')]('nolimit')){_0x43e483[_0xdc23('0x25')]=qs['limit'](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x25')]);_0x43e483[_0xdc23('0x22')]=qs[_0xdc23('0x22')](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x22')]);}_0x43e483[_0xdc23('0x3e')]=qs[_0xdc23('0x3f')](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x3f')]);_0x43e483[_0xdc23('0x40')]=qs['filters'](_[_0xdc23('0x41')](_0xafd0e1[_0xdc23('0x36')],_0x40becf[_0xdc23('0x38')]),_0x501c9a);if(_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x42')]){_0x43e483[_0xdc23('0x40')]=_[_0xdc23('0x43')](_0x43e483['where'],{'$or':_[_0xdc23('0x32')](_0x501c9a,function(_0x213062){if(_0x213062[_0xdc23('0x34')]!==_0xdc23('0x44')){var _0x36d4ef={};_0x36d4ef[_0x213062[_0xdc23('0x2f')]]={'$like':'%'+_0xafd0e1[_0xdc23('0x36')]['filter']+'%'};return _0x36d4ef;}})});}_0x43e483=_['merge']({},_0x43e483,_0xafd0e1[_0xdc23('0x45')]);var _0x46d2e3={'where':_0x43e483['where']};return db[_0xdc23('0x46')][_0xdc23('0x24')](_0x46d2e3)[_0xdc23('0x2b')](function(_0x366e77){_0xc20b91['count']=_0x366e77;if(_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x47')]){_0x43e483['include']=[{'all':!![]}];}return db[_0xdc23('0x46')]['findAll'](_0x43e483);})[_0xdc23('0x2b')](function(_0x597373){_0xc20b91[_0xdc23('0x48')]=_0x597373;return _0xc20b91;})[_0xdc23('0x2b')](respondWithFilteredResult(_0x2337f3,_0x43e483))[_0xdc23('0x49')](handleError(_0x2337f3,null));};exports[_0xdc23('0x4a')]=function(_0x20a49c,_0x218e67){var _0x352152={'raw':![],'where':{'id':_0x20a49c[_0xdc23('0x4b')]['id']}},_0x4cf525={};_0x4cf525['model']=_[_0xdc23('0x37')](db[_0xdc23('0x46')][_0xdc23('0x4c')]);_0x4cf525[_0xdc23('0x36')]=_[_0xdc23('0x37')](_0x20a49c[_0xdc23('0x36')]);_0x4cf525[_0xdc23('0x38')]=_['intersection'](_0x4cf525['model'],_0x4cf525[_0xdc23('0x36')]);_0x352152[_0xdc23('0x3b')]=_[_0xdc23('0x39')](_0x4cf525['model'],qs[_0xdc23('0x3a')](_0x20a49c[_0xdc23('0x36')][_0xdc23('0x3a')]));_0x352152[_0xdc23('0x3b')]=_0x352152[_0xdc23('0x3b')][_0xdc23('0x3c')]?_0x352152['attributes']:_0x4cf525[_0xdc23('0x35')];if(_0x20a49c['query'][_0xdc23('0x47')]){_0x352152['include']=[{'all':!![]}];}_0x352152=_[_0xdc23('0x43')]({},_0x352152,_0x20a49c[_0xdc23('0x45')]);return db[_0xdc23('0x46')][_0xdc23('0x4d')](_0x352152)[_0xdc23('0x2b')](handleEntityNotFound(_0x218e67,null))[_0xdc23('0x2b')](respondWithResult(_0x218e67,null))[_0xdc23('0x49')](handleError(_0x218e67,null));};exports[_0xdc23('0x4e')]=function(_0x46aff9,_0x3f81f0){return db[_0xdc23('0x46')]['create'](_0x46aff9[_0xdc23('0x4f')],{})['then'](respondWithResult(_0x3f81f0,0xc9))[_0xdc23('0x49')](handleError(_0x3f81f0,null));};exports[_0xdc23('0x50')]=function(_0x48eab5,_0x27f9e4){var _0x13354f={'where':{'id':_0x48eab5[_0xdc23('0x4b')]['id']}},_0x4325c7={};_0x4325c7['model']=_[_0xdc23('0x37')](db['UserProfile'][_0xdc23('0x4c')]);_0x13354f[_0xdc23('0x3b')]=_[_0xdc23('0x39')](_0x4325c7[_0xdc23('0x35')],qs[_0xdc23('0x3a')](_0x48eab5[_0xdc23('0x36')][_0xdc23('0x3a')]));_0x13354f[_0xdc23('0x3b')]=_0x13354f[_0xdc23('0x3b')][_0xdc23('0x3c')]?_0x13354f['attributes']:_0x4325c7['model'];if(_0x48eab5['query'][_0xdc23('0x47')]){_0x13354f[_0xdc23('0x51')]=[{'all':!![]}];}_0x13354f=_[_0xdc23('0x43')]({},_0x13354f,_0x48eab5['options']);return db['UserProfile'][_0xdc23('0x4d')](_0x13354f)[_0xdc23('0x2b')](handleEntityNotFound(_0x27f9e4,null))[_0xdc23('0x2b')](function(_0x248f66){if(_0x248f66){var _0x2589d5=_0x248f66[_0xdc23('0x52')]({'plain':!![]});_0x2589d5=qs[_0xdc23('0x53')](_0x2589d5,['id','createdAt',_0xdc23('0x54'),'crudPermissions']);_0x48eab5[_0xdc23('0x4f')]=_[_0xdc23('0x53')](_0x48eab5[_0xdc23('0x4f')],['id',_0xdc23('0x55'),'updatedAt']);return db[_0xdc23('0x56')]['transaction'](function(_0x1adefd){return db['UserProfile'][_0xdc23('0x4e')](_[_0xdc23('0x43')](_0x2589d5,_0x48eab5['body']),{'include':_0x48eab5[_0xdc23('0x36')][_0xdc23('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x1adefd})[_0xdc23('0x2b')](function(_0x2d2fdf){var _0x5b7fb3=_0x2d2fdf[_0xdc23('0x52')]({'plain':!![]});return db[_0xdc23('0x57')][_0xdc23('0x58')]({'where':{'userProfileId':_0x48eab5[_0xdc23('0x4b')]['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x42cde4){if(_0x42cde4){return BPromise[_0xdc23('0x59')](_0x42cde4,function(_0x6e8494){return new BPromise(function(_0x3b6c2e,_0x45998d){if(_0x6e8494[_0xdc23('0x5a')]===null||_0x6e8494[_0xdc23('0x5a')]===0x1)_0x3b6c2e(null);return db[_0xdc23('0x5b')][_0xdc23('0x58')]({'where':{'sectionId':_0x6e8494['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x276647){var _0xfc9f53=_[_0xdc23('0x32')](_0x276647,function(_0x5dfb7b){return qs[_0xdc23('0x53')](_0x5dfb7b,['id',_0xdc23('0x55'),_0xdc23('0x54'),_0xdc23('0x5c')]);});_0x3b6c2e(_0xfc9f53);})[_0xdc23('0x49')](function(_0x561fc1){_0x45998d(_0x561fc1);});})[_0xdc23('0x2b')](function(_0x357e36){var _0xcd03b3=qs[_0xdc23('0x53')](_0x6e8494,['id',_0xdc23('0x55'),_0xdc23('0x54')]);_0xcd03b3[_0xdc23('0x5d')]=_0x5b7fb3['id'];if(_0x357e36)_0xcd03b3[_0xdc23('0x5e')]=_0x357e36;return _0xcd03b3;})['then'](function(_0x352a65){return db[_0xdc23('0x57')][_0xdc23('0x4e')](_0x352a65,{'include':[{'model':db[_0xdc23('0x5b')],'as':_0xdc23('0x5e')}],'raw':!![],'transaction':_0x1adefd});});})[_0xdc23('0x2b')](function(){return _0x5b7fb3;});}});});});}})[_0xdc23('0x2b')](respondWithResult(_0x27f9e4,0xc9))['catch'](handleError(_0x27f9e4,null));};exports[_0xdc23('0x2a')]=function(_0x43e081,_0x4cc5c4){if(_0x43e081[_0xdc23('0x4f')]['id']){delete _0x43e081[_0xdc23('0x4f')]['id'];}return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x43e081[_0xdc23('0x4b')]['id']}})[_0xdc23('0x2b')](handleEntityNotFound(_0x4cc5c4,null))[_0xdc23('0x2b')](saveUpdates(_0x43e081[_0xdc23('0x4f')],null))[_0xdc23('0x2b')](respondWithResult(_0x4cc5c4,null))['catch'](handleError(_0x4cc5c4,null));};exports[_0xdc23('0x5f')]=function(_0x2c3ddf,_0x2fe1fc){return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x2c3ddf[_0xdc23('0x4b')]['id']}})[_0xdc23('0x2b')](handleEntityNotFound(_0x2fe1fc,null))['then'](removeEntity(_0x2fe1fc,null))[_0xdc23('0x49')](handleError(_0x2fe1fc,null));};exports[_0xdc23('0x60')]=function(_0x55435a,_0x3b5ae1){return db[_0xdc23('0x46')][_0xdc23('0x60')]()['then'](respondWithResult(_0x3b5ae1,null))['catch'](handleError(_0x3b5ae1,null));};exports[_0xdc23('0x61')]=function(_0x94091f,_0xaf561e){var _0x59765b=_0x94091f['body'];return db['UserProfile'][_0xdc23('0x4d')]({'where':{'id':_0x94091f['params']['id']}})[_0xdc23('0x2b')](handleEntityNotFound(_0xaf561e,null))['then'](function(_0x35984d){if(_0x35984d){return db['sequelize'][_0xdc23('0x62')](function(_0x3dfe60){return db[_0xdc23('0x57')][_0xdc23('0x5f')]({'where':{'userProfileId':_0x94091f[_0xdc23('0x4b')]['id'],'sectionId':_[_0xdc23('0x32')](_0x59765b,function(_0x2c5219){return _0x2c5219['sectionId'];})},'transaction':_0x3dfe60})[_0xdc23('0x2b')](function(){var _0x569a27=_[_0xdc23('0x32')](_0x59765b,function(_0x38c3df){_0x38c3df['userProfileId']=_0x94091f[_0xdc23('0x4b')]['id'];return _0x38c3df;});var _0x35a088=[];return BPromise[_0xdc23('0x59')](_0x569a27,function(_0x518b72){return db[_0xdc23('0x57')][_0xdc23('0x4e')](_0x518b72,{'include':[{'model':db[_0xdc23('0x5b')],'as':_0xdc23('0x5e')}],'raw':!![],'transaction':_0x3dfe60})[_0xdc23('0x2b')](function(_0x447852){_0x35a088['push'](_0x447852[_0xdc23('0x52')]({'plain':!![]}));});})['then'](function(){return _0x35a088;});});});}})['then'](function(_0x115645){return _0x115645;})['then'](respondWithResult(_0xaf561e,null))[_0xdc23('0x49')](handleError(_0xaf561e,null));};exports['removeSections']=function(_0x1f6290,_0x21f2b2){var _0x2f171c;return db['UserProfile'][_0xdc23('0x4d')]({'where':{'id':_0x1f6290[_0xdc23('0x4b')]['id']},'attributes':['id',_0xdc23('0x2f')]})[_0xdc23('0x2b')](handleEntityNotFound(_0x21f2b2,null))['then'](function(_0x42cd80){if(_0x42cd80){_0x2f171c=_0x42cd80;return db[_0xdc23('0x57')]['destroy']({'where':{'userProfileId':_0x1f6290[_0xdc23('0x4b')]['id'],'sectionId':_0x1f6290[_0xdc23('0x36')][_0xdc23('0x63')]}});}})[_0xdc23('0x2b')](function(){return _0x2f171c;})['then'](respondWithStatusCode(_0x21f2b2,null))[_0xdc23('0x49')](handleError(_0x21f2b2,null));};exports['getSections']=function(_0x259351,_0x2e8d1a){var _0x598f79=[];var _0x35666c=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x259351[_0xdc23('0x4b')]['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x23d471){_0x598f79=_['filter'](_0x23d471,function(_0x4d52c3){return _0x4d52c3['enabled']===0x1||_[_0xdc23('0x64')]([0x3eb,0x709],_0x4d52c3['sectionId']);});if(!_[_0xdc23('0x65')](_0x598f79)){return _[_0xdc23('0x32')](_0x598f79,function(_0x4dddc7){return _0x4dddc7[_0xdc23('0x5c')];});}else{return;}})['then'](function(_0x9c0ea7){if(_0x9c0ea7)_0x35666c=_0x9c0ea7;if(_[_0xdc23('0x64')](_0x35666c,0x64)){var _0x43fbb6=_[_0xdc23('0x4d')](_0x598f79,{'sectionId':0x64});return hasDefaultDashboard(_0x43fbb6)['then'](function(_0x42efb3){return _['map'](_0x598f79,function(_0x36f4ba){if(_0x36f4ba[_0xdc23('0x5c')]===0x64){_0x36f4ba[_0xdc23('0x66')]=_0x42efb3;}return _0x36f4ba;});});}else{return;}})[_0xdc23('0x2b')](function(_0x4b235a){if(_0x4b235a)_0x598f79=_0x4b235a;if(_[_0xdc23('0x64')](_0x35666c,0x3eb)){var _0x1f10e7=_[_0xdc23('0x4d')](_0x598f79,{'sectionId':0x3eb});return getCustomDashboards(_0x1f10e7)[_0xdc23('0x2b')](function(_0x853e90){return _[_0xdc23('0x32')](_0x598f79,function(_0x3b4397){if(_0x1f10e7[_0xdc23('0x67')]){if(_0x3b4397[_0xdc23('0x5c')]===0x3eb){_0x3b4397[_0xdc23('0x66')]=_0x853e90;}}else{if(_0x3b4397[_0xdc23('0x5c')]===0x64){_0x3b4397[_0xdc23('0x66')]=_0x853e90;}}return _0x3b4397;});});}else{return;}})[_0xdc23('0x2b')](function(_0x4cff40){if(_0x4cff40)_0x598f79=_0x4cff40;if(_[_0xdc23('0x64')](_0x35666c,0x709)){var _0x536a34=_[_0xdc23('0x4d')](_0x598f79,{'sectionId':0x709});return getPlugins(_0x536a34)[_0xdc23('0x2b')](function(_0x1c4866){if(_0x536a34[_0xdc23('0x67')]){return _[_0xdc23('0x32')](_0x598f79,function(_0xb9f0a7){if(_0xb9f0a7[_0xdc23('0x5c')]===0x709){_0xb9f0a7[_0xdc23('0x66')]=_0x1c4866;}return _0xb9f0a7;});}else{var _0xccc938={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1c4866};var _0x1e9df3=_[_0xdc23('0x32')](_0x598f79);_0x1e9df3[_0xdc23('0x68')](_0xccc938);return _0x1e9df3;}});}else{return;}})[_0xdc23('0x2b')](function(_0x43bf95){if(_0x43bf95)_0x598f79=_0x43bf95;return _[_0xdc23('0x42')](_0x598f79,[_0xdc23('0x67'),0x1]);})[_0xdc23('0x2b')](respondWithResult(_0x2e8d1a,null))[_0xdc23('0x49')](handleError(_0x2e8d1a,null));};function hasDefaultDashboard(_0x3fac1d){var _0x573a93=[0x65];return new BPromise(function(_0x5e6ca3,_0x57d785){try{if(_0x3fac1d[_0xdc23('0x5a')]){_0x5e6ca3(_0x573a93);}else{return db['UserProfileResource'][_0xdc23('0x69')]({'where':{'sectionId':_0x3fac1d['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x247dac){_0x247dac?_0x5e6ca3(_0x573a93):_0x5e6ca3();});}}catch(_0x54b2e1){_0x57d785(_0x54b2e1);}});}function getCustomDashboards(_0x1ca3da){var _0x4961c3=[];return new BPromise(function(_0x12e35e,_0x218a9c){try{if(_0x1ca3da[_0xdc23('0x5a')]){return db[_0xdc23('0x6a')]['findAll']({'raw':!![]})[_0xdc23('0x2b')](function(_0x4a45a9){_0x4a45a9[_0xdc23('0x6b')](function(_0x2349f2){_0x4961c3[_0xdc23('0x68')](_0x2349f2['id']+0x1869f);});_0x12e35e(_0x4961c3);});}else{return db[_0xdc23('0x5b')][_0xdc23('0x58')]({'where':{'sectionId':_0x1ca3da['id']},'raw':!![]})['then'](function(_0x3b796b){_0x3b796b[_0xdc23('0x6b')](function(_0x3c62b9){_0x4961c3[_0xdc23('0x68')](_0x3c62b9[_0xdc23('0x6c')]+0x1869f);});_0x12e35e(_0x4961c3);});}}catch(_0x2cd80d){_0x218a9c(_0x2cd80d);}});}function getPlugins(_0x221588){var _0x313dab=[];return new BPromise(function(_0x197fc2,_0x1fcb6e){try{if(_0x221588[_0xdc23('0x5a')]){return db['Plugin'][_0xdc23('0x58')]({'raw':!![]})['then'](function(_0x4ab16f){_0x4ab16f[_0xdc23('0x6b')](function(_0xa0a893){_0x313dab[_0xdc23('0x68')](_0xa0a893['id']+0x15b38);});_0x197fc2(_0x313dab);});}else{return db[_0xdc23('0x5b')][_0xdc23('0x58')]({'where':{'sectionId':_0x221588['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x5dcb90){_0x5dcb90[_0xdc23('0x6b')](function(_0x3941be){_0x313dab[_0xdc23('0x68')](_0x3941be[_0xdc23('0x6c')]+0x15b38);});_0x197fc2(_0x313dab);});}}catch(_0x4e3615){_0x1fcb6e(_0x4e3615);}});}exports[_0xdc23('0x6d')]=function(_0x335aba,_0x326f4e){return db[_0xdc23('0x46')]['find']({'where':{'id':_0x335aba[_0xdc23('0x4b')]['id']}})['then'](handleEntityNotFound(_0x326f4e,null))[_0xdc23('0x2b')](function(_0x3c1d68){if(_0x3c1d68){return db[_0xdc23('0x56')][_0xdc23('0x62')](function(_0x5d8f79){return db[_0xdc23('0x57')][_0xdc23('0x58')]({'where':{'userProfileId':_0x335aba[_0xdc23('0x4b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x59e71f){if(_0x59e71f){return db['UserProfileSection'][_0xdc23('0x5f')]({'where':{'userProfileId':_0x335aba[_0xdc23('0x4b')]['id'],'id':_[_0xdc23('0x32')](_0x59e71f,function(_0x832f6b){return _0x832f6b['id'];})},'transaction':_0x5d8f79});}})[_0xdc23('0x2b')](function(_0x32e27c){var _0x380cb0=_[_0xdc23('0x32')](_0x335aba[_0xdc23('0x4f')],function(_0x352df6){_0x352df6[_0xdc23('0x5d')]=_0x335aba[_0xdc23('0x4b')]['id'];return _0x352df6;});return db[_0xdc23('0x57')][_0xdc23('0x6e')](_0x380cb0,{'raw':!![],'transaction':_0x5d8f79});})[_0xdc23('0x2b')](function(_0xf84e04){var _0x3700d6=_[_0xdc23('0x42')](_[_0xdc23('0x32')](_0xf84e04,function(_0x2ed997){return _0x2ed997[_0xdc23('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x3700d6){return db[_0xdc23('0x57')][_0xdc23('0x58')]({'where':{'userProfileId':_0x335aba['params']['id'],'sectionId':_[_0xdc23('0x32')](_0x3700d6,function(_0x3d10b5){return _0x3d10b5['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xdc23('0x2b')](function(_0x4acb83){var _0x3a1bf1=_[_0xdc23('0x32')](_0x335aba[_0xdc23('0x4f')],function(_0x25226a){_0x25226a[_0xdc23('0x5d')]=_0x335aba['params']['id'];return _0x25226a;});return db[_0xdc23('0x5b')][_0xdc23('0x6e')](_0x3a1bf1,{'raw':!![],'transaction':_0x5d8f79});});}})[_0xdc23('0x49')](handleError(_0x326f4e,null));});}})[_0xdc23('0x2b')](function(_0x2c1f65){var _0x23ea54=_[_0xdc23('0x32')](_0x2c1f65,function(_0x21f453){return _0x21f453[_0xdc23('0x52')]({'plain':!![]});});})['then'](respondWithResult(_0x326f4e,null))['catch'](handleError(_0x326f4e,null));};exports[_0xdc23('0x6f')]=function(_0x3917f3,_0x11b347,_0x462038){return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x3917f3[_0xdc23('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11b347,null))[_0xdc23('0x2b')](function(_0x56f142){if(_0x56f142){return _0x56f142[_0xdc23('0x6f')](_0x3917f3[_0xdc23('0x36')][_0xdc23('0x63')]);}})[_0xdc23('0x2b')](respondWithStatusCode(_0x11b347,null))[_0xdc23('0x49')](handleError(_0x11b347,null));};exports[_0xdc23('0x70')]=function(_0x54f54f,_0x4f250c){var _0x443938={};if(!_0x54f54f['query']['section'])throw new Error(_0xdc23('0x71'));if(!_0x54f54f[_0xdc23('0x36')][_0xdc23('0x3d')](_0xdc23('0x72'))){_0x443938[_0xdc23('0x25')]=qs[_0xdc23('0x25')](_0x54f54f['query']['limit']);_0x443938[_0xdc23('0x22')]=qs[_0xdc23('0x22')](_0x54f54f[_0xdc23('0x36')]['offset']);}return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x54f54f[_0xdc23('0x4b')]['id']}})[_0xdc23('0x2b')](function(_0x5d2342){if(!_0x5d2342)throw new Error(_0xdc23('0x73')+_0x54f54f[_0xdc23('0x4b')]['id']);return db[_0xdc23('0x46')][_0xdc23('0x70')](_0x54f54f);})[_0xdc23('0x2b')](respondWithFilteredResult(_0x4f250c,_0x443938))[_0xdc23('0x49')](handleError(_0x4f250c,null));}; \ No newline at end of file +var _0x1410=['send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','then','catch','show','params','includeAll','include','find','create','body','get','omit','createdAt','crudPermissions','updatedAt','transaction','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','UserProfileSection','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./userProfile.socket','register','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','error','stack','name'];(function(_0x1ee43f,_0x4686d8){var _0x1cb212=function(_0x3a8bc6){while(--_0x3a8bc6){_0x1ee43f['push'](_0x1ee43f['shift']());}};_0x1cb212(++_0x4686d8);}(_0x1410,0x130));var _0x0141=function(_0x26f2d4,_0x1252ea){_0x26f2d4=_0x26f2d4-0x0;var _0x3298a0=_0x1410[_0x26f2d4];return _0x3298a0;};'use strict';var emlformat=require(_0x0141('0x0'));var rimraf=require(_0x0141('0x1'));var zipdir=require(_0x0141('0x2'));var jsonpatch=require(_0x0141('0x3'));var rp=require('request-promise');var moment=require(_0x0141('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0141('0x5'));var util=require('util');var path=require(_0x0141('0x6'));var sox=require(_0x0141('0x7'));var csv=require(_0x0141('0x8'));var ejs=require(_0x0141('0x9'));var fs=require('fs');var fs_extra=require(_0x0141('0xa'));var _=require(_0x0141('0xb'));var squel=require(_0x0141('0xc'));var crypto=require(_0x0141('0xd'));var jsforce=require(_0x0141('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0141('0x8'));var querystring=require(_0x0141('0xf'));var Papa=require(_0x0141('0x10'));var Redis=require(_0x0141('0x11'));var authService=require(_0x0141('0x12'));var qs=require(_0x0141('0x13'));var as=require(_0x0141('0x14'));var hardwareService=require(_0x0141('0x15'));var logger=require('../../config/logger')(_0x0141('0x16'));var utils=require(_0x0141('0x17'));var config=require(_0x0141('0x18'));var licenseUtil=require(_0x0141('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0141('0x1a')](config[_0x0141('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0141('0x1c'))(new Redis(config[_0x0141('0x1b')]));require(_0x0141('0x1d'))[_0x0141('0x1e')](socket);function respondWithStatusCode(_0x1665e2,_0x51a855){_0x51a855=_0x51a855||0xcc;return function(_0x12f234){if(_0x12f234){return _0x1665e2['sendStatus'](_0x51a855);}return _0x1665e2[_0x0141('0x1f')](_0x51a855)[_0x0141('0x20')]();};}function respondWithResult(_0x345fbd,_0x310e2b){_0x310e2b=_0x310e2b||0xc8;return function(_0x3bf5b4){if(_0x3bf5b4){return _0x345fbd[_0x0141('0x1f')](_0x310e2b)['json'](_0x3bf5b4);}};}function respondWithFilteredResult(_0x58c3bb,_0x1b48c7){return function(_0x3720f6){if(_0x3720f6){var _0x4f9945=typeof _0x1b48c7[_0x0141('0x21')]===_0x0141('0x22')&&typeof _0x1b48c7[_0x0141('0x23')]===_0x0141('0x22');var _0x5427b5=_0x3720f6[_0x0141('0x24')];var _0x5bf2e8=_0x4f9945?0x0:_0x1b48c7['offset'];var _0x853d4d=_0x4f9945?_0x3720f6[_0x0141('0x24')]:_0x1b48c7[_0x0141('0x21')]+_0x1b48c7[_0x0141('0x23')];var _0x316f70;if(_0x853d4d>=_0x5427b5){_0x853d4d=_0x5427b5;_0x316f70=0xc8;}else{_0x316f70=0xce;}_0x58c3bb[_0x0141('0x1f')](_0x316f70);return _0x58c3bb['set'](_0x0141('0x25'),_0x5bf2e8+'-'+_0x853d4d+'/'+_0x5427b5)[_0x0141('0x26')](_0x3720f6);}return null;};}function patchUpdates(_0x363860){return function(_0x239ea2){try{jsonpatch[_0x0141('0x27')](_0x239ea2,_0x363860,!![]);}catch(_0x1a4b0b){return BPromise[_0x0141('0x28')](_0x1a4b0b);}return _0x239ea2[_0x0141('0x29')]();};}function saveUpdates(_0x12a11e,_0x3869b7){return function(_0x43b105){if(_0x43b105){return _0x43b105[_0x0141('0x2a')](_0x12a11e)['then'](function(_0x4247d){return _0x4247d;});}return null;};}function removeEntity(_0x14ecbf,_0xb80072){return function(_0x3e242c){if(_0x3e242c){return _0x3e242c[_0x0141('0x2b')]()['then'](function(){_0x14ecbf[_0x0141('0x1f')](0xcc)[_0x0141('0x20')]();});}};}function handleEntityNotFound(_0x2bb7c4,_0x4a82a6){return function(_0x29bec2){if(!_0x29bec2){_0x2bb7c4['sendStatus'](0x194);}return _0x29bec2;};}function handleError(_0x15a81e,_0x13d8d1){_0x13d8d1=_0x13d8d1||0x1f4;return function(_0x400602){logger[_0x0141('0x2c')](_0x400602[_0x0141('0x2d')]);if(_0x400602[_0x0141('0x2e')]){delete _0x400602[_0x0141('0x2e')];}_0x15a81e[_0x0141('0x1f')](_0x13d8d1)[_0x0141('0x2f')](_0x400602);};}exports[_0x0141('0x30')]=function(_0x32ce7e,_0x36c409){var _0x19f25f={},_0x48e025={},_0x4201ae={'count':0x0,'rows':[]};var _0x555294=_[_0x0141('0x31')](db[_0x0141('0x32')][_0x0141('0x33')],function(_0xb17adc){return{'name':_0xb17adc[_0x0141('0x34')],'type':_0xb17adc[_0x0141('0x35')]['key']};});_0x48e025[_0x0141('0x36')]=_['map'](_0x555294,_0x0141('0x2e'));_0x48e025[_0x0141('0x37')]=_[_0x0141('0x38')](_0x32ce7e['query']);_0x48e025[_0x0141('0x39')]=_[_0x0141('0x3a')](_0x48e025['model'],_0x48e025[_0x0141('0x37')]);_0x19f25f[_0x0141('0x3b')]=_[_0x0141('0x3a')](_0x48e025[_0x0141('0x36')],qs[_0x0141('0x3c')](_0x32ce7e['query'][_0x0141('0x3c')]));_0x19f25f[_0x0141('0x3b')]=_0x19f25f[_0x0141('0x3b')][_0x0141('0x3d')]?_0x19f25f[_0x0141('0x3b')]:_0x48e025[_0x0141('0x36')];if(!_0x32ce7e['query']['hasOwnProperty'](_0x0141('0x3e'))){_0x19f25f[_0x0141('0x23')]=qs['limit'](_0x32ce7e[_0x0141('0x37')][_0x0141('0x23')]);_0x19f25f[_0x0141('0x21')]=qs['offset'](_0x32ce7e['query']['offset']);}_0x19f25f[_0x0141('0x3f')]=qs[_0x0141('0x40')](_0x32ce7e[_0x0141('0x37')][_0x0141('0x40')]);_0x19f25f[_0x0141('0x41')]=qs[_0x0141('0x39')](_[_0x0141('0x42')](_0x32ce7e['query'],_0x48e025[_0x0141('0x39')]),_0x555294);if(_0x32ce7e[_0x0141('0x37')]['filter']){_0x19f25f[_0x0141('0x41')]=_[_0x0141('0x43')](_0x19f25f[_0x0141('0x41')],{'$or':_[_0x0141('0x31')](_0x555294,function(_0x1a4aa0){if(_0x1a4aa0[_0x0141('0x35')]!==_0x0141('0x44')){var _0x449505={};_0x449505[_0x1a4aa0['name']]={'$like':'%'+_0x32ce7e[_0x0141('0x37')][_0x0141('0x45')]+'%'};return _0x449505;}})});}_0x19f25f=_['merge']({},_0x19f25f,_0x32ce7e[_0x0141('0x46')]);var _0x21baeb={'where':_0x19f25f[_0x0141('0x41')]};return db[_0x0141('0x32')][_0x0141('0x24')](_0x21baeb)['then'](function(_0x1746a1){_0x4201ae['count']=_0x1746a1;if(_0x32ce7e[_0x0141('0x37')]['includeAll']){_0x19f25f['include']=[{'all':!![]}];}return db['UserProfile'][_0x0141('0x47')](_0x19f25f);})[_0x0141('0x48')](function(_0x210a8c){_0x4201ae['rows']=_0x210a8c;return _0x4201ae;})[_0x0141('0x48')](respondWithFilteredResult(_0x36c409,_0x19f25f))[_0x0141('0x49')](handleError(_0x36c409,null));};exports[_0x0141('0x4a')]=function(_0x51de8f,_0x4c64bf){var _0x3caba9={'raw':![],'where':{'id':_0x51de8f[_0x0141('0x4b')]['id']}},_0x268d2a={};_0x268d2a[_0x0141('0x36')]=_[_0x0141('0x38')](db[_0x0141('0x32')][_0x0141('0x33')]);_0x268d2a[_0x0141('0x37')]=_['keys'](_0x51de8f[_0x0141('0x37')]);_0x268d2a[_0x0141('0x39')]=_[_0x0141('0x3a')](_0x268d2a['model'],_0x268d2a[_0x0141('0x37')]);_0x3caba9[_0x0141('0x3b')]=_[_0x0141('0x3a')](_0x268d2a['model'],qs[_0x0141('0x3c')](_0x51de8f['query'][_0x0141('0x3c')]));_0x3caba9['attributes']=_0x3caba9[_0x0141('0x3b')]['length']?_0x3caba9[_0x0141('0x3b')]:_0x268d2a[_0x0141('0x36')];if(_0x51de8f[_0x0141('0x37')][_0x0141('0x4c')]){_0x3caba9[_0x0141('0x4d')]=[{'all':!![]}];}_0x3caba9=_['merge']({},_0x3caba9,_0x51de8f[_0x0141('0x46')]);return db[_0x0141('0x32')][_0x0141('0x4e')](_0x3caba9)['then'](handleEntityNotFound(_0x4c64bf,null))[_0x0141('0x48')](respondWithResult(_0x4c64bf,null))[_0x0141('0x49')](handleError(_0x4c64bf,null));};exports[_0x0141('0x4f')]=function(_0x4978a3,_0x3e30a8){return db['UserProfile'][_0x0141('0x4f')](_0x4978a3[_0x0141('0x50')],{})[_0x0141('0x48')](respondWithResult(_0x3e30a8,0xc9))[_0x0141('0x49')](handleError(_0x3e30a8,null));};exports['clone']=function(_0x28d638,_0x170969){var _0x3abf41={'where':{'id':_0x28d638[_0x0141('0x4b')]['id']}},_0x20260c={};_0x20260c[_0x0141('0x36')]=_[_0x0141('0x38')](db['UserProfile'][_0x0141('0x33')]);_0x3abf41[_0x0141('0x3b')]=_[_0x0141('0x3a')](_0x20260c['model'],qs[_0x0141('0x3c')](_0x28d638[_0x0141('0x37')][_0x0141('0x3c')]));_0x3abf41['attributes']=_0x3abf41[_0x0141('0x3b')]['length']?_0x3abf41[_0x0141('0x3b')]:_0x20260c[_0x0141('0x36')];if(_0x28d638[_0x0141('0x37')][_0x0141('0x4c')]){_0x3abf41[_0x0141('0x4d')]=[{'all':!![]}];}_0x3abf41=_[_0x0141('0x43')]({},_0x3abf41,_0x28d638[_0x0141('0x46')]);return db[_0x0141('0x32')][_0x0141('0x4e')](_0x3abf41)[_0x0141('0x48')](handleEntityNotFound(_0x170969,null))[_0x0141('0x48')](function(_0x53b31f){if(_0x53b31f){var _0x47100e=_0x53b31f[_0x0141('0x51')]({'plain':!![]});_0x47100e=qs[_0x0141('0x52')](_0x47100e,['id',_0x0141('0x53'),'updatedAt',_0x0141('0x54')]);_0x28d638[_0x0141('0x50')]=_[_0x0141('0x52')](_0x28d638[_0x0141('0x50')],['id',_0x0141('0x53'),_0x0141('0x55')]);return db['sequelize'][_0x0141('0x56')](function(_0x51d01c){return db[_0x0141('0x32')][_0x0141('0x4f')](_[_0x0141('0x43')](_0x47100e,_0x28d638[_0x0141('0x50')]),{'include':_0x28d638[_0x0141('0x37')][_0x0141('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x51d01c})[_0x0141('0x48')](function(_0x4d515e){var _0x55272c=_0x4d515e[_0x0141('0x51')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x28d638[_0x0141('0x4b')]['id']},'raw':!![]})[_0x0141('0x48')](function(_0x2c611c){if(_0x2c611c){return BPromise[_0x0141('0x57')](_0x2c611c,function(_0x4473b4){return new BPromise(function(_0x113a2f,_0x20d836){if(_0x4473b4[_0x0141('0x58')]===null||_0x4473b4[_0x0141('0x58')]===0x1)_0x113a2f(null);return db[_0x0141('0x59')]['findAll']({'where':{'sectionId':_0x4473b4['id']},'raw':!![]})[_0x0141('0x48')](function(_0x25017c){var _0x418c0b=_[_0x0141('0x31')](_0x25017c,function(_0x3d55f3){return qs[_0x0141('0x52')](_0x3d55f3,['id',_0x0141('0x53'),_0x0141('0x55'),'sectionId']);});_0x113a2f(_0x418c0b);})[_0x0141('0x49')](function(_0x2dc025){_0x20d836(_0x2dc025);});})[_0x0141('0x48')](function(_0x351f9f){var _0x3c7ddc=qs['omit'](_0x4473b4,['id','createdAt',_0x0141('0x55')]);_0x3c7ddc[_0x0141('0x5a')]=_0x55272c['id'];if(_0x351f9f)_0x3c7ddc[_0x0141('0x5b')]=_0x351f9f;return _0x3c7ddc;})[_0x0141('0x48')](function(_0x3b6589){return db['UserProfileSection'][_0x0141('0x4f')](_0x3b6589,{'include':[{'model':db[_0x0141('0x59')],'as':_0x0141('0x5b')}],'raw':!![],'transaction':_0x51d01c});});})[_0x0141('0x48')](function(){return _0x55272c;});}});});});}})[_0x0141('0x48')](respondWithResult(_0x170969,0xc9))['catch'](handleError(_0x170969,null));};exports['update']=function(_0x3bd325,_0x39b263){if(_0x3bd325[_0x0141('0x50')]['id']){delete _0x3bd325[_0x0141('0x50')]['id'];}return db['UserProfile'][_0x0141('0x4e')]({'where':{'id':_0x3bd325[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x39b263,null))[_0x0141('0x48')](saveUpdates(_0x3bd325[_0x0141('0x50')],null))['then'](respondWithResult(_0x39b263,null))[_0x0141('0x49')](handleError(_0x39b263,null));};exports[_0x0141('0x2b')]=function(_0x30d53b,_0x21241e){return db[_0x0141('0x32')]['find']({'where':{'id':_0x30d53b['params']['id']}})['then'](handleEntityNotFound(_0x21241e,null))[_0x0141('0x48')](removeEntity(_0x21241e,null))[_0x0141('0x49')](handleError(_0x21241e,null));};exports[_0x0141('0x5c')]=function(_0x5667f0,_0xf26515){return db[_0x0141('0x32')][_0x0141('0x5c')]()[_0x0141('0x48')](respondWithResult(_0xf26515,null))[_0x0141('0x49')](handleError(_0xf26515,null));};exports[_0x0141('0x5d')]=function(_0x5e3f1c,_0x64d195){var _0x1fbf04=_0x5e3f1c[_0x0141('0x50')];return db[_0x0141('0x32')][_0x0141('0x4e')]({'where':{'id':_0x5e3f1c[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x64d195,null))[_0x0141('0x48')](function(_0x528122){if(_0x528122){return db[_0x0141('0x5e')][_0x0141('0x56')](function(_0x17ab21){return db[_0x0141('0x5f')]['destroy']({'where':{'userProfileId':_0x5e3f1c['params']['id'],'sectionId':_[_0x0141('0x31')](_0x1fbf04,function(_0x56d68c){return _0x56d68c[_0x0141('0x60')];})},'transaction':_0x17ab21})['then'](function(){var _0xa33afd=_[_0x0141('0x31')](_0x1fbf04,function(_0x14b979){_0x14b979['userProfileId']=_0x5e3f1c[_0x0141('0x4b')]['id'];return _0x14b979;});var _0x276be9=[];return BPromise[_0x0141('0x57')](_0xa33afd,function(_0x4fc114){return db[_0x0141('0x5f')]['create'](_0x4fc114,{'include':[{'model':db[_0x0141('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x17ab21})[_0x0141('0x48')](function(_0x521ef5){_0x276be9[_0x0141('0x61')](_0x521ef5['get']({'plain':!![]}));});})[_0x0141('0x48')](function(){return _0x276be9;});});});}})[_0x0141('0x48')](function(_0x48cb50){return _0x48cb50;})[_0x0141('0x48')](respondWithResult(_0x64d195,null))['catch'](handleError(_0x64d195,null));};exports[_0x0141('0x62')]=function(_0x57a8da,_0x319328){var _0xe11868;return db[_0x0141('0x32')][_0x0141('0x4e')]({'where':{'id':_0x57a8da[_0x0141('0x4b')]['id']},'attributes':['id',_0x0141('0x2e')]})['then'](handleEntityNotFound(_0x319328,null))['then'](function(_0x3d04ff){if(_0x3d04ff){_0xe11868=_0x3d04ff;return db[_0x0141('0x5f')]['destroy']({'where':{'userProfileId':_0x57a8da['params']['id'],'sectionId':_0x57a8da['query'][_0x0141('0x63')]}});}})[_0x0141('0x48')](function(){return _0xe11868;})[_0x0141('0x48')](respondWithStatusCode(_0x319328,null))[_0x0141('0x49')](handleError(_0x319328,null));};exports[_0x0141('0x64')]=function(_0x1389f3,_0x3d85c1){var _0x392140=[];var _0x462e48=[];return db[_0x0141('0x5f')][_0x0141('0x47')]({'where':{'userProfileId':_0x1389f3[_0x0141('0x4b')]['id']},'raw':!![]})[_0x0141('0x48')](function(_0x3ddb3b){_0x392140=_[_0x0141('0x45')](_0x3ddb3b,function(_0x468bf3){return _0x468bf3[_0x0141('0x65')]===0x1||_[_0x0141('0x66')]([0x3eb,0x709],_0x468bf3['sectionId']);});if(!_[_0x0141('0x67')](_0x392140)){return _[_0x0141('0x31')](_0x392140,function(_0x1520b5){return _0x1520b5['sectionId'];});}else{return;}})[_0x0141('0x48')](function(_0x129d4e){if(_0x129d4e)_0x462e48=_0x129d4e;if(_[_0x0141('0x66')](_0x462e48,0x64)){var _0x4158e4=_['find'](_0x392140,{'sectionId':0x64});return hasDefaultDashboard(_0x4158e4)['then'](function(_0x9d9cbf){return _[_0x0141('0x31')](_0x392140,function(_0x137e47){if(_0x137e47[_0x0141('0x60')]===0x64){_0x137e47['subsections']=_0x9d9cbf;}return _0x137e47;});});}else{return;}})[_0x0141('0x48')](function(_0x3b2fba){if(_0x3b2fba)_0x392140=_0x3b2fba;if(_[_0x0141('0x66')](_0x462e48,0x3eb)){var _0x4a375c=_[_0x0141('0x4e')](_0x392140,{'sectionId':0x3eb});return getCustomDashboards(_0x4a375c)[_0x0141('0x48')](function(_0x15c75a){return _['map'](_0x392140,function(_0x95056e){if(_0x4a375c[_0x0141('0x65')]){if(_0x95056e[_0x0141('0x60')]===0x3eb){_0x95056e[_0x0141('0x68')]=_0x15c75a;}}else{if(_0x95056e['sectionId']===0x64){_0x95056e[_0x0141('0x68')]=_0x15c75a;}}return _0x95056e;});});}else{return;}})[_0x0141('0x48')](function(_0x113999){if(_0x113999)_0x392140=_0x113999;if(_[_0x0141('0x66')](_0x462e48,0x709)){var _0x15826c=_[_0x0141('0x4e')](_0x392140,{'sectionId':0x709});return getPlugins(_0x15826c)[_0x0141('0x48')](function(_0x101c32){if(_0x15826c[_0x0141('0x65')]){return _['map'](_0x392140,function(_0x43758c){if(_0x43758c[_0x0141('0x60')]===0x709){_0x43758c[_0x0141('0x68')]=_0x101c32;}return _0x43758c;});}else{var _0x1879df={'sectionId':0x76c,'enabled':0x1,'subsections':_0x101c32};var _0x2943f9=_[_0x0141('0x31')](_0x392140);_0x2943f9[_0x0141('0x61')](_0x1879df);return _0x2943f9;}});}else{return;}})[_0x0141('0x48')](function(_0x49ef36){if(_0x49ef36)_0x392140=_0x49ef36;return _[_0x0141('0x45')](_0x392140,[_0x0141('0x65'),0x1]);})[_0x0141('0x48')](respondWithResult(_0x3d85c1,null))[_0x0141('0x49')](handleError(_0x3d85c1,null));};function hasDefaultDashboard(_0x23a17a){var _0x10a9a7=[0x65];return new BPromise(function(_0x1d3943,_0x5d661b){try{if(_0x23a17a[_0x0141('0x58')]){_0x1d3943(_0x10a9a7);}else{return db[_0x0141('0x59')][_0x0141('0x69')]({'where':{'sectionId':_0x23a17a['id']},'raw':!![]})[_0x0141('0x48')](function(_0xb6e9da){_0xb6e9da?_0x1d3943(_0x10a9a7):_0x1d3943();});}}catch(_0x975d13){_0x5d661b(_0x975d13);}});}function getCustomDashboards(_0x18f224){var _0x52b5eb=[];return new BPromise(function(_0x5e1e78,_0x4909a7){try{if(_0x18f224['autoAssociation']){return db[_0x0141('0x6a')][_0x0141('0x47')]({'raw':!![]})[_0x0141('0x48')](function(_0x185f6f){_0x185f6f['forEach'](function(_0xee354b){_0x52b5eb['push'](_0xee354b['id']+0x1869f);});_0x5e1e78(_0x52b5eb);});}else{return db[_0x0141('0x59')]['findAll']({'where':{'sectionId':_0x18f224['id']},'raw':!![]})[_0x0141('0x48')](function(_0x293e40){_0x293e40[_0x0141('0x6b')](function(_0x579684){_0x52b5eb['push'](_0x579684[_0x0141('0x6c')]+0x1869f);});_0x5e1e78(_0x52b5eb);});}}catch(_0x1446d5){_0x4909a7(_0x1446d5);}});}function getPlugins(_0x5272e9){var _0xc640df=[];return new BPromise(function(_0x1f231e,_0x453dca){try{if(_0x5272e9[_0x0141('0x58')]){return db[_0x0141('0x6d')][_0x0141('0x47')]({'raw':!![]})[_0x0141('0x48')](function(_0x534759){_0x534759[_0x0141('0x6b')](function(_0x20a77b){_0xc640df[_0x0141('0x61')](_0x20a77b['id']+0x15b38);});_0x1f231e(_0xc640df);});}else{return db[_0x0141('0x59')][_0x0141('0x47')]({'where':{'sectionId':_0x5272e9['id']},'raw':!![]})[_0x0141('0x48')](function(_0x4a7568){_0x4a7568[_0x0141('0x6b')](function(_0x124a29){_0xc640df[_0x0141('0x61')](_0x124a29[_0x0141('0x6c')]+0x15b38);});_0x1f231e(_0xc640df);});}}catch(_0x520185){_0x453dca(_0x520185);}});}exports[_0x0141('0x6e')]=function(_0x4cc6c2,_0x15db8a){return db[_0x0141('0x32')]['find']({'where':{'id':_0x4cc6c2[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x15db8a,null))[_0x0141('0x48')](function(_0x3096e2){if(_0x3096e2){return db[_0x0141('0x5e')][_0x0141('0x56')](function(_0x5d8a45){return db['UserProfileSection'][_0x0141('0x47')]({'where':{'userProfileId':_0x4cc6c2['params']['id']},'attributes':['id'],'raw':!![]})[_0x0141('0x48')](function(_0x3eff9d){if(_0x3eff9d){return db['UserProfileSection'][_0x0141('0x2b')]({'where':{'userProfileId':_0x4cc6c2[_0x0141('0x4b')]['id'],'id':_['map'](_0x3eff9d,function(_0x131b67){return _0x131b67['id'];})},'transaction':_0x5d8a45});}})[_0x0141('0x48')](function(_0x2449c1){var _0x149326=_[_0x0141('0x31')](_0x4cc6c2[_0x0141('0x50')],function(_0x27fff5){_0x27fff5['userProfileId']=_0x4cc6c2[_0x0141('0x4b')]['id'];return _0x27fff5;});return db[_0x0141('0x5f')][_0x0141('0x6f')](_0x149326,{'raw':!![],'transaction':_0x5d8a45});})[_0x0141('0x48')](function(_0x152ed3){var _0x5d06fe=_[_0x0141('0x45')](_[_0x0141('0x31')](_0x152ed3,function(_0x2f832f){return _0x2f832f[_0x0141('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x5d06fe){return db[_0x0141('0x5f')][_0x0141('0x47')]({'where':{'userProfileId':_0x4cc6c2['params']['id'],'sectionId':_['map'](_0x5d06fe,function(_0x494530){return _0x494530['sectionId'];})},'attributes':['id',_0x0141('0x60')],'raw':!![]})[_0x0141('0x48')](function(_0x3a43b5){var _0x16531b=_[_0x0141('0x31')](_0x4cc6c2[_0x0141('0x50')],function(_0x8caa1c){_0x8caa1c[_0x0141('0x5a')]=_0x4cc6c2['params']['id'];return _0x8caa1c;});return db[_0x0141('0x59')][_0x0141('0x6f')](_0x16531b,{'raw':!![],'transaction':_0x5d8a45});});}})[_0x0141('0x49')](handleError(_0x15db8a,null));});}})[_0x0141('0x48')](function(_0x58670c){var _0x59065b=_[_0x0141('0x31')](_0x58670c,function(_0x2b2235){return _0x2b2235[_0x0141('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x15db8a,null))['catch'](handleError(_0x15db8a,null));};exports['removeResources']=function(_0x24e9c3,_0x3d5058,_0x5cec9f){return db['UserProfile'][_0x0141('0x4e')]({'where':{'id':_0x24e9c3[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](handleEntityNotFound(_0x3d5058,null))[_0x0141('0x48')](function(_0x5ed8ef){if(_0x5ed8ef){return _0x5ed8ef['removeResources'](_0x24e9c3[_0x0141('0x37')]['ids']);}})[_0x0141('0x48')](respondWithStatusCode(_0x3d5058,null))[_0x0141('0x49')](handleError(_0x3d5058,null));};exports[_0x0141('0x70')]=function(_0x21cae8,_0x26c858){var _0x3fcb8f={};if(!_0x21cae8['query'][_0x0141('0x71')])throw new Error(_0x0141('0x72'));if(!_0x21cae8['query'][_0x0141('0x73')](_0x0141('0x3e'))){_0x3fcb8f[_0x0141('0x23')]=qs[_0x0141('0x23')](_0x21cae8[_0x0141('0x37')][_0x0141('0x23')]);_0x3fcb8f[_0x0141('0x21')]=qs[_0x0141('0x21')](_0x21cae8[_0x0141('0x37')]['offset']);}return db['UserProfile']['find']({'where':{'id':_0x21cae8[_0x0141('0x4b')]['id']}})[_0x0141('0x48')](function(_0x429909){if(!_0x429909)throw new Error(_0x0141('0x74')+_0x21cae8[_0x0141('0x4b')]['id']);return db[_0x0141('0x32')]['getResources'](_0x21cae8);})[_0x0141('0x48')](respondWithFilteredResult(_0x26c858,_0x3fcb8f))[_0x0141('0x49')](handleError(_0x26c858,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 52a8ea0..92c6cd5 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 _0x9e2e=['save','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile'];(function(_0x3e68fb,_0x13a6e6){var _0x29e330=function(_0x364de6){while(--_0x364de6){_0x3e68fb['push'](_0x3e68fb['shift']());}};_0x29e330(++_0x13a6e6);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x245efb,_0x2c636b){_0x245efb=_0x245efb-0x0;var _0x59ee7b=_0x9e2e[_0x245efb];return _0x59ee7b;};'use strict';var EventEmitter=require(_0xe9e2('0x0'));var UserProfile=require(_0xe9e2('0x1'))['db'][_0xe9e2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe9e2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d34ef){return function(_0x11a0e5,_0x3bfa90,_0x212d98){UserProfileEvents[_0xe9e2('0x4')](_0x2d34ef+':'+_0x11a0e5['id'],_0x11a0e5);UserProfileEvents[_0xe9e2('0x4')](_0x2d34ef,_0x11a0e5);_0x212d98(null);};}for(var e in events){if(events[_0xe9e2('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xe9e2('0x6')]=UserProfileEvents; \ No newline at end of file +var _0xe451=['exports','UserProfile','remove','emit','hasOwnProperty'];(function(_0x46eb8a,_0x121f7e){var _0x50eeeb=function(_0x52ecd3){while(--_0x52ecd3){_0x46eb8a['push'](_0x46eb8a['shift']());}};_0x50eeeb(++_0x121f7e);}(_0xe451,0xec));var _0x1e45=function(_0x392a17,_0x55968c){_0x392a17=_0x392a17-0x0;var _0x61f736=_0xe451[_0x392a17];return _0x61f736;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x1e45('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1e45('0x1')};function emitEvent(_0x363caa){return function(_0x1f9061,_0x197c03,_0x5cc973){UserProfileEvents[_0x1e45('0x2')](_0x363caa+':'+_0x1f9061['id'],_0x1f9061);UserProfileEvents[_0x1e45('0x2')](_0x363caa,_0x1f9061);_0x5cc973(null);};}for(var e in events){if(events[_0x1e45('0x3')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1e45('0x4')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c282196..1090643 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 _0xc4c7=['tag','ThroughTags','openTabs','true','chat','sms','dataValues','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','map','catch','model','name','resolve','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareProjects','projectName','projects','JscriptyProject','CmContact','parentSections','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','raw','section','mergeResources','length','push','UserProfileSection','find','params','all','then','isEmpty','union','ignore','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','includeAll','include','forEach','default','DefaultReports','custom','CustomReports','count','rows','color'];(function(_0xe9e94e,_0xc323a4){var _0x57d03a=function(_0x2115d4){while(--_0x2115d4){_0xe9e94e['push'](_0xe9e94e['shift']());}};_0x57d03a(++_0xc323a4);}(_0xc4c7,0xca));var _0x7c4c=function(_0x2a40b3,_0xe1c253){_0x2a40b3=_0x2a40b3-0x0;var _0x4ac6cb=_0xc4c7[_0x2a40b3];return _0x4ac6cb;};'use strict';var _=require(_0x7c4c('0x0'));var attributes=require(_0x7c4c('0x1'));var qs=require(_0x7c4c('0x2'));var squel=require(_0x7c4c('0x3'));module[_0x7c4c('0x4')]=function(_0x3bea6e){var _0x2ecd28=_0x3bea6e[_0x7c4c('0x5')];function _0x1b8647(_0x1d2405,_0x1c7cfd){return new Promise(function(_0x5c8ee3,_0x171521){if(!_0x1c7cfd)return _0x5c8ee3(null);var _0x216915=_0x1c7cfd[_0x7c4c('0x6')]?{[_0x1c7cfd[_0x7c4c('0x6')][_0x7c4c('0x7')]]:_0x1c7cfd[_0x7c4c('0x6')][_0x7c4c('0x8')]}:undefined;return _0x2ecd28[_0x1d2405][_0x7c4c('0x9')]({'where':_0x216915,'raw':!![]})['then'](function(_0x2aae89){_0x1c7cfd['associatedResources']=_[_0x7c4c('0xa')](_0x2aae89,'id');_0x5c8ee3(_0x1c7cfd);})[_0x7c4c('0xb')](function(_0x3529ae){_0x171521(_0x3529ae);});});}function _0x15b332(_0x6d22ff,_0x3ad751){return new Promise(function(_0xa28acd,_0x43c483){var _0x4b6484=_0x6d22ff[_0x7c4c('0x6')]?{[_0x6d22ff['filter']['field']]:_0x6d22ff['filter'][_0x7c4c('0x8')]}:undefined;return _0x2ecd28[_0x6d22ff[_0x7c4c('0xc')]][_0x7c4c('0x9')]({'where':_0x4b6484,'raw':!![]})['then'](function(_0x4b10a1){_0x3ad751['associatedResources']=_[_0x7c4c('0xa')](_0x4b10a1,function(_0x36c624){return _0x36c624[_0x7c4c('0xd')];});_0xa28acd(_0x3ad751);})[_0x7c4c('0xb')](function(_0x355110){_0x43c483(_0x355110);});});}function _0x5e074c(_0x5cce7e,_0xc4d0c7,_0xd3d522){if(!_0xc4d0c7)return Promise[_0x7c4c('0xe')](null);return new Promise(function(_0x5c51d5,_0x2965ef){return _0x2ecd28['UserProfileResource'][_0x7c4c('0x9')]({'where':{'sectionId':_0xc4d0c7['id']},'raw':!![]})['then'](function(_0x1f2b76){if(_0x5cce7e['field']&&_0x5cce7e['field']!=='id'){_0xc4d0c7[_0x7c4c('0xf')]=_[_0x7c4c('0xa')](_0x1f2b76,function(_0x20367f){return _0x20367f[_0x5cce7e[_0x7c4c('0x7')]];});}else{if(_0xd3d522===_0x7c4c('0x10')){_0xc4d0c7[_0x7c4c('0xf')]=_[_0x7c4c('0xa')](_0x1f2b76,function(_0x1d28dc){return{'id':_0x1d28dc[_0x7c4c('0x11')],'type':_0x1d28dc[_0x7c4c('0x12')]};});}else{_0xc4d0c7[_0x7c4c('0xf')]=_[_0x7c4c('0xa')](_0x1f2b76,function(_0x3ccd85){return _0x3ccd85[_0x7c4c('0x11')];});}}_0x5c51d5(_0xc4d0c7);})['catch'](function(_0x8a6377){_0x2965ef(_0x8a6377);});});}function _0x38addc(_0x562ebb,_0x49c9dc){var _0x298a47={'parentSections':[]};switch(_0x562ebb[_0x7c4c('0x13')]()){case _0x7c4c('0x14'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x16');break;case'odbc':_0x298a47['childModel']=_0x7c4c('0x17');break;case _0x7c4c('0x18'):_0x298a47[_0x7c4c('0x15')]='SquareRecording';_0x298a47['parentSections']=[{'name':_0x7c4c('0x19'),'field':_0x7c4c('0xd'),'foreignKey':_0x7c4c('0x1a')}];break;case _0x7c4c('0x1b'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x1c');break;case'contacts':_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x1d');_0x298a47[_0x7c4c('0x1e')]=[{'name':_0x7c4c('0x1f'),'field':'id','foreignKey':_0x7c4c('0x20')}];break;case _0x7c4c('0x21'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x22');break;case'companies':_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x23');break;case _0x7c4c('0x24'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x25');break;case _0x7c4c('0x26'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x27');break;case _0x7c4c('0x28'):_0x298a47[_0x7c4c('0x15')]='ChatWebsite';break;case _0x7c4c('0x29'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x2a');break;case'faxaccounts':_0x298a47[_0x7c4c('0x15')]='FaxAccount';break;case _0x7c4c('0x2b'):case'internalroutes':case _0x7c4c('0x2c'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x2d');break;case _0x7c4c('0x2e'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x2f');break;case _0x7c4c('0x30'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x31');break;case _0x7c4c('0x32'):_0x298a47[_0x7c4c('0x15')]='VoiceRecording';_0x298a47[_0x7c4c('0x1e')]=[{'name':'Agents','field':'name','foreignKey':_0x7c4c('0x33'),'model':_0x7c4c('0x34'),'filter':{'field':'role','value':[_0x7c4c('0x35')]}},{'name':_0x7c4c('0x36'),'field':_0x7c4c('0xd'),'foreignKey':_0x7c4c('0x33'),'model':_0x7c4c('0x34'),'filter':{'field':_0x7c4c('0x37'),'value':[_0x7c4c('0x38')]}},{'name':_0x7c4c('0x39'),'field':'name','foreignKey':'queue','model':_0x7c4c('0x3a'),'filter':{'field':_0x7c4c('0x12'),'value':[_0x7c4c('0x3b')]}},{'name':_0x7c4c('0x3c'),'field':_0x7c4c('0xd'),'foreignKey':_0x7c4c('0x3d'),'model':'VoiceQueue','filter':{'field':_0x7c4c('0x12'),'value':[_0x7c4c('0x3e')]}}];break;case _0x7c4c('0x3f'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x40');break;case _0x7c4c('0x41'):_0x298a47['childModel']='VoiceChanSpy';break;case _0x7c4c('0x42'):_0x298a47['childModel']=_0x7c4c('0x43');break;case'ivrcampaigns':_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x44');break;case _0x7c4c('0x45'):_0x298a47[_0x7c4c('0x15')]='MailQueue';break;case'mailaccounts':_0x298a47['childModel']=_0x7c4c('0x46');break;case _0x7c4c('0x47'):_0x298a47[_0x7c4c('0x15')]='MailSubstatus';break;case'openchannelqueues':_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x48');break;case _0x7c4c('0x49'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x4a');break;case _0x7c4c('0x4b'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x4c');break;case _0x7c4c('0x4d'):_0x298a47[_0x7c4c('0x15')]='SmsAccount';break;case _0x7c4c('0x4e'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x4f');break;case _0x7c4c('0x50'):_0x298a47['childModel']=_0x7c4c('0x51');break;case _0x7c4c('0x52'):_0x298a47['childModel']=_0x7c4c('0x53');break;case _0x7c4c('0x54'):case _0x7c4c('0x55'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x3a');if(_0x49c9dc){_0x298a47['parentSections']=[{'name':_0x7c4c('0x39')},{'name':_0x7c4c('0x3c')}];}break;case _0x7c4c('0x56'):case'agents':case'telephones':_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x34');if(_0x49c9dc){_0x298a47[_0x7c4c('0x1e')]=[{'name':'Users','filter':{'field':_0x7c4c('0x37'),'value':[_0x7c4c('0x57'),_0x7c4c('0x58')]},'ignore':!![]},{'name':_0x7c4c('0x59')},{'name':'Telephones'}];}break;case _0x7c4c('0x5a'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x5b');break;case _0x7c4c('0x5c'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x5d');break;case _0x7c4c('0x5e'):_0x298a47['childModel']=_0x7c4c('0x5f');break;case'sugarcrmaccounts':_0x298a47['childModel']=_0x7c4c('0x60');break;case _0x7c4c('0x61'):_0x298a47['childModel']='DeskAccount';break;case _0x7c4c('0x62'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x63');break;case _0x7c4c('0x64'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x34');break;case _0x7c4c('0x65'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x66');break;case _0x7c4c('0x67'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x68');break;case _0x7c4c('0x69'):_0x298a47[_0x7c4c('0x15')]='Dashboard';break;case _0x7c4c('0x6a'):_0x298a47['childModel']=_0x7c4c('0x6b');break;case'pauses':_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x6c');break;case _0x7c4c('0x6d'):_0x298a47['childModel']=_0x7c4c('0x6e');break;case'sounds':_0x298a47['childModel']=_0x7c4c('0x6f');break;case _0x7c4c('0x70'):_0x298a47['childModel']=_0x7c4c('0x71');break;case'templates':_0x298a47['childModel']=_0x7c4c('0x72');break;case _0x7c4c('0x73'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x74');break;case _0x7c4c('0x75'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x76');break;case _0x7c4c('0x77'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x78');break;case _0x7c4c('0x79'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x7a');break;case _0x7c4c('0x7b'):_0x298a47[_0x7c4c('0x15')]=_0x7c4c('0x10');_0x298a47['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x7c4c('0x7c')}];break;case'metrics':_0x298a47['childModel']=_0x7c4c('0x7d');break;}return _0x298a47;}function _0x50866d(_0x362478,_0x596adc){var _0x562d6a=_0x362478['charAt'](0x0)[_0x7c4c('0x7e')]()+_0x362478[_0x7c4c('0x7f')](0x1);var _0x2846f3={'type':_0x2ecd28[_0x7c4c('0x80')][_0x7c4c('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x26f215,_0x2fe198){var _0x350b38=squel[_0x7c4c('0x82')]()['field']('ui.'+_0x562d6a+_0x7c4c('0x83'),'id')[_0x7c4c('0x7')](_0x7c4c('0x84'))[_0x7c4c('0x85')](_0x7c4c('0x86')+_0x362478+_0x7c4c('0x87'),'ui')[_0x7c4c('0x88')](_0x7c4c('0x89'),_0x596adc['id']);return _0x2ecd28[_0x7c4c('0x8a')][_0x7c4c('0x8b')](_0x350b38[_0x7c4c('0x8c')](),_0x2846f3)['then'](function(_0x468cdc){_0x596adc[_0x562d6a+_0x7c4c('0x8d')]=_0x468cdc;_0x26f215(_0x468cdc);})[_0x7c4c('0xb')](function(_0x1266e2){_0x2fe198(_0x1266e2);});});}return _0x3bea6e[_0x7c4c('0x8e')](_0x7c4c('0x8f'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3055b6){var _0x246b94={'raw':_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0x90')],'where':{}};var _0x391e80={};var _0x1761fd={'count':0x0,'rows':[]};var _0x42a474=_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0x91')];var _0x47ade4=_0x3055b6['query'][_0x7c4c('0x92')]||![];var _0x13da35=_0x38addc(_0x42a474,_0x47ade4);if(!_0x13da35[_0x7c4c('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x42a474+'\x27');var _0x28e4dd=[{'name':_0x42a474}];if(!_['isEmpty'](_0x13da35[_0x7c4c('0x1e')]))_0x28e4dd=_0x13da35['parentSections'];var _0x2a2d40=[];for(var _0x3698ee=0x0;_0x3698ee<_0x28e4dd[_0x7c4c('0x93')];_0x3698ee++){_0x2a2d40[_0x7c4c('0x94')](_0x2ecd28[_0x7c4c('0x95')][_0x7c4c('0x96')]({'where':{'userProfileId':_0x3055b6[_0x7c4c('0x97')]['id'],'name':_0x28e4dd[_0x3698ee]['name']},'raw':!![]}));}return Promise[_0x7c4c('0x98')](_0x2a2d40)[_0x7c4c('0x99')](function(_0x1d4ca2){var _0x48f762=_[_0x7c4c('0x6')](_0x1d4ca2,function(_0x189b1d){return _0x189b1d?_0x189b1d:undefined;});var _0x2ba418=_[_0x7c4c('0x6')](_0x28e4dd,['ignore',!![]]);var _0x1f689d=_[_0x7c4c('0x9a')](_0x48f762)&&_['isEmpty'](_0x2ba418)?null:_[_0x7c4c('0x9b')](_0x2ba418,_0x48f762);if(!_0x1f689d)return null;var _0x129681=[];for(var _0x50ca3e=0x0;_0x50ca3e<_0x1f689d[_0x7c4c('0x93')];_0x50ca3e++){var _0x59349c=_[_0x7c4c('0x96')](_0x28e4dd,function(_0x21f3a8){return _0x1f689d[_0x50ca3e]?_0x21f3a8['name']===_0x1f689d[_0x50ca3e][_0x7c4c('0xd')]:null;});if(_0x59349c){if(_0x1f689d[_0x50ca3e][_0x7c4c('0x9c')]){_0x129681[_0x7c4c('0x94')](_0x1b8647(_0x13da35[_0x7c4c('0x15')],_0x1f689d[_0x50ca3e]));}else{if(!_0x1f689d[_0x50ca3e][_0x7c4c('0x9d')]){_0x129681[_0x7c4c('0x94')](_0x5e074c(_0x59349c,_0x1f689d[_0x50ca3e],_0x13da35['childModel']));}else{if(_0x59349c[_0x7c4c('0xc')]){_0x129681[_0x7c4c('0x94')](_0x15b332(_0x59349c,_0x1f689d[_0x50ca3e]));}}}}}return Promise[_0x7c4c('0x98')](_0x129681);})[_0x7c4c('0x99')](function(_0x1bdf15){var _0x5189da=_0x1bdf15;var _0xe1aa78=null;if(_0x5189da){_0xe1aa78=_0x5189da[_0x7c4c('0x93')]===0x1?_0x5189da[0x0]:null;}if(!_0xe1aa78&&!_0x5189da)return _0x1761fd;var _0x457887=_0x2ecd28[_0x13da35[_0x7c4c('0x15')]][_0x7c4c('0x9e')];_0x391e80[_0x7c4c('0xc')]=_['keys'](_0x457887);_0x391e80['query']=_[_0x7c4c('0x9f')](_0x3055b6['query']);_0x391e80[_0x7c4c('0xa0')]=_[_0x7c4c('0xa1')](_0x391e80['model'],_0x391e80[_0x7c4c('0x8b')]);_0x246b94['attributes']=_[_0x7c4c('0xa1')](_0x391e80[_0x7c4c('0xc')],qs[_0x7c4c('0xa2')](_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xa2')]));_0x246b94[_0x7c4c('0xa3')]=_0x246b94['attributes'][_0x7c4c('0x93')]?_0x246b94[_0x7c4c('0xa3')]:_0x391e80[_0x7c4c('0xc')];if(!_0x3055b6[_0x7c4c('0x8b')]['hasOwnProperty'](_0x7c4c('0xa4'))){_0x246b94[_0x7c4c('0xa5')]=qs['limit'](_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xa5')]);_0x246b94['offset']=qs[_0x7c4c('0xa6')](_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xa6')]);}_0x246b94[_0x7c4c('0xa7')]=qs[_0x7c4c('0xa8')](_0x3055b6[_0x7c4c('0x8b')]['sort']);_0x246b94[_0x7c4c('0x88')]=qs['filters'](_[_0x7c4c('0xa9')](_0x3055b6[_0x7c4c('0x8b')],_0x391e80[_0x7c4c('0xa0')]));if(_0x3055b6['query']['filter']){_0x246b94[_0x7c4c('0x88')]=_[_0x7c4c('0xaa')](_0x246b94['where'],{'$or':_[_0x7c4c('0xa')](_0x457887,function(_0x306318){if(_0x306318[_0x7c4c('0x12')]['key']!==_0x7c4c('0xab')){var _0x54f8cd={};_0x54f8cd[_0x306318['field']]={'$like':'%'+_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0x6')]+'%'};return _0x54f8cd;}})});}var _0x923402=[];var _0x355a3d=null;var _0x2b2579={};if(_0xe1aa78){_0x355a3d=_[_0x7c4c('0x96')](_0x28e4dd,[_0x7c4c('0xd'),_0xe1aa78[_0x7c4c('0xd')]]);if(_0x355a3d[_0x7c4c('0x7')]){_0x2b2579={};if(_0x13da35[_0x7c4c('0x15')]===_0x7c4c('0x10')){_0x2b2579[_0x355a3d['foreignKey']]=_[_0x7c4c('0xa')](_0xe1aa78['associatedResources'],'id');}else{_0x2b2579[_0x355a3d[_0x7c4c('0xac')]]=_0xe1aa78[_0x7c4c('0xf')];}_0x923402[_0x7c4c('0x94')](_0x2b2579);}else{_0x246b94[_0x7c4c('0x88')]['id']=_0xe1aa78[_0x7c4c('0xf')];}}else{for(var _0x47754b=0x0;_0x47754b<_0x5189da['length'];_0x47754b++){_0x355a3d=_[_0x7c4c('0x96')](_0x28e4dd,[_0x7c4c('0xd'),_0x5189da[_0x47754b][_0x7c4c('0xd')]]);if(_0x355a3d[_0x7c4c('0x7')]){_0x2b2579={};_0x2b2579[_0x355a3d[_0x7c4c('0xac')]]=_0x5189da[_0x47754b]['associatedResources'];_0x923402[_0x7c4c('0x94')](_0x2b2579);}else{if(!_0x246b94[_0x7c4c('0x88')]['id'])_0x246b94[_0x7c4c('0x88')]['id']=[];_0x5189da[_0x47754b][_0x7c4c('0xf')]['forEach'](function(_0x1ee32b){_0x246b94[_0x7c4c('0x88')]['id'][_0x7c4c('0x94')](_0x1ee32b);});}}}if(!_[_0x7c4c('0x9a')](_0x923402)){_0x246b94[_0x7c4c('0x88')]=_[_0x7c4c('0xaa')](_0x246b94[_0x7c4c('0x88')],{'$and':{'$or':_0x923402}});}_0x246b94=_['merge']({},_0x246b94,_0x3055b6[_0x7c4c('0xad')]);if(_0xe1aa78&&!_0xe1aa78['autoAssociation']&&_0x13da35[_0x7c4c('0x15')]===_0x7c4c('0x10')){if(_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xae')]){_0x246b94[_0x7c4c('0xaf')]=[{'all':!![]}];}return _0x2ecd28[_0x13da35[_0x7c4c('0x15')]][_0x7c4c('0x9')](_0x246b94)[_0x7c4c('0x99')](function(_0x2987bd){var _0x52f6df=[];_0x2987bd[_0x7c4c('0xb0')](function(_0x1e1f08){var _0x540996;switch(_0x1e1f08['reportType']){case _0x7c4c('0xb1'):_0x540996=_[_0x7c4c('0x96')](_0xe1aa78[_0x7c4c('0xf')],function(_0x458072){return _0x458072['id']===_0x1e1f08[_0x7c4c('0x7c')]&&_0x458072[_0x7c4c('0x12')]===_0x7c4c('0xb2');});break;case _0x7c4c('0xb3'):_0x540996=_['find'](_0xe1aa78['associatedResources'],function(_0x2cf42a){return _0x2cf42a['id']===_0x1e1f08['reportId']&&_0x2cf42a['type']===_0x7c4c('0xb4');});break;}if(_0x540996)_0x52f6df[_0x7c4c('0x94')](_0x1e1f08);});_0x1761fd[_0x7c4c('0xb5')]=_0x52f6df[_0x7c4c('0x93')];_0x1761fd[_0x7c4c('0xb6')]=_0x52f6df;return _0x1761fd;});}else{return _0x2ecd28[_0x13da35['childModel']][_0x7c4c('0xb5')]({'where':_0x246b94[_0x7c4c('0x88')]})['then'](function(_0x4d6f08){_0x1761fd['count']=_0x4d6f08;if(_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xae')]){if(_0x13da35[_0x7c4c('0x15')]==='CmContact'){_0x246b94['include']=[{'model':_0x2ecd28[_0x7c4c('0x71')],'as':'Tags','attributes':['id',_0x7c4c('0xd'),_0x7c4c('0xb7')],'required':_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xb8')]?!![]:![]},{'model':_0x2ecd28[_0x7c4c('0x71')],'as':_0x7c4c('0xb9'),'attributes':['id','name','color'],'through':_0x3055b6['query'][_0x7c4c('0xb8')]?{'attributes':[],'where':{'TagId':_0x3055b6['query']['tag']||undefined}}:{},'required':_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xb8')]?!![]:![]}];}else{_0x246b94[_0x7c4c('0xaf')]=[{'all':!![]}];}}return _0x2ecd28[_0x13da35[_0x7c4c('0x15')]][_0x7c4c('0x9')](_0x246b94);})[_0x7c4c('0x99')](function(_0x5652e4){_0x1761fd[_0x7c4c('0xb6')]=_0x5652e4;if(_0x42a474==='Agents'&&_0x3055b6[_0x7c4c('0x8b')][_0x7c4c('0xba')]===_0x7c4c('0xbb')){var _0x380d23=[];for(var _0x208ff2=0x0;_0x208ff2<_0x1761fd['rows'][_0x7c4c('0x93')];_0x208ff2++){_0x380d23[_0x7c4c('0x94')](_0x50866d(_0x7c4c('0xbc'),_0x1761fd['rows'][_0x208ff2]['dataValues']));_0x380d23['push'](_0x50866d(_0x7c4c('0xbd'),_0x1761fd['rows'][_0x208ff2][_0x7c4c('0xbe')]));_0x380d23['push'](_0x50866d('fax',_0x1761fd['rows'][_0x208ff2][_0x7c4c('0xbe')]));_0x380d23['push'](_0x50866d('mail',_0x1761fd['rows'][_0x208ff2][_0x7c4c('0xbe')]));_0x380d23[_0x7c4c('0x94')](_0x50866d(_0x7c4c('0xbf'),_0x1761fd['rows'][_0x208ff2][_0x7c4c('0xbe')]));_0x380d23[_0x7c4c('0x94')](_0x50866d(_0x7c4c('0xc0'),_0x1761fd[_0x7c4c('0xb6')][_0x208ff2][_0x7c4c('0xbe')]));}return Promise[_0x7c4c('0x98')](_0x380d23)['then'](function(){return _0x1761fd;});}return _0x1761fd;});}});}}});}; \ No newline at end of file +var _0x2edd=['ThroughTags','openTabs','true','chat','dataValues','sms','fax','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','catch','value','model','resolve','UserProfileResource','AnalyticExtractedReport','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','CmContact','Lists','ListId','CmList','companies','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','VoiceQueues','users','telephones','Users','role','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','intervals','Interval','Pause','scheduler','Sound','tags','Tag','templates','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','reportType','default','custom','CustomReports','count','rows','include','color','tag'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2edd,0xbf));var _0xd2ed=function(_0x5422c8,_0x3ce1fa){_0x5422c8=_0x5422c8-0x0;var _0x2558f7=_0x2edd[_0x5422c8];return _0x2558f7;};'use strict';var _=require(_0xd2ed('0x0'));var attributes=require(_0xd2ed('0x1'));var qs=require(_0xd2ed('0x2'));var squel=require(_0xd2ed('0x3'));module[_0xd2ed('0x4')]=function(_0x372341){var _0x39c04d=_0x372341[_0xd2ed('0x5')];function _0x1788b2(_0x4eb2f5,_0x41424d){return new Promise(function(_0x5e3ddb,_0x3a1b96){if(!_0x41424d)return _0x5e3ddb(null);var _0x486545=_0x41424d[_0xd2ed('0x6')]?{[_0x41424d[_0xd2ed('0x6')][_0xd2ed('0x7')]]:_0x41424d[_0xd2ed('0x6')]['value']}:undefined;return _0x39c04d[_0x4eb2f5][_0xd2ed('0x8')]({'where':_0x486545,'raw':!![]})[_0xd2ed('0x9')](function(_0x4aabf2){_0x41424d[_0xd2ed('0xa')]=_[_0xd2ed('0xb')](_0x4aabf2,'id');_0x5e3ddb(_0x41424d);})[_0xd2ed('0xc')](function(_0x2dc62a){_0x3a1b96(_0x2dc62a);});});}function _0x1d654e(_0x58c47e,_0x354d04){return new Promise(function(_0x495395,_0x3db1a3){var _0x34764f=_0x58c47e[_0xd2ed('0x6')]?{[_0x58c47e['filter'][_0xd2ed('0x7')]]:_0x58c47e[_0xd2ed('0x6')][_0xd2ed('0xd')]}:undefined;return _0x39c04d[_0x58c47e[_0xd2ed('0xe')]][_0xd2ed('0x8')]({'where':_0x34764f,'raw':!![]})['then'](function(_0xc95a25){_0x354d04[_0xd2ed('0xa')]=_['map'](_0xc95a25,function(_0x5d3cd7){return _0x5d3cd7['name'];});_0x495395(_0x354d04);})[_0xd2ed('0xc')](function(_0x2240d4){_0x3db1a3(_0x2240d4);});});}function _0xb98f36(_0x1770ac,_0x47c7a1,_0x129f79){if(!_0x47c7a1)return Promise[_0xd2ed('0xf')](null);return new Promise(function(_0x2e2cd5,_0x46afb3){return _0x39c04d[_0xd2ed('0x10')][_0xd2ed('0x8')]({'where':{'sectionId':_0x47c7a1['id']},'raw':!![]})[_0xd2ed('0x9')](function(_0xdf033e){if(_0x1770ac[_0xd2ed('0x7')]&&_0x1770ac[_0xd2ed('0x7')]!=='id'){_0x47c7a1[_0xd2ed('0xa')]=_[_0xd2ed('0xb')](_0xdf033e,function(_0x14c486){return _0x14c486[_0x1770ac[_0xd2ed('0x7')]];});}else{if(_0x129f79===_0xd2ed('0x11')){_0x47c7a1[_0xd2ed('0xa')]=_['map'](_0xdf033e,function(_0x80bff2){return{'id':_0x80bff2['resourceId'],'type':_0x80bff2[_0xd2ed('0x12')]};});}else{_0x47c7a1[_0xd2ed('0xa')]=_[_0xd2ed('0xb')](_0xdf033e,function(_0x19377e){return _0x19377e['resourceId'];});}}_0x2e2cd5(_0x47c7a1);})[_0xd2ed('0xc')](function(_0x180211){_0x46afb3(_0x180211);});});}function _0x5a8cd5(_0x297c8d,_0x59d391){var _0x2c7be3={'parentSections':[]};switch(_0x297c8d[_0xd2ed('0x13')]()){case _0xd2ed('0x14'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x16');break;case _0xd2ed('0x17'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x18');break;case'squarerecordings':_0x2c7be3['childModel']=_0xd2ed('0x19');_0x2c7be3[_0xd2ed('0x1a')]=[{'name':_0xd2ed('0x1b'),'field':_0xd2ed('0x1c'),'foreignKey':_0xd2ed('0x1d')}];break;case _0xd2ed('0x1e'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x1f');break;case'contacts':_0x2c7be3['childModel']=_0xd2ed('0x20');_0x2c7be3['parentSections']=[{'name':_0xd2ed('0x21'),'field':'id','foreignKey':_0xd2ed('0x22')}];break;case'lists':_0x2c7be3['childModel']=_0xd2ed('0x23');break;case _0xd2ed('0x24'):_0x2c7be3[_0xd2ed('0x15')]='CmCompany';break;case _0xd2ed('0x25'):_0x2c7be3[_0xd2ed('0x15')]='CmCustomField';break;case _0xd2ed('0x26'):_0x2c7be3['childModel']=_0xd2ed('0x27');break;case _0xd2ed('0x28'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x29');break;case'faxqueues':_0x2c7be3[_0xd2ed('0x15')]='FaxQueue';break;case'faxaccounts':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x2a');break;case'inboundroutes':case'internalroutes':case _0xd2ed('0x2b'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x2c');break;case _0xd2ed('0x2d'):_0x2c7be3['childModel']=_0xd2ed('0x2e');break;case'voicemails':_0x2c7be3[_0xd2ed('0x15')]='VoiceMail';break;case _0xd2ed('0x2f'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x30');_0x2c7be3['parentSections']=[{'name':_0xd2ed('0x31'),'field':_0xd2ed('0x1c'),'foreignKey':'membername','model':_0xd2ed('0x32'),'filter':{'field':'role','value':[_0xd2ed('0x33')]}},{'name':_0xd2ed('0x34'),'field':'name','foreignKey':'membername','model':_0xd2ed('0x32'),'filter':{'field':'role','value':[_0xd2ed('0x35')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0xd2ed('0x36'),'model':_0xd2ed('0x37'),'filter':{'field':_0xd2ed('0x12'),'value':[_0xd2ed('0x38')]}},{'name':_0xd2ed('0x39'),'field':_0xd2ed('0x1c'),'foreignKey':_0xd2ed('0x36'),'model':_0xd2ed('0x37'),'filter':{'field':_0xd2ed('0x12'),'value':[_0xd2ed('0x3a')]}}];break;case _0xd2ed('0x3b'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x3c');break;case _0xd2ed('0x3d'):_0x2c7be3[_0xd2ed('0x15')]='VoiceChanSpy';break;case _0xd2ed('0x3e'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x3f');break;case _0xd2ed('0x40'):_0x2c7be3[_0xd2ed('0x15')]='Campaign';break;case _0xd2ed('0x41'):_0x2c7be3[_0xd2ed('0x15')]='MailQueue';break;case'mailaccounts':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x42');break;case'mailsubstatuses':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x43');break;case _0xd2ed('0x44'):_0x2c7be3['childModel']='OpenchannelQueue';break;case _0xd2ed('0x45'):_0x2c7be3[_0xd2ed('0x15')]='OpenchannelAccount';break;case _0xd2ed('0x46'):_0x2c7be3['childModel']=_0xd2ed('0x47');break;case'smsaccounts':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x48');break;case _0xd2ed('0x49'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x4a');break;case _0xd2ed('0x4b'):_0x2c7be3['childModel']=_0xd2ed('0x4c');break;case _0xd2ed('0x4d'):_0x2c7be3[_0xd2ed('0x15')]='Team';break;case'voicequeues':case _0xd2ed('0x4e'):_0x2c7be3['childModel']=_0xd2ed('0x37');if(_0x59d391){_0x2c7be3['parentSections']=[{'name':_0xd2ed('0x4f')},{'name':_0xd2ed('0x39')}];}break;case _0xd2ed('0x50'):case'agents':case _0xd2ed('0x51'):_0x2c7be3['childModel']=_0xd2ed('0x32');if(_0x59d391){_0x2c7be3[_0xd2ed('0x1a')]=[{'name':_0xd2ed('0x52'),'filter':{'field':_0xd2ed('0x53'),'value':[_0xd2ed('0x54'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xd2ed('0x34')}];}break;case _0xd2ed('0x55'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x56');break;case _0xd2ed('0x57'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x58');break;case _0xd2ed('0x59'):_0x2c7be3['childModel']=_0xd2ed('0x5a');break;case'sugarcrmaccounts':_0x2c7be3[_0xd2ed('0x15')]='SugarcrmAccount';break;case _0xd2ed('0x5b'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x5c');break;case _0xd2ed('0x5d'):_0x2c7be3['childModel']=_0xd2ed('0x5e');break;case _0xd2ed('0x5f'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x32');break;case _0xd2ed('0x60'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x61');break;case'dispositions':_0x2c7be3[_0xd2ed('0x15')]='Disposition';break;case _0xd2ed('0x62'):_0x2c7be3['childModel']='Dashboard';break;case _0xd2ed('0x63'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x64');break;case'pauses':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x65');break;case _0xd2ed('0x66'):_0x2c7be3[_0xd2ed('0x15')]='Schedule';break;case'sounds':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x67');break;case _0xd2ed('0x68'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x69');break;case _0xd2ed('0x6a'):_0x2c7be3['childModel']='Template';break;case'triggers':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x6b');break;case _0xd2ed('0x6c'):_0x2c7be3['childModel']=_0xd2ed('0x6d');break;case _0xd2ed('0x6e'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x6f');break;case'plugins':_0x2c7be3['childModel']=_0xd2ed('0x70');break;case _0xd2ed('0x71'):_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x11');_0x2c7be3[_0xd2ed('0x1a')]=[{'name':_0xd2ed('0x72'),'field':'id','foreignKey':_0xd2ed('0x73')}];break;case'metrics':_0x2c7be3[_0xd2ed('0x15')]=_0xd2ed('0x74');break;}return _0x2c7be3;}function _0x522700(_0x1d2f17,_0xc394b3){var _0x1addac=_0x1d2f17[_0xd2ed('0x75')](0x0)[_0xd2ed('0x76')]()+_0x1d2f17[_0xd2ed('0x77')](0x1);var _0x6af6cb={'type':_0x39c04d[_0xd2ed('0x78')][_0xd2ed('0x79')]['SELECT'],'raw':!![]};return new Promise(function(_0x490692,_0x4f22cc){var _0x2dcdef=squel[_0xd2ed('0x7a')]()[_0xd2ed('0x7')](_0xd2ed('0x7b')+_0x1addac+_0xd2ed('0x7c'),'id')[_0xd2ed('0x7')]('ui.createdAt')[_0xd2ed('0x7d')]('user_has_'+_0x1d2f17+_0xd2ed('0x7e'),'ui')[_0xd2ed('0x7f')](_0xd2ed('0x80'),_0xc394b3['id']);return _0x39c04d[_0xd2ed('0x81')][_0xd2ed('0x82')](_0x2dcdef['toString'](),_0x6af6cb)[_0xd2ed('0x9')](function(_0x3f84a9){_0xc394b3[_0x1addac+_0xd2ed('0x83')]=_0x3f84a9;_0x490692(_0x3f84a9);})[_0xd2ed('0xc')](function(_0x28231d){_0x4f22cc(_0x28231d);});});}return _0x372341['define'](_0xd2ed('0x84'),attributes,{'tableName':_0xd2ed('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5209a8){var _0xdd493a={'raw':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x86')],'where':{}};var _0x3c30d5={};var _0x5a9003={'count':0x0,'rows':[]};var _0x35bbc1=_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x87')];var _0x3936a5=_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x88')]||![];var _0x2b83e7=_0x5a8cd5(_0x35bbc1,_0x3936a5);if(!_0x2b83e7[_0xd2ed('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x35bbc1+'\x27');var _0x28a539=[{'name':_0x35bbc1}];if(!_[_0xd2ed('0x89')](_0x2b83e7['parentSections']))_0x28a539=_0x2b83e7[_0xd2ed('0x1a')];var _0x2c179a=[];for(var _0x8d520c=0x0;_0x8d520c<_0x28a539[_0xd2ed('0x8a')];_0x8d520c++){_0x2c179a[_0xd2ed('0x8b')](_0x39c04d[_0xd2ed('0x8c')][_0xd2ed('0x8d')]({'where':{'userProfileId':_0x5209a8[_0xd2ed('0x8e')]['id'],'name':_0x28a539[_0x8d520c][_0xd2ed('0x1c')]},'raw':!![]}));}return Promise[_0xd2ed('0x8f')](_0x2c179a)[_0xd2ed('0x9')](function(_0x44b620){var _0x53bed3=_[_0xd2ed('0x6')](_0x44b620,function(_0x175047){return _0x175047?_0x175047:undefined;});var _0x314556=_[_0xd2ed('0x6')](_0x28a539,['ignore',!![]]);var _0x5c6558=_['isEmpty'](_0x53bed3)&&_[_0xd2ed('0x89')](_0x314556)?null:_[_0xd2ed('0x90')](_0x314556,_0x53bed3);if(!_0x5c6558)return null;var _0x5dc1c4=[];for(var _0x356ca0=0x0;_0x356ca0<_0x5c6558[_0xd2ed('0x8a')];_0x356ca0++){var _0x590221=_[_0xd2ed('0x8d')](_0x28a539,function(_0x3cca6c){return _0x5c6558[_0x356ca0]?_0x3cca6c[_0xd2ed('0x1c')]===_0x5c6558[_0x356ca0][_0xd2ed('0x1c')]:null;});if(_0x590221){if(_0x5c6558[_0x356ca0][_0xd2ed('0x91')]){_0x5dc1c4['push'](_0x1788b2(_0x2b83e7[_0xd2ed('0x15')],_0x5c6558[_0x356ca0]));}else{if(!_0x5c6558[_0x356ca0][_0xd2ed('0x92')]){_0x5dc1c4[_0xd2ed('0x8b')](_0xb98f36(_0x590221,_0x5c6558[_0x356ca0],_0x2b83e7[_0xd2ed('0x15')]));}else{if(_0x590221['model']){_0x5dc1c4[_0xd2ed('0x8b')](_0x1d654e(_0x590221,_0x5c6558[_0x356ca0]));}}}}}return Promise['all'](_0x5dc1c4);})[_0xd2ed('0x9')](function(_0x1a40d4){var _0xe0a767=_0x1a40d4;var _0x3278aa=null;if(_0xe0a767){_0x3278aa=_0xe0a767['length']===0x1?_0xe0a767[0x0]:null;}if(!_0x3278aa&&!_0xe0a767)return _0x5a9003;var _0x30e8bd=_0x39c04d[_0x2b83e7['childModel']][_0xd2ed('0x93')];_0x3c30d5['model']=_[_0xd2ed('0x94')](_0x30e8bd);_0x3c30d5[_0xd2ed('0x82')]=_[_0xd2ed('0x94')](_0x5209a8['query']);_0x3c30d5[_0xd2ed('0x95')]=_[_0xd2ed('0x96')](_0x3c30d5[_0xd2ed('0xe')],_0x3c30d5[_0xd2ed('0x82')]);_0xdd493a[_0xd2ed('0x97')]=_['intersection'](_0x3c30d5[_0xd2ed('0xe')],qs[_0xd2ed('0x98')](_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x98')]));_0xdd493a[_0xd2ed('0x97')]=_0xdd493a['attributes'][_0xd2ed('0x8a')]?_0xdd493a['attributes']:_0x3c30d5[_0xd2ed('0xe')];if(!_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x99')](_0xd2ed('0x9a'))){_0xdd493a[_0xd2ed('0x9b')]=qs['limit'](_0x5209a8['query'][_0xd2ed('0x9b')]);_0xdd493a[_0xd2ed('0x9c')]=qs[_0xd2ed('0x9c')](_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x9c')]);}_0xdd493a[_0xd2ed('0x9d')]=qs[_0xd2ed('0x9e')](_0x5209a8['query']['sort']);_0xdd493a['where']=qs['filters'](_[_0xd2ed('0x9f')](_0x5209a8[_0xd2ed('0x82')],_0x3c30d5[_0xd2ed('0x95')]));if(_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0x6')]){_0xdd493a['where']=_[_0xd2ed('0xa0')](_0xdd493a[_0xd2ed('0x7f')],{'$or':_['map'](_0x30e8bd,function(_0x42fed8){if(_0x42fed8[_0xd2ed('0x12')][_0xd2ed('0xa1')]!==_0xd2ed('0xa2')){var _0x5a5391={};_0x5a5391[_0x42fed8[_0xd2ed('0x7')]]={'$like':'%'+_0x5209a8[_0xd2ed('0x82')]['filter']+'%'};return _0x5a5391;}})});}var _0x1a8d1d=[];var _0x5877cb=null;var _0x592831={};if(_0x3278aa){_0x5877cb=_['find'](_0x28a539,[_0xd2ed('0x1c'),_0x3278aa[_0xd2ed('0x1c')]]);if(_0x5877cb['field']){_0x592831={};if(_0x2b83e7[_0xd2ed('0x15')]===_0xd2ed('0x11')){_0x592831[_0x5877cb['foreignKey']]=_[_0xd2ed('0xb')](_0x3278aa['associatedResources'],'id');}else{_0x592831[_0x5877cb[_0xd2ed('0xa3')]]=_0x3278aa[_0xd2ed('0xa')];}_0x1a8d1d['push'](_0x592831);}else{_0xdd493a['where']['id']=_0x3278aa[_0xd2ed('0xa')];}}else{for(var _0xeaa07e=0x0;_0xeaa07e<_0xe0a767[_0xd2ed('0x8a')];_0xeaa07e++){_0x5877cb=_['find'](_0x28a539,[_0xd2ed('0x1c'),_0xe0a767[_0xeaa07e][_0xd2ed('0x1c')]]);if(_0x5877cb[_0xd2ed('0x7')]){_0x592831={};_0x592831[_0x5877cb[_0xd2ed('0xa3')]]=_0xe0a767[_0xeaa07e][_0xd2ed('0xa')];_0x1a8d1d[_0xd2ed('0x8b')](_0x592831);}else{if(!_0xdd493a[_0xd2ed('0x7f')]['id'])_0xdd493a[_0xd2ed('0x7f')]['id']=[];_0xe0a767[_0xeaa07e]['associatedResources'][_0xd2ed('0xa4')](function(_0x4812bc){_0xdd493a['where']['id'][_0xd2ed('0x8b')](_0x4812bc);});}}}if(!_['isEmpty'](_0x1a8d1d)){_0xdd493a['where']=_[_0xd2ed('0xa0')](_0xdd493a[_0xd2ed('0x7f')],{'$and':{'$or':_0x1a8d1d}});}_0xdd493a=_[_0xd2ed('0xa0')]({},_0xdd493a,_0x5209a8['options']);if(_0x3278aa&&!_0x3278aa['autoAssociation']&&_0x2b83e7[_0xd2ed('0x15')]===_0xd2ed('0x11')){if(_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xa5')]){_0xdd493a['include']=[{'all':!![]}];}return _0x39c04d[_0x2b83e7[_0xd2ed('0x15')]][_0xd2ed('0x8')](_0xdd493a)['then'](function(_0x181071){var _0x3b94b3=[];_0x181071[_0xd2ed('0xa4')](function(_0x4aec2d){var _0x8caaba;switch(_0x4aec2d[_0xd2ed('0xa6')]){case _0xd2ed('0xa7'):_0x8caaba=_['find'](_0x3278aa[_0xd2ed('0xa')],function(_0x451aec){return _0x451aec['id']===_0x4aec2d['reportId']&&_0x451aec[_0xd2ed('0x12')]==='DefaultReports';});break;case _0xd2ed('0xa8'):_0x8caaba=_[_0xd2ed('0x8d')](_0x3278aa[_0xd2ed('0xa')],function(_0x1648a7){return _0x1648a7['id']===_0x4aec2d[_0xd2ed('0x73')]&&_0x1648a7[_0xd2ed('0x12')]===_0xd2ed('0xa9');});break;}if(_0x8caaba)_0x3b94b3['push'](_0x4aec2d);});_0x5a9003[_0xd2ed('0xaa')]=_0x3b94b3['length'];_0x5a9003[_0xd2ed('0xab')]=_0x3b94b3;return _0x5a9003;});}else{return _0x39c04d[_0x2b83e7[_0xd2ed('0x15')]][_0xd2ed('0xaa')]({'where':_0xdd493a[_0xd2ed('0x7f')]})['then'](function(_0x456c2c){_0x5a9003[_0xd2ed('0xaa')]=_0x456c2c;if(_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xa5')]){if(_0x2b83e7[_0xd2ed('0x15')]===_0xd2ed('0x20')){_0xdd493a[_0xd2ed('0xac')]=[{'model':_0x39c04d[_0xd2ed('0x69')],'as':'Tags','attributes':['id',_0xd2ed('0x1c'),_0xd2ed('0xad')],'required':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]?!![]:![]},{'model':_0x39c04d[_0xd2ed('0x69')],'as':_0xd2ed('0xaf'),'attributes':['id',_0xd2ed('0x1c'),_0xd2ed('0xad')],'through':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]?{'attributes':[],'where':{'TagId':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]||undefined}}:{},'required':_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xae')]?!![]:![]}];}else{_0xdd493a[_0xd2ed('0xac')]=[{'all':!![]}];}}return _0x39c04d[_0x2b83e7[_0xd2ed('0x15')]][_0xd2ed('0x8')](_0xdd493a);})[_0xd2ed('0x9')](function(_0x31f27c){_0x5a9003[_0xd2ed('0xab')]=_0x31f27c;if(_0x35bbc1===_0xd2ed('0x31')&&_0x5209a8[_0xd2ed('0x82')][_0xd2ed('0xb0')]===_0xd2ed('0xb1')){var _0x1e5b17=[];for(var _0x3121e1=0x0;_0x3121e1<_0x5a9003[_0xd2ed('0xab')][_0xd2ed('0x8a')];_0x3121e1++){_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb2'),_0x5a9003[_0xd2ed('0xab')][_0x3121e1][_0xd2ed('0xb3')]));_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb4'),_0x5a9003['rows'][_0x3121e1][_0xd2ed('0xb3')]));_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb5'),_0x5a9003['rows'][_0x3121e1]['dataValues']));_0x1e5b17['push'](_0x522700('mail',_0x5a9003[_0xd2ed('0xab')][_0x3121e1][_0xd2ed('0xb3')]));_0x1e5b17[_0xd2ed('0x8b')](_0x522700(_0xd2ed('0xb6'),_0x5a9003['rows'][_0x3121e1]['dataValues']));_0x1e5b17[_0xd2ed('0x8b')](_0x522700('whatsapp',_0x5a9003[_0xd2ed('0xab')][_0x3121e1][_0xd2ed('0xb3')]));}return Promise[_0xd2ed('0x8f')](_0x1e5b17)[_0xd2ed('0x9')](function(){return _0x5a9003;});}return _0x5a9003;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ec28c41..fae68b9 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 _0x5d0a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','UserProfile,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0xb044a4,_0x17ea0e){var _0x3e3964=function(_0x1b7d43){while(--_0x1b7d43){_0xb044a4['push'](_0xb044a4['shift']());}};_0x3e3964(++_0x17ea0e);}(_0x5d0a,0x175));var _0xa5d0=function(_0x3c6f9c,_0x119cb0){_0x3c6f9c=_0x3c6f9c-0x0;var _0x54f5b9=_0x5d0a[_0x3c6f9c];return _0x54f5b9;};'use strict';var _=require(_0xa5d0('0x0'));var util=require('util');var moment=require(_0xa5d0('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5d0('0x2'));var fs=require('fs');var Redis=require(_0xa5d0('0x3'));var db=require(_0xa5d0('0x4'))['db'];var utils=require(_0xa5d0('0x5'));var logger=require('../../config/logger')(_0xa5d0('0x6'));var config=require(_0xa5d0('0x7'));var jayson=require(_0xa5d0('0x8'));var client=jayson[_0xa5d0('0x9')][_0xa5d0('0xa')]({'port':0x232a});config[_0xa5d0('0xb')]=_[_0xa5d0('0xc')](config[_0xa5d0('0xb')],{'host':_0xa5d0('0xd'),'port':0x18eb});var socket=require(_0xa5d0('0xe'))(new Redis(config[_0xa5d0('0xb')]));require('./userProfile.socket')[_0xa5d0('0xf')](socket);function respondWithRpcPromise(_0x29a3c1,_0x1f4235,_0x23e569){return new BPromise(function(_0x14fea2,_0x23f06a){return client[_0xa5d0('0x10')](_0x29a3c1,_0x23e569)[_0xa5d0('0x11')](function(_0xc847c9){logger[_0xa5d0('0x12')]('UserProfile,\x20%s,\x20%s',_0x1f4235,_0xa5d0('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x1f4235,_0xa5d0('0x13'),JSON[_0xa5d0('0x14')](_0xc847c9));if(_0xc847c9[_0xa5d0('0x15')]){if(_0xc847c9[_0xa5d0('0x15')]['code']===0x1f4){logger['error'](_0xa5d0('0x16'),_0x1f4235,_0xc847c9[_0xa5d0('0x15')][_0xa5d0('0x17')]);return _0x23f06a(_0xc847c9[_0xa5d0('0x15')][_0xa5d0('0x17')]);}logger[_0xa5d0('0x15')](_0xa5d0('0x16'),_0x1f4235,_0xc847c9['error'][_0xa5d0('0x17')]);return _0x14fea2(_0xc847c9['error'][_0xa5d0('0x17')]);}else{logger[_0xa5d0('0x12')]('UserProfile,\x20%s,\x20%s',_0x1f4235,'request\x20sent');_0x14fea2(_0xc847c9[_0xa5d0('0x18')][_0xa5d0('0x17')]);}})['catch'](function(_0x39beba){logger[_0xa5d0('0x15')](_0xa5d0('0x16'),_0x1f4235,_0x39beba);_0x23f06a(_0x39beba);});});} \ No newline at end of file +var _0x4312=['request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x4824c1,_0x2657fa){var _0x7cd05a=function(_0x6c3aa9){while(--_0x6c3aa9){_0x4824c1['push'](_0x4824c1['shift']());}};_0x7cd05a(++_0x2657fa);}(_0x4312,0xaf));var _0x2431=function(_0x382b8f,_0x5e0c9f){_0x382b8f=_0x382b8f-0x0;var _0x4c9b0e=_0x4312[_0x382b8f];return _0x4c9b0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2431('0x0'));var BPromise=require(_0x2431('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2431('0x2'));var db=require(_0x2431('0x3'))['db'];var utils=require(_0x2431('0x4'));var logger=require(_0x2431('0x5'))(_0x2431('0x6'));var config=require(_0x2431('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2431('0x8')]['http']({'port':0x232a});config[_0x2431('0x9')]=_[_0x2431('0xa')](config['redis'],{'host':_0x2431('0xb'),'port':0x18eb});var socket=require(_0x2431('0xc'))(new Redis(config[_0x2431('0x9')]));require('./userProfile.socket')[_0x2431('0xd')](socket);function respondWithRpcPromise(_0x26b223,_0xb751e,_0x568a96){return new BPromise(function(_0x12615b,_0x4a71f2){return client[_0x2431('0xe')](_0x26b223,_0x568a96)[_0x2431('0xf')](function(_0x384711){logger['info'](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));logger[_0x2431('0x12')](_0x2431('0x13'),_0xb751e,'request\x20sent',JSON[_0x2431('0x14')](_0x384711));if(_0x384711[_0x2431('0x15')]){if(_0x384711[_0x2431('0x15')][_0x2431('0x16')]===0x1f4){logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x4a71f2(_0x384711[_0x2431('0x15')]['message']);}logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x12615b(_0x384711[_0x2431('0x15')][_0x2431('0x17')]);}else{logger[_0x2431('0x18')](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));_0x12615b(_0x384711[_0x2431('0x19')][_0x2431('0x17')]);}})[_0x2431('0x1a')](function(_0x3b1776){logger[_0x2431('0x15')]('UserProfile,\x20%s,\x20%s',_0xb751e,_0x3b1776);_0x4a71f2(_0x3b1776);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f48c8b2..d2263ec 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 _0x913b=['register','userProfile:','save','emit','removeListener'];(function(_0x241a01,_0x99cc21){var _0x19d5f8=function(_0x119d9d){while(--_0x119d9d){_0x241a01['push'](_0x241a01['shift']());}};_0x19d5f8(++_0x99cc21);}(_0x913b,0x1c9));var _0xb913=function(_0x2225c9,_0xe99b2e){_0x2225c9=_0x2225c9-0x0;var _0xe7b099=_0x913b[_0x2225c9];return _0xe7b099;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xb913('0x0'),'remove','update'];function createListener(_0x7b40f5,_0x43c4b4){return function(_0x2457fa){_0x43c4b4[_0xb913('0x1')](_0x7b40f5,_0x2457fa);};}function removeListener(_0x1ca9e7,_0x3be480){return function(){UserProfileEvents[_0xb913('0x2')](_0x1ca9e7,_0x3be480);};}exports[_0xb913('0x3')]=function(_0x48a5c4){for(var _0x3ae084=0x0,_0x543b2d=events['length'];_0x3ae084<_0x543b2d;_0x3ae084++){var _0x6e05b=events[_0x3ae084];var _0x54ab29=createListener(_0xb913('0x4')+_0x6e05b,_0x48a5c4);UserProfileEvents['on'](_0x6e05b,_0x54ab29);}}; \ No newline at end of file +var _0xec7a=['emit','removeListener','register','userProfile:','./userProfile.events','save','remove','update'];(function(_0x5eb140,_0x32d463){var _0x306bb6=function(_0x34f886){while(--_0x34f886){_0x5eb140['push'](_0x5eb140['shift']());}};_0x306bb6(++_0x32d463);}(_0xec7a,0x1bc));var _0xaec7=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xec7a[_0x9729d7];return _0x3c4ac6;};'use strict';var UserProfileEvents=require(_0xaec7('0x0'));var events=[_0xaec7('0x1'),_0xaec7('0x2'),_0xaec7('0x3')];function createListener(_0x192f3a,_0x364d6d){return function(_0x2dab87){_0x364d6d[_0xaec7('0x4')](_0x192f3a,_0x2dab87);};}function removeListener(_0x1f3fe6,_0x1dea6a){return function(){UserProfileEvents[_0xaec7('0x5')](_0x1f3fe6,_0x1dea6a);};}exports[_0xaec7('0x6')]=function(_0x37f1a5){for(var _0x273877=0x0,_0x482964=events['length'];_0x273877<_0x482964;_0x273877++){var _0x179c84=events[_0x273877];var _0x51a73d=createListener(_0xaec7('0x7')+_0x179c84,_0x37f1a5);UserProfileEvents['on'](_0x179c84,_0x51a73d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e82bcec..3b096b6 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 _0x58d3=['fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x58d3,0xaf));var _0x358d=function(_0x34cf84,_0x5872b3){_0x34cf84=_0x34cf84-0x0;var _0x5c30ab=_0x58d3[_0x34cf84];return _0x5c30ab;};'use strict';var multer=require('multer');var util=require(_0x358d('0x0'));var path=require(_0x358d('0x1'));var timeout=require(_0x358d('0x2'));var express=require(_0x358d('0x3'));var router=express[_0x358d('0x4')]();var fs_extra=require(_0x358d('0x5'));var auth=require(_0x358d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x358d('0x7'));var controller=require(_0x358d('0x8'));router[_0x358d('0x9')]('/',auth['isAuthenticated'](),controller[_0x358d('0xa')]);router[_0x358d('0x9')]('/describe',auth[_0x358d('0xb')](),controller[_0x358d('0xc')]);router[_0x358d('0x9')](_0x358d('0xd'),auth[_0x358d('0xb')](),controller[_0x358d('0xe')]);router['post']('/',auth[_0x358d('0xb')](),controller[_0x358d('0xf')]);router['put'](_0x358d('0xd'),auth[_0x358d('0xb')](),controller[_0x358d('0x10')]);router[_0x358d('0x11')]('/:id',auth[_0x358d('0xb')](),controller[_0x358d('0x12')]);module[_0x358d('0x13')]=router; \ No newline at end of file +var _0x19f6=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','update'];(function(_0x5a7680,_0x5f5b67){var _0x2c54b2=function(_0x192d06){while(--_0x192d06){_0x5a7680['push'](_0x5a7680['shift']());}};_0x2c54b2(++_0x5f5b67);}(_0x19f6,0x1ce));var _0x619f=function(_0xb4f7b4,_0x2d5d2d){_0xb4f7b4=_0xb4f7b4-0x0;var _0x52685c=_0x19f6[_0xb4f7b4];return _0x52685c;};'use strict';var multer=require(_0x619f('0x0'));var util=require(_0x619f('0x1'));var path=require(_0x619f('0x2'));var timeout=require(_0x619f('0x3'));var express=require(_0x619f('0x4'));var router=express[_0x619f('0x5')]();var fs_extra=require(_0x619f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x619f('0x7'));var config=require(_0x619f('0x8'));var controller=require('./userProfileResource.controller');router[_0x619f('0x9')]('/',auth['isAuthenticated'](),controller[_0x619f('0xa')]);router[_0x619f('0x9')](_0x619f('0xb'),auth[_0x619f('0xc')](),controller[_0x619f('0xd')]);router['get'](_0x619f('0xe'),auth[_0x619f('0xc')](),controller['show']);router[_0x619f('0xf')]('/',auth[_0x619f('0xc')](),controller[_0x619f('0x10')]);router['put'](_0x619f('0xe'),auth[_0x619f('0xc')](),controller[_0x619f('0x11')]);router[_0x619f('0x12')]('/:id',auth[_0x619f('0xc')](),controller[_0x619f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 31e100d..9659608 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 _0x2a8e=['exports','STRING','INTEGER'];(function(_0x2bce0a,_0x215e44){var _0x12f3f4=function(_0x18dbdc){while(--_0x18dbdc){_0x2bce0a['push'](_0x2bce0a['shift']());}};_0x12f3f4(++_0x215e44);}(_0x2a8e,0x14a));var _0xe2a8=function(_0x486271,_0x54803c){_0x486271=_0x486271-0x0;var _0xda6d33=_0x2a8e[_0x486271];return _0xda6d33;};'use strict';var Sequelize=require('sequelize');module[_0xe2a8('0x0')]={'name':{'type':Sequelize[_0xe2a8('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe2a8('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xf0c8=['exports','STRING','INTEGER','sequelize'];(function(_0x2696ff,_0x1d6034){var _0x207573=function(_0x5e4d87){while(--_0x5e4d87){_0x2696ff['push'](_0x2696ff['shift']());}};_0x207573(++_0x1d6034);}(_0xf0c8,0x6b));var _0x8f0c=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xf0c8[_0x1f530d];return _0x22103f;};'use strict';var Sequelize=require(_0x8f0c('0x0'));module[_0x8f0c('0x1')]={'name':{'type':Sequelize[_0x8f0c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8f0c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8f0c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 232fc60..812f137 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 _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','UserProfileResource','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x317370,_0x13ef5b){var _0x58522d=function(_0x2e82aa){while(--_0x2e82aa){_0x317370['push'](_0x317370['shift']());}};_0x58522d(++_0x13ef5b);}(_0xf61e,0x191));var _0xef61=function(_0x48207f,_0x20cb19){_0x48207f=_0x48207f-0x0;var _0x400587=_0xf61e[_0x48207f];return _0x400587;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['UserProfileResource']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['UserProfileResource'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file +var _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x57ca,0x108));var _0xa57c=function(_0x1628a8,_0x1b3a0d){_0x1628a8=_0x1628a8-0x0;var _0x312ced=_0x57ca[_0x1628a8];return _0x312ced;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e5cf6f6..91f0069 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 _0x15a8=['user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource'];(function(_0x1844cd,_0x4d9b95){var _0x22316f=function(_0x28c53d){while(--_0x28c53d){_0x1844cd['push'](_0x1844cd['shift']());}};_0x22316f(++_0x4d9b95);}(_0x15a8,0xd3));var _0x815a=function(_0x245578,_0x317768){_0x245578=_0x245578-0x0;var _0x2d09d6=_0x15a8[_0x245578];return _0x2d09d6;};'use strict';var _=require(_0x815a('0x0'));var util=require(_0x815a('0x1'));var logger=require(_0x815a('0x2'))(_0x815a('0x3'));var moment=require(_0x815a('0x4'));var BPromise=require(_0x815a('0x5'));var rp=require(_0x815a('0x6'));var fs=require('fs');var path=require(_0x815a('0x7'));var rimraf=require('rimraf');var config=require(_0x815a('0x8'));var attributes=require(_0x815a('0x9'));module[_0x815a('0xa')]=function(_0x168e49,_0x469722){return _0x168e49[_0x815a('0xb')](_0x815a('0xc'),attributes,{'tableName':_0x815a('0xd'),'paranoid':![],'indexes':[{'name':_0x815a('0xe'),'fields':['resourceId',_0x815a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56b1=['./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e169e,_0xed2bf){var _0x1dc0d7=function(_0x99d89f){while(--_0x99d89f){_0x3e169e['push'](_0x3e169e['shift']());}};_0x1dc0d7(++_0xed2bf);}(_0x56b1,0x67));var _0x156b=function(_0x5a850c,_0x349ff1){_0x5a850c=_0x5a850c-0x0;var _0x1fc963=_0x56b1[_0x5a850c];return _0x1fc963;};'use strict';var _=require(_0x156b('0x0'));var util=require(_0x156b('0x1'));var logger=require(_0x156b('0x2'))('api');var moment=require(_0x156b('0x3'));var BPromise=require(_0x156b('0x4'));var rp=require(_0x156b('0x5'));var fs=require('fs');var path=require(_0x156b('0x6'));var rimraf=require(_0x156b('0x7'));var config=require(_0x156b('0x8'));var attributes=require(_0x156b('0x9'));module[_0x156b('0xa')]=function(_0x256e78,_0x216fb5){return _0x256e78['define']('UserProfileResource',attributes,{'tableName':_0x156b('0xb'),'paranoid':![],'indexes':[{'name':_0x156b('0xc'),'fields':['resourceId',_0x156b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4e9bbd3..319f1f8 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 _0xaf10=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s'];(function(_0x29a4a2,_0x213002){var _0x11ed0a=function(_0x773557){while(--_0x773557){_0x29a4a2['push'](_0x29a4a2['shift']());}};_0x11ed0a(++_0x213002);}(_0xaf10,0xc3));var _0x0af1=function(_0x27f978,_0x4b6e76){_0x27f978=_0x27f978-0x0;var _0x308b22=_0xaf10[_0x27f978];return _0x308b22;};'use strict';var _=require('lodash');var util=require(_0x0af1('0x0'));var moment=require(_0x0af1('0x1'));var BPromise=require(_0x0af1('0x2'));var rs=require(_0x0af1('0x3'));var fs=require('fs');var Redis=require(_0x0af1('0x4'));var db=require(_0x0af1('0x5'))['db'];var utils=require(_0x0af1('0x6'));var logger=require(_0x0af1('0x7'))(_0x0af1('0x8'));var config=require(_0x0af1('0x9'));var jayson=require(_0x0af1('0xa'));var client=jayson[_0x0af1('0xb')][_0x0af1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x526f57,_0x177bcf,_0x2a808c){return new BPromise(function(_0x16794f,_0x2dfd27){return client['request'](_0x526f57,_0x2a808c)[_0x0af1('0xd')](function(_0x3a76a1){logger[_0x0af1('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x177bcf,_0x0af1('0xf'));logger[_0x0af1('0x10')](_0x0af1('0x11'),_0x177bcf,_0x0af1('0xf'),JSON['stringify'](_0x3a76a1));if(_0x3a76a1['error']){if(_0x3a76a1[_0x0af1('0x12')][_0x0af1('0x13')]===0x1f4){logger[_0x0af1('0x12')](_0x0af1('0x14'),_0x177bcf,_0x3a76a1[_0x0af1('0x12')]['message']);return _0x2dfd27(_0x3a76a1[_0x0af1('0x12')][_0x0af1('0x15')]);}logger[_0x0af1('0x12')](_0x0af1('0x14'),_0x177bcf,_0x3a76a1[_0x0af1('0x12')][_0x0af1('0x15')]);return _0x16794f(_0x3a76a1[_0x0af1('0x12')][_0x0af1('0x15')]);}else{logger[_0x0af1('0xe')](_0x0af1('0x14'),_0x177bcf,_0x0af1('0xf'));_0x16794f(_0x3a76a1[_0x0af1('0x16')][_0x0af1('0x15')]);}})[_0x0af1('0x17')](function(_0x27a9b1){logger[_0x0af1('0x12')](_0x0af1('0x14'),_0x177bcf,_0x27a9b1);_0x2dfd27(_0x27a9b1);});});} \ No newline at end of file +var _0xbd3c=['randomstring','../../config/utils','../../config/logger','rpc','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xbd3c,0x13e));var _0xcbd3=function(_0x4821ef,_0x4b1e53){_0x4821ef=_0x4821ef-0x0;var _0x35e7a3=_0xbd3c[_0x4821ef];return _0x35e7a3;};'use strict';var _=require(_0xcbd3('0x0'));var util=require(_0xcbd3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcbd3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcbd3('0x3'));var logger=require(_0xcbd3('0x4'))(_0xcbd3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xcbd3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd90034,_0x2960f4,_0x55595b){return new BPromise(function(_0x4e5c55,_0x59f5f9){return client[_0xcbd3('0x7')](_0xd90034,_0x55595b)['then'](function(_0x1dea67){logger[_0xcbd3('0x8')](_0xcbd3('0x9'),_0x2960f4,_0xcbd3('0xa'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2960f4,_0xcbd3('0xa'),JSON[_0xcbd3('0xb')](_0x1dea67));if(_0x1dea67[_0xcbd3('0xc')]){if(_0x1dea67['error'][_0xcbd3('0xd')]===0x1f4){logger[_0xcbd3('0xc')](_0xcbd3('0x9'),_0x2960f4,_0x1dea67[_0xcbd3('0xc')][_0xcbd3('0xe')]);return _0x59f5f9(_0x1dea67[_0xcbd3('0xc')]['message']);}logger[_0xcbd3('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x2960f4,_0x1dea67[_0xcbd3('0xc')][_0xcbd3('0xe')]);return _0x4e5c55(_0x1dea67[_0xcbd3('0xc')]['message']);}else{logger[_0xcbd3('0x8')](_0xcbd3('0x9'),_0x2960f4,_0xcbd3('0xa'));_0x4e5c55(_0x1dea67[_0xcbd3('0xf')][_0xcbd3('0xe')]);}})['catch'](function(_0x13ba97){logger[_0xcbd3('0xc')](_0xcbd3('0x9'),_0x2960f4,_0x13ba97);_0x59f5f9(_0x13ba97);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a75894b..ffda437 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 _0x191c=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x520bf6,_0x4e9358){var _0x3f1e3e=function(_0x2d5fc9){while(--_0x2d5fc9){_0x520bf6['push'](_0x520bf6['shift']());}};_0x3f1e3e(++_0x4e9358);}(_0x191c,0xe9));var _0xc191=function(_0x52db2b,_0x5cc567){_0x52db2b=_0x52db2b-0x0;var _0x521133=_0x191c[_0x52db2b];return _0x521133;};'use strict';var multer=require(_0xc191('0x0'));var util=require(_0xc191('0x1'));var path=require(_0xc191('0x2'));var timeout=require(_0xc191('0x3'));var express=require(_0xc191('0x4'));var router=express['Router']();var fs_extra=require(_0xc191('0x5'));var auth=require(_0xc191('0x6'));var interaction=require(_0xc191('0x7'));var config=require(_0xc191('0x8'));var controller=require(_0xc191('0x9'));router[_0xc191('0xa')]('/',auth[_0xc191('0xb')](),controller['index']);router[_0xc191('0xa')](_0xc191('0xc'),auth[_0xc191('0xb')](),controller[_0xc191('0xd')]);router[_0xc191('0xa')]('/:id',auth[_0xc191('0xb')](),controller[_0xc191('0xe')]);router[_0xc191('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc191('0x10')]('/:id',auth[_0xc191('0xb')](),controller[_0xc191('0x11')]);router[_0xc191('0x12')](_0xc191('0x13'),auth[_0xc191('0xb')](),controller[_0xc191('0x14')]);module[_0xc191('0x15')]=router; \ No newline at end of file +var _0x56ba=['index','/describe','describe','/:id','post','create','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated'];(function(_0x58dca4,_0x5dd8dc){var _0x4b1ca3=function(_0x7ef314){while(--_0x7ef314){_0x58dca4['push'](_0x58dca4['shift']());}};_0x4b1ca3(++_0x5dd8dc);}(_0x56ba,0x171));var _0xa56b=function(_0x3eca59,_0x365394){_0x3eca59=_0x3eca59-0x0;var _0x55ae55=_0x56ba[_0x3eca59];return _0x55ae55;};'use strict';var multer=require(_0xa56b('0x0'));var util=require(_0xa56b('0x1'));var path=require('path');var timeout=require(_0xa56b('0x2'));var express=require(_0xa56b('0x3'));var router=express['Router']();var fs_extra=require(_0xa56b('0x4'));var auth=require(_0xa56b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa56b('0x6'));router[_0xa56b('0x7')]('/',auth[_0xa56b('0x8')](),controller[_0xa56b('0x9')]);router['get'](_0xa56b('0xa'),auth['isAuthenticated'](),controller[_0xa56b('0xb')]);router[_0xa56b('0x7')](_0xa56b('0xc'),auth[_0xa56b('0x8')](),controller['show']);router[_0xa56b('0xd')]('/',auth['isAuthenticated'](),controller[_0xa56b('0xe')]);router['put']('/:id',auth[_0xa56b('0x8')](),controller[_0xa56b('0xf')]);router['delete'](_0xa56b('0xc'),auth[_0xa56b('0x8')](),controller[_0xa56b('0x10')]);module[_0xa56b('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7be7069..8b9f18e 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 _0x6b20=['getDataValue','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x58bce0,_0x384c6e){var _0x13b726=function(_0x5e1fcb){while(--_0x5e1fcb){_0x58bce0['push'](_0x58bce0['shift']());}};_0x13b726(++_0x384c6e);}(_0x6b20,0xd1));var _0x06b2=function(_0x2e1a3a,_0x56e42f){_0x2e1a3a=_0x2e1a3a-0x0;var _0x3cfbc0=_0x6b20[_0x2e1a3a];return _0x3cfbc0;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x06b2('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x06b2('0x2')],'set':function(_0x5ba392){this[_0x06b2('0x4')](_0x06b2('0x5'),_0x5ba392?_0x5ba392[_0x06b2('0x6')](''):[]);},'get':function(){return this[_0x06b2('0x7')](_0x06b2('0x5'))?this[_0x06b2('0x7')](_0x06b2('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb62e,0x1de));var _0xeb62=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb62e[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d174de4..e7653d4 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 _0x27cf=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','UserProfileSection','rawAttributes','type','key','model','name','query','intersection','fields','attributes','length','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27cf,0x82));var _0xf27c=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x27cf[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf27c('0x0'));var zipdir=require(_0xf27c('0x1'));var jsonpatch=require(_0xf27c('0x2'));var rp=require(_0xf27c('0x3'));var moment=require(_0xf27c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf27c('0x5'));var util=require('util');var path=require(_0xf27c('0x6'));var sox=require(_0xf27c('0x7'));var csv=require(_0xf27c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf27c('0x9'));var _=require(_0xf27c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf27c('0xb'));var toCsv=require(_0xf27c('0x8'));var querystring=require(_0xf27c('0xc'));var Papa=require(_0xf27c('0xd'));var Redis=require(_0xf27c('0xe'));var authService=require(_0xf27c('0xf'));var qs=require(_0xf27c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf27c('0x11'));var logger=require(_0xf27c('0x12'))(_0xf27c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf27c('0x14'));var db=require(_0xf27c('0x15'))['db'];function respondWithStatusCode(_0x54e68f,_0x452eba){_0x452eba=_0x452eba||0xcc;return function(_0x135887){if(_0x135887){return _0x54e68f[_0xf27c('0x16')](_0x452eba);}return _0x54e68f[_0xf27c('0x17')](_0x452eba)[_0xf27c('0x18')]();};}function respondWithResult(_0x298eae,_0x3e6324){_0x3e6324=_0x3e6324||0xc8;return function(_0x7a4401){if(_0x7a4401){return _0x298eae[_0xf27c('0x17')](_0x3e6324)[_0xf27c('0x19')](_0x7a4401);}};}function respondWithFilteredResult(_0x579bf6,_0x57e131){return function(_0x3984f8){if(_0x3984f8){var _0x837271=typeof _0x57e131[_0xf27c('0x1a')]===_0xf27c('0x1b')&&typeof _0x57e131[_0xf27c('0x1c')]===_0xf27c('0x1b');var _0x5099d1=_0x3984f8['count'];var _0x5cbded=_0x837271?0x0:_0x57e131[_0xf27c('0x1a')];var _0x372924=_0x837271?_0x3984f8[_0xf27c('0x1d')]:_0x57e131[_0xf27c('0x1a')]+_0x57e131[_0xf27c('0x1c')];var _0xaf29a;if(_0x372924>=_0x5099d1){_0x372924=_0x5099d1;_0xaf29a=0xc8;}else{_0xaf29a=0xce;}_0x579bf6[_0xf27c('0x17')](_0xaf29a);return _0x579bf6[_0xf27c('0x1e')](_0xf27c('0x1f'),_0x5cbded+'-'+_0x372924+'/'+_0x5099d1)[_0xf27c('0x19')](_0x3984f8);}return null;};}function patchUpdates(_0x5815d2){return function(_0x19a963){try{jsonpatch[_0xf27c('0x20')](_0x19a963,_0x5815d2,!![]);}catch(_0x2fdc0e){return BPromise['reject'](_0x2fdc0e);}return _0x19a963[_0xf27c('0x21')]();};}function saveUpdates(_0x3967eb,_0x3ce56c){return function(_0x563002){if(_0x563002){return _0x563002[_0xf27c('0x22')](_0x3967eb)[_0xf27c('0x23')](function(_0x55d119){return _0x55d119;});}return null;};}function removeEntity(_0xf0c1b7,_0x400bb2){return function(_0x41e74e){if(_0x41e74e){return _0x41e74e[_0xf27c('0x24')]()[_0xf27c('0x23')](function(){_0xf0c1b7[_0xf27c('0x17')](0xcc)[_0xf27c('0x18')]();});}};}function handleEntityNotFound(_0x51a31c,_0x305dcf){return function(_0x48d0b0){if(!_0x48d0b0){_0x51a31c[_0xf27c('0x16')](0x194);}return _0x48d0b0;};}function handleError(_0x6d93d3,_0x19651f){_0x19651f=_0x19651f||0x1f4;return function(_0xad0bfd){logger[_0xf27c('0x25')](_0xad0bfd[_0xf27c('0x26')]);if(_0xad0bfd['name']){delete _0xad0bfd['name'];}_0x6d93d3[_0xf27c('0x17')](_0x19651f)[_0xf27c('0x27')](_0xad0bfd);};}exports[_0xf27c('0x28')]=function(_0x15ea73,_0x4c71a6){var _0x53d8ce={},_0x319030={},_0x27e38c={'count':0x0,'rows':[]};var _0x4b0f7f=_[_0xf27c('0x29')](db[_0xf27c('0x2a')][_0xf27c('0x2b')],function(_0x129226){return{'name':_0x129226['fieldName'],'type':_0x129226[_0xf27c('0x2c')][_0xf27c('0x2d')]};});_0x319030[_0xf27c('0x2e')]=_['map'](_0x4b0f7f,_0xf27c('0x2f'));_0x319030[_0xf27c('0x30')]=_['keys'](_0x15ea73[_0xf27c('0x30')]);_0x319030['filters']=_[_0xf27c('0x31')](_0x319030[_0xf27c('0x2e')],_0x319030[_0xf27c('0x30')]);_0x53d8ce['attributes']=_[_0xf27c('0x31')](_0x319030[_0xf27c('0x2e')],qs[_0xf27c('0x32')](_0x15ea73[_0xf27c('0x30')]['fields']));_0x53d8ce[_0xf27c('0x33')]=_0x53d8ce[_0xf27c('0x33')][_0xf27c('0x34')]?_0x53d8ce['attributes']:_0x319030[_0xf27c('0x2e')];if(!_0x15ea73['query']['hasOwnProperty'](_0xf27c('0x35'))){_0x53d8ce['limit']=qs['limit'](_0x15ea73[_0xf27c('0x30')][_0xf27c('0x1c')]);_0x53d8ce['offset']=qs[_0xf27c('0x1a')](_0x15ea73[_0xf27c('0x30')][_0xf27c('0x1a')]);}_0x53d8ce['order']=qs[_0xf27c('0x36')](_0x15ea73[_0xf27c('0x30')][_0xf27c('0x36')]);_0x53d8ce['where']=qs[_0xf27c('0x37')](_['pick'](_0x15ea73[_0xf27c('0x30')],_0x319030[_0xf27c('0x37')]),_0x4b0f7f);if(_0x15ea73[_0xf27c('0x30')][_0xf27c('0x38')]){_0x53d8ce[_0xf27c('0x39')]=_['merge'](_0x53d8ce[_0xf27c('0x39')],{'$or':_['map'](_0x4b0f7f,function(_0x41c623){if(_0x41c623[_0xf27c('0x2c')]!==_0xf27c('0x3a')){var _0x2bb819={};_0x2bb819[_0x41c623[_0xf27c('0x2f')]]={'$like':'%'+_0x15ea73[_0xf27c('0x30')][_0xf27c('0x38')]+'%'};return _0x2bb819;}})});}_0x53d8ce=_[_0xf27c('0x3b')]({},_0x53d8ce,_0x15ea73[_0xf27c('0x3c')]);var _0x27691f={'where':_0x53d8ce[_0xf27c('0x39')]};return db['UserProfileSection']['count'](_0x27691f)[_0xf27c('0x23')](function(_0x2a4ddd){_0x27e38c[_0xf27c('0x1d')]=_0x2a4ddd;if(_0x15ea73[_0xf27c('0x30')][_0xf27c('0x3d')]){_0x53d8ce[_0xf27c('0x3e')]=[{'all':!![]}];}return db[_0xf27c('0x2a')][_0xf27c('0x3f')](_0x53d8ce);})[_0xf27c('0x23')](function(_0x876ce9){_0x27e38c[_0xf27c('0x40')]=_0x876ce9;return _0x27e38c;})[_0xf27c('0x23')](respondWithFilteredResult(_0x4c71a6,_0x53d8ce))[_0xf27c('0x41')](handleError(_0x4c71a6,null));};exports[_0xf27c('0x42')]=function(_0x1af802,_0x377bb1){var _0x416740={'raw':![],'where':{'id':_0x1af802[_0xf27c('0x43')]['id']}},_0x9476fa={};_0x9476fa['model']=_[_0xf27c('0x44')](db[_0xf27c('0x2a')]['rawAttributes']);_0x9476fa[_0xf27c('0x30')]=_[_0xf27c('0x44')](_0x1af802[_0xf27c('0x30')]);_0x9476fa[_0xf27c('0x37')]=_[_0xf27c('0x31')](_0x9476fa[_0xf27c('0x2e')],_0x9476fa[_0xf27c('0x30')]);_0x416740['attributes']=_[_0xf27c('0x31')](_0x9476fa[_0xf27c('0x2e')],qs[_0xf27c('0x32')](_0x1af802[_0xf27c('0x30')]['fields']));_0x416740['attributes']=_0x416740['attributes'][_0xf27c('0x34')]?_0x416740[_0xf27c('0x33')]:_0x9476fa[_0xf27c('0x2e')];if(_0x1af802['query'][_0xf27c('0x3d')]){_0x416740[_0xf27c('0x3e')]=[{'all':!![]}];}_0x416740=_[_0xf27c('0x3b')]({},_0x416740,_0x1af802[_0xf27c('0x3c')]);return db[_0xf27c('0x2a')][_0xf27c('0x45')](_0x416740)[_0xf27c('0x23')](handleEntityNotFound(_0x377bb1,null))[_0xf27c('0x23')](respondWithResult(_0x377bb1,null))[_0xf27c('0x41')](handleError(_0x377bb1,null));};exports['create']=function(_0x2552e2,_0x2f4b92){return db['UserProfileSection'][_0xf27c('0x46')](_0x2552e2[_0xf27c('0x47')],{})[_0xf27c('0x23')](respondWithResult(_0x2f4b92,0xc9))['catch'](handleError(_0x2f4b92,null));};exports['update']=function(_0x525463,_0x394172){if(_0x525463[_0xf27c('0x47')]['id']){delete _0x525463[_0xf27c('0x47')]['id'];}return db[_0xf27c('0x2a')][_0xf27c('0x45')]({'where':{'id':_0x525463[_0xf27c('0x43')]['id']}})['then'](handleEntityNotFound(_0x394172,null))[_0xf27c('0x23')](saveUpdates(_0x525463[_0xf27c('0x47')],null))['then'](respondWithResult(_0x394172,null))[_0xf27c('0x41')](handleError(_0x394172,null));};exports['destroy']=function(_0x957493,_0x140f43){return db['UserProfileSection'][_0xf27c('0x45')]({'where':{'id':_0x957493[_0xf27c('0x43')]['id']}})[_0xf27c('0x23')](handleEntityNotFound(_0x140f43,null))[_0xf27c('0x23')](removeEntity(_0x140f43,null))[_0xf27c('0x41')](handleError(_0x140f43,null));};exports[_0xf27c('0x48')]=function(_0x3be035,_0x4d01a7){return db[_0xf27c('0x2a')]['describe']()[_0xf27c('0x23')](respondWithResult(_0x4d01a7,null))[_0xf27c('0x41')](handleError(_0x4d01a7,null));}; \ No newline at end of file +var _0x5472=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','send','index','map','UserProfileSection','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','merge','where','VIRTUAL','filter','options','rows','catch','params','rawAttributes','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x16fbff,_0x244266){var _0x547b30=function(_0x448a2e){while(--_0x448a2e){_0x16fbff['push'](_0x16fbff['shift']());}};_0x547b30(++_0x244266);}(_0x5472,0x1ab));var _0x2547=function(_0x40e13e,_0x376d13){_0x40e13e=_0x40e13e-0x0;var _0x5db39e=_0x5472[_0x40e13e];return _0x5db39e;};'use strict';var emlformat=require(_0x2547('0x0'));var rimraf=require(_0x2547('0x1'));var zipdir=require(_0x2547('0x2'));var jsonpatch=require(_0x2547('0x3'));var rp=require(_0x2547('0x4'));var moment=require(_0x2547('0x5'));var BPromise=require(_0x2547('0x6'));var Mustache=require(_0x2547('0x7'));var util=require(_0x2547('0x8'));var path=require(_0x2547('0x9'));var sox=require(_0x2547('0xa'));var csv=require('to-csv');var ejs=require(_0x2547('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2547('0xc'));var squel=require(_0x2547('0xd'));var crypto=require(_0x2547('0xe'));var jsforce=require(_0x2547('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2547('0x10'));var querystring=require(_0x2547('0x11'));var Papa=require(_0x2547('0x12'));var Redis=require(_0x2547('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2547('0x14'));var as=require(_0x2547('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2547('0x16'))(_0x2547('0x17'));var utils=require(_0x2547('0x18'));var config=require(_0x2547('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2547('0x1a'))['db'];function respondWithStatusCode(_0x407da5,_0x24f78c){_0x24f78c=_0x24f78c||0xcc;return function(_0x498214){if(_0x498214){return _0x407da5[_0x2547('0x1b')](_0x24f78c);}return _0x407da5[_0x2547('0x1c')](_0x24f78c)[_0x2547('0x1d')]();};}function respondWithResult(_0x3dda25,_0x3de7dd){_0x3de7dd=_0x3de7dd||0xc8;return function(_0x400e72){if(_0x400e72){return _0x3dda25[_0x2547('0x1c')](_0x3de7dd)[_0x2547('0x1e')](_0x400e72);}};}function respondWithFilteredResult(_0x11ed31,_0x3adca6){return function(_0x35d0aa){if(_0x35d0aa){var _0x35ff77=typeof _0x3adca6[_0x2547('0x1f')]===_0x2547('0x20')&&typeof _0x3adca6['limit']===_0x2547('0x20');var _0x36b859=_0x35d0aa[_0x2547('0x21')];var _0xe064a7=_0x35ff77?0x0:_0x3adca6[_0x2547('0x1f')];var _0x14df9b=_0x35ff77?_0x35d0aa[_0x2547('0x21')]:_0x3adca6[_0x2547('0x1f')]+_0x3adca6[_0x2547('0x22')];var _0x427a23;if(_0x14df9b>=_0x36b859){_0x14df9b=_0x36b859;_0x427a23=0xc8;}else{_0x427a23=0xce;}_0x11ed31[_0x2547('0x1c')](_0x427a23);return _0x11ed31[_0x2547('0x23')](_0x2547('0x24'),_0xe064a7+'-'+_0x14df9b+'/'+_0x36b859)['json'](_0x35d0aa);}return null;};}function patchUpdates(_0x2e10bd){return function(_0x25ad79){try{jsonpatch[_0x2547('0x25')](_0x25ad79,_0x2e10bd,!![]);}catch(_0x507e6b){return BPromise[_0x2547('0x26')](_0x507e6b);}return _0x25ad79['save']();};}function saveUpdates(_0x5c92a2,_0x402e5d){return function(_0x5609a9){if(_0x5609a9){return _0x5609a9[_0x2547('0x27')](_0x5c92a2)[_0x2547('0x28')](function(_0x3e3e74){return _0x3e3e74;});}return null;};}function removeEntity(_0x2dcf64,_0x5460d3){return function(_0x419f50){if(_0x419f50){return _0x419f50['destroy']()[_0x2547('0x28')](function(){_0x2dcf64[_0x2547('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x513d46,_0x4403a6){return function(_0x92a18b){if(!_0x92a18b){_0x513d46[_0x2547('0x1b')](0x194);}return _0x92a18b;};}function handleError(_0x2a0f4e,_0x4cff10){_0x4cff10=_0x4cff10||0x1f4;return function(_0x2c333d){logger[_0x2547('0x29')](_0x2c333d['stack']);if(_0x2c333d['name']){delete _0x2c333d['name'];}_0x2a0f4e[_0x2547('0x1c')](_0x4cff10)[_0x2547('0x2a')](_0x2c333d);};}exports[_0x2547('0x2b')]=function(_0x1f114e,_0x2b1dca){var _0x183371={},_0x372127={},_0x5b39ab={'count':0x0,'rows':[]};var _0x36df99=_[_0x2547('0x2c')](db[_0x2547('0x2d')]['rawAttributes'],function(_0x4c1510){return{'name':_0x4c1510[_0x2547('0x2e')],'type':_0x4c1510[_0x2547('0x2f')][_0x2547('0x30')]};});_0x372127[_0x2547('0x31')]=_[_0x2547('0x2c')](_0x36df99,_0x2547('0x32'));_0x372127[_0x2547('0x33')]=_[_0x2547('0x34')](_0x1f114e['query']);_0x372127[_0x2547('0x35')]=_[_0x2547('0x36')](_0x372127[_0x2547('0x31')],_0x372127[_0x2547('0x33')]);_0x183371['attributes']=_[_0x2547('0x36')](_0x372127['model'],qs[_0x2547('0x37')](_0x1f114e[_0x2547('0x33')]['fields']));_0x183371['attributes']=_0x183371[_0x2547('0x38')]['length']?_0x183371[_0x2547('0x38')]:_0x372127['model'];if(!_0x1f114e['query'][_0x2547('0x39')]('nolimit')){_0x183371['limit']=qs['limit'](_0x1f114e['query'][_0x2547('0x22')]);_0x183371[_0x2547('0x1f')]=qs[_0x2547('0x1f')](_0x1f114e[_0x2547('0x33')]['offset']);}_0x183371['order']=qs[_0x2547('0x3a')](_0x1f114e['query'][_0x2547('0x3a')]);_0x183371['where']=qs[_0x2547('0x35')](_[_0x2547('0x3b')](_0x1f114e[_0x2547('0x33')],_0x372127[_0x2547('0x35')]),_0x36df99);if(_0x1f114e[_0x2547('0x33')]['filter']){_0x183371['where']=_[_0x2547('0x3c')](_0x183371[_0x2547('0x3d')],{'$or':_[_0x2547('0x2c')](_0x36df99,function(_0x5828e4){if(_0x5828e4['type']!==_0x2547('0x3e')){var _0x3f5d40={};_0x3f5d40[_0x5828e4[_0x2547('0x32')]]={'$like':'%'+_0x1f114e[_0x2547('0x33')][_0x2547('0x3f')]+'%'};return _0x3f5d40;}})});}_0x183371=_[_0x2547('0x3c')]({},_0x183371,_0x1f114e[_0x2547('0x40')]);var _0x246da2={'where':_0x183371[_0x2547('0x3d')]};return db['UserProfileSection'][_0x2547('0x21')](_0x246da2)[_0x2547('0x28')](function(_0x3fb304){_0x5b39ab[_0x2547('0x21')]=_0x3fb304;if(_0x1f114e['query']['includeAll']){_0x183371['include']=[{'all':!![]}];}return db[_0x2547('0x2d')]['findAll'](_0x183371);})[_0x2547('0x28')](function(_0xf40a82){_0x5b39ab[_0x2547('0x41')]=_0xf40a82;return _0x5b39ab;})['then'](respondWithFilteredResult(_0x2b1dca,_0x183371))[_0x2547('0x42')](handleError(_0x2b1dca,null));};exports['show']=function(_0x399951,_0x5dec7a){var _0x8c122e={'raw':![],'where':{'id':_0x399951[_0x2547('0x43')]['id']}},_0x4a1ec6={};_0x4a1ec6[_0x2547('0x31')]=_['keys'](db[_0x2547('0x2d')][_0x2547('0x44')]);_0x4a1ec6['query']=_[_0x2547('0x34')](_0x399951[_0x2547('0x33')]);_0x4a1ec6['filters']=_[_0x2547('0x36')](_0x4a1ec6[_0x2547('0x31')],_0x4a1ec6['query']);_0x8c122e[_0x2547('0x38')]=_['intersection'](_0x4a1ec6[_0x2547('0x31')],qs[_0x2547('0x37')](_0x399951['query'][_0x2547('0x37')]));_0x8c122e[_0x2547('0x38')]=_0x8c122e[_0x2547('0x38')][_0x2547('0x45')]?_0x8c122e[_0x2547('0x38')]:_0x4a1ec6[_0x2547('0x31')];if(_0x399951['query'][_0x2547('0x46')]){_0x8c122e[_0x2547('0x47')]=[{'all':!![]}];}_0x8c122e=_[_0x2547('0x3c')]({},_0x8c122e,_0x399951['options']);return db['UserProfileSection'][_0x2547('0x48')](_0x8c122e)[_0x2547('0x28')](handleEntityNotFound(_0x5dec7a,null))['then'](respondWithResult(_0x5dec7a,null))[_0x2547('0x42')](handleError(_0x5dec7a,null));};exports[_0x2547('0x49')]=function(_0x3d3258,_0x597949){return db[_0x2547('0x2d')][_0x2547('0x49')](_0x3d3258[_0x2547('0x4a')],{})[_0x2547('0x28')](respondWithResult(_0x597949,0xc9))[_0x2547('0x42')](handleError(_0x597949,null));};exports[_0x2547('0x27')]=function(_0x52e411,_0x3746a0){if(_0x52e411[_0x2547('0x4a')]['id']){delete _0x52e411[_0x2547('0x4a')]['id'];}return db[_0x2547('0x2d')][_0x2547('0x48')]({'where':{'id':_0x52e411['params']['id']}})[_0x2547('0x28')](handleEntityNotFound(_0x3746a0,null))[_0x2547('0x28')](saveUpdates(_0x52e411[_0x2547('0x4a')],null))[_0x2547('0x28')](respondWithResult(_0x3746a0,null))[_0x2547('0x42')](handleError(_0x3746a0,null));};exports['destroy']=function(_0x565653,_0x1c6bbc){return db[_0x2547('0x2d')][_0x2547('0x48')]({'where':{'id':_0x565653[_0x2547('0x43')]['id']}})[_0x2547('0x28')](handleEntityNotFound(_0x1c6bbc,null))['then'](removeEntity(_0x1c6bbc,null))['catch'](handleError(_0x1c6bbc,null));};exports[_0x2547('0x4b')]=function(_0xe49e71,_0xd1f58e){return db[_0x2547('0x2d')][_0x2547('0x4b')]()['then'](respondWithResult(_0xd1f58e,null))[_0x2547('0x42')](handleError(_0xd1f58e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 01ec168..1331512 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 _0x2b94=['define','user_profile_has_sections','compositeIndex','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x2b94,0xad));var _0x42b9=function(_0x12fc3e,_0x2666d4){_0x12fc3e=_0x12fc3e-0x0;var _0x4a7003=_0x2b94[_0x12fc3e];return _0x4a7003;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42b9('0x0'))('api');var moment=require(_0x42b9('0x1'));var BPromise=require(_0x42b9('0x2'));var rp=require(_0x42b9('0x3'));var fs=require('fs');var path=require(_0x42b9('0x4'));var rimraf=require('rimraf');var config=require(_0x42b9('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x42b9('0x6')]=function(_0x336f01,_0x23f681){return _0x336f01[_0x42b9('0x7')]('UserProfileSection',attributes,{'tableName':_0x42b9('0x8'),'paranoid':![],'indexes':[{'name':_0x42b9('0x9'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa733=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger'];(function(_0x290a56,_0x5c540a){var _0x89610=function(_0x4e901f){while(--_0x4e901f){_0x290a56['push'](_0x290a56['shift']());}};_0x89610(++_0x5c540a);}(_0xa733,0xee));var _0x3a73=function(_0x1aebd7,_0x4618ff){_0x1aebd7=_0x1aebd7-0x0;var _0x2a238a=_0xa733[_0x1aebd7];return _0x2a238a;};'use strict';var _=require('lodash');var util=require(_0x3a73('0x0'));var logger=require(_0x3a73('0x1'))('api');var moment=require(_0x3a73('0x2'));var BPromise=require(_0x3a73('0x3'));var rp=require(_0x3a73('0x4'));var fs=require('fs');var path=require(_0x3a73('0x5'));var rimraf=require(_0x3a73('0x6'));var config=require(_0x3a73('0x7'));var attributes=require(_0x3a73('0x8'));module[_0x3a73('0x9')]=function(_0x493b84,_0x5c2f12){return _0x493b84[_0x3a73('0xa')](_0x3a73('0xb'),attributes,{'tableName':_0x3a73('0xc'),'paranoid':![],'indexes':[{'name':_0x3a73('0xd'),'fields':['sectionId',_0x3a73('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1460d99..e318465 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 _0xa830=['moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','info','result','catch','lodash','util'];(function(_0x452fcd,_0x44151a){var _0x30ad14=function(_0x587b2d){while(--_0x587b2d){_0x452fcd['push'](_0x452fcd['shift']());}};_0x30ad14(++_0x44151a);}(_0xa830,0xda));var _0x0a83=function(_0x3a2fe5,_0x4f3adf){_0x3a2fe5=_0x3a2fe5-0x0;var _0x5aacd1=_0xa830[_0x3a2fe5];return _0x5aacd1;};'use strict';var _=require(_0x0a83('0x0'));var util=require(_0x0a83('0x1'));var moment=require(_0x0a83('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a83('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a83('0x4'))(_0x0a83('0x5'));var config=require(_0x0a83('0x6'));var jayson=require(_0x0a83('0x7'));var client=jayson[_0x0a83('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x507bf8,_0x43d1c4,_0x450a18){return new BPromise(function(_0x37d60a,_0x4b8729){return client['request'](_0x507bf8,_0x450a18)[_0x0a83('0x9')](function(_0x505686){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x43d1c4,_0x0a83('0xa'));logger[_0x0a83('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x43d1c4,_0x0a83('0xa'),JSON[_0x0a83('0xc')](_0x505686));if(_0x505686['error']){if(_0x505686[_0x0a83('0xd')][_0x0a83('0xe')]===0x1f4){logger[_0x0a83('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x43d1c4,_0x505686[_0x0a83('0xd')][_0x0a83('0xf')]);return _0x4b8729(_0x505686[_0x0a83('0xd')]['message']);}logger[_0x0a83('0xd')](_0x0a83('0x10'),_0x43d1c4,_0x505686[_0x0a83('0xd')][_0x0a83('0xf')]);return _0x37d60a(_0x505686[_0x0a83('0xd')][_0x0a83('0xf')]);}else{logger[_0x0a83('0x11')](_0x0a83('0x10'),_0x43d1c4,_0x0a83('0xa'));_0x37d60a(_0x505686[_0x0a83('0x12')][_0x0a83('0xf')]);}})[_0x0a83('0x13')](function(_0x20b19a){logger[_0x0a83('0xd')](_0x0a83('0x10'),_0x43d1c4,_0x20b19a);_0x4b8729(_0x20b19a);});});} \ No newline at end of file +var _0xd46c=['UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x15d308,_0x273bdd){var _0x49740f=function(_0x2ec06d){while(--_0x2ec06d){_0x15d308['push'](_0x15d308['shift']());}};_0x49740f(++_0x273bdd);}(_0xd46c,0x1a7));var _0xcd46=function(_0x58b665,_0x19d106){_0x58b665=_0x58b665-0x0;var _0x4829cf=_0xd46c[_0x58b665];return _0x4829cf;};'use strict';var _=require(_0xcd46('0x0'));var util=require(_0xcd46('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd46('0x2'))(_0xcd46('0x3'));var config=require('../../config/environment');var jayson=require(_0xcd46('0x4'));var client=jayson[_0xcd46('0x5')][_0xcd46('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x37e276,_0x5ca978,_0x25d685){return new BPromise(function(_0x5a1e70,_0x3b1d75){return client[_0xcd46('0x7')](_0x37e276,_0x25d685)['then'](function(_0x5557a2){logger[_0xcd46('0x8')](_0xcd46('0x9'),_0x5ca978,_0xcd46('0xa'));logger[_0xcd46('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5ca978,_0xcd46('0xa'),JSON[_0xcd46('0xc')](_0x5557a2));if(_0x5557a2[_0xcd46('0xd')]){if(_0x5557a2['error']['code']===0x1f4){logger[_0xcd46('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5ca978,_0x5557a2[_0xcd46('0xd')]['message']);return _0x3b1d75(_0x5557a2[_0xcd46('0xd')][_0xcd46('0xe')]);}logger[_0xcd46('0xd')](_0xcd46('0x9'),_0x5ca978,_0x5557a2['error'][_0xcd46('0xe')]);return _0x5a1e70(_0x5557a2[_0xcd46('0xd')][_0xcd46('0xe')]);}else{logger['info'](_0xcd46('0x9'),_0x5ca978,'request\x20sent');_0x5a1e70(_0x5557a2[_0xcd46('0xf')]['message']);}})['catch'](function(_0x51a443){logger[_0xcd46('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5ca978,_0x51a443);_0x3b1d75(_0x51a443);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 57aaf9f..45e4a1c 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2eb26b,_0x52a8dc){var _0x393fd5=function(_0x6507c){while(--_0x6507c){_0x2eb26b['push'](_0x2eb26b['shift']());}};_0x393fd5(++_0x52a8dc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xcb91[_0xd816e2];return _0x1f5924;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2f3d2b,_0x450c70){var _0x30e056=function(_0x156dc9){while(--_0x156dc9){_0x2f3d2b['push'](_0x2f3d2b['shift']());}};_0x30e056(++_0x450c70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 03b4f31..ce45360 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 _0x9f7b=['exports','INTEGER'];(function(_0x173714,_0x2e0c5d){var _0x21114f=function(_0x20f828){while(--_0x20f828){_0x173714['push'](_0x173714['shift']());}};_0x21114f(++_0x2e0c5d);}(_0x9f7b,0xdc));var _0xb9f7=function(_0x4c9269,_0x537f70){_0x4c9269=_0x4c9269-0x0;var _0xd2f4fa=_0x9f7b[_0x4c9269];return _0xd2f4fa;};'use strict';var Sequelize=require('sequelize');module[_0xb9f7('0x0')]={'penalty':{'type':Sequelize[_0xb9f7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x66f7=['INTEGER','exports'];(function(_0x413b13,_0x4a25de){var _0x1cad2e=function(_0x757303){while(--_0x757303){_0x413b13['push'](_0x413b13['shift']());}};_0x1cad2e(++_0x4a25de);}(_0x66f7,0x16b));var _0x766f=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x66f7[_0x4a0e68];return _0x4fb274;};'use strict';var Sequelize=require('sequelize');module[_0x766f('0x0')]={'penalty':{'type':Sequelize[_0x766f('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 3809769..3d4d82b 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 _0xdb8b=['UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x55abf5,_0x3ded4d){var _0x281605=function(_0x33c9e0){while(--_0x33c9e0){_0x55abf5['push'](_0x55abf5['shift']());}};_0x281605(++_0x3ded4d);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4f9c23,_0x3a5871){_0x4f9c23=_0x4f9c23-0x0;var _0x3110ae=_0xdb8b[_0x4f9c23];return _0x3110ae;};'use strict';var _=require('lodash');var util=require(_0xbdb8('0x0'));var logger=require(_0xbdb8('0x1'))(_0xbdb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbdb8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var attributes=require(_0xbdb8('0x6'));module[_0xbdb8('0x7')]=function(_0x4c6bdb,_0x7affe8){return _0x4c6bdb['define'](_0xbdb8('0x8'),attributes,{'tableName':_0xbdb8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa64=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','api','bluebird','request-promise','path'];(function(_0x30ec0a,_0x390560){var _0x1c5562=function(_0xf152ac){while(--_0xf152ac){_0x30ec0a['push'](_0x30ec0a['shift']());}};_0x1c5562(++_0x390560);}(_0xaa64,0xf7));var _0x4aa6=function(_0x3829f4,_0x292ff8){_0x3829f4=_0x3829f4-0x0;var _0x453787=_0xaa64[_0x3829f4];return _0x453787;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var logger=require('../../config/logger')(_0x4aa6('0x2'));var moment=require('moment');var BPromise=require(_0x4aa6('0x3'));var rp=require(_0x4aa6('0x4'));var fs=require('fs');var path=require(_0x4aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x4aa6('0x6'));var attributes=require(_0x4aa6('0x7'));module[_0x4aa6('0x8')]=function(_0x37a260,_0x426bd6){return _0x37a260[_0x4aa6('0x9')](_0x4aa6('0xa'),attributes,{'tableName':'user_has_sms_queues','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 0045a86..92ca0f3 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 _0x28fb=['message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x2fe457,_0x1c58d6){var _0x40dac7=function(_0x29839b){while(--_0x29839b){_0x2fe457['push'](_0x2fe457['shift']());}};_0x40dac7(++_0x1c58d6);}(_0x28fb,0xc0));var _0xb28f=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0x28fb[_0x456bd2];return _0x2218c1;};'use strict';var _=require(_0xb28f('0x0'));var util=require('util');var moment=require(_0xb28f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb28f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb28f('0x3'))['db'];var utils=require(_0xb28f('0x4'));var logger=require(_0xb28f('0x5'))(_0xb28f('0x6'));var config=require(_0xb28f('0x7'));var jayson=require(_0xb28f('0x8'));var client=jayson[_0xb28f('0x9')][_0xb28f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bc6a9,_0x44b7cd,_0x2c0005){return new BPromise(function(_0x5b2e1c,_0x31fda8){return client[_0xb28f('0xb')](_0x3bc6a9,_0x2c0005)[_0xb28f('0xc')](function(_0x432004){logger[_0xb28f('0xd')](_0xb28f('0xe'),_0x44b7cd,_0xb28f('0xf'));logger['debug'](_0xb28f('0x10'),_0x44b7cd,'request\x20sent',JSON['stringify'](_0x432004));if(_0x432004[_0xb28f('0x11')]){if(_0x432004[_0xb28f('0x11')]['code']===0x1f4){logger['error'](_0xb28f('0xe'),_0x44b7cd,_0x432004['error'][_0xb28f('0x12')]);return _0x31fda8(_0x432004[_0xb28f('0x11')]['message']);}logger[_0xb28f('0x11')](_0xb28f('0xe'),_0x44b7cd,_0x432004[_0xb28f('0x11')][_0xb28f('0x12')]);return _0x5b2e1c(_0x432004[_0xb28f('0x11')][_0xb28f('0x12')]);}else{logger[_0xb28f('0xd')](_0xb28f('0xe'),_0x44b7cd,_0xb28f('0xf'));_0x5b2e1c(_0x432004[_0xb28f('0x13')]['message']);}})[_0xb28f('0x14')](function(_0x1b6482){logger['error'](_0xb28f('0xe'),_0x44b7cd,_0x1b6482);_0x31fda8(_0x1b6482);});});} \ No newline at end of file +var _0x8f1a=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','info'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x8f1a,0x105));var _0xa8f1=function(_0x449ffe,_0xfc9a){_0x449ffe=_0x449ffe-0x0;var _0xae175a=_0x8f1a[_0x449ffe];return _0xae175a;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var moment=require(_0xa8f1('0x2'));var BPromise=require(_0xa8f1('0x3'));var rs=require(_0xa8f1('0x4'));var fs=require('fs');var Redis=require(_0xa8f1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f1('0x6'));var logger=require(_0xa8f1('0x7'))(_0xa8f1('0x8'));var config=require(_0xa8f1('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26bb3b,_0x1fd9bd,_0x1d5f0a){return new BPromise(function(_0x3d8534,_0x2cbbe3){return client[_0xa8f1('0xa')](_0x26bb3b,_0x1d5f0a)['then'](function(_0x3cec7b){logger[_0xa8f1('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x1fd9bd,_0xa8f1('0xc'));logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x1fd9bd,'request\x20sent',JSON[_0xa8f1('0xf')](_0x3cec7b));if(_0x3cec7b[_0xa8f1('0x10')]){if(_0x3cec7b['error']['code']===0x1f4){logger[_0xa8f1('0x10')](_0xa8f1('0x11'),_0x1fd9bd,_0x3cec7b['error'][_0xa8f1('0x12')]);return _0x2cbbe3(_0x3cec7b[_0xa8f1('0x10')][_0xa8f1('0x12')]);}logger['error'](_0xa8f1('0x11'),_0x1fd9bd,_0x3cec7b[_0xa8f1('0x10')]['message']);return _0x3d8534(_0x3cec7b[_0xa8f1('0x10')][_0xa8f1('0x12')]);}else{logger[_0xa8f1('0xb')](_0xa8f1('0x11'),_0x1fd9bd,_0xa8f1('0xc'));_0x3d8534(_0x3cec7b[_0xa8f1('0x13')][_0xa8f1('0x12')]);}})[_0xa8f1('0x14')](function(_0x290982){logger['error'](_0xa8f1('0x11'),_0x1fd9bd,_0x290982);_0x2cbbe3(_0x290982);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0163bd5..730c6b3 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 _0xda16=['INTEGER','sequelize','exports'];(function(_0x3e78f4,_0x5d4c9a){var _0x5ca5eb=function(_0x1161b6){while(--_0x1161b6){_0x3e78f4['push'](_0x3e78f4['shift']());}};_0x5ca5eb(++_0x5d4c9a);}(_0xda16,0xb2));var _0x6da1=function(_0x33b4e7,_0x151401){_0x33b4e7=_0x33b4e7-0x0;var _0x29e187=_0xda16[_0x33b4e7];return _0x29e187;};'use strict';var Sequelize=require(_0x6da1('0x0'));module[_0x6da1('0x1')]={'UserId':{'type':Sequelize[_0x6da1('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdfa1=['INTEGER','sequelize','exports'];(function(_0x21fe11,_0x52f846){var _0x5eb704=function(_0x6be159){while(--_0x6be159){_0x21fe11['push'](_0x21fe11['shift']());}};_0x5eb704(++_0x52f846);}(_0xdfa1,0x79));var _0x1dfa=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xdfa1[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x1dfa('0x0'));module[_0x1dfa('0x1')]={'UserId':{'type':Sequelize[_0x1dfa('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1dfa('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 2714970..63f1185 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(_0x448c6c,_0x1f0731){var _0x138f7f=function(_0x3cb8e1){while(--_0x3cb8e1){_0x448c6c['push'](_0x448c6c['shift']());}};_0x138f7f(++_0x1f0731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x456752,_0x530aeb){var _0x4b0ffe=function(_0x1cd4ee){while(--_0x1cd4ee){_0x456752['push'](_0x456752['shift']());}};_0x4b0ffe(++_0x530aeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 fb4fc64..c7789b3 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2bb7d7,_0x46c9ef){var _0x4547c=function(_0x4a8211){while(--_0x4a8211){_0x2bb7d7['push'](_0x2bb7d7['shift']());}};_0x4547c(++_0x46c9ef);}(_0xe706,0xa3));var _0x6e70=function(_0x36fc1f,_0x27c1c8){_0x36fc1f=_0x36fc1f-0x0;var _0x371281=_0xe706[_0x36fc1f];return _0x371281;};'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 7a49c2d..f9b34b3 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 _0x73c9=['sequelize','exports','INTEGER'];(function(_0x3786dd,_0x5777fc){var _0x4c7a8e=function(_0x119047){while(--_0x119047){_0x3786dd['push'](_0x3786dd['shift']());}};_0x4c7a8e(++_0x5777fc);}(_0x73c9,0x17a));var _0x973c=function(_0x2170b1,_0x4ae3ed){_0x2170b1=_0x2170b1-0x0;var _0x2ffe0d=_0x73c9[_0x2170b1];return _0x2ffe0d;};'use strict';var Sequelize=require(_0x973c('0x0'));module[_0x973c('0x1')]={'penalty':{'type':Sequelize[_0x973c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe7a5=['sequelize','exports','INTEGER'];(function(_0x18a28a,_0x23e873){var _0x1a9107=function(_0x406fdd){while(--_0x406fdd){_0x18a28a['push'](_0x18a28a['shift']());}};_0x1a9107(++_0x23e873);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xe7a5[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require(_0x5e7a('0x0'));module[_0x5e7a('0x1')]={'penalty':{'type':Sequelize[_0x5e7a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 74de485..4f37474 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 _0xf22b=['request-promise','path','rimraf','exports','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x1af635,_0x52b80e){var _0x503a60=function(_0x2f60d6){while(--_0x2f60d6){_0x1af635['push'](_0x1af635['shift']());}};_0x503a60(++_0x52b80e);}(_0xf22b,0x10e));var _0xbf22=function(_0x2db495,_0x3706a0){_0x2db495=_0x2db495-0x0;var _0x4b4da0=_0xf22b[_0x2db495];return _0x4b4da0;};'use strict';var _=require('lodash');var util=require(_0xbf22('0x0'));var logger=require(_0xbf22('0x1'))(_0xbf22('0x2'));var moment=require(_0xbf22('0x3'));var BPromise=require(_0xbf22('0x4'));var rp=require(_0xbf22('0x5'));var fs=require('fs');var path=require(_0xbf22('0x6'));var rimraf=require(_0xbf22('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xbf22('0x8')]=function(_0x10410a,_0x47f749){return _0x10410a['define'](_0xbf22('0x9'),attributes,{'tableName':_0xbf22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd2f=['bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment'];(function(_0x37357f,_0x3b23bb){var _0x505ef9=function(_0x42df61){while(--_0x42df61){_0x37357f['push'](_0x37357f['shift']());}};_0x505ef9(++_0x3b23bb);}(_0xbd2f,0x134));var _0xfbd2=function(_0x446f9d,_0x3de91e){_0x446f9d=_0x446f9d-0x0;var _0x58bfbc=_0xbd2f[_0x446f9d];return _0x58bfbc;};'use strict';var _=require(_0xfbd2('0x0'));var util=require('util');var logger=require(_0xfbd2('0x1'))(_0xfbd2('0x2'));var moment=require(_0xfbd2('0x3'));var BPromise=require(_0xfbd2('0x4'));var rp=require(_0xfbd2('0x5'));var fs=require('fs');var path=require(_0xfbd2('0x6'));var rimraf=require('rimraf');var config=require(_0xfbd2('0x7'));var attributes=require(_0xfbd2('0x8'));module[_0xfbd2('0x9')]=function(_0x4a7391,_0x52a555){return _0x4a7391[_0xfbd2('0xa')](_0xfbd2('0xb'),attributes,{'tableName':_0xfbd2('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 7b7bb22..37029e5 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 _0x6c56=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x124a03,_0x126aeb){var _0x47d528=function(_0x42b28c){while(--_0x42b28c){_0x124a03['push'](_0x124a03['shift']());}};_0x47d528(++_0x126aeb);}(_0x6c56,0x16c));var _0x66c5=function(_0x1ad07b,_0x551d55){_0x1ad07b=_0x1ad07b-0x0;var _0x2c447f=_0x6c56[_0x1ad07b];return _0x2c447f;};'use strict';var _=require(_0x66c5('0x0'));var util=require(_0x66c5('0x1'));var moment=require(_0x66c5('0x2'));var BPromise=require(_0x66c5('0x3'));var rs=require(_0x66c5('0x4'));var fs=require('fs');var Redis=require(_0x66c5('0x5'));var db=require(_0x66c5('0x6'))['db'];var utils=require(_0x66c5('0x7'));var logger=require(_0x66c5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x66c5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x530088,_0x293f7f,_0x311d29){return new BPromise(function(_0x5f4ff0,_0x34efed){return client[_0x66c5('0xa')](_0x530088,_0x311d29)[_0x66c5('0xb')](function(_0x44bab1){logger[_0x66c5('0xc')](_0x66c5('0xd'),_0x293f7f,'request\x20sent');logger[_0x66c5('0xe')](_0x66c5('0xf'),_0x293f7f,_0x66c5('0x10'),JSON[_0x66c5('0x11')](_0x44bab1));if(_0x44bab1[_0x66c5('0x12')]){if(_0x44bab1[_0x66c5('0x12')]['code']===0x1f4){logger[_0x66c5('0x12')](_0x66c5('0xd'),_0x293f7f,_0x44bab1[_0x66c5('0x12')][_0x66c5('0x13')]);return _0x34efed(_0x44bab1[_0x66c5('0x12')]['message']);}logger[_0x66c5('0x12')](_0x66c5('0xd'),_0x293f7f,_0x44bab1['error'][_0x66c5('0x13')]);return _0x5f4ff0(_0x44bab1[_0x66c5('0x12')][_0x66c5('0x13')]);}else{logger[_0x66c5('0xc')](_0x66c5('0xd'),_0x293f7f,_0x66c5('0x10'));_0x5f4ff0(_0x44bab1[_0x66c5('0x14')][_0x66c5('0x13')]);}})[_0x66c5('0x15')](function(_0x3232d6){logger[_0x66c5('0x12')](_0x66c5('0xd'),_0x293f7f,_0x3232d6);_0x34efed(_0x3232d6);});});} \ No newline at end of file +var _0x22dd=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2514e2,_0x7490ad){var _0x28b546=function(_0x250a47){while(--_0x250a47){_0x2514e2['push'](_0x2514e2['shift']());}};_0x28b546(++_0x7490ad);}(_0x22dd,0xa2));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var moment=require(_0xd22d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd22d('0x3'));var db=require(_0xd22d('0x4'))['db'];var utils=require(_0xd22d('0x5'));var logger=require(_0xd22d('0x6'))('rpc');var config=require(_0xd22d('0x7'));var jayson=require(_0xd22d('0x8'));var client=jayson[_0xd22d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2df689,_0x32d797,_0x48dee5){return new BPromise(function(_0x40da8b,_0x396577){return client[_0xd22d('0xa')](_0x2df689,_0x48dee5)[_0xd22d('0xb')](function(_0x4d53fb){logger[_0xd22d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x32d797,_0xd22d('0xd'));logger['debug'](_0xd22d('0xe'),_0x32d797,_0xd22d('0xd'),JSON[_0xd22d('0xf')](_0x4d53fb));if(_0x4d53fb[_0xd22d('0x10')]){if(_0x4d53fb[_0xd22d('0x10')][_0xd22d('0x11')]===0x1f4){logger['error'](_0xd22d('0x12'),_0x32d797,_0x4d53fb[_0xd22d('0x10')]['message']);return _0x396577(_0x4d53fb[_0xd22d('0x10')][_0xd22d('0x13')]);}logger['error'](_0xd22d('0x12'),_0x32d797,_0x4d53fb[_0xd22d('0x10')][_0xd22d('0x13')]);return _0x40da8b(_0x4d53fb['error'][_0xd22d('0x13')]);}else{logger[_0xd22d('0xc')](_0xd22d('0x12'),_0x32d797,'request\x20sent');_0x40da8b(_0x4d53fb[_0xd22d('0x14')][_0xd22d('0x13')]);}})[_0xd22d('0x15')](function(_0x15f46b){logger['error'](_0xd22d('0x12'),_0x32d797,_0x15f46b);_0x396577(_0x15f46b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b591fe7..796f381 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(_0xe5530b,_0x4477ea){var _0x549c66=function(_0x495293){while(--_0x495293){_0xe5530b['push'](_0xe5530b['shift']());}};_0x549c66(++_0x4477ea);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x39df5b,_0xb6aa74){var _0x155106=function(_0x2f5a2a){while(--_0x2f5a2a){_0x39df5b['push'](_0x39df5b['shift']());}};_0x155106(++_0xb6aa74);}(_0xe706,0xa3));var _0x6e70=function(_0x5de7f2,_0x358f95){_0x5de7f2=_0x5de7f2-0x0;var _0x1095d3=_0xe706[_0x5de7f2];return _0x1095d3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 736e95c..e00eb09 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 _0x9235=['exports','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk','sequelize'];(function(_0x3affa6,_0x408ac6){var _0x137b33=function(_0x22ef5e){while(--_0x22ef5e){_0x3affa6['push'](_0x3affa6['shift']());}};_0x137b33(++_0x408ac6);}(_0x9235,0x101));var _0x5923=function(_0x477b5d,_0x5c20d0){_0x477b5d=_0x477b5d-0x0;var _0x28006c=_0x9235[_0x477b5d];return _0x28006c;};'use strict';var Sequelize=require(_0x5923('0x0'));module[_0x5923('0x1')]={'uniqueid':{'type':Sequelize[_0x5923('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x5923('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5923('0x4'),'comment':_0x5923('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x5923('0x3')],'allowNull':![],'unique':_0x5923('0x4'),'comment':_0x5923('0x5')},'penalty':{'type':Sequelize[_0x5923('0x2')](0xb),'defaultValue':0x0,'comment':_0x5923('0x5')},'paused':{'type':Sequelize[_0x5923('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x104b=['STRING','queue_interface','Required\x20by\x20Asterisk','exports','INTEGER'];(function(_0x1b3b47,_0x43cdaf){var _0x2e7975=function(_0x3de251){while(--_0x3de251){_0x1b3b47['push'](_0x1b3b47['shift']());}};_0x2e7975(++_0x43cdaf);}(_0x104b,0x143));var _0xb104=function(_0x2a446e,_0x526ca0){_0x2a446e=_0x2a446e-0x0;var _0x136947=_0x104b[_0x2a446e];return _0x136947;};'use strict';var Sequelize=require('sequelize');module[_0xb104('0x0')]={'uniqueid':{'type':Sequelize[_0xb104('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xb104('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xb104('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb104('0x2')],'allowNull':![],'unique':_0xb104('0x3'),'comment':_0xb104('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xb104('0x2')],'allowNull':![],'unique':_0xb104('0x3'),'comment':_0xb104('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb104('0x1')](0xb),'defaultValue':0x0,'comment':_0xb104('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e449db6..bd6d7f1 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 _0x90ba=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x379af0,_0x2a06e6){var _0x2926b6=function(_0xc716db){while(--_0xc716db){_0x379af0['push'](_0x379af0['shift']());}};_0x2926b6(++_0x2a06e6);}(_0x90ba,0x163));var _0xa90b=function(_0x34ba14,_0x3db2af){_0x34ba14=_0x34ba14-0x0;var _0x288a36=_0x90ba[_0x34ba14];return _0x288a36;};'use strict';var EventEmitter=require(_0xa90b('0x0'));var UserVoiceQueueRt=require(_0xa90b('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa90b('0x2')](0x0);var events={'afterCreate':_0xa90b('0x3'),'afterUpdate':_0xa90b('0x4'),'afterDestroy':_0xa90b('0x5')};function emitEvent(_0x59a694){return function(_0x42ab1e,_0x35bb3f,_0x474fe6){UserVoiceQueueRtEvents[_0xa90b('0x6')](_0x59a694+':'+_0x42ab1e['id'],_0x42ab1e);UserVoiceQueueRtEvents[_0xa90b('0x6')](_0x59a694,_0x42ab1e);_0x474fe6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xa90b('0x7')](e,emitEvent(event));}}module[_0xa90b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd3be=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x56d4ca,_0x1668e0){var _0x5ab127=function(_0x342060){while(--_0x342060){_0x56d4ca['push'](_0x56d4ca['shift']());}};_0x5ab127(++_0x1668e0);}(_0xd3be,0xcf));var _0xed3b=function(_0x318ee3,_0x357e32){_0x318ee3=_0x318ee3-0x0;var _0x410d8b=_0xd3be[_0x318ee3];return _0x410d8b;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xed3b('0x0'))['db'][_0xed3b('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xed3b('0x2')](0x0);var events={'afterCreate':_0xed3b('0x3'),'afterUpdate':_0xed3b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x284c26){return function(_0x3311e7,_0x16da17,_0x35c930){UserVoiceQueueRtEvents['emit'](_0x284c26+':'+_0x3311e7['id'],_0x3311e7);UserVoiceQueueRtEvents[_0xed3b('0x5')](_0x284c26,_0x3311e7);_0x35c930(null);};}for(var e in events){if(events[_0xed3b('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xed3b('0x7')](e,emitEvent(event));}}module[_0xed3b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 2e19885..e6e1971 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 _0x3c43=['UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports'];(function(_0x194bb9,_0x50cc2c){var _0x39bba9=function(_0x5582d1){while(--_0x5582d1){_0x194bb9['push'](_0x194bb9['shift']());}};_0x39bba9(++_0x50cc2c);}(_0x3c43,0x14c));var _0x33c4=function(_0x503dd6,_0x77c7b2){_0x503dd6=_0x503dd6-0x0;var _0x215c94=_0x3c43[_0x503dd6];return _0x215c94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x33c4('0x0'))(_0x33c4('0x1'));var moment=require('moment');var BPromise=require(_0x33c4('0x2'));var rp=require(_0x33c4('0x3'));var fs=require('fs');var path=require(_0x33c4('0x4'));var rimraf=require(_0x33c4('0x5'));var config=require('../../config/environment');var attributes=require(_0x33c4('0x6'));module[_0x33c4('0x7')]=function(_0x569a82,_0x2909f3){return _0x569a82['define'](_0x33c4('0x8'),attributes,{'tableName':_0x33c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4ef=['./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3d0bea,_0x5ece9f){var _0x1f4b5e=function(_0x336f08){while(--_0x336f08){_0x3d0bea['push'](_0x3d0bea['shift']());}};_0x1f4b5e(++_0x5ece9f);}(_0xb4ef,0x144));var _0xfb4e=function(_0x194ea4,_0x3c5763){_0x194ea4=_0x194ea4-0x0;var _0xebed87=_0xb4ef[_0x194ea4];return _0xebed87;};'use strict';var _=require(_0xfb4e('0x0'));var util=require('util');var logger=require(_0xfb4e('0x1'))(_0xfb4e('0x2'));var moment=require(_0xfb4e('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb4e('0x4'));var fs=require('fs');var path=require(_0xfb4e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb4e('0x6'));module[_0xfb4e('0x7')]=function(_0x1faaa6,_0x3688ff){return _0x1faaa6[_0xfb4e('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xfb4e('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 dfee45d..ea89d42 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 _0x8920=['COUNT','literal','outboundQueuePauses','info','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize'];(function(_0x482bac,_0x2ad787){var _0x35d510=function(_0x3b15ee){while(--_0x3b15ee){_0x482bac['push'](_0x482bac['shift']());}};_0x35d510(++_0x2ad787);}(_0x8920,0x7e));var _0x0892=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8920[_0x432682];return _0x463d05;};'use strict';var _=require(_0x0892('0x0'));var util=require(_0x0892('0x1'));var moment=require(_0x0892('0x2'));var BPromise=require(_0x0892('0x3'));var rs=require(_0x0892('0x4'));var fs=require('fs');var Redis=require(_0x0892('0x5'));var db=require(_0x0892('0x6'))['db'];var utils=require(_0x0892('0x7'));var logger=require(_0x0892('0x8'))(_0x0892('0x9'));var config=require(_0x0892('0xa'));var jayson=require(_0x0892('0xb'));var client=jayson[_0x0892('0xc')][_0x0892('0xd')]({'port':0x232a});config[_0x0892('0xe')]=_[_0x0892('0xf')](config[_0x0892('0xe')],{'host':_0x0892('0x10'),'port':0x18eb});var socket=require(_0x0892('0x11'))(new Redis(config[_0x0892('0xe')]));require(_0x0892('0x12'))[_0x0892('0x13')](socket);function respondWithRpcPromise(_0x30facc,_0xdbb16d,_0x4ccde6){return new BPromise(function(_0x29b597,_0x168240){return client['request'](_0x30facc,_0x4ccde6)[_0x0892('0x14')](function(_0x10890e){logger['info'](_0x0892('0x15'),_0xdbb16d,_0x0892('0x16'));logger['debug'](_0x0892('0x17'),_0xdbb16d,_0x0892('0x16'),JSON[_0x0892('0x18')](_0x10890e));if(_0x10890e[_0x0892('0x19')]){if(_0x10890e[_0x0892('0x19')]['code']===0x1f4){logger['error'](_0x0892('0x15'),_0xdbb16d,_0x10890e[_0x0892('0x19')][_0x0892('0x1a')]);return _0x168240(_0x10890e['error'][_0x0892('0x1a')]);}logger[_0x0892('0x19')](_0x0892('0x15'),_0xdbb16d,_0x10890e['error'][_0x0892('0x1a')]);return _0x29b597(_0x10890e[_0x0892('0x19')][_0x0892('0x1a')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xdbb16d,_0x0892('0x16'));_0x29b597(_0x10890e[_0x0892('0x1b')][_0x0892('0x1a')]);}})['catch'](function(_0xea8651){logger[_0x0892('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xdbb16d,_0xea8651);_0x168240(_0xea8651);});});}exports[_0x0892('0x1c')]=function(_0x4989a0){var _0x25d35a=this;return new Promise(function(_0x19f437,_0x39bffd){return db[_0x0892('0x1d')][_0x0892('0x1e')]({'raw':_0x4989a0['options']?_0x4989a0[_0x0892('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4989a0[_0x0892('0x1f')]?_0x4989a0[_0x0892('0x1f')][_0x0892('0x20')]||null:null,'attributes':[[db[_0x0892('0x21')]['fn'](_0x0892('0x22'),db[_0x0892('0x21')]['fn']('IF',db['sequelize'][_0x0892('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0x0892('0x24')]]})[_0x0892('0x14')](function(_0x405797){logger[_0x0892('0x25')]('GetVoiceQueueRtPauses',_0x4989a0);logger[_0x0892('0x26')](_0x0892('0x1c'),_0x4989a0,JSON[_0x0892('0x18')](_0x405797));_0x19f437(_0x405797);})[_0x0892('0x27')](function(_0x5cd0c9){logger['error'](_0x0892('0x1c'),_0x5cd0c9[_0x0892('0x1a')],_0x4989a0);_0x39bffd(_0x25d35a['error'](0x1f4,_0x5cd0c9[_0x0892('0x1a')]));});});}; \ No newline at end of file +var _0x561b=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x353c41,_0x5abbf3){var _0x17e950=function(_0x12f2ab){while(--_0x12f2ab){_0x353c41['push'](_0x353c41['shift']());}};_0x17e950(++_0x5abbf3);}(_0x561b,0x185));var _0xb561=function(_0x2df342,_0xfb6edb){_0x2df342=_0x2df342-0x0;var _0x4785ac=_0x561b[_0x2df342];return _0x4785ac;};'use strict';var _=require(_0xb561('0x0'));var util=require(_0xb561('0x1'));var moment=require(_0xb561('0x2'));var BPromise=require(_0xb561('0x3'));var rs=require(_0xb561('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb561('0x5'))['db'];var utils=require(_0xb561('0x6'));var logger=require(_0xb561('0x7'))(_0xb561('0x8'));var config=require(_0xb561('0x9'));var jayson=require(_0xb561('0xa'));var client=jayson['client'][_0xb561('0xb')]({'port':0x232a});config[_0xb561('0xc')]=_['defaults'](config[_0xb561('0xc')],{'host':_0xb561('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb561('0xc')]));require(_0xb561('0xe'))[_0xb561('0xf')](socket);function respondWithRpcPromise(_0xdb9113,_0x26eef1,_0x4fb965){return new BPromise(function(_0x14b5b0,_0x33c0db){return client[_0xb561('0x10')](_0xdb9113,_0x4fb965)[_0xb561('0x11')](function(_0x31bcb2){logger[_0xb561('0x12')](_0xb561('0x13'),_0x26eef1,_0xb561('0x14'));logger[_0xb561('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x26eef1,'request\x20sent',JSON[_0xb561('0x16')](_0x31bcb2));if(_0x31bcb2[_0xb561('0x17')]){if(_0x31bcb2[_0xb561('0x17')][_0xb561('0x18')]===0x1f4){logger[_0xb561('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x26eef1,_0x31bcb2[_0xb561('0x17')]['message']);return _0x33c0db(_0x31bcb2[_0xb561('0x17')]['message']);}logger[_0xb561('0x17')](_0xb561('0x13'),_0x26eef1,_0x31bcb2[_0xb561('0x17')]['message']);return _0x14b5b0(_0x31bcb2[_0xb561('0x17')][_0xb561('0x19')]);}else{logger[_0xb561('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x26eef1,_0xb561('0x14'));_0x14b5b0(_0x31bcb2['result'][_0xb561('0x19')]);}})['catch'](function(_0x32f4b8){logger[_0xb561('0x17')](_0xb561('0x13'),_0x26eef1,_0x32f4b8);_0x33c0db(_0x32f4b8);});});}exports[_0xb561('0x1a')]=function(_0x4faaea){var _0xe58e24=this;return new Promise(function(_0x410a1b,_0x347dd0){return db[_0xb561('0x1b')][_0xb561('0x1c')]({'raw':_0x4faaea[_0xb561('0x1d')]?_0x4faaea[_0xb561('0x1d')][_0xb561('0x1e')]===undefined?!![]:![]:!![],'where':_0x4faaea[_0xb561('0x1d')]?_0x4faaea[_0xb561('0x1d')][_0xb561('0x1f')]||null:null,'attributes':[[db[_0xb561('0x20')]['fn'](_0xb561('0x21'),db[_0xb561('0x20')]['fn']('IF',db['sequelize']['literal'](_0xb561('0x22')))),_0xb561('0x23')]]})['then'](function(_0x3fd659){logger[_0xb561('0x12')](_0xb561('0x1a'),_0x4faaea);logger[_0xb561('0x15')](_0xb561('0x1a'),_0x4faaea,JSON[_0xb561('0x16')](_0x3fd659));_0x410a1b(_0x3fd659);})['catch'](function(_0x38553e){logger[_0xb561('0x17')]('GetVoiceQueueRtPauses',_0x38553e[_0xb561('0x19')],_0x4faaea);_0x347dd0(_0xe58e24['error'](0x1f4,_0x38553e[_0xb561('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1e3afa3..2166df2 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 _0x9b2c=['register','length','userVoiceQueueRt:','save','remove','removeListener'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x9b2c,0x189));var _0xc9b2=function(_0x6f3151,_0x406745){_0x6f3151=_0x6f3151-0x0;var _0x305fb8=_0x9b2c[_0x6f3151];return _0x305fb8;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xc9b2('0x0'),_0xc9b2('0x1'),'update'];function createListener(_0x140704,_0x54dbb1){return function(_0x102cd6){_0x54dbb1['emit'](_0x140704,_0x102cd6);};}function removeListener(_0xdbbe00,_0x26a747){return function(){UserVoiceQueueRtEvents[_0xc9b2('0x2')](_0xdbbe00,_0x26a747);};}exports[_0xc9b2('0x3')]=function(_0x15be55){for(var _0x3e6343=0x0,_0x3ab6d0=events[_0xc9b2('0x4')];_0x3e6343<_0x3ab6d0;_0x3e6343++){var _0x440a3f=events[_0x3e6343];var _0x224ce6=createListener(_0xc9b2('0x5')+_0x440a3f,_0x15be55);UserVoiceQueueRtEvents['on'](_0x440a3f,_0x224ce6);}}; \ No newline at end of file +var _0xafc4=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0xafc4,0x69));var _0x4afc=function(_0x38a393,_0x4fde3b){_0x38a393=_0x38a393-0x0;var _0x265ac1=_0xafc4[_0x38a393];return _0x265ac1;};'use strict';var UserVoiceQueueRtEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);UserVoiceQueueRtEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index cd29d84..ca7b695 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x15af24,_0x12a7f6){var _0x57ff82=function(_0x451d82){while(--_0x451d82){_0x15af24['push'](_0x15af24['shift']());}};_0x57ff82(++_0x12a7f6);}(_0x70e0,0x17b));var _0x070e=function(_0x1bb5f4,_0x776610){_0x1bb5f4=_0x1bb5f4-0x0;var _0x1f4d83=_0x70e0[_0x1bb5f4];return _0x1f4d83;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x721ebf,_0x9e9b92){var _0x5b1157=function(_0x5c8b00){while(--_0x5c8b00){_0x721ebf['push'](_0x721ebf['shift']());}};_0x5b1157(++_0x9e9b92);}(_0xe706,0xa3));var _0x6e70=function(_0x10b6ae,_0x56a559){_0x10b6ae=_0x10b6ae-0x0;var _0x1321e9=_0xe706[_0x10b6ae];return _0x1321e9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9ac6e5b..a727db1 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 _0xab36=['exports','INTEGER','sequelize'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0xab36,0x1df));var _0x6ab3=function(_0x4e79f2,_0x4266e4){_0x4e79f2=_0x4e79f2-0x0;var _0x2cc0d4=_0xab36[_0x4e79f2];return _0x2cc0d4;};'use strict';var Sequelize=require(_0x6ab3('0x0'));module[_0x6ab3('0x1')]={'penalty':{'type':Sequelize[_0x6ab3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9eb9=['exports','INTEGER','sequelize'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x9eb9,0x11c));var _0x99eb=function(_0x4caf98,_0x370bdf){_0x4caf98=_0x4caf98-0x0;var _0x47d295=_0x9eb9[_0x4caf98];return _0x47d295;};'use strict';var Sequelize=require(_0x99eb('0x0'));module[_0x99eb('0x1')]={'penalty':{'type':Sequelize[_0x99eb('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 2aacd1f..8ba6691 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 _0x4449=['bluebird','request-promise','path','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api'];(function(_0x4f3db1,_0x293f01){var _0x49bb00=function(_0x28cea2){while(--_0x28cea2){_0x4f3db1['push'](_0x4f3db1['shift']());}};_0x49bb00(++_0x293f01);}(_0x4449,0x16f));var _0x9444=function(_0x146db4,_0x2afacb){_0x146db4=_0x146db4-0x0;var _0x26c687=_0x4449[_0x146db4];return _0x26c687;};'use strict';var _=require(_0x9444('0x0'));var util=require('util');var logger=require(_0x9444('0x1'))(_0x9444('0x2'));var moment=require('moment');var BPromise=require(_0x9444('0x3'));var rp=require(_0x9444('0x4'));var fs=require('fs');var path=require(_0x9444('0x5'));var rimraf=require('rimraf');var config=require(_0x9444('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x9444('0x7')]=function(_0x2194c7,_0x48fde2){return _0x2194c7['define'](_0x9444('0x8'),attributes,{'tableName':_0x9444('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081a=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x47b3db,_0x4f8d90){var _0x5a8ff6=function(_0x1dc63f){while(--_0x1dc63f){_0x47b3db['push'](_0x47b3db['shift']());}};_0x5a8ff6(++_0x4f8d90);}(_0x081a,0x1ed));var _0xa081=function(_0xcffcbe,_0x143d81){_0xcffcbe=_0xcffcbe-0x0;var _0x447d0d=_0x081a[_0xcffcbe];return _0x447d0d;};'use strict';var _=require(_0xa081('0x0'));var util=require(_0xa081('0x1'));var logger=require(_0xa081('0x2'))(_0xa081('0x3'));var moment=require(_0xa081('0x4'));var BPromise=require(_0xa081('0x5'));var rp=require(_0xa081('0x6'));var fs=require('fs');var path=require(_0xa081('0x7'));var rimraf=require('rimraf');var config=require(_0xa081('0x8'));var attributes=require(_0xa081('0x9'));module[_0xa081('0xa')]=function(_0x4bc6ac,_0x5c22ff){return _0x4bc6ac[_0xa081('0xb')](_0xa081('0xc'),attributes,{'tableName':_0xa081('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c12373a..2f56d2a 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 _0xa8ec=['client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa8ec,0x1c2));var _0xca8e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xa8ec[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xca8e('0x0'));var util=require(_0xca8e('0x1'));var moment=require('moment');var BPromise=require(_0xca8e('0x2'));var rs=require(_0xca8e('0x3'));var fs=require('fs');var Redis=require(_0xca8e('0x4'));var db=require(_0xca8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca8e('0x6'))(_0xca8e('0x7'));var config=require(_0xca8e('0x8'));var jayson=require(_0xca8e('0x9'));var client=jayson[_0xca8e('0xa')][_0xca8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc9723c,_0x51b5b4,_0x459af7){return new BPromise(function(_0x1dea69,_0x1bb812){return client[_0xca8e('0xc')](_0xc9723c,_0x459af7)[_0xca8e('0xd')](function(_0xe279b5){logger[_0xca8e('0xe')](_0xca8e('0xf'),_0x51b5b4,_0xca8e('0x10'));logger['debug'](_0xca8e('0x11'),_0x51b5b4,_0xca8e('0x10'),JSON[_0xca8e('0x12')](_0xe279b5));if(_0xe279b5['error']){if(_0xe279b5[_0xca8e('0x13')][_0xca8e('0x14')]===0x1f4){logger[_0xca8e('0x13')](_0xca8e('0xf'),_0x51b5b4,_0xe279b5[_0xca8e('0x13')][_0xca8e('0x15')]);return _0x1bb812(_0xe279b5[_0xca8e('0x13')]['message']);}logger[_0xca8e('0x13')](_0xca8e('0xf'),_0x51b5b4,_0xe279b5[_0xca8e('0x13')][_0xca8e('0x15')]);return _0x1dea69(_0xe279b5[_0xca8e('0x13')]['message']);}else{logger[_0xca8e('0xe')](_0xca8e('0xf'),_0x51b5b4,_0xca8e('0x10'));_0x1dea69(_0xe279b5['result'][_0xca8e('0x15')]);}})[_0xca8e('0x16')](function(_0x46af27){logger[_0xca8e('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x51b5b4,_0x46af27);_0x1bb812(_0x46af27);});});} \ No newline at end of file +var _0x5228=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug'];(function(_0xed01eb,_0x275edb){var _0x25b9de=function(_0x3c331c){while(--_0x3c331c){_0xed01eb['push'](_0xed01eb['shift']());}};_0x25b9de(++_0x275edb);}(_0x5228,0x1d3));var _0x8522=function(_0x34c187,_0x40148c){_0x34c187=_0x34c187-0x0;var _0x593943=_0x5228[_0x34c187];return _0x593943;};'use strict';var _=require('lodash');var util=require(_0x8522('0x0'));var moment=require(_0x8522('0x1'));var BPromise=require(_0x8522('0x2'));var rs=require(_0x8522('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8522('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8522('0x5'))(_0x8522('0x6'));var config=require(_0x8522('0x7'));var jayson=require(_0x8522('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5302db,_0x432b5a,_0x4404c){return new BPromise(function(_0x15c5a0,_0x4748cb){return client['request'](_0x5302db,_0x4404c)[_0x8522('0x9')](function(_0x4d0819){logger[_0x8522('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x432b5a,_0x8522('0xb'));logger[_0x8522('0xc')](_0x8522('0xd'),_0x432b5a,_0x8522('0xb'),JSON[_0x8522('0xe')](_0x4d0819));if(_0x4d0819['error']){if(_0x4d0819[_0x8522('0xf')][_0x8522('0x10')]===0x1f4){logger[_0x8522('0xf')](_0x8522('0x11'),_0x432b5a,_0x4d0819['error'][_0x8522('0x12')]);return _0x4748cb(_0x4d0819[_0x8522('0xf')][_0x8522('0x12')]);}logger[_0x8522('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x432b5a,_0x4d0819[_0x8522('0xf')][_0x8522('0x12')]);return _0x15c5a0(_0x4d0819['error'][_0x8522('0x12')]);}else{logger[_0x8522('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x432b5a,_0x8522('0xb'));_0x15c5a0(_0x4d0819['result']['message']);}})[_0x8522('0x13')](function(_0x400fca){logger['error'](_0x8522('0x11'),_0x432b5a,_0x400fca);_0x4748cb(_0x400fca);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2bc2449..aef7c6e 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 _0x5636=['post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2f7f1c,_0x493686){var _0x65418d=function(_0x2f81e4){while(--_0x2f81e4){_0x2f7f1c['push'](_0x2f7f1c['shift']());}};_0x65418d(++_0x493686);}(_0x5636,0x102));var _0x6563=function(_0x3dd7f6,_0x25d1a9){_0x3dd7f6=_0x3dd7f6-0x0;var _0x38f4af=_0x5636[_0x3dd7f6];return _0x38f4af;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0xc')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router[_0x6563('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6563('0xf')]);router[_0x6563('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6563('0x11')]=router; \ No newline at end of file +var _0xc978=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1ff92d,_0x3bfdeb){var _0x129a98=function(_0x45a90b){while(--_0x45a90b){_0x1ff92d['push'](_0x1ff92d['shift']());}};_0x129a98(++_0x3bfdeb);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xf')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0x11')]('/:id',auth[_0x8c97('0xb')](),controller[_0x8c97('0x12')]);router[_0x8c97('0x13')](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x14')]);module[_0x8c97('0x15')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 6883449..8f94d37 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 _0x6cca=['name','STRING','sequelize','exports'];(function(_0x1c31d5,_0x2d5bde){var _0x2205e5=function(_0x131353){while(--_0x131353){_0x1c31d5['push'](_0x1c31d5['shift']());}};_0x2205e5(++_0x2d5bde);}(_0x6cca,0x10e));var _0xa6cc=function(_0x418e6b,_0xc100a6){_0x418e6b=_0x418e6b-0x0;var _0x1ab875=_0x6cca[_0x418e6b];return _0x1ab875;};'use strict';var Sequelize=require(_0xa6cc('0x0'));module[_0xa6cc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa6cc('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa6cc('0x3')]}}; \ No newline at end of file +var _0x1af5=['sequelize','STRING','name'];(function(_0x324ea9,_0x3449d8){var _0x2e7150=function(_0x5c59bb){while(--_0x5c59bb){_0x324ea9['push'](_0x324ea9['shift']());}};_0x2e7150(++_0x3449d8);}(_0x1af5,0x17d));var _0x51af=function(_0x5c1504,_0x1e94d5){_0x5c1504=_0x5c1504-0x0;var _0x87a50e=_0x1af5[_0x5c1504];return _0x87a50e;};'use strict';var Sequelize=require(_0x51af('0x0'));module['exports']={'name':{'type':Sequelize[_0x51af('0x1')],'unique':_0x51af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x51af('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6a1433d..64fb72f 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 _0x522d=['type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','save','update','then','destroy','get','Variables','error','stack','name','index','map','Variable','fieldName'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x522d,0x16e));var _0xd522=function(_0x40b993,_0x164c29){_0x40b993=_0x40b993-0x0;var _0x412e85=_0x522d[_0x40b993];return _0x412e85;};'use strict';var emlformat=require(_0xd522('0x0'));var rimraf=require(_0xd522('0x1'));var zipdir=require(_0xd522('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd522('0x3'));var moment=require(_0xd522('0x4'));var BPromise=require(_0xd522('0x5'));var Mustache=require(_0xd522('0x6'));var util=require('util');var path=require(_0xd522('0x7'));var sox=require('sox');var csv=require(_0xd522('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd522('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd522('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd522('0xb'));var Papa=require(_0xd522('0xc'));var Redis=require(_0xd522('0xd'));var authService=require(_0xd522('0xe'));var qs=require(_0xd522('0xf'));var as=require(_0xd522('0x10'));var hardwareService=require(_0xd522('0x11'));var logger=require(_0xd522('0x12'))(_0xd522('0x13'));var utils=require(_0xd522('0x14'));var config=require(_0xd522('0x15'));var licenseUtil=require(_0xd522('0x16'));var db=require(_0xd522('0x17'))['db'];function respondWithStatusCode(_0x2cadcc,_0x5d18ed){_0x5d18ed=_0x5d18ed||0xcc;return function(_0x2ebaa3){if(_0x2ebaa3){return _0x2cadcc[_0xd522('0x18')](_0x5d18ed);}return _0x2cadcc[_0xd522('0x19')](_0x5d18ed)[_0xd522('0x1a')]();};}function respondWithResult(_0x5efc07,_0x9da639){_0x9da639=_0x9da639||0xc8;return function(_0x4c9250){if(_0x4c9250){return _0x5efc07[_0xd522('0x19')](_0x9da639)[_0xd522('0x1b')](_0x4c9250);}};}function respondWithFilteredResult(_0xc36e89,_0x168113){return function(_0x2a4a52){if(_0x2a4a52){var _0x1700c9=typeof _0x168113['offset']==='undefined'&&typeof _0x168113['limit']==='undefined';var _0x582cbe=_0x2a4a52['count'];var _0x1464c6=_0x1700c9?0x0:_0x168113[_0xd522('0x1c')];var _0x46bb85=_0x1700c9?_0x2a4a52['count']:_0x168113[_0xd522('0x1c')]+_0x168113['limit'];var _0x455b59;if(_0x46bb85>=_0x582cbe){_0x46bb85=_0x582cbe;_0x455b59=0xc8;}else{_0x455b59=0xce;}_0xc36e89[_0xd522('0x19')](_0x455b59);return _0xc36e89[_0xd522('0x1d')](_0xd522('0x1e'),_0x1464c6+'-'+_0x46bb85+'/'+_0x582cbe)[_0xd522('0x1b')](_0x2a4a52);}return null;};}function patchUpdates(_0x21146e){return function(_0x555d7d){try{jsonpatch['apply'](_0x555d7d,_0x21146e,!![]);}catch(_0x277ec6){return BPromise['reject'](_0x277ec6);}return _0x555d7d[_0xd522('0x1f')]();};}function saveUpdates(_0x783af8,_0x3333f3){return function(_0x177547){if(_0x177547){return _0x177547[_0xd522('0x20')](_0x783af8)[_0xd522('0x21')](function(_0x556c72){return _0x556c72;});}return null;};}function removeEntity(_0x2f5a90,_0x2af207){return function(_0x9324c1){if(_0x9324c1){return _0x9324c1[_0xd522('0x22')]()[_0xd522('0x21')](function(){var _0x550b34=_0x9324c1[_0xd522('0x23')]({'plain':!![]});var _0x207b5f=_0xd522('0x24');return db['UserProfileResource'][_0xd522('0x22')]({'where':{'type':_0x207b5f,'resourceId':_0x550b34['id']}})['then'](function(){return _0x9324c1;});})[_0xd522('0x21')](function(){_0x2f5a90[_0xd522('0x19')](0xcc)[_0xd522('0x1a')]();});}};}function handleEntityNotFound(_0x38957c,_0x325dc7){return function(_0x47c43c){if(!_0x47c43c){_0x38957c[_0xd522('0x18')](0x194);}return _0x47c43c;};}function handleError(_0x1cd751,_0x957570){_0x957570=_0x957570||0x1f4;return function(_0x9b6d8){logger[_0xd522('0x25')](_0x9b6d8[_0xd522('0x26')]);if(_0x9b6d8[_0xd522('0x27')]){delete _0x9b6d8['name'];}_0x1cd751[_0xd522('0x19')](_0x957570)['send'](_0x9b6d8);};}exports[_0xd522('0x28')]=function(_0x3fd4d3,_0x145643){var _0x264055={},_0xf0c859={},_0x242b96={'count':0x0,'rows':[]};var _0x390c62=_[_0xd522('0x29')](db[_0xd522('0x2a')]['rawAttributes'],function(_0x2e15c5){return{'name':_0x2e15c5[_0xd522('0x2b')],'type':_0x2e15c5[_0xd522('0x2c')][_0xd522('0x2d')]};});_0xf0c859[_0xd522('0x2e')]=_['map'](_0x390c62,_0xd522('0x27'));_0xf0c859['query']=_[_0xd522('0x2f')](_0x3fd4d3[_0xd522('0x30')]);_0xf0c859[_0xd522('0x31')]=_[_0xd522('0x32')](_0xf0c859[_0xd522('0x2e')],_0xf0c859[_0xd522('0x30')]);_0x264055[_0xd522('0x33')]=_[_0xd522('0x32')](_0xf0c859[_0xd522('0x2e')],qs['fields'](_0x3fd4d3['query'][_0xd522('0x34')]));_0x264055[_0xd522('0x33')]=_0x264055[_0xd522('0x33')][_0xd522('0x35')]?_0x264055[_0xd522('0x33')]:_0xf0c859['model'];if(!_0x3fd4d3[_0xd522('0x30')][_0xd522('0x36')](_0xd522('0x37'))){_0x264055['limit']=qs[_0xd522('0x38')](_0x3fd4d3[_0xd522('0x30')][_0xd522('0x38')]);_0x264055[_0xd522('0x1c')]=qs['offset'](_0x3fd4d3[_0xd522('0x30')][_0xd522('0x1c')]);}_0x264055[_0xd522('0x39')]=qs[_0xd522('0x3a')](_0x3fd4d3[_0xd522('0x30')]['sort']);_0x264055[_0xd522('0x3b')]=qs[_0xd522('0x31')](_[_0xd522('0x3c')](_0x3fd4d3[_0xd522('0x30')],_0xf0c859[_0xd522('0x31')]),_0x390c62);if(_0x3fd4d3[_0xd522('0x30')][_0xd522('0x3d')]){_0x264055[_0xd522('0x3b')]=_[_0xd522('0x3e')](_0x264055[_0xd522('0x3b')],{'$or':_[_0xd522('0x29')](_0x390c62,function(_0x1a3ea3){if(_0x1a3ea3['type']!==_0xd522('0x3f')){var _0x4a6bac={};_0x4a6bac[_0x1a3ea3[_0xd522('0x27')]]={'$like':'%'+_0x3fd4d3[_0xd522('0x30')][_0xd522('0x3d')]+'%'};return _0x4a6bac;}})});}_0x264055=_[_0xd522('0x3e')]({},_0x264055,_0x3fd4d3[_0xd522('0x40')]);var _0xadf9e3={'where':_0x264055[_0xd522('0x3b')]};return db[_0xd522('0x2a')][_0xd522('0x41')](_0xadf9e3)[_0xd522('0x21')](function(_0x4018f1){_0x242b96[_0xd522('0x41')]=_0x4018f1;if(_0x3fd4d3[_0xd522('0x30')]['includeAll']){_0x264055[_0xd522('0x42')]=[{'all':!![]}];}return db['Variable'][_0xd522('0x43')](_0x264055);})[_0xd522('0x21')](function(_0x2e6560){_0x242b96['rows']=_0x2e6560;return _0x242b96;})[_0xd522('0x21')](respondWithFilteredResult(_0x145643,_0x264055))[_0xd522('0x44')](handleError(_0x145643,null));};exports[_0xd522('0x45')]=function(_0x7282df,_0x370e05){var _0x45c4aa={'raw':!![],'where':{'id':_0x7282df[_0xd522('0x46')]['id']}},_0x520b08={};_0x520b08[_0xd522('0x2e')]=_[_0xd522('0x2f')](db[_0xd522('0x2a')][_0xd522('0x47')]);_0x520b08['query']=_[_0xd522('0x2f')](_0x7282df[_0xd522('0x30')]);_0x520b08[_0xd522('0x31')]=_[_0xd522('0x32')](_0x520b08[_0xd522('0x2e')],_0x520b08[_0xd522('0x30')]);_0x45c4aa[_0xd522('0x33')]=_['intersection'](_0x520b08['model'],qs[_0xd522('0x34')](_0x7282df[_0xd522('0x30')]['fields']));_0x45c4aa[_0xd522('0x33')]=_0x45c4aa[_0xd522('0x33')][_0xd522('0x35')]?_0x45c4aa[_0xd522('0x33')]:_0x520b08[_0xd522('0x2e')];if(_0x7282df['query']['includeAll']){_0x45c4aa[_0xd522('0x42')]=[{'all':!![]}];}_0x45c4aa=_[_0xd522('0x3e')]({},_0x45c4aa,_0x7282df[_0xd522('0x40')]);return db[_0xd522('0x2a')][_0xd522('0x48')](_0x45c4aa)[_0xd522('0x21')](handleEntityNotFound(_0x370e05,null))['then'](respondWithResult(_0x370e05,null))['catch'](handleError(_0x370e05,null));};exports[_0xd522('0x49')]=function(_0x3a7399,_0x41494a){return db[_0xd522('0x2a')][_0xd522('0x49')](_0x3a7399[_0xd522('0x4a')],{})[_0xd522('0x21')](function(_0x429b34){var _0x41b84e=_0x3a7399[_0xd522('0x4b')]['get']({'plain':!![]});if(!_0x41b84e)throw new Error(_0xd522('0x4c'));if(_0x41b84e[_0xd522('0x4d')]===_0xd522('0x4b')){var _0xdf24c4=_0x429b34['get']({'plain':!![]});var _0x5c3565=_0xd522('0x24');return db[_0xd522('0x4e')][_0xd522('0x48')]({'where':{'name':_0x5c3565,'userProfileId':_0x41b84e['userProfileId']},'raw':!![]})[_0xd522('0x21')](function(_0x141879){if(_0x141879&&_0x141879[_0xd522('0x4f')]===0x0){return db[_0xd522('0x50')][_0xd522('0x49')]({'name':_0xdf24c4[_0xd522('0x27')],'resourceId':_0xdf24c4['id'],'type':_0x141879['name'],'sectionId':_0x141879['id']},{})[_0xd522('0x21')](function(){return _0x429b34;});}else{return _0x429b34;}})[_0xd522('0x44')](function(_0x328ad1){logger[_0xd522('0x25')](_0xd522('0x51'),_0x328ad1);throw _0x328ad1;});}return _0x429b34;})[_0xd522('0x21')](respondWithResult(_0x41494a,0xc9))[_0xd522('0x44')](handleError(_0x41494a,null));};exports[_0xd522('0x20')]=function(_0x107ded,_0x15086e){if(_0x107ded[_0xd522('0x4a')]['id']){delete _0x107ded[_0xd522('0x4a')]['id'];}return db['Variable'][_0xd522('0x48')]({'where':{'id':_0x107ded['params']['id']}})[_0xd522('0x21')](handleEntityNotFound(_0x15086e,null))[_0xd522('0x21')](saveUpdates(_0x107ded['body'],null))['then'](respondWithResult(_0x15086e,null))[_0xd522('0x44')](handleError(_0x15086e,null));};exports[_0xd522('0x22')]=function(_0x24c766,_0x482dcc){return db[_0xd522('0x2a')]['find']({'where':{'id':_0x24c766['params']['id']}})['then'](handleEntityNotFound(_0x482dcc,null))[_0xd522('0x21')](removeEntity(_0x482dcc,null))['catch'](handleError(_0x482dcc,null));}; \ No newline at end of file +var _0x1d07=['nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x1d07,0xbb));var _0x71d0=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x1d07[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71d0('0x0'));var rp=require(_0x71d0('0x1'));var moment=require('moment');var BPromise=require(_0x71d0('0x2'));var Mustache=require('mustache');var util=require(_0x71d0('0x3'));var path=require(_0x71d0('0x4'));var sox=require(_0x71d0('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71d0('0x6'));var _=require(_0x71d0('0x7'));var squel=require(_0x71d0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x71d0('0x9'));var toCsv=require(_0x71d0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71d0('0xb'));var authService=require(_0x71d0('0xc'));var qs=require(_0x71d0('0xd'));var as=require(_0x71d0('0xe'));var hardwareService=require(_0x71d0('0xf'));var logger=require(_0x71d0('0x10'))(_0x71d0('0x11'));var utils=require('../../config/utils');var config=require(_0x71d0('0x12'));var licenseUtil=require(_0x71d0('0x13'));var db=require(_0x71d0('0x14'))['db'];function respondWithStatusCode(_0x2785c8,_0x1bfdea){_0x1bfdea=_0x1bfdea||0xcc;return function(_0x5ab215){if(_0x5ab215){return _0x2785c8[_0x71d0('0x15')](_0x1bfdea);}return _0x2785c8[_0x71d0('0x16')](_0x1bfdea)[_0x71d0('0x17')]();};}function respondWithResult(_0x1775e7,_0x4a00a5){_0x4a00a5=_0x4a00a5||0xc8;return function(_0x8d2b9d){if(_0x8d2b9d){return _0x1775e7['status'](_0x4a00a5)['json'](_0x8d2b9d);}};}function respondWithFilteredResult(_0x2099d0,_0x2c3e20){return function(_0x2b5900){if(_0x2b5900){var _0x4b94e3=typeof _0x2c3e20[_0x71d0('0x18')]===_0x71d0('0x19')&&typeof _0x2c3e20[_0x71d0('0x1a')]===_0x71d0('0x19');var _0x451e3f=_0x2b5900[_0x71d0('0x1b')];var _0x44d960=_0x4b94e3?0x0:_0x2c3e20[_0x71d0('0x18')];var _0xe29fc7=_0x4b94e3?_0x2b5900[_0x71d0('0x1b')]:_0x2c3e20[_0x71d0('0x18')]+_0x2c3e20[_0x71d0('0x1a')];var _0x330265;if(_0xe29fc7>=_0x451e3f){_0xe29fc7=_0x451e3f;_0x330265=0xc8;}else{_0x330265=0xce;}_0x2099d0[_0x71d0('0x16')](_0x330265);return _0x2099d0[_0x71d0('0x1c')](_0x71d0('0x1d'),_0x44d960+'-'+_0xe29fc7+'/'+_0x451e3f)[_0x71d0('0x1e')](_0x2b5900);}return null;};}function patchUpdates(_0x1adeae){return function(_0x3980eb){try{jsonpatch[_0x71d0('0x1f')](_0x3980eb,_0x1adeae,!![]);}catch(_0x49cf47){return BPromise[_0x71d0('0x20')](_0x49cf47);}return _0x3980eb[_0x71d0('0x21')]();};}function saveUpdates(_0x5c2e93,_0x3df355){return function(_0x3e695a){if(_0x3e695a){return _0x3e695a[_0x71d0('0x22')](_0x5c2e93)[_0x71d0('0x23')](function(_0x38ee93){return _0x38ee93;});}return null;};}function removeEntity(_0x6ecbd1,_0x49b171){return function(_0xc82ccf){if(_0xc82ccf){return _0xc82ccf[_0x71d0('0x24')]()['then'](function(){var _0x579b04=_0xc82ccf['get']({'plain':!![]});var _0x4222a0=_0x71d0('0x25');return db[_0x71d0('0x26')][_0x71d0('0x24')]({'where':{'type':_0x4222a0,'resourceId':_0x579b04['id']}})[_0x71d0('0x23')](function(){return _0xc82ccf;});})[_0x71d0('0x23')](function(){_0x6ecbd1[_0x71d0('0x16')](0xcc)[_0x71d0('0x17')]();});}};}function handleEntityNotFound(_0x338ce2,_0x1a74e1){return function(_0x21ad17){if(!_0x21ad17){_0x338ce2[_0x71d0('0x15')](0x194);}return _0x21ad17;};}function handleError(_0x5c74e3,_0x395000){_0x395000=_0x395000||0x1f4;return function(_0x494ca2){logger[_0x71d0('0x27')](_0x494ca2[_0x71d0('0x28')]);if(_0x494ca2[_0x71d0('0x29')]){delete _0x494ca2[_0x71d0('0x29')];}_0x5c74e3[_0x71d0('0x16')](_0x395000)['send'](_0x494ca2);};}exports[_0x71d0('0x2a')]=function(_0x2dd062,_0x5d7b95){var _0x1b7ca4={},_0x853def={},_0x22e567={'count':0x0,'rows':[]};var _0x2146e6=_[_0x71d0('0x2b')](db[_0x71d0('0x2c')][_0x71d0('0x2d')],function(_0x397f56){return{'name':_0x397f56[_0x71d0('0x2e')],'type':_0x397f56[_0x71d0('0x2f')][_0x71d0('0x30')]};});_0x853def[_0x71d0('0x31')]=_['map'](_0x2146e6,_0x71d0('0x29'));_0x853def[_0x71d0('0x32')]=_[_0x71d0('0x33')](_0x2dd062[_0x71d0('0x32')]);_0x853def[_0x71d0('0x34')]=_['intersection'](_0x853def[_0x71d0('0x31')],_0x853def['query']);_0x1b7ca4[_0x71d0('0x35')]=_['intersection'](_0x853def[_0x71d0('0x31')],qs[_0x71d0('0x36')](_0x2dd062[_0x71d0('0x32')][_0x71d0('0x36')]));_0x1b7ca4[_0x71d0('0x35')]=_0x1b7ca4[_0x71d0('0x35')]['length']?_0x1b7ca4[_0x71d0('0x35')]:_0x853def[_0x71d0('0x31')];if(!_0x2dd062[_0x71d0('0x32')][_0x71d0('0x37')](_0x71d0('0x38'))){_0x1b7ca4[_0x71d0('0x1a')]=qs['limit'](_0x2dd062['query'][_0x71d0('0x1a')]);_0x1b7ca4[_0x71d0('0x18')]=qs['offset'](_0x2dd062[_0x71d0('0x32')][_0x71d0('0x18')]);}_0x1b7ca4['order']=qs[_0x71d0('0x39')](_0x2dd062[_0x71d0('0x32')][_0x71d0('0x39')]);_0x1b7ca4[_0x71d0('0x3a')]=qs[_0x71d0('0x34')](_[_0x71d0('0x3b')](_0x2dd062[_0x71d0('0x32')],_0x853def['filters']),_0x2146e6);if(_0x2dd062[_0x71d0('0x32')][_0x71d0('0x3c')]){_0x1b7ca4['where']=_[_0x71d0('0x3d')](_0x1b7ca4[_0x71d0('0x3a')],{'$or':_[_0x71d0('0x2b')](_0x2146e6,function(_0x519bc3){if(_0x519bc3['type']!==_0x71d0('0x3e')){var _0x5b0f43={};_0x5b0f43[_0x519bc3['name']]={'$like':'%'+_0x2dd062['query']['filter']+'%'};return _0x5b0f43;}})});}_0x1b7ca4=_['merge']({},_0x1b7ca4,_0x2dd062['options']);var _0x4e0a5c={'where':_0x1b7ca4[_0x71d0('0x3a')]};return db[_0x71d0('0x2c')]['count'](_0x4e0a5c)[_0x71d0('0x23')](function(_0x893a03){_0x22e567[_0x71d0('0x1b')]=_0x893a03;if(_0x2dd062[_0x71d0('0x32')][_0x71d0('0x3f')]){_0x1b7ca4[_0x71d0('0x40')]=[{'all':!![]}];}return db['Variable'][_0x71d0('0x41')](_0x1b7ca4);})[_0x71d0('0x23')](function(_0x2f60ea){_0x22e567[_0x71d0('0x42')]=_0x2f60ea;return _0x22e567;})[_0x71d0('0x23')](respondWithFilteredResult(_0x5d7b95,_0x1b7ca4))[_0x71d0('0x43')](handleError(_0x5d7b95,null));};exports[_0x71d0('0x44')]=function(_0x50f195,_0x39d7f7){var _0x2295b0={'raw':!![],'where':{'id':_0x50f195[_0x71d0('0x45')]['id']}},_0x142d07={};_0x142d07[_0x71d0('0x31')]=_[_0x71d0('0x33')](db[_0x71d0('0x2c')][_0x71d0('0x2d')]);_0x142d07[_0x71d0('0x32')]=_[_0x71d0('0x33')](_0x50f195[_0x71d0('0x32')]);_0x142d07[_0x71d0('0x34')]=_[_0x71d0('0x46')](_0x142d07[_0x71d0('0x31')],_0x142d07['query']);_0x2295b0[_0x71d0('0x35')]=_[_0x71d0('0x46')](_0x142d07[_0x71d0('0x31')],qs['fields'](_0x50f195[_0x71d0('0x32')][_0x71d0('0x36')]));_0x2295b0[_0x71d0('0x35')]=_0x2295b0[_0x71d0('0x35')]['length']?_0x2295b0[_0x71d0('0x35')]:_0x142d07['model'];if(_0x50f195[_0x71d0('0x32')][_0x71d0('0x3f')]){_0x2295b0[_0x71d0('0x40')]=[{'all':!![]}];}_0x2295b0=_[_0x71d0('0x3d')]({},_0x2295b0,_0x50f195[_0x71d0('0x47')]);return db[_0x71d0('0x2c')][_0x71d0('0x48')](_0x2295b0)[_0x71d0('0x23')](handleEntityNotFound(_0x39d7f7,null))['then'](respondWithResult(_0x39d7f7,null))[_0x71d0('0x43')](handleError(_0x39d7f7,null));};exports['create']=function(_0x55a400,_0x2e0396){return db[_0x71d0('0x2c')][_0x71d0('0x49')](_0x55a400[_0x71d0('0x4a')],{})[_0x71d0('0x23')](function(_0x2ed1c1){var _0x1a1b76=_0x55a400['user']['get']({'plain':!![]});if(!_0x1a1b76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a1b76[_0x71d0('0x4b')]===_0x71d0('0x4c')){var _0x3b88f4=_0x2ed1c1[_0x71d0('0x4d')]({'plain':!![]});var _0x33caa8=_0x71d0('0x25');return db[_0x71d0('0x4e')]['find']({'where':{'name':_0x33caa8,'userProfileId':_0x1a1b76[_0x71d0('0x4f')]},'raw':!![]})[_0x71d0('0x23')](function(_0x1105ab){if(_0x1105ab&&_0x1105ab[_0x71d0('0x50')]===0x0){return db[_0x71d0('0x26')][_0x71d0('0x49')]({'name':_0x3b88f4[_0x71d0('0x29')],'resourceId':_0x3b88f4['id'],'type':_0x1105ab['name'],'sectionId':_0x1105ab['id']},{})[_0x71d0('0x23')](function(){return _0x2ed1c1;});}else{return _0x2ed1c1;}})[_0x71d0('0x43')](function(_0x1f8cda){logger[_0x71d0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f8cda);throw _0x1f8cda;});}return _0x2ed1c1;})[_0x71d0('0x23')](respondWithResult(_0x2e0396,0xc9))[_0x71d0('0x43')](handleError(_0x2e0396,null));};exports['update']=function(_0x400f32,_0x33e6a7){if(_0x400f32[_0x71d0('0x4a')]['id']){delete _0x400f32[_0x71d0('0x4a')]['id'];}return db[_0x71d0('0x2c')][_0x71d0('0x48')]({'where':{'id':_0x400f32[_0x71d0('0x45')]['id']}})['then'](handleEntityNotFound(_0x33e6a7,null))[_0x71d0('0x23')](saveUpdates(_0x400f32[_0x71d0('0x4a')],null))[_0x71d0('0x23')](respondWithResult(_0x33e6a7,null))[_0x71d0('0x43')](handleError(_0x33e6a7,null));};exports[_0x71d0('0x24')]=function(_0x3ede30,_0x4a7354){return db[_0x71d0('0x2c')]['find']({'where':{'id':_0x3ede30['params']['id']}})[_0x71d0('0x23')](handleEntityNotFound(_0x4a7354,null))['then'](removeEntity(_0x4a7354,null))[_0x71d0('0x43')](handleError(_0x4a7354,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 818f044..c50a419 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 _0x1876=['define','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x1876,0x12d));var _0x6187=function(_0x7ad21,_0x41a33f){_0x7ad21=_0x7ad21-0x0;var _0x2d3a70=_0x1876[_0x7ad21];return _0x2d3a70;};'use strict';var _=require(_0x6187('0x0'));var util=require(_0x6187('0x1'));var logger=require(_0x6187('0x2'))(_0x6187('0x3'));var moment=require(_0x6187('0x4'));var BPromise=require(_0x6187('0x5'));var rp=require(_0x6187('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6187('0x7'));var config=require(_0x6187('0x8'));var attributes=require(_0x6187('0x9'));module[_0x6187('0xa')]=function(_0x40112e,_0x58da63){return _0x40112e[_0x6187('0xb')]('Variable',attributes,{'tableName':_0x6187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ac3=['bluebird','request-promise','path','../../config/environment','exports','define','tools_variables','lodash','../../config/logger','api'];(function(_0x5464a3,_0x180d2b){var _0x4b9450=function(_0x108afe){while(--_0x108afe){_0x5464a3['push'](_0x5464a3['shift']());}};_0x4b9450(++_0x180d2b);}(_0x7ac3,0x197));var _0x37ac=function(_0x469e0d,_0x33269a){_0x469e0d=_0x469e0d-0x0;var _0x149d5b=_0x7ac3[_0x469e0d];return _0x149d5b;};'use strict';var _=require(_0x37ac('0x0'));var util=require('util');var logger=require(_0x37ac('0x1'))(_0x37ac('0x2'));var moment=require('moment');var BPromise=require(_0x37ac('0x3'));var rp=require(_0x37ac('0x4'));var fs=require('fs');var path=require(_0x37ac('0x5'));var rimraf=require('rimraf');var config=require(_0x37ac('0x6'));var attributes=require('./variable.attributes');module[_0x37ac('0x7')]=function(_0x1ebfae,_0x49287b){return _0x1ebfae[_0x37ac('0x8')]('Variable',attributes,{'tableName':_0x37ac('0x9'),'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 d9ba103..ae8be83 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x4b9ba5,_0x34b868){var _0x292a7b=function(_0x18bf6f){while(--_0x18bf6f){_0x4b9ba5['push'](_0x4b9ba5['shift']());}};_0x292a7b(++_0x34b868);}(_0xabce,0x103));var _0xeabc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xabce[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x326f,0xd1));var _0xf326=function(_0x1b9dce,_0x108894){_0x1b9dce=_0x1b9dce-0x0;var _0x172858=_0x326f[_0x1b9dce];return _0x172858;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d6cd459..57131c5 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 _0xe22c=['isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x2d9043,_0x4d3914){var _0x30dbbe=function(_0x5433b6){while(--_0x5433b6){_0x2d9043['push'](_0x2d9043['shift']());}};_0x30dbbe(++_0x4d3914);}(_0xe22c,0xdb));var _0xce22=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe22c[_0x502c7d];return _0x30b7ed;};'use strict';var express=require('express');var router=express[_0xce22('0x0')]();var auth=require(_0xce22('0x1'));var controller=require(_0xce22('0x2'));router[_0xce22('0x3')]('/',controller[_0xce22('0x4')]);router[_0xce22('0x3')]('/fetch',auth[_0xce22('0x5')](),auth[_0xce22('0x6')](),controller[_0xce22('0x7')]);router[_0xce22('0x3')](_0xce22('0x8'),auth[_0xce22('0x5')](),auth[_0xce22('0x6')](),controller[_0xce22('0x9')]);router[_0xce22('0x3')](_0xce22('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xce22('0xb')]);router[_0xce22('0x3')](_0xce22('0xc'),auth['isAuthenticated'](),controller[_0xce22('0xd')]);router['get'](_0xce22('0xe'),controller[_0xce22('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa74a=['/restart','restart','exports','../../components/auth/service','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','pull'];(function(_0x52a86a,_0x471b8c){var _0x3ebe88=function(_0x4588a2){while(--_0x4588a2){_0x52a86a['push'](_0x52a86a['shift']());}};_0x3ebe88(++_0x471b8c);}(_0xa74a,0x19a));var _0xaa74=function(_0x3ce1a1,_0x465127){_0x3ce1a1=_0x3ce1a1-0x0;var _0x32c826=_0xa74a[_0x3ce1a1];return _0x32c826;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xaa74('0x0'));var controller=require('./version.controller');router['get']('/',controller['index']);router[_0xaa74('0x1')](_0xaa74('0x2'),auth[_0xaa74('0x3')](),auth['canUpdate'](),controller[_0xaa74('0x4')]);router[_0xaa74('0x1')](_0xaa74('0x5'),auth[_0xaa74('0x3')](),auth[_0xaa74('0x6')](),controller['reset']);router[_0xaa74('0x1')]('/pull',auth[_0xaa74('0x3')](),auth[_0xaa74('0x6')](),controller[_0xaa74('0x7')]);router['get'](_0xaa74('0x8'),auth[_0xaa74('0x3')](),controller[_0xaa74('0x9')]);router['get']('/migrations',controller['migrations']);module[_0xaa74('0xa')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 2089f1f..0520338 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 _0x4534=['map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','tags','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','join'];(function(_0x25ebc2,_0x134562){var _0x5b193e=function(_0x1544c1){while(--_0x1544c1){_0x25ebc2['push'](_0x25ebc2['shift']());}};_0x5b193e(++_0x134562);}(_0x4534,0x1e2));var _0x4453=function(_0x442a21,_0x445127){_0x442a21=_0x442a21-0x0;var _0x450760=_0x4534[_0x442a21];return _0x450760;};'use strict';var Umzug=require(_0x4453('0x0'));var path=require(_0x4453('0x1'));var fs=require('fs');var _=require(_0x4453('0x2'));var pkginfo=require(_0x4453('0x3'))(module,_0x4453('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x4453('0x5'))['exec'];var db=require(_0x4453('0x6'))['db'];var config=require(_0x4453('0x7'));var pm2=require(_0x4453('0x8'));var logger=require(_0x4453('0x9'))(_0x4453('0xa'));var git=require(_0x4453('0xb'))(config[_0x4453('0xc')]);exports['index']=function(_0x2d5d62,_0x465063){var _0x124bac={'current':module[_0x4453('0xd')][_0x4453('0x4')],'phonebar':0x2};if(_0x2d5d62[_0x4453('0xe')]&&_0x2d5d62['query'][_0x4453('0xf')]){return git[_0x4453('0x10')]()[_0x4453('0x11')](function(_0xe11a34,_0x20ae0b){_0x124bac[_0x4453('0xf')]=(_0xe11a34?module[_0x4453('0xd')][_0x4453('0x4')]:_0x20ae0b[_0x4453('0xf')])||_0x4453('0x12');return _0x465063[_0x4453('0x13')](0xc8)[_0x4453('0x14')](_0x124bac);});}else{return _0x465063[_0x4453('0x13')](0xc8)[_0x4453('0x14')](_0x124bac);}};exports[_0x4453('0x10')]=function(_0x44f137,_0x125cd4){return git[_0x4453('0x10')](['origin','master'],function(_0x572507){if(_0x572507){logger[_0x4453('0x15')](_0x572507);return _0x125cd4[_0x4453('0x13')](0x1f4)[_0x4453('0x14')](_0x572507);}logger[_0x4453('0x16')](_0x4453('0x17'));return _0x125cd4[_0x4453('0x13')](0xc8)[_0x4453('0x14')]({'output':_0x4453('0x18')});});};exports[_0x4453('0x19')]=function(_0x4f2898,_0x3bbbd6){return git[_0x4453('0x19')]([_0x4453('0x1a'),_0x4453('0x1b')],function(_0xc35527){if(_0xc35527){logger['error'](_0xc35527);return _0x3bbbd6[_0x4453('0x13')](0x1f4)['json'](_0xc35527);}logger['info'](_0x4453('0x1c'));return _0x3bbbd6['status'](0xc8)[_0x4453('0x14')]({'output':_0x4453('0x1d')});});};exports[_0x4453('0x1e')]=function(_0x3a7e5a,_0x7f6894){exec(_0x4453('0x1f'),function(_0x12f77c,_0x1d4dbc,_0x34ec7a){logger[_0x4453('0x16')](_0x1d4dbc);logger[_0x4453('0x16')](_0x34ec7a);if(_0x12f77c){logger[_0x4453('0x15')](_0x12f77c);return _0x7f6894[_0x4453('0x13')](0x1f4)[_0x4453('0x14')](_0x12f77c);}return _0x7f6894['status'](0xc8)['json']({'output':_0x1d4dbc});});};exports[_0x4453('0x20')]=function(_0x39a382,_0x1af855){return pm2[_0x4453('0x20')](_0x4453('0x21'))[_0x4453('0x22')](function(_0x2d5ca4){logger[_0x4453('0x16')]('pm2\x20restart\x20motion\x20%s',_0x2d5ca4);return _0x1af855[_0x4453('0x13')](0xc8)['json']({'output':_0x4453('0x23')});})['catch'](function(_0x116d15){logger[_0x4453('0x15')](_0x116d15);return _0x1af855[_0x4453('0x13')](0x1f4)[_0x4453('0x14')](_0x116d15);});};exports[_0x4453('0x24')]=function(_0x1710cb,_0xc608dc){var _0x5b767b=fs[_0x4453('0x25')](path['join'](config['root'],_0x4453('0x26'),'migrations'));var _0x4f8bf0=[];for(var _0x5cad25=0x0;_0x5cad25<_0x5b767b[_0x4453('0x27')];_0x5cad25++){var _0x23ac11=_0x5b767b[_0x5cad25][_0x4453('0x28')](_0x4453('0x29'),'');if(compareVersions(module[_0x4453('0xd')][_0x4453('0x4')],_0x23ac11)===-0x1){_0x4f8bf0['push'](_0x23ac11);}}if(_0x4f8bf0['length']){var _0x35891d=_0x4f8bf0[_0x4453('0x2a')](compareVersions);var _0x3b5f05=new Umzug({'storage':_0x4453('0x2b'),'storageOptions':{'model':db[_0x4453('0x2c')],'modelName':_0x4453('0x2c'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x4453('0x2d')](),db[_0x4453('0x2b')][_0x4453('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[_0x4453('0x2f')](config[_0x4453('0xc')],_0x4453('0x26'),_0x4453('0x24')),'pattern':/\.js$/}});_0x3b5f05['up']({'migrations':_[_0x4453('0x30')](_0x35891d,function(_0x1d79ba){return _0x1d79ba+_0x4453('0x29');})})[_0x4453('0x22')](function(){return _0xc608dc[_0x4453('0x13')](0xc8)[_0x4453('0x14')]({'output':_0x4453('0x31')+module['exports']['version']+_0x4453('0x32')+_['last'](_0x35891d),'migrations':_[_0x4453('0x2f')](_0x35891d)});})[_0x4453('0x33')](function(_0x1dd13b){if(_0x1dd13b instanceof db['sequelize']['UniqueConstraintError']){return _0xc608dc[_0x4453('0x13')](0xc8)[_0x4453('0x14')]({'output':_0x4453('0x34')});}else{return _0xc608dc[_0x4453('0x13')](0x1f4)[_0x4453('0x14')](_0x1dd13b);}});}else{return _0xc608dc[_0x4453('0x13')](0xc8)[_0x4453('0x14')]({'output':_0x4453('0x34')});}}; \ No newline at end of file +var _0xd5b1=['--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','info','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','server','migrations','length','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','catch','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','tags','status','json','origin','master','reset'];(function(_0x1dac4f,_0x36a9b3){var _0x5cf734=function(_0x4e51ef){while(--_0x4e51ef){_0x1dac4f['push'](_0x1dac4f['shift']());}};_0x5cf734(++_0x36a9b3);}(_0xd5b1,0x111));var _0x1d5b=function(_0x551776,_0x39d319){_0x551776=_0x551776-0x0;var _0x2302e1=_0xd5b1[_0x551776];return _0x2302e1;};'use strict';var Umzug=require(_0x1d5b('0x0'));var path=require(_0x1d5b('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x1d5b('0x2'))(module,_0x1d5b('0x3'));var compareVersions=require(_0x1d5b('0x4'));var exec=require('child_process')['exec'];var db=require(_0x1d5b('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x1d5b('0x6'));var logger=require(_0x1d5b('0x7'))(_0x1d5b('0x8'));var git=require(_0x1d5b('0x9'))(config[_0x1d5b('0xa')]);exports['index']=function(_0x25119c,_0x5b605a){var _0x39b3fc={'current':module[_0x1d5b('0xb')][_0x1d5b('0x3')],'phonebar':0x2};if(_0x25119c[_0x1d5b('0xc')]&&_0x25119c[_0x1d5b('0xc')][_0x1d5b('0xd')]){return git[_0x1d5b('0xe')]()[_0x1d5b('0xf')](function(_0x1197b5,_0x3e20b8){_0x39b3fc[_0x1d5b('0xd')]=(_0x1197b5?module[_0x1d5b('0xb')][_0x1d5b('0x3')]:_0x3e20b8['latest'])||'2.0.0';return _0x5b605a[_0x1d5b('0x10')](0xc8)['json'](_0x39b3fc);});}else{return _0x5b605a[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')](_0x39b3fc);}};exports[_0x1d5b('0xe')]=function(_0x486308,_0x277d0f){return git['fetch']([_0x1d5b('0x12'),_0x1d5b('0x13')],function(_0x4b74a6){if(_0x4b74a6){logger['error'](_0x4b74a6);return _0x277d0f[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x4b74a6);}logger['info']('git\x20fetch');return _0x277d0f['status'](0xc8)[_0x1d5b('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x1d5b('0x14')]=function(_0x17729f,_0x816e73){return git['reset']([_0x1d5b('0x15'),_0x1d5b('0x16')],function(_0x474959){if(_0x474959){logger[_0x1d5b('0x17')](_0x474959);return _0x816e73[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x474959);}logger['info'](_0x1d5b('0x18'));return _0x816e73[_0x1d5b('0x10')](0xc8)['json']({'output':_0x1d5b('0x19')});});};exports['pull']=function(_0x3c9489,_0x139a30){exec('npm\x20install\x20--production',function(_0x36574e,_0x234ae8,_0xeee0a2){logger[_0x1d5b('0x1a')](_0x234ae8);logger[_0x1d5b('0x1a')](_0xeee0a2);if(_0x36574e){logger[_0x1d5b('0x17')](_0x36574e);return _0x139a30[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x36574e);}return _0x139a30[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')]({'output':_0x234ae8});});};exports[_0x1d5b('0x1b')]=function(_0x482735,_0xef79c0){return pm2['restart'](_0x1d5b('0x1c'))['then'](function(_0x2dfd08){logger['info']('pm2\x20restart\x20motion\x20%s',_0x2dfd08);return _0xef79c0['status'](0xc8)['json']({'output':_0x1d5b('0x1d')});})['catch'](function(_0x6feed9){logger['error'](_0x6feed9);return _0xef79c0[_0x1d5b('0x10')](0x1f4)[_0x1d5b('0x11')](_0x6feed9);});};exports['migrations']=function(_0x11db01,_0x4a5872){var _0x1b3e72=fs[_0x1d5b('0x1e')](path['join'](config[_0x1d5b('0xa')],_0x1d5b('0x1f'),_0x1d5b('0x20')));var _0x4887ed=[];for(var _0x3a589c=0x0;_0x3a589c<_0x1b3e72[_0x1d5b('0x21')];_0x3a589c++){var _0x15deb7=_0x1b3e72[_0x3a589c]['replace']('.js','');if(compareVersions(module['exports'][_0x1d5b('0x3')],_0x15deb7)===-0x1){_0x4887ed[_0x1d5b('0x22')](_0x15deb7);}}if(_0x4887ed[_0x1d5b('0x21')]){var _0x510c43=_0x4887ed[_0x1d5b('0x23')](compareVersions);var _0x5d71d1=new Umzug({'storage':_0x1d5b('0x24'),'storageOptions':{'model':db[_0x1d5b('0x25')],'modelName':'Migration','columnName':_0x1d5b('0x3')},'migrations':{'params':[db[_0x1d5b('0x24')][_0x1d5b('0x26')](),db['sequelize'][_0x1d5b('0x27')],function(){throw new Error(_0x1d5b('0x28'));}],'path':path['join'](config[_0x1d5b('0xa')],'server',_0x1d5b('0x20')),'pattern':/\.js$/}});_0x5d71d1['up']({'migrations':_['map'](_0x510c43,function(_0x374f94){return _0x374f94+_0x1d5b('0x29');})})[_0x1d5b('0x2a')](function(){return _0x4a5872[_0x1d5b('0x10')](0xc8)['json']({'output':_0x1d5b('0x2b')+module['exports'][_0x1d5b('0x3')]+_0x1d5b('0x2c')+_[_0x1d5b('0x2d')](_0x510c43),'migrations':_[_0x1d5b('0x2e')](_0x510c43)});})[_0x1d5b('0x2f')](function(_0x8f2953){if(_0x8f2953 instanceof db['sequelize']['UniqueConstraintError']){return _0x4a5872[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')]({'output':_0x1d5b('0x30')});}else{return _0x4a5872['status'](0x1f4)['json'](_0x8f2953);}});}else{return _0x4a5872[_0x1d5b('0x10')](0xc8)[_0x1d5b('0x11')]({'output':_0x1d5b('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index efda805..92196a3 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 _0x00e4=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x00e4,0x87));var _0x400e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x00e4[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x400e('0x0'));var timeout=require(_0x400e('0x1'));var express=require(_0x400e('0x2'));var router=express[_0x400e('0x3')]();var fs_extra=require(_0x400e('0x4'));var auth=require(_0x400e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x400e('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x400e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x400e('0x7')](_0x400e('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x400e('0x7')](_0x400e('0x9'),auth[_0x400e('0xa')](),controller[_0x400e('0xb')]);router[_0x400e('0xc')]('/',auth[_0x400e('0xa')](),controller[_0x400e('0xd')]);router['put'](_0x400e('0x9'),auth[_0x400e('0xa')](),controller[_0x400e('0xe')]);router[_0x400e('0xf')](_0x400e('0x9'),auth[_0x400e('0xa')](),controller[_0x400e('0x10')]);module[_0x400e('0x11')]=router; \ No newline at end of file +var _0xd319=['/:id','show','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xd319,0x12e));var _0x9d31=function(_0x3f55cf,_0x2b17b8){_0x3f55cf=_0x3f55cf-0x0;var _0x5b7f57=_0xd319[_0x3f55cf];return _0x5b7f57;};'use strict';var multer=require(_0x9d31('0x0'));var util=require(_0x9d31('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d31('0x2')]();var fs_extra=require(_0x9d31('0x3'));var auth=require(_0x9d31('0x4'));var interaction=require(_0x9d31('0x5'));var config=require(_0x9d31('0x6'));var controller=require(_0x9d31('0x7'));router['get']('/',auth[_0x9d31('0x8')](),controller[_0x9d31('0x9')]);router[_0x9d31('0xa')](_0x9d31('0xb'),auth['isAuthenticated'](),controller[_0x9d31('0xc')]);router[_0x9d31('0xa')](_0x9d31('0xd'),auth[_0x9d31('0x8')](),controller[_0x9d31('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9d31('0xf')]);router[_0x9d31('0x10')]('/:id',auth[_0x9d31('0x8')](),controller[_0x9d31('0x11')]);router[_0x9d31('0x12')]('/:id',auth[_0x9d31('0x8')](),controller[_0x9d31('0x13')]);module[_0x9d31('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 8d4068a..cacf3be 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 _0xb44a=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb44a,0x1c2));var _0xab44=function(_0x39f9f2,_0x37fc06){_0x39f9f2=_0x39f9f2-0x0;var _0x3febf8=_0xb44a[_0x39f9f2];return _0x3febf8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xab44('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xab44('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xab44('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xab44('0x1')]},'agentconnectAt':{'type':Sequelize[_0xab44('0x1')]},'agentcompleteAt':{'type':Sequelize[_0xab44('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0xab44('0x1')]},'agentdumpAt':{'type':Sequelize[_0xab44('0x1')]},'holdtime':{'type':Sequelize[_0xab44('0x2')]},'agentcomplete':{'type':Sequelize[_0xab44('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xab44('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xab44('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xab44('0x2')]},'agentacw':{'type':Sequelize[_0xab44('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xab44('0x2')]},'reason':{'type':Sequelize[_0xab44('0x0')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xab44('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xab44('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xab44('0x0')]},'accountcode':{'type':Sequelize[_0xab44('0x0')]},'context':{'type':Sequelize[_0xab44('0x0')]},'exten':{'type':Sequelize[_0xab44('0x0')]},'priority':{'type':Sequelize[_0xab44('0x0')]},'destchannel':{'type':Sequelize[_0xab44('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xab44('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xab44('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xab44('0x0')]},'destaccountcode':{'type':Sequelize[_0xab44('0x0')]},'destcontext':{'type':Sequelize[_0xab44('0x0')]},'destexten':{'type':Sequelize[_0xab44('0x0')]},'destpriority':{'type':Sequelize[_0xab44('0x0')]},'destuniqueid':{'type':Sequelize[_0xab44('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xab44('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xab44('0x0')],'comment':_0xab44('0x4')},'transferexten':{'type':Sequelize[_0xab44('0x0')]},'transferuniqueid':{'type':Sequelize[_0xab44('0x0')]},'agententerreason':{'type':Sequelize[_0xab44('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4bde=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x35d228,_0x4ed0bc){var _0x4ea604=function(_0x5471f3){while(--_0x5471f3){_0x35d228['push'](_0x35d228['shift']());}};_0x4ea604(++_0x4ed0bc);}(_0x4bde,0x1b1));var _0xe4bd=function(_0xc47856,_0x2aa357){_0xc47856=_0xc47856-0x0;var _0x4dbaa1=_0x4bde[_0xc47856];return _0x4dbaa1;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'type':{'type':Sequelize[_0xe4bd('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'calleridname':{'type':Sequelize[_0xe4bd('0x2')]},'queue':{'type':Sequelize[_0xe4bd('0x2')]},'interface':{'type':Sequelize[_0xe4bd('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe4bd('0x3')]},'holdtime':{'type':Sequelize[_0xe4bd('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe4bd('0x4')]},'agentacw':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe4bd('0x4')]},'reason':{'type':Sequelize[_0xe4bd('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe4bd('0x2')]},'context':{'type':Sequelize[_0xe4bd('0x2')]},'exten':{'type':Sequelize[_0xe4bd('0x2')]},'priority':{'type':Sequelize[_0xe4bd('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe4bd('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'destlanguage':{'type':Sequelize[_0xe4bd('0x2')]},'destaccountcode':{'type':Sequelize[_0xe4bd('0x2')]},'destcontext':{'type':Sequelize[_0xe4bd('0x2')]},'destexten':{'type':Sequelize[_0xe4bd('0x2')]},'destpriority':{'type':Sequelize[_0xe4bd('0x2')]},'destuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe4bd('0x2')]},'transfer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe4bd('0x2')],'comment':_0xe4bd('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'agententerreason':{'type':Sequelize[_0xe4bd('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index b96c355..4e844e1 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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 710092a..961e0f3 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 _0x06f4=['api','moment','path','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x361410,_0x53f17d){var _0x576e43=function(_0x4b7adc){while(--_0x4b7adc){_0x361410['push'](_0x361410['shift']());}};_0x576e43(++_0x53f17d);}(_0x06f4,0x136));var _0x406f=function(_0x11e446,_0x2d1d0d){_0x11e446=_0x11e446-0x0;var _0x5da68e=_0x06f4[_0x11e446];return _0x5da68e;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var logger=require('../../config/logger')(_0x406f('0x2'));var moment=require(_0x406f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x406f('0x4'));var rimraf=require('rimraf');var config=require(_0x406f('0x5'));var attributes=require(_0x406f('0x6'));module[_0x406f('0x7')]=function(_0x32b2bd,_0x59821c){return _0x32b2bd[_0x406f('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x406f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x406f('0xa'),_0x406f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f0d=['uniqueid','destuniqueid','bluebird','request-promise','path','../../config/environment','define','VoiceAgentReport'];(function(_0x538753,_0x2e0e8f){var _0x3a795e=function(_0x29bd24){while(--_0x29bd24){_0x538753['push'](_0x538753['shift']());}};_0x3a795e(++_0x2e0e8f);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x458edc,_0x9baf98){_0x458edc=_0x458edc-0x0;var _0x44af29=_0x4f0d[_0x458edc];return _0x44af29;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd4f0('0x0'));var rp=require(_0xd4f0('0x1'));var fs=require('fs');var path=require(_0xd4f0('0x2'));var rimraf=require('rimraf');var config=require(_0xd4f0('0x3'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x1809dd,_0x4da370){return _0x1809dd[_0xd4f0('0x4')](_0xd4f0('0x5'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xd4f0('0x6'),_0xd4f0('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index af45dab..3ee568f 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 _0x6a8f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','then','stringify','UpdateVoiceAgentReport','raw','where','attributes','limit','lodash','util','bluebird','randomstring'];(function(_0x3201c5,_0x3ce95f){var _0x3f2a41=function(_0x373254){while(--_0x373254){_0x3201c5['push'](_0x3201c5['shift']());}};_0x3f2a41(++_0x3ce95f);}(_0x6a8f,0x151));var _0xf6a8=function(_0xc7d92f,_0x2f2193){_0xc7d92f=_0xc7d92f-0x0;var _0x3a17ea=_0x6a8f[_0xc7d92f];return _0x3a17ea;};'use strict';var _=require(_0xf6a8('0x0'));var util=require(_0xf6a8('0x1'));var moment=require('moment');var BPromise=require(_0xf6a8('0x2'));var rs=require(_0xf6a8('0x3'));var fs=require('fs');var Redis=require(_0xf6a8('0x4'));var db=require(_0xf6a8('0x5'))['db'];var utils=require(_0xf6a8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf6a8('0x7'));var jayson=require(_0xf6a8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52e296,_0x306c35,_0x328172){return new BPromise(function(_0x1e5ad4,_0x23c571){return client[_0xf6a8('0x9')](_0x52e296,_0x328172)['then'](function(_0x159bea){logger['info'](_0xf6a8('0xa'),_0x306c35,_0xf6a8('0xb'));logger[_0xf6a8('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x306c35,_0xf6a8('0xb'),JSON['stringify'](_0x159bea));if(_0x159bea[_0xf6a8('0xd')]){if(_0x159bea[_0xf6a8('0xd')][_0xf6a8('0xe')]===0x1f4){logger['error'](_0xf6a8('0xa'),_0x306c35,_0x159bea['error']['message']);return _0x23c571(_0x159bea[_0xf6a8('0xd')]['message']);}logger[_0xf6a8('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x306c35,_0x159bea[_0xf6a8('0xd')]['message']);return _0x1e5ad4(_0x159bea[_0xf6a8('0xd')][_0xf6a8('0xf')]);}else{logger[_0xf6a8('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x306c35,_0xf6a8('0xb'));_0x1e5ad4(_0x159bea[_0xf6a8('0x11')][_0xf6a8('0xf')]);}})[_0xf6a8('0x12')](function(_0x162200){logger[_0xf6a8('0xd')](_0xf6a8('0xa'),_0x306c35,_0x162200);_0x23c571(_0x162200);});});}exports[_0xf6a8('0x13')]=function(_0xf31566){var _0x49ad36=this;return new Promise(function(_0x1370b2,_0xfd48aa){return db[_0xf6a8('0x14')][_0xf6a8('0x15')](_0xf31566[_0xf6a8('0x16')],{'raw':_0xf31566[_0xf6a8('0x17')]?_0xf31566[_0xf6a8('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf6a8('0x18')](function(_0x461298){logger[_0xf6a8('0x10')](_0xf6a8('0x13'),_0xf31566);logger[_0xf6a8('0xc')]('CreateVoiceAgentReport',_0xf31566,JSON[_0xf6a8('0x19')](_0x461298));_0x1370b2(_0x461298);})[_0xf6a8('0x12')](function(_0x5cb68c){logger[_0xf6a8('0xd')](_0xf6a8('0x13'),_0x5cb68c[_0xf6a8('0xf')],_0xf31566);_0xfd48aa(_0x49ad36[_0xf6a8('0xd')](0x1f4,_0x5cb68c[_0xf6a8('0xf')]));});});};exports[_0xf6a8('0x1a')]=function(_0x294408){var _0x2bf57d=this;return new Promise(function(_0x3865a0,_0xc6f94c){return db['VoiceAgentReport']['update'](_0x294408[_0xf6a8('0x16')],{'raw':_0x294408['options']?_0x294408[_0xf6a8('0x17')][_0xf6a8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294408[_0xf6a8('0x17')]?_0x294408[_0xf6a8('0x17')][_0xf6a8('0x1c')]||null:null,'attributes':_0x294408['options']?_0x294408[_0xf6a8('0x17')][_0xf6a8('0x1d')]||null:null,'limit':_0x294408['options']?_0x294408[_0xf6a8('0x17')][_0xf6a8('0x1e')]||null:null})[_0xf6a8('0x18')](function(_0x5f18d4){logger[_0xf6a8('0x10')]('UpdateVoiceAgentReport',_0x294408);logger[_0xf6a8('0xc')](_0xf6a8('0x1a'),_0x294408,JSON['stringify'](_0x5f18d4));_0x3865a0(_0x5f18d4);})['catch'](function(_0x30af8e){logger[_0xf6a8('0xd')](_0xf6a8('0x1a'),_0x30af8e[_0xf6a8('0xf')],_0x294408);_0xc6f94c(_0x2bf57d[_0xf6a8('0xd')](0x1f4,_0x30af8e[_0xf6a8('0xf')]));});});}; \ No newline at end of file +var _0x7696=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','catch','where','attributes','limit','UpdateVoiceAgentReport','util','moment','bluebird','randomstring','ioredis'];(function(_0x11c269,_0x28b2ca){var _0x16ee45=function(_0x25975d){while(--_0x25975d){_0x11c269['push'](_0x11c269['shift']());}};_0x16ee45(++_0x28b2ca);}(_0x7696,0x96));var _0x6769=function(_0x1ed6f4,_0x29f029){_0x1ed6f4=_0x1ed6f4-0x0;var _0x4c521a=_0x7696[_0x1ed6f4];return _0x4c521a;};'use strict';var _=require('lodash');var util=require(_0x6769('0x0'));var moment=require(_0x6769('0x1'));var BPromise=require(_0x6769('0x2'));var rs=require(_0x6769('0x3'));var fs=require('fs');var Redis=require(_0x6769('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6769('0x5'));var logger=require(_0x6769('0x6'))('rpc');var config=require(_0x6769('0x7'));var jayson=require(_0x6769('0x8'));var client=jayson[_0x6769('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f03b4,_0x319b53,_0x18f4b3){return new BPromise(function(_0x52b10b,_0x119846){return client[_0x6769('0xa')](_0x2f03b4,_0x18f4b3)[_0x6769('0xb')](function(_0x463169){logger[_0x6769('0xc')](_0x6769('0xd'),_0x319b53,_0x6769('0xe'));logger[_0x6769('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x319b53,_0x6769('0xe'),JSON['stringify'](_0x463169));if(_0x463169['error']){if(_0x463169[_0x6769('0x10')][_0x6769('0x11')]===0x1f4){logger['error'](_0x6769('0xd'),_0x319b53,_0x463169['error'][_0x6769('0x12')]);return _0x119846(_0x463169['error'][_0x6769('0x12')]);}logger[_0x6769('0x10')](_0x6769('0xd'),_0x319b53,_0x463169[_0x6769('0x10')][_0x6769('0x12')]);return _0x52b10b(_0x463169[_0x6769('0x10')][_0x6769('0x12')]);}else{logger[_0x6769('0xc')](_0x6769('0xd'),_0x319b53,_0x6769('0xe'));_0x52b10b(_0x463169[_0x6769('0x13')][_0x6769('0x12')]);}})['catch'](function(_0x53416c){logger[_0x6769('0x10')](_0x6769('0xd'),_0x319b53,_0x53416c);_0x119846(_0x53416c);});});}exports[_0x6769('0x14')]=function(_0x326eae){var _0xb18c38=this;return new Promise(function(_0x1fabea,_0x1c6799){return db[_0x6769('0x15')][_0x6769('0x16')](_0x326eae['body'],{'raw':_0x326eae[_0x6769('0x17')]?_0x326eae['options'][_0x6769('0x18')]===undefined?!![]:![]:!![]})[_0x6769('0xb')](function(_0x5ec2e2){logger[_0x6769('0xc')](_0x6769('0x14'),_0x326eae);logger[_0x6769('0xf')](_0x6769('0x14'),_0x326eae,JSON[_0x6769('0x19')](_0x5ec2e2));_0x1fabea(_0x5ec2e2);})[_0x6769('0x1a')](function(_0x128b4b){logger[_0x6769('0x10')](_0x6769('0x14'),_0x128b4b[_0x6769('0x12')],_0x326eae);_0x1c6799(_0xb18c38[_0x6769('0x10')](0x1f4,_0x128b4b['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x561890){var _0x3ce12d=this;return new Promise(function(_0x3e1987,_0x5089f2){return db['VoiceAgentReport']['update'](_0x561890['body'],{'raw':_0x561890[_0x6769('0x17')]?_0x561890['options'][_0x6769('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561890[_0x6769('0x17')]?_0x561890['options'][_0x6769('0x1b')]||null:null,'attributes':_0x561890['options']?_0x561890['options'][_0x6769('0x1c')]||null:null,'limit':_0x561890[_0x6769('0x17')]?_0x561890[_0x6769('0x17')][_0x6769('0x1d')]||null:null})[_0x6769('0xb')](function(_0x57598d){logger[_0x6769('0xc')](_0x6769('0x1e'),_0x561890);logger['debug'](_0x6769('0x1e'),_0x561890,JSON[_0x6769('0x19')](_0x57598d));_0x3e1987(_0x57598d);})['catch'](function(_0x10d892){logger[_0x6769('0x10')](_0x6769('0x1e'),_0x10d892[_0x6769('0x12')],_0x561890);_0x5089f2(_0x3ce12d[_0x6769('0x10')](0x1f4,_0x10d892[_0x6769('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 37536db..162a10c 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 _0xf873=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x243e44,_0x51e134){var _0x4d08dc=function(_0x535ada){while(--_0x535ada){_0x243e44['push'](_0x243e44['shift']());}};_0x4d08dc(++_0x51e134);}(_0xf873,0xb2));var _0x3f87=function(_0xc045df,_0x119281){_0xc045df=_0xc045df-0x0;var _0x5577df=_0xf873[_0xc045df];return _0x5577df;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var fs_extra=require(_0x3f87('0x5'));var auth=require(_0x3f87('0x6'));var interaction=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var controller=require('./voiceCallReport.controller');router[_0x3f87('0x9')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0xb')]);router['get'](_0x3f87('0xc'),auth[_0x3f87('0xa')](),controller[_0x3f87('0xd')]);router[_0x3f87('0x9')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller['show']);router[_0x3f87('0xf')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0x10')]);router[_0x3f87('0x11')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x12')]);router[_0x3f87('0x13')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x14')]);module[_0x3f87('0x15')]=router; \ No newline at end of file +var _0x0c02=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','util','path','express','Router'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x20c0('0x9')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0xe')]('/',auth[_0x20c0('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x20c0('0xf')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d71a153..61102c8 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 _0x62fc=['outbound','STRING','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal'];(function(_0x3dc55d,_0xd07e93){var _0x3aa7f3=function(_0x506b46){while(--_0x506b46){_0x3dc55d['push'](_0x3dc55d['shift']());}};_0x3aa7f3(++_0xd07e93);}(_0x62fc,0x9d));var _0xc62f=function(_0x2aba5a,_0x1171d8){_0x2aba5a=_0x2aba5a-0x0;var _0x5abb7d=_0x62fc[_0x2aba5a];return _0x5abb7d;};'use strict';var Sequelize=require(_0xc62f('0x0'));module[_0xc62f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc62f('0x2')](_0xc62f('0x3'),_0xc62f('0x4'),_0xc62f('0x5'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0xc62f('0x6')]},'accountcode':{'type':Sequelize[_0xc62f('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc62f('0x6')]},'callerid':{'type':Sequelize[_0xc62f('0x6')]},'channel':{'type':Sequelize[_0xc62f('0x6')]},'destinationchannel':{'type':Sequelize[_0xc62f('0x6')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xc62f('0x7')]},'systemanswertime':{'type':Sequelize[_0xc62f('0x7')]},'answertime':{'type':Sequelize[_0xc62f('0x7')]},'endtime':{'type':Sequelize[_0xc62f('0x7')]},'duration':{'type':Sequelize[_0xc62f('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xc62f('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc62f('0x6')]},'amaflags':{'type':Sequelize[_0xc62f('0x6')]},'userfield':{'type':Sequelize[_0xc62f('0x6')]},'userDisposition':{'type':Sequelize[_0xc62f('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xc62f('0x6')]},'userThirdDisposition':{'type':Sequelize[_0xc62f('0x6')]},'note':{'type':Sequelize[_0xc62f('0x6')]},'prefix':{'type':Sequelize[_0xc62f('0x6')]},'routeid':{'type':Sequelize[_0xc62f('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe6e5=['internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x1d7c83,_0x2d8f2d){var _0x283ef2=function(_0x68da53){while(--_0x68da53){_0x1d7c83['push'](_0x1d7c83['shift']());}};_0x283ef2(++_0x2d8f2d);}(_0xe6e5,0x1e7));var _0x5e6e=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xe6e5[_0x5ddaac];return _0x2a9c58;};'use strict';var Sequelize=require(_0x5e6e('0x0'));module[_0x5e6e('0x1')]={'uniqueid':{'type':Sequelize[_0x5e6e('0x2')]},'type':{'type':Sequelize[_0x5e6e('0x3')](_0x5e6e('0x4'),_0x5e6e('0x5'),'outbound',_0x5e6e('0x6'),_0x5e6e('0x7'),_0x5e6e('0x8'))},'tag':{'type':Sequelize[_0x5e6e('0x2')]},'accountcode':{'type':Sequelize[_0x5e6e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x5e6e('0x2')]},'destinationcontext':{'type':Sequelize[_0x5e6e('0x2')]},'callerid':{'type':Sequelize[_0x5e6e('0x2')]},'channel':{'type':Sequelize[_0x5e6e('0x2')]},'destinationchannel':{'type':Sequelize[_0x5e6e('0x2')]},'lastapplication':{'type':Sequelize[_0x5e6e('0x2')]},'lastdata':{'type':Sequelize[_0x5e6e('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x5e6e('0xa')]},'answertime':{'type':Sequelize[_0x5e6e('0xa')]},'endtime':{'type':Sequelize[_0x5e6e('0xa')]},'duration':{'type':Sequelize[_0x5e6e('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5e6e('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5e6e('0x2')]},'amaflags':{'type':Sequelize[_0x5e6e('0x2')]},'userfield':{'type':Sequelize[_0x5e6e('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x5e6e('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5e6e('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x5e6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index dc8127b..99591da 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0xadb5,0xad));var _0x5adb=function(_0x9681f4,_0x519420){_0x9681f4=_0x9681f4-0x0;var _0xdbdc58=_0xadb5[_0x9681f4];return _0xdbdc58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0xf0091f,_0x382a66){var _0x59ee21=function(_0x4cd74d){while(--_0x4cd74d){_0xf0091f['push'](_0xf0091f['shift']());}};_0x59ee21(++_0x382a66);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x0b0e[_0x32b542];return _0x554d54;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index fba2722..2c167fc 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 _0x5ce9=['rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x5ce9,0x1b5));var _0x95ce=function(_0xa1e4bc,_0x35f14f){_0xa1e4bc=_0xa1e4bc-0x0;var _0x4c74f7=_0x5ce9[_0xa1e4bc];return _0x4c74f7;};'use strict';var _=require(_0x95ce('0x0'));var util=require(_0x95ce('0x1'));var logger=require(_0x95ce('0x2'))(_0x95ce('0x3'));var moment=require(_0x95ce('0x4'));var BPromise=require(_0x95ce('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95ce('0x6'));var rimraf=require(_0x95ce('0x7'));var config=require(_0x95ce('0x8'));var attributes=require(_0x95ce('0x9'));module['exports']=function(_0x20da36,_0x17b09f){return _0x20da36['define'](_0x95ce('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x95ce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5308=['VoiceCallReport','report_call','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x41232b,_0x17850d){var _0x84762b=function(_0x11cbee){while(--_0x11cbee){_0x41232b['push'](_0x41232b['shift']());}};_0x84762b(++_0x17850d);}(_0x5308,0xd4));var _0x8530=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x5308[_0x44dba1];return _0x2fbd3f;};'use strict';var _=require('lodash');var util=require(_0x8530('0x0'));var logger=require('../../config/logger')(_0x8530('0x1'));var moment=require(_0x8530('0x2'));var BPromise=require(_0x8530('0x3'));var rp=require(_0x8530('0x4'));var fs=require('fs');var path=require(_0x8530('0x5'));var rimraf=require(_0x8530('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x8530('0x7')]=function(_0x47ad4e,_0x104628){return _0x47ad4e['define'](_0x8530('0x8'),attributes,{'tableName':_0x8530('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8530('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 1c593f0..2219cb8 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 _0xad7a=['request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','map','include','attributes','model','then','CreateVoiceCallReport','create','raw','UpdateVoiceCallReport','update','limit','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x7b6c7f,_0x3987dd){var _0x4b3793=function(_0x223b7d){while(--_0x223b7d){_0x7b6c7f['push'](_0x7b6c7f['shift']());}};_0x4b3793(++_0x3987dd);}(_0xad7a,0x68));var _0xaad7=function(_0x9b00b9,_0x34c404){_0x9b00b9=_0x9b00b9-0x0;var _0x65879d=_0xad7a[_0x9b00b9];return _0x65879d;};'use strict';var _=require(_0xaad7('0x0'));var util=require(_0xaad7('0x1'));var moment=require('moment');var BPromise=require(_0xaad7('0x2'));var rs=require(_0xaad7('0x3'));var fs=require('fs');var Redis=require(_0xaad7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaad7('0x5'));var config=require(_0xaad7('0x6'));var jayson=require(_0xaad7('0x7'));var client=jayson[_0xaad7('0x8')][_0xaad7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7683e4,_0x5dd626,_0x55ad56){return new BPromise(function(_0x8a605,_0xa2fce3){return client[_0xaad7('0xa')](_0x7683e4,_0x55ad56)['then'](function(_0x1e6651){logger[_0xaad7('0xb')](_0xaad7('0xc'),_0x5dd626,_0xaad7('0xd'));logger[_0xaad7('0xe')](_0xaad7('0xf'),_0x5dd626,_0xaad7('0xd'),JSON[_0xaad7('0x10')](_0x1e6651));if(_0x1e6651[_0xaad7('0x11')]){if(_0x1e6651[_0xaad7('0x11')][_0xaad7('0x12')]===0x1f4){logger[_0xaad7('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5dd626,_0x1e6651['error'][_0xaad7('0x13')]);return _0xa2fce3(_0x1e6651['error'][_0xaad7('0x13')]);}logger['error'](_0xaad7('0xc'),_0x5dd626,_0x1e6651[_0xaad7('0x11')][_0xaad7('0x13')]);return _0x8a605(_0x1e6651[_0xaad7('0x11')]['message']);}else{logger[_0xaad7('0xb')](_0xaad7('0xc'),_0x5dd626,'request\x20sent');_0x8a605(_0x1e6651[_0xaad7('0x14')][_0xaad7('0x13')]);}})[_0xaad7('0x15')](function(_0x2f63d4){logger[_0xaad7('0x11')](_0xaad7('0xc'),_0x5dd626,_0x2f63d4);_0xa2fce3(_0x2f63d4);});});}exports[_0xaad7('0x16')]=function(_0x161b18){var _0x11662f=this;return new Promise(function(_0x40551b,_0x488c80){return db[_0xaad7('0x17')][_0xaad7('0x18')]({'raw':_0x161b18[_0xaad7('0x19')]?_0x161b18['options']['raw']===undefined?!![]:![]:!![],'where':_0x161b18[_0xaad7('0x19')]?_0x161b18[_0xaad7('0x19')][_0xaad7('0x1a')]||null:null,'attributes':_0x161b18[_0xaad7('0x19')]?_0x161b18['options']['attributes']||null:null,'limit':_0x161b18[_0xaad7('0x19')]?_0x161b18[_0xaad7('0x19')]['limit']||null:null,'include':_0x161b18[_0xaad7('0x19')]?_0x161b18['options']['include']?_[_0xaad7('0x1b')](_0x161b18[_0xaad7('0x19')][_0xaad7('0x1c')],function(_0x5622b1){return{'model':db[_0x5622b1['model']],'as':_0x5622b1['as'],'attributes':_0x5622b1[_0xaad7('0x1d')],'include':_0x5622b1[_0xaad7('0x1c')]?_[_0xaad7('0x1b')](_0x5622b1[_0xaad7('0x1c')],function(_0x8b1253){return{'model':db[_0x8b1253[_0xaad7('0x1e')]],'as':_0x8b1253['as'],'attributes':_0x8b1253['attributes'],'include':_0x8b1253[_0xaad7('0x1c')]?_[_0xaad7('0x1b')](_0x8b1253['include'],function(_0x331c0b){return{'model':db[_0x331c0b['model']],'as':_0x331c0b['as'],'attributes':_0x331c0b[_0xaad7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaad7('0x1f')](function(_0x403c80){logger['info'](_0xaad7('0x16'),_0x161b18);logger[_0xaad7('0xe')](_0xaad7('0x16'),_0x161b18,JSON['stringify'](_0x403c80));_0x40551b(_0x403c80);})[_0xaad7('0x15')](function(_0x5c4e62){logger[_0xaad7('0x11')](_0xaad7('0x16'),_0x5c4e62['message'],_0x161b18);_0x488c80(_0x11662f[_0xaad7('0x11')](0x1f4,_0x5c4e62['message']));});});};exports[_0xaad7('0x20')]=function(_0x27bece){var _0x308bd2=this;return new Promise(function(_0x50da9d,_0x30e907){return db['VoiceCallReport'][_0xaad7('0x21')](_0x27bece['body'],{'raw':_0x27bece[_0xaad7('0x19')]?_0x27bece[_0xaad7('0x19')][_0xaad7('0x22')]===undefined?!![]:![]:!![]})[_0xaad7('0x1f')](function(_0x2de019){logger[_0xaad7('0xb')](_0xaad7('0x20'),_0x27bece);logger[_0xaad7('0xe')](_0xaad7('0x20'),_0x27bece,JSON[_0xaad7('0x10')](_0x2de019));_0x50da9d(_0x2de019);})[_0xaad7('0x15')](function(_0x506cc4){logger[_0xaad7('0x11')](_0xaad7('0x20'),_0x506cc4[_0xaad7('0x13')],_0x27bece);_0x30e907(_0x308bd2['error'](0x1f4,_0x506cc4[_0xaad7('0x13')]));});});};exports[_0xaad7('0x23')]=function(_0x52d4b4){var _0x678458=this;return new Promise(function(_0x2bdcf9,_0xa36821){return db[_0xaad7('0x17')][_0xaad7('0x24')](_0x52d4b4['body'],{'raw':_0x52d4b4[_0xaad7('0x19')]?_0x52d4b4['options'][_0xaad7('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d4b4[_0xaad7('0x19')]?_0x52d4b4[_0xaad7('0x19')][_0xaad7('0x1a')]||null:null,'attributes':_0x52d4b4[_0xaad7('0x19')]?_0x52d4b4[_0xaad7('0x19')]['attributes']||null:null,'limit':_0x52d4b4[_0xaad7('0x19')]?_0x52d4b4['options'][_0xaad7('0x25')]||null:null})[_0xaad7('0x1f')](function(_0x48a961){logger[_0xaad7('0xb')](_0xaad7('0x23'),_0x52d4b4);logger[_0xaad7('0xe')]('UpdateVoiceCallReport',_0x52d4b4,JSON[_0xaad7('0x10')](_0x48a961));_0x2bdcf9(_0x48a961);})['catch'](function(_0x196a58){logger[_0xaad7('0x11')]('UpdateVoiceCallReport',_0x196a58[_0xaad7('0x13')],_0x52d4b4);_0xa36821(_0x678458[_0xaad7('0x11')](0x1f4,_0x196a58['message']));});});}; \ No newline at end of file +var _0xa618=['body','stringify','UpdateVoiceCallReport','update','lodash','util','moment','../../config/utils','../../config/logger','jayson/promise','client','request','info','request\x20sent','debug','error','code','VoiceCallReport,\x20%s,\x20%s','message','GetVoiceCallReport','findAll','options','raw','where','limit','include','attributes','model','map','then','catch','CreateVoiceCallReport','VoiceCallReport','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa618,0x114));var _0x8a61=function(_0x2190ee,_0x546dff){_0x2190ee=_0x2190ee-0x0;var _0x3b0b09=_0xa618[_0x2190ee];return _0x3b0b09;};'use strict';var _=require(_0x8a61('0x0'));var util=require(_0x8a61('0x1'));var moment=require(_0x8a61('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(_0x8a61('0x3'));var logger=require(_0x8a61('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a61('0x5'));var client=jayson[_0x8a61('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b48c4,_0x26aeeb,_0x414347){return new BPromise(function(_0x37dfec,_0x292393){return client[_0x8a61('0x7')](_0x3b48c4,_0x414347)['then'](function(_0x26acd9){logger[_0x8a61('0x8')]('VoiceCallReport,\x20%s,\x20%s',_0x26aeeb,_0x8a61('0x9'));logger[_0x8a61('0xa')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x26aeeb,_0x8a61('0x9'),JSON['stringify'](_0x26acd9));if(_0x26acd9[_0x8a61('0xb')]){if(_0x26acd9[_0x8a61('0xb')][_0x8a61('0xc')]===0x1f4){logger[_0x8a61('0xb')](_0x8a61('0xd'),_0x26aeeb,_0x26acd9[_0x8a61('0xb')][_0x8a61('0xe')]);return _0x292393(_0x26acd9['error']['message']);}logger[_0x8a61('0xb')](_0x8a61('0xd'),_0x26aeeb,_0x26acd9[_0x8a61('0xb')][_0x8a61('0xe')]);return _0x37dfec(_0x26acd9[_0x8a61('0xb')][_0x8a61('0xe')]);}else{logger[_0x8a61('0x8')]('VoiceCallReport,\x20%s,\x20%s',_0x26aeeb,_0x8a61('0x9'));_0x37dfec(_0x26acd9['result'][_0x8a61('0xe')]);}})['catch'](function(_0x545ed8){logger[_0x8a61('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x26aeeb,_0x545ed8);_0x292393(_0x545ed8);});});}exports[_0x8a61('0xf')]=function(_0x1dbc49){var _0xfdbfaa=this;return new Promise(function(_0x4df52b,_0x10c70f){return db['VoiceCallReport'][_0x8a61('0x10')]({'raw':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49['options'][_0x8a61('0x12')]===undefined?!![]:![]:!![],'where':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49['options'][_0x8a61('0x13')]||null:null,'attributes':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49[_0x8a61('0x11')]['attributes']||null:null,'limit':_0x1dbc49['options']?_0x1dbc49[_0x8a61('0x11')][_0x8a61('0x14')]||null:null,'include':_0x1dbc49[_0x8a61('0x11')]?_0x1dbc49[_0x8a61('0x11')][_0x8a61('0x15')]?_['map'](_0x1dbc49[_0x8a61('0x11')]['include'],function(_0x28ed6c){return{'model':db[_0x28ed6c['model']],'as':_0x28ed6c['as'],'attributes':_0x28ed6c[_0x8a61('0x16')],'include':_0x28ed6c['include']?_['map'](_0x28ed6c[_0x8a61('0x15')],function(_0x4c3000){return{'model':db[_0x4c3000[_0x8a61('0x17')]],'as':_0x4c3000['as'],'attributes':_0x4c3000[_0x8a61('0x16')],'include':_0x4c3000[_0x8a61('0x15')]?_[_0x8a61('0x18')](_0x4c3000['include'],function(_0xc0b101){return{'model':db[_0xc0b101[_0x8a61('0x17')]],'as':_0xc0b101['as'],'attributes':_0xc0b101[_0x8a61('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8a61('0x19')](function(_0x55b03b){logger['info'](_0x8a61('0xf'),_0x1dbc49);logger[_0x8a61('0xa')]('GetVoiceCallReport',_0x1dbc49,JSON['stringify'](_0x55b03b));_0x4df52b(_0x55b03b);})[_0x8a61('0x1a')](function(_0x23635c){logger[_0x8a61('0xb')](_0x8a61('0xf'),_0x23635c[_0x8a61('0xe')],_0x1dbc49);_0x10c70f(_0xfdbfaa['error'](0x1f4,_0x23635c[_0x8a61('0xe')]));});});};exports[_0x8a61('0x1b')]=function(_0x3aeaba){var _0x4e7f2c=this;return new Promise(function(_0x129eaa,_0x59c10b){return db[_0x8a61('0x1c')][_0x8a61('0x1d')](_0x3aeaba[_0x8a61('0x1e')],{'raw':_0x3aeaba[_0x8a61('0x11')]?_0x3aeaba['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x37bc4d){logger[_0x8a61('0x8')]('CreateVoiceCallReport',_0x3aeaba);logger['debug'](_0x8a61('0x1b'),_0x3aeaba,JSON[_0x8a61('0x1f')](_0x37bc4d));_0x129eaa(_0x37bc4d);})[_0x8a61('0x1a')](function(_0x4621c9){logger['error'](_0x8a61('0x1b'),_0x4621c9[_0x8a61('0xe')],_0x3aeaba);_0x59c10b(_0x4e7f2c[_0x8a61('0xb')](0x1f4,_0x4621c9[_0x8a61('0xe')]));});});};exports[_0x8a61('0x20')]=function(_0x1e16af){var _0x55876a=this;return new Promise(function(_0xfaa564,_0x15e796){return db[_0x8a61('0x1c')][_0x8a61('0x21')](_0x1e16af[_0x8a61('0x1e')],{'raw':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x13')]||null:null,'attributes':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x16')]||null:null,'limit':_0x1e16af[_0x8a61('0x11')]?_0x1e16af[_0x8a61('0x11')][_0x8a61('0x14')]||null:null})[_0x8a61('0x19')](function(_0x4472e9){logger[_0x8a61('0x8')](_0x8a61('0x20'),_0x1e16af);logger[_0x8a61('0xa')]('UpdateVoiceCallReport',_0x1e16af,JSON[_0x8a61('0x1f')](_0x4472e9));_0xfaa564(_0x4472e9);})['catch'](function(_0x375aca){logger[_0x8a61('0xb')](_0x8a61('0x20'),_0x375aca['message'],_0x1e16af);_0x15e796(_0x55876a[_0x8a61('0xb')](0x1f4,_0x375aca[_0x8a61('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9e13cae..7b25c7d 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 _0xabb2=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x532ac3,_0x55e608){var _0x37bd3e=function(_0x59f198){while(--_0x59f198){_0x532ac3['push'](_0x532ac3['shift']());}};_0x37bd3e(++_0x55e608);}(_0xabb2,0xeb));var _0x2abb=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0xabb2[_0x2ef44b];return _0x2405b9;};'use strict';var multer=require(_0x2abb('0x0'));var util=require(_0x2abb('0x1'));var path=require(_0x2abb('0x2'));var timeout=require(_0x2abb('0x3'));var express=require(_0x2abb('0x4'));var router=express[_0x2abb('0x5')]();var fs_extra=require(_0x2abb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2abb('0x7'));var config=require(_0x2abb('0x8'));var controller=require('./voiceChanSpy.controller');router[_0x2abb('0x9')]('/',auth['isAuthenticated'](),controller[_0x2abb('0xa')]);router[_0x2abb('0x9')]('/:id',auth[_0x2abb('0xb')](),controller[_0x2abb('0xc')]);router[_0x2abb('0xd')]('/',auth[_0x2abb('0xb')](),controller['create']);router[_0x2abb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2abb('0xf')]);router[_0x2abb('0x10')]('/:id',auth[_0x2abb('0xb')](),controller[_0x2abb('0x11')]);module[_0x2abb('0x12')]=router; \ No newline at end of file +var _0xe4ed=['./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x188aea,_0x2fe9ab){var _0x3bf8a8=function(_0x37cdba){while(--_0x37cdba){_0x188aea['push'](_0x188aea['shift']());}};_0x3bf8a8(++_0x2fe9ab);}(_0xe4ed,0x1cb));var _0xde4e=function(_0x40e932,_0x50344c){_0x40e932=_0x40e932-0x0;var _0x33823b=_0xe4ed[_0x40e932];return _0x33823b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde4e('0x0'));var timeout=require('connect-timeout');var express=require(_0xde4e('0x1'));var router=express[_0xde4e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xde4e('0x3'));var config=require(_0xde4e('0x4'));var controller=require(_0xde4e('0x5'));router[_0xde4e('0x6')]('/',auth['isAuthenticated'](),controller[_0xde4e('0x7')]);router['get'](_0xde4e('0x8'),auth[_0xde4e('0x9')](),controller[_0xde4e('0xa')]);router[_0xde4e('0xb')]('/',auth[_0xde4e('0x9')](),controller['create']);router[_0xde4e('0xc')]('/:id',auth[_0xde4e('0x9')](),controller[_0xde4e('0xd')]);router[_0xde4e('0xe')](_0xde4e('0x8'),auth[_0xde4e('0x9')](),controller[_0xde4e('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 0b45a98..347d18b 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 _0x853e=['getDataValue','BOOLEAN','sequelize','STRING','name','options','join'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x853e,0xbf));var _0xe853=function(_0x3aa2d4,_0x544ca8){_0x3aa2d4=_0x3aa2d4-0x0;var _0x407d8a=_0x853e[_0x3aa2d4];return _0x407d8a;};'use strict';var Sequelize=require(_0xe853('0x0'));module['exports']={'name':{'type':Sequelize[_0xe853('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xe853('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xe853('0x1')],'set':function(_0x56dbb6){this['setDataValue'](_0xe853('0x3'),_0x56dbb6?_0x56dbb6[_0xe853('0x4')](''):[]);},'get':function(){return this[_0xe853('0x5')](_0xe853('0x3'))?this[_0xe853('0x5')](_0xe853('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0xe853('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xe853('0x1')]},'record':{'type':Sequelize[_0xe853('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe853('0x1')]},'description':{'type':Sequelize[_0xe853('0x1')]}}; \ No newline at end of file +var _0x748e=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x748e,0x14d));var _0xe748=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0x748e[_0x4dd71c];return _0x8e4e36;};'use strict';var Sequelize=require('sequelize');module[_0xe748('0x0')]={'name':{'type':Sequelize[_0xe748('0x1')]},'prefix':{'type':Sequelize[_0xe748('0x1')],'unique':_0xe748('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xe748('0x1')],'set':function(_0x3375bc){this[_0xe748('0x3')](_0xe748('0x4'),_0x3375bc?_0x3375bc[_0xe748('0x5')](''):[]);},'get':function(){return this[_0xe748('0x6')](_0xe748('0x4'))?this[_0xe748('0x6')](_0xe748('0x4'))[_0xe748('0x7')](''):[];}},'auth':{'type':Sequelize[_0xe748('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xe748('0x1')]},'record':{'type':Sequelize[_0xe748('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe748('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b0381e1..26c23f6 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 _0x0fec=['apply','reject','save','destroy','get','ChanSpies','then','end','sendStatus','error','stack','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceChanSpy','includeAll','include','rows','catch','show','params','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','moment','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x46e0bf,_0xe68bfb){_0x46e0bf=_0x46e0bf-0x0;var _0x5c93c6=_0x0fec[_0x46e0bf];return _0x5c93c6;};'use strict';var emlformat=require(_0xc0fe('0x0'));var rimraf=require(_0xc0fe('0x1'));var zipdir=require(_0xc0fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0fe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc0fe('0x4'));var util=require(_0xc0fe('0x5'));var path=require('path');var sox=require(_0xc0fe('0x6'));var csv=require('to-csv');var ejs=require(_0xc0fe('0x7'));var fs=require('fs');var fs_extra=require(_0xc0fe('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc0fe('0x9'));var deskjs=require(_0xc0fe('0xa'));var toCsv=require(_0xc0fe('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc0fe('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xc0fe('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0fe('0xe'))(_0xc0fe('0xf'));var utils=require(_0xc0fe('0x10'));var config=require(_0xc0fe('0x11'));var licenseUtil=require(_0xc0fe('0x12'));var db=require(_0xc0fe('0x13'))['db'];function respondWithStatusCode(_0x559ad2,_0x350a6d){_0x350a6d=_0x350a6d||0xcc;return function(_0x2cd4bb){if(_0x2cd4bb){return _0x559ad2['sendStatus'](_0x350a6d);}return _0x559ad2['status'](_0x350a6d)['end']();};}function respondWithResult(_0x35ff2c,_0x2a4dad){_0x2a4dad=_0x2a4dad||0xc8;return function(_0x40cccf){if(_0x40cccf){return _0x35ff2c['status'](_0x2a4dad)[_0xc0fe('0x14')](_0x40cccf);}};}function respondWithFilteredResult(_0x46f20f,_0x5ae053){return function(_0x4afe19){if(_0x4afe19){var _0x1c7b1c=typeof _0x5ae053[_0xc0fe('0x15')]===_0xc0fe('0x16')&&typeof _0x5ae053[_0xc0fe('0x17')]===_0xc0fe('0x16');var _0xedc330=_0x4afe19[_0xc0fe('0x18')];var _0x15fe4b=_0x1c7b1c?0x0:_0x5ae053['offset'];var _0x42b841=_0x1c7b1c?_0x4afe19[_0xc0fe('0x18')]:_0x5ae053[_0xc0fe('0x15')]+_0x5ae053[_0xc0fe('0x17')];var _0x17504f;if(_0x42b841>=_0xedc330){_0x42b841=_0xedc330;_0x17504f=0xc8;}else{_0x17504f=0xce;}_0x46f20f[_0xc0fe('0x19')](_0x17504f);return _0x46f20f[_0xc0fe('0x1a')](_0xc0fe('0x1b'),_0x15fe4b+'-'+_0x42b841+'/'+_0xedc330)['json'](_0x4afe19);}return null;};}function patchUpdates(_0x3cdd16){return function(_0x36bfe2){try{jsonpatch[_0xc0fe('0x1c')](_0x36bfe2,_0x3cdd16,!![]);}catch(_0x329a4c){return BPromise[_0xc0fe('0x1d')](_0x329a4c);}return _0x36bfe2[_0xc0fe('0x1e')]();};}function saveUpdates(_0x44fb50,_0x13a20f){return function(_0x20236a){if(_0x20236a){return _0x20236a['update'](_0x44fb50)['then'](function(_0xc3d74){return _0xc3d74;});}return null;};}function removeEntity(_0x280ba5,_0x9c477){return function(_0x525f91){if(_0x525f91){return _0x525f91[_0xc0fe('0x1f')]()['then'](function(){var _0x29b349=_0x525f91[_0xc0fe('0x20')]({'plain':!![]});var _0x5e7890=_0xc0fe('0x21');return db['UserProfileResource'][_0xc0fe('0x1f')]({'where':{'type':_0x5e7890,'resourceId':_0x29b349['id']}})[_0xc0fe('0x22')](function(){return _0x525f91;});})[_0xc0fe('0x22')](function(){_0x280ba5['status'](0xcc)[_0xc0fe('0x23')]();});}};}function handleEntityNotFound(_0x5a6f96,_0x408272){return function(_0xe0a8c1){if(!_0xe0a8c1){_0x5a6f96[_0xc0fe('0x24')](0x194);}return _0xe0a8c1;};}function handleError(_0x5ea96d,_0x5d5584){_0x5d5584=_0x5d5584||0x1f4;return function(_0x2d17cd){logger[_0xc0fe('0x25')](_0x2d17cd[_0xc0fe('0x26')]);if(_0x2d17cd['name']){delete _0x2d17cd['name'];}_0x5ea96d['status'](_0x5d5584)[_0xc0fe('0x27')](_0x2d17cd);};}exports['index']=function(_0x3dc35a,_0x72ddac){var _0x5a7033={},_0x432a1d={},_0x4b2e1a={'count':0x0,'rows':[]};var _0x45e6c2=_[_0xc0fe('0x28')](db['VoiceChanSpy'][_0xc0fe('0x29')],function(_0x145cc5){return{'name':_0x145cc5[_0xc0fe('0x2a')],'type':_0x145cc5[_0xc0fe('0x2b')][_0xc0fe('0x2c')]};});_0x432a1d[_0xc0fe('0x2d')]=_['map'](_0x45e6c2,'name');_0x432a1d[_0xc0fe('0x2e')]=_[_0xc0fe('0x2f')](_0x3dc35a[_0xc0fe('0x2e')]);_0x432a1d[_0xc0fe('0x30')]=_[_0xc0fe('0x31')](_0x432a1d[_0xc0fe('0x2d')],_0x432a1d['query']);_0x5a7033['attributes']=_[_0xc0fe('0x31')](_0x432a1d[_0xc0fe('0x2d')],qs['fields'](_0x3dc35a[_0xc0fe('0x2e')][_0xc0fe('0x32')]));_0x5a7033['attributes']=_0x5a7033[_0xc0fe('0x33')][_0xc0fe('0x34')]?_0x5a7033[_0xc0fe('0x33')]:_0x432a1d[_0xc0fe('0x2d')];if(!_0x3dc35a[_0xc0fe('0x2e')][_0xc0fe('0x35')](_0xc0fe('0x36'))){_0x5a7033[_0xc0fe('0x17')]=qs[_0xc0fe('0x17')](_0x3dc35a[_0xc0fe('0x2e')][_0xc0fe('0x17')]);_0x5a7033[_0xc0fe('0x15')]=qs[_0xc0fe('0x15')](_0x3dc35a['query'][_0xc0fe('0x15')]);}_0x5a7033[_0xc0fe('0x37')]=qs[_0xc0fe('0x38')](_0x3dc35a['query'][_0xc0fe('0x38')]);_0x5a7033[_0xc0fe('0x39')]=qs[_0xc0fe('0x30')](_[_0xc0fe('0x3a')](_0x3dc35a[_0xc0fe('0x2e')],_0x432a1d[_0xc0fe('0x30')]),_0x45e6c2);if(_0x3dc35a[_0xc0fe('0x2e')][_0xc0fe('0x3b')]){_0x5a7033[_0xc0fe('0x39')]=_[_0xc0fe('0x3c')](_0x5a7033[_0xc0fe('0x39')],{'$or':_[_0xc0fe('0x28')](_0x45e6c2,function(_0x134015){if(_0x134015['type']!=='VIRTUAL'){var _0x489581={};_0x489581[_0x134015['name']]={'$like':'%'+_0x3dc35a['query'][_0xc0fe('0x3b')]+'%'};return _0x489581;}})});}_0x5a7033=_[_0xc0fe('0x3c')]({},_0x5a7033,_0x3dc35a[_0xc0fe('0x3d')]);var _0x5be64a={'where':_0x5a7033[_0xc0fe('0x39')]};return db[_0xc0fe('0x3e')][_0xc0fe('0x18')](_0x5be64a)[_0xc0fe('0x22')](function(_0x227645){_0x4b2e1a['count']=_0x227645;if(_0x3dc35a[_0xc0fe('0x2e')][_0xc0fe('0x3f')]){_0x5a7033[_0xc0fe('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x5a7033);})[_0xc0fe('0x22')](function(_0x115786){_0x4b2e1a[_0xc0fe('0x41')]=_0x115786;return _0x4b2e1a;})[_0xc0fe('0x22')](respondWithFilteredResult(_0x72ddac,_0x5a7033))[_0xc0fe('0x42')](handleError(_0x72ddac,null));};exports[_0xc0fe('0x43')]=function(_0x53f9f2,_0x316f43){var _0x3f43ee={'raw':![],'where':{'id':_0x53f9f2[_0xc0fe('0x44')]['id']}},_0x10af22={};_0x10af22[_0xc0fe('0x2d')]=_[_0xc0fe('0x2f')](db[_0xc0fe('0x3e')][_0xc0fe('0x29')]);_0x10af22[_0xc0fe('0x2e')]=_[_0xc0fe('0x2f')](_0x53f9f2[_0xc0fe('0x2e')]);_0x10af22[_0xc0fe('0x30')]=_[_0xc0fe('0x31')](_0x10af22[_0xc0fe('0x2d')],_0x10af22['query']);_0x3f43ee[_0xc0fe('0x33')]=_[_0xc0fe('0x31')](_0x10af22[_0xc0fe('0x2d')],qs[_0xc0fe('0x32')](_0x53f9f2['query'][_0xc0fe('0x32')]));_0x3f43ee[_0xc0fe('0x33')]=_0x3f43ee[_0xc0fe('0x33')]['length']?_0x3f43ee[_0xc0fe('0x33')]:_0x10af22[_0xc0fe('0x2d')];if(_0x53f9f2['query'][_0xc0fe('0x3f')]){_0x3f43ee[_0xc0fe('0x40')]=[{'all':!![]}];}_0x3f43ee=_['merge']({},_0x3f43ee,_0x53f9f2[_0xc0fe('0x3d')]);return db['VoiceChanSpy'][_0xc0fe('0x45')](_0x3f43ee)[_0xc0fe('0x22')](handleEntityNotFound(_0x316f43,null))['then'](respondWithResult(_0x316f43,null))[_0xc0fe('0x42')](handleError(_0x316f43,null));};exports['create']=function(_0x5f0ff5,_0x3e970b){return db['VoiceChanSpy'][_0xc0fe('0x46')](_0x5f0ff5['body'],{})[_0xc0fe('0x22')](function(_0x84e80e){var _0xcc9d38=_0x5f0ff5['user']['get']({'plain':!![]});if(!_0xcc9d38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcc9d38[_0xc0fe('0x47')]===_0xc0fe('0x48')){var _0x4708e3=_0x84e80e[_0xc0fe('0x20')]({'plain':!![]});var _0x327e9f=_0xc0fe('0x21');return db[_0xc0fe('0x49')]['find']({'where':{'name':_0x327e9f,'userProfileId':_0xcc9d38[_0xc0fe('0x4a')]},'raw':!![]})['then'](function(_0x177eb8){if(_0x177eb8&&_0x177eb8[_0xc0fe('0x4b')]===0x0){return db[_0xc0fe('0x4c')][_0xc0fe('0x46')]({'name':_0x4708e3[_0xc0fe('0x4d')],'resourceId':_0x4708e3['id'],'type':_0x177eb8[_0xc0fe('0x4d')],'sectionId':_0x177eb8['id']},{})[_0xc0fe('0x22')](function(){return _0x84e80e;});}else{return _0x84e80e;}})[_0xc0fe('0x42')](function(_0x5ebbb9){logger[_0xc0fe('0x25')](_0xc0fe('0x4e'),_0x5ebbb9);throw _0x5ebbb9;});}return _0x84e80e;})['then'](respondWithResult(_0x3e970b,0xc9))[_0xc0fe('0x42')](handleError(_0x3e970b,null));};exports[_0xc0fe('0x4f')]=function(_0x1b358d,_0x31fb49){if(_0x1b358d[_0xc0fe('0x50')]['id']){delete _0x1b358d[_0xc0fe('0x50')]['id'];}return db[_0xc0fe('0x3e')]['find']({'where':{'id':_0x1b358d[_0xc0fe('0x44')]['id']}})['then'](handleEntityNotFound(_0x31fb49,null))[_0xc0fe('0x22')](saveUpdates(_0x1b358d[_0xc0fe('0x50')],null))[_0xc0fe('0x22')](respondWithResult(_0x31fb49,null))['catch'](handleError(_0x31fb49,null));};exports['destroy']=function(_0x569144,_0x2623ca){return db[_0xc0fe('0x3e')][_0xc0fe('0x45')]({'where':{'id':_0x569144['params']['id']}})[_0xc0fe('0x22')](handleEntityNotFound(_0x2623ca,null))[_0xc0fe('0x22')](removeEntity(_0x2623ca,null))[_0xc0fe('0x42')](handleError(_0x2623ca,null));}; \ No newline at end of file +var _0xe9ad=['send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','name'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe9ad,0x82));var _0xde9a=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0xe9ad[_0x57fda8];return _0x11c895;};'use strict';var emlformat=require(_0xde9a('0x0'));var rimraf=require(_0xde9a('0x1'));var zipdir=require(_0xde9a('0x2'));var jsonpatch=require(_0xde9a('0x3'));var rp=require(_0xde9a('0x4'));var moment=require(_0xde9a('0x5'));var BPromise=require(_0xde9a('0x6'));var Mustache=require('mustache');var util=require(_0xde9a('0x7'));var path=require(_0xde9a('0x8'));var sox=require(_0xde9a('0x9'));var csv=require(_0xde9a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde9a('0xb'));var _=require(_0xde9a('0xc'));var squel=require(_0xde9a('0xd'));var crypto=require('crypto');var jsforce=require(_0xde9a('0xe'));var deskjs=require(_0xde9a('0xf'));var toCsv=require(_0xde9a('0xa'));var querystring=require(_0xde9a('0x10'));var Papa=require(_0xde9a('0x11'));var Redis=require(_0xde9a('0x12'));var authService=require(_0xde9a('0x13'));var qs=require(_0xde9a('0x14'));var as=require(_0xde9a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde9a('0x16'))(_0xde9a('0x17'));var utils=require(_0xde9a('0x18'));var config=require(_0xde9a('0x19'));var licenseUtil=require(_0xde9a('0x1a'));var db=require(_0xde9a('0x1b'))['db'];function respondWithStatusCode(_0x1cb3bd,_0x3a9b1a){_0x3a9b1a=_0x3a9b1a||0xcc;return function(_0xd81956){if(_0xd81956){return _0x1cb3bd['sendStatus'](_0x3a9b1a);}return _0x1cb3bd[_0xde9a('0x1c')](_0x3a9b1a)[_0xde9a('0x1d')]();};}function respondWithResult(_0x2f2e11,_0x267d5b){_0x267d5b=_0x267d5b||0xc8;return function(_0x1c1873){if(_0x1c1873){return _0x2f2e11[_0xde9a('0x1c')](_0x267d5b)[_0xde9a('0x1e')](_0x1c1873);}};}function respondWithFilteredResult(_0x432d3c,_0x3f0e39){return function(_0x474713){if(_0x474713){var _0x50ffb8=typeof _0x3f0e39[_0xde9a('0x1f')]===_0xde9a('0x20')&&typeof _0x3f0e39[_0xde9a('0x21')]===_0xde9a('0x20');var _0x454156=_0x474713['count'];var _0x12ba7f=_0x50ffb8?0x0:_0x3f0e39[_0xde9a('0x1f')];var _0x3b89ef=_0x50ffb8?_0x474713['count']:_0x3f0e39[_0xde9a('0x1f')]+_0x3f0e39['limit'];var _0x8f481a;if(_0x3b89ef>=_0x454156){_0x3b89ef=_0x454156;_0x8f481a=0xc8;}else{_0x8f481a=0xce;}_0x432d3c['status'](_0x8f481a);return _0x432d3c[_0xde9a('0x22')](_0xde9a('0x23'),_0x12ba7f+'-'+_0x3b89ef+'/'+_0x454156)[_0xde9a('0x1e')](_0x474713);}return null;};}function patchUpdates(_0x4add81){return function(_0x43b1bb){try{jsonpatch[_0xde9a('0x24')](_0x43b1bb,_0x4add81,!![]);}catch(_0x4e4e02){return BPromise['reject'](_0x4e4e02);}return _0x43b1bb[_0xde9a('0x25')]();};}function saveUpdates(_0x416b36,_0x56550b){return function(_0x290d8d){if(_0x290d8d){return _0x290d8d[_0xde9a('0x26')](_0x416b36)[_0xde9a('0x27')](function(_0x402b06){return _0x402b06;});}return null;};}function removeEntity(_0xa48b6b,_0x284c96){return function(_0x544f9d){if(_0x544f9d){return _0x544f9d[_0xde9a('0x28')]()[_0xde9a('0x27')](function(){var _0x2fa60c=_0x544f9d[_0xde9a('0x29')]({'plain':!![]});var _0xfd4b9d=_0xde9a('0x2a');return db[_0xde9a('0x2b')][_0xde9a('0x28')]({'where':{'type':_0xfd4b9d,'resourceId':_0x2fa60c['id']}})[_0xde9a('0x27')](function(){return _0x544f9d;});})['then'](function(){_0xa48b6b['status'](0xcc)[_0xde9a('0x1d')]();});}};}function handleEntityNotFound(_0x42ba56,_0x748a16){return function(_0x3a9e95){if(!_0x3a9e95){_0x42ba56['sendStatus'](0x194);}return _0x3a9e95;};}function handleError(_0x4169bd,_0x271dbe){_0x271dbe=_0x271dbe||0x1f4;return function(_0x467ce2){logger['error'](_0x467ce2[_0xde9a('0x2c')]);if(_0x467ce2['name']){delete _0x467ce2[_0xde9a('0x2d')];}_0x4169bd['status'](_0x271dbe)[_0xde9a('0x2e')](_0x467ce2);};}exports[_0xde9a('0x2f')]=function(_0x3deac3,_0x422b05){var _0x22d78a={},_0x2f0f7a={},_0x366ccd={'count':0x0,'rows':[]};var _0x52b157=_[_0xde9a('0x30')](db[_0xde9a('0x31')][_0xde9a('0x32')],function(_0x26bdff){return{'name':_0x26bdff[_0xde9a('0x33')],'type':_0x26bdff[_0xde9a('0x34')][_0xde9a('0x35')]};});_0x2f0f7a[_0xde9a('0x36')]=_[_0xde9a('0x30')](_0x52b157,_0xde9a('0x2d'));_0x2f0f7a[_0xde9a('0x37')]=_[_0xde9a('0x38')](_0x3deac3[_0xde9a('0x37')]);_0x2f0f7a[_0xde9a('0x39')]=_['intersection'](_0x2f0f7a['model'],_0x2f0f7a[_0xde9a('0x37')]);_0x22d78a['attributes']=_[_0xde9a('0x3a')](_0x2f0f7a[_0xde9a('0x36')],qs['fields'](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x3b')]));_0x22d78a[_0xde9a('0x3c')]=_0x22d78a['attributes']['length']?_0x22d78a[_0xde9a('0x3c')]:_0x2f0f7a[_0xde9a('0x36')];if(!_0x3deac3['query'][_0xde9a('0x3d')](_0xde9a('0x3e'))){_0x22d78a[_0xde9a('0x21')]=qs[_0xde9a('0x21')](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x21')]);_0x22d78a[_0xde9a('0x1f')]=qs[_0xde9a('0x1f')](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x1f')]);}_0x22d78a['order']=qs[_0xde9a('0x3f')](_0x3deac3[_0xde9a('0x37')][_0xde9a('0x3f')]);_0x22d78a[_0xde9a('0x40')]=qs['filters'](_[_0xde9a('0x41')](_0x3deac3[_0xde9a('0x37')],_0x2f0f7a[_0xde9a('0x39')]),_0x52b157);if(_0x3deac3[_0xde9a('0x37')][_0xde9a('0x42')]){_0x22d78a[_0xde9a('0x40')]=_['merge'](_0x22d78a[_0xde9a('0x40')],{'$or':_[_0xde9a('0x30')](_0x52b157,function(_0x492255){if(_0x492255[_0xde9a('0x34')]!==_0xde9a('0x43')){var _0x8c3f59={};_0x8c3f59[_0x492255[_0xde9a('0x2d')]]={'$like':'%'+_0x3deac3[_0xde9a('0x37')]['filter']+'%'};return _0x8c3f59;}})});}_0x22d78a=_[_0xde9a('0x44')]({},_0x22d78a,_0x3deac3[_0xde9a('0x45')]);var _0x2811b2={'where':_0x22d78a[_0xde9a('0x40')]};return db[_0xde9a('0x31')][_0xde9a('0x46')](_0x2811b2)[_0xde9a('0x27')](function(_0x2b87f0){_0x366ccd['count']=_0x2b87f0;if(_0x3deac3[_0xde9a('0x37')][_0xde9a('0x47')]){_0x22d78a['include']=[{'all':!![]}];}return db[_0xde9a('0x31')]['findAll'](_0x22d78a);})[_0xde9a('0x27')](function(_0x229181){_0x366ccd[_0xde9a('0x48')]=_0x229181;return _0x366ccd;})[_0xde9a('0x27')](respondWithFilteredResult(_0x422b05,_0x22d78a))[_0xde9a('0x49')](handleError(_0x422b05,null));};exports[_0xde9a('0x4a')]=function(_0x372665,_0x38fd2d){var _0x57fbf8={'raw':![],'where':{'id':_0x372665[_0xde9a('0x4b')]['id']}},_0x51fe53={};_0x51fe53[_0xde9a('0x36')]=_['keys'](db['VoiceChanSpy'][_0xde9a('0x32')]);_0x51fe53[_0xde9a('0x37')]=_[_0xde9a('0x38')](_0x372665[_0xde9a('0x37')]);_0x51fe53[_0xde9a('0x39')]=_['intersection'](_0x51fe53[_0xde9a('0x36')],_0x51fe53['query']);_0x57fbf8['attributes']=_[_0xde9a('0x3a')](_0x51fe53[_0xde9a('0x36')],qs['fields'](_0x372665[_0xde9a('0x37')][_0xde9a('0x3b')]));_0x57fbf8['attributes']=_0x57fbf8[_0xde9a('0x3c')][_0xde9a('0x4c')]?_0x57fbf8[_0xde9a('0x3c')]:_0x51fe53[_0xde9a('0x36')];if(_0x372665[_0xde9a('0x37')][_0xde9a('0x47')]){_0x57fbf8[_0xde9a('0x4d')]=[{'all':!![]}];}_0x57fbf8=_['merge']({},_0x57fbf8,_0x372665[_0xde9a('0x45')]);return db['VoiceChanSpy']['find'](_0x57fbf8)[_0xde9a('0x27')](handleEntityNotFound(_0x38fd2d,null))[_0xde9a('0x27')](respondWithResult(_0x38fd2d,null))[_0xde9a('0x49')](handleError(_0x38fd2d,null));};exports[_0xde9a('0x4e')]=function(_0x31de98,_0xe4c867){return db[_0xde9a('0x31')][_0xde9a('0x4e')](_0x31de98[_0xde9a('0x4f')],{})[_0xde9a('0x27')](function(_0x330e15){var _0x3e840d=_0x31de98['user'][_0xde9a('0x29')]({'plain':!![]});if(!_0x3e840d)throw new Error(_0xde9a('0x50'));if(_0x3e840d[_0xde9a('0x51')]===_0xde9a('0x52')){var _0xc6d00b=_0x330e15[_0xde9a('0x29')]({'plain':!![]});var _0x1a6058=_0xde9a('0x2a');return db[_0xde9a('0x53')][_0xde9a('0x54')]({'where':{'name':_0x1a6058,'userProfileId':_0x3e840d['userProfileId']},'raw':!![]})['then'](function(_0x20e214){if(_0x20e214&&_0x20e214[_0xde9a('0x55')]===0x0){return db[_0xde9a('0x2b')][_0xde9a('0x4e')]({'name':_0xc6d00b['name'],'resourceId':_0xc6d00b['id'],'type':_0x20e214[_0xde9a('0x2d')],'sectionId':_0x20e214['id']},{})[_0xde9a('0x27')](function(){return _0x330e15;});}else{return _0x330e15;}})[_0xde9a('0x49')](function(_0x4872f6){logger[_0xde9a('0x56')](_0xde9a('0x57'),_0x4872f6);throw _0x4872f6;});}return _0x330e15;})['then'](respondWithResult(_0xe4c867,0xc9))[_0xde9a('0x49')](handleError(_0xe4c867,null));};exports[_0xde9a('0x26')]=function(_0x317d8c,_0xc665a8){if(_0x317d8c[_0xde9a('0x4f')]['id']){delete _0x317d8c[_0xde9a('0x4f')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x317d8c[_0xde9a('0x4b')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0xc665a8,null))['then'](saveUpdates(_0x317d8c[_0xde9a('0x4f')],null))['then'](respondWithResult(_0xc665a8,null))[_0xde9a('0x49')](handleError(_0xc665a8,null));};exports['destroy']=function(_0x3dbf4a,_0x9cbbf1){return db['VoiceChanSpy']['find']({'where':{'id':_0x3dbf4a[_0xde9a('0x4b')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0x9cbbf1,null))[_0xde9a('0x27')](removeEntity(_0x9cbbf1,null))[_0xde9a('0x49')](handleError(_0x9cbbf1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9b7c684..5a08532 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 _0x5684=['record','push','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','catch','exports','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','lodash','util','context','from-sip','format','prefix','system','merge','CDR(type)=%s','chanspy'];(function(_0x1c8835,_0x41f3fb){var _0x5640bf=function(_0xcb3721){while(--_0xcb3721){_0x1c8835['push'](_0x1c8835['shift']());}};_0x5640bf(++_0x41f3fb);}(_0x5684,0x106));var _0x4568=function(_0x298bda,_0x219b51){_0x298bda=_0x298bda-0x0;var _0x3ebe46=_0x5684[_0x298bda];return _0x3ebe46;};'use strict';var _=require(_0x4568('0x0'));var util=require(_0x4568('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x285aaa,_0x37723a,_0x1ba5ff){var _0x209669=0x1;var _0x32ca01=[];var _0x50dbc2={'context':_0x37723a[_0x4568('0x2')]||_0x4568('0x3'),'exten':util[_0x4568('0x4')]('%s%s',_0x285aaa[_0x4568('0x5')],_0x1ba5ff),'type':_0x4568('0x6'),'isApp':![],'ChanSpyId':_0x285aaa['id'],'UserId':_0x37723a['id']};_0x32ca01['push'](_[_0x4568('0x7')]({'app':'Set','appdata':util['format'](_0x4568('0x8'),_0x4568('0x9')),'priority':_0x209669++},_0x50dbc2));if(_0x285aaa[_0x4568('0xa')]){_0x32ca01[_0x4568('0xb')](_['merge']({'app':'MixMonitor','appdata':util[_0x4568('0x4')](_0x4568('0xc'),_0x285aaa['recordingFormat']),'priority':_0x209669++},_0x50dbc2));}if(_0x285aaa[_0x4568('0xd')]){_0x32ca01[_0x4568('0xb')](_[_0x4568('0x7')]({'app':_0x4568('0xe'),'appdata':_0x285aaa[_0x4568('0xf')],'priority':_0x209669++},_0x50dbc2));}_0x32ca01[_0x4568('0xb')](_[_0x4568('0x7')]({'app':_0x4568('0x10'),'appdata':util[_0x4568('0x4')](_0x4568('0x11'),_0x37723a[_0x4568('0x12')],_0x285aaa[_0x4568('0x13')]?_0x285aaa['options'][_0x4568('0x14')](''):''),'priority':_0x209669++},_0x50dbc2));if(_0x285aaa[_0x4568('0xa')]){_0x32ca01[_0x4568('0xb')](_[_0x4568('0x7')]({'app':'StopMixMonitor','priority':_0x209669++},_0x50dbc2));}return _0x32ca01;};var getChanSpyApplications=function(_0xf758d6,_0x2239a1){var _0xc518b2=[];for(var _0x54c75b=0x0,_0x4778e9=0x1;_0x54c75b<_0x2239a1[_0x4568('0x15')];_0x54c75b++,_0x4778e9=0x1){_0xc518b2=_0xc518b2[_0x4568('0x16')](getUserApplications(_0xf758d6,_0x2239a1[_0x54c75b],_0x2239a1[_0x54c75b][_0x4568('0x17')]));if(_0x2239a1[_0x54c75b]['internal']!=_0x2239a1[_0x54c75b][_0x4568('0x12')]){_0xc518b2=_0xc518b2[_0x4568('0x16')](getUserApplications(_0xf758d6,_0x2239a1[_0x54c75b],_0x2239a1[_0x54c75b][_0x4568('0x12')]));}}return _0xc518b2;};var getChanSpyPromise=function(_0x2db943,_0x5562aa){return new BPromise(function(_0x33a367,_0x17ff38){return _0x2db943[_0x4568('0x18')][_0x4568('0x19')]({'attributes':['id',_0x4568('0x12'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x32a957){if(_0x32a957){return _0x33a367(getChanSpyApplications(_0x5562aa,_0x32a957));}return _0x33a367([]);})[_0x4568('0x1a')](function(_0xc32cd0){_0x17ff38(_0xc32cd0);});});};module[_0x4568('0x1b')]=function(_0x460911,_0x1c41d9){var _0x43d1d3=_0x460911[_0x4568('0x1c')];return _0x460911['define'](_0x4568('0x1d'),attributes,{'tableName':_0x4568('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7535c4,_0x32558c,_0x1d3857){return getChanSpyPromise(_0x43d1d3,_0x7535c4)[_0x4568('0x1f')](function(_0x511292){if(_0x511292&&_0x511292['length']){return _0x43d1d3[_0x4568('0x20')][_0x4568('0x21')](_0x511292);}})[_0x4568('0x1f')](function(){_0x1d3857();})[_0x4568('0x1a')](function(_0x1ab4a4){_0x1d3857(_0x1ab4a4);});},'afterUpdate':function(_0x2bff67,_0x3bbdd3,_0x486e9d){return _0x43d1d3[_0x4568('0x20')]['destroy']({'where':{'ChanSpyId':_0x2bff67['id']}})['then'](function(){return getChanSpyPromise(_0x43d1d3,_0x2bff67);})[_0x4568('0x1f')](function(_0x2e26e3){if(_0x2e26e3&&_0x2e26e3[_0x4568('0x15')]){return _0x43d1d3['VoiceExtension'][_0x4568('0x21')](_0x2e26e3);}})['then'](function(){_0x486e9d();})[_0x4568('0x1a')](function(_0x4f2635){_0x486e9d(_0x4f2635);});},'afterDestroy':function(_0x1f7337,_0x20159f,_0x259092){return _0x43d1d3[_0x4568('0x20')]['destroy']({'where':{'ChanSpyId':_0x1f7337['id']}})[_0x4568('0x1f')](function(){_0x259092();})[_0x4568('0x1a')](function(_0x7b1bea){_0x259092(_0x7b1bea);});}}});}; \ No newline at end of file +var _0xa774=['concat','internal','User','agent','then','catch','models','define','voice_chanspy','length','VoiceExtension','destroy','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','name','options','join','StopMixMonitor'];(function(_0x571c47,_0x438835){var _0x3b2953=function(_0x5802b9){while(--_0x5802b9){_0x571c47['push'](_0x571c47['shift']());}};_0x3b2953(++_0x438835);}(_0xa774,0x135));var _0x4a77=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xa774[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x4a77('0x0'));var attributes=require(_0x4a77('0x1'));var getUserApplications=function(_0x40e994,_0x46aea5,_0x9c1afe){var _0x536ad0=0x1;var _0x29a212=[];var _0x5bd6fa={'context':_0x46aea5[_0x4a77('0x2')]||'from-sip','exten':util[_0x4a77('0x3')](_0x4a77('0x4'),_0x40e994[_0x4a77('0x5')],_0x9c1afe),'type':'system','isApp':![],'ChanSpyId':_0x40e994['id'],'UserId':_0x46aea5['id']};_0x29a212[_0x4a77('0x6')](_[_0x4a77('0x7')]({'app':_0x4a77('0x8'),'appdata':util['format'](_0x4a77('0x9'),_0x4a77('0xa')),'priority':_0x536ad0++},_0x5bd6fa));if(_0x40e994[_0x4a77('0xb')]){_0x29a212[_0x4a77('0x6')](_['merge']({'app':_0x4a77('0xc'),'appdata':util[_0x4a77('0x3')](_0x4a77('0xd'),_0x40e994[_0x4a77('0xe')]),'priority':_0x536ad0++},_0x5bd6fa));}if(_0x40e994['auth']){_0x29a212[_0x4a77('0x6')](_['merge']({'app':_0x4a77('0xf'),'appdata':_0x40e994['password'],'priority':_0x536ad0++},_0x5bd6fa));}_0x29a212[_0x4a77('0x6')](_[_0x4a77('0x7')]({'app':_0x4a77('0x10'),'appdata':util[_0x4a77('0x3')]('SIP/%s,%s',_0x46aea5[_0x4a77('0x11')],_0x40e994[_0x4a77('0x12')]?_0x40e994[_0x4a77('0x12')][_0x4a77('0x13')](''):''),'priority':_0x536ad0++},_0x5bd6fa));if(_0x40e994[_0x4a77('0xb')]){_0x29a212[_0x4a77('0x6')](_[_0x4a77('0x7')]({'app':_0x4a77('0x14'),'priority':_0x536ad0++},_0x5bd6fa));}return _0x29a212;};var getChanSpyApplications=function(_0x47eca8,_0x148614){var _0x3716f3=[];for(var _0xce03fe=0x0,_0x440c03=0x1;_0xce03fe<_0x148614['length'];_0xce03fe++,_0x440c03=0x1){_0x3716f3=_0x3716f3[_0x4a77('0x15')](getUserApplications(_0x47eca8,_0x148614[_0xce03fe],_0x148614[_0xce03fe][_0x4a77('0x16')]));if(_0x148614[_0xce03fe][_0x4a77('0x16')]!=_0x148614[_0xce03fe]['name']){_0x3716f3=_0x3716f3[_0x4a77('0x15')](getUserApplications(_0x47eca8,_0x148614[_0xce03fe],_0x148614[_0xce03fe][_0x4a77('0x11')]));}}return _0x3716f3;};var getChanSpyPromise=function(_0x5ca9cb,_0x428c0a){return new BPromise(function(_0x385769,_0x2dfd3f){return _0x5ca9cb[_0x4a77('0x17')]['findAll']({'attributes':['id',_0x4a77('0x11'),'internal'],'where':{'role':_0x4a77('0x18'),'chanspy':!![]},'raw':!![]})[_0x4a77('0x19')](function(_0x175654){if(_0x175654){return _0x385769(getChanSpyApplications(_0x428c0a,_0x175654));}return _0x385769([]);})[_0x4a77('0x1a')](function(_0x4b6aac){_0x2dfd3f(_0x4b6aac);});});};module['exports']=function(_0x4d7ec6,_0x536e95){var _0x580b0e=_0x4d7ec6[_0x4a77('0x1b')];return _0x4d7ec6[_0x4a77('0x1c')]('VoiceChanSpy',attributes,{'tableName':_0x4a77('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x57ef99,_0xf814b8,_0x45301a){return getChanSpyPromise(_0x580b0e,_0x57ef99)[_0x4a77('0x19')](function(_0x21c390){if(_0x21c390&&_0x21c390[_0x4a77('0x1e')]){return _0x580b0e[_0x4a77('0x1f')]['bulkCreate'](_0x21c390);}})[_0x4a77('0x19')](function(){_0x45301a();})[_0x4a77('0x1a')](function(_0x51dcc2){_0x45301a(_0x51dcc2);});},'afterUpdate':function(_0x457dca,_0x257fc1,_0x2499ac){return _0x580b0e['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x457dca['id']}})[_0x4a77('0x19')](function(){return getChanSpyPromise(_0x580b0e,_0x457dca);})[_0x4a77('0x19')](function(_0x4cc483){if(_0x4cc483&&_0x4cc483[_0x4a77('0x1e')]){return _0x580b0e[_0x4a77('0x1f')]['bulkCreate'](_0x4cc483);}})[_0x4a77('0x19')](function(){_0x2499ac();})[_0x4a77('0x1a')](function(_0x429f23){_0x2499ac(_0x429f23);});},'afterDestroy':function(_0x750f04,_0x36fbc9,_0x4fe520){return _0x580b0e['VoiceExtension'][_0x4a77('0x20')]({'where':{'ChanSpyId':_0x750f04['id']}})['then'](function(){_0x4fe520();})['catch'](function(_0x2a0ff9){_0x4fe520(_0x2a0ff9);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6d98f0f..f9f3c29 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 _0xd691=['jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4929dc,_0x1bd349){var _0xef9c93=function(_0x243ffa){while(--_0x243ffa){_0x4929dc['push'](_0x4929dc['shift']());}};_0xef9c93(++_0x1bd349);}(_0xd691,0xe6));var _0x1d69=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xd691[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var moment=require(_0x1d69('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d69('0x3'));var fs=require('fs');var Redis=require(_0x1d69('0x4'));var db=require(_0x1d69('0x5'))['db'];var utils=require(_0x1d69('0x6'));var logger=require(_0x1d69('0x7'))(_0x1d69('0x8'));var config=require(_0x1d69('0x9'));var jayson=require(_0x1d69('0xa'));var client=jayson[_0x1d69('0xb')][_0x1d69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b0c,_0x520acb,_0x267da3){return new BPromise(function(_0x49f008,_0x369d44){return client[_0x1d69('0xd')](_0x5a5b0c,_0x267da3)[_0x1d69('0xe')](function(_0x364061){logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));logger[_0x1d69('0x11')](_0x1d69('0x12'),_0x520acb,_0x1d69('0x10'),JSON['stringify'](_0x364061));if(_0x364061['error']){if(_0x364061[_0x1d69('0x13')][_0x1d69('0x14')]===0x1f4){logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x369d44(_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);}logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x49f008(_0x364061[_0x1d69('0x13')]['message']);}else{logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));_0x49f008(_0x364061[_0x1d69('0x16')][_0x1d69('0x15')]);}})[_0x1d69('0x17')](function(_0x383771){logger['error'](_0x1d69('0xf'),_0x520acb,_0x383771);_0x369d44(_0x383771);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4cfb78,_0x4c1da6){_0x4cfb78=_0x4cfb78-0x0;var _0xc1250e=_0xbdb7[_0x4cfb78];return _0xc1250e;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 1747a77..6e18f5c 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 _0xdc4b=['get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceContext.controller'];(function(_0x34834c,_0x4993c7){var _0x58a0a8=function(_0x196b6c){while(--_0x196b6c){_0x34834c['push'](_0x34834c['shift']());}};_0x58a0a8(++_0x4993c7);}(_0xdc4b,0x105));var _0xbdc4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdc4b[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xbdc4('0x0'));var util=require(_0xbdc4('0x1'));var path=require(_0xbdc4('0x2'));var timeout=require(_0xbdc4('0x3'));var express=require(_0xbdc4('0x4'));var router=express[_0xbdc4('0x5')]();var fs_extra=require(_0xbdc4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbdc4('0x7'));var controller=require(_0xbdc4('0x8'));router[_0xbdc4('0x9')]('/',auth[_0xbdc4('0xa')](),controller[_0xbdc4('0xb')]);router['get'](_0xbdc4('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbdc4('0xa')](),controller[_0xbdc4('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbdc4('0xe')]);router[_0xbdc4('0xf')]('/:id',auth[_0xbdc4('0xa')](),controller[_0xbdc4('0x10')]);module[_0xbdc4('0x11')]=router; \ No newline at end of file +var _0x8fc2=['post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show'];(function(_0x3c7f9c,_0x597bde){var _0x2b10ad=function(_0x501925){while(--_0x501925){_0x3c7f9c['push'](_0x3c7f9c['shift']());}};_0x2b10ad(++_0x597bde);}(_0x8fc2,0x1eb));var _0x28fc=function(_0x35729f,_0x9997ea){_0x35729f=_0x35729f-0x0;var _0x473550=_0x8fc2[_0x35729f];return _0x473550;};'use strict';var multer=require(_0x28fc('0x0'));var util=require(_0x28fc('0x1'));var path=require(_0x28fc('0x2'));var timeout=require(_0x28fc('0x3'));var express=require('express');var router=express[_0x28fc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28fc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x28fc('0x6'));var controller=require(_0x28fc('0x7'));router[_0x28fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x28fc('0x9')]);router[_0x28fc('0x8')](_0x28fc('0xa'),auth[_0x28fc('0xb')](),controller[_0x28fc('0xc')]);router[_0x28fc('0xd')]('/',auth[_0x28fc('0xb')](),controller[_0x28fc('0xe')]);router[_0x28fc('0xf')](_0x28fc('0xa'),auth[_0x28fc('0xb')](),controller['update']);router[_0x28fc('0x10')](_0x28fc('0xa'),auth[_0x28fc('0xb')](),controller['destroy']);module[_0x28fc('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 e51a050..ea521a5 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 _0x32f0=['exports','STRING','BOOLEAN','sequelize'];(function(_0x17f5d4,_0xc7ddf6){var _0x46f0df=function(_0x264927){while(--_0x264927){_0x17f5d4['push'](_0x17f5d4['shift']());}};_0x46f0df(++_0xc7ddf6);}(_0x32f0,0x1ab));var _0x032f=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x32f0[_0x1678c8];return _0x387aa9;};'use strict';var Sequelize=require(_0x032f('0x0'));module[_0x032f('0x1')]={'name':{'type':Sequelize[_0x032f('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x032f('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x032f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb734=['STRING','name'];(function(_0x101ef8,_0x576b43){var _0x10b3fb=function(_0x3a0d57){while(--_0x3a0d57){_0x101ef8['push'](_0x101ef8['shift']());}};_0x10b3fb(++_0x576b43);}(_0xb734,0x130));var _0x4b73=function(_0x21e79a,_0x5a7990){_0x21e79a=_0x21e79a-0x0;var _0x506c02=_0xb734[_0x21e79a];return _0x506c02;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4b73('0x0')],'unique':_0x4b73('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 843a3a5..3767e21 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 _0x09d7=['rows','catch','params','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','writeFileSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','name','send','index','map','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','VoiceContext','includeAll','include','findAll'];(function(_0x23e812,_0x1c9fd9){var _0x4fe7e4=function(_0x502b23){while(--_0x502b23){_0x23e812['push'](_0x23e812['shift']());}};_0x4fe7e4(++_0x1c9fd9);}(_0x09d7,0x1aa));var _0x709d=function(_0x181c9b,_0x275392){_0x181c9b=_0x181c9b-0x0;var _0x5b1a0d=_0x09d7[_0x181c9b];return _0x5b1a0d;};'use strict';var emlformat=require(_0x709d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x709d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x709d('0x2'));var moment=require(_0x709d('0x3'));var BPromise=require(_0x709d('0x4'));var Mustache=require(_0x709d('0x5'));var util=require(_0x709d('0x6'));var path=require(_0x709d('0x7'));var sox=require(_0x709d('0x8'));var csv=require('to-csv');var ejs=require(_0x709d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x709d('0xa'));var squel=require(_0x709d('0xb'));var crypto=require(_0x709d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x709d('0xd'));var toCsv=require(_0x709d('0xe'));var querystring=require(_0x709d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x709d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x709d('0x11'));var hardwareService=require(_0x709d('0x12'));var logger=require(_0x709d('0x13'))(_0x709d('0x14'));var utils=require('../../config/utils');var config=require(_0x709d('0x15'));var licenseUtil=require(_0x709d('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x709d('0x17'));var client=jayson[_0x709d('0x18')][_0x709d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xb7a9d,_0x1188d5,_0x2deb88,_0x4a0c9a){return new BPromise(function(_0x572ebc,_0x4a8b15){var _0x3bf7b8=_0x4a0c9a||client;return _0x3bf7b8[_0x709d('0x1a')](_0xb7a9d,_0x2deb88)[_0x709d('0x1b')](function(_0x20527b){logger[_0x709d('0x1c')](_0x709d('0x1d'),_0x1188d5,_0x709d('0x1e'));logger[_0x709d('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1188d5,_0x709d('0x1e'),JSON[_0x709d('0x20')](_0x20527b));if(_0x20527b['error']){if(_0x20527b[_0x709d('0x21')][_0x709d('0x22')]===0x1f4){logger['error'](_0x709d('0x1d'),_0x1188d5,_0x20527b[_0x709d('0x21')]['message']);return _0x4a8b15(_0x20527b[_0x709d('0x21')][_0x709d('0x23')]);}logger[_0x709d('0x21')](_0x709d('0x1d'),_0x1188d5,_0x20527b[_0x709d('0x21')]['message']);return _0x572ebc(_0x20527b[_0x709d('0x21')][_0x709d('0x23')]);}else{logger['info'](_0x709d('0x1d'),_0x1188d5,_0x709d('0x1e'));_0x572ebc(_0x20527b[_0x709d('0x24')][_0x709d('0x23')]);}})['catch'](function(_0x228c58){logger[_0x709d('0x21')]('VoiceContext,\x20%s,\x20%s',_0x1188d5,_0x228c58);_0x4a8b15(_0x228c58);});});}function respondWithStatusCode(_0x48f3fd,_0x3fac2d){_0x3fac2d=_0x3fac2d||0xcc;return function(_0x879fba){if(_0x879fba){return _0x48f3fd[_0x709d('0x25')](_0x3fac2d);}return _0x48f3fd[_0x709d('0x26')](_0x3fac2d)[_0x709d('0x27')]();};}function respondWithResult(_0x13699e,_0x50e233){_0x50e233=_0x50e233||0xc8;return function(_0x398073){if(_0x398073){return _0x13699e[_0x709d('0x26')](_0x50e233)[_0x709d('0x28')](_0x398073);}};}function respondWithFilteredResult(_0x2c05b4,_0x52225e){return function(_0x2d3fa3){if(_0x2d3fa3){var _0xbba484=typeof _0x52225e[_0x709d('0x29')]==='undefined'&&typeof _0x52225e[_0x709d('0x2a')]===_0x709d('0x2b');var _0x33af9b=_0x2d3fa3[_0x709d('0x2c')];var _0xbc512e=_0xbba484?0x0:_0x52225e[_0x709d('0x29')];var _0x25e0dd=_0xbba484?_0x2d3fa3[_0x709d('0x2c')]:_0x52225e['offset']+_0x52225e[_0x709d('0x2a')];var _0x209ee9;if(_0x25e0dd>=_0x33af9b){_0x25e0dd=_0x33af9b;_0x209ee9=0xc8;}else{_0x209ee9=0xce;}_0x2c05b4['status'](_0x209ee9);return _0x2c05b4[_0x709d('0x2d')](_0x709d('0x2e'),_0xbc512e+'-'+_0x25e0dd+'/'+_0x33af9b)['json'](_0x2d3fa3);}return null;};}function patchUpdates(_0x1c10b8){return function(_0x879a09){try{jsonpatch[_0x709d('0x2f')](_0x879a09,_0x1c10b8,!![]);}catch(_0x8196e){return BPromise[_0x709d('0x30')](_0x8196e);}return _0x879a09[_0x709d('0x31')]();};}function saveUpdates(_0x44e747,_0x413ef4){return function(_0xa3bc1){if(_0xa3bc1){return _0xa3bc1[_0x709d('0x32')](_0x44e747)[_0x709d('0x1b')](function(_0x30456e){return _0x30456e;});}return null;};}function removeEntity(_0x25059a,_0x33e752){return function(_0x76dbe1){if(_0x76dbe1){return _0x76dbe1[_0x709d('0x33')]()[_0x709d('0x1b')](function(){var _0x569855=_0x76dbe1['get']({'plain':!![]});var _0x31e4aa='Contexts';return db[_0x709d('0x34')][_0x709d('0x33')]({'where':{'type':_0x31e4aa,'resourceId':_0x569855['id']}})['then'](function(){return _0x76dbe1;});})['then'](function(){_0x25059a[_0x709d('0x26')](0xcc)[_0x709d('0x27')]();});}};}function handleEntityNotFound(_0xe89c85,_0x7c7e2a){return function(_0x563d6c){if(!_0x563d6c){_0xe89c85[_0x709d('0x25')](0x194);}return _0x563d6c;};}function handleError(_0x560d5a,_0x363646){_0x363646=_0x363646||0x1f4;return function(_0x2f5f52){logger[_0x709d('0x21')](_0x2f5f52['stack']);if(_0x2f5f52[_0x709d('0x35')]){delete _0x2f5f52[_0x709d('0x35')];}_0x560d5a[_0x709d('0x26')](_0x363646)[_0x709d('0x36')](_0x2f5f52);};}exports[_0x709d('0x37')]=function(_0x2ba0e1,_0x3083e4){var _0x5c54b8={},_0x3d51b3={},_0x4c969c={'count':0x0,'rows':[]};var _0x15461e=_[_0x709d('0x38')](db['VoiceContext']['rawAttributes'],function(_0x272806){return{'name':_0x272806['fieldName'],'type':_0x272806[_0x709d('0x39')]['key']};});_0x3d51b3[_0x709d('0x3a')]=_[_0x709d('0x38')](_0x15461e,'name');_0x3d51b3[_0x709d('0x3b')]=_[_0x709d('0x3c')](_0x2ba0e1[_0x709d('0x3b')]);_0x3d51b3[_0x709d('0x3d')]=_[_0x709d('0x3e')](_0x3d51b3[_0x709d('0x3a')],_0x3d51b3[_0x709d('0x3b')]);_0x5c54b8['attributes']=_['intersection'](_0x3d51b3[_0x709d('0x3a')],qs[_0x709d('0x3f')](_0x2ba0e1['query'][_0x709d('0x3f')]));_0x5c54b8[_0x709d('0x40')]=_0x5c54b8['attributes'][_0x709d('0x41')]?_0x5c54b8[_0x709d('0x40')]:_0x3d51b3[_0x709d('0x3a')];if(!_0x2ba0e1[_0x709d('0x3b')][_0x709d('0x42')](_0x709d('0x43'))){_0x5c54b8[_0x709d('0x2a')]=qs[_0x709d('0x2a')](_0x2ba0e1[_0x709d('0x3b')][_0x709d('0x2a')]);_0x5c54b8[_0x709d('0x29')]=qs[_0x709d('0x29')](_0x2ba0e1['query'][_0x709d('0x29')]);}_0x5c54b8[_0x709d('0x44')]=qs[_0x709d('0x45')](_0x2ba0e1[_0x709d('0x3b')][_0x709d('0x45')]);_0x5c54b8['where']=qs[_0x709d('0x3d')](_[_0x709d('0x46')](_0x2ba0e1[_0x709d('0x3b')],_0x3d51b3['filters']),_0x15461e);if(_0x2ba0e1[_0x709d('0x3b')][_0x709d('0x47')]){_0x5c54b8['where']=_[_0x709d('0x48')](_0x5c54b8[_0x709d('0x49')],{'$or':_[_0x709d('0x38')](_0x15461e,function(_0x128f86){if(_0x128f86[_0x709d('0x39')]!==_0x709d('0x4a')){var _0x49e868={};_0x49e868[_0x128f86[_0x709d('0x35')]]={'$like':'%'+_0x2ba0e1[_0x709d('0x3b')][_0x709d('0x47')]+'%'};return _0x49e868;}})});}_0x5c54b8=_[_0x709d('0x48')]({},_0x5c54b8,_0x2ba0e1['options']);var _0x54e5da={'where':_0x5c54b8['where']};return db[_0x709d('0x4b')][_0x709d('0x2c')](_0x54e5da)[_0x709d('0x1b')](function(_0xff9387){_0x4c969c[_0x709d('0x2c')]=_0xff9387;if(_0x2ba0e1[_0x709d('0x3b')][_0x709d('0x4c')]){_0x5c54b8[_0x709d('0x4d')]=[{'all':!![]}];}return db[_0x709d('0x4b')][_0x709d('0x4e')](_0x5c54b8);})[_0x709d('0x1b')](function(_0x2d2a43){_0x4c969c[_0x709d('0x4f')]=_0x2d2a43;return _0x4c969c;})[_0x709d('0x1b')](respondWithFilteredResult(_0x3083e4,_0x5c54b8))[_0x709d('0x50')](handleError(_0x3083e4,null));};exports['show']=function(_0x2fc038,_0x4989dd){var _0x1a834d={'raw':![],'where':{'id':_0x2fc038[_0x709d('0x51')]['id']}},_0x5674b7={};_0x5674b7[_0x709d('0x3a')]=_[_0x709d('0x3c')](db[_0x709d('0x4b')]['rawAttributes']);_0x5674b7[_0x709d('0x3b')]=_[_0x709d('0x3c')](_0x2fc038['query']);_0x5674b7['filters']=_['intersection'](_0x5674b7[_0x709d('0x3a')],_0x5674b7[_0x709d('0x3b')]);_0x1a834d[_0x709d('0x40')]=_['intersection'](_0x5674b7[_0x709d('0x3a')],qs[_0x709d('0x3f')](_0x2fc038[_0x709d('0x3b')][_0x709d('0x3f')]));_0x1a834d['attributes']=_0x1a834d[_0x709d('0x40')][_0x709d('0x41')]?_0x1a834d[_0x709d('0x40')]:_0x5674b7[_0x709d('0x3a')];if(_0x2fc038[_0x709d('0x3b')]['includeAll']){_0x1a834d[_0x709d('0x4d')]=[{'all':!![]}];}_0x1a834d=_[_0x709d('0x48')]({},_0x1a834d,_0x2fc038[_0x709d('0x52')]);return db['VoiceContext'][_0x709d('0x53')](_0x1a834d)[_0x709d('0x1b')](handleEntityNotFound(_0x4989dd,null))['then'](respondWithResult(_0x4989dd,null))[_0x709d('0x50')](handleError(_0x4989dd,null));};exports[_0x709d('0x54')]=function(_0x34d5d9,_0x3548e8,_0x38ffd4){var _0x206fbe;return db[_0x709d('0x4b')][_0x709d('0x54')](_0x34d5d9[_0x709d('0x55')],{'raw':!![]})[_0x709d('0x1b')](function(_0x1a2240){_0x206fbe=_0x1a2240;return db[_0x709d('0x4b')][_0x709d('0x4e')]({'raw':!![]});})[_0x709d('0x1b')](function(_0x521861){var _0x23cc3b=fs[_0x709d('0x56')](path[_0x709d('0x57')](config[_0x709d('0x58')],_0x709d('0x59')),_0x709d('0x5a'));var _0xade805=ejs[_0x709d('0x5b')](_0x23cc3b,{'contexts':_0x521861||[]});fs['writeFileSync'](_0x709d('0x5c'),_0xade805);})['then'](function(){return respondWithRpcPromise(_0x709d('0x5d'),'create',{'module':_0x709d('0x5e')});})['then'](function(){var _0x4e1ab0=_0x34d5d9[_0x709d('0x5f')][_0x709d('0x60')]({'plain':!![]});if(!_0x4e1ab0)throw new Error(_0x709d('0x61'));if(_0x4e1ab0['role']===_0x709d('0x5f')){var _0x8350ca=_0x206fbe['get']({'plain':!![]});return db[_0x709d('0x62')][_0x709d('0x53')]({'where':{'name':'Contexts','userProfileId':_0x4e1ab0['userProfileId']},'raw':!![]})[_0x709d('0x1b')](function(_0x3194b0){if(_0x3194b0&&_0x3194b0[_0x709d('0x63')]===0x0){return db[_0x709d('0x34')]['create']({'name':_0x8350ca[_0x709d('0x35')],'resourceId':_0x8350ca['id'],'type':_0x3194b0['name'],'sectionId':_0x3194b0['id']},{})[_0x709d('0x1b')](function(){return _0x206fbe;});}else{return _0x206fbe;}})[_0x709d('0x50')](function(_0x2fe12d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fe12d);throw _0x2fe12d;});}return _0x206fbe;})['then'](respondWithResult(_0x3548e8,0xc9))['catch'](handleError(_0x3548e8,null));};exports[_0x709d('0x32')]=function(_0x23b992,_0x2ca109,_0x6e43b5){var _0x4f3efc;return db[_0x709d('0x4b')][_0x709d('0x53')]({'where':{'id':_0x23b992[_0x709d('0x51')]['id']}})[_0x709d('0x1b')](handleEntityNotFound(_0x2ca109,null))[_0x709d('0x1b')](saveUpdates(_0x23b992[_0x709d('0x55')],null))[_0x709d('0x1b')](function(_0x31cd33){if(_0x31cd33){_0x4f3efc=_0x31cd33;return db[_0x709d('0x4b')][_0x709d('0x4e')]({'raw':!![]});}})[_0x709d('0x1b')](function(_0x123bee){var _0x18338f=fs[_0x709d('0x56')](path['join'](config['root'],_0x709d('0x59')),_0x709d('0x5a'));var _0x401f48=ejs[_0x709d('0x5b')](_0x18338f,{'contexts':_0x123bee||[]});fs[_0x709d('0x64')](_0x709d('0x5c'),_0x401f48);})[_0x709d('0x1b')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x709d('0x5e')});})[_0x709d('0x1b')](function(){return _0x4f3efc;})['then'](respondWithResult(_0x2ca109,null))[_0x709d('0x50')](handleError(_0x2ca109,null));};exports[_0x709d('0x33')]=function(_0x538c7e,_0x135c09,_0x4c25b1){var _0x306da8;return db[_0x709d('0x4b')][_0x709d('0x53')]({'where':{'id':_0x538c7e[_0x709d('0x51')]['id']}})['then'](handleEntityNotFound(_0x135c09,null))['then'](removeEntity(_0x135c09,null))[_0x709d('0x1b')](function(){return db[_0x709d('0x4b')]['findAll']({'raw':!![]});})[_0x709d('0x1b')](function(_0x221ad5){var _0x2c42ff=fs[_0x709d('0x56')](path[_0x709d('0x57')](config[_0x709d('0x58')],_0x709d('0x59')),_0x709d('0x5a'));var _0x49e152=ejs[_0x709d('0x5b')](_0x2c42ff,{'contexts':_0x221ad5});fs[_0x709d('0x64')](_0x709d('0x5c'),_0x49e152);return respondWithRpcPromise(_0x709d('0x5d'),_0x709d('0x33'),{'module':_0x709d('0x5e')});})[_0x709d('0x50')](handleError(_0x135c09,null));}; \ No newline at end of file +var _0xfd9a=['VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','Contexts','UserProfileResource','end','sendStatus','name','index','VoiceContext','rawAttributes','fieldName','key','map','keys','query','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','options','include','findAll','show','params','intersection','includeAll','find','create','body','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','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x32292b,_0x4e9525){var _0x1845b4=function(_0x348377){while(--_0x348377){_0x32292b['push'](_0x32292b['shift']());}};_0x1845b4(++_0x4e9525);}(_0xfd9a,0x115));var _0xafd9=function(_0x45cc01,_0x2e635a){_0x45cc01=_0x45cc01-0x0;var _0x349d47=_0xfd9a[_0x45cc01];return _0x349d47;};'use strict';var emlformat=require(_0xafd9('0x0'));var rimraf=require(_0xafd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafd9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xafd9('0x3'));var Mustache=require(_0xafd9('0x4'));var util=require(_0xafd9('0x5'));var path=require(_0xafd9('0x6'));var sox=require(_0xafd9('0x7'));var csv=require(_0xafd9('0x8'));var ejs=require(_0xafd9('0x9'));var fs=require('fs');var fs_extra=require(_0xafd9('0xa'));var _=require('lodash');var squel=require(_0xafd9('0xb'));var crypto=require(_0xafd9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xafd9('0xd'));var toCsv=require(_0xafd9('0x8'));var querystring=require('querystring');var Papa=require(_0xafd9('0xe'));var Redis=require(_0xafd9('0xf'));var authService=require(_0xafd9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xafd9('0x11'));var hardwareService=require(_0xafd9('0x12'));var logger=require(_0xafd9('0x13'))(_0xafd9('0x14'));var utils=require(_0xafd9('0x15'));var config=require(_0xafd9('0x16'));var licenseUtil=require(_0xafd9('0x17'));var db=require(_0xafd9('0x18'))['db'];var jayson=require(_0xafd9('0x19'));var client=jayson[_0xafd9('0x1a')][_0xafd9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x9d0240,_0x74c5c6,_0xb495f2,_0x39b8d2){return new BPromise(function(_0x293029,_0x44e2d3){var _0x46fe51=_0x39b8d2||client;return _0x46fe51[_0xafd9('0x1c')](_0x9d0240,_0xb495f2)[_0xafd9('0x1d')](function(_0x7c52ff){logger[_0xafd9('0x1e')](_0xafd9('0x1f'),_0x74c5c6,'request\x20sent');logger['debug'](_0xafd9('0x20'),_0x74c5c6,_0xafd9('0x21'),JSON[_0xafd9('0x22')](_0x7c52ff));if(_0x7c52ff['error']){if(_0x7c52ff['error'][_0xafd9('0x23')]===0x1f4){logger['error'](_0xafd9('0x1f'),_0x74c5c6,_0x7c52ff[_0xafd9('0x24')][_0xafd9('0x25')]);return _0x44e2d3(_0x7c52ff[_0xafd9('0x24')][_0xafd9('0x25')]);}logger['error'](_0xafd9('0x1f'),_0x74c5c6,_0x7c52ff[_0xafd9('0x24')][_0xafd9('0x25')]);return _0x293029(_0x7c52ff['error']['message']);}else{logger[_0xafd9('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x74c5c6,'request\x20sent');_0x293029(_0x7c52ff['result'][_0xafd9('0x25')]);}})[_0xafd9('0x26')](function(_0x5ac1af){logger[_0xafd9('0x24')](_0xafd9('0x1f'),_0x74c5c6,_0x5ac1af);_0x44e2d3(_0x5ac1af);});});}function respondWithStatusCode(_0x5550f0,_0x15549d){_0x15549d=_0x15549d||0xcc;return function(_0x104e73){if(_0x104e73){return _0x5550f0['sendStatus'](_0x15549d);}return _0x5550f0[_0xafd9('0x27')](_0x15549d)['end']();};}function respondWithResult(_0x46d0d4,_0x46e8a0){_0x46e8a0=_0x46e8a0||0xc8;return function(_0x12a313){if(_0x12a313){return _0x46d0d4['status'](_0x46e8a0)[_0xafd9('0x28')](_0x12a313);}};}function respondWithFilteredResult(_0x3e8a59,_0x2af5a2){return function(_0x11cb0a){if(_0x11cb0a){var _0x90699=typeof _0x2af5a2[_0xafd9('0x29')]===_0xafd9('0x2a')&&typeof _0x2af5a2[_0xafd9('0x2b')]==='undefined';var _0x41dcbc=_0x11cb0a['count'];var _0x1a7981=_0x90699?0x0:_0x2af5a2[_0xafd9('0x29')];var _0x4821b6=_0x90699?_0x11cb0a[_0xafd9('0x2c')]:_0x2af5a2['offset']+_0x2af5a2[_0xafd9('0x2b')];var _0x36514c;if(_0x4821b6>=_0x41dcbc){_0x4821b6=_0x41dcbc;_0x36514c=0xc8;}else{_0x36514c=0xce;}_0x3e8a59[_0xafd9('0x27')](_0x36514c);return _0x3e8a59[_0xafd9('0x2d')]('Content-Range',_0x1a7981+'-'+_0x4821b6+'/'+_0x41dcbc)[_0xafd9('0x28')](_0x11cb0a);}return null;};}function patchUpdates(_0x5015dc){return function(_0x159a59){try{jsonpatch[_0xafd9('0x2e')](_0x159a59,_0x5015dc,!![]);}catch(_0x5d685a){return BPromise[_0xafd9('0x2f')](_0x5d685a);}return _0x159a59['save']();};}function saveUpdates(_0x3bdafd,_0x318299){return function(_0x39b65a){if(_0x39b65a){return _0x39b65a[_0xafd9('0x30')](_0x3bdafd)[_0xafd9('0x1d')](function(_0x2598da){return _0x2598da;});}return null;};}function removeEntity(_0x1fd0c3,_0x21c22e){return function(_0x2411f9){if(_0x2411f9){return _0x2411f9[_0xafd9('0x31')]()[_0xafd9('0x1d')](function(){var _0x3eecf8=_0x2411f9[_0xafd9('0x32')]({'plain':!![]});var _0x544378=_0xafd9('0x33');return db[_0xafd9('0x34')][_0xafd9('0x31')]({'where':{'type':_0x544378,'resourceId':_0x3eecf8['id']}})['then'](function(){return _0x2411f9;});})[_0xafd9('0x1d')](function(){_0x1fd0c3[_0xafd9('0x27')](0xcc)[_0xafd9('0x35')]();});}};}function handleEntityNotFound(_0x25c40a,_0x2fdd18){return function(_0x1632b2){if(!_0x1632b2){_0x25c40a[_0xafd9('0x36')](0x194);}return _0x1632b2;};}function handleError(_0x424605,_0x2e3196){_0x2e3196=_0x2e3196||0x1f4;return function(_0x453006){logger['error'](_0x453006['stack']);if(_0x453006[_0xafd9('0x37')]){delete _0x453006['name'];}_0x424605['status'](_0x2e3196)['send'](_0x453006);};}exports[_0xafd9('0x38')]=function(_0x34f0fb,_0x27d88b){var _0x392606={},_0x3066e5={},_0x4b6d14={'count':0x0,'rows':[]};var _0x154657=_['map'](db[_0xafd9('0x39')][_0xafd9('0x3a')],function(_0x470682){return{'name':_0x470682[_0xafd9('0x3b')],'type':_0x470682['type'][_0xafd9('0x3c')]};});_0x3066e5['model']=_[_0xafd9('0x3d')](_0x154657,_0xafd9('0x37'));_0x3066e5['query']=_[_0xafd9('0x3e')](_0x34f0fb[_0xafd9('0x3f')]);_0x3066e5['filters']=_['intersection'](_0x3066e5[_0xafd9('0x40')],_0x3066e5[_0xafd9('0x3f')]);_0x392606[_0xafd9('0x41')]=_['intersection'](_0x3066e5[_0xafd9('0x40')],qs[_0xafd9('0x42')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x42')]));_0x392606['attributes']=_0x392606['attributes']['length']?_0x392606[_0xafd9('0x41')]:_0x3066e5[_0xafd9('0x40')];if(!_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x43')](_0xafd9('0x44'))){_0x392606[_0xafd9('0x2b')]=qs[_0xafd9('0x2b')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x2b')]);_0x392606[_0xafd9('0x29')]=qs[_0xafd9('0x29')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x29')]);}_0x392606[_0xafd9('0x45')]=qs[_0xafd9('0x46')](_0x34f0fb[_0xafd9('0x3f')][_0xafd9('0x46')]);_0x392606[_0xafd9('0x47')]=qs[_0xafd9('0x48')](_[_0xafd9('0x49')](_0x34f0fb['query'],_0x3066e5['filters']),_0x154657);if(_0x34f0fb[_0xafd9('0x3f')]['filter']){_0x392606[_0xafd9('0x47')]=_[_0xafd9('0x4a')](_0x392606['where'],{'$or':_[_0xafd9('0x3d')](_0x154657,function(_0x897145){if(_0x897145[_0xafd9('0x4b')]!=='VIRTUAL'){var _0x538653={};_0x538653[_0x897145[_0xafd9('0x37')]]={'$like':'%'+_0x34f0fb[_0xafd9('0x3f')]['filter']+'%'};return _0x538653;}})});}_0x392606=_['merge']({},_0x392606,_0x34f0fb[_0xafd9('0x4c')]);var _0x4a4845={'where':_0x392606['where']};return db[_0xafd9('0x39')]['count'](_0x4a4845)[_0xafd9('0x1d')](function(_0x4f6759){_0x4b6d14[_0xafd9('0x2c')]=_0x4f6759;if(_0x34f0fb[_0xafd9('0x3f')]['includeAll']){_0x392606[_0xafd9('0x4d')]=[{'all':!![]}];}return db[_0xafd9('0x39')][_0xafd9('0x4e')](_0x392606);})[_0xafd9('0x1d')](function(_0x551756){_0x4b6d14['rows']=_0x551756;return _0x4b6d14;})['then'](respondWithFilteredResult(_0x27d88b,_0x392606))[_0xafd9('0x26')](handleError(_0x27d88b,null));};exports[_0xafd9('0x4f')]=function(_0x211c24,_0xf395be){var _0x503c97={'raw':![],'where':{'id':_0x211c24[_0xafd9('0x50')]['id']}},_0x580784={};_0x580784['model']=_['keys'](db[_0xafd9('0x39')][_0xafd9('0x3a')]);_0x580784[_0xafd9('0x3f')]=_[_0xafd9('0x3e')](_0x211c24[_0xafd9('0x3f')]);_0x580784[_0xafd9('0x48')]=_[_0xafd9('0x51')](_0x580784['model'],_0x580784[_0xafd9('0x3f')]);_0x503c97[_0xafd9('0x41')]=_[_0xafd9('0x51')](_0x580784['model'],qs[_0xafd9('0x42')](_0x211c24[_0xafd9('0x3f')]['fields']));_0x503c97['attributes']=_0x503c97[_0xafd9('0x41')]['length']?_0x503c97[_0xafd9('0x41')]:_0x580784[_0xafd9('0x40')];if(_0x211c24[_0xafd9('0x3f')][_0xafd9('0x52')]){_0x503c97[_0xafd9('0x4d')]=[{'all':!![]}];}_0x503c97=_[_0xafd9('0x4a')]({},_0x503c97,_0x211c24[_0xafd9('0x4c')]);return db['VoiceContext'][_0xafd9('0x53')](_0x503c97)[_0xafd9('0x1d')](handleEntityNotFound(_0xf395be,null))[_0xafd9('0x1d')](respondWithResult(_0xf395be,null))[_0xafd9('0x26')](handleError(_0xf395be,null));};exports[_0xafd9('0x54')]=function(_0x359205,_0x3ce382,_0x42254b){var _0x3d1900;return db[_0xafd9('0x39')][_0xafd9('0x54')](_0x359205[_0xafd9('0x55')],{'raw':!![]})[_0xafd9('0x1d')](function(_0x5853d4){_0x3d1900=_0x5853d4;return db[_0xafd9('0x39')][_0xafd9('0x4e')]({'raw':!![]});})['then'](function(_0x10ee37){var _0x18743f=fs['readFileSync'](path[_0xafd9('0x56')](config[_0xafd9('0x57')],_0xafd9('0x58')),_0xafd9('0x59'));var _0x42c35d=ejs[_0xafd9('0x5a')](_0x18743f,{'contexts':_0x10ee37||[]});fs[_0xafd9('0x5b')](_0xafd9('0x5c'),_0x42c35d);})[_0xafd9('0x1d')](function(){return respondWithRpcPromise(_0xafd9('0x5d'),_0xafd9('0x54'),{'module':_0xafd9('0x5e')});})[_0xafd9('0x1d')](function(){var _0x33341a=_0x359205[_0xafd9('0x5f')][_0xafd9('0x32')]({'plain':!![]});if(!_0x33341a)throw new Error(_0xafd9('0x60'));if(_0x33341a[_0xafd9('0x61')]===_0xafd9('0x5f')){var _0x1d579d=_0x3d1900['get']({'plain':!![]});return db[_0xafd9('0x62')][_0xafd9('0x53')]({'where':{'name':_0xafd9('0x33'),'userProfileId':_0x33341a[_0xafd9('0x63')]},'raw':!![]})['then'](function(_0x469c07){if(_0x469c07&&_0x469c07[_0xafd9('0x64')]===0x0){return db[_0xafd9('0x34')][_0xafd9('0x54')]({'name':_0x1d579d[_0xafd9('0x37')],'resourceId':_0x1d579d['id'],'type':_0x469c07[_0xafd9('0x37')],'sectionId':_0x469c07['id']},{})[_0xafd9('0x1d')](function(){return _0x3d1900;});}else{return _0x3d1900;}})[_0xafd9('0x26')](function(_0x45331a){logger['error'](_0xafd9('0x65'),_0x45331a);throw _0x45331a;});}return _0x3d1900;})[_0xafd9('0x1d')](respondWithResult(_0x3ce382,0xc9))[_0xafd9('0x26')](handleError(_0x3ce382,null));};exports[_0xafd9('0x30')]=function(_0x1d1d9b,_0x3a4d2c,_0x4e8f2f){var _0x160142;return db[_0xafd9('0x39')][_0xafd9('0x53')]({'where':{'id':_0x1d1d9b[_0xafd9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3a4d2c,null))[_0xafd9('0x1d')](saveUpdates(_0x1d1d9b['body'],null))[_0xafd9('0x1d')](function(_0x439856){if(_0x439856){_0x160142=_0x439856;return db[_0xafd9('0x39')][_0xafd9('0x4e')]({'raw':!![]});}})['then'](function(_0x55aef0){var _0x463626=fs['readFileSync'](path[_0xafd9('0x56')](config[_0xafd9('0x57')],_0xafd9('0x58')),_0xafd9('0x59'));var _0x56f0b7=ejs[_0xafd9('0x5a')](_0x463626,{'contexts':_0x55aef0||[]});fs[_0xafd9('0x5b')](_0xafd9('0x5c'),_0x56f0b7);})[_0xafd9('0x1d')](function(){return respondWithRpcPromise(_0xafd9('0x5d'),'update',{'module':_0xafd9('0x5e')});})[_0xafd9('0x1d')](function(){return _0x160142;})['then'](respondWithResult(_0x3a4d2c,null))[_0xafd9('0x26')](handleError(_0x3a4d2c,null));};exports[_0xafd9('0x31')]=function(_0x54406e,_0x145271,_0xe1d497){var _0x2e34e3;return db[_0xafd9('0x39')][_0xafd9('0x53')]({'where':{'id':_0x54406e['params']['id']}})[_0xafd9('0x1d')](handleEntityNotFound(_0x145271,null))[_0xafd9('0x1d')](removeEntity(_0x145271,null))['then'](function(){return db[_0xafd9('0x39')][_0xafd9('0x4e')]({'raw':!![]});})[_0xafd9('0x1d')](function(_0x10d86f){var _0x435ae5=fs[_0xafd9('0x66')](path[_0xafd9('0x56')](config[_0xafd9('0x57')],_0xafd9('0x58')),_0xafd9('0x59'));var _0x130356=ejs['render'](_0x435ae5,{'contexts':_0x10d86f});fs[_0xafd9('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x130356);return respondWithRpcPromise(_0xafd9('0x5d'),_0xafd9('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x145271,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 45f341c..bfb7231 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 _0x4f54=['request-promise','rimraf','../../config/environment','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2c22e2,_0x562898){var _0xdadc47=function(_0x5a8ff0){while(--_0x5a8ff0){_0x2c22e2['push'](_0x2c22e2['shift']());}};_0xdadc47(++_0x562898);}(_0x4f54,0x123));var _0x44f5=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4f54[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x44f5('0x0'));var util=require(_0x44f5('0x1'));var logger=require(_0x44f5('0x2'))(_0x44f5('0x3'));var moment=require(_0x44f5('0x4'));var BPromise=require(_0x44f5('0x5'));var rp=require(_0x44f5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44f5('0x7'));var config=require(_0x44f5('0x8'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x4b15c6,_0x5815ed){return _0x4b15c6[_0x44f5('0x9')]('VoiceContext',attributes,{'tableName':_0x44f5('0xa'),'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(_0x269112,_0x2d8b36){var _0x1d45c7=function(_0x57ab36){while(--_0x57ab36){_0x269112['push'](_0x269112['shift']());}};_0x1d45c7(++_0x2d8b36);}(_0x4e27,0x180));var _0x74e2=function(_0x1a30ab,_0x4993f6){_0x1a30ab=_0x1a30ab-0x0;var _0x3bf765=_0x4e27[_0x1a30ab];return _0x3bf765;};'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 23e2161..bb78e00 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 _0x2080=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x2080,0x19f));var _0x0208=function(_0x251b81,_0x32e8d5){_0x251b81=_0x251b81-0x0;var _0xf320a1=_0x2080[_0x251b81];return _0xf320a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0208('0x0'));var BPromise=require(_0x0208('0x1'));var rs=require(_0x0208('0x2'));var fs=require('fs');var Redis=require(_0x0208('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0208('0x4'));var logger=require(_0x0208('0x5'))('rpc');var config=require(_0x0208('0x6'));var jayson=require(_0x0208('0x7'));var client=jayson[_0x0208('0x8')][_0x0208('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29ab94,_0x56a859,_0x4279d3){return new BPromise(function(_0xf3f72e,_0x44daee){return client[_0x0208('0xa')](_0x29ab94,_0x4279d3)[_0x0208('0xb')](function(_0x47eb2a){logger[_0x0208('0xc')]('VoiceContext,\x20%s,\x20%s',_0x56a859,_0x0208('0xd'));logger[_0x0208('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x56a859,'request\x20sent',JSON[_0x0208('0xf')](_0x47eb2a));if(_0x47eb2a[_0x0208('0x10')]){if(_0x47eb2a[_0x0208('0x10')][_0x0208('0x11')]===0x1f4){logger[_0x0208('0x10')](_0x0208('0x12'),_0x56a859,_0x47eb2a[_0x0208('0x10')][_0x0208('0x13')]);return _0x44daee(_0x47eb2a[_0x0208('0x10')]['message']);}logger[_0x0208('0x10')](_0x0208('0x12'),_0x56a859,_0x47eb2a['error'][_0x0208('0x13')]);return _0xf3f72e(_0x47eb2a['error'][_0x0208('0x13')]);}else{logger[_0x0208('0xc')]('VoiceContext,\x20%s,\x20%s',_0x56a859,_0x0208('0xd'));_0xf3f72e(_0x47eb2a['result'][_0x0208('0x13')]);}})[_0x0208('0x14')](function(_0x27b53f){logger[_0x0208('0x10')]('VoiceContext,\x20%s,\x20%s',_0x56a859,_0x27b53f);_0x44daee(_0x27b53f);});});} \ No newline at end of file +var _0x1ae4=['error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x1ae4,0x114));var _0x41ae=function(_0x296fd2,_0x32ed7c){_0x296fd2=_0x296fd2-0x0;var _0xf0ff15=_0x1ae4[_0x296fd2];return _0xf0ff15;};'use strict';var _=require(_0x41ae('0x0'));var util=require(_0x41ae('0x1'));var moment=require(_0x41ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x41ae('0x3'));var fs=require('fs');var Redis=require(_0x41ae('0x4'));var db=require(_0x41ae('0x5'))['db'];var utils=require(_0x41ae('0x6'));var logger=require(_0x41ae('0x7'))(_0x41ae('0x8'));var config=require(_0x41ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41ae('0xa')][_0x41ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41ae40,_0x2973bc,_0x533a15){return new BPromise(function(_0x12a66c,_0x4ff3d6){return client[_0x41ae('0xc')](_0x41ae40,_0x533a15)[_0x41ae('0xd')](function(_0x5f1096){logger[_0x41ae('0xe')](_0x41ae('0xf'),_0x2973bc,'request\x20sent');logger[_0x41ae('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2973bc,_0x41ae('0x11'),JSON['stringify'](_0x5f1096));if(_0x5f1096[_0x41ae('0x12')]){if(_0x5f1096[_0x41ae('0x12')]['code']===0x1f4){logger[_0x41ae('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2973bc,_0x5f1096[_0x41ae('0x12')][_0x41ae('0x13')]);return _0x4ff3d6(_0x5f1096[_0x41ae('0x12')][_0x41ae('0x13')]);}logger[_0x41ae('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2973bc,_0x5f1096[_0x41ae('0x12')][_0x41ae('0x13')]);return _0x12a66c(_0x5f1096[_0x41ae('0x12')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x2973bc,'request\x20sent');_0x12a66c(_0x5f1096['result'][_0x41ae('0x13')]);}})[_0x41ae('0x14')](function(_0xbb7986){logger[_0x41ae('0x12')](_0x41ae('0xf'),_0x2973bc,_0xbb7986);_0x4ff3d6(_0xbb7986);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index cf3c906..21a4954 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 _0x8d53=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','describe','/:id','post','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x26bafe,_0x13e506){var _0x307879=function(_0x5a1548){while(--_0x5a1548){_0x26bafe['push'](_0x26bafe['shift']());}};_0x307879(++_0x13e506);}(_0x8d53,0x1c2));var _0x38d5=function(_0x2bd8c1,_0x597e60){_0x2bd8c1=_0x2bd8c1-0x0;var _0x453eb2=_0x8d53[_0x2bd8c1];return _0x453eb2;};'use strict';var multer=require(_0x38d5('0x0'));var util=require(_0x38d5('0x1'));var path=require('path');var timeout=require(_0x38d5('0x2'));var express=require(_0x38d5('0x3'));var router=express[_0x38d5('0x4')]();var fs_extra=require(_0x38d5('0x5'));var auth=require(_0x38d5('0x6'));var interaction=require(_0x38d5('0x7'));var config=require(_0x38d5('0x8'));var controller=require(_0x38d5('0x9'));router['get']('/',auth[_0x38d5('0xa')](),controller[_0x38d5('0xb')]);router[_0x38d5('0xc')]('/describe',auth[_0x38d5('0xa')](),controller[_0x38d5('0xd')]);router[_0x38d5('0xc')](_0x38d5('0xe'),auth[_0x38d5('0xa')](),controller['show']);router[_0x38d5('0xf')]('/',auth[_0x38d5('0xa')](),controller['create']);router[_0x38d5('0x10')](_0x38d5('0xe'),auth[_0x38d5('0xa')](),controller[_0x38d5('0x11')]);router['delete']('/:id',auth[_0x38d5('0xa')](),controller[_0x38d5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x43df=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','util','path','express','Router'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x43df,0x1c8));var _0xf43d=function(_0x59fd31,_0x2b86c2){_0x59fd31=_0x59fd31-0x0;var _0x6f1c16=_0x43df[_0x59fd31];return _0x6f1c16;};'use strict';var multer=require('multer');var util=require(_0xf43d('0x0'));var path=require(_0xf43d('0x1'));var timeout=require('connect-timeout');var express=require(_0xf43d('0x2'));var router=express[_0xf43d('0x3')]();var fs_extra=require(_0xf43d('0x4'));var auth=require(_0xf43d('0x5'));var interaction=require(_0xf43d('0x6'));var config=require(_0xf43d('0x7'));var controller=require(_0xf43d('0x8'));router[_0xf43d('0x9')]('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0xb')]);router[_0xf43d('0x9')](_0xf43d('0xc'),auth['isAuthenticated'](),controller[_0xf43d('0xd')]);router['get'](_0xf43d('0xe'),auth[_0xf43d('0xa')](),controller[_0xf43d('0xf')]);router['post']('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0x10')]);router['put']('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x11')]);router['delete']('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x12')]);module[_0xf43d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 9b8367a..1a4bb35 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x353695,_0x1614f6){var _0x2b0343=function(_0x1f6b77){while(--_0x1f6b77){_0x353695['push'](_0x353695['shift']());}};_0x2b0343(++_0x1614f6);}(_0xedd9,0xfc));var _0x9edd=function(_0x36e22b,_0x12fdc9){_0x36e22b=_0x36e22b-0x0;var _0x41bc3d=_0xedd9[_0x36e22b];return _0x41bc3d;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x369ada,_0x5f4c91){_0x369ada=_0x369ada-0x0;var _0x2c580f=_0x8ef6[_0x369ada];return _0x2c580f;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 48998d5..cd4cdc8 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 _0xc38f=['end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','include','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x48f0a4,_0x31e30f){var _0x1dcd89=function(_0x5876d8){while(--_0x5876d8){_0x48f0a4['push'](_0x48f0a4['shift']());}};_0x1dcd89(++_0x31e30f);}(_0xc38f,0x7c));var _0xfc38=function(_0x453cff,_0x4c3c5f){_0x453cff=_0x453cff-0x0;var _0x53d1eb=_0xc38f[_0x453cff];return _0x53d1eb;};'use strict';var emlformat=require(_0xfc38('0x0'));var rimraf=require(_0xfc38('0x1'));var zipdir=require(_0xfc38('0x2'));var jsonpatch=require(_0xfc38('0x3'));var rp=require(_0xfc38('0x4'));var moment=require(_0xfc38('0x5'));var BPromise=require(_0xfc38('0x6'));var Mustache=require(_0xfc38('0x7'));var util=require(_0xfc38('0x8'));var path=require(_0xfc38('0x9'));var sox=require('sox');var csv=require(_0xfc38('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc38('0xb'));var _=require(_0xfc38('0xc'));var squel=require(_0xfc38('0xd'));var crypto=require(_0xfc38('0xe'));var jsforce=require(_0xfc38('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc38('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc38('0x11'));var authService=require(_0xfc38('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc38('0x13'));var hardwareService=require(_0xfc38('0x14'));var logger=require(_0xfc38('0x15'))(_0xfc38('0x16'));var utils=require('../../config/utils');var config=require(_0xfc38('0x17'));var licenseUtil=require(_0xfc38('0x18'));var db=require(_0xfc38('0x19'))['db'];function respondWithStatusCode(_0x57b771,_0x341591){_0x341591=_0x341591||0xcc;return function(_0x1d93b4){if(_0x1d93b4){return _0x57b771[_0xfc38('0x1a')](_0x341591);}return _0x57b771[_0xfc38('0x1b')](_0x341591)[_0xfc38('0x1c')]();};}function respondWithResult(_0x3bca2d,_0x26776c){_0x26776c=_0x26776c||0xc8;return function(_0x2e7c53){if(_0x2e7c53){return _0x3bca2d[_0xfc38('0x1b')](_0x26776c)[_0xfc38('0x1d')](_0x2e7c53);}};}function respondWithFilteredResult(_0x4737aa,_0x219de6){return function(_0x118a25){if(_0x118a25){var _0x48bf4b=typeof _0x219de6[_0xfc38('0x1e')]==='undefined'&&typeof _0x219de6[_0xfc38('0x1f')]===_0xfc38('0x20');var _0x57f205=_0x118a25[_0xfc38('0x21')];var _0x1f820a=_0x48bf4b?0x0:_0x219de6[_0xfc38('0x1e')];var _0x242e37=_0x48bf4b?_0x118a25['count']:_0x219de6[_0xfc38('0x1e')]+_0x219de6[_0xfc38('0x1f')];var _0x59c6a5;if(_0x242e37>=_0x57f205){_0x242e37=_0x57f205;_0x59c6a5=0xc8;}else{_0x59c6a5=0xce;}_0x4737aa[_0xfc38('0x1b')](_0x59c6a5);return _0x4737aa[_0xfc38('0x22')]('Content-Range',_0x1f820a+'-'+_0x242e37+'/'+_0x57f205)['json'](_0x118a25);}return null;};}function patchUpdates(_0x2de499){return function(_0x48512f){try{jsonpatch[_0xfc38('0x23')](_0x48512f,_0x2de499,!![]);}catch(_0x5553f4){return BPromise[_0xfc38('0x24')](_0x5553f4);}return _0x48512f[_0xfc38('0x25')]();};}function saveUpdates(_0x341ce0,_0x2693b4){return function(_0x278667){if(_0x278667){return _0x278667[_0xfc38('0x26')](_0x341ce0)[_0xfc38('0x27')](function(_0x1e3324){return _0x1e3324;});}return null;};}function removeEntity(_0x427bdb,_0x52c6eb){return function(_0x1820f8){if(_0x1820f8){return _0x1820f8[_0xfc38('0x28')]()[_0xfc38('0x27')](function(){_0x427bdb[_0xfc38('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21fcda,_0x38d21d){return function(_0x4755d2){if(!_0x4755d2){_0x21fcda['sendStatus'](0x194);}return _0x4755d2;};}function handleError(_0x42aee9,_0x497b30){_0x497b30=_0x497b30||0x1f4;return function(_0x359e12){logger['error'](_0x359e12[_0xfc38('0x29')]);if(_0x359e12['name']){delete _0x359e12[_0xfc38('0x2a')];}_0x42aee9['status'](_0x497b30)[_0xfc38('0x2b')](_0x359e12);};}exports[_0xfc38('0x2c')]=function(_0x57bb7c,_0x37e8ea){var _0xd5aba4={},_0xf43ba6={},_0x2e0d38={'count':0x0,'rows':[]};var _0x433cf6=_['map'](db[_0xfc38('0x2d')][_0xfc38('0x2e')],function(_0x31a6e7){return{'name':_0x31a6e7[_0xfc38('0x2f')],'type':_0x31a6e7[_0xfc38('0x30')]['key']};});_0xf43ba6[_0xfc38('0x31')]=_[_0xfc38('0x32')](_0x433cf6,_0xfc38('0x2a'));_0xf43ba6[_0xfc38('0x33')]=_[_0xfc38('0x34')](_0x57bb7c[_0xfc38('0x33')]);_0xf43ba6[_0xfc38('0x35')]=_[_0xfc38('0x36')](_0xf43ba6[_0xfc38('0x31')],_0xf43ba6[_0xfc38('0x33')]);_0xd5aba4[_0xfc38('0x37')]=_['intersection'](_0xf43ba6[_0xfc38('0x31')],qs[_0xfc38('0x38')](_0x57bb7c[_0xfc38('0x33')][_0xfc38('0x38')]));_0xd5aba4[_0xfc38('0x37')]=_0xd5aba4[_0xfc38('0x37')][_0xfc38('0x39')]?_0xd5aba4[_0xfc38('0x37')]:_0xf43ba6[_0xfc38('0x31')];if(!_0x57bb7c['query'][_0xfc38('0x3a')](_0xfc38('0x3b'))){_0xd5aba4[_0xfc38('0x1f')]=qs[_0xfc38('0x1f')](_0x57bb7c['query'][_0xfc38('0x1f')]);_0xd5aba4[_0xfc38('0x1e')]=qs[_0xfc38('0x1e')](_0x57bb7c[_0xfc38('0x33')][_0xfc38('0x1e')]);}_0xd5aba4['order']=qs[_0xfc38('0x3c')](_0x57bb7c[_0xfc38('0x33')][_0xfc38('0x3c')]);_0xd5aba4[_0xfc38('0x3d')]=qs[_0xfc38('0x35')](_[_0xfc38('0x3e')](_0x57bb7c[_0xfc38('0x33')],_0xf43ba6[_0xfc38('0x35')]),_0x433cf6);if(_0x57bb7c[_0xfc38('0x33')][_0xfc38('0x3f')]){_0xd5aba4[_0xfc38('0x3d')]=_[_0xfc38('0x40')](_0xd5aba4[_0xfc38('0x3d')],{'$or':_[_0xfc38('0x32')](_0x433cf6,function(_0x41efda){if(_0x41efda[_0xfc38('0x30')]!==_0xfc38('0x41')){var _0x2efc3e={};_0x2efc3e[_0x41efda[_0xfc38('0x2a')]]={'$like':'%'+_0x57bb7c['query']['filter']+'%'};return _0x2efc3e;}})});}_0xd5aba4=_[_0xfc38('0x40')]({},_0xd5aba4,_0x57bb7c[_0xfc38('0x42')]);var _0x154674={'where':_0xd5aba4[_0xfc38('0x3d')]};return db['VoiceDialReport']['count'](_0x154674)[_0xfc38('0x27')](function(_0x1c102c){_0x2e0d38[_0xfc38('0x21')]=_0x1c102c;if(_0x57bb7c['query'][_0xfc38('0x43')]){_0xd5aba4['include']=[{'all':!![]}];}return db[_0xfc38('0x2d')]['findAll'](_0xd5aba4);})['then'](function(_0x4ec7e5){_0x2e0d38[_0xfc38('0x44')]=_0x4ec7e5;return _0x2e0d38;})[_0xfc38('0x27')](respondWithFilteredResult(_0x37e8ea,_0xd5aba4))['catch'](handleError(_0x37e8ea,null));};exports['show']=function(_0x3e3dae,_0x2e8eac){var _0x46f543={'raw':!![],'where':{'id':_0x3e3dae[_0xfc38('0x45')]['id']}},_0x3d9898={};_0x3d9898['model']=_[_0xfc38('0x34')](db[_0xfc38('0x2d')][_0xfc38('0x2e')]);_0x3d9898[_0xfc38('0x33')]=_[_0xfc38('0x34')](_0x3e3dae['query']);_0x3d9898[_0xfc38('0x35')]=_[_0xfc38('0x36')](_0x3d9898[_0xfc38('0x31')],_0x3d9898[_0xfc38('0x33')]);_0x46f543[_0xfc38('0x37')]=_['intersection'](_0x3d9898[_0xfc38('0x31')],qs[_0xfc38('0x38')](_0x3e3dae[_0xfc38('0x33')][_0xfc38('0x38')]));_0x46f543[_0xfc38('0x37')]=_0x46f543[_0xfc38('0x37')]['length']?_0x46f543[_0xfc38('0x37')]:_0x3d9898[_0xfc38('0x31')];if(_0x3e3dae[_0xfc38('0x33')][_0xfc38('0x43')]){_0x46f543[_0xfc38('0x46')]=[{'all':!![]}];}_0x46f543=_[_0xfc38('0x40')]({},_0x46f543,_0x3e3dae[_0xfc38('0x42')]);return db[_0xfc38('0x2d')]['find'](_0x46f543)[_0xfc38('0x27')](handleEntityNotFound(_0x2e8eac,null))[_0xfc38('0x27')](respondWithResult(_0x2e8eac,null))[_0xfc38('0x47')](handleError(_0x2e8eac,null));};exports['create']=function(_0x53743b,_0x20abfe){return db[_0xfc38('0x2d')][_0xfc38('0x48')](_0x53743b[_0xfc38('0x49')],{})['then'](respondWithResult(_0x20abfe,0xc9))[_0xfc38('0x47')](handleError(_0x20abfe,null));};exports[_0xfc38('0x26')]=function(_0x2951e2,_0x548feb){if(_0x2951e2[_0xfc38('0x49')]['id']){delete _0x2951e2[_0xfc38('0x49')]['id'];}return db[_0xfc38('0x2d')][_0xfc38('0x4a')]({'where':{'id':_0x2951e2['params']['id']}})[_0xfc38('0x27')](handleEntityNotFound(_0x548feb,null))['then'](saveUpdates(_0x2951e2['body'],null))['then'](respondWithResult(_0x548feb,null))[_0xfc38('0x47')](handleError(_0x548feb,null));};exports[_0xfc38('0x28')]=function(_0x16d384,_0x3250d6){return db[_0xfc38('0x2d')][_0xfc38('0x4a')]({'where':{'id':_0x16d384['params']['id']}})[_0xfc38('0x27')](handleEntityNotFound(_0x3250d6,null))['then'](removeEntity(_0x3250d6,null))[_0xfc38('0x47')](handleError(_0x3250d6,null));};exports[_0xfc38('0x4b')]=function(_0x50874a,_0x13cee5){return db[_0xfc38('0x2d')][_0xfc38('0x4b')]()[_0xfc38('0x27')](respondWithResult(_0x13cee5,null))['catch'](handleError(_0x13cee5,null));}; \ No newline at end of file +var _0x489f=['key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','VoiceDialReport','catch','show','params','keys','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x46fdbb,_0x217295){var _0x219d7e=function(_0x1350b8){while(--_0x1350b8){_0x46fdbb['push'](_0x46fdbb['shift']());}};_0x219d7e(++_0x217295);}(_0x489f,0x65));var _0xf489=function(_0x39c1d2,_0x5c6879){_0x39c1d2=_0x39c1d2-0x0;var _0x5934b8=_0x489f[_0x39c1d2];return _0x5934b8;};'use strict';var emlformat=require(_0xf489('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf489('0x1'));var jsonpatch=require(_0xf489('0x2'));var rp=require(_0xf489('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf489('0x4'));var util=require('util');var path=require(_0xf489('0x5'));var sox=require(_0xf489('0x6'));var csv=require('to-csv');var ejs=require(_0xf489('0x7'));var fs=require('fs');var fs_extra=require(_0xf489('0x8'));var _=require(_0xf489('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf489('0xa'));var deskjs=require(_0xf489('0xb'));var toCsv=require(_0xf489('0xc'));var querystring=require(_0xf489('0xd'));var Papa=require('papaparse');var Redis=require(_0xf489('0xe'));var authService=require(_0xf489('0xf'));var qs=require(_0xf489('0x10'));var as=require(_0xf489('0x11'));var hardwareService=require(_0xf489('0x12'));var logger=require(_0xf489('0x13'))(_0xf489('0x14'));var utils=require(_0xf489('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf489('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd8d2,_0x3ce411){_0x3ce411=_0x3ce411||0xcc;return function(_0x1785f9){if(_0x1785f9){return _0x5cd8d2[_0xf489('0x17')](_0x3ce411);}return _0x5cd8d2[_0xf489('0x18')](_0x3ce411)['end']();};}function respondWithResult(_0x5a1e61,_0x529bf0){_0x529bf0=_0x529bf0||0xc8;return function(_0x3c9747){if(_0x3c9747){return _0x5a1e61['status'](_0x529bf0)[_0xf489('0x19')](_0x3c9747);}};}function respondWithFilteredResult(_0x321158,_0x30d284){return function(_0x4422a8){if(_0x4422a8){var _0x3bc1c1=typeof _0x30d284['offset']===_0xf489('0x1a')&&typeof _0x30d284[_0xf489('0x1b')]===_0xf489('0x1a');var _0x41641c=_0x4422a8[_0xf489('0x1c')];var _0x15cb66=_0x3bc1c1?0x0:_0x30d284[_0xf489('0x1d')];var _0x3cbabf=_0x3bc1c1?_0x4422a8[_0xf489('0x1c')]:_0x30d284[_0xf489('0x1d')]+_0x30d284[_0xf489('0x1b')];var _0x5214e8;if(_0x3cbabf>=_0x41641c){_0x3cbabf=_0x41641c;_0x5214e8=0xc8;}else{_0x5214e8=0xce;}_0x321158['status'](_0x5214e8);return _0x321158[_0xf489('0x1e')](_0xf489('0x1f'),_0x15cb66+'-'+_0x3cbabf+'/'+_0x41641c)['json'](_0x4422a8);}return null;};}function patchUpdates(_0x3ac2d5){return function(_0xed4220){try{jsonpatch['apply'](_0xed4220,_0x3ac2d5,!![]);}catch(_0x4275ba){return BPromise[_0xf489('0x20')](_0x4275ba);}return _0xed4220[_0xf489('0x21')]();};}function saveUpdates(_0x2ed708,_0x3b58d3){return function(_0x10e8ed){if(_0x10e8ed){return _0x10e8ed[_0xf489('0x22')](_0x2ed708)[_0xf489('0x23')](function(_0x47a986){return _0x47a986;});}return null;};}function removeEntity(_0x1f7eed,_0x27d61b){return function(_0x2527e3){if(_0x2527e3){return _0x2527e3['destroy']()[_0xf489('0x23')](function(){_0x1f7eed['status'](0xcc)[_0xf489('0x24')]();});}};}function handleEntityNotFound(_0x2d3f0d,_0x5b3f89){return function(_0x144ad6){if(!_0x144ad6){_0x2d3f0d[_0xf489('0x17')](0x194);}return _0x144ad6;};}function handleError(_0x32b1e9,_0x3c4f6a){_0x3c4f6a=_0x3c4f6a||0x1f4;return function(_0x378efb){logger[_0xf489('0x25')](_0x378efb[_0xf489('0x26')]);if(_0x378efb[_0xf489('0x27')]){delete _0x378efb[_0xf489('0x27')];}_0x32b1e9[_0xf489('0x18')](_0x3c4f6a)[_0xf489('0x28')](_0x378efb);};}exports[_0xf489('0x29')]=function(_0x19f9dd,_0x3c9095){var _0x4c3970={},_0x5cd660={},_0x3b4d56={'count':0x0,'rows':[]};var _0x201bed=_[_0xf489('0x2a')](db['VoiceDialReport'][_0xf489('0x2b')],function(_0x797a83){return{'name':_0x797a83['fieldName'],'type':_0x797a83[_0xf489('0x2c')][_0xf489('0x2d')]};});_0x5cd660[_0xf489('0x2e')]=_[_0xf489('0x2a')](_0x201bed,_0xf489('0x27'));_0x5cd660[_0xf489('0x2f')]=_['keys'](_0x19f9dd[_0xf489('0x2f')]);_0x5cd660['filters']=_[_0xf489('0x30')](_0x5cd660['model'],_0x5cd660[_0xf489('0x2f')]);_0x4c3970[_0xf489('0x31')]=_[_0xf489('0x30')](_0x5cd660['model'],qs[_0xf489('0x32')](_0x19f9dd[_0xf489('0x2f')]['fields']));_0x4c3970[_0xf489('0x31')]=_0x4c3970[_0xf489('0x31')][_0xf489('0x33')]?_0x4c3970[_0xf489('0x31')]:_0x5cd660[_0xf489('0x2e')];if(!_0x19f9dd[_0xf489('0x2f')][_0xf489('0x34')]('nolimit')){_0x4c3970[_0xf489('0x1b')]=qs[_0xf489('0x1b')](_0x19f9dd[_0xf489('0x2f')][_0xf489('0x1b')]);_0x4c3970[_0xf489('0x1d')]=qs[_0xf489('0x1d')](_0x19f9dd[_0xf489('0x2f')][_0xf489('0x1d')]);}_0x4c3970[_0xf489('0x35')]=qs[_0xf489('0x36')](_0x19f9dd[_0xf489('0x2f')][_0xf489('0x36')]);_0x4c3970['where']=qs[_0xf489('0x37')](_[_0xf489('0x38')](_0x19f9dd['query'],_0x5cd660['filters']),_0x201bed);if(_0x19f9dd[_0xf489('0x2f')][_0xf489('0x39')]){_0x4c3970[_0xf489('0x3a')]=_['merge'](_0x4c3970[_0xf489('0x3a')],{'$or':_['map'](_0x201bed,function(_0x40fa0d){if(_0x40fa0d[_0xf489('0x2c')]!==_0xf489('0x3b')){var _0x553f08={};_0x553f08[_0x40fa0d[_0xf489('0x27')]]={'$like':'%'+_0x19f9dd[_0xf489('0x2f')]['filter']+'%'};return _0x553f08;}})});}_0x4c3970=_[_0xf489('0x3c')]({},_0x4c3970,_0x19f9dd[_0xf489('0x3d')]);var _0x4e4100={'where':_0x4c3970[_0xf489('0x3a')]};return db['VoiceDialReport'][_0xf489('0x1c')](_0x4e4100)[_0xf489('0x23')](function(_0x55e0cd){_0x3b4d56[_0xf489('0x1c')]=_0x55e0cd;if(_0x19f9dd[_0xf489('0x2f')][_0xf489('0x3e')]){_0x4c3970[_0xf489('0x3f')]=[{'all':!![]}];}return db[_0xf489('0x40')]['findAll'](_0x4c3970);})[_0xf489('0x23')](function(_0x186312){_0x3b4d56['rows']=_0x186312;return _0x3b4d56;})['then'](respondWithFilteredResult(_0x3c9095,_0x4c3970))[_0xf489('0x41')](handleError(_0x3c9095,null));};exports[_0xf489('0x42')]=function(_0x2b2474,_0x579fdd){var _0x2523ac={'raw':!![],'where':{'id':_0x2b2474[_0xf489('0x43')]['id']}},_0x566e3a={};_0x566e3a[_0xf489('0x2e')]=_[_0xf489('0x44')](db[_0xf489('0x40')][_0xf489('0x2b')]);_0x566e3a[_0xf489('0x2f')]=_[_0xf489('0x44')](_0x2b2474['query']);_0x566e3a['filters']=_[_0xf489('0x30')](_0x566e3a[_0xf489('0x2e')],_0x566e3a[_0xf489('0x2f')]);_0x2523ac[_0xf489('0x31')]=_[_0xf489('0x30')](_0x566e3a[_0xf489('0x2e')],qs[_0xf489('0x32')](_0x2b2474[_0xf489('0x2f')][_0xf489('0x32')]));_0x2523ac[_0xf489('0x31')]=_0x2523ac[_0xf489('0x31')]['length']?_0x2523ac[_0xf489('0x31')]:_0x566e3a[_0xf489('0x2e')];if(_0x2b2474['query'][_0xf489('0x3e')]){_0x2523ac[_0xf489('0x3f')]=[{'all':!![]}];}_0x2523ac=_[_0xf489('0x3c')]({},_0x2523ac,_0x2b2474['options']);return db[_0xf489('0x40')]['find'](_0x2523ac)[_0xf489('0x23')](handleEntityNotFound(_0x579fdd,null))[_0xf489('0x23')](respondWithResult(_0x579fdd,null))[_0xf489('0x41')](handleError(_0x579fdd,null));};exports[_0xf489('0x45')]=function(_0x42458f,_0x30247e){return db[_0xf489('0x40')][_0xf489('0x45')](_0x42458f['body'],{})[_0xf489('0x23')](respondWithResult(_0x30247e,0xc9))[_0xf489('0x41')](handleError(_0x30247e,null));};exports[_0xf489('0x22')]=function(_0x44f34b,_0x3b7969){if(_0x44f34b['body']['id']){delete _0x44f34b[_0xf489('0x46')]['id'];}return db[_0xf489('0x40')]['find']({'where':{'id':_0x44f34b[_0xf489('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b7969,null))[_0xf489('0x23')](saveUpdates(_0x44f34b[_0xf489('0x46')],null))[_0xf489('0x23')](respondWithResult(_0x3b7969,null))[_0xf489('0x41')](handleError(_0x3b7969,null));};exports[_0xf489('0x47')]=function(_0x3a8cf0,_0x5c3be9){return db[_0xf489('0x40')]['find']({'where':{'id':_0x3a8cf0[_0xf489('0x43')]['id']}})[_0xf489('0x23')](handleEntityNotFound(_0x5c3be9,null))[_0xf489('0x23')](removeEntity(_0x5c3be9,null))[_0xf489('0x41')](handleError(_0x5c3be9,null));};exports[_0xf489('0x48')]=function(_0xc9484f,_0x27b738){return db[_0xf489('0x40')]['describe']()[_0xf489('0x23')](respondWithResult(_0x27b738,null))[_0xf489('0x41')](handleError(_0x27b738,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ed2c00e..da27830 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 _0x84cc=['../../config/logger','api','moment','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x742760,_0x276fd9){var _0x53eeab=function(_0x35d7f2){while(--_0x35d7f2){_0x742760['push'](_0x742760['shift']());}};_0x53eeab(++_0x276fd9);}(_0x84cc,0x1c6));var _0xc84c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x84cc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc84c('0x0'));var util=require('util');var logger=require(_0xc84c('0x1'))(_0xc84c('0x2'));var moment=require(_0xc84c('0x3'));var BPromise=require('bluebird');var rp=require(_0xc84c('0x4'));var fs=require('fs');var path=require(_0xc84c('0x5'));var rimraf=require(_0xc84c('0x6'));var config=require('../../config/environment');var attributes=require(_0xc84c('0x7'));module[_0xc84c('0x8')]=function(_0x380513,_0x14d391){return _0x380513[_0xc84c('0x9')](_0xc84c('0xa'),attributes,{'tableName':_0xc84c('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc84c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0160=['define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x37f181,_0x34c4ea){var _0x4149a9=function(_0x418e46){while(--_0x418e46){_0x37f181['push'](_0x37f181['shift']());}};_0x4149a9(++_0x34c4ea);}(_0x0160,0x16c));var _0x0016=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0x0160[_0x37ded3];return _0x51e49e;};'use strict';var _=require('lodash');var util=require(_0x0016('0x0'));var logger=require(_0x0016('0x1'))(_0x0016('0x2'));var moment=require(_0x0016('0x3'));var BPromise=require(_0x0016('0x4'));var rp=require(_0x0016('0x5'));var fs=require('fs');var path=require(_0x0016('0x6'));var rimraf=require(_0x0016('0x7'));var config=require(_0x0016('0x8'));var attributes=require(_0x0016('0x9'));module[_0x0016('0xa')]=function(_0x20ffe3,_0x5e54a2){return _0x20ffe3[_0x0016('0xb')](_0x0016('0xc'),attributes,{'tableName':_0x0016('0xd'),'paranoid':![],'indexes':[{'fields':[_0x0016('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 72a48b0..326fea3 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 _0x4886=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','then','UpdateVoiceDialReport','body','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x57d96e,_0x1714ec){var _0x3d70cd=function(_0x1d3f22){while(--_0x1d3f22){_0x57d96e['push'](_0x57d96e['shift']());}};_0x3d70cd(++_0x1714ec);}(_0x4886,0x84));var _0x6488=function(_0x3994a2,_0x164239){_0x3994a2=_0x3994a2-0x0;var _0x5a1e21=_0x4886[_0x3994a2];return _0x5a1e21;};'use strict';var _=require(_0x6488('0x0'));var util=require(_0x6488('0x1'));var moment=require('moment');var BPromise=require(_0x6488('0x2'));var rs=require(_0x6488('0x3'));var fs=require('fs');var Redis=require(_0x6488('0x4'));var db=require(_0x6488('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6488('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6488('0x7'));var client=jayson['client'][_0x6488('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41dd23,_0x1371f7,_0x2eb3fc){return new BPromise(function(_0x2f516c,_0x4d9584){return client[_0x6488('0x9')](_0x41dd23,_0x2eb3fc)['then'](function(_0x40906f){logger[_0x6488('0xa')](_0x6488('0xb'),_0x1371f7,_0x6488('0xc'));logger[_0x6488('0xd')](_0x6488('0xe'),_0x1371f7,'request\x20sent',JSON[_0x6488('0xf')](_0x40906f));if(_0x40906f[_0x6488('0x10')]){if(_0x40906f[_0x6488('0x10')][_0x6488('0x11')]===0x1f4){logger['error'](_0x6488('0xb'),_0x1371f7,_0x40906f[_0x6488('0x10')]['message']);return _0x4d9584(_0x40906f[_0x6488('0x10')][_0x6488('0x12')]);}logger[_0x6488('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x1371f7,_0x40906f[_0x6488('0x10')]['message']);return _0x2f516c(_0x40906f[_0x6488('0x10')][_0x6488('0x12')]);}else{logger[_0x6488('0xa')](_0x6488('0xb'),_0x1371f7,_0x6488('0xc'));_0x2f516c(_0x40906f['result'][_0x6488('0x12')]);}})[_0x6488('0x13')](function(_0x3a7c3d){logger['error'](_0x6488('0xb'),_0x1371f7,_0x3a7c3d);_0x4d9584(_0x3a7c3d);});});}exports[_0x6488('0x14')]=function(_0x2e1cd4){var _0x23c510=this;return new Promise(function(_0x10d8aa,_0xb002c8){return db[_0x6488('0x15')]['create'](_0x2e1cd4['body'],{'raw':_0x2e1cd4['options']?_0x2e1cd4[_0x6488('0x16')][_0x6488('0x17')]===undefined?!![]:![]:!![]})[_0x6488('0x18')](function(_0x16f2fd){logger[_0x6488('0xa')](_0x6488('0x14'),_0x2e1cd4);logger['debug']('CreateVoiceDialReport',_0x2e1cd4,JSON[_0x6488('0xf')](_0x16f2fd));_0x10d8aa(_0x16f2fd);})[_0x6488('0x13')](function(_0x2654f1){logger['error'](_0x6488('0x14'),_0x2654f1[_0x6488('0x12')],_0x2e1cd4);_0xb002c8(_0x23c510[_0x6488('0x10')](0x1f4,_0x2654f1[_0x6488('0x12')]));});});};exports[_0x6488('0x19')]=function(_0x455256){var _0x58235e=this;return new Promise(function(_0x169977,_0x330e43){return db[_0x6488('0x15')]['update'](_0x455256[_0x6488('0x1a')],{'raw':_0x455256['options']?_0x455256[_0x6488('0x16')][_0x6488('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x455256['options']?_0x455256[_0x6488('0x16')]['where']||null:null,'attributes':_0x455256[_0x6488('0x16')]?_0x455256[_0x6488('0x16')][_0x6488('0x1b')]||null:null,'limit':_0x455256[_0x6488('0x16')]?_0x455256[_0x6488('0x16')][_0x6488('0x1c')]||null:null})[_0x6488('0x18')](function(_0x4a65a3){logger[_0x6488('0xa')](_0x6488('0x19'),_0x455256);logger[_0x6488('0xd')](_0x6488('0x19'),_0x455256,JSON[_0x6488('0xf')](_0x4a65a3));_0x169977(_0x4a65a3);})['catch'](function(_0x927fc0){logger[_0x6488('0x10')]('UpdateVoiceDialReport',_0x927fc0[_0x6488('0x12')],_0x455256);_0x330e43(_0x58235e[_0x6488('0x10')](0x1f4,_0x927fc0['message']));});});}; \ No newline at end of file +var _0x482b=['error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','where','attributes','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x460f7d,_0x77abbd){var _0x5ac693=function(_0x202431){while(--_0x202431){_0x460f7d['push'](_0x460f7d['shift']());}};_0x5ac693(++_0x77abbd);}(_0x482b,0x163));var _0xb482=function(_0x5e6dda,_0x597bd4){_0x5e6dda=_0x5e6dda-0x0;var _0x56d46e=_0x482b[_0x5e6dda];return _0x56d46e;};'use strict';var _=require(_0xb482('0x0'));var util=require(_0xb482('0x1'));var moment=require(_0xb482('0x2'));var BPromise=require(_0xb482('0x3'));var rs=require(_0xb482('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb482('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb482('0x6'))('rpc');var config=require(_0xb482('0x7'));var jayson=require(_0xb482('0x8'));var client=jayson['client'][_0xb482('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2782fb,_0x125a84,_0x12b96f){return new BPromise(function(_0x15b94d,_0x56d63f){return client[_0xb482('0xa')](_0x2782fb,_0x12b96f)[_0xb482('0xb')](function(_0x1fa84e){logger[_0xb482('0xc')](_0xb482('0xd'),_0x125a84,_0xb482('0xe'));logger['debug'](_0xb482('0xf'),_0x125a84,'request\x20sent',JSON[_0xb482('0x10')](_0x1fa84e));if(_0x1fa84e[_0xb482('0x11')]){if(_0x1fa84e['error']['code']===0x1f4){logger['error'](_0xb482('0xd'),_0x125a84,_0x1fa84e['error'][_0xb482('0x12')]);return _0x56d63f(_0x1fa84e[_0xb482('0x11')][_0xb482('0x12')]);}logger[_0xb482('0x11')](_0xb482('0xd'),_0x125a84,_0x1fa84e[_0xb482('0x11')][_0xb482('0x12')]);return _0x15b94d(_0x1fa84e[_0xb482('0x11')][_0xb482('0x12')]);}else{logger[_0xb482('0xc')](_0xb482('0xd'),_0x125a84,'request\x20sent');_0x15b94d(_0x1fa84e[_0xb482('0x13')]['message']);}})[_0xb482('0x14')](function(_0x1219a1){logger[_0xb482('0x11')](_0xb482('0xd'),_0x125a84,_0x1219a1);_0x56d63f(_0x1219a1);});});}exports[_0xb482('0x15')]=function(_0x436fa2){var _0x135238=this;return new Promise(function(_0x299a3a,_0x2fc3be){return db[_0xb482('0x16')]['create'](_0x436fa2[_0xb482('0x17')],{'raw':_0x436fa2[_0xb482('0x18')]?_0x436fa2[_0xb482('0x18')][_0xb482('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5c4a2e){logger[_0xb482('0xc')](_0xb482('0x15'),_0x436fa2);logger['debug'](_0xb482('0x15'),_0x436fa2,JSON['stringify'](_0x5c4a2e));_0x299a3a(_0x5c4a2e);})[_0xb482('0x14')](function(_0xe6a70d){logger[_0xb482('0x11')](_0xb482('0x15'),_0xe6a70d[_0xb482('0x12')],_0x436fa2);_0x2fc3be(_0x135238['error'](0x1f4,_0xe6a70d[_0xb482('0x12')]));});});};exports[_0xb482('0x1a')]=function(_0x458a45){var _0x20f1a0=this;return new Promise(function(_0x39ce33,_0x10dfbd){return db[_0xb482('0x16')][_0xb482('0x1b')](_0x458a45[_0xb482('0x17')],{'raw':_0x458a45['options']?_0x458a45[_0xb482('0x18')][_0xb482('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x458a45[_0xb482('0x18')]?_0x458a45[_0xb482('0x18')][_0xb482('0x1c')]||null:null,'attributes':_0x458a45[_0xb482('0x18')]?_0x458a45[_0xb482('0x18')][_0xb482('0x1d')]||null:null,'limit':_0x458a45[_0xb482('0x18')]?_0x458a45[_0xb482('0x18')]['limit']||null:null})[_0xb482('0xb')](function(_0x3b08d8){logger['info']('UpdateVoiceDialReport',_0x458a45);logger[_0xb482('0x1e')](_0xb482('0x1a'),_0x458a45,JSON['stringify'](_0x3b08d8));_0x39ce33(_0x3b08d8);})[_0xb482('0x14')](function(_0x1ec2fe){logger[_0xb482('0x11')](_0xb482('0x1a'),_0x1ec2fe['message'],_0x458a45);_0x10dfbd(_0x20f1a0['error'](0x1f4,_0x1ec2fe[_0xb482('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 96cbf68..a997165 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 _0xd43a=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id','show','post','/:id/applications','addApplications','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3e0405,_0x29dddc){var _0x153edb=function(_0x2d3131){while(--_0x2d3131){_0x3e0405['push'](_0x3e0405['shift']());}};_0x153edb(++_0x29dddc);}(_0xd43a,0xf1));var _0xad43=function(_0x5442ee,_0x5381f4){_0x5442ee=_0x5442ee-0x0;var _0x217b52=_0xd43a[_0x5442ee];return _0x217b52;};'use strict';var multer=require('multer');var util=require(_0xad43('0x0'));var path=require(_0xad43('0x1'));var timeout=require(_0xad43('0x2'));var express=require('express');var router=express[_0xad43('0x3')]();var fs_extra=require(_0xad43('0x4'));var auth=require(_0xad43('0x5'));var interaction=require(_0xad43('0x6'));var config=require(_0xad43('0x7'));var controller=require(_0xad43('0x8'));router['get']('/',auth[_0xad43('0x9')](),controller[_0xad43('0xa')]);router[_0xad43('0xb')](_0xad43('0xc'),auth['isAuthenticated'](),controller[_0xad43('0xd')]);router[_0xad43('0xe')]('/',auth[_0xad43('0x9')](),controller['create']);router[_0xad43('0xe')](_0xad43('0xf'),auth[_0xad43('0x9')](),controller[_0xad43('0x10')]);router['put'](_0xad43('0xc'),auth['isAuthenticated'](),controller[_0xad43('0x11')]);router['delete'](_0xad43('0xc'),auth[_0xad43('0x9')](),controller[_0xad43('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc102=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','put','update','delete','exports','multer','util','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc102,0xba));var _0x2c10=function(_0x13e7fc,_0x5df5ee){_0x13e7fc=_0x13e7fc-0x0;var _0x407fdf=_0xc102[_0x13e7fc];return _0x407fdf;};'use strict';var multer=require(_0x2c10('0x0'));var util=require(_0x2c10('0x1'));var path=require(_0x2c10('0x2'));var timeout=require(_0x2c10('0x3'));var express=require(_0x2c10('0x4'));var router=express[_0x2c10('0x5')]();var fs_extra=require(_0x2c10('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2c10('0x7'));var config=require('../../config/environment');var controller=require(_0x2c10('0x8'));router[_0x2c10('0x9')]('/',auth['isAuthenticated'](),controller[_0x2c10('0xa')]);router[_0x2c10('0x9')](_0x2c10('0xb'),auth[_0x2c10('0xc')](),controller[_0x2c10('0xd')]);router[_0x2c10('0xe')]('/',auth['isAuthenticated'](),controller[_0x2c10('0xf')]);router[_0x2c10('0xe')](_0x2c10('0x10'),auth[_0x2c10('0xc')](),controller['addApplications']);router[_0x2c10('0x11')]('/:id',auth[_0x2c10('0xc')](),controller[_0x2c10('0x12')]);router[_0x2c10('0x13')](_0x2c10('0xb'),auth[_0x2c10('0xc')](),controller['destroy']);module[_0x2c10('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 25d5248..5b874bc 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 _0x9c6c=['STRING','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exten','sequelize','exports','compositeIndex'];(function(_0x3ef0f1,_0x589773){var _0x131dea=function(_0x3cfc49){while(--_0x3cfc49){_0x3ef0f1['push'](_0x3ef0f1['shift']());}};_0x131dea(++_0x589773);}(_0x9c6c,0x1ea));var _0xc9c6=function(_0x50a860,_0x1526f3){_0x50a860=_0x50a860-0x0;var _0x5b2cba=_0x9c6c[_0x50a860];return _0x5b2cba;};'use strict';var Sequelize=require(_0xc9c6('0x0'));module[_0xc9c6('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc9c6('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc9c6('0x2')},'priority':{'type':Sequelize[_0xc9c6('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xc9c6('0x2')},'tag':{'type':Sequelize[_0xc9c6('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc9c6('0x3')],'allowNull':![],'defaultValue':_0xc9c6('0x4')},'appdata':{'type':Sequelize[_0xc9c6('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc9c6('0x5')]('inbound',_0xc9c6('0x6'),_0xc9c6('0x7'),_0xc9c6('0x8'),_0xc9c6('0x9'),'system',_0xc9c6('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xc9c6('0x3')]},'interval':{'type':Sequelize[_0xc9c6('0x3')],'allowNull':![],'defaultValue':_0xc9c6('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc9c6('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc9c6('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc9c6('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc9c6('0xd')]},'recordingFormat':{'type':Sequelize[_0xc9c6('0x3')],'defaultValue':_0xc9c6('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3b133d){return this[_0xc9c6('0xf')](_0xc9c6('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x9edb=['INTEGER','BOOLEAN','wav','VIRTUAL','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','inbound-fax','outbound-fax','any'];(function(_0x804ab1,_0x3a981e){var _0x757879=function(_0x191b29){while(--_0x191b29){_0x804ab1['push'](_0x804ab1['shift']());}};_0x757879(++_0x3a981e);}(_0x9edb,0x154));var _0xb9ed=function(_0x4ef666,_0x1ecac8){_0x4ef666=_0x4ef666-0x0;var _0x1ffa9f=_0x9edb[_0x4ef666];return _0x1ffa9f;};'use strict';var Sequelize=require(_0xb9ed('0x0'));module[_0xb9ed('0x1')]={'context':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb9ed('0x3')},'priority':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xb9ed('0x3')},'tag':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':![],'defaultValue':_0xb9ed('0x4')},'appdata':{'type':Sequelize[_0xb9ed('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xb9ed('0x5'),_0xb9ed('0x6'),'internal',_0xb9ed('0x7'),_0xb9ed('0x8'),'system',_0xb9ed('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xb9ed('0xa')]},'isApp':{'type':Sequelize[_0xb9ed('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb9ed('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xb9ed('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb9ed('0xc')},'answer':{'type':Sequelize[_0xb9ed('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb9ed('0xd')],'get':function(_0x2519f8){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xb9ed('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 6278841..1125604 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 _0x9ff7=['localhost','socket.io-emitter','register','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','end','sendStatus','error','index','VoiceExtension','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','send','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x21f42d,_0x33564f){var _0x217ed7=function(_0x3c58e6){while(--_0x3c58e6){_0x21f42d['push'](_0x21f42d['shift']());}};_0x217ed7(++_0x33564f);}(_0x9ff7,0x16c));var _0x79ff=function(_0x21b25e,_0x34615f){_0x21b25e=_0x21b25e-0x0;var _0x5c2008=_0x9ff7[_0x21b25e];return _0x5c2008;};'use strict';var _=require(_0x79ff('0x0'));var Redis=require(_0x79ff('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x79ff('0x2'))(_0x79ff('0x3'));var config=require(_0x79ff('0x4'));var db=require(_0x79ff('0x5'))['db'];config['redis']=_[_0x79ff('0x6')](config[_0x79ff('0x7')],{'host':_0x79ff('0x8'),'port':0x18eb});var socket=require(_0x79ff('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x79ff('0xa')](socket);function respondWithStatusCode(_0x5d879d,_0x5c27f7){_0x5c27f7=_0x5c27f7||0xcc;return function(_0x260bbf){if(_0x260bbf){return _0x5d879d['sendStatus'](_0x5c27f7);}return _0x5d879d[_0x79ff('0xb')](_0x5c27f7)['end']();};}function respondWithResult(_0x1638b8,_0x990ee7){_0x990ee7=_0x990ee7||0xc8;return function(_0x28b20e){if(_0x28b20e){return _0x1638b8[_0x79ff('0xb')](_0x990ee7)[_0x79ff('0xc')](_0x28b20e);}};}function respondWithFilteredResult(_0x5f3945,_0x7b58d9){return function(_0x5599b4){if(_0x5599b4){var _0x185b44=typeof _0x7b58d9[_0x79ff('0xd')]==='undefined'&&typeof _0x7b58d9[_0x79ff('0xe')]===_0x79ff('0xf');var _0x1a57b0=_0x5599b4[_0x79ff('0x10')];var _0x25b3fc=_0x185b44?0x0:_0x7b58d9['offset'];var _0x5b81c6=_0x185b44?_0x5599b4[_0x79ff('0x10')]:_0x7b58d9[_0x79ff('0xd')]+_0x7b58d9['limit'];var _0x32186a;if(_0x5b81c6>=_0x1a57b0){_0x5b81c6=_0x1a57b0;_0x32186a=0xc8;}else{_0x32186a=0xce;}_0x5f3945[_0x79ff('0xb')](_0x32186a);return _0x5f3945[_0x79ff('0x11')](_0x79ff('0x12'),_0x25b3fc+'-'+_0x5b81c6+'/'+_0x1a57b0)[_0x79ff('0xc')](_0x5599b4);}return null;};}function removeEntity(_0x9ab1fa){return function(_0x433f27){if(_0x433f27){return _0x433f27[_0x79ff('0x13')]()[_0x79ff('0x14')](function(){var _0x3efd02=_0x433f27[_0x79ff('0x15')]({'plain':!![]});var _0x3af6b2=[{'name':_0x79ff('0x16'),'value':_0x79ff('0x17'),'ignore':![]},{'name':_0x79ff('0x18'),'value':_0x79ff('0x19'),'ignore':![]},{'name':_0x79ff('0x1a'),'value':_0x79ff('0x1b'),'ignore':![]}];var _0x5823ac=_(_0x3af6b2)[_0x79ff('0x1c')](_0x79ff('0x1d'))[_0x79ff('0x1e')](_0x79ff('0x1f'))[_0x79ff('0x1f')]();if(_['includes'](_0x5823ac,_0x3efd02[_0x79ff('0x20')])){return;}var _0x52b535=_[_0x79ff('0x21')](_0x3af6b2,[_0x79ff('0x1f'),_0x3efd02[_0x79ff('0x20')]])[_0x79ff('0x22')];return db[_0x79ff('0x23')]['destroy']({'where':{'type':_0x52b535,'resourceId':_0x3efd02['id']}})[_0x79ff('0x14')](function(){return _0x433f27;});})['then'](function(){_0x9ab1fa[_0x79ff('0xb')](0xcc)[_0x79ff('0x24')]();});}};}function handleEntityNotFound(_0x367166){return function(_0x4810c4){if(!_0x4810c4){_0x367166[_0x79ff('0x25')](0x194);}return _0x4810c4;};}function handleError(_0x191041,_0x41ac37){_0x41ac37=_0x41ac37||0x1f4;return function(_0x100dbc){logger[_0x79ff('0x26')](_0x100dbc['stack']);if(_0x100dbc[_0x79ff('0x22')]){delete _0x100dbc[_0x79ff('0x22')];}_0x191041[_0x79ff('0xb')](_0x41ac37)['send'](_0x100dbc);};}exports[_0x79ff('0x27')]=function(_0xaf6f3d,_0x896d82){var _0x5710eb={},_0x387b19={},_0x571024={'count':0x0,'rows':[]};var _0x239d3d=_[_0x79ff('0x1e')](db[_0x79ff('0x28')][_0x79ff('0x29')],function(_0x2cc9e5){return{'name':_0x2cc9e5['fieldName'],'type':_0x2cc9e5[_0x79ff('0x20')][_0x79ff('0x2a')]};});_0x387b19[_0x79ff('0x2b')]=_[_0x79ff('0x1e')](_0x239d3d,_0x79ff('0x22'));_0x387b19['query']=_[_0x79ff('0x2c')](_0xaf6f3d[_0x79ff('0x2d')]);_0x387b19[_0x79ff('0x2e')]=_[_0x79ff('0x2f')](_0x387b19[_0x79ff('0x2b')],_0x387b19['query']);_0x5710eb['attributes']=_[_0x79ff('0x2f')](_0x387b19[_0x79ff('0x2b')],qs[_0x79ff('0x30')](_0xaf6f3d['query']['fields']));_0x5710eb['attributes']=_0x5710eb[_0x79ff('0x31')]['length']?_0x5710eb[_0x79ff('0x31')]:_0x387b19[_0x79ff('0x2b')];if(!_0xaf6f3d['query']['hasOwnProperty'](_0x79ff('0x32'))){_0x5710eb[_0x79ff('0xe')]=qs['limit'](_0xaf6f3d['query'][_0x79ff('0xe')]);_0x5710eb[_0x79ff('0xd')]=qs[_0x79ff('0xd')](_0xaf6f3d[_0x79ff('0x2d')][_0x79ff('0xd')]);}_0x5710eb[_0x79ff('0x33')]=qs['sort'](_0xaf6f3d['query'][_0x79ff('0x34')]);_0x5710eb['where']=qs[_0x79ff('0x2e')](_[_0x79ff('0x35')](_0xaf6f3d[_0x79ff('0x2d')],_0x387b19['filters']),_0x239d3d);if(_0xaf6f3d[_0x79ff('0x2d')][_0x79ff('0x1c')]){_0x5710eb[_0x79ff('0x36')]=_['merge'](_0x5710eb[_0x79ff('0x36')],{'$or':_[_0x79ff('0x1e')](_0x239d3d,function(_0x20286d){if(_0x20286d[_0x79ff('0x20')]!=='VIRTUAL'){var _0x562f56={};_0x562f56[_0x20286d[_0x79ff('0x22')]]={'$like':'%'+_0xaf6f3d['query']['filter']+'%'};return _0x562f56;}})});}_0x5710eb=_[_0x79ff('0x37')]({},_0x5710eb,_0xaf6f3d[_0x79ff('0x38')]);var _0x49c915={'where':_0x5710eb[_0x79ff('0x36')]};return db[_0x79ff('0x28')][_0x79ff('0x10')](_0x49c915)[_0x79ff('0x14')](function(_0x2a958c){_0x571024[_0x79ff('0x10')]=_0x2a958c;if(_0xaf6f3d['query'][_0x79ff('0x39')]){_0x5710eb[_0x79ff('0x3a')]=[{'all':!![]}];}return db[_0x79ff('0x28')][_0x79ff('0x3b')](_0x5710eb);})[_0x79ff('0x14')](function(_0x3012a6){_0x571024[_0x79ff('0x3c')]=_0x3012a6;return _0x571024;})['then'](respondWithFilteredResult(_0x896d82,_0x5710eb))[_0x79ff('0x3d')](handleError(_0x896d82,null));};exports[_0x79ff('0x3e')]=function(_0x203f5a,_0x2dcf79){var _0x3c6237={'raw':![],'where':{'id':_0x203f5a[_0x79ff('0x3f')]['id']}},_0xde5fa9={};_0xde5fa9['model']=_['keys'](db[_0x79ff('0x28')][_0x79ff('0x29')]);_0xde5fa9[_0x79ff('0x2d')]=_[_0x79ff('0x2c')](_0x203f5a['query']);_0xde5fa9[_0x79ff('0x2e')]=_[_0x79ff('0x2f')](_0xde5fa9[_0x79ff('0x2b')],_0xde5fa9['query']);_0x3c6237[_0x79ff('0x31')]=_['intersection'](_0xde5fa9[_0x79ff('0x2b')],qs[_0x79ff('0x30')](_0x203f5a[_0x79ff('0x2d')][_0x79ff('0x30')]));_0x3c6237[_0x79ff('0x31')]=_0x3c6237['attributes'][_0x79ff('0x40')]?_0x3c6237['attributes']:_0xde5fa9[_0x79ff('0x2b')];if(_0x203f5a['query'][_0x79ff('0x39')]){_0x3c6237[_0x79ff('0x3a')]=[{'all':!![]}];}_0x3c6237=_[_0x79ff('0x37')]({},_0x3c6237,_0x203f5a[_0x79ff('0x38')]);return db['VoiceExtension'][_0x79ff('0x21')](_0x3c6237)[_0x79ff('0x14')](handleEntityNotFound(_0x2dcf79,null))[_0x79ff('0x14')](respondWithResult(_0x2dcf79,null))[_0x79ff('0x3d')](handleError(_0x2dcf79,null));};exports[_0x79ff('0x13')]=function(_0x589a4a,_0x8b8343){return db['VoiceExtension'][_0x79ff('0x21')]({'where':{'id':_0x589a4a[_0x79ff('0x3f')]['id']}})['then'](handleEntityNotFound(_0x8b8343,null))[_0x79ff('0x14')](removeEntity(_0x8b8343,null))[_0x79ff('0x3d')](handleError(_0x8b8343,null));};exports[_0x79ff('0x41')]=function(_0x322a65,_0x3510d1){if(_0x322a65[_0x79ff('0x42')][_0x79ff('0x20')]==='outbound'&&!_[_0x79ff('0x43')](_0x322a65[_0x79ff('0x42')][_0x79ff('0x44')],'_')){_0x322a65['body']['exten']='_'[_0x79ff('0x45')](_0x322a65['body'][_0x79ff('0x44')]);}return db['VoiceExtension']['create'](_0x322a65[_0x79ff('0x42')],{'raw':![]})[_0x79ff('0x14')](function(_0x3fd9a6){var _0x21541d=_0x322a65['user'][_0x79ff('0x15')]({'plain':!![]});if(!_0x21541d)throw new Error(_0x79ff('0x46'));if(_0x21541d[_0x79ff('0x47')]===_0x79ff('0x48')){var _0x42c075=_0x3fd9a6[_0x79ff('0x15')]({'plain':!![]});var _0x57f351=[{'name':_0x79ff('0x16'),'value':_0x79ff('0x17')},{'name':_0x79ff('0x18'),'value':_0x79ff('0x19')},{'name':_0x79ff('0x1a'),'value':_0x79ff('0x1b')}];var _0x292c47=_['find'](_0x57f351,['value',_0x42c075[_0x79ff('0x20')]])['name'];return db[_0x79ff('0x49')][_0x79ff('0x21')]({'where':{'name':_0x292c47,'userProfileId':_0x21541d['userProfileId']},'raw':!![]})['then'](function(_0x5674ac){if(_0x5674ac&&_0x5674ac['autoAssociation']===0x0){return db[_0x79ff('0x23')][_0x79ff('0x41')]({'name':_0x42c075[_0x79ff('0x22')],'resourceId':_0x42c075['id'],'type':_0x5674ac[_0x79ff('0x22')],'sectionId':_0x5674ac['id']},{})[_0x79ff('0x14')](function(){return _0x3fd9a6;});}else{return _0x3fd9a6;}})['catch'](function(_0xce5757){logger[_0x79ff('0x26')](_0x79ff('0x4a'),_0xce5757);throw _0xce5757;});}return _0x3fd9a6;})['then'](respondWithResult(_0x3510d1,0xc9))[_0x79ff('0x3d')](handleError(_0x3510d1,null));};exports[_0x79ff('0x4b')]=function(_0x1ab184,_0x4884ab){if(_0x1ab184[_0x79ff('0x42')]['id']){delete _0x1ab184[_0x79ff('0x42')]['id'];}return db[_0x79ff('0x28')][_0x79ff('0x21')]({'where':{'id':_0x1ab184[_0x79ff('0x3f')]['id']}})[_0x79ff('0x14')](handleEntityNotFound(_0x4884ab,null))['then'](function(_0xe702e7){if(_0xe702e7){return db['VoiceExtension'][_0x79ff('0x4b')](_['pick'](_0x1ab184[_0x79ff('0x42')],[_0x79ff('0x44'),_0x79ff('0x4c'),'description',_0x79ff('0x4d'),_0x79ff('0x4e'),_0x79ff('0x4f'),'alias']),{'where':{'context':_0xe702e7[_0x79ff('0x4c')],'exten':_0xe702e7[_0x79ff('0x44')]},'individualHooks':!![]})[_0x79ff('0x14')](function(_0x210883){return _0x210883;});}return null;})[_0x79ff('0x14')](respondWithStatusCode(_0x4884ab,null))[_0x79ff('0x3d')](handleError(_0x4884ab,null));};exports[_0x79ff('0x50')]=function(_0x451230,_0x384674){var _0x32cb0e=_0x451230[_0x79ff('0x3f')]['id'];var _0x255084=_0x451230[_0x79ff('0x42')];var _0x4fce09=0xc8;var _0x3e74bd=null;return db[_0x79ff('0x51')]['transaction']({'isolationLevel':db[_0x79ff('0x51')]['Transaction'][_0x79ff('0x52')][_0x79ff('0x53')]},function(_0x493f8c){return db[_0x79ff('0x28')][_0x79ff('0x54')]({'where':{'id':_0x32cb0e},'transaction':_0x493f8c})['then'](function(_0xbba12b){if(_0xbba12b){return db[_0x79ff('0x28')][_0x79ff('0x13')]({'where':{'VoiceExtensionId':_0x32cb0e},'transaction':_0x493f8c})['then'](function(){var _0x4a88ef=_[_0x79ff('0x1e')](_0x255084,function(_0x4b262d){_0x4b262d[_0x79ff('0x55')]=_0x32cb0e;_0x4b262d[_0x79ff('0x56')]=!![];return _0x4b262d;});return _0xbba12b[_0x79ff('0x57')](_0x4a88ef);})['then'](function(_0x1602fa){return db['VoiceExtension']['bulkCreate'](_0x1602fa,{'transaction':_0x493f8c});});}else{_0x4fce09=0x194;_0x3e74bd=[];}});})[_0x79ff('0x14')](function(){if(_0x4fce09!==0x194){return db[_0x79ff('0x28')][_0x79ff('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x32cb0e},'order':_0x79ff('0x59')})['then'](function(_0x296b43){_0x3e74bd=_0x296b43;});}})[_0x79ff('0x3d')](function(_0x3e4c57){_0x4fce09=0x1f4;logger['error'](_0x3e4c57[_0x79ff('0x5a')]);if(_0x3e4c57[_0x79ff('0x22')]){delete _0x3e4c57['name'];}_0x3e74bd=_0x3e4c57;})[_0x79ff('0x5b')](function(){if(_0x3e74bd===null){_0x384674[_0x79ff('0x25')](_0x4fce09);}else{if(_0x4fce09===0x1f4){_0x384674[_0x79ff('0xb')](_0x4fce09)[_0x79ff('0x5c')](_0x3e74bd);}else{_0x384674['status'](_0x4fce09)[_0x79ff('0xc')](_0x3e74bd);}}});}; \ No newline at end of file +var _0x2ba3=['startsWith','exten','user','role','InboundRoutes','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','then','end','error','send','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','length','params','create','body'];(function(_0x5b9360,_0x1a8a2a){var _0x1180aa=function(_0x141c19){while(--_0x141c19){_0x5b9360['push'](_0x5b9360['shift']());}};_0x1180aa(++_0x1a8a2a);}(_0x2ba3,0x175));var _0x32ba=function(_0x4752f3,_0x1c46b4){_0x4752f3=_0x4752f3-0x0;var _0x142f78=_0x2ba3[_0x4752f3];return _0x142f78;};'use strict';var _=require(_0x32ba('0x0'));var Redis=require('ioredis');var qs=require(_0x32ba('0x1'));var logger=require(_0x32ba('0x2'))(_0x32ba('0x3'));var config=require(_0x32ba('0x4'));var db=require('../../mysqldb')['db'];config[_0x32ba('0x5')]=_[_0x32ba('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ba('0x7'))(new Redis(config[_0x32ba('0x5')]));require(_0x32ba('0x8'))[_0x32ba('0x9')](socket);function respondWithStatusCode(_0x15ae9e,_0x28559a){_0x28559a=_0x28559a||0xcc;return function(_0x26c1d7){if(_0x26c1d7){return _0x15ae9e[_0x32ba('0xa')](_0x28559a);}return _0x15ae9e[_0x32ba('0xb')](_0x28559a)['end']();};}function respondWithResult(_0x574da5,_0x255997){_0x255997=_0x255997||0xc8;return function(_0xca1c7f){if(_0xca1c7f){return _0x574da5[_0x32ba('0xb')](_0x255997)[_0x32ba('0xc')](_0xca1c7f);}};}function respondWithFilteredResult(_0x381073,_0x47420b){return function(_0x5df308){if(_0x5df308){var _0x45e4cb=typeof _0x47420b[_0x32ba('0xd')]==='undefined'&&typeof _0x47420b['limit']===_0x32ba('0xe');var _0x428f0b=_0x5df308[_0x32ba('0xf')];var _0x528b9d=_0x45e4cb?0x0:_0x47420b[_0x32ba('0xd')];var _0x34b5d9=_0x45e4cb?_0x5df308[_0x32ba('0xf')]:_0x47420b['offset']+_0x47420b[_0x32ba('0x10')];var _0x2d0dfe;if(_0x34b5d9>=_0x428f0b){_0x34b5d9=_0x428f0b;_0x2d0dfe=0xc8;}else{_0x2d0dfe=0xce;}_0x381073[_0x32ba('0xb')](_0x2d0dfe);return _0x381073['set'](_0x32ba('0x11'),_0x528b9d+'-'+_0x34b5d9+'/'+_0x428f0b)[_0x32ba('0xc')](_0x5df308);}return null;};}function removeEntity(_0x238e44){return function(_0x24682e){if(_0x24682e){return _0x24682e[_0x32ba('0x12')]()['then'](function(){var _0x2a8f35=_0x24682e[_0x32ba('0x13')]({'plain':!![]});var _0xe76571=[{'name':'InboundRoutes','value':_0x32ba('0x14'),'ignore':![]},{'name':_0x32ba('0x15'),'value':_0x32ba('0x16'),'ignore':![]},{'name':_0x32ba('0x17'),'value':_0x32ba('0x18'),'ignore':![]}];var _0x4db6e7=_(_0xe76571)[_0x32ba('0x19')]('ignore')[_0x32ba('0x1a')]('value')[_0x32ba('0x1b')]();if(_[_0x32ba('0x1c')](_0x4db6e7,_0x2a8f35[_0x32ba('0x1d')])){return;}var _0x10be9b=_[_0x32ba('0x1e')](_0xe76571,['value',_0x2a8f35['type']])[_0x32ba('0x1f')];return db['UserProfileResource'][_0x32ba('0x12')]({'where':{'type':_0x10be9b,'resourceId':_0x2a8f35['id']}})['then'](function(){return _0x24682e;});})[_0x32ba('0x20')](function(){_0x238e44[_0x32ba('0xb')](0xcc)[_0x32ba('0x21')]();});}};}function handleEntityNotFound(_0x1c21a0){return function(_0x5db05f){if(!_0x5db05f){_0x1c21a0['sendStatus'](0x194);}return _0x5db05f;};}function handleError(_0xb79c8a,_0xfed14){_0xfed14=_0xfed14||0x1f4;return function(_0x101111){logger[_0x32ba('0x22')](_0x101111['stack']);if(_0x101111[_0x32ba('0x1f')]){delete _0x101111[_0x32ba('0x1f')];}_0xb79c8a[_0x32ba('0xb')](_0xfed14)[_0x32ba('0x23')](_0x101111);};}exports[_0x32ba('0x24')]=function(_0x4b36b5,_0x2fd3fd){var _0x3e1bf8={},_0x1356bc={},_0x2a76fc={'count':0x0,'rows':[]};var _0x25ceb9=_['map'](db[_0x32ba('0x25')][_0x32ba('0x26')],function(_0x15324b){return{'name':_0x15324b['fieldName'],'type':_0x15324b[_0x32ba('0x1d')][_0x32ba('0x27')]};});_0x1356bc[_0x32ba('0x28')]=_[_0x32ba('0x1a')](_0x25ceb9,_0x32ba('0x1f'));_0x1356bc[_0x32ba('0x29')]=_[_0x32ba('0x2a')](_0x4b36b5[_0x32ba('0x29')]);_0x1356bc[_0x32ba('0x2b')]=_[_0x32ba('0x2c')](_0x1356bc['model'],_0x1356bc[_0x32ba('0x29')]);_0x3e1bf8[_0x32ba('0x2d')]=_[_0x32ba('0x2c')](_0x1356bc['model'],qs[_0x32ba('0x2e')](_0x4b36b5['query'][_0x32ba('0x2e')]));_0x3e1bf8[_0x32ba('0x2d')]=_0x3e1bf8[_0x32ba('0x2d')]['length']?_0x3e1bf8[_0x32ba('0x2d')]:_0x1356bc['model'];if(!_0x4b36b5[_0x32ba('0x29')]['hasOwnProperty'](_0x32ba('0x2f'))){_0x3e1bf8['limit']=qs[_0x32ba('0x10')](_0x4b36b5[_0x32ba('0x29')][_0x32ba('0x10')]);_0x3e1bf8[_0x32ba('0xd')]=qs[_0x32ba('0xd')](_0x4b36b5[_0x32ba('0x29')][_0x32ba('0xd')]);}_0x3e1bf8[_0x32ba('0x30')]=qs[_0x32ba('0x31')](_0x4b36b5[_0x32ba('0x29')][_0x32ba('0x31')]);_0x3e1bf8['where']=qs[_0x32ba('0x2b')](_['pick'](_0x4b36b5[_0x32ba('0x29')],_0x1356bc['filters']),_0x25ceb9);if(_0x4b36b5[_0x32ba('0x29')][_0x32ba('0x19')]){_0x3e1bf8[_0x32ba('0x32')]=_[_0x32ba('0x33')](_0x3e1bf8[_0x32ba('0x32')],{'$or':_['map'](_0x25ceb9,function(_0x4ea1ae){if(_0x4ea1ae[_0x32ba('0x1d')]!==_0x32ba('0x34')){var _0x42fcf5={};_0x42fcf5[_0x4ea1ae['name']]={'$like':'%'+_0x4b36b5['query']['filter']+'%'};return _0x42fcf5;}})});}_0x3e1bf8=_['merge']({},_0x3e1bf8,_0x4b36b5['options']);var _0x57bef4={'where':_0x3e1bf8['where']};return db[_0x32ba('0x25')][_0x32ba('0xf')](_0x57bef4)[_0x32ba('0x20')](function(_0x576682){_0x2a76fc[_0x32ba('0xf')]=_0x576682;if(_0x4b36b5['query'][_0x32ba('0x35')]){_0x3e1bf8['include']=[{'all':!![]}];}return db[_0x32ba('0x25')][_0x32ba('0x36')](_0x3e1bf8);})[_0x32ba('0x20')](function(_0x387e50){_0x2a76fc[_0x32ba('0x37')]=_0x387e50;return _0x2a76fc;})[_0x32ba('0x20')](respondWithFilteredResult(_0x2fd3fd,_0x3e1bf8))[_0x32ba('0x38')](handleError(_0x2fd3fd,null));};exports[_0x32ba('0x39')]=function(_0x35c12c,_0x44683a){var _0x3ab8e9={'raw':![],'where':{'id':_0x35c12c['params']['id']}},_0x3b9678={};_0x3b9678[_0x32ba('0x28')]=_[_0x32ba('0x2a')](db[_0x32ba('0x25')][_0x32ba('0x26')]);_0x3b9678[_0x32ba('0x29')]=_[_0x32ba('0x2a')](_0x35c12c[_0x32ba('0x29')]);_0x3b9678['filters']=_['intersection'](_0x3b9678[_0x32ba('0x28')],_0x3b9678[_0x32ba('0x29')]);_0x3ab8e9[_0x32ba('0x2d')]=_[_0x32ba('0x2c')](_0x3b9678[_0x32ba('0x28')],qs[_0x32ba('0x2e')](_0x35c12c[_0x32ba('0x29')][_0x32ba('0x2e')]));_0x3ab8e9[_0x32ba('0x2d')]=_0x3ab8e9[_0x32ba('0x2d')][_0x32ba('0x3a')]?_0x3ab8e9['attributes']:_0x3b9678['model'];if(_0x35c12c[_0x32ba('0x29')][_0x32ba('0x35')]){_0x3ab8e9['include']=[{'all':!![]}];}_0x3ab8e9=_['merge']({},_0x3ab8e9,_0x35c12c['options']);return db[_0x32ba('0x25')]['find'](_0x3ab8e9)['then'](handleEntityNotFound(_0x44683a,null))[_0x32ba('0x20')](respondWithResult(_0x44683a,null))[_0x32ba('0x38')](handleError(_0x44683a,null));};exports[_0x32ba('0x12')]=function(_0x15458c,_0x3d839c){return db[_0x32ba('0x25')][_0x32ba('0x1e')]({'where':{'id':_0x15458c[_0x32ba('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3d839c,null))[_0x32ba('0x20')](removeEntity(_0x3d839c,null))['catch'](handleError(_0x3d839c,null));};exports[_0x32ba('0x3c')]=function(_0x3b7ca5,_0x5f11c2){if(_0x3b7ca5[_0x32ba('0x3d')]['type']===_0x32ba('0x16')&&!_[_0x32ba('0x3e')](_0x3b7ca5[_0x32ba('0x3d')][_0x32ba('0x3f')],'_')){_0x3b7ca5[_0x32ba('0x3d')][_0x32ba('0x3f')]='_'['concat'](_0x3b7ca5['body'][_0x32ba('0x3f')]);}return db[_0x32ba('0x25')][_0x32ba('0x3c')](_0x3b7ca5['body'],{'raw':![]})['then'](function(_0x4d1e1d){var _0x468120=_0x3b7ca5[_0x32ba('0x40')][_0x32ba('0x13')]({'plain':!![]});if(!_0x468120)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x468120[_0x32ba('0x41')]===_0x32ba('0x40')){var _0x5e7bbb=_0x4d1e1d[_0x32ba('0x13')]({'plain':!![]});var _0x5df954=[{'name':_0x32ba('0x42'),'value':_0x32ba('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x32ba('0x18')}];var _0x27fa04=_[_0x32ba('0x1e')](_0x5df954,[_0x32ba('0x1b'),_0x5e7bbb[_0x32ba('0x1d')]])[_0x32ba('0x1f')];return db[_0x32ba('0x43')]['find']({'where':{'name':_0x27fa04,'userProfileId':_0x468120['userProfileId']},'raw':!![]})['then'](function(_0x4466a6){if(_0x4466a6&&_0x4466a6['autoAssociation']===0x0){return db[_0x32ba('0x44')]['create']({'name':_0x5e7bbb[_0x32ba('0x1f')],'resourceId':_0x5e7bbb['id'],'type':_0x4466a6['name'],'sectionId':_0x4466a6['id']},{})[_0x32ba('0x20')](function(){return _0x4d1e1d;});}else{return _0x4d1e1d;}})['catch'](function(_0x48912d){logger[_0x32ba('0x22')](_0x32ba('0x45'),_0x48912d);throw _0x48912d;});}return _0x4d1e1d;})[_0x32ba('0x20')](respondWithResult(_0x5f11c2,0xc9))[_0x32ba('0x38')](handleError(_0x5f11c2,null));};exports['update']=function(_0x4a2151,_0x596b10){if(_0x4a2151['body']['id']){delete _0x4a2151['body']['id'];}return db[_0x32ba('0x25')]['find']({'where':{'id':_0x4a2151[_0x32ba('0x3b')]['id']}})['then'](handleEntityNotFound(_0x596b10,null))['then'](function(_0x4cbd1c){if(_0x4cbd1c){return db[_0x32ba('0x25')][_0x32ba('0x46')](_[_0x32ba('0x47')](_0x4a2151[_0x32ba('0x3d')],[_0x32ba('0x3f'),_0x32ba('0x48'),_0x32ba('0x49'),_0x32ba('0x4a'),_0x32ba('0x4b'),'mandatoryDisposition',_0x32ba('0x4c')]),{'where':{'context':_0x4cbd1c[_0x32ba('0x48')],'exten':_0x4cbd1c[_0x32ba('0x3f')]},'individualHooks':!![]})[_0x32ba('0x20')](function(_0x4bbc84){return _0x4bbc84;});}return null;})[_0x32ba('0x20')](respondWithStatusCode(_0x596b10,null))[_0x32ba('0x38')](handleError(_0x596b10,null));};exports[_0x32ba('0x4d')]=function(_0x1cb4ea,_0x46d14d){var _0x49a102=_0x1cb4ea[_0x32ba('0x3b')]['id'];var _0x57ff98=_0x1cb4ea['body'];var _0x5ad426=0xc8;var _0xdedf08=null;return db[_0x32ba('0x4e')]['transaction']({'isolationLevel':db[_0x32ba('0x4e')][_0x32ba('0x4f')][_0x32ba('0x50')][_0x32ba('0x51')]},function(_0x53ac04){return db[_0x32ba('0x25')]['findOne']({'where':{'id':_0x49a102},'transaction':_0x53ac04})['then'](function(_0x51e006){if(_0x51e006){return db[_0x32ba('0x25')][_0x32ba('0x12')]({'where':{'VoiceExtensionId':_0x49a102},'transaction':_0x53ac04})['then'](function(){var _0x6ac1be=_[_0x32ba('0x1a')](_0x57ff98,function(_0x587fbd){_0x587fbd[_0x32ba('0x52')]=_0x49a102;_0x587fbd[_0x32ba('0x53')]=!![];return _0x587fbd;});return _0x51e006['createRouting'](_0x6ac1be);})[_0x32ba('0x20')](function(_0x101428){return db[_0x32ba('0x25')]['bulkCreate'](_0x101428,{'transaction':_0x53ac04});});}else{_0x5ad426=0x194;_0xdedf08=[];}});})['then'](function(){if(_0x5ad426!==0x194){return db[_0x32ba('0x25')][_0x32ba('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x49a102},'order':_0x32ba('0x55')})['then'](function(_0x42479d){_0xdedf08=_0x42479d;});}})[_0x32ba('0x38')](function(_0x26d4a9){_0x5ad426=0x1f4;logger[_0x32ba('0x22')](_0x26d4a9[_0x32ba('0x56')]);if(_0x26d4a9[_0x32ba('0x1f')]){delete _0x26d4a9[_0x32ba('0x1f')];}_0xdedf08=_0x26d4a9;})['finally'](function(){if(_0xdedf08===null){_0x46d14d[_0x32ba('0xa')](_0x5ad426);}else{if(_0x5ad426===0x1f4){_0x46d14d[_0x32ba('0xb')](_0x5ad426)[_0x32ba('0x23')](_0xdedf08);}else{_0x46d14d[_0x32ba('0xb')](_0x5ad426)[_0x32ba('0xc')](_0xdedf08);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5909a64..913b5e5 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 _0x0662=['hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','update','emit'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0x0662,0x14b));var _0x2066=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x0662[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x2066('0x0'))['db'][_0x2066('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2066('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2066('0x3'),'afterDestroy':'remove'};function emitEvent(_0x59c71a){return function(_0x21b42a,_0x3fe2dd,_0x16d3bf){VoiceExtensionEvents[_0x2066('0x4')](_0x59c71a+':'+_0x21b42a['id'],_0x21b42a);VoiceExtensionEvents['emit'](_0x59c71a,_0x21b42a);_0x16d3bf(null);};}for(var e in events){if(events[_0x2066('0x5')](e)){var event=events[e];VoiceExtension[_0x2066('0x6')](e,emitEvent(event));}}module[_0x2066('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xebf9=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x46314f,_0x4332dd){var _0x5a1f0c=function(_0x2b8601){while(--_0x2b8601){_0x46314f['push'](_0x46314f['shift']());}};_0x5a1f0c(++_0x4332dd);}(_0xebf9,0x1f4));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x9ebf('0x0'));var VoiceExtension=require(_0x9ebf('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9ebf('0x2')](0x0);var events={'afterCreate':_0x9ebf('0x3'),'afterUpdate':_0x9ebf('0x4'),'afterDestroy':_0x9ebf('0x5')};function emitEvent(_0x1e7755){return function(_0x3533b3,_0x40c570,_0x2a8b77){VoiceExtensionEvents[_0x9ebf('0x6')](_0x1e7755+':'+_0x3533b3['id'],_0x3533b3);VoiceExtensionEvents[_0x9ebf('0x6')](_0x1e7755,_0x3533b3);_0x2a8b77(null);};}for(var e in events){if(events[_0x9ebf('0x7')](e)){var event=events[e];VoiceExtension[_0x9ebf('0x8')](e,emitEvent(event));}}module[_0x9ebf('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 074f09f..c862d80 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 _0xbeea=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','VoiceExtension','voice_extensions','get','then','Hangup','lodash','exports','type','Set','CDR(type)=','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','param','prefix','phone','${EXTEN:','${EXTEN}','SIP','none','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','intervals','map','filter','toLowerCase','hasOwnProperty','tag','length','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x1312a0,_0x45fa6a){var _0x86ca6e=function(_0x3e78af){while(--_0x3e78af){_0x1312a0['push'](_0x1312a0['shift']());}};_0x86ca6e(++_0x45fa6a);}(_0xbeea,0xb1));var _0xabee=function(_0x29a79f,_0x3b8c8a){_0x29a79f=_0x29a79f-0x0;var _0x55ae59=_0xbeea[_0x29a79f];return _0x55ae59;};'use strict';var _=require(_0xabee('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xabee('0x1')]=function(_0x3b377b){var _0x35ca8b=_0x3b377b['models'];function _0x972e88(_0x59e264){var _0x58afa7=0x2;var _0x33571e=[{'type':_0x59e264[_0xabee('0x2')],'app':_0xabee('0x3'),'appdata':_0xabee('0x4')+_0x59e264['type'],'context':_0x59e264['context'],'exten':_0x59e264[_0xabee('0x5')],'priority':_0x58afa7++,'VoiceExtensionId':_0x59e264['id']},{'type':_0x59e264[_0xabee('0x2')],'app':_0x59e264['alias']?_0xabee('0x3'):'NoOp','appdata':_0x59e264[_0xabee('0x6')]?_0xabee('0x7')+_0x59e264[_0xabee('0x6')]:_0xabee('0x8'),'context':_0x59e264[_0xabee('0x9')],'exten':_0x59e264[_0xabee('0x5')],'priority':_0x58afa7++,'VoiceExtensionId':_0x59e264['id']}];if(_0x59e264['type']===_0xabee('0xa')){_0x33571e[_0xabee('0xb')]({'type':_0xabee('0xa'),'app':'Set','appdata':_0xabee('0xc')+_0x59e264['id'],'context':_0x59e264[_0xabee('0x9')],'exten':_0x59e264[_0xabee('0x5')],'priority':_0x58afa7++,'VoiceExtensionId':_0x59e264['id']});}_0x33571e['push']({'type':_0x59e264['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x59e264['context'],'exten':_0x59e264[_0xabee('0x5')],'priority':_0x58afa7++,'VoiceExtensionId':_0x59e264['id']},{'type':_0x59e264[_0xabee('0x2')],'app':_0xabee('0x3'),'appdata':_0xabee('0xd'),'context':_0x59e264[_0xabee('0x9')],'exten':_0x59e264['exten'],'priority':_0x58afa7++,'VoiceExtensionId':_0x59e264['id']},{'type':_0x59e264[_0xabee('0x2')],'app':_0xabee('0x3'),'appdata':_0xabee('0xe'),'context':_0x59e264[_0xabee('0x9')],'exten':_0x59e264[_0xabee('0x5')],'priority':_0x58afa7++,'VoiceExtensionId':_0x59e264['id']});return _0x33571e;}function _0x2d6e69(_0x440413){var _0x5a9562=0x2;var _0x33e3c0=[{'type':_0xabee('0xf'),'app':_0xabee('0x3'),'appdata':_0xabee('0x10'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':'outbound','app':_0x440413['alias']?_0xabee('0x3'):'NoOp','appdata':_0x440413['alias']?_0xabee('0x7')+_0x440413[_0xabee('0x6')]:_0xabee('0x8'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':'outbound','app':_0xabee('0x3'),'appdata':'CDR(destination)='+(_0x440413['cutdigits']?'${EXTEN:'+_0x440413[_0xabee('0x11')]+'}':'${EXTEN}'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':_0xabee('0xf'),'app':_0xabee('0x3'),'appdata':_0xabee('0xc')+_0x440413['id'],'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':'outbound','app':_0xabee('0x12'),'appdata':_0xabee('0x13')+(_0x5a9562+0x2)+_0xabee('0x14')+(_0x5a9562+0x1)+')','context':_0x440413[_0xabee('0x9')],'exten':_0x440413['exten'],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':_0xabee('0xf'),'app':_0xabee('0x3'),'appdata':_0x440413['cutdigits']?_0xabee('0x15')+_0x440413[_0xabee('0x11')]+'}':_0xabee('0x16'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413['exten'],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':_0xabee('0xf'),'app':_0xabee('0x3'),'appdata':_0xabee('0x17'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':_0xabee('0xf'),'app':_0xabee('0x3'),'appdata':_0xabee('0xd'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413['exten'],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':_0xabee('0xf'),'app':'Set','appdata':_0xabee('0xe'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':_0xabee('0xf'),'app':'Set','appdata':_0xabee('0x18')+_0x440413['id'],'context':_0x440413['context'],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']}];if(_0x440413['hasOwnProperty'](_0xabee('0x19'))&&_0x440413['recordingFormat']!=='none'){_0x33e3c0[_0xabee('0xb')]({'type':_0xabee('0xf'),'app':_0xabee('0x3'),'appdata':_0xabee('0x1a'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']},{'type':_0xabee('0xf'),'app':_0xabee('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x440413[_0xabee('0x19')]||_0xabee('0x1b'),'context':_0x440413[_0xabee('0x9')],'exten':_0x440413[_0xabee('0x5')],'priority':_0x5a9562++,'VoiceExtensionId':_0x440413['id']});}return _0x33e3c0;}function _0x146ae9(_0x77c942,_0x9703eb){var _0x2d0953=[{'name':_0xabee('0x1c'),'param':0x0},{'name':_0xabee('0x1d'),'param':0x1},{'name':_0xabee('0x1e'),'param':0x2},{'name':_0xabee('0x1f'),'param':0x3}];var _0xb1ef34={};var _0x2ca217=_0x9703eb[_0xabee('0x20')](',');var _0x2e2769=[];for(var _0x3db173=0x0;_0x3db173<_0x2d0953['length'];_0x3db173++){switch(_0x2d0953[_0x3db173]['name']){case _0xabee('0x1c'):_0xb1ef34[_0xabee('0x1c')]=_0x2ca217[_0x2d0953[_0x3db173][_0xabee('0x21')]][_0xabee('0x20')]('/')[0x1];_0xb1ef34['phone']=_0x2ca217[_0x2d0953[_0x3db173][_0xabee('0x21')]][_0xabee('0x20')]('/')[0x2];_0xb1ef34[_0xabee('0x22')]=_0xb1ef34['phone']?_0xb1ef34[_0xabee('0x23')]['split']('$')[0x0]:undefined;_0xb1ef34[_0xabee('0x23')]=_0x77c942[_0xabee('0x11')]?(_0xb1ef34[_0xabee('0x22')]||'')+_0xabee('0x24')+_0x77c942['cutdigits']+'}':(_0xb1ef34['prefix']||'')+_0xabee('0x25');_0x2e2769[_0x2d0953[_0x3db173][_0xabee('0x21')]]=[_0xabee('0x26'),_0xb1ef34[_0xabee('0x1c')],_0xb1ef34[_0xabee('0x23')]]['join']('/');break;case _0xabee('0x1e'):_0xb1ef34[_0xabee('0x1e')]=_0x2ca217[_0x2d0953[_0x3db173]['param']];if(_0x77c942[_0xabee('0x19')]!==_0xabee('0x27')){if(_0xb1ef34['options'][_0xabee('0x28')](_0xabee('0x29'))<0x0){_0xb1ef34[_0xabee('0x1e')]+=_0xabee('0x29');}}else{_0xb1ef34[_0xabee('0x1e')]=_0xb1ef34[_0xabee('0x1e')][_0xabee('0x2a')]('U(xcally-mixmonitor-context)','');}_0x2e2769[_0x2d0953[_0x3db173][_0xabee('0x21')]]=_0xb1ef34[_0xabee('0x1e')];break;default:_0x2e2769[_0x2d0953[_0x3db173][_0xabee('0x21')]]=_0x2ca217[_0x2d0953[_0x3db173]['param']];}}return _0x2e2769[_0xabee('0x2b')](',');}function _0x2701b7(_0x5a918e,_0x29ffe9,_0x1475f3){return new Promise(function(_0x50b996,_0x1ce8ae){var _0x2e3675=[];if(_[_0xabee('0x2c')](_0x29ffe9))return _0x50b996(_0x2e3675);_0x35ca8b[_0xabee('0x2d')][_0xabee('0x2e')]({'attributes':['id',_0xabee('0x2f'),_0xabee('0x30')],'raw':!![]})['then'](function(_0x2aa2f0){for(var _0x23735d=0x0,_0x441af1=0x0;_0x23735d<_0x29ffe9['length'];_0x23735d++,_0x441af1=0x0){var _0x444a92=_0x29ffe9[_0x23735d];var _0x2e83e0=[];var _0x5ae15a=[];delete _0x444a92['id'];if(_0x444a92['interval']!=='*,*,*,*'){_0x444a92[_0xabee('0x31')]=[_0x444a92[_0xabee('0x2f')]];}else{_0x444a92['intervals']=_0x444a92['IntervalId']?_[_0xabee('0x32')](_[_0xabee('0x33')](_0x2aa2f0,{'IntervalId':_0x444a92[_0xabee('0x30')]}),_0xabee('0x2f')):[];}_0x444a92[_0xabee('0x9')]=_0x5a918e[_0xabee('0x9')];_0x444a92[_0xabee('0x5')]=_0x5a918e[_0xabee('0x5')];if(_0x444a92[_0xabee('0x2')])_0x444a92[_0xabee('0x2')]=_0x444a92[_0xabee('0x2')][_0xabee('0x34')]();if(_0x5a918e[_0xabee('0x2')]===_0xabee('0xf')){if(_0x444a92[_0xabee('0x35')](_0xabee('0x36'))&&_0x444a92[_0xabee('0x36')]&&_0x444a92[_0xabee('0x36')]!=='--'){_0x2e83e0['push']({'type':_0x444a92[_0xabee('0x2')][_0xabee('0x34')](),'app':'Set','appdata':'CDR(tag)='+_0x444a92[_0xabee('0x36')],'context':_0x5a918e[_0xabee('0x9')],'exten':_0x5a918e[_0xabee('0x5')],'priority':_0x444a92[_0xabee('0x31')][_0xabee('0x37')]+_0x1475f3+_0x441af1++,'VoiceExtensionId':_0x5a918e['id']});}_0x2e83e0[_0xabee('0xb')]({'type':_0x444a92[_0xabee('0x2')]['toLowerCase'](),'app':_0xabee('0x12'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x444a92[_0xabee('0x38')]?_0xabee('0x39')+_0x444a92['callerID']+')':_0xabee('0x3a')),'context':_0x5a918e[_0xabee('0x9')],'exten':_0x5a918e[_0xabee('0x5')],'priority':_0x444a92['intervals'][_0xabee('0x37')]+_0x1475f3+_0x441af1++,'VoiceExtensionId':_0x5a918e['id']});}else{if(_0x444a92['hasOwnProperty'](_0xabee('0x3b'))){if([_0xabee('0x3c'),_0xabee('0x3d')]['includes'](_0x444a92[_0xabee('0x3e')][_0xabee('0x34')]())&&_0x444a92[_0xabee('0x3f')]!=='custom'){if(_0x444a92[_0xabee('0x3b')]){_0x2e83e0[_0xabee('0xb')]({'type':_0x444a92[_0xabee('0x2')][_0xabee('0x34')](),'app':'ExecIf','appdata':_0xabee('0x40'),'context':_0x5a918e[_0xabee('0x9')],'exten':_0x5a918e[_0xabee('0x5')],'priority':_0x444a92['intervals'][_0xabee('0x37')]+_0x1475f3+_0x441af1++,'VoiceExtensionId':_0x5a918e['id']});_0x2e83e0[_0xabee('0xb')]({'type':_0x444a92[_0xabee('0x2')][_0xabee('0x34')](),'app':_0xabee('0x3'),'appdata':_0xabee('0x41'),'context':_0x5a918e[_0xabee('0x9')],'exten':_0x5a918e[_0xabee('0x5')],'priority':_0x444a92[_0xabee('0x31')]['length']+_0x1475f3+_0x441af1++,'VoiceExtensionId':_0x5a918e['id']});}else{_0x2e83e0['push']({'type':_0x444a92[_0xabee('0x2')][_0xabee('0x34')](),'app':_0xabee('0x12'),'appdata':_0xabee('0x42'),'context':_0x5a918e[_0xabee('0x9')],'exten':_0x5a918e[_0xabee('0x5')],'priority':_0x444a92['intervals'][_0xabee('0x37')]+_0x1475f3+_0x441af1++,'VoiceExtensionId':_0x5a918e['id']});_0x2e83e0[_0xabee('0xb')]({'type':_0x444a92[_0xabee('0x2')]['toLowerCase'](),'app':'Set','appdata':_0xabee('0x43'),'context':_0x5a918e['context'],'exten':_0x5a918e['exten'],'priority':_0x444a92['intervals'][_0xabee('0x37')]+_0x1475f3+_0x441af1++,'VoiceExtensionId':_0x5a918e['id']});}}}}for(var _0x5b975b=0x0;_0x5b975b<_0x444a92[_0xabee('0x31')]['length'];_0x5b975b++){var _0x12240a=_0x1475f3+_0x444a92['intervals'][_0xabee('0x37')];var _0x2c88fc=_0x5b975b===_0x444a92[_0xabee('0x31')][_0xabee('0x37')]-0x1?_0x1475f3+_0x2e83e0['length']+_0x5ae15a[_0xabee('0x37')]+0x2:_0x1475f3+_0x5b975b+0x1;_0x2e83e0['splice'](_0x5b975b,0x0,{'type':_0x5a918e[_0xabee('0x2')],'app':_0xabee('0x44'),'appdata':_0x444a92[_0xabee('0x31')][_0x5b975b]+'?'+_0x5a918e[_0xabee('0x9')]+_0xabee('0x45')+_0x12240a+':'+_0x5a918e[_0xabee('0x9')]+_0xabee('0x45')+_0x2c88fc,'exten':_0x5a918e[_0xabee('0x5')],'context':_0x5a918e['context'],'priority':_0x1475f3+_0x5b975b,'VoiceExtensionId':_0x5a918e['id']});}if(_0x444a92[_0xabee('0x3f')]===_0xabee('0x46'))_0x444a92['appdata']=_0x146ae9(_0x5a918e,_0x444a92[_0xabee('0x47')]);_0x444a92['priority']=_0x2e83e0[_0xabee('0x37')]?_[_0xabee('0x48')](_0x2e83e0)[_0xabee('0x49')]+0x1:_0x1475f3;_0x2e3675=_[_0xabee('0x4a')](_0x2e3675,_0x2e83e0,[_0x444a92],_0x5ae15a);_0x1475f3=_['last'](_0x2e3675)[_0xabee('0x49')]+0x1;}return _0x50b996(_0x2e3675);})[_0xabee('0x4b')](function(_0x2bfdb5){_0x1ce8ae(_0x2bfdb5);});});}return _0x3b377b['define'](_0xabee('0x4c'),attributes,{'tableName':_0xabee('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4861e5){var _0x47a561=this[_0xabee('0x4e')]({'plain':!![]});var _0x1e0082=_0x47a561['type']===_0xabee('0xf')?_0x2d6e69(_0x47a561):_0x972e88(_0x47a561);return _0x2701b7(_0x47a561,_0x4861e5,_['last'](_0x1e0082)[_0xabee('0x49')]+0x1)[_0xabee('0x4f')](function(_0x5e0133){var _0x1f87da=_[_0xabee('0x4a')](_0x1e0082,_0x5e0133);_0x1f87da[_0xabee('0xb')]({'type':_0x47a561[_0xabee('0x2')],'app':_0xabee('0x50'),'exten':_0x47a561[_0xabee('0x5')],'context':_0x47a561['context'],'priority':_[_0xabee('0x48')](_0x1f87da)[_0xabee('0x49')]+0x1,'VoiceExtensionId':_0x47a561['id']});return _0x1f87da;});}}});}; \ No newline at end of file +var _0x43e7=['type','inbound','push','Set','exten','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','none','indexOf','replace','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get','concat','lodash','exports','CDR(type)=','context','NoOp','alias','CDR(routeAlias)='];(function(_0x15456c,_0x420b80){var _0x51849c=function(_0x181c7e){while(--_0x181c7e){_0x15456c['push'](_0x15456c['shift']());}};_0x51849c(++_0x420b80);}(_0x43e7,0xda));var _0x743e=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x43e7[_0x5cb97e];return _0x1714b4;};'use strict';var _=require(_0x743e('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x743e('0x1')]=function(_0x596e39){var _0x570e19=_0x596e39['models'];function _0x435e3a(_0x4b0e05){var _0x3043d1=0x2;var _0xab5e2a=[{'type':_0x4b0e05['type'],'app':'Set','appdata':_0x743e('0x2')+_0x4b0e05['type'],'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05['exten'],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']},{'type':_0x4b0e05['type'],'app':_0x4b0e05['alias']?'Set':_0x743e('0x4'),'appdata':_0x4b0e05[_0x743e('0x5')]?_0x743e('0x6')+_0x4b0e05['alias']:'No\x20alias\x20set','context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05['exten'],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']}];if(_0x4b0e05[_0x743e('0x7')]===_0x743e('0x8')){_0xab5e2a[_0x743e('0x9')]({'type':'inbound','app':_0x743e('0xa'),'appdata':'CDR(routeid)='+_0x4b0e05['id'],'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']});}_0xab5e2a[_0x743e('0x9')]({'type':_0x4b0e05['type'],'app':_0x743e('0xa'),'appdata':_0x743e('0xc'),'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']},{'type':_0x4b0e05[_0x743e('0x7')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']},{'type':_0x4b0e05[_0x743e('0x7')],'app':_0x743e('0xa'),'appdata':_0x743e('0xd'),'context':_0x4b0e05[_0x743e('0x3')],'exten':_0x4b0e05[_0x743e('0xb')],'priority':_0x3043d1++,'VoiceExtensionId':_0x4b0e05['id']});return _0xab5e2a;}function _0x2a3c0e(_0x1dd702){var _0xe8174b=0x2;var _0x3799e8=[{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':_0x743e('0xf'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x1dd702[_0x743e('0x5')]?_0x743e('0xa'):_0x743e('0x4'),'appdata':_0x1dd702[_0x743e('0x5')]?_0x743e('0x6')+_0x1dd702['alias']:_0x743e('0x10'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':'CDR(destination)='+(_0x1dd702[_0x743e('0x11')]?_0x743e('0x12')+_0x1dd702[_0x743e('0x11')]+'}':_0x743e('0x13')),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':_0x743e('0x14')+_0x1dd702['id'],'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0x15'),'appdata':_0x743e('0x16')+(_0xe8174b+0x2)+'):Goto('+(_0xe8174b+0x1)+')','context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':_0x1dd702[_0x743e('0x11')]?_0x743e('0x17')+_0x1dd702['cutdigits']+'}':_0x743e('0x18'),'context':_0x1dd702['context'],'exten':_0x1dd702['exten'],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':_0x743e('0xe'),'app':_0x743e('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':_0x743e('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':_0x743e('0xa'),'appdata':_0x743e('0xd'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702['exten'],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':_0x743e('0xa'),'appdata':'outboundrouteid='+_0x1dd702['id'],'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702['exten'],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']}];if(_0x1dd702[_0x743e('0x19')](_0x743e('0x1a'))&&_0x1dd702[_0x743e('0x1a')]!=='none'){_0x3799e8[_0x743e('0x9')]({'type':'outbound','app':'Set','appdata':_0x743e('0x1b'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']},{'type':'outbound','app':'Set','appdata':_0x743e('0x1c')+_0x1dd702[_0x743e('0x1a')]||_0x743e('0x1d'),'context':_0x1dd702[_0x743e('0x3')],'exten':_0x1dd702[_0x743e('0xb')],'priority':_0xe8174b++,'VoiceExtensionId':_0x1dd702['id']});}return _0x3799e8;}function _0x404bec(_0x172c35,_0x41fbb5){var _0x190f6f=[{'name':_0x743e('0x1e'),'param':0x0},{'name':_0x743e('0x1f'),'param':0x1},{'name':_0x743e('0x20'),'param':0x2},{'name':_0x743e('0x21'),'param':0x3}];var _0x3897eb={};var _0x2da72d=_0x41fbb5[_0x743e('0x22')](',');var _0x332f19=[];for(var _0x8d6745=0x0;_0x8d6745<_0x190f6f[_0x743e('0x23')];_0x8d6745++){switch(_0x190f6f[_0x8d6745][_0x743e('0x24')]){case _0x743e('0x1e'):_0x3897eb[_0x743e('0x1e')]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]][_0x743e('0x22')]('/')[0x1];_0x3897eb[_0x743e('0x26')]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]][_0x743e('0x22')]('/')[0x2];_0x3897eb['prefix']=_0x3897eb[_0x743e('0x26')]?_0x3897eb[_0x743e('0x26')][_0x743e('0x22')]('$')[0x0]:undefined;_0x3897eb[_0x743e('0x26')]=_0x172c35[_0x743e('0x11')]?(_0x3897eb[_0x743e('0x27')]||'')+'${EXTEN:'+_0x172c35[_0x743e('0x11')]+'}':(_0x3897eb['prefix']||'')+_0x743e('0x13');_0x332f19[_0x190f6f[_0x8d6745][_0x743e('0x25')]]=[_0x743e('0x28'),_0x3897eb[_0x743e('0x1e')],_0x3897eb[_0x743e('0x26')]][_0x743e('0x29')]('/');break;case _0x743e('0x20'):_0x3897eb[_0x743e('0x20')]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]];if(_0x172c35[_0x743e('0x1a')]!==_0x743e('0x2a')){if(_0x3897eb[_0x743e('0x20')][_0x743e('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x3897eb['options']+='U(xcally-mixmonitor-context)';}}else{_0x3897eb[_0x743e('0x20')]=_0x3897eb[_0x743e('0x20')][_0x743e('0x2c')](_0x743e('0x2d'),'');}_0x332f19[_0x190f6f[_0x8d6745][_0x743e('0x25')]]=_0x3897eb['options'];break;default:_0x332f19[_0x190f6f[_0x8d6745][_0x743e('0x25')]]=_0x2da72d[_0x190f6f[_0x8d6745][_0x743e('0x25')]];}}return _0x332f19[_0x743e('0x29')](',');}function _0x491dfb(_0x170bad,_0x4606ec,_0x3ec16b){return new Promise(function(_0x1d1c3d,_0x18f17e){var _0x23111a=[];if(_[_0x743e('0x2e')](_0x4606ec))return _0x1d1c3d(_0x23111a);_0x570e19['Interval'][_0x743e('0x2f')]({'attributes':['id',_0x743e('0x30'),_0x743e('0x31')],'raw':!![]})[_0x743e('0x32')](function(_0x5ea163){for(var _0x2a50a4=0x0,_0x205bdf=0x0;_0x2a50a4<_0x4606ec[_0x743e('0x23')];_0x2a50a4++,_0x205bdf=0x0){var _0x1a0955=_0x4606ec[_0x2a50a4];var _0x3128bc=[];var _0x359c90=[];delete _0x1a0955['id'];if(_0x1a0955['interval']!==_0x743e('0x33')){_0x1a0955[_0x743e('0x34')]=[_0x1a0955[_0x743e('0x30')]];}else{_0x1a0955[_0x743e('0x34')]=_0x1a0955[_0x743e('0x31')]?_[_0x743e('0x35')](_['filter'](_0x5ea163,{'IntervalId':_0x1a0955[_0x743e('0x31')]}),_0x743e('0x30')):[];}_0x1a0955[_0x743e('0x3')]=_0x170bad['context'];_0x1a0955['exten']=_0x170bad[_0x743e('0xb')];if(_0x1a0955['type'])_0x1a0955['type']=_0x1a0955[_0x743e('0x7')][_0x743e('0x36')]();if(_0x170bad['type']===_0x743e('0xe')){if(_0x1a0955['hasOwnProperty'](_0x743e('0x37'))&&_0x1a0955[_0x743e('0x37')]&&_0x1a0955[_0x743e('0x37')]!=='--'){_0x3128bc['push']({'type':_0x1a0955['type'][_0x743e('0x36')](),'app':_0x743e('0xa'),'appdata':_0x743e('0x38')+_0x1a0955['tag'],'context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1a0955[_0x743e('0x39')]?_0x743e('0x3a')+_0x1a0955[_0x743e('0x39')]+')':_0x743e('0x3b')),'context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad['exten'],'priority':_0x1a0955[_0x743e('0x34')]['length']+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}else{if(_0x1a0955[_0x743e('0x19')](_0x743e('0x3c'))){if([_0x743e('0x3d'),_0x743e('0x3e')]['includes'](_0x1a0955['app'][_0x743e('0x36')]())&&_0x1a0955['appType']!=='custom'){if(_0x1a0955[_0x743e('0x3c')]){_0x3128bc['push']({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':_0x743e('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955['intervals'][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':_0x743e('0xa'),'appdata':_0x743e('0x3f'),'context':_0x170bad['context'],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}else{_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':_0x743e('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad['exten'],'priority':_0x1a0955[_0x743e('0x34')]['length']+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});_0x3128bc[_0x743e('0x9')]({'type':_0x1a0955[_0x743e('0x7')][_0x743e('0x36')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x170bad[_0x743e('0x3')],'exten':_0x170bad[_0x743e('0xb')],'priority':_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]+_0x3ec16b+_0x205bdf++,'VoiceExtensionId':_0x170bad['id']});}}}}for(var _0x36f41b=0x0;_0x36f41b<_0x1a0955[_0x743e('0x34')][_0x743e('0x23')];_0x36f41b++){var _0x1f2769=_0x3ec16b+_0x1a0955[_0x743e('0x34')][_0x743e('0x23')];var _0x235a04=_0x36f41b===_0x1a0955[_0x743e('0x34')][_0x743e('0x23')]-0x1?_0x3ec16b+_0x3128bc['length']+_0x359c90[_0x743e('0x23')]+0x2:_0x3ec16b+_0x36f41b+0x1;_0x3128bc[_0x743e('0x40')](_0x36f41b,0x0,{'type':_0x170bad[_0x743e('0x7')],'app':'GotoIfTime','appdata':_0x1a0955[_0x743e('0x34')][_0x36f41b]+'?'+_0x170bad[_0x743e('0x3')]+_0x743e('0x41')+_0x1f2769+':'+_0x170bad[_0x743e('0x3')]+_0x743e('0x41')+_0x235a04,'exten':_0x170bad[_0x743e('0xb')],'context':_0x170bad[_0x743e('0x3')],'priority':_0x3ec16b+_0x36f41b,'VoiceExtensionId':_0x170bad['id']});}if(_0x1a0955['appType']===_0x743e('0x42'))_0x1a0955['appdata']=_0x404bec(_0x170bad,_0x1a0955[_0x743e('0x43')]);_0x1a0955[_0x743e('0x44')]=_0x3128bc[_0x743e('0x23')]?_[_0x743e('0x45')](_0x3128bc)['priority']+0x1:_0x3ec16b;_0x23111a=_['concat'](_0x23111a,_0x3128bc,[_0x1a0955],_0x359c90);_0x3ec16b=_[_0x743e('0x45')](_0x23111a)[_0x743e('0x44')]+0x1;}return _0x1d1c3d(_0x23111a);})[_0x743e('0x46')](function(_0x3938b6){_0x18f17e(_0x3938b6);});});}return _0x596e39[_0x743e('0x47')](_0x743e('0x48'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5562d7){var _0xf5ab70=this[_0x743e('0x49')]({'plain':!![]});var _0x370b58=_0xf5ab70[_0x743e('0x7')]===_0x743e('0xe')?_0x2a3c0e(_0xf5ab70):_0x435e3a(_0xf5ab70);return _0x491dfb(_0xf5ab70,_0x5562d7,_[_0x743e('0x45')](_0x370b58)['priority']+0x1)[_0x743e('0x32')](function(_0x48b0a){var _0x456ea3=_[_0x743e('0x4a')](_0x370b58,_0x48b0a);_0x456ea3[_0x743e('0x9')]({'type':_0xf5ab70[_0x743e('0x7')],'app':'Hangup','exten':_0xf5ab70[_0x743e('0xb')],'context':_0xf5ab70['context'],'priority':_['last'](_0x456ea3)[_0x743e('0x44')]+0x1,'VoiceExtensionId':_0xf5ab70['id']});return _0x456ea3;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ba1fd4e..24bb15c 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 _0xf767=['options','where','attributes','limit','include','map','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','VoiceExtension,\x20%s,\x20%s','message','GetVoiceExtension','VoiceExtension','findAll','raw'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xf767,0x76));var _0x7f76=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xf767[_0x4d45c1];return _0x244478;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var moment=require(_0x7f76('0x1'));var BPromise=require(_0x7f76('0x2'));var rs=require(_0x7f76('0x3'));var fs=require('fs');var Redis=require(_0x7f76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f76('0x5'));var logger=require(_0x7f76('0x6'))(_0x7f76('0x7'));var config=require(_0x7f76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f76('0x9')][_0x7f76('0xa')]({'port':0x232a});config[_0x7f76('0xb')]=_[_0x7f76('0xc')](config[_0x7f76('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f76('0xd'))(new Redis(config[_0x7f76('0xb')]));require(_0x7f76('0xe'))[_0x7f76('0xf')](socket);function respondWithRpcPromise(_0x4c5f88,_0x247403,_0x5dc8aa){return new BPromise(function(_0xb94891,_0x11770c){return client[_0x7f76('0x10')](_0x4c5f88,_0x5dc8aa)[_0x7f76('0x11')](function(_0xfc818e){logger[_0x7f76('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x247403,_0x7f76('0x13'));logger[_0x7f76('0x14')](_0x7f76('0x15'),_0x247403,_0x7f76('0x13'),JSON[_0x7f76('0x16')](_0xfc818e));if(_0xfc818e['error']){if(_0xfc818e[_0x7f76('0x17')]['code']===0x1f4){logger[_0x7f76('0x17')](_0x7f76('0x18'),_0x247403,_0xfc818e['error']['message']);return _0x11770c(_0xfc818e['error'][_0x7f76('0x19')]);}logger[_0x7f76('0x17')](_0x7f76('0x18'),_0x247403,_0xfc818e['error'][_0x7f76('0x19')]);return _0xb94891(_0xfc818e['error'][_0x7f76('0x19')]);}else{logger[_0x7f76('0x12')](_0x7f76('0x18'),_0x247403,'request\x20sent');_0xb94891(_0xfc818e['result']['message']);}})['catch'](function(_0x59867d){logger[_0x7f76('0x17')](_0x7f76('0x18'),_0x247403,_0x59867d);_0x11770c(_0x59867d);});});}exports[_0x7f76('0x1a')]=function(_0x21c2ca){var _0x54610a=this;return new Promise(function(_0x4623ef,_0x557c0f){return db[_0x7f76('0x1b')][_0x7f76('0x1c')]({'raw':_0x21c2ca['options']?_0x21c2ca['options'][_0x7f76('0x1d')]===undefined?!![]:![]:!![],'where':_0x21c2ca[_0x7f76('0x1e')]?_0x21c2ca['options'][_0x7f76('0x1f')]||null:null,'attributes':_0x21c2ca['options']?_0x21c2ca[_0x7f76('0x1e')][_0x7f76('0x20')]||null:null,'limit':_0x21c2ca[_0x7f76('0x1e')]?_0x21c2ca[_0x7f76('0x1e')][_0x7f76('0x21')]||null:null,'include':_0x21c2ca['options']?_0x21c2ca[_0x7f76('0x1e')]['include']?_['map'](_0x21c2ca[_0x7f76('0x1e')][_0x7f76('0x22')],function(_0x3492f4){return{'model':db[_0x3492f4['model']],'as':_0x3492f4['as'],'attributes':_0x3492f4[_0x7f76('0x20')],'include':_0x3492f4[_0x7f76('0x22')]?_[_0x7f76('0x23')](_0x3492f4[_0x7f76('0x22')],function(_0x27a030){return{'model':db[_0x27a030['model']],'as':_0x27a030['as'],'attributes':_0x27a030[_0x7f76('0x20')],'include':_0x27a030[_0x7f76('0x22')]?_['map'](_0x27a030['include'],function(_0xe459de){return{'model':db[_0xe459de['model']],'as':_0xe459de['as'],'attributes':_0xe459de[_0x7f76('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7f76('0x11')](function(_0xd5ba7){logger[_0x7f76('0x12')](_0x7f76('0x1a'),_0x21c2ca);logger[_0x7f76('0x14')]('GetVoiceExtension',_0x21c2ca,JSON[_0x7f76('0x16')](_0xd5ba7));_0x4623ef(_0xd5ba7);})[_0x7f76('0x24')](function(_0x109589){logger[_0x7f76('0x17')]('GetVoiceExtension',_0x109589[_0x7f76('0x19')],_0x21c2ca);_0x557c0f(_0x54610a[_0x7f76('0x17')](0x1f4,_0x109589[_0x7f76('0x19')]));});});}; \ No newline at end of file +var _0xb073=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','model','map','debug','catch','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3e0fab,_0x285e29){var _0x36cde8=function(_0x124a10){while(--_0x124a10){_0x3e0fab['push'](_0x3e0fab['shift']());}};_0x36cde8(++_0x285e29);}(_0xb073,0x187));var _0x3b07=function(_0x43f2d7,_0x3b37cb){_0x43f2d7=_0x43f2d7-0x0;var _0xcd377e=_0xb073[_0x43f2d7];return _0xcd377e;};'use strict';var _=require('lodash');var util=require(_0x3b07('0x0'));var moment=require('moment');var BPromise=require(_0x3b07('0x1'));var rs=require(_0x3b07('0x2'));var fs=require('fs');var Redis=require(_0x3b07('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b07('0x4'));var logger=require(_0x3b07('0x5'))(_0x3b07('0x6'));var config=require('../../config/environment');var jayson=require(_0x3b07('0x7'));var client=jayson[_0x3b07('0x8')][_0x3b07('0x9')]({'port':0x232a});config[_0x3b07('0xa')]=_[_0x3b07('0xb')](config[_0x3b07('0xa')],{'host':_0x3b07('0xc'),'port':0x18eb});var socket=require(_0x3b07('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x3b07('0xe')](socket);function respondWithRpcPromise(_0x716b0b,_0x31cf54,_0xf22a0d){return new BPromise(function(_0x470160,_0x1ba4b9){return client[_0x3b07('0xf')](_0x716b0b,_0xf22a0d)[_0x3b07('0x10')](function(_0x1f4577){logger[_0x3b07('0x11')](_0x3b07('0x12'),_0x31cf54,'request\x20sent');logger['debug'](_0x3b07('0x13'),_0x31cf54,_0x3b07('0x14'),JSON[_0x3b07('0x15')](_0x1f4577));if(_0x1f4577['error']){if(_0x1f4577[_0x3b07('0x16')]['code']===0x1f4){logger[_0x3b07('0x16')](_0x3b07('0x12'),_0x31cf54,_0x1f4577[_0x3b07('0x16')][_0x3b07('0x17')]);return _0x1ba4b9(_0x1f4577[_0x3b07('0x16')][_0x3b07('0x17')]);}logger[_0x3b07('0x16')](_0x3b07('0x12'),_0x31cf54,_0x1f4577[_0x3b07('0x16')][_0x3b07('0x17')]);return _0x470160(_0x1f4577['error']['message']);}else{logger['info'](_0x3b07('0x12'),_0x31cf54,_0x3b07('0x14'));_0x470160(_0x1f4577['result']['message']);}})['catch'](function(_0x25bfa8){logger['error'](_0x3b07('0x12'),_0x31cf54,_0x25bfa8);_0x1ba4b9(_0x25bfa8);});});}exports[_0x3b07('0x18')]=function(_0x3b66ff){var _0x3efe1c=this;return new Promise(function(_0x46f659,_0x21bef9){return db[_0x3b07('0x19')][_0x3b07('0x1a')]({'raw':_0x3b66ff[_0x3b07('0x1b')]?_0x3b66ff[_0x3b07('0x1b')][_0x3b07('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b66ff['options']?_0x3b66ff[_0x3b07('0x1b')]['where']||null:null,'attributes':_0x3b66ff[_0x3b07('0x1b')]?_0x3b66ff['options'][_0x3b07('0x1d')]||null:null,'limit':_0x3b66ff['options']?_0x3b66ff[_0x3b07('0x1b')][_0x3b07('0x1e')]||null:null,'include':_0x3b66ff[_0x3b07('0x1b')]?_0x3b66ff['options'][_0x3b07('0x1f')]?_['map'](_0x3b66ff[_0x3b07('0x1b')]['include'],function(_0xbb8016){return{'model':db[_0xbb8016[_0x3b07('0x20')]],'as':_0xbb8016['as'],'attributes':_0xbb8016[_0x3b07('0x1d')],'include':_0xbb8016[_0x3b07('0x1f')]?_[_0x3b07('0x21')](_0xbb8016[_0x3b07('0x1f')],function(_0x43d50f){return{'model':db[_0x43d50f['model']],'as':_0x43d50f['as'],'attributes':_0x43d50f[_0x3b07('0x1d')],'include':_0x43d50f[_0x3b07('0x1f')]?_[_0x3b07('0x21')](_0x43d50f[_0x3b07('0x1f')],function(_0x15c1a1){return{'model':db[_0x15c1a1[_0x3b07('0x20')]],'as':_0x15c1a1['as'],'attributes':_0x15c1a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4acc7d){logger['info'](_0x3b07('0x18'),_0x3b66ff);logger[_0x3b07('0x22')](_0x3b07('0x18'),_0x3b66ff,JSON[_0x3b07('0x15')](_0x4acc7d));_0x46f659(_0x4acc7d);})[_0x3b07('0x23')](function(_0x4491f2){logger['error']('GetVoiceExtension',_0x4491f2[_0x3b07('0x17')],_0x3b66ff);_0x21bef9(_0x3efe1c[_0x3b07('0x16')](0x1f4,_0x4491f2[_0x3b07('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0dfe695..8f09103 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x4a4ead,_0x2d7ca2){var _0x55cae0=function(_0x34d7c0){while(--_0x34d7c0){_0x4a4ead['push'](_0x4a4ead['shift']());}};_0x55cae0(++_0x2d7ca2);}(_0x53ec,0x192));var _0xc53e=function(_0x19ae7a,_0x5d3b51){_0x19ae7a=_0x19ae7a-0x0;var _0x30d82e=_0x53ec[_0x19ae7a];return _0x30d82e;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x4b4077,_0x236c6c){var _0x296908=function(_0x5b1b6f){while(--_0x5b1b6f){_0x4b4077['push'](_0x4b4077['shift']());}};_0x296908(++_0x236c6c);}(_0x53ec,0x192));var _0xc53e=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0x53ec[_0x27d0d8];return _0x2b79d1;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 21489d1..1aecc8f 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 _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(_0x23ca3a,_0xe44c43){var _0x5c1aab=function(_0x29bcdd){while(--_0x29bcdd){_0x23ca3a['push'](_0x23ca3a['shift']());}};_0x5c1aab(++_0xe44c43);}(_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 +var _0x7ee1=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','create','/:id','update','delete','exports','multer','express','Router'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x7ee1,0x8d));var _0x17ee=function(_0x13ac04,_0x1a9202){_0x13ac04=_0x13ac04-0x0;var _0x1fa418=_0x7ee1[_0x13ac04];return _0x1fa418;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/:id',auth[_0x17ee('0x9')](),controller['show']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x17ee('0xb')]);router['put'](_0x17ee('0xc'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')]('/:id',auth[_0x17ee('0x9')](),controller['destroy']);module[_0x17ee('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 294ac3a..2357cbe 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 _0x3bdb=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0xad8bde,_0x4af3a5){var _0x1de286=function(_0x4f4c12){while(--_0x4f4c12){_0xad8bde['push'](_0xad8bde['shift']());}};_0x1de286(++_0x4af3a5);}(_0x3bdb,0x9b));var _0xb3bd=function(_0x7b9961,_0x3b307a){_0x7b9961=_0x7b9961-0x0;var _0x485e66=_0x3bdb[_0x7b9961];return _0x485e66;};'use strict';var Sequelize=require(_0xb3bd('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb3bd('0x1')],'defaultValue':_0xb3bd('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xb3bd('0x1')],'defaultValue':'','allowNull':![],'unique':_0xb3bd('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb3bd('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4118dc){this[_0xb3bd('0x4')](_0xb3bd('0x5'),typeof _0x4118dc===_0xb3bd('0x6')&&_0x4118dc[_0xb3bd('0x7')]()?_0x4118dc[_0xb3bd('0x7')]():null);}},'pager':{'type':Sequelize[_0xb3bd('0x1')]},'tz':{'type':Sequelize[_0xb3bd('0x1')],'defaultValue':_0xb3bd('0x8')},'attach':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':_0xb3bd('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb3bd('0x9')]('yes','no'),'defaultValue':_0xb3bd('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xb3bd('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb3bd('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xb3bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xb3bd('0xa'),'no'),'defaultValue':_0xb3bd('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb3bd('0x9')](_0xb3bd('0xa'),'no'),'defaultValue':_0xb3bd('0xa'),'allowNull':![]},'stamp':{'type':_0xb3bd('0xb')},'emailsubject':{'type':Sequelize[_0xb3bd('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xb3bd('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb3bd('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb3bd('0xd')],'get':function(){return this[_0xb3bd('0xe')](_0xb3bd('0xf'))+_0xb3bd('0x10')+this[_0xb3bd('0xe')](_0xb3bd('0x11'));}}}; \ No newline at end of file +var _0x8bde=['setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x3907cf,_0x75e619){var _0x5928f8=function(_0x5d7e38){while(--_0x5d7e38){_0x3907cf['push'](_0x3907cf['shift']());}};_0x5928f8(++_0x75e619);}(_0x8bde,0xdf));var _0xe8bd=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x8bde[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0xe8bd('0x0'));module[_0xe8bd('0x1')]={'customer_id':{'type':Sequelize[_0xe8bd('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe8bd('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xe8bd('0x4')},'password':{'type':Sequelize[_0xe8bd('0x2')]},'fullname':{'type':Sequelize[_0xe8bd('0x2')]},'email':{'type':Sequelize[_0xe8bd('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ed305){this[_0xe8bd('0x5')](_0xe8bd('0x6'),typeof _0x1ed305===_0xe8bd('0x7')&&_0x1ed305[_0xe8bd('0x8')]()?_0x1ed305['trim']():null);}},'pager':{'type':Sequelize[_0xe8bd('0x2')]},'tz':{'type':Sequelize[_0xe8bd('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe8bd('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe8bd('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe8bd('0x9')](_0xe8bd('0xa'),'no'),'defaultValue':_0xe8bd('0xa'),'allowNull':![]},'stamp':{'type':_0xe8bd('0xc')},'emailsubject':{'type':Sequelize[_0xe8bd('0x2')]},'emailbody':{'type':Sequelize[_0xe8bd('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe8bd('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe8bd('0xe')],'get':function(){return this[_0xe8bd('0xf')](_0xe8bd('0x10'))+_0xe8bd('0x11')+this[_0xe8bd('0xf')](_0xe8bd('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index dbca8fa..67e5ecd 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 _0x0565=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','Voicemails','sendStatus','stack','name','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','error','update','findOne','VoiceMailMessage','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x45385c,_0x840419){var _0x523eb1=function(_0x557e5c){while(--_0x557e5c){_0x45385c['push'](_0x45385c['shift']());}};_0x523eb1(++_0x840419);}(_0x0565,0xf2));var _0x5056=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0565[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){var _0x37f7b5=_0x29e166['get']({'plain':!![]});var _0x267048=_0x5056('0x25');return db['UserProfileResource'][_0x5056('0x24')]({'where':{'type':_0x267048,'resourceId':_0x37f7b5['id']}})['then'](function(){return _0x29e166;});})[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)[_0x5056('0x1a')]();});}};}function handleEntityNotFound(_0x2b8fab,_0x45f600){return function(_0x50f2a8){if(!_0x50f2a8){_0x2b8fab[_0x5056('0x26')](0x194);}return _0x50f2a8;};}function handleError(_0x346e9e,_0x14cb84){_0x14cb84=_0x14cb84||0x1f4;return function(_0x2ac79a){logger['error'](_0x2ac79a[_0x5056('0x27')]);if(_0x2ac79a['name']){delete _0x2ac79a[_0x5056('0x28')];}_0x346e9e['status'](_0x14cb84)['send'](_0x2ac79a);};}exports['index']=function(_0x113be0,_0x252f75){var _0x482939={},_0x27f4be={},_0x2c5728={'count':0x0,'rows':[]};var _0x9e2986=_[_0x5056('0x29')](db[_0x5056('0x2a')][_0x5056('0x2b')],function(_0x173fac){return{'name':_0x173fac[_0x5056('0x2c')],'type':_0x173fac[_0x5056('0x2d')][_0x5056('0x2e')]};});_0x27f4be[_0x5056('0x2f')]=_['map'](_0x9e2986,'name');_0x27f4be[_0x5056('0x30')]=_[_0x5056('0x31')](_0x113be0['query']);_0x27f4be[_0x5056('0x32')]=_[_0x5056('0x33')](_0x27f4be['model'],_0x27f4be[_0x5056('0x30')]);_0x482939[_0x5056('0x34')]=_[_0x5056('0x33')](_0x27f4be[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x113be0[_0x5056('0x30')][_0x5056('0x35')]));_0x482939[_0x5056('0x34')]=_0x482939[_0x5056('0x34')][_0x5056('0x36')]?_0x482939[_0x5056('0x34')]:_0x27f4be[_0x5056('0x2f')];if(!_0x113be0[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x482939['limit']=qs[_0x5056('0x1d')](_0x113be0['query'][_0x5056('0x1d')]);_0x482939[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x113be0[_0x5056('0x30')]['offset']);}_0x482939[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x113be0['query'][_0x5056('0x3a')]);_0x482939['where']=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x113be0[_0x5056('0x30')],_0x27f4be['filters']),_0x9e2986);if(_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]){_0x482939[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x482939[_0x5056('0x3d')],{'$or':_[_0x5056('0x29')](_0x9e2986,function(_0x1aa311){if(_0x1aa311[_0x5056('0x2d')]!==_0x5056('0x3f')){var _0x430db0={};_0x430db0[_0x1aa311[_0x5056('0x28')]]={'$like':'%'+_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]+'%'};return _0x430db0;}})});}_0x482939=_[_0x5056('0x3e')]({},_0x482939,_0x113be0[_0x5056('0x40')]);var _0x351ebd={'where':_0x482939['where']};return db['VoiceMail'][_0x5056('0x1f')](_0x351ebd)[_0x5056('0x23')](function(_0x6946b4){_0x2c5728[_0x5056('0x1f')]=_0x6946b4;if(_0x113be0[_0x5056('0x30')][_0x5056('0x41')]){_0x482939[_0x5056('0x42')]=[{'all':!![]}];}return db[_0x5056('0x2a')]['findAll'](_0x482939);})['then'](function(_0x68a385){_0x2c5728[_0x5056('0x43')]=_0x68a385;return _0x2c5728;})[_0x5056('0x23')](respondWithFilteredResult(_0x252f75,_0x482939))['catch'](handleError(_0x252f75,null));};exports[_0x5056('0x44')]=function(_0x5b99e9,_0x285fee){var _0x40375b={'raw':!![],'where':{'id':_0x5b99e9[_0x5056('0x45')]['id']}},_0x2ef93e={};_0x2ef93e[_0x5056('0x2f')]=_[_0x5056('0x31')](db['VoiceMail'][_0x5056('0x2b')]);_0x2ef93e[_0x5056('0x30')]=_[_0x5056('0x31')](_0x5b99e9['query']);_0x2ef93e['filters']=_['intersection'](_0x2ef93e['model'],_0x2ef93e[_0x5056('0x30')]);_0x40375b[_0x5056('0x34')]=_[_0x5056('0x33')](_0x2ef93e[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x5b99e9['query']['fields']));_0x40375b[_0x5056('0x34')]=_0x40375b[_0x5056('0x34')][_0x5056('0x36')]?_0x40375b[_0x5056('0x34')]:_0x2ef93e[_0x5056('0x2f')];if(_0x5b99e9[_0x5056('0x30')][_0x5056('0x41')]){_0x40375b['include']=[{'all':!![]}];}_0x40375b=_['merge']({},_0x40375b,_0x5b99e9[_0x5056('0x40')]);return db[_0x5056('0x2a')]['find'](_0x40375b)[_0x5056('0x23')](handleEntityNotFound(_0x285fee,null))[_0x5056('0x23')](respondWithResult(_0x285fee,null))['catch'](handleError(_0x285fee,null));};exports['create']=function(_0x83d8e4,_0x1ab1a9){return db['VoiceMail']['create'](_0x83d8e4[_0x5056('0x46')],{})[_0x5056('0x23')](function(_0x528575){var _0x5c3f73=_0x83d8e4[_0x5056('0x47')][_0x5056('0x48')]({'plain':!![]});if(!_0x5c3f73)throw new Error(_0x5056('0x49'));if(_0x5c3f73[_0x5056('0x4a')]===_0x5056('0x47')){var _0xdf427c=_0x528575[_0x5056('0x48')]({'plain':!![]});var _0x366ba2=_0x5056('0x25');return db[_0x5056('0x4b')][_0x5056('0x4c')]({'where':{'name':_0x366ba2,'userProfileId':_0x5c3f73[_0x5056('0x4d')]},'raw':!![]})[_0x5056('0x23')](function(_0x327821){if(_0x327821&&_0x327821[_0x5056('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0xdf427c[_0x5056('0x28')],'resourceId':_0xdf427c['id'],'type':_0x327821[_0x5056('0x28')],'sectionId':_0x327821['id']},{})[_0x5056('0x23')](function(){return _0x528575;});}else{return _0x528575;}})[_0x5056('0x4f')](function(_0x35776b){logger[_0x5056('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35776b);throw _0x35776b;});}return _0x528575;})[_0x5056('0x23')](respondWithResult(_0x1ab1a9,0xc9))[_0x5056('0x4f')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x51')]=function(_0x3d22cc,_0x1ff74a){if(_0x3d22cc[_0x5056('0x46')]['id']){delete _0x3d22cc[_0x5056('0x46')]['id'];}return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x3d22cc[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x1ff74a,null))[_0x5056('0x23')](saveUpdates(_0x3d22cc[_0x5056('0x46')],null))['then'](respondWithResult(_0x1ff74a,null))[_0x5056('0x4f')](handleError(_0x1ff74a,null));};exports[_0x5056('0x24')]=function(_0x2df8e8,_0x5363fd){return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x2df8e8[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x5363fd,null))['then'](removeEntity(_0x5363fd,null))['catch'](handleError(_0x5363fd,null));};exports['getMessages']=function(_0x427007,_0x55ae24,_0x1934e1){return db[_0x5056('0x2a')][_0x5056('0x52')]({'where':{'id':_0x427007[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x55ae24,null))[_0x5056('0x23')](function(_0x5330b4){var _0x48568b;var _0x25da13={},_0x333d22={};_0x333d22['model']=_[_0x5056('0x31')](db[_0x5056('0x53')][_0x5056('0x2b')]);_0x333d22[_0x5056('0x30')]=_[_0x5056('0x31')](_0x427007['query']);_0x333d22[_0x5056('0x32')]=_[_0x5056('0x33')](_0x333d22['model'],_0x333d22[_0x5056('0x30')]);_0x25da13[_0x5056('0x34')]=_[_0x5056('0x33')](_0x333d22[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x427007[_0x5056('0x30')][_0x5056('0x35')]));_0x25da13[_0x5056('0x34')]=_0x25da13[_0x5056('0x34')][_0x5056('0x36')]?_0x25da13[_0x5056('0x34')]:_0x333d22[_0x5056('0x2f')];if(!_0x427007[_0x5056('0x30')]['hasOwnProperty'](_0x5056('0x38'))){_0x25da13[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x427007[_0x5056('0x30')][_0x5056('0x1d')]);_0x25da13[_0x5056('0x1c')]=qs['offset'](_0x427007[_0x5056('0x30')]['offset']);}_0x25da13[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x427007['query']['sort']);_0x25da13[_0x5056('0x3d')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x427007[_0x5056('0x30')],_0x333d22['filters']));if(_0x427007['query'][_0x5056('0x3c')]){_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13['where'],{'$or':_[_0x5056('0x29')](_0x25da13['attributes'],function(_0x57cb62){var _0x1bfae9={};_0x1bfae9[_0x57cb62]={'$like':'%'+_0x427007[_0x5056('0x30')]['filter']+'%'};return _0x1bfae9;})});}_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13[_0x5056('0x3d')],{'mailboxuser':_0x5330b4[_0x5056('0x54')]});_0x25da13=_[_0x5056('0x3e')]({},_0x25da13,_0x427007[_0x5056('0x40')]);return db[_0x5056('0x53')]['findAndCountAll'](_0x25da13)[_0x5056('0x23')](respondWithFilteredResult(_0x55ae24,_0x25da13));})[_0x5056('0x4f')](handleError(_0x55ae24,null));}; \ No newline at end of file +var _0x57f8=['index','map','VoiceMail','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','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','name','send'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x57f8,0x198));var _0x857f=function(_0x26f081,_0x4277f3){_0x26f081=_0x26f081-0x0;var _0x4bf032=_0x57f8[_0x26f081];return _0x4bf032;};'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['VoiceMail'][_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('0x26')]=function(_0x153e4e,_0x4bb5fc){if(_0x153e4e[_0x857f('0x50')]['id']){delete _0x153e4e[_0x857f('0x50')]['id'];}return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x153e4e[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x4bb5fc,null))[_0x857f('0x28')](saveUpdates(_0x153e4e[_0x857f('0x50')],null))['then'](respondWithResult(_0x4bb5fc,null))['catch'](handleError(_0x4bb5fc,null));};exports[_0x857f('0x27')]=function(_0x477653,_0x14b2ff){return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x477653[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14b2ff,null))[_0x857f('0x28')](removeEntity(_0x14b2ff,null))[_0x857f('0x48')](handleError(_0x14b2ff,null));};exports['getMessages']=function(_0x280a95,_0x5e3759,_0x17f12c){return db[_0x857f('0x31')]['findOne']({'where':{'id':_0x280a95[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x5e3759,null))[_0x857f('0x28')](function(_0x464208){var _0x868071;var _0x1d096b={},_0x2fed09={};_0x2fed09[_0x857f('0x34')]=_['keys'](db[_0x857f('0x57')][_0x857f('0x4c')]);_0x2fed09[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x280a95[_0x857f('0x35')]);_0x2fed09[_0x857f('0x36')]=_[_0x857f('0x37')](_0x2fed09[_0x857f('0x34')],_0x2fed09[_0x857f('0x35')]);_0x1d096b[_0x857f('0x38')]=_[_0x857f('0x37')](_0x2fed09['model'],qs[_0x857f('0x4d')](_0x280a95[_0x857f('0x35')][_0x857f('0x4d')]));_0x1d096b[_0x857f('0x38')]=_0x1d096b['attributes'][_0x857f('0x39')]?_0x1d096b['attributes']:_0x2fed09[_0x857f('0x34')];if(!_0x280a95[_0x857f('0x35')][_0x857f('0x58')](_0x857f('0x3a'))){_0x1d096b['limit']=qs['limit'](_0x280a95[_0x857f('0x35')][_0x857f('0x21')]);_0x1d096b[_0x857f('0x1f')]=qs['offset'](_0x280a95[_0x857f('0x35')]['offset']);}_0x1d096b[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x280a95[_0x857f('0x35')]['sort']);_0x1d096b['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x280a95[_0x857f('0x35')],_0x2fed09[_0x857f('0x36')]));if(_0x280a95[_0x857f('0x35')][_0x857f('0x3e')]){_0x1d096b[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x1d096b['where'],{'$or':_['map'](_0x1d096b[_0x857f('0x38')],function(_0xb60b6e){var _0x3f144e={};_0x3f144e[_0xb60b6e]={'$like':'%'+_0x280a95[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x3f144e;})});}_0x1d096b[_0x857f('0x3f')]=_['merge'](_0x1d096b[_0x857f('0x3f')],{'mailboxuser':_0x464208[_0x857f('0x59')]});_0x1d096b=_[_0x857f('0x42')]({},_0x1d096b,_0x280a95[_0x857f('0x43')]);return db[_0x857f('0x57')][_0x857f('0x5a')](_0x1d096b)[_0x857f('0x28')](respondWithFilteredResult(_0x5e3759,_0x1d096b));})[_0x857f('0x48')](handleError(_0x5e3759,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0fb4834..262648b 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 _0xe254=['context','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','mailbox_context'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe254,0xb7));var _0x4e25=function(_0x389390,_0x289af9){_0x389390=_0x389390-0x0;var _0x303e59=_0xe254[_0x389390];return _0x303e59;};'use strict';var _=require('lodash');var util=require(_0x4e25('0x0'));var logger=require(_0x4e25('0x1'))(_0x4e25('0x2'));var moment=require(_0x4e25('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e25('0x4'));var fs=require('fs');var path=require(_0x4e25('0x5'));var rimraf=require(_0x4e25('0x6'));var config=require(_0x4e25('0x7'));var attributes=require('./voiceMail.attributes');module[_0x4e25('0x8')]=function(_0x487f1f,_0xa513ef){return _0x487f1f[_0x4e25('0x9')](_0x4e25('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x4e25('0xb'),'fields':['mailbox',_0x4e25('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5af8=['../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x283081,_0x1d174a){var _0x37c1d2=function(_0x76d8ae){while(--_0x76d8ae){_0x283081['push'](_0x283081['shift']());}};_0x37c1d2(++_0x1d174a);}(_0x5af8,0x181));var _0x85af=function(_0x4ff886,_0x26067e){_0x4ff886=_0x4ff886-0x0;var _0x2eb543=_0x5af8[_0x4ff886];return _0x2eb543;};'use strict';var _=require(_0x85af('0x0'));var util=require(_0x85af('0x1'));var logger=require(_0x85af('0x2'))(_0x85af('0x3'));var moment=require(_0x85af('0x4'));var BPromise=require('bluebird');var rp=require(_0x85af('0x5'));var fs=require('fs');var path=require(_0x85af('0x6'));var rimraf=require('rimraf');var config=require(_0x85af('0x7'));var attributes=require(_0x85af('0x8'));module['exports']=function(_0x3a279d,_0x2f84b7){return _0x3a279d[_0x85af('0x9')](_0x85af('0xa'),attributes,{'tableName':_0x85af('0xb'),'paranoid':![],'indexes':[{'name':_0x85af('0xc'),'fields':[_0x85af('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 56d3651..18b2666 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 _0xd79e=['moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util'];(function(_0x4d24bd,_0xb801a4){var _0x134ff5=function(_0x5ae88d){while(--_0x5ae88d){_0x4d24bd['push'](_0x4d24bd['shift']());}};_0x134ff5(++_0xb801a4);}(_0xd79e,0x1d9));var _0xed79=function(_0x5b1538,_0x2ca42c){_0x5b1538=_0x5b1538-0x0;var _0x3cbd28=_0xd79e[_0x5b1538];return _0x3cbd28;};'use strict';var _=require(_0xed79('0x0'));var util=require(_0xed79('0x1'));var moment=require(_0xed79('0x2'));var BPromise=require(_0xed79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed79('0x4'))(_0xed79('0x5'));var config=require(_0xed79('0x6'));var jayson=require(_0xed79('0x7'));var client=jayson[_0xed79('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce942,_0x55ba55,_0x497187){return new BPromise(function(_0xdc1291,_0x369256){return client['request'](_0x2ce942,_0x497187)[_0xed79('0x9')](function(_0x3353bd){logger['info'](_0xed79('0xa'),_0x55ba55,'request\x20sent');logger['debug'](_0xed79('0xb'),_0x55ba55,_0xed79('0xc'),JSON[_0xed79('0xd')](_0x3353bd));if(_0x3353bd['error']){if(_0x3353bd[_0xed79('0xe')][_0xed79('0xf')]===0x1f4){logger[_0xed79('0xe')](_0xed79('0xa'),_0x55ba55,_0x3353bd[_0xed79('0xe')][_0xed79('0x10')]);return _0x369256(_0x3353bd[_0xed79('0xe')]['message']);}logger[_0xed79('0xe')](_0xed79('0xa'),_0x55ba55,_0x3353bd[_0xed79('0xe')][_0xed79('0x10')]);return _0xdc1291(_0x3353bd[_0xed79('0xe')][_0xed79('0x10')]);}else{logger[_0xed79('0x11')](_0xed79('0xa'),_0x55ba55,_0xed79('0xc'));_0xdc1291(_0x3353bd['result']['message']);}})[_0xed79('0x12')](function(_0x5e11eb){logger['error'](_0xed79('0xa'),_0x55ba55,_0x5e11eb);_0x369256(_0x5e11eb);});});} \ No newline at end of file +var _0x0284=['error','VoiceMail,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1c0e0a,_0x3df5cf){var _0x339c78=function(_0xbf3b80){while(--_0xbf3b80){_0x1c0e0a['push'](_0x1c0e0a['shift']());}};_0x339c78(++_0x3df5cf);}(_0x0284,0xab));var _0x4028=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x0284[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x4028('0x0'));var util=require(_0x4028('0x1'));var moment=require(_0x4028('0x2'));var BPromise=require('bluebird');var rs=require(_0x4028('0x3'));var fs=require('fs');var Redis=require(_0x4028('0x4'));var db=require(_0x4028('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4028('0x6'))(_0x4028('0x7'));var config=require(_0x4028('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4028('0x9')][_0x4028('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15083a,_0x3a31e9,_0x1bede8){return new BPromise(function(_0x28deb9,_0x123761){return client[_0x4028('0xb')](_0x15083a,_0x1bede8)[_0x4028('0xc')](function(_0x38a929){logger[_0x4028('0xd')]('VoiceMail,\x20%s,\x20%s',_0x3a31e9,'request\x20sent');logger[_0x4028('0xe')](_0x4028('0xf'),_0x3a31e9,_0x4028('0x10'),JSON[_0x4028('0x11')](_0x38a929));if(_0x38a929[_0x4028('0x12')]){if(_0x38a929['error']['code']===0x1f4){logger['error'](_0x4028('0x13'),_0x3a31e9,_0x38a929[_0x4028('0x12')]['message']);return _0x123761(_0x38a929[_0x4028('0x12')][_0x4028('0x14')]);}logger[_0x4028('0x12')](_0x4028('0x13'),_0x3a31e9,_0x38a929[_0x4028('0x12')]['message']);return _0x28deb9(_0x38a929[_0x4028('0x12')][_0x4028('0x14')]);}else{logger[_0x4028('0xd')](_0x4028('0x13'),_0x3a31e9,_0x4028('0x10'));_0x28deb9(_0x38a929['result'][_0x4028('0x14')]);}})['catch'](function(_0x487a23){logger[_0x4028('0x12')](_0x4028('0x13'),_0x3a31e9,_0x487a23);_0x123761(_0x487a23);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0d50984..fc4ee8a 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 _0xe1b5=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','index','isAuthenticated','/:id/download','download','create','put','/:id'];(function(_0x20db74,_0x1e9034){var _0x153822=function(_0x44b02a){while(--_0x44b02a){_0x20db74['push'](_0x20db74['shift']());}};_0x153822(++_0x1e9034);}(_0xe1b5,0x9e));var _0x5e1b=function(_0xf854d8,_0x3a9a03){_0xf854d8=_0xf854d8-0x0;var _0x559eb2=_0xe1b5[_0xf854d8];return _0x559eb2;};'use strict';var multer=require(_0x5e1b('0x0'));var util=require(_0x5e1b('0x1'));var path=require(_0x5e1b('0x2'));var timeout=require(_0x5e1b('0x3'));var express=require(_0x5e1b('0x4'));var router=express[_0x5e1b('0x5')]();var fs_extra=require(_0x5e1b('0x6'));var auth=require(_0x5e1b('0x7'));var interaction=require(_0x5e1b('0x8'));var config=require('../../config/environment');var controller=require(_0x5e1b('0x9'));router[_0x5e1b('0xa')]('/',auth['isAuthenticated'](),controller[_0x5e1b('0xb')]);router[_0x5e1b('0xa')]('/:id',auth[_0x5e1b('0xc')](),controller['show']);router[_0x5e1b('0xa')](_0x5e1b('0xd'),auth[_0x5e1b('0xc')](),controller[_0x5e1b('0xe')]);router['post']('/',auth[_0x5e1b('0xc')](),controller[_0x5e1b('0xf')]);router[_0x5e1b('0x10')](_0x5e1b('0x11'),auth['isAuthenticated'](),controller[_0x5e1b('0x12')]);router[_0x5e1b('0x13')]('/:id',auth[_0x5e1b('0xc')](),controller[_0x5e1b('0x14')]);module[_0x5e1b('0x15')]=router; \ No newline at end of file +var _0x29d4=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id'];(function(_0x41882a,_0x57d4b6){var _0x224245=function(_0x558f92){while(--_0x558f92){_0x41882a['push'](_0x41882a['shift']());}};_0x224245(++_0x57d4b6);}(_0x29d4,0xce));var _0x429d=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x29d4[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require('multer');var util=require(_0x429d('0x0'));var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x429d('0x5'));var controller=require(_0x429d('0x6'));router[_0x429d('0x7')]('/',auth[_0x429d('0x8')](),controller['index']);router['get'](_0x429d('0x9'),auth[_0x429d('0x8')](),controller[_0x429d('0xa')]);router[_0x429d('0x7')]('/:id/download',auth[_0x429d('0x8')](),controller['download']);router[_0x429d('0xb')]('/',auth[_0x429d('0x8')](),controller[_0x429d('0xc')]);router[_0x429d('0xd')]('/:id',auth[_0x429d('0x8')](),controller[_0x429d('0xe')]);router[_0x429d('0xf')](_0x429d('0x9'),auth[_0x429d('0x8')](),controller[_0x429d('0x10')]);module[_0x429d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9e800e0..469843d 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 _0x0b7f=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x1ee513,_0x5ca65d){var _0x326089=function(_0x2618c2){while(--_0x2618c2){_0x1ee513['push'](_0x1ee513['shift']());}};_0x326089(++_0x5ca65d);}(_0x0b7f,0x103));var _0xf0b7=function(_0x83aa1a,_0x54c5cb){_0x83aa1a=_0x83aa1a-0x0;var _0x162dcb=_0x0b7f[_0x83aa1a];return _0x162dcb;};'use strict';var Sequelize=require(_0xf0b7('0x0'));module[_0xf0b7('0x1')]={'name':{'type':Sequelize[_0xf0b7('0x2')],'get':function(_0x2cbbe0){return this[_0xf0b7('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xf0b7('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xf0b7('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':''},'stamp':{'type':_0xf0b7('0x7'),'defaultValue':Sequelize[_0xf0b7('0x8')](_0xf0b7('0x9'))}}; \ No newline at end of file +var _0x457b=['long','TIMESTAMP','literal','VIRTUAL','INTEGER','STRING'];(function(_0x5eab06,_0x3d4afe){var _0x5aafb0=function(_0x7645f7){while(--_0x7645f7){_0x5eab06['push'](_0x5eab06['shift']());}};_0x5aafb0(++_0x3d4afe);}(_0x457b,0x1ef));var _0xb457=function(_0x48921a,_0x5d6dca){_0x48921a=_0x48921a-0x0;var _0x2efcdc=_0x457b[_0x48921a];return _0x2efcdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb457('0x0')],'get':function(_0x1b1a67){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xb457('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xb457('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0xb457('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xb457('0x4'),'defaultValue':Sequelize[_0xb457('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3a7a19c..f559cf0 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 _0xb01f=['then','destroy','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','find','create','body','update','recording','msg_id','Sequelize','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','reject'];(function(_0x3a6fe8,_0x4aaa6b){var _0x248ad4=function(_0x1c7dec){while(--_0x1c7dec){_0x3a6fe8['push'](_0x3a6fe8['shift']());}};_0x248ad4(++_0x4aaa6b);}(_0xb01f,0x123));var _0xfb01=function(_0x434b35,_0x53811c){_0x434b35=_0x434b35-0x0;var _0x51d4da=_0xb01f[_0x434b35];return _0x51d4da;};'use strict';var emlformat=require(_0xfb01('0x0'));var rimraf=require(_0xfb01('0x1'));var zipdir=require(_0xfb01('0x2'));var jsonpatch=require(_0xfb01('0x3'));var rp=require(_0xfb01('0x4'));var moment=require('moment');var BPromise=require(_0xfb01('0x5'));var Mustache=require(_0xfb01('0x6'));var util=require(_0xfb01('0x7'));var path=require(_0xfb01('0x8'));var sox=require('sox');var csv=require(_0xfb01('0x9'));var ejs=require(_0xfb01('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb01('0xb'));var jsforce=require(_0xfb01('0xc'));var deskjs=require(_0xfb01('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb01('0xe'));var Papa=require('papaparse');var Redis=require(_0xfb01('0xf'));var authService=require(_0xfb01('0x10'));var qs=require(_0xfb01('0x11'));var as=require(_0xfb01('0x12'));var hardwareService=require(_0xfb01('0x13'));var logger=require(_0xfb01('0x14'))(_0xfb01('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfb01('0x16'));var db=require(_0xfb01('0x17'))['db'];function respondWithStatusCode(_0x5ada2c,_0x159ac1){_0x159ac1=_0x159ac1||0xcc;return function(_0x4abe41){if(_0x4abe41){return _0x5ada2c[_0xfb01('0x18')](_0x159ac1);}return _0x5ada2c[_0xfb01('0x19')](_0x159ac1)[_0xfb01('0x1a')]();};}function respondWithResult(_0x47a68d,_0xb7b209){_0xb7b209=_0xb7b209||0xc8;return function(_0x32902c){if(_0x32902c){return _0x47a68d[_0xfb01('0x19')](_0xb7b209)[_0xfb01('0x1b')](_0x32902c);}};}function respondWithFilteredResult(_0x14976d,_0x1e06f3){return function(_0x9496f9){if(_0x9496f9){var _0x2e7475=typeof _0x1e06f3['offset']===_0xfb01('0x1c')&&typeof _0x1e06f3[_0xfb01('0x1d')]===_0xfb01('0x1c');var _0x191d28=_0x9496f9['count'];var _0x222c68=_0x2e7475?0x0:_0x1e06f3[_0xfb01('0x1e')];var _0x5de33b=_0x2e7475?_0x9496f9[_0xfb01('0x1f')]:_0x1e06f3[_0xfb01('0x1e')]+_0x1e06f3['limit'];var _0x102ecf;if(_0x5de33b>=_0x191d28){_0x5de33b=_0x191d28;_0x102ecf=0xc8;}else{_0x102ecf=0xce;}_0x14976d['status'](_0x102ecf);return _0x14976d['set']('Content-Range',_0x222c68+'-'+_0x5de33b+'/'+_0x191d28)[_0xfb01('0x1b')](_0x9496f9);}return null;};}function patchUpdates(_0xb2f94d){return function(_0x5e3306){try{jsonpatch['apply'](_0x5e3306,_0xb2f94d,!![]);}catch(_0x471ffb){return BPromise[_0xfb01('0x20')](_0x471ffb);}return _0x5e3306['save']();};}function saveUpdates(_0x44b25e,_0x3e9c00){return function(_0x1552b0){if(_0x1552b0){return _0x1552b0['update'](_0x44b25e)[_0xfb01('0x21')](function(_0x17ae0a){return _0x17ae0a;});}return null;};}function removeEntity(_0x3f7608,_0x3861ac){return function(_0x378f07){if(_0x378f07){return _0x378f07[_0xfb01('0x22')]()[_0xfb01('0x21')](function(){_0x3f7608[_0xfb01('0x19')](0xcc)[_0xfb01('0x1a')]();});}};}function handleEntityNotFound(_0x24c85f,_0x58f182){return function(_0x24749b){if(!_0x24749b){_0x24c85f[_0xfb01('0x18')](0x194);}return _0x24749b;};}function handleError(_0x49da93,_0x278a12){_0x278a12=_0x278a12||0x1f4;return function(_0x59ce8f){logger[_0xfb01('0x23')](_0x59ce8f['stack']);if(_0x59ce8f['name']){delete _0x59ce8f[_0xfb01('0x24')];}_0x49da93['status'](_0x278a12)[_0xfb01('0x25')](_0x59ce8f);};}exports[_0xfb01('0x26')]=function(_0x30f7cc,_0x2d38a9){var _0x28f0bf={},_0x7e4482={},_0x51614f={'count':0x0,'rows':[]};var _0x325efd=_[_0xfb01('0x27')](db[_0xfb01('0x28')][_0xfb01('0x29')],function(_0x5b4d8b){return{'name':_0x5b4d8b[_0xfb01('0x2a')],'type':_0x5b4d8b[_0xfb01('0x2b')][_0xfb01('0x2c')]};});_0x7e4482[_0xfb01('0x2d')]=_[_0xfb01('0x2e')](_[_0xfb01('0x27')](_0x325efd,_0xfb01('0x24')),[_0xfb01('0x24')]);_0x7e4482['query']=_[_0xfb01('0x2f')](_0x30f7cc[_0xfb01('0x30')]);_0x7e4482[_0xfb01('0x31')]=_[_0xfb01('0x32')](_0x7e4482[_0xfb01('0x2d')],_0x7e4482[_0xfb01('0x30')]);_0x28f0bf[_0xfb01('0x33')]=_[_0xfb01('0x32')](_0x7e4482[_0xfb01('0x2d')],qs[_0xfb01('0x34')](_0x30f7cc['query'][_0xfb01('0x34')]));_0x28f0bf[_0xfb01('0x33')]=_0x28f0bf[_0xfb01('0x33')][_0xfb01('0x35')]?_0x28f0bf[_0xfb01('0x33')]:_0x7e4482[_0xfb01('0x2d')];if(!_0x30f7cc[_0xfb01('0x30')][_0xfb01('0x36')](_0xfb01('0x37'))){_0x28f0bf[_0xfb01('0x1d')]=qs[_0xfb01('0x1d')](_0x30f7cc['query'][_0xfb01('0x1d')]);_0x28f0bf[_0xfb01('0x1e')]=qs[_0xfb01('0x1e')](_0x30f7cc[_0xfb01('0x30')][_0xfb01('0x1e')]);}_0x28f0bf[_0xfb01('0x38')]=qs[_0xfb01('0x39')](_0x30f7cc['query']['sort']);_0x28f0bf[_0xfb01('0x3a')]=qs[_0xfb01('0x31')](_[_0xfb01('0x3b')](_0x30f7cc['query'],_0x7e4482[_0xfb01('0x31')]),_0x325efd);if(_0x30f7cc[_0xfb01('0x30')][_0xfb01('0x3c')]){_0x28f0bf[_0xfb01('0x3a')]=_['merge'](_0x28f0bf[_0xfb01('0x3a')],{'$or':_[_0xfb01('0x27')](_0x325efd,function(_0x181713){if(_0x181713[_0xfb01('0x2b')]!==_0xfb01('0x3d')){var _0x2ecf47={};_0x2ecf47[_0x181713['name']]={'$like':'%'+_0x30f7cc['query']['filter']+'%'};return _0x2ecf47;}})});}_0x28f0bf=_[_0xfb01('0x3e')]({},_0x28f0bf,_0x30f7cc['options']);var _0x31257d={'where':_0x28f0bf[_0xfb01('0x3a')]};return db[_0xfb01('0x28')][_0xfb01('0x1f')](_0x31257d)[_0xfb01('0x21')](function(_0x15331b){_0x51614f['count']=_0x15331b;if(_0x30f7cc['query'][_0xfb01('0x3f')]){_0x28f0bf[_0xfb01('0x40')]=[{'all':!![]}];}return db[_0xfb01('0x28')]['findAll'](_0x28f0bf);})[_0xfb01('0x21')](function(_0x2ea896){_0x51614f[_0xfb01('0x41')]=_0x2ea896;return _0x51614f;})['then'](respondWithFilteredResult(_0x2d38a9,_0x28f0bf))[_0xfb01('0x42')](handleError(_0x2d38a9,null));};exports[_0xfb01('0x43')]=function(_0x5d42c2,_0x35178e){var _0x3192db={'raw':!![],'where':{'id':_0x5d42c2[_0xfb01('0x44')]['id']}},_0x5862d0={};_0x5862d0[_0xfb01('0x2d')]=_[_0xfb01('0x2f')](db[_0xfb01('0x28')]['rawAttributes']);_0x5862d0[_0xfb01('0x30')]=_[_0xfb01('0x2f')](_0x5d42c2[_0xfb01('0x30')]);_0x5862d0[_0xfb01('0x31')]=_[_0xfb01('0x32')](_0x5862d0[_0xfb01('0x2d')],_0x5862d0[_0xfb01('0x30')]);_0x3192db[_0xfb01('0x33')]=_['intersection'](_0x5862d0['model'],qs[_0xfb01('0x34')](_0x5d42c2[_0xfb01('0x30')][_0xfb01('0x34')]));_0x3192db[_0xfb01('0x33')]=_0x3192db[_0xfb01('0x33')][_0xfb01('0x35')]?_0x3192db['attributes']:_0x5862d0[_0xfb01('0x2d')];if(_0x5d42c2[_0xfb01('0x30')][_0xfb01('0x3f')]){_0x3192db['include']=[{'all':!![]}];}_0x3192db=_[_0xfb01('0x3e')]({},_0x3192db,_0x5d42c2['options']);return db['VoiceMailMessage'][_0xfb01('0x45')](_0x3192db)[_0xfb01('0x21')](handleEntityNotFound(_0x35178e,null))[_0xfb01('0x21')](respondWithResult(_0x35178e,null))[_0xfb01('0x42')](handleError(_0x35178e,null));};exports[_0xfb01('0x46')]=function(_0x32823e,_0x142520){return db[_0xfb01('0x28')][_0xfb01('0x46')](_0x32823e[_0xfb01('0x47')],{})['then'](respondWithResult(_0x142520,0xc9))['catch'](handleError(_0x142520,null));};exports[_0xfb01('0x48')]=function(_0x7c2e4d,_0x4e73b4){if(_0x7c2e4d[_0xfb01('0x47')]['id']){delete _0x7c2e4d[_0xfb01('0x47')]['id'];}return db[_0xfb01('0x28')][_0xfb01('0x45')]({'where':{'id':_0x7c2e4d[_0xfb01('0x44')]['id']}})[_0xfb01('0x21')](handleEntityNotFound(_0x4e73b4,null))[_0xfb01('0x21')](saveUpdates(_0x7c2e4d[_0xfb01('0x47')],null))['then'](respondWithResult(_0x4e73b4,null))[_0xfb01('0x42')](handleError(_0x4e73b4,null));};exports[_0xfb01('0x22')]=function(_0xe45483,_0xc28af3){return db[_0xfb01('0x28')][_0xfb01('0x45')]({'where':{'id':_0xe45483[_0xfb01('0x44')]['id']}})[_0xfb01('0x21')](handleEntityNotFound(_0xc28af3,null))[_0xfb01('0x21')](removeEntity(_0xc28af3,null))[_0xfb01('0x42')](handleError(_0xc28af3,null));};exports['download']=function(_0x44210c,_0x509145,_0x50753c){return db[_0xfb01('0x28')][_0xfb01('0x45')]({'where':{'id':_0x44210c[_0xfb01('0x44')]['id']},'attributes':['id',_0xfb01('0x49'),_0xfb01('0x4a')]})[_0xfb01('0x21')](handleEntityNotFound(_0x509145,null))['then'](function(_0x4ce34f){if(_0x4ce34f){if(!_0x4ce34f[_0xfb01('0x49')]){throw new db[(_0xfb01('0x4b'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x1f60a5={'Content-Type':'audio/wav','Content-Disposition':_0xfb01('0x4c')};if(_0x4ce34f['msg_id']){_0x1f60a5[_0xfb01('0x4d')]=_0xfb01('0x4e')+_0x4ce34f['msg_id']+_0xfb01('0x4f');}_0x509145[_0xfb01('0x50')](_0x1f60a5);return _0x509145[_0xfb01('0x25')](new Buffer(_0x4ce34f[_0xfb01('0x49')]));}})[_0xfb01('0x42')](handleError(_0x509145,null));}; \ No newline at end of file +var _0x1219=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VoiceMailMessage','fieldName','key','model','differenceBy','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','catch','show','params','rawAttributes','includeAll','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3c0159,_0x253316){var _0x599932=function(_0x3018b9){while(--_0x3018b9){_0x3c0159['push'](_0x3c0159['shift']());}};_0x599932(++_0x253316);}(_0x1219,0xac));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9121('0x0'));var rimraf=require(_0x9121('0x1'));var zipdir=require(_0x9121('0x2'));var jsonpatch=require(_0x9121('0x3'));var rp=require(_0x9121('0x4'));var moment=require(_0x9121('0x5'));var BPromise=require(_0x9121('0x6'));var Mustache=require(_0x9121('0x7'));var util=require(_0x9121('0x8'));var path=require(_0x9121('0x9'));var sox=require(_0x9121('0xa'));var csv=require('to-csv');var ejs=require(_0x9121('0xb'));var fs=require('fs');var fs_extra=require(_0x9121('0xc'));var _=require(_0x9121('0xd'));var squel=require(_0x9121('0xe'));var crypto=require(_0x9121('0xf'));var jsforce=require(_0x9121('0x10'));var deskjs=require(_0x9121('0x11'));var toCsv=require(_0x9121('0x12'));var querystring=require(_0x9121('0x13'));var Papa=require(_0x9121('0x14'));var Redis=require(_0x9121('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9121('0x16'));var hardwareService=require(_0x9121('0x17'));var logger=require(_0x9121('0x18'))(_0x9121('0x19'));var utils=require(_0x9121('0x1a'));var config=require(_0x9121('0x1b'));var licenseUtil=require(_0x9121('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37d489,_0x3d82ec){_0x3d82ec=_0x3d82ec||0xcc;return function(_0x71b6f8){if(_0x71b6f8){return _0x37d489[_0x9121('0x1d')](_0x3d82ec);}return _0x37d489[_0x9121('0x1e')](_0x3d82ec)[_0x9121('0x1f')]();};}function respondWithResult(_0xb3e2da,_0x26e2ca){_0x26e2ca=_0x26e2ca||0xc8;return function(_0x15281b){if(_0x15281b){return _0xb3e2da[_0x9121('0x1e')](_0x26e2ca)[_0x9121('0x20')](_0x15281b);}};}function respondWithFilteredResult(_0x2e5f38,_0x4bc518){return function(_0x224d53){if(_0x224d53){var _0x1384f9=typeof _0x4bc518[_0x9121('0x21')]===_0x9121('0x22')&&typeof _0x4bc518['limit']===_0x9121('0x22');var _0x385016=_0x224d53[_0x9121('0x23')];var _0x4e1c6a=_0x1384f9?0x0:_0x4bc518['offset'];var _0x3af334=_0x1384f9?_0x224d53[_0x9121('0x23')]:_0x4bc518[_0x9121('0x21')]+_0x4bc518[_0x9121('0x24')];var _0x1d2d70;if(_0x3af334>=_0x385016){_0x3af334=_0x385016;_0x1d2d70=0xc8;}else{_0x1d2d70=0xce;}_0x2e5f38[_0x9121('0x1e')](_0x1d2d70);return _0x2e5f38[_0x9121('0x25')](_0x9121('0x26'),_0x4e1c6a+'-'+_0x3af334+'/'+_0x385016)[_0x9121('0x20')](_0x224d53);}return null;};}function patchUpdates(_0x33c328){return function(_0x4e3fd6){try{jsonpatch[_0x9121('0x27')](_0x4e3fd6,_0x33c328,!![]);}catch(_0x2b22c6){return BPromise[_0x9121('0x28')](_0x2b22c6);}return _0x4e3fd6[_0x9121('0x29')]();};}function saveUpdates(_0x460b4d,_0x4ec136){return function(_0x1aaffa){if(_0x1aaffa){return _0x1aaffa[_0x9121('0x2a')](_0x460b4d)[_0x9121('0x2b')](function(_0x4e25e0){return _0x4e25e0;});}return null;};}function removeEntity(_0x75dd26,_0x4821fa){return function(_0x29edc7){if(_0x29edc7){return _0x29edc7[_0x9121('0x2c')]()[_0x9121('0x2b')](function(){_0x75dd26[_0x9121('0x1e')](0xcc)[_0x9121('0x1f')]();});}};}function handleEntityNotFound(_0x3c66ac,_0x44004b){return function(_0xebac9a){if(!_0xebac9a){_0x3c66ac[_0x9121('0x1d')](0x194);}return _0xebac9a;};}function handleError(_0x1e9890,_0x134468){_0x134468=_0x134468||0x1f4;return function(_0x4ea2a0){logger[_0x9121('0x2d')](_0x4ea2a0['stack']);if(_0x4ea2a0[_0x9121('0x2e')]){delete _0x4ea2a0[_0x9121('0x2e')];}_0x1e9890[_0x9121('0x1e')](_0x134468)[_0x9121('0x2f')](_0x4ea2a0);};}exports[_0x9121('0x30')]=function(_0x26d17f,_0x45e745){var _0x2b6bd8={},_0x5755bb={},_0x1e6113={'count':0x0,'rows':[]};var _0x229a81=_['map'](db[_0x9121('0x31')]['rawAttributes'],function(_0x5ae52b){return{'name':_0x5ae52b[_0x9121('0x32')],'type':_0x5ae52b['type'][_0x9121('0x33')]};});_0x5755bb[_0x9121('0x34')]=_[_0x9121('0x35')](_[_0x9121('0x36')](_0x229a81,'name'),[_0x9121('0x2e')]);_0x5755bb[_0x9121('0x37')]=_[_0x9121('0x38')](_0x26d17f['query']);_0x5755bb[_0x9121('0x39')]=_['intersection'](_0x5755bb[_0x9121('0x34')],_0x5755bb[_0x9121('0x37')]);_0x2b6bd8[_0x9121('0x3a')]=_[_0x9121('0x3b')](_0x5755bb['model'],qs['fields'](_0x26d17f[_0x9121('0x37')][_0x9121('0x3c')]));_0x2b6bd8[_0x9121('0x3a')]=_0x2b6bd8['attributes'][_0x9121('0x3d')]?_0x2b6bd8[_0x9121('0x3a')]:_0x5755bb[_0x9121('0x34')];if(!_0x26d17f[_0x9121('0x37')]['hasOwnProperty'](_0x9121('0x3e'))){_0x2b6bd8['limit']=qs[_0x9121('0x24')](_0x26d17f[_0x9121('0x37')][_0x9121('0x24')]);_0x2b6bd8['offset']=qs['offset'](_0x26d17f[_0x9121('0x37')]['offset']);}_0x2b6bd8['order']=qs[_0x9121('0x3f')](_0x26d17f[_0x9121('0x37')][_0x9121('0x3f')]);_0x2b6bd8[_0x9121('0x40')]=qs[_0x9121('0x39')](_[_0x9121('0x41')](_0x26d17f[_0x9121('0x37')],_0x5755bb[_0x9121('0x39')]),_0x229a81);if(_0x26d17f[_0x9121('0x37')]['filter']){_0x2b6bd8[_0x9121('0x40')]=_[_0x9121('0x42')](_0x2b6bd8[_0x9121('0x40')],{'$or':_[_0x9121('0x36')](_0x229a81,function(_0x467c57){if(_0x467c57[_0x9121('0x43')]!==_0x9121('0x44')){var _0x44d09f={};_0x44d09f[_0x467c57[_0x9121('0x2e')]]={'$like':'%'+_0x26d17f[_0x9121('0x37')][_0x9121('0x45')]+'%'};return _0x44d09f;}})});}_0x2b6bd8=_['merge']({},_0x2b6bd8,_0x26d17f[_0x9121('0x46')]);var _0x59cd49={'where':_0x2b6bd8[_0x9121('0x40')]};return db[_0x9121('0x31')][_0x9121('0x23')](_0x59cd49)[_0x9121('0x2b')](function(_0x2993af){_0x1e6113['count']=_0x2993af;if(_0x26d17f[_0x9121('0x37')]['includeAll']){_0x2b6bd8[_0x9121('0x47')]=[{'all':!![]}];}return db[_0x9121('0x31')]['findAll'](_0x2b6bd8);})[_0x9121('0x2b')](function(_0x18f182){_0x1e6113['rows']=_0x18f182;return _0x1e6113;})['then'](respondWithFilteredResult(_0x45e745,_0x2b6bd8))[_0x9121('0x48')](handleError(_0x45e745,null));};exports[_0x9121('0x49')]=function(_0x23825c,_0x2eeacc){var _0x3cc8e6={'raw':!![],'where':{'id':_0x23825c[_0x9121('0x4a')]['id']}},_0x2f2587={};_0x2f2587[_0x9121('0x34')]=_[_0x9121('0x38')](db[_0x9121('0x31')][_0x9121('0x4b')]);_0x2f2587[_0x9121('0x37')]=_[_0x9121('0x38')](_0x23825c['query']);_0x2f2587[_0x9121('0x39')]=_['intersection'](_0x2f2587[_0x9121('0x34')],_0x2f2587[_0x9121('0x37')]);_0x3cc8e6[_0x9121('0x3a')]=_['intersection'](_0x2f2587[_0x9121('0x34')],qs['fields'](_0x23825c[_0x9121('0x37')][_0x9121('0x3c')]));_0x3cc8e6['attributes']=_0x3cc8e6[_0x9121('0x3a')]['length']?_0x3cc8e6[_0x9121('0x3a')]:_0x2f2587[_0x9121('0x34')];if(_0x23825c[_0x9121('0x37')][_0x9121('0x4c')]){_0x3cc8e6[_0x9121('0x47')]=[{'all':!![]}];}_0x3cc8e6=_[_0x9121('0x42')]({},_0x3cc8e6,_0x23825c[_0x9121('0x46')]);return db['VoiceMailMessage'][_0x9121('0x4d')](_0x3cc8e6)[_0x9121('0x2b')](handleEntityNotFound(_0x2eeacc,null))['then'](respondWithResult(_0x2eeacc,null))[_0x9121('0x48')](handleError(_0x2eeacc,null));};exports[_0x9121('0x4e')]=function(_0x566d37,_0x317915){return db['VoiceMailMessage'][_0x9121('0x4e')](_0x566d37[_0x9121('0x4f')],{})[_0x9121('0x2b')](respondWithResult(_0x317915,0xc9))[_0x9121('0x48')](handleError(_0x317915,null));};exports[_0x9121('0x2a')]=function(_0x326872,_0x1b20d0){if(_0x326872['body']['id']){delete _0x326872[_0x9121('0x4f')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x326872[_0x9121('0x4a')]['id']}})[_0x9121('0x2b')](handleEntityNotFound(_0x1b20d0,null))[_0x9121('0x2b')](saveUpdates(_0x326872[_0x9121('0x4f')],null))['then'](respondWithResult(_0x1b20d0,null))[_0x9121('0x48')](handleError(_0x1b20d0,null));};exports[_0x9121('0x2c')]=function(_0x57a36c,_0xac5490){return db[_0x9121('0x31')][_0x9121('0x4d')]({'where':{'id':_0x57a36c[_0x9121('0x4a')]['id']}})['then'](handleEntityNotFound(_0xac5490,null))[_0x9121('0x2b')](removeEntity(_0xac5490,null))[_0x9121('0x48')](handleError(_0xac5490,null));};exports[_0x9121('0x50')]=function(_0x1ca96d,_0x380689,_0x447c4f){return db[_0x9121('0x31')][_0x9121('0x4d')]({'where':{'id':_0x1ca96d[_0x9121('0x4a')]['id']},'attributes':['id',_0x9121('0x51'),_0x9121('0x52')]})[_0x9121('0x2b')](handleEntityNotFound(_0x380689,null))[_0x9121('0x2b')](function(_0x33b9c7){if(_0x33b9c7){if(!_0x33b9c7[_0x9121('0x51')]){throw new db[(_0x9121('0x53'))]['ValidationError'](_0x9121('0x54'));}var _0x3ab61d={'Content-Type':_0x9121('0x55'),'Content-Disposition':'attachment'};if(_0x33b9c7[_0x9121('0x52')]){_0x3ab61d[_0x9121('0x56')]=_0x9121('0x57')+_0x33b9c7[_0x9121('0x52')]+_0x9121('0x58');}_0x380689[_0x9121('0x25')](_0x3ab61d);return _0x380689[_0x9121('0x2f')](new Buffer(_0x33b9c7['recording']));}})[_0x9121('0x48')](handleError(_0x380689,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8035123..b7a3a5f 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 _0xa18f=['define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceMailMessage.attributes','exports'];(function(_0x1bec0d,_0x338db4){var _0x49e3e3=function(_0x372c7a){while(--_0x372c7a){_0x1bec0d['push'](_0x1bec0d['shift']());}};_0x49e3e3(++_0x338db4);}(_0xa18f,0xdb));var _0xfa18=function(_0x83a989,_0x1073a2){_0x83a989=_0x83a989-0x0;var _0x44cc79=_0xa18f[_0x83a989];return _0x44cc79;};'use strict';var _=require(_0xfa18('0x0'));var util=require(_0xfa18('0x1'));var logger=require(_0xfa18('0x2'))(_0xfa18('0x3'));var moment=require(_0xfa18('0x4'));var BPromise=require(_0xfa18('0x5'));var rp=require(_0xfa18('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa18('0x7'));module[_0xfa18('0x8')]=function(_0x319524,_0x565359){return _0x319524[_0xfa18('0x9')](_0xfa18('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xfa18('0xb'),'fields':[_0xfa18('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a9a=['path','../../config/environment','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x202ece,_0x470a05){var _0x3c8270=function(_0x3889a3){while(--_0x3889a3){_0x202ece['push'](_0x202ece['shift']());}};_0x3c8270(++_0x470a05);}(_0x7a9a,0xae));var _0xa7a9=function(_0x55488e,_0x4764f1){_0x55488e=_0x55488e-0x0;var _0x3a6da0=_0x7a9a[_0x55488e];return _0x3a6da0;};'use strict';var _=require(_0xa7a9('0x0'));var util=require(_0xa7a9('0x1'));var logger=require(_0xa7a9('0x2'))(_0xa7a9('0x3'));var moment=require(_0xa7a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7a9('0x5'));var fs=require('fs');var path=require(_0xa7a9('0x6'));var rimraf=require('rimraf');var config=require(_0xa7a9('0x7'));var attributes=require(_0xa7a9('0x8'));module[_0xa7a9('0x9')]=function(_0x287600,_0x245d82){return _0x287600['define']('VoiceMailMessage',attributes,{'tableName':_0xa7a9('0xa'),'paranoid':![],'indexes':[{'name':_0xa7a9('0xb'),'fields':[_0xa7a9('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index dc8d39b..1f63491 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 _0x330c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x12f4d8,_0x1f6d82){var _0x265413=function(_0x4901a6){while(--_0x4901a6){_0x12f4d8['push'](_0x12f4d8['shift']());}};_0x265413(++_0x1f6d82);}(_0x330c,0xd7));var _0xc330=function(_0x368c0a,_0x4dd9e0){_0x368c0a=_0x368c0a-0x0;var _0x2fa9ae=_0x330c[_0x368c0a];return _0x2fa9ae;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var moment=require(_0xc330('0x2'));var BPromise=require(_0xc330('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc330('0x4'));var db=require(_0xc330('0x5'))['db'];var utils=require(_0xc330('0x6'));var logger=require(_0xc330('0x7'))('rpc');var config=require(_0xc330('0x8'));var jayson=require(_0xc330('0x9'));var client=jayson['client'][_0xc330('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bcd33,_0x1ac3f8,_0x236c88){return new BPromise(function(_0x38a4f8,_0xc9afc){return client[_0xc330('0xb')](_0x2bcd33,_0x236c88)[_0xc330('0xc')](function(_0x598c57){logger[_0xc330('0xd')](_0xc330('0xe'),_0x1ac3f8,'request\x20sent');logger[_0xc330('0xf')](_0xc330('0x10'),_0x1ac3f8,_0xc330('0x11'),JSON[_0xc330('0x12')](_0x598c57));if(_0x598c57[_0xc330('0x13')]){if(_0x598c57['error'][_0xc330('0x14')]===0x1f4){logger['error'](_0xc330('0xe'),_0x1ac3f8,_0x598c57[_0xc330('0x13')][_0xc330('0x15')]);return _0xc9afc(_0x598c57['error']['message']);}logger[_0xc330('0x13')](_0xc330('0xe'),_0x1ac3f8,_0x598c57['error']['message']);return _0x38a4f8(_0x598c57[_0xc330('0x13')][_0xc330('0x15')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x1ac3f8,_0xc330('0x11'));_0x38a4f8(_0x598c57[_0xc330('0x16')][_0xc330('0x15')]);}})[_0xc330('0x17')](function(_0x5581b4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1ac3f8,_0x5581b4);_0xc9afc(_0x5581b4);});});} \ No newline at end of file +var _0x3b07=['request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3b07,0x15c));var _0x73b0=function(_0xfc1d82,_0x1b4b13){_0xfc1d82=_0xfc1d82-0x0;var _0x527720=_0x3b07[_0xfc1d82];return _0x527720;};'use strict';var _=require(_0x73b0('0x0'));var util=require(_0x73b0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x73b0('0x2'));var fs=require('fs');var Redis=require(_0x73b0('0x3'));var db=require(_0x73b0('0x4'))['db'];var utils=require(_0x73b0('0x5'));var logger=require(_0x73b0('0x6'))(_0x73b0('0x7'));var config=require(_0x73b0('0x8'));var jayson=require(_0x73b0('0x9'));var client=jayson[_0x73b0('0xa')][_0x73b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x529f1c,_0x55852e,_0x5d3b27){return new BPromise(function(_0x33a1c1,_0x2f29c2){return client[_0x73b0('0xc')](_0x529f1c,_0x5d3b27)[_0x73b0('0xd')](function(_0x34cc50){logger['info'](_0x73b0('0xe'),_0x55852e,_0x73b0('0xf'));logger['debug'](_0x73b0('0x10'),_0x55852e,_0x73b0('0xf'),JSON['stringify'](_0x34cc50));if(_0x34cc50[_0x73b0('0x11')]){if(_0x34cc50[_0x73b0('0x11')][_0x73b0('0x12')]===0x1f4){logger['error'](_0x73b0('0xe'),_0x55852e,_0x34cc50[_0x73b0('0x11')]['message']);return _0x2f29c2(_0x34cc50['error']['message']);}logger[_0x73b0('0x11')](_0x73b0('0xe'),_0x55852e,_0x34cc50[_0x73b0('0x11')][_0x73b0('0x13')]);return _0x33a1c1(_0x34cc50[_0x73b0('0x11')][_0x73b0('0x13')]);}else{logger['info'](_0x73b0('0xe'),_0x55852e,'request\x20sent');_0x33a1c1(_0x34cc50['result'][_0x73b0('0x13')]);}})['catch'](function(_0x50d4f7){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x55852e,_0x50d4f7);_0x2f29c2(_0x50d4f7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3630e5d..bfa197c 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 _0x5f7b=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','/:id','update','delete','/:id/sounds/:id2','removeSound'];(function(_0x3aac95,_0xd0cc0d){var _0x41776b=function(_0xe76c4f){while(--_0xe76c4f){_0x3aac95['push'](_0x3aac95['shift']());}};_0x41776b(++_0xd0cc0d);}(_0x5f7b,0x169));var _0xb5f7=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x5f7b[_0x25e7cb];return _0x375d92;};'use strict';var multer=require('multer');var util=require(_0xb5f7('0x0'));var path=require('path');var timeout=require(_0xb5f7('0x1'));var express=require(_0xb5f7('0x2'));var router=express[_0xb5f7('0x3')]();var fs_extra=require(_0xb5f7('0x4'));var auth=require(_0xb5f7('0x5'));var interaction=require(_0xb5f7('0x6'));var config=require(_0xb5f7('0x7'));var controller=require(_0xb5f7('0x8'));router[_0xb5f7('0x9')]('/',auth[_0xb5f7('0xa')](),controller[_0xb5f7('0xb')]);router[_0xb5f7('0x9')]('/:id',auth[_0xb5f7('0xa')](),controller[_0xb5f7('0xc')]);router[_0xb5f7('0x9')](_0xb5f7('0xd'),auth[_0xb5f7('0xa')](),controller[_0xb5f7('0xe')]);router[_0xb5f7('0xf')]('/',auth['isAuthenticated'](),controller[_0xb5f7('0x10')]);router[_0xb5f7('0xf')](_0xb5f7('0xd'),auth[_0xb5f7('0xa')](),controller[_0xb5f7('0x11')]);router['put'](_0xb5f7('0x12'),auth[_0xb5f7('0xa')](),controller[_0xb5f7('0x13')]);router[_0xb5f7('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xb5f7('0x15'),auth[_0xb5f7('0xa')](),controller[_0xb5f7('0x16')]);module[_0xb5f7('0x17')]=router; \ No newline at end of file +var _0x0c2b=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x557575,_0x33e4c6){var _0x4bba29=function(_0x44ed48){while(--_0x44ed48){_0x557575['push'](_0x557575['shift']());}};_0x4bba29(++_0x33e4c6);}(_0x0c2b,0x1f4));var _0xb0c2=function(_0x4a527e,_0x32d3db){_0x4a527e=_0x4a527e-0x0;var _0xe0cbc3=_0x0c2b[_0x4a527e];return _0xe0cbc3;};'use strict';var multer=require('multer');var util=require(_0xb0c2('0x0'));var path=require(_0xb0c2('0x1'));var timeout=require(_0xb0c2('0x2'));var express=require('express');var router=express[_0xb0c2('0x3')]();var fs_extra=require(_0xb0c2('0x4'));var auth=require(_0xb0c2('0x5'));var interaction=require(_0xb0c2('0x6'));var config=require(_0xb0c2('0x7'));var controller=require(_0xb0c2('0x8'));router[_0xb0c2('0x9')]('/',auth[_0xb0c2('0xa')](),controller[_0xb0c2('0xb')]);router[_0xb0c2('0x9')](_0xb0c2('0xc'),auth[_0xb0c2('0xa')](),controller['show']);router[_0xb0c2('0x9')](_0xb0c2('0xd'),auth[_0xb0c2('0xa')](),controller['getSounds']);router[_0xb0c2('0xe')]('/',auth[_0xb0c2('0xa')](),controller['create']);router[_0xb0c2('0xe')](_0xb0c2('0xd'),auth[_0xb0c2('0xa')](),controller[_0xb0c2('0xf')]);router[_0xb0c2('0x10')](_0xb0c2('0xc'),auth[_0xb0c2('0xa')](),controller[_0xb0c2('0x11')]);router[_0xb0c2('0x12')]('/:id',auth[_0xb0c2('0xa')](),controller[_0xb0c2('0x13')]);router[_0xb0c2('0x12')](_0xb0c2('0x14'),auth[_0xb0c2('0xa')](),controller['removeSound']);module[_0xb0c2('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 13242ff..a156420 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 _0x5e9a=['TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','mp3nb','quietmp3nb','mp3','files','STRING','alpha'];(function(_0xa08a23,_0x196fb9){var _0x4bccc4=function(_0x45830d){while(--_0x45830d){_0xa08a23['push'](_0xa08a23['shift']());}};_0x4bccc4(++_0x196fb9);}(_0x5e9a,0x7a));var _0xa5e9=function(_0xb4358b,_0x3a7109){_0xb4358b=_0xb4358b-0x0;var _0x7d5852=_0x5e9a[_0xb4358b];return _0x7d5852;};'use strict';var Sequelize=require(_0xa5e9('0x0'));module[_0xa5e9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa5e9('0x2')},'mode':{'type':Sequelize[_0xa5e9('0x3')]('custom','files',_0xa5e9('0x4'),_0xa5e9('0x5'),'quietmp3',_0xa5e9('0x6')),'allowNull':!![],'defaultValue':_0xa5e9('0x7')},'directory':{'type':Sequelize[_0xa5e9('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0xa5e9('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa5e9('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa5e9('0x8')],'allowNull':!![],'defaultValue':_0xa5e9('0x9')},'format':{'type':Sequelize[_0xa5e9('0x8')],'allowNull':!![]},'stamp':{'type':_0xa5e9('0xa')},'defaultEntry':{'type':Sequelize[_0xa5e9('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd09=['ENUM','custom','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x4fa08c,_0x30cac4){var _0x7a920a=function(_0x213fd1){while(--_0x213fd1){_0x4fa08c['push'](_0x4fa08c['shift']());}};_0x7a920a(++_0x30cac4);}(_0xfd09,0x168));var _0x9fd0=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xfd09[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require(_0x9fd0('0x0'));module[_0x9fd0('0x1')]={'name':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9fd0('0x3')](_0x9fd0('0x4'),'files',_0x9fd0('0x5'),_0x9fd0('0x6'),_0x9fd0('0x7'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':!![],'defaultValue':_0x9fd0('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9fd0('0x9')},'defaultEntry':{'type':Sequelize[_0x9fd0('0xa')],'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 133c84c..560a2b4 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 _0xbff9=['directory','join','root','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','transaction','addSound','findOne','save_name','converted_format','server/files/sounds/converted','%s.%s','basename','extname','format','symlinkSync','removeSound','id2','Sound','fields','pick','filter','getSounds','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','end','sendStatus','name','send','index','map','VoiceMusicOnHold','type','key','keys','query','filters','model','attributes','length','nolimit','order','sort','where','merge','options','includeAll','include','findAll','show','rawAttributes','intersection','find','body','params','catch','create','sequelize','mode'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xbff9,0x97));var _0x9bff=function(_0x246669,_0x1c1818){_0x246669=_0x246669-0x0;var _0x2f94c5=_0xbff9[_0x246669];return _0x2f94c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9bff('0x0'));var jsonpatch=require(_0x9bff('0x1'));var rp=require(_0x9bff('0x2'));var moment=require(_0x9bff('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9bff('0x4'));var util=require('util');var path=require(_0x9bff('0x5'));var sox=require(_0x9bff('0x6'));var csv=require(_0x9bff('0x7'));var ejs=require(_0x9bff('0x8'));var fs=require('fs');var fs_extra=require(_0x9bff('0x9'));var _=require(_0x9bff('0xa'));var squel=require('squel');var crypto=require(_0x9bff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9bff('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9bff('0xd'));var authService=require(_0x9bff('0xe'));var qs=require(_0x9bff('0xf'));var as=require(_0x9bff('0x10'));var hardwareService=require(_0x9bff('0x11'));var logger=require(_0x9bff('0x12'))(_0x9bff('0x13'));var utils=require(_0x9bff('0x14'));var config=require(_0x9bff('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9bff('0x16'))['db'];function respondWithStatusCode(_0x1b3289,_0x1fbdae){_0x1fbdae=_0x1fbdae||0xcc;return function(_0x414624){if(_0x414624){return _0x1b3289['sendStatus'](_0x1fbdae);}return _0x1b3289['status'](_0x1fbdae)['end']();};}function respondWithResult(_0x11f522,_0x2afce1){_0x2afce1=_0x2afce1||0xc8;return function(_0xeaac19){if(_0xeaac19){return _0x11f522[_0x9bff('0x17')](_0x2afce1)['json'](_0xeaac19);}};}function respondWithFilteredResult(_0x5aec27,_0x45e8c3){return function(_0x2be0e8){if(_0x2be0e8){var _0xb7279b=typeof _0x45e8c3['offset']===_0x9bff('0x18')&&typeof _0x45e8c3[_0x9bff('0x19')]===_0x9bff('0x18');var _0x14be61=_0x2be0e8['count'];var _0xbd08e8=_0xb7279b?0x0:_0x45e8c3[_0x9bff('0x1a')];var _0x25b181=_0xb7279b?_0x2be0e8[_0x9bff('0x1b')]:_0x45e8c3[_0x9bff('0x1a')]+_0x45e8c3[_0x9bff('0x19')];var _0x747e46;if(_0x25b181>=_0x14be61){_0x25b181=_0x14be61;_0x747e46=0xc8;}else{_0x747e46=0xce;}_0x5aec27[_0x9bff('0x17')](_0x747e46);return _0x5aec27[_0x9bff('0x1c')](_0x9bff('0x1d'),_0xbd08e8+'-'+_0x25b181+'/'+_0x14be61)[_0x9bff('0x1e')](_0x2be0e8);}return null;};}function patchUpdates(_0x36a10c){return function(_0xa5671a){try{jsonpatch[_0x9bff('0x1f')](_0xa5671a,_0x36a10c,!![]);}catch(_0x4a83a3){return BPromise[_0x9bff('0x20')](_0x4a83a3);}return _0xa5671a[_0x9bff('0x21')]();};}function saveUpdates(_0x3e8bd7,_0x5e8605){return function(_0x30e9d9){if(_0x30e9d9){return _0x30e9d9[_0x9bff('0x22')](_0x3e8bd7)[_0x9bff('0x23')](function(_0x38e7af){return _0x38e7af;});}return null;};}function removeEntity(_0x391683,_0x4ec140){return function(_0xabaadf){if(_0xabaadf){return _0xabaadf[_0x9bff('0x24')]()['then'](function(){var _0x56b2ff=_0xabaadf[_0x9bff('0x25')]({'plain':!![]});var _0x218ee2=_0x9bff('0x26');return db['UserProfileResource'][_0x9bff('0x24')]({'where':{'type':_0x218ee2,'resourceId':_0x56b2ff['id']}})[_0x9bff('0x23')](function(){return _0xabaadf;});})[_0x9bff('0x23')](function(){_0x391683[_0x9bff('0x17')](0xcc)[_0x9bff('0x27')]();});}};}function handleEntityNotFound(_0x55445a,_0x4819f1){return function(_0x598b37){if(!_0x598b37){_0x55445a[_0x9bff('0x28')](0x194);}return _0x598b37;};}function handleError(_0x49348a,_0x24bfed){_0x24bfed=_0x24bfed||0x1f4;return function(_0x512b8f){logger['error'](_0x512b8f['stack']);if(_0x512b8f['name']){delete _0x512b8f[_0x9bff('0x29')];}_0x49348a[_0x9bff('0x17')](_0x24bfed)[_0x9bff('0x2a')](_0x512b8f);};}exports[_0x9bff('0x2b')]=function(_0x11458b,_0x6f85ec){var _0x14f5c6={},_0x1996ee={},_0x1539ed={'count':0x0,'rows':[]};var _0x56f4d3=_[_0x9bff('0x2c')](db[_0x9bff('0x2d')]['rawAttributes'],function(_0x1d0ab8){return{'name':_0x1d0ab8['fieldName'],'type':_0x1d0ab8[_0x9bff('0x2e')][_0x9bff('0x2f')]};});_0x1996ee['model']=_[_0x9bff('0x2c')](_0x56f4d3,_0x9bff('0x29'));_0x1996ee['query']=_[_0x9bff('0x30')](_0x11458b[_0x9bff('0x31')]);_0x1996ee[_0x9bff('0x32')]=_['intersection'](_0x1996ee[_0x9bff('0x33')],_0x1996ee['query']);_0x14f5c6[_0x9bff('0x34')]=_['intersection'](_0x1996ee[_0x9bff('0x33')],qs['fields'](_0x11458b[_0x9bff('0x31')]['fields']));_0x14f5c6['attributes']=_0x14f5c6[_0x9bff('0x34')][_0x9bff('0x35')]?_0x14f5c6[_0x9bff('0x34')]:_0x1996ee['model'];if(!_0x11458b[_0x9bff('0x31')]['hasOwnProperty'](_0x9bff('0x36'))){_0x14f5c6['limit']=qs['limit'](_0x11458b[_0x9bff('0x31')][_0x9bff('0x19')]);_0x14f5c6['offset']=qs[_0x9bff('0x1a')](_0x11458b[_0x9bff('0x31')]['offset']);}_0x14f5c6[_0x9bff('0x37')]=qs['sort'](_0x11458b[_0x9bff('0x31')][_0x9bff('0x38')]);delete _0x11458b[_0x9bff('0x31')][_0x9bff('0x38')];_0x14f5c6[_0x9bff('0x39')]=qs[_0x9bff('0x32')](_['pick'](_0x11458b[_0x9bff('0x31')],_0x1996ee[_0x9bff('0x32')]),_0x56f4d3);if(_0x11458b[_0x9bff('0x31')]['filter']){_0x14f5c6[_0x9bff('0x39')]=_[_0x9bff('0x3a')](_0x14f5c6[_0x9bff('0x39')],{'$or':_['map'](_0x56f4d3,function(_0x326d43){if(_0x326d43[_0x9bff('0x2e')]!=='VIRTUAL'){var _0x49e61f={};_0x49e61f[_0x326d43[_0x9bff('0x29')]]={'$like':'%'+_0x11458b[_0x9bff('0x31')]['filter']+'%'};return _0x49e61f;}})});}_0x14f5c6=_[_0x9bff('0x3a')]({},_0x14f5c6,_0x11458b[_0x9bff('0x3b')]);var _0x2bfec0={'where':_0x14f5c6['where']};return db[_0x9bff('0x2d')][_0x9bff('0x1b')](_0x2bfec0)[_0x9bff('0x23')](function(_0xb36822){_0x1539ed[_0x9bff('0x1b')]=_0xb36822;if(_0x11458b['query'][_0x9bff('0x3c')]){_0x14f5c6[_0x9bff('0x3d')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x9bff('0x3e')](_0x14f5c6);})[_0x9bff('0x23')](function(_0x4b4c8b){_0x1539ed['rows']=_0x4b4c8b;return _0x1539ed;})[_0x9bff('0x23')](respondWithFilteredResult(_0x6f85ec,_0x14f5c6))['catch'](handleError(_0x6f85ec,null));};exports[_0x9bff('0x3f')]=function(_0x5e4bac,_0x111dd4){var _0x4faa6e={'raw':![],'where':{'id':_0x5e4bac['params']['id']}},_0x5cd5a9={};_0x5cd5a9[_0x9bff('0x33')]=_[_0x9bff('0x30')](db[_0x9bff('0x2d')][_0x9bff('0x40')]);_0x5cd5a9['query']=_[_0x9bff('0x30')](_0x5e4bac[_0x9bff('0x31')]);_0x5cd5a9[_0x9bff('0x32')]=_[_0x9bff('0x41')](_0x5cd5a9[_0x9bff('0x33')],_0x5cd5a9[_0x9bff('0x31')]);_0x4faa6e['attributes']=_[_0x9bff('0x41')](_0x5cd5a9[_0x9bff('0x33')],qs['fields'](_0x5e4bac[_0x9bff('0x31')]['fields']));_0x4faa6e[_0x9bff('0x34')]=_0x4faa6e[_0x9bff('0x34')][_0x9bff('0x35')]?_0x4faa6e[_0x9bff('0x34')]:_0x5cd5a9[_0x9bff('0x33')];if(_0x5e4bac[_0x9bff('0x31')][_0x9bff('0x3c')]){_0x4faa6e[_0x9bff('0x3d')]=[{'all':!![]}];}_0x4faa6e=_[_0x9bff('0x3a')]({},_0x4faa6e,_0x5e4bac[_0x9bff('0x3b')]);return db[_0x9bff('0x2d')][_0x9bff('0x42')](_0x4faa6e)['then'](handleEntityNotFound(_0x111dd4,null))[_0x9bff('0x23')](respondWithResult(_0x111dd4,null))['catch'](handleError(_0x111dd4,null));};exports[_0x9bff('0x22')]=function(_0x31437e,_0x46a9fd){if(_0x31437e[_0x9bff('0x43')]['id']){delete _0x31437e[_0x9bff('0x43')]['id'];}return db[_0x9bff('0x2d')][_0x9bff('0x42')]({'where':{'id':_0x31437e[_0x9bff('0x44')]['id']}})[_0x9bff('0x23')](handleEntityNotFound(_0x46a9fd,null))[_0x9bff('0x23')](saveUpdates(_0x31437e['body'],null))[_0x9bff('0x23')](respondWithResult(_0x46a9fd,null))[_0x9bff('0x45')](handleError(_0x46a9fd,null));};exports[_0x9bff('0x46')]=function(_0x375a42,_0x239c38,_0x273ced){return db[_0x9bff('0x47')]['transaction'](function(_0x35128d){if(_0x375a42[_0x9bff('0x43')][_0x9bff('0x48')]==='files'){_0x375a42[_0x9bff('0x43')][_0x9bff('0x49')]=path[_0x9bff('0x4a')](config[_0x9bff('0x4b')],_0x9bff('0x4c'),_0x375a42['body'][_0x9bff('0x29')]);}return db[_0x9bff('0x2d')][_0x9bff('0x46')](_0x375a42[_0x9bff('0x43')],{'transaction':_0x35128d})[_0x9bff('0x23')](function(_0x3a2bf8){if(_0x375a42[_0x9bff('0x43')][_0x9bff('0x48')]===_0x9bff('0x4d')){fs[_0x9bff('0x4e')](_0x3a2bf8[_0x9bff('0x49')],parseInt(_0x9bff('0x4f'),0x8));}var _0x3a0331=_0x375a42[_0x9bff('0x50')]['get']({'plain':!![]});if(!_0x3a0331)throw new Error(_0x9bff('0x51'));if(_0x3a0331['role']===_0x9bff('0x50')){var _0x3c3f54=_0x3a2bf8[_0x9bff('0x25')]({'plain':!![]});return db[_0x9bff('0x52')][_0x9bff('0x42')]({'where':{'name':_0x9bff('0x26'),'userProfileId':_0x3a0331['userProfileId']},'raw':!![]})[_0x9bff('0x23')](function(_0x432fd5){if(_0x432fd5&&_0x432fd5[_0x9bff('0x53')]===0x0){return db[_0x9bff('0x54')][_0x9bff('0x46')]({'name':_0x3c3f54[_0x9bff('0x29')],'resourceId':_0x3c3f54['id'],'type':_0x432fd5['name'],'sectionId':_0x432fd5['id']},{})[_0x9bff('0x23')](function(){return _0x3a2bf8;});}else{return _0x3a2bf8;}})[_0x9bff('0x45')](function(_0x1de830){logger[_0x9bff('0x55')](_0x9bff('0x56'),_0x1de830);});}return _0x3a2bf8;});})[_0x9bff('0x23')](respondWithResult(_0x239c38,0xc9))[_0x9bff('0x45')](handleError(_0x239c38,null));};exports[_0x9bff('0x24')]=function(_0x4b0668,_0x4267bc,_0x5649c1){var _0x28b184;return db[_0x9bff('0x2d')][_0x9bff('0x42')]({'where':{'id':_0x4b0668[_0x9bff('0x44')]['id']}})['then'](function(_0x1fb15b){if(_0x1fb15b){return db[_0x9bff('0x47')]['transaction'](function(_0x1d685d){return _0x1fb15b[_0x9bff('0x24')]({'transaction':_0x1d685d,'raw':!![]})[_0x9bff('0x23')](function(_0x3eae26){if(_0x3eae26[_0x9bff('0x49')]){fs[_0x9bff('0x57')](_0x3eae26[_0x9bff('0x49')])[_0x9bff('0x58')](function(_0x1f4cfa){fs['unlinkSync'](path[_0x9bff('0x4a')](_0x3eae26['directory'],_0x1f4cfa));});fs[_0x9bff('0x59')](_0x3eae26[_0x9bff('0x49')]);}return _0x3eae26;});})[_0x9bff('0x45')](function(_0x7a53bc){throw new db[(_0x9bff('0x5a'))][(_0x9bff('0x5b'))](_0x7a53bc[_0x9bff('0x5c')]);});}})[_0x9bff('0x23')](handleEntityNotFound(_0x4267bc,null))[_0x9bff('0x23')](removeEntity(_0x4267bc,null))[_0x9bff('0x45')](handleError(_0x4267bc,null));};exports['addSound']=function(_0x13bd0b,_0x230651,_0x4731b7){return db[_0x9bff('0x47')][_0x9bff('0x5d')](function(_0x1d3304){var _0x3582fb;return db[_0x9bff('0x2d')][_0x9bff('0x42')]({'where':{'id':_0x13bd0b['params']['id']}})[_0x9bff('0x23')](function(_0x8a3e0c){if(_0x8a3e0c){_0x3582fb=_0x8a3e0c;return _0x8a3e0c[_0x9bff('0x5e')](_0x13bd0b[_0x9bff('0x43')]['id'],{'transaction':_0x1d3304});}})[_0x9bff('0x23')](function(_0x5c3ad3){if(_0x5c3ad3){return db['Sound'][_0x9bff('0x5f')]({'where':{'id':_0x13bd0b[_0x9bff('0x43')]['id']},'attributes':['id',_0x9bff('0x29'),_0x9bff('0x60'),_0x9bff('0x61'),'createdAt'],'raw':!![]});}})[_0x9bff('0x23')](function(_0x1c2230){if(_0x1c2230){var _0x36d569=path[_0x9bff('0x4a')](config[_0x9bff('0x4b')],_0x9bff('0x62'),util['format'](_0x9bff('0x63'),path[_0x9bff('0x64')](_0x1c2230[_0x9bff('0x60')],path[_0x9bff('0x65')](_0x1c2230[_0x9bff('0x60')])),_0x1c2230['converted_format']));var _0x391dad=path['join'](config[_0x9bff('0x4b')],_0x9bff('0x4c'),_0x3582fb['name'],util[_0x9bff('0x66')]('%s.%s',_0x1c2230[_0x9bff('0x29')],_0x1c2230['converted_format']));fs[_0x9bff('0x67')](_0x36d569,_0x391dad);return _0x1c2230;}})['catch'](function(_0x5e42be){throw new db['Sequelize']['ValidationError'](_0x5e42be[_0x9bff('0x5c')]);});})[_0x9bff('0x23')](handleEntityNotFound(_0x230651,null))[_0x9bff('0x23')](respondWithResult(_0x230651,0xc9))[_0x9bff('0x45')](handleError(_0x230651,null));};exports[_0x9bff('0x68')]=function(_0x2947bf,_0x448d1a,_0x550249){return db['sequelize'][_0x9bff('0x5d')](function(_0x4ab570){var _0x361553;return db[_0x9bff('0x2d')]['findOne']({'where':{'id':_0x2947bf[_0x9bff('0x44')]['id']}})[_0x9bff('0x23')](handleEntityNotFound(_0x448d1a,null))['then'](function(_0x40913e){if(_0x40913e){_0x361553=_0x40913e;return _0x40913e['removeSound'](_0x2947bf[_0x9bff('0x44')][_0x9bff('0x69')]);}})[_0x9bff('0x23')](function(_0x43df36){if(_0x43df36){return db[_0x9bff('0x6a')][_0x9bff('0x5f')]({'where':{'id':_0x2947bf[_0x9bff('0x44')]['id2']},'attributes':['id',_0x9bff('0x29'),_0x9bff('0x60'),'converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x5c034a){if(_0x5c034a){fs['unlinkSync'](path[_0x9bff('0x4a')](_0x361553[_0x9bff('0x49')],util[_0x9bff('0x66')](_0x9bff('0x63'),_0x5c034a[_0x9bff('0x29')],_0x5c034a[_0x9bff('0x61')])));return _0x5c034a;}})[_0x9bff('0x45')](function(_0x59709a){throw new db[(_0x9bff('0x5a'))][(_0x9bff('0x5b'))](_0x59709a['message']);});})['then'](handleEntityNotFound(_0x448d1a,null))[_0x9bff('0x23')](respondWithStatusCode(_0x448d1a,0xcc))['catch'](handleError(_0x448d1a,null));};exports['getSounds']=function(_0x5f391d,_0x294b5c,_0x1ab5a9){var _0x228192={};var _0x5869c3={};var _0x26efc2;var _0x4b5c97;return db[_0x9bff('0x2d')]['findOne']({'where':{'id':_0x5f391d['params']['id']}})[_0x9bff('0x23')](handleEntityNotFound(_0x294b5c,null))[_0x9bff('0x23')](function(_0x4bb2b2){if(_0x4bb2b2){_0x26efc2=_0x4bb2b2;_0x5869c3[_0x9bff('0x33')]=_[_0x9bff('0x30')](db[_0x9bff('0x6a')][_0x9bff('0x40')]);_0x5869c3[_0x9bff('0x31')]=_[_0x9bff('0x30')](_0x5f391d['query']);_0x5869c3[_0x9bff('0x32')]=_[_0x9bff('0x41')](_0x5869c3[_0x9bff('0x33')],_0x5869c3['query']);_0x228192[_0x9bff('0x34')]=_[_0x9bff('0x41')](_0x5869c3[_0x9bff('0x33')],qs[_0x9bff('0x6b')](_0x5f391d[_0x9bff('0x31')][_0x9bff('0x6b')]));_0x228192[_0x9bff('0x34')]=_0x228192[_0x9bff('0x34')][_0x9bff('0x35')]?_0x228192[_0x9bff('0x34')]:_0x5869c3[_0x9bff('0x33')];_0x228192[_0x9bff('0x37')]=qs['sort'](_0x5f391d['query']['sort']);_0x228192[_0x9bff('0x39')]=qs[_0x9bff('0x32')](_[_0x9bff('0x6c')](_0x5f391d[_0x9bff('0x31')],_0x5869c3[_0x9bff('0x32')]));if(_0x5f391d[_0x9bff('0x31')][_0x9bff('0x6d')]){_0x228192['where']=_[_0x9bff('0x3a')](_0x228192[_0x9bff('0x39')],{'$or':_[_0x9bff('0x2c')](_0x228192[_0x9bff('0x34')],function(_0x2cdd2c){var _0x566c29={};_0x566c29[_0x2cdd2c]={'$like':'%'+_0x5f391d[_0x9bff('0x31')][_0x9bff('0x6d')]+'%'};return _0x566c29;})});}_0x228192=_[_0x9bff('0x3a')]({},_0x228192,_0x5f391d['options']);return _0x26efc2[_0x9bff('0x6e')](_0x228192);}})[_0x9bff('0x23')](function(_0x8a85e0){if(_0x8a85e0){_0x4b5c97=_0x8a85e0['length'];if(!_0x5f391d[_0x9bff('0x31')][_0x9bff('0x6f')](_0x9bff('0x36'))){_0x228192[_0x9bff('0x19')]=qs['limit'](_0x5f391d['query']['limit']);_0x228192[_0x9bff('0x1a')]=qs['offset'](_0x5f391d['query'][_0x9bff('0x1a')]);}return _0x26efc2[_0x9bff('0x6e')](_0x228192);}})['then'](function(_0x5c4f41){if(_0x5c4f41){return _0x5c4f41?{'count':_0x4b5c97,'rows':_0x5c4f41}:null;}})[_0x9bff('0x23')](respondWithResult(_0x294b5c,null))[_0x9bff('0x45')](handleError(_0x294b5c,null));}; \ No newline at end of file +var _0x00a1=['order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','fields','find','body','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','createdAt','hasOwnProperty','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','length','nolimit'];(function(_0x46de08,_0x350a03){var _0x11dcff=function(_0x213b4d){while(--_0x213b4d){_0x46de08['push'](_0x46de08['shift']());}};_0x11dcff(++_0x350a03);}(_0x00a1,0x129));var _0x100a=function(_0x154a4a,_0x2524e3){_0x154a4a=_0x154a4a-0x0;var _0x2b036d=_0x00a1[_0x154a4a];return _0x2b036d;};'use strict';var emlformat=require(_0x100a('0x0'));var rimraf=require(_0x100a('0x1'));var zipdir=require(_0x100a('0x2'));var jsonpatch=require(_0x100a('0x3'));var rp=require(_0x100a('0x4'));var moment=require(_0x100a('0x5'));var BPromise=require(_0x100a('0x6'));var Mustache=require(_0x100a('0x7'));var util=require(_0x100a('0x8'));var path=require(_0x100a('0x9'));var sox=require(_0x100a('0xa'));var csv=require(_0x100a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x100a('0xc'));var _=require(_0x100a('0xd'));var squel=require(_0x100a('0xe'));var crypto=require('crypto');var jsforce=require(_0x100a('0xf'));var deskjs=require(_0x100a('0x10'));var toCsv=require(_0x100a('0xb'));var querystring=require(_0x100a('0x11'));var Papa=require(_0x100a('0x12'));var Redis=require('ioredis');var authService=require(_0x100a('0x13'));var qs=require(_0x100a('0x14'));var as=require(_0x100a('0x15'));var hardwareService=require(_0x100a('0x16'));var logger=require(_0x100a('0x17'))(_0x100a('0x18'));var utils=require(_0x100a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x100a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46308d,_0x5d792e){_0x5d792e=_0x5d792e||0xcc;return function(_0x4142b8){if(_0x4142b8){return _0x46308d[_0x100a('0x1b')](_0x5d792e);}return _0x46308d[_0x100a('0x1c')](_0x5d792e)[_0x100a('0x1d')]();};}function respondWithResult(_0x9e0931,_0x28844b){_0x28844b=_0x28844b||0xc8;return function(_0x1d31bc){if(_0x1d31bc){return _0x9e0931[_0x100a('0x1c')](_0x28844b)[_0x100a('0x1e')](_0x1d31bc);}};}function respondWithFilteredResult(_0x178f5d,_0x2e8db9){return function(_0xa8d48d){if(_0xa8d48d){var _0x3c7b31=typeof _0x2e8db9[_0x100a('0x1f')]===_0x100a('0x20')&&typeof _0x2e8db9['limit']===_0x100a('0x20');var _0x3dc5d9=_0xa8d48d[_0x100a('0x21')];var _0x49ec83=_0x3c7b31?0x0:_0x2e8db9['offset'];var _0x2e6ab1=_0x3c7b31?_0xa8d48d[_0x100a('0x21')]:_0x2e8db9[_0x100a('0x1f')]+_0x2e8db9[_0x100a('0x22')];var _0x469db9;if(_0x2e6ab1>=_0x3dc5d9){_0x2e6ab1=_0x3dc5d9;_0x469db9=0xc8;}else{_0x469db9=0xce;}_0x178f5d['status'](_0x469db9);return _0x178f5d[_0x100a('0x23')](_0x100a('0x24'),_0x49ec83+'-'+_0x2e6ab1+'/'+_0x3dc5d9)['json'](_0xa8d48d);}return null;};}function patchUpdates(_0x3f6508){return function(_0x48171e){try{jsonpatch[_0x100a('0x25')](_0x48171e,_0x3f6508,!![]);}catch(_0x3aaa44){return BPromise[_0x100a('0x26')](_0x3aaa44);}return _0x48171e[_0x100a('0x27')]();};}function saveUpdates(_0x2118a4,_0x2a0cbb){return function(_0x447564){if(_0x447564){return _0x447564[_0x100a('0x28')](_0x2118a4)[_0x100a('0x29')](function(_0x248c1e){return _0x248c1e;});}return null;};}function removeEntity(_0x559475,_0x2351c6){return function(_0x30af67){if(_0x30af67){return _0x30af67[_0x100a('0x2a')]()[_0x100a('0x29')](function(){var _0x45cefd=_0x30af67[_0x100a('0x2b')]({'plain':!![]});var _0x338ed2='MusicOnHolds';return db[_0x100a('0x2c')][_0x100a('0x2a')]({'where':{'type':_0x338ed2,'resourceId':_0x45cefd['id']}})['then'](function(){return _0x30af67;});})[_0x100a('0x29')](function(){_0x559475[_0x100a('0x1c')](0xcc)[_0x100a('0x1d')]();});}};}function handleEntityNotFound(_0x15eca5,_0x59d8f0){return function(_0x3ab9c6){if(!_0x3ab9c6){_0x15eca5[_0x100a('0x1b')](0x194);}return _0x3ab9c6;};}function handleError(_0x3472a0,_0x1d8a1c){_0x1d8a1c=_0x1d8a1c||0x1f4;return function(_0x5bc72c){logger[_0x100a('0x2d')](_0x5bc72c['stack']);if(_0x5bc72c['name']){delete _0x5bc72c[_0x100a('0x2e')];}_0x3472a0[_0x100a('0x1c')](_0x1d8a1c)[_0x100a('0x2f')](_0x5bc72c);};}exports['index']=function(_0x343b43,_0x598bbb){var _0x4b7cc5={},_0x581463={},_0x1d7fcc={'count':0x0,'rows':[]};var _0x538e40=_[_0x100a('0x30')](db['VoiceMusicOnHold'][_0x100a('0x31')],function(_0x276c1d){return{'name':_0x276c1d[_0x100a('0x32')],'type':_0x276c1d[_0x100a('0x33')]['key']};});_0x581463[_0x100a('0x34')]=_[_0x100a('0x30')](_0x538e40,'name');_0x581463['query']=_[_0x100a('0x35')](_0x343b43['query']);_0x581463[_0x100a('0x36')]=_[_0x100a('0x37')](_0x581463[_0x100a('0x34')],_0x581463[_0x100a('0x38')]);_0x4b7cc5[_0x100a('0x39')]=_[_0x100a('0x37')](_0x581463[_0x100a('0x34')],qs['fields'](_0x343b43[_0x100a('0x38')]['fields']));_0x4b7cc5[_0x100a('0x39')]=_0x4b7cc5[_0x100a('0x39')][_0x100a('0x3a')]?_0x4b7cc5[_0x100a('0x39')]:_0x581463[_0x100a('0x34')];if(!_0x343b43['query']['hasOwnProperty'](_0x100a('0x3b'))){_0x4b7cc5[_0x100a('0x22')]=qs[_0x100a('0x22')](_0x343b43[_0x100a('0x38')][_0x100a('0x22')]);_0x4b7cc5[_0x100a('0x1f')]=qs[_0x100a('0x1f')](_0x343b43[_0x100a('0x38')][_0x100a('0x1f')]);}_0x4b7cc5[_0x100a('0x3c')]=qs[_0x100a('0x3d')](_0x343b43['query'][_0x100a('0x3d')]);delete _0x343b43['query'][_0x100a('0x3d')];_0x4b7cc5[_0x100a('0x3e')]=qs[_0x100a('0x36')](_[_0x100a('0x3f')](_0x343b43[_0x100a('0x38')],_0x581463[_0x100a('0x36')]),_0x538e40);if(_0x343b43[_0x100a('0x38')][_0x100a('0x40')]){_0x4b7cc5[_0x100a('0x3e')]=_[_0x100a('0x41')](_0x4b7cc5['where'],{'$or':_[_0x100a('0x30')](_0x538e40,function(_0x34dc86){if(_0x34dc86[_0x100a('0x33')]!==_0x100a('0x42')){var _0x1d2008={};_0x1d2008[_0x34dc86['name']]={'$like':'%'+_0x343b43[_0x100a('0x38')]['filter']+'%'};return _0x1d2008;}})});}_0x4b7cc5=_[_0x100a('0x41')]({},_0x4b7cc5,_0x343b43[_0x100a('0x43')]);var _0x52de3a={'where':_0x4b7cc5[_0x100a('0x3e')]};return db[_0x100a('0x44')][_0x100a('0x21')](_0x52de3a)[_0x100a('0x29')](function(_0x158959){_0x1d7fcc[_0x100a('0x21')]=_0x158959;if(_0x343b43[_0x100a('0x38')][_0x100a('0x45')]){_0x4b7cc5[_0x100a('0x46')]=[{'all':!![]}];}return db[_0x100a('0x44')][_0x100a('0x47')](_0x4b7cc5);})['then'](function(_0x3944ab){_0x1d7fcc[_0x100a('0x48')]=_0x3944ab;return _0x1d7fcc;})[_0x100a('0x29')](respondWithFilteredResult(_0x598bbb,_0x4b7cc5))[_0x100a('0x49')](handleError(_0x598bbb,null));};exports[_0x100a('0x4a')]=function(_0x3510a6,_0x663171){var _0x2b4170={'raw':![],'where':{'id':_0x3510a6[_0x100a('0x4b')]['id']}},_0x2d4350={};_0x2d4350[_0x100a('0x34')]=_[_0x100a('0x35')](db[_0x100a('0x44')]['rawAttributes']);_0x2d4350[_0x100a('0x38')]=_['keys'](_0x3510a6[_0x100a('0x38')]);_0x2d4350[_0x100a('0x36')]=_[_0x100a('0x37')](_0x2d4350[_0x100a('0x34')],_0x2d4350[_0x100a('0x38')]);_0x2b4170[_0x100a('0x39')]=_[_0x100a('0x37')](_0x2d4350['model'],qs[_0x100a('0x4c')](_0x3510a6[_0x100a('0x38')][_0x100a('0x4c')]));_0x2b4170['attributes']=_0x2b4170[_0x100a('0x39')][_0x100a('0x3a')]?_0x2b4170['attributes']:_0x2d4350[_0x100a('0x34')];if(_0x3510a6[_0x100a('0x38')][_0x100a('0x45')]){_0x2b4170[_0x100a('0x46')]=[{'all':!![]}];}_0x2b4170=_[_0x100a('0x41')]({},_0x2b4170,_0x3510a6[_0x100a('0x43')]);return db['VoiceMusicOnHold'][_0x100a('0x4d')](_0x2b4170)[_0x100a('0x29')](handleEntityNotFound(_0x663171,null))['then'](respondWithResult(_0x663171,null))[_0x100a('0x49')](handleError(_0x663171,null));};exports[_0x100a('0x28')]=function(_0x28013a,_0x42a8a1){if(_0x28013a[_0x100a('0x4e')]['id']){delete _0x28013a[_0x100a('0x4e')]['id'];}return db[_0x100a('0x44')][_0x100a('0x4d')]({'where':{'id':_0x28013a[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](handleEntityNotFound(_0x42a8a1,null))[_0x100a('0x29')](saveUpdates(_0x28013a[_0x100a('0x4e')],null))[_0x100a('0x29')](respondWithResult(_0x42a8a1,null))['catch'](handleError(_0x42a8a1,null));};exports['create']=function(_0x1c6788,_0x2fd025,_0x444d11){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0x20e530){if(_0x1c6788[_0x100a('0x4e')][_0x100a('0x51')]===_0x100a('0x52')){_0x1c6788['body'][_0x100a('0x53')]=path[_0x100a('0x54')](config[_0x100a('0x55')],_0x100a('0x56'),_0x1c6788[_0x100a('0x4e')]['name']);}return db[_0x100a('0x44')]['create'](_0x1c6788[_0x100a('0x4e')],{'transaction':_0x20e530})[_0x100a('0x29')](function(_0x445122){if(_0x1c6788[_0x100a('0x4e')][_0x100a('0x51')]===_0x100a('0x52')){fs[_0x100a('0x57')](_0x445122[_0x100a('0x53')],parseInt(_0x100a('0x58'),0x8));}var _0x4d0e56=_0x1c6788[_0x100a('0x59')][_0x100a('0x2b')]({'plain':!![]});if(!_0x4d0e56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d0e56[_0x100a('0x5a')]===_0x100a('0x59')){var _0xf58e8c=_0x445122[_0x100a('0x2b')]({'plain':!![]});return db[_0x100a('0x5b')][_0x100a('0x4d')]({'where':{'name':_0x100a('0x5c'),'userProfileId':_0x4d0e56[_0x100a('0x5d')]},'raw':!![]})[_0x100a('0x29')](function(_0x259d3b){if(_0x259d3b&&_0x259d3b[_0x100a('0x5e')]===0x0){return db[_0x100a('0x2c')][_0x100a('0x5f')]({'name':_0xf58e8c[_0x100a('0x2e')],'resourceId':_0xf58e8c['id'],'type':_0x259d3b[_0x100a('0x2e')],'sectionId':_0x259d3b['id']},{})[_0x100a('0x29')](function(){return _0x445122;});}else{return _0x445122;}})[_0x100a('0x49')](function(_0x17f950){logger[_0x100a('0x2d')](_0x100a('0x60'),_0x17f950);});}return _0x445122;});})[_0x100a('0x29')](respondWithResult(_0x2fd025,0xc9))[_0x100a('0x49')](handleError(_0x2fd025,null));};exports['destroy']=function(_0x16f44d,_0x42a26c,_0x536cca){var _0x1f9148;return db[_0x100a('0x44')][_0x100a('0x4d')]({'where':{'id':_0x16f44d[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](function(_0x367e01){if(_0x367e01){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0x38936d){return _0x367e01[_0x100a('0x2a')]({'transaction':_0x38936d,'raw':!![]})[_0x100a('0x29')](function(_0x575879){if(_0x575879['directory']){fs[_0x100a('0x61')](_0x575879[_0x100a('0x53')])[_0x100a('0x62')](function(_0x9e8344){fs[_0x100a('0x63')](path['join'](_0x575879[_0x100a('0x53')],_0x9e8344));});fs[_0x100a('0x64')](_0x575879[_0x100a('0x53')]);}return _0x575879;});})[_0x100a('0x49')](function(_0x2f27a7){throw new db[(_0x100a('0x65'))][(_0x100a('0x66'))](_0x2f27a7[_0x100a('0x67')]);});}})[_0x100a('0x29')](handleEntityNotFound(_0x42a26c,null))[_0x100a('0x29')](removeEntity(_0x42a26c,null))[_0x100a('0x49')](handleError(_0x42a26c,null));};exports[_0x100a('0x68')]=function(_0x26c3d6,_0x73b108,_0x382f97){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0x4f6ba8){var _0x4d5da1;return db['VoiceMusicOnHold'][_0x100a('0x4d')]({'where':{'id':_0x26c3d6['params']['id']}})['then'](function(_0x2fbb79){if(_0x2fbb79){_0x4d5da1=_0x2fbb79;return _0x2fbb79[_0x100a('0x68')](_0x26c3d6[_0x100a('0x4e')]['id'],{'transaction':_0x4f6ba8});}})[_0x100a('0x29')](function(_0x124235){if(_0x124235){return db[_0x100a('0x69')][_0x100a('0x6a')]({'where':{'id':_0x26c3d6[_0x100a('0x4e')]['id']},'attributes':['id',_0x100a('0x2e'),_0x100a('0x6b'),_0x100a('0x6c'),'createdAt'],'raw':!![]});}})[_0x100a('0x29')](function(_0x3981ca){if(_0x3981ca){var _0x3b9dfd=path[_0x100a('0x54')](config[_0x100a('0x55')],_0x100a('0x6d'),util[_0x100a('0x6e')](_0x100a('0x6f'),path[_0x100a('0x70')](_0x3981ca[_0x100a('0x6b')],path['extname'](_0x3981ca[_0x100a('0x6b')])),_0x3981ca[_0x100a('0x6c')]));var _0x318fac=path[_0x100a('0x54')](config['root'],'server/files/moh',_0x4d5da1[_0x100a('0x2e')],util[_0x100a('0x6e')](_0x100a('0x6f'),_0x3981ca[_0x100a('0x2e')],_0x3981ca['converted_format']));fs[_0x100a('0x71')](_0x3b9dfd,_0x318fac);return _0x3981ca;}})[_0x100a('0x49')](function(_0x17050d){throw new db['Sequelize'][(_0x100a('0x66'))](_0x17050d['message']);});})[_0x100a('0x29')](handleEntityNotFound(_0x73b108,null))[_0x100a('0x29')](respondWithResult(_0x73b108,0xc9))[_0x100a('0x49')](handleError(_0x73b108,null));};exports[_0x100a('0x72')]=function(_0x215cf1,_0x48a948,_0x2dda50){return db[_0x100a('0x4f')][_0x100a('0x50')](function(_0xd92b8d){var _0x1d3aae;return db[_0x100a('0x44')]['findOne']({'where':{'id':_0x215cf1[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](handleEntityNotFound(_0x48a948,null))[_0x100a('0x29')](function(_0x2152d4){if(_0x2152d4){_0x1d3aae=_0x2152d4;return _0x2152d4[_0x100a('0x72')](_0x215cf1[_0x100a('0x4b')][_0x100a('0x73')]);}})['then'](function(_0x12739b){if(_0x12739b){return db['Sound']['findOne']({'where':{'id':_0x215cf1['params']['id2']},'attributes':['id',_0x100a('0x2e'),'save_name',_0x100a('0x6c'),_0x100a('0x74')],'raw':!![]});}})['then'](function(_0x503805){if(_0x503805){fs[_0x100a('0x63')](path[_0x100a('0x54')](_0x1d3aae[_0x100a('0x53')],util[_0x100a('0x6e')](_0x100a('0x6f'),_0x503805[_0x100a('0x2e')],_0x503805['converted_format'])));return _0x503805;}})[_0x100a('0x49')](function(_0x346ae0){throw new db[(_0x100a('0x65'))]['ValidationError'](_0x346ae0[_0x100a('0x67')]);});})[_0x100a('0x29')](handleEntityNotFound(_0x48a948,null))[_0x100a('0x29')](respondWithStatusCode(_0x48a948,0xcc))[_0x100a('0x49')](handleError(_0x48a948,null));};exports['getSounds']=function(_0x3d78c1,_0x5ac0a2,_0x593eaf){var _0x110a8d={};var _0x4ee579={};var _0xedb4e4;var _0x391926;return db[_0x100a('0x44')]['findOne']({'where':{'id':_0x3d78c1[_0x100a('0x4b')]['id']}})[_0x100a('0x29')](handleEntityNotFound(_0x5ac0a2,null))[_0x100a('0x29')](function(_0x7052ec){if(_0x7052ec){_0xedb4e4=_0x7052ec;_0x4ee579[_0x100a('0x34')]=_[_0x100a('0x35')](db[_0x100a('0x69')][_0x100a('0x31')]);_0x4ee579['query']=_[_0x100a('0x35')](_0x3d78c1[_0x100a('0x38')]);_0x4ee579['filters']=_['intersection'](_0x4ee579[_0x100a('0x34')],_0x4ee579[_0x100a('0x38')]);_0x110a8d[_0x100a('0x39')]=_[_0x100a('0x37')](_0x4ee579['model'],qs['fields'](_0x3d78c1['query'][_0x100a('0x4c')]));_0x110a8d[_0x100a('0x39')]=_0x110a8d[_0x100a('0x39')]['length']?_0x110a8d[_0x100a('0x39')]:_0x4ee579[_0x100a('0x34')];_0x110a8d[_0x100a('0x3c')]=qs[_0x100a('0x3d')](_0x3d78c1['query'][_0x100a('0x3d')]);_0x110a8d[_0x100a('0x3e')]=qs[_0x100a('0x36')](_['pick'](_0x3d78c1[_0x100a('0x38')],_0x4ee579['filters']));if(_0x3d78c1[_0x100a('0x38')][_0x100a('0x40')]){_0x110a8d[_0x100a('0x3e')]=_[_0x100a('0x41')](_0x110a8d['where'],{'$or':_[_0x100a('0x30')](_0x110a8d[_0x100a('0x39')],function(_0x12be5c){var _0x5495a9={};_0x5495a9[_0x12be5c]={'$like':'%'+_0x3d78c1[_0x100a('0x38')][_0x100a('0x40')]+'%'};return _0x5495a9;})});}_0x110a8d=_[_0x100a('0x41')]({},_0x110a8d,_0x3d78c1[_0x100a('0x43')]);return _0xedb4e4['getSounds'](_0x110a8d);}})['then'](function(_0x5f2e16){if(_0x5f2e16){_0x391926=_0x5f2e16['length'];if(!_0x3d78c1['query'][_0x100a('0x75')](_0x100a('0x3b'))){_0x110a8d['limit']=qs[_0x100a('0x22')](_0x3d78c1[_0x100a('0x38')][_0x100a('0x22')]);_0x110a8d[_0x100a('0x1f')]=qs[_0x100a('0x1f')](_0x3d78c1['query'][_0x100a('0x1f')]);}return _0xedb4e4[_0x100a('0x76')](_0x110a8d);}})['then'](function(_0x3ba192){if(_0x3ba192){return _0x3ba192?{'count':_0x391926,'rows':_0x3ba192}:null;}})[_0x100a('0x29')](respondWithResult(_0x5ac0a2,null))['catch'](handleError(_0x5ac0a2,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c9563f3..29a7ee3 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 _0x2350=['voice_musiconhold','lodash','util','api','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes','define'];(function(_0x49d54e,_0x2170ea){var _0x2d72ec=function(_0x5177d9){while(--_0x5177d9){_0x49d54e['push'](_0x49d54e['shift']());}};_0x2d72ec(++_0x2170ea);}(_0x2350,0xf1));var _0x0235=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0x2350[_0x1f4b18];return _0xde3957;};'use strict';var _=require(_0x0235('0x0'));var util=require(_0x0235('0x1'));var logger=require('../../config/logger')(_0x0235('0x2'));var moment=require(_0x0235('0x3'));var BPromise=require('bluebird');var rp=require(_0x0235('0x4'));var fs=require('fs');var path=require(_0x0235('0x5'));var rimraf=require(_0x0235('0x6'));var config=require('../../config/environment');var attributes=require(_0x0235('0x7'));module['exports']=function(_0x42f33f,_0x189c62){return _0x42f33f[_0x0235('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x0235('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x458c=['path','rimraf','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46743c,_0x848ab0){var _0x4ac8b5=function(_0x3fdba3){while(--_0x3fdba3){_0x46743c['push'](_0x46743c['shift']());}};_0x4ac8b5(++_0x848ab0);}(_0x458c,0xba));var _0xc458=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x458c[_0x3f55de];return _0x2698de;};'use strict';var _=require('lodash');var util=require(_0xc458('0x0'));var logger=require(_0xc458('0x1'))(_0xc458('0x2'));var moment=require(_0xc458('0x3'));var BPromise=require(_0xc458('0x4'));var rp=require(_0xc458('0x5'));var fs=require('fs');var path=require(_0xc458('0x6'));var rimraf=require(_0xc458('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xc458('0x8')]=function(_0x553ed0,_0xddb600){return _0x553ed0[_0xc458('0x9')](_0xc458('0xa'),attributes,{'tableName':_0xc458('0xb'),'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 04a0827..778bf65 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x28fbf3,_0x4f6808){var _0x149618=function(_0x387c05){while(--_0x387c05){_0x28fbf3['push'](_0x28fbf3['shift']());}};_0x149618(++_0x4f6808);}(_0x70e0,0x17b));var _0x070e=function(_0xbbc939,_0x18139f){_0xbbc939=_0xbbc939-0x0;var _0x20132e=_0x70e0[_0xbbc939];return _0x20132e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4477f9,_0x474dfd){var _0x27933e=function(_0x50d291){while(--_0x50d291){_0x4477f9['push'](_0x4477f9['shift']());}};_0x27933e(++_0x474dfd);}(_0xe706,0xa3));var _0x6e70=function(_0x4848cd,_0x3d9895){_0x4848cd=_0x4848cd-0x0;var _0x261a1d=_0xe706[_0x4848cd];return _0x261a1d;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c1363f5..88abfaa 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 _0xd9d9=['getAgents','post','addAgents','addTeams','delete','/:id/users','removeAgents','/:id/teams','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x522b97,_0x5bea1c){_0x522b97=_0x522b97-0x0;var _0x115fa1=_0xd9d9[_0x522b97];return _0x115fa1;};'use strict';var multer=require('multer');var util=require(_0x9d9d('0x0'));var path=require(_0x9d9d('0x1'));var timeout=require(_0x9d9d('0x2'));var express=require(_0x9d9d('0x3'));var router=express[_0x9d9d('0x4')]();var fs_extra=require(_0x9d9d('0x5'));var auth=require(_0x9d9d('0x6'));var interaction=require(_0x9d9d('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x9d9d('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d9d('0x9')]);router['get'](_0x9d9d('0xa'),auth[_0x9d9d('0xb')](),controller[_0x9d9d('0xc')]);router['get'](_0x9d9d('0xd'),auth[_0x9d9d('0xb')](),controller[_0x9d9d('0xe')]);router['get']('/:id/users',auth[_0x9d9d('0xb')](),controller[_0x9d9d('0xf')]);router[_0x9d9d('0x8')]('/:id/teams',auth[_0x9d9d('0xb')](),controller['getTeams']);router[_0x9d9d('0x10')]('/',auth[_0x9d9d('0xb')](),controller['create']);router[_0x9d9d('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x9d9d('0x11')]);router[_0x9d9d('0x10')]('/:id/teams',auth[_0x9d9d('0xb')](),controller[_0x9d9d('0x12')]);router['put']('/:id',auth[_0x9d9d('0xb')](),controller['update']);router['delete']('/:id',auth[_0x9d9d('0xb')](),controller['destroy']);router[_0x9d9d('0x13')](_0x9d9d('0x14'),auth[_0x9d9d('0xb')](),controller[_0x9d9d('0x15')]);router['delete'](_0x9d9d('0x16'),auth[_0x9d9d('0xb')](),controller[_0x9d9d('0x17')]);module[_0x9d9d('0x18')]=router; \ No newline at end of file +var _0x20ad=['/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x20ad,0x13a));var _0xd20a=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x20ad[_0x53cf8e];return _0x459197;};'use strict';var multer=require(_0xd20a('0x0'));var util=require(_0xd20a('0x1'));var path=require(_0xd20a('0x2'));var timeout=require(_0xd20a('0x3'));var express=require('express');var router=express[_0xd20a('0x4')]();var fs_extra=require(_0xd20a('0x5'));var auth=require(_0xd20a('0x6'));var interaction=require(_0xd20a('0x7'));var config=require(_0xd20a('0x8'));var controller=require(_0xd20a('0x9'));router[_0xd20a('0xa')]('/',auth[_0xd20a('0xb')](),controller[_0xd20a('0xc')]);router['get'](_0xd20a('0xd'),auth[_0xd20a('0xb')](),controller['describe']);router[_0xd20a('0xa')](_0xd20a('0xe'),auth[_0xd20a('0xb')](),controller[_0xd20a('0xf')]);router[_0xd20a('0xa')](_0xd20a('0x10'),auth[_0xd20a('0xb')](),controller[_0xd20a('0x11')]);router['get'](_0xd20a('0x12'),auth['isAuthenticated'](),controller[_0xd20a('0x13')]);router['post']('/',auth[_0xd20a('0xb')](),controller[_0xd20a('0x14')]);router[_0xd20a('0x15')](_0xd20a('0x10'),auth[_0xd20a('0xb')](),controller[_0xd20a('0x16')]);router[_0xd20a('0x15')](_0xd20a('0x12'),auth['isAuthenticated'](),controller[_0xd20a('0x17')]);router[_0xd20a('0x18')](_0xd20a('0xe'),auth['isAuthenticated'](),controller[_0xd20a('0x19')]);router[_0xd20a('0x1a')](_0xd20a('0xe'),auth[_0xd20a('0xb')](),controller['destroy']);router[_0xd20a('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xd20a('0x1b')]);router[_0xd20a('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd20a('0x1c')]);module[_0xd20a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b8179e3..f54d9a0 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 _0xfb09=['getDataValue','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x155444,_0x113d2a){var _0x41b879=function(_0x37f4f5){while(--_0x37f4f5){_0x155444['push'](_0x155444['shift']());}};_0x41b879(++_0x113d2a);}(_0xfb09,0x1d5));var _0x9fb0=function(_0x3199f2,_0x36a5b1){_0x3199f2=_0x3199f2-0x0;var _0x1d8662=_0xfb09[_0x3199f2];return _0x1d8662;};'use strict';var Sequelize=require(_0x9fb0('0x0'));module[_0x9fb0('0x1')]={'name':{'type':Sequelize[_0x9fb0('0x2')],'allowNull':![],'unique':_0x9fb0('0x3')},'prefix':{'type':Sequelize[_0x9fb0('0x4')],'get':function(_0x2aae59){return'system-'+this[_0x9fb0('0x5')](_0x9fb0('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x9fb0('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9af6=['STRING','name','getDataValue','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9af6,0x142));var _0x69af=function(_0x2621ac,_0x4d8774){_0x2621ac=_0x2621ac-0x0;var _0x57bc8c=_0x9af6[_0x2621ac];return _0x57bc8c;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'name':{'type':Sequelize[_0x69af('0x2')],'allowNull':![],'unique':_0x69af('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5caf24){return'system-'+this[_0x69af('0x4')](_0x69af('0x3'))+'-';}},'description':{'type':Sequelize[_0x69af('0x2')]},'callerIdAll':{'type':Sequelize[_0x69af('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x69af('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9277670..9d204c7 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 _0x84a0=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','online','voicePause','interface','flatMap','Agents','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84a0,0x66));var _0x084a=function(_0x29e09d,_0x290cdd){_0x29e09d=_0x29e09d-0x0;var _0x58469c=_0x84a0[_0x29e09d];return _0x58469c;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];config[_0x084a('0x18')]=_[_0x084a('0x19')](config[_0x084a('0x18')],{'host':_0x084a('0x1a'),'port':0x18eb});var socket=require(_0x084a('0x1b'))(new Redis(config[_0x084a('0x18')]));require(_0x084a('0x1c'))['register'](socket);function respondWithStatusCode(_0x4277c9,_0x4b9cc5){_0x4b9cc5=_0x4b9cc5||0xcc;return function(_0x225de0){if(_0x225de0){return _0x4277c9[_0x084a('0x1d')](_0x4b9cc5);}return _0x4277c9[_0x084a('0x1e')](_0x4b9cc5)[_0x084a('0x1f')]();};}function respondWithResult(_0xd20527,_0x4cbd16){_0x4cbd16=_0x4cbd16||0xc8;return function(_0x443ebb){if(_0x443ebb){return _0xd20527['status'](_0x4cbd16)[_0x084a('0x20')](_0x443ebb);}};}function respondWithFilteredResult(_0x355b45,_0x4af43e){return function(_0xf2c333){if(_0xf2c333){var _0x32c729=typeof _0x4af43e[_0x084a('0x21')]===_0x084a('0x22')&&typeof _0x4af43e[_0x084a('0x23')]===_0x084a('0x22');var _0x447a19=_0xf2c333[_0x084a('0x24')];var _0x3f60cf=_0x32c729?0x0:_0x4af43e[_0x084a('0x21')];var _0x3c7fd6=_0x32c729?_0xf2c333[_0x084a('0x24')]:_0x4af43e[_0x084a('0x21')]+_0x4af43e[_0x084a('0x23')];var _0xf0dd98;if(_0x3c7fd6>=_0x447a19){_0x3c7fd6=_0x447a19;_0xf0dd98=0xc8;}else{_0xf0dd98=0xce;}_0x355b45['status'](_0xf0dd98);return _0x355b45[_0x084a('0x25')](_0x084a('0x26'),_0x3f60cf+'-'+_0x3c7fd6+'/'+_0x447a19)[_0x084a('0x20')](_0xf2c333);}return null;};}function patchUpdates(_0x2d62bf){return function(_0x1c3f6c){try{jsonpatch['apply'](_0x1c3f6c,_0x2d62bf,!![]);}catch(_0x755c24){return BPromise[_0x084a('0x27')](_0x755c24);}return _0x1c3f6c[_0x084a('0x28')]();};}function saveUpdates(_0x1f2c9f,_0x18b43d){return function(_0x3cdc1e){if(_0x3cdc1e){return _0x3cdc1e['update'](_0x1f2c9f)[_0x084a('0x29')](function(_0x2af138){return _0x2af138;});}return null;};}function removeEntity(_0x54233b,_0x5b1474){return function(_0x8806d5){if(_0x8806d5){return _0x8806d5[_0x084a('0x2a')]()[_0x084a('0x29')](function(){var _0x4c5658=_0x8806d5['get']({'plain':!![]});var _0x4874fe='VoicePrefixes';return db[_0x084a('0x2b')]['destroy']({'where':{'type':_0x4874fe,'resourceId':_0x4c5658['id']}})['then'](function(){return _0x8806d5;});})['then'](function(){_0x54233b[_0x084a('0x1e')](0xcc)[_0x084a('0x1f')]();});}};}function handleEntityNotFound(_0x388062,_0x2c4149){return function(_0x3be7a6){if(!_0x3be7a6){_0x388062[_0x084a('0x1d')](0x194);}return _0x3be7a6;};}function handleError(_0x378de6,_0x16053f){_0x16053f=_0x16053f||0x1f4;return function(_0x5e6ea8){logger[_0x084a('0x2c')](_0x5e6ea8[_0x084a('0x2d')]);if(_0x5e6ea8['name']){delete _0x5e6ea8[_0x084a('0x2e')];}_0x378de6[_0x084a('0x1e')](_0x16053f)[_0x084a('0x2f')](_0x5e6ea8);};}exports[_0x084a('0x30')]=function(_0x448ae9,_0x202602){var _0x3a99fe={},_0x1e971a={},_0x50cb54={'count':0x0,'rows':[]};var _0x2f59a6=_[_0x084a('0x31')](db[_0x084a('0x32')][_0x084a('0x33')],function(_0x49c9db){return{'name':_0x49c9db['fieldName'],'type':_0x49c9db[_0x084a('0x34')][_0x084a('0x35')]};});_0x1e971a[_0x084a('0x36')]=_[_0x084a('0x31')](_0x2f59a6,_0x084a('0x2e'));_0x1e971a['query']=_[_0x084a('0x37')](_0x448ae9[_0x084a('0x38')]);_0x1e971a[_0x084a('0x39')]=_['intersection'](_0x1e971a[_0x084a('0x36')],_0x1e971a[_0x084a('0x38')]);_0x3a99fe[_0x084a('0x3a')]=_['intersection'](_0x1e971a['model'],qs['fields'](_0x448ae9[_0x084a('0x38')][_0x084a('0x3b')]));_0x3a99fe[_0x084a('0x3a')]=_0x3a99fe['attributes'][_0x084a('0x3c')]?_0x3a99fe[_0x084a('0x3a')]:_0x1e971a[_0x084a('0x36')];if(!_0x448ae9[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x3a99fe[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x448ae9[_0x084a('0x38')][_0x084a('0x23')]);_0x3a99fe[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x448ae9[_0x084a('0x38')][_0x084a('0x21')]);}_0x3a99fe[_0x084a('0x3f')]=qs['sort'](_0x448ae9[_0x084a('0x38')][_0x084a('0x40')]);_0x3a99fe[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x448ae9[_0x084a('0x38')],_0x1e971a[_0x084a('0x39')]),_0x2f59a6);if(_0x448ae9[_0x084a('0x38')][_0x084a('0x43')]){_0x3a99fe['where']=_[_0x084a('0x44')](_0x3a99fe[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x2f59a6,function(_0x432eb7){if(_0x432eb7[_0x084a('0x34')]!==_0x084a('0x45')){var _0x515743={};_0x515743[_0x432eb7[_0x084a('0x2e')]]={'$like':'%'+_0x448ae9[_0x084a('0x38')]['filter']+'%'};return _0x515743;}})});}_0x3a99fe=_[_0x084a('0x44')]({},_0x3a99fe,_0x448ae9[_0x084a('0x46')]);var _0x68e0d6={'where':_0x3a99fe['where']};return db[_0x084a('0x32')][_0x084a('0x24')](_0x68e0d6)['then'](function(_0x3e2b92){_0x50cb54[_0x084a('0x24')]=_0x3e2b92;if(_0x448ae9['query']['includeAll']){_0x3a99fe[_0x084a('0x47')]=[{'all':!![]}];}return db[_0x084a('0x32')][_0x084a('0x48')](_0x3a99fe);})[_0x084a('0x29')](function(_0x1e2a2d){_0x50cb54[_0x084a('0x49')]=_0x1e2a2d;return _0x50cb54;})[_0x084a('0x29')](respondWithFilteredResult(_0x202602,_0x3a99fe))[_0x084a('0x4a')](handleError(_0x202602,null));};exports[_0x084a('0x4b')]=function(_0x8b61f5,_0x30f8a4){var _0x593cc8={'raw':![],'where':{'id':_0x8b61f5[_0x084a('0x4c')]['id']}},_0x51dbda={};_0x51dbda[_0x084a('0x36')]=_[_0x084a('0x37')](db['VoicePrefix'][_0x084a('0x33')]);_0x51dbda[_0x084a('0x38')]=_[_0x084a('0x37')](_0x8b61f5[_0x084a('0x38')]);_0x51dbda[_0x084a('0x39')]=_['intersection'](_0x51dbda[_0x084a('0x36')],_0x51dbda['query']);_0x593cc8[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x51dbda[_0x084a('0x36')],qs['fields'](_0x8b61f5['query'][_0x084a('0x3b')]));_0x593cc8[_0x084a('0x3a')]=_0x593cc8['attributes'][_0x084a('0x3c')]?_0x593cc8[_0x084a('0x3a')]:_0x51dbda[_0x084a('0x36')];if(_0x8b61f5[_0x084a('0x38')]['includeAll']){_0x593cc8[_0x084a('0x47')]=[{'all':!![]}];}_0x593cc8=_[_0x084a('0x44')]({},_0x593cc8,_0x8b61f5[_0x084a('0x46')]);return db[_0x084a('0x32')]['find'](_0x593cc8)[_0x084a('0x29')](handleEntityNotFound(_0x30f8a4,null))[_0x084a('0x29')](respondWithResult(_0x30f8a4,null))[_0x084a('0x4a')](handleError(_0x30f8a4,null));};exports[_0x084a('0x2a')]=function(_0x5a718c,_0x502d9a){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x5a718c[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x502d9a,null))[_0x084a('0x29')](removeEntity(_0x502d9a,null))[_0x084a('0x4a')](handleError(_0x502d9a,null));};exports[_0x084a('0x4f')]=function(_0x12c3a8,_0xf6ce0d){return db[_0x084a('0x32')][_0x084a('0x4f')]()[_0x084a('0x29')](respondWithResult(_0xf6ce0d,null))['catch'](handleError(_0xf6ce0d,null));};exports[_0x084a('0x50')]=function(_0x37fce4,_0x29fa4b){var _0x39edc1;return db[_0x084a('0x51')][_0x084a('0x52')](function(_0xa5362){return db['VoicePrefix'][_0x084a('0x50')](_0x37fce4[_0x084a('0x53')],{'transaction':_0xa5362})[_0x084a('0x29')](function(_0x54aa6c){_0x39edc1=_0x54aa6c['get']({'plain':!![]});return db[_0x084a('0x54')]['find']({'where':{'id':_0x39edc1[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x490ad9){return createVoicePrefixExtensions(_0x39edc1,_0x490ad9,_0xa5362);});});})[_0x084a('0x29')](function(){var _0x54e9a5=_0x37fce4['user'][_0x084a('0x56')]({'plain':!![]});if(!_0x54e9a5)throw new Error(_0x084a('0x57'));if(_0x54e9a5[_0x084a('0x58')]===_0x084a('0x59')){var _0x2a8056=_0x39edc1;return db[_0x084a('0x5a')][_0x084a('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x54e9a5[_0x084a('0x5b')]},'raw':!![]})[_0x084a('0x29')](function(_0x3d7f0a){if(_0x3d7f0a&&_0x3d7f0a['autoAssociation']===0x0){return db[_0x084a('0x2b')][_0x084a('0x50')]({'name':_0x2a8056[_0x084a('0x2e')],'resourceId':_0x2a8056['id'],'type':_0x3d7f0a[_0x084a('0x2e')],'sectionId':_0x3d7f0a['id']},{})['then'](function(){return _0x39edc1;});}else{return _0x39edc1;}})[_0x084a('0x4a')](function(_0x58fe64){logger[_0x084a('0x2c')](_0x084a('0x5c'),_0x58fe64);throw _0x58fe64;});}return _0x39edc1;})[_0x084a('0x29')](respondWithResult(_0x29fa4b,null))['catch'](handleError(_0x29fa4b,null));};function Extension(_0x589e38,_0xd37003,_0x2f228c,_0x598075){this[_0x084a('0x5d')]='from-sip';this['exten']=_0x589e38;this[_0x084a('0x5e')]=_0x2f228c;this[_0x084a('0x34')]=_0x084a('0x5f');this[_0x084a('0x60')]=_0x084a('0x61');this[_0x084a('0x62')]=_0xd37003;this[_0x084a('0x63')]=_0x598075;}function createVoicePrefixExtensions(_0x5ab9d6,_0x114aa5,_0x50fe69){return new BPromise(function(_0x445563,_0x12588a){var _0x3668eb=new Extension(formatPrefixName(_0x5ab9d6['prefix']),0x1,_0x084a('0x64'),_0x084a('0x65'));_0x3668eb['VoicePrefixId']=_0x5ab9d6['id'];return db[_0x084a('0x54')]['create'](_0x3668eb,{'transaction':_0x50fe69})['then'](function(_0x1c40f3){var _0x534db3=_0x1c40f3['get']({'plain':!![]});var _0x2368f5=_[_0x084a('0x31')](addVoicePrefixExtensions(_0x5ab9d6,_0x114aa5),function(_0x495304){_0x495304['VoiceExtensionId']=_0x534db3['id'];_0x495304[_0x084a('0x66')]=_0x5ab9d6['id'];return _0x495304;});return db[_0x084a('0x54')][_0x084a('0x67')](_0x2368f5,{'transaction':_0x50fe69})[_0x084a('0x29')](function(_0x45e2d3){if(!_0x45e2d3){return _0x12588a(_0x084a('0x68'));}else{return _0x445563(_0x45e2d3);}})[_0x084a('0x4a')](function(_0x560f60){return _0x12588a(_0x560f60);});});;});};function addVoicePrefixExtensions(_0x51e090,_0x2ba35a){var _0x36ba24=[];var _0x5c77a3=formatPrefixName(_0x51e090[_0x084a('0x69')]);_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x2,_0x084a('0x6b'),_0x084a('0x6c')+_0x51e090['name']));if(_0x51e090[_0x084a('0x6d')]){_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x6b'),'PREFIX-CALLERIDALL='+_0x51e090['callerIdAll']));}else{_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x64'),_0x084a('0x6e')));}_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x4,_0x084a('0x6f'),_0x2ba35a[_0x084a('0x5d')]+','+_0x084a('0x70')+(0x8+_0x51e090['name'][_0x084a('0x3c')])+'}'+','+0x1));return _0x36ba24;}function formatPrefixName(_0x51a066){var _0x4e713c='_';for(var _0x24a553=0x0;_0x24a553<_0x51a066[_0x084a('0x3c')];_0x24a553++){if(_0x51a066[_0x084a('0x71')](_0x24a553)=='-'){_0x4e713c+=_0x51a066['charAt'](_0x24a553);}else{_0x4e713c+='['+_0x51a066[_0x084a('0x71')](_0x24a553)+']';}}_0x4e713c+='.';return _0x4e713c;}exports['update']=function(_0x1eb7be,_0x1054ea,_0x2417b4){var _0x12cef4=_0x1eb7be[_0x084a('0x53')];_0x12cef4[_0x084a('0x69')]='system-'+_0x12cef4['name']+'-';return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x782285){return db[_0x084a('0x32')][_0x084a('0x72')](_0x12cef4,{'where':{'id':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db['VoiceExtension'][_0x084a('0x2a')]({'where':{'VoicePrefixId':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db[_0x084a('0x54')][_0x084a('0x4e')]({'where':{'id':_0x12cef4[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x537578){return createVoicePrefixExtensions(_0x12cef4,_0x537578,_0x782285);});});});})['then'](function(){return db[_0x084a('0x32')][_0x084a('0x73')](_0x12cef4['id']);})[_0x084a('0x29')](respondWithResult(_0x1054ea,null))[_0x084a('0x4a')](handleError(_0x1054ea,null));};exports[_0x084a('0x74')]=function(_0xb287e7,_0x3824db,_0x26cd70){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0xb287e7['params']['id']}})['then'](handleEntityNotFound(_0x3824db,null))['then'](function(_0x2216d4){if(_0x2216d4){return _0x2216d4[_0x084a('0x74')](_0xb287e7['body'][_0x084a('0x75')],_[_0x084a('0x76')](_0xb287e7[_0x084a('0x53')],[_0x084a('0x75'),'id'])||{})['spread'](function(_0x50cb3a){for(var _0x30ea2a=0x0;_0x30ea2a<_0xb287e7[_0x084a('0x53')][_0x084a('0x75')][_0x084a('0x3c')];_0x30ea2a+=0x1){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':Number(_0xb287e7[_0x084a('0x53')]['ids'][_0x30ea2a]),'VoicePrefixId':Number(_0xb287e7[_0x084a('0x4c')]['id'])});}return _0x50cb3a;});}})[_0x084a('0x29')](respondWithResult(_0x3824db,null))[_0x084a('0x4a')](handleError(_0x3824db,null));};exports[_0x084a('0x79')]=function(_0x3dcafb,_0x31b89a,_0x14617e){return db['VoicePrefix'][_0x084a('0x4e')]({'where':{'id':_0x3dcafb[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x31b89a,null))[_0x084a('0x29')](function(_0x417048){if(_0x417048){return _0x417048[_0x084a('0x79')](_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')])[_0x084a('0x29')](function(){if(_[_0x084a('0x7a')](_0x3dcafb[_0x084a('0x38')]['ids'])){for(var _0x2932b6=0x0;_0x2932b6<_0x3dcafb[_0x084a('0x38')]['ids'][_0x084a('0x3c')];_0x2932b6+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')][_0x2932b6]),'VoicePrefixId':Number(_0x3dcafb['params']['id'])});}}else{socket[_0x084a('0x77')](_0x084a('0x7b'),{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')]),'VoicePrefixId':Number(_0x3dcafb[_0x084a('0x4c')]['id'])});}});}})[_0x084a('0x29')](respondWithStatusCode(_0x31b89a,null))[_0x084a('0x4a')](handleError(_0x31b89a,null));};exports[_0x084a('0x7c')]=function(_0x1916b1,_0x8074aa,_0xe03abd){var _0x7c85e3={};var _0x19ea24={};var _0x18cf1e;var _0x3b8dda;return db['VoicePrefix'][_0x084a('0x7d')]({'where':{'id':_0x1916b1[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x8074aa,null))[_0x084a('0x29')](function(_0x1a99b2){if(_0x1a99b2){_0x18cf1e=_0x1a99b2;_0x19ea24[_0x084a('0x36')]=_[_0x084a('0x37')](db[_0x084a('0x7e')]['rawAttributes']);_0x19ea24['query']=_[_0x084a('0x37')](_0x1916b1[_0x084a('0x38')]);_0x19ea24['filters']=_['intersection'](_0x19ea24[_0x084a('0x36')],_0x19ea24['query']);_0x7c85e3[_0x084a('0x3a')]=_['intersection'](_0x19ea24[_0x084a('0x36')],qs[_0x084a('0x3b')](_0x1916b1[_0x084a('0x38')][_0x084a('0x3b')]));_0x7c85e3['attributes']=_0x7c85e3['attributes']['length']?_0x7c85e3[_0x084a('0x3a')]:_0x19ea24[_0x084a('0x36')];_0x7c85e3[_0x084a('0x3f')]=qs['sort'](_0x1916b1[_0x084a('0x38')][_0x084a('0x40')]);_0x7c85e3['where']=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x1916b1['query'],_0x19ea24[_0x084a('0x39')]));if(_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]){_0x7c85e3['where']=_['merge'](_0x7c85e3[_0x084a('0x41')],{'$or':_['map'](_0x7c85e3[_0x084a('0x3a')],function(_0x67d92b){var _0x11894e={};_0x11894e[_0x67d92b]={'$like':'%'+_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]+'%'};return _0x11894e;})});}_0x7c85e3=_[_0x084a('0x44')]({},_0x7c85e3,_0x1916b1['options']);return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})['then'](function(_0x5ce185){if(_0x5ce185){_0x3b8dda=_0x5ce185[_0x084a('0x3c')];if(!_0x1916b1[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x7c85e3[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x1916b1['query']['limit']);_0x7c85e3[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x1916b1[_0x084a('0x38')]['offset']);}return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})[_0x084a('0x29')](function(_0x4eb3da){if(_0x4eb3da){return _0x4eb3da?{'count':_0x3b8dda,'rows':_0x4eb3da}:null;}})['then'](respondWithResult(_0x8074aa,null))[_0x084a('0x4a')](handleError(_0x8074aa,null));};exports['getTeams']=function(_0x5c93b2,_0x135e46,_0x2d9c66){var _0x57d90c={};var _0x42d267={};var _0x2ee08a;var _0x4f40c4;return db[_0x084a('0x32')][_0x084a('0x7d')]({'where':{'id':_0x5c93b2[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x135e46,null))[_0x084a('0x29')](function(_0x29cdb8){if(_0x29cdb8){_0x2ee08a=_0x29cdb8;_0x42d267['model']=_['keys'](db[_0x084a('0x7f')][_0x084a('0x33')]);_0x42d267['query']=_[_0x084a('0x37')](_0x5c93b2['query']);_0x42d267[_0x084a('0x39')]=_[_0x084a('0x4d')](_0x42d267[_0x084a('0x36')],_0x42d267[_0x084a('0x38')]);_0x57d90c[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x42d267['model'],qs['fields'](_0x5c93b2[_0x084a('0x38')][_0x084a('0x3b')]));_0x57d90c[_0x084a('0x3a')]=_0x57d90c[_0x084a('0x3a')][_0x084a('0x3c')]?_0x57d90c['attributes']:_0x42d267[_0x084a('0x36')];_0x57d90c[_0x084a('0x3f')]=qs[_0x084a('0x40')](_0x5c93b2[_0x084a('0x38')]['sort']);_0x57d90c[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x5c93b2[_0x084a('0x38')],_0x42d267[_0x084a('0x39')]));if(_0x5c93b2[_0x084a('0x38')][_0x084a('0x43')]){_0x57d90c[_0x084a('0x41')]=_[_0x084a('0x44')](_0x57d90c[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x57d90c['attributes'],function(_0x5ed84e){var _0x35df86={};_0x35df86[_0x5ed84e]={'$like':'%'+_0x5c93b2['query'][_0x084a('0x43')]+'%'};return _0x35df86;})});}_0x57d90c=_[_0x084a('0x44')]({},_0x57d90c,_0x5c93b2[_0x084a('0x46')]);return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x5412d1){if(_0x5412d1){_0x4f40c4=_0x5412d1[_0x084a('0x3c')];if(!_0x5c93b2[_0x084a('0x38')]['hasOwnProperty'](_0x084a('0x3e'))){_0x57d90c[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x5c93b2['query'][_0x084a('0x23')]);_0x57d90c[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x5c93b2[_0x084a('0x38')][_0x084a('0x21')]);}return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x37d422){if(_0x37d422){return _0x37d422?{'count':_0x4f40c4,'rows':_0x37d422}:null;}})['then'](respondWithResult(_0x135e46,null))[_0x084a('0x4a')](handleError(_0x135e46,null));};exports[_0x084a('0x81')]=function(_0x355c04,_0x8b89d0,_0x5db744){var _0x45a53a=_0x355c04[_0x084a('0x53')][_0x084a('0x75')];var _0xab0f66;return db[_0x084a('0x7f')][_0x084a('0x48')]({'where':{'id':_0x45a53a},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':'Agents','attributes':['id',_0x084a('0x2e'),_0x084a('0x82'),_0x084a('0x83'),_0x084a('0x84')],'raw':!![]}]})[_0x084a('0x29')](function(_0x4087bf){if(_0x4087bf){_0xab0f66=_0x4087bf;var _0x88598d=_[_0x084a('0x85')](_0x4087bf,function(_0x1106ff){var _0x3339d4=_0x1106ff[_0x084a('0x56')]({'plain':!![]});return _0x3339d4[_0x084a('0x86')];});return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x355c04[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x378b74){return db['sequelize'][_0x084a('0x52')](function(_0x383bb8){return _0x378b74[_0x084a('0x81')](_0x45a53a,{'transaction':_0x383bb8})[_0x084a('0x29')](function(){return BPromise['each'](_0xab0f66,function(_0x133f4c){return db[_0x084a('0x87')][_0x084a('0x88')]({'TeamId':_0x133f4c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},{'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){return BPromise[_0x084a('0x89')](_0x88598d,function(_0x5b5c6c){return db['UserVoicePrefix'][_0x084a('0x8a')]({'where':{'UserId':_0x5b5c6c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){_0x88598d[_0x084a('0x8b')](function(_0x3dd10e){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':_0x3dd10e['id'],'VoicePrefixId':_0x378b74['id']});});});});});}})[_0x084a('0x29')](respondWithStatusCode(_0x8b89d0,null))['catch'](handleError(_0x8b89d0,null));};exports[_0x084a('0x8c')]=function(_0x294cca,_0x3be1f3,_0x1c6dec){return db['Team']['findAll']({'where':{'id':_0x294cca[_0x084a('0x38')][_0x084a('0x75')]},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':_0x084a('0x86'),'attributes':['id'],'raw':!![]}]})[_0x084a('0x29')](handleEntityNotFound(_0x3be1f3,null))['then'](function(_0x57ed50){var _0x5288ea=_[_0x084a('0x31')](_0x57ed50,'id');var _0x19aff1=[];var _0x5dab17=[];var _0x3983b1=squel[_0x084a('0x8d')]();_0x3983b1['field'](_0x084a('0x8e'))[_0x084a('0x8f')](_0x084a('0x90'),'tq')['join'](_0x084a('0x91'),'ut',_0x084a('0x92'))[_0x084a('0x41')](_0x084a('0x93'),_0x294cca[_0x084a('0x4c')]['id']);for(var _0x1d6333=0x0;_0x1d6333<_0x57ed50['length'];_0x1d6333+=0x1){let _0x277932=_0x57ed50[_0x1d6333];for(var _0x5f16a1=0x0;_0x5f16a1<_0x277932[_0x084a('0x86')]['length'];_0x5f16a1+=0x1){let _0x4156fa=_0x277932[_0x084a('0x86')][_0x5f16a1];var _0x43f940=_0x3983b1[_0x084a('0x94')]();_0x43f940[_0x084a('0x41')](_0x084a('0x95'),_0x4156fa['id']);_0x5dab17[_0x084a('0x6a')](db[_0x084a('0x51')][_0x084a('0x38')](_0x43f940[_0x084a('0x96')](),{'type':db[_0x084a('0x51')][_0x084a('0x97')]['SELECT']})[_0x084a('0x29')](function(_0x44f94e){if(_0x44f94e[_0x084a('0x3c')]===0x1){return _0x4156fa['id'];}else{var _0x4725a0=_[_0x084a('0x98')](_[_0x084a('0x31')](_0x44f94e,_0x084a('0x99')),function(_0x13b3f0){return _['includes'](_0x5288ea,_0x13b3f0);});if(_0x4725a0){return _0x4156fa['id'];}}}));}}return BPromise['all'](_0x5dab17)['then'](function(_0x1bcb9d){_0x19aff1=_(_0x19aff1)[_0x084a('0x9a')](_0x1bcb9d)[_0x084a('0x9b')]()[_0x084a('0x9c')]();return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x294cca[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x1997ee){return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x1f5843){return _0x1997ee[_0x084a('0x8c')](_0x294cca[_0x084a('0x38')][_0x084a('0x75')],{'transaction':_0x1f5843})[_0x084a('0x29')](function(){if(!_[_0x084a('0x9d')](_0x19aff1)){return _0x1997ee[_0x084a('0x79')](_0x19aff1,{'transaction':_0x1f5843});}})[_0x084a('0x29')](function(){_0x19aff1[_0x084a('0x8b')](function(_0x2ee2a7){socket['emit'](_0x084a('0x7b'),{'UserId':_0x2ee2a7,'VoicePrefixId':_0x1997ee['id']});});});});});});})[_0x084a('0x29')](respondWithStatusCode(_0x3be1f3,null))[_0x084a('0x4a')](handleError(_0x3be1f3,null));}; \ No newline at end of file +var _0x1775=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','User','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x26f099,_0x2d96a2){var _0x942b90=function(_0x1c2e99){while(--_0x1c2e99){_0x26f099['push'](_0x26f099['shift']());}};_0x942b90(++_0x2d96a2);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){var _0x231d35=_0x577bf7[_0x5177('0x31')]({'plain':!![]});var _0x58846c=_0x5177('0x32');return db[_0x5177('0x33')][_0x5177('0x30')]({'where':{'type':_0x58846c,'resourceId':_0x231d35['id']}})[_0x5177('0x34')](function(){return _0x577bf7;});})[_0x5177('0x34')](function(){_0x19a0c2[_0x5177('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498fcd,_0x45cf20){return function(_0x1c660e){if(!_0x1c660e){_0x498fcd[_0x5177('0x22')](0x194);}return _0x1c660e;};}function handleError(_0x174f7a,_0x2e1985){_0x2e1985=_0x2e1985||0x1f4;return function(_0x8134f9){logger[_0x5177('0x35')](_0x8134f9[_0x5177('0x36')]);if(_0x8134f9['name']){delete _0x8134f9[_0x5177('0x37')];}_0x174f7a[_0x5177('0x23')](_0x2e1985)['send'](_0x8134f9);};}exports[_0x5177('0x38')]=function(_0x5e4c48,_0x172b36){var _0x1a2c46={},_0x1ba51c={},_0x5e2e5a={'count':0x0,'rows':[]};var _0x4f70df=_[_0x5177('0x39')](db[_0x5177('0x3a')][_0x5177('0x3b')],function(_0x3735e9){return{'name':_0x3735e9[_0x5177('0x3c')],'type':_0x3735e9[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x1ba51c[_0x5177('0x3f')]=_['map'](_0x4f70df,_0x5177('0x37'));_0x1ba51c[_0x5177('0x40')]=_['keys'](_0x5e4c48[_0x5177('0x40')]);_0x1ba51c[_0x5177('0x41')]=_[_0x5177('0x42')](_0x1ba51c[_0x5177('0x3f')],_0x1ba51c[_0x5177('0x40')]);_0x1a2c46[_0x5177('0x43')]=_['intersection'](_0x1ba51c[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x44')]));_0x1a2c46[_0x5177('0x43')]=_0x1a2c46[_0x5177('0x43')][_0x5177('0x45')]?_0x1a2c46['attributes']:_0x1ba51c[_0x5177('0x3f')];if(!_0x5e4c48[_0x5177('0x40')]['hasOwnProperty']('nolimit')){_0x1a2c46[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x28')]);_0x1a2c46[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x26')]);}_0x1a2c46[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x47')]);_0x1a2c46[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x5e4c48[_0x5177('0x40')],_0x1ba51c['filters']),_0x4f70df);if(_0x5e4c48[_0x5177('0x40')]['filter']){_0x1a2c46[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x1a2c46[_0x5177('0x48')],{'$or':_['map'](_0x4f70df,function(_0x56eba4){if(_0x56eba4[_0x5177('0x3d')]!==_0x5177('0x4b')){var _0x1a149b={};_0x1a149b[_0x56eba4[_0x5177('0x37')]]={'$like':'%'+_0x5e4c48[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x1a149b;}})});}_0x1a2c46=_[_0x5177('0x4a')]({},_0x1a2c46,_0x5e4c48[_0x5177('0x4d')]);var _0x4e287e={'where':_0x1a2c46[_0x5177('0x48')]};return db['VoicePrefix']['count'](_0x4e287e)[_0x5177('0x34')](function(_0x17dc98){_0x5e2e5a['count']=_0x17dc98;if(_0x5e4c48[_0x5177('0x40')]['includeAll']){_0x1a2c46['include']=[{'all':!![]}];}return db[_0x5177('0x3a')][_0x5177('0x4e')](_0x1a2c46);})[_0x5177('0x34')](function(_0x3776b8){_0x5e2e5a[_0x5177('0x4f')]=_0x3776b8;return _0x5e2e5a;})[_0x5177('0x34')](respondWithFilteredResult(_0x172b36,_0x1a2c46))[_0x5177('0x50')](handleError(_0x172b36,null));};exports['show']=function(_0x5396cc,_0x12b70){var _0x511dc0={'raw':![],'where':{'id':_0x5396cc[_0x5177('0x51')]['id']}},_0x23be2a={};_0x23be2a[_0x5177('0x3f')]=_[_0x5177('0x52')](db['VoicePrefix'][_0x5177('0x3b')]);_0x23be2a[_0x5177('0x40')]=_[_0x5177('0x52')](_0x5396cc[_0x5177('0x40')]);_0x23be2a[_0x5177('0x41')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],_0x23be2a[_0x5177('0x40')]);_0x511dc0[_0x5177('0x43')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],qs['fields'](_0x5396cc[_0x5177('0x40')]['fields']));_0x511dc0['attributes']=_0x511dc0['attributes'][_0x5177('0x45')]?_0x511dc0[_0x5177('0x43')]:_0x23be2a['model'];if(_0x5396cc[_0x5177('0x40')][_0x5177('0x53')]){_0x511dc0[_0x5177('0x54')]=[{'all':!![]}];}_0x511dc0=_['merge']({},_0x511dc0,_0x5396cc[_0x5177('0x4d')]);return db['VoicePrefix']['find'](_0x511dc0)['then'](handleEntityNotFound(_0x12b70,null))[_0x5177('0x34')](respondWithResult(_0x12b70,null))[_0x5177('0x50')](handleError(_0x12b70,null));};exports[_0x5177('0x30')]=function(_0x5a1f8b,_0x4e53e4){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x5a1f8b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x34')](removeEntity(_0x4e53e4,null))[_0x5177('0x50')](handleError(_0x4e53e4,null));};exports[_0x5177('0x55')]=function(_0xa0edd7,_0x26bac0){return db[_0x5177('0x3a')][_0x5177('0x55')]()[_0x5177('0x34')](respondWithResult(_0x26bac0,null))[_0x5177('0x50')](handleError(_0x26bac0,null));};exports[_0x5177('0x56')]=function(_0x422d6c,_0x4c2068){var _0x59376b;return db[_0x5177('0x57')]['transaction'](function(_0x649c6f){return db['VoicePrefix'][_0x5177('0x56')](_0x422d6c[_0x5177('0x58')],{'transaction':_0x649c6f})[_0x5177('0x34')](function(_0x55a0b6){_0x59376b=_0x55a0b6['get']({'plain':!![]});return db[_0x5177('0x59')][_0x5177('0x5a')]({'where':{'id':_0x59376b[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x4a4758){return createVoicePrefixExtensions(_0x59376b,_0x4a4758,_0x649c6f);});});})['then'](function(){var _0x3f0e89=_0x422d6c[_0x5177('0x5c')][_0x5177('0x31')]({'plain':!![]});if(!_0x3f0e89)throw new Error(_0x5177('0x5d'));if(_0x3f0e89['role']===_0x5177('0x5c')){var _0x143aff=_0x59376b;return db[_0x5177('0x5e')]['find']({'where':{'name':_0x5177('0x32'),'userProfileId':_0x3f0e89[_0x5177('0x5f')]},'raw':!![]})[_0x5177('0x34')](function(_0x49e3e3){if(_0x49e3e3&&_0x49e3e3[_0x5177('0x60')]===0x0){return db['UserProfileResource'][_0x5177('0x56')]({'name':_0x143aff[_0x5177('0x37')],'resourceId':_0x143aff['id'],'type':_0x49e3e3[_0x5177('0x37')],'sectionId':_0x49e3e3['id']},{})['then'](function(){return _0x59376b;});}else{return _0x59376b;}})[_0x5177('0x50')](function(_0x161e03){logger[_0x5177('0x35')](_0x5177('0x61'),_0x161e03);throw _0x161e03;});}return _0x59376b;})[_0x5177('0x34')](respondWithResult(_0x4c2068,null))[_0x5177('0x50')](handleError(_0x4c2068,null));};function Extension(_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){this['context']=_0x5177('0x62');this[_0x5177('0x63')]=_0x37380c;this[_0x5177('0x64')]=_0x5ceed2;this[_0x5177('0x3d')]=_0x5177('0x65');this[_0x5177('0x66')]='Voice\x20Prefix\x20Extension';this['priority']=_0x267599;this[_0x5177('0x67')]=_0x5d96ce;}function createVoicePrefixExtensions(_0x23eb6e,_0x1f294e,_0x336017){return new BPromise(function(_0x123d40,_0x1b1778){var _0x2d1745=new Extension(formatPrefixName(_0x23eb6e[_0x5177('0x68')]),0x1,_0x5177('0x69'),'Voice\x20Prefix');_0x2d1745[_0x5177('0x6a')]=_0x23eb6e['id'];return db[_0x5177('0x59')]['create'](_0x2d1745,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4481b6){var _0x4edebc=_0x4481b6[_0x5177('0x31')]({'plain':!![]});var _0x2f3344=_[_0x5177('0x39')](addVoicePrefixExtensions(_0x23eb6e,_0x1f294e),function(_0x4be4b2){_0x4be4b2[_0x5177('0x5b')]=_0x4edebc['id'];_0x4be4b2[_0x5177('0x6a')]=_0x23eb6e['id'];return _0x4be4b2;});return db['VoiceExtension']['bulkCreate'](_0x2f3344,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4f76d7){if(!_0x4f76d7){return _0x1b1778(_0x5177('0x6b'));}else{return _0x123d40(_0x4f76d7);}})['catch'](function(_0x2771fa){return _0x1b1778(_0x2771fa);});});;});};function addVoicePrefixExtensions(_0x16f17c,_0x5a8ada){var _0x2af938=[];var _0x3b090d=formatPrefixName(_0x16f17c[_0x5177('0x68')]);_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x2,_0x5177('0x6d'),_0x5177('0x6e')+_0x16f17c[_0x5177('0x37')]));if(_0x16f17c['callerIdAll']){_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'Set','PREFIX-CALLERIDALL='+_0x16f17c[_0x5177('0x6f')]));}else{_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'NoOp',_0x5177('0x70')));}_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x4,_0x5177('0x71'),_0x5a8ada[_0x5177('0x72')]+','+_0x5177('0x73')+(0x8+_0x16f17c[_0x5177('0x37')][_0x5177('0x45')])+'}'+','+0x1));return _0x2af938;}function formatPrefixName(_0x3b26f4){var _0x478d5e='_';for(var _0x54b28f=0x0;_0x54b28f<_0x3b26f4[_0x5177('0x45')];_0x54b28f++){if(_0x3b26f4[_0x5177('0x74')](_0x54b28f)=='-'){_0x478d5e+=_0x3b26f4[_0x5177('0x74')](_0x54b28f);}else{_0x478d5e+='['+_0x3b26f4[_0x5177('0x74')](_0x54b28f)+']';}}_0x478d5e+='.';return _0x478d5e;}exports[_0x5177('0x2f')]=function(_0x3dd58f,_0x4fc289,_0x3692b2){var _0x397b75=_0x3dd58f[_0x5177('0x58')];_0x397b75[_0x5177('0x68')]='system-'+_0x397b75[_0x5177('0x37')]+'-';return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x22da9d){return db[_0x5177('0x3a')]['update'](_0x397b75,{'where':{'id':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x30')]({'where':{'VoicePrefixId':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x5a')]({'where':{'id':_0x397b75[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x44ed82){return createVoicePrefixExtensions(_0x397b75,_0x44ed82,_0x22da9d);});});});})['then'](function(){return db[_0x5177('0x3a')][_0x5177('0x76')](_0x397b75['id']);})[_0x5177('0x34')](respondWithResult(_0x4fc289,null))[_0x5177('0x50')](handleError(_0x4fc289,null));};exports['addAgents']=function(_0x16b85b,_0x17456b,_0x3502dd){return db['VoicePrefix']['find']({'where':{'id':_0x16b85b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x17456b,null))[_0x5177('0x34')](function(_0x170e25){if(_0x170e25){return _0x170e25[_0x5177('0x77')](_0x16b85b[_0x5177('0x58')][_0x5177('0x78')],_[_0x5177('0x79')](_0x16b85b[_0x5177('0x58')],['ids','id'])||{})['spread'](function(_0x597a84){for(var _0x290315=0x0;_0x290315<_0x16b85b['body'][_0x5177('0x78')][_0x5177('0x45')];_0x290315+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':Number(_0x16b85b[_0x5177('0x58')]['ids'][_0x290315]),'VoicePrefixId':Number(_0x16b85b[_0x5177('0x51')]['id'])});}return _0x597a84;});}})[_0x5177('0x34')](respondWithResult(_0x17456b,null))[_0x5177('0x50')](handleError(_0x17456b,null));};exports['removeAgents']=function(_0x3d845e,_0x484762,_0x3d95df){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x3d845e[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x484762,null))['then'](function(_0x5f0141){if(_0x5f0141){return _0x5f0141[_0x5177('0x7c')](_0x3d845e['query'][_0x5177('0x78')])[_0x5177('0x34')](function(){if(_['isArray'](_0x3d845e[_0x5177('0x40')][_0x5177('0x78')])){for(var _0xcbbb73=0x0;_0xcbbb73<_0x3d845e[_0x5177('0x40')][_0x5177('0x78')][_0x5177('0x45')];_0xcbbb73+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e['query'][_0x5177('0x78')][_0xcbbb73]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}}else{socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e[_0x5177('0x40')][_0x5177('0x78')]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}});}})[_0x5177('0x34')](respondWithStatusCode(_0x484762,null))[_0x5177('0x50')](handleError(_0x484762,null));};exports['getAgents']=function(_0x17efe1,_0x30c2dc,_0x523012){var _0x33e1a6={};var _0x5f57bc={};var _0x3f1aad;var _0x558e04;return db['VoicePrefix']['findOne']({'where':{'id':_0x17efe1[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x30c2dc,null))[_0x5177('0x34')](function(_0x516d0b){if(_0x516d0b){_0x3f1aad=_0x516d0b;_0x5f57bc[_0x5177('0x3f')]=_[_0x5177('0x52')](db[_0x5177('0x7e')][_0x5177('0x3b')]);_0x5f57bc[_0x5177('0x40')]=_['keys'](_0x17efe1[_0x5177('0x40')]);_0x5f57bc[_0x5177('0x41')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],_0x5f57bc['query']);_0x33e1a6[_0x5177('0x43')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x17efe1[_0x5177('0x40')][_0x5177('0x44')]));_0x33e1a6[_0x5177('0x43')]=_0x33e1a6[_0x5177('0x43')]['length']?_0x33e1a6['attributes']:_0x5f57bc[_0x5177('0x3f')];_0x33e1a6[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x17efe1['query'][_0x5177('0x47')]);_0x33e1a6[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x17efe1['query'],_0x5f57bc[_0x5177('0x41')]));if(_0x17efe1[_0x5177('0x40')][_0x5177('0x4c')]){_0x33e1a6['where']=_[_0x5177('0x4a')](_0x33e1a6['where'],{'$or':_[_0x5177('0x39')](_0x33e1a6[_0x5177('0x43')],function(_0x5a40f1){var _0x5a8146={};_0x5a8146[_0x5a40f1]={'$like':'%'+_0x17efe1['query'][_0x5177('0x4c')]+'%'};return _0x5a8146;})});}_0x33e1a6=_['merge']({},_0x33e1a6,_0x17efe1[_0x5177('0x4d')]);return _0x3f1aad[_0x5177('0x7f')](_0x33e1a6);}})[_0x5177('0x34')](function(_0x57adf4){if(_0x57adf4){_0x558e04=_0x57adf4['length'];if(!_0x17efe1['query'][_0x5177('0x80')](_0x5177('0x81'))){_0x33e1a6[_0x5177('0x28')]=qs['limit'](_0x17efe1[_0x5177('0x40')][_0x5177('0x28')]);_0x33e1a6['offset']=qs[_0x5177('0x26')](_0x17efe1['query'][_0x5177('0x26')]);}return _0x3f1aad['getAgents'](_0x33e1a6);}})['then'](function(_0x5910a8){if(_0x5910a8){return _0x5910a8?{'count':_0x558e04,'rows':_0x5910a8}:null;}})[_0x5177('0x34')](respondWithResult(_0x30c2dc,null))['catch'](handleError(_0x30c2dc,null));};exports[_0x5177('0x82')]=function(_0x450c61,_0x1d351b,_0x1372ad){var _0x3b4cab={};var _0x197377={};var _0x580d34;var _0x1e76cf;return db[_0x5177('0x3a')]['findOne']({'where':{'id':_0x450c61[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x1d351b,null))[_0x5177('0x34')](function(_0x51f7ce){if(_0x51f7ce){_0x580d34=_0x51f7ce;_0x197377['model']=_['keys'](db[_0x5177('0x83')][_0x5177('0x3b')]);_0x197377[_0x5177('0x40')]=_[_0x5177('0x52')](_0x450c61[_0x5177('0x40')]);_0x197377[_0x5177('0x41')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],_0x197377[_0x5177('0x40')]);_0x3b4cab[_0x5177('0x43')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],qs['fields'](_0x450c61[_0x5177('0x40')]['fields']));_0x3b4cab[_0x5177('0x43')]=_0x3b4cab[_0x5177('0x43')][_0x5177('0x45')]?_0x3b4cab['attributes']:_0x197377[_0x5177('0x3f')];_0x3b4cab[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x450c61[_0x5177('0x40')][_0x5177('0x47')]);_0x3b4cab[_0x5177('0x48')]=qs[_0x5177('0x41')](_[_0x5177('0x49')](_0x450c61['query'],_0x197377['filters']));if(_0x450c61[_0x5177('0x40')]['filter']){_0x3b4cab[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x3b4cab['where'],{'$or':_[_0x5177('0x39')](_0x3b4cab[_0x5177('0x43')],function(_0x54efd0){var _0x3e8a29={};_0x3e8a29[_0x54efd0]={'$like':'%'+_0x450c61[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x3e8a29;})});}_0x3b4cab=_[_0x5177('0x4a')]({},_0x3b4cab,_0x450c61[_0x5177('0x4d')]);return _0x580d34[_0x5177('0x82')](_0x3b4cab);}})[_0x5177('0x34')](function(_0x7a67fb){if(_0x7a67fb){_0x1e76cf=_0x7a67fb[_0x5177('0x45')];if(!_0x450c61[_0x5177('0x40')][_0x5177('0x80')](_0x5177('0x81'))){_0x3b4cab[_0x5177('0x28')]=qs['limit'](_0x450c61[_0x5177('0x40')][_0x5177('0x28')]);_0x3b4cab[_0x5177('0x26')]=qs['offset'](_0x450c61[_0x5177('0x40')][_0x5177('0x26')]);}return _0x580d34['getTeams'](_0x3b4cab);}})[_0x5177('0x34')](function(_0x5cbc48){if(_0x5cbc48){return _0x5cbc48?{'count':_0x1e76cf,'rows':_0x5cbc48}:null;}})['then'](respondWithResult(_0x1d351b,null))[_0x5177('0x50')](handleError(_0x1d351b,null));};exports[_0x5177('0x84')]=function(_0xd8f8f3,_0x40ded0,_0x356874){var _0x219a7c=_0xd8f8f3['body'][_0x5177('0x78')];var _0xcb831c;return db['Team'][_0x5177('0x4e')]({'where':{'id':_0x219a7c},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id',_0x5177('0x37'),_0x5177('0x86'),_0x5177('0x87'),_0x5177('0x88')],'raw':!![]}]})[_0x5177('0x34')](function(_0x4e60b2){if(_0x4e60b2){_0xcb831c=_0x4e60b2;var _0x193dbf=_['flatMap'](_0x4e60b2,function(_0xecd419){var _0x4970b3=_0xecd419[_0x5177('0x31')]({'plain':!![]});return _0x4970b3[_0x5177('0x85')];});return db[_0x5177('0x3a')][_0x5177('0x5a')]({'where':{'id':_0xd8f8f3['params']['id']}})[_0x5177('0x34')](function(_0x1b7c52){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x4e8c0c){return _0x1b7c52['addTeams'](_0x219a7c,{'transaction':_0x4e8c0c})['then'](function(){return BPromise['each'](_0xcb831c,function(_0xaafc9f){return db['TeamVoicePrefix'][_0x5177('0x89')]({'TeamId':_0xaafc9f['id'],'VoicePrefixId':_0xd8f8f3['params']['id']},{'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){return BPromise['each'](_0x193dbf,function(_0x384af7){return db[_0x5177('0x8a')][_0x5177('0x8b')]({'where':{'UserId':_0x384af7['id'],'VoicePrefixId':_0xd8f8f3[_0x5177('0x51')]['id']},'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){_0x193dbf[_0x5177('0x8c')](function(_0x3a9c65){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':_0x3a9c65['id'],'VoicePrefixId':_0x1b7c52['id']});});});});});}})[_0x5177('0x34')](respondWithStatusCode(_0x40ded0,null))['catch'](handleError(_0x40ded0,null));};exports[_0x5177('0x8d')]=function(_0x13fa90,_0x3475c3,_0x5ed46a){return db[_0x5177('0x83')][_0x5177('0x4e')]({'where':{'id':_0x13fa90[_0x5177('0x40')][_0x5177('0x78')]},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id'],'raw':!![]}]})[_0x5177('0x34')](handleEntityNotFound(_0x3475c3,null))[_0x5177('0x34')](function(_0xb8f7de){var _0x1bc4cb=_[_0x5177('0x39')](_0xb8f7de,'id');var _0x4d29b7=[];var _0x1f8c26=[];var _0x365b68=squel[_0x5177('0x8e')]();_0x365b68['field'](_0x5177('0x8f'))[_0x5177('0x90')]('team_has_voice_prefixes','tq')[_0x5177('0x91')](_0x5177('0x92'),'ut',_0x5177('0x93'))['where'](_0x5177('0x94'),_0x13fa90[_0x5177('0x51')]['id']);for(var _0x3b8c79=0x0;_0x3b8c79<_0xb8f7de[_0x5177('0x45')];_0x3b8c79+=0x1){let _0x2a16ed=_0xb8f7de[_0x3b8c79];for(var _0x5d1909=0x0;_0x5d1909<_0x2a16ed['Agents'][_0x5177('0x45')];_0x5d1909+=0x1){let _0x61ead2=_0x2a16ed['Agents'][_0x5d1909];var _0x2ffb25=_0x365b68[_0x5177('0x95')]();_0x2ffb25['where'](_0x5177('0x96'),_0x61ead2['id']);_0x1f8c26[_0x5177('0x6c')](db['sequelize']['query'](_0x2ffb25[_0x5177('0x97')](),{'type':db['sequelize']['QueryTypes'][_0x5177('0x98')]})[_0x5177('0x34')](function(_0x58170f){if(_0x58170f[_0x5177('0x45')]===0x1){return _0x61ead2['id'];}else{var _0xdc5504=_[_0x5177('0x99')](_[_0x5177('0x39')](_0x58170f,_0x5177('0x9a')),function(_0x2fa026){return _['includes'](_0x1bc4cb,_0x2fa026);});if(_0xdc5504){return _0x61ead2['id'];}}}));}}return BPromise[_0x5177('0x9b')](_0x1f8c26)['then'](function(_0x55e914){_0x4d29b7=_(_0x4d29b7)[_0x5177('0x9c')](_0x55e914)[_0x5177('0x9d')]()[_0x5177('0x9e')]();return db['VoicePrefix'][_0x5177('0x5a')]({'where':{'id':_0x13fa90[_0x5177('0x51')]['id']}})[_0x5177('0x34')](function(_0x3873ca){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x10698d){return _0x3873ca[_0x5177('0x8d')](_0x13fa90[_0x5177('0x40')][_0x5177('0x78')],{'transaction':_0x10698d})[_0x5177('0x34')](function(){if(!_[_0x5177('0x9f')](_0x4d29b7)){return _0x3873ca['removeAgents'](_0x4d29b7,{'transaction':_0x10698d});}})[_0x5177('0x34')](function(){_0x4d29b7[_0x5177('0x8c')](function(_0x38f0f4){socket[_0x5177('0x7a')]('userVoicePrefix:remove',{'UserId':_0x38f0f4,'VoicePrefixId':_0x3873ca['id']});});});});});});})['then'](respondWithStatusCode(_0x3475c3,null))['catch'](handleError(_0x3475c3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index dccbde4..4159817 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 _0x995d=['emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x1e848b,_0x5153b1){var _0xf2aae6=function(_0x1b7a6a){while(--_0x1b7a6a){_0x1e848b['push'](_0x1e848b['shift']());}};_0xf2aae6(++_0x5153b1);}(_0x995d,0x1f2));var _0xd995=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x995d[_0x5bd426];return _0x23a7eb;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xd995('0x0'))['db'][_0xd995('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd995('0x2')](0x0);var events={'afterCreate':_0xd995('0x3'),'afterUpdate':_0xd995('0x4'),'afterDestroy':_0xd995('0x5')};function emitEvent(_0x1c3c36){return function(_0xe3d37c,_0x132773,_0x4ea5a9){VoicePrefixEvents[_0xd995('0x6')](_0x1c3c36+':'+_0xe3d37c['id'],_0xe3d37c);VoicePrefixEvents['emit'](_0x1c3c36,_0xe3d37c);_0x4ea5a9(null);};}for(var e in events){if(events[_0xd995('0x7')](e)){var event=events[e];VoicePrefix[_0xd995('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xad6b=['VoicePrefix','setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad6b,0x1b1));var _0xbad6=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xad6b[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xbad6('0x0'))['db'][_0xbad6('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbad6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbad6('0x3')};function emitEvent(_0xeec723){return function(_0x4f4090,_0x36da6e,_0x2a985b){VoicePrefixEvents[_0xbad6('0x4')](_0xeec723+':'+_0x4f4090['id'],_0x4f4090);VoicePrefixEvents[_0xbad6('0x4')](_0xeec723,_0x4f4090);_0x2a985b(null);};}for(var e in events){if(events[_0xbad6('0x5')](e)){var event=events[e];VoicePrefix[_0xbad6('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 47b3765..1997487 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 _0x3824=['exports','define','VoicePrefix','voice_prefixes','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x3824,0x72));var _0x4382=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x3824[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4382('0x0'))('api');var moment=require(_0x4382('0x1'));var BPromise=require(_0x4382('0x2'));var rp=require(_0x4382('0x3'));var fs=require('fs');var path=require(_0x4382('0x4'));var rimraf=require(_0x4382('0x5'));var config=require(_0x4382('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x4382('0x7')]=function(_0x254495,_0x9d7701){return _0x254495[_0x4382('0x8')](_0x4382('0x9'),attributes,{'tableName':_0x4382('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62b0=['api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62b0,0xa6));var _0x062b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62b0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x062b('0x0'));var util=require(_0x062b('0x1'));var logger=require(_0x062b('0x2'))(_0x062b('0x3'));var moment=require(_0x062b('0x4'));var BPromise=require('bluebird');var rp=require(_0x062b('0x5'));var fs=require('fs');var path=require(_0x062b('0x6'));var rimraf=require(_0x062b('0x7'));var config=require(_0x062b('0x8'));var attributes=require(_0x062b('0x9'));module[_0x062b('0xa')]=function(_0x3f8ae2,_0x4bdadb){return _0x3f8ae2[_0x062b('0xb')](_0x062b('0xc'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 19c67d4..2e05991 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 _0x2b29=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x47dc29,_0x4b0b2d){var _0xa4abf9=function(_0x45f8ea){while(--_0x45f8ea){_0x47dc29['push'](_0x47dc29['shift']());}};_0xa4abf9(++_0x4b0b2d);}(_0x2b29,0x163));var _0x92b2=function(_0x54206b,_0xc308f){_0x54206b=_0x54206b-0x0;var _0x1a4e34=_0x2b29[_0x54206b];return _0x1a4e34;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});config['redis']=_[_0x92b2('0xb')](config[_0x92b2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x92b2('0xd'))(new Redis(config[_0x92b2('0xc')]));require(_0x92b2('0xe'))[_0x92b2('0xf')](socket);function respondWithRpcPromise(_0x592c9e,_0x2b17de,_0x21bbf5){return new BPromise(function(_0x187eab,_0x1ef7f3){return client[_0x92b2('0x10')](_0x592c9e,_0x21bbf5)[_0x92b2('0x11')](function(_0xa18d4e){logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));logger[_0x92b2('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2b17de,_0x92b2('0x13'),JSON[_0x92b2('0x15')](_0xa18d4e));if(_0xa18d4e[_0x92b2('0x16')]){if(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x17')]===0x1f4){logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e[_0x92b2('0x16')]['message']);return _0x1ef7f3(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x18')]);}logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e['error'][_0x92b2('0x18')]);return _0x187eab(_0xa18d4e['error'][_0x92b2('0x18')]);}else{logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));_0x187eab(_0xa18d4e[_0x92b2('0x19')][_0x92b2('0x18')]);}})[_0x92b2('0x1a')](function(_0x3dfd47){logger[_0x92b2('0x16')](_0x92b2('0x12'),_0x2b17de,_0x3dfd47);_0x1ef7f3(_0x3dfd47);});});} \ No newline at end of file +var _0xe3da=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});config[_0xae3d('0xe')]=_[_0xae3d('0xf')](config['redis'],{'host':_0xae3d('0x10'),'port':0x18eb});var socket=require(_0xae3d('0x11'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xae3d('0x12')](socket);function respondWithRpcPromise(_0x157a3e,_0x420e28,_0x124833){return new BPromise(function(_0x2705b8,_0x15d6da){return client['request'](_0x157a3e,_0x124833)[_0xae3d('0x13')](function(_0x49fe58){logger[_0xae3d('0x14')](_0xae3d('0x15'),_0x420e28,_0xae3d('0x16'));logger[_0xae3d('0x17')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'),JSON[_0xae3d('0x18')](_0x49fe58));if(_0x49fe58[_0xae3d('0x19')]){if(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1a')]===0x1f4){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58['error'][_0xae3d('0x1b')]);return _0x15d6da(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58[_0xae3d('0x19')]['message']);return _0x2705b8(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}else{logger[_0xae3d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'));_0x2705b8(_0x49fe58[_0xae3d('0x1c')]['message']);}})['catch'](function(_0x8a37cc){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x8a37cc);_0x15d6da(_0x8a37cc);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 9798828..7de509c 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 _0x26c2=['update','register','length','voicePrefix:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x26c2,0x130));var _0x226c=function(_0x302eb0,_0x1e6b21){_0x302eb0=_0x302eb0-0x0;var _0x33f842=_0x26c2[_0x302eb0];return _0x33f842;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save','remove',_0x226c('0x0')];function createListener(_0x23ec98,_0x674a14){return function(_0x3b56e8){_0x674a14['emit'](_0x23ec98,_0x3b56e8);};}function removeListener(_0x2f79d3,_0x117899){return function(){VoicePrefixEvents['removeListener'](_0x2f79d3,_0x117899);};}exports[_0x226c('0x1')]=function(_0xb40fbd){for(var _0x21ed3a=0x0,_0x3c4e5d=events[_0x226c('0x2')];_0x21ed3a<_0x3c4e5d;_0x21ed3a++){var _0x59804e=events[_0x21ed3a];var _0x34cbc3=createListener(_0x226c('0x3')+_0x59804e,_0xb40fbd);VoicePrefixEvents['on'](_0x59804e,_0x34cbc3);}}; \ No newline at end of file +var _0x222f=['./voicePrefix.events','save','remove','update','emit','register'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x222f,0x1a4));var _0xf222=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x222f[_0x3e21f4];return _0x40fc49;};'use strict';var VoicePrefixEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){VoicePrefixEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('voicePrefix:'+_0xf5a105,_0x54a758);VoicePrefixEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d81da21..13c2e97 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1e1a40,_0x120381){var _0x233c8e=function(_0x134c29){while(--_0x134c29){_0x1e1a40['push'](_0x1e1a40['shift']());}};_0x233c8e(++_0x120381);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xb1b616,_0x3b9023){var _0x1259b0=function(_0xb2e638){while(--_0xb2e638){_0xb1b616['push'](_0xb1b616['shift']());}};_0x1259b0(++_0x3b9023);}(_0xb10b,0x12a));var _0xbb10=function(_0x177dc7,_0x13501c){_0x177dc7=_0x177dc7-0x0;var _0x19b7dc=_0xb10b[_0x177dc7];return _0x19b7dc;};'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 2f4237b..4f3801d 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 _0x5204=['random','wrandom','rrordered','ringall','strategy','type','getDataValue','dialMethod','booked','rrmemory','roundrobin','progressive','predictive','INTEGER','yes','all','once','periodic_announce','join','split','setDataValue','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','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).','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#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)','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\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','#RecallMe\x20Timeout\x20(min:1)','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','leastrecent','fewestcalls'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5204,0xeb));var _0x4520=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x5204[_0x57014b];return _0x2b258a;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize[_0x4520('0x2')],'allowNull':![],'unique':_0x4520('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4520('0x4')]('inbound','outbound'),'allowNull':![],'defaultValue':_0x4520('0x5')},'musiconhold':{'type':Sequelize[_0x4520('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x4520('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x4520('0x4')]('rr','ringall',_0x4520('0x6'),_0x4520('0x7'),_0x4520('0x8'),'rrmemory','linear',_0x4520('0x9'),_0x4520('0xa')),'allowNull':![],'defaultValue':_0x4520('0xb'),'set':function(_0x1ff634){this['setDataValue'](_0x4520('0xc'),_0x1ff634?_0x1ff634:'rrmemory');},'get':function(){var _0x3edb12=this['getDataValue'](_0x4520('0xd'));var _0x11b61e=this[_0x4520('0xe')](_0x4520('0xf'));var _0x310502=this['getDataValue'](_0x4520('0xc'));if(_0x3edb12==='inbound'){return _0x310502;}if(_0x11b61e===_0x4520('0x10')&&_0x310502===_0x4520('0x11')||_0x11b61e==='booked'&&_0x310502===_0x4520('0x12')){return _0x310502;}if(_0x11b61e===_0x4520('0x13')||_0x11b61e===_0x4520('0x14')||_0x11b61e==='power'){return _0x310502;}return null;}},'servicelevel':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4520('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4520('0x15')](0xb)},'timeout':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4520('0x2')]},'weight':{'type':Sequelize[_0x4520('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defaultValue':_0x4520('0x16')},'autopause':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no',_0x4520('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4520('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x4520('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4520('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4520('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x4520('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4520('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4520('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defaultValue':_0x4520('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x4520('0x16'),'no',_0x4520('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4520('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x4520('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4520('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4520('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4520('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4520('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4520('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4520('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4520('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4520('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4520('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x4520('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x8e5d63){this['setDataValue'](_0x4520('0x19'),_0x8e5d63?_0x8e5d63[_0x4520('0x1a')](','):[]);},'get':function(){return this[_0x4520('0xe')](_0x4520('0x19'))?this[_0x4520('0xe')](_0x4520('0x19'))[_0x4520('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x4520('0x2')],'defaultValue':_0x4520('0x16'),'set':function(_0x29ca1a){this[_0x4520('0x1c')](_0x4520('0x1d'),_0x29ca1a?_0x29ca1a[_0x4520('0x1a')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x4520('0xe')](_0x4520('0x1d'))[_0x4520('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4520('0x2')],'defaultValue':'no','set':function(_0x59560f){this[_0x4520('0x1c')](_0x4520('0x1e'),_0x59560f?_0x59560f[_0x4520('0x1a')](','):undefined);},'get':function(){return this[_0x4520('0xe')]('leavewhenempty')?this[_0x4520('0xe')]('leavewhenempty')[_0x4520('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4520('0x4')](_0x4520('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x4520('0x1f')],'defaultValue':0x0,'set':function(_0x27c20f){this['setDataValue']('acw',_0x27c20f);if(_0x27c20f){if(this[_0x4520('0xe')](_0x4520('0x20'))<0x2){this[_0x4520('0x1c')](_0x4520('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4520('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4520('0x21')},'dialMethod':{'type':Sequelize[_0x4520('0x4')]('preview',_0x4520('0x13'),_0x4520('0x22'),'predictive',_0x4520('0x10')),'defaultValue':'progressive','comment':_0x4520('0x23')},'dialLimitChannel':{'type':Sequelize[_0x4520('0x15')](0x4)[_0x4520('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4520('0x25')},'dialLimitQueue':{'type':Sequelize[_0x4520('0x15')](0x4)[_0x4520('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4520('0x26')},'dialPowerLevel':{'type':Sequelize[_0x4520('0x27')](0x2)[_0x4520('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4520('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x4520('0x4')]('agentBusyFactor',_0x4520('0x29')),'defaultValue':_0x4520('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4520('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4520('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x4520('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4520('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4520('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x4520('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x4520('0x2')],'defaultValue':_0x4520('0x2d'),'comment':_0x4520('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x4520('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)[_0x4520('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)[_0x4520('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4520('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0x3,'comment':_0x4520('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)[_0x4520('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4520('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4520('0x35')},'dialTimezone':{'type':Sequelize[_0x4520('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4520('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x4520('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4520('0x4')]('always',_0x4520('0x36'),_0x4520('0x37')),'defaultValue':_0x4520('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4520('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x4520('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4520('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x4520('0x15')](0x9)[_0x4520('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4520('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4520('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4520('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x4520('0x15')](0x9)[_0x4520('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4520('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4520('0x15')](0x9)[_0x4520('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4520('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4520('0x15')](0x9)[_0x4520('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4520('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4520('0x15')](0x5)[_0x4520('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4520('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4520('0x15')](0x9)[_0x4520('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4520('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x4520('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4520('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x4520('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4520('0x4')]('DESC','ASC'),'defaultValue':_0x4520('0x42')},'dialQueueProject2':{'type':Sequelize[_0x4520('0x2')],'comment':_0x4520('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4520('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4520('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4520('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)[_0x4520('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4520('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)[_0x4520('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4520('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4520('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4520('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4520('0x15')](0x5)[_0x4520('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4520('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x4520('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x4520('0x1f')],'defaultValue':![],'comment':_0x4520('0x4e'),'set':function(_0x401040){if(!_0x401040)this[_0x4520('0x1c')](_0x4520('0x4f'),null);this[_0x4520('0x1c')](_0x4520('0x50'),_0x401040);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4520('0x15')](0x3)[_0x4520('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4520('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x4520('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xdc8d=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\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)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','inbound','outbound','default','STRING','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','ENUM','once','TEXT','setDataValue','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','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)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x1b6daf,_0x25c63e){var _0x216a87=function(_0x2f2881){while(--_0x2f2881){_0x1b6daf['push'](_0x1b6daf['shift']());}};_0x216a87(++_0x25c63e);}(_0xdc8d,0xa9));var _0xddc8=function(_0x38bdac,_0x50563d){_0x38bdac=_0x38bdac-0x0;var _0xea8198=_0xdc8d[_0x38bdac];return _0xea8198;};'use strict';var Sequelize=require(_0xddc8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xddc8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xddc8('0x2'),_0xddc8('0x3')),'allowNull':![],'defaultValue':_0xddc8('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xddc8('0x4')},'announce':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xddc8('0x6'),_0xddc8('0x7'),_0xddc8('0x8'),_0xddc8('0x9'),_0xddc8('0xa'),_0xddc8('0xb'),_0xddc8('0xc'),_0xddc8('0xd')),'allowNull':![],'defaultValue':_0xddc8('0x6'),'set':function(_0x5ed171){this['setDataValue'](_0xddc8('0xe'),_0x5ed171?_0x5ed171:'rrmemory');},'get':function(){var _0x394b7b=this[_0xddc8('0xf')](_0xddc8('0x10'));var _0x102acf=this[_0xddc8('0xf')](_0xddc8('0x11'));var _0x3785a5=this[_0xddc8('0xf')](_0xddc8('0xe'));if(_0x394b7b===_0xddc8('0x2')){return _0x3785a5;}if(_0x102acf===_0xddc8('0x12')&&_0x3785a5===_0xddc8('0xa')||_0x102acf==='booked'&&_0x3785a5===_0xddc8('0x13')){return _0x3785a5;}if(_0x102acf===_0xddc8('0x14')||_0x102acf==='predictive'||_0x102acf===_0xddc8('0x15')){return _0x3785a5;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xddc8('0x16')](0xb)},'timeout':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xddc8('0x5')]},'weight':{'type':Sequelize[_0xddc8('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xddc8('0x17')},'autopause':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xddc8('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xddc8('0x18')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xddc8('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xddc8('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xddc8('0x18')]('yes','no'),'defaultValue':_0xddc8('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no',_0xddc8('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xddc8('0x18')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xddc8('0x5')]},'queue_youarenext':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xddc8('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xddc8('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xddc8('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xddc8('0x5')]},'queue_less_than':{'type':Sequelize[_0xddc8('0x5')]},'periodic_announce':{'type':Sequelize[_0xddc8('0x1a')],'set':function(_0x3e3d6e){this[_0xddc8('0x1b')](_0xddc8('0x1c'),_0x3e3d6e?_0x3e3d6e[_0xddc8('0x1d')](','):[]);},'get':function(){return this[_0xddc8('0xf')](_0xddc8('0x1c'))?this[_0xddc8('0xf')](_0xddc8('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':_0xddc8('0x17'),'set':function(_0x233c89){this[_0xddc8('0x1b')]('joinempty',_0x233c89?_0x233c89[_0xddc8('0x1d')](','):undefined);},'get':function(){return this[_0xddc8('0xf')](_0xddc8('0x1e'))?this[_0xddc8('0xf')](_0xddc8('0x1e'))[_0xddc8('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':'no','set':function(_0x529ee5){this[_0xddc8('0x1b')](_0xddc8('0x20'),_0x529ee5?_0x529ee5['join'](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0xddc8('0xf')](_0xddc8('0x20'))[_0xddc8('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xddc8('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xddc8('0x5')]},'description':{'type':Sequelize[_0xddc8('0x5')]},'acw':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':0x0,'set':function(_0x260039){this[_0xddc8('0x1b')]('acw',_0x260039);if(_0x260039){if(this['getDataValue']('wrapuptime')<0x2){this[_0xddc8('0x1b')](_0xddc8('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xddc8('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xddc8('0x23')},'dialMethod':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x24'),'progressive',_0xddc8('0x15'),_0xddc8('0x25'),'booked'),'defaultValue':'progressive','comment':_0xddc8('0x26')},'dialLimitChannel':{'type':Sequelize[_0xddc8('0x16')](0x4)[_0xddc8('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xddc8('0x28')},'dialLimitQueue':{'type':Sequelize[_0xddc8('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xddc8('0x29')},'dialPowerLevel':{'type':Sequelize[_0xddc8('0x2a')](0x2)[_0xddc8('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xddc8('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x2c'),_0xddc8('0x2d')),'defaultValue':_0xddc8('0x2d'),'comment':_0xddc8('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xddc8('0x2a')](0x2)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xddc8('0x2f')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xddc8('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xddc8('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0xddc8('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xddc8('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xddc8('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc8('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'comment':_0xddc8('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xddc8('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xddc8('0x18')](_0xddc8('0x35'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':0x0,'comment':_0xddc8('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xddc8('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xddc8('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xddc8('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xddc8('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xddc8('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xddc8('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xddc8('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xddc8('0x16')](0x9)[_0xddc8('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xddc8('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xddc8('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':0x0,'comment':_0xddc8('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xddc8('0x3f'),_0xddc8('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xddc8('0x5')],'comment':_0xddc8('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddc8('0x42')},'dialCutDigit':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddc8('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc8('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0xddc8('0x16')](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc8('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc8('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xddc8('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x15fcd7){if(!_0x15fcd7)this['setDataValue'](_0xddc8('0x4a'),null);this['setDataValue'](_0xddc8('0x4b'),_0x15fcd7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xddc8('0x16')](0x3)[_0xddc8('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xddc8('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 6b87762..fbd9b12 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 _0xcf17=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','stack','index','VoiceQueue','rawAttributes','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','includeAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','updatedAt','role','UserProfileSection','destroy','findOne','nolimit','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','every','TeamId','union','compact','isEmpty','userVoiceQueue:remove','spread','online','upsert','all','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','removeLists','CmHopper','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xf996a,_0x244050){var _0xa5a27d=function(_0x3bdc7f){while(--_0x3bdc7f){_0xf996a['push'](_0xf996a['shift']());}};_0xa5a27d(++_0x244050);}(_0xcf17,0x159));var _0x7cf1=function(_0x454b24,_0x4f60d7){_0x454b24=_0x454b24-0x0;var _0x2a60db=_0xcf17[_0x454b24];return _0x2a60db;};'use strict';var emlformat=require(_0x7cf1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7cf1('0x1'));var rp=require(_0x7cf1('0x2'));var moment=require('moment');var BPromise=require(_0x7cf1('0x3'));var Mustache=require(_0x7cf1('0x4'));var util=require(_0x7cf1('0x5'));var path=require(_0x7cf1('0x6'));var sox=require(_0x7cf1('0x7'));var csv=require('to-csv');var ejs=require(_0x7cf1('0x8'));var fs=require('fs');var fs_extra=require(_0x7cf1('0x9'));var _=require(_0x7cf1('0xa'));var squel=require('squel');var crypto=require(_0x7cf1('0xb'));var jsforce=require(_0x7cf1('0xc'));var deskjs=require(_0x7cf1('0xd'));var toCsv=require(_0x7cf1('0xe'));var querystring=require(_0x7cf1('0xf'));var Papa=require(_0x7cf1('0x10'));var Redis=require('ioredis');var authService=require(_0x7cf1('0x11'));var qs=require(_0x7cf1('0x12'));var as=require(_0x7cf1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7cf1('0x14'));var utils=require(_0x7cf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7cf1('0x16'));var db=require('../../mysqldb')['db'];config[_0x7cf1('0x17')]=_[_0x7cf1('0x18')](config['redis'],{'host':_0x7cf1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7cf1('0x17')]));require('./voiceQueue.socket')[_0x7cf1('0x1a')](socket);function respondWithStatusCode(_0x113802,_0x27a857){_0x27a857=_0x27a857||0xcc;return function(_0x4685a1){if(_0x4685a1){return _0x113802[_0x7cf1('0x1b')](_0x27a857);}return _0x113802[_0x7cf1('0x1c')](_0x27a857)[_0x7cf1('0x1d')]();};}function respondWithResult(_0x199d06,_0xe3e9fd){_0xe3e9fd=_0xe3e9fd||0xc8;return function(_0x385a62){if(_0x385a62){return _0x199d06[_0x7cf1('0x1c')](_0xe3e9fd)[_0x7cf1('0x1e')](_0x385a62);}};}function respondWithFilteredResult(_0x42951a,_0x54dee1){return function(_0x3a7004){if(_0x3a7004){var _0x41ee8e=typeof _0x54dee1[_0x7cf1('0x1f')]===_0x7cf1('0x20')&&typeof _0x54dee1[_0x7cf1('0x21')]===_0x7cf1('0x20');var _0x21e253=_0x3a7004[_0x7cf1('0x22')];var _0x1e9f09=_0x41ee8e?0x0:_0x54dee1[_0x7cf1('0x1f')];var _0x4ca4a0=_0x41ee8e?_0x3a7004[_0x7cf1('0x22')]:_0x54dee1[_0x7cf1('0x1f')]+_0x54dee1['limit'];var _0x5d844c;if(_0x4ca4a0>=_0x21e253){_0x4ca4a0=_0x21e253;_0x5d844c=0xc8;}else{_0x5d844c=0xce;}_0x42951a[_0x7cf1('0x1c')](_0x5d844c);return _0x42951a[_0x7cf1('0x23')](_0x7cf1('0x24'),_0x1e9f09+'-'+_0x4ca4a0+'/'+_0x21e253)[_0x7cf1('0x1e')](_0x3a7004);}return null;};}function patchUpdates(_0x2f7de1){return function(_0x315997){try{jsonpatch['apply'](_0x315997,_0x2f7de1,!![]);}catch(_0x357121){return BPromise[_0x7cf1('0x25')](_0x357121);}return _0x315997[_0x7cf1('0x26')]();};}function saveUpdates(_0x1b12de,_0x1fde68){return function(_0x1d8a10){if(_0x1d8a10){return _0x1d8a10[_0x7cf1('0x27')](_0x1b12de)['then'](function(_0x31916c){return _0x31916c;});}return null;};}function removeEntity(_0x215625,_0x49731d){return function(_0x497da0){if(_0x497da0){return _0x497da0['destroy']()[_0x7cf1('0x28')](function(){var _0x4ad8ae=_0x497da0[_0x7cf1('0x29')]({'plain':!![]});var _0x299cd8=[{'name':'VoiceQueues','value':_0x7cf1('0x2a'),'ignore':![]},{'name':_0x7cf1('0x2b'),'value':_0x7cf1('0x2c'),'ignore':![]}];var _0x3bbd46=_(_0x299cd8)[_0x7cf1('0x2d')](_0x7cf1('0x2e'))[_0x7cf1('0x2f')]('value')[_0x7cf1('0x30')]();if(_[_0x7cf1('0x31')](_0x3bbd46,_0x4ad8ae[_0x7cf1('0x32')])){return;}var _0x4eb456=_['find'](_0x299cd8,[_0x7cf1('0x30'),_0x4ad8ae[_0x7cf1('0x32')]])[_0x7cf1('0x33')];return db[_0x7cf1('0x34')]['destroy']({'where':{'type':_0x4eb456,'resourceId':_0x4ad8ae['id']}})[_0x7cf1('0x28')](function(){return _0x497da0;});})[_0x7cf1('0x28')](function(){_0x215625['status'](0xcc)[_0x7cf1('0x1d')]();});}};}function handleEntityNotFound(_0x563cb5,_0x1ae778){return function(_0x24f05b){if(!_0x24f05b){_0x563cb5['sendStatus'](0x194);}return _0x24f05b;};}function handleError(_0x21b47a,_0x3dbe61){_0x3dbe61=_0x3dbe61||0x1f4;return function(_0x5e3215){logger['error'](_0x5e3215[_0x7cf1('0x35')]);if(_0x5e3215[_0x7cf1('0x33')]){delete _0x5e3215[_0x7cf1('0x33')];}_0x21b47a['status'](_0x3dbe61)['send'](_0x5e3215);};}exports[_0x7cf1('0x36')]=function(_0x15e929,_0x4eee38){var _0x166bc9={},_0x329f2c={},_0x3e9a0b={'count':0x0,'rows':[]};var _0xcdb10=_[_0x7cf1('0x2f')](db[_0x7cf1('0x37')][_0x7cf1('0x38')],function(_0x3b92dc){return{'name':_0x3b92dc['fieldName'],'type':_0x3b92dc[_0x7cf1('0x32')][_0x7cf1('0x39')]};});_0x329f2c[_0x7cf1('0x3a')]=_[_0x7cf1('0x2f')](_0xcdb10,_0x7cf1('0x33'));_0x329f2c['query']=_['keys'](_0x15e929['query']);_0x329f2c[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x329f2c['model'],_0x329f2c[_0x7cf1('0x3d')]);_0x166bc9[_0x7cf1('0x3e')]=_[_0x7cf1('0x3c')](_0x329f2c[_0x7cf1('0x3a')],qs['fields'](_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x3f')]));_0x166bc9['attributes']=_0x166bc9['attributes'][_0x7cf1('0x40')]?_0x166bc9[_0x7cf1('0x3e')]:_0x329f2c[_0x7cf1('0x3a')];if(!_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x41')]('nolimit')){_0x166bc9[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x21')]);_0x166bc9[_0x7cf1('0x1f')]=qs['offset'](_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x1f')]);}_0x166bc9[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x43')]);_0x166bc9[_0x7cf1('0x44')]=qs[_0x7cf1('0x3b')](_[_0x7cf1('0x45')](_0x15e929[_0x7cf1('0x3d')],_0x329f2c[_0x7cf1('0x3b')]),_0xcdb10);if(_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0x166bc9['where']=_[_0x7cf1('0x46')](_0x166bc9[_0x7cf1('0x44')],{'$or':_['map'](_0xcdb10,function(_0x34c0b7){if(_0x34c0b7[_0x7cf1('0x32')]!=='VIRTUAL'){var _0x831102={};_0x831102[_0x34c0b7[_0x7cf1('0x33')]]={'$like':'%'+_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x2d')]+'%'};return _0x831102;}})});}_0x166bc9=_[_0x7cf1('0x46')]({},_0x166bc9,_0x15e929['options']);var _0x480eb5={'where':_0x166bc9[_0x7cf1('0x44')]};return db[_0x7cf1('0x37')][_0x7cf1('0x22')](_0x480eb5)[_0x7cf1('0x28')](function(_0x4a1396){_0x3e9a0b[_0x7cf1('0x22')]=_0x4a1396;if(_0x15e929[_0x7cf1('0x3d')][_0x7cf1('0x47')]){_0x166bc9['include']=[{'all':!![]}];}return db[_0x7cf1('0x37')]['findAll'](_0x166bc9);})[_0x7cf1('0x28')](function(_0x2199c5){_0x3e9a0b[_0x7cf1('0x48')]=_0x2199c5;return _0x3e9a0b;})[_0x7cf1('0x28')](respondWithFilteredResult(_0x4eee38,_0x166bc9))[_0x7cf1('0x49')](handleError(_0x4eee38,null));};exports[_0x7cf1('0x4a')]=function(_0x8af130,_0x1ce115){var _0x43003b={'raw':![],'where':{'id':_0x8af130[_0x7cf1('0x4b')]['id']}},_0x5b3a37={};_0x5b3a37[_0x7cf1('0x3a')]=_['keys'](db[_0x7cf1('0x37')][_0x7cf1('0x38')]);_0x5b3a37[_0x7cf1('0x3d')]=_['keys'](_0x8af130[_0x7cf1('0x3d')]);_0x5b3a37[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x5b3a37[_0x7cf1('0x3a')],_0x5b3a37[_0x7cf1('0x3d')]);_0x43003b['attributes']=_[_0x7cf1('0x3c')](_0x5b3a37[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x8af130[_0x7cf1('0x3d')]['fields']));_0x43003b[_0x7cf1('0x3e')]=_0x43003b[_0x7cf1('0x3e')][_0x7cf1('0x40')]?_0x43003b[_0x7cf1('0x3e')]:_0x5b3a37[_0x7cf1('0x3a')];if(_0x8af130[_0x7cf1('0x3d')][_0x7cf1('0x47')]){_0x43003b[_0x7cf1('0x4c')]=[{'all':!![]}];}_0x43003b=_[_0x7cf1('0x46')]({},_0x43003b,_0x8af130[_0x7cf1('0x4d')]);return db[_0x7cf1('0x37')][_0x7cf1('0x4e')](_0x43003b)[_0x7cf1('0x28')](handleEntityNotFound(_0x1ce115,null))['then'](respondWithResult(_0x1ce115,null))[_0x7cf1('0x49')](handleError(_0x1ce115,null));};exports[_0x7cf1('0x4f')]=function(_0x326fc2,_0x343580){return db[_0x7cf1('0x37')][_0x7cf1('0x4f')](_0x326fc2[_0x7cf1('0x50')],{})['then'](function(_0x4a0aec){var _0x316c1e=_0x326fc2[_0x7cf1('0x51')][_0x7cf1('0x29')]({'plain':!![]});if(!_0x316c1e)throw new Error(_0x7cf1('0x52'));if(_0x316c1e['role']===_0x7cf1('0x51')){var _0xd86da4=_0x4a0aec[_0x7cf1('0x29')]({'plain':!![]});var _0x3eeba8=[{'name':_0x7cf1('0x53'),'value':_0x7cf1('0x2a')},{'name':_0x7cf1('0x2b'),'value':_0x7cf1('0x2c')}];var _0x4da1e9=_[_0x7cf1('0x4e')](_0x3eeba8,['value',_0xd86da4[_0x7cf1('0x32')]])['name'];return db['UserProfileSection'][_0x7cf1('0x4e')]({'where':{'name':_0x4da1e9,'userProfileId':_0x316c1e['userProfileId']},'raw':!![]})[_0x7cf1('0x28')](function(_0x54040b){if(_0x54040b&&_0x54040b[_0x7cf1('0x54')]===0x0){return db[_0x7cf1('0x34')][_0x7cf1('0x4f')]({'name':_0xd86da4[_0x7cf1('0x33')],'resourceId':_0xd86da4['id'],'type':_0x54040b[_0x7cf1('0x33')],'sectionId':_0x54040b['id']},{})[_0x7cf1('0x28')](function(){return _0x4a0aec;});}else{return _0x4a0aec;}})[_0x7cf1('0x49')](function(_0x46b2cf){logger[_0x7cf1('0x55')](_0x7cf1('0x56'),_0x46b2cf);throw _0x46b2cf;});}return _0x4a0aec;})['then'](respondWithResult(_0x343580,0xc9))[_0x7cf1('0x49')](handleError(_0x343580,null));};exports[_0x7cf1('0x57')]=function(_0x46888b,_0x52ae2b){var _0x441770={'where':{'id':_0x46888b['params']['id']}},_0x54a258={};_0x54a258[_0x7cf1('0x3a')]=_[_0x7cf1('0x58')](db[_0x7cf1('0x37')][_0x7cf1('0x38')]);_0x441770[_0x7cf1('0x3e')]=_[_0x7cf1('0x3c')](_0x54a258[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x46888b[_0x7cf1('0x3d')]['fields']));_0x441770[_0x7cf1('0x3e')]=_0x441770[_0x7cf1('0x3e')][_0x7cf1('0x40')]?_0x441770[_0x7cf1('0x3e')]:_0x54a258['model'];if(_0x46888b[_0x7cf1('0x3d')][_0x7cf1('0x47')]){_0x441770['include']=[{'all':!![]}];}_0x441770=_[_0x7cf1('0x46')]({},_0x441770,_0x46888b['options']);return db['VoiceQueue']['find'](_0x441770)[_0x7cf1('0x28')](handleEntityNotFound(_0x52ae2b,null))['then'](function(_0x496ab8){if(_0x496ab8){var _0x47d949=_0x496ab8[_0x7cf1('0x29')]({'plain':!![]});_0x47d949=qs[_0x7cf1('0x59')](_0x47d949,['id',_0x7cf1('0x5a'),_0x7cf1('0x5b')]);_0x46888b[_0x7cf1('0x50')]=_['omit'](_0x46888b['body'],['id',_0x7cf1('0x5a'),'updatedAt']);return db[_0x7cf1('0x37')][_0x7cf1('0x4f')](_['merge'](_0x47d949,_0x46888b[_0x7cf1('0x50')]),{'include':_0x46888b['query'][_0x7cf1('0x47')]?[{'all':!![]}]:undefined})[_0x7cf1('0x28')](function(_0x4b9fc5){var _0x3cb1c7=_0x46888b[_0x7cf1('0x51')][_0x7cf1('0x29')]({'plain':!![]});if(!_0x3cb1c7)throw new Error(_0x7cf1('0x52'));if(_0x3cb1c7[_0x7cf1('0x5c')]===_0x7cf1('0x51')){var _0x2b7c8b=_0x4b9fc5['get']({'plain':!![]});var _0x47994a=[{'name':'VoiceQueues','value':_0x7cf1('0x2a')},{'name':_0x7cf1('0x2b'),'value':'outbound'}];var _0x1ea69b=_['find'](_0x47994a,[_0x7cf1('0x30'),_0x2b7c8b['type']])['name'];return db[_0x7cf1('0x5d')][_0x7cf1('0x4e')]({'where':{'name':_0x1ea69b,'userProfileId':_0x3cb1c7['userProfileId']},'raw':!![]})[_0x7cf1('0x28')](function(_0x5c1096){if(_0x5c1096&&_0x5c1096[_0x7cf1('0x54')]===0x0){return db[_0x7cf1('0x34')][_0x7cf1('0x4f')]({'name':_0x2b7c8b['name'],'resourceId':_0x2b7c8b['id'],'type':_0x5c1096[_0x7cf1('0x33')],'sectionId':_0x5c1096['id']},{})[_0x7cf1('0x28')](function(){return _0x4b9fc5;});}else{return _0x4b9fc5;}})[_0x7cf1('0x49')](function(_0x503646){logger[_0x7cf1('0x55')](_0x7cf1('0x56'),_0x503646);throw _0x503646;});}return _0x4b9fc5;});}})['then'](respondWithResult(_0x52ae2b,0xc9))[_0x7cf1('0x49')](handleError(_0x52ae2b,null));};exports[_0x7cf1('0x27')]=function(_0x39c5db,_0x48bc50){if(_0x39c5db[_0x7cf1('0x50')]['id']){delete _0x39c5db[_0x7cf1('0x50')]['id'];}return db[_0x7cf1('0x37')]['find']({'where':{'id':_0x39c5db[_0x7cf1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48bc50,null))[_0x7cf1('0x28')](saveUpdates(_0x39c5db[_0x7cf1('0x50')],null))['then'](respondWithResult(_0x48bc50,null))['catch'](handleError(_0x48bc50,null));};exports[_0x7cf1('0x5e')]=function(_0x439e7e,_0x21d52a){return db[_0x7cf1('0x37')][_0x7cf1('0x4e')]({'where':{'id':_0x439e7e['params']['id']}})['then'](handleEntityNotFound(_0x21d52a,null))['then'](removeEntity(_0x21d52a,null))[_0x7cf1('0x49')](handleError(_0x21d52a,null));};exports['getHoppers']=function(_0x297e6,_0x2a32d6,_0x36fc6e){var _0x983de1={'raw':![],'where':{}};var _0x25b5e1={};var _0x235d26={'count':0x0,'rows':[]};return db[_0x7cf1('0x37')][_0x7cf1('0x5f')]({'where':{'id':_0x297e6['params']['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x2a32d6,null))[_0x7cf1('0x28')](function(_0x483200){if(_0x483200){_0x25b5e1[_0x7cf1('0x3a')]=_[_0x7cf1('0x58')](db['CmHopper'][_0x7cf1('0x38')]);_0x25b5e1[_0x7cf1('0x3d')]=_[_0x7cf1('0x58')](_0x297e6['query']);_0x25b5e1[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x25b5e1[_0x7cf1('0x3a')],_0x25b5e1['query']);_0x983de1['attributes']=_[_0x7cf1('0x3c')](_0x25b5e1[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x297e6[_0x7cf1('0x3d')]['fields']));_0x983de1[_0x7cf1('0x3e')]=_0x983de1['attributes']['length']?_0x983de1['attributes']:_0x25b5e1['model'];if(!_0x297e6['query'][_0x7cf1('0x41')](_0x7cf1('0x60'))){_0x983de1[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x297e6[_0x7cf1('0x3d')][_0x7cf1('0x21')]);_0x983de1[_0x7cf1('0x1f')]=qs['offset'](_0x297e6[_0x7cf1('0x3d')][_0x7cf1('0x1f')]);}_0x983de1[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x297e6[_0x7cf1('0x3d')]['sort']);_0x983de1[_0x7cf1('0x44')]=qs[_0x7cf1('0x3b')](_[_0x7cf1('0x45')](_0x297e6['query'],_0x25b5e1['filters']));_0x983de1[_0x7cf1('0x44')][_0x7cf1('0x61')]=_0x483200['id'];if(_0x297e6[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0x983de1[_0x7cf1('0x44')]=_[_0x7cf1('0x46')](_0x983de1[_0x7cf1('0x44')],{'$or':_['map'](_0x983de1[_0x7cf1('0x3e')],function(_0x3b594f){var _0x4eafe4={};_0x4eafe4[_0x3b594f]={'$like':'%'+_0x297e6[_0x7cf1('0x3d')][_0x7cf1('0x2d')]+'%'};return _0x4eafe4;})});}_0x983de1=_[_0x7cf1('0x46')]({},_0x983de1,_0x297e6['options']);return db['CmHopper'][_0x7cf1('0x22')]({'where':_0x983de1[_0x7cf1('0x44')]})[_0x7cf1('0x28')](function(_0x14b355){_0x235d26['count']=_0x14b355;if(_0x297e6[_0x7cf1('0x3d')][_0x7cf1('0x47')]){_0x983de1['include']=[{'all':!![]}];}return db['CmHopper'][_0x7cf1('0x62')](_0x983de1);})[_0x7cf1('0x28')](function(_0xe83a68){_0x235d26[_0x7cf1('0x48')]=_0xe83a68;return _0x235d26;});}})['then'](respondWithFilteredResult(_0x2a32d6,_0x983de1))[_0x7cf1('0x49')](handleError(_0x2a32d6,null));};exports[_0x7cf1('0x63')]=function(_0x154b0a,_0x85d2b6,_0x1e4b42){var _0xfcb381={'raw':!![],'where':{}};var _0x1f3ad9={};var _0x526d42={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7cf1('0x5f')]({'where':{'id':_0x154b0a[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x85d2b6,null))[_0x7cf1('0x28')](function(_0x2b62b1){if(_0x2b62b1){_0x1f3ad9[_0x7cf1('0x3a')]=_[_0x7cf1('0x58')](db[_0x7cf1('0x64')][_0x7cf1('0x38')]);_0x1f3ad9[_0x7cf1('0x3d')]=_[_0x7cf1('0x58')](_0x154b0a[_0x7cf1('0x3d')]);_0x1f3ad9[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x1f3ad9[_0x7cf1('0x3a')],_0x1f3ad9['query']);_0xfcb381['attributes']=_[_0x7cf1('0x3c')](_0x1f3ad9[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x154b0a[_0x7cf1('0x3d')]['fields']));_0xfcb381['attributes']=_0xfcb381[_0x7cf1('0x3e')][_0x7cf1('0x40')]?_0xfcb381[_0x7cf1('0x3e')]:_0x1f3ad9[_0x7cf1('0x3a')];if(!_0x154b0a[_0x7cf1('0x3d')]['hasOwnProperty'](_0x7cf1('0x60'))){_0xfcb381[_0x7cf1('0x21')]=qs['limit'](_0x154b0a[_0x7cf1('0x3d')]['limit']);_0xfcb381['offset']=qs[_0x7cf1('0x1f')](_0x154b0a['query'][_0x7cf1('0x1f')]);}_0xfcb381[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x154b0a[_0x7cf1('0x3d')][_0x7cf1('0x43')]);_0xfcb381['where']=qs[_0x7cf1('0x3b')](_[_0x7cf1('0x45')](_0x154b0a[_0x7cf1('0x3d')],_0x1f3ad9['filters']));_0xfcb381[_0x7cf1('0x44')][_0x7cf1('0x61')]=_0x2b62b1['id'];if(_0x154b0a['query'][_0x7cf1('0x2d')]){_0xfcb381[_0x7cf1('0x44')]=_[_0x7cf1('0x46')](_0xfcb381[_0x7cf1('0x44')],{'$or':_['map'](_0xfcb381[_0x7cf1('0x3e')],function(_0x328907){var _0x5a9d63={};_0x5a9d63[_0x328907]={'$like':'%'+_0x154b0a[_0x7cf1('0x3d')][_0x7cf1('0x2d')]+'%'};return _0x5a9d63;})});}_0xfcb381=_[_0x7cf1('0x46')]({},_0xfcb381,_0x154b0a['options']);return db[_0x7cf1('0x64')][_0x7cf1('0x22')]({'where':_0xfcb381['where']})['then'](function(_0x18fb4f){_0x526d42[_0x7cf1('0x22')]=_0x18fb4f;if(_0x154b0a['query'][_0x7cf1('0x47')]){_0xfcb381[_0x7cf1('0x4c')]=[{'all':!![]}];}return db[_0x7cf1('0x64')][_0x7cf1('0x62')](_0xfcb381);})['then'](function(_0x41ad56){_0x526d42[_0x7cf1('0x48')]=_0x41ad56;return _0x526d42;});}})[_0x7cf1('0x28')](respondWithFilteredResult(_0x85d2b6,_0xfcb381))['catch'](handleError(_0x85d2b6,null));};exports[_0x7cf1('0x65')]=function(_0x210150,_0x3e2f38,_0x143e11){var _0x51a1b9={'raw':!![],'where':{}};var _0x21c2ec={};var _0x10a1e8={'count':0x0,'rows':[]};return db[_0x7cf1('0x37')]['findOne']({'where':{'id':_0x210150[_0x7cf1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e2f38,null))[_0x7cf1('0x28')](function(_0x4174b1){if(_0x4174b1){_0x21c2ec[_0x7cf1('0x3a')]=_['keys'](db[_0x7cf1('0x66')][_0x7cf1('0x38')]);_0x21c2ec[_0x7cf1('0x3d')]=_[_0x7cf1('0x58')](_0x210150['query']);_0x21c2ec[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x21c2ec[_0x7cf1('0x3a')],_0x21c2ec[_0x7cf1('0x3d')]);_0x51a1b9[_0x7cf1('0x3e')]=_[_0x7cf1('0x3c')](_0x21c2ec['model'],qs[_0x7cf1('0x3f')](_0x210150[_0x7cf1('0x3d')][_0x7cf1('0x3f')]));_0x51a1b9[_0x7cf1('0x3e')]=_0x51a1b9[_0x7cf1('0x3e')][_0x7cf1('0x40')]?_0x51a1b9[_0x7cf1('0x3e')]:_0x21c2ec[_0x7cf1('0x3a')];if(!_0x210150[_0x7cf1('0x3d')]['hasOwnProperty']('nolimit')){_0x51a1b9[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x210150[_0x7cf1('0x3d')]['limit']);_0x51a1b9[_0x7cf1('0x1f')]=qs[_0x7cf1('0x1f')](_0x210150['query'][_0x7cf1('0x1f')]);}_0x51a1b9[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x210150[_0x7cf1('0x3d')][_0x7cf1('0x43')]);_0x51a1b9['where']=qs[_0x7cf1('0x3b')](_[_0x7cf1('0x45')](_0x210150[_0x7cf1('0x3d')],_0x21c2ec[_0x7cf1('0x3b')]));_0x51a1b9[_0x7cf1('0x44')][_0x7cf1('0x61')]=_0x4174b1['id'];if(_0x210150['query'][_0x7cf1('0x2d')]){_0x51a1b9[_0x7cf1('0x44')]=_[_0x7cf1('0x46')](_0x51a1b9[_0x7cf1('0x44')],{'$or':_[_0x7cf1('0x2f')](_0x51a1b9[_0x7cf1('0x3e')],function(_0x3866f4){var _0x32466f={};_0x32466f[_0x3866f4]={'$like':'%'+_0x210150[_0x7cf1('0x3d')][_0x7cf1('0x2d')]+'%'};return _0x32466f;})});}_0x51a1b9=_[_0x7cf1('0x46')]({},_0x51a1b9,_0x210150[_0x7cf1('0x4d')]);return db[_0x7cf1('0x66')][_0x7cf1('0x22')]({'where':_0x51a1b9[_0x7cf1('0x44')]})[_0x7cf1('0x28')](function(_0x53a6b6){_0x10a1e8['count']=_0x53a6b6;if(_0x210150[_0x7cf1('0x3d')]['includeAll']){_0x51a1b9[_0x7cf1('0x4c')]=[{'all':!![]}];}return db[_0x7cf1('0x66')][_0x7cf1('0x62')](_0x51a1b9);})[_0x7cf1('0x28')](function(_0x5c767f){_0x10a1e8['rows']=_0x5c767f;return _0x10a1e8;});}})[_0x7cf1('0x28')](respondWithFilteredResult(_0x3e2f38,_0x51a1b9))[_0x7cf1('0x49')](handleError(_0x3e2f38,null));};exports[_0x7cf1('0x67')]=function(_0x2ea0ff,_0x1205bf,_0xe28f27){var _0xe9c21={'raw':!![],'where':{}};var _0x4bca6f={};var _0x1b3006={'count':0x0,'rows':[]};return db[_0x7cf1('0x37')][_0x7cf1('0x5f')]({'where':{'id':_0x2ea0ff[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x1205bf,null))[_0x7cf1('0x28')](function(_0x1587c5){if(_0x1587c5){_0x4bca6f[_0x7cf1('0x3a')]=_['keys'](db[_0x7cf1('0x68')]['rawAttributes']);_0x4bca6f[_0x7cf1('0x3d')]=_[_0x7cf1('0x58')](_0x2ea0ff[_0x7cf1('0x3d')]);_0x4bca6f[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x4bca6f[_0x7cf1('0x3a')],_0x4bca6f['query']);_0xe9c21[_0x7cf1('0x3e')]=_[_0x7cf1('0x3c')](_0x4bca6f[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x2ea0ff[_0x7cf1('0x3d')][_0x7cf1('0x3f')]));_0xe9c21[_0x7cf1('0x3e')]=_0xe9c21[_0x7cf1('0x3e')]['length']?_0xe9c21[_0x7cf1('0x3e')]:_0x4bca6f[_0x7cf1('0x3a')];if(!_0x2ea0ff['query'][_0x7cf1('0x41')](_0x7cf1('0x60'))){_0xe9c21[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x2ea0ff[_0x7cf1('0x3d')][_0x7cf1('0x21')]);_0xe9c21[_0x7cf1('0x1f')]=qs[_0x7cf1('0x1f')](_0x2ea0ff[_0x7cf1('0x3d')][_0x7cf1('0x1f')]);}_0xe9c21[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x2ea0ff[_0x7cf1('0x3d')][_0x7cf1('0x43')]);_0xe9c21['where']=qs[_0x7cf1('0x3b')](_['pick'](_0x2ea0ff['query'],_0x4bca6f[_0x7cf1('0x3b')]));_0xe9c21[_0x7cf1('0x44')]['VoiceQueueId']=_0x1587c5['id'];if(_0x2ea0ff[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0xe9c21[_0x7cf1('0x44')]=_['merge'](_0xe9c21[_0x7cf1('0x44')],{'$or':_[_0x7cf1('0x2f')](_0xe9c21['attributes'],function(_0x24d438){var _0x494b3c={};_0x494b3c[_0x24d438]={'$like':'%'+_0x2ea0ff[_0x7cf1('0x3d')]['filter']+'%'};return _0x494b3c;})});}_0xe9c21=_[_0x7cf1('0x46')]({},_0xe9c21,_0x2ea0ff[_0x7cf1('0x4d')]);return db[_0x7cf1('0x68')]['count']({'where':_0xe9c21['where']})['then'](function(_0x51896d){_0x1b3006['count']=_0x51896d;if(_0x2ea0ff[_0x7cf1('0x3d')][_0x7cf1('0x47')]){_0xe9c21[_0x7cf1('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7cf1('0x62')](_0xe9c21);})[_0x7cf1('0x28')](function(_0x36d3c3){_0x1b3006['rows']=_0x36d3c3;return _0x1b3006;});}})[_0x7cf1('0x28')](respondWithFilteredResult(_0x1205bf,_0xe9c21))[_0x7cf1('0x49')](handleError(_0x1205bf,null));};exports[_0x7cf1('0x69')]=function(_0x86b3f8,_0x284e39,_0x3add52){var _0x3c2757={};var _0x1160ee={};var _0x18c72b;var _0x1bd93d;return db[_0x7cf1('0x37')]['findOne']({'where':{'id':_0x86b3f8[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x284e39,null))[_0x7cf1('0x28')](function(_0x15fa33){if(_0x15fa33){_0x18c72b=_0x15fa33;_0x1160ee[_0x7cf1('0x3a')]=_[_0x7cf1('0x58')](db['Team'][_0x7cf1('0x38')]);_0x1160ee['query']=_['keys'](_0x86b3f8['query']);_0x1160ee['filters']=_['intersection'](_0x1160ee[_0x7cf1('0x3a')],_0x1160ee[_0x7cf1('0x3d')]);_0x3c2757[_0x7cf1('0x3e')]=_[_0x7cf1('0x3c')](_0x1160ee[_0x7cf1('0x3a')],qs['fields'](_0x86b3f8[_0x7cf1('0x3d')][_0x7cf1('0x3f')]));_0x3c2757['attributes']=_0x3c2757[_0x7cf1('0x3e')][_0x7cf1('0x40')]?_0x3c2757['attributes']:_0x1160ee[_0x7cf1('0x3a')];_0x3c2757[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x86b3f8[_0x7cf1('0x3d')][_0x7cf1('0x43')]);_0x3c2757['where']=qs[_0x7cf1('0x3b')](_[_0x7cf1('0x45')](_0x86b3f8[_0x7cf1('0x3d')],_0x1160ee[_0x7cf1('0x3b')]));if(_0x86b3f8[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0x3c2757[_0x7cf1('0x44')]=_['merge'](_0x3c2757['where'],{'$or':_[_0x7cf1('0x2f')](_0x3c2757['attributes'],function(_0x446c28){var _0xfadbe6={};_0xfadbe6[_0x446c28]={'$like':'%'+_0x86b3f8[_0x7cf1('0x3d')][_0x7cf1('0x2d')]+'%'};return _0xfadbe6;})});}_0x3c2757=_[_0x7cf1('0x46')]({},_0x3c2757,_0x86b3f8[_0x7cf1('0x4d')]);return _0x18c72b['getTeams'](_0x3c2757);}})[_0x7cf1('0x28')](function(_0x181dee){if(_0x181dee){_0x1bd93d=_0x181dee[_0x7cf1('0x40')];if(!_0x86b3f8[_0x7cf1('0x3d')][_0x7cf1('0x41')](_0x7cf1('0x60'))){_0x3c2757[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x86b3f8[_0x7cf1('0x3d')]['limit']);_0x3c2757[_0x7cf1('0x1f')]=qs['offset'](_0x86b3f8[_0x7cf1('0x3d')][_0x7cf1('0x1f')]);}return _0x18c72b[_0x7cf1('0x69')](_0x3c2757);}})[_0x7cf1('0x28')](function(_0x527f38){if(_0x527f38){return _0x527f38?{'count':_0x1bd93d,'rows':_0x527f38}:null;}})[_0x7cf1('0x28')](respondWithResult(_0x284e39,null))[_0x7cf1('0x49')](handleError(_0x284e39,null));};exports[_0x7cf1('0x6a')]=function(_0x94e436,_0x3bdb4c,_0x410822){var _0x8088cf=_0x94e436[_0x7cf1('0x50')][_0x7cf1('0x6b')];var _0x4a6aa4=_['map'](_0x8088cf,'id');return db[_0x7cf1('0x6c')][_0x7cf1('0x62')]({'where':{'id':_0x4a6aa4},'attributes':['id'],'include':[{'model':db[_0x7cf1('0x6d')],'as':'Agents','attributes':['id',_0x7cf1('0x33'),'online',_0x7cf1('0x6e'),_0x7cf1('0x6f')],'raw':!![]}]})['then'](function(_0x4e7b7b){if(_0x4e7b7b){var _0x3f2a68=_[_0x7cf1('0x70')](_0x4e7b7b,function(_0x58bffc){var _0x42f1ae=_0x58bffc[_0x7cf1('0x29')]({'plain':!![]});_0x42f1ae['Agents'][_0x7cf1('0x71')](function(_0x105a4f){_0x105a4f[_0x7cf1('0x72')]=_['find'](_0x8088cf,{'id':_0x42f1ae['id']})['penalty'];});return _0x42f1ae[_0x7cf1('0x73')];});return db['VoiceQueue']['find']({'where':{'id':_0x94e436[_0x7cf1('0x4b')]['id']}})['then'](function(_0x34a452){return db[_0x7cf1('0x74')][_0x7cf1('0x75')](function(_0x2375ab){return _0x34a452[_0x7cf1('0x6a')](_0x4a6aa4,{'transaction':_0x2375ab})[_0x7cf1('0x28')](function(){return BPromise[_0x7cf1('0x76')](_0x8088cf,function(_0x39ad9f){return db[_0x7cf1('0x77')]['upsert']({'TeamId':_0x39ad9f['id'],'VoiceQueueId':_0x94e436['params']['id'],'penalty':_0x39ad9f[_0x7cf1('0x72')]},{'transaction':_0x2375ab});});})[_0x7cf1('0x28')](function(){return BPromise['each'](_0x3f2a68,function(_0x134022){return db[_0x7cf1('0x78')]['findOrCreate']({'where':{'UserId':_0x134022['id'],'VoiceQueueId':_0x94e436['params']['id']},'defaults':{'penalty':_0x134022['penalty']},'transaction':_0x2375ab});});})['then'](function(){return BPromise[_0x7cf1('0x76')](_['filter'](_0x3f2a68,{'online':!![]}),function(_0x33f52f){return db[_0x7cf1('0x79')]['upsert']({'membername':_0x33f52f[_0x7cf1('0x33')],'UserId':_0x33f52f['id'],'queue_name':_0x34a452[_0x7cf1('0x33')],'VoiceQueueId':_0x34a452['id'],'interface':_['isNil'](_0x33f52f[_0x7cf1('0x6f')])?util[_0x7cf1('0x7a')](_0x7cf1('0x7b'),_0x33f52f[_0x7cf1('0x33')]):_0x33f52f[_0x7cf1('0x6f')],'paused':_0x33f52f[_0x7cf1('0x6e')]||![],'penalty':_0x33f52f[_0x7cf1('0x72')]},{'transaction':_0x2375ab});});})['then'](function(){_0x3f2a68[_0x7cf1('0x71')](function(_0x594b0e){socket[_0x7cf1('0x7c')](_0x7cf1('0x7d'),{'UserId':_0x594b0e['id'],'VoiceQueueId':_0x34a452['id']});});});});});}})['then'](respondWithStatusCode(_0x3bdb4c,null))[_0x7cf1('0x49')](handleError(_0x3bdb4c,null));};exports[_0x7cf1('0x7e')]=function(_0x11a3c7,_0x68f7e0,_0x4cc6b0){return db[_0x7cf1('0x6c')][_0x7cf1('0x62')]({'where':{'id':_0x11a3c7[_0x7cf1('0x3d')][_0x7cf1('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x7cf1('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7cf1('0x28')](handleEntityNotFound(_0x68f7e0,null))['then'](function(_0x32ec88){var _0x4e5d35=_[_0x7cf1('0x2f')](_0x32ec88,'id');var _0x5d4201=[];var _0x531e1b=[];var _0x562f9a=squel['select']();_0x562f9a[_0x7cf1('0x80')]('tq.TeamId')['from'](_0x7cf1('0x81'),'tq')[_0x7cf1('0x82')](_0x7cf1('0x83'),'ut',_0x7cf1('0x84'))[_0x7cf1('0x44')](_0x7cf1('0x85'),_0x11a3c7[_0x7cf1('0x4b')]['id']);for(var _0x471ef2=0x0;_0x471ef2<_0x32ec88[_0x7cf1('0x40')];_0x471ef2+=0x1){let _0x338a65=_0x32ec88[_0x471ef2];for(var _0x178e0d=0x0;_0x178e0d<_0x338a65['Agents']['length'];_0x178e0d+=0x1){let _0x33a2fd=_0x338a65[_0x7cf1('0x73')][_0x178e0d];var _0x18915d=_0x562f9a[_0x7cf1('0x57')]();_0x18915d[_0x7cf1('0x44')]('ut.UserId\x20=\x20?',_0x33a2fd['id']);_0x531e1b[_0x7cf1('0x86')](db[_0x7cf1('0x74')][_0x7cf1('0x3d')](_0x18915d['toString'](),{'type':db[_0x7cf1('0x74')][_0x7cf1('0x87')]['SELECT']})[_0x7cf1('0x28')](function(_0x42029f){if(_0x42029f['length']===0x1){return _0x33a2fd['id'];}else{var _0x2b0915=_[_0x7cf1('0x88')](_[_0x7cf1('0x2f')](_0x42029f,_0x7cf1('0x89')),function(_0x2a654f){return _[_0x7cf1('0x31')](_0x4e5d35,_0x2a654f);});if(_0x2b0915){return _0x33a2fd['id'];}}}));}}return BPromise['all'](_0x531e1b)[_0x7cf1('0x28')](function(_0x26e574){_0x5d4201=_(_0x5d4201)[_0x7cf1('0x8a')](_0x26e574)[_0x7cf1('0x8b')]()[_0x7cf1('0x30')]();return db[_0x7cf1('0x37')]['find']({'where':{'id':_0x11a3c7[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](function(_0xf7c03){return db['sequelize'][_0x7cf1('0x75')](function(_0x40868e){return _0xf7c03[_0x7cf1('0x7e')](_0x11a3c7[_0x7cf1('0x3d')][_0x7cf1('0x7f')],{'transaction':_0x40868e})[_0x7cf1('0x28')](function(){if(!_[_0x7cf1('0x8c')](_0x5d4201)){return _0xf7c03['removeAgents'](_0x5d4201,{'transaction':_0x40868e})[_0x7cf1('0x28')](function(){return db['UserVoiceQueueRt'][_0x7cf1('0x5e')]({'where':{'VoiceQueueId':_0x11a3c7['params']['id'],'UserId':_0x5d4201},'transaction':_0x40868e});});}})[_0x7cf1('0x28')](function(){_0x5d4201[_0x7cf1('0x71')](function(_0x4df50a){socket['emit'](_0x7cf1('0x8d'),{'UserId':_0x4df50a,'VoiceQueueId':_0xf7c03['id']});});});});});});})[_0x7cf1('0x28')](respondWithStatusCode(_0x68f7e0,null))[_0x7cf1('0x49')](handleError(_0x68f7e0,null));};exports['addAgents']=function(_0x197922,_0x38907a,_0x31576b){var _0x53393d,_0x2822fd;return db[_0x7cf1('0x37')][_0x7cf1('0x4e')]({'where':{'id':_0x197922[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x38907a,null))['then'](function(_0x59ea33){if(_0x59ea33){_0x2822fd=_0x59ea33;return _0x59ea33['addAgents'](_0x197922[_0x7cf1('0x50')][_0x7cf1('0x7f')],_[_0x7cf1('0x59')](_0x197922[_0x7cf1('0x50')],[_0x7cf1('0x7f'),'id'])||{})[_0x7cf1('0x8e')](function(_0x23b961){for(var _0x142fa8=0x0;_0x142fa8<_0x197922[_0x7cf1('0x50')][_0x7cf1('0x7f')]['length'];_0x142fa8+=0x1){socket[_0x7cf1('0x7c')](_0x7cf1('0x7d'),{'UserId':Number(_0x197922[_0x7cf1('0x50')][_0x7cf1('0x7f')][_0x142fa8]),'VoiceQueueId':Number(_0x197922[_0x7cf1('0x4b')]['id'])});}return _0x23b961;});}})[_0x7cf1('0x28')](function(_0x33ff8e){_0x53393d=_0x33ff8e||[];if(_0x2822fd){return db['User'][_0x7cf1('0x62')]({'where':{'id':_0x197922[_0x7cf1('0x50')][_0x7cf1('0x7f')]},'attributes':['id',_0x7cf1('0x33'),_0x7cf1('0x8f'),'voicePause','interface'],'raw':!![]});}})[_0x7cf1('0x28')](function(_0x1f4584){if(!_['isEmpty'](_0x1f4584)){var _0x2b34db=[];for(var _0x51f64a=0x0;_0x51f64a<_0x1f4584[_0x7cf1('0x40')];_0x51f64a++){if(_0x1f4584[_0x51f64a]['online']){_0x2b34db[_0x7cf1('0x86')](db[_0x7cf1('0x79')][_0x7cf1('0x90')]({'membername':_0x1f4584[_0x51f64a][_0x7cf1('0x33')],'UserId':_0x1f4584[_0x51f64a]['id'],'queue_name':_0x2822fd['name'],'VoiceQueueId':_0x2822fd['id'],'interface':_['isNil'](_0x1f4584[_0x51f64a][_0x7cf1('0x6f')])?util[_0x7cf1('0x7a')](_0x7cf1('0x7b'),_0x1f4584[_0x51f64a][_0x7cf1('0x33')]):_0x1f4584[_0x51f64a]['interface'],'paused':_0x1f4584[_0x51f64a][_0x7cf1('0x6e')]||![],'penalty':_0x197922[_0x7cf1('0x50')][_0x7cf1('0x72')]||0x0}));}}return BPromise[_0x7cf1('0x91')](_0x2b34db);}})[_0x7cf1('0x28')](function(){return _0x53393d;})[_0x7cf1('0x28')](respondWithResult(_0x38907a,null))['catch'](handleError(_0x38907a,null));};exports[_0x7cf1('0x92')]=function(_0x3ea07c,_0x3a8770,_0x2dd21b){return db['VoiceQueue'][_0x7cf1('0x4e')]({'where':{'id':_0x3ea07c[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x3a8770,null))[_0x7cf1('0x28')](function(_0x81ca88){if(_0x81ca88){return _0x81ca88['removeAgents'](_0x3ea07c[_0x7cf1('0x3d')][_0x7cf1('0x7f')])[_0x7cf1('0x28')](function(){if(_[_0x7cf1('0x93')](_0x3ea07c[_0x7cf1('0x3d')][_0x7cf1('0x7f')])){for(var _0x32e2e8=0x0;_0x32e2e8<_0x3ea07c[_0x7cf1('0x3d')][_0x7cf1('0x7f')][_0x7cf1('0x40')];_0x32e2e8+=0x1){socket[_0x7cf1('0x7c')](_0x7cf1('0x8d'),{'UserId':Number(_0x3ea07c[_0x7cf1('0x3d')]['ids'][_0x32e2e8]),'VoiceQueueId':Number(_0x3ea07c[_0x7cf1('0x4b')]['id'])});}}else{socket['emit'](_0x7cf1('0x8d'),{'UserId':Number(_0x3ea07c[_0x7cf1('0x3d')][_0x7cf1('0x7f')]),'VoiceQueueId':Number(_0x3ea07c[_0x7cf1('0x4b')]['id'])});}});}})[_0x7cf1('0x28')](function(_0x4f9ba5){return db[_0x7cf1('0x79')][_0x7cf1('0x5e')]({'where':{'VoiceQueueId':_0x3ea07c[_0x7cf1('0x4b')]['id'],'UserId':_0x3ea07c[_0x7cf1('0x3d')]['ids']}})[_0x7cf1('0x28')](function(){return _0x4f9ba5;});})[_0x7cf1('0x28')](respondWithStatusCode(_0x3a8770,null))['catch'](handleError(_0x3a8770,null));};exports['getAgents']=function(_0xf5caa2,_0x154ab1,_0x44f2ba){var _0x300829={};var _0x32ecc7={};var _0xed9b7;var _0x2519a1;return db[_0x7cf1('0x37')][_0x7cf1('0x5f')]({'where':{'id':_0xf5caa2[_0x7cf1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x154ab1,null))['then'](function(_0x6c8034){if(_0x6c8034){_0xed9b7=_0x6c8034;_0x32ecc7[_0x7cf1('0x3a')]=_['keys'](db[_0x7cf1('0x6d')]['rawAttributes']);_0x32ecc7[_0x7cf1('0x3d')]=_['keys'](_0xf5caa2['query']);_0x32ecc7[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x32ecc7[_0x7cf1('0x3a')],_0x32ecc7[_0x7cf1('0x3d')]);_0x300829[_0x7cf1('0x3e')]=_['intersection'](_0x32ecc7[_0x7cf1('0x3a')],qs['fields'](_0xf5caa2[_0x7cf1('0x3d')]['fields']));_0x300829[_0x7cf1('0x3e')]=_0x300829[_0x7cf1('0x3e')][_0x7cf1('0x40')]?_0x300829[_0x7cf1('0x3e')]:_0x32ecc7[_0x7cf1('0x3a')];_0x300829[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0xf5caa2['query'][_0x7cf1('0x43')]);_0x300829[_0x7cf1('0x44')]=qs[_0x7cf1('0x3b')](_[_0x7cf1('0x45')](_0xf5caa2[_0x7cf1('0x3d')],_0x32ecc7[_0x7cf1('0x3b')]));if(_0xf5caa2[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0x300829['where']=_[_0x7cf1('0x46')](_0x300829[_0x7cf1('0x44')],{'$or':_[_0x7cf1('0x2f')](_0x300829[_0x7cf1('0x3e')],function(_0x1c751c){var _0x4dacf8={};_0x4dacf8[_0x1c751c]={'$like':'%'+_0xf5caa2[_0x7cf1('0x3d')][_0x7cf1('0x2d')]+'%'};return _0x4dacf8;})});}_0x300829=_[_0x7cf1('0x46')]({},_0x300829,_0xf5caa2[_0x7cf1('0x4d')]);return _0xed9b7[_0x7cf1('0x94')](_0x300829);}})[_0x7cf1('0x28')](function(_0x24ee58){if(_0x24ee58){_0x2519a1=_0x24ee58['length'];if(!_0xf5caa2[_0x7cf1('0x3d')][_0x7cf1('0x41')](_0x7cf1('0x60'))){_0x300829[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0xf5caa2[_0x7cf1('0x3d')]['limit']);_0x300829[_0x7cf1('0x1f')]=qs[_0x7cf1('0x1f')](_0xf5caa2[_0x7cf1('0x3d')][_0x7cf1('0x1f')]);}return _0xed9b7['getAgents'](_0x300829);}})['then'](function(_0x535325){if(_0x535325){return _0x535325?{'count':_0x2519a1,'rows':_0x535325}:null;}})['then'](respondWithResult(_0x154ab1,null))['catch'](handleError(_0x154ab1,null));};exports[_0x7cf1('0x95')]=function(_0x38132e,_0x27f393,_0x4ff193){var _0x4c241c={};var _0x1934e9={};var _0x43fbd4;var _0x141e7e;return db[_0x7cf1('0x37')][_0x7cf1('0x5f')]({'where':{'id':_0x38132e['params']['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x27f393,null))[_0x7cf1('0x28')](function(_0xc7024f){if(_0xc7024f){_0x43fbd4=_0xc7024f;_0x1934e9[_0x7cf1('0x3a')]=_['keys'](db[_0x7cf1('0x79')][_0x7cf1('0x38')]);_0x1934e9[_0x7cf1('0x3d')]=_['keys'](_0x38132e[_0x7cf1('0x3d')]);_0x1934e9[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x1934e9[_0x7cf1('0x3a')],_0x1934e9[_0x7cf1('0x3d')]);_0x4c241c[_0x7cf1('0x3e')]=_[_0x7cf1('0x3c')](_0x1934e9[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x38132e[_0x7cf1('0x3d')][_0x7cf1('0x3f')]));_0x4c241c['attributes']=_0x4c241c['attributes'][_0x7cf1('0x40')]?_0x4c241c[_0x7cf1('0x3e')]:_0x1934e9[_0x7cf1('0x3a')];_0x4c241c[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x38132e[_0x7cf1('0x3d')][_0x7cf1('0x43')]);_0x4c241c[_0x7cf1('0x44')]=qs['filters'](_[_0x7cf1('0x45')](_0x38132e[_0x7cf1('0x3d')],_0x1934e9[_0x7cf1('0x3b')]));if(_0x38132e[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0x4c241c[_0x7cf1('0x44')]=_[_0x7cf1('0x46')](_0x4c241c['where'],{'$or':_[_0x7cf1('0x2f')](_0x4c241c[_0x7cf1('0x3e')],function(_0x18990c){var _0x5e9647={};_0x5e9647[_0x18990c]={'$like':'%'+_0x38132e[_0x7cf1('0x3d')][_0x7cf1('0x2d')]+'%'};return _0x5e9647;})});}_0x4c241c=_[_0x7cf1('0x46')]({},_0x4c241c,_0x38132e['options']);return _0x43fbd4[_0x7cf1('0x95')](_0x4c241c);}})[_0x7cf1('0x28')](function(_0x6fecf){if(_0x6fecf){_0x141e7e=_0x6fecf['length'];if(!_0x38132e['query'][_0x7cf1('0x41')]('nolimit')){_0x4c241c[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x38132e[_0x7cf1('0x3d')]['limit']);_0x4c241c[_0x7cf1('0x1f')]=qs[_0x7cf1('0x1f')](_0x38132e[_0x7cf1('0x3d')]['offset']);}return _0x43fbd4['getMembers'](_0x4c241c);}})[_0x7cf1('0x28')](function(_0x142cca){return _0x142cca?{'count':_0x141e7e,'rows':_0x142cca}:null;})[_0x7cf1('0x28')](respondWithResult(_0x27f393,null))[_0x7cf1('0x49')](handleError(_0x27f393,null));};exports[_0x7cf1('0x96')]=function(_0x4b40a8,_0xb6b890,_0x500693){var _0x12e538={};var _0xdfd3ee={};var _0x535c01;var _0x5d209a;return db[_0x7cf1('0x37')]['findOne']({'where':{'id':_0x4b40a8[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0xb6b890,null))['then'](function(_0x554600){if(_0x554600){_0x535c01=_0x554600;_0xdfd3ee['model']=_[_0x7cf1('0x58')](db[_0x7cf1('0x97')]['rawAttributes']);_0xdfd3ee[_0x7cf1('0x3d')]=_[_0x7cf1('0x58')](_0x4b40a8['query']);_0xdfd3ee['filters']=_[_0x7cf1('0x3c')](_0xdfd3ee['model'],_0xdfd3ee['query']);_0x12e538['attributes']=_[_0x7cf1('0x3c')](_0xdfd3ee[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x4b40a8['query'][_0x7cf1('0x3f')]));_0x12e538[_0x7cf1('0x3e')]=_0x12e538[_0x7cf1('0x3e')]['length']?_0x12e538[_0x7cf1('0x3e')]:_0xdfd3ee[_0x7cf1('0x3a')];_0x12e538['order']=qs['sort'](_0x4b40a8['query'][_0x7cf1('0x43')]);_0x12e538[_0x7cf1('0x44')]=qs['filters'](_[_0x7cf1('0x45')](_0x4b40a8[_0x7cf1('0x3d')],_0xdfd3ee[_0x7cf1('0x3b')]));if(_0x4b40a8[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0x12e538[_0x7cf1('0x44')]=_[_0x7cf1('0x46')](_0x12e538['where'],{'$or':_['map'](_0x12e538['attributes'],function(_0xd40156){var _0x17f46f={};_0x17f46f[_0xd40156]={'$like':'%'+_0x4b40a8[_0x7cf1('0x3d')]['filter']+'%'};return _0x17f46f;})});}_0x12e538=_[_0x7cf1('0x46')]({},_0x12e538,_0x4b40a8['options']);return _0x535c01['getLists'](_0x12e538);}})[_0x7cf1('0x28')](function(_0x4bb3b9){if(_0x4bb3b9){_0x5d209a=_0x4bb3b9[_0x7cf1('0x40')];if(!_0x4b40a8[_0x7cf1('0x3d')]['hasOwnProperty']('nolimit')){_0x12e538[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x4b40a8[_0x7cf1('0x3d')][_0x7cf1('0x21')]);_0x12e538['offset']=qs[_0x7cf1('0x1f')](_0x4b40a8[_0x7cf1('0x3d')][_0x7cf1('0x1f')]);}return _0x535c01[_0x7cf1('0x96')](_0x12e538);}})['then'](function(_0x56a99b){if(_0x56a99b){return _0x56a99b?{'count':_0x5d209a,'rows':_0x56a99b}:null;}})[_0x7cf1('0x28')](respondWithResult(_0xb6b890,null))[_0x7cf1('0x49')](handleError(_0xb6b890,null));};exports[_0x7cf1('0x98')]=function(_0x577523,_0x1c12e3,_0x103d32){var _0x2aa8c9,_0x10a419;return db[_0x7cf1('0x37')][_0x7cf1('0x4e')]({'where':{'id':_0x577523[_0x7cf1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c12e3,null))[_0x7cf1('0x28')](function(_0x3666d0){if(_0x3666d0){_0x10a419=_0x3666d0;return _0x3666d0['addLists'](_0x577523[_0x7cf1('0x50')]['ids'],_['omit'](_0x577523[_0x7cf1('0x50')],[_0x7cf1('0x7f'),'id'])||{});}return null;})[_0x7cf1('0x8e')](function(_0x336457){var _0x5de9a2;_0x2aa8c9=_0x336457||[];var _0x542002=[];if(_0x336457){for(var _0x503d2a=0x0;_0x503d2a<_0x336457[_0x7cf1('0x40')];_0x503d2a+=0x1){var _0x41397b=_0x336457[_0x503d2a][_0x7cf1('0x29')]({'plain':!![]});_0x10a419[_0x7cf1('0x99')]=_0x577523['body'][_0x7cf1('0x99')]?_0x577523['body'][_0x7cf1('0x99')]:_0x10a419['dialCheckDuplicateType'];switch(_0x10a419['dialCheckDuplicateType']){case _0x7cf1('0x9a'):_0x5de9a2=squel[_0x7cf1('0x9b')]()[_0x7cf1('0x9c')](_0x7cf1('0x9d'))[_0x7cf1('0x9e')]([_0x7cf1('0x9f'),_0x7cf1('0xa0'),_0x7cf1('0xa1'),_0x7cf1('0xa2'),_0x7cf1('0x61'),'createdAt','updatedAt'],squel[_0x7cf1('0xa3')]()[_0x7cf1('0x80')](_0x7cf1('0x9f'),_0x7cf1('0x9f'))[_0x7cf1('0x80')](_0x7cf1('0xa4'),'scheduledAt')[_0x7cf1('0x80')]('id',_0x7cf1('0xa1'))[_0x7cf1('0x80')](_0x41397b[_0x7cf1('0xa5')][_0x7cf1('0xa6')](),_0x7cf1('0xa2'))['field'](_0x577523[_0x7cf1('0x4b')]['id']['toString'](),_0x7cf1('0x61'))[_0x7cf1('0x80')](_0x7cf1('0xa4'),'createdAt')[_0x7cf1('0x80')](_0x7cf1('0xa4'),_0x7cf1('0x5b'))[_0x7cf1('0xa7')](_0x7cf1('0xa8'))[_0x7cf1('0x44')]('deletedAt\x20IS\x20NULL')[_0x7cf1('0x44')]('ListId\x20=\x20?',_0x41397b['CmListId'][_0x7cf1('0xa6')]())['where'](_0x7cf1('0xa9'))[_0x7cf1('0x44')](_0x7cf1('0xaa'),squel[_0x7cf1('0xa3')]()[_0x7cf1('0x80')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x7cf1('0xab'))[_0x7cf1('0x44')]('VoiceQueueId\x20=\x20?',_0x577523[_0x7cf1('0x4b')]['id'][_0x7cf1('0xa6')]()))[_0x7cf1('0x44')](_0x7cf1('0xaa'),squel['select']()[_0x7cf1('0x80')](_0x7cf1('0xac'))[_0x7cf1('0xa7')](_0x7cf1('0x9d'))[_0x7cf1('0x44')](_0x7cf1('0x85'),_0x577523[_0x7cf1('0x4b')]['id'][_0x7cf1('0xa6')]())))[_0x7cf1('0xa6')]();break;case _0x7cf1('0xad'):_0x5de9a2=squel[_0x7cf1('0x9b')]()[_0x7cf1('0x9c')](_0x7cf1('0x9d'))[_0x7cf1('0x9e')](['phone','scheduledAt',_0x7cf1('0xa1'),_0x7cf1('0xa2'),_0x7cf1('0x61'),_0x7cf1('0x5a'),_0x7cf1('0x5b')],squel['select']()[_0x7cf1('0x80')]('phone','phone')['field'](_0x7cf1('0xa4'),_0x7cf1('0xa0'))[_0x7cf1('0x80')]('id',_0x7cf1('0xa1'))[_0x7cf1('0x80')](_0x41397b[_0x7cf1('0xa5')][_0x7cf1('0xa6')](),_0x7cf1('0xa2'))[_0x7cf1('0x80')](_0x577523['params']['id']['toString'](),_0x7cf1('0x61'))[_0x7cf1('0x80')]('NOW()',_0x7cf1('0x5a'))[_0x7cf1('0x80')](_0x7cf1('0xa4'),'updatedAt')['from'](_0x7cf1('0xa8'))['where'](_0x7cf1('0xae'))[_0x7cf1('0x44')](_0x7cf1('0xaf'),_0x41397b['CmListId']['toString']())[_0x7cf1('0x44')](_0x7cf1('0xa9'))['where'](_0x7cf1('0xaa'),squel['select']()[_0x7cf1('0x80')](_0x7cf1('0xac'))[_0x7cf1('0xa7')]('cm_hopper')[_0x7cf1('0x44')]('VoiceQueueId\x20=\x20?',_0x577523[_0x7cf1('0x4b')]['id'][_0x7cf1('0xa6')]())))[_0x7cf1('0xa6')]();break;default:_0x5de9a2=squel['insert']()[_0x7cf1('0x9c')](_0x7cf1('0x9d'))[_0x7cf1('0x9e')](['phone',_0x7cf1('0xa0'),'ContactId',_0x7cf1('0xa2'),_0x7cf1('0x61'),_0x7cf1('0x5a'),_0x7cf1('0x5b')],squel[_0x7cf1('0xa3')]()['field'](_0x7cf1('0x9f'),'phone')['field'](_0x7cf1('0xa4'),_0x7cf1('0xa0'))[_0x7cf1('0x80')]('id','ContactId')[_0x7cf1('0x80')](_0x41397b[_0x7cf1('0xa5')]['toString'](),_0x7cf1('0xa2'))[_0x7cf1('0x80')](_0x577523['params']['id'][_0x7cf1('0xa6')](),_0x7cf1('0x61'))[_0x7cf1('0x80')](_0x7cf1('0xa4'),'createdAt')[_0x7cf1('0x80')](_0x7cf1('0xa4'),_0x7cf1('0x5b'))['from'](_0x7cf1('0xa8'))[_0x7cf1('0x44')]('deletedAt\x20IS\x20NULL')[_0x7cf1('0x44')](_0x7cf1('0xaf'),_0x41397b[_0x7cf1('0xa5')][_0x7cf1('0xa6')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x7cf1('0xa6')]();}_0x542002[_0x7cf1('0x86')](db[_0x7cf1('0x74')][_0x7cf1('0x3d')](_0x5de9a2));}return BPromise[_0x7cf1('0x91')](_0x542002);}})[_0x7cf1('0x28')](function(){return _0x2aa8c9;})[_0x7cf1('0x28')](respondWithResult(_0x1c12e3,null))[_0x7cf1('0x49')](handleError(_0x1c12e3,null));};exports[_0x7cf1('0xb0')]=function(_0x2d3aaa,_0x577b49,_0x53f98b){return db[_0x7cf1('0x37')][_0x7cf1('0x4e')]({'where':{'id':_0x2d3aaa[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x577b49,null))[_0x7cf1('0x28')](function(_0x49d3f5){if(_0x49d3f5){return _0x49d3f5[_0x7cf1('0xb0')](_0x2d3aaa[_0x7cf1('0x3d')][_0x7cf1('0x7f')]);}})[_0x7cf1('0x28')](function(_0x2038b0){if(_0x2038b0){return db[_0x7cf1('0xb1')][_0x7cf1('0x5e')]({'where':{'ListId':_0x2d3aaa[_0x7cf1('0x3d')][_0x7cf1('0x7f')],'VoiceQueueId':_0x2d3aaa['params']['id']}})[_0x7cf1('0x28')](function(){return _0x2038b0;});}})['then'](respondWithStatusCode(_0x577b49,null))[_0x7cf1('0x49')](handleError(_0x577b49,null));};exports['getBlackLists']=function(_0x4547f3,_0x3a41a0,_0xe3827d){var _0x3ec951={};var _0x55d841={};var _0x239dfa;var _0x43969b;return db[_0x7cf1('0x37')][_0x7cf1('0x5f')]({'where':{'id':_0x4547f3[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x3a41a0,null))['then'](function(_0x4cfe07){if(_0x4cfe07){_0x239dfa=_0x4cfe07;_0x55d841[_0x7cf1('0x3a')]=_[_0x7cf1('0x58')](db[_0x7cf1('0x97')]['rawAttributes']);_0x55d841[_0x7cf1('0x3d')]=_[_0x7cf1('0x58')](_0x4547f3['query']);_0x55d841[_0x7cf1('0x3b')]=_[_0x7cf1('0x3c')](_0x55d841[_0x7cf1('0x3a')],_0x55d841[_0x7cf1('0x3d')]);_0x3ec951[_0x7cf1('0x3e')]=_[_0x7cf1('0x3c')](_0x55d841[_0x7cf1('0x3a')],qs[_0x7cf1('0x3f')](_0x4547f3[_0x7cf1('0x3d')][_0x7cf1('0x3f')]));_0x3ec951['attributes']=_0x3ec951[_0x7cf1('0x3e')][_0x7cf1('0x40')]?_0x3ec951[_0x7cf1('0x3e')]:_0x55d841[_0x7cf1('0x3a')];_0x3ec951[_0x7cf1('0x42')]=qs[_0x7cf1('0x43')](_0x4547f3[_0x7cf1('0x3d')][_0x7cf1('0x43')]);_0x3ec951[_0x7cf1('0x44')]=qs['filters'](_['pick'](_0x4547f3[_0x7cf1('0x3d')],_0x55d841['filters']));if(_0x4547f3[_0x7cf1('0x3d')][_0x7cf1('0x2d')]){_0x3ec951[_0x7cf1('0x44')]=_[_0x7cf1('0x46')](_0x3ec951[_0x7cf1('0x44')],{'$or':_[_0x7cf1('0x2f')](_0x3ec951[_0x7cf1('0x3e')],function(_0x202c19){var _0x5a45be={};_0x5a45be[_0x202c19]={'$like':'%'+_0x4547f3[_0x7cf1('0x3d')]['filter']+'%'};return _0x5a45be;})});}_0x3ec951=_[_0x7cf1('0x46')]({},_0x3ec951,_0x4547f3[_0x7cf1('0x4d')]);return _0x239dfa[_0x7cf1('0xb2')](_0x3ec951);}})['then'](function(_0x89a2c0){if(_0x89a2c0){_0x43969b=_0x89a2c0[_0x7cf1('0x40')];if(!_0x4547f3['query'][_0x7cf1('0x41')]('nolimit')){_0x3ec951[_0x7cf1('0x21')]=qs[_0x7cf1('0x21')](_0x4547f3[_0x7cf1('0x3d')][_0x7cf1('0x21')]);_0x3ec951[_0x7cf1('0x1f')]=qs[_0x7cf1('0x1f')](_0x4547f3[_0x7cf1('0x3d')][_0x7cf1('0x1f')]);}return _0x239dfa[_0x7cf1('0xb2')](_0x3ec951);}})['then'](function(_0x455409){if(_0x455409){return _0x455409?{'count':_0x43969b,'rows':_0x455409}:null;}})[_0x7cf1('0x28')](respondWithResult(_0x3a41a0,null))[_0x7cf1('0x49')](handleError(_0x3a41a0,null));};exports[_0x7cf1('0xb3')]=function(_0x503e34,_0x17df6e,_0x48def0){var _0x3561b8,_0x1030e9;return db[_0x7cf1('0x37')]['find']({'where':{'id':_0x503e34[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x17df6e,null))[_0x7cf1('0x28')](function(_0x2246a6){if(_0x2246a6){_0x1030e9=_0x2246a6;return _0x2246a6[_0x7cf1('0xb3')](_0x503e34[_0x7cf1('0x50')][_0x7cf1('0x7f')],_[_0x7cf1('0x59')](_0x503e34[_0x7cf1('0x50')],[_0x7cf1('0x7f'),'id'])||{});}return null;})[_0x7cf1('0x8e')](function(_0x1911b1){var _0x2c9916;_0x3561b8=_0x1911b1||[];var _0x52dd8c=[];if(_0x1911b1){for(var _0x16c13a=0x0;_0x16c13a<_0x1911b1['length'];_0x16c13a+=0x1){var _0x3efd34=_0x1911b1[_0x16c13a][_0x7cf1('0x29')]({'plain':!![]});_0x2c9916=squel[_0x7cf1('0x9b')]()[_0x7cf1('0x9c')](_0x7cf1('0xb4'))['fromQuery']([_0x7cf1('0x9f'),_0x7cf1('0xa1'),_0x7cf1('0xa2'),_0x7cf1('0x61'),_0x7cf1('0x5a'),_0x7cf1('0x5b')],squel['select']()[_0x7cf1('0x80')](_0x7cf1('0x9f'),_0x7cf1('0x9f'))[_0x7cf1('0x80')]('id',_0x7cf1('0xa1'))[_0x7cf1('0x80')](_0x3efd34['CmListId']['toString'](),_0x7cf1('0xa2'))[_0x7cf1('0x80')](_0x503e34[_0x7cf1('0x4b')]['id'][_0x7cf1('0xa6')](),_0x7cf1('0x61'))[_0x7cf1('0x80')](_0x7cf1('0xa4'),_0x7cf1('0x5a'))['field'](_0x7cf1('0xa4'),'updatedAt')[_0x7cf1('0xa7')](_0x7cf1('0xa8'))[_0x7cf1('0x44')](_0x7cf1('0xae'))[_0x7cf1('0x44')](_0x7cf1('0xaf'),_0x3efd34[_0x7cf1('0xa5')][_0x7cf1('0xa6')]())[_0x7cf1('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x7cf1('0xa6')]();_0x52dd8c[_0x7cf1('0x86')](db[_0x7cf1('0x74')][_0x7cf1('0x3d')](_0x2c9916));}return BPromise['all'](_0x52dd8c);}})['then'](function(){return _0x3561b8;})[_0x7cf1('0x28')](respondWithResult(_0x17df6e,null))['catch'](handleError(_0x17df6e,null));};exports[_0x7cf1('0xb5')]=function(_0x38e2d6,_0x4da448,_0x4d39ec){return db[_0x7cf1('0x37')][_0x7cf1('0x4e')]({'where':{'id':_0x38e2d6[_0x7cf1('0x4b')]['id']}})[_0x7cf1('0x28')](handleEntityNotFound(_0x4da448,null))[_0x7cf1('0x28')](function(_0x59790c){if(_0x59790c){return _0x59790c[_0x7cf1('0xb5')](_0x38e2d6[_0x7cf1('0x3d')][_0x7cf1('0x7f')]);}})['then'](function(_0x29dff8){if(_0x29dff8){return db[_0x7cf1('0x68')]['destroy']({'where':{'ListId':_0x38e2d6[_0x7cf1('0x3d')][_0x7cf1('0x7f')],'VoiceQueueId':_0x38e2d6[_0x7cf1('0x4b')]['id']}})['then'](function(){return _0x29dff8;});}})[_0x7cf1('0x28')](respondWithStatusCode(_0x4da448,null))['catch'](handleError(_0x4da448,null));}; \ No newline at end of file +var _0x327e=['CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','online','interface','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','union','compact','removeTeams','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','all','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','update','getHoppers','findOne','hasOwnProperty'];(function(_0x4f09c2,_0x476952){var _0x30be0d=function(_0x21fb05){while(--_0x21fb05){_0x4f09c2['push'](_0x4f09c2['shift']());}};_0x30be0d(++_0x476952);}(_0x327e,0x113));var _0xe327=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x327e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe327('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe327('0x1'));var jsonpatch=require(_0xe327('0x2'));var rp=require(_0xe327('0x3'));var moment=require('moment');var BPromise=require(_0xe327('0x4'));var Mustache=require(_0xe327('0x5'));var util=require('util');var path=require(_0xe327('0x6'));var sox=require('sox');var csv=require(_0xe327('0x7'));var ejs=require(_0xe327('0x8'));var fs=require('fs');var fs_extra=require(_0xe327('0x9'));var _=require(_0xe327('0xa'));var squel=require('squel');var crypto=require(_0xe327('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe327('0xc'));var toCsv=require(_0xe327('0x7'));var querystring=require('querystring');var Papa=require(_0xe327('0xd'));var Redis=require(_0xe327('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe327('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe327('0x10'));var logger=require(_0xe327('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe327('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe327('0x13'))['db'];config[_0xe327('0x14')]=_['defaults'](config['redis'],{'host':_0xe327('0x15'),'port':0x18eb});var socket=require(_0xe327('0x16'))(new Redis(config['redis']));require(_0xe327('0x17'))['register'](socket);function respondWithStatusCode(_0x3f4992,_0x345ec9){_0x345ec9=_0x345ec9||0xcc;return function(_0x56ad72){if(_0x56ad72){return _0x3f4992[_0xe327('0x18')](_0x345ec9);}return _0x3f4992[_0xe327('0x19')](_0x345ec9)['end']();};}function respondWithResult(_0x3493e9,_0x3861a7){_0x3861a7=_0x3861a7||0xc8;return function(_0x2ee09c){if(_0x2ee09c){return _0x3493e9[_0xe327('0x19')](_0x3861a7)[_0xe327('0x1a')](_0x2ee09c);}};}function respondWithFilteredResult(_0x4935aa,_0x5573df){return function(_0xab2812){if(_0xab2812){var _0x347ff6=typeof _0x5573df[_0xe327('0x1b')]==='undefined'&&typeof _0x5573df[_0xe327('0x1c')]===_0xe327('0x1d');var _0x5de3a2=_0xab2812[_0xe327('0x1e')];var _0x252e46=_0x347ff6?0x0:_0x5573df['offset'];var _0x2fbcdb=_0x347ff6?_0xab2812['count']:_0x5573df[_0xe327('0x1b')]+_0x5573df[_0xe327('0x1c')];var _0x1a7276;if(_0x2fbcdb>=_0x5de3a2){_0x2fbcdb=_0x5de3a2;_0x1a7276=0xc8;}else{_0x1a7276=0xce;}_0x4935aa['status'](_0x1a7276);return _0x4935aa[_0xe327('0x1f')](_0xe327('0x20'),_0x252e46+'-'+_0x2fbcdb+'/'+_0x5de3a2)[_0xe327('0x1a')](_0xab2812);}return null;};}function patchUpdates(_0x12e3a0){return function(_0x2b2cab){try{jsonpatch[_0xe327('0x21')](_0x2b2cab,_0x12e3a0,!![]);}catch(_0x1b3fb8){return BPromise[_0xe327('0x22')](_0x1b3fb8);}return _0x2b2cab[_0xe327('0x23')]();};}function saveUpdates(_0x42e7e7,_0x3da3b1){return function(_0x9472d3){if(_0x9472d3){return _0x9472d3['update'](_0x42e7e7)['then'](function(_0x488226){return _0x488226;});}return null;};}function removeEntity(_0x574dc4,_0x59db53){return function(_0x21f42f){if(_0x21f42f){return _0x21f42f[_0xe327('0x24')]()[_0xe327('0x25')](function(){var _0x1b1814=_0x21f42f[_0xe327('0x26')]({'plain':!![]});var _0x5b2b60=[{'name':_0xe327('0x27'),'value':'inbound','ignore':![]},{'name':_0xe327('0x28'),'value':_0xe327('0x29'),'ignore':![]}];var _0x40553c=_(_0x5b2b60)[_0xe327('0x2a')](_0xe327('0x2b'))[_0xe327('0x2c')](_0xe327('0x2d'))[_0xe327('0x2d')]();if(_[_0xe327('0x2e')](_0x40553c,_0x1b1814[_0xe327('0x2f')])){return;}var _0x1d9610=_[_0xe327('0x30')](_0x5b2b60,['value',_0x1b1814[_0xe327('0x2f')]])[_0xe327('0x31')];return db[_0xe327('0x32')][_0xe327('0x24')]({'where':{'type':_0x1d9610,'resourceId':_0x1b1814['id']}})['then'](function(){return _0x21f42f;});})['then'](function(){_0x574dc4[_0xe327('0x19')](0xcc)[_0xe327('0x33')]();});}};}function handleEntityNotFound(_0x3bbed5,_0x3a7326){return function(_0x148930){if(!_0x148930){_0x3bbed5[_0xe327('0x18')](0x194);}return _0x148930;};}function handleError(_0x3e43f8,_0x47c0bd){_0x47c0bd=_0x47c0bd||0x1f4;return function(_0x4c309b){logger[_0xe327('0x34')](_0x4c309b[_0xe327('0x35')]);if(_0x4c309b[_0xe327('0x31')]){delete _0x4c309b['name'];}_0x3e43f8['status'](_0x47c0bd)['send'](_0x4c309b);};}exports[_0xe327('0x36')]=function(_0x44e4bb,_0x432455){var _0x58115f={},_0x5191f9={},_0x2a7fe6={'count':0x0,'rows':[]};var _0x216e96=_['map'](db[_0xe327('0x37')][_0xe327('0x38')],function(_0x503b78){return{'name':_0x503b78[_0xe327('0x39')],'type':_0x503b78[_0xe327('0x2f')][_0xe327('0x3a')]};});_0x5191f9[_0xe327('0x3b')]=_[_0xe327('0x2c')](_0x216e96,_0xe327('0x31'));_0x5191f9[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x44e4bb[_0xe327('0x3c')]);_0x5191f9['filters']=_['intersection'](_0x5191f9[_0xe327('0x3b')],_0x5191f9[_0xe327('0x3c')]);_0x58115f[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x5191f9[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x44e4bb[_0xe327('0x3c')][_0xe327('0x40')]));_0x58115f[_0xe327('0x3e')]=_0x58115f['attributes']['length']?_0x58115f[_0xe327('0x3e')]:_0x5191f9[_0xe327('0x3b')];if(!_0x44e4bb['query']['hasOwnProperty'](_0xe327('0x41'))){_0x58115f[_0xe327('0x1c')]=qs['limit'](_0x44e4bb[_0xe327('0x3c')][_0xe327('0x1c')]);_0x58115f['offset']=qs[_0xe327('0x1b')](_0x44e4bb[_0xe327('0x3c')][_0xe327('0x1b')]);}_0x58115f[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x44e4bb['query']['sort']);_0x58115f['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x44e4bb[_0xe327('0x3c')],_0x5191f9[_0xe327('0x44')]),_0x216e96);if(_0x44e4bb[_0xe327('0x3c')][_0xe327('0x2a')]){_0x58115f[_0xe327('0x46')]=_[_0xe327('0x47')](_0x58115f[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x216e96,function(_0x13010e){if(_0x13010e[_0xe327('0x2f')]!==_0xe327('0x48')){var _0x4777ef={};_0x4777ef[_0x13010e[_0xe327('0x31')]]={'$like':'%'+_0x44e4bb[_0xe327('0x3c')]['filter']+'%'};return _0x4777ef;}})});}_0x58115f=_[_0xe327('0x47')]({},_0x58115f,_0x44e4bb['options']);var _0x3ca252={'where':_0x58115f['where']};return db[_0xe327('0x37')][_0xe327('0x1e')](_0x3ca252)[_0xe327('0x25')](function(_0x3ac672){_0x2a7fe6[_0xe327('0x1e')]=_0x3ac672;if(_0x44e4bb[_0xe327('0x3c')][_0xe327('0x49')]){_0x58115f[_0xe327('0x4a')]=[{'all':!![]}];}return db['VoiceQueue'][_0xe327('0x4b')](_0x58115f);})['then'](function(_0x9611c3){_0x2a7fe6[_0xe327('0x4c')]=_0x9611c3;return _0x2a7fe6;})[_0xe327('0x25')](respondWithFilteredResult(_0x432455,_0x58115f))['catch'](handleError(_0x432455,null));};exports[_0xe327('0x4d')]=function(_0x828d8b,_0x323d03){var _0x3eea1e={'raw':![],'where':{'id':_0x828d8b[_0xe327('0x4e')]['id']}},_0x712e32={};_0x712e32[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x37')]['rawAttributes']);_0x712e32['query']=_[_0xe327('0x3d')](_0x828d8b['query']);_0x712e32['filters']=_[_0xe327('0x3f')](_0x712e32[_0xe327('0x3b')],_0x712e32[_0xe327('0x3c')]);_0x3eea1e[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x712e32[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x828d8b[_0xe327('0x3c')]['fields']));_0x3eea1e[_0xe327('0x3e')]=_0x3eea1e[_0xe327('0x3e')][_0xe327('0x4f')]?_0x3eea1e[_0xe327('0x3e')]:_0x712e32[_0xe327('0x3b')];if(_0x828d8b[_0xe327('0x3c')][_0xe327('0x49')]){_0x3eea1e[_0xe327('0x4a')]=[{'all':!![]}];}_0x3eea1e=_[_0xe327('0x47')]({},_0x3eea1e,_0x828d8b[_0xe327('0x50')]);return db[_0xe327('0x37')]['find'](_0x3eea1e)[_0xe327('0x25')](handleEntityNotFound(_0x323d03,null))[_0xe327('0x25')](respondWithResult(_0x323d03,null))[_0xe327('0x51')](handleError(_0x323d03,null));};exports['create']=function(_0x58e09a,_0x4b40d7){return db[_0xe327('0x37')][_0xe327('0x52')](_0x58e09a[_0xe327('0x53')],{})[_0xe327('0x25')](function(_0x481fe7){var _0xa31b45=_0x58e09a['user']['get']({'plain':!![]});if(!_0xa31b45)throw new Error(_0xe327('0x54'));if(_0xa31b45[_0xe327('0x55')]===_0xe327('0x56')){var _0x598c2b=_0x481fe7[_0xe327('0x26')]({'plain':!![]});var _0x28f240=[{'name':_0xe327('0x27'),'value':_0xe327('0x57')},{'name':_0xe327('0x28'),'value':_0xe327('0x29')}];var _0x33cfb6=_[_0xe327('0x30')](_0x28f240,[_0xe327('0x2d'),_0x598c2b[_0xe327('0x2f')]])[_0xe327('0x31')];return db[_0xe327('0x58')]['find']({'where':{'name':_0x33cfb6,'userProfileId':_0xa31b45[_0xe327('0x59')]},'raw':!![]})[_0xe327('0x25')](function(_0x2ac7bb){if(_0x2ac7bb&&_0x2ac7bb[_0xe327('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x598c2b['name'],'resourceId':_0x598c2b['id'],'type':_0x2ac7bb[_0xe327('0x31')],'sectionId':_0x2ac7bb['id']},{})[_0xe327('0x25')](function(){return _0x481fe7;});}else{return _0x481fe7;}})[_0xe327('0x51')](function(_0x316185){logger[_0xe327('0x34')](_0xe327('0x5b'),_0x316185);throw _0x316185;});}return _0x481fe7;})['then'](respondWithResult(_0x4b40d7,0xc9))['catch'](handleError(_0x4b40d7,null));};exports[_0xe327('0x5c')]=function(_0x1b1eb4,_0x35e5b4){var _0x4d412f={'where':{'id':_0x1b1eb4['params']['id']}},_0x52648c={};_0x52648c[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x37')]['rawAttributes']);_0x4d412f[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x52648c[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x1b1eb4[_0xe327('0x3c')]['fields']));_0x4d412f[_0xe327('0x3e')]=_0x4d412f[_0xe327('0x3e')][_0xe327('0x4f')]?_0x4d412f[_0xe327('0x3e')]:_0x52648c['model'];if(_0x1b1eb4[_0xe327('0x3c')][_0xe327('0x49')]){_0x4d412f[_0xe327('0x4a')]=[{'all':!![]}];}_0x4d412f=_['merge']({},_0x4d412f,_0x1b1eb4['options']);return db['VoiceQueue'][_0xe327('0x30')](_0x4d412f)[_0xe327('0x25')](handleEntityNotFound(_0x35e5b4,null))['then'](function(_0x44d623){if(_0x44d623){var _0x37e7c7=_0x44d623[_0xe327('0x26')]({'plain':!![]});_0x37e7c7=qs[_0xe327('0x5d')](_0x37e7c7,['id',_0xe327('0x5e'),'updatedAt']);_0x1b1eb4[_0xe327('0x53')]=_[_0xe327('0x5d')](_0x1b1eb4[_0xe327('0x53')],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0xe327('0x52')](_[_0xe327('0x47')](_0x37e7c7,_0x1b1eb4[_0xe327('0x53')]),{'include':_0x1b1eb4[_0xe327('0x3c')]['includeAll']?[{'all':!![]}]:undefined})[_0xe327('0x25')](function(_0x57b85f){var _0x56b660=_0x1b1eb4[_0xe327('0x56')]['get']({'plain':!![]});if(!_0x56b660)throw new Error(_0xe327('0x54'));if(_0x56b660['role']===_0xe327('0x56')){var _0x54ee88=_0x57b85f[_0xe327('0x26')]({'plain':!![]});var _0x1444c8=[{'name':'VoiceQueues','value':_0xe327('0x57')},{'name':_0xe327('0x28'),'value':'outbound'}];var _0x48afd7=_[_0xe327('0x30')](_0x1444c8,[_0xe327('0x2d'),_0x54ee88[_0xe327('0x2f')]])[_0xe327('0x31')];return db[_0xe327('0x58')][_0xe327('0x30')]({'where':{'name':_0x48afd7,'userProfileId':_0x56b660['userProfileId']},'raw':!![]})[_0xe327('0x25')](function(_0x179f52){if(_0x179f52&&_0x179f52['autoAssociation']===0x0){return db[_0xe327('0x32')][_0xe327('0x52')]({'name':_0x54ee88[_0xe327('0x31')],'resourceId':_0x54ee88['id'],'type':_0x179f52[_0xe327('0x31')],'sectionId':_0x179f52['id']},{})['then'](function(){return _0x57b85f;});}else{return _0x57b85f;}})[_0xe327('0x51')](function(_0x50dedd){logger['error'](_0xe327('0x5b'),_0x50dedd);throw _0x50dedd;});}return _0x57b85f;});}})[_0xe327('0x25')](respondWithResult(_0x35e5b4,0xc9))[_0xe327('0x51')](handleError(_0x35e5b4,null));};exports[_0xe327('0x5f')]=function(_0x3eaaa9,_0x40b806){if(_0x3eaaa9[_0xe327('0x53')]['id']){delete _0x3eaaa9[_0xe327('0x53')]['id'];}return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x3eaaa9[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x40b806,null))[_0xe327('0x25')](saveUpdates(_0x3eaaa9[_0xe327('0x53')],null))[_0xe327('0x25')](respondWithResult(_0x40b806,null))['catch'](handleError(_0x40b806,null));};exports[_0xe327('0x24')]=function(_0x44f347,_0x2b16e6){return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x44f347[_0xe327('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b16e6,null))['then'](removeEntity(_0x2b16e6,null))[_0xe327('0x51')](handleError(_0x2b16e6,null));};exports[_0xe327('0x60')]=function(_0x2fcef4,_0x55c446,_0x3dad20){var _0x435762={'raw':![],'where':{}};var _0x5dcb66={};var _0x41233f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe327('0x61')]({'where':{'id':_0x2fcef4['params']['id']}})['then'](handleEntityNotFound(_0x55c446,null))[_0xe327('0x25')](function(_0x5cc50b){if(_0x5cc50b){_0x5dcb66['model']=_[_0xe327('0x3d')](db['CmHopper'][_0xe327('0x38')]);_0x5dcb66[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x2fcef4[_0xe327('0x3c')]);_0x5dcb66[_0xe327('0x44')]=_['intersection'](_0x5dcb66[_0xe327('0x3b')],_0x5dcb66[_0xe327('0x3c')]);_0x435762[_0xe327('0x3e')]=_['intersection'](_0x5dcb66[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x2fcef4[_0xe327('0x3c')][_0xe327('0x40')]));_0x435762[_0xe327('0x3e')]=_0x435762[_0xe327('0x3e')][_0xe327('0x4f')]?_0x435762[_0xe327('0x3e')]:_0x5dcb66['model'];if(!_0x2fcef4['query'][_0xe327('0x62')](_0xe327('0x41'))){_0x435762[_0xe327('0x1c')]=qs['limit'](_0x2fcef4[_0xe327('0x3c')][_0xe327('0x1c')]);_0x435762[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x2fcef4[_0xe327('0x3c')]['offset']);}_0x435762['order']=qs['sort'](_0x2fcef4['query'][_0xe327('0x43')]);_0x435762['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x2fcef4[_0xe327('0x3c')],_0x5dcb66[_0xe327('0x44')]));_0x435762[_0xe327('0x46')]['VoiceQueueId']=_0x5cc50b['id'];if(_0x2fcef4[_0xe327('0x3c')][_0xe327('0x2a')]){_0x435762[_0xe327('0x46')]=_[_0xe327('0x47')](_0x435762['where'],{'$or':_[_0xe327('0x2c')](_0x435762[_0xe327('0x3e')],function(_0x12d492){var _0x350c06={};_0x350c06[_0x12d492]={'$like':'%'+_0x2fcef4[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0x350c06;})});}_0x435762=_[_0xe327('0x47')]({},_0x435762,_0x2fcef4[_0xe327('0x50')]);return db[_0xe327('0x63')][_0xe327('0x1e')]({'where':_0x435762[_0xe327('0x46')]})[_0xe327('0x25')](function(_0x45e1e8){_0x41233f[_0xe327('0x1e')]=_0x45e1e8;if(_0x2fcef4[_0xe327('0x3c')][_0xe327('0x49')]){_0x435762['include']=[{'all':!![]}];}return db[_0xe327('0x63')][_0xe327('0x4b')](_0x435762);})[_0xe327('0x25')](function(_0x539043){_0x41233f['rows']=_0x539043;return _0x41233f;});}})[_0xe327('0x25')](respondWithFilteredResult(_0x55c446,_0x435762))['catch'](handleError(_0x55c446,null));};exports[_0xe327('0x64')]=function(_0x2b4444,_0x18f45c,_0x343df5){var _0x8e33e3={'raw':!![],'where':{}};var _0x69d340={};var _0x10014f={'count':0x0,'rows':[]};return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x2b4444[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x18f45c,null))[_0xe327('0x25')](function(_0x390eff){if(_0x390eff){_0x69d340[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x65')]['rawAttributes']);_0x69d340[_0xe327('0x3c')]=_['keys'](_0x2b4444['query']);_0x69d340[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x69d340[_0xe327('0x3b')],_0x69d340[_0xe327('0x3c')]);_0x8e33e3[_0xe327('0x3e')]=_['intersection'](_0x69d340[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x2b4444['query']['fields']));_0x8e33e3[_0xe327('0x3e')]=_0x8e33e3[_0xe327('0x3e')]['length']?_0x8e33e3[_0xe327('0x3e')]:_0x69d340['model'];if(!_0x2b4444[_0xe327('0x3c')]['hasOwnProperty']('nolimit')){_0x8e33e3[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x2b4444[_0xe327('0x3c')][_0xe327('0x1c')]);_0x8e33e3[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x2b4444['query'][_0xe327('0x1b')]);}_0x8e33e3[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x2b4444[_0xe327('0x3c')][_0xe327('0x43')]);_0x8e33e3[_0xe327('0x46')]=qs[_0xe327('0x44')](_['pick'](_0x2b4444['query'],_0x69d340[_0xe327('0x44')]));_0x8e33e3['where'][_0xe327('0x66')]=_0x390eff['id'];if(_0x2b4444[_0xe327('0x3c')][_0xe327('0x2a')]){_0x8e33e3['where']=_['merge'](_0x8e33e3['where'],{'$or':_[_0xe327('0x2c')](_0x8e33e3[_0xe327('0x3e')],function(_0x33e967){var _0x253f4f={};_0x253f4f[_0x33e967]={'$like':'%'+_0x2b4444['query'][_0xe327('0x2a')]+'%'};return _0x253f4f;})});}_0x8e33e3=_[_0xe327('0x47')]({},_0x8e33e3,_0x2b4444['options']);return db['CmHopperHistory'][_0xe327('0x1e')]({'where':_0x8e33e3[_0xe327('0x46')]})[_0xe327('0x25')](function(_0x599a51){_0x10014f[_0xe327('0x1e')]=_0x599a51;if(_0x2b4444[_0xe327('0x3c')][_0xe327('0x49')]){_0x8e33e3[_0xe327('0x4a')]=[{'all':!![]}];}return db[_0xe327('0x65')][_0xe327('0x4b')](_0x8e33e3);})[_0xe327('0x25')](function(_0x3f365d){_0x10014f[_0xe327('0x4c')]=_0x3f365d;return _0x10014f;});}})['then'](respondWithFilteredResult(_0x18f45c,_0x8e33e3))[_0xe327('0x51')](handleError(_0x18f45c,null));};exports[_0xe327('0x67')]=function(_0x51889f,_0x57b89b,_0x38efea){var _0x334485={'raw':!![],'where':{}};var _0x45906e={};var _0x35772d={'count':0x0,'rows':[]};return db[_0xe327('0x37')]['findOne']({'where':{'id':_0x51889f[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x57b89b,null))['then'](function(_0x5ec02d){if(_0x5ec02d){_0x45906e[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x68')][_0xe327('0x38')]);_0x45906e[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x51889f[_0xe327('0x3c')]);_0x45906e[_0xe327('0x44')]=_['intersection'](_0x45906e[_0xe327('0x3b')],_0x45906e[_0xe327('0x3c')]);_0x334485[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x45906e['model'],qs[_0xe327('0x40')](_0x51889f[_0xe327('0x3c')][_0xe327('0x40')]));_0x334485[_0xe327('0x3e')]=_0x334485[_0xe327('0x3e')][_0xe327('0x4f')]?_0x334485[_0xe327('0x3e')]:_0x45906e[_0xe327('0x3b')];if(!_0x51889f[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x334485[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x51889f[_0xe327('0x3c')][_0xe327('0x1c')]);_0x334485['offset']=qs[_0xe327('0x1b')](_0x51889f['query'][_0xe327('0x1b')]);}_0x334485[_0xe327('0x42')]=qs['sort'](_0x51889f[_0xe327('0x3c')]['sort']);_0x334485[_0xe327('0x46')]=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x51889f[_0xe327('0x3c')],_0x45906e['filters']));_0x334485[_0xe327('0x46')][_0xe327('0x66')]=_0x5ec02d['id'];if(_0x51889f['query'][_0xe327('0x2a')]){_0x334485[_0xe327('0x46')]=_[_0xe327('0x47')](_0x334485[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x334485[_0xe327('0x3e')],function(_0x15d27b){var _0x4e400d={};_0x4e400d[_0x15d27b]={'$like':'%'+_0x51889f['query']['filter']+'%'};return _0x4e400d;})});}_0x334485=_[_0xe327('0x47')]({},_0x334485,_0x51889f[_0xe327('0x50')]);return db[_0xe327('0x68')][_0xe327('0x1e')]({'where':_0x334485['where']})[_0xe327('0x25')](function(_0x4449da){_0x35772d[_0xe327('0x1e')]=_0x4449da;if(_0x51889f[_0xe327('0x3c')][_0xe327('0x49')]){_0x334485[_0xe327('0x4a')]=[{'all':!![]}];}return db[_0xe327('0x68')]['findAll'](_0x334485);})['then'](function(_0x234158){_0x35772d[_0xe327('0x4c')]=_0x234158;return _0x35772d;});}})[_0xe327('0x25')](respondWithFilteredResult(_0x57b89b,_0x334485))[_0xe327('0x51')](handleError(_0x57b89b,null));};exports[_0xe327('0x69')]=function(_0x3647fd,_0x8b0fe0,_0x234edf){var _0xe4bce9={'raw':!![],'where':{}};var _0x44e320={};var _0x1853cc={'count':0x0,'rows':[]};return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x3647fd[_0xe327('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8b0fe0,null))[_0xe327('0x25')](function(_0x3fb246){if(_0x3fb246){_0x44e320[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x6a')]['rawAttributes']);_0x44e320[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x3647fd[_0xe327('0x3c')]);_0x44e320[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x44e320[_0xe327('0x3b')],_0x44e320['query']);_0xe4bce9[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x44e320['model'],qs[_0xe327('0x40')](_0x3647fd[_0xe327('0x3c')]['fields']));_0xe4bce9[_0xe327('0x3e')]=_0xe4bce9['attributes'][_0xe327('0x4f')]?_0xe4bce9[_0xe327('0x3e')]:_0x44e320[_0xe327('0x3b')];if(!_0x3647fd[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0xe4bce9[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x3647fd[_0xe327('0x3c')][_0xe327('0x1c')]);_0xe4bce9[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x3647fd['query'][_0xe327('0x1b')]);}_0xe4bce9[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x3647fd['query'][_0xe327('0x43')]);_0xe4bce9[_0xe327('0x46')]=qs['filters'](_[_0xe327('0x45')](_0x3647fd[_0xe327('0x3c')],_0x44e320[_0xe327('0x44')]));_0xe4bce9['where'][_0xe327('0x66')]=_0x3fb246['id'];if(_0x3647fd[_0xe327('0x3c')][_0xe327('0x2a')]){_0xe4bce9[_0xe327('0x46')]=_['merge'](_0xe4bce9['where'],{'$or':_['map'](_0xe4bce9[_0xe327('0x3e')],function(_0x5737e4){var _0x3b6292={};_0x3b6292[_0x5737e4]={'$like':'%'+_0x3647fd['query'][_0xe327('0x2a')]+'%'};return _0x3b6292;})});}_0xe4bce9=_[_0xe327('0x47')]({},_0xe4bce9,_0x3647fd['options']);return db[_0xe327('0x6a')]['count']({'where':_0xe4bce9['where']})[_0xe327('0x25')](function(_0x39e08e){_0x1853cc[_0xe327('0x1e')]=_0x39e08e;if(_0x3647fd[_0xe327('0x3c')][_0xe327('0x49')]){_0xe4bce9[_0xe327('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0xe4bce9);})['then'](function(_0x1d0cdd){_0x1853cc[_0xe327('0x4c')]=_0x1d0cdd;return _0x1853cc;});}})[_0xe327('0x25')](respondWithFilteredResult(_0x8b0fe0,_0xe4bce9))['catch'](handleError(_0x8b0fe0,null));};exports[_0xe327('0x6b')]=function(_0x496433,_0x36b528,_0x2bc44a){var _0xd6758={};var _0x3c92cc={};var _0x2a3fec;var _0x2d43b1;return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x496433['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x36b528,null))[_0xe327('0x25')](function(_0x5302e8){if(_0x5302e8){_0x2a3fec=_0x5302e8;_0x3c92cc[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x6c')][_0xe327('0x38')]);_0x3c92cc[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x496433[_0xe327('0x3c')]);_0x3c92cc['filters']=_[_0xe327('0x3f')](_0x3c92cc['model'],_0x3c92cc[_0xe327('0x3c')]);_0xd6758['attributes']=_['intersection'](_0x3c92cc[_0xe327('0x3b')],qs['fields'](_0x496433[_0xe327('0x3c')]['fields']));_0xd6758[_0xe327('0x3e')]=_0xd6758['attributes'][_0xe327('0x4f')]?_0xd6758['attributes']:_0x3c92cc[_0xe327('0x3b')];_0xd6758[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x496433[_0xe327('0x3c')][_0xe327('0x43')]);_0xd6758['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x496433['query'],_0x3c92cc['filters']));if(_0x496433[_0xe327('0x3c')][_0xe327('0x2a')]){_0xd6758['where']=_[_0xe327('0x47')](_0xd6758[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0xd6758['attributes'],function(_0x47c331){var _0xb681ff={};_0xb681ff[_0x47c331]={'$like':'%'+_0x496433[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0xb681ff;})});}_0xd6758=_['merge']({},_0xd6758,_0x496433[_0xe327('0x50')]);return _0x2a3fec[_0xe327('0x6b')](_0xd6758);}})[_0xe327('0x25')](function(_0x48e000){if(_0x48e000){_0x2d43b1=_0x48e000[_0xe327('0x4f')];if(!_0x496433[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0xd6758[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x496433[_0xe327('0x3c')]['limit']);_0xd6758['offset']=qs[_0xe327('0x1b')](_0x496433[_0xe327('0x3c')]['offset']);}return _0x2a3fec['getTeams'](_0xd6758);}})[_0xe327('0x25')](function(_0x50fab1){if(_0x50fab1){return _0x50fab1?{'count':_0x2d43b1,'rows':_0x50fab1}:null;}})[_0xe327('0x25')](respondWithResult(_0x36b528,null))[_0xe327('0x51')](handleError(_0x36b528,null));};exports[_0xe327('0x6d')]=function(_0x1920bb,_0x181833,_0x3e8b0f){var _0x411941=_0x1920bb[_0xe327('0x53')][_0xe327('0x6e')];var _0x2b1fa3=_[_0xe327('0x2c')](_0x411941,'id');return db[_0xe327('0x6c')][_0xe327('0x4b')]({'where':{'id':_0x2b1fa3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xe327('0x6f'),'voicePause',_0xe327('0x70')],'raw':!![]}]})['then'](function(_0x1bf5a2){if(_0x1bf5a2){var _0xb13756=_['flatMap'](_0x1bf5a2,function(_0x175c3a){var _0x2fee28=_0x175c3a[_0xe327('0x26')]({'plain':!![]});_0x2fee28[_0xe327('0x71')][_0xe327('0x72')](function(_0xb94552){_0xb94552[_0xe327('0x73')]=_[_0xe327('0x30')](_0x411941,{'id':_0x2fee28['id']})[_0xe327('0x73')];});return _0x2fee28[_0xe327('0x71')];});return db['VoiceQueue'][_0xe327('0x30')]({'where':{'id':_0x1920bb[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](function(_0x394303){return db[_0xe327('0x74')][_0xe327('0x75')](function(_0x5265e6){return _0x394303[_0xe327('0x6d')](_0x2b1fa3,{'transaction':_0x5265e6})[_0xe327('0x25')](function(){return BPromise[_0xe327('0x76')](_0x411941,function(_0x7e67b9){return db[_0xe327('0x77')]['upsert']({'TeamId':_0x7e67b9['id'],'VoiceQueueId':_0x1920bb['params']['id'],'penalty':_0x7e67b9[_0xe327('0x73')]},{'transaction':_0x5265e6});});})[_0xe327('0x25')](function(){return BPromise['each'](_0xb13756,function(_0x499738){return db[_0xe327('0x78')][_0xe327('0x79')]({'where':{'UserId':_0x499738['id'],'VoiceQueueId':_0x1920bb[_0xe327('0x4e')]['id']},'defaults':{'penalty':_0x499738[_0xe327('0x73')]},'transaction':_0x5265e6});});})[_0xe327('0x25')](function(){return BPromise[_0xe327('0x76')](_[_0xe327('0x2a')](_0xb13756,{'online':!![]}),function(_0xad7f44){return db[_0xe327('0x7a')][_0xe327('0x7b')]({'membername':_0xad7f44[_0xe327('0x31')],'UserId':_0xad7f44['id'],'queue_name':_0x394303[_0xe327('0x31')],'VoiceQueueId':_0x394303['id'],'interface':_[_0xe327('0x7c')](_0xad7f44[_0xe327('0x70')])?util[_0xe327('0x7d')](_0xe327('0x7e'),_0xad7f44[_0xe327('0x31')]):_0xad7f44[_0xe327('0x70')],'paused':_0xad7f44[_0xe327('0x7f')]||![],'penalty':_0xad7f44['penalty']},{'transaction':_0x5265e6});});})['then'](function(){_0xb13756['forEach'](function(_0x3829c){socket[_0xe327('0x80')](_0xe327('0x81'),{'UserId':_0x3829c['id'],'VoiceQueueId':_0x394303['id']});});});});});}})[_0xe327('0x25')](respondWithStatusCode(_0x181833,null))[_0xe327('0x51')](handleError(_0x181833,null));};exports['removeTeams']=function(_0x42fae2,_0x3371f3,_0x835eeb){return db['Team'][_0xe327('0x4b')]({'where':{'id':_0x42fae2[_0xe327('0x3c')][_0xe327('0x82')]},'attributes':['id'],'include':[{'model':db[_0xe327('0x83')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe327('0x25')](handleEntityNotFound(_0x3371f3,null))[_0xe327('0x25')](function(_0x404a57){var _0x101d1c=_['map'](_0x404a57,'id');var _0x463b90=[];var _0x5b2b35=[];var _0x2a38c1=squel[_0xe327('0x84')]();_0x2a38c1[_0xe327('0x85')](_0xe327('0x86'))[_0xe327('0x87')](_0xe327('0x88'),'tq')[_0xe327('0x89')](_0xe327('0x8a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe327('0x46')]('VoiceQueueId\x20=\x20?',_0x42fae2[_0xe327('0x4e')]['id']);for(var _0x34394b=0x0;_0x34394b<_0x404a57[_0xe327('0x4f')];_0x34394b+=0x1){let _0x231342=_0x404a57[_0x34394b];for(var _0x5310e6=0x0;_0x5310e6<_0x231342[_0xe327('0x71')][_0xe327('0x4f')];_0x5310e6+=0x1){let _0x281593=_0x231342['Agents'][_0x5310e6];var _0x2140f0=_0x2a38c1['clone']();_0x2140f0[_0xe327('0x46')](_0xe327('0x8b'),_0x281593['id']);_0x5b2b35[_0xe327('0x8c')](db[_0xe327('0x74')]['query'](_0x2140f0[_0xe327('0x8d')](),{'type':db[_0xe327('0x74')][_0xe327('0x8e')][_0xe327('0x8f')]})[_0xe327('0x25')](function(_0x39532b){if(_0x39532b[_0xe327('0x4f')]===0x1){return _0x281593['id'];}else{var _0x205aa7=_[_0xe327('0x90')](_[_0xe327('0x2c')](_0x39532b,'TeamId'),function(_0x238b9a){return _[_0xe327('0x2e')](_0x101d1c,_0x238b9a);});if(_0x205aa7){return _0x281593['id'];}}}));}}return BPromise['all'](_0x5b2b35)[_0xe327('0x25')](function(_0x8bec73){_0x463b90=_(_0x463b90)[_0xe327('0x91')](_0x8bec73)[_0xe327('0x92')]()['value']();return db[_0xe327('0x37')]['find']({'where':{'id':_0x42fae2[_0xe327('0x4e')]['id']}})['then'](function(_0x5b4b06){return db[_0xe327('0x74')][_0xe327('0x75')](function(_0x352cea){return _0x5b4b06[_0xe327('0x93')](_0x42fae2['query']['ids'],{'transaction':_0x352cea})[_0xe327('0x25')](function(){if(!_['isEmpty'](_0x463b90)){return _0x5b4b06[_0xe327('0x94')](_0x463b90,{'transaction':_0x352cea})[_0xe327('0x25')](function(){return db['UserVoiceQueueRt'][_0xe327('0x24')]({'where':{'VoiceQueueId':_0x42fae2['params']['id'],'UserId':_0x463b90},'transaction':_0x352cea});});}})[_0xe327('0x25')](function(){_0x463b90['forEach'](function(_0xd87bd4){socket[_0xe327('0x80')](_0xe327('0x95'),{'UserId':_0xd87bd4,'VoiceQueueId':_0x5b4b06['id']});});});});});});})[_0xe327('0x25')](respondWithStatusCode(_0x3371f3,null))[_0xe327('0x51')](handleError(_0x3371f3,null));};exports[_0xe327('0x96')]=function(_0x30efd4,_0xd44d6f,_0x4508f6){var _0x10465f,_0x3bc15c;return db[_0xe327('0x37')]['find']({'where':{'id':_0x30efd4['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0xd44d6f,null))[_0xe327('0x25')](function(_0x569d5a){if(_0x569d5a){_0x3bc15c=_0x569d5a;return _0x569d5a[_0xe327('0x96')](_0x30efd4[_0xe327('0x53')]['ids'],_[_0xe327('0x5d')](_0x30efd4[_0xe327('0x53')],[_0xe327('0x82'),'id'])||{})[_0xe327('0x97')](function(_0x21a23e){for(var _0x3eb144=0x0;_0x3eb144<_0x30efd4[_0xe327('0x53')][_0xe327('0x82')][_0xe327('0x4f')];_0x3eb144+=0x1){socket[_0xe327('0x80')](_0xe327('0x81'),{'UserId':Number(_0x30efd4[_0xe327('0x53')][_0xe327('0x82')][_0x3eb144]),'VoiceQueueId':Number(_0x30efd4[_0xe327('0x4e')]['id'])});}return _0x21a23e;});}})['then'](function(_0x42e3c){_0x10465f=_0x42e3c||[];if(_0x3bc15c){return db[_0xe327('0x83')][_0xe327('0x4b')]({'where':{'id':_0x30efd4[_0xe327('0x53')][_0xe327('0x82')]},'attributes':['id','name','online',_0xe327('0x7f'),'interface'],'raw':!![]});}})[_0xe327('0x25')](function(_0x6d0f35){if(!_[_0xe327('0x98')](_0x6d0f35)){var _0xb18bd4=[];for(var _0xf49c1a=0x0;_0xf49c1a<_0x6d0f35[_0xe327('0x4f')];_0xf49c1a++){if(_0x6d0f35[_0xf49c1a][_0xe327('0x6f')]){_0xb18bd4[_0xe327('0x8c')](db[_0xe327('0x7a')][_0xe327('0x7b')]({'membername':_0x6d0f35[_0xf49c1a]['name'],'UserId':_0x6d0f35[_0xf49c1a]['id'],'queue_name':_0x3bc15c[_0xe327('0x31')],'VoiceQueueId':_0x3bc15c['id'],'interface':_[_0xe327('0x7c')](_0x6d0f35[_0xf49c1a][_0xe327('0x70')])?util['format'](_0xe327('0x7e'),_0x6d0f35[_0xf49c1a][_0xe327('0x31')]):_0x6d0f35[_0xf49c1a]['interface'],'paused':_0x6d0f35[_0xf49c1a][_0xe327('0x7f')]||![],'penalty':_0x30efd4['body'][_0xe327('0x73')]||0x0}));}}return BPromise[_0xe327('0x99')](_0xb18bd4);}})[_0xe327('0x25')](function(){return _0x10465f;})[_0xe327('0x25')](respondWithResult(_0xd44d6f,null))[_0xe327('0x51')](handleError(_0xd44d6f,null));};exports[_0xe327('0x94')]=function(_0x2d1219,_0x5d8d86,_0x55bdf8){return db[_0xe327('0x37')]['find']({'where':{'id':_0x2d1219[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x5d8d86,null))[_0xe327('0x25')](function(_0x12b64a){if(_0x12b64a){return _0x12b64a['removeAgents'](_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')])['then'](function(){if(_['isArray'](_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')])){for(var _0x219695=0x0;_0x219695<_0x2d1219['query'][_0xe327('0x82')][_0xe327('0x4f')];_0x219695+=0x1){socket[_0xe327('0x80')](_0xe327('0x95'),{'UserId':Number(_0x2d1219[_0xe327('0x3c')]['ids'][_0x219695]),'VoiceQueueId':Number(_0x2d1219[_0xe327('0x4e')]['id'])});}}else{socket['emit'](_0xe327('0x95'),{'UserId':Number(_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')]),'VoiceQueueId':Number(_0x2d1219[_0xe327('0x4e')]['id'])});}});}})['then'](function(_0x50f598){return db[_0xe327('0x7a')][_0xe327('0x24')]({'where':{'VoiceQueueId':_0x2d1219[_0xe327('0x4e')]['id'],'UserId':_0x2d1219[_0xe327('0x3c')][_0xe327('0x82')]}})[_0xe327('0x25')](function(){return _0x50f598;});})[_0xe327('0x25')](respondWithStatusCode(_0x5d8d86,null))['catch'](handleError(_0x5d8d86,null));};exports[_0xe327('0x9a')]=function(_0x499a7c,_0xbe0d6d,_0x119cce){var _0x5cc021={};var _0x5281a9={};var _0xa21523;var _0x4420bc;return db[_0xe327('0x37')]['findOne']({'where':{'id':_0x499a7c['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0xbe0d6d,null))[_0xe327('0x25')](function(_0xfe6445){if(_0xfe6445){_0xa21523=_0xfe6445;_0x5281a9[_0xe327('0x3b')]=_[_0xe327('0x3d')](db['User']['rawAttributes']);_0x5281a9[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0x499a7c[_0xe327('0x3c')]);_0x5281a9[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x5281a9[_0xe327('0x3b')],_0x5281a9['query']);_0x5cc021[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x5281a9['model'],qs[_0xe327('0x40')](_0x499a7c['query']['fields']));_0x5cc021['attributes']=_0x5cc021[_0xe327('0x3e')]['length']?_0x5cc021[_0xe327('0x3e')]:_0x5281a9[_0xe327('0x3b')];_0x5cc021[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x499a7c[_0xe327('0x3c')][_0xe327('0x43')]);_0x5cc021['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x499a7c[_0xe327('0x3c')],_0x5281a9[_0xe327('0x44')]));if(_0x499a7c[_0xe327('0x3c')]['filter']){_0x5cc021[_0xe327('0x46')]=_[_0xe327('0x47')](_0x5cc021[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x5cc021[_0xe327('0x3e')],function(_0x23b986){var _0x547e0e={};_0x547e0e[_0x23b986]={'$like':'%'+_0x499a7c[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0x547e0e;})});}_0x5cc021=_[_0xe327('0x47')]({},_0x5cc021,_0x499a7c[_0xe327('0x50')]);return _0xa21523['getAgents'](_0x5cc021);}})[_0xe327('0x25')](function(_0x3c7c45){if(_0x3c7c45){_0x4420bc=_0x3c7c45[_0xe327('0x4f')];if(!_0x499a7c[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x5cc021[_0xe327('0x1c')]=qs['limit'](_0x499a7c[_0xe327('0x3c')][_0xe327('0x1c')]);_0x5cc021['offset']=qs[_0xe327('0x1b')](_0x499a7c['query'][_0xe327('0x1b')]);}return _0xa21523[_0xe327('0x9a')](_0x5cc021);}})[_0xe327('0x25')](function(_0x1d8740){if(_0x1d8740){return _0x1d8740?{'count':_0x4420bc,'rows':_0x1d8740}:null;}})['then'](respondWithResult(_0xbe0d6d,null))['catch'](handleError(_0xbe0d6d,null));};exports[_0xe327('0x9b')]=function(_0x1de0bf,_0x16573a,_0x457201){var _0x1fa85a={};var _0x57452c={};var _0x2a1915;var _0x39b13d;return db['VoiceQueue'][_0xe327('0x61')]({'where':{'id':_0x1de0bf[_0xe327('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16573a,null))[_0xe327('0x25')](function(_0xed87f8){if(_0xed87f8){_0x2a1915=_0xed87f8;_0x57452c['model']=_[_0xe327('0x3d')](db[_0xe327('0x7a')][_0xe327('0x38')]);_0x57452c['query']=_[_0xe327('0x3d')](_0x1de0bf[_0xe327('0x3c')]);_0x57452c[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x57452c[_0xe327('0x3b')],_0x57452c[_0xe327('0x3c')]);_0x1fa85a[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x57452c[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x1de0bf[_0xe327('0x3c')][_0xe327('0x40')]));_0x1fa85a[_0xe327('0x3e')]=_0x1fa85a[_0xe327('0x3e')][_0xe327('0x4f')]?_0x1fa85a['attributes']:_0x57452c[_0xe327('0x3b')];_0x1fa85a[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x1de0bf[_0xe327('0x3c')][_0xe327('0x43')]);_0x1fa85a['where']=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x1de0bf[_0xe327('0x3c')],_0x57452c[_0xe327('0x44')]));if(_0x1de0bf[_0xe327('0x3c')][_0xe327('0x2a')]){_0x1fa85a[_0xe327('0x46')]=_['merge'](_0x1fa85a[_0xe327('0x46')],{'$or':_['map'](_0x1fa85a['attributes'],function(_0xda285e){var _0x1e58b6={};_0x1e58b6[_0xda285e]={'$like':'%'+_0x1de0bf[_0xe327('0x3c')][_0xe327('0x2a')]+'%'};return _0x1e58b6;})});}_0x1fa85a=_[_0xe327('0x47')]({},_0x1fa85a,_0x1de0bf[_0xe327('0x50')]);return _0x2a1915[_0xe327('0x9b')](_0x1fa85a);}})[_0xe327('0x25')](function(_0x22396c){if(_0x22396c){_0x39b13d=_0x22396c[_0xe327('0x4f')];if(!_0x1de0bf[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x1fa85a[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x1de0bf[_0xe327('0x3c')][_0xe327('0x1c')]);_0x1fa85a[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x1de0bf['query'][_0xe327('0x1b')]);}return _0x2a1915[_0xe327('0x9b')](_0x1fa85a);}})[_0xe327('0x25')](function(_0x4383fd){return _0x4383fd?{'count':_0x39b13d,'rows':_0x4383fd}:null;})['then'](respondWithResult(_0x16573a,null))[_0xe327('0x51')](handleError(_0x16573a,null));};exports[_0xe327('0x9c')]=function(_0x51dd4d,_0x3fa518,_0x46b921){var _0x37b6ae={};var _0x1b2817={};var _0x7fbfe6;var _0x4d0b24;return db[_0xe327('0x37')][_0xe327('0x61')]({'where':{'id':_0x51dd4d['params']['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x3fa518,null))['then'](function(_0x22f981){if(_0x22f981){_0x7fbfe6=_0x22f981;_0x1b2817[_0xe327('0x3b')]=_['keys'](db[_0xe327('0x9d')][_0xe327('0x38')]);_0x1b2817['query']=_[_0xe327('0x3d')](_0x51dd4d[_0xe327('0x3c')]);_0x1b2817[_0xe327('0x44')]=_['intersection'](_0x1b2817[_0xe327('0x3b')],_0x1b2817[_0xe327('0x3c')]);_0x37b6ae[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x1b2817[_0xe327('0x3b')],qs[_0xe327('0x40')](_0x51dd4d[_0xe327('0x3c')][_0xe327('0x40')]));_0x37b6ae[_0xe327('0x3e')]=_0x37b6ae[_0xe327('0x3e')]['length']?_0x37b6ae[_0xe327('0x3e')]:_0x1b2817[_0xe327('0x3b')];_0x37b6ae[_0xe327('0x42')]=qs[_0xe327('0x43')](_0x51dd4d['query']['sort']);_0x37b6ae[_0xe327('0x46')]=qs[_0xe327('0x44')](_[_0xe327('0x45')](_0x51dd4d[_0xe327('0x3c')],_0x1b2817['filters']));if(_0x51dd4d['query'][_0xe327('0x2a')]){_0x37b6ae[_0xe327('0x46')]=_['merge'](_0x37b6ae['where'],{'$or':_[_0xe327('0x2c')](_0x37b6ae[_0xe327('0x3e')],function(_0x204ee5){var _0x29b7bb={};_0x29b7bb[_0x204ee5]={'$like':'%'+_0x51dd4d[_0xe327('0x3c')]['filter']+'%'};return _0x29b7bb;})});}_0x37b6ae=_[_0xe327('0x47')]({},_0x37b6ae,_0x51dd4d[_0xe327('0x50')]);return _0x7fbfe6['getLists'](_0x37b6ae);}})[_0xe327('0x25')](function(_0x1a33b0){if(_0x1a33b0){_0x4d0b24=_0x1a33b0[_0xe327('0x4f')];if(!_0x51dd4d[_0xe327('0x3c')]['hasOwnProperty'](_0xe327('0x41'))){_0x37b6ae[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0x51dd4d[_0xe327('0x3c')]['limit']);_0x37b6ae[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0x51dd4d['query'][_0xe327('0x1b')]);}return _0x7fbfe6[_0xe327('0x9c')](_0x37b6ae);}})[_0xe327('0x25')](function(_0x389649){if(_0x389649){return _0x389649?{'count':_0x4d0b24,'rows':_0x389649}:null;}})[_0xe327('0x25')](respondWithResult(_0x3fa518,null))[_0xe327('0x51')](handleError(_0x3fa518,null));};exports[_0xe327('0x9e')]=function(_0x183f31,_0x1d7682,_0x1ca2ba){var _0x57c53b,_0x525110;return db['VoiceQueue'][_0xe327('0x30')]({'where':{'id':_0x183f31[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x1d7682,null))['then'](function(_0x20ecc2){if(_0x20ecc2){_0x525110=_0x20ecc2;return _0x20ecc2[_0xe327('0x9e')](_0x183f31[_0xe327('0x53')]['ids'],_[_0xe327('0x5d')](_0x183f31[_0xe327('0x53')],[_0xe327('0x82'),'id'])||{});}return null;})['spread'](function(_0x16193b){var _0x17ab4c;_0x57c53b=_0x16193b||[];var _0x3b1d23=[];if(_0x16193b){for(var _0x1c467b=0x0;_0x1c467b<_0x16193b[_0xe327('0x4f')];_0x1c467b+=0x1){var _0xce85c3=_0x16193b[_0x1c467b][_0xe327('0x26')]({'plain':!![]});_0x525110[_0xe327('0x9f')]=_0x183f31[_0xe327('0x53')][_0xe327('0x9f')]?_0x183f31['body'][_0xe327('0x9f')]:_0x525110[_0xe327('0x9f')];switch(_0x525110[_0xe327('0x9f')]){case _0xe327('0xa0'):_0x17ab4c=squel[_0xe327('0xa1')]()[_0xe327('0xa2')]('cm_hopper')[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa5'),_0xe327('0xa6'),_0xe327('0xa7'),_0xe327('0x66'),'createdAt',_0xe327('0xa8')],squel[_0xe327('0x84')]()[_0xe327('0x85')](_0xe327('0xa4'),_0xe327('0xa4'))['field'](_0xe327('0xa9'),_0xe327('0xa5'))['field']('id',_0xe327('0xa6'))[_0xe327('0x85')](_0xce85c3[_0xe327('0xaa')][_0xe327('0x8d')](),_0xe327('0xa7'))['field'](_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),_0xe327('0x66'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0x5e'))[_0xe327('0x85')]('NOW()',_0xe327('0xa8'))['from'](_0xe327('0xab'))[_0xe327('0x46')](_0xe327('0xac'))['where'](_0xe327('0xad'),_0xce85c3[_0xe327('0xaa')]['toString']())[_0xe327('0x46')](_0xe327('0xae'))[_0xe327('0x46')](_0xe327('0xaf'),squel['select']()[_0xe327('0x85')](_0xe327('0xb0'))['from'](_0xe327('0xb1'))['where'](_0xe327('0xb2'),_0x183f31['params']['id'][_0xe327('0x8d')]()))[_0xe327('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe327('0x84')]()['field'](_0xe327('0xb3'))[_0xe327('0x87')](_0xe327('0xb4'))[_0xe327('0x46')](_0xe327('0xb2'),_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')]())))[_0xe327('0x8d')]();break;case _0xe327('0xb5'):_0x17ab4c=squel['insert']()[_0xe327('0xa2')]('cm_hopper')[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa5'),_0xe327('0xa6'),_0xe327('0xa7'),_0xe327('0x66'),_0xe327('0x5e'),_0xe327('0xa8')],squel[_0xe327('0x84')]()[_0xe327('0x85')](_0xe327('0xa4'),_0xe327('0xa4'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0xa5'))[_0xe327('0x85')]('id',_0xe327('0xa6'))['field'](_0xce85c3['CmListId'][_0xe327('0x8d')](),_0xe327('0xa7'))[_0xe327('0x85')](_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),_0xe327('0x66'))[_0xe327('0x85')](_0xe327('0xa9'),'createdAt')[_0xe327('0x85')]('NOW()',_0xe327('0xa8'))[_0xe327('0x87')](_0xe327('0xab'))[_0xe327('0x46')](_0xe327('0xac'))['where'](_0xe327('0xad'),_0xce85c3['CmListId']['toString']())['where'](_0xe327('0xae'))['where'](_0xe327('0xaf'),squel[_0xe327('0x84')]()[_0xe327('0x85')]('COALESCE(phone,\x27\x27)')[_0xe327('0x87')](_0xe327('0xb4'))[_0xe327('0x46')](_0xe327('0xb2'),_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')]())))['toString']();break;default:_0x17ab4c=squel[_0xe327('0xa1')]()[_0xe327('0xa2')](_0xe327('0xb4'))[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa5'),_0xe327('0xa6'),_0xe327('0xa7'),_0xe327('0x66'),_0xe327('0x5e'),'updatedAt'],squel[_0xe327('0x84')]()[_0xe327('0x85')]('phone',_0xe327('0xa4'))['field'](_0xe327('0xa9'),_0xe327('0xa5'))[_0xe327('0x85')]('id','ContactId')[_0xe327('0x85')](_0xce85c3[_0xe327('0xaa')][_0xe327('0x8d')](),'ListId')['field'](_0x183f31[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),'VoiceQueueId')[_0xe327('0x85')]('NOW()',_0xe327('0x5e'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0xa8'))['from'](_0xe327('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0xe327('0x46')]('ListId\x20=\x20?',_0xce85c3['CmListId'][_0xe327('0x8d')]())[_0xe327('0x46')](_0xe327('0xae')))[_0xe327('0x8d')]();}_0x3b1d23[_0xe327('0x8c')](db[_0xe327('0x74')]['query'](_0x17ab4c));}return BPromise[_0xe327('0x99')](_0x3b1d23);}})['then'](function(){return _0x57c53b;})[_0xe327('0x25')](respondWithResult(_0x1d7682,null))[_0xe327('0x51')](handleError(_0x1d7682,null));};exports['removeLists']=function(_0x366a69,_0x68138e,_0x3670ad){return db['VoiceQueue'][_0xe327('0x30')]({'where':{'id':_0x366a69[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x68138e,null))['then'](function(_0x212e81){if(_0x212e81){return _0x212e81[_0xe327('0xb6')](_0x366a69[_0xe327('0x3c')][_0xe327('0x82')]);}})[_0xe327('0x25')](function(_0xd2cb08){if(_0xd2cb08){return db[_0xe327('0x63')][_0xe327('0x24')]({'where':{'ListId':_0x366a69[_0xe327('0x3c')]['ids'],'VoiceQueueId':_0x366a69[_0xe327('0x4e')]['id']}})['then'](function(){return _0xd2cb08;});}})[_0xe327('0x25')](respondWithStatusCode(_0x68138e,null))[_0xe327('0x51')](handleError(_0x68138e,null));};exports[_0xe327('0xb7')]=function(_0xc0e9ef,_0x48006b,_0x4684c7){var _0x20e8e6={};var _0x5069cf={};var _0x33030d;var _0x5778b9;return db[_0xe327('0x37')]['findOne']({'where':{'id':_0xc0e9ef[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x48006b,null))[_0xe327('0x25')](function(_0x3a57cf){if(_0x3a57cf){_0x33030d=_0x3a57cf;_0x5069cf[_0xe327('0x3b')]=_[_0xe327('0x3d')](db[_0xe327('0x9d')][_0xe327('0x38')]);_0x5069cf[_0xe327('0x3c')]=_[_0xe327('0x3d')](_0xc0e9ef['query']);_0x5069cf[_0xe327('0x44')]=_[_0xe327('0x3f')](_0x5069cf[_0xe327('0x3b')],_0x5069cf['query']);_0x20e8e6[_0xe327('0x3e')]=_[_0xe327('0x3f')](_0x5069cf[_0xe327('0x3b')],qs[_0xe327('0x40')](_0xc0e9ef['query'][_0xe327('0x40')]));_0x20e8e6['attributes']=_0x20e8e6[_0xe327('0x3e')][_0xe327('0x4f')]?_0x20e8e6[_0xe327('0x3e')]:_0x5069cf['model'];_0x20e8e6[_0xe327('0x42')]=qs[_0xe327('0x43')](_0xc0e9ef[_0xe327('0x3c')][_0xe327('0x43')]);_0x20e8e6['where']=qs['filters'](_[_0xe327('0x45')](_0xc0e9ef[_0xe327('0x3c')],_0x5069cf[_0xe327('0x44')]));if(_0xc0e9ef[_0xe327('0x3c')]['filter']){_0x20e8e6['where']=_[_0xe327('0x47')](_0x20e8e6[_0xe327('0x46')],{'$or':_[_0xe327('0x2c')](_0x20e8e6['attributes'],function(_0x2e5e3d){var _0x34d836={};_0x34d836[_0x2e5e3d]={'$like':'%'+_0xc0e9ef['query'][_0xe327('0x2a')]+'%'};return _0x34d836;})});}_0x20e8e6=_['merge']({},_0x20e8e6,_0xc0e9ef[_0xe327('0x50')]);return _0x33030d['getBlackLists'](_0x20e8e6);}})[_0xe327('0x25')](function(_0x3b6607){if(_0x3b6607){_0x5778b9=_0x3b6607[_0xe327('0x4f')];if(!_0xc0e9ef[_0xe327('0x3c')][_0xe327('0x62')](_0xe327('0x41'))){_0x20e8e6[_0xe327('0x1c')]=qs[_0xe327('0x1c')](_0xc0e9ef[_0xe327('0x3c')][_0xe327('0x1c')]);_0x20e8e6[_0xe327('0x1b')]=qs[_0xe327('0x1b')](_0xc0e9ef[_0xe327('0x3c')]['offset']);}return _0x33030d['getBlackLists'](_0x20e8e6);}})[_0xe327('0x25')](function(_0x4ac573){if(_0x4ac573){return _0x4ac573?{'count':_0x5778b9,'rows':_0x4ac573}:null;}})['then'](respondWithResult(_0x48006b,null))[_0xe327('0x51')](handleError(_0x48006b,null));};exports[_0xe327('0xb8')]=function(_0x4e95d6,_0x1c7648,_0x30b468){var _0x371298,_0x545b58;return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x4e95d6['params']['id']}})['then'](handleEntityNotFound(_0x1c7648,null))[_0xe327('0x25')](function(_0x476a24){if(_0x476a24){_0x545b58=_0x476a24;return _0x476a24[_0xe327('0xb8')](_0x4e95d6[_0xe327('0x53')][_0xe327('0x82')],_[_0xe327('0x5d')](_0x4e95d6[_0xe327('0x53')],['ids','id'])||{});}return null;})[_0xe327('0x97')](function(_0x339b26){var _0x50dcd5;_0x371298=_0x339b26||[];var _0x260aaf=[];if(_0x339b26){for(var _0x15da6a=0x0;_0x15da6a<_0x339b26[_0xe327('0x4f')];_0x15da6a+=0x1){var _0x2a9677=_0x339b26[_0x15da6a]['get']({'plain':!![]});_0x50dcd5=squel['insert']()[_0xe327('0xa2')](_0xe327('0xb9'))[_0xe327('0xa3')]([_0xe327('0xa4'),_0xe327('0xa6'),_0xe327('0xa7'),'VoiceQueueId',_0xe327('0x5e'),_0xe327('0xa8')],squel[_0xe327('0x84')]()[_0xe327('0x85')](_0xe327('0xa4'),_0xe327('0xa4'))[_0xe327('0x85')]('id',_0xe327('0xa6'))[_0xe327('0x85')](_0x2a9677[_0xe327('0xaa')][_0xe327('0x8d')](),'ListId')['field'](_0x4e95d6[_0xe327('0x4e')]['id'][_0xe327('0x8d')](),_0xe327('0x66'))['field'](_0xe327('0xa9'),_0xe327('0x5e'))[_0xe327('0x85')](_0xe327('0xa9'),_0xe327('0xa8'))[_0xe327('0x87')]('cm_contacts')[_0xe327('0x46')]('deletedAt\x20IS\x20NULL')[_0xe327('0x46')](_0xe327('0xad'),_0x2a9677[_0xe327('0xaa')]['toString']())['where'](_0xe327('0xae')))['toString']();_0x260aaf['push'](db['sequelize'][_0xe327('0x3c')](_0x50dcd5));}return BPromise[_0xe327('0x99')](_0x260aaf);}})[_0xe327('0x25')](function(){return _0x371298;})['then'](respondWithResult(_0x1c7648,null))[_0xe327('0x51')](handleError(_0x1c7648,null));};exports[_0xe327('0xba')]=function(_0x1b5c3c,_0x33ac6c,_0x2ff2bf){return db[_0xe327('0x37')][_0xe327('0x30')]({'where':{'id':_0x1b5c3c[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](handleEntityNotFound(_0x33ac6c,null))[_0xe327('0x25')](function(_0x421ae2){if(_0x421ae2){return _0x421ae2[_0xe327('0xba')](_0x1b5c3c[_0xe327('0x3c')][_0xe327('0x82')]);}})[_0xe327('0x25')](function(_0x45efbe){if(_0x45efbe){return db[_0xe327('0x6a')][_0xe327('0x24')]({'where':{'ListId':_0x1b5c3c[_0xe327('0x3c')][_0xe327('0x82')],'VoiceQueueId':_0x1b5c3c[_0xe327('0x4e')]['id']}})[_0xe327('0x25')](function(){return _0x45efbe;});}})[_0xe327('0x25')](respondWithStatusCode(_0x33ac6c,null))[_0xe327('0x51')](handleError(_0x33ac6c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8a14957..b5857f8 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 _0x3e31=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3701bf,_0x305d6a){var _0x43aae3=function(_0x7b0fb7){while(--_0x7b0fb7){_0x3701bf['push'](_0x3701bf['shift']());}};_0x43aae3(++_0x305d6a);}(_0x3e31,0x187));var _0x13e3=function(_0x4a48c6,_0x2b7910){_0x4a48c6=_0x4a48c6-0x0;var _0x54c0a0=_0x3e31[_0x4a48c6];return _0x54c0a0;};'use strict';var EventEmitter=require(_0x13e3('0x0'));var VoiceQueue=require(_0x13e3('0x1'))['db'][_0x13e3('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x13e3('0x3')](0x0);var events={'afterCreate':_0x13e3('0x4'),'afterUpdate':_0x13e3('0x5'),'afterDestroy':_0x13e3('0x6')};function emitEvent(_0xf1e350){return function(_0x10b5cd,_0x3f0590,_0x57b044){VoiceQueueEvents[_0x13e3('0x7')](_0xf1e350+':'+_0x10b5cd['id'],_0x10b5cd);VoiceQueueEvents[_0x13e3('0x7')](_0xf1e350,_0x10b5cd);_0x57b044(null);};}for(var e in events){if(events[_0x13e3('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x13e3('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x85d1=['emit','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update'];(function(_0x2feb81,_0x3ff7f2){var _0x5c416f=function(_0x34d9b2){while(--_0x34d9b2){_0x2feb81['push'](_0x2feb81['shift']());}};_0x5c416f(++_0x3ff7f2);}(_0x85d1,0x19b));var _0x185d=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x85d1[_0x93942f];return _0x23fcd8;};'use strict';var EventEmitter=require(_0x185d('0x0'));var VoiceQueue=require(_0x185d('0x1'))['db'][_0x185d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x185d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x185d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2af4ba){return function(_0x336521,_0x539fde,_0xac849e){VoiceQueueEvents[_0x185d('0x5')](_0x2af4ba+':'+_0x336521['id'],_0x336521);VoiceQueueEvents[_0x185d('0x5')](_0x2af4ba,_0x336521);_0xac849e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x185d('0x6')](e,emitEvent(event));}}module[_0x185d('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index f2f2efa..f246850 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x500c5a,_0x5360cc){var _0x2763a8=function(_0x289570){while(--_0x289570){_0x500c5a['push'](_0x500c5a['shift']());}};_0x2763a8(++_0x5360cc);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x4c6f44,_0x413a03){var _0x5ee4b9=function(_0x61a78c){while(--_0x61a78c){_0x4c6f44['push'](_0x4c6f44['shift']());}};_0x5ee4b9(++_0x413a03);}(_0x3e74,0x175));var _0x43e7=function(_0x2ef7ed,_0x3f36f5){_0x2ef7ed=_0x2ef7ed-0x0;var _0x4e3c57=_0x3e74[_0x2ef7ed];return _0x4e3c57;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0419ca8..d5f1766 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 _0x2ff3=['register','then','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','model','ShowVoiceQueue','find','raw','map','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueue.socket'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2ff3,0x1d4));var _0x32ff=function(_0x29d554,_0x3ad7f0){_0x29d554=_0x29d554-0x0;var _0x50eb2a=_0x2ff3[_0x29d554];return _0x50eb2a;};'use strict';var _=require(_0x32ff('0x0'));var util=require(_0x32ff('0x1'));var moment=require(_0x32ff('0x2'));var BPromise=require(_0x32ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x32ff('0x5'))('rpc');var config=require(_0x32ff('0x6'));var jayson=require(_0x32ff('0x7'));var client=jayson[_0x32ff('0x8')]['http']({'port':0x232a});config[_0x32ff('0x9')]=_[_0x32ff('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ff('0xb'))(new Redis(config['redis']));require(_0x32ff('0xc'))[_0x32ff('0xd')](socket);function respondWithRpcPromise(_0x1e7b9b,_0x220a2d,_0x394ab8){return new BPromise(function(_0x3d0289,_0x1fa8ec){return client['request'](_0x1e7b9b,_0x394ab8)[_0x32ff('0xe')](function(_0x7d56d0){logger[_0x32ff('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x220a2d,_0x32ff('0x10'));logger[_0x32ff('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x220a2d,'request\x20sent',JSON[_0x32ff('0x12')](_0x7d56d0));if(_0x7d56d0[_0x32ff('0x13')]){if(_0x7d56d0[_0x32ff('0x13')][_0x32ff('0x14')]===0x1f4){logger[_0x32ff('0x13')](_0x32ff('0x15'),_0x220a2d,_0x7d56d0[_0x32ff('0x13')][_0x32ff('0x16')]);return _0x1fa8ec(_0x7d56d0[_0x32ff('0x13')][_0x32ff('0x16')]);}logger[_0x32ff('0x13')](_0x32ff('0x15'),_0x220a2d,_0x7d56d0['error'][_0x32ff('0x16')]);return _0x3d0289(_0x7d56d0[_0x32ff('0x13')][_0x32ff('0x16')]);}else{logger[_0x32ff('0xf')](_0x32ff('0x15'),_0x220a2d,_0x32ff('0x10'));_0x3d0289(_0x7d56d0[_0x32ff('0x17')][_0x32ff('0x16')]);}})[_0x32ff('0x18')](function(_0x45ebc1){logger[_0x32ff('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x220a2d,_0x45ebc1);_0x1fa8ec(_0x45ebc1);});});}exports[_0x32ff('0x19')]=function(_0x28e4e1){var _0x427dbe=this;return new Promise(function(_0x511370,_0x22c441){return db[_0x32ff('0x1a')]['findAll']({'raw':_0x28e4e1['options']?_0x28e4e1[_0x32ff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x28e4e1[_0x32ff('0x1b')]?_0x28e4e1[_0x32ff('0x1b')][_0x32ff('0x1c')]||null:null,'attributes':_0x28e4e1['options']?_0x28e4e1[_0x32ff('0x1b')][_0x32ff('0x1d')]||null:null,'limit':_0x28e4e1['options']?_0x28e4e1[_0x32ff('0x1b')][_0x32ff('0x1e')]||null:null,'include':_0x28e4e1[_0x32ff('0x1b')]?_0x28e4e1[_0x32ff('0x1b')][_0x32ff('0x1f')]?_['map'](_0x28e4e1['options'][_0x32ff('0x1f')],function(_0x250c5a){return{'model':db[_0x250c5a['model']],'as':_0x250c5a['as'],'attributes':_0x250c5a['attributes'],'include':_0x250c5a[_0x32ff('0x1f')]?_['map'](_0x250c5a['include'],function(_0x290197){return{'model':db[_0x290197[_0x32ff('0x20')]],'as':_0x290197['as'],'attributes':_0x290197[_0x32ff('0x1d')],'include':_0x290197['include']?_['map'](_0x290197[_0x32ff('0x1f')],function(_0x43d11d){return{'model':db[_0x43d11d['model']],'as':_0x43d11d['as'],'attributes':_0x43d11d['attributes']};}):[]};}):[]};}):[]:[]})[_0x32ff('0xe')](function(_0x11edbb){logger['info'](_0x32ff('0x19'),_0x28e4e1);logger[_0x32ff('0x11')](_0x32ff('0x19'),_0x28e4e1,JSON[_0x32ff('0x12')](_0x11edbb));_0x511370(_0x11edbb);})[_0x32ff('0x18')](function(_0x230741){logger[_0x32ff('0x13')](_0x32ff('0x19'),_0x230741[_0x32ff('0x16')],_0x28e4e1);_0x22c441(_0x427dbe[_0x32ff('0x13')](0x1f4,_0x230741[_0x32ff('0x16')]));});});};exports[_0x32ff('0x21')]=function(_0x5b5daa){var _0x19f526=this;return new Promise(function(_0x59e574,_0x101633){return db[_0x32ff('0x1a')][_0x32ff('0x22')]({'raw':_0x5b5daa[_0x32ff('0x1b')]?_0x5b5daa['options'][_0x32ff('0x23')]===undefined?!![]:![]:!![],'where':_0x5b5daa['options']?_0x5b5daa[_0x32ff('0x1b')][_0x32ff('0x1c')]||null:null,'attributes':_0x5b5daa['options']?_0x5b5daa['options'][_0x32ff('0x1d')]||null:null,'include':_0x5b5daa[_0x32ff('0x1b')]?_0x5b5daa[_0x32ff('0x1b')]['include']?_[_0x32ff('0x24')](_0x5b5daa[_0x32ff('0x1b')]['include'],function(_0xa4baf4){return{'model':db[_0xa4baf4[_0x32ff('0x20')]],'as':_0xa4baf4['as'],'attributes':_0xa4baf4[_0x32ff('0x1d')],'include':_0xa4baf4[_0x32ff('0x1f')]?_[_0x32ff('0x24')](_0xa4baf4['include'],function(_0x52c6da){return{'model':db[_0x52c6da[_0x32ff('0x20')]],'as':_0x52c6da['as'],'attributes':_0x52c6da[_0x32ff('0x1d')],'include':_0x52c6da['include']?_[_0x32ff('0x24')](_0x52c6da['include'],function(_0x43918a){return{'model':db[_0x43918a[_0x32ff('0x20')]],'as':_0x43918a['as'],'attributes':_0x43918a['attributes']};}):[]};}):[]};}):[]:[]})[_0x32ff('0xe')](function(_0x137ffc){logger[_0x32ff('0xf')]('ShowVoiceQueue',_0x5b5daa);logger[_0x32ff('0x11')]('ShowVoiceQueue',_0x5b5daa,JSON[_0x32ff('0x12')](_0x137ffc));_0x59e574(_0x137ffc);})[_0x32ff('0x18')](function(_0x23f404){logger[_0x32ff('0x13')](_0x32ff('0x21'),_0x23f404[_0x32ff('0x16')],_0x5b5daa);_0x101633(_0x19f526[_0x32ff('0x13')](0x1f4,_0x23f404[_0x32ff('0x16')]));});});}; \ No newline at end of file +var _0x12aa=['VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','attributes','include','map','model','info','GetVoiceQueue','ShowVoiceQueue','raw','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then'];(function(_0x55b9dc,_0x2c7227){var _0x15d404=function(_0x5e3a1e){while(--_0x5e3a1e){_0x55b9dc['push'](_0x55b9dc['shift']());}};_0x15d404(++_0x2c7227);}(_0x12aa,0x1db));var _0xa12a=function(_0x591758,_0x910e05){_0x591758=_0x591758-0x0;var _0x166bfb=_0x12aa[_0x591758];return _0x166bfb;};'use strict';var _=require(_0xa12a('0x0'));var util=require(_0xa12a('0x1'));var moment=require(_0xa12a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa12a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa12a('0x4'));var logger=require('../../config/logger')(_0xa12a('0x5'));var config=require(_0xa12a('0x6'));var jayson=require(_0xa12a('0x7'));var client=jayson[_0xa12a('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa12a('0x9')],{'host':_0xa12a('0xa'),'port':0x18eb});var socket=require(_0xa12a('0xb'))(new Redis(config[_0xa12a('0x9')]));require(_0xa12a('0xc'))['register'](socket);function respondWithRpcPromise(_0x2724f5,_0x1e8b52,_0x3a5308){return new BPromise(function(_0x4a9cbc,_0x4ec95d){return client[_0xa12a('0xd')](_0x2724f5,_0x3a5308)[_0xa12a('0xe')](function(_0x1cd057){logger['info'](_0xa12a('0xf'),_0x1e8b52,_0xa12a('0x10'));logger[_0xa12a('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1e8b52,_0xa12a('0x10'),JSON[_0xa12a('0x12')](_0x1cd057));if(_0x1cd057[_0xa12a('0x13')]){if(_0x1cd057['error'][_0xa12a('0x14')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1e8b52,_0x1cd057['error'][_0xa12a('0x15')]);return _0x4ec95d(_0x1cd057[_0xa12a('0x13')][_0xa12a('0x15')]);}logger['error'](_0xa12a('0xf'),_0x1e8b52,_0x1cd057[_0xa12a('0x13')][_0xa12a('0x15')]);return _0x4a9cbc(_0x1cd057['error']['message']);}else{logger['info'](_0xa12a('0xf'),_0x1e8b52,'request\x20sent');_0x4a9cbc(_0x1cd057[_0xa12a('0x16')]['message']);}})[_0xa12a('0x17')](function(_0x21ac27){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1e8b52,_0x21ac27);_0x4ec95d(_0x21ac27);});});}exports['GetVoiceQueue']=function(_0xcec68e){var _0x4cf030=this;return new Promise(function(_0x5d2382,_0x57e55b){return db[_0xa12a('0x18')][_0xa12a('0x19')]({'raw':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e[_0xa12a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e[_0xa12a('0x1a')]['where']||null:null,'attributes':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e['options'][_0xa12a('0x1b')]||null:null,'limit':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e[_0xa12a('0x1a')]['limit']||null:null,'include':_0xcec68e[_0xa12a('0x1a')]?_0xcec68e['options'][_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0xcec68e[_0xa12a('0x1a')][_0xa12a('0x1c')],function(_0x524f29){return{'model':db[_0x524f29[_0xa12a('0x1e')]],'as':_0x524f29['as'],'attributes':_0x524f29[_0xa12a('0x1b')],'include':_0x524f29[_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0x524f29[_0xa12a('0x1c')],function(_0x3a33a7){return{'model':db[_0x3a33a7['model']],'as':_0x3a33a7['as'],'attributes':_0x3a33a7[_0xa12a('0x1b')],'include':_0x3a33a7[_0xa12a('0x1c')]?_['map'](_0x3a33a7[_0xa12a('0x1c')],function(_0x4b68c9){return{'model':db[_0x4b68c9[_0xa12a('0x1e')]],'as':_0x4b68c9['as'],'attributes':_0x4b68c9['attributes']};}):[]};}):[]};}):[]:[]})[_0xa12a('0xe')](function(_0x3826e3){logger[_0xa12a('0x1f')](_0xa12a('0x20'),_0xcec68e);logger[_0xa12a('0x11')](_0xa12a('0x20'),_0xcec68e,JSON[_0xa12a('0x12')](_0x3826e3));_0x5d2382(_0x3826e3);})[_0xa12a('0x17')](function(_0x4c817d){logger['error']('GetVoiceQueue',_0x4c817d[_0xa12a('0x15')],_0xcec68e);_0x57e55b(_0x4cf030['error'](0x1f4,_0x4c817d[_0xa12a('0x15')]));});});};exports[_0xa12a('0x21')]=function(_0x3d7a91){var _0x3fa74f=this;return new Promise(function(_0x5b2f3f,_0x2d6e66){return db[_0xa12a('0x18')]['find']({'raw':_0x3d7a91[_0xa12a('0x1a')]?_0x3d7a91[_0xa12a('0x1a')][_0xa12a('0x22')]===undefined?!![]:![]:!![],'where':_0x3d7a91[_0xa12a('0x1a')]?_0x3d7a91[_0xa12a('0x1a')]['where']||null:null,'attributes':_0x3d7a91[_0xa12a('0x1a')]?_0x3d7a91[_0xa12a('0x1a')]['attributes']||null:null,'include':_0x3d7a91['options']?_0x3d7a91['options']['include']?_[_0xa12a('0x1d')](_0x3d7a91[_0xa12a('0x1a')][_0xa12a('0x1c')],function(_0x327652){return{'model':db[_0x327652[_0xa12a('0x1e')]],'as':_0x327652['as'],'attributes':_0x327652[_0xa12a('0x1b')],'include':_0x327652[_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0x327652[_0xa12a('0x1c')],function(_0x58702a){return{'model':db[_0x58702a[_0xa12a('0x1e')]],'as':_0x58702a['as'],'attributes':_0x58702a[_0xa12a('0x1b')],'include':_0x58702a[_0xa12a('0x1c')]?_[_0xa12a('0x1d')](_0x58702a[_0xa12a('0x1c')],function(_0x459260){return{'model':db[_0x459260['model']],'as':_0x459260['as'],'attributes':_0x459260[_0xa12a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x183392){logger[_0xa12a('0x1f')](_0xa12a('0x21'),_0x3d7a91);logger[_0xa12a('0x11')]('ShowVoiceQueue',_0x3d7a91,JSON[_0xa12a('0x12')](_0x183392));_0x5b2f3f(_0x183392);})[_0xa12a('0x17')](function(_0x225071){logger[_0xa12a('0x13')](_0xa12a('0x21'),_0x225071['message'],_0x3d7a91);_0x2d6e66(_0x3fa74f[_0xa12a('0x13')](0x1f4,_0x225071[_0xa12a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 85160eb..99fce0f 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 _0x49f9=['voiceQueue:','remove','update','emit','removeListener','register'];(function(_0x57af30,_0x5d8111){var _0x2ec2e4=function(_0xabd935){while(--_0xabd935){_0x57af30['push'](_0x57af30['shift']());}};_0x2ec2e4(++_0x5d8111);}(_0x49f9,0xd3));var _0x949f=function(_0x268a71,_0x320096){_0x268a71=_0x268a71-0x0;var _0xd456b3=_0x49f9[_0x268a71];return _0xd456b3;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x949f('0x0'),_0x949f('0x1')];function createListener(_0x321316,_0x5970b3){return function(_0x2f9625){_0x5970b3[_0x949f('0x2')](_0x321316,_0x2f9625);};}function removeListener(_0x2bfb20,_0x504dcb){return function(){VoiceQueueEvents[_0x949f('0x3')](_0x2bfb20,_0x504dcb);};}exports[_0x949f('0x4')]=function(_0xcce948){for(var _0x5453db=0x0,_0x27c69c=events['length'];_0x5453db<_0x27c69c;_0x5453db++){var _0x3f95f1=events[_0x5453db];var _0x54f78d=createListener(_0x949f('0x5')+_0x3f95f1,_0xcce948);VoiceQueueEvents['on'](_0x3f95f1,_0x54f78d);}}; \ No newline at end of file +var _0xf77f=['./voiceQueue.events','save','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x3cddb7,_0x5a2426){var _0x495471=function(_0x1f176b){while(--_0x1f176b){_0x3cddb7['push'](_0x3cddb7['shift']());}};_0x495471(++_0x5a2426);}(_0xf77f,0x1c8));var _0xff77=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xf77f[_0x433a86];return _0x23000c;};'use strict';var VoiceQueueEvents=require(_0xff77('0x0'));var events=[_0xff77('0x1'),'remove',_0xff77('0x2')];function createListener(_0x308a6b,_0xdc06ff){return function(_0x3ab6af){_0xdc06ff[_0xff77('0x3')](_0x308a6b,_0x3ab6af);};}function removeListener(_0x505f9,_0x4d79c8){return function(){VoiceQueueEvents[_0xff77('0x4')](_0x505f9,_0x4d79c8);};}exports[_0xff77('0x5')]=function(_0x13cd78){for(var _0x793c84=0x0,_0x2facc2=events[_0xff77('0x6')];_0x793c84<_0x2facc2;_0x793c84++){var _0x311153=events[_0x793c84];var _0x56ca86=createListener(_0xff77('0x7')+_0x311153,_0x13cd78);VoiceQueueEvents['on'](_0x311153,_0x56ca86);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index feb0fd2..1cf7085 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 _0x9f2e=['/describe','isAuthenticated','describe','/index','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x9f2e,0xc7));var _0xe9f2=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9f2e[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0xe9f2('0x0'));var util=require(_0xe9f2('0x1'));var path=require(_0xe9f2('0x2'));var timeout=require(_0xe9f2('0x3'));var express=require(_0xe9f2('0x4'));var router=express[_0xe9f2('0x5')]();var fs_extra=require(_0xe9f2('0x6'));var auth=require(_0xe9f2('0x7'));var interaction=require(_0xe9f2('0x8'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xe9f2('0x9')]('/',auth['isAuthenticated'](),controller[_0xe9f2('0xa')]);router['get'](_0xe9f2('0xb'),auth[_0xe9f2('0xc')](),controller[_0xe9f2('0xd')]);router[_0xe9f2('0x9')](_0xe9f2('0xe'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xe9f2('0x9')](_0xe9f2('0xf'),auth[_0xe9f2('0xc')](),controller['show']);router[_0xe9f2('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9f2('0x11')](_0xe9f2('0xf'),auth[_0xe9f2('0xc')](),controller[_0xe9f2('0x12')]);router[_0xe9f2('0x13')](_0xe9f2('0xf'),auth['isAuthenticated'](),controller[_0xe9f2('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe80c=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','/:id','show','put','update','exports','multer','util','path'];(function(_0xb6e9e9,_0x19d56f){var _0x2d183a=function(_0x55204e){while(--_0x55204e){_0xb6e9e9['push'](_0xb6e9e9['shift']());}};_0x2d183a(++_0x19d56f);}(_0xe80c,0x10e));var _0xce80=function(_0x1bd2d7,_0x2572c5){_0x1bd2d7=_0x1bd2d7-0x0;var _0x58b751=_0xe80c[_0x1bd2d7];return _0x58b751;};'use strict';var multer=require(_0xce80('0x0'));var util=require(_0xce80('0x1'));var path=require(_0xce80('0x2'));var timeout=require(_0xce80('0x3'));var express=require(_0xce80('0x4'));var router=express['Router']();var fs_extra=require(_0xce80('0x5'));var auth=require(_0xce80('0x6'));var interaction=require(_0xce80('0x7'));var config=require(_0xce80('0x8'));var controller=require(_0xce80('0x9'));router['get']('/',auth[_0xce80('0xa')](),controller[_0xce80('0xb')]);router[_0xce80('0xc')](_0xce80('0xd'),auth[_0xce80('0xa')](),controller[_0xce80('0xe')]);router[_0xce80('0xc')](_0xce80('0xf'),auth[_0xce80('0xa')](),controller['getVoiceQueuesReport']);router[_0xce80('0xc')](_0xce80('0x10'),auth[_0xce80('0xa')](),controller[_0xce80('0x11')]);router['post']('/',auth[_0xce80('0xa')](),controller['create']);router[_0xce80('0x12')](_0xce80('0x10'),auth[_0xce80('0xa')](),controller[_0xce80('0x13')]);router['delete']('/:id',auth[_0xce80('0xa')](),controller['destroy']);module[_0xce80('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2225acb..1c96db2 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 _0xa8f4=['sequelize','moment','exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5390ab,_0x598b5f){var _0xa64ce4=function(_0x43305d){while(--_0x43305d){_0x5390ab['push'](_0x5390ab['shift']());}};_0xa64ce4(++_0x598b5f);}(_0xa8f4,0x110));var _0x4a8f=function(_0x334b84,_0x360ed3){_0x334b84=_0x334b84-0x0;var _0x2b5960=_0xa8f4[_0x334b84];return _0x2b5960;};'use strict';var Sequelize=require(_0x4a8f('0x0'));var moment=require(_0x4a8f('0x1'));module[_0x4a8f('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4a8f('0x3')]},'calleridnum':{'type':Sequelize[_0x4a8f('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4a8f('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x4a8f('0x4')],'set':function(_0x3837f8){var _0x34df51=moment(_0x3837f8);var _0x3b75b2=moment(this[_0x4a8f('0x5')]('queuecallerjoinAt'))[_0x4a8f('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x267102=_0x34df51[_0x4a8f('0x7')](_0x3b75b2,_0x4a8f('0x8'));this[_0x4a8f('0x9')](_0x4a8f('0xa'),_0x3837f8);this['setDataValue'](_0x4a8f('0xb'),_0x267102||null);}},'position':{'type':Sequelize[_0x4a8f('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x4a8f('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4a8f('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x4a8f('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4a8f('0x4')]},'queuecallerexit':{'type':Sequelize[_0x4a8f('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x4a8f('0xe')},'originalposition':{'type':Sequelize[_0x4a8f('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4a8f('0x3')]},'connectedlinename':{'type':Sequelize[_0x4a8f('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4a8f('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4a8f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x4a8f('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4a8f('0x3')]},'transfer':{'type':Sequelize[_0x4a8f('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4a8f('0x3')],'comment':_0x4a8f('0xf')},'transferexten':{'type':Sequelize[_0x4a8f('0x3')]},'transferuniqueid':{'type':Sequelize[_0x4a8f('0x3')]},'disposition':{'type':Sequelize[_0x4a8f('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4a8f('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x4a8f('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8565=['diff','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x59091a,_0x4766f8){var _0x26503e=function(_0x2051e){while(--_0x2051e){_0x59091a['push'](_0x59091a['shift']());}};_0x26503e(++_0x4766f8);}(_0x8565,0x1c0));var _0x5856=function(_0x38f559,_0xba9f1c){_0x38f559=_0x38f559-0x0;var _0xc1a535=_0x8565[_0x38f559];return _0xc1a535;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5856('0x0'));module[_0x5856('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5856('0x2')]},'calleridnum':{'type':Sequelize[_0x5856('0x2')]},'calleridname':{'type':Sequelize[_0x5856('0x2')]},'queue':{'type':Sequelize[_0x5856('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5856('0x3')],'set':function(_0x1be678){var _0x2ba400=moment(_0x1be678);var _0x4b16a2=moment(this[_0x5856('0x4')]('queuecallerjoinAt'))[_0x5856('0x5')](_0x5856('0x6'));var _0x597033=_0x2ba400[_0x5856('0x7')](_0x4b16a2,'seconds');this[_0x5856('0x8')]('queuecallerleaveAt',_0x1be678);this['setDataValue']('holdtime',_0x597033||null);}},'position':{'type':Sequelize[_0x5856('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallerexit':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5856('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x5856('0xb')},'originalposition':{'type':Sequelize[_0x5856('0x9')]},'channel':{'type':Sequelize[_0x5856('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5856('0x2')]},'connectedlinename':{'type':Sequelize[_0x5856('0x2')]},'accountcode':{'type':Sequelize[_0x5856('0x2')]},'context':{'type':Sequelize[_0x5856('0x2')]},'exten':{'type':Sequelize[_0x5856('0x2')]},'priority':{'type':Sequelize[_0x5856('0x2')]},'holdtime':{'type':Sequelize[_0x5856('0x9')]},'mohtime':{'type':Sequelize[_0x5856('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5856('0x2')]},'transfer':{'type':Sequelize[_0x5856('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5856('0x2')],'comment':_0x5856('0xc')},'transferexten':{'type':Sequelize[_0x5856('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5856('0x2')]},'disposition':{'type':Sequelize[_0x5856('0x2')]},'secondDisposition':{'type':Sequelize[_0x5856('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5856('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5856('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 4f5a32c..97852fc 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 _0xcf12=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','findAll','rows','show','params','includeAll','include','create','body','find','catch','describe','order','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','destroy','then','error','stack','name','index','map','VoiceQueueReport'];(function(_0x58384a,_0xe734bf){var _0x5bd401=function(_0x384c8e){while(--_0x384c8e){_0x58384a['push'](_0x58384a['shift']());}};_0x5bd401(++_0xe734bf);}(_0xcf12,0x16d));var _0x2cf1=function(_0x1627ce,_0x9b92ed){_0x1627ce=_0x1627ce-0x0;var _0xb11196=_0xcf12[_0x1627ce];return _0xb11196;};'use strict';var emlformat=require(_0x2cf1('0x0'));var rimraf=require(_0x2cf1('0x1'));var zipdir=require(_0x2cf1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cf1('0x3'));var moment=require('moment');var BPromise=require(_0x2cf1('0x4'));var Mustache=require(_0x2cf1('0x5'));var util=require(_0x2cf1('0x6'));var path=require(_0x2cf1('0x7'));var sox=require(_0x2cf1('0x8'));var csv=require('to-csv');var ejs=require(_0x2cf1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cf1('0xa'));var squel=require(_0x2cf1('0xb'));var crypto=require(_0x2cf1('0xc'));var jsforce=require(_0x2cf1('0xd'));var deskjs=require(_0x2cf1('0xe'));var toCsv=require(_0x2cf1('0xf'));var querystring=require(_0x2cf1('0x10'));var Papa=require(_0x2cf1('0x11'));var Redis=require(_0x2cf1('0x12'));var authService=require(_0x2cf1('0x13'));var qs=require(_0x2cf1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cf1('0x15'));var logger=require(_0x2cf1('0x16'))(_0x2cf1('0x17'));var utils=require('../../config/utils');var config=require(_0x2cf1('0x18'));var licenseUtil=require(_0x2cf1('0x19'));var db=require(_0x2cf1('0x1a'))['db'];config[_0x2cf1('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2cf1('0x1c'))(new Redis(config[_0x2cf1('0x1b')]));require(_0x2cf1('0x1d'))[_0x2cf1('0x1e')](socket);function respondWithStatusCode(_0x84e866,_0x59e507){_0x59e507=_0x59e507||0xcc;return function(_0x157875){if(_0x157875){return _0x84e866[_0x2cf1('0x1f')](_0x59e507);}return _0x84e866[_0x2cf1('0x20')](_0x59e507)['end']();};}function respondWithResult(_0x149ea5,_0x968698){_0x968698=_0x968698||0xc8;return function(_0x3ed682){if(_0x3ed682){return _0x149ea5[_0x2cf1('0x20')](_0x968698)['json'](_0x3ed682);}};}function respondWithFilteredResult(_0x43fd2a,_0x55cc93){return function(_0x470c4c){if(_0x470c4c){var _0x5d2b67=typeof _0x55cc93[_0x2cf1('0x21')]===_0x2cf1('0x22')&&typeof _0x55cc93[_0x2cf1('0x23')]===_0x2cf1('0x22');var _0x2428c4=_0x470c4c[_0x2cf1('0x24')];var _0x138277=_0x5d2b67?0x0:_0x55cc93[_0x2cf1('0x21')];var _0x5bdaa2=_0x5d2b67?_0x470c4c[_0x2cf1('0x24')]:_0x55cc93[_0x2cf1('0x21')]+_0x55cc93[_0x2cf1('0x23')];var _0x1cdd6b;if(_0x5bdaa2>=_0x2428c4){_0x5bdaa2=_0x2428c4;_0x1cdd6b=0xc8;}else{_0x1cdd6b=0xce;}_0x43fd2a[_0x2cf1('0x20')](_0x1cdd6b);return _0x43fd2a[_0x2cf1('0x25')]('Content-Range',_0x138277+'-'+_0x5bdaa2+'/'+_0x2428c4)[_0x2cf1('0x26')](_0x470c4c);}return null;};}function patchUpdates(_0x12d18a){return function(_0xf2739e){try{jsonpatch['apply'](_0xf2739e,_0x12d18a,!![]);}catch(_0xc7bc66){return BPromise[_0x2cf1('0x27')](_0xc7bc66);}return _0xf2739e[_0x2cf1('0x28')]();};}function saveUpdates(_0x563857,_0x4fc041){return function(_0x185710){if(_0x185710){return _0x185710[_0x2cf1('0x29')](_0x563857)['then'](function(_0x423d28){return _0x423d28;});}return null;};}function removeEntity(_0xa50954,_0x17f248){return function(_0x1bbaab){if(_0x1bbaab){return _0x1bbaab[_0x2cf1('0x2a')]()[_0x2cf1('0x2b')](function(){_0xa50954['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f97c7,_0x179904){return function(_0x58f111){if(!_0x58f111){_0x1f97c7['sendStatus'](0x194);}return _0x58f111;};}function handleError(_0x1ac86e,_0x288156){_0x288156=_0x288156||0x1f4;return function(_0x223c87){logger[_0x2cf1('0x2c')](_0x223c87[_0x2cf1('0x2d')]);if(_0x223c87['name']){delete _0x223c87[_0x2cf1('0x2e')];}_0x1ac86e['status'](_0x288156)['send'](_0x223c87);};}exports[_0x2cf1('0x2f')]=function(_0x909fbb,_0x825c29){var _0x2b4494={},_0x22e1ac={},_0x4f3668={'count':0x0,'rows':[]};var _0x1669c3=_[_0x2cf1('0x30')](db[_0x2cf1('0x31')][_0x2cf1('0x32')],function(_0x14e747){return{'name':_0x14e747[_0x2cf1('0x33')],'type':_0x14e747['type'][_0x2cf1('0x34')]};});_0x22e1ac[_0x2cf1('0x35')]=_[_0x2cf1('0x30')](_0x1669c3,_0x2cf1('0x2e'));_0x22e1ac[_0x2cf1('0x36')]=_[_0x2cf1('0x37')](_0x909fbb[_0x2cf1('0x36')]);_0x22e1ac[_0x2cf1('0x38')]=_[_0x2cf1('0x39')](_0x22e1ac[_0x2cf1('0x35')],_0x22e1ac[_0x2cf1('0x36')]);_0x2b4494['attributes']=_[_0x2cf1('0x39')](_0x22e1ac[_0x2cf1('0x35')],qs[_0x2cf1('0x3a')](_0x909fbb[_0x2cf1('0x36')][_0x2cf1('0x3a')]));_0x2b4494[_0x2cf1('0x3b')]=_0x2b4494[_0x2cf1('0x3b')][_0x2cf1('0x3c')]?_0x2b4494[_0x2cf1('0x3b')]:_0x22e1ac[_0x2cf1('0x35')];if(!_0x909fbb[_0x2cf1('0x36')][_0x2cf1('0x3d')](_0x2cf1('0x3e'))){_0x2b4494['limit']=qs[_0x2cf1('0x23')](_0x909fbb[_0x2cf1('0x36')]['limit']);_0x2b4494[_0x2cf1('0x21')]=qs['offset'](_0x909fbb['query']['offset']);}_0x2b4494['order']=qs[_0x2cf1('0x3f')](_0x909fbb[_0x2cf1('0x36')][_0x2cf1('0x3f')]);_0x2b4494[_0x2cf1('0x40')]=qs[_0x2cf1('0x38')](_[_0x2cf1('0x41')](_0x909fbb['query'],_0x22e1ac['filters']),_0x1669c3);if(_0x909fbb[_0x2cf1('0x36')]['filter']){_0x2b4494['where']=_[_0x2cf1('0x42')](_0x2b4494[_0x2cf1('0x40')],{'$or':_[_0x2cf1('0x30')](_0x1669c3,function(_0x54b90c){if(_0x54b90c[_0x2cf1('0x43')]!=='VIRTUAL'){var _0x2d2a3b={};_0x2d2a3b[_0x54b90c['name']]={'$like':'%'+_0x909fbb[_0x2cf1('0x36')][_0x2cf1('0x44')]+'%'};return _0x2d2a3b;}})});}_0x2b4494=_[_0x2cf1('0x42')]({},_0x2b4494,_0x909fbb[_0x2cf1('0x45')]);var _0x38852b={'where':_0x2b4494[_0x2cf1('0x40')]};return db[_0x2cf1('0x31')][_0x2cf1('0x24')](_0x38852b)[_0x2cf1('0x2b')](function(_0x13a344){_0x4f3668[_0x2cf1('0x24')]=_0x13a344;if(_0x909fbb[_0x2cf1('0x36')]['includeAll']){_0x2b4494['include']=[{'all':!![]}];}return db[_0x2cf1('0x31')][_0x2cf1('0x46')](_0x2b4494);})[_0x2cf1('0x2b')](function(_0x1f8fe5){_0x4f3668[_0x2cf1('0x47')]=_0x1f8fe5;return _0x4f3668;})[_0x2cf1('0x2b')](respondWithFilteredResult(_0x825c29,_0x2b4494))['catch'](handleError(_0x825c29,null));};exports[_0x2cf1('0x48')]=function(_0x225124,_0x1aed6c){var _0x1857d7={'raw':![],'where':{'id':_0x225124[_0x2cf1('0x49')]['id']}},_0x1d33d8={};_0x1d33d8[_0x2cf1('0x35')]=_['keys'](db[_0x2cf1('0x31')][_0x2cf1('0x32')]);_0x1d33d8[_0x2cf1('0x36')]=_[_0x2cf1('0x37')](_0x225124[_0x2cf1('0x36')]);_0x1d33d8[_0x2cf1('0x38')]=_[_0x2cf1('0x39')](_0x1d33d8[_0x2cf1('0x35')],_0x1d33d8[_0x2cf1('0x36')]);_0x1857d7['attributes']=_[_0x2cf1('0x39')](_0x1d33d8['model'],qs[_0x2cf1('0x3a')](_0x225124['query'][_0x2cf1('0x3a')]));_0x1857d7[_0x2cf1('0x3b')]=_0x1857d7['attributes'][_0x2cf1('0x3c')]?_0x1857d7[_0x2cf1('0x3b')]:_0x1d33d8[_0x2cf1('0x35')];if(_0x225124[_0x2cf1('0x36')][_0x2cf1('0x4a')]){_0x1857d7[_0x2cf1('0x4b')]=[{'all':!![]}];}_0x1857d7=_[_0x2cf1('0x42')]({},_0x1857d7,_0x225124[_0x2cf1('0x45')]);return db[_0x2cf1('0x31')]['find'](_0x1857d7)[_0x2cf1('0x2b')](handleEntityNotFound(_0x1aed6c,null))['then'](respondWithResult(_0x1aed6c,null))['catch'](handleError(_0x1aed6c,null));};exports[_0x2cf1('0x4c')]=function(_0xf760e2,_0x4601d8){return db['VoiceQueueReport'][_0x2cf1('0x4c')](_0xf760e2[_0x2cf1('0x4d')],{})[_0x2cf1('0x2b')](respondWithResult(_0x4601d8,0xc9))['catch'](handleError(_0x4601d8,null));};exports[_0x2cf1('0x29')]=function(_0x4dbaab,_0x1ded5e){if(_0x4dbaab[_0x2cf1('0x4d')]['id']){delete _0x4dbaab[_0x2cf1('0x4d')]['id'];}return db['VoiceQueueReport'][_0x2cf1('0x4e')]({'where':{'id':_0x4dbaab[_0x2cf1('0x49')]['id']}})[_0x2cf1('0x2b')](handleEntityNotFound(_0x1ded5e,null))[_0x2cf1('0x2b')](saveUpdates(_0x4dbaab['body'],null))[_0x2cf1('0x2b')](respondWithResult(_0x1ded5e,null))[_0x2cf1('0x4f')](handleError(_0x1ded5e,null));};exports[_0x2cf1('0x2a')]=function(_0x353958,_0x58716d){return db[_0x2cf1('0x31')][_0x2cf1('0x4e')]({'where':{'id':_0x353958[_0x2cf1('0x49')]['id']}})[_0x2cf1('0x2b')](handleEntityNotFound(_0x58716d,null))[_0x2cf1('0x2b')](removeEntity(_0x58716d,null))[_0x2cf1('0x4f')](handleError(_0x58716d,null));};exports[_0x2cf1('0x50')]=function(_0x3605d2,_0x21881a){return db[_0x2cf1('0x31')][_0x2cf1('0x50')]()[_0x2cf1('0x2b')](respondWithResult(_0x21881a,null))[_0x2cf1('0x4f')](handleError(_0x21881a,null));};exports['getVoiceQueuesReport']=function(_0x2ccc17,_0x56b95a){var _0x11ff03={},_0x476544={},_0x357d72={'count':0x0,'rows':[]};_0x476544[_0x2cf1('0x35')]=_['keys'](db['VoiceQueueReport']['rawAttributes']);_0x476544[_0x2cf1('0x36')]=_['keys'](_0x2ccc17[_0x2cf1('0x36')]);_0x476544[_0x2cf1('0x38')]=_[_0x2cf1('0x39')](_0x476544['model'],_0x476544['query']);_0x11ff03['attributes']=_['intersection'](_0x476544[_0x2cf1('0x35')],qs[_0x2cf1('0x3a')](_0x2ccc17[_0x2cf1('0x36')][_0x2cf1('0x3a')]));_0x11ff03[_0x2cf1('0x3b')]=_0x11ff03['attributes'][_0x2cf1('0x3c')]?_0x11ff03[_0x2cf1('0x3b')]:_0x476544[_0x2cf1('0x35')];if(!_0x2ccc17[_0x2cf1('0x36')][_0x2cf1('0x3d')]('nolimit')){_0x11ff03['limit']=qs['limit'](_0x2ccc17['query'][_0x2cf1('0x23')]);_0x11ff03[_0x2cf1('0x21')]=qs[_0x2cf1('0x21')](_0x2ccc17[_0x2cf1('0x36')][_0x2cf1('0x21')]);}_0x11ff03[_0x2cf1('0x51')]=qs[_0x2cf1('0x3f')](_0x2ccc17[_0x2cf1('0x36')]['sort']);_0x11ff03[_0x2cf1('0x40')]=qs[_0x2cf1('0x38')](_[_0x2cf1('0x41')](_0x2ccc17[_0x2cf1('0x36')],_0x476544[_0x2cf1('0x38')]));if(_0x2ccc17[_0x2cf1('0x36')][_0x2cf1('0x44')]){_0x11ff03[_0x2cf1('0x40')]=_[_0x2cf1('0x42')](_0x11ff03['where'],{'$or':_[_0x2cf1('0x30')](_0x11ff03[_0x2cf1('0x3b')],function(_0x440fad){var _0x27f8ba={};_0x27f8ba[_0x440fad]={'$like':'%'+_0x2ccc17[_0x2cf1('0x36')][_0x2cf1('0x44')]+'%'};return _0x27f8ba;})});}_0x11ff03=_['merge']({},_0x11ff03,_0x2ccc17['options']);var _0x262917={'where':_0x11ff03[_0x2cf1('0x40')]};return db[_0x2cf1('0x31')][_0x2cf1('0x24')](_0x262917)[_0x2cf1('0x2b')](function(_0x117791){_0x357d72[_0x2cf1('0x24')]=_0x117791;if(_0x2ccc17[_0x2cf1('0x36')][_0x2cf1('0x4a')]){_0x11ff03[_0x2cf1('0x4b')]=[{'all':!![]}];}return db[_0x2cf1('0x31')]['findAll'](_0x11ff03);})[_0x2cf1('0x2b')](function(_0x2bb86f){_0x357d72['rows']=_0x2bb86f;return _0x357d72;})[_0x2cf1('0x2b')](respondWithFilteredResult(_0x56b95a,_0x11ff03,_0x2cf1('0x52')))[_0x2cf1('0x4f')](handleError(_0x56b95a,null,_0x2cf1('0x52')));}; \ No newline at end of file +var _0x0439=['describe','pick','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','find'];(function(_0xce66dc,_0xb4c0b){var _0x4dd12f=function(_0x35ea77){while(--_0x35ea77){_0xce66dc['push'](_0xce66dc['shift']());}};_0x4dd12f(++_0xb4c0b);}(_0x0439,0x18e));var _0x9043=function(_0x23ef1f,_0x127dd2){_0x23ef1f=_0x23ef1f-0x0;var _0x234192=_0x0439[_0x23ef1f];return _0x234192;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9043('0x0'));var zipdir=require(_0x9043('0x1'));var jsonpatch=require(_0x9043('0x2'));var rp=require(_0x9043('0x3'));var moment=require(_0x9043('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9043('0x5'));var util=require(_0x9043('0x6'));var path=require('path');var sox=require(_0x9043('0x7'));var csv=require(_0x9043('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9043('0x9'));var _=require('lodash');var squel=require(_0x9043('0xa'));var crypto=require(_0x9043('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9043('0x8'));var querystring=require('querystring');var Papa=require(_0x9043('0xc'));var Redis=require(_0x9043('0xd'));var authService=require(_0x9043('0xe'));var qs=require(_0x9043('0xf'));var as=require(_0x9043('0x10'));var hardwareService=require(_0x9043('0x11'));var logger=require(_0x9043('0x12'))(_0x9043('0x13'));var utils=require(_0x9043('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9043('0x15')](config[_0x9043('0x16')],{'host':_0x9043('0x17'),'port':0x18eb});var socket=require(_0x9043('0x18'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x190a49,_0x1a2d59){_0x1a2d59=_0x1a2d59||0xcc;return function(_0xea1162){if(_0xea1162){return _0x190a49[_0x9043('0x19')](_0x1a2d59);}return _0x190a49[_0x9043('0x1a')](_0x1a2d59)[_0x9043('0x1b')]();};}function respondWithResult(_0x3a6a3a,_0x537467){_0x537467=_0x537467||0xc8;return function(_0x4dc14a){if(_0x4dc14a){return _0x3a6a3a[_0x9043('0x1a')](_0x537467)[_0x9043('0x1c')](_0x4dc14a);}};}function respondWithFilteredResult(_0x396a6d,_0x78335e){return function(_0xa677ef){if(_0xa677ef){var _0x377284=typeof _0x78335e[_0x9043('0x1d')]===_0x9043('0x1e')&&typeof _0x78335e[_0x9043('0x1f')]===_0x9043('0x1e');var _0x29e135=_0xa677ef[_0x9043('0x20')];var _0x4a8890=_0x377284?0x0:_0x78335e[_0x9043('0x1d')];var _0x28fc01=_0x377284?_0xa677ef[_0x9043('0x20')]:_0x78335e[_0x9043('0x1d')]+_0x78335e[_0x9043('0x1f')];var _0x4de774;if(_0x28fc01>=_0x29e135){_0x28fc01=_0x29e135;_0x4de774=0xc8;}else{_0x4de774=0xce;}_0x396a6d[_0x9043('0x1a')](_0x4de774);return _0x396a6d[_0x9043('0x21')](_0x9043('0x22'),_0x4a8890+'-'+_0x28fc01+'/'+_0x29e135)['json'](_0xa677ef);}return null;};}function patchUpdates(_0x50c55e){return function(_0x5071da){try{jsonpatch['apply'](_0x5071da,_0x50c55e,!![]);}catch(_0x4b4922){return BPromise[_0x9043('0x23')](_0x4b4922);}return _0x5071da[_0x9043('0x24')]();};}function saveUpdates(_0x39f858,_0x4070ae){return function(_0x44893d){if(_0x44893d){return _0x44893d[_0x9043('0x25')](_0x39f858)[_0x9043('0x26')](function(_0x11b068){return _0x11b068;});}return null;};}function removeEntity(_0x3c470f,_0x3bf2c8){return function(_0x40d69b){if(_0x40d69b){return _0x40d69b[_0x9043('0x27')]()[_0x9043('0x26')](function(){_0x3c470f[_0x9043('0x1a')](0xcc)[_0x9043('0x1b')]();});}};}function handleEntityNotFound(_0x25a943,_0xa1cdf){return function(_0x4382a9){if(!_0x4382a9){_0x25a943['sendStatus'](0x194);}return _0x4382a9;};}function handleError(_0x37b20d,_0x30ec10){_0x30ec10=_0x30ec10||0x1f4;return function(_0x6ebe16){logger[_0x9043('0x28')](_0x6ebe16[_0x9043('0x29')]);if(_0x6ebe16['name']){delete _0x6ebe16[_0x9043('0x2a')];}_0x37b20d[_0x9043('0x1a')](_0x30ec10)[_0x9043('0x2b')](_0x6ebe16);};}exports[_0x9043('0x2c')]=function(_0x499002,_0x5bc7bb){var _0x7661c0={},_0x1b47f5={},_0x3da055={'count':0x0,'rows':[]};var _0x45ecc3=_[_0x9043('0x2d')](db[_0x9043('0x2e')][_0x9043('0x2f')],function(_0x10eb6a){return{'name':_0x10eb6a[_0x9043('0x30')],'type':_0x10eb6a[_0x9043('0x31')][_0x9043('0x32')]};});_0x1b47f5[_0x9043('0x33')]=_['map'](_0x45ecc3,'name');_0x1b47f5[_0x9043('0x34')]=_['keys'](_0x499002[_0x9043('0x34')]);_0x1b47f5[_0x9043('0x35')]=_[_0x9043('0x36')](_0x1b47f5[_0x9043('0x33')],_0x1b47f5['query']);_0x7661c0[_0x9043('0x37')]=_[_0x9043('0x36')](_0x1b47f5[_0x9043('0x33')],qs['fields'](_0x499002[_0x9043('0x34')]['fields']));_0x7661c0['attributes']=_0x7661c0['attributes'][_0x9043('0x38')]?_0x7661c0[_0x9043('0x37')]:_0x1b47f5['model'];if(!_0x499002[_0x9043('0x34')]['hasOwnProperty'](_0x9043('0x39'))){_0x7661c0[_0x9043('0x1f')]=qs['limit'](_0x499002[_0x9043('0x34')]['limit']);_0x7661c0[_0x9043('0x1d')]=qs['offset'](_0x499002[_0x9043('0x34')]['offset']);}_0x7661c0[_0x9043('0x3a')]=qs[_0x9043('0x3b')](_0x499002[_0x9043('0x34')][_0x9043('0x3b')]);_0x7661c0[_0x9043('0x3c')]=qs[_0x9043('0x35')](_['pick'](_0x499002[_0x9043('0x34')],_0x1b47f5[_0x9043('0x35')]),_0x45ecc3);if(_0x499002[_0x9043('0x34')][_0x9043('0x3d')]){_0x7661c0[_0x9043('0x3c')]=_[_0x9043('0x3e')](_0x7661c0[_0x9043('0x3c')],{'$or':_[_0x9043('0x2d')](_0x45ecc3,function(_0x599a73){if(_0x599a73['type']!=='VIRTUAL'){var _0x426747={};_0x426747[_0x599a73['name']]={'$like':'%'+_0x499002[_0x9043('0x34')][_0x9043('0x3d')]+'%'};return _0x426747;}})});}_0x7661c0=_[_0x9043('0x3e')]({},_0x7661c0,_0x499002['options']);var _0x51a538={'where':_0x7661c0[_0x9043('0x3c')]};return db['VoiceQueueReport'][_0x9043('0x20')](_0x51a538)[_0x9043('0x26')](function(_0xcb6187){_0x3da055[_0x9043('0x20')]=_0xcb6187;if(_0x499002['query'][_0x9043('0x3f')]){_0x7661c0[_0x9043('0x40')]=[{'all':!![]}];}return db[_0x9043('0x2e')][_0x9043('0x41')](_0x7661c0);})[_0x9043('0x26')](function(_0x236045){_0x3da055[_0x9043('0x42')]=_0x236045;return _0x3da055;})['then'](respondWithFilteredResult(_0x5bc7bb,_0x7661c0))[_0x9043('0x43')](handleError(_0x5bc7bb,null));};exports[_0x9043('0x44')]=function(_0x183fa6,_0x1cc5e4){var _0x295c0d={'raw':![],'where':{'id':_0x183fa6[_0x9043('0x45')]['id']}},_0x58b17f={};_0x58b17f['model']=_[_0x9043('0x46')](db[_0x9043('0x2e')]['rawAttributes']);_0x58b17f[_0x9043('0x34')]=_['keys'](_0x183fa6['query']);_0x58b17f[_0x9043('0x35')]=_['intersection'](_0x58b17f[_0x9043('0x33')],_0x58b17f[_0x9043('0x34')]);_0x295c0d[_0x9043('0x37')]=_[_0x9043('0x36')](_0x58b17f[_0x9043('0x33')],qs['fields'](_0x183fa6[_0x9043('0x34')][_0x9043('0x47')]));_0x295c0d[_0x9043('0x37')]=_0x295c0d[_0x9043('0x37')][_0x9043('0x38')]?_0x295c0d[_0x9043('0x37')]:_0x58b17f['model'];if(_0x183fa6['query'][_0x9043('0x3f')]){_0x295c0d[_0x9043('0x40')]=[{'all':!![]}];}_0x295c0d=_['merge']({},_0x295c0d,_0x183fa6[_0x9043('0x48')]);return db[_0x9043('0x2e')]['find'](_0x295c0d)[_0x9043('0x26')](handleEntityNotFound(_0x1cc5e4,null))[_0x9043('0x26')](respondWithResult(_0x1cc5e4,null))[_0x9043('0x43')](handleError(_0x1cc5e4,null));};exports[_0x9043('0x49')]=function(_0x1391a6,_0x307782){return db['VoiceQueueReport'][_0x9043('0x49')](_0x1391a6[_0x9043('0x4a')],{})[_0x9043('0x26')](respondWithResult(_0x307782,0xc9))[_0x9043('0x43')](handleError(_0x307782,null));};exports[_0x9043('0x25')]=function(_0x5ae2d1,_0x3bb551){if(_0x5ae2d1[_0x9043('0x4a')]['id']){delete _0x5ae2d1['body']['id'];}return db[_0x9043('0x2e')][_0x9043('0x4b')]({'where':{'id':_0x5ae2d1[_0x9043('0x45')]['id']}})[_0x9043('0x26')](handleEntityNotFound(_0x3bb551,null))[_0x9043('0x26')](saveUpdates(_0x5ae2d1['body'],null))['then'](respondWithResult(_0x3bb551,null))[_0x9043('0x43')](handleError(_0x3bb551,null));};exports[_0x9043('0x27')]=function(_0x1332a6,_0x50561d){return db[_0x9043('0x2e')]['find']({'where':{'id':_0x1332a6[_0x9043('0x45')]['id']}})[_0x9043('0x26')](handleEntityNotFound(_0x50561d,null))[_0x9043('0x26')](removeEntity(_0x50561d,null))['catch'](handleError(_0x50561d,null));};exports[_0x9043('0x4c')]=function(_0x4ff573,_0x53594e){return db[_0x9043('0x2e')][_0x9043('0x4c')]()[_0x9043('0x26')](respondWithResult(_0x53594e,null))[_0x9043('0x43')](handleError(_0x53594e,null));};exports['getVoiceQueuesReport']=function(_0x3c101b,_0x3b9596){var _0xef3f7c={},_0xaa7783={},_0x35081d={'count':0x0,'rows':[]};_0xaa7783[_0x9043('0x33')]=_[_0x9043('0x46')](db[_0x9043('0x2e')][_0x9043('0x2f')]);_0xaa7783[_0x9043('0x34')]=_[_0x9043('0x46')](_0x3c101b[_0x9043('0x34')]);_0xaa7783[_0x9043('0x35')]=_[_0x9043('0x36')](_0xaa7783['model'],_0xaa7783[_0x9043('0x34')]);_0xef3f7c[_0x9043('0x37')]=_[_0x9043('0x36')](_0xaa7783[_0x9043('0x33')],qs['fields'](_0x3c101b[_0x9043('0x34')][_0x9043('0x47')]));_0xef3f7c[_0x9043('0x37')]=_0xef3f7c['attributes'][_0x9043('0x38')]?_0xef3f7c[_0x9043('0x37')]:_0xaa7783[_0x9043('0x33')];if(!_0x3c101b[_0x9043('0x34')]['hasOwnProperty'](_0x9043('0x39'))){_0xef3f7c['limit']=qs[_0x9043('0x1f')](_0x3c101b[_0x9043('0x34')]['limit']);_0xef3f7c[_0x9043('0x1d')]=qs[_0x9043('0x1d')](_0x3c101b[_0x9043('0x34')][_0x9043('0x1d')]);}_0xef3f7c[_0x9043('0x3a')]=qs[_0x9043('0x3b')](_0x3c101b[_0x9043('0x34')][_0x9043('0x3b')]);_0xef3f7c[_0x9043('0x3c')]=qs[_0x9043('0x35')](_[_0x9043('0x4d')](_0x3c101b[_0x9043('0x34')],_0xaa7783[_0x9043('0x35')]));if(_0x3c101b['query'][_0x9043('0x3d')]){_0xef3f7c['where']=_[_0x9043('0x3e')](_0xef3f7c[_0x9043('0x3c')],{'$or':_[_0x9043('0x2d')](_0xef3f7c[_0x9043('0x37')],function(_0x593a32){var _0xb9c32c={};_0xb9c32c[_0x593a32]={'$like':'%'+_0x3c101b[_0x9043('0x34')][_0x9043('0x3d')]+'%'};return _0xb9c32c;})});}_0xef3f7c=_[_0x9043('0x3e')]({},_0xef3f7c,_0x3c101b[_0x9043('0x48')]);var _0x25e5b0={'where':_0xef3f7c[_0x9043('0x3c')]};return db[_0x9043('0x2e')][_0x9043('0x20')](_0x25e5b0)[_0x9043('0x26')](function(_0x23c339){_0x35081d[_0x9043('0x20')]=_0x23c339;if(_0x3c101b[_0x9043('0x34')][_0x9043('0x3f')]){_0xef3f7c[_0x9043('0x40')]=[{'all':!![]}];}return db[_0x9043('0x2e')][_0x9043('0x41')](_0xef3f7c);})[_0x9043('0x26')](function(_0x53a519){_0x35081d[_0x9043('0x42')]=_0x53a519;return _0x35081d;})[_0x9043('0x26')](respondWithFilteredResult(_0x3b9596,_0xef3f7c,_0x9043('0x4e')))[_0x9043('0x43')](handleError(_0x3b9596,null,_0x9043('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d307288..b882e15 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 _0xe06b=['remove','emit','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x52d02e,_0x2d0894){var _0x2bf500=function(_0x52b6c7){while(--_0x52b6c7){_0x52d02e['push'](_0x52d02e['shift']());}};_0x2bf500(++_0x2d0894);}(_0xe06b,0x109));var _0xbe06=function(_0x302f1c,_0x21791d){_0x302f1c=_0x302f1c-0x0;var _0xc0e855=_0xe06b[_0x302f1c];return _0xc0e855;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xbe06('0x0'))['db'][_0xbe06('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xbe06('0x2')](0x0);var events={'afterCreate':_0xbe06('0x3'),'afterUpdate':_0xbe06('0x4'),'afterDestroy':_0xbe06('0x5')};function emitEvent(_0x347498){return function(_0x301fcd,_0x2f3028,_0xe31b28){VoiceQueueReportEvents[_0xbe06('0x6')](_0x347498+':'+_0x301fcd['id'],_0x301fcd);VoiceQueueReportEvents[_0xbe06('0x6')](_0x347498,_0x301fcd);_0xe31b28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xbe06('0x7')](e,emitEvent(event));}}module[_0xbe06('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xa859=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa859,0x1af));var _0x9a85=function(_0x1ccb9e,_0x19b38f){_0x1ccb9e=_0x1ccb9e-0x0;var _0x1475c2=_0xa859[_0x1ccb9e];return _0x1475c2;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x9a85('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9a85('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a85('0x2'),'afterDestroy':_0x9a85('0x3')};function emitEvent(_0x3c33ba){return function(_0x5cf4ca,_0x3a534b,_0x30c4dd){VoiceQueueReportEvents[_0x9a85('0x4')](_0x3c33ba+':'+_0x5cf4ca['id'],_0x5cf4ca);VoiceQueueReportEvents[_0x9a85('0x4')](_0x3c33ba,_0x5cf4ca);_0x30c4dd(null);};}for(var e in events){if(events[_0x9a85('0x5')](e)){var event=events[e];VoiceQueueReport[_0x9a85('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index bb30381..164cfe3 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 _0x14c7=['report_queue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x44f5f2,_0xc1a9d1){var _0x493ea3=function(_0x71eb22){while(--_0x71eb22){_0x44f5f2['push'](_0x44f5f2['shift']());}};_0x493ea3(++_0xc1a9d1);}(_0x14c7,0x160));var _0x714c=function(_0x2ea894,_0x2011fd){_0x2ea894=_0x2ea894-0x0;var _0x1637fe=_0x14c7[_0x2ea894];return _0x1637fe;};'use strict';var _=require(_0x714c('0x0'));var util=require('util');var logger=require(_0x714c('0x1'))(_0x714c('0x2'));var moment=require(_0x714c('0x3'));var BPromise=require(_0x714c('0x4'));var rp=require(_0x714c('0x5'));var fs=require('fs');var path=require(_0x714c('0x6'));var rimraf=require(_0x714c('0x7'));var config=require('../../config/environment');var attributes=require(_0x714c('0x8'));module[_0x714c('0x9')]=function(_0x104762,_0x45f122){return _0x104762[_0x714c('0xa')](_0x714c('0xb'),attributes,{'tableName':_0x714c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc885=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid'];(function(_0x5f0f89,_0x1fc5cc){var _0x541945=function(_0x26ea1d){while(--_0x26ea1d){_0x5f0f89['push'](_0x5f0f89['shift']());}};_0x541945(++_0x1fc5cc);}(_0xc885,0xfc));var _0x5c88=function(_0x3a23d3,_0x4088d8){_0x3a23d3=_0x3a23d3-0x0;var _0x10803b=_0xc885[_0x3a23d3];return _0x10803b;};'use strict';var _=require(_0x5c88('0x0'));var util=require(_0x5c88('0x1'));var logger=require(_0x5c88('0x2'))('api');var moment=require(_0x5c88('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c88('0x5'));var config=require(_0x5c88('0x6'));var attributes=require(_0x5c88('0x7'));module[_0x5c88('0x8')]=function(_0x4a8666,_0x4f4aa3){return _0x4a8666[_0x5c88('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x5c88('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5c88('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2691b3c..de6c0b9 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 _0x9fca=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','model','map','catch','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register'];(function(_0x5a9fad,_0x4a4e40){var _0x1f1585=function(_0x5f4faa){while(--_0x5f4faa){_0x5a9fad['push'](_0x5a9fad['shift']());}};_0x1f1585(++_0x4a4e40);}(_0x9fca,0x140));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xa9fc('0x0'));var util=require(_0xa9fc('0x1'));var moment=require(_0xa9fc('0x2'));var BPromise=require(_0xa9fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9fc('0x4'));var db=require(_0xa9fc('0x5'))['db'];var utils=require(_0xa9fc('0x6'));var logger=require(_0xa9fc('0x7'))(_0xa9fc('0x8'));var config=require(_0xa9fc('0x9'));var jayson=require(_0xa9fc('0xa'));var client=jayson['client'][_0xa9fc('0xb')]({'port':0x232a});config[_0xa9fc('0xc')]=_['defaults'](config[_0xa9fc('0xc')],{'host':_0xa9fc('0xd'),'port':0x18eb});var socket=require(_0xa9fc('0xe'))(new Redis(config[_0xa9fc('0xc')]));require('./voiceQueueReport.socket')[_0xa9fc('0xf')](socket);function respondWithRpcPromise(_0x1e11e2,_0x491db9,_0x114df0){return new BPromise(function(_0x49d2fa,_0x1fb65b){return client[_0xa9fc('0x10')](_0x1e11e2,_0x114df0)[_0xa9fc('0x11')](function(_0x56933d){logger[_0xa9fc('0x12')](_0xa9fc('0x13'),_0x491db9,_0xa9fc('0x14'));logger[_0xa9fc('0x15')](_0xa9fc('0x16'),_0x491db9,_0xa9fc('0x14'),JSON[_0xa9fc('0x17')](_0x56933d));if(_0x56933d[_0xa9fc('0x18')]){if(_0x56933d[_0xa9fc('0x18')][_0xa9fc('0x19')]===0x1f4){logger['error'](_0xa9fc('0x13'),_0x491db9,_0x56933d['error'][_0xa9fc('0x1a')]);return _0x1fb65b(_0x56933d[_0xa9fc('0x18')][_0xa9fc('0x1a')]);}logger['error'](_0xa9fc('0x13'),_0x491db9,_0x56933d[_0xa9fc('0x18')][_0xa9fc('0x1a')]);return _0x49d2fa(_0x56933d[_0xa9fc('0x18')]['message']);}else{logger[_0xa9fc('0x12')](_0xa9fc('0x13'),_0x491db9,_0xa9fc('0x14'));_0x49d2fa(_0x56933d[_0xa9fc('0x1b')]['message']);}})['catch'](function(_0x433a8){logger['error'](_0xa9fc('0x13'),_0x491db9,_0x433a8);_0x1fb65b(_0x433a8);});});}exports[_0xa9fc('0x1c')]=function(_0x2c0c15){var _0x4a4f3b=this;return new Promise(function(_0x193463,_0x35ebca){return db['VoiceQueueReport'][_0xa9fc('0x1d')]({'raw':_0x2c0c15[_0xa9fc('0x1e')]?_0x2c0c15[_0xa9fc('0x1e')][_0xa9fc('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c0c15['options']?_0x2c0c15[_0xa9fc('0x1e')][_0xa9fc('0x20')]||null:null,'attributes':_0x2c0c15[_0xa9fc('0x1e')]?_0x2c0c15[_0xa9fc('0x1e')][_0xa9fc('0x21')]||null:null,'limit':_0x2c0c15['options']?_0x2c0c15[_0xa9fc('0x1e')]['limit']||null:null,'include':_0x2c0c15['options']?_0x2c0c15[_0xa9fc('0x1e')][_0xa9fc('0x22')]?_['map'](_0x2c0c15[_0xa9fc('0x1e')]['include'],function(_0x558ad5){return{'model':db[_0x558ad5['model']],'as':_0x558ad5['as'],'attributes':_0x558ad5[_0xa9fc('0x21')],'include':_0x558ad5[_0xa9fc('0x22')]?_['map'](_0x558ad5[_0xa9fc('0x22')],function(_0x5c8bc1){return{'model':db[_0x5c8bc1[_0xa9fc('0x23')]],'as':_0x5c8bc1['as'],'attributes':_0x5c8bc1[_0xa9fc('0x21')],'include':_0x5c8bc1[_0xa9fc('0x22')]?_[_0xa9fc('0x24')](_0x5c8bc1[_0xa9fc('0x22')],function(_0x5603ae){return{'model':db[_0x5603ae[_0xa9fc('0x23')]],'as':_0x5603ae['as'],'attributes':_0x5603ae[_0xa9fc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa9fc('0x11')](function(_0x420e76){logger[_0xa9fc('0x12')](_0xa9fc('0x1c'),_0x2c0c15);logger[_0xa9fc('0x15')](_0xa9fc('0x1c'),_0x2c0c15,JSON['stringify'](_0x420e76));_0x193463(_0x420e76);})[_0xa9fc('0x25')](function(_0x2110c3){logger['error'](_0xa9fc('0x1c'),_0x2110c3[_0xa9fc('0x1a')],_0x2c0c15);_0x35ebca(_0x4a4f3b[_0xa9fc('0x18')](0x1f4,_0x2110c3[_0xa9fc('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x3eeca1){var _0x28e29f=this;return new Promise(function(_0x5e28e7,_0x1b2bfd){return db['VoiceQueueReport'][_0xa9fc('0x26')](_0x3eeca1['body'],{'raw':_0x3eeca1[_0xa9fc('0x1e')]?_0x3eeca1[_0xa9fc('0x1e')][_0xa9fc('0x1f')]===undefined?!![]:![]:!![]})[_0xa9fc('0x11')](function(_0x49023f){logger[_0xa9fc('0x12')](_0xa9fc('0x27'),_0x3eeca1);logger[_0xa9fc('0x15')](_0xa9fc('0x27'),_0x3eeca1,JSON[_0xa9fc('0x17')](_0x49023f));_0x5e28e7(_0x49023f);})[_0xa9fc('0x25')](function(_0x1f36fe){logger['error'](_0xa9fc('0x27'),_0x1f36fe['message'],_0x3eeca1);_0x1b2bfd(_0x28e29f[_0xa9fc('0x18')](0x1f4,_0x1f36fe[_0xa9fc('0x1a')]));});});};exports[_0xa9fc('0x28')]=function(_0x4057cf){var _0xabde2c=this;return new Promise(function(_0x22d723,_0x4daf1e){return db['VoiceQueueReport'][_0xa9fc('0x29')](_0x4057cf['body'],{'raw':_0x4057cf['options']?_0x4057cf[_0xa9fc('0x1e')][_0xa9fc('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4057cf[_0xa9fc('0x1e')]?_0x4057cf[_0xa9fc('0x1e')][_0xa9fc('0x20')]||null:null,'attributes':_0x4057cf[_0xa9fc('0x1e')]?_0x4057cf[_0xa9fc('0x1e')][_0xa9fc('0x21')]||null:null,'limit':_0x4057cf[_0xa9fc('0x1e')]?_0x4057cf[_0xa9fc('0x1e')]['limit']||null:null})['then'](function(_0xaf6bfb){logger[_0xa9fc('0x12')](_0xa9fc('0x28'),_0x4057cf);logger[_0xa9fc('0x15')](_0xa9fc('0x28'),_0x4057cf,JSON['stringify'](_0xaf6bfb));_0x22d723(_0xaf6bfb);})['catch'](function(_0x32abe2){logger[_0xa9fc('0x18')](_0xa9fc('0x28'),_0x32abe2[_0xa9fc('0x1a')],_0x4057cf);_0x4daf1e(_0xabde2c[_0xa9fc('0x18')](0x1f4,_0x32abe2['message']));});});}; \ No newline at end of file +var _0x8cde=['register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x3f2bf3,_0xb432f4){var _0x353e5e=function(_0x583d0d){while(--_0x583d0d){_0x3f2bf3['push'](_0x3f2bf3['shift']());}};_0x353e5e(++_0xb432f4);}(_0x8cde,0x1b3));var _0xe8cd=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x8cde[_0x235482];return _0x5f5bea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe8cd('0x0'));var BPromise=require(_0xe8cd('0x1'));var rs=require(_0xe8cd('0x2'));var fs=require('fs');var Redis=require(_0xe8cd('0x3'));var db=require(_0xe8cd('0x4'))['db'];var utils=require(_0xe8cd('0x5'));var logger=require(_0xe8cd('0x6'))(_0xe8cd('0x7'));var config=require(_0xe8cd('0x8'));var jayson=require(_0xe8cd('0x9'));var client=jayson[_0xe8cd('0xa')][_0xe8cd('0xb')]({'port':0x232a});config[_0xe8cd('0xc')]=_['defaults'](config[_0xe8cd('0xc')],{'host':_0xe8cd('0xd'),'port':0x18eb});var socket=require(_0xe8cd('0xe'))(new Redis(config[_0xe8cd('0xc')]));require('./voiceQueueReport.socket')[_0xe8cd('0xf')](socket);function respondWithRpcPromise(_0x7ed909,_0x117494,_0x6d6659){return new BPromise(function(_0xff28af,_0xdc53c2){return client[_0xe8cd('0x10')](_0x7ed909,_0x6d6659)['then'](function(_0x1e999c){logger[_0xe8cd('0x11')](_0xe8cd('0x12'),_0x117494,_0xe8cd('0x13'));logger[_0xe8cd('0x14')](_0xe8cd('0x15'),_0x117494,_0xe8cd('0x13'),JSON[_0xe8cd('0x16')](_0x1e999c));if(_0x1e999c[_0xe8cd('0x17')]){if(_0x1e999c['error'][_0xe8cd('0x18')]===0x1f4){logger['error'](_0xe8cd('0x12'),_0x117494,_0x1e999c[_0xe8cd('0x17')][_0xe8cd('0x19')]);return _0xdc53c2(_0x1e999c['error'][_0xe8cd('0x19')]);}logger['error'](_0xe8cd('0x12'),_0x117494,_0x1e999c[_0xe8cd('0x17')]['message']);return _0xff28af(_0x1e999c[_0xe8cd('0x17')][_0xe8cd('0x19')]);}else{logger[_0xe8cd('0x11')](_0xe8cd('0x12'),_0x117494,_0xe8cd('0x13'));_0xff28af(_0x1e999c[_0xe8cd('0x1a')]['message']);}})[_0xe8cd('0x1b')](function(_0x5eb9c6){logger[_0xe8cd('0x17')](_0xe8cd('0x12'),_0x117494,_0x5eb9c6);_0xdc53c2(_0x5eb9c6);});});}exports[_0xe8cd('0x1c')]=function(_0x611e06){var _0x46123=this;return new Promise(function(_0x16ea1b,_0x2c9f06){return db[_0xe8cd('0x1d')][_0xe8cd('0x1e')]({'raw':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x20')]||null:null,'attributes':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x21')]||null:null,'limit':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x22')]||null:null,'include':_0x611e06[_0xe8cd('0x1f')]?_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x23')]?_['map'](_0x611e06[_0xe8cd('0x1f')][_0xe8cd('0x23')],function(_0x180f18){return{'model':db[_0x180f18['model']],'as':_0x180f18['as'],'attributes':_0x180f18[_0xe8cd('0x21')],'include':_0x180f18[_0xe8cd('0x23')]?_[_0xe8cd('0x24')](_0x180f18['include'],function(_0x44932f){return{'model':db[_0x44932f[_0xe8cd('0x25')]],'as':_0x44932f['as'],'attributes':_0x44932f[_0xe8cd('0x21')],'include':_0x44932f[_0xe8cd('0x23')]?_[_0xe8cd('0x24')](_0x44932f['include'],function(_0x4ceebc){return{'model':db[_0x4ceebc['model']],'as':_0x4ceebc['as'],'attributes':_0x4ceebc[_0xe8cd('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe8cd('0x26')](function(_0x5990b0){logger[_0xe8cd('0x11')](_0xe8cd('0x1c'),_0x611e06);logger['debug'](_0xe8cd('0x1c'),_0x611e06,JSON[_0xe8cd('0x16')](_0x5990b0));_0x16ea1b(_0x5990b0);})[_0xe8cd('0x1b')](function(_0x4f459b){logger[_0xe8cd('0x17')](_0xe8cd('0x1c'),_0x4f459b[_0xe8cd('0x19')],_0x611e06);_0x2c9f06(_0x46123[_0xe8cd('0x17')](0x1f4,_0x4f459b[_0xe8cd('0x19')]));});});};exports[_0xe8cd('0x27')]=function(_0x4c22d7){var _0x280caf=this;return new Promise(function(_0x1bb93e,_0x5c389b){return db['VoiceQueueReport'][_0xe8cd('0x28')](_0x4c22d7[_0xe8cd('0x29')],{'raw':_0x4c22d7['options']?_0x4c22d7['options'][_0xe8cd('0x2a')]===undefined?!![]:![]:!![]})[_0xe8cd('0x26')](function(_0x2d50b5){logger['info'](_0xe8cd('0x27'),_0x4c22d7);logger[_0xe8cd('0x14')](_0xe8cd('0x27'),_0x4c22d7,JSON[_0xe8cd('0x16')](_0x2d50b5));_0x1bb93e(_0x2d50b5);})[_0xe8cd('0x1b')](function(_0x4b8f7d){logger[_0xe8cd('0x17')]('CreateVoiceQueueReport',_0x4b8f7d[_0xe8cd('0x19')],_0x4c22d7);_0x5c389b(_0x280caf[_0xe8cd('0x17')](0x1f4,_0x4b8f7d[_0xe8cd('0x19')]));});});};exports[_0xe8cd('0x2b')]=function(_0x44a78e){var _0x38e669=this;return new Promise(function(_0x444366,_0x52ba24){return db[_0xe8cd('0x1d')][_0xe8cd('0x2c')](_0x44a78e[_0xe8cd('0x29')],{'raw':_0x44a78e['options']?_0x44a78e[_0xe8cd('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a78e[_0xe8cd('0x1f')]?_0x44a78e[_0xe8cd('0x1f')][_0xe8cd('0x20')]||null:null,'attributes':_0x44a78e[_0xe8cd('0x1f')]?_0x44a78e[_0xe8cd('0x1f')][_0xe8cd('0x21')]||null:null,'limit':_0x44a78e[_0xe8cd('0x1f')]?_0x44a78e['options'][_0xe8cd('0x22')]||null:null})[_0xe8cd('0x26')](function(_0x27a481){logger[_0xe8cd('0x11')](_0xe8cd('0x2b'),_0x44a78e);logger['debug'](_0xe8cd('0x2b'),_0x44a78e,JSON[_0xe8cd('0x16')](_0x27a481));_0x444366(_0x27a481);})[_0xe8cd('0x1b')](function(_0x3d8f16){logger[_0xe8cd('0x17')](_0xe8cd('0x2b'),_0x3d8f16[_0xe8cd('0x19')],_0x44a78e);_0x52ba24(_0x38e669[_0xe8cd('0x17')](0x1f4,_0x3d8f16[_0xe8cd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9de7b55..95909e3 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 _0xa24e=['save','remove','update','emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x1a93eb,_0x216ca1){var _0x439162=function(_0x2ee46c){while(--_0x2ee46c){_0x1a93eb['push'](_0x1a93eb['shift']());}};_0x439162(++_0x216ca1);}(_0xa24e,0x137));var _0xea24=function(_0x38b347,_0x29f7f6){_0x38b347=_0x38b347-0x0;var _0x24134e=_0xa24e[_0x38b347];return _0x24134e;};'use strict';var VoiceQueueReportEvents=require(_0xea24('0x0'));var events=[_0xea24('0x1'),_0xea24('0x2'),_0xea24('0x3')];function createListener(_0x306f1d,_0x357b7f){return function(_0x2224b5){_0x357b7f[_0xea24('0x4')](_0x306f1d,_0x2224b5);};}function removeListener(_0x403530,_0x58d44f){return function(){VoiceQueueReportEvents[_0xea24('0x5')](_0x403530,_0x58d44f);};}exports[_0xea24('0x6')]=function(_0x36b376){for(var _0x2534a6=0x0,_0x361c92=events['length'];_0x2534a6<_0x361c92;_0x2534a6++){var _0x1ecec0=events[_0x2534a6];var _0x21c18a=createListener(_0xea24('0x7')+_0x1ecec0,_0x36b376);VoiceQueueReportEvents['on'](_0x1ecec0,_0x21c18a);}}; \ No newline at end of file +var _0xb453=['./voiceQueueReport.events','save','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xb453,0x1e8));var _0x3b45=function(_0x3c15f2,_0x2db099){_0x3c15f2=_0x3c15f2-0x0;var _0x20fec6=_0xb453[_0x3c15f2];return _0x20fec6;};'use strict';var VoiceQueueReportEvents=require(_0x3b45('0x0'));var events=[_0x3b45('0x1'),'remove',_0x3b45('0x2')];function createListener(_0x19c429,_0x48ecf8){return function(_0x4a6ac4){_0x48ecf8[_0x3b45('0x3')](_0x19c429,_0x4a6ac4);};}function removeListener(_0x471768,_0x10029d){return function(){VoiceQueueReportEvents[_0x3b45('0x4')](_0x471768,_0x10029d);};}exports[_0x3b45('0x5')]=function(_0x210775){for(var _0x2f4baa=0x0,_0x39c77c=events[_0x3b45('0x6')];_0x2f4baa<_0x39c77c;_0x2f4baa++){var _0x1b529a=events[_0x2f4baa];var _0x59da08=createListener(_0x3b45('0x7')+_0x1b529a,_0x210775);VoiceQueueReportEvents['on'](_0x1b529a,_0x59da08);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 695fd8c..f67b15a 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 _0x98ac=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','exports'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x98ac,0x1d1));var _0xc98a=function(_0x43b7a3,_0x208ce4){_0x43b7a3=_0x43b7a3-0x0;var _0x1994c1=_0x98ac[_0x43b7a3];return _0x1994c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc98a('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc98a('0x1')]();var fs_extra=require(_0xc98a('0x2'));var auth=require(_0xc98a('0x3'));var interaction=require(_0xc98a('0x4'));var config=require(_0xc98a('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0xc98a('0x6')]('/',auth[_0xc98a('0x7')](),controller['index']);router[_0xc98a('0x6')](_0xc98a('0x8'),auth[_0xc98a('0x7')](),controller[_0xc98a('0x9')]);router[_0xc98a('0xa')]('/',auth[_0xc98a('0x7')](),controller[_0xc98a('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc98a('0xc')]);router[_0xc98a('0xd')](_0xc98a('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xc98a('0xe')]=router; \ No newline at end of file +var _0x28c4=['get','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','./voiceQueuesLog.controller','isAuthenticated'];(function(_0x43a67d,_0x18ac8f){var _0x3690e2=function(_0x525bfa){while(--_0x525bfa){_0x43a67d['push'](_0x43a67d['shift']());}};_0x3690e2(++_0x18ac8f);}(_0x28c4,0x99));var _0x428c=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0x28c4[_0x279368];return _0x40b6d0;};'use strict';var multer=require('multer');var util=require(_0x428c('0x0'));var path=require(_0x428c('0x1'));var timeout=require(_0x428c('0x2'));var express=require(_0x428c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x428c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x428c('0x5'));router['get']('/',auth[_0x428c('0x6')](),controller['index']);router[_0x428c('0x7')](_0x428c('0x8'),auth[_0x428c('0x6')](),controller[_0x428c('0x9')]);router[_0x428c('0xa')]('/',auth[_0x428c('0x6')](),controller[_0x428c('0xb')]);router[_0x428c('0xc')](_0x428c('0x8'),auth['isAuthenticated'](),controller[_0x428c('0xd')]);router[_0x428c('0xe')](_0x428c('0x8'),auth[_0x428c('0x6')](),controller[_0x428c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index fc24e0b..cf1653d 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 _0x91ea=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x1c8896,_0x30e22a){var _0x25127e=function(_0x306016){while(--_0x306016){_0x1c8896['push'](_0x1c8896['shift']());}};_0x25127e(++_0x30e22a);}(_0x91ea,0x13f));var _0xa91e=function(_0x5f51d1,_0x49ef31){_0x5f51d1=_0x5f51d1-0x0;var _0x229a0a=_0x91ea[_0x5f51d1];return _0x229a0a;};'use strict';var Sequelize=require(_0xa91e('0x0'));var moment=require(_0xa91e('0x1'));module[_0xa91e('0x2')]={'time':{'type':Sequelize[_0xa91e('0x3')]},'callid':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa91e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa91e('0x4')],'allowNull':![],'defaultValue':moment()[_0xa91e('0x5')](_0xa91e('0x6'))}}; \ No newline at end of file +var _0x0a14=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x3fb655,_0x345c41){var _0x22212d=function(_0x4c04c1){while(--_0x4c04c1){_0x3fb655['push'](_0x3fb655['shift']());}};_0x22212d(++_0x345c41);}(_0x0a14,0x120));var _0x40a1=function(_0x56984a,_0x36cba3){_0x56984a=_0x56984a-0x0;var _0x9133ab=_0x0a14[_0x56984a];return _0x9133ab;};'use strict';var Sequelize=require(_0x40a1('0x0'));var moment=require(_0x40a1('0x1'));module[_0x40a1('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x40a1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x40a1('0x4')],'allowNull':![],'defaultValue':moment()[_0x40a1('0x5')](_0x40a1('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9d63931..e330367 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 _0x27f3=['fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','map','VoiceQueuesLog','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x1126cd,_0x45187b){var _0x33626c=function(_0x14bd43){while(--_0x14bd43){_0x1126cd['push'](_0x1126cd['shift']());}};_0x33626c(++_0x45187b);}(_0x27f3,0xcf));var _0x327f=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x27f3[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x327f('0x0'));var rimraf=require(_0x327f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x327f('0x2'));var rp=require(_0x327f('0x3'));var moment=require(_0x327f('0x4'));var BPromise=require(_0x327f('0x5'));var Mustache=require('mustache');var util=require(_0x327f('0x6'));var path=require('path');var sox=require(_0x327f('0x7'));var csv=require(_0x327f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x327f('0x9'));var _=require(_0x327f('0xa'));var squel=require(_0x327f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x327f('0xc'));var authService=require(_0x327f('0xd'));var qs=require(_0x327f('0xe'));var as=require(_0x327f('0xf'));var hardwareService=require(_0x327f('0x10'));var logger=require('../../config/logger')(_0x327f('0x11'));var utils=require(_0x327f('0x12'));var config=require(_0x327f('0x13'));var licenseUtil=require(_0x327f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3b97,_0x2d11b2){_0x2d11b2=_0x2d11b2||0xcc;return function(_0x3bcc63){if(_0x3bcc63){return _0x4d3b97[_0x327f('0x15')](_0x2d11b2);}return _0x4d3b97[_0x327f('0x16')](_0x2d11b2)[_0x327f('0x17')]();};}function respondWithResult(_0x1b0187,_0x2379fb){_0x2379fb=_0x2379fb||0xc8;return function(_0x58abe0){if(_0x58abe0){return _0x1b0187[_0x327f('0x16')](_0x2379fb)[_0x327f('0x18')](_0x58abe0);}};}function respondWithFilteredResult(_0x3f9777,_0x9f6fbc){return function(_0x21cec4){if(_0x21cec4){var _0x23d8c7=typeof _0x9f6fbc['offset']===_0x327f('0x19')&&typeof _0x9f6fbc[_0x327f('0x1a')]===_0x327f('0x19');var _0x39c981=_0x21cec4['count'];var _0xfc9bc3=_0x23d8c7?0x0:_0x9f6fbc['offset'];var _0x6c5d9f=_0x23d8c7?_0x21cec4[_0x327f('0x1b')]:_0x9f6fbc[_0x327f('0x1c')]+_0x9f6fbc[_0x327f('0x1a')];var _0x39038d;if(_0x6c5d9f>=_0x39c981){_0x6c5d9f=_0x39c981;_0x39038d=0xc8;}else{_0x39038d=0xce;}_0x3f9777[_0x327f('0x16')](_0x39038d);return _0x3f9777[_0x327f('0x1d')](_0x327f('0x1e'),_0xfc9bc3+'-'+_0x6c5d9f+'/'+_0x39c981)[_0x327f('0x18')](_0x21cec4);}return null;};}function patchUpdates(_0x3064eb){return function(_0x28b813){try{jsonpatch['apply'](_0x28b813,_0x3064eb,!![]);}catch(_0x36ca4b){return BPromise[_0x327f('0x1f')](_0x36ca4b);}return _0x28b813[_0x327f('0x20')]();};}function saveUpdates(_0x125f2c,_0xb5673b){return function(_0x231b02){if(_0x231b02){return _0x231b02[_0x327f('0x21')](_0x125f2c)[_0x327f('0x22')](function(_0x34740f){return _0x34740f;});}return null;};}function removeEntity(_0x464b4e,_0xe723aa){return function(_0x549640){if(_0x549640){return _0x549640['destroy']()[_0x327f('0x22')](function(){_0x464b4e['status'](0xcc)[_0x327f('0x17')]();});}};}function handleEntityNotFound(_0x1c9a47,_0x19da32){return function(_0x5dede0){if(!_0x5dede0){_0x1c9a47['sendStatus'](0x194);}return _0x5dede0;};}function handleError(_0x55160b,_0x3a1c3b){_0x3a1c3b=_0x3a1c3b||0x1f4;return function(_0x138f4e){logger[_0x327f('0x23')](_0x138f4e[_0x327f('0x24')]);if(_0x138f4e[_0x327f('0x25')]){delete _0x138f4e['name'];}_0x55160b[_0x327f('0x16')](_0x3a1c3b)[_0x327f('0x26')](_0x138f4e);};}exports['index']=function(_0x559740,_0x3b319d){var _0x54d26c={},_0x512ae1={},_0x5a421c={'count':0x0,'rows':[]};var _0xd9c084=_[_0x327f('0x27')](db[_0x327f('0x28')]['rawAttributes'],function(_0x1e74fb){return{'name':_0x1e74fb[_0x327f('0x29')],'type':_0x1e74fb[_0x327f('0x2a')][_0x327f('0x2b')]};});_0x512ae1[_0x327f('0x2c')]=_[_0x327f('0x27')](_0xd9c084,_0x327f('0x25'));_0x512ae1[_0x327f('0x2d')]=_['keys'](_0x559740['query']);_0x512ae1[_0x327f('0x2e')]=_[_0x327f('0x2f')](_0x512ae1[_0x327f('0x2c')],_0x512ae1[_0x327f('0x2d')]);_0x54d26c[_0x327f('0x30')]=_[_0x327f('0x2f')](_0x512ae1[_0x327f('0x2c')],qs[_0x327f('0x31')](_0x559740[_0x327f('0x2d')][_0x327f('0x31')]));_0x54d26c['attributes']=_0x54d26c[_0x327f('0x30')][_0x327f('0x32')]?_0x54d26c[_0x327f('0x30')]:_0x512ae1[_0x327f('0x2c')];if(!_0x559740[_0x327f('0x2d')][_0x327f('0x33')]('nolimit')){_0x54d26c[_0x327f('0x1a')]=qs[_0x327f('0x1a')](_0x559740[_0x327f('0x2d')]['limit']);_0x54d26c[_0x327f('0x1c')]=qs[_0x327f('0x1c')](_0x559740[_0x327f('0x2d')]['offset']);}_0x54d26c[_0x327f('0x34')]=qs[_0x327f('0x35')](_0x559740[_0x327f('0x2d')][_0x327f('0x35')]);_0x54d26c[_0x327f('0x36')]=qs[_0x327f('0x2e')](_[_0x327f('0x37')](_0x559740[_0x327f('0x2d')],_0x512ae1[_0x327f('0x2e')]),_0xd9c084);if(_0x559740[_0x327f('0x2d')]['filter']){_0x54d26c[_0x327f('0x36')]=_[_0x327f('0x38')](_0x54d26c[_0x327f('0x36')],{'$or':_[_0x327f('0x27')](_0xd9c084,function(_0x5caf56){if(_0x5caf56[_0x327f('0x2a')]!==_0x327f('0x39')){var _0x98c214={};_0x98c214[_0x5caf56['name']]={'$like':'%'+_0x559740[_0x327f('0x2d')][_0x327f('0x3a')]+'%'};return _0x98c214;}})});}_0x54d26c=_['merge']({},_0x54d26c,_0x559740[_0x327f('0x3b')]);var _0x3e0fd={'where':_0x54d26c[_0x327f('0x36')]};return db[_0x327f('0x28')]['count'](_0x3e0fd)['then'](function(_0x4d36e6){_0x5a421c[_0x327f('0x1b')]=_0x4d36e6;if(_0x559740[_0x327f('0x2d')][_0x327f('0x3c')]){_0x54d26c['include']=[{'all':!![]}];}return db[_0x327f('0x28')][_0x327f('0x3d')](_0x54d26c);})[_0x327f('0x22')](function(_0x3c061e){_0x5a421c[_0x327f('0x3e')]=_0x3c061e;return _0x5a421c;})['then'](respondWithFilteredResult(_0x3b319d,_0x54d26c))[_0x327f('0x3f')](handleError(_0x3b319d,null));};exports[_0x327f('0x40')]=function(_0x4bda37,_0x5361b6){var _0x54b26e={'raw':!![],'where':{'id':_0x4bda37[_0x327f('0x41')]['id']}},_0x5f54fb={};_0x5f54fb['model']=_[_0x327f('0x42')](db[_0x327f('0x28')][_0x327f('0x43')]);_0x5f54fb['query']=_['keys'](_0x4bda37[_0x327f('0x2d')]);_0x5f54fb[_0x327f('0x2e')]=_['intersection'](_0x5f54fb[_0x327f('0x2c')],_0x5f54fb[_0x327f('0x2d')]);_0x54b26e[_0x327f('0x30')]=_['intersection'](_0x5f54fb[_0x327f('0x2c')],qs[_0x327f('0x31')](_0x4bda37[_0x327f('0x2d')][_0x327f('0x31')]));_0x54b26e['attributes']=_0x54b26e[_0x327f('0x30')]['length']?_0x54b26e[_0x327f('0x30')]:_0x5f54fb[_0x327f('0x2c')];if(_0x4bda37['query'][_0x327f('0x3c')]){_0x54b26e['include']=[{'all':!![]}];}_0x54b26e=_[_0x327f('0x38')]({},_0x54b26e,_0x4bda37[_0x327f('0x3b')]);return db[_0x327f('0x28')][_0x327f('0x44')](_0x54b26e)[_0x327f('0x22')](handleEntityNotFound(_0x5361b6,null))[_0x327f('0x22')](respondWithResult(_0x5361b6,null))[_0x327f('0x3f')](handleError(_0x5361b6,null));};exports[_0x327f('0x45')]=function(_0x566c63,_0x5bc9d0){return db[_0x327f('0x28')][_0x327f('0x45')](_0x566c63['body'],{})['then'](respondWithResult(_0x5bc9d0,0xc9))[_0x327f('0x3f')](handleError(_0x5bc9d0,null));};exports[_0x327f('0x21')]=function(_0x538b5c,_0x1137e2){if(_0x538b5c[_0x327f('0x46')]['id']){delete _0x538b5c[_0x327f('0x46')]['id'];}return db['VoiceQueuesLog'][_0x327f('0x44')]({'where':{'id':_0x538b5c['params']['id']}})[_0x327f('0x22')](handleEntityNotFound(_0x1137e2,null))[_0x327f('0x22')](saveUpdates(_0x538b5c[_0x327f('0x46')],null))[_0x327f('0x22')](respondWithResult(_0x1137e2,null))[_0x327f('0x3f')](handleError(_0x1137e2,null));};exports[_0x327f('0x47')]=function(_0x2d5b25,_0x3a493e){return db[_0x327f('0x28')]['find']({'where':{'id':_0x2d5b25['params']['id']}})['then'](handleEntityNotFound(_0x3a493e,null))[_0x327f('0x22')](removeEntity(_0x3a493e,null))['catch'](handleError(_0x3a493e,null));}; \ No newline at end of file +var _0xf77c=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','end','error','stack','name','send','map','VoiceQueuesLog','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','create','body','update','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xf77c,0x7f));var _0xcf77=function(_0x58bba8,_0x213d48){_0x58bba8=_0x58bba8-0x0;var _0x110a16=_0xf77c[_0x58bba8];return _0x110a16;};'use strict';var emlformat=require(_0xcf77('0x0'));var rimraf=require(_0xcf77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcf77('0x2'));var moment=require('moment');var BPromise=require(_0xcf77('0x3'));var Mustache=require(_0xcf77('0x4'));var util=require(_0xcf77('0x5'));var path=require(_0xcf77('0x6'));var sox=require(_0xcf77('0x7'));var csv=require(_0xcf77('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf77('0x9'));var _=require(_0xcf77('0xa'));var squel=require(_0xcf77('0xb'));var crypto=require(_0xcf77('0xc'));var jsforce=require(_0xcf77('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf77('0x8'));var querystring=require('querystring');var Papa=require(_0xcf77('0xe'));var Redis=require('ioredis');var authService=require(_0xcf77('0xf'));var qs=require(_0xcf77('0x10'));var as=require(_0xcf77('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf77('0x12'))(_0xcf77('0x13'));var utils=require(_0xcf77('0x14'));var config=require(_0xcf77('0x15'));var licenseUtil=require(_0xcf77('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x292e11,_0x1e08cb){_0x1e08cb=_0x1e08cb||0xcc;return function(_0x5b4545){if(_0x5b4545){return _0x292e11[_0xcf77('0x17')](_0x1e08cb);}return _0x292e11[_0xcf77('0x18')](_0x1e08cb)['end']();};}function respondWithResult(_0x513114,_0x117174){_0x117174=_0x117174||0xc8;return function(_0x31f4a8){if(_0x31f4a8){return _0x513114['status'](_0x117174)[_0xcf77('0x19')](_0x31f4a8);}};}function respondWithFilteredResult(_0x1e8d13,_0x47863c){return function(_0x333c60){if(_0x333c60){var _0x392101=typeof _0x47863c['offset']===_0xcf77('0x1a')&&typeof _0x47863c[_0xcf77('0x1b')]==='undefined';var _0x1470f6=_0x333c60[_0xcf77('0x1c')];var _0x339a84=_0x392101?0x0:_0x47863c['offset'];var _0x4a351e=_0x392101?_0x333c60[_0xcf77('0x1c')]:_0x47863c[_0xcf77('0x1d')]+_0x47863c[_0xcf77('0x1b')];var _0x9725e7;if(_0x4a351e>=_0x1470f6){_0x4a351e=_0x1470f6;_0x9725e7=0xc8;}else{_0x9725e7=0xce;}_0x1e8d13[_0xcf77('0x18')](_0x9725e7);return _0x1e8d13[_0xcf77('0x1e')](_0xcf77('0x1f'),_0x339a84+'-'+_0x4a351e+'/'+_0x1470f6)[_0xcf77('0x19')](_0x333c60);}return null;};}function patchUpdates(_0x2f63bd){return function(_0x256047){try{jsonpatch[_0xcf77('0x20')](_0x256047,_0x2f63bd,!![]);}catch(_0x48e3d0){return BPromise[_0xcf77('0x21')](_0x48e3d0);}return _0x256047['save']();};}function saveUpdates(_0xbbe2f5,_0x105036){return function(_0xcb97ff){if(_0xcb97ff){return _0xcb97ff['update'](_0xbbe2f5)['then'](function(_0x57f1af){return _0x57f1af;});}return null;};}function removeEntity(_0x3d4ed7,_0x460983){return function(_0x58ccbd){if(_0x58ccbd){return _0x58ccbd[_0xcf77('0x22')]()[_0xcf77('0x23')](function(){_0x3d4ed7['status'](0xcc)[_0xcf77('0x24')]();});}};}function handleEntityNotFound(_0x377938,_0x1bd5d9){return function(_0x26022c){if(!_0x26022c){_0x377938['sendStatus'](0x194);}return _0x26022c;};}function handleError(_0x13888b,_0x3bd393){_0x3bd393=_0x3bd393||0x1f4;return function(_0x5a01fd){logger[_0xcf77('0x25')](_0x5a01fd[_0xcf77('0x26')]);if(_0x5a01fd[_0xcf77('0x27')]){delete _0x5a01fd[_0xcf77('0x27')];}_0x13888b[_0xcf77('0x18')](_0x3bd393)[_0xcf77('0x28')](_0x5a01fd);};}exports['index']=function(_0x134795,_0x26cda0){var _0x3dd2fc={},_0x6cac64={},_0x19ce62={'count':0x0,'rows':[]};var _0x949e38=_[_0xcf77('0x29')](db[_0xcf77('0x2a')]['rawAttributes'],function(_0x3793f7){return{'name':_0x3793f7[_0xcf77('0x2b')],'type':_0x3793f7['type'][_0xcf77('0x2c')]};});_0x6cac64[_0xcf77('0x2d')]=_['map'](_0x949e38,_0xcf77('0x27'));_0x6cac64[_0xcf77('0x2e')]=_[_0xcf77('0x2f')](_0x134795['query']);_0x6cac64['filters']=_[_0xcf77('0x30')](_0x6cac64[_0xcf77('0x2d')],_0x6cac64[_0xcf77('0x2e')]);_0x3dd2fc[_0xcf77('0x31')]=_[_0xcf77('0x30')](_0x6cac64[_0xcf77('0x2d')],qs['fields'](_0x134795[_0xcf77('0x2e')][_0xcf77('0x32')]));_0x3dd2fc[_0xcf77('0x31')]=_0x3dd2fc[_0xcf77('0x31')]['length']?_0x3dd2fc[_0xcf77('0x31')]:_0x6cac64[_0xcf77('0x2d')];if(!_0x134795[_0xcf77('0x2e')][_0xcf77('0x33')](_0xcf77('0x34'))){_0x3dd2fc[_0xcf77('0x1b')]=qs[_0xcf77('0x1b')](_0x134795[_0xcf77('0x2e')][_0xcf77('0x1b')]);_0x3dd2fc[_0xcf77('0x1d')]=qs[_0xcf77('0x1d')](_0x134795[_0xcf77('0x2e')][_0xcf77('0x1d')]);}_0x3dd2fc[_0xcf77('0x35')]=qs[_0xcf77('0x36')](_0x134795[_0xcf77('0x2e')][_0xcf77('0x36')]);_0x3dd2fc[_0xcf77('0x37')]=qs[_0xcf77('0x38')](_[_0xcf77('0x39')](_0x134795[_0xcf77('0x2e')],_0x6cac64['filters']),_0x949e38);if(_0x134795[_0xcf77('0x2e')][_0xcf77('0x3a')]){_0x3dd2fc[_0xcf77('0x37')]=_[_0xcf77('0x3b')](_0x3dd2fc[_0xcf77('0x37')],{'$or':_[_0xcf77('0x29')](_0x949e38,function(_0x331f11){if(_0x331f11['type']!=='VIRTUAL'){var _0x5d97ad={};_0x5d97ad[_0x331f11['name']]={'$like':'%'+_0x134795[_0xcf77('0x2e')][_0xcf77('0x3a')]+'%'};return _0x5d97ad;}})});}_0x3dd2fc=_[_0xcf77('0x3b')]({},_0x3dd2fc,_0x134795[_0xcf77('0x3c')]);var _0x3880b3={'where':_0x3dd2fc[_0xcf77('0x37')]};return db[_0xcf77('0x2a')][_0xcf77('0x1c')](_0x3880b3)['then'](function(_0x4ccb3c){_0x19ce62[_0xcf77('0x1c')]=_0x4ccb3c;if(_0x134795[_0xcf77('0x2e')][_0xcf77('0x3d')]){_0x3dd2fc[_0xcf77('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xcf77('0x3f')](_0x3dd2fc);})[_0xcf77('0x23')](function(_0x1b3715){_0x19ce62['rows']=_0x1b3715;return _0x19ce62;})[_0xcf77('0x23')](respondWithFilteredResult(_0x26cda0,_0x3dd2fc))['catch'](handleError(_0x26cda0,null));};exports[_0xcf77('0x40')]=function(_0x1466ac,_0x2eca0d){var _0x741599={'raw':!![],'where':{'id':_0x1466ac[_0xcf77('0x41')]['id']}},_0x1343ff={};_0x1343ff[_0xcf77('0x2d')]=_[_0xcf77('0x2f')](db['VoiceQueuesLog'][_0xcf77('0x42')]);_0x1343ff[_0xcf77('0x2e')]=_['keys'](_0x1466ac[_0xcf77('0x2e')]);_0x1343ff[_0xcf77('0x38')]=_[_0xcf77('0x30')](_0x1343ff[_0xcf77('0x2d')],_0x1343ff[_0xcf77('0x2e')]);_0x741599[_0xcf77('0x31')]=_[_0xcf77('0x30')](_0x1343ff[_0xcf77('0x2d')],qs[_0xcf77('0x32')](_0x1466ac['query'][_0xcf77('0x32')]));_0x741599[_0xcf77('0x31')]=_0x741599[_0xcf77('0x31')][_0xcf77('0x43')]?_0x741599['attributes']:_0x1343ff[_0xcf77('0x2d')];if(_0x1466ac['query']['includeAll']){_0x741599[_0xcf77('0x3e')]=[{'all':!![]}];}_0x741599=_[_0xcf77('0x3b')]({},_0x741599,_0x1466ac[_0xcf77('0x3c')]);return db[_0xcf77('0x2a')][_0xcf77('0x44')](_0x741599)['then'](handleEntityNotFound(_0x2eca0d,null))[_0xcf77('0x23')](respondWithResult(_0x2eca0d,null))[_0xcf77('0x45')](handleError(_0x2eca0d,null));};exports['create']=function(_0x48d020,_0xbb59df){return db[_0xcf77('0x2a')][_0xcf77('0x46')](_0x48d020[_0xcf77('0x47')],{})[_0xcf77('0x23')](respondWithResult(_0xbb59df,0xc9))[_0xcf77('0x45')](handleError(_0xbb59df,null));};exports[_0xcf77('0x48')]=function(_0x322073,_0x278768){if(_0x322073['body']['id']){delete _0x322073[_0xcf77('0x47')]['id'];}return db[_0xcf77('0x2a')][_0xcf77('0x44')]({'where':{'id':_0x322073[_0xcf77('0x41')]['id']}})['then'](handleEntityNotFound(_0x278768,null))['then'](saveUpdates(_0x322073[_0xcf77('0x47')],null))['then'](respondWithResult(_0x278768,null))[_0xcf77('0x45')](handleError(_0x278768,null));};exports[_0xcf77('0x22')]=function(_0x5a451b,_0x3b7a01){return db[_0xcf77('0x2a')][_0xcf77('0x44')]({'where':{'id':_0x5a451b[_0xcf77('0x41')]['id']}})[_0xcf77('0x23')](handleEntityNotFound(_0x3b7a01,null))['then'](removeEntity(_0x3b7a01,null))[_0xcf77('0x45')](handleError(_0x3b7a01,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3ced935..449a0b0 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 _0x20a2=['moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','dtm','lodash','api'];(function(_0xb2a97b,_0x26767b){var _0x49f9a8=function(_0x59514a){while(--_0x59514a){_0xb2a97b['push'](_0xb2a97b['shift']());}};_0x49f9a8(++_0x26767b);}(_0x20a2,0x102));var _0x220a=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x20a2[_0x361d3f];return _0x320229;};'use strict';var _=require(_0x220a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x220a('0x1'));var moment=require(_0x220a('0x2'));var BPromise=require(_0x220a('0x3'));var rp=require(_0x220a('0x4'));var fs=require('fs');var path=require(_0x220a('0x5'));var rimraf=require(_0x220a('0x6'));var config=require('../../config/environment');var attributes=require(_0x220a('0x7'));module[_0x220a('0x8')]=function(_0x1ccdf4,_0x1a69f8){return _0x1ccdf4[_0x220a('0x9')](_0x220a('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x220a('0xb'),_0x220a('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf4e7=['exports','define','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceQueuesLog.attributes'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xf4e7,0x139));var _0x7f4e=function(_0x325fb0,_0x9c223d){_0x325fb0=_0x325fb0-0x0;var _0x92b926=_0xf4e7[_0x325fb0];return _0x92b926;};'use strict';var _=require(_0x7f4e('0x0'));var util=require(_0x7f4e('0x1'));var logger=require(_0x7f4e('0x2'))(_0x7f4e('0x3'));var moment=require(_0x7f4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7f4e('0x5'));var fs=require('fs');var path=require(_0x7f4e('0x6'));var rimraf=require(_0x7f4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7f4e('0x8'));module[_0x7f4e('0x9')]=function(_0x5d989d,_0x41666d){return _0x5d989d[_0x7f4e('0xa')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x7f4e('0xb'),'fields':[_0x7f4e('0xc'),_0x7f4e('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 451df94..41f29a5 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 _0x4e3c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0x4e3c,0x1b4));var _0xc4e3=function(_0x3be2a0,_0x30d5af){_0x3be2a0=_0x3be2a0-0x0;var _0x130828=_0x4e3c[_0x3be2a0];return _0x130828;};'use strict';var _=require('lodash');var util=require(_0xc4e3('0x0'));var moment=require(_0xc4e3('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4e3('0x2'));var fs=require('fs');var Redis=require(_0xc4e3('0x3'));var db=require(_0xc4e3('0x4'))['db'];var utils=require(_0xc4e3('0x5'));var logger=require(_0xc4e3('0x6'))(_0xc4e3('0x7'));var config=require(_0xc4e3('0x8'));var jayson=require(_0xc4e3('0x9'));var client=jayson[_0xc4e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3884a6,_0x56c2ec,_0x376a84){return new BPromise(function(_0x497fbc,_0x195625){return client['request'](_0x3884a6,_0x376a84)['then'](function(_0x328212){logger['info'](_0xc4e3('0xb'),_0x56c2ec,_0xc4e3('0xc'));logger[_0xc4e3('0xd')](_0xc4e3('0xe'),_0x56c2ec,_0xc4e3('0xc'),JSON[_0xc4e3('0xf')](_0x328212));if(_0x328212['error']){if(_0x328212[_0xc4e3('0x10')][_0xc4e3('0x11')]===0x1f4){logger[_0xc4e3('0x10')](_0xc4e3('0xb'),_0x56c2ec,_0x328212['error'][_0xc4e3('0x12')]);return _0x195625(_0x328212[_0xc4e3('0x10')]['message']);}logger[_0xc4e3('0x10')](_0xc4e3('0xb'),_0x56c2ec,_0x328212[_0xc4e3('0x10')][_0xc4e3('0x12')]);return _0x497fbc(_0x328212[_0xc4e3('0x10')][_0xc4e3('0x12')]);}else{logger[_0xc4e3('0x13')](_0xc4e3('0xb'),_0x56c2ec,_0xc4e3('0xc'));_0x497fbc(_0x328212[_0xc4e3('0x14')]['message']);}})[_0xc4e3('0x15')](function(_0x1920f8){logger[_0xc4e3('0x10')](_0xc4e3('0xb'),_0x56c2ec,_0x1920f8);_0x195625(_0x1920f8);});});} \ No newline at end of file +var _0xc7ad=['error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x101dce,_0x3b887c){var _0x5a92bb=function(_0x5bac04){while(--_0x5bac04){_0x101dce['push'](_0x101dce['shift']());}};_0x5a92bb(++_0x3b887c);}(_0xc7ad,0xca));var _0xdc7a=function(_0x2cda30,_0x468a36){_0x2cda30=_0x2cda30-0x0;var _0x5869d3=_0xc7ad[_0x2cda30];return _0x5869d3;};'use strict';var _=require(_0xdc7a('0x0'));var util=require(_0xdc7a('0x1'));var moment=require(_0xdc7a('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc7a('0x4'));var logger=require('../../config/logger')(_0xdc7a('0x5'));var config=require(_0xdc7a('0x6'));var jayson=require(_0xdc7a('0x7'));var client=jayson[_0xdc7a('0x8')][_0xdc7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a3bff,_0x8116ca,_0x11158e){return new BPromise(function(_0xcd0a4f,_0x261d79){return client[_0xdc7a('0xa')](_0x1a3bff,_0x11158e)[_0xdc7a('0xb')](function(_0x4dd06f){logger[_0xdc7a('0xc')](_0xdc7a('0xd'),_0x8116ca,_0xdc7a('0xe'));logger[_0xdc7a('0xf')](_0xdc7a('0x10'),_0x8116ca,_0xdc7a('0xe'),JSON[_0xdc7a('0x11')](_0x4dd06f));if(_0x4dd06f[_0xdc7a('0x12')]){if(_0x4dd06f[_0xdc7a('0x12')][_0xdc7a('0x13')]===0x1f4){logger['error'](_0xdc7a('0xd'),_0x8116ca,_0x4dd06f['error'][_0xdc7a('0x14')]);return _0x261d79(_0x4dd06f[_0xdc7a('0x12')]['message']);}logger[_0xdc7a('0x12')](_0xdc7a('0xd'),_0x8116ca,_0x4dd06f[_0xdc7a('0x12')]['message']);return _0xcd0a4f(_0x4dd06f[_0xdc7a('0x12')][_0xdc7a('0x14')]);}else{logger[_0xdc7a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x8116ca,_0xdc7a('0xe'));_0xcd0a4f(_0x4dd06f['result']['message']);}})[_0xdc7a('0x15')](function(_0x12c2ad){logger[_0xdc7a('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x8116ca,_0x12c2ad);_0x261d79(_0x12c2ad);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 70a769e..3a6a1a8 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 _0x4e12=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','/:id','update','destroy','exports','multer','util','path','Router'];(function(_0x33eb89,_0x28c84c){var _0x574524=function(_0x3c6b65){while(--_0x3c6b65){_0x33eb89['push'](_0x33eb89['shift']());}};_0x574524(++_0x28c84c);}(_0x4e12,0x182));var _0x24e1=function(_0x1f4cc4,_0x181bcb){_0x1f4cc4=_0x1f4cc4-0x0;var _0x34c773=_0x4e12[_0x1f4cc4];return _0x34c773;};'use strict';var multer=require(_0x24e1('0x0'));var util=require(_0x24e1('0x1'));var path=require(_0x24e1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x24e1('0x3')]();var fs_extra=require(_0x24e1('0x4'));var auth=require(_0x24e1('0x5'));var interaction=require(_0x24e1('0x6'));var config=require(_0x24e1('0x7'));var controller=require('./voiceRecording.controller');router[_0x24e1('0x8')]('/',auth[_0x24e1('0x9')](),controller[_0x24e1('0xa')]);router[_0x24e1('0x8')](_0x24e1('0xb'),auth[_0x24e1('0x9')](),controller[_0x24e1('0xc')]);router[_0x24e1('0x8')]('/:id',auth[_0x24e1('0x9')](),controller[_0x24e1('0xd')]);router[_0x24e1('0x8')]('/:id/download',auth[_0x24e1('0x9')](),controller['download']);router[_0x24e1('0x8')](_0x24e1('0xe'),controller[_0x24e1('0xf')]);router[_0x24e1('0x8')]('/:id/transcribe',auth[_0x24e1('0x9')](),controller[_0x24e1('0x10')]);router[_0x24e1('0x11')]('/',auth[_0x24e1('0x9')](),controller[_0x24e1('0x12')]);router[_0x24e1('0x11')](_0x24e1('0x13'),auth[_0x24e1('0x9')](),controller[_0x24e1('0x14')]);router[_0x24e1('0x15')](_0x24e1('0x16'),auth['isAuthenticated'](),controller[_0x24e1('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x24e1('0x18')]);module[_0x24e1('0x19')]=router; \ No newline at end of file +var _0x6d96=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','util','path','express'];(function(_0x245a43,_0x2bf0b8){var _0xe97427=function(_0x17e38a){while(--_0x17e38a){_0x245a43['push'](_0x245a43['shift']());}};_0xe97427(++_0x2bf0b8);}(_0x6d96,0x105));var _0x66d9=function(_0x48fc43,_0x38c553){_0x48fc43=_0x48fc43-0x0;var _0x37fb79=_0x6d96[_0x48fc43];return _0x37fb79;};'use strict';var multer=require('multer');var util=require(_0x66d9('0x0'));var path=require(_0x66d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x66d9('0x2'));var router=express[_0x66d9('0x3')]();var fs_extra=require(_0x66d9('0x4'));var auth=require(_0x66d9('0x5'));var interaction=require(_0x66d9('0x6'));var config=require(_0x66d9('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x66d9('0x8')](),controller['index']);router[_0x66d9('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x66d9('0xa'),auth['isAuthenticated'](),controller[_0x66d9('0xb')]);router[_0x66d9('0x9')](_0x66d9('0xc'),auth[_0x66d9('0x8')](),controller[_0x66d9('0xd')]);router[_0x66d9('0x9')](_0x66d9('0xe'),controller['downloads']);router[_0x66d9('0x9')](_0x66d9('0xf'),auth[_0x66d9('0x8')](),controller[_0x66d9('0x10')]);router[_0x66d9('0x11')]('/',auth[_0x66d9('0x8')](),controller['create']);router['post'](_0x66d9('0xf'),auth[_0x66d9('0x8')](),controller[_0x66d9('0x12')]);router[_0x66d9('0x13')](_0x66d9('0xa'),auth[_0x66d9('0x8')](),controller[_0x66d9('0x14')]);router[_0x66d9('0x15')](_0x66d9('0xa'),auth['isAuthenticated'](),controller[_0x66d9('0x16')]);module[_0x66d9('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c83af08..0948f69 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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 9c0952b..0327572 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 _0x3a56=['apply','reject','save','update','then','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','token','$and','push','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x3ee499,_0x5cd536){var _0xcff964=function(_0x4da1ea){while(--_0x4da1ea){_0x3ee499['push'](_0x3ee499['shift']());}};_0xcff964(++_0x5cd536);}(_0x3a56,0x73));var _0x63a5=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x3a56[_0x4e4f0e];return _0x1a7219;};'use strict';var emlformat=require(_0x63a5('0x0'));var rimraf=require(_0x63a5('0x1'));var zipdir=require(_0x63a5('0x2'));var jsonpatch=require(_0x63a5('0x3'));var rp=require(_0x63a5('0x4'));var moment=require(_0x63a5('0x5'));var BPromise=require(_0x63a5('0x6'));var Mustache=require(_0x63a5('0x7'));var util=require(_0x63a5('0x8'));var path=require(_0x63a5('0x9'));var sox=require(_0x63a5('0xa'));var csv=require(_0x63a5('0xb'));var ejs=require(_0x63a5('0xc'));var fs=require('fs');var fs_extra=require(_0x63a5('0xd'));var _=require(_0x63a5('0xe'));var squel=require(_0x63a5('0xf'));var crypto=require(_0x63a5('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x63a5('0x11'));var AWS=require(_0x63a5('0x12'));var uuidv4=require('uuid/v4');var Redis=require(_0x63a5('0x13'));var authService=require(_0x63a5('0x14'));var qs=require(_0x63a5('0x15'));var as=require(_0x63a5('0x16'));var hardwareService=require(_0x63a5('0x17'));var logger=require(_0x63a5('0x18'))(_0x63a5('0x19'));var utils=require(_0x63a5('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b9f2a,_0x384cfe){_0x384cfe=_0x384cfe||0xcc;return function(_0x59d01d){if(_0x59d01d){return _0x5b9f2a[_0x63a5('0x1b')](_0x384cfe);}return _0x5b9f2a['status'](_0x384cfe)['end']();};}function respondWithResult(_0x39208b,_0x499b71){_0x499b71=_0x499b71||0xc8;return function(_0x1f37c8){if(_0x1f37c8){return _0x39208b[_0x63a5('0x1c')](_0x499b71)[_0x63a5('0x1d')](_0x1f37c8);}};}function respondWithFilteredResult(_0x5f2619,_0x129f1a){return function(_0x440d77){if(_0x440d77){var _0x51cdb5=typeof _0x129f1a[_0x63a5('0x1e')]===_0x63a5('0x1f')&&typeof _0x129f1a[_0x63a5('0x20')]===_0x63a5('0x1f');var _0x760d57=_0x440d77[_0x63a5('0x21')];var _0x442fa8=_0x51cdb5?0x0:_0x129f1a['offset'];var _0x4c91d3=_0x51cdb5?_0x440d77[_0x63a5('0x21')]:_0x129f1a[_0x63a5('0x1e')]+_0x129f1a[_0x63a5('0x20')];var _0x2f50a7;if(_0x4c91d3>=_0x760d57){_0x4c91d3=_0x760d57;_0x2f50a7=0xc8;}else{_0x2f50a7=0xce;}_0x5f2619[_0x63a5('0x1c')](_0x2f50a7);return _0x5f2619['set'](_0x63a5('0x22'),_0x442fa8+'-'+_0x4c91d3+'/'+_0x760d57)['json'](_0x440d77);}return null;};}function patchUpdates(_0x395601){return function(_0x1cac7c){try{jsonpatch[_0x63a5('0x23')](_0x1cac7c,_0x395601,!![]);}catch(_0x594a37){return BPromise[_0x63a5('0x24')](_0x594a37);}return _0x1cac7c[_0x63a5('0x25')]();};}function saveUpdates(_0x489399,_0x985b46){return function(_0x23e27f){if(_0x23e27f){return _0x23e27f[_0x63a5('0x26')](_0x489399)[_0x63a5('0x27')](function(_0x50de1e){return _0x50de1e;});}return null;};}function removeEntity(_0x290426,_0x41085b){return function(_0x31b7aa){if(_0x31b7aa){return _0x31b7aa['destroy']()[_0x63a5('0x27')](function(){_0x290426[_0x63a5('0x1c')](0xcc)[_0x63a5('0x28')]();});}};}function handleEntityNotFound(_0xa44fcc,_0x37562d){return function(_0x436e7e){if(!_0x436e7e){_0xa44fcc[_0x63a5('0x1b')](0x194);}return _0x436e7e;};}function handleError(_0x11ae2e,_0x7f396b){_0x7f396b=_0x7f396b||0x1f4;return function(_0x22e8f0){logger[_0x63a5('0x29')](_0x22e8f0[_0x63a5('0x2a')]);if(_0x22e8f0['name']){delete _0x22e8f0[_0x63a5('0x2b')];}_0x11ae2e[_0x63a5('0x1c')](_0x7f396b)[_0x63a5('0x2c')](_0x22e8f0);};}exports[_0x63a5('0x2d')]=function(_0x5bfa4c,_0x61393e){var _0x1b08a5={},_0x2e5337={},_0x3845b9={'count':0x0,'rows':[]};var _0x103169=_[_0x63a5('0x2e')](db[_0x63a5('0x2f')][_0x63a5('0x30')],function(_0x4d8868){return{'name':_0x4d8868[_0x63a5('0x31')],'type':_0x4d8868[_0x63a5('0x32')]['key']};});_0x2e5337[_0x63a5('0x33')]=_[_0x63a5('0x34')](_[_0x63a5('0x2e')](_0x103169,_0x63a5('0x2b')),['format']);_0x2e5337[_0x63a5('0x35')]=_[_0x63a5('0x36')](_0x5bfa4c['query']);_0x2e5337[_0x63a5('0x37')]=_[_0x63a5('0x38')](_0x2e5337[_0x63a5('0x33')],_0x2e5337[_0x63a5('0x35')]);_0x1b08a5[_0x63a5('0x39')]=_[_0x63a5('0x38')](_0x2e5337[_0x63a5('0x33')],qs[_0x63a5('0x3a')](_0x5bfa4c[_0x63a5('0x35')][_0x63a5('0x3a')]));_0x1b08a5['attributes']=_0x1b08a5[_0x63a5('0x39')][_0x63a5('0x3b')]?_0x1b08a5[_0x63a5('0x39')]:_0x2e5337[_0x63a5('0x33')];if(!_0x5bfa4c[_0x63a5('0x35')][_0x63a5('0x3c')]('nolimit')){_0x1b08a5['limit']=qs['limit'](_0x5bfa4c[_0x63a5('0x35')][_0x63a5('0x20')]);_0x1b08a5['offset']=qs['offset'](_0x5bfa4c['query']['offset']);}_0x1b08a5[_0x63a5('0x3d')]=qs['sort'](_0x5bfa4c[_0x63a5('0x35')][_0x63a5('0x3e')]);_0x1b08a5[_0x63a5('0x3f')]=qs[_0x63a5('0x37')](_['pick'](_0x5bfa4c[_0x63a5('0x35')],_0x2e5337[_0x63a5('0x37')]),_0x103169);if(_0x5bfa4c[_0x63a5('0x35')]['filter']){_0x1b08a5['where']=_[_0x63a5('0x40')](_0x1b08a5[_0x63a5('0x3f')],{'$or':_[_0x63a5('0x2e')](_0x103169,function(_0x5873f3){if(_0x5873f3[_0x63a5('0x32')]!==_0x63a5('0x41')){var _0x4b4a11={};_0x4b4a11[_0x5873f3['name']]={'$like':'%'+_0x5bfa4c['query'][_0x63a5('0x42')]+'%'};return _0x4b4a11;}})});}_0x1b08a5=_[_0x63a5('0x40')]({},_0x1b08a5,_0x5bfa4c[_0x63a5('0x43')]);var _0x4462c8={'where':_0x1b08a5[_0x63a5('0x3f')]};return db['VoiceRecording'][_0x63a5('0x21')](_0x4462c8)[_0x63a5('0x27')](function(_0x3dee61){_0x3845b9[_0x63a5('0x21')]=_0x3dee61;if(_0x5bfa4c['query'][_0x63a5('0x44')]){_0x1b08a5['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x63a5('0x45')](_0x1b08a5);})['then'](function(_0x421bad){_0x3845b9[_0x63a5('0x46')]=_0x421bad;return _0x3845b9;})[_0x63a5('0x27')](respondWithFilteredResult(_0x61393e,_0x1b08a5))[_0x63a5('0x47')](handleError(_0x61393e,null));};exports['show']=function(_0x5692d4,_0x865bd){var _0x177da2={'raw':![],'where':{'id':_0x5692d4[_0x63a5('0x48')]['id']}},_0x3a0a73={};_0x3a0a73[_0x63a5('0x33')]=_['keys'](db[_0x63a5('0x2f')]['rawAttributes']);_0x3a0a73[_0x63a5('0x35')]=_[_0x63a5('0x36')](_0x5692d4[_0x63a5('0x35')]);_0x3a0a73['filters']=_[_0x63a5('0x38')](_0x3a0a73[_0x63a5('0x33')],_0x3a0a73[_0x63a5('0x35')]);_0x177da2[_0x63a5('0x39')]=_[_0x63a5('0x38')](_0x3a0a73[_0x63a5('0x33')],qs[_0x63a5('0x3a')](_0x5692d4[_0x63a5('0x35')][_0x63a5('0x3a')]));_0x177da2[_0x63a5('0x39')]=_0x177da2[_0x63a5('0x39')]['length']?_0x177da2[_0x63a5('0x39')]:_0x3a0a73['model'];if(_0x5692d4[_0x63a5('0x35')][_0x63a5('0x44')]){_0x177da2['include']=[{'all':!![]}];}_0x177da2=_[_0x63a5('0x40')]({},_0x177da2,_0x5692d4[_0x63a5('0x43')]);return db[_0x63a5('0x2f')][_0x63a5('0x49')](_0x177da2)['then'](handleEntityNotFound(_0x865bd,null))['then'](respondWithResult(_0x865bd,null))[_0x63a5('0x47')](handleError(_0x865bd,null));};exports['create']=function(_0x59d213,_0x107b88){return db['VoiceRecording'][_0x63a5('0x4a')](_0x59d213[_0x63a5('0x4b')],{})[_0x63a5('0x27')](respondWithResult(_0x107b88,0xc9))[_0x63a5('0x47')](handleError(_0x107b88,null));};exports[_0x63a5('0x26')]=function(_0x9aa214,_0x36b20c){if(_0x9aa214[_0x63a5('0x4b')]['id']){delete _0x9aa214[_0x63a5('0x4b')]['id'];}return db[_0x63a5('0x2f')][_0x63a5('0x49')]({'where':{'id':_0x9aa214[_0x63a5('0x48')]['id']}})[_0x63a5('0x27')](handleEntityNotFound(_0x36b20c,null))['then'](saveUpdates(_0x9aa214['body'],null))[_0x63a5('0x27')](respondWithResult(_0x36b20c,null))['catch'](handleError(_0x36b20c,null));};exports[_0x63a5('0x4c')]=function(_0x3c2352,_0x91bb74){return db['VoiceRecording'][_0x63a5('0x4c')]()['then'](respondWithResult(_0x91bb74,null))['catch'](handleError(_0x91bb74,null));};exports[_0x63a5('0x4d')]=function(_0x4a0557,_0x5cc89b,_0xe2f66c){var _0x5346d7=require(_0x63a5('0x4e'));var _0x132820=![];var _0x3ed3c5={};if(_0x4a0557[_0x63a5('0x35')][_0x63a5('0x32')]&&_0x4a0557[_0x63a5('0x35')][_0x63a5('0x32')]===_0x63a5('0x4f')){_0x3ed3c5[_0x63a5('0x4f')]=_0x4a0557['params']['id'];}else{_0x3ed3c5['id']=_0x4a0557[_0x63a5('0x48')]['id'];}return db[_0x63a5('0x2f')][_0x63a5('0x49')]({'where':_0x3ed3c5,'attributes':['id',_0x63a5('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x5cc89b,null))[_0x63a5('0x27')](function(_0x4b01ac){if(_0x4b01ac){var _0x1821f9=_0x4b01ac[_0x63a5('0x50')];var _0x8c43aa=util[_0x63a5('0x51')](_0x63a5('0x52'),_0x1821f9);if(fs[_0x63a5('0x53')](_0x8c43aa)){_0x132820=!![];return _0x5346d7[_0x63a5('0x54')](_0x8c43aa,_0x1821f9,config[_0x63a5('0x55')]['recording'])[_0x63a5('0x27')](function(){return _0x4b01ac;});}return _0x4b01ac;}})['then'](function(_0x315351){if(_0x315351){var _0x2b24e6=_0x315351[_0x63a5('0x50')];if(!fs[_0x63a5('0x53')](_0x2b24e6)){throw new db[(_0x63a5('0x56'))][(_0x63a5('0x57'))](_0x63a5('0x58'));}if(_0x315351[_0x63a5('0x59')]){return _0x5cc89b[_0x63a5('0x4d')](_0x2b24e6,_0x315351[_0x63a5('0x59')]+path[_0x63a5('0x5a')](_0x2b24e6),function(){if(_0x132820){fs[_0x63a5('0x5b')](_0x2b24e6);}});}else{return _0x5cc89b['download'](_0x2b24e6,function(_0x20f5da){if(_0x132820){fs[_0x63a5('0x5b')](_0x2b24e6);}});}}})[_0x63a5('0x47')](function(_0xff95d5){if(_0xff95d5['message']===_0x63a5('0x58')){_0x5cc89b['status'](0x194)[_0x63a5('0x2c')](_0x63a5('0x5c'));}else{return handleError(_0x5cc89b,null);}});};exports[_0x63a5('0x5d')]=function(_0x398b9a,_0x2ba755,_0x1a0d1e){var _0x32d53c=require(_0x63a5('0x4e'));var _0x5f5d3c=![];var _0xd71567={'$and':[db['sequelize'][_0x63a5('0x3f')](db['sequelize']['fn']('MD5',db['sequelize']['col'](_0x63a5('0x4f'))),_0x398b9a[_0x63a5('0x35')][_0x63a5('0x5e')])]};if(_0x398b9a[_0x63a5('0x35')][_0x63a5('0x32')]&&_0x398b9a[_0x63a5('0x35')]['type']===_0x63a5('0x4f')){_0xd71567[_0x63a5('0x5f')]['push']({'uniqueid':_0x398b9a[_0x63a5('0x48')]['id']});}else{_0xd71567[_0x63a5('0x5f')][_0x63a5('0x60')]({'id':_0x398b9a[_0x63a5('0x48')]['id']});}return db[_0x63a5('0x2f')]['find']({'where':_0xd71567,'attributes':['id',_0x63a5('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x2ba755,null))[_0x63a5('0x27')](function(_0x4b3730){if(_0x4b3730){var _0x4ec953=util[_0x63a5('0x51')](_0x63a5('0x52'),_0x4b3730['value']);if(fs[_0x63a5('0x53')](_0x4ec953)){_0x5f5d3c=!![];return _0x32d53c[_0x63a5('0x54')](_0x4ec953,_0x4b3730[_0x63a5('0x50')],config[_0x63a5('0x55')][_0x63a5('0x61')])[_0x63a5('0x27')](function(){return _0x4b3730;});}return _0x4b3730;}})[_0x63a5('0x27')](function(_0x335a72){if(_0x335a72){if(!fs[_0x63a5('0x53')](_0x335a72[_0x63a5('0x50')])){throw new db['Sequelize'][(_0x63a5('0x57'))](_0x63a5('0x58'));}if(_0x335a72[_0x63a5('0x59')]){return _0x2ba755['download'](_0x335a72[_0x63a5('0x50')],_0x335a72[_0x63a5('0x59')]+path[_0x63a5('0x5a')](_0x335a72[_0x63a5('0x50')]),function(){if(_0x5f5d3c){fs[_0x63a5('0x5b')](_0x335a72[_0x63a5('0x50')]);}});}else{return _0x2ba755[_0x63a5('0x4d')](_0x335a72[_0x63a5('0x50')],function(_0x2c12ab){if(_0x5f5d3c){fs[_0x63a5('0x5b')](_0x335a72[_0x63a5('0x50')]);}});}}})[_0x63a5('0x47')](handleError(_0x2ba755,null));};exports['destroy']=function(_0x354e1e,_0x16ac8b){return db[_0x63a5('0x2f')][_0x63a5('0x49')]({'where':{'id':_0x354e1e[_0x63a5('0x48')]['id']}})[_0x63a5('0x27')](function(_0x6f22f5){if(_[_0x63a5('0x62')](_0x6f22f5)){throw new ReferenceError(_0x63a5('0x63'));}return _0x6f22f5;})[_0x63a5('0x27')](function(_0x107638){var _0x4455ac=_0x107638['value'];logger[_0x63a5('0x64')](_0x63a5('0x65'),_0x4455ac);if(!_['isNil'](_0x107638['value'])&&fs[_0x63a5('0x53')](_0x4455ac)){logger[_0x63a5('0x64')]('File:\x20\x22'+_0x4455ac+_0x63a5('0x66'));fs[_0x63a5('0x67')](_0x4455ac);}_0x4455ac=_0x4455ac+_0x63a5('0x68');if(!_[_0x63a5('0x62')](_0x107638[_0x63a5('0x50')])&&fs[_0x63a5('0x53')](_0x4455ac)){logger[_0x63a5('0x64')](_0x63a5('0x69')+_0x4455ac+_0x63a5('0x66'));fs[_0x63a5('0x67')](_0x4455ac);}return _0x107638;})['then'](function(_0x121379){if(!_0x121379)throw new InternalError();return _0x121379['destroy']();})['then'](function(){_0x16ac8b[_0x63a5('0x1c')](0xcc)[_0x63a5('0x28')]();})[_0x63a5('0x47')](handleError(_0x16ac8b,null));};function getBucketslist(_0x4462b3,_0x588cd3,_0x528ef6){return new Promise(function(_0xfc060,_0x1cb3fd){var _0x47e92d=new AWS['S3']({'accessKeyId':_0x588cd3,'secretAccessKey':_0x4462b3,'region':_0x528ef6});_0x47e92d[_0x63a5('0x6a')]({},function(_0x474804,_0x3946ca){if(_0x474804){return _0x1cb3fd(_0x474804);}else{return _0xfc060(_0x3946ca);}});});}function createBucket(_0x5b746c,_0x2e53db,_0x65928d,_0x261207){return new Promise(function(_0x4210f1,_0x477072){var _0x12c4d9=new AWS['S3']({'accessKeyId':_0x2e53db,'secretAccessKey':_0x5b746c,'region':_0x65928d});_0x12c4d9[_0x63a5('0x6b')]({'Bucket':_0x261207},function(_0x295336,_0x5f4af1){if(_0x295336){return _0x477072(_0x295336);}else{return _0x4210f1(_0x5f4af1);}});});}function uploadFile(_0xd11ad5,_0x1eeb77,_0x44917d,_0xed1ae,_0xf7e1ff,_0x382e46){return new Promise(function(_0x4f2449,_0x1bf6da){var _0x47e0b7=new AWS['S3']({'accessKeyId':_0x1eeb77,'secretAccessKey':_0xd11ad5,'region':_0x44917d});_0x47e0b7[_0x63a5('0x6c')]({'Bucket':_0xed1ae,'Key':_0xf7e1ff,'Body':_0x382e46},function(_0x1c3652,_0x550c4b){if(_0x1c3652){return _0x1bf6da(_0x1c3652);}else{return _0x4f2449(_0x550c4b);}});});}function startTranscribe(_0x187b1b,_0xf4a9d4,_0x3e1a9b,_0x1e368a,_0x29e27b,_0xa18bc1){return new Promise(function(_0x178be5,_0x169d94){var _0x62b377=new AWS[(_0x63a5('0x6d'))]({'accessKeyId':_0xf4a9d4,'secretAccessKey':_0x187b1b,'region':_0x3e1a9b});_0x62b377[_0x63a5('0x6e')]({'TranscriptionJobName':_0x1e368a,'LanguageCode':_0x29e27b,'Media':{'MediaFileUri':_0xa18bc1}},function(_0x40c4f7,_0x5ac6a7){if(_0x40c4f7){return _0x169d94(_0x40c4f7);}else{return _0x178be5(_0x5ac6a7);}});});}function transcribe(_0x495282,_0xac0c4b,_0x54fb0a,_0x3afca2,_0x4262ea,_0x120c2c,_0x393d00){return new Promise(function(_0x523c34,_0xaf8674){var _0xbe8355={};logger[_0x63a5('0x64')](util[_0x63a5('0x51')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x495282,_0x4262ea));return uploadFile(_0xac0c4b,_0x54fb0a,_0x3afca2,_0x4262ea,path[_0x63a5('0x6f')](_0x120c2c),fs[_0x63a5('0x70')](_0x120c2c))[_0x63a5('0x27')](function(_0x36e485){logger[_0x63a5('0x64')](util[_0x63a5('0x51')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x495282,_0x4262ea,_0x36e485[_0x63a5('0x71')]));_0xbe8355[_0x63a5('0x72')]=_0x36e485[_0x63a5('0x73')];_0xbe8355[_0x63a5('0x74')]=_0x36e485[_0x63a5('0x71')];logger[_0x63a5('0x64')](util[_0x63a5('0x51')](_0x63a5('0x75'),_0x495282));return startTranscribe(_0xac0c4b,_0x54fb0a,_0x3afca2,uuidv4(),_0x393d00,_0x36e485[_0x63a5('0x71')]);})[_0x63a5('0x27')](function(_0x56b8d6){logger[_0x63a5('0x64')](util[_0x63a5('0x51')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x495282,_0x56b8d6[_0x63a5('0x76')][_0x63a5('0x77')]));_0xbe8355[_0x63a5('0x78')]=_0x56b8d6[_0x63a5('0x76')][_0x63a5('0x77')];_0xbe8355[_0x63a5('0x79')]=_0x56b8d6[_0x63a5('0x76')][_0x63a5('0x7a')];return _0x523c34(_0xbe8355);})[_0x63a5('0x47')](function(_0x445c25){return _0xaf8674(_0x445c25);});});}exports['runTranscribe']=function(_0x5e7f82,_0x3de310,_0x35bf26){var _0x4354f1;var _0x59fd24;var _0x39bcda;var _0x1eb458=require('../../components/encryptor');return db[_0x63a5('0x2f')][_0x63a5('0x7b')]({'where':{'id':_0x5e7f82['params']['id']}})[_0x63a5('0x27')](function(_0x5c5ee1){if(_0x5c5ee1){var _0x311f0d=util[_0x63a5('0x51')](_0x63a5('0x52'),_0x5c5ee1[_0x63a5('0x50')]);if(fs[_0x63a5('0x53')](_0x311f0d)){cypher=!![];return _0x1eb458[_0x63a5('0x54')](_0x311f0d,_0x5c5ee1[_0x63a5('0x50')],config[_0x63a5('0x55')]['recording'])[_0x63a5('0x27')](function(){return _0x5c5ee1;});}return _0x5c5ee1;}})[_0x63a5('0x27')](function(_0x26c612){if(!_0x26c612){throw new db['Sequelize']['ValidationError'](_0x63a5('0x7c'));}_0x59fd24=_0x26c612;return db['Setting'][_0x63a5('0x7b')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x3de310,null))[_0x63a5('0x27')](function(_0x546f89){if(_0x546f89){_0x4354f1=_0x546f89;if(!_0x4354f1[_0x63a5('0x7d')]||!_0x4354f1[_0x63a5('0x7e')]||!_0x4354f1['transcribeRegion']||!_0x4354f1['language']||!_0x4354f1[_0x63a5('0x72')]){throw new db[(_0x63a5('0x56'))]['ValidationError'](_0x63a5('0x7f'));}if(_0x5e7f82['body']['runSentiment']&&(!_0x4354f1['sentiment']||!_0x4354f1[_0x63a5('0x80')]||!_0x4354f1[_0x63a5('0x81')]||!_0x4354f1['language']||!_0x4354f1['bucket'])){throw new db[(_0x63a5('0x56'))][(_0x63a5('0x57'))](_0x63a5('0x82'));}return db['CloudProvider'][_0x63a5('0x7b')]({'where':{'id':_0x4354f1[_0x63a5('0x7e')]}});}})[_0x63a5('0x27')](function(_0x14bd1d){if(!_0x14bd1d){throw new db[(_0x63a5('0x56'))][(_0x63a5('0x57'))](_0x63a5('0x83'));}if(!_0x14bd1d['data1']||!_0x14bd1d[_0x63a5('0x84')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x39bcda=_0x14bd1d;return getBucketslist(_0x39bcda[_0x63a5('0x85')],_0x39bcda[_0x63a5('0x84')],_0x4354f1[_0x63a5('0x86')]);})[_0x63a5('0x27')](function(_0x2418fa){if(_0x2418fa&&_0x2418fa[_0x63a5('0x87')]){var _0x49ad02=_['find'](_0x2418fa[_0x63a5('0x87')],function(_0x2a3e33){return _0x2a3e33[_0x63a5('0x88')]===_0x4354f1[_0x63a5('0x72')];});if(!_0x49ad02){logger[_0x63a5('0x64')](util[_0x63a5('0x51')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5e7f82[_0x63a5('0x48')]['id'],_0x4354f1[_0x63a5('0x72')]));return createBucket(_0x39bcda['data1'],_0x39bcda[_0x63a5('0x84')],_0x4354f1[_0x63a5('0x86')],_0x4354f1['bucket']);}logger[_0x63a5('0x64')](util['format'](_0x63a5('0x89'),_0x5e7f82[_0x63a5('0x48')]['id'],_0x4354f1['bucket']));return;}})[_0x63a5('0x27')](function(_0x11c47b){if(_0x59fd24[_0x63a5('0x79')]===_0x63a5('0x8a')){return transcribe(_0x5e7f82[_0x63a5('0x48')]['id'],_0x39bcda['data1'],_0x39bcda['data2'],_0x4354f1[_0x63a5('0x86')],_0x4354f1['bucket'],_0x59fd24[_0x63a5('0x50')],_0x4354f1[_0x63a5('0x8b')]);}else{logger[_0x63a5('0x64')](util['format'](_0x63a5('0x8c'),_0x5e7f82[_0x63a5('0x48')]['id']));return{'transcribeStatus':_0x63a5('0x8d')};}})['then'](function(_0x11067e){if(_0x11067e){_0x11067e[_0x63a5('0x8e')]=_0x5e7f82[_0x63a5('0x4b')][_0x63a5('0x8f')];return _0x59fd24[_0x63a5('0x90')](_0x11067e);}})[_0x63a5('0x27')](respondWithResult(_0x3de310,null))[_0x63a5('0x47')](handleError(_0x3de310,null));};function writeFile(_0x43b977,_0x14a169){return new Promise(function(_0x3ae71c,_0x1e772e){fs[_0x63a5('0x91')](_0x14a169,_0x43b977,function(_0x2864d7,_0xd9edb2){if(_0x2864d7){return _0x1e772e(_0x2864d7);}else{return _0x3ae71c(_0xd9edb2);}});});}exports[_0x63a5('0x92')]=function(_0x53e991,_0x58ae54,_0x339e56){return db[_0x63a5('0x2f')][_0x63a5('0x7b')]({'where':{'id':_0x53e991[_0x63a5('0x48')]['id']}})['then'](handleEntityNotFound(_0x58ae54))['then'](function(_0x213fce){if(_0x213fce&&_0x213fce[_0x63a5('0x93')]){var _0x3dec32=_0x213fce[_0x63a5('0x93')];var _0x973df4=config['root']+'/server/files/transcribes/transcribe_'+_0x213fce['id']+_0x63a5('0x94');if(fs['existsSync'](_0x973df4)){return _0x973df4;}return writeFile(_0x3dec32,_0x973df4)[_0x63a5('0x27')](function(){return _0x973df4;});}else{throw new db[(_0x63a5('0x56'))][(_0x63a5('0x57'))](_0x63a5('0x95'));}})['then'](function(_0x579a0d){return _0x58ae54[_0x63a5('0x4d')](_0x579a0d);})[_0x63a5('0x47')](handleError(_0x58ae54));}; \ No newline at end of file +var _0x20e7=['sendStatus','error','stack','name','send','index','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy'];(function(_0xf2c769,_0x56f997){var _0x48caa4=function(_0x5e6d1b){while(--_0x5e6d1b){_0xf2c769['push'](_0xf2c769['shift']());}};_0x48caa4(++_0x56f997);}(_0x20e7,0x1b3));var _0x720e=function(_0x452657,_0x3f1398){_0x452657=_0x452657-0x0;var _0x2d2339=_0x20e7[_0x452657];return _0x2d2339;};'use strict';var emlformat=require(_0x720e('0x0'));var rimraf=require(_0x720e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x720e('0x2'));var rp=require(_0x720e('0x3'));var moment=require(_0x720e('0x4'));var BPromise=require(_0x720e('0x5'));var Mustache=require(_0x720e('0x6'));var util=require(_0x720e('0x7'));var path=require(_0x720e('0x8'));var sox=require('sox');var csv=require(_0x720e('0x9'));var ejs=require(_0x720e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x720e('0xb'));var squel=require('squel');var crypto=require(_0x720e('0xc'));var jsforce=require(_0x720e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x720e('0x9'));var querystring=require(_0x720e('0xe'));var Papa=require(_0x720e('0xf'));var AWS=require(_0x720e('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x720e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x720e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x720e('0x13'));var logger=require('../../config/logger')(_0x720e('0x14'));var utils=require(_0x720e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x720e('0x16'));var db=require(_0x720e('0x17'))['db'];function respondWithStatusCode(_0x1f6a73,_0x451d4d){_0x451d4d=_0x451d4d||0xcc;return function(_0x17fd41){if(_0x17fd41){return _0x1f6a73['sendStatus'](_0x451d4d);}return _0x1f6a73[_0x720e('0x18')](_0x451d4d)[_0x720e('0x19')]();};}function respondWithResult(_0x5d2c4f,_0x5e3994){_0x5e3994=_0x5e3994||0xc8;return function(_0x28873f){if(_0x28873f){return _0x5d2c4f['status'](_0x5e3994)[_0x720e('0x1a')](_0x28873f);}};}function respondWithFilteredResult(_0x57c444,_0x3b0909){return function(_0x30e140){if(_0x30e140){var _0x2d6cad=typeof _0x3b0909[_0x720e('0x1b')]===_0x720e('0x1c')&&typeof _0x3b0909[_0x720e('0x1d')]===_0x720e('0x1c');var _0x27a52b=_0x30e140[_0x720e('0x1e')];var _0x15c02e=_0x2d6cad?0x0:_0x3b0909[_0x720e('0x1b')];var _0x590c9e=_0x2d6cad?_0x30e140['count']:_0x3b0909[_0x720e('0x1b')]+_0x3b0909[_0x720e('0x1d')];var _0x261fd2;if(_0x590c9e>=_0x27a52b){_0x590c9e=_0x27a52b;_0x261fd2=0xc8;}else{_0x261fd2=0xce;}_0x57c444['status'](_0x261fd2);return _0x57c444[_0x720e('0x1f')]('Content-Range',_0x15c02e+'-'+_0x590c9e+'/'+_0x27a52b)[_0x720e('0x1a')](_0x30e140);}return null;};}function patchUpdates(_0x1535d0){return function(_0x2742e6){try{jsonpatch[_0x720e('0x20')](_0x2742e6,_0x1535d0,!![]);}catch(_0x2c50eb){return BPromise[_0x720e('0x21')](_0x2c50eb);}return _0x2742e6['save']();};}function saveUpdates(_0x165a26,_0x59978e){return function(_0x119db9){if(_0x119db9){return _0x119db9['update'](_0x165a26)[_0x720e('0x22')](function(_0x883114){return _0x883114;});}return null;};}function removeEntity(_0x150697,_0x1ff4ac){return function(_0x35b7a0){if(_0x35b7a0){return _0x35b7a0[_0x720e('0x23')]()[_0x720e('0x22')](function(){_0x150697[_0x720e('0x18')](0xcc)[_0x720e('0x19')]();});}};}function handleEntityNotFound(_0x2a8592,_0x1f7815){return function(_0x17a453){if(!_0x17a453){_0x2a8592[_0x720e('0x24')](0x194);}return _0x17a453;};}function handleError(_0x30be3b,_0x6b0b6b){_0x6b0b6b=_0x6b0b6b||0x1f4;return function(_0x5d5ad8){logger[_0x720e('0x25')](_0x5d5ad8[_0x720e('0x26')]);if(_0x5d5ad8[_0x720e('0x27')]){delete _0x5d5ad8[_0x720e('0x27')];}_0x30be3b[_0x720e('0x18')](_0x6b0b6b)[_0x720e('0x28')](_0x5d5ad8);};}exports[_0x720e('0x29')]=function(_0x39c15f,_0x4c5edd){var _0x3d3678={},_0x512498={},_0x5dec0c={'count':0x0,'rows':[]};var _0x29c107=_['map'](db[_0x720e('0x2a')][_0x720e('0x2b')],function(_0x387869){return{'name':_0x387869['fieldName'],'type':_0x387869[_0x720e('0x2c')][_0x720e('0x2d')]};});_0x512498[_0x720e('0x2e')]=_[_0x720e('0x2f')](_['map'](_0x29c107,_0x720e('0x27')),[_0x720e('0x30')]);_0x512498[_0x720e('0x31')]=_[_0x720e('0x32')](_0x39c15f[_0x720e('0x31')]);_0x512498[_0x720e('0x33')]=_[_0x720e('0x34')](_0x512498[_0x720e('0x2e')],_0x512498[_0x720e('0x31')]);_0x3d3678[_0x720e('0x35')]=_[_0x720e('0x34')](_0x512498[_0x720e('0x2e')],qs['fields'](_0x39c15f[_0x720e('0x31')]['fields']));_0x3d3678[_0x720e('0x35')]=_0x3d3678[_0x720e('0x35')][_0x720e('0x36')]?_0x3d3678[_0x720e('0x35')]:_0x512498[_0x720e('0x2e')];if(!_0x39c15f['query'][_0x720e('0x37')](_0x720e('0x38'))){_0x3d3678[_0x720e('0x1d')]=qs[_0x720e('0x1d')](_0x39c15f[_0x720e('0x31')][_0x720e('0x1d')]);_0x3d3678[_0x720e('0x1b')]=qs[_0x720e('0x1b')](_0x39c15f[_0x720e('0x31')][_0x720e('0x1b')]);}_0x3d3678[_0x720e('0x39')]=qs[_0x720e('0x3a')](_0x39c15f['query'][_0x720e('0x3a')]);_0x3d3678['where']=qs[_0x720e('0x33')](_[_0x720e('0x3b')](_0x39c15f[_0x720e('0x31')],_0x512498[_0x720e('0x33')]),_0x29c107);if(_0x39c15f[_0x720e('0x31')][_0x720e('0x3c')]){_0x3d3678['where']=_[_0x720e('0x3d')](_0x3d3678[_0x720e('0x3e')],{'$or':_['map'](_0x29c107,function(_0x390bf9){if(_0x390bf9['type']!==_0x720e('0x3f')){var _0x26655c={};_0x26655c[_0x390bf9[_0x720e('0x27')]]={'$like':'%'+_0x39c15f['query'][_0x720e('0x3c')]+'%'};return _0x26655c;}})});}_0x3d3678=_[_0x720e('0x3d')]({},_0x3d3678,_0x39c15f['options']);var _0x5690f2={'where':_0x3d3678[_0x720e('0x3e')]};return db['VoiceRecording'][_0x720e('0x1e')](_0x5690f2)[_0x720e('0x22')](function(_0x3d25ce){_0x5dec0c[_0x720e('0x1e')]=_0x3d25ce;if(_0x39c15f[_0x720e('0x31')][_0x720e('0x40')]){_0x3d3678['include']=[{'all':!![]}];}return db[_0x720e('0x2a')][_0x720e('0x41')](_0x3d3678);})[_0x720e('0x22')](function(_0x31d595){_0x5dec0c[_0x720e('0x42')]=_0x31d595;return _0x5dec0c;})['then'](respondWithFilteredResult(_0x4c5edd,_0x3d3678))[_0x720e('0x43')](handleError(_0x4c5edd,null));};exports[_0x720e('0x44')]=function(_0x6d63da,_0x1314f9){var _0x3d6e5f={'raw':![],'where':{'id':_0x6d63da[_0x720e('0x45')]['id']}},_0xc7fadb={};_0xc7fadb['model']=_['keys'](db[_0x720e('0x2a')][_0x720e('0x2b')]);_0xc7fadb[_0x720e('0x31')]=_[_0x720e('0x32')](_0x6d63da[_0x720e('0x31')]);_0xc7fadb[_0x720e('0x33')]=_['intersection'](_0xc7fadb['model'],_0xc7fadb[_0x720e('0x31')]);_0x3d6e5f[_0x720e('0x35')]=_[_0x720e('0x34')](_0xc7fadb[_0x720e('0x2e')],qs[_0x720e('0x46')](_0x6d63da[_0x720e('0x31')][_0x720e('0x46')]));_0x3d6e5f[_0x720e('0x35')]=_0x3d6e5f[_0x720e('0x35')][_0x720e('0x36')]?_0x3d6e5f[_0x720e('0x35')]:_0xc7fadb[_0x720e('0x2e')];if(_0x6d63da[_0x720e('0x31')]['includeAll']){_0x3d6e5f[_0x720e('0x47')]=[{'all':!![]}];}_0x3d6e5f=_['merge']({},_0x3d6e5f,_0x6d63da[_0x720e('0x48')]);return db[_0x720e('0x2a')][_0x720e('0x49')](_0x3d6e5f)['then'](handleEntityNotFound(_0x1314f9,null))[_0x720e('0x22')](respondWithResult(_0x1314f9,null))[_0x720e('0x43')](handleError(_0x1314f9,null));};exports['create']=function(_0x22a1bb,_0x392019){return db['VoiceRecording'][_0x720e('0x4a')](_0x22a1bb[_0x720e('0x4b')],{})[_0x720e('0x22')](respondWithResult(_0x392019,0xc9))[_0x720e('0x43')](handleError(_0x392019,null));};exports['update']=function(_0x2423a0,_0x587034){if(_0x2423a0[_0x720e('0x4b')]['id']){delete _0x2423a0[_0x720e('0x4b')]['id'];}return db[_0x720e('0x2a')][_0x720e('0x49')]({'where':{'id':_0x2423a0['params']['id']}})[_0x720e('0x22')](handleEntityNotFound(_0x587034,null))[_0x720e('0x22')](saveUpdates(_0x2423a0['body'],null))['then'](respondWithResult(_0x587034,null))[_0x720e('0x43')](handleError(_0x587034,null));};exports[_0x720e('0x4c')]=function(_0x2f4478,_0x1c1440){return db[_0x720e('0x2a')]['describe']()[_0x720e('0x22')](respondWithResult(_0x1c1440,null))[_0x720e('0x43')](handleError(_0x1c1440,null));};exports[_0x720e('0x4d')]=function(_0x3d2bd5,_0xa8c60b,_0xba55d){var _0x57b56d=require(_0x720e('0x4e'));var _0x4eb6a7=![];var _0x26a7c1={};if(_0x3d2bd5['query'][_0x720e('0x2c')]&&_0x3d2bd5['query'][_0x720e('0x2c')]==='uniqueid'){_0x26a7c1[_0x720e('0x4f')]=_0x3d2bd5['params']['id'];}else{_0x26a7c1['id']=_0x3d2bd5[_0x720e('0x45')]['id'];}return db[_0x720e('0x2a')]['find']({'where':_0x26a7c1,'attributes':['id',_0x720e('0x50')],'raw':!![]})[_0x720e('0x22')](handleEntityNotFound(_0xa8c60b,null))['then'](function(_0x33ff24){if(_0x33ff24){var _0x946c32=_0x33ff24[_0x720e('0x50')];var _0x19378f=util[_0x720e('0x30')](_0x720e('0x51'),_0x946c32);if(fs[_0x720e('0x52')](_0x19378f)){_0x4eb6a7=!![];return _0x57b56d['decryptFile'](_0x19378f,_0x946c32,config[_0x720e('0x53')][_0x720e('0x54')])[_0x720e('0x22')](function(){return _0x33ff24;});}return _0x33ff24;}})[_0x720e('0x22')](function(_0x590b44){if(_0x590b44){var _0x1a5eb0=_0x590b44[_0x720e('0x50')];if(!fs[_0x720e('0x52')](_0x1a5eb0)){throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x57'));}if(_0x590b44['filename']){return _0xa8c60b[_0x720e('0x4d')](_0x1a5eb0,_0x590b44[_0x720e('0x58')]+path[_0x720e('0x59')](_0x1a5eb0),function(){if(_0x4eb6a7){fs[_0x720e('0x5a')](_0x1a5eb0);}});}else{return _0xa8c60b[_0x720e('0x4d')](_0x1a5eb0,function(_0x22eea4){if(_0x4eb6a7){fs[_0x720e('0x5a')](_0x1a5eb0);}});}}})['catch'](function(_0x48c911){if(_0x48c911[_0x720e('0x5b')]===_0x720e('0x57')){_0xa8c60b[_0x720e('0x18')](0x194)['send'](_0x720e('0x5c'));}else{return handleError(_0xa8c60b,null);}});};exports[_0x720e('0x5d')]=function(_0x19c0f5,_0x5d7399,_0x258ea4){var _0x338361=require(_0x720e('0x4e'));var _0x288637=![];var _0x388d23={'$and':[db['sequelize'][_0x720e('0x3e')](db[_0x720e('0x5e')]['fn'](_0x720e('0x5f'),db[_0x720e('0x5e')][_0x720e('0x60')]('uniqueid')),_0x19c0f5['query'][_0x720e('0x61')])]};if(_0x19c0f5[_0x720e('0x31')]['type']&&_0x19c0f5['query']['type']===_0x720e('0x4f')){_0x388d23[_0x720e('0x62')][_0x720e('0x63')]({'uniqueid':_0x19c0f5[_0x720e('0x45')]['id']});}else{_0x388d23[_0x720e('0x62')][_0x720e('0x63')]({'id':_0x19c0f5['params']['id']});}return db[_0x720e('0x2a')][_0x720e('0x49')]({'where':_0x388d23,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5d7399,null))[_0x720e('0x22')](function(_0xfa1137){if(_0xfa1137){var _0x4b5fc3=util[_0x720e('0x30')](_0x720e('0x51'),_0xfa1137[_0x720e('0x50')]);if(fs['existsSync'](_0x4b5fc3)){_0x288637=!![];return _0x338361[_0x720e('0x64')](_0x4b5fc3,_0xfa1137['value'],config[_0x720e('0x53')][_0x720e('0x54')])[_0x720e('0x22')](function(){return _0xfa1137;});}return _0xfa1137;}})[_0x720e('0x22')](function(_0x35283b){if(_0x35283b){if(!fs[_0x720e('0x52')](_0x35283b[_0x720e('0x50')])){throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x57'));}if(_0x35283b[_0x720e('0x58')]){return _0x5d7399[_0x720e('0x4d')](_0x35283b['value'],_0x35283b[_0x720e('0x58')]+path[_0x720e('0x59')](_0x35283b[_0x720e('0x50')]),function(){if(_0x288637){fs[_0x720e('0x5a')](_0x35283b[_0x720e('0x50')]);}});}else{return _0x5d7399[_0x720e('0x4d')](_0x35283b[_0x720e('0x50')],function(_0x4f4da1){if(_0x288637){fs['unlink'](_0x35283b[_0x720e('0x50')]);}});}}})[_0x720e('0x43')](handleError(_0x5d7399,null));};exports['destroy']=function(_0x5552c9,_0x3d0617){return db['VoiceRecording']['find']({'where':{'id':_0x5552c9[_0x720e('0x45')]['id']}})[_0x720e('0x22')](function(_0x20b5fc){if(_[_0x720e('0x65')](_0x20b5fc)){throw new ReferenceError(_0x720e('0x66'));}return _0x20b5fc;})['then'](function(_0x207344){var _0x331cca=_0x207344[_0x720e('0x50')];logger[_0x720e('0x67')](_0x720e('0x68'),_0x331cca);if(!_[_0x720e('0x65')](_0x207344[_0x720e('0x50')])&&fs[_0x720e('0x52')](_0x331cca)){logger[_0x720e('0x67')](_0x720e('0x69')+_0x331cca+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x331cca);}_0x331cca=_0x331cca+'.cypher';if(!_[_0x720e('0x65')](_0x207344[_0x720e('0x50')])&&fs[_0x720e('0x52')](_0x331cca)){logger[_0x720e('0x67')](_0x720e('0x69')+_0x331cca+_0x720e('0x6a'));fs[_0x720e('0x6b')](_0x331cca);}return _0x207344;})[_0x720e('0x22')](function(_0x20dbca){if(!_0x20dbca)throw new InternalError();return _0x20dbca[_0x720e('0x23')]();})[_0x720e('0x22')](function(){_0x3d0617[_0x720e('0x18')](0xcc)['end']();})['catch'](handleError(_0x3d0617,null));};function getBucketslist(_0x5c8a0a,_0x3db524,_0x4c61ef){return new Promise(function(_0x1c2806,_0x1e318a){var _0x1eba24=new AWS['S3']({'accessKeyId':_0x3db524,'secretAccessKey':_0x5c8a0a,'region':_0x4c61ef});_0x1eba24[_0x720e('0x6c')]({},function(_0x4340b0,_0x403b58){if(_0x4340b0){return _0x1e318a(_0x4340b0);}else{return _0x1c2806(_0x403b58);}});});}function createBucket(_0x5ae06e,_0x3529f3,_0xec9da2,_0xc331c8){return new Promise(function(_0x2a2b26,_0x8851bb){var _0x283a33=new AWS['S3']({'accessKeyId':_0x3529f3,'secretAccessKey':_0x5ae06e,'region':_0xec9da2});_0x283a33[_0x720e('0x6d')]({'Bucket':_0xc331c8},function(_0x3d0fbf,_0x1ca4b4){if(_0x3d0fbf){return _0x8851bb(_0x3d0fbf);}else{return _0x2a2b26(_0x1ca4b4);}});});}function uploadFile(_0x5c04e9,_0x17d312,_0x1b0197,_0x1dd38f,_0x5aa438,_0x594ce8){return new Promise(function(_0x3fcf44,_0x4fc54e){var _0x201a3b=new AWS['S3']({'accessKeyId':_0x17d312,'secretAccessKey':_0x5c04e9,'region':_0x1b0197});_0x201a3b['upload']({'Bucket':_0x1dd38f,'Key':_0x5aa438,'Body':_0x594ce8},function(_0x4ad309,_0x5ccaf6){if(_0x4ad309){return _0x4fc54e(_0x4ad309);}else{return _0x3fcf44(_0x5ccaf6);}});});}function startTranscribe(_0x3c0807,_0x3203b7,_0x565878,_0x2d8e43,_0x2b165d,_0x897738){return new Promise(function(_0x410f57,_0x3f39f2){var _0x455b6b=new AWS[(_0x720e('0x6e'))]({'accessKeyId':_0x3203b7,'secretAccessKey':_0x3c0807,'region':_0x565878});_0x455b6b['startTranscriptionJob']({'TranscriptionJobName':_0x2d8e43,'LanguageCode':_0x2b165d,'Media':{'MediaFileUri':_0x897738}},function(_0xd19cc6,_0x2ea954){if(_0xd19cc6){return _0x3f39f2(_0xd19cc6);}else{return _0x410f57(_0x2ea954);}});});}function transcribe(_0x124d15,_0x29fa85,_0x34942e,_0x310075,_0x834890,_0x25e7b1,_0x569c62){return new Promise(function(_0x3bcc0c,_0x335ba0){var _0xffd99d={};logger[_0x720e('0x67')](util[_0x720e('0x30')](_0x720e('0x6f'),_0x124d15,_0x834890));return uploadFile(_0x29fa85,_0x34942e,_0x310075,_0x834890,path['basename'](_0x25e7b1),fs[_0x720e('0x70')](_0x25e7b1))[_0x720e('0x22')](function(_0x47f56c){logger['info'](util['format'](_0x720e('0x71'),_0x124d15,_0x834890,_0x47f56c[_0x720e('0x72')]));_0xffd99d[_0x720e('0x73')]=_0x47f56c[_0x720e('0x74')];_0xffd99d[_0x720e('0x75')]=_0x47f56c[_0x720e('0x72')];logger['info'](util[_0x720e('0x30')](_0x720e('0x76'),_0x124d15));return startTranscribe(_0x29fa85,_0x34942e,_0x310075,uuidv4(),_0x569c62,_0x47f56c['Location']);})['then'](function(_0xc87d91){logger['info'](util[_0x720e('0x30')](_0x720e('0x77'),_0x124d15,_0xc87d91[_0x720e('0x78')][_0x720e('0x79')]));_0xffd99d['transcribeName']=_0xc87d91['TranscriptionJob'][_0x720e('0x79')];_0xffd99d[_0x720e('0x7a')]=_0xc87d91['TranscriptionJob'][_0x720e('0x7b')];return _0x3bcc0c(_0xffd99d);})[_0x720e('0x43')](function(_0x29b4ae){return _0x335ba0(_0x29b4ae);});});}exports[_0x720e('0x7c')]=function(_0xe5ea66,_0x46e26a,_0x2d524d){var _0x5e3d47;var _0x4dec1b;var _0x2e4224;var _0xf5af52=require(_0x720e('0x4e'));return db[_0x720e('0x2a')][_0x720e('0x7d')]({'where':{'id':_0xe5ea66[_0x720e('0x45')]['id']}})[_0x720e('0x22')](function(_0x54594b){if(_0x54594b){var _0x5d75d7=util[_0x720e('0x30')]('%s.cypher',_0x54594b[_0x720e('0x50')]);if(fs['existsSync'](_0x5d75d7)){cypher=!![];return _0xf5af52['decryptFile'](_0x5d75d7,_0x54594b['value'],config['secrets'][_0x720e('0x54')])[_0x720e('0x22')](function(){return _0x54594b;});}return _0x54594b;}})[_0x720e('0x22')](function(_0x42e2de){if(!_0x42e2de){throw new db[(_0x720e('0x55'))]['ValidationError'](_0x720e('0x7e'));}_0x4dec1b=_0x42e2de;return db[_0x720e('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x720e('0x22')](handleEntityNotFound(_0x46e26a,null))[_0x720e('0x22')](function(_0x397a94){if(_0x397a94){_0x5e3d47=_0x397a94;if(!_0x5e3d47[_0x720e('0x80')]||!_0x5e3d47['transcribeAccountId']||!_0x5e3d47['transcribeRegion']||!_0x5e3d47['language']||!_0x5e3d47[_0x720e('0x73')]){throw new db[(_0x720e('0x55'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0xe5ea66[_0x720e('0x4b')][_0x720e('0x81')]&&(!_0x5e3d47[_0x720e('0x82')]||!_0x5e3d47[_0x720e('0x83')]||!_0x5e3d47[_0x720e('0x84')]||!_0x5e3d47[_0x720e('0x85')]||!_0x5e3d47[_0x720e('0x73')])){throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x86'));}return db[_0x720e('0x87')]['findOne']({'where':{'id':_0x5e3d47[_0x720e('0x88')]}});}})['then'](function(_0x12df9d){if(!_0x12df9d){throw new db['Sequelize'][(_0x720e('0x56'))](_0x720e('0x89'));}if(!_0x12df9d[_0x720e('0x8a')]||!_0x12df9d['data2']){throw new db['Sequelize'][(_0x720e('0x56'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e4224=_0x12df9d;return getBucketslist(_0x2e4224[_0x720e('0x8a')],_0x2e4224['data2'],_0x5e3d47[_0x720e('0x8b')]);})['then'](function(_0x1e5a5c){if(_0x1e5a5c&&_0x1e5a5c[_0x720e('0x8c')]){var _0x465c74=_[_0x720e('0x49')](_0x1e5a5c[_0x720e('0x8c')],function(_0x4de928){return _0x4de928[_0x720e('0x8d')]===_0x5e3d47[_0x720e('0x73')];});if(!_0x465c74){logger[_0x720e('0x67')](util['format'](_0x720e('0x8e'),_0xe5ea66[_0x720e('0x45')]['id'],_0x5e3d47['bucket']));return createBucket(_0x2e4224[_0x720e('0x8a')],_0x2e4224[_0x720e('0x8f')],_0x5e3d47[_0x720e('0x8b')],_0x5e3d47['bucket']);}logger[_0x720e('0x67')](util['format'](_0x720e('0x90'),_0xe5ea66[_0x720e('0x45')]['id'],_0x5e3d47[_0x720e('0x73')]));return;}})[_0x720e('0x22')](function(_0x482709){if(_0x4dec1b[_0x720e('0x7a')]===_0x720e('0x91')){return transcribe(_0xe5ea66[_0x720e('0x45')]['id'],_0x2e4224[_0x720e('0x8a')],_0x2e4224[_0x720e('0x8f')],_0x5e3d47[_0x720e('0x8b')],_0x5e3d47[_0x720e('0x73')],_0x4dec1b['value'],_0x5e3d47['language']);}else{logger[_0x720e('0x67')](util['format'](_0x720e('0x92'),_0xe5ea66[_0x720e('0x45')]['id']));return{'transcribeStatus':_0x720e('0x93')};}})[_0x720e('0x22')](function(_0x104b34){if(_0x104b34){_0x104b34[_0x720e('0x94')]=_0xe5ea66[_0x720e('0x4b')][_0x720e('0x81')];return _0x4dec1b[_0x720e('0x95')](_0x104b34);}})[_0x720e('0x22')](respondWithResult(_0x46e26a,null))[_0x720e('0x43')](handleError(_0x46e26a,null));};function writeFile(_0x23ccd5,_0x25037b){return new Promise(function(_0xf317c0,_0x163ec5){fs[_0x720e('0x96')](_0x25037b,_0x23ccd5,function(_0x219921,_0x16cc73){if(_0x219921){return _0x163ec5(_0x219921);}else{return _0xf317c0(_0x16cc73);}});});}exports[_0x720e('0x97')]=function(_0x47edc6,_0x558c23,_0x502424){return db['VoiceRecording'][_0x720e('0x7d')]({'where':{'id':_0x47edc6[_0x720e('0x45')]['id']}})[_0x720e('0x22')](handleEntityNotFound(_0x558c23))[_0x720e('0x22')](function(_0x4765f7){if(_0x4765f7&&_0x4765f7[_0x720e('0x98')]){var _0x428fbb=_0x4765f7[_0x720e('0x98')];var _0x1e9956=config[_0x720e('0x99')]+_0x720e('0x9a')+_0x4765f7['id']+_0x720e('0x9b');if(fs['existsSync'](_0x1e9956)){return _0x1e9956;}return writeFile(_0x428fbb,_0x1e9956)[_0x720e('0x22')](function(){return _0x1e9956;});}else{throw new db[(_0x720e('0x55'))][(_0x720e('0x56'))](_0x720e('0x9c'));}})['then'](function(_0x32309f){return _0x558c23[_0x720e('0x4d')](_0x32309f);})[_0x720e('0x43')](handleError(_0x558c23));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d326c12..006bc6a 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 _0xe05d=['voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x33de79,_0x51888f){var _0x1932fa=function(_0x3824c3){while(--_0x3824c3){_0x33de79['push'](_0x33de79['shift']());}};_0x1932fa(++_0x51888f);}(_0xe05d,0x1d2));var _0xde05=function(_0x1a694d,_0x1da83e){_0x1a694d=_0x1a694d-0x0;var _0x33141a=_0xe05d[_0x1a694d];return _0x33141a;};'use strict';var _=require(_0xde05('0x0'));var util=require(_0xde05('0x1'));var logger=require(_0xde05('0x2'))(_0xde05('0x3'));var moment=require(_0xde05('0x4'));var BPromise=require(_0xde05('0x5'));var rp=require(_0xde05('0x6'));var fs=require('fs');var path=require(_0xde05('0x7'));var rimraf=require(_0xde05('0x8'));var config=require(_0xde05('0x9'));var attributes=require(_0xde05('0xa'));module[_0xde05('0xb')]=function(_0x7d62df,_0xc9a08f){return _0x7d62df[_0xde05('0xc')](_0xde05('0xd'),attributes,{'tableName':_0xde05('0xe'),'paranoid':![],'indexes':[{'name':_0xde05('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe75e=['util','../../config/logger','api','path','rimraf','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x1bcbe4,_0x47436b){var _0x126942=function(_0x4ff80b){while(--_0x4ff80b){_0x1bcbe4['push'](_0x1bcbe4['shift']());}};_0x126942(++_0x47436b);}(_0xe75e,0x15f));var _0xee75=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0xe75e[_0x1d80be];return _0xf9a4f3;};'use strict';var _=require(_0xee75('0x0'));var util=require(_0xee75('0x1'));var logger=require(_0xee75('0x2'))(_0xee75('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee75('0x4'));var rimraf=require(_0xee75('0x5'));var config=require('../../config/environment');var attributes=require(_0xee75('0x6'));module[_0xee75('0x7')]=function(_0xcf7f2d,_0x517f76){return _0xcf7f2d['define'](_0xee75('0x8'),attributes,{'tableName':_0xee75('0x9'),'paranoid':![],'indexes':[{'name':_0xee75('0xa'),'fields':[_0xee75('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5b52869..76414a2 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 _0xb44a=['client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','existsSync','value','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xb44a,0x1c2));var _0xab44=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xb44a[_0x34bc6c];return _0x168820;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['update'](_0x354b09[_0xab44('0x14')],{'raw':_0x354b09[_0xab44('0x15')]?_0x354b09[_0xab44('0x15')][_0xab44('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354b09[_0xab44('0x15')]?_0x354b09['options'][_0xab44('0x17')]||null:null,'attributes':_0x354b09['options']?_0x354b09[_0xab44('0x15')][_0xab44('0x18')]||null:null,'limit':_0x354b09[_0xab44('0x15')]?_0x354b09[_0xab44('0x15')]['limit']||null:null})[_0xab44('0x9')](function(_0x26fc03){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger[_0xab44('0xb')](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x26fc03));_0x310b15(_0x26fc03);})['catch'](function(_0x595761){logger[_0xab44('0xd')]('UpdateVoiceRecording',_0x595761[_0xab44('0xf')],_0x354b09);_0xc4b3dc(_0x44fa43['error'](0x1f4,_0x595761[_0xab44('0xf')]));});});};exports['CreateVoiceRecording']=function(_0x531583){var _0x8e60fa=this;return new Promise(function(_0x25287b,_0x259192){var _0x4620ed=require(_0xab44('0x19'));var _0x4e820c;return db[_0xab44('0x1a')][_0xab44('0x1b')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xab44('0x9')](function(_0xebb7d1){_0x4e820c=_0xebb7d1;return db[_0xab44('0x13')][_0xab44('0x1c')](_0x531583[_0xab44('0x14')]);})[_0xab44('0x9')](function(_0x59f844){if(_0x4e820c[_0xab44('0x1d')]&&fs[_0xab44('0x1e')](_0x59f844[_0xab44('0x1f')])){var _0x47e1be=util['format'](_0xab44('0x20'),_0x59f844['value']);return _0x4620ed['encryptFile'](_0x59f844[_0xab44('0x1f')],_0x47e1be,config[_0xab44('0x21')][_0xab44('0x22')])[_0xab44('0x9')](function(){fs[_0xab44('0x23')](_0x59f844[_0xab44('0x1f')]);logger[_0xab44('0x10')](_0xab44('0x24'));return _0x59f844;});}return _0x59f844;})[_0xab44('0x9')](function(_0x1e8e9d){logger[_0xab44('0x10')](_0xab44('0x25'),_0x531583);logger[_0xab44('0xb')](_0xab44('0x25'),_0x531583,JSON['stringify'](_0x1e8e9d));_0x25287b(_0x1e8e9d);})['catch'](function(_0x27e318){logger[_0xab44('0xd')]('CreateVoiceRecording',_0x27e318[_0xab44('0xf')],_0x531583);_0x259192(_0x8e60fa[_0xab44('0xd')](0x1f4,_0x27e318[_0xab44('0xf')]));});});}; \ No newline at end of file +var _0x4137=['attributes','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','VoiceRecording','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','UpdateVoiceRecording','update','body','options','where'];(function(_0xcb6d2b,_0x1a56ac){var _0x2c3687=function(_0x1b6ed0){while(--_0x1b6ed0){_0xcb6d2b['push'](_0xcb6d2b['shift']());}};_0x2c3687(++_0x1a56ac);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['VoiceRecording'][_0x7413('0x18')](_0x19157f[_0x7413('0x19')],{'raw':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1b')]||null:null,'attributes':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1c')]||null:null,'limit':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['limit']||null:null})['then'](function(_0x138508){logger['info'](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON[_0x7413('0x12')](_0x138508));_0x2a3417(_0x138508);})[_0x7413('0x1d')](function(_0x346ce8){logger[_0x7413('0x13')](_0x7413('0x17'),_0x346ce8[_0x7413('0x16')],_0x19157f);_0x26dafe(_0x12a01e['error'](0x1f4,_0x346ce8['message']));});});};exports[_0x7413('0x1e')]=function(_0x48c2dc){var _0x46c895=this;return new Promise(function(_0x71cbb4,_0x463b21){var _0x4c2e90=require(_0x7413('0x1f'));var _0x896552;return db[_0x7413('0x20')][_0x7413('0x21')]({'attributes':['id',_0x7413('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7413('0x23')](function(_0x5eb4d9){_0x896552=_0x5eb4d9;return db[_0x7413('0x24')]['create'](_0x48c2dc[_0x7413('0x19')]);})[_0x7413('0x23')](function(_0xae2969){if(_0x896552[_0x7413('0x22')]&&fs[_0x7413('0x25')](_0xae2969[_0x7413('0x26')])){var _0x5bb3ea=util[_0x7413('0x27')](_0x7413('0x28'),_0xae2969[_0x7413('0x26')]);return _0x4c2e90[_0x7413('0x29')](_0xae2969[_0x7413('0x26')],_0x5bb3ea,config[_0x7413('0x2a')][_0x7413('0x2b')])['then'](function(){fs[_0x7413('0x2c')](_0xae2969[_0x7413('0x26')]);logger[_0x7413('0xe')](_0x7413('0x2d'));return _0xae2969;});}return _0xae2969;})[_0x7413('0x23')](function(_0x51d676){logger[_0x7413('0xe')]('CreateVoiceRecording',_0x48c2dc);logger[_0x7413('0x10')](_0x7413('0x1e'),_0x48c2dc,JSON[_0x7413('0x12')](_0x51d676));_0x71cbb4(_0x51d676);})['catch'](function(_0xe6b096){logger['error'](_0x7413('0x1e'),_0xe6b096[_0x7413('0x16')],_0x48c2dc);_0x463b21(_0x46c895['error'](0x1f4,_0xe6b096['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6a70b2c..c4d19d9 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 _0xb754=['get','index','/describe','describe','/:id','show','isAuthenticated','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x41526f,_0x2819c2){var _0x16d1d8=function(_0x272176){while(--_0x272176){_0x41526f['push'](_0x41526f['shift']());}};_0x16d1d8(++_0x2819c2);}(_0xb754,0x1c1));var _0x4b75=function(_0x34f270,_0x26851b){_0x34f270=_0x34f270-0x0;var _0x172825=_0xb754[_0x34f270];return _0x172825;};'use strict';var multer=require('multer');var util=require(_0x4b75('0x0'));var path=require('path');var timeout=require(_0x4b75('0x1'));var express=require(_0x4b75('0x2'));var router=express[_0x4b75('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b75('0x4'));var config=require(_0x4b75('0x5'));var controller=require(_0x4b75('0x6'));router[_0x4b75('0x7')]('/',auth['isAuthenticated'](),controller[_0x4b75('0x8')]);router[_0x4b75('0x7')](_0x4b75('0x9'),auth['isAuthenticated'](),controller[_0x4b75('0xa')]);router['get'](_0x4b75('0xb'),auth['isAuthenticated'](),controller[_0x4b75('0xc')]);router['post']('/',auth[_0x4b75('0xd')](),controller['create']);router[_0x4b75('0xe')](_0x4b75('0xb'),auth['isAuthenticated'](),controller[_0x4b75('0xf')]);router[_0x4b75('0x10')](_0x4b75('0xb'),auth[_0x4b75('0xd')](),controller[_0x4b75('0x11')]);module[_0x4b75('0x12')]=router; \ No newline at end of file +var _0xdfec=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','update','delete'];(function(_0x19ee66,_0x13525e){var _0xad1546=function(_0x42779a){while(--_0x42779a){_0x19ee66['push'](_0x19ee66['shift']());}};_0xad1546(++_0x13525e);}(_0xdfec,0xd3));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcdfe('0x0'));var util=require('util');var path=require(_0xcdfe('0x1'));var timeout=require('connect-timeout');var express=require(_0xcdfe('0x2'));var router=express[_0xcdfe('0x3')]();var fs_extra=require(_0xcdfe('0x4'));var auth=require(_0xcdfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcdfe('0x6'));var controller=require(_0xcdfe('0x7'));router[_0xcdfe('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdfe('0x9')]);router[_0xcdfe('0x8')](_0xcdfe('0xa'),auth[_0xcdfe('0xb')](),controller['describe']);router[_0xcdfe('0x8')](_0xcdfe('0xc'),auth['isAuthenticated'](),controller[_0xcdfe('0xd')]);router[_0xcdfe('0xe')]('/',auth[_0xcdfe('0xb')](),controller['create']);router['put'](_0xcdfe('0xc'),auth['isAuthenticated'](),controller[_0xcdfe('0xf')]);router[_0xcdfe('0x10')](_0xcdfe('0xc'),auth[_0xcdfe('0xb')](),controller[_0xcdfe('0x11')]);module[_0xcdfe('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 af9aa02..bc8e858 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 _0xd720=['attended','STRING','ENUM','sequelize','moment','exports','blind'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xd720,0xf1));var _0x0d72=function(_0x338db8,_0xfc44b5){_0x338db8=_0x338db8-0x0;var _0x1b8f2c=_0xd720[_0x338db8];return _0x1b8f2c;};'use strict';var Sequelize=require(_0x0d72('0x0'));var moment=require(_0x0d72('0x1'));module[_0x0d72('0x2')]={'type':{'type':Sequelize['ENUM'](_0x0d72('0x3'),_0x0d72('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0d72('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x0d72('0x5')]},'transferercalleridname':{'type':Sequelize[_0x0d72('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0d72('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x0d72('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0d72('0x5')]},'transfererexten':{'type':Sequelize[_0x0d72('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x0d72('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0d72('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0d72('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0d72('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x0d72('0x5')]},'transfereecontext':{'type':Sequelize[_0x0d72('0x5')]},'transfereeexten':{'type':Sequelize[_0x0d72('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x0d72('0x5')]},'isexternal':{'type':Sequelize[_0x0d72('0x6')]('Yes','No')},'context':{'type':Sequelize[_0x0d72('0x5')]},'extension':{'type':Sequelize[_0x0d72('0x5')]}}; \ No newline at end of file +var _0x796e=['STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x1ca6ce,_0x4b818){var _0x353a85=function(_0x28b67a){while(--_0x28b67a){_0x1ca6ce['push'](_0x1ca6ce['shift']());}};_0x353a85(++_0x4b818);}(_0x796e,0x144));var _0xe796=function(_0x58fd7,_0x2f9317){_0x58fd7=_0x58fd7-0x0;var _0x2e6f13=_0x796e[_0x58fd7];return _0x2e6f13;};'use strict';var Sequelize=require(_0xe796('0x0'));var moment=require(_0xe796('0x1'));module[_0xe796('0x2')]={'type':{'type':Sequelize[_0xe796('0x3')](_0xe796('0x4'),'attended')},'result':{'type':Sequelize[_0xe796('0x5')]},'transfererchannel':{'type':Sequelize[_0xe796('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xe796('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe796('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe796('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xe796('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xe796('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xe796('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xe796('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe796('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe796('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe796('0x5')]},'transfereeexten':{'type':Sequelize[_0xe796('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xe796('0x5')]},'isexternal':{'type':Sequelize[_0xe796('0x3')](_0xe796('0x6'),'No')},'context':{'type':Sequelize[_0xe796('0x5')]},'extension':{'type':Sequelize[_0xe796('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0cf5d82..cdff1d7 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 _0x21c5=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','rawAttributes','options','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel'];(function(_0x4aee32,_0x20d7a8){var _0x23dd47=function(_0x8042b9){while(--_0x8042b9){_0x4aee32['push'](_0x4aee32['shift']());}};_0x23dd47(++_0x20d7a8);}(_0x21c5,0x1bd));var _0x521c=function(_0x317e3c,_0x27e519){_0x317e3c=_0x317e3c-0x0;var _0x58b3b6=_0x21c5[_0x317e3c];return _0x58b3b6;};'use strict';var emlformat=require(_0x521c('0x0'));var rimraf=require(_0x521c('0x1'));var zipdir=require(_0x521c('0x2'));var jsonpatch=require(_0x521c('0x3'));var rp=require('request-promise');var moment=require(_0x521c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x521c('0x5'));var util=require(_0x521c('0x6'));var path=require('path');var sox=require(_0x521c('0x7'));var csv=require('to-csv');var ejs=require(_0x521c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x521c('0x9'));var squel=require(_0x521c('0xa'));var crypto=require('crypto');var jsforce=require(_0x521c('0xb'));var deskjs=require(_0x521c('0xc'));var toCsv=require(_0x521c('0xd'));var querystring=require(_0x521c('0xe'));var Papa=require(_0x521c('0xf'));var Redis=require(_0x521c('0x10'));var authService=require(_0x521c('0x11'));var qs=require(_0x521c('0x12'));var as=require(_0x521c('0x13'));var hardwareService=require(_0x521c('0x14'));var logger=require(_0x521c('0x15'))(_0x521c('0x16'));var utils=require(_0x521c('0x17'));var config=require(_0x521c('0x18'));var licenseUtil=require(_0x521c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x451381,_0x37118f){_0x37118f=_0x37118f||0xcc;return function(_0x1a132c){if(_0x1a132c){return _0x451381[_0x521c('0x1a')](_0x37118f);}return _0x451381[_0x521c('0x1b')](_0x37118f)[_0x521c('0x1c')]();};}function respondWithResult(_0x4638c4,_0x23f620){_0x23f620=_0x23f620||0xc8;return function(_0x27b84c){if(_0x27b84c){return _0x4638c4[_0x521c('0x1b')](_0x23f620)[_0x521c('0x1d')](_0x27b84c);}};}function respondWithFilteredResult(_0x240225,_0x422cc3){return function(_0x58ead6){if(_0x58ead6){var _0x2a5f2b=typeof _0x422cc3[_0x521c('0x1e')]==='undefined'&&typeof _0x422cc3[_0x521c('0x1f')]===_0x521c('0x20');var _0x4836e1=_0x58ead6['count'];var _0x262d4b=_0x2a5f2b?0x0:_0x422cc3[_0x521c('0x1e')];var _0x2b5856=_0x2a5f2b?_0x58ead6[_0x521c('0x21')]:_0x422cc3[_0x521c('0x1e')]+_0x422cc3[_0x521c('0x1f')];var _0x321421;if(_0x2b5856>=_0x4836e1){_0x2b5856=_0x4836e1;_0x321421=0xc8;}else{_0x321421=0xce;}_0x240225[_0x521c('0x1b')](_0x321421);return _0x240225['set'](_0x521c('0x22'),_0x262d4b+'-'+_0x2b5856+'/'+_0x4836e1)[_0x521c('0x1d')](_0x58ead6);}return null;};}function patchUpdates(_0x18d147){return function(_0x57f9eb){try{jsonpatch[_0x521c('0x23')](_0x57f9eb,_0x18d147,!![]);}catch(_0x20169d){return BPromise['reject'](_0x20169d);}return _0x57f9eb[_0x521c('0x24')]();};}function saveUpdates(_0x25f8e1,_0x5b3022){return function(_0x561fe7){if(_0x561fe7){return _0x561fe7['update'](_0x25f8e1)[_0x521c('0x25')](function(_0x300496){return _0x300496;});}return null;};}function removeEntity(_0x3f0a21,_0x279dd6){return function(_0x6afa94){if(_0x6afa94){return _0x6afa94[_0x521c('0x26')]()['then'](function(){_0x3f0a21['status'](0xcc)[_0x521c('0x1c')]();});}};}function handleEntityNotFound(_0x4f6999,_0xc60cea){return function(_0x3c68ba){if(!_0x3c68ba){_0x4f6999[_0x521c('0x1a')](0x194);}return _0x3c68ba;};}function handleError(_0x215f65,_0x367382){_0x367382=_0x367382||0x1f4;return function(_0x3d1ced){logger['error'](_0x3d1ced[_0x521c('0x27')]);if(_0x3d1ced[_0x521c('0x28')]){delete _0x3d1ced['name'];}_0x215f65[_0x521c('0x1b')](_0x367382)[_0x521c('0x29')](_0x3d1ced);};}exports[_0x521c('0x2a')]=function(_0x2476d6,_0xa50a83){var _0x710cef={},_0x3740f3={},_0x3cc1bf={'count':0x0,'rows':[]};var _0x54ea68=_[_0x521c('0x2b')](db[_0x521c('0x2c')]['rawAttributes'],function(_0x1690c9){return{'name':_0x1690c9[_0x521c('0x2d')],'type':_0x1690c9[_0x521c('0x2e')][_0x521c('0x2f')]};});_0x3740f3['model']=_[_0x521c('0x2b')](_0x54ea68,_0x521c('0x28'));_0x3740f3[_0x521c('0x30')]=_[_0x521c('0x31')](_0x2476d6['query']);_0x3740f3[_0x521c('0x32')]=_[_0x521c('0x33')](_0x3740f3[_0x521c('0x34')],_0x3740f3[_0x521c('0x30')]);_0x710cef['attributes']=_[_0x521c('0x33')](_0x3740f3['model'],qs['fields'](_0x2476d6['query'][_0x521c('0x35')]));_0x710cef[_0x521c('0x36')]=_0x710cef['attributes'][_0x521c('0x37')]?_0x710cef[_0x521c('0x36')]:_0x3740f3[_0x521c('0x34')];if(!_0x2476d6[_0x521c('0x30')][_0x521c('0x38')]('nolimit')){_0x710cef[_0x521c('0x1f')]=qs[_0x521c('0x1f')](_0x2476d6[_0x521c('0x30')][_0x521c('0x1f')]);_0x710cef[_0x521c('0x1e')]=qs['offset'](_0x2476d6[_0x521c('0x30')][_0x521c('0x1e')]);}_0x710cef[_0x521c('0x39')]=qs[_0x521c('0x3a')](_0x2476d6['query'][_0x521c('0x3a')]);_0x710cef[_0x521c('0x3b')]=qs[_0x521c('0x32')](_[_0x521c('0x3c')](_0x2476d6[_0x521c('0x30')],_0x3740f3[_0x521c('0x32')]),_0x54ea68);if(_0x2476d6['query'][_0x521c('0x3d')]){_0x710cef[_0x521c('0x3b')]=_[_0x521c('0x3e')](_0x710cef[_0x521c('0x3b')],{'$or':_[_0x521c('0x2b')](_0x54ea68,function(_0x46388d){if(_0x46388d[_0x521c('0x2e')]!==_0x521c('0x3f')){var _0x24d866={};_0x24d866[_0x46388d['name']]={'$like':'%'+_0x2476d6[_0x521c('0x30')]['filter']+'%'};return _0x24d866;}})});}_0x710cef=_[_0x521c('0x3e')]({},_0x710cef,_0x2476d6['options']);var _0x563a0e={'where':_0x710cef[_0x521c('0x3b')]};return db[_0x521c('0x2c')][_0x521c('0x21')](_0x563a0e)[_0x521c('0x25')](function(_0x4ecf13){_0x3cc1bf[_0x521c('0x21')]=_0x4ecf13;if(_0x2476d6['query']['includeAll']){_0x710cef[_0x521c('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x710cef);})[_0x521c('0x25')](function(_0x1c4601){_0x3cc1bf[_0x521c('0x41')]=_0x1c4601;return _0x3cc1bf;})[_0x521c('0x25')](respondWithFilteredResult(_0xa50a83,_0x710cef))[_0x521c('0x42')](handleError(_0xa50a83,null));};exports[_0x521c('0x43')]=function(_0x17e49,_0x5197d1){var _0x53ca05={'raw':!![],'where':{'id':_0x17e49['params']['id']}},_0xfb80be={};_0xfb80be[_0x521c('0x34')]=_[_0x521c('0x31')](db['VoiceTransferReport'][_0x521c('0x44')]);_0xfb80be[_0x521c('0x30')]=_['keys'](_0x17e49['query']);_0xfb80be[_0x521c('0x32')]=_['intersection'](_0xfb80be[_0x521c('0x34')],_0xfb80be[_0x521c('0x30')]);_0x53ca05[_0x521c('0x36')]=_[_0x521c('0x33')](_0xfb80be[_0x521c('0x34')],qs[_0x521c('0x35')](_0x17e49[_0x521c('0x30')]['fields']));_0x53ca05[_0x521c('0x36')]=_0x53ca05[_0x521c('0x36')][_0x521c('0x37')]?_0x53ca05[_0x521c('0x36')]:_0xfb80be[_0x521c('0x34')];if(_0x17e49[_0x521c('0x30')]['includeAll']){_0x53ca05[_0x521c('0x40')]=[{'all':!![]}];}_0x53ca05=_[_0x521c('0x3e')]({},_0x53ca05,_0x17e49[_0x521c('0x45')]);return db[_0x521c('0x2c')]['find'](_0x53ca05)['then'](handleEntityNotFound(_0x5197d1,null))['then'](respondWithResult(_0x5197d1,null))[_0x521c('0x42')](handleError(_0x5197d1,null));};exports[_0x521c('0x46')]=function(_0x1312dc,_0x514409){return db[_0x521c('0x2c')]['create'](_0x1312dc[_0x521c('0x47')],{})[_0x521c('0x25')](respondWithResult(_0x514409,0xc9))[_0x521c('0x42')](handleError(_0x514409,null));};exports[_0x521c('0x48')]=function(_0x20ab2b,_0x44940d){if(_0x20ab2b['body']['id']){delete _0x20ab2b[_0x521c('0x47')]['id'];}return db['VoiceTransferReport'][_0x521c('0x49')]({'where':{'id':_0x20ab2b['params']['id']}})[_0x521c('0x25')](handleEntityNotFound(_0x44940d,null))[_0x521c('0x25')](saveUpdates(_0x20ab2b[_0x521c('0x47')],null))[_0x521c('0x25')](respondWithResult(_0x44940d,null))['catch'](handleError(_0x44940d,null));};exports['destroy']=function(_0x798ec2,_0x5946bb){return db[_0x521c('0x2c')][_0x521c('0x49')]({'where':{'id':_0x798ec2[_0x521c('0x4a')]['id']}})[_0x521c('0x25')](handleEntityNotFound(_0x5946bb,null))['then'](removeEntity(_0x5946bb,null))['catch'](handleError(_0x5946bb,null));};exports[_0x521c('0x4b')]=function(_0x6dc991,_0x3a420d){return db[_0x521c('0x2c')]['describe']()['then'](respondWithResult(_0x3a420d,null))[_0x521c('0x42')](handleError(_0x3a420d,null));}; \ No newline at end of file +var _0x178a=['error','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','set','reject','save','then','destroy','sendStatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x178a,0xb8));var _0xa178=function(_0x1564de,_0x55766e){_0x1564de=_0x1564de-0x0;var _0xc11706=_0x178a[_0x1564de];return _0xc11706;};'use strict';var emlformat=require(_0xa178('0x0'));var rimraf=require(_0xa178('0x1'));var zipdir=require(_0xa178('0x2'));var jsonpatch=require(_0xa178('0x3'));var rp=require(_0xa178('0x4'));var moment=require(_0xa178('0x5'));var BPromise=require(_0xa178('0x6'));var Mustache=require(_0xa178('0x7'));var util=require(_0xa178('0x8'));var path=require(_0xa178('0x9'));var sox=require(_0xa178('0xa'));var csv=require('to-csv');var ejs=require(_0xa178('0xb'));var fs=require('fs');var fs_extra=require(_0xa178('0xc'));var _=require('lodash');var squel=require(_0xa178('0xd'));var crypto=require(_0xa178('0xe'));var jsforce=require(_0xa178('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa178('0x10'));var querystring=require(_0xa178('0x11'));var Papa=require(_0xa178('0x12'));var Redis=require(_0xa178('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa178('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa178('0x15'));var logger=require(_0xa178('0x16'))(_0xa178('0x17'));var utils=require('../../config/utils');var config=require(_0xa178('0x18'));var licenseUtil=require(_0xa178('0x19'));var db=require(_0xa178('0x1a'))['db'];function respondWithStatusCode(_0x33f834,_0x4703cd){_0x4703cd=_0x4703cd||0xcc;return function(_0x59bf4d){if(_0x59bf4d){return _0x33f834['sendStatus'](_0x4703cd);}return _0x33f834[_0xa178('0x1b')](_0x4703cd)[_0xa178('0x1c')]();};}function respondWithResult(_0x3e8cf5,_0x41ccaf){_0x41ccaf=_0x41ccaf||0xc8;return function(_0x144bbc){if(_0x144bbc){return _0x3e8cf5[_0xa178('0x1b')](_0x41ccaf)['json'](_0x144bbc);}};}function respondWithFilteredResult(_0x5e4bb8,_0x28c50e){return function(_0x53d8f3){if(_0x53d8f3){var _0x1ce2c6=typeof _0x28c50e['offset']===_0xa178('0x1d')&&typeof _0x28c50e[_0xa178('0x1e')]===_0xa178('0x1d');var _0x157d15=_0x53d8f3['count'];var _0x4f3c00=_0x1ce2c6?0x0:_0x28c50e['offset'];var _0x29beb0=_0x1ce2c6?_0x53d8f3[_0xa178('0x1f')]:_0x28c50e['offset']+_0x28c50e['limit'];var _0x552db1;if(_0x29beb0>=_0x157d15){_0x29beb0=_0x157d15;_0x552db1=0xc8;}else{_0x552db1=0xce;}_0x5e4bb8[_0xa178('0x1b')](_0x552db1);return _0x5e4bb8[_0xa178('0x20')]('Content-Range',_0x4f3c00+'-'+_0x29beb0+'/'+_0x157d15)['json'](_0x53d8f3);}return null;};}function patchUpdates(_0x369307){return function(_0x23cce9){try{jsonpatch['apply'](_0x23cce9,_0x369307,!![]);}catch(_0x12d3b1){return BPromise[_0xa178('0x21')](_0x12d3b1);}return _0x23cce9[_0xa178('0x22')]();};}function saveUpdates(_0x471b20,_0x5d735e){return function(_0x150e8e){if(_0x150e8e){return _0x150e8e['update'](_0x471b20)[_0xa178('0x23')](function(_0x3630ec){return _0x3630ec;});}return null;};}function removeEntity(_0x5e94cd,_0x2b5be0){return function(_0x556a8e){if(_0x556a8e){return _0x556a8e[_0xa178('0x24')]()[_0xa178('0x23')](function(){_0x5e94cd[_0xa178('0x1b')](0xcc)[_0xa178('0x1c')]();});}};}function handleEntityNotFound(_0x287ce6,_0x36f612){return function(_0x4c9df4){if(!_0x4c9df4){_0x287ce6[_0xa178('0x25')](0x194);}return _0x4c9df4;};}function handleError(_0x55ebdd,_0x44a430){_0x44a430=_0x44a430||0x1f4;return function(_0x5de5cc){logger[_0xa178('0x26')](_0x5de5cc['stack']);if(_0x5de5cc[_0xa178('0x27')]){delete _0x5de5cc['name'];}_0x55ebdd['status'](_0x44a430)['send'](_0x5de5cc);};}exports[_0xa178('0x28')]=function(_0x1fa53b,_0x2d4002){var _0x11a0ac={},_0x37a3d5={},_0x59b064={'count':0x0,'rows':[]};var _0x30a906=_[_0xa178('0x29')](db[_0xa178('0x2a')][_0xa178('0x2b')],function(_0x5c9ec4){return{'name':_0x5c9ec4[_0xa178('0x2c')],'type':_0x5c9ec4[_0xa178('0x2d')]['key']};});_0x37a3d5[_0xa178('0x2e')]=_['map'](_0x30a906,_0xa178('0x27'));_0x37a3d5['query']=_[_0xa178('0x2f')](_0x1fa53b[_0xa178('0x30')]);_0x37a3d5[_0xa178('0x31')]=_['intersection'](_0x37a3d5[_0xa178('0x2e')],_0x37a3d5[_0xa178('0x30')]);_0x11a0ac[_0xa178('0x32')]=_[_0xa178('0x33')](_0x37a3d5['model'],qs[_0xa178('0x34')](_0x1fa53b[_0xa178('0x30')][_0xa178('0x34')]));_0x11a0ac[_0xa178('0x32')]=_0x11a0ac[_0xa178('0x32')]['length']?_0x11a0ac['attributes']:_0x37a3d5[_0xa178('0x2e')];if(!_0x1fa53b[_0xa178('0x30')]['hasOwnProperty'](_0xa178('0x35'))){_0x11a0ac['limit']=qs['limit'](_0x1fa53b[_0xa178('0x30')][_0xa178('0x1e')]);_0x11a0ac[_0xa178('0x36')]=qs[_0xa178('0x36')](_0x1fa53b[_0xa178('0x30')][_0xa178('0x36')]);}_0x11a0ac['order']=qs[_0xa178('0x37')](_0x1fa53b[_0xa178('0x30')][_0xa178('0x37')]);_0x11a0ac[_0xa178('0x38')]=qs[_0xa178('0x31')](_[_0xa178('0x39')](_0x1fa53b[_0xa178('0x30')],_0x37a3d5[_0xa178('0x31')]),_0x30a906);if(_0x1fa53b[_0xa178('0x30')][_0xa178('0x3a')]){_0x11a0ac['where']=_[_0xa178('0x3b')](_0x11a0ac[_0xa178('0x38')],{'$or':_[_0xa178('0x29')](_0x30a906,function(_0x42b247){if(_0x42b247[_0xa178('0x2d')]!==_0xa178('0x3c')){var _0x183578={};_0x183578[_0x42b247['name']]={'$like':'%'+_0x1fa53b[_0xa178('0x30')]['filter']+'%'};return _0x183578;}})});}_0x11a0ac=_[_0xa178('0x3b')]({},_0x11a0ac,_0x1fa53b[_0xa178('0x3d')]);var _0x23b276={'where':_0x11a0ac[_0xa178('0x38')]};return db[_0xa178('0x2a')][_0xa178('0x1f')](_0x23b276)[_0xa178('0x23')](function(_0x3eb941){_0x59b064[_0xa178('0x1f')]=_0x3eb941;if(_0x1fa53b[_0xa178('0x30')][_0xa178('0x3e')]){_0x11a0ac[_0xa178('0x3f')]=[{'all':!![]}];}return db[_0xa178('0x2a')]['findAll'](_0x11a0ac);})[_0xa178('0x23')](function(_0x4c2437){_0x59b064[_0xa178('0x40')]=_0x4c2437;return _0x59b064;})['then'](respondWithFilteredResult(_0x2d4002,_0x11a0ac))[_0xa178('0x41')](handleError(_0x2d4002,null));};exports[_0xa178('0x42')]=function(_0x7ce1f,_0x51f89d){var _0x3a4a08={'raw':!![],'where':{'id':_0x7ce1f[_0xa178('0x43')]['id']}},_0x544ca6={};_0x544ca6[_0xa178('0x2e')]=_[_0xa178('0x2f')](db[_0xa178('0x2a')][_0xa178('0x2b')]);_0x544ca6[_0xa178('0x30')]=_[_0xa178('0x2f')](_0x7ce1f['query']);_0x544ca6[_0xa178('0x31')]=_[_0xa178('0x33')](_0x544ca6[_0xa178('0x2e')],_0x544ca6['query']);_0x3a4a08[_0xa178('0x32')]=_[_0xa178('0x33')](_0x544ca6[_0xa178('0x2e')],qs['fields'](_0x7ce1f[_0xa178('0x30')][_0xa178('0x34')]));_0x3a4a08[_0xa178('0x32')]=_0x3a4a08[_0xa178('0x32')][_0xa178('0x44')]?_0x3a4a08[_0xa178('0x32')]:_0x544ca6['model'];if(_0x7ce1f['query'][_0xa178('0x3e')]){_0x3a4a08['include']=[{'all':!![]}];}_0x3a4a08=_['merge']({},_0x3a4a08,_0x7ce1f[_0xa178('0x3d')]);return db[_0xa178('0x2a')][_0xa178('0x45')](_0x3a4a08)['then'](handleEntityNotFound(_0x51f89d,null))[_0xa178('0x23')](respondWithResult(_0x51f89d,null))[_0xa178('0x41')](handleError(_0x51f89d,null));};exports['create']=function(_0x16ae61,_0x1d3187){return db[_0xa178('0x2a')][_0xa178('0x46')](_0x16ae61[_0xa178('0x47')],{})['then'](respondWithResult(_0x1d3187,0xc9))[_0xa178('0x41')](handleError(_0x1d3187,null));};exports[_0xa178('0x48')]=function(_0x3f32ac,_0x1e2c96){if(_0x3f32ac['body']['id']){delete _0x3f32ac[_0xa178('0x47')]['id'];}return db['VoiceTransferReport'][_0xa178('0x45')]({'where':{'id':_0x3f32ac[_0xa178('0x43')]['id']}})[_0xa178('0x23')](handleEntityNotFound(_0x1e2c96,null))[_0xa178('0x23')](saveUpdates(_0x3f32ac[_0xa178('0x47')],null))[_0xa178('0x23')](respondWithResult(_0x1e2c96,null))[_0xa178('0x41')](handleError(_0x1e2c96,null));};exports[_0xa178('0x24')]=function(_0x53a2ed,_0x565b67){return db[_0xa178('0x2a')][_0xa178('0x45')]({'where':{'id':_0x53a2ed['params']['id']}})['then'](handleEntityNotFound(_0x565b67,null))[_0xa178('0x23')](removeEntity(_0x565b67,null))[_0xa178('0x41')](handleError(_0x565b67,null));};exports['describe']=function(_0xa1136e,_0x527bce){return db[_0xa178('0x2a')][_0xa178('0x49')]()['then'](respondWithResult(_0x527bce,null))[_0xa178('0x41')](handleError(_0x527bce,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ce822e8..28951b8 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 _0x3607=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3607,0x1a9));var _0x7360=function(_0x529c1a,_0x2ab927){_0x529c1a=_0x529c1a-0x0;var _0x5cf37d=_0x3607[_0x529c1a];return _0x5cf37d;};'use strict';var _=require(_0x7360('0x0'));var util=require(_0x7360('0x1'));var logger=require(_0x7360('0x2'))(_0x7360('0x3'));var moment=require('moment');var BPromise=require(_0x7360('0x4'));var rp=require(_0x7360('0x5'));var fs=require('fs');var path=require(_0x7360('0x6'));var rimraf=require(_0x7360('0x7'));var config=require(_0x7360('0x8'));var attributes=require(_0x7360('0x9'));module[_0x7360('0xa')]=function(_0x189226,_0x587f6e){return _0x189226[_0x7360('0xb')](_0x7360('0xc'),attributes,{'tableName':_0x7360('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0571=['VoiceTransferReport','report_call_transfer','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0xb49b23,_0x5367f9){var _0x59cd96=function(_0x1ab2ce){while(--_0x1ab2ce){_0xb49b23['push'](_0xb49b23['shift']());}};_0x59cd96(++_0x5367f9);}(_0x0571,0x1a6));var _0x1057=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x0571[_0x39872b];return _0x55fa18;};'use strict';var _=require('lodash');var util=require(_0x1057('0x0'));var logger=require(_0x1057('0x1'))(_0x1057('0x2'));var moment=require('moment');var BPromise=require(_0x1057('0x3'));var rp=require(_0x1057('0x4'));var fs=require('fs');var path=require(_0x1057('0x5'));var rimraf=require('rimraf');var config=require(_0x1057('0x6'));var attributes=require(_0x1057('0x7'));module[_0x1057('0x8')]=function(_0x5e5b7f,_0x5c581b){return _0x5e5b7f[_0x1057('0x9')](_0x1057('0xa'),attributes,{'tableName':_0x1057('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 d49f1cf..c3ad43f 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 _0x2802=['VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x335ca9,_0x123b27){var _0x2401b8=function(_0x4acf90){while(--_0x4acf90){_0x335ca9['push'](_0x335ca9['shift']());}};_0x2401b8(++_0x123b27);}(_0x2802,0x1c2));var _0x2280=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x2802[_0x4c0622];return _0x1799d8;};'use strict';var _=require(_0x2280('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2280('0x1'));var rs=require(_0x2280('0x2'));var fs=require('fs');var Redis=require(_0x2280('0x3'));var db=require(_0x2280('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2280('0x5'))('rpc');var config=require(_0x2280('0x6'));var jayson=require(_0x2280('0x7'));var client=jayson[_0x2280('0x8')][_0x2280('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15f4a8,_0x5634ff,_0x28df4a){return new BPromise(function(_0x3d902e,_0x4b3614){return client[_0x2280('0xa')](_0x15f4a8,_0x28df4a)[_0x2280('0xb')](function(_0x260ea5){logger[_0x2280('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5634ff,_0x2280('0xd'));logger[_0x2280('0xe')](_0x2280('0xf'),_0x5634ff,'request\x20sent',JSON[_0x2280('0x10')](_0x260ea5));if(_0x260ea5['error']){if(_0x260ea5[_0x2280('0x11')]['code']===0x1f4){logger[_0x2280('0x11')](_0x2280('0x12'),_0x5634ff,_0x260ea5[_0x2280('0x11')][_0x2280('0x13')]);return _0x4b3614(_0x260ea5[_0x2280('0x11')][_0x2280('0x13')]);}logger[_0x2280('0x11')](_0x2280('0x12'),_0x5634ff,_0x260ea5['error'][_0x2280('0x13')]);return _0x3d902e(_0x260ea5[_0x2280('0x11')][_0x2280('0x13')]);}else{logger[_0x2280('0xc')](_0x2280('0x12'),_0x5634ff,_0x2280('0xd'));_0x3d902e(_0x260ea5[_0x2280('0x14')][_0x2280('0x13')]);}})[_0x2280('0x15')](function(_0x46be1c){logger[_0x2280('0x11')](_0x2280('0x12'),_0x5634ff,_0x46be1c);_0x4b3614(_0x46be1c);});});}exports[_0x2280('0x16')]=function(_0x149e63){var _0x39f60b=this;return new Promise(function(_0x2ab4c2,_0x2a00f6){return db[_0x2280('0x17')]['create'](_0x149e63[_0x2280('0x18')],{'raw':_0x149e63['options']?_0x149e63[_0x2280('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2280('0xb')](function(_0x3666f2){logger[_0x2280('0xc')]('CreateVoiceTransferReport',_0x149e63);logger[_0x2280('0xe')]('CreateVoiceTransferReport',_0x149e63,JSON[_0x2280('0x10')](_0x3666f2));_0x2ab4c2(_0x3666f2);})[_0x2280('0x15')](function(_0x594c6c){logger[_0x2280('0x11')](_0x2280('0x16'),_0x594c6c['message'],_0x149e63);_0x2a00f6(_0x39f60b[_0x2280('0x11')](0x1f4,_0x594c6c[_0x2280('0x13')]));});});}; \ No newline at end of file +var _0x17ce=['body','options','raw','CreateVoiceTransferReport','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','VoiceTransferReport','create'];(function(_0x2621d9,_0x5c4167){var _0x353051=function(_0x200704){while(--_0x200704){_0x2621d9['push'](_0x2621d9['shift']());}};_0x353051(++_0x5c4167);}(_0x17ce,0xff));var _0xe17c=function(_0x5d48ef,_0x1ee9e4){_0x5d48ef=_0x5d48ef-0x0;var _0x166702=_0x17ce[_0x5d48ef];return _0x166702;};'use strict';var _=require(_0xe17c('0x0'));var util=require(_0xe17c('0x1'));var moment=require(_0xe17c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe17c('0x3'));var db=require(_0xe17c('0x4'))['db'];var utils=require(_0xe17c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe17c('0x6')][_0xe17c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x947d74,_0x31c95f,_0x76d5f0){return new BPromise(function(_0x1096e9,_0x5ba6c0){return client['request'](_0x947d74,_0x76d5f0)[_0xe17c('0x8')](function(_0x111668){logger[_0xe17c('0x9')](_0xe17c('0xa'),_0x31c95f,_0xe17c('0xb'));logger[_0xe17c('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x31c95f,_0xe17c('0xb'),JSON['stringify'](_0x111668));if(_0x111668['error']){if(_0x111668[_0xe17c('0xd')][_0xe17c('0xe')]===0x1f4){logger[_0xe17c('0xd')](_0xe17c('0xa'),_0x31c95f,_0x111668[_0xe17c('0xd')][_0xe17c('0xf')]);return _0x5ba6c0(_0x111668['error'][_0xe17c('0xf')]);}logger[_0xe17c('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x31c95f,_0x111668[_0xe17c('0xd')][_0xe17c('0xf')]);return _0x1096e9(_0x111668[_0xe17c('0xd')][_0xe17c('0xf')]);}else{logger[_0xe17c('0x9')](_0xe17c('0xa'),_0x31c95f,_0xe17c('0xb'));_0x1096e9(_0x111668[_0xe17c('0x10')][_0xe17c('0xf')]);}})[_0xe17c('0x11')](function(_0x5ac1bf){logger[_0xe17c('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x31c95f,_0x5ac1bf);_0x5ba6c0(_0x5ac1bf);});});}exports['CreateVoiceTransferReport']=function(_0x5cc40b){var _0x9bc4a9=this;return new Promise(function(_0x1b763a,_0x52101f){return db[_0xe17c('0x12')][_0xe17c('0x13')](_0x5cc40b[_0xe17c('0x14')],{'raw':_0x5cc40b['options']?_0x5cc40b[_0xe17c('0x15')][_0xe17c('0x16')]===undefined?!![]:![]:!![]})[_0xe17c('0x8')](function(_0x2dba73){logger[_0xe17c('0x9')](_0xe17c('0x17'),_0x5cc40b);logger[_0xe17c('0xc')]('CreateVoiceTransferReport',_0x5cc40b,JSON[_0xe17c('0x18')](_0x2dba73));_0x1b763a(_0x2dba73);})[_0xe17c('0x11')](function(_0x47fff8){logger['error'](_0xe17c('0x17'),_0x47fff8['message'],_0x5cc40b);_0x52101f(_0x9bc4a9[_0xe17c('0xd')](0x1f4,_0x47fff8['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 962e7d5..66b9fed 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 _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x565621,_0x41443b){var _0x5de0dc=function(_0x37c839){while(--_0x37c839){_0x565621['push'](_0x565621['shift']());}};_0x5de0dc(++_0x41443b);}(_0xf4eb,0xec));var _0xbf4e=function(_0xdbb917,_0x5a489a){_0xdbb917=_0xdbb917-0x0;var _0x5bc07c=_0xf4eb[_0xdbb917];return _0x5bc07c;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file +var _0x008c=['/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','/calls','calls'];(function(_0x4604dd,_0x2c1504){var _0x30daf8=function(_0x1c6c3b){while(--_0x1c6c3b){_0x4604dd['push'](_0x4604dd['shift']());}};_0x30daf8(++_0x2c1504);}(_0x008c,0x188));var _0xc008=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0x008c[_0x41b29e];return _0xacd517;};'use strict';var express=require(_0xc008('0x0'));var router=express[_0xc008('0x1')]();var auth=require(_0xc008('0x2'));var controller=require(_0xc008('0x3'));router[_0xc008('0x4')]('/originate',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x7')]);router[_0xc008('0x4')](_0xc008('0x8'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x9')]);router[_0xc008('0x4')]('/answer',auth[_0xc008('0x5')](),auth['isWebrtcLicence'](),controller[_0xc008('0xa')]);router['post']('/hold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['unhold']);router[_0xc008('0x4')](_0xc008('0xb'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0xc')]);router[_0xc008('0x4')](_0xc008('0xd'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 5cafa8b..22d3ec9 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 _0xe5b3=['string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','socket.io-emitter','validate','number','callNumber\x20is\x20required'];(function(_0x3f4683,_0x4062f9){var _0x1a80aa=function(_0x5dea92){while(--_0x5dea92){_0x3f4683['push'](_0x3f4683['shift']());}};_0x1a80aa(++_0x4062f9);}(_0xe5b3,0x133));var _0x3e5b=function(_0x91d048,_0x1f5811){_0x91d048=_0x91d048-0x0;var _0x1ed14f=_0xe5b3[_0x91d048];return _0x1ed14f;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3e5b('0x0'));var db=require(_0x3e5b('0x1'))['db'];var config=require(_0x3e5b('0x2'));var util=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var jayson=require(_0x3e5b('0x5'));var amiClient=jayson[_0x3e5b('0x6')][_0x3e5b('0x7')]({'port':0x232a});var logger=require(_0x3e5b('0x8'))(_0x3e5b('0x9'));var Redis=require(_0x3e5b('0xa'));config['redis']=_[_0x3e5b('0xb')](config[_0x3e5b('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x3e5b('0xd'))(new Redis(config[_0x3e5b('0xc')]));var Schema=require(_0x3e5b('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x3e5b('0x10')]},'callerId':{'type':_0x3e5b('0x11')},'callbackUrl':{'type':_0x3e5b('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x13')]},'transferNumber':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]}});function emit(_0x59ddc0,_0x56a453,_0x258d6a){logger[_0x3e5b('0x15')](_0x59ddc0,_0x56a453,JSON['stringify'](_0x258d6a));io['to'](_0x59ddc0)[_0x3e5b('0x16')](_0x56a453,_0x258d6a);}function handleError(_0x143040){return function(_0x555002){console[_0x3e5b('0x17')](_0x3e5b('0x18'),_0x555002,_0x555002 instanceof RangeError);logger['error'](_0x555002['stack']);if(_0x555002 instanceof RangeError){if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x194)[_0x3e5b('0x1b')](_0x555002);}else{if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x1f4)[_0x3e5b('0x1b')](_0x555002);}};}function checkError(){return function(_0x36c988){if(!_0x36c988){throw new RangeError(_0x3e5b('0x1c'));}return _0x36c988;};}function respondWithRpcPromise(_0x2b977c,_0x11e5cf){return new BPromise(function(_0x2d77cc,_0x402873){var _0x5b46d4=amiClient;return _0x5b46d4[_0x3e5b('0x1d')](_0x2b977c,_0x11e5cf)[_0x3e5b('0x1e')](function(_0x2146d4){if(_0x2146d4[_0x3e5b('0x1f')]){if(_0x2146d4['error'][_0x3e5b('0x20')]===0x1f4){return _0x402873(_0x2146d4['error'][_0x3e5b('0x21')]);}return _0x2d77cc(_0x2146d4[_0x3e5b('0x1f')]['message']);}else{_0x2d77cc(_0x2146d4[_0x3e5b('0x22')]);}})[_0x3e5b('0x23')](function(_0x42d7e9){_0x402873(_0x42d7e9);});});}function getAgent(_0x3c8965){return db[_0x3e5b('0x24')][_0x3e5b('0x25')]({'where':{'id':_0x3c8965,'role':_0x3e5b('0x26')}})[_0x3e5b('0x1e')](checkError());}function getAgentCheckSession(_0x4c4b89,_0x1c7278){return new BPromise(function(_0x505f40,_0xb70ab4){var _0x4fd64b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x1f6473=getAgent(_0x4c4b89);Promise[_0x3e5b('0x28')]([_0x4fd64b,_0x1f6473])[_0x3e5b('0x1e')](function(_0x10d2ed){var _0x3cfaf6=_0x10d2ed[0x0];var _0x307091=_0x10d2ed[0x1];var _0x9c2123=_[_0x3e5b('0x29')](_0x3cfaf6[_0x3e5b('0x2a')],function(_0x1e1565){return _0x1e1565['UserId']==_0x307091['id']&&_0x1e1565[_0x3e5b('0x2b')]==_0x1c7278;});if(_0x9c2123[_0x3e5b('0x2c')]==0x1){_0x505f40(_0x307091);}else{_0xb70ab4(new RangeError(_0x3e5b('0x2d')+_0x1c7278+_0x3e5b('0x2e')));}});});}exports[_0x3e5b('0x2f')]=function(_0x31e9f9,_0x345927){logger['info'](_0x3e5b('0x30'),_0x31e9f9['body']);var _0x5b9ba3=originateValidation[_0x3e5b('0xe')](_0x31e9f9[_0x3e5b('0x31')]);if(_0x5b9ba3['length']>0x0){return _0x345927[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x5b9ba3);}var _0x9d01c4=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x26f842=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x34')];var _0x2450c0=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x35')];var _0x1506f5=_0x31e9f9['body'][_0x3e5b('0x36')];return getAgent(_0x9d01c4)[_0x3e5b('0x1e')](function(_0x53caa2){logger['info'](_0x3e5b('0x37'),_0x53caa2['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x53caa2[_0x3e5b('0x19')]),_0x3e5b('0x3a'),{'callNumber':_0x26f842,'callerId':_0x2450c0,'callbackUrl':_0x1506f5});return _0x345927['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0x3e5b('0x23')](handleError(_0x345927));};exports['hangup']=function(_0x47f7c8,_0x48f414){logger[_0x3e5b('0x15')](_0x3e5b('0x3b'),_0x47f7c8[_0x3e5b('0x31')]);var _0x35cfcd=hangupValidation[_0x3e5b('0xe')](_0x47f7c8[_0x3e5b('0x31')]);if(_0x35cfcd['length']>0x0){return _0x48f414['status'](0x190)['json'](_0x35cfcd);}var _0x565319=_0x47f7c8['body']['userId'];var _0x5aad1d=_0x47f7c8[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x565319)[_0x3e5b('0x1e')](function(_0x1aafd5){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x1aafd5[_0x3e5b('0x19')]);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x1aafd5[_0x3e5b('0x19')]),_0x3e5b('0x3c'),{'sessionId':_0x5aad1d});return _0x48f414['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x3d')});})[_0x3e5b('0x23')](handleError(_0x48f414));};exports[_0x3e5b('0x3e')]=function(_0xa262e0,_0xc69499){logger[_0x3e5b('0x15')](_0x3e5b('0x3f'),_0xa262e0[_0x3e5b('0x31')]);var _0x39da3f=answerValidation[_0x3e5b('0xe')](_0xa262e0['body']);if(_0x39da3f['length']>0x0){return _0xc69499['status'](0x190)['json'](_0x39da3f);}var _0xa99d75=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x24c416=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0xa99d75)[_0x3e5b('0x1e')](function(_0x158518){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x158518['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x158518[_0x3e5b('0x19')]),_0x3e5b('0x40'),{'sessionId':_0x24c416});return _0xc69499[_0x3e5b('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0xc69499));};exports[_0x3e5b('0x41')]=function(_0x20af6a,_0x3b2319){logger['info']('hold\x20fired:',_0x20af6a[_0x3e5b('0x31')]);var _0x313c51=holdValidation[_0x3e5b('0xe')](_0x20af6a['body']);if(_0x313c51['length']>0x0){return _0x3b2319[_0x3e5b('0x1a')](0x190)['json'](_0x313c51);}var _0x14b62a=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x36abab=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x14b62a)[_0x3e5b('0x1e')](function(_0x3ea5aa){logger[_0x3e5b('0x15')]('entityFound:',_0x3ea5aa[_0x3e5b('0x19')]);emit(util['format'](_0x3e5b('0x39'),_0x3ea5aa[_0x3e5b('0x19')]),_0x3e5b('0x42'),{'sessionId':_0x36abab});return _0x3b2319[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x43')});})[_0x3e5b('0x23')](handleError(_0x3b2319));};exports[_0x3e5b('0x44')]=function(_0x2b5d3d,_0x371655){logger[_0x3e5b('0x15')](_0x3e5b('0x45'),_0x2b5d3d[_0x3e5b('0x31')]);var _0x59d311=unholdValidation[_0x3e5b('0xe')](_0x2b5d3d[_0x3e5b('0x31')]);if(_0x59d311[_0x3e5b('0x2c')]>0x0){return _0x371655[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x59d311);}var _0x2cecd3=_0x2b5d3d['body'][_0x3e5b('0x33')];var _0x1cbdf7=_0x2b5d3d[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x2cecd3)[_0x3e5b('0x1e')](function(_0x449d0f){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x449d0f['name']);emit(util[_0x3e5b('0x38')]('user:%s',_0x449d0f['name']),_0x3e5b('0x46'),{'sessionId':_0x1cbdf7});return _0x371655['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x47')});})[_0x3e5b('0x23')](handleError(_0x371655));};exports[_0x3e5b('0x48')]=function(_0x4a492b,_0x5ddeee){logger['info']('calls\x20fired:',_0x5ddeee[_0x3e5b('0x31')]);var _0x999518=callsValidation[_0x3e5b('0xe')](_0x4a492b[_0x3e5b('0x31')]);if(_0x999518[_0x3e5b('0x2c')]>0x0){return _0x5ddeee['status'](0x190)['json'](_0x999518);}var _0xa0a18d=_0x4a492b[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x325f7b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x51efbd=getAgent(_0xa0a18d);return Promise['all']([_0x325f7b,_0x51efbd])['then'](function(_0x4eaa6e){var _0x3563b0=_0x4eaa6e[0x0];var _0x3e3115=_0x4eaa6e[0x1];var _0x3088d4=_[_0x3e5b('0x29')](_0x3563b0[_0x3e5b('0x2a')],function(_0x24087b){return _0x24087b[_0x3e5b('0x49')]==_0x3e3115['id'];});return _0x5ddeee[_0x3e5b('0x1a')](0xc8)['json']({'count':_0x3088d4[_0x3e5b('0x2c')],'rows':_0x3088d4});})[_0x3e5b('0x23')](handleError(_0x5ddeee));};exports[_0x3e5b('0x4a')]=function(_0x3e784a,_0x2d2c1e){logger['info'](_0x3e5b('0x4b'),_0x3e784a['body']);var _0x45ca16=conferenceValidation[_0x3e5b('0xe')](_0x3e784a['body']);if(_0x45ca16['length']>0x0){return _0x2d2c1e['status'](0x190)[_0x3e5b('0x32')](_0x45ca16);}var _0x50f5b4=_0x3e784a[_0x3e5b('0x31')][_0x3e5b('0x33')];return getAgent(_0x50f5b4)[_0x3e5b('0x1e')](function(_0x40197c){logger[_0x3e5b('0x15')]('entityFound:',_0x40197c['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x40197c[_0x3e5b('0x19')]),'webbar:conference');return _0x2d2c1e[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x4c')});})[_0x3e5b('0x23')](handleError(_0x2d2c1e));};exports[_0x3e5b('0x4d')]=function(_0x198316,_0x455594){logger[_0x3e5b('0x15')](_0x3e5b('0x4e'),_0x198316[_0x3e5b('0x31')]);var _0x4eb336=transferValidation[_0x3e5b('0xe')](_0x198316[_0x3e5b('0x31')]);if(_0x4eb336[_0x3e5b('0x2c')]>0x0){return _0x455594[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x4eb336);}var _0x39f1f2=_0x198316[_0x3e5b('0x31')]['userId'];var _0xe5d4c5=_0x198316[_0x3e5b('0x31')]['sessionId'];var _0x177144=_0x198316[_0x3e5b('0x31')]['transferNumber'];return getAgent(_0x39f1f2)['then'](function(_0x4f67d1){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x4f67d1['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x4f67d1['name']),_0x3e5b('0x4f'),{'sessionId':_0xe5d4c5,'transferNumber':_0x177144});return _0x455594[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x50')});})[_0x3e5b('0x23')](handleError(_0x455594));}; \ No newline at end of file +var _0xfe57=['VoiceChannels','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','catch','User','findOne','agent','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','format','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls'];(function(_0x29581e,_0x223618){var _0x422e46=function(_0x231081){while(--_0x231081){_0x29581e['push'](_0x29581e['shift']());}};_0x422e46(++_0x223618);}(_0xfe57,0x195));var _0x7fe5=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xfe57[_0x30a31e];return _0x170879;};'use strict';var path=require(_0x7fe5('0x0'));var fs=require('fs');var _=require(_0x7fe5('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x7fe5('0x2'));var BPromise=require(_0x7fe5('0x3'));var jayson=require(_0x7fe5('0x4'));var amiClient=jayson[_0x7fe5('0x5')][_0x7fe5('0x6')]({'port':0x232a});var logger=require(_0x7fe5('0x7'))(_0x7fe5('0x8'));var Redis=require(_0x7fe5('0x9'));config[_0x7fe5('0xa')]=_[_0x7fe5('0xb')](config[_0x7fe5('0xa')],{'host':_0x7fe5('0xc'),'port':0x18eb});var io=require(_0x7fe5('0xd'))(new Redis(config['redis']));var Schema=require(_0x7fe5('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7fe5('0xf')]},'callNumber':{'type':_0x7fe5('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x7fe5('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7fe5('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7fe5('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':_0x7fe5('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x7fe5('0x10'),'required':[!![],_0x7fe5('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]}});function emit(_0xbdf0a4,_0x4989a,_0x3f699b){logger[_0x7fe5('0x13')](_0xbdf0a4,_0x4989a,JSON['stringify'](_0x3f699b));io['to'](_0xbdf0a4)[_0x7fe5('0x14')](_0x4989a,_0x3f699b);}function handleError(_0x3c7dd3){return function(_0x340d5e){console[_0x7fe5('0x15')](_0x7fe5('0x16'),_0x340d5e,_0x340d5e instanceof RangeError);logger[_0x7fe5('0x17')](_0x340d5e[_0x7fe5('0x18')]);if(_0x340d5e instanceof RangeError){if(_0x340d5e[_0x7fe5('0x19')]){delete _0x340d5e[_0x7fe5('0x19')];}_0x3c7dd3[_0x7fe5('0x1a')](0x194)['send'](_0x340d5e);}else{if(_0x340d5e['name']){delete _0x340d5e[_0x7fe5('0x19')];}_0x3c7dd3[_0x7fe5('0x1a')](0x1f4)[_0x7fe5('0x1b')](_0x340d5e);}};}function checkError(){return function(_0x327301){if(!_0x327301){throw new RangeError(_0x7fe5('0x1c'));}return _0x327301;};}function respondWithRpcPromise(_0x39c3ba,_0x24efbb){return new BPromise(function(_0xdd9df7,_0x1b271c){var _0x28a7fd=amiClient;return _0x28a7fd[_0x7fe5('0x1d')](_0x39c3ba,_0x24efbb)[_0x7fe5('0x1e')](function(_0x54ee98){if(_0x54ee98[_0x7fe5('0x17')]){if(_0x54ee98[_0x7fe5('0x17')][_0x7fe5('0x1f')]===0x1f4){return _0x1b271c(_0x54ee98['error'][_0x7fe5('0x20')]);}return _0xdd9df7(_0x54ee98['error'][_0x7fe5('0x20')]);}else{_0xdd9df7(_0x54ee98['result']);}})[_0x7fe5('0x21')](function(_0x190355){_0x1b271c(_0x190355);});});}function getAgent(_0x134876){return db[_0x7fe5('0x22')][_0x7fe5('0x23')]({'where':{'id':_0x134876,'role':_0x7fe5('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x5f2d25,_0x417a56){return new BPromise(function(_0x450759,_0x27b66d){var _0x13c96b=respondWithRpcPromise('VoiceChannels');var _0x46f816=getAgent(_0x5f2d25);Promise['all']([_0x13c96b,_0x46f816])[_0x7fe5('0x1e')](function(_0x1420de){var _0x204bc8=_0x1420de[0x0];var _0x28a689=_0x1420de[0x1];var _0x1f8572=_[_0x7fe5('0x25')](_0x204bc8['rows'],function(_0xe521c6){return _0xe521c6[_0x7fe5('0x26')]==_0x28a689['id']&&_0xe521c6['sessionId']==_0x417a56;});if(_0x1f8572[_0x7fe5('0x27')]==0x1){_0x450759(_0x28a689);}else{_0x27b66d(new RangeError(_0x7fe5('0x28')+_0x417a56+_0x7fe5('0x29')));}});});}exports[_0x7fe5('0x2a')]=function(_0x465e46,_0x53ef16){logger['info'](_0x7fe5('0x2b'),_0x465e46[_0x7fe5('0x2c')]);var _0x3dbb62=originateValidation[_0x7fe5('0xe')](_0x465e46['body']);if(_0x3dbb62[_0x7fe5('0x27')]>0x0){return _0x53ef16[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x3dbb62);}var _0x4227b7=_0x465e46[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x4ecbba=_0x465e46[_0x7fe5('0x2c')][_0x7fe5('0x2f')];var _0x2c8225=_0x465e46[_0x7fe5('0x2c')]['callerId'];var _0x5617c2=_0x465e46[_0x7fe5('0x2c')]['callbackUrl'];return getAgent(_0x4227b7)[_0x7fe5('0x1e')](function(_0x513680){logger[_0x7fe5('0x13')]('entityFound:',_0x513680['name']);emit(util['format']('user:%s',_0x513680[_0x7fe5('0x19')]),_0x7fe5('0x30'),{'callNumber':_0x4ecbba,'callerId':_0x2c8225,'callbackUrl':_0x5617c2});return _0x53ef16['status'](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x31')});})['catch'](handleError(_0x53ef16));};exports[_0x7fe5('0x32')]=function(_0x4a641d,_0x4aeed2){logger[_0x7fe5('0x13')](_0x7fe5('0x33'),_0x4a641d[_0x7fe5('0x2c')]);var _0x2ff773=hangupValidation[_0x7fe5('0xe')](_0x4a641d['body']);if(_0x2ff773[_0x7fe5('0x27')]>0x0){return _0x4aeed2[_0x7fe5('0x1a')](0x190)['json'](_0x2ff773);}var _0x1fa05a=_0x4a641d[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0xf75042=_0x4a641d[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x1fa05a)[_0x7fe5('0x1e')](function(_0x50cfa5){logger['info'](_0x7fe5('0x35'),_0x50cfa5['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x50cfa5['name']),_0x7fe5('0x38'),{'sessionId':_0xf75042});return _0x4aeed2[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x39')});})[_0x7fe5('0x21')](handleError(_0x4aeed2));};exports[_0x7fe5('0x3a')]=function(_0x1cd6d3,_0x4ee6cc){logger['info'](_0x7fe5('0x3b'),_0x1cd6d3['body']);var _0xad0b05=answerValidation[_0x7fe5('0xe')](_0x1cd6d3[_0x7fe5('0x2c')]);if(_0xad0b05[_0x7fe5('0x27')]>0x0){return _0x4ee6cc['status'](0x190)[_0x7fe5('0x2d')](_0xad0b05);}var _0x5439bc=_0x1cd6d3['body'][_0x7fe5('0x2e')];var _0x585f27=_0x1cd6d3['body'][_0x7fe5('0x34')];return getAgent(_0x5439bc)[_0x7fe5('0x1e')](function(_0x46826f){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x46826f['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x46826f['name']),_0x7fe5('0x3c'),{'sessionId':_0x585f27});return _0x4ee6cc[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x3d')});})['catch'](handleError(_0x4ee6cc));};exports[_0x7fe5('0x3e')]=function(_0x13225e,_0x7355ac){logger['info'](_0x7fe5('0x3f'),_0x13225e[_0x7fe5('0x2c')]);var _0x3efc98=holdValidation['validate'](_0x13225e[_0x7fe5('0x2c')]);if(_0x3efc98[_0x7fe5('0x27')]>0x0){return _0x7355ac[_0x7fe5('0x1a')](0x190)['json'](_0x3efc98);}var _0x19c4a6=_0x13225e[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x4610b6=_0x13225e[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x19c4a6)[_0x7fe5('0x1e')](function(_0x447b57){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x447b57[_0x7fe5('0x19')]);emit(util['format']('user:%s',_0x447b57['name']),'webbar:hold',{'sessionId':_0x4610b6});return _0x7355ac[_0x7fe5('0x1a')](0xc8)['json']({'error':![],'message':_0x7fe5('0x40')});})[_0x7fe5('0x21')](handleError(_0x7355ac));};exports[_0x7fe5('0x41')]=function(_0x1d9ca8,_0x362f33){logger['info'](_0x7fe5('0x42'),_0x1d9ca8[_0x7fe5('0x2c')]);var _0x1bd234=unholdValidation[_0x7fe5('0xe')](_0x1d9ca8[_0x7fe5('0x2c')]);if(_0x1bd234[_0x7fe5('0x27')]>0x0){return _0x362f33[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x1bd234);}var _0x2df3b0=_0x1d9ca8[_0x7fe5('0x2c')]['userId'];var _0x1c16d4=_0x1d9ca8[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x2df3b0)[_0x7fe5('0x1e')](function(_0x18b041){logger[_0x7fe5('0x13')]('entityFound:',_0x18b041[_0x7fe5('0x19')]);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x18b041[_0x7fe5('0x19')]),_0x7fe5('0x43'),{'sessionId':_0x1c16d4});return _0x362f33[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0x7fe5('0x21')](handleError(_0x362f33));};exports[_0x7fe5('0x44')]=function(_0x11d474,_0x637c0a){logger[_0x7fe5('0x13')]('calls\x20fired:',_0x637c0a[_0x7fe5('0x2c')]);var _0x34a430=callsValidation[_0x7fe5('0xe')](_0x11d474[_0x7fe5('0x2c')]);if(_0x34a430['length']>0x0){return _0x637c0a[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x34a430);}var _0x13b865=_0x11d474[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x25e583=respondWithRpcPromise(_0x7fe5('0x45'));var _0x26607a=getAgent(_0x13b865);return Promise[_0x7fe5('0x46')]([_0x25e583,_0x26607a])[_0x7fe5('0x1e')](function(_0xe5b5cf){var _0x59bd7c=_0xe5b5cf[0x0];var _0x44015c=_0xe5b5cf[0x1];var _0x1ce47c=_[_0x7fe5('0x25')](_0x59bd7c['rows'],function(_0x53e554){return _0x53e554[_0x7fe5('0x26')]==_0x44015c['id'];});return _0x637c0a['status'](0xc8)[_0x7fe5('0x2d')]({'count':_0x1ce47c[_0x7fe5('0x27')],'rows':_0x1ce47c});})['catch'](handleError(_0x637c0a));};exports[_0x7fe5('0x47')]=function(_0x47c811,_0x1fd083){logger[_0x7fe5('0x13')](_0x7fe5('0x48'),_0x47c811[_0x7fe5('0x2c')]);var _0x42d7b3=conferenceValidation[_0x7fe5('0xe')](_0x47c811['body']);if(_0x42d7b3['length']>0x0){return _0x1fd083[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x42d7b3);}var _0x42f66a=_0x47c811[_0x7fe5('0x2c')][_0x7fe5('0x2e')];return getAgent(_0x42f66a)['then'](function(_0x1eb46e){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x1eb46e[_0x7fe5('0x19')]);emit(util[_0x7fe5('0x36')]('user:%s',_0x1eb46e[_0x7fe5('0x19')]),_0x7fe5('0x49'));return _0x1fd083[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x4a')});})[_0x7fe5('0x21')](handleError(_0x1fd083));};exports[_0x7fe5('0x4b')]=function(_0x512252,_0x343057){logger[_0x7fe5('0x13')](_0x7fe5('0x4c'),_0x512252[_0x7fe5('0x2c')]);var _0x87af50=transferValidation[_0x7fe5('0xe')](_0x512252[_0x7fe5('0x2c')]);if(_0x87af50['length']>0x0){return _0x343057['status'](0x190)[_0x7fe5('0x2d')](_0x87af50);}var _0x4c3ee6=_0x512252[_0x7fe5('0x2c')]['userId'];var _0x3bb81b=_0x512252[_0x7fe5('0x2c')][_0x7fe5('0x34')];var _0x31eb57=_0x512252[_0x7fe5('0x2c')][_0x7fe5('0x4d')];return getAgent(_0x4c3ee6)[_0x7fe5('0x1e')](function(_0x411c3c){logger['info'](_0x7fe5('0x35'),_0x411c3c['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x411c3c[_0x7fe5('0x19')]),'webbar:transfer',{'sessionId':_0x3bb81b,'transferNumber':_0x31eb57});return _0x343057[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x4e')});})[_0x7fe5('0x21')](handleError(_0x343057));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index af2e8f3..9e873c3 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 _0x0598=['put','update','delete','destroy','/:id/canned_answers','removeAgents','multer','util','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','addApplications','/:id/notify'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0598,0x92));var _0x8059=function(_0x18717b,_0x2f978f){_0x18717b=_0x18717b-0x0;var _0x40fdf1=_0x0598[_0x18717b];return _0x40fdf1;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0x9')]);router[_0x8059('0x5')](_0x8059('0xa'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router['get']('/:id/canned_answers',auth[_0x8059('0x6')](),controller[_0x8059('0xc')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x8059('0xd')]);router[_0x8059('0x5')](_0x8059('0xe'),auth[_0x8059('0x6')](),controller[_0x8059('0xf')]);router['post']('/',auth[_0x8059('0x6')](),controller['create']);router[_0x8059('0x10')]('/:id/dispositions',auth[_0x8059('0x6')](),controller[_0x8059('0x11')]);router[_0x8059('0x10')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x8059('0x10')](_0x8059('0x12'),auth[_0x8059('0x6')](),controller[_0x8059('0x13')]);router[_0x8059('0x10')]('/:id/applications',auth[_0x8059('0x6')](),controller[_0x8059('0x14')]);router[_0x8059('0x10')](_0x8059('0x15'),controller['notify']);router[_0x8059('0x10')]('/:id/send',auth[_0x8059('0x6')](),controller['send']);router[_0x8059('0x16')]('/:id',auth[_0x8059('0x6')](),controller[_0x8059('0x17')]);router[_0x8059('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0x19')]);router[_0x8059('0x18')](_0x8059('0xa'),auth[_0x8059('0x6')](),controller['removeDispositions']);router[_0x8059('0x18')](_0x8059('0x1a'),auth[_0x8059('0x6')](),controller['removeAnswers']);router[_0x8059('0x18')](_0x8059('0x12'),auth[_0x8059('0x6')](),controller[_0x8059('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x54aeb5,_0x1aa3c4){var _0xd30904=function(_0x5f4048){while(--_0x5f4048){_0x54aeb5['push'](_0x54aeb5['shift']());}};_0xd30904(++_0x1aa3c4);}(_0x2a07,0x74));var _0x72a0=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0x2a07[_0x217cfd];return _0x1e887f;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getDispositions']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0xa')](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72a0('0x17')](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x17')](_0x72a0('0x12'),auth['isAuthenticated'](),controller[_0x72a0('0x19')]);router[_0x72a0('0x17')](_0x72a0('0x1a'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1b')]);router['post'](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['post'](_0x72a0('0x1d'),controller[_0x72a0('0x1e')]);router[_0x72a0('0x17')](_0x72a0('0x1f'),auth['isAuthenticated'](),controller[_0x72a0('0x20')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x21')]);router['delete'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x22')]);router[_0x72a0('0x23')]('/:id/dispositions',auth[_0x72a0('0xb')](),controller[_0x72a0('0x24')]);router[_0x72a0('0x23')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x25')]);router['delete']('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x26')]);module[_0x72a0('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2e65b37..3446e63 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 _0xc879=['sequelize','randomstring','exports','STRING','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0xc879,0x1a4));var _0x9c87=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xc879[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0x9c87('0x0'));var rs=require(_0x9c87('0x1'));module[_0x9c87('0x2')]={'name':{'type':Sequelize[_0x9c87('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x9c87('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9c87('0x3')],'defaultValue':function(){return rs[_0x9c87('0x4')]();}},'phone':{'type':Sequelize[_0x9c87('0x3')]},'type':{'type':Sequelize['ENUM'](_0x9c87('0x5'),_0x9c87('0x6'))},'accountSid':{'type':Sequelize[_0x9c87('0x3')]},'baseUrl':{'type':Sequelize[_0x9c87('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x9c87('0x7')],'defaultValue':function(){return _0x9c87('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9c87('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c87('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c87('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c87('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c87('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c87('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9c87('0xa')],'comment':_0x9c87('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x9c87('0x9')],'defaultValue':![],'comment':_0x9c87('0xc'),'set':function(_0x3d02b1){if(!_0x3d02b1){this[_0x9c87('0xd')](_0x9c87('0xe'),null);}this['setDataValue']('mandatoryDisposition',_0x3d02b1);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8416=['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','sequelize','STRING','name','ENUM','twilio','sinch','TEXT'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0x8416,0x124));var _0x6841=function(_0x55bd12,_0x3ccb52){_0x55bd12=_0x55bd12-0x0;var _0x1941dd=_0x8416[_0x55bd12];return _0x1941dd;};'use strict';var Sequelize=require(_0x6841('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x6841('0x1')],'unique':_0x6841('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6841('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6841('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6841('0x1')]},'type':{'type':Sequelize[_0x6841('0x3')](_0x6841('0x4'),_0x6841('0x5'))},'accountSid':{'type':Sequelize[_0x6841('0x1')]},'baseUrl':{'type':Sequelize[_0x6841('0x1')]},'authToken':{'type':Sequelize[_0x6841('0x1')]},'notificationTemplate':{'type':Sequelize[_0x6841('0x6')],'defaultValue':function(){return _0x6841('0x7');}},'notificationSound':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6841('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6841('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6841('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6841('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6841('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x599806){if(!_0x599806){this[_0x6841('0xb')](_0x6841('0xc'),null);}this[_0x6841('0xb')]('mandatoryDisposition',_0x599806);}},'description':{'type':Sequelize[_0x6841('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 722a0b0..a41248f 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 _0xe8d4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','register','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','UserProfileResource','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','model','map','query','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','autoAssociation','create','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse'];(function(_0x35a4f6,_0x981ba8){var _0xfc39e6=function(_0x40167e){while(--_0x40167e){_0x35a4f6['push'](_0x35a4f6['shift']());}};_0xfc39e6(++_0x981ba8);}(_0xe8d4,0xb3));var _0x4e8d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe8d4[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e8d('0x0'));var jsonpatch=require(_0x4e8d('0x1'));var rp=require('request-promise');var moment=require(_0x4e8d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4e8d('0x3'));var sox=require(_0x4e8d('0x4'));var csv=require(_0x4e8d('0x5'));var ejs=require(_0x4e8d('0x6'));var fs=require('fs');var fs_extra=require(_0x4e8d('0x7'));var _=require(_0x4e8d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e8d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4e8d('0x5'));var querystring=require(_0x4e8d('0xa'));var Papa=require(_0x4e8d('0xb'));var Redis=require(_0x4e8d('0xc'));var authService=require(_0x4e8d('0xd'));var qs=require(_0x4e8d('0xe'));var as=require(_0x4e8d('0xf'));var hardwareService=require(_0x4e8d('0x10'));var logger=require(_0x4e8d('0x11'))('api');var utils=require(_0x4e8d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4e8d('0x13'))['db'];config[_0x4e8d('0x14')]=_[_0x4e8d('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e8d('0x14')]));require('./whatsappAccount.socket')[_0x4e8d('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4e8d('0x17')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4d3f96,_0x4cb3d6,_0x2492e4,_0x558212){return new BPromise(function(_0x306512,_0x2e546c){var _0x340b3d=_0x558212||client;return _0x340b3d[_0x4e8d('0x18')](_0x4d3f96,_0x2492e4)[_0x4e8d('0x19')](function(_0x362b59){logger[_0x4e8d('0x1a')](_0x4e8d('0x1b'),_0x4cb3d6,_0x4e8d('0x1c'));logger[_0x4e8d('0x1d')](_0x4e8d('0x1e'),_0x4cb3d6,_0x4e8d('0x1c'),JSON[_0x4e8d('0x1f')](_0x362b59));if(_0x362b59['error']){if(_0x362b59[_0x4e8d('0x20')][_0x4e8d('0x21')]===0x1f4){logger['error'](_0x4e8d('0x1b'),_0x4cb3d6,_0x362b59[_0x4e8d('0x20')][_0x4e8d('0x22')]);return _0x2e546c(_0x362b59[_0x4e8d('0x20')]['message']);}logger[_0x4e8d('0x20')](_0x4e8d('0x1b'),_0x4cb3d6,_0x362b59[_0x4e8d('0x20')][_0x4e8d('0x22')]);return _0x306512(_0x362b59[_0x4e8d('0x20')][_0x4e8d('0x22')]);}else{logger[_0x4e8d('0x1a')](_0x4e8d('0x1b'),_0x4cb3d6,_0x4e8d('0x1c'));_0x306512(_0x362b59[_0x4e8d('0x23')][_0x4e8d('0x22')]);}})[_0x4e8d('0x24')](function(_0x1fb7c0){logger['error'](_0x4e8d('0x1b'),_0x4cb3d6,_0x1fb7c0);_0x2e546c(_0x1fb7c0);});});}function respondWithStatusCode(_0x23e309,_0x69efd0){_0x69efd0=_0x69efd0||0xcc;return function(_0x53bb0d){if(_0x53bb0d){return _0x23e309[_0x4e8d('0x25')](_0x69efd0);}return _0x23e309[_0x4e8d('0x26')](_0x69efd0)[_0x4e8d('0x27')]();};}function respondWithResult(_0x25cb5f,_0x226f5b){_0x226f5b=_0x226f5b||0xc8;return function(_0x3cde87){if(_0x3cde87){return _0x25cb5f['status'](_0x226f5b)[_0x4e8d('0x28')](_0x3cde87);}};}function respondWithFilteredResult(_0x5ad9bb,_0x55beb9){return function(_0x34f273){if(_0x34f273){var _0x2405f1=typeof _0x55beb9[_0x4e8d('0x29')]===_0x4e8d('0x2a')&&typeof _0x55beb9['limit']===_0x4e8d('0x2a');var _0x4c0650=_0x34f273[_0x4e8d('0x2b')];var _0x17254e=_0x2405f1?0x0:_0x55beb9[_0x4e8d('0x29')];var _0x2f145b=_0x2405f1?_0x34f273['count']:_0x55beb9[_0x4e8d('0x29')]+_0x55beb9[_0x4e8d('0x2c')];var _0x514d9c;if(_0x2f145b>=_0x4c0650){_0x2f145b=_0x4c0650;_0x514d9c=0xc8;}else{_0x514d9c=0xce;}_0x5ad9bb[_0x4e8d('0x26')](_0x514d9c);return _0x5ad9bb[_0x4e8d('0x2d')]('Content-Range',_0x17254e+'-'+_0x2f145b+'/'+_0x4c0650)['json'](_0x34f273);}return null;};}function patchUpdates(_0x5acd66){return function(_0x51075c){try{jsonpatch[_0x4e8d('0x2e')](_0x51075c,_0x5acd66,!![]);}catch(_0x554eb7){return BPromise['reject'](_0x554eb7);}return _0x51075c[_0x4e8d('0x2f')]();};}function saveUpdates(_0x556b53,_0x4f2e7c){return function(_0x15ad94){if(_0x15ad94){return _0x15ad94[_0x4e8d('0x30')](_0x556b53)[_0x4e8d('0x19')](function(_0x2ceae5){return _0x2ceae5;});}return null;};}function removeEntity(_0x4e96a1,_0x2febac){return function(_0x2f8279){if(_0x2f8279){return _0x2f8279[_0x4e8d('0x31')]()[_0x4e8d('0x19')](function(){var _0x48f793=_0x2f8279['get']({'plain':!![]});var _0x4d7070='WhatsappAccounts';return db[_0x4e8d('0x32')]['destroy']({'where':{'type':_0x4d7070,'resourceId':_0x48f793['id']}})[_0x4e8d('0x19')](function(){return _0x2f8279;});})[_0x4e8d('0x19')](function(){_0x4e96a1[_0x4e8d('0x26')](0xcc)[_0x4e8d('0x27')]();});}};}function handleEntityNotFound(_0x16fc19,_0x2843ab){return function(_0x109154){if(!_0x109154){_0x16fc19[_0x4e8d('0x25')](0x194);}return _0x109154;};}function handleError(_0x585fb7,_0x510071){_0x510071=_0x510071||0x1f4;return function(_0x377805){logger[_0x4e8d('0x20')](_0x377805['stack']);if(_0x377805[_0x4e8d('0x33')]){delete _0x377805[_0x4e8d('0x33')];}_0x585fb7[_0x4e8d('0x26')](_0x510071)[_0x4e8d('0x34')](_0x377805);};}exports['index']=function(_0x50e22e,_0x3ecdfd){var _0x3fbb2a={'include':[{'model':db[_0x4e8d('0x35')],'as':_0x4e8d('0x36')}]},_0x34d0de={},_0x3997c7={'count':0x0,'rows':[]};var _0x3407a5=_['map'](db[_0x4e8d('0x37')][_0x4e8d('0x38')],function(_0x3c80bf){return{'name':_0x3c80bf['fieldName'],'type':_0x3c80bf[_0x4e8d('0x39')]['key']};});_0x34d0de[_0x4e8d('0x3a')]=_[_0x4e8d('0x3b')](_0x3407a5,'name');_0x34d0de[_0x4e8d('0x3c')]=_['keys'](_0x50e22e[_0x4e8d('0x3c')]);_0x34d0de[_0x4e8d('0x3d')]=_[_0x4e8d('0x3e')](_0x34d0de[_0x4e8d('0x3a')],_0x34d0de[_0x4e8d('0x3c')]);_0x3fbb2a['attributes']=_[_0x4e8d('0x3e')](_0x34d0de[_0x4e8d('0x3a')],qs[_0x4e8d('0x3f')](_0x50e22e[_0x4e8d('0x3c')]['fields']));_0x3fbb2a['attributes']=_0x3fbb2a[_0x4e8d('0x40')][_0x4e8d('0x41')]?_0x3fbb2a[_0x4e8d('0x40')]:_0x34d0de['model'];if(!_0x50e22e[_0x4e8d('0x3c')]['hasOwnProperty']('nolimit')){_0x3fbb2a['limit']=qs[_0x4e8d('0x2c')](_0x50e22e[_0x4e8d('0x3c')]['limit']);_0x3fbb2a[_0x4e8d('0x29')]=qs[_0x4e8d('0x29')](_0x50e22e[_0x4e8d('0x3c')][_0x4e8d('0x29')]);}_0x3fbb2a['order']=qs[_0x4e8d('0x42')](_0x50e22e[_0x4e8d('0x3c')]['sort']);_0x3fbb2a[_0x4e8d('0x43')]=qs[_0x4e8d('0x3d')](_[_0x4e8d('0x44')](_0x50e22e[_0x4e8d('0x3c')],_0x34d0de[_0x4e8d('0x3d')]),_0x3407a5);if(_0x50e22e[_0x4e8d('0x3c')][_0x4e8d('0x45')]){_0x3fbb2a[_0x4e8d('0x43')]=_[_0x4e8d('0x46')](_0x3fbb2a[_0x4e8d('0x43')],{'$or':_[_0x4e8d('0x3b')](_0x3407a5,function(_0x293b7c){if(_0x293b7c[_0x4e8d('0x39')]!==_0x4e8d('0x47')){var _0x264d37={};_0x264d37[_0x293b7c[_0x4e8d('0x33')]]={'$like':'%'+_0x50e22e['query'][_0x4e8d('0x45')]+'%'};return _0x264d37;}})});}_0x3fbb2a=_[_0x4e8d('0x46')]({},_0x3fbb2a,_0x50e22e[_0x4e8d('0x48')]);var _0x3f5404={'where':_0x3fbb2a[_0x4e8d('0x43')]};return db['WhatsappAccount'][_0x4e8d('0x2b')](_0x3f5404)[_0x4e8d('0x19')](function(_0x4fed5b){_0x3997c7['count']=_0x4fed5b;if(_0x50e22e[_0x4e8d('0x3c')][_0x4e8d('0x49')]){_0x3fbb2a[_0x4e8d('0x4a')]=[{'all':!![]}];}return db[_0x4e8d('0x37')][_0x4e8d('0x4b')](_0x3fbb2a);})['then'](function(_0x4f2ee4){_0x3997c7['rows']=_0x4f2ee4;return _0x3997c7;})[_0x4e8d('0x19')](respondWithFilteredResult(_0x3ecdfd,_0x3fbb2a))['catch'](handleError(_0x3ecdfd,null));};exports['show']=function(_0xbb85e,_0x26584c){var _0x4a3de4={'raw':![],'where':{'id':_0xbb85e[_0x4e8d('0x4c')]['id']},'include':[{'model':db[_0x4e8d('0x35')],'as':_0x4e8d('0x36')}]},_0x1ac0fe={};_0x1ac0fe[_0x4e8d('0x3a')]=_[_0x4e8d('0x4d')](db[_0x4e8d('0x37')][_0x4e8d('0x38')]);_0x1ac0fe[_0x4e8d('0x3c')]=_[_0x4e8d('0x4d')](_0xbb85e[_0x4e8d('0x3c')]);_0x1ac0fe['filters']=_[_0x4e8d('0x3e')](_0x1ac0fe[_0x4e8d('0x3a')],_0x1ac0fe[_0x4e8d('0x3c')]);_0x4a3de4['attributes']=_[_0x4e8d('0x3e')](_0x1ac0fe['model'],qs[_0x4e8d('0x3f')](_0xbb85e[_0x4e8d('0x3c')][_0x4e8d('0x3f')]));_0x4a3de4['attributes']=_0x4a3de4[_0x4e8d('0x40')][_0x4e8d('0x41')]?_0x4a3de4['attributes']:_0x1ac0fe[_0x4e8d('0x3a')];if(_0xbb85e['query'][_0x4e8d('0x49')]){_0x4a3de4[_0x4e8d('0x4a')]=[{'all':!![]}];}_0x4a3de4=_[_0x4e8d('0x46')]({},_0x4a3de4,_0xbb85e[_0x4e8d('0x48')]);return db[_0x4e8d('0x37')][_0x4e8d('0x4e')](_0x4a3de4)[_0x4e8d('0x19')](handleEntityNotFound(_0x26584c,null))[_0x4e8d('0x19')](respondWithResult(_0x26584c,null))['catch'](handleError(_0x26584c,null));};exports['create']=function(_0x134b90,_0xbe4b45){return db[_0x4e8d('0x37')]['create'](_0x134b90[_0x4e8d('0x4f')],{})['then'](function(_0x3a0144){var _0x104c68=_0x134b90[_0x4e8d('0x50')][_0x4e8d('0x51')]({'plain':!![]});if(!_0x104c68)throw new Error(_0x4e8d('0x52'));if(_0x104c68[_0x4e8d('0x53')]===_0x4e8d('0x50')){var _0x25670d=_0x3a0144[_0x4e8d('0x51')]({'plain':!![]});var _0x3a4609=_0x4e8d('0x54');return db[_0x4e8d('0x55')]['find']({'where':{'name':_0x3a4609,'userProfileId':_0x104c68['userProfileId']},'raw':!![]})[_0x4e8d('0x19')](function(_0x4a0db5){if(_0x4a0db5&&_0x4a0db5[_0x4e8d('0x56')]===0x0){return db[_0x4e8d('0x32')][_0x4e8d('0x57')]({'name':_0x25670d[_0x4e8d('0x33')],'resourceId':_0x25670d['id'],'type':_0x4a0db5[_0x4e8d('0x33')],'sectionId':_0x4a0db5['id']},{})[_0x4e8d('0x19')](function(){return _0x3a0144;});}else{return _0x3a0144;}})['catch'](function(_0x1b4e1b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b4e1b);throw _0x1b4e1b;});}return _0x3a0144;})[_0x4e8d('0x19')](respondWithResult(_0xbe4b45,0xc9))['catch'](handleError(_0xbe4b45,null));};exports[_0x4e8d('0x30')]=function(_0x1f5191,_0x1736fe){if(_0x1f5191[_0x4e8d('0x4f')]['id']){delete _0x1f5191[_0x4e8d('0x4f')]['id'];}return db[_0x4e8d('0x37')]['find']({'where':{'id':_0x1f5191[_0x4e8d('0x4c')]['id']},'include':[{'model':db['Pause'],'as':_0x4e8d('0x36')}]})[_0x4e8d('0x19')](handleEntityNotFound(_0x1736fe,null))[_0x4e8d('0x19')](saveUpdates(_0x1f5191['body'],null))[_0x4e8d('0x19')](respondWithResult(_0x1736fe,null))[_0x4e8d('0x24')](handleError(_0x1736fe,null));};exports['destroy']=function(_0x10132d,_0x4f9f8f){return db['WhatsappAccount']['find']({'where':{'id':_0x10132d[_0x4e8d('0x4c')]['id']}})[_0x4e8d('0x19')](handleEntityNotFound(_0x4f9f8f,null))[_0x4e8d('0x19')](removeEntity(_0x4f9f8f,null))[_0x4e8d('0x24')](handleError(_0x4f9f8f,null));};exports[_0x4e8d('0x58')]=function(_0x5835a1,_0x4c9938){return db[_0x4e8d('0x37')][_0x4e8d('0x58')]()[_0x4e8d('0x19')](respondWithResult(_0x4c9938,null))['catch'](handleError(_0x4c9938,null));};exports[_0x4e8d('0x59')]=function(_0x42ba5a,_0x4e71ce,_0x72ed3f){if(_0x42ba5a[_0x4e8d('0x4f')]['id']){delete _0x42ba5a[_0x4e8d('0x4f')]['id'];}return db[_0x4e8d('0x37')][_0x4e8d('0x4e')]({'where':{'id':_0x42ba5a['params']['id']}})['then'](handleEntityNotFound(_0x4e71ce,null))[_0x4e8d('0x19')](function(_0xd37441){if(_0xd37441){_0x42ba5a['body'][_0x4e8d('0x5a')]=_0xd37441['id'];return db[_0x4e8d('0x5b')][_0x4e8d('0x57')](_0x42ba5a[_0x4e8d('0x4f')]);}})['then'](respondWithResult(_0x4e71ce,null))[_0x4e8d('0x24')](handleError(_0x4e71ce,null));};exports[_0x4e8d('0x5c')]=function(_0x5b4f85,_0x3b4b58,_0x7c047){var _0x16ecd5={'raw':![],'where':{}};var _0x1353d8={};var _0x158f8d={'count':0x0,'rows':[]};return db[_0x4e8d('0x37')][_0x4e8d('0x5d')]({'where':{'id':_0x5b4f85['params']['id']}})['then'](handleEntityNotFound(_0x3b4b58,null))[_0x4e8d('0x19')](function(_0x2f2e26){if(_0x2f2e26){_0x1353d8[_0x4e8d('0x3a')]=_[_0x4e8d('0x4d')](db[_0x4e8d('0x5b')][_0x4e8d('0x38')]);_0x1353d8[_0x4e8d('0x3c')]=_[_0x4e8d('0x4d')](_0x5b4f85[_0x4e8d('0x3c')]);_0x1353d8['filters']=_['intersection'](_0x1353d8[_0x4e8d('0x3a')],_0x1353d8[_0x4e8d('0x3c')]);_0x16ecd5[_0x4e8d('0x40')]=_[_0x4e8d('0x3e')](_0x1353d8[_0x4e8d('0x3a')],qs[_0x4e8d('0x3f')](_0x5b4f85[_0x4e8d('0x3c')][_0x4e8d('0x3f')]));_0x16ecd5[_0x4e8d('0x40')]=_0x16ecd5['attributes']['length']?_0x16ecd5[_0x4e8d('0x40')]:_0x1353d8[_0x4e8d('0x3a')];if(!_0x5b4f85[_0x4e8d('0x3c')][_0x4e8d('0x5e')](_0x4e8d('0x5f'))){_0x16ecd5['limit']=qs[_0x4e8d('0x2c')](_0x5b4f85[_0x4e8d('0x3c')][_0x4e8d('0x2c')]);_0x16ecd5['offset']=qs[_0x4e8d('0x29')](_0x5b4f85['query'][_0x4e8d('0x29')]);}_0x16ecd5[_0x4e8d('0x60')]=qs[_0x4e8d('0x42')](_0x5b4f85[_0x4e8d('0x3c')][_0x4e8d('0x42')]);_0x16ecd5[_0x4e8d('0x43')]=qs[_0x4e8d('0x3d')](_[_0x4e8d('0x44')](_0x5b4f85[_0x4e8d('0x3c')],_0x1353d8['filters']));_0x16ecd5[_0x4e8d('0x43')]['WhatsappAccountId']=_0x2f2e26['id'];if(_0x5b4f85[_0x4e8d('0x3c')][_0x4e8d('0x45')]){_0x16ecd5[_0x4e8d('0x43')]=_['merge'](_0x16ecd5[_0x4e8d('0x43')],{'$or':_['map'](_0x16ecd5[_0x4e8d('0x40')],function(_0x6e5217){var _0x5c8e74={};_0x5c8e74[_0x6e5217]={'$like':'%'+_0x5b4f85[_0x4e8d('0x3c')][_0x4e8d('0x45')]+'%'};return _0x5c8e74;})});}_0x16ecd5=_['merge']({},_0x16ecd5,_0x5b4f85[_0x4e8d('0x48')]);return db[_0x4e8d('0x5b')][_0x4e8d('0x2b')]({'where':_0x16ecd5['where']})['then'](function(_0x14c150){_0x158f8d[_0x4e8d('0x2b')]=_0x14c150;if(_0x5b4f85[_0x4e8d('0x3c')][_0x4e8d('0x49')]){_0x16ecd5['include']=[{'all':!![]}];}return db['Disposition'][_0x4e8d('0x4b')](_0x16ecd5);})['then'](function(_0x28bb3e){_0x158f8d[_0x4e8d('0x61')]=_0x28bb3e;return _0x158f8d;});}})['then'](respondWithFilteredResult(_0x3b4b58,_0x16ecd5))[_0x4e8d('0x24')](handleError(_0x3b4b58,null));};exports['removeDispositions']=function(_0x209fb5,_0x23295f,_0x3bcb65){return db[_0x4e8d('0x37')]['find']({'where':{'id':_0x209fb5['params']['id']}})[_0x4e8d('0x19')](handleEntityNotFound(_0x23295f,null))['then'](function(_0x502686){if(_0x502686){return _0x502686[_0x4e8d('0x62')](_0x209fb5['query'][_0x4e8d('0x63')]);}})[_0x4e8d('0x19')](respondWithStatusCode(_0x23295f,null))[_0x4e8d('0x24')](handleError(_0x23295f,null));};exports[_0x4e8d('0x64')]=function(_0x534997,_0x290701,_0x3dde41){if(_0x534997[_0x4e8d('0x4f')]['id']){delete _0x534997['body']['id'];}return db[_0x4e8d('0x37')][_0x4e8d('0x4e')]({'where':{'id':_0x534997[_0x4e8d('0x4c')]['id']}})[_0x4e8d('0x19')](handleEntityNotFound(_0x290701,null))[_0x4e8d('0x19')](function(_0x5b40ae){if(_0x5b40ae){_0x534997[_0x4e8d('0x4f')]['WhatsappAccountId']=_0x5b40ae['id'];return db['CannedAnswer'][_0x4e8d('0x57')](_0x534997[_0x4e8d('0x4f')]);}})[_0x4e8d('0x19')](respondWithResult(_0x290701,null))[_0x4e8d('0x24')](handleError(_0x290701,null));};exports['getAnswers']=function(_0x2e6bc8,_0x1d7a62,_0x3fea7d){var _0x1f4fc3={'raw':![],'where':{}};var _0x3e7d4c={};var _0x4bbdf5={'count':0x0,'rows':[]};return db[_0x4e8d('0x37')][_0x4e8d('0x5d')]({'where':{'id':_0x2e6bc8['params']['id']}})[_0x4e8d('0x19')](handleEntityNotFound(_0x1d7a62,null))['then'](function(_0x4c1b55){if(_0x4c1b55){_0x3e7d4c[_0x4e8d('0x3a')]=_[_0x4e8d('0x4d')](db[_0x4e8d('0x65')][_0x4e8d('0x38')]);_0x3e7d4c[_0x4e8d('0x3c')]=_['keys'](_0x2e6bc8[_0x4e8d('0x3c')]);_0x3e7d4c[_0x4e8d('0x3d')]=_[_0x4e8d('0x3e')](_0x3e7d4c[_0x4e8d('0x3a')],_0x3e7d4c['query']);_0x1f4fc3[_0x4e8d('0x40')]=_[_0x4e8d('0x3e')](_0x3e7d4c[_0x4e8d('0x3a')],qs[_0x4e8d('0x3f')](_0x2e6bc8[_0x4e8d('0x3c')]['fields']));_0x1f4fc3[_0x4e8d('0x40')]=_0x1f4fc3['attributes'][_0x4e8d('0x41')]?_0x1f4fc3[_0x4e8d('0x40')]:_0x3e7d4c[_0x4e8d('0x3a')];if(!_0x2e6bc8[_0x4e8d('0x3c')][_0x4e8d('0x5e')](_0x4e8d('0x5f'))){_0x1f4fc3['limit']=qs[_0x4e8d('0x2c')](_0x2e6bc8[_0x4e8d('0x3c')][_0x4e8d('0x2c')]);_0x1f4fc3[_0x4e8d('0x29')]=qs[_0x4e8d('0x29')](_0x2e6bc8[_0x4e8d('0x3c')]['offset']);}_0x1f4fc3[_0x4e8d('0x60')]=qs['sort'](_0x2e6bc8[_0x4e8d('0x3c')][_0x4e8d('0x42')]);_0x1f4fc3['where']=qs[_0x4e8d('0x3d')](_[_0x4e8d('0x44')](_0x2e6bc8[_0x4e8d('0x3c')],_0x3e7d4c['filters']));_0x1f4fc3[_0x4e8d('0x43')][_0x4e8d('0x5a')]=_0x4c1b55['id'];if(_0x2e6bc8['query']['filter']){_0x1f4fc3[_0x4e8d('0x43')]=_[_0x4e8d('0x46')](_0x1f4fc3[_0x4e8d('0x43')],{'$or':_[_0x4e8d('0x3b')](_0x1f4fc3['attributes'],function(_0x56b4e0){var _0x5ea6a9={};_0x5ea6a9[_0x56b4e0]={'$like':'%'+_0x2e6bc8['query'][_0x4e8d('0x45')]+'%'};return _0x5ea6a9;})});}_0x1f4fc3=_['merge']({},_0x1f4fc3,_0x2e6bc8[_0x4e8d('0x48')]);return db['CannedAnswer'][_0x4e8d('0x2b')]({'where':_0x1f4fc3[_0x4e8d('0x43')]})['then'](function(_0x198492){_0x4bbdf5['count']=_0x198492;if(_0x2e6bc8['query']['includeAll']){_0x1f4fc3['include']=[{'all':!![]}];}return db[_0x4e8d('0x65')][_0x4e8d('0x4b')](_0x1f4fc3);})['then'](function(_0x2c8adb){_0x4bbdf5[_0x4e8d('0x61')]=_0x2c8adb;return _0x4bbdf5;});}})[_0x4e8d('0x19')](respondWithFilteredResult(_0x1d7a62,_0x1f4fc3))[_0x4e8d('0x24')](handleError(_0x1d7a62,null));};exports['removeAnswers']=function(_0x12b211,_0x2ca29d,_0xbdc01b){return db[_0x4e8d('0x37')][_0x4e8d('0x4e')]({'where':{'id':_0x12b211[_0x4e8d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2ca29d,null))[_0x4e8d('0x19')](function(_0x599a94){if(_0x599a94){return _0x599a94[_0x4e8d('0x66')](_0x12b211['query'][_0x4e8d('0x63')]);}})[_0x4e8d('0x19')](respondWithStatusCode(_0x2ca29d,null))[_0x4e8d('0x24')](handleError(_0x2ca29d,null));};exports[_0x4e8d('0x67')]=function(_0x5d500e,_0x5d27d9,_0x44118f){return db[_0x4e8d('0x37')]['find']({'where':{'id':_0x5d500e['params']['id']}})[_0x4e8d('0x19')](handleEntityNotFound(_0x5d27d9,null))[_0x4e8d('0x19')](function(_0x2a3482){if(_0x2a3482){return _0x2a3482[_0x4e8d('0x67')](_0x5d500e[_0x4e8d('0x4f')]['ids'],_['omit'](_0x5d500e[_0x4e8d('0x4f')],[_0x4e8d('0x63'),'id'])||{})[_0x4e8d('0x68')](function(_0x5a539a){for(var _0x2fd222=0x0;_0x2fd222<_0x5d500e['body'][_0x4e8d('0x63')]['length'];_0x2fd222+=0x1){socket['emit'](_0x4e8d('0x69'),{'UserId':Number(_0x5d500e['body']['ids'][_0x2fd222]),'WhatsappAccountId':Number(_0x5d500e[_0x4e8d('0x4c')]['id'])});}return _0x5a539a;});}})[_0x4e8d('0x19')](respondWithResult(_0x5d27d9,null))[_0x4e8d('0x24')](handleError(_0x5d27d9,null));};exports[_0x4e8d('0x6a')]=function(_0x5789d9,_0x71d1a8,_0x7aeef9){return db[_0x4e8d('0x37')][_0x4e8d('0x4e')]({'where':{'id':_0x5789d9['params']['id']}})['then'](handleEntityNotFound(_0x71d1a8,null))[_0x4e8d('0x19')](function(_0x36c249){if(_0x36c249){return _0x36c249[_0x4e8d('0x6a')](_0x5789d9[_0x4e8d('0x3c')][_0x4e8d('0x63')])['then'](function(){if(_[_0x4e8d('0x6b')](_0x5789d9[_0x4e8d('0x3c')][_0x4e8d('0x63')])){for(var _0x14ebb3=0x0;_0x14ebb3<_0x5789d9[_0x4e8d('0x3c')][_0x4e8d('0x63')][_0x4e8d('0x41')];_0x14ebb3+=0x1){socket[_0x4e8d('0x6c')]('userWhatsappAccount:remove',{'UserId':Number(_0x5789d9['query'][_0x4e8d('0x63')][_0x14ebb3]),'WhatsappAccountId':Number(_0x5789d9[_0x4e8d('0x4c')]['id'])});}}else{socket['emit'](_0x4e8d('0x6d'),{'UserId':Number(_0x5789d9[_0x4e8d('0x3c')]['ids']),'WhatsappAccountId':Number(_0x5789d9[_0x4e8d('0x4c')]['id'])});}});}})[_0x4e8d('0x19')](respondWithStatusCode(_0x71d1a8,null))[_0x4e8d('0x24')](handleError(_0x71d1a8,null));};exports[_0x4e8d('0x6e')]=function(_0x2e3058,_0x56c462,_0x54a5f6){var _0x5ab533={};var _0x3f8f88={};var _0x123d35;var _0x41f46e;return db[_0x4e8d('0x37')][_0x4e8d('0x5d')]({'where':{'id':_0x2e3058[_0x4e8d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56c462,null))['then'](function(_0x5c500a){if(_0x5c500a){_0x123d35=_0x5c500a;_0x3f8f88[_0x4e8d('0x3a')]=_[_0x4e8d('0x4d')](db['User']['rawAttributes']);_0x3f8f88[_0x4e8d('0x3c')]=_[_0x4e8d('0x4d')](_0x2e3058[_0x4e8d('0x3c')]);_0x3f8f88[_0x4e8d('0x3d')]=_[_0x4e8d('0x3e')](_0x3f8f88[_0x4e8d('0x3a')],_0x3f8f88['query']);_0x5ab533[_0x4e8d('0x40')]=_['intersection'](_0x3f8f88[_0x4e8d('0x3a')],qs[_0x4e8d('0x3f')](_0x2e3058['query']['fields']));_0x5ab533['attributes']=_0x5ab533['attributes'][_0x4e8d('0x41')]?_0x5ab533[_0x4e8d('0x40')]:_0x3f8f88[_0x4e8d('0x3a')];_0x5ab533['order']=qs[_0x4e8d('0x42')](_0x2e3058[_0x4e8d('0x3c')][_0x4e8d('0x42')]);_0x5ab533[_0x4e8d('0x43')]=qs[_0x4e8d('0x3d')](_[_0x4e8d('0x44')](_0x2e3058[_0x4e8d('0x3c')],_0x3f8f88[_0x4e8d('0x3d')]));if(_0x2e3058[_0x4e8d('0x3c')][_0x4e8d('0x45')]){_0x5ab533[_0x4e8d('0x43')]=_['merge'](_0x5ab533[_0x4e8d('0x43')],{'$or':_[_0x4e8d('0x3b')](_0x5ab533[_0x4e8d('0x40')],function(_0x7673dc){var _0x162239={};_0x162239[_0x7673dc]={'$like':'%'+_0x2e3058['query'][_0x4e8d('0x45')]+'%'};return _0x162239;})});}_0x5ab533=_[_0x4e8d('0x46')]({},_0x5ab533,_0x2e3058[_0x4e8d('0x48')]);return _0x123d35[_0x4e8d('0x6e')](_0x5ab533);}})[_0x4e8d('0x19')](function(_0x540c2b){if(_0x540c2b){_0x41f46e=_0x540c2b[_0x4e8d('0x41')];if(!_0x2e3058[_0x4e8d('0x3c')][_0x4e8d('0x5e')](_0x4e8d('0x5f'))){_0x5ab533[_0x4e8d('0x2c')]=qs['limit'](_0x2e3058[_0x4e8d('0x3c')]['limit']);_0x5ab533[_0x4e8d('0x29')]=qs[_0x4e8d('0x29')](_0x2e3058['query'][_0x4e8d('0x29')]);}return _0x123d35[_0x4e8d('0x6e')](_0x5ab533);}})[_0x4e8d('0x19')](function(_0xe7beee){if(_0xe7beee){return _0xe7beee?{'count':_0x41f46e,'rows':_0xe7beee}:null;}})[_0x4e8d('0x19')](respondWithResult(_0x56c462,null))[_0x4e8d('0x24')](handleError(_0x56c462,null));};exports[_0x4e8d('0x6f')]=function(_0x476da6,_0x4124b0){var _0x564276=_0x476da6['params']['id'];var _0x2d6289=_0x476da6[_0x4e8d('0x4f')];var _0xc990a7=0xc8;var _0x4fc69c=null;return db['sequelize'][_0x4e8d('0x70')]({'isolationLevel':db[_0x4e8d('0x71')]['Transaction'][_0x4e8d('0x72')][_0x4e8d('0x73')]},function(_0x4cbb1a){return db[_0x4e8d('0x37')][_0x4e8d('0x5d')]({'where':{'id':_0x564276},'transaction':_0x4cbb1a})[_0x4e8d('0x19')](function(_0x2d53b8){if(_0x2d53b8){return db['WhatsappApplication'][_0x4e8d('0x31')]({'where':{'WhatsappAccountId':_0x564276},'transaction':_0x4cbb1a})[_0x4e8d('0x19')](function(){var _0x42c3f0=_[_0x4e8d('0x3b')](_0x2d6289,function(_0x3ef840){_0x3ef840[_0x4e8d('0x5a')]=_0x564276;return _0x3ef840;});return db[_0x4e8d('0x74')][_0x4e8d('0x75')](_0x42c3f0,{'transaction':_0x4cbb1a});});}else{_0xc990a7=0x194;_0x4fc69c=[];}});})[_0x4e8d('0x19')](function(){if(_0xc990a7!==0x194){return db[_0x4e8d('0x74')][_0x4e8d('0x76')]({'where':{'WhatsappAccountId':_0x564276},'order':_0x4e8d('0x77')})[_0x4e8d('0x19')](function(_0x1e7656){_0x4fc69c=_0x1e7656;});}})['catch'](function(_0x17e629){_0xc990a7=0x1f4;logger[_0x4e8d('0x20')](_0x17e629[_0x4e8d('0x78')]);if(_0x17e629[_0x4e8d('0x33')]){delete _0x17e629[_0x4e8d('0x33')];}_0x4fc69c=_0x17e629;})[_0x4e8d('0x79')](function(){if(_0x4fc69c===null){_0x4124b0['sendStatus'](_0xc990a7);}else{if(_0xc990a7===0x1f4){_0x4124b0[_0x4e8d('0x26')](_0xc990a7)[_0x4e8d('0x34')](_0x4fc69c);}else{_0x4124b0['status'](_0xc990a7)['json'](_0x4fc69c);}}});};exports[_0x4e8d('0x7a')]=function(_0x38ca4a,_0xb1c3a0,_0x22fa6b){var _0x414b63={};var _0x334d18={};var _0x16c6ef;var _0x346e84;return db[_0x4e8d('0x37')][_0x4e8d('0x5d')]({'where':{'id':_0x38ca4a[_0x4e8d('0x4c')]['id']}})[_0x4e8d('0x19')](handleEntityNotFound(_0xb1c3a0,null))[_0x4e8d('0x19')](function(_0x1a28ef){if(_0x1a28ef){_0x16c6ef=_0x1a28ef;_0x334d18[_0x4e8d('0x3a')]=_[_0x4e8d('0x4d')](db[_0x4e8d('0x74')][_0x4e8d('0x38')]);_0x334d18[_0x4e8d('0x3c')]=_['keys'](_0x38ca4a[_0x4e8d('0x3c')]);_0x334d18[_0x4e8d('0x3d')]=_[_0x4e8d('0x3e')](_0x334d18[_0x4e8d('0x3a')],_0x334d18[_0x4e8d('0x3c')]);_0x414b63[_0x4e8d('0x40')]=_['intersection'](_0x334d18['model'],qs[_0x4e8d('0x3f')](_0x38ca4a['query']['fields']));_0x414b63[_0x4e8d('0x40')]=_0x414b63[_0x4e8d('0x40')]['length']?_0x414b63[_0x4e8d('0x40')]:_0x334d18[_0x4e8d('0x3a')];_0x414b63['order']=qs['sort'](_0x38ca4a['query'][_0x4e8d('0x42')]);_0x414b63['where']=qs[_0x4e8d('0x3d')](_['pick'](_0x38ca4a[_0x4e8d('0x3c')],_0x334d18['filters']));if(_0x38ca4a[_0x4e8d('0x3c')][_0x4e8d('0x45')]){_0x414b63[_0x4e8d('0x43')]=_[_0x4e8d('0x46')](_0x414b63[_0x4e8d('0x43')],{'$or':_[_0x4e8d('0x3b')](_0x414b63['attributes'],function(_0xd89b8e){var _0x203c13={};_0x203c13[_0xd89b8e]={'$like':'%'+_0x38ca4a[_0x4e8d('0x3c')]['filter']+'%'};return _0x203c13;})});}_0x414b63=_[_0x4e8d('0x46')]({},_0x414b63,_0x38ca4a[_0x4e8d('0x48')]);return _0x16c6ef['getApplications'](_0x414b63);}})[_0x4e8d('0x19')](function(_0x7d86b4){if(_0x7d86b4){_0x346e84=_0x7d86b4[_0x4e8d('0x41')];if(!_0x38ca4a[_0x4e8d('0x3c')][_0x4e8d('0x5e')](_0x4e8d('0x5f'))){_0x414b63[_0x4e8d('0x2c')]=qs[_0x4e8d('0x2c')](_0x38ca4a[_0x4e8d('0x3c')][_0x4e8d('0x2c')]);_0x414b63['offset']=qs[_0x4e8d('0x29')](_0x38ca4a['query'][_0x4e8d('0x29')]);}return _0x16c6ef['getApplications'](_0x414b63);}})['then'](function(_0x2df43f){if(_0x2df43f){return _0x2df43f?{'count':_0x346e84,'rows':_0x2df43f}:null;}})['then'](respondWithResult(_0xb1c3a0,null))[_0x4e8d('0x24')](handleError(_0xb1c3a0,null));};exports[_0x4e8d('0x7b')]=function(_0x4cc418,_0x31456a,_0x31523a){var _0xb9a3b6={'channel':_0x4e8d('0x7c')};var _0x1dec75=[];var _0x301f8c=[];var _0x56e30a={};return db['WhatsappAccount']['find']({'where':{'id':_0x4cc418[_0x4e8d('0x4c')]['id']},'include':[{'model':db[_0x4e8d('0x74')],'as':_0x4e8d('0x7d')}]})['then'](handleEntityNotFound(_0x31456a,null))[_0x4e8d('0x19')](function(_0x3cb1e2){_0xb9a3b6['account']=_0x3cb1e2;if(_0xb9a3b6[_0x4e8d('0x7e')]&&_0xb9a3b6[_0x4e8d('0x7e')][_0x4e8d('0x39')]==='sinch'&&_0x4cc418['body']['statuses']){if(_0x4cc418['body'][_0x4e8d('0x7f')][_0x4e8d('0x41')]===0x0)return;if(_0x4cc418['body'][_0x4e8d('0x7f')][0x0][_0x4e8d('0x80')]!==_0x4e8d('0x81'))return;return db[_0x4e8d('0x82')]['update']({'read':!![],'readAt':_0x4cc418[_0x4e8d('0x4f')][_0x4e8d('0x7f')][0x0][_0x4e8d('0x83')]},{'where':{'messageId':_0x4cc418[_0x4e8d('0x4f')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x4e8d('0x19')](function(_0x1e693f){return _0x31456a[_0x4e8d('0x26')](0xc8)[_0x4e8d('0x28')](_0x1e693f);});}_0xb9a3b6[_0x4e8d('0x84')]=_[_0x4e8d('0x85')](_0x3cb1e2['Applications'],['priority'],[_0x4e8d('0x86')]);if(_0xb9a3b6[_0x4e8d('0x7e')][_0x4e8d('0x7d')]){delete _0xb9a3b6['account'][_0x4e8d('0x7d')];}return db[_0x4e8d('0x87')][_0x4e8d('0x58')]()[_0x4e8d('0x19')](function(_0x45bdd6){if(!_0x45bdd6){throw new db[(_0x4e8d('0x88'))][(_0x4e8d('0x89'))](_0x4e8d('0x8a'));}_0x1dec75=_['difference'](_[_0x4e8d('0x4d')](_0x45bdd6),[_0x4e8d('0x8b'),_0x4e8d('0x8c')]);_0x301f8c=_['difference'](_['keys'](_0x45bdd6),[_0x4e8d('0x8b'),'updatedAt',_0x4e8d('0x8d'),_0x4e8d('0x8e')]);_0xb9a3b6['body']={'mapKey':_0x4e8d('0x8f')};if(_0xb9a3b6[_0x4e8d('0x7e')]&&_0xb9a3b6[_0x4e8d('0x7e')][_0x4e8d('0x39')]===_0x4e8d('0x90')){_0xb9a3b6['body'][_0x4e8d('0x91')]=_0x4cc418['body'][_0x4e8d('0x92')][_0x4e8d('0x93')](_0x4e8d('0x94'),'');_0xb9a3b6[_0x4e8d('0x4f')]['body']=_0x4cc418[_0x4e8d('0x4f')][_0x4e8d('0x95')];_0xb9a3b6['body']['messageId']=_0x4cc418['body'][_0x4e8d('0x96')];}if(_0xb9a3b6[_0x4e8d('0x7e')]&&_0xb9a3b6[_0x4e8d('0x7e')][_0x4e8d('0x39')]===_0x4e8d('0x97')){_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x91')]=_0x4cc418[_0x4e8d('0x4f')]['notifications'][0x0][_0x4e8d('0x91')];_0xb9a3b6['body'][_0x4e8d('0x4f')]=_0x4cc418[_0x4e8d('0x4f')][_0x4e8d('0x98')][0x0][_0x4e8d('0x22')][_0x4e8d('0x4f')];_0xb9a3b6['body'][_0x4e8d('0x99')]=_0x4cc418[_0x4e8d('0x4f')]['notifications'][0x0]['message_id'];}if(_0xb9a3b6[_0x4e8d('0x4f')]['id']){delete _0xb9a3b6['body']['id'];}if(_['isNil'](_0xb9a3b6[_0x4e8d('0x4f')]['from'])){throw new db[(_0x4e8d('0x88'))][(_0x4e8d('0x89'))](_0x4e8d('0x9a'));}if(_[_0x4e8d('0x9b')](_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x4f')])||_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x4f')]===''){throw new db[(_0x4e8d('0x88'))][(_0x4e8d('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4e8d('0x9b')](_0xb9a3b6['body'][_0x4e8d('0x9c')])){throw new db[(_0x4e8d('0x88'))][(_0x4e8d('0x89'))](_0x4e8d('0x9d')+_0x301f8c);}if(!_[_0x4e8d('0x9e')](_0x301f8c,_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x9c')])){throw new db['Sequelize'][(_0x4e8d('0x89'))](_0x4e8d('0x9f')+_0x301f8c);}_0x56e30a[_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x9c')]]=_0xb9a3b6['body'][_0x4e8d('0x91')];return db[_0x4e8d('0xa0')]['find']({'where':{'id':_0xb9a3b6[_0x4e8d('0x7e')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x4e8d('0xa1'),'where':_0x56e30a,'limit':0x1,'order':[[_0x4e8d('0x8c'),_0x4e8d('0xa2')]]}]});})[_0x4e8d('0x19')](handleEntityNotFound(_0x31456a,null))['then'](function(_0x161c83){if(_0x161c83){_0xb9a3b6['list']=_[_0x4e8d('0xa3')](_0x161c83,[_0x4e8d('0xa1')]);if(_0x161c83['Contacts'][_0x4e8d('0x41')]){return _0x161c83[_0x4e8d('0xa1')][0x0];}var _0x6742bf=_[_0x4e8d('0x15')](_0xb9a3b6['body'],{'firstName':_0xb9a3b6['body'][_0x4e8d('0x91')],'ListId':_0x161c83['id']});_0x6742bf[_0xb9a3b6['body']['mapKey']]=_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x91')];return db[_0x4e8d('0x87')]['create'](_0x6742bf,{'fields':_0x1dec75,'raw':!![]});}})[_0x4e8d('0x19')](handleEntityNotFound(_0x31456a,null))[_0x4e8d('0x19')](function(_0xc9fb00){if(_0xc9fb00){_0xb9a3b6[_0x4e8d('0xa4')]=_0xc9fb00;var _0x5fe943={'ContactId':_0xc9fb00['id'],'phone':_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x91')],'WhatsappAccountId':_0x4cc418[_0x4e8d('0x4c')]['id']};var _0x3bd815={'ContactId':_0xc9fb00['id'],'WhatsappAccountId':_0x4cc418[_0x4e8d('0x4c')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x4e8d('0x4e')]({'where':_0x3bd815})[_0x4e8d('0x19')](function(_0x1e455d){if(_0x1e455d){return[_0x1e455d,![]];}return db[_0x4e8d('0xa5')][_0x4e8d('0x57')](_0x5fe943)['then'](function(_0x2dabb5){return[_0x2dabb5,!![]];});});}})[_0x4e8d('0x68')](function(_0x6e413b,_0xa5721d){_0xb9a3b6[_0x4e8d('0xa6')]=_0x6e413b[_0x4e8d('0x51')]({'plain':!![]});_0xb9a3b6[_0x4e8d('0xa6')][_0x4e8d('0xa7')]=![];if(_0xa5721d){if(_0xb9a3b6['account'][_0x4e8d('0xa8')]){_0xb9a3b6[_0x4e8d('0x84')][_0x4e8d('0xa9')]({'id':0x0,'priority':_0xb9a3b6[_0x4e8d('0x84')][_0x4e8d('0x41')]+0x1,'app':_0x4e8d('0xaa'),'appdata':_0x4e8d('0xab'),'interval':_0x4e8d('0xac')});}_0xb9a3b6[_0x4e8d('0xa6')][_0x4e8d('0xa7')]=!![];}return db['WhatsappMessage'][_0x4e8d('0x57')]({'phone':_0xb9a3b6[_0x4e8d('0x4f')]['from'],'messageId':_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x99')],'body':_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0x4f')],'WhatsappAccountId':_0x4cc418[_0x4e8d('0x4c')]['id'],'WhatsappInteractionId':_0x6e413b['id'],'direction':'in','ContactId':_0x6e413b['ContactId'],'AttachmentId':_0xb9a3b6[_0x4e8d('0x4f')][_0x4e8d('0xad')]});})[_0x4e8d('0x19')](function(_0x34cae3){_0xb9a3b6['message']=_0x34cae3;if(_0xb9a3b6[_0x4e8d('0xa6')][_0x4e8d('0xae')]){return db['User'][_0x4e8d('0x4e')]({'attributes':['id','name'],'where':{'id':_0xb9a3b6[_0x4e8d('0xa6')]['UserId']}})[_0x4e8d('0x19')](function(_0xaafced){if(_0xaafced){_0xb9a3b6[_0x4e8d('0x84')][_0x4e8d('0xaf')]({'id':0x0,'priority':0x0,'app':_0x4e8d('0xb0'),'appdata':_0xaafced[_0x4e8d('0x33')]+','+(_0xb9a3b6['account'][_0x4e8d('0xb1')]||0xa),'interval':_0x4e8d('0xac')});}return respondWithRpcPromise('Start',_0x4e8d('0xb2'),_0xb9a3b6);});}return respondWithRpcPromise(_0x4e8d('0xb3'),_0x4e8d('0xb2'),_0xb9a3b6);})[_0x4e8d('0x19')](function(_0x1f228a){if(_0x1f228a){var _0x32be6d=0xc8;var _0x4f0f1f=_0x4e8d('0xb4');logger[_0x4e8d('0x1a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4f0f1f,_0x32be6d,_0x4e8d('0xb5'));logger[_0x4e8d('0x1d')](_0x4e8d('0xb6'),_0x4f0f1f,_0x32be6d,_0x4e8d('0xb5'),JSON['stringify'](_0x1f228a));if(_0xb9a3b6[_0x4e8d('0x7e')][_0x4e8d('0x39')]===_0x4e8d('0x90')){return _0x31456a[_0x4e8d('0x26')](_0x32be6d)[_0x4e8d('0x2d')](_0x4e8d('0xb7'),_0x4e8d('0xb8'))['send'](_0x4e8d('0xb9'));}else{return _0x31456a[_0x4e8d('0x26')](_0x32be6d)['json'](_0x1f228a);}}});})[_0x4e8d('0x24')](handleError(_0x31456a,null));};exports[_0x4e8d('0x34')]=function(_0x367a12,_0x5b7c83,_0xbdc0e6){var _0x47fa4f,_0x4034db,_0x23e4fa;if(_[_0x4e8d('0x9b')](_0x367a12[_0x4e8d('0x4f')][_0x4e8d('0x4f')])||_0x367a12[_0x4e8d('0x4f')]['body']===''){throw new db[(_0x4e8d('0x88'))]['ValidationError'](_0x4e8d('0xba'));}if(_[_0x4e8d('0x9b')](_0x367a12['body']['to'])){throw new db['Sequelize'][(_0x4e8d('0x89'))]('to\x20is\x20mandatory');}_0x47fa4f=_0x367a12['body']['to'];return db[_0x4e8d('0x37')][_0x4e8d('0x4e')]({'where':{'id':_0x367a12[_0x4e8d('0x4c')]['id']},'include':[{'model':db['CmList'],'as':_0x4e8d('0xbb'),'include':[{'model':db[_0x4e8d('0x87')],'as':_0x4e8d('0xa1'),'where':{'mobile':_0x47fa4f},'limit':0x1,'order':[[_0x4e8d('0x8c'),_0x4e8d('0xa2')]]}]}]})[_0x4e8d('0x19')](handleEntityNotFound(_0x5b7c83,null))[_0x4e8d('0x19')](function(_0x2acc01){if(_0x2acc01&&_0x2acc01[_0x4e8d('0xbb')]){_0x4034db=_0x2acc01[_0x4e8d('0x51')]({'plain':!![]});if(_0x4034db[_0x4e8d('0xbb')]&&_0x4034db[_0x4e8d('0xbb')][_0x4e8d('0xa1')]['length']){return _0x4034db['List'][_0x4e8d('0xa1')][0x0];}return db[_0x4e8d('0x87')][_0x4e8d('0x57')](_[_0x4e8d('0x15')](_0x367a12['body'],{'firstName':_0x47fa4f,'mobile':_0x47fa4f,'phone':_0x47fa4f,'ListId':_0x4034db[_0x4e8d('0x8e')]}));}})[_0x4e8d('0x19')](handleEntityNotFound(_0x5b7c83,null))[_0x4e8d('0x19')](function(_0x58d0f8){if(_0x58d0f8){_0x23e4fa=_0x58d0f8;return db[_0x4e8d('0xa5')][_0x4e8d('0x4e')]({'where':{'ContactId':_0x23e4fa['id'],'closed':![],'WhatsappAccountId':_0x4034db['id']}})[_0x4e8d('0x19')](function(_0x5bfb6e){if(_0x5bfb6e){return[_0x5bfb6e,![]];}return db[_0x4e8d('0xa5')]['create']({'UserId':_0x367a12[_0x4e8d('0x50')]['id'],'ContactId':_0x23e4fa['id'],'WhatsappAccountId':_0x4034db['id'],'phone':_0x47fa4f,'firstMsgDirection':_0x4e8d('0xbc'),'Messages':[_['merge'](_0x367a12[_0x4e8d('0x4f')],{'read':![],'body':_0x367a12[_0x4e8d('0x4f')][_0x4e8d('0x4f')],'phone':_0x47fa4f,'WhatsappAccountId':_0x4034db['id'],'UserId':_0x367a12[_0x4e8d('0x50')]['id'],'ContactId':_0x23e4fa['id']})]},{'include':[{'model':db[_0x4e8d('0x82')],'as':_0x4e8d('0xbd')}]})[_0x4e8d('0x19')](function(_0x33ec26){return[_0x33ec26,!![]];});});}})[_0x4e8d('0x68')](function(_0x163d0b,_0x276d8f){if(_0x276d8f){return _0x163d0b;}return db['WhatsappMessage'][_0x4e8d('0x57')](_[_0x4e8d('0x46')](_0x367a12[_0x4e8d('0x4f')],{'read':![],'body':_0x367a12[_0x4e8d('0x4f')][_0x4e8d('0x4f')],'phone':_0x47fa4f,'WhatsappAccountId':_0x4034db['id'],'WhatsappInteractionId':_0x163d0b['id'],'UserId':_0x367a12[_0x4e8d('0x50')]['id'],'ContactId':_0x23e4fa['id']}))[_0x4e8d('0x19')](function(_0x4569d2){_0x163d0b[_0x4e8d('0xbe')][_0x4e8d('0xbd')]=[];_0x163d0b['dataValues'][_0x4e8d('0xbd')][_0x4e8d('0xa9')](_0x4569d2[_0x4e8d('0xbe')]);return _0x163d0b;});})[_0x4e8d('0x19')](respondWithResult(_0x5b7c83,null))['catch'](handleError(_0x5b7c83,null));}; \ No newline at end of file +var _0xc10b=['getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','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','defaults','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','offset','undefined','count','limit','set','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','WhatsappAccount','includeAll','include','rows','show','params','Pause','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','length','pick','WhatsappAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','ids','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','json'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xc10b,0x103));var _0xbc10=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xc10b[_0x580647];return _0x5f0792;};'use strict';var emlformat=require(_0xbc10('0x0'));var rimraf=require(_0xbc10('0x1'));var zipdir=require(_0xbc10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc10('0x3'));var moment=require(_0xbc10('0x4'));var BPromise=require(_0xbc10('0x5'));var Mustache=require(_0xbc10('0x6'));var util=require(_0xbc10('0x7'));var path=require(_0xbc10('0x8'));var sox=require(_0xbc10('0x9'));var csv=require(_0xbc10('0xa'));var ejs=require(_0xbc10('0xb'));var fs=require('fs');var fs_extra=require(_0xbc10('0xc'));var _=require('lodash');var squel=require(_0xbc10('0xd'));var crypto=require(_0xbc10('0xe'));var jsforce=require(_0xbc10('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbc10('0xa'));var querystring=require(_0xbc10('0x10'));var Papa=require('papaparse');var Redis=require(_0xbc10('0x11'));var authService=require(_0xbc10('0x12'));var qs=require(_0xbc10('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc10('0x14'))('api');var utils=require(_0xbc10('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbc10('0x16'));var db=require(_0xbc10('0x17'))['db'];config[_0xbc10('0x18')]=_['defaults'](config['redis'],{'host':_0xbc10('0x19'),'port':0x18eb});var socket=require(_0xbc10('0x1a'))(new Redis(config[_0xbc10('0x18')]));require(_0xbc10('0x1b'))[_0xbc10('0x1c')](socket);var jayson=require(_0xbc10('0x1d'));var client=jayson['client'][_0xbc10('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x343e04,_0x47beb4,_0x67489e,_0x3e7a44){return new BPromise(function(_0x2b3105,_0x4361bb){var _0x489243=_0x3e7a44||client;return _0x489243[_0xbc10('0x1f')](_0x343e04,_0x67489e)[_0xbc10('0x20')](function(_0x27ac80){logger[_0xbc10('0x21')](_0xbc10('0x22'),_0x47beb4,_0xbc10('0x23'));logger['debug'](_0xbc10('0x24'),_0x47beb4,_0xbc10('0x23'),JSON[_0xbc10('0x25')](_0x27ac80));if(_0x27ac80[_0xbc10('0x26')]){if(_0x27ac80[_0xbc10('0x26')]['code']===0x1f4){logger[_0xbc10('0x26')](_0xbc10('0x22'),_0x47beb4,_0x27ac80[_0xbc10('0x26')][_0xbc10('0x27')]);return _0x4361bb(_0x27ac80['error'][_0xbc10('0x27')]);}logger[_0xbc10('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x47beb4,_0x27ac80['error'][_0xbc10('0x27')]);return _0x2b3105(_0x27ac80[_0xbc10('0x26')][_0xbc10('0x27')]);}else{logger[_0xbc10('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x47beb4,_0xbc10('0x23'));_0x2b3105(_0x27ac80[_0xbc10('0x28')]['message']);}})[_0xbc10('0x29')](function(_0x358e5b){logger[_0xbc10('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x47beb4,_0x358e5b);_0x4361bb(_0x358e5b);});});}function respondWithStatusCode(_0x4c7b1c,_0x3d2169){_0x3d2169=_0x3d2169||0xcc;return function(_0x5ec416){if(_0x5ec416){return _0x4c7b1c[_0xbc10('0x2a')](_0x3d2169);}return _0x4c7b1c[_0xbc10('0x2b')](_0x3d2169)['end']();};}function respondWithResult(_0x81baae,_0x164cf3){_0x164cf3=_0x164cf3||0xc8;return function(_0x410f8a){if(_0x410f8a){return _0x81baae['status'](_0x164cf3)['json'](_0x410f8a);}};}function respondWithFilteredResult(_0x8dbe4f,_0x7f1c6){return function(_0x1fa190){if(_0x1fa190){var _0x3386a1=typeof _0x7f1c6[_0xbc10('0x2c')]===_0xbc10('0x2d')&&typeof _0x7f1c6['limit']===_0xbc10('0x2d');var _0x250ed6=_0x1fa190[_0xbc10('0x2e')];var _0xaabc92=_0x3386a1?0x0:_0x7f1c6[_0xbc10('0x2c')];var _0x135ca4=_0x3386a1?_0x1fa190[_0xbc10('0x2e')]:_0x7f1c6[_0xbc10('0x2c')]+_0x7f1c6[_0xbc10('0x2f')];var _0x11a3b3;if(_0x135ca4>=_0x250ed6){_0x135ca4=_0x250ed6;_0x11a3b3=0xc8;}else{_0x11a3b3=0xce;}_0x8dbe4f[_0xbc10('0x2b')](_0x11a3b3);return _0x8dbe4f[_0xbc10('0x30')]('Content-Range',_0xaabc92+'-'+_0x135ca4+'/'+_0x250ed6)['json'](_0x1fa190);}return null;};}function patchUpdates(_0x436f91){return function(_0x1a8f87){try{jsonpatch[_0xbc10('0x31')](_0x1a8f87,_0x436f91,!![]);}catch(_0x27fac9){return BPromise[_0xbc10('0x32')](_0x27fac9);}return _0x1a8f87[_0xbc10('0x33')]();};}function saveUpdates(_0x2d810f,_0x400aa1){return function(_0x4dd292){if(_0x4dd292){return _0x4dd292[_0xbc10('0x34')](_0x2d810f)[_0xbc10('0x20')](function(_0x257620){return _0x257620;});}return null;};}function removeEntity(_0x59025f,_0x558e38){return function(_0x515f53){if(_0x515f53){return _0x515f53[_0xbc10('0x35')]()[_0xbc10('0x20')](function(){var _0x1e3361=_0x515f53['get']({'plain':!![]});var _0x4ffdde=_0xbc10('0x36');return db[_0xbc10('0x37')][_0xbc10('0x35')]({'where':{'type':_0x4ffdde,'resourceId':_0x1e3361['id']}})[_0xbc10('0x20')](function(){return _0x515f53;});})[_0xbc10('0x20')](function(){_0x59025f[_0xbc10('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x264d39,_0x4f078f){return function(_0x219ca5){if(!_0x219ca5){_0x264d39[_0xbc10('0x2a')](0x194);}return _0x219ca5;};}function handleError(_0x262e0b,_0x5baf94){_0x5baf94=_0x5baf94||0x1f4;return function(_0x1bfc2c){logger[_0xbc10('0x26')](_0x1bfc2c[_0xbc10('0x38')]);if(_0x1bfc2c['name']){delete _0x1bfc2c[_0xbc10('0x39')];}_0x262e0b[_0xbc10('0x2b')](_0x5baf94)[_0xbc10('0x3a')](_0x1bfc2c);};}exports[_0xbc10('0x3b')]=function(_0x1fcaa2,_0x59dd1a){var _0x2d192e={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x42fd74={},_0x3420c1={'count':0x0,'rows':[]};var _0x723fa5=_[_0xbc10('0x3c')](db['WhatsappAccount'][_0xbc10('0x3d')],function(_0x4b5a7a){return{'name':_0x4b5a7a[_0xbc10('0x3e')],'type':_0x4b5a7a[_0xbc10('0x3f')][_0xbc10('0x40')]};});_0x42fd74[_0xbc10('0x41')]=_['map'](_0x723fa5,_0xbc10('0x39'));_0x42fd74['query']=_['keys'](_0x1fcaa2[_0xbc10('0x42')]);_0x42fd74['filters']=_['intersection'](_0x42fd74[_0xbc10('0x41')],_0x42fd74['query']);_0x2d192e[_0xbc10('0x43')]=_[_0xbc10('0x44')](_0x42fd74[_0xbc10('0x41')],qs[_0xbc10('0x45')](_0x1fcaa2[_0xbc10('0x42')]['fields']));_0x2d192e['attributes']=_0x2d192e[_0xbc10('0x43')]['length']?_0x2d192e[_0xbc10('0x43')]:_0x42fd74['model'];if(!_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x46')](_0xbc10('0x47'))){_0x2d192e[_0xbc10('0x2f')]=qs[_0xbc10('0x2f')](_0x1fcaa2['query'][_0xbc10('0x2f')]);_0x2d192e[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x1fcaa2[_0xbc10('0x42')]['offset']);}_0x2d192e[_0xbc10('0x48')]=qs[_0xbc10('0x49')](_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x49')]);_0x2d192e[_0xbc10('0x4a')]=qs[_0xbc10('0x4b')](_['pick'](_0x1fcaa2[_0xbc10('0x42')],_0x42fd74['filters']),_0x723fa5);if(_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x4c')]){_0x2d192e[_0xbc10('0x4a')]=_['merge'](_0x2d192e['where'],{'$or':_[_0xbc10('0x3c')](_0x723fa5,function(_0x16d6ce){if(_0x16d6ce['type']!=='VIRTUAL'){var _0x461286={};_0x461286[_0x16d6ce[_0xbc10('0x39')]]={'$like':'%'+_0x1fcaa2[_0xbc10('0x42')]['filter']+'%'};return _0x461286;}})});}_0x2d192e=_[_0xbc10('0x4d')]({},_0x2d192e,_0x1fcaa2[_0xbc10('0x4e')]);var _0x7d3304={'where':_0x2d192e[_0xbc10('0x4a')]};return db[_0xbc10('0x4f')]['count'](_0x7d3304)['then'](function(_0x3bdfec){_0x3420c1[_0xbc10('0x2e')]=_0x3bdfec;if(_0x1fcaa2[_0xbc10('0x42')][_0xbc10('0x50')]){_0x2d192e[_0xbc10('0x51')]=[{'all':!![]}];}return db[_0xbc10('0x4f')]['findAll'](_0x2d192e);})['then'](function(_0x22d617){_0x3420c1[_0xbc10('0x52')]=_0x22d617;return _0x3420c1;})[_0xbc10('0x20')](respondWithFilteredResult(_0x59dd1a,_0x2d192e))[_0xbc10('0x29')](handleError(_0x59dd1a,null));};exports[_0xbc10('0x53')]=function(_0x3e4e49,_0x184a17){var _0x48fd81={'raw':![],'where':{'id':_0x3e4e49[_0xbc10('0x54')]['id']},'include':[{'model':db[_0xbc10('0x55')],'as':'mandatoryDispositionPause'}]},_0x4c6bc9={};_0x4c6bc9['model']=_[_0xbc10('0x56')](db['WhatsappAccount']['rawAttributes']);_0x4c6bc9[_0xbc10('0x42')]=_[_0xbc10('0x56')](_0x3e4e49[_0xbc10('0x42')]);_0x4c6bc9[_0xbc10('0x4b')]=_[_0xbc10('0x44')](_0x4c6bc9['model'],_0x4c6bc9['query']);_0x48fd81[_0xbc10('0x43')]=_[_0xbc10('0x44')](_0x4c6bc9[_0xbc10('0x41')],qs[_0xbc10('0x45')](_0x3e4e49[_0xbc10('0x42')][_0xbc10('0x45')]));_0x48fd81[_0xbc10('0x43')]=_0x48fd81[_0xbc10('0x43')]['length']?_0x48fd81['attributes']:_0x4c6bc9['model'];if(_0x3e4e49[_0xbc10('0x42')][_0xbc10('0x50')]){_0x48fd81[_0xbc10('0x51')]=[{'all':!![]}];}_0x48fd81=_[_0xbc10('0x4d')]({},_0x48fd81,_0x3e4e49['options']);return db[_0xbc10('0x4f')][_0xbc10('0x57')](_0x48fd81)['then'](handleEntityNotFound(_0x184a17,null))[_0xbc10('0x20')](respondWithResult(_0x184a17,null))[_0xbc10('0x29')](handleError(_0x184a17,null));};exports['create']=function(_0x2a8ab7,_0x2d33c5){return db[_0xbc10('0x4f')][_0xbc10('0x58')](_0x2a8ab7[_0xbc10('0x59')],{})[_0xbc10('0x20')](function(_0xcfb82a){var _0x13fd92=_0x2a8ab7[_0xbc10('0x5a')][_0xbc10('0x5b')]({'plain':!![]});if(!_0x13fd92)throw new Error(_0xbc10('0x5c'));if(_0x13fd92[_0xbc10('0x5d')]===_0xbc10('0x5a')){var _0x4b7f00=_0xcfb82a['get']({'plain':!![]});var _0x352465=_0xbc10('0x36');return db['UserProfileSection'][_0xbc10('0x57')]({'where':{'name':_0x352465,'userProfileId':_0x13fd92[_0xbc10('0x5e')]},'raw':!![]})[_0xbc10('0x20')](function(_0x2c9540){if(_0x2c9540&&_0x2c9540[_0xbc10('0x5f')]===0x0){return db[_0xbc10('0x37')][_0xbc10('0x58')]({'name':_0x4b7f00[_0xbc10('0x39')],'resourceId':_0x4b7f00['id'],'type':_0x2c9540[_0xbc10('0x39')],'sectionId':_0x2c9540['id']},{})[_0xbc10('0x20')](function(){return _0xcfb82a;});}else{return _0xcfb82a;}})[_0xbc10('0x29')](function(_0x117b9a){logger[_0xbc10('0x26')](_0xbc10('0x60'),_0x117b9a);throw _0x117b9a;});}return _0xcfb82a;})[_0xbc10('0x20')](respondWithResult(_0x2d33c5,0xc9))[_0xbc10('0x29')](handleError(_0x2d33c5,null));};exports[_0xbc10('0x34')]=function(_0x4209f0,_0x10b655){if(_0x4209f0[_0xbc10('0x59')]['id']){delete _0x4209f0[_0xbc10('0x59')]['id'];}return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x4209f0['params']['id']},'include':[{'model':db[_0xbc10('0x55')],'as':_0xbc10('0x61')}]})[_0xbc10('0x20')](handleEntityNotFound(_0x10b655,null))['then'](saveUpdates(_0x4209f0[_0xbc10('0x59')],null))[_0xbc10('0x20')](respondWithResult(_0x10b655,null))[_0xbc10('0x29')](handleError(_0x10b655,null));};exports[_0xbc10('0x35')]=function(_0x5029cb,_0x354deb){return db[_0xbc10('0x4f')]['find']({'where':{'id':_0x5029cb['params']['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x354deb,null))[_0xbc10('0x20')](removeEntity(_0x354deb,null))['catch'](handleError(_0x354deb,null));};exports[_0xbc10('0x62')]=function(_0x115d54,_0x4d208d){return db[_0xbc10('0x4f')][_0xbc10('0x62')]()['then'](respondWithResult(_0x4d208d,null))[_0xbc10('0x29')](handleError(_0x4d208d,null));};exports[_0xbc10('0x63')]=function(_0x25c6cb,_0x3a6521,_0x33c492){if(_0x25c6cb[_0xbc10('0x59')]['id']){delete _0x25c6cb['body']['id'];}return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x25c6cb[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x3a6521,null))[_0xbc10('0x20')](function(_0x3abc39){if(_0x3abc39){_0x25c6cb['body']['WhatsappAccountId']=_0x3abc39['id'];return db[_0xbc10('0x64')]['create'](_0x25c6cb[_0xbc10('0x59')]);}})['then'](respondWithResult(_0x3a6521,null))[_0xbc10('0x29')](handleError(_0x3a6521,null));};exports[_0xbc10('0x65')]=function(_0x467fc1,_0x5487e2,_0x370670){var _0x268eab={'raw':![],'where':{}};var _0x3b244a={};var _0x536578={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbc10('0x66')]({'where':{'id':_0x467fc1[_0xbc10('0x54')]['id']}})['then'](handleEntityNotFound(_0x5487e2,null))['then'](function(_0x3a5c59){if(_0x3a5c59){_0x3b244a['model']=_['keys'](db[_0xbc10('0x64')][_0xbc10('0x3d')]);_0x3b244a[_0xbc10('0x42')]=_[_0xbc10('0x56')](_0x467fc1[_0xbc10('0x42')]);_0x3b244a['filters']=_[_0xbc10('0x44')](_0x3b244a[_0xbc10('0x41')],_0x3b244a[_0xbc10('0x42')]);_0x268eab[_0xbc10('0x43')]=_[_0xbc10('0x44')](_0x3b244a[_0xbc10('0x41')],qs[_0xbc10('0x45')](_0x467fc1[_0xbc10('0x42')][_0xbc10('0x45')]));_0x268eab[_0xbc10('0x43')]=_0x268eab[_0xbc10('0x43')][_0xbc10('0x67')]?_0x268eab['attributes']:_0x3b244a[_0xbc10('0x41')];if(!_0x467fc1[_0xbc10('0x42')]['hasOwnProperty']('nolimit')){_0x268eab['limit']=qs[_0xbc10('0x2f')](_0x467fc1[_0xbc10('0x42')]['limit']);_0x268eab[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x467fc1['query'][_0xbc10('0x2c')]);}_0x268eab['order']=qs[_0xbc10('0x49')](_0x467fc1[_0xbc10('0x42')][_0xbc10('0x49')]);_0x268eab[_0xbc10('0x4a')]=qs[_0xbc10('0x4b')](_[_0xbc10('0x68')](_0x467fc1[_0xbc10('0x42')],_0x3b244a[_0xbc10('0x4b')]));_0x268eab[_0xbc10('0x4a')][_0xbc10('0x69')]=_0x3a5c59['id'];if(_0x467fc1[_0xbc10('0x42')][_0xbc10('0x4c')]){_0x268eab[_0xbc10('0x4a')]=_[_0xbc10('0x4d')](_0x268eab[_0xbc10('0x4a')],{'$or':_[_0xbc10('0x3c')](_0x268eab[_0xbc10('0x43')],function(_0x103c32){var _0x439292={};_0x439292[_0x103c32]={'$like':'%'+_0x467fc1[_0xbc10('0x42')][_0xbc10('0x4c')]+'%'};return _0x439292;})});}_0x268eab=_[_0xbc10('0x4d')]({},_0x268eab,_0x467fc1[_0xbc10('0x4e')]);return db[_0xbc10('0x64')]['count']({'where':_0x268eab[_0xbc10('0x4a')]})[_0xbc10('0x20')](function(_0x3f7b0e){_0x536578['count']=_0x3f7b0e;if(_0x467fc1['query'][_0xbc10('0x50')]){_0x268eab[_0xbc10('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x268eab);})[_0xbc10('0x20')](function(_0x39ce07){_0x536578['rows']=_0x39ce07;return _0x536578;});}})['then'](respondWithFilteredResult(_0x5487e2,_0x268eab))[_0xbc10('0x29')](handleError(_0x5487e2,null));};exports['removeDispositions']=function(_0x1dc0fd,_0xa647b9,_0x5aae90){return db[_0xbc10('0x4f')]['find']({'where':{'id':_0x1dc0fd[_0xbc10('0x54')]['id']}})['then'](handleEntityNotFound(_0xa647b9,null))[_0xbc10('0x20')](function(_0x218aec){if(_0x218aec){return _0x218aec[_0xbc10('0x6a')](_0x1dc0fd['query']['ids']);}})[_0xbc10('0x20')](respondWithStatusCode(_0xa647b9,null))['catch'](handleError(_0xa647b9,null));};exports['addAnswer']=function(_0xb9c923,_0x4f20b1,_0x719763){if(_0xb9c923[_0xbc10('0x59')]['id']){delete _0xb9c923['body']['id'];}return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0xb9c923[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x4f20b1,null))['then'](function(_0x789f4b){if(_0x789f4b){_0xb9c923['body'][_0xbc10('0x69')]=_0x789f4b['id'];return db[_0xbc10('0x6b')][_0xbc10('0x58')](_0xb9c923[_0xbc10('0x59')]);}})[_0xbc10('0x20')](respondWithResult(_0x4f20b1,null))[_0xbc10('0x29')](handleError(_0x4f20b1,null));};exports[_0xbc10('0x6c')]=function(_0x280669,_0x51ea13,_0x35cd8d){var _0x8dfe50={'raw':![],'where':{}};var _0xf269e1={};var _0x596d84={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbc10('0x66')]({'where':{'id':_0x280669[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x51ea13,null))[_0xbc10('0x20')](function(_0x307111){if(_0x307111){_0xf269e1[_0xbc10('0x41')]=_[_0xbc10('0x56')](db[_0xbc10('0x6b')][_0xbc10('0x3d')]);_0xf269e1['query']=_[_0xbc10('0x56')](_0x280669[_0xbc10('0x42')]);_0xf269e1[_0xbc10('0x4b')]=_[_0xbc10('0x44')](_0xf269e1['model'],_0xf269e1['query']);_0x8dfe50[_0xbc10('0x43')]=_['intersection'](_0xf269e1[_0xbc10('0x41')],qs['fields'](_0x280669[_0xbc10('0x42')][_0xbc10('0x45')]));_0x8dfe50[_0xbc10('0x43')]=_0x8dfe50[_0xbc10('0x43')]['length']?_0x8dfe50['attributes']:_0xf269e1[_0xbc10('0x41')];if(!_0x280669[_0xbc10('0x42')][_0xbc10('0x46')]('nolimit')){_0x8dfe50[_0xbc10('0x2f')]=qs['limit'](_0x280669[_0xbc10('0x42')][_0xbc10('0x2f')]);_0x8dfe50['offset']=qs[_0xbc10('0x2c')](_0x280669[_0xbc10('0x42')][_0xbc10('0x2c')]);}_0x8dfe50[_0xbc10('0x48')]=qs[_0xbc10('0x49')](_0x280669[_0xbc10('0x42')][_0xbc10('0x49')]);_0x8dfe50[_0xbc10('0x4a')]=qs['filters'](_[_0xbc10('0x68')](_0x280669['query'],_0xf269e1[_0xbc10('0x4b')]));_0x8dfe50[_0xbc10('0x4a')][_0xbc10('0x69')]=_0x307111['id'];if(_0x280669[_0xbc10('0x42')][_0xbc10('0x4c')]){_0x8dfe50[_0xbc10('0x4a')]=_[_0xbc10('0x4d')](_0x8dfe50['where'],{'$or':_[_0xbc10('0x3c')](_0x8dfe50['attributes'],function(_0x2d34c3){var _0x25a800={};_0x25a800[_0x2d34c3]={'$like':'%'+_0x280669[_0xbc10('0x42')]['filter']+'%'};return _0x25a800;})});}_0x8dfe50=_[_0xbc10('0x4d')]({},_0x8dfe50,_0x280669[_0xbc10('0x4e')]);return db['CannedAnswer'][_0xbc10('0x2e')]({'where':_0x8dfe50[_0xbc10('0x4a')]})[_0xbc10('0x20')](function(_0x108fba){_0x596d84[_0xbc10('0x2e')]=_0x108fba;if(_0x280669[_0xbc10('0x42')][_0xbc10('0x50')]){_0x8dfe50[_0xbc10('0x51')]=[{'all':!![]}];}return db[_0xbc10('0x6b')]['findAll'](_0x8dfe50);})[_0xbc10('0x20')](function(_0x1eeb56){_0x596d84[_0xbc10('0x52')]=_0x1eeb56;return _0x596d84;});}})[_0xbc10('0x20')](respondWithFilteredResult(_0x51ea13,_0x8dfe50))[_0xbc10('0x29')](handleError(_0x51ea13,null));};exports['removeAnswers']=function(_0x2d320b,_0x2f3f21,_0x4c0752){return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x2d320b[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x2f3f21,null))[_0xbc10('0x20')](function(_0x4227e4){if(_0x4227e4){return _0x4227e4[_0xbc10('0x6d')](_0x2d320b[_0xbc10('0x42')]['ids']);}})[_0xbc10('0x20')](respondWithStatusCode(_0x2f3f21,null))[_0xbc10('0x29')](handleError(_0x2f3f21,null));};exports[_0xbc10('0x6e')]=function(_0x3bbba0,_0x1b96a1,_0x4ad3a5){return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x3bbba0[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x1b96a1,null))[_0xbc10('0x20')](function(_0x1fa80a){if(_0x1fa80a){return _0x1fa80a[_0xbc10('0x6e')](_0x3bbba0[_0xbc10('0x59')]['ids'],_[_0xbc10('0x6f')](_0x3bbba0[_0xbc10('0x59')],[_0xbc10('0x70'),'id'])||{})[_0xbc10('0x71')](function(_0x510ba1){for(var _0x2a4934=0x0;_0x2a4934<_0x3bbba0[_0xbc10('0x59')][_0xbc10('0x70')][_0xbc10('0x67')];_0x2a4934+=0x1){socket[_0xbc10('0x72')](_0xbc10('0x73'),{'UserId':Number(_0x3bbba0[_0xbc10('0x59')][_0xbc10('0x70')][_0x2a4934]),'WhatsappAccountId':Number(_0x3bbba0[_0xbc10('0x54')]['id'])});}return _0x510ba1;});}})[_0xbc10('0x20')](respondWithResult(_0x1b96a1,null))[_0xbc10('0x29')](handleError(_0x1b96a1,null));};exports[_0xbc10('0x74')]=function(_0x3009d8,_0x126e41,_0x26dcc4){return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x3009d8[_0xbc10('0x54')]['id']}})['then'](handleEntityNotFound(_0x126e41,null))[_0xbc10('0x20')](function(_0x4f0b12){if(_0x4f0b12){return _0x4f0b12[_0xbc10('0x74')](_0x3009d8[_0xbc10('0x42')][_0xbc10('0x70')])[_0xbc10('0x20')](function(){if(_['isArray'](_0x3009d8[_0xbc10('0x42')][_0xbc10('0x70')])){for(var _0x136117=0x0;_0x136117<_0x3009d8['query'][_0xbc10('0x70')][_0xbc10('0x67')];_0x136117+=0x1){socket['emit'](_0xbc10('0x75'),{'UserId':Number(_0x3009d8['query'][_0xbc10('0x70')][_0x136117]),'WhatsappAccountId':Number(_0x3009d8['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x3009d8[_0xbc10('0x42')][_0xbc10('0x70')]),'WhatsappAccountId':Number(_0x3009d8[_0xbc10('0x54')]['id'])});}});}})[_0xbc10('0x20')](respondWithStatusCode(_0x126e41,null))[_0xbc10('0x29')](handleError(_0x126e41,null));};exports[_0xbc10('0x76')]=function(_0x3c4aec,_0x5c5d3a,_0x28efdb){var _0x7c3098={};var _0x4975c6={};var _0x2323e9;var _0xeda816;return db[_0xbc10('0x4f')][_0xbc10('0x66')]({'where':{'id':_0x3c4aec[_0xbc10('0x54')]['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x5c5d3a,null))[_0xbc10('0x20')](function(_0x15391b){if(_0x15391b){_0x2323e9=_0x15391b;_0x4975c6['model']=_['keys'](db[_0xbc10('0x77')]['rawAttributes']);_0x4975c6['query']=_['keys'](_0x3c4aec['query']);_0x4975c6['filters']=_[_0xbc10('0x44')](_0x4975c6[_0xbc10('0x41')],_0x4975c6[_0xbc10('0x42')]);_0x7c3098[_0xbc10('0x43')]=_['intersection'](_0x4975c6['model'],qs['fields'](_0x3c4aec['query'][_0xbc10('0x45')]));_0x7c3098[_0xbc10('0x43')]=_0x7c3098[_0xbc10('0x43')]['length']?_0x7c3098[_0xbc10('0x43')]:_0x4975c6[_0xbc10('0x41')];_0x7c3098['order']=qs[_0xbc10('0x49')](_0x3c4aec['query'][_0xbc10('0x49')]);_0x7c3098[_0xbc10('0x4a')]=qs[_0xbc10('0x4b')](_[_0xbc10('0x68')](_0x3c4aec['query'],_0x4975c6['filters']));if(_0x3c4aec[_0xbc10('0x42')]['filter']){_0x7c3098[_0xbc10('0x4a')]=_['merge'](_0x7c3098['where'],{'$or':_['map'](_0x7c3098[_0xbc10('0x43')],function(_0x5d1b3e){var _0x1d7182={};_0x1d7182[_0x5d1b3e]={'$like':'%'+_0x3c4aec[_0xbc10('0x42')]['filter']+'%'};return _0x1d7182;})});}_0x7c3098=_[_0xbc10('0x4d')]({},_0x7c3098,_0x3c4aec[_0xbc10('0x4e')]);return _0x2323e9['getAgents'](_0x7c3098);}})[_0xbc10('0x20')](function(_0x5d50be){if(_0x5d50be){_0xeda816=_0x5d50be[_0xbc10('0x67')];if(!_0x3c4aec[_0xbc10('0x42')][_0xbc10('0x46')](_0xbc10('0x47'))){_0x7c3098['limit']=qs['limit'](_0x3c4aec[_0xbc10('0x42')][_0xbc10('0x2f')]);_0x7c3098[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x3c4aec[_0xbc10('0x42')][_0xbc10('0x2c')]);}return _0x2323e9[_0xbc10('0x76')](_0x7c3098);}})[_0xbc10('0x20')](function(_0x3e556d){if(_0x3e556d){return _0x3e556d?{'count':_0xeda816,'rows':_0x3e556d}:null;}})[_0xbc10('0x20')](respondWithResult(_0x5c5d3a,null))[_0xbc10('0x29')](handleError(_0x5c5d3a,null));};exports['addApplications']=function(_0x1da3d8,_0x143052){var _0x241f59=_0x1da3d8[_0xbc10('0x54')]['id'];var _0x19326d=_0x1da3d8[_0xbc10('0x59')];var _0x6bcc56=0xc8;var _0x2e4b5d=null;return db[_0xbc10('0x78')][_0xbc10('0x79')]({'isolationLevel':db['sequelize'][_0xbc10('0x7a')][_0xbc10('0x7b')]['READ_COMMITTED']},function(_0x5e3b34){return db[_0xbc10('0x4f')][_0xbc10('0x66')]({'where':{'id':_0x241f59},'transaction':_0x5e3b34})[_0xbc10('0x20')](function(_0x160162){if(_0x160162){return db[_0xbc10('0x7c')][_0xbc10('0x35')]({'where':{'WhatsappAccountId':_0x241f59},'transaction':_0x5e3b34})[_0xbc10('0x20')](function(){var _0x5c0f22=_[_0xbc10('0x3c')](_0x19326d,function(_0x27109e){_0x27109e['WhatsappAccountId']=_0x241f59;return _0x27109e;});return db[_0xbc10('0x7c')][_0xbc10('0x7d')](_0x5c0f22,{'transaction':_0x5e3b34});});}else{_0x6bcc56=0x194;_0x2e4b5d=[];}});})[_0xbc10('0x20')](function(){if(_0x6bcc56!==0x194){return db[_0xbc10('0x7c')][_0xbc10('0x7e')]({'where':{'WhatsappAccountId':_0x241f59},'order':_0xbc10('0x7f')})[_0xbc10('0x20')](function(_0x3623ca){_0x2e4b5d=_0x3623ca;});}})[_0xbc10('0x29')](function(_0x2db9bf){_0x6bcc56=0x1f4;logger[_0xbc10('0x26')](_0x2db9bf['stack']);if(_0x2db9bf[_0xbc10('0x39')]){delete _0x2db9bf[_0xbc10('0x39')];}_0x2e4b5d=_0x2db9bf;})['finally'](function(){if(_0x2e4b5d===null){_0x143052[_0xbc10('0x2a')](_0x6bcc56);}else{if(_0x6bcc56===0x1f4){_0x143052[_0xbc10('0x2b')](_0x6bcc56)[_0xbc10('0x3a')](_0x2e4b5d);}else{_0x143052['status'](_0x6bcc56)[_0xbc10('0x80')](_0x2e4b5d);}}});};exports['getApplications']=function(_0x4fe45c,_0x52a151,_0x4096f6){var _0x2012a0={};var _0x256fe8={};var _0x32b189;var _0x433ca1;return db[_0xbc10('0x4f')][_0xbc10('0x66')]({'where':{'id':_0x4fe45c['params']['id']}})[_0xbc10('0x20')](handleEntityNotFound(_0x52a151,null))['then'](function(_0x298fad){if(_0x298fad){_0x32b189=_0x298fad;_0x256fe8[_0xbc10('0x41')]=_[_0xbc10('0x56')](db[_0xbc10('0x7c')][_0xbc10('0x3d')]);_0x256fe8[_0xbc10('0x42')]=_[_0xbc10('0x56')](_0x4fe45c[_0xbc10('0x42')]);_0x256fe8[_0xbc10('0x4b')]=_[_0xbc10('0x44')](_0x256fe8[_0xbc10('0x41')],_0x256fe8[_0xbc10('0x42')]);_0x2012a0['attributes']=_[_0xbc10('0x44')](_0x256fe8[_0xbc10('0x41')],qs['fields'](_0x4fe45c[_0xbc10('0x42')][_0xbc10('0x45')]));_0x2012a0[_0xbc10('0x43')]=_0x2012a0['attributes'][_0xbc10('0x67')]?_0x2012a0[_0xbc10('0x43')]:_0x256fe8[_0xbc10('0x41')];_0x2012a0[_0xbc10('0x48')]=qs[_0xbc10('0x49')](_0x4fe45c['query'][_0xbc10('0x49')]);_0x2012a0[_0xbc10('0x4a')]=qs['filters'](_['pick'](_0x4fe45c[_0xbc10('0x42')],_0x256fe8[_0xbc10('0x4b')]));if(_0x4fe45c[_0xbc10('0x42')]['filter']){_0x2012a0[_0xbc10('0x4a')]=_[_0xbc10('0x4d')](_0x2012a0[_0xbc10('0x4a')],{'$or':_[_0xbc10('0x3c')](_0x2012a0[_0xbc10('0x43')],function(_0x3a66f9){var _0x3019c2={};_0x3019c2[_0x3a66f9]={'$like':'%'+_0x4fe45c['query'][_0xbc10('0x4c')]+'%'};return _0x3019c2;})});}_0x2012a0=_[_0xbc10('0x4d')]({},_0x2012a0,_0x4fe45c[_0xbc10('0x4e')]);return _0x32b189[_0xbc10('0x81')](_0x2012a0);}})[_0xbc10('0x20')](function(_0x308517){if(_0x308517){_0x433ca1=_0x308517[_0xbc10('0x67')];if(!_0x4fe45c[_0xbc10('0x42')]['hasOwnProperty'](_0xbc10('0x47'))){_0x2012a0['limit']=qs[_0xbc10('0x2f')](_0x4fe45c['query'][_0xbc10('0x2f')]);_0x2012a0[_0xbc10('0x2c')]=qs[_0xbc10('0x2c')](_0x4fe45c['query']['offset']);}return _0x32b189[_0xbc10('0x81')](_0x2012a0);}})['then'](function(_0x5ab3dc){if(_0x5ab3dc){return _0x5ab3dc?{'count':_0x433ca1,'rows':_0x5ab3dc}:null;}})[_0xbc10('0x20')](respondWithResult(_0x52a151,null))[_0xbc10('0x29')](handleError(_0x52a151,null));};exports[_0xbc10('0x82')]=function(_0x1ed651,_0x2f12dd,_0x376fca){var _0x4c7aa5={'channel':_0xbc10('0x83')};var _0x3a8813=[];var _0x12f747=[];var _0x4880c3={};return db[_0xbc10('0x4f')][_0xbc10('0x57')]({'where':{'id':_0x1ed651['params']['id']},'include':[{'model':db[_0xbc10('0x7c')],'as':_0xbc10('0x84')}]})[_0xbc10('0x20')](handleEntityNotFound(_0x2f12dd,null))[_0xbc10('0x20')](function(_0x3a752e){_0x4c7aa5[_0xbc10('0x85')]=_0x3a752e;if(_0x4c7aa5[_0xbc10('0x85')]&&_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0x3f')]===_0xbc10('0x86')&&_0x1ed651[_0xbc10('0x59')]['statuses']){if(_0x1ed651['body'][_0xbc10('0x87')][_0xbc10('0x67')]===0x0)return;if(_0x1ed651[_0xbc10('0x59')][_0xbc10('0x87')][0x0][_0xbc10('0x88')]!==_0xbc10('0x89'))return;return db[_0xbc10('0x8a')]['update']({'read':!![],'readAt':_0x1ed651['body'][_0xbc10('0x87')][0x0][_0xbc10('0x8b')]},{'where':{'messageId':_0x1ed651['body'][_0xbc10('0x87')][0x0][_0xbc10('0x8c')]},'individualHooks':!![]})[_0xbc10('0x20')](function(_0x15b938){return _0x2f12dd[_0xbc10('0x2b')](0xc8)[_0xbc10('0x80')](_0x15b938);});}_0x4c7aa5['applications']=_['orderBy'](_0x3a752e[_0xbc10('0x84')],[_0xbc10('0x7f')],['asc']);if(_0x4c7aa5['account'][_0xbc10('0x84')]){delete _0x4c7aa5['account']['Applications'];}return db[_0xbc10('0x8d')][_0xbc10('0x62')]()[_0xbc10('0x20')](function(_0x452b4b){if(!_0x452b4b){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))](_0xbc10('0x90'));}_0x3a8813=_['difference'](_[_0xbc10('0x56')](_0x452b4b),['createdAt',_0xbc10('0x91')]);_0x12f747=_[_0xbc10('0x92')](_[_0xbc10('0x56')](_0x452b4b),['createdAt',_0xbc10('0x91'),_0xbc10('0x93'),_0xbc10('0x94')]);_0x4c7aa5['body']={'mapKey':_0xbc10('0x95')};if(_0x4c7aa5[_0xbc10('0x85')]&&_0x4c7aa5['account'][_0xbc10('0x3f')]==='twilio'){_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x96')]=_0x1ed651['body']['From'][_0xbc10('0x97')](_0xbc10('0x98'),'');_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x59')]=_0x1ed651[_0xbc10('0x59')][_0xbc10('0x99')];_0x4c7aa5['body'][_0xbc10('0x9a')]=_0x1ed651['body'][_0xbc10('0x9b')];}if(_0x4c7aa5[_0xbc10('0x85')]&&_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0x3f')]===_0xbc10('0x86')){_0x4c7aa5['body'][_0xbc10('0x96')]=_0x1ed651['body'][_0xbc10('0x9c')][0x0]['from'];_0x4c7aa5['body'][_0xbc10('0x59')]=_0x1ed651['body'][_0xbc10('0x9c')][0x0]['message'][_0xbc10('0x59')];_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x9a')]=_0x1ed651[_0xbc10('0x59')]['notifications'][0x0]['message_id'];}if(_0x4c7aa5[_0xbc10('0x59')]['id']){delete _0x4c7aa5[_0xbc10('0x59')]['id'];}if(_[_0xbc10('0x9d')](_0x4c7aa5['body']['from'])){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4c7aa5['body'][_0xbc10('0x59')])||_0x4c7aa5['body'][_0xbc10('0x59')]===''){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))](_0xbc10('0x9e'));}if(_[_0xbc10('0x9d')](_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x9f')])){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12f747);}if(!_['includes'](_0x12f747,_0x4c7aa5['body'][_0xbc10('0x9f')])){throw new db['Sequelize'][(_0xbc10('0x8f'))](_0xbc10('0xa0')+_0x12f747);}_0x4880c3[_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x9f')]]=_0x4c7aa5[_0xbc10('0x59')]['from'];return db[_0xbc10('0xa1')][_0xbc10('0x57')]({'where':{'id':_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0x94')]},'include':[{'model':db[_0xbc10('0x8d')],'as':_0xbc10('0xa2'),'where':_0x4880c3,'limit':0x1,'order':[[_0xbc10('0x91'),_0xbc10('0xa3')]]}]});})[_0xbc10('0x20')](handleEntityNotFound(_0x2f12dd,null))[_0xbc10('0x20')](function(_0x522f54){if(_0x522f54){_0x4c7aa5['list']=_[_0xbc10('0x6f')](_0x522f54,[_0xbc10('0xa2')]);if(_0x522f54[_0xbc10('0xa2')][_0xbc10('0x67')]){return _0x522f54[_0xbc10('0xa2')][0x0];}var _0x33d5b5=_[_0xbc10('0xa4')](_0x4c7aa5[_0xbc10('0x59')],{'firstName':_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x96')],'ListId':_0x522f54['id']});_0x33d5b5[_0x4c7aa5['body'][_0xbc10('0x9f')]]=_0x4c7aa5['body'][_0xbc10('0x96')];return db[_0xbc10('0x8d')]['create'](_0x33d5b5,{'fields':_0x3a8813,'raw':!![]});}})[_0xbc10('0x20')](handleEntityNotFound(_0x2f12dd,null))[_0xbc10('0x20')](function(_0x3e64f6){if(_0x3e64f6){_0x4c7aa5[_0xbc10('0xa5')]=_0x3e64f6;var _0x3c0fe9={'ContactId':_0x3e64f6['id'],'phone':_0x4c7aa5[_0xbc10('0x59')]['from'],'WhatsappAccountId':_0x1ed651['params']['id']};var _0x23949e={'ContactId':_0x3e64f6['id'],'WhatsappAccountId':_0x1ed651['params']['id'],'closed':![]};return db[_0xbc10('0xa6')][_0xbc10('0x57')]({'where':_0x23949e})[_0xbc10('0x20')](function(_0xb7b538){if(_0xb7b538){return[_0xb7b538,![]];}return db[_0xbc10('0xa6')][_0xbc10('0x58')](_0x3c0fe9)[_0xbc10('0x20')](function(_0x1ff3e3){return[_0x1ff3e3,!![]];});});}})[_0xbc10('0x71')](function(_0x246ded,_0x286419){_0x4c7aa5[_0xbc10('0xa7')]=_0x246ded[_0xbc10('0x5b')]({'plain':!![]});_0x4c7aa5['interaction'][_0xbc10('0xa8')]=![];if(_0x286419){if(_0x4c7aa5['account'][_0xbc10('0xa9')]){_0x4c7aa5[_0xbc10('0xaa')][_0xbc10('0xab')]({'id':0x0,'priority':_0x4c7aa5[_0xbc10('0xaa')][_0xbc10('0x67')]+0x1,'app':_0xbc10('0xac'),'appdata':_0xbc10('0xad'),'interval':'*,*,*,*'});}_0x4c7aa5[_0xbc10('0xa7')][_0xbc10('0xa8')]=!![];}return db[_0xbc10('0x8a')][_0xbc10('0x58')]({'phone':_0x4c7aa5[_0xbc10('0x59')][_0xbc10('0x96')],'messageId':_0x4c7aa5[_0xbc10('0x59')]['messageId'],'body':_0x4c7aa5['body'][_0xbc10('0x59')],'WhatsappAccountId':_0x1ed651['params']['id'],'WhatsappInteractionId':_0x246ded['id'],'direction':'in','ContactId':_0x246ded[_0xbc10('0xae')],'AttachmentId':_0x4c7aa5['body'][_0xbc10('0xaf')]});})[_0xbc10('0x20')](function(_0x2f161e){_0x4c7aa5[_0xbc10('0x27')]=_0x2f161e;if(_0x4c7aa5[_0xbc10('0xa7')][_0xbc10('0xb0')]){return db[_0xbc10('0x77')][_0xbc10('0x57')]({'attributes':['id',_0xbc10('0x39')],'where':{'id':_0x4c7aa5[_0xbc10('0xa7')][_0xbc10('0xb0')]}})['then'](function(_0x222d43){if(_0x222d43){_0x4c7aa5[_0xbc10('0xaa')][_0xbc10('0xb1')]({'id':0x0,'priority':0x0,'app':_0xbc10('0xb2'),'appdata':_0x222d43[_0xbc10('0x39')]+','+(_0x4c7aa5[_0xbc10('0x85')][_0xbc10('0xb3')]||0xa),'interval':_0xbc10('0xb4')});}return respondWithRpcPromise('Start',_0xbc10('0xb5'),_0x4c7aa5);});}return respondWithRpcPromise(_0xbc10('0xb6'),_0xbc10('0xb5'),_0x4c7aa5);})[_0xbc10('0x20')](function(_0x4854d2){if(_0x4854d2){var _0x3935a1=0xc8;var _0x46ec0e=_0xbc10('0xb7');logger[_0xbc10('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x46ec0e,_0x3935a1,'entity\x20found');logger['debug'](_0xbc10('0xb8'),_0x46ec0e,_0x3935a1,'entity\x20found',JSON[_0xbc10('0x25')](_0x4854d2));if(_0x4c7aa5['account'][_0xbc10('0x3f')]===_0xbc10('0xb9')){return _0x2f12dd[_0xbc10('0x2b')](_0x3935a1)[_0xbc10('0x30')](_0xbc10('0xba'),_0xbc10('0xbb'))[_0xbc10('0x3a')](_0xbc10('0xbc'));}else{return _0x2f12dd[_0xbc10('0x2b')](_0x3935a1)[_0xbc10('0x80')](_0x4854d2);}}});})[_0xbc10('0x29')](handleError(_0x2f12dd,null));};exports[_0xbc10('0x3a')]=function(_0x3092d2,_0xbd061,_0x3f72c6){var _0x253a20,_0xc4b3a4,_0x4aebae;if(_['isNil'](_0x3092d2[_0xbc10('0x59')][_0xbc10('0x59')])||_0x3092d2['body'][_0xbc10('0x59')]===''){throw new db[(_0xbc10('0x8e'))][(_0xbc10('0x8f'))](_0xbc10('0x9e'));}if(_['isNil'](_0x3092d2[_0xbc10('0x59')]['to'])){throw new db[(_0xbc10('0x8e'))]['ValidationError'](_0xbc10('0xbd'));}_0x253a20=_0x3092d2['body']['to'];return db['WhatsappAccount'][_0xbc10('0x57')]({'where':{'id':_0x3092d2['params']['id']},'include':[{'model':db[_0xbc10('0xa1')],'as':_0xbc10('0xbe'),'include':[{'model':db[_0xbc10('0x8d')],'as':_0xbc10('0xa2'),'where':{'mobile':_0x253a20},'limit':0x1,'order':[[_0xbc10('0x91'),_0xbc10('0xa3')]]}]}]})[_0xbc10('0x20')](handleEntityNotFound(_0xbd061,null))[_0xbc10('0x20')](function(_0x167f53){if(_0x167f53&&_0x167f53[_0xbc10('0xbe')]){_0xc4b3a4=_0x167f53[_0xbc10('0x5b')]({'plain':!![]});if(_0xc4b3a4['List']&&_0xc4b3a4[_0xbc10('0xbe')][_0xbc10('0xa2')]['length']){return _0xc4b3a4[_0xbc10('0xbe')][_0xbc10('0xa2')][0x0];}return db[_0xbc10('0x8d')][_0xbc10('0x58')](_['defaults'](_0x3092d2[_0xbc10('0x59')],{'firstName':_0x253a20,'mobile':_0x253a20,'phone':_0x253a20,'ListId':_0xc4b3a4[_0xbc10('0x94')]}));}})[_0xbc10('0x20')](handleEntityNotFound(_0xbd061,null))[_0xbc10('0x20')](function(_0x2051f3){if(_0x2051f3){_0x4aebae=_0x2051f3;return db[_0xbc10('0xa6')]['find']({'where':{'ContactId':_0x4aebae['id'],'closed':![],'WhatsappAccountId':_0xc4b3a4['id']}})[_0xbc10('0x20')](function(_0x409bb4){if(_0x409bb4){return[_0x409bb4,![]];}return db[_0xbc10('0xa6')][_0xbc10('0x58')]({'UserId':_0x3092d2[_0xbc10('0x5a')]['id'],'ContactId':_0x4aebae['id'],'WhatsappAccountId':_0xc4b3a4['id'],'phone':_0x253a20,'firstMsgDirection':_0xbc10('0xbf'),'Messages':[_[_0xbc10('0x4d')](_0x3092d2[_0xbc10('0x59')],{'read':![],'body':_0x3092d2['body']['body'],'phone':_0x253a20,'WhatsappAccountId':_0xc4b3a4['id'],'UserId':_0x3092d2[_0xbc10('0x5a')]['id'],'ContactId':_0x4aebae['id']})]},{'include':[{'model':db[_0xbc10('0x8a')],'as':_0xbc10('0xc0')}]})[_0xbc10('0x20')](function(_0x17a1e5){return[_0x17a1e5,!![]];});});}})[_0xbc10('0x71')](function(_0x11418a,_0x4a7b3c){if(_0x4a7b3c){return _0x11418a;}return db[_0xbc10('0x8a')]['create'](_['merge'](_0x3092d2[_0xbc10('0x59')],{'read':![],'body':_0x3092d2[_0xbc10('0x59')][_0xbc10('0x59')],'phone':_0x253a20,'WhatsappAccountId':_0xc4b3a4['id'],'WhatsappInteractionId':_0x11418a['id'],'UserId':_0x3092d2[_0xbc10('0x5a')]['id'],'ContactId':_0x4aebae['id']}))[_0xbc10('0x20')](function(_0x1d1e0d){_0x11418a[_0xbc10('0xc1')]['Messages']=[];_0x11418a['dataValues'][_0xbc10('0xc0')]['push'](_0x1d1e0d[_0xbc10('0xc1')]);return _0x11418a;});})[_0xbc10('0x20')](respondWithResult(_0xbd061,null))[_0xbc10('0x29')](handleError(_0xbd061,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index eab623e..b04c421 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 _0xc21e=['exports','events','../../mysqldb','WhatsappAccount','update','remove','emit','hasOwnProperty','hook'];(function(_0x277cd9,_0x433874){var _0x534c2f=function(_0x31374b){while(--_0x31374b){_0x277cd9['push'](_0x277cd9['shift']());}};_0x534c2f(++_0x433874);}(_0xc21e,0x1ba));var _0xec21=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc21e[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xec21('0x0'));var WhatsappAccount=require(_0xec21('0x1'))['db'][_0xec21('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xec21('0x3'),'afterDestroy':_0xec21('0x4')};function emitEvent(_0x24255){return function(_0x5d17d0,_0x49e1f4,_0x5125d6){WhatsappAccountEvents[_0xec21('0x5')](_0x24255+':'+_0x5d17d0['id'],_0x5d17d0);WhatsappAccountEvents[_0xec21('0x5')](_0x24255,_0x5d17d0);_0x5125d6(null);};}for(var e in events){if(events[_0xec21('0x6')](e)){var event=events[e];WhatsappAccount[_0xec21('0x7')](e,emitEvent(event));}}module[_0xec21('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x1b70=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x1b70,0xd2));var _0x01b7=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x1b70[_0x1304c6];return _0x2e6654;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x01b7('0x0'))['db'][_0x01b7('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x01b7('0x2')](0x0);var events={'afterCreate':_0x01b7('0x3'),'afterUpdate':_0x01b7('0x4'),'afterDestroy':_0x01b7('0x5')};function emitEvent(_0x250f92){return function(_0xee34c3,_0x347ff1,_0x87ea4e){WhatsappAccountEvents[_0x01b7('0x6')](_0x250f92+':'+_0xee34c3['id'],_0xee34c3);WhatsappAccountEvents[_0x01b7('0x6')](_0x250f92,_0xee34c3);_0x87ea4e(null);};}for(var e in events){if(events[_0x01b7('0x7')](e)){var event=events[e];WhatsappAccount[_0x01b7('0x8')](e,emitEvent(event));}}module[_0x01b7('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f0fe568..99571ec 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 _0x6537=['./whatsappAccount.attributes','exports','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c9684,_0x4cbe38){var _0x1aaee0=function(_0x4b08a2){while(--_0x4b08a2){_0x2c9684['push'](_0x2c9684['shift']());}};_0x1aaee0(++_0x4cbe38);}(_0x6537,0x1b3));var _0x7653=function(_0x564cc0,_0x2ef286){_0x564cc0=_0x564cc0-0x0;var _0x40b5b8=_0x6537[_0x564cc0];return _0x40b5b8;};'use strict';var _=require(_0x7653('0x0'));var util=require(_0x7653('0x1'));var logger=require(_0x7653('0x2'))(_0x7653('0x3'));var moment=require('moment');var BPromise=require(_0x7653('0x4'));var rp=require(_0x7653('0x5'));var fs=require('fs');var path=require(_0x7653('0x6'));var rimraf=require(_0x7653('0x7'));var config=require(_0x7653('0x8'));var attributes=require(_0x7653('0x9'));module[_0x7653('0xa')]=function(_0x4ee836,_0x5edd8a){return _0x4ee836['define']('WhatsappAccount',attributes,{'tableName':_0x7653('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a87=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0xb3dc7c,_0x52be85){var _0x33f779=function(_0x2c90b4){while(--_0x2c90b4){_0xb3dc7c['push'](_0xb3dc7c['shift']());}};_0x33f779(++_0x52be85);}(_0x7a87,0xde));var _0x77a8=function(_0x38adeb,_0x2d854a){_0x38adeb=_0x38adeb-0x0;var _0xcd7258=_0x7a87[_0x38adeb];return _0xcd7258;};'use strict';var _=require(_0x77a8('0x0'));var util=require(_0x77a8('0x1'));var logger=require(_0x77a8('0x2'))(_0x77a8('0x3'));var moment=require(_0x77a8('0x4'));var BPromise=require('bluebird');var rp=require(_0x77a8('0x5'));var fs=require('fs');var path=require(_0x77a8('0x6'));var rimraf=require(_0x77a8('0x7'));var config=require(_0x77a8('0x8'));var attributes=require(_0x77a8('0x9'));module[_0x77a8('0xa')]=function(_0x109111,_0x5334d1){return _0x109111[_0x77a8('0xb')](_0x77a8('0xc'),attributes,{'tableName':_0x77a8('0xd'),'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 6e74ee2..2b678b7 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 _0xdeb3=['model','map','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdeb3,0xb7));var _0x3deb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdeb3[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var moment=require(_0x3deb('0x1'));var BPromise=require(_0x3deb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3deb('0x3'))['db'];var utils=require(_0x3deb('0x4'));var logger=require(_0x3deb('0x5'))(_0x3deb('0x6'));var config=require(_0x3deb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x8')]['http']({'port':0x232a});config[_0x3deb('0x9')]=_['defaults'](config[_0x3deb('0x9')],{'host':_0x3deb('0xa'),'port':0x18eb});var socket=require(_0x3deb('0xb'))(new Redis(config[_0x3deb('0x9')]));require(_0x3deb('0xc'))[_0x3deb('0xd')](socket);function respondWithRpcPromise(_0x2cd00a,_0x1d628e,_0x36c78a){return new BPromise(function(_0x54b603,_0x5a50f5){return client[_0x3deb('0xe')](_0x2cd00a,_0x36c78a)[_0x3deb('0xf')](function(_0x756238){logger['info'](_0x3deb('0x10'),_0x1d628e,_0x3deb('0x11'));logger[_0x3deb('0x12')](_0x3deb('0x13'),_0x1d628e,'request\x20sent',JSON['stringify'](_0x756238));if(_0x756238['error']){if(_0x756238[_0x3deb('0x14')][_0x3deb('0x15')]===0x1f4){logger[_0x3deb('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x1d628e,_0x756238[_0x3deb('0x14')][_0x3deb('0x16')]);return _0x5a50f5(_0x756238['error'][_0x3deb('0x16')]);}logger[_0x3deb('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x1d628e,_0x756238[_0x3deb('0x14')]['message']);return _0x54b603(_0x756238[_0x3deb('0x14')]['message']);}else{logger['info'](_0x3deb('0x10'),_0x1d628e,_0x3deb('0x11'));_0x54b603(_0x756238[_0x3deb('0x17')][_0x3deb('0x16')]);}})[_0x3deb('0x18')](function(_0x145d16){logger['error'](_0x3deb('0x10'),_0x1d628e,_0x145d16);_0x5a50f5(_0x145d16);});});}exports[_0x3deb('0x19')]=function(_0x4a1173){var _0x3eb5fb=this;return new Promise(function(_0x43fc1f,_0x1c8641){return db[_0x3deb('0x1a')][_0x3deb('0x1b')]({'raw':_0x4a1173['options']?_0x4a1173[_0x3deb('0x1c')][_0x3deb('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a1173[_0x3deb('0x1c')]?_0x4a1173[_0x3deb('0x1c')][_0x3deb('0x1e')]||null:null,'attributes':_0x4a1173[_0x3deb('0x1c')]?_0x4a1173[_0x3deb('0x1c')][_0x3deb('0x1f')]||null:null,'include':_0x4a1173[_0x3deb('0x1c')]?_0x4a1173['options'][_0x3deb('0x20')]?_['map'](_0x4a1173[_0x3deb('0x1c')][_0x3deb('0x20')],function(_0x2bbba1){return{'model':db[_0x2bbba1[_0x3deb('0x21')]],'as':_0x2bbba1['as'],'attributes':_0x2bbba1[_0x3deb('0x1f')],'include':_0x2bbba1[_0x3deb('0x20')]?_[_0x3deb('0x22')](_0x2bbba1[_0x3deb('0x20')],function(_0x38af26){return{'model':db[_0x38af26[_0x3deb('0x21')]],'as':_0x38af26['as'],'attributes':_0x38af26[_0x3deb('0x1f')],'include':_0x38af26[_0x3deb('0x20')]?_[_0x3deb('0x22')](_0x38af26[_0x3deb('0x20')],function(_0x3f8edb){return{'model':db[_0x3f8edb[_0x3deb('0x21')]],'as':_0x3f8edb['as'],'attributes':_0x3f8edb[_0x3deb('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3deb('0xf')](function(_0x1b6d93){logger[_0x3deb('0x23')]('ShowWhatsappAccount',_0x4a1173);logger[_0x3deb('0x12')](_0x3deb('0x19'),_0x4a1173,JSON['stringify'](_0x1b6d93));_0x43fc1f(_0x1b6d93);})[_0x3deb('0x18')](function(_0x5dd49e){logger[_0x3deb('0x14')](_0x3deb('0x19'),_0x5dd49e[_0x3deb('0x16')],_0x4a1173);_0x1c8641(_0x3eb5fb[_0x3deb('0x14')](0x1f4,_0x5dd49e[_0x3deb('0x16')]));});});}; \ No newline at end of file +var _0xe211=['request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xe211,0xfb));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e21('0x0'));var util=require(_0x1e21('0x1'));var moment=require('moment');var BPromise=require(_0x1e21('0x2'));var rs=require(_0x1e21('0x3'));var fs=require('fs');var Redis=require(_0x1e21('0x4'));var db=require(_0x1e21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e21('0x6'))(_0x1e21('0x7'));var config=require(_0x1e21('0x8'));var jayson=require(_0x1e21('0x9'));var client=jayson[_0x1e21('0xa')][_0x1e21('0xb')]({'port':0x232a});config[_0x1e21('0xc')]=_[_0x1e21('0xd')](config[_0x1e21('0xc')],{'host':_0x1e21('0xe'),'port':0x18eb});var socket=require(_0x1e21('0xf'))(new Redis(config['redis']));require(_0x1e21('0x10'))[_0x1e21('0x11')](socket);function respondWithRpcPromise(_0x40165f,_0x2567b6,_0x1b3ce1){return new BPromise(function(_0x22cc3c,_0x21f346){return client[_0x1e21('0x12')](_0x40165f,_0x1b3ce1)[_0x1e21('0x13')](function(_0x5d9f83){logger[_0x1e21('0x14')](_0x1e21('0x15'),_0x2567b6,_0x1e21('0x16'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2567b6,'request\x20sent',JSON[_0x1e21('0x17')](_0x5d9f83));if(_0x5d9f83[_0x1e21('0x18')]){if(_0x5d9f83[_0x1e21('0x18')][_0x1e21('0x19')]===0x1f4){logger['error'](_0x1e21('0x15'),_0x2567b6,_0x5d9f83[_0x1e21('0x18')]['message']);return _0x21f346(_0x5d9f83[_0x1e21('0x18')][_0x1e21('0x1a')]);}logger[_0x1e21('0x18')](_0x1e21('0x15'),_0x2567b6,_0x5d9f83[_0x1e21('0x18')]['message']);return _0x22cc3c(_0x5d9f83[_0x1e21('0x18')]['message']);}else{logger[_0x1e21('0x14')](_0x1e21('0x15'),_0x2567b6,_0x1e21('0x16'));_0x22cc3c(_0x5d9f83[_0x1e21('0x1b')][_0x1e21('0x1a')]);}})[_0x1e21('0x1c')](function(_0x53b2cb){logger[_0x1e21('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x2567b6,_0x53b2cb);_0x21f346(_0x53b2cb);});});}exports[_0x1e21('0x1d')]=function(_0x5028a3){var _0x225d2a=this;return new Promise(function(_0xec3615,_0x19620d){return db[_0x1e21('0x1e')][_0x1e21('0x1f')]({'raw':_0x5028a3[_0x1e21('0x20')]?_0x5028a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5028a3[_0x1e21('0x20')]?_0x5028a3['options'][_0x1e21('0x21')]||null:null,'attributes':_0x5028a3[_0x1e21('0x20')]?_0x5028a3['options'][_0x1e21('0x22')]||null:null,'include':_0x5028a3['options']?_0x5028a3[_0x1e21('0x20')][_0x1e21('0x23')]?_[_0x1e21('0x24')](_0x5028a3[_0x1e21('0x20')][_0x1e21('0x23')],function(_0x13b714){return{'model':db[_0x13b714['model']],'as':_0x13b714['as'],'attributes':_0x13b714['attributes'],'include':_0x13b714['include']?_[_0x1e21('0x24')](_0x13b714['include'],function(_0x183081){return{'model':db[_0x183081[_0x1e21('0x25')]],'as':_0x183081['as'],'attributes':_0x183081[_0x1e21('0x22')],'include':_0x183081[_0x1e21('0x23')]?_['map'](_0x183081[_0x1e21('0x23')],function(_0x445f34){return{'model':db[_0x445f34[_0x1e21('0x25')]],'as':_0x445f34['as'],'attributes':_0x445f34[_0x1e21('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1e21('0x13')](function(_0x568958){logger[_0x1e21('0x14')](_0x1e21('0x1d'),_0x5028a3);logger[_0x1e21('0x26')]('ShowWhatsappAccount',_0x5028a3,JSON[_0x1e21('0x17')](_0x568958));_0xec3615(_0x568958);})[_0x1e21('0x1c')](function(_0x30d224){logger[_0x1e21('0x18')]('ShowWhatsappAccount',_0x30d224[_0x1e21('0x1a')],_0x5028a3);_0x19620d(_0x225d2a['error'](0x1f4,_0x30d224[_0x1e21('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5e13fe0..824c2c2 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 _0x433f=['emit','length','whatsappAccount:','remove'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x433f,0x13b));var _0xf433=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x433f[_0x167cc1];return _0x10bc4b;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xf433('0x0'),'update'];function createListener(_0x3e19af,_0x5d114f){return function(_0x2d92c6){_0x5d114f[_0xf433('0x1')](_0x3e19af,_0x2d92c6);};}function removeListener(_0x5c04e3,_0x20708d){return function(){WhatsappAccountEvents['removeListener'](_0x5c04e3,_0x20708d);};}exports['register']=function(_0x7e932b){for(var _0x2e9771=0x0,_0x5b07b6=events[_0xf433('0x2')];_0x2e9771<_0x5b07b6;_0x2e9771++){var _0x3bcd69=events[_0x2e9771];var _0x3362e6=createListener(_0xf433('0x3')+_0x3bcd69,_0x7e932b);WhatsappAccountEvents['on'](_0x3bcd69,_0x3362e6);}}; \ No newline at end of file +var _0x1003=['save','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x4fcf5b,_0x19cdd3){var _0x24aca1=function(_0x7df9b6){while(--_0x7df9b6){_0x4fcf5b['push'](_0x4fcf5b['shift']());}};_0x24aca1(++_0x19cdd3);}(_0x1003,0x84));var _0x3100=function(_0x53f980,_0x3e2794){_0x53f980=_0x53f980-0x0;var _0x214409=_0x1003[_0x53f980];return _0x214409;};'use strict';var WhatsappAccountEvents=require(_0x3100('0x0'));var events=[_0x3100('0x1'),'remove','update'];function createListener(_0x3a3e6b,_0x3520ea){return function(_0x5a383d){_0x3520ea[_0x3100('0x2')](_0x3a3e6b,_0x5a383d);};}function removeListener(_0xe8771f,_0x5ab20e){return function(){WhatsappAccountEvents[_0x3100('0x3')](_0xe8771f,_0x5ab20e);};}exports[_0x3100('0x4')]=function(_0x7ef694){for(var _0x3a41dc=0x0,_0x157721=events[_0x3100('0x5')];_0x3a41dc<_0x157721;_0x3a41dc++){var _0x13ad17=events[_0x3a41dc];var _0x21cbc7=createListener(_0x3100('0x6')+_0x13ad17,_0x7ef694);WhatsappAccountEvents['on'](_0x13ad17,_0x21cbc7);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 78ea09c..e10b09b 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 _0x363e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x66ff70,_0x396483){var _0x289270=function(_0x367dcb){while(--_0x367dcb){_0x66ff70['push'](_0x66ff70['shift']());}};_0x289270(++_0x396483);}(_0x363e,0x1d7));var _0xe363=function(_0x1ed01f,_0x503e38){_0x1ed01f=_0x1ed01f-0x0;var _0x3f2c57=_0x363e[_0x1ed01f];return _0x3f2c57;};'use strict';var multer=require('multer');var util=require(_0xe363('0x0'));var path=require(_0xe363('0x1'));var timeout=require(_0xe363('0x2'));var express=require(_0xe363('0x3'));var router=express[_0xe363('0x4')]();var fs_extra=require(_0xe363('0x5'));var auth=require(_0xe363('0x6'));var interaction=require(_0xe363('0x7'));var config=require(_0xe363('0x8'));var controller=require(_0xe363('0x9'));router[_0xe363('0xa')]('/',auth[_0xe363('0xb')](),controller['index']);router['get']('/:id',auth[_0xe363('0xb')](),controller[_0xe363('0xc')]);router[_0xe363('0xd')]('/',auth[_0xe363('0xb')](),controller[_0xe363('0xe')]);router['put'](_0xe363('0xf'),auth[_0xe363('0xb')](),controller[_0xe363('0x10')]);router[_0xe363('0x11')](_0xe363('0xf'),auth['isAuthenticated'](),controller[_0xe363('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfaa2=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','show','post','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xfaa2,0xfd));var _0x2faa=function(_0x18d48f,_0x19ea70){_0x18d48f=_0x18d48f-0x0;var _0xeb76a7=_0xfaa2[_0x18d48f];return _0xeb76a7;};'use strict';var multer=require(_0x2faa('0x0'));var util=require('util');var path=require(_0x2faa('0x1'));var timeout=require(_0x2faa('0x2'));var express=require(_0x2faa('0x3'));var router=express[_0x2faa('0x4')]();var fs_extra=require(_0x2faa('0x5'));var auth=require(_0x2faa('0x6'));var interaction=require(_0x2faa('0x7'));var config=require(_0x2faa('0x8'));var controller=require(_0x2faa('0x9'));router[_0x2faa('0xa')]('/',auth['isAuthenticated'](),controller[_0x2faa('0xb')]);router[_0x2faa('0xa')](_0x2faa('0xc'),auth['isAuthenticated'](),controller[_0x2faa('0xd')]);router[_0x2faa('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x2faa('0xf')](),controller[_0x2faa('0x10')]);router[_0x2faa('0x11')](_0x2faa('0xc'),auth[_0x2faa('0xf')](),controller[_0x2faa('0x12')]);module[_0x2faa('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index cda1bbb..abc94e1 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 _0x4368=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4368,0xf4));var _0x8436=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x4368[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0x8436('0x0'));module[_0x8436('0x1')]={'priority':{'type':Sequelize[_0x8436('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8436('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8436('0x4')]()},'description':{'type':Sequelize[_0x8436('0x3')]},'interval':{'type':Sequelize[_0x8436('0x3')],'defaultValue':_0x8436('0x5')}}; \ No newline at end of file +var _0xab31=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x596b11,_0x378296){var _0x18852b=function(_0x374cb3){while(--_0x374cb3){_0x596b11['push'](_0x596b11['shift']());}};_0x18852b(++_0x378296);}(_0xab31,0x18c));var _0x1ab3=function(_0x21484a,_0x53e891){_0x21484a=_0x21484a-0x0;var _0x1b9f8c=_0xab31[_0x21484a];return _0x1b9f8c;};'use strict';var Sequelize=require('sequelize');module[_0x1ab3('0x0')]={'priority':{'type':Sequelize[_0x1ab3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1ab3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1ab3('0x3')]()},'description':{'type':Sequelize[_0x1ab3('0x2')]},'interval':{'type':Sequelize[_0x1ab3('0x2')],'defaultValue':_0x1ab3('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0d55668..ff1e215 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 _0x22b4=['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','set','Content-Range','reject','update','then','destroy','error','send','map','WhatsappApplication','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse'];(function(_0x1876ee,_0x111dff){var _0x2cd0b0=function(_0x13b2e1){while(--_0x13b2e1){_0x1876ee['push'](_0x1876ee['shift']());}};_0x2cd0b0(++_0x111dff);}(_0x22b4,0x8b));var _0x422b=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x22b4[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0x422b('0x0'));var rimraf=require(_0x422b('0x1'));var zipdir=require(_0x422b('0x2'));var jsonpatch=require(_0x422b('0x3'));var rp=require(_0x422b('0x4'));var moment=require(_0x422b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x422b('0x6'));var util=require(_0x422b('0x7'));var path=require('path');var sox=require(_0x422b('0x8'));var csv=require(_0x422b('0x9'));var ejs=require(_0x422b('0xa'));var fs=require('fs');var fs_extra=require(_0x422b('0xb'));var _=require(_0x422b('0xc'));var squel=require(_0x422b('0xd'));var crypto=require('crypto');var jsforce=require(_0x422b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x422b('0x9'));var querystring=require(_0x422b('0xf'));var Papa=require(_0x422b('0x10'));var Redis=require(_0x422b('0x11'));var authService=require(_0x422b('0x12'));var qs=require(_0x422b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x422b('0x14'));var logger=require(_0x422b('0x15'))(_0x422b('0x16'));var utils=require(_0x422b('0x17'));var config=require(_0x422b('0x18'));var licenseUtil=require(_0x422b('0x19'));var db=require(_0x422b('0x1a'))['db'];function respondWithStatusCode(_0x4527c5,_0x4b944c){_0x4b944c=_0x4b944c||0xcc;return function(_0x5f24aa){if(_0x5f24aa){return _0x4527c5[_0x422b('0x1b')](_0x4b944c);}return _0x4527c5[_0x422b('0x1c')](_0x4b944c)[_0x422b('0x1d')]();};}function respondWithResult(_0x803900,_0x2eadaa){_0x2eadaa=_0x2eadaa||0xc8;return function(_0x310622){if(_0x310622){return _0x803900[_0x422b('0x1c')](_0x2eadaa)[_0x422b('0x1e')](_0x310622);}};}function respondWithFilteredResult(_0x52a967,_0x1e40eb){return function(_0x50a914){if(_0x50a914){var _0x3a98d6=typeof _0x1e40eb[_0x422b('0x1f')]===_0x422b('0x20')&&typeof _0x1e40eb[_0x422b('0x21')]===_0x422b('0x20');var _0x433d0b=_0x50a914['count'];var _0x338cf4=_0x3a98d6?0x0:_0x1e40eb[_0x422b('0x1f')];var _0x1fdb00=_0x3a98d6?_0x50a914['count']:_0x1e40eb[_0x422b('0x1f')]+_0x1e40eb[_0x422b('0x21')];var _0x1aa3bf;if(_0x1fdb00>=_0x433d0b){_0x1fdb00=_0x433d0b;_0x1aa3bf=0xc8;}else{_0x1aa3bf=0xce;}_0x52a967[_0x422b('0x1c')](_0x1aa3bf);return _0x52a967[_0x422b('0x22')](_0x422b('0x23'),_0x338cf4+'-'+_0x1fdb00+'/'+_0x433d0b)[_0x422b('0x1e')](_0x50a914);}return null;};}function patchUpdates(_0x51049c){return function(_0x38665f){try{jsonpatch['apply'](_0x38665f,_0x51049c,!![]);}catch(_0x542b3c){return BPromise[_0x422b('0x24')](_0x542b3c);}return _0x38665f['save']();};}function saveUpdates(_0x44f98c,_0x5d1582){return function(_0x3f7619){if(_0x3f7619){return _0x3f7619[_0x422b('0x25')](_0x44f98c)[_0x422b('0x26')](function(_0x5d0f47){return _0x5d0f47;});}return null;};}function removeEntity(_0x394c50,_0x21fb07){return function(_0x3c34db){if(_0x3c34db){return _0x3c34db[_0x422b('0x27')]()[_0x422b('0x26')](function(){_0x394c50[_0x422b('0x1c')](0xcc)[_0x422b('0x1d')]();});}};}function handleEntityNotFound(_0x1f7d44,_0x3baba8){return function(_0x22b089){if(!_0x22b089){_0x1f7d44[_0x422b('0x1b')](0x194);}return _0x22b089;};}function handleError(_0x5dbdad,_0x954459){_0x954459=_0x954459||0x1f4;return function(_0x3d85ec){logger[_0x422b('0x28')](_0x3d85ec['stack']);if(_0x3d85ec['name']){delete _0x3d85ec['name'];}_0x5dbdad[_0x422b('0x1c')](_0x954459)[_0x422b('0x29')](_0x3d85ec);};}exports['index']=function(_0xf19907,_0x124a74){var _0xedfad={},_0x24b86b={},_0xba7f0e={'count':0x0,'rows':[]};var _0x19a4e8=_[_0x422b('0x2a')](db[_0x422b('0x2b')]['rawAttributes'],function(_0x55779d){return{'name':_0x55779d[_0x422b('0x2c')],'type':_0x55779d[_0x422b('0x2d')][_0x422b('0x2e')]};});_0x24b86b['model']=_[_0x422b('0x2a')](_0x19a4e8,_0x422b('0x2f'));_0x24b86b['query']=_[_0x422b('0x30')](_0xf19907[_0x422b('0x31')]);_0x24b86b[_0x422b('0x32')]=_[_0x422b('0x33')](_0x24b86b[_0x422b('0x34')],_0x24b86b[_0x422b('0x31')]);_0xedfad[_0x422b('0x35')]=_[_0x422b('0x33')](_0x24b86b[_0x422b('0x34')],qs[_0x422b('0x36')](_0xf19907[_0x422b('0x31')][_0x422b('0x36')]));_0xedfad['attributes']=_0xedfad[_0x422b('0x35')][_0x422b('0x37')]?_0xedfad['attributes']:_0x24b86b[_0x422b('0x34')];if(!_0xf19907[_0x422b('0x31')][_0x422b('0x38')](_0x422b('0x39'))){_0xedfad[_0x422b('0x21')]=qs[_0x422b('0x21')](_0xf19907[_0x422b('0x31')][_0x422b('0x21')]);_0xedfad[_0x422b('0x1f')]=qs[_0x422b('0x1f')](_0xf19907['query'][_0x422b('0x1f')]);}_0xedfad[_0x422b('0x3a')]=qs[_0x422b('0x3b')](_0xf19907[_0x422b('0x31')][_0x422b('0x3b')]);_0xedfad[_0x422b('0x3c')]=qs[_0x422b('0x32')](_[_0x422b('0x3d')](_0xf19907[_0x422b('0x31')],_0x24b86b[_0x422b('0x32')]),_0x19a4e8);if(_0xf19907['query'][_0x422b('0x3e')]){_0xedfad[_0x422b('0x3c')]=_[_0x422b('0x3f')](_0xedfad[_0x422b('0x3c')],{'$or':_[_0x422b('0x2a')](_0x19a4e8,function(_0x374b1f){if(_0x374b1f[_0x422b('0x2d')]!==_0x422b('0x40')){var _0x48d703={};_0x48d703[_0x374b1f[_0x422b('0x2f')]]={'$like':'%'+_0xf19907[_0x422b('0x31')][_0x422b('0x3e')]+'%'};return _0x48d703;}})});}_0xedfad=_['merge']({},_0xedfad,_0xf19907[_0x422b('0x41')]);var _0x1479fe={'where':_0xedfad[_0x422b('0x3c')]};return db[_0x422b('0x2b')][_0x422b('0x42')](_0x1479fe)[_0x422b('0x26')](function(_0x7b982a){_0xba7f0e[_0x422b('0x42')]=_0x7b982a;if(_0xf19907[_0x422b('0x31')][_0x422b('0x43')]){_0xedfad[_0x422b('0x44')]=[{'all':!![]}];}return db[_0x422b('0x2b')][_0x422b('0x45')](_0xedfad);})[_0x422b('0x26')](function(_0x24fb8b){_0xba7f0e[_0x422b('0x46')]=_0x24fb8b;return _0xba7f0e;})[_0x422b('0x26')](respondWithFilteredResult(_0x124a74,_0xedfad))[_0x422b('0x47')](handleError(_0x124a74,null));};exports[_0x422b('0x48')]=function(_0x49eacf,_0x451e2a){var _0x1f2ed0={'raw':!![],'where':{'id':_0x49eacf[_0x422b('0x49')]['id']}},_0x40d3f8={};_0x40d3f8[_0x422b('0x34')]=_[_0x422b('0x30')](db[_0x422b('0x2b')][_0x422b('0x4a')]);_0x40d3f8['query']=_[_0x422b('0x30')](_0x49eacf[_0x422b('0x31')]);_0x40d3f8[_0x422b('0x32')]=_[_0x422b('0x33')](_0x40d3f8[_0x422b('0x34')],_0x40d3f8[_0x422b('0x31')]);_0x1f2ed0['attributes']=_[_0x422b('0x33')](_0x40d3f8[_0x422b('0x34')],qs[_0x422b('0x36')](_0x49eacf[_0x422b('0x31')][_0x422b('0x36')]));_0x1f2ed0[_0x422b('0x35')]=_0x1f2ed0[_0x422b('0x35')][_0x422b('0x37')]?_0x1f2ed0[_0x422b('0x35')]:_0x40d3f8[_0x422b('0x34')];if(_0x49eacf[_0x422b('0x31')]['includeAll']){_0x1f2ed0[_0x422b('0x44')]=[{'all':!![]}];}_0x1f2ed0=_[_0x422b('0x3f')]({},_0x1f2ed0,_0x49eacf[_0x422b('0x41')]);return db['WhatsappApplication'][_0x422b('0x4b')](_0x1f2ed0)[_0x422b('0x26')](handleEntityNotFound(_0x451e2a,null))[_0x422b('0x26')](respondWithResult(_0x451e2a,null))[_0x422b('0x47')](handleError(_0x451e2a,null));};exports['create']=function(_0x583eee,_0x40439d){return db[_0x422b('0x2b')][_0x422b('0x4c')](_0x583eee['body'],{})[_0x422b('0x26')](respondWithResult(_0x40439d,0xc9))[_0x422b('0x47')](handleError(_0x40439d,null));};exports[_0x422b('0x25')]=function(_0x1910c5,_0x4db99b){if(_0x1910c5[_0x422b('0x4d')]['id']){delete _0x1910c5[_0x422b('0x4d')]['id'];}return db['WhatsappApplication'][_0x422b('0x4b')]({'where':{'id':_0x1910c5[_0x422b('0x49')]['id']}})[_0x422b('0x26')](handleEntityNotFound(_0x4db99b,null))[_0x422b('0x26')](saveUpdates(_0x1910c5[_0x422b('0x4d')],null))['then'](respondWithResult(_0x4db99b,null))['catch'](handleError(_0x4db99b,null));};exports[_0x422b('0x27')]=function(_0x141c61,_0x256cc6){return db['WhatsappApplication'][_0x422b('0x4b')]({'where':{'id':_0x141c61[_0x422b('0x49')]['id']}})[_0x422b('0x26')](handleEntityNotFound(_0x256cc6,null))[_0x422b('0x26')](removeEntity(_0x256cc6,null))[_0x422b('0x47')](handleError(_0x256cc6,null));}; \ No newline at end of file +var _0x9a2d=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','reject','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9a2d,0x123));var _0xd9a2=function(_0x71d025,_0x13efa6){_0x71d025=_0x71d025-0x0;var _0x4aba9f=_0x9a2d[_0x71d025];return _0x4aba9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9a2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9a2('0x1'));var moment=require(_0xd9a2('0x2'));var BPromise=require(_0xd9a2('0x3'));var Mustache=require(_0xd9a2('0x4'));var util=require(_0xd9a2('0x5'));var path=require(_0xd9a2('0x6'));var sox=require(_0xd9a2('0x7'));var csv=require(_0xd9a2('0x8'));var ejs=require(_0xd9a2('0x9'));var fs=require('fs');var fs_extra=require(_0xd9a2('0xa'));var _=require(_0xd9a2('0xb'));var squel=require(_0xd9a2('0xc'));var crypto=require(_0xd9a2('0xd'));var jsforce=require(_0xd9a2('0xe'));var deskjs=require(_0xd9a2('0xf'));var toCsv=require(_0xd9a2('0x8'));var querystring=require(_0xd9a2('0x10'));var Papa=require(_0xd9a2('0x11'));var Redis=require(_0xd9a2('0x12'));var authService=require(_0xd9a2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a2('0x14'));var logger=require('../../config/logger')(_0xd9a2('0x15'));var utils=require('../../config/utils');var config=require(_0xd9a2('0x16'));var licenseUtil=require(_0xd9a2('0x17'));var db=require(_0xd9a2('0x18'))['db'];function respondWithStatusCode(_0xc5a12e,_0x58a5f0){_0x58a5f0=_0x58a5f0||0xcc;return function(_0x1ba710){if(_0x1ba710){return _0xc5a12e[_0xd9a2('0x19')](_0x58a5f0);}return _0xc5a12e[_0xd9a2('0x1a')](_0x58a5f0)['end']();};}function respondWithResult(_0x41b098,_0x4f3c91){_0x4f3c91=_0x4f3c91||0xc8;return function(_0xf3b78e){if(_0xf3b78e){return _0x41b098['status'](_0x4f3c91)[_0xd9a2('0x1b')](_0xf3b78e);}};}function respondWithFilteredResult(_0x3a6969,_0x5e3a6e){return function(_0xee6ea8){if(_0xee6ea8){var _0x1447e6=typeof _0x5e3a6e['offset']===_0xd9a2('0x1c')&&typeof _0x5e3a6e['limit']===_0xd9a2('0x1c');var _0x5185d0=_0xee6ea8[_0xd9a2('0x1d')];var _0x143ec5=_0x1447e6?0x0:_0x5e3a6e[_0xd9a2('0x1e')];var _0x2fd2df=_0x1447e6?_0xee6ea8[_0xd9a2('0x1d')]:_0x5e3a6e[_0xd9a2('0x1e')]+_0x5e3a6e[_0xd9a2('0x1f')];var _0x319859;if(_0x2fd2df>=_0x5185d0){_0x2fd2df=_0x5185d0;_0x319859=0xc8;}else{_0x319859=0xce;}_0x3a6969[_0xd9a2('0x1a')](_0x319859);return _0x3a6969[_0xd9a2('0x20')]('Content-Range',_0x143ec5+'-'+_0x2fd2df+'/'+_0x5185d0)['json'](_0xee6ea8);}return null;};}function patchUpdates(_0xde39f6){return function(_0x468f53){try{jsonpatch['apply'](_0x468f53,_0xde39f6,!![]);}catch(_0x36c3a7){return BPromise[_0xd9a2('0x21')](_0x36c3a7);}return _0x468f53['save']();};}function saveUpdates(_0x1758ec,_0x291a1c){return function(_0x11e928){if(_0x11e928){return _0x11e928[_0xd9a2('0x22')](_0x1758ec)[_0xd9a2('0x23')](function(_0x464af5){return _0x464af5;});}return null;};}function removeEntity(_0x3aedd2,_0x5a59b9){return function(_0x568b91){if(_0x568b91){return _0x568b91[_0xd9a2('0x24')]()[_0xd9a2('0x23')](function(){_0x3aedd2[_0xd9a2('0x1a')](0xcc)[_0xd9a2('0x25')]();});}};}function handleEntityNotFound(_0x492320,_0x2c1c33){return function(_0x591510){if(!_0x591510){_0x492320[_0xd9a2('0x19')](0x194);}return _0x591510;};}function handleError(_0x2093ea,_0x5ea1fc){_0x5ea1fc=_0x5ea1fc||0x1f4;return function(_0x1f042e){logger[_0xd9a2('0x26')](_0x1f042e[_0xd9a2('0x27')]);if(_0x1f042e[_0xd9a2('0x28')]){delete _0x1f042e[_0xd9a2('0x28')];}_0x2093ea[_0xd9a2('0x1a')](_0x5ea1fc)[_0xd9a2('0x29')](_0x1f042e);};}exports[_0xd9a2('0x2a')]=function(_0x53723f,_0x1c8557){var _0x5a6f29={},_0xc422b0={},_0x4964fd={'count':0x0,'rows':[]};var _0x216231=_[_0xd9a2('0x2b')](db[_0xd9a2('0x2c')][_0xd9a2('0x2d')],function(_0x57d1c9){return{'name':_0x57d1c9[_0xd9a2('0x2e')],'type':_0x57d1c9[_0xd9a2('0x2f')][_0xd9a2('0x30')]};});_0xc422b0['model']=_[_0xd9a2('0x2b')](_0x216231,'name');_0xc422b0[_0xd9a2('0x31')]=_['keys'](_0x53723f['query']);_0xc422b0[_0xd9a2('0x32')]=_['intersection'](_0xc422b0['model'],_0xc422b0[_0xd9a2('0x31')]);_0x5a6f29[_0xd9a2('0x33')]=_[_0xd9a2('0x34')](_0xc422b0[_0xd9a2('0x35')],qs['fields'](_0x53723f['query'][_0xd9a2('0x36')]));_0x5a6f29[_0xd9a2('0x33')]=_0x5a6f29['attributes'][_0xd9a2('0x37')]?_0x5a6f29[_0xd9a2('0x33')]:_0xc422b0[_0xd9a2('0x35')];if(!_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x38')](_0xd9a2('0x39'))){_0x5a6f29['limit']=qs[_0xd9a2('0x1f')](_0x53723f['query'][_0xd9a2('0x1f')]);_0x5a6f29['offset']=qs[_0xd9a2('0x1e')](_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x1e')]);}_0x5a6f29[_0xd9a2('0x3a')]=qs['sort'](_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x3b')]);_0x5a6f29[_0xd9a2('0x3c')]=qs[_0xd9a2('0x32')](_[_0xd9a2('0x3d')](_0x53723f['query'],_0xc422b0['filters']),_0x216231);if(_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x3e')]){_0x5a6f29[_0xd9a2('0x3c')]=_[_0xd9a2('0x3f')](_0x5a6f29[_0xd9a2('0x3c')],{'$or':_[_0xd9a2('0x2b')](_0x216231,function(_0x5cf0c5){if(_0x5cf0c5['type']!=='VIRTUAL'){var _0x3dae16={};_0x3dae16[_0x5cf0c5[_0xd9a2('0x28')]]={'$like':'%'+_0x53723f['query'][_0xd9a2('0x3e')]+'%'};return _0x3dae16;}})});}_0x5a6f29=_[_0xd9a2('0x3f')]({},_0x5a6f29,_0x53723f[_0xd9a2('0x40')]);var _0x50f9c5={'where':_0x5a6f29[_0xd9a2('0x3c')]};return db['WhatsappApplication'][_0xd9a2('0x1d')](_0x50f9c5)['then'](function(_0x54b433){_0x4964fd[_0xd9a2('0x1d')]=_0x54b433;if(_0x53723f[_0xd9a2('0x31')][_0xd9a2('0x41')]){_0x5a6f29[_0xd9a2('0x42')]=[{'all':!![]}];}return db[_0xd9a2('0x2c')][_0xd9a2('0x43')](_0x5a6f29);})[_0xd9a2('0x23')](function(_0x2f5209){_0x4964fd[_0xd9a2('0x44')]=_0x2f5209;return _0x4964fd;})[_0xd9a2('0x23')](respondWithFilteredResult(_0x1c8557,_0x5a6f29))[_0xd9a2('0x45')](handleError(_0x1c8557,null));};exports['show']=function(_0x622a10,_0x219975){var _0x19dc29={'raw':!![],'where':{'id':_0x622a10['params']['id']}},_0x2354c8={};_0x2354c8[_0xd9a2('0x35')]=_[_0xd9a2('0x46')](db['WhatsappApplication']['rawAttributes']);_0x2354c8[_0xd9a2('0x31')]=_['keys'](_0x622a10['query']);_0x2354c8[_0xd9a2('0x32')]=_[_0xd9a2('0x34')](_0x2354c8[_0xd9a2('0x35')],_0x2354c8[_0xd9a2('0x31')]);_0x19dc29[_0xd9a2('0x33')]=_['intersection'](_0x2354c8['model'],qs[_0xd9a2('0x36')](_0x622a10['query'][_0xd9a2('0x36')]));_0x19dc29[_0xd9a2('0x33')]=_0x19dc29[_0xd9a2('0x33')][_0xd9a2('0x37')]?_0x19dc29[_0xd9a2('0x33')]:_0x2354c8[_0xd9a2('0x35')];if(_0x622a10[_0xd9a2('0x31')][_0xd9a2('0x41')]){_0x19dc29[_0xd9a2('0x42')]=[{'all':!![]}];}_0x19dc29=_[_0xd9a2('0x3f')]({},_0x19dc29,_0x622a10[_0xd9a2('0x40')]);return db[_0xd9a2('0x2c')][_0xd9a2('0x47')](_0x19dc29)[_0xd9a2('0x23')](handleEntityNotFound(_0x219975,null))['then'](respondWithResult(_0x219975,null))[_0xd9a2('0x45')](handleError(_0x219975,null));};exports[_0xd9a2('0x48')]=function(_0x44bbb2,_0x37a9f6){return db[_0xd9a2('0x2c')]['create'](_0x44bbb2['body'],{})[_0xd9a2('0x23')](respondWithResult(_0x37a9f6,0xc9))[_0xd9a2('0x45')](handleError(_0x37a9f6,null));};exports[_0xd9a2('0x22')]=function(_0x985214,_0x293ed3){if(_0x985214[_0xd9a2('0x49')]['id']){delete _0x985214[_0xd9a2('0x49')]['id'];}return db[_0xd9a2('0x2c')][_0xd9a2('0x47')]({'where':{'id':_0x985214[_0xd9a2('0x4a')]['id']}})[_0xd9a2('0x23')](handleEntityNotFound(_0x293ed3,null))[_0xd9a2('0x23')](saveUpdates(_0x985214[_0xd9a2('0x49')],null))[_0xd9a2('0x23')](respondWithResult(_0x293ed3,null))[_0xd9a2('0x45')](handleError(_0x293ed3,null));};exports['destroy']=function(_0x12ee64,_0x4d8af3){return db[_0xd9a2('0x2c')][_0xd9a2('0x47')]({'where':{'id':_0x12ee64[_0xd9a2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d8af3,null))[_0xd9a2('0x23')](removeEntity(_0x4d8af3,null))[_0xd9a2('0x45')](handleError(_0x4d8af3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4a37a8f..8986dbe 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 _0x9221=['exports','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9221,0x64));var _0x1922=function(_0x3f2647,_0x4447ac){_0x3f2647=_0x3f2647-0x0;var _0xbd8415=_0x9221[_0x3f2647];return _0xbd8415;};'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 +var _0x01fe=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x01fe,0x102));var _0xe01f=function(_0x2b5b94,_0x211ba3){_0x2b5b94=_0x2b5b94-0x0;var _0x5da8d4=_0x01fe[_0x2b5b94];return _0x5da8d4;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var logger=require(_0xe01f('0x1'))(_0xe01f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe01f('0x3'));var fs=require('fs');var path=require(_0xe01f('0x4'));var rimraf=require(_0xe01f('0x5'));var config=require(_0xe01f('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0xe01f('0x7')]=function(_0x574969,_0x3effc4){return _0x574969[_0xe01f('0x8')](_0xe01f('0x9'),attributes,{'tableName':_0xe01f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe01f('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 8540678..3fb8f23 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 _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x157fa6,_0x1be67c){var _0x191d4a=function(_0x3ce782){while(--_0x3ce782){_0x157fa6['push'](_0x157fa6['shift']());}};_0x191d4a(++_0x1be67c);}(_0xac9d,0x14d));var _0xdac9=function(_0xc55c68,_0x292a8b){_0xc55c68=_0xc55c68-0x0;var _0x148523=_0xac9d[_0xc55c68];return _0x148523;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result'];(function(_0x195871,_0x4a0f1e){var _0x57a24c=function(_0x5e2e39){while(--_0x5e2e39){_0x195871['push'](_0x195871['shift']());}};_0x57a24c(++_0x4a0f1e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0xf3cd[_0xf46bd9];return _0x2763c3;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index af64b17..6ffebda 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 _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(_0x545a02,_0x2efaab){var _0x70e3e=function(_0x3132a0){while(--_0x3132a0){_0x545a02['push'](_0x545a02['shift']());}};_0x70e3e(++_0x2efaab);}(_0xafc4,0x69));var _0x4afc=function(_0x266ec6,_0x44e3ca){_0x266ec6=_0x266ec6-0x0;var _0x5f1f59=_0xafc4[_0x266ec6];return _0x5f1f59;};'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 +var _0xbacd=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller'];(function(_0x4a8b7e,_0x324d96){var _0x1831d4=function(_0x28e5b2){while(--_0x28e5b2){_0x4a8b7e['push'](_0x4a8b7e['shift']());}};_0x1831d4(++_0x324d96);}(_0xbacd,0x1c5));var _0xdbac=function(_0xcd566b,_0x4363b4){_0xcd566b=_0xcd566b-0x0;var _0x1e2205=_0xbacd[_0xcd566b];return _0x1e2205;};'use strict';var multer=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var path=require('path');var timeout=require(_0xdbac('0x2'));var express=require(_0xdbac('0x3'));var router=express[_0xdbac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbac('0x5'));var interaction=require(_0xdbac('0x6'));var config=require(_0xdbac('0x7'));var controller=require(_0xdbac('0x8'));router[_0xdbac('0x9')]('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0xb')]);router[_0xdbac('0x9')](_0xdbac('0xc'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xd')]);router[_0xdbac('0x9')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xf')]);router['get'](_0xdbac('0x10'),auth[_0xdbac('0xa')](),controller['getMessages']);router[_0xdbac('0x9')]('/:id/download',auth[_0xdbac('0xa')](),controller[_0xdbac('0x11')]);router[_0xdbac('0x12')]('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0x13')]);router[_0xdbac('0x12')](_0xdbac('0x10'),auth[_0xdbac('0xa')](),controller[_0xdbac('0x14')]);router['post'](_0xdbac('0x15'),auth[_0xdbac('0xa')](),interaction[_0xdbac('0x16')](_0xdbac('0x17'),_0xdbac('0x18')),controller[_0xdbac('0x19')]);router[_0xdbac('0x1a')](_0xdbac('0xe'),auth['isAuthenticated'](),interaction[_0xdbac('0x16')](_0xdbac('0x17'),_0xdbac('0x1b')),controller['update']);router[_0xdbac('0x1c')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),interaction[_0xdbac('0x16')](_0xdbac('0x17'),_0xdbac('0x1d')),controller[_0xdbac('0x1e')]);router[_0xdbac('0x1c')](_0xdbac('0x15'),auth[_0xdbac('0xa')](),controller[_0xdbac('0x1f')]);module[_0xdbac('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c3a4426..38e433f 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 _0xabe8=['STRING','ENUM','out','BOOLEAN','sequelize','moment','exports','DATE'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xabe8,0x8c));var _0x8abe=function(_0x14da82,_0x240fb7){_0x14da82=_0x14da82-0x0;var _0x4bf728=_0xabe8[_0x14da82];return _0x4bf728;};'use strict';var Sequelize=require(_0x8abe('0x0'));var moment=require(_0x8abe('0x1'));module[_0x8abe('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8abe('0x3')]},'disposition':{'type':Sequelize[_0x8abe('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8abe('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8abe('0x4')]},'read1stAt':{'type':Sequelize[_0x8abe('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8abe('0x5')]('in',_0x8abe('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8abe('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8abe('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xb0df=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x47fbab,_0x10c1a8){var _0x5ceb27=function(_0x1c02e1){while(--_0x1c02e1){_0x47fbab['push'](_0x47fbab['shift']());}};_0x5ceb27(++_0x10c1a8);}(_0xb0df,0x85));var _0xfb0d=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0xb0df[_0x8560d3];return _0x33b1b5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfb0d('0x0'));module[_0xfb0d('0x1')]={'closed':{'type':Sequelize[_0xfb0d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfb0d('0x3')]},'disposition':{'type':Sequelize[_0xfb0d('0x4')]},'secondDisposition':{'type':Sequelize[_0xfb0d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfb0d('0x4')]},'note':{'type':Sequelize[_0xfb0d('0x4')]},'phone':{'type':Sequelize[_0xfb0d('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfb0d('0x5')]('in',_0xfb0d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfb0d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfb0d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 914be6f..b0b89cd 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 _0xfa94=['zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','whatsapp_interactions','cm_contacts','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','includeAll','options','create','params','describe','addMessage','WhatsappMessage','ids','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','omit','spread','emit','whatsappInteractionTags:save','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Attachment','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','disposition','Messages','basename','existsSync','pipe','createWriteStream','out','System','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format'];(function(_0x552dee,_0x1e45b0){var _0x30072e=function(_0x151eca){while(--_0x151eca){_0x552dee['push'](_0x552dee['shift']());}};_0x30072e(++_0x1e45b0);}(_0xfa94,0xef));var _0x4fa9=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0xfa94[_0x179b74];return _0x268f76;};'use strict';var emlformat=require(_0x4fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa9('0x2'));var moment=require(_0x4fa9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4fa9('0x4'));var util=require(_0x4fa9('0x5'));var path=require(_0x4fa9('0x6'));var sox=require(_0x4fa9('0x7'));var csv=require(_0x4fa9('0x8'));var ejs=require(_0x4fa9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fa9('0xa'));var _=require('lodash');var squel=require(_0x4fa9('0xb'));var crypto=require(_0x4fa9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fa9('0x8'));var querystring=require('querystring');var Papa=require(_0x4fa9('0xd'));var Redis=require(_0x4fa9('0xe'));var authService=require(_0x4fa9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fa9('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x4fa9('0x11'));var logger=require(_0x4fa9('0x12'))('api');var utils=require(_0x4fa9('0x13'));var config=require(_0x4fa9('0x14'));var licenseUtil=require(_0x4fa9('0x15'));var db=require('../../mysqldb')['db'];config[_0x4fa9('0x16')]=_['defaults'](config[_0x4fa9('0x16')],{'host':_0x4fa9('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fa9('0x16')]));require(_0x4fa9('0x18'))[_0x4fa9('0x19')](socket);function respondWithStatusCode(_0x183aab,_0x18847){_0x18847=_0x18847||0xcc;return function(_0x36af3a){if(_0x36af3a){return _0x183aab[_0x4fa9('0x1a')](_0x18847);}return _0x183aab[_0x4fa9('0x1b')](_0x18847)[_0x4fa9('0x1c')]();};}function respondWithResult(_0x4ef6d8,_0x19ea1b){_0x19ea1b=_0x19ea1b||0xc8;return function(_0x1a1117){if(_0x1a1117){return _0x4ef6d8['status'](_0x19ea1b)['json'](_0x1a1117);}};}function respondWithFilteredResult(_0x2b93a2,_0x4f58bd){return function(_0x2fe920){if(_0x2fe920){var _0x416e08=typeof _0x4f58bd['offset']===_0x4fa9('0x1d')&&typeof _0x4f58bd['limit']===_0x4fa9('0x1d');var _0x30599a=_0x2fe920[_0x4fa9('0x1e')];var _0xe91c1e=_0x416e08?0x0:_0x4f58bd[_0x4fa9('0x1f')];var _0x5e2576=_0x416e08?_0x2fe920[_0x4fa9('0x1e')]:_0x4f58bd[_0x4fa9('0x1f')]+_0x4f58bd[_0x4fa9('0x20')];var _0x5080f5;if(_0x5e2576>=_0x30599a){_0x5e2576=_0x30599a;_0x5080f5=0xc8;}else{_0x5080f5=0xce;}_0x2b93a2[_0x4fa9('0x1b')](_0x5080f5);return _0x2b93a2[_0x4fa9('0x21')](_0x4fa9('0x22'),_0xe91c1e+'-'+_0x5e2576+'/'+_0x30599a)[_0x4fa9('0x23')](_0x2fe920);}return null;};}function patchUpdates(_0x3f3568){return function(_0x251830){try{jsonpatch[_0x4fa9('0x24')](_0x251830,_0x3f3568,!![]);}catch(_0x261db9){return BPromise[_0x4fa9('0x25')](_0x261db9);}return _0x251830[_0x4fa9('0x26')]();};}function saveUpdates(_0x243083,_0x1fbbcf){return function(_0x2e9818){if(_0x2e9818){return _0x2e9818[_0x4fa9('0x27')](_0x243083)[_0x4fa9('0x28')](function(_0x244c95){return _0x244c95;});}return null;};}function removeEntity(_0x1bac66,_0x1e5836){return function(_0x1fe8ba){if(_0x1fe8ba){return _0x1fe8ba[_0x4fa9('0x29')]()['then'](function(){_0x1bac66[_0x4fa9('0x1b')](0xcc)[_0x4fa9('0x1c')]();});}};}function handleEntityNotFound(_0x12f169,_0xdeffbf){return function(_0x9bc956){if(!_0x9bc956){_0x12f169[_0x4fa9('0x1a')](0x194);}return _0x9bc956;};}function handleError(_0x31ada4,_0x5545b9){_0x5545b9=_0x5545b9||0x1f4;return function(_0x384d4e){logger[_0x4fa9('0x2a')](_0x384d4e[_0x4fa9('0x2b')]);if(_0x384d4e[_0x4fa9('0x2c')]){delete _0x384d4e[_0x4fa9('0x2c')];}_0x31ada4[_0x4fa9('0x1b')](_0x5545b9)[_0x4fa9('0x2d')](_0x384d4e);};}function getInteractionUsers(_0x2f7d40,_0xa9932f){return new BPromise(function(_0x472173,_0x1efb9d){try{if(_0xa9932f[_0x2f7d40['id']]){_0x2f7d40[_0x4fa9('0x2e')]=_[_0x4fa9('0x2f')](_0xa9932f[_0x2f7d40['id']],function(_0x1b7f9c){return{'id':_0x1b7f9c['id'],'fullname':_0x1b7f9c[_0x4fa9('0x30')]};});}}catch(_0x1fa94e){_0x1efb9d(_0x1fa94e);}_0x472173(_0x2f7d40);});}function getInteractionTags(_0x2e1b22,_0x54cd8d){return new BPromise(function(_0x1907a9,_0x12cb4b){try{if(_0x2e1b22[_0x4fa9('0x31')]){_0x2e1b22[_0x4fa9('0x32')]=[];_0x2e1b22[_0x4fa9('0x31')][_0x4fa9('0x33')](',')['forEach'](function(_0x1c3838){_0x2e1b22[_0x4fa9('0x32')][_0x4fa9('0x34')](_0x54cd8d[_0x1c3838]);});}delete _0x2e1b22['TagIds'];}catch(_0x642faf){_0x12cb4b(_0x642faf);}_0x1907a9(_0x2e1b22);});}function updateWhatsappInteraction(_0x4c14fd,_0x5813be,_0xa8e93e){return new BPromise(function(_0x591844,_0x3d5739){return getInteractionUsers(_0x4c14fd,_0xa8e93e)[_0x4fa9('0x28')](function(_0x2e9e10){return getInteractionTags(_0x2e9e10,_0x5813be);})[_0x4fa9('0x28')](function(_0x4edfa3){return getStateInteraction(_0x4edfa3);})[_0x4fa9('0x28')](function(_0x3449bb){_0x591844(_0x3449bb);})[_0x4fa9('0x35')](function(_0x4c070e){_0x3d5739(_0x4c070e);});});}function getStateInteraction(_0xb56ddd){return new BPromise(function(_0x450f06){_0xb56ddd[_0x4fa9('0x36')]=0x0;_0xb56ddd[_0x4fa9('0x37')]=0x0;_0xb56ddd[_0x4fa9('0x38')]=0x0;_0xb56ddd[_0x4fa9('0x39')]=0x0;_0xb56ddd[_0x4fa9('0x3a')]=0x0;if(!_0xb56ddd[_0x4fa9('0x3b')]&&!_0xb56ddd[_0x4fa9('0x3c')]){_0xb56ddd[_0x4fa9('0x36')]+=0x1;}if(!_0xb56ddd[_0x4fa9('0x3b')]&&_0xb56ddd[_0x4fa9('0x3c')]){_0xb56ddd['talking']+=0x1;if(_0xb56ddd[_0x4fa9('0x36')]){_0xb56ddd['waiting']-=0x1;}}if(_0xb56ddd['closed']&&_0xb56ddd[_0x4fa9('0x3c')]){_0xb56ddd['answered']+=0x1;if(_0xb56ddd['talking']){_0xb56ddd['talking']-=0x1;}}if(_0xb56ddd[_0x4fa9('0x3b')]&&!_0xb56ddd[_0x4fa9('0x3c')]){_0xb56ddd['unmanaged']+=0x1;if(_0xb56ddd[_0x4fa9('0x36')]){_0xb56ddd['waiting']-=0x1;}}_0xb56ddd['total']+=0x1;_0x450f06(_0xb56ddd);});}exports[_0x4fa9('0x3d')]=function(_0x22b9cf,_0x47750a){var _0x33a8d9={},_0x167112={},_0x167c8c={'count':0x0,'rows':[]};var _0x93fb02=_['map'](db['WhatsappInteraction'][_0x4fa9('0x3e')],function(_0x537583){return{'name':_0x537583[_0x4fa9('0x3f')],'type':_0x537583[_0x4fa9('0x40')][_0x4fa9('0x41')]};});_0x167112[_0x4fa9('0x42')]=_['map'](_0x93fb02,_0x4fa9('0x2c'));_0x167112['query']=_[_0x4fa9('0x43')](_0x22b9cf[_0x4fa9('0x44')]);_0x167112[_0x4fa9('0x45')]=_[_0x4fa9('0x46')](_0x167112[_0x4fa9('0x42')],_0x167112[_0x4fa9('0x44')]);_0x33a8d9[_0x4fa9('0x47')]=_[_0x4fa9('0x46')](_0x167112['model'],qs[_0x4fa9('0x48')](_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x48')]));_0x33a8d9['attributes']=_0x33a8d9[_0x4fa9('0x47')][_0x4fa9('0x49')]?_0x33a8d9[_0x4fa9('0x47')]:_0x167112[_0x4fa9('0x42')];if(!_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x4a')](_0x4fa9('0x4b'))){_0x33a8d9[_0x4fa9('0x20')]=qs[_0x4fa9('0x20')](_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x20')]);_0x33a8d9[_0x4fa9('0x1f')]=qs['offset'](_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x1f')]);}_0x33a8d9[_0x4fa9('0x4c')]=qs[_0x4fa9('0x4d')](_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x4d')]);_0x33a8d9[_0x4fa9('0x4e')]=qs[_0x4fa9('0x45')](_[_0x4fa9('0x4f')](_0x22b9cf[_0x4fa9('0x44')],_0x167112[_0x4fa9('0x45')]),_0x93fb02);var _0x5d3b12=[];var _0x5d838c=squel[_0x4fa9('0x50')]()['field']('id')[_0x4fa9('0x51')](_0x4fa9('0x2c'))[_0x4fa9('0x51')](_0x4fa9('0x52'))[_0x4fa9('0x53')](_0x4fa9('0x54'));var _0x5044b3=squel['select']()['field'](_0x4fa9('0x55'))['field'](_0x4fa9('0x56'))[_0x4fa9('0x51')](_0x4fa9('0x57'))[_0x4fa9('0x53')]('user_has_whatsapp_interactions','ui')[_0x4fa9('0x58')](_0x4fa9('0x59'),'u','u.id\x20=\x20ui.UserId');var _0x85c954=squel[_0x4fa9('0x50')]()[_0x4fa9('0x53')](_0x4fa9('0x5a'),'i')[_0x4fa9('0x58')](_0x4fa9('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x4fa9('0x59'),'o','o.id\x20=\x20i.UserId')[_0x4fa9('0x58')](_0x4fa9('0x5c'),'a',_0x4fa9('0x5d'))[_0x4fa9('0x58')](_0x4fa9('0x5e'),'me',_0x4fa9('0x5f'))[_0x4fa9('0x58')]('whatsapp_interaction_has_tags','it',_0x4fa9('0x60'))['left_join'](_0x4fa9('0x54'),'t',_0x4fa9('0x61'));var _0x2c3515=squel[_0x4fa9('0x62')]();var _0x3f03c5=[];var _0x464ab3=squel['expr']();var _0x52f9d9;if(_0x22b9cf['query'][_0x4fa9('0x63')]){_0x52f9d9=as['parseSearch'](_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x63')]);var _0x300b32=_0x52f9d9['sqlOperator'];for(var _0x583c36=0x0;_0x583c36<_0x52f9d9['conditions']['length'];_0x583c36++){var _0x39d64e=_0x52f9d9['conditions'][_0x583c36];var _0xfbf320='i';var _0x568037=_[_0x4fa9('0x64')](_0x93fb02,[_0x4fa9('0x2c'),_0x39d64e[_0x4fa9('0x51')]]);if(!_0x568037){switch(_0x39d64e[_0x4fa9('0x51')]){case _0x4fa9('0x65'):if(_0x39d64e[_0x4fa9('0x66')]==0x1){_0x85c954[_0x4fa9('0x67')]('`'+_0x39d64e[_0x4fa9('0x51')]+_0x4fa9('0x68'));}else{_0x85c954[_0x4fa9('0x67')]('`'+_0x39d64e[_0x4fa9('0x51')]+_0x4fa9('0x69'));}break;case'Contact':if(_0x39d64e[_0x4fa9('0x6a')]===_0x4fa9('0x6b')){if(_0x39d64e[_0x4fa9('0x66')][_0x4fa9('0x33')]('\x20')[_0x4fa9('0x49')]>0x1){_0x2c3515[_0x300b32]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x39d64e[_0x4fa9('0x66')]),null);}else{var _0x22c712='%'+_0x39d64e[_0x4fa9('0x66')]+'%';_0x2c3515[_0x300b32](_0x4fa9('0x6c'),_0x22c712,_0x22c712,_0x22c712);}}else{_0x568037=_[_0x4fa9('0x64')](_0x93fb02,[_0x4fa9('0x2c'),'ContactId']);_0x39d64e[_0x4fa9('0x51')]=_0x4fa9('0x6d');_0x4ec4fa=as[_0x4fa9('0x6e')](_0xfbf320,_0x568037[_0x4fa9('0x40')],_0x39d64e);_0x2c3515[_0x300b32](_0x4ec4fa[_0x4fa9('0x6f')],_0x4ec4fa['value'][_0x4fa9('0x70')],_0x4ec4fa[_0x4fa9('0x66')][_0x4fa9('0x1c')]);}break;case _0x4fa9('0x71'):var _0x504330=_0x39d64e[_0x4fa9('0x66')][_0x4fa9('0x33')](',')[_0x4fa9('0x2f')](function(_0x10f82b){return Number(_0x10f82b);});_0x504330[_0x4fa9('0x72')](function(_0x406604){_0x464ab3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x406604+',%');});_0x3f03c5=_[_0x4fa9('0x73')](_0x3f03c5,_0x504330);break;case'User':if(_0x39d64e[_0x4fa9('0x6a')]===_0x4fa9('0x6b')){_0x2c3515[_0x300b32](_0x4fa9('0x74'),'%'+_0x39d64e[_0x4fa9('0x66')]+'%',null);}else{_0x568037=_['find'](_0x93fb02,[_0x4fa9('0x2c'),_0x4fa9('0x3c')]);_0x39d64e[_0x4fa9('0x51')]=_0x4fa9('0x3c');_0x4ec4fa=as['buildExpression'](_0xfbf320,_0x568037[_0x4fa9('0x40')],_0x39d64e);_0x2c3515[_0x300b32](_0x4ec4fa['text'],_0x4ec4fa[_0x4fa9('0x66')][_0x4fa9('0x70')],_0x4ec4fa[_0x4fa9('0x66')][_0x4fa9('0x1c')]);}break;case _0x4fa9('0x75'):_0x4ec4fa=as[_0x4fa9('0x6e')]('me',null,_0x39d64e);_0x2c3515[_0x300b32](_0x4ec4fa[_0x4fa9('0x6f')],_0x4ec4fa[_0x4fa9('0x66')][_0x4fa9('0x70')],_0x4ec4fa['value'][_0x4fa9('0x1c')]);break;}}else{var _0x4ec4fa=as[_0x4fa9('0x6e')](_0xfbf320,_0x568037['type'],_0x39d64e);_0x2c3515[_0x300b32](_0x4ec4fa[_0x4fa9('0x6f')],_0x4ec4fa[_0x4fa9('0x66')][_0x4fa9('0x70')],_0x4ec4fa[_0x4fa9('0x66')][_0x4fa9('0x1c')]);}}}else{var _0x109b9e=_(_0x22b9cf[_0x4fa9('0x44')])[_0x4fa9('0x43')]()[_0x4fa9('0x2f')](function(_0x3e74f2){return _[_0x4fa9('0x76')](_0x93fb02,[_0x4fa9('0x2c'),_0x3e74f2])?_0x3e74f2:undefined;})[_0x4fa9('0x77')]()[_0x4fa9('0x66')]();if(!_[_0x4fa9('0x78')](_0x109b9e)){_0x109b9e[_0x4fa9('0x72')](function(_0x27844c){if(_0x27844c===_0x4fa9('0x79')){_0x85c954[_0x4fa9('0x4e')](_0x4fa9('0x7a'),[][_0x4fa9('0x7b')](_0x22b9cf[_0x4fa9('0x44')][_0x27844c]));}else if(_0x27844c===_0x4fa9('0x7c')){var _0x287e5c=JSON[_0x4fa9('0x7d')](_0x22b9cf['query'][_0x27844c])['$gte'];var _0x5c93f8=JSON['parse'](_0x22b9cf['query'][_0x27844c])['$lte'];_0x85c954[_0x4fa9('0x4e')](_0x4fa9('0x7e'),_0x287e5c,_0x5c93f8);}else{if(_0x22b9cf[_0x4fa9('0x44')][_0x27844c]===_0x4fa9('0x7f')){_0x85c954['where']('i.'+_0x27844c+_0x4fa9('0x80'));}else{_0x85c954[_0x4fa9('0x4e')]('i.'+_0x27844c+_0x4fa9('0x81'),_0x22b9cf['query'][_0x27844c]);}}});}if(_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x82')]){if(_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x82')]==0x1){_0x85c954[_0x4fa9('0x67')](_0x4fa9('0x83'));}else{_0x85c954['having'](_0x4fa9('0x84'));}}if(_0x22b9cf['query'][_0x4fa9('0x85')]){_0x3f03c5=_[_0x4fa9('0x86')](_0x22b9cf['query'][_0x4fa9('0x85')])?_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x85')]:new Array(_0x22b9cf['query']['tag']);_0x3f03c5[_0x4fa9('0x72')](function(_0xcbd37d){_0x464ab3['or'](_0x4fa9('0x87'),'%,'+_0xcbd37d+',%');});}if(_0x22b9cf[_0x4fa9('0x44')]['filter']){var _0x442e31=_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x88')]['replace']('\x5c','\x5c\x5c')[_0x4fa9('0x89')](/'/g,'\x27\x27');if(qs[_0x4fa9('0x8a')](_0x442e31)){_0x2c3515['or'](_0x4fa9('0x8b'),_0x442e31+'%')['or']('i.phone\x20LIKE\x20?',_0x442e31+'%');}else{_0x2c3515['or'](_0x4fa9('0x8c'),qs['getFullTextValue'](_0x442e31))['or'](_0x4fa9('0x8d'),_0x442e31+'%');}}}_0x85c954[_0x4fa9('0x4e')](_0x2c3515);_0x85c954[_0x4fa9('0x8e')](_0x4fa9('0x8f'));var _0x378d89={'type':db['Sequelize']['QueryTypes'][_0x4fa9('0x90')],'raw':!![]};var _0x3cae67=_0x85c954[_0x4fa9('0x91')]();_0x3cae67[_0x4fa9('0x51')](_0x4fa9('0x8f'));_0x3cae67['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4fa9('0x65'));if(_0x33a8d9[_0x4fa9('0x4c')]){_0x33a8d9[_0x4fa9('0x4c')][_0x4fa9('0x72')](function(_0x44bde2){var _0x3d7c28=_0x44bde2[0x0]==='contactName'?_0x44bde2[0x0]:'i.'+_0x44bde2[0x0];_0x85c954[_0x4fa9('0x4c')](_0x3d7c28,_0x44bde2[0x1]===_0x4fa9('0x92')?![]:!![]);});}if(!_[_0x4fa9('0x78')](_0x3f03c5)){_0x85c954[_0x4fa9('0x67')](_0x464ab3);_0x3cae67[_0x4fa9('0x4e')](_0x4fa9('0x93'),_0x3f03c5);}BPromise[_0x4fa9('0x94')]()[_0x4fa9('0x28')](function(){if(!_0x52f9d9){if(_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x79')])return;_0x3cae67[_0x4fa9('0x4e')](_0x4fa9('0x95'));_0x85c954[_0x4fa9('0x4e')](_0x4fa9('0x95'));return;}if(_0x22b9cf[_0x4fa9('0x96')][_0x4fa9('0x97')]!==_0x4fa9('0x98'))return;return _0x22b9cf[_0x4fa9('0x96')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x328b90){if(_[_0x4fa9('0x78')](_0x328b90)){_0x3cae67[_0x4fa9('0x4e')](_0x4fa9('0x99'));_0x85c954[_0x4fa9('0x4e')](_0x4fa9('0x99'));}else{_0x3cae67[_0x4fa9('0x4e')](_0x4fa9('0x7a'),_[_0x4fa9('0x2f')](_0x328b90,'id'));_0x85c954[_0x4fa9('0x4e')](_0x4fa9('0x7a'),_[_0x4fa9('0x2f')](_0x328b90,'id'));}});})[_0x4fa9('0x28')](function(){if(_0x22b9cf[_0x4fa9('0x96')]['role']===_0x4fa9('0x98')&&!_0x52f9d9&&!_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x79')])return[];return db[_0x4fa9('0x9a')]['query'](_0x3cae67[_0x4fa9('0x9b')](),_0x378d89);})[_0x4fa9('0x28')](function(_0x21e41d){_0x167c8c[_0x4fa9('0x1e')]=_0x21e41d[_0x4fa9('0x49')];if(_0x167c8c[_0x4fa9('0x1e')]===0x0)return[];return db[_0x4fa9('0x9a')][_0x4fa9('0x44')](_0x5d838c['toString'](),_0x378d89)[_0x4fa9('0x28')](function(_0x4b0f54){_0x5d3b12=_[_0x4fa9('0x9c')](_0x4b0f54,'id');_0x378d89=_[_0x4fa9('0x9d')](_0x378d89,{'model':db[_0x4fa9('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x22b9cf[_0x4fa9('0x44')][_0x4fa9('0x48')]){_0x33a8d9[_0x4fa9('0x47')]['forEach'](function(_0x4e1fdc){_0x85c954[_0x4fa9('0x51')]('i.'+_0x4e1fdc);});}else{_0x85c954[_0x4fa9('0x51')](_0x4fa9('0x9f'),_0x4fa9('0x65'));_0x85c954['field'](_0x4fa9('0xa0'),_0x4fa9('0xa1'));_0x85c954[_0x4fa9('0x51')]('a.mandatoryDisposition',_0x4fa9('0xa2'));_0x85c954[_0x4fa9('0x51')](_0x4fa9('0xa3'),_0x4fa9('0xa4'));_0x85c954['field'](_0x4fa9('0xa5'));_0x85c954['field']('c.firstName',_0x4fa9('0xa6'));_0x85c954[_0x4fa9('0x51')](_0x4fa9('0xa7'),'Contact.lastName');_0x85c954[_0x4fa9('0x51')](_0x4fa9('0xa8'),_0x4fa9('0xa9'));_0x85c954[_0x4fa9('0x51')](_0x4fa9('0xaa'),_0x4fa9('0xab'));_0x85c954[_0x4fa9('0x51')](_0x4fa9('0xac'),'Contact.mobile');_0x85c954[_0x4fa9('0x51')](_0x4fa9('0xad'),_0x4fa9('0xae'));_0x85c954[_0x4fa9('0x51')]('o.fullname',_0x4fa9('0xaf'));_0x85c954['field'](_0x4fa9('0xb0'),_0x4fa9('0xb1'));_0x85c954['field'](_0x4fa9('0xb2'),_0x4fa9('0x31'));}if(_0x33a8d9[_0x4fa9('0x20')])_0x85c954['limit'](_0x33a8d9[_0x4fa9('0x20')]);if(_0x33a8d9['offset'])_0x85c954['offset'](_0x33a8d9[_0x4fa9('0x1f')]);return db['sequelize'][_0x4fa9('0x44')](_0x85c954[_0x4fa9('0x9b')](),_0x378d89);})[_0x4fa9('0x28')](function(_0xc5bcab){if(_0xc5bcab[_0x4fa9('0x49')]>0x0)_0x5044b3[_0x4fa9('0x4e')](_0x4fa9('0xb3'),_[_0x4fa9('0x2f')](_0xc5bcab,'id'));return db[_0x4fa9('0x9a')][_0x4fa9('0x44')](_0x5044b3[_0x4fa9('0x9b')](),_0x378d89)[_0x4fa9('0x28')](function(_0x3b602e){var _0x302206=_[_0x4fa9('0xb4')](_0x3b602e,_0x4fa9('0xb5'));var _0x48a12a=[];_0xc5bcab['forEach'](function(_0x43051b){_0x48a12a[_0x4fa9('0x34')](updateWhatsappInteraction(_0x43051b,_0x5d3b12,_0x302206));});return BPromise[_0x4fa9('0xb6')](_0x48a12a);});});})[_0x4fa9('0x28')](function(_0x26a3b8){_0x167c8c[_0x4fa9('0xb7')]=_0x26a3b8;return _0x167c8c;})[_0x4fa9('0x28')](respondWithFilteredResult(_0x47750a,_0x33a8d9))[_0x4fa9('0x35')](handleError(_0x47750a,null));};exports[_0x4fa9('0xb8')]=function(_0x4b4ef3,_0x1d6d06){var _0x20be4d={'raw':![],'where':{'id':_0x4b4ef3['params']['id']}},_0x546157={};_0x546157[_0x4fa9('0x42')]=_[_0x4fa9('0x43')](db[_0x4fa9('0x9e')][_0x4fa9('0x3e')]);_0x546157[_0x4fa9('0x44')]=_[_0x4fa9('0x43')](_0x4b4ef3['query']);_0x546157[_0x4fa9('0x45')]=_['intersection'](_0x546157[_0x4fa9('0x42')],_0x546157[_0x4fa9('0x44')]);_0x20be4d[_0x4fa9('0x47')]=_['intersection'](_0x546157[_0x4fa9('0x42')],qs['fields'](_0x4b4ef3[_0x4fa9('0x44')][_0x4fa9('0x48')]));_0x20be4d[_0x4fa9('0x47')]=_0x20be4d[_0x4fa9('0x47')][_0x4fa9('0x49')]?_0x20be4d[_0x4fa9('0x47')]:_0x546157[_0x4fa9('0x42')];if(_0x4b4ef3[_0x4fa9('0x44')][_0x4fa9('0xb9')]){_0x20be4d['include']=[{'all':!![]}];}_0x20be4d=_[_0x4fa9('0x9d')]({},_0x20be4d,_0x4b4ef3[_0x4fa9('0xba')]);return db['WhatsappInteraction'][_0x4fa9('0x64')](_0x20be4d)[_0x4fa9('0x28')](handleEntityNotFound(_0x1d6d06,null))[_0x4fa9('0x28')](respondWithResult(_0x1d6d06,null))['catch'](handleError(_0x1d6d06,null));};exports[_0x4fa9('0xbb')]=function(_0x1010df,_0x283d0f){return db['WhatsappInteraction'][_0x4fa9('0xbb')](_0x1010df[_0x4fa9('0x75')],{})[_0x4fa9('0x28')](respondWithResult(_0x283d0f,0xc9))[_0x4fa9('0x35')](handleError(_0x283d0f,null));};exports['update']=function(_0x2d4854,_0xf63800){if(_0x2d4854[_0x4fa9('0x75')]['id']){delete _0x2d4854[_0x4fa9('0x75')]['id'];}return db[_0x4fa9('0x9e')][_0x4fa9('0x64')]({'where':{'id':_0x2d4854[_0x4fa9('0xbc')]['id']}})[_0x4fa9('0x28')](handleEntityNotFound(_0xf63800,null))[_0x4fa9('0x28')](saveUpdates(_0x2d4854[_0x4fa9('0x75')],null))[_0x4fa9('0x28')](respondWithResult(_0xf63800,null))['catch'](handleError(_0xf63800,null));};exports[_0x4fa9('0x29')]=function(_0x5d0b37,_0x22008a){return db[_0x4fa9('0x9e')]['find']({'where':{'id':_0x5d0b37[_0x4fa9('0xbc')]['id']}})[_0x4fa9('0x28')](handleEntityNotFound(_0x22008a,null))[_0x4fa9('0x28')](removeEntity(_0x22008a,null))['catch'](handleError(_0x22008a,null));};exports[_0x4fa9('0xbd')]=function(_0x25d259,_0x5acd8a){return db['WhatsappInteraction'][_0x4fa9('0xbd')]()[_0x4fa9('0x28')](respondWithResult(_0x5acd8a,null))[_0x4fa9('0x35')](handleError(_0x5acd8a,null));};exports[_0x4fa9('0xbe')]=function(_0x155dfd,_0x1744ac,_0x580761){return db[_0x4fa9('0xbf')][_0x4fa9('0x64')]({'where':{'id':_0x155dfd[_0x4fa9('0xbc')]['id']}})[_0x4fa9('0x28')](handleEntityNotFound(_0x1744ac,null))['then'](function(_0x47a508){if(_0x47a508){return _0x47a508[_0x4fa9('0xbe')](_0x155dfd[_0x4fa9('0x75')][_0x4fa9('0xc0')],_['omit'](_0x155dfd['body'],[_0x4fa9('0xc0'),'id'])||{});}})[_0x4fa9('0x28')](respondWithResult(_0x1744ac,null))['catch'](handleError(_0x1744ac,null));};exports['getMessages']=function(_0x47b0b5,_0x563eba,_0x5844d8){var _0x14904b={'raw':![],'where':{}};var _0xfa4bcc={};var _0x12ec25={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4fa9('0xc1')]({'where':{'id':_0x47b0b5['params']['id']}})[_0x4fa9('0x28')](handleEntityNotFound(_0x563eba,null))[_0x4fa9('0x28')](function(_0x2e7fbe){if(_0x2e7fbe){_0xfa4bcc['model']=_[_0x4fa9('0x43')](db[_0x4fa9('0xbf')][_0x4fa9('0x3e')]);_0xfa4bcc[_0x4fa9('0x44')]=_[_0x4fa9('0x43')](_0x47b0b5[_0x4fa9('0x44')]);_0xfa4bcc[_0x4fa9('0x45')]=_[_0x4fa9('0x46')](_0xfa4bcc[_0x4fa9('0x42')],_0xfa4bcc['query']);_0x14904b[_0x4fa9('0x47')]=_[_0x4fa9('0x46')](_0xfa4bcc['model'],qs[_0x4fa9('0x48')](_0x47b0b5[_0x4fa9('0x44')][_0x4fa9('0x48')]));_0x14904b[_0x4fa9('0x47')]=_0x14904b[_0x4fa9('0x47')]['length']?_0x14904b[_0x4fa9('0x47')]:_0xfa4bcc[_0x4fa9('0x42')];if(!_0x47b0b5[_0x4fa9('0x44')][_0x4fa9('0x4a')](_0x4fa9('0x4b'))){_0x14904b[_0x4fa9('0x20')]=qs[_0x4fa9('0x20')](_0x47b0b5[_0x4fa9('0x44')][_0x4fa9('0x20')]);_0x14904b[_0x4fa9('0x1f')]=qs[_0x4fa9('0x1f')](_0x47b0b5['query'][_0x4fa9('0x1f')]);}_0x14904b[_0x4fa9('0x4c')]=qs[_0x4fa9('0x4d')](_0x47b0b5['query'][_0x4fa9('0x4d')]);_0x14904b[_0x4fa9('0x4e')]=qs[_0x4fa9('0x45')](_[_0x4fa9('0x4f')](_0x47b0b5[_0x4fa9('0x44')],_0xfa4bcc['filters']));_0x14904b['where'][_0x4fa9('0xb5')]=_0x2e7fbe['id'];if(_0x47b0b5[_0x4fa9('0x44')][_0x4fa9('0x88')]){_0x14904b['where']=_[_0x4fa9('0x9d')](_0x14904b[_0x4fa9('0x4e')],{'$or':_['map'](_0x14904b['attributes'],function(_0x571132){var _0x119fcc={};_0x119fcc[_0x571132]={'$like':'%'+_0x47b0b5[_0x4fa9('0x44')]['filter']+'%'};return _0x119fcc;})});}if(_0x47b0b5[_0x4fa9('0x44')][_0x4fa9('0xc2')]){var _0x26d0fc=_0x47b0b5[_0x4fa9('0x44')]['$gte'][_0x4fa9('0x33')](',');var _0x3cc680={};_0x3cc680[_0x26d0fc[0x0]]={'$gte':moment(_0x26d0fc[0x1])[_0x4fa9('0xc3')](_0x4fa9('0xc4'))};_0x14904b[_0x4fa9('0x4e')]=_[_0x4fa9('0x9d')](_0x14904b[_0x4fa9('0x4e')],_0x3cc680);}_0x14904b=_[_0x4fa9('0x9d')]({},_0x14904b,_0x47b0b5[_0x4fa9('0xba')]);return db[_0x4fa9('0xbf')][_0x4fa9('0x1e')]({'where':_0x14904b[_0x4fa9('0x4e')]})[_0x4fa9('0x28')](function(_0x1ee7c5){_0x12ec25[_0x4fa9('0x1e')]=_0x1ee7c5;if(_0x47b0b5[_0x4fa9('0x44')][_0x4fa9('0xb9')]){_0x14904b['include']=[{'all':!![]}];}return db[_0x4fa9('0xbf')][_0x4fa9('0xc5')](_0x14904b);})[_0x4fa9('0x28')](function(_0x27dd20){_0x12ec25[_0x4fa9('0xb7')]=_0x27dd20;return _0x12ec25;});}})['then'](respondWithFilteredResult(_0x563eba,_0x14904b))['catch'](handleError(_0x563eba,null));};exports['addTags']=function(_0x17de9f,_0x4c209b,_0x409f6c){return db[_0x4fa9('0x9e')][_0x4fa9('0x64')]({'where':{'id':_0x17de9f[_0x4fa9('0xbc')]['id']}})[_0x4fa9('0x28')](handleEntityNotFound(_0x4c209b,null))[_0x4fa9('0x28')](function(_0x32c58c){if(_0x32c58c){return _0x32c58c['setTags'](_0x17de9f[_0x4fa9('0x75')]['ids'],_[_0x4fa9('0xc6')](_0x17de9f[_0x4fa9('0x75')],['ids','id'])||{})[_0x4fa9('0xc7')](function(){return db[_0x4fa9('0x71')][_0x4fa9('0xc5')]({'attributes':['id',_0x4fa9('0x2c'),_0x4fa9('0x52')],'where':{'id':_0x17de9f[_0x4fa9('0x75')][_0x4fa9('0xc0')]}});})[_0x4fa9('0x28')](function(_0x25e7e8){socket[_0x4fa9('0xc8')](_0x4fa9('0xc9'),{'id':Number(_0x17de9f[_0x4fa9('0xbc')]['id']),'tags':_0x25e7e8||[]});return{'id':Number(_0x17de9f[_0x4fa9('0xbc')]['id']),'tags':_0x25e7e8||[]};});}})[_0x4fa9('0x28')](respondWithResult(_0x4c209b,null))[_0x4fa9('0x35')](handleError(_0x4c209b,null));};exports['removeTags']=function(_0x86333b,_0x24eb4a,_0x4dce59){return db['WhatsappInteraction'][_0x4fa9('0x64')]({'where':{'id':_0x86333b[_0x4fa9('0xbc')]['id']}})[_0x4fa9('0x28')](handleEntityNotFound(_0x24eb4a,null))[_0x4fa9('0x28')](function(_0x260d55){if(_0x260d55){return _0x260d55['removeTags'](_0x86333b['query']['ids']);}})[_0x4fa9('0x28')](respondWithStatusCode(_0x24eb4a,null))[_0x4fa9('0x35')](handleError(_0x24eb4a,null));};exports['download']=function(_0x50ab09,_0x12083f){var _0xf354d0=moment()[_0x4fa9('0xca')]()[_0x4fa9('0x9b')]();var _0x5ea3e0=path[_0x4fa9('0xcb')](config[_0x4fa9('0xcc')],_0x4fa9('0xcd'),_0x4fa9('0xce'),'tmp');var _0x534dbb=path['join'](config[_0x4fa9('0xcc')],_0x4fa9('0xcd'),_0x4fa9('0xce'),_0x4fa9('0xcf'));var _0x56e82f=path[_0x4fa9('0xcb')](_0x5ea3e0,_0xf354d0);var _0x20ad2e=util[_0x4fa9('0xc3')](_0x4fa9('0xd0'),_0x50ab09['params']['id'],_0xf354d0);var _0x2e1cbb=path['join'](_0x5ea3e0,_0x20ad2e);var _0x3aaa11=[];_0x3aaa11['push']({'model':db[_0x4fa9('0xd1')],'as':_0x4fa9('0xd1'),'attributes':['id',_0x4fa9('0x30')],'raw':!![]});_0x3aaa11[_0x4fa9('0x34')]({'model':db[_0x4fa9('0xd2')],'as':_0x4fa9('0xd3'),'attributes':['id',_0x4fa9('0xd4'),_0x4fa9('0xd5')],'raw':!![]});if(_0x50ab09[_0x4fa9('0x44')][_0x4fa9('0xcf')]){_0x3aaa11[_0x4fa9('0x34')]({'model':db[_0x4fa9('0xd6')],'as':_0x4fa9('0xd6'),'raw':!![]});}var _0x2d53f8=[{'model':db[_0x4fa9('0xbf')],'as':'Messages','attributes':['id',_0x4fa9('0x75'),_0x4fa9('0x7c'),_0x4fa9('0xd7'),_0x4fa9('0xd8'),_0x4fa9('0x82')],'include':_0x3aaa11}];_0x2d53f8[_0x4fa9('0x34')]({'model':db[_0x4fa9('0xd9')],'as':_0x4fa9('0xda'),'attributes':['id',_0x4fa9('0x2c')]});_0x2d53f8[_0x4fa9('0x34')]({'model':db[_0x4fa9('0xd1')],'as':'Owner','attributes':['id',_0x4fa9('0x30')]});return db['WhatsappInteraction'][_0x4fa9('0x64')]({'where':{'id':_0x50ab09['params']['id']},'include':_0x2d53f8})[_0x4fa9('0x28')](handleEntityNotFound(_0x12083f,null))[_0x4fa9('0x28')](function(_0x4c1be4){if(_0x4c1be4){var _0x4dd4ba=_0x4c1be4[_0x4fa9('0xdb')]({'plain':!![]});fs[_0x4fa9('0xdc')](_0x56e82f);var _0x4bba2b={'channel':_0x4fa9('0xdd'),'account':_0x4dd4ba[_0x4fa9('0xda')]['name'],'agent':_0x4dd4ba[_0x4fa9('0xde')]?_0x4dd4ba[_0x4fa9('0xde')][_0x4fa9('0x30')]:'N.A.','createdAt':moment(_0x4dd4ba[_0x4fa9('0x7c')])[_0x4fa9('0xc3')](_0x4fa9('0xc4'))[_0x4fa9('0x9b')](),'closedAt':_0x4dd4ba['closed']?moment(_0x4dd4ba['closedAt'])[_0x4fa9('0xc3')](_0x4fa9('0xc4'))['toString']():'','disposition':_0x4dd4ba[_0x4fa9('0xdf')],'messages':_(_0x4dd4ba[_0x4fa9('0xe0')])[_0x4fa9('0x88')]({'secret':![]})[_0x4fa9('0x2f')](function(_0x53f971){if(_0x53f971[_0x4fa9('0xd6')]){var _0x59ef7e=path[_0x4fa9('0xcb')](_0x534dbb,_0x53f971[_0x4fa9('0xd6')][_0x4fa9('0xe1')]);if(fs[_0x4fa9('0xe2')](_0x59ef7e)){fs['createReadStream'](_0x59ef7e)[_0x4fa9('0xe3')](fs[_0x4fa9('0xe4')](path[_0x4fa9('0xcb')](_0x56e82f,_0x53f971['Attachment'][_0x4fa9('0xe1')])));}}return{'date':moment(_0x53f971[_0x4fa9('0x7c')])[_0x4fa9('0xc3')](_0x4fa9('0xc4'))[_0x4fa9('0x9b')](),'sender':_0x53f971['direction']===_0x4fa9('0xe5')?_0x53f971[_0x4fa9('0xd1')]?_0x53f971['User'][_0x4fa9('0x30')]:_0x4fa9('0xe6'):_0x53f971['Contact']['firstName']+(_0x53f971[_0x4fa9('0xd3')][_0x4fa9('0xd5')]?'\x20'+_0x53f971[_0x4fa9('0xd3')][_0x4fa9('0xd5')]:''),'body':_0x53f971[_0x4fa9('0xd6')]?_0x53f971[_0x4fa9('0xd6')][_0x4fa9('0xe1')]:_0x53f971[_0x4fa9('0x75')],'direction':_0x53f971['direction']===_0x4fa9('0xe5')?'A':'C','secret':_0x53f971['secret'],'read':_0x53f971[_0x4fa9('0x82')],'attachment':_0x53f971[_0x4fa9('0xd6')]};})[_0x4fa9('0x66')]()};return ejs['renderFile'](path[_0x4fa9('0xcb')](config[_0x4fa9('0xcc')],'server',_0x4fa9('0xe7'),_0x4fa9('0xe8')),{'interaction':_0x4bba2b})[_0x4fa9('0x28')](function(_0x333756){var _0x130581=path[_0x4fa9('0xcb')](_0x56e82f,_0x4fa9('0xe9')+_0x4dd4ba['id']+'-'+_0xf354d0+_0x4fa9('0xea'));var _0x30f25b={'path':_0x130581,'channel':'Whatsapp','interactionId':_0x4dd4ba['id']};return pdf[_0x4fa9('0xeb')](_0x333756,_0x30f25b);})[_0x4fa9('0x28')](function(){return new BPromise(function(_0x517eba,_0x216b7c){zipdir(_0x56e82f,{'saveTo':_0x2e1cbb},function(_0x3a2fbd,_0x898336){if(_0x3a2fbd)return _0x216b7c(_0x3a2fbd);return _0x517eba(_0x898336);});})[_0x4fa9('0x28')](function(){return new BPromise(function(_0x31a6c7,_0x167b52){rimraf(_0x56e82f,function(_0x144b89){if(_0x144b89)_0x167b52(_0x144b89);return _0x31a6c7();});});})[_0x4fa9('0x28')](function(){return _0x12083f[_0x4fa9('0xec')](_0x2e1cbb,_0x20ad2e,function(_0x5c25d4){if(_0x5c25d4){console[_0x4fa9('0xed')](_0x4fa9('0xee'),_0x5c25d4);}else{fs[_0x4fa9('0xef')](_0x2e1cbb);}});});});}else{return _0x12083f[_0x4fa9('0x1a')](0xc8);}})['catch'](handleError(_0x12083f,null));}; \ No newline at end of file +var _0x5d4e=['i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','push','all','rows','show','params','includeAll','create','destroy','describe','addMessage','WhatsappMessage','ids','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','omit','findAll','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','Attachment','existsSync','createReadStream','createWriteStream','basename','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','stack','name','send','Users','TagIds','Tags','split','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','field','color','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','whatsapp_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END'];(function(_0x20481f,_0x23f9aa){var _0x16b17c=function(_0xbcf6ff){while(--_0xbcf6ff){_0x20481f['push'](_0x20481f['shift']());}};_0x16b17c(++_0x23f9aa);}(_0x5d4e,0x138));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5d4('0x0'));var zipdir=require(_0xe5d4('0x1'));var jsonpatch=require(_0xe5d4('0x2'));var rp=require(_0xe5d4('0x3'));var moment=require(_0xe5d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5d4('0x5'));var util=require(_0xe5d4('0x6'));var path=require(_0xe5d4('0x7'));var sox=require('sox');var csv=require(_0xe5d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe5d4('0x9'));var crypto=require(_0xe5d4('0xa'));var jsforce=require(_0xe5d4('0xb'));var deskjs=require(_0xe5d4('0xc'));var toCsv=require(_0xe5d4('0x8'));var querystring=require(_0xe5d4('0xd'));var Papa=require(_0xe5d4('0xe'));var Redis=require(_0xe5d4('0xf'));var authService=require(_0xe5d4('0x10'));var qs=require(_0xe5d4('0x11'));var as=require(_0xe5d4('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5d4('0x13'))(_0xe5d4('0x14'));var utils=require(_0xe5d4('0x15'));var config=require(_0xe5d4('0x16'));var licenseUtil=require(_0xe5d4('0x17'));var db=require(_0xe5d4('0x18'))['db'];config[_0xe5d4('0x19')]=_[_0xe5d4('0x1a')](config[_0xe5d4('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5d4('0x19')]));require(_0xe5d4('0x1b'))['register'](socket);function respondWithStatusCode(_0x9af39d,_0x3a3017){_0x3a3017=_0x3a3017||0xcc;return function(_0x3dee9f){if(_0x3dee9f){return _0x9af39d[_0xe5d4('0x1c')](_0x3a3017);}return _0x9af39d[_0xe5d4('0x1d')](_0x3a3017)[_0xe5d4('0x1e')]();};}function respondWithResult(_0x3e0139,_0x1c78fa){_0x1c78fa=_0x1c78fa||0xc8;return function(_0x274b83){if(_0x274b83){return _0x3e0139[_0xe5d4('0x1d')](_0x1c78fa)[_0xe5d4('0x1f')](_0x274b83);}};}function respondWithFilteredResult(_0x12ab5b,_0x915fb7){return function(_0x3a926a){if(_0x3a926a){var _0x435782=typeof _0x915fb7[_0xe5d4('0x20')]===_0xe5d4('0x21')&&typeof _0x915fb7[_0xe5d4('0x22')]===_0xe5d4('0x21');var _0x3253fe=_0x3a926a['count'];var _0x222791=_0x435782?0x0:_0x915fb7[_0xe5d4('0x20')];var _0x4c632f=_0x435782?_0x3a926a[_0xe5d4('0x23')]:_0x915fb7[_0xe5d4('0x20')]+_0x915fb7[_0xe5d4('0x22')];var _0x2f13d9;if(_0x4c632f>=_0x3253fe){_0x4c632f=_0x3253fe;_0x2f13d9=0xc8;}else{_0x2f13d9=0xce;}_0x12ab5b[_0xe5d4('0x1d')](_0x2f13d9);return _0x12ab5b[_0xe5d4('0x24')]('Content-Range',_0x222791+'-'+_0x4c632f+'/'+_0x3253fe)['json'](_0x3a926a);}return null;};}function patchUpdates(_0x2712b5){return function(_0x22283f){try{jsonpatch['apply'](_0x22283f,_0x2712b5,!![]);}catch(_0x1ddbbb){return BPromise[_0xe5d4('0x25')](_0x1ddbbb);}return _0x22283f['save']();};}function saveUpdates(_0x4cec21,_0x3c1a60){return function(_0x2d6e4f){if(_0x2d6e4f){return _0x2d6e4f[_0xe5d4('0x26')](_0x4cec21)[_0xe5d4('0x27')](function(_0x3e266e){return _0x3e266e;});}return null;};}function removeEntity(_0xb124df,_0x1c08b7){return function(_0x456ab2){if(_0x456ab2){return _0x456ab2['destroy']()[_0xe5d4('0x27')](function(){_0xb124df[_0xe5d4('0x1d')](0xcc)[_0xe5d4('0x1e')]();});}};}function handleEntityNotFound(_0x5db1fd,_0xf48273){return function(_0xf35c55){if(!_0xf35c55){_0x5db1fd[_0xe5d4('0x1c')](0x194);}return _0xf35c55;};}function handleError(_0x39478a,_0xbb9fdd){_0xbb9fdd=_0xbb9fdd||0x1f4;return function(_0xb0ae3b){logger['error'](_0xb0ae3b[_0xe5d4('0x28')]);if(_0xb0ae3b[_0xe5d4('0x29')]){delete _0xb0ae3b[_0xe5d4('0x29')];}_0x39478a[_0xe5d4('0x1d')](_0xbb9fdd)[_0xe5d4('0x2a')](_0xb0ae3b);};}function getInteractionUsers(_0x3bbe51,_0x569160){return new BPromise(function(_0x45663b,_0xbcf569){try{if(_0x569160[_0x3bbe51['id']]){_0x3bbe51[_0xe5d4('0x2b')]=_['map'](_0x569160[_0x3bbe51['id']],function(_0x346df4){return{'id':_0x346df4['id'],'fullname':_0x346df4['fullname']};});}}catch(_0x482bc2){_0xbcf569(_0x482bc2);}_0x45663b(_0x3bbe51);});}function getInteractionTags(_0x536d60,_0x49d612){return new BPromise(function(_0x15f33d,_0x1b5cd2){try{if(_0x536d60[_0xe5d4('0x2c')]){_0x536d60[_0xe5d4('0x2d')]=[];_0x536d60[_0xe5d4('0x2c')][_0xe5d4('0x2e')](',')['forEach'](function(_0x548cae){_0x536d60['Tags']['push'](_0x49d612[_0x548cae]);});}delete _0x536d60[_0xe5d4('0x2c')];}catch(_0x2f2e68){_0x1b5cd2(_0x2f2e68);}_0x15f33d(_0x536d60);});}function updateWhatsappInteraction(_0x412872,_0x2ba9c7,_0x48914a){return new BPromise(function(_0x1d344c,_0x1bc823){return getInteractionUsers(_0x412872,_0x48914a)[_0xe5d4('0x27')](function(_0x5dbc05){return getInteractionTags(_0x5dbc05,_0x2ba9c7);})[_0xe5d4('0x27')](function(_0x1e179a){return getStateInteraction(_0x1e179a);})[_0xe5d4('0x27')](function(_0x3510a5){_0x1d344c(_0x3510a5);})[_0xe5d4('0x2f')](function(_0x278484){_0x1bc823(_0x278484);});});}function getStateInteraction(_0x107d4c){return new BPromise(function(_0x475388){_0x107d4c[_0xe5d4('0x30')]=0x0;_0x107d4c['talking']=0x0;_0x107d4c[_0xe5d4('0x31')]=0x0;_0x107d4c[_0xe5d4('0x32')]=0x0;_0x107d4c[_0xe5d4('0x33')]=0x0;if(!_0x107d4c[_0xe5d4('0x34')]&&!_0x107d4c['UserId']){_0x107d4c[_0xe5d4('0x30')]+=0x1;}if(!_0x107d4c[_0xe5d4('0x34')]&&_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x36')]+=0x1;if(_0x107d4c[_0xe5d4('0x30')]){_0x107d4c['waiting']-=0x1;}}if(_0x107d4c['closed']&&_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x31')]+=0x1;if(_0x107d4c[_0xe5d4('0x36')]){_0x107d4c[_0xe5d4('0x36')]-=0x1;}}if(_0x107d4c['closed']&&!_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x32')]+=0x1;if(_0x107d4c[_0xe5d4('0x30')]){_0x107d4c[_0xe5d4('0x30')]-=0x1;}}_0x107d4c[_0xe5d4('0x33')]+=0x1;_0x475388(_0x107d4c);});}exports[_0xe5d4('0x37')]=function(_0x39e17b,_0x1a4123){var _0x2c1445={},_0x333db1={},_0x1f9de9={'count':0x0,'rows':[]};var _0x4f2531=_['map'](db[_0xe5d4('0x38')][_0xe5d4('0x39')],function(_0x4cbd78){return{'name':_0x4cbd78[_0xe5d4('0x3a')],'type':_0x4cbd78[_0xe5d4('0x3b')][_0xe5d4('0x3c')]};});_0x333db1[_0xe5d4('0x3d')]=_[_0xe5d4('0x3e')](_0x4f2531,_0xe5d4('0x29'));_0x333db1[_0xe5d4('0x3f')]=_[_0xe5d4('0x40')](_0x39e17b[_0xe5d4('0x3f')]);_0x333db1[_0xe5d4('0x41')]=_['intersection'](_0x333db1[_0xe5d4('0x3d')],_0x333db1[_0xe5d4('0x3f')]);_0x2c1445[_0xe5d4('0x42')]=_[_0xe5d4('0x43')](_0x333db1[_0xe5d4('0x3d')],qs['fields'](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x2c1445[_0xe5d4('0x42')]=_0x2c1445[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x2c1445['attributes']:_0x333db1['model'];if(!_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x46')](_0xe5d4('0x47'))){_0x2c1445[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x22')]);_0x2c1445[_0xe5d4('0x20')]=qs['offset'](_0x39e17b[_0xe5d4('0x3f')]['offset']);}_0x2c1445['order']=qs[_0xe5d4('0x48')](_0x39e17b[_0xe5d4('0x3f')]['sort']);_0x2c1445[_0xe5d4('0x49')]=qs[_0xe5d4('0x41')](_['pick'](_0x39e17b['query'],_0x333db1['filters']),_0x4f2531);var _0x2df9ac=[];var _0x50e9ec=squel['select']()[_0xe5d4('0x4a')]('id')['field'](_0xe5d4('0x29'))[_0xe5d4('0x4a')](_0xe5d4('0x4b'))[_0xe5d4('0x4c')]('tools_tags');var _0x1fe8fc=squel['select']()[_0xe5d4('0x4a')]('u.id')[_0xe5d4('0x4a')](_0xe5d4('0x4d'))[_0xe5d4('0x4a')](_0xe5d4('0x4e'))['from'](_0xe5d4('0x4f'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x470c56=squel['select']()['from'](_0xe5d4('0x50'),'i')[_0xe5d4('0x51')](_0xe5d4('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe5d4('0x51')](_0xe5d4('0x53'),'o',_0xe5d4('0x54'))['left_join'](_0xe5d4('0x55'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xe5d4('0x51')](_0xe5d4('0x56'),'me',_0xe5d4('0x57'))[_0xe5d4('0x51')](_0xe5d4('0x58'),'it',_0xe5d4('0x59'))[_0xe5d4('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x110f49=squel[_0xe5d4('0x5a')]();var _0x50999e=[];var _0x5b5a02=squel['expr']();var _0x5eede3;if(_0x39e17b['query'][_0xe5d4('0x5b')]){_0x5eede3=as[_0xe5d4('0x5c')](_0x39e17b['query'][_0xe5d4('0x5b')]);var _0x53bf73=_0x5eede3[_0xe5d4('0x5d')];for(var _0xbb46e=0x0;_0xbb46e<_0x5eede3[_0xe5d4('0x5e')][_0xe5d4('0x45')];_0xbb46e++){var _0x28d0ad=_0x5eede3[_0xe5d4('0x5e')][_0xbb46e];var _0x52365e='i';var _0x5b0dba=_[_0xe5d4('0x5f')](_0x4f2531,[_0xe5d4('0x29'),_0x28d0ad[_0xe5d4('0x4a')]]);if(!_0x5b0dba){switch(_0x28d0ad['field']){case _0xe5d4('0x60'):if(_0x28d0ad[_0xe5d4('0x61')]==0x1){_0x470c56[_0xe5d4('0x62')]('`'+_0x28d0ad[_0xe5d4('0x4a')]+_0xe5d4('0x63'));}else{_0x470c56[_0xe5d4('0x62')]('`'+_0x28d0ad[_0xe5d4('0x4a')]+_0xe5d4('0x64'));}break;case _0xe5d4('0x65'):if(_0x28d0ad[_0xe5d4('0x66')]===_0xe5d4('0x67')){if(_0x28d0ad['value'][_0xe5d4('0x2e')]('\x20')[_0xe5d4('0x45')]>0x1){_0x110f49[_0x53bf73](_0xe5d4('0x68'),qs[_0xe5d4('0x69')](_0x28d0ad[_0xe5d4('0x61')]),null);}else{var _0x186546='%'+_0x28d0ad[_0xe5d4('0x61')]+'%';_0x110f49[_0x53bf73](_0xe5d4('0x6a'),_0x186546,_0x186546,_0x186546);}}else{_0x5b0dba=_['find'](_0x4f2531,[_0xe5d4('0x29'),'ContactId']);_0x28d0ad[_0xe5d4('0x4a')]=_0xe5d4('0x6b');_0x3d7877=as[_0xe5d4('0x6c')](_0x52365e,_0x5b0dba[_0xe5d4('0x3b')],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877[_0xe5d4('0x6d')],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x6e')],_0x3d7877['value'][_0xe5d4('0x1e')]);}break;case _0xe5d4('0x6f'):var _0x366c58=_0x28d0ad[_0xe5d4('0x61')][_0xe5d4('0x2e')](',')[_0xe5d4('0x3e')](function(_0x5200ae){return Number(_0x5200ae);});_0x366c58[_0xe5d4('0x70')](function(_0x1337e4){_0x5b5a02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1337e4+',%');});_0x50999e=_[_0xe5d4('0x71')](_0x50999e,_0x366c58);break;case _0xe5d4('0x72'):if(_0x28d0ad[_0xe5d4('0x66')]===_0xe5d4('0x67')){_0x110f49[_0x53bf73](_0xe5d4('0x73'),'%'+_0x28d0ad[_0xe5d4('0x61')]+'%',null);}else{_0x5b0dba=_['find'](_0x4f2531,[_0xe5d4('0x29'),_0xe5d4('0x35')]);_0x28d0ad[_0xe5d4('0x4a')]='UserId';_0x3d7877=as['buildExpression'](_0x52365e,_0x5b0dba[_0xe5d4('0x3b')],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877['text'],_0x3d7877[_0xe5d4('0x61')]['start'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);}break;case _0xe5d4('0x74'):_0x3d7877=as[_0xe5d4('0x6c')]('me',null,_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877[_0xe5d4('0x6d')],_0x3d7877[_0xe5d4('0x61')]['start'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);break;}}else{var _0x3d7877=as[_0xe5d4('0x6c')](_0x52365e,_0x5b0dba['type'],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877['text'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x6e')],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);}}}else{var _0x2e74c3=_(_0x39e17b['query'])[_0xe5d4('0x40')]()[_0xe5d4('0x3e')](function(_0x3f3241){return _[_0xe5d4('0x75')](_0x4f2531,[_0xe5d4('0x29'),_0x3f3241])?_0x3f3241:undefined;})[_0xe5d4('0x76')]()[_0xe5d4('0x61')]();if(!_[_0xe5d4('0x77')](_0x2e74c3)){_0x2e74c3['forEach'](function(_0x20399d){if(_0x20399d==='WhatsappAccountId'){_0x470c56[_0xe5d4('0x49')]('i.WhatsappAccountId\x20IN\x20?',[][_0xe5d4('0x78')](_0x39e17b[_0xe5d4('0x3f')][_0x20399d]));}else if(_0x20399d===_0xe5d4('0x79')){var _0x40f8db=JSON[_0xe5d4('0x7a')](_0x39e17b[_0xe5d4('0x3f')][_0x20399d])[_0xe5d4('0x7b')];var _0x299121=JSON['parse'](_0x39e17b[_0xe5d4('0x3f')][_0x20399d])[_0xe5d4('0x7c')];_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x7d'),_0x40f8db,_0x299121);}else{if(_0x39e17b[_0xe5d4('0x3f')][_0x20399d]===_0xe5d4('0x7e')){_0x470c56[_0xe5d4('0x49')]('i.'+_0x20399d+_0xe5d4('0x7f'));}else{_0x470c56['where']('i.'+_0x20399d+_0xe5d4('0x80'),_0x39e17b['query'][_0x20399d]);}}});}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x81')]){if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x81')]==0x1){_0x470c56[_0xe5d4('0x62')](_0xe5d4('0x82'));}else{_0x470c56['having'](_0xe5d4('0x83'));}}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]){_0x50999e=_[_0xe5d4('0x85')](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')])?_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]:new Array(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]);_0x50999e[_0xe5d4('0x70')](function(_0x4288f8){_0x5b5a02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4288f8+',%');});}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x86')]){var _0x1c25a0=_0x39e17b[_0xe5d4('0x3f')]['filter'][_0xe5d4('0x87')]('\x5c','\x5c\x5c')[_0xe5d4('0x87')](/'/g,'\x27\x27');if(qs[_0xe5d4('0x88')](_0x1c25a0)){_0x110f49['or'](_0xe5d4('0x89'),_0x1c25a0+'%')['or']('i.phone\x20LIKE\x20?',_0x1c25a0+'%');}else{_0x110f49['or'](_0xe5d4('0x8a'),qs[_0xe5d4('0x69')](_0x1c25a0))['or'](_0xe5d4('0x8b'),_0x1c25a0+'%');}}}_0x470c56[_0xe5d4('0x49')](_0x110f49);_0x470c56[_0xe5d4('0x8c')](_0xe5d4('0x8d'));var _0xe931d={'type':db[_0xe5d4('0x8e')][_0xe5d4('0x8f')][_0xe5d4('0x90')],'raw':!![]};var _0x46907a=_0x470c56[_0xe5d4('0x91')]();_0x46907a[_0xe5d4('0x4a')](_0xe5d4('0x8d'));_0x46907a[_0xe5d4('0x4a')](_0xe5d4('0x92'),'unreadMessages');if(_0x2c1445[_0xe5d4('0x93')]){_0x2c1445[_0xe5d4('0x93')][_0xe5d4('0x70')](function(_0x230b3d){var _0x486be1=_0x230b3d[0x0]===_0xe5d4('0x94')?_0x230b3d[0x0]:'i.'+_0x230b3d[0x0];_0x470c56[_0xe5d4('0x93')](_0x486be1,_0x230b3d[0x1]===_0xe5d4('0x95')?![]:!![]);});}if(!_[_0xe5d4('0x77')](_0x50999e)){_0x470c56[_0xe5d4('0x62')](_0x5b5a02);_0x46907a['where'](_0xe5d4('0x96'),_0x50999e);}BPromise[_0xe5d4('0x97')]()[_0xe5d4('0x27')](function(){if(!_0x5eede3){if(_0x39e17b['query'][_0xe5d4('0x98')])return;_0x46907a[_0xe5d4('0x49')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x470c56['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x39e17b[_0xe5d4('0x99')]['role']!==_0xe5d4('0x9a'))return;return _0x39e17b[_0xe5d4('0x99')][_0xe5d4('0x9b')]({'attributes':['id'],'raw':!![]})[_0xe5d4('0x27')](function(_0x55c437){if(_[_0xe5d4('0x77')](_0x55c437)){_0x46907a[_0xe5d4('0x49')](_0xe5d4('0x9c'));_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x9c'));}else{_0x46907a['where'](_0xe5d4('0x9d'),_[_0xe5d4('0x3e')](_0x55c437,'id'));_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x9d'),_[_0xe5d4('0x3e')](_0x55c437,'id'));}});})[_0xe5d4('0x27')](function(){if(_0x39e17b['user'][_0xe5d4('0x9e')]==='agent'&&!_0x5eede3&&!_0x39e17b['query'][_0xe5d4('0x98')])return[];return db[_0xe5d4('0x9f')][_0xe5d4('0x3f')](_0x46907a['toString'](),_0xe931d);})[_0xe5d4('0x27')](function(_0x4f37b5){_0x1f9de9[_0xe5d4('0x23')]=_0x4f37b5[_0xe5d4('0x45')];if(_0x1f9de9['count']===0x0)return[];return db['sequelize'][_0xe5d4('0x3f')](_0x50e9ec[_0xe5d4('0xa0')](),_0xe931d)[_0xe5d4('0x27')](function(_0x3cbf64){_0x2df9ac=_[_0xe5d4('0xa1')](_0x3cbf64,'id');_0xe931d=_[_0xe5d4('0xa2')](_0xe931d,{'model':db[_0xe5d4('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x44')]){_0x2c1445['attributes'][_0xe5d4('0x70')](function(_0x317c57){_0x470c56[_0xe5d4('0x4a')]('i.'+_0x317c57);});}else{_0x470c56[_0xe5d4('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe5d4('0x60'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa3'),_0xe5d4('0xa4'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa5'),_0xe5d4('0xa6'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa7'),_0xe5d4('0x94'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa8'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa9'),_0xe5d4('0xaa'));_0x470c56['field']('c.lastName',_0xe5d4('0xab'));_0x470c56['field'](_0xe5d4('0xac'),_0xe5d4('0xad'));_0x470c56['field']('c.phone',_0xe5d4('0xae'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xaf'),_0xe5d4('0xb0'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb1'),_0xe5d4('0xb2'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb3'),'Owner.fullname');_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb4'),_0xe5d4('0xb5'));_0x470c56[_0xe5d4('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x2c1445[_0xe5d4('0x22')])_0x470c56[_0xe5d4('0x22')](_0x2c1445[_0xe5d4('0x22')]);if(_0x2c1445[_0xe5d4('0x20')])_0x470c56[_0xe5d4('0x20')](_0x2c1445[_0xe5d4('0x20')]);return db[_0xe5d4('0x9f')]['query'](_0x470c56[_0xe5d4('0xa0')](),_0xe931d);})[_0xe5d4('0x27')](function(_0x1fc8d9){if(_0x1fc8d9[_0xe5d4('0x45')]>0x0)_0x1fe8fc[_0xe5d4('0x49')](_0xe5d4('0xb6'),_[_0xe5d4('0x3e')](_0x1fc8d9,'id'));return db[_0xe5d4('0x9f')][_0xe5d4('0x3f')](_0x1fe8fc[_0xe5d4('0xa0')](),_0xe931d)[_0xe5d4('0x27')](function(_0x365f2f){var _0x1f742e=_['groupBy'](_0x365f2f,_0xe5d4('0xb7'));var _0x1ba7fb=[];_0x1fc8d9['forEach'](function(_0x3a5cd9){_0x1ba7fb[_0xe5d4('0xb8')](updateWhatsappInteraction(_0x3a5cd9,_0x2df9ac,_0x1f742e));});return BPromise[_0xe5d4('0xb9')](_0x1ba7fb);});});})['then'](function(_0x34b777){_0x1f9de9[_0xe5d4('0xba')]=_0x34b777;return _0x1f9de9;})[_0xe5d4('0x27')](respondWithFilteredResult(_0x1a4123,_0x2c1445))['catch'](handleError(_0x1a4123,null));};exports[_0xe5d4('0xbb')]=function(_0x227693,_0x35f8c1){var _0x4965c9={'raw':![],'where':{'id':_0x227693[_0xe5d4('0xbc')]['id']}},_0x1f9ada={};_0x1f9ada[_0xe5d4('0x3d')]=_['keys'](db[_0xe5d4('0x38')]['rawAttributes']);_0x1f9ada['query']=_[_0xe5d4('0x40')](_0x227693[_0xe5d4('0x3f')]);_0x1f9ada['filters']=_[_0xe5d4('0x43')](_0x1f9ada['model'],_0x1f9ada[_0xe5d4('0x3f')]);_0x4965c9[_0xe5d4('0x42')]=_[_0xe5d4('0x43')](_0x1f9ada[_0xe5d4('0x3d')],qs[_0xe5d4('0x44')](_0x227693[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x4965c9[_0xe5d4('0x42')]=_0x4965c9[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x4965c9[_0xe5d4('0x42')]:_0x1f9ada[_0xe5d4('0x3d')];if(_0x227693[_0xe5d4('0x3f')][_0xe5d4('0xbd')]){_0x4965c9['include']=[{'all':!![]}];}_0x4965c9=_[_0xe5d4('0xa2')]({},_0x4965c9,_0x227693['options']);return db['WhatsappInteraction']['find'](_0x4965c9)['then'](handleEntityNotFound(_0x35f8c1,null))[_0xe5d4('0x27')](respondWithResult(_0x35f8c1,null))[_0xe5d4('0x2f')](handleError(_0x35f8c1,null));};exports[_0xe5d4('0xbe')]=function(_0x391d75,_0x38e9c8){return db['WhatsappInteraction'][_0xe5d4('0xbe')](_0x391d75[_0xe5d4('0x74')],{})[_0xe5d4('0x27')](respondWithResult(_0x38e9c8,0xc9))[_0xe5d4('0x2f')](handleError(_0x38e9c8,null));};exports[_0xe5d4('0x26')]=function(_0x19895a,_0x266037){if(_0x19895a[_0xe5d4('0x74')]['id']){delete _0x19895a[_0xe5d4('0x74')]['id'];}return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x19895a[_0xe5d4('0xbc')]['id']}})['then'](handleEntityNotFound(_0x266037,null))[_0xe5d4('0x27')](saveUpdates(_0x19895a[_0xe5d4('0x74')],null))[_0xe5d4('0x27')](respondWithResult(_0x266037,null))[_0xe5d4('0x2f')](handleError(_0x266037,null));};exports[_0xe5d4('0xbf')]=function(_0x40464c,_0x2dd103){return db['WhatsappInteraction'][_0xe5d4('0x5f')]({'where':{'id':_0x40464c['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x2dd103,null))[_0xe5d4('0x27')](removeEntity(_0x2dd103,null))[_0xe5d4('0x2f')](handleError(_0x2dd103,null));};exports[_0xe5d4('0xc0')]=function(_0x5ace69,_0x2c1349){return db[_0xe5d4('0x38')][_0xe5d4('0xc0')]()[_0xe5d4('0x27')](respondWithResult(_0x2c1349,null))[_0xe5d4('0x2f')](handleError(_0x2c1349,null));};exports[_0xe5d4('0xc1')]=function(_0x4ed3c5,_0x470a15,_0x1e9175){return db[_0xe5d4('0xc2')]['find']({'where':{'id':_0x4ed3c5['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x470a15,null))[_0xe5d4('0x27')](function(_0x2795bf){if(_0x2795bf){return _0x2795bf[_0xe5d4('0xc1')](_0x4ed3c5[_0xe5d4('0x74')][_0xe5d4('0xc3')],_['omit'](_0x4ed3c5[_0xe5d4('0x74')],[_0xe5d4('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x470a15,null))['catch'](handleError(_0x470a15,null));};exports['getMessages']=function(_0x376e7,_0xe8792f,_0x52161c){var _0x2ab5b3={'raw':![],'where':{}};var _0x56afa0={};var _0x148756={'count':0x0,'rows':[]};return db[_0xe5d4('0x38')][_0xe5d4('0xc4')]({'where':{'id':_0x376e7['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0xe8792f,null))['then'](function(_0x165edc){if(_0x165edc){_0x56afa0[_0xe5d4('0x3d')]=_[_0xe5d4('0x40')](db[_0xe5d4('0xc2')][_0xe5d4('0x39')]);_0x56afa0[_0xe5d4('0x3f')]=_[_0xe5d4('0x40')](_0x376e7[_0xe5d4('0x3f')]);_0x56afa0[_0xe5d4('0x41')]=_[_0xe5d4('0x43')](_0x56afa0[_0xe5d4('0x3d')],_0x56afa0[_0xe5d4('0x3f')]);_0x2ab5b3['attributes']=_[_0xe5d4('0x43')](_0x56afa0[_0xe5d4('0x3d')],qs[_0xe5d4('0x44')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x2ab5b3[_0xe5d4('0x42')]=_0x2ab5b3[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x2ab5b3['attributes']:_0x56afa0[_0xe5d4('0x3d')];if(!_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x46')](_0xe5d4('0x47'))){_0x2ab5b3[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x22')]);_0x2ab5b3['offset']=qs['offset'](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x20')]);}_0x2ab5b3[_0xe5d4('0x93')]=qs[_0xe5d4('0x48')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x48')]);_0x2ab5b3[_0xe5d4('0x49')]=qs[_0xe5d4('0x41')](_[_0xe5d4('0xc5')](_0x376e7['query'],_0x56afa0[_0xe5d4('0x41')]));_0x2ab5b3[_0xe5d4('0x49')][_0xe5d4('0xb7')]=_0x165edc['id'];if(_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x86')]){_0x2ab5b3[_0xe5d4('0x49')]=_[_0xe5d4('0xa2')](_0x2ab5b3['where'],{'$or':_[_0xe5d4('0x3e')](_0x2ab5b3[_0xe5d4('0x42')],function(_0x17f160){var _0x179be3={};_0x179be3[_0x17f160]={'$like':'%'+_0x376e7['query'][_0xe5d4('0x86')]+'%'};return _0x179be3;})});}if(_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x7b')]){var _0x52964f=_0x376e7['query'][_0xe5d4('0x7b')][_0xe5d4('0x2e')](',');var _0xa22f5e={};_0xa22f5e[_0x52964f[0x0]]={'$gte':moment(_0x52964f[0x1])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))};_0x2ab5b3[_0xe5d4('0x49')]=_['merge'](_0x2ab5b3['where'],_0xa22f5e);}_0x2ab5b3=_[_0xe5d4('0xa2')]({},_0x2ab5b3,_0x376e7['options']);return db['WhatsappMessage'][_0xe5d4('0x23')]({'where':_0x2ab5b3['where']})['then'](function(_0x3c484a){_0x148756['count']=_0x3c484a;if(_0x376e7['query'][_0xe5d4('0xbd')]){_0x2ab5b3[_0xe5d4('0xc8')]=[{'all':!![]}];}return db[_0xe5d4('0xc2')]['findAll'](_0x2ab5b3);})[_0xe5d4('0x27')](function(_0x56d325){_0x148756[_0xe5d4('0xba')]=_0x56d325;return _0x148756;});}})[_0xe5d4('0x27')](respondWithFilteredResult(_0xe8792f,_0x2ab5b3))[_0xe5d4('0x2f')](handleError(_0xe8792f,null));};exports[_0xe5d4('0xc9')]=function(_0x1e8b66,_0xa338da,_0xb8bbee){return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x1e8b66[_0xe5d4('0xbc')]['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0xa338da,null))['then'](function(_0x54a593){if(_0x54a593){return _0x54a593['setTags'](_0x1e8b66[_0xe5d4('0x74')][_0xe5d4('0xc3')],_[_0xe5d4('0xca')](_0x1e8b66['body'],[_0xe5d4('0xc3'),'id'])||{})['spread'](function(){return db[_0xe5d4('0x6f')][_0xe5d4('0xcb')]({'attributes':['id','name',_0xe5d4('0x4b')],'where':{'id':_0x1e8b66[_0xe5d4('0x74')]['ids']}});})[_0xe5d4('0x27')](function(_0x5e2ea0){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x1e8b66[_0xe5d4('0xbc')]['id']),'tags':_0x5e2ea0||[]});return{'id':Number(_0x1e8b66[_0xe5d4('0xbc')]['id']),'tags':_0x5e2ea0||[]};});}})[_0xe5d4('0x27')](respondWithResult(_0xa338da,null))[_0xe5d4('0x2f')](handleError(_0xa338da,null));};exports['removeTags']=function(_0xb6ceb7,_0x6f13d1,_0x53ebe5){return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0xb6ceb7['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x6f13d1,null))['then'](function(_0x493757){if(_0x493757){return _0x493757['removeTags'](_0xb6ceb7['query'][_0xe5d4('0xc3')]);}})['then'](respondWithStatusCode(_0x6f13d1,null))[_0xe5d4('0x2f')](handleError(_0x6f13d1,null));};exports[_0xe5d4('0xcc')]=function(_0x37bc25,_0x418256){var _0x3c3b09=moment()['unix']()['toString']();var _0x51c93f=path[_0xe5d4('0xcd')](config[_0xe5d4('0xce')],_0xe5d4('0xcf'),_0xe5d4('0xd0'),_0xe5d4('0xd1'));var _0x1b43e2=path[_0xe5d4('0xcd')](config['root'],_0xe5d4('0xcf'),_0xe5d4('0xd0'),_0xe5d4('0xd2'));var _0x31c6d2=path[_0xe5d4('0xcd')](_0x51c93f,_0x3c3b09);var _0x1c4380=util[_0xe5d4('0xc6')](_0xe5d4('0xd3'),_0x37bc25[_0xe5d4('0xbc')]['id'],_0x3c3b09);var _0x383c12=path[_0xe5d4('0xcd')](_0x51c93f,_0x1c4380);var _0x215011=[];_0x215011[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0x72')],'as':_0xe5d4('0x72'),'attributes':['id',_0xe5d4('0xd4')],'raw':!![]});_0x215011['push']({'model':db[_0xe5d4('0xd5')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x37bc25[_0xe5d4('0x3f')][_0xe5d4('0xd2')]){_0x215011['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x57bc1a=[{'model':db['WhatsappMessage'],'as':_0xe5d4('0xd6'),'attributes':['id',_0xe5d4('0x74'),_0xe5d4('0x79'),_0xe5d4('0xd7'),_0xe5d4('0xd8'),_0xe5d4('0x81')],'include':_0x215011}];_0x57bc1a[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0xd9')],'as':_0xe5d4('0xda'),'attributes':['id',_0xe5d4('0x29')]});_0x57bc1a[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0x72')],'as':_0xe5d4('0xdb'),'attributes':['id',_0xe5d4('0xd4')]});return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x37bc25[_0xe5d4('0xbc')]['id']},'include':_0x57bc1a})['then'](handleEntityNotFound(_0x418256,null))['then'](function(_0x30c3fb){if(_0x30c3fb){var _0x54a804=_0x30c3fb[_0xe5d4('0xdc')]({'plain':!![]});fs[_0xe5d4('0xdd')](_0x31c6d2);var _0x5285a3={'channel':_0xe5d4('0xde'),'account':_0x54a804[_0xe5d4('0xda')]['name'],'agent':_0x54a804[_0xe5d4('0xdb')]?_0x54a804[_0xe5d4('0xdb')]['fullname']:_0xe5d4('0xdf'),'createdAt':moment(_0x54a804['createdAt'])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))[_0xe5d4('0xa0')](),'closedAt':_0x54a804[_0xe5d4('0x34')]?moment(_0x54a804[_0xe5d4('0xe0')])[_0xe5d4('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x54a804[_0xe5d4('0xe1')],'messages':_(_0x54a804[_0xe5d4('0xd6')])[_0xe5d4('0x86')]({'secret':![]})[_0xe5d4('0x3e')](function(_0x156956){if(_0x156956[_0xe5d4('0xe2')]){var _0x5813f8=path[_0xe5d4('0xcd')](_0x1b43e2,_0x156956[_0xe5d4('0xe2')]['basename']);if(fs[_0xe5d4('0xe3')](_0x5813f8)){fs[_0xe5d4('0xe4')](_0x5813f8)['pipe'](fs[_0xe5d4('0xe5')](path['join'](_0x31c6d2,_0x156956[_0xe5d4('0xe2')][_0xe5d4('0xe6')])));}}return{'date':moment(_0x156956[_0xe5d4('0x79')])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))['toString'](),'sender':_0x156956[_0xe5d4('0xd7')]===_0xe5d4('0xe7')?_0x156956['User']?_0x156956[_0xe5d4('0x72')][_0xe5d4('0xd4')]:_0xe5d4('0xe8'):_0x156956['Contact']['firstName']+(_0x156956[_0xe5d4('0x65')][_0xe5d4('0xe9')]?'\x20'+_0x156956['Contact'][_0xe5d4('0xe9')]:''),'body':_0x156956[_0xe5d4('0xe2')]?_0x156956[_0xe5d4('0xe2')][_0xe5d4('0xe6')]:_0x156956[_0xe5d4('0x74')],'direction':_0x156956[_0xe5d4('0xd7')]===_0xe5d4('0xe7')?'A':'C','secret':_0x156956[_0xe5d4('0xd8')],'read':_0x156956[_0xe5d4('0x81')],'attachment':_0x156956[_0xe5d4('0xe2')]};})[_0xe5d4('0x61')]()};return ejs[_0xe5d4('0xea')](path[_0xe5d4('0xcd')](config['root'],_0xe5d4('0xcf'),_0xe5d4('0xeb'),_0xe5d4('0xec')),{'interaction':_0x5285a3})['then'](function(_0x3ff451){var _0x43581d=path['join'](_0x31c6d2,_0xe5d4('0xed')+_0x54a804['id']+'-'+_0x3c3b09+_0xe5d4('0xee'));var _0xdd31d8={'path':_0x43581d,'channel':_0xe5d4('0xde'),'interactionId':_0x54a804['id']};return pdf['createPdfFromHTML'](_0x3ff451,_0xdd31d8);})['then'](function(){return new BPromise(function(_0x3c3686,_0x3f3f0a){zipdir(_0x31c6d2,{'saveTo':_0x383c12},function(_0x5544bb,_0x2f510c){if(_0x5544bb)return _0x3f3f0a(_0x5544bb);return _0x3c3686(_0x2f510c);});})['then'](function(){return new BPromise(function(_0x234476,_0x3f3cab){rimraf(_0x31c6d2,function(_0x48b244){if(_0x48b244)_0x3f3cab(_0x48b244);return _0x234476();});});})[_0xe5d4('0x27')](function(){return _0x418256['download'](_0x383c12,_0x1c4380,function(_0x534c11){if(_0x534c11){console['log']('err',_0x534c11);}else{fs[_0xe5d4('0xef')](_0x383c12);}});});});}else{return _0x418256[_0xe5d4('0x1c')](0xc8);}})[_0xe5d4('0x2f')](handleError(_0x418256,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 8deecec..e3d6bca 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 _0x69af=['hasOwnProperty','hook','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','findAll','emit','catch'];(function(_0x483b8d,_0x22b063){var _0x710db1=function(_0x582395){while(--_0x582395){_0x483b8d['push'](_0x483b8d['shift']());}};_0x710db1(++_0x22b063);}(_0x69af,0x17b));var _0xf69a=function(_0x13ee17,_0x3152c4){_0x13ee17=_0x13ee17-0x0;var _0x338119=_0x69af[_0x13ee17];return _0x338119;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xf69a('0x0'))['db'][_0xf69a('0x1')];var WhatsappMessage=require(_0xf69a('0x0'))['db'][_0xf69a('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf69a('0x3')](0x0);var events={'afterCreate':_0xf69a('0x4'),'afterUpdate':'update','afterDestroy':_0xf69a('0x5')};function emitEvent(_0x10a24a){return function(_0x297ae0,_0x2820d8,_0x723700){_0x297ae0['getUsers']({'attributes':['id'],'raw':!![]})[_0xf69a('0x6')](function(_0x3669ef){_0x297ae0[_0xf69a('0x7')]('Users',_0x3669ef['map'](function(_0x1f7f03){return{'id':_0x1f7f03['id']};}));return WhatsappMessage[_0xf69a('0x8')]({'where':{'WhatsappInteractionId':_0x297ae0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf69a('0x6')](function(_0x302b3a){_0x297ae0[_0xf69a('0x7')]('unreadMessages',_0x302b3a['length']);WhatsappInteractionEvents['emit'](_0x10a24a+':'+_0x297ae0['id'],_0x297ae0);WhatsappInteractionEvents[_0xf69a('0x9')](_0x10a24a,_0x297ae0);_0x723700(null);})[_0xf69a('0xa')](_0x723700(null));};}for(var e in events){if(events[_0xf69a('0xb')](e)){var event=events[e];WhatsappInteraction[_0xf69a('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xd64b=['map','unreadMessages','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd64b,0xc1));var _0xbd64=function(_0x2c204a,_0x119aa9){_0x2c204a=_0x2c204a-0x0;var _0xf68ab1=_0xd64b[_0x2c204a];return _0xf68ab1;};'use strict';var EventEmitter=require(_0xbd64('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xbd64('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xbd64('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbd64('0x3')](0x0);var events={'afterCreate':_0xbd64('0x4'),'afterUpdate':_0xbd64('0x5'),'afterDestroy':_0xbd64('0x6')};function emitEvent(_0x5458d8){return function(_0x5446e4,_0x54f916,_0x51e87d){_0x5446e4[_0xbd64('0x7')]({'attributes':['id'],'raw':!![]})[_0xbd64('0x8')](function(_0x3e700e){_0x5446e4[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e[_0xbd64('0xb')](function(_0x197a84){return{'id':_0x197a84['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x5446e4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x40919e){_0x5446e4[_0xbd64('0x9')](_0xbd64('0xc'),_0x40919e['length']);WhatsappInteractionEvents[_0xbd64('0xd')](_0x5458d8+':'+_0x5446e4['id'],_0x5446e4);WhatsappInteractionEvents[_0xbd64('0xd')](_0x5458d8,_0x5446e4);_0x51e87d(null);})[_0xbd64('0xe')](_0x51e87d(null));};}for(var e in events){if(events[_0xbd64('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xbd64('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7692c56..c481c4d 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 _0x4bc8=['request-promise','path','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment'];(function(_0x13f0cb,_0x575bc6){var _0x162c0d=function(_0x504745){while(--_0x504745){_0x13f0cb['push'](_0x13f0cb['shift']());}};_0x162c0d(++_0x575bc6);}(_0x4bc8,0xce));var _0x84bc=function(_0x26a93f,_0x2a57ab){_0x26a93f=_0x26a93f-0x0;var _0x425527=_0x4bc8[_0x26a93f];return _0x425527;};'use strict';var _=require(_0x84bc('0x0'));var util=require('util');var logger=require(_0x84bc('0x1'))(_0x84bc('0x2'));var moment=require(_0x84bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x84bc('0x4'));var fs=require('fs');var path=require(_0x84bc('0x5'));var rimraf=require('rimraf');var config=require(_0x84bc('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x84bc('0x7')]=function(_0x19f370,_0xd2c6b8){return _0x19f370[_0x84bc('0x8')](_0x84bc('0x9'),attributes,{'tableName':_0x84bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35d9f5,_0x528b60,_0x411f6c){if(_0x35d9f5['changed'](_0x84bc('0xb'))){_0x35d9f5['closedAt']=moment()[_0x84bc('0xc')](_0x84bc('0xd'));}_0x411f6c(null,_0x35d9f5);}}});}; \ No newline at end of file +var _0xcac5=['closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed'];(function(_0x456660,_0x4e2958){var _0x3410d9=function(_0x2066b0){while(--_0x2066b0){_0x456660['push'](_0x456660['shift']());}};_0x3410d9(++_0x4e2958);}(_0xcac5,0xb8));var _0x5cac=function(_0x49f8fd,_0x27dac7){_0x49f8fd=_0x49f8fd-0x0;var _0xda175e=_0xcac5[_0x49f8fd];return _0xda175e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5cac('0x0'))(_0x5cac('0x1'));var moment=require(_0x5cac('0x2'));var BPromise=require(_0x5cac('0x3'));var rp=require(_0x5cac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cac('0x5'));var config=require(_0x5cac('0x6'));var attributes=require(_0x5cac('0x7'));module['exports']=function(_0x4b6775,_0x2d5400){return _0x4b6775[_0x5cac('0x8')]('WhatsappInteraction',attributes,{'tableName':_0x5cac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59860c,_0x549c43,_0x58af55){if(_0x59860c[_0x5cac('0xa')](_0x5cac('0xb'))){_0x59860c[_0x5cac('0xc')]=moment()['format'](_0x5cac('0xd'));}_0x58af55(null,_0x59860c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 52a7604..fa9971d 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 _0x080a=['redis','defaults','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','find','ids','omit','spread','AddTags','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x55dfd7,_0x42d854){var _0x5ecef1=function(_0x151fe9){while(--_0x151fe9){_0x55dfd7['push'](_0x55dfd7['shift']());}};_0x5ecef1(++_0x42d854);}(_0x080a,0xd1));var _0xa080=function(_0x52bedf,_0x52f6c7){_0x52bedf=_0x52bedf-0x0;var _0x279b61=_0x080a[_0x52bedf];return _0x279b61;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa080('0x0'));var fs=require('fs');var Redis=require(_0xa080('0x1'));var db=require(_0xa080('0x2'))['db'];var utils=require(_0xa080('0x3'));var logger=require(_0xa080('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa080('0x5'));var client=jayson['client'][_0xa080('0x6')]({'port':0x232a});config[_0xa080('0x7')]=_[_0xa080('0x8')](config[_0xa080('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xa080('0x9'))(new Redis(config[_0xa080('0x7')]));require('./whatsappInteraction.socket')[_0xa080('0xa')](socket);function respondWithRpcPromise(_0x17328f,_0x1d275d,_0x273597){return new BPromise(function(_0x11d7f4,_0x5c8096){return client[_0xa080('0xb')](_0x17328f,_0x273597)[_0xa080('0xc')](function(_0x3be15d){logger[_0xa080('0xd')](_0xa080('0xe'),_0x1d275d,_0xa080('0xf'));logger[_0xa080('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1d275d,_0xa080('0xf'),JSON[_0xa080('0x11')](_0x3be15d));if(_0x3be15d[_0xa080('0x12')]){if(_0x3be15d[_0xa080('0x12')]['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x1d275d,_0x3be15d[_0xa080('0x12')][_0xa080('0x13')]);return _0x5c8096(_0x3be15d['error'][_0xa080('0x13')]);}logger[_0xa080('0x12')](_0xa080('0xe'),_0x1d275d,_0x3be15d['error'][_0xa080('0x13')]);return _0x11d7f4(_0x3be15d[_0xa080('0x12')]['message']);}else{logger['info'](_0xa080('0xe'),_0x1d275d,_0xa080('0xf'));_0x11d7f4(_0x3be15d[_0xa080('0x14')]['message']);}})[_0xa080('0x15')](function(_0x2b2491){logger[_0xa080('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d275d,_0x2b2491);_0x5c8096(_0x2b2491);});});}exports[_0xa080('0x16')]=function(_0x57f344){var _0x4ed25e=this;return new Promise(function(_0x29bd52,_0x57dd95){return db[_0xa080('0x17')][_0xa080('0x18')](_0x57f344[_0xa080('0x19')],{'raw':_0x57f344[_0xa080('0x1a')]?_0x57f344['options'][_0xa080('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57f344['options']?_0x57f344[_0xa080('0x1a')][_0xa080('0x1c')]||null:null,'attributes':_0x57f344[_0xa080('0x1a')]?_0x57f344[_0xa080('0x1a')][_0xa080('0x1d')]||null:null,'limit':_0x57f344['options']?_0x57f344[_0xa080('0x1a')][_0xa080('0x1e')]||null:null})[_0xa080('0xc')](function(_0x119320){logger[_0xa080('0xd')](_0xa080('0x16'),_0x57f344);logger[_0xa080('0x10')](_0xa080('0x16'),_0x57f344,JSON[_0xa080('0x11')](_0x119320));_0x29bd52(_0x119320);})[_0xa080('0x15')](function(_0x5c9124){logger[_0xa080('0x12')](_0xa080('0x16'),_0x5c9124[_0xa080('0x13')],_0x57f344);_0x57dd95(_0x4ed25e[_0xa080('0x12')](0x1f4,_0x5c9124[_0xa080('0x13')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3297c2){return new Promise(function(_0x270ea1,_0x467e3d){return db[_0xa080('0x17')][_0xa080('0x1f')]({'where':_0x3297c2['options']?_0x3297c2[_0xa080('0x1a')]['where']||null:null})['then'](function(_0x180604){if(_0x180604){return _0x180604['addTags'](_0x3297c2[_0xa080('0x19')][_0xa080('0x20')],_[_0xa080('0x21')](_0x3297c2[_0xa080('0x19')],[_0xa080('0x20'),'id'])||{});}})[_0xa080('0x22')](function(_0x20dd67){logger[_0xa080('0xd')]('AddTags',_0x3297c2);logger['debug'](_0xa080('0x23'),_0x3297c2,JSON[_0xa080('0x11')](_0x20dd67));_0x270ea1(_0x20dd67);})[_0xa080('0x15')](function(_0x58d26c){logger['error'](_0xa080('0x23'),_0x58d26c['message'],_0x3297c2);_0x467e3d(_this[_0xa080('0x12')](0x1f4,_0x58d26c['message']));});});}; \ No newline at end of file +var _0xab3a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','stringify','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x532272,_0x34dd2){var _0x5edcd6=function(_0x5d1951){while(--_0x5d1951){_0x532272['push'](_0x532272['shift']());}};_0x5edcd6(++_0x34dd2);}(_0xab3a,0x1d3));var _0xaab3=function(_0x5428f5,_0x363285){_0x5428f5=_0x5428f5-0x0;var _0xf745ce=_0xab3a[_0x5428f5];return _0xf745ce;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require(_0xaab3('0x6'))['db'];var utils=require(_0xaab3('0x7'));var logger=require(_0xaab3('0x8'))(_0xaab3('0x9'));var config=require(_0xaab3('0xa'));var jayson=require(_0xaab3('0xb'));var client=jayson[_0xaab3('0xc')]['http']({'port':0x232a});config['redis']=_[_0xaab3('0xd')](config[_0xaab3('0xe')],{'host':_0xaab3('0xf'),'port':0x18eb});var socket=require(_0xaab3('0x10'))(new Redis(config[_0xaab3('0xe')]));require(_0xaab3('0x11'))[_0xaab3('0x12')](socket);function respondWithRpcPromise(_0x2ee82a,_0x3595c0,_0x151330){return new BPromise(function(_0x404054,_0x54c60d){return client['request'](_0x2ee82a,_0x151330)[_0xaab3('0x13')](function(_0x45363f){logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');logger[_0xaab3('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3595c0,_0xaab3('0x17'),JSON['stringify'](_0x45363f));if(_0x45363f[_0xaab3('0x18')]){if(_0x45363f[_0xaab3('0x18')][_0xaab3('0x19')]===0x1f4){logger['error'](_0xaab3('0x15'),_0x3595c0,_0x45363f[_0xaab3('0x18')]['message']);return _0x54c60d(_0x45363f[_0xaab3('0x18')][_0xaab3('0x1a')]);}logger[_0xaab3('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x3595c0,_0x45363f['error']['message']);return _0x404054(_0x45363f['error'][_0xaab3('0x1a')]);}else{logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');_0x404054(_0x45363f[_0xaab3('0x1b')][_0xaab3('0x1a')]);}})[_0xaab3('0x1c')](function(_0x13048f){logger[_0xaab3('0x18')](_0xaab3('0x15'),_0x3595c0,_0x13048f);_0x54c60d(_0x13048f);});});}exports[_0xaab3('0x1d')]=function(_0x5a865b){var _0x1b72a5=this;return new Promise(function(_0x3bcc3b,_0x43a8d4){return db[_0xaab3('0x1e')][_0xaab3('0x1f')](_0x5a865b['body'],{'raw':_0x5a865b['options']?_0x5a865b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a865b['options']?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x21')]||null:null,'attributes':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x22')]||null:null,'limit':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x23')]||null:null})[_0xaab3('0x13')](function(_0x46e004){logger[_0xaab3('0x14')](_0xaab3('0x1d'),_0x5a865b);logger[_0xaab3('0x16')]('UpdateWhatsappInteraction',_0x5a865b,JSON[_0xaab3('0x24')](_0x46e004));_0x3bcc3b(_0x46e004);})['catch'](function(_0x28eaff){logger[_0xaab3('0x18')]('UpdateWhatsappInteraction',_0x28eaff[_0xaab3('0x1a')],_0x5a865b);_0x43a8d4(_0x1b72a5[_0xaab3('0x18')](0x1f4,_0x28eaff[_0xaab3('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4f5eec){return new Promise(function(_0x2f9833,_0x205996){return db[_0xaab3('0x1e')]['find']({'where':_0x4f5eec[_0xaab3('0x20')]?_0x4f5eec[_0xaab3('0x20')][_0xaab3('0x21')]||null:null})[_0xaab3('0x13')](function(_0x35a13d){if(_0x35a13d){return _0x35a13d[_0xaab3('0x25')](_0x4f5eec[_0xaab3('0x26')][_0xaab3('0x27')],_[_0xaab3('0x28')](_0x4f5eec[_0xaab3('0x26')],[_0xaab3('0x27'),'id'])||{});}})[_0xaab3('0x29')](function(_0xc33cb4){logger[_0xaab3('0x14')]('AddTags',_0x4f5eec);logger[_0xaab3('0x16')](_0xaab3('0x2a'),_0x4f5eec,JSON[_0xaab3('0x24')](_0xc33cb4));_0x2f9833(_0xc33cb4);})[_0xaab3('0x1c')](function(_0xc7cead){logger[_0xaab3('0x18')]('AddTags',_0xc7cead[_0xaab3('0x1a')],_0x4f5eec);_0x205996(_this['error'](0x1f4,_0xc7cead['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5b1baa6..4c30f7e 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 _0xd109=['./whatsappInteraction.events','save','remove','update','emit','register','whatsappInteraction:'];(function(_0x49121a,_0x3b56d3){var _0x156cfa=function(_0x40edfc){while(--_0x40edfc){_0x49121a['push'](_0x49121a['shift']());}};_0x156cfa(++_0x3b56d3);}(_0xd109,0x77));var _0x9d10=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd109[_0x59ee6f];return _0x4c0979;};'use strict';var WhatsappInteractionEvents=require(_0x9d10('0x0'));var events=[_0x9d10('0x1'),_0x9d10('0x2'),_0x9d10('0x3')];function createListener(_0x3ca77d,_0x2b92e8){return function(_0x3c8210){_0x2b92e8[_0x9d10('0x4')](_0x3ca77d,_0x3c8210);};}function removeListener(_0x571138,_0x1baead){return function(){WhatsappInteractionEvents['removeListener'](_0x571138,_0x1baead);};}exports[_0x9d10('0x5')]=function(_0x1b0536){for(var _0x345a67=0x0,_0x12f71b=events['length'];_0x345a67<_0x12f71b;_0x345a67++){var _0x5fa7da=events[_0x345a67];var _0x34aae1=createListener(_0x9d10('0x6')+_0x5fa7da,_0x1b0536);WhatsappInteractionEvents['on'](_0x5fa7da,_0x34aae1);}}; \ No newline at end of file +var _0x4e8d=['save','update','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x4caf03,_0x538d94){var _0x35770c=function(_0x140433){while(--_0x140433){_0x4caf03['push'](_0x4caf03['shift']());}};_0x35770c(++_0x538d94);}(_0x4e8d,0xc5));var _0xd4e8=function(_0x5815e5,_0x1e8953){_0x5815e5=_0x5815e5-0x0;var _0x2419a1=_0x4e8d[_0x5815e5];return _0x2419a1;};'use strict';var WhatsappInteractionEvents=require(_0xd4e8('0x0'));var events=[_0xd4e8('0x1'),'remove',_0xd4e8('0x2')];function createListener(_0x31bf74,_0x1441b3){return function(_0x100869){_0x1441b3['emit'](_0x31bf74,_0x100869);};}function removeListener(_0x1ce484,_0x4c5809){return function(){WhatsappInteractionEvents['removeListener'](_0x1ce484,_0x4c5809);};}exports[_0xd4e8('0x3')]=function(_0x2da97c){for(var _0x4c7dc7=0x0,_0x3fb1bd=events[_0xd4e8('0x4')];_0x4c7dc7<_0x3fb1bd;_0x4c7dc7++){var _0x2623d1=events[_0x4c7dc7];var _0xd15d0c=createListener(_0xd4e8('0x5')+_0x2623d1,_0x2da97c);WhatsappInteractionEvents['on'](_0x2623d1,_0xd15d0c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index eec9baf..c3b7e85 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 _0x70e3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout'];(function(_0x2d700c,_0x1a7b78){var _0x48224a=function(_0x30bcce){while(--_0x30bcce){_0x2d700c['push'](_0x2d700c['shift']());}};_0x48224a(++_0x1a7b78);}(_0x70e3,0xef));var _0x370e=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x70e3[_0x3fb9dd];return _0x20136a;};'use strict';var multer=require(_0x370e('0x0'));var util=require(_0x370e('0x1'));var path=require(_0x370e('0x2'));var timeout=require(_0x370e('0x3'));var express=require(_0x370e('0x4'));var router=express[_0x370e('0x5')]();var fs_extra=require(_0x370e('0x6'));var auth=require(_0x370e('0x7'));var interaction=require(_0x370e('0x8'));var config=require(_0x370e('0x9'));var controller=require('./whatsappMessage.controller');router[_0x370e('0xa')]('/',auth[_0x370e('0xb')](),controller[_0x370e('0xc')]);router[_0x370e('0xa')]('/describe',auth[_0x370e('0xb')](),controller['describe']);router[_0x370e('0xa')](_0x370e('0xd'),auth[_0x370e('0xb')](),controller['show']);router[_0x370e('0xe')]('/',auth[_0x370e('0xb')](),interaction[_0x370e('0xf')](_0x370e('0x10'),_0x370e('0x11')),controller['create']);router['post'](_0x370e('0x12'),controller[_0x370e('0x13')]);router['put'](_0x370e('0xd'),auth[_0x370e('0xb')](),controller[_0x370e('0x14')]);router[_0x370e('0x15')](_0x370e('0x16'),auth[_0x370e('0xb')](),controller['accept']);router['put'](_0x370e('0x17'),auth[_0x370e('0xb')](),controller[_0x370e('0x18')]);router[_0x370e('0x19')](_0x370e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x370e('0x1a')]=router; \ No newline at end of file +var _0xad40=['create','/:id/status','put','/:id/accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0xad40,0x116));var _0x0ad4=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xad40[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0ad4('0x0'));var util=require(_0x0ad4('0x1'));var path=require('path');var timeout=require(_0x0ad4('0x2'));var express=require(_0x0ad4('0x3'));var router=express[_0x0ad4('0x4')]();var fs_extra=require(_0x0ad4('0x5'));var auth=require(_0x0ad4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ad4('0x7'));var controller=require(_0x0ad4('0x8'));router[_0x0ad4('0x9')]('/',auth[_0x0ad4('0xa')](),controller[_0x0ad4('0xb')]);router[_0x0ad4('0x9')](_0x0ad4('0xc'),auth[_0x0ad4('0xa')](),controller[_0x0ad4('0xd')]);router[_0x0ad4('0x9')](_0x0ad4('0xe'),auth[_0x0ad4('0xa')](),controller['show']);router[_0x0ad4('0xf')]('/',auth[_0x0ad4('0xa')](),interaction[_0x0ad4('0x10')](_0x0ad4('0x11'),_0x0ad4('0x12')),controller[_0x0ad4('0x13')]);router[_0x0ad4('0xf')](_0x0ad4('0x14'),controller['status']);router[_0x0ad4('0x15')](_0x0ad4('0xe'),auth[_0x0ad4('0xa')](),controller['update']);router[_0x0ad4('0x15')](_0x0ad4('0x16'),auth[_0x0ad4('0xa')](),controller['accept']);router[_0x0ad4('0x15')](_0x0ad4('0x17'),auth[_0x0ad4('0xa')](),controller[_0x0ad4('0x18')]);router[_0x0ad4('0x19')]('/:id',auth[_0x0ad4('0xa')](),controller['destroy']);module[_0x0ad4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 952af97..d691cde 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 _0xdc11=['BOOLEAN','ENUM','out','DATE','TEXT','sequelize','exports','medium'];(function(_0x3880df,_0x15d9ce){var _0x58aba5=function(_0x5615a2){while(--_0x5615a2){_0x3880df['push'](_0x3880df['shift']());}};_0x58aba5(++_0x15d9ce);}(_0xdc11,0x1cd));var _0x1dc1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc11[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1dc1('0x0'));module[_0x1dc1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1dc1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1dc1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1dc1('0x4')]('in',_0x1dc1('0x5')),'defaultValue':_0x1dc1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1dc1('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x1dc1('0x7')]}}; \ No newline at end of file +var _0x9f13=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x9f13,0x1f4));var _0x39f1=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0x9f13[_0x49a982];return _0x2a0bc9;};'use strict';var Sequelize=require(_0x39f1('0x0'));module[_0x39f1('0x1')]={'body':{'type':Sequelize[_0x39f1('0x2')](_0x39f1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x39f1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x39f1('0x5')]('in',_0x39f1('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x39f1('0x7')](0xbe)},'phone':{'type':Sequelize[_0x39f1('0x7')]},'readAt':{'type':Sequelize[_0x39f1('0x8')]},'secret':{'type':Sequelize[_0x39f1('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x39f1('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 2e0a9d4..c7411b6 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 _0xfd80=['WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','set','Content-Range','then','destroy','name','send','index','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','WhatsappMessage','rows','catch','params','find','create','body','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','ContactId','SELECT','event','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','update'];(function(_0x279b40,_0x5a951c){var _0x2bda82=function(_0x5ee11e){while(--_0x5ee11e){_0x279b40['push'](_0x279b40['shift']());}};_0x2bda82(++_0x5a951c);}(_0xfd80,0x8a));var _0x0fd8=function(_0x863bc6,_0x5be51e){_0x863bc6=_0x863bc6-0x0;var _0x521545=_0xfd80[_0x863bc6];return _0x521545;};'use strict';var emlformat=require(_0x0fd8('0x0'));var rimraf=require(_0x0fd8('0x1'));var zipdir=require(_0x0fd8('0x2'));var jsonpatch=require(_0x0fd8('0x3'));var rp=require(_0x0fd8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0fd8('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0fd8('0x6'));var ejs=require(_0x0fd8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fd8('0x8'));var squel=require(_0x0fd8('0x9'));var crypto=require(_0x0fd8('0xa'));var jsforce=require(_0x0fd8('0xb'));var deskjs=require(_0x0fd8('0xc'));var toCsv=require(_0x0fd8('0x6'));var querystring=require(_0x0fd8('0xd'));var Papa=require(_0x0fd8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0fd8('0xf'));var as=require(_0x0fd8('0x10'));var hardwareService=require(_0x0fd8('0x11'));var logger=require(_0x0fd8('0x12'))(_0x0fd8('0x13'));var utils=require(_0x0fd8('0x14'));var config=require(_0x0fd8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fd8('0x16'))['db'];config[_0x0fd8('0x17')]=_[_0x0fd8('0x18')](config[_0x0fd8('0x17')],{'host':_0x0fd8('0x19'),'port':0x18eb});var socket=require(_0x0fd8('0x1a'))(new Redis(config[_0x0fd8('0x17')]));require('./whatsappMessage.socket')[_0x0fd8('0x1b')](socket);var jayson=require(_0x0fd8('0x1c'));var client=jayson[_0x0fd8('0x1d')][_0x0fd8('0x1e')]({'port':0x232c});var client9002=jayson[_0x0fd8('0x1d')][_0x0fd8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5e6708,_0x4a714e,_0x27025b,_0xdefba9){return new BPromise(function(_0x4c3f77,_0x360d43){var _0xe24a5=_0xdefba9||client;return _0xe24a5['request'](_0x5e6708,_0x27025b)['then'](function(_0x1c847f){logger[_0x0fd8('0x1f')](_0x0fd8('0x20'),_0x4a714e,_0x0fd8('0x21'));logger[_0x0fd8('0x22')](_0x0fd8('0x23'),_0x4a714e,_0x0fd8('0x21'),JSON[_0x0fd8('0x24')](_0x1c847f));if(_0x1c847f[_0x0fd8('0x25')]){if(_0x1c847f[_0x0fd8('0x25')][_0x0fd8('0x26')]===0x1f4){logger[_0x0fd8('0x25')](_0x0fd8('0x20'),_0x4a714e,_0x1c847f[_0x0fd8('0x25')]['message']);return _0x360d43(_0x1c847f[_0x0fd8('0x25')][_0x0fd8('0x27')]);}logger['error'](_0x0fd8('0x20'),_0x4a714e,_0x1c847f[_0x0fd8('0x25')]['message']);return _0x4c3f77(_0x1c847f[_0x0fd8('0x25')]['message']);}else{logger[_0x0fd8('0x1f')](_0x0fd8('0x20'),_0x4a714e,_0x0fd8('0x21'));_0x4c3f77(_0x1c847f[_0x0fd8('0x28')]['message']);}})['catch'](function(_0x18d968){logger[_0x0fd8('0x25')](_0x0fd8('0x20'),_0x4a714e,_0x18d968);_0x360d43(_0x18d968);});});}function respondWithStatusCode(_0x170838,_0xeb099e){_0xeb099e=_0xeb099e||0xcc;return function(_0x558b90){if(_0x558b90){return _0x170838[_0x0fd8('0x29')](_0xeb099e);}return _0x170838[_0x0fd8('0x2a')](_0xeb099e)[_0x0fd8('0x2b')]();};}function respondWithResult(_0x51ba36,_0x4b21c4){_0x4b21c4=_0x4b21c4||0xc8;return function(_0x1affc1){if(_0x1affc1){return _0x51ba36['status'](_0x4b21c4)['json'](_0x1affc1);}};}function respondWithFilteredResult(_0x4e9b58,_0x1c9940){return function(_0x4f90fe){if(_0x4f90fe){var _0x3f0afd=typeof _0x1c9940[_0x0fd8('0x2c')]===_0x0fd8('0x2d')&&typeof _0x1c9940['limit']==='undefined';var _0x5744d0=_0x4f90fe[_0x0fd8('0x2e')];var _0x1abc75=_0x3f0afd?0x0:_0x1c9940[_0x0fd8('0x2c')];var _0xae50c=_0x3f0afd?_0x4f90fe[_0x0fd8('0x2e')]:_0x1c9940[_0x0fd8('0x2c')]+_0x1c9940['limit'];var _0x5ccf45;if(_0xae50c>=_0x5744d0){_0xae50c=_0x5744d0;_0x5ccf45=0xc8;}else{_0x5ccf45=0xce;}_0x4e9b58['status'](_0x5ccf45);return _0x4e9b58[_0x0fd8('0x2f')](_0x0fd8('0x30'),_0x1abc75+'-'+_0xae50c+'/'+_0x5744d0)['json'](_0x4f90fe);}return null;};}function patchUpdates(_0x4e1a34){return function(_0x57c7e1){try{jsonpatch['apply'](_0x57c7e1,_0x4e1a34,!![]);}catch(_0x53d8e3){return BPromise['reject'](_0x53d8e3);}return _0x57c7e1['save']();};}function saveUpdates(_0x10288d,_0x5871b2){return function(_0x28a3a4){if(_0x28a3a4){return _0x28a3a4['update'](_0x10288d)[_0x0fd8('0x31')](function(_0x123329){return _0x123329;});}return null;};}function removeEntity(_0x48fbcc,_0x3c3c59){return function(_0x369eb1){if(_0x369eb1){return _0x369eb1[_0x0fd8('0x32')]()[_0x0fd8('0x31')](function(){_0x48fbcc[_0x0fd8('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x282d50,_0x4f7721){return function(_0x5c082a){if(!_0x5c082a){_0x282d50[_0x0fd8('0x29')](0x194);}return _0x5c082a;};}function handleError(_0xa60ef0,_0x247d55){_0x247d55=_0x247d55||0x1f4;return function(_0x1819e8){logger[_0x0fd8('0x25')](_0x1819e8['stack']);if(_0x1819e8[_0x0fd8('0x33')]){delete _0x1819e8[_0x0fd8('0x33')];}_0xa60ef0[_0x0fd8('0x2a')](_0x247d55)[_0x0fd8('0x34')](_0x1819e8);};}exports[_0x0fd8('0x35')]=function(_0x14bffc,_0x2afd80){var _0x2ee562={},_0x1c52a9={},_0x2d4674={'count':0x0,'rows':[]};var _0x3ea87f=_['map'](db['WhatsappMessage'][_0x0fd8('0x36')],function(_0x28ad44){return{'name':_0x28ad44[_0x0fd8('0x37')],'type':_0x28ad44[_0x0fd8('0x38')]['key']};});_0x1c52a9[_0x0fd8('0x39')]=_['map'](_0x3ea87f,_0x0fd8('0x33'));_0x1c52a9['query']=_[_0x0fd8('0x3a')](_0x14bffc[_0x0fd8('0x3b')]);_0x1c52a9['filters']=_[_0x0fd8('0x3c')](_0x1c52a9['model'],_0x1c52a9[_0x0fd8('0x3b')]);_0x2ee562[_0x0fd8('0x3d')]=_[_0x0fd8('0x3c')](_0x1c52a9[_0x0fd8('0x39')],qs['fields'](_0x14bffc[_0x0fd8('0x3b')][_0x0fd8('0x3e')]));_0x2ee562[_0x0fd8('0x3d')]=_0x2ee562['attributes'][_0x0fd8('0x3f')]?_0x2ee562['attributes']:_0x1c52a9[_0x0fd8('0x39')];if(!_0x14bffc['query']['hasOwnProperty'](_0x0fd8('0x40'))){_0x2ee562[_0x0fd8('0x41')]=qs[_0x0fd8('0x41')](_0x14bffc[_0x0fd8('0x3b')]['limit']);_0x2ee562[_0x0fd8('0x2c')]=qs[_0x0fd8('0x2c')](_0x14bffc['query'][_0x0fd8('0x2c')]);}_0x2ee562[_0x0fd8('0x42')]=qs[_0x0fd8('0x43')](_0x14bffc[_0x0fd8('0x3b')][_0x0fd8('0x43')]);_0x2ee562[_0x0fd8('0x44')]=qs[_0x0fd8('0x45')](_[_0x0fd8('0x46')](_0x14bffc[_0x0fd8('0x3b')],_0x1c52a9[_0x0fd8('0x45')]),_0x3ea87f);if(_0x14bffc[_0x0fd8('0x3b')][_0x0fd8('0x47')]){_0x2ee562['where']=_[_0x0fd8('0x48')](_0x2ee562[_0x0fd8('0x44')],{'$or':_[_0x0fd8('0x49')](_0x3ea87f,function(_0xdf5f03){if(_0xdf5f03[_0x0fd8('0x38')]!==_0x0fd8('0x4a')){var _0x37dab9={};_0x37dab9[_0xdf5f03[_0x0fd8('0x33')]]={'$like':'%'+_0x14bffc['query'][_0x0fd8('0x47')]+'%'};return _0x37dab9;}})});}_0x2ee562=_[_0x0fd8('0x48')]({},_0x2ee562,_0x14bffc[_0x0fd8('0x4b')]);var _0x520038={'where':_0x2ee562[_0x0fd8('0x44')]};return db['WhatsappMessage'][_0x0fd8('0x2e')](_0x520038)['then'](function(_0x4ff41f){_0x2d4674[_0x0fd8('0x2e')]=_0x4ff41f;if(_0x14bffc[_0x0fd8('0x3b')][_0x0fd8('0x4c')]){_0x2ee562[_0x0fd8('0x4d')]=[{'all':!![]}];}return db[_0x0fd8('0x4e')]['findAll'](_0x2ee562);})[_0x0fd8('0x31')](function(_0x3968e8){_0x2d4674[_0x0fd8('0x4f')]=_0x3968e8;return _0x2d4674;})[_0x0fd8('0x31')](respondWithFilteredResult(_0x2afd80,_0x2ee562))[_0x0fd8('0x50')](handleError(_0x2afd80,null));};exports['show']=function(_0x24e5e5,_0x4910a4){var _0x135460={'raw':!![],'where':{'id':_0x24e5e5[_0x0fd8('0x51')]['id']}},_0x58910d={};_0x58910d[_0x0fd8('0x39')]=_[_0x0fd8('0x3a')](db[_0x0fd8('0x4e')]['rawAttributes']);_0x58910d['query']=_[_0x0fd8('0x3a')](_0x24e5e5['query']);_0x58910d[_0x0fd8('0x45')]=_[_0x0fd8('0x3c')](_0x58910d[_0x0fd8('0x39')],_0x58910d['query']);_0x135460[_0x0fd8('0x3d')]=_[_0x0fd8('0x3c')](_0x58910d[_0x0fd8('0x39')],qs['fields'](_0x24e5e5[_0x0fd8('0x3b')]['fields']));_0x135460[_0x0fd8('0x3d')]=_0x135460[_0x0fd8('0x3d')][_0x0fd8('0x3f')]?_0x135460[_0x0fd8('0x3d')]:_0x58910d['model'];if(_0x24e5e5[_0x0fd8('0x3b')][_0x0fd8('0x4c')]){_0x135460[_0x0fd8('0x4d')]=[{'all':!![]}];}_0x135460=_[_0x0fd8('0x48')]({},_0x135460,_0x24e5e5[_0x0fd8('0x4b')]);return db[_0x0fd8('0x4e')][_0x0fd8('0x52')](_0x135460)['then'](handleEntityNotFound(_0x4910a4,null))[_0x0fd8('0x31')](respondWithResult(_0x4910a4,null))[_0x0fd8('0x50')](handleError(_0x4910a4,null));};exports[_0x0fd8('0x53')]=function(_0x2e0325,_0xe9cc0c){return db[_0x0fd8('0x4e')]['create'](_0x2e0325['body'],{})[_0x0fd8('0x31')](respondWithResult(_0xe9cc0c,0xc9))[_0x0fd8('0x50')](handleError(_0xe9cc0c,null));};exports['update']=function(_0x27ecbb,_0x195c8b){if(_0x27ecbb[_0x0fd8('0x54')]['id']){delete _0x27ecbb['body']['id'];}return db[_0x0fd8('0x4e')]['find']({'where':{'id':_0x27ecbb[_0x0fd8('0x51')]['id']}})[_0x0fd8('0x31')](handleEntityNotFound(_0x195c8b,null))[_0x0fd8('0x31')](saveUpdates(_0x27ecbb[_0x0fd8('0x54')],null))['then'](respondWithResult(_0x195c8b,null))[_0x0fd8('0x50')](handleError(_0x195c8b,null));};exports['destroy']=function(_0x1ddcde,_0x4c8766){return db[_0x0fd8('0x4e')]['find']({'where':{'id':_0x1ddcde[_0x0fd8('0x51')]['id']}})[_0x0fd8('0x31')](handleEntityNotFound(_0x4c8766,null))[_0x0fd8('0x31')](removeEntity(_0x4c8766,null))[_0x0fd8('0x50')](handleError(_0x4c8766,null));};exports[_0x0fd8('0x55')]=function(_0x59404e,_0xaebfd1){return db[_0x0fd8('0x4e')][_0x0fd8('0x55')]()[_0x0fd8('0x31')](respondWithResult(_0xaebfd1,null))[_0x0fd8('0x50')](handleError(_0xaebfd1,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x2511dd,_0x17ad05,_0x4e733f){var _0x407d91={'agent':{},'channel':_0x0fd8('0x56')};if(_0x2511dd[_0x0fd8('0x54')]['id']){delete _0x2511dd[_0x0fd8('0x54')]['id'];}_0x2511dd['body'][_0x0fd8('0x57')]=!![];_0x2511dd[_0x0fd8('0x54')][_0x0fd8('0x58')]=moment()[_0x0fd8('0x59')](_0x0fd8('0x5a'));_0x2511dd[_0x0fd8('0x54')][_0x0fd8('0x5b')]=_0x2511dd[_0x0fd8('0x54')][_0x0fd8('0x5b')]||_0x2511dd[_0x0fd8('0x5c')]['id'];_0x407d91[_0x0fd8('0x5d')]['id']=_0x2511dd['body'][_0x0fd8('0x5b')];return db[_0x0fd8('0x4e')][_0x0fd8('0x52')]({'where':{'id':_0x2511dd[_0x0fd8('0x51')]['id'],'UserId':null}})[_0x0fd8('0x31')](handleEntityNotFound(_0x17ad05,null))['then'](saveUpdates(_0x2511dd[_0x0fd8('0x54')],null))[_0x0fd8('0x31')](function(_0x190b3a){if(_0x190b3a){_0x407d91[_0x0fd8('0x27')]=_0x190b3a[_0x0fd8('0x5e')]({'plain':!![]});return db[_0x0fd8('0x5f')]['find']({'where':{'id':_0x190b3a[_0x0fd8('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x17ad05,null))[_0x0fd8('0x31')](function(_0x5789ff){if(_0x5789ff){return _0x5789ff['update']({'UserId':_0x2511dd[_0x0fd8('0x54')][_0x0fd8('0x5b')],'read1stAt':_[_0x0fd8('0x61')](_0x5789ff[_0x0fd8('0x62')])?moment()[_0x0fd8('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0fd8('0x31')](function(_0x287b6f){if(_0x287b6f){_0x407d91[_0x0fd8('0x63')]=_0x287b6f[_0x0fd8('0x5e')]({'plain':!![]});interaction_log['info'](_0x0fd8('0x64'),_0x2511dd[_0x0fd8('0x5c')]['id'],_0x2511dd[_0x0fd8('0x5c')]['name'],_0x2511dd[_0x0fd8('0x5c')][_0x0fd8('0x65')],_0x407d91[_0x0fd8('0x63')]['id'],_0x2511dd['body']?JSON[_0x0fd8('0x24')](_0x2511dd[_0x0fd8('0x54')]):_0x0fd8('0x66'));return respondWithRpcPromise(_0x0fd8('0x67'),_0x0fd8('0x68'),_0x407d91);}return null;})[_0x0fd8('0x31')](function(_0x21461d){var _0xb7c8b9=_0x0fd8('0x69')+_0x21461d[_0x0fd8('0x27')]['ContactId'];return db[_0x0fd8('0x6a')][_0x0fd8('0x3b')](_0xb7c8b9,{'type':db[_0x0fd8('0x6b')][_0x0fd8('0x6c')]['SELECT'],'raw':!![]})[_0x0fd8('0x31')](function(_0x4dc5e8){return _0x4dc5e8;});})[_0x0fd8('0x31')](function(_0x238e49){if(_0x238e49){_0x407d91[_0x0fd8('0x27')][_0x0fd8('0x6d')]=_0x238e49[0x0];if(!_0x2511dd[_0x0fd8('0x54')][_0x0fd8('0x5b')])return;return db[_0x0fd8('0x6e')]['find']({'where':{'id':_0x2511dd[_0x0fd8('0x54')][_0x0fd8('0x5b')],'role':'agent'},'attributes':['id',_0x0fd8('0x33'),_0x0fd8('0x6f'),_0x0fd8('0x70'),_0x0fd8('0x71')],'raw':!![]});}return null;})[_0x0fd8('0x31')](function(_0x29e98e){if(!_0x29e98e)return null;_0x407d91[_0x0fd8('0x27')][_0x0fd8('0x5d')]=_0x29e98e;return _0x407d91;})['then'](function(_0x5f0225){if(_0x5f0225){if(_0x2511dd[_0x0fd8('0x54')]['manual']){_0x407d91[_0x0fd8('0x27')][_0x0fd8('0x72')]=util[_0x0fd8('0x59')](_0x0fd8('0x73'),_0x2511dd[_0x0fd8('0x5c')][_0x0fd8('0x33')]);_0x407d91['message'][_0x0fd8('0x74')]=_0x407d91['channel'];_0x407d91[_0x0fd8('0x27')][_0x0fd8('0x75')]=_0x407d91[_0x0fd8('0x74')];_0x407d91[_0x0fd8('0x27')]['event']=_0x0fd8('0x76');return respondWithRpcPromise(_0x0fd8('0x77'),_0x0fd8('0x77'),{'event':_0x0fd8('0x78'),'message':_0x407d91[_0x0fd8('0x27')]},client9002)['then'](function(){return _0x407d91;});}return _0x407d91;}return null;})[_0x0fd8('0x31')](respondWithResult(_0x17ad05,null))[_0x0fd8('0x50')](handleError(_0x17ad05,null));};var interaction_log=require(_0x0fd8('0x12'))('whatsapp-interactions');exports[_0x0fd8('0x79')]=function(_0x44b3e1,_0x32f2cc,_0x4757e8){var _0x5f3607={'agent':{},'channel':'whatsapp'};if(_0x44b3e1[_0x0fd8('0x54')]['id']){delete _0x44b3e1[_0x0fd8('0x54')]['id'];}_0x44b3e1[_0x0fd8('0x54')][_0x0fd8('0x5b')]=_0x44b3e1[_0x0fd8('0x54')]['UserId']||_0x44b3e1[_0x0fd8('0x5c')]['id'];_0x5f3607[_0x0fd8('0x5d')]['id']=_0x44b3e1[_0x0fd8('0x54')][_0x0fd8('0x5b')];return db[_0x0fd8('0x4e')]['find']({'where':{'id':_0x44b3e1[_0x0fd8('0x51')]['id'],'UserId':null}})[_0x0fd8('0x31')](handleEntityNotFound(_0x32f2cc,null))[_0x0fd8('0x31')](function(_0x52d3c3){if(_0x52d3c3){_0x5f3607['message']=_0x52d3c3[_0x0fd8('0x5e')]({'plain':!![]});return db['WhatsappInteraction'][_0x0fd8('0x52')]({'where':{'id':_0x52d3c3[_0x0fd8('0x60')]}});}return null;})[_0x0fd8('0x31')](handleEntityNotFound(_0x32f2cc,null))[_0x0fd8('0x31')](function(_0x2162d2){if(_0x2162d2){_0x5f3607[_0x0fd8('0x63')]=_0x2162d2['get']({'plain':!![]});interaction_log[_0x0fd8('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44b3e1[_0x0fd8('0x5c')]['id'],_0x44b3e1[_0x0fd8('0x5c')][_0x0fd8('0x33')],_0x44b3e1[_0x0fd8('0x5c')][_0x0fd8('0x65')],_0x5f3607[_0x0fd8('0x63')]['id'],_0x44b3e1[_0x0fd8('0x54')]?JSON[_0x0fd8('0x24')](_0x44b3e1[_0x0fd8('0x54')]):'null');return respondWithRpcPromise(_0x0fd8('0x7a'),_0x0fd8('0x7b'),_0x5f3607);}return null;})[_0x0fd8('0x31')](function(_0x2b957c){var _0x560234=_0x0fd8('0x69')+_0x2b957c['message'][_0x0fd8('0x7c')];return db[_0x0fd8('0x6a')][_0x0fd8('0x3b')](_0x560234,{'type':db[_0x0fd8('0x6b')][_0x0fd8('0x6c')][_0x0fd8('0x7d')],'raw':!![]})['then'](function(_0x120105){return _0x120105;});})[_0x0fd8('0x31')](function(_0x2f28ac){if(_0x2f28ac){_0x5f3607[_0x0fd8('0x27')]['contact']=_0x2f28ac[0x0];if(!_0x44b3e1['body'][_0x0fd8('0x5b')])return;return db[_0x0fd8('0x6e')][_0x0fd8('0x52')]({'where':{'id':_0x44b3e1[_0x0fd8('0x54')][_0x0fd8('0x5b')],'role':_0x0fd8('0x5d')},'attributes':['id',_0x0fd8('0x33'),_0x0fd8('0x6f'),_0x0fd8('0x70'),_0x0fd8('0x71')],'raw':!![]});}return null;})['then'](function(_0x1ea138){if(!_0x1ea138)return null;_0x5f3607['message'][_0x0fd8('0x5d')]=_0x1ea138;return _0x5f3607;})['then'](function(_0xa312bc){if(_0xa312bc){_0xa312bc[_0x0fd8('0x27')][_0x0fd8('0x72')]=util['format']('SIP/%s',_0x44b3e1[_0x0fd8('0x5c')][_0x0fd8('0x33')]);_0xa312bc[_0x0fd8('0x27')][_0x0fd8('0x74')]=_0x5f3607[_0x0fd8('0x74')];_0xa312bc[_0x0fd8('0x27')]['motionChannel']=_0x5f3607[_0x0fd8('0x74')];_0xa312bc[_0x0fd8('0x27')][_0x0fd8('0x7e')]=_0x0fd8('0x79');respondWithRpcPromise(_0x0fd8('0x77'),'EventManager',{'event':'rejectmessage','message':_0xa312bc['message']},client9002);return _0x5f3607;}return null;})[_0x0fd8('0x31')](respondWithResult(_0x32f2cc,null))[_0x0fd8('0x50')](handleError(_0x32f2cc,null));};exports[_0x0fd8('0x2a')]=function(_0x1637d7,_0x556a81,_0x4ccaf4){if(_0x1637d7['body']['id']){delete _0x1637d7[_0x0fd8('0x54')]['id'];}var _0xaa778d;return db[_0x0fd8('0x4e')][_0x0fd8('0x52')]({'where':{'id':_0x1637d7[_0x0fd8('0x51')]['id']}})[_0x0fd8('0x31')](handleEntityNotFound(_0x556a81,null))[_0x0fd8('0x31')](function(_0x422699){if(_0x422699){_0xaa778d=_0x422699;return db[_0x0fd8('0x7f')]['find']({'where':{'id':_0x422699['WhatsappAccountId']}});}})[_0x0fd8('0x31')](handleEntityNotFound(_0x556a81,null))[_0x0fd8('0x31')](function(_0x15dd88){if(_0x15dd88){logger[_0x0fd8('0x22')](_0x0fd8('0x80'),_0x0fd8('0x2a'),_0x0fd8('0x81'),_0x15dd88[_0x0fd8('0x38')],util['inspect'](_0x1637d7['body'],{'showHidden':![],'depth':null}));switch(_0x15dd88[_0x0fd8('0x38')]){case _0x0fd8('0x82'):if(_0x1637d7[_0x0fd8('0x54')][_0x0fd8('0x83')]&&_0x1637d7[_0x0fd8('0x54')][_0x0fd8('0x83')]===_0xaa778d[_0x0fd8('0x84')]&&_0x1637d7['body']['MessageStatus']&&_0x1637d7[_0x0fd8('0x54')]['MessageStatus']===_0x0fd8('0x57')){return _0xaa778d[_0x0fd8('0x85')]({'read':!![]});}else{logger[_0x0fd8('0x25')](_0x0fd8('0x86'),_0x0fd8('0x2a'),_0x0fd8('0x82'),util[_0x0fd8('0x87')](_0x1637d7[_0x0fd8('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xaa778d;}})[_0x0fd8('0x31')](respondWithResult(_0x556a81,null))[_0x0fd8('0x50')](handleError(_0x556a81,null));}; \ No newline at end of file +var _0x1374=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','motionChannel','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','json','offset','undefined','limit','count','status','reject','save','update','destroy','end','stack','send','index','map','WhatsappMessage','rawAttributes','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','catch','show','params','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','isNil','read1stAt','interaction','get','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x40d14d,_0xda4f2){var _0x24c0e3=function(_0x20bf57){while(--_0x20bf57){_0x40d14d['push'](_0x40d14d['shift']());}};_0x24c0e3(++_0xda4f2);}(_0x1374,0x1c0));var _0x4137=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1374[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x4137('0x0'));var rimraf=require(_0x4137('0x1'));var zipdir=require(_0x4137('0x2'));var jsonpatch=require(_0x4137('0x3'));var rp=require(_0x4137('0x4'));var moment=require(_0x4137('0x5'));var BPromise=require(_0x4137('0x6'));var Mustache=require(_0x4137('0x7'));var util=require(_0x4137('0x8'));var path=require(_0x4137('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4137('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4137('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4137('0xc'));var deskjs=require(_0x4137('0xd'));var toCsv=require(_0x4137('0xe'));var querystring=require(_0x4137('0xf'));var Papa=require('papaparse');var Redis=require(_0x4137('0x10'));var authService=require(_0x4137('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4137('0x12'));var hardwareService=require(_0x4137('0x13'));var logger=require(_0x4137('0x14'))(_0x4137('0x15'));var utils=require(_0x4137('0x16'));var config=require(_0x4137('0x17'));var licenseUtil=require(_0x4137('0x18'));var db=require(_0x4137('0x19'))['db'];config['redis']=_[_0x4137('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4137('0x1b'))(new Redis(config[_0x4137('0x1c')]));require(_0x4137('0x1d'))[_0x4137('0x1e')](socket);var jayson=require(_0x4137('0x1f'));var client=jayson[_0x4137('0x20')][_0x4137('0x21')]({'port':0x232c});var client9002=jayson[_0x4137('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1c02,_0x25ad5e,_0x2efe88,_0x2b0489){return new BPromise(function(_0x19df98,_0x2d8831){var _0x3b7400=_0x2b0489||client;return _0x3b7400[_0x4137('0x22')](_0x1a1c02,_0x2efe88)[_0x4137('0x23')](function(_0x354749){logger['info'](_0x4137('0x24'),_0x25ad5e,_0x4137('0x25'));logger['debug'](_0x4137('0x26'),_0x25ad5e,_0x4137('0x25'),JSON[_0x4137('0x27')](_0x354749));if(_0x354749[_0x4137('0x28')]){if(_0x354749[_0x4137('0x28')][_0x4137('0x29')]===0x1f4){logger['error'](_0x4137('0x24'),_0x25ad5e,_0x354749[_0x4137('0x28')][_0x4137('0x2a')]);return _0x2d8831(_0x354749[_0x4137('0x28')][_0x4137('0x2a')]);}logger[_0x4137('0x28')](_0x4137('0x24'),_0x25ad5e,_0x354749['error'][_0x4137('0x2a')]);return _0x19df98(_0x354749[_0x4137('0x28')][_0x4137('0x2a')]);}else{logger['info'](_0x4137('0x24'),_0x25ad5e,'request\x20sent');_0x19df98(_0x354749[_0x4137('0x2b')]['message']);}})['catch'](function(_0x28c963){logger['error'](_0x4137('0x24'),_0x25ad5e,_0x28c963);_0x2d8831(_0x28c963);});});}function respondWithStatusCode(_0x53bcd0,_0x50559f){_0x50559f=_0x50559f||0xcc;return function(_0x1e7c4d){if(_0x1e7c4d){return _0x53bcd0[_0x4137('0x2c')](_0x50559f);}return _0x53bcd0['status'](_0x50559f)['end']();};}function respondWithResult(_0x4fa4b5,_0x364164){_0x364164=_0x364164||0xc8;return function(_0x2b38a2){if(_0x2b38a2){return _0x4fa4b5['status'](_0x364164)[_0x4137('0x2d')](_0x2b38a2);}};}function respondWithFilteredResult(_0x1512a7,_0x10c131){return function(_0x4abfbf){if(_0x4abfbf){var _0x275055=typeof _0x10c131[_0x4137('0x2e')]===_0x4137('0x2f')&&typeof _0x10c131[_0x4137('0x30')]==='undefined';var _0x54ef21=_0x4abfbf[_0x4137('0x31')];var _0x82b21c=_0x275055?0x0:_0x10c131[_0x4137('0x2e')];var _0x19fe68=_0x275055?_0x4abfbf[_0x4137('0x31')]:_0x10c131['offset']+_0x10c131['limit'];var _0x34ea71;if(_0x19fe68>=_0x54ef21){_0x19fe68=_0x54ef21;_0x34ea71=0xc8;}else{_0x34ea71=0xce;}_0x1512a7[_0x4137('0x32')](_0x34ea71);return _0x1512a7['set']('Content-Range',_0x82b21c+'-'+_0x19fe68+'/'+_0x54ef21)[_0x4137('0x2d')](_0x4abfbf);}return null;};}function patchUpdates(_0x1b75d9){return function(_0x28c976){try{jsonpatch['apply'](_0x28c976,_0x1b75d9,!![]);}catch(_0x174b26){return BPromise[_0x4137('0x33')](_0x174b26);}return _0x28c976[_0x4137('0x34')]();};}function saveUpdates(_0x46e618,_0x309f5f){return function(_0x1464b0){if(_0x1464b0){return _0x1464b0[_0x4137('0x35')](_0x46e618)[_0x4137('0x23')](function(_0x28c167){return _0x28c167;});}return null;};}function removeEntity(_0x4edbf6,_0x54573d){return function(_0x3113c1){if(_0x3113c1){return _0x3113c1[_0x4137('0x36')]()['then'](function(){_0x4edbf6[_0x4137('0x32')](0xcc)[_0x4137('0x37')]();});}};}function handleEntityNotFound(_0x20ee54,_0x4b8694){return function(_0x8f3f9c){if(!_0x8f3f9c){_0x20ee54[_0x4137('0x2c')](0x194);}return _0x8f3f9c;};}function handleError(_0x3e65e4,_0x422f0a){_0x422f0a=_0x422f0a||0x1f4;return function(_0x26ad82){logger[_0x4137('0x28')](_0x26ad82[_0x4137('0x38')]);if(_0x26ad82['name']){delete _0x26ad82['name'];}_0x3e65e4[_0x4137('0x32')](_0x422f0a)[_0x4137('0x39')](_0x26ad82);};}exports[_0x4137('0x3a')]=function(_0x4cce85,_0x328eaf){var _0x476fbe={},_0x3caf12={},_0xc76623={'count':0x0,'rows':[]};var _0x32c812=_[_0x4137('0x3b')](db[_0x4137('0x3c')][_0x4137('0x3d')],function(_0x2847d8){return{'name':_0x2847d8['fieldName'],'type':_0x2847d8[_0x4137('0x3e')][_0x4137('0x3f')]};});_0x3caf12['model']=_[_0x4137('0x3b')](_0x32c812,_0x4137('0x40'));_0x3caf12['query']=_[_0x4137('0x41')](_0x4cce85[_0x4137('0x42')]);_0x3caf12[_0x4137('0x43')]=_[_0x4137('0x44')](_0x3caf12[_0x4137('0x45')],_0x3caf12[_0x4137('0x42')]);_0x476fbe[_0x4137('0x46')]=_[_0x4137('0x44')](_0x3caf12['model'],qs[_0x4137('0x47')](_0x4cce85[_0x4137('0x42')][_0x4137('0x47')]));_0x476fbe['attributes']=_0x476fbe[_0x4137('0x46')][_0x4137('0x48')]?_0x476fbe['attributes']:_0x3caf12['model'];if(!_0x4cce85[_0x4137('0x42')][_0x4137('0x49')](_0x4137('0x4a'))){_0x476fbe[_0x4137('0x30')]=qs[_0x4137('0x30')](_0x4cce85[_0x4137('0x42')][_0x4137('0x30')]);_0x476fbe[_0x4137('0x2e')]=qs[_0x4137('0x2e')](_0x4cce85[_0x4137('0x42')][_0x4137('0x2e')]);}_0x476fbe[_0x4137('0x4b')]=qs[_0x4137('0x4c')](_0x4cce85[_0x4137('0x42')][_0x4137('0x4c')]);_0x476fbe['where']=qs[_0x4137('0x43')](_[_0x4137('0x4d')](_0x4cce85[_0x4137('0x42')],_0x3caf12[_0x4137('0x43')]),_0x32c812);if(_0x4cce85[_0x4137('0x42')][_0x4137('0x4e')]){_0x476fbe['where']=_['merge'](_0x476fbe['where'],{'$or':_['map'](_0x32c812,function(_0xdd3a9b){if(_0xdd3a9b['type']!==_0x4137('0x4f')){var _0x337f21={};_0x337f21[_0xdd3a9b[_0x4137('0x40')]]={'$like':'%'+_0x4cce85[_0x4137('0x42')][_0x4137('0x4e')]+'%'};return _0x337f21;}})});}_0x476fbe=_[_0x4137('0x50')]({},_0x476fbe,_0x4cce85[_0x4137('0x51')]);var _0xb4662f={'where':_0x476fbe[_0x4137('0x52')]};return db[_0x4137('0x3c')]['count'](_0xb4662f)[_0x4137('0x23')](function(_0x521a3d){_0xc76623[_0x4137('0x31')]=_0x521a3d;if(_0x4cce85[_0x4137('0x42')][_0x4137('0x53')]){_0x476fbe[_0x4137('0x54')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4137('0x55')](_0x476fbe);})[_0x4137('0x23')](function(_0xe2df3d){_0xc76623['rows']=_0xe2df3d;return _0xc76623;})['then'](respondWithFilteredResult(_0x328eaf,_0x476fbe))[_0x4137('0x56')](handleError(_0x328eaf,null));};exports[_0x4137('0x57')]=function(_0x3ea10d,_0x41d170){var _0x41d5a7={'raw':!![],'where':{'id':_0x3ea10d[_0x4137('0x58')]['id']}},_0x3a20e1={};_0x3a20e1['model']=_['keys'](db[_0x4137('0x3c')][_0x4137('0x3d')]);_0x3a20e1['query']=_['keys'](_0x3ea10d[_0x4137('0x42')]);_0x3a20e1[_0x4137('0x43')]=_[_0x4137('0x44')](_0x3a20e1[_0x4137('0x45')],_0x3a20e1[_0x4137('0x42')]);_0x41d5a7['attributes']=_['intersection'](_0x3a20e1['model'],qs['fields'](_0x3ea10d[_0x4137('0x42')][_0x4137('0x47')]));_0x41d5a7[_0x4137('0x46')]=_0x41d5a7[_0x4137('0x46')][_0x4137('0x48')]?_0x41d5a7['attributes']:_0x3a20e1[_0x4137('0x45')];if(_0x3ea10d[_0x4137('0x42')][_0x4137('0x53')]){_0x41d5a7[_0x4137('0x54')]=[{'all':!![]}];}_0x41d5a7=_[_0x4137('0x50')]({},_0x41d5a7,_0x3ea10d[_0x4137('0x51')]);return db[_0x4137('0x3c')]['find'](_0x41d5a7)['then'](handleEntityNotFound(_0x41d170,null))['then'](respondWithResult(_0x41d170,null))['catch'](handleError(_0x41d170,null));};exports[_0x4137('0x59')]=function(_0x1a182c,_0x24e988){return db[_0x4137('0x3c')]['create'](_0x1a182c[_0x4137('0x5a')],{})['then'](respondWithResult(_0x24e988,0xc9))[_0x4137('0x56')](handleError(_0x24e988,null));};exports['update']=function(_0xaa0868,_0x2fe975){if(_0xaa0868[_0x4137('0x5a')]['id']){delete _0xaa0868[_0x4137('0x5a')]['id'];}return db['WhatsappMessage'][_0x4137('0x5b')]({'where':{'id':_0xaa0868['params']['id']}})['then'](handleEntityNotFound(_0x2fe975,null))[_0x4137('0x23')](saveUpdates(_0xaa0868['body'],null))['then'](respondWithResult(_0x2fe975,null))[_0x4137('0x56')](handleError(_0x2fe975,null));};exports[_0x4137('0x36')]=function(_0xbef9e1,_0x4ef821){return db[_0x4137('0x3c')][_0x4137('0x5b')]({'where':{'id':_0xbef9e1[_0x4137('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ef821,null))[_0x4137('0x23')](removeEntity(_0x4ef821,null))[_0x4137('0x56')](handleError(_0x4ef821,null));};exports[_0x4137('0x5c')]=function(_0x2d882a,_0x4163a2){return db['WhatsappMessage'][_0x4137('0x5c')]()[_0x4137('0x23')](respondWithResult(_0x4163a2,null))['catch'](handleError(_0x4163a2,null));};var interaction_log=require(_0x4137('0x14'))(_0x4137('0x5d'));exports[_0x4137('0x5e')]=function(_0x19ad2c,_0x4c1079,_0x14465d){var _0x313fcb={'agent':{},'channel':_0x4137('0x5f')};if(_0x19ad2c[_0x4137('0x5a')]['id']){delete _0x19ad2c[_0x4137('0x5a')]['id'];}_0x19ad2c[_0x4137('0x5a')][_0x4137('0x60')]=!![];_0x19ad2c[_0x4137('0x5a')][_0x4137('0x61')]=moment()[_0x4137('0x62')](_0x4137('0x63'));_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')]=_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')]||_0x19ad2c[_0x4137('0x65')]['id'];_0x313fcb[_0x4137('0x66')]['id']=_0x19ad2c[_0x4137('0x5a')]['UserId'];return db[_0x4137('0x3c')][_0x4137('0x5b')]({'where':{'id':_0x19ad2c[_0x4137('0x58')]['id'],'UserId':null}})[_0x4137('0x23')](handleEntityNotFound(_0x4c1079,null))[_0x4137('0x23')](saveUpdates(_0x19ad2c[_0x4137('0x5a')],null))[_0x4137('0x23')](function(_0x534596){if(_0x534596){_0x313fcb[_0x4137('0x2a')]=_0x534596['get']({'plain':!![]});return db[_0x4137('0x67')][_0x4137('0x5b')]({'where':{'id':_0x534596['WhatsappInteractionId']}});}return null;})[_0x4137('0x23')](handleEntityNotFound(_0x4c1079,null))['then'](function(_0x18e37a){if(_0x18e37a){return _0x18e37a[_0x4137('0x35')]({'UserId':_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')],'read1stAt':_[_0x4137('0x68')](_0x18e37a[_0x4137('0x69')])?moment()[_0x4137('0x62')](_0x4137('0x63')):undefined});}return null;})['then'](function(_0x3ad771){if(_0x3ad771){_0x313fcb[_0x4137('0x6a')]=_0x3ad771[_0x4137('0x6b')]({'plain':!![]});interaction_log[_0x4137('0x6c')](_0x4137('0x6d'),_0x19ad2c['user']['id'],_0x19ad2c['user']['name'],_0x19ad2c[_0x4137('0x65')][_0x4137('0x6e')],_0x313fcb[_0x4137('0x6a')]['id'],_0x19ad2c[_0x4137('0x5a')]?JSON[_0x4137('0x27')](_0x19ad2c['body']):_0x4137('0x6f'));return respondWithRpcPromise(_0x4137('0x70'),'acceptMessage',_0x313fcb);}return null;})['then'](function(_0x34038d){var _0x1f3ad2=_0x4137('0x71')+_0x34038d[_0x4137('0x2a')]['ContactId'];return db[_0x4137('0x72')]['query'](_0x1f3ad2,{'type':db[_0x4137('0x73')][_0x4137('0x74')][_0x4137('0x75')],'raw':!![]})[_0x4137('0x23')](function(_0x1363eb){return _0x1363eb;});})['then'](function(_0x23ffb4){if(_0x23ffb4){_0x313fcb[_0x4137('0x2a')]['contact']=_0x23ffb4[0x0];if(!_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')])return;return db[_0x4137('0x76')][_0x4137('0x5b')]({'where':{'id':_0x19ad2c[_0x4137('0x5a')][_0x4137('0x64')],'role':_0x4137('0x66')},'attributes':['id',_0x4137('0x40'),_0x4137('0x77'),'email',_0x4137('0x78')],'raw':!![]});}return null;})[_0x4137('0x23')](function(_0x2e16b5){if(!_0x2e16b5)return null;_0x313fcb[_0x4137('0x2a')]['agent']=_0x2e16b5;return _0x313fcb;})[_0x4137('0x23')](function(_0x5792c2){if(_0x5792c2){if(_0x19ad2c[_0x4137('0x5a')]['manual']){_0x313fcb[_0x4137('0x2a')][_0x4137('0x79')]=util[_0x4137('0x62')](_0x4137('0x7a'),_0x19ad2c[_0x4137('0x65')][_0x4137('0x40')]);_0x313fcb[_0x4137('0x2a')]['channel']=_0x313fcb[_0x4137('0x7b')];_0x313fcb[_0x4137('0x2a')]['motionChannel']=_0x313fcb[_0x4137('0x7b')];_0x313fcb[_0x4137('0x2a')][_0x4137('0x7c')]='accept';return respondWithRpcPromise(_0x4137('0x7d'),_0x4137('0x7d'),{'event':'acceptmessage','message':_0x313fcb[_0x4137('0x2a')]},client9002)[_0x4137('0x23')](function(){return _0x313fcb;});}return _0x313fcb;}return null;})[_0x4137('0x23')](respondWithResult(_0x4c1079,null))[_0x4137('0x56')](handleError(_0x4c1079,null));};var interaction_log=require(_0x4137('0x14'))(_0x4137('0x5d'));exports['reject']=function(_0x511e96,_0x4d34ab,_0x169268){var _0x83c80e={'agent':{},'channel':_0x4137('0x5f')};if(_0x511e96[_0x4137('0x5a')]['id']){delete _0x511e96[_0x4137('0x5a')]['id'];}_0x511e96[_0x4137('0x5a')]['UserId']=_0x511e96['body'][_0x4137('0x64')]||_0x511e96['user']['id'];_0x83c80e[_0x4137('0x66')]['id']=_0x511e96[_0x4137('0x5a')][_0x4137('0x64')];return db['WhatsappMessage']['find']({'where':{'id':_0x511e96['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d34ab,null))[_0x4137('0x23')](function(_0x18932a){if(_0x18932a){_0x83c80e['message']=_0x18932a[_0x4137('0x6b')]({'plain':!![]});return db[_0x4137('0x67')][_0x4137('0x5b')]({'where':{'id':_0x18932a['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4d34ab,null))['then'](function(_0x52f6a8){if(_0x52f6a8){_0x83c80e[_0x4137('0x6a')]=_0x52f6a8['get']({'plain':!![]});interaction_log[_0x4137('0x6c')](_0x4137('0x7e'),_0x511e96[_0x4137('0x65')]['id'],_0x511e96[_0x4137('0x65')][_0x4137('0x40')],_0x511e96[_0x4137('0x65')][_0x4137('0x6e')],_0x83c80e['interaction']['id'],_0x511e96[_0x4137('0x5a')]?JSON[_0x4137('0x27')](_0x511e96[_0x4137('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0x4137('0x7f'),_0x83c80e);}return null;})[_0x4137('0x23')](function(_0x407693){var _0x2344ba=_0x4137('0x71')+_0x407693[_0x4137('0x2a')]['ContactId'];return db[_0x4137('0x72')][_0x4137('0x42')](_0x2344ba,{'type':db[_0x4137('0x73')][_0x4137('0x74')][_0x4137('0x75')],'raw':!![]})['then'](function(_0x3027a2){return _0x3027a2;});})['then'](function(_0x1ab75a){if(_0x1ab75a){_0x83c80e[_0x4137('0x2a')][_0x4137('0x80')]=_0x1ab75a[0x0];if(!_0x511e96[_0x4137('0x5a')][_0x4137('0x64')])return;return db[_0x4137('0x76')][_0x4137('0x5b')]({'where':{'id':_0x511e96[_0x4137('0x5a')][_0x4137('0x64')],'role':_0x4137('0x66')},'attributes':['id',_0x4137('0x40'),_0x4137('0x77'),'email',_0x4137('0x78')],'raw':!![]});}return null;})[_0x4137('0x23')](function(_0x298e7d){if(!_0x298e7d)return null;_0x83c80e[_0x4137('0x2a')][_0x4137('0x66')]=_0x298e7d;return _0x83c80e;})['then'](function(_0x5f5b6e){if(_0x5f5b6e){_0x5f5b6e[_0x4137('0x2a')][_0x4137('0x79')]=util[_0x4137('0x62')]('SIP/%s',_0x511e96['user'][_0x4137('0x40')]);_0x5f5b6e[_0x4137('0x2a')][_0x4137('0x7b')]=_0x83c80e[_0x4137('0x7b')];_0x5f5b6e['message'][_0x4137('0x81')]=_0x83c80e[_0x4137('0x7b')];_0x5f5b6e[_0x4137('0x2a')][_0x4137('0x7c')]=_0x4137('0x33');respondWithRpcPromise(_0x4137('0x7d'),'EventManager',{'event':'rejectmessage','message':_0x5f5b6e[_0x4137('0x2a')]},client9002);return _0x83c80e;}return null;})[_0x4137('0x23')](respondWithResult(_0x4d34ab,null))['catch'](handleError(_0x4d34ab,null));};exports['status']=function(_0x246bcf,_0x1e6b35,_0xb37bc3){if(_0x246bcf['body']['id']){delete _0x246bcf[_0x4137('0x5a')]['id'];}var _0xa2f3fd;return db[_0x4137('0x3c')][_0x4137('0x5b')]({'where':{'id':_0x246bcf[_0x4137('0x58')]['id']}})[_0x4137('0x23')](handleEntityNotFound(_0x1e6b35,null))[_0x4137('0x23')](function(_0x1aaab4){if(_0x1aaab4){_0xa2f3fd=_0x1aaab4;return db['WhatsappAccount']['find']({'where':{'id':_0x1aaab4[_0x4137('0x82')]}});}})[_0x4137('0x23')](handleEntityNotFound(_0x1e6b35,null))[_0x4137('0x23')](function(_0x5e6417){if(_0x5e6417){logger[_0x4137('0x83')](_0x4137('0x84'),_0x4137('0x32'),_0x4137('0x85'),_0x5e6417['type'],util[_0x4137('0x86')](_0x246bcf[_0x4137('0x5a')],{'showHidden':![],'depth':null}));switch(_0x5e6417[_0x4137('0x3e')]){case _0x4137('0x87'):if(_0x246bcf[_0x4137('0x5a')]['MessageSid']&&_0x246bcf[_0x4137('0x5a')][_0x4137('0x88')]===_0xa2f3fd[_0x4137('0x89')]&&_0x246bcf[_0x4137('0x5a')]['MessageStatus']&&_0x246bcf[_0x4137('0x5a')][_0x4137('0x8a')]===_0x4137('0x60')){return _0xa2f3fd[_0x4137('0x35')]({'read':!![]});}else{logger[_0x4137('0x28')](_0x4137('0x8b'),_0x4137('0x32'),'twilio',util['inspect'](_0x246bcf[_0x4137('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xa2f3fd;}})[_0x4137('0x23')](respondWithResult(_0x1e6b35,null))[_0x4137('0x56')](handleError(_0x1e6b35,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 15d5803..ae54c9c 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 _0x57f8=['emit','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0xf5d6ca,_0x48e975){var _0x3464b1=function(_0x1e637e){while(--_0x1e637e){_0xf5d6ca['push'](_0xf5d6ca['shift']());}};_0x3464b1(++_0x48e975);}(_0x57f8,0x198));var _0x857f=function(_0x627b1b,_0x462114){_0x627b1b=_0x627b1b-0x0;var _0x2fd022=_0x57f8[_0x627b1b];return _0x2fd022;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x857f('0x0'))['db'][_0x857f('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x857f('0x2')](0x0);var events={'afterCreate':_0x857f('0x3'),'afterUpdate':_0x857f('0x4'),'afterDestroy':_0x857f('0x5')};function emitEvent(_0x2ff336){return function(_0x6f054b,_0x318050,_0xced48e){WhatsappMessageEvents[_0x857f('0x6')](_0x2ff336+':'+_0x6f054b['id'],_0x6f054b);WhatsappMessageEvents[_0x857f('0x6')](_0x2ff336,_0x6f054b);_0xced48e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x857f('0x7')](e,emitEvent(event));}}module[_0x857f('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8b29=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x1de6db,_0x1ee364){var _0x17f999=function(_0x4319ba){while(--_0x4319ba){_0x1de6db['push'](_0x1de6db['shift']());}};_0x17f999(++_0x1ee364);}(_0x8b29,0xbe));var _0x98b2=function(_0x4d5a65,_0x18b370){_0x4d5a65=_0x4d5a65-0x0;var _0x352d2d=_0x8b29[_0x4d5a65];return _0x352d2d;};'use strict';var EventEmitter=require(_0x98b2('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x98b2('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x98b2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x98b2('0x3')};function emitEvent(_0x20afa9){return function(_0x5bf7df,_0x209616,_0x5da9ce){WhatsappMessageEvents[_0x98b2('0x4')](_0x20afa9+':'+_0x5bf7df['id'],_0x5bf7df);WhatsappMessageEvents[_0x98b2('0x4')](_0x20afa9,_0x5bf7df);_0x5da9ce(null);};}for(var e in events){if(events[_0x98b2('0x5')](e)){var event=events[e];WhatsappMessage[_0x98b2('0x6')](e,emitEvent(event));}}module[_0x98b2('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index b8ef1b0..8536453 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 _0xfdff=['rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','direction','WhatsappAccount','WhatsappAccountId','type','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','node-fetch'];(function(_0x5d95a9,_0x577af9){var _0x288c77=function(_0x2be360){while(--_0x2be360){_0x5d95a9['push'](_0x5d95a9['shift']());}};_0x288c77(++_0x577af9);}(_0xfdff,0x1da));var _0xffdf=function(_0x2a7dcb,_0x178f36){_0x2a7dcb=_0x2a7dcb-0x0;var _0x23d900=_0xfdff[_0x2a7dcb];return _0x23d900;};'use strict';var _=require(_0xffdf('0x0'));var util=require(_0xffdf('0x1'));var logger=require(_0xffdf('0x2'))(_0xffdf('0x3'));var moment=require('moment');var BPromise=require(_0xffdf('0x4'));var rp=require('request-promise');var fetch=require(_0xffdf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffdf('0x6'));var config=require(_0xffdf('0x7'));var attributes=require(_0xffdf('0x8'));module[_0xffdf('0x9')]=function(_0x877cd3,_0x5ae8c4){return _0x877cd3[_0xffdf('0xa')](_0xffdf('0xb'),attributes,{'tableName':_0xffdf('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xffdf('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0xffdf('0xe')],'type':_0xffdf('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11d50c,_0x341166,_0x2248ce){var _0x133f33=_0x877cd3[_0xffdf('0x10')];var _0x208794=_0x11d50c[_0xffdf('0x11')]({'plain':!![]});if(_0x208794['direction'][_0xffdf('0x12')]()==='in'||_0x208794['direction'][_0xffdf('0x12')]()===_0xffdf('0x13')&&!_0x208794[_0xffdf('0x14')]&&!_[_0xffdf('0x15')](_0x208794[_0xffdf('0x16')])){_0x133f33[_0xffdf('0x17')][_0xffdf('0x18')]({'where':{'id':_0x208794[_0xffdf('0x19')]}})[_0xffdf('0x1a')](function(_0x1c2c55){if(_0x1c2c55){_0x1c2c55['update']({'lastMsgAt':_0x208794[_0xffdf('0x1b')],'lastMsgDirection':_0x208794['direction'][_0xffdf('0x12')]()});}})[_0xffdf('0x1c')](function(_0x29049e){console[_0xffdf('0x1d')](_0x29049e);});}if(_0x208794[_0xffdf('0x1e')]===_0xffdf('0x13')&&!_0x208794[_0xffdf('0x14')]){var _0x351b78;_0x133f33[_0xffdf('0x1f')]['find']({'where':{'id':_0x208794[_0xffdf('0x20')]},'raw':!![]})[_0xffdf('0x1a')](function(_0x3ea3a1){_0x351b78=_0x3ea3a1;if(_0x351b78&&_0x351b78[_0xffdf('0x21')]){switch(_0x351b78[_0xffdf('0x21')]){case'twilio':var _0x4a4781=require('twilio');if(_0x351b78['accountSid']&&_0x351b78[_0xffdf('0x22')]&&_0x351b78[_0xffdf('0x23')]){var _0x34404d=new _0x4a4781(_0x351b78['accountSid'],_0x351b78[_0xffdf('0x22')]);_0x34404d[_0xffdf('0x24')][_0xffdf('0x25')]({'body':_0x208794['body'],'to':_0xffdf('0x26')+_0x208794[_0xffdf('0x23')],'from':_0xffdf('0x26')+_0x351b78[_0xffdf('0x23')],'statusCallback':_0x351b78[_0xffdf('0x27')]+_0xffdf('0x28')+_0x208794['id']+_0xffdf('0x29')+_0x351b78['token']})['then'](function(_0x8bab82){if(_0x8bab82['sid']){return _0x11d50c[_0xffdf('0x2a')]({'messageId':_0x8bab82['sid']});}})[_0xffdf('0x1c')](function(_0x31a331){logger[_0xffdf('0x1d')](_0xffdf('0x2b'),_0xffdf('0x2c'),_0xffdf('0x2d'),util['inspect'](_0x31a331,{'showHidden':![],'depth':null}));});}else{logger[_0xffdf('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xffdf('0x2c'),_0xffdf('0x2d'),_0xffdf('0x2e'));}break;case'sinch':var _0x2bf6d6=_0x351b78['accountSid'];var _0x15ef90=_0x351b78[_0xffdf('0x22')];var _0x24478a=_0x351b78[_0xffdf('0x2f')]+_0xffdf('0x30')+_0x2bf6d6+_0xffdf('0x31');var _0x417d70={'to':[_0x208794['phone']],'message':{'type':_0xffdf('0x32'),'text':_0x208794[_0xffdf('0xe')]}};var _0x337ca4={'method':_0xffdf('0x33'),'uri':_0x24478a,'headers':{'Authorization':'Bearer\x20'+_0x15ef90,'Content-Type':_0xffdf('0x34')},'body':_0x417d70,'json':!![]};rp(_0x337ca4)[_0xffdf('0x1a')](function(_0x5a1fb9){if(_0x5a1fb9['statuses'][0x0]['message_id']){return _0x11d50c[_0xffdf('0x2a')]({'messageId':_0x5a1fb9[_0xffdf('0x35')][0x0][_0xffdf('0x36')]});}})[_0xffdf('0x1c')](function(_0x2e1aba){logger[_0xffdf('0x37')](_0xffdf('0x38'),_0x2e1aba);});break;}}})[_0xffdf('0x39')](function(){_0x2248ce();});}else{_0x2248ce();}}},'charset':_0xffdf('0x3a'),'collate':_0xffdf('0x3b')});}; \ No newline at end of file +var _0x35cb=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','toLowerCase','catch','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35cb,0xb8));var _0xb35c=function(_0x5a818d,_0x2e6f5f){_0x5a818d=_0x5a818d-0x0;var _0x494b9a=_0x35cb[_0x5a818d];return _0x494b9a;};'use strict';var _=require(_0xb35c('0x0'));var util=require(_0xb35c('0x1'));var logger=require(_0xb35c('0x2'))(_0xb35c('0x3'));var moment=require(_0xb35c('0x4'));var BPromise=require(_0xb35c('0x5'));var rp=require(_0xb35c('0x6'));var fetch=require(_0xb35c('0x7'));var fs=require('fs');var path=require(_0xb35c('0x8'));var rimraf=require('rimraf');var config=require(_0xb35c('0x9'));var attributes=require(_0xb35c('0xa'));module[_0xb35c('0xb')]=function(_0x238d68,_0x25f1da){return _0x238d68[_0xb35c('0xc')](_0xb35c('0xd'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xb35c('0xe'),'fields':[_0xb35c('0xe')]},{'name':_0xb35c('0xf'),'fields':[_0xb35c('0x10')],'type':_0xb35c('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b9367,_0x3d1886,_0x180e8d){var _0x3d2045=_0x238d68[_0xb35c('0x12')];var _0x5fbcc9=_0x5b9367[_0xb35c('0x13')]({'plain':!![]});if(_0x5fbcc9[_0xb35c('0x14')]['toLowerCase']()==='in'||_0x5fbcc9['direction']['toLowerCase']()===_0xb35c('0x15')&&!_0x5fbcc9[_0xb35c('0x16')]&&!_[_0xb35c('0x17')](_0x5fbcc9[_0xb35c('0x18')])){_0x3d2045[_0xb35c('0x19')][_0xb35c('0x1a')]({'where':{'id':_0x5fbcc9[_0xb35c('0x1b')]}})[_0xb35c('0x1c')](function(_0x3af3f5){if(_0x3af3f5){_0x3af3f5[_0xb35c('0x1d')]({'lastMsgAt':_0x5fbcc9[_0xb35c('0x1e')],'lastMsgDirection':_0x5fbcc9[_0xb35c('0x14')][_0xb35c('0x1f')]()});}})[_0xb35c('0x20')](function(_0x6daa7d){console['error'](_0x6daa7d);});}if(_0x5fbcc9['direction']===_0xb35c('0x15')&&!_0x5fbcc9[_0xb35c('0x16')]){var _0x311778;_0x3d2045['WhatsappAccount']['find']({'where':{'id':_0x5fbcc9[_0xb35c('0x21')]},'raw':!![]})[_0xb35c('0x1c')](function(_0x58ba6e){_0x311778=_0x58ba6e;if(_0x311778&&_0x311778[_0xb35c('0x22')]){switch(_0x311778[_0xb35c('0x22')]){case _0xb35c('0x23'):var _0x5cd863=require(_0xb35c('0x23'));if(_0x311778[_0xb35c('0x24')]&&_0x311778[_0xb35c('0x25')]&&_0x311778[_0xb35c('0x26')]){var _0x52b4fc=new _0x5cd863(_0x311778[_0xb35c('0x24')],_0x311778[_0xb35c('0x25')]);_0x52b4fc[_0xb35c('0x27')][_0xb35c('0x28')]({'body':_0x5fbcc9[_0xb35c('0x10')],'to':_0xb35c('0x29')+_0x5fbcc9[_0xb35c('0x26')],'from':_0xb35c('0x29')+_0x311778['phone'],'statusCallback':_0x311778[_0xb35c('0x2a')]+_0xb35c('0x2b')+_0x5fbcc9['id']+_0xb35c('0x2c')+_0x311778['token']})[_0xb35c('0x1c')](function(_0x2b86a5){if(_0x2b86a5[_0xb35c('0x2d')]){return _0x5b9367[_0xb35c('0x1d')]({'messageId':_0x2b86a5[_0xb35c('0x2d')]});}})['catch'](function(_0x397254){logger['error'](_0xb35c('0x2e'),_0xb35c('0x2f'),_0xb35c('0x23'),util[_0xb35c('0x30')](_0x397254,{'showHidden':![],'depth':null}));});}else{logger[_0xb35c('0x31')](_0xb35c('0x2e'),_0xb35c('0x2f'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb35c('0x32'):var _0x92cce=_0x311778[_0xb35c('0x24')];var _0xf93a39=_0x311778[_0xb35c('0x25')];var _0x489635=_0x311778[_0xb35c('0x33')]+_0xb35c('0x34')+_0x92cce+'/messages/';var _0x477619={'to':[_0x5fbcc9[_0xb35c('0x26')]],'message':{'type':_0xb35c('0x35'),'text':_0x5fbcc9['body']}};var _0x410a1f={'method':_0xb35c('0x36'),'uri':_0x489635,'headers':{'Authorization':_0xb35c('0x37')+_0xf93a39,'Content-Type':_0xb35c('0x38')},'body':_0x477619,'json':!![]};rp(_0x410a1f)[_0xb35c('0x1c')](function(_0x4240bf){if(_0x4240bf[_0xb35c('0x39')][0x0][_0xb35c('0x3a')]){return _0x5b9367['update']({'messageId':_0x4240bf[_0xb35c('0x39')][0x0]['message_id']});}})['catch'](function(_0x2aefb0){logger[_0xb35c('0x3b')]('WhatsappMessage,\x20%s',_0x2aefb0);});break;}}})['finally'](function(){_0x180e8d();});}else{_0x180e8d();}}},'charset':_0xb35c('0x3c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index dbe8238..cb91cf6 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 _0x487f=['catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x542d5f,_0xfa1e1a){var _0x2b52f4=function(_0x1f31ca){while(--_0x1f31ca){_0x542d5f['push'](_0x542d5f['shift']());}};_0x2b52f4(++_0xfa1e1a);}(_0x487f,0x151));var _0xf487=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x487f[_0x411add];return _0x238242;};'use strict';var _=require(_0xf487('0x0'));var util=require(_0xf487('0x1'));var moment=require('moment');var BPromise=require(_0xf487('0x2'));var rs=require(_0xf487('0x3'));var fs=require('fs');var Redis=require(_0xf487('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf487('0x5'));var logger=require(_0xf487('0x6'))('rpc');var config=require(_0xf487('0x7'));var jayson=require(_0xf487('0x8'));var client=jayson['client'][_0xf487('0x9')]({'port':0x232a});config['redis']=_[_0xf487('0xa')](config[_0xf487('0xb')],{'host':_0xf487('0xc'),'port':0x18eb});var socket=require(_0xf487('0xd'))(new Redis(config[_0xf487('0xb')]));require(_0xf487('0xe'))[_0xf487('0xf')](socket);function respondWithRpcPromise(_0x521d9a,_0x60fc06,_0x82d165){return new BPromise(function(_0x1f6dff,_0x5841cc){return client[_0xf487('0x10')](_0x521d9a,_0x82d165)['then'](function(_0x252250){logger[_0xf487('0x11')](_0xf487('0x12'),_0x60fc06,_0xf487('0x13'));logger['debug'](_0xf487('0x14'),_0x60fc06,_0xf487('0x13'),JSON[_0xf487('0x15')](_0x252250));if(_0x252250[_0xf487('0x16')]){if(_0x252250['error'][_0xf487('0x17')]===0x1f4){logger[_0xf487('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x60fc06,_0x252250[_0xf487('0x16')][_0xf487('0x18')]);return _0x5841cc(_0x252250[_0xf487('0x16')]['message']);}logger['error'](_0xf487('0x12'),_0x60fc06,_0x252250[_0xf487('0x16')][_0xf487('0x18')]);return _0x1f6dff(_0x252250[_0xf487('0x16')][_0xf487('0x18')]);}else{logger[_0xf487('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x60fc06,_0xf487('0x13'));_0x1f6dff(_0x252250[_0xf487('0x19')][_0xf487('0x18')]);}})[_0xf487('0x1a')](function(_0x293aab){logger['error'](_0xf487('0x12'),_0x60fc06,_0x293aab);_0x5841cc(_0x293aab);});});}exports[_0xf487('0x1b')]=function(_0x221127){var _0xebf3c=this;return new Promise(function(_0x2255be,_0x467ad8){return db[_0xf487('0x1c')][_0xf487('0x1d')](_0x221127[_0xf487('0x1e')],{'raw':_0x221127[_0xf487('0x1f')]?_0x221127[_0xf487('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x22f24b){logger[_0xf487('0x11')](_0xf487('0x1b'),_0x221127);logger[_0xf487('0x20')]('CreateWhatsappMessage',_0x221127,JSON[_0xf487('0x15')](_0x22f24b));_0x2255be(_0x22f24b);})['catch'](function(_0x2c01c7){logger[_0xf487('0x16')](_0xf487('0x1b'),_0x2c01c7['message'],_0x221127);_0x467ad8(_0xebf3c[_0xf487('0x16')](0x1f4,_0x2c01c7[_0xf487('0x18')]));});});}; \ No newline at end of file +var _0xf1d4=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xf1d4,0x16c));var _0x4f1d=function(_0x48ac89,_0x102d3b){_0x48ac89=_0x48ac89-0x0;var _0x336a03=_0xf1d4[_0x48ac89];return _0x336a03;};'use strict';var _=require('lodash');var util=require(_0x4f1d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f1d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f1d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f1d('0x3'))(_0x4f1d('0x4'));var config=require('../../config/environment');var jayson=require(_0x4f1d('0x5'));var client=jayson[_0x4f1d('0x6')][_0x4f1d('0x7')]({'port':0x232a});config[_0x4f1d('0x8')]=_[_0x4f1d('0x9')](config[_0x4f1d('0x8')],{'host':_0x4f1d('0xa'),'port':0x18eb});var socket=require(_0x4f1d('0xb'))(new Redis(config['redis']));require(_0x4f1d('0xc'))[_0x4f1d('0xd')](socket);function respondWithRpcPromise(_0x499e85,_0x23da9b,_0x6e2b7d){return new BPromise(function(_0x118590,_0x128c71){return client[_0x4f1d('0xe')](_0x499e85,_0x6e2b7d)[_0x4f1d('0xf')](function(_0x5b7e1a){logger[_0x4f1d('0x10')](_0x4f1d('0x11'),_0x23da9b,_0x4f1d('0x12'));logger['debug'](_0x4f1d('0x13'),_0x23da9b,'request\x20sent',JSON[_0x4f1d('0x14')](_0x5b7e1a));if(_0x5b7e1a[_0x4f1d('0x15')]){if(_0x5b7e1a[_0x4f1d('0x15')]['code']===0x1f4){logger['error'](_0x4f1d('0x11'),_0x23da9b,_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);return _0x128c71(_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);}logger['error'](_0x4f1d('0x11'),_0x23da9b,_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);return _0x118590(_0x5b7e1a[_0x4f1d('0x15')][_0x4f1d('0x16')]);}else{logger[_0x4f1d('0x10')](_0x4f1d('0x11'),_0x23da9b,_0x4f1d('0x12'));_0x118590(_0x5b7e1a['result']['message']);}})['catch'](function(_0x3cd6fc){logger['error'](_0x4f1d('0x11'),_0x23da9b,_0x3cd6fc);_0x128c71(_0x3cd6fc);});});}exports[_0x4f1d('0x17')]=function(_0x47f581){var _0x58115f=this;return new Promise(function(_0x509b4a,_0x1251c4){return db[_0x4f1d('0x18')][_0x4f1d('0x19')](_0x47f581[_0x4f1d('0x1a')],{'raw':_0x47f581[_0x4f1d('0x1b')]?_0x47f581[_0x4f1d('0x1b')][_0x4f1d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x483640){logger[_0x4f1d('0x10')](_0x4f1d('0x17'),_0x47f581);logger[_0x4f1d('0x1d')]('CreateWhatsappMessage',_0x47f581,JSON[_0x4f1d('0x14')](_0x483640));_0x509b4a(_0x483640);})[_0x4f1d('0x1e')](function(_0x2be719){logger[_0x4f1d('0x15')](_0x4f1d('0x17'),_0x2be719[_0x4f1d('0x16')],_0x47f581);_0x1251c4(_0x58115f['error'](0x1f4,_0x2be719['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e18c03d..e807ff0 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 _0x80ce=['removeListener','register','length','whatsappMessage:','save','update','emit'];(function(_0x45b6da,_0x5eed1b){var _0x456bae=function(_0x35121e){while(--_0x35121e){_0x45b6da['push'](_0x45b6da['shift']());}};_0x456bae(++_0x5eed1b);}(_0x80ce,0x185));var _0xe80c=function(_0x1ffda0,_0x45c3e0){_0x1ffda0=_0x1ffda0-0x0;var _0x4d563e=_0x80ce[_0x1ffda0];return _0x4d563e;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xe80c('0x0'),'remove',_0xe80c('0x1')];function createListener(_0x29edc9,_0x4aaeb3){return function(_0x2307c4){_0x4aaeb3[_0xe80c('0x2')](_0x29edc9,_0x2307c4);};}function removeListener(_0x4275d3,_0x7e0eb4){return function(){WhatsappMessageEvents[_0xe80c('0x3')](_0x4275d3,_0x7e0eb4);};}exports[_0xe80c('0x4')]=function(_0x418cf0){for(var _0x388bed=0x0,_0x31af77=events[_0xe80c('0x5')];_0x388bed<_0x31af77;_0x388bed++){var _0x29a704=events[_0x388bed];var _0x304dcd=createListener(_0xe80c('0x6')+_0x29a704,_0x418cf0);WhatsappMessageEvents['on'](_0x29a704,_0x304dcd);}}; \ No newline at end of file +var _0x0b7f=['length','whatsappMessage:','remove','removeListener','register'];(function(_0x4bdae6,_0x58bad7){var _0x4a8f49=function(_0x1cc1af){while(--_0x1cc1af){_0x4bdae6['push'](_0x4bdae6['shift']());}};_0x4a8f49(++_0x58bad7);}(_0x0b7f,0x93));var _0xf0b7=function(_0x14405d,_0x2b42a0){_0x14405d=_0x14405d-0x0;var _0x17b644=_0x0b7f[_0x14405d];return _0x17b644;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0xf0b7('0x0'),'update'];function createListener(_0x5a23b2,_0x56ab5a){return function(_0x5b7d5d){_0x56ab5a['emit'](_0x5a23b2,_0x5b7d5d);};}function removeListener(_0xe16de,_0x237b87){return function(){WhatsappMessageEvents[_0xf0b7('0x1')](_0xe16de,_0x237b87);};}exports[_0xf0b7('0x2')]=function(_0x2de7b1){for(var _0x512d22=0x0,_0x10b33d=events[_0xf0b7('0x3')];_0x512d22<_0x10b33d;_0x512d22++){var _0x13ea55=events[_0x512d22];var _0x1c1d40=createListener(_0xf0b7('0x4')+_0x13ea55,_0x2de7b1);WhatsappMessageEvents['on'](_0x13ea55,_0x1c1d40);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e149f58..bd261eb 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 _0xab22=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x126e95,_0x464d5f){var _0x11ca0a=function(_0x297772){while(--_0x297772){_0x126e95['push'](_0x126e95['shift']());}};_0x11ca0a(++_0x464d5f);}(_0xab22,0xde));var _0x2ab2=function(_0x54f172,_0x1adc6f){_0x54f172=_0x54f172-0x0;var _0x4a8b91=_0xab22[_0x54f172];return _0x4a8b91;};'use strict';var multer=require(_0x2ab2('0x0'));var util=require(_0x2ab2('0x1'));var path=require('path');var timeout=require(_0x2ab2('0x2'));var express=require('express');var router=express[_0x2ab2('0x3')]();var fs_extra=require(_0x2ab2('0x4'));var auth=require(_0x2ab2('0x5'));var interaction=require(_0x2ab2('0x6'));var config=require(_0x2ab2('0x7'));var controller=require(_0x2ab2('0x8'));router[_0x2ab2('0x9')]('/',auth[_0x2ab2('0xa')](),controller[_0x2ab2('0xb')]);router[_0x2ab2('0x9')](_0x2ab2('0xc'),auth['isAuthenticated'](),controller[_0x2ab2('0xd')]);router[_0x2ab2('0x9')]('/:id',auth[_0x2ab2('0xa')](),controller[_0x2ab2('0xe')]);router['get'](_0x2ab2('0xf'),auth[_0x2ab2('0xa')](),controller[_0x2ab2('0x10')]);router[_0x2ab2('0x9')](_0x2ab2('0x11'),auth['isAuthenticated'](),controller[_0x2ab2('0x12')]);router[_0x2ab2('0x9')]('/:id/users',auth[_0x2ab2('0xa')](),controller[_0x2ab2('0x13')]);router[_0x2ab2('0x14')]('/',auth[_0x2ab2('0xa')](),controller['create']);router[_0x2ab2('0x14')](_0x2ab2('0x11'),auth[_0x2ab2('0xa')](),controller[_0x2ab2('0x15')]);router[_0x2ab2('0x14')](_0x2ab2('0x16'),auth[_0x2ab2('0xa')](),controller[_0x2ab2('0x17')]);router[_0x2ab2('0x18')](_0x2ab2('0x19'),auth[_0x2ab2('0xa')](),controller[_0x2ab2('0x1a')]);router[_0x2ab2('0x1b')](_0x2ab2('0x19'),auth[_0x2ab2('0xa')](),controller[_0x2ab2('0x1c')]);router[_0x2ab2('0x1b')](_0x2ab2('0x11'),auth['isAuthenticated'](),controller[_0x2ab2('0x1d')]);router['delete'](_0x2ab2('0x16'),auth[_0x2ab2('0xa')](),controller[_0x2ab2('0x1e')]);module[_0x2ab2('0x1f')]=router; \ No newline at end of file +var _0x8835=['put','update','delete','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/users','getAgents','post','/:id/teams','addAgents'];(function(_0x4751d6,_0x2911a1){var _0x55e2c3=function(_0x420a54){while(--_0x420a54){_0x4751d6['push'](_0x4751d6['shift']());}};_0x55e2c3(++_0x2911a1);}(_0x8835,0x1f3));var _0x5883=function(_0x43c982,_0x55cebd){_0x43c982=_0x43c982-0x0;var _0x5b3ce3=_0x8835[_0x43c982];return _0x5b3ce3;};'use strict';var multer=require(_0x5883('0x0'));var util=require('util');var path=require(_0x5883('0x1'));var timeout=require('connect-timeout');var express=require(_0x5883('0x2'));var router=express[_0x5883('0x3')]();var fs_extra=require(_0x5883('0x4'));var auth=require(_0x5883('0x5'));var interaction=require(_0x5883('0x6'));var config=require('../../config/environment');var controller=require(_0x5883('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5883('0x8')]);router[_0x5883('0x9')](_0x5883('0xa'),auth[_0x5883('0xb')](),controller[_0x5883('0xc')]);router[_0x5883('0x9')](_0x5883('0xd'),auth[_0x5883('0xb')](),controller[_0x5883('0xe')]);router[_0x5883('0x9')](_0x5883('0xf'),auth[_0x5883('0xb')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x5883('0xb')](),controller['getTeams']);router[_0x5883('0x9')](_0x5883('0x10'),auth[_0x5883('0xb')](),controller[_0x5883('0x11')]);router[_0x5883('0x12')]('/',auth[_0x5883('0xb')](),controller['create']);router[_0x5883('0x12')](_0x5883('0x13'),auth[_0x5883('0xb')](),controller['addTeams']);router[_0x5883('0x12')](_0x5883('0x10'),auth[_0x5883('0xb')](),controller[_0x5883('0x14')]);router[_0x5883('0x15')](_0x5883('0xd'),auth[_0x5883('0xb')](),controller[_0x5883('0x16')]);router[_0x5883('0x17')](_0x5883('0xd'),auth[_0x5883('0xb')](),controller['destroy']);router[_0x5883('0x17')](_0x5883('0x13'),auth[_0x5883('0xb')](),controller[_0x5883('0x18')]);router[_0x5883('0x17')](_0x5883('0x10'),auth[_0x5883('0xb')](),controller[_0x5883('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 7ac5047..02c874c 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 _0x6d0b=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x227742,_0x13ec28){var _0x428801=function(_0x4bbe1f){while(--_0x4bbe1f){_0x227742['push'](_0x227742['shift']());}};_0x428801(++_0x13ec28);}(_0x6d0b,0x71));var _0xb6d0=function(_0x1b3cda,_0x42743f){_0x1b3cda=_0x1b3cda-0x0;var _0x451ca3=_0x6d0b[_0x1b3cda];return _0x451ca3;};'use strict';var Sequelize=require(_0xb6d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb6d0('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb6d0('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6d0('0x3')](_0xb6d0('0x4'),_0xb6d0('0x5'),_0xb6d0('0x6'))},'description':{'type':Sequelize[_0xb6d0('0x1')]}}; \ No newline at end of file +var _0xac65=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xac65,0x11d));var _0x5ac6=function(_0xb830a,_0x258ed8){_0xb830a=_0xb830a-0x0;var _0x47b2f3=_0xac65[_0xb830a];return _0x47b2f3;};'use strict';var Sequelize=require(_0x5ac6('0x0'));module[_0x5ac6('0x1')]={'name':{'type':Sequelize[_0x5ac6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5ac6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5ac6('0x4')](_0x5ac6('0x5'),'beepall',_0x5ac6('0x6'))},'description':{'type':Sequelize[_0x5ac6('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index dde1e4a..2fbb273 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 _0x81c4=['isEmpty','userWhatsappQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','map','WhatsappQueue','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','all','compact'];(function(_0xae1076,_0x390dd5){var _0x32af13=function(_0x501ebd){while(--_0x501ebd){_0xae1076['push'](_0xae1076['shift']());}};_0x32af13(++_0x390dd5);}(_0x81c4,0x11c));var _0x481c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x81c4[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0x481c('0x0'));var rimraf=require(_0x481c('0x1'));var zipdir=require(_0x481c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x481c('0x3'));var BPromise=require(_0x481c('0x4'));var Mustache=require('mustache');var util=require(_0x481c('0x5'));var path=require(_0x481c('0x6'));var sox=require('sox');var csv=require(_0x481c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x481c('0x8'));var crypto=require('crypto');var jsforce=require(_0x481c('0x9'));var deskjs=require(_0x481c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x481c('0xb'));var Papa=require(_0x481c('0xc'));var Redis=require(_0x481c('0xd'));var authService=require(_0x481c('0xe'));var qs=require(_0x481c('0xf'));var as=require(_0x481c('0x10'));var hardwareService=require(_0x481c('0x11'));var logger=require(_0x481c('0x12'))(_0x481c('0x13'));var utils=require(_0x481c('0x14'));var config=require(_0x481c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x481c('0x16'))['db'];config['redis']=_[_0x481c('0x17')](config[_0x481c('0x18')],{'host':_0x481c('0x19'),'port':0x18eb});var socket=require(_0x481c('0x1a'))(new Redis(config[_0x481c('0x18')]));require(_0x481c('0x1b'))[_0x481c('0x1c')](socket);function respondWithStatusCode(_0x1f4be6,_0xfb8fe){_0xfb8fe=_0xfb8fe||0xcc;return function(_0xb514cf){if(_0xb514cf){return _0x1f4be6[_0x481c('0x1d')](_0xfb8fe);}return _0x1f4be6[_0x481c('0x1e')](_0xfb8fe)[_0x481c('0x1f')]();};}function respondWithResult(_0x198f48,_0x451cc2){_0x451cc2=_0x451cc2||0xc8;return function(_0x55cb33){if(_0x55cb33){return _0x198f48[_0x481c('0x1e')](_0x451cc2)[_0x481c('0x20')](_0x55cb33);}};}function respondWithFilteredResult(_0x2f2bfd,_0x43f6d8){return function(_0x42da08){if(_0x42da08){var _0x4ac16d=typeof _0x43f6d8[_0x481c('0x21')]===_0x481c('0x22')&&typeof _0x43f6d8[_0x481c('0x23')]===_0x481c('0x22');var _0x1a0d76=_0x42da08['count'];var _0x3ce333=_0x4ac16d?0x0:_0x43f6d8[_0x481c('0x21')];var _0x462d3c=_0x4ac16d?_0x42da08[_0x481c('0x24')]:_0x43f6d8['offset']+_0x43f6d8[_0x481c('0x23')];var _0x29588d;if(_0x462d3c>=_0x1a0d76){_0x462d3c=_0x1a0d76;_0x29588d=0xc8;}else{_0x29588d=0xce;}_0x2f2bfd['status'](_0x29588d);return _0x2f2bfd[_0x481c('0x25')](_0x481c('0x26'),_0x3ce333+'-'+_0x462d3c+'/'+_0x1a0d76)['json'](_0x42da08);}return null;};}function patchUpdates(_0x49781a){return function(_0x2c3af2){try{jsonpatch[_0x481c('0x27')](_0x2c3af2,_0x49781a,!![]);}catch(_0x5c517c){return BPromise['reject'](_0x5c517c);}return _0x2c3af2[_0x481c('0x28')]();};}function saveUpdates(_0x59ee90,_0x31f84d){return function(_0x28f56){if(_0x28f56){return _0x28f56[_0x481c('0x29')](_0x59ee90)[_0x481c('0x2a')](function(_0x1cdb35){return _0x1cdb35;});}return null;};}function removeEntity(_0x529fec,_0x3060eb){return function(_0x8017ad){if(_0x8017ad){return _0x8017ad[_0x481c('0x2b')]()[_0x481c('0x2a')](function(){var _0x1b9770=_0x8017ad[_0x481c('0x2c')]({'plain':!![]});var _0x49d195=_0x481c('0x2d');return db[_0x481c('0x2e')][_0x481c('0x2b')]({'where':{'type':_0x49d195,'resourceId':_0x1b9770['id']}})['then'](function(){return _0x8017ad;});})[_0x481c('0x2a')](function(){_0x529fec[_0x481c('0x1e')](0xcc)[_0x481c('0x1f')]();});}};}function handleEntityNotFound(_0x4eed1d,_0x26a940){return function(_0x56dac3){if(!_0x56dac3){_0x4eed1d['sendStatus'](0x194);}return _0x56dac3;};}function handleError(_0x5725a2,_0x5ba1d2){_0x5ba1d2=_0x5ba1d2||0x1f4;return function(_0x2c19a5){logger['error'](_0x2c19a5[_0x481c('0x2f')]);if(_0x2c19a5[_0x481c('0x30')]){delete _0x2c19a5[_0x481c('0x30')];}_0x5725a2['status'](_0x5ba1d2)['send'](_0x2c19a5);};}exports['index']=function(_0x462081,_0xd4099a){var _0x59c8ca={},_0x26c531={},_0x3180e1={'count':0x0,'rows':[]};var _0x8cf89f=_[_0x481c('0x31')](db[_0x481c('0x32')][_0x481c('0x33')],function(_0x4cf686){return{'name':_0x4cf686['fieldName'],'type':_0x4cf686['type'][_0x481c('0x34')]};});_0x26c531[_0x481c('0x35')]=_[_0x481c('0x31')](_0x8cf89f,'name');_0x26c531[_0x481c('0x36')]=_['keys'](_0x462081[_0x481c('0x36')]);_0x26c531['filters']=_[_0x481c('0x37')](_0x26c531[_0x481c('0x35')],_0x26c531['query']);_0x59c8ca[_0x481c('0x38')]=_[_0x481c('0x37')](_0x26c531['model'],qs['fields'](_0x462081[_0x481c('0x36')][_0x481c('0x39')]));_0x59c8ca[_0x481c('0x38')]=_0x59c8ca['attributes'][_0x481c('0x3a')]?_0x59c8ca[_0x481c('0x38')]:_0x26c531[_0x481c('0x35')];if(!_0x462081[_0x481c('0x36')][_0x481c('0x3b')](_0x481c('0x3c'))){_0x59c8ca[_0x481c('0x23')]=qs['limit'](_0x462081[_0x481c('0x36')][_0x481c('0x23')]);_0x59c8ca[_0x481c('0x21')]=qs['offset'](_0x462081[_0x481c('0x36')][_0x481c('0x21')]);}_0x59c8ca[_0x481c('0x3d')]=qs['sort'](_0x462081[_0x481c('0x36')][_0x481c('0x3e')]);_0x59c8ca[_0x481c('0x3f')]=qs[_0x481c('0x40')](_[_0x481c('0x41')](_0x462081[_0x481c('0x36')],_0x26c531['filters']),_0x8cf89f);if(_0x462081[_0x481c('0x36')][_0x481c('0x42')]){_0x59c8ca[_0x481c('0x3f')]=_['merge'](_0x59c8ca['where'],{'$or':_[_0x481c('0x31')](_0x8cf89f,function(_0x567d09){if(_0x567d09[_0x481c('0x43')]!==_0x481c('0x44')){var _0x43973a={};_0x43973a[_0x567d09['name']]={'$like':'%'+_0x462081[_0x481c('0x36')][_0x481c('0x42')]+'%'};return _0x43973a;}})});}_0x59c8ca=_[_0x481c('0x45')]({},_0x59c8ca,_0x462081['options']);var _0x4ffc9e={'where':_0x59c8ca[_0x481c('0x3f')]};return db[_0x481c('0x32')][_0x481c('0x24')](_0x4ffc9e)['then'](function(_0x25e84a){_0x3180e1['count']=_0x25e84a;if(_0x462081[_0x481c('0x36')]['includeAll']){_0x59c8ca[_0x481c('0x46')]=[{'all':!![]}];}return db[_0x481c('0x32')][_0x481c('0x47')](_0x59c8ca);})[_0x481c('0x2a')](function(_0x5814e2){_0x3180e1[_0x481c('0x48')]=_0x5814e2;return _0x3180e1;})[_0x481c('0x2a')](respondWithFilteredResult(_0xd4099a,_0x59c8ca))[_0x481c('0x49')](handleError(_0xd4099a,null));};exports[_0x481c('0x4a')]=function(_0x879fb5,_0x8051ff){var _0x55b314={'raw':!![],'where':{'id':_0x879fb5[_0x481c('0x4b')]['id']}},_0x1526e7={};_0x1526e7[_0x481c('0x35')]=_['keys'](db['WhatsappQueue'][_0x481c('0x33')]);_0x1526e7[_0x481c('0x36')]=_[_0x481c('0x4c')](_0x879fb5[_0x481c('0x36')]);_0x1526e7[_0x481c('0x40')]=_[_0x481c('0x37')](_0x1526e7['model'],_0x1526e7['query']);_0x55b314[_0x481c('0x38')]=_[_0x481c('0x37')](_0x1526e7[_0x481c('0x35')],qs[_0x481c('0x39')](_0x879fb5[_0x481c('0x36')][_0x481c('0x39')]));_0x55b314[_0x481c('0x38')]=_0x55b314['attributes']['length']?_0x55b314[_0x481c('0x38')]:_0x1526e7[_0x481c('0x35')];if(_0x879fb5[_0x481c('0x36')][_0x481c('0x4d')]){_0x55b314['include']=[{'all':!![]}];}_0x55b314=_[_0x481c('0x45')]({},_0x55b314,_0x879fb5[_0x481c('0x4e')]);return db[_0x481c('0x32')]['find'](_0x55b314)[_0x481c('0x2a')](handleEntityNotFound(_0x8051ff,null))['then'](respondWithResult(_0x8051ff,null))[_0x481c('0x49')](handleError(_0x8051ff,null));};exports['create']=function(_0x4ae330,_0x51a43e){return db['WhatsappQueue'][_0x481c('0x4f')](_0x4ae330[_0x481c('0x50')],{})[_0x481c('0x2a')](function(_0x2260e9){var _0x43f8ff=_0x4ae330[_0x481c('0x51')][_0x481c('0x2c')]({'plain':!![]});if(!_0x43f8ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43f8ff[_0x481c('0x52')]===_0x481c('0x51')){var _0x580295=_0x2260e9[_0x481c('0x2c')]({'plain':!![]});var _0x52c95e=_0x481c('0x2d');return db[_0x481c('0x53')]['find']({'where':{'name':_0x52c95e,'userProfileId':_0x43f8ff[_0x481c('0x54')]},'raw':!![]})['then'](function(_0x226e8e){if(_0x226e8e&&_0x226e8e['autoAssociation']===0x0){return db[_0x481c('0x2e')][_0x481c('0x4f')]({'name':_0x580295[_0x481c('0x30')],'resourceId':_0x580295['id'],'type':_0x226e8e['name'],'sectionId':_0x226e8e['id']},{})[_0x481c('0x2a')](function(){return _0x2260e9;});}else{return _0x2260e9;}})[_0x481c('0x49')](function(_0x4c76bd){logger[_0x481c('0x55')](_0x481c('0x56'),_0x4c76bd);throw _0x4c76bd;});}return _0x2260e9;})[_0x481c('0x2a')](respondWithResult(_0x51a43e,0xc9))['catch'](handleError(_0x51a43e,null));};exports[_0x481c('0x29')]=function(_0xfaba8d,_0x17ed3d){if(_0xfaba8d['body']['id']){delete _0xfaba8d[_0x481c('0x50')]['id'];}return db[_0x481c('0x32')][_0x481c('0x57')]({'where':{'id':_0xfaba8d[_0x481c('0x4b')]['id']}})[_0x481c('0x2a')](handleEntityNotFound(_0x17ed3d,null))[_0x481c('0x2a')](saveUpdates(_0xfaba8d[_0x481c('0x50')],null))[_0x481c('0x2a')](respondWithResult(_0x17ed3d,null))[_0x481c('0x49')](handleError(_0x17ed3d,null));};exports[_0x481c('0x2b')]=function(_0x1629f9,_0x2135e9){return db[_0x481c('0x32')]['find']({'where':{'id':_0x1629f9[_0x481c('0x4b')]['id']}})[_0x481c('0x2a')](handleEntityNotFound(_0x2135e9,null))['then'](removeEntity(_0x2135e9,null))[_0x481c('0x49')](handleError(_0x2135e9,null));};exports['describe']=function(_0x1d23b0,_0x5b748d){return db['WhatsappQueue'][_0x481c('0x58')]()['then'](respondWithResult(_0x5b748d,null))['catch'](handleError(_0x5b748d,null));};exports['getMembers']=function(_0x55ad4b,_0x18810b,_0x225d31){var _0x253ceb={'raw':!![],'where':{}},_0x4925cf={},_0x139b4b;return db[_0x481c('0x32')][_0x481c('0x59')]({'where':{'id':_0x55ad4b[_0x481c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18810b,null))[_0x481c('0x2a')](function(_0x5205aa){if(_0x5205aa){_0x139b4b=_0x5205aa[_0x481c('0x2c')]({'plain':!![]});_0x4925cf[_0x481c('0x35')]=_[_0x481c('0x4c')](db[_0x481c('0x5a')]['rawAttributes']);_0x4925cf[_0x481c('0x36')]=_[_0x481c('0x4c')](_0x55ad4b[_0x481c('0x36')]);_0x4925cf[_0x481c('0x40')]=_[_0x481c('0x37')](_0x4925cf[_0x481c('0x35')],_0x4925cf[_0x481c('0x36')]);_0x253ceb['attributes']=_['intersection'](_0x4925cf[_0x481c('0x35')],qs['fields'](_0x55ad4b[_0x481c('0x36')][_0x481c('0x39')]));_0x253ceb[_0x481c('0x38')]=_0x253ceb[_0x481c('0x38')]['length']?_0x253ceb[_0x481c('0x38')]:_0x4925cf[_0x481c('0x35')];if(!_0x55ad4b[_0x481c('0x36')][_0x481c('0x3b')](_0x481c('0x3c'))){_0x253ceb[_0x481c('0x23')]=qs[_0x481c('0x23')](_0x55ad4b[_0x481c('0x36')][_0x481c('0x23')]);_0x253ceb['offset']=qs[_0x481c('0x21')](_0x55ad4b[_0x481c('0x36')][_0x481c('0x21')]);}_0x253ceb[_0x481c('0x3d')]=qs['sort'](_0x55ad4b[_0x481c('0x36')][_0x481c('0x3e')]);_0x253ceb['where']=qs[_0x481c('0x40')](_[_0x481c('0x41')](_0x55ad4b[_0x481c('0x36')],_0x4925cf[_0x481c('0x40')]));_0x253ceb[_0x481c('0x3f')][_0x481c('0x5b')]=_0x5205aa['id'];if(_0x55ad4b['query'][_0x481c('0x42')]){_0x253ceb[_0x481c('0x3f')]=_['merge'](_0x253ceb[_0x481c('0x3f')],{'$or':_['map'](_0x253ceb['attributes'],function(_0x44613e){var _0x4d8c70={};_0x4d8c70[_0x44613e]={'$like':'%'+_0x55ad4b[_0x481c('0x36')]['filter']+'%'};return _0x4d8c70;})});}_0x253ceb=_[_0x481c('0x45')]({},_0x253ceb,_0x55ad4b[_0x481c('0x4e')]);return db[_0x481c('0x5a')][_0x481c('0x47')](_0x253ceb);}})[_0x481c('0x2a')](function(_0x19d191){if(_0x19d191){return db[_0x481c('0x5c')][_0x481c('0x5d')]({'where':{'id':_['map'](_0x19d191,_0x481c('0x5e')),'role':_0x481c('0x5f')},'attributes':['id',_0x481c('0x30'),_0x481c('0x60'),_0x481c('0x61'),'createdAt']});}})[_0x481c('0x2a')](function(_0x26cd37){if(_0x26cd37){return{'count':_0x26cd37['count'],'rows':_['map'](_0x26cd37[_0x481c('0x48')],function(_0x5b9765){return{'membername':_0x5b9765[_0x481c('0x30')],'UserId':_0x5b9765['id'],'queue_name':_0x139b4b[_0x481c('0x30')],'WhatsappQueueId':_0x139b4b['id'],'interface':util[_0x481c('0x62')](_0x481c('0x63'),'SIP',_0x5b9765[_0x481c('0x30')]),'penalty':0x0,'paused':_0x5b9765[_0x481c('0x60')],'createdAt':_0x5b9765[_0x481c('0x64')],'updatedAt':_0x5b9765[_0x481c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x18810b,_0x253ceb))[_0x481c('0x49')](handleError(_0x18810b,null));};exports[_0x481c('0x65')]=function(_0x922d29,_0x569b32,_0x1a64ba){var _0x4927e8={};var _0x203c84={};var _0x239858;var _0x5a3283;return db[_0x481c('0x32')][_0x481c('0x59')]({'where':{'id':_0x922d29[_0x481c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x569b32,null))['then'](function(_0x4a8f55){if(_0x4a8f55){_0x239858=_0x4a8f55;_0x203c84[_0x481c('0x35')]=_['keys'](db[_0x481c('0x66')][_0x481c('0x33')]);_0x203c84[_0x481c('0x36')]=_['keys'](_0x922d29['query']);_0x203c84['filters']=_[_0x481c('0x37')](_0x203c84[_0x481c('0x35')],_0x203c84[_0x481c('0x36')]);_0x4927e8[_0x481c('0x38')]=_[_0x481c('0x37')](_0x203c84[_0x481c('0x35')],qs[_0x481c('0x39')](_0x922d29[_0x481c('0x36')][_0x481c('0x39')]));_0x4927e8[_0x481c('0x38')]=_0x4927e8[_0x481c('0x38')][_0x481c('0x3a')]?_0x4927e8[_0x481c('0x38')]:_0x203c84[_0x481c('0x35')];_0x4927e8[_0x481c('0x3d')]=qs[_0x481c('0x3e')](_0x922d29[_0x481c('0x36')][_0x481c('0x3e')]);_0x4927e8['where']=qs[_0x481c('0x40')](_[_0x481c('0x41')](_0x922d29[_0x481c('0x36')],_0x203c84['filters']));if(_0x922d29['query']['filter']){_0x4927e8[_0x481c('0x3f')]=_[_0x481c('0x45')](_0x4927e8['where'],{'$or':_[_0x481c('0x31')](_0x4927e8['attributes'],function(_0x1eac5f){var _0x51ab4={};_0x51ab4[_0x1eac5f]={'$like':'%'+_0x922d29['query']['filter']+'%'};return _0x51ab4;})});}_0x4927e8=_['merge']({},_0x4927e8,_0x922d29[_0x481c('0x4e')]);return _0x239858[_0x481c('0x65')](_0x4927e8);}})[_0x481c('0x2a')](function(_0x5c2c8c){if(_0x5c2c8c){_0x5a3283=_0x5c2c8c[_0x481c('0x3a')];if(!_0x922d29[_0x481c('0x36')][_0x481c('0x3b')](_0x481c('0x3c'))){_0x4927e8[_0x481c('0x23')]=qs[_0x481c('0x23')](_0x922d29[_0x481c('0x36')][_0x481c('0x23')]);_0x4927e8[_0x481c('0x21')]=qs[_0x481c('0x21')](_0x922d29[_0x481c('0x36')][_0x481c('0x21')]);}return _0x239858[_0x481c('0x65')](_0x4927e8);}})[_0x481c('0x2a')](function(_0x55097c){if(_0x55097c){return _0x55097c?{'count':_0x5a3283,'rows':_0x55097c}:null;}})['then'](respondWithResult(_0x569b32,null))['catch'](handleError(_0x569b32,null));};exports[_0x481c('0x67')]=function(_0x35074a,_0x1078ea,_0x405fa){var _0x460fba=_0x35074a['body'][_0x481c('0x68')];return db[_0x481c('0x66')][_0x481c('0x47')]({'where':{'id':_0x460fba},'attributes':['id'],'include':[{'model':db[_0x481c('0x5c')],'as':_0x481c('0x69'),'attributes':['id','name',_0x481c('0x6a'),'voicePause',_0x481c('0x6b')],'raw':!![]}]})[_0x481c('0x2a')](function(_0x497244){if(_0x497244){var _0x2bced0=_[_0x481c('0x6c')](_0x497244,function(_0x2eec7b){var _0x4cd458=_0x2eec7b[_0x481c('0x2c')]({'plain':!![]});return _0x4cd458['Agents'];});return db[_0x481c('0x32')][_0x481c('0x57')]({'where':{'id':_0x35074a[_0x481c('0x4b')]['id']}})[_0x481c('0x2a')](function(_0x43ccb4){return db[_0x481c('0x6d')][_0x481c('0x6e')](function(_0x10cde4){return _0x43ccb4[_0x481c('0x67')](_0x460fba,{'transaction':_0x10cde4})['then'](function(){return BPromise[_0x481c('0x6f')](_0x2bced0,function(_0x12d858){return db[_0x481c('0x5a')][_0x481c('0x70')]({'where':{'UserId':_0x12d858['id'],'WhatsappQueueId':_0x35074a[_0x481c('0x4b')]['id']},'transaction':_0x10cde4});});})[_0x481c('0x2a')](function(){_0x2bced0[_0x481c('0x71')](function(_0x24ec5f){socket[_0x481c('0x72')](_0x481c('0x73'),{'UserId':_0x24ec5f['id'],'WhatsappQueueId':_0x43ccb4['id']});});});});});}})[_0x481c('0x2a')](respondWithStatusCode(_0x1078ea,null))['catch'](handleError(_0x1078ea,null));};exports[_0x481c('0x74')]=function(_0x894217,_0xd22a6d,_0x234af6){return db[_0x481c('0x66')][_0x481c('0x47')]({'where':{'id':_0x894217['query'][_0x481c('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x481c('0x69'),'attributes':['id'],'raw':!![]}]})[_0x481c('0x2a')](handleEntityNotFound(_0xd22a6d,null))['then'](function(_0x349630){var _0x6c37d9=_['map'](_0x349630,'id');var _0x47676e=[];var _0x5819d1=[];var _0x32334b=squel[_0x481c('0x75')]();_0x32334b['field'](_0x481c('0x76'))[_0x481c('0x77')](_0x481c('0x78'),'tq')[_0x481c('0x79')]('user_has_teams','ut',_0x481c('0x7a'))['where'](_0x481c('0x7b'),_0x894217['params']['id']);for(var _0xbea681=0x0;_0xbea681<_0x349630[_0x481c('0x3a')];_0xbea681+=0x1){let _0x3cdee5=_0x349630[_0xbea681];for(var _0x2f61eb=0x0;_0x2f61eb<_0x3cdee5[_0x481c('0x69')][_0x481c('0x3a')];_0x2f61eb+=0x1){let _0x3bd61f=_0x3cdee5[_0x481c('0x69')][_0x2f61eb];var _0x4123ab=_0x32334b[_0x481c('0x7c')]();_0x4123ab[_0x481c('0x3f')]('ut.UserId\x20=\x20?',_0x3bd61f['id']);_0x5819d1[_0x481c('0x7d')](db[_0x481c('0x6d')][_0x481c('0x36')](_0x4123ab[_0x481c('0x7e')](),{'type':db[_0x481c('0x6d')][_0x481c('0x7f')]['SELECT']})['then'](function(_0x50ddd6){if(_0x50ddd6[_0x481c('0x3a')]===0x1){return _0x3bd61f['id'];}else{var _0x2b8d00=_[_0x481c('0x80')](_[_0x481c('0x31')](_0x50ddd6,_0x481c('0x81')),function(_0x40520f){return _[_0x481c('0x82')](_0x6c37d9,_0x40520f);});if(_0x2b8d00){return _0x3bd61f['id'];}}}));}}return BPromise[_0x481c('0x83')](_0x5819d1)['then'](function(_0x4d18b9){_0x47676e=_(_0x47676e)['union'](_0x4d18b9)[_0x481c('0x84')]()['value']();return db[_0x481c('0x32')][_0x481c('0x57')]({'where':{'id':_0x894217['params']['id']}})['then'](function(_0x2dfd4f){return db[_0x481c('0x6d')][_0x481c('0x6e')](function(_0x55bb9f){return _0x2dfd4f[_0x481c('0x74')](_0x894217[_0x481c('0x36')]['ids'],{'transaction':_0x55bb9f})[_0x481c('0x2a')](function(){if(!_[_0x481c('0x85')](_0x47676e)){return _0x2dfd4f['removeAgents'](_0x47676e,{'transaction':_0x55bb9f});}})['then'](function(){_0x47676e[_0x481c('0x71')](function(_0x4e1eb3){socket[_0x481c('0x72')](_0x481c('0x86'),{'UserId':_0x4e1eb3,'WhatsappQueueId':_0x2dfd4f['id']});});});});});});})['then'](respondWithStatusCode(_0xd22a6d,null))[_0x481c('0x49')](handleError(_0xd22a6d,null));};exports[_0x481c('0x87')]=function(_0x2dd9bf,_0x2f6688,_0x3f2470){return db[_0x481c('0x32')][_0x481c('0x57')]({'where':{'id':_0x2dd9bf[_0x481c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f6688,null))[_0x481c('0x2a')](function(_0x3bb95b){if(_0x3bb95b){return _0x3bb95b[_0x481c('0x87')](_0x2dd9bf[_0x481c('0x50')][_0x481c('0x68')],_[_0x481c('0x88')](_0x2dd9bf[_0x481c('0x50')],[_0x481c('0x68'),'id'])||{})['spread'](function(_0x1d8772){for(var _0x4beef4=0x0;_0x4beef4<_0x2dd9bf[_0x481c('0x50')]['ids'][_0x481c('0x3a')];_0x4beef4+=0x1){socket['emit'](_0x481c('0x73'),{'UserId':Number(_0x2dd9bf['body'][_0x481c('0x68')][_0x4beef4]),'WhatsappQueueId':Number(_0x2dd9bf[_0x481c('0x4b')]['id'])});}return _0x1d8772;});}})[_0x481c('0x2a')](respondWithResult(_0x2f6688,null))[_0x481c('0x49')](handleError(_0x2f6688,null));};exports[_0x481c('0x89')]=function(_0x45ac7b,_0x591d3c,_0x5408eb){return db['WhatsappQueue'][_0x481c('0x57')]({'where':{'id':_0x45ac7b[_0x481c('0x4b')]['id']}})[_0x481c('0x2a')](handleEntityNotFound(_0x591d3c,null))[_0x481c('0x2a')](function(_0x5e9517){if(_0x5e9517){return _0x5e9517[_0x481c('0x89')](_0x45ac7b['query'][_0x481c('0x68')])[_0x481c('0x2a')](function(){if(_['isArray'](_0x45ac7b[_0x481c('0x36')][_0x481c('0x68')])){for(var _0x288fc0=0x0;_0x288fc0<_0x45ac7b[_0x481c('0x36')][_0x481c('0x68')][_0x481c('0x3a')];_0x288fc0+=0x1){socket[_0x481c('0x72')](_0x481c('0x86'),{'UserId':Number(_0x45ac7b[_0x481c('0x36')][_0x481c('0x68')][_0x288fc0]),'WhatsappQueueId':Number(_0x45ac7b[_0x481c('0x4b')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x45ac7b[_0x481c('0x36')][_0x481c('0x68')]),'WhatsappQueueId':Number(_0x45ac7b[_0x481c('0x4b')]['id'])});}});}})[_0x481c('0x2a')](respondWithStatusCode(_0x591d3c,null))[_0x481c('0x49')](handleError(_0x591d3c,null));};exports['getAgents']=function(_0x4a13af,_0x492be7,_0x2409f5){var _0x5b4f9b={};var _0x364c50={};var _0x2161ff;var _0xf38090;return db[_0x481c('0x32')]['findOne']({'where':{'id':_0x4a13af[_0x481c('0x4b')]['id']}})[_0x481c('0x2a')](handleEntityNotFound(_0x492be7,null))[_0x481c('0x2a')](function(_0x23c7ab){if(_0x23c7ab){_0x2161ff=_0x23c7ab;_0x364c50['model']=_[_0x481c('0x4c')](db[_0x481c('0x5c')][_0x481c('0x33')]);_0x364c50['query']=_[_0x481c('0x4c')](_0x4a13af[_0x481c('0x36')]);_0x364c50[_0x481c('0x40')]=_[_0x481c('0x37')](_0x364c50[_0x481c('0x35')],_0x364c50['query']);_0x5b4f9b[_0x481c('0x38')]=_['intersection'](_0x364c50[_0x481c('0x35')],qs[_0x481c('0x39')](_0x4a13af[_0x481c('0x36')]['fields']));_0x5b4f9b[_0x481c('0x38')]=_0x5b4f9b[_0x481c('0x38')][_0x481c('0x3a')]?_0x5b4f9b[_0x481c('0x38')]:_0x364c50[_0x481c('0x35')];_0x5b4f9b['order']=qs['sort'](_0x4a13af['query'][_0x481c('0x3e')]);_0x5b4f9b[_0x481c('0x3f')]=qs['filters'](_[_0x481c('0x41')](_0x4a13af[_0x481c('0x36')],_0x364c50[_0x481c('0x40')]));if(_0x4a13af[_0x481c('0x36')][_0x481c('0x42')]){_0x5b4f9b['where']=_[_0x481c('0x45')](_0x5b4f9b[_0x481c('0x3f')],{'$or':_['map'](_0x5b4f9b[_0x481c('0x38')],function(_0x4eead6){var _0x21e1f8={};_0x21e1f8[_0x4eead6]={'$like':'%'+_0x4a13af[_0x481c('0x36')][_0x481c('0x42')]+'%'};return _0x21e1f8;})});}_0x5b4f9b=_['merge']({},_0x5b4f9b,_0x4a13af[_0x481c('0x4e')]);return _0x2161ff[_0x481c('0x8a')](_0x5b4f9b);}})['then'](function(_0x2792e0){if(_0x2792e0){_0xf38090=_0x2792e0[_0x481c('0x3a')];if(!_0x4a13af[_0x481c('0x36')]['hasOwnProperty'](_0x481c('0x3c'))){_0x5b4f9b['limit']=qs['limit'](_0x4a13af[_0x481c('0x36')][_0x481c('0x23')]);_0x5b4f9b[_0x481c('0x21')]=qs[_0x481c('0x21')](_0x4a13af[_0x481c('0x36')][_0x481c('0x21')]);}return _0x2161ff['getAgents'](_0x5b4f9b);}})[_0x481c('0x2a')](function(_0x3888fd){if(_0x3888fd){return _0x3888fd?{'count':_0xf38090,'rows':_0x3888fd}:null;}})['then'](respondWithResult(_0x492be7,null))[_0x481c('0x49')](handleError(_0x492be7,null));}; \ No newline at end of file +var _0x307e=['each','UserWhatsappQueue','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','Team','select','field','join','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','all','compact','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','sendStatus','error','stack','name','map','WhatsappQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','nolimit','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction'];(function(_0x406633,_0x190f5d){var _0x318f51=function(_0x305e03){while(--_0x305e03){_0x406633['push'](_0x406633['shift']());}};_0x318f51(++_0x190f5d);}(_0x307e,0x1b1));var _0xe307=function(_0x324cda,_0x4b5f65){_0x324cda=_0x324cda-0x0;var _0x2dd7ce=_0x307e[_0x324cda];return _0x2dd7ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe307('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe307('0x3'));var path=require(_0xe307('0x4'));var sox=require(_0xe307('0x5'));var csv=require(_0xe307('0x6'));var ejs=require(_0xe307('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe307('0x8'));var squel=require(_0xe307('0x9'));var crypto=require('crypto');var jsforce=require(_0xe307('0xa'));var deskjs=require(_0xe307('0xb'));var toCsv=require(_0xe307('0x6'));var querystring=require(_0xe307('0xc'));var Papa=require(_0xe307('0xd'));var Redis=require(_0xe307('0xe'));var authService=require(_0xe307('0xf'));var qs=require(_0xe307('0x10'));var as=require(_0xe307('0x11'));var hardwareService=require(_0xe307('0x12'));var logger=require('../../config/logger')(_0xe307('0x13'));var utils=require(_0xe307('0x14'));var config=require(_0xe307('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe307('0x16'))['db'];config[_0xe307('0x17')]=_[_0xe307('0x18')](config[_0xe307('0x17')],{'host':_0xe307('0x19'),'port':0x18eb});var socket=require(_0xe307('0x1a'))(new Redis(config[_0xe307('0x17')]));require(_0xe307('0x1b'))[_0xe307('0x1c')](socket);function respondWithStatusCode(_0x3f9134,_0x58319f){_0x58319f=_0x58319f||0xcc;return function(_0x754f6a){if(_0x754f6a){return _0x3f9134['sendStatus'](_0x58319f);}return _0x3f9134[_0xe307('0x1d')](_0x58319f)[_0xe307('0x1e')]();};}function respondWithResult(_0x39e8e4,_0x1d4842){_0x1d4842=_0x1d4842||0xc8;return function(_0x2d3e07){if(_0x2d3e07){return _0x39e8e4[_0xe307('0x1d')](_0x1d4842)[_0xe307('0x1f')](_0x2d3e07);}};}function respondWithFilteredResult(_0x347d69,_0x505f42){return function(_0x1185f1){if(_0x1185f1){var _0x2b08d2=typeof _0x505f42['offset']===_0xe307('0x20')&&typeof _0x505f42['limit']===_0xe307('0x20');var _0x1a2fe6=_0x1185f1[_0xe307('0x21')];var _0x4752fc=_0x2b08d2?0x0:_0x505f42[_0xe307('0x22')];var _0xf26c73=_0x2b08d2?_0x1185f1['count']:_0x505f42[_0xe307('0x22')]+_0x505f42[_0xe307('0x23')];var _0x37b006;if(_0xf26c73>=_0x1a2fe6){_0xf26c73=_0x1a2fe6;_0x37b006=0xc8;}else{_0x37b006=0xce;}_0x347d69['status'](_0x37b006);return _0x347d69[_0xe307('0x24')](_0xe307('0x25'),_0x4752fc+'-'+_0xf26c73+'/'+_0x1a2fe6)[_0xe307('0x1f')](_0x1185f1);}return null;};}function patchUpdates(_0x127563){return function(_0xe90b75){try{jsonpatch[_0xe307('0x26')](_0xe90b75,_0x127563,!![]);}catch(_0x4a71b1){return BPromise[_0xe307('0x27')](_0x4a71b1);}return _0xe90b75[_0xe307('0x28')]();};}function saveUpdates(_0x333890,_0x1fcc4d){return function(_0x25b6f1){if(_0x25b6f1){return _0x25b6f1[_0xe307('0x29')](_0x333890)['then'](function(_0x4f9d55){return _0x4f9d55;});}return null;};}function removeEntity(_0x21e055,_0x585264){return function(_0x43fb96){if(_0x43fb96){return _0x43fb96[_0xe307('0x2a')]()[_0xe307('0x2b')](function(){var _0x33bb27=_0x43fb96[_0xe307('0x2c')]({'plain':!![]});var _0x2a8c3e=_0xe307('0x2d');return db['UserProfileResource'][_0xe307('0x2a')]({'where':{'type':_0x2a8c3e,'resourceId':_0x33bb27['id']}})['then'](function(){return _0x43fb96;});})[_0xe307('0x2b')](function(){_0x21e055[_0xe307('0x1d')](0xcc)[_0xe307('0x1e')]();});}};}function handleEntityNotFound(_0xb6f042,_0xefa389){return function(_0x5cea9a){if(!_0x5cea9a){_0xb6f042[_0xe307('0x2e')](0x194);}return _0x5cea9a;};}function handleError(_0x1f6947,_0x34d071){_0x34d071=_0x34d071||0x1f4;return function(_0x467990){logger[_0xe307('0x2f')](_0x467990[_0xe307('0x30')]);if(_0x467990[_0xe307('0x31')]){delete _0x467990[_0xe307('0x31')];}_0x1f6947['status'](_0x34d071)['send'](_0x467990);};}exports['index']=function(_0x53d38f,_0x4f4d85){var _0x1fefab={},_0x417d63={},_0x5ea442={'count':0x0,'rows':[]};var _0x5e61f1=_[_0xe307('0x32')](db[_0xe307('0x33')]['rawAttributes'],function(_0x22004c){return{'name':_0x22004c[_0xe307('0x34')],'type':_0x22004c[_0xe307('0x35')][_0xe307('0x36')]};});_0x417d63[_0xe307('0x37')]=_[_0xe307('0x32')](_0x5e61f1,'name');_0x417d63[_0xe307('0x38')]=_[_0xe307('0x39')](_0x53d38f[_0xe307('0x38')]);_0x417d63['filters']=_[_0xe307('0x3a')](_0x417d63[_0xe307('0x37')],_0x417d63[_0xe307('0x38')]);_0x1fefab[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x417d63['model'],qs[_0xe307('0x3c')](_0x53d38f['query']['fields']));_0x1fefab[_0xe307('0x3b')]=_0x1fefab[_0xe307('0x3b')][_0xe307('0x3d')]?_0x1fefab['attributes']:_0x417d63[_0xe307('0x37')];if(!_0x53d38f[_0xe307('0x38')][_0xe307('0x3e')]('nolimit')){_0x1fefab[_0xe307('0x23')]=qs[_0xe307('0x23')](_0x53d38f[_0xe307('0x38')]['limit']);_0x1fefab[_0xe307('0x22')]=qs['offset'](_0x53d38f[_0xe307('0x38')][_0xe307('0x22')]);}_0x1fefab[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0x53d38f[_0xe307('0x38')]['sort']);_0x1fefab['where']=qs[_0xe307('0x41')](_[_0xe307('0x42')](_0x53d38f['query'],_0x417d63[_0xe307('0x41')]),_0x5e61f1);if(_0x53d38f[_0xe307('0x38')][_0xe307('0x43')]){_0x1fefab[_0xe307('0x44')]=_['merge'](_0x1fefab['where'],{'$or':_['map'](_0x5e61f1,function(_0x389619){if(_0x389619[_0xe307('0x35')]!=='VIRTUAL'){var _0x231bdf={};_0x231bdf[_0x389619[_0xe307('0x31')]]={'$like':'%'+_0x53d38f[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0x231bdf;}})});}_0x1fefab=_[_0xe307('0x45')]({},_0x1fefab,_0x53d38f[_0xe307('0x46')]);var _0x399ca6={'where':_0x1fefab[_0xe307('0x44')]};return db[_0xe307('0x33')]['count'](_0x399ca6)[_0xe307('0x2b')](function(_0x5e3acc){_0x5ea442[_0xe307('0x21')]=_0x5e3acc;if(_0x53d38f['query'][_0xe307('0x47')]){_0x1fefab['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x1fefab);})[_0xe307('0x2b')](function(_0x604f05){_0x5ea442[_0xe307('0x48')]=_0x604f05;return _0x5ea442;})[_0xe307('0x2b')](respondWithFilteredResult(_0x4f4d85,_0x1fefab))[_0xe307('0x49')](handleError(_0x4f4d85,null));};exports[_0xe307('0x4a')]=function(_0x165e61,_0x1ccd4b){var _0x278472={'raw':!![],'where':{'id':_0x165e61[_0xe307('0x4b')]['id']}},_0x15fdd6={};_0x15fdd6[_0xe307('0x37')]=_[_0xe307('0x39')](db[_0xe307('0x33')][_0xe307('0x4c')]);_0x15fdd6[_0xe307('0x38')]=_[_0xe307('0x39')](_0x165e61['query']);_0x15fdd6[_0xe307('0x41')]=_[_0xe307('0x3a')](_0x15fdd6['model'],_0x15fdd6[_0xe307('0x38')]);_0x278472[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x15fdd6['model'],qs['fields'](_0x165e61[_0xe307('0x38')]['fields']));_0x278472[_0xe307('0x3b')]=_0x278472[_0xe307('0x3b')][_0xe307('0x3d')]?_0x278472[_0xe307('0x3b')]:_0x15fdd6[_0xe307('0x37')];if(_0x165e61[_0xe307('0x38')]['includeAll']){_0x278472[_0xe307('0x4d')]=[{'all':!![]}];}_0x278472=_[_0xe307('0x45')]({},_0x278472,_0x165e61['options']);return db[_0xe307('0x33')][_0xe307('0x4e')](_0x278472)[_0xe307('0x2b')](handleEntityNotFound(_0x1ccd4b,null))['then'](respondWithResult(_0x1ccd4b,null))[_0xe307('0x49')](handleError(_0x1ccd4b,null));};exports[_0xe307('0x4f')]=function(_0x287097,_0x149408){return db['WhatsappQueue'][_0xe307('0x4f')](_0x287097['body'],{})[_0xe307('0x2b')](function(_0x1f30a4){var _0xeaa5c6=_0x287097['user']['get']({'plain':!![]});if(!_0xeaa5c6)throw new Error(_0xe307('0x50'));if(_0xeaa5c6['role']===_0xe307('0x51')){var _0x22c2af=_0x1f30a4[_0xe307('0x2c')]({'plain':!![]});var _0xac692f=_0xe307('0x2d');return db['UserProfileSection'][_0xe307('0x4e')]({'where':{'name':_0xac692f,'userProfileId':_0xeaa5c6[_0xe307('0x52')]},'raw':!![]})[_0xe307('0x2b')](function(_0x3276f9){if(_0x3276f9&&_0x3276f9[_0xe307('0x53')]===0x0){return db[_0xe307('0x54')][_0xe307('0x4f')]({'name':_0x22c2af[_0xe307('0x31')],'resourceId':_0x22c2af['id'],'type':_0x3276f9[_0xe307('0x31')],'sectionId':_0x3276f9['id']},{})[_0xe307('0x2b')](function(){return _0x1f30a4;});}else{return _0x1f30a4;}})[_0xe307('0x49')](function(_0x433b60){logger[_0xe307('0x2f')](_0xe307('0x55'),_0x433b60);throw _0x433b60;});}return _0x1f30a4;})[_0xe307('0x2b')](respondWithResult(_0x149408,0xc9))['catch'](handleError(_0x149408,null));};exports[_0xe307('0x29')]=function(_0x3bf431,_0x4cd617){if(_0x3bf431[_0xe307('0x56')]['id']){delete _0x3bf431[_0xe307('0x56')]['id'];}return db[_0xe307('0x33')][_0xe307('0x4e')]({'where':{'id':_0x3bf431[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x4cd617,null))[_0xe307('0x2b')](saveUpdates(_0x3bf431[_0xe307('0x56')],null))[_0xe307('0x2b')](respondWithResult(_0x4cd617,null))[_0xe307('0x49')](handleError(_0x4cd617,null));};exports[_0xe307('0x2a')]=function(_0x4f8e04,_0x48941a){return db[_0xe307('0x33')]['find']({'where':{'id':_0x4f8e04[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x48941a,null))[_0xe307('0x2b')](removeEntity(_0x48941a,null))[_0xe307('0x49')](handleError(_0x48941a,null));};exports[_0xe307('0x57')]=function(_0x1d6adc,_0x57e86b){return db[_0xe307('0x33')][_0xe307('0x57')]()[_0xe307('0x2b')](respondWithResult(_0x57e86b,null))[_0xe307('0x49')](handleError(_0x57e86b,null));};exports[_0xe307('0x58')]=function(_0x448fbd,_0x5dc0ba,_0x138975){var _0x31507b={'raw':!![],'where':{}},_0x2256ee={},_0x4687f4;return db[_0xe307('0x33')][_0xe307('0x59')]({'where':{'id':_0x448fbd[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x5dc0ba,null))['then'](function(_0x4a77cd){if(_0x4a77cd){_0x4687f4=_0x4a77cd['get']({'plain':!![]});_0x2256ee[_0xe307('0x37')]=_[_0xe307('0x39')](db['UserWhatsappQueue'][_0xe307('0x4c')]);_0x2256ee['query']=_[_0xe307('0x39')](_0x448fbd[_0xe307('0x38')]);_0x2256ee[_0xe307('0x41')]=_[_0xe307('0x3a')](_0x2256ee[_0xe307('0x37')],_0x2256ee[_0xe307('0x38')]);_0x31507b[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x2256ee['model'],qs[_0xe307('0x3c')](_0x448fbd[_0xe307('0x38')]['fields']));_0x31507b[_0xe307('0x3b')]=_0x31507b[_0xe307('0x3b')][_0xe307('0x3d')]?_0x31507b[_0xe307('0x3b')]:_0x2256ee[_0xe307('0x37')];if(!_0x448fbd[_0xe307('0x38')][_0xe307('0x3e')]('nolimit')){_0x31507b['limit']=qs[_0xe307('0x23')](_0x448fbd[_0xe307('0x38')]['limit']);_0x31507b['offset']=qs[_0xe307('0x22')](_0x448fbd[_0xe307('0x38')][_0xe307('0x22')]);}_0x31507b[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0x448fbd[_0xe307('0x38')][_0xe307('0x40')]);_0x31507b[_0xe307('0x44')]=qs[_0xe307('0x41')](_['pick'](_0x448fbd[_0xe307('0x38')],_0x2256ee['filters']));_0x31507b[_0xe307('0x44')][_0xe307('0x5a')]=_0x4a77cd['id'];if(_0x448fbd['query']['filter']){_0x31507b[_0xe307('0x44')]=_[_0xe307('0x45')](_0x31507b['where'],{'$or':_[_0xe307('0x32')](_0x31507b['attributes'],function(_0xc9e219){var _0x207961={};_0x207961[_0xc9e219]={'$like':'%'+_0x448fbd[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0x207961;})});}_0x31507b=_[_0xe307('0x45')]({},_0x31507b,_0x448fbd[_0xe307('0x46')]);return db['UserWhatsappQueue'][_0xe307('0x5b')](_0x31507b);}})[_0xe307('0x2b')](function(_0x43f5e1){if(_0x43f5e1){return db[_0xe307('0x5c')][_0xe307('0x5d')]({'where':{'id':_[_0xe307('0x32')](_0x43f5e1,_0xe307('0x5e')),'role':_0xe307('0x5f')},'attributes':['id',_0xe307('0x31'),_0xe307('0x60'),_0xe307('0x61'),_0xe307('0x62')]});}})[_0xe307('0x2b')](function(_0x5310ff){if(_0x5310ff){return{'count':_0x5310ff[_0xe307('0x21')],'rows':_[_0xe307('0x32')](_0x5310ff[_0xe307('0x48')],function(_0x4f0356){return{'membername':_0x4f0356['name'],'UserId':_0x4f0356['id'],'queue_name':_0x4687f4[_0xe307('0x31')],'WhatsappQueueId':_0x4687f4['id'],'interface':util[_0xe307('0x63')]('%s/%s',_0xe307('0x64'),_0x4f0356[_0xe307('0x31')]),'penalty':0x0,'paused':_0x4f0356[_0xe307('0x60')],'createdAt':_0x4f0356[_0xe307('0x62')],'updatedAt':_0x4f0356['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe307('0x2b')](respondWithFilteredResult(_0x5dc0ba,_0x31507b))[_0xe307('0x49')](handleError(_0x5dc0ba,null));};exports[_0xe307('0x65')]=function(_0x373c82,_0x8639da,_0x45a59c){var _0x36dedf={};var _0x216765={};var _0x263843;var _0xdaa4d1;return db[_0xe307('0x33')][_0xe307('0x59')]({'where':{'id':_0x373c82[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x8639da,null))[_0xe307('0x2b')](function(_0x88c6ba){if(_0x88c6ba){_0x263843=_0x88c6ba;_0x216765[_0xe307('0x37')]=_[_0xe307('0x39')](db['Team'][_0xe307('0x4c')]);_0x216765[_0xe307('0x38')]=_[_0xe307('0x39')](_0x373c82[_0xe307('0x38')]);_0x216765[_0xe307('0x41')]=_[_0xe307('0x3a')](_0x216765[_0xe307('0x37')],_0x216765[_0xe307('0x38')]);_0x36dedf['attributes']=_['intersection'](_0x216765[_0xe307('0x37')],qs[_0xe307('0x3c')](_0x373c82['query']['fields']));_0x36dedf[_0xe307('0x3b')]=_0x36dedf[_0xe307('0x3b')][_0xe307('0x3d')]?_0x36dedf[_0xe307('0x3b')]:_0x216765['model'];_0x36dedf[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0x373c82[_0xe307('0x38')][_0xe307('0x40')]);_0x36dedf['where']=qs['filters'](_[_0xe307('0x42')](_0x373c82[_0xe307('0x38')],_0x216765[_0xe307('0x41')]));if(_0x373c82[_0xe307('0x38')]['filter']){_0x36dedf[_0xe307('0x44')]=_['merge'](_0x36dedf['where'],{'$or':_[_0xe307('0x32')](_0x36dedf[_0xe307('0x3b')],function(_0x52091f){var _0x30407c={};_0x30407c[_0x52091f]={'$like':'%'+_0x373c82[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0x30407c;})});}_0x36dedf=_[_0xe307('0x45')]({},_0x36dedf,_0x373c82['options']);return _0x263843[_0xe307('0x65')](_0x36dedf);}})['then'](function(_0x4c56dc){if(_0x4c56dc){_0xdaa4d1=_0x4c56dc[_0xe307('0x3d')];if(!_0x373c82[_0xe307('0x38')][_0xe307('0x3e')](_0xe307('0x66'))){_0x36dedf[_0xe307('0x23')]=qs[_0xe307('0x23')](_0x373c82[_0xe307('0x38')][_0xe307('0x23')]);_0x36dedf[_0xe307('0x22')]=qs[_0xe307('0x22')](_0x373c82['query'][_0xe307('0x22')]);}return _0x263843[_0xe307('0x65')](_0x36dedf);}})[_0xe307('0x2b')](function(_0x467737){if(_0x467737){return _0x467737?{'count':_0xdaa4d1,'rows':_0x467737}:null;}})[_0xe307('0x2b')](respondWithResult(_0x8639da,null))[_0xe307('0x49')](handleError(_0x8639da,null));};exports[_0xe307('0x67')]=function(_0x54e7fb,_0x364257,_0x313b0f){var _0x5a8256=_0x54e7fb[_0xe307('0x56')][_0xe307('0x68')];return db['Team'][_0xe307('0x5b')]({'where':{'id':_0x5a8256},'attributes':['id'],'include':[{'model':db[_0xe307('0x5c')],'as':'Agents','attributes':['id','name','online',_0xe307('0x69'),_0xe307('0x6a')],'raw':!![]}]})[_0xe307('0x2b')](function(_0x1eae8e){if(_0x1eae8e){var _0x5e1f76=_[_0xe307('0x6b')](_0x1eae8e,function(_0x2061d6){var _0x2e6c9b=_0x2061d6[_0xe307('0x2c')]({'plain':!![]});return _0x2e6c9b[_0xe307('0x6c')];});return db[_0xe307('0x33')][_0xe307('0x4e')]({'where':{'id':_0x54e7fb[_0xe307('0x4b')]['id']}})['then'](function(_0x54e7ce){return db[_0xe307('0x6d')][_0xe307('0x6e')](function(_0x2125b4){return _0x54e7ce[_0xe307('0x67')](_0x5a8256,{'transaction':_0x2125b4})[_0xe307('0x2b')](function(){return BPromise[_0xe307('0x6f')](_0x5e1f76,function(_0xb370fd){return db[_0xe307('0x70')][_0xe307('0x71')]({'where':{'UserId':_0xb370fd['id'],'WhatsappQueueId':_0x54e7fb['params']['id']},'transaction':_0x2125b4});});})[_0xe307('0x2b')](function(){_0x5e1f76[_0xe307('0x72')](function(_0x321c56){socket['emit'](_0xe307('0x73'),{'UserId':_0x321c56['id'],'WhatsappQueueId':_0x54e7ce['id']});});});});});}})[_0xe307('0x2b')](respondWithStatusCode(_0x364257,null))[_0xe307('0x49')](handleError(_0x364257,null));};exports[_0xe307('0x74')]=function(_0x4d7d25,_0x26eb83,_0x12a00f){return db[_0xe307('0x75')][_0xe307('0x5b')]({'where':{'id':_0x4d7d25['query'][_0xe307('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe307('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xe307('0x2b')](handleEntityNotFound(_0x26eb83,null))[_0xe307('0x2b')](function(_0x4a5307){var _0x3971d7=_[_0xe307('0x32')](_0x4a5307,'id');var _0x3d336b=[];var _0x382c03=[];var _0x3c3cdb=squel[_0xe307('0x76')]();_0x3c3cdb[_0xe307('0x77')]('tq.TeamId')['from']('team_has_whatsapp_queues','tq')[_0xe307('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe307('0x44')](_0xe307('0x79'),_0x4d7d25[_0xe307('0x4b')]['id']);for(var _0x349bb5=0x0;_0x349bb5<_0x4a5307[_0xe307('0x3d')];_0x349bb5+=0x1){let _0x35d1db=_0x4a5307[_0x349bb5];for(var _0x7d07ad=0x0;_0x7d07ad<_0x35d1db[_0xe307('0x6c')][_0xe307('0x3d')];_0x7d07ad+=0x1){let _0x6ccd0e=_0x35d1db[_0xe307('0x6c')][_0x7d07ad];var _0x57b444=_0x3c3cdb['clone']();_0x57b444[_0xe307('0x44')](_0xe307('0x7a'),_0x6ccd0e['id']);_0x382c03[_0xe307('0x7b')](db[_0xe307('0x6d')][_0xe307('0x38')](_0x57b444[_0xe307('0x7c')](),{'type':db[_0xe307('0x6d')]['QueryTypes'][_0xe307('0x7d')]})['then'](function(_0x42bb51){if(_0x42bb51[_0xe307('0x3d')]===0x1){return _0x6ccd0e['id'];}else{var _0x54bf3e=_['every'](_[_0xe307('0x32')](_0x42bb51,'TeamId'),function(_0x3f5684){return _['includes'](_0x3971d7,_0x3f5684);});if(_0x54bf3e){return _0x6ccd0e['id'];}}}));}}return BPromise[_0xe307('0x7e')](_0x382c03)['then'](function(_0x1f3b44){_0x3d336b=_(_0x3d336b)['union'](_0x1f3b44)[_0xe307('0x7f')]()['value']();return db[_0xe307('0x33')]['find']({'where':{'id':_0x4d7d25[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](function(_0x21adeb){return db[_0xe307('0x6d')][_0xe307('0x6e')](function(_0x14950a){return _0x21adeb[_0xe307('0x74')](_0x4d7d25[_0xe307('0x38')]['ids'],{'transaction':_0x14950a})[_0xe307('0x2b')](function(){if(!_['isEmpty'](_0x3d336b)){return _0x21adeb['removeAgents'](_0x3d336b,{'transaction':_0x14950a});}})[_0xe307('0x2b')](function(){_0x3d336b['forEach'](function(_0x298719){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x298719,'WhatsappQueueId':_0x21adeb['id']});});});});});});})[_0xe307('0x2b')](respondWithStatusCode(_0x26eb83,null))[_0xe307('0x49')](handleError(_0x26eb83,null));};exports[_0xe307('0x80')]=function(_0x355cf3,_0x89618a,_0x4d0bce){return db['WhatsappQueue'][_0xe307('0x4e')]({'where':{'id':_0x355cf3[_0xe307('0x4b')]['id']}})['then'](handleEntityNotFound(_0x89618a,null))[_0xe307('0x2b')](function(_0x4bb75d){if(_0x4bb75d){return _0x4bb75d[_0xe307('0x80')](_0x355cf3[_0xe307('0x56')][_0xe307('0x68')],_[_0xe307('0x81')](_0x355cf3[_0xe307('0x56')],[_0xe307('0x68'),'id'])||{})[_0xe307('0x82')](function(_0x1925c5){for(var _0x2344e7=0x0;_0x2344e7<_0x355cf3[_0xe307('0x56')][_0xe307('0x68')][_0xe307('0x3d')];_0x2344e7+=0x1){socket[_0xe307('0x83')](_0xe307('0x73'),{'UserId':Number(_0x355cf3[_0xe307('0x56')][_0xe307('0x68')][_0x2344e7]),'WhatsappQueueId':Number(_0x355cf3[_0xe307('0x4b')]['id'])});}return _0x1925c5;});}})[_0xe307('0x2b')](respondWithResult(_0x89618a,null))[_0xe307('0x49')](handleError(_0x89618a,null));};exports[_0xe307('0x84')]=function(_0x352590,_0x2edf54,_0x57283e){return db[_0xe307('0x33')][_0xe307('0x4e')]({'where':{'id':_0x352590[_0xe307('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2edf54,null))[_0xe307('0x2b')](function(_0x3d3d75){if(_0x3d3d75){return _0x3d3d75[_0xe307('0x84')](_0x352590[_0xe307('0x38')][_0xe307('0x68')])[_0xe307('0x2b')](function(){if(_[_0xe307('0x85')](_0x352590[_0xe307('0x38')][_0xe307('0x68')])){for(var _0x589a39=0x0;_0x589a39<_0x352590[_0xe307('0x38')][_0xe307('0x68')][_0xe307('0x3d')];_0x589a39+=0x1){socket[_0xe307('0x83')](_0xe307('0x86'),{'UserId':Number(_0x352590[_0xe307('0x38')][_0xe307('0x68')][_0x589a39]),'WhatsappQueueId':Number(_0x352590[_0xe307('0x4b')]['id'])});}}else{socket['emit'](_0xe307('0x86'),{'UserId':Number(_0x352590[_0xe307('0x38')][_0xe307('0x68')]),'WhatsappQueueId':Number(_0x352590[_0xe307('0x4b')]['id'])});}});}})[_0xe307('0x2b')](respondWithStatusCode(_0x2edf54,null))[_0xe307('0x49')](handleError(_0x2edf54,null));};exports[_0xe307('0x87')]=function(_0xdcda69,_0x33cf7f,_0x3561ef){var _0x379c4e={};var _0x3593c7={};var _0xd03cf5;var _0x447511;return db[_0xe307('0x33')][_0xe307('0x59')]({'where':{'id':_0xdcda69[_0xe307('0x4b')]['id']}})[_0xe307('0x2b')](handleEntityNotFound(_0x33cf7f,null))['then'](function(_0x5885bc){if(_0x5885bc){_0xd03cf5=_0x5885bc;_0x3593c7[_0xe307('0x37')]=_[_0xe307('0x39')](db[_0xe307('0x5c')][_0xe307('0x4c')]);_0x3593c7['query']=_['keys'](_0xdcda69['query']);_0x3593c7['filters']=_['intersection'](_0x3593c7[_0xe307('0x37')],_0x3593c7['query']);_0x379c4e[_0xe307('0x3b')]=_[_0xe307('0x3a')](_0x3593c7[_0xe307('0x37')],qs[_0xe307('0x3c')](_0xdcda69[_0xe307('0x38')]['fields']));_0x379c4e[_0xe307('0x3b')]=_0x379c4e[_0xe307('0x3b')]['length']?_0x379c4e['attributes']:_0x3593c7['model'];_0x379c4e[_0xe307('0x3f')]=qs[_0xe307('0x40')](_0xdcda69['query'][_0xe307('0x40')]);_0x379c4e[_0xe307('0x44')]=qs[_0xe307('0x41')](_['pick'](_0xdcda69[_0xe307('0x38')],_0x3593c7[_0xe307('0x41')]));if(_0xdcda69['query'][_0xe307('0x43')]){_0x379c4e[_0xe307('0x44')]=_[_0xe307('0x45')](_0x379c4e[_0xe307('0x44')],{'$or':_[_0xe307('0x32')](_0x379c4e[_0xe307('0x3b')],function(_0x6947e9){var _0xd99e4d={};_0xd99e4d[_0x6947e9]={'$like':'%'+_0xdcda69[_0xe307('0x38')][_0xe307('0x43')]+'%'};return _0xd99e4d;})});}_0x379c4e=_[_0xe307('0x45')]({},_0x379c4e,_0xdcda69[_0xe307('0x46')]);return _0xd03cf5[_0xe307('0x87')](_0x379c4e);}})[_0xe307('0x2b')](function(_0x231522){if(_0x231522){_0x447511=_0x231522[_0xe307('0x3d')];if(!_0xdcda69[_0xe307('0x38')]['hasOwnProperty'](_0xe307('0x66'))){_0x379c4e[_0xe307('0x23')]=qs['limit'](_0xdcda69['query'][_0xe307('0x23')]);_0x379c4e['offset']=qs['offset'](_0xdcda69[_0xe307('0x38')][_0xe307('0x22')]);}return _0xd03cf5[_0xe307('0x87')](_0x379c4e);}})[_0xe307('0x2b')](function(_0xc170af){if(_0xc170af){return _0xc170af?{'count':_0x447511,'rows':_0xc170af}:null;}})[_0xe307('0x2b')](respondWithResult(_0x33cf7f,null))['catch'](handleError(_0x33cf7f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f01dd79..42ca789 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 _0x436f=['hasOwnProperty','hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0xb3a3be,_0x320be5){var _0x29bdd9=function(_0x3e489e){while(--_0x3e489e){_0xb3a3be['push'](_0xb3a3be['shift']());}};_0x29bdd9(++_0x320be5);}(_0x436f,0x83));var _0xf436=function(_0x5216e6,_0x143963){_0x5216e6=_0x5216e6-0x0;var _0x51c125=_0x436f[_0x5216e6];return _0x51c125;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xf436('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf436('0x1'),'afterUpdate':_0xf436('0x2'),'afterDestroy':_0xf436('0x3')};function emitEvent(_0x186478){return function(_0x3cd9bd,_0x23ecf4,_0x21ed9c){WhatsappQueueEvents[_0xf436('0x4')](_0x186478+':'+_0x3cd9bd['id'],_0x3cd9bd);WhatsappQueueEvents[_0xf436('0x4')](_0x186478,_0x3cd9bd);_0x21ed9c(null);};}for(var e in events){if(events[_0xf436('0x5')](e)){var event=events[e];WhatsappQueue[_0xf436('0x6')](e,emitEvent(event));}}module[_0xf436('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6117=['../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x49030c,_0x4f7165){var _0x5004bf=function(_0x33b7a5){while(--_0x33b7a5){_0x49030c['push'](_0x49030c['shift']());}};_0x5004bf(++_0x4f7165);}(_0x6117,0x190));var _0x7611=function(_0x6d77ec,_0x338e01){_0x6d77ec=_0x6d77ec-0x0;var _0x567ac6=_0x6117[_0x6d77ec];return _0x567ac6;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x7611('0x0'))['db'][_0x7611('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7611('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7611('0x3'),'afterDestroy':_0x7611('0x4')};function emitEvent(_0x2be6c5){return function(_0x248dfd,_0x1effab,_0x3cfd7b){WhatsappQueueEvents[_0x7611('0x5')](_0x2be6c5+':'+_0x248dfd['id'],_0x248dfd);WhatsappQueueEvents[_0x7611('0x5')](_0x2be6c5,_0x248dfd);_0x3cfd7b(null);};}for(var e in events){if(events[_0x7611('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7611('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9e00ce5..72bfcce 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 _0x4ccc=['../../config/logger','api','moment','request-promise','path','rimraf','./whatsappQueue.attributes','exports','lodash'];(function(_0x558f73,_0x3419a2){var _0x1ff53e=function(_0x2e487a){while(--_0x2e487a){_0x558f73['push'](_0x558f73['shift']());}};_0x1ff53e(++_0x3419a2);}(_0x4ccc,0x116));var _0xc4cc=function(_0x3acecd,_0x1db973){_0x3acecd=_0x3acecd-0x0;var _0x5b92af=_0x4ccc[_0x3acecd];return _0x5b92af;};'use strict';var _=require(_0xc4cc('0x0'));var util=require('util');var logger=require(_0xc4cc('0x1'))(_0xc4cc('0x2'));var moment=require(_0xc4cc('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4cc('0x4'));var fs=require('fs');var path=require(_0xc4cc('0x5'));var rimraf=require(_0xc4cc('0x6'));var config=require('../../config/environment');var attributes=require(_0xc4cc('0x7'));module[_0xc4cc('0x8')]=function(_0x4efaec,_0xe6d2a4){return _0x4efaec['define']('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca31=['path','rimraf','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xca31,0xae));var _0x1ca3=function(_0x168b64,_0x3bd2a8){_0x168b64=_0x168b64-0x0;var _0x298845=_0xca31[_0x168b64];return _0x298845;};'use strict';var _=require(_0x1ca3('0x0'));var util=require('util');var logger=require(_0x1ca3('0x1'))(_0x1ca3('0x2'));var moment=require(_0x1ca3('0x3'));var BPromise=require(_0x1ca3('0x4'));var rp=require(_0x1ca3('0x5'));var fs=require('fs');var path=require(_0x1ca3('0x6'));var rimraf=require(_0x1ca3('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x1ca3('0x8')]=function(_0x1f35b8,_0x120b2b){return _0x1f35b8[_0x1ca3('0x9')](_0x1ca3('0xa'),attributes,{'tableName':_0x1ca3('0xb'),'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 1ab6f82..f866492 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 _0x3a0e=['then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappQueue','options','raw','where','attributes','limit','map','include','model','GetWhatsappQueue','debug','find','ShowWhatsappQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request'];(function(_0x146f59,_0x3cde63){var _0x26a630=function(_0x4138b9){while(--_0x4138b9){_0x146f59['push'](_0x146f59['shift']());}};_0x26a630(++_0x3cde63);}(_0x3a0e,0x177));var _0xe3a0=function(_0x379a66,_0x5c3446){_0x379a66=_0x379a66-0x0;var _0x3e96ba=_0x3a0e[_0x379a66];return _0x3e96ba;};'use strict';var _=require('lodash');var util=require(_0xe3a0('0x0'));var moment=require('moment');var BPromise=require(_0xe3a0('0x1'));var rs=require(_0xe3a0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3a0('0x3'))['db'];var utils=require(_0xe3a0('0x4'));var logger=require(_0xe3a0('0x5'))(_0xe3a0('0x6'));var config=require(_0xe3a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe3a0('0x8')][_0xe3a0('0x9')]({'port':0x232a});config[_0xe3a0('0xa')]=_['defaults'](config['redis'],{'host':_0xe3a0('0xb'),'port':0x18eb});var socket=require(_0xe3a0('0xc'))(new Redis(config[_0xe3a0('0xa')]));require('./whatsappQueue.socket')[_0xe3a0('0xd')](socket);function respondWithRpcPromise(_0x14b49a,_0x5015cd,_0x45774){return new BPromise(function(_0x36c721,_0x5bc6f9){return client[_0xe3a0('0xe')](_0x14b49a,_0x45774)[_0xe3a0('0xf')](function(_0xc7ea41){logger[_0xe3a0('0x10')](_0xe3a0('0x11'),_0x5015cd,'request\x20sent');logger['debug'](_0xe3a0('0x12'),_0x5015cd,_0xe3a0('0x13'),JSON[_0xe3a0('0x14')](_0xc7ea41));if(_0xc7ea41[_0xe3a0('0x15')]){if(_0xc7ea41['error'][_0xe3a0('0x16')]===0x1f4){logger[_0xe3a0('0x15')](_0xe3a0('0x11'),_0x5015cd,_0xc7ea41[_0xe3a0('0x15')][_0xe3a0('0x17')]);return _0x5bc6f9(_0xc7ea41[_0xe3a0('0x15')][_0xe3a0('0x17')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5015cd,_0xc7ea41[_0xe3a0('0x15')]['message']);return _0x36c721(_0xc7ea41['error'][_0xe3a0('0x17')]);}else{logger[_0xe3a0('0x10')](_0xe3a0('0x11'),_0x5015cd,_0xe3a0('0x13'));_0x36c721(_0xc7ea41[_0xe3a0('0x18')][_0xe3a0('0x17')]);}})[_0xe3a0('0x19')](function(_0x1cf27e){logger[_0xe3a0('0x15')](_0xe3a0('0x11'),_0x5015cd,_0x1cf27e);_0x5bc6f9(_0x1cf27e);});});}exports['GetWhatsappQueue']=function(_0x580737){var _0x1f912c=this;return new Promise(function(_0x4acf64,_0x36c1ff){return db[_0xe3a0('0x1a')]['findAll']({'raw':_0x580737[_0xe3a0('0x1b')]?_0x580737['options'][_0xe3a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x580737[_0xe3a0('0x1b')]?_0x580737[_0xe3a0('0x1b')][_0xe3a0('0x1d')]||null:null,'attributes':_0x580737[_0xe3a0('0x1b')]?_0x580737[_0xe3a0('0x1b')][_0xe3a0('0x1e')]||null:null,'limit':_0x580737[_0xe3a0('0x1b')]?_0x580737[_0xe3a0('0x1b')][_0xe3a0('0x1f')]||null:null,'include':_0x580737[_0xe3a0('0x1b')]?_0x580737[_0xe3a0('0x1b')]['include']?_[_0xe3a0('0x20')](_0x580737['options'][_0xe3a0('0x21')],function(_0x593e11){return{'model':db[_0x593e11['model']],'as':_0x593e11['as'],'attributes':_0x593e11['attributes'],'include':_0x593e11[_0xe3a0('0x21')]?_[_0xe3a0('0x20')](_0x593e11[_0xe3a0('0x21')],function(_0xa0860d){return{'model':db[_0xa0860d[_0xe3a0('0x22')]],'as':_0xa0860d['as'],'attributes':_0xa0860d[_0xe3a0('0x1e')],'include':_0xa0860d['include']?_[_0xe3a0('0x20')](_0xa0860d[_0xe3a0('0x21')],function(_0x53b4f5){return{'model':db[_0x53b4f5['model']],'as':_0x53b4f5['as'],'attributes':_0x53b4f5[_0xe3a0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe3a0('0xf')](function(_0x50b684){logger[_0xe3a0('0x10')](_0xe3a0('0x23'),_0x580737);logger[_0xe3a0('0x24')](_0xe3a0('0x23'),_0x580737,JSON[_0xe3a0('0x14')](_0x50b684));_0x4acf64(_0x50b684);})[_0xe3a0('0x19')](function(_0x11b60b){logger[_0xe3a0('0x15')](_0xe3a0('0x23'),_0x11b60b[_0xe3a0('0x17')],_0x580737);_0x36c1ff(_0x1f912c[_0xe3a0('0x15')](0x1f4,_0x11b60b[_0xe3a0('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x12cfa8){var _0x19ac9e=this;return new Promise(function(_0x5bc6a6,_0x532067){return db[_0xe3a0('0x1a')][_0xe3a0('0x25')]({'raw':_0x12cfa8[_0xe3a0('0x1b')]?_0x12cfa8[_0xe3a0('0x1b')][_0xe3a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x12cfa8[_0xe3a0('0x1b')]?_0x12cfa8[_0xe3a0('0x1b')][_0xe3a0('0x1d')]||null:null,'attributes':_0x12cfa8[_0xe3a0('0x1b')]?_0x12cfa8[_0xe3a0('0x1b')][_0xe3a0('0x1e')]||null:null,'include':_0x12cfa8[_0xe3a0('0x1b')]?_0x12cfa8[_0xe3a0('0x1b')][_0xe3a0('0x21')]?_['map'](_0x12cfa8['options'][_0xe3a0('0x21')],function(_0x223684){return{'model':db[_0x223684['model']],'as':_0x223684['as'],'attributes':_0x223684[_0xe3a0('0x1e')],'include':_0x223684[_0xe3a0('0x21')]?_[_0xe3a0('0x20')](_0x223684['include'],function(_0x3afe49){return{'model':db[_0x3afe49[_0xe3a0('0x22')]],'as':_0x3afe49['as'],'attributes':_0x3afe49[_0xe3a0('0x1e')],'include':_0x3afe49[_0xe3a0('0x21')]?_['map'](_0x3afe49[_0xe3a0('0x21')],function(_0x57ebe2){return{'model':db[_0x57ebe2['model']],'as':_0x57ebe2['as'],'attributes':_0x57ebe2[_0xe3a0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe3a0('0xf')](function(_0x272397){logger[_0xe3a0('0x10')](_0xe3a0('0x26'),_0x12cfa8);logger[_0xe3a0('0x24')](_0xe3a0('0x26'),_0x12cfa8,JSON[_0xe3a0('0x14')](_0x272397));_0x5bc6a6(_0x272397);})[_0xe3a0('0x19')](function(_0x191aee){logger['error'](_0xe3a0('0x26'),_0x191aee['message'],_0x12cfa8);_0x532067(_0x19ac9e[_0xe3a0('0x15')](0x1f4,_0x191aee['message']));});});}; \ No newline at end of file +var _0xcd3b=['map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xcd3b,0x1ce));var _0xbcd3=function(_0x4b68a0,_0x3c1f59){_0x4b68a0=_0x4b68a0-0x0;var _0x4c10d2=_0xcd3b[_0x4b68a0];return _0x4c10d2;};'use strict';var _=require(_0xbcd3('0x0'));var util=require(_0xbcd3('0x1'));var moment=require('moment');var BPromise=require(_0xbcd3('0x2'));var rs=require(_0xbcd3('0x3'));var fs=require('fs');var Redis=require(_0xbcd3('0x4'));var db=require(_0xbcd3('0x5'))['db'];var utils=require(_0xbcd3('0x6'));var logger=require(_0xbcd3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbcd3('0x8'));var client=jayson['client'][_0xbcd3('0x9')]({'port':0x232a});config[_0xbcd3('0xa')]=_[_0xbcd3('0xb')](config[_0xbcd3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcd3('0xc'))(new Redis(config['redis']));require(_0xbcd3('0xd'))[_0xbcd3('0xe')](socket);function respondWithRpcPromise(_0x1d1d24,_0x5bf1bb,_0x4f29f7){return new BPromise(function(_0x1f165e,_0x3e9e98){return client[_0xbcd3('0xf')](_0x1d1d24,_0x4f29f7)[_0xbcd3('0x10')](function(_0x1e065c){logger[_0xbcd3('0x11')](_0xbcd3('0x12'),_0x5bf1bb,'request\x20sent');logger[_0xbcd3('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5bf1bb,_0xbcd3('0x14'),JSON['stringify'](_0x1e065c));if(_0x1e065c[_0xbcd3('0x15')]){if(_0x1e065c[_0xbcd3('0x15')][_0xbcd3('0x16')]===0x1f4){logger[_0xbcd3('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x5bf1bb,_0x1e065c[_0xbcd3('0x15')][_0xbcd3('0x17')]);return _0x3e9e98(_0x1e065c['error'][_0xbcd3('0x17')]);}logger[_0xbcd3('0x15')](_0xbcd3('0x12'),_0x5bf1bb,_0x1e065c[_0xbcd3('0x15')]['message']);return _0x1f165e(_0x1e065c[_0xbcd3('0x15')][_0xbcd3('0x17')]);}else{logger['info'](_0xbcd3('0x12'),_0x5bf1bb,_0xbcd3('0x14'));_0x1f165e(_0x1e065c['result'][_0xbcd3('0x17')]);}})[_0xbcd3('0x18')](function(_0x4e7630){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5bf1bb,_0x4e7630);_0x3e9e98(_0x4e7630);});});}exports['GetWhatsappQueue']=function(_0x4f002e){var _0x9582da=this;return new Promise(function(_0x5d6dad,_0x338678){return db['WhatsappQueue'][_0xbcd3('0x19')]({'raw':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1c')]||null:null,'attributes':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e['options'][_0xbcd3('0x1d')]||null:null,'limit':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1e')]||null:null,'include':_0x4f002e[_0xbcd3('0x1a')]?_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x4f002e[_0xbcd3('0x1a')][_0xbcd3('0x1f')],function(_0x4694d6){return{'model':db[_0x4694d6[_0xbcd3('0x21')]],'as':_0x4694d6['as'],'attributes':_0x4694d6['attributes'],'include':_0x4694d6[_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x4694d6['include'],function(_0x5f214d){return{'model':db[_0x5f214d[_0xbcd3('0x21')]],'as':_0x5f214d['as'],'attributes':_0x5f214d[_0xbcd3('0x1d')],'include':_0x5f214d['include']?_[_0xbcd3('0x20')](_0x5f214d[_0xbcd3('0x1f')],function(_0x518864){return{'model':db[_0x518864[_0xbcd3('0x21')]],'as':_0x518864['as'],'attributes':_0x518864[_0xbcd3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbcd3('0x10')](function(_0x58e100){logger['info'](_0xbcd3('0x22'),_0x4f002e);logger[_0xbcd3('0x13')](_0xbcd3('0x22'),_0x4f002e,JSON[_0xbcd3('0x23')](_0x58e100));_0x5d6dad(_0x58e100);})['catch'](function(_0x2dc080){logger[_0xbcd3('0x15')](_0xbcd3('0x22'),_0x2dc080[_0xbcd3('0x17')],_0x4f002e);_0x338678(_0x9582da['error'](0x1f4,_0x2dc080[_0xbcd3('0x17')]));});});};exports[_0xbcd3('0x24')]=function(_0x3faf9d){var _0x1ecc9e=this;return new Promise(function(_0x48e7e,_0x322316){return db['WhatsappQueue'][_0xbcd3('0x25')]({'raw':_0x3faf9d['options']?_0x3faf9d[_0xbcd3('0x1a')][_0xbcd3('0x1b')]===undefined?!![]:![]:!![],'where':_0x3faf9d['options']?_0x3faf9d[_0xbcd3('0x1a')][_0xbcd3('0x1c')]||null:null,'attributes':_0x3faf9d[_0xbcd3('0x1a')]?_0x3faf9d[_0xbcd3('0x1a')]['attributes']||null:null,'include':_0x3faf9d[_0xbcd3('0x1a')]?_0x3faf9d['options'][_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x3faf9d[_0xbcd3('0x1a')]['include'],function(_0x5b9f1c){return{'model':db[_0x5b9f1c[_0xbcd3('0x21')]],'as':_0x5b9f1c['as'],'attributes':_0x5b9f1c['attributes'],'include':_0x5b9f1c[_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x5b9f1c[_0xbcd3('0x1f')],function(_0x1edc05){return{'model':db[_0x1edc05[_0xbcd3('0x21')]],'as':_0x1edc05['as'],'attributes':_0x1edc05[_0xbcd3('0x1d')],'include':_0x1edc05[_0xbcd3('0x1f')]?_[_0xbcd3('0x20')](_0x1edc05[_0xbcd3('0x1f')],function(_0x37a220){return{'model':db[_0x37a220[_0xbcd3('0x21')]],'as':_0x37a220['as'],'attributes':_0x37a220[_0xbcd3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbcd3('0x10')](function(_0x2165a0){logger['info'](_0xbcd3('0x24'),_0x3faf9d);logger['debug'](_0xbcd3('0x24'),_0x3faf9d,JSON[_0xbcd3('0x23')](_0x2165a0));_0x48e7e(_0x2165a0);})[_0xbcd3('0x18')](function(_0xd7cc56){logger['error'](_0xbcd3('0x24'),_0xd7cc56['message'],_0x3faf9d);_0x322316(_0x1ecc9e[_0xbcd3('0x15')](0x1f4,_0xd7cc56[_0xbcd3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 48fb2ae..a957906 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 _0xd769=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd769,0x1d8));var _0x9d76=function(_0x59543b,_0x364e20){_0x59543b=_0x59543b-0x0;var _0x32ec92=_0xd769[_0x59543b];return _0x32ec92;};'use strict';var WhatsappQueueEvents=require(_0x9d76('0x0'));var events=[_0x9d76('0x1'),_0x9d76('0x2'),_0x9d76('0x3')];function createListener(_0x2647bc,_0x377852){return function(_0x571d3d){_0x377852['emit'](_0x2647bc,_0x571d3d);};}function removeListener(_0xff923e,_0x49c877){return function(){WhatsappQueueEvents['removeListener'](_0xff923e,_0x49c877);};}exports[_0x9d76('0x4')]=function(_0x4e586a){for(var _0x36f30a=0x0,_0x504f6e=events[_0x9d76('0x5')];_0x36f30a<_0x504f6e;_0x36f30a++){var _0x1b7a4c=events[_0x36f30a];var _0xad1df4=createListener(_0x9d76('0x6')+_0x1b7a4c,_0x4e586a);WhatsappQueueEvents['on'](_0x1b7a4c,_0xad1df4);}}; \ No newline at end of file +var _0x80b3=['./whatsappQueue.events','remove','emit','removeListener','length','whatsappQueue:'];(function(_0x13c542,_0x4a9af3){var _0x306405=function(_0x36aaef){while(--_0x36aaef){_0x13c542['push'](_0x13c542['shift']());}};_0x306405(++_0x4a9af3);}(_0x80b3,0xc6));var _0x380b=function(_0x4c2b45,_0x201455){_0x4c2b45=_0x4c2b45-0x0;var _0x2fa8aa=_0x80b3[_0x4c2b45];return _0x2fa8aa;};'use strict';var WhatsappQueueEvents=require(_0x380b('0x0'));var events=['save',_0x380b('0x1'),'update'];function createListener(_0x283e1c,_0x2c17bd){return function(_0x46a477){_0x2c17bd[_0x380b('0x2')](_0x283e1c,_0x46a477);};}function removeListener(_0x3520c4,_0x59bda1){return function(){WhatsappQueueEvents[_0x380b('0x3')](_0x3520c4,_0x59bda1);};}exports['register']=function(_0x42ca90){for(var _0x1f8924=0x0,_0x4fc391=events[_0x380b('0x4')];_0x1f8924<_0x4fc391;_0x1f8924++){var _0x22071d=events[_0x1f8924];var _0x40c27e=createListener(_0x380b('0x5')+_0x22071d,_0x42ca90);WhatsappQueueEvents['on'](_0x22071d,_0x40c27e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bed0fa5..d617c15 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 _0xd6dc=['get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x2e8421,_0x1e2ceb){var _0x3a0d02=function(_0xd8bb5d){while(--_0xd8bb5d){_0x2e8421['push'](_0x2e8421['shift']());}};_0x3a0d02(++_0x1e2ceb);}(_0xd6dc,0x1d7));var _0xcd6d=function(_0xc13270,_0x36c05e){_0xc13270=_0xc13270-0x0;var _0x157828=_0xd6dc[_0xc13270];return _0x157828;};'use strict';var multer=require(_0xcd6d('0x0'));var util=require('util');var path=require(_0xcd6d('0x1'));var timeout=require(_0xcd6d('0x2'));var express=require(_0xcd6d('0x3'));var router=express[_0xcd6d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd6d('0x5'));var interaction=require(_0xcd6d('0x6'));var config=require(_0xcd6d('0x7'));var controller=require(_0xcd6d('0x8'));router[_0xcd6d('0x9')]('/',auth[_0xcd6d('0xa')](),controller[_0xcd6d('0xb')]);router[_0xcd6d('0x9')](_0xcd6d('0xc'),auth['isAuthenticated'](),controller[_0xcd6d('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcd6d('0xe')]);router[_0xcd6d('0xf')]('/',auth['isAuthenticated'](),controller[_0xcd6d('0x10')]);router[_0xcd6d('0x11')]('/:id',auth[_0xcd6d('0xa')](),controller[_0xcd6d('0x12')]);router[_0xcd6d('0x13')]('/:id',auth[_0xcd6d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x13e7=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','multer','path','connect-timeout','Router'];(function(_0x5e31e2,_0x273090){var _0x294e2c=function(_0x20ab82){while(--_0x20ab82){_0x5e31e2['push'](_0x5e31e2['shift']());}};_0x294e2c(++_0x273090);}(_0x13e7,0x16c));var _0x713e=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x13e7[_0x457b64];return _0x437111;};'use strict';var multer=require(_0x713e('0x0'));var util=require('util');var path=require(_0x713e('0x1'));var timeout=require(_0x713e('0x2'));var express=require('express');var router=express[_0x713e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x713e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x713e('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0x713e('0x6')]('/',auth[_0x713e('0x7')](),controller[_0x713e('0x8')]);router[_0x713e('0x6')]('/describe',auth[_0x713e('0x7')](),controller[_0x713e('0x9')]);router[_0x713e('0x6')](_0x713e('0xa'),auth[_0x713e('0x7')](),controller[_0x713e('0xb')]);router[_0x713e('0xc')]('/',auth[_0x713e('0x7')](),controller[_0x713e('0xd')]);router['put'](_0x713e('0xa'),auth[_0x713e('0x7')](),controller[_0x713e('0xe')]);router[_0x713e('0xf')](_0x713e('0xa'),auth[_0x713e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 4d67c86..30ac10b 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(_0x1fc8b7,_0x55235b){var _0x24f69e=function(_0x35d8b0){while(--_0x35d8b0){_0x1fc8b7['push'](_0x1fc8b7['shift']());}};_0x24f69e(++_0x55235b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x16db4b,_0x269435){var _0x457b8a=function(_0x8584d7){while(--_0x8584d7){_0x16db4b['push'](_0x16db4b['shift']());}};_0x457b8a(++_0x269435);}(_0x7a54,0x106));var _0x47a5=function(_0xc0d032,_0x4f15c2){_0xc0d032=_0xc0d032-0x0;var _0x295da8=_0x7a54[_0xc0d032];return _0x295da8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 41f7cbb..9415ab6 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 _0xbdb7=['then','findAll','rows','catch','params','rawAttributes','length','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x48fb10,_0xa50a89){_0x48fb10=_0x48fb10-0x0;var _0x534251=_0xbdb7[_0x48fb10];return _0x534251;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={},_0xd2d7be={},_0x25a1fe={'count':0x0,'rows':[]};var _0x365c02=_[_0x7bdb('0x28')](db[_0x7bdb('0x29')]['rawAttributes'],function(_0x388a45){return{'name':_0x388a45[_0x7bdb('0x2a')],'type':_0x388a45[_0x7bdb('0x2b')][_0x7bdb('0x2c')]};});_0xd2d7be[_0x7bdb('0x2d')]=_['map'](_0x365c02,_0x7bdb('0x25'));_0xd2d7be[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x371e8a[_0x7bdb('0x2e')]);_0xd2d7be['filters']=_['intersection'](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2e')]);_0x1e9996['attributes']=_[_0x7bdb('0x30')](_0xd2d7be['model'],qs[_0x7bdb('0x31')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x31')]));_0x1e9996['attributes']=_0x1e9996[_0x7bdb('0x32')]['length']?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x2d')];if(!_0x371e8a['query'][_0x7bdb('0x33')]('nolimit')){_0x1e9996['limit']=qs[_0x7bdb('0x1b')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x1b')]);_0x1e9996[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x371e8a[_0x7bdb('0x2e')]['offset']);}_0x1e9996[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x35')]);_0x1e9996[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x371e8a[_0x7bdb('0x2e')],_0xd2d7be[_0x7bdb('0x37')]),_0x365c02);if(_0x371e8a['query']['filter']){_0x1e9996[_0x7bdb('0x36')]=_[_0x7bdb('0x39')](_0x1e9996[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x28')](_0x365c02,function(_0x3732b2){if(_0x3732b2['type']!=='VIRTUAL'){var _0x27164f={};_0x27164f[_0x3732b2['name']]={'$like':'%'+_0x371e8a[_0x7bdb('0x2e')]['filter']+'%'};return _0x27164f;}})});}_0x1e9996=_[_0x7bdb('0x39')]({},_0x1e9996,_0x371e8a['options']);var _0x4cf3fa={'where':_0x1e9996[_0x7bdb('0x36')]};return db[_0x7bdb('0x29')][_0x7bdb('0x1c')](_0x4cf3fa)[_0x7bdb('0x3a')](function(_0x43c7d3){_0x25a1fe[_0x7bdb('0x1c')]=_0x43c7d3;if(_0x371e8a[_0x7bdb('0x2e')]['includeAll']){_0x1e9996['include']=[{'all':!![]}];}return db[_0x7bdb('0x29')][_0x7bdb('0x3b')](_0x1e9996);})[_0x7bdb('0x3a')](function(_0x3509e4){_0x25a1fe[_0x7bdb('0x3c')]=_0x3509e4;return _0x25a1fe;})[_0x7bdb('0x3a')](respondWithFilteredResult(_0x2e8e65,_0x1e9996))[_0x7bdb('0x3d')](handleError(_0x2e8e65,null));};exports['show']=function(_0x4a2ebc,_0x1bcbcd){var _0x8e893e={'raw':!![],'where':{'id':_0x4a2ebc[_0x7bdb('0x3e')]['id']}},_0x4636f8={};_0x4636f8['model']=_[_0x7bdb('0x2f')](db['WhatsappQueueReport'][_0x7bdb('0x3f')]);_0x4636f8[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x4a2ebc[_0x7bdb('0x2e')]);_0x4636f8[_0x7bdb('0x37')]=_[_0x7bdb('0x30')](_0x4636f8[_0x7bdb('0x2d')],_0x4636f8[_0x7bdb('0x2e')]);_0x8e893e[_0x7bdb('0x32')]=_['intersection'](_0x4636f8[_0x7bdb('0x2d')],qs[_0x7bdb('0x31')](_0x4a2ebc['query'][_0x7bdb('0x31')]));_0x8e893e['attributes']=_0x8e893e[_0x7bdb('0x32')][_0x7bdb('0x40')]?_0x8e893e[_0x7bdb('0x32')]:_0x4636f8[_0x7bdb('0x2d')];if(_0x4a2ebc[_0x7bdb('0x2e')]['includeAll']){_0x8e893e[_0x7bdb('0x41')]=[{'all':!![]}];}_0x8e893e=_[_0x7bdb('0x39')]({},_0x8e893e,_0x4a2ebc[_0x7bdb('0x42')]);return db[_0x7bdb('0x29')][_0x7bdb('0x43')](_0x8e893e)['then'](handleEntityNotFound(_0x1bcbcd,null))[_0x7bdb('0x3a')](respondWithResult(_0x1bcbcd,null))[_0x7bdb('0x3d')](handleError(_0x1bcbcd,null));};exports[_0x7bdb('0x44')]=function(_0xb26a9,_0x259007){return db[_0x7bdb('0x29')][_0x7bdb('0x44')](_0xb26a9[_0x7bdb('0x45')],{})[_0x7bdb('0x3a')](respondWithResult(_0x259007,0xc9))[_0x7bdb('0x3d')](handleError(_0x259007,null));};exports['update']=function(_0x189cf8,_0x58c4bc){if(_0x189cf8['body']['id']){delete _0x189cf8[_0x7bdb('0x45')]['id'];}return db[_0x7bdb('0x29')]['find']({'where':{'id':_0x189cf8[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x58c4bc,null))['then'](saveUpdates(_0x189cf8['body'],null))['then'](respondWithResult(_0x58c4bc,null))[_0x7bdb('0x3d')](handleError(_0x58c4bc,null));};exports[_0x7bdb('0x46')]=function(_0x2fab74,_0x46410c){return db[_0x7bdb('0x29')][_0x7bdb('0x43')]({'where':{'id':_0x2fab74[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x46410c,null))[_0x7bdb('0x3a')](removeEntity(_0x46410c,null))[_0x7bdb('0x3d')](handleError(_0x46410c,null));};exports['describe']=function(_0x299ef0,_0x4806e0){return db[_0x7bdb('0x29')][_0x7bdb('0x47')]()[_0x7bdb('0x3a')](respondWithResult(_0x4806e0,null))[_0x7bdb('0x3d')](handleError(_0x4806e0,null));}; \ No newline at end of file +var _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x14a0,0x8e));var _0x014a=function(_0x2419d2,_0x63d417){_0x2419d2=_0x2419d2-0x0;var _0x1ea483=_0x14a0[_0x2419d2];return _0x1ea483;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['WhatsappQueueReport'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['WhatsappQueueReport'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));};exports[_0x014a('0x49')]=function(_0x3caa6e,_0x4f8547){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x4f8547,null))[_0x014a('0x42')](handleError(_0x4f8547,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9e83b04..720b99a 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 _0xe88a=['uniqueid','lodash','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xe88a,0x187));var _0xae88=function(_0xc4d0d2,_0x3aae05){_0xc4d0d2=_0xc4d0d2-0x0;var _0x236666=_0xe88a[_0xc4d0d2];return _0x236666;};'use strict';var _=require(_0xae88('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xae88('0x1'));var BPromise=require(_0xae88('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae88('0x3'));var rimraf=require(_0xae88('0x4'));var config=require(_0xae88('0x5'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x34e4d6,_0x1bc1f5){return _0x34e4d6[_0xae88('0x6')](_0xae88('0x7'),attributes,{'tableName':_0xae88('0x8'),'paranoid':![],'indexes':[{'name':_0xae88('0x9'),'fields':[_0xae88('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4500=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','WhatsappQueueReport'];(function(_0x218fdc,_0x3b552b){var _0x54f74e=function(_0x515557){while(--_0x515557){_0x218fdc['push'](_0x218fdc['shift']());}};_0x54f74e(++_0x3b552b);}(_0x4500,0x16e));var _0x0450=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0x4500[_0xfcfc24];return _0x58f773;};'use strict';var _=require(_0x0450('0x0'));var util=require(_0x0450('0x1'));var logger=require(_0x0450('0x2'))(_0x0450('0x3'));var moment=require(_0x0450('0x4'));var BPromise=require(_0x0450('0x5'));var rp=require(_0x0450('0x6'));var fs=require('fs');var path=require(_0x0450('0x7'));var rimraf=require('rimraf');var config=require(_0x0450('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x0450('0x9')]=function(_0x5df908,_0x31ef1a){return _0x5df908['define'](_0x0450('0xa'),attributes,{'tableName':_0x0450('0xb'),'paranoid':![],'indexes':[{'name':_0x0450('0xc'),'fields':[_0x0450('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4c5a55d..c527bad 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 _0xd48e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','debug','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash'];(function(_0x56234e,_0x3e9220){var _0x3ce9f7=function(_0x103dc8){while(--_0x103dc8){_0x56234e['push'](_0x56234e['shift']());}};_0x3ce9f7(++_0x3e9220);}(_0xd48e,0x1a3));var _0xed48=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xd48e[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xed48('0x0'));var util=require(_0xed48('0x1'));var moment=require(_0xed48('0x2'));var BPromise=require(_0xed48('0x3'));var rs=require(_0xed48('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed48('0x5'))['db'];var utils=require(_0xed48('0x6'));var logger=require('../../config/logger')(_0xed48('0x7'));var config=require('../../config/environment');var jayson=require(_0xed48('0x8'));var client=jayson[_0xed48('0x9')][_0xed48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17fb70,_0x2bae24,_0x2e9700){return new BPromise(function(_0x3bda68,_0x3282b1){return client[_0xed48('0xb')](_0x17fb70,_0x2e9700)[_0xed48('0xc')](function(_0x4ba98a){logger[_0xed48('0xd')](_0xed48('0xe'),_0x2bae24,_0xed48('0xf'));logger['debug'](_0xed48('0x10'),_0x2bae24,_0xed48('0xf'),JSON[_0xed48('0x11')](_0x4ba98a));if(_0x4ba98a[_0xed48('0x12')]){if(_0x4ba98a['error'][_0xed48('0x13')]===0x1f4){logger['error'](_0xed48('0xe'),_0x2bae24,_0x4ba98a[_0xed48('0x12')]['message']);return _0x3282b1(_0x4ba98a[_0xed48('0x12')][_0xed48('0x14')]);}logger[_0xed48('0x12')](_0xed48('0xe'),_0x2bae24,_0x4ba98a[_0xed48('0x12')]['message']);return _0x3bda68(_0x4ba98a['error'][_0xed48('0x14')]);}else{logger[_0xed48('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2bae24,_0xed48('0xf'));_0x3bda68(_0x4ba98a[_0xed48('0x15')][_0xed48('0x14')]);}})[_0xed48('0x16')](function(_0xb89278){logger['error'](_0xed48('0xe'),_0x2bae24,_0xb89278);_0x3282b1(_0xb89278);});});}exports['CreateWhatsappQueueReport']=function(_0x48f13a){var _0x552276=this;return new Promise(function(_0x1df416,_0x38a90c){return db[_0xed48('0x17')][_0xed48('0x18')](_0x48f13a[_0xed48('0x19')],{'raw':_0x48f13a['options']?_0x48f13a[_0xed48('0x1a')][_0xed48('0x1b')]===undefined?!![]:![]:!![]})[_0xed48('0xc')](function(_0x3c04d4){logger[_0xed48('0xd')](_0xed48('0x1c'),_0x48f13a);logger[_0xed48('0x1d')]('CreateWhatsappQueueReport',_0x48f13a,JSON['stringify'](_0x3c04d4));_0x1df416(_0x3c04d4);})[_0xed48('0x16')](function(_0x1c1629){logger[_0xed48('0x12')]('CreateWhatsappQueueReport',_0x1c1629['message'],_0x48f13a);_0x38a90c(_0x552276[_0xed48('0x12')](0x1f4,_0x1c1629['message']));});});};exports[_0xed48('0x1e')]=function(_0xe22069){var _0x3ab105=this;return new Promise(function(_0x167399,_0x1c3708){return db[_0xed48('0x17')][_0xed48('0x1f')](_0xe22069[_0xed48('0x19')],{'raw':_0xe22069[_0xed48('0x1a')]?_0xe22069[_0xed48('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe22069[_0xed48('0x1a')]?_0xe22069[_0xed48('0x1a')][_0xed48('0x20')]||null:null,'attributes':_0xe22069[_0xed48('0x1a')]?_0xe22069[_0xed48('0x1a')][_0xed48('0x21')]||null:null,'limit':_0xe22069[_0xed48('0x1a')]?_0xe22069[_0xed48('0x1a')][_0xed48('0x22')]||null:null})['then'](function(_0x90752e){logger['info'](_0xed48('0x1e'),_0xe22069);logger[_0xed48('0x1d')](_0xed48('0x1e'),_0xe22069,JSON[_0xed48('0x11')](_0x90752e));_0x167399(_0x90752e);})['catch'](function(_0x56d77b){logger[_0xed48('0x12')](_0xed48('0x1e'),_0x56d77b['message'],_0xe22069);_0x1c3708(_0x3ab105[_0xed48('0x12')](0x1f4,_0x56d77b['message']));});});}; \ No newline at end of file +var _0x206a=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x2fddd1,_0x419545){var _0x5860f5=function(_0x5eca86){while(--_0x5eca86){_0x2fddd1['push'](_0x2fddd1['shift']());}};_0x5860f5(++_0x419545);}(_0x206a,0x96));var _0xa206=function(_0x1a9e9e,_0x4e02c0){_0x1a9e9e=_0x1a9e9e-0x0;var _0x461061=_0x206a[_0x1a9e9e];return _0x461061;};'use strict';var _=require(_0xa206('0x0'));var util=require(_0xa206('0x1'));var moment=require(_0xa206('0x2'));var BPromise=require(_0xa206('0x3'));var rs=require(_0xa206('0x4'));var fs=require('fs');var Redis=require(_0xa206('0x5'));var db=require(_0xa206('0x6'))['db'];var utils=require(_0xa206('0x7'));var logger=require(_0xa206('0x8'))(_0xa206('0x9'));var config=require('../../config/environment');var jayson=require(_0xa206('0xa'));var client=jayson['client'][_0xa206('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ca01,_0x24f48b,_0x139c45){return new BPromise(function(_0x581f5c,_0x4a9222){return client[_0xa206('0xc')](_0x54ca01,_0x139c45)[_0xa206('0xd')](function(_0x4df5dd){logger[_0xa206('0xe')](_0xa206('0xf'),_0x24f48b,_0xa206('0x10'));logger[_0xa206('0x11')](_0xa206('0x12'),_0x24f48b,_0xa206('0x10'),JSON[_0xa206('0x13')](_0x4df5dd));if(_0x4df5dd['error']){if(_0x4df5dd['error'][_0xa206('0x14')]===0x1f4){logger[_0xa206('0x15')](_0xa206('0xf'),_0x24f48b,_0x4df5dd[_0xa206('0x15')]['message']);return _0x4a9222(_0x4df5dd[_0xa206('0x15')][_0xa206('0x16')]);}logger[_0xa206('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x24f48b,_0x4df5dd[_0xa206('0x15')]['message']);return _0x581f5c(_0x4df5dd[_0xa206('0x15')][_0xa206('0x16')]);}else{logger[_0xa206('0xe')](_0xa206('0xf'),_0x24f48b,_0xa206('0x10'));_0x581f5c(_0x4df5dd[_0xa206('0x17')][_0xa206('0x16')]);}})[_0xa206('0x18')](function(_0x5b1e75){logger[_0xa206('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x24f48b,_0x5b1e75);_0x4a9222(_0x5b1e75);});});}exports[_0xa206('0x19')]=function(_0x97f33){var _0x1ed8a3=this;return new Promise(function(_0x5ab965,_0x385ee6){return db[_0xa206('0x1a')][_0xa206('0x1b')](_0x97f33[_0xa206('0x1c')],{'raw':_0x97f33[_0xa206('0x1d')]?_0x97f33[_0xa206('0x1d')][_0xa206('0x1e')]===undefined?!![]:![]:!![]})[_0xa206('0xd')](function(_0x27e47e){logger['info']('CreateWhatsappQueueReport',_0x97f33);logger[_0xa206('0x11')]('CreateWhatsappQueueReport',_0x97f33,JSON[_0xa206('0x13')](_0x27e47e));_0x5ab965(_0x27e47e);})['catch'](function(_0x189849){logger[_0xa206('0x15')](_0xa206('0x19'),_0x189849[_0xa206('0x16')],_0x97f33);_0x385ee6(_0x1ed8a3['error'](0x1f4,_0x189849[_0xa206('0x16')]));});});};exports[_0xa206('0x1f')]=function(_0x51066b){var _0x1f330d=this;return new Promise(function(_0x2f0207,_0x43c2cf){return db[_0xa206('0x1a')]['update'](_0x51066b[_0xa206('0x1c')],{'raw':_0x51066b[_0xa206('0x1d')]?_0x51066b['options'][_0xa206('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51066b[_0xa206('0x1d')]?_0x51066b[_0xa206('0x1d')][_0xa206('0x20')]||null:null,'attributes':_0x51066b['options']?_0x51066b['options'][_0xa206('0x21')]||null:null,'limit':_0x51066b[_0xa206('0x1d')]?_0x51066b[_0xa206('0x1d')][_0xa206('0x22')]||null:null})['then'](function(_0x5bf043){logger[_0xa206('0xe')](_0xa206('0x1f'),_0x51066b);logger['debug'](_0xa206('0x1f'),_0x51066b,JSON[_0xa206('0x13')](_0x5bf043));_0x2f0207(_0x5bf043);})[_0xa206('0x18')](function(_0x14b6fd){logger[_0xa206('0x15')](_0xa206('0x1f'),_0x14b6fd[_0xa206('0x16')],_0x51066b);_0x43c2cf(_0x1f330d[_0xa206('0x15')](0x1f4,_0x14b6fd[_0xa206('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1da79b8..16f349f 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 _0x14cc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2598b3,_0x1cc0a8){var _0x55607f=function(_0x3b37fd){while(--_0x3b37fd){_0x2598b3['push'](_0x2598b3['shift']());}};_0x55607f(++_0x1cc0a8);}(_0x14cc,0x1f4));var _0xc14c=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x14cc[_0x39872b];return _0x55fa18;};'use strict';var multer=require(_0xc14c('0x0'));var util=require(_0xc14c('0x1'));var path=require(_0xc14c('0x2'));var timeout=require(_0xc14c('0x3'));var express=require(_0xc14c('0x4'));var router=express[_0xc14c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc14c('0x6'));var interaction=require(_0xc14c('0x7'));var config=require(_0xc14c('0x8'));var controller=require(_0xc14c('0x9'));router[_0xc14c('0xa')]('/',auth[_0xc14c('0xb')](),controller[_0xc14c('0xc')]);router[_0xc14c('0xa')](_0xc14c('0xd'),auth['isAuthenticated'](),controller[_0xc14c('0xe')]);router[_0xc14c('0xa')](_0xc14c('0xf'),auth[_0xc14c('0xb')](),controller[_0xc14c('0x10')]);router[_0xc14c('0x11')]('/',auth[_0xc14c('0xb')](),controller['create']);router[_0xc14c('0x12')](_0xc14c('0xf'),auth[_0xc14c('0xb')](),controller[_0xc14c('0x13')]);router[_0xc14c('0x14')](_0xc14c('0xf'),auth[_0xc14c('0xb')](),controller[_0xc14c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x80e5=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x80e5,0xac));var _0x580e=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x80e5[_0x16771d];return _0x386f11;};'use strict';var multer=require(_0x580e('0x0'));var util=require(_0x580e('0x1'));var path=require(_0x580e('0x2'));var timeout=require(_0x580e('0x3'));var express=require(_0x580e('0x4'));var router=express[_0x580e('0x5')]();var fs_extra=require(_0x580e('0x6'));var auth=require(_0x580e('0x7'));var interaction=require(_0x580e('0x8'));var config=require(_0x580e('0x9'));var controller=require('./whatsappTransferReport.controller');router[_0x580e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x580e('0xa')](_0x580e('0xb'),auth[_0x580e('0xc')](),controller[_0x580e('0xd')]);router[_0x580e('0xa')](_0x580e('0xe'),auth[_0x580e('0xc')](),controller['show']);router[_0x580e('0xf')]('/',auth[_0x580e('0xc')](),controller[_0x580e('0x10')]);router['put']('/:id',auth[_0x580e('0xc')](),controller[_0x580e('0x11')]);router[_0x580e('0x12')](_0x580e('0xe'),auth[_0x580e('0xc')](),controller[_0x580e('0x13')]);module[_0x580e('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 8040910..e42b73d 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 _0xe77c=['agent','queue','DATE','sequelize','exports','STRING','account'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xe77c,0x176));var _0xce77=function(_0x4cefee,_0xabb91e){_0x4cefee=_0x4cefee-0x0;var _0x473af2=_0xe77c[_0x4cefee];return _0x473af2;};'use strict';var Sequelize=require(_0xce77('0x0'));module[_0xce77('0x1')]={'uniqueid':{'type':Sequelize[_0xce77('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xce77('0x3'),_0xce77('0x4'),_0xce77('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xce77('0x6')]}}; \ No newline at end of file +var _0x42f4=['STRING','ENUM','account','agent','queue','sequelize'];(function(_0x2508b4,_0x1b1e0f){var _0x181e86=function(_0x1a551e){while(--_0x1a551e){_0x2508b4['push'](_0x2508b4['shift']());}};_0x181e86(++_0x1b1e0f);}(_0x42f4,0x19d));var _0x442f=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0x42f4[_0x219fa0];return _0xc603fb;};'use strict';var Sequelize=require(_0x442f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x442f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x442f('0x2')](_0x442f('0x3'),_0x442f('0x4'),_0x442f('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 04805de..d7a75ba 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 _0xea17=['rows','catch','show','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll'];(function(_0x271744,_0x39f766){var _0x3558d6=function(_0x303b1c){while(--_0x303b1c){_0x271744['push'](_0x271744['shift']());}};_0x3558d6(++_0x39f766);}(_0xea17,0xa3));var _0x7ea1=function(_0x4fb1ea,_0x394fce){_0x4fb1ea=_0x4fb1ea-0x0;var _0x13b302=_0xea17[_0x4fb1ea];return _0x13b302;};'use strict';var emlformat=require(_0x7ea1('0x0'));var rimraf=require(_0x7ea1('0x1'));var zipdir=require(_0x7ea1('0x2'));var jsonpatch=require(_0x7ea1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ea1('0x4'));var Mustache=require(_0x7ea1('0x5'));var util=require(_0x7ea1('0x6'));var path=require('path');var sox=require(_0x7ea1('0x7'));var csv=require(_0x7ea1('0x8'));var ejs=require(_0x7ea1('0x9'));var fs=require('fs');var fs_extra=require(_0x7ea1('0xa'));var _=require(_0x7ea1('0xb'));var squel=require(_0x7ea1('0xc'));var crypto=require(_0x7ea1('0xd'));var jsforce=require(_0x7ea1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7ea1('0x8'));var querystring=require(_0x7ea1('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ea1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7ea1('0x11'));var as=require(_0x7ea1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7ea1('0x13'));var utils=require('../../config/utils');var config=require(_0x7ea1('0x14'));var licenseUtil=require(_0x7ea1('0x15'));var db=require(_0x7ea1('0x16'))['db'];function respondWithStatusCode(_0x57308a,_0x4605b4){_0x4605b4=_0x4605b4||0xcc;return function(_0x399d9c){if(_0x399d9c){return _0x57308a['sendStatus'](_0x4605b4);}return _0x57308a[_0x7ea1('0x17')](_0x4605b4)[_0x7ea1('0x18')]();};}function respondWithResult(_0x4c04e0,_0x435782){_0x435782=_0x435782||0xc8;return function(_0x2f32eb){if(_0x2f32eb){return _0x4c04e0['status'](_0x435782)[_0x7ea1('0x19')](_0x2f32eb);}};}function respondWithFilteredResult(_0x241c88,_0x2d134e){return function(_0x3de621){if(_0x3de621){var _0x2ade1b=typeof _0x2d134e['offset']===_0x7ea1('0x1a')&&typeof _0x2d134e[_0x7ea1('0x1b')]===_0x7ea1('0x1a');var _0x1b5c1a=_0x3de621['count'];var _0x56b1db=_0x2ade1b?0x0:_0x2d134e[_0x7ea1('0x1c')];var _0x1649fa=_0x2ade1b?_0x3de621[_0x7ea1('0x1d')]:_0x2d134e[_0x7ea1('0x1c')]+_0x2d134e[_0x7ea1('0x1b')];var _0x157317;if(_0x1649fa>=_0x1b5c1a){_0x1649fa=_0x1b5c1a;_0x157317=0xc8;}else{_0x157317=0xce;}_0x241c88[_0x7ea1('0x17')](_0x157317);return _0x241c88[_0x7ea1('0x1e')](_0x7ea1('0x1f'),_0x56b1db+'-'+_0x1649fa+'/'+_0x1b5c1a)[_0x7ea1('0x19')](_0x3de621);}return null;};}function patchUpdates(_0x2b8173){return function(_0x202174){try{jsonpatch[_0x7ea1('0x20')](_0x202174,_0x2b8173,!![]);}catch(_0x479ee6){return BPromise[_0x7ea1('0x21')](_0x479ee6);}return _0x202174[_0x7ea1('0x22')]();};}function saveUpdates(_0x185ba3,_0x22bdc5){return function(_0x241beb){if(_0x241beb){return _0x241beb[_0x7ea1('0x23')](_0x185ba3)[_0x7ea1('0x24')](function(_0xa83055){return _0xa83055;});}return null;};}function removeEntity(_0x517d1c,_0x460700){return function(_0x6a27e5){if(_0x6a27e5){return _0x6a27e5[_0x7ea1('0x25')]()['then'](function(){_0x517d1c[_0x7ea1('0x17')](0xcc)[_0x7ea1('0x18')]();});}};}function handleEntityNotFound(_0x2e6bb0,_0x115221){return function(_0x455024){if(!_0x455024){_0x2e6bb0[_0x7ea1('0x26')](0x194);}return _0x455024;};}function handleError(_0x239e2f,_0x1b87a1){_0x1b87a1=_0x1b87a1||0x1f4;return function(_0x109d6e){logger[_0x7ea1('0x27')](_0x109d6e[_0x7ea1('0x28')]);if(_0x109d6e[_0x7ea1('0x29')]){delete _0x109d6e[_0x7ea1('0x29')];}_0x239e2f['status'](_0x1b87a1)[_0x7ea1('0x2a')](_0x109d6e);};}exports[_0x7ea1('0x2b')]=function(_0x2f5867,_0x45952d){var _0x3aa1d7={},_0xeb1a6c={},_0x453910={'count':0x0,'rows':[]};var _0x1be82c=_[_0x7ea1('0x2c')](db[_0x7ea1('0x2d')][_0x7ea1('0x2e')],function(_0x1f6afd){return{'name':_0x1f6afd[_0x7ea1('0x2f')],'type':_0x1f6afd[_0x7ea1('0x30')][_0x7ea1('0x31')]};});_0xeb1a6c[_0x7ea1('0x32')]=_[_0x7ea1('0x2c')](_0x1be82c,'name');_0xeb1a6c['query']=_[_0x7ea1('0x33')](_0x2f5867[_0x7ea1('0x34')]);_0xeb1a6c[_0x7ea1('0x35')]=_[_0x7ea1('0x36')](_0xeb1a6c[_0x7ea1('0x32')],_0xeb1a6c[_0x7ea1('0x34')]);_0x3aa1d7[_0x7ea1('0x37')]=_[_0x7ea1('0x36')](_0xeb1a6c['model'],qs[_0x7ea1('0x38')](_0x2f5867[_0x7ea1('0x34')]['fields']));_0x3aa1d7['attributes']=_0x3aa1d7[_0x7ea1('0x37')][_0x7ea1('0x39')]?_0x3aa1d7[_0x7ea1('0x37')]:_0xeb1a6c['model'];if(!_0x2f5867[_0x7ea1('0x34')]['hasOwnProperty'](_0x7ea1('0x3a'))){_0x3aa1d7[_0x7ea1('0x1b')]=qs[_0x7ea1('0x1b')](_0x2f5867[_0x7ea1('0x34')][_0x7ea1('0x1b')]);_0x3aa1d7[_0x7ea1('0x1c')]=qs[_0x7ea1('0x1c')](_0x2f5867[_0x7ea1('0x34')][_0x7ea1('0x1c')]);}_0x3aa1d7[_0x7ea1('0x3b')]=qs[_0x7ea1('0x3c')](_0x2f5867['query']['sort']);_0x3aa1d7[_0x7ea1('0x3d')]=qs[_0x7ea1('0x35')](_['pick'](_0x2f5867[_0x7ea1('0x34')],_0xeb1a6c['filters']),_0x1be82c);if(_0x2f5867[_0x7ea1('0x34')][_0x7ea1('0x3e')]){_0x3aa1d7['where']=_['merge'](_0x3aa1d7[_0x7ea1('0x3d')],{'$or':_[_0x7ea1('0x2c')](_0x1be82c,function(_0x41a845){if(_0x41a845[_0x7ea1('0x30')]!==_0x7ea1('0x3f')){var _0x305f12={};_0x305f12[_0x41a845[_0x7ea1('0x29')]]={'$like':'%'+_0x2f5867[_0x7ea1('0x34')][_0x7ea1('0x3e')]+'%'};return _0x305f12;}})});}_0x3aa1d7=_['merge']({},_0x3aa1d7,_0x2f5867[_0x7ea1('0x40')]);var _0x312f45={'where':_0x3aa1d7['where']};return db[_0x7ea1('0x2d')][_0x7ea1('0x1d')](_0x312f45)[_0x7ea1('0x24')](function(_0x249a8d){_0x453910['count']=_0x249a8d;if(_0x2f5867[_0x7ea1('0x34')][_0x7ea1('0x41')]){_0x3aa1d7[_0x7ea1('0x42')]=[{'all':!![]}];}return db[_0x7ea1('0x2d')][_0x7ea1('0x43')](_0x3aa1d7);})['then'](function(_0xcc9520){_0x453910[_0x7ea1('0x44')]=_0xcc9520;return _0x453910;})[_0x7ea1('0x24')](respondWithFilteredResult(_0x45952d,_0x3aa1d7))[_0x7ea1('0x45')](handleError(_0x45952d,null));};exports[_0x7ea1('0x46')]=function(_0x1af9b6,_0x5270f2){var _0x2491d2={'raw':!![],'where':{'id':_0x1af9b6['params']['id']}},_0x17178b={};_0x17178b['model']=_['keys'](db[_0x7ea1('0x2d')]['rawAttributes']);_0x17178b[_0x7ea1('0x34')]=_[_0x7ea1('0x33')](_0x1af9b6[_0x7ea1('0x34')]);_0x17178b[_0x7ea1('0x35')]=_[_0x7ea1('0x36')](_0x17178b['model'],_0x17178b[_0x7ea1('0x34')]);_0x2491d2[_0x7ea1('0x37')]=_[_0x7ea1('0x36')](_0x17178b['model'],qs[_0x7ea1('0x38')](_0x1af9b6[_0x7ea1('0x34')][_0x7ea1('0x38')]));_0x2491d2[_0x7ea1('0x37')]=_0x2491d2[_0x7ea1('0x37')][_0x7ea1('0x39')]?_0x2491d2[_0x7ea1('0x37')]:_0x17178b[_0x7ea1('0x32')];if(_0x1af9b6['query']['includeAll']){_0x2491d2[_0x7ea1('0x42')]=[{'all':!![]}];}_0x2491d2=_[_0x7ea1('0x47')]({},_0x2491d2,_0x1af9b6[_0x7ea1('0x40')]);return db['WhatsappTransferReport'][_0x7ea1('0x48')](_0x2491d2)[_0x7ea1('0x24')](handleEntityNotFound(_0x5270f2,null))[_0x7ea1('0x24')](respondWithResult(_0x5270f2,null))['catch'](handleError(_0x5270f2,null));};exports[_0x7ea1('0x49')]=function(_0x30f7e5,_0x54b2b7){return db[_0x7ea1('0x2d')][_0x7ea1('0x49')](_0x30f7e5[_0x7ea1('0x4a')],{})[_0x7ea1('0x24')](respondWithResult(_0x54b2b7,0xc9))[_0x7ea1('0x45')](handleError(_0x54b2b7,null));};exports[_0x7ea1('0x23')]=function(_0x4ffcd5,_0x51114a){if(_0x4ffcd5[_0x7ea1('0x4a')]['id']){delete _0x4ffcd5[_0x7ea1('0x4a')]['id'];}return db[_0x7ea1('0x2d')]['find']({'where':{'id':_0x4ffcd5['params']['id']}})[_0x7ea1('0x24')](handleEntityNotFound(_0x51114a,null))['then'](saveUpdates(_0x4ffcd5['body'],null))[_0x7ea1('0x24')](respondWithResult(_0x51114a,null))[_0x7ea1('0x45')](handleError(_0x51114a,null));};exports[_0x7ea1('0x25')]=function(_0x406f40,_0x3a3f99){return db['WhatsappTransferReport'][_0x7ea1('0x48')]({'where':{'id':_0x406f40[_0x7ea1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a3f99,null))[_0x7ea1('0x24')](removeEntity(_0x3a3f99,null))[_0x7ea1('0x45')](handleError(_0x3a3f99,null));};exports[_0x7ea1('0x4c')]=function(_0x507b1d,_0x46bc26){return db[_0x7ea1('0x2d')][_0x7ea1('0x4c')]()['then'](respondWithResult(_0x46bc26,null))[_0x7ea1('0x45')](handleError(_0x46bc26,null));}; \ No newline at end of file +var _0xfd46=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','query'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xfd46,0x176));var _0x6fd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd46[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6fd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fd4('0x1'));var jsonpatch=require(_0x6fd4('0x2'));var rp=require(_0x6fd4('0x3'));var moment=require(_0x6fd4('0x4'));var BPromise=require(_0x6fd4('0x5'));var Mustache=require(_0x6fd4('0x6'));var util=require(_0x6fd4('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6fd4('0x8'));var fs=require('fs');var fs_extra=require(_0x6fd4('0x9'));var _=require(_0x6fd4('0xa'));var squel=require('squel');var crypto=require(_0x6fd4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6fd4('0xc'));var toCsv=require(_0x6fd4('0xd'));var querystring=require(_0x6fd4('0xe'));var Papa=require('papaparse');var Redis=require(_0x6fd4('0xf'));var authService=require(_0x6fd4('0x10'));var qs=require(_0x6fd4('0x11'));var as=require(_0x6fd4('0x12'));var hardwareService=require(_0x6fd4('0x13'));var logger=require('../../config/logger')(_0x6fd4('0x14'));var utils=require(_0x6fd4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6fd4('0x16'));var db=require(_0x6fd4('0x17'))['db'];function respondWithStatusCode(_0x1e59de,_0x1084ef){_0x1084ef=_0x1084ef||0xcc;return function(_0x9113bb){if(_0x9113bb){return _0x1e59de[_0x6fd4('0x18')](_0x1084ef);}return _0x1e59de[_0x6fd4('0x19')](_0x1084ef)[_0x6fd4('0x1a')]();};}function respondWithResult(_0x44af8e,_0x41c873){_0x41c873=_0x41c873||0xc8;return function(_0x118474){if(_0x118474){return _0x44af8e['status'](_0x41c873)['json'](_0x118474);}};}function respondWithFilteredResult(_0x296de7,_0x3d39ae){return function(_0x43c1ff){if(_0x43c1ff){var _0x29978d=typeof _0x3d39ae[_0x6fd4('0x1b')]===_0x6fd4('0x1c')&&typeof _0x3d39ae[_0x6fd4('0x1d')]===_0x6fd4('0x1c');var _0x3a8390=_0x43c1ff[_0x6fd4('0x1e')];var _0x4d77d3=_0x29978d?0x0:_0x3d39ae[_0x6fd4('0x1b')];var _0x2c956c=_0x29978d?_0x43c1ff['count']:_0x3d39ae['offset']+_0x3d39ae['limit'];var _0x9b9c82;if(_0x2c956c>=_0x3a8390){_0x2c956c=_0x3a8390;_0x9b9c82=0xc8;}else{_0x9b9c82=0xce;}_0x296de7[_0x6fd4('0x19')](_0x9b9c82);return _0x296de7[_0x6fd4('0x1f')]('Content-Range',_0x4d77d3+'-'+_0x2c956c+'/'+_0x3a8390)['json'](_0x43c1ff);}return null;};}function patchUpdates(_0x3d2afc){return function(_0x4b56c5){try{jsonpatch[_0x6fd4('0x20')](_0x4b56c5,_0x3d2afc,!![]);}catch(_0x5e8739){return BPromise[_0x6fd4('0x21')](_0x5e8739);}return _0x4b56c5['save']();};}function saveUpdates(_0x31596b,_0x202410){return function(_0x3fd37b){if(_0x3fd37b){return _0x3fd37b[_0x6fd4('0x22')](_0x31596b)[_0x6fd4('0x23')](function(_0x483dae){return _0x483dae;});}return null;};}function removeEntity(_0x4b3146,_0x7c9470){return function(_0x5b91f9){if(_0x5b91f9){return _0x5b91f9['destroy']()['then'](function(){_0x4b3146[_0x6fd4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41399c,_0x3a143f){return function(_0x4746b9){if(!_0x4746b9){_0x41399c[_0x6fd4('0x18')](0x194);}return _0x4746b9;};}function handleError(_0x2d5832,_0x2edfc1){_0x2edfc1=_0x2edfc1||0x1f4;return function(_0x60baa4){logger[_0x6fd4('0x24')](_0x60baa4[_0x6fd4('0x25')]);if(_0x60baa4[_0x6fd4('0x26')]){delete _0x60baa4[_0x6fd4('0x26')];}_0x2d5832[_0x6fd4('0x19')](_0x2edfc1)['send'](_0x60baa4);};}exports[_0x6fd4('0x27')]=function(_0x4b084d,_0x26fb48){var _0x26bd8e={},_0x4e8c0a={},_0xbdb101={'count':0x0,'rows':[]};var _0x24bc9a=_[_0x6fd4('0x28')](db[_0x6fd4('0x29')][_0x6fd4('0x2a')],function(_0x59e3a4){return{'name':_0x59e3a4[_0x6fd4('0x2b')],'type':_0x59e3a4['type']['key']};});_0x4e8c0a[_0x6fd4('0x2c')]=_[_0x6fd4('0x28')](_0x24bc9a,_0x6fd4('0x26'));_0x4e8c0a[_0x6fd4('0x2d')]=_['keys'](_0x4b084d[_0x6fd4('0x2d')]);_0x4e8c0a['filters']=_[_0x6fd4('0x2e')](_0x4e8c0a[_0x6fd4('0x2c')],_0x4e8c0a[_0x6fd4('0x2d')]);_0x26bd8e[_0x6fd4('0x2f')]=_[_0x6fd4('0x2e')](_0x4e8c0a[_0x6fd4('0x2c')],qs[_0x6fd4('0x30')](_0x4b084d[_0x6fd4('0x2d')][_0x6fd4('0x30')]));_0x26bd8e[_0x6fd4('0x2f')]=_0x26bd8e[_0x6fd4('0x2f')][_0x6fd4('0x31')]?_0x26bd8e[_0x6fd4('0x2f')]:_0x4e8c0a[_0x6fd4('0x2c')];if(!_0x4b084d[_0x6fd4('0x2d')][_0x6fd4('0x32')]('nolimit')){_0x26bd8e[_0x6fd4('0x1d')]=qs[_0x6fd4('0x1d')](_0x4b084d[_0x6fd4('0x2d')]['limit']);_0x26bd8e[_0x6fd4('0x1b')]=qs['offset'](_0x4b084d['query'][_0x6fd4('0x1b')]);}_0x26bd8e[_0x6fd4('0x33')]=qs[_0x6fd4('0x34')](_0x4b084d[_0x6fd4('0x2d')][_0x6fd4('0x34')]);_0x26bd8e[_0x6fd4('0x35')]=qs[_0x6fd4('0x36')](_[_0x6fd4('0x37')](_0x4b084d[_0x6fd4('0x2d')],_0x4e8c0a[_0x6fd4('0x36')]),_0x24bc9a);if(_0x4b084d['query'][_0x6fd4('0x38')]){_0x26bd8e[_0x6fd4('0x35')]=_[_0x6fd4('0x39')](_0x26bd8e[_0x6fd4('0x35')],{'$or':_[_0x6fd4('0x28')](_0x24bc9a,function(_0x258aaf){if(_0x258aaf['type']!==_0x6fd4('0x3a')){var _0x290d50={};_0x290d50[_0x258aaf['name']]={'$like':'%'+_0x4b084d[_0x6fd4('0x2d')]['filter']+'%'};return _0x290d50;}})});}_0x26bd8e=_[_0x6fd4('0x39')]({},_0x26bd8e,_0x4b084d[_0x6fd4('0x3b')]);var _0x5c9314={'where':_0x26bd8e[_0x6fd4('0x35')]};return db['WhatsappTransferReport'][_0x6fd4('0x1e')](_0x5c9314)[_0x6fd4('0x23')](function(_0x18d2b0){_0xbdb101[_0x6fd4('0x1e')]=_0x18d2b0;if(_0x4b084d['query']['includeAll']){_0x26bd8e[_0x6fd4('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x26bd8e);})[_0x6fd4('0x23')](function(_0x358ade){_0xbdb101[_0x6fd4('0x3d')]=_0x358ade;return _0xbdb101;})[_0x6fd4('0x23')](respondWithFilteredResult(_0x26fb48,_0x26bd8e))[_0x6fd4('0x3e')](handleError(_0x26fb48,null));};exports['show']=function(_0x33d570,_0x169d41){var _0xdccba8={'raw':!![],'where':{'id':_0x33d570[_0x6fd4('0x3f')]['id']}},_0x34ed9e={};_0x34ed9e[_0x6fd4('0x2c')]=_[_0x6fd4('0x40')](db[_0x6fd4('0x29')]['rawAttributes']);_0x34ed9e['query']=_['keys'](_0x33d570['query']);_0x34ed9e[_0x6fd4('0x36')]=_['intersection'](_0x34ed9e['model'],_0x34ed9e[_0x6fd4('0x2d')]);_0xdccba8[_0x6fd4('0x2f')]=_[_0x6fd4('0x2e')](_0x34ed9e[_0x6fd4('0x2c')],qs[_0x6fd4('0x30')](_0x33d570[_0x6fd4('0x2d')]['fields']));_0xdccba8[_0x6fd4('0x2f')]=_0xdccba8['attributes'][_0x6fd4('0x31')]?_0xdccba8['attributes']:_0x34ed9e[_0x6fd4('0x2c')];if(_0x33d570['query'][_0x6fd4('0x41')]){_0xdccba8[_0x6fd4('0x3c')]=[{'all':!![]}];}_0xdccba8=_[_0x6fd4('0x39')]({},_0xdccba8,_0x33d570[_0x6fd4('0x3b')]);return db[_0x6fd4('0x29')][_0x6fd4('0x42')](_0xdccba8)[_0x6fd4('0x23')](handleEntityNotFound(_0x169d41,null))[_0x6fd4('0x23')](respondWithResult(_0x169d41,null))['catch'](handleError(_0x169d41,null));};exports[_0x6fd4('0x43')]=function(_0x2e85e4,_0x433f7b){return db['WhatsappTransferReport']['create'](_0x2e85e4[_0x6fd4('0x44')],{})['then'](respondWithResult(_0x433f7b,0xc9))[_0x6fd4('0x3e')](handleError(_0x433f7b,null));};exports['update']=function(_0x55172c,_0x4bed16){if(_0x55172c[_0x6fd4('0x44')]['id']){delete _0x55172c[_0x6fd4('0x44')]['id'];}return db['WhatsappTransferReport'][_0x6fd4('0x42')]({'where':{'id':_0x55172c[_0x6fd4('0x3f')]['id']}})[_0x6fd4('0x23')](handleEntityNotFound(_0x4bed16,null))[_0x6fd4('0x23')](saveUpdates(_0x55172c[_0x6fd4('0x44')],null))[_0x6fd4('0x23')](respondWithResult(_0x4bed16,null))['catch'](handleError(_0x4bed16,null));};exports['destroy']=function(_0xbdbb78,_0x28d3c5){return db[_0x6fd4('0x29')][_0x6fd4('0x42')]({'where':{'id':_0xbdbb78[_0x6fd4('0x3f')]['id']}})[_0x6fd4('0x23')](handleEntityNotFound(_0x28d3c5,null))[_0x6fd4('0x23')](removeEntity(_0x28d3c5,null))[_0x6fd4('0x3e')](handleError(_0x28d3c5,null));};exports[_0x6fd4('0x45')]=function(_0x34848c,_0x33753c){return db[_0x6fd4('0x29')]['describe']()[_0x6fd4('0x23')](respondWithResult(_0x33753c,null))['catch'](handleError(_0x33753c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 8754de1..332143e 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 _0xf318=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define'];(function(_0x929c7e,_0x38c4cc){var _0x5de099=function(_0xc4e8d8){while(--_0xc4e8d8){_0x929c7e['push'](_0x929c7e['shift']());}};_0x5de099(++_0x38c4cc);}(_0xf318,0x81));var _0x8f31=function(_0x1813b6,_0xd77ff5){_0x1813b6=_0x1813b6-0x0;var _0x188af0=_0xf318[_0x1813b6];return _0x188af0;};'use strict';var _=require('lodash');var util=require(_0x8f31('0x0'));var logger=require(_0x8f31('0x1'))(_0x8f31('0x2'));var moment=require(_0x8f31('0x3'));var BPromise=require(_0x8f31('0x4'));var rp=require(_0x8f31('0x5'));var fs=require('fs');var path=require(_0x8f31('0x6'));var rimraf=require(_0x8f31('0x7'));var config=require('../../config/environment');var attributes=require(_0x8f31('0x8'));module[_0x8f31('0x9')]=function(_0x220945,_0x88267){return _0x220945[_0x8f31('0xa')](_0x8f31('0xb'),attributes,{'tableName':_0x8f31('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8f31('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x108b=['define','report_whatsapp_transfer','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x7d324f,_0x33cd55){var _0x4c54db=function(_0xf6a52c){while(--_0xf6a52c){_0x7d324f['push'](_0x7d324f['shift']());}};_0x4c54db(++_0x33cd55);}(_0x108b,0xb2));var _0xb108=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x108b[_0x5b5cde];return _0x364ad2;};'use strict';var _=require(_0xb108('0x0'));var util=require(_0xb108('0x1'));var logger=require('../../config/logger')(_0xb108('0x2'));var moment=require(_0xb108('0x3'));var BPromise=require(_0xb108('0x4'));var rp=require(_0xb108('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb108('0x6'));var config=require(_0xb108('0x7'));var attributes=require(_0xb108('0x8'));module['exports']=function(_0x16d645,_0x4f9d9b){return _0x16d645[_0xb108('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0xb108('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d0bb7fc..898f0c6 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 _0xcb1a=['request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0xfa73ff,_0x214d28){var _0x2d0300=function(_0x4fd6fb){while(--_0x4fd6fb){_0xfa73ff['push'](_0xfa73ff['shift']());}};_0x2d0300(++_0x214d28);}(_0xcb1a,0x1e9));var _0xacb1=function(_0x4aa205,_0x368e58){_0x4aa205=_0x4aa205-0x0;var _0x5c7ce4=_0xcb1a[_0x4aa205];return _0x5c7ce4;};'use strict';var _=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var moment=require('moment');var BPromise=require(_0xacb1('0x2'));var rs=require(_0xacb1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacb1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xacb1('0x5'))('rpc');var config=require(_0xacb1('0x6'));var jayson=require(_0xacb1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x114027,_0x19598b,_0x231e9e){return new BPromise(function(_0x175239,_0x55feaf){return client[_0xacb1('0x8')](_0x114027,_0x231e9e)['then'](function(_0x49cafe){logger[_0xacb1('0x9')](_0xacb1('0xa'),_0x19598b,_0xacb1('0xb'));logger[_0xacb1('0xc')](_0xacb1('0xd'),_0x19598b,'request\x20sent',JSON[_0xacb1('0xe')](_0x49cafe));if(_0x49cafe[_0xacb1('0xf')]){if(_0x49cafe['error'][_0xacb1('0x10')]===0x1f4){logger[_0xacb1('0xf')](_0xacb1('0xa'),_0x19598b,_0x49cafe[_0xacb1('0xf')]['message']);return _0x55feaf(_0x49cafe[_0xacb1('0xf')][_0xacb1('0x11')]);}logger[_0xacb1('0xf')](_0xacb1('0xa'),_0x19598b,_0x49cafe[_0xacb1('0xf')][_0xacb1('0x11')]);return _0x175239(_0x49cafe[_0xacb1('0xf')]['message']);}else{logger[_0xacb1('0x9')](_0xacb1('0xa'),_0x19598b,_0xacb1('0xb'));_0x175239(_0x49cafe[_0xacb1('0x12')]['message']);}})[_0xacb1('0x13')](function(_0x7c335d){logger[_0xacb1('0xf')](_0xacb1('0xa'),_0x19598b,_0x7c335d);_0x55feaf(_0x7c335d);});});} \ No newline at end of file +var _0x301a=['info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x229b0a,_0x2f0fb6){var _0x51796b=function(_0x465665){while(--_0x465665){_0x229b0a['push'](_0x229b0a['shift']());}};_0x51796b(++_0x2f0fb6);}(_0x301a,0xf1));var _0xa301=function(_0x29e8fb,_0x169e3c){_0x29e8fb=_0x29e8fb-0x0;var _0x21c0df=_0x301a[_0x29e8fb];return _0x21c0df;};'use strict';var _=require(_0xa301('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa301('0x1'));var fs=require('fs');var Redis=require(_0xa301('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa301('0x3'));var logger=require(_0xa301('0x4'))(_0xa301('0x5'));var config=require(_0xa301('0x6'));var jayson=require(_0xa301('0x7'));var client=jayson[_0xa301('0x8')][_0xa301('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151995,_0x513977,_0x29c68c){return new BPromise(function(_0x331189,_0x1051b8){return client[_0xa301('0xa')](_0x151995,_0x29c68c)['then'](function(_0xadc720){logger[_0xa301('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x513977,'request\x20sent');logger['debug'](_0xa301('0xc'),_0x513977,_0xa301('0xd'),JSON['stringify'](_0xadc720));if(_0xadc720[_0xa301('0xe')]){if(_0xadc720['error'][_0xa301('0xf')]===0x1f4){logger[_0xa301('0xe')](_0xa301('0x10'),_0x513977,_0xadc720[_0xa301('0xe')]['message']);return _0x1051b8(_0xadc720[_0xa301('0xe')]['message']);}logger[_0xa301('0xe')](_0xa301('0x10'),_0x513977,_0xadc720[_0xa301('0xe')]['message']);return _0x331189(_0xadc720[_0xa301('0xe')]['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x513977,_0xa301('0xd'));_0x331189(_0xadc720['result'][_0xa301('0x11')]);}})['catch'](function(_0x81e527){logger[_0xa301('0xe')](_0xa301('0x10'),_0x513977,_0x81e527);_0x1051b8(_0x81e527);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b25a0d8..0ee5b6d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeea0=['./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','exitCode','number','length','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app'];(function(_0x4063cd,_0x5f5443){var _0x3c7449=function(_0x99a77e){while(--_0x99a77e){_0x4063cd['push'](_0x4063cd['shift']());}};_0x3c7449(++_0x5f5443);}(_0xeea0,0x91));var _0x0eea=function(_0x49eff4,_0x70824e){_0x49eff4=_0x49eff4-0x0;var _0x4a0d03=_0xeea0[_0x49eff4];return _0x4a0d03;};'use strict';var _=require(_0x0eea('0x0'));var db=require(_0x0eea('0x1'))['db'];var seedDb=require(_0x0eea('0x2'));var checkLicense=require(_0x0eea('0x3'));var rpc=require(_0x0eea('0x4'));var config=require('./config/environment');var logger=require(_0x0eea('0x5'))(_0x0eea('0x6'));var pm2=require(_0x0eea('0x7'));var pm2Config=require(_0x0eea('0x8'));var schedule=require(_0x0eea('0x9'));var chat=require(_0x0eea('0xa'));var whatsapp=require(_0x0eea('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x0eea('0xc'));function main(){return db[_0x0eea('0xd')][_0x0eea('0xe')]()[_0x0eea('0xf')](function(){if(config[_0x0eea('0x10')]){return seedDb['default']();}})[_0x0eea('0xf')](function(){return checkLicense[_0x0eea('0x11')]();})[_0x0eea('0xf')](function(){return rpc[_0x0eea('0x12')]();})['then'](function(_0x4fd6b1){logger[_0x0eea('0x13')](_0x4fd6b1);return chat['start']();})['then'](function(){return whatsapp[_0x0eea('0x14')]();})[_0x0eea('0xf')](function(){return schedule['start']();})[_0x0eea('0xf')](function(){return transcribe['start']();})[_0x0eea('0xf')](function(){return provider['start']();})[_0x0eea('0xf')](function(_0x56a41d){logger['info'](_0x56a41d);return pm2[_0x0eea('0x14')](pm2Config);})[_0x0eea('0xf')](function(_0x5f2d5c){var _0x4c001f=_0x5f2d5c['filter'](function(_0x174f0c){return typeof _0x174f0c[_0x0eea('0x15')]===_0x0eea('0x16')&&_0x174f0c[_0x0eea('0x15')]>=0x0;});if(_0x4c001f[_0x0eea('0x17')]>0x0){throw new Error(_0x4c001f[_0x0eea('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x0eea('0x18')](_0x4c001f,function(_0x3a26cb){return'\x22'+_0x3a26cb[_0x0eea('0x19')][_0x0eea('0x1a')]+'\x22';}));}logger['info'](_0x0eea('0x1b'),_[_0x0eea('0x18')](_[_0x0eea('0x1c')](_0x5f2d5c,{'status':_0x0eea('0x1d')}),_0x0eea('0x1a'))[_0x0eea('0x1e')]());logger['info'](_0x0eea('0x1f'),_[_0x0eea('0x18')](_['filter'](_0x5f2d5c,function(_0x36e670){return _0x36e670[_0x0eea('0x20')]!==_0x0eea('0x1d');}),_0x0eea('0x1a'))['join']()||_0x0eea('0x21'));console['log'](_0x0eea('0x22'));})['catch'](function(_0xe49805){console[_0x0eea('0x23')](_0x0eea('0x24'),_0xe49805);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xe49805);process[_0x0eea('0x25')](0x1);});}main(); \ No newline at end of file +var _0x3937=['./config/seedDB','./config/license','./config/environment','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','start','info','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','filter','online','name','join','Offline\x20apps:','status','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash'];(function(_0x2b3dfe,_0x2e9db2){var _0xe18ef1=function(_0x109e43){while(--_0x109e43){_0x2b3dfe['push'](_0x2b3dfe['shift']());}};_0xe18ef1(++_0x2e9db2);}(_0x3937,0xbf));var _0x7393=function(_0x4f33c3,_0x5562d3){_0x4f33c3=_0x4f33c3-0x0;var _0x3d46ac=_0x3937[_0x4f33c3];return _0x3d46ac;};'use strict';var _=require(_0x7393('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x7393('0x1'));var checkLicense=require(_0x7393('0x2'));var rpc=require('./rpc');var config=require(_0x7393('0x3'));var logger=require('./config/logger')(_0x7393('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x7393('0x5'));var schedule=require(_0x7393('0x6'));var chat=require(_0x7393('0x7'));var whatsapp=require(_0x7393('0x8'));var transcribe=require(_0x7393('0x9'));var provider=require(_0x7393('0xa'));function main(){return db[_0x7393('0xb')][_0x7393('0xc')]()[_0x7393('0xd')](function(){if(config['seedDB']){return seedDb['default']();}})[_0x7393('0xd')](function(){return checkLicense[_0x7393('0xe')]();})[_0x7393('0xd')](function(){return rpc['listen']();})[_0x7393('0xd')](function(_0x5f0dd5){logger['info'](_0x5f0dd5);return chat['start']();})['then'](function(){return whatsapp[_0x7393('0xf')]();})[_0x7393('0xd')](function(){return schedule[_0x7393('0xf')]();})['then'](function(){return transcribe[_0x7393('0xf')]();})[_0x7393('0xd')](function(){return provider[_0x7393('0xf')]();})[_0x7393('0xd')](function(_0xe86cf4){logger[_0x7393('0x10')](_0xe86cf4);return pm2[_0x7393('0xf')](pm2Config);})[_0x7393('0xd')](function(_0x11030d){var _0x4e521c=_0x11030d['filter'](function(_0x414c37){return typeof _0x414c37['exitCode']==='number'&&_0x414c37['exitCode']>=0x0;});if(_0x4e521c[_0x7393('0x11')]>0x0){throw new Error(_0x4e521c['length']+_0x7393('0x12')+_[_0x7393('0x13')](_0x4e521c,function(_0x5b8b03){return'\x22'+_0x5b8b03[_0x7393('0x14')]['name']+'\x22';}));}logger['info'](_0x7393('0x15'),_[_0x7393('0x13')](_[_0x7393('0x16')](_0x11030d,{'status':_0x7393('0x17')}),_0x7393('0x18'))[_0x7393('0x19')]());logger[_0x7393('0x10')](_0x7393('0x1a'),_['map'](_['filter'](_0x11030d,function(_0x30eae3){return _0x30eae3[_0x7393('0x1b')]!==_0x7393('0x17');}),_0x7393('0x18'))[_0x7393('0x19')]()||'None');console['log']('App\x20Ready!');})[_0x7393('0x1c')](function(_0x5b5ca9){console['log'](_0x7393('0x1d'),_0x5b5ca9);logger[_0x7393('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5b5ca9);process[_0x7393('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d8f13f5..e31a0d4 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 _0xe499=['updatePasswordsHistory','length','unshift','join','promisify','sign','secret','secrets','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','basic-auth','bluebird','util','session','role','fullname','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isAuthenticated','use','user','ChatInteraction','closed','disposition','then','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','name','authenticate','pass','status','Wrong\x20credentials.','json','Unknown\x20authorization\x20format','query','apikey','getUuid','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','redirect','/dashboards/general','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','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.','Sequelize'];(function(_0x9a4be4,_0x48d8b9){var _0x32f318=function(_0x1a8395){while(--_0x1a8395){_0x9a4be4['push'](_0x9a4be4['shift']());}};_0x32f318(++_0x48d8b9);}(_0xe499,0x90));var _0x9e49=function(_0x48ae97,_0x450240){_0x48ae97=_0x48ae97-0x0;var _0x13a62f=_0xe499[_0x48ae97];return _0x13a62f;};'use strict';var db=require(_0x9e49('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x9e49('0x1'));var licenseUtil=require(_0x9e49('0x2'));var encryptor=require(_0x9e49('0x3'));var _=require(_0x9e49('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x9e49('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x9e49('0x6'));var crypto=require('crypto');var BPromise=require(_0x9e49('0x7'));var util=require(_0x9e49('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0x9e49('0x9')]});var userAttributes=['id',_0x9e49('0xa'),_0x9e49('0xb'),'name',_0x9e49('0xc'),_0x9e49('0xd'),_0x9e49('0xe'),_0x9e49('0xf'),_0x9e49('0x10'),'voicePause',_0x9e49('0x11'),_0x9e49('0x12'),_0x9e49('0x13'),'smsPause',_0x9e49('0x14'),'pauseType',_0x9e49('0x15'),_0x9e49('0x16'),_0x9e49('0x17'),_0x9e49('0x18'),_0x9e49('0x19'),'passwordResetAt',_0x9e49('0x1a'),_0x9e49('0x1b'),_0x9e49('0x1c'),_0x9e49('0x1d'),_0x9e49('0x1e'),'phoneBarEnableDtmfTone',_0x9e49('0x1f'),'phoneBarExpires',_0x9e49('0x20'),_0x9e49('0x21'),_0x9e49('0x22'),'hotdesk',_0x9e49('0x23'),_0x9e49('0x24'),_0x9e49('0x25'),_0x9e49('0x26'),_0x9e49('0x27'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x9e49('0x28'),_0x9e49('0x29'),_0x9e49('0x2a')];exports['isChatInteractionAuthorized']=function(){return this[_0x9e49('0x2b')](!![])[_0x9e49('0x2c')](function(_0x245ccc,_0x491842,_0x3ed1ea){if(_0x245ccc[_0x9e49('0x2d')]){_0x3ed1ea();}else{return db[_0x9e49('0x2e')]['findOne']({'where':{'id':_0x245ccc['params']['id']},'attributes':['id',_0x9e49('0x2f'),_0x9e49('0x30')],'raw':!![]})[_0x9e49('0x31')](function(_0x506b53){if(_0x506b53&&_0x506b53[_0x9e49('0x2f')]){return _0x491842['status'](_0x506b53[_0x9e49('0x30')]===_0x9e49('0x32')?0x195:0x193)['json']({'message':_0x506b53[_0x9e49('0x30')]==='unmanaged'?_0x9e49('0x33'):_0x9e49('0x34')});}else{_0x3ed1ea();}})[_0x9e49('0x35')](function(_0x43d551){_0x3ed1ea(_0x43d551);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3bb80e){return compose()[_0x9e49('0x2c')](function(_0x4d3826,_0x4142d3,_0x30aa85){var _0x54ee98;if(_0x4d3826['headers'][_0x9e49('0x36')]){if(_[_0x9e49('0x37')](_0x4d3826[_0x9e49('0x38')][_0x9e49('0x36')],_0x9e49('0x39'))){var _0x310aa5=basicAuth(_0x4d3826);db[_0x9e49('0x3a')][_0x9e49('0x3b')]({'where':{'name':_0x310aa5[_0x9e49('0x3c')]}})[_0x9e49('0x31')](function(_0xc5e67d){if(!_0xc5e67d||!_0xc5e67d[_0x9e49('0x3d')](_0x310aa5[_0x9e49('0x3e')])){return _0x4142d3[_0x9e49('0x3f')](0x191)['json']({'message':_0x9e49('0x40')});}_0x4d3826['user']={'id':_0xc5e67d['id']};_0x30aa85();})[_0x9e49('0x35')](function(_0x291ad6){_0x30aa85(_0x291ad6);});}else if(_[_0x9e49('0x37')](_0x4d3826[_0x9e49('0x38')]['authorization'],'Bearer')){validateJwt(_0x4d3826,_0x4142d3,_0x30aa85);}else{if(_0x3bb80e){_0x30aa85();}else{return _0x4142d3[_0x9e49('0x3f')](0x193)[_0x9e49('0x41')]({'message':_0x9e49('0x42')});}}}else if(_0x4d3826[_0x9e49('0x43')][_0x9e49('0x44')]){try{var _0x1fe3ad={'audience':hardwareConf[_0x9e49('0x45')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x4d3826['query'][_0x9e49('0x44')],_0x1fe3ad)[_0x9e49('0x31')](function(_0x2aa87c){return db[_0x9e49('0x3a')][_0x9e49('0x3b')]({'where':{'id':_0x2aa87c['sub']}})[_0x9e49('0x31')](function(_0xb14df){_0x54ee98=_0xb14df;return db[_0x9e49('0x46')][_0x9e49('0x47')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9e49('0x48')],'raw':!![]});})[_0x9e49('0x31')](function(_0x3a0857){if(!_0x54ee98||!_[_0x9e49('0x49')](_0x54ee98[_0x9e49('0x4a')],_0x2aa87c[_0x9e49('0x4b')])){return _0x4142d3[_0x9e49('0x3f')](0x191)[_0x9e49('0x41')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x54ee98[_0x9e49('0x4c')]){return _0x4142d3[_0x9e49('0x3f')](0x191)[_0x9e49('0x41')]({'message':_0x9e49('0x4d')});}if(_0x54ee98[_0x9e49('0x4e')]){if(_0x3a0857[_0x9e49('0x48')]>0x0){if(moment(_0x54ee98[_0x9e49('0x4f')])[_0x9e49('0x50')](_0x3a0857[_0x9e49('0x48')],_0x9e49('0x51'))>moment()){return _0x4142d3['status'](0x191)['json']({'message':_0x9e49('0x4d')});}}else{return _0x4142d3[_0x9e49('0x3f')](0x191)[_0x9e49('0x41')]({'message':_0x9e49('0x4d')});}}_0x4d3826['user']={'id':_0x54ee98['id']};_0x30aa85();});})[_0x9e49('0x35')](function(){return _0x4142d3[_0x9e49('0x3f')](0x191)[_0x9e49('0x41')]({'message':_0x9e49('0x4d')});});}catch(_0x2ad3a6){_0x30aa85(_0x2ad3a6);}}else if(_0x3bb80e){_0x30aa85();}else{return _0x4142d3[_0x9e49('0x3f')](0x193)[_0x9e49('0x41')]({'message':_0x9e49('0x42')});}})['use'](function(_0x3f9c8a,_0x1312e2,_0x4d6026){if(_0x3f9c8a[_0x9e49('0x2d')]){db[_0x9e49('0x3a')][_0x9e49('0x3b')]({'where':{'id':_0x3f9c8a[_0x9e49('0x2d')]['id']},'attributes':userAttributes})[_0x9e49('0x31')](function(_0x3f148e){if(!_0x3f148e){return _0x1312e2[_0x9e49('0x3f')](0x194)[_0x9e49('0x41')]({'message':_0x9e49('0x52')});}_0x3f9c8a[_0x9e49('0x2d')]=_0x3f148e;_0x4d6026();})[_0x9e49('0x35')](function(_0xc4739){_0x4d6026(_0xc4739);});}else if(_0x3bb80e){_0x4d6026();}else{return _0x1312e2[_0x9e49('0x3f')](0x194)[_0x9e49('0x41')]({'message':_0x9e49('0x53')});}});};exports[_0x9e49('0x54')]=function canUpdate(){return compose()[_0x9e49('0x2c')](function(_0x4cb3f5,_0x58cc9e,_0x437be1){return licenseUtil[_0x9e49('0x55')]()[_0x9e49('0x31')](function(_0x4514a0){if(_0x4514a0[_0x9e49('0x56')]){_0x437be1();}else{return _0x58cc9e[_0x9e49('0x3f')](0x193)[_0x9e49('0x41')]({'message':_0x9e49('0x57')});}})['catch'](function(_0x3e3045){_0x437be1(_0x3e3045);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x9e49('0x2c')](function(_0x1791c8,_0x2b1d5a,_0x4e28e7){return licenseUtil[_0x9e49('0x55')]()['then'](function(_0x319a03){if(_0x319a03['webrtc']){_0x4e28e7();}else{return _0x2b1d5a[_0x9e49('0x3f')](0x193)[_0x9e49('0x41')]({'message':_0x9e49('0x57')});}})[_0x9e49('0x35')](function(_0xe5f0f4){_0x4e28e7(_0xe5f0f4);});});};exports[_0x9e49('0x58')]=function(_0x1103e4,_0x194930,_0x5c0e24){_0x1103e4['isMiddleware']=!![];return _0x5c0e24();};exports[_0x9e49('0x59')]=function signToken(_0x3380b7){return signJwt(_0x3380b7);};exports[_0x9e49('0x5a')]=function(_0x31a178,_0x245f11){if(!_0x31a178[_0x9e49('0x2d')]){return _0x245f11['status'](0x194)[_0x9e49('0x41')]({'message':_0x9e49('0x5b')});}var _0x179243={'payload':{'id':_0x31a178[_0x9e49('0x2d')]['id'],'role':_0x31a178['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x179243)[_0x9e49('0x31')](function(_0x2a2fa5){_0x245f11['cookie']('motion.token',_0x2a2fa5);_0x245f11[_0x9e49('0x5c')](_0x9e49('0x5d'));})['catch'](function(_0x395fcc){return _0x245f11[_0x9e49('0x3f')](0x1f4)[_0x9e49('0x5e')](_0x395fcc);});};exports['retrieveApiKey']=function(_0x2deb05){if(_[_0x9e49('0x5f')](_0x2deb05[_0x9e49('0x4a')])||_[_0x9e49('0x5f')](_0x2deb05['apiKeyIat'])){return null;}else{return createJwt(_0x2deb05);}};exports[_0x9e49('0x60')]=function(_0x543f7d){_0x543f7d[_0x9e49('0x4a')]=generateNonce();_0x543f7d['apiKeyIat']=generateIssuedAt();return createJwt(_0x543f7d);};exports[_0x9e49('0x61')]=function(_0x3ba009,_0xec4636){var _0x436fdc=_0x3ba009[_0x9e49('0x43')]['apikey'];if(_0x436fdc){var _0x495cd3={'nonce':_0xec4636[_0x9e49('0x4a')],'iat':_0xec4636[_0x9e49('0x62')],'audience':hardwareConf[_0x9e49('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x436fdc,_0x495cd3)['then'](function(){return generateApiKey(_0xec4636);});}else{throw{'message':_0x9e49('0x63')};}};exports[_0x9e49('0x64')]=function(_0x51c411){var _0x5837c8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5837c8[_0x9e49('0x65')](_0x51c411))throw new db['Sequelize'][(_0x9e49('0x66'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x9e49('0x67')]=function(_0x5067ec,_0x32758b,_0x174be0){var _0x155fc1=encryptor[_0x9e49('0x68')](_0x32758b)[_0x9e49('0x69')](',');for(var _0x2f8a1b=0x0;_0x2f8a1b<_0x174be0;_0x2f8a1b++){if(!_0x155fc1[_0x2f8a1b])break;if(_0x5067ec[_0x9e49('0x6a')]()===_0x155fc1[_0x2f8a1b][_0x9e49('0x6a')]()){var _0x1e4dbb=util['format'](_0x9e49('0x6b'),_0x174be0);if(_0x174be0===0x1){_0x1e4dbb=_0x9e49('0x6c');}throw new db[(_0x9e49('0x6d'))]['ValidationError'](_0x1e4dbb);}}return;};exports[_0x9e49('0x6e')]=function(_0x3d31d1,_0x50876e){var _0xf38e88=_0x50876e?encryptor[_0x9e49('0x68')](_0x50876e)[_0x9e49('0x69')](','):[];if(_0xf38e88[_0x9e49('0x6f')]===0x5){_0xf38e88['splice'](-0x1,0x1);}_0xf38e88[_0x9e49('0x70')](_0x3d31d1);return encryptor['encryptString'](_0xf38e88[_0x9e49('0x71')](','));};function signJwt(_0x175f82){var _0x5e712a=BPromise[_0x9e49('0x72')](jwt[_0x9e49('0x73')],{'context':jwt});var _0x39f4a8=_0x175f82[_0x9e49('0x74')]||config[_0x9e49('0x75')]['session'];return new BPromise(function(_0x32b0ba,_0x1c921c){_0x5e712a(_0x175f82[_0x9e49('0x76')],_0x39f4a8,_0x175f82[_0x9e49('0x77')])[_0x9e49('0x31')](function(_0x52f2b9){_0x32b0ba(_0x52f2b9);})['catch'](function(_0x5fecfc){_0x1c921c(_0x5fecfc);});});}function verifyJwt(_0x51bef0,_0x5d182f,_0x5e31bc){var _0x3bb647=BPromise[_0x9e49('0x72')](jwt[_0x9e49('0x78')],{'context':jwt});var _0x2ad644=_0x5e31bc||config[_0x9e49('0x75')][_0x9e49('0x9')];return new BPromise(function(_0x7aadcc,_0xfee1fc){_0x3bb647(_0x51bef0,_0x2ad644,_0x5d182f)['then'](function(_0x44ba7a){_0x7aadcc(_0x44ba7a);})['catch'](function(_0x3f2de5){_0xfee1fc(_0x3f2de5);});});}function generateNonce(){return crypto[_0x9e49('0x79')](0x10)[_0x9e49('0x7a')](_0x9e49('0x7b'));}function generateIssuedAt(){return Math[_0x9e49('0x7c')](Date[_0x9e49('0x7d')]()/0x3e8)[_0x9e49('0x7a')]();}function createJwt(_0x54620a){var _0x3c9a73={'payload':{'iat':_0x54620a[_0x9e49('0x62')],'nonce':_0x54620a['apiKeyNonce']},'options':{'algorithm':_0x9e49('0x7e'),'subject':_0x54620a['id'][_0x9e49('0x7a')](),'issuer':hardwareConf[_0x9e49('0x45')](),'audience':hardwareConf[_0x9e49('0x45')]()}};return signJwt(_0x3c9a73)[_0x9e49('0x31')](function(_0x5e284e){return{'iat':_0x54620a['apiKeyIat'],'nonce':_0x54620a[_0x9e49('0x4a')],'token':_0x5e284e};});} \ No newline at end of file +var _0xe145=['Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','length','splice','encryptString','join','promisify','sign','secret','payload','verify','randomBytes','toString','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','user','findOne','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','use','headers','authorization','startsWith','User','find','pass','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\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','regenerateApiKey'];(function(_0x25301d,_0x5f33b3){var _0x543c37=function(_0x192172){while(--_0x192172){_0x25301d['push'](_0x25301d['shift']());}};_0x543c37(++_0x5f33b3);}(_0xe145,0x10b));var _0x5e14=function(_0x11e7d8,_0x125e63){_0x11e7d8=_0x11e7d8-0x0;var _0x1eddfa=_0xe145[_0x11e7d8];return _0x1eddfa;};'use strict';var db=require(_0x5e14('0x0'))['db'];var config=require(_0x5e14('0x1'));var hardwareConf=require(_0x5e14('0x2'));var licenseUtil=require(_0x5e14('0x3'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x5e14('0x4'));var compose=require(_0x5e14('0x5'));var basicAuth=require(_0x5e14('0x6'));var crypto=require('crypto');var BPromise=require(_0x5e14('0x7'));var util=require(_0x5e14('0x8'));var moment=require(_0x5e14('0x9'));var validateJwt=expressJwt({'secret':config[_0x5e14('0xa')][_0x5e14('0xb')]});var userAttributes=['id','role',_0x5e14('0xc'),_0x5e14('0xd'),_0x5e14('0xe'),_0x5e14('0xf'),_0x5e14('0x10'),_0x5e14('0x11'),_0x5e14('0x12'),'voicePause',_0x5e14('0x13'),_0x5e14('0x14'),_0x5e14('0x15'),'smsPause',_0x5e14('0x16'),_0x5e14('0x17'),'showWebBar',_0x5e14('0x18'),_0x5e14('0x19'),_0x5e14('0x1a'),_0x5e14('0x1b'),_0x5e14('0x1c'),'alias','phoneBarAutoAnswer',_0x5e14('0x1d'),'phoneBarDnd','phoneBarEnableRecording',_0x5e14('0x1e'),_0x5e14('0x1f'),_0x5e14('0x20'),_0x5e14('0x21'),_0x5e14('0x22'),'phoneBarRemoteControlPort',_0x5e14('0x23'),'interface','userProfileId','privacyEnabled',_0x5e14('0x24'),_0x5e14('0x25'),'downloadVoiceRecordings',_0x5e14('0x26'),_0x5e14('0x27'),_0x5e14('0x28'),_0x5e14('0x29')];exports[_0x5e14('0x2a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x3fe5c7,_0x40196c,_0x233246){if(_0x3fe5c7[_0x5e14('0x2b')]){_0x233246();}else{return db['ChatInteraction'][_0x5e14('0x2c')]({'where':{'id':_0x3fe5c7['params']['id']},'attributes':['id',_0x5e14('0x2d'),'disposition'],'raw':!![]})[_0x5e14('0x2e')](function(_0x2cc737){if(_0x2cc737&&_0x2cc737[_0x5e14('0x2d')]){return _0x40196c[_0x5e14('0x2f')](_0x2cc737[_0x5e14('0x30')]===_0x5e14('0x31')?0x195:0x193)[_0x5e14('0x32')]({'message':_0x2cc737['disposition']==='unmanaged'?_0x5e14('0x33'):_0x5e14('0x34')});}else{_0x233246();}})[_0x5e14('0x35')](function(_0x3e391d){_0x233246(_0x3e391d);});}});};exports[_0x5e14('0x36')]=function isAuthenticated(_0x2de0d3){return compose()[_0x5e14('0x37')](function(_0x4cc8cf,_0x35354c,_0x573398){var _0x1fcabe;if(_0x4cc8cf[_0x5e14('0x38')][_0x5e14('0x39')]){if(_[_0x5e14('0x3a')](_0x4cc8cf['headers']['authorization'],'Basic')){var _0x18b20f=basicAuth(_0x4cc8cf);db[_0x5e14('0x3b')][_0x5e14('0x3c')]({'where':{'name':_0x18b20f[_0x5e14('0xd')]}})[_0x5e14('0x2e')](function(_0x44ad59){if(!_0x44ad59||!_0x44ad59['authenticate'](_0x18b20f[_0x5e14('0x3d')])){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':'Wrong\x20credentials.'});}_0x4cc8cf[_0x5e14('0x2b')]={'id':_0x44ad59['id']};_0x573398();})[_0x5e14('0x35')](function(_0x298d55){_0x573398(_0x298d55);});}else if(_[_0x5e14('0x3a')](_0x4cc8cf[_0x5e14('0x38')][_0x5e14('0x39')],_0x5e14('0x3e'))){validateJwt(_0x4cc8cf,_0x35354c,_0x573398);}else{if(_0x2de0d3){_0x573398();}else{return _0x35354c[_0x5e14('0x2f')](0x193)[_0x5e14('0x32')]({'message':_0x5e14('0x3f')});}}}else if(_0x4cc8cf[_0x5e14('0x40')]['apikey']){try{var _0x1f6626={'audience':hardwareConf[_0x5e14('0x41')](),'issuer':hardwareConf[_0x5e14('0x41')]()};verifyJwt(_0x4cc8cf['query'][_0x5e14('0x42')],_0x1f6626)[_0x5e14('0x2e')](function(_0x4891c4){return db[_0x5e14('0x3b')][_0x5e14('0x3c')]({'where':{'id':_0x4891c4['sub']}})[_0x5e14('0x2e')](function(_0xbe3f42){_0x1fcabe=_0xbe3f42;return db[_0x5e14('0x43')]['findOne']({'where':{'id':0x1},'attributes':[_0x5e14('0x44'),_0x5e14('0x45')],'raw':!![]});})['then'](function(_0x5a4db1){if(!_0x1fcabe||!_[_0x5e14('0x46')](_0x1fcabe[_0x5e14('0x47')],_0x4891c4[_0x5e14('0x48')])){return _0x35354c[_0x5e14('0x2f')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1fcabe['disabled']){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});}if(_0x1fcabe[_0x5e14('0x4a')]){if(_0x5a4db1[_0x5e14('0x45')]>0x0){if(moment(_0x1fcabe[_0x5e14('0x4b')])[_0x5e14('0x4c')](_0x5a4db1[_0x5e14('0x45')],_0x5e14('0x4d'))>moment()){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});}}else{return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});}}_0x4cc8cf['user']={'id':_0x1fcabe['id']};_0x573398();});})[_0x5e14('0x35')](function(){return _0x35354c[_0x5e14('0x2f')](0x191)[_0x5e14('0x32')]({'message':_0x5e14('0x49')});});}catch(_0xef3f5f){_0x573398(_0xef3f5f);}}else if(_0x2de0d3){_0x573398();}else{return _0x35354c[_0x5e14('0x2f')](0x193)['json']({'message':_0x5e14('0x3f')});}})['use'](function(_0x4b5eb6,_0x204f44,_0xe6146e){if(_0x4b5eb6[_0x5e14('0x2b')]){db['User']['find']({'where':{'id':_0x4b5eb6[_0x5e14('0x2b')]['id']},'attributes':userAttributes})[_0x5e14('0x2e')](function(_0x27ce1b){if(!_0x27ce1b){return _0x204f44[_0x5e14('0x2f')](0x194)[_0x5e14('0x32')]({'message':_0x5e14('0x4e')});}_0x4b5eb6[_0x5e14('0x2b')]=_0x27ce1b;_0xe6146e();})[_0x5e14('0x35')](function(_0x490784){_0xe6146e(_0x490784);});}else if(_0x2de0d3){_0xe6146e();}else{return _0x204f44[_0x5e14('0x2f')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5e14('0x4f')]=function canUpdate(){return compose()[_0x5e14('0x37')](function(_0x3f233f,_0x56cb96,_0x31b58c){return licenseUtil[_0x5e14('0x50')]()[_0x5e14('0x2e')](function(_0x2ab29c){if(_0x2ab29c[_0x5e14('0x51')]){_0x31b58c();}else{return _0x56cb96['status'](0x193)[_0x5e14('0x32')]({'message':_0x5e14('0x52')});}})[_0x5e14('0x35')](function(_0xb04e50){_0x31b58c(_0xb04e50);});});};exports[_0x5e14('0x53')]=function isWebrtcLicence(){return compose()[_0x5e14('0x37')](function(_0x36bc1f,_0x4550f6,_0x2c17d9){return licenseUtil[_0x5e14('0x50')]()[_0x5e14('0x2e')](function(_0x5f1082){if(_0x5f1082[_0x5e14('0x54')]){_0x2c17d9();}else{return _0x4550f6['status'](0x193)['json']({'message':_0x5e14('0x52')});}})[_0x5e14('0x35')](function(_0x41f9ac){_0x2c17d9(_0x41f9ac);});});};exports[_0x5e14('0x55')]=function(_0x41f438,_0x24e67,_0x4c9ee5){_0x41f438[_0x5e14('0x55')]=!![];return _0x4c9ee5();};exports[_0x5e14('0x56')]=function signToken(_0x3408a2){return signJwt(_0x3408a2);};exports[_0x5e14('0x57')]=function(_0x52bb13,_0x43de74){if(!_0x52bb13[_0x5e14('0x2b')]){return _0x43de74[_0x5e14('0x2f')](0x194)['json']({'message':_0x5e14('0x58')});}var _0x4ff08e={'payload':{'id':_0x52bb13[_0x5e14('0x2b')]['id'],'role':_0x52bb13[_0x5e14('0x2b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4ff08e)[_0x5e14('0x2e')](function(_0x4acd4e){_0x43de74[_0x5e14('0x59')](_0x5e14('0x5a'),_0x4acd4e);_0x43de74[_0x5e14('0x5b')](_0x5e14('0x5c'));})[_0x5e14('0x35')](function(_0x23ac32){return _0x43de74[_0x5e14('0x2f')](0x1f4)[_0x5e14('0x5d')](_0x23ac32);});};exports[_0x5e14('0x5e')]=function(_0x1662a1){if(_[_0x5e14('0x5f')](_0x1662a1['apiKeyNonce'])||_[_0x5e14('0x5f')](_0x1662a1[_0x5e14('0x60')])){return null;}else{return createJwt(_0x1662a1);}};exports[_0x5e14('0x61')]=function(_0x492f78){_0x492f78['apiKeyNonce']=generateNonce();_0x492f78['apiKeyIat']=generateIssuedAt();return createJwt(_0x492f78);};exports[_0x5e14('0x62')]=function(_0x4a322b,_0xd3c835){var _0x375d3b=_0x4a322b[_0x5e14('0x40')][_0x5e14('0x42')];if(_0x375d3b){var _0x5b9b7f={'nonce':_0xd3c835[_0x5e14('0x47')],'iat':_0xd3c835['apiKeyIat'],'audience':hardwareConf[_0x5e14('0x41')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x375d3b,_0x5b9b7f)[_0x5e14('0x2e')](function(){return generateApiKey(_0xd3c835);});}else{throw{'message':_0x5e14('0x63')};}};exports['validatePasswordPattern']=function(_0x1f5466){var _0x288388=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x288388['test'](_0x1f5466))throw new db['Sequelize'][(_0x5e14('0x64'))](_0x5e14('0x65'));return;};exports['validatePasswordHistory']=function(_0x241f43,_0x9e3647,_0x1e8d20){var _0x3a6716=encryptor[_0x5e14('0x66')](_0x9e3647)[_0x5e14('0x67')](',');for(var _0x151402=0x0;_0x151402<_0x1e8d20;_0x151402++){if(!_0x3a6716[_0x151402])break;if(_0x241f43[_0x5e14('0x68')]()===_0x3a6716[_0x151402]['toLowerCase']()){var _0x4b5d53=util[_0x5e14('0x69')](_0x5e14('0x6a'),_0x1e8d20);if(_0x1e8d20===0x1){_0x4b5d53=_0x5e14('0x6b');}throw new db[(_0x5e14('0x6c'))]['ValidationError'](_0x4b5d53);}}return;};exports['updatePasswordsHistory']=function(_0xaa6136,_0x5d5134){var _0x29874a=_0x5d5134?encryptor['decryptString'](_0x5d5134)[_0x5e14('0x67')](','):[];if(_0x29874a[_0x5e14('0x6d')]===0x5){_0x29874a[_0x5e14('0x6e')](-0x1,0x1);}_0x29874a['unshift'](_0xaa6136);return encryptor[_0x5e14('0x6f')](_0x29874a[_0x5e14('0x70')](','));};function signJwt(_0x2aed42){var _0x3886cb=BPromise[_0x5e14('0x71')](jwt[_0x5e14('0x72')],{'context':jwt});var _0x411c1d=_0x2aed42[_0x5e14('0x73')]||config[_0x5e14('0xa')][_0x5e14('0xb')];return new BPromise(function(_0x5b064b,_0x1e14f4){_0x3886cb(_0x2aed42[_0x5e14('0x74')],_0x411c1d,_0x2aed42['options'])[_0x5e14('0x2e')](function(_0x1b2e92){_0x5b064b(_0x1b2e92);})[_0x5e14('0x35')](function(_0x43ea1a){_0x1e14f4(_0x43ea1a);});});}function verifyJwt(_0x2f5afc,_0x2ec24a,_0x427eac){var _0x3e9f9b=BPromise[_0x5e14('0x71')](jwt[_0x5e14('0x75')],{'context':jwt});var _0x4db4fb=_0x427eac||config[_0x5e14('0xa')][_0x5e14('0xb')];return new BPromise(function(_0x23e8c2,_0x1e1bbc){_0x3e9f9b(_0x2f5afc,_0x4db4fb,_0x2ec24a)[_0x5e14('0x2e')](function(_0x2b6237){_0x23e8c2(_0x2b6237);})[_0x5e14('0x35')](function(_0x1c931f){_0x1e1bbc(_0x1c931f);});});}function generateNonce(){return crypto[_0x5e14('0x76')](0x10)[_0x5e14('0x77')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x5e14('0x78')]()/0x3e8)[_0x5e14('0x77')]();}function createJwt(_0x1c0e80){var _0x5242fc={'payload':{'iat':_0x1c0e80[_0x5e14('0x60')],'nonce':_0x1c0e80[_0x5e14('0x47')]},'options':{'algorithm':_0x5e14('0x79'),'subject':_0x1c0e80['id'][_0x5e14('0x77')](),'issuer':hardwareConf[_0x5e14('0x41')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5242fc)['then'](function(_0x1c3ff3){return{'iat':_0x1c0e80[_0x5e14('0x60')],'nonce':_0x1c0e80[_0x5e14('0x47')],'token':_0x1c3ff3};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d2b6b1f..703e0c9 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 _0x7a90=['createWriteStream','data','update','binary','write','end','unlink','decryptFile','createReadStream','createDecipher','final','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','encryptFile'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x7a90,0x1a4));var _0x07a9=function(_0x21a55b,_0x2509d2){_0x21a55b=_0x21a55b-0x0;var _0x3236f5=_0x7a90[_0x21a55b];return _0x3236f5;};'use strict';var crypto=require(_0x07a9('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x07a9('0x1'));var config=require(_0x07a9('0x2'));var logger=require(_0x07a9('0x3'))(_0x07a9('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x07a9('0x5')][_0x07a9('0x6')],'algorithm':_0x07a9('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x07a9('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x07a9('0x8')][_0x07a9('0x9')]);if(isSupported){fileOptions[_0x07a9('0x9')]=config[_0x07a9('0x8')][_0x07a9('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x07a9('0x8')][_0x07a9('0x9')],_0x07a9('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x818ac4){return AES_SUPPORTED_RX[_0x07a9('0xb')](_0x818ac4);}function getSupportedCiphers(){return crypto[_0x07a9('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x307092){return getSupportedCiphers()['indexOf'](_0x307092)>-0x1;}function combineOptions(_0x260d57){var _0x43dff9={};for(var _0x324268 in fileOptions){if(fileOptions['hasOwnProperty'](_0x324268)){_0x43dff9[_0x324268]=fileOptions[_0x324268];}}if(_0x260d57){for(var _0x3dff3e in _0x260d57){if(_0x260d57['hasOwnProperty'](_0x3dff3e)){_0x43dff9[_0x3dff3e]=_0x260d57[_0x3dff3e];}}}return _0x43dff9;}exports[_0x07a9('0xd')]=function(_0x29a059,_0x3565e9,_0x4790df,_0x2441a5){return new BPromise(function(_0x404bc6,_0xed14d){_0x2441a5=combineOptions(_0x2441a5);var _0x25484b=new Buffer(_0x4790df);var _0x467227=fs['createReadStream'](_0x29a059);var _0x53b36f=fs[_0x07a9('0xe')](_0x3565e9);var _0x13d675=crypto['createCipher'](_0x2441a5['algorithm'],_0x25484b);_0x467227['on'](_0x07a9('0xf'),function(_0x50f538){var _0x21f522=new Buffer(_0x13d675[_0x07a9('0x10')](_0x50f538),_0x07a9('0x11'));_0x53b36f['write'](_0x21f522);});_0x467227['on']('end',function(){try{var _0x1412f6=new Buffer(_0x13d675['final']('binary'),_0x07a9('0x11'));_0x53b36f[_0x07a9('0x12')](_0x1412f6);_0x53b36f[_0x07a9('0x13')]();_0x53b36f['on']('close',function(){return _0x404bc6(_0x3565e9);});}catch(_0x5b35be){fs[_0x07a9('0x14')](_0x3565e9);return _0xed14d(_0x5b35be);}});});};exports[_0x07a9('0x15')]=function(_0x53577f,_0x2b52e9,_0x3486f2,_0x1611fc){return new BPromise(function(_0x4d9f5f,_0x2e303f){_0x1611fc=combineOptions(_0x1611fc);var _0x5b8bff=new Buffer(_0x3486f2);var _0x3d7074=fs[_0x07a9('0x16')](_0x53577f);var _0x308497=fs[_0x07a9('0xe')](_0x2b52e9);var _0x48d39e=crypto[_0x07a9('0x17')](_0x1611fc[_0x07a9('0x9')],_0x5b8bff);_0x3d7074['on']('data',function(_0x103203){var _0x2f3a37=new Buffer(_0x48d39e[_0x07a9('0x10')](_0x103203),'binary');_0x308497[_0x07a9('0x12')](_0x2f3a37);});_0x3d7074['on']('end',function(){try{var _0x41e3df=new Buffer(_0x48d39e[_0x07a9('0x18')](_0x07a9('0x11')),_0x07a9('0x11'));_0x308497[_0x07a9('0x12')](_0x41e3df);_0x308497[_0x07a9('0x13')]();_0x308497['on']('close',function(){return _0x4d9f5f(_0x2b52e9);});}catch(_0x9363a9){fs['unlink'](_0x2b52e9);return _0x2e303f(_0x9363a9);}});});};exports[_0x07a9('0x19')]=function(_0x38f5ca,_0xe02d19,_0x3b199c){var _0x3eff76=_0x3b199c||stringOptions[_0x07a9('0x9')];var _0x3e5d6f=_0xe02d19||stringOptions[_0x07a9('0x1a')];var _0x4fbb88=crypto[_0x07a9('0x1b')](_0x3eff76,_0x3e5d6f);var _0xcca8fd=_0x4fbb88[_0x07a9('0x10')](_0x38f5ca,_0x07a9('0x1c'),_0x07a9('0x1d'));_0xcca8fd+=_0x4fbb88['final'](_0x07a9('0x1d'));return _0xcca8fd;};exports[_0x07a9('0x1e')]=function(_0x96d831,_0x4896d4,_0xd2c9fa){var _0x401dde=_0xd2c9fa||stringOptions['algorithm'];var _0x34cbd2=_0x4896d4||stringOptions[_0x07a9('0x1a')];var _0x5859ef=crypto[_0x07a9('0x17')](_0x401dde,_0x34cbd2);var _0x39a01a=_0x5859ef['update'](_0x96d831,_0x07a9('0x1d'),_0x07a9('0x1c'));_0x39a01a+=_0x5859ef[_0x07a9('0x18')](_0x07a9('0x1c'));return _0x39a01a;}; \ No newline at end of file +var _0xa381=['test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','end','close','unlink','decryptFile','createReadStream','createDecipher','write','encryptString','secret','createCipher','utf8','base64','final','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa381,0xf6));var _0x1a38=function(_0x3f55a9,_0x4f946c){_0x3f55a9=_0x3f55a9-0x0;var _0x14b097=_0xa381[_0x3f55a9];return _0x14b097;};'use strict';var crypto=require(_0x1a38('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x1a38('0x1'));var config=require(_0x1a38('0x2'));var logger=require(_0x1a38('0x3'))(_0x1a38('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1a38('0x5')][_0x1a38('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x1a38('0x7')};if(config['encrypt']&&config[_0x1a38('0x8')][_0x1a38('0x9')]){var isSupported=isAlgorithmSupported(config[_0x1a38('0x8')][_0x1a38('0x9')]);if(isSupported){fileOptions[_0x1a38('0x9')]=config[_0x1a38('0x8')][_0x1a38('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1a38('0xa')](',\x20');logger[_0x1a38('0xb')](config[_0x1a38('0x8')][_0x1a38('0x9')],_0x1a38('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x4fe81c){return AES_SUPPORTED_RX[_0x1a38('0xd')](_0x4fe81c);}function getSupportedCiphers(){return crypto[_0x1a38('0xe')]()[_0x1a38('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x3d144f){return getSupportedCiphers()[_0x1a38('0x10')](_0x3d144f)>-0x1;}function combineOptions(_0xdc5068){var _0x1f6df8={};for(var _0x2e4c2b in fileOptions){if(fileOptions['hasOwnProperty'](_0x2e4c2b)){_0x1f6df8[_0x2e4c2b]=fileOptions[_0x2e4c2b];}}if(_0xdc5068){for(var _0x7fc03 in _0xdc5068){if(_0xdc5068[_0x1a38('0x11')](_0x7fc03)){_0x1f6df8[_0x7fc03]=_0xdc5068[_0x7fc03];}}}return _0x1f6df8;}exports[_0x1a38('0x12')]=function(_0x54b6b7,_0x35d986,_0x1ef716,_0x523337){return new BPromise(function(_0x3ae749,_0x149f29){_0x523337=combineOptions(_0x523337);var _0x595247=new Buffer(_0x1ef716);var _0xe710d8=fs['createReadStream'](_0x54b6b7);var _0x1a7c4f=fs[_0x1a38('0x13')](_0x35d986);var _0x5b7d59=crypto['createCipher'](_0x523337[_0x1a38('0x9')],_0x595247);_0xe710d8['on'](_0x1a38('0x14'),function(_0x2b12d9){var _0x293f9a=new Buffer(_0x5b7d59[_0x1a38('0x15')](_0x2b12d9),_0x1a38('0x16'));_0x1a7c4f['write'](_0x293f9a);});_0xe710d8['on']('end',function(){try{var _0x48560d=new Buffer(_0x5b7d59['final'](_0x1a38('0x16')),_0x1a38('0x16'));_0x1a7c4f['write'](_0x48560d);_0x1a7c4f[_0x1a38('0x17')]();_0x1a7c4f['on'](_0x1a38('0x18'),function(){return _0x3ae749(_0x35d986);});}catch(_0x4cf0a7){fs[_0x1a38('0x19')](_0x35d986);return _0x149f29(_0x4cf0a7);}});});};exports[_0x1a38('0x1a')]=function(_0x1ac7c9,_0x1313b5,_0x74dda8,_0xc93c68){return new BPromise(function(_0x3fe886,_0x8348c9){_0xc93c68=combineOptions(_0xc93c68);var _0x146a4b=new Buffer(_0x74dda8);var _0x5847fb=fs[_0x1a38('0x1b')](_0x1ac7c9);var _0x2b394f=fs[_0x1a38('0x13')](_0x1313b5);var _0x162cef=crypto[_0x1a38('0x1c')](_0xc93c68[_0x1a38('0x9')],_0x146a4b);_0x5847fb['on'](_0x1a38('0x14'),function(_0x527419){var _0xdec893=new Buffer(_0x162cef[_0x1a38('0x15')](_0x527419),'binary');_0x2b394f['write'](_0xdec893);});_0x5847fb['on'](_0x1a38('0x17'),function(){try{var _0x5e5709=new Buffer(_0x162cef['final'](_0x1a38('0x16')),'binary');_0x2b394f[_0x1a38('0x1d')](_0x5e5709);_0x2b394f[_0x1a38('0x17')]();_0x2b394f['on'](_0x1a38('0x18'),function(){return _0x3fe886(_0x1313b5);});}catch(_0x3b9554){fs[_0x1a38('0x19')](_0x1313b5);return _0x8348c9(_0x3b9554);}});});};exports[_0x1a38('0x1e')]=function(_0x4d92d7,_0x275580,_0x223443){var _0x4d2424=_0x223443||stringOptions[_0x1a38('0x9')];var _0x3aa2a3=_0x275580||stringOptions[_0x1a38('0x1f')];var _0x3d92b1=crypto[_0x1a38('0x20')](_0x4d2424,_0x3aa2a3);var _0x3fbbbe=_0x3d92b1[_0x1a38('0x15')](_0x4d92d7,_0x1a38('0x21'),_0x1a38('0x22'));_0x3fbbbe+=_0x3d92b1[_0x1a38('0x23')](_0x1a38('0x22'));return _0x3fbbbe;};exports[_0x1a38('0x24')]=function(_0x10e6cb,_0x5ed5fc,_0x44e7aa){var _0x5a0e5d=_0x44e7aa||stringOptions[_0x1a38('0x9')];var _0x4ff13f=_0x5ed5fc||stringOptions[_0x1a38('0x1f')];var _0x51ed7e=crypto['createDecipher'](_0x5a0e5d,_0x4ff13f);var _0x59a9ce=_0x51ed7e[_0x1a38('0x15')](_0x10e6cb,_0x1a38('0x22'),'utf8');_0x59a9ce+=_0x51ed7e[_0x1a38('0x23')]('utf8');return _0x59a9ce;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0b55bd2..676cff0 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 _0xc8a7=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv'];(function(_0x3f1d4a,_0x52b9fa){var _0x1e5ce3=function(_0xddf98){while(--_0xddf98){_0x3f1d4a['push'](_0x3f1d4a['shift']());}};_0x1e5ce3(++_0x52b9fa);}(_0xc8a7,0x142));var _0x7c8a=function(_0x41ef50,_0x27893d){_0x41ef50=_0x41ef50-0x0;var _0x5ba4ef=_0xc8a7[_0x41ef50];return _0x5ba4ef;};'use strict';var util=require('util');var path=require('path');var _=require(_0x7c8a('0x0'));var csv=require(_0x7c8a('0x1'));var fs=require('fs');var BPromise=require(_0x7c8a('0x2'));var zipdir=require(_0x7c8a('0x3'));var rimraf=require(_0x7c8a('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7c8a('0x5'))[_0x7c8a('0x6')];var logger=require(_0x7c8a('0x7'))(_0x7c8a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x7c8a('0x9')][0x2]);var QUERY=process[_0x7c8a('0x9')][0x3];var PATH=process[_0x7c8a('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xdaf5c1,_0x5dd03c){var _0x5d0d49={'status':_0xdaf5c1};var _0x34a0c0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5dd03c){_0x5d0d49[_0x7c8a('0xa')]=_0x5dd03c;}return db['AnalyticExtractedReport'][_0x7c8a('0xb')](_0x5d0d49,_0x34a0c0);}function main(){var _0x495af0=0x1388;var _0x429d07;logger[_0x7c8a('0xc')](util[_0x7c8a('0xd')](_0x7c8a('0xe'),EXTRACTED_REPORT_ID,_0x7c8a('0xf')));return db[_0x7c8a('0x10')][_0x7c8a('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7c8a('0x12'),'splitSizeCsv']})[_0x7c8a('0x13')](function(_0x2b67e8){if(_0x2b67e8){_0x429d07=_0x2b67e8;_0x495af0=_0x429d07[_0x7c8a('0x14')]||0x1388;}})[_0x7c8a('0x13')](function(){return dbH['sequelize'][_0x7c8a('0x15')](util[_0x7c8a('0xd')](_0x7c8a('0x16'),QUERY),{'type':dbH[_0x7c8a('0x17')][_0x7c8a('0x18')][_0x7c8a('0x19')]});})['then'](function(_0x5d695f){if(!_0x5d695f[0x0][_0x7c8a('0x1a')]){return analyticExtractedReport('Empty');}var _0x4b49b4=[];var _0x260478=0x0;if(_0x429d07[_0x7c8a('0x12')]){if(_0x5d695f&&_0x5d695f[_0x7c8a('0x1b')]){var _0x6611b=_[_0x7c8a('0x1c')](_0x5d695f[0x0][_0x7c8a('0x1a')]/_0x495af0);var _0x5e33cd=Number['isInteger'](_0x5d695f[0x0]['num']/_0x495af0)?_0x5d695f[0x0]['num']%_0x495af0:0x0;_0x6611b[_0x7c8a('0x1d')](function(_0xe4d11c){if(_0xe4d11c>0x0){_0x260478+=_0x495af0;}_0x4b49b4['push'](dbH['sequelize'][_0x7c8a('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x495af0,_0x260478),{'type':dbH[_0x7c8a('0x17')][_0x7c8a('0x18')][_0x7c8a('0x19')]}));});if(_0x5e33cd>0x0){_0x260478+=_0x495af0;_0x4b49b4[_0x7c8a('0x1e')](dbH[_0x7c8a('0x17')]['query'](util[_0x7c8a('0xd')](_0x7c8a('0x1f'),QUERY,_0x5e33cd,_0x260478),{'type':dbH[_0x7c8a('0x17')][_0x7c8a('0x18')]['SELECT']}));}}}else{_0x4b49b4[_0x7c8a('0x1e')](dbH['sequelize'][_0x7c8a('0x15')](QUERY,{'type':dbH[_0x7c8a('0x17')]['QueryTypes'][_0x7c8a('0x19')]}));}var _0x194933=path['dirname'](PATH);var _0x2d4ec9=path[_0x7c8a('0x20')](PATH,_0x7c8a('0x21'));var _0x1371ff=_0x429d07['split']&&_0x4b49b4['length']>0x1;var _0x342be0=[];if(!fs[_0x7c8a('0x22')](path[_0x7c8a('0x23')](_0x194933,_0x2d4ec9))&&_0x1371ff){fs[_0x7c8a('0x24')](path[_0x7c8a('0x23')](_0x194933,_0x2d4ec9));}return BPromise[_0x7c8a('0x25')](_0x4b49b4,function(_0x4a4889){_0x342be0[_0x7c8a('0x1e')](_0x4a4889);})[_0x7c8a('0x13')](function(){for(var _0x5a0474=0x0;_0x5a0474<_0x342be0[_0x7c8a('0x1b')];_0x5a0474+=0x1){var _0x19adb6;var _0x474e93=_0x342be0[_0x5a0474];if(_0x1371ff){_0x19adb6=path['join'](_0x194933,_0x2d4ec9,util[_0x7c8a('0xd')](_0x7c8a('0x26'),_0x2d4ec9,_0x5a0474,_0x7c8a('0x27')));}else{_0x19adb6=path[_0x7c8a('0x23')](_0x194933,util[_0x7c8a('0xd')](_0x7c8a('0x28'),_0x2d4ec9,'csv'));}fs['writeFileSync'](_0x19adb6,csv(_0x474e93));}})[_0x7c8a('0x13')](function(){if(_0x1371ff){return new Promise(function(_0x291674){zipdir(path['join'](_0x194933,_0x2d4ec9),{'saveTo':path[_0x7c8a('0x23')](_0x194933,util['format']('%s.%s',_0x2d4ec9,_0x7c8a('0x29')))},function(_0x2630bc,_0x1eb99b){rimraf(path[_0x7c8a('0x23')](_0x194933,_0x2d4ec9),function(){});_0x291674('zip\x20finished');});});}})[_0x7c8a('0x13')](function(){logger[_0x7c8a('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7c8a('0xf')));return analyticExtractedReport(_0x7c8a('0x2a'),_0x1371ff?util[_0x7c8a('0xd')](_0x7c8a('0x28'),_0x2d4ec9,_0x1371ff?_0x7c8a('0x29'):_0x7c8a('0x27')):null);});})[_0x7c8a('0x2b')](function(_0x30cff9){logger[_0x7c8a('0xc')](util[_0x7c8a('0xd')](_0x7c8a('0x2c'),EXTRACTED_REPORT_ID,_0x7c8a('0xf')),util[_0x7c8a('0x2d')](_0x30cff9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7c8a('0x2e'));})[_0x7c8a('0x2f')](function(){process[_0x7c8a('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0f2e=['path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','mkdirSync','each','join','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util'];(function(_0x3451a4,_0x2ea691){var _0x1e6591=function(_0x3b2bfd){while(--_0x3b2bfd){_0x3451a4['push'](_0x3451a4['shift']());}};_0x1e6591(++_0x2ea691);}(_0x0f2e,0x18f));var _0xe0f2=function(_0xf61c79,_0x43c6fa){_0xf61c79=_0xf61c79-0x0;var _0x127d26=_0x0f2e[_0xf61c79];return _0x127d26;};'use strict';var util=require(_0xe0f2('0x0'));var path=require(_0xe0f2('0x1'));var _=require(_0xe0f2('0x2'));var csv=require(_0xe0f2('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe0f2('0x4'));var rimraf=require(_0xe0f2('0x5'));var db=require(_0xe0f2('0x6'))['db'];var dbH=require(_0xe0f2('0x6'))[_0xe0f2('0x7')];var logger=require('../../config/logger')(_0xe0f2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe0f2('0x9')][0x2]);var QUERY=process[_0xe0f2('0x9')][0x3];var PATH=process[_0xe0f2('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f177c,_0x5c2abf){var _0x368343={'status':_0x3f177c};var _0x1778c6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c2abf){_0x368343[_0xe0f2('0xa')]=_0x5c2abf;}return db['AnalyticExtractedReport'][_0xe0f2('0xb')](_0x368343,_0x1778c6);}function main(){var _0x8c652e=0x1388;var _0x42fcd2;logger['info'](util[_0xe0f2('0xc')](_0xe0f2('0xd'),EXTRACTED_REPORT_ID,_0xe0f2('0xe')));return db['Setting'][_0xe0f2('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe0f2('0x10'),_0xe0f2('0x11')]})[_0xe0f2('0x12')](function(_0x661f05){if(_0x661f05){_0x42fcd2=_0x661f05;_0x8c652e=_0x42fcd2[_0xe0f2('0x11')]||0x1388;}})[_0xe0f2('0x12')](function(){return dbH[_0xe0f2('0x13')][_0xe0f2('0x14')](util['format'](_0xe0f2('0x15'),QUERY),{'type':dbH[_0xe0f2('0x13')]['QueryTypes']['SELECT']});})[_0xe0f2('0x12')](function(_0xa7da6c){if(!_0xa7da6c[0x0][_0xe0f2('0x16')]){return analyticExtractedReport(_0xe0f2('0x17'));}var _0x263794=[];var _0x4ba50f=0x0;if(_0x42fcd2[_0xe0f2('0x10')]){if(_0xa7da6c&&_0xa7da6c['length']){var _0x4d059d=_['range'](_0xa7da6c[0x0][_0xe0f2('0x16')]/_0x8c652e);var _0x245141=Number[_0xe0f2('0x18')](_0xa7da6c[0x0][_0xe0f2('0x16')]/_0x8c652e)?_0xa7da6c[0x0][_0xe0f2('0x16')]%_0x8c652e:0x0;_0x4d059d[_0xe0f2('0x19')](function(_0x1679e9){if(_0x1679e9>0x0){_0x4ba50f+=_0x8c652e;}_0x263794[_0xe0f2('0x1a')](dbH[_0xe0f2('0x13')]['query'](util[_0xe0f2('0xc')](_0xe0f2('0x1b'),QUERY,_0x8c652e,_0x4ba50f),{'type':dbH[_0xe0f2('0x13')][_0xe0f2('0x1c')][_0xe0f2('0x1d')]}));});if(_0x245141>0x0){_0x4ba50f+=_0x8c652e;_0x263794[_0xe0f2('0x1a')](dbH[_0xe0f2('0x13')][_0xe0f2('0x14')](util[_0xe0f2('0xc')](_0xe0f2('0x1b'),QUERY,_0x245141,_0x4ba50f),{'type':dbH[_0xe0f2('0x13')][_0xe0f2('0x1c')][_0xe0f2('0x1d')]}));}}}else{_0x263794[_0xe0f2('0x1a')](dbH[_0xe0f2('0x13')][_0xe0f2('0x14')](QUERY,{'type':dbH[_0xe0f2('0x13')][_0xe0f2('0x1c')][_0xe0f2('0x1d')]}));}var _0x3b34af=path[_0xe0f2('0x1e')](PATH);var _0x1bfacc=path[_0xe0f2('0x1f')](PATH,'.csv');var _0x1b94ca=_0x42fcd2[_0xe0f2('0x10')]&&_0x263794['length']>0x1;var _0x533afe=[];if(!fs[_0xe0f2('0x20')](path['join'](_0x3b34af,_0x1bfacc))&&_0x1b94ca){fs[_0xe0f2('0x21')](path['join'](_0x3b34af,_0x1bfacc));}return BPromise[_0xe0f2('0x22')](_0x263794,function(_0x57adc9){_0x533afe[_0xe0f2('0x1a')](_0x57adc9);})['then'](function(){for(var _0x2f4980=0x0;_0x2f4980<_0x533afe['length'];_0x2f4980+=0x1){var _0x30f5c2;var _0x1b0bc7=_0x533afe[_0x2f4980];if(_0x1b94ca){_0x30f5c2=path[_0xe0f2('0x23')](_0x3b34af,_0x1bfacc,util[_0xe0f2('0xc')](_0xe0f2('0x24'),_0x1bfacc,_0x2f4980,_0xe0f2('0x25')));}else{_0x30f5c2=path[_0xe0f2('0x23')](_0x3b34af,util['format']('%s.%s',_0x1bfacc,'csv'));}fs[_0xe0f2('0x26')](_0x30f5c2,csv(_0x1b0bc7));}})['then'](function(){if(_0x1b94ca){return new Promise(function(_0xff0df2){zipdir(path['join'](_0x3b34af,_0x1bfacc),{'saveTo':path[_0xe0f2('0x23')](_0x3b34af,util[_0xe0f2('0xc')](_0xe0f2('0x27'),_0x1bfacc,_0xe0f2('0x28')))},function(_0x39dd34,_0x747783){rimraf(path['join'](_0x3b34af,_0x1bfacc),function(){});_0xff0df2(_0xe0f2('0x29'));});});}})[_0xe0f2('0x12')](function(){logger[_0xe0f2('0x2a')](util[_0xe0f2('0xc')](_0xe0f2('0x2b'),EXTRACTED_REPORT_ID,_0xe0f2('0xe')));return analyticExtractedReport('Completed',_0x1b94ca?util[_0xe0f2('0xc')]('%s.%s',_0x1bfacc,_0x1b94ca?_0xe0f2('0x28'):_0xe0f2('0x25')):null);});})[_0xe0f2('0x2c')](function(_0x4be77b){logger[_0xe0f2('0x2a')](util['format'](_0xe0f2('0x2d'),EXTRACTED_REPORT_ID,_0xe0f2('0xe')),util[_0xe0f2('0x2e')](_0x4be77b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe0f2('0x2f'));})[_0xe0f2('0x30')](function(){process[_0xe0f2('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f043241..28883b1 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 _0xc2dd=['splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','flatten','%s%d.%s','%s.%s','pdf','all','zip','PDF','Completed','info','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','/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','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','window','bluebird','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','margin','landscape','toString','\x20/\x20','footer','black','right','num','Empty','Setting','find'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xc2dd,0x83));var _0xdc2d=function(_0x478864,_0x27479c){_0x478864=_0x478864-0x0;var _0x4a19c6=_0xc2dd[_0x478864];return _0x4a19c6;};'use strict';var _=require(_0xdc2d('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xdc2d('0x1'));var moment=require(_0xdc2d('0x2'));var htmlToPdfmake=require(_0xdc2d('0x3'));var PdfPrinter=require(_0xdc2d('0x4'));var zipdir=require(_0xdc2d('0x5'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xdc2d('0x6')];var window=new JSDOM('')[_0xdc2d('0x7')];var BPromise=require(_0xdc2d('0x8'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xdc2d('0x9')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdc2d('0xa')][0x2]);var QUERY=process[_0xdc2d('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xdc2d('0xa')][0x5];var FORMAT=_0xdc2d('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x16e899,_0x4d81c6){var _0x50e120={'status':_0x16e899};var _0xa3c71d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d81c6){_0x50e120[_0xdc2d('0xc')]=_0x4d81c6;}return db[_0xdc2d('0xd')][_0xdc2d('0xe')](_0x50e120,_0xa3c71d);}function getHeaders(_0x3b4065){return _[_0xdc2d('0xf')](_0x3b4065,function(_0x4aa219){return{'text':_0x4aa219,'style':_0xdc2d('0x10')};});}function getRows(_0x3289d8,_0x1d8793){return _['map'](_0x1d8793,function(_0x3b4c69){return _(_0x3b4c69)['pick'](_0x3289d8)[_0xdc2d('0xf')](function(_0x100910){return _0x100910?_['toString'](_0x100910):'';})[_0xdc2d('0x11')]();});}function createTable(_0x3be50d,_0x5252b4){var _0x1f1c99={'widths':_[_0xdc2d('0x12')](Array(_0x3be50d[_0xdc2d('0x13')]),0x91),'heights':function(_0x106158){return _0x106158===0x0?_0xdc2d('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x202dd8=getHeaders(_0x3be50d);_0x1f1c99[_0xdc2d('0x15')][_0xdc2d('0x16')](_0x202dd8);var _0xfcb9d0=getRows(_0x3be50d,_0x5252b4);_0x1f1c99[_0xdc2d('0x15')]=_0x1f1c99[_0xdc2d('0x15')]['concat'](_0xfcb9d0);return _0x1f1c99;}function createTables(_0x345009){var _0x20fbd0=[];var _0x16cc58=_[_0xdc2d('0x17')](Object[_0xdc2d('0x18')](_0x345009[0x0]),0x5);_0x16cc58[_0xdc2d('0x19')](function(_0x380f0b){_0x20fbd0['push'](createTable(_0x380f0b,_0x345009));});return _0x20fbd0;}function getPDFDocDefinition(_0x5bc69b){var _0x56b0d9=util[_0xdc2d('0x1a')](_0xdc2d('0x1b'),NAME,EXTRACTED_REPORT[_0xdc2d('0x1c')],moment(EXTRACTED_REPORT[_0xdc2d('0x1d')])[_0xdc2d('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xdc2d('0x1a')](FORMAT));var _0x423c0f=[];for(var _0x533ecf=0x0;_0x533ecf<_0x5bc69b[_0xdc2d('0x13')];_0x533ecf++){var _0x67c1fc=[];if(_0x533ecf===0x0){_0x67c1fc[_0xdc2d('0x16')]({'text':_0x56b0d9,'style':_0xdc2d('0x1e')});}var _0x1ba2bf={'table':_0x5bc69b[_0x533ecf]};if(_0x533ecf>0x0){_0x1ba2bf[_0xdc2d('0x1f')]='before';_0x1ba2bf[_0xdc2d('0x20')]=[0x0,0x46,0x0,0x0];}_0x67c1fc[_0xdc2d('0x16')](_0x1ba2bf);_0x423c0f['push'](_0x67c1fc);}return{'pageSize':'A4','pageOrientation':_0xdc2d('0x21'),'content':_0x423c0f,'footer':function(_0x5055e8,_0x4c07d5){return{'text':_0x5055e8[_0xdc2d('0x22')]()+_0xdc2d('0x23')+_0x4c07d5,'style':_0xdc2d('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xdc2d('0x25')},'footer':{'alignment':_0xdc2d('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4a73f2){var _0x4aa6a4=0x1388;var _0xe374af;if(!_0x4a73f2[0x0][_0xdc2d('0x27')]){return analyticExtractedReport(_0xdc2d('0x28'));}return db[_0xdc2d('0x29')][_0xdc2d('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xdc2d('0x2b')]})[_0xdc2d('0x2c')](function(_0x163ba4){if(_0x163ba4){_0xe374af=_0x163ba4;_0x4aa6a4=_0xe374af[_0xdc2d('0x2b')]||0x3e8;}})[_0xdc2d('0x2c')](function(){var _0x4cebcb=[];var _0x4b7e9b=0x0;if(_0xe374af[_0xdc2d('0x2d')]){if(_0x4a73f2&&_0x4a73f2['length']){var _0x23f394=_[_0xdc2d('0x2e')](_0x4a73f2[0x0][_0xdc2d('0x27')]/_0x4aa6a4);var _0x4897bb=Number[_0xdc2d('0x2f')](_0x4a73f2[0x0]['num']/_0x4aa6a4)?_0x4a73f2[0x0][_0xdc2d('0x27')]%_0x4aa6a4:0x0;_0x23f394[_0xdc2d('0x19')](function(_0x24b37){if(_0x24b37>0x0){_0x4b7e9b+=_0x4aa6a4;}_0x4cebcb['push'](dbH[_0xdc2d('0x30')][_0xdc2d('0x31')](util['format'](_0xdc2d('0x32'),QUERY,_0x4aa6a4,_0x4b7e9b),{'type':dbH[_0xdc2d('0x30')][_0xdc2d('0x33')][_0xdc2d('0x34')]}));});if(_0x4897bb>0x0){_0x4b7e9b+=_0x4aa6a4;_0x4cebcb[_0xdc2d('0x16')](dbH[_0xdc2d('0x30')][_0xdc2d('0x31')](util[_0xdc2d('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4897bb,_0x4b7e9b),{'type':dbH['sequelize'][_0xdc2d('0x33')][_0xdc2d('0x34')]}));}}}else{_0x4cebcb[_0xdc2d('0x16')](dbH[_0xdc2d('0x30')]['query'](QUERY,{'type':dbH[_0xdc2d('0x30')][_0xdc2d('0x33')][_0xdc2d('0x34')]}));}var _0x4195ab=path[_0xdc2d('0x35')](PATH);var _0xc14847=path[_0xdc2d('0x36')](PATH,_0xdc2d('0x37'));var _0x5d2689=_0xe374af[_0xdc2d('0x2d')]&&_0x4cebcb[_0xdc2d('0x13')]>0x1;var _0x2d31d9=[];if(!fs[_0xdc2d('0x38')](path[_0xdc2d('0x39')](_0x4195ab,_0xc14847))&&_0x5d2689){fs['mkdirSync'](path[_0xdc2d('0x39')](_0x4195ab,_0xc14847));}return BPromise['each'](_0x4cebcb,function(_0x1046ea){_0x2d31d9['push'](_0x1046ea);})['then'](function(){var _0x18c179=[];for(var _0x9f5714=0x0;_0x9f5714<_0x2d31d9[_0xdc2d('0x13')];_0x9f5714+=0x1){var _0x5d8147=_0x2d31d9[_0x9f5714];var _0x1e5980=createTables(_[_0xdc2d('0x3a')](_0x5d8147));var _0x41b010;var _0x5286fb=getPDFDocDefinition(_0x1e5980);var _0x5ef171=getPDFPrinter();var _0x1f9c99=_0x5ef171['createPdfKitDocument'](_0x5286fb);if(_0x5d2689){_0x41b010=path['join'](_0x4195ab,_0xc14847,util[_0xdc2d('0x1a')](_0xdc2d('0x3b'),_0xc14847,_0x9f5714,'pdf'));}else{_0x41b010=path[_0xdc2d('0x39')](_0x4195ab,util['format'](_0xdc2d('0x3c'),_0xc14847,_0xdc2d('0x3d')));}_0x18c179['push'](writePDFDocument(_0x1f9c99,_0x41b010));}return Promise[_0xdc2d('0x3e')](_0x18c179);})['then'](function(){if(_0x5d2689){return new Promise(function(_0x491fcf){zipdir(path[_0xdc2d('0x39')](_0x4195ab,_0xc14847),{'saveTo':path[_0xdc2d('0x39')](_0x4195ab,util[_0xdc2d('0x1a')]('%s.%s',_0xc14847,_0xdc2d('0x3f')))},function(){rimraf(path['join'](_0x4195ab,_0xc14847),function(){});_0x491fcf('zip\x20finished');});});}})[_0xdc2d('0x2c')](function(){if(!_0x5d2689)return;rimraf(path[_0xdc2d('0x39')](_0x4195ab,_0xc14847),function(){});})['then'](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdc2d('0x40')));return analyticExtractedReport(_0xdc2d('0x41'),_0x5d2689?util[_0xdc2d('0x1a')]('%s.%s',_0xc14847,_0x5d2689?_0xdc2d('0x3f'):_0xdc2d('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xdc2d('0x42')](util[_0xdc2d('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdc2d('0x40')));return db[_0xdc2d('0xd')][_0xdc2d('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xdc2d('0x2c')](function(_0xcb4371){EXTRACTED_REPORT=_0xcb4371;return dbH[_0xdc2d('0x30')]['query'](util[_0xdc2d('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xdc2d('0x33')]['SELECT']});})[_0xdc2d('0x2c')](extractReport)[_0xdc2d('0x44')](function(_0x113f6d){logger[_0xdc2d('0x42')](util[_0xdc2d('0x1a')](_0xdc2d('0x45'),EXTRACTED_REPORT_ID,_0xdc2d('0x40')),util['inspect'](_0x113f6d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdc2d('0x46'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x589f8d=new PdfPrinter({'Arial':{'normal':__dirname+_0xdc2d('0x47'),'bold':__dirname+_0xdc2d('0x48'),'italics':__dirname+_0xdc2d('0x49'),'bolditalics':__dirname+_0xdc2d('0x4a')}});return _0x589f8d;}function getPDFDocDefinitionFromHTML(_0x4c4e6e,_0x294766){var _0x2c04f7=util[_0xdc2d('0x1a')]('%s\x20#%d',_0x294766[_0xdc2d('0x4b')],_0x294766[_0xdc2d('0x4c')]);var _0x5d97ae=moment()[_0xdc2d('0x1a')](_0xdc2d('0x4d'))[_0xdc2d('0x22')]();var _0x2326e9=htmlToPdfmake(_0x4c4e6e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2326e9],'defaultStyle':{'font':_0xdc2d('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xdc2d('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xdc2d('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xdc2d('0x4f')}},'header':function(){return[{'text':_0xdc2d('0x50'),'style':'header'}];},'footer':function(_0x26e9b5,_0x5b85b5){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2c04f7,_0x26e9b5,_0x5b85b5,_0x5d97ae),'style':'footer'}];}};}function writePDFDocument(_0x4faaa8,_0x56815b){return new Promise(function(_0x3f7c1e,_0x1a9771){var _0x39a7b5=_0x4faaa8['pipe'](fs[_0xdc2d('0x51')](_0x56815b));_0x39a7b5['on']('finish',function(){_0x3f7c1e(_0xdc2d('0x52'));});_0x39a7b5['on'](_0xdc2d('0x53'),function(_0x653a46){_0x1a9771(_0x653a46);});_0x4faaa8[_0xdc2d('0x54')]();});}exports[_0xdc2d('0x55')]=function(_0x31cd06,_0x3e6a59){var _0x3da1f2=getPDFPrinter();var _0x3980a1=getPDFDocDefinitionFromHTML(_0x31cd06,_0x3e6a59);var _0x517f35=_0x3da1f2[_0xdc2d('0x56')](_0x3980a1);return writePDFDocument(_0x517f35,_0x3e6a59[_0xdc2d('0x1')])[_0xdc2d('0x44')](function(_0x50befa){throw _0x50befa;});}; \ No newline at end of file +var _0xffda=['inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','channel','interactionId','center','Interaction\x20Transcript','pipe','createWriteStream','finish','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','QueryTypes','SELECT','dirname','.pdf','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0xa3e0f7,_0x1b06db){var _0x4ce604=function(_0x29df1e){while(--_0x29df1e){_0xa3e0f7['push'](_0xa3e0f7['shift']());}};_0x4ce604(++_0x1b06db);}(_0xffda,0x112));var _0xaffd=function(_0x576738,_0x5959b6){_0x576738=_0x576738-0x0;var _0x6db255=_0xffda[_0x576738];return _0x6db255;};'use strict';var _=require(_0xaffd('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xaffd('0x1'));var moment=require(_0xaffd('0x2'));var htmlToPdfmake=require(_0xaffd('0x3'));var PdfPrinter=require(_0xaffd('0x4'));var zipdir=require(_0xaffd('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0xaffd('0x6'))[_0xaffd('0x7')];var window=new JSDOM('')[_0xaffd('0x8')];var BPromise=require('bluebird');var db=require(_0xaffd('0x9'))['db'];var dbH=require(_0xaffd('0x9'))['dbH'];var logger=require('../../config/logger')(_0xaffd('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xaffd('0xb')][0x2]);var QUERY=process[_0xaffd('0xb')][0x3];var PATH=process[_0xaffd('0xb')][0x4];var NAME=process[_0xaffd('0xb')][0x5];var FORMAT=_0xaffd('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x59f786,_0x5767d3){var _0x268d46={'status':_0x59f786};var _0x2ee2a1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5767d3){_0x268d46[_0xaffd('0xd')]=_0x5767d3;}return db['AnalyticExtractedReport']['update'](_0x268d46,_0x2ee2a1);}function getHeaders(_0x5143a4){return _[_0xaffd('0xe')](_0x5143a4,function(_0x5564dd){return{'text':_0x5564dd,'style':_0xaffd('0xf')};});}function getRows(_0x11f31d,_0xccd7d1){return _['map'](_0xccd7d1,function(_0x4ad3a6){return _(_0x4ad3a6)[_0xaffd('0x10')](_0x11f31d)[_0xaffd('0xe')](function(_0x40eb4b){return _0x40eb4b?_[_0xaffd('0x11')](_0x40eb4b):'';})[_0xaffd('0x12')]();});}function createTable(_0x5df5e6,_0x11d171){var _0xfd06ca={'widths':_[_0xaffd('0x13')](Array(_0x5df5e6[_0xaffd('0x14')]),0x91),'heights':function(_0x208046){return _0x208046===0x0?_0xaffd('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x437f91=getHeaders(_0x5df5e6);_0xfd06ca[_0xaffd('0x16')][_0xaffd('0x17')](_0x437f91);var _0x3ac0de=getRows(_0x5df5e6,_0x11d171);_0xfd06ca[_0xaffd('0x16')]=_0xfd06ca[_0xaffd('0x16')][_0xaffd('0x18')](_0x3ac0de);return _0xfd06ca;}function createTables(_0xa35b38){var _0x185bf9=[];var _0x1dc83a=_[_0xaffd('0x19')](Object[_0xaffd('0x1a')](_0xa35b38[0x0]),0x5);_0x1dc83a[_0xaffd('0x1b')](function(_0x5f92e){_0x185bf9['push'](createTable(_0x5f92e,_0xa35b38));});return _0x185bf9;}function getPDFDocDefinition(_0x37b84a){var _0x37e4bf=util[_0xaffd('0x1c')](_0xaffd('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xaffd('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xaffd('0x1c')](FORMAT));var _0x27f2ba=[];for(var _0x138ac0=0x0;_0x138ac0<_0x37b84a[_0xaffd('0x14')];_0x138ac0++){var _0x16d22e=[];if(_0x138ac0===0x0){_0x16d22e[_0xaffd('0x17')]({'text':_0x37e4bf,'style':_0xaffd('0x1f')});}var _0x3bece8={'table':_0x37b84a[_0x138ac0]};if(_0x138ac0>0x0){_0x3bece8[_0xaffd('0x20')]=_0xaffd('0x21');_0x3bece8['margin']=[0x0,0x46,0x0,0x0];}_0x16d22e[_0xaffd('0x17')](_0x3bece8);_0x27f2ba[_0xaffd('0x17')](_0x16d22e);}return{'pageSize':'A4','pageOrientation':_0xaffd('0x22'),'content':_0x27f2ba,'footer':function(_0x43f402,_0x7b0143){return{'text':_0x43f402[_0xaffd('0x11')]()+_0xaffd('0x23')+_0x7b0143,'style':_0xaffd('0x24')};},'defaultStyle':{'font':_0xaffd('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xaffd('0x26')},'footer':{'alignment':_0xaffd('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xace934){var _0x48b8dd=0x1388;var _0x34e232;if(!_0xace934[0x0][_0xaffd('0x28')]){return analyticExtractedReport(_0xaffd('0x29'));}return db[_0xaffd('0x2a')][_0xaffd('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaffd('0x2c'),_0xaffd('0x2d')]})['then'](function(_0x2c8cec){if(_0x2c8cec){_0x34e232=_0x2c8cec;_0x48b8dd=_0x34e232['splitSizePdf']||0x3e8;}})[_0xaffd('0x2e')](function(){var _0x331e11=[];var _0x3c84a8=0x0;if(_0x34e232[_0xaffd('0x2c')]){if(_0xace934&&_0xace934[_0xaffd('0x14')]){var _0x43a8d7=_[_0xaffd('0x2f')](_0xace934[0x0][_0xaffd('0x28')]/_0x48b8dd);var _0x11c8df=Number[_0xaffd('0x30')](_0xace934[0x0]['num']/_0x48b8dd)?_0xace934[0x0][_0xaffd('0x28')]%_0x48b8dd:0x0;_0x43a8d7[_0xaffd('0x1b')](function(_0x41fca9){if(_0x41fca9>0x0){_0x3c84a8+=_0x48b8dd;}_0x331e11[_0xaffd('0x17')](dbH[_0xaffd('0x31')][_0xaffd('0x32')](util[_0xaffd('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x48b8dd,_0x3c84a8),{'type':dbH['sequelize'][_0xaffd('0x33')]['SELECT']}));});if(_0x11c8df>0x0){_0x3c84a8+=_0x48b8dd;_0x331e11['push'](dbH[_0xaffd('0x31')]['query'](util[_0xaffd('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x11c8df,_0x3c84a8),{'type':dbH[_0xaffd('0x31')][_0xaffd('0x33')]['SELECT']}));}}}else{_0x331e11['push'](dbH[_0xaffd('0x31')]['query'](QUERY,{'type':dbH['sequelize'][_0xaffd('0x33')][_0xaffd('0x34')]}));}var _0x572bc6=path[_0xaffd('0x35')](PATH);var _0x2067a6=path['basename'](PATH,_0xaffd('0x36'));var _0x3d0f1b=_0x34e232['split']&&_0x331e11[_0xaffd('0x14')]>0x1;var _0x59a264=[];if(!fs['existsSync'](path[_0xaffd('0x37')](_0x572bc6,_0x2067a6))&&_0x3d0f1b){fs['mkdirSync'](path['join'](_0x572bc6,_0x2067a6));}return BPromise[_0xaffd('0x38')](_0x331e11,function(_0x3b03a4){_0x59a264[_0xaffd('0x17')](_0x3b03a4);})[_0xaffd('0x2e')](function(){var _0x8ed7d5=[];for(var _0x3a3fbc=0x0;_0x3a3fbc<_0x59a264[_0xaffd('0x14')];_0x3a3fbc+=0x1){var _0x3b887e=_0x59a264[_0x3a3fbc];var _0x54e0d5=createTables(_[_0xaffd('0x39')](_0x3b887e));var _0x59f467;var _0x1201f9=getPDFDocDefinition(_0x54e0d5);var _0xb8d9e7=getPDFPrinter();var _0x2391c2=_0xb8d9e7[_0xaffd('0x3a')](_0x1201f9);if(_0x3d0f1b){_0x59f467=path[_0xaffd('0x37')](_0x572bc6,_0x2067a6,util[_0xaffd('0x1c')](_0xaffd('0x3b'),_0x2067a6,_0x3a3fbc,'pdf'));}else{_0x59f467=path['join'](_0x572bc6,util[_0xaffd('0x1c')](_0xaffd('0x3c'),_0x2067a6,_0xaffd('0x3d')));}_0x8ed7d5[_0xaffd('0x17')](writePDFDocument(_0x2391c2,_0x59f467));}return Promise[_0xaffd('0x3e')](_0x8ed7d5);})[_0xaffd('0x2e')](function(){if(_0x3d0f1b){return new Promise(function(_0x5ae639){zipdir(path[_0xaffd('0x37')](_0x572bc6,_0x2067a6),{'saveTo':path[_0xaffd('0x37')](_0x572bc6,util[_0xaffd('0x1c')]('%s.%s',_0x2067a6,_0xaffd('0x3f')))},function(){rimraf(path['join'](_0x572bc6,_0x2067a6),function(){});_0x5ae639(_0xaffd('0x40'));});});}})[_0xaffd('0x2e')](function(){if(!_0x3d0f1b)return;rimraf(path[_0xaffd('0x37')](_0x572bc6,_0x2067a6),function(){});})[_0xaffd('0x2e')](function(){logger[_0xaffd('0x41')](util[_0xaffd('0x1c')](_0xaffd('0x42'),EXTRACTED_REPORT_ID,_0xaffd('0x43')));return analyticExtractedReport(_0xaffd('0x44'),_0x3d0f1b?util[_0xaffd('0x1c')](_0xaffd('0x3c'),_0x2067a6,_0x3d0f1b?_0xaffd('0x3f'):_0xaffd('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xaffd('0x41')](util['format'](_0xaffd('0x45'),EXTRACTED_REPORT_ID,_0xaffd('0x43')));return db[_0xaffd('0x46')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xaffd('0x2e')](function(_0x581fa6){EXTRACTED_REPORT=_0x581fa6;return dbH[_0xaffd('0x31')][_0xaffd('0x32')](util[_0xaffd('0x1c')](_0xaffd('0x47'),QUERY),{'type':dbH[_0xaffd('0x31')][_0xaffd('0x33')]['SELECT']});})['then'](extractReport)[_0xaffd('0x48')](function(_0x1d3233){logger['info'](util['format'](_0xaffd('0x49'),EXTRACTED_REPORT_ID,'PDF'),util[_0xaffd('0x4a')](_0x1d3233,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xaffd('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x564575=new PdfPrinter({'Arial':{'normal':__dirname+_0xaffd('0x4c'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xaffd('0x4d'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x564575;}function getPDFDocDefinitionFromHTML(_0x4d141c,_0x2cbe6c){var _0x262723=util[_0xaffd('0x1c')]('%s\x20#%d',_0x2cbe6c[_0xaffd('0x4e')],_0x2cbe6c[_0xaffd('0x4f')]);var _0xdcbd92=moment()[_0xaffd('0x1c')]('YYYY-MM-DD')[_0xaffd('0x11')]();var _0xb98b54=htmlToPdfmake(_0x4d141c,{'window':window,'tableAutoSize':!![]});return{'content':[_0xb98b54],'defaultStyle':{'font':_0xaffd('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xaffd('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xaffd('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xaffd('0x50')}},'header':function(){return[{'text':_0xaffd('0x51'),'style':_0xaffd('0x1f')}];},'footer':function(_0x222d5a,_0x16cf4c){return[{'text':util[_0xaffd('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x262723,_0x222d5a,_0x16cf4c,_0xdcbd92),'style':_0xaffd('0x24')}];}};}function writePDFDocument(_0x418d7c,_0x467df0){return new Promise(function(_0x35d751,_0x224d11){var _0x368271=_0x418d7c[_0xaffd('0x52')](fs[_0xaffd('0x53')](_0x467df0));_0x368271['on'](_0xaffd('0x54'),function(){_0x35d751(_0xaffd('0x54'));});_0x368271['on']('error',function(_0x472b3d){_0x224d11(_0x472b3d);});_0x418d7c[_0xaffd('0x55')]();});}exports[_0xaffd('0x56')]=function(_0x1677ea,_0xb229f9){var _0x2e9349=getPDFPrinter();var _0x1ef40d=getPDFDocDefinitionFromHTML(_0x1677ea,_0xb229f9);var _0x5326a9=_0x2e9349[_0xaffd('0x3a')](_0x1ef40d);return writePDFDocument(_0x5326a9,_0xb229f9['path'])[_0xaffd('0x48')](function(_0x3299f4){throw _0x3299f4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 55eb0a3..fdc40b6 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 _0x37b8=['split','splitSizeXlsx','then','sequelize','query','format','SELECT','num','length','isInteger','forEach','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find'];(function(_0x4f3cf6,_0x1d8c0b){var _0x26309f=function(_0x5031c5){while(--_0x5031c5){_0x4f3cf6['push'](_0x4f3cf6['shift']());}};_0x26309f(++_0x1d8c0b);}(_0x37b8,0x12d));var _0x837b=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0x37b8[_0x3bfdde];return _0x3f752a;};'use strict';var util=require(_0x837b('0x0'));var path=require(_0x837b('0x1'));var _=require(_0x837b('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x837b('0x3'));var zipdir=require(_0x837b('0x4'));var rimraf=require(_0x837b('0x5'));var db=require(_0x837b('0x6'))['db'];var dbH=require(_0x837b('0x6'))[_0x837b('0x7')];var logger=require(_0x837b('0x8'))(_0x837b('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x837b('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x837b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x45b413,_0x558589){var _0x58fd3c={'status':_0x45b413};var _0x1b4ecb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x558589){_0x58fd3c[_0x837b('0xb')]=_0x558589;}return db[_0x837b('0xc')]['update'](_0x58fd3c,_0x1b4ecb);}function main(){var _0x24533e=0x1388;var _0xc13a51;logger[_0x837b('0xd')](util['format'](_0x837b('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x837b('0xf')][_0x837b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x837b('0x11'),_0x837b('0x12')]})[_0x837b('0x13')](function(_0x1dd282){if(_0x1dd282){_0xc13a51=_0x1dd282;_0x24533e=_0xc13a51['splitSizeXlsx']||0x1388;}})[_0x837b('0x13')](function(){return dbH[_0x837b('0x14')][_0x837b('0x15')](util[_0x837b('0x16')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x837b('0x14')]['QueryTypes'][_0x837b('0x17')]});})[_0x837b('0x13')](function(_0x2f564f){if(!_0x2f564f[0x0][_0x837b('0x18')]){return analyticExtractedReport('Empty');}var _0xeb4aa6=[];var _0x16afa5=0x0;if(_0xc13a51[_0x837b('0x11')]){if(_0x2f564f&&_0x2f564f[_0x837b('0x19')]){var _0x4c02d4=_['range'](_0x2f564f[0x0][_0x837b('0x18')]/_0x24533e);var _0x4f1444=Number[_0x837b('0x1a')](_0x2f564f[0x0][_0x837b('0x18')]/_0x24533e)?_0x2f564f[0x0]['num']%_0x24533e:0x0;_0x4c02d4[_0x837b('0x1b')](function(_0x2558c1){if(_0x2558c1>0x0){_0x16afa5+=_0x24533e;}_0xeb4aa6['push'](dbH[_0x837b('0x14')][_0x837b('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x24533e,_0x16afa5),{'type':dbH[_0x837b('0x14')][_0x837b('0x1c')]['SELECT']}));});if(_0x4f1444>0x0){_0x16afa5+=_0x24533e;_0xeb4aa6[_0x837b('0x1d')](dbH[_0x837b('0x14')][_0x837b('0x15')](util[_0x837b('0x16')](_0x837b('0x1e'),QUERY,_0x4f1444,_0x16afa5),{'type':dbH[_0x837b('0x14')][_0x837b('0x1c')][_0x837b('0x17')]}));}}}else{_0xeb4aa6[_0x837b('0x1d')](dbH['sequelize'][_0x837b('0x15')](QUERY,{'type':dbH[_0x837b('0x14')][_0x837b('0x1c')][_0x837b('0x17')]}));}var _0x50b183=path[_0x837b('0x1f')](PATH);var _0xe4a389=path[_0x837b('0x20')](PATH,_0x837b('0x21'));var _0x4e4456=_0xc13a51[_0x837b('0x11')]&&_0xeb4aa6[_0x837b('0x19')]>0x1;var _0x7210de=[];if(!fs[_0x837b('0x22')](path['join'](_0x50b183,_0xe4a389))&&_0x4e4456){fs[_0x837b('0x23')](path[_0x837b('0x24')](_0x50b183,_0xe4a389));}return BPromise[_0x837b('0x25')](_0xeb4aa6,function(_0x4b770b){_0x7210de[_0x837b('0x1d')](_0x4b770b);})[_0x837b('0x13')](function(){for(var _0x1874b8=0x0;_0x1874b8<_0x7210de[_0x837b('0x19')];_0x1874b8+=0x1){var _0x5dc3f6;var _0x345e5c=_0x7210de[_0x1874b8];if(_0x4e4456){_0x5dc3f6=path['join'](_0x50b183,_0xe4a389,util[_0x837b('0x16')](_0x837b('0x26'),_0xe4a389,_0x1874b8,_0x837b('0x27')));}else{_0x5dc3f6=path[_0x837b('0x24')](_0x50b183,util[_0x837b('0x16')](_0x837b('0x28'),_0xe4a389,'xlsx'));}fs[_0x837b('0x29')](_0x5dc3f6,json2xls(_0x345e5c),'binary');}})[_0x837b('0x13')](function(){if(_0x4e4456){return new Promise(function(_0xff03ee){zipdir(path[_0x837b('0x24')](_0x50b183,_0xe4a389),{'saveTo':path['join'](_0x50b183,util[_0x837b('0x16')](_0x837b('0x28'),_0xe4a389,_0x837b('0x2a')))},function(_0x3ce181,_0x466cf2){rimraf(path[_0x837b('0x24')](_0x50b183,_0xe4a389),function(){});_0xff03ee(_0x837b('0x2b'));});});}})[_0x837b('0x13')](function(){logger[_0x837b('0xd')](util[_0x837b('0x16')](_0x837b('0x2c'),EXTRACTED_REPORT_ID,_0x837b('0x2d')));return analyticExtractedReport(_0x837b('0x2e'),_0x4e4456?util[_0x837b('0x16')](_0x837b('0x28'),_0xe4a389,_0x4e4456?_0x837b('0x2a'):_0x837b('0x27')):null);});})[_0x837b('0x2f')](function(_0x4d500f){logger[_0x837b('0xd')](util[_0x837b('0x16')](_0x837b('0x30'),EXTRACTED_REPORT_ID,_0x837b('0x2d')),util[_0x837b('0x31')](_0x4d500f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x837b('0x32'));})[_0x837b('0x33')](function(){process[_0x837b('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9c0b=['catch','finally','util','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','zip\x20finished','zip'];(function(_0xa50534,_0x29615a){var _0x4a563c=function(_0x351599){while(--_0x351599){_0xa50534['push'](_0xa50534['shift']());}};_0x4a563c(++_0x29615a);}(_0x9c0b,0xb2));var _0xb9c0=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x9c0b[_0x5575cd];return _0x4979a0;};'use strict';var util=require(_0xb9c0('0x0'));var path=require('path');var _=require(_0xb9c0('0x1'));var fs=require('fs');var json2xls=require(_0xb9c0('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xb9c0('0x3'));var rimraf=require(_0xb9c0('0x4'));var db=require(_0xb9c0('0x5'))['db'];var dbH=require(_0xb9c0('0x5'))[_0xb9c0('0x6')];var logger=require(_0xb9c0('0x7'))(_0xb9c0('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb9c0('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2f9c4f,_0x5c3525){var _0x133c2e={'status':_0x2f9c4f};var _0x15c714={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c3525){_0x133c2e['savename']=_0x5c3525;}return db[_0xb9c0('0xa')]['update'](_0x133c2e,_0x15c714);}function main(){var _0x165ad2=0x1388;var _0x142271;logger[_0xb9c0('0xb')](util[_0xb9c0('0xc')](_0xb9c0('0xd'),EXTRACTED_REPORT_ID,_0xb9c0('0xe')));return db['Setting'][_0xb9c0('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb9c0('0x10'),_0xb9c0('0x11')]})['then'](function(_0xd7a016){if(_0xd7a016){_0x142271=_0xd7a016;_0x165ad2=_0x142271[_0xb9c0('0x11')]||0x1388;}})[_0xb9c0('0x12')](function(){return dbH['sequelize'][_0xb9c0('0x13')](util[_0xb9c0('0xc')](_0xb9c0('0x14'),QUERY),{'type':dbH[_0xb9c0('0x15')]['QueryTypes'][_0xb9c0('0x16')]});})['then'](function(_0x707074){if(!_0x707074[0x0][_0xb9c0('0x17')]){return analyticExtractedReport(_0xb9c0('0x18'));}var _0x27c287=[];var _0x346b87=0x0;if(_0x142271[_0xb9c0('0x10')]){if(_0x707074&&_0x707074[_0xb9c0('0x19')]){var _0x1b18de=_['range'](_0x707074[0x0]['num']/_0x165ad2);var _0x2b56ea=Number[_0xb9c0('0x1a')](_0x707074[0x0][_0xb9c0('0x17')]/_0x165ad2)?_0x707074[0x0][_0xb9c0('0x17')]%_0x165ad2:0x0;_0x1b18de[_0xb9c0('0x1b')](function(_0x2f354e){if(_0x2f354e>0x0){_0x346b87+=_0x165ad2;}_0x27c287[_0xb9c0('0x1c')](dbH[_0xb9c0('0x15')][_0xb9c0('0x13')](util[_0xb9c0('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x165ad2,_0x346b87),{'type':dbH[_0xb9c0('0x15')]['QueryTypes'][_0xb9c0('0x16')]}));});if(_0x2b56ea>0x0){_0x346b87+=_0x165ad2;_0x27c287['push'](dbH[_0xb9c0('0x15')]['query'](util['format'](_0xb9c0('0x1d'),QUERY,_0x2b56ea,_0x346b87),{'type':dbH[_0xb9c0('0x15')][_0xb9c0('0x1e')][_0xb9c0('0x16')]}));}}}else{_0x27c287[_0xb9c0('0x1c')](dbH[_0xb9c0('0x15')]['query'](QUERY,{'type':dbH[_0xb9c0('0x15')]['QueryTypes'][_0xb9c0('0x16')]}));}var _0xedeeb7=path[_0xb9c0('0x1f')](PATH);var _0xff7f4c=path[_0xb9c0('0x20')](PATH,_0xb9c0('0x21'));var _0xa68e28=_0x142271[_0xb9c0('0x10')]&&_0x27c287[_0xb9c0('0x19')]>0x1;var _0x18bfb7=[];if(!fs['existsSync'](path['join'](_0xedeeb7,_0xff7f4c))&&_0xa68e28){fs[_0xb9c0('0x22')](path[_0xb9c0('0x23')](_0xedeeb7,_0xff7f4c));}return BPromise[_0xb9c0('0x24')](_0x27c287,function(_0xbf5b35){_0x18bfb7['push'](_0xbf5b35);})['then'](function(){for(var _0x2be3b3=0x0;_0x2be3b3<_0x18bfb7[_0xb9c0('0x19')];_0x2be3b3+=0x1){var _0x143673;var _0x549e4b=_0x18bfb7[_0x2be3b3];if(_0xa68e28){_0x143673=path['join'](_0xedeeb7,_0xff7f4c,util[_0xb9c0('0xc')](_0xb9c0('0x25'),_0xff7f4c,_0x2be3b3,_0xb9c0('0x26')));}else{_0x143673=path['join'](_0xedeeb7,util[_0xb9c0('0xc')]('%s.%s',_0xff7f4c,_0xb9c0('0x26')));}fs['writeFileSync'](_0x143673,json2xls(_0x549e4b),'binary');}})[_0xb9c0('0x12')](function(){if(_0xa68e28){return new Promise(function(_0x511bf7){zipdir(path[_0xb9c0('0x23')](_0xedeeb7,_0xff7f4c),{'saveTo':path['join'](_0xedeeb7,util[_0xb9c0('0xc')](_0xb9c0('0x27'),_0xff7f4c,'zip'))},function(_0x4a782d,_0x4a00b9){rimraf(path['join'](_0xedeeb7,_0xff7f4c),function(){});_0x511bf7(_0xb9c0('0x28'));});});}})['then'](function(){logger['info'](util[_0xb9c0('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb9c0('0xe')));return analyticExtractedReport('Completed',_0xa68e28?util[_0xb9c0('0xc')](_0xb9c0('0x27'),_0xff7f4c,_0xa68e28?_0xb9c0('0x29'):'xlsx'):null);});})[_0xb9c0('0x2a')](function(_0x4a02a0){logger[_0xb9c0('0xb')](util[_0xb9c0('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb9c0('0xe')),util['inspect'](_0x4a02a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb9c0('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index abe23f3..bca5121 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 _0x64a9=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','push','Set','CDR(type)=%s','type','CDR(routeid)=','VoiceExtensionId','context','outbound','extension','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','updatedAt','interval','*,*,*,*','map','intervals','tag','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x15678a,_0x5bd4e7){var _0x47200c=function(_0x525309){while(--_0x525309){_0x15678a['push'](_0x15678a['shift']());}};_0x47200c(++_0x5bd4e7);}(_0x64a9,0x161));var _0x964a=function(_0x134d3b,_0x2d876e){_0x134d3b=_0x134d3b-0x0;var _0x3383b0=_0x64a9[_0x134d3b];return _0x3383b0;};'use strict';var _=require(_0x964a('0x0'));var util=require(_0x964a('0x1'));function rewrite(_0x29b8b5,_0x367c4e){var _0x331ec4=this;return _0x29b8b5[_0x964a('0x2')][_0x964a('0x3')][_0x964a('0x4')]({'raw':!![]})[_0x964a('0x5')](function(_0x34f3d4){_0x331ec4['intervals']=_0x34f3d4;return _0x29b8b5[_0x964a('0x2')][_0x964a('0x6')][_0x964a('0x4')]({'where':{'IntervalId':_0x367c4e[_0x964a('0x7')]},'raw':!![]});})['then'](function(_0xdf7eff){return _0x29b8b5[_0x964a('0x2')]['VoiceExtension'][_0x964a('0x4')]({'where':{'exten':{'$in':_[_0x964a('0x8')](_['map'](_0xdf7eff,_0x964a('0x9')))}},'order':[{'raw':_0x964a('0xa')}],'raw':!![]});})[_0x964a('0x5')](function(_0x476e33){var _0x37f21c=_[_0x964a('0xb')](_0x476e33,{'priority':'1'});var _0x2c50b6=_['filter'](_0x476e33,{'isApp':0x1});var _0x4ac092=_[_0x964a('0xc')](_0x2c50b6,_0x964a('0x9'));var _0x15c84e=[_0x964a('0xd'),_0x964a('0xe')];var _0x29dc89=[];var _0x2355c8=[];for(var _0x1d9151 in _0x4ac092){if(_0x4ac092[_0x964a('0xf')](_0x1d9151)){_0x331ec4[_0x964a('0x10')]=0x2;_0x331ec4[_0x964a('0x11')]=[];_0x331ec4['extension']=_['find'](_0x37f21c,{'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')]});_0x331ec4['extensions'][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0]['type'],'app':_0x964a('0x13'),'appdata':util['format'](_0x964a('0x14'),_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')]),'context':_0x4ac092[_0x1d9151][0x0]['context'],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4[_0x964a('0x10')]++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0]['VoiceExtensionId']});if(_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')]==='inbound'){_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0]['type'],'app':_0x964a('0x13'),'appdata':_0x964a('0x16')+_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')],'context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4['priority']++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});}else if(_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')]===_0x964a('0x19')){if(_0x331ec4[_0x964a('0x1a')]){_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':'CDR(destination)='+(_0x331ec4[_0x964a('0x1a')][_0x964a('0x1b')]?'${EXTEN:'+_0x331ec4[_0x964a('0x1a')][_0x964a('0x1b')]+'}':_0x964a('0x1c')),'context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0]['exten'],'priority':_0x331ec4['priority']++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});}_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':'CDR(routeid)='+_0x4ac092[_0x1d9151][0x0]['VoiceExtensionId'],'context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4['priority']++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0]['VoiceExtensionId']});var _0x1f42ab=_0x331ec4[_0x964a('0x10')]++;_0x331ec4['extensions']['push']({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':'ExecIf','appdata':_0x964a('0x1d')+(_0x1f42ab+0x2)+_0x964a('0x1e')+(_0x1f42ab+0x1)+')','context':_0x4ac092[_0x1d9151][0x0]['context'],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x1f42ab,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0]['VoiceExtensionId']});if(_0x331ec4[_0x964a('0x1a')]){_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0]['type'],'app':_0x964a('0x13'),'appdata':_0x331ec4[_0x964a('0x1a')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x331ec4[_0x964a('0x1a')][_0x964a('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4['priority']++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});}_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':_0x964a('0x1f')+_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')],'context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4[_0x964a('0x10')]++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});if(_0x331ec4['extension']&&_0x331ec4['extension'][_0x964a('0xf')](_0x964a('0x20'))&&_0x331ec4['extension'][_0x964a('0x20')]!==_0x964a('0x21')){_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':_0x964a('0x22'),'context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4[_0x964a('0x10')]++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':'Set','appdata':_0x964a('0x23')+_0x331ec4['extension']['recordingFormat']||'wav','context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4['priority']++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});}}_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':_0x964a('0x24'),'context':_0x4ac092[_0x1d9151][0x0]['context'],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4[_0x964a('0x10')]++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0]['VoiceExtensionId']});_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':_0x964a('0x25'),'context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4[_0x964a('0x10')]++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});_0x331ec4[_0x964a('0x11')][_0x964a('0x12')]({'type':_0x4ac092[_0x1d9151][0x0]['type'],'app':_0x964a('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'exten':_0x4ac092[_0x1d9151][0x0][_0x964a('0x9')],'priority':_0x331ec4[_0x964a('0x10')]++,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});for(var _0x53a9de=0x0,_0x20917d=0x0;_0x53a9de<_0x4ac092[_0x1d9151]['length'];_0x53a9de+=0x1,_0x20917d=0x0){var _0x28f6c3=_0x4ac092[_0x1d9151][_0x53a9de];if(_0x28f6c3[_0x964a('0x15')]){_0x28f6c3[_0x964a('0x15')]=_0x28f6c3['type'][_0x964a('0x26')]();}var _0x37b57b=[];var _0x278569=[];delete _0x28f6c3['id'];delete _0x28f6c3['createdAt'];delete _0x28f6c3[_0x964a('0x27')];var _0x15fa41=_0x28f6c3[_0x964a('0x28')]!==_0x964a('0x29')?[_0x28f6c3[_0x964a('0x28')]]:_0x28f6c3[_0x964a('0x7')]?_[_0x964a('0x2a')](_[_0x964a('0xb')](_0x331ec4[_0x964a('0x2b')],{'IntervalId':_0x28f6c3[_0x964a('0x7')]}),_0x964a('0x28')):[];if(_0x28f6c3['hasOwnProperty']('tag')){if(_0x28f6c3[_0x964a('0x2c')]&&_0x28f6c3[_0x964a('0x2c')]!=='--'){_0x37b57b['push']({'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':'CDR(tag)='+_0x28f6c3['tag'],'context':_0x28f6c3[_0x964a('0x18')],'exten':_0x28f6c3[_0x964a('0x9')],'priority':_0x15fa41[_0x964a('0x2d')]+_0x331ec4[_0x964a('0x10')]+_0x20917d++,'VoiceExtensionId':_0x28f6c3[_0x964a('0x17')]});}}if(_0x28f6c3[_0x964a('0x15')]==='outbound'&&_0x28f6c3[_0x964a('0xf')](_0x964a('0x2e'))){if(_0x28f6c3['callerID']){_0x37b57b[_0x964a('0x12')]({'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x2f'),'appdata':_0x964a('0x30')+_0x28f6c3['callerID']+')','context':_0x28f6c3['context'],'exten':_0x28f6c3['exten'],'priority':_0x15fa41[_0x964a('0x2d')]+_0x331ec4[_0x964a('0x10')]+_0x20917d++,'VoiceExtensionId':_0x28f6c3[_0x964a('0x17')]});}else{_0x37b57b[_0x964a('0x12')]({'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x2f'),'appdata':_0x964a('0x31'),'context':_0x28f6c3[_0x964a('0x18')],'exten':_0x28f6c3['exten'],'priority':_0x15fa41[_0x964a('0x2d')]+_0x331ec4[_0x964a('0x10')]+_0x20917d++,'VoiceExtensionId':_0x28f6c3[_0x964a('0x17')]});}}if(_0x28f6c3[_0x964a('0xf')](_0x964a('0x32'))){if(_0x15c84e[_0x964a('0x33')](_0x28f6c3[_0x964a('0x34')]['toLowerCase']())>=0x0&&_0x28f6c3[_0x964a('0x35')]!=='custom'){if(_0x28f6c3['answer']){_0x37b57b['push']({'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x2f'),'appdata':_0x964a('0x36'),'context':_0x28f6c3[_0x964a('0x18')],'exten':_0x28f6c3['exten'],'priority':_0x15fa41[_0x964a('0x2d')]+_0x331ec4[_0x964a('0x10')]+_0x20917d++,'VoiceExtensionId':_0x28f6c3[_0x964a('0x17')]});_0x37b57b[_0x964a('0x12')]({'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':_0x964a('0x37'),'context':_0x28f6c3[_0x964a('0x18')],'exten':_0x28f6c3[_0x964a('0x9')],'priority':_0x15fa41[_0x964a('0x2d')]+_0x331ec4['priority']+_0x20917d++,'VoiceExtensionId':_0x28f6c3[_0x964a('0x17')]});}else{_0x37b57b['push']({'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x2f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x28f6c3[_0x964a('0x18')],'exten':_0x28f6c3[_0x964a('0x9')],'priority':_0x15fa41[_0x964a('0x2d')]+_0x331ec4[_0x964a('0x10')]+_0x20917d++,'VoiceExtensionId':_0x28f6c3['VoiceExtensionId']});_0x37b57b[_0x964a('0x12')]({'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x13'),'appdata':_0x964a('0x38'),'context':_0x28f6c3[_0x964a('0x18')],'exten':_0x28f6c3[_0x964a('0x9')],'priority':_0x15fa41[_0x964a('0x2d')]+_0x331ec4['priority']+_0x20917d++,'VoiceExtensionId':_0x28f6c3[_0x964a('0x17')]});}}}for(var _0x45fb5f=0x0;_0x45fb5f<_0x15fa41[_0x964a('0x2d')];_0x45fb5f+=0x1){var _0xbd101=_0x331ec4[_0x964a('0x10')]+_0x15fa41[_0x964a('0x2d')];var _0xa5d3cd=_0x45fb5f===_0x15fa41[_0x964a('0x2d')]-0x1?_0x331ec4[_0x964a('0x10')]+_0x37b57b[_0x964a('0x2d')]+_0x278569['length']+0x2:_0x331ec4[_0x964a('0x10')]+_0x45fb5f+0x1;_0x37b57b[_0x964a('0x39')](_0x45fb5f,0x0,{'type':_0x28f6c3[_0x964a('0x15')],'app':_0x964a('0x3a'),'appdata':_0x15fa41[_0x45fb5f]+'?'+_0x28f6c3[_0x964a('0x18')]+_0x964a('0x3b')+_0xbd101+':'+_0x28f6c3[_0x964a('0x18')]+',${EXTEN},'+_0xa5d3cd,'exten':_0x28f6c3[_0x964a('0x9')],'context':_0x28f6c3[_0x964a('0x18')],'priority':_0x331ec4[_0x964a('0x10')]+_0x45fb5f,'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]});}_0x28f6c3[_0x964a('0x10')]=_0x37b57b[_0x964a('0x2d')]?_[_0x964a('0x3c')](_0x37b57b)['priority']+0x1:_0x331ec4[_0x964a('0x10')];_0x331ec4[_0x964a('0x10')]=(_0x278569['length']?_[_0x964a('0x3c')](_0x278569)[_0x964a('0x10')]:_0x28f6c3['priority'])+0x1;_0x331ec4['extensions']=_[_0x964a('0x3d')](_0x331ec4[_0x964a('0x11')],_0x37b57b,[_0x28f6c3],_0x278569);}_0x331ec4['extensions']['push']({'type':_0x4ac092[_0x1d9151][0x0][_0x964a('0x15')],'app':_0x964a('0x3e'),'exten':_0x4ac092[_0x1d9151][0x0]['exten'],'context':_0x4ac092[_0x1d9151][0x0][_0x964a('0x18')],'priority':_0x331ec4[_0x964a('0x10')],'VoiceExtensionId':_0x4ac092[_0x1d9151][0x0]['VoiceExtensionId']});_0x29dc89[_0x964a('0x12')](_0x4ac092[_0x1d9151][0x0][_0x964a('0x17')]);_0x2355c8=_[_0x964a('0x3d')](_0x2355c8,_0x331ec4[_0x964a('0x11')]);}}return _0x29b8b5['transaction'](function(_0x3c041c){return _0x29b8b5[_0x964a('0x2')]['VoiceExtension'][_0x964a('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x29dc89}},'transaction':_0x3c041c})[_0x964a('0x5')](function(_0xb2eb47){return _0x29b8b5[_0x964a('0x2')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0x2355c8,_0x964a('0x10')),{'transaction':_0x3c041c});});});})[_0x964a('0x40')](function(_0x564e0f){console[_0x964a('0x41')](_0x564e0f);});}exports[_0x964a('0x42')]=rewrite; \ No newline at end of file +var _0x7ba1=['util','Interval','findAll','then','intervals','VoiceExtension','IntervalId','models','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','context','outbound','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite'];(function(_0x542a40,_0x1ae834){var _0x2a9e5b=function(_0x530b5f){while(--_0x530b5f){_0x542a40['push'](_0x542a40['shift']());}};_0x2a9e5b(++_0x1ae834);}(_0x7ba1,0x128));var _0x17ba=function(_0x871d66,_0x2dec18){_0x871d66=_0x871d66-0x0;var _0x1d2d7c=_0x7ba1[_0x871d66];return _0x1d2d7c;};'use strict';var _=require('lodash');var util=require(_0x17ba('0x0'));function rewrite(_0x2a6cc6,_0x1155dc){var _0x384520=this;return _0x2a6cc6['models'][_0x17ba('0x1')][_0x17ba('0x2')]({'raw':!![]})[_0x17ba('0x3')](function(_0x4efcc1){_0x384520[_0x17ba('0x4')]=_0x4efcc1;return _0x2a6cc6['models'][_0x17ba('0x5')][_0x17ba('0x2')]({'where':{'IntervalId':_0x1155dc[_0x17ba('0x6')]},'raw':!![]});})[_0x17ba('0x3')](function(_0xd3c6c6){return _0x2a6cc6[_0x17ba('0x7')][_0x17ba('0x5')][_0x17ba('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0xd3c6c6,'exten'))}},'order':[{'raw':_0x17ba('0x8')}],'raw':!![]});})['then'](function(_0x39607f){var _0x2ac790=_[_0x17ba('0x9')](_0x39607f,{'priority':'1'});var _0x2e3fac=_[_0x17ba('0x9')](_0x39607f,{'isApp':0x1});var _0x2bef1d=_[_0x17ba('0xa')](_0x2e3fac,_0x17ba('0xb'));var _0x317498=[_0x17ba('0xc'),_0x17ba('0xd')];var _0x1e8349=[];var _0x3594bc=[];for(var _0x1f5baf in _0x2bef1d){if(_0x2bef1d[_0x17ba('0xe')](_0x1f5baf)){_0x384520[_0x17ba('0xf')]=0x2;_0x384520[_0x17ba('0x10')]=[];_0x384520[_0x17ba('0x11')]=_[_0x17ba('0x12')](_0x2ac790,{'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')]});_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':util[_0x17ba('0x16')](_0x17ba('0x17'),_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')]),'context':_0x2bef1d[_0x1f5baf][0x0]['context'],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520['priority']++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});if(_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')]==='inbound'){_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':'CDR(routeid)='+_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')],'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});}else if(_0x2bef1d[_0x1f5baf][0x0]['type']===_0x17ba('0x1a')){if(_0x384520[_0x17ba('0x11')]){_0x384520[_0x17ba('0x10')]['push']({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':'CDR(destination)='+(_0x384520[_0x17ba('0x11')][_0x17ba('0x1b')]?_0x17ba('0x1c')+_0x384520[_0x17ba('0x11')][_0x17ba('0x1b')]+'}':'${EXTEN}'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0]['exten'],'priority':_0x384520['priority']++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});}_0x384520['extensions'][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x1d')+_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')],'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});var _0x35a811=_0x384520[_0x17ba('0xf')]++;_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x1e'),'appdata':_0x17ba('0x1f')+(_0x35a811+0x2)+_0x17ba('0x20')+(_0x35a811+0x1)+')','context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0]['exten'],'priority':_0x35a811,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});if(_0x384520['extension']){_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x384520['extension'][_0x17ba('0x1b')]?_0x17ba('0x21')+_0x384520[_0x17ba('0x11')][_0x17ba('0x1b')]+'}':_0x17ba('0x22'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520['priority']++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});}_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':'Set','appdata':_0x17ba('0x23')+_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId'],'context':_0x2bef1d[_0x1f5baf][0x0]['context'],'exten':_0x2bef1d[_0x1f5baf][0x0]['exten'],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});if(_0x384520[_0x17ba('0x11')]&&_0x384520['extension'][_0x17ba('0xe')](_0x17ba('0x24'))&&_0x384520['extension'][_0x17ba('0x24')]!==_0x17ba('0x25')){_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':'Set','appdata':_0x17ba('0x26'),'context':_0x2bef1d[_0x1f5baf][0x0]['context'],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':_0x17ba('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x384520[_0x17ba('0x11')][_0x17ba('0x24')]||_0x17ba('0x27'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});}}_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':_0x17ba('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});_0x384520['extensions'][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x28'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});_0x384520['extensions'][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x14')],'app':'Set','appdata':_0x17ba('0x29'),'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'priority':_0x384520[_0x17ba('0xf')]++,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});for(var _0x10e9b0=0x0,_0x4097a4=0x0;_0x10e9b0<_0x2bef1d[_0x1f5baf][_0x17ba('0x2a')];_0x10e9b0+=0x1,_0x4097a4=0x0){var _0x1ea8b4=_0x2bef1d[_0x1f5baf][_0x10e9b0];if(_0x1ea8b4['type']){_0x1ea8b4[_0x17ba('0x14')]=_0x1ea8b4[_0x17ba('0x14')]['toLowerCase']();}var _0x1e6dcb=[];var _0x49a4aa=[];delete _0x1ea8b4['id'];delete _0x1ea8b4[_0x17ba('0x2b')];delete _0x1ea8b4['updatedAt'];var _0x1d9cab=_0x1ea8b4['interval']!==_0x17ba('0x2c')?[_0x1ea8b4[_0x17ba('0x2d')]]:_0x1ea8b4[_0x17ba('0x6')]?_[_0x17ba('0x2e')](_['filter'](_0x384520[_0x17ba('0x4')],{'IntervalId':_0x1ea8b4[_0x17ba('0x6')]}),'interval'):[];if(_0x1ea8b4[_0x17ba('0xe')](_0x17ba('0x2f'))){if(_0x1ea8b4[_0x17ba('0x2f')]&&_0x1ea8b4[_0x17ba('0x2f')]!=='--'){_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x30')+_0x1ea8b4[_0x17ba('0x2f')],'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4['exten'],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520['priority']+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}}if(_0x1ea8b4[_0x17ba('0x14')]===_0x17ba('0x1a')&&_0x1ea8b4[_0x17ba('0xe')]('callerID')){if(_0x1ea8b4[_0x17ba('0x31')]){_0x1e6dcb['push']({'type':_0x1ea8b4['type'],'app':'ExecIf','appdata':_0x17ba('0x32')+_0x1ea8b4[_0x17ba('0x31')]+')','context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}else{_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4['type'],'app':_0x17ba('0x1e'),'appdata':_0x17ba('0x33'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4['exten'],'priority':_0x1d9cab['length']+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}}if(_0x1ea8b4['hasOwnProperty'](_0x17ba('0x34'))){if(_0x317498[_0x17ba('0x35')](_0x1ea8b4[_0x17ba('0x36')][_0x17ba('0x37')]())>=0x0&&_0x1ea8b4[_0x17ba('0x38')]!==_0x17ba('0x39')){if(_0x1ea8b4[_0x17ba('0x34')]){_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':'ExecIf','appdata':_0x17ba('0x3a'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4['VoiceExtensionId']});_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x15'),'appdata':_0x17ba('0x3b'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab[_0x17ba('0x2a')]+_0x384520['priority']+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}else{_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x1e'),'appdata':_0x17ba('0x3c'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4['exten'],'priority':_0x1d9cab['length']+_0x384520['priority']+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4['VoiceExtensionId']});_0x1e6dcb[_0x17ba('0x13')]({'type':_0x1ea8b4[_0x17ba('0x14')],'app':'Set','appdata':_0x17ba('0x3d'),'context':_0x1ea8b4[_0x17ba('0x19')],'exten':_0x1ea8b4[_0x17ba('0xb')],'priority':_0x1d9cab['length']+_0x384520[_0x17ba('0xf')]+_0x4097a4++,'VoiceExtensionId':_0x1ea8b4[_0x17ba('0x18')]});}}}for(var _0x260440=0x0;_0x260440<_0x1d9cab[_0x17ba('0x2a')];_0x260440+=0x1){var _0x3d485e=_0x384520[_0x17ba('0xf')]+_0x1d9cab[_0x17ba('0x2a')];var _0x3d49e3=_0x260440===_0x1d9cab[_0x17ba('0x2a')]-0x1?_0x384520['priority']+_0x1e6dcb['length']+_0x49a4aa[_0x17ba('0x2a')]+0x2:_0x384520['priority']+_0x260440+0x1;_0x1e6dcb[_0x17ba('0x3e')](_0x260440,0x0,{'type':_0x1ea8b4[_0x17ba('0x14')],'app':_0x17ba('0x3f'),'appdata':_0x1d9cab[_0x260440]+'?'+_0x1ea8b4['context']+_0x17ba('0x40')+_0x3d485e+':'+_0x1ea8b4['context']+_0x17ba('0x40')+_0x3d49e3,'exten':_0x1ea8b4['exten'],'context':_0x1ea8b4[_0x17ba('0x19')],'priority':_0x384520[_0x17ba('0xf')]+_0x260440,'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]});}_0x1ea8b4[_0x17ba('0xf')]=_0x1e6dcb[_0x17ba('0x2a')]?_[_0x17ba('0x41')](_0x1e6dcb)[_0x17ba('0xf')]+0x1:_0x384520[_0x17ba('0xf')];_0x384520[_0x17ba('0xf')]=(_0x49a4aa[_0x17ba('0x2a')]?_['last'](_0x49a4aa)[_0x17ba('0xf')]:_0x1ea8b4['priority'])+0x1;_0x384520[_0x17ba('0x10')]=_[_0x17ba('0x42')](_0x384520['extensions'],_0x1e6dcb,[_0x1ea8b4],_0x49a4aa);}_0x384520[_0x17ba('0x10')][_0x17ba('0x13')]({'type':_0x2bef1d[_0x1f5baf][0x0]['type'],'app':'Hangup','exten':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0xb')],'context':_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x19')],'priority':_0x384520[_0x17ba('0xf')],'VoiceExtensionId':_0x2bef1d[_0x1f5baf][0x0]['VoiceExtensionId']});_0x1e8349[_0x17ba('0x13')](_0x2bef1d[_0x1f5baf][0x0][_0x17ba('0x18')]);_0x3594bc=_[_0x17ba('0x42')](_0x3594bc,_0x384520[_0x17ba('0x10')]);}}return _0x2a6cc6[_0x17ba('0x43')](function(_0x23da1f){return _0x2a6cc6[_0x17ba('0x7')][_0x17ba('0x5')][_0x17ba('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x1e8349}},'transaction':_0x23da1f})[_0x17ba('0x3')](function(_0xeb6af6){return _0x2a6cc6[_0x17ba('0x7')][_0x17ba('0x5')][_0x17ba('0x45')](_[_0x17ba('0x46')](_0x3594bc,_0x17ba('0xf')),{'transaction':_0x23da1f});});});})[_0x17ba('0x47')](function(_0x3dd4c8){console[_0x17ba('0x48')](_0x3dd4c8);});}exports[_0x17ba('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6211558..3183ab6 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 _0x1262=['scheduledAt','ListId','createdAt','select','field','NOW()','toString','updatedAt','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','ContactId','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','BlackLists','Lists','CampaignId','all','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','CmContact','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','defaults','localhost','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','test','isNil','errors','length','map','data','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','insert','cm_hopper','fromQuery','phone'];(function(_0x3c51af,_0x1203ba){var _0x2d3588=function(_0x409a66){while(--_0x409a66){_0x3c51af['push'](_0x3c51af['shift']());}};_0x2d3588(++_0x1203ba);}(_0x1262,0x10e));var _0x2126=function(_0x278548,_0x373505){_0x278548=_0x278548-0x0;var _0x4b6c99=_0x1262[_0x278548];return _0x4b6c99;};'use strict';var BPromise=require(_0x2126('0x0'));var util=require(_0x2126('0x1'));var _=require(_0x2126('0x2'));var fs=require('fs');var squel=require(_0x2126('0x3'));var Papa=require(_0x2126('0x4'));var Redis=require(_0x2126('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x2126('0x6'));var logger=require(_0x2126('0x7'))(_0x2126('0x8'));config['redis']=_[_0x2126('0x9')](config['redis'],{'host':_0x2126('0xa'),'port':0x18eb});var socket=require(_0x2126('0xb'))(new Redis(config[_0x2126('0xc')]));require(_0x2126('0xd'))['register'](socket);try{if(!process[_0x2126('0xe')][0x2]||process['argv'][0x2]===_0x2126('0xf')||process['argv'][0x2]===_0x2126('0x10')){throw new Error(_0x2126('0x11'));}var FILEPATH=process[_0x2126('0xe')][0x2];if(!process[_0x2126('0xe')][0x3]||process['argv'][0x3]===_0x2126('0xf')||process[_0x2126('0xe')][0x3]===_0x2126('0x10')||!process[_0x2126('0xe')][0x4]||process[_0x2126('0xe')][0x4]==='undefined'||process[_0x2126('0xe')][0x4]===_0x2126('0x10')){throw new Error(_0x2126('0x12'));}var FIELDS=_[_0x2126('0x13')](process['argv'][0x3][_0x2126('0x14')](','),process[_0x2126('0xe')][0x4][_0x2126('0x14')](','));if(!process[_0x2126('0xe')][0x5]||process[_0x2126('0xe')][0x5]===_0x2126('0xf')||process['argv'][0x5]===_0x2126('0x10')){throw new Error(_0x2126('0x15'));}var LISTID=process[_0x2126('0xe')][0x5];var COMPANYID=process[_0x2126('0xe')][0x6]&&process[_0x2126('0xe')][0x6]!==_0x2126('0xf')&&process[_0x2126('0xe')][0x6]!==_0x2126('0x10')?process[_0x2126('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x2126('0xe')][0x7]!==_0x2126('0x10')?process['argv'][0x7]:null;if(!process[_0x2126('0xe')][0x8]||process['argv'][0x8]===_0x2126('0xf')||process[_0x2126('0xe')][0x8]==='null'){throw new Error(_0x2126('0x16'));}var SOCKET_TIMESTAMP=process[_0x2126('0xe')][0x8];}catch(_0x12a822){logger[_0x2126('0x17')](_0x12a822);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(_0x3d8fdc,_0x208bdb,_0x4b4762,_0x5bf101){var _0x2dfbf2={'message':_0x208bdb};_0x2dfbf2[_0x3d8fdc]=!![];if(_0x4b4762){_0x2dfbf2['contact']=_0x4b4762;}if(_0x5bf101){_0x2dfbf2['index']=_0x5bf101;}return _0x2dfbf2;}function isEmail(_0x388bdc){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))*$/[_0x2126('0x18')](_0x388bdc);}function checkRow(_0x417fc4,_0x3e3478,_0x33940a){return new BPromise(function(_0x432f21,_0x36506a){if(_[_0x2126('0x19')](_0x417fc4)){return _0x36506a(handleCheckRowError(_0x2126('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x33940a));}if(_0x417fc4[_0x2126('0x1a')]&&_0x417fc4[_0x2126('0x1a')][_0x2126('0x1b')]){var _0x5e8974=_[_0x2126('0x1c')](_0x417fc4[_0x2126('0x1a')],'message')['join'](';');return _0x36506a(handleCheckRowError('error',_0x5e8974,null,_0x33940a));}var _0x22e8f4={};for(var _0x969e73 in FIELDS){if(FIELDS['hasOwnProperty'](_0x969e73)&&FIELDS[_0x969e73]){_0x22e8f4[_0x969e73]=_0x417fc4['data'][0x0][FIELDS[_0x969e73]]||_0x417fc4[_0x2126('0x1d')][0x0]['\ufeff'+FIELDS[_0x969e73]];}}if(!_0x22e8f4['firstName']){return _0x36506a(handleCheckRowError(_0x2126('0x17'),'firstName\x20not\x20specified!',null,_0x33940a));}if(!_0x22e8f4['phone']){return _0x36506a(handleCheckRowError(_0x2126('0x17'),'phone\x20not\x20specified!',null,_0x33940a));}if(_0x22e8f4[_0x2126('0x1e')]){var _0x2c8954=moment(_0x22e8f4[_0x2126('0x1e')],_0x2126('0x1f'));if(!_0x2c8954[_0x2126('0x20')]()){return _0x36506a(handleCheckRowError(_0x2126('0x17'),_0x2126('0x21'),null,_0x33940a));}}if(_0x22e8f4[_0x2126('0x22')]){if(!isEmail(_0x22e8f4[_0x2126('0x22')])){return _0x36506a(handleCheckRowError(_0x2126('0x17'),_0x2126('0x23'),null,_0x33940a));}}_0x22e8f4['ListId']=LISTID;_0x22e8f4['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2126('0x1b')]&&_0x3e3478){var _0x259711={};for(var _0x1b3c8c=0x0,_0x63b36a=DUPLICATES[_0x2126('0x1b')];_0x1b3c8c<_0x63b36a;_0x1b3c8c+=0x1){_0x259711[DUPLICATES[_0x1b3c8c]]=_0x22e8f4[DUPLICATES[_0x1b3c8c]];}var _0x2ebd6a=_[_0x2126('0x24')](_0x3e3478,_0x259711);if(_0x2ebd6a){return _0x36506a(handleCheckRowError(_0x2126('0x25'),_0x2126('0x26'),_0x2ebd6a,_0x33940a));}}return db['CmContact']['create'](_0x22e8f4,{'raw':!![],'hooks':![],'fields':_[_0x2126('0x27')](_0x22e8f4)})[_0x2126('0x28')](function(_0x505b3b){if(DUPLICATES&&DUPLICATES[_0x2126('0x1b')]&&_0x3e3478){_0x3e3478[_0x2126('0x29')](_['pick'](_0x22e8f4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x505b3b['id'];return _0x432f21();})[_0x2126('0x2a')](function(_0x468faf){return _0x36506a(handleCheckRowError(_0x2126('0x17'),_0x2126('0x2b')+(_0x468faf[_0x2126('0x2c')]||JSON[_0x2126('0x2d')](_0x468faf)),null,_0x33940a));});});}function checkHopper(){function _0x336aac(){return function(_0x3ae08c){logger['error'](_0x2126('0x2e'),'checkHopper',util['inspect'](_0x3ae08c,{'showHidden':![],'depth':null}));};}var _0x4d9af5=function(_0x1cccd3,_0x28b294){var _0x28b4dc=squel[_0x2126('0x2f')]()['into'](_0x2126('0x30'))[_0x2126('0x31')]([_0x2126('0x32'),_0x2126('0x33'),'ContactId',_0x2126('0x34'),_0x28b294,_0x2126('0x35'),'updatedAt'],squel[_0x2126('0x36')]()['field'](_0x2126('0x32'),_0x2126('0x32'))[_0x2126('0x37')](_0x2126('0x38'),_0x2126('0x33'))[_0x2126('0x37')]('id','ContactId')[_0x2126('0x37')](LISTID[_0x2126('0x39')](),_0x2126('0x34'))[_0x2126('0x37')](_0x1cccd3['id'][_0x2126('0x39')](),_0x28b294)[_0x2126('0x37')](_0x2126('0x38'),_0x2126('0x35'))[_0x2126('0x37')](_0x2126('0x38'),_0x2126('0x3a'))[_0x2126('0x3b')]('cm_contacts')['where'](_0x2126('0x3c'))['where'](_0x2126('0x3d'),LISTID[_0x2126('0x39')]())[_0x2126('0x3e')](_0x2126('0x3f'))[_0x2126('0x3e')](_0x2126('0x40'),squel[_0x2126('0x36')]()['field'](_0x2126('0x32'))[_0x2126('0x3b')](_0x2126('0x30'))[_0x2126('0x3e')](_0x28b294+_0x2126('0x41'),_0x1cccd3['id']['toString']())))[_0x2126('0x39')]();return _0x28b4dc;};var _0x3d4bc4=function(_0x22147c,_0xa85c11){var _0x1761f7=squel['insert']()[_0x2126('0x42')](_0x2126('0x30'))[_0x2126('0x31')]([_0x2126('0x32'),_0x2126('0x33'),_0x2126('0x43'),_0x2126('0x34'),_0xa85c11,'createdAt',_0x2126('0x3a')],squel['select']()[_0x2126('0x37')](_0x2126('0x32'),_0x2126('0x32'))[_0x2126('0x37')]('NOW()',_0x2126('0x33'))[_0x2126('0x37')]('id',_0x2126('0x43'))['field'](LISTID[_0x2126('0x39')](),'ListId')[_0x2126('0x37')](_0x22147c['id'][_0x2126('0x39')](),_0xa85c11)[_0x2126('0x37')](_0x2126('0x38'),_0x2126('0x35'))[_0x2126('0x37')](_0x2126('0x38'),_0x2126('0x3a'))[_0x2126('0x3b')](_0x2126('0x44'))[_0x2126('0x3e')]('deletedAt\x20IS\x20NULL')[_0x2126('0x3e')]('ListId\x20=\x20?',LISTID[_0x2126('0x39')]())[_0x2126('0x3e')](_0x2126('0x45'),squel[_0x2126('0x46')](hopperContacts))['where'](_0x2126('0x3f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2126('0x36')]()[_0x2126('0x37')](_0x2126('0x47'))[_0x2126('0x3b')](_0x2126('0x48'))[_0x2126('0x3e')](_0xa85c11+_0x2126('0x41'),_0x22147c['id'][_0x2126('0x39')]()))[_0x2126('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2126('0x36')]()[_0x2126('0x37')](_0x2126('0x32'))[_0x2126('0x3b')]('cm_hopper')[_0x2126('0x3e')](_0xa85c11+_0x2126('0x41'),_0x22147c['id'][_0x2126('0x39')]())))[_0x2126('0x39')]();return _0x1761f7;};function _0x2357f2(_0x2abbf9,_0x16fc37){var _0x357dc3=squel[_0x2126('0x2f')]()[_0x2126('0x42')](_0x2126('0x30'))[_0x2126('0x31')]([_0x2126('0x32'),'scheduledAt',_0x2126('0x43'),_0x2126('0x34'),_0x16fc37,_0x2126('0x35'),_0x2126('0x3a')],squel['select']()[_0x2126('0x37')](_0x2126('0x32'),_0x2126('0x32'))['field'](_0x2126('0x38'),'scheduledAt')['field']('id',_0x2126('0x43'))[_0x2126('0x37')](LISTID[_0x2126('0x39')](),_0x2126('0x34'))[_0x2126('0x37')](_0x2abbf9['id'][_0x2126('0x39')](),_0x16fc37)[_0x2126('0x37')](_0x2126('0x38'),'createdAt')['field']('NOW()',_0x2126('0x3a'))['from'](_0x2126('0x44'))[_0x2126('0x3e')](_0x2126('0x3c'))[_0x2126('0x3e')](_0x2126('0x3d'),LISTID[_0x2126('0x39')]())['where'](_0x2126('0x45'),squel[_0x2126('0x46')](hopperContacts))[_0x2126('0x3e')](_0x2126('0x3f')))['toString']();return _0x357dc3;}function _0x4fc580(_0x3482b1,_0x4f8941){var _0x2d2e68=squel['insert']()[_0x2126('0x42')](_0x2126('0x49'))[_0x2126('0x31')]([_0x2126('0x32'),_0x2126('0x43'),_0x2126('0x34'),_0x4f8941,'createdAt',_0x2126('0x3a')],squel[_0x2126('0x36')]()[_0x2126('0x37')](_0x2126('0x32'),_0x2126('0x32'))[_0x2126('0x37')]('id','ContactId')[_0x2126('0x37')](LISTID['toString'](),'ListId')[_0x2126('0x37')](_0x3482b1['id']['toString'](),_0x4f8941)[_0x2126('0x37')](_0x2126('0x38'),_0x2126('0x35'))[_0x2126('0x37')]('NOW()',_0x2126('0x3a'))[_0x2126('0x3b')](_0x2126('0x44'))[_0x2126('0x3e')](_0x2126('0x3c'))['where'](_0x2126('0x3d'),LISTID[_0x2126('0x39')]())[_0x2126('0x3e')](_0x2126('0x45'),squel[_0x2126('0x46')](hopperContacts))[_0x2126('0x3e')](_0x2126('0x3f')))[_0x2126('0x39')]();return _0x2d2e68;}return db[_0x2126('0x4a')][_0x2126('0x4b')]({'where':{'type':_0x2126('0x4c')},'attributes':['id',_0x2126('0x4d')],'include':[{'model':db[_0x2126('0x4e')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2c607f){var _0x558e99=[];if(_0x2c607f){var _0x575378;for(var _0xe03f90=0x0,_0xb4c29;_0xe03f90<_0x2c607f[_0x2126('0x1b')];_0xe03f90+=0x1){_0xb4c29=_0x2c607f[_0xe03f90][_0x2126('0x4f')]({'plain':!![]});switch(_0xb4c29[_0x2126('0x4d')]){case _0x2126('0x50'):_0x558e99[_0x2126('0x29')](db[_0x2126('0x51')][_0x2126('0x52')](_0x3d4bc4(_0xb4c29,_0x2126('0x53')))[_0x2126('0x28')](function(){})[_0x2126('0x2a')](_0x336aac()));break;case'onlyIfOpen':_0x558e99[_0x2126('0x29')](db[_0x2126('0x51')][_0x2126('0x52')](_0x4d9af5(_0xb4c29,_0x2126('0x53')))[_0x2126('0x28')](function(){})[_0x2126('0x2a')](_0x336aac()));break;default:_0x558e99['push'](db[_0x2126('0x51')][_0x2126('0x52')](_0x2357f2(_0xb4c29,_0x2126('0x53')))['then'](function(){})[_0x2126('0x2a')](_0x336aac()));}}}return _0x558e99;})['all']()['then'](function(){return db['VoiceQueue'][_0x2126('0x4b')]({'where':{'type':_0x2126('0x4c')},'attributes':['id'],'include':[{'model':db[_0x2126('0x4e')],'as':_0x2126('0x54'),'where':{'id':LISTID}}]})[_0x2126('0x28')](function(_0x416ae8){var _0x555eea=[];if(_0x416ae8){var _0x380420;for(var _0x2ea9fd=0x0,_0x16c386;_0x2ea9fd<_0x416ae8[_0x2126('0x1b')];_0x2ea9fd+=0x1){_0x16c386=_0x416ae8[_0x2ea9fd][_0x2126('0x4f')]({'plain':!![]});_0x555eea[_0x2126('0x29')](db[_0x2126('0x51')]['query'](_0x4fc580(_0x16c386,_0x2126('0x53')))['then'](function(){})[_0x2126('0x2a')](_0x336aac()));}}return _0x555eea;})['all']();})[_0x2126('0x28')](function(){return db['Campaign'][_0x2126('0x4b')]({'attributes':['id',_0x2126('0x4d')],'include':[{'model':db[_0x2126('0x4e')],'as':_0x2126('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x54aa9e){var _0x33d9d7=[];if(_0x54aa9e){for(var _0x3408aa=0x0,_0x49b4cf;_0x3408aa<_0x54aa9e[_0x2126('0x1b')];_0x3408aa+=0x1){_0x49b4cf=_0x54aa9e[_0x3408aa]['get']({'plain':!![]});switch(_0x49b4cf['dialCheckDuplicateType']){case'always':_0x33d9d7[_0x2126('0x29')](db[_0x2126('0x51')]['query'](_0x3d4bc4(_0x49b4cf,_0x2126('0x56')))['then'](function(){})[_0x2126('0x2a')](_0x336aac()));break;case'onlyIfOpen':_0x33d9d7['push'](db['sequelize'][_0x2126('0x52')](_0x4d9af5(_0x49b4cf,_0x2126('0x56')))[_0x2126('0x28')](function(){})[_0x2126('0x2a')](_0x336aac()));break;default:_0x33d9d7[_0x2126('0x29')](db[_0x2126('0x51')]['query'](_0x2357f2(_0x49b4cf,_0x2126('0x56')))['then'](function(){})[_0x2126('0x2a')](_0x336aac()));}}}return _0x33d9d7;})[_0x2126('0x57')]();})[_0x2126('0x28')](function(){return db[_0x2126('0x58')][_0x2126('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x2126('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x41f4b8){var _0x84f685=[];if(_0x41f4b8){for(var _0x9fe0ea=0x0,_0x28528d;_0x9fe0ea<_0x41f4b8[_0x2126('0x1b')];_0x9fe0ea+=0x1){_0x28528d=_0x41f4b8[_0x9fe0ea][_0x2126('0x4f')]({'plain':!![]});_0x84f685['push'](db['sequelize'][_0x2126('0x52')](_0x4fc580(_0x28528d,_0x2126('0x56')))['then'](function(){})[_0x2126('0x2a')](_0x336aac()));}}return _0x84f685;})['all']();})[_0x2126('0x2a')](function(_0x15878c){logger[_0x2126('0x17')](_0x2126('0x59'),_0x2126('0x5a'),_0x15878c[_0x2126('0x2c')]);});}var processPromises=function(_0xa82963){return BPromise['all'](promises)[_0x2126('0x28')](function(_0x49cde0){})['catch'](function(_0x34c53b){logger['error'](_0x2126('0x5b'),JSON[_0x2126('0x2d')](_0x34c53b));})['finally'](function(){socket['emit'](_0x2126('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xa82963){return _0xa82963[_0x2126('0x5d')]();}});};var endCsv=function(){return BPromise[_0x2126('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x2126('0x28')](function(){socket[_0x2126('0x5f')](_0x2126('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2126('0x60')](FILEPATH);}catch(_0xaf0c3c){logger[_0x2126('0x17')](_0x2126('0x61'),JSON[_0x2126('0x2d')](_0xaf0c3c));}finally{process[_0x2126('0x62')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x2126('0x63'));endCsv();});function main(){return BPromise['resolve']()[_0x2126('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2126('0x14')](',');return db[_0x2126('0x64')][_0x2126('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x731267){var _0x47861b=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2126('0x65')](_0x47861b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x84dd39,_0x219099){total+=0x1;var _0x2a6f01=total;promises[_0x2126('0x29')](checkRow(_0x84dd39,_0x731267,_0x2a6f01)[_0x2126('0x28')](function(){success+=0x1;})[_0x2126('0x2a')](function(_0x964950){if(_0x964950[_0x2126('0x17')]){errors+=0x1;delete _0x964950['error'];}else if(_0x964950[_0x2126('0x25')]){duplicates+=0x1;delete _0x964950[_0x2126('0x25')];}rows['push'](_0x964950);}));if(total%0xc8===0x0){_0x219099[_0x2126('0x66')]();return processPromises(_0x219099);}},'complete':function(){return processPromises()[_0x2126('0x28')](function(){logger[_0x2126('0x67')](_0x2126('0x68'));endCsv();});},'error':function(_0x3a6d8f,_0x467fd0){logger[_0x2126('0x67')](_0x2126('0x69'),JSON[_0x2126('0x2d')](_0x3a6d8f));endCsv();}});})[_0x2126('0x2a')](function(_0x32ef35){logger['error'](_0x2126('0x6a'),JSON[_0x2126('0x2d')](_0x32ef35));});}main(); \ No newline at end of file +var _0x1e6a=['../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','phone','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','query','VoiceQueueId','sequelize','all','BlackLists','Campaign','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter'];(function(_0x3d3cd1,_0x370aba){var _0x4ffc6b=function(_0x357eca){while(--_0x357eca){_0x3d3cd1['push'](_0x3d3cd1['shift']());}};_0x4ffc6b(++_0x370aba);}(_0x1e6a,0x1b6));var _0xa1e6=function(_0x5e022c,_0x41b2c0){_0x5e022c=_0x5e022c-0x0;var _0xf577f5=_0x1e6a[_0x5e022c];return _0xf577f5;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xa1e6('0x0'));var fs=require('fs');var squel=require(_0xa1e6('0x1'));var Papa=require(_0xa1e6('0x2'));var Redis=require('ioredis');var db=require(_0xa1e6('0x3'))['db'];var config=require(_0xa1e6('0x4'));var logger=require(_0xa1e6('0x5'))(_0xa1e6('0x6'));config[_0xa1e6('0x7')]=_['defaults'](config[_0xa1e6('0x7')],{'host':_0xa1e6('0x8'),'port':0x18eb});var socket=require(_0xa1e6('0x9'))(new Redis(config['redis']));require(_0xa1e6('0xa'))['register'](socket);try{if(!process['argv'][0x2]||process[_0xa1e6('0xb')][0x2]===_0xa1e6('0xc')||process[_0xa1e6('0xb')][0x2]==='null'){throw new Error(_0xa1e6('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0xa1e6('0xb')][0x3]||process[_0xa1e6('0xb')][0x3]===_0xa1e6('0xc')||process['argv'][0x3]===_0xa1e6('0xe')||!process[_0xa1e6('0xb')][0x4]||process[_0xa1e6('0xb')][0x4]===_0xa1e6('0xc')||process[_0xa1e6('0xb')][0x4]===_0xa1e6('0xe')){throw new Error(_0xa1e6('0xf'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0xa1e6('0x10')](','),process[_0xa1e6('0xb')][0x4][_0xa1e6('0x10')](','));if(!process['argv'][0x5]||process[_0xa1e6('0xb')][0x5]==='undefined'||process[_0xa1e6('0xb')][0x5]===_0xa1e6('0xe')){throw new Error(_0xa1e6('0x11'));}var LISTID=process[_0xa1e6('0xb')][0x5];var COMPANYID=process[_0xa1e6('0xb')][0x6]&&process['argv'][0x6]!==_0xa1e6('0xc')&&process[_0xa1e6('0xb')][0x6]!==_0xa1e6('0xe')?process[_0xa1e6('0xb')][0x6]:null;var DUPLICATES=process[_0xa1e6('0xb')][0x7]&&process['argv'][0x7]!==_0xa1e6('0xc')&&process[_0xa1e6('0xb')][0x7]!==_0xa1e6('0xe')?process[_0xa1e6('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0xa1e6('0xb')][0x8]==='undefined'||process[_0xa1e6('0xb')][0x8]===_0xa1e6('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xa1e6('0xb')][0x8];}catch(_0x5c0ae0){logger['error'](_0x5c0ae0);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(_0x4e1054,_0x87af09,_0x3507c7,_0x575dc0){var _0x15082e={'message':_0x87af09};_0x15082e[_0x4e1054]=!![];if(_0x3507c7){_0x15082e[_0xa1e6('0x12')]=_0x3507c7;}if(_0x575dc0){_0x15082e[_0xa1e6('0x13')]=_0x575dc0;}return _0x15082e;}function isEmail(_0x274f98){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))*$/[_0xa1e6('0x14')](_0x274f98);}function checkRow(_0x10bd37,_0x37ae87,_0xd60d3b){return new BPromise(function(_0x30f3ca,_0x1475b0){if(_[_0xa1e6('0x15')](_0x10bd37)){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x17'),null,_0xd60d3b));}if(_0x10bd37[_0xa1e6('0x18')]&&_0x10bd37['errors'][_0xa1e6('0x19')]){var _0x2a4da0=_[_0xa1e6('0x1a')](_0x10bd37[_0xa1e6('0x18')],_0xa1e6('0x1b'))['join'](';');return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0x2a4da0,null,_0xd60d3b));}var _0x4e5ffb={};for(var _0x420d98 in FIELDS){if(FIELDS[_0xa1e6('0x1c')](_0x420d98)&&FIELDS[_0x420d98]){_0x4e5ffb[_0x420d98]=_0x10bd37['data'][0x0][FIELDS[_0x420d98]]||_0x10bd37[_0xa1e6('0x1d')][0x0]['\ufeff'+FIELDS[_0x420d98]];}}if(!_0x4e5ffb[_0xa1e6('0x1e')]){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x1f'),null,_0xd60d3b));}if(!_0x4e5ffb['phone']){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x20'),null,_0xd60d3b));}if(_0x4e5ffb[_0xa1e6('0x21')]){var _0x2060ac=moment(_0x4e5ffb['birthDate'],_0xa1e6('0x22'));if(!_0x2060ac[_0xa1e6('0x23')]()){return _0x1475b0(handleCheckRowError('error',_0xa1e6('0x24'),null,_0xd60d3b));}}if(_0x4e5ffb[_0xa1e6('0x25')]){if(!isEmail(_0x4e5ffb[_0xa1e6('0x25')])){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x26'),null,_0xd60d3b));}}_0x4e5ffb[_0xa1e6('0x27')]=LISTID;_0x4e5ffb[_0xa1e6('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa1e6('0x19')]&&_0x37ae87){var _0x524b12={};for(var _0x121b13=0x0,_0x5aa78e=DUPLICATES[_0xa1e6('0x19')];_0x121b13<_0x5aa78e;_0x121b13+=0x1){_0x524b12[DUPLICATES[_0x121b13]]=_0x4e5ffb[DUPLICATES[_0x121b13]];}var _0x14589d=_[_0xa1e6('0x29')](_0x37ae87,_0x524b12);if(_0x14589d){return _0x1475b0(handleCheckRowError(_0xa1e6('0x2a'),_0xa1e6('0x2b'),_0x14589d,_0xd60d3b));}}return db[_0xa1e6('0x2c')][_0xa1e6('0x2d')](_0x4e5ffb,{'raw':!![],'hooks':![],'fields':_[_0xa1e6('0x2e')](_0x4e5ffb)})[_0xa1e6('0x2f')](function(_0x3ed32f){if(DUPLICATES&&DUPLICATES[_0xa1e6('0x19')]&&_0x37ae87){_0x37ae87['push'](_[_0xa1e6('0x30')](_0x4e5ffb,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3ed32f['id'];return _0x30f3ca();})[_0xa1e6('0x31')](function(_0x51a555){return _0x1475b0(handleCheckRowError(_0xa1e6('0x16'),_0xa1e6('0x32')+(_0x51a555['message']||JSON[_0xa1e6('0x33')](_0x51a555)),null,_0xd60d3b));});});}function checkHopper(){function _0x1f305b(){return function(_0x27e16e){logger['error'](_0xa1e6('0x34'),_0xa1e6('0x35'),util['inspect'](_0x27e16e,{'showHidden':![],'depth':null}));};}var _0x2821f6=function(_0x3ec4eb,_0x12e08c){var _0x476eac=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')](_0xa1e6('0x38'))[_0xa1e6('0x39')](['phone',_0xa1e6('0x3a'),_0xa1e6('0x3b'),'ListId',_0x12e08c,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x40'),_0xa1e6('0x40'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3a'))[_0xa1e6('0x3f')]('id',_0xa1e6('0x3b'))[_0xa1e6('0x3f')](LISTID[_0xa1e6('0x42')](),_0xa1e6('0x27'))[_0xa1e6('0x3f')](_0x3ec4eb['id'][_0xa1e6('0x42')](),_0x12e08c)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3d'))['from'](_0xa1e6('0x43'))[_0xa1e6('0x44')](_0xa1e6('0x45'))['where'](_0xa1e6('0x46'),LISTID[_0xa1e6('0x42')]())['where'](_0xa1e6('0x47'))[_0xa1e6('0x44')](_0xa1e6('0x48'),squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x40'))[_0xa1e6('0x49')](_0xa1e6('0x38'))['where'](_0x12e08c+_0xa1e6('0x4a'),_0x3ec4eb['id']['toString']())))[_0xa1e6('0x42')]();return _0x476eac;};var _0x37e1f6=function(_0x4e9995,_0x5f1ed3){var _0x564763=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')](_0xa1e6('0x38'))['fromQuery']([_0xa1e6('0x40'),'scheduledAt',_0xa1e6('0x3b'),_0xa1e6('0x27'),_0x5f1ed3,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel['select']()[_0xa1e6('0x3f')]('phone',_0xa1e6('0x40'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),'scheduledAt')[_0xa1e6('0x3f')]('id',_0xa1e6('0x3b'))[_0xa1e6('0x3f')](LISTID['toString'](),'ListId')[_0xa1e6('0x3f')](_0x4e9995['id'][_0xa1e6('0x42')](),_0x5f1ed3)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3d'))[_0xa1e6('0x49')](_0xa1e6('0x43'))['where'](_0xa1e6('0x45'))[_0xa1e6('0x44')](_0xa1e6('0x46'),LISTID['toString']())[_0xa1e6('0x44')](_0xa1e6('0x4b'),squel[_0xa1e6('0x4c')](hopperContacts))[_0xa1e6('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xa1e6('0x44')](_0xa1e6('0x48'),squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x4d'))[_0xa1e6('0x49')](_0xa1e6('0x4e'))['where'](_0x5f1ed3+_0xa1e6('0x4a'),_0x4e9995['id'][_0xa1e6('0x42')]()))[_0xa1e6('0x44')](_0xa1e6('0x48'),squel[_0xa1e6('0x3e')]()[_0xa1e6('0x3f')](_0xa1e6('0x40'))[_0xa1e6('0x49')](_0xa1e6('0x38'))[_0xa1e6('0x44')](_0x5f1ed3+_0xa1e6('0x4a'),_0x4e9995['id'][_0xa1e6('0x42')]())))[_0xa1e6('0x42')]();return _0x564763;};function _0x3bc961(_0x2d7d3c,_0x2318e9){var _0x32f7c5=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')]('cm_hopper')[_0xa1e6('0x39')]([_0xa1e6('0x40'),_0xa1e6('0x3a'),_0xa1e6('0x3b'),_0xa1e6('0x27'),_0x2318e9,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel['select']()[_0xa1e6('0x3f')](_0xa1e6('0x40'),_0xa1e6('0x40'))['field'](_0xa1e6('0x41'),'scheduledAt')[_0xa1e6('0x3f')]('id','ContactId')['field'](LISTID['toString'](),_0xa1e6('0x27'))['field'](_0x2d7d3c['id'][_0xa1e6('0x42')](),_0x2318e9)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))['field'](_0xa1e6('0x41'),_0xa1e6('0x3d'))['from'](_0xa1e6('0x43'))[_0xa1e6('0x44')]('deletedAt\x20IS\x20NULL')[_0xa1e6('0x44')](_0xa1e6('0x46'),LISTID[_0xa1e6('0x42')]())['where'](_0xa1e6('0x4b'),squel['str'](hopperContacts))[_0xa1e6('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xa1e6('0x42')]();return _0x32f7c5;}function _0x303398(_0x3c3c2f,_0x2a4560){var _0x1d6514=squel[_0xa1e6('0x36')]()[_0xa1e6('0x37')](_0xa1e6('0x4f'))['fromQuery']([_0xa1e6('0x40'),_0xa1e6('0x3b'),_0xa1e6('0x27'),_0x2a4560,_0xa1e6('0x3c'),_0xa1e6('0x3d')],squel['select']()[_0xa1e6('0x3f')](_0xa1e6('0x40'),'phone')['field']('id',_0xa1e6('0x3b'))['field'](LISTID['toString'](),'ListId')['field'](_0x3c3c2f['id'][_0xa1e6('0x42')](),_0x2a4560)[_0xa1e6('0x3f')](_0xa1e6('0x41'),_0xa1e6('0x3c'))['field'](_0xa1e6('0x41'),'updatedAt')[_0xa1e6('0x49')]('cm_contacts')[_0xa1e6('0x44')](_0xa1e6('0x45'))[_0xa1e6('0x44')](_0xa1e6('0x46'),LISTID['toString']())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xa1e6('0x44')](_0xa1e6('0x47')))[_0xa1e6('0x42')]();return _0x1d6514;}return db[_0xa1e6('0x50')][_0xa1e6('0x51')]({'where':{'type':_0xa1e6('0x52')},'attributes':['id',_0xa1e6('0x53')],'include':[{'model':db[_0xa1e6('0x54')],'as':_0xa1e6('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x550fe7){var _0x2aa182=[];if(_0x550fe7){var _0x16d195;for(var _0x2c9a8d=0x0,_0x546fbf;_0x2c9a8d<_0x550fe7[_0xa1e6('0x19')];_0x2c9a8d+=0x1){_0x546fbf=_0x550fe7[_0x2c9a8d][_0xa1e6('0x56')]({'plain':!![]});switch(_0x546fbf[_0xa1e6('0x53')]){case _0xa1e6('0x57'):_0x2aa182[_0xa1e6('0x58')](db['sequelize'][_0xa1e6('0x59')](_0x37e1f6(_0x546fbf,_0xa1e6('0x5a')))[_0xa1e6('0x2f')](function(){})[_0xa1e6('0x31')](_0x1f305b()));break;case'onlyIfOpen':_0x2aa182[_0xa1e6('0x58')](db['sequelize'][_0xa1e6('0x59')](_0x2821f6(_0x546fbf,_0xa1e6('0x5a')))['then'](function(){})[_0xa1e6('0x31')](_0x1f305b()));break;default:_0x2aa182[_0xa1e6('0x58')](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x3bc961(_0x546fbf,_0xa1e6('0x5a')))[_0xa1e6('0x2f')](function(){})[_0xa1e6('0x31')](_0x1f305b()));}}}return _0x2aa182;})[_0xa1e6('0x5c')]()[_0xa1e6('0x2f')](function(){return db[_0xa1e6('0x50')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xa1e6('0x54')],'as':_0xa1e6('0x5d'),'where':{'id':LISTID}}]})[_0xa1e6('0x2f')](function(_0x48f718){var _0x3a2041=[];if(_0x48f718){var _0x2ac25b;for(var _0x4ae065=0x0,_0x220009;_0x4ae065<_0x48f718[_0xa1e6('0x19')];_0x4ae065+=0x1){_0x220009=_0x48f718[_0x4ae065][_0xa1e6('0x56')]({'plain':!![]});_0x3a2041[_0xa1e6('0x58')](db['sequelize'][_0xa1e6('0x59')](_0x303398(_0x220009,'VoiceQueueId'))[_0xa1e6('0x2f')](function(){})[_0xa1e6('0x31')](_0x1f305b()));}}return _0x3a2041;})[_0xa1e6('0x5c')]();})[_0xa1e6('0x2f')](function(){return db[_0xa1e6('0x5e')]['findAll']({'attributes':['id',_0xa1e6('0x53')],'include':[{'model':db['CmList'],'as':_0xa1e6('0x55'),'where':{'id':LISTID}}]})[_0xa1e6('0x2f')](function(_0x5ac34f){var _0x52eb9a=[];if(_0x5ac34f){for(var _0x2d0289=0x0,_0x37bd87;_0x2d0289<_0x5ac34f[_0xa1e6('0x19')];_0x2d0289+=0x1){_0x37bd87=_0x5ac34f[_0x2d0289][_0xa1e6('0x56')]({'plain':!![]});switch(_0x37bd87[_0xa1e6('0x53')]){case _0xa1e6('0x57'):_0x52eb9a[_0xa1e6('0x58')](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x37e1f6(_0x37bd87,_0xa1e6('0x5f')))['then'](function(){})[_0xa1e6('0x31')](_0x1f305b()));break;case _0xa1e6('0x60'):_0x52eb9a['push'](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x2821f6(_0x37bd87,_0xa1e6('0x5f')))[_0xa1e6('0x2f')](function(){})['catch'](_0x1f305b()));break;default:_0x52eb9a['push'](db[_0xa1e6('0x5b')]['query'](_0x3bc961(_0x37bd87,'CampaignId'))[_0xa1e6('0x2f')](function(){})['catch'](_0x1f305b()));}}}return _0x52eb9a;})[_0xa1e6('0x5c')]();})['then'](function(){return db['Campaign'][_0xa1e6('0x51')]({'attributes':['id'],'include':[{'model':db[_0xa1e6('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa1e6('0x2f')](function(_0x4104a8){var _0x203c70=[];if(_0x4104a8){for(var _0x208ea9=0x0,_0xbca4f;_0x208ea9<_0x4104a8['length'];_0x208ea9+=0x1){_0xbca4f=_0x4104a8[_0x208ea9][_0xa1e6('0x56')]({'plain':!![]});_0x203c70[_0xa1e6('0x58')](db[_0xa1e6('0x5b')][_0xa1e6('0x59')](_0x303398(_0xbca4f,_0xa1e6('0x5f')))['then'](function(){})['catch'](_0x1f305b()));}}return _0x203c70;})[_0xa1e6('0x5c')]();})[_0xa1e6('0x31')](function(_0x39ff87){logger[_0xa1e6('0x16')]('cmContact,\x20%s,\x20%s',_0xa1e6('0x61'),_0x39ff87[_0xa1e6('0x1b')]);});}var processPromises=function(_0x59cea2){return BPromise[_0xa1e6('0x5c')](promises)[_0xa1e6('0x2f')](function(_0x22abd4){})[_0xa1e6('0x31')](function(_0x231b02){logger[_0xa1e6('0x16')](_0xa1e6('0x62'),JSON['stringify'](_0x231b02));})['finally'](function(){socket[_0xa1e6('0x63')](_0xa1e6('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x59cea2){return _0x59cea2['resume']();}});};var endCsv=function(){return BPromise[_0xa1e6('0x65')]()[_0xa1e6('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0xa1e6('0x2f')](function(){socket[_0xa1e6('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2a90e5){logger[_0xa1e6('0x16')](_0xa1e6('0x66'),JSON['stringify'](_0x2a90e5));}finally{process[_0xa1e6('0x67')](0x0);}});};process['on'](_0xa1e6('0x68'),function(){logger['info'](_0xa1e6('0x69'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa1e6('0x10')](',');return db[_0xa1e6('0x2c')][_0xa1e6('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa1e6('0x2f')](function(_0x55653f){var _0x52166e=fs[_0xa1e6('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x52166e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c612a,_0x48894a){total+=0x1;var _0x1b1e90=total;promises[_0xa1e6('0x58')](checkRow(_0x5c612a,_0x55653f,_0x1b1e90)[_0xa1e6('0x2f')](function(){success+=0x1;})['catch'](function(_0x38bc99){if(_0x38bc99[_0xa1e6('0x16')]){errors+=0x1;delete _0x38bc99[_0xa1e6('0x16')];}else if(_0x38bc99['duplicate']){duplicates+=0x1;delete _0x38bc99[_0xa1e6('0x2a')];}rows[_0xa1e6('0x58')](_0x38bc99);}));if(total%0xc8===0x0){_0x48894a[_0xa1e6('0x6b')]();return processPromises(_0x48894a);}},'complete':function(){return processPromises()[_0xa1e6('0x2f')](function(){logger[_0xa1e6('0x6c')](_0xa1e6('0x6d'));endCsv();});},'error':function(_0x5323b9,_0x5abd41){logger[_0xa1e6('0x6c')](_0xa1e6('0x6e'),JSON['stringify'](_0x5323b9));endCsv();}});})[_0xa1e6('0x31')](function(_0x4d6623){logger[_0xa1e6('0x16')](_0xa1e6('0x6f'),JSON[_0xa1e6('0x33')](_0x4d6623));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7db7074..5bf49aa 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 _0xd93a=['papaparse','util','bluebird','moment','squel','../../../config/environment/shared','import','redis','localhost','socket.io-emitter','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','ListId','updatedAt','cm_contacts','ListId\x20=\x20?','cm_contacts.id','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','errors','code','message','query','spread','push','catch','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','length','all','then','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','set','send','start','root','.csv','keys','includes',',utcOffset','writeFileSync','parse','createReadStream','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','affectedRows','unlink','exit','complete','argv','server/files/tmp','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash'];(function(_0x393c24,_0x29c062){var _0x273e83=function(_0x239f61){while(--_0x239f61){_0x393c24['push'](_0x393c24['shift']());}};_0x273e83(++_0x29c062);}(_0xd93a,0x130));var _0xad93=function(_0x4c7e55,_0x3748c8){_0x4c7e55=_0x4c7e55-0x0;var _0x320a2a=_0xd93a[_0x4c7e55];return _0x320a2a;};'use strict';var fs=require('fs');var path=require(_0xad93('0x0'));var _=require(_0xad93('0x1'));var Papa=require(_0xad93('0x2'));var util=require(_0xad93('0x3'));var BPromise=require(_0xad93('0x4'));var moment=require(_0xad93('0x5'));var squel=require(_0xad93('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0xad93('0x7'));var logger=require('../../../config/logger')(_0xad93('0x8'));config[_0xad93('0x9')]=_['defaults'](config['redis'],{'host':_0xad93('0xa'),'port':0x18eb});var socket=require(_0xad93('0xb'))(new Redis(config[_0xad93('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2d89a3){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'](_0x2d89a3);}function selectNotIn(_0x129b8f,_0x1dfda2,_0x21f404,_0x3d7b48,_0x5853b0){return squel[_0xad93('0xc')]()[_0xad93('0xd')](_0xad93('0xe'))[_0xad93('0xf')](_0x3d7b48)[_0xad93('0x10')](_0x1dfda2,null,_0x1dfda2+_0xad93('0x11')+_0x3d7b48+'.'+_0x21f404)[_0xad93('0x12')](_0x3d7b48+'.'+_0x21f404+'\x20=\x20'+_0x129b8f+'.'+_0x21f404)[_0xad93('0x12')](_0x1dfda2+_0xad93('0x13')+_0x5853b0[_0xad93('0x10')]()+')');}function insertCmHopper(_0x200b9d,_0x727cf7,_0xa3cb6e,_0x56f956,_0x5a6869){var _0x3662de=[_0xad93('0x14'),_0xad93('0x15'),'cm_contacts.id',_0xad93('0x16'),_0x727cf7+'.'+_0x56f956,'cm_contacts.createdAt',_0xad93('0x17'),_0xad93('0x18'),_0xad93('0x19'),'\x22'+_0x5a6869+'\x22'];return squel[_0xad93('0x1a')]()[_0xad93('0x1b')](_0xad93('0x1c'))[_0xad93('0x1d')]([_0xad93('0xe'),_0xad93('0x1e'),_0xad93('0x1f'),'ListId',_0x56f956,_0xad93('0x20'),'updatedAt',_0xad93('0x21'),_0xad93('0x22'),_0xad93('0x23')],squel[_0xad93('0xc')]()[_0xad93('0x24')](_0x3662de)['from'](_0x727cf7)['join']('cm_contacts',null,_0xad93('0x25')+_0x727cf7+_0xad93('0x26'))['join'](_0xa3cb6e,null,_0xa3cb6e+_0xad93('0x11')+_0x727cf7+'.'+_0x56f956)[_0xad93('0x12')](_0x727cf7+_0xad93('0x27'),_0x200b9d)[_0xad93('0x12')](_0xad93('0x28'),NOW)['where'](_0xad93('0x29'),selectNotIn(_0x727cf7,_0xa3cb6e,_0x56f956,'cm_hopper',[_0xad93('0x2a'),_0xad93('0x2b')]))[_0xad93('0x12')](_0xad93('0x29'),selectNotIn(_0x727cf7,_0xa3cb6e,_0x56f956,_0xad93('0x1c'),['\x22always\x22'])))[_0xad93('0x2c')]();}function insertCmHopperBlack(_0x577f7e,_0x170c4b,_0x258ee9,_0xe6f367){var _0x48d7f5=[_0xad93('0x14'),'cm_contacts.id',_0xad93('0x16'),_0x170c4b+'.'+_0xe6f367,_0xad93('0x2d'),_0xad93('0x17')];return squel[_0xad93('0x1a')]()[_0xad93('0x1b')](_0xad93('0x2e'))[_0xad93('0x1d')](['phone',_0xad93('0x1f'),_0xad93('0x2f'),_0xe6f367,_0xad93('0x20'),_0xad93('0x30')],squel[_0xad93('0xc')]()['fields'](_0x48d7f5)['from'](_0x170c4b)[_0xad93('0x10')](_0xad93('0x31'),null,_0xad93('0x25')+_0x170c4b+_0xad93('0x26'))['join'](_0x258ee9,null,_0x258ee9+'.id\x20=\x20'+_0x170c4b+'.'+_0xe6f367)['where'](_0x170c4b+'.CmListId\x20=\x20?',_0x577f7e)['where'](_0xad93('0x28'),NOW)['where'](_0xad93('0x29'),squel['select']()[_0xad93('0xd')](_0xad93('0xe'))[_0xad93('0xf')](_0xad93('0x2e'))['where'](_0xad93('0x32'),_0x577f7e)['where'](_0xe6f367+'\x20=\x20?',_0x170c4b+'.'+_0xe6f367)))[_0xad93('0x2c')]();}function insertTzCmHopper(_0x44604c,_0x59cf60,_0x66fc99,_0x354726,_0xf203b8,_0x3d0b42){var _0x2e8ceb=[_0xad93('0x14'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x3d0b42+'.offset-cm_contacts.utcOffset\x20minute)',_0xad93('0x33'),_0xad93('0x16'),_0x59cf60+'.'+_0x354726,'cm_contacts.createdAt',_0xad93('0x17'),_0xad93('0x18'),_0xad93('0x19'),'\x22'+_0xf203b8+'\x22'];var _0x46d07c=squel[_0xad93('0x1a')]()[_0xad93('0x1b')](_0xad93('0x1c'))[_0xad93('0x1d')](['phone',_0xad93('0x1e'),_0xad93('0x1f'),_0xad93('0x2f'),_0x354726,_0xad93('0x20'),_0xad93('0x30'),'priority',_0xad93('0x22'),_0xad93('0x23')],squel['select']()[_0xad93('0x24')](_0x2e8ceb)[_0xad93('0xf')](_0x59cf60)[_0xad93('0x10')](_0xad93('0x31'),null,_0xad93('0x25')+_0x59cf60+_0xad93('0x26'))['join'](_0x66fc99,null,_0x66fc99+_0xad93('0x11')+_0x59cf60+'.'+_0x354726)[_0xad93('0x10')](_0x3d0b42,null,_0x3d0b42+_0xad93('0x11')+_0x59cf60+'.'+_0x354726)['where'](_0x59cf60+_0xad93('0x27'),_0x44604c)[_0xad93('0x12')](_0xad93('0x28'),NOW)[_0xad93('0x12')](_0xad93('0x29'),selectNotIn(_0x59cf60,_0x66fc99,_0x354726,_0xad93('0x1c'),[_0xad93('0x2a'),_0xad93('0x2b')]))[_0xad93('0x12')](_0xad93('0x29'),selectNotIn(_0x59cf60,_0x66fc99,_0x354726,_0xad93('0x1c'),['\x22always\x22'])))[_0xad93('0x2c')]();return _0x46d07c;}function insertTzCmHopperBlack(_0x124b77,_0x259a02,_0x187dc5,_0x5044f6){var _0x5a9a7b=[_0xad93('0x14'),'cm_contacts.id',_0xad93('0x16'),_0x259a02+'.'+_0x5044f6,_0xad93('0x2d'),'cm_contacts.updatedAt'];return squel[_0xad93('0x1a')]()[_0xad93('0x1b')](_0xad93('0x2e'))['fromQuery']([_0xad93('0xe'),_0xad93('0x1f'),_0xad93('0x2f'),_0x5044f6,_0xad93('0x20'),_0xad93('0x30')],squel[_0xad93('0xc')]()[_0xad93('0x24')](_0x5a9a7b)['from'](_0x259a02)[_0xad93('0x10')](_0xad93('0x31'),null,_0xad93('0x25')+_0x259a02+_0xad93('0x26'))['join'](_0x187dc5,null,_0x187dc5+_0xad93('0x11')+_0x259a02+'.'+_0x5044f6)[_0xad93('0x12')](_0x259a02+'.CmListId\x20=\x20?',_0x124b77)['where'](_0xad93('0x28'),NOW)[_0xad93('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xad93('0xd')](_0xad93('0xe'))[_0xad93('0xf')](_0xad93('0x2e'))[_0xad93('0x12')](_0xad93('0x32'),_0x124b77)[_0xad93('0x12')](_0x5044f6+_0xad93('0x34'),_0x259a02+'.'+_0x5044f6)))['toString']();}function insertCmContact(_0x328181,_0x5e4845,_0x275890,_0x2661dc){var _0x564bd0=_[_0xad93('0x35')](_['keys'](_0x2661dc),[_0xad93('0x2f'),_0xad93('0x36'),'createdAt',_0xad93('0x30')]);return squel['insert']()[_0xad93('0x1b')]('cm_contacts')[_0xad93('0x1d')](_0x564bd0,squel[_0xad93('0xc')]()[_0xad93('0x24')](_0x564bd0)['from'](_0x5e4845)[_0xad93('0x12')]('('+_0x275890[_0xad93('0x10')](',')+_0xad93('0x37'),squel[_0xad93('0xc')]()[_0xad93('0x24')](_0x275890)['from'](_0xad93('0x31'))[_0xad93('0x12')](_0xad93('0x32'),_0x328181)[_0xad93('0x12')](_0xad93('0x38')))[_0xad93('0x12')](_0xad93('0x39'),squel[_0xad93('0xc')]()[_0xad93('0xd')](_0xad93('0x3a'),_0xad93('0x3b'))['from'](_0x5e4845)[_0xad93('0x3c')](_0x275890[_0xad93('0x10')](','))))[_0xad93('0x2c')]();}function handleStop(){logger[_0xad93('0x3d')](_0xad93('0x3e'));stopped=!![];}function handleUncaughtException(_0x2ced6a){logger[_0xad93('0x3f')](_0x2ced6a['message']);process['exit'](0x1);}function handleError(_0x610348,_0x59c104){stats[_0xad93('0x40')]['push']({'name':_0x59c104[_0xad93('0x41')],'message':_0x59c104[_0xad93('0x42')],'row':_0x610348});}function handleQuery(_0x91832c){logger[_0xad93('0x3d')](_0x91832c);return db['sequelize'][_0xad93('0x43')](_0x91832c)[_0xad93('0x44')](function(_0x3cb0b8){results[_0xad93('0x45')](_0x3cb0b8);})[_0xad93('0x46')](function(_0x763e08){logger[_0xad93('0x3f')](_0x763e08[_0xad93('0x42')]);});}function updateTzCampaigns(_0x129b9b){return new Promise(function(_0x5e1877,_0x13f3ec){var _0x205973=squel[_0xad93('0xc')]()[_0xad93('0x24')](['campaigns.id','campaigns.dialTimezone'])[_0xad93('0xf')](_0xad93('0x47'))[_0xad93('0x10')](_0xad93('0x48'),null,_0xad93('0x49'))['where'](_0xad93('0x4a')+_0x129b9b);db[_0xad93('0x4b')][_0xad93('0x43')](_0x205973[_0xad93('0x2c')]())['spread'](function(_0x17eafb){var _0x4d4b51=[];for(var _0xf06be=0x0;_0xf06be<_0x17eafb[_0xad93('0x4c')];_0xf06be++){_0x4d4b51[_0xad93('0x45')](getTimezoneData(_0x17eafb[_0xf06be],tmp_campaigns));}BPromise[_0xad93('0x4d')](_0x4d4b51)[_0xad93('0x4e')](function(){_0x5e1877({'val':0x1});});})[_0xad93('0x46')](function(_0x59c29a){logger['error'](_0x59c29a[_0xad93('0x42')]);_0x5e1877({'val':0x0});});});}function updateTzVoiceQueues(_0x35dc38){return new Promise(function(_0x2aaf1d,_0x175826){var _0x363cb7=squel['select']()[_0xad93('0x24')](['voice_queues.id','voice_queues.dialTimezone'])['from'](_0xad93('0x4f'))[_0xad93('0x10')](_0xad93('0x50'),null,_0xad93('0x51'))[_0xad93('0x12')](_0xad93('0x52')+_0x35dc38);db['sequelize'][_0xad93('0x43')](_0x363cb7[_0xad93('0x2c')]())[_0xad93('0x44')](function(_0x329683){var _0x11c8b1=[];for(var _0x1a06d8=0x0;_0x1a06d8<_0x329683[_0xad93('0x4c')];_0x1a06d8++){_0x11c8b1[_0xad93('0x45')](getTimezoneData(_0x329683[_0x1a06d8],tmp_voice_queues));}BPromise[_0xad93('0x4d')](_0x11c8b1)[_0xad93('0x4e')](function(){_0x2aaf1d({'val':0x1});});})[_0xad93('0x46')](function(_0xe9275f){logger['error'](_0xe9275f[_0xad93('0x42')]);_0x2aaf1d({'val':0x0});});});}function getTimezoneData(_0x1acad7,_0x4b6e5d){return new Promise(function(_0x3a2aa3,_0x483e54){var _0xe29e3d=shared[_0xad93('0x53')];var _0x4573f9=_0xe29e3d[_0x1acad7[_0xad93('0x54')]];if(_[_0xad93('0x55')](_0x4573f9)){_0x3a2aa3({'ret':0x1});}else{var _0x394897=_0x4573f9['utcOffset'];var _0x24d4e9=squel[_0xad93('0x1a')]()[_0xad93('0x1b')](_0x4b6e5d)[_0xad93('0x56')]('id',_0x1acad7['id'])['set']('offset',_0x394897)[_0xad93('0x56')](_0xad93('0x54'),_0x1acad7['dialTimezone'])['toString']();return db[_0xad93('0x4b')][_0xad93('0x43')](_0x24d4e9)[_0xad93('0x44')](function(_0x57168d){_0x3a2aa3({'ret':0x1});})[_0xad93('0x46')](function(_0x229df8){logger[_0xad93('0x3f')](_0x229df8[_0xad93('0x42')]);_0x483e54({'ret':0x1});});}});}function handleTZQuery(_0x377ea0){logger[_0xad93('0x3d')](_0x377ea0);return db[_0xad93('0x4b')][_0xad93('0x43')](_0x377ea0)[_0xad93('0x44')](function(_0x300be1){})[_0xad93('0x46')](function(_0x2c4f48){logger[_0xad93('0x3f')](_0x2c4f48[_0xad93('0x42')]);});}function main(_0x4cf1f0,_0x1ecade,_0x29dff3,_0x523876){logger[_0xad93('0x3d')]('main',_0x4cf1f0,JSON['stringify'](_0x1ecade));process[_0xad93('0x57')](_0xad93('0x58'));var _0xe821d5=_0x1ecade['binding'];var _0x13bfe4=_0x1ecade['socket_timestamp'];var _0x338f1c=path[_0xad93('0x10')](config[_0xad93('0x59')],'server/files/tmp',_0x13bfe4+_0xad93('0x5a'));hasTZ=_[_0xad93('0x5b')](_0xe821d5)[_0xad93('0x5c')](_0xad93('0x54'));var _0x18c7c0=_[_0xad93('0x5b')](_0xe821d5)[_0xad93('0x10')]();logger[_0xad93('0x3d')]('header',_0x18c7c0);if(hasTZ)_0x18c7c0+=_0xad93('0x5d');fs[_0xad93('0x5e')](_0x338f1c,_0x18c7c0+'\x0a');Papa[_0xad93('0x5f')](fs[_0xad93('0x60')](_0x4cf1f0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d2042,_0x279d4d){try{for(var _0x3e1395=0x0,_0x5cb65f=[];_0x3e1395<_0x5d2042['data'][_0xad93('0x4c')];_0x3e1395++){stats[_0xad93('0x61')]+=0x1;if(_0x5d2042[_0xad93('0x40')][_0x3e1395]){handleError(_0x5d2042[_0xad93('0x62')][_0x3e1395],_0x5d2042[_0xad93('0x40')][_0x3e1395]);}else{var _0x5e75fc=[];for(var _0x537ae5 in _0xe821d5){if(_0xe821d5[_0xad93('0x63')](_0x537ae5)){if(_0x5d2042[_0xad93('0x62')][_0x3e1395][_0xe821d5[_0x537ae5]]){var _0x420117=_[_0xad93('0x64')](_0x5d2042[_0xad93('0x62')][_0x3e1395][_0xe821d5[_0x537ae5]][_0xad93('0x65')](/"/g,'\x27'));switch(_0x537ae5){case _0xad93('0x1e'):var _0x548db9=moment(_0x420117,_0xad93('0x66'),!![]);if(_0x548db9[_0xad93('0x67')]()){_0x5cb65f['push']('\x22'+_0x420117+'\x22');}else{_0x5e75fc[_0xad93('0x45')](_0xad93('0x68'));}break;case _0xad93('0x21'):var _0xed96bd=parseInt(_0x420117);_0x420117=_[_0xad93('0x69')](_0xed96bd)||_0xed96bd<0x0||_0xed96bd>0x4?_0x523876?0x3:0x2:_0xed96bd;_0x5cb65f[_0xad93('0x45')]('\x22'+_0x420117+'\x22');break;case _0xad93('0x22'):var _0x3fefa0=parseInt(_0x420117);if(_['isNumber'](_0x3fefa0)&&_[_0xad93('0x5c')](_0x29dff3,_0x3fefa0)){_0x5cb65f[_0xad93('0x45')]('\x22'+_0x3fefa0+'\x22');}else{_0x5e75fc['push'](_0xad93('0x6a'));}break;case _0xad93('0x6b'):if(isEmail(_0x420117)){_0x5cb65f[_0xad93('0x45')]('\x22'+_0x420117+'\x22');}else{_0x5e75fc['push'](_0xad93('0x6c'));}break;case _0xad93('0x6d'):var _0x25a524=moment(_0x420117,_0xad93('0x6e'),!![]);if(_0x25a524[_0xad93('0x67')]()){_0x5cb65f[_0xad93('0x45')]('\x22'+_0x420117+'\x22');}else{_0x5e75fc[_0xad93('0x45')](_0xad93('0x6f'));}break;case _0xad93('0x54'):var _0x1ee9f8=shared[_0xad93('0x53')];var _0x4c5448=_0x1ee9f8[_0x420117];if(!_[_0xad93('0x55')](_0x4c5448)){var _0x512277=_0x4c5448['utcOffset'];_0x5cb65f['push']('\x22'+_0x420117+'\x22');_0x5cb65f['push']('\x22'+_0x512277+'\x22');}break;default:_0x5cb65f['push']('\x22'+_0x420117+'\x22');}}else{switch(_0x537ae5){case _0xad93('0x70'):case _0xad93('0xe'):_0x5e75fc[_0xad93('0x45')](_0x537ae5+_0xad93('0x71'));break;default:_0x5cb65f['push']('\x22\x22');}}}}if(_0x5e75fc[_0xad93('0x4c')]){handleError(_0x5d2042[_0xad93('0x62')][_0x3e1395],{'code':_0xad93('0x72'),'message':_0x5e75fc[_0xad93('0x10')]()});}else{fs[_0xad93('0x73')](_0x338f1c,_0x5cb65f[_0xad93('0x10')]()+'\x0a');}_0x5cb65f=[];}if(!(stats[_0xad93('0x61')]%0xc8)){socket[_0xad93('0x74')](_0xad93('0x75')+_0x13bfe4,stats);stats[_0xad93('0x40')]=[];}}if(stopped){logger['info'](_0xad93('0x76'));_0x279d4d[_0xad93('0x77')]();}}catch(_0x2b5555){handleError(_0x5d2042['data'][_0x3e1395],{'code':_0xad93('0x78'),'message':_0x2b5555[_0xad93('0x42')]});logger['error'](_0xad93('0x79'),_0x2b5555[_0xad93('0x42')]);}},'complete':function(){try{var _0x13a354=[];var _0x15ba8f=[];var _0x183da2=_0xad93('0x31');if(_0x1ecade[_0xad93('0x7a')]&&_0x1ecade[_0xad93('0x7a')][_0xad93('0x4c')]){_0x183da2=_0xad93('0x7b')+_0x13bfe4;_0x13a354['push'](_0xad93('0x7c')+_0x183da2+_0xad93('0x7d'));}tmp_campaigns=_0xad93('0x7e')+_0x13bfe4;tmp_voice_queues=_0xad93('0x7f')+_0x13bfe4;_0x15ba8f[_0xad93('0x45')](_0xad93('0x7c')+tmp_campaigns+_0xad93('0x80'));_0x15ba8f[_0xad93('0x45')](_0xad93('0x7c')+tmp_voice_queues+_0xad93('0x80'));BPromise[_0xad93('0x81')](_0x15ba8f,handleTZQuery)[_0xad93('0x4e')](function(_0x3cc52e){updateTzCampaigns(_0x1ecade[_0xad93('0x2f')])['then'](function(_0x24f9b3){updateTzVoiceQueues(_0x1ecade[_0xad93('0x2f')])['then'](function(_0x1ab64e){var _0x31b7d2=util[_0xad93('0x82')](_0xad93('0x83'),_0x338f1c,_0x183da2,_0x18c7c0,_0x1ecade[_0xad93('0x2f')],_0x1ecade[_0xad93('0x36')]||null,NOW,NOW);if(_['isNil'](_0xe821d5[_0xad93('0x1e')])){_0x31b7d2+=_0xad93('0x84');}_0x13a354['push'](_0x31b7d2);if(_0x1ecade[_0xad93('0x7a')]&&_0x1ecade[_0xad93('0x7a')]['length']){_0x13a354[_0xad93('0x45')](insertCmContact(_0x1ecade[_0xad93('0x2f')],_0x183da2,_0x1ecade[_0xad93('0x7a')],_0xe821d5));_0x13a354['push'](_0xad93('0x85')+_0x183da2+';');}if(hasTZ){_0x13a354[_0xad93('0x45')](insertTzCmHopper(_0x1ecade['ListId'],'voice_queues_has_cm_lists',_0xad93('0x4f'),_0xad93('0x86'),_0x523876,tmp_voice_queues));_0x13a354[_0xad93('0x45')](insertTzCmHopperBlack(_0x1ecade[_0xad93('0x2f')],_0xad93('0x87'),_0xad93('0x4f'),'VoiceQueueId'));_0x13a354[_0xad93('0x45')](insertTzCmHopper(_0x1ecade[_0xad93('0x2f')],_0xad93('0x48'),_0xad93('0x47'),'CampaignId',_0x523876,tmp_campaigns));_0x13a354[_0xad93('0x45')](insertTzCmHopperBlack(_0x1ecade['ListId'],_0xad93('0x88'),'campaigns',_0xad93('0x89')));}else{_0x13a354[_0xad93('0x45')](insertCmHopper(_0x1ecade[_0xad93('0x2f')],_0xad93('0x50'),_0xad93('0x4f'),'VoiceQueueId',_0x523876));_0x13a354['push'](insertCmHopperBlack(_0x1ecade[_0xad93('0x2f')],'voice_queues_has_cm_blacklists','voice_queues',_0xad93('0x86')));_0x13a354[_0xad93('0x45')](insertCmHopper(_0x1ecade[_0xad93('0x2f')],'campaigns_has_cm_lists','campaigns',_0xad93('0x89'),_0x523876));_0x13a354[_0xad93('0x45')](insertCmHopperBlack(_0x1ecade[_0xad93('0x2f')],_0xad93('0x88'),_0xad93('0x47'),_0xad93('0x89')));}_0x13a354['push'](_0xad93('0x85')+tmp_campaigns+';');_0x13a354[_0xad93('0x45')](_0xad93('0x85')+tmp_voice_queues+';');BPromise[_0xad93('0x81')](_0x13a354,handleQuery)[_0xad93('0x4e')](function(_0x5b4b16){stats['finish']=!![];stats[_0xad93('0x8a')]=_0x1ecade['duplicates']&&_0x1ecade[_0xad93('0x7a')][_0xad93('0x4c')]?results[0x2]['affectedRows']:results[0x0][_0xad93('0x8a')];socket[_0xad93('0x74')]('contact:import:'+_0x13bfe4,stats);fs[_0xad93('0x8b')](_0x4cf1f0);fs[_0xad93('0x8b')](_0x338f1c);process[_0xad93('0x8c')](0x0);})[_0xad93('0x46')](function(_0x37a14a){logger['error'](_0x37a14a[_0xad93('0x42')]);process[_0xad93('0x8c')](0x1);});});});});}catch(_0x11d3de){logger['error'](_0xad93('0x8d'),_0x11d3de[_0xad93('0x42')]);process[_0xad93('0x8c')](0x1);}},'error':function(_0x3a3548,_0x189293,_0x113bbb,_0x1e1936){throw new Error(_0x1e1936);}});}function validate(){if(process[_0xad93('0x8e')]&&process[_0xad93('0x8e')][_0xad93('0x4c')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x2e6c3b=path[_0xad93('0x10')](config['root'],_0xad93('0x8f'),process[_0xad93('0x8e')][0x2]);if(!fs['existsSync'](_0x2e6c3b)){throw new Error(_0xad93('0x90'));}var _0x1c738c={};try{_0x1c738c=JSON[_0xad93('0x5f')](process['argv'][0x3]);if(!_0x1c738c[_0xad93('0x91')]){throw new Error(_0xad93('0x92'));}if(!_0x1c738c['binding'][_0xad93('0xe')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x1c738c[_0xad93('0x91')][_0xad93('0x70')]){throw new Error(_0xad93('0x93'));}var _0x1958ea=0x0;if(_0x1c738c[_0xad93('0x91')][_0xad93('0x22')]){_0x1958ea=0x1;}if(!_0x1c738c[_0xad93('0x2f')]){throw new Error(_0xad93('0x94'));}}catch(_0x12c8cd){throw new Error('body\x20id\x20mandatory');}var _0x215fd4=[];try{_0x215fd4=_[_0xad93('0x95')](JSON[_0xad93('0x5f')](process[_0xad93('0x8e')][0x4]),'id');}catch(_0x2abfcf){logger[_0xad93('0x3d')](_0xad93('0x96'));}main(_0x2e6c3b,_0x1c738c,_0x215fd4,_0x1958ea);}validate();process['on'](_0xad93('0x97'),handleStop);process['on'](_0xad93('0x98'),handleUncaughtException); \ No newline at end of file +var _0x070e=['abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','format',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','into','fromQuery','scheduledat','ListId','createdAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','ContactId','updatedAt','fields','from','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','cm_contacts.priority','UserId','.CmListId','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','info','error','message','exit','errors','push','code','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','length','all','then','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','query','timezones','isNil','utcOffset','offset','dialTimezone','stringify','start','binding','socket_timestamp','root','server/files/tmp','includes','keys','header','parse','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','emit','contact:import:'];(function(_0x3f535e,_0x5d0e9e){var _0x44ba5a=function(_0x2b1efa){while(--_0x2b1efa){_0x3f535e['push'](_0x3f535e['shift']());}};_0x44ba5a(++_0x5d0e9e);}(_0x070e,0x147));var _0xe070=function(_0x2e0001,_0x5b9571){_0x2e0001=_0x2e0001-0x0;var _0x448985=_0x070e[_0x2e0001];return _0x448985;};'use strict';var fs=require('fs');var path=require(_0xe070('0x0'));var _=require(_0xe070('0x1'));var Papa=require(_0xe070('0x2'));var util=require(_0xe070('0x3'));var BPromise=require(_0xe070('0x4'));var moment=require(_0xe070('0x5'));var squel=require(_0xe070('0x6'));var Redis=require(_0xe070('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0xe070('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0xe070('0x9'))(_0xe070('0xa'));config[_0xe070('0xb')]=_[_0xe070('0xc')](config[_0xe070('0xb')],{'host':_0xe070('0xd'),'port':0x18eb});var socket=require(_0xe070('0xe'))(new Redis(config[_0xe070('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xe070('0xf'));function isEmail(_0x15f0b4){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))*$/[_0xe070('0x10')](_0x15f0b4);}function selectNotIn(_0x5005e4,_0x54fc55,_0x2c8391,_0x285d35,_0x5e28ba){return squel[_0xe070('0x11')]()[_0xe070('0x12')](_0xe070('0x13'))['from'](_0x285d35)[_0xe070('0x14')](_0x54fc55,null,_0x54fc55+_0xe070('0x15')+_0x285d35+'.'+_0x2c8391)[_0xe070('0x16')](_0x285d35+'.'+_0x2c8391+_0xe070('0x17')+_0x5005e4+'.'+_0x2c8391)[_0xe070('0x16')](_0x54fc55+_0xe070('0x18')+_0x5e28ba[_0xe070('0x14')]()+')');}function insertCmHopper(_0x3c5868,_0x5ba628,_0x169916,_0x4e5d54,_0x45d2d8){var _0x2079ce=[_0xe070('0x19'),_0xe070('0x1a'),_0xe070('0x1b'),'cm_contacts.ListId',_0x5ba628+'.'+_0x4e5d54,_0xe070('0x1c'),_0xe070('0x1d'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x45d2d8+'\x22'];return squel['insert']()[_0xe070('0x1e')]('cm_hopper')[_0xe070('0x1f')]([_0xe070('0x13'),_0xe070('0x20'),'ContactId',_0xe070('0x21'),_0x4e5d54,_0xe070('0x22'),'updatedAt',_0xe070('0x23'),'UserId',_0xe070('0x24')],squel[_0xe070('0x11')]()['fields'](_0x2079ce)['from'](_0x5ba628)[_0xe070('0x14')](_0xe070('0x25'),null,_0xe070('0x26')+_0x5ba628+'.CmListId')[_0xe070('0x14')](_0x169916,null,_0x169916+'.id\x20=\x20'+_0x5ba628+'.'+_0x4e5d54)['where'](_0x5ba628+_0xe070('0x27'),_0x3c5868)[_0xe070('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe070('0x16')](_0xe070('0x28'),selectNotIn(_0x5ba628,_0x169916,_0x4e5d54,_0xe070('0x29'),[_0xe070('0x2a'),_0xe070('0x2b')]))[_0xe070('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5ba628,_0x169916,_0x4e5d54,_0xe070('0x29'),['\x22always\x22'])))[_0xe070('0x2c')]();}function insertCmHopperBlack(_0x2ae115,_0x109823,_0x571ba8,_0x52fd93){var _0x5e2727=[_0xe070('0x19'),_0xe070('0x1b'),'cm_contacts.ListId',_0x109823+'.'+_0x52fd93,_0xe070('0x1c'),_0xe070('0x1d')];return squel[_0xe070('0x2d')]()[_0xe070('0x1e')](_0xe070('0x2e'))[_0xe070('0x1f')](['phone',_0xe070('0x2f'),_0xe070('0x21'),_0x52fd93,_0xe070('0x22'),_0xe070('0x30')],squel[_0xe070('0x11')]()[_0xe070('0x31')](_0x5e2727)[_0xe070('0x32')](_0x109823)[_0xe070('0x14')](_0xe070('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x109823+'.CmListId')[_0xe070('0x14')](_0x571ba8,null,_0x571ba8+_0xe070('0x15')+_0x109823+'.'+_0x52fd93)[_0xe070('0x16')](_0x109823+_0xe070('0x27'),_0x2ae115)[_0xe070('0x16')](_0xe070('0x33'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xe070('0x11')]()['field']('phone')[_0xe070('0x32')](_0xe070('0x2e'))[_0xe070('0x16')](_0xe070('0x34'),_0x2ae115)['where'](_0x52fd93+'\x20=\x20?',_0x109823+'.'+_0x52fd93)))['toString']();}function insertTzCmHopper(_0x4e91fe,_0x1ae5c5,_0x4e75e0,_0x12cad4,_0x4746cb,_0x3fe2c5){var _0x275e43=[_0xe070('0x19'),_0xe070('0x35')+_0x3fe2c5+_0xe070('0x36'),_0xe070('0x1b'),_0xe070('0x37'),_0x1ae5c5+'.'+_0x12cad4,_0xe070('0x1c'),_0xe070('0x1d'),_0xe070('0x38'),'cm_contacts.UserId','\x22'+_0x4746cb+'\x22'];var _0x5e3b9b=squel[_0xe070('0x2d')]()['into'](_0xe070('0x29'))[_0xe070('0x1f')]([_0xe070('0x13'),_0xe070('0x20'),'ContactId',_0xe070('0x21'),_0x12cad4,_0xe070('0x22'),_0xe070('0x30'),'priority',_0xe070('0x39'),_0xe070('0x24')],squel['select']()[_0xe070('0x31')](_0x275e43)[_0xe070('0x32')](_0x1ae5c5)['join']('cm_contacts',null,_0xe070('0x26')+_0x1ae5c5+_0xe070('0x3a'))[_0xe070('0x14')](_0x4e75e0,null,_0x4e75e0+_0xe070('0x15')+_0x1ae5c5+'.'+_0x12cad4)[_0xe070('0x14')](_0x3fe2c5,null,_0x3fe2c5+_0xe070('0x15')+_0x1ae5c5+'.'+_0x12cad4)[_0xe070('0x16')](_0x1ae5c5+_0xe070('0x27'),_0x4e91fe)[_0xe070('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe070('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1ae5c5,_0x4e75e0,_0x12cad4,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0xe070('0x28'),selectNotIn(_0x1ae5c5,_0x4e75e0,_0x12cad4,_0xe070('0x29'),[_0xe070('0x2a')])))[_0xe070('0x2c')]();return _0x5e3b9b;}function insertTzCmHopperBlack(_0x49e5ac,_0x560ec6,_0x102a31,_0x2910f7){var _0x4427bb=['cm_contacts.phone',_0xe070('0x1b'),_0xe070('0x37'),_0x560ec6+'.'+_0x2910f7,_0xe070('0x1c'),_0xe070('0x1d')];return squel[_0xe070('0x2d')]()[_0xe070('0x1e')](_0xe070('0x2e'))[_0xe070('0x1f')]([_0xe070('0x13'),_0xe070('0x2f'),_0xe070('0x21'),_0x2910f7,_0xe070('0x22'),_0xe070('0x30')],squel[_0xe070('0x11')]()[_0xe070('0x31')](_0x4427bb)[_0xe070('0x32')](_0x560ec6)['join']('cm_contacts',null,_0xe070('0x26')+_0x560ec6+_0xe070('0x3a'))[_0xe070('0x14')](_0x102a31,null,_0x102a31+'.id\x20=\x20'+_0x560ec6+'.'+_0x2910f7)['where'](_0x560ec6+_0xe070('0x27'),_0x49e5ac)[_0xe070('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xe070('0x28'),squel[_0xe070('0x11')]()[_0xe070('0x12')](_0xe070('0x13'))[_0xe070('0x32')](_0xe070('0x2e'))['where']('ListId\x20=\x20?',_0x49e5ac)[_0xe070('0x16')](_0x2910f7+_0xe070('0x3b'),_0x560ec6+'.'+_0x2910f7)))[_0xe070('0x2c')]();}function insertCmContact(_0x3cff1f,_0x3754b0,_0x18391f,_0xd43fc3){var _0x489903=_[_0xe070('0x3c')](_['keys'](_0xd43fc3),['ListId',_0xe070('0x3d'),_0xe070('0x22'),'updatedAt']);return squel[_0xe070('0x2d')]()['into'](_0xe070('0x25'))[_0xe070('0x1f')](_0x489903,squel['select']()[_0xe070('0x31')](_0x489903)[_0xe070('0x32')](_0x3754b0)[_0xe070('0x16')]('('+_0x18391f[_0xe070('0x14')](',')+_0xe070('0x3e'),squel[_0xe070('0x11')]()['fields'](_0x18391f)[_0xe070('0x32')]('cm_contacts')[_0xe070('0x16')]('ListId\x20=\x20?',_0x3cff1f)[_0xe070('0x16')](_0xe070('0x3f')))[_0xe070('0x16')]('id\x20IN\x20?',squel['select']()[_0xe070('0x12')]('MIN(id)','min_id')['from'](_0x3754b0)['group'](_0x18391f[_0xe070('0x14')](','))))[_0xe070('0x2c')]();}function handleStop(){logger[_0xe070('0x40')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x13d164){logger[_0xe070('0x41')](_0x13d164[_0xe070('0x42')]);process[_0xe070('0x43')](0x1);}function handleError(_0x34555f,_0x4e2e99){stats[_0xe070('0x44')][_0xe070('0x45')]({'name':_0x4e2e99[_0xe070('0x46')],'message':_0x4e2e99[_0xe070('0x42')],'row':_0x34555f});}function handleQuery(_0x211b09){logger[_0xe070('0x40')](_0x211b09);return db[_0xe070('0x47')]['query'](_0x211b09)[_0xe070('0x48')](function(_0x2e4c63){results['push'](_0x2e4c63);})[_0xe070('0x49')](function(_0x1241ac){logger[_0xe070('0x41')](_0x1241ac[_0xe070('0x42')]);});}function updateTzCampaigns(_0x3c758a){return new Promise(function(_0x338a23,_0xa4e7c6){var _0x10479c=squel[_0xe070('0x11')]()[_0xe070('0x31')]([_0xe070('0x4a'),_0xe070('0x4b')])['from'](_0xe070('0x4c'))[_0xe070('0x14')](_0xe070('0x4d'),null,_0xe070('0x4e'))[_0xe070('0x16')]('campaigns_has_cm_lists.CmListId='+_0x3c758a);db[_0xe070('0x47')]['query'](_0x10479c[_0xe070('0x2c')]())[_0xe070('0x48')](function(_0x2cce93){var _0x23f901=[];for(var _0x40845b=0x0;_0x40845b<_0x2cce93[_0xe070('0x4f')];_0x40845b++){_0x23f901[_0xe070('0x45')](getTimezoneData(_0x2cce93[_0x40845b],tmp_campaigns));}BPromise[_0xe070('0x50')](_0x23f901)[_0xe070('0x51')](function(){_0x338a23({'val':0x1});});})['catch'](function(_0x4157cd){logger['error'](_0x4157cd['message']);_0x338a23({'val':0x0});});});}function updateTzVoiceQueues(_0x3dcbd5){return new Promise(function(_0x5a0a8e,_0x1154e4){var _0x16fd6d=squel[_0xe070('0x11')]()['fields'](['voice_queues.id','voice_queues.dialTimezone'])['from']('voice_queues')[_0xe070('0x14')](_0xe070('0x52'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0xe070('0x53')+_0x3dcbd5);db[_0xe070('0x47')][_0xe070('0x54')](_0x16fd6d['toString']())[_0xe070('0x48')](function(_0x2d5340){var _0x518757=[];for(var _0x2be20c=0x0;_0x2be20c<_0x2d5340['length'];_0x2be20c++){_0x518757[_0xe070('0x45')](getTimezoneData(_0x2d5340[_0x2be20c],tmp_voice_queues));}BPromise[_0xe070('0x50')](_0x518757)[_0xe070('0x51')](function(){_0x5a0a8e({'val':0x1});});})[_0xe070('0x49')](function(_0x5776f1){logger[_0xe070('0x41')](_0x5776f1[_0xe070('0x42')]);_0x5a0a8e({'val':0x0});});});}function getTimezoneData(_0x36eeb9,_0x3f4096){return new Promise(function(_0x1c6186,_0x185957){var _0x4c3055=shared[_0xe070('0x55')];var _0x53f327=_0x4c3055[_0x36eeb9['dialTimezone']];if(_[_0xe070('0x56')](_0x53f327)){_0x1c6186({'ret':0x1});}else{var _0x4d4fa6=_0x53f327[_0xe070('0x57')];var _0x1176e3=squel[_0xe070('0x2d')]()[_0xe070('0x1e')](_0x3f4096)['set']('id',_0x36eeb9['id'])['set'](_0xe070('0x58'),_0x4d4fa6)['set']('dialTimezone',_0x36eeb9[_0xe070('0x59')])[_0xe070('0x2c')]();return db['sequelize'][_0xe070('0x54')](_0x1176e3)[_0xe070('0x48')](function(_0x5990a9){_0x1c6186({'ret':0x1});})[_0xe070('0x49')](function(_0x4b5fe8){logger[_0xe070('0x41')](_0x4b5fe8['message']);_0x185957({'ret':0x1});});}});}function handleTZQuery(_0x5a4171){logger[_0xe070('0x40')](_0x5a4171);return db['sequelize'][_0xe070('0x54')](_0x5a4171)[_0xe070('0x48')](function(_0x3c7d3e){})[_0xe070('0x49')](function(_0x190aae){logger[_0xe070('0x41')](_0x190aae[_0xe070('0x42')]);});}function main(_0x102e0b,_0x8f8848,_0x33e2c2,_0x35828e){logger['info']('main',_0x102e0b,JSON[_0xe070('0x5a')](_0x8f8848));process['send'](_0xe070('0x5b'));var _0x551b66=_0x8f8848[_0xe070('0x5c')];var _0xdb13e1=_0x8f8848[_0xe070('0x5d')];var _0x2e408f=path[_0xe070('0x14')](config[_0xe070('0x5e')],_0xe070('0x5f'),_0xdb13e1+'.csv');hasTZ=_['keys'](_0x551b66)[_0xe070('0x60')]('dialTimezone');var _0x514808=_[_0xe070('0x61')](_0x551b66)[_0xe070('0x14')]();logger[_0xe070('0x40')](_0xe070('0x62'),_0x514808);if(hasTZ)_0x514808+=',utcOffset';fs['writeFileSync'](_0x2e408f,_0x514808+'\x0a');Papa[_0xe070('0x63')](fs['createReadStream'](_0x102e0b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5521c5,_0x501e04){try{for(var _0x3cafed=0x0,_0xd0cf3=[];_0x3cafed<_0x5521c5[_0xe070('0x64')][_0xe070('0x4f')];_0x3cafed++){stats[_0xe070('0x65')]+=0x1;if(_0x5521c5[_0xe070('0x44')][_0x3cafed]){handleError(_0x5521c5[_0xe070('0x64')][_0x3cafed],_0x5521c5[_0xe070('0x44')][_0x3cafed]);}else{var _0x321137=[];for(var _0xfaca51 in _0x551b66){if(_0x551b66[_0xe070('0x66')](_0xfaca51)){if(_0x5521c5[_0xe070('0x64')][_0x3cafed][_0x551b66[_0xfaca51]]){var _0x8be0ff=_[_0xe070('0x67')](_0x5521c5['data'][_0x3cafed][_0x551b66[_0xfaca51]]['replace'](/"/g,'\x27'));switch(_0xfaca51){case _0xe070('0x20'):var _0x5bdf64=moment(_0x8be0ff,_0xe070('0xf'),!![]);if(_0x5bdf64[_0xe070('0x68')]()){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');}else{_0x321137[_0xe070('0x45')](_0xe070('0x69'));}break;case _0xe070('0x23'):var _0xcee3c4=parseInt(_0x8be0ff);_0x8be0ff=_[_0xe070('0x6a')](_0xcee3c4)||_0xcee3c4<0x0||_0xcee3c4>0x4?_0x35828e?0x3:0x2:_0xcee3c4;_0xd0cf3['push']('\x22'+_0x8be0ff+'\x22');break;case'UserId':var _0x266476=parseInt(_0x8be0ff);if(_['isNumber'](_0x266476)&&_['includes'](_0x33e2c2,_0x266476)){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x266476+'\x22');}else{_0x321137[_0xe070('0x45')]('agent\x20not\x20exists');}break;case _0xe070('0x6b'):if(isEmail(_0x8be0ff)){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');}else{_0x321137[_0xe070('0x45')]('email\x20wrong\x20format');}break;case _0xe070('0x6c'):var _0x39f938=moment(_0x8be0ff,'YYYY-MM-DD',!![]);if(_0x39f938[_0xe070('0x68')]()){_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');}else{_0x321137[_0xe070('0x45')](_0xe070('0x6d'));}break;case _0xe070('0x59'):var _0x459536=shared[_0xe070('0x55')];var _0x1d0c38=_0x459536[_0x8be0ff];if(!_['isNil'](_0x1d0c38)){var _0x1a467c=_0x1d0c38[_0xe070('0x57')];_0xd0cf3[_0xe070('0x45')]('\x22'+_0x8be0ff+'\x22');_0xd0cf3[_0xe070('0x45')]('\x22'+_0x1a467c+'\x22');}break;default:_0xd0cf3['push']('\x22'+_0x8be0ff+'\x22');}}else{switch(_0xfaca51){case'firstName':case _0xe070('0x13'):_0x321137['push'](_0xfaca51+_0xe070('0x6e'));break;default:_0xd0cf3[_0xe070('0x45')]('\x22\x22');}}}}if(_0x321137['length']){handleError(_0x5521c5[_0xe070('0x64')][_0x3cafed],{'code':'SystemRow','message':_0x321137[_0xe070('0x14')]()});}else{fs[_0xe070('0x6f')](_0x2e408f,_0xd0cf3[_0xe070('0x14')]()+'\x0a');}_0xd0cf3=[];}if(!(stats['rows']%0xc8)){socket[_0xe070('0x70')](_0xe070('0x71')+_0xdb13e1,stats);stats[_0xe070('0x44')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x501e04[_0xe070('0x72')]();}}catch(_0x452f56){handleError(_0x5521c5[_0xe070('0x64')][_0x3cafed],{'code':_0xe070('0x73'),'message':_0x452f56[_0xe070('0x42')]});logger[_0xe070('0x41')](_0xe070('0x74'),_0x452f56[_0xe070('0x42')]);}},'complete':function(){try{var _0x23fd51=[];var _0x34fe68=[];var _0x46fee1='cm_contacts';if(_0x8f8848['duplicates']&&_0x8f8848[_0xe070('0x75')][_0xe070('0x4f')]){_0x46fee1='cm_contacts_'+_0xdb13e1;_0x23fd51[_0xe070('0x45')](_0xe070('0x76')+_0x46fee1+_0xe070('0x77'));}tmp_campaigns=_0xe070('0x78')+_0xdb13e1;tmp_voice_queues=_0xe070('0x79')+_0xdb13e1;_0x34fe68[_0xe070('0x45')](_0xe070('0x76')+tmp_campaigns+_0xe070('0x7a'));_0x34fe68['push'](_0xe070('0x76')+tmp_voice_queues+_0xe070('0x7a'));BPromise['each'](_0x34fe68,handleTZQuery)[_0xe070('0x51')](function(_0x4862c7){updateTzCampaigns(_0x8f8848[_0xe070('0x21')])[_0xe070('0x51')](function(_0x26979c){updateTzVoiceQueues(_0x8f8848['ListId'])['then'](function(_0xb9ebd0){var _0x2abc1b=util[_0xe070('0x7b')]('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',_0x2e408f,_0x46fee1,_0x514808,_0x8f8848[_0xe070('0x21')],_0x8f8848[_0xe070('0x3d')]||null,NOW,NOW);if(_[_0xe070('0x56')](_0x551b66[_0xe070('0x20')])){_0x2abc1b+=_0xe070('0x7c');}_0x23fd51[_0xe070('0x45')](_0x2abc1b);if(_0x8f8848[_0xe070('0x75')]&&_0x8f8848[_0xe070('0x75')][_0xe070('0x4f')]){_0x23fd51[_0xe070('0x45')](insertCmContact(_0x8f8848[_0xe070('0x21')],_0x46fee1,_0x8f8848[_0xe070('0x75')],_0x551b66));_0x23fd51[_0xe070('0x45')](_0xe070('0x7d')+_0x46fee1+';');}if(hasTZ){_0x23fd51[_0xe070('0x45')](insertTzCmHopper(_0x8f8848[_0xe070('0x21')],'voice_queues_has_cm_lists',_0xe070('0x7e'),_0xe070('0x7f'),_0x35828e,tmp_voice_queues));_0x23fd51[_0xe070('0x45')](insertTzCmHopperBlack(_0x8f8848[_0xe070('0x21')],_0xe070('0x80'),'voice_queues',_0xe070('0x7f')));_0x23fd51[_0xe070('0x45')](insertTzCmHopper(_0x8f8848[_0xe070('0x21')],_0xe070('0x4d'),'campaigns',_0xe070('0x81'),_0x35828e,tmp_campaigns));_0x23fd51[_0xe070('0x45')](insertTzCmHopperBlack(_0x8f8848[_0xe070('0x21')],_0xe070('0x82'),_0xe070('0x4c'),'CampaignId'));}else{_0x23fd51[_0xe070('0x45')](insertCmHopper(_0x8f8848[_0xe070('0x21')],_0xe070('0x52'),_0xe070('0x7e'),'VoiceQueueId',_0x35828e));_0x23fd51[_0xe070('0x45')](insertCmHopperBlack(_0x8f8848['ListId'],_0xe070('0x80'),_0xe070('0x7e'),_0xe070('0x7f')));_0x23fd51[_0xe070('0x45')](insertCmHopper(_0x8f8848[_0xe070('0x21')],'campaigns_has_cm_lists',_0xe070('0x4c'),'CampaignId',_0x35828e));_0x23fd51['push'](insertCmHopperBlack(_0x8f8848[_0xe070('0x21')],_0xe070('0x82'),_0xe070('0x4c'),_0xe070('0x81')));}_0x23fd51[_0xe070('0x45')](_0xe070('0x7d')+tmp_campaigns+';');_0x23fd51['push'](_0xe070('0x7d')+tmp_voice_queues+';');BPromise[_0xe070('0x83')](_0x23fd51,handleQuery)[_0xe070('0x51')](function(_0x2eb0ef){stats[_0xe070('0x84')]=!![];stats[_0xe070('0x85')]=_0x8f8848['duplicates']&&_0x8f8848[_0xe070('0x75')][_0xe070('0x4f')]?results[0x2][_0xe070('0x85')]:results[0x0]['affectedRows'];socket[_0xe070('0x70')](_0xe070('0x71')+_0xdb13e1,stats);fs['unlink'](_0x102e0b);fs[_0xe070('0x86')](_0x2e408f);process['exit'](0x0);})['catch'](function(_0x563345){logger[_0xe070('0x41')](_0x563345[_0xe070('0x42')]);process[_0xe070('0x43')](0x1);});});});});}catch(_0x394234){logger[_0xe070('0x41')](_0xe070('0x87'),_0x394234[_0xe070('0x42')]);process[_0xe070('0x43')](0x1);}},'error':function(_0x529955,_0x1e1cec,_0x1ab429,_0x2e0256){throw new Error(_0x2e0256);}});}function validate(){if(process[_0xe070('0x88')]&&process['argv']['length']<0x4){throw new Error(_0xe070('0x89'));}var _0x3770b5=path[_0xe070('0x14')](config[_0xe070('0x5e')],'server/files/tmp',process[_0xe070('0x88')][0x2]);if(!fs[_0xe070('0x8a')](_0x3770b5)){throw new Error(_0xe070('0x8b'));}var _0x2e20da={};try{_0x2e20da=JSON[_0xe070('0x63')](process[_0xe070('0x88')][0x3]);if(!_0x2e20da[_0xe070('0x5c')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2e20da[_0xe070('0x5c')][_0xe070('0x13')]){throw new Error(_0xe070('0x8c'));}if(!_0x2e20da[_0xe070('0x5c')][_0xe070('0x8d')]){throw new Error(_0xe070('0x8e'));}var _0x4f61cd=0x0;if(_0x2e20da[_0xe070('0x5c')][_0xe070('0x39')]){_0x4f61cd=0x1;}if(!_0x2e20da[_0xe070('0x21')]){throw new Error(_0xe070('0x8f'));}}catch(_0x245e4d){throw new Error('body\x20id\x20mandatory');}var _0x14391c=[];try{_0x14391c=_[_0xe070('0x90')](JSON[_0xe070('0x63')](process[_0xe070('0x88')][0x4]),'id');}catch(_0x346beb){logger[_0xe070('0x40')](_0xe070('0x91'));}main(_0x3770b5,_0x2e20da,_0x14391c,_0x4f61cd);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe070('0x92'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 3c03009..9161148 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe477=['Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','calleridname','keyValue','destexten','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt'];(function(_0x4dda5d,_0xbb055c){var _0x49e188=function(_0x3308b3){while(--_0x3308b3){_0x4dda5d['push'](_0x4dda5d['shift']());}};_0x49e188(++_0xbb055c);}(_0xe477,0x19c));var _0x7e47=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xe477[_0x5ddaac];return _0x2a9c58;};'use strict';exports[_0x7e47('0x0')]=function(_0x2bbd31,_0x1d6431){var _0x112ce1=[{'type':_0x7e47('0x1'),'content':_0x7e47('0x2'),'variableName':null}];switch(_0x2bbd31[_0x7e47('0x3')]()){case _0x7e47('0x4'):switch(_0x1d6431[_0x7e47('0x3')]()){case _0x7e47('0x5'):_0x112ce1[_0x7e47('0x6')]({'type':'variable','content':'','variableName':_0x7e47('0x7')});_0x112ce1[_0x7e47('0x6')]({'type':_0x7e47('0x8'),'content':'','variableName':'calleridnum'});break;case _0x7e47('0x9'):_0x112ce1[_0x7e47('0x6')]({'type':_0x7e47('0x1'),'content':_0x7e47('0xa'),'variableName':null});_0x112ce1[_0x7e47('0x6')]({'type':_0x7e47('0x8'),'content':'','variableName':_0x7e47('0xb')});break;}}return _0x112ce1;};exports[_0x7e47('0xc')]=function(_0x4e91ab,_0x16b4bc){var _0x4bc04a=[];switch(_0x4e91ab[_0x7e47('0x3')]()){case'voice':switch(_0x16b4bc[_0x7e47('0x3')]()){case _0x7e47('0x5'):_0x4bc04a=[{'type':_0x7e47('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':'variable','variableName':'calleridnum'},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x7e47('0x8'),'variableName':_0x7e47('0xd')},{'type':_0x7e47('0xe'),'content':'','key':'Call\x20To','keyType':_0x7e47('0x8'),'variableName':_0x7e47('0xf')},{'type':'keyValue','content':'','key':_0x7e47('0x10'),'keyType':_0x7e47('0x8'),'variableName':'queue'},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x11'),'keyType':_0x7e47('0x8'),'variableName':'uniqueid'},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x12'),'keyType':_0x7e47('0x8'),'variableName':_0x7e47('0x13')},{'type':_0x7e47('0x1'),'content':_0x7e47('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x15'),'keyType':'variable','variableName':_0x7e47('0x16')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x17'),'keyType':_0x7e47('0x8'),'variableName':_0x7e47('0xb')},{'type':_0x7e47('0x1'),'content':_0x7e47('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x19'),'keyType':'variable','variableName':_0x7e47('0x13')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x1a'),'keyType':'variable','variableName':_0x7e47('0x1b')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x1c'),'keyType':'variable','variableName':_0x7e47('0x1d')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x1e'),'keyType':_0x7e47('0x8'),'variableName':'holdtime'},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x1f'),'keyType':_0x7e47('0x8'),'variableName':'talktime'}];break;case _0x7e47('0x9'):_0x4bc04a=[{'type':'string','content':_0x7e47('0x20'),'variableName':null},{'type':'keyValue','content':'','key':_0x7e47('0x21'),'keyType':_0x7e47('0x8'),'keyContent':'','variableName':_0x7e47('0xb')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x22'),'keyType':_0x7e47('0x8'),'keyContent':'','variableName':_0x7e47('0x23')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x11'),'keyType':_0x7e47('0x8'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x7e47('0x12'),'keyType':_0x7e47('0x8'),'keyContent':'','variableName':_0x7e47('0x24')},{'type':_0x7e47('0x1'),'content':_0x7e47('0x18')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x25'),'keyType':_0x7e47('0x8'),'keyContent':'','variableName':_0x7e47('0x26')},{'type':_0x7e47('0xe'),'content':'','key':_0x7e47('0x27'),'keyType':_0x7e47('0x8'),'keyContent':'','variableName':_0x7e47('0x28')},{'type':'keyValue','content':'','key':_0x7e47('0x29'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0x7e47('0x2a'),'keyType':_0x7e47('0x8'),'keyContent':'','variableName':_0x7e47('0x2b')}];break;}}return _0x4bc04a;}; \ No newline at end of file +var _0x7fcf=['Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','Called\x20Number','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','inbound','push','queue','variable','calleridnum','outbound','destcalleridnum','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','destexten','UniqueId','uniqueid'];(function(_0x46d531,_0x24c3ac){var _0x2c4485=function(_0x5f10fb){while(--_0x5f10fb){_0x46d531['push'](_0x46d531['shift']());}};_0x2c4485(++_0x24c3ac);}(_0x7fcf,0x1c4));var _0xf7fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7fcf[_0x5b644e];return _0x49c6bf;};'use strict';exports[_0xf7fc('0x0')]=function(_0x45d802,_0x11173e){var _0x4276f0=[{'type':_0xf7fc('0x1'),'content':_0xf7fc('0x2'),'variableName':null}];switch(_0x45d802['toLowerCase']()){case _0xf7fc('0x3'):switch(_0x11173e['toLowerCase']()){case _0xf7fc('0x4'):_0x4276f0[_0xf7fc('0x5')]({'type':'variable','content':'','variableName':_0xf7fc('0x6')});_0x4276f0[_0xf7fc('0x5')]({'type':_0xf7fc('0x7'),'content':'','variableName':_0xf7fc('0x8')});break;case _0xf7fc('0x9'):_0x4276f0[_0xf7fc('0x5')]({'type':_0xf7fc('0x1'),'content':'Outbound\x20Call','variableName':null});_0x4276f0[_0xf7fc('0x5')]({'type':_0xf7fc('0x7'),'content':'','variableName':_0xf7fc('0xa')});break;}}return _0x4276f0;};exports[_0xf7fc('0xb')]=function(_0x2135e8,_0x18fb2b){var _0x406bba=[];switch(_0x2135e8['toLowerCase']()){case _0xf7fc('0x3'):switch(_0x18fb2b[_0xf7fc('0xc')]()){case _0xf7fc('0x4'):_0x406bba=[{'type':_0xf7fc('0x1'),'content':_0xf7fc('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf7fc('0xe'),'keyType':_0xf7fc('0x7'),'variableName':'calleridnum'},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x10'),'keyType':_0xf7fc('0x7'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0xf7fc('0x11'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x12')},{'type':_0xf7fc('0xf'),'content':'','key':'Queue','keyType':_0xf7fc('0x7'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0xf7fc('0x13'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x14')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x15'),'keyType':_0xf7fc('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':_0xf7fc('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf7fc('0x17'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x18')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x19'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0xa')},{'type':_0xf7fc('0x1'),'content':_0xf7fc('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x1b'),'keyType':_0xf7fc('0x7'),'variableName':'agentcalledAt'},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x1c'),'keyType':_0xf7fc('0x7'),'variableName':_0xf7fc('0x1d')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x1e'),'keyType':'variable','variableName':_0xf7fc('0x1f')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x20'),'keyType':_0xf7fc('0x7'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':_0xf7fc('0x21'),'keyType':'variable','variableName':'talktime'}];break;case _0xf7fc('0x9'):_0x406bba=[{'type':'string','content':_0xf7fc('0xd'),'variableName':null},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x22'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0xa')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x23')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x13'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x14')},{'type':_0xf7fc('0xf'),'content':'','key':'Date','keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x24')},{'type':_0xf7fc('0x1'),'content':_0xf7fc('0x1a')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x25'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x26'),'keyType':'variable','keyContent':'','variableName':_0xf7fc('0x27')},{'type':_0xf7fc('0xf'),'content':'','key':'Duration','keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x28')},{'type':_0xf7fc('0xf'),'content':'','key':_0xf7fc('0x29'),'keyType':_0xf7fc('0x7'),'keyContent':'','variableName':_0xf7fc('0x2a')}];break;}}return _0x406bba;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 83b726c..0935efa 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6cd=['catch','clone','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info'];(function(_0x40750d,_0x593094){var _0x42d026=function(_0x1168bb){while(--_0x1168bb){_0x40750d['push'](_0x40750d['shift']());}};_0x42d026(++_0x593094);}(_0xc6cd,0x1d3));var _0xdc6c=function(_0x1f0ed9,_0x359185){_0x1f0ed9=_0x1f0ed9-0x0;var _0x1d9589=_0xc6cd[_0x1f0ed9];return _0x1d9589;};'use strict';var _=require('lodash');var db=require(_0xdc6c('0x0'))['db'];var loggers={'openchannel':require(_0xdc6c('0x1'))(_0xdc6c('0x2')),'mail':require(_0xdc6c('0x1'))('mail-interactions'),'fax':require(_0xdc6c('0x1'))(_0xdc6c('0x3')),'sms':require('../../config/logger')(_0xdc6c('0x4')),'chat':require(_0xdc6c('0x1'))('chat-interactions'),'whatsapp':require(_0xdc6c('0x1'))(_0xdc6c('0x5'))};function getInteractionId(_0x450d4c,_0x26bfc4,_0x3481ad){if(_0x450d4c&&_0x450d4c[_[_0xdc6c('0x6')](_0x3481ad)+_0xdc6c('0x7')]){return _0x450d4c[_[_0xdc6c('0x6')](_0x3481ad)+'InteractionId'];}else if(_0x450d4c&&_0x450d4c['id']){return _0x450d4c['id'];}else if(_0x26bfc4&&_0x26bfc4['id']){return _0x26bfc4['id'];}else{return'unknown';}}function log(_0x1368a8,_0xafcffb,_0x5439cb,_0x5db139,_0xaa69ab,_0x1f2422){loggers[_0xaa69ab['toLowerCase']()][_0x1368a8](_0xdc6c('0x8'),_0x1f2422[_0xdc6c('0x9')](),_0xafcffb?_0xafcffb['id']:null,_0xafcffb?_0xafcffb[_0xdc6c('0xa')]:null,_0xafcffb?_0xafcffb[_0xdc6c('0xb')]:null,getInteractionId(_0x5439cb,_0x5db139,_0xaa69ab),_0x5439cb?JSON[_0xdc6c('0xc')](_0x5439cb):_0xdc6c('0xd'));}function updateUser(_0xa6ee1c,_0x3a403f,_0x3f152d,_0x469f72,_0x1f3c11){db[_[_0xdc6c('0x6')](_0x469f72)+_0xdc6c('0xe')][_0xdc6c('0xf')]({'where':{'id':getInteractionId(_0x3a403f,_0x3f152d,_0x469f72)}})[_0xdc6c('0x10')](function(_0x138d07){if(_0x138d07){return _0x138d07[_0xdc6c('0x11')]({'UserId':_0xa6ee1c?_0xa6ee1c['id']:null});}})[_0xdc6c('0x10')](function(_0x4eb15c){if(_0x4eb15c){log(_0xdc6c('0x12'),_0xa6ee1c,_0x3a403f,_0x3f152d,_0x469f72,_0x1f3c11);}})[_0xdc6c('0x13')](function(){log('error',_0xa6ee1c,_0x3a403f,_0x3f152d,_0x469f72,_0x1f3c11);});}exports['tracked']=function(_0x54c316,_0x1b4283){return function(_0x942b4e,_0x109b70,_0x255e15){var _0xf3168a=_0x942b4e['user'];var _0x5ed611={};var _0x2eadf7=_0x942b4e['query'];if(_0x5ed611){_0x5ed611=_[_0xdc6c('0x14')](_0x942b4e[_0xdc6c('0x15')]);_0x5ed611=_[_0xdc6c('0x16')](_0x5ed611,['body',_0xdc6c('0x17'),_0xdc6c('0x18'),_0xdc6c('0x19'),_0xdc6c('0x1a')]);}updateUser(_0xf3168a,_0x5ed611,_0x2eadf7,_0x54c316,_0x1b4283);_0x255e15(null);};}; \ No newline at end of file +var _0x6470=['then','update','info','catch','error','tracked','user','query','omit','body','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null','Interaction','findOne'];(function(_0x3a9da5,_0x2d940c){var _0x13e52d=function(_0x57b925){while(--_0x57b925){_0x3a9da5['push'](_0x3a9da5['shift']());}};_0x13e52d(++_0x2d940c);}(_0x6470,0x16a));var _0x0647=function(_0x2f2221,_0x5de764){_0x2f2221=_0x2f2221-0x0;var _0x214484=_0x6470[_0x2f2221];return _0x214484;};'use strict';var _=require(_0x0647('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x0647('0x1'))(_0x0647('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x0647('0x1'))(_0x0647('0x3')),'sms':require(_0x0647('0x1'))(_0x0647('0x4')),'chat':require(_0x0647('0x1'))(_0x0647('0x5')),'whatsapp':require(_0x0647('0x1'))(_0x0647('0x6'))};function getInteractionId(_0x41ac47,_0x445fbc,_0x11b98e){if(_0x41ac47&&_0x41ac47[_[_0x0647('0x7')](_0x11b98e)+_0x0647('0x8')]){return _0x41ac47[_['upperFirst'](_0x11b98e)+_0x0647('0x8')];}else if(_0x41ac47&&_0x41ac47['id']){return _0x41ac47['id'];}else if(_0x445fbc&&_0x445fbc['id']){return _0x445fbc['id'];}else{return'unknown';}}function log(_0x253aea,_0x1389ae,_0x2a52f9,_0x217629,_0x401dbf,_0x46abad){loggers[_0x401dbf['toLowerCase']()][_0x253aea](_0x0647('0x9'),_0x46abad[_0x0647('0xa')](),_0x1389ae?_0x1389ae['id']:null,_0x1389ae?_0x1389ae[_0x0647('0xb')]:null,_0x1389ae?_0x1389ae['role']:null,getInteractionId(_0x2a52f9,_0x217629,_0x401dbf),_0x2a52f9?JSON['stringify'](_0x2a52f9):_0x0647('0xc'));}function updateUser(_0x9bb7bf,_0x250879,_0xbfdffa,_0x25e80e,_0x3c4e32){db[_[_0x0647('0x7')](_0x25e80e)+_0x0647('0xd')][_0x0647('0xe')]({'where':{'id':getInteractionId(_0x250879,_0xbfdffa,_0x25e80e)}})[_0x0647('0xf')](function(_0x521ae0){if(_0x521ae0){return _0x521ae0[_0x0647('0x10')]({'UserId':_0x9bb7bf?_0x9bb7bf['id']:null});}})[_0x0647('0xf')](function(_0x292bc6){if(_0x292bc6){log(_0x0647('0x11'),_0x9bb7bf,_0x250879,_0xbfdffa,_0x25e80e,_0x3c4e32);}})[_0x0647('0x12')](function(){log(_0x0647('0x13'),_0x9bb7bf,_0x250879,_0xbfdffa,_0x25e80e,_0x3c4e32);});}exports[_0x0647('0x14')]=function(_0x34d46e,_0x5808d4){return function(_0x5d9227,_0x58a54b,_0x2830a5){var _0x3933b1=_0x5d9227[_0x0647('0x15')];var _0x230a1b={};var _0x2c7c36=_0x5d9227[_0x0647('0x16')];if(_0x230a1b){_0x230a1b=_['clone'](_0x5d9227['body']);_0x230a1b=_[_0x0647('0x17')](_0x230a1b,[_0x0647('0x18'),_0x0647('0x19'),_0x0647('0x1a'),_0x0647('0x1b'),_0x0647('0x1c')]);}updateUser(_0x3933b1,_0x230a1b,_0x2c7c36,_0x34d46e,_0x5808d4);_0x2830a5(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index e1df150..92101ca 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 _0x3869=['use','License','then','count','status','json','catch','users','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','utf8','parse'];(function(_0xcb7163,_0x1d2ad8){var _0x4b8dc2=function(_0x4272a7){while(--_0x4272a7){_0xcb7163['push'](_0xcb7163['shift']());}};_0x4b8dc2(++_0x1d2ad8);}(_0x3869,0xb2));var _0x9386=function(_0x254ef6,_0x40764a){_0x254ef6=_0x254ef6-0x0;var _0x3e0b18=_0x3869[_0x254ef6];return _0x3e0b18;};'use strict';var crypto=require(_0x9386('0x0'));var util=require(_0x9386('0x1'));var compose=require(_0x9386('0x2'));var db=require(_0x9386('0x3'))['db'];var config=require(_0x9386('0x4'));function getValueFromLicense(_0x1dca14,_0x3a30f6){if(_0x1dca14&&_0x3a30f6){if(_0x3a30f6[_0x9386('0x5')]&&_0x3a30f6[_0x9386('0x6')]){var _0x46a9a4=_0x3a30f6[_0x9386('0x5')];var _0x23becf=_0x3a30f6[_0x9386('0x6')];var _0x471824=_0x46a9a4[_0x9386('0x7')]('-')[0x4];var _0x550489=_0x46a9a4[_0x9386('0x7')]('-')[0x0];var _0x24030c=crypto[_0x9386('0x8')](_0x9386('0x9'),util['format'](_0x9386('0xa'),_0x471824,_0x46a9a4,_0x550489));var _0x61e1c8=_0x24030c[_0x9386('0xb')](_0x23becf,'base64','utf8');_0x61e1c8+=_0x24030c['final'](_0x9386('0xc'));var _0x2423a1=JSON[_0x9386('0xd')](_0x61e1c8);return _0x2423a1['hasOwnProperty'](_0x1dca14)?_0x2423a1[_0x1dca14]:null;}}return null;}function isLimit(_0x29855f,_0xfe4182,_0x45239a,_0x5470a9){var _0x2a26ab=_0xfe4182;return compose()[_0x9386('0xe')](function(_0x3c4221,_0x58a1ac,_0x585dda){return db[_0x9386('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x9386('0x10')](function(_0xd0444b){var _0x10ccdf=getValueFromLicense(_0x29855f,_0xd0444b);return _0x10ccdf?_0x10ccdf:_0x2a26ab;})[_0x9386('0x10')](function(_0x2a73db){_0x2a26ab=_0x2a73db;return _0x45239a[_0x9386('0x11')](_0x5470a9);})[_0x9386('0x10')](function(_0x80d257){if(_0x80d257>=_0x2a26ab){return _0x58a1ac[_0x9386('0x12')](0x193)[_0x9386('0x13')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x29855f)});}_0x585dda();})[_0x9386('0x14')](function(_0x520f9a){_0x585dda(_0x520f9a);});});}function isUserLimit(){return isLimit(_0x9386('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x9386('0x16')}]}});}exports[_0x9386('0x17')]=isUserLimit; \ No newline at end of file +var _0x3515=['split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','../../mysqldb','../../config/environment','data1','license'];(function(_0x429013,_0x4f9322){var _0x663606=function(_0x10bbf2){while(--_0x10bbf2){_0x429013['push'](_0x429013['shift']());}};_0x663606(++_0x4f9322);}(_0x3515,0x100));var _0x5351=function(_0x11ff0f,_0x2e8e59){_0x11ff0f=_0x11ff0f-0x0;var _0x31d8e7=_0x3515[_0x11ff0f];return _0x31d8e7;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0x5351('0x0'))['db'];var config=require(_0x5351('0x1'));function getValueFromLicense(_0x3a1129,_0x2b66ae){if(_0x3a1129&&_0x2b66ae){if(_0x2b66ae[_0x5351('0x2')]&&_0x2b66ae[_0x5351('0x3')]){var _0x48fc1e=_0x2b66ae['data1'];var _0x3e7c5a=_0x2b66ae[_0x5351('0x3')];var _0x5c5545=_0x48fc1e[_0x5351('0x4')]('-')[0x4];var _0x3e9198=_0x48fc1e[_0x5351('0x4')]('-')[0x0];var _0x2c37bb=crypto[_0x5351('0x5')]('aes-256-ctr',util[_0x5351('0x6')](_0x5351('0x7'),_0x5c5545,_0x48fc1e,_0x3e9198));var _0x4ea3b7=_0x2c37bb[_0x5351('0x8')](_0x3e7c5a,_0x5351('0x9'),_0x5351('0xa'));_0x4ea3b7+=_0x2c37bb[_0x5351('0xb')](_0x5351('0xa'));var _0x31b7bb=JSON[_0x5351('0xc')](_0x4ea3b7);return _0x31b7bb[_0x5351('0xd')](_0x3a1129)?_0x31b7bb[_0x3a1129]:null;}}return null;}function isLimit(_0x43f7fc,_0x19d432,_0x4d7c66,_0xbfec67){var _0x386f76=_0x19d432;return compose()[_0x5351('0xe')](function(_0x5842e8,_0x57076,_0x105123){return db['License'][_0x5351('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x49a61f){var _0x34a6c5=getValueFromLicense(_0x43f7fc,_0x49a61f);return _0x34a6c5?_0x34a6c5:_0x386f76;})[_0x5351('0x10')](function(_0x2f2fef){_0x386f76=_0x2f2fef;return _0x4d7c66[_0x5351('0x11')](_0xbfec67);})[_0x5351('0x10')](function(_0x2cb641){if(_0x2cb641>=_0x386f76){return _0x57076[_0x5351('0x12')](0x193)['json']({'message':util[_0x5351('0x6')](_0x5351('0x13'),_0x43f7fc)});}_0x105123();})[_0x5351('0x14')](function(_0x52ec3b){_0x105123(_0x52ec3b);});});}function isUserLimit(){return isLimit(_0x5351('0x15'),0x1,db[_0x5351('0x16')],{'where':{'$or':[{'role':_0x5351('0x17')},{'role':_0x5351('0x18')}]}});}exports[_0x5351('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ab6cdfe..f31f583 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 _0xebc7=['buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$lt','<\x20?','>\x20?','$gte','>=\x20?','$between','start','utcOffset','hours','minutes','moment','parseSearch','sqlOperator','startsWith','and','replace','split','length','slice','shift','forEach','conditions','push'];(function(_0x479cd3,_0x3737a0){var _0x56ddb1=function(_0x34e1a4){while(--_0x34e1a4){_0x479cd3['push'](_0x479cd3['shift']());}};_0x56ddb1(++_0x3737a0);}(_0xebc7,0x1dd));var _0x7ebc=function(_0x4f992e,_0x509550){_0x4f992e=_0x4f992e-0x0;var _0x2df82f=_0xebc7[_0x4f992e];return _0x2df82f;};'use strict';var _=require('lodash');var moment=require(_0x7ebc('0x0'));exports[_0x7ebc('0x1')]=function(_0xe9582c){var _0x2d78aa={'conditions':[]};_0x2d78aa[_0x7ebc('0x2')]=_[_0x7ebc('0x3')](_0xe9582c,'[$or]')?'or':_0x7ebc('0x4');var _0x163b08=_0xe9582c['replace']('[$and]','')[_0x7ebc('0x5')]('[$or]','')[_0x7ebc('0x6')]('||');for(var _0x56292d=0x0;_0x56292d<_0x163b08[_0x7ebc('0x7')];_0x56292d++){var _0xb56492=_0x163b08[_0x56292d][_0x7ebc('0x6')](':=');var _0x571d37=_0xb56492[0x0];var _0x7f42fc=_0xb56492[_0x7ebc('0x8')](0x1);_0x7f42fc['forEach'](function(_0x45a865){var _0x58bf5b=_0x45a865['split']('[')[_0x7ebc('0x9')]();var _0xac1020=_0x45a865['match'](/\[(.*?)\]/g);_0xac1020[_0x7ebc('0xa')](function(_0x4fb8a5){var _0x14719a=_0x4fb8a5[_0x7ebc('0x6')]('[')['filter'](function(_0x2a0bd4){return _0x2a0bd4['indexOf'](']')>-0x1;})['map'](function(_0x4ce478){return _0x4ce478[_0x7ebc('0x6')](']')[0x0];})[0x0];_0x2d78aa[_0x7ebc('0xb')][_0x7ebc('0xc')]({'field':_0x571d37,'operator':_0x58bf5b,'value':_0x14719a});});});}return _0x2d78aa;};exports[_0x7ebc('0xd')]=function(_0x51db0c,_0x2fee43,_0x37aac0){var _0x169356={};if(_0x2fee43===_0x7ebc('0xe')){if(_0x37aac0[_0x7ebc('0xf')]===_0x7ebc('0x10')){_0x37aac0['operator']='$between';_0x37aac0[_0x7ebc('0x11')]+=','+_0x37aac0['value'];}else if(_[_0x7ebc('0x12')]([_0x7ebc('0x13'),_0x7ebc('0x14')],_0x37aac0[_0x7ebc('0xf')])){_0x37aac0[_0x7ebc('0x11')]=moment(_0x37aac0['value'])[_0x7ebc('0x15')](0x1,_0x7ebc('0x16'))[_0x7ebc('0x17')](_0x7ebc('0x18'));}}if(_0x37aac0['castTo']){_0x2fee43=_0x37aac0[_0x7ebc('0x19')];_0x169356[_0x7ebc('0x1a')]=_0x7ebc('0x1b')+_0x51db0c+'.'+_0x37aac0[_0x7ebc('0x1c')]+_0x7ebc('0x1d')+_0x37aac0[_0x7ebc('0x19')]+')\x20'+parseOperator(_0x37aac0['operator']);}else{_0x169356[_0x7ebc('0x1a')]=_0x51db0c+'.'+_0x37aac0[_0x7ebc('0x1c')]+'\x20'+parseOperator(_0x37aac0[_0x7ebc('0xf')]);}if(_[_0x7ebc('0x12')]([_0x7ebc('0x1e'),'$notIn'],_0x37aac0[_0x7ebc('0xf')]))_0x169356['text']='('+_0x169356['text']+'\x20OR\x20'+_0x51db0c+'.'+_0x37aac0[_0x7ebc('0x1c')]+_0x7ebc('0x1f');_0x169356['value']=parseValue(_0x2fee43,_0x37aac0[_0x7ebc('0xf')],_0x37aac0[_0x7ebc('0x11')]);return _0x169356;};function parseOperator(_0x495794){var _0x148f19;switch(_0x495794){case _0x7ebc('0x20'):_0x148f19=_0x7ebc('0x21');break;case _0x7ebc('0x22'):_0x148f19=_0x7ebc('0x23');break;case _0x7ebc('0x10'):_0x148f19='=\x20?';break;case _0x7ebc('0x1e'):_0x148f19=_0x7ebc('0x24');break;case _0x7ebc('0x25'):case _0x7ebc('0x26'):case'$endsWith':_0x148f19='LIKE\x20?';break;case _0x7ebc('0x27'):_0x148f19=_0x7ebc('0x28');break;case _0x7ebc('0x13'):_0x148f19=_0x7ebc('0x29');break;case _0x7ebc('0x14'):_0x148f19='<=\x20?';break;case _0x7ebc('0x2a'):_0x148f19=_0x7ebc('0x2b');break;case _0x7ebc('0x2c'):_0x148f19='BETWEEN\x20?\x20AND\x20?';break;}return _0x148f19;}function parseValue(_0x52b72c,_0x4bf225,_0x4b1d6d){var _0x30052a={'start':undefined,'end':undefined};switch(_0x4bf225){case _0x7ebc('0x20'):case _0x7ebc('0x22'):_0x30052a[_0x7ebc('0x2d')]=_0x4b1d6d[_0x7ebc('0x6')](',');break;case'$substring':_0x30052a[_0x7ebc('0x2d')]='%'+_0x4b1d6d+'%';break;case'$startsWith':_0x30052a[_0x7ebc('0x2d')]=_0x4b1d6d+'%';break;case'$endsWith':_0x30052a[_0x7ebc('0x2d')]='%'+_0x4b1d6d;break;case'$between':var _0x15d833=_0x4b1d6d[_0x7ebc('0x6')](',');var _0x4b1d6d=_0x15d833[_0x7ebc('0x9')]();var _0x46fb37=_0x15d833['pop']();if(_0x52b72c===_0x7ebc('0xe')){_0x4b1d6d=moment(_0x4b1d6d)[_0x7ebc('0x2e')](0x0,!![])[_0x7ebc('0x17')]();_0x46fb37=moment(_0x46fb37)[_0x7ebc('0x2e')](0x0,!![])['add'](0x17,_0x7ebc('0x2f'))[_0x7ebc('0x15')](0x3b,_0x7ebc('0x30'))[_0x7ebc('0x15')](0x3b,'seconds')[_0x7ebc('0x17')]();}_0x30052a={'start':_0x4b1d6d,'end':_0x46fb37};break;default:_0x30052a[_0x7ebc('0x2d')]=_0x4b1d6d;break;}return _0x30052a;} \ No newline at end of file +var _0x30b4=['days','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','start','$between','pop','utcOffset','format','hours','minutes','lodash','moment','sqlOperator','startsWith','and','replace','[$and]','split','length','slice','shift','match','forEach','indexOf','map','conditions','push','DATE','operator','$eq','value','includes','$gt','add'];(function(_0x493fbb,_0x220663){var _0x522868=function(_0x41e3aa){while(--_0x41e3aa){_0x493fbb['push'](_0x493fbb['shift']());}};_0x522868(++_0x220663);}(_0x30b4,0x8a));var _0x430b=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0x30b4[_0x1b0597];return _0x2b6a2a;};'use strict';var _=require(_0x430b('0x0'));var moment=require(_0x430b('0x1'));exports['parseSearch']=function(_0x254d0f){var _0xb17abf={'conditions':[]};_0xb17abf[_0x430b('0x2')]=_[_0x430b('0x3')](_0x254d0f,'[$or]')?'or':_0x430b('0x4');var _0x4a9641=_0x254d0f[_0x430b('0x5')](_0x430b('0x6'),'')[_0x430b('0x5')]('[$or]','')[_0x430b('0x7')]('||');for(var _0x2cbdf5=0x0;_0x2cbdf5<_0x4a9641[_0x430b('0x8')];_0x2cbdf5++){var _0x47bdea=_0x4a9641[_0x2cbdf5][_0x430b('0x7')](':=');var _0x58faa8=_0x47bdea[0x0];var _0x23b8b4=_0x47bdea[_0x430b('0x9')](0x1);_0x23b8b4['forEach'](function(_0x354712){var _0x5585af=_0x354712[_0x430b('0x7')]('[')[_0x430b('0xa')]();var _0x46cbcf=_0x354712[_0x430b('0xb')](/\[(.*?)\]/g);_0x46cbcf[_0x430b('0xc')](function(_0x2cda91){var _0x35db80=_0x2cda91['split']('[')['filter'](function(_0x1b11db){return _0x1b11db[_0x430b('0xd')](']')>-0x1;})[_0x430b('0xe')](function(_0x4e3b9c){return _0x4e3b9c['split'](']')[0x0];})[0x0];_0xb17abf[_0x430b('0xf')][_0x430b('0x10')]({'field':_0x58faa8,'operator':_0x5585af,'value':_0x35db80});});});}return _0xb17abf;};exports['buildExpression']=function(_0x12a063,_0x133e9b,_0x1f581b){var _0x285f0c={};if(_0x133e9b===_0x430b('0x11')){if(_0x1f581b[_0x430b('0x12')]===_0x430b('0x13')){_0x1f581b[_0x430b('0x12')]='$between';_0x1f581b[_0x430b('0x14')]+=','+_0x1f581b[_0x430b('0x14')];}else if(_[_0x430b('0x15')]([_0x430b('0x16'),'$lte'],_0x1f581b[_0x430b('0x12')])){_0x1f581b[_0x430b('0x14')]=moment(_0x1f581b['value'])[_0x430b('0x17')](0x1,_0x430b('0x18'))['format'](_0x430b('0x19'));}}if(_0x1f581b['castTo']){_0x133e9b=_0x1f581b[_0x430b('0x1a')];_0x285f0c[_0x430b('0x1b')]='CAST('+_0x12a063+'.'+_0x1f581b[_0x430b('0x1c')]+_0x430b('0x1d')+_0x1f581b['castTo']+')\x20'+parseOperator(_0x1f581b[_0x430b('0x12')]);}else{_0x285f0c['text']=_0x12a063+'.'+_0x1f581b[_0x430b('0x1c')]+'\x20'+parseOperator(_0x1f581b['operator']);}if(_[_0x430b('0x15')]([_0x430b('0x1e'),_0x430b('0x1f')],_0x1f581b['operator']))_0x285f0c[_0x430b('0x1b')]='('+_0x285f0c[_0x430b('0x1b')]+'\x20OR\x20'+_0x12a063+'.'+_0x1f581b[_0x430b('0x1c')]+_0x430b('0x20');_0x285f0c['value']=parseValue(_0x133e9b,_0x1f581b[_0x430b('0x12')],_0x1f581b[_0x430b('0x14')]);return _0x285f0c;};function parseOperator(_0x1a4e42){var _0x598da8;switch(_0x1a4e42){case _0x430b('0x21'):_0x598da8=_0x430b('0x22');break;case _0x430b('0x1f'):_0x598da8='NOT\x20IN\x20?';break;case _0x430b('0x13'):_0x598da8=_0x430b('0x23');break;case _0x430b('0x1e'):_0x598da8=_0x430b('0x24');break;case _0x430b('0x25'):case _0x430b('0x26'):case _0x430b('0x27'):_0x598da8=_0x430b('0x28');break;case _0x430b('0x29'):_0x598da8='<\x20?';break;case _0x430b('0x16'):_0x598da8=_0x430b('0x2a');break;case _0x430b('0x2b'):_0x598da8=_0x430b('0x2c');break;case _0x430b('0x2d'):_0x598da8=_0x430b('0x2e');break;case'$between':_0x598da8='BETWEEN\x20?\x20AND\x20?';break;}return _0x598da8;}function parseValue(_0x56a686,_0x5756bd,_0x42b26a){var _0x9589bc={'start':undefined,'end':undefined};switch(_0x5756bd){case _0x430b('0x21'):case _0x430b('0x1f'):_0x9589bc['start']=_0x42b26a[_0x430b('0x7')](',');break;case _0x430b('0x25'):_0x9589bc[_0x430b('0x2f')]='%'+_0x42b26a+'%';break;case _0x430b('0x26'):_0x9589bc[_0x430b('0x2f')]=_0x42b26a+'%';break;case'$endsWith':_0x9589bc['start']='%'+_0x42b26a;break;case _0x430b('0x30'):var _0x1782d=_0x42b26a[_0x430b('0x7')](',');var _0x42b26a=_0x1782d[_0x430b('0xa')]();var _0x2cbe1c=_0x1782d[_0x430b('0x31')]();if(_0x56a686==='DATE'){_0x42b26a=moment(_0x42b26a)[_0x430b('0x32')](0x0,!![])[_0x430b('0x33')]();_0x2cbe1c=moment(_0x2cbe1c)[_0x430b('0x32')](0x0,!![])[_0x430b('0x17')](0x17,_0x430b('0x34'))['add'](0x3b,_0x430b('0x35'))[_0x430b('0x17')](0x3b,'seconds')[_0x430b('0x33')]();}_0x9589bc={'start':_0x42b26a,'end':_0x2cbe1c};break;default:_0x9589bc[_0x430b('0x2f')]=_0x42b26a;break;}return _0x9589bc;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 5e58131..65840d2 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 _0xb4c7=['unsigned','substr','DESC','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','getOptions','$id','query','map','intersection','model','attributes','nolimit','where','pick','object','filter','columns','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','col'];(function(_0x22893c,_0x2d1ab9){var _0x58dc82=function(_0x2055bd){while(--_0x2055bd){_0x22893c['push'](_0x22893c['shift']());}};_0x58dc82(++_0x2d1ab9);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2f8ec9,_0x212e2d){_0x2f8ec9=_0x2f8ec9-0x0;var _0x3e0227=_0xb4c7[_0x2f8ec9];return _0x3e0227;};'use strict';var _=require(_0x7b4c('0x0'));var sequelize=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xa0d9f1){var _0x286a79=['ne'];try{var _0x4bef48=JSON[_0x7b4c('0x3')](_0xa0d9f1);var _0x149d55=Object[_0x7b4c('0x4')](_0x4bef48)[0x0];return _0x286a79[_0x7b4c('0x5')](_0x149d55);}catch(_0x2d9945){return![];}}function getOperatorValue(_0x5adec9){var _0x1b0f57=JSON[_0x7b4c('0x3')](_0x5adec9);var _0x2dd5c7=Object['keys'](_0x1b0f57)[0x0];var _0x2d7b7e=_0x1b0f57[_0x2dd5c7];return{['$'+_0x2dd5c7]:_0x2d7b7e};}exports[_0x7b4c('0x6')]=function(_0x570daa){var _0x433aa2=null;if(_0x570daa){_0x433aa2=_0x570daa[_0x7b4c('0x7')](',');}return _0x433aa2;};exports[_0x7b4c('0x8')]=function(_0x237e28,_0x365225){var _0x93d013={};if(!_[_0x7b4c('0x9')](_0x237e28)){_[_0x7b4c('0xa')](_0x237e28,function(_0xa9814e,_0x2adb51){try{if(_0x365225){var _0x5d5bc3=_['find'](_0x365225,{'name':_0x2adb51})||{};if(hasSequelizeOperator(_0xa9814e)){_0x93d013[_0x2adb51]=getOperatorValue(_0xa9814e);}else if(_0x5d5bc3[_0x7b4c('0xb')]===_0x7b4c('0xc')&&_[_0x7b4c('0xd')](_0xa9814e)){var _0x1722ad=JSON[_0x7b4c('0x3')](_0xa9814e);var _0x341d36={'$gte':moment(moment(_0x1722ad[_0x7b4c('0xe')])[_0x7b4c('0xf')](_0x7b4c('0x10')))[_0x7b4c('0x11')]()['format'](),'$lte':moment(moment(_0x1722ad[_0x7b4c('0x12')])[_0x7b4c('0xf')](_0x7b4c('0x10')))[_0x7b4c('0x11')]()[_0x7b4c('0x13')](0x1,'s')[_0x7b4c('0xf')]()};_0x93d013[_0x2adb51]=_0x341d36;}else if(_0x5d5bc3[_0x7b4c('0x14')]===_0x7b4c('0x15')){_0x93d013[_0x2adb51]=_0xa9814e;}else{_0x93d013[_0x2adb51]=_['isArray'](_0xa9814e)?_0xa9814e:JSON[_0x7b4c('0x3')](_0xa9814e);}}else{_0x93d013[_0x2adb51]=_[_0x7b4c('0x16')](_0xa9814e)?_0xa9814e:JSON[_0x7b4c('0x3')](_0xa9814e);}}catch(_0x36c02a){_0x93d013[_0x2adb51]=_0xa9814e['split'](',');}});}return _0x93d013;};exports[_0x7b4c('0x17')]=function(_0x3d314d){_0x3d314d=parseInt(_0x3d314d,0xa);if(!_0x3d314d||_0x3d314d<0x0){_0x3d314d=LIMIT_VALUE;}return _0x3d314d;};exports[_0x7b4c('0x18')]=function(_0x380b79){_0x380b79=parseInt(_0x380b79,0xa);if(!_0x380b79||_0x380b79<0x0){_0x380b79=0x0;}return _0x380b79;};exports[_0x7b4c('0x19')]=function(_0x1363b4){var _0x237110,_0x445281=null;if(_0x1363b4){_0x237110=_0x1363b4[_0x7b4c('0x7')](',');_0x445281=_['map'](_0x237110,function(_0x1f06ec){if(_0x1f06ec[_0x7b4c('0x1a')]('-')===0x0){return[_0x1f06ec===_0x7b4c('0x1b')?sequelize[_0x7b4c('0x1c')](sequelize[_0x7b4c('0x1d')](_0x7b4c('0x1b')),_0x7b4c('0x1e')):_0x1f06ec[_0x7b4c('0x1f')](0x1),_0x7b4c('0x20')];}else{return[_0x1f06ec===_0x7b4c('0x1b')?sequelize['cast'](sequelize[_0x7b4c('0x1d')](_0x7b4c('0x1b')),_0x7b4c('0x1e')):_0x1f06ec,_0x7b4c('0x21')];}});}return _0x445281;};exports[_0x7b4c('0x22')]=function(_0x2bdc4d,_0x37c059){if(_[_0x7b4c('0x9')](_0x2bdc4d)){return _0x2bdc4d;}if(_[_0x7b4c('0x16')](_0x2bdc4d)){for(var _0x1a69db=0x0;_0x1a69db<_0x2bdc4d[_0x7b4c('0x23')];_0x1a69db+=0x1){_0x2bdc4d[_0x1a69db]=this[_0x7b4c('0x22')](_0x2bdc4d[_0x1a69db],_0x37c059);}return _0x2bdc4d;}if(!_[_0x7b4c('0x24')](_0x2bdc4d)){return _0x2bdc4d;}if(_['isString'](_0x37c059)){_0x37c059=[_0x37c059];}if(!_[_0x7b4c('0x16')](_0x37c059)){return _0x2bdc4d;}for(var _0x3ab614=0x0;_0x3ab614<_0x37c059[_0x7b4c('0x23')];_0x3ab614+=0x1){_[_0x7b4c('0x25')](_0x2bdc4d,_0x37c059[_0x3ab614]);}for(var _0x207c2f in _0x2bdc4d){if(_0x2bdc4d[_0x7b4c('0x26')](_0x207c2f)){_0x2bdc4d[_0x207c2f]=this[_0x7b4c('0x22')](_0x2bdc4d[_0x207c2f],_0x37c059);}}return _0x2bdc4d;};exports[_0x7b4c('0x27')]=function(_0x3e4a46){return _0x3e4a46[_0x7b4c('0x28')](RegExp(_0x7b4c('0x29')))?!![]:![];};exports[_0x7b4c('0x2a')]=function(_0x3544bc){return _0x3544bc[_0x7b4c('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x7b4c('0x2b')]=function(_0x3e5bdd){var _0x1d0724=[];_0x3e5bdd[_0x7b4c('0x7')](/[ ,]+/)[_0x7b4c('0x2c')](function(_0x4f0d33){_0x4f0d33=_0x4f0d33['replace'](/([^:]")"+/g,'$1');_0x4f0d33='+'+_0x4f0d33+'*';var _0x511f21=/[ `!@#$%^&*()_\-?~]/;if(_0x4f0d33[_0x7b4c('0x28')](_0x511f21))_0x4f0d33='\x22'+_0x4f0d33+'\x22';_0x1d0724[_0x7b4c('0x2d')](_0x4f0d33);});return _0x1d0724[_0x7b4c('0x2e')]('\x20');};exports[_0x7b4c('0x2f')]=function(_0x498391,_0x6e66e3,_0x344325){var _0x5d728b={},_0x647978={};if(_0x6e66e3['query'][_0x7b4c('0x30')]){_0x6e66e3[_0x7b4c('0x31')]['id']=_0x6e66e3[_0x7b4c('0x31')]['$id'];delete _0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x30')];}_0x5d728b['model']=_[_0x7b4c('0x32')](_0x498391,_0x7b4c('0x14'));_0x5d728b[_0x7b4c('0x31')]=_[_0x7b4c('0x4')](_0x6e66e3['query']);_0x5d728b['filters']=_[_0x7b4c('0x33')](_0x5d728b[_0x7b4c('0x34')],_0x5d728b['query']);_0x647978[_0x7b4c('0x35')]=_['intersection'](_0x5d728b['model'],this[_0x7b4c('0x6')](_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x6')]));_0x647978[_0x7b4c('0x35')]=_0x647978['attributes'][_0x7b4c('0x23')]?_0x647978[_0x7b4c('0x35')]:_0x5d728b[_0x7b4c('0x34')];if(!_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x26')](_0x7b4c('0x36'))){_0x647978[_0x7b4c('0x17')]=this['limit'](_0x6e66e3['query'][_0x7b4c('0x17')]);_0x647978[_0x7b4c('0x18')]=this[_0x7b4c('0x18')](_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x18')]);}_0x647978['order']=this[_0x7b4c('0x19')](_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x19')]);_0x647978[_0x7b4c('0x37')]=this[_0x7b4c('0x8')](_[_0x7b4c('0x38')](_0x6e66e3[_0x7b4c('0x31')],_0x5d728b[_0x7b4c('0x8')]),_0x498391);if(_0x6e66e3[_0x7b4c('0x31')]['filter']){var _0x2a4085=_0x498391;var _0x562838=_0x6e66e3[_0x7b4c('0x31')]['filter'];if(typeof _0x562838===_0x7b4c('0x39')){_0x2a4085=_[_0x7b4c('0x3a')](_0x498391,function(_0x5bb6d0){return _['includes'](_0x562838[_0x7b4c('0x3b')],_0x5bb6d0[_0x7b4c('0x14')]);});_0x562838=_0x562838[_0x7b4c('0x3c')];}_0x647978[_0x7b4c('0x37')]=_['merge'](_0x647978[_0x7b4c('0x37')],{'$or':_[_0x7b4c('0x32')](_0x2a4085,function(_0x100774){if(_0x100774['type']!==_0x7b4c('0x3d')){if(_0x344325){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x7b4c('0x1d')](_0x100774['name'])),{'$like':sequelize['fn'](_0x7b4c('0x3e'),'%'+_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x3a')]+'%')});}else{var _0x301935={};_0x301935[_0x100774[_0x7b4c('0x14')]]={'$like':'%'+_0x6e66e3[_0x7b4c('0x31')][_0x7b4c('0x3a')]+'%'};return _0x301935;}}})});}_0x647978=_[_0x7b4c('0x3f')]({},_0x647978,_0x6e66e3[_0x7b4c('0x40')]);return _0x647978;}; \ No newline at end of file +var _0x7bae=['omit','isObject','isString','length','unset','match','^[+]?[0-9]*$','getFullTextValue','replace','getOptions','query','$id','model','name','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','object','columns','merge','type','VIRTUAL','lower','options','moment','keys','includes','parse','fields','split','isEmpty','forOwn','find','DATE','$gte','format','YYYY-MM-DD','$lte','subtract','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast'];(function(_0x46f9fc,_0x30b951){var _0x4eca28=function(_0x3d70e9){while(--_0x3d70e9){_0x46f9fc['push'](_0x46f9fc['shift']());}};_0x4eca28(++_0x30b951);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7bae[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xe7ba('0x0'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1e05c4){var _0x503803=['ne'];try{var _0x3963c7=JSON['parse'](_0x1e05c4);var _0x120efa=Object[_0xe7ba('0x1')](_0x3963c7)[0x0];return _0x503803[_0xe7ba('0x2')](_0x120efa);}catch(_0x2276df){return![];}}function getOperatorValue(_0x398a6a){var _0xfd3a22=JSON[_0xe7ba('0x3')](_0x398a6a);var _0x3c5e59=Object[_0xe7ba('0x1')](_0xfd3a22)[0x0];var _0x34fb18=_0xfd3a22[_0x3c5e59];return{['$'+_0x3c5e59]:_0x34fb18};}exports[_0xe7ba('0x4')]=function(_0x27b1d5){var _0x41c39d=null;if(_0x27b1d5){_0x41c39d=_0x27b1d5[_0xe7ba('0x5')](',');}return _0x41c39d;};exports['filters']=function(_0x3df8bf,_0xe57e33){var _0x375ebb={};if(!_[_0xe7ba('0x6')](_0x3df8bf)){_[_0xe7ba('0x7')](_0x3df8bf,function(_0x1672f0,_0x99a86f){try{if(_0xe57e33){var _0x448bcc=_[_0xe7ba('0x8')](_0xe57e33,{'name':_0x99a86f})||{};if(hasSequelizeOperator(_0x1672f0)){_0x375ebb[_0x99a86f]=getOperatorValue(_0x1672f0);}else if(_0x448bcc['type']===_0xe7ba('0x9')&&_['isPlainObject'](_0x1672f0)){var _0x602b1=JSON[_0xe7ba('0x3')](_0x1672f0);var _0x390596={'$gte':moment(moment(_0x602b1[_0xe7ba('0xa')])[_0xe7ba('0xb')](_0xe7ba('0xc')))['utc']()['format'](),'$lte':moment(moment(_0x602b1[_0xe7ba('0xd')])[_0xe7ba('0xb')](_0xe7ba('0xc')))['utc']()[_0xe7ba('0xe')](0x1,'s')['format']()};_0x375ebb[_0x99a86f]=_0x390596;}else if(_0x448bcc['name']==='uniqueid'){_0x375ebb[_0x99a86f]=_0x1672f0;}else{_0x375ebb[_0x99a86f]=_[_0xe7ba('0xf')](_0x1672f0)?_0x1672f0:JSON['parse'](_0x1672f0);}}else{_0x375ebb[_0x99a86f]=_[_0xe7ba('0xf')](_0x1672f0)?_0x1672f0:JSON['parse'](_0x1672f0);}}catch(_0x4e3021){_0x375ebb[_0x99a86f]=_0x1672f0['split'](',');}});}return _0x375ebb;};exports[_0xe7ba('0x10')]=function(_0x30086c){_0x30086c=parseInt(_0x30086c,0xa);if(!_0x30086c||_0x30086c<0x0){_0x30086c=LIMIT_VALUE;}return _0x30086c;};exports[_0xe7ba('0x11')]=function(_0x3c06c3){_0x3c06c3=parseInt(_0x3c06c3,0xa);if(!_0x3c06c3||_0x3c06c3<0x0){_0x3c06c3=0x0;}return _0x3c06c3;};exports[_0xe7ba('0x12')]=function(_0x58550c){var _0x149c62,_0x20c653=null;if(_0x58550c){_0x149c62=_0x58550c[_0xe7ba('0x5')](',');_0x20c653=_[_0xe7ba('0x13')](_0x149c62,function(_0x4aaf35){if(_0x4aaf35[_0xe7ba('0x14')]('-')===0x0){return[_0x4aaf35===_0xe7ba('0x15')?sequelize['cast'](sequelize[_0xe7ba('0x16')](_0xe7ba('0x15')),_0xe7ba('0x17')):_0x4aaf35[_0xe7ba('0x18')](0x1),_0xe7ba('0x19')];}else{return[_0x4aaf35===_0xe7ba('0x15')?sequelize[_0xe7ba('0x1a')](sequelize[_0xe7ba('0x16')](_0xe7ba('0x15')),_0xe7ba('0x17')):_0x4aaf35,'ASC'];}});}return _0x20c653;};exports['omit']=function(_0x4dcc7b,_0x4cd124){if(_[_0xe7ba('0x6')](_0x4dcc7b)){return _0x4dcc7b;}if(_['isArray'](_0x4dcc7b)){for(var _0x4ecc0d=0x0;_0x4ecc0d<_0x4dcc7b['length'];_0x4ecc0d+=0x1){_0x4dcc7b[_0x4ecc0d]=this[_0xe7ba('0x1b')](_0x4dcc7b[_0x4ecc0d],_0x4cd124);}return _0x4dcc7b;}if(!_[_0xe7ba('0x1c')](_0x4dcc7b)){return _0x4dcc7b;}if(_[_0xe7ba('0x1d')](_0x4cd124)){_0x4cd124=[_0x4cd124];}if(!_[_0xe7ba('0xf')](_0x4cd124)){return _0x4dcc7b;}for(var _0x3435c6=0x0;_0x3435c6<_0x4cd124[_0xe7ba('0x1e')];_0x3435c6+=0x1){_[_0xe7ba('0x1f')](_0x4dcc7b,_0x4cd124[_0x3435c6]);}for(var _0x3a59d6 in _0x4dcc7b){if(_0x4dcc7b['hasOwnProperty'](_0x3a59d6)){_0x4dcc7b[_0x3a59d6]=this[_0xe7ba('0x1b')](_0x4dcc7b[_0x3a59d6],_0x4cd124);}}return _0x4dcc7b;};exports['isNumeric']=function(_0x102925){return _0x102925[_0xe7ba('0x20')](RegExp(_0xe7ba('0x21')))?!![]:![];};exports['isEmail']=function(_0x587c7d){return _0x587c7d[_0xe7ba('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xe7ba('0x22')]=function(_0x8d5020){var _0x20b6cd=[];_0x8d5020[_0xe7ba('0x5')](/[ ,]+/)['forEach'](function(_0x37911d){_0x37911d=_0x37911d[_0xe7ba('0x23')](/([^:]")"+/g,'$1');_0x37911d='+'+_0x37911d+'*';var _0x5b5ff3=/[ `!@#$%^&*()_\-?~]/;if(_0x37911d[_0xe7ba('0x20')](_0x5b5ff3))_0x37911d='\x22'+_0x37911d+'\x22';_0x20b6cd['push'](_0x37911d);});return _0x20b6cd['join']('\x20');};exports[_0xe7ba('0x24')]=function(_0x134f21,_0x1be947,_0x52f90e){var _0x3b14b4={},_0x4ccdc7={};if(_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x26')]){_0x1be947[_0xe7ba('0x25')]['id']=_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x26')];delete _0x1be947['query'][_0xe7ba('0x26')];}_0x3b14b4[_0xe7ba('0x27')]=_['map'](_0x134f21,_0xe7ba('0x28'));_0x3b14b4[_0xe7ba('0x25')]=_[_0xe7ba('0x1')](_0x1be947['query']);_0x3b14b4[_0xe7ba('0x29')]=_[_0xe7ba('0x2a')](_0x3b14b4['model'],_0x3b14b4[_0xe7ba('0x25')]);_0x4ccdc7[_0xe7ba('0x2b')]=_[_0xe7ba('0x2a')](_0x3b14b4['model'],this[_0xe7ba('0x4')](_0x1be947[_0xe7ba('0x25')]['fields']));_0x4ccdc7[_0xe7ba('0x2b')]=_0x4ccdc7[_0xe7ba('0x2b')][_0xe7ba('0x1e')]?_0x4ccdc7['attributes']:_0x3b14b4['model'];if(!_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x2c')](_0xe7ba('0x2d'))){_0x4ccdc7[_0xe7ba('0x10')]=this[_0xe7ba('0x10')](_0x1be947['query'][_0xe7ba('0x10')]);_0x4ccdc7[_0xe7ba('0x11')]=this[_0xe7ba('0x11')](_0x1be947[_0xe7ba('0x25')]['offset']);}_0x4ccdc7[_0xe7ba('0x2e')]=this[_0xe7ba('0x12')](_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x12')]);_0x4ccdc7[_0xe7ba('0x2f')]=this[_0xe7ba('0x29')](_[_0xe7ba('0x30')](_0x1be947['query'],_0x3b14b4[_0xe7ba('0x29')]),_0x134f21);if(_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]){var _0x401b0a=_0x134f21;var _0xf61205=_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')];if(typeof _0xf61205===_0xe7ba('0x32')){_0x401b0a=_[_0xe7ba('0x31')](_0x134f21,function(_0x50792c){return _[_0xe7ba('0x2')](_0xf61205[_0xe7ba('0x33')],_0x50792c['name']);});_0xf61205=_0xf61205['value'];}_0x4ccdc7[_0xe7ba('0x2f')]=_[_0xe7ba('0x34')](_0x4ccdc7[_0xe7ba('0x2f')],{'$or':_['map'](_0x401b0a,function(_0x249e1d){if(_0x249e1d[_0xe7ba('0x35')]!==_0xe7ba('0x36')){if(_0x52f90e){return sequelize[_0xe7ba('0x2f')](sequelize['fn'](_0xe7ba('0x37'),sequelize['col'](_0x249e1d[_0xe7ba('0x28')])),{'$like':sequelize['fn']('lower','%'+_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]+'%')});}else{var _0xe0f1c3={};_0xe0f1c3[_0x249e1d[_0xe7ba('0x28')]]={'$like':'%'+_0x1be947[_0xe7ba('0x25')][_0xe7ba('0x31')]+'%'};return _0xe0f1c3;}}})});}_0x4ccdc7=_[_0xe7ba('0x34')]({},_0x4ccdc7,_0x1be947[_0xe7ba('0x38')]);return _0x4ccdc7;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8f3d76f..431bbf9 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0xfca0bf,_0x8ac9f9){var _0xc72568=function(_0x4b4a90){while(--_0x4b4a90){_0xfca0bf['push'](_0xfca0bf['shift']());}};_0xc72568(++_0x8ac9f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index cdcf231..fde8b7f 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 _0x2f77=['bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','join','createHash','md5','update','hex','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','substring','lodash'];(function(_0x512b3d,_0x459d64){var _0x5a25a6=function(_0x40b7e9){while(--_0x40b7e9){_0x512b3d['push'](_0x512b3d['shift']());}};_0x5a25a6(++_0x459d64);}(_0x2f77,0x128));var _0x72f7=function(_0x16fbbc,_0x54a1ee){_0x16fbbc=_0x16fbbc-0x0;var _0x300a0d=_0x2f77[_0x16fbbc];return _0x300a0d;};'use strict';var _=require(_0x72f7('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x72f7('0x1'));var exec=require(_0x72f7('0x2'))[_0x72f7('0x3')];var config=require(_0x72f7('0x4'));function getInterfaces(){var _0x19c3c5=[];var _0x16cf55=os[_0x72f7('0x5')]();var _0xc2ab78=_[_0x72f7('0x6')](_['keys'](_0x16cf55));for(var _0x549733=0x0;_0x549733<_0xc2ab78['length'];_0x549733++){var _0x193f6f=_0x16cf55[_0xc2ab78[_0x549733]][_0x72f7('0x7')](function(_0x960e53){return _0x960e53[_0x72f7('0x8')]===_0x72f7('0x9')&&_0x960e53[_0x72f7('0xa')]===![];});_0x19c3c5=_0x19c3c5[_0x72f7('0xb')](_0x193f6f);}return _0x19c3c5;}function getFirstInterface(){var _0x4d8f70=_[_0x72f7('0xc')](getInterfaces());return{'macAddress':_0x4d8f70&&_0x4d8f70[_0x72f7('0xd')]?_0x4d8f70[_0x72f7('0xd')]:_0x72f7('0xe'),'ipAddress':_0x4d8f70&&_0x4d8f70[_0x72f7('0xf')]?_0x4d8f70[_0x72f7('0xf')]:_0x72f7('0x10')};}exports[_0x72f7('0x11')]=getFirstInterface;function getCPUhash(){var _0x2edcc8=_[_0x72f7('0x6')](os[_0x72f7('0x12')]()['map'](function(_0x5e4165){return _0x5e4165['model'];}))[_0x72f7('0x13')](':');return crypto[_0x72f7('0x14')](_0x72f7('0x15'))[_0x72f7('0x16')](_0x2edcc8)['digest'](_0x72f7('0x17'));}exports['getUuid']=function(){var _0x2d3bc8=os[_0x72f7('0x18')]();var _0x222db6=/[0-9a-f-]{36}/;if(config[_0x72f7('0x19')]&&_0x222db6['test'](config['licenseToken'])){return config[_0x72f7('0x19')];}else if(_0x2d3bc8==='win32'){return exec(_0x72f7('0x1a'),{'encoding':_0x72f7('0x1b')})[_0x72f7('0x1c')]('\x0d\x0a','');}else{var _0x5bef3f=getFirstInterface();var _0x2d0dae=getCPUhash();var _0x5a03dc=_0x2d0dae+'|'+os[_0x72f7('0x1d')]()+'|'+_0x5bef3f['macAddress']+'|'+_0x5bef3f[_0x72f7('0x1e')];var _0x185fc7=crypto['createHash'](_0x72f7('0x15'))[_0x72f7('0x16')](_0x5a03dc)[_0x72f7('0x1f')](_0x72f7('0x17'));return _0x185fc7['substring'](0x0,0x8)+'-'+_0x185fc7[_0x72f7('0x20')](0x8,0xc)+'-'+_0x185fc7['substring'](0xc,0x10)+'-'+_0x185fc7['substring'](0x10,0x14)+'-'+_0x185fc7['substring'](0x14);}}; \ No newline at end of file +var _0x5cd1=['hex','substring','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','createHash','update','digest','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5'];(function(_0x527306,_0x444b80){var _0x4085e9=function(_0x3c5b19){while(--_0x3c5b19){_0x527306['push'](_0x527306['shift']());}};_0x4085e9(++_0x444b80);}(_0x5cd1,0x12b));var _0x15cd=function(_0x2fda81,_0x5de06c){_0x2fda81=_0x2fda81-0x0;var _0x5f38d9=_0x5cd1[_0x2fda81];return _0x5f38d9;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x15cd('0x0'));var exec=require(_0x15cd('0x1'))[_0x15cd('0x2')];var config=require('../environment');function getInterfaces(){var _0x8ec60=[];var _0x293ed4=os[_0x15cd('0x3')]();var _0x2b0b28=_['orderBy'](_[_0x15cd('0x4')](_0x293ed4));for(var _0x355985=0x0;_0x355985<_0x2b0b28[_0x15cd('0x5')];_0x355985++){var _0xe945c=_0x293ed4[_0x2b0b28[_0x355985]]['filter'](function(_0xd85f12){return _0xd85f12[_0x15cd('0x6')]==='IPv4'&&_0xd85f12[_0x15cd('0x7')]===![];});_0x8ec60=_0x8ec60[_0x15cd('0x8')](_0xe945c);}return _0x8ec60;}function getFirstInterface(){var _0x29ec6b=_[_0x15cd('0x9')](getInterfaces());return{'macAddress':_0x29ec6b&&_0x29ec6b['mac']?_0x29ec6b[_0x15cd('0xa')]:_0x15cd('0xb'),'ipAddress':_0x29ec6b&&_0x29ec6b[_0x15cd('0xc')]?_0x29ec6b[_0x15cd('0xc')]:_0x15cd('0xd')};}exports[_0x15cd('0xe')]=getFirstInterface;function getCPUhash(){var _0x23d5ea=_[_0x15cd('0xf')](os['cpus']()[_0x15cd('0x10')](function(_0x39ec9f){return _0x39ec9f['model'];}))['join'](':');return crypto[_0x15cd('0x11')]('md5')[_0x15cd('0x12')](_0x23d5ea)[_0x15cd('0x13')]('hex');}exports[_0x15cd('0x14')]=function(){var _0x445c84=os[_0x15cd('0x15')]();var _0x595d49=/[0-9a-f-]{36}/;if(config[_0x15cd('0x16')]&&_0x595d49[_0x15cd('0x17')](config['licenseToken'])){return config[_0x15cd('0x16')];}else if(_0x445c84==='win32'){return exec(_0x15cd('0x18'),{'encoding':_0x15cd('0x19')})[_0x15cd('0x1a')]('\x0d\x0a','');}else{var _0x59c235=getFirstInterface();var _0x44a7e3=getCPUhash();var _0xde561c=_0x44a7e3+'|'+os[_0x15cd('0x1b')]()+'|'+_0x59c235[_0x15cd('0x1c')]+'|'+_0x59c235[_0x15cd('0x1d')];var _0x4dfc97=crypto['createHash'](_0x15cd('0x1e'))[_0x15cd('0x12')](_0xde561c)['digest'](_0x15cd('0x1f'));return _0x4dfc97[_0x15cd('0x20')](0x0,0x8)+'-'+_0x4dfc97[_0x15cd('0x20')](0x8,0xc)+'-'+_0x4dfc97[_0x15cd('0x20')](0xc,0x10)+'-'+_0x4dfc97[_0x15cd('0x20')](0x10,0x14)+'-'+_0x4dfc97[_0x15cd('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 04bb461..f08bf80 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 _0xdd80=['spread','util','moment','bluebird','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','version','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','message','finally','License','findOrCreate'];(function(_0x406e3e,_0x1f24a1){var _0x351c8c=function(_0x49d8e9){while(--_0x49d8e9){_0x406e3e['push'](_0x406e3e['shift']());}};_0x351c8c(++_0x1f24a1);}(_0xdd80,0x119));var _0x0dd8=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xdd80[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0x0dd8('0x0'));var moment=require(_0x0dd8('0x1'));var rp=require('request-promise');var BPromise=require(_0x0dd8('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x0dd8('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x0dd8('0x4'));var logger=require(_0x0dd8('0x5'))(_0x0dd8('0x6'));var HOST=_0x0dd8('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x12b0f5){return new BPromise(function(_0x491d01,_0x31b7c0){var _0x238c2c=util[_0x0dd8('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x12b0f5,module[_0x0dd8('0x9')][_0x0dd8('0xa')]);if(oldToken){_0x238c2c=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x12b0f5,module[_0x0dd8('0x9')]['version'],oldToken);}var _0x189562={'uri':_0x238c2c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x189562)[_0x0dd8('0xb')](function(_0x3772cd){_0x491d01(_0x3772cd);})['catch'](function(_0x196280){_0x31b7c0(_0x196280);});});}function manageLicense(_0x2664f4,_0x409af7){var _0x5d3d9b=_0x409af7[_0x0dd8('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x5d3d9b[_0x0dd8('0xd')]!==_0x2664f4&&!_0x5d3d9b[_0x0dd8('0xe')]){oldToken=_0x5d3d9b[_0x0dd8('0xd')];}httpRequest(_0x2664f4)['then'](function(_0x2b95b3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2b95b3[_0x0dd8('0xf')]){isOldTokenSent=![];if(!_0x5d3d9b['license']&&_0x5d3d9b[_0x0dd8('0x6')]!=_0x2b95b3[_0x0dd8('0x6')]||_0x5d3d9b[_0x0dd8('0x6')]&&_0x5d3d9b[_0x0dd8('0xe')]){logger[_0x0dd8('0x10')](_0x0dd8('0x11'));}if(_0x5d3d9b[_0x0dd8('0x6')]&&!_0x5d3d9b[_0x0dd8('0xe')]&&_0x5d3d9b[_0x0dd8('0x6')]!=_0x2b95b3[_0x0dd8('0x6')]){logger[_0x0dd8('0x10')](_0x0dd8('0x12'));}if(_0x5d3d9b[_0x0dd8('0x6')]&&!_0x5d3d9b[_0x0dd8('0xe')]&&_0x5d3d9b['license']==_0x2b95b3['license']){return _0x409af7;}return _0x409af7[_0x0dd8('0x13')]({'data1':_0x2664f4,'data2':null,'license':_0x2b95b3[_0x0dd8('0x6')]});}else{if(_0x2b95b3[_0x0dd8('0x6')]||_0x5d3d9b[_0x0dd8('0x6')]){if(!_0x5d3d9b['data2']){if(_0x5d3d9b[_0x0dd8('0xd')]==_0x2664f4){GRAY_PERIOD_REASON='Disabled';logger[_0x0dd8('0x10')](_0x0dd8('0x14'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x0dd8('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5d3d9b[_0x0dd8('0xd')],_0x2664f4);}logger[_0x0dd8('0x10')](_0x0dd8('0x15'),GRAY_PERIOD_REASON[_0x0dd8('0x16')](),moment()[_0x0dd8('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x409af7['update']({'data2':encryptor[_0x0dd8('0x17')](moment()[_0x0dd8('0x8')](_0x0dd8('0x18')))});}else{if(moment()[_0x0dd8('0x19')](encryptor[_0x0dd8('0x1a')](_0x5d3d9b[_0x0dd8('0xe')]),_0x0dd8('0x1b'))>DAYS){logger[_0x0dd8('0x10')]('DEMO\x20START\x20AT\x20%s',moment()[_0x0dd8('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x409af7[_0x0dd8('0x13')]({'data1':_0x2664f4,'data2':null,'license':null});}}}else{if(_0x5d3d9b['data1']!=_0x2664f4){logger[_0x0dd8('0x10')](_0x0dd8('0x1c'),_0x5d3d9b[_0x0dd8('0xd')],_0x2664f4);return _0x409af7[_0x0dd8('0x13')]({'data1':_0x2664f4,'data2':null,'license':null});}}}return _0x409af7;})[_0x0dd8('0xb')](function(_0x3c9349){_0x409af7=_0x3c9349;})[_0x0dd8('0x1d')](function(_0x230f52){logger['error'](_0x230f52[_0x0dd8('0x1e')]);})[_0x0dd8('0x1f')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x409af7);},TIME);});}function defaultLicense(){var _0x8437b5=hardware['getUuid']();if(_0x8437b5){return db[_0x0dd8('0x20')][_0x0dd8('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x8437b5}})[_0x0dd8('0x22')](function(_0x5b900f,_0x3e4630){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x8437b5);manageLicense(_0x8437b5,_0x5b900f);})['catch'](function(_0x563528){logger['error'](_0x563528['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x5e43=['encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','%s/api/servers/%s/check?version=%s','format','exports','GET','then','catch','get','data1','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0xfc0021,_0x336a32){var _0x5f392c=function(_0x45a830){while(--_0x45a830){_0xfc0021['push'](_0xfc0021['shift']());}};_0x5f392c(++_0x336a32);}(_0x5e43,0x85));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x35e4('0x0'));var moment=require('moment');var rp=require(_0x35e4('0x1'));var BPromise=require(_0x35e4('0x2'));var pkginfo=require(_0x35e4('0x3'))(module,_0x35e4('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x35e4('0x5'));var hardware=require(_0x35e4('0x6'));var logger=require(_0x35e4('0x7'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x43393e){return new BPromise(function(_0x11ee7a,_0x3f1789){var _0x52074d=util['format'](_0x35e4('0x8'),HOST,_0x43393e,module['exports'][_0x35e4('0x4')]);if(oldToken){_0x52074d=util[_0x35e4('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x43393e,module[_0x35e4('0xa')][_0x35e4('0x4')],oldToken);}var _0x308765={'uri':_0x52074d,'method':_0x35e4('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x308765)[_0x35e4('0xc')](function(_0x28c1b6){_0x11ee7a(_0x28c1b6);})[_0x35e4('0xd')](function(_0x6dc3a){_0x3f1789(_0x6dc3a);});});}function manageLicense(_0x15fe7e,_0x4dbaf9){var _0x552b45=_0x4dbaf9[_0x35e4('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x552b45['data1']!==_0x15fe7e&&!_0x552b45['data2']){oldToken=_0x552b45[_0x35e4('0xf')];}httpRequest(_0x15fe7e)[_0x35e4('0xc')](function(_0x5cdec3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5cdec3[_0x35e4('0x10')]){isOldTokenSent=![];if(!_0x552b45[_0x35e4('0x11')]&&_0x552b45[_0x35e4('0x11')]!=_0x5cdec3[_0x35e4('0x11')]||_0x552b45[_0x35e4('0x11')]&&_0x552b45[_0x35e4('0x12')]){logger[_0x35e4('0x13')](_0x35e4('0x14'));}if(_0x552b45['license']&&!_0x552b45[_0x35e4('0x12')]&&_0x552b45[_0x35e4('0x11')]!=_0x5cdec3[_0x35e4('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x552b45[_0x35e4('0x11')]&&!_0x552b45['data2']&&_0x552b45[_0x35e4('0x11')]==_0x5cdec3[_0x35e4('0x11')]){return _0x4dbaf9;}return _0x4dbaf9[_0x35e4('0x15')]({'data1':_0x15fe7e,'data2':null,'license':_0x5cdec3[_0x35e4('0x11')]});}else{if(_0x5cdec3['license']||_0x552b45[_0x35e4('0x11')]){if(!_0x552b45[_0x35e4('0x12')]){if(_0x552b45[_0x35e4('0xf')]==_0x15fe7e){GRAY_PERIOD_REASON=_0x35e4('0x16');logger[_0x35e4('0x13')](_0x35e4('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x35e4('0x13')](_0x35e4('0x18'),_0x552b45[_0x35e4('0xf')],_0x15fe7e);}logger[_0x35e4('0x13')](_0x35e4('0x19'),GRAY_PERIOD_REASON[_0x35e4('0x1a')](),moment()[_0x35e4('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x4dbaf9[_0x35e4('0x15')]({'data2':encryptor[_0x35e4('0x1b')](moment()[_0x35e4('0x9')](_0x35e4('0x1c')))});}else{if(moment()[_0x35e4('0x1d')](encryptor[_0x35e4('0x1e')](_0x552b45[_0x35e4('0x12')]),'days')>DAYS){logger[_0x35e4('0x13')](_0x35e4('0x1f'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4dbaf9[_0x35e4('0x15')]({'data1':_0x15fe7e,'data2':null,'license':null});}}}else{if(_0x552b45[_0x35e4('0xf')]!=_0x15fe7e){logger[_0x35e4('0x13')](_0x35e4('0x18'),_0x552b45[_0x35e4('0xf')],_0x15fe7e);return _0x4dbaf9['update']({'data1':_0x15fe7e,'data2':null,'license':null});}}}return _0x4dbaf9;})[_0x35e4('0xc')](function(_0x4771ec){_0x4dbaf9=_0x4771ec;})[_0x35e4('0xd')](function(_0x44d231){logger[_0x35e4('0x20')](_0x44d231[_0x35e4('0x21')]);})[_0x35e4('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x35e4('0x23')](),_0x4dbaf9);},TIME);});}function defaultLicense(){var _0x12836d=hardware[_0x35e4('0x23')]();if(_0x12836d){return db[_0x35e4('0x24')][_0x35e4('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x12836d}})[_0x35e4('0x26')](function(_0x12c57c,_0x21f56e){logger[_0x35e4('0x13')](_0x35e4('0x27'),_0x12836d);manageLicense(_0x12836d,_0x12c57c);})[_0x35e4('0xd')](function(_0x11392d){logger[_0x35e4('0x20')](_0x11392d[_0x35e4('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index fa9ddc9..8304f74 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 _0x19c7=['role','telephone','telephones','forEach','admin','user','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll'];(function(_0x311f54,_0x2f3e9e){var _0x1e0bda=function(_0x8c6268){while(--_0x8c6268){_0x311f54['push'](_0x311f54['shift']());}};_0x1e0bda(++_0x2f3e9e);}(_0x19c7,0xc3));var _0x719c=function(_0x5c7437,_0x3cabd8){_0x5c7437=_0x5c7437-0x0;var _0xf21fcd=_0x19c7[_0x5c7437];return _0xf21fcd;};'use strict';var util=require(_0x719c('0x0'));var _=require(_0x719c('0x1'));var moment=require(_0x719c('0x2'));var BPromise=require(_0x719c('0x3'));var hardware=require('./hardware');var encryptor=require(_0x719c('0x4'));var db=require(_0x719c('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x719c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x719c('0x7'),'machineUuid':hardware[_0x719c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x719c('0x9'),'machineUuid':hardware[_0x719c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1a5d2f){return new BPromise(function(_0x5e9485,_0x56eac5){return db[_0x719c('0xa')][_0x719c('0xb')](_[_0x719c('0xc')](_0x1a5d2f,{'raw':!![],'where':{'id':0x1}}))[_0x719c('0xd')](function(_0x24ad2e){return checkLicense(_0x24ad2e,null);})[_0x719c('0xd')](function(_0x3aee9f){_0x5e9485(_0x3aee9f);return;})[_0x719c('0xe')](function(_0x3108fa){_0x56eac5(_0x3108fa);});});}function checkLicense(_0x1e8443,_0x207384){if(!_0x1e8443){demoLicense[_0x719c('0xf')]=_0x1e8443[_0x719c('0x10')];return demoLicense;}try{var _0x18e4a3=_0x207384||_0x1e8443['license'];if(_[_0x719c('0x11')](_0x18e4a3)){throw new Error(_0x719c('0x12'));}var _0x9c907d=_0x1e8443[_0x719c('0x10')];var _0x40ac3a=_0x1e8443[_0x719c('0x13')];var _0x64f780=_0x9c907d[_0x719c('0x14')]('-')[0x4];var _0x1638b0=_0x9c907d[_0x719c('0x14')]('-')[0x0];var _0x4ad645=encryptor['decryptString'](_0x18e4a3,util[_0x719c('0x15')](_0x719c('0x16'),_0x64f780,_0x9c907d,_0x1638b0));var _0xb1de85=JSON[_0x719c('0x17')](_0x4ad645);_0xb1de85[_0x719c('0x18')]=![];_0xb1de85['uuid']=_0x9c907d;_0xb1de85['machineUuid']=hardware[_0x719c('0x8')]();if(_0x40ac3a){var _0x2c621b=encryptor['decryptString'](_0x40ac3a);_0xb1de85['gray']=_0x2c621b;_0xb1de85[_0x719c('0x19')]=moment(_0x2c621b)[_0x719c('0x1a')](0x7,_0x719c('0x1b'))[_0x719c('0x15')]();_0xb1de85[_0x719c('0x1c')]=_0xb1de85[_0x719c('0xf')]!=_0xb1de85[_0x719c('0x1d')]?_0x719c('0x1e'):_0x719c('0x1f');}return _0xb1de85;}catch(_0x27fe3a){breakingLicense[_0x719c('0xf')]=_0x1e8443[_0x719c('0x10')];breakingLicense[_0x719c('0x20')]=_0x27fe3a[_0x719c('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x59e467,_0x286289){getLicense()[_0x719c('0xd')](function(_0x260287){return db[_0x719c('0x21')][_0x719c('0x22')]({'attributes':['role',[db['sequelize']['fn']('COUNT',db['sequelize']['col'](_0x719c('0x23'))),'count']],'group':_0x719c('0x23'),'where':{'role':{'$or':['admin','user',_0x719c('0x24')]}},'raw':!![]})[_0x719c('0xd')](function(_0x3e6164){var _0x40750a={'user':_0x260287['users']||0x0,'telephone':_0x260287[_0x719c('0x25')]||0x0};_0x3e6164[_0x719c('0x26')](function(_0x1c60d0){var _0x556ae0=_0x1c60d0[_0x719c('0x23')]===_0x719c('0x27')?_0x719c('0x28'):_0x1c60d0[_0x719c('0x23')];_0x40750a[_0x556ae0]-=_0x1c60d0[_0x719c('0x29')];if(_0x40750a[_0x556ae0]<0x0)_0x40750a[_0x556ae0]=0x0;});_0x59e467(_0x40750a);return;});})[_0x719c('0xe')](function(_0x3677a5){_0x286289(_0x3677a5);});});}function checkUserLimits(_0x17032a){return new BPromise(function(_0x24acf9,_0x47bfdc){getLimits()[_0x719c('0xd')](function(_0xa4f3ca){var _0x21478a=_[_0x719c('0x2a')](_[_0x719c('0x2b')](_0x17032a,_0x719c('0x23')),['admin','user',_0x719c('0x24')]);var _0x53113a=(_0x21478a[_0x719c('0x27')]||0x0)+(_0x21478a[_0x719c('0x28')]||0x0);var _0x339585=_0x21478a[_0x719c('0x24')]||0x0;if(_0x53113a>_0xa4f3ca[_0x719c('0x28')])return _0x47bfdc(_0x719c('0x2c'));if(_0x339585>_0xa4f3ca[_0x719c('0x24')])return _0x47bfdc(_0x719c('0x2d'));return _0x24acf9();})[_0x719c('0xe')](function(_0x193dba){_0x47bfdc(_0x193dba);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xbe2b=['license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','add','grayReason','changed','message','User','findAll','role','sequelize','col','count','user','forEach','countBy','admin','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch','uuid','data1'];(function(_0x25e989,_0x210742){var _0xc32712=function(_0x5f09f7){while(--_0x5f09f7){_0x25e989['push'](_0x25e989['shift']());}};_0xc32712(++_0x210742);}(_0xbe2b,0x184));var _0xbbe2=function(_0x4e479d,_0x2a4c10){_0x4e479d=_0x4e479d-0x0;var _0x5d66a6=_0xbe2b[_0x4e479d];return _0x5d66a6;};'use strict';var util=require(_0xbbe2('0x0'));var _=require(_0xbbe2('0x1'));var moment=require(_0xbbe2('0x2'));var BPromise=require(_0xbbe2('0x3'));var hardware=require('./hardware');var encryptor=require(_0xbbe2('0x4'));var db=require(_0xbbe2('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbbe2('0x6'),'machineUuid':hardware[_0xbbe2('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbbe2('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbbe2('0x9'),'machineUuid':hardware[_0xbbe2('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2636f4){return new BPromise(function(_0xe7fa84,_0xdd1680){return db[_0xbbe2('0xa')][_0xbbe2('0xb')](_[_0xbbe2('0xc')](_0x2636f4,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xaaf242){return checkLicense(_0xaaf242,null);})[_0xbbe2('0xd')](function(_0x2deb73){_0xe7fa84(_0x2deb73);return;})[_0xbbe2('0xe')](function(_0x29e6f1){_0xdd1680(_0x29e6f1);});});}function checkLicense(_0x58ab5c,_0x1d0bcc){if(!_0x58ab5c){demoLicense[_0xbbe2('0xf')]=_0x58ab5c[_0xbbe2('0x10')];return demoLicense;}try{var _0x2a026a=_0x1d0bcc||_0x58ab5c[_0xbbe2('0x11')];if(_[_0xbbe2('0x12')](_0x2a026a)){throw new Error(_0xbbe2('0x13'));}var _0x5c01ce=_0x58ab5c['data1'];var _0x170b8a=_0x58ab5c['data2'];var _0x385d46=_0x5c01ce[_0xbbe2('0x14')]('-')[0x4];var _0x24e126=_0x5c01ce['split']('-')[0x0];var _0x217c7e=encryptor[_0xbbe2('0x15')](_0x2a026a,util[_0xbbe2('0x16')](_0xbbe2('0x17'),_0x385d46,_0x5c01ce,_0x24e126));var _0x5ca910=JSON[_0xbbe2('0x18')](_0x217c7e);_0x5ca910[_0xbbe2('0x19')]=![];_0x5ca910[_0xbbe2('0xf')]=_0x5c01ce;_0x5ca910[_0xbbe2('0x1a')]=hardware['getUuid']();if(_0x170b8a){var _0x3c936e=encryptor[_0xbbe2('0x15')](_0x170b8a);_0x5ca910['gray']=_0x3c936e;_0x5ca910['deadline']=moment(_0x3c936e)[_0xbbe2('0x1b')](0x7,'days')[_0xbbe2('0x16')]();_0x5ca910[_0xbbe2('0x1c')]=_0x5ca910[_0xbbe2('0xf')]!=_0x5ca910[_0xbbe2('0x1a')]?_0xbbe2('0x1d'):'disabled';}return _0x5ca910;}catch(_0x16579f){breakingLicense[_0xbbe2('0xf')]=_0x58ab5c[_0xbbe2('0x10')];breakingLicense[_0xbbe2('0x1e')]=_0x16579f[_0xbbe2('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x15e79e,_0x32c1cd){getLicense()[_0xbbe2('0xd')](function(_0x20a628){return db[_0xbbe2('0x1f')][_0xbbe2('0x20')]({'attributes':[_0xbbe2('0x21'),[db[_0xbbe2('0x22')]['fn']('COUNT',db['sequelize'][_0xbbe2('0x23')]('role')),_0xbbe2('0x24')]],'group':'role','where':{'role':{'$or':['admin',_0xbbe2('0x25'),'telephone']}},'raw':!![]})['then'](function(_0x172859){var _0x247004={'user':_0x20a628['users']||0x0,'telephone':_0x20a628['telephones']||0x0};_0x172859[_0xbbe2('0x26')](function(_0x4291f6){var _0x13ea39=_0x4291f6[_0xbbe2('0x21')]==='admin'?'user':_0x4291f6['role'];_0x247004[_0x13ea39]-=_0x4291f6['count'];if(_0x247004[_0x13ea39]<0x0)_0x247004[_0x13ea39]=0x0;});_0x15e79e(_0x247004);return;});})[_0xbbe2('0xe')](function(_0xac82cf){_0x32c1cd(_0xac82cf);});});}function checkUserLimits(_0x2dc885){return new BPromise(function(_0x5761e9,_0x2294de){getLimits()[_0xbbe2('0xd')](function(_0x6648af){var _0x299424=_['pick'](_[_0xbbe2('0x27')](_0x2dc885,_0xbbe2('0x21')),[_0xbbe2('0x28'),_0xbbe2('0x25'),'telephone']);var _0x17e5b0=(_0x299424[_0xbbe2('0x28')]||0x0)+(_0x299424[_0xbbe2('0x25')]||0x0);var _0x3a2f8c=_0x299424[_0xbbe2('0x29')]||0x0;if(_0x17e5b0>_0x6648af[_0xbbe2('0x25')])return _0x2294de(_0xbbe2('0x2a'));if(_0x3a2f8c>_0x6648af[_0xbbe2('0x29')])return _0x2294de(_0xbbe2('0x2b'));return _0x5761e9();})[_0xbbe2('0xe')](function(_0x581000){_0x2294de(_0x581000);});});}module[_0xbbe2('0x2c')]={'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 a647a3d..2a11b9d 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 _0x1c9a=['myappanuglar-secret','secret','exports'];(function(_0x269db0,_0x4e12bf){var _0xcaf518=function(_0x3be83a){while(--_0x3be83a){_0x269db0['push'](_0x269db0['shift']());}};_0xcaf518(++_0x4e12bf);}(_0x1c9a,0x98));var _0xa1c9=function(_0x1364a4,_0x147381){_0x1364a4=_0x1364a4-0x0;var _0x165c46=_0x1c9a[_0x1364a4];return _0x165c46;};'use strict';module[_0xa1c9('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xa1c9('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa1c9('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x4fba7f,_0x25aae3){var _0x22bdaa=function(_0x4ecd64){while(--_0x4ecd64){_0x4fba7f['push'](_0x4fba7f['shift']());}};_0x22bdaa(++_0x25aae3);}(_0x0120,0x6f));var _0x0012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0120[_0x501510];return _0x1e6ee5;};'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 diff --git a/server/config/logger.js b/server/config/logger.js index 00858c5..6d7872b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7233=['../utils/loggers'];(function(_0xd84f3a,_0x122ba9){var _0x14f977=function(_0x59d85f){while(--_0x59d85f){_0xd84f3a['push'](_0xd84f3a['shift']());}};_0x14f977(++_0x122ba9);}(_0x7233,0x195));var _0x3723=function(_0x341395,_0xd00c22){_0x341395=_0x341395-0x0;var _0x352a66=_0x7233[_0x341395];return _0x352a66;};'use strict';var fileLogger=require(_0x3723('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file +var _0xa500=['exports','../utils/loggers'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0xa500,0x12d));var _0x0a50=function(_0x2aebf2,_0x421d99){_0x2aebf2=_0x2aebf2-0x0;var _0x33cda6=_0xa500[_0x2aebf2];return _0x33cda6;};'use strict';var fileLogger=require(_0x0a50('0x0'))['fileLogger'];module[_0x0a50('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 17750ff..98af8e5 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 _0xf69a=['../../services/agi/index.js','routing','../../services/routing/index.js','xdr','exports','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x2eb9c4,_0x1ad2be){var _0x29e0a9=function(_0x206ebe){while(--_0x206ebe){_0x2eb9c4['push'](_0x2eb9c4['shift']());}};_0x29e0a9(++_0x1ad2be);}(_0xf69a,0x139));var _0xaf69=function(_0x16066e,_0x31e151){_0x16066e=_0x16066e-0x0;var _0x52a12e=_0xf69a[_0x16066e];return _0x52a12e;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xaf69('0x0'),'script':path[_0xaf69('0x1')](__dirname,_0xaf69('0x2'))},{'name':_0xaf69('0x3'),'script':path[_0xaf69('0x1')](__dirname,_0xaf69('0x4'))},{'name':_0xaf69('0x5'),'script':path[_0xaf69('0x1')](__dirname,_0xaf69('0x6'))},{'name':'email','script':path[_0xaf69('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xaf69('0x7'),'script':path[_0xaf69('0x1')](__dirname,_0xaf69('0x8'))},{'name':_0xaf69('0x9'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xaf69('0xa')]=config; \ No newline at end of file +var _0xc0b9=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js'];(function(_0x3759d2,_0x19472f){var _0x327c0b=function(_0x373643){while(--_0x373643){_0x3759d2['push'](_0x3759d2['shift']());}};_0x327c0b(++_0x19472f);}(_0xc0b9,0x19d));var _0x9c0b=function(_0x44c62d,_0x41626f){_0x44c62d=_0x44c62d-0x0;var _0x19d4bb=_0xc0b9[_0x44c62d];return _0x19d4bb;};'use strict';var path=require(_0x9c0b('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x9c0b('0x1')](__dirname,_0x9c0b('0x2'))},{'name':_0x9c0b('0x3'),'script':path[_0x9c0b('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x9c0b('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x9c0b('0x5'),'script':path[_0x9c0b('0x1')](__dirname,_0x9c0b('0x6'))},{'name':_0x9c0b('0x7'),'script':path[_0x9c0b('0x1')](__dirname,_0x9c0b('0x8'))},{'name':_0x9c0b('0x9'),'script':path['join'](__dirname,_0x9c0b('0xa'))}]};module[_0x9c0b('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f4501f1..637343a 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 _0xc39f=['disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','connected','start','then'];(function(_0x4569da,_0x45bec6){var _0x2791d1=function(_0x25dbf5){while(--_0x25dbf5){_0x4569da['push'](_0x4569da['shift']());}};_0x2791d1(++_0x45bec6);}(_0xc39f,0xff));var _0xfc39=function(_0x519962,_0x220674){_0x519962=_0x519962-0x0;var _0xac39ea=_0xc39f[_0x519962];return _0xac39ea;};'use strict';var pm2=require(_0xfc39('0x0'));var BPromise=require(_0xfc39('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5da954,_0x33894d){return pm2['connect'](function(_0x438501){if(_0x438501){return _0x33894d(_0x438501);}return _0x5da954(_0xfc39('0x2'));});});};exports[_0xfc39('0x3')]=function(_0x552ddb){return connect()[_0xfc39('0x4')](function(){return new BPromise(function(_0x6fe0e6,_0xa3697b){return pm2['start'](_0x552ddb,function(_0xe9ee44,_0x21a96b){if(_0xe9ee44){return _0xa3697b(_0xe9ee44);}pm2[_0xfc39('0x5')]();return _0x6fe0e6(_0x21a96b);});});});};exports[_0xfc39('0x6')]=function(_0x535a43){return connect()[_0xfc39('0x4')](function(){return new BPromise(function(_0x3feaf8,_0x3b72e4){return pm2[_0xfc39('0x6')](_0x535a43,function(_0x5b1eac,_0x39fe0d){if(_0x5b1eac){return _0x3b72e4(_0x5b1eac);}pm2[_0xfc39('0x5')]();return _0x3feaf8(_0x39fe0d);});});});};exports[_0xfc39('0x7')]=function(_0x4c290d){return connect()['then'](function(){return new BPromise(function(_0x12a886,_0x2446e3){return pm2['restart'](_0x4c290d,function(_0x6c1f4b,_0x2c10a3){if(_0x6c1f4b){return _0x2446e3(_0x6c1f4b);}pm2[_0xfc39('0x5')]();return _0x12a886(_0x2c10a3);});});});};exports[_0xfc39('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5a07c9,_0x3ac9e5){return pm2[_0xfc39('0x8')](function(_0x459b53,_0x12200f){if(_0x459b53){return _0x3ac9e5(_0x459b53);}pm2[_0xfc39('0x5')]();return _0x5a07c9(_0x12200f);});});});};exports[_0xfc39('0x9')]=function(_0x408b43){return connect()[_0xfc39('0x4')](function(){return new BPromise(function(_0x11418b,_0x53e0dd){return pm2['describe'](_0x408b43,function(_0x21001e,_0x270996){if(_0x21001e){return _0x53e0dd(_0x21001e);}pm2['disconnect']();return _0x11418b(_0x270996);});});});};exports[_0xfc39('0xa')]=function(_0x27bc8){return connect()[_0xfc39('0x4')](function(){return new BPromise(function(_0x476927,_0x262980){return pm2[_0xfc39('0xa')](_0x27bc8,function(_0x2c1229,_0x465bf9){if(_0x2c1229){return _0x262980(_0x2c1229);}pm2[_0xfc39('0x5')]();return _0x476927(_0x465bf9);});});});};exports[_0xfc39('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x368bf0,_0x2cc57e){return pm2[_0xfc39('0xb')](function(_0x263c88){if(_0x263c88){return _0x2cc57e(_0x263c88);}return _0x368bf0(_0xfc39('0xc'));});});});}; \ No newline at end of file +var _0x19f2=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x431dc7,_0x235714){var _0xea9a71=function(_0xf6971){while(--_0xf6971){_0x431dc7['push'](_0x431dc7['shift']());}};_0xea9a71(++_0x235714);}(_0x19f2,0x7a));var _0x219f=function(_0x79b53e,_0x108f8d){_0x79b53e=_0x79b53e-0x0;var _0x2d4d6c=_0x19f2[_0x79b53e];return _0x2d4d6c;};'use strict';var pm2=require(_0x219f('0x0'));var BPromise=require(_0x219f('0x1'));var config=require(_0x219f('0x2'));function connect(){return new BPromise(function(_0x568330,_0xde2d1a){return pm2[_0x219f('0x3')](function(_0xe08dc0){if(_0xe08dc0){return _0xde2d1a(_0xe08dc0);}return _0x568330('connected');});});};exports[_0x219f('0x4')]=function(_0x85542d){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x5083f4,_0x40170c){return pm2[_0x219f('0x4')](_0x85542d,function(_0x1538ac,_0x383bb8){if(_0x1538ac){return _0x40170c(_0x1538ac);}pm2[_0x219f('0x6')]();return _0x5083f4(_0x383bb8);});});});};exports[_0x219f('0x7')]=function(_0x32fd59){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x32d221,_0x107598){return pm2[_0x219f('0x7')](_0x32fd59,function(_0x18bccf,_0xd879d4){if(_0x18bccf){return _0x107598(_0x18bccf);}pm2[_0x219f('0x6')]();return _0x32d221(_0xd879d4);});});});};exports['restart']=function(_0x22f733){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x3dc044,_0x143b4f){return pm2[_0x219f('0x8')](_0x22f733,function(_0x42d32d,_0x180c30){if(_0x42d32d){return _0x143b4f(_0x42d32d);}pm2['disconnect']();return _0x3dc044(_0x180c30);});});});};exports[_0x219f('0x9')]=function(){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x53d809,_0x181d92){return pm2[_0x219f('0x9')](function(_0x2e6136,_0xabd777){if(_0x2e6136){return _0x181d92(_0x2e6136);}pm2[_0x219f('0x6')]();return _0x53d809(_0xabd777);});});});};exports[_0x219f('0xa')]=function(_0x4f71b1){return connect()[_0x219f('0x5')](function(){return new BPromise(function(_0x3eff75,_0x26bf3d){return pm2[_0x219f('0xa')](_0x4f71b1,function(_0x55791,_0x1d2343){if(_0x55791){return _0x26bf3d(_0x55791);}pm2[_0x219f('0x6')]();return _0x3eff75(_0x1d2343);});});});};exports[_0x219f('0xb')]=function(_0x702e07){return connect()['then'](function(){return new BPromise(function(_0x4fc1a3,_0x3a1e0f){return pm2['delete'](_0x702e07,function(_0x57769d,_0x2a8435){if(_0x57769d){return _0x3a1e0f(_0x57769d);}pm2[_0x219f('0x6')]();return _0x4fc1a3(_0x2a8435);});});});};exports[_0x219f('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1ef0c4,_0x1ed4a9){return pm2[_0x219f('0xc')](function(_0x33c9e0){if(_0x33c9e0){return _0x1ed4a9(_0x33c9e0);}return _0x1ef0c4(_0x219f('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a89292f..05e9fbf 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 _0x888c=['error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x888c,0x67));var _0xc888=function(_0x206324,_0x39de2c){_0x206324=_0x206324-0x0;var _0x20a964=_0x888c[_0x206324];return _0x20a964;};'use strict';var _=require(_0xc888('0x0'));var moment=require(_0xc888('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xc888('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc888('0x3'))(_0xc888('0x4'));config[_0xc888('0x5')]=_[_0xc888('0x6')](config[_0xc888('0x5')],{'host':_0xc888('0x7'),'port':0x18eb});var io=require(_0xc888('0x8'))(new Redis(config[_0xc888('0x5')]));function closeInteractions(){var _0x29e5c1=0x0;var _0x5f3407=[];return db['Setting'][_0xc888('0x9')]({'raw':!![],'attributes':['id',_0xc888('0xa')],'where':{'id':0x1}})['then'](function(_0xd84744){_0x29e5c1=_0xd84744[_0xc888('0xa')];if(_0x29e5c1){return db[_0xc888('0xb')][_0xc888('0xc')]({'raw':!![],'attributes':['id',_0xc888('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc888('0xe')](_0xd84744[_0xc888('0xa')],_0xc888('0xf'))}}});}else{return[];}})[_0xc888('0x10')](function(_0x528449){if(_0x528449&&_0x528449[_0xc888('0x11')]){_0x5f3407=_[_0xc888('0x12')](_0x528449||[],'id');logger[_0xc888('0x13')](_0xc888('0x14'),_0x5f3407['join']());return db[_0xc888('0xb')]['update']({'closeReason':_0xc888('0x15'),'disposition':_0xc888('0x16'),'closed':!![],'closedAt':moment()['format'](_0xc888('0x17'))},{'where':{'id':_0x5f3407}});}})[_0xc888('0x10')](function(){if(_0x5f3407&&_0x5f3407['length']){logger[_0xc888('0x13')](_0xc888('0x18'),_0x5f3407[_0xc888('0x19')]());for(var _0x17f977=0x0;_0x17f977<_0x5f3407[_0xc888('0x11')];_0x17f977++){io[_0xc888('0x1a')](_0xc888('0x1b'),{'id':_0x5f3407[_0x17f977],'closed':!![]});}}})[_0xc888('0x1c')](function(_0x1ceb95){logger[_0xc888('0x1d')](_0xc888('0x1e'),_0x1ceb95?util[_0xc888('0x1f')](_0x1ceb95,{'showHidden':![],'depth':null}):'');});}exports[_0xc888('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf605=['start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','info','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x540d65,_0x489f77){var _0x7dbd5a=function(_0x4a916d){while(--_0x4a916d){_0x540d65['push'](_0x540d65['shift']());}};_0x7dbd5a(++_0x489f77);}(_0xf605,0x9c));var _0x5f60=function(_0xf6b8e7,_0xaea5cd){_0xf6b8e7=_0xf6b8e7-0x0;var _0x5b7563=_0xf605[_0xf6b8e7];return _0x5b7563;};'use strict';var _=require(_0x5f60('0x0'));var moment=require('moment');var Redis=require(_0x5f60('0x1'));var util=require(_0x5f60('0x2'));var config=require(_0x5f60('0x3'));var db=require(_0x5f60('0x4'))['db'];var logger=require(_0x5f60('0x5'))('schedule');config[_0x5f60('0x6')]=_[_0x5f60('0x7')](config[_0x5f60('0x6')],{'host':_0x5f60('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5f60('0x6')]));function closeInteractions(){var _0x23f4c2=0x0;var _0x18974d=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x57d854){_0x23f4c2=_0x57d854[_0x5f60('0x9')];if(_0x23f4c2){return db[_0x5f60('0xa')][_0x5f60('0xb')]({'raw':!![],'attributes':['id',_0x5f60('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5f60('0xd')](_0x57d854[_0x5f60('0x9')],_0x5f60('0xe'))}}});}else{return[];}})[_0x5f60('0xf')](function(_0x1c7a39){if(_0x1c7a39&&_0x1c7a39['length']){_0x18974d=_[_0x5f60('0x10')](_0x1c7a39||[],'id');logger[_0x5f60('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x18974d[_0x5f60('0x12')]());return db['ChatInteraction'][_0x5f60('0x13')]({'closeReason':'system','disposition':_0x5f60('0x14'),'closed':!![],'closedAt':moment()[_0x5f60('0x15')](_0x5f60('0x16'))},{'where':{'id':_0x18974d}});}})[_0x5f60('0xf')](function(){if(_0x18974d&&_0x18974d[_0x5f60('0x17')]){logger[_0x5f60('0x11')](_0x5f60('0x18'),_0x18974d['join']());for(var _0x13a76d=0x0;_0x13a76d<_0x18974d[_0x5f60('0x17')];_0x13a76d++){io['emit'](_0x5f60('0x19'),{'id':_0x18974d[_0x13a76d],'closed':!![]});}}})[_0x5f60('0x1a')](function(_0x2e9e9d){logger[_0x5f60('0x1b')](_0x5f60('0x1c'),_0x2e9e9d?util[_0x5f60('0x1d')](_0x2e9e9d,{'showHidden':![],'depth':null}):'');});}exports[_0x5f60('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 639229d..e11b2eb 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 _0x207d=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x18d191,_0x49d54d){var _0x11dd16=function(_0x2f96ae){while(--_0x2f96ae){_0x18d191['push'](_0x18d191['shift']());}};_0x11dd16(++_0x49d54d);}(_0x207d,0x1dd));var _0xd207=function(_0x4a0769,_0x5eaa46){_0x4a0769=_0x4a0769-0x0;var _0x12401b=_0x207d[_0x4a0769];return _0x12401b;};'use strict';function start(){var _0x17f536=require(_0xd207('0x0'));return _0x17f536[_0xd207('0x1')]();}module[_0xd207('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf9e5=['exports'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xf9e5,0x1d3));var _0x5f9e=function(_0xdb4941,_0x5ddc54){_0xdb4941=_0xdb4941-0x0;var _0x2b3770=_0xf9e5[_0xdb4941];return _0x2b3770;};'use strict';function start(){var _0x4f5d05=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4f5d05['startAllRefreshIntervals']();}module[_0x5f9e('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index f933c03..47e41ff 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 _0xf7dc=['catch','error','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add\x20cron','stop\x20cron','update','update\x20cron','util','path','lodash','moment','cron-job-manager','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','email','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error\x20mail','email\x20sent'];(function(_0xcc74d2,_0x4cd185){var _0x195fc2=function(_0x5c3920){while(--_0x5c3920){_0xcc74d2['push'](_0xcc74d2['shift']());}};_0x195fc2(++_0x4cd185);}(_0xf7dc,0x1d9));var _0xcf7d=function(_0x2b48f3,_0x2358b9){_0x2b48f3=_0x2b48f3-0x0;var _0x12d975=_0xf7dc[_0x2b48f3];return _0x12d975;};'use strict';var fs=require('fs');var util=require(_0xcf7d('0x0'));var path=require(_0xcf7d('0x1'));var _=require(_0xcf7d('0x2'));var moment=require(_0xcf7d('0x3'));var CronJobManager=require(_0xcf7d('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../logger')(_0xcf7d('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xcf7d('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xcf7d('0x7')][_0xcf7d('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3e0c29,_0x53b3df){return function(){logger['info'](_0xcf7d('0x9'),_0x3e0c29['email']);var _0x23b957=!![];var _0x234094=_0x3e0c29[_0xcf7d('0xa')][_0xcf7d('0xb')]();var _0x5ce4fa={'account':_0x234094,'message':{'from':util[_0xcf7d('0xc')](_0xcf7d('0xd'),_0x3e0c29['MailAccount'][_0xcf7d('0xe')],_0x3e0c29[_0xcf7d('0xa')]['email']||_0x3e0c29[_0xcf7d('0xa')][_0xcf7d('0xf')][_0xcf7d('0x10')]),'to':_0x3e0c29[_0xcf7d('0x11')],'cc':_0x3e0c29['cc'],'bcc':_0x3e0c29['bcc'],'subject':util['format'](_0xcf7d('0x12'),_0x53b3df[_0xcf7d('0xe')],_0x3e0c29['subtractNumber'],_0x3e0c29[_0xcf7d('0x13')])}};var _0xe565dd=path[_0xcf7d('0x14')](__dirname,_0xcf7d('0x15'));var _0x160ce3=_0x53b3df[_0xcf7d('0x16')];var _0x413b0d=util['format'](_0xcf7d('0x17'),path[_0xcf7d('0x18')](_0x53b3df[_0xcf7d('0x16')],path[_0xcf7d('0x19')](_0x53b3df['savename'])),_0xcf7d('0x1a'));var _0x193ea2=path[_0xcf7d('0x14')](_0xe565dd,_0x160ce3);var _0x3e775b=path[_0xcf7d('0x14')](_0xe565dd,_0x413b0d);if(fs['existsSync'](_0x193ea2)){_0x53b3df[_0xcf7d('0x1b')]=_0xcf7d('0x1c');_0x5ce4fa['message'][_0xcf7d('0x1d')]=[{'filename':_0x160ce3,'path':_0x193ea2}];_0x5ce4fa[_0xcf7d('0x1e')][_0xcf7d('0x1f')]=util['format'](_0xcf7d('0x20'),JSON[_0xcf7d('0x21')](_0x53b3df,null,0x2));}else if(fs[_0xcf7d('0x22')](_0x3e775b)){_0x53b3df[_0xcf7d('0x1b')]='Sent';_0x5ce4fa[_0xcf7d('0x1e')][_0xcf7d('0x1d')]=[{'filename':_0x413b0d,'path':_0x3e775b}];}else{_0x5ce4fa[_0xcf7d('0x1e')][_0xcf7d('0x1f')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3e0c29[_0xcf7d('0x23')]){_0x23b957=![];logger[_0xcf7d('0x24')](_0xcf7d('0x25'));}}if(_0x23b957){return client[_0xcf7d('0x26')](_0xcf7d('0x27'),_0x5ce4fa)[_0xcf7d('0x28')](function(_0x255796){if(_0x255796['error']){return logger['error'](_0xcf7d('0x29'),JSON['stringify'](_0x255796));}return logger[_0xcf7d('0x24')](_0xcf7d('0x2a'));})[_0xcf7d('0x2b')](function(_0x110cae){return logger['error'](_0xcf7d('0x29'),JSON[_0xcf7d('0x21')](_0x110cae));});}};}function handleError(){return function(_0x1d6cdb){return logger[_0xcf7d('0x2c')](JSON[_0xcf7d('0x21')](_0x1d6cdb));};}function handleResult(_0xf0e5df){return function(_0x22612c){logger['info']('data',JSON['stringify'](_0x22612c));if(_0xf0e5df[_0xcf7d('0xa')]&&_0xf0e5df['MailAccount'][_0xcf7d('0xf')]&&!_[_0xcf7d('0x2d')](_0xf0e5df[_0xcf7d('0x11')])){setTimeout(handleSendEmail(_0xf0e5df,_0x22612c),0x3c*0x3e8);}};}function handleJob(_0x4bfdb7){return function(){try{if(_[_0xcf7d('0x2d')](_0x4bfdb7['subtractNumber'])){return logger[_0xcf7d('0x24')](_0xcf7d('0x2e'));}if(_[_0xcf7d('0x2d')](_0x4bfdb7[_0xcf7d('0x13')])){return logger[_0xcf7d('0x24')](_0xcf7d('0x2f'));}var _0x3ba760={'startDate':moment()[_0xcf7d('0x30')](_0x4bfdb7[_0xcf7d('0x31')],_0x4bfdb7[_0xcf7d('0x13')])[_0xcf7d('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xcf7d('0xc')](_0xcf7d('0x32')),'type':'scheduled','output':_0x4bfdb7[_0xcf7d('0x33')],'name':_0x4bfdb7[_0xcf7d('0xe')]};if(!_['isNil'](_0x4bfdb7['DefaultReportId'])){logger[_0xcf7d('0x24')](_0xcf7d('0x34'),_0x4bfdb7['DefaultReportId']);return analyticDefaultReportController[_0xcf7d('0x35')]({'id':_0x4bfdb7[_0xcf7d('0x36')]},_0x3ba760)[_0xcf7d('0x28')](handleResult(_0x4bfdb7))['catch'](handleError());}if(!_['isNil'](_0x4bfdb7[_0xcf7d('0x37')])){logger[_0xcf7d('0x24')](_0xcf7d('0x38'),_0x4bfdb7[_0xcf7d('0x37')]);return analyticCustomReportController['runReport']({'id':_0x4bfdb7['CustomReportId']},_0x3ba760)[_0xcf7d('0x28')](handleResult(_0x4bfdb7))[_0xcf7d('0x2b')](handleError());}}catch(_0x514910){logger[_0xcf7d('0x2c')](JSON[_0xcf7d('0x21')](_0x514910));}return logger[_0xcf7d('0x24')](_0xcf7d('0x39'));};}function getJobs(_0xdf1ab){var _0x1c19f6={};if(_0xdf1ab){_0x1c19f6['id']=_0xdf1ab;}return db[_0xcf7d('0x3a')][_0xcf7d('0x3b')]({'where':_0x1c19f6,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db[_0xcf7d('0x3c')],'as':_0xcf7d('0xf'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})['then'](function(_0x489845){var _0x217b69=_[_0xcf7d('0x3d')](manager['jobs']);var _0x8b7c26=_[_0xcf7d('0x3e')](_0x489845,function(_0x35c885){return _0x35c885['id'][_0xcf7d('0x3f')]();});var _0x5df561=_[_0xcf7d('0x40')](_0x489845,function(_0xfe7ef7){return _0xfe7ef7['id']['toString']();});var _0x3e59b0=_0xdf1ab?_0x8b7c26:_[_0xcf7d('0x41')](_0x8b7c26,_0x217b69);var _0x315791=_[_0xcf7d('0x42')](_0x8b7c26,_0x217b69);var _0x3d56fe=_[_0xcf7d('0x41')](_0x217b69,_0x8b7c26);var _0x51da4c;var _0x45fbc1;for(_0x51da4c=0x0;_0x51da4c<_0x3d56fe['length']&&!_0xdf1ab;_0x51da4c+=0x1){_0x45fbc1=_0x3d56fe[_0x51da4c]['toString']();if(manager[_0xcf7d('0x43')](_0x45fbc1)){manager[_0xcf7d('0x44')](_0x45fbc1);manager[_0xcf7d('0x45')](_0x45fbc1);logger[_0xcf7d('0x24')](_0xcf7d('0x46'),_0x45fbc1);}}logger[_0xcf7d('0x24')](_0xcf7d('0x47'),JSON[_0xcf7d('0x21')](_0x3e59b0));for(_0x51da4c=0x0;_0x51da4c<_0x3e59b0[_0xcf7d('0x48')];_0x51da4c+=0x1){_0x45fbc1=_0x3e59b0[_0x51da4c][_0xcf7d('0x3f')]();logger[_0xcf7d('0x24')](_0xcf7d('0x49'),_0x45fbc1);if(_0xdf1ab){logger[_0xcf7d('0x24')](_0xcf7d('0x4a'),_0xdf1ab);logger[_0xcf7d('0x24')](JSON[_0xcf7d('0x21')](_0x5df561[_0x45fbc1]));BPromise[_0xcf7d('0x4b')]()[_0xcf7d('0x28')](handleJob(_0x5df561[_0x45fbc1]));logger[_0xcf7d('0x24')](_0xcf7d('0x4c'),_0x5df561[_0x45fbc1][_0xcf7d('0xe')],_0x5df561[_0x45fbc1][_0xcf7d('0x4d')]);}else if(_0x5df561[_0x45fbc1][_0xcf7d('0x4d')]&&_0x5df561[_0x45fbc1][_0xcf7d('0x4e')]&&moment()[_0xcf7d('0x4f')](_0x5df561[_0x45fbc1][_0xcf7d('0x50')],_0x5df561[_0x45fbc1][_0xcf7d('0x51')])){manager['add'](_0x45fbc1,_0x5df561[_0x45fbc1][_0xcf7d('0x4d')],handleJob(_0x5df561[_0x45fbc1]));manager['start'](_0x45fbc1);logger[_0xcf7d('0x24')](_0xcf7d('0x52'),_0x5df561[_0x45fbc1]['name'],_0x5df561[_0x45fbc1][_0xcf7d('0x4d')]);}else if(manager[_0xcf7d('0x43')](_0x45fbc1)){manager[_0xcf7d('0x44')](_0x45fbc1);manager[_0xcf7d('0x45')](_0x45fbc1);logger['info'](_0xcf7d('0x53'),_0x5df561[_0x45fbc1]['name'],_0x5df561[_0x45fbc1][_0xcf7d('0x4d')]);}}for(_0x51da4c=0x0,_0x45fbc1;_0x51da4c<_0x315791[_0xcf7d('0x48')]&&!_0xdf1ab;_0x51da4c+=0x1){_0x45fbc1=_0x315791[_0x51da4c][_0xcf7d('0x3f')]();if(manager[_0xcf7d('0x43')](_0x45fbc1)){if(_0x5df561[_0x45fbc1][_0xcf7d('0x4d')]&&_0x5df561[_0x45fbc1]['active']&&moment()['isBetween'](_0x5df561[_0x45fbc1][_0xcf7d('0x50')],_0x5df561[_0x45fbc1][_0xcf7d('0x51')])){manager[_0xcf7d('0x54')](_0x45fbc1,_0x5df561[_0x45fbc1][_0xcf7d('0x4d')],handleJob(_0x5df561[_0x45fbc1]));logger[_0xcf7d('0x24')](_0xcf7d('0x55'),_0x5df561[_0x45fbc1][_0xcf7d('0xe')],_0x5df561[_0x45fbc1]['cron']);}else{manager[_0xcf7d('0x44')](_0x45fbc1);manager[_0xcf7d('0x45')](_0x45fbc1);logger[_0xcf7d('0x24')]('stop\x20cron',_0x5df561[_0x45fbc1]['name'],_0x5df561[_0x45fbc1]['cron']);}}}})[_0xcf7d('0x2b')](function(_0x5c528f){logger[_0xcf7d('0x2c')](JSON[_0xcf7d('0x21')](_0x5c528f));});}exports['run']=function(_0x164b3b){return getJobs(_0x164b3b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe20e=['data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','stop','toRun','index','my\x20id','run\x20job','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','cron','update','update\x20cron','stop\x20cron','run','path','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail'];(function(_0x3d32c5,_0x8a7bcb){var _0x5b3d3f=function(_0x27221f){while(--_0x27221f){_0x3d32c5['push'](_0x3d32c5['shift']());}};_0x5b3d3f(++_0x8a7bcb);}(_0xe20e,0x1ed));var _0xee20=function(_0x45bfbc,_0x1ff15e){_0x45bfbc=_0x45bfbc-0x0;var _0x407018=_0xe20e[_0x45bfbc];return _0x407018;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xee20('0x0'));var _=require('lodash');var moment=require(_0xee20('0x1'));var CronJobManager=require(_0xee20('0x2'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xee20('0x3'))(_0xee20('0x4'));var db=require(_0xee20('0x5'))['db'];var analyticCustomReportController=require(_0xee20('0x6'));var analyticDefaultReportController=require(_0xee20('0x7'));var client=jayson[_0xee20('0x8')][_0xee20('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x544d4b,_0x2924fe){return function(){logger[_0xee20('0xa')](_0xee20('0xb'),_0x544d4b[_0xee20('0xc')]);var _0x4717ba=!![];var _0x35eae8=_0x544d4b[_0xee20('0xd')][_0xee20('0xe')]();var _0x557dc5={'account':_0x35eae8,'message':{'from':util['format'](_0xee20('0xf'),_0x544d4b[_0xee20('0xd')][_0xee20('0x10')],_0x544d4b[_0xee20('0xd')][_0xee20('0xc')]||_0x544d4b[_0xee20('0xd')][_0xee20('0x11')][_0xee20('0x12')]),'to':_0x544d4b['email'],'cc':_0x544d4b['cc'],'bcc':_0x544d4b['bcc'],'subject':util[_0xee20('0x13')](_0xee20('0x14'),_0x2924fe[_0xee20('0x10')],_0x544d4b[_0xee20('0x15')],_0x544d4b[_0xee20('0x16')])}};var _0x3e5478=path[_0xee20('0x17')](__dirname,_0xee20('0x18'));var _0x37f294=_0x2924fe[_0xee20('0x19')];var _0xa6587e=util[_0xee20('0x13')](_0xee20('0x1a'),path[_0xee20('0x1b')](_0x2924fe['savename'],path[_0xee20('0x1c')](_0x2924fe[_0xee20('0x19')])),_0xee20('0x1d'));var _0x1d6341=path[_0xee20('0x17')](_0x3e5478,_0x37f294);var _0x1cf61b=path[_0xee20('0x17')](_0x3e5478,_0xa6587e);if(fs[_0xee20('0x1e')](_0x1d6341)){_0x2924fe['status']=_0xee20('0x1f');_0x557dc5[_0xee20('0x20')][_0xee20('0x21')]=[{'filename':_0x37f294,'path':_0x1d6341}];_0x557dc5[_0xee20('0x20')][_0xee20('0x22')]=util[_0xee20('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xee20('0x23')](_0x2924fe,null,0x2));}else if(fs[_0xee20('0x1e')](_0x1cf61b)){_0x2924fe[_0xee20('0x24')]=_0xee20('0x1f');_0x557dc5[_0xee20('0x20')]['attachments']=[{'filename':_0xa6587e,'path':_0x1cf61b}];}else{_0x557dc5[_0xee20('0x20')]['text']=_0xee20('0x25');if(!_0x544d4b[_0xee20('0x26')]){_0x4717ba=![];logger[_0xee20('0xa')](_0xee20('0x27'));}}if(_0x4717ba){return client[_0xee20('0x28')](_0xee20('0x29'),_0x557dc5)[_0xee20('0x2a')](function(_0x3024d3){if(_0x3024d3[_0xee20('0x2b')]){return logger[_0xee20('0x2b')]('error\x20mail',JSON[_0xee20('0x23')](_0x3024d3));}return logger[_0xee20('0xa')](_0xee20('0x2c'));})[_0xee20('0x2d')](function(_0x3ee843){return logger['error'](_0xee20('0x2e'),JSON[_0xee20('0x23')](_0x3ee843));});}};}function handleError(){return function(_0x4ec5f6){return logger[_0xee20('0x2b')](JSON[_0xee20('0x23')](_0x4ec5f6));};}function handleResult(_0x367180){return function(_0x2fb27e){logger['info'](_0xee20('0x2f'),JSON[_0xee20('0x23')](_0x2fb27e));if(_0x367180[_0xee20('0xd')]&&_0x367180[_0xee20('0xd')]['Smtp']&&!_[_0xee20('0x30')](_0x367180[_0xee20('0xc')])){setTimeout(handleSendEmail(_0x367180,_0x2fb27e),0x3c*0x3e8);}};}function handleJob(_0x36922d){return function(){try{if(_[_0xee20('0x30')](_0x36922d[_0xee20('0x15')])){return logger['info'](_0xee20('0x31'));}if(_[_0xee20('0x30')](_0x36922d[_0xee20('0x16')])){return logger[_0xee20('0xa')](_0xee20('0x32'));}var _0xec92d0={'startDate':moment()[_0xee20('0x33')](_0x36922d[_0xee20('0x15')],_0x36922d['subtractUnit'])['format'](_0xee20('0x34')),'endDate':moment()['format'](_0xee20('0x34')),'type':_0xee20('0x35'),'output':_0x36922d[_0xee20('0x36')],'name':_0x36922d['name']};if(!_['isNil'](_0x36922d[_0xee20('0x37')])){logger[_0xee20('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x36922d[_0xee20('0x37')]);return analyticDefaultReportController['runReport']({'id':_0x36922d[_0xee20('0x37')]},_0xec92d0)[_0xee20('0x2a')](handleResult(_0x36922d))['catch'](handleError());}if(!_[_0xee20('0x30')](_0x36922d[_0xee20('0x38')])){logger['info'](_0xee20('0x39'),_0x36922d[_0xee20('0x38')]);return analyticCustomReportController[_0xee20('0x3a')]({'id':_0x36922d[_0xee20('0x38')]},_0xec92d0)[_0xee20('0x2a')](handleResult(_0x36922d))[_0xee20('0x2d')](handleError());}}catch(_0x1ef802){logger[_0xee20('0x2b')](JSON[_0xee20('0x23')](_0x1ef802));}return logger['info'](_0xee20('0x3b'));};}function getJobs(_0x2039cc){var _0x5a406a={};if(_0x2039cc){_0x5a406a['id']=_0x2039cc;}return db[_0xee20('0x3c')][_0xee20('0x3d')]({'where':_0x5a406a,'include':[{'model':db[_0xee20('0xd')],'attributes':['id','name',_0xee20('0xc')],'include':[{'model':db[_0xee20('0x3e')],'as':'Smtp','include':[{'model':db[_0xee20('0x3f')],'as':_0xee20('0x3f')}]}]}]})[_0xee20('0x2a')](function(_0x392500){var _0x3795d6=_[_0xee20('0x40')](manager[_0xee20('0x41')]);var _0x4ea684=_[_0xee20('0x42')](_0x392500,function(_0x4de5c5){return _0x4de5c5['id'][_0xee20('0x43')]();});var _0x1d018f=_['keyBy'](_0x392500,function(_0x44607e){return _0x44607e['id']['toString']();});var _0x371c48=_0x2039cc?_0x4ea684:_[_0xee20('0x44')](_0x4ea684,_0x3795d6);var _0x17670d=_[_0xee20('0x45')](_0x4ea684,_0x3795d6);var _0x3cc195=_[_0xee20('0x44')](_0x3795d6,_0x4ea684);var _0x5e2754;var _0x2a2fb2;for(_0x5e2754=0x0;_0x5e2754<_0x3cc195[_0xee20('0x46')]&&!_0x2039cc;_0x5e2754+=0x1){_0x2a2fb2=_0x3cc195[_0x5e2754][_0xee20('0x43')]();if(manager[_0xee20('0x47')](_0x2a2fb2)){manager[_0xee20('0x48')](_0x2a2fb2);manager['deleteJob'](_0x2a2fb2);logger[_0xee20('0xa')]('delete\x20cron',_0x2a2fb2);}}logger[_0xee20('0xa')](_0xee20('0x49'),JSON[_0xee20('0x23')](_0x371c48));for(_0x5e2754=0x0;_0x5e2754<_0x371c48[_0xee20('0x46')];_0x5e2754+=0x1){_0x2a2fb2=_0x371c48[_0x5e2754][_0xee20('0x43')]();logger['info'](_0xee20('0x4a'),_0x2a2fb2);if(_0x2039cc){logger[_0xee20('0xa')](_0xee20('0x4b'),_0x2039cc);logger[_0xee20('0xa')](JSON[_0xee20('0x23')](_0x1d018f[_0x2a2fb2]));BPromise['resolve']()[_0xee20('0x2a')](handleJob(_0x1d018f[_0x2a2fb2]));logger[_0xee20('0xa')](_0xee20('0x4c'),_0x1d018f[_0x2a2fb2][_0xee20('0x10')],_0x1d018f[_0x2a2fb2]['cron']);}else if(_0x1d018f[_0x2a2fb2]['cron']&&_0x1d018f[_0x2a2fb2][_0xee20('0x4d')]&&moment()[_0xee20('0x4e')](_0x1d018f[_0x2a2fb2][_0xee20('0x4f')],_0x1d018f[_0x2a2fb2][_0xee20('0x50')])){manager[_0xee20('0x51')](_0x2a2fb2,_0x1d018f[_0x2a2fb2]['cron'],handleJob(_0x1d018f[_0x2a2fb2]));manager[_0xee20('0x52')](_0x2a2fb2);logger['info'](_0xee20('0x53'),_0x1d018f[_0x2a2fb2]['name'],_0x1d018f[_0x2a2fb2]['cron']);}else if(manager[_0xee20('0x47')](_0x2a2fb2)){manager[_0xee20('0x48')](_0x2a2fb2);manager[_0xee20('0x54')](_0x2a2fb2);logger[_0xee20('0xa')]('stop\x20cron',_0x1d018f[_0x2a2fb2][_0xee20('0x10')],_0x1d018f[_0x2a2fb2][_0xee20('0x55')]);}}for(_0x5e2754=0x0,_0x2a2fb2;_0x5e2754<_0x17670d[_0xee20('0x46')]&&!_0x2039cc;_0x5e2754+=0x1){_0x2a2fb2=_0x17670d[_0x5e2754][_0xee20('0x43')]();if(manager[_0xee20('0x47')](_0x2a2fb2)){if(_0x1d018f[_0x2a2fb2][_0xee20('0x55')]&&_0x1d018f[_0x2a2fb2][_0xee20('0x4d')]&&moment()['isBetween'](_0x1d018f[_0x2a2fb2][_0xee20('0x4f')],_0x1d018f[_0x2a2fb2][_0xee20('0x50')])){manager[_0xee20('0x56')](_0x2a2fb2,_0x1d018f[_0x2a2fb2][_0xee20('0x55')],handleJob(_0x1d018f[_0x2a2fb2]));logger[_0xee20('0xa')](_0xee20('0x57'),_0x1d018f[_0x2a2fb2][_0xee20('0x10')],_0x1d018f[_0x2a2fb2][_0xee20('0x55')]);}else{manager[_0xee20('0x48')](_0x2a2fb2);manager[_0xee20('0x54')](_0x2a2fb2);logger[_0xee20('0xa')](_0xee20('0x58'),_0x1d018f[_0x2a2fb2]['name'],_0x1d018f[_0x2a2fb2][_0xee20('0x55')]);}}}})[_0xee20('0x2d')](function(_0x4e781d){logger[_0xee20('0x2b')](JSON['stringify'](_0x4e781d));});}exports[_0xee20('0x59')]=function(_0x3fdeeb){return getJobs(_0x3fdeeb);};exports[_0xee20('0x52')]=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 0016b60..f4fa50a 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 _0x32d5=['TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','findOne','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','format','transcribeName','data1','data2','transcribeRegion','then','info'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0x32d5,0x1aa));var _0x532d=function(_0x19b594,_0x2d7cb7){_0x19b594=_0x19b594-0x0;var _0x3d529a=_0x32d5[_0x19b594];return _0x3d529a;};var _=require(_0x532d('0x0'));var AWS=require(_0x532d('0x1'));var rp=require(_0x532d('0x2'));var util=require(_0x532d('0x3'));var BPromise=require(_0x532d('0x4'));var db=require(_0x532d('0x5'))['db'];var logger=require(_0x532d('0x6'))('transcribe');function getTranscriptionJob(_0x2f0e4c,_0x309316,_0x4f87d1,_0x219056){return new Promise(function(_0x2b1142,_0x2995e2){var _0x20104e=new AWS[(_0x532d('0x7'))]({'accessKeyId':_0x309316,'secretAccessKey':_0x2f0e4c,'region':_0x4f87d1});_0x20104e['getTranscriptionJob']({'TranscriptionJobName':_0x219056},function(_0x4f3d4e,_0x445220){if(_0x4f3d4e){return _0x2995e2(_0x4f3d4e);}else{return _0x2b1142(_0x445220);}});});}function sentiment(_0x54ccf5,_0x3d28ac,_0x23ee37,_0x2e1875,_0x45b5df){return new Promise(function(_0x6aee76,_0x414ac1){var _0x24d5b4=new AWS[(_0x532d('0x8'))]({'accessKeyId':_0x3d28ac,'secretAccessKey':_0x54ccf5,'region':_0x23ee37});_0x24d5b4[_0x532d('0x9')]({'Text':_0x2e1875,'LanguageCode':_0x45b5df[_0x532d('0xa')](0x0,0x2)},function(_0x364601,_0x43d9f9){if(_0x364601){return _0x414ac1(_0x364601);}else{return _0x6aee76(_0x43d9f9);}});});}function checkTranscribeJob(_0x5917be,_0x257823,_0x2b9da7){var _0x27714e;return new BPromise(function(_0x255ba7,_0x3bca06){logger['info'](util[_0x532d('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5917be['id'],_0x5917be[_0x532d('0xc')]));return getTranscriptionJob(_0x2b9da7[_0x532d('0xd')],_0x2b9da7[_0x532d('0xe')],_0x257823[_0x532d('0xf')],_0x5917be[_0x532d('0xc')])[_0x532d('0x10')](function(_0x3747e4){logger[_0x532d('0x11')](util[_0x532d('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5917be['id'],_0x5917be[_0x532d('0xc')],_0x3747e4[_0x532d('0x12')][_0x532d('0x13')]));if(!_0x5917be[_0x532d('0x14')]){switch(_0x3747e4[_0x532d('0x12')][_0x532d('0x13')]){case _0x532d('0x15'):var _0x2ee70f={'transcribeStatus':_0x3747e4[_0x532d('0x12')]['TranscriptionJobStatus'],'fileUri':_0x3747e4[_0x532d('0x12')][_0x532d('0x16')][_0x532d('0x17')]};logger[_0x532d('0x11')](util[_0x532d('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x5917be['id']));return rp({'uri':_0x3747e4[_0x532d('0x12')][_0x532d('0x16')][_0x532d('0x17')],'json':!![]})[_0x532d('0x10')](function(_0x22b6a6){logger['info'](util['format'](_0x532d('0x18'),_0x5917be['id']));if(_0x22b6a6&&_0x22b6a6[_0x532d('0x19')]&&_0x22b6a6[_0x532d('0x19')]['transcripts']&&_0x22b6a6['results'][_0x532d('0x1a')][_0x532d('0x1b')]){_0x2ee70f[_0x532d('0x14')]='';for(var _0x48896e=0x0;_0x48896e<_0x22b6a6['results']['transcripts'][_0x532d('0x1b')];_0x48896e++){_0x2ee70f[_0x532d('0x14')]+=_0x22b6a6['results'][_0x532d('0x1a')][_0x48896e][_0x532d('0x1c')]+'';}}return _0x5917be[_0x532d('0x1d')](_0x2ee70f);})[_0x532d('0x10')](function(){logger[_0x532d('0x11')](util[_0x532d('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5917be['id']));if(!_0x5917be[_0x532d('0x1e')]){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x21'));}if(!_0x257823[_0x532d('0x22')]||!_0x257823['sentimentAccountId']||!_0x257823['sentimentRegion']||!_0x257823['language']||!_0x257823[_0x532d('0x23')]){throw new db['Sequelize'][(_0x532d('0x20'))](_0x532d('0x24'));}if(!_0x2ee70f[_0x532d('0x14')]){throw new Error(_0x532d('0x25'));}if(_0x257823[_0x532d('0x26')]===_0x2b9da7['id']){return _0x2b9da7;}else{return db[_0x532d('0x27')]['findOne']({'where':{'id':_settings[_0x532d('0x26')]}});}})[_0x532d('0x10')](function(_0x44c59f){if(!_0x44c59f){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x28'));}if(!_0x44c59f['data1']||!_0x44c59f[_0x532d('0xe')]){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x29'));}_0x27714e=_0x44c59f;logger[_0x532d('0x11')](util['format'](_0x532d('0x2a'),_0x5917be['id']));return sentiment(_0x27714e[_0x532d('0xd')],_0x27714e['data2'],_0x257823[_0x532d('0x2b')],_0x2ee70f[_0x532d('0x14')],_0x257823[_0x532d('0x2c')]);})[_0x532d('0x10')](function(_0x3c9fd8){logger[_0x532d('0x11')](util['format'](_0x532d('0x2d'),_0x5917be['id']));return _0x5917be[_0x532d('0x1d')]({'sentiment':_0x3c9fd8['Sentiment'],'sPositive':_0x3c9fd8['SentimentScore'][_0x532d('0x2e')],'sNegative':_0x3c9fd8[_0x532d('0x2f')][_0x532d('0x30')],'sMixed':_0x3c9fd8[_0x532d('0x2f')][_0x532d('0x31')],'sNeutral':_0x3c9fd8[_0x532d('0x2f')][_0x532d('0x32')]});})[_0x532d('0x10')](function(){logger[_0x532d('0x11')](util[_0x532d('0xb')](_0x532d('0x33'),_0x5917be['id']));_0x255ba7();});case _0x532d('0x34'):return _0x5917be[_0x532d('0x1d')]({'transcribeStatus':_0x532d('0x34'),'failureReason':_0x3747e4['TranscriptionJob'][_0x532d('0x35')]})[_0x532d('0x10')](function(){logger[_0x532d('0x11')](util[_0x532d('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5917be['id']));_0x255ba7();});default:logger[_0x532d('0x11')](util[_0x532d('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5917be['id']));break;}}else{return BPromise[_0x532d('0x36')]()[_0x532d('0x10')](function(){if(!_0x5917be[_0x532d('0x1e')]){throw new db['Sequelize']['ValidationError'](_0x532d('0x21'));}if(!_0x257823[_0x532d('0x22')]||!_0x257823[_0x532d('0x26')]||!_0x257823['sentimentRegion']||!_0x257823[_0x532d('0x2c')]||!_0x257823[_0x532d('0x23')]){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5917be[_0x532d('0x14')]){throw new Error(_0x532d('0x25'));}if(_0x257823[_0x532d('0x26')]===_0x2b9da7['id']){return _0x2b9da7;}else{return db[_0x532d('0x27')][_0x532d('0x37')]({'where':{'id':_settings[_0x532d('0x26')]}});}})[_0x532d('0x10')](function(_0x1f61c8){if(!_0x1f61c8){throw new db['Sequelize']['ValidationError'](_0x532d('0x28'));}if(!_0x1f61c8[_0x532d('0xd')]||!_0x1f61c8['data2']){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x29'));}_0x27714e=_0x1f61c8;logger[_0x532d('0x11')](util[_0x532d('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5917be['id']));return sentiment(_0x27714e[_0x532d('0xd')],_0x27714e[_0x532d('0xe')],_0x257823[_0x532d('0x2b')],_0x5917be[_0x532d('0x14')],_0x257823['language']);})[_0x532d('0x10')](function(_0x45c0eb){logger[_0x532d('0x11')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5917be['id']));return _0x5917be[_0x532d('0x1d')]({'sentiment':_0x45c0eb[_0x532d('0x38')],'sPositive':_0x45c0eb[_0x532d('0x2f')]['Positive'],'sNegative':_0x45c0eb[_0x532d('0x2f')]['Negative'],'sMixed':_0x45c0eb[_0x532d('0x2f')][_0x532d('0x31')],'sNeutral':_0x45c0eb[_0x532d('0x2f')]['Neutral'],'transcribeStatus':_0x532d('0x15')});})[_0x532d('0x10')](function(){logger[_0x532d('0x11')](util['format'](_0x532d('0x33'),_0x5917be['id']));_0x255ba7();});}})[_0x532d('0x39')](function(_0x539cc8){if(_0x539cc8){if(!_0x539cc8['name']||_0x539cc8[_0x532d('0x3a')]!==_0x532d('0x3b')){logger[_0x532d('0x3c')](util[_0x532d('0xb')](_0x532d('0x3d'),_0x5917be['id']),util['inspect'](_0x539cc8,{'showHidden':![],'depth':null}));}}_0x255ba7();});});}function checkTranscribe(){var _0x2af30e;var _0x492a2b;var _0x4b3bf2;return db[_0x532d('0x3e')][_0x532d('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x532d('0x10')](function(_0x4e49e3){if(!_0x4e49e3||!_0x4e49e3[_0x532d('0x1b')]){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x40'));}_0x2af30e=_0x4e49e3;return db[_0x532d('0x41')][_0x532d('0x37')]({'where':{'id':0x1}});})[_0x532d('0x10')](function(_0x1db287){if(!_0x1db287){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x42'));}_0x492a2b=_0x1db287;if(!_0x492a2b[_0x532d('0x43')]||!_0x492a2b['transcribeAccountId']||!_0x492a2b['transcribeRegion']||!_0x492a2b['language']||!_0x492a2b[_0x532d('0x23')]){throw new db['Sequelize'][(_0x532d('0x20'))](_0x532d('0x44'));}return db[_0x532d('0x27')]['findOne']({'where':{'id':_0x492a2b[_0x532d('0x45')]}});})[_0x532d('0x10')](function(_0x5eb7b0){if(!_0x5eb7b0){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x28'));}if(!_0x5eb7b0[_0x532d('0xd')]||!_0x5eb7b0['data2']){throw new db[(_0x532d('0x1f'))][(_0x532d('0x20'))](_0x532d('0x29'));}_0x4b3bf2=_0x5eb7b0;var _0x4cf530=[];_0x2af30e[_0x532d('0x46')](function(_0x5053e4){_0x4cf530['push'](checkTranscribeJob(_0x5053e4,_0x492a2b,_0x4b3bf2));});return BPromise[_0x532d('0x47')](_0x4cf530);})[_0x532d('0x39')](function(_0x450755){if(_0x450755){if(!_0x450755[_0x532d('0x3a')]||_0x450755[_0x532d('0x3a')]!==_0x532d('0x3b')){logger[_0x532d('0x3c')](util[_0x532d('0x48')](_0x450755,{'showHidden':![],'depth':null}));}}});}exports[_0x532d('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb4e2=['resolve','Sentiment','Mixed','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','bucket','CloudProvider','transcribeAccountId','forEach','push','all','error','start','lodash','util','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason'];(function(_0x3e32b1,_0x487a75){var _0x419327=function(_0x6ad6a3){while(--_0x6ad6a3){_0x3e32b1['push'](_0x3e32b1['shift']());}};_0x419327(++_0x487a75);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x3b6d37,_0x131aaa){_0x3b6d37=_0x3b6d37-0x0;var _0x1bdb29=_0xb4e2[_0x3b6d37];return _0x1bdb29;};var _=require(_0x2b4e('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x2b4e('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x2b4e('0x2'));function getTranscriptionJob(_0x681c21,_0x14fbca,_0x1131c0,_0xf07f95){return new Promise(function(_0x1a77ed,_0x10f028){var _0x4a84a9=new AWS[(_0x2b4e('0x3'))]({'accessKeyId':_0x14fbca,'secretAccessKey':_0x681c21,'region':_0x1131c0});_0x4a84a9[_0x2b4e('0x4')]({'TranscriptionJobName':_0xf07f95},function(_0x36f83e,_0x36a811){if(_0x36f83e){return _0x10f028(_0x36f83e);}else{return _0x1a77ed(_0x36a811);}});});}function sentiment(_0x32795f,_0x2208ce,_0x3fd14e,_0x14bb06,_0xfaa7ec){return new Promise(function(_0x3015e6,_0x16b4ae){var _0xa05d7e=new AWS[(_0x2b4e('0x5'))]({'accessKeyId':_0x2208ce,'secretAccessKey':_0x32795f,'region':_0x3fd14e});_0xa05d7e[_0x2b4e('0x6')]({'Text':_0x14bb06,'LanguageCode':_0xfaa7ec['substring'](0x0,0x2)},function(_0xcbeaff,_0x1315aa){if(_0xcbeaff){return _0x16b4ae(_0xcbeaff);}else{return _0x3015e6(_0x1315aa);}});});}function checkTranscribeJob(_0x1cf80d,_0xca0a0e,_0x595fcc){var _0x8531ed;return new BPromise(function(_0x579559,_0x41d2a1){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x9'),_0x1cf80d['id'],_0x1cf80d[_0x2b4e('0xa')]));return getTranscriptionJob(_0x595fcc[_0x2b4e('0xb')],_0x595fcc['data2'],_0xca0a0e[_0x2b4e('0xc')],_0x1cf80d[_0x2b4e('0xa')])[_0x2b4e('0xd')](function(_0x4d329f){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1cf80d['id'],_0x1cf80d[_0x2b4e('0xa')],_0x4d329f['TranscriptionJob'][_0x2b4e('0xe')]));if(!_0x1cf80d[_0x2b4e('0xf')]){switch(_0x4d329f[_0x2b4e('0x10')][_0x2b4e('0xe')]){case _0x2b4e('0x11'):var _0x36d927={'transcribeStatus':_0x4d329f[_0x2b4e('0x10')][_0x2b4e('0xe')],'fileUri':_0x4d329f[_0x2b4e('0x10')]['Transcript'][_0x2b4e('0x12')]};logger['info'](util[_0x2b4e('0x8')](_0x2b4e('0x13'),_0x1cf80d['id']));return rp({'uri':_0x4d329f[_0x2b4e('0x10')][_0x2b4e('0x14')]['TranscriptFileUri'],'json':!![]})[_0x2b4e('0xd')](function(_0xdb887f){logger[_0x2b4e('0x7')](util['format'](_0x2b4e('0x15'),_0x1cf80d['id']));if(_0xdb887f&&_0xdb887f[_0x2b4e('0x16')]&&_0xdb887f['results'][_0x2b4e('0x17')]&&_0xdb887f['results'][_0x2b4e('0x17')][_0x2b4e('0x18')]){_0x36d927['fileText']='';for(var _0x5e37f7=0x0;_0x5e37f7<_0xdb887f[_0x2b4e('0x16')][_0x2b4e('0x17')][_0x2b4e('0x18')];_0x5e37f7++){_0x36d927['fileText']+=_0xdb887f[_0x2b4e('0x16')][_0x2b4e('0x17')][_0x5e37f7][_0x2b4e('0x19')]+'';}}return _0x1cf80d[_0x2b4e('0x1a')](_0x36d927);})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));if(!_0x1cf80d[_0x2b4e('0x1c')]){throw new db['Sequelize'][(_0x2b4e('0x1d'))](_0x2b4e('0x1e'));}if(!_0xca0a0e[_0x2b4e('0x1f')]||!_0xca0a0e[_0x2b4e('0x20')]||!_0xca0a0e['sentimentRegion']||!_0xca0a0e['language']||!_0xca0a0e['bucket']){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x22'));}if(!_0x36d927['fileText']){throw new Error(_0x2b4e('0x23'));}if(_0xca0a0e[_0x2b4e('0x20')]===_0x595fcc['id']){return _0x595fcc;}else{return db['CloudProvider'][_0x2b4e('0x24')]({'where':{'id':_settings[_0x2b4e('0x20')]}});}})[_0x2b4e('0xd')](function(_0x19618a){if(!_0x19618a){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x25'));}if(!_0x19618a['data1']||!_0x19618a[_0x2b4e('0x26')]){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x27'));}_0x8531ed=_0x19618a;logger[_0x2b4e('0x7')](util['format'](_0x2b4e('0x28'),_0x1cf80d['id']));return sentiment(_0x8531ed[_0x2b4e('0xb')],_0x8531ed[_0x2b4e('0x26')],_0xca0a0e[_0x2b4e('0x29')],_0x36d927['fileText'],_0xca0a0e[_0x2b4e('0x2a')]);})[_0x2b4e('0xd')](function(_0x58b099){logger['info'](util[_0x2b4e('0x8')](_0x2b4e('0x2b'),_0x1cf80d['id']));return _0x1cf80d[_0x2b4e('0x1a')]({'sentiment':_0x58b099['Sentiment'],'sPositive':_0x58b099[_0x2b4e('0x2c')][_0x2b4e('0x2d')],'sNegative':_0x58b099[_0x2b4e('0x2c')][_0x2b4e('0x2e')],'sMixed':_0x58b099['SentimentScore']['Mixed'],'sNeutral':_0x58b099[_0x2b4e('0x2c')][_0x2b4e('0x2f')]});})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));_0x579559();});case _0x2b4e('0x30'):return _0x1cf80d['update']({'transcribeStatus':'FAILED','failureReason':_0x4d329f['TranscriptionJob'][_0x2b4e('0x31')]})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));_0x579559();});default:logger[_0x2b4e('0x7')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1cf80d['id']));break;}}else{return BPromise[_0x2b4e('0x32')]()['then'](function(){if(!_0x1cf80d[_0x2b4e('0x1c')]){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x1e'));}if(!_0xca0a0e[_0x2b4e('0x1f')]||!_0xca0a0e['sentimentAccountId']||!_0xca0a0e[_0x2b4e('0x29')]||!_0xca0a0e[_0x2b4e('0x2a')]||!_0xca0a0e['bucket']){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x22'));}if(!_0x1cf80d[_0x2b4e('0xf')]){throw new Error(_0x2b4e('0x23'));}if(_0xca0a0e[_0x2b4e('0x20')]===_0x595fcc['id']){return _0x595fcc;}else{return db['CloudProvider'][_0x2b4e('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2b4e('0xd')](function(_0x5706f2){if(!_0x5706f2){throw new db[(_0x2b4e('0x21'))]['ValidationError'](_0x2b4e('0x25'));}if(!_0x5706f2[_0x2b4e('0xb')]||!_0x5706f2[_0x2b4e('0x26')]){throw new db['Sequelize'][(_0x2b4e('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x8531ed=_0x5706f2;logger[_0x2b4e('0x7')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1cf80d['id']));return sentiment(_0x8531ed[_0x2b4e('0xb')],_0x8531ed[_0x2b4e('0x26')],_0xca0a0e['sentimentRegion'],_0x1cf80d['fileText'],_0xca0a0e[_0x2b4e('0x2a')]);})[_0x2b4e('0xd')](function(_0x211e58){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x2b'),_0x1cf80d['id']));return _0x1cf80d[_0x2b4e('0x1a')]({'sentiment':_0x211e58[_0x2b4e('0x33')],'sPositive':_0x211e58[_0x2b4e('0x2c')][_0x2b4e('0x2d')],'sNegative':_0x211e58[_0x2b4e('0x2c')][_0x2b4e('0x2e')],'sMixed':_0x211e58[_0x2b4e('0x2c')][_0x2b4e('0x34')],'sNeutral':_0x211e58['SentimentScore']['Neutral'],'transcribeStatus':_0x2b4e('0x11')});})[_0x2b4e('0xd')](function(){logger[_0x2b4e('0x7')](util[_0x2b4e('0x8')](_0x2b4e('0x1b'),_0x1cf80d['id']));_0x579559();});}})[_0x2b4e('0x35')](function(_0x4ffe08){if(_0x4ffe08){if(!_0x4ffe08[_0x2b4e('0x36')]||_0x4ffe08[_0x2b4e('0x36')]!=='SequelizeValidationError'){logger['error'](util[_0x2b4e('0x8')](_0x2b4e('0x37'),_0x1cf80d['id']),util[_0x2b4e('0x38')](_0x4ffe08,{'showHidden':![],'depth':null}));}}_0x579559();});});}function checkTranscribe(){var _0x51bbce;var _0x7c795d;var _0x25aa50;return db['VoiceRecording'][_0x2b4e('0x39')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0xd9167f){if(!_0xd9167f||!_0xd9167f[_0x2b4e('0x18')]){throw new db['Sequelize'][(_0x2b4e('0x1d'))](_0x2b4e('0x3a'));}_0x51bbce=_0xd9167f;return db[_0x2b4e('0x3b')][_0x2b4e('0x24')]({'where':{'id':0x1}});})[_0x2b4e('0xd')](function(_0x49adea){if(!_0x49adea){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))]('Settings\x20not\x20available');}_0x7c795d=_0x49adea;if(!_0x7c795d[_0x2b4e('0x2')]||!_0x7c795d['transcribeAccountId']||!_0x7c795d[_0x2b4e('0xc')]||!_0x7c795d[_0x2b4e('0x2a')]||!_0x7c795d[_0x2b4e('0x3c')]){throw new db[(_0x2b4e('0x21'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x2b4e('0x3d')][_0x2b4e('0x24')]({'where':{'id':_0x7c795d[_0x2b4e('0x3e')]}});})[_0x2b4e('0xd')](function(_0x58c995){if(!_0x58c995){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x25'));}if(!_0x58c995[_0x2b4e('0xb')]||!_0x58c995[_0x2b4e('0x26')]){throw new db[(_0x2b4e('0x21'))][(_0x2b4e('0x1d'))](_0x2b4e('0x27'));}_0x25aa50=_0x58c995;var _0x5ba01c=[];_0x51bbce[_0x2b4e('0x3f')](function(_0x10bdf2){_0x5ba01c[_0x2b4e('0x40')](checkTranscribeJob(_0x10bdf2,_0x7c795d,_0x25aa50));});return BPromise[_0x2b4e('0x41')](_0x5ba01c);})['catch'](function(_0xed21f2){if(_0xed21f2){if(!_0xed21f2['name']||_0xed21f2[_0x2b4e('0x36')]!=='SequelizeValidationError'){logger[_0x2b4e('0x42')](util[_0x2b4e('0x38')](_0xed21f2,{'showHidden':![],'depth':null}));}}});}exports[_0x2b4e('0x43')]=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 121310c..f5f6845 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 _0x084b=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','WhatsappInteraction','subtract','hours','then','length'];(function(_0x155c8c,_0x474f7d){var _0x2de4e0=function(_0x86036c){while(--_0x86036c){_0x155c8c['push'](_0x155c8c['shift']());}};_0x2de4e0(++_0x474f7d);}(_0x084b,0xd5));var _0xb084=function(_0x46051e,_0x3fe7d8){_0x46051e=_0x46051e-0x0;var _0x14d893=_0x084b[_0x46051e];return _0x14d893;};'use strict';var _=require(_0xb084('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0xb084('0x1'));var db=require(_0xb084('0x2'))['db'];var logger=require('../logger')(_0xb084('0x3'));config[_0xb084('0x4')]=_[_0xb084('0x5')](config['redis'],{'host':_0xb084('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb084('0x4')]));function closeInteractions(){var _0x449c7a=[];return db[_0xb084('0x7')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb084('0x8')](0x18,_0xb084('0x9'))}}})[_0xb084('0xa')](function(_0xec1e0d){if(_0xec1e0d&&_0xec1e0d[_0xb084('0xb')]){_0x449c7a=_[_0xb084('0xc')](_0xec1e0d||[],'id');logger[_0xb084('0xd')](_0xb084('0xe'),_0x449c7a[_0xb084('0xf')]());return db[_0xb084('0x7')][_0xb084('0x10')]({'closeReason':_0xb084('0x11'),'disposition':_0xb084('0x12'),'closed':!![],'closedAt':moment()[_0xb084('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x449c7a}});}})['then'](function(){if(_0x449c7a&&_0x449c7a[_0xb084('0xb')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x449c7a[_0xb084('0xf')]());for(var _0xd24ff9=0x0;_0xd24ff9<_0x449c7a['length'];_0xd24ff9++){io['emit'](_0xb084('0x14'),{'id':_0x449c7a[_0xd24ff9],'closed':!![]});}}})[_0xb084('0x15')](function(_0x41a367){logger[_0xb084('0x16')](_0xb084('0x17'),_0x41a367?util['inspect'](_0x41a367,{'showHidden':![],'depth':null}):'');});}exports[_0xb084('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb96d=['util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x22f2ed,_0x39f10b){var _0x1963eb=function(_0x51da9f){while(--_0x51da9f){_0x22f2ed['push'](_0x22f2ed['shift']());}};_0x1963eb(++_0x39f10b);}(_0xb96d,0x94));var _0xdb96=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xb96d[_0x58965a];return _0x254efc;};'use strict';var _=require(_0xdb96('0x0'));var moment=require(_0xdb96('0x1'));var Redis=require('ioredis');var util=require(_0xdb96('0x2'));var config=require(_0xdb96('0x3'));var db=require(_0xdb96('0x4'))['db'];var logger=require('../logger')(_0xdb96('0x5'));config[_0xdb96('0x6')]=_['defaults'](config[_0xdb96('0x6')],{'host':_0xdb96('0x7'),'port':0x18eb});var io=require(_0xdb96('0x8'))(new Redis(config[_0xdb96('0x6')]));function closeInteractions(){var _0x6d19f5=[];return db[_0xdb96('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xdb96('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdb96('0xb')](0x18,_0xdb96('0xc'))}}})['then'](function(_0x21dce4){if(_0x21dce4&&_0x21dce4['length']){_0x6d19f5=_[_0xdb96('0xd')](_0x21dce4||[],'id');logger[_0xdb96('0xe')](_0xdb96('0xf'),_0x6d19f5[_0xdb96('0x10')]());return db[_0xdb96('0x9')][_0xdb96('0x11')]({'closeReason':_0xdb96('0x12'),'disposition':_0xdb96('0x13'),'closed':!![],'closedAt':moment()['format'](_0xdb96('0x14'))},{'where':{'id':_0x6d19f5}});}})['then'](function(){if(_0x6d19f5&&_0x6d19f5['length']){logger['info'](_0xdb96('0x15'),_0x6d19f5[_0xdb96('0x10')]());for(var _0x1880c9=0x0;_0x1880c9<_0x6d19f5[_0xdb96('0x16')];_0x1880c9++){io[_0xdb96('0x17')](_0xdb96('0x18'),{'id':_0x6d19f5[_0x1880c9],'closed':!![]});}}})[_0xdb96('0x19')](function(_0x6c5209){logger[_0xdb96('0x1a')](_0xdb96('0x1b'),_0x6c5209?util[_0xdb96('0x1c')](_0x6c5209,{'showHidden':![],'depth':null}):'');});}exports[_0xdb96('0x1d')]=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 ca1c19e..ba2fca2 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x288e=['CmHopper','finished\x20populating','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','now','innocenzo.biondo','@xcally.com','CmContact','destroy','bulkCreate','then','log'];(function(_0x3682c4,_0xc4ba94){var _0x3c6e2f=function(_0x368ecd){while(--_0x368ecd){_0x3682c4['push'](_0x3682c4['shift']());}};_0x3c6e2f(++_0xc4ba94);}(_0x288e,0x125));var _0xe288=function(_0x3ac93c,_0x124d0){_0x3ac93c=_0x3ac93c-0x0;var _0x3e0add=_0x288e[_0x3ac93c];return _0x3e0add;};'use strict';var util=require(_0xe288('0x0'));var db=require(_0xe288('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe288('0x2')]({'id':i,'firstName':_0xe288('0x3')+i,'lastName':_0xe288('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe288('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe288('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe288('0x3')+i,'lastName':_0xe288('0x4')+i,'phone':0xf879fb460+i,'email':_0xe288('0x6')+i+_0xe288('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe288('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe288('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe288('0x5')](),'updatedAt':Date['now']()});}db[_0xe288('0x8')][_0xe288('0x9')]({'where':{}})['then'](function(){return db[_0xe288('0x8')][_0xe288('0xa')](contacts);})[_0xe288('0xb')](function(){console[_0xe288('0xc')]('finished\x20populating','contacts1');return db[_0xe288('0xd')][_0xe288('0x9')]({'where':{}});})[_0xe288('0xb')](function(){return db[_0xe288('0xd')]['bulkCreate'](hopper);})[_0xe288('0xb')](function(){console['log'](_0xe288('0xe'),'hopper1');return db[_0xe288('0x8')][_0xe288('0xa')](contacts2);})[_0xe288('0xb')](function(){console['log'](_0xe288('0xe'),_0xe288('0xf'));return db[_0xe288('0xd')][_0xe288('0xa')](hopper2);})[_0xe288('0xb')](function(){console[_0xe288('0xc')](_0xe288('0xe'),_0xe288('0x10'));})['catch'](function(_0x286076){console['log'](_0x286076);}); \ No newline at end of file +var _0x97e6=['CmHopper','destroy','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0x2b16a3,_0x412bfa){var _0x308951=function(_0x2af897){while(--_0x2af897){_0x2b16a3['push'](_0x2b16a3['shift']());}};_0x308951(++_0x412bfa);}(_0x97e6,0x132));var _0x697e=function(_0x467e9e,_0x4a6888){_0x467e9e=_0x467e9e-0x0;var _0x10376a=_0x97e6[_0x467e9e];return _0x10376a;};'use strict';var util=require(_0x697e('0x0'));var db=require(_0x697e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x697e('0x2')]({'id':i,'firstName':_0x697e('0x3')+i,'lastName':_0x697e('0x4')+i,'phone':0xf879fb460+i,'email':_0x697e('0x5')+i+_0x697e('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x697e('0x7')](),'updatedAt':Date[_0x697e('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x697e('0x3')+i,'lastName':_0x697e('0x4')+i,'phone':0xf879fb460+i,'email':_0x697e('0x5')+i+_0x697e('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x697e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x697e('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x697e('0x7')](),'updatedAt':Date[_0x697e('0x7')]()});}db[_0x697e('0x8')]['destroy']({'where':{}})[_0x697e('0x9')](function(){return db[_0x697e('0x8')][_0x697e('0xa')](contacts);})['then'](function(){console[_0x697e('0xb')](_0x697e('0xc'),_0x697e('0xd'));return db[_0x697e('0xe')][_0x697e('0xf')]({'where':{}});})[_0x697e('0x9')](function(){return db[_0x697e('0xe')][_0x697e('0xa')](hopper);})[_0x697e('0x9')](function(){console['log'](_0x697e('0xc'),_0x697e('0x10'));return db['CmContact'][_0x697e('0xa')](contacts2);})['then'](function(){console[_0x697e('0xb')]('finished\x20populating',_0x697e('0x11'));return db[_0x697e('0xe')][_0x697e('0xa')](hopper2);})['then'](function(){console[_0x697e('0xb')]('finished\x20populating',_0x697e('0x12'));})[_0x697e('0x13')](function(_0x1c9572){console[_0x697e('0xb')](_0x1c9572);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e7809ae..326e1c1 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0828=['format','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','%s%s','agent'];(function(_0x4938ae,_0xa6036a){var _0xc070e8=function(_0x1fe630){while(--_0x1fe630){_0x4938ae['push'](_0x4938ae['shift']());}};_0xc070e8(++_0xa6036a);}(_0x0828,0x80));var _0x8082=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0828[_0x53ccf2];return _0x5a2964;};'use strict';var util=require(_0x8082('0x0'));var db=require(_0x8082('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8082('0x2')]({'name':util['format'](_0x8082('0x3'),_0x8082('0x4'),i),'fullname':util[_0x8082('0x5')]('%s%s',_0x8082('0x4'),i),'email':util['format'](_0x8082('0x6'),_0x8082('0x4'),i),'role':_0x8082('0x4'),'password':'password','internal':0xfa0+i,'type':_0x8082('0x7'),'transport':[_0x8082('0x8'),'ws',_0x8082('0x9')],'disallow':['all'],'allow':[_0x8082('0xa')],'defaultuser':util[_0x8082('0x5')](_0x8082('0x3'),'agent',i),'encryption':_0x8082('0xb'),'avpf':'yes','force_avp':_0x8082('0xb'),'icesupport':_0x8082('0xb'),'dtlsenable':_0x8082('0xb'),'dtlsverify':'no','dtlscertfile':_0x8082('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x8082('0x5')](_0x8082('0xd'),util[_0x8082('0x5')]('%s%s',_0x8082('0x4'),i),0xfa0+i)});}db[_0x8082('0xe')][_0x8082('0xf')](users)['then'](function(){console[_0x8082('0x10')](_0x8082('0x11'));})[_0x8082('0x12')](function(_0x108d64){console['log'](_0x108d64);}); \ No newline at end of file +var _0x0625=['password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x47819a,_0x3074b2){var _0x505b69=function(_0x21285b){while(--_0x21285b){_0x47819a['push'](_0x47819a['shift']());}};_0x505b69(++_0x3074b2);}(_0x0625,0x1dc));var _0x5062=function(_0x17a26b,_0x42df5b){_0x17a26b=_0x17a26b-0x0;var _0x28bce3=_0x0625[_0x17a26b];return _0x28bce3;};'use strict';var util=require(_0x5062('0x0'));var db=require(_0x5062('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5062('0x2')]({'name':util[_0x5062('0x3')](_0x5062('0x4'),_0x5062('0x5'),i),'fullname':util[_0x5062('0x3')]('%s%s',_0x5062('0x5'),i),'email':util[_0x5062('0x3')](_0x5062('0x6'),_0x5062('0x5'),i),'role':_0x5062('0x5'),'password':_0x5062('0x7'),'internal':0xfa0+i,'type':_0x5062('0x8'),'transport':[_0x5062('0x9'),'ws',_0x5062('0xa')],'disallow':[_0x5062('0xb')],'allow':[_0x5062('0xc')],'defaultuser':util['format'](_0x5062('0x4'),_0x5062('0x5'),i),'encryption':_0x5062('0xd'),'avpf':_0x5062('0xd'),'force_avp':_0x5062('0xd'),'icesupport':_0x5062('0xd'),'dtlsenable':_0x5062('0xd'),'dtlsverify':'no','dtlscertfile':_0x5062('0xe'),'dtlsprivatekey':_0x5062('0xf'),'dtlssetup':_0x5062('0x10'),'callerid':util[_0x5062('0x3')]('\x22%s\x22\x20<%s>',util[_0x5062('0x3')](_0x5062('0x4'),_0x5062('0x5'),i),0xfa0+i)});}db['User'][_0x5062('0x11')](users)['then'](function(){console[_0x5062('0x12')](_0x5062('0x13'));})[_0x5062('0x14')](function(_0x3b60b3){console[_0x5062('0x12')](_0x3b60b3);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index dc6e50d..627a8b0 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ebd=['findAll','IvrCampaigns','UserProfileResource','telephone','Campaign','ivr','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','include','VoiceQueue','push','ChatQueue','OpenchannelQueue','voice:inbound','FaxQueue','MailQueue','WhatsappQueue','Telephones','Trunks','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','map','removeChatInteractions','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','User','role','agent','type','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues'];(function(_0x5e0a6b,_0x27f116){var _0x35315c=function(_0x545d78){while(--_0x545d78){_0x5e0a6b['push'](_0x5e0a6b['shift']());}};_0x35315c(++_0x27f116);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0x2ebd[_0x158e3b];return _0x551a1d;};'use strict';var _=require(_0xd2eb('0x0'));var util=require(_0xd2eb('0x1'));var BPromise=require(_0xd2eb('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xd2eb('0x3')],'include':[{'as':_0xd2eb('0x4'),'model':db[_0xd2eb('0x5')],'attributes':['id',_0xd2eb('0x3'),_0xd2eb('0x6')],'raw':!![],'where':{'role':_0xd2eb('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xd2eb('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xd2eb('0x3')],'where':{'role':_0xd2eb('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd2eb('0x3'),_0xd2eb('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x406a00,_0x2cf722,_0x5eca80){return db['UserProfileSection'][_0xd2eb('0x9')]({'where':{'name':_0x406a00,'userProfileId':_0x2cf722},'raw':!![]})[_0xd2eb('0xa')](function(_0xe2cadc){if(_0xe2cadc){if(_0xe2cadc[_0xd2eb('0xb')]){switch(_0x406a00){case _0xd2eb('0xc'):case _0xd2eb('0xd'):case _0xd2eb('0xe'):case _0xd2eb('0xf'):case _0xd2eb('0x10'):case _0xd2eb('0x11'):case _0xd2eb('0x12'):return db[_0x5eca80][_0xd2eb('0x13')](queryQueues);case'Telephones':return db[_0x5eca80][_0xd2eb('0x13')](queryTelephones);case'Trunks':return db[_0x5eca80][_0xd2eb('0x13')](queryTrunks);case _0xd2eb('0x14'):return db[_0x5eca80]['findAll'](queryCampaigns);}}else{return db[_0xd2eb('0x15')][_0xd2eb('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0xe2cadc['id']},'raw':!![]})[_0xd2eb('0xa')](function(_0xa042c9){if(_0xa042c9){var _0x216f82={'where':{'id':_['map'](_0xa042c9,'resourceId')},'raw':!![]};switch(_0x5eca80){case _0xd2eb('0x5'):_0x216f82['where']['role']=_0xd2eb('0x16');break;case _0xd2eb('0x17'):_0x216f82['where'][_0xd2eb('0x8')]=_0xd2eb('0x18');break;}return db[_0x5eca80][_0xd2eb('0x13')](_0x216f82);}else{return[];}});}}else{return[];}})[_0xd2eb('0xa')](function(_0x3d2760){return _0x3d2760;});}function joinOrLeaveQueues(_0x154349,_0x2f4062,_0x29a605,_0x496586){_0x154349[_0x2f4062](util[_0xd2eb('0x19')]('%s:queue:%s',_0x29a605,_0x496586[_0xd2eb('0x3')]));if(_0x496586[_0xd2eb('0x4')]){for(var _0x2a9a90=0x0;_0x2a9a90<_0x496586[_0xd2eb('0x4')]['length'];_0x2a9a90+=0x1){_0x154349[_0x2f4062](util[_0xd2eb('0x19')](_0xd2eb('0x1a'),_0x496586['Agents'][_0x2a9a90][_0xd2eb('0x3')]));}}}function joinOrLeave(_0x469edd,_0x3bacd7,_0x2a9967){var _0x2bc69a;if(_0x469edd[_0xd2eb('0x1b')][_0xd2eb('0x1c')]['id']){db[_0xd2eb('0x5')]['find']({'attributes':['id',_0xd2eb('0x3'),_0xd2eb('0x6'),_0xd2eb('0x1d')],'where':{'id':_0x469edd[_0xd2eb('0x1b')][_0xd2eb('0x1c')]['id']},'include':[{'model':db[_0xd2eb('0x1e')],'as':_0xd2eb('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xd2eb('0x20')],'as':_0xd2eb('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xd2eb('0x22')],'as':_0xd2eb('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xd2eb('0x24')],'as':_0xd2eb('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd2eb('0x26')],'as':_0xd2eb('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd2eb('0x28')],'as':_0xd2eb('0x29'),'attributes':['id'],'raw':!![]}]})[_0xd2eb('0xa')](function(_0x6998b1){if(_0x6998b1){_0x2bc69a=_0x6998b1;_0x469edd[_0x3bacd7](util[_0xd2eb('0x19')](_0xd2eb('0x1a'),_0x6998b1['name']));var _0x3b1607=[];switch(_0x6998b1[_0xd2eb('0x6')]){case _0xd2eb('0x2a'):_0x469edd[_0x3bacd7]('voice:inbound');_0x469edd[_0x3bacd7](_0xd2eb('0x2b'));if(queryQueues['hasOwnProperty'](_0xd2eb('0x2c'))){delete queryQueues[_0xd2eb('0x2c')];}_0x3b1607['push'](db[_0xd2eb('0x2d')][_0xd2eb('0x13')](queryQueues));_0x3b1607[_0xd2eb('0x2e')](db[_0xd2eb('0x2f')][_0xd2eb('0x13')](queryQueues));_0x3b1607[_0xd2eb('0x2e')](db['FaxQueue']['findAll'](queryQueues));_0x3b1607[_0xd2eb('0x2e')](db['SmsQueue']['findAll'](queryQueues));_0x3b1607[_0xd2eb('0x2e')](db['MailQueue'][_0xd2eb('0x13')](queryQueues));_0x3b1607['push'](db[_0xd2eb('0x30')][_0xd2eb('0x13')](queryQueues));_0x3b1607['push'](db['WhatsappQueue'][_0xd2eb('0x13')](queryQueues));_0x3b1607['push'](db[_0xd2eb('0x5')][_0xd2eb('0x13')](queryTelephones));_0x3b1607[_0xd2eb('0x2e')](db['Trunk']['findAll'](queryTrunks));_0x3b1607[_0xd2eb('0x2e')](db['Campaign'][_0xd2eb('0x13')](queryCampaigns));_0x3b1607[_0xd2eb('0x2e')](db[_0xd2eb('0x5')][_0xd2eb('0x13')](queryAgents));break;case'user':_0x469edd[_0x3bacd7](_0xd2eb('0x31'));_0x469edd[_0x3bacd7]('voice:outbound');_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources('VoiceQueues',_0x6998b1[_0xd2eb('0x1d')],_0xd2eb('0x2d')));_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources(_0xd2eb('0xd'),_0x6998b1[_0xd2eb('0x1d')],_0xd2eb('0x2f')));_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources(_0xd2eb('0xe'),_0x6998b1[_0xd2eb('0x1d')],_0xd2eb('0x32')));_0x3b1607['push'](getAssociatedResources(_0xd2eb('0xf'),_0x6998b1[_0xd2eb('0x1d')],'SmsQueue'));_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources(_0xd2eb('0x10'),_0x6998b1[_0xd2eb('0x1d')],_0xd2eb('0x33')));_0x3b1607['push'](getAssociatedResources(_0xd2eb('0x11'),_0x6998b1['userProfileId'],_0xd2eb('0x30')));_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources('WhatsappQueues',_0x6998b1[_0xd2eb('0x1d')],_0xd2eb('0x34')));_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources(_0xd2eb('0x35'),_0x6998b1[_0xd2eb('0x1d')],'User'));_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources(_0xd2eb('0x36'),_0x6998b1[_0xd2eb('0x1d')],_0xd2eb('0x37')));_0x3b1607[_0xd2eb('0x2e')](getAssociatedResources('IvrCampaigns',_0x6998b1[_0xd2eb('0x1d')],_0xd2eb('0x17')));_0x3b1607[_0xd2eb('0x2e')](db[_0xd2eb('0x5')]['findAll'](queryAgents));break;case _0xd2eb('0x7'):_0x469edd[_0x3bacd7]('voice:inbound');_0x469edd[_0x3bacd7](_0xd2eb('0x2b'));_0x3b1607['push'](_0x6998b1[_0xd2eb('0x38')]({'attributes':['id',_0xd2eb('0x3')]}));_0x3b1607[_0xd2eb('0x2e')](_0x6998b1[_0xd2eb('0x39')]({'attributes':['id',_0xd2eb('0x3')]}));_0x3b1607['push'](_0x6998b1[_0xd2eb('0x3a')]({'attributes':['id',_0xd2eb('0x3')]}));_0x3b1607['push'](_0x6998b1[_0xd2eb('0x3b')]({'attributes':['id',_0xd2eb('0x3')]}));_0x3b1607[_0xd2eb('0x2e')](_0x6998b1[_0xd2eb('0x3c')]({'attributes':['id',_0xd2eb('0x3')]}));_0x3b1607[_0xd2eb('0x2e')](_0x6998b1[_0xd2eb('0x3d')]({'attributes':['id',_0xd2eb('0x3')]}));_0x3b1607[_0xd2eb('0x2e')](_0x6998b1['getWhatsappQueues']({'attributes':['id',_0xd2eb('0x3')]}));break;}return BPromise['all'](_0x3b1607);}})[_0xd2eb('0xa')](function(_0x22f0fc){if(_0x22f0fc&&_0x22f0fc[_0xd2eb('0x3e')]){for(var _0x1dfe76=0x0;_0x1dfe76<_0x22f0fc[_0xd2eb('0x3e')];_0x1dfe76+=0x1){for(var _0x2d452f=0x0;_0x2d452f<_0x22f0fc[_0x1dfe76][_0xd2eb('0x3e')];_0x2d452f+=0x1){switch(_0x1dfe76){case 0x0:joinOrLeaveQueues(_0x469edd,_0x3bacd7,_0xd2eb('0x3f'),_0x22f0fc[_0x1dfe76][_0x2d452f]);break;case 0x1:joinOrLeaveQueues(_0x469edd,_0x3bacd7,_0xd2eb('0x40'),_0x22f0fc[_0x1dfe76][_0x2d452f]);break;case 0x2:joinOrLeaveQueues(_0x469edd,_0x3bacd7,_0xd2eb('0x41'),_0x22f0fc[_0x1dfe76][_0x2d452f]);break;case 0x3:joinOrLeaveQueues(_0x469edd,_0x3bacd7,_0xd2eb('0x42'),_0x22f0fc[_0x1dfe76][_0x2d452f]);break;case 0x4:joinOrLeaveQueues(_0x469edd,_0x3bacd7,_0xd2eb('0x43'),_0x22f0fc[_0x1dfe76][_0x2d452f]);break;case 0x5:joinOrLeaveQueues(_0x469edd,_0x3bacd7,_0xd2eb('0x44'),_0x22f0fc[_0x1dfe76][_0x2d452f]);break;case 0x6:joinOrLeaveQueues(_0x469edd,_0x3bacd7,_0xd2eb('0x45'),_0x22f0fc[_0x1dfe76][_0x2d452f]);break;case 0x7:if(_0x2bc69a[_0xd2eb('0x6')]!==_0xd2eb('0x7'))_0x469edd[_0x3bacd7](util[_0xd2eb('0x19')](_0xd2eb('0x46'),_0x22f0fc[_0x1dfe76][_0x2d452f][_0xd2eb('0x3')]));break;case 0x8:if(_0x2bc69a[_0xd2eb('0x6')]!==_0xd2eb('0x7'))_0x469edd[_0x3bacd7](util[_0xd2eb('0x19')](_0xd2eb('0x47'),_0x22f0fc[_0x1dfe76][_0x2d452f]['name']));break;case 0x9:if(_0x2bc69a[_0xd2eb('0x6')]!==_0xd2eb('0x7'))_0x469edd[_0x3bacd7](util[_0xd2eb('0x19')]('campaign:%s:%s',_0x22f0fc[_0x1dfe76][_0x2d452f][_0xd2eb('0x8')],_0x22f0fc[_0x1dfe76][_0x2d452f]['name']));break;case 0xa:_0x469edd[_0x3bacd7](util['format'](_0xd2eb('0x1a'),_0x22f0fc[_0x1dfe76][_0x2d452f][_0xd2eb('0x3')]));break;}}}}})['then'](function(){if(_0x3bacd7===_0xd2eb('0x48')){var _0x51ee64=_[_0xd2eb('0x49')](_0x2bc69a[_0xd2eb('0x1f')],'id');return _0x2bc69a[_0xd2eb('0x4a')](_0x51ee64)[_0xd2eb('0xa')](function(){for(var _0x950ac5=0x0;_0x950ac5<_0x51ee64[_0xd2eb('0x3e')];_0x950ac5+=0x1){_0x2a9967['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x51ee64[_0x950ac5]),'UserId':Number(_0x2bc69a['id'])});}});}})['then'](function(){if(_0x3bacd7===_0xd2eb('0x48')){var _0x2f3f95=_[_0xd2eb('0x49')](_0x2bc69a[_0xd2eb('0x21')],'id');return _0x2bc69a[_0xd2eb('0x4b')](_0x2f3f95)['then'](function(){for(var _0x5acb12=0x0;_0x5acb12<_0x2f3f95['length'];_0x5acb12+=0x1){_0x2a9967[_0xd2eb('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2f3f95[_0x5acb12]),'UserId':Number(_0x2bc69a['id'])});}});}})[_0xd2eb('0xa')](function(){if(_0x3bacd7===_0xd2eb('0x48')){var _0x30e3e9=_['map'](_0x2bc69a[_0xd2eb('0x23')],'id');return _0x2bc69a[_0xd2eb('0x4d')](_0x30e3e9)['then'](function(){for(var _0x54065f=0x0;_0x54065f<_0x30e3e9[_0xd2eb('0x3e')];_0x54065f+=0x1){_0x2a9967[_0xd2eb('0x4c')](_0xd2eb('0x4e'),{'FaxInteractionId':Number(_0x30e3e9[_0x54065f]),'UserId':Number(_0x2bc69a['id'])});}});}})[_0xd2eb('0xa')](function(){if(_0x3bacd7==='leave'){var _0x49da56=_[_0xd2eb('0x49')](_0x2bc69a[_0xd2eb('0x25')],'id');return _0x2bc69a[_0xd2eb('0x4f')](_0x49da56)[_0xd2eb('0xa')](function(){for(var _0x5840ab=0x0;_0x5840ab<_0x49da56[_0xd2eb('0x3e')];_0x5840ab+=0x1){_0x2a9967[_0xd2eb('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x49da56[_0x5840ab]),'UserId':Number(_0x2bc69a['id'])});}});}})['then'](function(){if(_0x3bacd7==='leave'){var _0x2a5434=_[_0xd2eb('0x49')](_0x2bc69a[_0xd2eb('0x27')],'id');return _0x2bc69a[_0xd2eb('0x50')](_0x2a5434)[_0xd2eb('0xa')](function(){for(var _0x544935=0x0;_0x544935<_0x2a5434[_0xd2eb('0x3e')];_0x544935+=0x1){_0x2a9967[_0xd2eb('0x4c')](_0xd2eb('0x51'),{'OpenchannelInteractionId':Number(_0x2a5434[_0x544935]),'UserId':Number(_0x2bc69a['id'])});}});}})[_0xd2eb('0xa')](function(){if(_0x3bacd7===_0xd2eb('0x48')){var _0x33b5c6=_[_0xd2eb('0x49')](_0x2bc69a['WhatsappInteractions'],'id');return _0x2bc69a['removeWhatsappInteractions'](_0x33b5c6)[_0xd2eb('0xa')](function(){for(var _0x5a8f75=0x0;_0x5a8f75<_0x33b5c6[_0xd2eb('0x3e')];_0x5a8f75+=0x1){_0x2a9967[_0xd2eb('0x4c')](_0xd2eb('0x52'),{'WhatsappInteractionId':Number(_0x33b5c6[_0x5a8f75]),'UserId':Number(_0x2bc69a['id'])});}});}})['catch'](function(_0x3fa892){_0x469edd[_0xd2eb('0x53')](_0x3fa892);});}}function onDisconnect(_0x3daa9f,_0x3d1faf){joinOrLeave(_0x3daa9f,_0xd2eb('0x48'),_0x3d1faf);}function onConnect(_0x5a8cc8){joinOrLeave(_0x5a8cc8,_0xd2eb('0x54'));}exports[_0xd2eb('0x55')]=function(_0x390013){_0x390013['on'](_0xd2eb('0x56'),function(_0x3c7cb1){_0x3c7cb1[_0xd2eb('0x57')](0x0);_0x3c7cb1[_0xd2eb('0x58')]=_0x3c7cb1[_0xd2eb('0x59')][_0xd2eb('0x56')][_0xd2eb('0x5a')]+':'+_0x3c7cb1['request'][_0xd2eb('0x56')]['remotePort'];_0x3c7cb1[_0xd2eb('0x5b')]=new Date();_0x3c7cb1[_0xd2eb('0x53')]=function(_0x425e32){console['log']('SocketIO\x20'+_0x3c7cb1['nsp'][_0xd2eb('0x3')]+'['+_0x3c7cb1[_0xd2eb('0x58')]+']',_0x425e32);};_0x3c7cb1['on'](_0xd2eb('0x5c'),function(){onDisconnect(_0x3c7cb1,_0x390013);_0x3c7cb1[_0xd2eb('0x53')](_0xd2eb('0x5d'));});onConnect(_0x3c7cb1);_0x3c7cb1[_0xd2eb('0x53')](_0xd2eb('0x5e'));});}; \ No newline at end of file +var _0xdbc6=['join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','bluebird','./environment','name','Agents','User','role','telephone','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','MailQueues','Campaign','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','telephone:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log'];(function(_0x528442,_0x3f7aed){var _0x4c42cd=function(_0x304a36){while(--_0x304a36){_0x528442['push'](_0x528442['shift']());}};_0x4c42cd(++_0x3f7aed);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x1bfcc0,_0x21572c){_0x1bfcc0=_0x1bfcc0-0x0;var _0x3f5d76=_0xdbc6[_0x1bfcc0];return _0x3f5d76;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x6dbc('0x0'));var db=require('../mysqldb')['db'];var config=require(_0x6dbc('0x1'));var queryQueues={'attributes':['id',_0x6dbc('0x2')],'include':[{'as':_0x6dbc('0x3'),'model':db[_0x6dbc('0x4')],'attributes':['id',_0x6dbc('0x2'),_0x6dbc('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6dbc('0x2')],'where':{'role':_0x6dbc('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6dbc('0x2')],'where':{'role':_0x6dbc('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6dbc('0x2'),_0x6dbc('0x8')],'where':{'type':_0x6dbc('0x9')}};function getAssociatedResources(_0x5ea822,_0x3494e2,_0x3c57b4){return db['UserProfileSection'][_0x6dbc('0xa')]({'where':{'name':_0x5ea822,'userProfileId':_0x3494e2},'raw':!![]})[_0x6dbc('0xb')](function(_0x5bbb3c){if(_0x5bbb3c){if(_0x5bbb3c[_0x6dbc('0xc')]){switch(_0x5ea822){case _0x6dbc('0xd'):case _0x6dbc('0xe'):case _0x6dbc('0xf'):case _0x6dbc('0x10'):case'MailQueues':case'OpenchannelQueues':case _0x6dbc('0x11'):return db[_0x3c57b4][_0x6dbc('0x12')](queryQueues);case _0x6dbc('0x13'):return db[_0x3c57b4][_0x6dbc('0x12')](queryTelephones);case _0x6dbc('0x14'):return db[_0x3c57b4][_0x6dbc('0x12')](queryTrunks);case _0x6dbc('0x15'):return db[_0x3c57b4][_0x6dbc('0x12')](queryCampaigns);}}else{return db[_0x6dbc('0x16')]['findAll']({'attributes':[_0x6dbc('0x17')],'where':{'sectionId':_0x5bbb3c['id']},'raw':!![]})[_0x6dbc('0xb')](function(_0x12a257){if(_0x12a257){var _0x418e71={'where':{'id':_[_0x6dbc('0x18')](_0x12a257,_0x6dbc('0x17'))},'raw':!![]};switch(_0x3c57b4){case _0x6dbc('0x4'):_0x418e71[_0x6dbc('0x19')]['role']='telephone';break;case'Campaign':_0x418e71[_0x6dbc('0x19')][_0x6dbc('0x8')]=_0x6dbc('0x9');break;}return db[_0x3c57b4][_0x6dbc('0x12')](_0x418e71);}else{return[];}});}}else{return[];}})[_0x6dbc('0xb')](function(_0x581381){return _0x581381;});}function joinOrLeaveQueues(_0x44435c,_0x12311d,_0xb270df,_0x294803){_0x44435c[_0x12311d](util[_0x6dbc('0x1a')](_0x6dbc('0x1b'),_0xb270df,_0x294803[_0x6dbc('0x2')]));if(_0x294803[_0x6dbc('0x3')]){for(var _0x9edc7a=0x0;_0x9edc7a<_0x294803[_0x6dbc('0x3')][_0x6dbc('0x1c')];_0x9edc7a+=0x1){_0x44435c[_0x12311d](util['format'](_0x6dbc('0x1d'),_0x294803[_0x6dbc('0x3')][_0x9edc7a][_0x6dbc('0x2')]));}}}function joinOrLeave(_0x52b772,_0x1b8e84,_0x47d55b){var _0x3e98b2;if(_0x52b772[_0x6dbc('0x1e')][_0x6dbc('0x1f')]['id']){db['User'][_0x6dbc('0x20')]({'attributes':['id',_0x6dbc('0x2'),_0x6dbc('0x5'),_0x6dbc('0x21')],'where':{'id':_0x52b772[_0x6dbc('0x1e')][_0x6dbc('0x1f')]['id']},'include':[{'model':db[_0x6dbc('0x22')],'as':_0x6dbc('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x6dbc('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x25')],'as':_0x6dbc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x27')],'as':_0x6dbc('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x29')],'as':_0x6dbc('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x6dbc('0x2b')],'as':_0x6dbc('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x23ea7d){if(_0x23ea7d){_0x3e98b2=_0x23ea7d;_0x52b772[_0x1b8e84](util[_0x6dbc('0x1a')](_0x6dbc('0x1d'),_0x23ea7d[_0x6dbc('0x2')]));var _0x564920=[];switch(_0x23ea7d['role']){case _0x6dbc('0x2d'):_0x52b772[_0x1b8e84](_0x6dbc('0x2e'));_0x52b772[_0x1b8e84](_0x6dbc('0x2f'));if(queryQueues[_0x6dbc('0x30')](_0x6dbc('0x31'))){delete queryQueues[_0x6dbc('0x31')];}_0x564920['push'](db[_0x6dbc('0x32')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x34')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x35')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x36')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x37')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x38')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x39')][_0x6dbc('0x12')](queryQueues));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x4')][_0x6dbc('0x12')](queryTelephones));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x3a')][_0x6dbc('0x12')](queryTrunks));_0x564920['push'](db['Campaign'][_0x6dbc('0x12')](queryCampaigns));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x4')]['findAll'](queryAgents));break;case _0x6dbc('0x3b'):_0x52b772[_0x1b8e84]('voice:inbound');_0x52b772[_0x1b8e84]('voice:outbound');_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0xd'),_0x23ea7d['userProfileId'],_0x6dbc('0x32')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0xe'),_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x34')));_0x564920['push'](getAssociatedResources(_0x6dbc('0xf'),_0x23ea7d['userProfileId'],_0x6dbc('0x35')));_0x564920[_0x6dbc('0x33')](getAssociatedResources('SmsQueues',_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x36')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x3c'),_0x23ea7d[_0x6dbc('0x21')],'MailQueue'));_0x564920[_0x6dbc('0x33')](getAssociatedResources('OpenchannelQueues',_0x23ea7d['userProfileId'],'OpenchannelQueue'));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x11'),_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x39')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x13'),_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x4')));_0x564920[_0x6dbc('0x33')](getAssociatedResources(_0x6dbc('0x14'),_0x23ea7d['userProfileId'],_0x6dbc('0x3a')));_0x564920[_0x6dbc('0x33')](getAssociatedResources('IvrCampaigns',_0x23ea7d[_0x6dbc('0x21')],_0x6dbc('0x3d')));_0x564920[_0x6dbc('0x33')](db[_0x6dbc('0x4')][_0x6dbc('0x12')](queryAgents));break;case'agent':_0x52b772[_0x1b8e84](_0x6dbc('0x2e'));_0x52b772[_0x1b8e84](_0x6dbc('0x2f'));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x3e')]({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x3f')]({'attributes':['id','name']}));_0x564920[_0x6dbc('0x33')](_0x23ea7d['getFaxQueues']({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x40')]({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x41')]({'attributes':['id',_0x6dbc('0x2')]}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x42')]({'attributes':['id','name']}));_0x564920[_0x6dbc('0x33')](_0x23ea7d[_0x6dbc('0x43')]({'attributes':['id',_0x6dbc('0x2')]}));break;}return BPromise[_0x6dbc('0x44')](_0x564920);}})['then'](function(_0x561570){if(_0x561570&&_0x561570[_0x6dbc('0x1c')]){for(var _0x4fc9b9=0x0;_0x4fc9b9<_0x561570[_0x6dbc('0x1c')];_0x4fc9b9+=0x1){for(var _0x426059=0x0;_0x426059<_0x561570[_0x4fc9b9][_0x6dbc('0x1c')];_0x426059+=0x1){switch(_0x4fc9b9){case 0x0:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x45'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x1:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x46'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x2:joinOrLeaveQueues(_0x52b772,_0x1b8e84,'fax',_0x561570[_0x4fc9b9][_0x426059]);break;case 0x3:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x47'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x4:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x48'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x5:joinOrLeaveQueues(_0x52b772,_0x1b8e84,_0x6dbc('0x49'),_0x561570[_0x4fc9b9][_0x426059]);break;case 0x6:joinOrLeaveQueues(_0x52b772,_0x1b8e84,'whatsapp',_0x561570[_0x4fc9b9][_0x426059]);break;case 0x7:if(_0x3e98b2[_0x6dbc('0x5')]!==_0x6dbc('0x7'))_0x52b772[_0x1b8e84](util['format'](_0x6dbc('0x4a'),_0x561570[_0x4fc9b9][_0x426059][_0x6dbc('0x2')]));break;case 0x8:if(_0x3e98b2[_0x6dbc('0x5')]!=='agent')_0x52b772[_0x1b8e84](util['format']('trunk:%s',_0x561570[_0x4fc9b9][_0x426059]['name']));break;case 0x9:if(_0x3e98b2[_0x6dbc('0x5')]!==_0x6dbc('0x7'))_0x52b772[_0x1b8e84](util[_0x6dbc('0x1a')]('campaign:%s:%s',_0x561570[_0x4fc9b9][_0x426059][_0x6dbc('0x8')],_0x561570[_0x4fc9b9][_0x426059][_0x6dbc('0x2')]));break;case 0xa:_0x52b772[_0x1b8e84](util[_0x6dbc('0x1a')]('user:%s',_0x561570[_0x4fc9b9][_0x426059]['name']));break;}}}}})[_0x6dbc('0xb')](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x38c85b=_[_0x6dbc('0x18')](_0x3e98b2[_0x6dbc('0x23')],'id');return _0x3e98b2['removeChatInteractions'](_0x38c85b)[_0x6dbc('0xb')](function(){for(var _0x431c48=0x0;_0x431c48<_0x38c85b['length'];_0x431c48+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x4d'),{'ChatInteractionId':Number(_0x38c85b[_0x431c48]),'UserId':Number(_0x3e98b2['id'])});}});}})['then'](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x3045a1=_['map'](_0x3e98b2[_0x6dbc('0x24')],'id');return _0x3e98b2[_0x6dbc('0x4e')](_0x3045a1)[_0x6dbc('0xb')](function(){for(var _0x2907e5=0x0;_0x2907e5<_0x3045a1[_0x6dbc('0x1c')];_0x2907e5+=0x1){_0x47d55b['emit'](_0x6dbc('0x4f'),{'MailInteractionId':Number(_0x3045a1[_0x2907e5]),'UserId':Number(_0x3e98b2['id'])});}});}})['then'](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x1e55de=_[_0x6dbc('0x18')](_0x3e98b2[_0x6dbc('0x26')],'id');return _0x3e98b2[_0x6dbc('0x50')](_0x1e55de)[_0x6dbc('0xb')](function(){for(var _0x673597=0x0;_0x673597<_0x1e55de['length'];_0x673597+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x51'),{'FaxInteractionId':Number(_0x1e55de[_0x673597]),'UserId':Number(_0x3e98b2['id'])});}});}})[_0x6dbc('0xb')](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x45dcbf=_[_0x6dbc('0x18')](_0x3e98b2[_0x6dbc('0x28')],'id');return _0x3e98b2['removeSmsInteractions'](_0x45dcbf)[_0x6dbc('0xb')](function(){for(var _0x2cce4c=0x0;_0x2cce4c<_0x45dcbf['length'];_0x2cce4c+=0x1){_0x47d55b['emit'](_0x6dbc('0x52'),{'SmsInteractionId':Number(_0x45dcbf[_0x2cce4c]),'UserId':Number(_0x3e98b2['id'])});}});}})['then'](function(){if(_0x1b8e84===_0x6dbc('0x4b')){var _0x13e1b7=_['map'](_0x3e98b2[_0x6dbc('0x2a')],'id');return _0x3e98b2[_0x6dbc('0x53')](_0x13e1b7)[_0x6dbc('0xb')](function(){for(var _0x4b71a0=0x0;_0x4b71a0<_0x13e1b7[_0x6dbc('0x1c')];_0x4b71a0+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x54'),{'OpenchannelInteractionId':Number(_0x13e1b7[_0x4b71a0]),'UserId':Number(_0x3e98b2['id'])});}});}})[_0x6dbc('0xb')](function(){if(_0x1b8e84==='leave'){var _0x280562=_['map'](_0x3e98b2[_0x6dbc('0x2c')],'id');return _0x3e98b2[_0x6dbc('0x55')](_0x280562)[_0x6dbc('0xb')](function(){for(var _0x33d972=0x0;_0x33d972<_0x280562[_0x6dbc('0x1c')];_0x33d972+=0x1){_0x47d55b[_0x6dbc('0x4c')](_0x6dbc('0x56'),{'WhatsappInteractionId':Number(_0x280562[_0x33d972]),'UserId':Number(_0x3e98b2['id'])});}});}})[_0x6dbc('0x57')](function(_0x2856a1){_0x52b772[_0x6dbc('0x58')](_0x2856a1);});}}function onDisconnect(_0x4a3fde,_0x3bb839){joinOrLeave(_0x4a3fde,_0x6dbc('0x4b'),_0x3bb839);}function onConnect(_0x15b7fb){joinOrLeave(_0x15b7fb,_0x6dbc('0x59'));}exports[_0x6dbc('0x5a')]=function(_0x1e5f6f){_0x1e5f6f['on'](_0x6dbc('0x5b'),function(_0x206582){_0x206582[_0x6dbc('0x5c')](0x0);_0x206582[_0x6dbc('0x5d')]=_0x206582[_0x6dbc('0x5e')][_0x6dbc('0x5b')][_0x6dbc('0x5f')]+':'+_0x206582['request'][_0x6dbc('0x5b')][_0x6dbc('0x60')];_0x206582[_0x6dbc('0x61')]=new Date();_0x206582['log']=function(_0xc60021){console[_0x6dbc('0x58')](_0x6dbc('0x62')+_0x206582[_0x6dbc('0x63')][_0x6dbc('0x2')]+'['+_0x206582[_0x6dbc('0x5d')]+']',_0xc60021);};_0x206582['on'](_0x6dbc('0x64'),function(){onDisconnect(_0x206582,_0x1e5f6f);_0x206582['log']('DISCONNECTED');});onConnect(_0x206582);_0x206582[_0x6dbc('0x58')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b2e4873..7be3b88 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 _0x9c0f=['../../mysqldb','jayson/promise','triggers','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','afterCreate','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','agent','incomingmessage','outgoingmessage','opened','format','changed','closed','substatus','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterUpdate','find','fullname','email','length','hasOwnProperty','hook','callback','toLowerCase','condition','util'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x9c0f,0x1bb));var _0xf9c0=function(_0x191674,_0x3b5687){_0x191674=_0x191674-0x0;var _0x3a0fc2=_0x9c0f[_0x191674];return _0x3a0fc2;};'use strict';var util=require(_0xf9c0('0x0'));var db=require(_0xf9c0('0x1'))['db'];var jayson=require(_0xf9c0('0x2'));var logger=require('../logger')(_0xf9c0('0x3'));var client=jayson['client'][_0xf9c0('0x4')]({'port':0x232a});var triggers=[{'channel':_0xf9c0('0x5'),'model':_0xf9c0('0x6'),'event':'afterCreate','condition':_0xf9c0('0x7'),'callback':afterCreate},{'channel':_0xf9c0('0x5'),'model':_0xf9c0('0x6'),'event':_0xf9c0('0x8'),'condition':_0xf9c0('0x9'),'callback':afterUpdate},{'channel':_0xf9c0('0x5'),'model':_0xf9c0('0xa'),'event':'afterCreate','condition':_0xf9c0('0xb'),'callback':afterCreateMessage},{'channel':_0xf9c0('0x5'),'model':_0xf9c0('0xc'),'event':_0xf9c0('0xd'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xf9c0('0xe'),'model':_0xf9c0('0xf'),'event':_0xf9c0('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0xf9c0('0xf'),'event':_0xf9c0('0x8'),'condition':_0xf9c0('0x9'),'callback':afterUpdate},{'channel':_0xf9c0('0xe'),'model':_0xf9c0('0x10'),'event':_0xf9c0('0xd'),'condition':_0xf9c0('0xb'),'callback':afterCreateMessage},{'channel':_0xf9c0('0x11'),'model':_0xf9c0('0x12'),'event':_0xf9c0('0xd'),'condition':_0xf9c0('0x7'),'callback':afterCreate},{'channel':_0xf9c0('0x11'),'model':'WhatsappInteraction','event':_0xf9c0('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf9c0('0x11'),'model':_0xf9c0('0x13'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf9c0('0x14'),'model':'FaxInteraction','event':_0xf9c0('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xf9c0('0x14'),'model':_0xf9c0('0x15'),'event':'afterUpdate','condition':_0xf9c0('0x9'),'callback':afterUpdate},{'channel':_0xf9c0('0x14'),'model':_0xf9c0('0x16'),'event':'afterCreate','condition':_0xf9c0('0xb'),'callback':afterCreateMessage},{'channel':_0xf9c0('0x17'),'model':_0xf9c0('0x18'),'event':_0xf9c0('0xd'),'condition':_0xf9c0('0x7'),'callback':afterCreate},{'channel':_0xf9c0('0x17'),'model':_0xf9c0('0x18'),'event':_0xf9c0('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf9c0('0x17'),'model':_0xf9c0('0x19'),'event':_0xf9c0('0xd'),'condition':_0xf9c0('0xb'),'callback':afterCreateMessage},{'channel':_0xf9c0('0x1a'),'model':_0xf9c0('0x1b'),'event':_0xf9c0('0xd'),'condition':_0xf9c0('0x7'),'callback':afterCreate},{'channel':_0xf9c0('0x1a'),'model':_0xf9c0('0x1b'),'event':_0xf9c0('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf9c0('0x1a'),'model':_0xf9c0('0x1c'),'event':_0xf9c0('0xd'),'condition':_0xf9c0('0xb'),'callback':afterCreateMessage}];function request(_0x291a14){return client[_0xf9c0('0x1d')](_0xf9c0('0x1e'),_0x291a14)[_0xf9c0('0x1f')](function(_0x289f49){logger[_0xf9c0('0x20')](_0xf9c0('0x21'),_0xf9c0('0x1e'),_0x289f49);if(_0x289f49[_0xf9c0('0x22')]){if(_0x289f49[_0xf9c0('0x22')][_0xf9c0('0x23')]===0x1f4){logger[_0xf9c0('0x22')](_0xf9c0('0x21'),_0xf9c0('0x1e'),_0x289f49['error']);}}})[_0xf9c0('0x24')](function(_0xb6d9af){logger['error'](_0xf9c0('0x21'),_0xf9c0('0x1e'),_0xb6d9af);});}function afterCreateMessage(_0x3d816f){return function(_0x53a27a){_0x53a27a=_0x53a27a[_0xf9c0('0x25')]({'plain':!![]});_0x53a27a[_0xf9c0('0x26')]=_0x3d816f;_0x53a27a[_0xf9c0('0x27')]=_0x3d816f;_0x53a27a[_0xf9c0('0x28')]=_0x53a27a[_0xf9c0('0x29')];Promise[_0xf9c0('0x2a')]()['then'](function(){if(typeof _0x53a27a[_0xf9c0('0x2b')]===_0xf9c0('0x2c'))return null;var _0x301677='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53a27a['ContactId'];return db[_0xf9c0('0x2d')][_0xf9c0('0x2e')](_0x301677,{'type':db[_0xf9c0('0x2f')][_0xf9c0('0x30')][_0xf9c0('0x31')],'raw':!![]});})[_0xf9c0('0x1f')](function(_0x29b82a){if(_0x29b82a){_0x53a27a[_0xf9c0('0x32')]=_0x29b82a[0x0];}if(typeof _0x53a27a['UserId']===_0xf9c0('0x2c'))return;return getAgent(_0x53a27a[_0xf9c0('0x33')]);})['then'](function(_0x504cf5){if(_0x504cf5){_0x53a27a[_0xf9c0('0x34')]=util['format'](_0xf9c0('0x35'),_0x504cf5[_0xf9c0('0x36')]);_0x53a27a[_0xf9c0('0x37')]=_0x504cf5;_0x53a27a[_0xf9c0('0x26')]=_0x3d816f;return request({'event':_0xf9c0('0x38'),'message':_0x53a27a});}else{return request({'event':_0xf9c0('0x39'),'message':_0x53a27a});}})['catch'](function(_0x4310f4){logger['error'](_0xf9c0('0x21'),'AfterCreateMessage',_0x4310f4);});};}function afterCreateOfflineMessage(_0x4200af){return function(_0x43e953){_0x43e953=_0x43e953[_0xf9c0('0x25')]({'plain':!![]});_0x43e953[_0xf9c0('0x26')]=_0x4200af;_0x43e953['motionChannel']=_0x4200af;_0x43e953['event']='offlineMessage';return request({'event':_0x43e953[_0xf9c0('0x28')],'message':_0x43e953});};}function afterCreate(_0x8b2499,_0x30987f){return function(_0x582be1){_0x582be1=_0x582be1[_0xf9c0('0x25')]({'plain':!![]});_0x582be1[_0xf9c0('0x26')]=_0x8b2499;_0x582be1[_0xf9c0('0x27')]=_0x8b2499;_0x582be1[_0xf9c0('0x28')]=_0xf9c0('0x3a');Promise[_0xf9c0('0x2a')]()[_0xf9c0('0x1f')](function(){var _0x3b363b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x582be1['ContactId'];return db[_0xf9c0('0x2d')][_0xf9c0('0x2e')](_0x3b363b,{'type':db[_0xf9c0('0x2f')][_0xf9c0('0x30')]['SELECT'],'raw':!![]});})[_0xf9c0('0x1f')](function(_0x5c5bb5){if(_0x5c5bb5){_0x582be1[_0xf9c0('0x32')]=_0x5c5bb5[0x0];}if(typeof _0x582be1[_0xf9c0('0x33')]===_0xf9c0('0x2c'))return;return getAgent(_0x582be1['UserId']);})[_0xf9c0('0x1f')](function(_0x65e22e){if(_0x65e22e){_0x582be1['interface']=util[_0xf9c0('0x3b')](_0xf9c0('0x35'),_0x65e22e[_0xf9c0('0x36')]);_0x582be1[_0xf9c0('0x37')]=_0x65e22e;}return request({'event':_0x30987f,'message':_0x582be1});})[_0xf9c0('0x24')](function(_0x321779){logger[_0xf9c0('0x22')](_0xf9c0('0x21'),'AfterCreate',_0x321779);});};}function afterUpdate(_0x5363a2){return function(_0x1fa851){var _0x525023=_0x1fa851[_0xf9c0('0x3c')](_0xf9c0('0x3d'))&&_0x1fa851[_0xf9c0('0x3d')];var _0x495977=_0x1fa851['changed']('substatus');if(_0x525023||_0x495977){var _0x4c99c0=_0x525023?'closedinteraction':_0xf9c0('0x3e');var _0x1bfe7e=_0x1fa851[_0xf9c0('0x25')]({'plain':!![]});_0x1bfe7e[_0xf9c0('0x26')]=_0x5363a2;_0x1bfe7e['motionChannel']=_0x5363a2;_0x1bfe7e[_0xf9c0('0x28')]=_0x525023?_0xf9c0('0x3d'):'substatus';var _0x2049b6=_0xf9c0('0x3f')+_0x1bfe7e[_0xf9c0('0x2b')];return db[_0xf9c0('0x2d')][_0xf9c0('0x2e')](_0x2049b6,{'type':db[_0xf9c0('0x2f')][_0xf9c0('0x30')][_0xf9c0('0x31')],'raw':!![]})[_0xf9c0('0x1f')](function(_0x15d9f3){if(_0x15d9f3){_0x1bfe7e[_0xf9c0('0x32')]=_0x15d9f3[0x0];}if(typeof _0x1bfe7e[_0xf9c0('0x33')]===_0xf9c0('0x2c'))return;return getAgent(_0x1bfe7e['UserId']);})[_0xf9c0('0x1f')](function(_0x32216b){if(_0x32216b){_0x1bfe7e[_0xf9c0('0x34')]=util[_0xf9c0('0x3b')](_0xf9c0('0x35'),_0x32216b[_0xf9c0('0x36')]);_0x1bfe7e[_0xf9c0('0x37')]=_0x32216b;}return request({'event':_0x4c99c0,'message':_0x1bfe7e});})['catch'](function(_0x1cd2d6){logger[_0xf9c0('0x22')]('Trigger,\x20%s',_0xf9c0('0x40'),_0x1cd2d6);});}};}function getAgent(_0xd35abc){return db['User'][_0xf9c0('0x41')]({'where':{'id':_0xd35abc},'attributes':['id',_0xf9c0('0x36'),_0xf9c0('0x42'),_0xf9c0('0x43'),'internal'],'raw':!![]})['then'](function(_0x3473b3){return _0x3473b3;});}exports['default']=function(){for(var _0x5e3d8e=0x0;_0x5e3d8e=_0x872381[_0x19f0('0x14')]){throw Error(_0x19f0('0x15'));}_0x488d26(_0x2e1260);})[_0x19f0('0x16')](function(_0x4c998c){_0x416e48(_0x4c998c);});});}; \ No newline at end of file +var _0x8cd2=['User','count','agent','then','agents','catch','lodash','./license/util','voice','mail','fax','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','role'];(function(_0x9571a5,_0xae6266){var _0x58bca6=function(_0x512104){while(--_0x512104){_0x9571a5['push'](_0x9571a5['shift']());}};_0x58bca6(++_0xae6266);}(_0x8cd2,0x6a));var _0x28cd=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x8cd2[_0x14f7fe];return _0x3d8309;};'use strict';var _=require(_0x28cd('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x28cd('0x1'));var channels=[_0x28cd('0x2'),_0x28cd('0x3'),'chat',_0x28cd('0x4'),_0x28cd('0x5'),_0x28cd('0x6'),_0x28cd('0x7')];exports['getChannels']=function(){return channels;};exports[_0x28cd('0x8')]=function(_0x21fa2b){_0x21fa2b=_0x21fa2b[_0x28cd('0x9')]();return _[_0x28cd('0xa')](channels,_0x21fa2b);};exports['clearBlockUser']=function(_0x3af6f7,_0x411879,_0xea6a52,_0x2f252c){var _0x13e47a={'loginAttempts':_0x411879,'blocked':_0xea6a52};if(!_[_0x28cd('0xb')](_0x2f252c)){_0x13e47a[_0x28cd('0xc')]=_0x2f252c;}return _0x3af6f7['updateAttributes'](_0x13e47a);};exports['getLicense']=function(_0x112cd9){return new BPromise(function(_0x430fc5,_0x567ae7){var _0x4019dd=0x0;if(_0x112cd9[_0x28cd('0xd')]!=='agent'){_0x430fc5(_0x112cd9);}db[_0x28cd('0xe')][_0x28cd('0xf')]({'where':{'role':_0x28cd('0x10'),'online':!![],'id':{'$ne':_0x112cd9['id']}}})[_0x28cd('0x11')](function(_0x1bcb30){_0x4019dd=_0x1bcb30;return util['getLicense']();})[_0x28cd('0x11')](function(_0x2e7197){if(_0x2e7197&&_0x2e7197[_0x28cd('0x12')]&&_0x4019dd>=_0x2e7197[_0x28cd('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x430fc5(_0x112cd9);})[_0x28cd('0x13')](function(_0x106b5d){_0x567ae7(_0x106b5d);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 04f7a2d..6e9043e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf90e=['status','render','json'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf90e,0x126));var _0xef90=function(_0x4fb4f1,_0x53a4c4){_0x4fb4f1=_0x4fb4f1-0x0;var _0x2db71b=_0xf90e[_0x4fb4f1];return _0x2db71b;};'use strict';module['exports'][0x194]=function pageNotFound(_0x19e082,_0xf5611c){var _0x360d00='404';var _0x3f7903=0x194;var _0x1c1fca={'status':_0x3f7903};_0xf5611c[_0xef90('0x0')](_0x1c1fca[_0xef90('0x0')]);_0xf5611c[_0xef90('0x1')](_0x360d00,{},function(_0x1b8b8d,_0x257a78){if(_0x1b8b8d){return _0xf5611c[_0xef90('0x0')](_0x1c1fca['status'])[_0xef90('0x2')](_0x1c1fca);}_0xf5611c['send'](_0x257a78);});}; \ No newline at end of file +var _0x35f6=['404','status','render','json'];(function(_0x2a7959,_0x5aaf1e){var _0x358727=function(_0x3464ae){while(--_0x3464ae){_0x2a7959['push'](_0x2a7959['shift']());}};_0x358727(++_0x5aaf1e);}(_0x35f6,0x11c));var _0x635f=function(_0x322d4c,_0x22edb7){_0x322d4c=_0x322d4c-0x0;var _0x39126a=_0x35f6[_0x322d4c];return _0x39126a;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1c62a8,_0x4aef61){var _0xdc1584=_0x635f('0x0');var _0x194344=0x194;var _0x754f30={'status':_0x194344};_0x4aef61[_0x635f('0x1')](_0x754f30['status']);_0x4aef61[_0x635f('0x2')](_0xdc1584,{},function(_0x31b69c,_0x53c7bd){if(_0x31b69c){return _0x4aef61['status'](_0x754f30[_0x635f('0x1')])[_0x635f('0x3')](_0x754f30);}_0x4aef61['send'](_0x53c7bd);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e39be9d..f5e7bed 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b5e=['UserId','hasOne','userSetting','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','Groups','Contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsite','ChatWebsites','user_has_chat_websites','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceContext','moh_has_sounds','VoiceQueue','VoiceQueueId','CmHopperFinal','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','Applications','List','Template','user_has_mail_accounts','team_has_mail_queues','Teams','Messages','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','ListId','Contact','Items','FaxAccount','FaxAccountId','FaxApplication','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','UserFaxQueue','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatApplication','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','CompanyId','CmHopper','Hoppers','HopperFinals','HopperHistories','Company','cm_user_has_contacts','Agent','Campaign','CampaignId','Condition','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','Mohs','cm_contact_has_tags','AllConditions','AnyConditions','AnyCondition','TriggerAnyId','CustomReportId','AnalyticDefaultReport','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','Configurations','Description','DeskAccount','int_desk_configuration_has_tags','Subject','ZohoAccount','ZohoConfiguration','int_zendesk_configuration_has_tags','VtigerConfiguration','FromId','JscriptyProject','ProjectId','MailQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToMailAccountId','ToUserId','ToChatQueueId','ToQueue','FromFaxAccountId','ToFaxAccountId','ToAccount','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CmCustomField','CustomFields','Queues','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8mb4','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxInteraction','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.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','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','VoiceMail','cascade'];(function(_0xe086c8,_0x3bb7a6){var _0x23e70e=function(_0x165c90){while(--_0x165c90){_0xe086c8['push'](_0xe086c8['shift']());}};_0x23e70e(++_0x3bb7a6);}(_0x7b5e,0xe6));var _0xe7b5=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7b5e[_0x24061a];return _0x82054e;};'use strict';var config=require(_0xe7b5('0x0'));var Sequelize=require(_0xe7b5('0x1'));var _=require(_0xe7b5('0x2'));var jstz=require(_0xe7b5('0x3'));var timezone=jstz['determine']();config[_0xe7b5('0x1')]=_['defaultsDeep'](config[_0xe7b5('0x1')],{'database':'motion2','username':_0xe7b5('0x4'),'password':_0xe7b5('0x5'),'options':{'host':_0xe7b5('0x6'),'port':0xcea,'dialect':_0xe7b5('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xe7b5('0x8')](),'define':{'charset':_0xe7b5('0x9'),'collate':_0xe7b5('0xa')}}});config[_0xe7b5('0xb')]=_[_0xe7b5('0xc')](config[_0xe7b5('0xb')],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':_0xe7b5('0x6'),'port':0xcea,'dialect':_0xe7b5('0x7'),'dialectOptions':{'charset':_0xe7b5('0xd')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe7b5('0x9'),'collate':_0xe7b5('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe7b5('0x1')][_0xe7b5('0xe')],config['sequelize']['username'],config[_0xe7b5('0x1')][_0xe7b5('0xf')],config['sequelize'][_0xe7b5('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe7b5('0xb')][_0xe7b5('0xe')],config['sequelizeHistory'][_0xe7b5('0x11')],config[_0xe7b5('0xb')][_0xe7b5('0xf')],config[_0xe7b5('0xb')][_0xe7b5('0x10')])};db[_0xe7b5('0x12')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x14'));db[_0xe7b5('0x15')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x16'));db['VoiceContext']=db[_0xe7b5('0x1')]['import']('../api/voiceContext/voiceContext.model');db[_0xe7b5('0x17')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x18'));db[_0xe7b5('0x19')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x1a'));db['VoiceQueue']=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x1b'));db[_0xe7b5('0x1c')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x1d'));db[_0xe7b5('0x1e')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x1f'));db['VoiceMail']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x20'));db[_0xe7b5('0x21')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x22'));db[_0xe7b5('0x23')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xe7b5('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xe7b5('0x24')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x25'));db[_0xe7b5('0x26')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/memberReport/memberReport.model');db[_0xe7b5('0x27')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/trunk/trunk.model');db[_0xe7b5('0x28')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x29'));db[_0xe7b5('0x2a')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe7b5('0x2b')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x2c'));db['UserChatQueue']=db['sequelize'][_0xe7b5('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xe7b5('0x2d')]=db[_0xe7b5('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x2e'));db[_0xe7b5('0x2f')]=db[_0xe7b5('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xe7b5('0x30')]=db['sequelize'][_0xe7b5('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x31'));db[_0xe7b5('0x32')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x33'));db[_0xe7b5('0x34')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x35'));db[_0xe7b5('0x36')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x37'));db['MailQueue']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x38'));db['MailSubstatus']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x39'));db[_0xe7b5('0x3a')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x3b'));db['MailMessage']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/mailMessage/mailMessage.model');db[_0xe7b5('0x3c')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x3d'));db['MailQueueReport']=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x3e'));db[_0xe7b5('0x3f')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x40'));db[_0xe7b5('0x41')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x42'));db['FaxAccount']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x43'));db['FaxApplication']=db['sequelize'][_0xe7b5('0x13')]('../api/faxApplication/faxApplication.model');db[_0xe7b5('0x44')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/faxMessage/faxMessage.model');db[_0xe7b5('0x45')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x46'));db['FaxQueueReport']=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x47'));db[_0xe7b5('0x48')]=db['sequelize'][_0xe7b5('0x13')]('../api/smsAccount/smsAccount.model');db[_0xe7b5('0x49')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x4a'));db['SmsInteraction']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x4b'));db[_0xe7b5('0x4c')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/smsMessage/smsMessage.model');db[_0xe7b5('0x4d')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x4e'));db[_0xe7b5('0x4f')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x50'));db[_0xe7b5('0x51')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x52'));db[_0xe7b5('0x53')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x54'));db[_0xe7b5('0x55')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x56'));db[_0xe7b5('0x57')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0xe7b5('0x58')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x59'));db['ChatApplication']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x5a'));db[_0xe7b5('0x5b')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x5c'));db[_0xe7b5('0x5d')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x5e'));db[_0xe7b5('0x5f')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xe7b5('0x60')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x61'));db[_0xe7b5('0x62')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/chatGroup/chatGroup.model');db[_0xe7b5('0x63')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xe7b5('0x64')]=db['sequelize'][_0xe7b5('0x13')]('../api/cmCompany/cmCompany.model');db[_0xe7b5('0x65')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x66'));db['CmHopper']=db['sequelize']['import'](_0xe7b5('0x67'));db[_0xe7b5('0x68')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x69'));db['CmHopperFinal']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x6a'));db[_0xe7b5('0x6b')]=db[_0xe7b5('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xe7b5('0x6c')]=db[_0xe7b5('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xe7b5('0x6d')]=db['sequelize'][_0xe7b5('0x13')]('../api/action/action.model');db[_0xe7b5('0x6e')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x6f'));db[_0xe7b5('0x70')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x71'));db[_0xe7b5('0x72')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x73'));db['Condition']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x74'));db[_0xe7b5('0x75')]=db[_0xe7b5('0x1')]['import']('../api/interval/interval.model');db[_0xe7b5('0x76')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x77'));db[_0xe7b5('0x78')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/cdr/cdr.model');db[_0xe7b5('0x79')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x7a'));db[_0xe7b5('0x7b')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x7c'));db[_0xe7b5('0x7d')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x7e'));db[_0xe7b5('0x7f')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x80'));db['Template']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/template/template.model');db[_0xe7b5('0x81')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/trigger/trigger.model');db[_0xe7b5('0x82')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x83'));db[_0xe7b5('0x84')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/integration/integration.model');db['IntegrationReport']=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x85'));db['AnalyticCustomReport']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x86'));db['AnalyticDefaultReport']=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x87'));db[_0xe7b5('0x88')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x89'));db['AnalyticMetric']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x8a'));db['AnalyticFieldReport']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x8b'));db[_0xe7b5('0x8c')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x8d'));db[_0xe7b5('0x8e')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0x8f'));db[_0xe7b5('0x90')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x91'));db[_0xe7b5('0x92')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x93'));db[_0xe7b5('0x94')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x95'));db[_0xe7b5('0x96')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xe7b5('0x97')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x98'));db['DeskAccount']=db['sequelize']['import'](_0xe7b5('0x99'));db[_0xe7b5('0x9a')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x9b'));db[_0xe7b5('0x9c')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x9d'));db['ZohoAccount']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0x9e'));db['ZohoConfiguration']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xe7b5('0x9f')]=db['sequelize'][_0xe7b5('0x13')]('../api/intZohoField/intZohoField.model');db[_0xe7b5('0xa0')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xa1'));db[_0xe7b5('0xa2')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xa3'));db[_0xe7b5('0xa4')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xa5'));db['FreshdeskAccount']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xa6'));db[_0xe7b5('0xa7')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xa8'));db[_0xe7b5('0xa9')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xaa'));db[_0xe7b5('0xab')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xac'));db['VtigerConfiguration']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xad'));db[_0xe7b5('0xae')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xaf'));db[_0xe7b5('0xb0')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xe7b5('0xb1')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xb2'));db[_0xe7b5('0xb3')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xb4'));db[_0xe7b5('0xb5')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xb6'));db[_0xe7b5('0xb7')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xb8'));db[_0xe7b5('0xb9')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xba'));db[_0xe7b5('0xbb')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xe7b5('0xbc')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0xbd'));db[_0xe7b5('0xbe')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xbf'));db[_0xe7b5('0x84')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xc0'));db[_0xe7b5('0xc1')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xc2'));db[_0xe7b5('0xc3')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xc4'));db[_0xe7b5('0xc5')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xc6'));db[_0xe7b5('0xc7')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xc8'));db[_0xe7b5('0xc9')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0xca'));db[_0xe7b5('0xcb')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0xcc'));db[_0xe7b5('0xcd')]=db['sequelize'][_0xe7b5('0x13')]('../api/squareReport/squareReport.model');db[_0xe7b5('0xce')]=db['sequelize']['import'](_0xe7b5('0xcf'));db['JscriptyProject']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xd0'));db[_0xe7b5('0xd1')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xd2'));db[_0xe7b5('0xd3')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xd4'));db[_0xe7b5('0xd5')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xd6'));db[_0xe7b5('0xd7')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xd8'));db['SquareMessage']=db['sequelize'][_0xe7b5('0x13')]('../api/squareMessage/squareMessage.model');db[_0xe7b5('0xd9')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/team/team.model');db[_0xe7b5('0xda')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xdb'));db['Campaign']=db['sequelize'][_0xe7b5('0x13')]('../api/campaign/campaign.model');db[_0xe7b5('0xdc')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xdd'));db[_0xe7b5('0xde')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xdf'));db[_0xe7b5('0xe0')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xe1'));db[_0xe7b5('0xe2')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xe7b5('0xe3')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xe4'));db[_0xe7b5('0xe5')]=db[_0xe7b5('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xe6'));db[_0xe7b5('0xe7')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xe8'));db[_0xe7b5('0xe9')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xea'));db[_0xe7b5('0xeb')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xec'));db[_0xe7b5('0xed')]=db[_0xe7b5('0x1')]['import']('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xee'));db[_0xe7b5('0xef')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0xf0'));db[_0xe7b5('0xf1')]=db['sequelize'][_0xe7b5('0x13')](_0xe7b5('0xf2'));db[_0xe7b5('0xf3')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xf4'));db['WhatsappInteraction']=db[_0xe7b5('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe7b5('0xf5')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xf6'));db[_0xe7b5('0xf7')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xf8'));db[_0xe7b5('0xf9')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0xfa'));db[_0xe7b5('0xfb')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xfc'));db['CloudProvider']=db['sequelize']['import'](_0xe7b5('0xfd'));db['TeamVoiceQueue']=db[_0xe7b5('0x1')][_0xe7b5('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xe7b5('0xfe')]=db[_0xe7b5('0x1')][_0xe7b5('0x13')](_0xe7b5('0xff'));db[_0xe7b5('0x100')]=db[_0xe7b5('0x1')]['import'](_0xe7b5('0x101'));db[_0xe7b5('0x102')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db[_0xe7b5('0x12')]['hasOne'](db[_0xe7b5('0x103')],{'as':_0xe7b5('0x103'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x12')][_0xe7b5('0x106')](db[_0xe7b5('0x102')],{'as':_0xe7b5('0x107'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x105')});db['User']['hasMany'](db['VoiceRecording'],{'as':_0xe7b5('0x108'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x12')][_0xe7b5('0x109')](db[_0xe7b5('0x2a')],{'as':_0xe7b5('0x10a'),'foreignKey':_0xe7b5('0x105')});db['User'][_0xe7b5('0x109')](db[_0xe7b5('0x17')],{'as':_0xe7b5('0x10b'),'onDelete':'cascade','hooks':!![]});db[_0xe7b5('0x12')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe7b5('0x105')});db['User'][_0xe7b5('0x109')](db['CmHopperHistory'],{'as':_0xe7b5('0x10c'),'foreignKey':'UserId'});db['User'][_0xe7b5('0x109')](db[_0xe7b5('0x6c')],{'as':_0xe7b5('0x6c'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x12')][_0xe7b5('0x109')](db['OpenchannelInteraction'],{'as':_0xe7b5('0x10d'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x12')][_0xe7b5('0x109')](db[_0xe7b5('0x5b')],{'as':_0xe7b5('0x10e'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x12')][_0xe7b5('0x109')](db[_0xe7b5('0x10f')],{'as':_0xe7b5('0x110'),'foreignKey':_0xe7b5('0x105')});db['User']['hasMany'](db[_0xe7b5('0x44')],{'as':_0xe7b5('0x111'),'foreignKey':_0xe7b5('0x105')});db['User'][_0xe7b5('0x109')](db[_0xe7b5('0x3a')],{'as':_0xe7b5('0x112'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x12')][_0xe7b5('0x109')](db['WhatsappInteraction'],{'as':_0xe7b5('0x113'),'foreignKey':_0xe7b5('0x105')});db['User'][_0xe7b5('0x109')](db[_0xe7b5('0xf1')],{'as':_0xe7b5('0x114'),'foreignKey':'SenderId'});db[_0xe7b5('0x12')][_0xe7b5('0x115')](db[_0xe7b5('0xed')],{'as':_0xe7b5('0xed'),'foreignKey':_0xe7b5('0x116')});db[_0xe7b5('0x12')]['belongsToMany'](db[_0xe7b5('0x62')],{'as':_0xe7b5('0x117'),'through':'chat_group_has_users'});db[_0xe7b5('0x12')]['belongsToMany'](db['CmContact'],{'as':_0xe7b5('0x118'),'through':'cm_user_has_contacts'});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x11a'),'through':_0xe7b5('0x11b')});db['User'][_0xe7b5('0x119')](db['Team'],{'through':_0xe7b5('0x11c')});db['User'][_0xe7b5('0x119')](db[_0xe7b5('0x3a')],{'as':_0xe7b5('0x112'),'through':_0xe7b5('0x11d')});db[_0xe7b5('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0xe7b5('0x10e'),'through':_0xe7b5('0x11e')});db['User'][_0xe7b5('0x119')](db[_0xe7b5('0x44')],{'as':'FaxInteractions','through':_0xe7b5('0x11f')});db['User']['belongsToMany'](db['SmsInteraction'],{'as':'SmsInteractions','through':_0xe7b5('0x120')});db[_0xe7b5('0x12')]['belongsToMany'](db[_0xe7b5('0x53')],{'as':'OpenchannelInteractions','through':_0xe7b5('0x121')});db[_0xe7b5('0x12')]['belongsToMany'](db[_0xe7b5('0x122')],{'as':_0xe7b5('0x113'),'through':_0xe7b5('0x123')});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db['VoiceQueue'],{'as':_0xe7b5('0x124'),'through':'UserVoiceQueue','required':![]});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db[_0xe7b5('0xeb')],{'as':_0xe7b5('0x125'),'through':_0xe7b5('0x100'),'required':![]});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db[_0xe7b5('0x126')],{'as':'MailQueues','through':_0xe7b5('0x2d'),'required':![]});db['User'][_0xe7b5('0x119')](db['ChatQueue'],{'as':_0xe7b5('0x127'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db['FaxQueue'],{'as':_0xe7b5('0x128'),'through':'UserFaxQueue','required':![]});db[_0xe7b5('0x12')]['belongsToMany'](db[_0xe7b5('0x4d')],{'as':_0xe7b5('0x129'),'through':_0xe7b5('0x2f'),'required':![]});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db['OpenchannelQueue'],{'as':_0xe7b5('0x12a'),'through':_0xe7b5('0x30'),'required':![]});db['User']['belongsToMany'](db['WhatsappQueue'],{'as':_0xe7b5('0x12b'),'through':_0xe7b5('0x12c'),'required':![]});db[_0xe7b5('0x12')]['belongsToMany'](db['CmList'],{'through':_0xe7b5('0x11b')});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db[_0xe7b5('0x12d')],{'as':_0xe7b5('0x12e'),'through':_0xe7b5('0x12f')});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db[_0xe7b5('0x36')],{'as':_0xe7b5('0x130'),'through':'user_has_mail_accounts'});db[_0xe7b5('0x12')]['belongsToMany'](db[_0xe7b5('0x4f')],{'as':_0xe7b5('0x131'),'through':_0xe7b5('0x132')});db[_0xe7b5('0x12')]['belongsToMany'](db[_0xe7b5('0x48')],{'as':_0xe7b5('0x133'),'through':_0xe7b5('0x134')});db[_0xe7b5('0x12')][_0xe7b5('0x119')](db['WhatsappAccount'],{'as':_0xe7b5('0x135'),'through':_0xe7b5('0x136')});db['User'][_0xe7b5('0x119')](db[_0xe7b5('0xd5')],{'as':_0xe7b5('0x137'),'through':_0xe7b5('0x138')});db[_0xe7b5('0x15')][_0xe7b5('0x109')](db[_0xe7b5('0x17')],{'as':'SpiedAgents','onDelete':_0xe7b5('0x104'),'foreignKey':'ChanSpyId'});db[_0xe7b5('0x139')][_0xe7b5('0x109')](db[_0xe7b5('0x17')],{'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x17')][_0xe7b5('0x109')](db[_0xe7b5('0x17')],{'as':'Applications','onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x19')][_0xe7b5('0x119')](db[_0xe7b5('0x7d')],{'as':'Sounds','through':_0xe7b5('0x13a')});db[_0xe7b5('0x13b')][_0xe7b5('0x109')](db[_0xe7b5('0x2a')],{'as':'Members','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe7b5('0x109')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xe7b5('0x13c')});db[_0xe7b5('0x13b')][_0xe7b5('0x109')](db[_0xe7b5('0x13d')],{'as':'HopperFinals','foreignKey':_0xe7b5('0x13c')});db[_0xe7b5('0x13b')][_0xe7b5('0x109')](db[_0xe7b5('0x6b')],{'as':'HopperHistories','foreignKey':_0xe7b5('0x13c')});db[_0xe7b5('0x13b')][_0xe7b5('0x109')](db[_0xe7b5('0x6c')],{'as':_0xe7b5('0x6c'),'foreignKey':_0xe7b5('0x13c')});db[_0xe7b5('0x13b')][_0xe7b5('0x109')](db[_0xe7b5('0x68')],{'as':_0xe7b5('0x13e'),'foreignKey':_0xe7b5('0x13c')});db['VoiceQueue'][_0xe7b5('0x109')](db[_0xe7b5('0xc9')],{'as':_0xe7b5('0x13f'),'foreignKey':_0xe7b5('0x13c')});db[_0xe7b5('0x13b')][_0xe7b5('0x115')](db[_0xe7b5('0x27')],{'as':_0xe7b5('0x27'),'foreignKey':_0xe7b5('0x140')});db['VoiceQueue'][_0xe7b5('0x115')](db[_0xe7b5('0x27')],{'as':_0xe7b5('0x141'),'foreignKey':'TrunkBackupId'});db[_0xe7b5('0x13b')][_0xe7b5('0x115')](db[_0xe7b5('0x75')],{'as':_0xe7b5('0x75'),'foreignKey':_0xe7b5('0x142')});db[_0xe7b5('0x13b')][_0xe7b5('0x115')](db[_0xe7b5('0x76')],{'as':_0xe7b5('0x143'),'foreignKey':_0xe7b5('0x144')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0xe7b5('0x11a'),'through':_0xe7b5('0x145')});db['VoiceQueue'][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x2b')});db['VoiceQueue'][_0xe7b5('0x119')](db[_0xe7b5('0xd9')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xe7b5('0x13b')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xe7b5('0x1c')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x12'),'foreignKey':_0xe7b5('0x105')});db['ScreenRecording'][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':'User','foreignKey':_0xe7b5('0x105')});db['VoiceMail'][_0xe7b5('0x109')](db[_0xe7b5('0x21')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xe7b5('0x147'),'sourceKey':'mailbox'});db[_0xe7b5('0x21')][_0xe7b5('0x115')](db[_0xe7b5('0x103')],{'foreignKey':'mailboxuser','targetKey':_0xe7b5('0x148')});db[_0xe7b5('0x23')][_0xe7b5('0x109')](db[_0xe7b5('0x26')],{'as':_0xe7b5('0x149'),'foreignKey':_0xe7b5('0x14a'),'constraints':![]});db[_0xe7b5('0x23')][_0xe7b5('0x109')](db[_0xe7b5('0x24')],{'as':_0xe7b5('0x14b'),'foreignKey':_0xe7b5('0x14a'),'constraints':![]});db[_0xe7b5('0x23')][_0xe7b5('0x115')](db['User'],{'as':_0xe7b5('0x12'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x23')]['belongsTo'](db[_0xe7b5('0x65')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe7b5('0x32')][_0xe7b5('0x115')](db[_0xe7b5('0x36')],{'as':_0xe7b5('0x36'),'foreignKey':_0xe7b5('0x14c')});db[_0xe7b5('0x32')][_0xe7b5('0x115')](db[_0xe7b5('0x14d')],{'as':_0xe7b5('0x14d'),'foreignKey':_0xe7b5('0x14e'),'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x34')][_0xe7b5('0x115')](db[_0xe7b5('0x36')],{'as':_0xe7b5('0x36'),'foreignKey':'MailAccountId'});db[_0xe7b5('0x34')][_0xe7b5('0x115')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0xe7b5('0x14e'),'onDelete':'restrict'});db[_0xe7b5('0x36')][_0xe7b5('0x106')](db['MailServerIn'],{'as':_0xe7b5('0x150'),'onDelete':_0xe7b5('0x104')});db['MailAccount'][_0xe7b5('0x106')](db[_0xe7b5('0x34')],{'as':_0xe7b5('0x151'),'onDelete':'cascade'});db[_0xe7b5('0x36')][_0xe7b5('0x109')](db['Disposition'],{'as':_0xe7b5('0x152'),'foreignKey':'MailAccountId','onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x36')][_0xe7b5('0x109')](db[_0xe7b5('0x70')],{'as':_0xe7b5('0x153'),'foreignKey':'MailAccountId'});db[_0xe7b5('0x36')][_0xe7b5('0x109')](db[_0xe7b5('0x154')],{'as':'Messages','foreignKey':_0xe7b5('0x14c')});db[_0xe7b5('0x36')][_0xe7b5('0x109')](db[_0xe7b5('0x3a')],{'as':_0xe7b5('0x155')});db[_0xe7b5('0x36')][_0xe7b5('0x109')](db['MailApplication'],{'as':_0xe7b5('0x156')});db[_0xe7b5('0x36')]['belongsTo'](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':'ListId'});db['MailAccount'][_0xe7b5('0x115')](db[_0xe7b5('0x158')],{'as':_0xe7b5('0x158'),'foreignKey':'TemplateId'});db[_0xe7b5('0x36')][_0xe7b5('0x115')](db[_0xe7b5('0x76')],{'as':'mandatoryDispositionPause','foreignKey':_0xe7b5('0x144')});db[_0xe7b5('0x36')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x159')});db[_0xe7b5('0x126')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x2d')});db['MailQueue'][_0xe7b5('0x119')](db[_0xe7b5('0xd9')],{'through':_0xe7b5('0x15a'),'as':_0xe7b5('0x15b')});db[_0xe7b5('0x3a')][_0xe7b5('0x109')](db[_0xe7b5('0x154')],{'as':_0xe7b5('0x15c'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x15d')});db[_0xe7b5('0x3a')][_0xe7b5('0x115')](db['MailAccount'],{'as':_0xe7b5('0x15e'),'foreignKey':'MailAccountId'});db[_0xe7b5('0x3a')][_0xe7b5('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0x3a')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x160'),'foreignKey':'UserId'});db[_0xe7b5('0x3a')]['belongsToMany'](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x161'),'as':_0xe7b5('0x162')});db['MailInteraction'][_0xe7b5('0x119')](db['Tag'],{'through':_0xe7b5('0x161'),'as':'ThroughTags'});db['MailInteraction'][_0xe7b5('0x119')](db['User'],{'as':_0xe7b5('0x163'),'through':'user_has_mail_interactions','foreignKey':_0xe7b5('0x15d')});db[_0xe7b5('0x154')][_0xe7b5('0x109')](db['Attachment'],{'as':_0xe7b5('0x164'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x12')});db['MailMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'onDelete':_0xe7b5('0x104'),'as':'Contact'});db[_0xe7b5('0x154')]['belongsTo'](db[_0xe7b5('0x3a')],{'as':_0xe7b5('0x165'),'foreignKey':_0xe7b5('0x15d')});db[_0xe7b5('0x154')]['belongsTo'](db[_0xe7b5('0x36')],{'as':'Account','foreignKey':_0xe7b5('0x14c')});db[_0xe7b5('0x154')][_0xe7b5('0x115')](db[_0xe7b5('0x12d')],{'as':_0xe7b5('0x12d'),'foreignKey':_0xe7b5('0x166')});db[_0xe7b5('0x154')][_0xe7b5('0x115')](db[_0xe7b5('0x5f')],{'as':_0xe7b5('0x5f'),'foreignKey':_0xe7b5('0x167')});db['MailApplication']['belongsTo'](db[_0xe7b5('0x12')],{'onDelete':_0xe7b5('0x14f')});db['MailApplication'][_0xe7b5('0x115')](db['MailQueue'],{'onDelete':_0xe7b5('0x14f')});db['MailApplication'][_0xe7b5('0x115')](db[_0xe7b5('0x36')],{'onDelete':'restrict'});db[_0xe7b5('0x3c')][_0xe7b5('0x115')](db[_0xe7b5('0x75')],{'onDelete':_0xe7b5('0x14f'),'foreignKey':_0xe7b5('0x142')});db['MailApplication'][_0xe7b5('0x115')](db[_0xe7b5('0x7f')],{'onDelete':'restrict','foreignKey':_0xe7b5('0x168')});db[_0xe7b5('0x169')][_0xe7b5('0x115')](db[_0xe7b5('0x36')],{});db[_0xe7b5('0x169')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0x169')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x16b'),'foreignKey':'ContactId'});db[_0xe7b5('0x169')]['belongsTo'](db['MailInteraction'],{});db[_0xe7b5('0x169')][_0xe7b5('0x115')](db['MailMessage'],{});db[_0xe7b5('0x169')][_0xe7b5('0x115')](db['User'],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0xe7b5('0x3f')]['hasMany'](db[_0xe7b5('0x41')],{'as':_0xe7b5('0x16c'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x16d')][_0xe7b5('0x109')](db[_0xe7b5('0x72')],{'as':'Dispositions','foreignKey':_0xe7b5('0x16e'),'onDelete':_0xe7b5('0x104')});db['FaxAccount'][_0xe7b5('0x109')](db[_0xe7b5('0x70')],{'as':_0xe7b5('0x153'),'foreignKey':_0xe7b5('0x16e')});db[_0xe7b5('0x16d')][_0xe7b5('0x109')](db[_0xe7b5('0x44')],{'as':_0xe7b5('0x155')});db['FaxAccount'][_0xe7b5('0x109')](db[_0xe7b5('0x16f')],{'as':_0xe7b5('0x156')});db[_0xe7b5('0x16d')]['hasMany'](db[_0xe7b5('0x17')],{'as':_0xe7b5('0x170'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x16d')][_0xe7b5('0x109')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount'][_0xe7b5('0x115')](db[_0xe7b5('0x27')],{'as':_0xe7b5('0x27')});db[_0xe7b5('0x16d')][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':_0xe7b5('0x16a')});db['FaxAccount']['belongsTo'](db[_0xe7b5('0x76')],{'as':_0xe7b5('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe7b5('0x16d')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0xe7b5('0x16f')]['belongsTo'](db['User'],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x16f')][_0xe7b5('0x115')](db[_0xe7b5('0x45')],{'onDelete':_0xe7b5('0x14f')});db['FaxApplication'][_0xe7b5('0x115')](db[_0xe7b5('0x16d')],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x16f')][_0xe7b5('0x115')](db['Tag'],{'onDelete':_0xe7b5('0x14f'),'foreignKey':'TagId'});db[_0xe7b5('0x44')][_0xe7b5('0x109')](db[_0xe7b5('0x171')],{'as':_0xe7b5('0x15c'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x172')});db[_0xe7b5('0x44')][_0xe7b5('0x115')](db[_0xe7b5('0x16d')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x16e')});db[_0xe7b5('0x44')]['belongsTo'](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x16b'),'foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0x44')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x160'),'foreignKey':'UserId'});db['FaxInteraction'][_0xe7b5('0x119')](db[_0xe7b5('0x7f')],{'through':'fax_interaction_has_tags','as':_0xe7b5('0x162')});db[_0xe7b5('0x44')][_0xe7b5('0x119')](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x173'),'as':_0xe7b5('0x174')});db[_0xe7b5('0x44')]['belongsToMany'](db[_0xe7b5('0x12')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xe7b5('0x172')});db[_0xe7b5('0x171')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'onDelete':_0xe7b5('0x104'),'as':'User'});db['FaxMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x44')],{'as':_0xe7b5('0x165'),'foreignKey':_0xe7b5('0x172')});db[_0xe7b5('0x171')]['belongsTo'](db[_0xe7b5('0x65')],{'onDelete':_0xe7b5('0x104'),'as':'Contact'});db[_0xe7b5('0x171')][_0xe7b5('0x115')](db[_0xe7b5('0xde')],{'as':_0xe7b5('0xde'),'foreignKey':_0xe7b5('0x175')});db[_0xe7b5('0x171')][_0xe7b5('0x115')](db[_0xe7b5('0x16d')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x16e')});db[_0xe7b5('0x45')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x176')});db[_0xe7b5('0x45')][_0xe7b5('0x119')](db[_0xe7b5('0xd9')],{'through':_0xe7b5('0x177'),'as':_0xe7b5('0x15b')});db[_0xe7b5('0x178')]['belongsTo'](db[_0xe7b5('0x16d')],{});db[_0xe7b5('0x178')][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':_0xe7b5('0x16a')});db['FaxQueueReport']['belongsTo'](db[_0xe7b5('0x65')],{'as':'Contact','foreignKey':'ContactId'});db['FaxQueueReport'][_0xe7b5('0x115')](db[_0xe7b5('0x44')],{});db[_0xe7b5('0x178')]['belongsTo'](db[_0xe7b5('0x171')],{});db[_0xe7b5('0x178')][_0xe7b5('0x115')](db['User'],{});db[_0xe7b5('0x178')]['belongsTo'](db[_0xe7b5('0x45')],{});db['SmsAccount']['hasMany'](db['Disposition'],{'as':_0xe7b5('0x152'),'foreignKey':_0xe7b5('0x179'),'onDelete':'cascade'});db['SmsAccount'][_0xe7b5('0x109')](db[_0xe7b5('0x70')],{'as':'Answers','foreignKey':_0xe7b5('0x179')});db[_0xe7b5('0x48')][_0xe7b5('0x109')](db[_0xe7b5('0x4c')],{'as':'Messages','foreignKey':_0xe7b5('0x179')});db[_0xe7b5('0x48')][_0xe7b5('0x109')](db[_0xe7b5('0x10f')],{'as':_0xe7b5('0x155')});db[_0xe7b5('0x48')]['hasMany'](db[_0xe7b5('0x49')],{'as':_0xe7b5('0x156')});db[_0xe7b5('0x48')][_0xe7b5('0x115')](db['CmList'],{'as':_0xe7b5('0x157'),'foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0x48')][_0xe7b5('0x115')](db[_0xe7b5('0x76')],{'as':_0xe7b5('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe7b5('0x48')]['belongsToMany'](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x134')});db[_0xe7b5('0x49')][_0xe7b5('0x115')](db['User'],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x49')]['belongsTo'](db[_0xe7b5('0x4d')],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x49')][_0xe7b5('0x115')](db[_0xe7b5('0x48')],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x49')][_0xe7b5('0x115')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe7b5('0x142')});db[_0xe7b5('0x49')][_0xe7b5('0x115')](db[_0xe7b5('0x7f')],{'onDelete':'restrict','foreignKey':_0xe7b5('0x168')});db[_0xe7b5('0x10f')][_0xe7b5('0x109')](db[_0xe7b5('0x4c')],{'as':_0xe7b5('0x15c'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x17a')});db['SmsInteraction'][_0xe7b5('0x115')](db[_0xe7b5('0x48')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x179')});db['SmsInteraction'][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'as':'Contact','foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0x10f')]['belongsTo'](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x160'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x10f')][_0xe7b5('0x119')](db[_0xe7b5('0x7f')],{'through':'sms_interaction_has_tags','as':_0xe7b5('0x162')});db[_0xe7b5('0x10f')][_0xe7b5('0x119')](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x17b'),'as':_0xe7b5('0x174')});db[_0xe7b5('0x10f')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':'Users','through':_0xe7b5('0x120'),'foreignKey':_0xe7b5('0x17a')});db['SmsMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x12')});db[_0xe7b5('0x4c')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x16b')});db['SmsMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x10f')],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x165'),'foreignKey':_0xe7b5('0x17a')});db[_0xe7b5('0x4c')]['belongsTo'](db[_0xe7b5('0x48')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x179')});db['SmsQueue'][_0xe7b5('0x119')](db['User'],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x2f'),'foreignKey':_0xe7b5('0x17c')});db['SmsQueue'][_0xe7b5('0x119')](db[_0xe7b5('0xd9')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xe7b5('0x4f')][_0xe7b5('0x109')](db[_0xe7b5('0x72')],{'as':_0xe7b5('0x152'),'foreignKey':'OpenchannelAccountId','onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x4f')][_0xe7b5('0x109')](db[_0xe7b5('0x70')],{'as':_0xe7b5('0x153'),'foreignKey':_0xe7b5('0x17d')});db[_0xe7b5('0x4f')]['hasMany'](db[_0xe7b5('0x53')],{'as':_0xe7b5('0x155'),'foreignKey':_0xe7b5('0x17d')});db[_0xe7b5('0x4f')]['hasMany'](db[_0xe7b5('0x55')],{'as':_0xe7b5('0x15c'),'foreignKey':_0xe7b5('0x17d')});db[_0xe7b5('0x4f')][_0xe7b5('0x109')](db['OpenchannelApplication'],{'as':_0xe7b5('0x156'),'foreignKey':_0xe7b5('0x17d')});db[_0xe7b5('0x4f')][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':'List','foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0x4f')][_0xe7b5('0x115')](db['Pause'],{'as':_0xe7b5('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':'user_has_openchannel_accounts'});db[_0xe7b5('0x51')]['belongsTo'](db[_0xe7b5('0x12')],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x51')]['belongsTo'](db[_0xe7b5('0x57')],{'onDelete':_0xe7b5('0x14f'),'foreignKey':'OpenchannelQueueId'});db[_0xe7b5('0x51')][_0xe7b5('0x115')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xe7b5('0x17d')});db[_0xe7b5('0x51')][_0xe7b5('0x115')](db['Interval'],{'onDelete':_0xe7b5('0x14f'),'foreignKey':_0xe7b5('0x142')});db[_0xe7b5('0x51')][_0xe7b5('0x115')](db[_0xe7b5('0x7f')],{'onDelete':'restrict','foreignKey':_0xe7b5('0x168')});db['OpenchannelInteraction']['hasMany'](db['OpenchannelMessage'],{'as':_0xe7b5('0x15c'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x17e')});db['OpenchannelInteraction'][_0xe7b5('0x115')](db[_0xe7b5('0x4f')],{'as':_0xe7b5('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0xe7b5('0x53')]['belongsTo'](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x16b'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x160'),'foreignKey':_0xe7b5('0x105')});db['OpenchannelInteraction']['belongsToMany'](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x17f'),'as':_0xe7b5('0x162')});db[_0xe7b5('0x53')]['belongsToMany'](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x17f'),'as':_0xe7b5('0x174')});db[_0xe7b5('0x53')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x163'),'through':_0xe7b5('0x121'),'foreignKey':_0xe7b5('0x17e')});db['OpenchannelMessage'][_0xe7b5('0x115')](db['User'],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x12')});db[_0xe7b5('0x55')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'onDelete':'cascade','as':'Contact'});db['OpenchannelMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x53')],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x165'),'foreignKey':'OpenchannelInteractionId'});db[_0xe7b5('0x55')]['belongsTo'](db[_0xe7b5('0xde')],{'as':'Attachment','foreignKey':_0xe7b5('0x175')});db[_0xe7b5('0x55')][_0xe7b5('0x115')](db[_0xe7b5('0x4f')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x17d')});db[_0xe7b5('0x57')]['belongsToMany'](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x30'),'foreignKey':_0xe7b5('0x180')});db[_0xe7b5('0x57')]['belongsToMany'](db[_0xe7b5('0xd9')],{'through':_0xe7b5('0x181'),'as':_0xe7b5('0x15b')});db[_0xe7b5('0x12d')][_0xe7b5('0x109')](db[_0xe7b5('0x72')],{'as':_0xe7b5('0x152'),'foreignKey':_0xe7b5('0x166'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x12d')][_0xe7b5('0x109')](db[_0xe7b5('0x70')],{'as':'Answers','foreignKey':_0xe7b5('0x166')});db[_0xe7b5('0x12d')][_0xe7b5('0x109')](db['ChatProactiveAction'],{'as':_0xe7b5('0x182')});db['ChatWebsite'][_0xe7b5('0x109')](db['ChatInteraction'],{'as':_0xe7b5('0x155')});db[_0xe7b5('0x12d')][_0xe7b5('0x109')](db[_0xe7b5('0x183')],{'as':'Applications'});db[_0xe7b5('0x12d')][_0xe7b5('0x109')](db['ChatMessage'],{'as':_0xe7b5('0x15c')});db[_0xe7b5('0x12d')]['belongsTo'](db['CmList'],{'as':_0xe7b5('0x157'),'foreignKey':'ListId'});db[_0xe7b5('0x12d')][_0xe7b5('0x115')](db['Interval'],{'as':_0xe7b5('0x75'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0xe7b5('0x36')],{'as':_0xe7b5('0x36'),'foreignKey':_0xe7b5('0x14c')});db[_0xe7b5('0x12d')][_0xe7b5('0x115')](db[_0xe7b5('0x76')],{'as':_0xe7b5('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe7b5('0x12d')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xe7b5('0x12f')});db[_0xe7b5('0x58')][_0xe7b5('0x115')](db[_0xe7b5('0x4f')],{});db[_0xe7b5('0x58')]['belongsTo'](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0x58')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x16b'),'foreignKey':'ContactId'});db[_0xe7b5('0x58')]['belongsTo'](db[_0xe7b5('0x53')],{});db[_0xe7b5('0x58')][_0xe7b5('0x115')](db[_0xe7b5('0x55')],{});db[_0xe7b5('0x58')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{});db[_0xe7b5('0x58')][_0xe7b5('0x115')](db[_0xe7b5('0x57')],{});db[_0xe7b5('0x183')][_0xe7b5('0x115')](db['User'],{'as':'Agent','foreignKey':_0xe7b5('0x105'),'onDelete':'restrict'});db['ChatApplication'][_0xe7b5('0x115')](db[_0xe7b5('0x60')],{'as':'Queue','foreignKey':_0xe7b5('0x184'),'onDelete':'restrict'});db['ChatApplication'][_0xe7b5('0x115')](db['ChatWebsite'],{'as':_0xe7b5('0x185'),'foreignKey':_0xe7b5('0x166'),'onDelete':_0xe7b5('0x14f')});db['ChatApplication'][_0xe7b5('0x115')](db[_0xe7b5('0x7f')],{'onDelete':_0xe7b5('0x14f'),'foreignKey':'TagId'});db[_0xe7b5('0x5b')]['hasMany'](db[_0xe7b5('0x5d')],{'as':_0xe7b5('0x15c'),'onDelete':'cascade','foreignKey':_0xe7b5('0x186')});db[_0xe7b5('0x5b')][_0xe7b5('0x115')](db[_0xe7b5('0x12d')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x166')});db[_0xe7b5('0x5b')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x16b'),'foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0x5b')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x160'),'foreignKey':'UserId'});db['ChatInteraction'][_0xe7b5('0x119')](db['Tag'],{'through':_0xe7b5('0x187'),'as':_0xe7b5('0x162')});db['ChatInteraction']['belongsToMany'](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x187'),'as':'ThroughTags'});db[_0xe7b5('0x5b')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':'Users','through':_0xe7b5('0x11e'),'foreignKey':_0xe7b5('0x186')});db[_0xe7b5('0x5d')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x12')});db[_0xe7b5('0x5d')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'onDelete':_0xe7b5('0x104'),'as':'Contact','foreignKey':'ContactId'});db[_0xe7b5('0x5d')][_0xe7b5('0x115')](db[_0xe7b5('0x5b')],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x165'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xe7b5('0x115')](db[_0xe7b5('0xde')],{'as':_0xe7b5('0xde'),'foreignKey':_0xe7b5('0x175')});db['ChatMessage']['belongsTo'](db[_0xe7b5('0x12d')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x166')});db[_0xe7b5('0x5f')][_0xe7b5('0x109')](db[_0xe7b5('0xde')],{'as':_0xe7b5('0x164'),'foreignKey':_0xe7b5('0x167'),'onDelete':_0xe7b5('0x104'),'hooks':!![]});db['ChatOfflineMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x16b'),'foreignKey':_0xe7b5('0x15f')});db['ChatOfflineMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x12d')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x166')});db['ChatQueue'][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x188'),'hooks':!![]});db[_0xe7b5('0x60')][_0xe7b5('0x119')](db[_0xe7b5('0xd9')],{'through':_0xe7b5('0x189'),'as':'Teams'});db[_0xe7b5('0x62')]['hasMany'](db[_0xe7b5('0x18a')],{'as':_0xe7b5('0x15c'),'foreignKey':_0xe7b5('0x18b'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x62')]['belongsToMany'](db['User'],{'as':_0xe7b5('0x18c'),'through':'chat_group_has_users'});db[_0xe7b5('0x63')]['belongsTo'](db[_0xe7b5('0x12d')],{'as':_0xe7b5('0x185'),'foreignKey':_0xe7b5('0x166')});db[_0xe7b5('0x64')][_0xe7b5('0x109')](db['CmContact'],{'as':_0xe7b5('0x118'),'foreignKey':_0xe7b5('0x18d')});db['CmContact'][_0xe7b5('0x109')](db[_0xe7b5('0x18e')],{'as':_0xe7b5('0x18f'),'foreignKey':'ContactId'});db['CmContact'][_0xe7b5('0x109')](db[_0xe7b5('0x13d')],{'as':_0xe7b5('0x190'),'foreignKey':'ContactId'});db[_0xe7b5('0x65')][_0xe7b5('0x109')](db[_0xe7b5('0x6b')],{'as':_0xe7b5('0x191'),'foreignKey':_0xe7b5('0x15f')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0xe7b5('0x6c'),'foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0x65')]['hasMany'](db[_0xe7b5('0xc9')],{'as':_0xe7b5('0x13f'),'foreignKey':_0xe7b5('0x15f')});db['CmContact']['hasMany'](db[_0xe7b5('0x53')],{'as':'OpenchannelInteractions','foreignKey':_0xe7b5('0x15f'),'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x65')][_0xe7b5('0x109')](db[_0xe7b5('0x5b')],{'as':_0xe7b5('0x10e'),'foreignKey':_0xe7b5('0x15f'),'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x65')][_0xe7b5('0x109')](db[_0xe7b5('0x10f')],{'as':_0xe7b5('0x110'),'foreignKey':_0xe7b5('0x15f'),'onDelete':_0xe7b5('0x14f')});db['CmContact'][_0xe7b5('0x109')](db[_0xe7b5('0x44')],{'as':_0xe7b5('0x111'),'foreignKey':'ContactId','onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x65')][_0xe7b5('0x109')](db[_0xe7b5('0x3a')],{'as':'MailInteractions','foreignKey':_0xe7b5('0x15f'),'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x65')][_0xe7b5('0x115')](db['CmCompany'],{'as':_0xe7b5('0x192'),'foreignKey':_0xe7b5('0x18d')});db[_0xe7b5('0x65')]['belongsTo'](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':_0xe7b5('0x16a'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x65')][_0xe7b5('0x119')](db['User'],{'as':'Users','through':_0xe7b5('0x193')});db[_0xe7b5('0x65')][_0xe7b5('0x119')](db[_0xe7b5('0x7f')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xe7b5('0x65')][_0xe7b5('0x119')](db['Tag'],{'through':'cm_contact_has_tags','as':_0xe7b5('0x174')});db[_0xe7b5('0x18e')][_0xe7b5('0x115')](db['CmContact'],{'as':_0xe7b5('0x16b'),'foreignKey':_0xe7b5('0x15f'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x18e')][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':_0xe7b5('0x16a'),'onDelete':_0xe7b5('0x104')});db['CmHopper'][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x194'),'foreignKey':_0xe7b5('0x105')});db[_0xe7b5('0x18e')][_0xe7b5('0x115')](db[_0xe7b5('0x13b')],{'as':'Queue','foreignKey':_0xe7b5('0x13c'),'onDelete':'cascade'});db[_0xe7b5('0x18e')][_0xe7b5('0x115')](db[_0xe7b5('0x195')],{'as':_0xe7b5('0x195'),'foreignKey':_0xe7b5('0x196'),'onDelete':'cascade'});db[_0xe7b5('0x18e')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x160'),'foreignKey':'OwnerId'});db[_0xe7b5('0x68')][_0xe7b5('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0xe7b5('0x15f'),'onDelete':_0xe7b5('0x104')});db['CmHopperBlack'][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':'ListId','onDelete':_0xe7b5('0x104')});db['CmHopperBlack'][_0xe7b5('0x115')](db[_0xe7b5('0x13b')],{'as':'Queue','foreignKey':_0xe7b5('0x13c'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x68')]['belongsTo'](db[_0xe7b5('0x195')],{'as':_0xe7b5('0x195'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xe7b5('0x6e')][_0xe7b5('0x109')](db['Condition'],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0xe7b5('0x104'),'hooks':!![]});db['Automation']['hasMany'](db[_0xe7b5('0x197')],{'as':{'plural':_0xe7b5('0x198'),'singular':_0xe7b5('0x199')},'foreignKey':_0xe7b5('0x19a'),'onDelete':_0xe7b5('0x104'),'hooks':!![]});db['Automation'][_0xe7b5('0x109')](db[_0xe7b5('0x6d')],{'as':_0xe7b5('0x19b'),'foreignKey':_0xe7b5('0x19c'),'onDelete':_0xe7b5('0x104'),'hooks':!![]});db[_0xe7b5('0x72')][_0xe7b5('0x109')](db['Disposition'],{'as':_0xe7b5('0x152'),'foreignKey':_0xe7b5('0x19d'),'onDelete':_0xe7b5('0x104')});db['Interval'][_0xe7b5('0x109')](db['Interval'],{'as':'Intervals','foreignKey':_0xe7b5('0x142'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xe7b5('0x75')][_0xe7b5('0x109')](db[_0xe7b5('0x17')],{'as':_0xe7b5('0x10b'),'foreignKey':'IntervalId','onDelete':_0xe7b5('0x14f')});db['Interval']['hasMany'](db[_0xe7b5('0x3c')],{'as':_0xe7b5('0x19e'),'foreignKey':'IntervalId'});db[_0xe7b5('0x75')][_0xe7b5('0x109')](db[_0xe7b5('0x183')],{'as':_0xe7b5('0x19f'),'foreignKey':_0xe7b5('0x142')});db[_0xe7b5('0x75')][_0xe7b5('0x109')](db[_0xe7b5('0x16f')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0xe7b5('0x109')](db[_0xe7b5('0x49')],{'as':_0xe7b5('0x1a0'),'foreignKey':_0xe7b5('0x142')});db[_0xe7b5('0x7b')][_0xe7b5('0x115')](db[_0xe7b5('0x36')],{});db[_0xe7b5('0x7b')][_0xe7b5('0x115')](db['AnalyticDefaultReport'],{'foreignKey':_0xe7b5('0x1a1')});db[_0xe7b5('0x7b')][_0xe7b5('0x115')](db[_0xe7b5('0x1a2')],{'foreignKey':'CustomReportId'});db[_0xe7b5('0x7d')][_0xe7b5('0x119')](db['VoiceMusicOnHold'],{'as':_0xe7b5('0x1a3'),'through':_0xe7b5('0x13a'),'onDelete':'restrict'});db[_0xe7b5('0x7f')][_0xe7b5('0x119')](db[_0xe7b5('0x65')],{'through':_0xe7b5('0x1a4')});db[_0xe7b5('0x7f')][_0xe7b5('0x119')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xe7b5('0x7f')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0xe7b5('0x119')](db[_0xe7b5('0x10f')],{'through':_0xe7b5('0x17b')});db[_0xe7b5('0x7f')]['belongsToMany'](db[_0xe7b5('0x44')],{'through':_0xe7b5('0x173')});db[_0xe7b5('0x7f')][_0xe7b5('0x119')](db[_0xe7b5('0x53')],{'through':_0xe7b5('0x17f')});db[_0xe7b5('0x7f')][_0xe7b5('0x119')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xe7b5('0x81')][_0xe7b5('0x109')](db['Condition'],{'as':{'plural':_0xe7b5('0x1a5'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0xe7b5('0x104'),'hooks':!![]});db[_0xe7b5('0x81')]['hasMany'](db['Condition'],{'as':{'plural':_0xe7b5('0x1a6'),'singular':_0xe7b5('0x1a7')},'foreignKey':_0xe7b5('0x1a8'),'onDelete':_0xe7b5('0x104'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xe7b5('0x104'),'hooks':!![]});db['AnalyticCustomReport'][_0xe7b5('0x109')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1a9'),'hooks':!![]});db[_0xe7b5('0x1aa')][_0xe7b5('0x109')](db[_0xe7b5('0x1ab')],{'as':_0xe7b5('0x1ac'),'onDelete':'cascade','foreignKey':_0xe7b5('0x1a1')});db[_0xe7b5('0x1ad')][_0xe7b5('0x109')](db['AnalyticFieldReport'],{'as':_0xe7b5('0x1ac'),'onDelete':_0xe7b5('0x104'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0xe7b5('0x115')](db['AnalyticMetric'],{'foreignKey':_0xe7b5('0x1ae')});db[_0xe7b5('0x8e')][_0xe7b5('0x109')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0x90')][_0xe7b5('0x109')](db[_0xe7b5('0x92')],{'as':_0xe7b5('0x1b0'),'onDelete':'cascade','foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x90')][_0xe7b5('0x109')](db['SalesforceField'],{'as':_0xe7b5('0x1b2'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0x90')]['hasMany'](db[_0xe7b5('0x92')],{'as':_0xe7b5('0x1ac'),'onDelete':'cascade','foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0x90')][_0xe7b5('0x115')](db[_0xe7b5('0x8e')],{'as':_0xe7b5('0x15e'),'foreignKey':'AccountId'});db[_0xe7b5('0x92')][_0xe7b5('0x109')](db[_0xe7b5('0x92')],{'as':'Subject','foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x92')][_0xe7b5('0x109')](db[_0xe7b5('0x92')],{'as':'Description','foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0x92')][_0xe7b5('0x109')](db[_0xe7b5('0x92')],{'as':_0xe7b5('0x1b5'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0x92')][_0xe7b5('0x115')](db[_0xe7b5('0x82')],{'as':'Variable','foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0x94')]['hasMany'](db[_0xe7b5('0x96')],{'as':_0xe7b5('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0xe7b5('0x109')](db['SugarcrmField'],{'as':_0xe7b5('0x1b0'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x96')]['hasMany'](db[_0xe7b5('0x97')],{'as':_0xe7b5('0x1b2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xe7b5('0x96')][_0xe7b5('0x109')](db[_0xe7b5('0x97')],{'as':_0xe7b5('0x1ac'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0x96')][_0xe7b5('0x115')](db[_0xe7b5('0x94')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0x97')][_0xe7b5('0x109')](db[_0xe7b5('0x97')],{'as':'Subject','foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x97')]['hasMany'](db[_0xe7b5('0x97')],{'as':_0xe7b5('0x1b8'),'foreignKey':_0xe7b5('0x1b3')});db['SugarcrmField']['hasMany'](db[_0xe7b5('0x97')],{'as':_0xe7b5('0x1b5'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0x97')][_0xe7b5('0x115')](db['Variable'],{'as':_0xe7b5('0x82'),'foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0x1b9')][_0xe7b5('0x109')](db[_0xe7b5('0x9a')],{'as':_0xe7b5('0x1b7'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1af')});db['DeskConfiguration'][_0xe7b5('0x109')](db[_0xe7b5('0x9c')],{'as':_0xe7b5('0x1b0'),'onDelete':'cascade','foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x9a')]['hasMany'](db[_0xe7b5('0x9c')],{'as':'Descriptions','onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0x9a')][_0xe7b5('0x109')](db[_0xe7b5('0x9c')],{'as':_0xe7b5('0x1ac'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0x9a')][_0xe7b5('0x115')](db[_0xe7b5('0x1b9')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x1af')});db['DeskConfiguration'][_0xe7b5('0x119')](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x1ba')});db[_0xe7b5('0x9c')][_0xe7b5('0x109')](db[_0xe7b5('0x9c')],{'as':_0xe7b5('0x1bb'),'foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x9c')][_0xe7b5('0x109')](db[_0xe7b5('0x9c')],{'as':'Description','foreignKey':_0xe7b5('0x1b3')});db['DeskField'][_0xe7b5('0x109')](db[_0xe7b5('0x9c')],{'as':_0xe7b5('0x1b5'),'foreignKey':'FieldId'});db[_0xe7b5('0x9c')][_0xe7b5('0x115')](db[_0xe7b5('0x82')],{'as':_0xe7b5('0x82'),'foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0x1bc')][_0xe7b5('0x109')](db['ZohoConfiguration'],{'as':_0xe7b5('0x1b7'),'onDelete':'cascade','foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0x1bd')]['hasMany'](db[_0xe7b5('0x9f')],{'as':_0xe7b5('0x1b0'),'onDelete':_0xe7b5('0x104'),'foreignKey':'SubjectId'});db[_0xe7b5('0x1bd')][_0xe7b5('0x109')](db[_0xe7b5('0x9f')],{'as':_0xe7b5('0x1b2'),'onDelete':'cascade','foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0x1bd')]['hasMany'](db['ZohoField'],{'as':_0xe7b5('0x1ac'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0x1bd')]['belongsTo'](db[_0xe7b5('0x1bc')],{'as':'Account','foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0x9f')][_0xe7b5('0x109')](db[_0xe7b5('0x9f')],{'as':_0xe7b5('0x1bb'),'foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x9f')][_0xe7b5('0x109')](db[_0xe7b5('0x9f')],{'as':_0xe7b5('0x1b8'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0x9f')][_0xe7b5('0x109')](db[_0xe7b5('0x9f')],{'as':'Field','foreignKey':_0xe7b5('0x1b4')});db['ZohoField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0xa0')][_0xe7b5('0x109')](db[_0xe7b5('0xa2')],{'as':_0xe7b5('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe7b5('0xa2')][_0xe7b5('0x109')](db[_0xe7b5('0xa4')],{'as':_0xe7b5('0x1b0'),'foreignKey':'SubjectId'});db[_0xe7b5('0xa2')]['hasMany'](db[_0xe7b5('0xa4')],{'as':_0xe7b5('0x1b2'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0xa2')][_0xe7b5('0x109')](db[_0xe7b5('0xa4')],{'as':_0xe7b5('0x1ac'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xa2')][_0xe7b5('0x115')](db[_0xe7b5('0xa0')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x1af')});db['ZendeskConfiguration']['belongsToMany'](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x1be')});db['ZendeskField'][_0xe7b5('0x109')](db[_0xe7b5('0xa4')],{'as':_0xe7b5('0x1bb'),'foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0xa4')]['hasMany'](db[_0xe7b5('0xa4')],{'as':_0xe7b5('0x1b8'),'foreignKey':_0xe7b5('0x1b3')});db['ZendeskField']['hasMany'](db[_0xe7b5('0xa4')],{'as':_0xe7b5('0x1b5'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xa4')]['belongsTo'](db[_0xe7b5('0x82')],{'as':_0xe7b5('0x82'),'foreignKey':_0xe7b5('0x1b6')});db['FreshdeskAccount'][_0xe7b5('0x109')](db['FreshdeskConfiguration'],{'as':_0xe7b5('0x1b7'),'onDelete':_0xe7b5('0x104'),'foreignKey':'AccountId'});db['FreshdeskConfiguration']['hasMany'](db[_0xe7b5('0xa9')],{'as':'Subjects','onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b1')});db['FreshdeskConfiguration'][_0xe7b5('0x109')](db[_0xe7b5('0xa9')],{'as':'Descriptions','onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0xa7')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xa7')]['belongsTo'](db['FreshdeskAccount'],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0xa7')][_0xe7b5('0x119')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0xe7b5('0xa9')]['hasMany'](db['FreshdeskField'],{'as':_0xe7b5('0x1bb'),'foreignKey':'SubjectId'});db[_0xe7b5('0xa9')]['hasMany'](db['FreshdeskField'],{'as':'Description','foreignKey':_0xe7b5('0x1b3')});db['FreshdeskField']['hasMany'](db[_0xe7b5('0xa9')],{'as':_0xe7b5('0x1b5'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xa9')][_0xe7b5('0x115')](db[_0xe7b5('0x82')],{'as':_0xe7b5('0x82'),'foreignKey':'VariableId'});db['VtigerAccount'][_0xe7b5('0x109')](db[_0xe7b5('0x1bf')],{'as':_0xe7b5('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe7b5('0x1bf')][_0xe7b5('0x109')](db['VtigerField'],{'as':_0xe7b5('0x1b0'),'foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0x1bf')][_0xe7b5('0x109')](db[_0xe7b5('0xae')],{'as':_0xe7b5('0x1b2'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0x1bf')][_0xe7b5('0x109')](db[_0xe7b5('0xae')],{'as':'Fields','foreignKey':'FieldId'});db[_0xe7b5('0x1bf')][_0xe7b5('0x115')](db['VtigerAccount'],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0xae')][_0xe7b5('0x109')](db['VtigerField'],{'as':'Subject','foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0xae')]['hasMany'](db[_0xe7b5('0xae')],{'as':'Description','foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0xae')][_0xe7b5('0x109')](db[_0xe7b5('0xae')],{'as':_0xe7b5('0x1b5'),'foreignKey':'FieldId'});db['VtigerField'][_0xe7b5('0x115')](db[_0xe7b5('0x82')],{'as':_0xe7b5('0x82'),'foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0xb0')][_0xe7b5('0x109')](db['ServicenowConfiguration'],{'as':_0xe7b5('0x1b7'),'onDelete':_0xe7b5('0x104'),'foreignKey':'AccountId'});db[_0xe7b5('0xb1')]['hasMany'](db[_0xe7b5('0xb3')],{'as':_0xe7b5('0x1b0'),'foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0xb1')]['hasMany'](db['ServicenowField'],{'as':_0xe7b5('0x1b2'),'foreignKey':'DescriptionId'});db[_0xe7b5('0xb1')]['hasMany'](db[_0xe7b5('0xb3')],{'as':_0xe7b5('0x1ac'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xb1')][_0xe7b5('0x115')](db[_0xe7b5('0xb0')],{'as':_0xe7b5('0x15e'),'foreignKey':'AccountId'});db['ServicenowField'][_0xe7b5('0x109')](db[_0xe7b5('0xb3')],{'as':_0xe7b5('0x1bb'),'foreignKey':'SubjectId'});db[_0xe7b5('0xb3')][_0xe7b5('0x109')](db[_0xe7b5('0xb3')],{'as':_0xe7b5('0x1b8'),'foreignKey':'DescriptionId'});db[_0xe7b5('0xb3')][_0xe7b5('0x109')](db[_0xe7b5('0xb3')],{'as':_0xe7b5('0x1b5'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xb3')][_0xe7b5('0x115')](db['Variable'],{'as':'Variable','foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0xb5')][_0xe7b5('0x109')](db[_0xe7b5('0xb7')],{'as':_0xe7b5('0x1b7'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0xb5')][_0xe7b5('0x115')](db[_0xe7b5('0x14d')],{'as':_0xe7b5('0x14d'),'foreignKey':_0xe7b5('0x14e')});db[_0xe7b5('0xb7')]['hasMany'](db[_0xe7b5('0xb9')],{'as':_0xe7b5('0x1b0'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b1')});db['Dynamics365Configuration'][_0xe7b5('0x109')](db[_0xe7b5('0xb9')],{'as':_0xe7b5('0x1b2'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0xb7')][_0xe7b5('0x109')](db['Dynamics365Field'],{'as':_0xe7b5('0x1ac'),'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xb7')][_0xe7b5('0x115')](db[_0xe7b5('0xb5')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0xb9')]['hasMany'](db[_0xe7b5('0xb9')],{'as':_0xe7b5('0x1bb'),'foreignKey':_0xe7b5('0x1b1')});db[_0xe7b5('0xb9')]['hasMany'](db['Dynamics365Field'],{'as':_0xe7b5('0x1b8'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0xb9')][_0xe7b5('0x109')](db[_0xe7b5('0xb9')],{'as':_0xe7b5('0x1b5'),'foreignKey':_0xe7b5('0x1b4')});db['Dynamics365Field'][_0xe7b5('0x115')](db[_0xe7b5('0x82')],{'as':'Variable','foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0xbb')][_0xe7b5('0x109')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe7b5('0x1af')});db['FreshsalesConfiguration'][_0xe7b5('0x109')](db[_0xe7b5('0xbe')],{'as':_0xe7b5('0x1b0'),'foreignKey':_0xe7b5('0x1b1')});db['FreshsalesConfiguration'][_0xe7b5('0x109')](db[_0xe7b5('0xbe')],{'as':'Descriptions','foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0xbc')]['hasMany'](db[_0xe7b5('0xbe')],{'as':_0xe7b5('0x1ac'),'foreignKey':_0xe7b5('0x1b4')});db[_0xe7b5('0xbc')]['belongsTo'](db[_0xe7b5('0xbb')],{'as':_0xe7b5('0x15e'),'foreignKey':_0xe7b5('0x1af')});db[_0xe7b5('0xbe')][_0xe7b5('0x109')](db['FreshsalesField'],{'as':_0xe7b5('0x1bb'),'foreignKey':'SubjectId'});db[_0xe7b5('0xbe')][_0xe7b5('0x109')](db[_0xe7b5('0xbe')],{'as':_0xe7b5('0x1b8'),'foreignKey':_0xe7b5('0x1b3')});db[_0xe7b5('0xbe')][_0xe7b5('0x109')](db[_0xe7b5('0xbe')],{'as':_0xe7b5('0x1b5'),'foreignKey':'FieldId'});db[_0xe7b5('0xbe')][_0xe7b5('0x115')](db[_0xe7b5('0x82')],{'as':_0xe7b5('0x82'),'foreignKey':_0xe7b5('0x1b6')});db[_0xe7b5('0xc3')][_0xe7b5('0x115')](db[_0xe7b5('0x12d')],{});db[_0xe7b5('0xc3')][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':'List','foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0xc3')][_0xe7b5('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0xc3')][_0xe7b5('0x115')](db['ChatInteraction'],{});db[_0xe7b5('0xc3')][_0xe7b5('0x115')](db[_0xe7b5('0x5d')],{});db['ChatQueueReport'][_0xe7b5('0x115')](db['User'],{});db[_0xe7b5('0xc3')][_0xe7b5('0x115')](db[_0xe7b5('0x60')],{});db[_0xe7b5('0x18a')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1c0')});db[_0xe7b5('0x18a')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'onDelete':_0xe7b5('0x104'),'foreignKey':'ToId'});db[_0xe7b5('0xc9')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xe7b5('0x104')});db['JscriptySessionReport'][_0xe7b5('0x109')](db[_0xe7b5('0xc5')],{'foreignKey':'SessionId','onDelete':_0xe7b5('0x104')});db[_0xe7b5('0xcb')][_0xe7b5('0x115')](db[_0xe7b5('0x48')],{});db[_0xe7b5('0xcb')][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x157'),'foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0xcb')]['belongsTo'](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x16b'),'foreignKey':_0xe7b5('0x15f')});db['SmsQueueReport'][_0xe7b5('0x115')](db[_0xe7b5('0x10f')],{});db[_0xe7b5('0xcb')][_0xe7b5('0x115')](db[_0xe7b5('0x4c')],{});db[_0xe7b5('0xcb')][_0xe7b5('0x115')](db['User'],{});db[_0xe7b5('0xcb')][_0xe7b5('0x115')](db['SmsQueue'],{});db[_0xe7b5('0x1c1')][_0xe7b5('0x109')](db[_0xe7b5('0xc9')],{'foreignKey':_0xe7b5('0x1c2')});db[_0xe7b5('0x1c1')]['hasMany'](db[_0xe7b5('0xc7')],{'foreignKey':'ProjectId'});db[_0xe7b5('0x1c1')]['hasMany'](db[_0xe7b5('0xc5')],{'foreignKey':_0xe7b5('0x1c2')});db['SquareProject'][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x163'),'through':'user_has_square_projects'});db[_0xe7b5('0xd9')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':'Agents','through':_0xe7b5('0x11c')});db['Team']['belongsToMany'](db[_0xe7b5('0x13b')],{'through':'TeamVoiceQueue','as':_0xe7b5('0x124')});db[_0xe7b5('0xd9')][_0xe7b5('0x119')](db[_0xe7b5('0x126')],{'through':'team_has_mail_queues','as':_0xe7b5('0x1c3')});db[_0xe7b5('0xd9')]['belongsToMany'](db[_0xe7b5('0x60')],{'through':_0xe7b5('0x189'),'as':_0xe7b5('0x127')});db[_0xe7b5('0xd9')][_0xe7b5('0x119')](db[_0xe7b5('0x45')],{'through':_0xe7b5('0x177'),'as':'FaxQueues'});db[_0xe7b5('0xd9')]['belongsToMany'](db[_0xe7b5('0x4d')],{'through':'team_has_sms_queues','as':_0xe7b5('0x129')});db[_0xe7b5('0xd9')][_0xe7b5('0x119')](db['OpenchannelQueue'],{'through':_0xe7b5('0x181'),'as':_0xe7b5('0x12a')});db[_0xe7b5('0xd9')][_0xe7b5('0x119')](db[_0xe7b5('0xfb')],{'through':_0xe7b5('0x1c4'),'as':_0xe7b5('0x12b')});db[_0xe7b5('0xd9')][_0xe7b5('0x119')](db[_0xe7b5('0xeb')],{'through':_0xe7b5('0xfe'),'as':_0xe7b5('0x125')});db[_0xe7b5('0x195')][_0xe7b5('0x109')](db[_0xe7b5('0x18e')],{'as':_0xe7b5('0x18f'),'foreignKey':_0xe7b5('0x196')});db[_0xe7b5('0x195')][_0xe7b5('0x109')](db[_0xe7b5('0x13d')],{'as':_0xe7b5('0x190'),'foreignKey':_0xe7b5('0x196')});db['Campaign'][_0xe7b5('0x109')](db['CmHopperHistory'],{'as':_0xe7b5('0x191'),'foreignKey':'CampaignId'});db['Campaign'][_0xe7b5('0x109')](db['CmHopperBlack'],{'as':_0xe7b5('0x13e'),'foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db[_0xe7b5('0x27')],{'as':'Trunk','foreignKey':_0xe7b5('0x140')});db['Campaign']['belongsTo'](db[_0xe7b5('0x27')],{'as':_0xe7b5('0x141'),'foreignKey':_0xe7b5('0x1c5')});db[_0xe7b5('0x195')]['belongsTo'](db[_0xe7b5('0x75')],{'as':_0xe7b5('0x75'),'foreignKey':'IntervalId'});db[_0xe7b5('0x195')][_0xe7b5('0x115')](db['SquareProject'],{'as':_0xe7b5('0xd5'),'foreignKey':_0xe7b5('0x1c6')});db[_0xe7b5('0x195')]['belongsToMany'](db['CmList'],{'as':_0xe7b5('0x11a'),'through':_0xe7b5('0x1c7')});db[_0xe7b5('0x195')][_0xe7b5('0x119')](db[_0xe7b5('0xe9')],{'as':_0xe7b5('0x1c8'),'through':_0xe7b5('0x1c9')});db['Attachment'][_0xe7b5('0x115')](db['ChatOfflineMessage'],{'as':_0xe7b5('0x5f'),'foreignKey':_0xe7b5('0x167')});db[_0xe7b5('0xe2')]['belongsTo'](db[_0xe7b5('0x154')],{});db[_0xe7b5('0xe2')][_0xe7b5('0x115')](db[_0xe7b5('0x3a')],{});db[_0xe7b5('0xe2')][_0xe7b5('0x115')](db[_0xe7b5('0x36')],{'foreignKey':_0xe7b5('0x1ca'),'as':_0xe7b5('0x1cb')});db[_0xe7b5('0xe2')]['belongsTo'](db[_0xe7b5('0x12')],{'foreignKey':_0xe7b5('0x1cc'),'as':_0xe7b5('0x1cd')});db['MailTransferReport'][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'foreignKey':'ToUserId','as':_0xe7b5('0x1ce')});db[_0xe7b5('0xe2')]['belongsTo'](db[_0xe7b5('0x126')],{'foreignKey':_0xe7b5('0x1cf'),'as':'ToQueue'});db[_0xe7b5('0xe2')]['belongsTo'](db[_0xe7b5('0x36')],{'foreignKey':_0xe7b5('0x1d0'),'as':'ToAccount'});db['ChatTransferReport'][_0xe7b5('0x115')](db[_0xe7b5('0x5d')],{});db[_0xe7b5('0xe3')]['belongsTo'](db[_0xe7b5('0x5b')],{});db[_0xe7b5('0xe3')]['belongsTo'](db[_0xe7b5('0x12d')],{'foreignKey':'FromChatWebsiteId','as':_0xe7b5('0x1cb')});db[_0xe7b5('0xe3')]['belongsTo'](db[_0xe7b5('0x12')],{'foreignKey':_0xe7b5('0x1cc'),'as':_0xe7b5('0x1cd')});db[_0xe7b5('0xe3')][_0xe7b5('0x115')](db['User'],{'foreignKey':_0xe7b5('0x1d1'),'as':_0xe7b5('0x1ce')});db[_0xe7b5('0xe3')][_0xe7b5('0x115')](db[_0xe7b5('0x60')],{'foreignKey':_0xe7b5('0x1d2'),'as':_0xe7b5('0x1d3')});db['ChatTransferReport'][_0xe7b5('0x115')](db[_0xe7b5('0x12d')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xe7b5('0xe5')]['belongsTo'](db[_0xe7b5('0x171')],{});db[_0xe7b5('0xe5')][_0xe7b5('0x115')](db[_0xe7b5('0x44')],{});db[_0xe7b5('0xe5')][_0xe7b5('0x115')](db[_0xe7b5('0x16d')],{'foreignKey':_0xe7b5('0x1d4'),'as':_0xe7b5('0x1cb')});db[_0xe7b5('0xe5')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe7b5('0xe5')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'foreignKey':'ToUserId','as':_0xe7b5('0x1ce')});db[_0xe7b5('0xe5')]['belongsTo'](db[_0xe7b5('0x45')],{'foreignKey':'ToFaxQueueId','as':_0xe7b5('0x1d3')});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0xe7b5('0x1d5'),'as':_0xe7b5('0x1d6')});db[_0xe7b5('0x1d7')][_0xe7b5('0x115')](db[_0xe7b5('0x55')],{});db[_0xe7b5('0x1d7')][_0xe7b5('0x115')](db[_0xe7b5('0x53')],{});db[_0xe7b5('0x1d7')]['belongsTo'](db[_0xe7b5('0x4f')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0xe7b5('0x1d7')]['belongsTo'](db[_0xe7b5('0x12')],{'foreignKey':_0xe7b5('0x1cc'),'as':_0xe7b5('0x1cd')});db[_0xe7b5('0x1d7')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'foreignKey':_0xe7b5('0x1d1'),'as':'ToAgent'});db[_0xe7b5('0x1d7')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0xe7b5('0x1d8'),'as':_0xe7b5('0x1d3')});db[_0xe7b5('0x1d7')][_0xe7b5('0x115')](db['OpenchannelAccount'],{'foreignKey':_0xe7b5('0x1d9'),'as':_0xe7b5('0x1d6')});db['SmsTransferReport'][_0xe7b5('0x115')](db['SmsMessage'],{});db[_0xe7b5('0xe7')][_0xe7b5('0x115')](db[_0xe7b5('0x10f')],{});db[_0xe7b5('0xe7')]['belongsTo'](db[_0xe7b5('0x48')],{'foreignKey':'FromSmsAccountId','as':_0xe7b5('0x1cb')});db[_0xe7b5('0xe7')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'foreignKey':_0xe7b5('0x1cc'),'as':_0xe7b5('0x1cd')});db['SmsTransferReport'][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'foreignKey':'ToUserId','as':_0xe7b5('0x1ce')});db['SmsTransferReport'][_0xe7b5('0x115')](db[_0xe7b5('0x4d')],{'foreignKey':_0xe7b5('0x1da'),'as':_0xe7b5('0x1d3')});db['SmsTransferReport'][_0xe7b5('0x115')](db[_0xe7b5('0x48')],{'foreignKey':'ToSmsAccountId','as':_0xe7b5('0x1d6')});db[_0xe7b5('0xe9')][_0xe7b5('0x109')](db[_0xe7b5('0x72')],{'as':'Dispositions','foreignKey':_0xe7b5('0x16a'),'onDelete':_0xe7b5('0x104')});db['CmList'][_0xe7b5('0x109')](db[_0xe7b5('0x1db')],{'as':_0xe7b5('0x1dc'),'foreignKey':'ListId'});db[_0xe7b5('0xe9')][_0xe7b5('0x109')](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x118'),'onDelete':_0xe7b5('0x104'),'foreignKey':'ListId'});db[_0xe7b5('0xe9')]['hasMany'](db[_0xe7b5('0x13d')],{'as':'HopperFinals','foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0xe9')][_0xe7b5('0x109')](db[_0xe7b5('0x6b')],{'as':_0xe7b5('0x10c'),'foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0xe9')][_0xe7b5('0x109')](db[_0xe7b5('0x6c')],{'as':_0xe7b5('0x6c'),'foreignKey':'ListId'});db[_0xe7b5('0xe9')][_0xe7b5('0x119')](db[_0xe7b5('0x13b')],{'as':_0xe7b5('0x1dd'),'through':_0xe7b5('0x145')});db['CmList']['belongsToMany'](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x11b')});db[_0xe7b5('0xeb')][_0xe7b5('0x109')](db[_0xe7b5('0x17')],{'as':_0xe7b5('0x10b'),'onDelete':_0xe7b5('0x104')});db['VoicePrefix'][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x100')});db[_0xe7b5('0xeb')][_0xe7b5('0x119')](db[_0xe7b5('0xd9')],{'through':_0xe7b5('0xfe'),'as':'Teams'});db[_0xe7b5('0xed')][_0xe7b5('0x109')](db[_0xe7b5('0x12')],{'as':'Users','foreignKey':'userProfileId'});db[_0xe7b5('0xed')]['hasMany'](db[_0xe7b5('0x1de')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xe7b5('0x104')});db[_0xe7b5('0x1de')]['hasMany'](db[_0xe7b5('0xef')],{'as':_0xe7b5('0x1df'),'foreignKey':_0xe7b5('0x1e0'),'onDelete':_0xe7b5('0x104')});db[_0xe7b5('0xf3')][_0xe7b5('0x109')](db['Disposition'],{'as':_0xe7b5('0x152'),'foreignKey':_0xe7b5('0x1e1'),'onDelete':'cascade'});db[_0xe7b5('0xf3')][_0xe7b5('0x109')](db[_0xe7b5('0x70')],{'as':_0xe7b5('0x153'),'foreignKey':_0xe7b5('0x1e1')});db[_0xe7b5('0xf3')][_0xe7b5('0x109')](db[_0xe7b5('0xf5')],{'as':_0xe7b5('0x15c'),'foreignKey':_0xe7b5('0x1e1')});db[_0xe7b5('0xf3')][_0xe7b5('0x109')](db[_0xe7b5('0x122')],{'as':_0xe7b5('0x155')});db[_0xe7b5('0xf3')]['hasMany'](db[_0xe7b5('0x1e2')],{'as':_0xe7b5('0x156')});db[_0xe7b5('0xf3')][_0xe7b5('0x115')](db[_0xe7b5('0xe9')],{'as':'List','foreignKey':_0xe7b5('0x16a')});db[_0xe7b5('0xf3')][_0xe7b5('0x115')](db[_0xe7b5('0x76')],{'as':'mandatoryDispositionPause','foreignKey':_0xe7b5('0x144')});db[_0xe7b5('0xf3')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':_0xe7b5('0x136')});db[_0xe7b5('0x1e2')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x1e2')][_0xe7b5('0x115')](db[_0xe7b5('0xfb')],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x1e2')][_0xe7b5('0x115')](db['WhatsappAccount'],{'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x1e2')][_0xe7b5('0x115')](db[_0xe7b5('0x75')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db['Tag'],{'onDelete':_0xe7b5('0x14f'),'foreignKey':'TagId'});db[_0xe7b5('0x122')][_0xe7b5('0x109')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xe7b5('0x104'),'foreignKey':_0xe7b5('0x1e3')});db[_0xe7b5('0x122')]['belongsTo'](db[_0xe7b5('0xf3')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xe7b5('0x122')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'as':'Contact','foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0x122')][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0xe7b5('0x122')][_0xe7b5('0x119')](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x1e4'),'as':_0xe7b5('0x162')});db[_0xe7b5('0x122')]['belongsToMany'](db[_0xe7b5('0x7f')],{'through':_0xe7b5('0x1e4'),'as':_0xe7b5('0x174')});db[_0xe7b5('0x122')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x163'),'through':_0xe7b5('0x123'),'foreignKey':_0xe7b5('0x1e3')});db['WhatsappMessage'][_0xe7b5('0x115')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x12')});db[_0xe7b5('0xf5')]['belongsTo'](db['CmContact'],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x16b')});db[_0xe7b5('0xf5')][_0xe7b5('0x115')](db[_0xe7b5('0x122')],{'onDelete':_0xe7b5('0x104'),'as':_0xe7b5('0x165'),'foreignKey':'WhatsappInteractionId'});db[_0xe7b5('0xf5')][_0xe7b5('0x115')](db[_0xe7b5('0xf3')],{'as':_0xe7b5('0x15e'),'foreignKey':'WhatsappAccountId'});db[_0xe7b5('0xf7')]['belongsTo'](db[_0xe7b5('0xf3')],{});db[_0xe7b5('0xf7')][_0xe7b5('0x115')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xe7b5('0xf7')][_0xe7b5('0x115')](db[_0xe7b5('0x65')],{'as':_0xe7b5('0x16b'),'foreignKey':_0xe7b5('0x15f')});db[_0xe7b5('0xf7')]['belongsTo'](db[_0xe7b5('0x122')],{});db[_0xe7b5('0xf7')][_0xe7b5('0x115')](db[_0xe7b5('0xfb')],{});db[_0xe7b5('0xf7')][_0xe7b5('0x115')](db['WhatsappMessage'],{});db[_0xe7b5('0xf7')][_0xe7b5('0x115')](db['User'],{});db[_0xe7b5('0xf9')][_0xe7b5('0x115')](db[_0xe7b5('0xf5')],{});db[_0xe7b5('0xf9')][_0xe7b5('0x115')](db['WhatsappInteraction'],{});db[_0xe7b5('0xf9')][_0xe7b5('0x115')](db['WhatsappAccount'],{'foreignKey':_0xe7b5('0x1e5'),'as':_0xe7b5('0x1cb')});db['WhatsappTransferReport'][_0xe7b5('0x115')](db[_0xe7b5('0xf3')],{'foreignKey':_0xe7b5('0x1e6'),'as':'ToAccount'});db[_0xe7b5('0xf9')][_0xe7b5('0x115')](db[_0xe7b5('0xfb')],{'foreignKey':_0xe7b5('0x1e7'),'as':_0xe7b5('0x1d3')});db[_0xe7b5('0xf9')]['belongsTo'](db[_0xe7b5('0x12')],{'foreignKey':_0xe7b5('0x1cc'),'as':_0xe7b5('0x1cd')});db[_0xe7b5('0xf9')]['belongsTo'](db['User'],{'foreignKey':_0xe7b5('0x1d1'),'as':'ToAgent'});db[_0xe7b5('0xfb')][_0xe7b5('0x119')](db[_0xe7b5('0x12')],{'as':_0xe7b5('0x146'),'through':'UserWhatsappQueue','foreignKey':_0xe7b5('0x1e8')});db[_0xe7b5('0xfb')][_0xe7b5('0x119')](db[_0xe7b5('0xd9')],{'through':_0xe7b5('0x1c4'),'as':_0xe7b5('0x15b')});db[_0xe7b5('0x102')][_0xe7b5('0x115')](db['User'],{'as':_0xe7b5('0x1e9'),'foreignKey':_0xe7b5('0x105'),'onDelete':_0xe7b5('0x104'),'hooks':!![]});db[_0xe7b5('0x14d')]['hasOne'](db[_0xe7b5('0xb5')],{'as':_0xe7b5('0xb5'),'onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x14d')]['hasOne'](db[_0xe7b5('0x32')],{'as':'Imap','onDelete':_0xe7b5('0x14f')});db[_0xe7b5('0x14d')][_0xe7b5('0x106')](db[_0xe7b5('0x34')],{'as':_0xe7b5('0x151'),'onDelete':_0xe7b5('0x14f')});module[_0xe7b5('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xc08a=['Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','User','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_mail_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','QueueCalls','AgentReports','Contact','ContactId','CloudProviderId','MailServerOut','MailAccountId','restrict','hasOne','Dispositions','Answers','MailMessage','Messages','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','ThroughTags','Interaction','ChatOfflineMessage','ChatOfflineMessageId','Items','FaxAccountId','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatInternalMessage','Website','CompanyId','CmHopper','CmCompany','Company','cm_user_has_contacts','cm_contact_has_tags','Campaign','CampaignId','All','OneAll','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','mail_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyCondition','TriggerId','AnalyticCustomReport','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','DescriptionId','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Configuration','FreshsalesConfiguration','FromId','SessionId','ProjectId','user_has_square_projects','SmsQueues','team_has_whatsapp_queues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToUserId','ToAgent','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappMessage','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','mysql','name','utf8','utf8_general_ci','sequelizeHistory','xcall','utf8mb4','database','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','Variable'];(function(_0x1644f2,_0x2884e8){var _0x1fcb31=function(_0x41773c){while(--_0x41773c){_0x1644f2['push'](_0x1644f2['shift']());}};_0x1fcb31(++_0x2884e8);}(_0xc08a,0x15f));var _0xac08=function(_0x5c0dc2,_0x4022ef){_0x5c0dc2=_0x5c0dc2-0x0;var _0x4ea1bf=_0xc08a[_0x5c0dc2];return _0x4ea1bf;};'use strict';var config=require(_0xac08('0x0'));var Sequelize=require(_0xac08('0x1'));var _=require(_0xac08('0x2'));var jstz=require(_0xac08('0x3'));var timezone=jstz[_0xac08('0x4')]();config['sequelize']=_[_0xac08('0x5')](config['sequelize'],{'database':_0xac08('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xac08('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xac08('0x8')](),'define':{'charset':_0xac08('0x9'),'collate':_0xac08('0xa')}}});config[_0xac08('0xb')]=_[_0xac08('0x5')](config[_0xac08('0xb')],{'database':_0xac08('0x6'),'username':_0xac08('0xc'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xac08('0x7'),'dialectOptions':{'charset':_0xac08('0xd')},'logging':![],'timezone':timezone[_0xac08('0x8')](),'define':{'charset':_0xac08('0x9'),'collate':_0xac08('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xac08('0x1')][_0xac08('0xe')],config['sequelize']['username'],config[_0xac08('0x1')][_0xac08('0xf')],config[_0xac08('0x1')][_0xac08('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xac08('0xb')]['database'],config[_0xac08('0xb')]['username'],config[_0xac08('0xb')][_0xac08('0xf')],config['sequelizeHistory']['options'])};db['User']=db['sequelize'][_0xac08('0x11')](_0xac08('0x12'));db[_0xac08('0x13')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xac08('0x14')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x15'));db[_0xac08('0x16')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xac08('0x17')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x18'));db[_0xac08('0x19')]=db[_0xac08('0x1')]['import'](_0xac08('0x1a'));db['ScreenRecording']=db[_0xac08('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0xac08('0x1b')]=db[_0xac08('0x1')]['import'](_0xac08('0x1c'));db[_0xac08('0x1d')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xac08('0x1e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x1f'));db[_0xac08('0x20')]=db['sequelize'][_0xac08('0x11')]('../api/voiceDialReport/voiceDialReport.model');db[_0xac08('0x21')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x22'));db[_0xac08('0x23')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x24'));db[_0xac08('0x25')]=db['sequelize']['import']('../api/memberReport/memberReport.model');db['Trunk']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x26'));db[_0xac08('0x27')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x28'));db[_0xac08('0x29')]=db[_0xac08('0x1')]['import'](_0xac08('0x2a'));db[_0xac08('0x2b')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x2c'));db[_0xac08('0x2d')]=db['sequelize'][_0xac08('0x11')]('../api/userChatQueue/userChatQueue.model');db[_0xac08('0x2e')]=db[_0xac08('0x1')]['import'](_0xac08('0x2f'));db[_0xac08('0x30')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x31'));db[_0xac08('0x32')]=db[_0xac08('0x1')]['import'](_0xac08('0x33'));db[_0xac08('0x34')]=db['sequelize'][_0xac08('0x11')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xac08('0x35')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x36'));db['MailServerOut']=db[_0xac08('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize'][_0xac08('0x11')](_0xac08('0x37'));db[_0xac08('0x38')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x39'));db[_0xac08('0x3a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x3b'));db[_0xac08('0x3c')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x3d'));db['MailMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x3e'));db[_0xac08('0x3f')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x40'));db[_0xac08('0x41')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x42'));db[_0xac08('0x43')]=db['sequelize']['import'](_0xac08('0x44'));db[_0xac08('0x45')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0xac08('0x46')]=db['sequelize']['import'](_0xac08('0x47'));db[_0xac08('0x48')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x49'));db[_0xac08('0x4a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x4b'));db[_0xac08('0x4c')]=db[_0xac08('0x1')]['import'](_0xac08('0x4d'));db[_0xac08('0x4e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x4f'));db[_0xac08('0x50')]=db['sequelize'][_0xac08('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0xac08('0x51')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x52'));db[_0xac08('0x53')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x54'));db[_0xac08('0x55')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x56'));db[_0xac08('0x57')]=db[_0xac08('0x1')]['import'](_0xac08('0x58'));db['SmsQueue']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x59'));db[_0xac08('0x5a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x5b'));db[_0xac08('0x5c')]=db[_0xac08('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xac08('0x5d')]=db[_0xac08('0x1')]['import'](_0xac08('0x5e'));db[_0xac08('0x5f')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x60'));db[_0xac08('0x61')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x62'));db[_0xac08('0x63')]=db['sequelize'][_0xac08('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0xac08('0x64')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x65'));db[_0xac08('0x66')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x67'));db[_0xac08('0x68')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x69'));db[_0xac08('0x6a')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x6b'));db[_0xac08('0x6c')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x6d'));db[_0xac08('0x6e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x6f'));db['ChatProactiveAction']=db[_0xac08('0x1')]['import'](_0xac08('0x70'));db['CmCompany']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xac08('0x1')]['import'](_0xac08('0x71'));db['CmHopper']=db[_0xac08('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0xac08('0x72')]=db[_0xac08('0x1')]['import'](_0xac08('0x73'));db[_0xac08('0x74')]=db['sequelize'][_0xac08('0x11')](_0xac08('0x75'));db['CmHopperHistory']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x76'));db[_0xac08('0x77')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x78'));db[_0xac08('0x79')]=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db[_0xac08('0x7a')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/action/action.model');db['Automation']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x7b'));db[_0xac08('0x7c')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x7d'));db[_0xac08('0x7e')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x7f'));db[_0xac08('0x80')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x81'));db['Interval']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/interval/interval.model');db[_0xac08('0x82')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x83'));db[_0xac08('0x84')]=db[_0xac08('0x1')]['import'](_0xac08('0x85'));db[_0xac08('0x86')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x87'));db[_0xac08('0x88')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x89'));db[_0xac08('0x8a')]=db[_0xac08('0x1')]['import'](_0xac08('0x8b'));db[_0xac08('0x8c')]=db[_0xac08('0x1')]['import']('../api/tag/tag.model');db['Template']=db[_0xac08('0x1')]['import'](_0xac08('0x8d'));db[_0xac08('0x8e')]=db[_0xac08('0x1')]['import']('../api/trigger/trigger.model');db[_0xac08('0x8f')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/variable/variable.model');db[_0xac08('0x90')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x91'));db[_0xac08('0x92')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x93'));db['AnalyticDefaultReport']=db['sequelize'][_0xac08('0x11')](_0xac08('0x94'));db[_0xac08('0x95')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xac08('0x96')]=db[_0xac08('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0xac08('0x97')]=db[_0xac08('0x1')]['import'](_0xac08('0x98'));db['AnalyticTreeReport']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x99'));db[_0xac08('0x9a')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x9b'));db[_0xac08('0x9c')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x9d'));db['SugarcrmAccount']=db['sequelize'][_0xac08('0x11')](_0xac08('0x9e'));db[_0xac08('0x9f')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xa0'));db[_0xac08('0xa1')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xac08('0xa2')]=db['sequelize'][_0xac08('0x11')]('../api/intDeskAccount/intDeskAccount.model');db[_0xac08('0xa3')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xa4'));db[_0xac08('0xa5')]=db['sequelize'][_0xac08('0x11')]('../api/intDeskField/intDeskField.model');db[_0xac08('0xa6')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xa7'));db[_0xac08('0xa8')]=db['sequelize'][_0xac08('0x11')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0xac08('0x11')]('../api/intZohoField/intZohoField.model');db[_0xac08('0xa9')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xaa'));db[_0xac08('0xab')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xac'));db[_0xac08('0xad')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xae'));db[_0xac08('0xaf')]=db[_0xac08('0x1')]['import'](_0xac08('0xb0'));db[_0xac08('0xb1')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xb2'));db['FreshdeskField']=db['sequelize'][_0xac08('0x11')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xb3'));db[_0xac08('0xb4')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xb5'));db[_0xac08('0xb6')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xb7'));db[_0xac08('0xb8')]=db[_0xac08('0x1')]['import'](_0xac08('0xb9'));db['ServicenowConfiguration']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xac08('0xba')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xbb'));db[_0xac08('0xbc')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xbd'));db['Dynamics365Configuration']=db['sequelize'][_0xac08('0x11')](_0xac08('0xbe'));db[_0xac08('0xbf')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xc0'));db[_0xac08('0xc1')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xc2'));db['FreshsalesConfiguration']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xac08('0xc3')]=db[_0xac08('0x1')]['import'](_0xac08('0xc4'));db[_0xac08('0x90')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x91'));db[_0xac08('0xc5')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xc6'));db[_0xac08('0xc7')]=db[_0xac08('0x1')]['import'](_0xac08('0xc8'));db['ChatInternalMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xc9'));db[_0xac08('0xca')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xcb'));db[_0xac08('0xcc')]=db[_0xac08('0x1')]['import'](_0xac08('0xcd'));db[_0xac08('0xce')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xcf'));db[_0xac08('0xd0')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xd1'));db[_0xac08('0xd2')]=db['sequelize']['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xac08('0xd3')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xd4'));db[_0xac08('0xd5')]=db[_0xac08('0x1')]['import'](_0xac08('0xd6'));db[_0xac08('0xd7')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xd8'));db[_0xac08('0xd9')]=db[_0xac08('0x1')]['import'](_0xac08('0xda'));db['SquareRecording']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xdb'));db['SquareMessage']=db['sequelize'][_0xac08('0x11')](_0xac08('0xdc'));db['Team']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xdd'));db[_0xac08('0xde')]=db[_0xac08('0x1')]['import'](_0xac08('0xdf'));db['Campaign']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/campaign/campaign.model');db[_0xac08('0xe0')]=db[_0xac08('0x1')]['import'](_0xac08('0xe1'));db[_0xac08('0xe2')]=db[_0xac08('0x1')]['import'](_0xac08('0xe3'));db[_0xac08('0xe4')]=db[_0xac08('0x1')]['import'](_0xac08('0xe5'));db['MailTransferReport']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/mailTransferReport/mailTransferReport.model');db[_0xac08('0xe6')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xe7'));db['FaxTransferReport']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xe8'));db[_0xac08('0xe9')]=db[_0xac08('0x1')]['import'](_0xac08('0xea'));db[_0xac08('0xeb')]=db['sequelize'][_0xac08('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0xac08('0xec')]=db[_0xac08('0x1')]['import'](_0xac08('0xed'));db[_0xac08('0xee')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xef'));db[_0xac08('0xf0')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xf1'));db[_0xac08('0xf2')]=db['sequelize'][_0xac08('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0xac08('0xf3')]=db['sequelize'][_0xac08('0x11')]('../api/userProfileResource/userProfileResource.model');db[_0xac08('0xf4')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xf5'));db[_0xac08('0xf6')]=db['sequelize'][_0xac08('0x11')](_0xac08('0xf7'));db['WhatsappApplication']=db['sequelize'][_0xac08('0x11')]('../api/whatsappApplication/whatsappApplication.model');db[_0xac08('0xf8')]=db['sequelize'][_0xac08('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xf9'));db['WhatsappQueueReport']=db[_0xac08('0x1')]['import'](_0xac08('0xfa'));db[_0xac08('0xfb')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0xfc'));db[_0xac08('0xfd')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/whatsappQueue/whatsappQueue.model');db[_0xac08('0xfe')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/cloudProvider/cloudProvider.model');db[_0xac08('0xff')]=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x100'));db['TeamVoicePrefix']=db[_0xac08('0x1')][_0xac08('0x11')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0xac08('0x1')][_0xac08('0x11')](_0xac08('0x101'));db[_0xac08('0x102')]=db[_0xac08('0x1')][_0xac08('0x11')]('../api/user-setting/user-setting.model');db[_0xac08('0x103')]['hasOne'](db[_0xac08('0x1b')],{'as':_0xac08('0x1b'),'onDelete':_0xac08('0x104'),'foreignKey':'UserId'});db[_0xac08('0x103')]['hasOne'](db[_0xac08('0x102')],{'as':'userSetting','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x19')],{'as':_0xac08('0x107'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x29')],{'as':_0xac08('0x108'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x109')],{'as':_0xac08('0x10a'),'onDelete':_0xac08('0x104'),'hooks':!![]});db['User']['hasMany'](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xac08('0x10c')],{'as':_0xac08('0x10d'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')]['hasMany'](db[_0xac08('0x77')],{'as':_0xac08('0x77'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x68')],{'as':_0xac08('0x10e'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0x55')],{'as':_0xac08('0x10f'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')]['hasMany'](db['FaxInteraction'],{'as':_0xac08('0x110'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')]['hasMany'](db['MailInteraction'],{'as':_0xac08('0x111'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0xf8')],{'as':_0xac08('0x112'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x103')][_0xac08('0x106')](db[_0xac08('0xf4')],{'as':'UserNotifications','foreignKey':_0xac08('0x113')});db[_0xac08('0x103')][_0xac08('0x114')](db[_0xac08('0xf0')],{'as':_0xac08('0xf0'),'foreignKey':_0xac08('0x115')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x6e')],{'as':_0xac08('0x117'),'through':_0xac08('0x118')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x119')],{'as':_0xac08('0x11a'),'through':'cm_user_has_contacts'});db[_0xac08('0x103')][_0xac08('0x116')](db['CmList'],{'as':'Lists','through':_0xac08('0x11b')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x11d')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x3c')],{'as':_0xac08('0x111'),'through':_0xac08('0x11e')});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0x68')],{'as':'ChatInteractions','through':_0xac08('0x11f')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x4a')],{'as':_0xac08('0x110'),'through':_0xac08('0x120')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x55')],{'as':'SmsInteractions','through':_0xac08('0x121')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x5d')],{'as':_0xac08('0x122'),'through':_0xac08('0x123')});db[_0xac08('0x103')]['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User']['belongsToMany'](db[_0xac08('0x17')],{'as':_0xac08('0x124'),'through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db[_0xac08('0xee')],{'as':_0xac08('0x125'),'through':_0xac08('0x126'),'required':![]});db['User'][_0xac08('0x116')](db['MailQueue'],{'as':_0xac08('0x127'),'through':_0xac08('0x2e'),'required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0xac08('0x128'),'through':_0xac08('0x2d'),'required':![],'hooks':!![]});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0x4e')],{'as':_0xac08('0x129'),'through':_0xac08('0x30'),'required':![]});db['User'][_0xac08('0x116')](db[_0xac08('0x12a')],{'as':'SmsQueues','through':_0xac08('0x12b'),'required':![]});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0x61')],{'as':_0xac08('0x12c'),'through':'UserOpenchannelQueue','required':![]});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0xfd')],{'as':_0xac08('0x12d'),'through':_0xac08('0x34'),'required':![]});db[_0xac08('0x103')]['belongsToMany'](db[_0xac08('0xec')],{'through':'cm_user_has_lists'});db[_0xac08('0x103')][_0xac08('0x116')](db['ChatWebsite'],{'as':_0xac08('0x12e'),'through':'user_has_chat_websites'});db[_0xac08('0x103')][_0xac08('0x116')](db['FaxAccount'],{'as':_0xac08('0x12f'),'through':_0xac08('0x130')});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x131')],{'as':'MailAccounts','through':_0xac08('0x132')});db[_0xac08('0x103')][_0xac08('0x116')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0xac08('0x103')][_0xac08('0x116')](db[_0xac08('0x51')],{'as':'SmsAccounts','through':_0xac08('0x133')});db[_0xac08('0x103')][_0xac08('0x116')](db['WhatsappAccount'],{'as':_0xac08('0x134'),'through':_0xac08('0x135')});db['User'][_0xac08('0x116')](db[_0xac08('0xd9')],{'as':_0xac08('0x136'),'through':'user_has_square_projects'});db[_0xac08('0x13')]['hasMany'](db[_0xac08('0x109')],{'as':_0xac08('0x137'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x138')});db[_0xac08('0x14')][_0xac08('0x106')](db['VoiceExtension'],{'onDelete':_0xac08('0x104')});db[_0xac08('0x109')][_0xac08('0x106')](db[_0xac08('0x109')],{'as':_0xac08('0x139'),'onDelete':_0xac08('0x104')});db[_0xac08('0x16')][_0xac08('0x116')](db[_0xac08('0x8a')],{'as':'Sounds','through':'moh_has_sounds'});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0x29')],{'as':_0xac08('0x13a'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db['CmHopper'],{'as':_0xac08('0x13c'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db['CmHopperHistory'],{'as':_0xac08('0x13d'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0x77')],{'as':_0xac08('0x77'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xac08('0x106')](db['CmHopperBlack'],{'as':_0xac08('0x13e'),'foreignKey':_0xac08('0x13b')});db[_0xac08('0x17')][_0xac08('0x106')](db[_0xac08('0xce')],{'as':_0xac08('0x13f'),'foreignKey':_0xac08('0x13b')});db['VoiceQueue'][_0xac08('0x114')](db[_0xac08('0x140')],{'as':'Trunk','foreignKey':_0xac08('0x141')});db['VoiceQueue'][_0xac08('0x114')](db[_0xac08('0x140')],{'as':_0xac08('0x142'),'foreignKey':_0xac08('0x143')});db[_0xac08('0x17')][_0xac08('0x114')](db[_0xac08('0x144')],{'as':_0xac08('0x144'),'foreignKey':_0xac08('0x145')});db['VoiceQueue'][_0xac08('0x114')](db['Pause'],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x17')][_0xac08('0x116')](db[_0xac08('0xec')],{'as':_0xac08('0x148'),'through':_0xac08('0x149')});db[_0xac08('0x17')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x2b')});db[_0xac08('0x17')][_0xac08('0x116')](db['Team'],{'as':_0xac08('0x14b'),'through':_0xac08('0xff')});db[_0xac08('0x17')][_0xac08('0x116')](db[_0xac08('0xec')],{'as':_0xac08('0x14c'),'through':_0xac08('0x14d')});db[_0xac08('0x19')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x103'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x14e')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x103'),'foreignKey':'UserId'});db['VoiceMail'][_0xac08('0x106')](db[_0xac08('0x1d')],{'as':'Messages','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x14f'),'sourceKey':_0xac08('0x150')});db['VoiceMailMessage'][_0xac08('0x114')](db[_0xac08('0x1b')],{'foreignKey':_0xac08('0x14f'),'targetKey':'mailbox'});db[_0xac08('0x1e')]['hasMany'](db[_0xac08('0x23')],{'as':_0xac08('0x151'),'foreignKey':'uniqueid','constraints':![]});db[_0xac08('0x1e')][_0xac08('0x106')](db['VoiceAgentReport'],{'as':_0xac08('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0xac08('0x1e')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x103'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x1e')]['belongsTo'](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['MailServerIn']['belongsTo'](db[_0xac08('0x131')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xac08('0x35')][_0xac08('0x114')](db[_0xac08('0xfe')],{'as':_0xac08('0xfe'),'foreignKey':_0xac08('0x155'),'onDelete':'restrict'});db[_0xac08('0x156')][_0xac08('0x114')](db[_0xac08('0x131')],{'as':'MailAccount','foreignKey':_0xac08('0x157')});db[_0xac08('0x156')]['belongsTo'](db[_0xac08('0xfe')],{'as':_0xac08('0xfe'),'foreignKey':_0xac08('0x155'),'onDelete':_0xac08('0x158')});db['MailAccount'][_0xac08('0x159')](db[_0xac08('0x35')],{'as':'Imap','onDelete':_0xac08('0x104')});db[_0xac08('0x131')][_0xac08('0x159')](db[_0xac08('0x156')],{'as':'Smtp','onDelete':_0xac08('0x104')});db[_0xac08('0x131')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':'MailAccountId','onDelete':_0xac08('0x104')});db[_0xac08('0x131')][_0xac08('0x106')](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0xac08('0x15c')],{'as':_0xac08('0x15d'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xac08('0x106')](db[_0xac08('0x3c')],{'as':_0xac08('0x15e')});db[_0xac08('0x131')][_0xac08('0x106')](db[_0xac08('0x3f')],{'as':'Applications'});db[_0xac08('0x131')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db[_0xac08('0x131')]['belongsTo'](db[_0xac08('0x161')],{'as':_0xac08('0x161'),'foreignKey':_0xac08('0x162')});db[_0xac08('0x131')][_0xac08('0x114')](db[_0xac08('0x82')],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x131')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x132')});db[_0xac08('0x38')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x2e')});db[_0xac08('0x38')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x163'),'as':_0xac08('0x14b')});db[_0xac08('0x3c')]['hasMany'](db[_0xac08('0x15c')],{'as':'Messages','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x164')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x157')});db[_0xac08('0x3c')]['belongsTo'](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['MailInteraction'][_0xac08('0x114')](db['User'],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db['MailInteraction'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':'mail_interaction_has_tags','as':_0xac08('0x167')});db['MailInteraction'][_0xac08('0x116')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xac08('0x168')});db[_0xac08('0x3c')][_0xac08('0x116')](db['User'],{'as':'Users','through':_0xac08('0x11e'),'foreignKey':_0xac08('0x164')});db[_0xac08('0x15c')][_0xac08('0x106')](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db[_0xac08('0x15c')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x103')});db['MailMessage'][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153')});db['MailMessage'][_0xac08('0x114')](db[_0xac08('0x3c')],{'as':_0xac08('0x169'),'foreignKey':_0xac08('0x164')});db[_0xac08('0x15c')][_0xac08('0x114')](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0xac08('0x15c')][_0xac08('0x114')](db[_0xac08('0x63')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0xac08('0x15c')][_0xac08('0x114')](db[_0xac08('0x16a')],{'as':_0xac08('0x16a'),'foreignKey':_0xac08('0x16b')});db[_0xac08('0x3f')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x3f')][_0xac08('0x114')](db[_0xac08('0x38')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x3f')][_0xac08('0x114')](db[_0xac08('0x131')],{'onDelete':'restrict'});db[_0xac08('0x3f')][_0xac08('0x114')](db['Interval'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db['MailApplication'][_0xac08('0x114')](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':'TagId'});db[_0xac08('0x41')]['belongsTo'](db[_0xac08('0x131')],{});db[_0xac08('0x41')]['belongsTo'](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':'ListId'});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x3c')],{});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x15c')],{});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x103')],{});db[_0xac08('0x41')][_0xac08('0x114')](db[_0xac08('0x38')],{});db[_0xac08('0x43')][_0xac08('0x106')](db[_0xac08('0x45')],{'as':_0xac08('0x16c'),'onDelete':_0xac08('0x104')});db[_0xac08('0x46')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':_0xac08('0x16d'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':_0xac08('0x16d')});db[_0xac08('0x46')]['hasMany'](db[_0xac08('0x4a')],{'as':_0xac08('0x15e')});db[_0xac08('0x46')][_0xac08('0x106')](db['FaxApplication'],{'as':'Applications'});db[_0xac08('0x46')][_0xac08('0x106')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xac08('0x104')});db[_0xac08('0x46')]['hasMany'](db[_0xac08('0x4c')],{'as':_0xac08('0x15d')});db['FaxAccount'][_0xac08('0x114')](db[_0xac08('0x140')],{'as':_0xac08('0x140')});db[_0xac08('0x46')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':'List','foreignKey':_0xac08('0x160')});db['FaxAccount'][_0xac08('0x114')](db[_0xac08('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xac08('0x46')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':'user_has_fax_accounts'});db[_0xac08('0x48')]['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x48')][_0xac08('0x114')](db[_0xac08('0x4e')],{'onDelete':_0xac08('0x158')});db['FaxApplication'][_0xac08('0x114')](db[_0xac08('0x46')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x48')][_0xac08('0x114')](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x16e')});db['FaxInteraction'][_0xac08('0x106')](db[_0xac08('0x4c')],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x16f')});db['FaxInteraction'][_0xac08('0x114')](db[_0xac08('0x46')],{'as':'Account','foreignKey':_0xac08('0x16d')});db['FaxInteraction'][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x4a')][_0xac08('0x114')](db['User'],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x4a')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x170'),'as':_0xac08('0x167')});db[_0xac08('0x4a')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x170'),'as':_0xac08('0x168')});db[_0xac08('0x4a')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x120'),'foreignKey':'FaxInteractionId'});db[_0xac08('0x4c')][_0xac08('0x114')](db['User'],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x103')});db[_0xac08('0x4c')][_0xac08('0x114')](db[_0xac08('0x4a')],{'as':_0xac08('0x169'),'foreignKey':_0xac08('0x16f')});db[_0xac08('0x4c')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153')});db[_0xac08('0x4c')][_0xac08('0x114')](db['Attachment'],{'as':_0xac08('0xe2'),'foreignKey':_0xac08('0x172')});db[_0xac08('0x4c')][_0xac08('0x114')](db['FaxAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x16d')});db['FaxQueue'][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x30')});db[_0xac08('0x4e')]['belongsToMany'](db[_0xac08('0x11c')],{'through':_0xac08('0x173'),'as':_0xac08('0x14b')});db['FaxQueueReport'][_0xac08('0x114')](db[_0xac08('0x46')],{});db[_0xac08('0x50')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db['FaxQueueReport'][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':'ContactId'});db[_0xac08('0x50')][_0xac08('0x114')](db[_0xac08('0x4a')],{});db[_0xac08('0x50')][_0xac08('0x114')](db['FaxMessage'],{});db[_0xac08('0x50')][_0xac08('0x114')](db['User'],{});db[_0xac08('0x50')][_0xac08('0x114')](db[_0xac08('0x4e')],{});db[_0xac08('0x51')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':'SmsAccountId','onDelete':_0xac08('0x104')});db['SmsAccount']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xac08('0x174')});db['SmsAccount'][_0xac08('0x106')](db[_0xac08('0x57')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0xac08('0x51')][_0xac08('0x106')](db['SmsInteraction'],{'as':_0xac08('0x15e')});db[_0xac08('0x51')][_0xac08('0x106')](db['SmsApplication'],{'as':_0xac08('0x139')});db[_0xac08('0x51')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db['SmsAccount'][_0xac08('0x114')](db[_0xac08('0x82')],{'as':_0xac08('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xac08('0x51')][_0xac08('0x116')](db['User'],{'as':_0xac08('0x14a'),'through':_0xac08('0x133')});db[_0xac08('0x53')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x53')][_0xac08('0x114')](db['SmsQueue'],{'onDelete':'restrict'});db[_0xac08('0x53')][_0xac08('0x114')](db[_0xac08('0x51')],{'onDelete':'restrict'});db[_0xac08('0x53')][_0xac08('0x114')](db['Interval'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db[_0xac08('0x53')]['belongsTo'](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':'TagId'});db[_0xac08('0x55')][_0xac08('0x106')](db[_0xac08('0x57')],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xac08('0x114')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xac08('0x55')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x55')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x55')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x175'),'as':_0xac08('0x167')});db[_0xac08('0x55')][_0xac08('0x116')](db['Tag'],{'through':_0xac08('0x175'),'as':_0xac08('0x168')});db[_0xac08('0x55')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x121'),'foreignKey':'SmsInteractionId'});db[_0xac08('0x57')][_0xac08('0x114')](db['User'],{'as':_0xac08('0x103')});db['SmsMessage'][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153')});db[_0xac08('0x57')][_0xac08('0x114')](db[_0xac08('0x55')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x169'),'foreignKey':_0xac08('0x176')});db[_0xac08('0x57')]['belongsTo'](db[_0xac08('0x51')],{'as':_0xac08('0x165'),'foreignKey':'SmsAccountId'});db[_0xac08('0x12a')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':'UserSmsQueue','foreignKey':_0xac08('0x177')});db[_0xac08('0x12a')]['belongsToMany'](db['Team'],{'through':_0xac08('0x178'),'as':'Teams'});db['OpenchannelAccount'][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':_0xac08('0x179'),'onDelete':_0xac08('0x104')});db[_0xac08('0x5a')][_0xac08('0x106')](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0xac08('0x5a')][_0xac08('0x106')](db[_0xac08('0x5d')],{'as':_0xac08('0x15e'),'foreignKey':_0xac08('0x179')});db['OpenchannelAccount'][_0xac08('0x106')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xac08('0x179')});db[_0xac08('0x5a')][_0xac08('0x106')](db[_0xac08('0x5c')],{'as':_0xac08('0x139'),'foreignKey':_0xac08('0x179')});db[_0xac08('0x5a')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db['OpenchannelAccount'][_0xac08('0x114')](db[_0xac08('0x82')],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x5a')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x17a')});db[_0xac08('0x5c')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x5c')][_0xac08('0x114')](db[_0xac08('0x61')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x17b')});db[_0xac08('0x5c')]['belongsTo'](db[_0xac08('0x5a')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x179')});db['OpenchannelApplication'][_0xac08('0x114')](db[_0xac08('0x144')],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db[_0xac08('0x5c')][_0xac08('0x114')](db['Tag'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x16e')});db['OpenchannelInteraction'][_0xac08('0x106')](db[_0xac08('0x5f')],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':'OpenchannelInteractionId'});db[_0xac08('0x5d')][_0xac08('0x114')](db[_0xac08('0x5a')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x179')});db['OpenchannelInteraction'][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x5d')]['belongsTo'](db[_0xac08('0x103')],{'as':'Owner','foreignKey':_0xac08('0x105')});db['OpenchannelInteraction'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x17c'),'as':_0xac08('0x167')});db[_0xac08('0x5d')][_0xac08('0x116')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xac08('0x168')});db[_0xac08('0x5d')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':'user_has_openchannel_interactions','foreignKey':_0xac08('0x17d')});db[_0xac08('0x5f')]['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x103')});db[_0xac08('0x5f')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':'cascade','as':_0xac08('0x153')});db[_0xac08('0x5f')][_0xac08('0x114')](db[_0xac08('0x5d')],{'onDelete':_0xac08('0x104'),'as':'Interaction','foreignKey':_0xac08('0x17d')});db['OpenchannelMessage'][_0xac08('0x114')](db[_0xac08('0xe2')],{'as':_0xac08('0xe2'),'foreignKey':'AttachmentId'});db[_0xac08('0x5f')][_0xac08('0x114')](db[_0xac08('0x5a')],{'as':_0xac08('0x165'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x32'),'foreignKey':_0xac08('0x17b')});db[_0xac08('0x61')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x17e'),'as':'Teams'});db['ChatWebsite']['hasMany'](db[_0xac08('0x7e')],{'as':'Dispositions','foreignKey':_0xac08('0x17f'),'onDelete':'cascade'});db[_0xac08('0x63')][_0xac08('0x106')](db['CannedAnswer'],{'as':_0xac08('0x15b'),'foreignKey':_0xac08('0x17f')});db['ChatWebsite'][_0xac08('0x106')](db[_0xac08('0x180')],{'as':_0xac08('0x181')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0xac08('0x15e')});db['ChatWebsite'][_0xac08('0x106')](db[_0xac08('0x66')],{'as':_0xac08('0x139')});db[_0xac08('0x63')][_0xac08('0x106')](db[_0xac08('0x6a')],{'as':_0xac08('0x15d')});db['ChatWebsite'][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':'ListId'});db[_0xac08('0x63')][_0xac08('0x114')](db[_0xac08('0x144')],{'as':_0xac08('0x144'),'foreignKey':_0xac08('0x145')});db[_0xac08('0x63')][_0xac08('0x114')](db[_0xac08('0x131')],{'as':'MailAccount','foreignKey':_0xac08('0x157')});db[_0xac08('0x63')]['belongsTo'](db['Pause'],{'as':_0xac08('0x146'),'foreignKey':_0xac08('0x147')});db[_0xac08('0x63')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x182')});db[_0xac08('0x64')][_0xac08('0x114')](db[_0xac08('0x5a')],{});db['OpenchannelQueueReport'][_0xac08('0x114')](db[_0xac08('0xec')],{'as':'List','foreignKey':_0xac08('0x160')});db[_0xac08('0x64')][_0xac08('0x114')](db['CmContact'],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x64')][_0xac08('0x114')](db[_0xac08('0x5d')],{});db[_0xac08('0x64')]['belongsTo'](db[_0xac08('0x5f')],{});db[_0xac08('0x64')][_0xac08('0x114')](db['User'],{});db[_0xac08('0x64')][_0xac08('0x114')](db[_0xac08('0x61')],{});db['ChatApplication'][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x183'),'foreignKey':_0xac08('0x105'),'onDelete':_0xac08('0x158')});db[_0xac08('0x66')][_0xac08('0x114')](db[_0xac08('0x6c')],{'as':_0xac08('0x184'),'foreignKey':_0xac08('0x185'),'onDelete':_0xac08('0x158')});db['ChatApplication'][_0xac08('0x114')](db[_0xac08('0x63')],{'as':'Website','foreignKey':_0xac08('0x17f'),'onDelete':_0xac08('0x158')});db['ChatApplication'][_0xac08('0x114')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xac08('0x16e')});db[_0xac08('0x68')][_0xac08('0x106')](db['ChatMessage'],{'as':_0xac08('0x15d'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x186')});db['ChatInteraction'][_0xac08('0x114')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xac08('0x17f')});db[_0xac08('0x68')][_0xac08('0x114')](db['CmContact'],{'as':'Contact','foreignKey':_0xac08('0x154')});db[_0xac08('0x68')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x166'),'foreignKey':_0xac08('0x105')});db[_0xac08('0x68')]['belongsToMany'](db['Tag'],{'through':_0xac08('0x187'),'as':'Tags'});db[_0xac08('0x68')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x187'),'as':_0xac08('0x168')});db[_0xac08('0x68')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x11f'),'foreignKey':'ChatInteractionId'});db[_0xac08('0x6a')][_0xac08('0x114')](db['User'],{'onDelete':_0xac08('0x104'),'as':'User'});db[_0xac08('0x6a')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':'Contact','foreignKey':_0xac08('0x154')});db[_0xac08('0x6a')][_0xac08('0x114')](db['ChatInteraction'],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x169'),'foreignKey':_0xac08('0x186')});db[_0xac08('0x6a')][_0xac08('0x114')](db[_0xac08('0xe2')],{'as':_0xac08('0xe2'),'foreignKey':_0xac08('0x172')});db[_0xac08('0x6a')][_0xac08('0x114')](db[_0xac08('0x63')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xac08('0x106')](db[_0xac08('0xe2')],{'as':_0xac08('0x188'),'foreignKey':_0xac08('0x16b'),'onDelete':_0xac08('0x104'),'hooks':!![]});db['ChatOfflineMessage'][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['ChatOfflineMessage'][_0xac08('0x114')](db[_0xac08('0x63')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x17f')});db[_0xac08('0x6c')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Agents','through':_0xac08('0x2d'),'hooks':!![]});db[_0xac08('0x6c')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x189'),'as':'Teams'});db['ChatGroup'][_0xac08('0x106')](db[_0xac08('0x18a')],{'as':_0xac08('0x15d'),'foreignKey':'ChatGroupId','onDelete':_0xac08('0x104')});db[_0xac08('0x6e')][_0xac08('0x116')](db[_0xac08('0x103')],{'as':_0xac08('0x13a'),'through':_0xac08('0x118')});db[_0xac08('0x180')]['belongsTo'](db[_0xac08('0x63')],{'as':_0xac08('0x18b'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xac08('0x106')](db[_0xac08('0x119')],{'as':'Contacts','foreignKey':_0xac08('0x18c')});db['CmContact'][_0xac08('0x106')](db[_0xac08('0x18d')],{'as':_0xac08('0x13c'),'foreignKey':_0xac08('0x154')});db['CmContact'][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x10c')],{'as':_0xac08('0x13d'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')]['hasMany'](db['ReportAgentPreview'],{'as':_0xac08('0x77'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')]['hasMany'](db[_0xac08('0xce')],{'as':_0xac08('0x13f'),'foreignKey':_0xac08('0x154')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x68')],{'as':_0xac08('0x10e'),'foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x55')],{'as':'SmsInteractions','foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db[_0xac08('0x4a')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x106')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xac08('0x158')});db[_0xac08('0x119')][_0xac08('0x114')](db[_0xac08('0x18e')],{'as':_0xac08('0x18f'),'foreignKey':_0xac08('0x18c')});db[_0xac08('0x119')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160'),'onDelete':_0xac08('0x104')});db['CmContact'][_0xac08('0x116')](db['User'],{'as':_0xac08('0x171'),'through':_0xac08('0x190')});db[_0xac08('0x119')][_0xac08('0x116')](db[_0xac08('0x8c')],{'as':_0xac08('0x167'),'through':'cm_contact_has_tags'});db['CmContact'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x191'),'as':_0xac08('0x168')});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154'),'onDelete':_0xac08('0x104')});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0xac08('0x15f'),'foreignKey':'ListId','onDelete':_0xac08('0x104')});db[_0xac08('0x18d')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x183'),'foreignKey':'UserId'});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x17')],{'as':_0xac08('0x184'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x192')],{'as':_0xac08('0x192'),'foreignKey':_0xac08('0x193'),'onDelete':_0xac08('0x104')});db[_0xac08('0x18d')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':_0xac08('0x166'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xac08('0x114')](db['CmContact'],{'as':_0xac08('0x153'),'foreignKey':'ContactId','onDelete':_0xac08('0x104')});db[_0xac08('0x72')][_0xac08('0x114')](db[_0xac08('0xec')],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160'),'onDelete':_0xac08('0x104')});db['CmHopperBlack'][_0xac08('0x114')](db[_0xac08('0x17')],{'as':'Queue','foreignKey':_0xac08('0x13b'),'onDelete':'cascade'});db[_0xac08('0x72')][_0xac08('0x114')](db[_0xac08('0x192')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xac08('0x104')});db['Automation'][_0xac08('0x106')](db[_0xac08('0x80')],{'as':{'plural':_0xac08('0x194'),'singular':_0xac08('0x195')},'foreignKey':_0xac08('0x196'),'onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0x197')][_0xac08('0x106')](db[_0xac08('0x80')],{'as':{'plural':_0xac08('0x198'),'singular':_0xac08('0x199')},'foreignKey':_0xac08('0x19a'),'onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0x197')][_0xac08('0x106')](db[_0xac08('0x7a')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xac08('0x104'),'hooks':!![]});db['Disposition'][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xac08('0x144')][_0xac08('0x106')](db['Interval'],{'as':_0xac08('0x19b'),'foreignKey':_0xac08('0x145'),'onDelete':_0xac08('0x104'),'hooks':!![],'required':![]});db[_0xac08('0x144')]['hasMany'](db[_0xac08('0x109')],{'as':_0xac08('0x10a'),'foreignKey':'IntervalId','onDelete':_0xac08('0x158')});db[_0xac08('0x144')][_0xac08('0x106')](db[_0xac08('0x3f')],{'as':'MailApplications','foreignKey':_0xac08('0x145')});db[_0xac08('0x144')][_0xac08('0x106')](db['ChatApplication'],{'as':_0xac08('0x19c'),'foreignKey':'IntervalId'});db[_0xac08('0x144')][_0xac08('0x106')](db['FaxApplication'],{'as':_0xac08('0x19d'),'foreignKey':_0xac08('0x145')});db['Interval']['hasMany'](db['SmsApplication'],{'as':_0xac08('0x19e'),'foreignKey':_0xac08('0x145')});db['Schedule'][_0xac08('0x114')](db[_0xac08('0x131')],{});db[_0xac08('0x88')][_0xac08('0x114')](db['AnalyticDefaultReport'],{'foreignKey':_0xac08('0x19f')});db[_0xac08('0x88')][_0xac08('0x114')](db['AnalyticCustomReport'],{'foreignKey':_0xac08('0x1a0')});db[_0xac08('0x8a')][_0xac08('0x116')](db['VoiceMusicOnHold'],{'as':_0xac08('0x1a1'),'through':_0xac08('0x1a2'),'onDelete':_0xac08('0x158')});db[_0xac08('0x8c')]['belongsToMany'](db[_0xac08('0x119')],{'through':'cm_contact_has_tags'});db['Tag'][_0xac08('0x116')](db[_0xac08('0x68')],{'through':_0xac08('0x187')});db[_0xac08('0x8c')]['belongsToMany'](db['MailInteraction'],{'through':_0xac08('0x1a3')});db[_0xac08('0x8c')]['belongsToMany'](db[_0xac08('0x55')],{'through':'sms_interaction_has_tags'});db[_0xac08('0x8c')][_0xac08('0x116')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xac08('0x8c')][_0xac08('0x116')](db['OpenchannelInteraction'],{'through':_0xac08('0x17c')});db[_0xac08('0x8c')][_0xac08('0x116')](db['WhatsappInteraction'],{'through':_0xac08('0x1a4')});db[_0xac08('0x8e')][_0xac08('0x106')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xac08('0x1a5')},'foreignKey':_0xac08('0x1a6'),'onDelete':_0xac08('0x104'),'hooks':!![]});db['Trigger'][_0xac08('0x106')](db[_0xac08('0x80')],{'as':{'plural':'AnyConditions','singular':_0xac08('0x1a7')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0xac08('0x8e')][_0xac08('0x106')](db[_0xac08('0x7a')],{'as':'Actions','foreignKey':_0xac08('0x1a8'),'onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0x1a9')][_0xac08('0x106')](db[_0xac08('0x97')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xac08('0x106')](db['AnalyticFieldReport'],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x19f')});db[_0xac08('0x96')]['hasMany'](db[_0xac08('0x97')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1ab')});db[_0xac08('0x97')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xac08('0x1ab')});db[_0xac08('0x1ac')]['hasMany'](db[_0xac08('0x9a')],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x9a')]['hasMany'](db[_0xac08('0x9c')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x9a')]['hasMany'](db[_0xac08('0x9c')],{'as':_0xac08('0x1b1'),'onDelete':_0xac08('0x104'),'foreignKey':'DescriptionId'});db[_0xac08('0x9a')]['hasMany'](db[_0xac08('0x9c')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db['SalesforceConfiguration']['belongsTo'](db[_0xac08('0x1ac')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x9c')][_0xac08('0x106')](db[_0xac08('0x9c')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db['SalesforceField'][_0xac08('0x106')](db['SalesforceField'],{'as':_0xac08('0x1b4'),'foreignKey':'DescriptionId'});db[_0xac08('0x9c')][_0xac08('0x106')](db['SalesforceField'],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0x9c')][_0xac08('0x114')](db['Variable'],{'as':'Variable','foreignKey':_0xac08('0x1b6')});db[_0xac08('0x1b7')]['hasMany'](db[_0xac08('0x9f')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x9f')][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x9f')][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1b1'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db['SugarcrmConfiguration'][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0x9f')][_0xac08('0x114')](db['SugarcrmAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xa1')][_0xac08('0x106')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xa1')][_0xac08('0x106')](db[_0xac08('0xa1')],{'as':_0xac08('0x1b4'),'foreignKey':'DescriptionId'});db[_0xac08('0xa1')]['hasMany'](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0xac08('0xa1')]['belongsTo'](db[_0xac08('0x8f')],{'as':'Variable','foreignKey':_0xac08('0x1b6')});db[_0xac08('0xa2')][_0xac08('0x106')](db[_0xac08('0xa3')],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db['DeskConfiguration'][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':_0xac08('0x1b1'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xa3')][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':'Fields','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db['DeskConfiguration'][_0xac08('0x114')](db['DeskAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xa3')][_0xac08('0x116')](db['Tag'],{'through':_0xac08('0x1b9')});db[_0xac08('0xa5')][_0xac08('0x106')](db['DeskField'],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db['DeskField'][_0xac08('0x106')](db['DeskField'],{'as':'Description','foreignKey':_0xac08('0x1b8')});db[_0xac08('0xa5')][_0xac08('0x106')](db[_0xac08('0xa5')],{'as':'Field','foreignKey':_0xac08('0x1b2')});db['DeskField'][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xa6')][_0xac08('0x106')](db[_0xac08('0xa8')],{'as':_0xac08('0x1ad'),'onDelete':_0xac08('0x104'),'foreignKey':'AccountId'});db[_0xac08('0xa8')][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':'SubjectId'});db[_0xac08('0xa8')][_0xac08('0x106')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xa8')][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xa8')][_0xac08('0x114')](db[_0xac08('0xa6')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db[_0xac08('0x1ba')][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x1ba')]['hasMany'](db[_0xac08('0x1ba')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0xac08('0x106')](db[_0xac08('0x1ba')],{'as':'Field','foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1ba')][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db[_0xac08('0xa9')][_0xac08('0x106')](db[_0xac08('0xab')],{'as':_0xac08('0x1ad'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1ae')});db['ZendeskConfiguration']['hasMany'](db[_0xac08('0xad')],{'as':_0xac08('0x1af'),'foreignKey':_0xac08('0x1b0')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xac08('0x1b1'),'foreignKey':_0xac08('0x1b8')});db['ZendeskConfiguration'][_0xac08('0x106')](db[_0xac08('0xad')],{'as':_0xac08('0x1aa'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xab')][_0xac08('0x114')](db[_0xac08('0xa9')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db['ZendeskConfiguration'][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x1bb')});db[_0xac08('0xad')][_0xac08('0x106')](db[_0xac08('0xad')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xad')]['hasMany'](db[_0xac08('0xad')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xad')][_0xac08('0x106')](db[_0xac08('0xad')],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db['ZendeskField'][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xaf')]['hasMany'](db[_0xac08('0xb1')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xac08('0xb1')]['hasMany'](db['FreshdeskField'],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xb1')][_0xac08('0x106')](db[_0xac08('0x1bc')],{'as':_0xac08('0x1b1'),'onDelete':'cascade','foreignKey':_0xac08('0x1b8')});db['FreshdeskConfiguration'][_0xac08('0x106')](db['FreshdeskField'],{'as':_0xac08('0x1aa'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xb1')][_0xac08('0x114')](db[_0xac08('0xaf')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db[_0xac08('0xb1')]['belongsToMany'](db[_0xac08('0x8c')],{'through':_0xac08('0x1bd')});db[_0xac08('0x1bc')][_0xac08('0x106')](db[_0xac08('0x1bc')],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x1bc')]['hasMany'](db[_0xac08('0x1bc')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1bc')]['hasMany'](db['FreshdeskField'],{'as':_0xac08('0x1b5'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xac08('0x114')](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0x1be')][_0xac08('0x106')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xac08('0x104'),'foreignKey':'AccountId'});db[_0xac08('0xb4')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':'Subjects','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xb4')]['hasMany'](db[_0xac08('0xb6')],{'as':_0xac08('0x1b1'),'foreignKey':'DescriptionId'});db[_0xac08('0xb4')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':_0xac08('0x1aa'),'foreignKey':_0xac08('0x1b2')});db['VtigerConfiguration'][_0xac08('0x114')](db[_0xac08('0x1be')],{'as':'Account','foreignKey':_0xac08('0x1ae')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xb6')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xb6')][_0xac08('0x106')](db[_0xac08('0xb6')],{'as':'Field','foreignKey':'FieldId'});db[_0xac08('0xb6')]['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xb8')]['hasMany'](db[_0xac08('0x1bf')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xac08('0x1bf')][_0xac08('0x106')](db[_0xac08('0xba')],{'as':_0xac08('0x1af'),'foreignKey':_0xac08('0x1b0')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0xac08('0x1b1'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1bf')][_0xac08('0x106')](db['ServicenowField'],{'as':'Fields','foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1bf')][_0xac08('0x114')](db[_0xac08('0xb8')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xba')][_0xac08('0x106')](db[_0xac08('0xba')],{'as':'Subject','foreignKey':_0xac08('0x1b0')});db[_0xac08('0xba')][_0xac08('0x106')](db[_0xac08('0xba')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db['ServicenowField'][_0xac08('0x106')](db[_0xac08('0xba')],{'as':_0xac08('0x1b5'),'foreignKey':'FieldId'});db[_0xac08('0xba')]['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db['Dynamics365Account'][_0xac08('0x106')](db[_0xac08('0x1c0')],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':_0xac08('0x1ae')});db[_0xac08('0xbc')][_0xac08('0x114')](db['CloudProvider'],{'as':_0xac08('0xfe'),'foreignKey':'CloudProviderId'});db[_0xac08('0x1c0')][_0xac08('0x106')](db[_0xac08('0xbf')],{'as':_0xac08('0x1af'),'onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b0')});db['Dynamics365Configuration'][_0xac08('0x106')](db[_0xac08('0xbf')],{'as':'Descriptions','onDelete':_0xac08('0x104'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1c0')]['hasMany'](db[_0xac08('0xbf')],{'as':_0xac08('0x1aa'),'onDelete':'cascade','foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1c0')][_0xac08('0x114')](db['Dynamics365Account'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xbf')][_0xac08('0x106')](db['Dynamics365Field'],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xbf')][_0xac08('0x106')](db['Dynamics365Field'],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xbf')][_0xac08('0x106')](db['Dynamics365Field'],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0xbf')]['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':_0xac08('0x1b6')});db[_0xac08('0xc1')][_0xac08('0x106')](db['FreshsalesConfiguration'],{'as':_0xac08('0x1ad'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1af'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0x1c1')]['hasMany'](db[_0xac08('0xc3')],{'as':_0xac08('0x1b1'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0x1c1')][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1aa'),'foreignKey':_0xac08('0x1b2')});db[_0xac08('0x1c1')]['belongsTo'](db[_0xac08('0xc1')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1ae')});db[_0xac08('0xc3')][_0xac08('0x106')](db['FreshsalesField'],{'as':_0xac08('0x1b3'),'foreignKey':_0xac08('0x1b0')});db[_0xac08('0xc3')][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1b4'),'foreignKey':_0xac08('0x1b8')});db[_0xac08('0xc3')][_0xac08('0x106')](db[_0xac08('0xc3')],{'as':_0xac08('0x1b5'),'foreignKey':_0xac08('0x1b2')});db['FreshsalesField']['belongsTo'](db[_0xac08('0x8f')],{'as':_0xac08('0x8f'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0xac08('0x114')](db[_0xac08('0x63')],{});db['ChatQueueReport']['belongsTo'](db[_0xac08('0xec')],{'as':'List','foreignKey':'ListId'});db[_0xac08('0xc7')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':'ContactId'});db[_0xac08('0xc7')][_0xac08('0x114')](db[_0xac08('0x68')],{});db[_0xac08('0xc7')][_0xac08('0x114')](db['ChatMessage'],{});db[_0xac08('0xc7')][_0xac08('0x114')](db['User'],{});db[_0xac08('0xc7')][_0xac08('0x114')](db[_0xac08('0x6c')],{});db[_0xac08('0x18a')][_0xac08('0x114')](db[_0xac08('0x103')],{'onDelete':'cascade','foreignKey':_0xac08('0x1c2')});db['ChatInternalMessage']['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x104'),'foreignKey':'ToId'});db[_0xac08('0xce')][_0xac08('0x106')](db['JscriptyQuestionReport'],{'foreignKey':_0xac08('0x1c3'),'onDelete':_0xac08('0x104')});db[_0xac08('0xce')]['hasMany'](db[_0xac08('0xca')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xac08('0xd0')][_0xac08('0x114')](db[_0xac08('0x51')],{});db[_0xac08('0xd0')][_0xac08('0x114')](db['CmList'],{'as':_0xac08('0x15f'),'foreignKey':'ListId'});db[_0xac08('0xd0')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db[_0xac08('0xd0')]['belongsTo'](db[_0xac08('0x55')],{});db[_0xac08('0xd0')]['belongsTo'](db[_0xac08('0x57')],{});db[_0xac08('0xd0')]['belongsTo'](db[_0xac08('0x103')],{});db[_0xac08('0xd0')]['belongsTo'](db['SmsQueue'],{});db[_0xac08('0xd3')][_0xac08('0x106')](db[_0xac08('0xce')],{'foreignKey':_0xac08('0x1c4')});db[_0xac08('0xd3')][_0xac08('0x106')](db[_0xac08('0xcc')],{'foreignKey':_0xac08('0x1c4')});db[_0xac08('0xd3')]['hasMany'](db[_0xac08('0xca')],{'foreignKey':_0xac08('0x1c4')});db[_0xac08('0xd9')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'through':_0xac08('0x1c5')});db[_0xac08('0x11c')][_0xac08('0x116')](db['User'],{'as':_0xac08('0x14a'),'through':_0xac08('0x11d')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x17')],{'through':_0xac08('0xff'),'as':_0xac08('0x124')});db['Team'][_0xac08('0x116')](db[_0xac08('0x38')],{'through':_0xac08('0x163'),'as':_0xac08('0x127')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x6c')],{'through':_0xac08('0x189'),'as':_0xac08('0x128')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x4e')],{'through':_0xac08('0x173'),'as':'FaxQueues'});db['Team'][_0xac08('0x116')](db['SmsQueue'],{'through':_0xac08('0x178'),'as':_0xac08('0x1c6')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0x61')],{'through':_0xac08('0x17e'),'as':_0xac08('0x12c')});db[_0xac08('0x11c')][_0xac08('0x116')](db[_0xac08('0xfd')],{'through':_0xac08('0x1c7'),'as':_0xac08('0x12d')});db[_0xac08('0x11c')]['belongsToMany'](db[_0xac08('0xee')],{'through':_0xac08('0x1c8'),'as':'VoicePrefixes'});db[_0xac08('0x192')]['hasMany'](db[_0xac08('0x18d')],{'as':_0xac08('0x13c'),'foreignKey':_0xac08('0x193')});db['Campaign'][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0xac08('0x13d'),'foreignKey':_0xac08('0x193')});db[_0xac08('0x192')][_0xac08('0x106')](db[_0xac08('0x72')],{'as':_0xac08('0x13e'),'foreignKey':'CampaignId'});db[_0xac08('0x192')]['belongsTo'](db[_0xac08('0x140')],{'as':_0xac08('0x140'),'foreignKey':_0xac08('0x141')});db[_0xac08('0x192')][_0xac08('0x114')](db[_0xac08('0x140')],{'as':'TrunkBackup','foreignKey':_0xac08('0x143')});db[_0xac08('0x192')][_0xac08('0x114')](db[_0xac08('0x144')],{'as':_0xac08('0x144'),'foreignKey':'IntervalId'});db[_0xac08('0x192')]['belongsTo'](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xac08('0x1c9')});db[_0xac08('0x192')][_0xac08('0x116')](db['CmList'],{'as':_0xac08('0x148'),'through':'campaigns_has_cm_lists'});db[_0xac08('0x192')]['belongsToMany'](db[_0xac08('0xec')],{'as':'BlackLists','through':_0xac08('0x1ca')});db[_0xac08('0xe2')][_0xac08('0x114')](db[_0xac08('0x16a')],{'as':_0xac08('0x16a'),'foreignKey':_0xac08('0x16b')});db[_0xac08('0x1cb')][_0xac08('0x114')](db[_0xac08('0x15c')],{});db[_0xac08('0x1cb')][_0xac08('0x114')](db['MailInteraction'],{});db[_0xac08('0x1cb')][_0xac08('0x114')](db[_0xac08('0x131')],{'foreignKey':_0xac08('0x1cc'),'as':_0xac08('0x1cd')});db[_0xac08('0x1cb')]['belongsTo'](db[_0xac08('0x103')],{'foreignKey':'FromUserId','as':_0xac08('0x1ce')});db[_0xac08('0x1cb')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xac08('0x1cb')]['belongsTo'](db[_0xac08('0x38')],{'foreignKey':_0xac08('0x1cf'),'as':_0xac08('0x1d0')});db[_0xac08('0x1cb')][_0xac08('0x114')](db['MailAccount'],{'foreignKey':_0xac08('0x1d1'),'as':_0xac08('0x1d2')});db['ChatTransferReport']['belongsTo'](db[_0xac08('0x6a')],{});db[_0xac08('0xe6')][_0xac08('0x114')](db['ChatInteraction'],{});db[_0xac08('0xe6')][_0xac08('0x114')](db['ChatWebsite'],{'foreignKey':_0xac08('0x1d3'),'as':'FromAccount'});db[_0xac08('0xe6')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db[_0xac08('0xe6')][_0xac08('0x114')](db['User'],{'foreignKey':_0xac08('0x1d5'),'as':_0xac08('0x1d6')});db['ChatTransferReport'][_0xac08('0x114')](db[_0xac08('0x6c')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xac08('0xe6')][_0xac08('0x114')](db['ChatWebsite'],{'foreignKey':_0xac08('0x1d7'),'as':_0xac08('0x1d2')});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x4c')],{});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x4a')],{});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x46')],{'foreignKey':'FromFaxAccountId','as':_0xac08('0x1cd')});db[_0xac08('0x1d8')]['belongsTo'](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db[_0xac08('0x1d8')][_0xac08('0x114')](db['User'],{'foreignKey':_0xac08('0x1d5'),'as':'ToAgent'});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x4e')],{'foreignKey':_0xac08('0x1d9'),'as':'ToQueue'});db[_0xac08('0x1d8')][_0xac08('0x114')](db[_0xac08('0x46')],{'foreignKey':_0xac08('0x1da'),'as':_0xac08('0x1d2')});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x5f')],{});db['OpenchannelTransferReport'][_0xac08('0x114')](db[_0xac08('0x5d')],{});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x5a')],{'foreignKey':'FromOpenchannelAccountId','as':_0xac08('0x1cd')});db[_0xac08('0xe9')]['belongsTo'](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db[_0xac08('0xe9')][_0xac08('0x114')](db['User'],{'foreignKey':'ToUserId','as':_0xac08('0x1d6')});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x61')],{'foreignKey':_0xac08('0x1db'),'as':_0xac08('0x1d0')});db[_0xac08('0xe9')][_0xac08('0x114')](db[_0xac08('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0xac08('0x1d2')});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x57')],{});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x55')],{});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x51')],{'foreignKey':'FromSmsAccountId','as':_0xac08('0x1cd')});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':'FromAgent'});db['SmsTransferReport'][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d5'),'as':_0xac08('0x1d6')});db[_0xac08('0xeb')][_0xac08('0x114')](db['SmsQueue'],{'foreignKey':_0xac08('0x1dc'),'as':_0xac08('0x1d0')});db[_0xac08('0xeb')][_0xac08('0x114')](db[_0xac08('0x51')],{'foreignKey':_0xac08('0x1dd'),'as':_0xac08('0x1d2')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':'Dispositions','foreignKey':_0xac08('0x160'),'onDelete':_0xac08('0x104')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x79')],{'as':_0xac08('0x1de'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x119')],{'as':_0xac08('0x11a'),'onDelete':'cascade','foreignKey':'ListId'});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x74')],{'as':_0xac08('0x10b'),'foreignKey':'ListId'});db[_0xac08('0xec')]['hasMany'](db[_0xac08('0x10c')],{'as':_0xac08('0x10d'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xec')][_0xac08('0x106')](db[_0xac08('0x77')],{'as':_0xac08('0x77'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xec')]['belongsToMany'](db[_0xac08('0x17')],{'as':'Queues','through':_0xac08('0x149')});db['CmList'][_0xac08('0x116')](db['User'],{'as':'Agents','through':_0xac08('0x11b')});db[_0xac08('0xee')]['hasMany'](db['VoiceExtension'],{'as':_0xac08('0x10a'),'onDelete':_0xac08('0x104')});db[_0xac08('0xee')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x126')});db[_0xac08('0xee')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x1c8'),'as':'Teams'});db[_0xac08('0xf0')]['hasMany'](db[_0xac08('0x103')],{'as':_0xac08('0x171'),'foreignKey':_0xac08('0x115')});db[_0xac08('0xf0')][_0xac08('0x106')](db[_0xac08('0xf2')],{'as':_0xac08('0x1df'),'foreignKey':_0xac08('0x115'),'onDelete':_0xac08('0x104')});db['UserProfileSection'][_0xac08('0x106')](db[_0xac08('0xf3')],{'as':_0xac08('0x1e0'),'foreignKey':_0xac08('0x1e1'),'onDelete':'cascade'});db[_0xac08('0xf6')][_0xac08('0x106')](db[_0xac08('0x7e')],{'as':_0xac08('0x15a'),'foreignKey':_0xac08('0x1e2'),'onDelete':_0xac08('0x104')});db[_0xac08('0xf6')][_0xac08('0x106')](db[_0xac08('0x7c')],{'as':_0xac08('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0xac08('0xf6')][_0xac08('0x106')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0xac08('0x1e2')});db['WhatsappAccount'][_0xac08('0x106')](db[_0xac08('0xf8')],{'as':'Interactions'});db['WhatsappAccount']['hasMany'](db[_0xac08('0x1e3')],{'as':'Applications'});db[_0xac08('0xf6')][_0xac08('0x114')](db['CmList'],{'as':_0xac08('0x15f'),'foreignKey':_0xac08('0x160')});db[_0xac08('0xf6')]['belongsTo'](db[_0xac08('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x135')});db[_0xac08('0x1e3')]['belongsTo'](db[_0xac08('0x103')],{'onDelete':_0xac08('0x158')});db[_0xac08('0x1e3')][_0xac08('0x114')](db[_0xac08('0xfd')],{'onDelete':_0xac08('0x158')});db['WhatsappApplication']['belongsTo'](db[_0xac08('0xf6')],{'onDelete':'restrict'});db[_0xac08('0x1e3')][_0xac08('0x114')](db['Interval'],{'onDelete':_0xac08('0x158'),'foreignKey':_0xac08('0x145')});db['WhatsappApplication']['belongsTo'](db[_0xac08('0x8c')],{'onDelete':_0xac08('0x158'),'foreignKey':'TagId'});db[_0xac08('0xf8')][_0xac08('0x106')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xac08('0x104'),'foreignKey':'WhatsappInteractionId'});db[_0xac08('0xf8')]['belongsTo'](db[_0xac08('0xf6')],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1e2')});db[_0xac08('0xf8')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':'Contact','foreignKey':'ContactId'});db[_0xac08('0xf8')][_0xac08('0x114')](db[_0xac08('0x103')],{'as':'Owner','foreignKey':_0xac08('0x105')});db[_0xac08('0xf8')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x1a4'),'as':_0xac08('0x167')});db[_0xac08('0xf8')][_0xac08('0x116')](db[_0xac08('0x8c')],{'through':_0xac08('0x1a4'),'as':_0xac08('0x168')});db['WhatsappInteraction'][_0xac08('0x116')](db[_0xac08('0x103')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xac08('0x1e4')});db[_0xac08('0x1e5')]['belongsTo'](db[_0xac08('0x103')],{'as':_0xac08('0x103')});db[_0xac08('0x1e5')][_0xac08('0x114')](db[_0xac08('0x119')],{'onDelete':_0xac08('0x104'),'as':'Contact'});db['WhatsappMessage'][_0xac08('0x114')](db[_0xac08('0xf8')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xac08('0x1e4')});db[_0xac08('0x1e5')][_0xac08('0x114')](db['WhatsappAccount'],{'as':_0xac08('0x165'),'foreignKey':_0xac08('0x1e2')});db[_0xac08('0x1e6')][_0xac08('0x114')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0xac08('0x114')](db[_0xac08('0xec')],{'as':'List','foreignKey':_0xac08('0x160')});db[_0xac08('0x1e6')][_0xac08('0x114')](db[_0xac08('0x119')],{'as':_0xac08('0x153'),'foreignKey':_0xac08('0x154')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0xac08('0xfd')],{});db[_0xac08('0x1e6')][_0xac08('0x114')](db[_0xac08('0x1e5')],{});db[_0xac08('0x1e6')][_0xac08('0x114')](db['User'],{});db[_0xac08('0xfb')]['belongsTo'](db[_0xac08('0x1e5')],{});db[_0xac08('0xfb')][_0xac08('0x114')](db[_0xac08('0xf8')],{});db[_0xac08('0xfb')][_0xac08('0x114')](db['WhatsappAccount'],{'foreignKey':_0xac08('0x1e7'),'as':_0xac08('0x1cd')});db[_0xac08('0xfb')][_0xac08('0x114')](db[_0xac08('0xf6')],{'foreignKey':_0xac08('0x1e8'),'as':'ToAccount'});db[_0xac08('0xfb')][_0xac08('0x114')](db['WhatsappQueue'],{'foreignKey':_0xac08('0x1e9'),'as':_0xac08('0x1d0')});db[_0xac08('0xfb')][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d4'),'as':_0xac08('0x1ce')});db['WhatsappTransferReport'][_0xac08('0x114')](db[_0xac08('0x103')],{'foreignKey':_0xac08('0x1d5'),'as':'ToAgent'});db[_0xac08('0xfd')]['belongsToMany'](db[_0xac08('0x103')],{'as':_0xac08('0x14a'),'through':_0xac08('0x34'),'foreignKey':_0xac08('0x1ea')});db[_0xac08('0xfd')][_0xac08('0x116')](db[_0xac08('0x11c')],{'through':_0xac08('0x1c7'),'as':'Teams'});db['UserSetting'][_0xac08('0x114')](db['User'],{'as':_0xac08('0x1eb'),'foreignKey':'UserId','onDelete':_0xac08('0x104'),'hooks':!![]});db[_0xac08('0xfe')][_0xac08('0x159')](db[_0xac08('0xbc')],{'as':_0xac08('0xbc'),'onDelete':_0xac08('0x158')});db[_0xac08('0xfe')]['hasOne'](db[_0xac08('0x35')],{'as':_0xac08('0x1ec'),'onDelete':_0xac08('0x158')});db[_0xac08('0xfe')][_0xac08('0x159')](db[_0xac08('0x156')],{'as':_0xac08('0x1ed'),'onDelete':_0xac08('0x158')});module[_0xac08('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 46495bf..ff42c5a 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e85=['/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/cloudProviders','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','/api/logs','join','root','/apidoc','/www','static','/demo','/snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount'];(function(_0x4698c1,_0xb0ba16){var _0x2aa23a=function(_0x50ee5a){while(--_0x50ee5a){_0x4698c1['push'](_0x4698c1['shift']());}};_0x2aa23a(++_0xb0ba16);}(_0x0e85,0x7c));var _0x50e8=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0e85[_0x4b7895];return _0x264180;};'use strict';var path=require(_0x50e8('0x0'));var express=require(_0x50e8('0x1'));var errors=require('./errors');var config=require(_0x50e8('0x2'));var setupLoggers=require(_0x50e8('0x3'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x236cf3){return setupLoggers(_0x236cf3)['then'](function(){_0x236cf3[_0x50e8('0x4')](_0x50e8('0x5'),require(_0x50e8('0x6')));_0x236cf3[_0x50e8('0x4')]('/api/voice/chanspy',require(_0x50e8('0x7')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x8'),require(_0x50e8('0x9')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xa'),require('./api/voiceExtension'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xb'),require(_0x50e8('0xc')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xd'),require(_0x50e8('0xe')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xf'),require('./api/voiceRecording'));_0x236cf3['use'](_0x50e8('0x10'),require(_0x50e8('0x11')));_0x236cf3['use']('/api/voice/mails',require(_0x50e8('0x12')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x13'),require(_0x50e8('0x14')));_0x236cf3['use'](_0x50e8('0x15'),require(_0x50e8('0x16')));_0x236cf3[_0x50e8('0x4')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x17'),require(_0x50e8('0x18')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x19'),require(_0x50e8('0x1a')));_0x236cf3['use']('/api/members/reports',require(_0x50e8('0x1b')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x1c'),require(_0x50e8('0x1d')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x1e'),require(_0x50e8('0x1f')));_0x236cf3['use'](_0x50e8('0x20'),require('./api/mailServerOut'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x21'),require(_0x50e8('0x22')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x23'),require('./api/mailQueue'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x24'),require('./api/mailSubstatus'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x25'),require('./api/mailInteraction'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x26'),require('./api/mailMessage'));_0x236cf3['use']('/api/mail/applications',require(_0x50e8('0x27')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x28'),require(_0x50e8('0x29')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x2a'),require('./api/dashboard'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x2b'),require('./api/dashboardItem'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x2c'),require(_0x50e8('0x2d')));_0x236cf3[_0x50e8('0x4')]('/api/fax/applications',require(_0x50e8('0x2e')));_0x236cf3['use'](_0x50e8('0x2f'),require(_0x50e8('0x30')));_0x236cf3[_0x50e8('0x4')]('/api/fax/messages',require(_0x50e8('0x31')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x32'),require(_0x50e8('0x33')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x34'),require(_0x50e8('0x35')));_0x236cf3['use'](_0x50e8('0x36'),require(_0x50e8('0x37')));_0x236cf3['use']('/api/sms/applications',require(_0x50e8('0x38')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x39'),require('./api/smsInteraction'));_0x236cf3['use'](_0x50e8('0x3a'),require(_0x50e8('0x3b')));_0x236cf3['use'](_0x50e8('0x3c'),require(_0x50e8('0x3d')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x3e'),require('./api/openchannelAccount'));_0x236cf3[_0x50e8('0x4')]('/api/openchannel/applications',require(_0x50e8('0x3f')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x40'),require('./api/openchannelInteraction'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x41'),require('./api/openchannelMessage'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x42'),require(_0x50e8('0x43')));_0x236cf3[_0x50e8('0x4')]('/api/chat/websites',require(_0x50e8('0x44')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x45'),require(_0x50e8('0x46')));_0x236cf3['use'](_0x50e8('0x47'),require(_0x50e8('0x48')));_0x236cf3[_0x50e8('0x4')]('/api/chat/interactions',require('./api/chatInteraction'));_0x236cf3['use'](_0x50e8('0x49'),require(_0x50e8('0x4a')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x4b'),require(_0x50e8('0x4c')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x4d'),require(_0x50e8('0x4e')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x4f'),require('./api/chatGroup'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x50'),require(_0x50e8('0x51')));_0x236cf3[_0x50e8('0x4')]('/api/cm/companies',require(_0x50e8('0x52')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x53'),require(_0x50e8('0x54')));_0x236cf3[_0x50e8('0x4')]('/api/cm/hopper',require('./api/cmHopper'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x55'),require('./api/cmHopperBlack'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x56'),require(_0x50e8('0x57')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x58'),require(_0x50e8('0x59')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x5a'),require('./api/cmCustomField'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x5b'),require(_0x50e8('0x5c')));_0x236cf3[_0x50e8('0x4')]('/api/automations',require(_0x50e8('0x5d')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x5e'),require(_0x50e8('0x5f')));_0x236cf3['use'](_0x50e8('0x60'),require('./api/disposition'));_0x236cf3['use']('/api/conditions',require(_0x50e8('0x61')));_0x236cf3[_0x50e8('0x4')]('/api/intervals',require(_0x50e8('0x62')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x63'),require(_0x50e8('0x64')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x65'),require('./api/cdr'));_0x236cf3[_0x50e8('0x4')]('/api/voiceQueuesLog',require(_0x50e8('0x66')));_0x236cf3[_0x50e8('0x4')]('/api/schedules',require(_0x50e8('0x67')));_0x236cf3['use'](_0x50e8('0x68'),require(_0x50e8('0x69')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x6a'),require(_0x50e8('0x6b')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x6c'),require(_0x50e8('0x6d')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x6e'),require(_0x50e8('0x6f')));_0x236cf3['use'](_0x50e8('0x70'),require(_0x50e8('0x71')));_0x236cf3['use'](_0x50e8('0x72'),require('./api/integration'));_0x236cf3[_0x50e8('0x4')]('/api/integrations/reports',require(_0x50e8('0x73')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x74'),require(_0x50e8('0x75')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x76'),require(_0x50e8('0x77')));_0x236cf3['use'](_0x50e8('0x78'),require(_0x50e8('0x79')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x7a'),require(_0x50e8('0x7b')));_0x236cf3[_0x50e8('0x4')]('/api/analytics/field_reports',require(_0x50e8('0x7c')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x7d'),require(_0x50e8('0x7e')));_0x236cf3['use'](_0x50e8('0x7f'),require(_0x50e8('0x80')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x81'),require(_0x50e8('0x82')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x83'),require('./api/intSalesforceField'));_0x236cf3['use']('/api/integrations/sugarcrm/accounts',require(_0x50e8('0x84')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x85'),require(_0x50e8('0x86')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x87'),require('./api/intSugarcrmField'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x88'),require(_0x50e8('0x89')));_0x236cf3[_0x50e8('0x4')]('/api/integrations/desk/configurations',require(_0x50e8('0x8a')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x8b'),require(_0x50e8('0x8c')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x8d'),require('./api/intZohoAccount'));_0x236cf3[_0x50e8('0x4')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x236cf3['use'](_0x50e8('0x8e'),require('./api/intZohoField'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x8f'),require(_0x50e8('0x90')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x91'),require(_0x50e8('0x92')));_0x236cf3[_0x50e8('0x4')]('/api/integrations/zendesk/fields',require(_0x50e8('0x93')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x94'),require('./api/intFreshdeskAccount'));_0x236cf3['use']('/api/integrations/freshdesk/configurations',require(_0x50e8('0x95')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x96'),require(_0x50e8('0x97')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x98'),require('./api/intVtigerAccount'));_0x236cf3[_0x50e8('0x4')]('/api/integrations/vtiger/configurations',require(_0x50e8('0x99')));_0x236cf3[_0x50e8('0x4')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x236cf3['use'](_0x50e8('0x9a'),require(_0x50e8('0x9b')));_0x236cf3['use'](_0x50e8('0x9c'),require(_0x50e8('0x9d')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0x9e'),require(_0x50e8('0x9f')));_0x236cf3['use'](_0x50e8('0xa0'),require(_0x50e8('0xa1')));_0x236cf3[_0x50e8('0x4')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xa2'),require(_0x50e8('0xa3')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xa4'),require(_0x50e8('0xa5')));_0x236cf3['use']('/api/integrations/freshsales/configurations',require(_0x50e8('0xa6')));_0x236cf3['use'](_0x50e8('0xa7'),require(_0x50e8('0xa8')));_0x236cf3['use'](_0x50e8('0xa9'),require('./api/network'));_0x236cf3['use']('/api/chat/reports/queue',require(_0x50e8('0xaa')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xab'),require(_0x50e8('0xac')));_0x236cf3['use']('/api/jscripty/answers/reports',require(_0x50e8('0xad')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xae'),require(_0x50e8('0xaf')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xb0'),require(_0x50e8('0xb1')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xb2'),require(_0x50e8('0xb3')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xb4'),require(_0x50e8('0xb5')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xb6'),require(_0x50e8('0xb7')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xb8'),require('./api/jscriptyProject'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xb9'),require(_0x50e8('0xba')));_0x236cf3[_0x50e8('0x4')]('/api/square/odbc',require(_0x50e8('0xbb')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xbc'),require(_0x50e8('0xbd')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xbe'),require('./api/squareRecording'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xbf'),require(_0x50e8('0xc0')));_0x236cf3[_0x50e8('0x4')]('/api/teams',require(_0x50e8('0xc1')));_0x236cf3['use'](_0x50e8('0xc2'),require(_0x50e8('0xc3')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xc4'),require(_0x50e8('0xc5')));_0x236cf3['use'](_0x50e8('0xc6'),require(_0x50e8('0xc7')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xc8'),require(_0x50e8('0xc9')));_0x236cf3[_0x50e8('0x4')]('/api/plugins',require(_0x50e8('0xca')));_0x236cf3[_0x50e8('0x4')]('/api/mail/reports/transfer',require(_0x50e8('0xcb')));_0x236cf3[_0x50e8('0x4')]('/api/chat/reports/transfer',require(_0x50e8('0xcc')));_0x236cf3['use'](_0x50e8('0xcd'),require(_0x50e8('0xce')));_0x236cf3['use'](_0x50e8('0xcf'),require(_0x50e8('0xd0')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xd1'),require('./api/smsTransferReport'));_0x236cf3[_0x50e8('0x4')]('/api/cm/lists',require(_0x50e8('0xd2')));_0x236cf3[_0x50e8('0x4')]('/api/voice/prefixes',require(_0x50e8('0xd3')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xd4'),require(_0x50e8('0xd5')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xd6'),require(_0x50e8('0xd7')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xd8'),require('./api/userProfileResource'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xd9'),require(_0x50e8('0xda')));_0x236cf3['use'](_0x50e8('0xdb'),require(_0x50e8('0xdc')));_0x236cf3[_0x50e8('0x4')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xdd'),require('./api/whatsappInteraction'));_0x236cf3[_0x50e8('0x4')]('/api/whatsapp/messages',require(_0x50e8('0xde')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xdf'),require(_0x50e8('0xe0')));_0x236cf3['use'](_0x50e8('0xe1'),require('./api/whatsappTransferReport'));_0x236cf3[_0x50e8('0x4')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xe2'),require('./api/cloudProvider'));_0x236cf3[_0x50e8('0x4')]('/api/realtime',require(_0x50e8('0xe3')));_0x236cf3['use']('/api/user-settings',require(_0x50e8('0xe4')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xe5'),require(_0x50e8('0xe6')));_0x236cf3['use'](_0x50e8('0xe7'),require('./api/authGoogle'));_0x236cf3['use'](_0x50e8('0xe8'),require(_0x50e8('0xe9')));_0x236cf3[_0x50e8('0x4')]('/api/jira',require('./api/jira'));_0x236cf3['use'](_0x50e8('0xea'),require(_0x50e8('0xeb')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xec'),require(_0x50e8('0xed')));_0x236cf3[_0x50e8('0x4')]('/api/system',require('./api/system'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xee'),require(_0x50e8('0xef')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xf0'),require('./api/webbar'));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xf1'),clientSideLogs);_0x236cf3[_0x50e8('0x4')]('/apidoc',express['static'](path[_0x50e8('0xf2')](config[_0x50e8('0xf3')],_0x50e8('0xf4'))));_0x236cf3['use'](_0x50e8('0xf5'),express[_0x50e8('0xf6')](path['join'](config[_0x50e8('0xf3')],'/www')));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xf7'),express[_0x50e8('0xf6')](path[_0x50e8('0xf2')](config[_0x50e8('0xf3')],_0x50e8('0xf7'))));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xf8'),express[_0x50e8('0xf6')](path['join'](config[_0x50e8('0xf3')],'snippet',_0x50e8('0xf9'))));_0x236cf3[_0x50e8('0x4')](_0x50e8('0xfa'),express[_0x50e8('0xf6')](path[_0x50e8('0xf2')](config[_0x50e8('0xf3')],'/server/files/plugins')));_0x236cf3[_0x50e8('0xfb')](_0x50e8('0xfc'))[_0x50e8('0xfd')](errors[0x194]);_0x236cf3[_0x50e8('0xfb')]('/*')[_0x50e8('0xfd')](function(_0x2c5bee,_0x4182f2){_0x4182f2['sendFile'](path[_0x50e8('0xfe')](_0x236cf3[_0x50e8('0xfd')](_0x50e8('0xff'))+_0x50e8('0x100')));});return _0x236cf3;});}; \ No newline at end of file +var _0x6f47=['/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/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/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','express','./errors','./utils/client-side-logger','./api/client-side-logs','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/interactions','./api/openchannelInteraction'];(function(_0x494ff5,_0x5014e6){var _0x4118f7=function(_0x1c7583){while(--_0x1c7583){_0x494ff5['push'](_0x494ff5['shift']());}};_0x4118f7(++_0x5014e6);}(_0x6f47,0xc7));var _0x76f4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x6f47[_0xf50820];return _0x2a9b10;};'use strict';var path=require('path');var express=require(_0x76f4('0x0'));var errors=require(_0x76f4('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x76f4('0x2'))['setupLoggers'];var clientSideLogs=require(_0x76f4('0x3'));exports['default']=function(_0xe214ad){return setupLoggers(_0xe214ad)[_0x76f4('0x4')](function(){_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6'),require('./api/user'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7'),require(_0x76f4('0x8')));_0xe214ad['use'](_0x76f4('0x9'),require(_0x76f4('0xa')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb'),require(_0x76f4('0xc')));_0xe214ad['use']('/api/voice/mohs',require(_0x76f4('0xd')));_0xe214ad[_0x76f4('0x5')]('/api/voice/queues',require('./api/voiceQueue'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe'),require(_0x76f4('0xf')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x10'),require(_0x76f4('0x11')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x12'),require(_0x76f4('0x13')));_0xe214ad['use'](_0x76f4('0x14'),require(_0x76f4('0x15')));_0xe214ad['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x16'),require(_0x76f4('0x17')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x18'),require(_0x76f4('0x19')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1a'),require(_0x76f4('0x1b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1c'),require(_0x76f4('0x1d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1e'),require(_0x76f4('0x1f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x20'),require(_0x76f4('0x21')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x22'),require(_0x76f4('0x23')));_0xe214ad[_0x76f4('0x5')]('/api/mail/accounts',require(_0x76f4('0x24')));_0xe214ad['use'](_0x76f4('0x25'),require(_0x76f4('0x26')));_0xe214ad[_0x76f4('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0xe214ad['use'](_0x76f4('0x27'),require(_0x76f4('0x28')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x29'),require(_0x76f4('0x2a')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2b'),require('./api/mailApplication'));_0xe214ad['use'](_0x76f4('0x2c'),require('./api/mailQueueReport'));_0xe214ad[_0x76f4('0x5')]('/api/dashboards',require('./api/dashboard'));_0xe214ad['use'](_0x76f4('0x2d'),require(_0x76f4('0x2e')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2f'),require(_0x76f4('0x30')));_0xe214ad[_0x76f4('0x5')]('/api/fax/applications',require(_0x76f4('0x31')));_0xe214ad['use']('/api/fax/interactions',require('./api/faxInteraction'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x32'),require(_0x76f4('0x33')));_0xe214ad[_0x76f4('0x5')]('/api/fax/queues',require(_0x76f4('0x34')));_0xe214ad['use'](_0x76f4('0x35'),require(_0x76f4('0x36')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x37'),require(_0x76f4('0x38')));_0xe214ad['use']('/api/sms/applications',require(_0x76f4('0x39')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3a'),require(_0x76f4('0x3b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3c'),require(_0x76f4('0x3d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3e'),require(_0x76f4('0x3f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x40'),require('./api/openchannelAccount'));_0xe214ad['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x41'),require(_0x76f4('0x42')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x43'),require('./api/openchannelMessage'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x44'),require(_0x76f4('0x45')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x46'),require(_0x76f4('0x47')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x48'),require(_0x76f4('0x49')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4a'),require(_0x76f4('0x4b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4c'),require(_0x76f4('0x4d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4e'),require(_0x76f4('0x4f')));_0xe214ad['use'](_0x76f4('0x50'),require(_0x76f4('0x51')));_0xe214ad[_0x76f4('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0xe214ad[_0x76f4('0x5')]('/api/chat/groups',require(_0x76f4('0x52')));_0xe214ad['use'](_0x76f4('0x53'),require(_0x76f4('0x54')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x55'),require(_0x76f4('0x56')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x57'),require(_0x76f4('0x58')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x59'),require('./api/cmHopper'));_0xe214ad['use'](_0x76f4('0x5a'),require(_0x76f4('0x5b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5c'),require(_0x76f4('0x5d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5e'),require(_0x76f4('0x5f')));_0xe214ad[_0x76f4('0x5')]('/api/cm/custom_fields',require(_0x76f4('0x60')));_0xe214ad[_0x76f4('0x5')]('/api/actions',require('./api/action'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x61'),require(_0x76f4('0x62')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x63'),require('./api/cannedAnswer'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x64'),require(_0x76f4('0x65')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x66'),require(_0x76f4('0x67')));_0xe214ad['use'](_0x76f4('0x68'),require(_0x76f4('0x69')));_0xe214ad[_0x76f4('0x5')]('/api/pauses',require('./api/pause'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6a'),require(_0x76f4('0x6b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6c'),require('./api/voiceQueuesLog'));_0xe214ad['use'](_0x76f4('0x6d'),require('./api/schedule'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6e'),require('./api/sound'));_0xe214ad['use'](_0x76f4('0x6f'),require(_0x76f4('0x70')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x71'),require('./api/template'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x72'),require(_0x76f4('0x73')));_0xe214ad['use'](_0x76f4('0x74'),require(_0x76f4('0x75')));_0xe214ad['use']('/api/integrations',require(_0x76f4('0x76')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x77'),require(_0x76f4('0x78')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/custom_reports',require(_0x76f4('0x79')));_0xe214ad['use'](_0x76f4('0x7a'),require(_0x76f4('0x7b')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/extracted_reports',require(_0x76f4('0x7c')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/metrics',require(_0x76f4('0x7d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7e'),require(_0x76f4('0x7f')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/tree_reports',require(_0x76f4('0x80')));_0xe214ad['use'](_0x76f4('0x81'),require(_0x76f4('0x82')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/salesforce/configurations',require(_0x76f4('0x83')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x84'),require(_0x76f4('0x85')));_0xe214ad['use'](_0x76f4('0x86'),require(_0x76f4('0x87')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x88'),require('./api/intSugarcrmConfiguration'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/sugarcrm/fields',require(_0x76f4('0x89')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8a'),require(_0x76f4('0x8b')));_0xe214ad['use'](_0x76f4('0x8c'),require(_0x76f4('0x8d')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8e'),require('./api/intZohoConfiguration'));_0xe214ad['use'](_0x76f4('0x8f'),require(_0x76f4('0x90')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x91'),require(_0x76f4('0x92')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x93'),require(_0x76f4('0x94')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xe214ad['use'](_0x76f4('0x95'),require(_0x76f4('0x96')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x97'),require('./api/intFreshdeskConfiguration'));_0xe214ad['use'](_0x76f4('0x98'),require('./api/intFreshdeskField'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/vtiger/accounts',require(_0x76f4('0x99')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9a'),require(_0x76f4('0x9b')));_0xe214ad['use'](_0x76f4('0x9c'),require(_0x76f4('0x9d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9e'),require(_0x76f4('0x9f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa0'),require('./api/intServicenowConfiguration'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa1'),require(_0x76f4('0xa2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa3'),require(_0x76f4('0xa4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa5'),require('./api/intDynamics365Configuration'));_0xe214ad['use'](_0x76f4('0xa6'),require(_0x76f4('0xa7')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/freshsales/accounts',require(_0x76f4('0xa8')));_0xe214ad['use'](_0x76f4('0xa9'),require(_0x76f4('0xaa')));_0xe214ad['use'](_0x76f4('0xab'),require(_0x76f4('0xac')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xad'),require(_0x76f4('0xae')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xaf'),require(_0x76f4('0xb0')));_0xe214ad[_0x76f4('0x5')]('/api/chat/internal/messages',require(_0x76f4('0xb1')));_0xe214ad['use'](_0x76f4('0xb2'),require(_0x76f4('0xb3')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb4'),require(_0x76f4('0xb5')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb6'),require(_0x76f4('0xb7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb8'),require('./api/smsQueueReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb9'),require('./api/squareReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xba'),require(_0x76f4('0xbb')));_0xe214ad['use'](_0x76f4('0xbc'),require(_0x76f4('0xbd')));_0xe214ad[_0x76f4('0x5')]('/api/settings',require(_0x76f4('0xbe')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xbf'),require(_0x76f4('0xc0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc1'),require(_0x76f4('0xc2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc3'),require('./api/squareRecording'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc4'),require(_0x76f4('0xc5')));_0xe214ad[_0x76f4('0x5')]('/api/teams',require(_0x76f4('0xc6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc7'),require('./api/license'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc8'),require(_0x76f4('0xc9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xca'),require('./api/migration'));_0xe214ad[_0x76f4('0x5')]('/api/attachments',require(_0x76f4('0xcb')));_0xe214ad[_0x76f4('0x5')]('/api/plugins',require('./api/plugin'));_0xe214ad['use'](_0x76f4('0xcc'),require(_0x76f4('0xcd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xce'),require(_0x76f4('0xcf')));_0xe214ad[_0x76f4('0x5')]('/api/fax/reports/transfer',require(_0x76f4('0xd0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd1'),require(_0x76f4('0xd2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd3'),require(_0x76f4('0xd4')));_0xe214ad[_0x76f4('0x5')]('/api/cm/lists',require(_0x76f4('0xd5')));_0xe214ad['use'](_0x76f4('0xd6'),require(_0x76f4('0xd7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd8'),require(_0x76f4('0xd9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xda'),require(_0x76f4('0xdb')));_0xe214ad['use'](_0x76f4('0xdc'),require('./api/userProfileResource'));_0xe214ad['use']('/api/userNotifications',require(_0x76f4('0xdd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xde'),require(_0x76f4('0xdf')));_0xe214ad['use'](_0x76f4('0xe0'),require(_0x76f4('0xe1')));_0xe214ad[_0x76f4('0x5')]('/api/whatsapp/interactions',require(_0x76f4('0xe2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe3'),require(_0x76f4('0xe4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe5'),require(_0x76f4('0xe6')));_0xe214ad['use'](_0x76f4('0xe7'),require(_0x76f4('0xe8')));_0xe214ad['use'](_0x76f4('0xe9'),require(_0x76f4('0xea')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xeb'),require(_0x76f4('0xec')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xed'),require(_0x76f4('0xee')));_0xe214ad[_0x76f4('0x5')]('/api/user-settings',require(_0x76f4('0xef')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf0'),require(_0x76f4('0xf1')));_0xe214ad['use'](_0x76f4('0xf2'),require('./api/authGoogle'));_0xe214ad[_0x76f4('0x5')]('/api/auth/activedirectory',require(_0x76f4('0xf3')));_0xe214ad[_0x76f4('0x5')]('/api/jira',require('./api/jira'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf4'),require(_0x76f4('0xf5')));_0xe214ad['use']('/api/version',require(_0x76f4('0xf6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf7'),require(_0x76f4('0xf8')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf9'),require(_0x76f4('0xfa')));_0xe214ad[_0x76f4('0x5')]('/api/webbar',require('./api/webbar'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xfb'),clientSideLogs);_0xe214ad[_0x76f4('0x5')]('/apidoc',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0xff'))));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x100'),express[_0x76f4('0xfc')](path['join'](config[_0x76f4('0xfe')],_0x76f4('0x100'))));_0xe214ad[_0x76f4('0x5')]('/demo',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0x101'))));_0xe214ad['use'](_0x76f4('0x102'),express['static'](path[_0x76f4('0xfd')](config['root'],_0x76f4('0x103'),_0x76f4('0x104'))));_0xe214ad[_0x76f4('0x5')]('/plugins',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],'/server/files/plugins')));_0xe214ad[_0x76f4('0x105')](_0x76f4('0x106'))['get'](errors[0x194]);_0xe214ad['route']('/*')[_0x76f4('0x107')](function(_0x39afa3,_0x515cfe){_0x515cfe['sendFile'](path[_0x76f4('0x108')](_0xe214ad[_0x76f4('0x107')]('appPath')+_0x76f4('0x109')));});return _0xe214ad;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4342727..a4abe4f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74f3=['../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','../api/user/user.rpc','merge','../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/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc'];(function(_0x45382c,_0x4c17fb){var _0x3ecd5c=function(_0x362d18){while(--_0x362d18){_0x45382c['push'](_0x45382c['shift']());}};_0x3ecd5c(++_0x4c17fb);}(_0x74f3,0x10c));var _0x374f=function(_0x2e49da,_0x36472a){_0x2e49da=_0x2e49da-0x0;var _0x987c54=_0x74f3[_0x2e49da];return _0x987c54;};'use strict';var jayson=require(_0x374f('0x0'));var _=require(_0x374f('0x1'));var config=require('../config/environment');exports[_0x374f('0x2')]=function(){return new Promise(function(_0x181355,_0x32a39a){var _0x5e2647={};_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x3')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/voiceExtension/voiceExtension.rpc'));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x5')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x6')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x7')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x8')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x9')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0xa')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0xb')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0xc')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0xd')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0xe')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0xf')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x10')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x11')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x12')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x13')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x14')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/faxAccount/faxAccount.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x15')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x16')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x17')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x18')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x19')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/smsAccount/smsAccount.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x1a')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x1b')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x1c')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x1d')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x1e')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x1f')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x20')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x21')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x22')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x23')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x24')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x25')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x26')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x27')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x28')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x29')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/interval/interval.rpc'));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x2a')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x2b')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x2c')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x2d')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x2e')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x2f')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x30')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x31')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x32')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x33')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x34')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x35')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x36')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x37')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x38')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x39')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x3a')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/setting/setting.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x3b')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x3c')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x3d')));_0x5e2647=_['merge'](_0x5e2647,require('../api/squareMessage/squareMessage.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x3e')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/attachment/attachment.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x3f')));_0x5e2647=_['merge'](_0x5e2647,require(_0x374f('0x40')));_0x5e2647=_['merge'](_0x5e2647,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x41')));_0x5e2647=_[_0x374f('0x4')](_0x5e2647,require(_0x374f('0x42')));var _0xaecc46=jayson[_0x374f('0x43')](_0x5e2647)[_0x374f('0x44')]();var _0x3f33d5=config['rpc'][_0x374f('0x45')]||config[_0x374f('0x45')]+0x1;var _0x1e34f9=config[_0x374f('0x46')]['ip']||_0x374f('0x47');_0xaecc46['on']('error',function(_0xac7952){return _0x32a39a(_0xac7952);});_0xaecc46[_0x374f('0x2')](_0x3f33d5,_0x1e34f9,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1e34f9,_0x3f33d5);require('../config/triggers')[_0x374f('0x48')]();return _0x181355(_0x374f('0x49')+_0x1e34f9+':'+_0x3f33d5);});});}; \ No newline at end of file +var _0xba92=['../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x2481f9,_0x786f4d){var _0x58ed9f=function(_0x13b675){while(--_0x13b675){_0x2481f9['push'](_0x2481f9['shift']());}};_0x58ed9f(++_0x786f4d);}(_0xba92,0x105));var _0x2ba9=function(_0x485c04,_0x459615){_0x485c04=_0x485c04-0x0;var _0xa516ae=_0xba92[_0x485c04];return _0xa516ae;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2ba9('0x0'));var config=require('../config/environment');exports[_0x2ba9('0x1')]=function(){return new Promise(function(_0x2bd971,_0x37d471){var _0x1d83ee={};_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x3')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/voiceExtension/voiceExtension.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x4')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x5')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x6')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x7')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x8')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x9')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xa')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xb')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xc')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xd')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/mailInteraction/mailInteraction.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0xe')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/mailApplication/mailApplication.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0xf')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x10')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x11')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x12')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/faxMessage/faxMessage.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x13')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x14')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x15')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x16')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x17')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/smsQueue/smsQueue.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x18')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x19')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1a')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/chatInteraction/chatInteraction.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1b')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1c')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x1d')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/cmHopper/cmHopper.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1e')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x1f')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x20')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x21')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x22')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x23')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x24')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/trigger/trigger.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x25')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x26')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x27')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x28')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x29')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2a')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2b')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2c')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2d')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x2e')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x2f')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x30')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x31')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/setting/setting.rpc'));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x32')));_0x1d83ee=_['merge'](_0x1d83ee,require('../api/squareProject/squareProject.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x33')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require('../api/squareMessage/squareMessage.rpc'));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x34')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x35')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x36')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x37')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x38')));_0x1d83ee=_[_0x2ba9('0x2')](_0x1d83ee,require(_0x2ba9('0x39')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x3a')));_0x1d83ee=_['merge'](_0x1d83ee,require(_0x2ba9('0x3b')));var _0x28bf52=jayson['server'](_0x1d83ee)[_0x2ba9('0x3c')]();var _0xad71ab=config[_0x2ba9('0x3d')][_0x2ba9('0x3e')]||config[_0x2ba9('0x3e')]+0x1;var _0x3a00b7=config[_0x2ba9('0x3d')]['ip']||_0x2ba9('0x3f');_0x28bf52['on'](_0x2ba9('0x40'),function(_0x199502){return _0x37d471(_0x199502);});_0x28bf52['listen'](_0xad71ab,_0x3a00b7,function(){console[_0x2ba9('0x41')](_0x2ba9('0x42'),_0x3a00b7,_0xad71ab);require(_0x2ba9('0x43'))[_0x2ba9('0x44')]();return _0x2bd971(_0x2ba9('0x45')+_0x3a00b7+':'+_0xad71ab);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 36a65e8..85011c8 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 _0x7fd5=['AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','split','length','match','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sync','answer','getData','sendRequest','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x7fd5,0xa0));var _0x57fd=function(_0x21a0c5,_0x586032){_0x21a0c5=_0x21a0c5-0x0;var _0x13d439=_0x7fd5[_0x21a0c5];return _0x13d439;};'use strict';var util=require(_0x57fd('0x0'));var _=require(_0x57fd('0x1'));var EventEmitter=require(_0x57fd('0x2'))[_0x57fd('0x3')];var AGIReply=require(_0x57fd('0x4'));var AGIError=require(_0x57fd('0x5'));function AGIChannel(_0x5a464b){var _0x1c7ceb=this,_0x312cb8=new AGIReply(),_0x6572cc=![],_0x3d08f7={};EventEmitter[_0x57fd('0x6')](_0x1c7ceb);_0x5a464b[_0x57fd('0x7')](_0x57fd('0x8'));_0x5a464b[_0x57fd('0x9')](0x8*0x3c*0x3c*0x3e8);_0x312cb8[_0x57fd('0x7')](_0x57fd('0x8'));_0x312cb8['on'](_0x57fd('0xa'),function(_0x21a87f){for(var _0x4f67c2 in _0x21a87f){_0x1c7ceb[_0x4f67c2]=_0x21a87f[_0x4f67c2];}_0x1c7ceb[_0x57fd('0xb')]('ready');});_0x312cb8['on'](_0x57fd('0xc'),function(_0x3ad7a9){if(_0x3ad7a9[_0x57fd('0xd')]()==_0x57fd('0xe')){_0x1c7ceb['emit'](_0x57fd('0xe'));return;}if(_0x3ad7a9[_0x57fd('0xf')](0x0,0xb)==_0x57fd('0x10')){_0x6572cc=!![];}if(_0x6572cc){_0x3d08f7['rx']+=_0x3ad7a9+'\x0a';if(_0x3ad7a9[_0x57fd('0x11')]('520\x20End\x20of\x20proper')!=-0x1){_0x6572cc=![];}}else{_0x3d08f7['rx']=_0x3ad7a9;}if(_0x6572cc){return;}if(typeof _0x3d08f7['cb']==_0x57fd('0x12')){var _0x4e574b=_0x3d08f7['rx'][_0x57fd('0xf')](0x0,0x3),_0x58c94f=null,_0x254104=null;_0x4e574b=parseInt(_0x4e574b);if(isNaN(_0x4e574b)){_0x3d08f7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x57fd('0x13')});return;}if(_0x4e574b!=0xc8){_0x3d08f7['cb'](null,{'code':_0x4e574b,'result':-0x1,'extra':'KO'});return;}_0x58c94f=_0x3d08f7['rx']['substring'](0x4)[_0x57fd('0x14')](_0x57fd('0x15'),'');if(_0x58c94f[_0x57fd('0x16')]('\x20')!=-0x1){_0x58c94f=_0x58c94f[_0x57fd('0x17')](0x0,_0x58c94f[_0x57fd('0x16')]('\x20'));}if(_['startsWith'](_0x58c94f,'-1')){_0x58c94f=parseInt(_0x58c94f);}_0x254104=_0x3d08f7['rx'][_0x57fd('0x18')]('\x20');if(_0x254104['length']==0x3){_0x254104=_0x254104[0x2][_0x57fd('0xf')](0x1,_0x254104[0x2][_0x57fd('0x19')]-0x1);}else if(_0x254104[_0x57fd('0x19')]>0x3){var _0x4a4933=/\((.+)\)/;var _0x2a77c9=_0x3d08f7['rx'][_0x57fd('0x1a')](_0x4a4933);if(_0x2a77c9){_0x254104=_0x2a77c9[0x1];}else{_0x254104=null;}}else{_0x254104=null;}_0x3d08f7['cb'](null,{'code':_0x4e574b,'result':_0x58c94f,'extra':_0x254104});}});_0x5a464b['on']('error',function(_0x183308){_0x1c7ceb[_0x57fd('0xb')]('error',new AGIError(_0x57fd('0x1b'),_0x183308['code']));});_0x5a464b['on'](_0x57fd('0x1c'),function(){_0x1c7ceb[_0x57fd('0xb')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x5a464b['on'](_0x57fd('0x1d'),function(){_0x1c7ceb[_0x57fd('0xb')](_0x57fd('0x1d'),new AGIError(_0x57fd('0x1e')));_0x5a464b[_0x57fd('0x1f')]();});_0x5a464b[_0x57fd('0x20')](_0x312cb8);this[_0x57fd('0x21')]=function(_0x4a981c,_0x729e5f){var _0x4a981c=_0x4a981c||'',_0x729e5f=typeof _0x729e5f==_0x57fd('0x12')?_0x729e5f:new Function();_0x3d08f7={'tx':_0x4a981c,'rx':'','cb':_0x729e5f};_0x5a464b[_0x57fd('0x22')](_0x4a981c+'\x0a');},this[_0x57fd('0x1c')]=function(){_0x5a464b[_0x57fd('0x1f')]();};}util[_0x57fd('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x57fd('0x24')]['sendRequest']=function(_0x96bc23){return this[_0x57fd('0x21')][_0x57fd('0x25')](this,_0x96bc23);};AGIChannel[_0x57fd('0x24')][_0x57fd('0x26')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x57fd('0x24')][_0x57fd('0x27')]=function(_0x502f3a,_0xce80a3,_0x4166d6){_0x502f3a=_0x502f3a===undefined?'beep':_0x502f3a;_0xce80a3=_0xce80a3===undefined?'5':_0xce80a3;_0x4166d6=_0x4166d6===undefined?'1':_0x4166d6;return this[_0x57fd('0x28')](util[_0x57fd('0x29')](_0x57fd('0x2a'),_0x502f3a,_0xce80a3*0x3e8,_0x4166d6));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x2b')]=function(_0x3531de){_0x3531de=_0x3531de||_0x57fd('0x2c');return this[_0x57fd('0x28')](util[_0x57fd('0x29')](_0x57fd('0x2d'),_0x3531de));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x2e')]=function(_0x10fb90,_0x38b804){if(_['isArray'](_0x38b804)){return this[_0x57fd('0x28')](util['format'](_0x57fd('0x2f'),_0x10fb90,_0x38b804[_0x57fd('0x30')](',')));}return this[_0x57fd('0x28')](util[_0x57fd('0x29')](_0x57fd('0x2f'),_0x10fb90,_0x38b804));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x31')]=function(_0x13b82d){return this['sendRequest'](util[_0x57fd('0x29')]('SET\x20CONTEXT\x20%s',_0x13b82d));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x32')]=function(_0x1a7541){return this[_0x57fd('0x28')](util[_0x57fd('0x29')](_0x57fd('0x33'),_0x1a7541));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x34')]=function(_0x537f3d){return this[_0x57fd('0x28')](util[_0x57fd('0x29')](_0x57fd('0x35'),_0x537f3d));};AGIChannel[_0x57fd('0x24')][_0x57fd('0xe')]=function(){return this[_0x57fd('0x28')](_0x57fd('0x36'));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x37')]=function(_0x47aaaa,_0x496e93){var _0x824aec=_[_0x57fd('0x38')](_0x496e93)||_['isNumber'](_0x496e93)?_0x496e93[_0x57fd('0x39')]():_0x496e93;return this['sendRequest'](util[_0x57fd('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x47aaaa,_0x824aec?_0x824aec[_0x57fd('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x3a')]=function(_0x1359b2,_0x2d12cb){return this['sendRequest'](util[_0x57fd('0x29')](_0x57fd('0x3b'),_0x1359b2,_0x2d12cb));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x3c')]=function(_0x550013,_0x3f1df3){return this['sendRequest'](util[_0x57fd('0x29')](_0x57fd('0x3d'),_0x550013,_0x3f1df3));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x3e')]=function(_0xe4e904,_0x51046c){return this[_0x57fd('0x28')](util[_0x57fd('0x29')](_0x57fd('0x3f'),_0xe4e904,_0x51046c));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x40')]=function(_0x4fd3d9,_0xea1179,_0x52b37f){_0xea1179=_0xea1179||this[_0x57fd('0x41')];_0x52b37f=_0x52b37f||0x1;this[_0x57fd('0x31')](_0x4fd3d9);this[_0x57fd('0x32')](_0xea1179);this[_0x57fd('0x34')](_0x52b37f);return this['noop'](util[_0x57fd('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x4fd3d9,_0xea1179,_0x52b37f));};AGIChannel['prototype'][_0x57fd('0x42')]=function(_0x11449f){return this[_0x57fd('0x28')](util[_0x57fd('0x29')](_0x57fd('0x43'),_0x11449f));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x44')]=function(_0x16629e,_0x25a083,_0x4404a3,_0x466265,_0x4fb1b5,_0x308a9d){_0x25a083=_0x25a083||_0x57fd('0x45');_0x4404a3=_0x4404a3||'';_0x466265=_0x466265===undefined?-0x1:_0x466265==='-1'?-0x1:_0x466265*0x3e8;_0x4fb1b5=_0x4fb1b5===undefined?'':'s='+_0x4fb1b5;_0x308a9d=_0x308a9d?'BEEP':'';return this[_0x57fd('0x28')](util[_0x57fd('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x16629e,_0x25a083,_0x4404a3,_0x466265,_0x308a9d,_0x4fb1b5));};AGIChannel[_0x57fd('0x24')][_0x57fd('0x46')]=function(_0x115453,_0x31b105){_0x31b105=_0x31b105||'';return this[_0x57fd('0x28')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x115453,_0x31b105));};AGIChannel[_0x57fd('0x24')]['agi']=function(_0x3e5836){return this['exec'](_0x57fd('0x47'),_0x3e5836);};AGIChannel[_0x57fd('0x24')][_0x57fd('0x48')]=function(_0x4d36c0){return this[_0x57fd('0x2e')](_0x57fd('0x49'),_0x4d36c0);};AGIChannel[_0x57fd('0x24')]['error']=function(_0xd11215,_0x338a7f){this[_0x57fd('0x2b')](util[_0x57fd('0x29')](_0x57fd('0x4a'),_0xd11215['id'],_0xd11215[_0x57fd('0x4b')],_0x338a7f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x57fd('0x4c')]=AGIChannel; \ No newline at end of file +var _0x980e=['setTimeout','setEncoding','utf8','headers','ready','line','hangup','emit','substring','520-Invalid','no\x20code','replace','result=','indexOf','substr','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','destroy','prototype','sync','sendRequest','ANSWER','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','format','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./error','call'];(function(_0x4dcf1d,_0x491ea1){var _0x773104=function(_0x4f45c9){while(--_0x4f45c9){_0x4dcf1d['push'](_0x4dcf1d['shift']());}};_0x773104(++_0x491ea1);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe980('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0xe980('0x1')];var AGIReply=require('./reply');var AGIError=require(_0xe980('0x2'));function AGIChannel(_0x53cd36){var _0x2e82ea=this,_0x274b04=new AGIReply(),_0x599c53=![],_0x4eb599={};EventEmitter[_0xe980('0x3')](_0x2e82ea);_0x53cd36['setEncoding']('utf8');_0x53cd36[_0xe980('0x4')](0x8*0x3c*0x3c*0x3e8);_0x274b04[_0xe980('0x5')](_0xe980('0x6'));_0x274b04['on'](_0xe980('0x7'),function(_0x2d76d0){for(var _0x44995d in _0x2d76d0){_0x2e82ea[_0x44995d]=_0x2d76d0[_0x44995d];}_0x2e82ea['emit'](_0xe980('0x8'));});_0x274b04['on'](_0xe980('0x9'),function(_0x323b26){if(_0x323b26['toLowerCase']()==_0xe980('0xa')){_0x2e82ea[_0xe980('0xb')](_0xe980('0xa'));return;}if(_0x323b26[_0xe980('0xc')](0x0,0xb)==_0xe980('0xd')){_0x599c53=!![];}if(_0x599c53){_0x4eb599['rx']+=_0x323b26+'\x0a';if(_0x323b26['search']('520\x20End\x20of\x20proper')!=-0x1){_0x599c53=![];}}else{_0x4eb599['rx']=_0x323b26;}if(_0x599c53){return;}if(typeof _0x4eb599['cb']=='function'){var _0x23c9cc=_0x4eb599['rx']['substring'](0x0,0x3),_0x234b1b=null,_0x58c367=null;_0x23c9cc=parseInt(_0x23c9cc);if(isNaN(_0x23c9cc)){_0x4eb599['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe980('0xe')});return;}if(_0x23c9cc!=0xc8){_0x4eb599['cb'](null,{'code':_0x23c9cc,'result':-0x1,'extra':'KO'});return;}_0x234b1b=_0x4eb599['rx'][_0xe980('0xc')](0x4)[_0xe980('0xf')](_0xe980('0x10'),'');if(_0x234b1b[_0xe980('0x11')]('\x20')!=-0x1){_0x234b1b=_0x234b1b[_0xe980('0x12')](0x0,_0x234b1b[_0xe980('0x11')]('\x20'));}if(_['startsWith'](_0x234b1b,'-1')){_0x234b1b=parseInt(_0x234b1b);}_0x58c367=_0x4eb599['rx']['split']('\x20');if(_0x58c367['length']==0x3){_0x58c367=_0x58c367[0x2][_0xe980('0xc')](0x1,_0x58c367[0x2][_0xe980('0x13')]-0x1);}else if(_0x58c367[_0xe980('0x13')]>0x3){var _0x406418=/\((.+)\)/;var _0x29593c=_0x4eb599['rx']['match'](_0x406418);if(_0x29593c){_0x58c367=_0x29593c[0x1];}else{_0x58c367=null;}}else{_0x58c367=null;}_0x4eb599['cb'](null,{'code':_0x23c9cc,'result':_0x234b1b,'extra':_0x58c367});}});_0x53cd36['on'](_0xe980('0x14'),function(_0x1c6354){_0x2e82ea[_0xe980('0xb')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x1c6354[_0xe980('0x15')]));});_0x53cd36['on'](_0xe980('0x16'),function(){_0x2e82ea[_0xe980('0xb')](_0xe980('0x16'),new AGIError(_0xe980('0x17')));});_0x53cd36['on'](_0xe980('0x18'),function(){_0x2e82ea[_0xe980('0xb')](_0xe980('0x18'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x53cd36['destroy']();});_0x53cd36[_0xe980('0x19')](_0x274b04);this[_0xe980('0x1a')]=function(_0x1bd7ea,_0x4f929f){var _0x1bd7ea=_0x1bd7ea||'',_0x4f929f=typeof _0x4f929f=='function'?_0x4f929f:new Function();_0x4eb599={'tx':_0x1bd7ea,'rx':'','cb':_0x4f929f};_0x53cd36[_0xe980('0x1b')](_0x1bd7ea+'\x0a');},this[_0xe980('0x16')]=function(){_0x53cd36[_0xe980('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xe980('0x1d')]['sendRequest']=function(_0x2a87e3){return this[_0xe980('0x1a')][_0xe980('0x1e')](this,_0x2a87e3);};AGIChannel[_0xe980('0x1d')]['answer']=function(){return this[_0xe980('0x1f')](_0xe980('0x20'));};AGIChannel[_0xe980('0x1d')]['getData']=function(_0x54e755,_0x1628bd,_0x138a75){_0x54e755=_0x54e755===undefined?'beep':_0x54e755;_0x1628bd=_0x1628bd===undefined?'5':_0x1628bd;_0x138a75=_0x138a75===undefined?'1':_0x138a75;return this[_0xe980('0x1f')](util['format'](_0xe980('0x21'),_0x54e755,_0x1628bd*0x3e8,_0x138a75));};AGIChannel[_0xe980('0x1d')][_0xe980('0x22')]=function(_0x3ef831){_0x3ef831=_0x3ef831||_0xe980('0x23');return this[_0xe980('0x1f')](util['format'](_0xe980('0x24'),_0x3ef831));};AGIChannel['prototype'][_0xe980('0x25')]=function(_0x24a29e,_0x421ef9){if(_[_0xe980('0x26')](_0x421ef9)){return this[_0xe980('0x1f')](util['format']('EXEC\x20%s\x20%s',_0x24a29e,_0x421ef9[_0xe980('0x27')](',')));}return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x29'),_0x24a29e,_0x421ef9));};AGIChannel[_0xe980('0x1d')][_0xe980('0x2a')]=function(_0x3d2fb1){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x2b'),_0x3d2fb1));};AGIChannel[_0xe980('0x1d')]['setExtension']=function(_0x4a8bbe){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x2c'),_0x4a8bbe));};AGIChannel['prototype'][_0xe980('0x2d')]=function(_0x4b9586){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x2e'),_0x4b9586));};AGIChannel[_0xe980('0x1d')][_0xe980('0xa')]=function(){return this[_0xe980('0x1f')](_0xe980('0x2f'));};AGIChannel[_0xe980('0x1d')]['setVariable']=function(_0x5a4d44,_0x2d3ef7){var _0x2625cf=_['isBoolean'](_0x2d3ef7)||_[_0xe980('0x30')](_0x2d3ef7)?_0x2d3ef7['toString']():_0x2d3ef7;return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x31'),_0x5a4d44,_0x2625cf?_0x2625cf[_0xe980('0x32')]()[_0xe980('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe980('0x1d')]['sayNumber']=function(_0x11fb5b,_0x1f16c7){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x33'),_0x11fb5b,_0x1f16c7));};AGIChannel['prototype'][_0xe980('0x34')]=function(_0x1f35ed,_0x1faffe){return this['sendRequest'](util[_0xe980('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x1f35ed,_0x1faffe));};AGIChannel[_0xe980('0x1d')][_0xe980('0x35')]=function(_0x577d17,_0x5f0958){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x36'),_0x577d17,_0x5f0958));};AGIChannel[_0xe980('0x1d')][_0xe980('0x37')]=function(_0x1368d6,_0x5c5d5a,_0x30b359){_0x5c5d5a=_0x5c5d5a||this[_0xe980('0x38')];_0x30b359=_0x30b359||0x1;this[_0xe980('0x2a')](_0x1368d6);this['setExtension'](_0x5c5d5a);this[_0xe980('0x2d')](_0x30b359);return this[_0xe980('0x22')](util[_0xe980('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x1368d6,_0x5c5d5a,_0x30b359));};AGIChannel[_0xe980('0x1d')][_0xe980('0x39')]=function(_0x528161){return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x3a'),_0x528161));};AGIChannel[_0xe980('0x1d')][_0xe980('0x3b')]=function(_0x2e0f32,_0x556937,_0x124d0c,_0x1c6853,_0x1e04c2,_0x1619c5){_0x556937=_0x556937||'wav';_0x124d0c=_0x124d0c||'';_0x1c6853=_0x1c6853===undefined?-0x1:_0x1c6853==='-1'?-0x1:_0x1c6853*0x3e8;_0x1e04c2=_0x1e04c2===undefined?'':'s='+_0x1e04c2;_0x1619c5=_0x1619c5?_0xe980('0x3c'):'';return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x3d'),_0x2e0f32,_0x556937,_0x124d0c,_0x1c6853,_0x1619c5,_0x1e04c2));};AGIChannel[_0xe980('0x1d')][_0xe980('0x3e')]=function(_0x572095,_0x30855d){_0x30855d=_0x30855d||'';return this[_0xe980('0x1f')](util[_0xe980('0x28')](_0xe980('0x3f'),_0x572095,_0x30855d));};AGIChannel[_0xe980('0x1d')][_0xe980('0x40')]=function(_0x45a918){return this[_0xe980('0x25')](_0xe980('0x41'),_0x45a918);};AGIChannel[_0xe980('0x1d')][_0xe980('0x42')]=function(_0x39dd69){return this[_0xe980('0x25')](_0xe980('0x43'),_0x39dd69);};AGIChannel['prototype']['error']=function(_0x8b1e4,_0x40b9da){this[_0xe980('0x22')](util['format'](_0xe980('0x44'),_0x8b1e4['id'],_0x8b1e4[_0xe980('0x45')],_0x40b9da));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe980('0x46')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index fa491a9..a2035db 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 _0x0d16=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x2c13c0,_0xecf707){var _0x5ed96d=function(_0x2c4bd8){while(--_0x2c4bd8){_0x2c13c0['push'](_0x2c13c0['shift']());}};_0x5ed96d(++_0xecf707);}(_0x0d16,0x170));var _0x60d1=function(_0x469f57,_0x421e35){_0x469f57=_0x469f57-0x0;var _0x305223=_0x0d16[_0x469f57];return _0x305223;};'use strict';var util=require(_0x60d1('0x0'));var error={'E_AGI_UNDEFINED':_0x60d1('0x1'),'E_AGI_ARGUMENT_PORT':_0x60d1('0x2'),'E_AGI_SERVER_ERROR':_0x60d1('0x3'),'E_AGI_SERVER_CLOSE':_0x60d1('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x60d1('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x60d1('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x60d1('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x60d1('0x8'),'E_AGI_COMMAND_EMPTY':_0x60d1('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x60d1('0xa'),'E_AGI_IVR_ENTRY':_0x60d1('0xb')};function AGIError(_0x33b971){var _0x33b971=_0x33b971||null,_0x339edf=_0x339edf||[],_0x4f7c38=0x1,_0x395c34='';if(!error[_0x33b971]){_0x33b971=_0x60d1('0xc');}_0x339edf[_0x60d1('0xd')](error[_0x33b971]);while(arguments[_0x4f7c38]){_0x339edf[_0x60d1('0xd')](arguments[_0x4f7c38]);_0x4f7c38++;}_0x395c34=util[_0x60d1('0xe')][_0x60d1('0xf')](util,_0x339edf);this[_0x60d1('0x10')]=_0x395c34;this['name']=_0x33b971;}module[_0x60d1('0x11')]=AGIError; \ No newline at end of file +var _0x98b8=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','exports','util'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x98b8,0xe0));var _0x898b=function(_0x350e9b,_0x42df13){_0x350e9b=_0x350e9b-0x0;var _0x4131d1=_0x98b8[_0x350e9b];return _0x4131d1;};'use strict';var util=require(_0x898b('0x0'));var error={'E_AGI_UNDEFINED':_0x898b('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x898b('0x2'),'E_AGI_SERVER_CLOSE':_0x898b('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x898b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x898b('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x898b('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x898b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x898b('0x8'),'E_AGI_IVR_ENTRY':_0x898b('0x9')};function AGIError(_0x2456de){var _0x2456de=_0x2456de||null,_0xfa49d1=_0xfa49d1||[],_0x4a500f=0x1,_0x5de2c2='';if(!error[_0x2456de]){_0x2456de=_0x898b('0xa');}_0xfa49d1['push'](error[_0x2456de]);while(arguments[_0x4a500f]){_0xfa49d1[_0x898b('0xb')](arguments[_0x4a500f]);_0x4a500f++;}_0x5de2c2=util['format']['apply'](util,_0xfa49d1);this[_0x898b('0xc')]=_0x5de2c2;this[_0x898b('0xd')]=_0x2456de;}module[_0x898b('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 968ff04..662ee22 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 _0x5351=['agicommand','vswitch','target','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','menu','getdigits','vertices','edges','prototype','addEdge','push','numberOfEdges','size','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split'];(function(_0x8969c5,_0x5b3c48){var _0x1913de=function(_0x2c82c3){while(--_0x2c82c3){_0x8969c5['push'](_0x8969c5['shift']());}};_0x1913de(++_0x5b3c48);}(_0x5351,0x140));var _0x1535=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5351[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1535('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0x1535('0x1'),_0x1535('0x2'),'getsecretdigits'];var Graph=function(){this[_0x1535('0x3')]={};this[_0x1535('0x4')]={};this['numberOfEdges']=0x0;};Graph['prototype']['addVertex']=function(_0x2908c9){this[_0x1535('0x3')][_0x2908c9['id']]=_0x2908c9;this[_0x1535('0x4')][_0x2908c9['id']]=[];};Graph[_0x1535('0x5')][_0x1535('0x6')]=function(_0x5d6c4a,_0x41793b,_0x10a794){this[_0x1535('0x4')][_0x5d6c4a][_0x1535('0x7')]({'target':_0x41793b,'condition':_0x10a794});this[_0x1535('0x8')]+=0x1;};Graph['prototype'][_0x1535('0x9')]=function(){return _[_0x1535('0x9')](this[_0x1535('0x3')]);};Graph['prototype']['relations']=function(){return this[_0x1535('0x8')];};Graph[_0x1535('0x5')][_0x1535('0xa')]=function(_0x316bf5){return this[_0x1535('0x3')][_0x316bf5];};Graph[_0x1535('0x5')]['traverseBFS']=function(_0x25b621,_0x57e65e){if(!this['vertices'][_0x25b621]){return logger[_0x1535('0xb')](_0x1535('0xc'));}var _0x81cced=_0x57e65e(this[_0x1535('0x3')][_0x25b621]);if(!_0x81cced){return logger[_0x1535('0xb')](_0x1535('0xd'));}if(this[_0x1535('0x4')][_0x25b621][_0x1535('0xe')]===0x0){return logger[_0x1535('0xb')](_0x1535('0xf'));}for(var _0x2d3ab8=0x0,_0x5f462f=[],_0x1a08a9=![];_0x2d3ab8\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','toJson','mxGraphModel','root','retry','maxRetry','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','then','createSquareReport','catch','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','sync','production','start','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','traverseBFS','vertex','gotoc','context','extension','priority','agicommand','code','response','isUndefined','result','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','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa153,0xbe));var _0x3a15=function(_0x919327,_0xdace84){_0x919327=_0x919327-0x0;var _0x2ba6ca=_0xa153[_0x919327];return _0x2ba6ca;};'use strict';var parser=require('xml2json');var _=require(_0x3a15('0x0'));var syncho=require(_0x3a15('0x1'));var util=require(_0x3a15('0x2'));var moment=require(_0x3a15('0x3'));var config=require(_0x3a15('0x4'));var logger=require(_0x3a15('0x5'))('agi');var utilLicense=require(_0x3a15('0x6'));var rpc=require(_0x3a15('0x7'));var mailRpc=require(_0x3a15('0x8'));var Graph=require(_0x3a15('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x3a15('0xa')]=_['defaults'](config[_0x3a15('0xa')],{'ip':_0x3a15('0xb'),'port':0x11dd});function connectionHandler(_0x8da7c1){process[_0x3a15('0xc')](function(){syncho(function(){try{setChannelVariables(_0x8da7c1);agiHandler(_0x8da7c1);}catch(_0x543b33){logger['error'](_0x543b33[_0x3a15('0xd')]);}});});}function listeningHandler(){console[_0x3a15('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x3a15('0xa')][_0x3a15('0xf')]);logger[_0x3a15('0x10')](util[_0x3a15('0x11')](_0x3a15('0x12'),config[_0x3a15('0xa')]['ip'],config[_0x3a15('0xa')][_0x3a15('0xf')]));}function errorHandler(_0x19e2b7){if(_0x19e2b7&&_0x19e2b7[_0x3a15('0x13')]&&_0x19e2b7['message']){logger[_0x3a15('0x14')](util[_0x3a15('0x11')]('[%s]\x20%s',_0x19e2b7[_0x3a15('0x13')],_0x19e2b7[_0x3a15('0x15')]));}else{logger[_0x3a15('0x14')](util[_0x3a15('0x11')](_0x3a15('0x16'),_0x19e2b7['stack']));}}function closeHandler(){logger[_0x3a15('0x10')](util[_0x3a15('0x11')](_0x3a15('0x17'),this['arg_1'],this[_0x3a15('0x18')],this[_0x3a15('0x19')],this[_0x3a15('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4716f2){logger[_0x3a15('0x14')](_0x4716f2['stack']);}}function timeoutHandler(){logger[_0x3a15('0x10')](util[_0x3a15('0x11')](_0x3a15('0x1b'),this['arg_1'],this[_0x3a15('0x18')],this['callerid'],this[_0x3a15('0x1a')],this[_0x3a15('0x1c')]));}function hangupHandler(){logger['info'](util[_0x3a15('0x11')](_0x3a15('0x1d'),this[_0x3a15('0x1e')],this[_0x3a15('0x18')],this[_0x3a15('0x19')],this[_0x3a15('0x1a')],this[_0x3a15('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x402c9b){return parser[_0x3a15('0x1f')](_0x402c9b,{'object':!![]})[_0x3a15('0x20')][_0x3a15('0x21')];}function addVertex(_0x1f525d,_0x4cf939,_0x5ddd16){_0x4cf939['agicommand']=_0x5ddd16;if(_0x4cf939['hasOwnProperty'](_0x3a15('0x22'))){_0x4cf939[_0x3a15('0x23')]=parseInt(_0x4cf939[_0x3a15('0x22')],0xa);}_0x1f525d['addVertex'](_[_0x3a15('0x24')](_0x4cf939,_0x3a15('0x25')));}function initGraph(_0x59ad50,_0x5f08bb){var _0x35e201=new Graph();for(var _0x57805d in _0x59ad50){if(_0x59ad50[_0x3a15('0x26')](_0x57805d)){if(_['isArray'](_0x59ad50[_0x57805d])){for(var _0x4e9d64=0x0;_0x4e9d64<_0x59ad50[_0x57805d][_0x3a15('0x27')];_0x4e9d64+=0x1){addVertex(_0x35e201,_0x59ad50[_0x57805d][_0x4e9d64],_0x57805d);}}else{addVertex(_0x35e201,_0x59ad50[_0x57805d],_0x57805d);}}}for(var _0x29e56d=0x0;_0x29e56d<_0x5f08bb[_0x3a15('0x27')];_0x29e56d+=0x1){if(_0x5f08bb[_0x29e56d][_0x3a15('0x28')]&&_0x5f08bb[_0x29e56d][_0x3a15('0x29')]){_0x35e201[_0x3a15('0x2a')](_0x5f08bb[_0x29e56d]['source'],_0x5f08bb[_0x29e56d][_0x3a15('0x29')],_0x5f08bb[_0x29e56d][_0x3a15('0x2b')]);}}return _0x35e201;}function getSquareProject(_0x1f1a8c,_0x37254c){rpc['getSquareProject'](_0x1f1a8c)[_0x3a15('0x2c')](function(_0x141a8c){_0x37254c(null,_0x141a8c);})['catch'](function(_0x50449f){_0x37254c(null,_0x50449f);});}function createSquareReport(_0x3aae64,_0x229483){rpc[_0x3a15('0x2d')](_0x3aae64)[_0x3a15('0x2c')](function(_0xc1a29d){if(_0x229483){_0x229483(null,_0xc1a29d);}})[_0x3a15('0x2e')](function(_0x2d817b){if(_0x229483){_0x229483(null,_0x2d817b);}});}function setChannelVariables(_0x329711){for(var _0x801919 in _0x329711){if(_0x329711['hasOwnProperty'](_0x801919)){if(_0x801919['indexOf'](_0x3a15('0x2f'))===0x0){_0x329711[_0x801919[_0x3a15('0x30')](0x4)]=_0x329711[_0x801919];delete _0x329711[_0x801919];}}}}function getLogFromObject(_0x2a97f5){return util[_0x3a15('0x31')](_0x2a97f5,{'showHidden':![],'depth':null});}function agiHandler(_0x10d8a7){var _0x1dc72d,_0x166e64,_0x4df6b2,_0x36fb65,_0x5c1de5;logger[_0x3a15('0x32')](_0x3a15('0x33'),JSON[_0x3a15('0x34')](_0x10d8a7,null,0x2));logger[_0x3a15('0x10')](util[_0x3a15('0x11')](_0x3a15('0x35'),_0x10d8a7[_0x3a15('0x1e')],_0x10d8a7[_0x3a15('0x18')],_0x10d8a7[_0x3a15('0x19')],_0x10d8a7[_0x3a15('0x1a')],_0x10d8a7[_0x3a15('0x1c')]));_0x10d8a7['on']('error',errorHandler);_0x10d8a7['on'](_0x3a15('0x36'),closeHandler);_0x10d8a7['on'](_0x3a15('0x37'),timeoutHandler);_0x10d8a7[_0x3a15('0x38')]=![];_0x10d8a7['on']('hangup',hangupHandler);var _0x334fdb=getSquareProject[_0x3a15('0x39')](null,_0x10d8a7[_0x3a15('0x1e')]);if(_0x334fdb){if(_0x334fdb[_0x3a15('0x3a')]){_0x1dc72d=getRoot(_0x334fdb[_0x3a15('0x3a')]);if(_0x1dc72d&&_0x1dc72d[_0x3a15('0x3b')]){logger['debug'](_0x3a15('0x21'),JSON['stringify'](_0x1dc72d,null,0x2));_0x10d8a7['joinAt']=moment()[_0x3a15('0x11')](_0x3a15('0x3c'));_0x166e64=initGraph(_[_0x3a15('0x24')](_0x1dc72d,_0x3a15('0x25')),_0x1dc72d[_0x3a15('0x25')]);_0x4df6b2=new Vertices(_0x10d8a7,rpc,mailRpc);logger[_0x3a15('0x10')](util[_0x3a15('0x11')](_0x3a15('0x3d'),_0x10d8a7['arg_1'],_0x10d8a7['calleridname'],_0x10d8a7[_0x3a15('0x19')],_0x10d8a7['dnid'],_0x10d8a7[_0x3a15('0x1c')]));_0x166e64[_0x3a15('0x3e')](_0x1dc72d['start']['id'],function(_0x5cd2bc){try{_0x5cd2bc=_0x4df6b2['clear'](_0x5cd2bc);logger[_0x3a15('0x32')](_0x3a15('0x3f'),JSON[_0x3a15('0x34')](_0x5cd2bc,null,0x2));if(_0x5cd2bc['agicommand']===_0x3a15('0x40')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x10d8a7[_0x3a15('0x41')]=_0x5cd2bc[_0x3a15('0x41')]||_0x10d8a7[_0x3a15('0x41')];_0x10d8a7[_0x3a15('0x42')]=_0x5cd2bc[_0x3a15('0x42')];_0x10d8a7[_0x3a15('0x43')]=_0x5cd2bc[_0x3a15('0x43')]?_0x5cd2bc['priority']-0x1:0x1;return null;}else if(_0x5cd2bc&&_0x4df6b2[_0x5cd2bc[_0x3a15('0x44')]]){_0x5c1de5=_0x4df6b2[_0x5cd2bc[_0x3a15('0x44')]](_0x5cd2bc);logger[_0x3a15('0x10')]('response',JSON[_0x3a15('0x34')](_0x5c1de5,null,0x2));if(_0x5c1de5&&_0x5c1de5[_0x3a15('0x45')]===AGI_CODE_SUCCESS&&_0x5c1de5['result']!==AGI_RESULT_ERROR&&!_0x10d8a7[_0x3a15('0x38')]){logger[_0x3a15('0x32')](_0x3a15('0x46'),getLogFromObject(_0x5c1de5));return _[_0x3a15('0x47')](_0x5c1de5[_0x3a15('0x48')])?null:_0x5c1de5[_0x3a15('0x48')][_0x3a15('0x49')]();}else{logger[_0x3a15('0x14')](_0x3a15('0x46'),getLogFromObject(_0x5c1de5));return null;}}else{logger[_0x3a15('0x14')](_0x3a15('0x4a'));return null;}}catch(_0x3c2f23){logger[_0x3a15('0x14')](_0x3c2f23[_0x3a15('0xd')]);return null;}});if(_0x1dc72d[_0x3a15('0x4b')]){logger['info'](util[_0x3a15('0x11')](_0x3a15('0x4c'),_0x10d8a7[_0x3a15('0x1e')],_0x10d8a7[_0x3a15('0x18')],_0x10d8a7[_0x3a15('0x19')],_0x10d8a7[_0x3a15('0x1a')],_0x10d8a7[_0x3a15('0x1c')]));_0x166e64[_0x3a15('0x3e')](_0x1dc72d[_0x3a15('0x4b')]['id'],function(_0xda7c69){try{_0xda7c69=_0x4df6b2[_0x3a15('0x4d')](_0xda7c69);logger[_0x3a15('0x32')](_0x3a15('0x3f'),JSON[_0x3a15('0x34')](_0xda7c69,null,0x2));if(_0xda7c69&&_0x4df6b2[_0xda7c69['agicommand']]){_0x5c1de5=_0x4df6b2[_0xda7c69[_0x3a15('0x44')]](_0xda7c69);if(_0x5c1de5){logger[_0x3a15('0x32')](_0x3a15('0x46'),getLogFromObject(_0x5c1de5));return _[_0x3a15('0x47')](_0x5c1de5[_0x3a15('0x48')])?null:_0x5c1de5['result']['toString']();}else{logger[_0x3a15('0x14')](_0x3a15('0x46'),getLogFromObject(_0x5c1de5));return null;}}else{logger[_0x3a15('0x14')](_0x3a15('0x4a'));return null;}}catch(_0x2f51a7){logger['error'](_0x2f51a7[_0x3a15('0xd')]);return null;}});}logger[_0x3a15('0x10')](util[_0x3a15('0x11')](_0x3a15('0x4e'),_0x10d8a7[_0x3a15('0x1e')],_0x10d8a7['calleridname'],_0x10d8a7[_0x3a15('0x19')],_0x10d8a7[_0x3a15('0x1a')],_0x10d8a7[_0x3a15('0x1c')]));logger[_0x3a15('0x10')](util['format'](_0x3a15('0x4f'),_0x10d8a7['context'],_0x10d8a7[_0x3a15('0x42')],parseInt(_0x10d8a7[_0x3a15('0x43')],0xa)+0x1));_0x10d8a7[_0x3a15('0x50')](_0x10d8a7['context'],_0x10d8a7[_0x3a15('0x42')],parseInt(_0x10d8a7[_0x3a15('0x43')],0xa)+0x1);_0x10d8a7['close']();}}else{logger[_0x3a15('0x14')](util[_0x3a15('0x11')](_0x3a15('0x51'),_0x10d8a7[_0x3a15('0x1e')]));_0x10d8a7[_0x3a15('0x50')](_0x10d8a7[_0x3a15('0x41')],_0x10d8a7[_0x3a15('0x42')],parseInt(_0x10d8a7[_0x3a15('0x43')],0xa)+0x1);_0x10d8a7[_0x3a15('0x36')]();}}else{logger[_0x3a15('0x14')](util[_0x3a15('0x11')](_0x3a15('0x52'),_0x10d8a7[_0x3a15('0x1e')]));_0x10d8a7[_0x3a15('0x50')](_0x10d8a7[_0x3a15('0x41')],_0x10d8a7[_0x3a15('0x42')],parseInt(_0x10d8a7['priority'],0xa)+0x1);_0x10d8a7[_0x3a15('0x36')]();}}function main(){var _0x25827d;return utilLicense[_0x3a15('0x53')]()[_0x3a15('0x2c')](function(_0x407f92){if(_0x407f92){if(_0x407f92[_0x3a15('0x54')]){if(_0x407f92['callysquare']&&_0x407f92[_0x3a15('0x55')]>0x0){logger[_0x3a15('0x10')](util['format'](_0x3a15('0x56'),_0x407f92[_0x3a15('0x55')]));_0x25827d=_0x407f92['callysquare'];}else{logger[_0x3a15('0x10')](_0x3a15('0x57'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x25827d=-0x1;}}})[_0x3a15('0x2e')](function(_0x3789d2){logger['error'](_0x3a15('0x58'),_0x3789d2['stack']);})[_0x3a15('0x4b')](function(){var _0x1d5990=require(_0x3a15('0x59'))(config[_0x3a15('0xa')][_0x3a15('0xf')],config[_0x3a15('0xa')]['ip'],_0x25827d);_0x1d5990['on'](_0x3a15('0x14'),errorHandler);_0x1d5990['on'](_0x3a15('0x5a'),listeningHandler);_0x1d5990['on']('connection',connectionHandler);_0x1d5990['on'](_0x3a15('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0xb932=['then','catch','createSquareReport','indexOf','agi_','inspect','stringify','close','timeout','evtHangup','hangup','production','debug','joinAt','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','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','stack','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','error','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject'];(function(_0x2317c1,_0x557cc6){var _0x4e0155=function(_0xd03b1b){while(--_0xd03b1b){_0x2317c1['push'](_0x2317c1['shift']());}};_0x4e0155(++_0x557cc6);}(_0xb932,0x18b));var _0x2b93=function(_0x3afb5e,_0x95f97b){_0x3afb5e=_0x3afb5e-0x0;var _0x4bdb9e=_0xb932[_0x3afb5e];return _0x4bdb9e;};'use strict';var parser=require(_0x2b93('0x0'));var _=require(_0x2b93('0x1'));var syncho=require(_0x2b93('0x2'));var util=require('util');var moment=require(_0x2b93('0x3'));var config=require(_0x2b93('0x4'));var logger=require('../../config/logger')(_0x2b93('0x5'));var utilLicense=require(_0x2b93('0x6'));var rpc=require(_0x2b93('0x7'));var mailRpc=require(_0x2b93('0x8'));var Graph=require(_0x2b93('0x9'));var Vertices=require(_0x2b93('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2b93('0x5')]=_['defaults'](config[_0x2b93('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x244596){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x244596);agiHandler(_0x244596);}catch(_0x151edf){logger['error'](_0x151edf[_0x2b93('0xb')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x2b93('0xc')]);logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0xf'),config[_0x2b93('0x5')]['ip'],config[_0x2b93('0x5')]['port']));}function errorHandler(_0x112ded){if(_0x112ded&&_0x112ded['name']&&_0x112ded[_0x2b93('0x10')]){logger['error'](util[_0x2b93('0xe')]('[%s]\x20%s',_0x112ded[_0x2b93('0x11')],_0x112ded[_0x2b93('0x10')]));}else{logger[_0x2b93('0x12')](util[_0x2b93('0xe')](_0x2b93('0x13'),_0x112ded[_0x2b93('0xb')]));}}function closeHandler(){logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x14'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x2b93('0x15')],this[_0x2b93('0x16')]));try{createSquareReport(this);}catch(_0x460186){logger[_0x2b93('0x12')](_0x460186[_0x2b93('0xb')]);}}function timeoutHandler(){logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x17'),this[_0x2b93('0x18')],this['calleridname'],this[_0x2b93('0x19')],this[_0x2b93('0x15')],this[_0x2b93('0x16')]));}function hangupHandler(){logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x1a'),this[_0x2b93('0x18')],this[_0x2b93('0x1b')],this[_0x2b93('0x19')],this[_0x2b93('0x15')],this[_0x2b93('0x16')]));this['evtHangup']=!![];}function getRoot(_0x30dcd1){return parser[_0x2b93('0x1c')](_0x30dcd1,{'object':!![]})[_0x2b93('0x1d')][_0x2b93('0x1e')];}function addVertex(_0x249d91,_0x581edb,_0x2940a7){_0x581edb[_0x2b93('0x1f')]=_0x2940a7;if(_0x581edb[_0x2b93('0x20')](_0x2b93('0x21'))){_0x581edb[_0x2b93('0x22')]=parseInt(_0x581edb[_0x2b93('0x21')],0xa);}_0x249d91[_0x2b93('0x23')](_[_0x2b93('0x24')](_0x581edb,_0x2b93('0x25')));}function initGraph(_0x3c7e26,_0x582c0a){var _0x280046=new Graph();for(var _0x56bf45 in _0x3c7e26){if(_0x3c7e26[_0x2b93('0x20')](_0x56bf45)){if(_[_0x2b93('0x26')](_0x3c7e26[_0x56bf45])){for(var _0xb649ea=0x0;_0xb649ea<_0x3c7e26[_0x56bf45][_0x2b93('0x27')];_0xb649ea+=0x1){addVertex(_0x280046,_0x3c7e26[_0x56bf45][_0xb649ea],_0x56bf45);}}else{addVertex(_0x280046,_0x3c7e26[_0x56bf45],_0x56bf45);}}}for(var _0x158e8a=0x0;_0x158e8a<_0x582c0a[_0x2b93('0x27')];_0x158e8a+=0x1){if(_0x582c0a[_0x158e8a][_0x2b93('0x28')]&&_0x582c0a[_0x158e8a][_0x2b93('0x29')]){_0x280046[_0x2b93('0x2a')](_0x582c0a[_0x158e8a][_0x2b93('0x28')],_0x582c0a[_0x158e8a][_0x2b93('0x29')],_0x582c0a[_0x158e8a][_0x2b93('0x2b')]);}}return _0x280046;}function getSquareProject(_0x4f9755,_0x1b7910){rpc[_0x2b93('0x2c')](_0x4f9755)[_0x2b93('0x2d')](function(_0x32d17a){_0x1b7910(null,_0x32d17a);})[_0x2b93('0x2e')](function(_0x24ff49){_0x1b7910(null,_0x24ff49);});}function createSquareReport(_0x1e6b33,_0x43b2d4){rpc[_0x2b93('0x2f')](_0x1e6b33)['then'](function(_0x4c668b){if(_0x43b2d4){_0x43b2d4(null,_0x4c668b);}})[_0x2b93('0x2e')](function(_0x24beff){if(_0x43b2d4){_0x43b2d4(null,_0x24beff);}});}function setChannelVariables(_0x2e09be){for(var _0x130550 in _0x2e09be){if(_0x2e09be['hasOwnProperty'](_0x130550)){if(_0x130550[_0x2b93('0x30')](_0x2b93('0x31'))===0x0){_0x2e09be[_0x130550['substring'](0x4)]=_0x2e09be[_0x130550];delete _0x2e09be[_0x130550];}}}}function getLogFromObject(_0x348c7){return util[_0x2b93('0x32')](_0x348c7,{'showHidden':![],'depth':null});}function agiHandler(_0x3619a1){var _0x4769c4,_0x44e16b,_0x3d0dae,_0x46648b,_0x25309e;logger['debug']('variables',JSON[_0x2b93('0x33')](_0x3619a1,null,0x2));logger[_0x2b93('0xd')](util[_0x2b93('0xe')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3619a1[_0x2b93('0x18')],_0x3619a1['calleridname'],_0x3619a1[_0x2b93('0x19')],_0x3619a1['dnid'],_0x3619a1[_0x2b93('0x16')]));_0x3619a1['on'](_0x2b93('0x12'),errorHandler);_0x3619a1['on'](_0x2b93('0x34'),closeHandler);_0x3619a1['on'](_0x2b93('0x35'),timeoutHandler);_0x3619a1[_0x2b93('0x36')]=![];_0x3619a1['on'](_0x2b93('0x37'),hangupHandler);var _0x319e31=getSquareProject['sync'](null,_0x3619a1[_0x2b93('0x18')]);if(_0x319e31){if(_0x319e31[_0x2b93('0x38')]){_0x4769c4=getRoot(_0x319e31[_0x2b93('0x38')]);if(_0x4769c4&&_0x4769c4['start']){logger[_0x2b93('0x39')]('root',JSON[_0x2b93('0x33')](_0x4769c4,null,0x2));_0x3619a1[_0x2b93('0x3a')]=moment()[_0x2b93('0xe')](_0x2b93('0x3b'));_0x44e16b=initGraph(_[_0x2b93('0x24')](_0x4769c4,_0x2b93('0x25')),_0x4769c4[_0x2b93('0x25')]);_0x3d0dae=new Vertices(_0x3619a1,rpc,mailRpc);logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x3c'),_0x3619a1[_0x2b93('0x18')],_0x3619a1['calleridname'],_0x3619a1[_0x2b93('0x19')],_0x3619a1[_0x2b93('0x15')],_0x3619a1[_0x2b93('0x16')]));_0x44e16b[_0x2b93('0x3d')](_0x4769c4[_0x2b93('0x3e')]['id'],function(_0x1fc0fc){try{_0x1fc0fc=_0x3d0dae['clear'](_0x1fc0fc);logger[_0x2b93('0x39')](_0x2b93('0x3f'),JSON[_0x2b93('0x33')](_0x1fc0fc,null,0x2));if(_0x1fc0fc[_0x2b93('0x1f')]===_0x2b93('0x40')){logger[_0x2b93('0xd')](_0x2b93('0x41'));_0x3619a1[_0x2b93('0x42')]=_0x1fc0fc[_0x2b93('0x42')]||_0x3619a1['context'];_0x3619a1['extension']=_0x1fc0fc[_0x2b93('0x43')];_0x3619a1['priority']=_0x1fc0fc[_0x2b93('0x44')]?_0x1fc0fc[_0x2b93('0x44')]-0x1:0x1;return null;}else if(_0x1fc0fc&&_0x3d0dae[_0x1fc0fc[_0x2b93('0x1f')]]){_0x25309e=_0x3d0dae[_0x1fc0fc[_0x2b93('0x1f')]](_0x1fc0fc);logger[_0x2b93('0xd')](_0x2b93('0x45'),JSON[_0x2b93('0x33')](_0x25309e,null,0x2));if(_0x25309e&&_0x25309e[_0x2b93('0x46')]===AGI_CODE_SUCCESS&&_0x25309e[_0x2b93('0x47')]!==AGI_RESULT_ERROR&&!_0x3619a1[_0x2b93('0x36')]){logger[_0x2b93('0x39')](_0x2b93('0x45'),getLogFromObject(_0x25309e));return _[_0x2b93('0x48')](_0x25309e[_0x2b93('0x47')])?null:_0x25309e[_0x2b93('0x47')][_0x2b93('0x49')]();}else{logger[_0x2b93('0x12')]('response',getLogFromObject(_0x25309e));return null;}}else{logger[_0x2b93('0x12')](_0x2b93('0x4a'));return null;}}catch(_0xa67920){logger[_0x2b93('0x12')](_0xa67920[_0x2b93('0xb')]);return null;}});if(_0x4769c4['finally']){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3619a1[_0x2b93('0x18')],_0x3619a1[_0x2b93('0x1b')],_0x3619a1[_0x2b93('0x19')],_0x3619a1[_0x2b93('0x15')],_0x3619a1['uniqueid']));_0x44e16b[_0x2b93('0x3d')](_0x4769c4[_0x2b93('0x4b')]['id'],function(_0xbbe8a2){try{_0xbbe8a2=_0x3d0dae[_0x2b93('0x4c')](_0xbbe8a2);logger['debug']('vertex',JSON[_0x2b93('0x33')](_0xbbe8a2,null,0x2));if(_0xbbe8a2&&_0x3d0dae[_0xbbe8a2[_0x2b93('0x1f')]]){_0x25309e=_0x3d0dae[_0xbbe8a2[_0x2b93('0x1f')]](_0xbbe8a2);if(_0x25309e){logger[_0x2b93('0x39')](_0x2b93('0x45'),getLogFromObject(_0x25309e));return _[_0x2b93('0x48')](_0x25309e[_0x2b93('0x47')])?null:_0x25309e[_0x2b93('0x47')][_0x2b93('0x49')]();}else{logger['error'](_0x2b93('0x45'),getLogFromObject(_0x25309e));return null;}}else{logger[_0x2b93('0x12')](_0x2b93('0x4a'));return null;}}catch(_0x3b8e17){logger[_0x2b93('0x12')](_0x3b8e17[_0x2b93('0xb')]);return null;}});}logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x4d'),_0x3619a1[_0x2b93('0x18')],_0x3619a1[_0x2b93('0x1b')],_0x3619a1[_0x2b93('0x19')],_0x3619a1[_0x2b93('0x15')],_0x3619a1[_0x2b93('0x16')]));logger[_0x2b93('0xd')](util[_0x2b93('0xe')](_0x2b93('0x4e'),_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1['priority'],0xa)+0x1));_0x3619a1[_0x2b93('0x4f')](_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1[_0x2b93('0x44')],0xa)+0x1);_0x3619a1[_0x2b93('0x34')]();}}else{logger[_0x2b93('0x12')](util[_0x2b93('0xe')](_0x2b93('0x50'),_0x3619a1[_0x2b93('0x18')]));_0x3619a1['continueAt'](_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1[_0x2b93('0x44')],0xa)+0x1);_0x3619a1['close']();}}else{logger[_0x2b93('0x12')](util[_0x2b93('0xe')](_0x2b93('0x51'),_0x3619a1['arg_1']));_0x3619a1[_0x2b93('0x4f')](_0x3619a1[_0x2b93('0x42')],_0x3619a1[_0x2b93('0x43')],parseInt(_0x3619a1[_0x2b93('0x44')],0xa)+0x1);_0x3619a1[_0x2b93('0x34')]();}}function main(){var _0x37df4e;return utilLicense[_0x2b93('0x52')]()['then'](function(_0x1b7b63){if(_0x1b7b63){if(_0x1b7b63['voice']){if(_0x1b7b63[_0x2b93('0x53')]&&_0x1b7b63[_0x2b93('0x53')]>0x0){logger['info'](util[_0x2b93('0xe')]('[LICENSE]\x20CHANNELS:\x20%s',_0x1b7b63['callysquare']));_0x37df4e=_0x1b7b63[_0x2b93('0x53')];}else{logger['info'](_0x2b93('0x54'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x37df4e=-0x1;}}})[_0x2b93('0x2e')](function(_0x4d416a){logger['error']('[LICENSE]',_0x4d416a[_0x2b93('0xb')]);})[_0x2b93('0x4b')](function(){var _0x182d04=require(_0x2b93('0x55'))(config[_0x2b93('0x5')][_0x2b93('0xc')],config[_0x2b93('0x5')]['ip'],_0x37df4e);_0x182d04['on'](_0x2b93('0x12'),errorHandler);_0x182d04['on'](_0x2b93('0x56'),listeningHandler);_0x182d04['on'](_0x2b93('0x57'),connectionHandler);_0x182d04['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index ec6083e..6bdec48 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 _0x99b5=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x99b5,0x160));var _0x599b=function(_0xd2e104,_0x48c0f6){_0xd2e104=_0xd2e104-0x0;var _0x4101f9=_0x99b5[_0xd2e104];return _0x4101f9;};'use strict';var BPromise=require(_0x599b('0x0'));var jayson=require(_0x599b('0x1'));var client=jayson[_0x599b('0x2')][_0x599b('0x3')]({'port':0x232b});function request(_0x380b26,_0x1569e0){return new BPromise(function(_0x501f92,_0x1497ce){return client[_0x599b('0x4')](_0x380b26,_0x1569e0)[_0x599b('0x5')](function(_0x449146){if(_0x449146[_0x599b('0x6')]){return _0x1497ce(_0x449146[_0x599b('0x6')][_0x599b('0x7')]);}else{return _0x501f92(_0x449146['result']);}})['catch'](function(_0x458a09){return _0x1497ce(_0x458a09);});});}exports['sendMailMessage']=function(_0x285869,_0x40f7a9){return request(_0x599b('0x8'),{'account':_0x285869,'message':_0x40f7a9});}; \ No newline at end of file +var _0x901f=['bluebird','jayson/promise','client','http','request','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x901f,0xa5));var _0xf901=function(_0x21ec92,_0x2e036c){_0x21ec92=_0x21ec92-0x0;var _0x53a537=_0x901f[_0x21ec92];return _0x53a537;};'use strict';var BPromise=require(_0xf901('0x0'));var jayson=require(_0xf901('0x1'));var client=jayson[_0xf901('0x2')][_0xf901('0x3')]({'port':0x232b});function request(_0x5d71d4,_0x228e4a){return new BPromise(function(_0x3b3fee,_0x2fa657){return client[_0xf901('0x4')](_0x5d71d4,_0x228e4a)['then'](function(_0x38ffb1){if(_0x38ffb1['error']){return _0x2fa657(_0x38ffb1[_0xf901('0x5')][_0xf901('0x6')]);}else{return _0x3b3fee(_0x38ffb1[_0xf901('0x7')]);}})[_0xf901('0x8')](function(_0x117336){return _0x2fa657(_0x117336);});});}exports[_0xf901('0x9')]=function(_0x3055c9,_0x1584a1){return request(_0xf901('0xa'),{'account':_0x3055c9,'message':_0x1584a1});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 523ddd7..b72a728 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 _0xd63a=['Transform','call','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','trim','length','emit','line','exports','stream'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd63a,0xed));var _0xad63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd63a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var Transform=require(_0xad63('0x0'))[_0xad63('0x1')];function AGIReply(_0x110a2f){Transform[_0xad63('0x2')](this,_0x110a2f);this[_0xad63('0x3')]='';this[_0xad63('0x4')]=![];}util[_0xad63('0x5')](AGIReply,Transform);AGIReply[_0xad63('0x6')]['_transform']=function(_0x221ea2,_0x463523,_0x382378){var _0x39132f='\x0a',_0x40553a=['\x0a\x0a',_0xad63('0x7')],_0x2d2945=-0x1,_0x5c05c3=-0x1,_0x13576a='',_0x2b2104=0x0,_0x196b2b='',_0x3c7bcc='';this['_localBuffer']+=_0x221ea2[_0xad63('0x8')]();_0x196b2b=this[_0xad63('0x3')];if(!this[_0xad63('0x4')]){_0x2b2104=0x0;while(_0x40553a[_0x2b2104]){while((_0x5c05c3=_0x196b2b[_0xad63('0x9')](_0x40553a[_0x2b2104]))!=-0x1){_0x13576a=_0x40553a[_0x2b2104];_0x3c7bcc=_0x196b2b['substring'](0x0,_0x5c05c3);_0x196b2b=_0x196b2b[_0xad63('0xa')](_0x5c05c3+_0x13576a['length']);var _0x21eafb=_0x3c7bcc[_0xad63('0xb')](_0x39132f),_0x33de19=0x0,_0x100f32={},_0xbc0eed='',_0x46677e='',_0x2a11e3=-0x1;while(_0x21eafb[_0x33de19]){_0x2a11e3=_0x21eafb[_0x33de19]['indexOf'](':');if(_0x2a11e3!=-0x1){_0xbc0eed=_0x21eafb[_0x33de19]['slice'](0x0,_0x2a11e3)[_0xad63('0xc')]();_0x46677e=_0x21eafb[_0x33de19]['slice'](_0x2a11e3+0x1)['trim']();if(_0xbc0eed[_0xad63('0xd')]>0x0){_0x100f32[_0xbc0eed]=_0x46677e;}}else{}_0x33de19++;}this[_0xad63('0xe')]('headers',_0x100f32);this[_0xad63('0x4')]=!![];}_0x2b2104++;}this['_localBuffer']=_0x196b2b;}else{while((_0x2d2945=_0x196b2b[_0xad63('0x9')](_0x39132f))!=-0x1){_0x3c7bcc=_0x196b2b[_0xad63('0xa')](0x0,_0x2d2945);this[_0xad63('0xe')](_0xad63('0xf'),_0x3c7bcc);_0x196b2b=_0x196b2b[_0xad63('0xa')](_0x2d2945+_0x39132f[_0xad63('0xd')]);}this[_0xad63('0x3')]=_0x196b2b;}_0x382378();};module[_0xad63('0x10')]=AGIReply; \ No newline at end of file +var _0x67b4=['substring','length','split','slice','trim','emit','line','util','Transform','call','_localBuffer','_inBody','inherits','prototype','toString','indexOf'];(function(_0x181f30,_0x59e7e0){var _0x175754=function(_0x5f0751){while(--_0x5f0751){_0x181f30['push'](_0x181f30['shift']());}};_0x175754(++_0x59e7e0);}(_0x67b4,0x1d7));var _0x467b=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x67b4[_0x1b2ff7];return _0x31656a;};'use strict';var util=require(_0x467b('0x0'));var Transform=require('stream')[_0x467b('0x1')];function AGIReply(_0x59b3f7){Transform[_0x467b('0x2')](this,_0x59b3f7);this[_0x467b('0x3')]='';this[_0x467b('0x4')]=![];}util[_0x467b('0x5')](AGIReply,Transform);AGIReply[_0x467b('0x6')]['_transform']=function(_0xea308b,_0x64a8ab,_0x3c4515){var _0x4bfe4b='\x0a',_0x178580=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xfe0f28=-0x1,_0x13e6f7=-0x1,_0x230fff='',_0x20556f=0x0,_0x3e3484='',_0x1f662d='';this[_0x467b('0x3')]+=_0xea308b[_0x467b('0x7')]();_0x3e3484=this[_0x467b('0x3')];if(!this['_inBody']){_0x20556f=0x0;while(_0x178580[_0x20556f]){while((_0x13e6f7=_0x3e3484[_0x467b('0x8')](_0x178580[_0x20556f]))!=-0x1){_0x230fff=_0x178580[_0x20556f];_0x1f662d=_0x3e3484[_0x467b('0x9')](0x0,_0x13e6f7);_0x3e3484=_0x3e3484[_0x467b('0x9')](_0x13e6f7+_0x230fff[_0x467b('0xa')]);var _0x2d1115=_0x1f662d[_0x467b('0xb')](_0x4bfe4b),_0x56f32f=0x0,_0x38dd02={},_0x4b9a99='',_0x443600='',_0x509115=-0x1;while(_0x2d1115[_0x56f32f]){_0x509115=_0x2d1115[_0x56f32f][_0x467b('0x8')](':');if(_0x509115!=-0x1){_0x4b9a99=_0x2d1115[_0x56f32f][_0x467b('0xc')](0x0,_0x509115)[_0x467b('0xd')]();_0x443600=_0x2d1115[_0x56f32f][_0x467b('0xc')](_0x509115+0x1)[_0x467b('0xd')]();if(_0x4b9a99[_0x467b('0xa')]>0x0){_0x38dd02[_0x4b9a99]=_0x443600;}}else{}_0x56f32f++;}this[_0x467b('0xe')]('headers',_0x38dd02);this[_0x467b('0x4')]=!![];}_0x20556f++;}this[_0x467b('0x3')]=_0x3e3484;}else{while((_0xfe0f28=_0x3e3484[_0x467b('0x8')](_0x4bfe4b))!=-0x1){_0x1f662d=_0x3e3484[_0x467b('0x9')](0x0,_0xfe0f28);this[_0x467b('0xe')](_0x467b('0xf'),_0x1f662d);_0x3e3484=_0x3e3484[_0x467b('0x9')](_0xfe0f28+_0x4bfe4b[_0x467b('0xa')]);}this[_0x467b('0x3')]=_0x3e3484;}_0x3c4515();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d10596a..db110e9 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 _0x076a=['Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','then','error','message','result','catch','getSquareProjects','name','production','getSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','ShowTrunk','ShowSound','save_name','ShowInterval'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x076a,0x1f1));var _0xa076=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x076a[_0x36ed48];return _0x51c63a;};'use strict';var BPromise=require('bluebird');var moment=require(_0xa076('0x0'));var _=require(_0xa076('0x1'));var util=require(_0xa076('0x2'));var jayson=require(_0xa076('0x3'));var client=jayson[_0xa076('0x4')]['http']({'port':0x2329});function request(_0x434981,_0x1e1a5c){return new BPromise(function(_0x352094,_0x110074){return client['request'](_0x434981,_0x1e1a5c)[_0xa076('0x5')](function(_0x38b480){if(_0x38b480[_0xa076('0x6')]){return _0x110074(_0x38b480[_0xa076('0x6')][_0xa076('0x7')]);}else{return _0x352094(_0x38b480[_0xa076('0x8')]);}})[_0xa076('0x9')](function(_0x1b62fe){return _0x110074(_0x1b62fe);});});}exports[_0xa076('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xa076('0xb'),_0xa076('0xc')]}});};exports[_0xa076('0xd')]=function(_0x127af6){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x127af6},'attributes':[_0xa076('0xc')]}});};exports[_0xa076('0xe')]=function(_0x298087){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x298087},'include':[{'model':_0xa076('0xf'),'as':_0xa076('0x10'),'include':[{'model':_0xa076('0x11'),'as':_0xa076('0x11')}]}],'attributes':['id',_0xa076('0xb'),_0xa076('0x12')],'smtp':!![]}});};exports[_0xa076('0x13')]=function(_0x3228e3){return request('ShowSquareProject',{'options':{'where':{'id':_0x3228e3},'attributes':[_0xa076('0xb')]}});};exports[_0xa076('0x14')]=function(_0x319378){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x319378},'attributes':[_0xa076('0xb')]}});};exports[_0xa076('0x15')]=function(_0x5db418){return request(_0xa076('0x16'),{'options':{'where':{'id':_0x5db418},'attributes':[_0xa076('0xb')]}});};exports[_0xa076('0x17')]=function(_0x2a8ae4){return request(_0xa076('0x18'),{'options':{'where':{'id':_0x2a8ae4},'attributes':[_0xa076('0x19')]}});};exports[_0xa076('0x1a')]=function(_0x31b171){return request(_0xa076('0x1b'),{'options':{'where':{'id':_0x31b171},'attributes':[_0xa076('0xb')]}});};exports[_0xa076('0x1c')]=function(_0x1c0dc8){return request('GetContactByPhone',{'options':{'where':{'phone':_0x1c0dc8[_0xa076('0x1d')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x5548ef){return request(_0xa076('0x1e'),{'options':{'where':{'id':_0x5548ef},'attributes':[_0xa076('0xb')]}});};exports['getSoundById']=function(_0x4c724c){return request(_0xa076('0x1f'),{'options':{'where':{'id':_0x4c724c},'attributes':[_0xa076('0x20')]}});};exports['getIntervalById']=function(_0x4d3b35){return request(_0xa076('0x21'),{'options':{'raw':![],'where':{'id':_0x4d3b35},'include':[{'model':_0xa076('0x22'),'as':_0xa076('0x23')}]}});};exports[_0xa076('0x24')]=function(_0x5ae6ce){return request(_0xa076('0x25'),{'options':{'where':{'id':_0x5ae6ce},'attributes':['id',_0xa076('0xb')]}});};exports['createSmsMessage']=function(_0x3c05e4){return request(_0xa076('0x26'),{'body':_0x3c05e4});};exports[_0xa076('0x27')]=function(_0x50fe36){return request(_0xa076('0x28'),{'body':_0x50fe36});};exports['createSquareReport']=function(_0x5f0c3c){return request(_0xa076('0x29'),{'body':_[_0xa076('0x2a')](_0x5f0c3c,{'project_name':_0x5f0c3c[_0xa076('0x2b')],'prev_project_name':_0x5f0c3c[_0xa076('0x2c')]||'','is_subproject':_0x5f0c3c[_0xa076('0x2c')]?!![]:![],'leaveAt':moment()[_0xa076('0x2d')](_0xa076('0x2e'))})});};exports[_0xa076('0x2f')]=function(_0x34c884){return request('CreateSquareRecording',{'body':_0x34c884});};exports[_0xa076('0x30')]=function(_0x1c4916){return request('CreateSquareMessage',{'body':_0x1c4916});};exports['createCmContact']=function(_0x3d0aac){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3d0aac['phone'],'ListId':_0x3d0aac[_0xa076('0x31')]}}})[_0xa076('0x5')](function(_0x23a4b2){if(_0x23a4b2){return _0x23a4b2;}return request(_0xa076('0x32'),{'body':_0x3d0aac});});};exports['getPauseById']=function(_0x150e71){return request(_0xa076('0x33'),{'options':{'where':{'id':_0x150e71},'attributes':[_0xa076('0xb')]}});};exports[_0xa076('0x34')]=function(_0x55bda5,_0x35b646){return request(_0xa076('0x35'),{'body':{'interface':_0x35b646},'options':{'where':_0x55bda5}});};exports[_0xa076('0x36')]=function(_0x3aeb1a,_0x1d493c,_0x654c2b){return request(_0xa076('0x37'),{'body':{'type':_0x1d493c,'uniqueid':_0x654c2b},'options':{'where':_0x3aeb1a}});};exports['agentUnpause']=function(_0x3a6f05){return request(_0xa076('0x38'),{'body':{},'options':{'where':_0x3a6f05}});};exports[_0xa076('0x39')]=function(_0x3b92fb){return request(_0xa076('0x3a'),{'body':{},'options':{'where':_0x3b92fb}});}; \ No newline at end of file +var _0x1963=['ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById'];(function(_0x5bcc71,_0x36b7f1){var _0x2c58ee=function(_0x1083ae){while(--_0x1083ae){_0x5bcc71['push'](_0x5bcc71['shift']());}};_0x2c58ee(++_0x36b7f1);}(_0x1963,0x151));var _0x3196=function(_0x4bc626,_0x54c76e){_0x4bc626=_0x4bc626-0x0;var _0x548316=_0x1963[_0x4bc626];return _0x548316;};'use strict';var BPromise=require(_0x3196('0x0'));var moment=require(_0x3196('0x1'));var _=require(_0x3196('0x2'));var util=require(_0x3196('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x3196('0x4')][_0x3196('0x5')]({'port':0x2329});function request(_0x453ac1,_0x51269f){return new BPromise(function(_0x43d6f2,_0x51fe34){return client[_0x3196('0x6')](_0x453ac1,_0x51269f)[_0x3196('0x7')](function(_0x3268ca){if(_0x3268ca[_0x3196('0x8')]){return _0x51fe34(_0x3268ca[_0x3196('0x8')][_0x3196('0x9')]);}else{return _0x43d6f2(_0x3268ca[_0x3196('0xa')]);}})['catch'](function(_0x2f90d7){return _0x51fe34(_0x2f90d7);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x3196('0xb')]=function(_0x5ba329){return request(_0x3196('0xc'),{'options':{'raw':![],'where':{'name':_0x5ba329},'attributes':['production']}});};exports[_0x3196('0xd')]=function(_0x65873){return request(_0x3196('0xe'),{'options':{'raw':![],'where':{'id':_0x65873},'include':[{'model':_0x3196('0xf'),'as':_0x3196('0x10'),'include':[{'model':_0x3196('0x11'),'as':_0x3196('0x11')}]}],'attributes':['id',_0x3196('0x12'),'email'],'smtp':!![]}});};exports[_0x3196('0x13')]=function(_0x51049a){return request(_0x3196('0xc'),{'options':{'where':{'id':_0x51049a},'attributes':['name']}});};exports[_0x3196('0x14')]=function(_0x5bb109){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5bb109},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x15')]=function(_0x2e11c7){return request(_0x3196('0x16'),{'options':{'where':{'id':_0x2e11c7},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x17')]=function(_0x9fb5d7){return request(_0x3196('0x18'),{'options':{'where':{'id':_0x9fb5d7},'attributes':[_0x3196('0x19')]}});};exports[_0x3196('0x1a')]=function(_0xd22243){return request(_0x3196('0x1b'),{'options':{'where':{'id':_0xd22243},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x1c')]=function(_0x2d6142){return request(_0x3196('0x1d'),{'options':{'where':{'phone':_0x2d6142[_0x3196('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x43b86e){return request(_0x3196('0x1f'),{'options':{'where':{'id':_0x43b86e},'attributes':[_0x3196('0x12')]}});};exports['getSoundById']=function(_0x3cddf6){return request(_0x3196('0x20'),{'options':{'where':{'id':_0x3cddf6},'attributes':[_0x3196('0x21')]}});};exports[_0x3196('0x22')]=function(_0x5b4029){return request(_0x3196('0x23'),{'options':{'raw':![],'where':{'id':_0x5b4029},'include':[{'model':_0x3196('0x24'),'as':_0x3196('0x25')}]}});};exports[_0x3196('0x26')]=function(_0x2a9a25){return request(_0x3196('0x27'),{'options':{'where':{'id':_0x2a9a25},'attributes':['id',_0x3196('0x12')]}});};exports['createSmsMessage']=function(_0x47d643){return request(_0x3196('0x28'),{'body':_0x47d643});};exports[_0x3196('0x29')]=function(_0x38251d){return request(_0x3196('0x2a'),{'body':_0x38251d});};exports['createSquareReport']=function(_0x17f95a){return request('CreateSquareReport',{'body':_[_0x3196('0x2b')](_0x17f95a,{'project_name':_0x17f95a[_0x3196('0x2c')],'prev_project_name':_0x17f95a[_0x3196('0x2d')]||'','is_subproject':_0x17f95a[_0x3196('0x2d')]?!![]:![],'leaveAt':moment()[_0x3196('0x2e')](_0x3196('0x2f'))})});};exports[_0x3196('0x30')]=function(_0xcb4465){return request(_0x3196('0x31'),{'body':_0xcb4465});};exports[_0x3196('0x32')]=function(_0x320b59){return request('CreateSquareMessage',{'body':_0x320b59});};exports[_0x3196('0x33')]=function(_0x55181f){return request(_0x3196('0x34'),{'options':{'raw':![],'where':{'phone':_0x55181f[_0x3196('0x1e')],'ListId':_0x55181f[_0x3196('0x35')]}}})['then'](function(_0x14693c){if(_0x14693c){return _0x14693c;}return request('CreateCmContact',{'body':_0x55181f});});};exports[_0x3196('0x36')]=function(_0x2c0b93){return request('ShowPause',{'options':{'where':{'id':_0x2c0b93},'attributes':[_0x3196('0x12')]}});};exports[_0x3196('0x37')]=function(_0x1a439f,_0x6a01dc){return request(_0x3196('0x38'),{'body':{'interface':_0x6a01dc},'options':{'where':_0x1a439f}});};exports[_0x3196('0x39')]=function(_0x13d5b7,_0x1402ad,_0x27adbc){return request(_0x3196('0x3a'),{'body':{'type':_0x1402ad,'uniqueid':_0x27adbc},'options':{'where':_0x13d5b7}});};exports[_0x3196('0x3b')]=function(_0x23adaf){return request(_0x3196('0x3c'),{'body':{},'options':{'where':_0x23adaf}});};exports['agentLogout']=function(_0x12ddc3){return request(_0x3196('0x3d'),{'body':{},'options':{'where':_0x12ddc3}});}; \ 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 402c083..29d488a 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 _0x644f=['exports','./lex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x644f,0x177));var _0xf644=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x644f[_0x335271];return _0xa9fff8;};var polly=require('./polly');var lex=require(_0xf644('0x0'));module[_0xf644('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3d4b=['./lex','./polly'];(function(_0x256dbf,_0x59cedb){var _0x10f25e=function(_0x10a66c){while(--_0x10a66c){_0x256dbf['push'](_0x256dbf['shift']());}};_0x10f25e(++_0x59cedb);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x283129,_0x4854e8){_0x283129=_0x283129-0x0;var _0x3b60f0=_0x3d4b[_0x283129];return _0x3b60f0;};var polly=require(_0xb3d4('0x0'));var lex=require(_0xb3d4('0x1'));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 a32cf89..13ddb8a 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 _0x9348=['exports','./lib/api'];(function(_0x3adddc,_0x2f814c){var _0x155a0f=function(_0x32f279){while(--_0x32f279){_0x3adddc['push'](_0x3adddc['shift']());}};_0x155a0f(++_0x2f814c);}(_0x9348,0x10d));var _0x8934=function(_0x634e28,_0x3cd995){_0x634e28=_0x634e28-0x0;var _0x5a458e=_0x9348[_0x634e28];return _0x5a458e;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ No newline at end of file +var _0x41bb=['exports','./lib/api'];(function(_0x1b2018,_0x10ee5a){var _0x3087d5=function(_0x461781){while(--_0x461781){_0x1b2018['push'](_0x1b2018['shift']());}};_0x3087d5(++_0x10ee5a);}(_0x41bb,0xc5));var _0xb41b=function(_0x187644,_0x115c74){_0x187644=_0x187644-0x0;var _0x110f61=_0x41bb[_0x187644];return _0x110f61;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ 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 5ea0026..abce86c 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(_0x37ce94,_0xbe541){var _0x5a9a52=function(_0x3fa025){while(--_0x3fa025){_0x37ce94['push'](_0x37ce94['shift']());}};_0x5a9a52(++_0xbe541);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x43875f,_0x2c2921){var _0x189586=function(_0x3d298b){while(--_0x3d298b){_0x43875f['push'](_0x43875f['shift']());}};_0x189586(++_0x2c2921);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 84ef412..e53e6ba 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 _0x76be=['exports','./lib/api'];(function(_0x26d2aa,_0x3583f9){var _0xbe2442=function(_0x4da03c){while(--_0x4da03c){_0x26d2aa['push'](_0x26d2aa['shift']());}};_0xbe2442(++_0x3583f9);}(_0x76be,0xe3));var _0xe76b=function(_0x130cd0,_0x58c494){_0x130cd0=_0x130cd0-0x0;var _0x1aae16=_0x76be[_0x130cd0];return _0x1aae16;};'use strict';var polly=require(_0xe76b('0x0'));module[_0xe76b('0x1')]=function(_0x429980,_0x55cd0b,_0x3aaee5,_0x30f155,_0x1ecfdb,_0x2eb12e,_0x2b629d){return polly(_0x429980,_0x55cd0b,_0x3aaee5,_0x30f155,_0x1ecfdb,_0x2eb12e,_0x2b629d);}; \ No newline at end of file +var _0x6b61=['./lib/api','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6b61,0x184));var _0x16b6=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x6b61[_0x480bc8];return _0x28c245;};'use strict';var polly=require(_0x16b6('0x0'));module[_0x16b6('0x1')]=function(_0x262cc2,_0x240f16,_0x59b3a0,_0xc86894,_0x52ba5f,_0x2914f7,_0x1dff04){return polly(_0x262cc2,_0x240f16,_0x59b3a0,_0xc86894,_0x52ba5f,_0x2914f7,_0x1dff04);}; \ 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 0b1d0a8..44ee131 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 _0x1b25=['bluebird','randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x1b25,0x1d8));var _0x51b2=function(_0x3da2a5,_0x5c5c70){_0x3da2a5=_0x3da2a5-0x0;var _0x57bb9e=_0x1b25[_0x3da2a5];return _0x57bb9e;};'use strict';var fs=require('fs');var path=require(_0x51b2('0x0'));var BPromise=require(_0x51b2('0x1'));var rs=require(_0x51b2('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x5d4dbf,_0x12ecc9,_0x6c2892){return new BPromise(function(_0xc9c3d4,_0x7c13d6){_0x5d4dbf[_0x51b2('0x3')](_0x12ecc9,function(_0x31431d,_0x11c1d1){if(_0x31431d){_0x7c13d6(_0x31431d);}else if(_0x11c1d1){if(_0x11c1d1[_0x51b2('0x4')]instanceof Buffer){fs['writeFile'](_0x6c2892,_0x11c1d1[_0x51b2('0x4')],function(_0x382977){if(_0x382977){_0x7c13d6(_0x382977);}else{_0xc9c3d4();}});}else{_0x7c13d6(new Error(_0x51b2('0x5')));}}else{_0x7c13d6(new Error(_0x51b2('0x6')));}});});}module[_0x51b2('0x7')]=function(_0x191e75,_0x42b06e,_0x18cf14,_0x29cc7d,_0x125d5d,_0x550139,_0xc19594){var _0x3bc3d0=new AWS[(_0x51b2('0x8'))]({'accessKeyId':_0x191e75,'secretAccessKey':_0x42b06e,'region':_0x18cf14});var _0x368616={'Text':_0x125d5d,'TextType':_0x550139||_0x51b2('0x9'),'OutputFormat':_0x51b2('0xa'),'VoiceId':_0x29cc7d};return pollyResult(_0x3bc3d0,_0x368616,_0xc19594);}; \ No newline at end of file +var _0xdeb2=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','randomstring'];(function(_0x400b6c,_0x4a6139){var _0x4c4e3e=function(_0x191233){while(--_0x191233){_0x400b6c['push'](_0x400b6c['shift']());}};_0x4c4e3e(++_0x4a6139);}(_0xdeb2,0xbb));var _0x2deb=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0xdeb2[_0x3fc287];return _0x33af9f;};'use strict';var fs=require('fs');var path=require(_0x2deb('0x0'));var BPromise=require('bluebird');var rs=require(_0x2deb('0x1'));var AWS=require(_0x2deb('0x2'));function pollyResult(_0x2198cc,_0x3e9df1,_0xf4ed4){return new BPromise(function(_0x1a0c6e,_0x331746){_0x2198cc[_0x2deb('0x3')](_0x3e9df1,function(_0x1995c9,_0x282524){if(_0x1995c9){_0x331746(_0x1995c9);}else if(_0x282524){if(_0x282524[_0x2deb('0x4')]instanceof Buffer){fs['writeFile'](_0xf4ed4,_0x282524[_0x2deb('0x4')],function(_0x29cb29){if(_0x29cb29){_0x331746(_0x29cb29);}else{_0x1a0c6e();}});}else{_0x331746(new Error(_0x2deb('0x5')));}}else{_0x331746(new Error(_0x2deb('0x6')));}});});}module[_0x2deb('0x7')]=function(_0x528b53,_0x4fdb98,_0x13b0b1,_0x95a409,_0x4edbe7,_0x1e2dd0,_0x3d6a96){var _0x16fea1=new AWS['Polly']({'accessKeyId':_0x528b53,'secretAccessKey':_0x4fdb98,'region':_0x13b0b1});var _0x26551e={'Text':_0x4edbe7,'TextType':_0x1e2dd0||'text','OutputFormat':_0x2deb('0x8'),'VoiceId':_0x95a409};return pollyResult(_0x16fea1,_0x26551e,_0x3d6a96);}; \ 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 b5846ba..6e7e753 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 _0x0841=['./lib/api','exports'];(function(_0x494474,_0x45d32b){var _0x2e84df=function(_0x4929f0){while(--_0x4929f0){_0x494474['push'](_0x494474['shift']());}};_0x2e84df(++_0x45d32b);}(_0x0841,0x6a));var _0x1084=function(_0x3cfb8f,_0x557696){_0x3cfb8f=_0x3cfb8f-0x0;var _0x5f1d83=_0x0841[_0x3cfb8f];return _0x5f1d83;};'use strict';var asr=require(_0x1084('0x0'));module[_0x1084('0x1')]=function(_0x5213a3,_0x2fec1d,_0x2dac3b,_0x367fcb){return asr(_0x5213a3,_0x2fec1d,_0x2dac3b);}; \ No newline at end of file +var _0xb146=['./lib/api','exports'];(function(_0x4f6add,_0x5f2f22){var _0x4c0c9a=function(_0x4dba42){while(--_0x4dba42){_0x4f6add['push'](_0x4f6add['shift']());}};_0x4c0c9a(++_0x5f2f22);}(_0xb146,0x68));var _0x6b14=function(_0x3fe47f,_0x1a2b5b){_0x3fe47f=_0x3fe47f-0x0;var _0x55d8d9=_0xb146[_0x3fe47f];return _0x55d8d9;};'use strict';var asr=require(_0x6b14('0x0'));module[_0x6b14('0x1')]=function(_0x439559,_0x2fa621,_0x4076dc,_0x194c0e){return asr(_0x439559,_0x2fa621,_0x4076dc);}; \ 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 a7eea2d..48a0dfc 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 _0xa4fb=['lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4fb,0x150));var _0xba4f=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0xa4fb[_0x28c939];return _0x527fe9;};'use strict';var url=require(_0xba4f('0x0'));var BPromise=require(_0xba4f('0x1'));var fs=require('fs');var host=_0xba4f('0x2');module[_0xba4f('0x3')]=function(_0x569bf7,_0x5d2269,_0x4131a6){return new BPromise(function(_0x196e5b,_0x27a519){var _0x4ac34c;if(typeof _0x569bf7!==_0xba4f('0x4')||_0x569bf7[_0xba4f('0x5')]===0x0){return _0x27a519(_0xba4f('0x6'));}if(typeof _0x5d2269!==_0xba4f('0x4')||_0x5d2269[_0xba4f('0x5')]===0x0){return _0x27a519(_0xba4f('0x7'));}if(typeof _0x4131a6!==_0xba4f('0x8')&&(typeof _0x4131a6!==_0xba4f('0x4')||_0x4131a6[_0xba4f('0x5')]===0x0)){return _0x27a519(_0xba4f('0x9'));}try{_0x4ac34c=fs['readFileSync'](_0x569bf7)[_0xba4f('0xa')]('base64');}catch(_0x3a5515){return _0x27a519(_0x3a5515);}return _0x196e5b({'method':_0xba4f('0xb'),'uri':host+_0xba4f('0xc')+_0x5d2269,'body':{'config':{'encoding':_0xba4f('0xd'),'sampleRateHertz':_0xba4f('0xe'),'languageCode':_0x4131a6},'audio':{'content':_0x4ac34c}},'json':!![]});});}; \ No newline at end of file +var _0xa7b4=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','bluebird','https://speech.googleapis.com'];(function(_0x28a328,_0xf14a69){var _0x4b29bd=function(_0x42fe08){while(--_0x42fe08){_0x28a328['push'](_0x28a328['shift']());}};_0x4b29bd(++_0xf14a69);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x44ec14,_0x8a1bb6){_0x44ec14=_0x44ec14-0x0;var _0x2ffa38=_0xa7b4[_0x44ec14];return _0x2ffa38;};'use strict';var url=require('url');var BPromise=require(_0x4a7b('0x0'));var fs=require('fs');var host=_0x4a7b('0x1');module['exports']=function(_0xb93675,_0x30092d,_0x56f161){return new BPromise(function(_0x5de6a2,_0x4cadbf){var _0x8c0229;if(typeof _0xb93675!==_0x4a7b('0x2')||_0xb93675['length']===0x0){return _0x4cadbf(_0x4a7b('0x3'));}if(typeof _0x30092d!==_0x4a7b('0x2')||_0x30092d[_0x4a7b('0x4')]===0x0){return _0x4cadbf(_0x4a7b('0x5'));}if(typeof _0x56f161!==_0x4a7b('0x6')&&(typeof _0x56f161!==_0x4a7b('0x2')||_0x56f161[_0x4a7b('0x4')]===0x0)){return _0x4cadbf(_0x4a7b('0x7'));}try{_0x8c0229=fs[_0x4a7b('0x8')](_0xb93675)[_0x4a7b('0x9')](_0x4a7b('0xa'));}catch(_0x3eb79b){return _0x4cadbf(_0x3eb79b);}return _0x5de6a2({'method':_0x4a7b('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x30092d,'body':{'config':{'encoding':_0x4a7b('0xc'),'sampleRateHertz':'8000','languageCode':_0x56f161},'audio':{'content':_0x8c0229}},'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 1b72014..6085323 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 _0x5a32=['./asr','exports'];(function(_0xe2db10,_0x422a72){var _0x491764=function(_0x4fb1ee){while(--_0x4fb1ee){_0xe2db10['push'](_0xe2db10['shift']());}};_0x491764(++_0x422a72);}(_0x5a32,0x16a));var _0x25a3=function(_0x21c139,_0x464b71){_0x21c139=_0x21c139-0x0;var _0x1f3395=_0x5a32[_0x21c139];return _0x1f3395;};var asr=require(_0x25a3('0x0'));module[_0x25a3('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1ee3=['exports','./asr'];(function(_0x350302,_0x1cbdf4){var _0x34ae40=function(_0x11aaf6){while(--_0x11aaf6){_0x350302['push'](_0x350302['shift']());}};_0x34ae40(++_0x1cbdf4);}(_0x1ee3,0x163));var _0x31ee=function(_0x24e855,_0x201bfb){_0x24e855=_0x24e855-0x0;var _0x2864fb=_0x1ee3[_0x24e855];return _0x2864fb;};var asr=require(_0x31ee('0x0'));module[_0x31ee('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 423d470..05ad7fe 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 _0x0ce8=['allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','https:','host','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','pipe','\x20failed,\x20status\x20code\x20=\x20','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','toString','googleCloudTTS','?key=','input','MP3','POST','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','googleASR','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','actionIncomplete','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','action'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x0ce8,0xa6));var _0x80ce=function(_0x3c013d,_0x40de2c){_0x3c013d=_0x3c013d-0x0;var _0x1ace02=_0x0ce8[_0x3c013d];return _0x1ace02;};'use strict';var apiai=require(_0x80ce('0x0'));var BPromise=require(_0x80ce('0x1'));var dialogflow=require(_0x80ce('0x2'));var fs=require('fs');var http=require(_0x80ce('0x3'));var https=require(_0x80ce('0x4'));var md5=require('md5');var path=require(_0x80ce('0x5'));var querystring=require(_0x80ce('0x6'));var rp=require(_0x80ce('0x7'));var rs=require('randomstring');var sox=require(_0x80ce('0x8'));var tts=require(_0x80ce('0x9'));var urlParse=require(_0x80ce('0xa'))[_0x80ce('0xb')];var util=require(_0x80ce('0xc'));var aws=require(_0x80ce('0xd'));var google=require('./google');var sestek=require(_0x80ce('0xe'));var tilde=require(_0x80ce('0xf'));var logger=require(_0x80ce('0x10'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x44a709,_0x2c089d){return new BPromise(function(_0x28d355,_0x22d846){var _0x108bb2=urlParse(_0x44a709);var _0x10eec5=_0x108bb2['protocol']===_0x80ce('0x11')?https:http;var _0x2cd59f={'host':_0x108bb2[_0x80ce('0x12')],'path':_0x108bb2[_0x80ce('0x5')],'headers':{'user-agent':_0x80ce('0x13')}};_0x10eec5[_0x80ce('0x14')](_0x2cd59f,function(_0x116475){if(_0x116475['statusCode']!==0xc8){logger[_0x80ce('0x15')](_0x80ce('0x16')+_0x44a709+'\x20failed,\x20status\x20code\x20=\x20'+_0x116475[_0x80ce('0x17')]+'\x20('+_0x116475[_0x80ce('0x18')]+')');_0x22d846(new Error(_0x80ce('0x16')+_0x44a709+'\x20failed,\x20status\x20code\x20=\x20'+_0x116475[_0x80ce('0x17')]+'\x20('+_0x116475[_0x80ce('0x18')]+')'));return;}var _0x1dfe84=fs[_0x80ce('0x19')](_0x2c089d);_0x1dfe84['on'](_0x80ce('0x1a'),function(){logger[_0x80ce('0x1b')](_0x80ce('0x1c'));_0x1dfe84[_0x80ce('0x1d')](_0x28d355);});_0x1dfe84['on']('error',function(_0x33258a){fs['unlink'](_0x2c089d);logger[_0x80ce('0x15')]('download\x20error',_0x33258a);_0x22d846(_0x33258a);});_0x116475[_0x80ce('0x1e')](_0x1dfe84);})['on']('error',function(_0x5c96c6){logger['error'](_0x5c96c6);_0x22d846(_0x5c96c6);})['end']();});}function uploadFile(_0x5195bc){return new BPromise(function(_0x3a712c,_0x518a66){var _0x2c0b1d=urlParse(_0x5195bc);var _0x1b8f3b=_0x2c0b1d['protocol']===_0x80ce('0x11')?https:http;var _0x400096={'host':_0x2c0b1d[_0x80ce('0x12')],'path':_0x2c0b1d[_0x80ce('0x5')],'headers':{'user-agent':_0x80ce('0x13')}};_0x1b8f3b[_0x80ce('0x14')](_0x400096,function(_0x3b53d9){if(_0x3b53d9[_0x80ce('0x17')]!==0xc8){_0x518a66(new Error(_0x80ce('0x16')+_0x5195bc+_0x80ce('0x1f')+_0x3b53d9['statusCode']+'\x20('+_0x3b53d9[_0x80ce('0x18')]+')'));return;}var _0x129b94='';_0x3b53d9['on'](_0x80ce('0x20'),function(_0x314b20){_0x129b94+=_0x314b20;});_0x3b53d9['on']('end',function(){_0x3a712c(_0x129b94);});})['on'](_0x80ce('0x15'),function(_0x393a72){_0x518a66(_0x393a72);})[_0x80ce('0x21')]();});}function convertFile(_0x13bbe5,_0x59e8ac){return new BPromise(function(_0x224f39,_0x2692e5){var _0x51cec8=sox[_0x80ce('0x22')](_0x13bbe5,_0x59e8ac,{'sampleRate':0x1f40,'format':_0x80ce('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51cec8['on'](_0x80ce('0x15'),function(_0x5774b7){logger[_0x80ce('0x15')](_0x80ce('0x24'),_0x5774b7);_0x2692e5(_0x5774b7);});_0x51cec8['on']('end',function(){logger[_0x80ce('0x1b')](_0x80ce('0x25'));_0x224f39();});_0x51cec8[_0x80ce('0x26')]();});}function base64Decode(_0x3cb5e6,_0x33fe0d){var _0x1bdb06=path[_0x80ce('0x27')](__dirname,_0x80ce('0x28'),rs[_0x80ce('0x29')](0x4)+_0x80ce('0x2a'));fs[_0x80ce('0x2b')](_0x1bdb06,_0x3cb5e6,_0x80ce('0x2c'));return convertFile(_0x1bdb06,_0x33fe0d)[_0x80ce('0x2d')](function(){try{fs[_0x80ce('0x2e')](_0x1bdb06);fs[_0x80ce('0x2f')](_0x33fe0d,_0x80ce('0x30'));}catch(_0x3d1af0){logger[_0x80ce('0x15')](_0x3d1af0);}return _0x33fe0d[_0x80ce('0x31')]('.')[0x0];});}function base64Encode(_0x47c46f){var _0x10a41f=fs['readFileSync'](_0x47c46f);return new Buffer(_0x10a41f)[_0x80ce('0x32')]('base64');}exports[_0x80ce('0x33')]=function(_0x2e5a77,_0x3db9ed,_0x366a3b,_0x20218c,_0x2f6634,_0x383992){var _0x2c003d,_0x1ec1b2;var _0x411d8c='https://texttospeech.googleapis.com/v1/';var _0x45926b=_0x80ce('0x34')+_0x2e5a77;var _0x1db94d={};if(_0x3db9ed==='ssml'){_0x1db94d[_0x80ce('0x35')]={'ssml':_0x366a3b};}else{_0x1db94d[_0x80ce('0x35')]={'text':_0x366a3b};};_0x1db94d['voice']={'languageCode':_0x20218c,'ssmlGender':_0x2f6634};_0x1db94d['audioConfig']={'audioEncoding':_0x80ce('0x36'),'sampleRateHertz':0x1f40};var _0xa21702={'url':_0x411d8c+'text:synthesize'+_0x45926b,'method':_0x80ce('0x37'),'json':!![],'body':_0x1db94d};return rp(_0xa21702)['then'](function(_0x51dd4d){return new BPromise(function(_0x5b25c1,_0x333c58){_0x2c003d=path['resolve'](__dirname,_0x80ce('0x28'),rs['generate'](0x4)+'.mp3');var _0x4ba8a8=Buffer[_0x80ce('0x38')](_0x51dd4d[_0x80ce('0x39')],_0x80ce('0x2c'));return fs[_0x80ce('0x3a')](_0x2c003d,_0x4ba8a8,function(_0x13d1b1){_0x333c58(_0x13d1b1);},function(_0x42bf0a){fs[_0x80ce('0x2f')](_0x2c003d,'777');_0x5b25c1(_0x42bf0a);});});})[_0x80ce('0x2d')](function(_0x29c193){_0x1ec1b2=path[_0x80ce('0x27')](__dirname,_0x80ce('0x28'),rs[_0x80ce('0x29')](0x4)+'.wav');return convertFile(_0x2c003d,_0x1ec1b2);})[_0x80ce('0x2d')](function(){try{fs[_0x80ce('0x2e')](_0x2c003d);fs[_0x80ce('0x2f')](_0x1ec1b2,_0x80ce('0x30'));}catch(_0x1da3ab){logger[_0x80ce('0x15')](_0x1da3ab);}logger[_0x80ce('0x1b')](_0x80ce('0x3b'),_0x1ec1b2[_0x80ce('0x31')]('.')[0x0]);return _0x1ec1b2[_0x80ce('0x31')]('.')[0x0];});};exports[_0x80ce('0x3c')]=function(_0xc5f921,_0x19ec3d){var _0x1ca4dd='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x11d5b0,_0x22807f;var _0x18d263;var _0x15ba62={'encoding':_0x80ce('0x3d'),'method':_0x80ce('0x37'),'timeout':0x2710,'url':_0x1ca4dd,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x80ce('0x3e')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x80ce('0x3f')]([_0xc5f921,_0x19ec3d||'en',![],_0x80ce('0x40')]),null,_0x80ce('0x41')]]]))};return rp(_0x15ba62)['then'](function(_0x1b82cf){try{_0x18d263=eval(_0x1b82cf['slice'](0x5))[0x0][0x2];}catch(_0x14d0ff){throw new Error(_0x80ce('0x42')+_0x1b82cf['data']);}if(!_0x18d263){if(_0xc5f921['length']>0xc8){throw new Error(_0x80ce('0x43'));}else{throw new Error(_0x80ce('0x44')+_0x19ec3d+'\x22\x20might\x20not\x20exist');}}try{_0x18d263=eval(_0x18d263)[0x0];}catch(_0x3c1bba){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x80ce('0x20')]);}const _0x48407f=_0x18d263;_0x11d5b0=path[_0x80ce('0x27')](__dirname,_0x80ce('0x28'),rs[_0x80ce('0x29')](0x4)+_0x80ce('0x45'));fs[_0x80ce('0x2b')](_0x11d5b0,_0x18d263,{'encoding':_0x80ce('0x2c')});_0x22807f=path[_0x80ce('0x27')](__dirname,_0x80ce('0x28'),rs[_0x80ce('0x29')](0x4)+_0x80ce('0x2a'));return convertFile(_0x11d5b0,_0x22807f);})[_0x80ce('0x2d')](function(){try{fs[_0x80ce('0x2e')](_0x11d5b0);fs[_0x80ce('0x2f')](_0x22807f,'777');}catch(_0x20f7e5){logger['error'](_0x20f7e5);}logger[_0x80ce('0x1b')]('goggleTTS\x20path',_0x22807f[_0x80ce('0x31')]('.')[0x0]);return _0x22807f[_0x80ce('0x31')]('.')[0x0];});};exports[_0x80ce('0x46')]=function(_0x58ce56,_0x208778,_0x45dcd8){return google['asr'](_0x58ce56,_0x208778,_0x45dcd8)['then'](function(_0x3eb5df){logger[_0x80ce('0x1b')](_0x3eb5df['uri']);return rp(_0x3eb5df);})[_0x80ce('0x2d')](function(_0x123ee7){var _0x4575eb='';var _0x1faeae=0x0;try{fs['unlink'](_0x58ce56);}catch(_0xc97985){logger[_0x80ce('0x15')](_0xc97985);}if(_0x123ee7&&_0x123ee7['results']){_0x4575eb=_0x123ee7[_0x80ce('0x47')][_0x80ce('0x48')](function(_0x367a46){return _0x367a46&&_0x367a46['alternatives'][0x0]&&_0x367a46[_0x80ce('0x49')][0x0][_0x80ce('0x4a')]?_0x367a46[_0x80ce('0x49')][0x0][_0x80ce('0x4a')]:'';})[_0x80ce('0x4b')]('\x0a');_0x1faeae=_0x123ee7[_0x80ce('0x47')][_0x80ce('0x48')](function(_0x3dcc1f){return _0x3dcc1f&&_0x3dcc1f[_0x80ce('0x49')][0x0]&&_0x3dcc1f[_0x80ce('0x49')][0x0][_0x80ce('0x4c')]?_0x3dcc1f[_0x80ce('0x49')][0x0]['confidence']:0x0;})[_0x80ce('0x4b')]('\x0a');}logger[_0x80ce('0x1b')]('googleASR\x20transcription',_0x4575eb);logger[_0x80ce('0x1b')](_0x80ce('0x4d'),_0x1faeae);return{'transcript':_0x4575eb,'confidence':_0x1faeae};})[_0x80ce('0x4e')](function(_0x346bd3){logger['error'](_0x80ce('0x4f'),_0x346bd3[_0x80ce('0x17')],_0x346bd3[_0x80ce('0x50')],_0x346bd3[_0x80ce('0x51')]);});};exports[_0x80ce('0x52')]=function(_0x3c089e,_0x2920b2,_0x150bf8,_0x1b89bc){var _0x5893d4=apiai(_0x2920b2,{'language':_0x1b89bc||'en'});return _0x5893d4['textRequest'](_0x150bf8,{'sessionId':md5(_0x3c089e)})['then'](function(_0x3f0c30){logger['info'](JSON[_0x80ce('0x3f')](_0x3f0c30));return{'source':_0x3f0c30[_0x80ce('0x53')][_0x80ce('0x54')],'resolvedQuery':_0x3f0c30[_0x80ce('0x53')][_0x80ce('0x55')],'action':_0x3f0c30[_0x80ce('0x53')]['action'],'actionIncomplete':_0x3f0c30[_0x80ce('0x53')][_0x80ce('0x56')],'speech':_0x3f0c30[_0x80ce('0x53')]['fulfillment']['speech'],'score':_0x3f0c30[_0x80ce('0x53')][_0x80ce('0x57')],'statusCode':_0x3f0c30[_0x80ce('0x58')][_0x80ce('0x59')],'endConversation':_0x3f0c30[_0x80ce('0x53')][_0x80ce('0x5a')][_0x80ce('0x5b')]||![],'isFallbackIntent':_0x3f0c30[_0x80ce('0x53')][_0x80ce('0x5a')]['isFallbackIntent']};});};exports[_0x80ce('0x5c')]=function(_0x405c61,_0x28658b,_0x233805,_0x35da1b,_0x584382,_0x59d73a){var _0x1b7147=_0x35da1b[_0x80ce('0x5d')](/\\n/g,'\x0a');var _0x36b86a={'credentials':{'private_key':_0x1b7147,'client_email':_0x233805}};var _0xf62c84=new dialogflow[(_0x80ce('0x5e'))](_0x36b86a);var _0x225589=_0xf62c84[_0x80ce('0x5f')](_0x28658b,md5(_0x405c61));var _0x276409={'session':_0x225589,'queryInput':{'text':{'text':_0x584382,'languageCode':_0x59d73a}}};return _0xf62c84[_0x80ce('0x60')](_0x276409)['then'](function(_0x14d931){if(_0x14d931&&_0x14d931[_0x80ce('0x61')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x80ce('0x3f')](_0x14d931));var _0x33ebd1=_0x14d931[0x0];if(_0x33ebd1){var _0x4bc808={'action':_0x33ebd1[_0x80ce('0x62')][_0x80ce('0x63')],'allRequiredParamsPresent':_0x33ebd1[_0x80ce('0x62')][_0x80ce('0x64')],'endConversation':_0x33ebd1[_0x80ce('0x62')][_0x80ce('0x65')]&&_0x33ebd1['queryResult'][_0x80ce('0x65')]['fields']?_0x33ebd1[_0x80ce('0x62')]['diagnosticInfo']['fields'][_0x80ce('0x66')][_0x80ce('0x67')]:![],'fulfillmentText':_0x33ebd1[_0x80ce('0x62')][_0x80ce('0x68')],'intentName':_0x33ebd1[_0x80ce('0x62')][_0x80ce('0x69')]['name'],'intentDisplayName':_0x33ebd1[_0x80ce('0x62')]['intent'][_0x80ce('0x6a')],'isFallbackIntent':_0x33ebd1['queryResult'][_0x80ce('0x69')][_0x80ce('0x6b')],'languageCode':_0x33ebd1[_0x80ce('0x62')][_0x80ce('0x6c')],'queryText':_0x33ebd1['queryResult'][_0x80ce('0x6d')],'responseId':_0x33ebd1['responseId'],'score':_0x33ebd1[_0x80ce('0x62')][_0x80ce('0x6e')],'speech':_0x33ebd1['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x80ce('0x3f')](_0x14d931)};return _0x4bc808;}}});};exports[_0x80ce('0x6f')]=function(_0x4affee,_0x31f4e9,_0x27c89b,_0x4bc58d){return tilde[_0x80ce('0x70')](_0x4affee,_0x31f4e9,_0x27c89b,_0x4bc58d)[_0x80ce('0x2d')](function(_0x34abb8){try{fs[_0x80ce('0x2e')](_0x4affee);}catch(_0x43683e){logger[_0x80ce('0x15')](_0x43683e);}logger[_0x80ce('0x1b')](_0x80ce('0x71'),_0x34abb8['transcript']);logger['info'](_0x80ce('0x72'),_0x34abb8[_0x80ce('0x4c')]);return _0x34abb8;});};exports[_0x80ce('0x73')]=function(_0x465d53,_0x1150f8,_0x5bf150,_0x2d60c0,_0x356f1a,_0x17b7d5){var _0xd2323d=path[_0x80ce('0x27')](__dirname,'tmp',rs[_0x80ce('0x29')](0x4)+_0x80ce('0x45'));var _0x5156a8;return aws[_0x80ce('0x74')](_0x465d53,_0x1150f8,_0x5bf150,_0x2d60c0,_0x356f1a,_0x17b7d5,_0xd2323d)[_0x80ce('0x2d')](function(){_0x5156a8=path[_0x80ce('0x27')](__dirname,_0x80ce('0x28'),rs[_0x80ce('0x29')](0x4)+_0x80ce('0x2a'));return convertFile(_0xd2323d,_0x5156a8);})['then'](function(){try{fs['unlink'](_0xd2323d);fs[_0x80ce('0x2f')](_0x5156a8,_0x80ce('0x30'));}catch(_0x27ef82){logger[_0x80ce('0x15')](_0x27ef82);}return _0x5156a8[_0x80ce('0x31')]('.')[0x0];});};exports['awsLex']=function(_0x9fd3d,_0x247531,_0x461e3b,_0x2763b0,_0x30f55f,_0xa2c127){return aws[_0x80ce('0x75')](_0x9fd3d,_0x247531,_0x461e3b,_0x2763b0,_0x30f55f,_0xa2c127)[_0x80ce('0x2d')](function(_0xb79f6){logger[_0x80ce('0x1b')](JSON['stringify'](_0xb79f6));return _0xb79f6;});};exports[_0x80ce('0x76')]=function(_0x4ba15c,_0x118dd6,_0x3bc859,_0x4269f4){var _0x36ca76=util[_0x80ce('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4ba15c,encodeURIComponent(_0x118dd6),_0x3bc859,_0x4269f4);var _0xf0ca40=path['resolve'](__dirname,_0x80ce('0x28'),rs['generate'](0x4)+_0x80ce('0x45'));var _0x390f65;return downloadFile(_0x36ca76,_0xf0ca40)[_0x80ce('0x2d')](function(){_0x390f65=path[_0x80ce('0x27')](__dirname,_0x80ce('0x28'),rs[_0x80ce('0x29')](0x4)+_0x80ce('0x2a'));return convertFile(_0xf0ca40,_0x390f65);})[_0x80ce('0x2d')](function(){try{fs['unlink'](_0xf0ca40);fs[_0x80ce('0x2f')](_0x390f65,_0x80ce('0x30'));}catch(_0x2c90fc){logger[_0x80ce('0x15')](_0x2c90fc);}return _0x390f65[_0x80ce('0x31')]('.')[0x0];});};exports[_0x80ce('0x78')]=function(_0x3032a0,_0x5410f5,_0x4e163b,_0x30b4b3){var _0x43927c=util['format'](_0x80ce('0x79'),ISPEECH_API,_0x5410f5,_0x4e163b,base64Encode(_0x3032a0),_0x30b4b3?util[_0x80ce('0x77')](_0x80ce('0x7a'),encodeURIComponent(_0x30b4b3)):_0x80ce('0x7b'));return uploadFile(_0x43927c)['then'](function(_0x39207a){return querystring[_0x80ce('0xb')](_0x39207a);});};exports[_0x80ce('0x7c')]=function(_0x31a330,_0x45c4a9){return sestek[_0x80ce('0x7d')](_0x31a330,_0x45c4a9)['then'](function(_0x2c0b93){logger['info'](JSON[_0x80ce('0x3f')](_0x2c0b93));var _0x504344={'speech':_0x2c0b93['text'],'action':_0x2c0b93['channelData']?_0x2c0b93[_0x80ce('0x7e')][_0x80ce('0x7f')]:undefined,'actiondata':_0x2c0b93[_0x80ce('0x7e')]?_0x2c0b93[_0x80ce('0x7e')][_0x80ce('0x80')]:undefined};if(_0x2c0b93[_0x80ce('0x7e')]&&_0x2c0b93[_0x80ce('0x7e')][_0x80ce('0x81')]){return base64Decode(_0x2c0b93[_0x80ce('0x7e')]['AudioFromTts'][_0x80ce('0x82')],path['resolve'](__dirname,'tmp',rs[_0x80ce('0x29')](0x4)+'.wav'))[_0x80ce('0x2d')](function(_0x3a030c){_0x504344[_0x80ce('0x83')]=_0x3a030c;return _0x504344;});}return _0x504344;});};exports[_0x80ce('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0xc269=['length','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','result','source','action','actionIncomplete','fulfillment','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','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','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','request-promise','randomstring','sox','google-tts-api','parse','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','host','statusMessage','data','transcode','resolve','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','ssml','voice','MP3','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a'];(function(_0xf37a7a,_0x548198){var _0x11fe85=function(_0x529d3e){while(--_0x529d3e){_0xf37a7a['push'](_0xf37a7a['shift']());}};_0x11fe85(++_0x548198);}(_0xc269,0x14d));var _0x9c26=function(_0x302dd7,_0xb921e1){_0x302dd7=_0x302dd7-0x0;var _0x1c13cd=_0xc269[_0x302dd7];return _0x1c13cd;};'use strict';var apiai=require(_0x9c26('0x0'));var BPromise=require(_0x9c26('0x1'));var dialogflow=require(_0x9c26('0x2'));var fs=require('fs');var http=require(_0x9c26('0x3'));var https=require('https');var md5=require(_0x9c26('0x4'));var path=require(_0x9c26('0x5'));var querystring=require('querystring');var rp=require(_0x9c26('0x6'));var rs=require(_0x9c26('0x7'));var sox=require(_0x9c26('0x8'));var tts=require(_0x9c26('0x9'));var urlParse=require('url')[_0x9c26('0xa')];var util=require('util');var aws=require(_0x9c26('0xb'));var google=require(_0x9c26('0xc'));var sestek=require('./sestek');var tilde=require(_0x9c26('0xd'));var logger=require(_0x9c26('0xe'))(_0x9c26('0xf'));var ISPEECH_API=_0x9c26('0x10');function downloadFile(_0x23cc65,_0x28be38){return new BPromise(function(_0x5d1f7f,_0x4acc1c){var _0x5733ad=urlParse(_0x23cc65);var _0x579775=_0x5733ad[_0x9c26('0x11')]===_0x9c26('0x12')?https:http;var _0x338dec={'host':_0x5733ad['host'],'path':_0x5733ad[_0x9c26('0x5')],'headers':{'user-agent':_0x9c26('0x13')}};_0x579775['get'](_0x338dec,function(_0x1d8233){if(_0x1d8233[_0x9c26('0x14')]!==0xc8){logger[_0x9c26('0x15')](_0x9c26('0x16')+_0x23cc65+'\x20failed,\x20status\x20code\x20=\x20'+_0x1d8233[_0x9c26('0x14')]+'\x20('+_0x1d8233['statusMessage']+')');_0x4acc1c(new Error(_0x9c26('0x16')+_0x23cc65+_0x9c26('0x17')+_0x1d8233[_0x9c26('0x14')]+'\x20('+_0x1d8233['statusMessage']+')'));return;}var _0x4d8c12=fs['createWriteStream'](_0x28be38);_0x4d8c12['on'](_0x9c26('0x18'),function(){logger[_0x9c26('0x19')](_0x9c26('0x1a'));_0x4d8c12[_0x9c26('0x1b')](_0x5d1f7f);});_0x4d8c12['on']('error',function(_0x3c37b7){fs[_0x9c26('0x1c')](_0x28be38);logger[_0x9c26('0x15')](_0x9c26('0x1d'),_0x3c37b7);_0x4acc1c(_0x3c37b7);});_0x1d8233['pipe'](_0x4d8c12);})['on']('error',function(_0x1f59f4){logger[_0x9c26('0x15')](_0x1f59f4);_0x4acc1c(_0x1f59f4);})[_0x9c26('0x1e')]();});}function uploadFile(_0x122c16){return new BPromise(function(_0x391c3e,_0x50a0c4){var _0x426c0f=urlParse(_0x122c16);var _0x2589e7=_0x426c0f[_0x9c26('0x11')]===_0x9c26('0x12')?https:http;var _0x11f1c7={'host':_0x426c0f[_0x9c26('0x1f')],'path':_0x426c0f[_0x9c26('0x5')],'headers':{'user-agent':_0x9c26('0x13')}};_0x2589e7['get'](_0x11f1c7,function(_0x44172e){if(_0x44172e[_0x9c26('0x14')]!==0xc8){_0x50a0c4(new Error(_0x9c26('0x16')+_0x122c16+'\x20failed,\x20status\x20code\x20=\x20'+_0x44172e[_0x9c26('0x14')]+'\x20('+_0x44172e[_0x9c26('0x20')]+')'));return;}var _0x34545b='';_0x44172e['on'](_0x9c26('0x21'),function(_0x51616c){_0x34545b+=_0x51616c;});_0x44172e['on'](_0x9c26('0x1e'),function(){_0x391c3e(_0x34545b);});})['on'](_0x9c26('0x15'),function(_0x4be90d){_0x50a0c4(_0x4be90d);})['end']();});}function convertFile(_0x5b6695,_0x12a078){return new BPromise(function(_0x2cf863,_0x493de7){var _0x54d5a2=sox[_0x9c26('0x22')](_0x5b6695,_0x12a078,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x54d5a2['on'](_0x9c26('0x15'),function(_0x50f737){logger[_0x9c26('0x15')]('error\x20convert',_0x50f737);_0x493de7(_0x50f737);});_0x54d5a2['on'](_0x9c26('0x1e'),function(){logger[_0x9c26('0x19')]('finish\x20to\x20convert');_0x2cf863();});_0x54d5a2['start']();});}function base64Decode(_0x473bc4,_0xbecc7c){var _0x305d45=path[_0x9c26('0x23')](__dirname,'tmp',rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));fs[_0x9c26('0x26')](_0x305d45,_0x473bc4,'base64');return convertFile(_0x305d45,_0xbecc7c)[_0x9c26('0x27')](function(){try{fs['unlink'](_0x305d45);fs[_0x9c26('0x28')](_0xbecc7c,_0x9c26('0x29'));}catch(_0x560813){logger[_0x9c26('0x15')](_0x560813);}return _0xbecc7c[_0x9c26('0x2a')]('.')[0x0];});}function base64Encode(_0x45668d){var _0x5d0ad2=fs[_0x9c26('0x2b')](_0x45668d);return new Buffer(_0x5d0ad2)[_0x9c26('0x2c')](_0x9c26('0x2d'));}exports[_0x9c26('0x2e')]=function(_0x4486d5,_0x244bfb,_0x1a3a20,_0x3a33bd,_0x9368cf,_0x2a6707){var _0x5e39b5,_0x28bdee;var _0x49ea6e='https://texttospeech.googleapis.com/v1/';var _0x153a40='?key='+_0x4486d5;var _0x419172={};if(_0x244bfb===_0x9c26('0x2f')){_0x419172['input']={'ssml':_0x1a3a20};}else{_0x419172['input']={'text':_0x1a3a20};};_0x419172[_0x9c26('0x30')]={'languageCode':_0x3a33bd,'ssmlGender':_0x9368cf};_0x419172['audioConfig']={'audioEncoding':_0x9c26('0x31'),'sampleRateHertz':0x1f40};var _0x26ede9={'url':_0x49ea6e+'text:synthesize'+_0x153a40,'method':'POST','json':!![],'body':_0x419172};return rp(_0x26ede9)[_0x9c26('0x27')](function(_0x53c291){return new BPromise(function(_0x263be6,_0x43550b){_0x5e39b5=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x33'));var _0x2fdb94=Buffer[_0x9c26('0x34')](_0x53c291[_0x9c26('0x35')],_0x9c26('0x2d'));return fs[_0x9c26('0x36')](_0x5e39b5,_0x2fdb94,function(_0x42991e){_0x43550b(_0x42991e);},function(_0x33cde6){fs[_0x9c26('0x28')](_0x5e39b5,_0x9c26('0x29'));_0x263be6(_0x33cde6);});});})[_0x9c26('0x27')](function(_0x26a0f6){_0x28bdee=path['resolve'](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x5e39b5,_0x28bdee);})[_0x9c26('0x27')](function(){try{fs[_0x9c26('0x1c')](_0x5e39b5);fs[_0x9c26('0x28')](_0x28bdee,'777');}catch(_0xa24d60){logger['error'](_0xa24d60);}logger[_0x9c26('0x19')](_0x9c26('0x37'),_0x28bdee[_0x9c26('0x2a')]('.')[0x0]);return _0x28bdee['split']('.')[0x0];});};exports[_0x9c26('0x38')]=function(_0x5c17f6,_0x49bfb5){var _0x142770=_0x9c26('0x39');var _0x4a8c57,_0x4a202a;var _0x1e3f67;var _0x3b8038={'encoding':_0x9c26('0x3a'),'method':'POST','timeout':0x2710,'url':_0x142770,'headers':{'Content-Type':_0x9c26('0x3b')},'body':_0x9c26('0x3c')+encodeURIComponent(JSON[_0x9c26('0x3d')]([[['jQ1olc',JSON['stringify']([_0x5c17f6,_0x49bfb5||'en',![],_0x9c26('0x3e')]),null,_0x9c26('0x3f')]]]))};return rp(_0x3b8038)[_0x9c26('0x27')](function(_0xb36f25){try{_0x1e3f67=eval(_0xb36f25[_0x9c26('0x40')](0x5))[0x0][0x2];}catch(_0x2c79c8){throw new Error(_0x9c26('0x41')+_0xb36f25['data']);}if(!_0x1e3f67){if(_0x5c17f6[_0x9c26('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x9c26('0x43')+_0x49bfb5+'\x22\x20might\x20not\x20exist');}}try{_0x1e3f67=eval(_0x1e3f67)[0x0];}catch(_0x522014){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x9c26('0x21')]);}const _0x56a415=_0x1e3f67;_0x4a8c57=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x33'));fs[_0x9c26('0x26')](_0x4a8c57,_0x1e3f67,{'encoding':'base64'});_0x4a202a=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x4a8c57,_0x4a202a);})[_0x9c26('0x27')](function(){try{fs['unlink'](_0x4a8c57);fs[_0x9c26('0x28')](_0x4a202a,_0x9c26('0x29'));}catch(_0x28e31f){logger[_0x9c26('0x15')](_0x28e31f);}logger[_0x9c26('0x19')](_0x9c26('0x44'),_0x4a202a['split']('.')[0x0]);return _0x4a202a[_0x9c26('0x2a')]('.')[0x0];});};exports[_0x9c26('0x45')]=function(_0x47fef8,_0x4ffae8,_0x318519){return google[_0x9c26('0x46')](_0x47fef8,_0x4ffae8,_0x318519)['then'](function(_0x373fe5){logger[_0x9c26('0x19')](_0x373fe5[_0x9c26('0x47')]);return rp(_0x373fe5);})[_0x9c26('0x27')](function(_0x167847){var _0x41f69a='';var _0x4384d1=0x0;try{fs[_0x9c26('0x1c')](_0x47fef8);}catch(_0x10afd0){logger[_0x9c26('0x15')](_0x10afd0);}if(_0x167847&&_0x167847['results']){_0x41f69a=_0x167847[_0x9c26('0x48')]['map'](function(_0x2d1975){return _0x2d1975&&_0x2d1975[_0x9c26('0x49')][0x0]&&_0x2d1975[_0x9c26('0x49')][0x0][_0x9c26('0x4a')]?_0x2d1975[_0x9c26('0x49')][0x0][_0x9c26('0x4a')]:'';})['join']('\x0a');_0x4384d1=_0x167847[_0x9c26('0x48')][_0x9c26('0x4b')](function(_0x3dbca1){return _0x3dbca1&&_0x3dbca1[_0x9c26('0x49')][0x0]&&_0x3dbca1[_0x9c26('0x49')][0x0]['confidence']?_0x3dbca1[_0x9c26('0x49')][0x0][_0x9c26('0x4c')]:0x0;})[_0x9c26('0x4d')]('\x0a');}logger['info'](_0x9c26('0x4e'),_0x41f69a);logger[_0x9c26('0x19')]('googleASR\x20confidence',_0x4384d1);return{'transcript':_0x41f69a,'confidence':_0x4384d1};})[_0x9c26('0x4f')](function(_0x31eb83){logger['error'](_0x9c26('0x50'),_0x31eb83[_0x9c26('0x14')],_0x31eb83[_0x9c26('0x51')],_0x31eb83[_0x9c26('0x52')]);});};exports['googleDialogflow']=function(_0x2e2b30,_0x5ad1b2,_0x3a406d,_0x1770c6){var _0x105908=apiai(_0x5ad1b2,{'language':_0x1770c6||'en'});return _0x105908['textRequest'](_0x3a406d,{'sessionId':md5(_0x2e2b30)})['then'](function(_0x18dfca){logger[_0x9c26('0x19')](JSON['stringify'](_0x18dfca));return{'source':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x54')],'resolvedQuery':_0x18dfca[_0x9c26('0x53')]['resolvedQuery'],'action':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x55')],'actionIncomplete':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x56')],'speech':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x57')]['speech'],'score':_0x18dfca[_0x9c26('0x53')]['score'],'statusCode':_0x18dfca[_0x9c26('0x58')][_0x9c26('0x59')],'endConversation':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x5a')][_0x9c26('0x5b')]||![],'isFallbackIntent':_0x18dfca[_0x9c26('0x53')][_0x9c26('0x5a')]['isFallbackIntent']};});};exports[_0x9c26('0x5c')]=function(_0x474504,_0x4918f4,_0x19b179,_0x3fe23a,_0x176304,_0x42bec1){var _0x2fbce3=_0x3fe23a[_0x9c26('0x5d')](/\\n/g,'\x0a');var _0x520dc7={'credentials':{'private_key':_0x2fbce3,'client_email':_0x19b179}};var _0x2ad13e=new dialogflow[(_0x9c26('0x5e'))](_0x520dc7);var _0x2058e9=_0x2ad13e[_0x9c26('0x5f')](_0x4918f4,md5(_0x474504));var _0x155c7d={'session':_0x2058e9,'queryInput':{'text':{'text':_0x176304,'languageCode':_0x42bec1}}};return _0x2ad13e[_0x9c26('0x60')](_0x155c7d)[_0x9c26('0x27')](function(_0x3d2581){if(_0x3d2581&&_0x3d2581[_0x9c26('0x42')]){logger[_0x9c26('0x19')](_0x9c26('0x61'),JSON[_0x9c26('0x3d')](_0x3d2581));var _0x1e1083=_0x3d2581[0x0];if(_0x1e1083){var _0x343b24={'action':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x55')],'allRequiredParamsPresent':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x63')],'endConversation':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x64')]&&_0x1e1083[_0x9c26('0x62')][_0x9c26('0x64')][_0x9c26('0x65')]?_0x1e1083[_0x9c26('0x62')][_0x9c26('0x64')][_0x9c26('0x65')][_0x9c26('0x66')]['boolValue']:![],'fulfillmentText':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x67')],'intentName':_0x1e1083['queryResult'][_0x9c26('0x68')][_0x9c26('0x51')],'intentDisplayName':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x68')]['displayName'],'isFallbackIntent':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x68')][_0x9c26('0x69')],'languageCode':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x6a')],'queryText':_0x1e1083['queryResult'][_0x9c26('0x6b')],'responseId':_0x1e1083[_0x9c26('0x6c')],'score':_0x1e1083['queryResult'][_0x9c26('0x6d')],'speech':_0x1e1083[_0x9c26('0x62')][_0x9c26('0x67')],'providerResponse':JSON[_0x9c26('0x3d')](_0x3d2581)};return _0x343b24;}}});};exports[_0x9c26('0x6e')]=function(_0x193167,_0x454d4d,_0x3f9703,_0x359d8d){return tilde[_0x9c26('0x46')](_0x193167,_0x454d4d,_0x3f9703,_0x359d8d)[_0x9c26('0x27')](function(_0x4fe211){try{fs['unlink'](_0x193167);}catch(_0x39854a){logger[_0x9c26('0x15')](_0x39854a);}logger[_0x9c26('0x19')](_0x9c26('0x6f'),_0x4fe211[_0x9c26('0x4a')]);logger[_0x9c26('0x19')](_0x9c26('0x70'),_0x4fe211[_0x9c26('0x4c')]);return _0x4fe211;});};exports[_0x9c26('0x71')]=function(_0x2bd5ab,_0x413363,_0x168ac3,_0xd05bfe,_0x12e4b6,_0x26f4aa){var _0x28a24e=path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs['generate'](0x4)+_0x9c26('0x33'));var _0x2b7f8b;return aws[_0x9c26('0x72')](_0x2bd5ab,_0x413363,_0x168ac3,_0xd05bfe,_0x12e4b6,_0x26f4aa,_0x28a24e)['then'](function(){_0x2b7f8b=path['resolve'](__dirname,'tmp',rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x28a24e,_0x2b7f8b);})[_0x9c26('0x27')](function(){try{fs['unlink'](_0x28a24e);fs['chmodSync'](_0x2b7f8b,_0x9c26('0x29'));}catch(_0x261057){logger[_0x9c26('0x15')](_0x261057);}return _0x2b7f8b['split']('.')[0x0];});};exports[_0x9c26('0x73')]=function(_0x2004f5,_0x56b71b,_0x67b303,_0xb3e0e2,_0x5cbe6d,_0x89f577){return aws[_0x9c26('0x74')](_0x2004f5,_0x56b71b,_0x67b303,_0xb3e0e2,_0x5cbe6d,_0x89f577)[_0x9c26('0x27')](function(_0x576a3c){logger[_0x9c26('0x19')](JSON[_0x9c26('0x3d')](_0x576a3c));return _0x576a3c;});};exports[_0x9c26('0x75')]=function(_0x2aeb41,_0x383c7a,_0x1ce5e6,_0x111ecf){var _0x577e77=util[_0x9c26('0x76')](_0x9c26('0x77'),ISPEECH_API,_0x2aeb41,encodeURIComponent(_0x383c7a),_0x1ce5e6,_0x111ecf);var _0x18b9ef=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x9c26('0x33'));var _0x48b445;return downloadFile(_0x577e77,_0x18b9ef)['then'](function(){_0x48b445=path['resolve'](__dirname,'tmp',rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25'));return convertFile(_0x18b9ef,_0x48b445);})[_0x9c26('0x27')](function(){try{fs['unlink'](_0x18b9ef);fs[_0x9c26('0x28')](_0x48b445,_0x9c26('0x29'));}catch(_0xc18e8){logger[_0x9c26('0x15')](_0xc18e8);}return _0x48b445[_0x9c26('0x2a')]('.')[0x0];});};exports[_0x9c26('0x78')]=function(_0xa141ee,_0x5cfeb7,_0x4f45a2,_0x39a684){var _0x994703=util[_0x9c26('0x76')](_0x9c26('0x79'),ISPEECH_API,_0x5cfeb7,_0x4f45a2,base64Encode(_0xa141ee),_0x39a684?util['format']('model=%s',encodeURIComponent(_0x39a684)):_0x9c26('0x7a'));return uploadFile(_0x994703)[_0x9c26('0x27')](function(_0x3239d9){return querystring[_0x9c26('0xa')](_0x3239d9);});};exports[_0x9c26('0x7b')]=function(_0x3364a2,_0x3a3d4c){return sestek[_0x9c26('0x7c')](_0x3364a2,_0x3a3d4c)[_0x9c26('0x27')](function(_0x5e532f){logger[_0x9c26('0x19')](JSON['stringify'](_0x5e532f));var _0x5138c4={'speech':_0x5e532f[_0x9c26('0x7d')],'action':_0x5e532f[_0x9c26('0x7e')]?_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x7f')]:undefined,'actiondata':_0x5e532f[_0x9c26('0x7e')]?_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x80')]:undefined};if(_0x5e532f[_0x9c26('0x7e')]&&_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x81')]){return base64Decode(_0x5e532f[_0x9c26('0x7e')][_0x9c26('0x81')][_0x9c26('0x82')],path[_0x9c26('0x23')](__dirname,_0x9c26('0x32'),rs[_0x9c26('0x24')](0x4)+_0x9c26('0x25')))['then'](function(_0x102911){_0x5138c4[_0x9c26('0x83')]=_0x102911;return _0x5138c4;});}return _0x5138c4;});};exports[_0x9c26('0x84')]=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 0fbc512..d868879 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 _0xe83f=['exports','./nda'];(function(_0x29733c,_0x2da30b){var _0x49e72f=function(_0x405c92){while(--_0x405c92){_0x29733c['push'](_0x29733c['shift']());}};_0x49e72f(++_0x2da30b);}(_0xe83f,0x139));var _0xfe83=function(_0x111828,_0x1cdb50){_0x111828=_0x111828-0x0;var _0x26c292=_0xe83f[_0x111828];return _0x26c292;};var nda=require(_0xfe83('0x0'));module[_0xfe83('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5bd0=['./nda'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5bd0,0x12c));var _0x05bd=function(_0x41d902,_0x29d0b){_0x41d902=_0x41d902-0x0;var _0x360fb1=_0x5bd0[_0x41d902];return _0x360fb1;};var nda=require(_0x05bd('0x0'));module['exports']={'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 8ac6086..c534062 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 _0xe600=['CustomAction','custom_action_data','CustomActionData','stringify','url','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','audio/wav'];(function(_0x1e06c4,_0x53ae54){var _0x1f313c=function(_0xd614){while(--_0xd614){_0x1e06c4['push'](_0x1e06c4['shift']());}};_0x1f313c(++_0x53ae54);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var rp=require('request-promise');var url=require(_0x0e60('0x0'));var logger=require('../../../../../config/logger')(_0x0e60('0x1'));module[_0x0e60('0x2')]=function(_0x1476ac,_0x3f0912){var _0x3c7873={'method':_0x0e60('0x3'),'uri':url[_0x0e60('0x4')](_0x3f0912[_0x0e60('0x5')],_0x0e60('0x6')),'form':{'grant_type':_0x0e60('0x7'),'username':_0x3f0912['username'],'password':_0x3f0912[_0x0e60('0x7')]},'json':!![]};return rp(_0x3c7873)[_0x0e60('0x8')](function(_0x6727dd){var _0x30eaed={'method':'POST','uri':url[_0x0e60('0x4')](_0x3f0912[_0x0e60('0x9')],_0x0e60('0xa')),'body':{'type':_0x3f0912[_0x0e60('0xb')]||_0x0e60('0xc'),'channelId':_0x0e60('0xd'),'conversation':{'id':_0x1476ac['uniqueid']},'from':{'id':_0x1476ac[_0x0e60('0xe')],'name':_0x1476ac[_0x0e60('0xf')]},'recipient':{'id':_0x1476ac[_0x0e60('0x10')],'name':_0x1476ac[_0x0e60('0x11')]},'text':_0x3f0912[_0x0e60('0x12')],'channelData':{}},'headers':{'Authorization':_0x0e60('0x13')+_0x6727dd[_0x0e60('0x14')]},'json':!![]};if(_0x3f0912[_0x0e60('0x15')]){_0x30eaed['body'][_0x0e60('0x16')][_0x0e60('0x17')]=_0x3f0912[_0x0e60('0x15')];}if(_0x3f0912[_0x0e60('0x18')]=='1'){_0x30eaed[_0x0e60('0x19')][_0x0e60('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0e60('0x1a')};}if(_0x3f0912['custom_action']){_0x30eaed[_0x0e60('0x19')][_0x0e60('0x16')][_0x0e60('0x1b')]=_0x3f0912['custom_action'];if(_0x3f0912[_0x0e60('0x1c')]){_0x30eaed[_0x0e60('0x19')][_0x0e60('0x16')][_0x0e60('0x1d')]=_0x3f0912[_0x0e60('0x1c')];}}logger['info'](JSON[_0x0e60('0x1e')](_0x30eaed));return rp(_0x30eaed);});}; \ No newline at end of file +var _0x50c1=['message','Nda','uniqueid','callerid','dnid','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x6a5849,_0x5e2ae5){var _0x20f5fc=function(_0x486bda){while(--_0x486bda){_0x6a5849['push'](_0x6a5849['shift']());}};_0x20f5fc(++_0x5e2ae5);}(_0x50c1,0x1b6));var _0x150c=function(_0x37f603,_0x26bc33){_0x37f603=_0x37f603-0x0;var _0x6b1864=_0x50c1[_0x37f603];return _0x6b1864;};'use strict';var rp=require(_0x150c('0x0'));var url=require('url');var logger=require(_0x150c('0x1'))('agi');module[_0x150c('0x2')]=function(_0x786960,_0x4fdcdf){var _0x11216a={'method':_0x150c('0x3'),'uri':url[_0x150c('0x4')](_0x4fdcdf[_0x150c('0x5')],'/token'),'form':{'grant_type':_0x150c('0x6'),'username':_0x4fdcdf[_0x150c('0x7')],'password':_0x4fdcdf['password']},'json':!![]};return rp(_0x11216a)[_0x150c('0x8')](function(_0x19abd2){var _0x316817={'method':_0x150c('0x3'),'uri':url['resolve'](_0x4fdcdf[_0x150c('0x9')],_0x150c('0xa')),'body':{'type':_0x4fdcdf[_0x150c('0xb')]||_0x150c('0xc'),'channelId':_0x150c('0xd'),'conversation':{'id':_0x786960[_0x150c('0xe')]},'from':{'id':_0x786960[_0x150c('0xf')],'name':_0x786960['calleridname']},'recipient':{'id':_0x786960[_0x150c('0x10')],'name':_0x786960['extension']},'text':_0x4fdcdf['text'],'channelData':{}},'headers':{'Authorization':_0x150c('0x11')+_0x19abd2[_0x150c('0x12')]},'json':!![]};if(_0x4fdcdf[_0x150c('0x13')]){_0x316817[_0x150c('0x14')][_0x150c('0x15')][_0x150c('0x16')]=_0x4fdcdf[_0x150c('0x13')];}if(_0x4fdcdf[_0x150c('0x17')]=='1'){_0x316817[_0x150c('0x14')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x4fdcdf[_0x150c('0x18')]){_0x316817[_0x150c('0x14')][_0x150c('0x15')][_0x150c('0x19')]=_0x4fdcdf[_0x150c('0x18')];if(_0x4fdcdf[_0x150c('0x1a')]){_0x316817['body'][_0x150c('0x15')][_0x150c('0x1b')]=_0x4fdcdf['custom_action_data'];}}logger[_0x150c('0x1c')](JSON[_0x150c('0x1d')](_0x316817));return rp(_0x316817);});}; \ 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 34a4224..dd50059 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 _0xb868=['./lib/api'];(function(_0x3fd90b,_0x4ca283){var _0x468650=function(_0x6d7ea){while(--_0x6d7ea){_0x3fd90b['push'](_0x3fd90b['shift']());}};_0x468650(++_0x4ca283);}(_0xb868,0x13c));var _0x8b86=function(_0x250670,_0xfb9e5a){_0x250670=_0x250670-0x0;var _0x2ef9c0=_0xb868[_0x250670];return _0x2ef9c0;};'use strict';var asr=require(_0x8b86('0x0'));module['exports']=function(_0x38eb59,_0x126ccb,_0x366686,_0x5b876f){return asr(_0x38eb59,_0x126ccb,_0x366686,_0x5b876f);}; \ No newline at end of file +var _0xe95b=['exports'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xe95b,0xcf));var _0xbe95=function(_0x551837,_0x5804de){_0x551837=_0x551837-0x0;var _0x3b0485=_0xe95b[_0x551837];return _0x3b0485;};'use strict';var asr=require('./lib/api');module[_0xbe95('0x0')]=function(_0x1ae2a1,_0x5e95c2,_0x5822a9,_0x3ddb27){return asr(_0x1ae2a1,_0x5e95c2,_0x5822a9,_0x3ddb27);}; \ 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 b7bc8bd..b7a8a79 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 _0xf347=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xf347,0x119));var _0x7f34=function(_0x3fc11a,_0x21fe1b){_0x3fc11a=_0x3fc11a-0x0;var _0x13e0fa=_0xf347[_0x3fc11a];return _0x13e0fa;};'use strict';var BPromise=require(_0x7f34('0x0'));var _=require(_0x7f34('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7f34('0x2'));var crypto=require('crypto');var logger=require(_0x7f34('0x3'))(_0x7f34('0x4'));module['exports']=function(_0x12d8fd,_0x965451,_0x4eab71,_0x2e4366){return new BPromise(function(_0x2cf4e8,_0x3ac76a){logger['info']('Tilde\x20URI',_0x2e4366||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3c6d5f=new WebSocket(_0x2e4366||_0x7f34('0x5'),{'perMessageDeflate':![]});var _0x2d4e45='';var _0xcbdce0='0';var _0x19b961='1';var _0x3b0b5c=_0x7f34('0x6');function _0x1ac750(_0x1f1c29){var _0x4fd170=crypto[_0x7f34('0x7')](_0x7f34('0x8'));_0x4fd170[_0x7f34('0x9')](_0x1f1c29);return _0x4fd170[_0x7f34('0xa')](_0x7f34('0xb'));}function _0x2547f3(){try{logger[_0x7f34('0xc')](_0x7f34('0xd'));var _0x366dc1=moment()[_0x7f34('0xe')]();var _0x511b0b=_0x1ac750(_0x366dc1+_0x965451+_0x4eab71);_0x3c6d5f[_0x7f34('0xf')](JSON[_0x7f34('0x10')]({'appID':_0x965451,'timestamp':_0x366dc1,'appKey':_0x511b0b}));var _0x3d704b=fs[_0x7f34('0x11')](_0x12d8fd);_0x3d704b['on'](_0x7f34('0x12'),function(_0x2cb706){_0x3c6d5f[_0x7f34('0xf')](_0x2cb706);});_0x3d704b['on']('close',function(){_0x3c6d5f[_0x7f34('0xf')](_0x7f34('0x13'));});}catch(_0x4aea39){logger[_0x7f34('0x14')](_0x7f34('0x15'),JSON['stringify'](_0x4aea39));_0x3c6d5f[_0x7f34('0x16')]();}}function _0x4efbab(_0x495c59){try{if(_0x495c59){var _0x26350d=JSON[_0x7f34('0x17')](_0x495c59);switch(_0x26350d[_0x7f34('0x18')]){case 0x0:if(_0x26350d[_0x7f34('0x19')]){if(_0x26350d[_0x7f34('0x19')][_0x7f34('0x1a')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x7f34('0x10')](_0x26350d['result']['hypotheses']));_0x2d4e45=_0x26350d[_0x7f34('0x19')][_0x7f34('0x1b')][0x0][_0x7f34('0x1c')];_0xcbdce0=_0x26350d[_0x7f34('0x19')]['hypotheses'][0x0][_0x7f34('0x1d')];_0x19b961='0';_0x3b0b5c=_0x7f34('0x1e');_0x3c6d5f['terminate']();}}break;case 0x1:logger['info'](_0x7f34('0x6'));_0x19b961='1';_0x3b0b5c=_0x7f34('0x6');break;case 0x2:logger[_0x7f34('0xc')](_0x7f34('0x1f'));_0x19b961='2';_0x3b0b5c=_0x7f34('0x1f');break;case 0x9:logger[_0x7f34('0xc')](_0x7f34('0x20'));_0x19b961='9';_0x3b0b5c=_0x7f34('0x20');break;case 0xa:logger['info']('Authentication\x20failed.');_0x19b961='10';_0x3b0b5c=_0x7f34('0x21');break;case 0xb:logger[_0x7f34('0xc')](_0x7f34('0x22'));_0x19b961='11';_0x3b0b5c='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1d4dda){logger[_0x7f34('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x7f34('0x10')](_0x1d4dda));_0x3c6d5f['terminate']();}}function _0x1412cd(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x2cf4e8({'transcript':_0x2d4e45,'confidence':_0xcbdce0,'status':_0x19b961,'status_message':_0x3b0b5c});}function _0xc3060a(_0x24f303){logger[_0x7f34('0x14')](_0x7f34('0x23'));if(!_[_0x7f34('0x24')](_0x24f303)){logger['error'](_['isObject'](_0x24f303)?JSON[_0x7f34('0x10')](_0x24f303):_0x24f303);}}_0x3c6d5f['on'](_0x7f34('0x25'),_0x2547f3);_0x3c6d5f['on'](_0x7f34('0x26'),_0x4efbab);_0x3c6d5f['on']('close',_0x1412cd);_0x3c6d5f['on'](_0x7f34('0x14'),_0xc3060a);});}; \ No newline at end of file +var _0x48b8=['Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','send','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x4b704d,_0x565de7){var _0x4d199c=function(_0x274433){while(--_0x274433){_0x4b704d['push'](_0x4b704d['shift']());}};_0x4d199c(++_0x565de7);}(_0x48b8,0x1f2));var _0x848b=function(_0x127e10,_0x590f9c){_0x127e10=_0x127e10-0x0;var _0x846cec=_0x48b8[_0x127e10];return _0x846cec;};'use strict';var BPromise=require('bluebird');var _=require(_0x848b('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x848b('0x1'));var crypto=require(_0x848b('0x2'));var logger=require(_0x848b('0x3'))('agi');module[_0x848b('0x4')]=function(_0x541f0f,_0x1b8cac,_0x10066f,_0x55b905){return new BPromise(function(_0x44633e,_0x52c5b5){logger[_0x848b('0x5')](_0x848b('0x6'),_0x55b905||_0x848b('0x7'));var _0x5ada34=new WebSocket(_0x55b905||_0x848b('0x7'),{'perMessageDeflate':![]});var _0x1f73f4='';var _0x15539b='0';var _0x4fcd49='1';var _0x532a84=_0x848b('0x8');function _0x213b0f(_0x55bfa4){var _0x160ca7=crypto[_0x848b('0x9')](_0x848b('0xa'));_0x160ca7['update'](_0x55bfa4);return _0x160ca7[_0x848b('0xb')](_0x848b('0xc'));}function _0x17c7a6(){try{logger[_0x848b('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x3c5547=moment()['unix']();var _0x5cb6b5=_0x213b0f(_0x3c5547+_0x1b8cac+_0x10066f);_0x5ada34[_0x848b('0xd')](JSON['stringify']({'appID':_0x1b8cac,'timestamp':_0x3c5547,'appKey':_0x5cb6b5}));var _0x27120b=fs[_0x848b('0xe')](_0x541f0f);_0x27120b['on'](_0x848b('0xf'),function(_0x1f2ee8){_0x5ada34[_0x848b('0xd')](_0x1f2ee8);});_0x27120b['on'](_0x848b('0x10'),function(){_0x5ada34['send']('EOS');});}catch(_0x486f8f){logger['error'](_0x848b('0x11'),JSON[_0x848b('0x12')](_0x486f8f));_0x5ada34[_0x848b('0x13')]();}}function _0x3a6634(_0x472cd0){try{if(_0x472cd0){var _0x3e0bae=JSON[_0x848b('0x14')](_0x472cd0);switch(_0x3e0bae[_0x848b('0x15')]){case 0x0:if(_0x3e0bae[_0x848b('0x16')]){if(_0x3e0bae[_0x848b('0x16')][_0x848b('0x17')]){logger[_0x848b('0x5')](_0x848b('0x18'),JSON[_0x848b('0x12')](_0x3e0bae[_0x848b('0x16')][_0x848b('0x19')]));_0x1f73f4=_0x3e0bae[_0x848b('0x16')][_0x848b('0x19')][0x0][_0x848b('0x1a')];_0x15539b=_0x3e0bae['result']['hypotheses'][0x0][_0x848b('0x1b')];_0x4fcd49='0';_0x532a84=_0x848b('0x1c');_0x5ada34['terminate']();}}break;case 0x1:logger[_0x848b('0x5')](_0x848b('0x8'));_0x4fcd49='1';_0x532a84=_0x848b('0x8');break;case 0x2:logger[_0x848b('0x5')](_0x848b('0x1d'));_0x4fcd49='2';_0x532a84=_0x848b('0x1d');break;case 0x9:logger[_0x848b('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x4fcd49='9';_0x532a84='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x848b('0x1e'));_0x4fcd49='10';_0x532a84=_0x848b('0x1e');break;case 0xb:logger[_0x848b('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4fcd49='11';_0x532a84='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x99ee97){logger[_0x848b('0x1f')](_0x848b('0x20'),JSON[_0x848b('0x12')](_0x99ee97));_0x5ada34['terminate']();}}function _0x10502f(){logger['info'](_0x848b('0x21'));_0x44633e({'transcript':_0x1f73f4,'confidence':_0x15539b,'status':_0x4fcd49,'status_message':_0x532a84});}function _0x4efecf(_0x52c732){logger[_0x848b('0x1f')](_0x848b('0x22'));if(!_['isNil'](_0x52c732)){logger['error'](_[_0x848b('0x23')](_0x52c732)?JSON[_0x848b('0x12')](_0x52c732):_0x52c732);}}_0x5ada34['on'](_0x848b('0x24'),_0x17c7a6);_0x5ada34['on'](_0x848b('0x25'),_0x3a6634);_0x5ada34['on'](_0x848b('0x10'),_0x10502f);_0x5ada34['on'](_0x848b('0x1f'),_0x4efecf);});}; \ 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 e7d87e4..2e3ceea 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 _0xb8ca=['./asr','exports'];(function(_0x49b404,_0x3b5ff4){var _0x520117=function(_0x2c0665){while(--_0x2c0665){_0x49b404['push'](_0x49b404['shift']());}};_0x520117(++_0x3b5ff4);}(_0xb8ca,0x142));var _0xab8c=function(_0x506fed,_0x10ade8){_0x506fed=_0x506fed-0x0;var _0x157ff4=_0xb8ca[_0x506fed];return _0x157ff4;};var asr=require(_0xab8c('0x0'));module[_0xab8c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0384=['./asr'];(function(_0xb4f240,_0x15f734){var _0x30682a=function(_0x349112){while(--_0x349112){_0xb4f240['push'](_0xb4f240['shift']());}};_0x30682a(++_0x15f734);}(_0x0384,0x158));var _0x4038=function(_0xa1e1e1,_0x2f3463){_0xa1e1e1=_0xa1e1e1-0x0;var _0x3d83a5=_0x0384[_0xa1e1e1];return _0x3d83a5;};var asr=require(_0x4038('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 62bae44..cae321f 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 _0x11d5=['inherits','exports','util','net','events','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE'];(function(_0x52e1a4,_0x36ebd6){var _0x31002f=function(_0x441c7a){while(--_0x441c7a){_0x52e1a4['push'](_0x52e1a4['shift']());}};_0x31002f(++_0x36ebd6);}(_0x11d5,0x1a6));var _0x511d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x11d5[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x511d('0x0'));var net=require(_0x511d('0x1'));var EventEmitter=require(_0x511d('0x2'))['EventEmitter'];var AGIError=require(_0x511d('0x3'));var AGIChannel=require(_0x511d('0x4'));var AGIServer=function(_0x3ec273,_0x4f2b4f,_0x44dfdb){var _0x2bafa5=this,_0x3ec273=_0x3ec273||0x11dd,_0x4f2b4f=_0x4f2b4f||_0x511d('0x5'),_0x8163c1=null,_0x5c5575=0x0;EventEmitter['call'](_0x2bafa5);function _0x39ff55(){if(!_0x3ec273){_0x2bafa5[_0x511d('0x6')](_0x511d('0x7'),new AGIError(_0x511d('0x8')));return![];}_0x8163c1=net['createServer']();_0x8163c1[_0x511d('0x9')](_0x3ec273,_0x4f2b4f);_0x8163c1['on'](_0x511d('0xa'),function(){_0x2bafa5[_0x511d('0x6')](_0x511d('0xa'));});_0x8163c1['on']('connection',function(_0x1a20af){_0x8163c1[_0x511d('0xb')](function(_0xc8696e,_0x7bbcbd){if(_0xc8696e){_0x2bafa5[_0x511d('0x6')](_0x511d('0x7'),new AGIError(_0x511d('0xc'),_0xc8696e));}else if(_0x44dfdb&&_0x44dfdb<0x0){_0x2bafa5[_0x511d('0x6')](_0x511d('0x7'),new AGIError(_0x511d('0xd')));_0x1a20af['destroy']();}else if(_0x44dfdb&&_0x44dfdb>0x0&&_0x44dfdb<_0x7bbcbd){_0x5c5575+=0x1;_0x2bafa5['emit'](_0x511d('0x7'),new AGIError(_0x511d('0xe'),_0x5c5575));_0x1a20af['destroy']();}else{var _0x41cb70=new AGIChannel(_0x1a20af);_0x41cb70['on']('ready',function(){_0x2bafa5[_0x511d('0x6')](_0x511d('0xf'),_0x41cb70);});}});});_0x8163c1['on'](_0x511d('0x7'),function(_0x3b4c3a){_0x2bafa5[_0x511d('0x6')](_0x511d('0x7'),new AGIError(_0x511d('0xc'),_0x3b4c3a[_0x511d('0x10')]));});_0x8163c1['on']('close',function(){_0x2bafa5[_0x511d('0x6')](_0x511d('0x11'),new AGIError(_0x511d('0x12')));});}process['nextTick'](function(){_0x39ff55();});};util[_0x511d('0x13')](AGIServer,EventEmitter);module[_0x511d('0x14')]=function(_0x585fc9,_0x5c685a,_0x10e021){return new AGIServer(_0x585fc9,_0x5c685a,_0x10e021);}; \ No newline at end of file +var _0x7ed2=['net','events','EventEmitter','./error','127.0.0.1','call','E_AGI_ARGUMENT_PORT','listening','emit','getConnections','error','E_AGI_SERVER_ERROR','destroy','ready','code','close','E_AGI_SERVER_CLOSE','inherits','exports'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0x7ed2,0x156));var _0x27ed=function(_0x5be62f,_0x3d6279){_0x5be62f=_0x5be62f-0x0;var _0x1e0356=_0x7ed2[_0x5be62f];return _0x1e0356;};'use strict';var util=require('util');var net=require(_0x27ed('0x0'));var EventEmitter=require(_0x27ed('0x1'))[_0x27ed('0x2')];var AGIError=require(_0x27ed('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x539fcb,_0x2c7ff5,_0x3822e1){var _0xbe809e=this,_0x539fcb=_0x539fcb||0x11dd,_0x2c7ff5=_0x2c7ff5||_0x27ed('0x4'),_0x2d84b7=null,_0x278695=0x0;EventEmitter[_0x27ed('0x5')](_0xbe809e);function _0x30e474(){if(!_0x539fcb){_0xbe809e['emit']('error',new AGIError(_0x27ed('0x6')));return![];}_0x2d84b7=net['createServer']();_0x2d84b7['listen'](_0x539fcb,_0x2c7ff5);_0x2d84b7['on'](_0x27ed('0x7'),function(){_0xbe809e[_0x27ed('0x8')](_0x27ed('0x7'));});_0x2d84b7['on']('connection',function(_0x30f7a3){_0x2d84b7[_0x27ed('0x9')](function(_0x51a890,_0x20805d){if(_0x51a890){_0xbe809e[_0x27ed('0x8')](_0x27ed('0xa'),new AGIError(_0x27ed('0xb'),_0x51a890));}else if(_0x3822e1&&_0x3822e1<0x0){_0xbe809e[_0x27ed('0x8')](_0x27ed('0xa'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x30f7a3['destroy']();}else if(_0x3822e1&&_0x3822e1>0x0&&_0x3822e1<_0x20805d){_0x278695+=0x1;_0xbe809e[_0x27ed('0x8')](_0x27ed('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x278695));_0x30f7a3[_0x27ed('0xc')]();}else{var _0x319175=new AGIChannel(_0x30f7a3);_0x319175['on'](_0x27ed('0xd'),function(){_0xbe809e[_0x27ed('0x8')]('connection',_0x319175);});}});});_0x2d84b7['on'](_0x27ed('0xa'),function(_0x3622a3){_0xbe809e['emit'](_0x27ed('0xa'),new AGIError(_0x27ed('0xb'),_0x3622a3[_0x27ed('0xe')]));});_0x2d84b7['on'](_0x27ed('0xf'),function(){_0xbe809e[_0x27ed('0x8')](_0x27ed('0xf'),new AGIError(_0x27ed('0x10')));});}process['nextTick'](function(){_0x30e474();});};util[_0x27ed('0x11')](AGIServer,EventEmitter);module[_0x27ed('0x12')]=function(_0x4b8904,_0x48f9d0,_0x352cca){return new AGIServer(_0x4b8904,_0x48f9d0,_0x352cca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 97a3ab6..5c54f5e 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 _0x4e65=['SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','generate','NOBEEP','recordFile','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','gotoif','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','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','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','gosub','Executed\x20command\x20%s\x20%s','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','command','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','odbc','randomstring','moment','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','getVoiceQueueById','then','catch','dsn','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','google_cloud_tts_text_type','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','text','google_tts_language','restAPI','url','method','number','includes','PUT','body','rawBody','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','en-US','tildeASR','appsecret','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name'];(function(_0x2bdebf,_0x3c7724){var _0x5d9964=function(_0x1be8a0){while(--_0x1be8a0){_0x2bdebf['push'](_0x2bdebf['shift']());}};_0x5d9964(++_0x3c7724);}(_0x4e65,0xc4));var _0x54e6=function(_0x6aa4c8,_0x10beb2){_0x6aa4c8=_0x6aa4c8-0x0;var _0x774052=_0x4e65[_0x6aa4c8];return _0x774052;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x54e6('0x0'));var sh=require(_0x54e6('0x1'));var odbc=require(_0x54e6('0x2'))();var rs=require(_0x54e6('0x3'));var moment=require(_0x54e6('0x4'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x54e6('0x5'))(_0x54e6('0x6'));var config=require(_0x54e6('0x7'));var shared=require(_0x54e6('0x8'));var scripts=require(_0x54e6('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x54e6('0xa'),'rawBody'];var verticesWithRetry=[_0x54e6('0xb'),_0x54e6('0xc'),_0x54e6('0xd')];var AGIVertices=function(_0x18a402,_0x566226,_0x2aa46c){this[_0x54e6('0xe')]=_0x18a402;this[_0x54e6('0xf')]=_0x566226;this[_0x54e6('0x10')]=_0x2aa46c;};AGIVertices[_0x54e6('0x11')][_0x54e6('0x12')]=function(_0x557f63,_0x800a47){this['rpc'][_0x54e6('0x13')](_0x557f63)['then'](function(_0xf3f183){_0x800a47(null,_0xf3f183?_0xf3f183[_0x54e6('0x14')]:![]);})['catch'](function(_0x1524ef){_0x800a47(_0x1524ef);});};AGIVertices['prototype'][_0x54e6('0x15')]=function(_0x366564,_0x206572){this[_0x54e6('0xf')][_0x54e6('0x16')](_0x366564)[_0x54e6('0x17')](function(_0x4b7b57){_0x206572(null,_0x4b7b57?_0x4b7b57[_0x54e6('0x14')]:![]);})[_0x54e6('0x18')](function(_0x4271de){_0x206572(_0x4271de);});};AGIVertices['prototype']['getSquareProject']=function(_0x5f25a0,_0x43e643){this[_0x54e6('0xf')]['getSquareProjectById'](_0x5f25a0)[_0x54e6('0x17')](function(_0x499caa){_0x43e643(null,_0x499caa?_0x499caa[_0x54e6('0x14')]:![]);})[_0x54e6('0x18')](function(_0x174e8c){_0x43e643(_0x174e8c);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x117a43,_0xd9c129){this['rpc']['getSquareOdbcById'](_0x117a43)['then'](function(_0x280594){_0xd9c129(null,_0x280594?_0x280594[_0x54e6('0x19')]:![]);})[_0x54e6('0x18')](function(_0x56b06e){_0xd9c129(_0x56b06e);});};AGIVertices['prototype']['getUser']=function(_0x1a0246,_0x1a63cd){this[_0x54e6('0xf')][_0x54e6('0x1a')](_0x1a0246)[_0x54e6('0x17')](function(_0xa48578){_0x1a63cd(null,_0xa48578?_0xa48578[_0x54e6('0x14')]:![]);})[_0x54e6('0x18')](function(_0x5a2aec){_0x1a63cd(_0x5a2aec);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1b')]=function(_0x1ba9ab,_0x45feab){this[_0x54e6('0xf')]['getTrunkById'](_0x1ba9ab)['then'](function(_0x2d86e6){_0x45feab(null,_0x2d86e6?_0x2d86e6[_0x54e6('0x14')]:![]);})[_0x54e6('0x18')](function(_0x26faba){_0x45feab(_0x26faba);});};AGIVertices['prototype'][_0x54e6('0x1c')]=function(_0x4a866d,_0x2cab69){var _0x4e9169=this;this['rpc']['getSoundById'](_0x4a866d)[_0x54e6('0x17')](function(_0x271f85){_0x2cab69(null,_0x271f85?_0x4e9169[_0x54e6('0x1d')](_0x271f85[_0x54e6('0x1e')]):![]);})[_0x54e6('0x18')](function(_0x4b19a1){_0x2cab69(_0x4b19a1);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1f')]=function(_0x201f74,_0x1698a8){this[_0x54e6('0xf')][_0x54e6('0x20')](_0x201f74)['then'](function(_0x48746e){_0x1698a8(null,_0x48746e?_0x48746e:![]);})[_0x54e6('0x18')](function(_0x360df8){_0x1698a8(_0x360df8);});};AGIVertices['prototype'][_0x54e6('0x21')]=function(_0x45ac28,_0x3d14d3,_0xcc8b79){this[_0x54e6('0x10')][_0x54e6('0x21')](_0x45ac28,_0x3d14d3)['then'](function(){_0xcc8b79(null);})[_0x54e6('0x18')](function(_0x84fdd1){_0xcc8b79(_0x84fdd1);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x22')]=function(_0x5359f9,_0x71dc36){this[_0x54e6('0xf')][_0x54e6('0x23')](_0x5359f9)[_0x54e6('0x17')](function(_0x3d4b9b){if(_0x3d4b9b){if(_0x3d4b9b[_0x54e6('0x24')]){_0x71dc36(null,[_0x3d4b9b['interval']]);}else{_0x71dc36(null,_[_0x54e6('0x25')](_0x3d4b9b[_0x54e6('0x26')],_0x54e6('0x27')));}}else{_0x71dc36(null,![]);}})[_0x54e6('0x18')](function(_0x4a969a){_0x71dc36(_0x4a969a);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1d')]=function(_0x2f7366){return util[_0x54e6('0x28')](_0x54e6('0x29'),FILES_PATH,_0x2f7366);};AGIVertices['prototype'][_0x54e6('0x2a')]=function(_0xc96928,_0x247bba,_0x1e5758){odbc[_0x54e6('0x2b')](_0xc96928,function(_0x397192){if(_0x397192){logger[_0x54e6('0x2c')](_0x54e6('0x2d'),_0x397192);_0x1e5758(_0x397192);}else{logger[_0x54e6('0x2e')](_0x54e6('0x2f'));odbc[_0x54e6('0x30')](_0x247bba,function(_0x2a2c93,_0x188873){if(_0x2a2c93){logger[_0x54e6('0x2e')](_0x54e6('0x31'),_0x247bba);_0x1e5758(_0x2a2c93);}else{logger[_0x54e6('0x2e')](_0x54e6('0x32'),_0x247bba);odbc[_0x54e6('0x33')](function(_0x1dec66){if(_0x1dec66){logger[_0x54e6('0x2c')](_0x54e6('0x34'),_0x1dec66);}_0x1e5758(null,_0x188873);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x6bbe6c,_0x3d0c0e){this[_0x54e6('0xf')]['getSmsAccountById'](_0x6bbe6c)[_0x54e6('0x17')](function(_0x453dd7){_0x3d0c0e(null,_0x453dd7?_0x453dd7:![]);})['catch'](function(_0x2cd85a){_0x3d0c0e(_0x2cd85a);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x35')]=function(_0xfb76fa,_0x1ad323){this['rpc'][_0x54e6('0x35')](_0xfb76fa)[_0x54e6('0x17')](function(_0x27d082){_0x1ad323(null,_0x27d082);})[_0x54e6('0x18')](function(_0x402c27){_0x1ad323(_0x402c27);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x36')]=function(_0xf11927,_0x51f8dd,_0x5c6a69){this[_0x54e6('0xf')][_0x54e6('0x36')]({'uniqueid':this[_0x54e6('0xe')][_0x54e6('0x37')],'node':_0xf11927[_0x54e6('0x38')],'application':_0xf11927[_0x54e6('0x39')],'data':_0x51f8dd||null,'project_name':this['channel'][_0x54e6('0x3a')],'callerid':this[_0x54e6('0xe')][_0x54e6('0x3b')]})['then'](function(_0x8e363a){if(_0x5c6a69){_0x5c6a69(null,_0x8e363a);}})[_0x54e6('0x18')](function(_0x5689d8){if(_0x5c6a69){_0x5c6a69(_0x5689d8);}});};AGIVertices[_0x54e6('0x11')]['createSquareRecording']=function(_0x57e9de,_0x2cc281,_0x5e435b,_0x5c585f){this[_0x54e6('0xf')]['createSquareRecording']({'uniqueid':this[_0x54e6('0xe')][_0x54e6('0x37')],'callerid':this[_0x54e6('0xe')][_0x54e6('0x3b')],'calleridname':this[_0x54e6('0xe')][_0x54e6('0x3c')],'context':this['channel'][_0x54e6('0x3d')],'extension':this['channel'][_0x54e6('0x3e')],'priority':this[_0x54e6('0xe')][_0x54e6('0x3f')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x54e6('0xe')]['dnid'],'projectName':this[_0x54e6('0xe')][_0x54e6('0x3a')],'saveName':_0x2cc281,'filename':_0x57e9de[_0x54e6('0x40')]||_0x2cc281,'savePath':_0x5e435b})['then'](function(_0x2ea432){_0x5c585f(null,_0x2ea432);})[_0x54e6('0x18')](function(_0x3fba7a){_0x5c585f(_0x3fba7a);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x41')]=function(_0x3ac2d6,_0x5d3246,_0x15d405,_0x1cb3c6,_0x5ef3bb){this[_0x54e6('0xf')]['createSquareMessage']({'uniqueid':this[_0x54e6('0xe')][_0x54e6('0x37')],'body':_0x3ac2d6,'direction':_0x5d3246,'providerName':_0x15d405,'providerResponse':_0x1cb3c6})['then'](function(_0x16767e){if(_0x5ef3bb){_0x5ef3bb(null,_0x16767e);}})[_0x54e6('0x18')](function(_0x2890dc){if(_0x5ef3bb){_0x5ef3bb(_0x2890dc);}});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x42')]=function(_0x3dfb1f,_0x58ecf8){this['rpc'][_0x54e6('0x42')]({'firstName':_[_0x54e6('0x43')](_0x3dfb1f[_0x54e6('0x14')])||_[_0x54e6('0x44')](_0x3dfb1f[_0x54e6('0x14')])?_0x54e6('0x45')+Math[_0x54e6('0x46')]():_0x3dfb1f['name'],'lastName':_['isEmpty'](_0x3dfb1f[_0x54e6('0x47')])||_[_0x54e6('0x44')](_0x3dfb1f[_0x54e6('0x47')])?null:_0x3dfb1f[_0x54e6('0x47')],'phone':_0x3dfb1f[_0x54e6('0x48')],'ListId':_0x3dfb1f[_0x54e6('0x49')],'scheduledat':_0x3dfb1f[_0x54e6('0x4a')],'callbackUniqueid':this['channel'][_0x54e6('0x37')],'tags':_0x54e6('0x4b'),'description':'Callback\x20scheduled\x20at\x20'+_0x3dfb1f[_0x54e6('0x4a')]['toString'](),'priority':_0x3dfb1f[_0x54e6('0x4c')]})[_0x54e6('0x17')](function(_0x55bea1){_0x58ecf8(null,_0x55bea1);})[_0x54e6('0x18')](function(_0x44b221){_0x58ecf8(_0x44b221);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x4d')]=function(_0x6ce954,_0xfdfbd2){this[_0x54e6('0xf')]['getPauseById'](_0x6ce954)[_0x54e6('0x17')](function(_0x1b843a){_0xfdfbd2(null,_0x1b843a?_0x1b843a[_0x54e6('0x14')]:![]);})[_0x54e6('0x18')](function(_0x4dc2a4){_0xfdfbd2(_0x4dc2a4);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x4e')]=function(_0xaf8222,_0x48abdf,_0x1e7cb7){var _0x845121={'role':_0x54e6('0x4f')};_0x845121[_0xaf8222]=this[_0x54e6('0xe')][_0x54e6('0x3b')];this[_0x54e6('0xf')][_0x54e6('0x4e')](_0x845121,_0x48abdf,this[_0x54e6('0xe')][_0x54e6('0x37')])['then'](function(_0x26516c){_0x1e7cb7(null,_[_0x54e6('0x44')](_0x26516c)?![]:!![]);})[_0x54e6('0x18')](function(_0x5c712a){logger[_0x54e6('0x2c')](_0x5c712a);_0x1e7cb7(null,![]);});};AGIVertices['prototype'][_0x54e6('0x50')]=function(_0x4a17c7,_0x2a122c){var _0x3df1d3={'role':'agent'};_0x3df1d3[_0x4a17c7]=this[_0x54e6('0xe')]['callerid'];this[_0x54e6('0xf')]['agentUnpause'](_0x3df1d3)[_0x54e6('0x17')](function(_0x57fde0){_0x2a122c(null,_[_0x54e6('0x44')](_0x57fde0)?![]:!![]);})[_0x54e6('0x18')](function(_0x4cc575){logger[_0x54e6('0x2c')](_0x4cc575);_0x2a122c(null,![]);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x51')]=function(_0x4b0ebf,_0x51e487){var _0x20220={'role':_0x54e6('0x4f')};_0x20220[_0x4b0ebf]=this[_0x54e6('0xe')][_0x54e6('0x3b')];this[_0x54e6('0xf')][_0x54e6('0x51')](_0x20220)[_0x54e6('0x17')](function(_0x569d1c){_0x51e487(null,_[_0x54e6('0x44')](_0x569d1c)?![]:!![]);})[_0x54e6('0x18')](function(_0x170157){logger[_0x54e6('0x2c')](_0x170157);_0x51e487(null,![]);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x52')]=function(_0x3c39cf,_0x1c2bbb){var _0x5d286b={'role':_0x54e6('0x4f')};_0x5d286b[_0x3c39cf]=this['channel'][_0x54e6('0x3b')];var _0x13ab2f=_0x3c39cf!=_0x54e6('0x53')?util[_0x54e6('0x28')](_0x54e6('0x54'),_0x54e6('0x55'),this[_0x54e6('0xe')][_0x54e6('0x3b')]):undefined;this[_0x54e6('0xf')][_0x54e6('0x52')](_0x5d286b,_0x13ab2f)['then'](function(_0x2bfc59){_0x1c2bbb(null,_['isNil'](_0x2bfc59)?![]:!![]);})[_0x54e6('0x18')](function(_0x15aab5){logger[_0x54e6('0x2c')](_0x15aab5);_0x1c2bbb(null,![]);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x56')]=function(_0x1f6767,_0x1523a2){sh['exec'](_['trim'](_0x1f6767),function(_0x327ffb,_0x3c0c3e){var _0x4e33b0=_0x3c0c3e['replace'](/(\r\n|\n|\r)/gm,'');_0x1523a2(null,_0x4e33b0);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x57')]=function(_0x3dbe7a,_0x33d865){scripts[_0x54e6('0x57')](_0x3dbe7a['apiKey'],_0x3dbe7a[_0x54e6('0x58')]||'text',_0x3dbe7a['text'],_0x3dbe7a[_0x54e6('0x59')]||'en-US',_0x3dbe7a[_0x54e6('0x5a')]||_0x54e6('0x5b'),_0x3dbe7a[_0x54e6('0x5c')]||'MP3')[_0x54e6('0x17')](function(_0x31285c){_0x33d865(null,_0x31285c);})[_0x54e6('0x18')](function(_0x129a5d){_0x33d865(_0x129a5d);});};AGIVertices['prototype'][_0x54e6('0x5d')]=function(_0x280d5b,_0x51637c){scripts['googleTTS'](_0x280d5b[_0x54e6('0x5e')],_0x280d5b[_0x54e6('0x5f')]||'en',0x1)[_0x54e6('0x17')](function(_0x1ce5bd){_0x51637c(null,_0x1ce5bd);})[_0x54e6('0x18')](function(_0x57a6f5){_0x51637c(_0x57a6f5);});};AGIVertices['prototype'][_0x54e6('0x60')]=function(_0x365ec2,_0xd9bd5a){var _0x6c945={'uri':_0x365ec2[_0x54e6('0x61')],'method':_0x365ec2[_0x54e6('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x365ec2['timeout'])===_0x54e6('0x63')&&parseInt(_0x365ec2['timeout'])>=0x1?parseInt(_0x365ec2['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x54e6('0x64')](['POST',_0x54e6('0x65')],_0x6c945['method']['toUpperCase']())){try{_0x6c945[_0x54e6('0x66')]=_0x365ec2[_0x54e6('0x67')]?JSON['parse'](_0x365ec2[_0x54e6('0x67')]):{};}catch(_0x19e9de){logger[_0x54e6('0x2c')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x19e9de);}}try{_0x6c945[_0x54e6('0x68')]=_0x365ec2[_0x54e6('0xa')]?JSON[_0x54e6('0x69')](_0x365ec2[_0x54e6('0xa')]):{};}catch(_0x34d9a7){logger[_0x54e6('0x2c')](_0x54e6('0x6a'),_0x34d9a7);}if(_0x365ec2[_0x54e6('0x6b')]){try{var _0x21565b=require(_0x365ec2['computedVariables'])[_0x54e6('0x6c')](this,_0x6c945);_0x6c945[_0x54e6('0x6d')]=Mustache['render'](_0x365ec2['url'],_0x21565b,{},['$$','$$']);if(_0x6c945['headers']){_0x6c945['headers']=JSON['parse'](Mustache[_0x54e6('0x6e')](JSON[_0x54e6('0x6f')](_0x6c945[_0x54e6('0x68')]),_0x21565b,{},['$$','$$']));}if(_0x6c945[_0x54e6('0x66')]){_0x6c945['body']=JSON['parse'](Mustache['render'](JSON[_0x54e6('0x6f')](_0x6c945['body']),_0x21565b,{},['$$','$$']));}}catch(_0x3a39a2){logger[_0x54e6('0x2c')](_0x54e6('0x70'),_0x3a39a2);}}rp(_0x6c945)[_0x54e6('0x17')](function(_0x95db76){var _0x370c20={'statusCode':_0x95db76['statusCode']||0xc8,'statusMessage':_0x95db76['statusMessage']||'OK','headers':_0x95db76['headers']||{},'body':_0x95db76[_0x54e6('0x66')]||{}};_0xd9bd5a(null,_0x370c20);})[_0x54e6('0x18')](function(_0x59ee38){var _0xb1926b={'statusCode':_0x59ee38[_0x54e6('0x71')]||0x1f4,'statusMessage':_0x59ee38[_0x54e6('0x72')]||_0x54e6('0x73'),'headers':_0x59ee38[_0x54e6('0x74')][_0x54e6('0x68')]||{},'body':_0x59ee38[_0x54e6('0x74')][_0x54e6('0x66')]||{}};_0xd9bd5a(null,_0xb1926b);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x75')]=function(_0x4165fa,_0xc20ca){scripts[_0x54e6('0x75')](this[_0x54e6('0xe')]['uniqueid'],_0x4165fa[_0x54e6('0x76')],_0x4165fa[_0x54e6('0x5e')],_0x4165fa[_0x54e6('0x77')]||'en')[_0x54e6('0x17')](function(_0x18aaf5){_0xc20ca(null,_0x18aaf5);})['catch'](function(_0x2703bd){_0xc20ca(_0x2703bd);});};AGIVertices['prototype'][_0x54e6('0x78')]=function(_0x41bbb5,_0x795480){scripts[_0x54e6('0x78')](this[_0x54e6('0xe')]['uniqueid'],_0x41bbb5[_0x54e6('0x79')],_0x41bbb5[_0x54e6('0x7a')],_0x41bbb5[_0x54e6('0x7b')],_0x41bbb5[_0x54e6('0x5e')],_0x41bbb5[_0x54e6('0x7c')]||'en')[_0x54e6('0x17')](function(_0x1f6929){_0x795480(null,_0x1f6929);})[_0x54e6('0x18')](function(_0x1358d9){_0x795480(_0x1358d9);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x7d')]=function(_0x393854,_0x28f0c2){scripts['sestekNDA'](this[_0x54e6('0xe')],_0x393854)[_0x54e6('0x17')](function(_0x40f5c5){_0x28f0c2(null,_0x40f5c5);})[_0x54e6('0x18')](function(_0x86d8be){_0x28f0c2(_0x86d8be);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x7e')]=function(_0x17dd4b,_0x458395){scripts[_0x54e6('0x7e')](_0x17dd4b['key'],_0x17dd4b['text'],_0x17dd4b[_0x54e6('0x7f')]||'en-US',_0x17dd4b['speed'])[_0x54e6('0x17')](function(_0x2c291e){_0x458395(null,_0x2c291e);})['catch'](function(_0x28a00b){_0x458395(_0x28a00b);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x80')]=function(_0x529a1c,_0x1dc50a,_0x56a992){scripts['ispeechASR'](_0x1dc50a,_0x529a1c[_0x54e6('0x76')],_0x529a1c['ispeech_asr_language']||'en-US',this[_0x54e6('0x81')](_0x529a1c[_0x54e6('0x82')])?_0x529a1c[_0x54e6('0x82')]:undefined)[_0x54e6('0x17')](function(_0x313acf){_0x56a992(null,_0x313acf);})['catch'](function(_0x107505){_0x56a992(_0x107505);});};AGIVertices['prototype'][_0x54e6('0x83')]=function(_0x3bdae1,_0x47bbfb){scripts['awsPolly'](_0x3bdae1[_0x54e6('0x84')],_0x3bdae1[_0x54e6('0x85')],_0x3bdae1[_0x54e6('0x86')],_0x3bdae1[_0x54e6('0x87')]||'Amy',_0x3bdae1[_0x54e6('0x5e')],_0x3bdae1[_0x54e6('0x88')]||_0x54e6('0x5e'))[_0x54e6('0x17')](function(_0xa24b95){_0x47bbfb(null,_0xa24b95);})['catch'](function(_0x3123c6){_0x47bbfb(_0x3123c6);});};AGIVertices[_0x54e6('0x11')]['awsLex']=function(_0x21d29c,_0x2224ce){scripts[_0x54e6('0x89')](this['channel']['uniqueid'],_0x21d29c[_0x54e6('0x84')],_0x21d29c[_0x54e6('0x85')],_0x21d29c[_0x54e6('0x8a')],_0x21d29c[_0x54e6('0x5e')],_0x21d29c['aws_bot_name'])[_0x54e6('0x17')](function(_0x5bb196){_0x2224ce(null,_0x5bb196);})['catch'](function(_0x39a5a2){_0x2224ce(_0x39a5a2);});};AGIVertices[_0x54e6('0x11')]['googleASR']=function(_0x4d1908,_0x5783cf,_0x3e81c5){scripts['googleASR'](_0x5783cf,_0x4d1908[_0x54e6('0x76')],_0x4d1908['google_asr_language']||_0x54e6('0x8b'))[_0x54e6('0x17')](function(_0x3f6701){_0x3e81c5(null,_0x3f6701);})[_0x54e6('0x18')](function(_0x5e2452){_0x3e81c5(_0x5e2452);});};AGIVertices[_0x54e6('0x11')][_0x54e6('0x8c')]=function(_0x4649bf,_0x1ef26d,_0x103358){scripts[_0x54e6('0x8c')](_0x1ef26d,_0x4649bf['appid'],_0x4649bf[_0x54e6('0x8d')],_0x4649bf[_0x54e6('0x6d')])[_0x54e6('0x17')](function(_0xbfedff){_0x103358(null,_0xbfedff);})[_0x54e6('0x18')](function(_0x5cdde2){_0x103358(_0x5cdde2);});};AGIVertices[_0x54e6('0x11')]['clear']=function(_0xe93dda){var _0x476e52=_[_0x54e6('0x64')](verticesWithRetry,_0xe93dda[_0x54e6('0x39')])?_0xe93dda:_[_0x54e6('0x8e')](_0xe93dda);for(var _0x15cd58 in _0x476e52){if(_0x476e52[_0x54e6('0x8f')](_0x15cd58)){if(_0x476e52[_0x15cd58]&&_[_0x54e6('0x90')](_0x476e52[_0x15cd58])){if(_[_0x54e6('0x64')](recursiveMapAttributes,_0x15cd58)){_0x476e52[_0x15cd58]=this['replaceObjectAllVariables'](_0x476e52[_0x15cd58]);}else{_0x476e52[_0x15cd58]=this['replaceAllVariables'](_0x476e52[_0x15cd58]);}}}}return _0x476e52;};AGIVertices['prototype'][_0x54e6('0x91')]=function(_0x11b1c0){for(var _0x12e398 in _0x11b1c0){if(_0x11b1c0[_0x54e6('0x8f')](_0x12e398)){if(_[_0x54e6('0x92')](_0x11b1c0[_0x12e398])){this['recursiveNodeIndex'](_0x11b1c0[_0x12e398]);}else if(_[_0x54e6('0x93')](_0x11b1c0[_0x12e398])){for(var _0x508db5=0x0;_0x508db5<_0x11b1c0[_0x12e398][_0x54e6('0x94')];_0x508db5++){this[_0x54e6('0x91')](_0x11b1c0[_0x12e398][_0x508db5]);}}else if(_[_0x54e6('0x90')](_0x11b1c0[_0x12e398])){_0x11b1c0[_0x12e398]=this['replaceAllVariables'](_0x11b1c0[_0x12e398]);}}}};AGIVertices[_0x54e6('0x11')][_0x54e6('0x95')]=function(_0x56fb2b,_0x11efea){for(var _0x18908c in _0x56fb2b){if(_0x56fb2b['hasOwnProperty'](_0x18908c)){if(_[_0x54e6('0x92')](_0x56fb2b[_0x18908c])){if(!_['isEmpty'](_0x56fb2b[_0x18908c])){this[_0x54e6('0x95')](_0x56fb2b[_0x18908c],util['format'](_0x54e6('0x96'),_0x11efea,_0x18908c));}}else if(_[_0x54e6('0x93')](_0x56fb2b[_0x18908c])){for(var _0x1458c6=0x0;_0x1458c6<_0x56fb2b[_0x18908c][_0x54e6('0x94')];_0x1458c6++){this[_0x54e6('0x95')](_0x56fb2b[_0x18908c][_0x1458c6],util[_0x54e6('0x28')](_0x54e6('0x96'),_0x11efea,_0x18908c+'['+_0x1458c6+']'));}}else{if(!_[_0x54e6('0x44')](_0x56fb2b[_0x18908c])){this[_0x54e6('0xe')]['setVariable'](util[_0x54e6('0x28')](_0x54e6('0x96'),_0x11efea,_0x18908c),_0x56fb2b[_0x18908c]);}}}}};AGIVertices['prototype'][_0x54e6('0x97')]=function(_0x35426b){try{var _0x3627d3=JSON[_0x54e6('0x69')](_0x35426b);this[_0x54e6('0x91')](_0x3627d3);return JSON[_0x54e6('0x6f')](_0x3627d3);}catch(_0x5b1607){return this[_0x54e6('0x98')](_0x35426b);}};AGIVertices[_0x54e6('0x11')][_0x54e6('0x98')]=function(_0x5b4e6e){var _0x292ed5=_0x5b4e6e[_0x54e6('0x99')]('{');for(var _0x5dab41=0x1;_0x5dab41<_0x292ed5['length'];_0x5dab41+=0x1){var _0x18d137=_0x292ed5[_0x5dab41][_0x54e6('0x99')]('}');if(_0x18d137[_0x54e6('0x94')]>0x1){_0x5b4e6e=_0x5b4e6e[_0x54e6('0x9a')]('{'+_0x18d137[0x0]+'}',this[_0x54e6('0xe')][_0x54e6('0x12')](_0x18d137[0x0])[_0x54e6('0x9b')]||_0x18d137[0x0]);}}if(_0x292ed5['length']===0x1){return _0x5b4e6e[_0x54e6('0x9c')]();}return this[_0x54e6('0x98')](_0x5b4e6e);};AGIVertices['prototype'][_0x54e6('0x9d')]=function(_0x1b5d0f,_0x1398e8){var _0x31a45f=this['channel'][_0x54e6('0x12')](_0x1b5d0f);if(_0x31a45f[_0x54e6('0x9e')]===-0x1){return _0x31a45f;}logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1398e8,_0x31a45f[_0x54e6('0x9b')]));return this['channel'][_0x54e6('0x9f')](_0x1398e8,_0x31a45f['extra']);};AGIVertices['prototype']['isConfigured']=function(_0x1ea463){return _0x1ea463&&_0x1ea463!=='0'&&_0x1ea463!=='-1'&&_0x1ea463!=='';};AGIVertices['prototype']['maxRetry']=function(_0x53b2b4){this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x53b2b4,'-');_0x53b2b4['retry']=_0x53b2b4[_0x54e6('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x54e6('0xa1')]=function(_0x55d4c5){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0xa2'),_0x55d4c5[_0x54e6('0x38')]));if(!this['isConfigured'](_0x55d4c5[_0x54e6('0x5e')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}var _0x1a80fd='\x22'+_0x55d4c5[_0x54e6('0x5e')]+'\x22';if(this[_0x54e6('0x81')](_0x55d4c5[_0x54e6('0x74')])){_0x1a80fd+=','+_0x55d4c5['options'];}var _0xef6efd=this[_0x54e6('0xe')][_0x54e6('0xa5')](_0x54e6('0xa6'),_0x1a80fd);if(_0xef6efd['result']===-0x1){return _0xef6efd;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1a80fd));};AGIVertices['prototype'][_0x54e6('0xa7')]=function(_0x102c4a){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0xa8'),_0x102c4a[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x102c4a[_0x54e6('0xa9')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xaa'));}var _0xed4c1a=_0x102c4a[_0x54e6('0xa9')];if(this[_0x54e6('0x81')](_0x102c4a[_0x54e6('0x74')])){_0xed4c1a+=','+_0x102c4a[_0x54e6('0x74')];}var _0x1289af=this[_0x54e6('0xe')]['exec']('MRCPRecog',_0xed4c1a);if(_0x1289af[_0x54e6('0x9e')]===-0x1){return _0x1289af;}var _0x151616=this['getAndSetVariable'](_0x54e6('0xab'),_0x54e6('0xac'));if(_0x151616[_0x54e6('0x9e')]===-0x1){return _0x151616;}var _0x182a3d=this['getAndSetVariable']('RECOG_INPUT()',_0x54e6('0xad'));if(_0x182a3d[_0x54e6('0x9e')]===-0x1){return _0x182a3d;}var _0x4d8ab0=this[_0x54e6('0x9d')]('RECOG_INSTANCE()',_0x54e6('0xae'));if(_0x4d8ab0['result']===-0x1){return _0x4d8ab0;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xaf'),_0xed4c1a));};AGIVertices['prototype'][_0x54e6('0x6')]=function(_0x3e2aa2){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3e2aa2[_0x54e6('0x38')]));return this['channel']['agi']([_0x3e2aa2['command'],_0x3e2aa2[_0x54e6('0xb0')]]);};AGIVertices[_0x54e6('0x11')][_0x54e6('0xb1')]=function(_0x1124fb){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0xb2'),_0x1124fb[_0x54e6('0x38')]));if(this[_0x54e6('0x81')](_0x1124fb[_0x54e6('0xb3')])){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0xb4'),_0x1124fb[_0x54e6('0xb3')]));var _0x5d6abd=this[_0x54e6('0xe')]['wait'](_0x1124fb[_0x54e6('0xb3')]);if(_0x5d6abd['result']===-0x1){return _0x5d6abd;}}return this[_0x54e6('0xe')][_0x54e6('0xb1')]();};AGIVertices[_0x54e6('0x11')]['callback']=function(_0x449824){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0xb5'),_0x449824[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x449824[_0x54e6('0x49')])){return this['channel'][_0x54e6('0x2c')](_0x449824,_0x54e6('0xb6'));}_0x449824['scheduledAt']=moment();if(this[_0x54e6('0x81')](_0x449824['delay'])){_0x449824[_0x54e6('0x4a')]=moment()[_0x54e6('0xb7')](_0x449824[_0x54e6('0xb8')],_0x54e6('0xb9'));}if(!this[_0x54e6('0x81')](_0x449824[_0x54e6('0x4c')])){_0x449824[_0x54e6('0x4c')]=0x2;}this[_0x54e6('0x42')][_0x54e6('0x6c')](this,_0x449824);return this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xba'),_0x449824['phone'],_0x449824[_0x54e6('0x49')],_0x449824[_0x54e6('0x4a')]));};AGIVertices['prototype'][_0x54e6('0xbb')]=function(_0x8e7f6f){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x8e7f6f[_0x54e6('0x38')]));var _0x5baa24=this['channel']['exec'](_0x8e7f6f[_0x54e6('0xbc')],_0x8e7f6f['options']);if(_0x5baa24[_0x54e6('0x9e')]===-0x1){return _0x5baa24;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format']('Executed\x20command\x20%s\x20%s',_0x8e7f6f[_0x54e6('0xbc')],_0x8e7f6f[_0x54e6('0x74')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x6ed56f){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0xbd'),_0x6ed56f['label']));if(!this[_0x54e6('0x81')](_0x6ed56f[_0x54e6('0x5e')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}var _0x52e139='\x22'+_0x6ed56f[_0x54e6('0x5e')]+'\x22';if(this[_0x54e6('0x81')](_0x6ed56f[_0x54e6('0x74')])){_0x52e139+=','+_0x6ed56f['options'];}var _0x188fdc=this[_0x54e6('0xe')][_0x54e6('0xa5')](_0x54e6('0xa6'),_0x52e139);if(_0x188fdc[_0x54e6('0x9e')]===-0x1){return _0x188fdc;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0xbe'),_0x52e139));};AGIVertices[_0x54e6('0x11')]['sestektts']=function(_0xa9a1ad){logger['info'](util[_0x54e6('0x28')](_0x54e6('0xbf'),_0xa9a1ad[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0xa9a1ad[_0x54e6('0x5e')])){return this[_0x54e6('0xe')]['noop']('no\x20text\x20configured');}var _0x195cf3='\x22'+_0xa9a1ad[_0x54e6('0x5e')]+'\x22';if(this['isConfigured'](_0xa9a1ad['options'])){_0x195cf3+=','+_0xa9a1ad['options'];}var _0x503491=this[_0x54e6('0xe')][_0x54e6('0xa5')](_0x54e6('0xa6'),_0x195cf3);if(_0x503491[_0x54e6('0x9e')]===-0x1){return _0x503491;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x195cf3));};AGIVertices[_0x54e6('0x11')][_0x54e6('0xc0')]=function(_0xeaf545){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0xc1'),_0xeaf545[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0xeaf545[_0x54e6('0xa9')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xaa'));}var _0x4f57be=_0xeaf545[_0x54e6('0xa9')];if(this[_0x54e6('0x81')](_0xeaf545[_0x54e6('0x74')])){_0x4f57be+=','+_0xeaf545[_0x54e6('0x74')];}var _0x49901e=this[_0x54e6('0xe')][_0x54e6('0xa5')](_0x54e6('0xc2'),_0x4f57be);if(_0x49901e['result']===-0x1){return _0x49901e;}var _0x2f37ca=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x54e6('0xc3'));if(_0x2f37ca['result']===-0x1){return _0x2f37ca;}var _0x196039=this['getAndSetVariable']('RECOG_INPUT()',_0x54e6('0xc4'));if(_0x196039[_0x54e6('0x9e')]===-0x1){return _0x196039;}var _0x7ef441=this[_0x54e6('0x9d')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x7ef441[_0x54e6('0x9e')]===-0x1){return _0x7ef441;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xaf'),_0x4f57be));};AGIVertices[_0x54e6('0x11')][_0x54e6('0xc5')]=function(_0x123146){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0xc6'),_0x123146[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x123146[_0x54e6('0xa9')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xaa'));}var _0x5be7b0=_0x123146['grammar'];if(this[_0x54e6('0x81')](_0x123146[_0x54e6('0x74')])){_0x5be7b0+=','+_0x123146[_0x54e6('0x74')];}var _0x498533=this[_0x54e6('0xe')]['exec'](_0x54e6('0xc2'),_0x5be7b0);if(_0x498533[_0x54e6('0x9e')]===-0x1){return _0x498533;}var _0x130888=this['getAndSetVariable'](_0x54e6('0xab'),_0x54e6('0xc7'));if(_0x130888[_0x54e6('0x9e')]===-0x1){return _0x130888;}var _0x2507a6=this[_0x54e6('0x9d')]('RECOG_INPUT()',_0x54e6('0xc8'));if(_0x2507a6['result']===-0x1){return _0x2507a6;}var _0x314c5a=this['getAndSetVariable'](_0x54e6('0xc9'),_0x54e6('0xca'));if(_0x314c5a[_0x54e6('0x9e')]===-0x1){return _0x314c5a;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xaf'),_0x5be7b0));};AGIVertices[_0x54e6('0x11')][_0x54e6('0xcb')]=function(_0x4ec097){logger[_0x54e6('0x2e')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x4ec097[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x4ec097[_0x54e6('0xcc')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x4ec097,'no\x20database\x20selected');}var _0x559ef0=this[_0x54e6('0xcd')][_0x54e6('0x6c')](this,_0x4ec097[_0x54e6('0xcc')]);if(!_0x559ef0){return this[_0x54e6('0xe')]['error'](_0x4ec097,_0x54e6('0xce'));}if(!this[_0x54e6('0x81')](_0x4ec097[_0x54e6('0x30')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x4ec097,_0x54e6('0xcf'));}var _0x509c8c=_0x4ec097['query'][_0x54e6('0xd0')](/(\r\n|\n|\r)/gm,'\x20');this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')](_0x54e6('0xd1'),_0x509c8c));var _0x584e0e=this[_0x54e6('0x2a')][_0x54e6('0x6c')](this,_0x559ef0,_0x509c8c);this['createSquareDetailsReport'][_0x54e6('0x6c')](this,_0x4ec097,_0x509c8c);if(!this[_0x54e6('0x81')](_0x4ec097[_0x54e6('0xd2')])){return this['channel'][_0x54e6('0xa3')](_0x54e6('0xd3'));}var _0xe5a90c=this[_0x54e6('0x12')][_0x54e6('0x6c')](this,_0x4ec097[_0x54e6('0xd2')]);if(!_0xe5a90c){return this[_0x54e6('0xe')]['error'](_0x4ec097,_0x54e6('0xd4'));}var _0xca571d=this;_0x584e0e[_0x54e6('0xd5')](function(_0x19a422,_0x43a384){Object['keys'](_0x19a422)[_0x54e6('0xd5')](function(_0x56a86f){_0xca571d[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')]('%s[%s][%s]',_0xe5a90c,_0x43a384,_0x56a86f),_0x19a422[_0x56a86f]);});});this[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0xd6'),_0xe5a90c),_0x584e0e[_0x54e6('0x94')]);return this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xd7'),_0xe5a90c));};AGIVertices[_0x54e6('0x11')]['dial']=function(_0x4af333){logger[_0x54e6('0xd8')](util[_0x54e6('0x28')](_0x54e6('0xd9'),_0x4af333[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x4af333[_0x54e6('0xda')])){return this[_0x54e6('0xe')]['error'](_0x4af333,_0x54e6('0xdb'));}var _0x2e0da8=this[_0x54e6('0xdc')][_0x54e6('0x6c')](this,_0x4af333[_0x54e6('0xda')]);if(!_0x2e0da8){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x4af333,_0x54e6('0xdd'));}var _0x303664=this[_0x54e6('0xe')]['exec'](_0x54e6('0xde'),[util[_0x54e6('0x28')](_0x54e6('0xdf'),_0x2e0da8),_0x4af333[_0x54e6('0xb3')],_0x4af333[_0x54e6('0xe0')],_0x4af333['url']]);if(_0x303664[_0x54e6('0x9e')]===-0x1){return _0x303664;}return this[_0x54e6('0xe')]['noop'](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x54e6('0x11')][_0x54e6('0xe1')]=function(_0x19d472){logger['info'](util[_0x54e6('0x28')](_0x54e6('0xe2'),_0x19d472['label']));if(!this[_0x54e6('0x81')](_0x19d472[_0x54e6('0x76')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')]('no\x20key\x20configured');}if(!this[_0x54e6('0x81')](_0x19d472[_0x54e6('0x5e')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}this['channel'][_0x54e6('0xe3')]=!![];this[_0x54e6('0x36')](_0x19d472);this[_0x54e6('0x41')](_0x19d472[_0x54e6('0x5e')],'in','','');this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')](_0x54e6('0xe4'),_0x19d472[_0x54e6('0x5e')]));var _0x4ffd0c=this[_0x54e6('0x75')][_0x54e6('0x6c')](this,_0x19d472);if(_0x4ffd0c){for(var _0x146e48 in _0x4ffd0c){if(_0x4ffd0c[_0x54e6('0x8f')](_0x146e48)){this[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0xe5'),_0x146e48[_0x54e6('0xe6')]()),_0x4ffd0c[_0x146e48]);}}this[_0x54e6('0x41')](_0x4ffd0c[_0x54e6('0xe7')],_0x54e6('0xe8'),_0x54e6('0xe1'),'');return this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0xe9'),_0x4ffd0c['speech']));}return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x19d472,_0x54e6('0xea'));};AGIVertices[_0x54e6('0x11')]['dialogflowV2']=function(_0xc11f2b){logger['info'](util[_0x54e6('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0xc11f2b[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0xc11f2b[_0x54e6('0x79')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xeb'));}if(!this['isConfigured'](_0xc11f2b[_0x54e6('0x7a')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xec'));}if(!this['isConfigured'](_0xc11f2b[_0x54e6('0x7b')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0xc11f2b[_0x54e6('0x7c')])){return this[_0x54e6('0xe')]['noop'](_0x54e6('0xed'));}if(!this[_0x54e6('0x81')](_0xc11f2b[_0x54e6('0x5e')])){return this['channel'][_0x54e6('0xa3')](_0x54e6('0xa4'));}this[_0x54e6('0xe')]['bot']=!![];this[_0x54e6('0x36')](_0xc11f2b);this[_0x54e6('0x41')](_0xc11f2b[_0x54e6('0x5e')],'in','','');this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xee'),_0xc11f2b[_0x54e6('0x5e')]));var _0x186f0c=this['googleDialogflowV2'][_0x54e6('0x6c')](this,_0xc11f2b);if(_0x186f0c){for(var _0x536aab in _0x186f0c){if(_0x186f0c['hasOwnProperty'](_0x536aab)){if(_0x536aab!==_0x54e6('0xef')){this[_0x54e6('0xe')]['setVariable'](util['format'](_0x54e6('0xe5'),_0x536aab['toUpperCase']()),_0x186f0c[_0x536aab]);}}}this['createSquareMessage'](_0x186f0c[_0x54e6('0xe7')],_0x54e6('0xe8'),_0x54e6('0xf0'),_0x186f0c[_0x54e6('0xef')]);return this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xf1'),_0x186f0c[_0x54e6('0xe7')]));}return this['channel'][_0x54e6('0x2c')](_0xc11f2b,_0x54e6('0xf2'));};AGIVertices['prototype'][_0x54e6('0xf3')]=function(_0x1c4f71){logger['info'](util[_0x54e6('0x28')](_0x54e6('0xf4'),_0x1c4f71[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x1c4f71['ndauth_url'])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xf5'));}if(!this[_0x54e6('0x81')](_0x1c4f71['username'])){return this['channel']['noop'](_0x54e6('0xf6'));}if(!this[_0x54e6('0x81')](_0x1c4f71[_0x54e6('0xf7')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xf8'));}if(!this[_0x54e6('0x81')](_0x1c4f71[_0x54e6('0xf9')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}this[_0x54e6('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x1c4f71);this[_0x54e6('0x41')](_0x1c4f71[_0x54e6('0x5e')],'in','','');this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xfa'),_0x1c4f71[_0x54e6('0x5e')]));var _0x5d8d3e=this['sestekNDA']['sync'](this,_0x1c4f71);if(_0x5d8d3e){for(var _0x8faf0f in _0x5d8d3e){if(_0x5d8d3e['hasOwnProperty'](_0x8faf0f)){this[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0xfb'),_0x8faf0f['toUpperCase']()),_0x5d8d3e[_0x8faf0f]);}}this[_0x54e6('0x41')](_0x5d8d3e[_0x54e6('0xe7')],_0x54e6('0xe8'),'sesteknda','');if(_0x5d8d3e[_0x54e6('0xfc')]){this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0xfd'),_0x5d8d3e[_0x54e6('0xfc')]));var _0xba0096=this[_0x54e6('0xe')][_0x54e6('0xfe')](_0x5d8d3e[_0x54e6('0xfc')]);try{fs[_0x54e6('0xff')](_0x5d8d3e['audiofile']+'.wav');}catch(_0x28bd0c){logger[_0x54e6('0x2c')](_0x28bd0c);}return _0xba0096;}else{return this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')]('SestekNDA\x20Result\x20%s',_0x5d8d3e[_0x54e6('0xe7')]));}}return this[_0x54e6('0xe')]['error'](_0x1c4f71,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x5627f8){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x5627f8['label']));return this[_0x54e6('0xe')][_0x54e6('0xa3')]('end');};AGIVertices['prototype'][_0x54e6('0x100')]=function(_0x357e69){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0x101'),_0x357e69[_0x54e6('0x38')]));var _0x2cfd69='';if(_0x357e69['trunk_id']){if(!this[_0x54e6('0x81')](_0x357e69[_0x54e6('0x102')])){return this['channel'][_0x54e6('0x2c')](_0x357e69,_0x54e6('0x103'));}else{var _0x3e1dd3=parseInt(_0x357e69[_0x54e6('0x102')],0xa);if(isNaN(_0x3e1dd3)){_0x2cfd69=_0x357e69[_0x54e6('0x102')];}else{_0x2cfd69=this[_0x54e6('0x1b')]['sync'](this,_0x357e69['trunk_id']);if(!_0x2cfd69){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x357e69,_0x54e6('0x104'));}}}}else if(_0x357e69[_0x54e6('0x105')]){_0x2cfd69=_0x357e69['trunk_name'];}else{return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x357e69,_0x54e6('0x103'));}var _0x505707=this[_0x54e6('0xe')][_0x54e6('0xa5')]('DIAL',[util[_0x54e6('0x28')](_0x54e6('0x106'),_0x2cfd69,_0x357e69[_0x54e6('0x48')]),_0x357e69[_0x54e6('0xb3')],_0x357e69['opts'],_0x357e69[_0x54e6('0x61')]]);if(_0x505707[_0x54e6('0x9e')]===-0x1){return _0x505707;}return this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x107'),_0x54e6('0xde')));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x108')]=function(_0x2a9b6a){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2a9b6a['label']));return this[_0x54e6('0xe')]['noop'](_0x54e6('0x108'));};AGIVertices['prototype'][_0x54e6('0xc')]=function(_0x4142f9){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0x109'),_0x4142f9['label']));if(_0x4142f9['retry']===0x0){return this[_0x54e6('0xa0')](_0x4142f9);}_0x4142f9[_0x54e6('0x10a')]-=0x1;if(!this[_0x54e6('0x81')](_0x4142f9[_0x54e6('0x10b')])){return this[_0x54e6('0xe')]['error'](_0x4142f9,_0x54e6('0x10c'));}var _0x192c44=this[_0x54e6('0x1c')][_0x54e6('0x6c')](this,_0x4142f9[_0x54e6('0x10b')]);if(!_0x192c44){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x4142f9,'no\x20file\x20audio\x20found');}if(!this[_0x54e6('0x81')](_0x4142f9['variable_id'])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x54e6('0xd3'));}var _0x2eb7c6=this['channel'][_0x54e6('0x10d')](_0x192c44,_0x4142f9[_0x54e6('0x10e')],_0x4142f9[_0x54e6('0x10f')]);var _0x274916=_0x2eb7c6['result']?_0x2eb7c6['result'][_0x54e6('0x9c')]():'';logger['info'](_0x54e6('0x110'),JSON[_0x54e6('0x6f')](_0x2eb7c6));if(_0x2eb7c6['result']===-0x1){this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x4142f9,_0x274916);return _0x2eb7c6;}else if(_0x2eb7c6[_0x54e6('0x9b')]===_0x54e6('0xb3')){_0x2eb7c6[_0x54e6('0x9e')]=_0x274916[_0x54e6('0x94')]>=parseInt(_0x4142f9[_0x54e6('0x111')])?'x':'i';}else{_0x2eb7c6['result']=_0x274916[_0x54e6('0x94')]>=parseInt(_0x4142f9[_0x54e6('0x111')])&&_0x274916[_0x54e6('0x94')]<=parseInt(_0x4142f9[_0x54e6('0x10f')])?'x':'i';}var _0x3bdf22=this[_0x54e6('0x12')][_0x54e6('0x6c')](this,_0x4142f9[_0x54e6('0xd2')]);if(!_0x3bdf22){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x4142f9,'no\x20variable\x20found');}this[_0x54e6('0xe')][_0x54e6('0x9f')](_0x3bdf22,_0x274916);if(this['isConfigured'](_0x4142f9[_0x54e6('0x112')])){var _0x100206=parseInt(_0x4142f9[_0x54e6('0x112')],0xa);var _0xb4917d=rs['generate']({'charset':'*','length':_0x100206});var _0xddf403=_0x274916[_0x54e6('0x94')];if(_0xddf403>0x0){if(_0xddf403>_0x100206){this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x4142f9,_0x4142f9[_0x54e6('0x113')]===_0x54e6('0x114')?_0xb4917d+_0x274916[_0x54e6('0x115')](_0x100206):_0x274916[_0x54e6('0x115')](0x0,_0xddf403-_0x100206)+_0xb4917d);}else{this['createSquareDetailsReport'][_0x54e6('0x6c')](this,_0x4142f9,rs['generate']({'charset':'*','length':_0xddf403}));}}else{this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x4142f9,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x4142f9,_0x274916);}return _0x2eb7c6;};AGIVertices['prototype'][_0x54e6('0xd')]=function(_0xdbcc4d){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x116'),_0xdbcc4d['label']));return this[_0x54e6('0xc')](_0xdbcc4d);};AGIVertices[_0x54e6('0x11')][_0x54e6('0x117')]=function(_0x1de349){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x118'),_0x1de349[_0x54e6('0x38')]));this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x1de349,_0x1de349[_0x54e6('0x119')]);return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x11a'),_0x1de349[_0x54e6('0x119')]));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x11b')]=function(_0x5f4733){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0x11c'),_0x5f4733['label']));if(!this[_0x54e6('0x81')](_0x5f4733['aws_access_key_id'])||!this[_0x54e6('0x81')](_0x5f4733[_0x54e6('0x85')])){return this[_0x54e6('0xe')]['noop'](_0x54e6('0x11d'));}if(!this[_0x54e6('0x81')](_0x5f4733[_0x54e6('0x5e')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x11e'),_0x5f4733[_0x54e6('0x5e')]));var _0x525bf6=this[_0x54e6('0x83')]['sync'](this,_0x5f4733);if(_0x525bf6){this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')](_0x54e6('0x11f'),_0x525bf6));var _0x22d7a0=this['channel'][_0x54e6('0xfe')](_0x525bf6);try{fs[_0x54e6('0xff')](_0x525bf6+_0x54e6('0x120'));}catch(_0xd49ed4){logger[_0x54e6('0x2c')](_0xd49ed4);}return _0x22d7a0;}return this['channel']['error'](_0x5f4733,_0x54e6('0x121'));};AGIVertices[_0x54e6('0x11')]['awslex']=function(_0x2d25f4){logger['info'](util[_0x54e6('0x28')](_0x54e6('0x122'),_0x2d25f4[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x2d25f4[_0x54e6('0x84')])||!this['isConfigured'](_0x2d25f4[_0x54e6('0x85')])){return this[_0x54e6('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x54e6('0x81')](_0x2d25f4['aws_bot_name'])){return this['channel'][_0x54e6('0xa3')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x2d25f4[_0x54e6('0x5e')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}this['channel'][_0x54e6('0xe3')]=!![];this[_0x54e6('0x36')](_0x2d25f4);this[_0x54e6('0x41')](_0x2d25f4[_0x54e6('0x5e')],'in','','');this['channel'][_0x54e6('0xa3')](util['format'](_0x54e6('0x123'),_0x2d25f4[_0x54e6('0x5e')]));var _0x24c5bf=this['awsLex'][_0x54e6('0x6c')](this,_0x2d25f4);if(_0x24c5bf){for(var _0x3a52ac in _0x24c5bf){if(_0x24c5bf['hasOwnProperty'](_0x3a52ac)&&_['isString'](_0x24c5bf[_0x3a52ac])){this[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0x124'),_0x3a52ac[_0x54e6('0xe6')]()),_0x24c5bf[_0x3a52ac]);}}if(_['isNil'](_0x24c5bf[_0x54e6('0x72')])){return this['channel'][_0x54e6('0xa3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x54e6('0x41')](_0x24c5bf[_0x54e6('0x72')],_0x54e6('0xe8'),'amazonlex','');return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x24c5bf['message']));}}return this['channel']['error'](_0x2d25f4,_0x54e6('0x125'));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x126')]=function(_0x150974){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0x127'),_0x150974[_0x54e6('0x38')],_0x150974['timeout']));if(!this[_0x54e6('0x81')](_0x150974[_0x54e6('0x76')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x128'));}var _0x4c1927=_0x54e6('0x129');var _0x259f14=util[_0x54e6('0x28')](_0x54e6('0x12a'),FILES_PATH,rs[_0x54e6('0x12b')](0x4));var _0x5623d9=util[_0x54e6('0x28')](_0x54e6('0x96'),_0x259f14,_0x4c1927);var _0x2c67bc=!![];if(_0x150974['beep']===_0x54e6('0x12c')){_0x2c67bc=![];}var _0x1c2954=this['channel'][_0x54e6('0x12d')](_0x259f14,_0x4c1927,_0x150974[_0x54e6('0x12e')],_0x150974[_0x54e6('0xb3')],undefined,_0x2c67bc);if(_0x1c2954[_0x54e6('0x9e')]!==-0x1){this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')]('google\x20%s\x20file\x20created',_0x5623d9));var _0x23d295=this[_0x54e6('0x12f')][_0x54e6('0x6c')](this,_0x150974,_0x5623d9);if(_0x23d295){for(var _0x3010fb in _0x23d295){if(_0x23d295[_0x54e6('0x8f')](_0x3010fb)){this[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0x130'),_0x3010fb['toUpperCase']()),_0x23d295[_0x3010fb]);}}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0x131'),JSON[_0x54e6('0x6f')](_0x23d295)));}}return _0x1c2954;};AGIVertices[_0x54e6('0x11')][_0x54e6('0x132')]=function(_0x273904){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x133'),_0x273904[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x273904[_0x54e6('0x134')])){return this['channel'][_0x54e6('0xa3')]('no\x20appid\x20configured');}if(!this[_0x54e6('0x81')](_0x273904[_0x54e6('0x8d')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x135'));}var _0x4e2033=_0x54e6('0x129');var _0x50afd4=util[_0x54e6('0x28')](_0x54e6('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x196f31=util['format'](_0x54e6('0x96'),_0x50afd4,_0x4e2033);var _0x475c2a=!![];if(_0x273904['beep']==='NOBEEP'){_0x475c2a=![];}var _0x3f83c4=this[_0x54e6('0xe')][_0x54e6('0x12d')](_0x50afd4,_0x4e2033,_0x273904[_0x54e6('0x12e')],_0x273904[_0x54e6('0xb3')],undefined,_0x475c2a);if(_0x3f83c4[_0x54e6('0x9e')]!==-0x1){this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x136'),_0x196f31));var _0x3263f7=this[_0x54e6('0x8c')][_0x54e6('0x6c')](this,_0x273904,_0x196f31);if(_0x3263f7){for(var _0xf13fa0 in _0x3263f7){if(_0x3263f7[_0x54e6('0x8f')](_0xf13fa0)){this[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')]('TILDE_ASR_%s',_0xf13fa0[_0x54e6('0xe6')]()),_0x3263f7[_0xf13fa0]);}}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x137'),JSON['stringify'](_0x3263f7)));}}return _0x3f83c4;};AGIVertices[_0x54e6('0x11')][_0x54e6('0x138')]=function(_0x4b5ded){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4b5ded[_0x54e6('0x38')]));return this[_0x54e6('0xe')]['continueAt'](_0x4b5ded[_0x54e6('0x3d')],_0x4b5ded[_0x54e6('0x3e')],_0x4b5ded[_0x54e6('0x3f')]);};AGIVertices['prototype'][_0x54e6('0x139')]=function(_0xd69c81){logger['info'](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xd69c81[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0xd69c81[_0x54e6('0x13a')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0xd69c81,_0x54e6('0x13b'));}try{var _0x3b44e9=eval(_0xd69c81[_0x54e6('0x13a')])?'true':_0x54e6('0x13c');this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0x13d'),_0xd69c81[_0x54e6('0x13a')],_0x3b44e9));return{'code':0xc8,'result':_0x3b44e9};}catch(_0xd7267c){return{'code':0xc8,'result':_0x54e6('0x13c')};}};AGIVertices['prototype']['gotoiftime']=function(_0x44c1d9){logger[_0x54e6('0x2e')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x44c1d9[_0x54e6('0x38')]));if(!this['isConfigured'](_0x44c1d9[_0x54e6('0x13e')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x44c1d9,_0x54e6('0x13f'));}var _0xbd5da2=this[_0x54e6('0x22')]['sync'](this,_0x44c1d9[_0x54e6('0x13e')]);if(!_0xbd5da2){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x44c1d9,_0x54e6('0x140'));}for(var _0x56e6dd=0x0;_0x56e6dd<_0xbd5da2['length'];_0x56e6dd+=0x1){var _0x55e3bb=this['channel'][_0x54e6('0x12')](util[_0x54e6('0x28')](_0x54e6('0x141'),_0xbd5da2[_0x56e6dd]));if(_0x55e3bb[_0x54e6('0x9e')]===-0x1){return _0x55e3bb;}logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('IFTIME\x20%s\x20%s',_0xbd5da2[_0x56e6dd],_0x55e3bb[_0x54e6('0x9b')]));if(_0x55e3bb[_0x54e6('0x9b')]==='true'){logger['info'](util[_0x54e6('0x28')]('IFTIME\x20%s\x20%s',_0xbd5da2[_0x56e6dd],_0x54e6('0x142')));this['channel']['noop'](util['format'](_0x54e6('0x143'),_0xbd5da2[_0x56e6dd],'true'));return{'code':0xc8,'result':_0x54e6('0x142')};}else{logger['info'](util[_0x54e6('0x28')]('IFTIME\x20%s\x20%s',_0xbd5da2[_0x56e6dd],'false'));this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x143'),_0xbd5da2[_0x56e6dd],'false'));}}return{'code':0xc8,'result':_0x54e6('0x13c')};};AGIVertices['prototype'][_0x54e6('0x144')]=function(_0x4249f6){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x145'),_0x4249f6[_0x54e6('0x38')]));return this['channel'][_0x54e6('0x144')]();};AGIVertices['prototype']['ispeechasr']=function(_0x5a8156){logger['info'](util[_0x54e6('0x28')](_0x54e6('0x146'),_0x5a8156[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x5a8156['key'])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x128'));}var _0x36d1e2='wav';var _0x4401c3=util['format'](_0x54e6('0x12a'),FILES_PATH,rs[_0x54e6('0x12b')](0x4));var _0x1ea687=util[_0x54e6('0x28')](_0x54e6('0x96'),_0x4401c3,_0x36d1e2);var _0x3eb9da=!![];if(_0x5a8156[_0x54e6('0x147')]===_0x54e6('0x12c')){_0x3eb9da=![];}var _0x5dcfa0=this[_0x54e6('0xe')][_0x54e6('0x12d')](_0x4401c3,_0x36d1e2,_0x5a8156[_0x54e6('0x12e')],_0x5a8156['timeout'],undefined,_0x3eb9da);if(_0x5dcfa0[_0x54e6('0x9e')]!==-0x1){this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')]('ispeech\x20%s\x20file\x20created',_0x1ea687));var _0x277ac3=this[_0x54e6('0x80')]['sync'](this,_0x5a8156,_0x1ea687);if(_0x277ac3){for(var _0x25dc3e in _0x277ac3){if(_0x277ac3['hasOwnProperty'](_0x25dc3e)){this[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0x148'),_0x25dc3e[_0x54e6('0xe6')]()),_0x277ac3[_0x25dc3e]);}}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0x149'),JSON['stringify'](_0x277ac3)));}}return _0x5dcfa0;};AGIVertices[_0x54e6('0x11')][_0x54e6('0x14a')]=function(_0xa710c3){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x14b'),_0xa710c3[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0xa710c3[_0x54e6('0x76')])){return this['channel']['noop'](_0x54e6('0x128'));}if(!this[_0x54e6('0x81')](_0xa710c3[_0x54e6('0x5e')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0xa710c3[_0x54e6('0x5e')]));var _0x36b23a=this[_0x54e6('0x7e')]['sync'](this,_0xa710c3);if(_0x36b23a){this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0x14c'),_0x36b23a));var _0x596738=this[_0x54e6('0xe')][_0x54e6('0xfe')](_0x36b23a,_0xa710c3[_0x54e6('0x12e')]);try{fs[_0x54e6('0xff')](_0x36b23a+_0x54e6('0x120'));}catch(_0x53f3f4){logger[_0x54e6('0x2c')](_0x53f3f4);}return _0x596738;}return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0xa710c3,_0x54e6('0x14d'));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x14e')]=function(_0x4a778d){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x14f'),_0x4a778d[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x4a778d[_0x54e6('0x150')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x4a778d,_0x54e6('0x151'));}logger['info'](util[_0x54e6('0x28')](_0x54e6('0x152'),this['channel'][_0x54e6('0x3b')],_0x4a778d[_0x54e6('0x150')]));var _0x350216=this['agentLogin'][_0x54e6('0x6c')](this,_0x4a778d[_0x54e6('0x150')]);if(_0x350216){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x4a778d['findBy']));this['channel']['noop'](util[_0x54e6('0x28')](_0x54e6('0x153'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x4a778d[_0x54e6('0x150')]));return{'code':0xc8,'result':_0x54e6('0x154')};}else{logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x4a778d[_0x54e6('0x150')]));this[_0x54e6('0xe')]['noop'](util['format'](_0x54e6('0x155'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x4a778d['findBy']));return{'code':0xc8,'result':_0x54e6('0x156')};}};AGIVertices[_0x54e6('0x11')][_0x54e6('0x157')]=function(_0x2d8a2e){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x158'),_0x2d8a2e[_0x54e6('0x38')]));if(!this['isConfigured'](_0x2d8a2e[_0x54e6('0x150')])){return this['channel'][_0x54e6('0x2c')](_0x2d8a2e,'no\x20find\x20by\x20configured');}logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x2d8a2e['findBy']));var _0x1f198c=this[_0x54e6('0x51')][_0x54e6('0x6c')](this,_0x2d8a2e['findBy']);if(_0x1f198c){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x153'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x2d8a2e[_0x54e6('0x150')]));this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x2d8a2e[_0x54e6('0x150')]));return{'code':0xc8,'result':_0x54e6('0x154')};}else{logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x155'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x2d8a2e[_0x54e6('0x150')]));this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0x155'),this[_0x54e6('0xe')]['callerid'],_0x2d8a2e[_0x54e6('0x150')]));return{'code':0xc8,'result':_0x54e6('0x156')};}};AGIVertices[_0x54e6('0x11')]['math']=function(_0x1f4466){logger['info'](util[_0x54e6('0x28')](_0x54e6('0x159'),_0x1f4466[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x1f4466[_0x54e6('0x15a')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x1f4466,'no\x20operation\x20configured');}this[_0x54e6('0xe')]['noop'](util['format'](_0x54e6('0x15b'),_0x1f4466[_0x54e6('0x15a')]));var _0x21b66d=eval(_0x1f4466[_0x54e6('0x15a')]);if(!this[_0x54e6('0x81')](_0x1f4466[_0x54e6('0xd2')])){return this[_0x54e6('0xe')]['noop'](_0x54e6('0xd3'));}var _0x3a1a92=this[_0x54e6('0x12')][_0x54e6('0x6c')](this,_0x1f4466[_0x54e6('0xd2')]);if(!_0x3a1a92){return this['channel'][_0x54e6('0x2c')](_0x1f4466,'no\x20variable\x20found');}if(_['isArray'](_0x21b66d)){var _0x514db5=this;_0x21b66d[_0x54e6('0xd5')](function(_0x35acd3,_0x29cdf1){_0x514db5[_0x54e6('0xe')][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0x15c'),_0x3a1a92,_0x29cdf1),_0x35acd3);});return this[_0x54e6('0xe')]['noop'](util['format'](_0x54e6('0x15d'),_0x3a1a92));}else{return this['channel']['setVariable'](_0x3a1a92,_0x21b66d);}};AGIVertices[_0x54e6('0x11')]['menu']=function(_0x1cf83d){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0x15e'),_0x1cf83d['label']));if(_0x1cf83d['retry']===0x0){return this[_0x54e6('0xa0')](_0x1cf83d);}_0x1cf83d[_0x54e6('0x10a')]-=0x1;if(!this[_0x54e6('0x81')](_0x1cf83d[_0x54e6('0x10b')])){return this[_0x54e6('0xe')]['error'](_0x1cf83d,'no\x20file\x20audio\x20selected');}var _0x35128c=this[_0x54e6('0x1c')]['sync'](this,_0x1cf83d[_0x54e6('0x10b')]);if(!_0x35128c){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x1cf83d,_0x54e6('0x15f'));}var _0x5aed28=this[_0x54e6('0xe')][_0x54e6('0x10d')](_0x35128c,_0x1cf83d[_0x54e6('0x10e')],_0x1cf83d[_0x54e6('0x160')]);var _0x4b7a94=_0x5aed28['result'];if(_0x5aed28['result']===-0x1){this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x1cf83d,'-1');return _0x5aed28;}else if(_0x5aed28[_0x54e6('0x9b')]==='timeout'){_0x5aed28[_0x54e6('0x9e')]=_0x5aed28[_0x54e6('0x9e')][_0x54e6('0x94')]>0x0?_0x5aed28['result']:'t';}else if(_['isEmpty'](_0x5aed28[_0x54e6('0x9e')])){_0x5aed28[_0x54e6('0x9e')]='#';_0x4b7a94='#';}if(!this[_0x54e6('0x81')](_0x1cf83d[_0x54e6('0xd2')])){this[_0x54e6('0xe')][_0x54e6('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5bb497=this[_0x54e6('0x12')][_0x54e6('0x6c')](this,_0x1cf83d[_0x54e6('0xd2')]);if(!_0x5bb497){return this[_0x54e6('0xe')]['error'](_0x1cf83d,'no\x20variable\x20found');}this[_0x54e6('0xe')]['setVariable'](_0x5bb497,_0x4b7a94);}this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x1cf83d,_0x4b7a94);return _0x5aed28;};AGIVertices[_0x54e6('0x11')][_0x54e6('0xa3')]=function(_0x1ed6b8){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x161'),_0x1ed6b8['label']));return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x1ed6b8[_0x54e6('0x162')]||_0x1ed6b8[_0x54e6('0x38')]);};AGIVertices['prototype'][_0x54e6('0x163')]=function(_0x375501){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x164'),_0x375501[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x375501[_0x54e6('0x150')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x375501,_0x54e6('0x151'));}logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x375501[_0x54e6('0x150')]));var _0xc29720=this[_0x54e6('0x4d')]['sync'](this,_0x375501[_0x54e6('0x165')]);var _0x407214=this[_0x54e6('0x4e')]['sync'](this,_0x375501[_0x54e6('0x150')],_0xc29720);if(_0x407214){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x375501[_0x54e6('0x150')]));this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x153'),this['channel'][_0x54e6('0x3b')],_0x375501[_0x54e6('0x150')]));return{'code':0xc8,'result':_0x54e6('0x154')};}else{logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x155'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x375501['findBy']));this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x153'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x375501[_0x54e6('0x150')]));return{'code':0xc8,'result':_0x54e6('0x156')};}};AGIVertices[_0x54e6('0x11')][_0x54e6('0x166')]=function(_0x594f62){logger['info'](util[_0x54e6('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x594f62[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x594f62[_0x54e6('0x10b')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x594f62,_0x54e6('0x10c'));}var _0x21a4b5=this['getSound'][_0x54e6('0x6c')](this,_0x594f62[_0x54e6('0x10b')]);if(!_0x21a4b5){return this[_0x54e6('0xe')]['error'](_0x594f62,_0x54e6('0x15f'));}var _0x596edd=this[_0x54e6('0xe')][_0x54e6('0xa5')](_0x54e6('0x167'),[_0x21a4b5,_0x594f62[_0x54e6('0xe0')]]);if(_0x596edd['result']===-0x1){return _0x596edd;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x21a4b5));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x168')]=function(_0x2dde19){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0x169'),_0x2dde19[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x2dde19[_0x54e6('0x16a')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x2dde19,_0x54e6('0x16b'));}var _0x298e9d='';var _0x18a9fa=parseInt(_0x2dde19[_0x54e6('0x16a')],0xa);if(isNaN(_0x18a9fa)){_0x298e9d=_0x2dde19[_0x54e6('0x16a')];}else{_0x298e9d=this[_0x54e6('0x15')]['sync'](this,_0x2dde19[_0x54e6('0x16a')]);if(!_0x298e9d){return this['channel'][_0x54e6('0x2c')](_0x2dde19,'no\x20queue\x20found');}}var _0x4fd008='';if(this[_0x54e6('0x81')](_0x2dde19[_0x54e6('0x10b')])){var _0xf6c2c9=this[_0x54e6('0x1c')][_0x54e6('0x6c')](this,_0x2dde19[_0x54e6('0x10b')]);if(_0xf6c2c9){_0x4fd008=_0xf6c2c9;}}this['createSquareDetailsReport']['sync'](this,_0x2dde19,_0x298e9d);if(_0x2dde19[_0x54e6('0xe0')][_0x54e6('0x16c')]('x')<0x0){_0x2dde19[_0x54e6('0xe0')]+='x';}if(_0x2dde19[_0x54e6('0xe0')]['indexOf']('X')<0x0){_0x2dde19['opts']+='X';}this['channel'][_0x54e6('0x9f')]('XMCS-QUEUE',_0x298e9d?_0x298e9d[_0x54e6('0x16d')]():'');var _0x2a4fe1=this[_0x54e6('0xe')][_0x54e6('0xa5')]('QUEUE',[_0x298e9d,_0x2dde19[_0x54e6('0xe0')],_0x2dde19[_0x54e6('0x61')],_0x4fd008,_0x2dde19[_0x54e6('0xb3')],_0x2dde19[_0x54e6('0x6')],_0x2dde19['macro'],_0x2dde19[_0x54e6('0x16e')],'',_0x2dde19['position']]);if(_0x2a4fe1['result']===-0x1){return _0x2a4fe1;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x16f'),_0x54e6('0x170'),_0x298e9d));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x171')]=function(_0x7282d){logger['info'](util['format'](_0x54e6('0x172'),_0x7282d['label']));var _0x5d35e5=_0x7282d[_0x54e6('0x173')]||_0x54e6('0x129');var _0x2c041c=util[_0x54e6('0x28')](_0x54e6('0x174'),this[_0x54e6('0xe')]['uniqueid'],rs[_0x54e6('0x12b')](0x5));var _0x23294e=util[_0x54e6('0x28')](_0x54e6('0x175'),FILES_PATH,_0x2c041c,_0x5d35e5);var _0xd2feec=util[_0x54e6('0x28')](_0x54e6('0x12a'),FILES_PATH,_0x2c041c);this[_0x54e6('0x176')]['sync'](this,_0x7282d,_0x2c041c,_0x23294e);this[_0x54e6('0xe')][_0x54e6('0x9f')](_0x54e6('0x177'),_0x2c041c);logger['info'](_0x54e6('0x178'),_0xd2feec,_0x5d35e5,_0x7282d[_0x54e6('0x179')],_0x7282d[_0x54e6('0xb3')]);return this[_0x54e6('0xe')][_0x54e6('0x12d')](_0xd2feec,_0x5d35e5,_0x7282d['escape_digits'],_0x7282d[_0x54e6('0xb3')],undefined,!![]);};AGIVertices['prototype'][_0x54e6('0x17a')]=function(_0x2cd4f9){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2cd4f9[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x2cd4f9['url'])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x17b'));}var _0x2105a5=this[_0x54e6('0x60')]['sync'](this,_0x2cd4f9);logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x17c'),util[_0x54e6('0x17d')](_0x2105a5,{'showHidden':![],'depth':null})));if(!this[_0x54e6('0x81')](_0x2cd4f9['variable_id'])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x17e'));}var _0xcca1a9=this[_0x54e6('0x12')][_0x54e6('0x6c')](this,_0x2cd4f9[_0x54e6('0xd2')]);if(!_0xcca1a9){return this[_0x54e6('0xe')]['error'](_0x2cd4f9,_0x54e6('0xd4'));}this['channel'][_0x54e6('0x9f')](util['format'](_0x54e6('0x17f'),_0xcca1a9),_0x2105a5[_0x54e6('0x71')]?_0x2105a5[_0x54e6('0x71')]:_0x54e6('0x180'));this['channel'][_0x54e6('0x9f')](util[_0x54e6('0x28')](_0x54e6('0x181'),_0xcca1a9),_0x2105a5[_0x54e6('0x182')]?_0x2105a5[_0x54e6('0x182')]:'OK');if(_0x2105a5[_0x54e6('0x66')]){try{this[_0x54e6('0x95')](_0x2105a5[_0x54e6('0x66')],_0xcca1a9);}catch(_0x491590){logger[_0x54e6('0x2c')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xcca1a9));}}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')]('variable\x20%s\x20set',_0xcca1a9));};AGIVertices['prototype'][_0x54e6('0x183')]=function(_0xd6b930){logger['info'](util[_0x54e6('0x28')](_0x54e6('0x184'),_0xd6b930['label']));return this[_0x54e6('0xe')][_0x54e6('0x185')](_0xd6b930[_0x54e6('0x186')][_0x54e6('0xd0')](/\s+/g,''),_0xd6b930[_0x54e6('0x179')]);};AGIVertices['prototype'][_0x54e6('0x187')]=function(_0x35cb5c){logger['info'](util['format'](_0x54e6('0x188'),_0x35cb5c[_0x54e6('0x38')]));return this[_0x54e6('0xe')][_0x54e6('0x189')](_0x35cb5c[_0x54e6('0x63')][_0x54e6('0xd0')](/\s+/g,''),_0x35cb5c[_0x54e6('0x179')]);};AGIVertices['prototype'][_0x54e6('0x18a')]=function(_0x43a789){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x18b'),_0x43a789[_0x54e6('0x38')]));return this[_0x54e6('0xe')][_0x54e6('0x18c')](_0x43a789[_0x54e6('0x5e')],_0x43a789[_0x54e6('0x179')]);};AGIVertices[_0x54e6('0x11')]['sendMail']=function(_0x3379a3){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x18d'),_0x3379a3[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x3379a3['account_id'])){return this['channel'][_0x54e6('0xa3')](_0x54e6('0x18e'));}var _0x5f0f83=this[_0x54e6('0x1f')][_0x54e6('0x6c')](this,_0x3379a3[_0x54e6('0x18f')]);if(!_0x5f0f83||!_0x5f0f83[_0x54e6('0x190')]){return this['channel'][_0x54e6('0x2c')](_0x3379a3,_0x54e6('0x191'));}var _0x3e48ac={'from':util[_0x54e6('0x28')](_0x54e6('0x192'),_0x5f0f83[_0x54e6('0x14')],_0x5f0f83[_0x54e6('0x193')]||_0x5f0f83[_0x54e6('0x190')][_0x54e6('0x194')]),'to':_0x3379a3['to']||'','cc':_0x3379a3['cc']||'','bcc':_0x3379a3[_0x54e6('0x195')]||'','subject':_0x3379a3[_0x54e6('0x196')],'html':_0x3379a3[_0x54e6('0x5e')],'text':_0x3379a3[_0x54e6('0x5e')]};if(this[_0x54e6('0x81')](_0x3379a3[_0x54e6('0x197')])){}logger[_0x54e6('0xd8')](_0x54e6('0x198'),JSON[_0x54e6('0x6f')](_0x3e48ac));this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x3379a3,_0x3379a3[_0x54e6('0x18f')]);this['channel'][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x199'),_0x5f0f83[_0x54e6('0x14')]));this[_0x54e6('0x21')][_0x54e6('0x6c')](this,_0x5f0f83['smtpOptions'],_0x3e48ac);return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x19a'));};AGIVertices['prototype'][_0x54e6('0x19b')]=function(_0x34da88){logger['info'](util['format'](_0x54e6('0x19c'),_0x34da88['label']));return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x19d'));};AGIVertices[_0x54e6('0x11')]['sendSMS']=function(_0x3c3b26){logger['info'](util[_0x54e6('0x28')](_0x54e6('0x19e'),_0x3c3b26[_0x54e6('0x38')]));if(!this['isConfigured'](_0x3c3b26['sms_account_id'])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x19f'));}var _0x3e6454=this['getSmsAccount']['sync'](this,_0x3c3b26[_0x54e6('0x1a0')]);if(!_0x3e6454){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x3c3b26,'no\x20sms\x20account\x20found');}var _0x4230da={'body':_0x3c3b26['sms_text'],'phone':_0x3c3b26['to']||'','SmsAccountId':_0x3e6454['id']};logger[_0x54e6('0xd8')](_0x54e6('0x1a1'),JSON[_0x54e6('0x6f')](_0x4230da));this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x3c3b26,_0x3c3b26['sms_account_id']);this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x1a2'),_0x3e6454[_0x54e6('0x14')]));this[_0x54e6('0x35')][_0x54e6('0x6c')](this,_0x4230da);return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x1a3'));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1a4')]=function(_0x21db63){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x1a5'),_0x21db63[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x21db63[_0x54e6('0xd2')])){return this[_0x54e6('0xe')]['error'](_0x21db63,_0x54e6('0x1a6'));}var _0x1a3886=this['getVariable']['sync'](this,_0x21db63['variable_id']);if(!_0x1a3886){return this[_0x54e6('0xe')]['error'](_0x21db63,_0x54e6('0xd4'));}return this[_0x54e6('0xe')][_0x54e6('0x9f')](_0x1a3886,_0x21db63[_0x54e6('0x1a7')]);};AGIVertices[_0x54e6('0x11')]['start']=function(_0x5bdc85){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x1a8'),_0x5bdc85[_0x54e6('0x38')]));this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x1a9'));if(_0x5bdc85[_0x54e6('0xb1')]===_0x54e6('0x1aa')){this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x1ab'));return this[_0x54e6('0xe')][_0x54e6('0xb1')]();}return this[_0x54e6('0xe')]['noop'](_0x54e6('0x1ac'));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1ad')]=function(_0x1990d9){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x1ae'),_0x1990d9[_0x54e6('0x38')]));if(!this['isConfigured'](_0x1990d9[_0x54e6('0x1af')])){return this['channel'][_0x54e6('0x2c')](_0x1990d9,_0x54e6('0x1b0'));}var _0x4ac6ef=this['getSquareProject'][_0x54e6('0x6c')](this,_0x1990d9[_0x54e6('0x1af')]);if(!this[_0x54e6('0x81')](_0x4ac6ef)){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x1990d9,util[_0x54e6('0x28')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1990d9['project_id']));}if(_0x4ac6ef===this[_0x54e6('0xe')][_0x54e6('0x3a')]){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x1990d9,_0x54e6('0x1b1'));}this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x1990d9,_0x4ac6ef);var _0x31824a=this[_0x54e6('0xe')][_0x54e6('0xa5')](_0x54e6('0x1b2'),util[_0x54e6('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x54e6('0x6')]['host']||_0x54e6('0x1b3'),_0x4ac6ef,this[_0x54e6('0xe')]['arg_1']));if(_0x31824a[_0x54e6('0x9e')]===-0x1){return _0x31824a;}return this['channel']['noop'](util[_0x54e6('0x28')](_0x54e6('0x16f'),_0x54e6('0x1b2'),_0x4ac6ef));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1b4')]=function(_0x10b2a9){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x1b5'),_0x10b2a9['label']));var _0x40d65c=this[_0x54e6('0x56')][_0x54e6('0x6c')](this,_0x10b2a9['command']);this[_0x54e6('0x36')][_0x54e6('0x6c')](this,_0x10b2a9,_0x10b2a9['command']);if(this[_0x54e6('0x81')](_0x10b2a9['variable_id'])){var _0x5c6ab7=this['getVariable'][_0x54e6('0x6c')](this,_0x10b2a9[_0x54e6('0xd2')]);if(_0x5c6ab7){this[_0x54e6('0xe')][_0x54e6('0x9f')](_0x5c6ab7,_0x40d65c);return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x1b6'),_0x10b2a9['command'],_0x5c6ab7));}}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x10b2a9[_0x54e6('0x1b7')]));};AGIVertices[_0x54e6('0x11')]['google_cloud_tts']=function(_0x572e71){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x572e71[_0x54e6('0x38')]));_0x572e71[_0x54e6('0x5e')]=_0x572e71[_0x54e6('0x5e')][_0x54e6('0xd0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x54e6('0x81')](_0x572e71[_0x54e6('0x1b8')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0x1b9'));}if(!this[_0x54e6('0x81')](_0x572e71['text'])){return this[_0x54e6('0xe')][_0x54e6('0xa3')](_0x54e6('0xa4'));}this[_0x54e6('0xe')][_0x54e6('0xa3')](util[_0x54e6('0x28')](_0x54e6('0x1ba'),_0x572e71[_0x54e6('0x5e')]));var _0x59b2ad=this[_0x54e6('0x57')][_0x54e6('0x6c')](this,_0x572e71);if(_0x59b2ad){this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')](_0x54e6('0x1bb'),_0x59b2ad));var _0x429457=this[_0x54e6('0xe')]['streamFile'](_0x59b2ad);try{fs[_0x54e6('0xff')](_0x59b2ad+_0x54e6('0x120'));}catch(_0x1b7acc){logger[_0x54e6('0x2c')](_0x1b7acc);}return _0x429457;}return this['channel'][_0x54e6('0x2c')](_0x572e71,_0x54e6('0x1bc'));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1bd')]=function(_0x439828){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x1be'),_0x439828[_0x54e6('0x38')]));_0x439828[_0x54e6('0x5e')]=_0x439828[_0x54e6('0x5e')][_0x54e6('0xd0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x54e6('0x81')](_0x439828[_0x54e6('0x5e')])){return this[_0x54e6('0xe')][_0x54e6('0xa3')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x54e6('0x28')](_0x54e6('0x1bf'),_0x439828[_0x54e6('0x5e')]));var _0x167b87=this[_0x54e6('0x5d')][_0x54e6('0x6c')](this,_0x439828);if(_0x167b87){this[_0x54e6('0xe')]['noop'](util[_0x54e6('0x28')](_0x54e6('0x1c0'),_0x167b87));var _0x6e7e76=this[_0x54e6('0xe')]['streamFile'](_0x167b87);try{fs['unlink'](_0x167b87+_0x54e6('0x120'));}catch(_0x139e98){logger[_0x54e6('0x2c')](_0x139e98);}return _0x6e7e76;}return this[_0x54e6('0xe')]['error'](_0x439828,_0x54e6('0x1c1'));};AGIVertices['prototype']['unpause']=function(_0x45227e){logger['info'](util[_0x54e6('0x28')](_0x54e6('0x1c2'),_0x45227e[_0x54e6('0x38')]));if(!this[_0x54e6('0x81')](_0x45227e[_0x54e6('0x150')])){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x45227e,_0x54e6('0x151'));}logger[_0x54e6('0x2e')](util[_0x54e6('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x54e6('0xe')]['callerid'],_0x45227e[_0x54e6('0x150')]));var _0x482e81=this[_0x54e6('0x50')]['sync'](this,_0x45227e[_0x54e6('0x150')]);if(_0x482e81){logger[_0x54e6('0x2e')](util['format'](_0x54e6('0x153'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x45227e['findBy']));this['channel'][_0x54e6('0xa3')](util['format'](_0x54e6('0x153'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x45227e['findBy']));return{'code':0xc8,'result':_0x54e6('0x154')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x54e6('0xe')]['callerid'],_0x45227e[_0x54e6('0x150')]));this['channel']['noop'](util[_0x54e6('0x28')](_0x54e6('0x155'),this[_0x54e6('0xe')][_0x54e6('0x3b')],_0x45227e[_0x54e6('0x150')]));return{'code':0xc8,'result':_0x54e6('0x156')};}};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1c3')]=function(_0x516b9e){logger['info'](util[_0x54e6('0x28')](_0x54e6('0x1c4'),_0x516b9e[_0x54e6('0x38')]));var _0x4ab290=this['channel'][_0x54e6('0xa5')](_0x54e6('0x1c5'),[_0x516b9e[_0x54e6('0x1c6')],_0x516b9e[_0x54e6('0x74')]]);if(_0x4ab290['result']===-0x1){return _0x4ab290;}return this[_0x54e6('0xe')][_0x54e6('0xa3')](util['format'](_0x54e6('0x16f'),_0x54e6('0x1c5'),_0x516b9e['mailbox']));};AGIVertices[_0x54e6('0x11')][_0x54e6('0x1c7')]=function(_0x35fda3){logger[_0x54e6('0x2e')](util[_0x54e6('0x28')](_0x54e6('0x1c8'),_0x35fda3['label']));if(!this[_0x54e6('0x81')](_0x35fda3[_0x54e6('0xd2')])){return this['channel'][_0x54e6('0x2c')](_0x35fda3,_0x54e6('0x1a6'));}var _0x1da8c9=this['getVariable'][_0x54e6('0x6c')](this,_0x35fda3['variable_id']);if(!_0x1da8c9){return this[_0x54e6('0xe')][_0x54e6('0x2c')](_0x35fda3,_0x54e6('0xd4'));}var _0x35eebc=this['channel'][_0x54e6('0x12')](_0x1da8c9);return{'code':0xc8,'result':_0x35eebc[_0x54e6('0x9b')]?_0x35eebc['extra']:'-'};};String[_0x54e6('0x11')][_0x54e6('0x9a')]=function(_0x1c14c0,_0x2553f6){return this[_0x54e6('0x99')](_0x1c14c0)['join'](_0x2553f6);};module[_0x54e6('0x1c9')]=AGIVertices; \ No newline at end of file +var _0x74fd=['no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','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://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProjectById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','key','ispeech_asr_language','isConfigured','awsPolly','aws_access_key_id','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','label','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured'];(function(_0x181d2d,_0x480cc8){var _0x4a0cfc=function(_0x5e96b1){while(--_0x5e96b1){_0x181d2d['push'](_0x181d2d['shift']());}};_0x4a0cfc(++_0x480cc8);}(_0x74fd,0x8f));var _0xd74f=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x74fd[_0x4d07cc];return _0x42de3b;};'use strict';var fs=require('fs');var util=require(_0xd74f('0x0'));var _=require('lodash');var sh=require(_0xd74f('0x1'));var odbc=require(_0xd74f('0x2'))();var rs=require(_0xd74f('0x3'));var moment=require(_0xd74f('0x4'));var Mustache=require(_0xd74f('0x5'));var rp=require(_0xd74f('0x6'));var logger=require(_0xd74f('0x7'))(_0xd74f('0x8'));var config=require(_0xd74f('0x9'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0xd74f('0xa');var recursiveMapAttributes=[_0xd74f('0xb'),'rawBody'];var verticesWithRetry=[_0xd74f('0xc'),_0xd74f('0xd'),_0xd74f('0xe')];var AGIVertices=function(_0x1e063a,_0x20b73a,_0x514d18){this['channel']=_0x1e063a;this[_0xd74f('0xf')]=_0x20b73a;this['mailRpc']=_0x514d18;};AGIVertices['prototype'][_0xd74f('0x10')]=function(_0x1feb0a,_0x226c0f){this[_0xd74f('0xf')][_0xd74f('0x11')](_0x1feb0a)[_0xd74f('0x12')](function(_0x102176){_0x226c0f(null,_0x102176?_0x102176[_0xd74f('0x13')]:![]);})[_0xd74f('0x14')](function(_0x59998d){_0x226c0f(_0x59998d);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x16')]=function(_0x25ffbd,_0x1a0d70){this[_0xd74f('0xf')]['getVoiceQueueById'](_0x25ffbd)[_0xd74f('0x12')](function(_0x4297cd){_0x1a0d70(null,_0x4297cd?_0x4297cd[_0xd74f('0x13')]:![]);})['catch'](function(_0x267d4d){_0x1a0d70(_0x267d4d);});};AGIVertices[_0xd74f('0x15')]['getSquareProject']=function(_0x29993c,_0x229f49){this[_0xd74f('0xf')][_0xd74f('0x17')](_0x29993c)[_0xd74f('0x12')](function(_0x8ce3f2){_0x229f49(null,_0x8ce3f2?_0x8ce3f2[_0xd74f('0x13')]:![]);})['catch'](function(_0x3760a6){_0x229f49(_0x3760a6);});};AGIVertices[_0xd74f('0x15')]['getSquareOdbc']=function(_0x893907,_0x7b6d3f){this[_0xd74f('0xf')]['getSquareOdbcById'](_0x893907)['then'](function(_0x586a75){_0x7b6d3f(null,_0x586a75?_0x586a75[_0xd74f('0x18')]:![]);})['catch'](function(_0x5c0d80){_0x7b6d3f(_0x5c0d80);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x19')]=function(_0x51dcfc,_0x1ec24b){this[_0xd74f('0xf')]['getUserById'](_0x51dcfc)['then'](function(_0x313285){_0x1ec24b(null,_0x313285?_0x313285[_0xd74f('0x13')]:![]);})[_0xd74f('0x14')](function(_0x14bb84){_0x1ec24b(_0x14bb84);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1a')]=function(_0x51b4e9,_0x296c38){this[_0xd74f('0xf')][_0xd74f('0x1b')](_0x51b4e9)[_0xd74f('0x12')](function(_0xf44159){_0x296c38(null,_0xf44159?_0xf44159[_0xd74f('0x13')]:![]);})[_0xd74f('0x14')](function(_0xd5dca0){_0x296c38(_0xd5dca0);});};AGIVertices['prototype']['getSound']=function(_0x5ed0e6,_0xaed840){var _0xf7ec7e=this;this[_0xd74f('0xf')][_0xd74f('0x1c')](_0x5ed0e6)[_0xd74f('0x12')](function(_0x256878){_0xaed840(null,_0x256878?_0xf7ec7e[_0xd74f('0x1d')](_0x256878[_0xd74f('0x1e')]):![]);})[_0xd74f('0x14')](function(_0x43a86e){_0xaed840(_0x43a86e);});};AGIVertices[_0xd74f('0x15')]['getMailAccount']=function(_0x1ebda5,_0x457448){this[_0xd74f('0xf')][_0xd74f('0x1f')](_0x1ebda5)[_0xd74f('0x12')](function(_0x551efb){_0x457448(null,_0x551efb?_0x551efb:![]);})[_0xd74f('0x14')](function(_0x247134){_0x457448(_0x247134);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x20')]=function(_0x306c1f,_0x34b074,_0x16ef8c){this['mailRpc'][_0xd74f('0x20')](_0x306c1f,_0x34b074)[_0xd74f('0x12')](function(){_0x16ef8c(null);})[_0xd74f('0x14')](function(_0x2d1f50){_0x16ef8c(_0x2d1f50);});};AGIVertices['prototype']['getIntervals']=function(_0x8ff293,_0x3006bf){this[_0xd74f('0xf')][_0xd74f('0x21')](_0x8ff293)[_0xd74f('0x12')](function(_0x48c893){if(_0x48c893){if(_0x48c893[_0xd74f('0x22')]){_0x3006bf(null,[_0x48c893['interval']]);}else{_0x3006bf(null,_[_0xd74f('0x23')](_0x48c893['Intervals'],'interval'));}}else{_0x3006bf(null,![]);}})[_0xd74f('0x14')](function(_0x62b037){_0x3006bf(_0x62b037);});};AGIVertices[_0xd74f('0x15')]['getSoundPath']=function(_0x24fab1){return util[_0xd74f('0x24')](_0xd74f('0x25'),FILES_PATH,_0x24fab1);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x26')]=function(_0x222f25,_0x34259e,_0xbe17a6){odbc[_0xd74f('0x27')](_0x222f25,function(_0x3aa915){if(_0x3aa915){logger[_0xd74f('0x28')](_0xd74f('0x29'),_0x3aa915);_0xbe17a6(_0x3aa915);}else{logger[_0xd74f('0x2a')](_0xd74f('0x2b'));odbc[_0xd74f('0x2c')](_0x34259e,function(_0x38310e,_0x5f0485){if(_0x38310e){logger[_0xd74f('0x2a')](_0xd74f('0x2d'),_0x34259e);_0xbe17a6(_0x38310e);}else{logger[_0xd74f('0x2a')](_0xd74f('0x2e'),_0x34259e);odbc[_0xd74f('0x2f')](function(_0x12db3f){if(_0x12db3f){logger[_0xd74f('0x28')](_0xd74f('0x30'),_0x12db3f);}_0xbe17a6(null,_0x5f0485);});}});}});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x31')]=function(_0x1002f3,_0x3a8379){this[_0xd74f('0xf')]['getSmsAccountById'](_0x1002f3)[_0xd74f('0x12')](function(_0x44c96b){_0x3a8379(null,_0x44c96b?_0x44c96b:![]);})[_0xd74f('0x14')](function(_0x4b9a4f){_0x3a8379(_0x4b9a4f);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x32')]=function(_0x321329,_0xa5be08){this[_0xd74f('0xf')][_0xd74f('0x32')](_0x321329)[_0xd74f('0x12')](function(_0x1584f9){_0xa5be08(null,_0x1584f9);})['catch'](function(_0x50d541){_0xa5be08(_0x50d541);});};AGIVertices['prototype'][_0xd74f('0x33')]=function(_0x1031c9,_0x3c33ae,_0x5ee073){this['rpc']['createSquareDetailsReport']({'uniqueid':this['channel'][_0xd74f('0x34')],'node':_0x1031c9['label'],'application':_0x1031c9[_0xd74f('0x35')],'data':_0x3c33ae||null,'project_name':this[_0xd74f('0x36')][_0xd74f('0x37')],'callerid':this['channel'][_0xd74f('0x38')]})['then'](function(_0x13bde6){if(_0x5ee073){_0x5ee073(null,_0x13bde6);}})[_0xd74f('0x14')](function(_0x8e27cc){if(_0x5ee073){_0x5ee073(_0x8e27cc);}});};AGIVertices[_0xd74f('0x15')]['createSquareRecording']=function(_0x2382a5,_0x4f668c,_0x57c593,_0x5b60da){this[_0xd74f('0xf')][_0xd74f('0x39')]({'uniqueid':this[_0xd74f('0x36')][_0xd74f('0x34')],'callerid':this[_0xd74f('0x36')]['callerid'],'calleridname':this[_0xd74f('0x36')][_0xd74f('0x3a')],'context':this[_0xd74f('0x36')][_0xd74f('0x3b')],'extension':this['channel'][_0xd74f('0x3c')],'priority':this[_0xd74f('0x36')][_0xd74f('0x3d')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xd74f('0x36')][_0xd74f('0x3e')],'projectName':this[_0xd74f('0x36')]['arg_1'],'saveName':_0x4f668c,'filename':_0x2382a5['file']||_0x4f668c,'savePath':_0x57c593})['then'](function(_0x158ee2){_0x5b60da(null,_0x158ee2);})[_0xd74f('0x14')](function(_0x576f98){_0x5b60da(_0x576f98);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x3f')]=function(_0x3137bb,_0x1d2250,_0xd0169,_0x497772,_0x429550){this[_0xd74f('0xf')]['createSquareMessage']({'uniqueid':this[_0xd74f('0x36')][_0xd74f('0x34')],'body':_0x3137bb,'direction':_0x1d2250,'providerName':_0xd0169,'providerResponse':_0x497772})[_0xd74f('0x12')](function(_0x20d416){if(_0x429550){_0x429550(null,_0x20d416);}})[_0xd74f('0x14')](function(_0x41b4c0){if(_0x429550){_0x429550(_0x41b4c0);}});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x40')]=function(_0x4ef2aa,_0x2b037d){this[_0xd74f('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x4ef2aa['name'])||_[_0xd74f('0x41')](_0x4ef2aa[_0xd74f('0x13')])?_0xd74f('0x42')+Math[_0xd74f('0x43')]():_0x4ef2aa[_0xd74f('0x13')],'lastName':_[_0xd74f('0x44')](_0x4ef2aa[_0xd74f('0x45')])||_[_0xd74f('0x41')](_0x4ef2aa[_0xd74f('0x45')])?null:_0x4ef2aa[_0xd74f('0x45')],'phone':_0x4ef2aa[_0xd74f('0x46')],'ListId':_0x4ef2aa['list_id'],'scheduledat':_0x4ef2aa[_0xd74f('0x47')],'callbackUniqueid':this[_0xd74f('0x36')][_0xd74f('0x34')],'tags':'callback','description':_0xd74f('0x48')+_0x4ef2aa[_0xd74f('0x47')][_0xd74f('0x49')](),'priority':_0x4ef2aa['callback_priority']})[_0xd74f('0x12')](function(_0x19d921){_0x2b037d(null,_0x19d921);})[_0xd74f('0x14')](function(_0x5c1e4d){_0x2b037d(_0x5c1e4d);});};AGIVertices['prototype']['getPause']=function(_0x1ea449,_0x3568f5){this[_0xd74f('0xf')][_0xd74f('0x4a')](_0x1ea449)[_0xd74f('0x12')](function(_0x344350){_0x3568f5(null,_0x344350?_0x344350[_0xd74f('0x13')]:![]);})['catch'](function(_0x4bffe7){_0x3568f5(_0x4bffe7);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x4b')]=function(_0x985ec1,_0x375780,_0x54d803){var _0xd32392={'role':'agent'};_0xd32392[_0x985ec1]=this[_0xd74f('0x36')][_0xd74f('0x38')];this['rpc']['agentPause'](_0xd32392,_0x375780,this[_0xd74f('0x36')]['uniqueid'])['then'](function(_0x1bb8e1){_0x54d803(null,_['isNil'](_0x1bb8e1)?![]:!![]);})['catch'](function(_0x150c72){logger[_0xd74f('0x28')](_0x150c72);_0x54d803(null,![]);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x4c')]=function(_0x48d644,_0xb7037c){var _0xf78729={'role':'agent'};_0xf78729[_0x48d644]=this[_0xd74f('0x36')]['callerid'];this['rpc']['agentUnpause'](_0xf78729)[_0xd74f('0x12')](function(_0xcc4bca){_0xb7037c(null,_[_0xd74f('0x41')](_0xcc4bca)?![]:!![]);})['catch'](function(_0x94407){logger[_0xd74f('0x28')](_0x94407);_0xb7037c(null,![]);});};AGIVertices[_0xd74f('0x15')]['agentLogout']=function(_0x307935,_0x34f218){var _0x185432={'role':_0xd74f('0x4d')};_0x185432[_0x307935]=this[_0xd74f('0x36')][_0xd74f('0x38')];this[_0xd74f('0xf')][_0xd74f('0x4e')](_0x185432)[_0xd74f('0x12')](function(_0x1aed9a){_0x34f218(null,_[_0xd74f('0x41')](_0x1aed9a)?![]:!![]);})[_0xd74f('0x14')](function(_0x80adc0){logger['error'](_0x80adc0);_0x34f218(null,![]);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x4f')]=function(_0xdc600e,_0x3824eb){var _0x58d88d={'role':_0xd74f('0x4d')};_0x58d88d[_0xdc600e]=this[_0xd74f('0x36')][_0xd74f('0x38')];var _0xfb8ee1=_0xdc600e!=_0xd74f('0x50')?util[_0xd74f('0x24')]('%s/%s@from-sip/n',_0xd74f('0x51'),this[_0xd74f('0x36')][_0xd74f('0x38')]):undefined;this[_0xd74f('0xf')]['agentLogin'](_0x58d88d,_0xfb8ee1)['then'](function(_0x30ff50){_0x3824eb(null,_[_0xd74f('0x41')](_0x30ff50)?![]:!![]);})[_0xd74f('0x14')](function(_0x2283ee){logger[_0xd74f('0x28')](_0x2283ee);_0x3824eb(null,![]);});};AGIVertices['prototype'][_0xd74f('0x52')]=function(_0x529e27,_0x4b0e24){sh[_0xd74f('0x53')](_[_0xd74f('0x54')](_0x529e27),function(_0x45801a,_0x73c568){var _0x1cc8fd=_0x73c568[_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'');_0x4b0e24(null,_0x1cc8fd);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x56')]=function(_0x4966d3,_0x21c52f){scripts['googleCloudTTS'](_0x4966d3[_0xd74f('0x57')],_0x4966d3['google_cloud_tts_text_type']||_0xd74f('0x58'),_0x4966d3['text'],_0x4966d3[_0xd74f('0x59')]||_0xd74f('0x5a'),_0x4966d3[_0xd74f('0x5b')]||'MALE',_0x4966d3[_0xd74f('0x5c')]||_0xd74f('0x5d'))[_0xd74f('0x12')](function(_0x4c90ed){_0x21c52f(null,_0x4c90ed);})[_0xd74f('0x14')](function(_0x123d84){_0x21c52f(_0x123d84);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x5e')]=function(_0x382f21,_0x3c2127){scripts[_0xd74f('0x5e')](_0x382f21[_0xd74f('0x58')],_0x382f21[_0xd74f('0x5f')]||'en',0x1)[_0xd74f('0x12')](function(_0x3e89c1){_0x3c2127(null,_0x3e89c1);})['catch'](function(_0xb18465){_0x3c2127(_0xb18465);});};AGIVertices['prototype'][_0xd74f('0x60')]=function(_0xfbd699,_0x13169d){var _0x55354c={'uri':_0xfbd699[_0xd74f('0x61')],'method':_0xfbd699[_0xd74f('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xfbd699['timeout'])===_0xd74f('0x63')&&parseInt(_0xfbd699[_0xd74f('0x64')])>=0x1?parseInt(_0xfbd699['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xd74f('0x65'),_0xd74f('0x66')],_0x55354c['method'][_0xd74f('0x67')]())){try{_0x55354c[_0xd74f('0x68')]=_0xfbd699[_0xd74f('0x69')]?JSON['parse'](_0xfbd699[_0xd74f('0x69')]):{};}catch(_0x49293f){logger[_0xd74f('0x28')](_0xd74f('0x6a'),_0x49293f);}}try{_0x55354c[_0xd74f('0x6b')]=_0xfbd699[_0xd74f('0xb')]?JSON[_0xd74f('0x6c')](_0xfbd699[_0xd74f('0xb')]):{};}catch(_0x443430){logger['error'](_0xd74f('0x6d'),_0x443430);}if(_0xfbd699[_0xd74f('0x6e')]){try{var _0x52308b=require(_0xfbd699['computedVariables'])[_0xd74f('0x6f')](this,_0x55354c);_0x55354c['uri']=Mustache[_0xd74f('0x70')](_0xfbd699[_0xd74f('0x61')],_0x52308b,{},['$$','$$']);if(_0x55354c[_0xd74f('0x6b')]){_0x55354c[_0xd74f('0x6b')]=JSON[_0xd74f('0x6c')](Mustache['render'](JSON[_0xd74f('0x71')](_0x55354c['headers']),_0x52308b,{},['$$','$$']));}if(_0x55354c[_0xd74f('0x68')]){_0x55354c[_0xd74f('0x68')]=JSON[_0xd74f('0x6c')](Mustache[_0xd74f('0x70')](JSON[_0xd74f('0x71')](_0x55354c[_0xd74f('0x68')]),_0x52308b,{},['$$','$$']));}}catch(_0x3d85f3){logger[_0xd74f('0x28')](_0xd74f('0x72'),_0x3d85f3);}}rp(_0x55354c)[_0xd74f('0x12')](function(_0x1eac19){var _0x31736a={'statusCode':_0x1eac19['statusCode']||0xc8,'statusMessage':_0x1eac19[_0xd74f('0x73')]||'OK','headers':_0x1eac19[_0xd74f('0x6b')]||{},'body':_0x1eac19['body']||{}};_0x13169d(null,_0x31736a);})[_0xd74f('0x14')](function(_0x108119){var _0x22e516={'statusCode':_0x108119[_0xd74f('0x74')]||0x1f4,'statusMessage':_0x108119[_0xd74f('0x75')]||_0xd74f('0x76'),'headers':_0x108119[_0xd74f('0x77')]['headers']||{},'body':_0x108119['options']['body']||{}};_0x13169d(null,_0x22e516);});};AGIVertices[_0xd74f('0x15')]['googleDialogflow']=function(_0x1746e6,_0x5a73b7){scripts[_0xd74f('0x78')](this[_0xd74f('0x36')]['uniqueid'],_0x1746e6['key'],_0x1746e6[_0xd74f('0x58')],_0x1746e6[_0xd74f('0x79')]||'en')[_0xd74f('0x12')](function(_0x590d4e){_0x5a73b7(null,_0x590d4e);})[_0xd74f('0x14')](function(_0x5ade29){_0x5a73b7(_0x5ade29);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x7a')]=function(_0x14192a,_0x3264ba){scripts[_0xd74f('0x7a')](this[_0xd74f('0x36')][_0xd74f('0x34')],_0x14192a['dialogflowV2_project_id'],_0x14192a[_0xd74f('0x7b')],_0x14192a['private_key'],_0x14192a['text'],_0x14192a[_0xd74f('0x7c')]||'en')[_0xd74f('0x12')](function(_0x3a9967){_0x3264ba(null,_0x3a9967);})[_0xd74f('0x14')](function(_0x338258){_0x3264ba(_0x338258);});};AGIVertices['prototype'][_0xd74f('0x7d')]=function(_0x3c0f82,_0x1883e4){scripts[_0xd74f('0x7d')](this[_0xd74f('0x36')],_0x3c0f82)[_0xd74f('0x12')](function(_0x4749d8){_0x1883e4(null,_0x4749d8);})[_0xd74f('0x14')](function(_0x7d1a25){_0x1883e4(_0x7d1a25);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x7e')]=function(_0x3de693,_0x3f7677){scripts['ispeechTTS'](_0x3de693['key'],_0x3de693[_0xd74f('0x58')],_0x3de693[_0xd74f('0x7f')]||_0xd74f('0x5a'),_0x3de693[_0xd74f('0x80')])['then'](function(_0x32722d){_0x3f7677(null,_0x32722d);})[_0xd74f('0x14')](function(_0x69228a){_0x3f7677(_0x69228a);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x81')]=function(_0x470bc5,_0x5ef440,_0x505e34){scripts[_0xd74f('0x81')](_0x5ef440,_0x470bc5[_0xd74f('0x82')],_0x470bc5[_0xd74f('0x83')]||_0xd74f('0x5a'),this[_0xd74f('0x84')](_0x470bc5['model'])?_0x470bc5['model']:undefined)['then'](function(_0x52ebca){_0x505e34(null,_0x52ebca);})[_0xd74f('0x14')](function(_0x39644d){_0x505e34(_0x39644d);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x85')]=function(_0x4ff52c,_0x5e4e78){scripts['awsPolly'](_0x4ff52c[_0xd74f('0x86')],_0x4ff52c['aws_secret_access_key'],_0x4ff52c['aws_polly_region'],_0x4ff52c[_0xd74f('0x87')]||'Amy',_0x4ff52c[_0xd74f('0x58')],_0x4ff52c[_0xd74f('0x88')]||_0xd74f('0x58'))['then'](function(_0x50c480){_0x5e4e78(null,_0x50c480);})['catch'](function(_0x1ff37b){_0x5e4e78(_0x1ff37b);});};AGIVertices['prototype'][_0xd74f('0x89')]=function(_0x5c4ca8,_0x2ad16e){scripts[_0xd74f('0x89')](this[_0xd74f('0x36')]['uniqueid'],_0x5c4ca8[_0xd74f('0x86')],_0x5c4ca8['aws_secret_access_key'],_0x5c4ca8[_0xd74f('0x8a')],_0x5c4ca8[_0xd74f('0x58')],_0x5c4ca8[_0xd74f('0x8b')])[_0xd74f('0x12')](function(_0x23036e){_0x2ad16e(null,_0x23036e);})[_0xd74f('0x14')](function(_0x3931a2){_0x2ad16e(_0x3931a2);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x8c')]=function(_0x43c6ce,_0xe957e1,_0x1cd7c9){scripts[_0xd74f('0x8c')](_0xe957e1,_0x43c6ce['key'],_0x43c6ce['google_asr_language']||_0xd74f('0x5a'))[_0xd74f('0x12')](function(_0x1c7c79){_0x1cd7c9(null,_0x1c7c79);})['catch'](function(_0x1a7c54){_0x1cd7c9(_0x1a7c54);});};AGIVertices['prototype'][_0xd74f('0x8d')]=function(_0x12c656,_0xe8335,_0x3723c1){scripts[_0xd74f('0x8d')](_0xe8335,_0x12c656[_0xd74f('0x8e')],_0x12c656[_0xd74f('0x8f')],_0x12c656[_0xd74f('0x90')])[_0xd74f('0x12')](function(_0x284fd3){_0x3723c1(null,_0x284fd3);})[_0xd74f('0x14')](function(_0x42ca92){_0x3723c1(_0x42ca92);});};AGIVertices[_0xd74f('0x15')][_0xd74f('0x91')]=function(_0x505b40){var _0x3b7bef=_[_0xd74f('0x92')](verticesWithRetry,_0x505b40[_0xd74f('0x35')])?_0x505b40:_[_0xd74f('0x93')](_0x505b40);for(var _0x301da9 in _0x3b7bef){if(_0x3b7bef[_0xd74f('0x94')](_0x301da9)){if(_0x3b7bef[_0x301da9]&&_[_0xd74f('0x95')](_0x3b7bef[_0x301da9])){if(_[_0xd74f('0x92')](recursiveMapAttributes,_0x301da9)){_0x3b7bef[_0x301da9]=this[_0xd74f('0x96')](_0x3b7bef[_0x301da9]);}else{_0x3b7bef[_0x301da9]=this['replaceAllVariables'](_0x3b7bef[_0x301da9]);}}}}return _0x3b7bef;};AGIVertices[_0xd74f('0x15')]['recursiveNodeIndex']=function(_0x254d05){for(var _0x374239 in _0x254d05){if(_0x254d05[_0xd74f('0x94')](_0x374239)){if(_[_0xd74f('0x97')](_0x254d05[_0x374239])){this[_0xd74f('0x98')](_0x254d05[_0x374239]);}else if(_[_0xd74f('0x99')](_0x254d05[_0x374239])){for(var _0x51cb65=0x0;_0x51cb65<_0x254d05[_0x374239][_0xd74f('0x9a')];_0x51cb65++){this[_0xd74f('0x98')](_0x254d05[_0x374239][_0x51cb65]);}}else if(_[_0xd74f('0x95')](_0x254d05[_0x374239])){_0x254d05[_0x374239]=this[_0xd74f('0x9b')](_0x254d05[_0x374239]);}}}};AGIVertices[_0xd74f('0x15')][_0xd74f('0x9c')]=function(_0x2a9d2c,_0x2b77fa){for(var _0x211334 in _0x2a9d2c){if(_0x2a9d2c[_0xd74f('0x94')](_0x211334)){if(_['isPlainObject'](_0x2a9d2c[_0x211334])){if(!_['isEmpty'](_0x2a9d2c[_0x211334])){this[_0xd74f('0x9c')](_0x2a9d2c[_0x211334],util['format'](_0xd74f('0x9d'),_0x2b77fa,_0x211334));}}else if(_[_0xd74f('0x99')](_0x2a9d2c[_0x211334])){for(var _0x28e9ed=0x0;_0x28e9ed<_0x2a9d2c[_0x211334]['length'];_0x28e9ed++){this[_0xd74f('0x9c')](_0x2a9d2c[_0x211334][_0x28e9ed],util[_0xd74f('0x24')]('%s.%s',_0x2b77fa,_0x211334+'['+_0x28e9ed+']'));}}else{if(!_[_0xd74f('0x41')](_0x2a9d2c[_0x211334])){this[_0xd74f('0x36')][_0xd74f('0x9e')](util['format'](_0xd74f('0x9d'),_0x2b77fa,_0x211334),_0x2a9d2c[_0x211334]);}}}}};AGIVertices[_0xd74f('0x15')]['replaceObjectAllVariables']=function(_0xaa2ce4){try{var _0x25c53e=JSON[_0xd74f('0x6c')](_0xaa2ce4);this[_0xd74f('0x98')](_0x25c53e);return JSON[_0xd74f('0x71')](_0x25c53e);}catch(_0x2972cc){return this['replaceAllVariables'](_0xaa2ce4);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x33b3f1){var _0x342378=_0x33b3f1[_0xd74f('0x9f')]('{');for(var _0xe33221=0x1;_0xe33221<_0x342378[_0xd74f('0x9a')];_0xe33221+=0x1){var _0x207820=_0x342378[_0xe33221][_0xd74f('0x9f')]('}');if(_0x207820[_0xd74f('0x9a')]>0x1){_0x33b3f1=_0x33b3f1[_0xd74f('0xa0')]('{'+_0x207820[0x0]+'}',this[_0xd74f('0x36')]['getVariable'](_0x207820[0x0])[_0xd74f('0xa1')]||_0x207820[0x0]);}}if(_0x342378[_0xd74f('0x9a')]===0x1){return _0x33b3f1[_0xd74f('0x49')]();}return this[_0xd74f('0x9b')](_0x33b3f1);};AGIVertices['prototype'][_0xd74f('0xa2')]=function(_0x2448d6,_0x5459ce){var _0x3c97b8=this[_0xd74f('0x36')][_0xd74f('0x10')](_0x2448d6);if(_0x3c97b8[_0xd74f('0xa3')]===-0x1){return _0x3c97b8;}logger['info'](util[_0xd74f('0x24')](_0xd74f('0xa4'),_0x5459ce,_0x3c97b8['extra']));return this[_0xd74f('0x36')][_0xd74f('0x9e')](_0x5459ce,_0x3c97b8[_0xd74f('0xa1')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x84')]=function(_0x43773b){return _0x43773b&&_0x43773b!=='0'&&_0x43773b!=='-1'&&_0x43773b!=='';};AGIVertices[_0xd74f('0x15')][_0xd74f('0xa5')]=function(_0xd5f892){this[_0xd74f('0x33')]['sync'](this,_0xd5f892,'-');_0xd5f892[_0xd74f('0xa6')]=_0xd5f892[_0xd74f('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xd74f('0xa7')]=function(_0x502054){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x502054[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x502054[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20text\x20configured');}var _0xd8854d='\x22'+_0x502054[_0xd74f('0x58')]+'\x22';if(this[_0xd74f('0x84')](_0x502054['options'])){_0xd8854d+=','+_0x502054[_0xd74f('0x77')];}var _0x28561a=this[_0xd74f('0x36')]['exec'](_0xd74f('0xaa'),_0xd8854d);if(_0x28561a[_0xd74f('0xa3')]===-0x1){return _0x28561a;}return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xab'),_0xd8854d));};AGIVertices['prototype']['mrcprecog']=function(_0x5bb82a){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xac'),_0x5bb82a['label']));if(!this[_0xd74f('0x84')](_0x5bb82a[_0xd74f('0xad')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xae'));}var _0x27cbfa=_0x5bb82a[_0xd74f('0xad')];if(this[_0xd74f('0x84')](_0x5bb82a[_0xd74f('0x77')])){_0x27cbfa+=','+_0x5bb82a[_0xd74f('0x77')];}var _0x4b224f=this['channel'][_0xd74f('0x53')](_0xd74f('0xaf'),_0x27cbfa);if(_0x4b224f['result']===-0x1){return _0x4b224f;}var _0x3249f3=this['getAndSetVariable'](_0xd74f('0xb0'),_0xd74f('0xb1'));if(_0x3249f3['result']===-0x1){return _0x3249f3;}var _0x2d4f19=this['getAndSetVariable'](_0xd74f('0xb2'),_0xd74f('0xb3'));if(_0x2d4f19[_0xd74f('0xa3')]===-0x1){return _0x2d4f19;}var _0x5c865f=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5c865f[_0xd74f('0xa3')]===-0x1){return _0x5c865f;}return this['channel']['noop'](util['format'](_0xd74f('0xb4'),_0x27cbfa));};AGIVertices['prototype'][_0xd74f('0x8')]=function(_0x4bffde){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xb5'),_0x4bffde[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0x8')]([_0x4bffde[_0xd74f('0xb6')],_0x4bffde[_0xd74f('0xb7')]]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0xb8')]=function(_0x258d11){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0xb9'),_0x258d11[_0xd74f('0xa8')]));if(this[_0xd74f('0x84')](_0x258d11[_0xd74f('0x64')])){logger['info'](util[_0xd74f('0x24')](_0xd74f('0xba'),_0x258d11[_0xd74f('0x64')]));var _0x1a3e52=this[_0xd74f('0x36')]['wait'](_0x258d11[_0xd74f('0x64')]);if(_0x1a3e52['result']===-0x1){return _0x1a3e52;}}return this[_0xd74f('0x36')][_0xd74f('0xb8')]();};AGIVertices[_0xd74f('0x15')]['callback']=function(_0x5c948e){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0xbb'),_0x5c948e[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x5c948e['list_id'])){return this['channel'][_0xd74f('0x28')](_0x5c948e,_0xd74f('0xbc'));}_0x5c948e[_0xd74f('0x47')]=moment();if(this[_0xd74f('0x84')](_0x5c948e[_0xd74f('0xbd')])){_0x5c948e['scheduledAt']=moment()[_0xd74f('0xbe')](_0x5c948e['delay'],_0xd74f('0xbf'));}if(!this['isConfigured'](_0x5c948e[_0xd74f('0xc0')])){_0x5c948e['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x5c948e);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xc1'),_0x5c948e[_0xd74f('0x46')],_0x5c948e[_0xd74f('0xc2')],_0x5c948e[_0xd74f('0x47')]));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xc3')]=function(_0xa66722){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xc4'),_0xa66722[_0xd74f('0xa8')]));var _0x12bc6f=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xa66722[_0xd74f('0xc5')],_0xa66722[_0xd74f('0x77')]);if(_0x12bc6f[_0xd74f('0xa3')]===-0x1){return _0x12bc6f;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0xc6'),_0xa66722[_0xd74f('0xc5')],_0xa66722[_0xd74f('0x77')]));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xc7')]=function(_0x1eae9c){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xc8'),_0x1eae9c[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x1eae9c[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20text\x20configured');}var _0x2e3043='\x22'+_0x1eae9c['text']+'\x22';if(this[_0xd74f('0x84')](_0x1eae9c[_0xd74f('0x77')])){_0x2e3043+=','+_0x1eae9c[_0xd74f('0x77')];}var _0x1a022e=this[_0xd74f('0x36')]['exec']('MRCPSynth',_0x2e3043);if(_0x1a022e[_0xd74f('0xa3')]===-0x1){return _0x1a022e;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2e3043));};AGIVertices['prototype']['sestektts']=function(_0x27bc1b){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xc9'),_0x27bc1b[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x27bc1b['text'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}var _0x2cdedb='\x22'+_0x27bc1b['text']+'\x22';if(this[_0xd74f('0x84')](_0x27bc1b['options'])){_0x2cdedb+=','+_0x27bc1b[_0xd74f('0x77')];}var _0x563758=this[_0xd74f('0x36')]['exec']('MRCPSynth',_0x2cdedb);if(_0x563758[_0xd74f('0xa3')]===-0x1){return _0x563758;}return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xab'),_0x2cdedb));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xcb')]=function(_0x4e5873){logger['info'](util[_0xd74f('0x24')](_0xd74f('0xcc'),_0x4e5873[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x4e5873['grammar'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20grammar\x20configured');}var _0x197b88=_0x4e5873[_0xd74f('0xad')];if(this[_0xd74f('0x84')](_0x4e5873['options'])){_0x197b88+=','+_0x4e5873[_0xd74f('0x77')];}var _0x363a30=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0xaf'),_0x197b88);if(_0x363a30[_0xd74f('0xa3')]===-0x1){return _0x363a30;}var _0x5391e1=this[_0xd74f('0xa2')](_0xd74f('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5391e1[_0xd74f('0xa3')]===-0x1){return _0x5391e1;}var _0x12a430=this[_0xd74f('0xa2')]('RECOG_INPUT()',_0xd74f('0xcd'));if(_0x12a430['result']===-0x1){return _0x12a430;}var _0x415f64=this[_0xd74f('0xa2')](_0xd74f('0xce'),'LUMENVOX_ASR_INSTANCE');if(_0x415f64[_0xd74f('0xa3')]===-0x1){return _0x415f64;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xb4'),_0x197b88));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xcf')]=function(_0xaad050){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0xd0'),_0xaad050[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0xaad050[_0xd74f('0xad')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xae'));}var _0x38e767=_0xaad050['grammar'];if(this[_0xd74f('0x84')](_0xaad050[_0xd74f('0x77')])){_0x38e767+=','+_0xaad050[_0xd74f('0x77')];}var _0x3db428=this[_0xd74f('0x36')][_0xd74f('0x53')]('MRCPRecog',_0x38e767);if(_0x3db428[_0xd74f('0xa3')]===-0x1){return _0x3db428;}var _0x239643=this[_0xd74f('0xa2')]('RECOG_CONFIDENCE()',_0xd74f('0xd1'));if(_0x239643[_0xd74f('0xa3')]===-0x1){return _0x239643;}var _0x5e5537=this[_0xd74f('0xa2')]('RECOG_INPUT()',_0xd74f('0xd2'));if(_0x5e5537['result']===-0x1){return _0x5e5537;}var _0x28a159=this[_0xd74f('0xa2')](_0xd74f('0xce'),_0xd74f('0xd3'));if(_0x28a159[_0xd74f('0xa3')]===-0x1){return _0x28a159;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xb4'),_0x38e767));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xd4')]=function(_0x1aac17){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xd5'),_0x1aac17[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x1aac17[_0xd74f('0xd6')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1aac17,_0xd74f('0xd7'));}var _0x2ee6b7=this[_0xd74f('0xd8')][_0xd74f('0x6f')](this,_0x1aac17['odbc_id']);if(!_0x2ee6b7){return this[_0xd74f('0x36')]['error'](_0x1aac17,_0xd74f('0xd9'));}if(!this[_0xd74f('0x84')](_0x1aac17['query'])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1aac17,_0xd74f('0xda'));}var _0x1eeccd=_0x1aac17[_0xd74f('0x2c')][_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format']('query:\x20%s',_0x1eeccd));var _0x41e53c=this[_0xd74f('0x26')][_0xd74f('0x6f')](this,_0x2ee6b7,_0x1eeccd);this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x1aac17,_0x1eeccd);if(!this[_0xd74f('0x84')](_0x1aac17[_0xd74f('0xdb')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xdc'));}var _0x34018f=this[_0xd74f('0x10')]['sync'](this,_0x1aac17[_0xd74f('0xdb')]);if(!_0x34018f){return this['channel'][_0xd74f('0x28')](_0x1aac17,_0xd74f('0xdd'));}var _0x34979d=this;_0x41e53c['forEach'](function(_0x4e4277,_0x151326){Object[_0xd74f('0xde')](_0x4e4277)[_0xd74f('0xdf')](function(_0x2330f5){_0x34979d[_0xd74f('0x36')][_0xd74f('0x9e')](util['format'](_0xd74f('0xe0'),_0x34018f,_0x151326,_0x2330f5),_0x4e4277[_0x2330f5]);});});this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0xe1'),_0x34018f),_0x41e53c[_0xd74f('0x9a')]);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('variable\x20%s\x20set',_0x34018f));};AGIVertices[_0xd74f('0x15')]['dial']=function(_0x5d9443){logger[_0xd74f('0xe2')](util[_0xd74f('0x24')](_0xd74f('0xe3'),_0x5d9443[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x5d9443[_0xd74f('0xe4')])){return this['channel'][_0xd74f('0x28')](_0x5d9443,_0xd74f('0xe5'));}var _0x3dcd0f=this[_0xd74f('0x19')][_0xd74f('0x6f')](this,_0x5d9443[_0xd74f('0xe4')]);if(!_0x3dcd0f){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x5d9443,_0xd74f('0xe6'));}var _0x190895=this[_0xd74f('0x36')]['exec'](_0xd74f('0xe7'),[util[_0xd74f('0x24')](_0xd74f('0xe8'),_0x3dcd0f),_0x5d9443['timeout'],_0x5d9443[_0xd74f('0xe9')],_0x5d9443[_0xd74f('0x61')]]);if(_0x190895[_0xd74f('0xa3')]===-0x1){return _0x190895;}return this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0xea'),_0xd74f('0xe7')));};AGIVertices[_0xd74f('0x15')]['dialogflow']=function(_0x3f4611){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xeb'),_0x3f4611[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x3f4611[_0xd74f('0x82')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xec'));}if(!this[_0xd74f('0x84')](_0x3f4611[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xd74f('0x33')](_0x3f4611);this[_0xd74f('0x3f')](_0x3f4611[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0xed'),_0x3f4611['text']));var _0x56cdb8=this['googleDialogflow'][_0xd74f('0x6f')](this,_0x3f4611);if(_0x56cdb8){for(var _0x45be24 in _0x56cdb8){if(_0x56cdb8['hasOwnProperty'](_0x45be24)){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0xee'),_0x45be24[_0xd74f('0x67')]()),_0x56cdb8[_0x45be24]);}}this['createSquareMessage'](_0x56cdb8['speech'],_0xd74f('0xef'),_0xd74f('0xf0'),'');return this['channel'][_0xd74f('0xa9')](util['format']('Dialogflow\x20Result\x20%s',_0x56cdb8[_0xd74f('0xf1')]));}return this[_0xd74f('0x36')]['error'](_0x3f4611,_0xd74f('0xf2'));};AGIVertices['prototype']['dialogflowV2']=function(_0xa453aa){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0xf3'),_0xa453aa[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0xa453aa['dialogflowV2_project_id'])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0xf4'));}if(!this[_0xd74f('0x84')](_0xa453aa['client_email'])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0xd74f('0x84')](_0xa453aa['private_key'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xf5'));}if(!this['isConfigured'](_0xa453aa['dialogflowV2_language'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xf6'));}if(!this[_0xd74f('0x84')](_0xa453aa[_0xd74f('0x58')])){return this[_0xd74f('0x36')]['noop']('no\x20text\x20configured');}this[_0xd74f('0x36')][_0xd74f('0xf7')]=!![];this[_0xd74f('0x33')](_0xa453aa);this['createSquareMessage'](_0xa453aa[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0xf8'),_0xa453aa[_0xd74f('0x58')]));var _0x4517a8=this['googleDialogflowV2'][_0xd74f('0x6f')](this,_0xa453aa);if(_0x4517a8){for(var _0x54479f in _0x4517a8){if(_0x4517a8[_0xd74f('0x94')](_0x54479f)){if(_0x54479f!==_0xd74f('0xf9')){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0xee'),_0x54479f[_0xd74f('0x67')]()),_0x4517a8[_0x54479f]);}}}this[_0xd74f('0x3f')](_0x4517a8[_0xd74f('0xf1')],_0xd74f('0xef'),_0xd74f('0xfa'),_0x4517a8['providerResponse']);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0xfb'),_0x4517a8['speech']));}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0xa453aa,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xd74f('0x15')][_0xd74f('0xfc')]=function(_0x409ac7){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x409ac7[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0xfd')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xfe'));}if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0xff')])){return this[_0xd74f('0x36')]['noop']('no\x20username\x20configured');}if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0x100')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x101'));}if(!this[_0xd74f('0x84')](_0x409ac7[_0xd74f('0x102')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')][_0xd74f('0xf7')]=!![];this['createSquareDetailsReport'](_0x409ac7);this[_0xd74f('0x3f')](_0x409ac7[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('Trying\x20SestekNDA:\x20%s',_0x409ac7[_0xd74f('0x58')]));var _0x2b0c3a=this[_0xd74f('0x7d')][_0xd74f('0x6f')](this,_0x409ac7);if(_0x2b0c3a){for(var _0x25c4da in _0x2b0c3a){if(_0x2b0c3a['hasOwnProperty'](_0x25c4da)){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x103'),_0x25c4da[_0xd74f('0x67')]()),_0x2b0c3a[_0x25c4da]);}}this[_0xd74f('0x3f')](_0x2b0c3a[_0xd74f('0xf1')],_0xd74f('0xef'),'sesteknda','');if(_0x2b0c3a[_0xd74f('0x104')]){this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x105'),_0x2b0c3a[_0xd74f('0x104')]));var _0x5846a1=this['channel'][_0xd74f('0x106')](_0x2b0c3a[_0xd74f('0x104')]);try{fs['unlink'](_0x2b0c3a[_0xd74f('0x104')]+_0xd74f('0x107'));}catch(_0x5c3c03){logger[_0xd74f('0x28')](_0x5c3c03);}return _0x5846a1;}else{return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x108'),_0x2b0c3a['speech']));}}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x409ac7,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd74f('0x15')][_0xd74f('0x109')]=function(_0x4342be){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x10a'),_0x4342be[_0xd74f('0xa8')]));return this['channel']['noop']('end');};AGIVertices['prototype'][_0xd74f('0x10b')]=function(_0x6bed4b){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x10c'),_0x6bed4b[_0xd74f('0xa8')]));var _0x49b61f='';if(_0x6bed4b[_0xd74f('0x10d')]){if(!this[_0xd74f('0x84')](_0x6bed4b[_0xd74f('0x10d')])){return this['channel'][_0xd74f('0x28')](_0x6bed4b,_0xd74f('0x10e'));}else{var _0x52f78d=parseInt(_0x6bed4b[_0xd74f('0x10d')],0xa);if(isNaN(_0x52f78d)){_0x49b61f=_0x6bed4b[_0xd74f('0x10d')];}else{_0x49b61f=this[_0xd74f('0x1a')][_0xd74f('0x6f')](this,_0x6bed4b[_0xd74f('0x10d')]);if(!_0x49b61f){return this['channel'][_0xd74f('0x28')](_0x6bed4b,'no\x20trunk\x20found');}}}}else if(_0x6bed4b[_0xd74f('0x10f')]){_0x49b61f=_0x6bed4b['trunk_name'];}else{return this[_0xd74f('0x36')]['error'](_0x6bed4b,_0xd74f('0x10e'));}var _0x5234ce=this['channel'][_0xd74f('0x53')](_0xd74f('0xe7'),[util[_0xd74f('0x24')](_0xd74f('0x110'),_0x49b61f,_0x6bed4b[_0xd74f('0x46')]),_0x6bed4b[_0xd74f('0x64')],_0x6bed4b[_0xd74f('0xe9')],_0x6bed4b[_0xd74f('0x61')]]);if(_0x5234ce[_0xd74f('0xa3')]===-0x1){return _0x5234ce;}return this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0xea'),_0xd74f('0xe7')));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x111')]=function(_0x303dfc){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x112'),_0x303dfc[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0xa9')](_0xd74f('0x111'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0xd')]=function(_0x522b0d){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x113'),_0x522b0d[_0xd74f('0xa8')]));if(_0x522b0d['retry']===0x0){return this[_0xd74f('0xa5')](_0x522b0d);}_0x522b0d[_0xd74f('0xa6')]-=0x1;if(!this[_0xd74f('0x84')](_0x522b0d[_0xd74f('0x114')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x522b0d,_0xd74f('0x115'));}var _0x48828d=this[_0xd74f('0x116')][_0xd74f('0x6f')](this,_0x522b0d[_0xd74f('0x114')]);if(!_0x48828d){return this['channel'][_0xd74f('0x28')](_0x522b0d,_0xd74f('0x117'));}if(!this[_0xd74f('0x84')](_0x522b0d[_0xd74f('0xdb')])){return this[_0xd74f('0x36')]['error'](_0xd74f('0xdc'));}var _0x3df19c=this[_0xd74f('0x36')][_0xd74f('0x118')](_0x48828d,_0x522b0d[_0xd74f('0x119')],_0x522b0d[_0xd74f('0x11a')]);var _0x4b8ab4=_0x3df19c[_0xd74f('0xa3')]?_0x3df19c[_0xd74f('0xa3')][_0xd74f('0x49')]():'';logger[_0xd74f('0x2a')](_0xd74f('0x11b'),JSON[_0xd74f('0x71')](_0x3df19c));if(_0x3df19c['result']===-0x1){this[_0xd74f('0x33')]['sync'](this,_0x522b0d,_0x4b8ab4);return _0x3df19c;}else if(_0x3df19c['extra']==='timeout'){_0x3df19c[_0xd74f('0xa3')]=_0x4b8ab4['length']>=parseInt(_0x522b0d['mindigit'])?'x':'i';}else{_0x3df19c[_0xd74f('0xa3')]=_0x4b8ab4[_0xd74f('0x9a')]>=parseInt(_0x522b0d[_0xd74f('0x11c')])&&_0x4b8ab4[_0xd74f('0x9a')]<=parseInt(_0x522b0d['maxdigit'])?'x':'i';}var _0x12335f=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x522b0d[_0xd74f('0xdb')]);if(!_0x12335f){return this[_0xd74f('0x36')]['error'](_0x522b0d,_0xd74f('0xdd'));}this[_0xd74f('0x36')][_0xd74f('0x9e')](_0x12335f,_0x4b8ab4);if(this[_0xd74f('0x84')](_0x522b0d['hiddendigitsnum'])){var _0x49fe06=parseInt(_0x522b0d[_0xd74f('0x11d')],0xa);var _0x56307a=rs['generate']({'charset':'*','length':_0x49fe06});var _0x467248=_0x4b8ab4[_0xd74f('0x9a')];if(_0x467248>0x0){if(_0x467248>_0x49fe06){this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x522b0d,_0x522b0d['hiddendigitspos']===_0xd74f('0x11e')?_0x56307a+_0x4b8ab4['substr'](_0x49fe06):_0x4b8ab4[_0xd74f('0x11f')](0x0,_0x467248-_0x49fe06)+_0x56307a);}else{this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x522b0d,rs[_0xd74f('0x120')]({'charset':'*','length':_0x467248}));}}else{this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x522b0d,'');}}else{this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x522b0d,_0x4b8ab4);}return _0x3df19c;};AGIVertices[_0xd74f('0x15')][_0xd74f('0xe')]=function(_0x26e8d6){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x121'),_0x26e8d6['label']));return this[_0xd74f('0xd')](_0x26e8d6);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x122')]=function(_0x2d168f){logger['info'](util[_0xd74f('0x24')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2d168f['label']));this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x2d168f,_0x2d168f[_0xd74f('0x123')]);return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x124'),_0x2d168f[_0xd74f('0x123')]));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x125')]=function(_0x46ddb3){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x126'),_0x46ddb3[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x46ddb3[_0xd74f('0x86')])||!this['isConfigured'](_0x46ddb3[_0xd74f('0x127')])){return this['channel'][_0xd74f('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x46ddb3['text'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x128'),_0x46ddb3['text']));var _0x2e66c9=this[_0xd74f('0x85')]['sync'](this,_0x46ddb3);if(_0x2e66c9){this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x129'),_0x2e66c9));var _0x288661=this[_0xd74f('0x36')]['streamFile'](_0x2e66c9);try{fs[_0xd74f('0x12a')](_0x2e66c9+_0xd74f('0x107'));}catch(_0x1e364d){logger[_0xd74f('0x28')](_0x1e364d);}return _0x288661;}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x46ddb3,_0xd74f('0x12b'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x12c')]=function(_0x3d987f){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3d987f['label']));if(!this['isConfigured'](_0x3d987f[_0xd74f('0x86')])||!this[_0xd74f('0x84')](_0x3d987f[_0xd74f('0x127')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x12d'));}if(!this[_0xd74f('0x84')](_0x3d987f[_0xd74f('0x8b')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x12e'));}if(!this[_0xd74f('0x84')](_0x3d987f[_0xd74f('0x58')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')]['bot']=!![];this[_0xd74f('0x33')](_0x3d987f);this['createSquareMessage'](_0x3d987f[_0xd74f('0x58')],'in','','');this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x12f'),_0x3d987f[_0xd74f('0x58')]));var _0x49eb66=this[_0xd74f('0x89')]['sync'](this,_0x3d987f);if(_0x49eb66){for(var _0x5269b0 in _0x49eb66){if(_0x49eb66[_0xd74f('0x94')](_0x5269b0)&&_['isString'](_0x49eb66[_0x5269b0])){this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x130'),_0x5269b0['toUpperCase']()),_0x49eb66[_0x5269b0]);}}if(_[_0xd74f('0x41')](_0x49eb66[_0xd74f('0x75')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x131'));}else{this[_0xd74f('0x3f')](_0x49eb66[_0xd74f('0x75')],_0xd74f('0xef'),_0xd74f('0x132'),'');return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x133'),_0x49eb66[_0xd74f('0x75')]));}}return this['channel']['error'](_0x3d987f,_0xd74f('0x134'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x135')]=function(_0x1661bb){logger['info'](util['format'](_0xd74f('0x136'),_0x1661bb[_0xd74f('0xa8')],_0x1661bb[_0xd74f('0x64')]));if(!this[_0xd74f('0x84')](_0x1661bb[_0xd74f('0x82')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0xec'));}var _0x2e1111=_0xd74f('0x137');var _0xf568ad=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xd74f('0x120')](0x4));var _0x364d77=util[_0xd74f('0x24')](_0xd74f('0x9d'),_0xf568ad,_0x2e1111);var _0x280411=!![];if(_0x1661bb[_0xd74f('0x138')]===_0xd74f('0x139')){_0x280411=![];}var _0x18496f=this['channel'][_0xd74f('0x13a')](_0xf568ad,_0x2e1111,_0x1661bb[_0xd74f('0x13b')],_0x1661bb[_0xd74f('0x64')],undefined,_0x280411);if(_0x18496f[_0xd74f('0xa3')]!==-0x1){this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x13c'),_0x364d77));var _0x4eae3b=this['googleASR']['sync'](this,_0x1661bb,_0x364d77);if(_0x4eae3b){for(var _0x3e340b in _0x4eae3b){if(_0x4eae3b['hasOwnProperty'](_0x3e340b)){this[_0xd74f('0x36')]['setVariable'](util['format'](_0xd74f('0x13d'),_0x3e340b[_0xd74f('0x67')]()),_0x4eae3b[_0x3e340b]);}}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('GoogleASR\x20Result\x20%s',JSON[_0xd74f('0x71')](_0x4eae3b)));}}return _0x18496f;};AGIVertices[_0xd74f('0x15')][_0xd74f('0x13e')]=function(_0x2a7b16){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x13f'),_0x2a7b16[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x2a7b16[_0xd74f('0x8e')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0x140'));}if(!this[_0xd74f('0x84')](_0x2a7b16['appsecret'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x141'));}var _0x4b7fc6=_0xd74f('0x137');var _0xbee560=util[_0xd74f('0x24')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x7bd60b=util[_0xd74f('0x24')](_0xd74f('0x9d'),_0xbee560,_0x4b7fc6);var _0x1c9fdc=!![];if(_0x2a7b16[_0xd74f('0x138')]===_0xd74f('0x139')){_0x1c9fdc=![];}var _0x5a92a8=this[_0xd74f('0x36')][_0xd74f('0x13a')](_0xbee560,_0x4b7fc6,_0x2a7b16['intKey'],_0x2a7b16[_0xd74f('0x64')],undefined,_0x1c9fdc);if(_0x5a92a8['result']!==-0x1){this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x142'),_0x7bd60b));var _0x282607=this[_0xd74f('0x8d')][_0xd74f('0x6f')](this,_0x2a7b16,_0x7bd60b);if(_0x282607){for(var _0x44f80d in _0x282607){if(_0x282607[_0xd74f('0x94')](_0x44f80d)){this[_0xd74f('0x36')]['setVariable'](util[_0xd74f('0x24')]('TILDE_ASR_%s',_0x44f80d[_0xd74f('0x67')]()),_0x282607[_0x44f80d]);}}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x143'),JSON['stringify'](_0x282607)));}}return _0x5a92a8;};AGIVertices[_0xd74f('0x15')][_0xd74f('0x144')]=function(_0x4371f3){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x145'),_0x4371f3['label']));return this[_0xd74f('0x36')][_0xd74f('0x146')](_0x4371f3[_0xd74f('0x3b')],_0x4371f3['extension'],_0x4371f3[_0xd74f('0x3d')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x147')]=function(_0x219456){logger['info'](util['format'](_0xd74f('0x148'),_0x219456[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x219456[_0xd74f('0x149')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x219456,_0xd74f('0x14a'));}try{var _0x2c8a7b=eval(_0x219456[_0xd74f('0x149')])?'true':'false';this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')]('EVAL\x20CONDITION\x20%s\x20%s',_0x219456[_0xd74f('0x149')],_0x2c8a7b));return{'code':0xc8,'result':_0x2c8a7b};}catch(_0x263110){return{'code':0xc8,'result':_0xd74f('0x14b')};}};AGIVertices[_0xd74f('0x15')][_0xd74f('0x14c')]=function(_0x1cfc3a){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1cfc3a[_0xd74f('0xa8')]));if(!this['isConfigured'](_0x1cfc3a[_0xd74f('0x14d')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1cfc3a,_0xd74f('0x14e'));}var _0x3cbb4f=this['getIntervals'][_0xd74f('0x6f')](this,_0x1cfc3a[_0xd74f('0x14d')]);if(!_0x3cbb4f){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1cfc3a,_0xd74f('0x14f'));}for(var _0x15c0db=0x0;_0x15c0db<_0x3cbb4f['length'];_0x15c0db+=0x1){var _0x23669c=this['channel'][_0xd74f('0x10')](util[_0xd74f('0x24')](_0xd74f('0x150'),_0x3cbb4f[_0x15c0db]));if(_0x23669c[_0xd74f('0xa3')]===-0x1){return _0x23669c;}logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],_0x23669c[_0xd74f('0xa1')]));if(_0x23669c[_0xd74f('0xa1')]===_0xd74f('0x152')){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],_0xd74f('0x152')));this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],_0xd74f('0x152')));return{'code':0xc8,'result':_0xd74f('0x152')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('IFTIME\x20%s\x20%s',_0x3cbb4f[_0x15c0db],_0xd74f('0x14b')));this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x151'),_0x3cbb4f[_0x15c0db],'false'));}}return{'code':0xc8,'result':_0xd74f('0x14b')};};AGIVertices[_0xd74f('0x15')][_0xd74f('0x153')]=function(_0x1b7d7f){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1b7d7f['label']));return this[_0xd74f('0x36')]['hangup']();};AGIVertices[_0xd74f('0x15')][_0xd74f('0x154')]=function(_0x42b149){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x155'),_0x42b149['label']));if(!this[_0xd74f('0x84')](_0x42b149[_0xd74f('0x82')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0xec'));}var _0x1f88fe=_0xd74f('0x137');var _0x519e18=util[_0xd74f('0x24')](_0xd74f('0x156'),FILES_PATH,rs['generate'](0x4));var _0x3b4f28=util[_0xd74f('0x24')](_0xd74f('0x9d'),_0x519e18,_0x1f88fe);var _0x263c2a=!![];if(_0x42b149[_0xd74f('0x138')]===_0xd74f('0x139')){_0x263c2a=![];}var _0x1f8fc2=this['channel'][_0xd74f('0x13a')](_0x519e18,_0x1f88fe,_0x42b149[_0xd74f('0x13b')],_0x42b149['timeout'],undefined,_0x263c2a);if(_0x1f8fc2[_0xd74f('0xa3')]!==-0x1){this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x157'),_0x3b4f28));var _0x2cd95c=this[_0xd74f('0x81')]['sync'](this,_0x42b149,_0x3b4f28);if(_0x2cd95c){for(var _0x119c45 in _0x2cd95c){if(_0x2cd95c[_0xd74f('0x94')](_0x119c45)){this['channel']['setVariable'](util[_0xd74f('0x24')](_0xd74f('0x158'),_0x119c45[_0xd74f('0x67')]()),_0x2cd95c[_0x119c45]);}}return this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')]('IspeechASR\x20Result\x20%s',JSON[_0xd74f('0x71')](_0x2cd95c)));}}return _0x1f8fc2;};AGIVertices[_0xd74f('0x15')][_0xd74f('0x159')]=function(_0x96ce6c){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x15a'),_0x96ce6c['label']));if(!this[_0xd74f('0x84')](_0x96ce6c[_0xd74f('0x82')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0xec'));}if(!this[_0xd74f('0x84')](_0x96ce6c['text'])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0xca'));}this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x15b'),_0x96ce6c['text']));var _0x317d9f=this[_0xd74f('0x7e')][_0xd74f('0x6f')](this,_0x96ce6c);if(_0x317d9f){this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x157'),_0x317d9f));var _0x2ea836=this[_0xd74f('0x36')][_0xd74f('0x106')](_0x317d9f,_0x96ce6c[_0xd74f('0x13b')]);try{fs[_0xd74f('0x12a')](_0x317d9f+_0xd74f('0x107'));}catch(_0xb2e749){logger[_0xd74f('0x28')](_0xb2e749);}return _0x2ea836;}return this['channel'][_0xd74f('0x28')](_0x96ce6c,_0xd74f('0x15c'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x15d')]=function(_0x2baf49){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2baf49['label']));if(!this[_0xd74f('0x84')](_0x2baf49[_0xd74f('0x15e')])){return this[_0xd74f('0x36')]['error'](_0x2baf49,_0xd74f('0x15f'));}logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49['findBy']));var _0x18ea0a=this[_0xd74f('0x4f')]['sync'](this,_0x2baf49[_0xd74f('0x15e')]);if(_0x18ea0a){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x160'),this['channel']['callerid'],_0x2baf49[_0xd74f('0x15e')]));this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49['findBy']));return{'code':0xc8,'result':_0xd74f('0x161')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x162'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49[_0xd74f('0x15e')]));this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x162'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x2baf49[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')]['logout']=function(_0x53754d){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x164'),_0x53754d['label']));if(!this[_0xd74f('0x84')](_0x53754d['findBy'])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x53754d,_0xd74f('0x15f'));}logger['info'](util[_0xd74f('0x24')](_0xd74f('0x165'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x53754d['findBy']));var _0x4cb4d0=this[_0xd74f('0x4e')][_0xd74f('0x6f')](this,_0x53754d[_0xd74f('0x15e')]);if(_0x4cb4d0){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')]['callerid'],_0x53754d[_0xd74f('0x15e')]));this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x53754d[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x161')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x162'),this['channel']['callerid'],_0x53754d['findBy']));this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x162'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x53754d[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')]['math']=function(_0x21bcc3){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x166'),_0x21bcc3[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x21bcc3[_0xd74f('0x167')])){return this['channel']['error'](_0x21bcc3,_0xd74f('0x168'));}this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x169'),_0x21bcc3[_0xd74f('0x167')]));var _0x482330=eval(_0x21bcc3[_0xd74f('0x167')]);if(!this['isConfigured'](_0x21bcc3['variable_id'])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x44f2f1=this[_0xd74f('0x10')]['sync'](this,_0x21bcc3[_0xd74f('0xdb')]);if(!_0x44f2f1){return this[_0xd74f('0x36')]['error'](_0x21bcc3,_0xd74f('0xdd'));}if(_[_0xd74f('0x99')](_0x482330)){var _0xceb05d=this;_0x482330[_0xd74f('0xdf')](function(_0x42f933,_0x3e808d){_0xceb05d['channel'][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x16a'),_0x44f2f1,_0x3e808d),_0x42f933);});return this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x16b'),_0x44f2f1));}else{return this[_0xd74f('0x36')]['setVariable'](_0x44f2f1,_0x482330);}};AGIVertices[_0xd74f('0x15')]['menu']=function(_0x3b7f6d){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x16c'),_0x3b7f6d[_0xd74f('0xa8')]));if(_0x3b7f6d[_0xd74f('0xa6')]===0x0){return this['maxRetry'](_0x3b7f6d);}_0x3b7f6d['retry']-=0x1;if(!this['isConfigured'](_0x3b7f6d[_0xd74f('0x114')])){return this[_0xd74f('0x36')]['error'](_0x3b7f6d,_0xd74f('0x115'));}var _0x5e5ac6=this['getSound'][_0xd74f('0x6f')](this,_0x3b7f6d['file_id']);if(!_0x5e5ac6){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x3b7f6d,'no\x20file\x20audio\x20found');}var _0x43c2f0=this['channel'][_0xd74f('0x118')](_0x5e5ac6,_0x3b7f6d[_0xd74f('0x119')],_0x3b7f6d[_0xd74f('0x16d')]);var _0x1b15bb=_0x43c2f0['result'];if(_0x43c2f0['result']===-0x1){this[_0xd74f('0x33')]['sync'](this,_0x3b7f6d,'-1');return _0x43c2f0;}else if(_0x43c2f0[_0xd74f('0xa1')]===_0xd74f('0x64')){_0x43c2f0[_0xd74f('0xa3')]=_0x43c2f0[_0xd74f('0xa3')][_0xd74f('0x9a')]>0x0?_0x43c2f0[_0xd74f('0xa3')]:'t';}else if(_[_0xd74f('0x44')](_0x43c2f0[_0xd74f('0xa3')])){_0x43c2f0[_0xd74f('0xa3')]='#';_0x1b15bb='#';}if(!this['isConfigured'](_0x3b7f6d[_0xd74f('0xdb')])){this['channel'][_0xd74f('0xa9')](_0xd74f('0xdc'));}else{var _0x53eaca=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x3b7f6d[_0xd74f('0xdb')]);if(!_0x53eaca){return this['channel'][_0xd74f('0x28')](_0x3b7f6d,_0xd74f('0xdd'));}this['channel'][_0xd74f('0x9e')](_0x53eaca,_0x1b15bb);}this[_0xd74f('0x33')]['sync'](this,_0x3b7f6d,_0x1b15bb);return _0x43c2f0;};AGIVertices[_0xd74f('0x15')]['noop']=function(_0x3f14f4){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x3f14f4[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0xa9')](_0x3f14f4[_0xd74f('0x16e')]||_0x3f14f4[_0xd74f('0xa8')]);};AGIVertices[_0xd74f('0x15')]['pause']=function(_0x5106ca){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5106ca['label']));if(!this[_0xd74f('0x84')](_0x5106ca[_0xd74f('0x15e')])){return this[_0xd74f('0x36')]['error'](_0x5106ca,_0xd74f('0x15f'));}logger['info'](util[_0xd74f('0x24')](_0xd74f('0x165'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca['findBy']));var _0x42f0cc=this[_0xd74f('0x16f')]['sync'](this,_0x5106ca[_0xd74f('0x170')]);var _0x166464=this[_0xd74f('0x4b')]['sync'](this,_0x5106ca[_0xd74f('0x15e')],_0x42f0cc);if(_0x166464){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca['findBy']));this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca['findBy']));return{'code':0xc8,'result':_0xd74f('0x161')};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x162'),this['channel'][_0xd74f('0x38')],_0x5106ca['findBy']));this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x5106ca[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')]['playback']=function(_0x58ed9d){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x171'),_0x58ed9d[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x58ed9d['file_id'])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x58ed9d,_0xd74f('0x115'));}var _0x4c5501=this[_0xd74f('0x116')][_0xd74f('0x6f')](this,_0x58ed9d[_0xd74f('0x114')]);if(!_0x4c5501){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x58ed9d,_0xd74f('0x117'));}var _0x4292b0=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0x172'),[_0x4c5501,_0x58ed9d['opts']]);if(_0x4292b0[_0xd74f('0xa3')]===-0x1){return _0x4292b0;}return this[_0xd74f('0x36')]['noop'](util['format'](_0xd74f('0xc6'),_0xd74f('0x172'),_0x4c5501));};AGIVertices['prototype'][_0xd74f('0x173')]=function(_0x544758){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x174'),_0x544758[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x544758[_0xd74f('0x175')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x544758,_0xd74f('0x176'));}var _0x2ac5c8='';var _0x401ff9=parseInt(_0x544758['queue_id'],0xa);if(isNaN(_0x401ff9)){_0x2ac5c8=_0x544758[_0xd74f('0x175')];}else{_0x2ac5c8=this['getVoiceQueue'][_0xd74f('0x6f')](this,_0x544758[_0xd74f('0x175')]);if(!_0x2ac5c8){return this['channel'][_0xd74f('0x28')](_0x544758,'no\x20queue\x20found');}}var _0x42e5e7='';if(this[_0xd74f('0x84')](_0x544758['file_id'])){var _0x573438=this[_0xd74f('0x116')]['sync'](this,_0x544758[_0xd74f('0x114')]);if(_0x573438){_0x42e5e7=_0x573438;}}this['createSquareDetailsReport'][_0xd74f('0x6f')](this,_0x544758,_0x2ac5c8);if(_0x544758[_0xd74f('0xe9')]['indexOf']('x')<0x0){_0x544758['opts']+='x';}if(_0x544758[_0xd74f('0xe9')][_0xd74f('0x177')]('X')<0x0){_0x544758[_0xd74f('0xe9')]+='X';}this[_0xd74f('0x36')]['setVariable']('XMCS-QUEUE',_0x2ac5c8?_0x2ac5c8['toLowerCase']():'');var _0x4cec28=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0x178'),[_0x2ac5c8,_0x544758[_0xd74f('0xe9')],_0x544758[_0xd74f('0x61')],_0x42e5e7,_0x544758[_0xd74f('0x64')],_0x544758[_0xd74f('0x8')],_0x544758['macro'],_0x544758[_0xd74f('0x179')],'',_0x544758[_0xd74f('0x17a')]]);if(_0x4cec28[_0xd74f('0xa3')]===-0x1){return _0x4cec28;}return this['channel'][_0xd74f('0xa9')](util['format'](_0xd74f('0xc6'),_0xd74f('0x178'),_0x2ac5c8));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x17b')]=function(_0x1a69c2){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x17c'),_0x1a69c2[_0xd74f('0xa8')]));var _0x35f522=_0x1a69c2[_0xd74f('0x17d')]||'wav';var _0x505655=util[_0xd74f('0x24')](_0xd74f('0x17e'),this[_0xd74f('0x36')][_0xd74f('0x34')],rs[_0xd74f('0x120')](0x5));var _0x16ba98=util['format'](_0xd74f('0x17f'),FILES_PATH,_0x505655,_0x35f522);var _0x43a04f=util[_0xd74f('0x24')](_0xd74f('0x156'),FILES_PATH,_0x505655);this[_0xd74f('0x39')][_0xd74f('0x6f')](this,_0x1a69c2,_0x505655,_0x16ba98);this[_0xd74f('0x36')][_0xd74f('0x9e')]('RECORDING_SAVENAME',_0x505655);logger[_0xd74f('0x2a')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x43a04f,_0x35f522,_0x1a69c2[_0xd74f('0x180')],_0x1a69c2['timeout']);return this['channel']['recordFile'](_0x43a04f,_0x35f522,_0x1a69c2[_0xd74f('0x180')],_0x1a69c2[_0xd74f('0x64')],undefined,!![]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x181')]=function(_0x5659){logger[_0xd74f('0x2a')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x5659['label']));if(!this[_0xd74f('0x84')](_0x5659[_0xd74f('0x61')])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0x182'));}var _0x2388e8=this[_0xd74f('0x60')][_0xd74f('0x6f')](this,_0x5659);logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x183'),util[_0xd74f('0x184')](_0x2388e8,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5659[_0xd74f('0xdb')])){return this[_0xd74f('0x36')][_0xd74f('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x46692d=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x5659[_0xd74f('0xdb')]);if(!_0x46692d){return this['channel'][_0xd74f('0x28')](_0x5659,_0xd74f('0xdd'));}this[_0xd74f('0x36')]['setVariable'](util['format'](_0xd74f('0x185'),_0x46692d),_0x2388e8[_0xd74f('0x74')]?_0x2388e8[_0xd74f('0x74')]:_0xd74f('0x186'));this[_0xd74f('0x36')][_0xd74f('0x9e')](util[_0xd74f('0x24')](_0xd74f('0x187'),_0x46692d),_0x2388e8[_0xd74f('0x73')]?_0x2388e8[_0xd74f('0x73')]:'OK');if(_0x2388e8[_0xd74f('0x68')]){try{this[_0xd74f('0x9c')](_0x2388e8[_0xd74f('0x68')],_0x46692d);}catch(_0x483c4f){logger[_0xd74f('0x28')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x46692d));}}return this['channel']['noop'](util[_0xd74f('0x24')](_0xd74f('0x188'),_0x46692d));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x189')]=function(_0x3a2384){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x18a'),_0x3a2384[_0xd74f('0xa8')]));return this['channel']['sayDigits'](_0x3a2384[_0xd74f('0x18b')][_0xd74f('0x55')](/\s+/g,''),_0x3a2384['escape_digits']);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x18c')]=function(_0x4e5a89){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x18d'),_0x4e5a89[_0xd74f('0xa8')]));return this['channel'][_0xd74f('0x18e')](_0x4e5a89['number'][_0xd74f('0x55')](/\s+/g,''),_0x4e5a89['escape_digits']);};AGIVertices[_0xd74f('0x15')]['sayphonetic']=function(_0x19ad36){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x18f'),_0x19ad36[_0xd74f('0xa8')]));return this[_0xd74f('0x36')][_0xd74f('0x190')](_0x19ad36[_0xd74f('0x58')],_0x19ad36[_0xd74f('0x180')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x191')]=function(_0x2dd5f4){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x192'),_0x2dd5f4['label']));if(!this[_0xd74f('0x84')](_0x2dd5f4[_0xd74f('0x193')])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0x194'));}var _0x1190ad=this[_0xd74f('0x195')][_0xd74f('0x6f')](this,_0x2dd5f4[_0xd74f('0x193')]);if(!_0x1190ad||!_0x1190ad[_0xd74f('0x196')]){return this[_0xd74f('0x36')]['error'](_0x2dd5f4,_0xd74f('0x197'));}var _0x938780={'from':util[_0xd74f('0x24')](_0xd74f('0x198'),_0x1190ad[_0xd74f('0x13')],_0x1190ad[_0xd74f('0x199')]||_0x1190ad[_0xd74f('0x196')][_0xd74f('0x19a')]),'to':_0x2dd5f4['to']||'','cc':_0x2dd5f4['cc']||'','bcc':_0x2dd5f4[_0xd74f('0x19b')]||'','subject':_0x2dd5f4['subject'],'html':_0x2dd5f4['text'],'text':_0x2dd5f4[_0xd74f('0x58')]};if(this['isConfigured'](_0x2dd5f4[_0xd74f('0x19c')])){}logger['debug']('sendMail\x20message',JSON[_0xd74f('0x71')](_0x938780));this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x2dd5f4,_0x2dd5f4[_0xd74f('0x193')]);this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x19d'),_0x1190ad['name']));this[_0xd74f('0x20')][_0xd74f('0x6f')](this,_0x1190ad[_0xd74f('0x19e')],_0x938780);return this[_0xd74f('0x36')]['noop'](_0xd74f('0x19f'));};AGIVertices['prototype'][_0xd74f('0x1a0')]=function(_0x5151bd){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1a1'),_0x5151bd[_0xd74f('0xa8')]));return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1a2'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1a3')]=function(_0x3557f1){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x1a4'),_0x3557f1[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x3557f1[_0xd74f('0x1a5')])){return this[_0xd74f('0x36')]['noop'](_0xd74f('0x1a6'));}var _0x918f73=this[_0xd74f('0x31')]['sync'](this,_0x3557f1[_0xd74f('0x1a5')]);if(!_0x918f73){return this[_0xd74f('0x36')]['error'](_0x3557f1,_0xd74f('0x1a7'));}var _0x13f0b8={'body':_0x3557f1[_0xd74f('0x1a8')],'phone':_0x3557f1['to']||'','SmsAccountId':_0x918f73['id']};logger[_0xd74f('0xe2')](_0xd74f('0x1a9'),JSON[_0xd74f('0x71')](_0x13f0b8));this['createSquareDetailsReport']['sync'](this,_0x3557f1,_0x3557f1[_0xd74f('0x1a5')]);this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1aa'),_0x918f73[_0xd74f('0x13')]));this[_0xd74f('0x32')][_0xd74f('0x6f')](this,_0x13f0b8);return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1ab'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1ac')]=function(_0x281aa2){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x281aa2[_0xd74f('0xa8')]));if(!this['isConfigured'](_0x281aa2[_0xd74f('0xdb')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x281aa2,_0xd74f('0x1ad'));}var _0xcc4453=this['getVariable']['sync'](this,_0x281aa2[_0xd74f('0xdb')]);if(!_0xcc4453){return this['channel'][_0xd74f('0x28')](_0x281aa2,_0xd74f('0xdd'));}return this[_0xd74f('0x36')][_0xd74f('0x9e')](_0xcc4453,_0x281aa2[_0xd74f('0x1ae')]);};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1af')]=function(_0x603fb7){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x1b0'),_0x603fb7['label']));this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1b1'));if(_0x603fb7['answer']==='yes'){this['channel']['noop'](_0xd74f('0x1b2'));return this['channel'][_0xd74f('0xb8')]();}return this[_0xd74f('0x36')][_0xd74f('0xa9')](_0xd74f('0x1b3'));};AGIVertices['prototype']['subproject']=function(_0x4d7cf0){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1b4'),_0x4d7cf0[_0xd74f('0xa8')]));if(!this['isConfigured'](_0x4d7cf0[_0xd74f('0x1b5')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x4d7cf0,_0xd74f('0x1b6'));}var _0x5616d6=this[_0xd74f('0x1b7')][_0xd74f('0x6f')](this,_0x4d7cf0['project_id']);if(!this[_0xd74f('0x84')](_0x5616d6)){return this['channel'][_0xd74f('0x28')](_0x4d7cf0,util[_0xd74f('0x24')](_0xd74f('0x1b8'),_0x4d7cf0[_0xd74f('0x1b5')]));}if(_0x5616d6===this[_0xd74f('0x36')][_0xd74f('0x37')]){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x4d7cf0,_0xd74f('0x1b9'));}this['createSquareDetailsReport']['sync'](this,_0x4d7cf0,_0x5616d6);var _0x269d64=this[_0xd74f('0x36')][_0xd74f('0x53')]('AGI',util[_0xd74f('0x24')](_0xd74f('0x1ba'),config[_0xd74f('0x8')][_0xd74f('0x1bb')]||'127.0.0.1',_0x5616d6,this[_0xd74f('0x36')][_0xd74f('0x37')]));if(_0x269d64['result']===-0x1){return _0x269d64;}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x5616d6));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1bc')]=function(_0x2adf2f){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1bd'),_0x2adf2f[_0xd74f('0xa8')]));var _0x6b3d43=this[_0xd74f('0x52')]['sync'](this,_0x2adf2f['command']);this[_0xd74f('0x33')][_0xd74f('0x6f')](this,_0x2adf2f,_0x2adf2f[_0xd74f('0xb6')]);if(this[_0xd74f('0x84')](_0x2adf2f[_0xd74f('0xdb')])){var _0x3d8f99=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x2adf2f[_0xd74f('0xdb')]);if(_0x3d8f99){this[_0xd74f('0x36')]['setVariable'](_0x3d8f99,_0x6b3d43);return this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1be'),_0x2adf2f[_0xd74f('0xb6')],_0x3d8f99));}}return this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x1bf'),_0x2adf2f[_0xd74f('0xb6')]));};AGIVertices[_0xd74f('0x15')]['google_cloud_tts']=function(_0x8650f5){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1c0'),_0x8650f5[_0xd74f('0xa8')]));_0x8650f5[_0xd74f('0x58')]=_0x8650f5[_0xd74f('0x58')][_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd74f('0x84')](_0x8650f5['apiKey'])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0x1c1'));}if(!this[_0xd74f('0x84')](_0x8650f5[_0xd74f('0x58')])){return this['channel'][_0xd74f('0xa9')](_0xd74f('0xca'));}this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1c2'),_0x8650f5[_0xd74f('0x58')]));var _0x13fb7b=this[_0xd74f('0x56')][_0xd74f('0x6f')](this,_0x8650f5);if(_0x13fb7b){this[_0xd74f('0x36')]['noop'](util[_0xd74f('0x24')](_0xd74f('0x1c3'),_0x13fb7b));var _0x2f3152=this[_0xd74f('0x36')][_0xd74f('0x106')](_0x13fb7b);try{fs[_0xd74f('0x12a')](_0x13fb7b+_0xd74f('0x107'));}catch(_0x5904f9){logger['error'](_0x5904f9);}return _0x2f3152;}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x8650f5,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1c4')]=function(_0x1244ea){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1c5'),_0x1244ea[_0xd74f('0xa8')]));_0x1244ea['text']=_0x1244ea[_0xd74f('0x58')][_0xd74f('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd74f('0x84')](_0x1244ea[_0xd74f('0x58')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xd74f('0x36')][_0xd74f('0xa9')](util[_0xd74f('0x24')]('Trying\x20Google\x20TTS\x20%s',_0x1244ea[_0xd74f('0x58')]));var _0x5ed6d0=this[_0xd74f('0x5e')]['sync'](this,_0x1244ea);if(_0x5ed6d0){this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x1c6'),_0x5ed6d0));var _0x42ddd9=this[_0xd74f('0x36')][_0xd74f('0x106')](_0x5ed6d0);try{fs[_0xd74f('0x12a')](_0x5ed6d0+_0xd74f('0x107'));}catch(_0x2c1543){logger[_0xd74f('0x28')](_0x2c1543);}return _0x42ddd9;}return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x1244ea,_0xd74f('0x1c7'));};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1c8')]=function(_0x44ed88){logger['info'](util[_0xd74f('0x24')](_0xd74f('0x1c9'),_0x44ed88['label']));if(!this[_0xd74f('0x84')](_0x44ed88[_0xd74f('0x15e')])){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x44ed88,_0xd74f('0x15f'));}logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x165'),this[_0xd74f('0x36')]['callerid'],_0x44ed88[_0xd74f('0x15e')]));var _0x4ff2b2=this[_0xd74f('0x4c')][_0xd74f('0x6f')](this,_0x44ed88[_0xd74f('0x15e')]);if(_0x4ff2b2){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x44ed88[_0xd74f('0x15e')]));this['channel'][_0xd74f('0xa9')](util[_0xd74f('0x24')](_0xd74f('0x160'),this[_0xd74f('0x36')][_0xd74f('0x38')],_0x44ed88[_0xd74f('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd74f('0x2a')](util[_0xd74f('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd74f('0x36')][_0xd74f('0x38')],_0x44ed88['findBy']));this[_0xd74f('0x36')][_0xd74f('0xa9')](util['format'](_0xd74f('0x162'),this['channel'][_0xd74f('0x38')],_0x44ed88[_0xd74f('0x15e')]));return{'code':0xc8,'result':_0xd74f('0x163')};}};AGIVertices[_0xd74f('0x15')][_0xd74f('0x1ca')]=function(_0x13c8cf){logger[_0xd74f('0x2a')](util['format'](_0xd74f('0x1cb'),_0x13c8cf[_0xd74f('0xa8')]));var _0x17b1f8=this[_0xd74f('0x36')][_0xd74f('0x53')](_0xd74f('0x1cc'),[_0x13c8cf['mailbox'],_0x13c8cf[_0xd74f('0x77')]]);if(_0x17b1f8[_0xd74f('0xa3')]===-0x1){return _0x17b1f8;}return this[_0xd74f('0x36')]['noop'](util['format'](_0xd74f('0xc6'),_0xd74f('0x1cc'),_0x13c8cf[_0xd74f('0x1cd')]));};AGIVertices['prototype']['vswitch']=function(_0x47a9e9){logger[_0xd74f('0x2a')](util[_0xd74f('0x24')](_0xd74f('0x1ce'),_0x47a9e9[_0xd74f('0xa8')]));if(!this[_0xd74f('0x84')](_0x47a9e9[_0xd74f('0xdb')])){return this['channel'][_0xd74f('0x28')](_0x47a9e9,'no\x20variable\x20selected');}var _0x100383=this[_0xd74f('0x10')][_0xd74f('0x6f')](this,_0x47a9e9['variable_id']);if(!_0x100383){return this[_0xd74f('0x36')][_0xd74f('0x28')](_0x47a9e9,_0xd74f('0xdd'));}var _0x5ed1ac=this['channel']['getVariable'](_0x100383);return{'code':0xc8,'result':_0x5ed1ac[_0xd74f('0xa1')]?_0x5ed1ac[_0xd74f('0xa1')]:'-'};};String[_0xd74f('0x15')][_0xd74f('0xa0')]=function(_0x3a6434,_0x19bd1b){return this['split'](_0x3a6434)['join'](_0x19bd1b);};module[_0xd74f('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8fc9753..56fbeaf 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 _0x0a85=['message','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s'];(function(_0xf56657,_0x2b9233){var _0x35b79e=function(_0x1d501){while(--_0x1d501){_0xf56657['push'](_0xf56657['shift']());}};_0x35b79e(++_0x2b9233);}(_0x0a85,0x1c0));var _0x50a8=function(_0x5231d5,_0x3acd74){_0x5231d5=_0x5231d5-0x0;var _0xd4bc7a=_0x0a85[_0x5231d5];return _0xd4bc7a;};'use strict';var util=require(_0x50a8('0x0'));var _=require(_0x50a8('0x1'));var moment=require(_0x50a8('0x2'));var ami=require('../ami');var logger=require(_0x50a8('0x3'))(_0x50a8('0x4'));var RpcUser=require(_0x50a8('0x5'));var RpcVoiceAgentReport=require(_0x50a8('0x6'));function Acw(_0x2355a7){this[_0x50a8('0x7')]=_0x2355a7['voiceQueues'];this[_0x50a8('0x8')]=_0x2355a7['agents'];this[_0x50a8('0x9')]=_0x2355a7[_0x50a8('0x9')];this[_0x50a8('0xa')]={};ami['on'](_0x50a8('0xb'),this[_0x50a8('0xc')][_0x50a8('0xd')](this));ami['on'](_0x50a8('0xe'),this[_0x50a8('0xf')]['bind'](this));ami['on'](_0x50a8('0x10'),this[_0x50a8('0x11')][_0x50a8('0xd')](this));ami['on'](_0x50a8('0x12'),this[_0x50a8('0x13')][_0x50a8('0xd')](this));ami['on'](_0x50a8('0x14'),this[_0x50a8('0x15')][_0x50a8('0xd')](this));ami['on'](_0x50a8('0x16'),this[_0x50a8('0x17')][_0x50a8('0xd')](this));ami['on'](_0x50a8('0x18'),this[_0x50a8('0x19')][_0x50a8('0xd')](this));}function getDiff(_0x377639){var _0x15af38=moment()[_0x50a8('0x1a')](0x0);var _0x4d71b7=moment(_0x377639)[_0x50a8('0x1a')](0x0);return _0x15af38[_0x50a8('0x1b')](_0x4d71b7,_0x50a8('0x1c'));}Acw[_0x50a8('0x1d')][_0x50a8('0x1e')]=function(_0x62dcf6){try{var _0x2420e3=this;var _0x50ab2b=this['channels'][_0x62dcf6][_0x50a8('0x1f')];var _0x3007e5=this[_0x50a8('0xa')][_0x62dcf6][_0x50a8('0x20')];var _0x1bbab6=this[_0x50a8('0x7')][_0x3007e5];var _0x36964d=![];var _0x20dd0b=_0x50a8('0x21');if(_0x1bbab6['mandatoryDisposition']){if(_0x1bbab6[_0x50a8('0x22')][_0x50a8('0x23')]){_0x36964d=!![];_0x20dd0b=_0x1bbab6[_0x50a8('0x22')]['name'];}}ami[_0x50a8('0x24')]({'action':'QueuePause','interface':_0x50ab2b,'paused':!![],'reason':_0x20dd0b})['then'](function(_0x56091d){if(_0x2420e3[_0x50a8('0x8')][_0x50ab2b]){return RpcUser['getAgent'](_0x2420e3['agents'][_0x50ab2b]['id'])[_0x50a8('0x25')](function(_0x3c3abf){if(_0x3c3abf&&!_0x3c3abf['voicePause']){logger[_0x50a8('0x26')](_0x50a8('0x27'),_0x62dcf6,_0x50ab2b,_0x3007e5);var _0x3a340e=_0x2420e3[_0x50a8('0xa')][_0x62dcf6][_0x50a8('0x28')]&&_0x2420e3[_0x50a8('0xa')][_0x62dcf6][_0x50a8('0x29')]?_0x2420e3[_0x50a8('0xa')][_0x62dcf6]['destlinkedid']:_0x62dcf6;return RpcUser[_0x50a8('0x2a')](_0x2420e3[_0x50a8('0x8')][_0x50ab2b],_0x20dd0b,_0x3a340e)[_0x50a8('0x25')](function(_0x26d0e8){if(!_0x36964d){_0x2420e3[_0x50a8('0x9')][_0x50ab2b]={};logger[_0x50a8('0x26')](_0x50a8('0x2b'),_0x62dcf6,_0x2420e3['voiceQueues'][_0x3007e5][_0x50a8('0x2c')],_0x50ab2b,_0x3007e5);_0x2420e3['timers'][_0x50ab2b][_0x50a8('0x2d')]=setTimeout(_0x2420e3[_0x50a8('0x2e')][_0x50a8('0xd')](_0x2420e3,_0x50ab2b),_0x2420e3['voiceQueues'][_0x3007e5][_0x50a8('0x2c')]*0x3e8);_0x2420e3[_0x50a8('0x9')][_0x50ab2b][_0x50a8('0x2f')]=moment()[_0x50a8('0x30')](_0x50a8('0x31'));_0x2420e3[_0x50a8('0x9')][_0x50ab2b][_0x50a8('0x32')]=_0x62dcf6;_0x2420e3[_0x50a8('0x9')][_0x50ab2b]['queue']=_0x3007e5;_0x2420e3['timers'][_0x50ab2b]['updateAcw']=function(){var _0x2429e3=getDiff(_0x2420e3[_0x50a8('0x9')][_0x50ab2b][_0x50a8('0x2f')]);clearTimeout(_0x2420e3[_0x50a8('0x9')][_0x50ab2b][_0x50a8('0x2d')]);_0x2420e3[_0x50a8('0x9')][_0x50ab2b][_0x50a8('0x2d')]=![];RpcVoiceAgentReport[_0x50a8('0x33')]({'acwtime':_0x2429e3},_0x2420e3['timers'][_0x50ab2b][_0x50a8('0x32')],_0x50ab2b)[_0x50a8('0x25')](function(_0x496249){logger[_0x50a8('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x62dcf6,_0x2429e3,_0x496249);})[_0x50a8('0x34')](function(_0x512068){logger[_0x50a8('0x35')](_0x50a8('0x36'),_0x62dcf6,_0x512068);});delete _0x2420e3[_0x50a8('0x9')][_0x50ab2b];};}});}else{logger[_0x50a8('0x26')](_0x50a8('0x37'),_0x62dcf6,_0x50ab2b,_0x3007e5);}});}})[_0x50a8('0x34')](function(_0x92e484){logger[_0x50a8('0x35')](_0x50a8('0x2b'),_0x62dcf6,_0x2420e3[_0x50a8('0x7')][_0x3007e5]['acwTimeout'],_0x50ab2b,_0x3007e5);})['finally'](function(){delete _0x2420e3['channels'][_0x62dcf6];});}catch(_0x1e5707){logger[_0x50a8('0x35')]('[ACW][START]\x20%s',_0x1e5707['message']);}};Acw['prototype'][_0x50a8('0x2e')]=function(_0x30bb16){try{var _0x3b7e72=this;if(_0x3b7e72[_0x50a8('0x9')][_0x30bb16]){_0x3b7e72[_0x50a8('0x9')][_0x30bb16]['timer']=![];var _0x13d77c=_0x3b7e72[_0x50a8('0x9')][_0x30bb16][_0x50a8('0x32')];var _0x466bd8=_0x3b7e72[_0x50a8('0x9')][_0x30bb16][_0x50a8('0x20')];var _0x9d90b3=_0x3b7e72[_0x50a8('0x7')][_0x466bd8]['acwTimeout'];logger[_0x50a8('0x26')](_0x50a8('0x38'),_0x13d77c,_0x30bb16);RpcUser['saveUnpause'](this[_0x50a8('0x8')][_0x30bb16]);RpcVoiceAgentReport[_0x50a8('0x33')]({'acwtime':_0x9d90b3,'agentacw':!![]},_0x13d77c,_0x30bb16)[_0x50a8('0x25')](function(_0x165820){logger['info'](_0x50a8('0x39'),_0x13d77c,_0x9d90b3,_0x165820);})[_0x50a8('0x34')](function(_0x39169c){logger[_0x50a8('0x35')]('[%s][UPDATE][ERRORS:%s]',_0x13d77c,_0x39169c);});}else{logger[_0x50a8('0x35')](_0x50a8('0x3a'),_0x30bb16);if(_0x3b7e72['timers']){logger['info'](_0x50a8('0x3b'),JSON[_0x50a8('0x3c')](_0x3b7e72[_0x50a8('0x9')]));}}}catch(_0xe7d191){logger[_0x50a8('0x35')](_0x50a8('0x3d'),_0xe7d191[_0x50a8('0x3e')]);}};Acw[_0x50a8('0x1d')]['syncAgentConnect']=function(_0x37ecfa){try{if(this[_0x50a8('0x7')][_0x37ecfa['queue']]&&(this[_0x50a8('0x7')][_0x37ecfa['queue']][_0x50a8('0x4')]||this['voiceQueues'][_0x37ecfa['queue']][_0x50a8('0x3f')])){if(this[_0x50a8('0x8')][_0x37ecfa[_0x50a8('0x1f')]]){this['channels'][_0x37ecfa[_0x50a8('0x32')]]={'queue':_0x37ecfa[_0x50a8('0x20')],'interface':_0x37ecfa[_0x50a8('0x1f')],'destlinkedid':_0x37ecfa['destlinkedid']};}}}catch(_0x302c68){logger[_0x50a8('0x35')](_0x50a8('0x40'),_0x302c68[_0x50a8('0x3e')]);}};Acw[_0x50a8('0x1d')][_0x50a8('0x19')]=function(_0x567e64){try{if(this[_0x50a8('0x7')][_0x567e64[_0x50a8('0x20')]]&&(this[_0x50a8('0x7')][_0x567e64[_0x50a8('0x20')]]['acw']||this[_0x50a8('0x7')][_0x567e64[_0x50a8('0x20')]]['mandatoryDisposition'])){if(this[_0x50a8('0x8')][_0x567e64[_0x50a8('0x1f')]]){this[_0x50a8('0xa')][_0x567e64[_0x50a8('0x32')]]={'queue':_0x567e64[_0x50a8('0x20')],'interface':_0x567e64['interface']};}}}catch(_0x4cea9c){logger[_0x50a8('0x35')](_0x50a8('0x41'),_0x4cea9c[_0x50a8('0x3e')]);}};Acw[_0x50a8('0x1d')][_0x50a8('0xf')]=function(_0x8b8574){try{if(this[_0x50a8('0xa')][_0x8b8574[_0x50a8('0x32')]]&&_['isUndefined'](this[_0x50a8('0xa')][_0x8b8574[_0x50a8('0x32')]]['attended'])){logger['info'](_0x50a8('0x42'),_0x8b8574[_0x50a8('0x32')]);this[_0x50a8('0x1e')](_0x8b8574[_0x50a8('0x32')]);}else if(this['channels'][_0x8b8574[_0x50a8('0x43')]]&&_[_0x50a8('0x44')](this[_0x50a8('0xa')][_0x8b8574['linkedid']][_0x50a8('0x28')])){logger[_0x50a8('0x26')]('[%s][HANGUP:LINKEDID]',_0x8b8574[_0x50a8('0x43')]);this['startAcw'](_0x8b8574[_0x50a8('0x43')]);}}catch(_0x35cadb){logger[_0x50a8('0x35')]('[ACW][syncHangupRequest]\x20%s',_0x35cadb[_0x50a8('0x3e')]);}};Acw[_0x50a8('0x1d')][_0x50a8('0x11')]=function(_0x4ce766){try{if(this['channels'][_0x4ce766[_0x50a8('0x32')]]&&this[_0x50a8('0xa')][_0x4ce766[_0x50a8('0x32')]][_0x50a8('0x28')]){logger[_0x50a8('0x26')](_0x50a8('0x45'),_0x4ce766[_0x50a8('0x32')]);this['startAcw'](_0x4ce766['uniqueid']);}else if(this[_0x50a8('0xa')][_0x4ce766['linkedid']]&&this[_0x50a8('0xa')][_0x4ce766[_0x50a8('0x43')]][_0x50a8('0x28')]){logger['info'](_0x50a8('0x46'),_0x4ce766[_0x50a8('0x43')]);this[_0x50a8('0x1e')](_0x4ce766[_0x50a8('0x43')]);}}catch(_0x2270ee){logger['error'](_0x50a8('0x47'),_0x2270ee[_0x50a8('0x3e')]);}};Acw['prototype'][_0x50a8('0x15')]=function(_0x36ca1a){try{if(!_[_0x50a8('0x48')](this[_0x50a8('0xa')][_0x36ca1a['transfereeuniqueid']])){this[_0x50a8('0x1e')](_0x36ca1a['transfereeuniqueid']);if(this['channels'][_0x36ca1a[_0x50a8('0x49')]]){this[_0x50a8('0xa')][_0x36ca1a[_0x50a8('0x49')]][_0x50a8('0x28')]=!![];this['channels'][_0x36ca1a[_0x50a8('0x4a')]]=this[_0x50a8('0xa')][_0x36ca1a[_0x50a8('0x49')]];delete this[_0x50a8('0xa')][_0x36ca1a[_0x50a8('0x49')]];}}else if(!_[_0x50a8('0x48')](this[_0x50a8('0xa')][_0x36ca1a[_0x50a8('0x4a')]])){this['startAcw'](_0x36ca1a['transfertargetuniqueid']);if(this['channels'][_0x36ca1a[_0x50a8('0x4b')]]){this['channels'][_0x36ca1a[_0x50a8('0x4b')]][_0x50a8('0x28')]=!![];this[_0x50a8('0xa')][_0x36ca1a[_0x50a8('0x4c')]]=this[_0x50a8('0xa')][_0x36ca1a[_0x50a8('0x4b')]];delete this[_0x50a8('0xa')][_0x36ca1a[_0x50a8('0x4b')]];}}}catch(_0x350399){logger[_0x50a8('0x35')](_0x50a8('0x4d'),_0x350399['message']);}};Acw['prototype'][_0x50a8('0x17')]=function(_0xc14bc2){try{if(this[_0x50a8('0xa')][_0xc14bc2[_0x50a8('0x4e')]]){logger[_0x50a8('0x26')](_0x50a8('0x4f'),JSON[_0x50a8('0x3c')](_0xc14bc2[_0x50a8('0x4e')]));this[_0x50a8('0x1e')](_0xc14bc2[_0x50a8('0x4e')]);}else if(this[_0x50a8('0xa')][_0xc14bc2['transfererlinkedid']]){logger[_0x50a8('0x26')](_0x50a8('0x50'),JSON[_0x50a8('0x3c')](_0xc14bc2['transfererlinkedid']));this['startAcw'](_0xc14bc2[_0x50a8('0x51')]);}}catch(_0x28abdf){logger[_0x50a8('0x35')]('[ACW][syncBlindTransfer]\x20%s',_0x28abdf[_0x50a8('0x3e')]);}};Acw[_0x50a8('0x1d')]['syncAgentRingNoAnswer']=function(_0x15bfbd){try{if(this[_0x50a8('0x7')][_0x15bfbd[_0x50a8('0x20')]]&&this[_0x50a8('0x7')][_0x15bfbd['queue']]['autopause']==='all'){if(this['agents'][_0x15bfbd['interface']]){logger[_0x50a8('0x26')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x15bfbd['uniqueid'],_0x15bfbd[_0x50a8('0x1f')],_0x15bfbd[_0x50a8('0x20')]);return RpcUser[_0x50a8('0x2a')](this[_0x50a8('0x8')][_0x15bfbd[_0x50a8('0x1f')]],_0x50a8('0x52'),_0x15bfbd[_0x50a8('0x32')]);}}}catch(_0x8e621d){logger[_0x50a8('0x35')](_0x50a8('0x53'),_0x8e621d[_0x50a8('0x3e')]);}};module[_0x50a8('0x54')]=Acw; \ No newline at end of file +var _0x27db=['[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','milliseconds','diff','prototype','queue','mandatoryDisposition','mandatoryDispositionPause','name','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x27db,0x71));var _0xb27d=function(_0x44b6f8,_0x302591){_0x44b6f8=_0x44b6f8-0x0;var _0x32b459=_0x27db[_0x44b6f8];return _0x32b459;};'use strict';var util=require(_0xb27d('0x0'));var _=require(_0xb27d('0x1'));var moment=require(_0xb27d('0x2'));var ami=require(_0xb27d('0x3'));var logger=require(_0xb27d('0x4'))(_0xb27d('0x5'));var RpcUser=require(_0xb27d('0x6'));var RpcVoiceAgentReport=require(_0xb27d('0x7'));function Acw(_0x47c43e){this[_0xb27d('0x8')]=_0x47c43e['voiceQueues'];this[_0xb27d('0x9')]=_0x47c43e['agents'];this[_0xb27d('0xa')]=_0x47c43e[_0xb27d('0xa')];this[_0xb27d('0xb')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xb27d('0xc')](this));ami['on']('hanguprequest',this[_0xb27d('0xd')]['bind'](this));ami['on']('hangup',this[_0xb27d('0xe')][_0xb27d('0xc')](this));ami['on'](_0xb27d('0xf'),this[_0xb27d('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0xb27d('0x11')]['bind'](this));ami['on'](_0xb27d('0x12'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xb27d('0xc')](this));}function getDiff(_0x53936e){var _0x1577bb=moment()[_0xb27d('0x13')](0x0);var _0x518ad3=moment(_0x53936e)['milliseconds'](0x0);return _0x1577bb[_0xb27d('0x14')](_0x518ad3,'seconds');}Acw[_0xb27d('0x15')]['startAcw']=function(_0x2a57af){try{var _0x285768=this;var _0x6a5ba2=this['channels'][_0x2a57af]['interface'];var _0x1b8675=this[_0xb27d('0xb')][_0x2a57af][_0xb27d('0x16')];var _0x29bc3a=this['voiceQueues'][_0x1b8675];var _0x5e251c=![];var _0x99f26f='ACW';if(_0x29bc3a[_0xb27d('0x17')]){if(_0x29bc3a[_0xb27d('0x18')][_0xb27d('0x19')]){_0x5e251c=!![];_0x99f26f=_0x29bc3a['mandatoryDispositionPause'][_0xb27d('0x19')];}}ami['Action']({'action':'QueuePause','interface':_0x6a5ba2,'paused':!![],'reason':_0x99f26f})[_0xb27d('0x1a')](function(_0x1b02e9){if(_0x285768[_0xb27d('0x9')][_0x6a5ba2]){return RpcUser['getAgent'](_0x285768[_0xb27d('0x9')][_0x6a5ba2]['id'])['then'](function(_0x2dda78){if(_0x2dda78&&!_0x2dda78[_0xb27d('0x1b')]){logger['info'](_0xb27d('0x1c'),_0x2a57af,_0x6a5ba2,_0x1b8675);var _0x563ba9=_0x285768[_0xb27d('0xb')][_0x2a57af][_0xb27d('0x1d')]&&_0x285768[_0xb27d('0xb')][_0x2a57af][_0xb27d('0x1e')]?_0x285768['channels'][_0x2a57af][_0xb27d('0x1e')]:_0x2a57af;return RpcUser[_0xb27d('0x1f')](_0x285768[_0xb27d('0x9')][_0x6a5ba2],_0x99f26f,_0x563ba9)[_0xb27d('0x1a')](function(_0x1e2162){if(!_0x5e251c){_0x285768[_0xb27d('0xa')][_0x6a5ba2]={};logger[_0xb27d('0x20')](_0xb27d('0x21'),_0x2a57af,_0x285768[_0xb27d('0x8')][_0x1b8675]['acwTimeout'],_0x6a5ba2,_0x1b8675);_0x285768[_0xb27d('0xa')][_0x6a5ba2]['timer']=setTimeout(_0x285768[_0xb27d('0x22')][_0xb27d('0xc')](_0x285768,_0x6a5ba2),_0x285768[_0xb27d('0x8')][_0x1b8675][_0xb27d('0x23')]*0x3e8);_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x24')]=moment()[_0xb27d('0x25')](_0xb27d('0x26'));_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x27')]=_0x2a57af;_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x16')]=_0x1b8675;_0x285768[_0xb27d('0xa')][_0x6a5ba2][_0xb27d('0x28')]=function(){var _0x1b25e8=getDiff(_0x285768['timers'][_0x6a5ba2]['lastPauseAt']);clearTimeout(_0x285768[_0xb27d('0xa')][_0x6a5ba2]['timer']);_0x285768['timers'][_0x6a5ba2][_0xb27d('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x1b25e8},_0x285768[_0xb27d('0xa')][_0x6a5ba2]['uniqueid'],_0x6a5ba2)['then'](function(_0x4d9668){logger[_0xb27d('0x20')](_0xb27d('0x2a'),_0x2a57af,_0x1b25e8,_0x4d9668);})[_0xb27d('0x2b')](function(_0x1c1a28){logger[_0xb27d('0x2c')](_0xb27d('0x2d'),_0x2a57af,_0x1c1a28);});delete _0x285768[_0xb27d('0xa')][_0x6a5ba2];};}});}else{logger[_0xb27d('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2a57af,_0x6a5ba2,_0x1b8675);}});}})[_0xb27d('0x2b')](function(_0x5b3ac3){logger[_0xb27d('0x2c')](_0xb27d('0x21'),_0x2a57af,_0x285768[_0xb27d('0x8')][_0x1b8675][_0xb27d('0x23')],_0x6a5ba2,_0x1b8675);})[_0xb27d('0x2e')](function(){delete _0x285768['channels'][_0x2a57af];});}catch(_0x1f1779){logger[_0xb27d('0x2c')](_0xb27d('0x2f'),_0x1f1779[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0x22')]=function(_0x3254d0){try{var _0x4a99c7=this;if(_0x4a99c7[_0xb27d('0xa')][_0x3254d0]){_0x4a99c7[_0xb27d('0xa')][_0x3254d0][_0xb27d('0x29')]=![];var _0x51228c=_0x4a99c7['timers'][_0x3254d0][_0xb27d('0x27')];var _0x2daea9=_0x4a99c7['timers'][_0x3254d0]['queue'];var _0x1c8de3=_0x4a99c7[_0xb27d('0x8')][_0x2daea9][_0xb27d('0x23')];logger[_0xb27d('0x20')](_0xb27d('0x31'),_0x51228c,_0x3254d0);RpcUser[_0xb27d('0x32')](this[_0xb27d('0x9')][_0x3254d0]);RpcVoiceAgentReport['update']({'acwtime':_0x1c8de3,'agentacw':!![]},_0x51228c,_0x3254d0)[_0xb27d('0x1a')](function(_0x5a0c6d){logger[_0xb27d('0x20')](_0xb27d('0x2a'),_0x51228c,_0x1c8de3,_0x5a0c6d);})['catch'](function(_0x52afbb){logger[_0xb27d('0x2c')](_0xb27d('0x2d'),_0x51228c,_0x52afbb);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3254d0);if(_0x4a99c7['timers']){logger[_0xb27d('0x20')]('[ACW][TIMERS]',JSON[_0xb27d('0x33')](_0x4a99c7[_0xb27d('0xa')]));}}}catch(_0x244c43){logger[_0xb27d('0x2c')](_0xb27d('0x34'),_0x244c43[_0xb27d('0x30')]);}};Acw['prototype']['syncAgentConnect']=function(_0x59929f){try{if(this['voiceQueues'][_0x59929f[_0xb27d('0x16')]]&&(this['voiceQueues'][_0x59929f[_0xb27d('0x16')]][_0xb27d('0x5')]||this['voiceQueues'][_0x59929f[_0xb27d('0x16')]][_0xb27d('0x17')])){if(this['agents'][_0x59929f['interface']]){this[_0xb27d('0xb')][_0x59929f['uniqueid']]={'queue':_0x59929f['queue'],'interface':_0x59929f[_0xb27d('0x35')],'destlinkedid':_0x59929f[_0xb27d('0x1e')]};}}}catch(_0x3b65b3){logger[_0xb27d('0x2c')](_0xb27d('0x36'),_0x3b65b3[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0x37')]=function(_0x2fbe51){try{if(this[_0xb27d('0x8')][_0x2fbe51[_0xb27d('0x16')]]&&(this[_0xb27d('0x8')][_0x2fbe51['queue']][_0xb27d('0x5')]||this[_0xb27d('0x8')][_0x2fbe51[_0xb27d('0x16')]][_0xb27d('0x17')])){if(this[_0xb27d('0x9')][_0x2fbe51[_0xb27d('0x35')]]){this['channels'][_0x2fbe51[_0xb27d('0x27')]]={'queue':_0x2fbe51[_0xb27d('0x16')],'interface':_0x2fbe51[_0xb27d('0x35')]};}}}catch(_0x3674e5){logger[_0xb27d('0x2c')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3674e5[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0xd')]=function(_0x1eff8c){try{if(this['channels'][_0x1eff8c[_0xb27d('0x27')]]&&_['isUndefined'](this[_0xb27d('0xb')][_0x1eff8c['uniqueid']]['attended'])){logger[_0xb27d('0x20')](_0xb27d('0x38'),_0x1eff8c['uniqueid']);this[_0xb27d('0x39')](_0x1eff8c[_0xb27d('0x27')]);}else if(this[_0xb27d('0xb')][_0x1eff8c[_0xb27d('0x3a')]]&&_[_0xb27d('0x3b')](this['channels'][_0x1eff8c[_0xb27d('0x3a')]][_0xb27d('0x1d')])){logger[_0xb27d('0x20')](_0xb27d('0x3c'),_0x1eff8c[_0xb27d('0x3a')]);this['startAcw'](_0x1eff8c[_0xb27d('0x3a')]);}}catch(_0xef6bf9){logger[_0xb27d('0x2c')](_0xb27d('0x3d'),_0xef6bf9[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0xe')]=function(_0x15e31a){try{if(this[_0xb27d('0xb')][_0x15e31a['uniqueid']]&&this[_0xb27d('0xb')][_0x15e31a[_0xb27d('0x27')]][_0xb27d('0x1d')]){logger['info'](_0xb27d('0x3e'),_0x15e31a[_0xb27d('0x27')]);this[_0xb27d('0x39')](_0x15e31a['uniqueid']);}else if(this[_0xb27d('0xb')][_0x15e31a[_0xb27d('0x3a')]]&&this[_0xb27d('0xb')][_0x15e31a[_0xb27d('0x3a')]][_0xb27d('0x1d')]){logger[_0xb27d('0x20')](_0xb27d('0x3f'),_0x15e31a[_0xb27d('0x3a')]);this[_0xb27d('0x39')](_0x15e31a[_0xb27d('0x3a')]);}}catch(_0xeefbd0){logger['error'](_0xb27d('0x40'),_0xeefbd0[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')][_0xb27d('0x11')]=function(_0x200ffd){try{if(!_[_0xb27d('0x41')](this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x42')]])){this[_0xb27d('0x39')](_0x200ffd[_0xb27d('0x42')]);if(this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x43')]]){this['channels'][_0x200ffd[_0xb27d('0x43')]][_0xb27d('0x1d')]=!![];this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x44')]]=this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x43')]];delete this['channels'][_0x200ffd[_0xb27d('0x43')]];}}else if(!_[_0xb27d('0x41')](this[_0xb27d('0xb')][_0x200ffd['transfertargetuniqueid']])){this[_0xb27d('0x39')](_0x200ffd[_0xb27d('0x44')]);if(this[_0xb27d('0xb')][_0x200ffd['origtransfereruniqueid']]){this[_0xb27d('0xb')][_0x200ffd['origtransfereruniqueid']][_0xb27d('0x1d')]=!![];this['channels'][_0x200ffd[_0xb27d('0x42')]]=this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x45')]];delete this[_0xb27d('0xb')][_0x200ffd[_0xb27d('0x45')]];}}}catch(_0x2938e3){logger[_0xb27d('0x2c')](_0xb27d('0x46'),_0x2938e3[_0xb27d('0x30')]);}};Acw[_0xb27d('0x15')]['syncBlindTransfer']=function(_0x512aff){try{if(this[_0xb27d('0xb')][_0x512aff[_0xb27d('0x47')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xb27d('0x33')](_0x512aff[_0xb27d('0x47')]));this[_0xb27d('0x39')](_0x512aff[_0xb27d('0x47')]);}else if(this['channels'][_0x512aff[_0xb27d('0x48')]]){logger[_0xb27d('0x20')](_0xb27d('0x49'),JSON['stringify'](_0x512aff[_0xb27d('0x48')]));this['startAcw'](_0x512aff[_0xb27d('0x48')]);}}catch(_0x2e4d27){logger[_0xb27d('0x2c')](_0xb27d('0x4a'),_0x2e4d27[_0xb27d('0x30')]);}};Acw['prototype'][_0xb27d('0x10')]=function(_0x4847ee){try{if(this[_0xb27d('0x8')][_0x4847ee[_0xb27d('0x16')]]&&this['voiceQueues'][_0x4847ee[_0xb27d('0x16')]][_0xb27d('0x4b')]===_0xb27d('0x4c')){if(this[_0xb27d('0x9')][_0x4847ee[_0xb27d('0x35')]]){logger[_0xb27d('0x20')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x4847ee[_0xb27d('0x27')],_0x4847ee[_0xb27d('0x35')],_0x4847ee['queue']);return RpcUser[_0xb27d('0x1f')](this[_0xb27d('0x9')][_0x4847ee[_0xb27d('0x35')]],_0xb27d('0x4d'),_0x4847ee[_0xb27d('0x27')]);}}}catch(_0x5bb89b){logger[_0xb27d('0x2c')](_0xb27d('0x4e'),_0x5bb89b[_0xb27d('0x30')]);}};module[_0xb27d('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ede52af..a6c1373 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x2e5da9,_0x5178f9){var _0x50b8a0=function(_0x4a75c1){while(--_0x4a75c1){_0x2e5da9['push'](_0x2e5da9['shift']());}};_0x50b8a0(++_0x5178f9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2032,0xd9));var _0x2203=function(_0x3bf5e8,_0x2850ab){_0x3bf5e8=_0x3bf5e8-0x0;var _0x216e86=_0x2032[_0x3bf5e8];return _0x216e86;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9e7986c..bf23ac8 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x1ca4cc,_0x402c23){var _0x108010=function(_0x4c5082){while(--_0x4c5082){_0x1ca4cc['push'](_0x1ca4cc['shift']());}};_0x108010(++_0x402c23);}(_0x9bde,0xe1));var _0xe9bd=function(_0x460266,_0x1ece9f){_0x460266=_0x460266-0x0;var _0x368bf1=_0x9bde[_0x460266];return _0x368bf1;};'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/action.js b/server/services/ami/dialer/action.js index b7ab9e7..1b9b210 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f21=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat'];(function(_0x487131,_0x2c86e8){var _0xf320ff=function(_0x2a9a17){while(--_0x2a9a17){_0x487131['push'](_0x487131['shift']());}};_0xf320ff(++_0x2c86e8);}(_0x0f21,0xfe));var _0x10f2=function(_0x4fa2da,_0x8ab535){_0x4fa2da=_0x4fa2da-0x0;var _0xd6958a=_0x0f21[_0x4fa2da];return _0xd6958a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x10f2('0x0'));function checkNameSurname(_0x164be3,_0x51bacc,_0x137c2c){var _0x5a7c23='';if(!_[_0x10f2('0x1')](_0x51bacc)&&'string'===typeof _0x51bacc){_0x5a7c23+=_0x51bacc;}if(!_['isNil'](_0x137c2c)&&_0x10f2('0x2')===typeof _0x137c2c){_0x5a7c23+='\x20'+_0x137c2c;}if(_0x5a7c23!==''){return _0x5a7c23;}return _0x164be3;}function Action(_0x4801e9,_0x3c1b68,_0x5cacd2){this[_0x10f2('0x3')]=_0x4801e9;this[_0x10f2('0x4')]=_0x5cacd2||undefined;this[_0x10f2('0x5')]=checkNameSurname(_0x3c1b68[_0x10f2('0x6')][_0x10f2('0x7')],_0x3c1b68[_0x10f2('0x6')][_0x10f2('0x8')],_0x3c1b68[_0x10f2('0x6')][_0x10f2('0x9')]);this[_0x10f2('0xa')]=_0x3c1b68['Contact'][_0x10f2('0x7')];this[_0x10f2('0xb')]=_0x4801e9[_0x10f2('0x5')];this[_0x10f2('0xc')]=_0x3c1b68[_0x10f2('0xc')]||![];this[_0x10f2('0xd')]=_0x4801e9[_0x10f2('0xd')];this[_0x10f2('0xe')]=_0x4801e9[_0x10f2('0xe')]||0x3;this[_0x10f2('0xf')]=_0x3c1b68['scheduledat'];this[_0x10f2('0x10')]=_0x3c1b68['countbusyretry'];this['countcongestionretry']=_0x3c1b68[_0x10f2('0x11')];this['countnoanswerretry']=_0x3c1b68[_0x10f2('0x12')];this[_0x10f2('0x13')]=_0x3c1b68['countnosuchnumberretry'];this[_0x10f2('0x14')]=_0x3c1b68['countdropretry'];this['countabandonedretry']=_0x3c1b68[_0x10f2('0x15')];this[_0x10f2('0x16')]=_0x3c1b68[_0x10f2('0x16')];this[_0x10f2('0x17')]=_0x3c1b68[_0x10f2('0x17')];this[_0x10f2('0x18')]=_0x3c1b68[_0x10f2('0x18')];this[_0x10f2('0x19')]=_0x3c1b68[_0x10f2('0x19')];this[_0x10f2('0x1a')]=_0x3c1b68['UserId'];this[_0x10f2('0x1b')]=_0x3c1b68[_0x10f2('0x1b')];this[_0x10f2('0x1c')]=_0x3c1b68[_0x10f2('0x1c')];this['idHopper']=_0x3c1b68['id'];this[_0x10f2('0x1d')]=_0x3c1b68[_0x10f2('0x6')]['firstName']||'';this['starttime']=moment()[_0x10f2('0x1e')](_0x10f2('0x1f'));this['callback']=_0x3c1b68[_0x10f2('0x20')];this[_0x10f2('0x21')]=_0x3c1b68['callbackuniqueid'];this[_0x10f2('0x22')]=_0x3c1b68[_0x10f2('0x22')];this[_0x10f2('0x23')]=_0x3c1b68[_0x10f2('0x23')];this[_0x10f2('0x24')]='';this[_0x10f2('0x25')]='';}Action[_0x10f2('0x26')][_0x10f2('0x27')]=function(){return util[_0x10f2('0x1e')](_0x10f2('0x28'),this['name'],this[_0x10f2('0x3')][_0x10f2('0x29')]>0x0?this['number'][_0x10f2('0x2a')](this[_0x10f2('0x3')][_0x10f2('0x29')]):this[_0x10f2('0xa')]);};Action['prototype'][_0x10f2('0x2b')]=function(){return this[_0x10f2('0xb')];};module[_0x10f2('0x2c')]=Action; \ No newline at end of file +var _0x6531=['UserId','VoiceQueueId','CampaignId','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','queue','exports','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','phone','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x288110,_0x583475){var _0x1fa4f2=function(_0x351177){while(--_0x351177){_0x288110['push'](_0x288110['shift']());}};_0x1fa4f2(++_0x583475);}(_0x6531,0x95));var _0x1653=function(_0x2f082a,_0x3f95e7){_0x2f082a=_0x2f082a-0x0;var _0x52d97d=_0x6531[_0x2f082a];return _0x52d97d;};'use strict';var util=require('util');var _=require(_0x1653('0x0'));var moment=require(_0x1653('0x1'));function checkNameSurname(_0x5d2335,_0x3db230,_0x31a3c1){var _0x56751b='';if(!_['isNil'](_0x3db230)&&_0x1653('0x2')===typeof _0x3db230){_0x56751b+=_0x3db230;}if(!_[_0x1653('0x3')](_0x31a3c1)&&'string'===typeof _0x31a3c1){_0x56751b+='\x20'+_0x31a3c1;}if(_0x56751b!==''){return _0x56751b;}return _0x5d2335;}function Action(_0xa0856b,_0x407c0e,_0x73680a){this[_0x1653('0x4')]=_0xa0856b;this[_0x1653('0x5')]=_0x73680a||undefined;this[_0x1653('0x6')]=checkNameSurname(_0x407c0e[_0x1653('0x7')][_0x1653('0x8')],_0x407c0e[_0x1653('0x7')]['firstName'],_0x407c0e[_0x1653('0x7')][_0x1653('0x9')]);this['number']=_0x407c0e['Contact']['phone'];this['queue']=_0xa0856b[_0x1653('0x6')];this[_0x1653('0xa')]=_0x407c0e[_0x1653('0xa')]||![];this[_0x1653('0xb')]=_0xa0856b[_0x1653('0xb')];this[_0x1653('0xc')]=_0xa0856b[_0x1653('0xc')]||0x3;this[_0x1653('0xd')]=_0x407c0e[_0x1653('0xd')];this[_0x1653('0xe')]=_0x407c0e[_0x1653('0xe')];this[_0x1653('0xf')]=_0x407c0e['countcongestionretry'];this[_0x1653('0x10')]=_0x407c0e[_0x1653('0x10')];this['countnosuchnumberretry']=_0x407c0e[_0x1653('0x11')];this[_0x1653('0x12')]=_0x407c0e[_0x1653('0x12')];this[_0x1653('0x13')]=_0x407c0e[_0x1653('0x13')];this[_0x1653('0x14')]=_0x407c0e[_0x1653('0x14')];this[_0x1653('0x15')]=_0x407c0e[_0x1653('0x15')];this[_0x1653('0x16')]=_0x407c0e[_0x1653('0x16')];this['ListId']=_0x407c0e['ListId'];this[_0x1653('0x17')]=_0x407c0e['UserId'];this['VoiceQueueId']=_0x407c0e[_0x1653('0x18')];this[_0x1653('0x19')]=_0x407c0e[_0x1653('0x19')];this['idHopper']=_0x407c0e['id'];this['ContactFirstName']=_0x407c0e[_0x1653('0x7')]['firstName']||'';this['starttime']=moment()[_0x1653('0x1a')](_0x1653('0x1b'));this[_0x1653('0x1c')]=_0x407c0e[_0x1653('0x1c')];this[_0x1653('0x1d')]=_0x407c0e[_0x1653('0x1d')];this[_0x1653('0x1e')]=_0x407c0e[_0x1653('0x1e')];this['recallme']=_0x407c0e[_0x1653('0x1f')];this[_0x1653('0x20')]='';this[_0x1653('0x21')]='';}Action[_0x1653('0x22')][_0x1653('0x23')]=function(){return util[_0x1653('0x1a')](_0x1653('0x24'),this[_0x1653('0x6')],this[_0x1653('0x4')][_0x1653('0x25')]>0x0?this[_0x1653('0x26')][_0x1653('0x27')](this[_0x1653('0x4')]['dialCutDigit']):this[_0x1653('0x26')]);};Action[_0x1653('0x22')][_0x1653('0x28')]=function(){return this[_0x1653('0x29')];};module[_0x1653('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 10f84f0..ab4686e 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c69=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x39e11d,_0x15ab2c){var _0xc8dce5=function(_0x478fbe){while(--_0x478fbe){_0x39e11d['push'](_0x39e11d['shift']());}};_0xc8dce5(++_0x15ab2c);}(_0x0c69,0x105));var _0x90c6=function(_0x935a04,_0x3a77a8){_0x935a04=_0x935a04-0x0;var _0x457b92=_0x0c69[_0x935a04];return _0x457b92;};'use strict';var util=require(_0x90c6('0x0'));var _=require(_0x90c6('0x1'));var moment=require(_0x90c6('0x2'));function getSeconds(_0x43e1d1,_0x18d889){var _0x40764e=moment(_0x43e1d1)[_0x90c6('0x3')](0x0);var _0x4b330a=moment(_0x18d889)[_0x90c6('0x3')](0x0);return _0x40764e[_0x90c6('0x4')](_0x4b330a,_0x90c6('0x5'));}function AgentComplete(_0xbc5da3,_0x11950c){this['state']=0x4;this[_0x90c6('0x6')]=_0x90c6('0x7');this[_0x90c6('0x8')]=_0xbc5da3[_0x90c6('0x8')];this[_0x90c6('0x9')]=_0xbc5da3['type'];this[_0x90c6('0xa')]=_0xbc5da3['type']===_0x90c6('0xb')?_0x90c6('0xc'):_0xbc5da3['type'];this['countbusyretry']=_0xbc5da3[_0x90c6('0xd')];this[_0x90c6('0xe')]=_0xbc5da3[_0x90c6('0xe')];this[_0x90c6('0xf')]=_0xbc5da3['countnoanswerretry'];this[_0x90c6('0x10')]=_0xbc5da3[_0x90c6('0xd')]+_0xbc5da3[_0x90c6('0xe')]+_0xbc5da3['countnoanswerretry']+_0xbc5da3['countnosuchnumberretry']+_0xbc5da3[_0x90c6('0x11')]+_0xbc5da3[_0x90c6('0x12')]+_0xbc5da3[_0x90c6('0x13')]+_0xbc5da3['countagentrejectretry'];this['countnosuchnumberretry']=_0xbc5da3['countnosuchnumberretry'];this['countdropretry']=_0xbc5da3['countdropretry'];this[_0x90c6('0x12')]=_0xbc5da3[_0x90c6('0x12')];this[_0x90c6('0x13')]=_0xbc5da3['countmachineretry'];this[_0x90c6('0x14')]=_0xbc5da3['countagentrejectretry'];this[_0x90c6('0x15')]=_0x11950c[_0x90c6('0x15')];this[_0x90c6('0x16')]=_0xbc5da3[_0x90c6('0x17')];this[_0x90c6('0x18')]=_0xbc5da3[_0x90c6('0x19')];this[_0x90c6('0x1a')]=_0xbc5da3[_0x90c6('0x1a')];this[_0x90c6('0x1b')]=_0xbc5da3[_0x90c6('0x1b')];this['answertime']=_0xbc5da3['answertime'];this['endtime']=moment()[_0x90c6('0x1c')](_0x90c6('0x1d'));this[_0x90c6('0x1e')]=getSeconds(_0xbc5da3[_0x90c6('0x1b')],_0xbc5da3[_0x90c6('0x1a')]);this[_0x90c6('0x1f')]=getSeconds(_0xbc5da3[_0x90c6('0x20')],_0xbc5da3[_0x90c6('0x1b')]);this[_0x90c6('0x21')]=getSeconds(this[_0x90c6('0x22')],_0xbc5da3[_0x90c6('0x20')]);this['queue']=_0x11950c[_0x90c6('0xc')];this[_0x90c6('0x23')]=_0x11950c['membername'];this[_0x90c6('0x24')]=_0x11950c['reason'];this[_0x90c6('0x25')]=_0xbc5da3[_0x90c6('0x25')];this['callbackuniqueid']=_0xbc5da3[_0x90c6('0x26')];this[_0x90c6('0x27')]=_0xbc5da3[_0x90c6('0x27')];this[_0x90c6('0x28')]=_0xbc5da3[_0x90c6('0x28')];this['ContactId']=_0xbc5da3[_0x90c6('0x29')];this[_0x90c6('0x2a')]=_0xbc5da3[_0x90c6('0x2a')];this[_0x90c6('0x2b')]=_0xbc5da3['UserId'];this[_0x90c6('0x2c')]=_0xbc5da3[_0x90c6('0x2c')];this[_0x90c6('0x2d')]=_0xbc5da3[_0x90c6('0x2d')];this['originatecalleridnum']=_0xbc5da3['originatecalleridnum']||'';this[_0x90c6('0x2e')]=_0xbc5da3[_0x90c6('0x2e')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x84da=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','answertime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x4947d7,_0x270f05){var _0x4b6e94=function(_0x469ae4){while(--_0x469ae4){_0x4947d7['push'](_0x4947d7['shift']());}};_0x4b6e94(++_0x270f05);}(_0x84da,0x186));var _0xa84d=function(_0x38c990,_0x395321){_0x38c990=_0x38c990-0x0;var _0x5a85e6=_0x84da[_0x38c990];return _0x5a85e6;};'use strict';var util=require('util');var _=require(_0xa84d('0x0'));var moment=require('moment');function getSeconds(_0xf3fe36,_0x24352d){var _0x287fc1=moment(_0xf3fe36)[_0xa84d('0x1')](0x0);var _0x277b62=moment(_0x24352d)[_0xa84d('0x1')](0x0);return _0x287fc1[_0xa84d('0x2')](_0x277b62,_0xa84d('0x3'));}function AgentComplete(_0x1ea278,_0x2872ae){this[_0xa84d('0x4')]=0x4;this[_0xa84d('0x5')]=_0xa84d('0x6');this[_0xa84d('0x7')]=_0x1ea278[_0xa84d('0x7')];this[_0xa84d('0x8')]=_0x1ea278[_0xa84d('0x8')];this[_0xa84d('0x9')]=_0x1ea278['type']===_0xa84d('0xa')?'queue':_0x1ea278[_0xa84d('0x8')];this[_0xa84d('0xb')]=_0x1ea278['countbusyretry'];this['countcongestionretry']=_0x1ea278[_0xa84d('0xc')];this[_0xa84d('0xd')]=_0x1ea278['countnoanswerretry'];this[_0xa84d('0xe')]=_0x1ea278[_0xa84d('0xb')]+_0x1ea278['countcongestionretry']+_0x1ea278[_0xa84d('0xd')]+_0x1ea278[_0xa84d('0xf')]+_0x1ea278[_0xa84d('0x10')]+_0x1ea278[_0xa84d('0x11')]+_0x1ea278['countmachineretry']+_0x1ea278[_0xa84d('0x12')];this[_0xa84d('0xf')]=_0x1ea278['countnosuchnumberretry'];this[_0xa84d('0x10')]=_0x1ea278[_0xa84d('0x10')];this[_0xa84d('0x11')]=_0x1ea278[_0xa84d('0x11')];this[_0xa84d('0x13')]=_0x1ea278['countmachineretry'];this[_0xa84d('0x12')]=_0x1ea278[_0xa84d('0x12')];this[_0xa84d('0x14')]=_0x2872ae[_0xa84d('0x14')];this[_0xa84d('0x15')]=_0x1ea278[_0xa84d('0x16')];this[_0xa84d('0x17')]=_0x1ea278[_0xa84d('0x18')];this[_0xa84d('0x19')]=_0x1ea278[_0xa84d('0x19')];this[_0xa84d('0x1a')]=_0x1ea278['responsetime'];this['answertime']=_0x1ea278['answertime'];this[_0xa84d('0x1b')]=moment()[_0xa84d('0x1c')](_0xa84d('0x1d'));this['ringtime']=getSeconds(_0x1ea278['responsetime'],_0x1ea278['starttime']);this[_0xa84d('0x1e')]=getSeconds(_0x1ea278[_0xa84d('0x1f')],_0x1ea278[_0xa84d('0x1a')]);this[_0xa84d('0x20')]=getSeconds(this[_0xa84d('0x1b')],_0x1ea278[_0xa84d('0x1f')]);this[_0xa84d('0x21')]=_0x2872ae[_0xa84d('0x21')];this[_0xa84d('0x22')]=_0x2872ae['membername'];this['reason']=_0x2872ae[_0xa84d('0x23')];this[_0xa84d('0x24')]=_0x1ea278['callback'];this[_0xa84d('0x25')]=_0x1ea278[_0xa84d('0x25')];this[_0xa84d('0x26')]=_0x1ea278[_0xa84d('0x26')];this[_0xa84d('0x27')]=_0x1ea278['recallme'];this[_0xa84d('0x28')]=_0x1ea278[_0xa84d('0x28')];this[_0xa84d('0x29')]=_0x1ea278[_0xa84d('0x29')];this[_0xa84d('0x2a')]=_0x1ea278[_0xa84d('0x2a')];this['VoiceQueueId']=_0x1ea278[_0xa84d('0x2b')];this[_0xa84d('0x2c')]=_0x1ea278['CampaignId'];this['originatecalleridnum']=_0x1ea278[_0xa84d('0x2d')]||'';this[_0xa84d('0x2e')]=_0x1ea278[_0xa84d('0x2e')]||'';}module[_0xa84d('0x2f')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 9efbb37..aa423ee 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56e6=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x56e6,0x6b));var _0x656e=function(_0x437d54,_0x211143){_0x437d54=_0x437d54-0x0;var _0x43014a=_0x56e6[_0x437d54];return _0x43014a;};'use strict';var util=require(_0x656e('0x0'));var _=require(_0x656e('0x1'));var moment=require(_0x656e('0x2'));function getSeconds(_0x75e34c,_0x3a7a6a){var _0x3833eb=moment(_0x75e34c)['milliseconds'](0x0);var _0x40a874=moment(_0x3a7a6a)[_0x656e('0x3')](0x0);return _0x3833eb[_0x656e('0x4')](_0x40a874,_0x656e('0x5'));}function Final(_0x123fd4){this[_0x656e('0x6')]=_0x123fd4[_0x656e('0x6')];this['scheduledat']=_0x123fd4[_0x656e('0x7')];this[_0x656e('0x8')]=_0x123fd4[_0x656e('0x8')];this[_0x656e('0x9')]=_0x123fd4[_0x656e('0x8')]===_0x656e('0xa')?_0x656e('0xb'):_0x123fd4[_0x656e('0x8')];this[_0x656e('0xc')]=_0x123fd4[_0x656e('0xc')];this[_0x656e('0xd')]=_0x123fd4[_0x656e('0xd')];this[_0x656e('0xe')]=_0x123fd4[_0x656e('0xe')];this['countglobal']=_0x123fd4['countbusyretry']+_0x123fd4[_0x656e('0xd')]+_0x123fd4[_0x656e('0xe')]+_0x123fd4[_0x656e('0xf')]+_0x123fd4[_0x656e('0x10')]+_0x123fd4['countabandonedretry']+_0x123fd4['countmachineretry']+_0x123fd4[_0x656e('0x11')];this[_0x656e('0xf')]=_0x123fd4['countnosuchnumberretry'];this[_0x656e('0x10')]=_0x123fd4['countdropretry'];this[_0x656e('0x12')]=_0x123fd4[_0x656e('0x12')];this[_0x656e('0x13')]=_0x123fd4[_0x656e('0x13')];this['countagentrejectretry']=_0x123fd4[_0x656e('0x11')];this[_0x656e('0xb')]=_0x123fd4[_0x656e('0xb')];this[_0x656e('0x14')]=_0x123fd4[_0x656e('0x14')];this['calleridnum']=_0x123fd4['calleridnum'];this['starttime']=_0x123fd4[_0x656e('0x15')];this[_0x656e('0x16')]=_0x123fd4['responsetime'];this[_0x656e('0x17')]=_0x123fd4['responsetime'];this['ringtime']=_0x123fd4['ringtime']||0x0;this[_0x656e('0x18')]=_0x123fd4[_0x656e('0x18')]||0x0;this[_0x656e('0x19')]=_0x123fd4[_0x656e('0x19')]||0x0;this['callback']=_0x123fd4[_0x656e('0x1a')];this[_0x656e('0x1b')]=_0x123fd4[_0x656e('0x1b')];this['callbackat']=_0x123fd4[_0x656e('0x1c')];this[_0x656e('0x1d')]=_0x123fd4[_0x656e('0x1d')];this[_0x656e('0x1e')]=_0x123fd4[_0x656e('0x1e')];this[_0x656e('0x1f')]=_0x123fd4[_0x656e('0x1f')];this['UserId']=_0x123fd4[_0x656e('0x20')];this[_0x656e('0x21')]=_0x123fd4['VoiceQueueId'];this['CampaignId']=_0x123fd4[_0x656e('0x22')];this['originatecalleridnum']=_0x123fd4[_0x656e('0x23')]||'';this['originatecalleridname']=_0x123fd4['originatecalleridname']||'';}module[_0x656e('0x24')]=Final; \ No newline at end of file +var _0x7118=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime'];(function(_0x19cfac,_0x3745dc){var _0x25d2a5=function(_0x2bad78){while(--_0x2bad78){_0x19cfac['push'](_0x19cfac['shift']());}};_0x25d2a5(++_0x3745dc);}(_0x7118,0x159));var _0x8711=function(_0x5785d6,_0x38ebc7){_0x5785d6=_0x5785d6-0x0;var _0x45ccbd=_0x7118[_0x5785d6];return _0x45ccbd;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8711('0x0'));function getSeconds(_0xf50b2e,_0x5c64d4){var _0x1758c5=moment(_0xf50b2e)[_0x8711('0x1')](0x0);var _0x348e88=moment(_0x5c64d4)[_0x8711('0x1')](0x0);return _0x1758c5[_0x8711('0x2')](_0x348e88,_0x8711('0x3'));}function Final(_0x206b82){this['uniqueid']=_0x206b82[_0x8711('0x4')];this[_0x8711('0x5')]=_0x206b82[_0x8711('0x5')];this[_0x8711('0x6')]=_0x206b82[_0x8711('0x6')];this[_0x8711('0x7')]=_0x206b82[_0x8711('0x6')]===_0x8711('0x8')?_0x8711('0x9'):_0x206b82[_0x8711('0x6')];this[_0x8711('0xa')]=_0x206b82['countbusyretry'];this['countcongestionretry']=_0x206b82[_0x8711('0xb')];this[_0x8711('0xc')]=_0x206b82[_0x8711('0xc')];this['countglobal']=_0x206b82['countbusyretry']+_0x206b82[_0x8711('0xb')]+_0x206b82[_0x8711('0xc')]+_0x206b82['countnosuchnumberretry']+_0x206b82['countdropretry']+_0x206b82[_0x8711('0xd')]+_0x206b82[_0x8711('0xe')]+_0x206b82[_0x8711('0xf')];this[_0x8711('0x10')]=_0x206b82[_0x8711('0x10')];this[_0x8711('0x11')]=_0x206b82[_0x8711('0x11')];this['countabandonedretry']=_0x206b82[_0x8711('0xd')];this[_0x8711('0xe')]=_0x206b82[_0x8711('0xe')];this[_0x8711('0xf')]=_0x206b82[_0x8711('0xf')];this[_0x8711('0x9')]=_0x206b82['queue'];this[_0x8711('0x12')]=_0x206b82[_0x8711('0x12')];this[_0x8711('0x13')]=_0x206b82[_0x8711('0x13')];this[_0x8711('0x14')]=_0x206b82['starttime'];this['responsetime']=_0x206b82['responsetime'];this[_0x8711('0x15')]=_0x206b82[_0x8711('0x16')];this[_0x8711('0x17')]=_0x206b82['ringtime']||0x0;this['holdtime']=_0x206b82[_0x8711('0x18')]||0x0;this[_0x8711('0x19')]=_0x206b82[_0x8711('0x19')]||0x0;this[_0x8711('0x1a')]=_0x206b82[_0x8711('0x1a')];this[_0x8711('0x1b')]=_0x206b82[_0x8711('0x1b')];this[_0x8711('0x1c')]=_0x206b82[_0x8711('0x1c')];this[_0x8711('0x1d')]=_0x206b82['recallme'];this[_0x8711('0x1e')]=_0x206b82[_0x8711('0x1e')];this[_0x8711('0x1f')]=_0x206b82[_0x8711('0x1f')];this['UserId']=_0x206b82[_0x8711('0x20')];this[_0x8711('0x21')]=_0x206b82[_0x8711('0x21')];this['CampaignId']=_0x206b82[_0x8711('0x22')];this[_0x8711('0x23')]=_0x206b82[_0x8711('0x23')]||'';this[_0x8711('0x24')]=_0x206b82[_0x8711('0x24')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 8f13bf8..fa9a412 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cb7=['number','starttime','format','holdtime','talktime','endtime','responsetime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid'];(function(_0x93872e,_0x37f470){var _0x4a6ff1=function(_0x2e6117){while(--_0x2e6117){_0x93872e['push'](_0x93872e['shift']());}};_0x4a6ff1(++_0x37f470);}(_0x6cb7,0x8a));var _0x76cb=function(_0x4836f5,_0x4bec7a){_0x4836f5=_0x4836f5-0x0;var _0x42e5b1=_0x6cb7[_0x4836f5];return _0x42e5b1;};'use strict';var util=require(_0x76cb('0x0'));var _=require(_0x76cb('0x1'));var moment=require(_0x76cb('0x2'));function getSeconds(_0x506a9a,_0x3be05c){var _0x5abfa1=moment(_0x506a9a)[_0x76cb('0x3')](0x0);var _0x5f46d4=moment(_0x3be05c)[_0x76cb('0x3')](0x0);return _0x5abfa1[_0x76cb('0x4')](_0x5f46d4,'seconds');}function Hangup(_0xbc77d8,_0x350398){this[_0x76cb('0x5')]=0x4;this[_0x76cb('0x6')]=_0x76cb('0x7');this[_0x76cb('0x8')]=_0xbc77d8['scheduledat'];this[_0x76cb('0x9')]=_0xbc77d8[_0x76cb('0x9')];this[_0x76cb('0xa')]=_0xbc77d8[_0x76cb('0x9')]==='outbound'?_0x76cb('0xb'):_0xbc77d8[_0x76cb('0x9')];this[_0x76cb('0xc')]=_0xbc77d8[_0x76cb('0xc')];this[_0x76cb('0xd')]=_0xbc77d8[_0x76cb('0xd')];this[_0x76cb('0xe')]=_0xbc77d8[_0x76cb('0xe')];this[_0x76cb('0xf')]=_0xbc77d8[_0x76cb('0xc')]+_0xbc77d8[_0x76cb('0xd')]+_0xbc77d8[_0x76cb('0xe')]+_0xbc77d8['countnosuchnumberretry']+_0xbc77d8[_0x76cb('0x10')]+_0xbc77d8[_0x76cb('0x11')]+_0xbc77d8[_0x76cb('0x12')]+_0xbc77d8['countagentrejectretry'];this[_0x76cb('0x13')]=_0xbc77d8['countnosuchnumberretry'];this['countdropretry']=_0xbc77d8[_0x76cb('0x10')];this[_0x76cb('0x11')]=_0xbc77d8[_0x76cb('0x11')];this[_0x76cb('0x12')]=_0xbc77d8[_0x76cb('0x12')];this[_0x76cb('0x14')]=_0xbc77d8['countagentrejectretry'];this[_0x76cb('0x15')]=_0x350398[_0x76cb('0x15')];this['calleridname']=_0xbc77d8['name'];this['calleridnum']=_0xbc77d8[_0x76cb('0x16')];this[_0x76cb('0x17')]=_0xbc77d8[_0x76cb('0x17')];this['responsetime']=_0xbc77d8['responsetime'];this['endtime']=moment()[_0x76cb('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0xbc77d8['responsetime'],_0xbc77d8['starttime']);this[_0x76cb('0x19')]=0x0;this[_0x76cb('0x1a')]=getSeconds(this[_0x76cb('0x1b')],_0xbc77d8[_0x76cb('0x1c')]);this['queue']=_0xbc77d8[_0x76cb('0xb')];this[_0x76cb('0x1d')]=_0x76cb('0x1e');this[_0x76cb('0x1f')]=_0x350398[_0x76cb('0x20')];this[_0x76cb('0x21')]=_0xbc77d8['callback'];this[_0x76cb('0x22')]=_0xbc77d8[_0x76cb('0x22')];this[_0x76cb('0x23')]=_0xbc77d8[_0x76cb('0x23')];this['recallme']=_0xbc77d8['recallme'];this['ContactId']=_0xbc77d8['ContactId'];this[_0x76cb('0x24')]=_0xbc77d8['ListId'];this['UserId']=_0xbc77d8[_0x76cb('0x25')];this[_0x76cb('0x26')]=_0xbc77d8[_0x76cb('0x26')];this[_0x76cb('0x27')]=_0xbc77d8[_0x76cb('0x27')];}module['exports']=Hangup; \ No newline at end of file +var _0x6377=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x695dbc,_0x2d30ef){var _0x344fe6=function(_0x159d60){while(--_0x159d60){_0x695dbc['push'](_0x695dbc['shift']());}};_0x344fe6(++_0x2d30ef);}(_0x6377,0x1a9));var _0x7637=function(_0x3641d5,_0x11626c){_0x3641d5=_0x3641d5-0x0;var _0x762e42=_0x6377[_0x3641d5];return _0x762e42;};'use strict';var util=require(_0x7637('0x0'));var _=require(_0x7637('0x1'));var moment=require(_0x7637('0x2'));function getSeconds(_0x1afdf3,_0x17c691){var _0x3820a1=moment(_0x1afdf3)[_0x7637('0x3')](0x0);var _0x36c711=moment(_0x17c691)['milliseconds'](0x0);return _0x3820a1[_0x7637('0x4')](_0x36c711,_0x7637('0x5'));}function Hangup(_0x59bbe,_0x3441cf){this[_0x7637('0x6')]=0x4;this[_0x7637('0x7')]=_0x7637('0x8');this[_0x7637('0x9')]=_0x59bbe['scheduledat'];this[_0x7637('0xa')]=_0x59bbe[_0x7637('0xa')];this[_0x7637('0xb')]=_0x59bbe[_0x7637('0xa')]===_0x7637('0xc')?_0x7637('0xd'):_0x59bbe[_0x7637('0xa')];this[_0x7637('0xe')]=_0x59bbe[_0x7637('0xe')];this['countcongestionretry']=_0x59bbe[_0x7637('0xf')];this[_0x7637('0x10')]=_0x59bbe[_0x7637('0x10')];this[_0x7637('0x11')]=_0x59bbe[_0x7637('0xe')]+_0x59bbe['countcongestionretry']+_0x59bbe[_0x7637('0x10')]+_0x59bbe[_0x7637('0x12')]+_0x59bbe[_0x7637('0x13')]+_0x59bbe[_0x7637('0x14')]+_0x59bbe[_0x7637('0x15')]+_0x59bbe[_0x7637('0x16')];this[_0x7637('0x12')]=_0x59bbe[_0x7637('0x12')];this[_0x7637('0x13')]=_0x59bbe[_0x7637('0x13')];this[_0x7637('0x14')]=_0x59bbe[_0x7637('0x14')];this[_0x7637('0x15')]=_0x59bbe[_0x7637('0x15')];this[_0x7637('0x16')]=_0x59bbe[_0x7637('0x16')];this['uniqueid']=_0x3441cf['uniqueid'];this['calleridname']=_0x59bbe[_0x7637('0x17')];this[_0x7637('0x18')]=_0x59bbe[_0x7637('0x19')];this[_0x7637('0x1a')]=_0x59bbe['starttime'];this[_0x7637('0x1b')]=_0x59bbe[_0x7637('0x1b')];this['endtime']=moment()[_0x7637('0x1c')](_0x7637('0x1d'));this[_0x7637('0x1e')]=getSeconds(_0x59bbe[_0x7637('0x1b')],_0x59bbe['starttime']);this[_0x7637('0x1f')]=0x0;this[_0x7637('0x20')]=getSeconds(this['endtime'],_0x59bbe[_0x7637('0x1b')]);this['queue']=_0x59bbe[_0x7637('0xd')];this['membername']=_0x7637('0x21');this['reason']=_0x3441cf[_0x7637('0x22')];this[_0x7637('0x23')]=_0x59bbe[_0x7637('0x23')];this[_0x7637('0x24')]=_0x59bbe[_0x7637('0x24')];this[_0x7637('0x25')]=_0x59bbe[_0x7637('0x25')];this['recallme']=_0x59bbe['recallme'];this[_0x7637('0x26')]=_0x59bbe[_0x7637('0x26')];this[_0x7637('0x27')]=_0x59bbe[_0x7637('0x27')];this[_0x7637('0x28')]=_0x59bbe[_0x7637('0x28')];this[_0x7637('0x29')]=_0x59bbe[_0x7637('0x29')];this[_0x7637('0x2a')]=_0x59bbe[_0x7637('0x2a')];}module[_0x7637('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 464ad18..cc15340 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38fd=['countnosuchnumberretry','countdropretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countmachineretry','countagentrejectretry'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x38fd,0x100));var _0xd38f=function(_0x360aea,_0x6b81c6){_0x360aea=_0x360aea-0x0;var _0x251e26=_0x38fd[_0x360aea];return _0x251e26;};'use strict';var util=require(_0xd38f('0x0'));var _=require(_0xd38f('0x1'));var moment=require(_0xd38f('0x2'));function getSeconds(_0x4c9531,_0x548551){var _0x20b4ff=moment(_0x4c9531)[_0xd38f('0x3')](0x0);var _0xb8139a=moment(_0x548551)[_0xd38f('0x3')](0x0);return _0x20b4ff[_0xd38f('0x4')](_0xb8139a,_0xd38f('0x5'));}function History(_0x45b430){this[_0xd38f('0x6')]=_0x45b430[_0xd38f('0x6')];this[_0xd38f('0x7')]=_0x45b430[_0xd38f('0x7')]||undefined;this[_0xd38f('0x8')]=_0x45b430[_0xd38f('0x8')];this['campaigntype']=_0x45b430[_0xd38f('0x8')]===_0xd38f('0x9')?_0xd38f('0xa'):_0x45b430[_0xd38f('0x8')];this[_0xd38f('0xb')]=_0x45b430[_0xd38f('0xb')];this['countcongestionretry']=_0x45b430['countcongestionretry'];this[_0xd38f('0xc')]=_0x45b430['countnoanswerretry'];this[_0xd38f('0xd')]=_0x45b430['countbusyretry']+_0x45b430[_0xd38f('0xe')]+_0x45b430['countnoanswerretry']+_0x45b430['countnosuchnumberretry']+_0x45b430['countdropretry']+_0x45b430['countabandonedretry']+_0x45b430[_0xd38f('0xf')]+_0x45b430[_0xd38f('0x10')];this[_0xd38f('0x11')]=_0x45b430[_0xd38f('0x11')];this[_0xd38f('0x12')]=_0x45b430['countdropretry'];this[_0xd38f('0x13')]=_0x45b430[_0xd38f('0x13')];this[_0xd38f('0xf')]=_0x45b430[_0xd38f('0xf')];this[_0xd38f('0x10')]=_0x45b430[_0xd38f('0x10')];this[_0xd38f('0xa')]=_0x45b430['queue'];this[_0xd38f('0x14')]=_0x45b430['name'];this[_0xd38f('0x15')]=_0x45b430[_0xd38f('0x16')];this[_0xd38f('0x17')]=_0x45b430[_0xd38f('0x17')];this[_0xd38f('0x18')]=_0x45b430[_0xd38f('0x18')];this[_0xd38f('0x19')]=_0x45b430[_0xd38f('0x18')];this[_0xd38f('0x1a')]=getSeconds(_0x45b430['responsetime'],_0x45b430[_0xd38f('0x17')]);this['holdtime']=0x0;this[_0xd38f('0x1b')]=0x0;this['callback']=_0x45b430[_0xd38f('0x1c')];this[_0xd38f('0x1d')]=_0x45b430[_0xd38f('0x1d')];this[_0xd38f('0x1e')]=_0x45b430[_0xd38f('0x1e')];this[_0xd38f('0x1f')]=_0x45b430[_0xd38f('0x1f')];this['ContactId']=_0x45b430[_0xd38f('0x20')];this['ListId']=_0x45b430['ListId'];this[_0xd38f('0x21')]=_0x45b430['UserId'];this['VoiceQueueId']=_0x45b430[_0xd38f('0x22')];this[_0xd38f('0x23')]=_0x45b430[_0xd38f('0x23')];this[_0xd38f('0x24')]=_0x45b430[_0xd38f('0x24')]||'';this[_0xd38f('0x25')]=_0x45b430[_0xd38f('0x25')]||'';}module[_0xd38f('0x26')]=History; \ No newline at end of file +var _0x7f61=['lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0xddd177,_0x560dd6){var _0x443799=function(_0x37f143){while(--_0x37f143){_0xddd177['push'](_0xddd177['shift']());}};_0x443799(++_0x560dd6);}(_0x7f61,0xee));var _0x17f6=function(_0xb87f93,_0x4f5286){_0xb87f93=_0xb87f93-0x0;var _0x569d2d=_0x7f61[_0xb87f93];return _0x569d2d;};'use strict';var util=require('util');var _=require(_0x17f6('0x0'));var moment=require(_0x17f6('0x1'));function getSeconds(_0x2a879d,_0x414dca){var _0x25beee=moment(_0x2a879d)[_0x17f6('0x2')](0x0);var _0x4e73d7=moment(_0x414dca)[_0x17f6('0x2')](0x0);return _0x25beee[_0x17f6('0x3')](_0x4e73d7,'seconds');}function History(_0x555e46){this[_0x17f6('0x4')]=_0x555e46[_0x17f6('0x4')];this[_0x17f6('0x5')]=_0x555e46[_0x17f6('0x5')]||undefined;this[_0x17f6('0x6')]=_0x555e46[_0x17f6('0x6')];this['campaigntype']=_0x555e46['type']==='outbound'?_0x17f6('0x7'):_0x555e46[_0x17f6('0x6')];this[_0x17f6('0x8')]=_0x555e46[_0x17f6('0x8')];this['countcongestionretry']=_0x555e46[_0x17f6('0x9')];this[_0x17f6('0xa')]=_0x555e46[_0x17f6('0xa')];this[_0x17f6('0xb')]=_0x555e46[_0x17f6('0x8')]+_0x555e46['countcongestionretry']+_0x555e46[_0x17f6('0xa')]+_0x555e46[_0x17f6('0xc')]+_0x555e46[_0x17f6('0xd')]+_0x555e46[_0x17f6('0xe')]+_0x555e46[_0x17f6('0xf')]+_0x555e46[_0x17f6('0x10')];this[_0x17f6('0xc')]=_0x555e46[_0x17f6('0xc')];this[_0x17f6('0xd')]=_0x555e46['countdropretry'];this[_0x17f6('0xe')]=_0x555e46[_0x17f6('0xe')];this[_0x17f6('0xf')]=_0x555e46[_0x17f6('0xf')];this[_0x17f6('0x10')]=_0x555e46[_0x17f6('0x10')];this[_0x17f6('0x7')]=_0x555e46['queue'];this['calleridname']=_0x555e46['name'];this['calleridnum']=_0x555e46[_0x17f6('0x11')];this['starttime']=_0x555e46[_0x17f6('0x12')];this[_0x17f6('0x13')]=_0x555e46[_0x17f6('0x13')];this[_0x17f6('0x14')]=_0x555e46[_0x17f6('0x13')];this[_0x17f6('0x15')]=getSeconds(_0x555e46[_0x17f6('0x13')],_0x555e46[_0x17f6('0x12')]);this[_0x17f6('0x16')]=0x0;this['talktime']=0x0;this[_0x17f6('0x17')]=_0x555e46[_0x17f6('0x17')];this[_0x17f6('0x18')]=_0x555e46['callbackuniqueid'];this[_0x17f6('0x19')]=_0x555e46['callbackat'];this[_0x17f6('0x1a')]=_0x555e46['recallme'];this[_0x17f6('0x1b')]=_0x555e46[_0x17f6('0x1b')];this[_0x17f6('0x1c')]=_0x555e46[_0x17f6('0x1c')];this[_0x17f6('0x1d')]=_0x555e46[_0x17f6('0x1d')];this[_0x17f6('0x1e')]=_0x555e46[_0x17f6('0x1e')];this[_0x17f6('0x1f')]=_0x555e46[_0x17f6('0x1f')];this['originatecalleridnum']=_0x555e46[_0x17f6('0x20')]||'';this[_0x17f6('0x21')]=_0x555e46['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a9c8d3e..285030a 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 _0x63e2=['queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','UserId','CampaignId','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','value','outboundAnswerAgiCallsDay','Machine','membername','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','add','ListId','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','roundrobin','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','timezones','indexOf','true','command','content','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','user:%s','user:dialPreviewRecallReminder','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','\x5cw{0,','pow','replace','random','match','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','nosuchnumber','[syncAgentComplete][createHistory][0]','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','floor','startProgressive','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[countReScheduled]\x20','Contact.phone','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','rrmemory','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','md5','voice:queue:%s','format','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','state','statedesc','starttime','[uniqueid]','clearZombieChannels','[actions]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]'];(function(_0xd92a00,_0x3cadb5){var _0x22aff5=function(_0x56d6df){while(--_0x56d6df){_0xd92a00['push'](_0xd92a00['shift']());}};_0x22aff5(++_0x3cadb5);}(_0x63e2,0x167));var _0x263e=function(_0x5ca03d,_0x5218e0){_0x5ca03d=_0x5ca03d-0x0;var _0x506c2f=_0x63e2[_0x5ca03d];return _0x506c2f;};'use strict';var util=require('util');var _=require(_0x263e('0x0'));var BPromise=require('bluebird');var uuid=require(_0x263e('0x1'));var moment=require(_0x263e('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x263e('0x3'));var ut=require(_0x263e('0x4'));var config=require('../../../config/environment/');var logger=require(_0x263e('0x5'))(_0x263e('0x6'));var loggerBooked=require(_0x263e('0x5'))(_0x263e('0x7'));var loggerPredictive=require(_0x263e('0x5'))(_0x263e('0x8'));var loggerPredictiveCalls=require(_0x263e('0x5'))(_0x263e('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x263e('0xa'));var ami=require(_0x263e('0xb'));config[_0x263e('0xc')]=_['defaults'](config[_0x263e('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x263e('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x263e('0xe'));var cmHopperHistory=require(_0x263e('0xf'));var cmHopperBlack=require(_0x263e('0x10'));var voiceQueueRt=require(_0x263e('0x11'));var RpcSetting=require(_0x263e('0x12'));var Action=require(_0x263e('0x13'));var History=require(_0x263e('0x14'));var Final=require(_0x263e('0x15'));var AgentComplete=require(_0x263e('0x16'));var QueueCallerAbandon=require(_0x263e('0x17'));var Hangup=require(_0x263e('0x18'));var ipAgi=process[_0x263e('0x19')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x263e('0x1a'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x263e('0x1b')][_0x263e('0x1c')]=function(_0x814d0c){this[_0x263e('0x1d')]=this['tail']?this[_0x263e('0x1d')]['finally'](_0x814d0c):_0x814d0c();};function Dialer(_0x13deb3,_0x15db84){this[_0x263e('0x1e')]=new Sequence();this['preview']=_0x15db84;this[_0x263e('0x1f')]=_0x13deb3[_0x263e('0x1f')];this[_0x263e('0x20')]=_0x13deb3[_0x263e('0x20')];this[_0x263e('0x21')]=_0x13deb3['agents'];this['trunks']=_0x13deb3[_0x263e('0x22')];this[_0x263e('0x23')]=config['maxNumberOriginate']||0x2;this[_0x263e('0x24')]={};this[_0x263e('0x25')]={};this[_0x263e('0x26')]={};this[_0x263e('0x27')]={};this[_0x263e('0x28')]={};this[_0x263e('0x29')]={};this['startProgressive']={};this[_0x263e('0x2a')]={};this[_0x263e('0x2b')]={};this['queueBookedRR']={};ami['on'](_0x263e('0x2c'),this[_0x263e('0x2d')]['bind'](this));ami['on'](_0x263e('0x2e'),this['syncQueueCallerAbandon'][_0x263e('0x2f')](this));ami['on']('originateresponse',this[_0x263e('0x30')][_0x263e('0x2f')](this));ami['on'](_0x263e('0x31'),this[_0x263e('0x32')][_0x263e('0x2f')](this));ami['on']('custom:queuesummary',this[_0x263e('0xa')][_0x263e('0x2f')](this));ami['on']('hangup',this[_0x263e('0x33')][_0x263e('0x2f')](this));ami['on'](_0x263e('0x34'),this[_0x263e('0x35')][_0x263e('0x2f')](this));ami['on'](_0x263e('0x36'),this[_0x263e('0x37')][_0x263e('0x2f')](this));ami['on'](_0x263e('0x38'),this[_0x263e('0x39')][_0x263e('0x2f')](this));ami['on'](_0x263e('0x3a'),this['syncQueueStatusComplete'][_0x263e('0x2f')](this));this[_0x263e('0x3b')]();this[_0x263e('0x3c')]();RpcSetting[_0x263e('0x3d')]()['then'](function(_0x2b104c){previewRecallmeReminderInterval=_0x2b104c[_0x263e('0x3e')];});}function isNotNull(_0x3dc754){return _0x3dc754!==null&&!_[_0x263e('0x3f')](_0x3dc754);}function checkIsLoggedIn(_0x53f3f1,_0x52f7a7){return function(){if(_0x52f7a7<=0x0){_0x53f3f1[_0x263e('0x40')]=_0x263e('0x41');throw _0x53f3f1[_0x263e('0x42')]+_0x263e('0x43');}};}function isActive(_0x578cfe){return _0x578cfe;}function checkIsActive(_0xa7be69,_0x287d16){return function(){if(!isActive(_0x287d16)){_0xa7be69['message']=_0x263e('0x44');throw _0xa7be69[_0x263e('0x42')]+_0x263e('0x45');}};}function checkInterval(_0x55f306){return function(){if(!isNotNull(_0x55f306[_0x263e('0x46')])){_0x55f306['message']=_0x263e('0x47');throw _0x55f306[_0x263e('0x42')]+_0x263e('0x48');}if(!isNotNull(_0x55f306[_0x263e('0x46')][_0x263e('0x49')])){_0x55f306[_0x263e('0x40')]=_0x263e('0x47');throw _0x55f306[_0x263e('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x263e('0x4a')](_0x55f306['Interval'][_0x263e('0x49')]))){_0x55f306[_0x263e('0x40')]='INTERVAL_IS_NULL';throw _0x55f306[_0x263e('0x42')]+_0x263e('0x48');}};}function msgResponse(_0x464d9d,_0x12b401,_0x4af320){return{'action':_0x464d9d,'response':_0x12b401,'message':_0x4af320,'stack':_0x4af320};}function myreject(_0xcc64ff){return function(_0x3c0a3a){return _0xcc64ff(msgResponse(_0x263e('0x4b'),_0x263e('0x4c'),JSON[_0x263e('0x4d')](_0x3c0a3a)));};}function getSeconds(_0x524e08,_0x179516){var _0x2ab977=moment(_0x524e08)[_0x263e('0x4e')](0x0);var _0xe6a672=moment(_0x179516)['milliseconds'](0x0);return _0x2ab977[_0x263e('0x4f')](_0xe6a672,'seconds');}function emit(_0x291c18,_0x26547f,_0x5e0f48){io['to'](_0x291c18)[_0x263e('0x50')](_0x26547f,_0x5e0f48);}function emitVoiceQueueSummary(_0x10ba6f){if(_0x10ba6f['type']===_0x263e('0x51')){var _0x3793a9={'id':_0x10ba6f['id'],'name':_0x10ba6f[_0x263e('0x42')],'strategy':_0x10ba6f[_0x263e('0x52')],'answered':_0x10ba6f['answered'],'available':_0x10ba6f[_0x263e('0x53')],'loggedIn':_0x10ba6f[_0x263e('0x54')],'pTalking':_0x10ba6f[_0x263e('0x55')],'sumBillable':_0x10ba6f[_0x263e('0x56')],'sumDuration':_0x10ba6f[_0x263e('0x57')],'sumHoldTime':_0x10ba6f[_0x263e('0x58')]||0x0,'talking':_0x10ba6f[_0x263e('0x59')],'total':_0x10ba6f[_0x263e('0x5a')],'type':_0x10ba6f[_0x263e('0x5b')],'unmanaged':_0x10ba6f[_0x263e('0x5c')],'abandoned':_0x10ba6f['abandoned'],'waiting':_0x10ba6f[_0x263e('0x5d')],'loggedInDb':_0x10ba6f[_0x263e('0x5e')],'dialActive':_0x10ba6f[_0x263e('0x5f')],'dialMethod':_0x10ba6f[_0x263e('0x60')],'dialOriginateCallerIdName':_0x10ba6f[_0x263e('0x61')],'dialOriginateCallerIdNumber':_0x10ba6f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x10ba6f['dialOriginateTimeout'],'dialPrefix':_0x10ba6f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x10ba6f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x10ba6f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x10ba6f[_0x263e('0x62')],'outboundBusyCallsDay':_0x10ba6f[_0x263e('0x63')],'outboundCongestionCallsDay':_0x10ba6f[_0x263e('0x64')],'outboundDropCallsDayACS':_0x10ba6f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x10ba6f[_0x263e('0x65')],'outboundDropCallsDayTimeout':_0x10ba6f[_0x263e('0x66')],'outboundNoAnswerCallsDay':_0x10ba6f[_0x263e('0x67')],'outboundNoSuchCallsDay':_0x10ba6f[_0x263e('0x68')],'outboundOriginateFailureCallsDay':_0x10ba6f[_0x263e('0x69')],'outboundReCallsDay':_0x10ba6f[_0x263e('0x6a')],'outboundRejectCallsDay':_0x10ba6f[_0x263e('0x6b')],'outboundUnknownCallsDay':_0x10ba6f[_0x263e('0x6c')],'predictiveIntervalAnsweredCalls':_0x10ba6f[_0x263e('0x6d')],'predictiveIntervalAvgHoldtime':_0x10ba6f[_0x263e('0x6e')],'predictiveIntervalAvgTalktime':_0x10ba6f[_0x263e('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x10ba6f[_0x263e('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x10ba6f[_0x263e('0x71')],'predictiveIntervalErlangCalls':_0x10ba6f[_0x263e('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0x10ba6f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x10ba6f[_0x263e('0x73')],'predictiveIntervalMultiplicativeFactor':_0x10ba6f[_0x263e('0x74')],'predictiveIntervalPauses':_0x10ba6f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x10ba6f['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x10ba6f['predictiveIntervalTotalCalls'],'message':_0x10ba6f[_0x263e('0x40')],'originated':_0x10ba6f[_0x263e('0x75')],'erlangCalls':_0x10ba6f['erlangCalls'],'erlangCallToSecond':_0x10ba6f[_0x263e('0x76')],'erlangAbandonmentRate':_0x10ba6f[_0x263e('0x77')],'erlangBusyFactor':_0x10ba6f[_0x263e('0x78')],'startPredictive':_0x10ba6f['startPredictive'],'startProgressive':_0x10ba6f['startProgressive']};if(_0x10ba6f[_0x263e('0x79')]){_0x3793a9['Trunk']={'id':_0x10ba6f['Trunk']['id'],'name':_0x10ba6f[_0x263e('0x79')]['name'],'active':_0x10ba6f[_0x263e('0x79')][_0x263e('0x7a')],'callerid':_0x10ba6f[_0x263e('0x79')]['callerid']};}if(_0x10ba6f['Interval']){_0x3793a9[_0x263e('0x46')]={'id':_0x10ba6f['Interval']['id'],'name':_0x10ba6f['Interval'][_0x263e('0x42')]};}var _0x515c70=md5(JSON[_0x263e('0x4d')](_0x3793a9));if(_0x10ba6f[_0x263e('0x7b')]!==_0x515c70){_0x10ba6f[_0x263e('0x7b')]=_0x515c70;emit(util['format'](_0x263e('0x7c'),_0x3793a9[_0x263e('0x42')]),'voice_queue:save',_0x3793a9);}}}function emitCampaignSummary(_0x4faf9a){if(_0x4faf9a[_0x263e('0x5b')]==='ivr'){emit(util[_0x263e('0x7d')]('campaign:ivr:%s',_0x4faf9a['name']),'campaign:save',_0x4faf9a);}}function checkGetDataPredictive(_0x487aeb){if(isNotNull(_0x487aeb)&&!_[_0x263e('0x4a')](_0x487aeb)){loggerPredictive[_0x263e('0x7e')](_0x263e('0x7f'));loggerPredictive[_0x263e('0x7e')](_0x263e('0x80'),_0x487aeb[_0x263e('0x81')]);loggerPredictive[_0x263e('0x7e')](_0x263e('0x82'),_0x487aeb[_0x263e('0x6d')]);loggerPredictive[_0x263e('0x7e')](_0x263e('0x83'),_0x487aeb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x487aeb[_0x263e('0x70')]);loggerPredictive[_0x263e('0x7e')](_0x263e('0x84'),_0x487aeb[_0x263e('0x6e')]);loggerPredictive['info'](_0x263e('0x85'),_0x487aeb[_0x263e('0x6f')]);loggerPredictive['info'](_0x263e('0x86'));if(_0x487aeb['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x487aeb[_0x263e('0x6f')])&&_0x487aeb['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x263e('0x7e')](_0x263e('0x87'));if(!_['isUndefined'](_0x487aeb['predictiveIntervalAvgHoldtime'])&&_0x487aeb[_0x263e('0x6e')]>0x0){return!![];}loggerPredictive[_0x263e('0x7e')](_0x263e('0x88'));}else{loggerPredictive[_0x263e('0x7e')](_0x263e('0x89'));}}else{loggerPredictive[_0x263e('0x7e')](_0x263e('0x8a'));}return![];}function mergeDataErlangB(_0x427dcc){return function(_0x2e0d51){loggerPredictive[_0x263e('0x7e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x263e('0x7e')](_0x263e('0x8b'),_0x2e0d51[_0x263e('0x8c')]);loggerPredictive['info'](_0x263e('0x8d'),_0x2e0d51[_0x263e('0x76')]);loggerPredictive[_0x263e('0x7e')](_0x263e('0x8e'),_0x2e0d51[_0x263e('0x77')]);loggerPredictive[_0x263e('0x7e')](_0x263e('0x8f'),_0x2e0d51[_0x263e('0x78')]);loggerPredictive[_0x263e('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e0d51[_0x263e('0x77')]);loggerPredictive[_0x263e('0x7e')](_0x263e('0x86'));_[_0x263e('0x90')](_0x427dcc,_0x2e0d51);};}function getDiff(_0x33dbed){var _0x499cc4=moment()[_0x263e('0x4e')](0x0);var _0x380a12=moment(_0x33dbed)[_0x263e('0x4e')](0x0);return _0x499cc4['diff'](_0x380a12,_0x263e('0x91'));}function ifInterval(_0x13e1cf,_0x16d228){if(_['isUndefined'](_0x16d228)){return![];}return getDiff(_0x16d228)<_0x13e1cf*0x3c;}function freeVariablesPredictive(_0x5e9f8f){if(isNotNull(_0x5e9f8f)){if(!_['isUndefined'](_0x5e9f8f['startProgressive'])){_0x5e9f8f['startProgressive']=undefined;loggerPredictive[_0x263e('0x7e')](_0x5e9f8f['name'],_0x263e('0x92'));}if(!_[_0x263e('0x3f')](_0x5e9f8f[_0x263e('0x29')])){_0x5e9f8f['startPredictive']=undefined;loggerPredictive[_0x263e('0x7e')](_0x5e9f8f[_0x263e('0x42')],_0x263e('0x93'));}if(!_[_0x263e('0x3f')](_0x5e9f8f[_0x263e('0x94')])){clearInterval(_0x5e9f8f[_0x263e('0x94')]);_0x5e9f8f[_0x263e('0x94')]=undefined;loggerPredictive[_0x263e('0x7e')](_0x5e9f8f[_0x263e('0x42')],_0x263e('0x95'));}}}function erlangb(_0x1e8e7f,_0x57a6ef){if(_0x57a6ef===0x0){return 0x0;}var _0x262b04=0x1;for(var _0x5f41fe=0x1;_0x5f41fe<=_0x57a6ef;_0x5f41fe+=0x1){_0x262b04=0x1+_0x262b04*_0x5f41fe/_0x1e8e7f;}return 0x1/_0x262b04;}function isVoiceQueueOutbound(_0x50128e){return _0x50128e===_0x263e('0x51');}function isNotPreview(_0x50370b){return _0x50370b!=='preview';}function isCampaignIvr(_0x1a1072){return _0x1a1072===_0x263e('0x96');}function getCallerId(_0x32d8c4,_0x5d2fcb,_0x1fd076){if(!_[_0x263e('0x3f')](_0x1fd076)&&typeof _0x1fd076===_0x263e('0x97')&&!_[_0x263e('0x4a')](_0x1fd076)){if(!_[_0x263e('0x3f')](_0x5d2fcb)&&typeof _0x5d2fcb===_0x263e('0x97')&&!_[_0x263e('0x4a')](_0x5d2fcb)){return util['format']('\x22%s\x22\x20<%s>',_0x5d2fcb,_0x1fd076);}return util[_0x263e('0x7d')]('\x22%s\x22\x20<%s>',_0x1fd076,_0x1fd076);}if(!_[_0x263e('0x3f')](_0x32d8c4)&&typeof _0x32d8c4===_0x263e('0x97')&&!_[_0x263e('0x4a')](_0x32d8c4)){return _0x32d8c4;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x505e95,_0x167957){return function(_0x47ba07){freeVariablesPredictive(_0x167957);emitVoiceQueueSummary(_0x167957);emitCampaignSummary(_0x167957);loggerSyncQueueSummary[_0x263e('0x98')](_0x505e95,util[_0x263e('0x99')](_0x47ba07,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x497cb1,_0x234a44){return function(_0x57874a){loggerPredictive[_0x263e('0x98')](_0x234a44[_0x263e('0x42')],_0x497cb1);loggerPredictive['error'](_0x57874a[_0x263e('0x9a')]);freeVariablesPredictive(_0x234a44);};}function loggerCatch(_0x52603e){return function(_0x3e95ca){logger['error'](_0x52603e,util['inspect'](_0x3e95ca,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2c8a36){return _0x2c8a36&&!_[_0x263e('0x3f')](_0x2c8a36)&&_0x2c8a36[_0x263e('0x9b')]>0x0;}function decremetOriginate(_0x260bb3){if(!_['isUndefined'](_0x260bb3)&&_0x260bb3!==null){if(typeof _0x260bb3[_0x263e('0x75')]!==_0x263e('0x9c')){if(_0x260bb3[_0x263e('0x75')]>0x0){_0x260bb3[_0x263e('0x75')]-=0x1;}else{logger[_0x263e('0x98')](_0x263e('0x9d'));}}}else{logger[_0x263e('0x98')](_0x263e('0x9e'));}}function checkContactLowerLimitOriginate(_0x3332a6,_0xaddf4d,_0xdf6cd8){if(_0xaddf4d>_0xdf6cd8){for(var _0x24db49=0x0;_0x24db49<_0xaddf4d-_0xdf6cd8;_0x24db49+=0x1){decremetOriginate(_0x3332a6);}}}function loggerGetContactDialer(_0x2041ca,_0x1104e3,_0x264626){return function(_0x304b84){checkContactLowerLimitOriginate(_0x1104e3,_0x264626,0x0);logger['error'](_0x2041ca,util[_0x263e('0x99')](_0x304b84,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x32279b){return function(_0x1f4a73){if(isNotNull(_0x1f4a73)&&isNotNull(_0x1f4a73[0x0])){if(_0x1f4a73[0x0][_0x263e('0x9f')]>0x0){_0x32279b[_0x263e('0x40')]='RESCHEDULED_CONTACTS';logger[_0x263e('0x7e')]('[getContactDialer2][ReScheduled]'+_0x32279b[_0x263e('0x42')],_0x1f4a73[0x0][_0x263e('0x9f')],_0x263e('0xa0'));}else{_0x32279b[_0x263e('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactDialer2][Empty]'+_0x32279b['name']);}}};}function notSendMessagesQueue(_0x1cea52){if(_0x1cea52['sendMessageOneNotActive']){freeVariablesPredictive(_0x1cea52);if(_0x1cea52[_0x263e('0x75')]===0x0&&_0x1cea52[_0x263e('0x59')]===0x0&&_0x1cea52['waiting']===0x0&&(_0x1cea52['pTalking']||0x0)===0x0){_0x1cea52[_0x263e('0xa1')]=![];_0x1cea52['available']=0x0;_0x1cea52[_0x263e('0x40')]=_0x263e('0x44');loggerSyncQueueSummary[_0x263e('0x98')](_0x263e('0xa2'),_0x1cea52[_0x263e('0x42')],'is\x20not\x20active');}else{_0x1cea52[_0x263e('0x40')]=_0x263e('0xa3');loggerSyncQueueSummary['error'](_0x263e('0xa2'),_0x1cea52[_0x263e('0x42')],'is\x20disactive');}emitVoiceQueueSummary(_0x1cea52);}}function notSendMessagesCampaign(_0x465475){if(_0x465475[_0x263e('0xa1')]){if(_0x465475[_0x263e('0x75')]===0x0){_0x465475['sendMessageOneNotActive']=![];_0x465475[_0x263e('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x263e('0x98')](_0x263e('0xa4'),_0x465475['name'],_0x263e('0xa5'));}else{_0x465475[_0x263e('0x40')]=_0x263e('0xa3');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x465475[_0x263e('0x42')],_0x263e('0xa6'));}emitCampaignSummary(_0x465475);}}function createObjHistory(_0x3e4727,_0x552284,_0x4fe676,_0x386e80,_0x3edc48){_0x3e4727['message']=_0x4fe676;var _0x379d17=new Action(_0x3e4727,_0x552284);var _0x42fcfd=new History(_0x379d17);_0x42fcfd[_0x263e('0xa7')]=_0x386e80;_0x42fcfd[_0x263e('0xa8')]=_0x3edc48;_0x42fcfd['endtime']=_0x379d17[_0x263e('0xa9')];return _0x42fcfd;}Dialer[_0x263e('0x1b')][_0x263e('0x3c')]=function(){var _0x5cf3f8=this;setInterval(function(){_0x5cf3f8['clearZombieChannels'](_0x5cf3f8[_0x263e('0x27')],_0x263e('0xaa'));_0x5cf3f8[_0x263e('0xab')](_0x5cf3f8[_0x263e('0x25')],_0x263e('0xac'));},0x32c8);};Dialer[_0x263e('0x1b')][_0x263e('0xab')]=function(_0x58103e,_0x3c154b){var _0x5ddcd7=this;for(var _0x287f1b in _0x58103e){if(typeof _0x58103e[_0x287f1b]!==_0x263e('0x9c')){this['sequence'][_0x263e('0x1c')](function(){if(!_[_0x263e('0xad')](_0x58103e[_0x287f1b])){return ami[_0x263e('0xae')]({'action':_0x263e('0xaf'),'channel':_0x58103e[_0x287f1b][_0x263e('0xb0')]})['catch'](function(_0x55a0fb){if(_0x55a0fb[_0x263e('0x40')]===_0x263e('0xb1')){setTimeout(function(){if(_0x58103e[_0x287f1b]&&_0x58103e[_0x287f1b]['type']!==_0x263e('0x96')){_0x5ddcd7[_0x263e('0xb2')](_0x5ddcd7[_0x263e('0x1f')][_0x58103e[_0x287f1b]['queue']]);logger[_0x263e('0x98')](_0x263e('0xb3'),_0x3c154b,_0x287f1b,_0x58103e[_0x287f1b][_0x263e('0xb4')]);delete _0x58103e[_0x287f1b];}if(_0x58103e[_0x287f1b]&&_0x58103e[_0x287f1b]['type']===_0x263e('0x96')){_0x5ddcd7[_0x263e('0xb2')](_0x5ddcd7[_0x263e('0x20')][_0x58103e[_0x287f1b][_0x263e('0xb4')]]);logger[_0x263e('0x98')](_0x263e('0xb5'),_0x3c154b,_0x287f1b,_0x58103e[_0x287f1b]['queue']);delete _0x58103e[_0x287f1b];}},0x2328);}});}});}}};Dialer[_0x263e('0x1b')][_0x263e('0xb6')]=function(_0x44546d){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopper[_0x263e('0xb6')](_0x44546d))[_0x263e('0xb9')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x263e('0x1b')]['checkIsBlackList']=function(_0x3d4c2c){return BPromise[_0x263e('0xb7')]()['then'](cmHopperBlack[_0x263e('0xba')](_0x3d4c2c))[_0x263e('0xb9')](loggerCatch(_0x263e('0xbb')));};Dialer['prototype'][_0x263e('0xbc')]=function(_0x183c22){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopperBlack[_0x263e('0xbc')](_0x183c22))[_0x263e('0xb9')](loggerCatch(_0x263e('0xbd')));};Dialer[_0x263e('0x1b')][_0x263e('0xbe')]=function(_0x223115){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopperHistory['avgHandleTime'](_0x223115))[_0x263e('0xb9')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x263e('0x1b')][_0x263e('0xbf')]=function(_0x2e695f){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopper[_0x263e('0xbf')](_0x2e695f))[_0x263e('0xb9')](loggerCatch(_0x263e('0xc0')));};Dialer[_0x263e('0x1b')][_0x263e('0xc1')]=function(_0x2c1df8,_0x485480,_0x126585){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopper[_0x263e('0xc1')](_0x2c1df8,_0x485480,_0x126585))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x263e('0x1b')][_0x263e('0xc2')]=function(_0x2ff214,_0x278f67,_0x5a3c5c,_0x42dbb1,_0x371dde){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopper[_0x263e('0xc2')](_0x2ff214,_0x278f67,_0x5a3c5c,_0x42dbb1))[_0x263e('0xb9')](function(_0x435ab9){_0x371dde[_0x263e('0xc3')]-=_0x5a3c5c;_0x371dde['temp']=_0x371dde['temp']>0x0?_0x371dde[_0x263e('0xc3')]:0x0;loggerCatch(_0x263e('0xc4'))(_0x435ab9);});};Dialer['prototype'][_0x263e('0xc5')]=function(_0x468465,_0x27f2cf,_0x332943,_0x176e73){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopper[_0x263e('0xc5')](_0x468465,_0x27f2cf,_0x332943))[_0x263e('0xb9')](function(_0x2f78a9){_0x176e73[_0x263e('0xc3')]-=_0x27f2cf;_0x176e73[_0x263e('0xc3')]=_0x176e73[_0x263e('0xc3')]>0x0?_0x176e73['temp']:0x0;loggerCatch(_0x263e('0xc6'))(_0x2f78a9);});};Dialer[_0x263e('0x1b')][_0x263e('0xc7')]=function(_0xb1ae09){return BPromise[_0x263e('0xb7')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0xb1ae09))['catch'](loggerCatch(_0x263e('0xc8')));};Dialer[_0x263e('0x1b')][_0x263e('0xc9')]=function(_0x688501){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopper[_0x263e('0xc9')](_0x688501))[_0x263e('0xb9')](loggerCatch(_0x263e('0xca')));};Dialer['prototype'][_0x263e('0xcb')]=function(_0x1d9b34){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopperHistory[_0x263e('0xcb')](_0x1d9b34))[_0x263e('0xb9')](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x263e('0xb2')]=function(_0x15b019){if(!_[_0x263e('0x3f')](_0x15b019)&&_0x15b019!==null){if(typeof _0x15b019[_0x263e('0x75')]!==_0x263e('0x9c')){if(_0x15b019[_0x263e('0x75')]>0x0){_0x15b019[_0x263e('0x75')]-=0x1;}else{logger[_0x263e('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x263e('0x98')](_0x263e('0xcc'));}};Dialer[_0x263e('0x1b')]['loggerHandler']=function(_0x6bd5c1,_0x56b5dd){var _0x23d174=this;return function(_0x1839d7){_0x23d174[_0x263e('0xb2')](_0x56b5dd);logger[_0x263e('0x98')](_0x6bd5c1,util[_0x263e('0x99')](_0x1839d7,{'showHidden':![],'depth':null}));};};Dialer[_0x263e('0x1b')][_0x263e('0xcd')]=function(_0x2d04b5,_0x228db1,_0x5bdc43){var _0x3e8f64={'state':0x19,'statedesc':_0x263e('0xce')};this['updateOriginated'](_0x228db1);this[_0x263e('0xcf')](_[_0x263e('0x90')](_0x3e8f64,_[_0x263e('0xd0')](_0x5bdc43,['ContactId','ListId',_0x263e('0xd1'),'VoiceQueueId',_0x263e('0xd2')])),'[emptyContact][createHistory]',_0x263e('0xd3'));logger[_0x263e('0x98')](_0x2d04b5);};Dialer['prototype'][_0x263e('0xd4')]=function(_0x897a89){return _0x897a89==='Success';};Dialer[_0x263e('0x1b')][_0x263e('0xd5')]=function(_0x4b2715){return!_[_0x263e('0x3f')](_0x4b2715)&&_0x4b2715&&!_[_0x263e('0x3f')](_0x4b2715['name'])&&!_['isUndefined'](_0x4b2715[_0x263e('0x7a')])&&_0x4b2715[_0x263e('0x7a')]&&(this['trunks'][util[_0x263e('0x7d')](_0x263e('0xd6'),_0x4b2715[_0x263e('0x42')])][_0x263e('0xaf')]===_0x263e('0xd7')||this[_0x263e('0x22')][util[_0x263e('0x7d')](_0x263e('0xd6'),_0x4b2715['name'])][_0x263e('0xaf')]===_0x263e('0xd8'));};Dialer['prototype'][_0x263e('0xcf')]=function(_0x1a26d6,_0x2dccf3,_0x3edc19){this[_0x263e('0xcb')](_0x1a26d6)[_0x263e('0xb9')](loggerCatch(_0x2dccf3));this['moveContactManagedDialer'](_0x1a26d6)[_0x263e('0xb9')](loggerCatch(_0x3edc19));};Dialer[_0x263e('0x1b')][_0x263e('0x37')]=function(_0x3a5a0c){var _0x2e6b98=this[_0x263e('0x27')][_0x3a5a0c[_0x263e('0xd9')]];var _0x107a39;if(!_[_0x263e('0xad')](_0x3a5a0c)&&!_[_0x263e('0xad')](_0x3a5a0c[_0x263e('0xda')])&&!_['isNil'](_0x3a5a0c[_0x263e('0xda')][_0x263e('0xdb')])&&_0x3a5a0c[_0x263e('0xdc')]===_0x263e('0xdd')&&_0x2e6b98){if(_0x2e6b98[_0x263e('0x5b')]!==_0x263e('0x96')&&this[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]][_0x263e('0xde')]&&_0x3a5a0c['value']===_0x263e('0xdf')){delete this[_0x263e('0x27')][_0x3a5a0c[_0x263e('0xd9')]];this[_0x263e('0xb2')](this[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]]);this[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]][_0x263e('0xe0')]+=0x1;this[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x107a39=new Hangup(_0x2e6b98,_0x3a5a0c);_0x107a39[_0x263e('0xa7')]=0x12;_0x107a39[_0x263e('0xa8')]=_0x263e('0xe1');_0x107a39['membername']=_0x263e('0xe2');ami[_0x263e('0x50')](_0x263e('0xe3'),ut[_0x263e('0xe4')](_0x107a39,_0x263e('0xe5')));this[_0x263e('0xcf')](_0x107a39,_0x263e('0xe6'),'[syncHangupInAMD]');}if(_0x2e6b98[_0x263e('0x5b')]!==_0x263e('0x96')&&this[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]][_0x263e('0xde')]&&_0x3a5a0c[_0x263e('0xe7')]==='MACHINE'){var _0x60de17=this;return new BPromise(function(_0x2ba9e5,_0x4d4049){delete _0x60de17[_0x263e('0x27')][_0x3a5a0c[_0x263e('0xd9')]];_0x60de17['updateOriginated'](_0x60de17[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]]);_0x60de17['voiceQueues'][_0x2e6b98[_0x263e('0xb4')]][_0x263e('0xe0')]+=0x1;_0x60de17[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]][_0x263e('0xe8')]+=0x1;var _0x2cedad=_0x60de17[_0x263e('0x1f')][_0x2e6b98[_0x263e('0xb4')]];var _0x43e0a6=new Hangup(_0x2e6b98,_0x3a5a0c);_0x43e0a6[_0x263e('0xa7')]=0x13;_0x43e0a6[_0x263e('0xa8')]=_0x263e('0xe9');_0x43e0a6[_0x263e('0xea')]=_0x263e('0xe2');_0x43e0a6[_0x263e('0xeb')]+=0x1;_0x43e0a6[_0x263e('0xec')]+=0x1;_0x43e0a6[_0x263e('0xe5')]=!![];ami[_0x263e('0x50')](_0x263e('0xe3'),ut[_0x263e('0xe4')](_0x43e0a6,_0x263e('0xe5')));_0x60de17['createHistory'](_0x43e0a6)[_0x263e('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x43e0a6[_0x263e('0xed')]+_0x43e0a6[_0x263e('0xee')]+_0x43e0a6[_0x263e('0xef')]+_0x43e0a6[_0x263e('0xf0')]+_0x43e0a6['countdropretry']+_0x43e0a6[_0x263e('0xf1')]+_0x43e0a6[_0x263e('0xeb')]+_0x43e0a6['countagentrejectretry']>=_0x2cedad['dialGlobalMaxRetry']){_0x60de17['stateGlobal'](_0x43e0a6,_0x2ba9e5,_0x4d4049,_0x263e('0xf2'));}else{if(_0x43e0a6[_0x263e('0xeb')]>=_0x2cedad['dialMachineMaxRetry']){_0x60de17[_0x263e('0xf3')](_0x43e0a6,_0x2ba9e5,_0x4d4049,_0x263e('0xf4'));}else{_0x60de17[_0x263e('0xbf')]({'active':![],'countmachineretry':_0x43e0a6['countmachineretry'],'scheduledat':moment()['add'](_0x2cedad[_0x263e('0xf5')],_0x263e('0xf6'))[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x43e0a6[_0x263e('0xf8')],'ListId':_0x43e0a6['ListId'],'VoiceQueueId':_0x43e0a6[_0x263e('0xf9')]||undefined,'CampaignId':_0x43e0a6[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0xfa')));_0x2ba9e5({'reschedule':0x1});}}});}if(_0x2e6b98[_0x263e('0x5b')]===_0x263e('0x96')&&this[_0x263e('0x20')][_0x2e6b98[_0x263e('0xb4')]][_0x263e('0xde')]&&_0x3a5a0c[_0x263e('0xe7')]===_0x263e('0xdf')){delete this[_0x263e('0x27')][_0x3a5a0c[_0x263e('0xd9')]];this[_0x263e('0xb2')](this['campaigns'][_0x2e6b98[_0x263e('0xb4')]]);_0x107a39=new Hangup(_0x2e6b98,_0x3a5a0c);_0x107a39[_0x263e('0xa7')]=0x12;_0x107a39[_0x263e('0xa8')]='HangupInAMD';_0x107a39['membername']='AMD';ami['emit']('custom:amd',ut[_0x263e('0xe4')](_0x107a39,_0x263e('0xe5')));this[_0x263e('0xcf')](_0x107a39,_0x263e('0xfb'),_0x263e('0xfc'));}if(_0x2e6b98[_0x263e('0x5b')]===_0x263e('0x96')&&this['campaigns'][_0x2e6b98['queue']][_0x263e('0xde')]&&_0x3a5a0c['value']==='MACHINE'){var _0x60de17=this;return new BPromise(function(_0x308d25,_0x508ff8){delete _0x60de17[_0x263e('0x27')][_0x3a5a0c['uniqueid']];_0x60de17[_0x263e('0xb2')](_0x60de17[_0x263e('0x20')][_0x2e6b98[_0x263e('0xb4')]]);_0x60de17[_0x263e('0x20')][_0x2e6b98[_0x263e('0xb4')]][_0x263e('0xe0')]+=0x1;_0x60de17[_0x263e('0x20')][_0x2e6b98['queue']][_0x263e('0xe8')]+=0x1;var _0x31f5bb=_0x60de17['campaigns'][_0x2e6b98['queue']];var _0x1b4c9a=new Hangup(_0x2e6b98,_0x3a5a0c);_0x1b4c9a['state']=0x13;_0x1b4c9a[_0x263e('0xa8')]=_0x263e('0xe9');_0x1b4c9a[_0x263e('0xea')]='AMD';_0x1b4c9a[_0x263e('0xeb')]+=0x1;_0x1b4c9a[_0x263e('0xec')]+=0x1;_0x1b4c9a[_0x263e('0xe5')]=!![];ami[_0x263e('0x50')](_0x263e('0xe3'),ut[_0x263e('0xe4')](_0x1b4c9a,_0x263e('0xe5')));_0x60de17[_0x263e('0xcb')](_0x1b4c9a)[_0x263e('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1b4c9a[_0x263e('0xed')]+_0x1b4c9a['countcongestionretry']+_0x1b4c9a[_0x263e('0xef')]+_0x1b4c9a[_0x263e('0xf0')]+_0x1b4c9a['countdropretry']+_0x1b4c9a[_0x263e('0xf1')]+_0x1b4c9a[_0x263e('0xeb')]+_0x1b4c9a['countagentrejectretry']>=_0x31f5bb[_0x263e('0xfd')]){_0x60de17[_0x263e('0xfe')](_0x1b4c9a,_0x308d25,_0x508ff8,'reason19\x20machine....');}else{if(_0x1b4c9a[_0x263e('0xeb')]>=_0x31f5bb[_0x263e('0xff')]){_0x60de17[_0x263e('0xf3')](_0x1b4c9a,_0x308d25,_0x508ff8,'reason\x2019\x20machine....');}else{_0x60de17[_0x263e('0xbf')]({'active':![],'countmachineretry':_0x1b4c9a[_0x263e('0xeb')],'scheduledat':moment()[_0x263e('0x100')](_0x31f5bb[_0x263e('0xf5')],_0x263e('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b4c9a[_0x263e('0xf8')],'ListId':_0x1b4c9a[_0x263e('0x101')],'VoiceQueueId':_0x1b4c9a[_0x263e('0xf9')]||undefined,'CampaignId':_0x1b4c9a[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x308d25({'reschedule':0x1});}}});}}};Dialer[_0x263e('0x1b')]['syncHangup']=function(_0x43d1ea){var _0x4ae987=this[_0x263e('0x27')][_0x43d1ea['uniqueid']];var _0x33220c=this;var _0x831db2;if(_0x4ae987&&_0x4ae987[_0x263e('0x5b')]===_0x263e('0x96')){delete this[_0x263e('0x27')][_0x43d1ea[_0x263e('0xd9')]];this['updateOriginated'](this[_0x263e('0x20')][_0x4ae987['queue']]);this[_0x263e('0x20')][_0x4ae987[_0x263e('0xb4')]]['ivrAnswerCallsDay']+=0x1;_0x831db2=new Hangup(_0x4ae987,_0x43d1ea);this[_0x263e('0xcb')](_0x831db2)[_0x263e('0xb9')](loggerCatch(_0x263e('0x102')));this[_0x263e('0xc9')](_0x831db2)[_0x263e('0xb9')](loggerCatch(_0x263e('0x103')));}if(_0x4ae987&&_0x4ae987[_0x263e('0x5b')]!==_0x263e('0x96')&&isNotNull(this[_0x263e('0x1f')][_0x4ae987[_0x263e('0xb4')]][_0x263e('0x104')])){delete this['uniqueId'][_0x43d1ea[_0x263e('0xd9')]];this[_0x263e('0xb2')](this[_0x263e('0x1f')][_0x4ae987['queue']]);this[_0x263e('0x1f')][_0x4ae987['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x263e('0x1f')][_0x4ae987[_0x263e('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x831db2=new Hangup(_0x4ae987,_0x43d1ea);_0x831db2['state']=0x10;_0x831db2[_0x263e('0xa8')]='AnswerAGI';_0x831db2[_0x263e('0xea')]=_0x263e('0x105');this[_0x263e('0xcb')](_0x831db2)[_0x263e('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x263e('0xc9')](_0x831db2)[_0x263e('0xb9')](loggerCatch(_0x263e('0x103')));}if(_0x4ae987&&_0x4ae987[_0x263e('0x5b')]!==_0x263e('0x96')&&!isNotNull(this[_0x263e('0x1f')][_0x4ae987[_0x263e('0xb4')]]['dialQueueProject'])){delete this[_0x263e('0x27')][_0x43d1ea[_0x263e('0xd9')]];this[_0x263e('0xb2')](this[_0x263e('0x1f')][_0x4ae987[_0x263e('0xb4')]]);this[_0x263e('0x1f')][_0x4ae987['queue']][_0x263e('0x6c')]+=0x1;_0x831db2=new Hangup(_0x4ae987,_0x43d1ea);_0x831db2[_0x263e('0xa7')]=0xc;_0x831db2[_0x263e('0xa8')]=_0x43d1ea[_0x263e('0x106')];_0x831db2['membername']=_0x263e('0x107');this[_0x263e('0xcb')](_0x831db2)['catch'](loggerCatch(_0x263e('0x102')));this['moveContactManagedDialer'](_0x831db2)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x3a8bc9){var _0xa5c83c=this['uniqueId'][_0x3a8bc9['uniqueid']];var _0x723878=this;if(this['voiceQueues'][_0x3a8bc9[_0x263e('0xb4')]]){if(_0xa5c83c&&_0xa5c83c[_0x263e('0x5b')]!=='ivr'){delete this['uniqueId'][_0x3a8bc9[_0x263e('0xd9')]];this[_0x263e('0x1f')][_0x3a8bc9[_0x263e('0xb4')]][_0x263e('0xe0')]+=0x1;var _0x3bbf62=new AgentComplete(_0xa5c83c,_0x3a8bc9);if(_0x3a8bc9[_0x263e('0x108')]==='agent'){_0x3bbf62[_0x263e('0x109')]=this[_0x263e('0x1f')][_0x3a8bc9[_0x263e('0xb4')]][_0x263e('0x10a')]&&this[_0x263e('0x1f')][_0x3a8bc9[_0x263e('0xb4')]][_0x263e('0x10b')]?moment()[_0x263e('0x7d')](_0x263e('0xf7')):undefined;}this[_0x263e('0xcb')](_0x3bbf62)[_0x263e('0xb9')](loggerCatch(_0x263e('0x10c')));this[_0x263e('0xc9')](_0x3bbf62)[_0x263e('0xb9')](loggerCatch(_0x263e('0x10d')));}}};Dialer[_0x263e('0x1b')][_0x263e('0x2d')]=function(_0x534f3a){if(this[_0x263e('0x1f')][_0x534f3a[_0x263e('0xb4')]]){if(this[_0x263e('0x27')][_0x534f3a[_0x263e('0xd9')]]&&this['uniqueId'][_0x534f3a[_0x263e('0xd9')]][_0x263e('0x5b')]!==_0x263e('0x96')){this['updateOriginated'](this[_0x263e('0x1f')][_0x534f3a[_0x263e('0xb4')]]);this['uniqueId'][_0x534f3a[_0x263e('0xd9')]]['answertime']=moment()[_0x263e('0x7d')](_0x263e('0xf7'));}}};Dialer['prototype'][_0x263e('0x10e')]=function(_0x4f71a9){this[_0x263e('0xcb')](_0x4f71a9)['catch'](loggerCatch(_0x263e('0x10c')));this['moveContactManagedDialer'](_0x4f71a9)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x263e('0x10f')]=function(_0x560699){var _0x1de34d=this[_0x263e('0x27')][_0x560699[_0x263e('0xd9')]];var _0xd6d7b5=this;if(this[_0x263e('0x1f')][_0x560699[_0x263e('0xb4')]]){if(_0x1de34d&&_0x1de34d[_0x263e('0x5b')]!==_0x263e('0x96')){delete this[_0x263e('0x27')][_0x560699['uniqueid']];this[_0x263e('0xb2')](this[_0x263e('0x1f')][_0x560699[_0x263e('0xb4')]]);_0x1de34d['droptime']=moment()[_0x263e('0x7d')](_0x263e('0xf7'));var _0x4d49f3=new QueueCallerAbandon(_0x1de34d,_0x560699);if(getSeconds(_0x1de34d[_0x263e('0x110')],_0x1de34d[_0x263e('0x111')])>=_0x1de34d['dialQueueTimeout']){this[_0x263e('0x1f')][_0x560699[_0x263e('0xb4')]][_0x263e('0x71')]+=0x1;this[_0x263e('0x1f')][_0x560699[_0x263e('0xb4')]][_0x263e('0x66')]+=0x1;this['voiceQueues'][_0x560699[_0x263e('0xb4')]][_0x263e('0x112')]+=0x1;_0x4d49f3[_0x263e('0xa7')]=0xa;_0x4d49f3[_0x263e('0xa8')]=_0x263e('0x113');_0x4d49f3[_0x263e('0x114')]=_0x263e('0x115');_0x4d49f3['agiafterat']=this['voiceQueues'][_0x560699[_0x263e('0xb4')]][_0x263e('0x10a')]?moment()[_0x263e('0x7d')](_0x263e('0xf7')):undefined;_0x4d49f3[_0x263e('0x116')]+=0x1;_0x4d49f3[_0x263e('0xec')]+=0x1;if(_0x4d49f3[_0x263e('0x116')]>=this['voiceQueues'][_0x560699[_0x263e('0xb4')]][_0x263e('0x117')]){this['queueCallerAbandonCreateState'](_0x4d49f3);}else{this[_0x263e('0xbf')]({'active':![],'countdropretry':_0x4d49f3[_0x263e('0x116')],'scheduledat':moment()[_0x263e('0x100')](this[_0x263e('0x1f')][_0x560699[_0x263e('0xb4')]][_0x263e('0x118')],_0x263e('0xf6'))[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x1de34d[_0x263e('0xf8')],'ListId':_0x1de34d[_0x263e('0x101')],'VoiceQueueId':_0x1de34d[_0x263e('0xf9')]||undefined,'CampaignId':_0x1de34d[_0x263e('0xd2')]||undefined})['catch'](loggerCatch(_0x263e('0x119')));var _0x51b014=new History(_0x4d49f3);_0x51b014[_0x263e('0xa7')]=0xa;_0x51b014['statedesc']=_0x263e('0x113');_0x51b014[_0x263e('0xa9')]=moment()['format'](_0x263e('0xf7'));_0x51b014['endtime']=_0x51b014[_0x263e('0xa9')];_0x51b014[_0x263e('0x11a')]=_0x4d49f3[_0x263e('0x11a')];_0x51b014[_0x263e('0x11b')]=_0x4d49f3[_0x263e('0x11b')];this[_0x263e('0xcb')](_0x51b014)[_0x263e('0xb9')](loggerCatch(_0x263e('0x11c')));}}else{this['voiceQueues'][_0x560699[_0x263e('0xb4')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x263e('0x1f')][_0x560699['queue']][_0x263e('0x65')]+=0x1;_0x4d49f3['state']=0xb;_0x4d49f3[_0x263e('0xa8')]=_0x263e('0x11d');_0x4d49f3[_0x263e('0x114')]=_0x263e('0x11e');_0x4d49f3[_0x263e('0xf1')]+=0x1;_0x4d49f3[_0x263e('0xec')]+=0x1;if(_0x4d49f3[_0x263e('0xf1')]>=this[_0x263e('0x1f')][_0x560699[_0x263e('0xb4')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x4d49f3);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x4d49f3[_0x263e('0xf1')],'scheduledat':moment()[_0x263e('0x100')](this[_0x263e('0x1f')][_0x560699[_0x263e('0xb4')]][_0x263e('0x11f')],_0x263e('0xf6'))[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x1de34d[_0x263e('0xf8')],'ListId':_0x1de34d[_0x263e('0x101')],'VoiceQueueId':_0x1de34d[_0x263e('0xf9')]||undefined,'CampaignId':_0x1de34d[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x120')));var _0x51b014=new History(_0x4d49f3);_0x51b014[_0x263e('0xa7')]=0xb;_0x51b014[_0x263e('0xa8')]=_0x263e('0x11d');_0x51b014[_0x263e('0xa9')]=moment()[_0x263e('0x7d')](_0x263e('0xf7'));_0x51b014['endtime']=_0x51b014[_0x263e('0xa9')];_0x51b014['calleridname']=_0x4d49f3['calleridname'];_0x51b014[_0x263e('0x11b')]=_0x4d49f3[_0x263e('0x11b')];this[_0x263e('0xcb')](_0x51b014)[_0x263e('0xb9')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x263e('0x1b')][_0x263e('0x35')]=function(_0x1e8b01){if(this[_0x263e('0x25')][_0x1e8b01[_0x263e('0xd9')]]){this[_0x263e('0x25')][_0x1e8b01['uniqueid']]['channel']=_0x1e8b01['channel'];}if(this[_0x263e('0x27')][_0x1e8b01[_0x263e('0xd9')]]){this[_0x263e('0x27')][_0x1e8b01[_0x263e('0xd9')]][_0x263e('0xb0')]=_0x1e8b01['channel'];}};Dialer['prototype']['syncQueueMember']=function(_0x3f591d){if(strategy[this['voiceQueues'][this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]][_0x263e('0xb4')]][_0x263e('0x52')]]===_0x263e('0x122')){if(this['actions'][_0x3f591d[_0x263e('0x121')]]&&_[_0x263e('0xad')](this['actions'][_0x3f591d['actionid']][_0x263e('0x123')])&&_0x3f591d[_0x263e('0xaf')]==='1'&&_0x3f591d[_0x263e('0x124')]==='0'){if(this[_0x263e('0x21')][_0x3f591d[_0x263e('0x125')]]){if(!this['agents'][_0x3f591d[_0x263e('0x125')]]['locked']){this[_0x263e('0x21')][_0x3f591d[_0x263e('0x125')]][_0x263e('0x123')]=!![];this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]]['locked']=!![];this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]][_0x263e('0x125')]=_0x3f591d[_0x263e('0x125')];}}}}else if((strategy[this[_0x263e('0x1f')][this['actions'][_0x3f591d[_0x263e('0x121')]]['queue']][_0x263e('0x52')]]||_0x263e('0x1a'))===_0x263e('0x1a')){if(this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]]){if(this['agents'][_0x3f591d[_0x263e('0x125')]]){this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]][_0x263e('0x125')]=_0x3f591d[_0x263e('0x125')];if(_[_0x263e('0xad')](this[_0x263e('0x2b')][this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]][_0x263e('0xb4')]])){this[_0x263e('0x2b')][this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]][_0x263e('0xb4')]]=[];}this[_0x263e('0x2b')][this[_0x263e('0x25')][_0x3f591d['actionid']][_0x263e('0xb4')]][_0x263e('0x126')](_[_0x263e('0x90')](_[_0x263e('0xd0')](this[_0x263e('0x25')][_0x3f591d[_0x263e('0x121')]],[_0x263e('0x127'),_0x263e('0x125')]),{'status':_0x3f591d[_0x263e('0xaf')],'paused':_0x3f591d[_0x263e('0x124')]}));}}}};function unlockQueueStatus(_0x2806b2,_0x22c436){setTimeout(function(){if(_[_0x263e('0x3f')](_0x2806b2[_0x263e('0x128')])){loggerBooked[_0x263e('0x98')]('[unlockQueueStatus][undefined]',_0x22c436);}_0x2806b2[_0x263e('0x128')]=!![];loggerBooked[_0x263e('0x7e')](_0x263e('0x129'),_0x22c436,JSON['stringify'](_[_0x263e('0xd0')](_0x2806b2,['name','queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0x263e('0x12a')]=function(_0x243428){var _0xb4cc4f=this;var _0x4844ba=_0xb4cc4f['voiceQueues'][_0xb4cc4f[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]];if(strategy[this[_0x263e('0x1f')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]][_0x263e('0x52')]]==='roundrobin'){if(this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]]&&this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0x125')]){this['preview'][_0x263e('0x12b')](this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0x127')],this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0x125')])[_0x263e('0xb9')](function(_0x31daa5){logger[_0x263e('0x98')](_0x263e('0x12c'),util['inspect'](_0x31daa5,{'showHidden':![],'depth':null}));})[_0x263e('0x12d')](function(){_0xb4cc4f[_0x263e('0xb2')](_0xb4cc4f[_0x263e('0x1f')][_0xb4cc4f[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]]);_0xb4cc4f[_0x263e('0x21')][_0xb4cc4f['actions'][_0x243428[_0x263e('0x121')]][_0x263e('0x125')]][_0x263e('0x123')]=![];delete _0xb4cc4f['actions'][_0x243428[_0x263e('0x121')]];unlockQueueStatus(_0x4844ba);});}else{this['updateOriginated'](this[_0x263e('0x1f')][this['actions'][_0x243428['actionid']][_0x263e('0xb4')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x243428['actionid']]['ContactId'],'ListId':this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0x101')],'VoiceQueueId':this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x243428[_0x263e('0x121')]][_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]];unlockQueueStatus(_0x4844ba);}}else if((strategy[this[_0x263e('0x1f')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]][_0x263e('0x52')]]||'rrmemory')===_0x263e('0x1a')){var _0x24819f;if(this['actions'][_0x243428[_0x263e('0x121')]]&&!_[_0x263e('0x4a')](this[_0x263e('0x2b')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]]['queue']])){if(this[_0x263e('0x12e')][_0xb4cc4f[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]]){this[_0x263e('0x12e')][_0xb4cc4f['actions'][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]]=this[_0x263e('0x12e')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]]?this[_0x263e('0x12e')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]]['queue']]:this[_0x263e('0x2b')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]]?this[_0x263e('0x2b')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]][_0x263e('0x12f')]||0x0:0x0;}this['queueBooked'][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]][_0x263e('0xb4')]][_0x263e('0x12f')]=this[_0x263e('0x12e')][this[_0x263e('0x25')][_0x243428[_0x263e('0x121')]]['queue']];for(var _0x58e87a=0x0;_0x58e87a=0x0;})[_0x263e('0xb9')](myreject(_0x2f3c21)));}}else{_0x4e6476[_0x263e('0x126')](ami[_0x263e('0xae')]({'action':_0x263e('0x14b'),'command':util[_0x263e('0x7d')](_0x263e('0x146'),_0x293517,!_[_0x263e('0x3f')](config[_0x263e('0x148')][_0x4cee91])?_0x4cee91:'')})['then'](function(_0x5a64b5){return _0x5a64b5[_0x263e('0x14c')]['indexOf'](_0x263e('0x14a'))>=0x0;})['catch'](myreject(_0x2f3c21)));}BPromise[_0x263e('0x14d')](_0x4e6476)[_0x263e('0xb8')](function(_0x5a9c97){var _0x25422a=_[_0x263e('0x14e')](_0x5a9c97);if(_0x25422a){return _0x1bb08c(_0x25422a);}else{_0xd5dc2f[_0x263e('0x40')]=_0x521ad0?'GLOBAL_INTERVAL_IS_OVERTIME':_0x263e('0x14f');return _0x2f3c21(msgResponse(_0x263e('0x150'),'Failure','Global:\x20'+_0x521ad0+'\x20'+_0x1e74e8+_0x263e('0x151')+util['inspect'](_0x293517,{'showHidden':![],'depth':null})+_0x263e('0x152')+_0x4cee91));}})[_0x263e('0xb9')](function(_0xb6fcb2){return _0x2f3c21(msgResponse('ifTime',_0x263e('0x140'),JSON[_0x263e('0x4d')](_0xb6fcb2)));});});};Dialer[_0x263e('0x1b')][_0x263e('0x153')]=function(_0x5ac693){var _0x173b70=this;return function(){switch(_0x5ac693['dialMethod']){case _0x263e('0x154'):freeVariablesPredictive(_0x5ac693);_0x173b70[_0x263e('0x155')](_0x5ac693,0x1);break;case'power':freeVariablesPredictive(_0x5ac693);_0x173b70['handlePower'](_0x5ac693,_0x5ac693[_0x263e('0x156')]);break;case'predictive':_0x173b70[_0x263e('0x8')](_0x5ac693);break;case _0x263e('0x7'):freeVariablesPredictive(_0x5ac693);_0x173b70['handlePower'](_0x5ac693,0x1);break;default:freeVariablesPredictive(_0x5ac693);logger[_0x263e('0x98')](_0x263e('0x157'),_0x5ac693[_0x263e('0x42')],_0x263e('0x158'));}};};Dialer['prototype'][_0x263e('0x159')]=function(_0x227493){return BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](cmHopper['handlePreviewRecallNotifications'](_0x227493['id'],previewRecallmeReminderInterval))[_0x263e('0xb8')](function(_0x2d2a67){for(var _0x3e796a=0x0;_0x3e796a<_0x2d2a67[_0x263e('0x9b')];_0x3e796a++){var _0x575923=_0x2d2a67[_0x3e796a][_0x263e('0x15a')]['name'];if(_0x575923)io['to'](util[_0x263e('0x7d')](_0x263e('0x15b'),_0x575923))['emit'](_0x263e('0x15c'),{'hopper':_0x2d2a67[_0x3e796a]});}})['catch'](function(_0x154f42){});};Dialer['prototype']['launchHandleIvr']=function(_0x336c20){var _0xbc472b=this;return function(){_0xbc472b['handleIvr'](_0x336c20);};};Dialer[_0x263e('0x1b')][_0x263e('0xa')]=function(_0xe6f841){var _0x4c2dfd=this;if(isNotPreview(_0xe6f841[_0x263e('0x60')])){if(isVoiceQueueOutbound(_0xe6f841['type'])&&isActive(_0xe6f841[_0x263e('0x5f')])){_0xe6f841[_0x263e('0xa1')]=!![];BPromise['resolve']()[_0x263e('0xb8')](checkIsLoggedIn(_0xe6f841,_0xe6f841[_0x263e('0x54')]))['then'](checkIsActive(_0xe6f841,_0xe6f841[_0x263e('0x5f')]))[_0x263e('0xb8')](checkInterval(_0xe6f841))[_0x263e('0xb8')](_0x4c2dfd[_0x263e('0x13a')](_0xe6f841))['then'](_0x4c2dfd[_0x263e('0x13d')](_0xe6f841[_0x263e('0x15d')],_0xe6f841['dialTimezone'],_0xe6f841[_0x263e('0x42')],_0xe6f841))[_0x263e('0xb8')](_0x4c2dfd[_0x263e('0x13f')](_0xe6f841[_0x263e('0x46')],_0xe6f841[_0x263e('0x15e')],_0xe6f841[_0x263e('0x42')],_0xe6f841))['then'](_0x4c2dfd[_0x263e('0x153')](_0xe6f841))[_0x263e('0xb9')](loggerCatchQueueSummary(_0x263e('0x15f'),_0xe6f841));}else{notSendMessagesQueue(_0xe6f841);}}else{freeVariablesPredictive(_0xe6f841);if(_0xe6f841['dialPreviewRecallmeReminder']){_0x4c2dfd[_0x263e('0x159')](_0xe6f841);}}};Dialer[_0x263e('0x1b')][_0x263e('0x139')]=function(){var _0x5f1882=this;var _0x435a4a;for(var _0x48cc20 in this[_0x263e('0x20')]){if(typeof this[_0x263e('0x20')][_0x48cc20]!==_0x263e('0x9c')){_0x435a4a=this[_0x263e('0x20')][_0x48cc20];if(isCampaignIvr(_0x435a4a[_0x263e('0x5b')])&&isActive(_0x435a4a[_0x263e('0x7a')])){_0x435a4a[_0x263e('0xa1')]=!![];BPromise[_0x263e('0xb7')]()[_0x263e('0xb8')](checkIsActive(_0x435a4a,_0x435a4a['active']))[_0x263e('0xb8')](checkInterval(_0x435a4a))[_0x263e('0xb8')](_0x5f1882[_0x263e('0x13a')](_0x435a4a))[_0x263e('0xb8')](_0x5f1882[_0x263e('0x13d')](_0x435a4a[_0x263e('0x15d')],_0x435a4a[_0x263e('0x15e')],_0x435a4a[_0x263e('0x42')],_0x435a4a))[_0x263e('0xb8')](_0x5f1882['checkIfTimeIntervals'](_0x435a4a[_0x263e('0x46')],_0x435a4a[_0x263e('0x15e')],_0x435a4a['name'],_0x435a4a))[_0x263e('0xb8')](_0x5f1882[_0x263e('0x160')](_0x435a4a))[_0x263e('0xb9')](loggerCatchQueueSummary('[syncCampaigns]',_0x435a4a));}else{notSendMessagesCampaign(_0x435a4a);}}}};function getCallerIdRandom(_0x10476d,_0x1abd30){var _0x4bcea7;var _0x1d73a3;var _0x1b37ee;if(_0x1abd30<=0x0){_0x1abd30=0x1;}_0x4bcea7=new RegExp(_0x263e('0x161')+_0x1abd30+'}$');_0x1d73a3=Math[_0x263e('0x162')](0xa,_0x1abd30-0x1);_0x1b37ee=Math[_0x263e('0x162')](0xa,_0x1abd30)-0x1;return util[_0x263e('0x7d')]('%s',_[_0x263e('0x163')](_0x10476d,_0x4bcea7,_[_0x263e('0x164')](_0x1d73a3,_0x1b37ee)));}function extractCalleridName(_0x2af8d7){var _0x2e4214=_0x2af8d7[_0x263e('0x165')](/"(.*?)"/);return _0x2e4214?_0x2e4214[0x1]:_0x2af8d7;}function extractCalleridNumber(_0x1229c4){var _0x53e539=_0x1229c4[_0x263e('0x165')](/<(.*?)>/);return _0x53e539?_0x53e539[0x1]:_0x1229c4;}Dialer[_0x263e('0x1b')]['actionOriginate']=function(_0x4bd0d7,_0x5c3416){var _0x4e85d2=this;var _0x5d0564=uuid['v4']();this['actions'][_0x5d0564]=new Action(_0x4bd0d7,_0x5c3416,_0x5d0564);return new BPromise(function(_0x1f1b52,_0xec745){if(_[_0x263e('0x3f')](_0x4bd0d7)&&typeof _0x4bd0d7!==_0x263e('0x166')){return _0xec745(msgResponse(_0x263e('0x167'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x263e('0x3f')](_0x5c3416[_0x263e('0x168')][_0x263e('0x169')])||_0x5c3416['Contact'][_0x263e('0x169')]===null){return _0xec745(msgResponse(_0x263e('0x167'),_0x263e('0x140'),_0x263e('0x16a')));}var _0x53f640={'XMD-CALLERID':_0x4e85d2[_0x263e('0x25')][_0x5d0564][_0x263e('0x16b')](),'XMD-AGI':_0x4bd0d7[_0x263e('0x104')]?util[_0x263e('0x7d')](_0x263e('0x16c'),ipAgi,_0x4bd0d7[_0x263e('0x104')]):_0x263e('0x16d'),'XMD-AGIAFTER':_0x4bd0d7[_0x263e('0x10a')]?util['format'](_0x263e('0x16c'),ipAgi,_0x4bd0d7[_0x263e('0x10a')]):'NONE','XMD-QUEUE':_0x4bd0d7[_0x263e('0x5b')]===_0x263e('0x51')?util[_0x263e('0x7d')]('\x22%s,%s%s,,,%s\x22',_0x4bd0d7[_0x263e('0x42')],_0x4bd0d7[_0x263e('0x16e')]||'',_0x4bd0d7[_0x263e('0x10b')]?'c':'',_0x4bd0d7[_0x263e('0x16f')]||0x3):_0x263e('0x16d'),'XMD-CONTACTID':_0x5c3416['ContactId'],'XMD-CDRTYPE':_0x263e('0x6'),'CALLERID(all)':_0x4e85d2[_0x263e('0x25')][_0x5d0564][_0x263e('0x16b')](),'XMD-AMD':_0x4bd0d7[_0x263e('0xde')]?_0x263e('0x170'):_0x263e('0x16d'),'XMD-DESTINATION':_0x263e('0xdd')};if(_0x4bd0d7[_0x263e('0xde')]){_0x53f640['XMD-AMDINITIALSILENCE']=_0x4bd0d7['dialAMDInitialSilence']||0x9c4;_0x53f640[_0x263e('0x171')]=_0x4bd0d7[_0x263e('0x172')]||0x5dc;_0x53f640[_0x263e('0x173')]=_0x4bd0d7[_0x263e('0x174')]||0x320;_0x53f640[_0x263e('0x175')]=_0x4bd0d7['dialAMDTotalAnalysisTime']||0x1388;_0x53f640[_0x263e('0x176')]=_0x4bd0d7[_0x263e('0x177')]||0x64;_0x53f640[_0x263e('0x178')]=_0x4bd0d7[_0x263e('0x179')]||0x32;_0x53f640['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4bd0d7[_0x263e('0x17a')]||0x3;_0x53f640[_0x263e('0x17b')]=_0x4bd0d7[_0x263e('0x17c')]||0x100;_0x53f640['XMD-AMDMAXIMUMWORDLENGTH']=_0x4bd0d7[_0x263e('0x17d')]||0x1388;}if(_0x4bd0d7[_0x263e('0x5b')]===_0x263e('0x51')){_0x53f640[_0x263e('0x17e')]=_0x5c3416[_0x263e('0xf9')];}else{_0x53f640[_0x263e('0x17f')]=_0x5c3416['CampaignId'];}for(var _0x195f22 in _0x5c3416['Contact']){if(typeof _0x5c3416[_0x263e('0x168')][_0x195f22]!=='undefined'){if(isNotNull(_0x5c3416[_0x263e('0x168')][_0x195f22])&&_0x195f22!=='id'&&_0x195f22!==_0x263e('0x180')&&_0x195f22!=='createdAt'&&_0x195f22!==_0x263e('0x181')){_0x53f640[util[_0x263e('0x7d')](_0x263e('0x182'),_0x263e('0x183'),_[_0x263e('0x184')](_0x195f22))]=_0x5c3416['Contact'][_0x195f22];}}}var _0x51140c=_0x4e85d2[_0x263e('0xd5')](_0x4bd0d7[_0x263e('0x79')])?getCallerId(_0x4bd0d7['Trunk'][_0x263e('0x185')],_0x4bd0d7[_0x263e('0x61')],_0x4bd0d7[_0x263e('0x186')]>0x0?getCallerIdRandom(_0x4bd0d7[_0x263e('0x187')],_0x4bd0d7['dialRandomLastDigitCallerIdNumber']):_0x4bd0d7[_0x263e('0x187')]):getCallerId(_[_0x263e('0xad')](_0x4bd0d7[_0x263e('0x188')])?_0x4bd0d7[_0x263e('0x79')]['callerid']:_0x4bd0d7[_0x263e('0x188')][_0x263e('0x185')],_0x4bd0d7[_0x263e('0x61')],_0x4bd0d7[_0x263e('0x186')]>0x0?getCallerIdRandom(_0x4bd0d7[_0x263e('0x187')],_0x4bd0d7[_0x263e('0x186')]):_0x4bd0d7[_0x263e('0x187')]);if(_0x51140c){_0x53f640[_0x263e('0x189')]=_0x4e85d2[_0x263e('0x25')][_0x5d0564][_0x263e('0x18a')]=extractCalleridName(_0x51140c);_0x53f640[_0x263e('0x18b')]=_0x4e85d2[_0x263e('0x25')][_0x5d0564]['originatecalleridnum']=extractCalleridNumber(_0x51140c);}return ami[_0x263e('0xae')]({'actionid':_0x5d0564,'action':_0x263e('0x167'),'channel':_0x4e85d2[_0x263e('0xd5')](_0x4bd0d7[_0x263e('0x79')])?util[_0x263e('0x7d')](_0x263e('0x18c'),_0x4bd0d7[_0x263e('0x79')][_0x263e('0x42')],isNotNull(_0x4bd0d7['dialPrefix'])?_0x4bd0d7['dialPrefix'][_0x263e('0x18d')]()||'':'',_0x4bd0d7[_0x263e('0x18e')]>0x0?_0x5c3416['Contact']['phone']['substring'](_0x4bd0d7[_0x263e('0x18e')]):_0x5c3416[_0x263e('0x168')][_0x263e('0x169')]):util[_0x263e('0x7d')](_0x263e('0x18c'),_[_0x263e('0xad')](_0x4bd0d7[_0x263e('0x188')])?_0x4bd0d7[_0x263e('0x79')][_0x263e('0x42')]:_0x4bd0d7[_0x263e('0x188')][_0x263e('0x42')],isNotNull(_0x4bd0d7[_0x263e('0x18f')])?_0x4bd0d7[_0x263e('0x18f')][_0x263e('0x18d')]()||'':'',_0x4bd0d7[_0x263e('0x18e')]>0x0?_0x5c3416[_0x263e('0x168')]['phone'][_0x263e('0x190')](_0x4bd0d7['dialCutDigit']):_0x5c3416[_0x263e('0x168')][_0x263e('0x169')]),'callerid':_0x51140c,'Exten':_0x263e('0xdd'),'Context':_0x263e('0x191'),'Priority':'1','variable':_0x53f640,'timeout':(_0x4bd0d7[_0x263e('0x192')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5d0564})[_0x263e('0xb8')](function(_0x192aaf){return _0x1f1b52(_0x192aaf);})[_0x263e('0xb9')](function(_0xe51c2f){_0x4bd0d7[_0x263e('0x69')]+=0x1;var _0xa46453=new History(_0x4e85d2[_0x263e('0x25')][_0x5d0564]);logger['error'](util[_0x263e('0x7d')](_0x263e('0x193'),JSON[_0x263e('0x4d')](_0xe51c2f)));_0xa46453['state']=0xe;_0xa46453['statedesc']=_0x263e('0x194');_0xa46453[_0x263e('0xa9')]=moment()['format'](_0x263e('0xf7'));_0xa46453[_0x263e('0x195')]=_0xa46453[_0x263e('0xa9')];_0x4e85d2[_0x263e('0xcb')](_0xa46453)[_0x263e('0xb9')](loggerCatch(_0x263e('0x196')));_0x4e85d2[_0x263e('0xc9')](_0xa46453)[_0x263e('0xb9')](loggerCatch(_0x263e('0x196')))[_0x263e('0x12d')](function(){delete _0x4e85d2['actions'][_0x5d0564];return _0xec745(msgResponse('originate',_0x263e('0x4c'),'originate\x20action\x20Error'));});});});};Dialer[_0x263e('0x1b')]['syncOriginateResponse']=function(_0x6693a5){var _0x352c0d=this[_0x263e('0x25')][_0x6693a5['actionid']];if(_0x352c0d){delete this[_0x263e('0x25')][_0x6693a5[_0x263e('0x121')]];_0x352c0d[_0x263e('0x111')]=moment()[_0x263e('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x52758e=_0x352c0d[_0x263e('0x5b')]===_0x263e('0x96')?this[_0x263e('0x20')][_0x352c0d[_0x263e('0xb4')]]:this[_0x263e('0x1f')][_0x352c0d['getQueue']()];if(!this[_0x263e('0xd4')](_0x6693a5['response'])){this[_0x263e('0xb2')](_0x52758e);return this[_0x263e('0x197')](_0x352c0d,_0x52758e,_0x6693a5)[_0x263e('0xb9')](loggerCatch(_0x263e('0x198')));}this[_0x263e('0x27')][_0x6693a5[_0x263e('0xd9')]]=_0x352c0d;}};Dialer[_0x263e('0x1b')][_0x263e('0x199')]=function(_0x5539bf,_0x1593ed,_0x403122){var _0x16569d=new History(_0x1593ed);if(_0x16569d['countbusyretry']+_0x16569d[_0x263e('0xee')]+_0x16569d[_0x263e('0xef')]+_0x16569d[_0x263e('0xf0')]+_0x16569d['countdropretry']+_0x16569d[_0x263e('0xf1')]+_0x16569d[_0x263e('0xeb')]+_0x16569d[_0x263e('0x19a')]>=_0x403122[_0x263e('0xfd')]-0x1){return!![];}switch(_0x5539bf){case 0x3:if(_0x16569d[_0x263e('0xef')]>=_0x403122[_0x263e('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x16569d['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x263e('0x100')](_0x403122[_0x263e('0x19c')],_0x263e('0xf6'))[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x16569d[_0x263e('0xf8')],'ListId':_0x16569d[_0x263e('0x101')],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x19d')));break;case 0x5:if(_0x16569d[_0x263e('0xed')]>=_0x403122['dialBusyMaxRetry']-0x1){return!![];}this[_0x263e('0xbf')]({'active':![],'countbusyretry':_0x16569d[_0x263e('0xed')]+=0x1,'scheduledat':moment()[_0x263e('0x100')](_0x403122[_0x263e('0x19e')],_0x263e('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16569d[_0x263e('0xf8')],'ListId':_0x16569d[_0x263e('0x101')],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x16569d['countcongestionretry']>=_0x403122[_0x263e('0x19f')]-0x1){return!![];}this[_0x263e('0xbf')]({'active':![],'countcongestionretry':_0x16569d['countcongestionretry']+=0x1,'scheduledat':moment()[_0x263e('0x100')](_0x403122['dialCongestionRetryFrequency'],'minutes')[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x16569d[_0x263e('0xf8')],'ListId':_0x16569d[_0x263e('0x101')],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x1a0')));break;case 0x0:if(_0x16569d[_0x263e('0xf0')]>=_0x403122['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x263e('0xbf')]({'active':![],'countnosuchnumberretry':_0x16569d[_0x263e('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x403122[_0x263e('0x1a1')],_0x263e('0xf6'))[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x16569d[_0x263e('0xf8')],'ListId':_0x16569d['ListId'],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x1a2')));}break;case 0xa:if(_0x16569d[_0x263e('0x116')]>=_0x403122[_0x263e('0x117')]-0x1){return!![];}this[_0x263e('0xbf')]({'active':![],'countdropretry':_0x16569d['countdropretry']+=0x1,'scheduledat':moment()[_0x263e('0x100')](_0x403122[_0x263e('0x118')],_0x263e('0xf6'))[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x16569d[_0x263e('0xf8')],'ListId':_0x16569d[_0x263e('0x101')],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d['CampaignId']||undefined})[_0x263e('0xb9')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x16569d[_0x263e('0xf1')]>=_0x403122[_0x263e('0x1a3')]-0x1){return!![];}this[_0x263e('0xbf')]({'active':![],'countabandonedretry':_0x16569d[_0x263e('0xf1')]+=0x1,'scheduledat':moment()[_0x263e('0x100')](_0x403122['dialAbandonedRetryFrequency'],'minutes')[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x16569d[_0x263e('0xf8')],'ListId':_0x16569d[_0x263e('0x101')],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d[_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x120')));break;case 0x13:if(_0x16569d[_0x263e('0xeb')]>=_0x403122[_0x263e('0xff')]-0x1){return!![];}this[_0x263e('0xbf')]({'active':![],'countmachineretry':_0x16569d[_0x263e('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x403122[_0x263e('0xf5')],'minutes')[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x16569d['ContactId'],'ListId':_0x16569d[_0x263e('0x101')],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d['CampaignId']||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0xfa')));break;case 0x14:if(_0x16569d[_0x263e('0x19a')]>=_0x403122[_0x263e('0x1a4')]-0x1){return!![];}this[_0x263e('0xbf')]({'active':![],'countagentrejectretry':_0x16569d[_0x263e('0x19a')]+=0x1,'scheduledat':moment()[_0x263e('0x100')](_0x403122[_0x263e('0x1a5')],_0x263e('0xf6'))[_0x263e('0x7d')](_0x263e('0xf7')),'ContactId':_0x16569d[_0x263e('0xf8')],'ListId':_0x16569d[_0x263e('0x101')],'VoiceQueueId':_0x16569d[_0x263e('0xf9')]||undefined,'CampaignId':_0x16569d['CampaignId']||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x1a6')));break;default:return!![];}};Dialer[_0x263e('0x1b')]['callProgressDetecting']=function(_0x22762f,_0x5e3b6f,_0x39d783){var _0x3c5308=this;var _0x1ca0fc=new History(_0x22762f);return new BPromise(function(_0x1b4da1,_0xe761b3){if(_[_0x263e('0x3f')](_0x5e3b6f)&&typeof _0x5e3b6f!==_0x263e('0x166')){return _0xe761b3(msgResponse('[callProgressDetecting]',_0x263e('0x140'),_0x263e('0x1a7')));}if(_[_0x263e('0x3f')](_0x39d783)&&typeof _0x39d783!=='object'){return _0xe761b3(msgResponse(_0x263e('0x1a8'),_0x263e('0x140'),_0x263e('0x1a9')));}switch(_0x39d783[_0x263e('0x108')]){case'0':_0x5e3b6f[_0x263e('0x68')]+=0x1;_0x1ca0fc['state']=0x0;_0x1ca0fc[_0x263e('0xa8')]='NoSuchNumber';_0x1ca0fc[_0x263e('0xf0')]+=0x1;_0x1ca0fc['countglobal']+=0x1;ami[_0x263e('0x50')]('custom:agentnosuchnumber',ut[_0x263e('0xe4')](_0x22762f,_0x263e('0x1aa')));_0x3c5308[_0x263e('0xcb')](_0x1ca0fc)[_0x263e('0xb9')](loggerCatch(_0x263e('0x1ab')));if(_0x3c5308[_0x263e('0x199')](0x0,_0x22762f,_0x5e3b6f)){if(_0x1ca0fc[_0x263e('0xf0')]>=_0x5e3b6f[_0x263e('0x1ac')]){_0x3c5308[_0x263e('0xf3')](_0x1ca0fc,_0x1b4da1,_0xe761b3,'reason\x200\x20no\x20such\x20number....');}else{_0x3c5308[_0x263e('0xfe')](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x263e('0x1ad'));}}break;case'3':_0x5e3b6f[_0x263e('0x67')]+=0x1;_0x1ca0fc[_0x263e('0xa7')]=0x3;_0x1ca0fc[_0x263e('0xa8')]='NoAnswer';_0x1ca0fc[_0x263e('0xef')]+=0x1;_0x1ca0fc[_0x263e('0xec')]+=0x1;ami[_0x263e('0x50')]('custom:agentnoanswer',ut[_0x263e('0xe4')](_0x22762f,'noanswer'));_0x3c5308[_0x263e('0xcb')](_0x1ca0fc)[_0x263e('0xb9')](loggerCatch(_0x263e('0x1ae')));if(_0x3c5308[_0x263e('0x199')](0x3,_0x22762f,_0x5e3b6f)){if(_0x1ca0fc[_0x263e('0xef')]>=_0x5e3b6f[_0x263e('0x19b')]){_0x3c5308[_0x263e('0xf3')](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x263e('0x1af'));}else{_0x3c5308['stateGlobal'](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x263e('0x1af'));}}break;case'5':_0x5e3b6f[_0x263e('0x63')]+=0x1;_0x1ca0fc[_0x263e('0xa7')]=0x5;_0x1ca0fc[_0x263e('0xa8')]='Busy';_0x1ca0fc[_0x263e('0xed')]+=0x1;_0x1ca0fc[_0x263e('0xec')]+=0x1;ami[_0x263e('0x50')](_0x263e('0x1b0'),ut[_0x263e('0xe4')](_0x22762f,_0x263e('0x1b1')));_0x3c5308['createHistory'](_0x1ca0fc)[_0x263e('0xb9')](loggerCatch(_0x263e('0x1b2')));if(_0x3c5308['checkRetriveMax'](0x5,_0x22762f,_0x5e3b6f)){if(_0x1ca0fc[_0x263e('0xed')]>=_0x5e3b6f[_0x263e('0x1b3')]){_0x3c5308['createStateFinal'](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x263e('0x1b4'));}else{_0x3c5308[_0x263e('0xfe')](_0x1ca0fc,_0x1b4da1,_0xe761b3,'reason\x205\x20busy');}}break;case'8':_0x5e3b6f[_0x263e('0x64')]+=0x1;_0x1ca0fc[_0x263e('0xa7')]=0x8;_0x1ca0fc['statedesc']=_0x263e('0x1b5');_0x1ca0fc[_0x263e('0xee')]+=0x1;_0x1ca0fc['countglobal']+=0x1;ami[_0x263e('0x50')](_0x263e('0x1b6'),ut[_0x263e('0xe4')](_0x22762f,'congestion'));_0x3c5308[_0x263e('0xcb')](_0x1ca0fc)[_0x263e('0xb9')](loggerCatch(_0x263e('0x1b7')));if(_0x3c5308['checkRetriveMax'](0x8,_0x22762f,_0x5e3b6f)){if(_0x1ca0fc[_0x263e('0xee')]>=_0x5e3b6f[_0x263e('0x19f')]){_0x3c5308[_0x263e('0xf3')](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x263e('0x1b8'));}else{_0x3c5308[_0x263e('0xfe')](_0x1ca0fc,_0x1b4da1,_0xe761b3,'reason\x208\x20congestion');}}break;case'11':_0x5e3b6f['outboundAbandonedCallsDay']+=0x1;_0x1ca0fc['state']=0xb;_0x1ca0fc[_0x263e('0xa8')]=_0x263e('0x11d');_0x1ca0fc['countabandonedretry']+=0x1;_0x1ca0fc[_0x263e('0xec')]+=0x1;_0x3c5308[_0x263e('0xcb')](_0x1ca0fc)[_0x263e('0xb9')](loggerCatch(_0x263e('0x1b9')));if(_0x3c5308['checkRetriveMax'](0xb,_0x22762f,_0x5e3b6f)){if(_0x1ca0fc[_0x263e('0xf1')]>=_0x5e3b6f[_0x263e('0x1a3')]){_0x3c5308['createStateFinal'](_0x1ca0fc,_0x1b4da1,_0xe761b3,'reason\x2011\x20abandoned');}else{_0x3c5308[_0x263e('0xfe')](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x263e('0x1ba'));}}break;case'20':_0x5e3b6f[_0x263e('0x6b')]+=0x1;_0x1ca0fc[_0x263e('0xa7')]=0x14;_0x1ca0fc['statedesc']=_0x263e('0x1bb');_0x1ca0fc[_0x263e('0x19a')]+=0x1;_0x1ca0fc[_0x263e('0xec')]+=0x1;ami[_0x263e('0x50')](_0x263e('0x1bc'),ut[_0x263e('0xe4')](_0x22762f,_0x263e('0x1bd')));_0x3c5308[_0x263e('0xcb')](_0x1ca0fc)[_0x263e('0xb9')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3c5308['checkRetriveMax'](0x14,_0x22762f,_0x5e3b6f)){if(_0x1ca0fc[_0x263e('0x19a')]>=_0x5e3b6f[_0x263e('0x1a4')]){_0x3c5308['createStateFinal'](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x263e('0x1be'));}else{_0x3c5308[_0x263e('0xfe')](_0x1ca0fc,_0x1b4da1,_0xe761b3,'reason\x2020\x20agentreject');}}break;default:_0x5e3b6f[_0x263e('0x6c')]+=0x1;_0x1ca0fc[_0x263e('0xa7')]=0xc;_0x1ca0fc[_0x263e('0xa8')]=_0x39d783[_0x263e('0x108')];_0x3c5308[_0x263e('0xcb')](_0x1ca0fc)['catch'](loggerCatch(_0x263e('0x1bf')));if(_0x3c5308[_0x263e('0x199')](_0x39d783[_0x263e('0x108')],_0x22762f,_0x5e3b6f)){if(_0x1ca0fc['countbusyretry']+_0x1ca0fc['countcongestionretry']+_0x1ca0fc[_0x263e('0xef')]+_0x1ca0fc[_0x263e('0xf0')]+_0x1ca0fc[_0x263e('0x116')]+_0x1ca0fc[_0x263e('0xf1')]+_0x1ca0fc['countmachineretry']+_0x1ca0fc['countagentrejectretry']>=_0x5e3b6f[_0x263e('0xfd')]){_0x3c5308['stateGlobal'](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x39d783[_0x263e('0x108')]);}else{_0x3c5308[_0x263e('0xf3')](_0x1ca0fc,_0x1b4da1,_0xe761b3,_0x39d783['reason']);}}}});};Dialer[_0x263e('0x1b')]['stateGlobal']=function(_0x267c4c,_0x5dc542,_0x4c749a,_0x318a54){var _0x3ca491=new Final(_0x267c4c);_0x3ca491[_0x263e('0xa7')]=0xf;_0x3ca491[_0x263e('0xa8')]=_0x263e('0x1c0');this[_0x263e('0xf3')](_0x3ca491,_0x5dc542,_0x4c749a,_0x318a54);};Dialer[_0x263e('0x1b')][_0x263e('0xf3')]=function(_0x2c781e,_0x3a113,_0xdbb773,_0x3cd9c7){this[_0x263e('0xc9')](_0x2c781e)['then'](function(){return _0x3a113(msgResponse(_0x263e('0x1a8'),_0x263e('0x1c1'),_0x3cd9c7));})[_0x263e('0xb9')](function(){return _0xdbb773(msgResponse(_0x263e('0x1c2'),_0x263e('0x140'),_0x263e('0x1c3')));});};Dialer['prototype'][_0x263e('0x8')]=function(_0x57daa9){var _0x75c8e=_0x57daa9['dialPredictiveOptimizationPercentage']/0x64;var _0x358840=_0x57daa9[_0x263e('0x66')]/(_0x57daa9[_0x263e('0x66')]+_0x57daa9[_0x263e('0xe0')]);var _0x1274b4=Math['round'](_0x57daa9[_0x263e('0x1c4')]*(_0x57daa9['predictiveIntervalMaxThreshold']/0x64));var _0x14be79=Math[_0x263e('0x1c5')](_0x57daa9[_0x263e('0x1c4')]*(_0x57daa9[_0x263e('0x1c6')]/0x64));var _0x387e3e=_0x57daa9[_0x263e('0x53')]+_0x57daa9[_0x263e('0x59')];var _0x35077f=Math[_0x263e('0x1c7')](_0x57daa9[_0x263e('0x8c')]*_0x57daa9[_0x263e('0x77')]*_0x57daa9[_0x263e('0x73')]*_0x57daa9[_0x263e('0x74')]);if(_[_0x263e('0x3f')](_0x57daa9[_0x263e('0x1c8')])){if(!_[_0x263e('0x3f')](_0x57daa9[_0x263e('0x29')])){_0x57daa9['startPredictive']=undefined;loggerPredictive[_0x263e('0x98')]('[startMethodPredictive][StartProgressive]',_0x263e('0x1c9'));}if(!_[_0x263e('0x3f')](_0x57daa9[_0x263e('0x94')])){loggerPredictive[_0x263e('0x98')](_0x263e('0x1ca'),_0x263e('0x1cb'));clearInterval(_0x57daa9[_0x263e('0x94')]);_0x57daa9[_0x263e('0x94')]=undefined;}_0x57daa9[_0x263e('0x1c8')]=moment()[_0x263e('0x7d')](_0x263e('0xf7'));loggerPredictive['info'](_0x57daa9[_0x263e('0x42')],_0x263e('0x1cc'),_0x57daa9['startProgressive']);this['handlePower'](_0x57daa9,0x1);}else if(ifInterval(_0x57daa9['dialPredictiveInterval'],_0x57daa9[_0x263e('0x1c8')])){this['handlePower'](_0x57daa9,0x1);loggerPredictiveCalls[_0x263e('0x7e')](_0x263e('0x1cd'),_0x57daa9[_0x263e('0x1c8')],_0x57daa9[_0x263e('0x42')]);_0x57daa9[_0x263e('0x8c')]=0x0;_0x57daa9[_0x263e('0x112')]=0x0;}else if(_0x75c8e<_0x358840&&_0x57daa9['dialPredictiveOptimization']===_0x263e('0x1ce')){freeVariablesPredictive(_0x57daa9);loggerPredictive[_0x263e('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x263e('0x1cf'),_0x358840,_0x263e('0x1c8'),_0x57daa9[_0x263e('0x42')]);}else if(_0x35077f<_0x57daa9[_0x263e('0x112')]&&_0x57daa9[_0x263e('0x1d0')]===_0x263e('0x1ce')){freeVariablesPredictive(_0x57daa9);loggerPredictive[_0x263e('0x7e')](_0x263e('0x1d1'),_0x263e('0x1d2'),_0x35077f,'Drop\x20in\x20this\x20interval',_0x57daa9['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x57daa9[_0x263e('0x42')]);}else if(!ifInterval(_0x57daa9[_0x263e('0x1d3')],_0x57daa9[_0x263e('0x1c8')])&&_[_0x263e('0x3f')](_0x57daa9[_0x263e('0x29')])&&!_['isUndefined'](_0x57daa9[_0x263e('0x1c8')])){_0x57daa9[_0x263e('0x29')]=moment()[_0x263e('0x7d')](_0x263e('0xf7'));loggerPredictive['info'](_0x57daa9['name'],_0x263e('0x1d4'),_0x57daa9[_0x263e('0x29')]);this[_0x263e('0xbe')](_0x57daa9[_0x263e('0x1d3')])[_0x263e('0xb8')](this['getDataPredictive'](_0x57daa9))[_0x263e('0xb8')](mergeDataErlangB(_0x57daa9))['then'](this[_0x263e('0x1d5')](_0x57daa9))[_0x263e('0xb9')](loggerCatchPredictive(_0x263e('0x1d6'),_0x57daa9));}else if(!ifInterval(_0x57daa9['dialPredictiveInterval'],_0x57daa9[_0x263e('0x29')])){_0x57daa9[_0x263e('0x112')]=0x0;_0x57daa9[_0x263e('0x29')]=moment()[_0x263e('0x7d')](_0x263e('0xf7'));loggerPredictive['info'](_0x57daa9[_0x263e('0x42')],_0x263e('0x1d7'),_0x57daa9[_0x263e('0x29')]);clearInterval(_0x57daa9[_0x263e('0x94')]);_0x57daa9[_0x263e('0x94')]=undefined;this['averageHandleTime'](_0x57daa9[_0x263e('0x1d3')])[_0x263e('0xb8')](this[_0x263e('0x1d8')](_0x57daa9))['then'](mergeDataErlangB(_0x57daa9))[_0x263e('0xb8')](this[_0x263e('0x1d5')](_0x57daa9))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x57daa9));}else if(_0x57daa9[_0x263e('0x1c4')]&&_0x387e3e<_0x57daa9[_0x263e('0x1c4')]-_0x14be79){freeVariablesPredictive(_0x57daa9);loggerPredictive['info'](_0x57daa9[_0x263e('0x42')],_0x263e('0x1d9'),_0x387e3e,_0x263e('0x1da'),_0x57daa9[_0x263e('0x1c4')],'-',_0x14be79,'=',_0x57daa9[_0x263e('0x1c4')]-_0x14be79,')');}else if(_0x57daa9['predictiveIntervalAvailable']&&_0x387e3e>_0x57daa9['predictiveIntervalAvailable']+_0x1274b4){freeVariablesPredictive(_0x57daa9);loggerPredictive['info'](_0x57daa9[_0x263e('0x42')],_0x263e('0x1d9'),_0x387e3e,_0x263e('0x1db'),_0x57daa9[_0x263e('0x1c4')],'+',_0x1274b4,'=',_0x57daa9[_0x263e('0x1c4')]+_0x1274b4,')');}};Dialer[_0x263e('0x1b')][_0x263e('0x1d8')]=function(_0x52a114){var _0x562089=this;return function(_0x2f32b8){return new BPromise(function(_0x510183,_0x5566b9){_[_0x263e('0x90')](_0x52a114,_0x2f32b8[0x0]);if(checkGetDataPredictive(_0x2f32b8[0x0])){var _0x4b40dd=_0x52a114[_0x263e('0x1c4')]=_0x52a114[_0x263e('0x59')]+_0x52a114[_0x263e('0x53')];var _0x11ea3a=_0x52a114[_0x263e('0x1d3')]*0x3c;var _0x4aa0b7=_0x2f32b8[0x0][_0x263e('0x6f')]+_0x2f32b8[0x0][_0x263e('0x6e')];var _0x495397=(_0x2f32b8[0x0][_0x263e('0x6d')]+_0x2f32b8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2f32b8[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2f32b8[0x0][_0x263e('0x81')];_0x52a114[_0x263e('0x73')]=_0x495397>0x0?_0x495397:0x1;switch(_0x52a114['dialPredictiveOptimization']){case'dropRate':var _0x5a57f9=_0x52a114[_0x263e('0x1dc')]/0x64;return _0x562089[_0x263e('0x1dd')](_0x4b40dd,_0x11ea3a,_0x4aa0b7,_0x495397,_0x5a57f9)[_0x263e('0xb8')](function(_0xe2b000){return _0x510183(_0xe2b000);});case _0x263e('0x1de'):var _0x21bb73=_0x52a114[_0x263e('0x1dc')]/0x64;return _0x562089[_0x263e('0x1df')](_0x4b40dd,_0x11ea3a,_0x4aa0b7,_0x495397,_0x21bb73)['then'](function(_0x4a4970){return _0x510183(_0x4a4970);});default:return _0x5566b9(msgResponse(_0x263e('0x1e0'),_0x263e('0x140'),_0x263e('0x1e1')));}}else{return _0x5566b9(msgResponse(_0x263e('0x1e0'),_0x263e('0x140'),_0x263e('0x1e2')));}});};};Dialer[_0x263e('0x1b')][_0x263e('0x1e3')]=function(_0x1127d9){var _0x443927=this;return function(_0x5153be){return new BPromise(function(_0x5c7333,_0xb8050b){_[_0x263e('0x90')](_0x1127d9,_0x5153be[0x0]);if(checkGetDataPredictive(_0x5153be[0x0])){loggerPredictive[_0x263e('0x7e')](JSON[_0x263e('0x4d')](_0x5153be[0x0]));if(_0x1127d9[_0x263e('0x1d0')]===_0x263e('0x1ce')){return _0x443927[_0x263e('0xc7')](_0x1127d9['id'])[_0x263e('0xb8')](function(_0x4c2979){var _0x21439a=_0x1127d9[_0x263e('0x54')]-_0x4c2979[0x0][_0x263e('0x1e4')];var _0x57c474=_0x1127d9['dialPredictiveInterval']*0x3c;var _0xd73e64=_0x5153be[0x0][_0x263e('0x6f')]+_0x5153be[0x0][_0x263e('0x6e')];var _0x9aa805=(_0x5153be[0x0]['predictiveIntervalAnsweredCalls']+_0x5153be[0x0][_0x263e('0x71')]+_0x5153be[0x0][_0x263e('0x70')])/_0x5153be[0x0][_0x263e('0x81')];var _0x45b9f3=_0x1127d9['dialPredictiveOptimizationPercentage']/0x64;_0x1127d9[_0x263e('0x1e5')]=_0x4c2979[0x0][_0x263e('0x1e4')]||0x0;_0x1127d9[_0x263e('0x73')]=_0x9aa805>0x0?_0x9aa805:0x1;return _0x443927['abandonmentRate'](_0x21439a,_0x57c474,_0xd73e64,_0x9aa805,_0x45b9f3);})['then'](function(_0x55a62c){return _0x5c7333(_0x55a62c);})[_0x263e('0xb9')](function(_0x5e6539){return _0xb8050b(msgResponse(_0x263e('0x1e6'),'Failure',JSON[_0x263e('0x4d')](_0x5e6539)));});}if(_0x1127d9['dialPredictiveOptimization']===_0x263e('0x1de')){return _0x443927[_0x263e('0xc7')](_0x1127d9['id'])[_0x263e('0xb8')](function(_0x4559bd){var _0x324711=_0x1127d9[_0x263e('0x54')]-_0x4559bd[0x0]['outboundQueuePauses'];var _0x7859f3=_0x1127d9[_0x263e('0x1d3')]*0x3c;var _0x45a987=_0x5153be[0x0][_0x263e('0x6f')]+_0x5153be[0x0][_0x263e('0x6e')];var _0x213aca=(_0x5153be[0x0][_0x263e('0x6d')]+_0x5153be[0x0][_0x263e('0x71')]+_0x5153be[0x0][_0x263e('0x70')])/_0x5153be[0x0]['predictiveIntervalTotalCalls'];var _0x40b483=_0x1127d9[_0x263e('0x1dc')]/0x64;_0x1127d9[_0x263e('0x1e5')]=_0x4559bd[0x0]['outboundQueuePauses']||0x0;_0x1127d9[_0x263e('0x73')]=_0x213aca>0x0?_0x213aca:0x1;return _0x443927[_0x263e('0x1df')](_0x324711,_0x7859f3,_0x45a987,_0x213aca,_0x40b483);})[_0x263e('0xb8')](function(_0x3108ff){return _0x5c7333(_0x3108ff);})[_0x263e('0xb9')](function(_0x5a7fe6){return _0xb8050b(msgResponse('[CatchErlangB]','Failure',JSON[_0x263e('0x4d')](_0x5a7fe6)));});}}else{return _0xb8050b(msgResponse('[getDataPredictive]',_0x263e('0x140'),_0x263e('0x1e2')));}});};};Dialer[_0x263e('0x1b')]['startMethodPredictive']=function(_0x1929d7){var _0x4615b2=this;return function(){var _0x1f4142=0x0;var _0x48ab45=Math[_0x263e('0x1c7')](_0x1929d7[_0x263e('0x76')]*0x3e8);if(_0x48ab45>0x0){_0x48ab45=_0x48ab45<0x64?0x64:_0x48ab45;loggerPredictive[_0x263e('0x7e')](_0x1929d7['name'],'one\x20call\x20every:',_0x48ab45,_0x263e('0x4e'));_0x1929d7[_0x263e('0x94')]=setInterval(function(){_0x4615b2[_0x263e('0x94')](_0x1929d7);loggerPredictiveCalls[_0x263e('0x7e')]('[handlePredictive]',_0x1f4142+=0x1);},_0x48ab45);}else{loggerPredictive[_0x263e('0x7e')](_0x1929d7[_0x263e('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x263e('0x1e7')]=function(_0x102ec3,_0x49df39){var _0x394471=this;return function(_0x55dcc9){if(_[_0x263e('0x4a')](_0x55dcc9)){if(_[_0x263e('0xad')](_0x49df39[_0x263e('0xd1')])||!_0x49df39[_0x263e('0x1e8')]){if(_0x102ec3[_0x263e('0x60')]===_0x263e('0x7')){_0x102ec3[_0x263e('0x128')]=_[_0x263e('0x3f')](_0x102ec3[_0x263e('0x128')])?!![]:_0x102ec3[_0x263e('0x128')];var _0x1b835d=uuid['v4']();_0x394471['actions'][_0x1b835d]=new Action(_0x102ec3,_0x49df39,_0x1b835d);loggerBooked['info'](_0x263e('0x1e9'),_0x1b835d,'queueStatusComplete:\x20',JSON[_0x263e('0x4d')](_0x102ec3['queueStatusComplete']),_0x263e('0x1ea'),_0x102ec3['name']);if(_0x102ec3['queueStatusComplete']){_0x102ec3[_0x263e('0x128')]=![];_0x394471[_0x263e('0x2b')][_0x394471[_0x263e('0x25')][_0x1b835d][_0x263e('0xb4')]]=[];ami[_0x263e('0xae')]({'actionid':_0x1b835d,'action':_0x263e('0x1eb'),'queue':_0x102ec3['name']})['catch'](function(){_0x394471['updateOriginated'](_0x102ec3);_0x394471[_0x263e('0xbf')]({'active':![],'ContactId':_0x394471[_0x263e('0x25')][_0x1b835d][_0x263e('0xf8')],'ListId':_0x394471[_0x263e('0x25')][_0x1b835d]['ListId'],'VoiceQueueId':_0x394471[_0x263e('0x25')][_0x1b835d]['VoiceQueueId']||undefined,'CampaignId':_0x394471[_0x263e('0x25')][_0x1b835d][_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x1ec')));delete _0x394471[_0x263e('0x25')][_0x1b835d];});}else{loggerBooked[_0x263e('0x7e')](_0x263e('0x1ed'),JSON[_0x263e('0x4d')](_0x102ec3[_0x263e('0x128')]),_0x263e('0x1ea'),_0x102ec3[_0x263e('0x42')]);_0x394471[_0x263e('0xb2')](_0x102ec3);_0x394471['rescheduleContact']({'active':![],'ContactId':_0x394471['actions'][_0x1b835d]['ContactId'],'ListId':_0x394471[_0x263e('0x25')][_0x1b835d][_0x263e('0x101')],'VoiceQueueId':_0x394471['actions'][_0x1b835d]['VoiceQueueId']||undefined,'CampaignId':_0x394471[_0x263e('0x25')][_0x1b835d][_0x263e('0xd2')]||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x1ec')));delete _0x394471[_0x263e('0x25')][_0x1b835d];}}else{return _0x394471[_0x263e('0x1ee')](_0x102ec3,_0x49df39);}}else{if(getDiff(_0x49df39[_0x263e('0x1ef')])<_0x102ec3['dialRecallMeTimeout']*0x3c){if(_0x49df39['Agent']&&!_0x49df39[_0x263e('0x15a')]['voicePause']){_0x394471['preview']['run'](_0x49df39['id'])[_0x263e('0x12d')](function(){_0x394471['updateOriginated'](_0x102ec3);});}else{_0x394471[_0x263e('0xc1')]({'active':![]},_0x49df39['id'],0x1)['finally'](function(){_0x394471['updateOriginated'](_0x102ec3);});}}else{_0x102ec3[_0x263e('0x6a')]+=0x1;_0x394471[_0x263e('0xb2')](_0x102ec3);if(_0x102ec3[_0x263e('0x1f0')]){_0x394471[_0x263e('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x49df39[_0x263e('0xf8')],'ListId':_0x49df39[_0x263e('0x101')],'VoiceQueueId':_0x49df39['VoiceQueueId']||undefined,'CampaignId':_0x49df39['CampaignId']||undefined})[_0x263e('0xb9')](loggerCatch(_0x263e('0x1f1')));_0x394471[_0x263e('0xcb')](createObjHistory(_0x102ec3,_0x49df39,'RECALLINQUEUE',0x17,_0x263e('0x1f2')))[_0x263e('0xb9')](loggerCatch(_0x263e('0x1f3')));}else{_0x394471[_0x263e('0xcf')](createObjHistory(_0x102ec3,_0x49df39,_0x263e('0x1f4'),0x16,_0x263e('0x1f5')),_0x263e('0x1f6'),'[Originate][HistoryRecallClose]');}}}}else{_0x102ec3[_0x263e('0x62')]+=0x1;_0x394471['saveInDb'](createObjHistory(_0x102ec3,_0x49df39,_0x263e('0x1f7'),0xd,'Blacklist'),_0x263e('0x1f8'),_0x263e('0x1f9'));throw _0x263e('0x1fa');}};};Dialer[_0x263e('0x1b')][_0x263e('0x1fb')]=function(_0x5d7e2e){var _0x567858=this;var _0x3fd280=_0x5d7e2e[_0x263e('0x1fc')]-_0x5d7e2e[_0x263e('0x75')]-_0x5d7e2e[_0x263e('0xc3')];emitCampaignSummary(_0x5d7e2e);if(_0x3fd280>0x0){if(_0x3fd280>this[_0x263e('0x23')]){_0x3fd280=this[_0x263e('0x23')];}_0x5d7e2e['temp']+=_0x3fd280;this[_0x263e('0xc5')](_0x5d7e2e['id'],_0x3fd280,_0x5d7e2e['dialOrderByScheduledAt'],_0x5d7e2e)[_0x263e('0xb8')](function(_0x5acbc3){_0x5d7e2e[_0x263e('0xc3')]-=_0x3fd280;_0x5d7e2e[_0x263e('0xc3')]=_0x5d7e2e['temp']>0x0?_0x5d7e2e[_0x263e('0xc3')]:0x0;if(!checkContactEmpty(_0x5acbc3)){_0x5d7e2e[_0x263e('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x263e('0x7e')](_0x263e('0x1fd')+_0x5d7e2e[_0x263e('0x42')]);}else{_0x5d7e2e[_0x263e('0x75')]+=_0x5acbc3[_0x263e('0x9b')];_0x5d7e2e[_0x263e('0x40')]=_0x263e('0x1fe');for(var _0x590fcf=0x0;_0x590fcf<_0x5acbc3['length'];_0x590fcf+=0x1){_0x5d7e2e[_0x263e('0x1ff')]+=0x1;if(_[_0x263e('0xad')](_0x5acbc3[_0x590fcf])||_[_0x263e('0xad')](_0x5acbc3[_0x590fcf][_0x263e('0x168')])||_[_0x263e('0xad')](_0x5acbc3[_0x590fcf]['Contact'][_0x263e('0x169')])){_0x567858[_0x263e('0xcd')]('[actionOriginate]\x20',_0x5d7e2e,_0x5acbc3[_0x590fcf]);}else{_0x567858[_0x263e('0xbc')](_['pick'](_0x5acbc3[_0x590fcf],[_0x263e('0xd2'),'Contact.phone']))[_0x263e('0xb8')](_0x567858[_0x263e('0x1e7')](_0x5d7e2e,_0x5acbc3[_0x590fcf]))['catch'](_0x567858[_0x263e('0x200')](_0x263e('0x201'),_0x5d7e2e));}}}})[_0x263e('0xb9')](loggerGetContactDialer('[getContactCampaign2]',_0x5d7e2e,_0x3fd280));}};Dialer[_0x263e('0x1b')][_0x263e('0x155')]=function(_0x4b9eff,_0x522346){var _0x149863=this;var _0x4de214=[];var _0x56795e=_0x522346>=0x1?_0x522346:0x1;if(_0x4b9eff[_0x263e('0x60')]===_0x263e('0x7')){_0x56795e=0x1;}var _0x156a19=Math['floor'](_0x4b9eff[_0x263e('0x53')]*_0x56795e)-_0x4b9eff['originated']-_0x4b9eff[_0x263e('0xc3')];emitVoiceQueueSummary(_0x4b9eff);if(_0x4b9eff[_0x263e('0x202')]>0x0){var _0xf8533=_0x4b9eff[_0x263e('0x202')]-_0x4b9eff[_0x263e('0x75')]-_0x4b9eff['talking']-_0x4b9eff[_0x263e('0xc3')]-_0x4b9eff[_0x263e('0x55')];if(_0x156a19>_0xf8533){_0x156a19=_0xf8533;}}if(_0x156a19>0x0){if(_0x4b9eff[_0x263e('0x60')]===_0x263e('0x7')){_0x156a19=0x1;}if(_0x156a19>this[_0x263e('0x23')]){_0x156a19=this[_0x263e('0x23')];}_0x4b9eff['temp']+=_0x156a19;for(var _0x2417fb in this['agents']){if(typeof this[_0x263e('0x21')][_0x2417fb]!==_0x263e('0x9c')){if(this[_0x263e('0x21')][_0x2417fb][_0x263e('0xa7')]===_0x263e('0x203')&&this[_0x263e('0x21')][_0x2417fb][_0x263e('0xaf')]===_0x263e('0xd7')){_0x4de214[_0x263e('0x126')](this['agents'][_0x2417fb]['id']);}}}this[_0x263e('0xc2')](_0x4b9eff['id'],_0x4de214,_0x156a19,_0x4b9eff['dialOrderByScheduledAt'],_0x4b9eff)[_0x263e('0xb8')](function(_0x10d1a9){_0x4b9eff['temp']-=_0x156a19;_0x4b9eff[_0x263e('0xc3')]=_0x4b9eff[_0x263e('0xc3')]>0x0?_0x4b9eff[_0x263e('0xc3')]:0x0;if(!checkContactEmpty(_0x10d1a9)){_0x149863[_0x263e('0xb6')](_0x4b9eff)[_0x263e('0xb8')](sendMessageReschedule(_0x4b9eff))[_0x263e('0xb9')](loggerCatch(_0x263e('0x204')));}else{_0x4b9eff[_0x263e('0x75')]+=_0x10d1a9[_0x263e('0x9b')];_0x4b9eff[_0x263e('0x40')]=_0x4b9eff[_0x263e('0x60')]==='booked'?'ACTIVE':_0x263e('0x1fe');for(var _0x37e25d=0x0;_0x37e25d<_0x10d1a9['length'];_0x37e25d+=0x1){if(_[_0x263e('0xad')](_0x10d1a9[_0x37e25d])||_[_0x263e('0xad')](_0x10d1a9[_0x37e25d][_0x263e('0x168')])||_[_0x263e('0xad')](_0x10d1a9[_0x37e25d][_0x263e('0x168')][_0x263e('0x169')])){_0x149863[_0x263e('0xcd')]('[actionOriginate]\x20',_0x4b9eff,_0x10d1a9[_0x37e25d]);}else{_0x149863[_0x263e('0xba')](_['pick'](_0x10d1a9[_0x37e25d],[_0x263e('0xf9'),_0x263e('0x205')]))[_0x263e('0xb8')](_0x149863['checkContactBlack'](_0x4b9eff,_0x10d1a9[_0x37e25d]))[_0x263e('0xb9')](_0x149863[_0x263e('0x200')](_0x263e('0x206'),_0x4b9eff));}}}})[_0x263e('0xb9')](loggerGetContactDialer(_0x263e('0x207'),_0x4b9eff,_0x156a19));}};Dialer[_0x263e('0x1b')][_0x263e('0x94')]=function(_0x44982c){if(_0x44982c[_0x263e('0x202')]>0x0){var _0xce3d24=_0x44982c['dialLimitQueue']-_0x44982c[_0x263e('0x75')]-_0x44982c[_0x263e('0x59')];if(_0xce3d24>0x0){this[_0x263e('0x208')](_0x44982c);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x44982c);}};Dialer[_0x263e('0x1b')][_0x263e('0x208')]=function(_0x514117){var _0xf9fd2b=this;var _0x28e02c=[];_0x514117[_0x263e('0x75')]+=0x1;for(var _0x5c25f5 in this['agents']){if(typeof this[_0x263e('0x21')][_0x5c25f5]!==_0x263e('0x9c')){if(this[_0x263e('0x21')][_0x5c25f5][_0x263e('0xa7')]==='not_inuse'&&this[_0x263e('0x21')][_0x5c25f5]['status']===_0x263e('0xd7')){_0x28e02c[_0x263e('0x126')](this[_0x263e('0x21')][_0x5c25f5]['id']);}}}this[_0x263e('0xc2')](_0x514117['id'],_0x28e02c,0x1,_0x514117[_0x263e('0x209')],_0x514117)[_0x263e('0xb8')](function(_0x5fd6af){if(!checkContactEmpty(_0x5fd6af)){checkContactLowerLimitOriginate(_0x514117,0x1,0x0);_0xf9fd2b['countReScheduled'](_0x514117)[_0x263e('0xb8')](sendMessageReschedule(_0x514117))[_0x263e('0xb9')](loggerCatch(_0x263e('0x204')));}else{_0x514117['message']='RUNNING';if(_[_0x263e('0xad')](_0x5fd6af[0x0])||_['isNil'](_0x5fd6af[0x0][_0x263e('0x168')])||_[_0x263e('0xad')](_0x5fd6af[0x0]['Contact']['phone'])){_0xf9fd2b[_0x263e('0xcd')](_0x263e('0x206'),_0x514117,_0x5fd6af[0x0]);}else{_0xf9fd2b[_0x263e('0xba')](_[_0x263e('0xd0')](_0x5fd6af[0x0],['VoiceQueueId',_0x263e('0x205')]))[_0x263e('0xb8')](_0xf9fd2b['checkContactBlack'](_0x514117,_0x5fd6af[0x0]))[_0x263e('0xb9')](_0xf9fd2b['loggerHandler']('[actionOriginatePredictive]\x20',_0x514117));}}})[_0x263e('0xb9')](loggerGetContactDialer(_0x263e('0x20a'),_0x514117,0x1));emitVoiceQueueSummary(_0x514117);};Dialer[_0x263e('0x1b')]['abandonmentRate']=function(_0xff0a14,_0x5c73bf,_0x21e9bf,_0x44b486,_0x3c03c0,_0x368150){loggerPredictive['info'](_0x263e('0x20b'));loggerPredictive['info'](_0x263e('0x20c'),_0xff0a14);loggerPredictive[_0x263e('0x7e')](_0x263e('0x20d'),_0x5c73bf);loggerPredictive[_0x263e('0x7e')](_0x263e('0x20e'),_0x21e9bf);loggerPredictive['info'](_0x263e('0x20f'),_0x44b486);loggerPredictive[_0x263e('0x7e')](_0x263e('0x210'),_0x3c03c0);loggerPredictive[_0x263e('0x7e')](_0x263e('0x86'));return new BPromise(function(_0x1b3c87,_0x4a16bc){if(_0xff0a14<=0x0||isNaN(_0xff0a14)){return _0x4a16bc(msgResponse(_0x263e('0x211'),_0x263e('0x4c'),_0x263e('0x212')+_0xff0a14));}if(_0x21e9bf<=0x0||isNaN(_0x21e9bf)){return _0x4a16bc(msgResponse(_0x263e('0x211'),_0x263e('0x4c'),_0x263e('0x213')+_0x21e9bf));}if(_0x44b486<=0x0||isNaN(_0x44b486)){return _0x4a16bc(msgResponse(_0x263e('0x211'),_0x263e('0x4c'),_0x263e('0x214')+_0x44b486));}if(_0x5c73bf<=0x0||isNaN(_0x5c73bf)){return _0x4a16bc(msgResponse(_0x263e('0x211'),_0x263e('0x4c'),_0x263e('0x215')+_0x5c73bf));}if(_0x3c03c0<=0x0||isNaN(_0x3c03c0)){return _0x4a16bc(msgResponse(_0x263e('0x211'),_0x263e('0x4c'),'Amax\x20=\x20'+_0x3c03c0));}_0x368150=_0x368150||0x0;var _0x572df8=0x1/_0x21e9bf;var _0x557871=0x0;var _0x592c03=0x0;var _0x2a1705=0x0;var _0x344d7a=0x0;for(var _0x328c7f=0x0;_0x2a1705<_0x3c03c0;_0x328c7f+=0x1){_0x592c03=_0x328c7f/_0x5c73bf;_0x557871=(_0x44b486*_0x592c03+_0x368150)/_0x572df8;_0x2a1705=erlangb(_0x557871,_0xff0a14);_0x344d7a=_0x557871/_0xff0a14*(0x1-erlangb(_0x557871,_0xff0a14));}return _0x1b3c87({'erlangCalls':_0x328c7f,'erlangCallToSecond':_0x5c73bf/_0x328c7f,'erlangAbandonmentRate':_0x2a1705,'erlangBusyFactor':_0x344d7a});});};Dialer[_0x263e('0x1b')][_0x263e('0x1df')]=function(_0x31fa83,_0x8f400a,_0x3f4aa2,_0x1a7846,_0x3cb0ef,_0x54d6d9){loggerPredictive[_0x263e('0x7e')](_0x263e('0x216'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31fa83);loggerPredictive[_0x263e('0x7e')](_0x263e('0x20d'),_0x8f400a);loggerPredictive[_0x263e('0x7e')](_0x263e('0x20e'),_0x3f4aa2);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a7846);loggerPredictive['info'](_0x263e('0x217'),_0x3cb0ef);loggerPredictive[_0x263e('0x7e')](_0x263e('0x86'));return new BPromise(function(_0x14dcca,_0x37343e){if(_0x31fa83<=0x0||isNaN(_0x31fa83)){return _0x37343e(msgResponse('[busyFactor]',_0x263e('0x4c'),_0x263e('0x212')+_0x31fa83));}if(_0x3f4aa2<=0x0||isNaN(_0x3f4aa2)){return _0x37343e(msgResponse('[busyFactor]','Error',_0x263e('0x213')+_0x3f4aa2));}if(_0x1a7846<=0x0||isNaN(_0x1a7846)){return _0x37343e(msgResponse(_0x263e('0x218'),_0x263e('0x4c'),'p\x20=\x20'+_0x1a7846));}if(_0x8f400a<=0x0||isNaN(_0x8f400a)){return _0x37343e(msgResponse(_0x263e('0x218'),_0x263e('0x4c'),_0x263e('0x215')+_0x8f400a));}if(_0x3cb0ef<=0x0||isNaN(_0x3cb0ef)){return _0x37343e(msgResponse(_0x263e('0x218'),_0x263e('0x4c'),_0x263e('0x219')+_0x3cb0ef));}_0x54d6d9=_0x54d6d9||0x0;var _0x4336c7=0x1/_0x3f4aa2;var _0x4e16fb=0x0;var _0x9c0103=0x0;var _0xf9c688=0x0;var _0x5b0ac0=0x0;for(var _0x195b8c=0x0;_0x5b0ac0<_0x3cb0ef;_0x195b8c+=0x1){_0x9c0103=_0x195b8c/_0x8f400a;_0x4e16fb=(_0x1a7846*_0x9c0103+_0x54d6d9)/_0x4336c7;_0xf9c688=erlangb(_0x4e16fb,_0x31fa83);_0x5b0ac0=_0x4e16fb/_0x31fa83*(0x1-erlangb(_0x4e16fb,_0x31fa83));}return _0x14dcca({'erlangCalls':_0x195b8c,'erlangCallToSecond':_0x8f400a/_0x195b8c,'erlangAbandonmentRate':_0xf9c688,'erlangBusyFactor':_0x5b0ac0});});};module[_0x263e('0x21a')]=Dialer; \ No newline at end of file +var _0x7f42=['[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','statedesc','endtime','starttime','clearZombieChannels','[actions]','isNil','Action','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','SIP/%s','status','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','xcally-motion-dialer','ivr','dialAMDActive','value','HangupInAMD','emit','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','state','Machine','membername','AMD','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countdropretry','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','push','iftime\x20%s,%s','interval','content','true','command','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','user:%s','launchHandleIvr','handleIvr','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','countbusyretry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','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(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','redis','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7f42,0x183));var _0x27f4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7f42[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x27f4('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x27f4('0x1'));var moment=require(_0x27f4('0x2'));var rr=require('rr');var md5=require(_0x27f4('0x3'));var Redis=require(_0x27f4('0x4'));var ut=require(_0x27f4('0x5'));var config=require(_0x27f4('0x6'));var logger=require('../../../config/logger')(_0x27f4('0x7'));var loggerBooked=require(_0x27f4('0x8'))(_0x27f4('0x9'));var loggerPredictive=require(_0x27f4('0x8'))(_0x27f4('0xa'));var loggerPredictiveCalls=require(_0x27f4('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x27f4('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0x27f4('0xb')]=_['defaults'](config['redis'],{'host':_0x27f4('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27f4('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x27f4('0xd'));var cmHopperBlack=require(_0x27f4('0xe'));var voiceQueueRt=require(_0x27f4('0xf'));var RpcSetting=require(_0x27f4('0x10'));var Action=require('./action');var History=require('./history');var Final=require(_0x27f4('0x11'));var AgentComplete=require(_0x27f4('0x12'));var QueueCallerAbandon=require(_0x27f4('0x13'));var Hangup=require(_0x27f4('0x14'));var ipAgi=process[_0x27f4('0x15')]['XCALLY_IP_AGI']||_0x27f4('0x16');var strategy={'rrmemory':_0x27f4('0x17'),'roundrobin':_0x27f4('0x18')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x27f4('0x19')][_0x27f4('0x1a')]=function(_0x2c91db){this[_0x27f4('0x1b')]=this[_0x27f4('0x1b')]?this['tail']['finally'](_0x2c91db):_0x2c91db();};function Dialer(_0x4297d7,_0x155230){this[_0x27f4('0x1c')]=new Sequence();this[_0x27f4('0x1d')]=_0x155230;this[_0x27f4('0x1e')]=_0x4297d7[_0x27f4('0x1e')];this[_0x27f4('0x1f')]=_0x4297d7[_0x27f4('0x1f')];this['agents']=_0x4297d7[_0x27f4('0x20')];this['trunks']=_0x4297d7[_0x27f4('0x21')];this[_0x27f4('0x22')]=config['maxNumberOriginate']||0x2;this[_0x27f4('0x23')]={};this[_0x27f4('0x24')]={};this[_0x27f4('0x25')]={};this[_0x27f4('0x26')]={};this[_0x27f4('0x27')]={};this[_0x27f4('0x28')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x27f4('0x29')]={};this[_0x27f4('0x2a')]={};ami['on'](_0x27f4('0x2b'),this[_0x27f4('0x2c')][_0x27f4('0x2d')](this));ami['on']('queuecallerabandon',this[_0x27f4('0x2e')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x2f'),this[_0x27f4('0x30')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x31'),this['syncAgentComplete'][_0x27f4('0x2d')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x32'),this[_0x27f4('0x33')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x34'),this['syncNewExten'][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x35'),this[_0x27f4('0x36')][_0x27f4('0x2d')](this));ami['on']('queuemember',this[_0x27f4('0x37')][_0x27f4('0x2d')](this));ami['on'](_0x27f4('0x38'),this[_0x27f4('0x39')][_0x27f4('0x2d')](this));this[_0x27f4('0x3a')]();this[_0x27f4('0x3b')]();RpcSetting['getSettings']()[_0x27f4('0x3c')](function(_0x26e36d){previewRecallmeReminderInterval=_0x26e36d[_0x27f4('0x3d')];});}function isNotNull(_0x52610e){return _0x52610e!==null&&!_[_0x27f4('0x3e')](_0x52610e);}function checkIsLoggedIn(_0x23aa3d,_0x26bd77){return function(){if(_0x26bd77<=0x0){_0x23aa3d['message']='AGENTS_NOT_LOGGED';throw _0x23aa3d[_0x27f4('0x3f')]+_0x27f4('0x40');}};}function isActive(_0x1129bc){return _0x1129bc;}function checkIsActive(_0x2ae2ea,_0x1b3eb3){return function(){if(!isActive(_0x1b3eb3)){_0x2ae2ea[_0x27f4('0x41')]=_0x27f4('0x42');throw _0x2ae2ea[_0x27f4('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x2ecc6f){return function(){if(!isNotNull(_0x2ecc6f[_0x27f4('0x43')])){_0x2ecc6f[_0x27f4('0x41')]=_0x27f4('0x44');throw _0x2ecc6f[_0x27f4('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2ecc6f[_0x27f4('0x43')][_0x27f4('0x45')])){_0x2ecc6f['message']=_0x27f4('0x44');throw _0x2ecc6f[_0x27f4('0x3f')]+_0x27f4('0x46');}if(!isNotNull(_['isEmpty'](_0x2ecc6f[_0x27f4('0x43')]['Intervals']))){_0x2ecc6f[_0x27f4('0x41')]=_0x27f4('0x44');throw _0x2ecc6f['name']+_0x27f4('0x46');}};}function msgResponse(_0x4b4281,_0x42fbe5,_0x185e81){return{'action':_0x4b4281,'response':_0x42fbe5,'message':_0x185e81,'stack':_0x185e81};}function myreject(_0x3ad02c){return function(_0x4b94d6){return _0x3ad02c(msgResponse('[ifTime][Action]',_0x27f4('0x47'),JSON[_0x27f4('0x48')](_0x4b94d6)));};}function getSeconds(_0x3bf210,_0x5de96f){var _0x3163d1=moment(_0x3bf210)[_0x27f4('0x49')](0x0);var _0xfad77c=moment(_0x5de96f)[_0x27f4('0x49')](0x0);return _0x3163d1[_0x27f4('0x4a')](_0xfad77c,_0x27f4('0x4b'));}function emit(_0x1aa16f,_0x572e5a,_0x2aba9c){io['to'](_0x1aa16f)['emit'](_0x572e5a,_0x2aba9c);}function emitVoiceQueueSummary(_0x328403){if(_0x328403[_0x27f4('0x4c')]===_0x27f4('0x4d')){var _0x378d9b={'id':_0x328403['id'],'name':_0x328403[_0x27f4('0x3f')],'strategy':_0x328403[_0x27f4('0x4e')],'answered':_0x328403[_0x27f4('0x4f')],'available':_0x328403[_0x27f4('0x50')],'loggedIn':_0x328403[_0x27f4('0x51')],'pTalking':_0x328403[_0x27f4('0x52')],'sumBillable':_0x328403[_0x27f4('0x53')],'sumDuration':_0x328403[_0x27f4('0x54')],'sumHoldTime':_0x328403['sumHoldTime']||0x0,'talking':_0x328403['talking'],'total':_0x328403['total'],'type':_0x328403['type'],'unmanaged':_0x328403[_0x27f4('0x55')],'abandoned':_0x328403[_0x27f4('0x56')],'waiting':_0x328403[_0x27f4('0x57')],'loggedInDb':_0x328403[_0x27f4('0x58')],'dialActive':_0x328403[_0x27f4('0x59')],'dialMethod':_0x328403[_0x27f4('0x5a')],'dialOriginateCallerIdName':_0x328403['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x328403['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x328403[_0x27f4('0x5b')],'dialPrefix':_0x328403[_0x27f4('0x5c')],'outboundAnswerAgiCallsDay':_0x328403[_0x27f4('0x5d')],'outboundAnswerCallsDay':_0x328403[_0x27f4('0x5e')],'outboundBlacklistCallsDay':_0x328403[_0x27f4('0x5f')],'outboundBusyCallsDay':_0x328403[_0x27f4('0x60')],'outboundCongestionCallsDay':_0x328403[_0x27f4('0x61')],'outboundDropCallsDayACS':_0x328403[_0x27f4('0x62')],'outboundDropCallsDayCallersExit':_0x328403[_0x27f4('0x63')],'outboundDropCallsDayTimeout':_0x328403['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x328403[_0x27f4('0x64')],'outboundNoSuchCallsDay':_0x328403[_0x27f4('0x65')],'outboundOriginateFailureCallsDay':_0x328403[_0x27f4('0x66')],'outboundReCallsDay':_0x328403[_0x27f4('0x67')],'outboundRejectCallsDay':_0x328403[_0x27f4('0x68')],'outboundUnknownCallsDay':_0x328403[_0x27f4('0x69')],'predictiveIntervalAnsweredCalls':_0x328403['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x328403['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x328403['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x328403['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x328403[_0x27f4('0x6a')],'predictiveIntervalErlangCalls':_0x328403[_0x27f4('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x328403[_0x27f4('0x6c')],'predictiveIntervalHitRate':_0x328403[_0x27f4('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x328403[_0x27f4('0x6e')],'predictiveIntervalPauses':_0x328403[_0x27f4('0x6f')],'predictiveIntervalAvailable':_0x328403['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x328403[_0x27f4('0x70')],'message':_0x328403[_0x27f4('0x41')],'originated':_0x328403[_0x27f4('0x71')],'erlangCalls':_0x328403[_0x27f4('0x72')],'erlangCallToSecond':_0x328403[_0x27f4('0x73')],'erlangAbandonmentRate':_0x328403[_0x27f4('0x74')],'erlangBusyFactor':_0x328403[_0x27f4('0x75')],'startPredictive':_0x328403[_0x27f4('0x28')],'startProgressive':_0x328403['startProgressive']};if(_0x328403[_0x27f4('0x76')]){_0x378d9b[_0x27f4('0x76')]={'id':_0x328403[_0x27f4('0x76')]['id'],'name':_0x328403[_0x27f4('0x76')]['name'],'active':_0x328403[_0x27f4('0x76')][_0x27f4('0x77')],'callerid':_0x328403[_0x27f4('0x76')][_0x27f4('0x78')]};}if(_0x328403[_0x27f4('0x43')]){_0x378d9b[_0x27f4('0x43')]={'id':_0x328403[_0x27f4('0x43')]['id'],'name':_0x328403[_0x27f4('0x43')][_0x27f4('0x3f')]};}var _0x1bdf2a=md5(JSON['stringify'](_0x378d9b));if(_0x328403[_0x27f4('0x3')]!==_0x1bdf2a){_0x328403[_0x27f4('0x3')]=_0x1bdf2a;emit(util[_0x27f4('0x79')](_0x27f4('0x7a'),_0x378d9b['name']),_0x27f4('0x7b'),_0x378d9b);}}}function emitCampaignSummary(_0x363f50){if(_0x363f50[_0x27f4('0x4c')]==='ivr'){emit(util[_0x27f4('0x79')]('campaign:ivr:%s',_0x363f50[_0x27f4('0x3f')]),'campaign:save',_0x363f50);}}function checkGetDataPredictive(_0x1e9100){if(isNotNull(_0x1e9100)&&!_[_0x27f4('0x7c')](_0x1e9100)){loggerPredictive['info'](_0x27f4('0x7d'));loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x7f'),_0x1e9100['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x27f4('0x80'),_0x1e9100[_0x27f4('0x81')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x82'),_0x1e9100[_0x27f4('0x6a')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x83'),_0x1e9100[_0x27f4('0x84')]);loggerPredictive[_0x27f4('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e9100[_0x27f4('0x85')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x86'),_0x1e9100[_0x27f4('0x87')]);loggerPredictive['info'](_0x27f4('0x88'));if(_0x1e9100[_0x27f4('0x70')]>0x0){if(!_[_0x27f4('0x3e')](_0x1e9100[_0x27f4('0x87')])&&_0x1e9100[_0x27f4('0x87')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x27f4('0x3e')](_0x1e9100[_0x27f4('0x85')])&&_0x1e9100['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x27f4('0x89'));}else{loggerPredictive[_0x27f4('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x27f4('0x8a'));}return![];}function mergeDataErlangB(_0x3cfe8c){return function(_0x2e3b7b){loggerPredictive['info'](_0x27f4('0x8b'));loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x8c'),_0x2e3b7b[_0x27f4('0x72')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x8d'),_0x2e3b7b[_0x27f4('0x73')]);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x8e'),_0x2e3b7b[_0x27f4('0x74')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e3b7b[_0x27f4('0x75')]);loggerPredictive[_0x27f4('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e3b7b[_0x27f4('0x74')]);loggerPredictive[_0x27f4('0x7e')]('---------------------------');_['merge'](_0x3cfe8c,_0x2e3b7b);};}function getDiff(_0x558650){var _0x2ffe70=moment()[_0x27f4('0x49')](0x0);var _0x2714b1=moment(_0x558650)[_0x27f4('0x49')](0x0);return _0x2ffe70['diff'](_0x2714b1,_0x27f4('0x4b'));}function ifInterval(_0x258295,_0x40926){if(_['isUndefined'](_0x40926)){return![];}return getDiff(_0x40926)<_0x258295*0x3c;}function freeVariablesPredictive(_0x1aba69){if(isNotNull(_0x1aba69)){if(!_['isUndefined'](_0x1aba69[_0x27f4('0x8f')])){_0x1aba69['startProgressive']=undefined;loggerPredictive[_0x27f4('0x7e')](_0x1aba69['name'],_0x27f4('0x90'));}if(!_[_0x27f4('0x3e')](_0x1aba69[_0x27f4('0x28')])){_0x1aba69[_0x27f4('0x28')]=undefined;loggerPredictive[_0x27f4('0x7e')](_0x1aba69[_0x27f4('0x3f')],_0x27f4('0x91'));}if(!_[_0x27f4('0x3e')](_0x1aba69[_0x27f4('0x92')])){clearInterval(_0x1aba69['handlePredictive']);_0x1aba69['handlePredictive']=undefined;loggerPredictive[_0x27f4('0x7e')](_0x1aba69['name'],_0x27f4('0x93'));}}}function erlangb(_0x3ca820,_0x5f5392){if(_0x5f5392===0x0){return 0x0;}var _0x122781=0x1;for(var _0x34ab47=0x1;_0x34ab47<=_0x5f5392;_0x34ab47+=0x1){_0x122781=0x1+_0x122781*_0x34ab47/_0x3ca820;}return 0x1/_0x122781;}function isVoiceQueueOutbound(_0x10f877){return _0x10f877===_0x27f4('0x4d');}function isNotPreview(_0x2ea1b7){return _0x2ea1b7!==_0x27f4('0x1d');}function isCampaignIvr(_0x36f51e){return _0x36f51e==='ivr';}function getCallerId(_0x4e3ef1,_0x4c3424,_0xb8cdfb){if(!_[_0x27f4('0x3e')](_0xb8cdfb)&&typeof _0xb8cdfb===_0x27f4('0x94')&&!_[_0x27f4('0x7c')](_0xb8cdfb)){if(!_[_0x27f4('0x3e')](_0x4c3424)&&typeof _0x4c3424===_0x27f4('0x94')&&!_[_0x27f4('0x7c')](_0x4c3424)){return util[_0x27f4('0x79')](_0x27f4('0x95'),_0x4c3424,_0xb8cdfb);}return util[_0x27f4('0x79')](_0x27f4('0x95'),_0xb8cdfb,_0xb8cdfb);}if(!_['isUndefined'](_0x4e3ef1)&&typeof _0x4e3ef1===_0x27f4('0x94')&&!_[_0x27f4('0x7c')](_0x4e3ef1)){return _0x4e3ef1;}return _0x27f4('0x96');}function loggerCatchQueueSummary(_0x2f41cc,_0x470a8f){return function(_0x432643){freeVariablesPredictive(_0x470a8f);emitVoiceQueueSummary(_0x470a8f);emitCampaignSummary(_0x470a8f);loggerSyncQueueSummary[_0x27f4('0x97')](_0x2f41cc,util['inspect'](_0x432643,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4ceb0d,_0x5e7e6b){return function(_0x296d85){loggerPredictive[_0x27f4('0x97')](_0x5e7e6b[_0x27f4('0x3f')],_0x4ceb0d);loggerPredictive[_0x27f4('0x97')](_0x296d85[_0x27f4('0x98')]);freeVariablesPredictive(_0x5e7e6b);};}function loggerCatch(_0x1f9d29){return function(_0x1b255f){logger['error'](_0x1f9d29,util[_0x27f4('0x99')](_0x1b255f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4fa482){return _0x4fa482&&!_[_0x27f4('0x3e')](_0x4fa482)&&_0x4fa482[_0x27f4('0x9a')]>0x0;}function decremetOriginate(_0x5da2e1){if(!_[_0x27f4('0x3e')](_0x5da2e1)&&_0x5da2e1!==null){if(typeof _0x5da2e1[_0x27f4('0x71')]!==_0x27f4('0x9b')){if(_0x5da2e1['originated']>0x0){_0x5da2e1['originated']-=0x1;}else{logger[_0x27f4('0x97')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x27f4('0x97')](_0x27f4('0x9c'));}}function checkContactLowerLimitOriginate(_0x5dcbf1,_0x111c29,_0x4dd7db){if(_0x111c29>_0x4dd7db){for(var _0x4cf734=0x0;_0x4cf734<_0x111c29-_0x4dd7db;_0x4cf734+=0x1){decremetOriginate(_0x5dcbf1);}}}function loggerGetContactDialer(_0x147b88,_0x19666b,_0x972bd1){return function(_0x16103c){checkContactLowerLimitOriginate(_0x19666b,_0x972bd1,0x0);logger[_0x27f4('0x97')](_0x147b88,util['inspect'](_0x16103c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x159ea4){return function(_0x32e54c){if(isNotNull(_0x32e54c)&&isNotNull(_0x32e54c[0x0])){if(_0x32e54c[0x0][_0x27f4('0x9d')]>0x0){_0x159ea4['message']=_0x27f4('0x9e');logger[_0x27f4('0x7e')](_0x27f4('0x9f')+_0x159ea4[_0x27f4('0x3f')],_0x32e54c[0x0][_0x27f4('0x9d')],'contacts');}else{_0x159ea4[_0x27f4('0x41')]=_0x27f4('0xa0');logger[_0x27f4('0x7e')](_0x27f4('0xa1')+_0x159ea4['name']);}}};}function notSendMessagesQueue(_0x45a161){if(_0x45a161[_0x27f4('0xa2')]){freeVariablesPredictive(_0x45a161);if(_0x45a161['originated']===0x0&&_0x45a161[_0x27f4('0xa3')]===0x0&&_0x45a161[_0x27f4('0x57')]===0x0&&(_0x45a161[_0x27f4('0x52')]||0x0)===0x0){_0x45a161['sendMessageOneNotActive']=![];_0x45a161['available']=0x0;_0x45a161['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x27f4('0x97')](_0x27f4('0xa4'),_0x45a161['name'],'is\x20not\x20active');}else{_0x45a161[_0x27f4('0x41')]=_0x27f4('0xa5');loggerSyncQueueSummary[_0x27f4('0x97')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x45a161[_0x27f4('0x3f')],_0x27f4('0xa6'));}emitVoiceQueueSummary(_0x45a161);}}function notSendMessagesCampaign(_0x5cbd8e){if(_0x5cbd8e[_0x27f4('0xa2')]){if(_0x5cbd8e[_0x27f4('0x71')]===0x0){_0x5cbd8e[_0x27f4('0xa2')]=![];_0x5cbd8e[_0x27f4('0x41')]=_0x27f4('0x42');loggerSyncQueueSummary['error'](_0x27f4('0xa7'),_0x5cbd8e[_0x27f4('0x3f')],_0x27f4('0xa8'));}else{_0x5cbd8e[_0x27f4('0x41')]=_0x27f4('0xa5');loggerSyncQueueSummary['error'](_0x27f4('0xa7'),_0x5cbd8e[_0x27f4('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x5cbd8e);}}function createObjHistory(_0x10c5a8,_0x2a6316,_0x2b4d60,_0x3deda4,_0x3c1b1e){_0x10c5a8[_0x27f4('0x41')]=_0x2b4d60;var _0x3a33e2=new Action(_0x10c5a8,_0x2a6316);var _0x5369cf=new History(_0x3a33e2);_0x5369cf['state']=_0x3deda4;_0x5369cf[_0x27f4('0xa9')]=_0x3c1b1e;_0x5369cf[_0x27f4('0xaa')]=_0x3a33e2[_0x27f4('0xab')];return _0x5369cf;}Dialer[_0x27f4('0x19')]['loopClearZombieChannels']=function(){var _0x4c3c8c=this;setInterval(function(){_0x4c3c8c[_0x27f4('0xac')](_0x4c3c8c[_0x27f4('0x26')],'[uniqueid]');_0x4c3c8c[_0x27f4('0xac')](_0x4c3c8c['actions'],_0x27f4('0xad'));},0x32c8);};Dialer['prototype'][_0x27f4('0xac')]=function(_0x237a19,_0x526ccb){var _0x5ab874=this;for(var _0x1e489c in _0x237a19){if(typeof _0x237a19[_0x1e489c]!=='undefined'){this[_0x27f4('0x1c')][_0x27f4('0x1a')](function(){if(!_[_0x27f4('0xae')](_0x237a19[_0x1e489c])){return ami[_0x27f4('0xaf')]({'action':'status','channel':_0x237a19[_0x1e489c]['channel']})['catch'](function(_0x5587df){if(_0x5587df[_0x27f4('0x41')]===_0x27f4('0xb0')){setTimeout(function(){if(_0x237a19[_0x1e489c]&&_0x237a19[_0x1e489c][_0x27f4('0x4c')]!=='ivr'){_0x5ab874['updateOriginated'](_0x5ab874[_0x27f4('0x1e')][_0x237a19[_0x1e489c][_0x27f4('0xb1')]]);logger[_0x27f4('0x97')](_0x27f4('0xb2'),_0x526ccb,_0x1e489c,_0x237a19[_0x1e489c][_0x27f4('0xb1')]);delete _0x237a19[_0x1e489c];}if(_0x237a19[_0x1e489c]&&_0x237a19[_0x1e489c][_0x27f4('0x4c')]==='ivr'){_0x5ab874['updateOriginated'](_0x5ab874[_0x27f4('0x1f')][_0x237a19[_0x1e489c][_0x27f4('0xb1')]]);logger['error'](_0x27f4('0xb3'),_0x526ccb,_0x1e489c,_0x237a19[_0x1e489c][_0x27f4('0xb1')]);delete _0x237a19[_0x1e489c];}},0x2328);}});}});}}};Dialer[_0x27f4('0x19')][_0x27f4('0xb4')]=function(_0x5e10be){return BPromise['resolve']()['then'](cmHopper[_0x27f4('0xb4')](_0x5e10be))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xb6')));};Dialer['prototype'][_0x27f4('0xb7')]=function(_0x4e86da){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopperBlack[_0x27f4('0xb7')](_0x4e86da))['catch'](loggerCatch(_0x27f4('0xb9')));};Dialer['prototype'][_0x27f4('0xba')]=function(_0x248838){return BPromise['resolve']()[_0x27f4('0x3c')](cmHopperBlack[_0x27f4('0xba')](_0x248838))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xbb')));};Dialer[_0x27f4('0x19')][_0x27f4('0xbc')]=function(_0x2713e6){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopperHistory[_0x27f4('0xbd')](_0x2713e6))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xbe')));};Dialer[_0x27f4('0x19')][_0x27f4('0xbf')]=function(_0x47b619){return BPromise['resolve']()[_0x27f4('0x3c')](cmHopper['rescheduleContact'](_0x47b619))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x27f4('0x19')][_0x27f4('0xc0')]=function(_0x576e15,_0xc06cf1,_0x224b5a){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopper[_0x27f4('0xc0')](_0x576e15,_0xc06cf1,_0x224b5a))['catch'](loggerCatch(_0x27f4('0xc1')));};Dialer[_0x27f4('0x19')]['getContactDialer']=function(_0x32e29b,_0x207d17,_0x166853,_0x445105,_0x178a8c){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopper[_0x27f4('0xc2')](_0x32e29b,_0x207d17,_0x166853,_0x445105))['catch'](function(_0x31b642){_0x178a8c['temp']-=_0x166853;_0x178a8c['temp']=_0x178a8c[_0x27f4('0xc3')]>0x0?_0x178a8c[_0x27f4('0xc3')]:0x0;loggerCatch(_0x27f4('0xc4'))(_0x31b642);});};Dialer['prototype'][_0x27f4('0xc5')]=function(_0x636d2c,_0x4bc0e0,_0x5de8b9,_0x270b35){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopper['getContactDialerIvr'](_0x636d2c,_0x4bc0e0,_0x5de8b9))[_0x27f4('0xb5')](function(_0x499943){_0x270b35[_0x27f4('0xc3')]-=_0x4bc0e0;_0x270b35[_0x27f4('0xc3')]=_0x270b35[_0x27f4('0xc3')]>0x0?_0x270b35[_0x27f4('0xc3')]:0x0;loggerCatch(_0x27f4('0xc6'))(_0x499943);});};Dialer[_0x27f4('0x19')][_0x27f4('0xc7')]=function(_0x3bfedd){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](voiceQueueRt[_0x27f4('0xc7')](_0x3bfedd))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xc8')));};Dialer[_0x27f4('0x19')]['moveContactManagedDialer']=function(_0x478ef6){return BPromise[_0x27f4('0xb8')]()['then'](cmHopper['moveContactManagedDialer'](_0x478ef6))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xc9')));};Dialer['prototype'][_0x27f4('0xca')]=function(_0x7f8d2a){return BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](cmHopperHistory[_0x27f4('0xca')](_0x7f8d2a))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xcb')));};Dialer['prototype'][_0x27f4('0xcc')]=function(_0x2b6a90){if(!_[_0x27f4('0x3e')](_0x2b6a90)&&_0x2b6a90!==null){if(typeof _0x2b6a90[_0x27f4('0x71')]!==_0x27f4('0x9b')){if(_0x2b6a90[_0x27f4('0x71')]>0x0){_0x2b6a90[_0x27f4('0x71')]-=0x1;}else{logger[_0x27f4('0x97')](_0x27f4('0xcd'));}}}else{logger[_0x27f4('0x97')](_0x27f4('0xce'));}};Dialer[_0x27f4('0x19')][_0x27f4('0xcf')]=function(_0x239f11,_0x4bceb6){var _0x1f1b68=this;return function(_0x3d79b8){_0x1f1b68[_0x27f4('0xcc')](_0x4bceb6);logger['error'](_0x239f11,util[_0x27f4('0x99')](_0x3d79b8,{'showHidden':![],'depth':null}));};};Dialer[_0x27f4('0x19')]['emptyContact']=function(_0x2b8166,_0x3358df,_0x343ef2){var _0x58167d={'state':0x19,'statedesc':_0x27f4('0xd0')};this['updateOriginated'](_0x3358df);this['saveInDb'](_[_0x27f4('0xd1')](_0x58167d,_[_0x27f4('0xd2')](_0x343ef2,[_0x27f4('0xd3'),_0x27f4('0xd4'),_0x27f4('0xd5'),_0x27f4('0xd6'),'CampaignId'])),_0x27f4('0xd7'),'[emptyContact]');logger[_0x27f4('0x97')](_0x2b8166);};Dialer[_0x27f4('0x19')]['isSuccess']=function(_0x4e3917){return _0x4e3917==='Success';};Dialer[_0x27f4('0x19')]['isTrunkReachable']=function(_0x3df6c5){return!_[_0x27f4('0x3e')](_0x3df6c5)&&_0x3df6c5&&!_['isUndefined'](_0x3df6c5[_0x27f4('0x3f')])&&!_[_0x27f4('0x3e')](_0x3df6c5['active'])&&_0x3df6c5[_0x27f4('0x77')]&&(this[_0x27f4('0x21')][util[_0x27f4('0x79')](_0x27f4('0xd8'),_0x3df6c5[_0x27f4('0x3f')])][_0x27f4('0xd9')]===_0x27f4('0xda')||this[_0x27f4('0x21')][util[_0x27f4('0x79')](_0x27f4('0xd8'),_0x3df6c5[_0x27f4('0x3f')])][_0x27f4('0xd9')]===_0x27f4('0xdb'));};Dialer['prototype'][_0x27f4('0xdc')]=function(_0x706603,_0x35255f,_0x5ac1f2){this[_0x27f4('0xca')](_0x706603)[_0x27f4('0xb5')](loggerCatch(_0x35255f));this['moveContactManagedDialer'](_0x706603)['catch'](loggerCatch(_0x5ac1f2));};Dialer[_0x27f4('0x19')]['syncVarSet']=function(_0x1c478a){var _0x192f27=this[_0x27f4('0x26')][_0x1c478a[_0x27f4('0xdd')]];var _0x5e6ba5;if(!_[_0x27f4('0xae')](_0x1c478a)&&!_[_0x27f4('0xae')](_0x1c478a[_0x27f4('0xde')])&&!_[_0x27f4('0xae')](_0x1c478a[_0x27f4('0xde')][_0x27f4('0xdf')])&&_0x1c478a['exten']===_0x27f4('0xe0')&&_0x192f27){if(_0x192f27[_0x27f4('0x4c')]!==_0x27f4('0xe1')&&this[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0xe2')]&&_0x1c478a[_0x27f4('0xe3')]==='HANGUP'){delete this[_0x27f4('0x26')][_0x1c478a[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][_0x192f27['queue']]);this[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5e')]+=0x1;this[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;_0x5e6ba5=new Hangup(_0x192f27,_0x1c478a);_0x5e6ba5['state']=0x12;_0x5e6ba5[_0x27f4('0xa9')]=_0x27f4('0xe4');_0x5e6ba5['membername']='AMD';ami[_0x27f4('0xe5')](_0x27f4('0xe6'),ut[_0x27f4('0xe7')](_0x5e6ba5,'amd'));this[_0x27f4('0xdc')](_0x5e6ba5,_0x27f4('0xe8'),_0x27f4('0xe9'));}if(_0x192f27[_0x27f4('0x4c')]!==_0x27f4('0xe1')&&this[_0x27f4('0x1e')][_0x192f27['queue']][_0x27f4('0xe2')]&&_0x1c478a[_0x27f4('0xe3')]===_0x27f4('0xea')){var _0x353076=this;return new BPromise(function(_0x1b7573,_0x4e8291){delete _0x353076[_0x27f4('0x26')][_0x1c478a['uniqueid']];_0x353076[_0x27f4('0xcc')](_0x353076[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]]);_0x353076[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5e')]+=0x1;_0x353076[_0x27f4('0x1e')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;var _0x496ede=_0x353076[_0x27f4('0x1e')][_0x192f27['queue']];var _0x3245bc=new Hangup(_0x192f27,_0x1c478a);_0x3245bc[_0x27f4('0xeb')]=0x13;_0x3245bc[_0x27f4('0xa9')]=_0x27f4('0xec');_0x3245bc[_0x27f4('0xed')]=_0x27f4('0xee');_0x3245bc[_0x27f4('0xef')]+=0x1;_0x3245bc[_0x27f4('0xf0')]+=0x1;_0x3245bc[_0x27f4('0xf1')]=!![];ami['emit'](_0x27f4('0xe6'),ut[_0x27f4('0xe7')](_0x3245bc,'amd'));_0x353076[_0x27f4('0xca')](_0x3245bc)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xf2')));if(_0x3245bc['countbusyretry']+_0x3245bc[_0x27f4('0xf3')]+_0x3245bc[_0x27f4('0xf4')]+_0x3245bc[_0x27f4('0xf5')]+_0x3245bc['countdropretry']+_0x3245bc[_0x27f4('0xf6')]+_0x3245bc[_0x27f4('0xef')]+_0x3245bc[_0x27f4('0xf7')]>=_0x496ede[_0x27f4('0xf8')]){_0x353076[_0x27f4('0xf9')](_0x3245bc,_0x1b7573,_0x4e8291,'reason19\x20machine....');}else{if(_0x3245bc[_0x27f4('0xef')]>=_0x496ede[_0x27f4('0xfa')]){_0x353076[_0x27f4('0xfb')](_0x3245bc,_0x1b7573,_0x4e8291,_0x27f4('0xfc'));}else{_0x353076[_0x27f4('0xbf')]({'active':![],'countmachineretry':_0x3245bc['countmachineretry'],'scheduledat':moment()[_0x27f4('0xfd')](_0x496ede[_0x27f4('0xfe')],'minutes')[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x3245bc['ContactId'],'ListId':_0x3245bc[_0x27f4('0xd4')],'VoiceQueueId':_0x3245bc[_0x27f4('0xd6')]||undefined,'CampaignId':_0x3245bc[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x101')));_0x1b7573({'reschedule':0x1});}}});}if(_0x192f27[_0x27f4('0x4c')]===_0x27f4('0xe1')&&this['campaigns'][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0xe2')]&&_0x1c478a[_0x27f4('0xe3')]===_0x27f4('0x102')){delete this['uniqueId'][_0x1c478a[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this['campaigns'][_0x192f27['queue']]);_0x5e6ba5=new Hangup(_0x192f27,_0x1c478a);_0x5e6ba5['state']=0x12;_0x5e6ba5[_0x27f4('0xa9')]=_0x27f4('0xe4');_0x5e6ba5[_0x27f4('0xed')]='AMD';ami[_0x27f4('0xe5')](_0x27f4('0xe6'),ut[_0x27f4('0xe7')](_0x5e6ba5,_0x27f4('0xf1')));this[_0x27f4('0xdc')](_0x5e6ba5,_0x27f4('0x103'),_0x27f4('0x104'));}if(_0x192f27[_0x27f4('0x4c')]===_0x27f4('0xe1')&&this[_0x27f4('0x1f')][_0x192f27[_0x27f4('0xb1')]]['dialAMDActive']&&_0x1c478a[_0x27f4('0xe3')]==='MACHINE'){var _0x353076=this;return new BPromise(function(_0x1fbabd,_0xb104cb){delete _0x353076['uniqueId'][_0x1c478a[_0x27f4('0xdd')]];_0x353076[_0x27f4('0xcc')](_0x353076[_0x27f4('0x1f')][_0x192f27[_0x27f4('0xb1')]]);_0x353076[_0x27f4('0x1f')][_0x192f27['queue']][_0x27f4('0x5e')]+=0x1;_0x353076[_0x27f4('0x1f')][_0x192f27[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;var _0x3b7f98=_0x353076[_0x27f4('0x1f')][_0x192f27['queue']];var _0x2cab6c=new Hangup(_0x192f27,_0x1c478a);_0x2cab6c[_0x27f4('0xeb')]=0x13;_0x2cab6c[_0x27f4('0xa9')]=_0x27f4('0xec');_0x2cab6c[_0x27f4('0xed')]=_0x27f4('0xee');_0x2cab6c[_0x27f4('0xef')]+=0x1;_0x2cab6c[_0x27f4('0xf0')]+=0x1;_0x2cab6c[_0x27f4('0xf1')]=!![];ami[_0x27f4('0xe5')](_0x27f4('0xe6'),ut['buildObj'](_0x2cab6c,_0x27f4('0xf1')));_0x353076[_0x27f4('0xca')](_0x2cab6c)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xf2')));if(_0x2cab6c['countbusyretry']+_0x2cab6c[_0x27f4('0xf3')]+_0x2cab6c[_0x27f4('0xf4')]+_0x2cab6c[_0x27f4('0xf5')]+_0x2cab6c[_0x27f4('0x105')]+_0x2cab6c[_0x27f4('0xf6')]+_0x2cab6c[_0x27f4('0xef')]+_0x2cab6c['countagentrejectretry']>=_0x3b7f98[_0x27f4('0xf8')]){_0x353076[_0x27f4('0xf9')](_0x2cab6c,_0x1fbabd,_0xb104cb,'reason19\x20machine....');}else{if(_0x2cab6c[_0x27f4('0xef')]>=_0x3b7f98[_0x27f4('0xfa')]){_0x353076['createStateFinal'](_0x2cab6c,_0x1fbabd,_0xb104cb,_0x27f4('0xfc'));}else{_0x353076[_0x27f4('0xbf')]({'active':![],'countmachineretry':_0x2cab6c['countmachineretry'],'scheduledat':moment()[_0x27f4('0xfd')](_0x3b7f98[_0x27f4('0xfe')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x2cab6c[_0x27f4('0xd3')],'ListId':_0x2cab6c[_0x27f4('0xd4')],'VoiceQueueId':_0x2cab6c['VoiceQueueId']||undefined,'CampaignId':_0x2cab6c['CampaignId']||undefined})['catch'](loggerCatch(_0x27f4('0x101')));_0x1fbabd({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x27f4('0x33')]=function(_0x9e1962){var _0x8b01e6=this[_0x27f4('0x26')][_0x9e1962[_0x27f4('0xdd')]];var _0xafdfd6=this;var _0x3a7c08;if(_0x8b01e6&&_0x8b01e6[_0x27f4('0x4c')]===_0x27f4('0xe1')){delete this['uniqueId'][_0x9e1962[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1f')][_0x8b01e6[_0x27f4('0xb1')]]);this[_0x27f4('0x1f')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x107')]+=0x1;_0x3a7c08=new Hangup(_0x8b01e6,_0x9e1962);this['createHistory'](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x108')));this[_0x27f4('0x109')](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x10a')));}if(_0x8b01e6&&_0x8b01e6['type']!==_0x27f4('0xe1')&&isNotNull(this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x10b')])){delete this[_0x27f4('0x26')][_0x9e1962[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]]);this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x5e')]+=0x1;this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x5d')]+=0x1;_0x3a7c08=new Hangup(_0x8b01e6,_0x9e1962);_0x3a7c08[_0x27f4('0xeb')]=0x10;_0x3a7c08[_0x27f4('0xa9')]=_0x27f4('0x10c');_0x3a7c08[_0x27f4('0xed')]=_0x27f4('0x10d');this['createHistory'](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x108')));this[_0x27f4('0x109')](_0x3a7c08)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x10a')));}if(_0x8b01e6&&_0x8b01e6[_0x27f4('0x4c')]!=='ivr'&&!isNotNull(this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x10b')])){delete this[_0x27f4('0x26')][_0x9e1962['uniqueid']];this[_0x27f4('0xcc')](this['voiceQueues'][_0x8b01e6[_0x27f4('0xb1')]]);this[_0x27f4('0x1e')][_0x8b01e6[_0x27f4('0xb1')]][_0x27f4('0x69')]+=0x1;_0x3a7c08=new Hangup(_0x8b01e6,_0x9e1962);_0x3a7c08['state']=0xc;_0x3a7c08[_0x27f4('0xa9')]=_0x9e1962[_0x27f4('0x10e')];_0x3a7c08[_0x27f4('0xed')]=_0x27f4('0x10f');this[_0x27f4('0xca')](_0x3a7c08)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x27f4('0x109')](_0x3a7c08)['catch'](loggerCatch(_0x27f4('0x10a')));}};Dialer['prototype'][_0x27f4('0x110')]=function(_0x2d961a){var _0xf5fdca=this[_0x27f4('0x26')][_0x2d961a['uniqueid']];var _0x5dea3f=this;if(this['voiceQueues'][_0x2d961a[_0x27f4('0xb1')]]){if(_0xf5fdca&&_0xf5fdca[_0x27f4('0x4c')]!=='ivr'){delete this[_0x27f4('0x26')][_0x2d961a[_0x27f4('0xdd')]];this[_0x27f4('0x1e')][_0x2d961a[_0x27f4('0xb1')]]['outboundAnswerCallsDay']+=0x1;var _0x13b4a9=new AgentComplete(_0xf5fdca,_0x2d961a);if(_0x2d961a['reason']===_0x27f4('0x111')){_0x13b4a9[_0x27f4('0x112')]=this[_0x27f4('0x1e')][_0x2d961a[_0x27f4('0xb1')]][_0x27f4('0x113')]&&this[_0x27f4('0x1e')][_0x2d961a[_0x27f4('0xb1')]][_0x27f4('0x114')]?moment()[_0x27f4('0x79')](_0x27f4('0xff')):undefined;}this['createHistory'](_0x13b4a9)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x115')));this[_0x27f4('0x109')](_0x13b4a9)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x116')));}}};Dialer[_0x27f4('0x19')]['syncAgentConnect']=function(_0x1ba0e2){if(this['voiceQueues'][_0x1ba0e2['queue']]){if(this[_0x27f4('0x26')][_0x1ba0e2['uniqueid']]&&this[_0x27f4('0x26')][_0x1ba0e2[_0x27f4('0xdd')]][_0x27f4('0x4c')]!==_0x27f4('0xe1')){this[_0x27f4('0xcc')](this['voiceQueues'][_0x1ba0e2[_0x27f4('0xb1')]]);this[_0x27f4('0x26')][_0x1ba0e2[_0x27f4('0xdd')]]['answertime']=moment()[_0x27f4('0x79')](_0x27f4('0xff'));}}};Dialer[_0x27f4('0x19')][_0x27f4('0x117')]=function(_0x30dbe0){this[_0x27f4('0xca')](_0x30dbe0)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x115')));this[_0x27f4('0x109')](_0x30dbe0)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x118')));};Dialer[_0x27f4('0x19')][_0x27f4('0x2e')]=function(_0x562817){var _0x127aa7=this[_0x27f4('0x26')][_0x562817[_0x27f4('0xdd')]];var _0xde42b9=this;if(this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]]){if(_0x127aa7&&_0x127aa7[_0x27f4('0x4c')]!==_0x27f4('0xe1')){delete this[_0x27f4('0x26')][_0x562817[_0x27f4('0xdd')]];this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]]);_0x127aa7[_0x27f4('0x119')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));var _0x34946b=new QueueCallerAbandon(_0x127aa7,_0x562817);if(getSeconds(_0x127aa7[_0x27f4('0x119')],_0x127aa7[_0x27f4('0x11a')])>=_0x127aa7[_0x27f4('0x11b')]){this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x6a')]+=0x1;this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x11c')]+=0x1;this['voiceQueues'][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x6c')]+=0x1;_0x34946b[_0x27f4('0xeb')]=0xa;_0x34946b[_0x27f4('0xa9')]=_0x27f4('0x11d');_0x34946b[_0x27f4('0x11e')]=_0x27f4('0x11f');_0x34946b[_0x27f4('0x112')]=this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x113')]?moment()['format'](_0x27f4('0xff')):undefined;_0x34946b[_0x27f4('0x105')]+=0x1;_0x34946b['countglobal']+=0x1;if(_0x34946b[_0x27f4('0x105')]>=this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x120')]){this[_0x27f4('0x117')](_0x34946b);}else{this[_0x27f4('0xbf')]({'active':![],'countdropretry':_0x34946b[_0x27f4('0x105')],'scheduledat':moment()[_0x27f4('0xfd')](this['voiceQueues'][_0x562817[_0x27f4('0xb1')]][_0x27f4('0x121')],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x127aa7['ContactId'],'ListId':_0x127aa7[_0x27f4('0xd4')],'VoiceQueueId':_0x127aa7[_0x27f4('0xd6')]||undefined,'CampaignId':_0x127aa7[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch('[rescheduleContact][Drop]'));var _0x42d20f=new History(_0x34946b);_0x42d20f[_0x27f4('0xeb')]=0xa;_0x42d20f[_0x27f4('0xa9')]=_0x27f4('0x11d');_0x42d20f[_0x27f4('0xab')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));_0x42d20f['endtime']=_0x42d20f['starttime'];_0x42d20f[_0x27f4('0x122')]=_0x34946b[_0x27f4('0x122')];_0x42d20f[_0x27f4('0x123')]=_0x34946b[_0x27f4('0x123')];this[_0x27f4('0xca')](_0x42d20f)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x124')));}}else{this[_0x27f4('0x1e')][_0x562817['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x27f4('0x1e')][_0x562817[_0x27f4('0xb1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x34946b['state']=0xb;_0x34946b['statedesc']='Abandoned';_0x34946b[_0x27f4('0x11e')]=_0x27f4('0x125');_0x34946b[_0x27f4('0xf6')]+=0x1;_0x34946b[_0x27f4('0xf0')]+=0x1;if(_0x34946b[_0x27f4('0xf6')]>=this['voiceQueues'][_0x562817[_0x27f4('0xb1')]]['dialAbandonedMaxRetry']){this[_0x27f4('0x117')](_0x34946b);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x34946b[_0x27f4('0xf6')],'scheduledat':moment()[_0x27f4('0xfd')](this[_0x27f4('0x1e')][_0x562817['queue']][_0x27f4('0x126')],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x127aa7[_0x27f4('0xd3')],'ListId':_0x127aa7[_0x27f4('0xd4')],'VoiceQueueId':_0x127aa7[_0x27f4('0xd6')]||undefined,'CampaignId':_0x127aa7[_0x27f4('0x100')]||undefined})['catch'](loggerCatch(_0x27f4('0x127')));var _0x42d20f=new History(_0x34946b);_0x42d20f['state']=0xb;_0x42d20f[_0x27f4('0xa9')]=_0x27f4('0x128');_0x42d20f[_0x27f4('0xab')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));_0x42d20f[_0x27f4('0xaa')]=_0x42d20f[_0x27f4('0xab')];_0x42d20f['calleridname']=_0x34946b[_0x27f4('0x122')];_0x42d20f[_0x27f4('0x123')]=_0x34946b[_0x27f4('0x123')];this[_0x27f4('0xca')](_0x42d20f)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x129')));}}}}};Dialer[_0x27f4('0x19')]['syncNewExten']=function(_0xcaf1e8){if(this['actions'][_0xcaf1e8[_0x27f4('0xdd')]]){this[_0x27f4('0x24')][_0xcaf1e8[_0x27f4('0xdd')]][_0x27f4('0x12a')]=_0xcaf1e8['channel'];}if(this[_0x27f4('0x26')][_0xcaf1e8[_0x27f4('0xdd')]]){this[_0x27f4('0x26')][_0xcaf1e8[_0x27f4('0xdd')]][_0x27f4('0x12a')]=_0xcaf1e8[_0x27f4('0x12a')];}};Dialer[_0x27f4('0x19')]['syncQueueMember']=function(_0x55e038){if(strategy[this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]][_0x27f4('0x4e')]]===_0x27f4('0x18')){if(this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]]&&_[_0x27f4('0xae')](this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12c')])&&_0x55e038[_0x27f4('0xd9')]==='1'&&_0x55e038[_0x27f4('0x12d')]==='0'){if(this[_0x27f4('0x20')][_0x55e038[_0x27f4('0x12e')]]){if(!this[_0x27f4('0x20')][_0x55e038['stateinterface']]['locked']){this['agents'][_0x55e038[_0x27f4('0x12e')]][_0x27f4('0x12c')]=!![];this['actions'][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12c')]=!![];this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12e')]=_0x55e038[_0x27f4('0x12e')];}}}}else if((strategy[this[_0x27f4('0x1e')][this['actions'][_0x55e038['actionid']][_0x27f4('0xb1')]][_0x27f4('0x4e')]]||'rrmemory')===_0x27f4('0x17')){if(this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]]){if(this[_0x27f4('0x20')][_0x55e038[_0x27f4('0x12e')]]){this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0x12e')]=_0x55e038[_0x27f4('0x12e')];if(_[_0x27f4('0xae')](this['queueBooked'][this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]])){this['queueBooked'][this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]]=[];}this['queueBooked'][this['actions'][_0x55e038[_0x27f4('0x12b')]][_0x27f4('0xb1')]]['push'](_[_0x27f4('0xd1')](_[_0x27f4('0xd2')](this[_0x27f4('0x24')][_0x55e038[_0x27f4('0x12b')]],['idHopper',_0x27f4('0x12e')]),{'status':_0x55e038['status'],'paused':_0x55e038[_0x27f4('0x12d')]}));}}}};function unlockQueueStatus(_0x5d3275,_0x401012){setTimeout(function(){if(_[_0x27f4('0x3e')](_0x5d3275[_0x27f4('0x12f')])){loggerBooked['error'](_0x27f4('0x130'),_0x401012);}_0x5d3275['queueStatusComplete']=!![];loggerBooked[_0x27f4('0x7e')](_0x27f4('0x131'),_0x401012,JSON[_0x27f4('0x48')](_['pick'](_0x5d3275,[_0x27f4('0x3f'),_0x27f4('0x12f')])));},0x1f3);}Dialer[_0x27f4('0x19')][_0x27f4('0x39')]=function(_0x1c72b2){var _0x425088=this;var _0x42be48=_0x425088['voiceQueues'][_0x425088[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]];if(strategy[this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]][_0x27f4('0x4e')]]===_0x27f4('0x18')){if(this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]&&this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]['stateinterface']){this[_0x27f4('0x1d')][_0x27f4('0x132')](this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0x133')],this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0x12e')])[_0x27f4('0xb5')](function(_0x57025d){logger[_0x27f4('0x97')](_0x27f4('0x134'),util[_0x27f4('0x99')](_0x57025d,{'showHidden':![],'depth':null}));})[_0x27f4('0x135')](function(){_0x425088[_0x27f4('0xcc')](_0x425088[_0x27f4('0x1e')][_0x425088['actions'][_0x1c72b2['actionid']][_0x27f4('0xb1')]]);_0x425088[_0x27f4('0x20')][_0x425088[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0x12e')]][_0x27f4('0x12c')]=![];delete _0x425088[_0x27f4('0x24')][_0x1c72b2['actionid']];unlockQueueStatus(_0x42be48);});}else{this[_0x27f4('0xcc')](this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0xb1')]]);this[_0x27f4('0xbf')]({'active':![],'ContactId':this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xd3')],'ListId':this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0xd4')],'VoiceQueueId':this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xd6')]||undefined,'CampaignId':this[_0x27f4('0x24')][_0x1c72b2['actionid']][_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x136')));delete this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]];unlockQueueStatus(_0x42be48);}}else if((strategy[this[_0x27f4('0x1e')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]['strategy']]||'rrmemory')===_0x27f4('0x17')){var _0x410c0e;if(this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]&&!_[_0x27f4('0x7c')](this[_0x27f4('0x29')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]])){if(this[_0x27f4('0x2a')][_0x425088[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]){this[_0x27f4('0x2a')][_0x425088[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]=this[_0x27f4('0x2a')][this['actions'][_0x1c72b2['actionid']][_0x27f4('0xb1')]]?this['queueBookedRR'][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]]['queue']]:this[_0x27f4('0x29')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]?this[_0x27f4('0x29')][this['actions'][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]][_0x27f4('0x137')]=this[_0x27f4('0x2a')][this[_0x27f4('0x24')][_0x1c72b2[_0x27f4('0x12b')]][_0x27f4('0xb1')]];for(var _0x2c57ee=0x0;_0x2c57ee=0x0;})[_0x27f4('0xb5')](myreject(_0x142ae8)));}}else{_0x5a7d50[_0x27f4('0x14f')](ami[_0x27f4('0xaf')]({'action':_0x27f4('0x154'),'command':util[_0x27f4('0x79')](_0x27f4('0x150'),_0x15f3e1,!_[_0x27f4('0x3e')](config[_0x27f4('0x14c')][_0x459d30])?_0x459d30:'')})[_0x27f4('0x3c')](function(_0x20bbad){return _0x20bbad[_0x27f4('0x152')][_0x27f4('0x155')](_0x27f4('0x153'))>=0x0;})[_0x27f4('0xb5')](myreject(_0x142ae8)));}BPromise[_0x27f4('0x156')](_0x5a7d50)['then'](function(_0x6237c5){var _0x2c68ec=_['some'](_0x6237c5);if(_0x2c68ec){return _0x38192c(_0x2c68ec);}else{_0x17abde[_0x27f4('0x41')]=_0x115225?_0x27f4('0x157'):_0x27f4('0x158');return _0x142ae8(msgResponse(_0x27f4('0x159'),'Failure','Global:\x20'+_0x115225+'\x20'+_0x523e2a+_0x27f4('0x15a')+util[_0x27f4('0x99')](_0x15f3e1,{'showHidden':![],'depth':null})+_0x27f4('0x15b')+_0x459d30));}})[_0x27f4('0xb5')](function(_0x31d9fa){return _0x142ae8(msgResponse(_0x27f4('0x147'),_0x27f4('0x149'),JSON[_0x27f4('0x48')](_0x31d9fa)));});});};Dialer[_0x27f4('0x19')][_0x27f4('0x15c')]=function(_0x5e5cfd){var _0x300b71=this;return function(){switch(_0x5e5cfd[_0x27f4('0x5a')]){case'progressive':freeVariablesPredictive(_0x5e5cfd);_0x300b71[_0x27f4('0x15d')](_0x5e5cfd,0x1);break;case _0x27f4('0x15e'):freeVariablesPredictive(_0x5e5cfd);_0x300b71[_0x27f4('0x15d')](_0x5e5cfd,_0x5e5cfd[_0x27f4('0x15f')]);break;case _0x27f4('0xa'):_0x300b71[_0x27f4('0xa')](_0x5e5cfd);break;case'booked':freeVariablesPredictive(_0x5e5cfd);_0x300b71[_0x27f4('0x15d')](_0x5e5cfd,0x1);break;default:freeVariablesPredictive(_0x5e5cfd);logger[_0x27f4('0x97')]('Queue',_0x5e5cfd[_0x27f4('0x3f')],_0x27f4('0x160'));}};};Dialer[_0x27f4('0x19')][_0x27f4('0x161')]=function(_0x3adebe){return BPromise[_0x27f4('0xb8')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x3adebe['id'],previewRecallmeReminderInterval))['then'](function(_0x22ee59){for(var _0xea59b1=0x0;_0xea59b1<_0x22ee59['length'];_0xea59b1++){var _0x473346=_0x22ee59[_0xea59b1]['Agent'][_0x27f4('0x3f')];if(_0x473346)io['to'](util['format'](_0x27f4('0x162'),_0x473346))[_0x27f4('0xe5')]('user:dialPreviewRecallReminder',{'hopper':_0x22ee59[_0xea59b1]});}})[_0x27f4('0xb5')](function(_0x43f0c6){});};Dialer['prototype'][_0x27f4('0x163')]=function(_0x46213b){var _0x5e1115=this;return function(){_0x5e1115[_0x27f4('0x164')](_0x46213b);};};Dialer['prototype'][_0x27f4('0x165')]=function(_0x15d1d9){var _0x111d5e=this;if(isNotPreview(_0x15d1d9[_0x27f4('0x5a')])){if(isVoiceQueueOutbound(_0x15d1d9[_0x27f4('0x4c')])&&isActive(_0x15d1d9[_0x27f4('0x59')])){_0x15d1d9[_0x27f4('0xa2')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x15d1d9,_0x15d1d9['loggedIn']))['then'](checkIsActive(_0x15d1d9,_0x15d1d9[_0x27f4('0x59')]))[_0x27f4('0x3c')](checkInterval(_0x15d1d9))['then'](_0x111d5e[_0x27f4('0x142')](_0x15d1d9))['then'](_0x111d5e[_0x27f4('0x146')](_0x15d1d9[_0x27f4('0x166')],_0x15d1d9[_0x27f4('0x167')],_0x15d1d9[_0x27f4('0x3f')],_0x15d1d9))[_0x27f4('0x3c')](_0x111d5e[_0x27f4('0x148')](_0x15d1d9['Interval'],_0x15d1d9[_0x27f4('0x167')],_0x15d1d9[_0x27f4('0x3f')],_0x15d1d9))['then'](_0x111d5e[_0x27f4('0x15c')](_0x15d1d9))[_0x27f4('0xb5')](loggerCatchQueueSummary(_0x27f4('0x168'),_0x15d1d9));}else{notSendMessagesQueue(_0x15d1d9);}}else{freeVariablesPredictive(_0x15d1d9);if(_0x15d1d9[_0x27f4('0x169')]){_0x111d5e[_0x27f4('0x161')](_0x15d1d9);}}};Dialer[_0x27f4('0x19')]['syncCampaigns']=function(){var _0x132b3e=this;var _0x362e7b;for(var _0x95dd3a in this[_0x27f4('0x1f')]){if(typeof this[_0x27f4('0x1f')][_0x95dd3a]!==_0x27f4('0x9b')){_0x362e7b=this['campaigns'][_0x95dd3a];if(isCampaignIvr(_0x362e7b[_0x27f4('0x4c')])&&isActive(_0x362e7b['active'])){_0x362e7b[_0x27f4('0xa2')]=!![];BPromise[_0x27f4('0xb8')]()[_0x27f4('0x3c')](checkIsActive(_0x362e7b,_0x362e7b['active']))[_0x27f4('0x3c')](checkInterval(_0x362e7b))['then'](_0x132b3e['checkIsTrunkReachable'](_0x362e7b))[_0x27f4('0x3c')](_0x132b3e['checkIfTime'](_0x362e7b[_0x27f4('0x166')],_0x362e7b['dialTimezone'],_0x362e7b[_0x27f4('0x3f')],_0x362e7b))[_0x27f4('0x3c')](_0x132b3e['checkIfTimeIntervals'](_0x362e7b['Interval'],_0x362e7b['dialTimezone'],_0x362e7b['name'],_0x362e7b))['then'](_0x132b3e['launchHandleIvr'](_0x362e7b))['catch'](loggerCatchQueueSummary(_0x27f4('0x16a'),_0x362e7b));}else{notSendMessagesCampaign(_0x362e7b);}}}};function getCallerIdRandom(_0x4ed9fc,_0x284399){var _0x3a5690;var _0x1a8b6e;var _0x409357;if(_0x284399<=0x0){_0x284399=0x1;}_0x3a5690=new RegExp(_0x27f4('0x16b')+_0x284399+'}$');_0x1a8b6e=Math[_0x27f4('0x16c')](0xa,_0x284399-0x1);_0x409357=Math[_0x27f4('0x16c')](0xa,_0x284399)-0x1;return util[_0x27f4('0x79')]('%s',_[_0x27f4('0x16d')](_0x4ed9fc,_0x3a5690,_[_0x27f4('0x16e')](_0x1a8b6e,_0x409357)));}function extractCalleridName(_0x14819a){var _0x2b3dd9=_0x14819a[_0x27f4('0x16f')](/"(.*?)"/);return _0x2b3dd9?_0x2b3dd9[0x1]:_0x14819a;}function extractCalleridNumber(_0x4d5a69){var _0xa37a03=_0x4d5a69[_0x27f4('0x16f')](/<(.*?)>/);return _0xa37a03?_0xa37a03[0x1]:_0x4d5a69;}Dialer[_0x27f4('0x19')][_0x27f4('0x170')]=function(_0x373dac,_0x7ad8fb){var _0x339bfd=this;var _0x22e937=uuid['v4']();this[_0x27f4('0x24')][_0x22e937]=new Action(_0x373dac,_0x7ad8fb,_0x22e937);return new BPromise(function(_0x17c01f,_0x65b1b1){if(_[_0x27f4('0x3e')](_0x373dac)&&typeof _0x373dac!==_0x27f4('0x171')){return _0x65b1b1(msgResponse(_0x27f4('0x172'),'Failure',_0x27f4('0x173')));}if(_[_0x27f4('0x3e')](_0x7ad8fb['Contact'][_0x27f4('0x174')])||_0x7ad8fb[_0x27f4('0x175')]['phone']===null){return _0x65b1b1(msgResponse(_0x27f4('0x172'),_0x27f4('0x149'),'contact\x20is\x20undefine'));}var _0x93cf48={'XMD-CALLERID':_0x339bfd[_0x27f4('0x24')][_0x22e937][_0x27f4('0x176')](),'XMD-AGI':_0x373dac['dialQueueProject']?util[_0x27f4('0x79')](_0x27f4('0x177'),ipAgi,_0x373dac[_0x27f4('0x10b')]):_0x27f4('0x178'),'XMD-AGIAFTER':_0x373dac[_0x27f4('0x113')]?util[_0x27f4('0x79')](_0x27f4('0x177'),ipAgi,_0x373dac[_0x27f4('0x113')]):_0x27f4('0x178'),'XMD-QUEUE':_0x373dac[_0x27f4('0x4c')]===_0x27f4('0x4d')?util[_0x27f4('0x79')](_0x27f4('0x179'),_0x373dac[_0x27f4('0x3f')],_0x373dac[_0x27f4('0x17a')]||'',_0x373dac[_0x27f4('0x114')]?'c':'',_0x373dac[_0x27f4('0x11b')]||0x3):_0x27f4('0x178'),'XMD-CONTACTID':_0x7ad8fb['ContactId'],'XMD-CDRTYPE':_0x27f4('0x7'),'CALLERID(all)':_0x339bfd[_0x27f4('0x24')][_0x22e937][_0x27f4('0x176')](),'XMD-AMD':_0x373dac[_0x27f4('0xe2')]?_0x27f4('0x17b'):_0x27f4('0x178'),'XMD-DESTINATION':_0x27f4('0xe0')};if(_0x373dac['dialAMDActive']){_0x93cf48[_0x27f4('0x17c')]=_0x373dac['dialAMDInitialSilence']||0x9c4;_0x93cf48[_0x27f4('0x17d')]=_0x373dac[_0x27f4('0x17e')]||0x5dc;_0x93cf48[_0x27f4('0x17f')]=_0x373dac['dialAMDAfterGreetingSilence']||0x320;_0x93cf48[_0x27f4('0x180')]=_0x373dac['dialAMDTotalAnalysisTime']||0x1388;_0x93cf48[_0x27f4('0x181')]=_0x373dac[_0x27f4('0x182')]||0x64;_0x93cf48['XMD-AMDBETWEENWORDSSILENCE']=_0x373dac['dialAMDBetweenWordsSilence']||0x32;_0x93cf48[_0x27f4('0x183')]=_0x373dac[_0x27f4('0x184')]||0x3;_0x93cf48[_0x27f4('0x185')]=_0x373dac[_0x27f4('0x186')]||0x100;_0x93cf48[_0x27f4('0x187')]=_0x373dac[_0x27f4('0x188')]||0x1388;}if(_0x373dac['type']===_0x27f4('0x4d')){_0x93cf48[_0x27f4('0x189')]=_0x7ad8fb['VoiceQueueId'];}else{_0x93cf48['XMD-CAMPAIGNID']=_0x7ad8fb[_0x27f4('0x100')];}for(var _0x2676f2 in _0x7ad8fb['Contact']){if(typeof _0x7ad8fb[_0x27f4('0x175')][_0x2676f2]!=='undefined'){if(isNotNull(_0x7ad8fb[_0x27f4('0x175')][_0x2676f2])&&_0x2676f2!=='id'&&_0x2676f2!==_0x27f4('0x18a')&&_0x2676f2!=='createdAt'&&_0x2676f2!=='updatedAt'){_0x93cf48[util[_0x27f4('0x79')](_0x27f4('0x18b'),_0x27f4('0x18c'),_[_0x27f4('0x18d')](_0x2676f2))]=_0x7ad8fb[_0x27f4('0x175')][_0x2676f2];}}}var _0x3c7562=_0x339bfd[_0x27f4('0x143')](_0x373dac[_0x27f4('0x76')])?getCallerId(_0x373dac[_0x27f4('0x76')][_0x27f4('0x78')],_0x373dac[_0x27f4('0x18e')],_0x373dac[_0x27f4('0x18f')]>0x0?getCallerIdRandom(_0x373dac['dialOriginateCallerIdNumber'],_0x373dac['dialRandomLastDigitCallerIdNumber']):_0x373dac[_0x27f4('0x190')]):getCallerId(_[_0x27f4('0xae')](_0x373dac[_0x27f4('0x191')])?_0x373dac[_0x27f4('0x76')][_0x27f4('0x78')]:_0x373dac[_0x27f4('0x191')][_0x27f4('0x78')],_0x373dac[_0x27f4('0x18e')],_0x373dac[_0x27f4('0x18f')]>0x0?getCallerIdRandom(_0x373dac[_0x27f4('0x190')],_0x373dac[_0x27f4('0x18f')]):_0x373dac[_0x27f4('0x190')]);if(_0x3c7562){_0x93cf48['XMD-ORIGINATECALLERIDNAME']=_0x339bfd[_0x27f4('0x24')][_0x22e937][_0x27f4('0x192')]=extractCalleridName(_0x3c7562);_0x93cf48[_0x27f4('0x193')]=_0x339bfd['actions'][_0x22e937][_0x27f4('0x194')]=extractCalleridNumber(_0x3c7562);}return ami['Action']({'actionid':_0x22e937,'action':'originate','channel':_0x339bfd[_0x27f4('0x143')](_0x373dac[_0x27f4('0x76')])?util[_0x27f4('0x79')](_0x27f4('0x195'),_0x373dac[_0x27f4('0x76')]['name'],isNotNull(_0x373dac[_0x27f4('0x5c')])?_0x373dac[_0x27f4('0x5c')][_0x27f4('0x196')]()||'':'',_0x373dac[_0x27f4('0x197')]>0x0?_0x7ad8fb[_0x27f4('0x175')][_0x27f4('0x174')][_0x27f4('0x198')](_0x373dac[_0x27f4('0x197')]):_0x7ad8fb[_0x27f4('0x175')][_0x27f4('0x174')]):util['format'](_0x27f4('0x195'),_[_0x27f4('0xae')](_0x373dac[_0x27f4('0x191')])?_0x373dac[_0x27f4('0x76')]['name']:_0x373dac[_0x27f4('0x191')][_0x27f4('0x3f')],isNotNull(_0x373dac[_0x27f4('0x5c')])?_0x373dac[_0x27f4('0x5c')]['trim']()||'':'',_0x373dac[_0x27f4('0x197')]>0x0?_0x7ad8fb['Contact'][_0x27f4('0x174')]['substring'](_0x373dac[_0x27f4('0x197')]):_0x7ad8fb[_0x27f4('0x175')][_0x27f4('0x174')]),'callerid':_0x3c7562,'Exten':_0x27f4('0xe0'),'Context':_0x27f4('0x199'),'Priority':'1','variable':_0x93cf48,'timeout':(_0x373dac[_0x27f4('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22e937})[_0x27f4('0x3c')](function(_0x507df7){return _0x17c01f(_0x507df7);})['catch'](function(_0xfa131f){_0x373dac[_0x27f4('0x66')]+=0x1;var _0xc8af82=new History(_0x339bfd[_0x27f4('0x24')][_0x22e937]);logger[_0x27f4('0x97')](util[_0x27f4('0x79')](_0x27f4('0x19a'),JSON[_0x27f4('0x48')](_0xfa131f)));_0xc8af82[_0x27f4('0xeb')]=0xe;_0xc8af82[_0x27f4('0xa9')]=_0x27f4('0x19b');_0xc8af82[_0x27f4('0xab')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));_0xc8af82[_0x27f4('0xaa')]=_0xc8af82[_0x27f4('0xab')];_0x339bfd['createHistory'](_0xc8af82)[_0x27f4('0xb5')](loggerCatch('[originate][error]'));_0x339bfd[_0x27f4('0x109')](_0xc8af82)[_0x27f4('0xb5')](loggerCatch('[originate][error]'))[_0x27f4('0x135')](function(){delete _0x339bfd[_0x27f4('0x24')][_0x22e937];return _0x65b1b1(msgResponse(_0x27f4('0x172'),_0x27f4('0x47'),_0x27f4('0x19c')));});});});};Dialer[_0x27f4('0x19')]['syncOriginateResponse']=function(_0x552b92){var _0x221315=this[_0x27f4('0x24')][_0x552b92[_0x27f4('0x12b')]];if(_0x221315){delete this[_0x27f4('0x24')][_0x552b92[_0x27f4('0x12b')]];_0x221315[_0x27f4('0x11a')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));var _0x21d5ba=_0x221315[_0x27f4('0x4c')]===_0x27f4('0xe1')?this[_0x27f4('0x1f')][_0x221315[_0x27f4('0xb1')]]:this[_0x27f4('0x1e')][_0x221315[_0x27f4('0x19d')]()];if(!this[_0x27f4('0x19e')](_0x552b92['response'])){this['updateOriginated'](_0x21d5ba);return this[_0x27f4('0x19f')](_0x221315,_0x21d5ba,_0x552b92)['catch'](loggerCatch(_0x27f4('0x1a0')));}this[_0x27f4('0x26')][_0x552b92[_0x27f4('0xdd')]]=_0x221315;}};Dialer['prototype'][_0x27f4('0x1a1')]=function(_0x78b172,_0x134c89,_0x22188b){var _0x1d7d70=new History(_0x134c89);if(_0x1d7d70['countbusyretry']+_0x1d7d70['countcongestionretry']+_0x1d7d70[_0x27f4('0xf4')]+_0x1d7d70[_0x27f4('0xf5')]+_0x1d7d70[_0x27f4('0x105')]+_0x1d7d70['countabandonedretry']+_0x1d7d70[_0x27f4('0xef')]+_0x1d7d70[_0x27f4('0xf7')]>=_0x22188b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x78b172){case 0x3:if(_0x1d7d70[_0x27f4('0xf4')]>=_0x22188b['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countnoanswerretry':_0x1d7d70[_0x27f4('0xf4')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x1a2')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1a3')));break;case 0x5:if(_0x1d7d70[_0x27f4('0x1a4')]>=_0x22188b['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x1d7d70[_0x27f4('0x1a4')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b['dialBusyRetryFrequency'],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70['CampaignId']||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1a5')));break;case 0x8:if(_0x1d7d70[_0x27f4('0xf3')]>=_0x22188b[_0x27f4('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x1d7d70[_0x27f4('0xf3')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x1a7')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1a8')));break;case 0x0:if(_0x1d7d70[_0x27f4('0xf5')]>=_0x22188b[_0x27f4('0x1a9')]-0x1){return!![];}else{this[_0x27f4('0xbf')]({'active':![],'countnosuchnumberretry':_0x1d7d70['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x22188b[_0x27f4('0x1aa')],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1ab')));}break;case 0xa:if(_0x1d7d70[_0x27f4('0x105')]>=_0x22188b[_0x27f4('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x1d7d70[_0x27f4('0x105')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b['dialDropRetryFrequency'],_0x27f4('0x106'))[_0x27f4('0x79')](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1ac')));break;case 0xb:if(_0x1d7d70[_0x27f4('0xf6')]>=_0x22188b['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countabandonedretry':_0x1d7d70[_0x27f4('0xf6')]+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x126')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70['VoiceQueueId']||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x127')));break;case 0x13:if(_0x1d7d70['countmachineretry']>=_0x22188b[_0x27f4('0xfa')]-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countmachineretry':_0x1d7d70['countmachineretry']+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b['dialMachineRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70['VoiceQueueId']||undefined,'CampaignId':_0x1d7d70[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x101')));break;case 0x14:if(_0x1d7d70[_0x27f4('0xf7')]>=_0x22188b['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x27f4('0xbf')]({'active':![],'countagentrejectretry':_0x1d7d70['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x27f4('0xfd')](_0x22188b[_0x27f4('0x1ad')],_0x27f4('0x106'))['format'](_0x27f4('0xff')),'ContactId':_0x1d7d70[_0x27f4('0xd3')],'ListId':_0x1d7d70[_0x27f4('0xd4')],'VoiceQueueId':_0x1d7d70[_0x27f4('0xd6')]||undefined,'CampaignId':_0x1d7d70['CampaignId']||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1ae')));break;default:return!![];}};Dialer[_0x27f4('0x19')][_0x27f4('0x19f')]=function(_0x5df133,_0x545fb9,_0x54736d){var _0x540c02=this;var _0x5b267a=new History(_0x5df133);return new BPromise(function(_0x11f3ef,_0x2a392c){if(_['isUndefined'](_0x545fb9)&&typeof _0x545fb9!==_0x27f4('0x171')){return _0x2a392c(msgResponse(_0x27f4('0x1af'),_0x27f4('0x149'),_0x27f4('0x1b0')));}if(_[_0x27f4('0x3e')](_0x54736d)&&typeof _0x54736d!==_0x27f4('0x171')){return _0x2a392c(msgResponse(_0x27f4('0x1af'),_0x27f4('0x149'),_0x27f4('0x1b1')));}switch(_0x54736d[_0x27f4('0x1b2')]){case'0':_0x545fb9['outboundNoSuchCallsDay']+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x0;_0x5b267a[_0x27f4('0xa9')]=_0x27f4('0x1b3');_0x5b267a[_0x27f4('0xf5')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami['emit'](_0x27f4('0x1b4'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1b5')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xf2')));if(_0x540c02[_0x27f4('0x1a1')](0x0,_0x5df133,_0x545fb9)){if(_0x5b267a['countnosuchnumberretry']>=_0x545fb9[_0x27f4('0x1a9')]){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,'reason\x200\x20no\x20such\x20number....');}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1b6'));}}break;case'3':_0x545fb9['outboundNoAnswerCallsDay']+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x3;_0x5b267a[_0x27f4('0xa9')]=_0x27f4('0x1b7');_0x5b267a[_0x27f4('0xf4')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1b8'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1b9')));_0x540c02[_0x27f4('0xca')](_0x5b267a)['catch'](loggerCatch(_0x27f4('0x1ba')));if(_0x540c02[_0x27f4('0x1a1')](0x3,_0x5df133,_0x545fb9)){if(_0x5b267a['countnoanswerretry']>=_0x545fb9[_0x27f4('0x1bb')]){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1bc'));}else{_0x540c02['stateGlobal'](_0x5b267a,_0x11f3ef,_0x2a392c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x545fb9[_0x27f4('0x60')]+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x5;_0x5b267a['statedesc']=_0x27f4('0x1bd');_0x5b267a['countbusyretry']+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1be'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1bf')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1c0')));if(_0x540c02[_0x27f4('0x1a1')](0x5,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0x1a4')]>=_0x545fb9[_0x27f4('0x1c1')]){_0x540c02['createStateFinal'](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c2'));}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c2'));}}break;case'8':_0x545fb9[_0x27f4('0x61')]+=0x1;_0x5b267a['state']=0x8;_0x5b267a[_0x27f4('0xa9')]='Congestion';_0x5b267a[_0x27f4('0xf3')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1c3'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1c4')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x540c02[_0x27f4('0x1a1')](0x8,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0xf3')]>=_0x545fb9['dialCongestionMaxRetry']){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c5'));}else{_0x540c02['stateGlobal'](_0x5b267a,_0x11f3ef,_0x2a392c,'reason\x208\x20congestion');}}break;case'11':_0x545fb9[_0x27f4('0x1c6')]+=0x1;_0x5b267a[_0x27f4('0xeb')]=0xb;_0x5b267a[_0x27f4('0xa9')]=_0x27f4('0x128');_0x5b267a[_0x27f4('0xf6')]+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x129')));if(_0x540c02[_0x27f4('0x1a1')](0xb,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0xf6')]>=_0x545fb9[_0x27f4('0x1c7')]){_0x540c02[_0x27f4('0xfb')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c8'));}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1c8'));}}break;case'20':_0x545fb9[_0x27f4('0x68')]+=0x1;_0x5b267a[_0x27f4('0xeb')]=0x14;_0x5b267a['statedesc']=_0x27f4('0x1c9');_0x5b267a['countagentrejectretry']+=0x1;_0x5b267a[_0x27f4('0xf0')]+=0x1;ami[_0x27f4('0xe5')](_0x27f4('0x1ca'),ut[_0x27f4('0xe7')](_0x5df133,_0x27f4('0x1cb')));_0x540c02[_0x27f4('0xca')](_0x5b267a)[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1cc')));if(_0x540c02['checkRetriveMax'](0x14,_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0xf7')]>=_0x545fb9[_0x27f4('0x1cd')]){_0x540c02['createStateFinal'](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1ce'));}else{_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x27f4('0x1ce'));}}break;default:_0x545fb9['outboundUnknownCallsDay']+=0x1;_0x5b267a[_0x27f4('0xeb')]=0xc;_0x5b267a[_0x27f4('0xa9')]=_0x54736d[_0x27f4('0x1b2')];_0x540c02[_0x27f4('0xca')](_0x5b267a)['catch'](loggerCatch(_0x27f4('0x1cf')));if(_0x540c02['checkRetriveMax'](_0x54736d[_0x27f4('0x1b2')],_0x5df133,_0x545fb9)){if(_0x5b267a[_0x27f4('0x1a4')]+_0x5b267a[_0x27f4('0xf3')]+_0x5b267a[_0x27f4('0xf4')]+_0x5b267a[_0x27f4('0xf5')]+_0x5b267a['countdropretry']+_0x5b267a[_0x27f4('0xf6')]+_0x5b267a[_0x27f4('0xef')]+_0x5b267a[_0x27f4('0xf7')]>=_0x545fb9['dialGlobalMaxRetry']){_0x540c02[_0x27f4('0xf9')](_0x5b267a,_0x11f3ef,_0x2a392c,_0x54736d[_0x27f4('0x1b2')]);}else{_0x540c02['createStateFinal'](_0x5b267a,_0x11f3ef,_0x2a392c,_0x54736d['reason']);}}}});};Dialer['prototype']['stateGlobal']=function(_0x4623e0,_0x1caa97,_0x51851b,_0x3889bd){var _0x37fa7f=new Final(_0x4623e0);_0x37fa7f[_0x27f4('0xeb')]=0xf;_0x37fa7f[_0x27f4('0xa9')]=_0x27f4('0x1d0');this[_0x27f4('0xfb')](_0x37fa7f,_0x1caa97,_0x51851b,_0x3889bd);};Dialer[_0x27f4('0x19')]['createStateFinal']=function(_0xce4fc4,_0x141340,_0x4f7a81,_0x560153){this[_0x27f4('0x109')](_0xce4fc4)[_0x27f4('0x3c')](function(){return _0x141340(msgResponse('[callProgressDetecting]',_0x27f4('0x1d1'),_0x560153));})[_0x27f4('0xb5')](function(){return _0x4f7a81(msgResponse(_0x27f4('0x1d2'),_0x27f4('0x149'),_0x27f4('0x1d3')));});};Dialer[_0x27f4('0x19')][_0x27f4('0xa')]=function(_0x296257){var _0x219c60=_0x296257[_0x27f4('0x1d4')]/0x64;var _0x21ac2e=_0x296257[_0x27f4('0x11c')]/(_0x296257[_0x27f4('0x11c')]+_0x296257[_0x27f4('0x5e')]);var _0x6ff61=Math[_0x27f4('0x1d5')](_0x296257['predictiveIntervalAvailable']*(_0x296257[_0x27f4('0x1d6')]/0x64));var _0x287984=Math[_0x27f4('0x1d5')](_0x296257[_0x27f4('0x1d7')]*(_0x296257[_0x27f4('0x1d8')]/0x64));var _0x45310d=_0x296257[_0x27f4('0x50')]+_0x296257[_0x27f4('0xa3')];var _0x35e23e=Math[_0x27f4('0x1d9')](_0x296257[_0x27f4('0x72')]*_0x296257['erlangAbandonmentRate']*_0x296257[_0x27f4('0x6d')]*_0x296257[_0x27f4('0x6e')]);if(_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x8f')])){if(!_['isUndefined'](_0x296257['startPredictive'])){_0x296257[_0x27f4('0x28')]=undefined;loggerPredictive[_0x27f4('0x97')](_0x27f4('0x1da'),_0x27f4('0x1db'));}if(!_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x92')])){loggerPredictive['error'](_0x27f4('0x1da'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x296257['handlePredictive']);_0x296257[_0x27f4('0x92')]=undefined;}_0x296257[_0x27f4('0x8f')]=moment()[_0x27f4('0x79')](_0x27f4('0xff'));loggerPredictive[_0x27f4('0x7e')](_0x296257['name'],'collection\x20data\x20in\x20progressive\x20at',_0x296257[_0x27f4('0x8f')]);this[_0x27f4('0x15d')](_0x296257,0x1);}else if(ifInterval(_0x296257[_0x27f4('0x1dc')],_0x296257[_0x27f4('0x8f')])){this['handlePower'](_0x296257,0x1);loggerPredictiveCalls[_0x27f4('0x7e')](_0x27f4('0x1dd'),_0x296257[_0x27f4('0x8f')],_0x296257[_0x27f4('0x3f')]);_0x296257['erlangCalls']=0x0;_0x296257[_0x27f4('0x6c')]=0x0;}else if(_0x219c60<_0x21ac2e&&_0x296257[_0x27f4('0x1de')]===_0x27f4('0x1df')){freeVariablesPredictive(_0x296257);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x1e0'),_0x27f4('0x1e1'),_0x21ac2e,_0x27f4('0x8f'),_0x296257[_0x27f4('0x3f')]);}else if(_0x35e23e<_0x296257[_0x27f4('0x6c')]&&_0x296257['dialPredictiveOptimization']===_0x27f4('0x1df')){freeVariablesPredictive(_0x296257);loggerPredictive['info'](_0x27f4('0x1e2'),'Max\x20Drop\x20',_0x35e23e,_0x27f4('0x1e3'),_0x296257[_0x27f4('0x6c')],_0x27f4('0x8f'),_0x296257[_0x27f4('0x3f')]);}else if(!ifInterval(_0x296257['dialPredictiveInterval'],_0x296257[_0x27f4('0x8f')])&&_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x28')])&&!_[_0x27f4('0x3e')](_0x296257[_0x27f4('0x8f')])){_0x296257['startPredictive']=moment()[_0x27f4('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x27f4('0x7e')](_0x296257['name'],_0x27f4('0x1e4'),_0x296257[_0x27f4('0x28')]);this[_0x27f4('0xbc')](_0x296257['dialPredictiveInterval'])[_0x27f4('0x3c')](this[_0x27f4('0x1e5')](_0x296257))['then'](mergeDataErlangB(_0x296257))[_0x27f4('0x3c')](this[_0x27f4('0x1e6')](_0x296257))[_0x27f4('0xb5')](loggerCatchPredictive(_0x27f4('0x1e7'),_0x296257));}else if(!ifInterval(_0x296257['dialPredictiveInterval'],_0x296257['startPredictive'])){_0x296257[_0x27f4('0x6c')]=0x0;_0x296257['startPredictive']=moment()[_0x27f4('0x79')](_0x27f4('0xff'));loggerPredictive[_0x27f4('0x7e')](_0x296257[_0x27f4('0x3f')],_0x27f4('0x1e8'),_0x296257[_0x27f4('0x28')]);clearInterval(_0x296257[_0x27f4('0x92')]);_0x296257[_0x27f4('0x92')]=undefined;this[_0x27f4('0xbc')](_0x296257[_0x27f4('0x1dc')])[_0x27f4('0x3c')](this[_0x27f4('0x1e5')](_0x296257))[_0x27f4('0x3c')](mergeDataErlangB(_0x296257))[_0x27f4('0x3c')](this[_0x27f4('0x1e6')](_0x296257))[_0x27f4('0xb5')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x296257));}else if(_0x296257[_0x27f4('0x1d7')]&&_0x45310d<_0x296257['predictiveIntervalAvailable']-_0x287984){freeVariablesPredictive(_0x296257);loggerPredictive[_0x27f4('0x7e')](_0x296257[_0x27f4('0x3f')],_0x27f4('0x1e9'),_0x45310d,_0x27f4('0x1ea'),_0x296257['predictiveIntervalAvailable'],'-',_0x287984,'=',_0x296257[_0x27f4('0x1d7')]-_0x287984,')');}else if(_0x296257['predictiveIntervalAvailable']&&_0x45310d>_0x296257[_0x27f4('0x1d7')]+_0x6ff61){freeVariablesPredictive(_0x296257);loggerPredictive[_0x27f4('0x7e')](_0x296257[_0x27f4('0x3f')],_0x27f4('0x1e9'),_0x45310d,_0x27f4('0x1eb'),_0x296257['predictiveIntervalAvailable'],'+',_0x6ff61,'=',_0x296257[_0x27f4('0x1d7')]+_0x6ff61,')');}};Dialer[_0x27f4('0x19')][_0x27f4('0x1e5')]=function(_0x25f0cf){var _0x71ce60=this;return function(_0x587261){return new BPromise(function(_0x2e720f,_0x4f2580){_[_0x27f4('0xd1')](_0x25f0cf,_0x587261[0x0]);if(checkGetDataPredictive(_0x587261[0x0])){var _0x4afe1b=_0x25f0cf[_0x27f4('0x1d7')]=_0x25f0cf['talking']+_0x25f0cf['available'];var _0x311dc4=_0x25f0cf[_0x27f4('0x1dc')]*0x3c;var _0x3ca925=_0x587261[0x0]['predictiveIntervalAvgTalktime']+_0x587261[0x0][_0x27f4('0x85')];var _0x599fd4=(_0x587261[0x0][_0x27f4('0x81')]+_0x587261[0x0][_0x27f4('0x6a')]+_0x587261[0x0][_0x27f4('0x84')])/_0x587261[0x0][_0x27f4('0x70')];_0x25f0cf[_0x27f4('0x6d')]=_0x599fd4>0x0?_0x599fd4:0x1;switch(_0x25f0cf[_0x27f4('0x1de')]){case _0x27f4('0x1df'):var _0x4cc012=_0x25f0cf[_0x27f4('0x1d4')]/0x64;return _0x71ce60[_0x27f4('0x1ec')](_0x4afe1b,_0x311dc4,_0x3ca925,_0x599fd4,_0x4cc012)[_0x27f4('0x3c')](function(_0x2be20f){return _0x2e720f(_0x2be20f);});case _0x27f4('0x1ed'):var _0x4306ea=_0x25f0cf[_0x27f4('0x1d4')]/0x64;return _0x71ce60[_0x27f4('0x1ee')](_0x4afe1b,_0x311dc4,_0x3ca925,_0x599fd4,_0x4306ea)[_0x27f4('0x3c')](function(_0x7ee716){return _0x2e720f(_0x7ee716);});default:return _0x4f2580(msgResponse('[getDataPredictive]',_0x27f4('0x149'),_0x27f4('0x1ef')));}}else{return _0x4f2580(msgResponse('[getDataPredictive]',_0x27f4('0x149'),_0x27f4('0x1f0')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x751453){var _0x36de27=this;return function(_0x1a25bf){return new BPromise(function(_0x1e1d5c,_0x45ef35){_[_0x27f4('0xd1')](_0x751453,_0x1a25bf[0x0]);if(checkGetDataPredictive(_0x1a25bf[0x0])){loggerPredictive['info'](JSON[_0x27f4('0x48')](_0x1a25bf[0x0]));if(_0x751453[_0x27f4('0x1de')]==='dropRate'){return _0x36de27[_0x27f4('0xc7')](_0x751453['id'])[_0x27f4('0x3c')](function(_0xf0655f){var _0x269222=_0x751453[_0x27f4('0x51')]-_0xf0655f[0x0][_0x27f4('0x1f1')];var _0x2e460d=_0x751453['dialPredictiveInterval']*0x3c;var _0x207bb0=_0x1a25bf[0x0][_0x27f4('0x87')]+_0x1a25bf[0x0]['predictiveIntervalAvgHoldtime'];var _0x1ec2fc=(_0x1a25bf[0x0][_0x27f4('0x81')]+_0x1a25bf[0x0][_0x27f4('0x6a')]+_0x1a25bf[0x0][_0x27f4('0x84')])/_0x1a25bf[0x0][_0x27f4('0x70')];var _0x9687af=_0x751453[_0x27f4('0x1d4')]/0x64;_0x751453[_0x27f4('0x6f')]=_0xf0655f[0x0][_0x27f4('0x1f1')]||0x0;_0x751453[_0x27f4('0x6d')]=_0x1ec2fc>0x0?_0x1ec2fc:0x1;return _0x36de27[_0x27f4('0x1ec')](_0x269222,_0x2e460d,_0x207bb0,_0x1ec2fc,_0x9687af);})[_0x27f4('0x3c')](function(_0x31960a){return _0x1e1d5c(_0x31960a);})[_0x27f4('0xb5')](function(_0xf721d6){return _0x45ef35(msgResponse(_0x27f4('0x1f2'),_0x27f4('0x149'),JSON[_0x27f4('0x48')](_0xf721d6)));});}if(_0x751453[_0x27f4('0x1de')]===_0x27f4('0x1ed')){return _0x36de27[_0x27f4('0xc7')](_0x751453['id'])[_0x27f4('0x3c')](function(_0x382058){var _0x2abb29=_0x751453['loggedIn']-_0x382058[0x0][_0x27f4('0x1f1')];var _0x189bb9=_0x751453[_0x27f4('0x1dc')]*0x3c;var _0x46b70b=_0x1a25bf[0x0][_0x27f4('0x87')]+_0x1a25bf[0x0]['predictiveIntervalAvgHoldtime'];var _0x325b19=(_0x1a25bf[0x0][_0x27f4('0x81')]+_0x1a25bf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1a25bf[0x0][_0x27f4('0x84')])/_0x1a25bf[0x0]['predictiveIntervalTotalCalls'];var _0x134ec1=_0x751453[_0x27f4('0x1d4')]/0x64;_0x751453[_0x27f4('0x6f')]=_0x382058[0x0][_0x27f4('0x1f1')]||0x0;_0x751453[_0x27f4('0x6d')]=_0x325b19>0x0?_0x325b19:0x1;return _0x36de27['busyFactor'](_0x2abb29,_0x189bb9,_0x46b70b,_0x325b19,_0x134ec1);})[_0x27f4('0x3c')](function(_0x499c7a){return _0x1e1d5c(_0x499c7a);})[_0x27f4('0xb5')](function(_0x10ef38){return _0x45ef35(msgResponse(_0x27f4('0x1f2'),_0x27f4('0x149'),JSON[_0x27f4('0x48')](_0x10ef38)));});}}else{return _0x45ef35(msgResponse('[getDataPredictive]','Failure',_0x27f4('0x1f0')));}});};};Dialer[_0x27f4('0x19')]['startMethodPredictive']=function(_0x1c611d){var _0x5c06ef=this;return function(){var _0x458c2c=0x0;var _0x2ead30=Math[_0x27f4('0x1d9')](_0x1c611d['erlangCallToSecond']*0x3e8);if(_0x2ead30>0x0){_0x2ead30=_0x2ead30<0x64?0x64:_0x2ead30;loggerPredictive['info'](_0x1c611d[_0x27f4('0x3f')],_0x27f4('0x1f3'),_0x2ead30,_0x27f4('0x49'));_0x1c611d['handlePredictive']=setInterval(function(){_0x5c06ef[_0x27f4('0x92')](_0x1c611d);loggerPredictiveCalls[_0x27f4('0x7e')](_0x27f4('0x1f4'),_0x458c2c+=0x1);},_0x2ead30);}else{loggerPredictive['info'](_0x1c611d[_0x27f4('0x3f')],_0x27f4('0x1f5'));}};};Dialer[_0x27f4('0x19')][_0x27f4('0x1f6')]=function(_0x2cc4b3,_0x5421ad){var _0x141f6b=this;return function(_0x3c9081){if(_[_0x27f4('0x7c')](_0x3c9081)){if(_[_0x27f4('0xae')](_0x5421ad[_0x27f4('0xd5')])||!_0x5421ad['recallme']){if(_0x2cc4b3[_0x27f4('0x5a')]==='booked'){_0x2cc4b3[_0x27f4('0x12f')]=_[_0x27f4('0x3e')](_0x2cc4b3[_0x27f4('0x12f')])?!![]:_0x2cc4b3['queueStatusComplete'];var _0x329fd0=uuid['v4']();_0x141f6b[_0x27f4('0x24')][_0x329fd0]=new Action(_0x2cc4b3,_0x5421ad,_0x329fd0);loggerBooked[_0x27f4('0x7e')](_0x27f4('0x1f7'),_0x329fd0,_0x27f4('0x1f8'),JSON[_0x27f4('0x48')](_0x2cc4b3[_0x27f4('0x12f')]),_0x27f4('0x1f9'),_0x2cc4b3[_0x27f4('0x3f')]);if(_0x2cc4b3[_0x27f4('0x12f')]){_0x2cc4b3[_0x27f4('0x12f')]=![];_0x141f6b['queueBooked'][_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xb1')]]=[];ami['Action']({'actionid':_0x329fd0,'action':_0x27f4('0x1fa'),'queue':_0x2cc4b3[_0x27f4('0x3f')]})[_0x27f4('0xb5')](function(){_0x141f6b[_0x27f4('0xcc')](_0x2cc4b3);_0x141f6b[_0x27f4('0xbf')]({'active':![],'ContactId':_0x141f6b[_0x27f4('0x24')][_0x329fd0]['ContactId'],'ListId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xd4')],'VoiceQueueId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xd6')]||undefined,'CampaignId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x1fb')));delete _0x141f6b[_0x27f4('0x24')][_0x329fd0];});}else{loggerBooked['info'](_0x27f4('0x1fc'),JSON[_0x27f4('0x48')](_0x2cc4b3[_0x27f4('0x12f')]),_0x27f4('0x1f9'),_0x2cc4b3['name']);_0x141f6b['updateOriginated'](_0x2cc4b3);_0x141f6b['rescheduleContact']({'active':![],'ContactId':_0x141f6b['actions'][_0x329fd0][_0x27f4('0xd3')],'ListId':_0x141f6b[_0x27f4('0x24')][_0x329fd0][_0x27f4('0xd4')],'VoiceQueueId':_0x141f6b[_0x27f4('0x24')][_0x329fd0]['VoiceQueueId']||undefined,'CampaignId':_0x141f6b[_0x27f4('0x24')][_0x329fd0]['CampaignId']||undefined})[_0x27f4('0xb5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x141f6b[_0x27f4('0x24')][_0x329fd0];}}else{return _0x141f6b[_0x27f4('0x170')](_0x2cc4b3,_0x5421ad);}}else{if(getDiff(_0x5421ad[_0x27f4('0x1fd')])<_0x2cc4b3[_0x27f4('0x1fe')]*0x3c){if(_0x5421ad[_0x27f4('0x1ff')]&&!_0x5421ad[_0x27f4('0x1ff')][_0x27f4('0x200')]){_0x141f6b[_0x27f4('0x1d')][_0x27f4('0x132')](_0x5421ad['id'])[_0x27f4('0x135')](function(){_0x141f6b['updateOriginated'](_0x2cc4b3);});}else{_0x141f6b['unlockContact']({'active':![]},_0x5421ad['id'],0x1)['finally'](function(){_0x141f6b['updateOriginated'](_0x2cc4b3);});}}else{_0x2cc4b3[_0x27f4('0x67')]+=0x1;_0x141f6b[_0x27f4('0xcc')](_0x2cc4b3);if(_0x2cc4b3[_0x27f4('0x201')]){_0x141f6b['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5421ad[_0x27f4('0xd3')],'ListId':_0x5421ad['ListId'],'VoiceQueueId':_0x5421ad['VoiceQueueId']||undefined,'CampaignId':_0x5421ad[_0x27f4('0x100')]||undefined})[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x202')));_0x141f6b[_0x27f4('0xca')](createObjHistory(_0x2cc4b3,_0x5421ad,'RECALLINQUEUE',0x17,_0x27f4('0x203')))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0x204')));}else{_0x141f6b['saveInDb'](createObjHistory(_0x2cc4b3,_0x5421ad,'RECALLFAILEDTIMEOUT',0x16,_0x27f4('0x205')),_0x27f4('0x206'),_0x27f4('0x207'));}}}}else{_0x2cc4b3['outboundBlacklistCallsDay']+=0x1;_0x141f6b[_0x27f4('0xdc')](createObjHistory(_0x2cc4b3,_0x5421ad,_0x27f4('0x208'),0xd,_0x27f4('0x209')),_0x27f4('0x20a'),_0x27f4('0x20b'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x4efce5){var _0x4c1f51=this;var _0x4b3159=_0x4efce5['limitCalls']-_0x4efce5['originated']-_0x4efce5[_0x27f4('0xc3')];emitCampaignSummary(_0x4efce5);if(_0x4b3159>0x0){if(_0x4b3159>this['maxNumberOriginate']){_0x4b3159=this[_0x27f4('0x22')];}_0x4efce5[_0x27f4('0xc3')]+=_0x4b3159;this[_0x27f4('0xc5')](_0x4efce5['id'],_0x4b3159,_0x4efce5[_0x27f4('0x20c')],_0x4efce5)['then'](function(_0x253f33){_0x4efce5[_0x27f4('0xc3')]-=_0x4b3159;_0x4efce5['temp']=_0x4efce5[_0x27f4('0xc3')]>0x0?_0x4efce5[_0x27f4('0xc3')]:0x0;if(!checkContactEmpty(_0x253f33)){_0x4efce5['message']=_0x27f4('0xa0');logger[_0x27f4('0x7e')]('[getContactCampaign2][Empty]'+_0x4efce5[_0x27f4('0x3f')]);}else{_0x4efce5[_0x27f4('0x71')]+=_0x253f33[_0x27f4('0x9a')];_0x4efce5[_0x27f4('0x41')]=_0x27f4('0x20d');for(var _0x5ab57d=0x0;_0x5ab57d<_0x253f33[_0x27f4('0x9a')];_0x5ab57d+=0x1){_0x4efce5[_0x27f4('0x20e')]+=0x1;if(_[_0x27f4('0xae')](_0x253f33[_0x5ab57d])||_[_0x27f4('0xae')](_0x253f33[_0x5ab57d][_0x27f4('0x175')])||_['isNil'](_0x253f33[_0x5ab57d][_0x27f4('0x175')][_0x27f4('0x174')])){_0x4c1f51[_0x27f4('0x20f')](_0x27f4('0x210'),_0x4efce5,_0x253f33[_0x5ab57d]);}else{_0x4c1f51['checkIsBlackListIvr'](_[_0x27f4('0xd2')](_0x253f33[_0x5ab57d],['CampaignId','Contact.phone']))[_0x27f4('0x3c')](_0x4c1f51[_0x27f4('0x1f6')](_0x4efce5,_0x253f33[_0x5ab57d]))['catch'](_0x4c1f51[_0x27f4('0xcf')](_0x27f4('0x211'),_0x4efce5));}}}})['catch'](loggerGetContactDialer(_0x27f4('0x212'),_0x4efce5,_0x4b3159));}};Dialer['prototype']['handlePower']=function(_0x1be544,_0x151bcb){var _0x30e904=this;var _0x232a61=[];var _0x4c8d0f=_0x151bcb>=0x1?_0x151bcb:0x1;if(_0x1be544[_0x27f4('0x5a')]===_0x27f4('0x9')){_0x4c8d0f=0x1;}var _0xa816d8=Math[_0x27f4('0x1d9')](_0x1be544[_0x27f4('0x50')]*_0x4c8d0f)-_0x1be544[_0x27f4('0x71')]-_0x1be544[_0x27f4('0xc3')];emitVoiceQueueSummary(_0x1be544);if(_0x1be544[_0x27f4('0x213')]>0x0){var _0x437950=_0x1be544[_0x27f4('0x213')]-_0x1be544[_0x27f4('0x71')]-_0x1be544['talking']-_0x1be544[_0x27f4('0xc3')]-_0x1be544['pTalking'];if(_0xa816d8>_0x437950){_0xa816d8=_0x437950;}}if(_0xa816d8>0x0){if(_0x1be544[_0x27f4('0x5a')]==='booked'){_0xa816d8=0x1;}if(_0xa816d8>this[_0x27f4('0x22')]){_0xa816d8=this[_0x27f4('0x22')];}_0x1be544[_0x27f4('0xc3')]+=_0xa816d8;for(var _0x40a275 in this[_0x27f4('0x20')]){if(typeof this[_0x27f4('0x20')][_0x40a275]!=='undefined'){if(this[_0x27f4('0x20')][_0x40a275][_0x27f4('0xeb')]==='not_inuse'&&this[_0x27f4('0x20')][_0x40a275]['status']===_0x27f4('0xda')){_0x232a61[_0x27f4('0x14f')](this[_0x27f4('0x20')][_0x40a275]['id']);}}}this[_0x27f4('0xc2')](_0x1be544['id'],_0x232a61,_0xa816d8,_0x1be544[_0x27f4('0x20c')],_0x1be544)[_0x27f4('0x3c')](function(_0x52521){_0x1be544[_0x27f4('0xc3')]-=_0xa816d8;_0x1be544['temp']=_0x1be544[_0x27f4('0xc3')]>0x0?_0x1be544[_0x27f4('0xc3')]:0x0;if(!checkContactEmpty(_0x52521)){_0x30e904[_0x27f4('0xb4')](_0x1be544)[_0x27f4('0x3c')](sendMessageReschedule(_0x1be544))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1be544[_0x27f4('0x71')]+=_0x52521[_0x27f4('0x9a')];_0x1be544[_0x27f4('0x41')]=_0x1be544[_0x27f4('0x5a')]==='booked'?'ACTIVE':_0x27f4('0x20d');for(var _0x22b803=0x0;_0x22b803<_0x52521[_0x27f4('0x9a')];_0x22b803+=0x1){if(_[_0x27f4('0xae')](_0x52521[_0x22b803])||_[_0x27f4('0xae')](_0x52521[_0x22b803][_0x27f4('0x175')])||_[_0x27f4('0xae')](_0x52521[_0x22b803]['Contact']['phone'])){_0x30e904[_0x27f4('0x20f')](_0x27f4('0x210'),_0x1be544,_0x52521[_0x22b803]);}else{_0x30e904['checkIsBlackList'](_[_0x27f4('0xd2')](_0x52521[_0x22b803],[_0x27f4('0xd6'),_0x27f4('0x214')]))['then'](_0x30e904[_0x27f4('0x1f6')](_0x1be544,_0x52521[_0x22b803]))[_0x27f4('0xb5')](_0x30e904[_0x27f4('0xcf')](_0x27f4('0x210'),_0x1be544));}}}})[_0x27f4('0xb5')](loggerGetContactDialer('[getContactDialer2]',_0x1be544,_0xa816d8));}};Dialer[_0x27f4('0x19')]['handlePredictive']=function(_0x5b60be){if(_0x5b60be[_0x27f4('0x213')]>0x0){var _0x103420=_0x5b60be[_0x27f4('0x213')]-_0x5b60be[_0x27f4('0x71')]-_0x5b60be[_0x27f4('0xa3')];if(_0x103420>0x0){this[_0x27f4('0x215')](_0x5b60be);}else{loggerPredictiveCalls[_0x27f4('0x7e')](_0x27f4('0x216'));}}else{this[_0x27f4('0x215')](_0x5b60be);}};Dialer[_0x27f4('0x19')][_0x27f4('0x215')]=function(_0x128624){var _0x1f9575=this;var _0x4a1673=[];_0x128624[_0x27f4('0x71')]+=0x1;for(var _0x33bb60 in this[_0x27f4('0x20')]){if(typeof this[_0x27f4('0x20')][_0x33bb60]!==_0x27f4('0x9b')){if(this[_0x27f4('0x20')][_0x33bb60]['state']===_0x27f4('0x217')&&this[_0x27f4('0x20')][_0x33bb60][_0x27f4('0xd9')]===_0x27f4('0xda')){_0x4a1673[_0x27f4('0x14f')](this[_0x27f4('0x20')][_0x33bb60]['id']);}}}this['getContactDialer'](_0x128624['id'],_0x4a1673,0x1,_0x128624[_0x27f4('0x20c')],_0x128624)[_0x27f4('0x3c')](function(_0x12b306){if(!checkContactEmpty(_0x12b306)){checkContactLowerLimitOriginate(_0x128624,0x1,0x0);_0x1f9575['countReScheduled'](_0x128624)[_0x27f4('0x3c')](sendMessageReschedule(_0x128624))[_0x27f4('0xb5')](loggerCatch(_0x27f4('0xb6')));}else{_0x128624['message']=_0x27f4('0x20d');if(_['isNil'](_0x12b306[0x0])||_[_0x27f4('0xae')](_0x12b306[0x0][_0x27f4('0x175')])||_[_0x27f4('0xae')](_0x12b306[0x0][_0x27f4('0x175')][_0x27f4('0x174')])){_0x1f9575[_0x27f4('0x20f')](_0x27f4('0x210'),_0x128624,_0x12b306[0x0]);}else{_0x1f9575[_0x27f4('0xb7')](_[_0x27f4('0xd2')](_0x12b306[0x0],['VoiceQueueId',_0x27f4('0x214')]))[_0x27f4('0x3c')](_0x1f9575[_0x27f4('0x1f6')](_0x128624,_0x12b306[0x0]))[_0x27f4('0xb5')](_0x1f9575[_0x27f4('0xcf')](_0x27f4('0x218'),_0x128624));}}})[_0x27f4('0xb5')](loggerGetContactDialer(_0x27f4('0x219'),_0x128624,0x1));emitVoiceQueueSummary(_0x128624);};Dialer[_0x27f4('0x19')][_0x27f4('0x1ec')]=function(_0x27e93c,_0x138a2a,_0x5b45ec,_0x49df92,_0x51c7b4,_0x22324a){loggerPredictive[_0x27f4('0x7e')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x27f4('0x7e')]('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',_0x27e93c);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x138a2a);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21a'),_0x5b45ec);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21b'),_0x49df92);loggerPredictive['info'](_0x27f4('0x21c'),_0x51c7b4);loggerPredictive[_0x27f4('0x7e')]('---------------------------');return new BPromise(function(_0x4b4bfe,_0x56bc5a){if(_0x27e93c<=0x0||isNaN(_0x27e93c)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),_0x27f4('0x47'),_0x27f4('0x21e')+_0x27e93c));}if(_0x5b45ec<=0x0||isNaN(_0x5b45ec)){return _0x56bc5a(msgResponse('[abandonmentRate]',_0x27f4('0x47'),_0x27f4('0x21f')+_0x5b45ec));}if(_0x49df92<=0x0||isNaN(_0x49df92)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),_0x27f4('0x47'),'p\x20=\x20'+_0x49df92));}if(_0x138a2a<=0x0||isNaN(_0x138a2a)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),_0x27f4('0x47'),_0x27f4('0x220')+_0x138a2a));}if(_0x51c7b4<=0x0||isNaN(_0x51c7b4)){return _0x56bc5a(msgResponse(_0x27f4('0x21d'),'Error',_0x27f4('0x221')+_0x51c7b4));}_0x22324a=_0x22324a||0x0;var _0x412bee=0x1/_0x5b45ec;var _0x1f4108=0x0;var _0x14e393=0x0;var _0x21c7b0=0x0;var _0x31da47=0x0;for(var _0x219536=0x0;_0x21c7b0<_0x51c7b4;_0x219536+=0x1){_0x14e393=_0x219536/_0x138a2a;_0x1f4108=(_0x49df92*_0x14e393+_0x22324a)/_0x412bee;_0x21c7b0=erlangb(_0x1f4108,_0x27e93c);_0x31da47=_0x1f4108/_0x27e93c*(0x1-erlangb(_0x1f4108,_0x27e93c));}return _0x4b4bfe({'erlangCalls':_0x219536,'erlangCallToSecond':_0x138a2a/_0x219536,'erlangAbandonmentRate':_0x21c7b0,'erlangBusyFactor':_0x31da47});});};Dialer[_0x27f4('0x19')][_0x27f4('0x1ee')]=function(_0x3a3d72,_0x481b33,_0x2ceccb,_0xae0b48,_0x24920c,_0x2d2c19){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x27f4('0x7e')]('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',_0x3a3d72);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x222'),_0x481b33);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21a'),_0x2ceccb);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x21b'),_0xae0b48);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x223'),_0x24920c);loggerPredictive[_0x27f4('0x7e')](_0x27f4('0x88'));return new BPromise(function(_0xc2d49f,_0x27b049){if(_0x3a3d72<=0x0||isNaN(_0x3a3d72)){return _0x27b049(msgResponse(_0x27f4('0x224'),_0x27f4('0x47'),_0x27f4('0x21e')+_0x3a3d72));}if(_0x2ceccb<=0x0||isNaN(_0x2ceccb)){return _0x27b049(msgResponse(_0x27f4('0x224'),'Error','Ts\x20=\x20'+_0x2ceccb));}if(_0xae0b48<=0x0||isNaN(_0xae0b48)){return _0x27b049(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0xae0b48));}if(_0x481b33<=0x0||isNaN(_0x481b33)){return _0x27b049(msgResponse(_0x27f4('0x224'),_0x27f4('0x47'),_0x27f4('0x220')+_0x481b33));}if(_0x24920c<=0x0||isNaN(_0x24920c)){return _0x27b049(msgResponse(_0x27f4('0x224'),'Error',_0x27f4('0x225')+_0x24920c));}_0x2d2c19=_0x2d2c19||0x0;var _0xa5f737=0x1/_0x2ceccb;var _0x21e1c9=0x0;var _0x306907=0x0;var _0x20859b=0x0;var _0x2f6f50=0x0;for(var _0x55a21b=0x0;_0x2f6f50<_0x24920c;_0x55a21b+=0x1){_0x306907=_0x55a21b/_0x481b33;_0x21e1c9=(_0xae0b48*_0x306907+_0x2d2c19)/_0xa5f737;_0x20859b=erlangb(_0x21e1c9,_0x3a3d72);_0x2f6f50=_0x21e1c9/_0x3a3d72*(0x1-erlangb(_0x21e1c9,_0x3a3d72));}return _0xc2d49f({'erlangCalls':_0x55a21b,'erlangCallToSecond':_0x481b33/_0x55a21b,'erlangAbandonmentRate':_0x20859b,'erlangBusyFactor':_0x2f6f50});});};module[_0x27f4('0x226')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index dcf6768..79692e5 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x210c=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x322177,_0x4a29c4){var _0x357c57=function(_0x5114c9){while(--_0x5114c9){_0x322177['push'](_0x322177['shift']());}};_0x357c57(++_0x4a29c4);}(_0x210c,0x190));var _0xc210=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x210c[_0x13f980];return _0x27153c;};'use strict';var util=require(_0xc210('0x0'));var _=require(_0xc210('0x1'));var moment=require(_0xc210('0x2'));function getSeconds(_0x29fac5,_0x55455c){var _0x38b600=moment(_0x29fac5)[_0xc210('0x3')](0x0);var _0x4c4508=moment(_0x55455c)[_0xc210('0x3')](0x0);return _0x38b600[_0xc210('0x4')](_0x4c4508,_0xc210('0x5'));}function QueueCallerAbandon(_0x872f64,_0xb9e573){this[_0xc210('0x6')]=_0x872f64['scheduledat'];this[_0xc210('0x7')]=_0x872f64['type'];this[_0xc210('0x8')]=_0x872f64[_0xc210('0x7')]===_0xc210('0x9')?_0xc210('0xa'):_0x872f64[_0xc210('0x7')];this[_0xc210('0xb')]=_0x872f64[_0xc210('0xb')];this[_0xc210('0xc')]=_0x872f64[_0xc210('0xc')];this[_0xc210('0xd')]=_0x872f64[_0xc210('0xd')];this[_0xc210('0xe')]=_0x872f64[_0xc210('0xb')]+_0x872f64[_0xc210('0xc')]+_0x872f64[_0xc210('0xd')]+_0x872f64[_0xc210('0xf')]+_0x872f64[_0xc210('0x10')]+_0x872f64['countabandonedretry']+_0x872f64[_0xc210('0x11')]+_0x872f64[_0xc210('0x12')];this[_0xc210('0xf')]=_0x872f64[_0xc210('0xf')];this[_0xc210('0x10')]=_0x872f64['countdropretry'];this[_0xc210('0x13')]=_0x872f64[_0xc210('0x13')];this[_0xc210('0x11')]=_0x872f64[_0xc210('0x11')];this['countagentrejectretry']=_0x872f64[_0xc210('0x12')];this['uniqueid']=_0xb9e573['uniqueid'];this['calleridname']=_0x872f64['name'];this[_0xc210('0x14')]=_0x872f64[_0xc210('0x15')];this[_0xc210('0x16')]=_0x872f64[_0xc210('0x16')];this[_0xc210('0x17')]=_0x872f64[_0xc210('0x17')];this['droptime']=_0x872f64[_0xc210('0x18')];this[_0xc210('0x19')]=this[_0xc210('0x18')];this[_0xc210('0x1a')]=getSeconds(_0x872f64[_0xc210('0x17')],_0x872f64[_0xc210('0x16')]);this[_0xc210('0x1b')]=getSeconds(this[_0xc210('0x18')],_0x872f64['responsetime']);this[_0xc210('0x1c')]=0x0;this[_0xc210('0xa')]=_0xb9e573[_0xc210('0xa')];this['membername']=_0xb9e573[_0xc210('0x1d')];this[_0xc210('0x1e')]=_0xb9e573['reason'];this[_0xc210('0x1f')]=_0x872f64[_0xc210('0x1f')];this['callbackuniqueid']=_0x872f64['callbackuniqueid'];this[_0xc210('0x20')]=_0x872f64[_0xc210('0x20')];this[_0xc210('0x21')]=_0x872f64[_0xc210('0x21')];this[_0xc210('0x22')]=_0x872f64['ContactId'];this[_0xc210('0x23')]=_0x872f64['ListId'];this[_0xc210('0x24')]=_0x872f64['UserId'];this['VoiceQueueId']=_0x872f64[_0xc210('0x25')];this[_0xc210('0x26')]=_0x872f64[_0xc210('0x26')];this[_0xc210('0x27')]=_0x872f64['originatecalleridnum']||'';this['originatecalleridname']=_0x872f64[_0xc210('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xd59d=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x56a347,_0x54d322){var _0x2745f7=function(_0xc7abe5){while(--_0xc7abe5){_0x56a347['push'](_0x56a347['shift']());}};_0x2745f7(++_0x54d322);}(_0xd59d,0x81));var _0xdd59=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xd59d[_0x387777];return _0x3f84c0;};'use strict';var util=require(_0xdd59('0x0'));var _=require('lodash');var moment=require(_0xdd59('0x1'));function getSeconds(_0x2a7273,_0x296927){var _0x279f7f=moment(_0x2a7273)[_0xdd59('0x2')](0x0);var _0x25ee97=moment(_0x296927)['milliseconds'](0x0);return _0x279f7f[_0xdd59('0x3')](_0x25ee97,_0xdd59('0x4'));}function QueueCallerAbandon(_0x4ae985,_0x2a50c9){this[_0xdd59('0x5')]=_0x4ae985[_0xdd59('0x5')];this[_0xdd59('0x6')]=_0x4ae985[_0xdd59('0x6')];this[_0xdd59('0x7')]=_0x4ae985[_0xdd59('0x6')]===_0xdd59('0x8')?_0xdd59('0x9'):_0x4ae985['type'];this[_0xdd59('0xa')]=_0x4ae985[_0xdd59('0xa')];this[_0xdd59('0xb')]=_0x4ae985[_0xdd59('0xb')];this[_0xdd59('0xc')]=_0x4ae985[_0xdd59('0xc')];this[_0xdd59('0xd')]=_0x4ae985[_0xdd59('0xa')]+_0x4ae985[_0xdd59('0xb')]+_0x4ae985[_0xdd59('0xc')]+_0x4ae985[_0xdd59('0xe')]+_0x4ae985['countdropretry']+_0x4ae985[_0xdd59('0xf')]+_0x4ae985['countmachineretry']+_0x4ae985['countagentrejectretry'];this[_0xdd59('0xe')]=_0x4ae985[_0xdd59('0xe')];this['countdropretry']=_0x4ae985['countdropretry'];this[_0xdd59('0xf')]=_0x4ae985['countabandonedretry'];this[_0xdd59('0x10')]=_0x4ae985['countmachineretry'];this[_0xdd59('0x11')]=_0x4ae985[_0xdd59('0x11')];this[_0xdd59('0x12')]=_0x2a50c9['uniqueid'];this[_0xdd59('0x13')]=_0x4ae985['name'];this['calleridnum']=_0x4ae985[_0xdd59('0x14')];this[_0xdd59('0x15')]=_0x4ae985[_0xdd59('0x15')];this[_0xdd59('0x16')]=_0x4ae985[_0xdd59('0x16')];this[_0xdd59('0x17')]=_0x4ae985[_0xdd59('0x17')];this[_0xdd59('0x18')]=this[_0xdd59('0x17')];this[_0xdd59('0x19')]=getSeconds(_0x4ae985['responsetime'],_0x4ae985[_0xdd59('0x15')]);this[_0xdd59('0x1a')]=getSeconds(this[_0xdd59('0x17')],_0x4ae985['responsetime']);this[_0xdd59('0x1b')]=0x0;this['queue']=_0x2a50c9['queue'];this[_0xdd59('0x1c')]=_0x2a50c9[_0xdd59('0x1d')];this[_0xdd59('0x1e')]=_0x2a50c9['reason'];this['callback']=_0x4ae985['callback'];this[_0xdd59('0x1f')]=_0x4ae985[_0xdd59('0x1f')];this['callbackat']=_0x4ae985[_0xdd59('0x20')];this[_0xdd59('0x21')]=_0x4ae985['recallme'];this['ContactId']=_0x4ae985[_0xdd59('0x22')];this['ListId']=_0x4ae985[_0xdd59('0x23')];this[_0xdd59('0x24')]=_0x4ae985[_0xdd59('0x24')];this[_0xdd59('0x25')]=_0x4ae985[_0xdd59('0x25')];this[_0xdd59('0x26')]=_0x4ae985[_0xdd59('0x26')];this['originatecalleridnum']=_0x4ae985['originatecalleridnum']||'';this[_0xdd59('0x27')]=_0x4ae985[_0xdd59('0x27')]||'';}module[_0xdd59('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a92960f..512c923 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(_0x55db9b,_0x22e4f3){var _0x3071fa=function(_0x1a6707){while(--_0x1a6707){_0x55db9b['push'](_0x55db9b['shift']());}};_0x3071fa(++_0x22e4f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x2a23c5,_0x59f5c6){var _0x4b6cb3=function(_0x30ac16){while(--_0x30ac16){_0x2a23c5['push'](_0x2a23c5['shift']());}};_0x4b6cb3(++_0x59f5c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 95c83ae..09bfd61 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 _0x36ee=['./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','error','stringify','\x20receiveFax\x20','actions','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','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','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','bluebird','moment','path','tiff2pdf'];(function(_0x850922,_0x4f7e33){var _0x569da7=function(_0xdf8c57){while(--_0xdf8c57){_0x850922['push'](_0x850922['shift']());}};_0x569da7(++_0x4f7e33);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xe36e('0x0'));var uuid=require('uuid');var moment=require(_0xe36e('0x1'));var path=require(_0xe36e('0x2'));var tiff2pdf=require(_0xe36e('0x3'));var gs=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var ami=require(_0xe36e('0x7'));var rpcDb=require(_0xe36e('0x8'));var Channel=require(_0xe36e('0x9'));var ut=require(_0xe36e('0xa'));var Action=require(_0xe36e('0xb'));var faxAccount=require(_0xe36e('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xe36e('0xd'));function Fax(_0x4aebdd){this[_0xe36e('0xe')]={};this[_0xe36e('0xf')]=_0x4aebdd[_0xe36e('0xf')];this['trunks']=_0x4aebdd[_0xe36e('0x10')];this['actions']={};ami['on'](_0xe36e('0x11'),this[_0xe36e('0x12')][_0xe36e('0x13')](this));ami['on'](_0xe36e('0x14'),this[_0xe36e('0x15')][_0xe36e('0x13')](this));ami['on'](_0xe36e('0x16'),this[_0xe36e('0x17')]['bind'](this));ami['on'](_0xe36e('0x18'),this[_0xe36e('0x19')][_0xe36e('0x13')](this));ami['on'](_0xe36e('0x1a'),this['syncFaxStatus'][_0xe36e('0x13')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xe36e('0x13')](this));ami['on'](_0xe36e('0x1b'),this[_0xe36e('0x1c')][_0xe36e('0x13')](this));ami['on'](_0xe36e('0x1d'),this[_0xe36e('0x1e')][_0xe36e('0x13')](this));}Fax[_0xe36e('0x1f')][_0xe36e('0x12')]=function(_0x428d34){if(_0x428d34['context']===_0xe36e('0x20')){for(var _0x2184ae in this['faxAccounts']){if(this[_0xe36e('0xf')]['hasOwnProperty'](_0x2184ae)){if(_0x428d34[_0xe36e('0x21')]===this[_0xe36e('0xf')][_0x2184ae]['localstationid']){this[_0xe36e('0xe')][_0x428d34[_0xe36e('0x22')]]={};this[_0xe36e('0xe')][_0x428d34['uniqueid']][_0xe36e('0x23')]=_0x428d34[_0xe36e('0x23')];this[_0xe36e('0xe')][_0x428d34[_0xe36e('0x22')]]['id']=this[_0xe36e('0xf')][_0x2184ae]['id'];this[_0xe36e('0xe')][_0x428d34['uniqueid']][_0xe36e('0x24')]=this[_0xe36e('0xf')][_0x2184ae][_0xe36e('0x24')];logger[_0xe36e('0x25')](_0x428d34[_0xe36e('0x22')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x428d34[_0xe36e('0x22')]]){this[_0xe36e('0xe')][_0x428d34[_0xe36e('0x22')]]={};this[_0xe36e('0xe')][_0x428d34[_0xe36e('0x22')]][_0xe36e('0x23')]=_0x428d34[_0xe36e('0x23')];logger['info'](_0x428d34[_0xe36e('0x22')],_0xe36e('0x26'));}};Fax[_0xe36e('0x1f')][_0xe36e('0x15')]=function(_0x5e58d8){if(this[_0xe36e('0xe')][_0x5e58d8['uniqueid']]){for(var _0xf7b02e in _0x5e58d8['variable']){if(_0x5e58d8[_0xe36e('0x27')]['hasOwnProperty'](_0xf7b02e)){this[_0xe36e('0xe')][_0x5e58d8['uniqueid']][_0xf7b02e]=_0x5e58d8[_0xe36e('0x28')];}}}};Fax['prototype']['syncNewState']=function(_0x5d8fd8){if(this['channels'][_0x5d8fd8[_0xe36e('0x22')]]){this[_0xe36e('0xe')][_0x5d8fd8['uniqueid']]['channelstate']=_0x5d8fd8[_0xe36e('0x29')];this[_0xe36e('0xe')][_0x5d8fd8[_0xe36e('0x22')]][_0xe36e('0x2a')]=_0x5d8fd8[_0xe36e('0x2a')];}};Fax[_0xe36e('0x1f')]['syncNewExten']=function(_0xb98e78){if(this[_0xe36e('0xe')][_0xb98e78['uniqueid']]){for(var _0x87e595 in _0xb98e78[_0xe36e('0x27')]){if(_0xb98e78[_0xe36e('0x27')][_0xe36e('0x2b')](_0x87e595)){this[_0xe36e('0xe')][_0xb98e78[_0xe36e('0x22')]][_0x87e595]=_0xb98e78[_0xe36e('0x28')];}}}};Fax[_0xe36e('0x1f')][_0xe36e('0x2c')]=function(_0x1cc329){if(this[_0xe36e('0xe')][_0x1cc329['uniqueid']]){this[_0xe36e('0xe')][_0x1cc329['uniqueid']]['operation']=_0x1cc329[_0xe36e('0x2d')];this['channels'][_0x1cc329[_0xe36e('0x22')]][_0xe36e('0x2e')]=_0x1cc329[_0xe36e('0x2e')];this[_0xe36e('0xe')][_0x1cc329['uniqueid']]['localstationid']=_0x1cc329[_0xe36e('0x2f')];this[_0xe36e('0xe')][_0x1cc329[_0xe36e('0x22')]][_0xe36e('0x30')]=_0x1cc329['filename'];logger[_0xe36e('0x25')](_0x1cc329[_0xe36e('0x22')],_0xe36e('0x31'));}};Fax['prototype'][_0xe36e('0x32')]=function(_0x2ff8f4){var _0x5d9f64=this;if(this[_0xe36e('0xe')][_0x2ff8f4[_0xe36e('0x22')]]){var _0x3a95d7=this[_0xe36e('0xe')][_0x2ff8f4[_0xe36e('0x22')]]['id'];this[_0xe36e('0xe')][_0x2ff8f4[_0xe36e('0x22')]][_0xe36e('0x33')]=_0x2ff8f4[_0xe36e('0x33')];this[_0xe36e('0xe')][_0x2ff8f4[_0xe36e('0x22')]][_0xe36e('0x34')]=_0x2ff8f4[_0xe36e('0x34')];this['channels'][_0x2ff8f4[_0xe36e('0x22')]][_0xe36e('0x2f')]=_0x2ff8f4[_0xe36e('0x2f')];this[_0xe36e('0xe')][_0x2ff8f4[_0xe36e('0x22')]]['resolution']=_0x2ff8f4['resolution'];this[_0xe36e('0xe')][_0x2ff8f4[_0xe36e('0x22')]][_0xe36e('0x35')]=_0x2ff8f4[_0xe36e('0x35')];this[_0xe36e('0xe')][_0x2ff8f4[_0xe36e('0x22')]][_0xe36e('0x30')]=_0x2ff8f4[_0xe36e('0x30')];this['channels'][_0x2ff8f4[_0xe36e('0x22')]][_0xe36e('0x36')]=_0x2ff8f4['calleridnum'];if(this[_0xe36e('0xe')][_0x2ff8f4['uniqueid']][_0xe36e('0x34')]>0x0){tiff2pdf(_0x2ff8f4[_0xe36e('0x30')],_0xe36e('0x37'),function(_0x470f38){logger[_0xe36e('0x25')](_0x2ff8f4['uniqueid'],_0xe36e('0x38'),_0x470f38[_0xe36e('0x39')]);attachment[_0xe36e('0x3a')]({'name':path[_0xe36e('0x3b')](_0x2ff8f4[_0xe36e('0x30')])[_0xe36e('0x24')],'basename':path['parse'](_0x2ff8f4[_0xe36e('0x30')])[_0xe36e('0x24')]+_0xe36e('0x3c'),'type':_0xe36e('0x3d')})[_0xe36e('0x3e')](function(_0x49cf4b){faxAccount[_0xe36e('0x3f')](_0x3a95d7,{'from':_0x2ff8f4[_0xe36e('0x36')],'mapKey':_0xe36e('0x6'),'body':path[_0xe36e('0x3b')](_0x2ff8f4[_0xe36e('0x30')])[_0xe36e('0x24')]+_0xe36e('0x3c'),'AttachmentId':_0x49cf4b['id']})[_0xe36e('0x40')](function(_0x43c2d4){logger['error'](_0x2ff8f4['uniqueid'],_0xe36e('0x41'),JSON['stringify'](_0x43c2d4));});})[_0xe36e('0x40')](function(_0x3d322c){logger[_0xe36e('0x42')](_0x2ff8f4[_0xe36e('0x22')],'\x20receiveFax\x20',JSON[_0xe36e('0x43')](_0x3d322c));});});}logger[_0xe36e('0x25')](_0x2ff8f4['uniqueid'],_0xe36e('0x44'));}};Fax[_0xe36e('0x1f')][_0xe36e('0x1e')]=function(_0x42eae5){if(this[_0xe36e('0x45')][_0x42eae5[_0xe36e('0x22')]]){_[_0xe36e('0x46')](this[_0xe36e('0xe')][_0x42eae5[_0xe36e('0x22')]],_[_0xe36e('0x47')](_0x42eae5,[_0xe36e('0x48'),_0xe36e('0x49')]));}};function updateStatus(_0x3147c0){if(_0x3147c0[_0xe36e('0x4a')]){faxMessage[_0xe36e('0x4b')](_0x3147c0['AttachmentId'],{'failMessage':_0xe36e('0x4c')})['then'](function(_0x510fcf){ut[_0xe36e('0x4d')](_0xe36e('0x4e'),_0x510fcf);})['catch'](function(_0x3ec864){ut[_0xe36e('0x4d')](_0xe36e('0x4f'),_0x3ec864);});}else{ut[_0xe36e('0x4d')](_0xe36e('0x50'));}}Fax[_0xe36e('0x1f')][_0xe36e('0x51')]=function(_0x41e10d,_0x4d5762,_0x55d190){var _0x22117e=this;var _0x837e8={};if(_0x4d5762){_0x837e8={'read':_0x4d5762};}else{_0x837e8={'failMessage':_0x55d190};}if(this['actions'][_0x41e10d][_0xe36e('0x4a')]){faxMessage[_0xe36e('0x4b')](this[_0xe36e('0x45')][_0x41e10d][_0xe36e('0x4a')],_0x837e8)[_0xe36e('0x3e')](function(_0x53758e){ut['logger']('[Fax][Message][Updated]',_0x53758e);})['catch'](function(_0x47605d){ut[_0xe36e('0x4d')](_0xe36e('0x52'),_0x47605d);})[_0xe36e('0x53')](function(){delete _0x22117e[_0xe36e('0xe')][_0x41e10d];delete _0x22117e[_0xe36e('0x45')][_0x41e10d];});}else{ut[_0xe36e('0x4d')](_0xe36e('0x54'));delete this[_0xe36e('0xe')][_0x41e10d];delete this['actions'][_0x41e10d];}};Fax[_0xe36e('0x1f')][_0xe36e('0x1c')]=function(_0x5a058b){var _0xd0733f=this;if(this[_0xe36e('0xe')][_0x5a058b[_0xe36e('0x22')]]){if(this[_0xe36e('0x45')][_0x5a058b[_0xe36e('0x22')]]){this[_0xe36e('0xe')][_0x5a058b[_0xe36e('0x22')]]['id']=this[_0xe36e('0x45')][_0x5a058b[_0xe36e('0x22')]]['id'];this[_0xe36e('0xe')][_0x5a058b[_0xe36e('0x22')]][_0xe36e('0x24')]=this[_0xe36e('0x45')][_0x5a058b[_0xe36e('0x22')]][_0xe36e('0x24')];}logger[_0xe36e('0x25')](_0x5a058b[_0xe36e('0x22')],this[_0xe36e('0x45')][_0x5a058b[_0xe36e('0x22')]]?_0xe36e('0x55'):_0xe36e('0x56'),JSON[_0xe36e('0x43')](this[_0xe36e('0xe')][_0x5a058b[_0xe36e('0x22')]]));if(this[_0xe36e('0x45')][_0x5a058b['uniqueid']]){if(this[_0xe36e('0xe')][_0x5a058b[_0xe36e('0x22')]]['faxpages']>0x0&&this[_0xe36e('0xe')][_0x5a058b[_0xe36e('0x22')]][_0xe36e('0x1a')]===_0xe36e('0x57')){this[_0xe36e('0x51')](_0x5a058b[_0xe36e('0x22')],!![]);}else{this['updateStatus'](_0x5a058b[_0xe36e('0x22')],![],this['channels'][_0x5a058b[_0xe36e('0x22')]][_0xe36e('0x58')]?_0xe36e('0x59')+this[_0xe36e('0xe')][_0x5a058b[_0xe36e('0x22')]][_0xe36e('0x58')]:_0xe36e('0x5a'));}}}};Fax[_0xe36e('0x1f')]['send']=function(_0x34c7a5){var _0xcafb87=this;return new BPromise(function(_0x4e6929,_0x3068e1){_0xcafb87[_0xe36e('0x5b')](_0x34c7a5,_0xcafb87[_0xe36e('0xf')][_0x34c7a5[_0xe36e('0x5c')]])[_0xe36e('0x3e')](function(_0x3565cb){ut[_0xe36e('0x4d')]('[Fax][execOriginate][success]',_0x3565cb);_0x4e6929(ut[_0xe36e('0x39')](_0xe36e('0x5d')));})[_0xe36e('0x40')](function(_0x1b7268){ut[_0xe36e('0x4d')](_0xe36e('0x5e'),_0x1b7268);updateStatus(_0x34c7a5);_0x3068e1(ut[_0xe36e('0x39')](_0xe36e('0x5f')));});});};Fax[_0xe36e('0x1f')][_0xe36e('0x60')]=function(_0x1c98bf){var _0x509733=this;return new BPromise(function(_0x371af5,_0x9a77de){var _0xd10e0b=_0x509733[_0xe36e('0x61')](_0x509733['faxAccounts'][_0x1c98bf['FaxAccountId']][_0xe36e('0x62')],_0x1c98bf);if(_0xd10e0b['isValid']){_0x371af5(ut['message']('Trunk\x20Reachable'));}else{_0x9a77de(ut[_0xe36e('0x39')](_0xd10e0b['message']));}});};function originate(_0x2cbd78,_0x2f7093,_0x258a63){return new BPromise(function(_0x221a90,_0x1bd60d){if(_0x258a63){var _0x46f789=util[_0xe36e('0x63')](_0xe36e('0x64'),path[_0xe36e('0x3b')](_0x2cbd78['path'])[_0xe36e('0x24')],_0x2cbd78['path']);gs[_0xe36e('0x65')](_0x46f789)['then'](function(){_0x2cbd78[_0xe36e('0x2')]=util[_0xe36e('0x63')](_0xe36e('0x66'),path[_0xe36e('0x3b')](_0x2cbd78['path'])['dir'],path[_0xe36e('0x3b')](_0x2cbd78[_0xe36e('0x2')])[_0xe36e('0x24')]);_0x2f7093[_0xe36e('0x67')]=_0x2cbd78[_0xe36e('0x2')];ut[_0xe36e('0x4d')]('Convert\x20pdf\x20to\x20tif','');ami[_0xe36e('0x68')](ut[_0xe36e('0x69')](_0x2cbd78,_0x2f7093))['then'](function(_0xb83ea7){_0x221a90(_0xb83ea7);})['catch'](function(_0x45ebca){_0x1bd60d(_0x45ebca);});})[_0xe36e('0x40')](function(_0x1cb052){_0x1bd60d(_0x1cb052);});}else{ami[_0xe36e('0x68')](ut['variablesAction'](_0x2cbd78,_0x2f7093))[_0xe36e('0x3e')](function(_0x565bcf){_0x221a90(_0x565bcf);})['catch'](function(_0x39ace1){_0x1bd60d(_0x39ace1);});}});}Fax[_0xe36e('0x1f')]['execOriginate']=function(_0x51f319,_0x460cc9){var _0x5ae7c6=this;return new BPromise(function(_0x33f3f5,_0x36ddc0){var _0x2c0ed5=uuid['v4']();var _0x276533=ut[_0xe36e('0x6a')](_0x51f319,_0x460cc9);_0x5ae7c6[_0xe36e('0x45')][_0x2c0ed5]=new Action(_0x2c0ed5,_0x460cc9,_0x51f319);var _0x590885=_0x5ae7c6[_0xe36e('0x45')][_0x2c0ed5];if(path[_0xe36e('0x3b')](_0x51f319[_0xe36e('0x2')])[_0xe36e('0x6b')]==='.pdf'){originate(_0x590885,_0x276533,!![])[_0xe36e('0x3e')](function(_0x37409f){_0x33f3f5(_0x37409f);})[_0xe36e('0x40')](function(_0x39c9fe){_0x36ddc0(_0x39c9fe);});}else{originate(_0x590885,_0x276533,![])['then'](function(_0x38be05){_0x33f3f5(_0x38be05);})['catch'](function(_0x1dae76){_0x36ddc0(_0x1dae76);});}});};Fax['prototype'][_0xe36e('0x6c')]=function(_0x522968){return!_['isNil'](_0x522968)&&!_[_0xe36e('0x6d')](_0x522968[_0xe36e('0x24')])&&!_[_0xe36e('0x6d')](_0x522968['active'])&&_0x522968[_0xe36e('0x6e')]&&!_[_0xe36e('0x6d')](this['trunks'][util[_0xe36e('0x63')](_0xe36e('0x6f'),_0x522968[_0xe36e('0x24')])])&&!_['isNil'](this['trunks'][util[_0xe36e('0x63')](_0xe36e('0x6f'),_0x522968[_0xe36e('0x24')])][_0xe36e('0x2e')])&&(this[_0xe36e('0x10')][util['format'](_0xe36e('0x6f'),_0x522968[_0xe36e('0x24')])][_0xe36e('0x2e')]===_0xe36e('0x70')||this[_0xe36e('0x10')][util['format'](_0xe36e('0x6f'),_0x522968[_0xe36e('0x24')])][_0xe36e('0x2e')]==='unmonitored');};Fax[_0xe36e('0x1f')]['checkTrunk']=function(_0x2ee394,_0x4c1845){if(!this[_0xe36e('0x6c')](_0x2ee394)){ut[_0xe36e('0x4d')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xe36e('0x6d')](_0x2ee394)?'':_0x2ee394['name']+_0xe36e('0x71'));return{'isValid':![],'message':_0xe36e('0x72')};}if(_[_0xe36e('0x6d')](_0x4c1845[_0xe36e('0x6')])){ut[_0xe36e('0x4d')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xe36e('0x43')](_0x4c1845));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xe36e('0x6d')](_0x4c1845[_0xe36e('0x2')])){ut[_0xe36e('0x4d')](_0xe36e('0x73'),JSON[_0xe36e('0x43')](_0x4c1845));return{'isValid':![],'message':_0xe36e('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xe36e('0x75')]=Fax; \ No newline at end of file +var _0x4cf8=['isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable'];(function(_0x19da4d,_0x260981){var _0xc71c77=function(_0x4edb82){while(--_0x4edb82){_0x19da4d['push'](_0x19da4d['shift']());}};_0xc71c77(++_0x260981);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x2d3c60,_0x4df458){_0x2d3c60=_0x2d3c60-0x0;var _0x560041=_0x4cf8[_0x2d3c60];return _0x560041;};'use strict';var util=require(_0x84cf('0x0'));var _=require(_0x84cf('0x1'));var BPromise=require(_0x84cf('0x2'));var uuid=require(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var path=require(_0x84cf('0x5'));var tiff2pdf=require(_0x84cf('0x6'));var gs=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var ami=require(_0x84cf('0xa'));var rpcDb=require(_0x84cf('0xb'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x84cf('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x84cf('0xd'));var faxMessage=require(_0x84cf('0xe'));function Fax(_0x51b84c){this[_0x84cf('0xf')]={};this[_0x84cf('0x10')]=_0x51b84c['faxAccounts'];this[_0x84cf('0x11')]=_0x51b84c[_0x84cf('0x11')];this[_0x84cf('0x12')]={};ami['on'](_0x84cf('0x13'),this['syncNewchannel'][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x15'),this['syncVarSet']['bind'](this));ami['on'](_0x84cf('0x16'),this[_0x84cf('0x17')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x18'),this[_0x84cf('0x19')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x1a'),this[_0x84cf('0x1b')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x1c'),this[_0x84cf('0x1d')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x1e'),this[_0x84cf('0x1f')][_0x84cf('0x14')](this));ami['on'](_0x84cf('0x20'),this[_0x84cf('0x21')][_0x84cf('0x14')](this));}Fax[_0x84cf('0x22')]['syncNewchannel']=function(_0x441590){if(_0x441590[_0x84cf('0x23')]===_0x84cf('0x24')){for(var _0x1abe2d in this[_0x84cf('0x10')]){if(this[_0x84cf('0x10')][_0x84cf('0x25')](_0x1abe2d)){if(_0x441590['exten']===this['faxAccounts'][_0x1abe2d][_0x84cf('0x26')]){this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]={};this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]['channel']=_0x441590[_0x84cf('0x28')];this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]['id']=this[_0x84cf('0x10')][_0x1abe2d]['id'];this[_0x84cf('0xf')][_0x441590['uniqueid']][_0x84cf('0x29')]=this[_0x84cf('0x10')][_0x1abe2d][_0x84cf('0x29')];logger[_0x84cf('0x2a')](_0x441590[_0x84cf('0x27')],_0x84cf('0x2b'));}}}}if(this[_0x84cf('0x12')][_0x441590['uniqueid']]){this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]]={};this[_0x84cf('0xf')][_0x441590[_0x84cf('0x27')]][_0x84cf('0x28')]=_0x441590[_0x84cf('0x28')];logger[_0x84cf('0x2a')](_0x441590[_0x84cf('0x27')],_0x84cf('0x2b'));}};Fax[_0x84cf('0x22')]['syncVarSet']=function(_0x83f20b){if(this[_0x84cf('0xf')][_0x83f20b[_0x84cf('0x27')]]){for(var _0x41a5db in _0x83f20b['variable']){if(_0x83f20b[_0x84cf('0x2c')]['hasOwnProperty'](_0x41a5db)){this[_0x84cf('0xf')][_0x83f20b[_0x84cf('0x27')]][_0x41a5db]=_0x83f20b[_0x84cf('0x2d')];}}}};Fax[_0x84cf('0x22')][_0x84cf('0x17')]=function(_0x20de4b){if(this[_0x84cf('0xf')][_0x20de4b[_0x84cf('0x27')]]){this[_0x84cf('0xf')][_0x20de4b[_0x84cf('0x27')]][_0x84cf('0x2e')]=_0x20de4b[_0x84cf('0x2e')];this[_0x84cf('0xf')][_0x20de4b[_0x84cf('0x27')]]['channelstatedesc']=_0x20de4b['channelstatedesc'];}};Fax[_0x84cf('0x22')][_0x84cf('0x19')]=function(_0x16ebaa){if(this[_0x84cf('0xf')][_0x16ebaa[_0x84cf('0x27')]]){for(var _0x1453cf in _0x16ebaa[_0x84cf('0x2c')]){if(_0x16ebaa[_0x84cf('0x2c')]['hasOwnProperty'](_0x1453cf)){this[_0x84cf('0xf')][_0x16ebaa[_0x84cf('0x27')]][_0x1453cf]=_0x16ebaa['value'];}}}};Fax[_0x84cf('0x22')]['syncFaxStatus']=function(_0x4624e3){if(this[_0x84cf('0xf')][_0x4624e3[_0x84cf('0x27')]]){this[_0x84cf('0xf')][_0x4624e3[_0x84cf('0x27')]]['operation']=_0x4624e3[_0x84cf('0x2f')];this['channels'][_0x4624e3['uniqueid']][_0x84cf('0x30')]=_0x4624e3[_0x84cf('0x30')];this['channels'][_0x4624e3[_0x84cf('0x27')]][_0x84cf('0x26')]=_0x4624e3[_0x84cf('0x26')];this[_0x84cf('0xf')][_0x4624e3[_0x84cf('0x27')]][_0x84cf('0x31')]=_0x4624e3['filename'];logger[_0x84cf('0x2a')](_0x4624e3[_0x84cf('0x27')],_0x84cf('0x32'));}};Fax[_0x84cf('0x22')][_0x84cf('0x1d')]=function(_0x2a8992){var _0x5129b0=this;if(this[_0x84cf('0xf')][_0x2a8992['uniqueid']]){var _0x1434e2=this[_0x84cf('0xf')][_0x2a8992[_0x84cf('0x27')]]['id'];this[_0x84cf('0xf')][_0x2a8992[_0x84cf('0x27')]][_0x84cf('0x33')]=_0x2a8992[_0x84cf('0x33')];this[_0x84cf('0xf')][_0x2a8992[_0x84cf('0x27')]]['pagestransferred']=_0x2a8992[_0x84cf('0x34')];this['channels'][_0x2a8992[_0x84cf('0x27')]][_0x84cf('0x26')]=_0x2a8992['localstationid'];this[_0x84cf('0xf')][_0x2a8992['uniqueid']][_0x84cf('0x35')]=_0x2a8992['resolution'];this[_0x84cf('0xf')][_0x2a8992['uniqueid']][_0x84cf('0x36')]=_0x2a8992[_0x84cf('0x36')];this['channels'][_0x2a8992[_0x84cf('0x27')]][_0x84cf('0x31')]=_0x2a8992[_0x84cf('0x31')];this['channels'][_0x2a8992[_0x84cf('0x27')]]['calleridnum']=_0x2a8992[_0x84cf('0x37')];if(this['channels'][_0x2a8992['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x2a8992[_0x84cf('0x31')],_0x84cf('0x38'),function(_0x49cb4f){logger[_0x84cf('0x2a')](_0x2a8992['uniqueid'],_0x84cf('0x39'),_0x49cb4f[_0x84cf('0x3a')]);attachment['create']({'name':path[_0x84cf('0x3b')](_0x2a8992['filename'])[_0x84cf('0x29')],'basename':path['parse'](_0x2a8992['filename'])['name']+'.pdf','type':'application/pdf'})['then'](function(_0x59b81c){faxAccount[_0x84cf('0x3c')](_0x1434e2,{'from':_0x2a8992[_0x84cf('0x37')],'mapKey':_0x84cf('0x9'),'body':path[_0x84cf('0x3b')](_0x2a8992['filename'])[_0x84cf('0x29')]+'.pdf','AttachmentId':_0x59b81c['id']})[_0x84cf('0x3d')](function(_0x3c89da){logger[_0x84cf('0x3e')](_0x2a8992[_0x84cf('0x27')],_0x84cf('0x3f'),JSON[_0x84cf('0x40')](_0x3c89da));});})['catch'](function(_0x2f7da6){logger[_0x84cf('0x3e')](_0x2a8992['uniqueid'],_0x84cf('0x41'),JSON[_0x84cf('0x40')](_0x2f7da6));});});}logger[_0x84cf('0x2a')](_0x2a8992['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0x84cf('0x21')]=function(_0x104421){if(this[_0x84cf('0x12')][_0x104421[_0x84cf('0x27')]]){_[_0x84cf('0x42')](this[_0x84cf('0xf')][_0x104421['uniqueid']],_[_0x84cf('0x43')](_0x104421,['response',_0x84cf('0x44')]));}};function updateStatus(_0x499225){if(_0x499225['AttachmentId']){faxMessage[_0x84cf('0x45')](_0x499225[_0x84cf('0x46')],{'failMessage':_0x84cf('0x47')})['then'](function(_0x52740c){ut[_0x84cf('0x48')](_0x84cf('0x49'),_0x52740c);})[_0x84cf('0x3d')](function(_0x15f783){ut[_0x84cf('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x15f783);});}else{ut[_0x84cf('0x48')](_0x84cf('0x4a'));}}Fax['prototype'][_0x84cf('0x4b')]=function(_0x5baea8,_0x4fd496,_0x147194){var _0x319322=this;var _0x5c651c={};if(_0x4fd496){_0x5c651c={'read':_0x4fd496};}else{_0x5c651c={'failMessage':_0x147194};}if(this['actions'][_0x5baea8][_0x84cf('0x46')]){faxMessage[_0x84cf('0x45')](this[_0x84cf('0x12')][_0x5baea8][_0x84cf('0x46')],_0x5c651c)[_0x84cf('0x4c')](function(_0x3edaec){ut[_0x84cf('0x48')](_0x84cf('0x4d'),_0x3edaec);})['catch'](function(_0x1bc15c){ut[_0x84cf('0x48')]('[Fax][Message][NoUpdate1]',_0x1bc15c);})['finally'](function(){delete _0x319322[_0x84cf('0xf')][_0x5baea8];delete _0x319322[_0x84cf('0x12')][_0x5baea8];});}else{ut[_0x84cf('0x48')](_0x84cf('0x4e'));delete this[_0x84cf('0xf')][_0x5baea8];delete this[_0x84cf('0x12')][_0x5baea8];}};Fax[_0x84cf('0x22')]['syncHangup']=function(_0x652356){var _0x4aa8b2=this;if(this[_0x84cf('0xf')][_0x652356['uniqueid']]){if(this[_0x84cf('0x12')][_0x652356[_0x84cf('0x27')]]){this['channels'][_0x652356[_0x84cf('0x27')]]['id']=this[_0x84cf('0x12')][_0x652356['uniqueid']]['id'];this[_0x84cf('0xf')][_0x652356['uniqueid']]['name']=this['actions'][_0x652356['uniqueid']][_0x84cf('0x29')];}logger[_0x84cf('0x2a')](_0x652356[_0x84cf('0x27')],this[_0x84cf('0x12')][_0x652356['uniqueid']]?_0x84cf('0x4f'):_0x84cf('0x50'),JSON['stringify'](this[_0x84cf('0xf')][_0x652356[_0x84cf('0x27')]]));if(this[_0x84cf('0x12')][_0x652356[_0x84cf('0x27')]]){if(this[_0x84cf('0xf')][_0x652356[_0x84cf('0x27')]][_0x84cf('0x51')]>0x0&&this[_0x84cf('0xf')][_0x652356['uniqueid']][_0x84cf('0x1a')]==='SUCCESS'){this[_0x84cf('0x4b')](_0x652356[_0x84cf('0x27')],!![]);}else{this[_0x84cf('0x4b')](_0x652356[_0x84cf('0x27')],![],this[_0x84cf('0xf')][_0x652356['uniqueid']][_0x84cf('0x52')]?_0x84cf('0x53')+this[_0x84cf('0xf')][_0x652356['uniqueid']][_0x84cf('0x52')]:_0x84cf('0x54'));}}}};Fax['prototype'][_0x84cf('0x55')]=function(_0x482958){var _0x26f8d4=this;return new BPromise(function(_0x30aa60,_0x57f1f2){_0x26f8d4[_0x84cf('0x56')](_0x482958,_0x26f8d4[_0x84cf('0x10')][_0x482958['FaxAccountId']])[_0x84cf('0x4c')](function(_0x2ff1bb){ut[_0x84cf('0x48')](_0x84cf('0x57'),_0x2ff1bb);_0x30aa60(ut['message'](_0x84cf('0x58')));})[_0x84cf('0x3d')](function(_0x4b52c8){ut['logger']('[Fax][execOriginate][failure]',_0x4b52c8);updateStatus(_0x482958);_0x57f1f2(ut[_0x84cf('0x3a')](_0x84cf('0x59')));});});};Fax[_0x84cf('0x22')]['checkAfterSend']=function(_0x5a8e61){var _0x30aecd=this;return new BPromise(function(_0x3040ee,_0xa17c6c){var _0x2ef504=_0x30aecd[_0x84cf('0x5a')](_0x30aecd[_0x84cf('0x10')][_0x5a8e61[_0x84cf('0x5b')]][_0x84cf('0x5c')],_0x5a8e61);if(_0x2ef504['isValid']){_0x3040ee(ut[_0x84cf('0x3a')]('Trunk\x20Reachable'));}else{_0xa17c6c(ut[_0x84cf('0x3a')](_0x2ef504[_0x84cf('0x3a')]));}});};function originate(_0x5ebea2,_0x5b154a,_0x282c17){return new BPromise(function(_0x31e622,_0x373a25){if(_0x282c17){var _0x1c6e56=util[_0x84cf('0x5d')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x84cf('0x3b')](_0x5ebea2[_0x84cf('0x5')])[_0x84cf('0x29')],_0x5ebea2[_0x84cf('0x5')]);gs['execute'](_0x1c6e56)[_0x84cf('0x4c')](function(){_0x5ebea2['path']=util['format'](_0x84cf('0x5e'),path[_0x84cf('0x3b')](_0x5ebea2[_0x84cf('0x5')])[_0x84cf('0x5f')],path['parse'](_0x5ebea2['path'])['name']);_0x5b154a[_0x84cf('0x60')]=_0x5ebea2['path'];ut[_0x84cf('0x48')](_0x84cf('0x61'),'');ami[_0x84cf('0x62')](ut[_0x84cf('0x63')](_0x5ebea2,_0x5b154a))['then'](function(_0x1fa573){_0x31e622(_0x1fa573);})[_0x84cf('0x3d')](function(_0x4e1141){_0x373a25(_0x4e1141);});})[_0x84cf('0x3d')](function(_0x491897){_0x373a25(_0x491897);});}else{ami['Action'](ut[_0x84cf('0x63')](_0x5ebea2,_0x5b154a))[_0x84cf('0x4c')](function(_0x5e3bd3){_0x31e622(_0x5e3bd3);})['catch'](function(_0x122f08){_0x373a25(_0x122f08);});}});}Fax['prototype']['execOriginate']=function(_0x55d0e8,_0x394d5d){var _0x444bb8=this;return new BPromise(function(_0x3674f3,_0x58300f){var _0x49e6f6=uuid['v4']();var _0x2994b2=ut[_0x84cf('0x64')](_0x55d0e8,_0x394d5d);_0x444bb8[_0x84cf('0x12')][_0x49e6f6]=new Action(_0x49e6f6,_0x394d5d,_0x55d0e8);var _0x4686e2=_0x444bb8['actions'][_0x49e6f6];if(path['parse'](_0x55d0e8['path'])[_0x84cf('0x65')]===_0x84cf('0x66')){originate(_0x4686e2,_0x2994b2,!![])[_0x84cf('0x4c')](function(_0x4fc2f2){_0x3674f3(_0x4fc2f2);})[_0x84cf('0x3d')](function(_0x29d062){_0x58300f(_0x29d062);});}else{originate(_0x4686e2,_0x2994b2,![])[_0x84cf('0x4c')](function(_0x9447b6){_0x3674f3(_0x9447b6);})[_0x84cf('0x3d')](function(_0x4c0461){_0x58300f(_0x4c0461);});}});};Fax[_0x84cf('0x22')][_0x84cf('0x67')]=function(_0xc32a6f){return!_['isNil'](_0xc32a6f)&&!_[_0x84cf('0x68')](_0xc32a6f[_0x84cf('0x29')])&&!_['isNil'](_0xc32a6f[_0x84cf('0x69')])&&_0xc32a6f[_0x84cf('0x69')]&&!_[_0x84cf('0x68')](this[_0x84cf('0x11')][util['format']('SIP/%s',_0xc32a6f[_0x84cf('0x29')])])&&!_[_0x84cf('0x68')](this['trunks'][util['format'](_0x84cf('0x6a'),_0xc32a6f[_0x84cf('0x29')])][_0x84cf('0x30')])&&(this[_0x84cf('0x11')][util[_0x84cf('0x5d')](_0x84cf('0x6a'),_0xc32a6f[_0x84cf('0x29')])][_0x84cf('0x30')]==='reachable'||this[_0x84cf('0x11')][util[_0x84cf('0x5d')](_0x84cf('0x6a'),_0xc32a6f[_0x84cf('0x29')])][_0x84cf('0x30')]===_0x84cf('0x6b'));};Fax['prototype'][_0x84cf('0x5a')]=function(_0x5af1e1,_0x105875){if(!this[_0x84cf('0x67')](_0x5af1e1)){ut[_0x84cf('0x48')](_0x84cf('0x6c'),_[_0x84cf('0x68')](_0x5af1e1)?'':_0x5af1e1['name']+_0x84cf('0x6d'));return{'isValid':![],'message':_0x84cf('0x6e')};}if(_[_0x84cf('0x68')](_0x105875[_0x84cf('0x9')])){ut[_0x84cf('0x48')](_0x84cf('0x6f'),JSON[_0x84cf('0x40')](_0x105875));return{'isValid':![],'message':_0x84cf('0x70')};}if(_[_0x84cf('0x68')](_0x105875[_0x84cf('0x5')])){ut[_0x84cf('0x48')](_0x84cf('0x71'),JSON[_0x84cf('0x40')](_0x105875));return{'isValid':![],'message':_0x84cf('0x72')};}return{'isValid':!![],'message':_0x84cf('0x73')};};module[_0x84cf('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 010ed6b..7086100 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 _0xb2c7=['then','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify','resolve'];(function(_0x190e2b,_0x196304){var _0x1f18e4=function(_0x47ede3){while(--_0x47ede3){_0x190e2b['push'](_0x190e2b['shift']());}};_0x1f18e4(++_0x196304);}(_0xb2c7,0x101));var _0x7b2c=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb2c7[_0x465a0c];return _0x1e202e;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x7b2c('0x0'))(_0x7b2c('0x1'));var _=require(_0x7b2c('0x2'));var faxAccount=require(_0x7b2c('0x3'));function loggerCatch(_0xd5071a){return function(_0x4fceb3){logger['error'](_0xd5071a,util[_0x7b2c('0x4')](_0x4fceb3,{'showHidden':![],'depth':null}));};}exports[_0x7b2c('0x5')]=function(_0xde00cb,_0x33a5f6){return BPromise[_0x7b2c('0x6')]()[_0x7b2c('0x7')](faxAccount[_0x7b2c('0x5')](_0xde00cb,_0x33a5f6))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xe8df=['inspect','notify','resolve','then','catch','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x112d20,_0x4bd3b6){var _0x48c4ce=function(_0x4715da){while(--_0x4715da){_0x112d20['push'](_0x112d20['shift']());}};_0x48c4ce(++_0x4bd3b6);}(_0xe8df,0x94));var _0xfe8d=function(_0x1aa2c2,_0x4f51ee){_0x1aa2c2=_0x1aa2c2-0x0;var _0x3cf3d5=_0xe8df[_0x1aa2c2];return _0x3cf3d5;};'use strict';var util=require('util');var BPromise=require(_0xfe8d('0x0'));var logger=require(_0xfe8d('0x1'))(_0xfe8d('0x2'));var _=require(_0xfe8d('0x3'));var faxAccount=require(_0xfe8d('0x4'));function loggerCatch(_0x3bbfc9){return function(_0x4bcfb1){logger[_0xfe8d('0x5')](_0x3bbfc9,util[_0xfe8d('0x6')](_0x4bcfb1,{'showHidden':![],'depth':null}));};}exports[_0xfe8d('0x7')]=function(_0x2a20da,_0x2dbcc){return BPromise[_0xfe8d('0x8')]()[_0xfe8d('0x9')](faxAccount[_0xfe8d('0x7')](_0x2a20da,_0x2dbcc))[_0xfe8d('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index a67394d..c798254 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 _0x0b46=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger'];(function(_0x4daa91,_0x18167b){var _0x2d04c6=function(_0x410af3){while(--_0x410af3){_0x4daa91['push'](_0x4daa91['shift']());}};_0x2d04c6(++_0x18167b);}(_0x0b46,0x166));var _0x60b4=function(_0x3e438f,_0x4439e7){_0x3e438f=_0x3e438f-0x0;var _0x35f7ff=_0x0b46[_0x3e438f];return _0x35f7ff;};'use strict';var util=require(_0x60b4('0x0'));var logger=require(_0x60b4('0x1'))(_0x60b4('0x2'));var BPromise=require(_0x60b4('0x3'));var exec=require(_0x60b4('0x4'))[_0x60b4('0x5')];exports[_0x60b4('0x6')]=function(_0x41a85f){return new BPromise(function(_0x39a908,_0x139fa7){exec(_0x41a85f,function(_0x1d3c83,_0x1bf87c,_0x2caccc){logger[_0x60b4('0x7')](_0x60b4('0x8'),_0x1bf87c);if(_0x1d3c83){logger[_0x60b4('0x7')]('Exec\x20gs','\x20Error\x20:',util[_0x60b4('0x9')](_0x1d3c83,{'showHidden':![],'depth':null}),_0x1bf87c,_0x2caccc);_0x139fa7(_0x1d3c83);}_0x39a908(_0x1bf87c);});});}; \ No newline at end of file +var _0x206c=['fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x206c,0x166));var _0xc206=function(_0x104ada,_0xc16fff){_0x104ada=_0x104ada-0x0;var _0x70ab44=_0x206c[_0x104ada];return _0x70ab44;};'use strict';var util=require(_0xc206('0x0'));var logger=require(_0xc206('0x1'))(_0xc206('0x2'));var BPromise=require(_0xc206('0x3'));var exec=require(_0xc206('0x4'))['exec'];exports[_0xc206('0x5')]=function(_0x9f4c6f){return new BPromise(function(_0x557a1b,_0x2a85ad){exec(_0x9f4c6f,function(_0x3dabb8,_0x1aa796,_0x477c36){logger[_0xc206('0x6')]('Exec\x20gs',_0x1aa796);if(_0x3dabb8){logger['info'](_0xc206('0x7'),_0xc206('0x8'),util[_0xc206('0x9')](_0x3dabb8,{'showHidden':![],'depth':null}),_0x1aa796,_0x477c36);_0x2a85ad(_0x3dabb8);}_0x557a1b(_0x1aa796);});});}; \ 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 ddd40ae..51a6156 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 _0x5adf=['channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','lodash','../../../../config/logger','fax','logger','ecm','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate'];(function(_0x1b0865,_0x1daf7e){var _0x318381=function(_0x4f9ed2){while(--_0x4f9ed2){_0x1b0865['push'](_0x1b0865['shift']());}};_0x318381(++_0x1daf7e);}(_0x5adf,0x1e9));var _0xf5ad=function(_0x85e76a,_0x3d5528){_0x85e76a=_0x85e76a-0x0;var _0x5b0a18=_0x5adf[_0x85e76a];return _0x5b0a18;};'use strict';var util=require(_0xf5ad('0x0'));var _=require(_0xf5ad('0x1'));var moment=require('moment');var logger=require(_0xf5ad('0x2'))(_0xf5ad('0x3'));exports['message']=function(_0x3d8149){return{'message':_0x3d8149};};exports[_0xf5ad('0x4')]=function(_0x36d892,_0x444afc){logger['info'](_0x36d892,util['inspect'](_0x444afc,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x22c03f,_0x30b6d5){var _0x2056f1={'XMF-ECM':_0x30b6d5[_0xf5ad('0x5')],'XMF-HEADERINFO':_0x30b6d5['headerinfo'],'XMF-MINRATE':_0x30b6d5[_0xf5ad('0x6')],'XMF-MAXRATE':_0x30b6d5[_0xf5ad('0x7')],'XMF-MODEM':util[_0xf5ad('0x8')]('\x22%s\x22',_0x30b6d5[_0xf5ad('0x9')]),'XMF-GATEWAY':_0x30b6d5[_0xf5ad('0xa')],'XMF-FAXDETECT':_0x30b6d5[_0xf5ad('0xb')],'XMF-T38TIMEOUT':_0x30b6d5[_0xf5ad('0xc')],'XMF-LOCALSTATIONID':_0x30b6d5[_0xf5ad('0xd')],'XMF-PATH':_0x22c03f[_0xf5ad('0xe')]};return _0x2056f1;};exports[_0xf5ad('0xf')]=function(_0x124229,_0xbeee7){return{'actionid':_0x124229['uniqueid'],'action':_0xf5ad('0x10'),'channel':_0x124229[_0xf5ad('0x11')],'Exten':_0xf5ad('0x12'),'Context':_0xf5ad('0x13'),'Priority':'1','callerid':util[_0xf5ad('0x8')](_0xf5ad('0x14'),_0x124229['headerinfo']?_0x124229['headerinfo']:'',_0x124229['localstationid']),'variable':_0xbeee7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x124229[_0xf5ad('0x15')]};}; \ No newline at end of file +var _0x5f66=['format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','message','info','inspect','headerinfo'];(function(_0x3d4768,_0x3bbb11){var _0x1f895c=function(_0x532e95){while(--_0x532e95){_0x3d4768['push'](_0x3d4768['shift']());}};_0x1f895c(++_0x3bbb11);}(_0x5f66,0x139));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var util=require(_0x65f6('0x0'));var _=require('lodash');var moment=require(_0x65f6('0x1'));var logger=require(_0x65f6('0x2'))('fax');exports[_0x65f6('0x3')]=function(_0x20eef5){return{'message':_0x20eef5};};exports['logger']=function(_0x24b506,_0x5cf7a4){logger[_0x65f6('0x4')](_0x24b506,util[_0x65f6('0x5')](_0x5cf7a4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x31dabb,_0x500aff){var _0x479ccb={'XMF-ECM':_0x500aff['ecm'],'XMF-HEADERINFO':_0x500aff[_0x65f6('0x6')],'XMF-MINRATE':_0x500aff['minrate'],'XMF-MAXRATE':_0x500aff['maxrate'],'XMF-MODEM':util[_0x65f6('0x7')](_0x65f6('0x8'),_0x500aff[_0x65f6('0x9')]),'XMF-GATEWAY':_0x500aff['gateway'],'XMF-FAXDETECT':_0x500aff[_0x65f6('0xa')],'XMF-T38TIMEOUT':_0x500aff[_0x65f6('0xb')],'XMF-LOCALSTATIONID':_0x500aff[_0x65f6('0xc')],'XMF-PATH':_0x31dabb[_0x65f6('0xd')]};return _0x479ccb;};exports['variablesAction']=function(_0xc8c571,_0x1b94f1){return{'actionid':_0xc8c571[_0x65f6('0xe')],'action':_0x65f6('0xf'),'channel':_0xc8c571[_0x65f6('0x10')],'Exten':_0x65f6('0x11'),'Context':_0x65f6('0x12'),'Priority':'1','callerid':util[_0x65f6('0x7')](_0x65f6('0x13'),_0xc8c571[_0x65f6('0x6')]?_0xc8c571['headerinfo']:'',_0xc8c571[_0x65f6('0xc')]),'variable':_0x1b94f1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xc8c571[_0x65f6('0xe')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e74bd3e..5a9c82f 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 _0xa683=['./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','[index.js][initParams]','sync','error','[index.js][main]','inspect','bluebird','util','moment'];(function(_0x3cdb90,_0x38f879){var _0x298a75=function(_0x2981d9){while(--_0x2981d9){_0x3cdb90['push'](_0x3cdb90['shift']());}};_0x298a75(++_0x38f879);}(_0xa683,0x15b));var _0x3a68=function(_0x531186,_0x5b22ef){_0x531186=_0x531186-0x0;var _0x5b0865=_0xa683[_0x531186];return _0x5b0865;};'use strict';var BPromise=require(_0x3a68('0x0'));var util=require(_0x3a68('0x1'));var moment=require(_0x3a68('0x2'));var server=require('./server');var Realtime=require(_0x3a68('0x3'));var Report=require(_0x3a68('0x4'));var Acw=require(_0x3a68('0x5'));var Trigger=require(_0x3a68('0x6'));var Dialer=require(_0x3a68('0x7'));var Preview=require(_0x3a68('0x8'));var Fax=require(_0x3a68('0x9'));var user=require(_0x3a68('0xa'));var voiceQueue=require(_0x3a68('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x3a68('0xc'));var trunk=require(_0x3a68('0xd'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x3a68('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x3a68('0xf'));var faxAccount=require(_0x3a68('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x3a68('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x3a68('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x3a68('0x13'));var vtiger=require(_0x3a68('0x14'));var freshsales=require(_0x3a68('0x15'));var servicenow=require(_0x3a68('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(_0x3a68('0x17'))(_0x3a68('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x3a68('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3a68('0x1a')](_0x3a68('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x3a68('0x1b')]()[_0x3a68('0x1c')](user[_0x3a68('0x1d')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x1e')]())[_0x3a68('0x1c')](user['getTelephones']())['then'](realtime[_0x3a68('0x1f')]())[_0x3a68('0x1c')](trunk[_0x3a68('0x20')]())[_0x3a68('0x1c')](realtime['initTrunks']())[_0x3a68('0x1c')](voiceQueue[_0x3a68('0x21')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x22')]())[_0x3a68('0x1c')](trigger['getTriggers']())[_0x3a68('0x1c')](realtime[_0x3a68('0x23')]())[_0x3a68('0x1c')](template[_0x3a68('0x24')]())['then'](realtime[_0x3a68('0x25')]())[_0x3a68('0x1c')](zendesk[_0x3a68('0x26')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x27')]())['then'](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x3a68('0x28')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x29')]())[_0x3a68('0x1c')](freshdesk[_0x3a68('0x2a')]())['then'](realtime['initFreshdeskAccounts']())[_0x3a68('0x1c')](desk[_0x3a68('0x2b')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x2c')]())[_0x3a68('0x1c')](zoho[_0x3a68('0x2d')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x2e')]())[_0x3a68('0x1c')](vtiger[_0x3a68('0x2f')]())[_0x3a68('0x1c')](realtime['initVtigerAccounts']())['then'](freshsales[_0x3a68('0x30')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x31')]())[_0x3a68('0x1c')](servicenow[_0x3a68('0x32')]())[_0x3a68('0x1c')](realtime['initServicenowAccounts']())[_0x3a68('0x1c')](dynamics365[_0x3a68('0x33')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x34')]())[_0x3a68('0x1c')](campaign[_0x3a68('0x35')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x36')]())[_0x3a68('0x1c')](voiceExtension['getVoiceExtensions']())[_0x3a68('0x1c')](realtime[_0x3a68('0x37')]())['then'](faxAccount[_0x3a68('0x38')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x39')]())[_0x3a68('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x3a68('0x1b')]()[_0x3a68('0x1c')](voiceQueueReport[_0x3a68('0x3a')]())[_0x3a68('0x1c')](realtime[_0x3a68('0x3b')]())[_0x3a68('0x1c')](cmHopperHistory[_0x3a68('0x3c')]())['then'](realtime[_0x3a68('0x3d')]())['then'](cmHopperHistory[_0x3a68('0x3e')]())[_0x3a68('0x1c')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x3a68('0x3f')]())[_0x3a68('0x1c')](realtime['initVoiceCallReports']())[_0x3a68('0x40')](function(_0x515d6f){logger['error'](_0x3a68('0x41'),util['inspect'](_0x515d6f,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x3a68('0x1c')](function(_0xe7ccce){return initRealtime();})[_0x3a68('0x1c')](function(){return initParams();})[_0x3a68('0x1c')](function(){report[_0x3a68('0x42')]();setInterval(initRealtime,0x1388);})[_0x3a68('0x40')](function(_0x288686){logger[_0x3a68('0x43')](_0x3a68('0x44'),util[_0x3a68('0x45')](_0x288686,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xcbf1=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','sync','error','[index.js][main]','bluebird','./server','./realtime','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbf1,0xc1));var _0x1cbf=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcbf1[_0x397e5f];return _0x5302b8;};'use strict';var BPromise=require(_0x1cbf('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x1cbf('0x1'));var Realtime=require(_0x1cbf('0x2'));var Report=require(_0x1cbf('0x3'));var Acw=require(_0x1cbf('0x4'));var Trigger=require(_0x1cbf('0x5'));var Dialer=require('./dialer');var Preview=require(_0x1cbf('0x6'));var Fax=require('./fax');var user=require(_0x1cbf('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x1cbf('0x8'));var voiceCallReport=require(_0x1cbf('0x9'));var trunk=require(_0x1cbf('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x1cbf('0xb'));var cmHopperHistory=require(_0x1cbf('0xc'));var campaign=require(_0x1cbf('0xd'));var voiceExtension=require(_0x1cbf('0xe'));var faxAccount=require(_0x1cbf('0xf'));var zendesk=require(_0x1cbf('0x10'));var salesforce=require(_0x1cbf('0x11'));var sugarcrm=require(_0x1cbf('0x12'));var freshdesk=require(_0x1cbf('0x13'));var desk=require(_0x1cbf('0x14'));var zoho=require(_0x1cbf('0x15'));var vtiger=require(_0x1cbf('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x1cbf('0x17'));var dynamics365=require(_0x1cbf('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x1cbf('0x19'))(_0x1cbf('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1cbf('0x1b')](_0x1cbf('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1cbf('0x1b')](_0x1cbf('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1cbf('0x1d')]()[_0x1cbf('0x1e')](user['getAgents']())[_0x1cbf('0x1e')](realtime['initAgents']())[_0x1cbf('0x1e')](user[_0x1cbf('0x1f')]())['then'](realtime[_0x1cbf('0x20')]())[_0x1cbf('0x1e')](trunk[_0x1cbf('0x21')]())[_0x1cbf('0x1e')](realtime['initTrunks']())[_0x1cbf('0x1e')](voiceQueue['getVoiceQueues']())[_0x1cbf('0x1e')](realtime['initVoiceQueues']())[_0x1cbf('0x1e')](trigger[_0x1cbf('0x22')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x23')]())[_0x1cbf('0x1e')](template[_0x1cbf('0x24')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x25')]())['then'](zendesk[_0x1cbf('0x26')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x27')]())[_0x1cbf('0x1e')](salesforce[_0x1cbf('0x28')]())['then'](realtime[_0x1cbf('0x29')]())['then'](sugarcrm[_0x1cbf('0x2a')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x2b')]())[_0x1cbf('0x1e')](freshdesk['getFreshdeskAccounts']())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x2c')]())[_0x1cbf('0x1e')](desk['getDeskAccounts']())['then'](realtime[_0x1cbf('0x2d')]())[_0x1cbf('0x1e')](zoho[_0x1cbf('0x2e')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x2f')]())[_0x1cbf('0x1e')](vtiger[_0x1cbf('0x30')]())['then'](realtime[_0x1cbf('0x31')]())[_0x1cbf('0x1e')](freshsales[_0x1cbf('0x32')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x33')]())[_0x1cbf('0x1e')](servicenow[_0x1cbf('0x34')]())['then'](realtime[_0x1cbf('0x35')]())[_0x1cbf('0x1e')](dynamics365[_0x1cbf('0x36')]())[_0x1cbf('0x1e')](realtime['initDynamics365Accounts']())[_0x1cbf('0x1e')](campaign[_0x1cbf('0x37')]())['then'](realtime['initCampaigns']())[_0x1cbf('0x1e')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x1cbf('0x38')]())['then'](faxAccount[_0x1cbf('0x39')]())['then'](realtime[_0x1cbf('0x3a')]())[_0x1cbf('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x1cbf('0x1d')]()[_0x1cbf('0x1e')](voiceQueueReport[_0x1cbf('0x3b')]())[_0x1cbf('0x1e')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x1cbf('0x3c')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x3d')]())[_0x1cbf('0x1e')](cmHopperHistory[_0x1cbf('0x3e')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x3f')]())[_0x1cbf('0x1e')](voiceCallReport[_0x1cbf('0x40')]())[_0x1cbf('0x1e')](realtime[_0x1cbf('0x41')]())[_0x1cbf('0x42')](function(_0x3f6fd3){logger['error']('[index.js][initParams]',util[_0x1cbf('0x43')](_0x3f6fd3,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x1cbf('0x1e')](function(_0x2eb982){return initRealtime();})[_0x1cbf('0x1e')](function(){return initParams();})[_0x1cbf('0x1e')](function(){report[_0x1cbf('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x242925){logger[_0x1cbf('0x45')](_0x1cbf('0x46'),util[_0x1cbf('0x43')](_0x242925,{'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 da82ab2..2b47884 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x58fcd2,_0x22332e){var _0x466d23=function(_0xaa6b15){while(--_0xaa6b15){_0x58fcd2['push'](_0x58fcd2['shift']());}};_0x466d23(++_0x22332e);}(_0xe706,0xa3));var _0x6e70=function(_0x2ccf59,_0x196b84){_0x2ccf59=_0x2ccf59-0x0;var _0x3c4cb2=_0xe706[_0x2ccf59];return _0x3c4cb2;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x2a539f,_0x4671ef){var _0x5005cd=function(_0x515ecc){while(--_0x515ecc){_0x2a539f['push'](_0x2a539f['shift']());}};_0x5005cd(++_0x4671ef);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xcb91[_0x469a3c];return _0x968f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index fd38b37..4a09b04 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 _0xc560=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x50bb84,_0x4820ce){var _0x41edfb=function(_0x5b5dd8){while(--_0x5b5dd8){_0x50bb84['push'](_0x50bb84['shift']());}};_0x41edfb(++_0x4820ce);}(_0xc560,0x100));var _0x0c56=function(_0x93e7d6,_0x537590){_0x93e7d6=_0x93e7d6-0x0;var _0xe0bcfe=_0xc560[_0x93e7d6];return _0xe0bcfe;};'use strict';function Campaign(_0x35cb01){this['id']=_0x35cb01['id']||0x0;this[_0x0c56('0x0')]=_0x35cb01[_0x0c56('0x0')]||'';this[_0x0c56('0x1')]=_0x35cb01[_0x0c56('0x1')]||_0x0c56('0x2');this['originated']=0x0;this[_0x0c56('0x3')]=0x0;this[_0x0c56('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x0c56('0x5')]='';this[_0x0c56('0x6')]=!![];this[_0x0c56('0x7')]=_0x35cb01[_0x0c56('0x7')];this[_0x0c56('0x8')]=_0x35cb01[_0x0c56('0x8')];this[_0x0c56('0x9')]=_0x35cb01[_0x0c56('0x9')]||null;this['dialGlobalInterval']=_0x35cb01[_0x0c56('0xa')]?_0x35cb01[_0x0c56('0xa')]:null;this[_0x0c56('0xb')]=_0x35cb01[_0x0c56('0xb')];this[_0x0c56('0xc')]=_0x35cb01[_0x0c56('0xc')];this[_0x0c56('0xd')]=_0x35cb01[_0x0c56('0xd')]||0x1e;this[_0x0c56('0xe')]=_0x35cb01[_0x0c56('0xe')];this[_0x0c56('0xf')]=_0x35cb01['dialCongestionRetryFrequency'];this[_0x0c56('0x10')]=_0x35cb01['dialBusyMaxRetry'];this[_0x0c56('0x11')]=_0x35cb01[_0x0c56('0x11')];this[_0x0c56('0x12')]=_0x35cb01[_0x0c56('0x12')];this[_0x0c56('0x13')]=_0x35cb01['dialNoAnswerRetryFrequency'];this[_0x0c56('0x14')]=_0x35cb01['dialGlobalMaxRetry'];this[_0x0c56('0x15')]=_0x35cb01[_0x0c56('0x15')]||0x3;this[_0x0c56('0x16')]=_0x35cb01['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0c56('0x17')]=_0x35cb01[_0x0c56('0x17')]||0x3;this[_0x0c56('0x18')]=_0x35cb01[_0x0c56('0x18')]||0x96;this[_0x0c56('0x19')]=_0x35cb01[_0x0c56('0x19')]||0x3;this[_0x0c56('0x1a')]=_0x35cb01[_0x0c56('0x1a')]||0x96;this[_0x0c56('0x1b')]=_0x35cb01[_0x0c56('0x1b')]||0x3;this[_0x0c56('0x1c')]=_0x35cb01[_0x0c56('0x1c')]||0x96;this[_0x0c56('0x1d')]=_0x35cb01[_0x0c56('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x35cb01[_0x0c56('0x1e')]||0x96;this[_0x0c56('0x1f')]=_0x35cb01[_0x0c56('0x1f')]||_0x0c56('0x20');this[_0x0c56('0x21')]=_0x35cb01[_0x0c56('0x21')]||undefined;this[_0x0c56('0x22')]=_0x35cb01[_0x0c56('0x22')]||undefined;this[_0x0c56('0x23')]=_0x35cb01[_0x0c56('0x23')]||undefined;this[_0x0c56('0x24')]=_0x35cb01[_0x0c56('0x24')]?_0x35cb01[_0x0c56('0x24')]:undefined;this['Trunk']=_0x35cb01[_0x0c56('0x25')]?_0x35cb01['Trunk']:undefined;this['Interval']=_0x35cb01['Interval']?_0x35cb01[_0x0c56('0x26')]:undefined;this[_0x0c56('0x27')]=_0x35cb01['SquareProject']?_0x35cb01[_0x0c56('0x27')]:undefined;this[_0x0c56('0x28')]=_0x35cb01[_0x0c56('0x27')]?_0x35cb01[_0x0c56('0x27')][_0x0c56('0x0')]:undefined;this[_0x0c56('0x29')]=_0x35cb01[_0x0c56('0x29')]||![];this[_0x0c56('0x2a')]=_0x35cb01[_0x0c56('0x2a')];this[_0x0c56('0x2b')]=_0x35cb01[_0x0c56('0x2b')];this[_0x0c56('0x2c')]=_0x35cb01[_0x0c56('0x2c')];this['dialAMDTotalAnalysisTime']=_0x35cb01[_0x0c56('0x2d')];this['dialAMDMinWordLength']=_0x35cb01[_0x0c56('0x2e')];this['dialAMDBetweenWordsSilence']=_0x35cb01['dialAMDBetweenWordsSilence'];this[_0x0c56('0x2f')]=_0x35cb01['dialAMDMaximumNumberOfWords'];this[_0x0c56('0x30')]=_0x35cb01[_0x0c56('0x30')];this['dialAMDMaximumWordLength']=_0x35cb01['dialAMDMaximumWordLength'];}module[_0x0c56('0x31')]=Campaign; \ No newline at end of file +var _0x2937=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2937,0x1dc));var _0x7293=function(_0x3ddcf6,_0x373cc3){_0x3ddcf6=_0x3ddcf6-0x0;var _0x444036=_0x2937[_0x3ddcf6];return _0x444036;};'use strict';function Campaign(_0x30c653){this['id']=_0x30c653['id']||0x0;this['name']=_0x30c653['name']||'';this['type']=_0x30c653[_0x7293('0x0')]||_0x7293('0x1');this[_0x7293('0x2')]=0x0;this[_0x7293('0x3')]=0x0;this[_0x7293('0x4')]=0x0;this[_0x7293('0x5')]=0x0;this[_0x7293('0x6')]='';this[_0x7293('0x7')]=!![];this['active']=_0x30c653['active'];this[_0x7293('0x8')]=_0x30c653[_0x7293('0x8')];this[_0x7293('0x9')]=_0x30c653[_0x7293('0x9')]||null;this[_0x7293('0xa')]=_0x30c653[_0x7293('0xa')]?_0x30c653[_0x7293('0xa')]:null;this[_0x7293('0xb')]=_0x30c653['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x30c653[_0x7293('0xc')];this['dialOriginateTimeout']=_0x30c653[_0x7293('0xd')]||0x1e;this[_0x7293('0xe')]=_0x30c653[_0x7293('0xe')];this[_0x7293('0xf')]=_0x30c653[_0x7293('0xf')];this[_0x7293('0x10')]=_0x30c653[_0x7293('0x10')];this[_0x7293('0x11')]=_0x30c653[_0x7293('0x11')];this[_0x7293('0x12')]=_0x30c653[_0x7293('0x12')];this[_0x7293('0x13')]=_0x30c653[_0x7293('0x13')];this[_0x7293('0x14')]=_0x30c653['dialGlobalMaxRetry'];this[_0x7293('0x15')]=_0x30c653[_0x7293('0x15')]||0x3;this[_0x7293('0x16')]=_0x30c653[_0x7293('0x16')]||0x96;this[_0x7293('0x17')]=_0x30c653[_0x7293('0x17')]||0x3;this[_0x7293('0x18')]=_0x30c653['dialDropRetryFrequency']||0x96;this[_0x7293('0x19')]=_0x30c653[_0x7293('0x19')]||0x3;this[_0x7293('0x1a')]=_0x30c653['dialAbandonedRetryFrequency']||0x96;this[_0x7293('0x1b')]=_0x30c653['dialMachineMaxRetry']||0x3;this[_0x7293('0x1c')]=_0x30c653[_0x7293('0x1c')]||0x96;this[_0x7293('0x1d')]=_0x30c653['dialAgentRejectMaxRetry']||0x3;this[_0x7293('0x1e')]=_0x30c653['dialAgentRejectRetryFrequency']||0x96;this[_0x7293('0x1f')]=_0x30c653[_0x7293('0x1f')]||'DESC';this[_0x7293('0x20')]=_0x30c653['dialPrefix']||undefined;this[_0x7293('0x21')]=_0x30c653[_0x7293('0x21')]||undefined;this[_0x7293('0x22')]=_0x30c653[_0x7293('0x22')]||undefined;this[_0x7293('0x23')]=_0x30c653[_0x7293('0x23')]?_0x30c653[_0x7293('0x23')]:undefined;this['Trunk']=_0x30c653[_0x7293('0x24')]?_0x30c653[_0x7293('0x24')]:undefined;this[_0x7293('0x25')]=_0x30c653[_0x7293('0x25')]?_0x30c653[_0x7293('0x25')]:undefined;this[_0x7293('0x26')]=_0x30c653[_0x7293('0x26')]?_0x30c653[_0x7293('0x26')]:undefined;this['dialQueueProject']=_0x30c653['SquareProject']?_0x30c653[_0x7293('0x26')][_0x7293('0x27')]:undefined;this[_0x7293('0x28')]=_0x30c653[_0x7293('0x28')]||![];this[_0x7293('0x29')]=_0x30c653[_0x7293('0x29')];this[_0x7293('0x2a')]=_0x30c653[_0x7293('0x2a')];this[_0x7293('0x2b')]=_0x30c653[_0x7293('0x2b')];this['dialAMDTotalAnalysisTime']=_0x30c653['dialAMDTotalAnalysisTime'];this[_0x7293('0x2c')]=_0x30c653[_0x7293('0x2c')];this['dialAMDBetweenWordsSilence']=_0x30c653[_0x7293('0x2d')];this[_0x7293('0x2e')]=_0x30c653['dialAMDMaximumNumberOfWords'];this[_0x7293('0x2f')]=_0x30c653[_0x7293('0x2f')];this['dialAMDMaximumWordLength']=_0x30c653[_0x7293('0x30')];}module[_0x7293('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e4e4d07..cb3cf01 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 _0xbdfb=['type','tag','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds'];(function(_0x52a6c1,_0x3ede31){var _0x4c5338=function(_0x535b0e){while(--_0x535b0e){_0x52a6c1['push'](_0x52a6c1['shift']());}};_0x4c5338(++_0x3ede31);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0xbdfb[_0x138836];return _0x322688;};'use strict';function Channel(){this[_0xbbdf('0x0')]=null;this[_0xbbdf('0x1')]='';this[_0xbbdf('0x2')]='';this[_0xbbdf('0x3')]=0x0;this[_0xbbdf('0x4')]='';this[_0xbbdf('0x5')]=undefined;this[_0xbbdf('0x6')]=undefined;this[_0xbbdf('0x7')]=0x0;this[_0xbbdf('0x8')]='';this[_0xbbdf('0x9')]=0x0;this['linkedid']=0x0;this[_0xbbdf('0xa')]=0x0;this[_0xbbdf('0xb')]=![];this['answertime']=null;this[_0xbbdf('0xc')]=null;this[_0xbbdf('0xd')]=![];this['abandoned']=![];this[_0xbbdf('0xe')]='';this[_0xbbdf('0xf')]='';this[_0xbbdf('0x10')]=0x0;this[_0xbbdf('0x11')]=0x0;this['holdtime']=0x0;this[_0xbbdf('0x12')]=null;this[_0xbbdf('0x13')]=null;this['disposition']=null;this[_0xbbdf('0x14')]=![];this[_0xbbdf('0x15')]=null;this[_0xbbdf('0x16')]=null;this[_0xbbdf('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xbbdf('0x18')]=undefined;this[_0xbbdf('0x19')]=undefined;this[_0xbbdf('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x49db=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','linkedid','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','monitor'];(function(_0x431159,_0x1823d3){var _0x79f3e4=function(_0x4c22e3){while(--_0x4c22e3){_0x431159['push'](_0x431159['shift']());}};_0x79f3e4(++_0x1823d3);}(_0x49db,0xc5));var _0xb49d=function(_0x3e5a1e,_0x240f76){_0x3e5a1e=_0x3e5a1e-0x0;var _0x4db801=_0x49db[_0x3e5a1e];return _0x4db801;};'use strict';function Channel(){this[_0xb49d('0x0')]=null;this[_0xb49d('0x1')]='';this[_0xb49d('0x2')]='';this[_0xb49d('0x3')]=0x0;this[_0xb49d('0x4')]='';this['connectedlinenum']=undefined;this[_0xb49d('0x5')]=undefined;this[_0xb49d('0x6')]=0x0;this[_0xb49d('0x7')]='';this['uniqueid']=0x0;this[_0xb49d('0x8')]=0x0;this['exten']=0x0;this['answered']=![];this[_0xb49d('0x9')]=null;this[_0xb49d('0xa')]=null;this[_0xb49d('0xb')]=![];this['abandoned']=![];this[_0xb49d('0xc')]='';this[_0xb49d('0xd')]='';this[_0xb49d('0xe')]=0x0;this[_0xb49d('0xf')]=0x0;this[_0xb49d('0x10')]=0x0;this[_0xb49d('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0xb49d('0x12')]=![];this[_0xb49d('0x13')]=null;this[_0xb49d('0x14')]=null;this[_0xb49d('0x15')]=[];this[_0xb49d('0x16')]=undefined;this[_0xb49d('0x17')]=undefined;this[_0xb49d('0x18')]=undefined;this[_0xb49d('0x19')]=0x0;}module[_0xb49d('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 98ab81b..88f358f 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 _0x358b=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x18032f,_0x4f4e45){var _0xb0b2b8=function(_0x563262){while(--_0x563262){_0x18032f['push'](_0x18032f['shift']());}};_0xb0b2b8(++_0x4f4e45);}(_0x358b,0xb2));var _0xb358=function(_0x38da01,_0x2ecc58){_0x38da01=_0x38da01-0x0;var _0x5dfed4=_0x358b[_0x38da01];return _0x5dfed4;};'use strict';function DeskAccount(_0x181dff){this['id']=_0x181dff['id']||0x0;this[_0xb358('0x0')]=_0x181dff[_0xb358('0x0')]||'';this[_0xb358('0x1')]=_0x181dff[_0xb358('0x1')]||'';this[_0xb358('0x2')]=_0x181dff[_0xb358('0x2')]||'';this[_0xb358('0x3')]=_0x181dff['authType']||'';this[_0xb358('0x4')]=_0x181dff['password']||'';this[_0xb358('0x5')]=_0x181dff[_0xb358('0x5')]||'';this[_0xb358('0x6')]=_0x181dff[_0xb358('0x6')]||'';this[_0xb358('0x7')]=_0x181dff['token']||'';this[_0xb358('0x8')]=_0x181dff[_0xb358('0x8')]||'';this['type']=_0x181dff[_0xb358('0x9')]||'';this['serverUrl']=_0x181dff[_0xb358('0xa')]||'';this[_0xb358('0xb')]=_0x181dff['Configurations']||{};}module[_0xb358('0xc')]=DeskAccount; \ No newline at end of file +var _0x4552=['password','consumerKey','token','tokenSecret','type','exports','name','username','remoteUri','authType'];(function(_0x19d354,_0x84da5c){var _0x535977=function(_0x5a8a71){while(--_0x5a8a71){_0x19d354['push'](_0x19d354['shift']());}};_0x535977(++_0x84da5c);}(_0x4552,0xa6));var _0x2455=function(_0x3a0ae9,_0x4e574a){_0x3a0ae9=_0x3a0ae9-0x0;var _0x161d04=_0x4552[_0x3a0ae9];return _0x161d04;};'use strict';function DeskAccount(_0x355a49){this['id']=_0x355a49['id']||0x0;this[_0x2455('0x0')]=_0x355a49[_0x2455('0x0')]||'';this[_0x2455('0x1')]=_0x355a49[_0x2455('0x1')]||'';this[_0x2455('0x2')]=_0x355a49[_0x2455('0x2')]||'';this[_0x2455('0x3')]=_0x355a49[_0x2455('0x3')]||'';this[_0x2455('0x4')]=_0x355a49[_0x2455('0x4')]||'';this[_0x2455('0x5')]=_0x355a49[_0x2455('0x5')]||'';this['consumerSecret']=_0x355a49['consumerSecret']||'';this[_0x2455('0x6')]=_0x355a49[_0x2455('0x6')]||'';this['tokenSecret']=_0x355a49[_0x2455('0x7')]||'';this['type']=_0x355a49[_0x2455('0x8')]||'';this['serverUrl']=_0x355a49['serverUrl']||'';this['Configurations']=_0x355a49['Configurations']||{};}module[_0x2455('0x9')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 8d0c573..ba86625 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 _0x5651=['remoteUri','tenantId','clientId','clientSecret','CloudProvider','exports','name','username','password'];(function(_0x51afda,_0x2459e0){var _0x4a391d=function(_0x595498){while(--_0x595498){_0x51afda['push'](_0x51afda['shift']());}};_0x4a391d(++_0x2459e0);}(_0x5651,0xf0));var _0x1565=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x5651[_0x3ff085];return _0x2b68c3;};'use strict';function Dynamics365Account(_0x2cc649){this['id']=_0x2cc649['id']||0x0;this[_0x1565('0x0')]=_0x2cc649[_0x1565('0x0')]||'';this[_0x1565('0x1')]=_0x2cc649['username']||'';this['password']=_0x2cc649[_0x1565('0x2')]||'';this[_0x1565('0x3')]=_0x2cc649[_0x1565('0x3')]||'';this[_0x1565('0x4')]=_0x2cc649[_0x1565('0x4')]||'';this[_0x1565('0x5')]=_0x2cc649[_0x1565('0x5')]||'';this[_0x1565('0x6')]=_0x2cc649[_0x1565('0x6')]||{};this['serverUrl']=_0x2cc649['serverUrl']||'';this['modernAuthentication']=_0x2cc649['modernAuthentication']||![];this['Configurations']=_0x2cc649['Configurations']||{};this[_0x1565('0x7')]=_0x2cc649[_0x1565('0x7')]||{};}module[_0x1565('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x6881=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x3e61d2,_0x197e2a){var _0x46c776=function(_0x15096f){while(--_0x15096f){_0x3e61d2['push'](_0x3e61d2['shift']());}};_0x46c776(++_0x197e2a);}(_0x6881,0x148));var _0x1688=function(_0x843670,_0x23ec99){_0x843670=_0x843670-0x0;var _0x498266=_0x6881[_0x843670];return _0x498266;};'use strict';function Dynamics365Account(_0x5723e5){this['id']=_0x5723e5['id']||0x0;this['name']=_0x5723e5[_0x1688('0x0')]||'';this[_0x1688('0x1')]=_0x5723e5[_0x1688('0x1')]||'';this['password']=_0x5723e5[_0x1688('0x2')]||'';this[_0x1688('0x3')]=_0x5723e5['remoteUri']||'';this[_0x1688('0x4')]=_0x5723e5[_0x1688('0x4')]||'';this[_0x1688('0x5')]=_0x5723e5[_0x1688('0x5')]||'';this[_0x1688('0x6')]=_0x5723e5[_0x1688('0x6')]||{};this[_0x1688('0x7')]=_0x5723e5[_0x1688('0x7')]||'';this[_0x1688('0x8')]=_0x5723e5[_0x1688('0x8')]||![];this[_0x1688('0x9')]=_0x5723e5[_0x1688('0x9')]||{};this[_0x1688('0xa')]=_0x5723e5[_0x1688('0xa')]||{};}module[_0x1688('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ff23ae3..e7f4a82 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 _0x6fc2=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect'];(function(_0x1fb047,_0x4f715b){var _0x353282=function(_0x458f84){while(--_0x458f84){_0x1fb047['push'](_0x1fb047['shift']());}};_0x353282(++_0x4f715b);}(_0x6fc2,0x117));var _0x26fc=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6fc2[_0x2be8c2];return _0x97f531;};'use strict';function FaxAccount(_0x131233){this['id']=_0x131233['id']||0x0;this[_0x26fc('0x0')]=_0x131233[_0x26fc('0x0')]||'';this['description']=_0x131233[_0x26fc('0x1')];this[_0x26fc('0x2')]=_0x131233['ecm'];this['headerinfo']=_0x131233['headerinfo'];this[_0x26fc('0x3')]=_0x131233[_0x26fc('0x3')];this['minrate']=_0x131233[_0x26fc('0x4')]||0x960;this[_0x26fc('0x5')]=_0x131233[_0x26fc('0x5')]||0x3840;this[_0x26fc('0x6')]=_0x131233['modem']||_0x26fc('0x7');this['gateway']=_0x131233['gateway']||'no';this[_0x26fc('0x8')]=_0x131233[_0x26fc('0x8')]||'no';this[_0x26fc('0x9')]=_0x131233['t38timeout']||0x1388;this[_0x26fc('0xa')]=_0x131233[_0x26fc('0xa')]||_0x26fc('0xb');this[_0x26fc('0xc')]=_0x131233[_0x26fc('0xc')]?_0x131233[_0x26fc('0xc')]:undefined;this[_0x26fc('0xd')]=_0x131233[_0x26fc('0xd')];this[_0x26fc('0xe')]=_0x131233[_0x26fc('0xe')];}module[_0x26fc('0xf')]=FaxAccount; \ No newline at end of file +var _0x57ea=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x1a1f3a,_0x1547a7){var _0xf8b031=function(_0x236ffb){while(--_0x236ffb){_0x1a1f3a['push'](_0x1a1f3a['shift']());}};_0xf8b031(++_0x1547a7);}(_0x57ea,0xc2));var _0xa57e=function(_0x582965,_0x58da5a){_0x582965=_0x582965-0x0;var _0x361185=_0x57ea[_0x582965];return _0x361185;};'use strict';function FaxAccount(_0x1e3d74){this['id']=_0x1e3d74['id']||0x0;this[_0xa57e('0x0')]=_0x1e3d74[_0xa57e('0x0')]||'';this[_0xa57e('0x1')]=_0x1e3d74[_0xa57e('0x1')];this[_0xa57e('0x2')]=_0x1e3d74['ecm'];this[_0xa57e('0x3')]=_0x1e3d74[_0xa57e('0x3')];this[_0xa57e('0x4')]=_0x1e3d74['localstationid'];this[_0xa57e('0x5')]=_0x1e3d74['minrate']||0x960;this[_0xa57e('0x6')]=_0x1e3d74['maxrate']||0x3840;this['modem']=_0x1e3d74[_0xa57e('0x7')]||_0xa57e('0x8');this['gateway']=_0x1e3d74[_0xa57e('0x9')]||'no';this['faxdetect']=_0x1e3d74[_0xa57e('0xa')]||'no';this[_0xa57e('0xb')]=_0x1e3d74[_0xa57e('0xb')]||0x1388;this[_0xa57e('0xc')]=_0x1e3d74[_0xa57e('0xc')]||_0xa57e('0xd');this['Trunk']=_0x1e3d74[_0xa57e('0xe')]?_0x1e3d74[_0xa57e('0xe')]:undefined;this[_0xa57e('0xf')]=_0x1e3d74[_0xa57e('0xf')];this[_0xa57e('0x10')]=_0x1e3d74[_0xa57e('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 9a2246c..f96a7d9 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 _0x68d2=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3e1415,_0x2ad5ee){var _0x2e1ec7=function(_0x4beb31){while(--_0x4beb31){_0x3e1415['push'](_0x3e1415['shift']());}};_0x2e1ec7(++_0x2ad5ee);}(_0x68d2,0x6d));var _0x268d=function(_0x5de767,_0x46714f){_0x5de767=_0x5de767-0x0;var _0x36aa35=_0x68d2[_0x5de767];return _0x36aa35;};'use strict';function FreshdeskAccount(_0x2b37eb){this['id']=_0x2b37eb['id']||0x0;this[_0x268d('0x0')]=_0x2b37eb[_0x268d('0x0')]||'';this[_0x268d('0x1')]=_0x2b37eb[_0x268d('0x1')]||'';this[_0x268d('0x2')]=_0x2b37eb['token']||'';this[_0x268d('0x3')]=_0x2b37eb[_0x268d('0x3')]||'';this['serverUrl']=_0x2b37eb[_0x268d('0x4')]||'';this['Configurations']=_0x2b37eb[_0x268d('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x21bb=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x21bb,0x1d2));var _0xb21b=function(_0x4923c5,_0x51c208){_0x4923c5=_0x4923c5-0x0;var _0xac9f8f=_0x21bb[_0x4923c5];return _0xac9f8f;};'use strict';function FreshdeskAccount(_0x2d3c9a){this['id']=_0x2d3c9a['id']||0x0;this[_0xb21b('0x0')]=_0x2d3c9a[_0xb21b('0x0')]||'';this[_0xb21b('0x1')]=_0x2d3c9a['username']||'';this['apiKey']=_0x2d3c9a[_0xb21b('0x2')]||'';this['remoteUri']=_0x2d3c9a[_0xb21b('0x3')]||'';this[_0xb21b('0x4')]=_0x2d3c9a[_0xb21b('0x4')]||'';this[_0xb21b('0x5')]=_0x2d3c9a[_0xb21b('0x5')]||{};}module[_0xb21b('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 16e29d7..82360fb 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 _0x5549=['serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x2c016b,_0x5119d1){var _0x1ebd2e=function(_0x12d411){while(--_0x12d411){_0x2c016b['push'](_0x2c016b['shift']());}};_0x1ebd2e(++_0x5119d1);}(_0x5549,0x1f4));var _0x9554=function(_0x38a3b4,_0x1b84a7){_0x38a3b4=_0x38a3b4-0x0;var _0x1ea871=_0x5549[_0x38a3b4];return _0x1ea871;};'use strict';function FreshsalesAccount(_0x41924e){this['id']=_0x41924e['id']||0x0;this[_0x9554('0x0')]=_0x41924e[_0x9554('0x0')]||'';this[_0x9554('0x1')]=_0x41924e[_0x9554('0x1')]||'';this['apiKey']=_0x41924e[_0x9554('0x2')]||'';this[_0x9554('0x3')]=_0x41924e[_0x9554('0x3')]||'';this[_0x9554('0x4')]=_0x41924e[_0x9554('0x4')]||'';this['Configurations']=_0x41924e[_0x9554('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xe5d5=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4f4d98,_0x37c563){var _0x464073=function(_0x30879d){while(--_0x30879d){_0x4f4d98['push'](_0x4f4d98['shift']());}};_0x464073(++_0x37c563);}(_0xe5d5,0x156));var _0x5e5d=function(_0x142263,_0x5a194a){_0x142263=_0x142263-0x0;var _0x130d05=_0xe5d5[_0x142263];return _0x130d05;};'use strict';function FreshsalesAccount(_0x10e72b){this['id']=_0x10e72b['id']||0x0;this['name']=_0x10e72b[_0x5e5d('0x0')]||'';this['username']=_0x10e72b[_0x5e5d('0x1')]||'';this['apiKey']=_0x10e72b[_0x5e5d('0x2')]||'';this['remoteUri']=_0x10e72b[_0x5e5d('0x3')]||'';this[_0x5e5d('0x4')]=_0x10e72b[_0x5e5d('0x4')]||'';this[_0x5e5d('0x5')]=_0x10e72b[_0x5e5d('0x5')]||{};}module[_0x5e5d('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index cb54c98..c2ddfb9 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 _0xf74e=['mohtime','variables','exports','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo'];(function(_0x9df6e3,_0x5e3dc8){var _0xd0633a=function(_0x5e7d3c){while(--_0x5e7d3c){_0x9df6e3['push'](_0x9df6e3['shift']());}};_0xd0633a(++_0x5e3dc8);}(_0xf74e,0x153));var _0xef74=function(_0x334b4f,_0x481f85){_0x334b4f=_0x334b4f-0x0;var _0x266ecd=_0xf74e[_0x334b4f];return _0x266ecd;};'use strict';function QueueReport(){this['type']=_0xef74('0x0');this[_0xef74('0x1')]='';this[_0xef74('0x2')]='';this['calleridname']='';this[_0xef74('0x3')]='';this[_0xef74('0x4')]=null;this['queuecallerleaveAt']=null;this[_0xef74('0x5')]=0x1;this[_0xef74('0x6')]=0x1;this['queuecallerabandon']=![];this[_0xef74('0x7')]=null;this[_0xef74('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xef74('0x9')]=![];this['queuecallerexitAt']=null;this[_0xef74('0xa')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xef74('0xb')]='';this[_0xef74('0xc')]='';this[_0xef74('0xd')]='';this[_0xef74('0xe')]='';this[_0xef74('0xf')]='';this['holdtime']=0x0;this[_0xef74('0x10')]=![];this[_0xef74('0x11')]='';this['motionChannel']='voice';this[_0xef74('0x12')]=0x0;this[_0xef74('0x13')]={};}module[_0xef74('0x14')]=QueueReport; \ No newline at end of file +var _0xeee2=['position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x10a6ee,_0x15678d){var _0x4e7cac=function(_0x56ce03){while(--_0x56ce03){_0x10a6ee['push'](_0x10a6ee['shift']());}};_0x4e7cac(++_0x15678d);}(_0xeee2,0x95));var _0x2eee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeee2[_0x321bb2];return _0x9c12ed;};'use strict';function QueueReport(){this[_0x2eee('0x0')]='inbound';this[_0x2eee('0x1')]='';this[_0x2eee('0x2')]='';this[_0x2eee('0x3')]='';this[_0x2eee('0x4')]='';this[_0x2eee('0x5')]=null;this[_0x2eee('0x6')]=null;this[_0x2eee('0x7')]=0x1;this['count']=0x1;this[_0x2eee('0x8')]=![];this[_0x2eee('0x9')]=null;this[_0x2eee('0xa')]=![];this[_0x2eee('0xb')]=null;this[_0x2eee('0xc')]=![];this[_0x2eee('0xd')]=null;this['originalposition']=0x1;this[_0x2eee('0xe')]='';this[_0x2eee('0xf')]='';this['connectedlinename']='';this[_0x2eee('0x10')]='';this[_0x2eee('0x11')]='';this[_0x2eee('0x12')]='';this['priority']='';this[_0x2eee('0x13')]=0x0;this[_0x2eee('0x14')]=![];this[_0x2eee('0x15')]='';this[_0x2eee('0x16')]='voice';this[_0x2eee('0x17')]=0x0;this[_0x2eee('0x18')]={};}module[_0x2eee('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 27b83dd..e0f10b1 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 _0x8ebd=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x2fcd06,_0x29e17b){var _0x44b835=function(_0x75790a){while(--_0x75790a){_0x2fcd06['push'](_0x2fcd06['shift']());}};_0x44b835(++_0x29e17b);}(_0x8ebd,0x16d));var _0xd8eb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8ebd[_0x2641f9];return _0x585741;};'use strict';function SalesforceAccount(_0x19aed6){this['id']=_0x19aed6['id']||0x0;this[_0xd8eb('0x0')]=_0x19aed6[_0xd8eb('0x0')]||'';this['username']=_0x19aed6[_0xd8eb('0x1')]||'';this['remoteUri']=_0x19aed6[_0xd8eb('0x2')]||'';this[_0xd8eb('0x3')]=_0x19aed6[_0xd8eb('0x3')]||'';this[_0xd8eb('0x4')]=_0x19aed6[_0xd8eb('0x4')]||'';this[_0xd8eb('0x5')]=_0x19aed6[_0xd8eb('0x5')]||'';this[_0xd8eb('0x6')]=_0x19aed6[_0xd8eb('0x6')]||'';this[_0xd8eb('0x7')]=_0x19aed6[_0xd8eb('0x7')]||_0xd8eb('0x8');this[_0xd8eb('0x9')]=_0x19aed6[_0xd8eb('0x9')]||'';this[_0xd8eb('0xa')]=_0x19aed6[_0xd8eb('0xa')]||{};}module[_0xd8eb('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x19a3=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19a3,0x1d9));var _0x319a=function(_0x4f2314,_0x651c42){_0x4f2314=_0x4f2314-0x0;var _0x176cdf=_0x19a3[_0x4f2314];return _0x176cdf;};'use strict';function SalesforceAccount(_0x57b41a){this['id']=_0x57b41a['id']||0x0;this['name']=_0x57b41a[_0x319a('0x0')]||'';this[_0x319a('0x1')]=_0x57b41a[_0x319a('0x1')]||'';this[_0x319a('0x2')]=_0x57b41a[_0x319a('0x2')]||'';this[_0x319a('0x3')]=_0x57b41a[_0x319a('0x3')]||'';this[_0x319a('0x4')]=_0x57b41a[_0x319a('0x4')]||'';this[_0x319a('0x5')]=_0x57b41a[_0x319a('0x5')]||'';this['securityToken']=_0x57b41a[_0x319a('0x6')]||'';this['type']=_0x57b41a[_0x319a('0x7')]||_0x319a('0x8');this[_0x319a('0x9')]=_0x57b41a[_0x319a('0x9')]||'';this[_0x319a('0xa')]=_0x57b41a[_0x319a('0xa')]||{};}module[_0x319a('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 622c1e8..0449a00 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 _0x4fef=['serverUrl','Configurations','name','username','remoteUri'];(function(_0x70d6f5,_0x561d3b){var _0x24c26e=function(_0x1cd631){while(--_0x1cd631){_0x70d6f5['push'](_0x70d6f5['shift']());}};_0x24c26e(++_0x561d3b);}(_0x4fef,0x14c));var _0xf4fe=function(_0x49d9fa,_0x76bd79){_0x49d9fa=_0x49d9fa-0x0;var _0x5299c6=_0x4fef[_0x49d9fa];return _0x5299c6;};'use strict';function ServicenowAccount(_0x374caf){this['id']=_0x374caf['id']||0x0;this['name']=_0x374caf[_0xf4fe('0x0')]||'';this[_0xf4fe('0x1')]=_0x374caf[_0xf4fe('0x1')]||'';this['password']=_0x374caf['password']||'';this[_0xf4fe('0x2')]=_0x374caf[_0xf4fe('0x2')]||'';this[_0xf4fe('0x3')]=_0x374caf[_0xf4fe('0x3')]||'';this[_0xf4fe('0x4')]=_0x374caf[_0xf4fe('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xe0e2=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x41f281,_0xa93b94){var _0x5bf85d=function(_0x514f5e){while(--_0x514f5e){_0x41f281['push'](_0x41f281['shift']());}};_0x5bf85d(++_0xa93b94);}(_0xe0e2,0x151));var _0x2e0e=function(_0x4f3ee5,_0x38db22){_0x4f3ee5=_0x4f3ee5-0x0;var _0x5280c7=_0xe0e2[_0x4f3ee5];return _0x5280c7;};'use strict';function ServicenowAccount(_0x31333e){this['id']=_0x31333e['id']||0x0;this[_0x2e0e('0x0')]=_0x31333e[_0x2e0e('0x0')]||'';this[_0x2e0e('0x1')]=_0x31333e[_0x2e0e('0x1')]||'';this[_0x2e0e('0x2')]=_0x31333e[_0x2e0e('0x2')]||'';this[_0x2e0e('0x3')]=_0x31333e[_0x2e0e('0x3')]||'';this['serverUrl']=_0x31333e[_0x2e0e('0x4')]||'';this[_0x2e0e('0x5')]=_0x31333e[_0x2e0e('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fb353f9..5c779c6 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 _0x9daa=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x2734ba,_0x5e672){var _0x4b74c9=function(_0x23e3a3){while(--_0x23e3a3){_0x2734ba['push'](_0x2734ba['shift']());}};_0x4b74c9(++_0x5e672);}(_0x9daa,0x12a));var _0xa9da=function(_0x47beb3,_0x4c0864){_0x47beb3=_0x47beb3-0x0;var _0x3fe1cb=_0x9daa[_0x47beb3];return _0x3fe1cb;};'use strict';function SugarcrmAccount(_0x385525){this['id']=_0x385525['id']||0x0;this[_0xa9da('0x0')]=_0x385525[_0xa9da('0x0')]||'';this['username']=_0x385525[_0xa9da('0x1')]||'';this[_0xa9da('0x2')]=_0x385525[_0xa9da('0x2')]||'';this[_0xa9da('0x3')]=_0x385525[_0xa9da('0x3')]||'';this[_0xa9da('0x4')]=_0x385525[_0xa9da('0x4')]||'';this[_0xa9da('0x5')]=_0x385525['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x6846=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x2384d8,_0x1f12d7){var _0x13502b=function(_0x9219c9){while(--_0x9219c9){_0x2384d8['push'](_0x2384d8['shift']());}};_0x13502b(++_0x1f12d7);}(_0x6846,0x18e));var _0x6684=function(_0xe70ed5,_0x404aab){_0xe70ed5=_0xe70ed5-0x0;var _0x515cd9=_0x6846[_0xe70ed5];return _0x515cd9;};'use strict';function SugarcrmAccount(_0xa297cc){this['id']=_0xa297cc['id']||0x0;this['name']=_0xa297cc[_0x6684('0x0')]||'';this['username']=_0xa297cc[_0x6684('0x1')]||'';this['password']=_0xa297cc['password']||'';this[_0x6684('0x2')]=_0xa297cc['remoteUri']||'';this[_0x6684('0x3')]=_0xa297cc[_0x6684('0x3')]||'';this[_0x6684('0x4')]=_0xa297cc[_0x6684('0x4')]||{};}module[_0x6684('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index bf0b7a5..ed69dc1 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 _0x30d3=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x22808e,_0x585083){var _0x2b97b2=function(_0x2ff801){while(--_0x2ff801){_0x22808e['push'](_0x22808e['shift']());}};_0x2b97b2(++_0x585083);}(_0x30d3,0x9f));var _0x330d=function(_0xca716a,_0x282f38){_0xca716a=_0xca716a-0x0;var _0x543dcb=_0x30d3[_0xca716a];return _0x543dcb;};'use strict';function Telephone(_0x3e6f9c){this['id']=_0x3e6f9c['id']||0x0;this['name']=_0x3e6f9c[_0x330d('0x0')]||'';this[_0x330d('0x1')]=_0x3e6f9c[_0x330d('0x1')]||'';this[_0x330d('0x2')]=_0x330d('0x3');this[_0x330d('0x4')]=0x0;this[_0x330d('0x5')]='unknown';this[_0x330d('0x6')]='';}module[_0x330d('0x7')]=Telephone; \ No newline at end of file +var _0x0d99=['name','accountcode','state','stateTime','status','exports'];(function(_0x229e8f,_0x57f05d){var _0x45e4cd=function(_0x1920ae){while(--_0x1920ae){_0x229e8f['push'](_0x229e8f['shift']());}};_0x45e4cd(++_0x57f05d);}(_0x0d99,0x1d4));var _0x90d9=function(_0x182a1b,_0xfba0d4){_0x182a1b=_0x182a1b-0x0;var _0x497be4=_0x0d99[_0x182a1b];return _0x497be4;};'use strict';function Telephone(_0x4f677b){this['id']=_0x4f677b['id']||0x0;this[_0x90d9('0x0')]=_0x4f677b[_0x90d9('0x0')]||'';this[_0x90d9('0x1')]=_0x4f677b[_0x90d9('0x1')]||'';this[_0x90d9('0x2')]='unknown';this[_0x90d9('0x3')]=0x0;this[_0x90d9('0x4')]='unknown';this['address']='';}module[_0x90d9('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 d7216dd..2389fc3 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x34b81d,_0x5861b6){var _0x31383d=function(_0x220466){while(--_0x220466){_0x34b81d['push'](_0x34b81d['shift']());}};_0x31383d(++_0x5861b6);}(_0xb10b,0x12a));var _0xbb10=function(_0x169790,_0x48aa33){_0x169790=_0x169790-0x0;var _0x4d0f36=_0xb10b[_0x169790];return _0x4d0f36;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x57a4db,_0x5e4585){var _0x4c3113=function(_0x2c8a11){while(--_0x2c8a11){_0x57a4db['push'](_0x57a4db['shift']());}};_0x4c3113(++_0x5e4585);}(_0xb10b,0x12a));var _0xbb10=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0xb10b[_0x296144];return _0x5329b1;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index fb7f3df..e4e8e1f 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x0b0e[_0x474d97];return _0x1edf25;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 71ec9dc..03ffb7f 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 _0x79e3=['domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status','registry','indexOf','host','port'];(function(_0x253098,_0x419505){var _0x50935c=function(_0x11c6c1){while(--_0x11c6c1){_0x253098['push'](_0x253098['shift']());}};_0x50935c(++_0x419505);}(_0x79e3,0x139));var _0x379e=function(_0x3bfa52,_0x6b40c3){_0x3bfa52=_0x3bfa52-0x0;var _0xb5711d=_0x79e3[_0x3bfa52];return _0xb5711d;};'use strict';function Trunk(_0x3df038){this['id']=_0x3df038['id']||0x0;this[_0x379e('0x0')]=_0x3df038[_0x379e('0x0')]||![];this['name']=_0x3df038[_0x379e('0x1')]||'';this[_0x379e('0x2')]=_0x379e('0x3');this[_0x379e('0x4')]=0x0;this[_0x379e('0x5')]='unknown';this[_0x379e('0x6')]=_0x3df038[_0x379e('0x6')]&&_0x3df038[_0x379e('0x6')][_0x379e('0x7')](':')?_0x3df038[_0x379e('0x6')]['split'](':')[0x0]:'';this[_0x379e('0x8')]='';this[_0x379e('0x9')]='';this[_0x379e('0xa')]='';this[_0x379e('0xb')]='';this[_0x379e('0xc')]='';this[_0x379e('0xd')]=_0x379e('0x3');this[_0x379e('0xe')]='';this[_0x379e('0xf')]='';this[_0x379e('0x10')]=_0x3df038[_0x379e('0x10')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x91c1=['stateTime','status','unknown','registry','indexOf','split','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state'];(function(_0x18ae0e,_0x4b7d34){var _0xd96cff=function(_0x5903a9){while(--_0x5903a9){_0x18ae0e['push'](_0x18ae0e['shift']());}};_0xd96cff(++_0x4b7d34);}(_0x91c1,0xb8));var _0x191c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x91c1[_0x1ac595];return _0x455fff;};'use strict';function Trunk(_0x8616c8){this['id']=_0x8616c8['id']||0x0;this['active']=_0x8616c8[_0x191c('0x0')]||![];this[_0x191c('0x1')]=_0x8616c8[_0x191c('0x1')]||'';this[_0x191c('0x2')]='unknown';this[_0x191c('0x3')]=0x0;this[_0x191c('0x4')]=_0x191c('0x5');this['registry']=_0x8616c8['registry']&&_0x8616c8[_0x191c('0x6')][_0x191c('0x7')](':')?_0x8616c8['registry'][_0x191c('0x8')](':')[0x0]:'';this['host']='';this[_0x191c('0x9')]='';this[_0x191c('0xa')]='';this[_0x191c('0xb')]='';this['refresh']='';this[_0x191c('0xc')]=_0x191c('0x5');this[_0x191c('0xd')]='';this[_0x191c('0xe')]='';this[_0x191c('0xf')]=_0x8616c8[_0x191c('0xf')]||'';}module[_0x191c('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 d0897ab..9e9673d 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 _0xc10a=['exten','mandatoryDisposition','exports'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0xc10a,0x96));var _0xac10=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0xc10a[_0x93942f];return _0x23fcd8;};'use strict';function voiceExtension(_0x587fec){this['id']=_0x587fec['id']||0x0;this['exten']=_0x587fec[_0xac10('0x0')]||'';this['recordingFormat']=_0x587fec['recordingFormat']||'none';this[_0xac10('0x1')]=_0x587fec[_0xac10('0x1')]||![];}module[_0xac10('0x2')]=voiceExtension; \ No newline at end of file +var _0x7b80=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x5b4e11,_0xa21c04){var _0x2d82c2=function(_0x2bd86e){while(--_0x2bd86e){_0x5b4e11['push'](_0x5b4e11['shift']());}};_0x2d82c2(++_0xa21c04);}(_0x7b80,0x143));var _0x07b8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7b80[_0x3ab51d];return _0x29a04e;};'use strict';function voiceExtension(_0x1aebbf){this['id']=_0x1aebbf['id']||0x0;this[_0x07b8('0x0')]=_0x1aebbf[_0x07b8('0x0')]||'';this[_0x07b8('0x1')]=_0x1aebbf['recordingFormat']||'none';this[_0x07b8('0x2')]=_0x1aebbf[_0x07b8('0x2')]||![];}module[_0x07b8('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e1911e7..3f25ee5 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 _0xbf7d=['dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbf7d,0x1b3));var _0xdbf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf7d[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=[_0xdbf7('0x0'),_0xdbf7('0x1'),_0xdbf7('0x2'),_0xdbf7('0x3'),_0xdbf7('0x4'),_0xdbf7('0x5'),_0xdbf7('0x6'),_0xdbf7('0x7'),_0xdbf7('0x8')];var monitorFormat={'wav':'wav','wav49':_0xdbf7('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0xdbf7('0xa'),'roundrobin':_0xdbf7('0xb')};function VoiceQueue(_0x10bab0){this['id']=_0x10bab0['id']||0x0;this[_0xdbf7('0xc')]=_0x10bab0[_0xdbf7('0xc')]||'';this[_0xdbf7('0xd')]=_0x10bab0[_0xdbf7('0xd')]||'';this[_0xdbf7('0xe')]=_0x10bab0['type']||_0xdbf7('0xf');this[_0xdbf7('0x10')]=0x0;this[_0xdbf7('0x11')]=0x0;this[_0xdbf7('0x12')]=0x0;this[_0xdbf7('0x13')]=0x0;this[_0xdbf7('0x14')]=0x0;this[_0xdbf7('0x15')]=0x0;this['sumBillable']=0x0;this[_0xdbf7('0x16')]=0x0;this[_0xdbf7('0x17')]=0x0;this['loggedIn']=0x0;this[_0xdbf7('0x18')]=0x0;this['acw']=_0x10bab0['acw']||![];this[_0xdbf7('0x19')]=_0x10bab0['acwTimeout']||0xa;this[_0xdbf7('0x1a')]=_0x10bab0['autopause']||'no';this[_0xdbf7('0x1b')]=!![];this[_0xdbf7('0x1c')]='';this[_0xdbf7('0x1d')]=0x0;this[_0xdbf7('0x1e')]=0x0;this[_0xdbf7('0x1f')]=_0x10bab0[_0xdbf7('0x1f')]||null;this['dialGlobalInterval']=_0x10bab0[_0xdbf7('0x20')]?_0x10bab0[_0xdbf7('0x20')]:null;this[_0xdbf7('0x21')]=_0x10bab0[_0xdbf7('0x21')];this[_0xdbf7('0x22')]=_0x10bab0[_0xdbf7('0x22')]||_0xdbf7('0x23');this['dialLimitChannel']=_0x10bab0[_0xdbf7('0x24')]||0x0;this[_0xdbf7('0x25')]=_0x10bab0[_0xdbf7('0x25')]||0x0;this[_0xdbf7('0x26')]=_0x10bab0['dialPowerLevel']||0x1;this[_0xdbf7('0x27')]=_0x10bab0[_0xdbf7('0x27')]||'dropRate';this[_0xdbf7('0x28')]=_0x10bab0[_0xdbf7('0x28')]||0.03;this['dialPredictiveInterval']=_0x10bab0['dialPredictiveInterval']||0x258;this[_0xdbf7('0x29')]=_0x10bab0[_0xdbf7('0x29')]||_0xdbf7('0x2a');this[_0xdbf7('0x2b')]=_0x10bab0[_0xdbf7('0x2b')]||_0xdbf7('0x2a');this[_0xdbf7('0x2c')]=_0x10bab0[_0xdbf7('0x2c')]||0x1e;this[_0xdbf7('0x2d')]=_0x10bab0['dialQueueOptions']||'tTxX';this[_0xdbf7('0x2e')]=_0x10bab0[_0xdbf7('0x2e')]||0x3;this[_0xdbf7('0x2f')]=_0x10bab0[_0xdbf7('0x2f')]||undefined;this[_0xdbf7('0x30')]=_0x10bab0[_0xdbf7('0x30')]||0x3;this[_0xdbf7('0x31')]=_0x10bab0[_0xdbf7('0x31')]||0x96;this[_0xdbf7('0x32')]=_0x10bab0[_0xdbf7('0x32')]||0x3;this[_0xdbf7('0x33')]=_0x10bab0[_0xdbf7('0x33')]||0x96;this[_0xdbf7('0x34')]=_0x10bab0[_0xdbf7('0x34')]||0x3;this[_0xdbf7('0x35')]=_0x10bab0[_0xdbf7('0x35')]||0x96;this[_0xdbf7('0x36')]=_0x10bab0['dialNoSuchNumberMaxRetry']||0x3;this[_0xdbf7('0x37')]=_0x10bab0[_0xdbf7('0x37')]||0x96;this[_0xdbf7('0x38')]=_0x10bab0['dialDropMaxRetry']||0x3;this[_0xdbf7('0x39')]=_0x10bab0['dialDropRetryFrequency']||0x96;this[_0xdbf7('0x3a')]=_0x10bab0['dialAbandonedMaxRetry']||0x3;this[_0xdbf7('0x3b')]=_0x10bab0['dialAbandonedRetryFrequency']||0x96;this[_0xdbf7('0x3c')]=_0x10bab0[_0xdbf7('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x10bab0[_0xdbf7('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x10bab0[_0xdbf7('0x3e')]||0x3;this[_0xdbf7('0x3f')]=_0x10bab0['dialAgentRejectRetryFrequency']||0x96;this[_0xdbf7('0x40')]=_0x10bab0[_0xdbf7('0x40')]||0x4;this[_0xdbf7('0x41')]=_0x10bab0[_0xdbf7('0x41')]?_0x10bab0['Trunk']:undefined;this[_0xdbf7('0x42')]=_0x10bab0[_0xdbf7('0x42')]?_0x10bab0[_0xdbf7('0x42')]:undefined;this[_0xdbf7('0x43')]=_0x10bab0[_0xdbf7('0x43')]||undefined;this[_0xdbf7('0x44')]=_0x10bab0[_0xdbf7('0x44')]?_0x10bab0['Interval']:undefined;this[_0xdbf7('0x45')]=_0x10bab0[_0xdbf7('0x45')]||_0xdbf7('0x46');this[_0xdbf7('0x47')]=_0x10bab0['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xdbf7('0x48')]=_0x10bab0[_0xdbf7('0x48')]||undefined;this[_0xdbf7('0x49')]=strategy[_0x10bab0[_0xdbf7('0x49')]]||_0xdbf7('0xa');this[_0xdbf7('0x4a')]=!![];this[_0xdbf7('0x4b')]=_0x10bab0['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x10bab0['dialAMDInitialSilence'];this[_0xdbf7('0x4c')]=_0x10bab0[_0xdbf7('0x4c')];this[_0xdbf7('0x4d')]=_0x10bab0[_0xdbf7('0x4d')];this['dialAMDTotalAnalysisTime']=_0x10bab0[_0xdbf7('0x4e')];this[_0xdbf7('0x4f')]=_0x10bab0[_0xdbf7('0x4f')];this[_0xdbf7('0x50')]=_0x10bab0['dialAMDBetweenWordsSilence'];this[_0xdbf7('0x51')]=_0x10bab0[_0xdbf7('0x51')];this[_0xdbf7('0x52')]=_0x10bab0[_0xdbf7('0x52')];this['dialAMDMaximumWordLength']=_0x10bab0[_0xdbf7('0x53')];this[_0xdbf7('0x54')]=0x0;this[_0xdbf7('0x55')]=0x0;this[_0xdbf7('0x56')]=_0x10bab0['timeout'];this[_0xdbf7('0x57')]=0x0;this[_0xdbf7('0x58')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xdbf7('0x59')]=0x0;this[_0xdbf7('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xdbf7('0x5b')]=0x0;this[_0xdbf7('0x5c')]=0x0;this[_0xdbf7('0x5d')]=0x0;this[_0xdbf7('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xdbf7('0x5f')]=0x0;this[_0xdbf7('0x60')]=0x0;this['startProgressive']=undefined;this[_0xdbf7('0x61')]=undefined;this['handlePredictive']=undefined;this[_0xdbf7('0x62')]=1.05;this[_0xdbf7('0x63')]=0x0;this[_0xdbf7('0x64')]=0x0;this[_0xdbf7('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xdbf7('0x66')]=0x0;this[_0xdbf7('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x10bab0[_0xdbf7('0x68')]||0x14;this[_0xdbf7('0x69')]=_0x10bab0[_0xdbf7('0x68')]||0xa;this[_0xdbf7('0x6a')]=0x0;this[_0xdbf7('0x6b')]=0x0;this[_0xdbf7('0x6c')]=0x1;this[_0xdbf7('0x6d')]=0x0;this[_0xdbf7('0x6e')]=0x0;this[_0xdbf7('0x6f')]=0x0;this['erlangBusyFactor']=0x0;this[_0xdbf7('0x70')]=_0x10bab0[_0xdbf7('0x70')]||0x1e;this[_0xdbf7('0x71')]=_0x10bab0[_0xdbf7('0x71')]||![];this[_0xdbf7('0x72')]=!!_0x10bab0[_0xdbf7('0x72')]||![];this[_0xdbf7('0x73')]=!!_0x10bab0[_0xdbf7('0x73')]||![];this[_0xdbf7('0x74')]=_0x10bab0[_0xdbf7('0x74')]||undefined;this[_0xdbf7('0x75')]=_0x10bab0[_0xdbf7('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x10bab0[_0xdbf7('0x76')]||![];this[_0xdbf7('0xd')]=monitorFormat[_0x10bab0[_0xdbf7('0xd')]]?monitorFormat[_0x10bab0[_0xdbf7('0xd')]]:undefined;this[_0xdbf7('0x77')]=_0x10bab0[_0xdbf7('0x77')]||![];this[_0xdbf7('0x78')]=_0x10bab0[_0xdbf7('0x78')]?_0x10bab0['mandatoryDispositionPause']:undefined;}module[_0xdbf7('0x79')]=VoiceQueue; \ No newline at end of file +var _0xf9f5=['dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf9f5,0x1c8));var _0x5f9f=function(_0x139822,_0x386cbb){_0x139822=_0x139822-0x0;var _0x1b57c7=_0xf9f5[_0x139822];return _0x1b57c7;};'use strict';var statusDesc=['unknown',_0x5f9f('0x0'),_0x5f9f('0x1'),_0x5f9f('0x2'),_0x5f9f('0x3'),_0x5f9f('0x4'),_0x5f9f('0x5'),'ringinuse','onhold'];var monitorFormat={'wav':_0x5f9f('0x6'),'wav49':_0x5f9f('0x7'),'gsm':_0x5f9f('0x8')};var strategy={'rrmemory':_0x5f9f('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x3d1c7c){this['id']=_0x3d1c7c['id']||0x0;this['name']=_0x3d1c7c[_0x5f9f('0xa')]||'';this[_0x5f9f('0xb')]=_0x3d1c7c[_0x5f9f('0xb')]||'';this[_0x5f9f('0xc')]=_0x3d1c7c['type']||_0x5f9f('0xd');this[_0x5f9f('0xe')]=0x0;this[_0x5f9f('0xf')]=0x0;this[_0x5f9f('0x10')]=0x0;this[_0x5f9f('0x11')]=0x0;this[_0x5f9f('0x12')]=0x0;this['sumHoldTime']=0x0;this[_0x5f9f('0x13')]=0x0;this[_0x5f9f('0x14')]=0x0;this[_0x5f9f('0x15')]=0x0;this['loggedIn']=0x0;this[_0x5f9f('0x16')]=0x0;this['acw']=_0x3d1c7c[_0x5f9f('0x17')]||![];this[_0x5f9f('0x18')]=_0x3d1c7c[_0x5f9f('0x18')]||0xa;this[_0x5f9f('0x19')]=_0x3d1c7c[_0x5f9f('0x19')]||'no';this[_0x5f9f('0x1a')]=!![];this[_0x5f9f('0x1b')]='';this[_0x5f9f('0x1c')]=0x0;this[_0x5f9f('0x1d')]=0x0;this['dialTimezone']=_0x3d1c7c['dialTimezone']||null;this[_0x5f9f('0x1e')]=_0x3d1c7c[_0x5f9f('0x1e')]?_0x3d1c7c[_0x5f9f('0x1e')]:null;this[_0x5f9f('0x1f')]=_0x3d1c7c['dialActive'];this[_0x5f9f('0x20')]=_0x3d1c7c[_0x5f9f('0x20')]||_0x5f9f('0x21');this[_0x5f9f('0x22')]=_0x3d1c7c['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x3d1c7c[_0x5f9f('0x23')]||0x0;this['dialPowerLevel']=_0x3d1c7c[_0x5f9f('0x24')]||0x1;this[_0x5f9f('0x25')]=_0x3d1c7c[_0x5f9f('0x25')]||_0x5f9f('0x26');this[_0x5f9f('0x27')]=_0x3d1c7c[_0x5f9f('0x27')]||0.03;this['dialPredictiveInterval']=_0x3d1c7c['dialPredictiveInterval']||0x258;this[_0x5f9f('0x28')]=_0x3d1c7c[_0x5f9f('0x28')]||_0x5f9f('0x29');this[_0x5f9f('0x2a')]=_0x3d1c7c[_0x5f9f('0x2a')]||_0x5f9f('0x29');this[_0x5f9f('0x2b')]=_0x3d1c7c[_0x5f9f('0x2b')]||0x1e;this['dialQueueOptions']=_0x3d1c7c[_0x5f9f('0x2c')]||_0x5f9f('0x2d');this[_0x5f9f('0x2e')]=_0x3d1c7c[_0x5f9f('0x2e')]||0x3;this['dialQueueProject']=_0x3d1c7c[_0x5f9f('0x2f')]||undefined;this[_0x5f9f('0x30')]=_0x3d1c7c[_0x5f9f('0x30')]||0x3;this[_0x5f9f('0x31')]=_0x3d1c7c[_0x5f9f('0x31')]||0x96;this[_0x5f9f('0x32')]=_0x3d1c7c[_0x5f9f('0x32')]||0x3;this[_0x5f9f('0x33')]=_0x3d1c7c[_0x5f9f('0x33')]||0x96;this[_0x5f9f('0x34')]=_0x3d1c7c[_0x5f9f('0x34')]||0x3;this[_0x5f9f('0x35')]=_0x3d1c7c[_0x5f9f('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3d1c7c[_0x5f9f('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3d1c7c[_0x5f9f('0x37')]||0x96;this[_0x5f9f('0x38')]=_0x3d1c7c[_0x5f9f('0x38')]||0x3;this['dialDropRetryFrequency']=_0x3d1c7c[_0x5f9f('0x39')]||0x96;this[_0x5f9f('0x3a')]=_0x3d1c7c[_0x5f9f('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x3d1c7c['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x3d1c7c[_0x5f9f('0x3b')]||0x3;this[_0x5f9f('0x3c')]=_0x3d1c7c[_0x5f9f('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x3d1c7c[_0x5f9f('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3d1c7c[_0x5f9f('0x3e')]||0x96;this[_0x5f9f('0x3f')]=_0x3d1c7c['dialGlobalMaxRetry']||0x4;this[_0x5f9f('0x40')]=_0x3d1c7c['Trunk']?_0x3d1c7c[_0x5f9f('0x40')]:undefined;this['TrunkBackup']=_0x3d1c7c[_0x5f9f('0x41')]?_0x3d1c7c[_0x5f9f('0x41')]:undefined;this['dialPrefix']=_0x3d1c7c[_0x5f9f('0x42')]||undefined;this[_0x5f9f('0x43')]=_0x3d1c7c[_0x5f9f('0x43')]?_0x3d1c7c[_0x5f9f('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x3d1c7c[_0x5f9f('0x44')]||_0x5f9f('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x3d1c7c[_0x5f9f('0x46')]||undefined;this[_0x5f9f('0x47')]=_0x3d1c7c['dialCutDigit']||undefined;this[_0x5f9f('0x48')]=strategy[_0x3d1c7c[_0x5f9f('0x48')]]||_0x5f9f('0x9');this[_0x5f9f('0x49')]=!![];this[_0x5f9f('0x4a')]=_0x3d1c7c['dialAMDActive']||![];this[_0x5f9f('0x4b')]=_0x3d1c7c[_0x5f9f('0x4b')];this[_0x5f9f('0x4c')]=_0x3d1c7c['dialAMDGreeting'];this[_0x5f9f('0x4d')]=_0x3d1c7c['dialAMDAfterGreetingSilence'];this[_0x5f9f('0x4e')]=_0x3d1c7c[_0x5f9f('0x4e')];this[_0x5f9f('0x4f')]=_0x3d1c7c[_0x5f9f('0x4f')];this['dialAMDBetweenWordsSilence']=_0x3d1c7c[_0x5f9f('0x50')];this[_0x5f9f('0x51')]=_0x3d1c7c[_0x5f9f('0x51')];this[_0x5f9f('0x52')]=_0x3d1c7c[_0x5f9f('0x52')];this[_0x5f9f('0x53')]=_0x3d1c7c[_0x5f9f('0x53')];this[_0x5f9f('0x54')]=0x0;this['pTalking']=0x0;this[_0x5f9f('0x55')]=_0x3d1c7c['timeout'];this[_0x5f9f('0x56')]=0x0;this[_0x5f9f('0x57')]=0x0;this[_0x5f9f('0x58')]=0x0;this[_0x5f9f('0x59')]=0x0;this[_0x5f9f('0x5a')]=0x0;this[_0x5f9f('0x5b')]=0x0;this[_0x5f9f('0x5c')]=0x0;this[_0x5f9f('0x5d')]=0x0;this[_0x5f9f('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x5f9f('0x5f')]=0x0;this['outboundReCallsDay']=0x0;this[_0x5f9f('0x60')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x5f9f('0x61')]=undefined;this[_0x5f9f('0x62')]=1.05;this[_0x5f9f('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5f9f('0x64')]=0x0;this[_0x5f9f('0x65')]=0x0;this[_0x5f9f('0x66')]=0x0;this[_0x5f9f('0x67')]=0x0;this[_0x5f9f('0x68')]=0x0;this[_0x5f9f('0x69')]=0x0;this[_0x5f9f('0x6a')]=_0x3d1c7c[_0x5f9f('0x6b')]||0x14;this[_0x5f9f('0x6c')]=_0x3d1c7c[_0x5f9f('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x5f9f('0x6d')]=0x0;this[_0x5f9f('0x6e')]=0x1;this[_0x5f9f('0x6f')]=0x0;this[_0x5f9f('0x70')]=0x0;this[_0x5f9f('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0x5f9f('0x72')]=_0x3d1c7c[_0x5f9f('0x72')]||0x1e;this['dialRecallInQueue']=_0x3d1c7c['dialRecallInQueue']||![];this[_0x5f9f('0x73')]=!!_0x3d1c7c[_0x5f9f('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x3d1c7c[_0x5f9f('0x74')]||![];this[_0x5f9f('0x75')]=_0x3d1c7c[_0x5f9f('0x75')]||undefined;this[_0x5f9f('0x76')]=_0x3d1c7c[_0x5f9f('0x76')]||![];this['dialAgiAfterHangupAgent']=_0x3d1c7c['dialAgiAfterHangupAgent']||![];this[_0x5f9f('0xb')]=monitorFormat[_0x3d1c7c[_0x5f9f('0xb')]]?monitorFormat[_0x3d1c7c[_0x5f9f('0xb')]]:undefined;this['mandatoryDisposition']=_0x3d1c7c[_0x5f9f('0x77')]||![];this[_0x5f9f('0x78')]=_0x3d1c7c[_0x5f9f('0x78')]?_0x3d1c7c[_0x5f9f('0x78')]:undefined;}module[_0x5f9f('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 11b21b8..f72cf70 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 _0xefa0=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xdb9542,_0x3b493a){var _0x4b5188=function(_0x1489f6){while(--_0x1489f6){_0xdb9542['push'](_0xdb9542['shift']());}};_0x4b5188(++_0x3b493a);}(_0xefa0,0x7d));var _0x0efa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xefa0[_0x40a045];return _0x1a687c;};'use strict';function VtigerAccount(_0x1070e2){this['id']=_0x1070e2['id']||0x0;this[_0x0efa('0x0')]=_0x1070e2[_0x0efa('0x0')]||'';this['username']=_0x1070e2[_0x0efa('0x1')]||'';this[_0x0efa('0x2')]=_0x1070e2['accessKey']||'';this[_0x0efa('0x3')]=_0x1070e2[_0x0efa('0x3')]||'';this['serverUrl']=_0x1070e2[_0x0efa('0x4')]||'';this[_0x0efa('0x5')]=_0x1070e2[_0x0efa('0x5')]||{};}module[_0x0efa('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa555=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa555,0x181));var _0x5a55=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xa555[_0x238671];return _0x474844;};'use strict';function VtigerAccount(_0x3a1fbe){this['id']=_0x3a1fbe['id']||0x0;this[_0x5a55('0x0')]=_0x3a1fbe['name']||'';this['username']=_0x3a1fbe[_0x5a55('0x1')]||'';this[_0x5a55('0x2')]=_0x3a1fbe['accessKey']||'';this[_0x5a55('0x3')]=_0x3a1fbe[_0x5a55('0x3')]||'';this[_0x5a55('0x4')]=_0x3a1fbe[_0x5a55('0x4')]||'';this['Configurations']=_0x3a1fbe[_0x5a55('0x5')]||{};}module[_0x5a55('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 a9c9fea..04414ae 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 _0x3bfc=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x316727,_0x1df3d6){var _0x4ac1a4=function(_0x3be7d9){while(--_0x3be7d9){_0x316727['push'](_0x316727['shift']());}};_0x4ac1a4(++_0x1df3d6);}(_0x3bfc,0x1d9));var _0xc3bf=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x3bfc[_0x3dbd6d];return _0x1216f1;};'use strict';function ZendeskAccount(_0x164ff3){this['id']=_0x164ff3['id']||0x0;this[_0xc3bf('0x0')]=_0x164ff3[_0xc3bf('0x0')]||'';this[_0xc3bf('0x1')]=_0x164ff3[_0xc3bf('0x1')]||'';this[_0xc3bf('0x2')]=_0x164ff3[_0xc3bf('0x2')]||'';this[_0xc3bf('0x3')]=_0x164ff3[_0xc3bf('0x3')]||'';this[_0xc3bf('0x4')]=_0x164ff3[_0xc3bf('0x4')]||'';this[_0xc3bf('0x5')]=_0x164ff3['authType']||'';this[_0xc3bf('0x6')]=_0x164ff3[_0xc3bf('0x6')]||_0xc3bf('0x7');this['serverUrl']=_0x164ff3[_0xc3bf('0x8')]||'';this[_0xc3bf('0x9')]=_0x164ff3['Configurations']||{};}module[_0xc3bf('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xff8d=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff8d,0x71));var _0xdff8=function(_0x20b6df,_0x55508b){_0x20b6df=_0x20b6df-0x0;var _0x29828d=_0xff8d[_0x20b6df];return _0x29828d;};'use strict';function ZendeskAccount(_0x2004b0){this['id']=_0x2004b0['id']||0x0;this[_0xdff8('0x0')]=_0x2004b0[_0xdff8('0x0')]||'';this[_0xdff8('0x1')]=_0x2004b0[_0xdff8('0x1')]||'';this[_0xdff8('0x2')]=_0x2004b0[_0xdff8('0x2')]||'';this[_0xdff8('0x3')]=_0x2004b0[_0xdff8('0x3')]||'';this[_0xdff8('0x4')]=_0x2004b0[_0xdff8('0x4')]||'';this[_0xdff8('0x5')]=_0x2004b0[_0xdff8('0x5')]||'';this[_0xdff8('0x6')]=_0x2004b0['type']||_0xdff8('0x7');this['serverUrl']=_0x2004b0[_0xdff8('0x8')]||'';this[_0xdff8('0x9')]=_0x2004b0[_0xdff8('0x9')]||{};}module[_0xdff8('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 374785e..c12f150 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 _0xdd78=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x17cad8,_0x241dc3){var _0x1b793e=function(_0x504055){while(--_0x504055){_0x17cad8['push'](_0x17cad8['shift']());}};_0x1b793e(++_0x241dc3);}(_0xdd78,0x80));var _0x8dd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd78[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x50fce0){this['id']=_0x50fce0['id']||0x0;this[_0x8dd7('0x0')]=_0x50fce0['name']||'';this['description']=_0x50fce0[_0x8dd7('0x1')]||'';this[_0x8dd7('0x2')]=_0x50fce0['host']||'';this[_0x8dd7('0x3')]=_0x50fce0[_0x8dd7('0x3')]||'';this[_0x8dd7('0x4')]=_0x50fce0[_0x8dd7('0x4')]||'';this[_0x8dd7('0x5')]=_0x50fce0[_0x8dd7('0x5')]||'';this['serverUrl']=_0x50fce0[_0x8dd7('0x6')]||'';this[_0x8dd7('0x7')]=_0x50fce0[_0x8dd7('0x7')]||'';this[_0x8dd7('0x8')]=_0x50fce0[_0x8dd7('0x8')]||'';this[_0x8dd7('0x9')]=_0x50fce0[_0x8dd7('0x9')]||{};}module[_0x8dd7('0xa')]=ZohoAccount; \ No newline at end of file +var _0x2a97=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x25ef7a,_0x10187a){var _0xd4c6f8=function(_0x48f72a){while(--_0x48f72a){_0x25ef7a['push'](_0x25ef7a['shift']());}};_0xd4c6f8(++_0x10187a);}(_0x2a97,0xca));var _0x72a9=function(_0x345b5b,_0x3d4f27){_0x345b5b=_0x345b5b-0x0;var _0x5d688a=_0x2a97[_0x345b5b];return _0x5d688a;};'use strict';function ZohoAccount(_0x1c7389){this['id']=_0x1c7389['id']||0x0;this[_0x72a9('0x0')]=_0x1c7389[_0x72a9('0x0')]||'';this[_0x72a9('0x1')]=_0x1c7389[_0x72a9('0x1')]||'';this[_0x72a9('0x2')]=_0x1c7389[_0x72a9('0x2')]||'';this[_0x72a9('0x3')]=_0x1c7389[_0x72a9('0x3')]||'';this[_0x72a9('0x4')]=_0x1c7389[_0x72a9('0x4')]||'';this['clientSecret']=_0x1c7389[_0x72a9('0x5')]||'';this['serverUrl']=_0x1c7389[_0x72a9('0x6')]||'';this[_0x72a9('0x7')]=_0x1c7389[_0x72a9('0x7')]||'';this[_0x72a9('0x8')]=_0x1c7389[_0x72a9('0x8')]||'';this[_0x72a9('0x9')]=_0x1c7389[_0x72a9('0x9')]||{};}module[_0x72a9('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index dcbf7ff..16133bc 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 _0xca84=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry'];(function(_0x45b607,_0x126ea5){var _0x5ad914=function(_0x549d5d){while(--_0x549d5d){_0x45b607['push'](_0x45b607['shift']());}};_0x5ad914(++_0x126ea5);}(_0xca84,0x183));var _0x4ca8=function(_0x54265b,_0x2fffef){_0x54265b=_0x54265b-0x0;var _0x84c5dc=_0xca84[_0x54265b];return _0x84c5dc;};'use strict';var util=require('util');var _=require(_0x4ca8('0x0'));var moment=require(_0x4ca8('0x1'));function checkNameSurname(_0xe0bbc9,_0x20530a,_0x2376ac){var _0x16a5eb='';if(!_['isNil'](_0x20530a)&&'string'===typeof _0x20530a){_0x16a5eb+=_0x20530a;}if(!_[_0x4ca8('0x2')](_0x2376ac)&&_0x4ca8('0x3')===typeof _0x2376ac){_0x16a5eb+='\x20'+_0x2376ac;}if(_0x16a5eb!==''){return _0x16a5eb;}return _0xe0bbc9;}function Action(_0x2ff831,_0x702335,_0x3f781c,_0x4d5acb,_0x1715d0){this[_0x4ca8('0x4')]=_0x3f781c||undefined;this[_0x4ca8('0x5')]=_0x2ff831['id'];this[_0x4ca8('0x6')]=_0x702335[_0x4ca8('0x7')];this[_0x4ca8('0x8')]=_0x702335['type'];this[_0x4ca8('0x9')]=_0x4ca8('0x6');this[_0x4ca8('0xa')]=![];this[_0x4ca8('0xb')]=_[_0x4ca8('0x2')](_0x2ff831[_0x4ca8('0xc')])?undefined:_0x2ff831['Agent'][_0x4ca8('0x7')];this['channelAgent']=this['membername']?util[_0x4ca8('0xd')](_0x4ca8('0xe'),this[_0x4ca8('0xb')]):_0x4d5acb||undefined;this[_0x4ca8('0xf')]=checkNameSurname(_0x2ff831[_0x4ca8('0x10')]['phone'],_0x2ff831['Contact'][_0x4ca8('0x11')],_0x2ff831[_0x4ca8('0x10')][_0x4ca8('0x12')]);this[_0x4ca8('0x13')]=_0x2ff831[_0x4ca8('0x13')]||![];this[_0x4ca8('0x14')]=_0x2ff831[_0x4ca8('0x10')][_0x4ca8('0x15')];this[_0x4ca8('0x16')]=_0x2ff831['scheduledat'];this[_0x4ca8('0x17')]=_0x2ff831['countbusyretry']||0x0;this['countcongestionretry']=_0x2ff831['countcongestionretry']||0x0;this[_0x4ca8('0x18')]=_0x2ff831[_0x4ca8('0x18')]||0x0;this[_0x4ca8('0x19')]=(_0x2ff831[_0x4ca8('0x17')]||0x0)+(_0x2ff831[_0x4ca8('0x1a')]||0x0)+(_0x2ff831[_0x4ca8('0x18')]||0x0)+(_0x2ff831[_0x4ca8('0x1b')]||0x0)+(_0x2ff831['countdropretry']||0x0)+(_0x2ff831[_0x4ca8('0x1c')]||0x0)+(_0x2ff831[_0x4ca8('0x1d')]||0x0)+(_0x2ff831[_0x4ca8('0x1e')]||0x0);this['countnosuchnumberretry']=_0x2ff831[_0x4ca8('0x1b')]||0x0;this['countdropretry']=_0x2ff831['countdropretry']||0x0;this[_0x4ca8('0x1c')]=_0x2ff831[_0x4ca8('0x1c')]||0x0;this[_0x4ca8('0x1d')]=_0x2ff831['countmachineretry']||0x0;this[_0x4ca8('0x1e')]=_0x2ff831['countagentrejectretry']||0x0;this['callback']=_0x2ff831[_0x4ca8('0x1f')];this[_0x4ca8('0x20')]=_0x2ff831[_0x4ca8('0x20')];this[_0x4ca8('0x21')]=_0x2ff831[_0x4ca8('0x21')];this[_0x4ca8('0x22')]=_0x2ff831[_0x4ca8('0x22')];this[_0x4ca8('0x23')]=_0x2ff831[_0x4ca8('0x23')];this[_0x4ca8('0x24')]=_0x2ff831['ListId'];this[_0x4ca8('0x25')]=_[_0x4ca8('0x2')](_0x2ff831[_0x4ca8('0xc')])?_0x2ff831['UserId']:_0x2ff831[_0x4ca8('0xc')]['id'];this[_0x4ca8('0x26')]=_0x2ff831[_0x4ca8('0x26')];this[_0x4ca8('0x27')]='';this[_0x4ca8('0x28')]='';}Action[_0x4ca8('0x29')][_0x4ca8('0x2a')]=function(){return util[_0x4ca8('0xd')](_0x4ca8('0x2b'),this[_0x4ca8('0xf')],this[_0x4ca8('0x2c')]);};module[_0x4ca8('0x2d')]=Action; \ No newline at end of file +var _0x5e00=['recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','\x22%s\x22\x20<%s>','exports','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x3ead90,_0x28fe97){var _0xa464f0=function(_0x4d91f3){while(--_0x4d91f3){_0x3ead90['push'](_0x3ead90['shift']());}};_0xa464f0(++_0x28fe97);}(_0x5e00,0x158));var _0x05e0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5e00[_0x57b54c];return _0x59cc19;};'use strict';var util=require('util');var _=require(_0x05e0('0x0'));var moment=require('moment');function checkNameSurname(_0x3dca79,_0x567bce,_0x34606f){var _0x187dfe='';if(!_[_0x05e0('0x1')](_0x567bce)&&_0x05e0('0x2')===typeof _0x567bce){_0x187dfe+=_0x567bce;}if(!_[_0x05e0('0x1')](_0x34606f)&&_0x05e0('0x2')===typeof _0x34606f){_0x187dfe+='\x20'+_0x34606f;}if(_0x187dfe!==''){return _0x187dfe;}return _0x3dca79;}function Action(_0x4dcb95,_0x9f3149,_0x32d3af,_0x364032,_0x2da86c){this[_0x05e0('0x3')]=_0x32d3af||undefined;this[_0x05e0('0x4')]=_0x4dcb95['id'];this[_0x05e0('0x5')]=_0x9f3149[_0x05e0('0x6')];this['type']=_0x9f3149[_0x05e0('0x7')];this[_0x05e0('0x8')]=_0x05e0('0x5');this[_0x05e0('0x9')]=![];this['membername']=_[_0x05e0('0x1')](_0x4dcb95[_0x05e0('0xa')])?undefined:_0x4dcb95[_0x05e0('0xa')][_0x05e0('0x6')];this[_0x05e0('0xb')]=this[_0x05e0('0xc')]?util[_0x05e0('0xd')](_0x05e0('0xe'),this['membername']):_0x364032||undefined;this[_0x05e0('0xf')]=checkNameSurname(_0x4dcb95[_0x05e0('0x10')]['phone'],_0x4dcb95['Contact'][_0x05e0('0x11')],_0x4dcb95[_0x05e0('0x10')]['lastName']);this[_0x05e0('0x12')]=_0x4dcb95[_0x05e0('0x12')]||![];this[_0x05e0('0x13')]=_0x4dcb95[_0x05e0('0x10')][_0x05e0('0x14')];this[_0x05e0('0x15')]=_0x4dcb95[_0x05e0('0x15')];this[_0x05e0('0x16')]=_0x4dcb95[_0x05e0('0x16')]||0x0;this[_0x05e0('0x17')]=_0x4dcb95['countcongestionretry']||0x0;this[_0x05e0('0x18')]=_0x4dcb95[_0x05e0('0x18')]||0x0;this[_0x05e0('0x19')]=(_0x4dcb95['countbusyretry']||0x0)+(_0x4dcb95['countcongestionretry']||0x0)+(_0x4dcb95[_0x05e0('0x18')]||0x0)+(_0x4dcb95['countnosuchnumberretry']||0x0)+(_0x4dcb95['countdropretry']||0x0)+(_0x4dcb95[_0x05e0('0x1a')]||0x0)+(_0x4dcb95[_0x05e0('0x1b')]||0x0)+(_0x4dcb95[_0x05e0('0x1c')]||0x0);this[_0x05e0('0x1d')]=_0x4dcb95[_0x05e0('0x1d')]||0x0;this['countdropretry']=_0x4dcb95[_0x05e0('0x1e')]||0x0;this['countabandonedretry']=_0x4dcb95['countabandonedretry']||0x0;this[_0x05e0('0x1b')]=_0x4dcb95[_0x05e0('0x1b')]||0x0;this[_0x05e0('0x1c')]=_0x4dcb95[_0x05e0('0x1c')]||0x0;this[_0x05e0('0x1f')]=_0x4dcb95['callback'];this[_0x05e0('0x20')]=_0x4dcb95['callbackuniqueid'];this[_0x05e0('0x21')]=_0x4dcb95[_0x05e0('0x21')];this[_0x05e0('0x22')]=_0x4dcb95[_0x05e0('0x22')];this['ContactId']=_0x4dcb95[_0x05e0('0x23')];this['ListId']=_0x4dcb95[_0x05e0('0x24')];this['UserId']=_[_0x05e0('0x1')](_0x4dcb95[_0x05e0('0xa')])?_0x4dcb95[_0x05e0('0x25')]:_0x4dcb95[_0x05e0('0xa')]['id'];this['VoiceQueueId']=_0x4dcb95[_0x05e0('0x26')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x05e0('0x27')]['getCaller']=function(){return util[_0x05e0('0xd')](_0x05e0('0x28'),this[_0x05e0('0xf')],this['number']);};module[_0x05e0('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 424b972..9d084ff 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 _0x9c5a=['[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','SIP/%s','status','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','idContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','addVariable','variables','keys','variable','error','inspect','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./rpcDb','./action','defaults','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','booked','clearZombieChannels','dialActive','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','then','length','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','buildAcw','custom:agentcomplete','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','agentreject','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]'];(function(_0x59a8f5,_0x52dba5){var _0x49299a=function(_0x57c8b2){while(--_0x57c8b2){_0x59a8f5['push'](_0x59a8f5['shift']());}};_0x49299a(++_0x52dba5);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x407e6b,_0x5dfe35){_0x407e6b=_0x407e6b-0x0;var _0x15ea8a=_0x9c5a[_0x407e6b];return _0x15ea8a;};'use strict';var util=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var md5=require(_0xa9c5('0x4'));var Redis=require(_0xa9c5('0x5'));var config=require('../../../config/environment');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var loggerAction=require('../../../config/logger')(_0xa9c5('0x8'));var ami=require('../ami');var rpcDb=require(_0xa9c5('0x9'));var Action=require(_0xa9c5('0xa'));var ut=require('./util/util');config['redis']=_[_0xa9c5('0xb')](config[_0xa9c5('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xa9c5('0xd'))(new Redis(config[_0xa9c5('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xa9c5('0xe')]=function(_0x40a79d){this['tail']=this['tail']?this[_0xa9c5('0xf')][_0xa9c5('0x10')](_0x40a79d):_0x40a79d();};function Preview(_0x45f8d8){this[_0xa9c5('0x11')]=new Sequence();this[_0xa9c5('0x12')]=_0x45f8d8[_0xa9c5('0x13')];this[_0xa9c5('0x14')]=_0x45f8d8[_0xa9c5('0x14')];this[_0xa9c5('0x15')]={};this[_0xa9c5('0x16')]=_0x45f8d8['agents'];this[_0xa9c5('0x17')]=0x0;ami['on'](_0xa9c5('0x18'),this[_0xa9c5('0x19')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1b'),this[_0xa9c5('0x1c')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1d'),this[_0xa9c5('0x1e')][_0xa9c5('0x1a')](this));ami['on']('dialend',this[_0xa9c5('0x1f')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x20'),this['syncNewExten'][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x21'),this[_0xa9c5('0x22')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x23'),this[_0xa9c5('0x24')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x25'),this[_0xa9c5('0x26')][_0xa9c5('0x1a')](this));this[_0xa9c5('0x27')](this[_0xa9c5('0x12')]);}function emit(_0x54f8b9,_0x1115ad,_0x21ab50){io['to'](_0x54f8b9)['emit'](_0x1115ad,_0x21ab50);}function emitCampaignPreview(_0x5d2115){if(_0x5d2115[_0xa9c5('0x28')]===_0xa9c5('0x29')){var _0x10b208={'id':_0x5d2115['id'],'name':_0x5d2115[_0xa9c5('0x2a')],'strategy':_0x5d2115[_0xa9c5('0x2b')],'answered':_0x5d2115[_0xa9c5('0x2c')],'available':_0x5d2115['available'],'loggedIn':_0x5d2115['loggedIn'],'pTalking':_0x5d2115[_0xa9c5('0x2d')],'sumBillable':_0x5d2115[_0xa9c5('0x2e')],'sumDuration':_0x5d2115['sumDuration'],'sumHoldTime':_0x5d2115[_0xa9c5('0x2f')]||0x0,'talking':_0x5d2115[_0xa9c5('0x30')],'total':_0x5d2115[_0xa9c5('0x31')],'type':_0x5d2115[_0xa9c5('0x28')],'unmanaged':_0x5d2115[_0xa9c5('0x32')],'abandoned':_0x5d2115[_0xa9c5('0x33')],'waiting':_0x5d2115[_0xa9c5('0x34')],'loggedInDb':_0x5d2115['loggedInDb'],'dialActive':_0x5d2115['dialActive'],'dialMethod':_0x5d2115[_0xa9c5('0x35')],'dialOriginateCallerIdName':_0x5d2115['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5d2115[_0xa9c5('0x36')],'dialOriginateTimeout':_0x5d2115[_0xa9c5('0x37')],'dialPrefix':_0x5d2115['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5d2115[_0xa9c5('0x38')],'outboundAnswerCallsDay':_0x5d2115[_0xa9c5('0x39')],'outboundBlacklistCallsDay':_0x5d2115['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5d2115[_0xa9c5('0x3a')],'outboundCongestionCallsDay':_0x5d2115[_0xa9c5('0x3b')],'outboundDropCallsDayACS':_0x5d2115[_0xa9c5('0x3c')],'outboundDropCallsDayCallersExit':_0x5d2115[_0xa9c5('0x3d')],'outboundDropCallsDayTimeout':_0x5d2115[_0xa9c5('0x3e')],'outboundNoAnswerCallsDay':_0x5d2115['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5d2115[_0xa9c5('0x3f')],'outboundOriginateFailureCallsDay':_0x5d2115['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5d2115[_0xa9c5('0x40')],'outboundRejectCallsDay':_0x5d2115[_0xa9c5('0x41')],'outboundUnknownCallsDay':_0x5d2115[_0xa9c5('0x42')],'outboundAbandonedCallsDay':_0x5d2115['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5d2115[_0xa9c5('0x43')],'predictiveIntervalAvgHoldtime':_0x5d2115[_0xa9c5('0x44')],'predictiveIntervalAvgTalktime':_0x5d2115['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5d2115[_0xa9c5('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x5d2115[_0xa9c5('0x46')],'predictiveIntervalErlangCalls':_0x5d2115[_0xa9c5('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5d2115[_0xa9c5('0x48')],'predictiveIntervalHitRate':_0x5d2115[_0xa9c5('0x49')],'predictiveIntervalMultiplicativeFactor':_0x5d2115[_0xa9c5('0x4a')],'predictiveIntervalPauses':_0x5d2115[_0xa9c5('0x4b')],'predictiveIntervalAvailable':_0x5d2115['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5d2115[_0xa9c5('0x4c')],'message':_0x5d2115[_0xa9c5('0x4d')],'originated':_0x5d2115[_0xa9c5('0x4e')],'erlangCalls':_0x5d2115[_0xa9c5('0x4f')],'erlangCallToSecond':_0x5d2115[_0xa9c5('0x50')],'erlangAbandonmentRate':_0x5d2115[_0xa9c5('0x51')],'erlangBusyFactor':_0x5d2115[_0xa9c5('0x52')],'startPredictive':_0x5d2115[_0xa9c5('0x53')],'startProgressive':_0x5d2115['startProgressive']};if(_0x5d2115['Trunk']){_0x10b208[_0xa9c5('0x54')]={'id':_0x5d2115[_0xa9c5('0x54')]['id'],'name':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x2a')],'active':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x55')],'callerid':_0x5d2115['Trunk']['callerid']};}if(_0x5d2115['Interval']){_0x10b208[_0xa9c5('0x56')]={'id':_0x5d2115[_0xa9c5('0x56')]['id'],'name':_0x5d2115['Interval'][_0xa9c5('0x2a')]};}var _0x56eb82=md5(JSON[_0xa9c5('0x57')](_0x10b208));if(_0x5d2115[_0xa9c5('0x4')]!==_0x56eb82){_0x5d2115[_0xa9c5('0x4')]=_0x56eb82;emit(util[_0xa9c5('0x58')]('voice:queue:%s',_0x10b208[_0xa9c5('0x2a')]),_0xa9c5('0x59'),_0x10b208);}}}function emitVoiceQueueChannelRemove(_0x191153){logger[_0xa9c5('0x5a')](_0xa9c5('0x5b'),JSON[_0xa9c5('0x57')](_0x191153));emit(util[_0xa9c5('0x58')](_0xa9c5('0x5c'),_0x191153['name']),_0xa9c5('0x5d'),_0x191153);io[_0xa9c5('0x5e')](_0xa9c5('0x5f'),_0x191153);}function notSendMessagesQueue(_0x2b95fa){if(_0x2b95fa[_0xa9c5('0x60')]){if(_0x2b95fa[_0xa9c5('0x4e')]===0x0&&_0x2b95fa['pTalking']===0x0){_0x2b95fa[_0xa9c5('0x60')]=![];_0x2b95fa['available']=0x0;_0x2b95fa[_0xa9c5('0x61')]=0x0;_0x2b95fa['message']=_0xa9c5('0x62');ut[_0xa9c5('0x63')](_0xa9c5('0x64'),_0x2b95fa['name']+_0xa9c5('0x65'));}else{_0x2b95fa[_0xa9c5('0x4d')]=_0xa9c5('0x66');ut[_0xa9c5('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2b95fa[_0xa9c5('0x2a')]+_0xa9c5('0x67'));}emitCampaignPreview(_0x2b95fa);}}Preview[_0xa9c5('0x68')][_0xa9c5('0x27')]=function(){var _0x2a6b48=this;setInterval(function(){_0x2a6b48['syncCampaigns']();},0x7cf);};Preview[_0xa9c5('0x68')]['syncCampaigns']=function(){var _0x1de605=this[_0xa9c5('0x12')];this[_0xa9c5('0x17')]+=0x1;for(var _0xc8fca4 in _0x1de605){if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&(_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')||_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x6a'))&&_0x1de605[_0xc8fca4][_0xa9c5('0x28')]==='outbound'){if(this[_0xa9c5('0x17')]>0x7){this[_0xa9c5('0x17')]=0x0;this[_0xa9c5('0x6b')]();}}if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')&&_0x1de605[_0xc8fca4]['type']===_0xa9c5('0x29')){if(_0x1de605[_0xc8fca4][_0xa9c5('0x6c')]){this['setMessage'](_0x1de605[_0xc8fca4]);if(_0x1de605[_0xc8fca4]['dialPreviewAutoRecallMe'])this['recallMe'](_0x1de605[_0xc8fca4]);}else{notSendMessagesQueue(_0x1de605[_0xc8fca4]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x160020){var _0x569185=this;this[_0xa9c5('0x11')][_0xa9c5('0xe')](function(){if(!_[_0xa9c5('0x6d')](_0x569185[_0xa9c5('0x15')][_0x160020])){loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x6e'),_0x160020,_0xa9c5('0x6f'),_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')],_0xa9c5('0x71'),JSON[_0xa9c5('0x57')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020]['queue']][_0xa9c5('0x4e')]),_0xa9c5('0x72'),JSON['stringify'](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]][_0xa9c5('0x2d')]),JSON['stringify'](_0x569185['actions'][_0x160020][_0xa9c5('0x73')]),JSON[_0xa9c5('0x57')](_['pick'](_0x569185[_0xa9c5('0x15')][_0x160020],[_0xa9c5('0x74'),_0xa9c5('0x75'),_0xa9c5('0x76'),_0xa9c5('0x77')])));return ami[_0xa9c5('0x78')]({'action':'status','channel':_0x569185['actions'][_0x160020]['channel']})[_0xa9c5('0x79')](function(_0x277903){if(_0x277903[_0xa9c5('0x4d')]===_0xa9c5('0x7a')){setTimeout(function(){if(_0x569185[_0xa9c5('0x15')][_0x160020]){ut[_0xa9c5('0x7b')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]],_0xa9c5('0x7c'));if(_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x73')]===!![]){ut[_0xa9c5('0x7d')](_0x569185['campaignsPreview'][_0x569185['actions'][_0x160020][_0xa9c5('0x70')]],'[clearZombieChannel]');ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);}ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);delete _0x569185[_0xa9c5('0x15')][_0x160020];}},0x2328);}});}});};Preview[_0xa9c5('0x68')]['clearZombieChannels']=function(){var _0x49422c=this;loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x7f'),_[_0xa9c5('0x80')](this['actions']));for(var _0x31e12e in this[_0xa9c5('0x15')]){if(_0x49422c[_0xa9c5('0x15')][_0xa9c5('0x69')](_0x31e12e)){_0x49422c[_0xa9c5('0x81')](_0x31e12e);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x82')]=function(_0x298b3d){var _0x5a7f0a=this;rpcDb[_0xa9c5('0x83')](_0x298b3d['id'],ut['agentReadyId'](this[_0xa9c5('0x16')]))[_0xa9c5('0x84')](function(_0x26bda1){if(!_['isNil'](_0x26bda1)){for(var _0x4d475a=0x0;_0x4d475a<_0x26bda1[_0xa9c5('0x85')];_0x4d475a+=0x1){if(ut['getDiff'](_0x26bda1[_0x4d475a][_0xa9c5('0x86')])<_0x298b3d[_0xa9c5('0x87')]*0x3c){if(_0x26bda1[_0x4d475a][_0xa9c5('0x88')]&&!_0x26bda1[_0x4d475a][_0xa9c5('0x88')]['voicePause']){_0x5a7f0a[_0xa9c5('0x89')](_0x26bda1[_0x4d475a]['id'])[_0xa9c5('0x84')](ut[_0xa9c5('0x8a')](_0xa9c5('0x8b')))['catch'](ut['logger2'](_0xa9c5('0x8b')));}else{rpcDb[_0xa9c5('0x8c')](_0x26bda1[_0x4d475a]['id']);}}else{var _0x67c1f8=new Action(_0x26bda1[_0x4d475a],_0x298b3d);_0x67c1f8[_0xa9c5('0x8d')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x298b3d['outboundReCallsDay']+=0x1;ut[_0xa9c5('0x8f')](_0x67c1f8,0x17,_0xa9c5('0x90'));if(_0x298b3d[_0xa9c5('0x91')]){rpcDb[_0xa9c5('0x92')](ut[_0xa9c5('0x93')](_0x26bda1[_0x4d475a]));rpcDb[_0xa9c5('0x94')](_0x67c1f8,_0xa9c5('0x95'));}else{ut[_0xa9c5('0x8f')](_0x67c1f8,0x16,_0xa9c5('0x96'));rpcDb[_0xa9c5('0x94')](_0x67c1f8,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x67c1f8,_0xa9c5('0x97'));}}}}})[_0xa9c5('0x79')](ut[_0xa9c5('0x8a')](_0xa9c5('0x98')));};Preview['prototype'][_0xa9c5('0x99')]=function(_0x4aa699){_0x4aa699[_0xa9c5('0x60')]=!![];if(ut[_0xa9c5('0x9a')](_0x4aa699[_0xa9c5('0x9b')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9c');}else if(!ut[_0xa9c5('0x9d')](_0x4aa699[_0xa9c5('0x6c')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x62');}else if(!this[_0xa9c5('0x9e')](_0x4aa699[_0xa9c5('0x54')])){if(!this[_0xa9c5('0x9e')](_0x4aa699['TrunkBackup'])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9f');}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}emitCampaignPreview(_0x4aa699);};Preview[_0xa9c5('0x68')]['callProgressDetectingCustomer']=function(_0x5b7c33,_0x207bb7,_0x502a00){var _0x2ae087=this;var _0x2510e4=this['actions'][_0x207bb7];var _0x219854=this[_0xa9c5('0x12')][_0x2510e4['queue']];var _0x4f8d9e;if(_0x219854){switch(_0x502a00){case'1':_0x219854[_0xa9c5('0x3f')]+=0x1;_0x2510e4[_0xa9c5('0xa1')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x0,_0xa9c5('0xa3'));ami[_0xa9c5('0x5e')]('custom:agentnosuchnumber',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xa5')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xa6'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xab'));}else{if(_0x2510e4[_0xa9c5('0xa1')]>=_0x219854['dialNoSuchNumberMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xab'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xa1'),_0x219854[_0xa9c5('0xad')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;case _0xa9c5('0xb0'):var _0x2d449a=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x2510e4['responsetime']=_0x2d449a;_0x2510e4[_0xa9c5('0xb1')]=_0x2d449a;_0x2510e4[_0xa9c5('0x73')]=!![];_0x219854[_0xa9c5('0x2d')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0xb2'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);ami[_0xa9c5('0x5e')]('custom:agentconnect',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xb5'),this['campaignsPreview'][_0x2510e4[_0xa9c5('0x70')]]));if(_0x219854[_0xa9c5('0xb6')]){ami[_0xa9c5('0x5e')]('custom:agentConnectPreview',ut[_0xa9c5('0xb7')](_0x2510e4));}break;case'16':ami[_0xa9c5('0x5e')](_0xa9c5('0xb8'),ut[_0xa9c5('0xa4')](_0x2510e4,'complete',this[_0xa9c5('0x12')][_0x2510e4[_0xa9c5('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2510e4,'complete'));_0x219854['outboundAnswerCallsDay']+=0x1;_0x219854['total']+=0x1;_0x219854['answered']+=0x1;ut['decrementTalkink'](_0x219854,'[16]');_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xba'));rpcDb['createCustomerFinal'](_0x2510e4,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x2510e4);_0x219854['sumDuration']+=_0x2510e4[_0xa9c5('0xbb')];_0x219854[_0xa9c5('0x2e')]+=_0x2510e4[_0xa9c5('0xbb')];logger[_0xa9c5('0x5a')]('[syncHangup][talking][decrement]',_0x2510e4['uniqueid'],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case _0xa9c5('0xbc'):_0x219854[_0xa9c5('0x3a')]+=0x1;_0x2510e4[_0xa9c5('0xbd')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x5,_0xa9c5('0xbe'));ami[_0xa9c5('0x5e')]('custom:agentbusy',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xbf')));rpcDb['createCustomerHistory'](_0x2510e4,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854['dialGlobalMaxRetry']){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc0'));}else{if(_0x2510e4[_0xa9c5('0xbd')]>=_0x219854[_0xa9c5('0xc1')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xbd'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4['activeContact']);}}break;case'NOANSWER':_0x219854[_0xa9c5('0xc5')]+=0x1;_0x2510e4['countnoanswerretry']+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x3,'NoAnswer');ami['emit'](_0xa9c5('0xc6'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xc7')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc9'));}else{if(_0x2510e4[_0xa9c5('0xca')]>=_0x219854[_0xa9c5('0xcb')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xcc'));}else{rpcDb[_0xa9c5('0xcd')](ut['scheduledAt'](_0x2510e4,_0xa9c5('0xca'),_0x219854[_0xa9c5('0xce')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xcf'):_0x219854[_0xa9c5('0x3b')]+=0x1;_0x2510e4[_0xa9c5('0xd0')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x8,_0xa9c5('0xd1'));ami[_0xa9c5('0x5e')](_0xa9c5('0xd2'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xd3')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xd4'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xd5'));}else{if(_0x2510e4[_0xa9c5('0xd0')]>=_0x219854['dialCongestionMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd0'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xd6'):_0x219854[_0xa9c5('0x41')]+=0x1;_0x2510e4[_0xa9c5('0xd7')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x14,_0xa9c5('0xd8'));ami[_0xa9c5('0x5e')]('custom:agentreject',ut['buildObj'](_0x2510e4,_0xa9c5('0xd9')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[syncHangupRequest][logAgentReject]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0x14,_0xa9c5('0xd8'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2510e4[_0xa9c5('0xd7')]>=_0x219854[_0xa9c5('0xda')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd7'),_0x219854['dialAgentRejectRetryFrequency']),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xdb'):_0x219854[_0xa9c5('0xdc')]+=0x1;_0x2510e4[_0xa9c5('0xdd')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xb,_0xa9c5('0xde'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xdf'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2510e4['countabandonedetry']>=_0x219854[_0xa9c5('0xe0')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,'countabandonedretry',_0x219854[_0xa9c5('0xe1')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case'18':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4[_0xa9c5('0xe2')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x12,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami[_0xa9c5('0x5e')](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe7'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe7'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe7'));}delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case'19':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x13,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami['emit'](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe8'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe8'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe8'));}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;default:if(_0x2510e4[_0xa9c5('0x73')]){ut[_0xa9c5('0x7d')](_0x219854,_0xa9c5('0xe9'));ut['loggerError'](_0xa9c5('0xea')+_0x219854['name'],_0x5b7c33);}_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xc,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xeb'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xec'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xec'));}delete this['actions'][_0x5b7c33['linkedid']];}if(!(_0x2510e4[_0xa9c5('0x73')]&&_0x502a00==='16')){ut[_0xa9c5('0x7b')](_0x219854,_0xa9c5('0xed'));logger[_0xa9c5('0x5a')](_0xa9c5('0xee'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x219854['originated']);}if(_0x502a00!==_0xa9c5('0xb0')){delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xef')]];}}};Preview[_0xa9c5('0x68')][_0xa9c5('0xf0')]=function(_0x42e803,_0xf77e11,_0x2204b){if(_[_0xa9c5('0xf1')](_0xf77e11)&&_0xa9c5('0xf2')!==typeof _0xf77e11){return;}if(_[_0xa9c5('0xf1')](_0x2204b)&&_0xa9c5('0xf2')!==typeof _0x2204b){return;}switch(_0x2204b[_0xa9c5('0xf3')]){case'0':ut['logAgent'](_0x42e803,0x0,_0xa9c5('0xa3'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf5'));break;case'3':ut['logAgent'](_0x42e803,0x3,_0xa9c5('0xf6'));rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xf7'));break;case'5':ut[_0xa9c5('0xf8')](_0x42e803,0x5,_0xa9c5('0xbe'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf9'));break;case'8':ut[_0xa9c5('0xf8')](_0x42e803,0x8,_0xa9c5('0xd1'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfa'));break;case'22':ut['logAgent'](_0x42e803,0x16,_0xa9c5('0xfb'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfc'));break;default:ut[_0xa9c5('0xf8')](_0x42e803,0xc,_0x2204b[_0xa9c5('0xf3')]);rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xfa'));}ut[_0xa9c5('0x7b')](_0xf77e11,_0xa9c5('0xfd'));logger[_0xa9c5('0x5a')](_0xa9c5('0xfe'),_0x42e803['uniqueid'],_0xa9c5('0xb4'),_0xf77e11['name'],_0xa9c5('0x71'),_0xf77e11[_0xa9c5('0x4e')]);delete this[_0xa9c5('0x15')][_0x42e803[_0xa9c5('0xb3')]];};Preview[_0xa9c5('0x68')][_0xa9c5('0xff')]=function(_0xe3b086,_0x35b8c9,_0x1fdc93,_0x1400b2,_0x3e2a1e){var _0x150d58=this;return new BPromise(function(_0x466ce6,_0x1c8efb){if(_[_0xa9c5('0x6d')](_0x35b8c9)||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x100')])||_['isNil'](_0x35b8c9[_0xa9c5('0x100')][_0xa9c5('0x101')])||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x76')])){_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x102'),_0x1400b2,_0x3e2a1e));return;}var _0x18389c=uuid['v4']();var _0xd2bb86=_0x150d58['campaignsPreview'][_0x35b8c9[_0xa9c5('0x6f')][_0xa9c5('0x2a')]];var _0x5018c4=_0x1fdc93?_0x150d58[_0xa9c5('0x16')][_0x1fdc93]['id']:undefined;_0x150d58[_0xa9c5('0x15')][_0x18389c]=new Action(_0x35b8c9,_0xd2bb86,_0x18389c,_0x1fdc93,_0x5018c4);var _0x5545eb=_0x150d58['actions'][_0x18389c];_0x5545eb[_0xa9c5('0xc4')]=_0x1400b2;_0x5545eb[_0xa9c5('0xae')]=_0x3e2a1e;_0x5545eb['lookAgent']=_0x1fdc93;if(_[_0xa9c5('0x103')](_0xe3b086)){_0x150d58[_0xa9c5('0x104')](_0x5545eb,_0xd2bb86,_0x35b8c9,_0x1fdc93)[_0xa9c5('0x84')](function(_0x2d5a24){logger[_0xa9c5('0x5a')](_0xa9c5('0x105'),_0xa9c5('0x106')+_0x5545eb[_0xa9c5('0x70')]+_0xa9c5('0x107')+_0x5545eb['idContact'],JSON[_0xa9c5('0x57')](_0x2d5a24));ami[_0xa9c5('0x5e')](_0xa9c5('0x108'),ut[_0xa9c5('0xa4')](_0x5545eb,'called',_0x150d58['campaignsPreview'][_0x5545eb[_0xa9c5('0x70')]]));_0x466ce6(ut[_0xa9c5('0x4d')](_0xa9c5('0x109')));})[_0xa9c5('0x79')](function(_0x3269ba){ut[_0xa9c5('0x63')]('[Preview][execCall][failure]',_0x3269ba);_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x10a'),_0x1400b2,_0x3e2a1e));});}else{_0xd2bb86[_0xa9c5('0x10b')]+=0x1;ut['logBlacklist'](_0x5545eb);rpcDb[_0xa9c5('0x10c')](_0x5545eb,_0xa9c5('0x10d'));delete _0x150d58['actions'][_0x18389c];_0x1c8efb(ut[_0xa9c5('0x4d')]('Contact\x20in\x20black\x20List',_0x1400b2,_0x3e2a1e));}});};Preview[_0xa9c5('0x68')]['isTrunkReachable']=function(_0x52d348){return!_[_0xa9c5('0x6d')](_0x52d348)&&!_[_0xa9c5('0x6d')](_0x52d348['name'])&&!_['isNil'](_0x52d348[_0xa9c5('0x55')])&&_0x52d348[_0xa9c5('0x55')]&&!_[_0xa9c5('0x6d')](this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])])&&!_['isNil'](this['trunks'][util[_0xa9c5('0x58')]('SIP/%s',_0x52d348[_0xa9c5('0x2a')])]['status'])&&(this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]==='reachable'||this[_0xa9c5('0x14')][util[_0xa9c5('0x58')](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]===_0xa9c5('0x110'));};Preview[_0xa9c5('0x68')][_0xa9c5('0x89')]=function(_0x37bdd7,_0x456833){var _0x1cc858=this;return new BPromise(function(_0x345b1d,_0x4681f9){_0x1cc858[_0xa9c5('0x111')](_0x37bdd7,_0x456833)[_0xa9c5('0x84')](function(_0x2f8ccf){_0x345b1d(_[_0xa9c5('0x112')](_0x2f8ccf,[_0xa9c5('0x4d')]));})[_0xa9c5('0x79')](function(_0x1b54dc){if(_0x1b54dc[_0xa9c5('0x113')]){rpcDb[_0xa9c5('0x114')](_0x37bdd7);}if(_0x1b54dc[_0xa9c5('0x55')]){rpcDb[_0xa9c5('0x8c')](_0x37bdd7);}_0x4681f9(_[_0xa9c5('0x112')](_0x1b54dc,['message']));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x111')]=function(_0x1d0b63,_0xa8905e){var _0x5e9ce9=this;return new BPromise(function(_0x1ff174,_0x4d7916){var _0x21a87e,_0x5b8f70;rpcDb[_0xa9c5('0x115')](_0x1d0b63)['then'](function(_0x22424e){if(!_[_0xa9c5('0x6d')](_0x22424e[0x0])){_0x5b8f70=_0x22424e[0x0][_0xa9c5('0x116')]?![]:!![];_0x21a87e=_0x22424e[0x0][_0xa9c5('0x116')]?!![]:![];_0x21a87e=_0xa8905e?!![]:_0x21a87e;}var _0x4a6123=_0x5e9ce9[_0xa9c5('0x117')](_0x22424e);if(_0x4a6123[_0xa9c5('0x118')]){rpcDb[_0xa9c5('0x119')](_[_0xa9c5('0x112')](_0x22424e[0x0],[_0xa9c5('0x76'),'Contact.phone']))[_0xa9c5('0x84')](function(_0x272db4){_0x5e9ce9[_0xa9c5('0xff')](_0x272db4,_0x22424e[0x0],_0xa8905e,_0x5b8f70,_0x21a87e)['then'](function(_0x18a668){_0x1ff174(_0x18a668);})[_0xa9c5('0x79')](function(_0x8cccd1){_0x4d7916(_0x8cccd1);});})[_0xa9c5('0x79')](function(_0x4c4b56){ut['logger']('[Preview][checkIsBlackList]',_0x4c4b56);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),_0x5b8f70,_0x21a87e));});}else{_0x4d7916(ut['message'](_0x4a6123[_0xa9c5('0x4d')],_0x5b8f70,_0x21a87e));}})['catch'](function(_0x592b18){ut['logger'](_0xa9c5('0x11b'),_0x592b18);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),![],!![]));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x117')]=function(_0xd06ffc){if(_[_0xa9c5('0x6d')](_0xd06ffc)||_[_0xa9c5('0x103')](_0xd06ffc)||!_[_0xa9c5('0x6d')](_0xd06ffc[0x0][_0xa9c5('0x88')])&&_[_0xa9c5('0x6d')](_0xd06ffc[0x0]['Agent'][_0xa9c5('0x2a')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11c'),_0xd06ffc);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x24b12d=this[_0xa9c5('0x12')][_0xd06ffc[0x0][_0xa9c5('0x6f')]['name']];_0x24b12d[_0xa9c5('0x4d')]=_0xa9c5('0xa0');if(_['isNil'](_0x24b12d)){ut[_0xa9c5('0x63')](_0xa9c5('0x11d'),_0x24b12d);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x54')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11e'),'campaign\x20Name:\x20'+_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x11f'));if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x120')])){ut['logger'](_0xa9c5('0x11e'),_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x121'));return{'isValid':![],'message':_0xa9c5('0x122')};}}if(!ut['isActive'](_0x24b12d['dialActive'])){ut[_0xa9c5('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x123'));return{'isValid':![],'message':_0xa9c5('0x124')+_0x24b12d['name']+_0xa9c5('0x123')};}return{'isValid':!![],'message':_0xa9c5('0x125')};};Preview[_0xa9c5('0x68')][_0xa9c5('0x104')]=function(_0x2c2671,_0x1c8e59,_0x26c209,_0x417181){var _0x58dd4c=this;return new BPromise(function(_0x4382cf,_0xdeb6e5){var _0x11621e=_0x2c2671[_0xa9c5('0xb3')];var _0x54ffc4=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59[_0xa9c5('0x54')])?util[_0xa9c5('0x58')]('SIP/%s/%s%s',_0x1c8e59['Trunk'][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x126')])?'':_0x1c8e59['dialPrefix']['trim']()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')]['phone'][_0xa9c5('0x128')](_0x1c8e59['dialCutDigit']):_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')]):util[_0xa9c5('0x58')](_0xa9c5('0x129'),_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x2a')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59['dialPrefix'])?'':_0x1c8e59[_0xa9c5('0x126')][_0xa9c5('0x12a')]()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')][_0xa9c5('0x128')](_0x1c8e59[_0xa9c5('0x127')]):_0x26c209['Contact'][_0xa9c5('0x101')]);var _0x3a25fd=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59['Trunk'])?ut['getCallerId'](_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')],_0x1c8e59['dialOriginateCallerIdName'],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut[_0xa9c5('0x12d')](_0x1c8e59['dialOriginateCallerIdNumber'],_0x1c8e59[_0xa9c5('0x12c')]):_0x1c8e59[_0xa9c5('0x36')]):ut[_0xa9c5('0x12e')](_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x12b')],_0x1c8e59[_0xa9c5('0x12f')],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut['getCallerIdRandom'](_0x1c8e59[_0xa9c5('0x36')],_0x1c8e59['dialRandomLastDigitCallerIdNumber']):_0x1c8e59[_0xa9c5('0x36')]);if(_0x3a25fd){_0x2c2671[_0xa9c5('0x130')]=ut[_0xa9c5('0x131')](_0x3a25fd);_0x2c2671[_0xa9c5('0x132')]=ut['extractCalleridNumber'](_0x3a25fd);}var _0x3058a6=ut[_0xa9c5('0x133')](_0x1c8e59,_0x26c209,_0x54ffc4,_0x3a25fd,_0x11621e,_0x2c2671);_[_0xa9c5('0x134')](_0x2c2671,ut[_0xa9c5('0x135')](_0x3058a6));_0x2c2671['starttime']=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));ami[_0xa9c5('0x78')](ut[_0xa9c5('0x136')](_0x2c2671,_0x1c8e59,_0x3058a6,_0x2c2671['activeContact'],_0x417181))[_0xa9c5('0x84')](function(_0x42dbd7){_0x1c8e59[_0xa9c5('0x4e')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0x137'),_0x11621e,_0xa9c5('0xb4'),_0x1c8e59[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x1c8e59[_0xa9c5('0x4e')]);_0x4382cf(_0x42dbd7);})[_0xa9c5('0x79')](function(_0x411ee7){ut[_0xa9c5('0xf8')](_0x2c2671,0xe,_0xa9c5('0x138'));rpcDb[_0xa9c5('0xf4')](_0x2c2671,_0xa9c5('0x139'));_0xdeb6e5(_0x411ee7);});});};Preview['prototype'][_0xa9c5('0x13a')]=function(_0x543b32){if(this['actions'][_0x543b32[_0xa9c5('0xaf')]]){this[_0xa9c5('0x15')][_0x543b32[_0xa9c5('0xaf')]][_0xa9c5('0x13b')]=_0x543b32[_0xa9c5('0x13b')];}};Preview['prototype'][_0xa9c5('0x19')]=function(_0x53b2f1){var _0x4dde67=this;var _0x130c9a=this[_0xa9c5('0x15')][_0x53b2f1[_0xa9c5('0x13c')]];if(_0x130c9a){if(_0x130c9a[_0xa9c5('0x13d')]&&this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]){ut[_0xa9c5('0x13e')](_0x130c9a,this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]][_0xa9c5('0x2a')],this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]['id']);}var _0x5d93d2=_[_0xa9c5('0x13f')](_0x130c9a);_0x5d93d2[_0xa9c5('0x140')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));var _0x20454c=_0x4dde67[_0xa9c5('0x12')][_0x130c9a[_0xa9c5('0x70')]];if(ut[_0xa9c5('0x141')](_0x53b2f1[_0xa9c5('0x142')])){if(_0x130c9a[_0xa9c5('0xc4')]){rpcDb['unlockContact'](_0x130c9a[_0xa9c5('0x143')]);}if(_0x130c9a['activeContact']){rpcDb[_0xa9c5('0x8c')](_0x130c9a[_0xa9c5('0x143')]);}ami[_0xa9c5('0x5e')](_0xa9c5('0x144'),ut[_0xa9c5('0xa4')](_0x130c9a,_0xa9c5('0x145'),this['campaignsPreview'][_0x130c9a[_0xa9c5('0x70')]]));this['callProgressDetectingAgent'](_0x5d93d2,_0x20454c,_0x53b2f1);}else{_0x130c9a[_0xa9c5('0x8d')]=moment()['format'](_0xa9c5('0x8e'));ut[_0xa9c5('0xf8')](_0x5d93d2,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0xf4')](_0x5d93d2,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x21fa3e){var _0x4d19fe=this;var _0x45fa29=this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]];var _0x40ddd5;if(_0x45fa29){_0x40ddd5=this['campaignsPreview'][_0x45fa29['queue']];logger['info'](_0xa9c5('0x146'),_0x21fa3e['linkedid'],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);}if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]&&_0x21fa3e['linkedid']!==_0x21fa3e[_0xa9c5('0xb3')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e['cause']);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}}else if(_0x45fa29&&_[_0xa9c5('0x6d')](_0x45fa29[_0xa9c5('0x14a')])&&_0x40ddd5[_0xa9c5('0x14b')]&&_0x21fa3e[_0xa9c5('0xaf')]===_0x21fa3e[_0xa9c5('0xb3')]&&_[_0xa9c5('0x6d')](_0x21fa3e[_0xa9c5('0xf3')])&&_0x21fa3e['cause']==='16'&&_0x21fa3e['channelstate']==='6'&&_['isUndefined'](_0x45fa29[_0xa9c5('0x14c')])){if(_0x45fa29['unlockAgent']){rpcDb[_0xa9c5('0x114')](_0x45fa29['idContact']);}if(_0x45fa29[_0xa9c5('0xae')]){rpcDb[_0xa9c5('0x8c')](_0x45fa29[_0xa9c5('0x143')]);}_0x21fa3e['reason']='22';this['callProgressDetectingAgent'](_0x45fa29,_0x40ddd5,_0x21fa3e);}else if(_0x45fa29&&_0x45fa29[_0xa9c5('0x14c')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger['info'](_0xa9c5('0x14d'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5['name'],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e[_0xa9c5('0x147')],'\x20Queue',_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e['cause']);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1f')]=function(_0x4db22d){if(this[_0xa9c5('0x15')][_0x4db22d[_0xa9c5('0xef')]]&&_0x4db22d[_0xa9c5('0xef')]!==_0x4db22d['destuniqueid']){this[_0xa9c5('0x148')](_0x4db22d,_0x4db22d['destlinkedid'],_0x4db22d[_0xa9c5('0xe4')]);}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1e')]=function(_0x1def15){if(this[_0xa9c5('0x15')][_0x1def15[_0xa9c5('0xaf')]]&&_0x1def15[_0xa9c5('0xaf')]!==_0x1def15['uniqueid']&&!this['actions'][_0x1def15[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){if(_0x1def15[_0xa9c5('0x147')]==='1'){this[_0xa9c5('0x148')](_0x1def15,_0x1def15['linkedid'],_0x1def15[_0xa9c5('0x147')]);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x14e')]=function(_0x90b498,_0x314f21,_0x4e1931){if(this[_0xa9c5('0x15')][_0x90b498]){if(_[_0xa9c5('0x6d')](this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')])){this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')]={};}this['actions'][_0x90b498]['variables'][_0x314f21]=_0x4e1931;}};Preview[_0xa9c5('0x68')][_0xa9c5('0x22')]=function(_0x7698d5){try{if(!_['isNil'](_0x7698d5)){if(ut['filterKey'](_[_0xa9c5('0x150')](_0x7698d5[_0xa9c5('0x151')])[0x0])){this[_0xa9c5('0x14e')](_0x7698d5[_0xa9c5('0xb3')],_['keys'](_0x7698d5[_0xa9c5('0x151')])[0x0],_0x7698d5['value']);}}}catch(_0xc1126c){logger[_0xa9c5('0x152')]('[syncVarSet][Preview]',util[_0xa9c5('0x153')](_0xc1126c,{'showHidden':![],'depth':null}));}};Preview[_0xa9c5('0x68')][_0xa9c5('0x24')]=function(_0x440f3d){if(_0x440f3d){if(this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]){this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]['transfer']=!![];}}};Preview['prototype'][_0xa9c5('0x26')]=function(_0x4be8cd){if(_0x4be8cd){if(this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]]){this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]][_0xa9c5('0x14c')]=!![];}}};module[_0xa9c5('0x155')]=Preview; \ No newline at end of file +var _0xb66c=['originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone','isFailure','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','exports','util','bluebird','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./action','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','outbound','name','strategy','answered','available','loggedIn','sumBillable','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','sendMessageOneNotActive','pTalking','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialMethod','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','contactId','UserId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','Agent','voicePause','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','run','pick','unlock','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','extractCalleridName'];(function(_0x50f164,_0x48b7f3){var _0x40f7f9=function(_0x4ffe88){while(--_0x4ffe88){_0x50f164['push'](_0x50f164['shift']());}};_0x40f7f9(++_0x48b7f3);}(_0xb66c,0x175));var _0xcb66=function(_0x4ad0a1,_0x357865){_0x4ad0a1=_0x4ad0a1-0x0;var _0x441a45=_0xb66c[_0x4ad0a1];return _0x441a45;};'use strict';var util=require(_0xcb66('0x0'));var _=require('lodash');var BPromise=require(_0xcb66('0x1'));var uuid=require('uuid');var moment=require(_0xcb66('0x2'));var md5=require(_0xcb66('0x3'));var Redis=require(_0xcb66('0x4'));var config=require('../../../config/environment');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var loggerAction=require(_0xcb66('0x5'))(_0xcb66('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xcb66('0x8'));var ut=require(_0xcb66('0x9'));config[_0xcb66('0xa')]=_[_0xcb66('0xb')](config[_0xcb66('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xcb66('0xc'))(new Redis(config[_0xcb66('0xa')]));var Sequence=function(){};Sequence[_0xcb66('0xd')][_0xcb66('0xe')]=function(_0x3c4ce1){this['tail']=this[_0xcb66('0xf')]?this[_0xcb66('0xf')][_0xcb66('0x10')](_0x3c4ce1):_0x3c4ce1();};function Preview(_0x38c2e6){this['sequence']=new Sequence();this[_0xcb66('0x11')]=_0x38c2e6[_0xcb66('0x12')];this[_0xcb66('0x13')]=_0x38c2e6[_0xcb66('0x13')];this['actions']={};this[_0xcb66('0x14')]=_0x38c2e6[_0xcb66('0x14')];this[_0xcb66('0x15')]=0x0;ami['on'](_0xcb66('0x16'),this['syncOriginateResponse'][_0xcb66('0x17')](this));ami['on']('hangup',this[_0xcb66('0x18')]['bind'](this));ami['on'](_0xcb66('0x19'),this['syncHangupRequest']['bind'](this));ami['on'](_0xcb66('0x1a'),this[_0xcb66('0x1b')][_0xcb66('0x17')](this));ami['on'](_0xcb66('0x1c'),this['syncNewExten'][_0xcb66('0x17')](this));ami['on'](_0xcb66('0x1d'),this[_0xcb66('0x1e')]['bind'](this));ami['on'](_0xcb66('0x1f'),this['syncAttendedTransfer'][_0xcb66('0x17')](this));ami['on'](_0xcb66('0x20'),this[_0xcb66('0x21')][_0xcb66('0x17')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x4d9690,_0xb39b87,_0x4b13d4){io['to'](_0x4d9690)['emit'](_0xb39b87,_0x4b13d4);}function emitCampaignPreview(_0x419540){if(_0x419540['type']===_0xcb66('0x22')){var _0x12e2bc={'id':_0x419540['id'],'name':_0x419540[_0xcb66('0x23')],'strategy':_0x419540[_0xcb66('0x24')],'answered':_0x419540[_0xcb66('0x25')],'available':_0x419540[_0xcb66('0x26')],'loggedIn':_0x419540[_0xcb66('0x27')],'pTalking':_0x419540['pTalking'],'sumBillable':_0x419540[_0xcb66('0x28')],'sumDuration':_0x419540['sumDuration'],'sumHoldTime':_0x419540['sumHoldTime']||0x0,'talking':_0x419540[_0xcb66('0x29')],'total':_0x419540[_0xcb66('0x2a')],'type':_0x419540[_0xcb66('0x2b')],'unmanaged':_0x419540['unmanaged'],'abandoned':_0x419540[_0xcb66('0x2c')],'waiting':_0x419540[_0xcb66('0x2d')],'loggedInDb':_0x419540[_0xcb66('0x2e')],'dialActive':_0x419540[_0xcb66('0x2f')],'dialMethod':_0x419540['dialMethod'],'dialOriginateCallerIdName':_0x419540[_0xcb66('0x30')],'dialOriginateCallerIdNumber':_0x419540[_0xcb66('0x31')],'dialOriginateTimeout':_0x419540[_0xcb66('0x32')],'dialPrefix':_0x419540[_0xcb66('0x33')],'outboundAnswerAgiCallsDay':_0x419540[_0xcb66('0x34')],'outboundAnswerCallsDay':_0x419540[_0xcb66('0x35')],'outboundBlacklistCallsDay':_0x419540[_0xcb66('0x36')],'outboundBusyCallsDay':_0x419540[_0xcb66('0x37')],'outboundCongestionCallsDay':_0x419540[_0xcb66('0x38')],'outboundDropCallsDayACS':_0x419540[_0xcb66('0x39')],'outboundDropCallsDayCallersExit':_0x419540['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x419540[_0xcb66('0x3a')],'outboundNoAnswerCallsDay':_0x419540['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x419540['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x419540['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x419540[_0xcb66('0x3b')],'outboundRejectCallsDay':_0x419540['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x419540[_0xcb66('0x3c')],'outboundAbandonedCallsDay':_0x419540[_0xcb66('0x3d')],'predictiveIntervalAnsweredCalls':_0x419540[_0xcb66('0x3e')],'predictiveIntervalAvgHoldtime':_0x419540['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x419540[_0xcb66('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x419540[_0xcb66('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x419540[_0xcb66('0x41')],'predictiveIntervalErlangCalls':_0x419540[_0xcb66('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x419540[_0xcb66('0x43')],'predictiveIntervalHitRate':_0x419540[_0xcb66('0x44')],'predictiveIntervalMultiplicativeFactor':_0x419540[_0xcb66('0x45')],'predictiveIntervalPauses':_0x419540[_0xcb66('0x46')],'predictiveIntervalAvailable':_0x419540[_0xcb66('0x47')],'predictiveIntervalTotalCalls':_0x419540[_0xcb66('0x48')],'message':_0x419540['message'],'originated':_0x419540[_0xcb66('0x49')],'erlangCalls':_0x419540[_0xcb66('0x4a')],'erlangCallToSecond':_0x419540[_0xcb66('0x4b')],'erlangAbandonmentRate':_0x419540[_0xcb66('0x4c')],'erlangBusyFactor':_0x419540[_0xcb66('0x4d')],'startPredictive':_0x419540[_0xcb66('0x4e')],'startProgressive':_0x419540[_0xcb66('0x4f')]};if(_0x419540['Trunk']){_0x12e2bc[_0xcb66('0x50')]={'id':_0x419540[_0xcb66('0x50')]['id'],'name':_0x419540[_0xcb66('0x50')][_0xcb66('0x23')],'active':_0x419540['Trunk'][_0xcb66('0x51')],'callerid':_0x419540[_0xcb66('0x50')][_0xcb66('0x52')]};}if(_0x419540[_0xcb66('0x53')]){_0x12e2bc[_0xcb66('0x53')]={'id':_0x419540[_0xcb66('0x53')]['id'],'name':_0x419540[_0xcb66('0x53')][_0xcb66('0x23')]};}var _0x3ae1cc=md5(JSON[_0xcb66('0x54')](_0x12e2bc));if(_0x419540[_0xcb66('0x3')]!==_0x3ae1cc){_0x419540[_0xcb66('0x3')]=_0x3ae1cc;emit(util['format']('voice:queue:%s',_0x12e2bc['name']),_0xcb66('0x55'),_0x12e2bc);}}}function emitVoiceQueueChannelRemove(_0x4182f9){logger[_0xcb66('0x56')](_0xcb66('0x57'),JSON[_0xcb66('0x54')](_0x4182f9));emit(util[_0xcb66('0x58')]('voice:queue:%s',_0x4182f9[_0xcb66('0x23')]),'voice_queue_channel:remove',_0x4182f9);io['emit']('voice_queue_presence:remove',_0x4182f9);}function notSendMessagesQueue(_0x411105){if(_0x411105[_0xcb66('0x59')]){if(_0x411105[_0xcb66('0x49')]===0x0&&_0x411105[_0xcb66('0x5a')]===0x0){_0x411105[_0xcb66('0x59')]=![];_0x411105[_0xcb66('0x26')]=0x0;_0x411105[_0xcb66('0x5b')]=0x0;_0x411105[_0xcb66('0x5c')]=_0xcb66('0x5d');ut['logger'](_0xcb66('0x5e'),_0x411105[_0xcb66('0x23')]+_0xcb66('0x5f'));}else{_0x411105['message']=_0xcb66('0x60');ut[_0xcb66('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x411105['name']+_0xcb66('0x62'));}emitCampaignPreview(_0x411105);}}Preview['prototype']['loopCampaigns']=function(){var _0x453ff2=this;setInterval(function(){_0x453ff2[_0xcb66('0x63')]();},0x7cf);};Preview[_0xcb66('0xd')][_0xcb66('0x63')]=function(){var _0x99229=this[_0xcb66('0x11')];this[_0xcb66('0x15')]+=0x1;for(var _0xff5ce5 in _0x99229){if(_0x99229[_0xcb66('0x64')](_0xff5ce5)&&(_0x99229[_0xff5ce5]['dialMethod']==='preview'||_0x99229[_0xff5ce5]['dialMethod']===_0xcb66('0x65'))&&_0x99229[_0xff5ce5]['type']===_0xcb66('0x22')){if(this['clockClearZombieChannels']>0x7){this[_0xcb66('0x15')]=0x0;this[_0xcb66('0x66')]();}}if(_0x99229[_0xcb66('0x64')](_0xff5ce5)&&_0x99229[_0xff5ce5][_0xcb66('0x67')]===_0xcb66('0x6')&&_0x99229[_0xff5ce5][_0xcb66('0x2b')]==='outbound'){if(_0x99229[_0xff5ce5]['dialActive']){this[_0xcb66('0x68')](_0x99229[_0xff5ce5]);if(_0x99229[_0xff5ce5][_0xcb66('0x69')])this[_0xcb66('0x6a')](_0x99229[_0xff5ce5]);}else{notSendMessagesQueue(_0x99229[_0xff5ce5]);}}}};Preview[_0xcb66('0xd')][_0xcb66('0x6b')]=function(_0x1c149b){var _0x1465df=this;this[_0xcb66('0x6c')][_0xcb66('0xe')](function(){if(!_['isNil'](_0x1465df[_0xcb66('0x6d')][_0x1c149b])){loggerAction[_0xcb66('0x56')](_0xcb66('0x6e'),_0x1c149b,_0xcb66('0x6f'),_0x1465df['actions'][_0x1c149b][_0xcb66('0x70')],_0xcb66('0x71'),JSON[_0xcb66('0x54')](_0x1465df['campaignsPreview'][_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]][_0xcb66('0x49')]),_0xcb66('0x72'),JSON['stringify'](_0x1465df[_0xcb66('0x11')][_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]]['pTalking']),JSON['stringify'](_0x1465df[_0xcb66('0x6d')][_0x1c149b]['dialAnswer']),JSON[_0xcb66('0x54')](_['pick'](_0x1465df[_0xcb66('0x6d')][_0x1c149b],[_0xcb66('0x73'),_0xcb66('0x74'),'VoiceQueueId',_0xcb66('0x75')])));return ami['Action']({'action':_0xcb66('0x76'),'channel':_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x77')]})[_0xcb66('0x78')](function(_0x184265){if(_0x184265['message']===_0xcb66('0x79')){setTimeout(function(){if(_0x1465df['actions'][_0x1c149b]){ut[_0xcb66('0x7a')](_0x1465df[_0xcb66('0x11')][_0x1465df[_0xcb66('0x6d')][_0x1c149b]['queue']],'[clearZombieChannel]');if(_0x1465df['actions'][_0x1c149b][_0xcb66('0x7b')]===!![]){ut[_0xcb66('0x7c')](_0x1465df[_0xcb66('0x11')][_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]],_0xcb66('0x7d'));ut[_0xcb66('0x7e')](_0xcb66('0x7f')+_0x1c149b,_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]);}ut['loggerError'](_0xcb66('0x80')+_0x1c149b,_0x1465df[_0xcb66('0x6d')][_0x1c149b][_0xcb66('0x70')]);delete _0x1465df[_0xcb66('0x6d')][_0x1c149b];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3b2e05=this;loggerAction[_0xcb66('0x56')](_0xcb66('0x81'),_[_0xcb66('0x82')](this[_0xcb66('0x6d')]));for(var _0x34b42f in this['actions']){if(_0x3b2e05[_0xcb66('0x6d')][_0xcb66('0x64')](_0x34b42f)){_0x3b2e05[_0xcb66('0x6b')](_0x34b42f);}}};Preview[_0xcb66('0xd')]['recallMe']=function(_0x454493){var _0x481c39=this;rpcDb[_0xcb66('0x83')](_0x454493['id'],ut['agentReadyId'](this[_0xcb66('0x14')]))[_0xcb66('0x84')](function(_0x146a06){if(!_['isNil'](_0x146a06)){for(var _0x54e6c2=0x0;_0x54e6c2<_0x146a06[_0xcb66('0x85')];_0x54e6c2+=0x1){if(ut[_0xcb66('0x86')](_0x146a06[_0x54e6c2]['scheduledat'])<_0x454493['dialRecallMeTimeout']*0x3c){if(_0x146a06[_0x54e6c2][_0xcb66('0x87')]&&!_0x146a06[_0x54e6c2]['Agent'][_0xcb66('0x88')]){_0x481c39['run'](_0x146a06[_0x54e6c2]['id'])[_0xcb66('0x84')](ut[_0xcb66('0x89')](_0xcb66('0x8a')))['catch'](ut[_0xcb66('0x89')](_0xcb66('0x8a')));}else{rpcDb['disableContact'](_0x146a06[_0x54e6c2]['id']);}}else{var _0x244003=new Action(_0x146a06[_0x54e6c2],_0x454493);_0x244003[_0xcb66('0x8b')]=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));_0x454493[_0xcb66('0x3b')]+=0x1;ut[_0xcb66('0x8d')](_0x244003,0x17,'RecallInQueue');if(_0x454493[_0xcb66('0x8e')]){rpcDb[_0xcb66('0x8f')](ut[_0xcb66('0x90')](_0x146a06[_0x54e6c2]));rpcDb[_0xcb66('0x91')](_0x244003,_0xcb66('0x92'));}else{ut[_0xcb66('0x8d')](_0x244003,0x16,_0xcb66('0x93'));rpcDb[_0xcb66('0x91')](_0x244003,_0xcb66('0x94'));rpcDb['createCustomerFinal'](_0x244003,_0xcb66('0x94'));}}}}})[_0xcb66('0x78')](ut[_0xcb66('0x89')](_0xcb66('0x95')));};Preview[_0xcb66('0xd')][_0xcb66('0x68')]=function(_0x52e27d){_0x52e27d[_0xcb66('0x59')]=!![];if(ut[_0xcb66('0x96')](_0x52e27d['loggedIn'])){_0x52e27d[_0xcb66('0x5c')]=_0xcb66('0x97');}else if(!ut[_0xcb66('0x98')](_0x52e27d[_0xcb66('0x2f')])){_0x52e27d['message']=_0xcb66('0x5d');}else if(!this[_0xcb66('0x99')](_0x52e27d[_0xcb66('0x50')])){if(!this[_0xcb66('0x99')](_0x52e27d[_0xcb66('0x9a')])){_0x52e27d[_0xcb66('0x5c')]=_0xcb66('0x9b');}else{_0x52e27d[_0xcb66('0x5c')]=_0xcb66('0x9c');}}else{_0x52e27d[_0xcb66('0x5c')]='ACTIVE';}emitCampaignPreview(_0x52e27d);};Preview[_0xcb66('0xd')][_0xcb66('0x9d')]=function(_0x311a98,_0x2b8aca,_0x4f0462){var _0x3c4776=this;var _0x26c43c=this[_0xcb66('0x6d')][_0x2b8aca];var _0x1c0533=this[_0xcb66('0x11')][_0x26c43c[_0xcb66('0x70')]];var _0x185363;if(_0x1c0533){switch(_0x4f0462){case'1':_0x1c0533['outboundNoSuchCallsDay']+=0x1;_0x26c43c['countnosuchnumberretry']+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x0,_0xcb66('0xa0'));ami[_0xcb66('0xa1')](_0xcb66('0xa2'),ut['buildObj'](_0x26c43c,_0xcb66('0xa3')));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xa4'));if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0xf,'Global');rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xa8'));}else{if(_0x26c43c[_0xcb66('0xa9')]>=_0x1c0533[_0xcb66('0xaa')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xa8'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,_0xcb66('0xa9'),_0x1c0533[_0xcb66('0xad')]),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];break;case _0xcb66('0xb1'):var _0x39e86a=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));_0x26c43c[_0xcb66('0xb2')]=_0x39e86a;_0x26c43c['answertime']=_0x39e86a;_0x26c43c[_0xcb66('0x7b')]=!![];_0x1c0533['pTalking']+=0x1;logger[_0xcb66('0x56')]('[syncHangup][talking][increment]',_0x26c43c[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x1c0533[_0xcb66('0x23')],_0xcb66('0x72'),_0x1c0533[_0xcb66('0x5a')]);ami[_0xcb66('0xa1')](_0xcb66('0xb5'),ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xb7'),this[_0xcb66('0x11')][_0x26c43c[_0xcb66('0x70')]]));if(_0x1c0533[_0xcb66('0xb8')]){ami[_0xcb66('0xa1')]('custom:agentConnectPreview',ut[_0xcb66('0xb9')](_0x26c43c));}break;case'16':ami[_0xcb66('0xa1')](_0xcb66('0xba'),ut['buildObj'](_0x26c43c,_0xcb66('0xbb'),this[_0xcb66('0x11')][_0x26c43c[_0xcb66('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x26c43c,_0xcb66('0xbb')));_0x1c0533[_0xcb66('0x35')]+=0x1;_0x1c0533[_0xcb66('0x2a')]+=0x1;_0x1c0533[_0xcb66('0x25')]+=0x1;ut[_0xcb66('0x7c')](_0x1c0533,_0xcb66('0xbc'));_0x26c43c['countglobal']=ut[_0xcb66('0x9f')](_0x26c43c);ut['logCustomer'](_0x26c43c,0x4,_0xcb66('0xbd'));rpcDb['createCustomerHistory'](_0x26c43c,_0xcb66('0xbe'));rpcDb['createCustomerFinal'](_0x26c43c,_0xcb66('0xbf'));rpcDb[_0xcb66('0xc0')](_0x26c43c);_0x1c0533[_0xcb66('0xc1')]+=_0x26c43c['talktime'];_0x1c0533[_0xcb66('0x28')]+=_0x26c43c['talktime'];logger[_0xcb66('0x56')](_0xcb66('0xc2'),_0x26c43c[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x1c0533[_0xcb66('0x23')],'pTalking:\x20',_0x1c0533[_0xcb66('0x5a')]);delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];break;case _0xcb66('0xc3'):_0x1c0533['outboundBusyCallsDay']+=0x1;_0x26c43c[_0xcb66('0xc4')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut['totalGlobal'](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x5,_0xcb66('0xc5'));ami[_0xcb66('0xa1')](_0xcb66('0xc6'),ut['buildObj'](_0x26c43c,_0xcb66('0xc7')));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xc8'));if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xca'));}else{if(_0x26c43c[_0xcb66('0xc4')]>=_0x1c0533[_0xcb66('0xcb')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xc8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x26c43c,'countbusyretry',_0x1c0533[_0xcb66('0xcc')]),_0x26c43c[_0xcb66('0xae')],_0x26c43c['activeContact']);}}break;case _0xcb66('0xcd'):_0x1c0533['outboundNoAnswerCallsDay']+=0x1;_0x26c43c[_0xcb66('0xce')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x3,'NoAnswer');ami[_0xcb66('0xa1')](_0xcb66('0xcf'),ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xd0')));rpcDb[_0xcb66('0x91')](_0x26c43c,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xd1'));}else{if(_0x26c43c[_0xcb66('0xce')]>=_0x1c0533[_0xcb66('0xd2')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xcb66('0xab')](ut['scheduledAt'](_0x26c43c,_0xcb66('0xce'),_0x1c0533[_0xcb66('0xd3')]),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}break;case _0xcb66('0xd4'):_0x1c0533[_0xcb66('0x38')]+=0x1;_0x26c43c['countcongestionretry']+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x8,_0xcb66('0xd5'));ami[_0xcb66('0xa1')](_0xcb66('0xd6'),ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xd7')));rpcDb['createCustomerHistory'](_0x26c43c,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x26c43c[_0xcb66('0xd8')]>=_0x1c0533['dialCongestionMaxRetry']){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xd9'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,_0xcb66('0xd8'),_0x1c0533['dialBusyRetryFrequency']),_0x26c43c['unlockAgent'],_0x26c43c[_0xcb66('0xaf')]);}}break;case _0xcb66('0xda'):_0x1c0533[_0xcb66('0xdb')]+=0x1;_0x26c43c[_0xcb66('0xdc')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut['totalGlobal'](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x14,'AgentReject');ami['emit'](_0xcb66('0xdd'),ut['buildObj'](_0x26c43c,'agentreject'));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xde'));if(ut['totalGlobal'](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0x14,_0xcb66('0xdf'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xe0'));}else{if(_0x26c43c[_0xcb66('0xdc')]>=_0x1c0533[_0xcb66('0xe1')]){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xe0'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,'countagentrejectretry',_0x1c0533['dialAgentRejectRetryFrequency']),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}break;case _0xcb66('0xe2'):_0x1c0533[_0xcb66('0x3d')]+=0x1;_0x26c43c[_0xcb66('0xe3')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut['logCustomer'](_0x26c43c,0xb,_0xcb66('0xe4'));rpcDb['createCustomerHistory'](_0x26c43c,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb['createCustomerFinal'](_0x185363,_0xcb66('0xe5'));}else{if(_0x26c43c['countabandonedetry']>=_0x1c0533['dialAbandonedMaxRety']){rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xe5'));}else{rpcDb[_0xcb66('0xab')](ut[_0xcb66('0xac')](_0x26c43c,_0xcb66('0xe3'),_0x1c0533['dialAbandonedRetryFrequency']),_0x26c43c[_0xcb66('0xae')],_0x26c43c[_0xcb66('0xaf')]);}}break;case'18':_0x1c0533[_0xcb66('0x3c')]+=0x1;_0x26c43c[_0xcb66('0xe6')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x12,_0x311a98['cause-txt']||_0x311a98[_0xcb66('0xe7')]);ami[_0xcb66('0xa1')](_0xcb66('0xe8'),ut['buildObj'](_0x26c43c,_0xcb66('0xe9')));rpcDb[_0xcb66('0x91')](_0x26c43c,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut[_0xcb66('0xa6')](_0x26c43c,0xf,'Global');rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xea'));}else{rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xea'));}delete this[_0xcb66('0x6d')][_0x311a98['linkedid']];break;case'19':_0x1c0533[_0xcb66('0x3c')]+=0x1;_0x26c43c[_0xcb66('0x9e')]=ut[_0xcb66('0x9f')](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0x13,_0x311a98[_0xcb66('0xeb')]||_0x311a98[_0xcb66('0xe7')]);ami['emit']('custom:amd',ut[_0xcb66('0xb6')](_0x26c43c,_0xcb66('0xe9')));rpcDb[_0xcb66('0x91')](_0x26c43c,_0xcb66('0xec'));if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533[_0xcb66('0xa5')]){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb[_0xcb66('0xa7')](_0x185363,_0xcb66('0xec'));}else{rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xec'));}delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];break;default:if(_0x26c43c['dialAnswer']){ut[_0xcb66('0x7c')](_0x1c0533,_0xcb66('0xed'));ut[_0xcb66('0x7e')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1c0533[_0xcb66('0x23')],_0x311a98);}_0x1c0533[_0xcb66('0x3c')]+=0x1;_0x26c43c['countglobal']=ut['totalGlobal'](_0x26c43c);ut[_0xcb66('0x8d')](_0x26c43c,0xc,_0x311a98[_0xcb66('0xeb')]||_0x311a98[_0xcb66('0xe7')]);rpcDb['createCustomerHistory'](_0x26c43c,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xcb66('0x9f')](_0x26c43c)>=_0x1c0533['dialGlobalMaxRetry']){_0x185363=ut['cloneAction'](_0x26c43c,0xf,_0xcb66('0xc9'));rpcDb['createCustomerFinal'](_0x185363,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xcb66('0xa7')](_0x26c43c,_0xcb66('0xee'));}delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];}if(!(_0x26c43c[_0xcb66('0x7b')]&&_0x4f0462==='16')){ut[_0xcb66('0x7a')](_0x1c0533,_0xcb66('0xef'));logger[_0xcb66('0x56')]('[originated][decrement][callProgressDetectingCustomer]',_0x26c43c[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x1c0533[_0xcb66('0x23')],_0xcb66('0x71'),_0x1c0533[_0xcb66('0x49')]);}if(_0x4f0462!==_0xcb66('0xb1')){delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xb0')]];delete this[_0xcb66('0x6d')][_0x311a98[_0xcb66('0xf0')]];}}};Preview[_0xcb66('0xd')][_0xcb66('0xf1')]=function(_0x5ac4ee,_0x2d9cdd,_0x78a272){if(_[_0xcb66('0xf2')](_0x2d9cdd)&&_0xcb66('0xf3')!==typeof _0x2d9cdd){return;}if(_[_0xcb66('0xf2')](_0x78a272)&&_0xcb66('0xf3')!==typeof _0x78a272){return;}switch(_0x78a272['reason']){case'0':ut['logAgent'](_0x5ac4ee,0x0,'NoSuchNumber');rpcDb[_0xcb66('0xf4')](_0x5ac4ee,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x5ac4ee,0x3,_0xcb66('0xf5'));rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xf6'));break;case'5':ut[_0xcb66('0xf7')](_0x5ac4ee,0x5,_0xcb66('0xc5'));rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xf8'));break;case'8':ut[_0xcb66('0xf7')](_0x5ac4ee,0x8,'Congestion');rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xf9'));break;case'22':ut[_0xcb66('0xf7')](_0x5ac4ee,0x16,_0xcb66('0xfa'));rpcDb[_0xcb66('0xf4')](_0x5ac4ee,_0xcb66('0xfb'));break;default:ut[_0xcb66('0xf7')](_0x5ac4ee,0xc,_0x78a272[_0xcb66('0xfc')]);rpcDb['createAgentHistory'](_0x5ac4ee,_0xcb66('0xf9'));}ut[_0xcb66('0x7a')](_0x2d9cdd,_0xcb66('0xfd'));logger[_0xcb66('0x56')](_0xcb66('0xfe'),_0x5ac4ee[_0xcb66('0xb3')],_0xcb66('0xb4'),_0x2d9cdd[_0xcb66('0x23')],_0xcb66('0x71'),_0x2d9cdd['originated']);delete this[_0xcb66('0x6d')][_0x5ac4ee[_0xcb66('0xb3')]];};Preview['prototype'][_0xcb66('0xff')]=function(_0x42b292,_0x1954f7,_0x40ab09,_0x225a8a,_0x6770b4){var _0x329344=this;return new BPromise(function(_0x578cf7,_0x17263c){if(_['isNil'](_0x1954f7)||_['isNil'](_0x1954f7['Contact'])||_[_0xcb66('0x100')](_0x1954f7[_0xcb66('0x101')][_0xcb66('0x102')])||_[_0xcb66('0x100')](_0x1954f7[_0xcb66('0x103')])){_0x17263c(ut[_0xcb66('0x5c')](_0xcb66('0x104'),_0x225a8a,_0x6770b4));return;}var _0x53e8f5=uuid['v4']();var _0x25b646=_0x329344[_0xcb66('0x11')][_0x1954f7[_0xcb66('0x6f')][_0xcb66('0x23')]];var _0x55120d=_0x40ab09?_0x329344[_0xcb66('0x14')][_0x40ab09]['id']:undefined;_0x329344['actions'][_0x53e8f5]=new Action(_0x1954f7,_0x25b646,_0x53e8f5,_0x40ab09,_0x55120d);var _0x5e4f31=_0x329344[_0xcb66('0x6d')][_0x53e8f5];_0x5e4f31[_0xcb66('0xae')]=_0x225a8a;_0x5e4f31['activeContact']=_0x6770b4;_0x5e4f31[_0xcb66('0x105')]=_0x40ab09;if(_[_0xcb66('0x106')](_0x42b292)){_0x329344[_0xcb66('0x107')](_0x5e4f31,_0x25b646,_0x1954f7,_0x40ab09)[_0xcb66('0x84')](function(_0x512f4e){logger[_0xcb66('0x56')](_0xcb66('0x108'),_0xcb66('0x109')+_0x5e4f31[_0xcb66('0x70')]+'\x20IdHopper:\x20'+_0x5e4f31[_0xcb66('0x10a')],JSON['stringify'](_0x512f4e));ami[_0xcb66('0xa1')](_0xcb66('0x10b'),ut['buildObj'](_0x5e4f31,'called',_0x329344['campaignsPreview'][_0x5e4f31[_0xcb66('0x70')]]));_0x578cf7(ut[_0xcb66('0x5c')]('Calling'));})[_0xcb66('0x78')](function(_0x2b8f94){ut['logger'](_0xcb66('0x10c'),_0x2b8f94);_0x17263c(ut[_0xcb66('0x5c')](_0xcb66('0x10d'),_0x225a8a,_0x6770b4));});}else{_0x25b646[_0xcb66('0x36')]+=0x1;ut[_0xcb66('0x10e')](_0x5e4f31);rpcDb[_0xcb66('0x10f')](_0x5e4f31,_0xcb66('0x110'));delete _0x329344[_0xcb66('0x6d')][_0x53e8f5];_0x17263c(ut['message'](_0xcb66('0x111'),_0x225a8a,_0x6770b4));}});};Preview[_0xcb66('0xd')][_0xcb66('0x99')]=function(_0x22ed1d){return!_[_0xcb66('0x100')](_0x22ed1d)&&!_[_0xcb66('0x100')](_0x22ed1d[_0xcb66('0x23')])&&!_['isNil'](_0x22ed1d[_0xcb66('0x51')])&&_0x22ed1d[_0xcb66('0x51')]&&!_[_0xcb66('0x100')](this[_0xcb66('0x13')][util['format']('SIP/%s',_0x22ed1d[_0xcb66('0x23')])])&&!_[_0xcb66('0x100')](this[_0xcb66('0x13')][util[_0xcb66('0x58')](_0xcb66('0x112'),_0x22ed1d[_0xcb66('0x23')])][_0xcb66('0x76')])&&(this[_0xcb66('0x13')][util[_0xcb66('0x58')](_0xcb66('0x112'),_0x22ed1d[_0xcb66('0x23')])][_0xcb66('0x76')]==='reachable'||this['trunks'][util['format'](_0xcb66('0x112'),_0x22ed1d[_0xcb66('0x23')])][_0xcb66('0x76')]==='unmonitored');};Preview[_0xcb66('0xd')][_0xcb66('0x113')]=function(_0x253ef9,_0x96f837){var _0x5686b5=this;return new BPromise(function(_0x5e82a8,_0x1d15ef){_0x5686b5['execRun'](_0x253ef9,_0x96f837)[_0xcb66('0x84')](function(_0x35f822){_0x5e82a8(_[_0xcb66('0x114')](_0x35f822,[_0xcb66('0x5c')]));})[_0xcb66('0x78')](function(_0x2a3e95){if(_0x2a3e95[_0xcb66('0x115')]){rpcDb['unlockContact'](_0x253ef9);}if(_0x2a3e95[_0xcb66('0x51')]){rpcDb[_0xcb66('0x116')](_0x253ef9);}_0x1d15ef(_[_0xcb66('0x114')](_0x2a3e95,[_0xcb66('0x5c')]));});});};Preview['prototype'][_0xcb66('0x117')]=function(_0x5084d7,_0x623fa){var _0x1a9cd1=this;return new BPromise(function(_0x141290,_0x4a0094){var _0x28a8ee,_0x290002;rpcDb[_0xcb66('0x118')](_0x5084d7)[_0xcb66('0x84')](function(_0x39a248){if(!_['isNil'](_0x39a248[0x0])){_0x290002=_0x39a248[0x0][_0xcb66('0x119')]?![]:!![];_0x28a8ee=_0x39a248[0x0][_0xcb66('0x119')]?!![]:![];_0x28a8ee=_0x623fa?!![]:_0x28a8ee;}var _0xa76581=_0x1a9cd1[_0xcb66('0x11a')](_0x39a248);if(_0xa76581[_0xcb66('0x11b')]){rpcDb[_0xcb66('0x11c')](_['pick'](_0x39a248[0x0],[_0xcb66('0x103'),_0xcb66('0x11d')]))['then'](function(_0x1c12d6){_0x1a9cd1[_0xcb66('0xff')](_0x1c12d6,_0x39a248[0x0],_0x623fa,_0x290002,_0x28a8ee)[_0xcb66('0x84')](function(_0x4a1995){_0x141290(_0x4a1995);})['catch'](function(_0x7a6acf){_0x4a0094(_0x7a6acf);});})[_0xcb66('0x78')](function(_0x4a7491){ut[_0xcb66('0x61')](_0xcb66('0x11e'),_0x4a7491);_0x4a0094(ut['message'](_0xcb66('0x11f'),_0x290002,_0x28a8ee));});}else{_0x4a0094(ut[_0xcb66('0x5c')](_0xa76581['message'],_0x290002,_0x28a8ee));}})[_0xcb66('0x78')](function(_0x2babe3){ut['logger'](_0xcb66('0x120'),_0x2babe3);_0x4a0094(ut['message'](_0xcb66('0x11f'),![],!![]));});});};Preview[_0xcb66('0xd')][_0xcb66('0x11a')]=function(_0x46eb02){if(_['isNil'](_0x46eb02)||_[_0xcb66('0x106')](_0x46eb02)||!_['isNil'](_0x46eb02[0x0][_0xcb66('0x87')])&&_[_0xcb66('0x100')](_0x46eb02[0x0]['Agent'][_0xcb66('0x23')])){ut[_0xcb66('0x61')](_0xcb66('0x121'),_0x46eb02);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x29efd9=this[_0xcb66('0x11')][_0x46eb02[0x0]['Queue'][_0xcb66('0x23')]];_0x29efd9[_0xcb66('0x5c')]=_0xcb66('0x9c');if(_['isNil'](_0x29efd9)){ut[_0xcb66('0x61')](_0xcb66('0x122'),_0x29efd9);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xcb66('0x99')](_0x29efd9[_0xcb66('0x50')])){ut[_0xcb66('0x61')](_0xcb66('0x123'),_0xcb66('0x124')+_0x29efd9[_0xcb66('0x23')]+_0xcb66('0x125'));if(!this[_0xcb66('0x99')](_0x29efd9[_0xcb66('0x9a')])){ut[_0xcb66('0x61')](_0xcb66('0x123'),_0x29efd9[_0xcb66('0x23')]+_0xcb66('0x126'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xcb66('0x98')](_0x29efd9[_0xcb66('0x2f')])){ut[_0xcb66('0x61')]('[Preview][validateContact][Campaign\x20Active]',_0x29efd9[_0xcb66('0x23')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xcb66('0x124')+_0x29efd9[_0xcb66('0x23')]+_0xcb66('0x127')};}return{'isValid':!![],'message':_0xcb66('0x128')};};Preview[_0xcb66('0xd')][_0xcb66('0x107')]=function(_0x1357f7,_0x6d601,_0x1dea5a,_0x2c4960){var _0x5d738b=this;return new BPromise(function(_0x472797,_0x4f447d){var _0x51807d=_0x1357f7[_0xcb66('0xb3')];var _0x46bccf=_0x5d738b[_0xcb66('0x99')](_0x6d601[_0xcb66('0x50')])?util[_0xcb66('0x58')](_0xcb66('0x129'),_0x6d601[_0xcb66('0x50')]['name'],_[_0xcb66('0x100')](_0x6d601[_0xcb66('0x33')])?'':_0x6d601[_0xcb66('0x33')][_0xcb66('0x12a')]()||'',_0x6d601[_0xcb66('0x12b')]>0x0?_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')][_0xcb66('0x12c')](_0x6d601['dialCutDigit']):_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')]):util[_0xcb66('0x58')](_0xcb66('0x129'),_['isNil'](_0x6d601[_0xcb66('0x9a')])?_0x6d601['Trunk'][_0xcb66('0x23')]:_0x6d601[_0xcb66('0x9a')]['name'],_[_0xcb66('0x100')](_0x6d601[_0xcb66('0x33')])?'':_0x6d601[_0xcb66('0x33')][_0xcb66('0x12a')]()||'',_0x6d601[_0xcb66('0x12b')]>0x0?_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')][_0xcb66('0x12c')](_0x6d601[_0xcb66('0x12b')]):_0x1dea5a[_0xcb66('0x101')][_0xcb66('0x102')]);var _0x5cc688=_0x5d738b[_0xcb66('0x99')](_0x6d601[_0xcb66('0x50')])?ut['getCallerId'](_0x6d601[_0xcb66('0x50')][_0xcb66('0x52')],_0x6d601[_0xcb66('0x30')],_0x6d601[_0xcb66('0x12d')]>0x0?ut[_0xcb66('0x12e')](_0x6d601[_0xcb66('0x31')],_0x6d601['dialRandomLastDigitCallerIdNumber']):_0x6d601['dialOriginateCallerIdNumber']):ut[_0xcb66('0x12f')](_[_0xcb66('0x100')](_0x6d601[_0xcb66('0x9a')])?_0x6d601[_0xcb66('0x50')][_0xcb66('0x52')]:_0x6d601[_0xcb66('0x9a')][_0xcb66('0x52')],_0x6d601[_0xcb66('0x30')],_0x6d601[_0xcb66('0x12d')]>0x0?ut[_0xcb66('0x12e')](_0x6d601[_0xcb66('0x31')],_0x6d601[_0xcb66('0x12d')]):_0x6d601[_0xcb66('0x31')]);if(_0x5cc688){_0x1357f7['originatecalleridname']=ut[_0xcb66('0x130')](_0x5cc688);_0x1357f7[_0xcb66('0x131')]=ut[_0xcb66('0x132')](_0x5cc688);}var _0x20efe7=ut[_0xcb66('0x133')](_0x6d601,_0x1dea5a,_0x46bccf,_0x5cc688,_0x51807d,_0x1357f7);_[_0xcb66('0x134')](_0x1357f7,ut[_0xcb66('0x135')](_0x20efe7));_0x1357f7[_0xcb66('0x8b')]=moment()[_0xcb66('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xcb66('0x136')](ut[_0xcb66('0x137')](_0x1357f7,_0x6d601,_0x20efe7,_0x1357f7[_0xcb66('0xaf')],_0x2c4960))[_0xcb66('0x84')](function(_0xec4512){_0x6d601['originated']+=0x1;logger[_0xcb66('0x56')](_0xcb66('0x138'),_0x51807d,_0xcb66('0xb4'),_0x6d601['name'],_0xcb66('0x71'),_0x6d601[_0xcb66('0x49')]);_0x472797(_0xec4512);})['catch'](function(_0x3951bd){ut['logAgent'](_0x1357f7,0xe,_0xcb66('0x139'));rpcDb[_0xcb66('0xf4')](_0x1357f7,'[originateFailure][logOriginateFailure]');_0x4f447d(_0x3951bd);});});};Preview[_0xcb66('0xd')]['syncNewExten']=function(_0x223c9b){if(this[_0xcb66('0x6d')][_0x223c9b[_0xcb66('0xb0')]]){this[_0xcb66('0x6d')][_0x223c9b[_0xcb66('0xb0')]][_0xcb66('0x77')]=_0x223c9b[_0xcb66('0x77')];}};Preview['prototype']['syncOriginateResponse']=function(_0x449bb6){var _0x51d3d0=this;var _0x57a338=this[_0xcb66('0x6d')][_0x449bb6[_0xcb66('0x13a')]];if(_0x57a338){if(_0x57a338[_0xcb66('0x105')]&&this[_0xcb66('0x14')][_0x57a338['lookAgent']]){ut[_0xcb66('0x13b')](_0x57a338,this[_0xcb66('0x14')][_0x57a338[_0xcb66('0x105')]][_0xcb66('0x23')],this['agents'][_0x57a338[_0xcb66('0x105')]]['id']);}var _0x2eb5ad=_[_0xcb66('0x13c')](_0x57a338);_0x2eb5ad['responsetime']=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));var _0x13f127=_0x51d3d0[_0xcb66('0x11')][_0x57a338[_0xcb66('0x70')]];if(ut[_0xcb66('0x13d')](_0x449bb6['response'])){if(_0x57a338[_0xcb66('0xae')]){rpcDb[_0xcb66('0x13e')](_0x57a338[_0xcb66('0x10a')]);}if(_0x57a338[_0xcb66('0xaf')]){rpcDb[_0xcb66('0x116')](_0x57a338[_0xcb66('0x10a')]);}ami[_0xcb66('0xa1')](_0xcb66('0x13f'),ut['buildObj'](_0x57a338,'rejected',this[_0xcb66('0x11')][_0x57a338[_0xcb66('0x70')]]));this['callProgressDetectingAgent'](_0x2eb5ad,_0x13f127,_0x449bb6);}else{_0x57a338[_0xcb66('0x8b')]=moment()[_0xcb66('0x58')](_0xcb66('0x8c'));ut['logAgent'](_0x2eb5ad,0x4,'Answer');rpcDb[_0xcb66('0xf4')](_0x2eb5ad,_0xcb66('0x140'));}}};Preview[_0xcb66('0xd')][_0xcb66('0x18')]=function(_0x5917a5){var _0x48d3c4=this;var _0x56c6a8=this[_0xcb66('0x6d')][_0x5917a5[_0xcb66('0xb0')]];var _0x179b50;if(_0x56c6a8){_0x179b50=this[_0xcb66('0x11')][_0x56c6a8[_0xcb66('0x70')]];logger[_0xcb66('0x56')](_0xcb66('0x141'),_0x5917a5[_0xcb66('0xb0')],'\x20Queue',_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50['pTalking']);}if(this[_0xcb66('0x6d')][_0x5917a5['linkedid']]&&_0x5917a5[_0xcb66('0xb0')]!==_0x5917a5[_0xcb66('0xb3')]){if(_0x5917a5[_0xcb66('0x142')]==='16'&&this[_0xcb66('0x6d')][_0x5917a5[_0xcb66('0xb0')]]['dialAnswer']){this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5[_0xcb66('0xb0')],_0x5917a5[_0xcb66('0x142')]);}else if(this[_0xcb66('0x6d')][_0x5917a5['linkedid']][_0xcb66('0x7b')]){logger[_0xcb66('0x56')](_0xcb66('0x143'),_0x5917a5[_0xcb66('0xb0')],_0x5917a5['cause'],_0xcb66('0xb4'),_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50[_0xcb66('0x5a')]);this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5[_0xcb66('0xb0')],_0x5917a5['cause']);}}else if(_0x56c6a8&&_[_0xcb66('0x100')](_0x56c6a8['statedesc'])&&_0x179b50[_0xcb66('0x144')]&&_0x5917a5[_0xcb66('0xb0')]===_0x5917a5[_0xcb66('0xb3')]&&_[_0xcb66('0x100')](_0x5917a5[_0xcb66('0xfc')])&&_0x5917a5[_0xcb66('0x142')]==='16'&&_0x5917a5[_0xcb66('0x145')]==='6'&&_[_0xcb66('0xf2')](_0x56c6a8[_0xcb66('0x146')])){if(_0x56c6a8[_0xcb66('0xae')]){rpcDb[_0xcb66('0x13e')](_0x56c6a8[_0xcb66('0x10a')]);}if(_0x56c6a8[_0xcb66('0xaf')]){rpcDb[_0xcb66('0x116')](_0x56c6a8[_0xcb66('0x10a')]);}_0x5917a5['reason']='22';this['callProgressDetectingAgent'](_0x56c6a8,_0x179b50,_0x5917a5);}else if(_0x56c6a8&&_0x56c6a8['transfer']){if(_0x5917a5[_0xcb66('0x142')]==='16'&&this['actions'][_0x5917a5[_0xcb66('0xb0')]][_0xcb66('0x7b')]){logger[_0xcb66('0x56')](_0xcb66('0x147'),_0x5917a5[_0xcb66('0xb0')],_0x5917a5[_0xcb66('0x142')],'\x20Queue',_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50['pTalking']);this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5['linkedid'],_0x5917a5['cause']);}else if(this['actions'][_0x5917a5[_0xcb66('0xb0')]][_0xcb66('0x7b')]){logger[_0xcb66('0x56')](_0xcb66('0x143'),_0x5917a5[_0xcb66('0xb0')],_0x5917a5['cause'],_0xcb66('0xb4'),_0x179b50[_0xcb66('0x23')],_0xcb66('0x72'),_0x179b50['pTalking']);this[_0xcb66('0x9d')](_0x5917a5,_0x5917a5[_0xcb66('0xb0')],_0x5917a5[_0xcb66('0x142')]);}}};Preview['prototype'][_0xcb66('0x1b')]=function(_0x132c72){if(this[_0xcb66('0x6d')][_0x132c72[_0xcb66('0xf0')]]&&_0x132c72[_0xcb66('0xf0')]!==_0x132c72[_0xcb66('0x148')]){this[_0xcb66('0x9d')](_0x132c72,_0x132c72[_0xcb66('0xf0')],_0x132c72['dialstatus']);}};Preview[_0xcb66('0xd')][_0xcb66('0x149')]=function(_0x471dde){if(this[_0xcb66('0x6d')][_0x471dde[_0xcb66('0xb0')]]&&_0x471dde[_0xcb66('0xb0')]!==_0x471dde['uniqueid']&&!this[_0xcb66('0x6d')][_0x471dde['linkedid']]['dialAnswer']){if(_0x471dde[_0xcb66('0x142')]==='1'){this[_0xcb66('0x9d')](_0x471dde,_0x471dde[_0xcb66('0xb0')],_0x471dde[_0xcb66('0x142')]);}}};Preview[_0xcb66('0xd')][_0xcb66('0x14a')]=function(_0x107e83,_0x2d9129,_0x50bcb0){if(this[_0xcb66('0x6d')][_0x107e83]){if(_[_0xcb66('0x100')](this[_0xcb66('0x6d')][_0x107e83][_0xcb66('0x14b')])){this[_0xcb66('0x6d')][_0x107e83][_0xcb66('0x14b')]={};}this[_0xcb66('0x6d')][_0x107e83]['variables'][_0x2d9129]=_0x50bcb0;}};Preview[_0xcb66('0xd')][_0xcb66('0x1e')]=function(_0x53585f){try{if(!_[_0xcb66('0x100')](_0x53585f)){if(ut[_0xcb66('0x14c')](_[_0xcb66('0x14d')](_0x53585f[_0xcb66('0x14e')])[0x0])){this['addVariable'](_0x53585f[_0xcb66('0xb3')],_['keys'](_0x53585f[_0xcb66('0x14e')])[0x0],_0x53585f['value']);}}}catch(_0x54e810){logger[_0xcb66('0x14f')](_0xcb66('0x150'),util['inspect'](_0x54e810,{'showHidden':![],'depth':null}));}};Preview[_0xcb66('0xd')]['syncAttendedTransfer']=function(_0x40d0da){if(_0x40d0da){if(this[_0xcb66('0x6d')][_0x40d0da['transfertargetlinkedid']]){this[_0xcb66('0x6d')][_0x40d0da[_0xcb66('0x151')]]['transfer']=!![];}}};Preview[_0xcb66('0xd')][_0xcb66('0x21')]=function(_0xd77e47){if(_0xd77e47){if(this[_0xcb66('0x6d')][_0xd77e47['transfererlinkedid']]){this[_0xcb66('0x6d')][_0xd77e47['transfererlinkedid']][_0xcb66('0x146')]=!![];}}};module[_0xcb66('0x152')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index fe5a959..4fb636a 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 _0x8ac8=['[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','xcally-motion-preview','assigned','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x47a41d,_0x5bc10f){var _0xa3476b=function(_0x39a278){while(--_0x39a278){_0x47a41d['push'](_0x47a41d['shift']());}};_0xa3476b(++_0x5bc10f);}(_0x8ac8,0xb9));var _0x88ac=function(_0x8aaa51,_0x58138a){_0x8aaa51=_0x8aaa51-0x0;var _0x4afbd8=_0x8ac8[_0x8aaa51];return _0x4afbd8;};'use strict';var util=require(_0x88ac('0x0'));var BPromise=require('bluebird');var logger=require(_0x88ac('0x1'))('preview');var _=require(_0x88ac('0x2'));var cmHopper=require(_0x88ac('0x3'));var cmHopperFinal=require(_0x88ac('0x4'));var cmHopperHistory=require(_0x88ac('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x88ac('0x6'));var agentReportPreview=require(_0x88ac('0x7'));var voiceQueueReport=require(_0x88ac('0x8'));function loggerCatch(_0x1e9963){return function(_0x606460){logger[_0x88ac('0x9')](_0x1e9963,util[_0x88ac('0xa')](_0x606460,{'showHidden':![],'depth':null}));};}function create(_0x1df44c){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x1df44c))[_0x88ac('0xb')](loggerCatch(_0x88ac('0xc')));}function createAgent(_0x4406f4){return BPromise[_0x88ac('0xd')]()[_0x88ac('0xe')](agentReportPreview[_0x88ac('0xf')](_0x4406f4))[_0x88ac('0xb')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2d937a){return BPromise[_0x88ac('0xd')]()['then'](cmHopper[_0x88ac('0x10')](_0x2d937a,!![]))[_0x88ac('0xb')](loggerCatch(_0x88ac('0x11')));}exports[_0x88ac('0x12')]=function(_0x3f92fa){return BPromise[_0x88ac('0xd')]()[_0x88ac('0xe')](cmHopperBlack[_0x88ac('0x12')](_0x3f92fa))['catch'](loggerCatch(_0x88ac('0x13')));};exports[_0x88ac('0x14')]=function(_0x1446a7){return BPromise[_0x88ac('0xd')]()[_0x88ac('0xe')](cmHopper[_0x88ac('0x14')](_0x1446a7))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x88ac('0xf')]=function(_0x4b0220,_0x3819cc){create(_0x4b0220)[_0x88ac('0xb')](loggerCatch(_0x3819cc));moveContact(_0x4b0220)[_0x88ac('0xb')](loggerCatch(_0x3819cc));};exports[_0x88ac('0x15')]=function(_0x2c2f17,_0x2c06bc){createAgent(_0x2c2f17)[_0x88ac('0xb')](loggerCatch(_0x2c06bc));};exports[_0x88ac('0x16')]=function(_0x1a376d,_0x102602){create(_0x1a376d)[_0x88ac('0xb')](loggerCatch(_0x102602));};exports[_0x88ac('0x17')]=function(_0x11914f,_0x539923){moveContact(_0x11914f)[_0x88ac('0xb')](loggerCatch(_0x539923));};exports[_0x88ac('0x18')]=function(_0x156e90,_0x50a723,_0x46c4e8){if(_0x50a723){_0x156e90[_0x88ac('0x19')]=null;}if(_0x46c4e8){_0x156e90[_0x88ac('0x1a')]=![];}return BPromise[_0x88ac('0xd')]()[_0x88ac('0xe')](cmHopper[_0x88ac('0x18')](_0x156e90))[_0x88ac('0xb')](loggerCatch(_0x88ac('0x1b')));};exports[_0x88ac('0x1c')]=function(_0x451238){return BPromise[_0x88ac('0xd')]()['then'](cmHopper[_0x88ac('0x1c')](_0x451238))[_0x88ac('0xb')](loggerCatch(_0x88ac('0x1d')));};exports[_0x88ac('0x1e')]=function(_0x57d1b3){return BPromise['resolve']()[_0x88ac('0xe')](cmHopper[_0x88ac('0x1e')]({'UserId':null},_0x57d1b3,0x1))[_0x88ac('0xb')](loggerCatch(_0x88ac('0x1f')));};exports[_0x88ac('0x20')]=function(_0x27e79d){return BPromise[_0x88ac('0xd')]()[_0x88ac('0xe')](cmHopper[_0x88ac('0x1e')]({'active':![]},_0x27e79d,0x1))[_0x88ac('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x88ac('0x21')]=function(_0x5ef33c){var _0x25e2cc={};_0x25e2cc[_0x88ac('0x22')]=_0x5ef33c[_0x88ac('0x22')];_0x25e2cc[_0x88ac('0x23')]=_0x5ef33c['uniqueid'];_0x25e2cc[_0x88ac('0x24')]=_0x5ef33c[_0x88ac('0x24')];_0x25e2cc[_0x88ac('0x25')]=_0x5ef33c[_0x88ac('0x25')];_0x25e2cc[_0x88ac('0x26')]=_0x5ef33c[_0x88ac('0x26')];_0x25e2cc['queuecallerjoinAt']=_0x5ef33c[_0x88ac('0x27')];_0x25e2cc[_0x88ac('0x28')]=_0x5ef33c['answertime'];_0x25e2cc[_0x88ac('0x29')]=0x1;_0x25e2cc[_0x88ac('0x2a')]=_0x5ef33c[_0x88ac('0x2b')];_0x25e2cc[_0x88ac('0x2c')]=_0x5ef33c['membername'];_0x25e2cc['context']='from-sip';_0x25e2cc['exten']=_0x88ac('0x2d');_0x25e2cc['holdtime']=0x0;_0x25e2cc[_0x88ac('0x2e')]=0x1;_0x25e2cc['lastAssignedTo']=_0x5ef33c[_0x88ac('0x2f')];_0x25e2cc[_0x88ac('0x30')]=_0x88ac('0x31');return BPromise[_0x88ac('0xd')]()[_0x88ac('0xe')](voiceQueueReport['create'](_0x25e2cc))[_0x88ac('0xb')](loggerCatch(_0x88ac('0x32')));};exports[_0x88ac('0x33')]=function(_0x2aeb03,_0x3b9627){return BPromise[_0x88ac('0xd')]()['then'](cmHopper[_0x88ac('0x33')](_0x2aeb03,_0x3b9627))[_0x88ac('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x88ac('0x34')]=function(_0x2422db){return BPromise[_0x88ac('0xd')]()[_0x88ac('0xe')](cmHopper[_0x88ac('0x18')](_0x2422db,!![],!![]))[_0x88ac('0xb')](loggerCatch(_0x88ac('0x35')));}; \ No newline at end of file +var _0x3b80=['unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x3b80,0xc5));var _0x03b8=function(_0x106a93,_0x5e8fd0){_0x106a93=_0x106a93-0x0;var _0x197296=_0x3b80[_0x106a93];return _0x197296;};'use strict';var util=require(_0x03b8('0x0'));var BPromise=require(_0x03b8('0x1'));var logger=require(_0x03b8('0x2'))(_0x03b8('0x3'));var _=require(_0x03b8('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x03b8('0x5'));var cmHopperHistory=require(_0x03b8('0x6'));var cmHopperBlack=require(_0x03b8('0x7'));var voiceQueueRt=require(_0x03b8('0x8'));var agentReportPreview=require(_0x03b8('0x9'));var voiceQueueReport=require(_0x03b8('0xa'));function loggerCatch(_0x4d5bf9){return function(_0x1f2b0c){logger[_0x03b8('0xb')](_0x4d5bf9,util[_0x03b8('0xc')](_0x1f2b0c,{'showHidden':![],'depth':null}));};}function create(_0x19fa2e){return BPromise['resolve']()['then'](cmHopperHistory[_0x03b8('0xd')](_0x19fa2e))[_0x03b8('0xe')](loggerCatch(_0x03b8('0xf')));}function createAgent(_0x1f3920){return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](agentReportPreview['createHistory'](_0x1f3920))[_0x03b8('0xe')](loggerCatch(_0x03b8('0xf')));}function moveContact(_0x52b502){return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](cmHopper['moveContactManagedDialer'](_0x52b502,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x03b8('0x12')]=function(_0x57a452){return BPromise[_0x03b8('0x10')]()['then'](cmHopperBlack[_0x03b8('0x12')](_0x57a452))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x13')));};exports['getContactPreview']=function(_0xceea82){return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](cmHopper['getContactPreview'](_0xceea82))['catch'](loggerCatch(_0x03b8('0x14')));};exports[_0x03b8('0xd')]=function(_0x5ae4f2,_0x2006f9){create(_0x5ae4f2)[_0x03b8('0xe')](loggerCatch(_0x2006f9));moveContact(_0x5ae4f2)['catch'](loggerCatch(_0x2006f9));};exports['createAgentHistory']=function(_0x1d3c0f,_0x28bec6){createAgent(_0x1d3c0f)[_0x03b8('0xe')](loggerCatch(_0x28bec6));};exports['createCustomerHistory']=function(_0x4d2b7a,_0x13f06c){create(_0x4d2b7a)[_0x03b8('0xe')](loggerCatch(_0x13f06c));};exports['createCustomerFinal']=function(_0x2bffdf,_0x31ce6c){moveContact(_0x2bffdf)[_0x03b8('0xe')](loggerCatch(_0x31ce6c));};exports[_0x03b8('0x15')]=function(_0x4d34b3,_0x1efce8,_0x3ead90){if(_0x1efce8){_0x4d34b3[_0x03b8('0x16')]=null;}if(_0x3ead90){_0x4d34b3[_0x03b8('0x17')]=![];}return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](cmHopper[_0x03b8('0x15')](_0x4d34b3))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x18')));};exports[_0x03b8('0x19')]=function(_0xcdb2d){return BPromise[_0x03b8('0x10')]()['then'](cmHopper[_0x03b8('0x19')](_0xcdb2d))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x1a')));};exports[_0x03b8('0x1b')]=function(_0x3ca37c){return BPromise[_0x03b8('0x10')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x3ca37c,0x1))[_0x03b8('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x03b8('0x1c')]=function(_0x3f76a3){return BPromise[_0x03b8('0x10')]()['then'](cmHopper['unlockContact']({'active':![]},_0x3f76a3,0x1))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x1d')));};exports[_0x03b8('0x1e')]=function(_0x5ef927){var _0x14f708={};_0x14f708[_0x03b8('0x1f')]=_0x5ef927['type'];_0x14f708['uniqueid']=_0x5ef927[_0x03b8('0x20')];_0x14f708[_0x03b8('0x21')]=_0x5ef927[_0x03b8('0x21')];_0x14f708[_0x03b8('0x22')]=_0x5ef927[_0x03b8('0x22')];_0x14f708[_0x03b8('0x23')]=_0x5ef927[_0x03b8('0x23')];_0x14f708[_0x03b8('0x24')]=_0x5ef927['answertime'];_0x14f708[_0x03b8('0x25')]=_0x5ef927[_0x03b8('0x26')];_0x14f708[_0x03b8('0x27')]=0x1;_0x14f708[_0x03b8('0x28')]=_0x5ef927[_0x03b8('0x29')];_0x14f708[_0x03b8('0x2a')]=_0x5ef927[_0x03b8('0x2b')];_0x14f708[_0x03b8('0x2c')]=_0x03b8('0x2d');_0x14f708[_0x03b8('0x2e')]=_0x03b8('0x2f');_0x14f708[_0x03b8('0x30')]=0x0;_0x14f708['assigned']=0x1;_0x14f708[_0x03b8('0x31')]=_0x5ef927[_0x03b8('0x2b')];_0x14f708['queuecallerexitreason']=_0x03b8('0x32');return BPromise[_0x03b8('0x10')]()[_0x03b8('0x11')](voiceQueueReport[_0x03b8('0x33')](_0x14f708))[_0x03b8('0xe')](loggerCatch(_0x03b8('0x34')));};exports[_0x03b8('0x35')]=function(_0x4c2bd6,_0x21a9a5){return BPromise[_0x03b8('0x10')]()['then'](cmHopper[_0x03b8('0x35')](_0x4c2bd6,_0x21a9a5))[_0x03b8('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x03b8('0x36')]=function(_0x415ae8){return BPromise[_0x03b8('0x10')]()['then'](cmHopper[_0x03b8('0x15')](_0x415ae8,!![],!![]))['catch'](loggerCatch(_0x03b8('0x37')));}; \ 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 18a761b..1d34c43 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 _0xa648=['filterKey','campaigntype','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','scheduledAt','active','scheduledat','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','mandatoryDisposition','buildAcw','interface','agentReadyId','status','reachable','push','getDiff','CampaignId'];(function(_0x4ec337,_0x2f3ebb){var _0xecc044=function(_0x4a0eca){while(--_0x4a0eca){_0x4ec337['push'](_0x4ec337['shift']());}};_0xecc044(++_0x2f3ebb);}(_0xa648,0x12e));var _0x8a64=function(_0x2b874f,_0x1b031e){_0x2b874f=_0x2b874f-0x0;var _0x4f4c39=_0xa648[_0x2b874f];return _0x4f4c39;};'use strict';var util=require('util');var _=require(_0x8a64('0x0'));var moment=require(_0x8a64('0x1'));var logger=require('../../../../config/logger')(_0x8a64('0x2'));var ipAgi=process[_0x8a64('0x3')][_0x8a64('0x4')]||'127.0.0.1';function getSeconds(_0x2bfff0,_0x2ff062){var _0x3f5df9=moment(_0x2bfff0)[_0x8a64('0x5')](0x0);var _0x3a7466=moment(_0x2ff062)[_0x8a64('0x5')](0x0);return _0x3f5df9[_0x8a64('0x6')](_0x3a7466,_0x8a64('0x7'));}exports[_0x8a64('0x8')]=function(_0x51b2bb){return function(_0x524ad3){logger[_0x8a64('0x9')](_0x51b2bb,util[_0x8a64('0xa')](_0x524ad3,{'showHidden':![],'depth':null}));};};exports[_0x8a64('0xb')]=function(_0x4bfb59,_0xc30650){logger['info'](_0x4bfb59,util[_0x8a64('0xa')](_0xc30650,{'showHidden':![],'depth':null}));};exports[_0x8a64('0xc')]=function(_0x1baf92,_0x54fd69){logger['error'](_0x1baf92,util[_0x8a64('0xa')](_0x54fd69,{'showHidden':![],'depth':null}));};exports[_0x8a64('0xd')]=function(_0x55a4c4){return function(_0x4b5001){logger['info'](_0x55a4c4,util[_0x8a64('0xa')](_0x4b5001,{'showHidden':![],'depth':null}));};};exports[_0x8a64('0xe')]=function(_0x3b4d74,_0x54d4af,_0x5d39ff){return{'message':_0x3b4d74,'unlock':_0x54d4af,'active':_0x5d39ff};};exports[_0x8a64('0xf')]=function(_0x1c1fde,_0x5d87be,_0x2b11aa){if(!_['isUndefined'](_0x2b11aa)&&_0x8a64('0x10')===typeof _0x2b11aa&&!_[_0x8a64('0x11')](_0x2b11aa)){if(!_[_0x8a64('0x12')](_0x5d87be)&&'string'===typeof _0x5d87be&&!_[_0x8a64('0x11')](_0x5d87be)){return util['format']('\x22%s\x22\x20<%s>',_0x5d87be,_0x2b11aa);}return util[_0x8a64('0x13')](_0x8a64('0x14'),_0x2b11aa,_0x2b11aa);}if(!_[_0x8a64('0x12')](_0x1c1fde)&&_0x8a64('0x10')===typeof _0x1c1fde&&!_[_0x8a64('0x11')](_0x1c1fde)){return _0x1c1fde;}return _0x8a64('0x15');};exports[_0x8a64('0x16')]=function(_0x330d0d){if(_['isNil'](_0x330d0d)){return![];}return _0x330d0d;};exports[_0x8a64('0x17')]=function(_0x34be0b,_0x2bec8b,_0x134600,_0x21338e,_0x422964,_0x99367d){var _0x135c2f={'XMD-QUEUE':_0x2bec8b['Queue']?_0x2bec8b['Queue'][_0x8a64('0x18')]:'','XMD-CALLERID':_0x21338e,'XMD-CALLERID-PREVIEW':_0x99367d?util[_0x8a64('0x13')]('\x22%s\x22\x20<%s>',_0x99367d[_0x8a64('0x19')],_0x99367d[_0x8a64('0x1a')]):_0x21338e,'XMD-DIALID':_0x422964,'XMD-CONTACTID':_0x2bec8b[_0x8a64('0x1b')],'XMD-CDRTYPE':_0x8a64('0x1c'),'CALLERID(all)':_0x21338e,'XMD-VOICEQUEUEID':_0x2bec8b['VoiceQueueId'],'XMD-DIALCHANNEL':_0x134600,'XMD-DIALTIMEOUT':_0x34be0b[_0x8a64('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x8a64('0x13')](_0x8a64('0x1e'),_0x34be0b['dialQueueProject2']?'g':'',_[_0x8a64('0x11')](_0x34be0b[_0x8a64('0x1f')])?'':_0x8a64('0x20')),'XMD-DIALURL':_0x34be0b[_0x8a64('0x21')]||'','XMD-AGI':_0x34be0b[_0x8a64('0x22')]?util[_0x8a64('0x13')](_0x8a64('0x23'),ipAgi,_0x34be0b[_0x8a64('0x22')]):'NONE','XMD-AGIAFTER':_0x34be0b['dialQueueProject2']?util[_0x8a64('0x13')](_0x8a64('0x23'),ipAgi,_0x34be0b[_0x8a64('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x99367d?_0x99367d[_0x8a64('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x99367d?_0x99367d[_0x8a64('0x26')]:'','XMD-DESTINATION':_0x8a64('0x27'),'SIPADDHEADER':_0x8a64('0x28')};if(!_[_0x8a64('0x11')](_0x34be0b[_0x8a64('0x1f')])){_0x135c2f[util[_0x8a64('0x13')]('%s',_0x8a64('0x29'))]=_0x34be0b['monitor_format'];_0x135c2f[util[_0x8a64('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x422964;}if(_0x2bec8b&&_0x2bec8b[_0x8a64('0x2a')]){for(var _0x2d0453 in _0x2bec8b[_0x8a64('0x2a')]){if(_0x2bec8b['Contact'][_0x8a64('0x2b')](_0x2d0453)){if(!_[_0x8a64('0x2c')](_0x2bec8b[_0x8a64('0x2a')][_0x2d0453])&&_0x2d0453!=='id'&&_0x2d0453!==_0x8a64('0x2d')&&_0x2d0453!==_0x8a64('0x2e')&&_0x2d0453!==_0x8a64('0x2f')){_0x135c2f[util['format'](_0x8a64('0x30'),'XMD-',_[_0x8a64('0x31')](_0x2d0453))]=_0x2bec8b[_0x8a64('0x2a')][_0x2d0453];}}}}return _0x135c2f;};exports[_0x8a64('0x32')]=function(_0x58b4c1){var _0x12ae81={};for(var _0x2ac588 in _0x58b4c1){if(_0x58b4c1[_0x8a64('0x2b')](_0x2ac588)){_0x12ae81[util['format']('%s',_[_0x8a64('0x33')](_0x2ac588))]=_0x58b4c1[_0x2ac588];}}return{'variables':_0x12ae81};};exports[_0x8a64('0x34')]=function(_0x5262f6,_0x4388c4){if(!_[_0x8a64('0x2c')](_0x5262f6)){if(_0x5262f6[_0x8a64('0x2b')]('originated')){if(_0x5262f6[_0x8a64('0x35')]>0x0){_0x5262f6['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x4388c4);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4388c4);}};exports[_0x8a64('0x36')]=function(_0x3fe880){var _0x582387=moment()[_0x8a64('0x13')](_0x8a64('0x37'));_0x3fe880[_0x8a64('0x38')]=0xd;_0x3fe880[_0x8a64('0x39')]=_0x8a64('0x3a');_0x3fe880[_0x8a64('0x3b')]=_0x582387;_0x3fe880[_0x8a64('0x3c')]=_0x582387;_0x3fe880[_0x8a64('0x3d')]=_0x582387;};exports[_0x8a64('0x3e')]=function(_0x149b0b,_0x28051b,_0x5e50ab){var _0x484e62=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x149b0b[_0x8a64('0x38')]=_0x28051b;_0x149b0b[_0x8a64('0x39')]=_0x5e50ab;_0x149b0b[_0x8a64('0x3c')]=_0x484e62;_0x149b0b[_0x8a64('0x3f')]=getSeconds(_0x149b0b[_0x8a64('0x3c')],_0x149b0b[_0x8a64('0x3b')]);};exports[_0x8a64('0x40')]=function(_0x5954c3,_0x4284ff,_0x208940){_0x5954c3[_0x8a64('0x41')]=_0x4284ff;_0x5954c3[_0x8a64('0x42')]=_0x208940;};exports[_0x8a64('0x43')]=function(_0x4190da,_0x320aae,_0x492f66){var _0x264cd6=moment()[_0x8a64('0x13')](_0x8a64('0x37'));_0x4190da[_0x8a64('0x38')]=_0x320aae;_0x4190da['statedesc']=_0x492f66;_0x4190da[_0x8a64('0x3c')]=_0x4190da[_0x8a64('0x3c')]?_0x4190da[_0x8a64('0x3c')]:_0x264cd6;_0x4190da[_0x8a64('0x3d')]=_0x4190da[_0x8a64('0x3d')]?_0x4190da['endtime']:_0x264cd6;_0x4190da['ringtime']=getSeconds(_0x4190da[_0x8a64('0x3c')]||0x0,_0x4190da[_0x8a64('0x3b')]||0x0);_0x4190da[_0x8a64('0x44')]=_0x4190da['answertime']?getSeconds(_0x4190da[_0x8a64('0x3d')],_0x4190da['answertime']):0x0;};exports[_0x8a64('0x45')]=function(_0x4259d1){return _0x4259d1===_0x8a64('0x46');};exports['variablesAction']=function(_0x470402,_0x50ce45,_0x4c9bc4,_0xcab462,_0x556275){var _0x5b682b=_0xcab462?_0x8a64('0x47'):_0x470402[_0x8a64('0x19')];_0x5b682b=_0x556275?_0x8a64('0x48'):_0x5b682b;return{'actionid':_0x470402[_0x8a64('0x49')],'action':_0x8a64('0x4a'),'channel':_0x470402[_0x8a64('0x4b')],'callerid':util['format'](_0x8a64('0x14'),_0x5b682b,_0x470402[_0x8a64('0x1a')]),'Exten':_0x8a64('0x27'),'Context':_0x8a64('0x4c'),'Priority':'1','variable':_0x4c9bc4,'timeout':(_0x50ce45[_0x8a64('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x470402['uniqueid']};};exports[_0x8a64('0x4e')]=function(_0x5aa88c){return _0x5aa88c[_0x8a64('0x4f')]+_0x5aa88c[_0x8a64('0x50')]+_0x5aa88c[_0x8a64('0x51')]+_0x5aa88c['countagentrejectretry']+_0x5aa88c[_0x8a64('0x52')];};exports['cloneAction']=function(_0x4d87f1){var _0x1184d5=_[_0x8a64('0x53')](_0x4d87f1);_0x1184d5['state']=0xf;_0x1184d5['statedesc']='Global';return _0x1184d5;};exports[_0x8a64('0x54')]=function(_0x4a106a,_0x164acc,_0xed57de){var _0x385869={};_0x385869[_0x164acc]=_0x4a106a[_0x164acc];_0x385869[_0x8a64('0x55')]=![];_0x385869[_0x8a64('0x56')]=moment()['add'](_0xed57de,'minutes')[_0x8a64('0x13')](_0x8a64('0x37'));_0x385869[_0x8a64('0x1b')]=_0x4a106a[_0x8a64('0x1b')];_0x385869['ListId']=_0x4a106a[_0x8a64('0x57')];_0x385869[_0x8a64('0x58')]=_0x4a106a['VoiceQueueId']||undefined;return _0x385869;};exports[_0x8a64('0x59')]=function(_0xcc486,_0x1f5ad8){if(!_[_0x8a64('0x2c')](_0xcc486)){if(_0xcc486[_0x8a64('0x5a')]>0x0){_0xcc486[_0x8a64('0x5a')]-=0x1;}else{logger[_0x8a64('0x9')](_0x1f5ad8,_0x8a64('0x5b'));}}else{logger[_0x8a64('0x9')](_0x1f5ad8,_0x8a64('0x5c'));}};exports[_0x8a64('0x5d')]=function(_0x45d9ba){if(_0x45d9ba<=0x0){return!![];}return![];};exports[_0x8a64('0x5e')]=function(_0x2d0ab8,_0x49d3ca,_0x29c9ae){_0x2d0ab8[_0x8a64('0x5f')]=_0x49d3ca;_0x2d0ab8[_0x8a64('0x18')]=_0x2d0ab8[_0x8a64('0x60')];_0x2d0ab8['interface']=_0x2d0ab8[_0x8a64('0x4b')];_0x2d0ab8['motionChannel']='voice';if(_0x29c9ae){_0x2d0ab8[_0x8a64('0x61')]=_0x29c9ae[_0x8a64('0x61')];}return _0x2d0ab8;};exports[_0x8a64('0x62')]=function(_0x19f8ab){var _0x258c21={};_0x258c21[_0x8a64('0x60')]=_0x19f8ab[_0x8a64('0x60')];_0x258c21[_0x8a64('0x63')]=_0x19f8ab[_0x8a64('0x4b')];_0x258c21[_0x8a64('0x49')]=_0x19f8ab['uniqueid'];return _0x258c21;};exports[_0x8a64('0x64')]=function(_0x42f05e){var _0x3e107e=[];for(var _0x2b756e in _0x42f05e){if(_0x42f05e['hasOwnProperty'](_0x2b756e)){if(!_[_0x8a64('0x2c')](_0x42f05e[_0x2b756e])&&_0x42f05e[_0x2b756e][_0x8a64('0x38')]==='not_inuse'&&_0x42f05e[_0x2b756e][_0x8a64('0x65')]===_0x8a64('0x66')){_0x3e107e[_0x8a64('0x67')](_0x42f05e[_0x2b756e]['id']);}}}return _0x3e107e;};exports[_0x8a64('0x68')]=function(_0x1487dd){var _0x37dd85=moment()[_0x8a64('0x5')](0x0);var _0x4db592=moment(_0x1487dd)[_0x8a64('0x5')](0x0);return _0x37dd85[_0x8a64('0x6')](_0x4db592,_0x8a64('0x7'));};exports['createBody']=function(_0x599a72){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x599a72[_0x8a64('0x1b')],'ListId':_0x599a72[_0x8a64('0x57')],'VoiceQueueId':_0x599a72[_0x8a64('0x58')]||undefined,'CampaignId':_0x599a72[_0x8a64('0x69')]||undefined};};exports[_0x8a64('0x6a')]=function(_0x390f55){if(_0x390f55===_0x8a64('0x49')||_0x390f55==='idContact'||_0x390f55===_0x8a64('0x60')||_0x390f55==='type'||_0x390f55===_0x8a64('0x6b')||_0x390f55==='dialAnswer'||_0x390f55===_0x8a64('0x41')||_0x390f55==='channelAgent'||_0x390f55===_0x8a64('0x19')||_0x390f55==='active'||_0x390f55===_0x8a64('0x1a')||_0x390f55===_0x8a64('0x56')||_0x390f55===_0x8a64('0x4f')||_0x390f55===_0x8a64('0x50')||_0x390f55===_0x8a64('0x51')||_0x390f55==='countglobal'||_0x390f55==='callback'||_0x390f55==='callbackuniqueid'||_0x390f55==='callbackat'||_0x390f55==='recallme'||_0x390f55===_0x8a64('0x1b')||_0x390f55===_0x8a64('0x57')||_0x390f55===_0x8a64('0x42')||_0x390f55==='VoiceQueueId'||_0x390f55===_0x8a64('0x6c')||_0x390f55===_0x8a64('0x6d')||_0x390f55==='xmd-queue'||_0x390f55===_0x8a64('0x6e')||_0x390f55===_0x8a64('0x6f')||_0x390f55===_0x8a64('0x70')||_0x390f55===_0x8a64('0x71')||_0x390f55===_0x8a64('0x72')||_0x390f55===_0x8a64('0x73')||_0x390f55===_0x8a64('0x74')||_0x390f55==='xmd-contactid'||_0x390f55===_0x8a64('0x75')||_0x390f55==='xmd-callerid'||_0x390f55===_0x8a64('0x76')||_0x390f55===_0x8a64('0x77')||_0x390f55===_0x8a64('0x78')||_0x390f55===_0x8a64('0x79')||_0x390f55===_0x8a64('0x7a')||_0x390f55===_0x8a64('0x7b')||_0x390f55===_0x8a64('0x7c')||_0x390f55==='rtpaudioqoslossbridged'||_0x390f55==='rtpaudioqosrtt'||_0x390f55===_0x8a64('0x7d')||_0x390f55===_0x8a64('0x78')||_0x390f55==='rtpaudioqosbridged'||_0x390f55===_0x8a64('0x7a')||_0x390f55==='rtpaudioqosjitterbridged'||_0x390f55===_0x8a64('0x7c')||_0x390f55===_0x8a64('0x7e')||_0x390f55==='rtpaudioqosrtt'||_0x390f55===_0x8a64('0x7d')||_0x390f55===_0x8a64('0x7f')||_0x390f55===_0x8a64('0x80')||_0x390f55===_0x8a64('0x38')||_0x390f55===_0x8a64('0x39')){return![];}return!![];};exports[_0x8a64('0x81')]=function(_0x30c3e3,_0x40001b){var _0x102e08,_0xf456e3,_0xbbb02e;if(_0x40001b<=0x0){_0x40001b=0x1;}_0x102e08=new RegExp(_0x8a64('0x82')+_0x40001b+'}$');_0xf456e3=Math[_0x8a64('0x83')](0xa,_0x40001b-0x1);_0xbbb02e=Math['pow'](0xa,_0x40001b)-0x1;return util[_0x8a64('0x13')]('%s',_['replace'](_0x30c3e3,_0x102e08,_[_0x8a64('0x84')](_0xf456e3,_0xbbb02e)));};exports[_0x8a64('0x85')]=function(_0x12eba9){var _0x4415f2=_0x12eba9[_0x8a64('0x86')](/"(.*?)"/);return _0x4415f2?_0x4415f2[0x1]:_0x12eba9;};exports[_0x8a64('0x87')]=function(_0x41a818){var _0x4bd559=_0x41a818['match'](/<(.*?)>/);return _0x4bd559?_0x4bd559[0x1]:_0x41a818;}; \ No newline at end of file +var _0xe09b=['rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','logger','info','inspect','error','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','statedesc','Blacklist','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','starttime','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','talktime','answertime','Failure','variablesAction','BOOKED','channelAgent','from-sip','timeout','uniqueid','countagentrejectretry','countnosuchnumberretry','cloneAction','state','Global','scheduledAt','active','scheduledat','add','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','motionChannel','voice','mandatoryDisposition','status','reachable','push','diff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos'];(function(_0x2a695c,_0x5e563c){var _0x5a97e0=function(_0x4ee24b){while(--_0x4ee24b){_0x2a695c['push'](_0x2a695c['shift']());}};_0x5a97e0(++_0x5e563c);}(_0xe09b,0x97));var _0xbe09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe09b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbe09('0x0'));var _=require('lodash');var moment=require(_0xbe09('0x1'));var logger=require('../../../../config/logger')(_0xbe09('0x2'));var ipAgi=process[_0xbe09('0x3')][_0xbe09('0x4')]||_0xbe09('0x5');function getSeconds(_0x285b15,_0xcf4ff2){var _0x56020e=moment(_0x285b15)['milliseconds'](0x0);var _0x34bea4=moment(_0xcf4ff2)[_0xbe09('0x6')](0x0);return _0x56020e['diff'](_0x34bea4,_0xbe09('0x7'));}exports[_0xbe09('0x8')]=function(_0x2fa68f){return function(_0xb01ab7){logger['error'](_0x2fa68f,util['inspect'](_0xb01ab7,{'showHidden':![],'depth':null}));};};exports[_0xbe09('0x9')]=function(_0x13e415,_0x41c654){logger[_0xbe09('0xa')](_0x13e415,util[_0xbe09('0xb')](_0x41c654,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x40659f,_0x197826){logger[_0xbe09('0xc')](_0x40659f,util[_0xbe09('0xb')](_0x197826,{'showHidden':![],'depth':null}));};exports[_0xbe09('0xd')]=function(_0xe20df){return function(_0x4000a7){logger['info'](_0xe20df,util[_0xbe09('0xb')](_0x4000a7,{'showHidden':![],'depth':null}));};};exports[_0xbe09('0xe')]=function(_0x44748b,_0x61a709,_0x2ced72){return{'message':_0x44748b,'unlock':_0x61a709,'active':_0x2ced72};};exports[_0xbe09('0xf')]=function(_0x2eb81d,_0x2663aa,_0x5a9d04){if(!_[_0xbe09('0x10')](_0x5a9d04)&&_0xbe09('0x11')===typeof _0x5a9d04&&!_[_0xbe09('0x12')](_0x5a9d04)){if(!_['isUndefined'](_0x2663aa)&&_0xbe09('0x11')===typeof _0x2663aa&&!_[_0xbe09('0x12')](_0x2663aa)){return util['format'](_0xbe09('0x13'),_0x2663aa,_0x5a9d04);}return util[_0xbe09('0x14')](_0xbe09('0x13'),_0x5a9d04,_0x5a9d04);}if(!_['isUndefined'](_0x2eb81d)&&_0xbe09('0x11')===typeof _0x2eb81d&&!_[_0xbe09('0x12')](_0x2eb81d)){return _0x2eb81d;}return _0xbe09('0x15');};exports[_0xbe09('0x16')]=function(_0x1f03a6){if(_[_0xbe09('0x17')](_0x1f03a6)){return![];}return _0x1f03a6;};exports['addVariables']=function(_0x93e0f0,_0x11361e,_0x1cc474,_0x55369d,_0x1ae6d6,_0x1a5ed6){var _0x2b2deb={'XMD-QUEUE':_0x11361e[_0xbe09('0x18')]?_0x11361e[_0xbe09('0x18')][_0xbe09('0x19')]:'','XMD-CALLERID':_0x55369d,'XMD-CALLERID-PREVIEW':_0x1a5ed6?util['format']('\x22%s\x22\x20<%s>',_0x1a5ed6[_0xbe09('0x1a')],_0x1a5ed6[_0xbe09('0x1b')]):_0x55369d,'XMD-DIALID':_0x1ae6d6,'XMD-CONTACTID':_0x11361e[_0xbe09('0x1c')],'XMD-CDRTYPE':_0xbe09('0x1d'),'CALLERID(all)':_0x55369d,'XMD-VOICEQUEUEID':_0x11361e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1cc474,'XMD-DIALTIMEOUT':_0x93e0f0[_0xbe09('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xbe09('0x14')]('\x22rtTxX%s%s\x22',_0x93e0f0[_0xbe09('0x1f')]?'g':'',_[_0xbe09('0x12')](_0x93e0f0[_0xbe09('0x20')])?'':_0xbe09('0x21')),'XMD-DIALURL':_0x93e0f0[_0xbe09('0x22')]||'','XMD-AGI':_0x93e0f0[_0xbe09('0x23')]?util[_0xbe09('0x14')](_0xbe09('0x24'),ipAgi,_0x93e0f0[_0xbe09('0x23')]):_0xbe09('0x25'),'XMD-AGIAFTER':_0x93e0f0[_0xbe09('0x1f')]?util[_0xbe09('0x14')](_0xbe09('0x24'),ipAgi,_0x93e0f0[_0xbe09('0x1f')]):_0xbe09('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x1a5ed6?_0x1a5ed6[_0xbe09('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x1a5ed6?_0x1a5ed6['originatecalleridname']:'','XMD-DESTINATION':_0xbe09('0x27'),'SIPADDHEADER':_0xbe09('0x28')};if(!_[_0xbe09('0x12')](_0x93e0f0['monitor_format'])){_0x2b2deb[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x93e0f0[_0xbe09('0x20')];_0x2b2deb[util[_0xbe09('0x14')]('%s',_0xbe09('0x29'))]=_0x1ae6d6;}if(_0x11361e&&_0x11361e[_0xbe09('0x2a')]){for(var _0x30994a in _0x11361e[_0xbe09('0x2a')]){if(_0x11361e['Contact']['hasOwnProperty'](_0x30994a)){if(!_[_0xbe09('0x17')](_0x11361e[_0xbe09('0x2a')][_0x30994a])&&_0x30994a!=='id'&&_0x30994a!==_0xbe09('0x2b')&&_0x30994a!==_0xbe09('0x2c')&&_0x30994a!==_0xbe09('0x2d')){_0x2b2deb[util['format'](_0xbe09('0x2e'),_0xbe09('0x2f'),_[_0xbe09('0x30')](_0x30994a))]=_0x11361e[_0xbe09('0x2a')][_0x30994a];}}}}return _0x2b2deb;};exports[_0xbe09('0x31')]=function(_0x10c3a3){var _0x5e57ff={};for(var _0x15aebb in _0x10c3a3){if(_0x10c3a3['hasOwnProperty'](_0x15aebb)){_0x5e57ff[util[_0xbe09('0x14')]('%s',_[_0xbe09('0x32')](_0x15aebb))]=_0x10c3a3[_0x15aebb];}}return{'variables':_0x5e57ff};};exports[_0xbe09('0x33')]=function(_0x288e7a,_0x236f9f){if(!_[_0xbe09('0x17')](_0x288e7a)){if(_0x288e7a[_0xbe09('0x34')]('originated')){if(_0x288e7a[_0xbe09('0x35')]>0x0){_0x288e7a[_0xbe09('0x35')]-=0x1;}else{logger[_0xbe09('0xc')](_0xbe09('0x36'),_0x236f9f);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x236f9f);}};exports[_0xbe09('0x37')]=function(_0x3f75a9){var _0x1d81ff=moment()[_0xbe09('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f75a9['state']=0xd;_0x3f75a9[_0xbe09('0x38')]=_0xbe09('0x39');_0x3f75a9['starttime']=_0x1d81ff;_0x3f75a9['responsetime']=_0x1d81ff;_0x3f75a9['endtime']=_0x1d81ff;};exports[_0xbe09('0x3a')]=function(_0x27bf29,_0x5cadff,_0xb4adc4){var _0x25c007=moment()[_0xbe09('0x14')](_0xbe09('0x3b'));_0x27bf29['state']=_0x5cadff;_0x27bf29[_0xbe09('0x38')]=_0xb4adc4;_0x27bf29['responsetime']=_0x25c007;_0x27bf29['ringtime']=getSeconds(_0x27bf29[_0xbe09('0x3c')],_0x27bf29[_0xbe09('0x3d')]);};exports[_0xbe09('0x3e')]=function(_0x29483c,_0x101c41,_0x37e01e){_0x29483c[_0xbe09('0x3f')]=_0x101c41;_0x29483c[_0xbe09('0x40')]=_0x37e01e;};exports[_0xbe09('0x41')]=function(_0x3718fe,_0x16fd60,_0x54cd85){var _0x3da98a=moment()['format'](_0xbe09('0x3b'));_0x3718fe['state']=_0x16fd60;_0x3718fe[_0xbe09('0x38')]=_0x54cd85;_0x3718fe['responsetime']=_0x3718fe[_0xbe09('0x3c')]?_0x3718fe[_0xbe09('0x3c')]:_0x3da98a;_0x3718fe[_0xbe09('0x42')]=_0x3718fe[_0xbe09('0x42')]?_0x3718fe[_0xbe09('0x42')]:_0x3da98a;_0x3718fe[_0xbe09('0x43')]=getSeconds(_0x3718fe[_0xbe09('0x3c')]||0x0,_0x3718fe['starttime']||0x0);_0x3718fe[_0xbe09('0x44')]=_0x3718fe[_0xbe09('0x45')]?getSeconds(_0x3718fe[_0xbe09('0x42')],_0x3718fe[_0xbe09('0x45')]):0x0;};exports['isFailure']=function(_0x8e5bfb){return _0x8e5bfb===_0xbe09('0x46');};exports[_0xbe09('0x47')]=function(_0x5a047b,_0x275a5e,_0x582177,_0x40b2d3,_0x4629de){var _0xc3cba5=_0x40b2d3?'RECALL':_0x5a047b['calleridname'];_0xc3cba5=_0x4629de?_0xbe09('0x48'):_0xc3cba5;return{'actionid':_0x5a047b['uniqueid'],'action':'originate','channel':_0x5a047b[_0xbe09('0x49')],'callerid':util[_0xbe09('0x14')](_0xbe09('0x13'),_0xc3cba5,_0x5a047b[_0xbe09('0x1b')]),'Exten':'xcally-motion-preview','Context':_0xbe09('0x4a'),'Priority':'1','variable':_0x582177,'timeout':(_0x275a5e[_0xbe09('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5a047b[_0xbe09('0x4c')]};};exports['totalGlobal']=function(_0x35337c){return _0x35337c['countbusyretry']+_0x35337c['countcongestionretry']+_0x35337c['countnoanswerretry']+_0x35337c[_0xbe09('0x4d')]+_0x35337c[_0xbe09('0x4e')];};exports[_0xbe09('0x4f')]=function(_0x2a7592){var _0x1a9391=_['clone'](_0x2a7592);_0x1a9391[_0xbe09('0x50')]=0xf;_0x1a9391['statedesc']=_0xbe09('0x51');return _0x1a9391;};exports[_0xbe09('0x52')]=function(_0x4a4a50,_0x2e4cc8,_0x1090f8){var _0x3dfd70={};_0x3dfd70[_0x2e4cc8]=_0x4a4a50[_0x2e4cc8];_0x3dfd70[_0xbe09('0x53')]=![];_0x3dfd70[_0xbe09('0x54')]=moment()[_0xbe09('0x55')](_0x1090f8,'minutes')[_0xbe09('0x14')](_0xbe09('0x3b'));_0x3dfd70[_0xbe09('0x1c')]=_0x4a4a50[_0xbe09('0x1c')];_0x3dfd70[_0xbe09('0x56')]=_0x4a4a50['ListId'];_0x3dfd70[_0xbe09('0x57')]=_0x4a4a50[_0xbe09('0x57')]||undefined;return _0x3dfd70;};exports['decrementTalkink']=function(_0x1e33f7,_0x1c6ce2){if(!_['isNil'](_0x1e33f7)){if(_0x1e33f7[_0xbe09('0x58')]>0x0){_0x1e33f7[_0xbe09('0x58')]-=0x1;}else{logger[_0xbe09('0xc')](_0x1c6ce2,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xbe09('0xc')](_0x1c6ce2,_0xbe09('0x59'));}};exports[_0xbe09('0x5a')]=function(_0x352fdc){if(_0x352fdc<=0x0){return!![];}return![];};exports[_0xbe09('0x5b')]=function(_0x1b7f4c,_0x356b09,_0x15fd03){_0x1b7f4c['lastevent']=_0x356b09;_0x1b7f4c[_0xbe09('0x19')]=_0x1b7f4c[_0xbe09('0x5c')];_0x1b7f4c[_0xbe09('0x5d')]=_0x1b7f4c[_0xbe09('0x49')];_0x1b7f4c[_0xbe09('0x5e')]=_0xbe09('0x5f');if(_0x15fd03){_0x1b7f4c[_0xbe09('0x60')]=_0x15fd03[_0xbe09('0x60')];}return _0x1b7f4c;};exports['buildAcw']=function(_0x159703){var _0x23493f={};_0x23493f['queue']=_0x159703[_0xbe09('0x5c')];_0x23493f[_0xbe09('0x5d')]=_0x159703[_0xbe09('0x49')];_0x23493f[_0xbe09('0x4c')]=_0x159703[_0xbe09('0x4c')];return _0x23493f;};exports['agentReadyId']=function(_0x4b0394){var _0x55761a=[];for(var _0x570851 in _0x4b0394){if(_0x4b0394['hasOwnProperty'](_0x570851)){if(!_[_0xbe09('0x17')](_0x4b0394[_0x570851])&&_0x4b0394[_0x570851][_0xbe09('0x50')]==='not_inuse'&&_0x4b0394[_0x570851][_0xbe09('0x61')]===_0xbe09('0x62')){_0x55761a[_0xbe09('0x63')](_0x4b0394[_0x570851]['id']);}}}return _0x55761a;};exports['getDiff']=function(_0x108ba5){var _0x2c2f66=moment()['milliseconds'](0x0);var _0x24e708=moment(_0x108ba5)[_0xbe09('0x6')](0x0);return _0x2c2f66[_0xbe09('0x64')](_0x24e708,_0xbe09('0x7'));};exports['createBody']=function(_0x1c02e7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c02e7[_0xbe09('0x1c')],'ListId':_0x1c02e7[_0xbe09('0x56')],'VoiceQueueId':_0x1c02e7[_0xbe09('0x57')]||undefined,'CampaignId':_0x1c02e7[_0xbe09('0x65')]||undefined};};exports[_0xbe09('0x66')]=function(_0x127afb){if(_0x127afb===_0xbe09('0x4c')||_0x127afb===_0xbe09('0x67')||_0x127afb===_0xbe09('0x5c')||_0x127afb===_0xbe09('0x68')||_0x127afb===_0xbe09('0x69')||_0x127afb===_0xbe09('0x6a')||_0x127afb==='membername'||_0x127afb===_0xbe09('0x49')||_0x127afb===_0xbe09('0x1a')||_0x127afb==='active'||_0x127afb===_0xbe09('0x1b')||_0x127afb==='scheduledat'||_0x127afb===_0xbe09('0x6b')||_0x127afb==='countcongestionretry'||_0x127afb===_0xbe09('0x6c')||_0x127afb===_0xbe09('0x6d')||_0x127afb===_0xbe09('0x6e')||_0x127afb===_0xbe09('0x6f')||_0x127afb==='callbackat'||_0x127afb==='recallme'||_0x127afb==='ContactId'||_0x127afb===_0xbe09('0x56')||_0x127afb===_0xbe09('0x40')||_0x127afb===_0xbe09('0x57')||_0x127afb===_0xbe09('0x70')||_0x127afb===_0xbe09('0x71')||_0x127afb===_0xbe09('0x72')||_0x127afb===_0xbe09('0x73')||_0x127afb==='xmd-listid'||_0x127afb===_0xbe09('0x74')||_0x127afb===_0xbe09('0x75')||_0x127afb===_0xbe09('0x76')||_0x127afb===_0xbe09('0x77')||_0x127afb===_0xbe09('0x78')||_0x127afb===_0xbe09('0x79')||_0x127afb==='xmd-cdrtype'||_0x127afb===_0xbe09('0x7a')||_0x127afb===_0xbe09('0x7b')||_0x127afb==='xmd-agi'||_0x127afb==='rtpaudioqos'||_0x127afb===_0xbe09('0x7c')||_0x127afb==='rtpaudioqosjitter'||_0x127afb===_0xbe09('0x7d')||_0x127afb===_0xbe09('0x7e')||_0x127afb===_0xbe09('0x7f')||_0x127afb===_0xbe09('0x80')||_0x127afb===_0xbe09('0x81')||_0x127afb===_0xbe09('0x82')||_0x127afb===_0xbe09('0x7c')||_0x127afb===_0xbe09('0x83')||_0x127afb===_0xbe09('0x7d')||_0x127afb===_0xbe09('0x7e')||_0x127afb==='rtpaudioqoslossbridged'||_0x127afb===_0xbe09('0x80')||_0x127afb===_0xbe09('0x81')||_0x127afb===_0xbe09('0x84')||_0x127afb===_0xbe09('0x85')||_0x127afb===_0xbe09('0x50')||_0x127afb==='statedesc'){return![];}return!![];};exports[_0xbe09('0x86')]=function(_0x329f42,_0x223f44){var _0x4f577d,_0x480c08,_0x30f37d;if(_0x223f44<=0x0){_0x223f44=0x1;}_0x4f577d=new RegExp(_0xbe09('0x87')+_0x223f44+'}$');_0x480c08=Math[_0xbe09('0x88')](0xa,_0x223f44-0x1);_0x30f37d=Math['pow'](0xa,_0x223f44)-0x1;return util[_0xbe09('0x14')]('%s',_[_0xbe09('0x89')](_0x329f42,_0x4f577d,_[_0xbe09('0x8a')](_0x480c08,_0x30f37d)));};exports['extractCalleridName']=function(_0x457b81){var _0x4dac9c=_0x457b81[_0xbe09('0x8b')](/"(.*?)"/);return _0x4dac9c?_0x4dac9c[0x1]:_0x457b81;};exports[_0xbe09('0x8c')]=function(_0x29e979){var _0x4a6763=_0x29e979[_0xbe09('0x8b')](/<(.*?)>/);return _0x4a6763?_0x4a6763[0x1]:_0x29e979;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 27c666f..63278ab 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 _0xf483=['voicequeuechannel','voicechannel','queueadd','string','number','queueremove','boolean'];(function(_0x44ab46,_0x814779){var _0x1379e3=function(_0x1545a8){while(--_0x1545a8){_0x44ab46['push'](_0x44ab46['shift']());}};_0x1379e3(++_0x814779);}(_0xf483,0x105));var _0x3f48=function(_0x53bbb0,_0x66fb6){_0x53bbb0=_0x53bbb0-0x0;var _0x2b8845=_0xf483[_0x53bbb0];return _0x2b8845;};'use strict';exports[_0x3f48('0x0')]={'queue':{'type':_0x3f48('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x3f48('0x1'),'required':!![]},'penalty':{'type':_0x3f48('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x3f48('0x3')]={'queue':{'type':_0x3f48('0x1'),'required':!![]},'interface':{'type':_0x3f48('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x3f48('0x1'),'required':!![]},'paused':{'type':_0x3f48('0x4')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x3f48('0x1'),'required':![]}};exports[_0x3f48('0x5')]={'uniqueid':{'type':_0x3f48('0x1'),'required':!![]}};exports[_0x3f48('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x3f48('0x1')},'format':{'type':_0x3f48('0x1')},'mixmonitorid':{'type':_0x3f48('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x3f48('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x3f48('0x1'),'required':!![]},'exten':{'type':_0x3f48('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x6ed3=['voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ed3,0x155));var _0x36ed=function(_0x20a089,_0x158776){_0x20a089=_0x20a089-0x0;var _0x4521e9=_0x6ed3[_0x20a089];return _0x4521e9;};'use strict';exports[_0x36ed('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x36ed('0x1'),'required':!![]},'membername':{'type':_0x36ed('0x1'),'required':!![]},'penalty':{'type':_0x36ed('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x36ed('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x36ed('0x1'),'required':!![]}};exports[_0x36ed('0x4')]={'interface':{'type':_0x36ed('0x1'),'required':!![]},'paused':{'type':_0x36ed('0x5')},'reason':{'type':_0x36ed('0x1'),'required':![]}};exports[_0x36ed('0x6')]={'module':{'type':_0x36ed('0x1'),'required':![]}};exports[_0x36ed('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x36ed('0x8')]={'uniqueid':{'type':_0x36ed('0x1'),'required':!![]},'filename':{'type':_0x36ed('0x1')},'format':{'type':_0x36ed('0x1')},'mixmonitorid':{'type':_0x36ed('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x36ed('0x1'),'required':!![]}};exports[_0x36ed('0x9')]={'uniqueid':{'type':_0x36ed('0x1'),'required':!![]},'exten':{'type':_0x36ed('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6119b98..9469f6f 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 _0x3300=['billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','name','mapKeys','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','trunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercompleteAt','diff','disposition','ANSWERED','duration'];(function(_0x44e0c8,_0x28f38f){var _0x2e012e=function(_0x56f01a){while(--_0x56f01a){_0x44e0c8['push'](_0x44e0c8['shift']());}};_0x2e012e(++_0x28f38f);}(_0x3300,0x7c));var _0x0330=function(_0x3bf3f1,_0x5b8238){_0x3bf3f1=_0x3bf3f1-0x0;var _0x5a0c0c=_0x3300[_0x3bf3f1];return _0x5a0c0c;};'use strict';var BPromise=require(_0x0330('0x0'));var util=require(_0x0330('0x1'));var _=require('lodash');var moment=require(_0x0330('0x2'));var Agent=require(_0x0330('0x3'));var Telephone=require(_0x0330('0x4'));var Trunk=require(_0x0330('0x5'));var VoiceQueue=require(_0x0330('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x0330('0x7'));var Campaign=require(_0x0330('0x8'));var VoiceExtension=require(_0x0330('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x0330('0xa'));var FreshdeskAccount=require(_0x0330('0xb'));var SugarcrmAccount=require(_0x0330('0xc'));var ZohoAccount=require(_0x0330('0xd'));var DeskAccount=require(_0x0330('0xe'));var VtigerAccount=require(_0x0330('0xf'));var ServicenowAccount=require(_0x0330('0x10'));var Dynamics365Account=require(_0x0330('0x11'));var FreshsalesAccount=require(_0x0330('0x12'));var FaxAccount=require(_0x0330('0x13'));var Realtime=function(){this[_0x0330('0x14')]={};this[_0x0330('0x15')]={};this['trunks']={};this[_0x0330('0x16')]={};this[_0x0330('0x17')]={};this['campaigns']={};this[_0x0330('0x18')]={};this[_0x0330('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x0330('0x1a')]={};this[_0x0330('0x1b')]={};this['queueChannels']={};this[_0x0330('0x1c')]={};this['timers']={};this[_0x0330('0x1d')]={};this[_0x0330('0x1e')]={};this['salesforceAccounts']={};this[_0x0330('0x1f')]={};this[_0x0330('0x20')]={};this[_0x0330('0x21')]={};this[_0x0330('0x22')]={};this[_0x0330('0x23')]={};this[_0x0330('0x24')]={};this['dynamics365Accounts']={};this[_0x0330('0x25')]={};this[_0x0330('0x26')]={};};function freeIsNotKey(_0x5cc267,_0x26c5e7,_0x4fab67){var _0x38435f=_['mapKeys'](_0x5cc267,function(_0x245eb3,_0x2c7791){return _0x245eb3[_0x4fab67];});for(var _0x14f24d in _0x26c5e7){if(_0x26c5e7[_0x0330('0x27')](_0x14f24d)){if(!_0x38435f[_0x14f24d]){delete _0x26c5e7[_0x14f24d];}}}}function freeIsNotKeySip(_0x238397,_0x79a6f9){var _0x4370cc=_['mapKeys'](_0x238397,function(_0x6449fd,_0x261fe8){return util[_0x0330('0x28')](_0x0330('0x29'),_0x6449fd[_0x0330('0x2a')]);});for(var _0x410ba7 in _0x79a6f9){if(_0x79a6f9[_0x0330('0x27')](_0x410ba7)){if(!_0x4370cc[_0x410ba7]){delete _0x79a6f9[_0x410ba7];}}}}function freeIsNotKeyAgent(_0x726943,_0x22d2de){var _0x35760a=_[_0x0330('0x2b')](_0x726943,function(_0x308a4b,_0x1ae060){var _0x1f5443=_[_0x0330('0x2c')](_0x308a4b[_0x0330('0x2d')])?util[_0x0330('0x28')](_0x0330('0x29'),_0x308a4b[_0x0330('0x2a')]):_0x308a4b['interface'];return _0x1f5443;});for(var _0x2fa811 in _0x22d2de){if(_0x22d2de[_0x0330('0x27')](_0x2fa811)){if(!_0x35760a[_0x2fa811]){delete _0x22d2de[_0x2fa811];}}}}function clearVoiceCallReports(_0x42956f){_0x42956f[_0x0330('0x2e')]=0x0;_0x42956f[_0x0330('0x2f')]=0x0;_0x42956f[_0x0330('0x30')]=0x0;_0x42956f[_0x0330('0x31')]=0x0;_0x42956f['sumBillable']=0x0;}function clearCampaigns(_0x114755){if(!_[_0x0330('0x32')](_0x114755)){for(var _0x940c5a in _0x114755){if(_0x114755[_0x0330('0x27')](_0x940c5a)){_0x114755[_0x940c5a][_0x0330('0x33')]=0x0;_0x114755[_0x940c5a][_0x0330('0x34')]=0x0;}}}}function clearVoiceQueues(_0x2b9ff7){if(!_['isEmpty'](_0x2b9ff7)){for(var _0x342d35 in _0x2b9ff7){if(_0x2b9ff7[_0x0330('0x27')](_0x342d35)){_0x2b9ff7[_0x342d35]['total']=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x2f')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x35')]=0x0;_0x2b9ff7[_0x342d35]['abandoned']=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x30')]=0x0;_0x2b9ff7[_0x342d35]['sumDuration']=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x36')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x37')]=0x0;_0x2b9ff7[_0x342d35]['outboundNoAnswerCallsDay']=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x38')]=0x0;_0x2b9ff7[_0x342d35]['outboundCongestionCallsDay']=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x39')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x3a')]=0x0;_0x2b9ff7[_0x342d35]['outboundDropCallsDayTimeout']=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x3b')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x3c')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x3d')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x3e')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x3f')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x37')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x40')]=0x0;_0x2b9ff7[_0x342d35][_0x0330('0x41')]=!![];}}}}Realtime['prototype'][_0x0330('0x42')]=function(_0x16940a,_0x22499c){for(var _0xf238a3 in _0x22499c){if(_0x16940a[_0x0330('0x27')](_0xf238a3)){_0x16940a[_0xf238a3]=_0x22499c[_0xf238a3];}}};Realtime[_0x0330('0x43')][_0x0330('0x44')]=function(){var _0x3d92a0=this;return function(_0x47c16f){if(_0x47c16f){freeIsNotKeyAgent(_0x47c16f,_0x3d92a0[_0x0330('0x14')]);for(var _0x394955=0x0,_0x1342c6={},_0x3ecdef={};_0x394955<_0x47c16f[_0x0330('0x45')];_0x394955+=0x1){_0x1342c6=_0x47c16f[_0x394955];var _0x464cf1=_['isNil'](_0x1342c6[_0x0330('0x2d')])?util[_0x0330('0x28')](_0x0330('0x29'),_0x1342c6['name']):_0x1342c6[_0x0330('0x2d')];if(_[_0x0330('0x46')](_0x3d92a0[_0x0330('0x14')][_0x464cf1])){_0x3d92a0[_0x0330('0x14')][_0x464cf1]=new Agent(_0x1342c6);}else{_0x3d92a0[_0x0330('0x42')](_0x3d92a0['agents'][_0x464cf1],_0x1342c6);}}}return _0x3d92a0['agents'];};};Realtime['prototype'][_0x0330('0x47')]=function(){var _0x19d2d9=this;return function(_0x19baf5){if(_0x19baf5){freeIsNotKeySip(_0x19baf5,_0x19d2d9[_0x0330('0x15')]);for(var _0x369b43=0x0,_0x49172a={},_0x5cafa7={};_0x369b43<_0x19baf5[_0x0330('0x45')];_0x369b43+=0x1){_0x49172a=_0x19baf5[_0x369b43];if(_[_0x0330('0x46')](_0x19d2d9[_0x0330('0x15')][util['format'](_0x0330('0x29'),_0x49172a[_0x0330('0x2a')])])){_0x19d2d9[_0x0330('0x15')][util['format'](_0x0330('0x29'),_0x49172a[_0x0330('0x2a')])]=new Telephone(_0x49172a);}else{_0x19d2d9[_0x0330('0x42')](_0x19d2d9['telephones'][util[_0x0330('0x28')]('SIP/%s',_0x49172a['name'])],_0x49172a);}}}return _0x19d2d9[_0x0330('0x15')];};};Realtime[_0x0330('0x43')]['initTrunks']=function(){var _0xbad878=this;return function(_0x4b0bd7){if(_0x4b0bd7){freeIsNotKeySip(_0x4b0bd7,_0xbad878[_0x0330('0x48')]);for(var _0x4059d3=0x0,_0x2d4d9f={},_0x3279d2={};_0x4059d3<_0x4b0bd7['length'];_0x4059d3+=0x1){_0x2d4d9f=_0x4b0bd7[_0x4059d3];if(_[_0x0330('0x46')](_0xbad878[_0x0330('0x48')][util[_0x0330('0x28')](_0x0330('0x29'),_0x2d4d9f[_0x0330('0x2a')])])){_0xbad878[_0x0330('0x48')][util[_0x0330('0x28')](_0x0330('0x29'),_0x2d4d9f[_0x0330('0x2a')])]=new Trunk(_0x2d4d9f);}else{_0xbad878[_0x0330('0x42')](_0xbad878[_0x0330('0x48')][util['format'](_0x0330('0x29'),_0x2d4d9f[_0x0330('0x2a')])],_0x2d4d9f);}}}return _0xbad878['trunks'];};};Realtime['prototype'][_0x0330('0x49')]=function(){var _0x53d469=this;return function(_0x28124f){if(_0x28124f){freeIsNotKey(_0x28124f,_0x53d469[_0x0330('0x16')],_0x0330('0x2a'));for(var _0x35beb4=0x0,_0x35a3d3={},_0x29f12e={};_0x35beb4<_0x28124f[_0x0330('0x45')];_0x35beb4+=0x1){_0x35a3d3=_0x28124f[_0x35beb4];if(_[_0x0330('0x46')](_0x53d469[_0x0330('0x16')][_0x35a3d3[_0x0330('0x2a')]])){_0x53d469['voiceQueues'][_0x35a3d3[_0x0330('0x2a')]]=new VoiceQueue(_0x35a3d3);}else{_0x53d469[_0x0330('0x42')](_0x53d469[_0x0330('0x16')][_0x35a3d3[_0x0330('0x2a')]],_0x35a3d3);}}}return _0x53d469[_0x0330('0x16')];};};Realtime['prototype'][_0x0330('0x4a')]=function(){var _0xe6f972=this;return function(_0x24dc8d){if(_0x24dc8d){freeIsNotKey(_0x24dc8d,_0xe6f972[_0x0330('0x17')],'id');for(var _0x2b9b1c=0x0,_0x17a147={},_0x14bf7f={};_0x2b9b1c<_0x24dc8d[_0x0330('0x45')];_0x2b9b1c+=0x1){_0x17a147=_0x24dc8d[_0x2b9b1c];if(_[_0x0330('0x46')](_0xe6f972[_0x0330('0x17')][_0x17a147['id']])){_0xe6f972['triggers'][_0x17a147['id']]=new Trigger(_0x17a147);}else{_0xe6f972['mergeFromDatabase'](_0xe6f972['triggers'][_0x17a147['id']],_0x17a147);}}}return _0xe6f972['triggers'];};};Realtime[_0x0330('0x43')][_0x0330('0x4b')]=function(){var _0xfc1f86=this;return function(_0x287c31){if(_0x287c31){freeIsNotKey(_0x287c31,_0xfc1f86[_0x0330('0x18')],'id');for(var _0x3c3b32=0x0,_0x381bf3={},_0x375fe3={};_0x3c3b32<_0x287c31[_0x0330('0x45')];_0x3c3b32+=0x1){_0x381bf3=_0x287c31[_0x3c3b32];if(_['isUndefined'](_0xfc1f86[_0x0330('0x18')][_0x381bf3['id']])){_0xfc1f86[_0x0330('0x18')][_0x381bf3['id']]=new Template(_0x381bf3);}else{_0xfc1f86[_0x0330('0x42')](_0xfc1f86[_0x0330('0x18')][_0x381bf3['id']],_0x381bf3);}}}return _0xfc1f86[_0x0330('0x18')];};};Realtime[_0x0330('0x43')][_0x0330('0x4c')]=function(){var _0x1c72d2=this;return function(_0x2ab8f1){if(_0x2ab8f1){freeIsNotKey(_0x2ab8f1,_0x1c72d2['zendeskAccounts'],'id');for(var _0x29d0fe=0x0,_0x25a156={},_0x48786a={};_0x29d0fe<_0x2ab8f1[_0x0330('0x45')];_0x29d0fe+=0x1){_0x25a156=_0x2ab8f1[_0x29d0fe];if(_[_0x0330('0x46')](_0x1c72d2[_0x0330('0x1e')][_0x25a156['id']])){_0x1c72d2[_0x0330('0x1e')][_0x25a156['id']]=new ZendeskAccount(_0x25a156);}else{_0x1c72d2[_0x0330('0x42')](_0x1c72d2['zendeskAccounts'][_0x25a156['id']],_0x25a156);}}}return _0x1c72d2[_0x0330('0x1e')];};};Realtime['prototype'][_0x0330('0x4d')]=function(){var _0x2654c8=this;return function(_0x4c0e7e){if(_0x4c0e7e){freeIsNotKey(_0x4c0e7e,_0x2654c8[_0x0330('0x4e')],'id');for(var _0x3b0930=0x0,_0x1423f2={},_0x2e2100={};_0x3b0930<_0x4c0e7e[_0x0330('0x45')];_0x3b0930+=0x1){_0x1423f2=_0x4c0e7e[_0x3b0930];if(_[_0x0330('0x46')](_0x2654c8[_0x0330('0x4e')][_0x1423f2['id']])){_0x2654c8['salesforceAccounts'][_0x1423f2['id']]=new SalesforceAccount(_0x1423f2);}else{_0x2654c8[_0x0330('0x42')](_0x2654c8[_0x0330('0x4e')][_0x1423f2['id']],_0x1423f2);}}}return _0x2654c8['salesforceAccounts'];};};Realtime[_0x0330('0x43')][_0x0330('0x4f')]=function(){var _0x51365b=this;return function(_0x454b74){if(_0x454b74){freeIsNotKey(_0x454b74,_0x51365b[_0x0330('0x20')],'id');for(var _0x2d0292=0x0,_0x2cafd2={},_0x460adc={};_0x2d0292<_0x454b74['length'];_0x2d0292+=0x1){_0x2cafd2=_0x454b74[_0x2d0292];if(_['isUndefined'](_0x51365b['freshdeskAccounts'][_0x2cafd2['id']])){_0x51365b[_0x0330('0x20')][_0x2cafd2['id']]=new FreshdeskAccount(_0x2cafd2);}else{_0x51365b[_0x0330('0x42')](_0x51365b['freshdeskAccounts'][_0x2cafd2['id']],_0x2cafd2);}}}return _0x51365b[_0x0330('0x20')];};};Realtime[_0x0330('0x43')][_0x0330('0x50')]=function(){var _0x31184b=this;return function(_0x424bfc){if(_0x424bfc){freeIsNotKey(_0x424bfc,_0x31184b[_0x0330('0x21')],'id');for(var _0x178d4f=0x0,_0x1725d6={},_0x10263f={};_0x178d4f<_0x424bfc['length'];_0x178d4f+=0x1){_0x1725d6=_0x424bfc[_0x178d4f];if(_[_0x0330('0x46')](_0x31184b['zohoAccounts'][_0x1725d6['id']])){_0x31184b[_0x0330('0x21')][_0x1725d6['id']]=new ZohoAccount(_0x1725d6);}else{_0x31184b[_0x0330('0x42')](_0x31184b[_0x0330('0x21')][_0x1725d6['id']],_0x1725d6);}}}return _0x31184b['zohoAccounts'];};};Realtime['prototype'][_0x0330('0x51')]=function(){var _0x250c8a=this;return function(_0x15b91c){if(_0x15b91c){freeIsNotKey(_0x15b91c,_0x250c8a[_0x0330('0x22')],'id');for(var _0x58646c=0x0,_0x545698={},_0x331d45={};_0x58646c<_0x15b91c[_0x0330('0x45')];_0x58646c+=0x1){_0x545698=_0x15b91c[_0x58646c];if(_[_0x0330('0x46')](_0x250c8a[_0x0330('0x22')][_0x545698['id']])){_0x250c8a[_0x0330('0x22')][_0x545698['id']]=new DeskAccount(_0x545698);}else{_0x250c8a[_0x0330('0x42')](_0x250c8a[_0x0330('0x22')][_0x545698['id']],_0x545698);}}}return _0x250c8a[_0x0330('0x22')];};};Realtime['prototype'][_0x0330('0x52')]=function(){var _0x26ded4=this;return function(_0x32edad){if(_0x32edad){freeIsNotKey(_0x32edad,_0x26ded4[_0x0330('0x1f')],'id');for(var _0xbbb70=0x0,_0x51f05c={},_0x466b7b={};_0xbbb70<_0x32edad['length'];_0xbbb70+=0x1){_0x51f05c=_0x32edad[_0xbbb70];if(_[_0x0330('0x46')](_0x26ded4[_0x0330('0x1f')][_0x51f05c['id']])){_0x26ded4[_0x0330('0x1f')][_0x51f05c['id']]=new SugarcrmAccount(_0x51f05c);}else{_0x26ded4[_0x0330('0x42')](_0x26ded4[_0x0330('0x1f')][_0x51f05c['id']],_0x51f05c);}}}return _0x26ded4[_0x0330('0x1f')];};};Realtime[_0x0330('0x43')][_0x0330('0x53')]=function(){var _0x3a2e0d=this;return function(_0xd3718){if(_0xd3718){freeIsNotKey(_0xd3718,_0x3a2e0d[_0x0330('0x23')],'id');for(var _0x103889=0x0,_0x528c51={},_0x30641c={};_0x103889<_0xd3718[_0x0330('0x45')];_0x103889+=0x1){_0x528c51=_0xd3718[_0x103889];if(_[_0x0330('0x46')](_0x3a2e0d['vtigerAccounts'][_0x528c51['id']])){_0x3a2e0d['vtigerAccounts'][_0x528c51['id']]=new VtigerAccount(_0x528c51);}else{_0x3a2e0d[_0x0330('0x42')](_0x3a2e0d['vtigerAccounts'][_0x528c51['id']],_0x528c51);}}}return _0x3a2e0d[_0x0330('0x23')];};};Realtime[_0x0330('0x43')][_0x0330('0x54')]=function(){var _0x43bce7=this;return function(_0x125443){if(_0x125443){freeIsNotKey(_0x125443,_0x43bce7[_0x0330('0x24')],'id');for(var _0x166059=0x0,_0x460dfb={},_0x436456={};_0x166059<_0x125443[_0x0330('0x45')];_0x166059+=0x1){_0x460dfb=_0x125443[_0x166059];if(_[_0x0330('0x46')](_0x43bce7[_0x0330('0x24')][_0x460dfb['id']])){_0x43bce7[_0x0330('0x24')][_0x460dfb['id']]=new ServicenowAccount(_0x460dfb);}else{_0x43bce7[_0x0330('0x42')](_0x43bce7['servicenowAccounts'][_0x460dfb['id']],_0x460dfb);}}}return _0x43bce7['servicenowAccounts'];};};Realtime[_0x0330('0x43')][_0x0330('0x55')]=function(){var _0x8702b3=this;return function(_0x2de879){if(_0x2de879){freeIsNotKey(_0x2de879,_0x8702b3[_0x0330('0x56')],'id');for(var _0x34c82=0x0,_0x1a03a0={},_0x248a71={};_0x34c82<_0x2de879[_0x0330('0x45')];_0x34c82+=0x1){_0x1a03a0=_0x2de879[_0x34c82];if(_['isUndefined'](_0x8702b3[_0x0330('0x56')][_0x1a03a0['id']])){_0x8702b3['dynamics365Accounts'][_0x1a03a0['id']]=new Dynamics365Account(_0x1a03a0);}else{_0x8702b3[_0x0330('0x42')](_0x8702b3[_0x0330('0x56')][_0x1a03a0['id']],_0x1a03a0);}}}return _0x8702b3[_0x0330('0x56')];};};Realtime[_0x0330('0x43')]['initFreshsalesAccounts']=function(){var _0x45b35f=this;return function(_0xac2c21){if(_0xac2c21){freeIsNotKey(_0xac2c21,_0x45b35f['freshsalesAccounts'],'id');for(var _0x31dee9=0x0,_0x137660={},_0x5c041a={};_0x31dee9<_0xac2c21['length'];_0x31dee9+=0x1){_0x137660=_0xac2c21[_0x31dee9];if(_[_0x0330('0x46')](_0x45b35f['freshsalesAccounts'][_0x137660['id']])){_0x45b35f[_0x0330('0x25')][_0x137660['id']]=new FreshsalesAccount(_0x137660);}else{_0x45b35f[_0x0330('0x42')](_0x45b35f[_0x0330('0x25')][_0x137660['id']],_0x137660);}}}return _0x45b35f[_0x0330('0x25')];};};Realtime[_0x0330('0x43')][_0x0330('0x57')]=function(){var _0x4e9282=this;return function(_0x2f6816){for(var _0x4eca43=0x0;_0x4eca43<_0x2f6816['length'];_0x4eca43+=0x1){_[_0x0330('0x58')](_0x4e9282[_0x0330('0x16')][_0x2f6816[_0x4eca43][_0x0330('0x2a')]],_0x2f6816[_0x4eca43]);}return _0x4e9282[_0x0330('0x16')];};};Realtime[_0x0330('0x43')][_0x0330('0x59')]=function(){var _0x3f2659=this;return function(_0x11c407){clearVoiceQueues(_0x3f2659[_0x0330('0x16')]);if(_0x11c407){_0x11c407=_[_0x0330('0x5a')](_0x11c407,_0x0330('0x5b'));for(var _0x5b24ab in _0x11c407){if(_0x11c407['hasOwnProperty'](_0x5b24ab)){var _0x258d19={};for(var _0x339b14=0x0;_0x339b14<_0x11c407[_0x5b24ab]['length'];_0x339b14+=0x1){var _0x1b5358=_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x5c')];if(_0x3f2659[_0x0330('0x16')][_0x1b5358]){if(_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x5d')]){_0x3f2659[_0x0330('0x16')][_0x1b5358][_0x0330('0x35')]+=0x1;}if(_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x5e')]){_0x3f2659['voiceQueues'][_0x1b5358][_0x0330('0x5f')]+=0x1;}_0x3f2659['voiceQueues'][_0x1b5358][_0x0330('0x30')]+=moment(_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x60')])['diff'](moment(_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x61')]),_0x0330('0x62'))||0x0;if(_0x339b14===_0x11c407[_0x5b24ab][_0x0330('0x45')]-0x1){_0x3f2659['voiceQueues'][_0x1b5358][_0x0330('0x31')]+=moment(_0x11c407[_0x5b24ab][_0x339b14]['queuecallercompleteAt']||_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x63')]||_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x64')])['diff'](moment(_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x61')]),_0x0330('0x62'))||0x0;_0x3f2659[_0x0330('0x16')][_0x1b5358][_0x0330('0x2e')]+=0x1;if(_0x11c407[_0x5b24ab][_0x339b14]['queuecallercomplete']){_0x3f2659[_0x0330('0x16')][_0x1b5358][_0x0330('0x2f')]+=0x1;_0x3f2659[_0x0330('0x16')][_0x1b5358][_0x0330('0x36')]+=moment(_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x65')])[_0x0330('0x66')](moment(_0x11c407[_0x5b24ab][_0x339b14][_0x0330('0x60')]),'seconds')||0x0;}}else{_0x3f2659[_0x0330('0x16')][_0x1b5358][_0x0330('0x31')]+=_0x3f2659['voiceQueues'][_0x1b5358][_0x0330('0x30')]||0x0;}}}}}}return _0x3f2659[_0x0330('0x16')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x4dbf78=this;return function(_0x4a86e2){clearVoiceCallReports(_0x4dbf78[_0x0330('0x19')]);if(_0x4a86e2){for(var _0x597abb=0x0;_0x597abb<_0x4a86e2[_0x0330('0x45')];_0x597abb+=0x1){_0x4dbf78[_0x0330('0x19')][_0x0330('0x2e')]+=0x1;_0x4dbf78[_0x0330('0x19')][_0x0330('0x31')]+=_0x4a86e2[_0x597abb]['duration'];if(_0x4a86e2[_0x597abb][_0x0330('0x67')]===_0x0330('0x68')){_0x4dbf78[_0x0330('0x19')][_0x0330('0x2f')]+=0x1;_0x4dbf78[_0x0330('0x19')]['sumHoldTime']+=_0x4a86e2[_0x597abb][_0x0330('0x69')]-_0x4a86e2[_0x597abb][_0x0330('0x6a')]||0x0;_0x4dbf78[_0x0330('0x19')]['sumBillable']+=_0x4a86e2[_0x597abb]['billableseconds'];}}}return _0x4dbf78[_0x0330('0x19')];};};Realtime[_0x0330('0x43')][_0x0330('0x6b')]=function(){var _0xb70d3b=this;return function(_0x1a801){if(_0x1a801){freeIsNotKey(_0x1a801,_0xb70d3b[_0x0330('0x6c')],_0x0330('0x2a'));for(var _0x13b8a0=0x0,_0x16ef40={};_0x13b8a0<_0x1a801[_0x0330('0x45')];_0x13b8a0+=0x1){_0x16ef40=_0x1a801[_0x13b8a0];if(_[_0x0330('0x46')](_0xb70d3b[_0x0330('0x6c')][_0x16ef40['name']])){_0xb70d3b[_0x0330('0x6c')][_0x16ef40[_0x0330('0x2a')]]=new Campaign(_0x16ef40);}else{_0xb70d3b[_0x0330('0x42')](_0xb70d3b[_0x0330('0x6c')][_0x16ef40['name']],_0x16ef40);_0xb70d3b['campaigns'][_0x16ef40[_0x0330('0x2a')]][_0x0330('0x6d')]=_0x16ef40['SquareProject']?_0x16ef40[_0x0330('0x6e')][_0x0330('0x2a')]:undefined;}}}return _0xb70d3b['campaigns'];};};Realtime[_0x0330('0x43')][_0x0330('0x6f')]=function(){var _0x4f09d1=this;return function(_0x8abc70){if(_0x8abc70){freeIsNotKey(_0x8abc70,_0x4f09d1[_0x0330('0x1a')],'id');for(var _0x28f7f2=0x0,_0x3f72f3={};_0x28f7f2<_0x8abc70[_0x0330('0x45')];_0x28f7f2+=0x1){_0x3f72f3=_0x8abc70[_0x28f7f2];if(_[_0x0330('0x46')](_0x4f09d1[_0x0330('0x1a')][_0x3f72f3['id']])){_0x4f09d1[_0x0330('0x1a')][_0x3f72f3['id']]=new VoiceExtension(_0x3f72f3);}else{_0x4f09d1[_0x0330('0x42')](_0x4f09d1['voiceExtensions'][_0x3f72f3['id']],_0x3f72f3);}}}return _0x4f09d1[_0x0330('0x1a')];};};Realtime[_0x0330('0x43')][_0x0330('0x70')]=function(){var _0x175731=this;return function(_0x46d464){clearCampaigns(_0x175731[_0x0330('0x6c')]);for(var _0x33fa7c=0x0;_0x33fa7c<_0x46d464[_0x0330('0x45')];_0x33fa7c+=0x1){_[_0x0330('0x58')](_0x175731['campaigns'][_0x46d464[_0x33fa7c][_0x0330('0x2a')]],_0x46d464[_0x33fa7c]);}return _0x175731[_0x0330('0x6c')];};};Realtime[_0x0330('0x43')][_0x0330('0x71')]=function(){var _0x23dabf=this;return function(_0x565fc1){if(_0x565fc1){freeIsNotKey(_0x565fc1,_0x23dabf['faxAccounts'],'id');for(var _0x59dbe8=0x0,_0x9e74b9={},_0x5a98eb={};_0x59dbe8<_0x565fc1[_0x0330('0x45')];_0x59dbe8+=0x1){_0x9e74b9=_0x565fc1[_0x59dbe8];if(_['isUndefined'](_0x23dabf['faxAccounts'][_0x9e74b9['id']])){_0x23dabf[_0x0330('0x26')][_0x9e74b9['id']]=new FaxAccount(_0x9e74b9);}else{_0x23dabf[_0x0330('0x42')](_0x23dabf[_0x0330('0x26')][_0x9e74b9['id']],_0x9e74b9);}}}return _0x23dabf[_0x0330('0x26')];};};module[_0x0330('0x72')]=Realtime; \ No newline at end of file +var _0x7a49=['format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','unmanaged','queuecallerabandon','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a49,0xaf));var _0x97a4=function(_0x4b3716,_0x4d4700){_0x4b3716=_0x4b3716-0x0;var _0x20a06a=_0x7a49[_0x4b3716];return _0x20a06a;};'use strict';var BPromise=require('bluebird');var util=require(_0x97a4('0x0'));var _=require(_0x97a4('0x1'));var moment=require(_0x97a4('0x2'));var Agent=require(_0x97a4('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x97a4('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x97a4('0x5'));var Template=require(_0x97a4('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x97a4('0x7'));var ZendeskAccount=require(_0x97a4('0x8'));var SalesforceAccount=require(_0x97a4('0x9'));var FreshdeskAccount=require(_0x97a4('0xa'));var SugarcrmAccount=require(_0x97a4('0xb'));var ZohoAccount=require(_0x97a4('0xc'));var DeskAccount=require(_0x97a4('0xd'));var VtigerAccount=require(_0x97a4('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x97a4('0xf'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x97a4('0x10'));var Realtime=function(){this[_0x97a4('0x11')]={};this[_0x97a4('0x12')]={};this[_0x97a4('0x13')]={};this['voiceQueues']={};this[_0x97a4('0x14')]={};this[_0x97a4('0x15')]={};this[_0x97a4('0x16')]={};this[_0x97a4('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x97a4('0x18')]={};this[_0x97a4('0x19')]={};this[_0x97a4('0x1a')]={};this['outboundChannels']={};this['timers']={};this[_0x97a4('0x1b')]={};this[_0x97a4('0x1c')]={};this[_0x97a4('0x1d')]={};this[_0x97a4('0x1e')]={};this[_0x97a4('0x1f')]={};this[_0x97a4('0x20')]={};this[_0x97a4('0x21')]={};this[_0x97a4('0x22')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0x97a4('0x23')]={};this[_0x97a4('0x24')]={};};function freeIsNotKey(_0x2987b2,_0x1b4ffe,_0x1f950c){var _0x4091b3=_[_0x97a4('0x25')](_0x2987b2,function(_0x52d4e2,_0x14d98b){return _0x52d4e2[_0x1f950c];});for(var _0x2c2abc in _0x1b4ffe){if(_0x1b4ffe[_0x97a4('0x26')](_0x2c2abc)){if(!_0x4091b3[_0x2c2abc]){delete _0x1b4ffe[_0x2c2abc];}}}}function freeIsNotKeySip(_0x15740e,_0x521b72){var _0x185f07=_[_0x97a4('0x25')](_0x15740e,function(_0x3ba88f,_0x370a51){return util[_0x97a4('0x27')](_0x97a4('0x28'),_0x3ba88f[_0x97a4('0x29')]);});for(var _0x247124 in _0x521b72){if(_0x521b72[_0x97a4('0x26')](_0x247124)){if(!_0x185f07[_0x247124]){delete _0x521b72[_0x247124];}}}}function freeIsNotKeyAgent(_0x4a6c52,_0x90d7a){var _0x245f42=_[_0x97a4('0x25')](_0x4a6c52,function(_0x386f94,_0x35c784){var _0x1c2f88=_[_0x97a4('0x2a')](_0x386f94[_0x97a4('0x2b')])?util[_0x97a4('0x27')](_0x97a4('0x28'),_0x386f94[_0x97a4('0x29')]):_0x386f94[_0x97a4('0x2b')];return _0x1c2f88;});for(var _0x536a08 in _0x90d7a){if(_0x90d7a[_0x97a4('0x26')](_0x536a08)){if(!_0x245f42[_0x536a08]){delete _0x90d7a[_0x536a08];}}}}function clearVoiceCallReports(_0x4fcb3c){_0x4fcb3c[_0x97a4('0x2c')]=0x0;_0x4fcb3c[_0x97a4('0x2d')]=0x0;_0x4fcb3c[_0x97a4('0x2e')]=0x0;_0x4fcb3c[_0x97a4('0x2f')]=0x0;_0x4fcb3c['sumBillable']=0x0;}function clearCampaigns(_0x11c1be){if(!_['isEmpty'](_0x11c1be)){for(var _0x227083 in _0x11c1be){if(_0x11c1be[_0x97a4('0x26')](_0x227083)){_0x11c1be[_0x227083][_0x97a4('0x30')]=0x0;_0x11c1be[_0x227083]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5e0895){if(!_[_0x97a4('0x31')](_0x5e0895)){for(var _0x35d028 in _0x5e0895){if(_0x5e0895[_0x97a4('0x26')](_0x35d028)){_0x5e0895[_0x35d028][_0x97a4('0x2c')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x2d')]=0x0;_0x5e0895[_0x35d028]['unmanaged']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x32')]=0x0;_0x5e0895[_0x35d028]['sumHoldTime']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x2f')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x33')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x34')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x35')]=0x0;_0x5e0895[_0x35d028]['outboundBusyCallsDay']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x36')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x37')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x38')]=0x0;_0x5e0895[_0x35d028]['outboundDropCallsDayTimeout']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x39')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3a')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3b')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3c')]=0x0;_0x5e0895[_0x35d028]['outboundReCallsDay']=0x0;_0x5e0895[_0x35d028][_0x97a4('0x34')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3d')]=0x0;_0x5e0895[_0x35d028][_0x97a4('0x3e')]=!![];}}}}Realtime[_0x97a4('0x3f')][_0x97a4('0x40')]=function(_0x197b83,_0x1b9cb3){for(var _0x569327 in _0x1b9cb3){if(_0x197b83[_0x97a4('0x26')](_0x569327)){_0x197b83[_0x569327]=_0x1b9cb3[_0x569327];}}};Realtime['prototype'][_0x97a4('0x41')]=function(){var _0x2d1323=this;return function(_0x5899d7){if(_0x5899d7){freeIsNotKeyAgent(_0x5899d7,_0x2d1323[_0x97a4('0x11')]);for(var _0x24d9b1=0x0,_0x39a3fc={},_0x5e18df={};_0x24d9b1<_0x5899d7['length'];_0x24d9b1+=0x1){_0x39a3fc=_0x5899d7[_0x24d9b1];var _0x21b2a8=_['isNil'](_0x39a3fc[_0x97a4('0x2b')])?util[_0x97a4('0x27')](_0x97a4('0x28'),_0x39a3fc['name']):_0x39a3fc[_0x97a4('0x2b')];if(_[_0x97a4('0x42')](_0x2d1323[_0x97a4('0x11')][_0x21b2a8])){_0x2d1323['agents'][_0x21b2a8]=new Agent(_0x39a3fc);}else{_0x2d1323[_0x97a4('0x40')](_0x2d1323[_0x97a4('0x11')][_0x21b2a8],_0x39a3fc);}}}return _0x2d1323[_0x97a4('0x11')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x43')]=function(){var _0x156e5e=this;return function(_0x4e42b){if(_0x4e42b){freeIsNotKeySip(_0x4e42b,_0x156e5e[_0x97a4('0x12')]);for(var _0x1dc0f8=0x0,_0x5b3d6f={},_0x4e71be={};_0x1dc0f8<_0x4e42b[_0x97a4('0x44')];_0x1dc0f8+=0x1){_0x5b3d6f=_0x4e42b[_0x1dc0f8];if(_[_0x97a4('0x42')](_0x156e5e[_0x97a4('0x12')][util['format'](_0x97a4('0x28'),_0x5b3d6f[_0x97a4('0x29')])])){_0x156e5e[_0x97a4('0x12')][util[_0x97a4('0x27')](_0x97a4('0x28'),_0x5b3d6f[_0x97a4('0x29')])]=new Telephone(_0x5b3d6f);}else{_0x156e5e['mergeFromDatabase'](_0x156e5e[_0x97a4('0x12')][util['format'](_0x97a4('0x28'),_0x5b3d6f[_0x97a4('0x29')])],_0x5b3d6f);}}}return _0x156e5e[_0x97a4('0x12')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x45')]=function(){var _0x1ee9fb=this;return function(_0x24d1c3){if(_0x24d1c3){freeIsNotKeySip(_0x24d1c3,_0x1ee9fb[_0x97a4('0x13')]);for(var _0xbe1cc0=0x0,_0x1136a7={},_0x1fe536={};_0xbe1cc0<_0x24d1c3['length'];_0xbe1cc0+=0x1){_0x1136a7=_0x24d1c3[_0xbe1cc0];if(_[_0x97a4('0x42')](_0x1ee9fb[_0x97a4('0x13')][util[_0x97a4('0x27')](_0x97a4('0x28'),_0x1136a7[_0x97a4('0x29')])])){_0x1ee9fb['trunks'][util[_0x97a4('0x27')]('SIP/%s',_0x1136a7['name'])]=new Trunk(_0x1136a7);}else{_0x1ee9fb[_0x97a4('0x40')](_0x1ee9fb['trunks'][util[_0x97a4('0x27')](_0x97a4('0x28'),_0x1136a7[_0x97a4('0x29')])],_0x1136a7);}}}return _0x1ee9fb[_0x97a4('0x13')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x46')]=function(){var _0x4f0d56=this;return function(_0x1b6f78){if(_0x1b6f78){freeIsNotKey(_0x1b6f78,_0x4f0d56['voiceQueues'],_0x97a4('0x29'));for(var _0x483176=0x0,_0x53e270={},_0x6ca10={};_0x483176<_0x1b6f78['length'];_0x483176+=0x1){_0x53e270=_0x1b6f78[_0x483176];if(_[_0x97a4('0x42')](_0x4f0d56[_0x97a4('0x47')][_0x53e270[_0x97a4('0x29')]])){_0x4f0d56[_0x97a4('0x47')][_0x53e270[_0x97a4('0x29')]]=new VoiceQueue(_0x53e270);}else{_0x4f0d56[_0x97a4('0x40')](_0x4f0d56['voiceQueues'][_0x53e270['name']],_0x53e270);}}}return _0x4f0d56['voiceQueues'];};};Realtime['prototype'][_0x97a4('0x48')]=function(){var _0x2fce7e=this;return function(_0x227460){if(_0x227460){freeIsNotKey(_0x227460,_0x2fce7e[_0x97a4('0x14')],'id');for(var _0x2f25dd=0x0,_0x2de58b={},_0x5386aa={};_0x2f25dd<_0x227460['length'];_0x2f25dd+=0x1){_0x2de58b=_0x227460[_0x2f25dd];if(_['isUndefined'](_0x2fce7e[_0x97a4('0x14')][_0x2de58b['id']])){_0x2fce7e[_0x97a4('0x14')][_0x2de58b['id']]=new Trigger(_0x2de58b);}else{_0x2fce7e[_0x97a4('0x40')](_0x2fce7e[_0x97a4('0x14')][_0x2de58b['id']],_0x2de58b);}}}return _0x2fce7e[_0x97a4('0x14')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x49')]=function(){var _0x1a82e8=this;return function(_0x86fff1){if(_0x86fff1){freeIsNotKey(_0x86fff1,_0x1a82e8['templates'],'id');for(var _0x5e34ee=0x0,_0x4ae751={},_0x164e3b={};_0x5e34ee<_0x86fff1['length'];_0x5e34ee+=0x1){_0x4ae751=_0x86fff1[_0x5e34ee];if(_[_0x97a4('0x42')](_0x1a82e8[_0x97a4('0x16')][_0x4ae751['id']])){_0x1a82e8[_0x97a4('0x16')][_0x4ae751['id']]=new Template(_0x4ae751);}else{_0x1a82e8[_0x97a4('0x40')](_0x1a82e8[_0x97a4('0x16')][_0x4ae751['id']],_0x4ae751);}}}return _0x1a82e8[_0x97a4('0x16')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x4a')]=function(){var _0x1a795b=this;return function(_0x460f25){if(_0x460f25){freeIsNotKey(_0x460f25,_0x1a795b[_0x97a4('0x1c')],'id');for(var _0x32be15=0x0,_0x20283e={},_0x58f286={};_0x32be15<_0x460f25[_0x97a4('0x44')];_0x32be15+=0x1){_0x20283e=_0x460f25[_0x32be15];if(_['isUndefined'](_0x1a795b[_0x97a4('0x1c')][_0x20283e['id']])){_0x1a795b[_0x97a4('0x1c')][_0x20283e['id']]=new ZendeskAccount(_0x20283e);}else{_0x1a795b[_0x97a4('0x40')](_0x1a795b['zendeskAccounts'][_0x20283e['id']],_0x20283e);}}}return _0x1a795b[_0x97a4('0x1c')];};};Realtime['prototype'][_0x97a4('0x4b')]=function(){var _0x30db61=this;return function(_0x448d2a){if(_0x448d2a){freeIsNotKey(_0x448d2a,_0x30db61[_0x97a4('0x1d')],'id');for(var _0x34ed91=0x0,_0x12da0b={},_0x75c6f1={};_0x34ed91<_0x448d2a[_0x97a4('0x44')];_0x34ed91+=0x1){_0x12da0b=_0x448d2a[_0x34ed91];if(_['isUndefined'](_0x30db61['salesforceAccounts'][_0x12da0b['id']])){_0x30db61[_0x97a4('0x1d')][_0x12da0b['id']]=new SalesforceAccount(_0x12da0b);}else{_0x30db61[_0x97a4('0x40')](_0x30db61['salesforceAccounts'][_0x12da0b['id']],_0x12da0b);}}}return _0x30db61[_0x97a4('0x1d')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x45bd1e=this;return function(_0xdb676a){if(_0xdb676a){freeIsNotKey(_0xdb676a,_0x45bd1e['freshdeskAccounts'],'id');for(var _0x5351c3=0x0,_0x391dea={},_0x24a831={};_0x5351c3<_0xdb676a['length'];_0x5351c3+=0x1){_0x391dea=_0xdb676a[_0x5351c3];if(_[_0x97a4('0x42')](_0x45bd1e['freshdeskAccounts'][_0x391dea['id']])){_0x45bd1e['freshdeskAccounts'][_0x391dea['id']]=new FreshdeskAccount(_0x391dea);}else{_0x45bd1e[_0x97a4('0x40')](_0x45bd1e[_0x97a4('0x1f')][_0x391dea['id']],_0x391dea);}}}return _0x45bd1e['freshdeskAccounts'];};};Realtime['prototype'][_0x97a4('0x4c')]=function(){var _0x3e3fd2=this;return function(_0x581ee6){if(_0x581ee6){freeIsNotKey(_0x581ee6,_0x3e3fd2[_0x97a4('0x20')],'id');for(var _0x16d67d=0x0,_0x2d3d3e={},_0x5c49bb={};_0x16d67d<_0x581ee6[_0x97a4('0x44')];_0x16d67d+=0x1){_0x2d3d3e=_0x581ee6[_0x16d67d];if(_[_0x97a4('0x42')](_0x3e3fd2[_0x97a4('0x20')][_0x2d3d3e['id']])){_0x3e3fd2[_0x97a4('0x20')][_0x2d3d3e['id']]=new ZohoAccount(_0x2d3d3e);}else{_0x3e3fd2[_0x97a4('0x40')](_0x3e3fd2[_0x97a4('0x20')][_0x2d3d3e['id']],_0x2d3d3e);}}}return _0x3e3fd2[_0x97a4('0x20')];};};Realtime[_0x97a4('0x3f')]['initDeskAccounts']=function(){var _0x10c6c4=this;return function(_0x231db7){if(_0x231db7){freeIsNotKey(_0x231db7,_0x10c6c4[_0x97a4('0x21')],'id');for(var _0x17f9d6=0x0,_0x4f0365={},_0x530347={};_0x17f9d6<_0x231db7[_0x97a4('0x44')];_0x17f9d6+=0x1){_0x4f0365=_0x231db7[_0x17f9d6];if(_['isUndefined'](_0x10c6c4[_0x97a4('0x21')][_0x4f0365['id']])){_0x10c6c4[_0x97a4('0x21')][_0x4f0365['id']]=new DeskAccount(_0x4f0365);}else{_0x10c6c4[_0x97a4('0x40')](_0x10c6c4[_0x97a4('0x21')][_0x4f0365['id']],_0x4f0365);}}}return _0x10c6c4[_0x97a4('0x21')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x4d')]=function(){var _0x3aa52d=this;return function(_0x4c9211){if(_0x4c9211){freeIsNotKey(_0x4c9211,_0x3aa52d[_0x97a4('0x1e')],'id');for(var _0x2cd5bb=0x0,_0x20c4bf={},_0x3f52c9={};_0x2cd5bb<_0x4c9211[_0x97a4('0x44')];_0x2cd5bb+=0x1){_0x20c4bf=_0x4c9211[_0x2cd5bb];if(_[_0x97a4('0x42')](_0x3aa52d[_0x97a4('0x1e')][_0x20c4bf['id']])){_0x3aa52d['sugarcrmAccounts'][_0x20c4bf['id']]=new SugarcrmAccount(_0x20c4bf);}else{_0x3aa52d[_0x97a4('0x40')](_0x3aa52d['sugarcrmAccounts'][_0x20c4bf['id']],_0x20c4bf);}}}return _0x3aa52d['sugarcrmAccounts'];};};Realtime['prototype'][_0x97a4('0x4e')]=function(){var _0x3da3ef=this;return function(_0x552ca8){if(_0x552ca8){freeIsNotKey(_0x552ca8,_0x3da3ef[_0x97a4('0x22')],'id');for(var _0x33fb26=0x0,_0x444d49={},_0xac67d={};_0x33fb26<_0x552ca8[_0x97a4('0x44')];_0x33fb26+=0x1){_0x444d49=_0x552ca8[_0x33fb26];if(_[_0x97a4('0x42')](_0x3da3ef[_0x97a4('0x22')][_0x444d49['id']])){_0x3da3ef[_0x97a4('0x22')][_0x444d49['id']]=new VtigerAccount(_0x444d49);}else{_0x3da3ef[_0x97a4('0x40')](_0x3da3ef[_0x97a4('0x22')][_0x444d49['id']],_0x444d49);}}}return _0x3da3ef['vtigerAccounts'];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x4f')]=function(){var _0x52f4f0=this;return function(_0x3ac2e7){if(_0x3ac2e7){freeIsNotKey(_0x3ac2e7,_0x52f4f0['servicenowAccounts'],'id');for(var _0x539922=0x0,_0x2c2629={},_0x4addfb={};_0x539922<_0x3ac2e7[_0x97a4('0x44')];_0x539922+=0x1){_0x2c2629=_0x3ac2e7[_0x539922];if(_['isUndefined'](_0x52f4f0[_0x97a4('0x50')][_0x2c2629['id']])){_0x52f4f0['servicenowAccounts'][_0x2c2629['id']]=new ServicenowAccount(_0x2c2629);}else{_0x52f4f0[_0x97a4('0x40')](_0x52f4f0[_0x97a4('0x50')][_0x2c2629['id']],_0x2c2629);}}}return _0x52f4f0[_0x97a4('0x50')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x51')]=function(){var _0x1c70ce=this;return function(_0x686b7e){if(_0x686b7e){freeIsNotKey(_0x686b7e,_0x1c70ce[_0x97a4('0x52')],'id');for(var _0xbcd24f=0x0,_0x5a0a72={},_0x21a328={};_0xbcd24f<_0x686b7e['length'];_0xbcd24f+=0x1){_0x5a0a72=_0x686b7e[_0xbcd24f];if(_[_0x97a4('0x42')](_0x1c70ce[_0x97a4('0x52')][_0x5a0a72['id']])){_0x1c70ce['dynamics365Accounts'][_0x5a0a72['id']]=new Dynamics365Account(_0x5a0a72);}else{_0x1c70ce[_0x97a4('0x40')](_0x1c70ce[_0x97a4('0x52')][_0x5a0a72['id']],_0x5a0a72);}}}return _0x1c70ce[_0x97a4('0x52')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x53')]=function(){var _0x2a30cf=this;return function(_0x495ffc){if(_0x495ffc){freeIsNotKey(_0x495ffc,_0x2a30cf[_0x97a4('0x23')],'id');for(var _0x40001b=0x0,_0x51f37e={},_0x4450c3={};_0x40001b<_0x495ffc[_0x97a4('0x44')];_0x40001b+=0x1){_0x51f37e=_0x495ffc[_0x40001b];if(_[_0x97a4('0x42')](_0x2a30cf[_0x97a4('0x23')][_0x51f37e['id']])){_0x2a30cf['freshsalesAccounts'][_0x51f37e['id']]=new FreshsalesAccount(_0x51f37e);}else{_0x2a30cf[_0x97a4('0x40')](_0x2a30cf[_0x97a4('0x23')][_0x51f37e['id']],_0x51f37e);}}}return _0x2a30cf[_0x97a4('0x23')];};};Realtime[_0x97a4('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x1c8031=this;return function(_0x24dc24){for(var _0x5f0fce=0x0;_0x5f0fce<_0x24dc24['length'];_0x5f0fce+=0x1){_[_0x97a4('0x54')](_0x1c8031['voiceQueues'][_0x24dc24[_0x5f0fce][_0x97a4('0x29')]],_0x24dc24[_0x5f0fce]);}return _0x1c8031[_0x97a4('0x47')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x55')]=function(){var _0x31fa27=this;return function(_0x3011a6){clearVoiceQueues(_0x31fa27[_0x97a4('0x47')]);if(_0x3011a6){_0x3011a6=_[_0x97a4('0x56')](_0x3011a6,'uniqueid');for(var _0x211429 in _0x3011a6){if(_0x3011a6[_0x97a4('0x26')](_0x211429)){var _0x30ff12={};for(var _0x5d4a03=0x0;_0x5d4a03<_0x3011a6[_0x211429]['length'];_0x5d4a03+=0x1){var _0x59b569=_0x3011a6[_0x211429][_0x5d4a03]['queue'];if(_0x31fa27[_0x97a4('0x47')][_0x59b569]){if(_0x3011a6[_0x211429][_0x5d4a03]['queuecallerexit']){_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x57')]+=0x1;}if(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x58')]){_0x31fa27['voiceQueues'][_0x59b569][_0x97a4('0x32')]+=0x1;}_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x2e')]+=moment(_0x3011a6[_0x211429][_0x5d4a03]['queuecallerleaveAt'])['diff'](moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x59')]),'seconds')||0x0;if(_0x5d4a03===_0x3011a6[_0x211429][_0x97a4('0x44')]-0x1){_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x2f')]+=moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5a')]||_0x3011a6[_0x211429][_0x5d4a03]['queuecallerabandonAt']||_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5b')])['diff'](moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x59')]),_0x97a4('0x5c'))||0x0;_0x31fa27['voiceQueues'][_0x59b569][_0x97a4('0x2c')]+=0x1;if(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5d')]){_0x31fa27['voiceQueues'][_0x59b569][_0x97a4('0x2d')]+=0x1;_0x31fa27[_0x97a4('0x47')][_0x59b569]['sumBillable']+=moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5a')])['diff'](moment(_0x3011a6[_0x211429][_0x5d4a03][_0x97a4('0x5e')]),_0x97a4('0x5c'))||0x0;}}else{_0x31fa27[_0x97a4('0x47')][_0x59b569][_0x97a4('0x2f')]+=_0x31fa27[_0x97a4('0x47')][_0x59b569]['sumHoldTime']||0x0;}}}}}}return _0x31fa27[_0x97a4('0x47')];};};Realtime['prototype'][_0x97a4('0x5f')]=function(){var _0x47ec7d=this;return function(_0x48dae9){clearVoiceCallReports(_0x47ec7d['outbound']);if(_0x48dae9){for(var _0x4c08c2=0x0;_0x4c08c2<_0x48dae9['length'];_0x4c08c2+=0x1){_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2c')]+=0x1;_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2f')]+=_0x48dae9[_0x4c08c2][_0x97a4('0x60')];if(_0x48dae9[_0x4c08c2][_0x97a4('0x61')]===_0x97a4('0x62')){_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2d')]+=0x1;_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x2e')]+=_0x48dae9[_0x4c08c2][_0x97a4('0x60')]-_0x48dae9[_0x4c08c2]['billableseconds']||0x0;_0x47ec7d[_0x97a4('0x17')][_0x97a4('0x33')]+=_0x48dae9[_0x4c08c2][_0x97a4('0x63')];}}}return _0x47ec7d[_0x97a4('0x17')];};};Realtime['prototype'][_0x97a4('0x64')]=function(){var _0x86a9f6=this;return function(_0x3dcec8){if(_0x3dcec8){freeIsNotKey(_0x3dcec8,_0x86a9f6[_0x97a4('0x15')],_0x97a4('0x29'));for(var _0x8a2aca=0x0,_0x1fd308={};_0x8a2aca<_0x3dcec8['length'];_0x8a2aca+=0x1){_0x1fd308=_0x3dcec8[_0x8a2aca];if(_[_0x97a4('0x42')](_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]])){_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]]=new Campaign(_0x1fd308);}else{_0x86a9f6[_0x97a4('0x40')](_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]],_0x1fd308);_0x86a9f6[_0x97a4('0x15')][_0x1fd308[_0x97a4('0x29')]][_0x97a4('0x65')]=_0x1fd308['SquareProject']?_0x1fd308[_0x97a4('0x66')][_0x97a4('0x29')]:undefined;}}}return _0x86a9f6[_0x97a4('0x15')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x67')]=function(){var _0x56d61b=this;return function(_0x5ac730){if(_0x5ac730){freeIsNotKey(_0x5ac730,_0x56d61b[_0x97a4('0x18')],'id');for(var _0xf2f2c9=0x0,_0x22bc71={};_0xf2f2c9<_0x5ac730[_0x97a4('0x44')];_0xf2f2c9+=0x1){_0x22bc71=_0x5ac730[_0xf2f2c9];if(_['isUndefined'](_0x56d61b[_0x97a4('0x18')][_0x22bc71['id']])){_0x56d61b['voiceExtensions'][_0x22bc71['id']]=new VoiceExtension(_0x22bc71);}else{_0x56d61b[_0x97a4('0x40')](_0x56d61b[_0x97a4('0x18')][_0x22bc71['id']],_0x22bc71);}}}return _0x56d61b['voiceExtensions'];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x68')]=function(){var _0x4bb423=this;return function(_0x1d7d73){clearCampaigns(_0x4bb423[_0x97a4('0x15')]);for(var _0x1ad36e=0x0;_0x1ad36e<_0x1d7d73[_0x97a4('0x44')];_0x1ad36e+=0x1){_[_0x97a4('0x54')](_0x4bb423[_0x97a4('0x15')][_0x1d7d73[_0x1ad36e]['name']],_0x1d7d73[_0x1ad36e]);}return _0x4bb423[_0x97a4('0x15')];};};Realtime[_0x97a4('0x3f')][_0x97a4('0x69')]=function(){var _0x31ffab=this;return function(_0x128185){if(_0x128185){freeIsNotKey(_0x128185,_0x31ffab[_0x97a4('0x24')],'id');for(var _0x546951=0x0,_0x222300={},_0x52b6fe={};_0x546951<_0x128185[_0x97a4('0x44')];_0x546951+=0x1){_0x222300=_0x128185[_0x546951];if(_['isUndefined'](_0x31ffab['faxAccounts'][_0x222300['id']])){_0x31ffab['faxAccounts'][_0x222300['id']]=new FaxAccount(_0x222300);}else{_0x31ffab[_0x97a4('0x40')](_0x31ffab[_0x97a4('0x24')][_0x222300['id']],_0x222300);}}}return _0x31ffab['faxAccounts'];};};module[_0x97a4('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1666191..443ae4a 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 _0x62c2=['createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','mobile','phone','indexOf','lastIndexOf','transfererlinkedid','exports','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','calleridnum','outbound','internal','destination','exten','type','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','split','membername','monitorFilename','monitors'];(function(_0xe91147,_0x6b9e99){var _0x1e84ad=function(_0x41f3db){while(--_0x41f3db){_0xe91147['push'](_0xe91147['shift']());}};_0x1e84ad(++_0x6b9e99);}(_0x62c2,0x68));var _0x262c=function(_0x1d2325,_0x225054){_0x1d2325=_0x1d2325-0x0;var _0xf240b7=_0x62c2[_0x1d2325];return _0xf240b7;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x262c('0x0'));var config=require(_0x262c('0x1'));var ami=require(_0x262c('0x2'));var RpcVoiceAgentReport=require(_0x262c('0x3'));var RpcVoiceCallReport=require(_0x262c('0x4'));var RpcVoiceDialReport=require(_0x262c('0x5'));var RpcMemberReport=require(_0x262c('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x262c('0x7'));var RpcVoiceTransferReport=require(_0x262c('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x262c('0x9'));var VoiceAgentReport=require(_0x262c('0xa'));var VoiceDialReport=require(_0x262c('0xb'));var UserReport=require('./userReport');function Report(_0x4b977c){this[_0x262c('0xc')]=_0x4b977c;this['agents']=_0x4b977c[_0x262c('0xd')];this['telephones']=_0x4b977c[_0x262c('0xe')];}Report[_0x262c('0xf')]['sync']=function(_0x4ce2fe){var _0x3add5f=new VoiceQueueReport(this[_0x262c('0xc')]);var _0x10fe53=new VoiceAgentReport(this[_0x262c('0xc')]);var _0x5353c2=new VoiceDialReport(this['realtime']);var _0x61b6d2=new VoiceCallReport(this[_0x262c('0xc')]);var _0x7e1688=new UserReport(this[_0x262c('0xc')]);if(config[_0x262c('0x10')]&&config[_0x262c('0x10')][_0x262c('0x11')]){ami['on'](_0x262c('0x12'),this[_0x262c('0x13')][_0x262c('0x14')](this));ami['on'](_0x262c('0x15'),this[_0x262c('0x16')][_0x262c('0x14')](this));ami['on'](_0x262c('0x17'),this[_0x262c('0x18')][_0x262c('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x262c('0x19')][_0x262c('0x14')](this));ami['on'](_0x262c('0x1a'),this[_0x262c('0x1b')][_0x262c('0x14')](this));ami['on'](_0x262c('0x1c'),this[_0x262c('0x1d')][_0x262c('0x14')](this));}};Report[_0x262c('0xf')][_0x262c('0x1e')]=function(_0x4bd1e8){var _0x4422a2;_0x4422a2=_[_0x262c('0x1f')](this[_0x262c('0xd')],function(_0x7a0cb9){return _0x7a0cb9[_0x262c('0x20')]==_0x4bd1e8||_0x7a0cb9[_0x262c('0x21')]==_0x4bd1e8;});if(_[_0x262c('0x22')](_0x4422a2)){var _0x4ce3d4=_['find'](this[_0x262c('0xe')],function(_0x586525){return _0x586525[_0x262c('0x20')]==_0x4bd1e8||_0x586525[_0x262c('0x21')]==_0x4bd1e8;});if(_0x4ce3d4){_0x4422a2=_[_0x262c('0x1f')](this[_0x262c('0xd')],function(_0x292baf){return _0x292baf[_0x262c('0x23')]==util[_0x262c('0x24')](_0x262c('0x25'),_0x4ce3d4[_0x262c('0x21')]);});}}return _0x4422a2;};Report['prototype'][_0x262c('0x13')]=function(_0x369b8c){for(var _0x3fef25=0x0;_0x3fef25<_0x369b8c[_0x262c('0x26')];_0x3fef25+=0x1){var _0x2c414e=this[_0x262c('0x1e')](_0x369b8c[_0x3fef25][_0x262c('0x27')]);if(_0x2c414e){_0x369b8c[_0x3fef25][_0x262c('0x20')]=_0x2c414e[_0x262c('0x20')];_0x369b8c[_0x3fef25][_0x262c('0x28')]=!![];_0x369b8c[_0x3fef25]['lastAssignedTo']=_0x2c414e[_0x262c('0x21')];_0x369b8c[_0x3fef25]['interface']=_[_0x262c('0x22')](_0x2c414e[_0x262c('0x23')])?util[_0x262c('0x24')](_0x262c('0x25'),_0x2c414e['name']):_0x2c414e[_0x262c('0x23')];if(_0x369b8c[_0x3fef25][_0x262c('0x29')]){_0x369b8c[_0x3fef25][_0x262c('0x2a')]=moment()[_0x262c('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x369b8c[_0x3fef25][_0x262c('0x2b')]){_0x369b8c[_0x3fef25][_0x262c('0x2c')]=moment()[_0x262c('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x262c('0x13')](_0x369b8c[_0x3fef25]);}RpcVoiceQueueReport[_0x262c('0x2d')](_0x369b8c[_0x3fef25]);}};function extractCalleridNumber(_0x72384a){var _0x3a5175=_0x72384a[_0x262c('0x2e')](/<(.*?)>/);return _0x3a5175?_0x3a5175[0x1]:_0x72384a;}Report[_0x262c('0xf')][_0x262c('0x2f')]=function(_0x19167f){for(var _0x4ec758=0x0;_0x4ec758',_0x569d63['calleridname'],_0x569d63[_0x262c('0x30')]);}if(RpcVoiceTransferReport[_0x262c('0x42')][_0x569d63['linkedid']]){var _0x7fc880=RpcVoiceTransferReport['transfers'][_0x569d63[_0x262c('0x43')]];_0x7fc880[_0x262c('0x44')]=_0x569d63[_0x262c('0x45')];RpcVoiceTransferReport[_0x262c('0x1b')](_0x7fc880);delete RpcVoiceTransferReport[_0x262c('0x42')][_0x569d63['linkedid']];}if(_[_0x262c('0x22')](_0x569d63[_0x262c('0x35')])){_0x569d63[_0x262c('0x35')]=this[_0x262c('0x46')](_0x569d63);}if(_[_0x262c('0x22')](_0x569d63[_0x262c('0x47')])){var _0x3bb06f=_0x569d63[_0x262c('0x3f')][_0x262c('0x48')]('-')[0x0];var _0x2892f9=this[_0x262c('0xd')][_0x3bb06f];if(!_0x2892f9)_0x2892f9=this[_0x262c('0x2f')](_0x569d63[_0x262c('0x20')]);if(_0x2892f9){_0x569d63[_0x262c('0x47')]=_0x2892f9['id'];_0x569d63[_0x262c('0x49')]=_0x2892f9[_0x262c('0x21')];}}RpcVoiceCallReport[_0x262c('0x2d')](_0x569d63);if(_0x569d63['monitor']){for(var _0x1359b0=0x0;_0x1359b0<_0x569d63['monitors'][_0x262c('0x26')];_0x1359b0+=0x1){_0x569d63[_0x262c('0x4a')]=_0x569d63[_0x262c('0x4b')][_0x1359b0]['filename'];_0x569d63['createdAt']=_0x569d63['monitors'][_0x1359b0][_0x262c('0x4c')];if(_0x569d63[_0x262c('0x34')]==_0x262c('0x3b')){_0x569d63['calleridnum']=_0x569d63[_0x262c('0x27')];_0x569d63[_0x262c('0x4d')]=_0x569d63[_0x262c('0x4e')];_0x569d63[_0x262c('0x27')]=_0x569d63[_0x262c('0x20')];_0x569d63[_0x262c('0x4e')]=_0x569d63[_0x262c('0x49')];_0x569d63[_0x262c('0x34')]=_0x569d63[_0x262c('0x3d')];}else if(_0x569d63[_0x262c('0x34')]==_0x262c('0x4f')){_0x569d63[_0x262c('0x30')]=_0x569d63[_0x262c('0x33')];_0x569d63[_0x262c('0x34')]=_0x569d63['originatecalleridnum'];}RpcVoiceRecording[_0x262c('0x2d')](_0x569d63);}}};Report[_0x262c('0xf')]['voiceAgentReport']=function(_0x32b70a){if(_[_0x262c('0x50')](_0x32b70a)){_0x32b70a[_0x262c('0x51')](function(_0x3c864a){RpcVoiceAgentReport['create'](_0x3c864a);});}else{RpcVoiceAgentReport[_0x262c('0x2d')](_0x32b70a);}};Report['prototype'][_0x262c('0x19')]=function(_0x161570){RpcVoiceDialReport[_0x262c('0x2d')](_0x161570);var _0x3384e3;var _0x11ff37;var _0x397544=_0x161570[_0x262c('0x3f')];if(_[_0x262c('0x52')](_0x397544,'Local')){_0x11ff37=_0x397544[_0x262c('0x53')](_0x397544['indexOf']('/')+0x1,_0x397544['indexOf']('@'));_0x3384e3=_[_0x262c('0x1f')](this[_0x262c('0xd')],function(_0x3c897a){return _0x3c897a[_0x262c('0x54')]==_0x11ff37||_0x3c897a[_0x262c('0x55')]==_0x11ff37||_0x3c897a['accountcode']==_0x11ff37;});}else{_0x11ff37=_0x397544[_0x262c('0x53')](_0x397544[_0x262c('0x56')]('/')+0x1,_0x397544[_0x262c('0x57')]('-'));_0x3384e3=this[_0x262c('0x1e')](_0x11ff37);}if(_0x3384e3){_0x161570[_0x262c('0x23')]=_[_0x262c('0x22')](_0x3384e3[_0x262c('0x23')])?util['format'](_0x262c('0x25'),_0x3384e3['name']):_0x3384e3[_0x262c('0x23')];_0x161570[_0x262c('0x49')]=_0x3384e3['name'];_0x161570['accountcode']=_0x3384e3['accountcode'];RpcMemberReport[_0x262c('0x19')](_0x161570);}};Report['prototype']['blindTransfer']=function(_0x38ec5e){RpcVoiceTransferReport[_0x262c('0x42')][_0x38ec5e[_0x262c('0x58')]]=_0x38ec5e;};Report[_0x262c('0xf')][_0x262c('0x1d')]=function(_0x1e6940){RpcVoiceTransferReport[_0x262c('0x1d')](_0x1e6940);};module[_0x262c('0x59')]=Report; \ No newline at end of file +var _0xb7d9=['channel','split','calleridnum','outbound','internal','destination','exten','dialer','lastapplication','lastdata','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','type','UserId','membername','monitor','monitorFilename','monitors','createdAt','connectedlinename','xcally-motion-dialer','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','lastAssignedTo','format','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType'];(function(_0x28e71a,_0x4405bd){var _0x268fed=function(_0x404197){while(--_0x404197){_0x28e71a['push'](_0x28e71a['shift']());}};_0x268fed(++_0x4405bd);}(_0xb7d9,0x85));var _0x9b7d=function(_0x37cb86,_0x456e6d){_0x37cb86=_0x37cb86-0x0;var _0x5d1aa8=_0xb7d9[_0x37cb86];return _0x5d1aa8;};'use strict';var _=require(_0x9b7d('0x0'));var moment=require('moment');var util=require(_0x9b7d('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9b7d('0x2'));var RpcVoiceCallReport=require(_0x9b7d('0x3'));var RpcVoiceDialReport=require(_0x9b7d('0x4'));var RpcMemberReport=require(_0x9b7d('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9b7d('0x6'));var RpcVoiceTransferReport=require(_0x9b7d('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x9b7d('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9b7d('0x9'));var UserReport=require(_0x9b7d('0xa'));function Report(_0x3d3f4f){this['realtime']=_0x3d3f4f;this[_0x9b7d('0xb')]=_0x3d3f4f[_0x9b7d('0xb')];this['telephones']=_0x3d3f4f[_0x9b7d('0xc')];}Report[_0x9b7d('0xd')][_0x9b7d('0xe')]=function(_0x4fa5f5){var _0x36b8df=new VoiceQueueReport(this[_0x9b7d('0xf')]);var _0x15728d=new VoiceAgentReport(this['realtime']);var _0x3a5623=new VoiceDialReport(this[_0x9b7d('0xf')]);var _0x3f1900=new VoiceCallReport(this[_0x9b7d('0xf')]);var _0x56ad3a=new UserReport(this[_0x9b7d('0xf')]);if(config[_0x9b7d('0x10')]&&config['xdr'][_0x9b7d('0x11')]){ami['on'](_0x9b7d('0x12'),this[_0x9b7d('0x13')][_0x9b7d('0x14')](this));ami['on'](_0x9b7d('0x15'),this[_0x9b7d('0x16')][_0x9b7d('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x9b7d('0x17')][_0x9b7d('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x9b7d('0x18')][_0x9b7d('0x14')](this));ami['on'](_0x9b7d('0x19'),this['blindTransfer'][_0x9b7d('0x14')](this));ami['on'](_0x9b7d('0x1a'),this[_0x9b7d('0x1b')]['bind'](this));}};Report[_0x9b7d('0xd')][_0x9b7d('0x1c')]=function(_0x36df00){var _0x114ccf;_0x114ccf=_[_0x9b7d('0x1d')](this['agents'],function(_0x599d80){return _0x599d80[_0x9b7d('0x1e')]==_0x36df00||_0x599d80[_0x9b7d('0x1f')]==_0x36df00;});if(_[_0x9b7d('0x20')](_0x114ccf)){var _0x54b169=_['find'](this[_0x9b7d('0xc')],function(_0xb08432){return _0xb08432[_0x9b7d('0x1e')]==_0x36df00||_0xb08432[_0x9b7d('0x1f')]==_0x36df00;});if(_0x54b169){_0x114ccf=_['find'](this[_0x9b7d('0xb')],function(_0x3166a2){return _0x3166a2[_0x9b7d('0x21')]==util['format'](_0x9b7d('0x22'),_0x54b169[_0x9b7d('0x1f')]);});}}return _0x114ccf;};Report[_0x9b7d('0xd')][_0x9b7d('0x13')]=function(_0x56b77d){for(var _0xbc6ca8=0x0;_0xbc6ca8<_0x56b77d[_0x9b7d('0x23')];_0xbc6ca8+=0x1){var _0x2c0afd=this[_0x9b7d('0x1c')](_0x56b77d[_0xbc6ca8]['connectedlinenum']);if(_0x2c0afd){_0x56b77d[_0xbc6ca8][_0x9b7d('0x1e')]=_0x2c0afd[_0x9b7d('0x1e')];_0x56b77d[_0xbc6ca8]['assigned']=!![];_0x56b77d[_0xbc6ca8][_0x9b7d('0x24')]=_0x2c0afd[_0x9b7d('0x1f')];_0x56b77d[_0xbc6ca8]['interface']=_['isNil'](_0x2c0afd['interface'])?util[_0x9b7d('0x25')](_0x9b7d('0x22'),_0x2c0afd[_0x9b7d('0x1f')]):_0x2c0afd[_0x9b7d('0x21')];if(_0x56b77d[_0xbc6ca8]['queuecallercomplete']){_0x56b77d[_0xbc6ca8][_0x9b7d('0x26')]=moment()[_0x9b7d('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x56b77d[_0xbc6ca8][_0x9b7d('0x27')]){_0x56b77d[_0xbc6ca8][_0x9b7d('0x28')]=moment()['format'](_0x9b7d('0x29'));}RpcMemberReport[_0x9b7d('0x13')](_0x56b77d[_0xbc6ca8]);}RpcVoiceQueueReport[_0x9b7d('0x2a')](_0x56b77d[_0xbc6ca8]);}};function extractCalleridNumber(_0xcb88a7){var _0x10783f=_0xcb88a7[_0x9b7d('0x2b')](/<(.*?)>/);return _0x10783f?_0x10783f[0x1]:_0xcb88a7;}Report['prototype'][_0x9b7d('0x2c')]=function(_0x27fd68){for(var _0x33c12e=0x0;_0x33c12e0x0?_0x73b3d7:0x0;this[_0xf886('0x14')][_0x587e35[_0xf886('0x6b')]][_0xf886('0x5c')]=this[_0xf886('0x14')][_0x587e35[_0xf886('0x6b')]][_0xf886('0x5c')]>_['toNumber'](_0x587e35['loggedin'])?_['toNumber'](_0x587e35[_0xf886('0x71')]):this['voiceQueues'][_0x587e35[_0xf886('0x6b')]]['talking'];this[_0xf886('0x56')](this[_0xf886('0x14')][_0x587e35[_0xf886('0x6b')]],_0xf886('0x18'));}logger[_0xf886('0x49')](_0xf886('0x73'),util[_0xf886('0x40')](this[_0xf886('0x14')][_0x587e35[_0xf886('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xf886('0x4b')](_0xf886('0x74'),this[_0xf886('0x14')][_0x587e35[_0xf886('0x6b')]]);}}}catch(_0xc6557d){logger['error'](_0xf886('0x69'),util[_0xf886('0x40')](_0xc6557d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf886('0x1b')]=function(_0xfa7c88){logger[_0xf886('0x49')](_0xf886('0x75'),util[_0xf886('0x40')](_0xfa7c88,{'showHidden':![],'depth':null}));this[_0xf886('0x15')]=!![];};VoiceQueueReport[_0xf886('0xd')][_0xf886('0x1d')]=function(_0x5a2e31){try{if(this['isNotNull'](_0x5a2e31)){logger[_0xf886('0x49')](_0xf886('0x76'),_0x5a2e31[_0xf886('0x4a')],util[_0xf886('0x40')](_0x5a2e31,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xf886('0x11')][_0x5a2e31[_0xf886('0x4a')]]))this[_0xf886('0x11')][_0x5a2e31[_0xf886('0x4a')]]=[];if(_[_0xf886('0x66')](this[_0xf886('0x13')][_0x5a2e31[_0xf886('0x4a')]]))this[_0xf886('0x13')][_0x5a2e31[_0xf886('0x4a')]]={};var _0x48e96b=new QueueReport();_0x48e96b[_0xf886('0x54')]=_0x5a2e31[_0xf886('0x6b')];_0x48e96b[_0xf886('0x57')]=this[_0xf886('0x14')][_0x48e96b['name']]&&this[_0xf886('0x14')][_0x48e96b[_0xf886('0x54')]][_0xf886('0x57')]?this[_0xf886('0x14')][_0x48e96b[_0xf886('0x54')]][_0xf886('0x57')]||_0xf886('0x58'):_0xf886('0x58');_0x48e96b[_0xf886('0x6b')]=_0x5a2e31[_0xf886('0x6b')];_0x48e96b[_0xf886('0x77')]=moment()[_0xf886('0x53')](_0xf886('0x78'));_0x48e96b[_0xf886('0x79')]=_0x5a2e31[_0xf886('0x79')];_0x48e96b[_0xf886('0x7a')]=_0x5a2e31['count'];_0x48e96b[_0xf886('0x4a')]=_0x5a2e31[_0xf886('0x4a')];_0x48e96b[_0xf886('0x7b')]=this[_0xf886('0x13')][_0x5a2e31[_0xf886('0x4a')]][_0xf886('0x7b')];logger['info'](_0xf886('0x7c'),_0x48e96b[_0xf886('0x54')],_0x48e96b[_0xf886('0x57')]);_['merge'](_0x48e96b,_[_0xf886('0x7d')](_0x5a2e31,_['keys'](_0x48e96b)));this[_0xf886('0x11')][_0x5a2e31[_0xf886('0x4a')]][_0xf886('0x7e')](_0x48e96b);this[_0xf886('0x13')][_0x5a2e31[_0xf886('0x4a')]]=_0x48e96b;this[_0xf886('0x48')](_0x48e96b,'queuecallerjoin');}}catch(_0xbd8f7d){logger[_0xf886('0x41')](_0xf886('0x76'),_0x5a2e31[_0xf886('0x4a')],util[_0xf886('0x40')](_0xbd8f7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf886('0xd')][_0xf886('0x1f')]=function(_0x466fb7){try{if(this[_0xf886('0x6a')](_0x466fb7)){logger['debug'](_0xf886('0x7f'),_0x466fb7[_0xf886('0x4a')],util['inspect'](_0x466fb7,{'showHidden':![],'depth':null}));if(this[_0xf886('0x11')][_0x466fb7[_0xf886('0x4a')]]){var _0x56a987=_['last'](this[_0xf886('0x11')][_0x466fb7[_0xf886('0x4a')]]);_0x56a987[_0xf886('0x80')]=![];_0x56a987[_0xf886('0x81')]=null;_0x56a987[_0xf886('0x82')]=_0x466fb7[_0xf886('0x82')];_0x56a987[_0xf886('0x83')]=_0x466fb7[_0xf886('0x83')];_0x56a987[_0xf886('0x1e')]=!![];_0x56a987['queuecallerabandonAt']=moment()[_0xf886('0x53')](_0xf886('0x78'));_0x56a987[_0xf886('0x51')]=_0xf886('0x84');_0x56a987[_0xf886('0x85')]=null;logger[_0xf886('0x6d')](_0xf886('0x86'),_0x56a987[_0xf886('0x54')],_0x56a987[_0xf886('0x57')]);this[_0xf886('0x13')][_0x466fb7[_0xf886('0x4a')]]=_0x56a987;this['emitVoiceQueueChannelRemove'](_0x56a987,_0xf886('0x1e'));}}}catch(_0x1d85c8){logger[_0xf886('0x41')](_0xf886('0x7f'),_0x466fb7[_0xf886('0x4a')],util[_0xf886('0x40')](_0x1d85c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf886('0xd')][_0xf886('0x87')]=function(_0x293ef0){try{if(this[_0xf886('0x6a')](_0x293ef0)){logger[_0xf886('0x49')](_0xf886('0x88'),_0x293ef0['uniqueid'],util['inspect'](_0x293ef0,{'showHidden':![],'depth':null}));if(this[_0xf886('0x11')][_0x293ef0[_0xf886('0x4a')]]){var _0x6e2389=_[_0xf886('0x89')](this['queueReports'][_0x293ef0['uniqueid']]);_0x6e2389['queuecallerleaveAt']=moment()[_0xf886('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x6e2389[_0xf886('0x8a')]=_0x293ef0[_0xf886('0x8a')];_0x6e2389[_0xf886('0x8b')]=_0x293ef0[_0xf886('0x8b')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x6e2389[_0xf886('0x54')],_0x6e2389[_0xf886('0x57')],_0x293ef0[_0xf886('0x8a')],_0x293ef0['connectedlinename']);this['channels'][_0x293ef0[_0xf886('0x4a')]]=_0x6e2389;this[_0xf886('0x48')](_0x6e2389,_0xf886('0x20'));}}}catch(_0x219d49){logger[_0xf886('0x41')]('[%s][voiceQueueReport][queuecallerleave]',_0x293ef0[_0xf886('0x4a')],util[_0xf886('0x40')](_0x219d49,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf886('0xd')][_0xf886('0x8c')]=function(_0x2863af){try{if(this[_0xf886('0x6a')](_0x2863af)){logger[_0xf886('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x2863af[_0xf886('0x4a')],util['inspect'](_0x2863af,{'showHidden':![],'depth':null}));if(this[_0xf886('0x11')][_0x2863af[_0xf886('0x4a')]]){var _0x2f4d8f=_['last'](this[_0xf886('0x11')][_0x2863af[_0xf886('0x4a')]]);_0x2f4d8f[_0xf886('0x80')]=!![];_0x2f4d8f['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xf886('0x6d')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2f4d8f[_0xf886('0x54')],_0x2f4d8f['type']);}}}catch(_0x53dd44){logger[_0xf886('0x41')](_0xf886('0x8d'),_0x2863af[_0xf886('0x4a')],util[_0xf886('0x40')](_0x53dd44,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf886('0x22')]=function(_0x4cd87d){try{if(this[_0xf886('0x6a')](_0x4cd87d)){logger['debug'](_0xf886('0x8e'),_0x4cd87d[_0xf886('0x4a')],util[_0xf886('0x40')](_0x4cd87d,{'showHidden':![],'depth':null}));if(this[_0xf886('0x11')][_0x4cd87d[_0xf886('0x4a')]]){var _0xca506c=_[_0xf886('0x89')](this[_0xf886('0x11')][_0x4cd87d[_0xf886('0x4a')]]);_0xca506c[_0xf886('0x1e')]=![];_0xca506c['queuecallerabandonAt']=null;_0xca506c[_0xf886('0x8f')]=!![];_0xca506c['lastAssignedTo']=_0x4cd87d[_0xf886('0x90')];_0xca506c[_0xf886('0x82')]=_0x4cd87d['holdtime'];_0xca506c[_0xf886('0x80')]=!![];_0xca506c['queuecallerexit']=![];_0xca506c[_0xf886('0x91')]=null;if(!_0xca506c[_0xf886('0x92')]){if(_0x4cd87d[_0xf886('0x93')]==_0xf886('0x92')){_0xca506c[_0xf886('0x51')]=_0xf886('0x94');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0xca506c[_0xf886('0x54')],_0xca506c[_0xf886('0x57')]);}else{if(_['startsWith'](_0x4cd87d['channel']['toLowerCase'](),_0xf886('0x95'))){if(this[_0xf886('0x11')][_0x4cd87d['linkedid']]){var _0x268954=_[_0xf886('0x89')](this[_0xf886('0x11')][_0x4cd87d[_0xf886('0x96')]]);_0x268954[_0xf886('0x80')]=![];_0x268954[_0xf886('0x97')]=!![];_0x268954['queuecallerexitAt']=moment(_0xca506c[_0xf886('0x77')])['add'](_0x4cd87d[_0xf886('0x82')],_0xf886('0x98'))['format'](_0xf886('0x78'));_0x268954[_0xf886('0x51')]=_0xf886('0x99');_0x268954[_0xf886('0x92')]=!![];_0x268954['transfertype']=_0xf886('0x9a');_0x268954[_0xf886('0x9b')]=_0x4cd87d[_0xf886('0x9c')];_0x268954['transferuniqueid']=_0x4cd87d['uniqueid'];logger['info'](_0xf886('0x9d'),_0x268954[_0xf886('0x54')],_0x268954['type']);var _0x300c14=this['queueReports'][_0x4cd87d[_0xf886('0x96')]];this[_0xf886('0x11')][_0x4cd87d['linkedid']]=this[_0xf886('0x11')][_0x4cd87d['uniqueid']];this[_0xf886('0x11')][_0x4cd87d[_0xf886('0x4a')]]=_0x300c14;}}else{_0xca506c[_0xf886('0x51')]=_0xf886('0x9e')+_0x4cd87d[_0xf886('0x93')][_0xf886('0x9f')]();logger[_0xf886('0x6d')](_0xf886('0xa0'),_0xca506c[_0xf886('0x54')],_0xca506c[_0xf886('0x57')],_0xca506c[_0xf886('0x51')]);}}}this['channels'][_0x4cd87d[_0xf886('0x4a')]]=_0xca506c;this['emitVoiceQueueChannelRemove'](_0xca506c,'agentcomplete');}}}catch(_0x351503){logger['error'](_0xf886('0x8e'),_0x4cd87d[_0xf886('0x4a')],util[_0xf886('0x40')](_0x351503,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf886('0xd')][_0xf886('0xa1')]=function(_0x4f0fa5){try{if(this[_0xf886('0x6a')](_0x4f0fa5)){logger[_0xf886('0x49')]('[%s][voiceQueueReport][varset]',_0x4f0fa5['uniqueid'],util[_0xf886('0x40')](_0x4f0fa5,{'showHidden':![],'depth':null}));this['addVariable'](_0x4f0fa5['uniqueid'],_[_0xf886('0xa2')](_0x4f0fa5['variable'])[0x0],_0x4f0fa5[_0xf886('0xa3')]);if(this[_0xf886('0x11')][_0x4f0fa5[_0xf886('0x4a')]]){var _0x5b405d=_[_0xf886('0x89')](this[_0xf886('0x11')][_0x4f0fa5[_0xf886('0x4a')]]);if(_0x5b405d){if(this[_0xf886('0x6a')](_0x4f0fa5['variable'])&&this[_0xf886('0x6a')](_0x4f0fa5[_0xf886('0xa4')][_0xf886('0xa5')])){switch(_0x4f0fa5['value']){case _0xf886('0xa6'):_0x5b405d[_0xf886('0x97')]=![];_0x5b405d[_0xf886('0x91')]=null;break;case _0xf886('0xa7'):_0x5b405d[_0xf886('0xa8')]='timeout';_0x5b405d[_0xf886('0x97')]=!![];_0x5b405d['queuecallerexitAt']=moment()[_0xf886('0x53')](_0xf886('0x78'));_0x5b405d['queuecallerleaveAt']=moment()['format'](_0xf886('0x78'));logger[_0xf886('0x49')](_0xf886('0xa9'),_0x4f0fa5[_0xf886('0x4a')],util[_0xf886('0x40')](_0x5b405d,{'showHidden':![],'depth':null}));ami[_0xf886('0x4b')](_0xf886('0xaa'),_0x5b405d);break;default:_0x5b405d[_0xf886('0x97')]=!![];_0x5b405d[_0xf886('0x91')]=moment()[_0xf886('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b405d[_0xf886('0xab')]=moment()[_0xf886('0x53')](_0xf886('0x78'));}_0x5b405d[_0xf886('0x1e')]=![];_0x5b405d[_0xf886('0xac')]=null;_0x5b405d[_0xf886('0x51')]=_0x4f0fa5[_0xf886('0xa3')];this['channels'][_0x4f0fa5[_0xf886('0x4a')]]=_0x5b405d;this[_0xf886('0x46')](_0x5b405d,_0xf886('0xad'));}else if(this['isNotNull'](_0x4f0fa5[_0xf886('0xa4')])&&this['isNotNull'](_0x4f0fa5[_0xf886('0xa4')][_0xf886('0xae')])){if(!_0x5b405d[_0xf886('0x1e')]){_0x5b405d[_0xf886('0x97')]=!![];_0x5b405d[_0xf886('0x91')]=moment()[_0xf886('0x53')](_0xf886('0x78'));_0x5b405d[_0xf886('0x51')]=_0xf886('0xaf');_0x5b405d['queuecallerleaveAt']=moment()[_0xf886('0x53')](_0xf886('0x78'));this['channels'][_0x4f0fa5[_0xf886('0x4a')]]=_0x5b405d;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x4f0fa5['uniqueid'],_0x5b405d[_0xf886('0x54')],_0x5b405d[_0xf886('0x57')],_['keys'](_0x4f0fa5[_0xf886('0xa4')])[0x0],_0x4f0fa5[_0xf886('0xa3')]);_0x5b405d[_0xf886('0x17')]=this[_0xf886('0x17')][_0x4f0fa5[_0xf886('0x4a')]];}}}}catch(_0x2aea88){logger[_0xf886('0x41')](_0xf886('0xb0'),_0x4f0fa5['uniqueid'],util[_0xf886('0x40')](_0x2aea88,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf886('0xd')][_0xf886('0xb1')]=function(_0x381a57,_0x270b51,_0x27756e){var _0x4c50e5=['rtpaudioqos','rtpaudioqosbridged',_0xf886('0xb2'),_0xf886('0xb3'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0xf886('0xb4'),_0xf886('0xb5'),_0xf886('0xb6'),_0xf886('0xb7'),_0xf886('0xb8'),'bridgepvtcallid',_0xf886('0xb9'),_0xf886('0xba'),_0xf886('0xbb'),_0xf886('0xbc'),_0xf886('0x90'),_0xf886('0xbd'),_0xf886('0xbe')];if(!_['isNil'](_0x270b51)&&!_[_0xf886('0xbf')](_0x4c50e5,_0x270b51)){if(_[_0xf886('0x66')](this[_0xf886('0x17')][_0x381a57])){this[_0xf886('0x17')][_0x381a57]={};}this[_0xf886('0x17')][_0x381a57][_0x270b51]=_0x27756e;}};VoiceQueueReport[_0xf886('0xd')][_0xf886('0xc0')]=function(_0x178a97){try{if(this['isNotNull'](_0x178a97)){logger[_0xf886('0x49')](_0xf886('0xc1'),_0x178a97[_0xf886('0x4a')],util[_0xf886('0x40')](_0x178a97,{'showHidden':![],'depth':null}));if(this[_0xf886('0x11')][_0x178a97[_0xf886('0x4a')]]){for(var _0x78fb77=0x0,_0x1e207e={};_0x78fb770x0?_0x209284:0x0;this['voiceQueues'][_0x13f853[_0x374d('0x6c')]][_0x374d('0x30')]=this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]][_0x374d('0x30')]>_[_0x374d('0x71')](_0x13f853['loggedin'])?_['toNumber'](_0x13f853[_0x374d('0x73')]):this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]][_0x374d('0x30')];this['emitVoiceQueueSummary'](this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]],_0x374d('0x17'));}logger[_0x374d('0x61')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x374d('0x3f')](this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]],{'showHidden':![],'depth':null}));ami[_0x374d('0x45')](_0x374d('0x74'),this[_0x374d('0x13')][_0x13f853[_0x374d('0x6c')]]);}}}catch(_0x4e1a42){logger[_0x374d('0x3d')](_0x374d('0x6a'),util[_0x374d('0x3f')](_0x4e1a42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')]['syncQueueSummaryComplete']=function(_0x16b028){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x374d('0x3f')](_0x16b028,{'showHidden':![],'depth':null}));this[_0x374d('0x14')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x4e00ab){try{if(this['isNotNull'](_0x4e00ab)){logger[_0x374d('0x61')](_0x374d('0x75'),_0x4e00ab['uniqueid'],util[_0x374d('0x3f')](_0x4e00ab,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x4e00ab[_0x374d('0x76')]]))this[_0x374d('0x11')][_0x4e00ab[_0x374d('0x76')]]=[];if(_[_0x374d('0x64')](this[_0x374d('0x34')][_0x4e00ab['uniqueid']]))this[_0x374d('0x34')][_0x4e00ab['uniqueid']]={};var _0x6fc4bf=new QueueReport();_0x6fc4bf[_0x374d('0x4a')]=_0x4e00ab['queue'];_0x6fc4bf[_0x374d('0x59')]=this[_0x374d('0x13')][_0x6fc4bf['name']]&&this[_0x374d('0x13')][_0x6fc4bf[_0x374d('0x4a')]][_0x374d('0x59')]?this[_0x374d('0x13')][_0x6fc4bf[_0x374d('0x4a')]]['type']||_0x374d('0x52'):'inbound';_0x6fc4bf[_0x374d('0x6c')]=_0x4e00ab[_0x374d('0x6c')];_0x6fc4bf[_0x374d('0x77')]=moment()['format'](_0x374d('0x78'));_0x6fc4bf[_0x374d('0x79')]=_0x4e00ab[_0x374d('0x79')];_0x6fc4bf[_0x374d('0x7a')]=_0x4e00ab[_0x374d('0x7a')];_0x6fc4bf[_0x374d('0x76')]=_0x4e00ab['uniqueid'];_0x6fc4bf['routealias']=this[_0x374d('0x34')][_0x4e00ab[_0x374d('0x76')]][_0x374d('0x7b')];logger[_0x374d('0x6e')](_0x374d('0x7c'),_0x6fc4bf[_0x374d('0x4a')],_0x6fc4bf['type']);_[_0x374d('0x7d')](_0x6fc4bf,_[_0x374d('0x7e')](_0x4e00ab,_[_0x374d('0x7f')](_0x6fc4bf)));this[_0x374d('0x11')][_0x4e00ab[_0x374d('0x76')]]['push'](_0x6fc4bf);this['channels'][_0x4e00ab[_0x374d('0x76')]]=_0x6fc4bf;this[_0x374d('0x46')](_0x6fc4bf,_0x374d('0x80'));}}catch(_0x4e09b7){logger['error'](_0x374d('0x75'),_0x4e00ab['uniqueid'],util[_0x374d('0x3f')](_0x4e09b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x374d('0x1c')]=function(_0xc17e4e){try{if(this[_0x374d('0x6b')](_0xc17e4e)){logger[_0x374d('0x61')](_0x374d('0x81'),_0xc17e4e['uniqueid'],util[_0x374d('0x3f')](_0xc17e4e,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0xc17e4e['uniqueid']]){var _0x7cc9b=_[_0x374d('0x82')](this[_0x374d('0x11')][_0xc17e4e[_0x374d('0x76')]]);_0x7cc9b[_0x374d('0x83')]=![];_0x7cc9b[_0x374d('0x84')]=null;_0x7cc9b[_0x374d('0x85')]=_0xc17e4e[_0x374d('0x85')];_0x7cc9b[_0x374d('0x86')]=_0xc17e4e['originalposition'];_0x7cc9b[_0x374d('0x1b')]=!![];_0x7cc9b[_0x374d('0x87')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x7cc9b['queuecallerexitreason']=_0x374d('0x88');_0x7cc9b[_0x374d('0x89')]=null;logger[_0x374d('0x6e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x7cc9b['name'],_0x7cc9b['type']);this['channels'][_0xc17e4e[_0x374d('0x76')]]=_0x7cc9b;this[_0x374d('0x44')](_0x7cc9b,_0x374d('0x1b'));}}}catch(_0x226f16){logger[_0x374d('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0xc17e4e[_0x374d('0x76')],util['inspect'](_0x226f16,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')]['syncQueueCallerLeave']=function(_0x3c193d){try{if(this[_0x374d('0x6b')](_0x3c193d)){logger[_0x374d('0x61')]('[%s][voiceQueueReport][queuecallerleave]',_0x3c193d[_0x374d('0x76')],util[_0x374d('0x3f')](_0x3c193d,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x3c193d[_0x374d('0x76')]]){var _0x5b7b20=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x3c193d[_0x374d('0x76')]]);_0x5b7b20[_0x374d('0x8a')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x5b7b20[_0x374d('0x8b')]=_0x3c193d[_0x374d('0x8b')];_0x5b7b20[_0x374d('0x8c')]=_0x3c193d[_0x374d('0x8c')];logger[_0x374d('0x6e')](_0x374d('0x8d'),_0x5b7b20[_0x374d('0x4a')],_0x5b7b20['type'],_0x3c193d['connectedlinenum'],_0x3c193d[_0x374d('0x8c')]);this[_0x374d('0x34')][_0x3c193d[_0x374d('0x76')]]=_0x5b7b20;this[_0x374d('0x46')](_0x5b7b20,'queuecallerleave');}}}catch(_0x542e5b){logger[_0x374d('0x3d')](_0x374d('0x8e'),_0x3c193d[_0x374d('0x76')],util[_0x374d('0x3f')](_0x542e5b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')][_0x374d('0x21')]=function(_0x1d29c8){try{if(this[_0x374d('0x6b')](_0x1d29c8)){logger[_0x374d('0x61')]('[%s][voiceQueueReport][agentconnect]',_0x1d29c8[_0x374d('0x76')],util['inspect'](_0x1d29c8,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x1d29c8[_0x374d('0x76')]]){var _0x34730d=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x1d29c8['uniqueid']]);_0x34730d[_0x374d('0x83')]=!![];_0x34730d[_0x374d('0x4c')]='COMPLETEDBYAGENT';logger[_0x374d('0x6e')](_0x374d('0x8f'),_0x34730d[_0x374d('0x4a')],_0x34730d['type']);}}}catch(_0x415cb1){logger[_0x374d('0x3d')](_0x374d('0x90'),_0x1d29c8[_0x374d('0x76')],util['inspect'](_0x415cb1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')]['syncAgentComplete']=function(_0x11f869){try{if(this[_0x374d('0x6b')](_0x11f869)){logger['debug'](_0x374d('0x91'),_0x11f869['uniqueid'],util[_0x374d('0x3f')](_0x11f869,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x11f869['uniqueid']]){var _0xabd2c7=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x11f869[_0x374d('0x76')]]);_0xabd2c7[_0x374d('0x1b')]=![];_0xabd2c7[_0x374d('0x87')]=null;_0xabd2c7[_0x374d('0x92')]=!![];_0xabd2c7[_0x374d('0x89')]=_0x11f869[_0x374d('0x93')];_0xabd2c7[_0x374d('0x85')]=_0x11f869[_0x374d('0x85')];_0xabd2c7[_0x374d('0x83')]=!![];_0xabd2c7['queuecallerexit']=![];_0xabd2c7['queuecallerexitAt']=null;if(!_0xabd2c7[_0x374d('0x94')]){if(_0x11f869[_0x374d('0x95')]=='transfer'){_0xabd2c7[_0x374d('0x4c')]=_0x374d('0x96');logger[_0x374d('0x6e')](_0x374d('0x97'),_0xabd2c7[_0x374d('0x4a')],_0xabd2c7[_0x374d('0x59')]);}else{if(_[_0x374d('0x98')](_0x11f869['channel'][_0x374d('0x99')](),_0x374d('0x9a'))){if(this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]]){var _0x18bd45=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]]);_0x18bd45['queuecallercomplete']=![];_0x18bd45['queuecallerexit']=!![];_0x18bd45[_0x374d('0x9c')]=moment(_0xabd2c7['queuecallerjoinAt'])['add'](_0x11f869[_0x374d('0x85')],_0x374d('0x9d'))[_0x374d('0x4e')](_0x374d('0x78'));_0x18bd45['queuecallerexitreason']=_0x374d('0x9e');_0x18bd45[_0x374d('0x94')]=!![];_0x18bd45[_0x374d('0x9f')]=_0x374d('0xa0');_0x18bd45[_0x374d('0xa1')]=_0x11f869[_0x374d('0xa2')];_0x18bd45[_0x374d('0xa3')]=_0x11f869['uniqueid'];logger[_0x374d('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x18bd45[_0x374d('0x4a')],_0x18bd45[_0x374d('0x59')]);var _0x5484dc=this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]];this[_0x374d('0x11')][_0x11f869[_0x374d('0x9b')]]=this[_0x374d('0x11')][_0x11f869[_0x374d('0x76')]];this['queueReports'][_0x11f869[_0x374d('0x76')]]=_0x5484dc;}}else{_0xabd2c7[_0x374d('0x4c')]='COMPLETEDBY'+_0x11f869[_0x374d('0x95')][_0x374d('0xa4')]();logger[_0x374d('0x6e')](_0x374d('0xa5'),_0xabd2c7[_0x374d('0x4a')],_0xabd2c7[_0x374d('0x59')],_0xabd2c7[_0x374d('0x4c')]);}}}this['channels'][_0x11f869['uniqueid']]=_0xabd2c7;this['emitVoiceQueueChannelRemove'](_0xabd2c7,_0x374d('0x1e'));}}}catch(_0x3d66fd){logger[_0x374d('0x3d')](_0x374d('0x91'),_0x11f869[_0x374d('0x76')],util[_0x374d('0x3f')](_0x3d66fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x374d('0xa6')]=function(_0x319788){try{if(this['isNotNull'](_0x319788)){logger[_0x374d('0x61')](_0x374d('0xa7'),_0x319788['uniqueid'],util[_0x374d('0x3f')](_0x319788,{'showHidden':![],'depth':null}));this['addVariable'](_0x319788[_0x374d('0x76')],_['keys'](_0x319788[_0x374d('0xa8')])[0x0],_0x319788['value']);if(this[_0x374d('0x11')][_0x319788[_0x374d('0x76')]]){var _0x8634a1=_[_0x374d('0x82')](this[_0x374d('0x11')][_0x319788[_0x374d('0x76')]]);if(_0x8634a1){if(this[_0x374d('0x6b')](_0x319788['variable'])&&this['isNotNull'](_0x319788[_0x374d('0xa8')]['queuestatus'])){switch(_0x319788[_0x374d('0xa9')]){case _0x374d('0xaa'):_0x8634a1[_0x374d('0xab')]=![];_0x8634a1[_0x374d('0x9c')]=null;break;case _0x374d('0xac'):_0x8634a1[_0x374d('0xad')]=_0x374d('0xae');_0x8634a1[_0x374d('0xab')]=!![];_0x8634a1['queuecallerexitAt']=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x8634a1[_0x374d('0x8a')]=moment()[_0x374d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x374d('0x61')](_0x374d('0xaf'),_0x319788[_0x374d('0x76')],util[_0x374d('0x3f')](_0x8634a1,{'showHidden':![],'depth':null}));ami[_0x374d('0x45')](_0x374d('0xb0'),_0x8634a1);break;default:_0x8634a1['queuecallerexit']=!![];_0x8634a1[_0x374d('0x9c')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x8634a1['queuecallerleaveAt']=moment()['format'](_0x374d('0x78'));}_0x8634a1['queuecallerabandon']=![];_0x8634a1[_0x374d('0x87')]=null;_0x8634a1[_0x374d('0x4c')]=_0x319788['value'];this[_0x374d('0x34')][_0x319788[_0x374d('0x76')]]=_0x8634a1;this[_0x374d('0x44')](_0x8634a1,'varset');}else if(this['isNotNull'](_0x319788['variable'])&&this[_0x374d('0x6b')](_0x319788[_0x374d('0xa8')]['queueposition'])){if(!_0x8634a1['queuecallerabandon']){_0x8634a1[_0x374d('0xab')]=!![];_0x8634a1[_0x374d('0x9c')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));_0x8634a1['queuecallerexitreason']=_0x374d('0xb1');_0x8634a1[_0x374d('0x8a')]=moment()[_0x374d('0x4e')](_0x374d('0x78'));this[_0x374d('0x34')][_0x319788['uniqueid']]=_0x8634a1;}}logger[_0x374d('0x6e')](_0x374d('0xb2'),_0x319788['uniqueid'],_0x8634a1[_0x374d('0x4a')],_0x8634a1[_0x374d('0x59')],_[_0x374d('0x7f')](_0x319788['variable'])[0x0],_0x319788['value']);_0x8634a1[_0x374d('0x16')]=this[_0x374d('0x16')][_0x319788[_0x374d('0x76')]];}}}}catch(_0x2e5879){logger[_0x374d('0x3d')](_0x374d('0xa7'),_0x319788[_0x374d('0x76')],util[_0x374d('0x3f')](_0x2e5879,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x374d('0xd')][_0x374d('0xb3')]=function(_0x4a7d73,_0x189ca6,_0x7fc2a2){var _0x57c477=[_0x374d('0xb4'),_0x374d('0xb5'),'rtpaudioqosjitter',_0x374d('0xb6'),'rtpaudioqosloss',_0x374d('0xb7'),'rtpaudioqosrtt',_0x374d('0xb8'),_0x374d('0xb9'),_0x374d('0xba'),_0x374d('0xbb'),_0x374d('0xbc'),_0x374d('0xbd'),_0x374d('0xbe'),_0x374d('0xbf'),_0x374d('0xc0'),_0x374d('0x93'),_0x374d('0xc1'),_0x374d('0xc2')];if(!_[_0x374d('0x37')](_0x189ca6)&&!_['includes'](_0x57c477,_0x189ca6)){if(_[_0x374d('0x64')](this[_0x374d('0x16')][_0x4a7d73])){this['variables'][_0x4a7d73]={};}this['variables'][_0x4a7d73][_0x189ca6]=_0x7fc2a2;}};VoiceQueueReport[_0x374d('0xd')][_0x374d('0x23')]=function(_0x31f8d2){try{if(this[_0x374d('0x6b')](_0x31f8d2)){logger['debug'](_0x374d('0xc3'),_0x31f8d2[_0x374d('0x76')],util[_0x374d('0x3f')](_0x31f8d2,{'showHidden':![],'depth':null}));if(this[_0x374d('0x11')][_0x31f8d2[_0x374d('0x76')]]){for(var _0x184016=0x0,_0x200410={};_0x184016=0x0?moment(_0x197287[_0x4cbc('0x17')])[_0x4cbc('0x18')](_0x197287[_0x4cbc('0x19')],_0x4cbc('0xf')):null,'data1':_0x4cbc('0x1a'),'data2':_0x197287['accountcode'],'data3':_0x197287[_0x4cbc('0x12')],'data4':_0x197287[_0x4cbc('0x1b')]||null,'role':_0x4cbc('0x14'),'internal':_0x197287[_0x4cbc('0x15')]?_[_0x4cbc('0x1c')](_0x197287['accountcode']):undefined,'uniqueid':_0x197287[_0x4cbc('0x1d')]},'log':_0x4cbc('0x8')});}; \ No newline at end of file +var _0xcb45=['queue','accountcode','toNumber','uniqueid','membername','TALKING','starttime','endtime','diff','outbound','dialstring','agent','moment','util','../client','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','seconds','inbound','calleridnum','exten'];(function(_0x2c74f4,_0x57fd68){var _0x2d4e8d=function(_0x498759){while(--_0x498759){_0x2c74f4['push'](_0x2c74f4['shift']());}};_0x2d4e8d(++_0x57fd68);}(_0xcb45,0x12e));var _0x5cb4=function(_0x226c58,_0xd7c9f9){_0x226c58=_0x226c58-0x0;var _0x59a9d8=_0xcb45[_0x226c58];return _0x59a9d8;};'use strict';var moment=require(_0x5cb4('0x0'));var _=require('lodash');var util=require(_0x5cb4('0x1'));var client=require(_0x5cb4('0x2'));exports['voiceQueueReport']=function(_0xba5a75){var _0x3bfdb7=_0xba5a75[_0x5cb4('0x3')]||_0xba5a75['queuecallerexitAt'];return client[_0x5cb4('0x4')](_0x5cb4('0x5'),{'body':{'channel':_0x5cb4('0x6'),'membername':_0xba5a75[_0x5cb4('0x7')],'interface':_[_0x5cb4('0x8')](_0xba5a75[_0x5cb4('0x9')])?util[_0x5cb4('0xa')](_0x5cb4('0xb'),_0xba5a75['lastAssignedTo']):_0xba5a75[_0x5cb4('0x9')],'type':'TALKING','enterAt':_0xba5a75[_0x5cb4('0xc')],'exitAt':_0x3bfdb7,'duration':moment(_0x3bfdb7)['diff'](_0xba5a75[_0x5cb4('0xc')],_0x5cb4('0xd')),'data1':_0x5cb4('0xe'),'data2':_0xba5a75[_0x5cb4('0xf')],'data3':_0xba5a75[_0x5cb4('0x10')],'data4':null,'data5':_0xba5a75[_0x5cb4('0x11')],'role':'agent','internal':_0xba5a75[_0x5cb4('0x12')]?_[_0x5cb4('0x13')](_0xba5a75[_0x5cb4('0x12')]):undefined,'uniqueid':_0xba5a75[_0x5cb4('0x14')]},'log':_0x5cb4('0x5')});};exports['voiceDialReport']=function(_0x5a245a){return client[_0x5cb4('0x4')](_0x5cb4('0x5'),{'body':{'channel':_0x5cb4('0x6'),'membername':_0x5a245a[_0x5cb4('0x15')],'interface':_0x5a245a['interface'],'type':_0x5cb4('0x16'),'enterAt':_0x5a245a[_0x5cb4('0x17')],'exitAt':_0x5a245a[_0x5cb4('0x18')],'duration':moment(_0x5a245a[_0x5cb4('0x18')])[_0x5cb4('0x19')](_0x5a245a['starttime'],_0x5cb4('0xd'))>=0x0?moment(_0x5a245a[_0x5cb4('0x18')])[_0x5cb4('0x19')](_0x5a245a['starttime'],_0x5cb4('0xd')):null,'data1':_0x5cb4('0x1a'),'data2':_0x5a245a[_0x5cb4('0x12')],'data3':_0x5a245a['exten'],'data4':_0x5a245a[_0x5cb4('0x1b')]||null,'role':_0x5cb4('0x1c'),'internal':_0x5a245a[_0x5cb4('0x12')]?_[_0x5cb4('0x13')](_0x5a245a[_0x5cb4('0x12')]):undefined,'uniqueid':_0x5a245a['uniqueid']},'log':_0x5cb4('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3dbbc16..977ba1a 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 _0x1dcc=['ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x569c95,_0x54f839){var _0x2749b5=function(_0x226c68){while(--_0x226c68){_0x569c95['push'](_0x569c95['shift']());}};_0x2749b5(++_0x54f839);}(_0x1dcc,0x77));var _0xc1dc=function(_0x41f94b,_0x3be749){_0x41f94b=_0x41f94b-0x0;var _0x3b0033=_0x1dcc[_0x41f94b];return _0x3b0033;};'use strict';var client=require(_0xc1dc('0x0'));exports['getSettings']=function(){return client['Request'](_0xc1dc('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc1dc('0x2'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0xcc9b=['previewRecallmeReminderInterval','GetSettings','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0xfde255,_0x3df282){var _0x39ac78=function(_0x42b713){while(--_0x42b713){_0xfde255['push'](_0xfde255['shift']());}};_0x39ac78(++_0x3df282);}(_0xcc9b,0x12e));var _0xbcc9=function(_0x5ecf1d,_0x435af0){_0x5ecf1d=_0x5ecf1d-0x0;var _0x3df787=_0xcc9b[_0x5ecf1d];return _0x3df787;};'use strict';var client=require('../client');exports[_0xbcc9('0x0')]=function(){return client['Request'](_0xbcc9('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbcc9('0x2'),_0xbcc9('0x3')]},'log':_0xbcc9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5aa64ee..3a02c57 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 _0x51bd=['name','html','../client','Request','GetTemplate'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x51bd,0x110));var _0xd51b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x51bd[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0xd51b('0x0'));exports['getTemplates']=function(_0x504b0f){return function(_0x454066){return client[_0xd51b('0x1')](_0xd51b('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd51b('0x3'),_0xd51b('0x4')]},'log':_0xd51b('0x2')});};}; \ No newline at end of file +var _0x5cd1=['Request','GetTemplate','name','../client','getTemplates'];(function(_0x3039e2,_0x57e99f){var _0x473070=function(_0x5b469c){while(--_0x5b469c){_0x3039e2['push'](_0x3039e2['shift']());}};_0x473070(++_0x57e99f);}(_0x5cd1,0x1cf));var _0x15cd=function(_0x2b93bb,_0xf2b2ad){_0x2b93bb=_0x2b93bb-0x0;var _0xe01da5=_0x5cd1[_0x2b93bb];return _0xe01da5;};'use strict';var client=require(_0x15cd('0x0'));exports[_0x15cd('0x1')]=function(_0x496b2c){return function(_0x4ee8a2){return client[_0x15cd('0x2')](_0x15cd('0x3'),{'options':{'raw':!![],'attributes':['id',_0x15cd('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5be7c64..d3167e0 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 _0xba34=['value','Action','Actions','action','data1','data2','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator'];(function(_0x50f318,_0x5781e5){var _0x4e62c8=function(_0x18672d){while(--_0x18672d){_0x50f318['push'](_0x50f318['shift']());}};_0x4e62c8(++_0x5781e5);}(_0xba34,0x8e));var _0x4ba3=function(_0x1a546d,_0x2be147){_0x1a546d=_0x1a546d-0x0;var _0xcc8a4c=_0xba34[_0x1a546d];return _0xcc8a4c;};'use strict';var client=require(_0x4ba3('0x0'));exports[_0x4ba3('0x1')]=function(_0x1691ec){return function(_0x47f628){return client[_0x4ba3('0x2')](_0x4ba3('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4ba3('0x4'),_0x4ba3('0x5')],'include':[{'model':_0x4ba3('0x6'),'as':_0x4ba3('0x7'),'attributes':['id',_0x4ba3('0x8'),_0x4ba3('0x9'),'value']},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x4ba3('0x8'),_0x4ba3('0x9'),_0x4ba3('0xa')]},{'model':_0x4ba3('0xb'),'as':_0x4ba3('0xc'),'attributes':['id',_0x4ba3('0xd'),_0x4ba3('0xe'),_0x4ba3('0xf'),'data3','data4',_0x4ba3('0x10'),_0x4ba3('0x11'),_0x4ba3('0x12')]}]},'log':_0x4ba3('0x3')});};}; \ No newline at end of file +var _0xdb40=['data4','data5','data7','../client','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Actions','data1','data3'];(function(_0x4cbf20,_0x22a782){var _0x28f032=function(_0x5d7b5c){while(--_0x5d7b5c){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x28f032(++_0x22a782);}(_0xdb40,0x146));var _0x0db4=function(_0x2a498e,_0x47bcfc){_0x2a498e=_0x2a498e-0x0;var _0x487794=_0xdb40[_0x2a498e];return _0x487794;};'use strict';var client=require(_0x0db4('0x0'));exports['getTriggers']=function(_0xbaf2b9){return function(_0x56c091){return client[_0x0db4('0x1')](_0x0db4('0x2'),{'options':{'raw':![],'attributes':['id',_0x0db4('0x3'),_0x0db4('0x4'),'status'],'include':[{'model':_0x0db4('0x5'),'as':_0x0db4('0x6'),'attributes':['id',_0x0db4('0x7'),_0x0db4('0x8'),_0x0db4('0x9')]},{'model':_0x0db4('0x5'),'as':_0x0db4('0xa'),'attributes':['id',_0x0db4('0x7'),_0x0db4('0x8'),_0x0db4('0x9')]},{'model':'Action','as':_0x0db4('0xb'),'attributes':['id','action',_0x0db4('0xc'),'data2',_0x0db4('0xd'),_0x0db4('0xe'),_0x0db4('0xf'),'data6',_0x0db4('0x10')]}]},'log':_0x0db4('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index cfe3c0d..b863884 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 _0xc1fa=['GetTrunk','Request','name','defaultuser'];(function(_0x2b958d,_0x1715b3){var _0x45a059=function(_0x2ceca3){while(--_0x2ceca3){_0x2b958d['push'](_0x2b958d['shift']());}};_0x45a059(++_0x1715b3);}(_0xc1fa,0xe5));var _0xac1f=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xc1fa[_0x34d275];return _0x1379cc;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x3802d0){return function(_0x1d461a){return client[_0xac1f('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xac1f('0x1'),'registry',_0xac1f('0x2')]},'log':_0xac1f('0x3')});};}; \ No newline at end of file +var _0xc651=['Request','GetTrunk','name','registry','defaultuser','../client','getTrunks'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xc651,0x16a));var _0x1c65=function(_0x54fe5e,_0x219172){_0x54fe5e=_0x54fe5e-0x0;var _0x4b8c46=_0xc651[_0x54fe5e];return _0x4b8c46;};'use strict';var client=require(_0x1c65('0x0'));exports[_0x1c65('0x1')]=function(_0x9421e7){return function(_0x3e2eb4){return client[_0x1c65('0x2')](_0x1c65('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1c65('0x4'),_0x1c65('0x5'),_0x1c65('0x6')]},'log':_0x1c65('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b5083f9..6f904da 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ 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(_0x4e2c29,_0x268b8c){var _0x2544b0=function(_0x407d8d){while(--_0x407d8d){_0x4e2c29['push'](_0x4e2c29['shift']());}};_0x2544b0(++_0x268b8c);}(_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 5781660..beca88f 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 _0x26eb=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x49eab4,_0x4ae658){var _0x585a1a=function(_0x1b58c8){while(--_0x1b58c8){_0x49eab4['push'](_0x49eab4['shift']());}};_0x585a1a(++_0x4ae658);}(_0x26eb,0xd5));var _0xb26e=function(_0x461253,_0x23d851){_0x461253=_0x461253-0x0;var _0x367032=_0x26eb[_0x461253];return _0x367032;};'use strict';var client=require(_0xb26e('0x0'));exports[_0xb26e('0x1')]=function(_0x2d1cd1){return client[_0xb26e('0x2')](_0xb26e('0x3'),{'body':_0x2d1cd1,'log':'CreateVoiceAgentReport'});};exports[_0xb26e('0x4')]=function(_0x4a88fb,_0x5b3ccb,_0x49f03b){return client[_0xb26e('0x2')](_0xb26e('0x5'),{'body':_0x4a88fb,'options':{'where':{'uniqueid':_0x5b3ccb,'interface':_0x49f03b,'agentcomplete':!![]}},'log':_0xb26e('0x5')});}; \ No newline at end of file +var _0x0da1=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x1c5a9e,_0x5b0fae){var _0x2c014=function(_0x1869b8){while(--_0x1869b8){_0x1c5a9e['push'](_0x1c5a9e['shift']());}};_0x2c014(++_0x5b0fae);}(_0x0da1,0x1de));var _0x10da=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0da1[_0x4c12ec];return _0x3ae42c;};'use strict';var client=require(_0x10da('0x0'));exports[_0x10da('0x1')]=function(_0x27af6a){return client[_0x10da('0x2')](_0x10da('0x3'),{'body':_0x27af6a,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0xc4e1d8,_0x1c5652,_0x3e0002){return client[_0x10da('0x2')](_0x10da('0x4'),{'body':_0xc4e1d8,'options':{'where':{'uniqueid':_0x1c5652,'interface':_0x3e0002,'agentcomplete':!![]}},'log':_0x10da('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1e79e35..b056df1 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 _0xa590=['CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','lodash','../client','create','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa590,0x1a5));var _0x0a59=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0xa590[_0x1a0600];return _0x734670;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x0a59('0x0'));var client=require(_0x0a59('0x1'));exports[_0x0a59('0x2')]=function(_0x44dfe9){return client[_0x0a59('0x3')](_0x0a59('0x4'),{'body':_[_0x0a59('0x5')](_0x44dfe9,{'source':_0x44dfe9['calleridnum'],'destinationcontext':_0x44dfe9[_0x0a59('0x6')],'callerid':_0x44dfe9[_0x0a59('0x7')],'amaflags':_0x0a59('0x8')}),'log':_0x0a59('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x0a59('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x0a59('0x9')],'createdAt':{'$between':[moment()[_0x0a59('0xa')](_0x0a59('0xb'))['format'](_0x0a59('0xc')),moment()['endOf'](_0x0a59('0xb'))['format'](_0x0a59('0xc'))]}},'attributes':[_0x0a59('0xd'),_0x0a59('0xe'),_0x0a59('0xf'),_0x0a59('0x10')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x76c7=['DOCUMENTATION','getVoiceCallReports','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','callerid'];(function(_0x14064a,_0xdc7bf0){var _0x4f993e=function(_0x5e9e3f){while(--_0x5e9e3f){_0x14064a['push'](_0x14064a['shift']());}};_0x4f993e(++_0xdc7bf0);}(_0x76c7,0x110));var _0x776c=function(_0x8227bd,_0x32d6f3){_0x8227bd=_0x8227bd-0x0;var _0x1456c9=_0x76c7[_0x8227bd];return _0x1456c9;};'use strict';var moment=require('moment');var util=require(_0x776c('0x0'));var _=require(_0x776c('0x1'));var client=require(_0x776c('0x2'));exports['create']=function(_0x111fc5){return client[_0x776c('0x3')](_0x776c('0x4'),{'body':_[_0x776c('0x5')](_0x111fc5,{'source':_0x111fc5[_0x776c('0x6')],'destinationcontext':_0x111fc5['context'],'callerid':_0x111fc5[_0x776c('0x7')],'amaflags':_0x776c('0x8')}),'log':_0x776c('0x4')});};exports[_0x776c('0x9')]=function(){return function(){return client[_0x776c('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x776c('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x776c('0xb'))[_0x776c('0xc')](_0x776c('0xd')),moment()[_0x776c('0xe')](_0x776c('0xb'))[_0x776c('0xc')](_0x776c('0xd'))]}},'attributes':[_0x776c('0xf'),_0x776c('0x10'),_0x776c('0x11'),_0x776c('0x12')]},'log':_0x776c('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a2a1739..8bf42b3 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 _0x2c48=['create','CreateVoiceDialReport','../client'];(function(_0x4688bd,_0x2f7caa){var _0x388a80=function(_0x2bad55){while(--_0x2bad55){_0x4688bd['push'](_0x4688bd['shift']());}};_0x388a80(++_0x2f7caa);}(_0x2c48,0x8c));var _0x82c4=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x2c48[_0x1e48d3];return _0x2852b1;};'use strict';var client=require(_0x82c4('0x0'));exports[_0x82c4('0x1')]=function(_0x20034b){return client['Request'](_0x82c4('0x2'),{'body':_0x20034b,'log':_0x82c4('0x2')});}; \ No newline at end of file +var _0x4fcc=['../client','Request','CreateVoiceDialReport'];(function(_0x19d9a9,_0x3b277f){var _0x263aa9=function(_0x49d9ac){while(--_0x49d9ac){_0x19d9a9['push'](_0x19d9a9['shift']());}};_0x263aa9(++_0x3b277f);}(_0x4fcc,0x7e));var _0xc4fc=function(_0x3a8931,_0x36e7a7){_0x3a8931=_0x3a8931-0x0;var _0x34dd86=_0x4fcc[_0x3a8931];return _0x34dd86;};'use strict';var client=require(_0xc4fc('0x0'));exports['create']=function(_0x557df1){return client[_0xc4fc('0x1')](_0xc4fc('0x2'),{'body':_0x557df1,'log':_0xc4fc('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index a706471..bb6acd3 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 _0xe630=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x8ba0f5,_0x4543c5){var _0x104092=function(_0x3c63f3){while(--_0x3c63f3){_0x8ba0f5['push'](_0x8ba0f5['shift']());}};_0x104092(++_0x4543c5);}(_0xe630,0x149));var _0x0e63=function(_0x54b0f3,_0x1fe2f7){_0x54b0f3=_0x54b0f3-0x0;var _0x5ae957=_0xe630[_0x54b0f3];return _0x5ae957;};'use strict';var client=require(_0x0e63('0x0'));exports[_0x0e63('0x1')]=function(){return function(){return client['Request'](_0x0e63('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0e63('0x3'),_0x0e63('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xc112=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xc112,0xec));var _0x2c11=function(_0x276f5a,_0x2e91fb){_0x276f5a=_0x276f5a-0x0;var _0x2836e=_0xc112[_0x276f5a];return _0x2836e;};'use strict';var client=require(_0x2c11('0x0'));exports[_0x2c11('0x1')]=function(){return function(){return client[_0x2c11('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2c11('0x3'),_0x2c11('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x2c11('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2ede87a..5fca6fc 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 _0xa5b4=['dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type'];(function(_0x4cdecc,_0x321d1a){var _0x3948a9=function(_0x2a247d){while(--_0x2a247d){_0x4cdecc['push'](_0x4cdecc['shift']());}};_0x3948a9(++_0x321d1a);}(_0xa5b4,0xf4));var _0x4a5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5b4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x4a5b('0x0')]=function(){return function(){return client[_0x4a5b('0x1')](_0x4a5b('0x2'),{'options':{'raw':![],'attributes':['id',_0x4a5b('0x3'),_0x4a5b('0x4'),'acwTimeout',_0x4a5b('0x5'),_0x4a5b('0x6'),_0x4a5b('0x7'),_0x4a5b('0x8'),_0x4a5b('0x9'),_0x4a5b('0xa'),_0x4a5b('0xb'),_0x4a5b('0xc'),_0x4a5b('0xd'),_0x4a5b('0xe'),'dialPredictiveInterval',_0x4a5b('0xf'),_0x4a5b('0x10'),_0x4a5b('0x11'),_0x4a5b('0x12'),_0x4a5b('0x13'),'dialQueueProject',_0x4a5b('0x14'),_0x4a5b('0x15'),_0x4a5b('0x16'),_0x4a5b('0x17'),_0x4a5b('0x18'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0x4a5b('0x19'),_0x4a5b('0x1a'),_0x4a5b('0x1b'),_0x4a5b('0x1c'),_0x4a5b('0x1d'),_0x4a5b('0x1e'),'dialAMDAfterGreetingSilence',_0x4a5b('0x1f'),_0x4a5b('0x20'),_0x4a5b('0x21'),_0x4a5b('0x22'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x4a5b('0x23'),'dialRecallMeTimeout',_0x4a5b('0x24'),_0x4a5b('0x25'),_0x4a5b('0x26'),'dialAgiAfterHangupClient',_0x4a5b('0x27'),'monitor_format','strategy',_0x4a5b('0x28'),'dialCutDigit',_0x4a5b('0x29'),_0x4a5b('0x2a'),_0x4a5b('0x2b'),_0x4a5b('0x2c'),_0x4a5b('0x2d'),_0x4a5b('0x2e'),_0x4a5b('0x2f'),_0x4a5b('0x30'),_0x4a5b('0x31'),'dialAgentRejectRetryFrequency',_0x4a5b('0x32'),_0x4a5b('0x33'),_0x4a5b('0x34'),_0x4a5b('0x35'),_0x4a5b('0x36')],'include':[{'model':'Trunk','as':_0x4a5b('0x37'),'attributes':['id',_0x4a5b('0x3'),_0x4a5b('0x38'),'active']},{'model':_0x4a5b('0x39'),'as':_0x4a5b('0x3a'),'attributes':['id',_0x4a5b('0x3')]},{'model':_0x4a5b('0x37'),'as':_0x4a5b('0x3b'),'attributes':['id',_0x4a5b('0x3'),_0x4a5b('0x38'),_0x4a5b('0x3c')]},{'model':_0x4a5b('0x3d'),'as':_0x4a5b('0x3d'),'attributes':['id',_0x4a5b('0x3')],'include':[{'model':_0x4a5b('0x3d'),'as':_0x4a5b('0x3e'),'attributes':['id','name','interval']}]}]},'log':_0x4a5b('0x0')});};}; \ No newline at end of file +var _0xa49f=['GetVoiceQueue','name','autopause','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','../client','Request'];(function(_0x5ab932,_0x23b79d){var _0x101295=function(_0x399e32){while(--_0x399e32){_0x5ab932['push'](_0x5ab932['shift']());}};_0x101295(++_0x23b79d);}(_0xa49f,0xb2));var _0xfa49=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xa49f[_0x35da42];return _0x370035;};'use strict';var client=require(_0xfa49('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xfa49('0x1')](_0xfa49('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa49('0x3'),'acw','acwTimeout',_0xfa49('0x4'),'monitor_format','type',_0xfa49('0x5'),_0xfa49('0x6'),_0xfa49('0x7'),_0xfa49('0x8'),_0xfa49('0x9'),'dialPredictiveOptimization',_0xfa49('0xa'),_0xfa49('0xb'),_0xfa49('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xfa49('0xd'),'dialQueueTimeout',_0xfa49('0xe'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0xfa49('0xf'),_0xfa49('0x10'),_0xfa49('0x11'),_0xfa49('0x12'),_0xfa49('0x13'),_0xfa49('0x14'),_0xfa49('0x15'),'dialCheckDuplicateType','dialAMDActive',_0xfa49('0x16'),_0xfa49('0x17'),'dialAMDAfterGreetingSilence',_0xfa49('0x18'),_0xfa49('0x19'),'dialAMDBetweenWordsSilence',_0xfa49('0x1a'),'dialAMDSilenceThreshold',_0xfa49('0x1b'),_0xfa49('0x1c'),_0xfa49('0x1d'),_0xfa49('0x1e'),_0xfa49('0x1f'),_0xfa49('0x20'),_0xfa49('0x21'),_0xfa49('0x22'),_0xfa49('0x23'),'strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xfa49('0x24'),_0xfa49('0x25'),_0xfa49('0x26'),_0xfa49('0x27'),_0xfa49('0x28'),_0xfa49('0x29'),_0xfa49('0x2a'),_0xfa49('0x2b'),_0xfa49('0x2c'),_0xfa49('0x2d'),'mandatoryDisposition',_0xfa49('0x2e'),_0xfa49('0x2f'),_0xfa49('0x30'),_0xfa49('0x31')],'include':[{'model':_0xfa49('0x32'),'as':_0xfa49('0x32'),'attributes':['id',_0xfa49('0x3'),'callerid',_0xfa49('0x33')]},{'model':_0xfa49('0x34'),'as':_0xfa49('0x35'),'attributes':['id',_0xfa49('0x3')]},{'model':_0xfa49('0x32'),'as':_0xfa49('0x36'),'attributes':['id',_0xfa49('0x3'),_0xfa49('0x37'),_0xfa49('0x33')]},{'model':_0xfa49('0x38'),'as':_0xfa49('0x38'),'attributes':['id',_0xfa49('0x3')],'include':[{'model':_0xfa49('0x38'),'as':_0xfa49('0x39'),'attributes':['id',_0xfa49('0x3'),_0xfa49('0x3a')]}]}]},'log':_0xfa49('0x3b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 8532d5a..b3708c5 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(_0xdf5faa,_0x39c554){var _0x12ab55=function(_0x465422){while(--_0x465422){_0xdf5faa['push'](_0xdf5faa['shift']());}};_0x12ab55(++_0x39c554);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x30e399,_0x349c3f){var _0x12b5eb=function(_0x2f3efd){while(--_0x2f3efd){_0x30e399['push'](_0x30e399['shift']());}};_0x12b5eb(++_0x349c3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 db66dbe..628635a 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 _0x6022=['../client','getVoiceQueueRtPauses','Request'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x6022,0x1ce));var _0x2602=function(_0x3e9fc5,_0x300c54){_0x3e9fc5=_0x3e9fc5-0x0;var _0x456410=_0x6022[_0x3e9fc5];return _0x456410;};'use strict';var client=require(_0x2602('0x0'));exports[_0x2602('0x1')]=function(_0x44d956){return function(){return client[_0x2602('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x44d956,'paused':!![]},'raw':!![]},'log':_0x2602('0x1')});};}; \ No newline at end of file +var _0x2b87=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x56d0a3,_0xbb47b2){var _0x60e629=function(_0x3a3fdb){while(--_0x3a3fdb){_0x56d0a3['push'](_0x56d0a3['shift']());}};_0x60e629(++_0xbb47b2);}(_0x2b87,0x16d));var _0x72b8=function(_0x35d358,_0x736a83){_0x35d358=_0x35d358-0x0;var _0x3d74e1=_0x2b87[_0x35d358];return _0x3d74e1;};'use strict';var client=require(_0x72b8('0x0'));exports[_0x72b8('0x1')]=function(_0x333d09){return function(){return client[_0x72b8('0x2')](_0x72b8('0x3'),{'options':{'where':{'VoiceQueueId':_0x333d09,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 7263112..0a06eb5 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3c3be3,_0xe7f14c){var _0x57dc65=function(_0x14521b){while(--_0x14521b){_0x3c3be3['push'](_0x3c3be3['shift']());}};_0x57dc65(++_0xe7f14c);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3b5736,_0x405711){var _0x457622=function(_0x35ca50){while(--_0x35ca50){_0x3b5736['push'](_0x3b5736['shift']());}};_0x457622(++_0x405711);}(_0x7a54,0x106));var _0x47a5=function(_0x33f48c,_0x57b116){_0x33f48c=_0x33f48c-0x0;var _0x53a51b=_0x7a54[_0x33f48c];return _0x53a51b;};'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 39f413d..9623c7f 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 _0x3dcf=['transferercontext','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode'];(function(_0x43ac88,_0x2cac9c){var _0x1617ec=function(_0x30448a){while(--_0x30448a){_0x43ac88['push'](_0x43ac88['shift']());}};_0x1617ec(++_0x2cac9c);}(_0x3dcf,0x1e6));var _0xf3dc=function(_0x1b71a3,_0x1dbc04){_0x1b71a3=_0x1b71a3-0x0;var _0x14528e=_0x3dcf[_0x1b71a3];return _0x14528e;};'use strict';var client=require(_0xf3dc('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x2ae4bb){return client[_0xf3dc('0x1')](_0xf3dc('0x2'),{'body':{'result':_0x2ae4bb[_0xf3dc('0x3')],'transfererchannel':_0x2ae4bb[_0xf3dc('0x4')],'transferercalleridnum':_0x2ae4bb[_0xf3dc('0x5')],'transferercalleridname':_0x2ae4bb[_0xf3dc('0x6')],'transfererconnectedlinenum':_0x2ae4bb['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2ae4bb['transfererconnectedlinename'],'transfereraccountcode':_0x2ae4bb[_0xf3dc('0x7')],'transferercontext':_0x2ae4bb[_0xf3dc('0x8')],'transfererexten':_0x2ae4bb['transfererexten'],'transfererlinkedid':_0x2ae4bb['transfererlinkedid'],'transfereechannel':_0x2ae4bb[_0xf3dc('0x9')],'transfereecalleridnum':_0x2ae4bb[_0xf3dc('0xa')],'transfereecalleridname':_0x2ae4bb['transfereecalleridname'],'transfereeconnectedlinenum':_0x2ae4bb[_0xf3dc('0xb')],'transfereeconnectedlinename':_0x2ae4bb[_0xf3dc('0xc')],'transfereeaccountcode':_0x2ae4bb['transfereeaccountcode'],'transfereecontext':_0x2ae4bb[_0xf3dc('0xd')],'transfereeexten':_0x2ae4bb[_0xf3dc('0xe')],'transfereelinkedid':_0x2ae4bb[_0xf3dc('0xf')],'isexternal':_0x2ae4bb[_0xf3dc('0x10')],'context':_0x2ae4bb[_0xf3dc('0x11')],'extension':_0x2ae4bb[_0xf3dc('0x12')],'type':'blind'},'log':_0xf3dc('0x2')});};exports[_0xf3dc('0x13')]=function(_0x29feb0){return client[_0xf3dc('0x1')](_0xf3dc('0x2'),{'body':{'result':_0x29feb0[_0xf3dc('0x3')],'transfererchannel':_0x29feb0[_0xf3dc('0x14')],'transferercalleridnum':_0x29feb0['origtransferercalleridnum'],'transferercalleridname':_0x29feb0[_0xf3dc('0x15')],'transfererconnectedlinenum':_0x29feb0[_0xf3dc('0x16')],'transfererconnectedlinename':_0x29feb0[_0xf3dc('0x17')],'transfereraccountcode':_0x29feb0[_0xf3dc('0x18')],'transferercontext':_0x29feb0[_0xf3dc('0x19')],'transfererexten':_0x29feb0[_0xf3dc('0x1a')],'transfererlinkedid':_0x29feb0[_0xf3dc('0x1b')],'transfereechannel':_0x29feb0[_0xf3dc('0x1c')],'transfereecalleridnum':_0x29feb0['transfertargetcalleridnum'],'transfereecalleridname':_0x29feb0[_0xf3dc('0x1d')],'transfereeconnectedlinenum':_0x29feb0[_0xf3dc('0x1e')],'transfereeconnectedlinename':_0x29feb0[_0xf3dc('0x1f')],'transfereeaccountcode':_0x29feb0['transfertargetaccountcode'],'transfereecontext':_0x29feb0[_0xf3dc('0x20')],'transfereeexten':_0x29feb0[_0xf3dc('0x21')],'transfereelinkedid':_0x29feb0[_0xf3dc('0x22')],'isexternal':_0x29feb0[_0xf3dc('0x10')],'context':_0x29feb0[_0xf3dc('0x23')],'extension':_0x29feb0[_0xf3dc('0x24')],'type':_0xf3dc('0x25')},'log':_0xf3dc('0x2')});}; \ No newline at end of file +var _0xb650=['origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel'];(function(_0x1b3132,_0x210ad8){var _0x31d71f=function(_0x25fdd5){while(--_0x25fdd5){_0x1b3132['push'](_0x1b3132['shift']());}};_0x31d71f(++_0x210ad8);}(_0xb650,0x101));var _0x0b65=function(_0x31924e,_0x1bd0c7){_0x31924e=_0x31924e-0x0;var _0x533f44=_0xb650[_0x31924e];return _0x533f44;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x4b233b){return client[_0x0b65('0x0')]('CreateVoiceTransferReport',{'body':{'result':_0x4b233b[_0x0b65('0x1')],'transfererchannel':_0x4b233b[_0x0b65('0x2')],'transferercalleridnum':_0x4b233b[_0x0b65('0x3')],'transferercalleridname':_0x4b233b[_0x0b65('0x4')],'transfererconnectedlinenum':_0x4b233b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x4b233b[_0x0b65('0x5')],'transfereraccountcode':_0x4b233b[_0x0b65('0x6')],'transferercontext':_0x4b233b[_0x0b65('0x7')],'transfererexten':_0x4b233b[_0x0b65('0x8')],'transfererlinkedid':_0x4b233b[_0x0b65('0x9')],'transfereechannel':_0x4b233b[_0x0b65('0xa')],'transfereecalleridnum':_0x4b233b[_0x0b65('0xb')],'transfereecalleridname':_0x4b233b[_0x0b65('0xc')],'transfereeconnectedlinenum':_0x4b233b[_0x0b65('0xd')],'transfereeconnectedlinename':_0x4b233b[_0x0b65('0xe')],'transfereeaccountcode':_0x4b233b[_0x0b65('0xf')],'transfereecontext':_0x4b233b[_0x0b65('0x10')],'transfereeexten':_0x4b233b[_0x0b65('0x11')],'transfereelinkedid':_0x4b233b['transfereelinkedid'],'isexternal':_0x4b233b['isexternal'],'context':_0x4b233b[_0x0b65('0x12')],'extension':_0x4b233b[_0x0b65('0x13')],'type':_0x0b65('0x14')},'log':_0x0b65('0x15')});};exports['attendedTransfer']=function(_0x55c597){return client[_0x0b65('0x0')]('CreateVoiceTransferReport',{'body':{'result':_0x55c597[_0x0b65('0x1')],'transfererchannel':_0x55c597[_0x0b65('0x16')],'transferercalleridnum':_0x55c597[_0x0b65('0x17')],'transferercalleridname':_0x55c597[_0x0b65('0x18')],'transfererconnectedlinenum':_0x55c597[_0x0b65('0x19')],'transfererconnectedlinename':_0x55c597[_0x0b65('0x1a')],'transfereraccountcode':_0x55c597[_0x0b65('0x1b')],'transferercontext':_0x55c597['secondtransferercontext'],'transfererexten':_0x55c597[_0x0b65('0x1c')],'transfererlinkedid':_0x55c597['origtransfererlinkedid'],'transfereechannel':_0x55c597[_0x0b65('0x1d')],'transfereecalleridnum':_0x55c597[_0x0b65('0x1e')],'transfereecalleridname':_0x55c597['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x55c597[_0x0b65('0x1f')],'transfereeconnectedlinename':_0x55c597[_0x0b65('0x20')],'transfereeaccountcode':_0x55c597[_0x0b65('0x21')],'transfereecontext':_0x55c597[_0x0b65('0x22')],'transfereeexten':_0x55c597[_0x0b65('0x23')],'transfereelinkedid':_0x55c597[_0x0b65('0x24')],'isexternal':_0x55c597['isexternal'],'context':_0x55c597[_0x0b65('0x25')],'extension':_0x55c597[_0x0b65('0x26')],'type':_0x0b65('0x27')},'log':_0x0b65('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c00422e..1a2efc6 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 _0x6075=['moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','module','Reload','Action','then','message','catch','command','content','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumHoldTime','talking','total','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','toLowerCase','isNil','monitors','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','validate','bluebird'];(function(_0x5b2568,_0x186e15){var _0xa533a9=function(_0x432814){while(--_0x432814){_0x5b2568['push'](_0x5b2568['shift']());}};_0xa533a9(++_0x186e15);}(_0x6075,0x191));var _0x5607=function(_0x3ea3c7,_0x197813){_0x3ea3c7=_0x3ea3c7-0x0;var _0x206845=_0x6075[_0x3ea3c7];return _0x206845;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var jayson=require(_0x5607('0x1'));var schema=require(_0x5607('0x2'));var BPromise=require(_0x5607('0x3'));var moment=require(_0x5607('0x4'));var config=require(_0x5607('0x5'));var properties=require(_0x5607('0x6'));var ami=require(_0x5607('0x7'));exports[_0x5607('0x8')]=function(_0x4d333d,_0x1f4637,_0xabf691){return new BPromise(function(_0x14b9f4,_0x5ab18d){var _0x53f825={'QueuePause':function(_0x3dc860){return new Promise(function(_0x25107d,_0x24d9da){var _0x299836=util[_0x5607('0x9')]('%s/%s',_0x5607('0xa'),_0x3dc860[_0x5607('0xb')]);if(_0x4d333d[_0x5607('0xc')]&&_0x4d333d['timers'][_0x299836]&&_0x4d333d[_0x5607('0xc')][_0x299836]['timer']){_0x4d333d['timers'][_0x299836][_0x5607('0xd')]();}if(_0x4d333d[_0x5607('0xe')][_0x299836]){_0x4d333d[_0x5607('0xe')][_0x299836]['updateStatusRealtime']({'statePause':_0x3dc860[_0x5607('0xf')]?!![]:![]});}_0x25107d({'code':0xc8,'message':_0x5607('0x10')});});},'Reload':function(_0xc534bd){var _0x39fc33=this;return new Promise(function(_0xe6368d,_0x33c436){if(ami[_0x5607('0x11')]()==![]){return _0x33c436(_0x39fc33[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config['asterisk'][_0x5607('0x14')],_0x5607('0x15')][_0x5607('0x16')]('\x20')));}_0xc534bd=_['pick'](_0xc534bd,_['keys'](properties[_0x5607('0x17')]));_0xc534bd['action']=_0x5607('0x18');return ami[_0x5607('0x19')](_0xc534bd)[_0x5607('0x1a')](function(_0x1375e9){_0xe6368d({'code':0xc8,'message':_0x1375e9[_0x5607('0x1b')]});})[_0x5607('0x1c')](function(_0x55689e){_0x33c436(_0x39fc33[_0x5607('0x12')](0x1f5,_0x55689e['message']));});});},'Command':function(_0x180775){var _0x3e071b=this;return new Promise(function(_0x430f68,_0x5f080d){if(ami[_0x5607('0x11')]()==![]){return _0x5f080d(_0x3e071b[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config['asterisk'][_0x5607('0x14')],_0x5607('0x15')][_0x5607('0x16')]('\x20')));}_0x180775=_['pick'](_0x180775,_0x5607('0x1d'));_0x180775['action']='Command';return ami[_0x5607('0x19')](_0x180775)[_0x5607('0x1a')](function(_0x32d30a){_0x430f68({'code':0xc8,'message':_0x32d30a[_0x5607('0x1e')]});})[_0x5607('0x1c')](function(_0x34df69){_0x5f080d(_0x3e071b[_0x5607('0x12')](0x1f5,_0x34df69[_0x5607('0x1b')]));});});},'VoiceQueues':function(_0x8a7592){return new Promise(function(_0x42a1af,_0x593df7){var _0x20ae60=[];for(var _0x27e144 in _0x4d333d['voiceQueues']){if(_0x4d333d[_0x5607('0x1f')][_0x5607('0x20')](_0x27e144)){var _0xdb07c8=_0x4d333d[_0x5607('0x1f')][_0x27e144];var _0x447042={'id':_0xdb07c8['id'],'name':_0xdb07c8[_0x5607('0xb')],'strategy':_0xdb07c8[_0x5607('0x21')],'answered':_0xdb07c8[_0x5607('0x22')],'available':_0xdb07c8['available'],'loggedIn':_0xdb07c8[_0x5607('0x23')],'pTalking':_0xdb07c8[_0x5607('0x24')],'sumBillable':_0xdb07c8['sumBillable'],'sumDuration':_0xdb07c8['sumDuration'],'sumHoldTime':_0xdb07c8[_0x5607('0x25')]||0x0,'talking':_0xdb07c8[_0x5607('0x26')],'total':_0xdb07c8[_0x5607('0x27')],'type':_0xdb07c8[_0x5607('0x28')],'unmanaged':_0xdb07c8[_0x5607('0x29')],'abandoned':_0xdb07c8['abandoned'],'waiting':_0xdb07c8[_0x5607('0x2a')],'loggedInDb':_0xdb07c8['loggedInDb']};if(_0xdb07c8[_0x5607('0x28')]===_0x5607('0x2b')){_0x447042[_0x5607('0x2c')]=_0xdb07c8['dialActive'];_0x447042[_0x5607('0x2d')]=_0xdb07c8['dialMethod'];_0x447042[_0x5607('0x2e')]=_0xdb07c8[_0x5607('0x2e')];_0x447042[_0x5607('0x2f')]=_0xdb07c8[_0x5607('0x2f')];_0x447042[_0x5607('0x30')]=_0xdb07c8['dialOriginateTimeout'];_0x447042[_0x5607('0x31')]=_0xdb07c8['dialPrefix'];_0x447042[_0x5607('0x32')]=_0xdb07c8[_0x5607('0x32')];_0x447042['outboundAnswerAgiCallsDay']=_0xdb07c8[_0x5607('0x33')];_0x447042[_0x5607('0x34')]=_0xdb07c8[_0x5607('0x34')];_0x447042['outboundBlacklistCallsDay']=_0xdb07c8[_0x5607('0x35')];_0x447042[_0x5607('0x36')]=_0xdb07c8[_0x5607('0x36')];_0x447042[_0x5607('0x37')]=_0xdb07c8['outboundCongestionCallsDay'];_0x447042[_0x5607('0x38')]=_0xdb07c8[_0x5607('0x38')];_0x447042['outboundDropCallsDayCallersExit']=_0xdb07c8[_0x5607('0x39')];_0x447042[_0x5607('0x3a')]=_0xdb07c8[_0x5607('0x3a')];_0x447042['outboundNoAnswerCallsDay']=_0xdb07c8[_0x5607('0x3b')];_0x447042['outboundNoSuchCallsDay']=_0xdb07c8[_0x5607('0x3c')];_0x447042[_0x5607('0x3d')]=_0xdb07c8[_0x5607('0x3d')];_0x447042['outboundReCallsDay']=_0xdb07c8['outboundReCallsDay'];_0x447042['outboundRejectCallsDay']=_0xdb07c8[_0x5607('0x3e')];_0x447042[_0x5607('0x3f')]=_0xdb07c8[_0x5607('0x3f')];_0x447042[_0x5607('0x40')]=_0xdb07c8[_0x5607('0x40')];_0x447042[_0x5607('0x41')]=_0xdb07c8[_0x5607('0x41')];_0x447042[_0x5607('0x42')]=_0xdb07c8['predictiveIntervalAvgTalktime'];_0x447042[_0x5607('0x43')]=_0xdb07c8[_0x5607('0x43')];_0x447042[_0x5607('0x44')]=_0xdb07c8[_0x5607('0x44')];_0x447042['predictiveIntervalErlangCalls']=_0xdb07c8[_0x5607('0x45')];_0x447042[_0x5607('0x46')]=_0xdb07c8['predictiveIntervalErlangCallsDroppedCalls'];_0x447042['predictiveIntervalHitRate']=_0xdb07c8[_0x5607('0x47')];_0x447042[_0x5607('0x48')]=_0xdb07c8[_0x5607('0x48')];_0x447042['predictiveIntervalPauses']=_0xdb07c8['predictiveIntervalPauses'];_0x447042['predictiveIntervalAvailable']=_0xdb07c8[_0x5607('0x49')];_0x447042[_0x5607('0x4a')]=_0xdb07c8[_0x5607('0x4a')];_0x447042['message']=_0xdb07c8[_0x5607('0x1b')];_0x447042[_0x5607('0x4b')]=_0xdb07c8[_0x5607('0x4b')];_0x447042[_0x5607('0x4c')]=_0xdb07c8[_0x5607('0x4c')];_0x447042[_0x5607('0x4d')]=_0xdb07c8[_0x5607('0x4d')];_0x447042['erlangAbandonmentRate']=_0xdb07c8['erlangAbandonmentRate'];_0x447042[_0x5607('0x4e')]=_0xdb07c8[_0x5607('0x4e')];_0x447042[_0x5607('0x4f')]=_0xdb07c8['startPredictive'];_0x447042[_0x5607('0x50')]=_0xdb07c8[_0x5607('0x50')];}if(_0xdb07c8['Trunk']){_0x447042[_0x5607('0x51')]={'id':_0xdb07c8[_0x5607('0x51')]['id'],'name':_0xdb07c8['Trunk']['name'],'active':_0xdb07c8[_0x5607('0x51')][_0x5607('0x52')],'callerid':_0xdb07c8[_0x5607('0x51')]['callerid']};}if(_0xdb07c8[_0x5607('0x53')]){_0x447042[_0x5607('0x53')]={'id':_0xdb07c8['Interval']['id'],'name':_0xdb07c8[_0x5607('0x53')][_0x5607('0xb')]};}_0x20ae60['push'](_0x447042);}}_0x42a1af({'count':_0x20ae60[_0x5607('0x54')],'rows':_0x20ae60});});},'UpdateVoiceQueue':function(_0x1dbb00){return new Promise(function(_0x4388b8,_0x5522d8){var _0x2dd1f8=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x1f')],{'id':parseInt(_0x1dbb00['id'])});var _0x2dddb2=_[_0x5607('0x56')](_0x1dbb00,['id']);if(_0x2dd1f8){for(var _0x517cc5 in _0x2dddb2){if(typeof _0x2dddb2[_0x517cc5]!==_0x5607('0x57')&&typeof _0x2dd1f8[_0x517cc5]!==_0x5607('0x57')){_0x2dd1f8[_0x517cc5]=_0x2dddb2[_0x517cc5];}}_0x4388b8(_0x2dd1f8);}else{_0x5522d8();}});},'VoiceChannels':function(_0x1bae90){return new Promise(function(_0x285306,_0xd0f24f){var _0x51c1fc=_[_0x5607('0x58')](_0x4d333d['channels']);_0x285306({'count':_0x51c1fc[_0x5607('0x54')],'rows':_0x51c1fc});});},'VoiceChannelMixMonitor':function(_0x4d88d){var _0x7ab0f9=this;return new Promise(function(_0x1a0975,_0x1b52b3){if(ami[_0x5607('0x11')]()==![]){return _0x1b52b3(_0x7ab0f9['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x5607('0x14')],_0x5607('0x15')]['join']('\x20')));}var _0xa6e098=schema(properties[_0x5607('0x59')])[_0x5607('0x2')](_0x4d88d);if(_0xa6e098[_0x5607('0x54')]>0x0){return _0x1b52b3(_0x7ab0f9[_0x5607('0x12')](0x1f4,_[_0x5607('0x5a')](_0xa6e098,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0xa10e08=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x5b')],{'uniqueid':_0x4d88d[_0x5607('0x5c')]});if(_0xa10e08&&_0xa10e08[_0x5607('0x5d')]){var _0x13b009=util[_0x5607('0x9')](_0x5607('0x5e'),_0x4d88d[_0x5607('0x5f')]||_0x4d88d['uniqueid'],_0x4d88d[_0x5607('0x9')]||'wav');return ami[_0x5607('0x19')]({'action':_0x5607('0x60'),'channel':_0xa10e08[_0x5607('0x5d')],'file':_0x13b009,'options':_0x5607('0x61')})[_0x5607('0x1a')](function(_0x1427eb){var _0x56d456=_[_0x5607('0x55')](_0xa10e08['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x13b009[_0x5607('0x62')]()});if(_[_0x5607('0x63')](_0x56d456)){_0xa10e08[_0x5607('0x64')][_0x5607('0x65')]({'filename':'/var/spool/asterisk/monitor/'+_0x13b009[_0x5607('0x62')](),'createdAt':moment()['format'](_0x5607('0x66')),'mixmonitorid':_0x1427eb[_0x5607('0x67')],'status':_0x5607('0x68')});}else{_0x56d456[_0x5607('0x67')]=_0x1427eb['mixmonitorid'];_0x56d456[_0x5607('0x69')]=_0x5607('0x68');}_0x1a0975({'code':0xc8,'message':[_0x4d88d['uniqueid'],_0x5607('0x6a'),_0x1427eb['mixmonitorid']][_0x5607('0x16')]('\x20'),'mixmonitorid':_0x1427eb[_0x5607('0x67')]});})[_0x5607('0x1c')](function(_0x335b82){_0x1b52b3(_0x7ab0f9[_0x5607('0x12')](0x1f5,[_0x4d88d['uniqueid'],_0x335b82[_0x5607('0x1b')][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x1b52b3(_0x7ab0f9[_0x5607('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x316b43){var _0x29b46f=this;return new Promise(function(_0x4fdf0e,_0x4da3f9){if(ami[_0x5607('0x11')]()==![]){return _0x4da3f9(_0x29b46f[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config[_0x5607('0x13')][_0x5607('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x279420=schema(properties['voicechannel'])[_0x5607('0x2')](_0x316b43);if(_0x279420['length']>0x0){return _0x4da3f9(_0x29b46f['error'](0x1f4,_['map'](_0x279420,'message')[_0x5607('0x16')](',\x20')));}var _0x3fc9be=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x5b')],{'uniqueid':_0x316b43[_0x5607('0x5c')]});if(_0x3fc9be){return BPromise[_0x5607('0x6b')]()[_0x5607('0x1a')](function(){if(_0x3fc9be['channel']){return ami[_0x5607('0x19')]({'action':_0x5607('0x6c'),'channel':_0x3fc9be[_0x5607('0x5d')],'mixmonitorid':_0x316b43['mixmonitorid']})[_0x5607('0x1c')](function(_0xb27fd7){});}})['then'](function(){if(_0x3fc9be[_0x5607('0x6d')]){return ami['Action']({'action':_0x5607('0x6c'),'channel':_0x3fc9be[_0x5607('0x6d')],'mixmonitorid':_0x316b43['mixmonitorid']})[_0x5607('0x1c')](function(_0x1291a0){});}})[_0x5607('0x1a')](function(_0x7cf9a9){var _0x25543d=_[_0x5607('0x55')](_0x3fc9be[_0x5607('0x64')],{'mixmonitorid':_0x316b43['mixmonitorid']});if(_0x25543d){_0x25543d['status']=_0x5607('0x6e');}})[_0x5607('0x1a')](function(){var _0x24638f=util[_0x5607('0x9')](_0x5607('0x5e'),_0x316b43[_0x5607('0x5f')]||_0x316b43[_0x5607('0x5c')],_0x316b43[_0x5607('0x9')]||_0x5607('0x6f'));var _0x1c92fb=_['find'](_0x3fc9be[_0x5607('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0x24638f[_0x5607('0x62')]()});if(_0x1c92fb){_0x1c92fb[_0x5607('0x69')]=_0x5607('0x6e');}})['then'](function(){_0x4fdf0e({'code':0xc8,'message':[_0x316b43['uniqueid'],_0x5607('0x70')]['join']('\x20')});})['catch'](function(_0x48a075){_0x4da3f9(_0x29b46f['error'](0x1f5,[_0x316b43[_0x5607('0x5c')],_0x48a075[_0x5607('0x1b')][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x4da3f9(_0x29b46f[_0x5607('0x12')](0x1f5,_0x5607('0x71')));}});},'VoiceQueuesChannels':function(_0x3aba9c){return new Promise(function(_0x4f1945,_0x1e0f58){var _0x325ef1=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x72')]);_0x4f1945({'count':_0x325ef1[_0x5607('0x54')],'rows':_0x325ef1});});},'VoiceQueuesChannel':function(_0x5e746c){var _0x150dcd=this;return new Promise(function(_0xf440e3,_0x37308e){var _0x559011=schema(properties[_0x5607('0x73')])[_0x5607('0x2')](_0x5e746c);if(_0x559011[_0x5607('0x54')]>0x0){return _0x37308e(_0x150dcd['error'](0x1f4,_[_0x5607('0x5a')](_0x559011,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0x29d020=_['find'](_0x4d333d[_0x5607('0x72')],{'uniqueid':_0x5e746c[_0x5607('0x5c')]});if(_0x29d020){_0xf440e3(_0x29d020);}else{return _0x37308e(_0x150dcd[_0x5607('0x12')](0x1f5,_0x5607('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x302113){var _0x2bd4e2=this;return new Promise(function(_0x251e26,_0x23448a){if(ami['isConnected']()==![]){return _0x23448a(_0x2bd4e2['error'](0x1f4,[config[_0x5607('0x13')]['ip'],config[_0x5607('0x13')][_0x5607('0x14')],_0x5607('0x15')][_0x5607('0x16')]('\x20')));}var _0x2f65c3=schema(properties['voicequeuechannelhangup'])[_0x5607('0x2')](_0x302113);if(_0x2f65c3[_0x5607('0x54')]>0x0){return _0x23448a(_0x2bd4e2[_0x5607('0x12')](0x1f4,_[_0x5607('0x5a')](_0x2f65c3,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0x40f1ab=_[_0x5607('0x55')](_0x4d333d['queueChannels'],{'uniqueid':_0x302113[_0x5607('0x5c')]});if(_0x40f1ab&&_0x40f1ab[_0x5607('0x5d')]){return ami['Action']({'action':'Hangup','channel':_0x40f1ab[_0x5607('0x5d')]})['then'](function(_0x1e4d49){_0x251e26({'code':0xc8,'message':[_0x302113['uniqueid'],_0x1e4d49['message'][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')});})['catch'](function(_0x5a4ccd){_0x23448a(_0x2bd4e2[_0x5607('0x12')](0x1f5,[_0x302113['uniqueid'],_0x5a4ccd['message'][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x23448a(_0x2bd4e2[_0x5607('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3acdd2){var _0x5757e4=this;return new Promise(function(_0x9ded24,_0x201920){if(ami[_0x5607('0x11')]()==![]){return _0x201920(_0x5757e4[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config['asterisk'][_0x5607('0x14')],'ami\x20disconnected'][_0x5607('0x16')]('\x20')));}var _0x4a2384=schema(properties[_0x5607('0x74')])[_0x5607('0x2')](_0x3acdd2);if(_0x4a2384[_0x5607('0x54')]>0x0){return _0x201920(_0x5757e4[_0x5607('0x12')](0x1f4,_['map'](_0x4a2384,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0x34e1c3=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x72')],{'uniqueid':_0x3acdd2[_0x5607('0x5c')]});if(_0x34e1c3&&_0x34e1c3[_0x5607('0x5d')]){return ami[_0x5607('0x19')]({'action':_0x5607('0x75'),'channel':_0x34e1c3[_0x5607('0x5d')],'exten':_0x3acdd2[_0x5607('0x76')],'context':_0x3acdd2[_0x5607('0x77')]||_0x34e1c3[_0x5607('0x77')],'priority':0x1})[_0x5607('0x1a')](function(_0x41eea5){_0x9ded24({'code':0xc8,'message':[_0x3acdd2[_0x5607('0x5c')],_0x41eea5[_0x5607('0x1b')][_0x5607('0x62')]()]['join']('\x20')});})[_0x5607('0x1c')](function(_0x4ebc44){_0x201920(_0x5757e4[_0x5607('0x12')](0x1f5,[_0x3acdd2['uniqueid'],_0x4ebc44[_0x5607('0x1b')][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x201920(_0x5757e4[_0x5607('0x12')](0x1f5,_0x5607('0x71')));}});},'Agents':function(_0xd775c6){return new Promise(function(_0x14c794,_0x394640){var _0x13a4ba=_['values'](_0x4d333d['agents']);_0x14c794({'count':_0x13a4ba[_0x5607('0x54')],'rows':_0x13a4ba});});},'Telephones':function(_0x43bae9){return new Promise(function(_0x1dd3d6,_0x4191df){var _0x40f7c8=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x78')]);_0x1dd3d6({'count':_0x40f7c8['length'],'rows':_0x40f7c8});});},'Trunks':function(_0x5c9959){return new Promise(function(_0x4e0d74,_0x4eef90){var _0x4b2916=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x79')]);_0x4e0d74({'count':_0x4b2916[_0x5607('0x54')],'rows':_0x4b2916});});},'OutboundChannels':function(_0x1488ec){return new Promise(function(_0x5f672c,_0x2e45a5){var _0x39e6e9=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x7a')]);_0x5f672c({'count':_0x39e6e9[_0x5607('0x54')],'rows':_0x39e6e9});});},'Outbound':function(_0x2d8f0a){return new Promise(function(_0x4a638d,_0x2afbc6){_0x4a638d(_0x4d333d[_0x5607('0x2b')]);});},'Campaigns':function(_0x1f13f9){return new Promise(function(_0xd4f4de,_0x2dda7a){var _0x464259=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x7b')]);_0xd4f4de({'count':_0x464259[_0x5607('0x54')],'rows':_0x464259});});},'VoiceQueuesPreview':function(_0x59ede7){var _0x5b04da=this;return new Promise(function(_0x5eb939,_0x429ec8){_0x1f4637[_0x5607('0x7c')](_0x59ede7['id'])[_0x5607('0x1a')](function(_0x22c57f){_0x5eb939({'code':0xc8,'message':_0x22c57f[_0x5607('0x1b')]});})[_0x5607('0x1c')](function(_0x321197){_0x429ec8(_0x5b04da['error'](0x1f4,_0x321197[_0x5607('0x1b')]));});});},'EventManager':function(_0x3c8b56){var _0xad467=this;return new Promise(function(_0x1e9af2,_0x265fa3){if(!_0x3c8b56[_0x5607('0x7d')]){return _0x265fa3(_0xad467[_0x5607('0x12')](0x1f4,_0x5607('0x7e')));}ami[_0x5607('0x7f')](_0x5607('0x80')+_0x3c8b56[_0x5607('0x7d')],_0x3c8b56['message']);_0x1e9af2({'code':0xc8,'message':_0x3c8b56});});},'FaxAccounts':function(_0x1f404b){return new Promise(function(_0x179dc2,_0x438219){var _0x442588=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x81')]);_0x179dc2({'count':_0x442588['length'],'rows':_0x442588});});},'SendFax':function(_0x2c48f8){var _0x2ee540=this;return new Promise(function(_0x11129a,_0x107b2f){_0xabf691['send'](_0x2c48f8)[_0x5607('0x1a')](function(_0x2085cc){_0x11129a({'code':0xc8,'message':_0x2085cc['message']});})['catch'](function(_0x1fc3ca){_0x107b2f(_0x2ee540['error'](0x1f4,_0x1fc3ca[_0x5607('0x1b')]));});});},'CheckAfterSend':function(_0x4ab236){var _0x2bd9c2=this;return new Promise(function(_0x2f4c43,_0x5df978){_0xabf691['checkAfterSend'](_0x4ab236)[_0x5607('0x1a')](function(_0x3a38c0){_0x2f4c43({'code':0xc8,'message':_0x3a38c0[_0x5607('0x1b')]});})['catch'](function(_0x548ed1){_0x5df978(_0x2bd9c2[_0x5607('0x12')](0x1f4,_0x548ed1[_0x5607('0x1b')]));});});}};var _0x2a59ec=jayson[_0x5607('0x82')](_0x53f825)[_0x5607('0x83')]();_0x2a59ec['on']('error',function(_0x5789a0){return _0x5ab18d(_0x5789a0);});_0x2a59ec[_0x5607('0x8')](0x232a,_0x5607('0x84'),function(){console[_0x5607('0x85')](_0x5607('0x86'),0x232a);return _0x14b9f4('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xb145=['Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','trunks','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','log','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','%s/%s','SIP','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','then','message','command','Action','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','type','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','values','channels','voicechannel','map','channel','format','filename','uniqueid','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','catch'];(function(_0x4f5f1c,_0x404440){var _0x411db9=function(_0x56a735){while(--_0x56a735){_0x4f5f1c['push'](_0x4f5f1c['shift']());}};_0x411db9(++_0x404440);}(_0xb145,0xa3));var _0x5b14=function(_0x844c7b,_0x234842){_0x844c7b=_0x844c7b-0x0;var _0x33fecf=_0xb145[_0x844c7b];return _0x33fecf;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var jayson=require(_0x5b14('0x1'));var schema=require(_0x5b14('0x2'));var BPromise=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var config=require(_0x5b14('0x5'));var properties=require(_0x5b14('0x6'));var ami=require(_0x5b14('0x7'));exports['listen']=function(_0x1e0b5b,_0x15490e,_0x392425){return new BPromise(function(_0x4d82ad,_0x50fd91){var _0x1d12ed={'QueuePause':function(_0x2a3921){return new Promise(function(_0x34530a,_0x62cdcd){var _0x473cfe=util['format'](_0x5b14('0x8'),_0x5b14('0x9'),_0x2a3921['name']);if(_0x1e0b5b[_0x5b14('0xa')]&&_0x1e0b5b[_0x5b14('0xa')][_0x473cfe]&&_0x1e0b5b[_0x5b14('0xa')][_0x473cfe][_0x5b14('0xb')]){_0x1e0b5b[_0x5b14('0xa')][_0x473cfe]['updateAcw']();}if(_0x1e0b5b[_0x5b14('0xc')][_0x473cfe]){_0x1e0b5b['agents'][_0x473cfe][_0x5b14('0xd')]({'statePause':_0x2a3921[_0x5b14('0xe')]?!![]:![]});}_0x34530a({'code':0xc8,'message':_0x5b14('0xf')});});},'Reload':function(_0x1cb56b){var _0x18b267=this;return new Promise(function(_0x40577a,_0x52ffa9){if(ami[_0x5b14('0x10')]()==![]){return _0x52ffa9(_0x18b267[_0x5b14('0x11')](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')][_0x5b14('0x15')]('\x20')));}_0x1cb56b=_[_0x5b14('0x16')](_0x1cb56b,_[_0x5b14('0x17')](properties[_0x5b14('0x18')]));_0x1cb56b[_0x5b14('0x19')]=_0x5b14('0x1a');return ami['Action'](_0x1cb56b)[_0x5b14('0x1b')](function(_0x50866a){_0x40577a({'code':0xc8,'message':_0x50866a['message']});})['catch'](function(_0x3f397d){_0x52ffa9(_0x18b267[_0x5b14('0x11')](0x1f5,_0x3f397d[_0x5b14('0x1c')]));});});},'Command':function(_0x89b7a0){var _0x3786f7=this;return new Promise(function(_0x16fba5,_0x19e6f8){if(ami['isConnected']()==![]){return _0x19e6f8(_0x3786f7['error'](0x1f4,[config['asterisk']['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')][_0x5b14('0x15')]('\x20')));}_0x89b7a0=_['pick'](_0x89b7a0,_0x5b14('0x1d'));_0x89b7a0[_0x5b14('0x19')]='Command';return ami[_0x5b14('0x1e')](_0x89b7a0)[_0x5b14('0x1b')](function(_0x50951f){_0x16fba5({'code':0xc8,'message':_0x50951f[_0x5b14('0x1f')]});})['catch'](function(_0x59282c){_0x19e6f8(_0x3786f7['error'](0x1f5,_0x59282c['message']));});});},'VoiceQueues':function(_0x2d62d1){return new Promise(function(_0x2d5f56,_0x153a25){var _0x5da505=[];for(var _0x46f86a in _0x1e0b5b[_0x5b14('0x20')]){if(_0x1e0b5b[_0x5b14('0x20')][_0x5b14('0x21')](_0x46f86a)){var _0xe6851b=_0x1e0b5b[_0x5b14('0x20')][_0x46f86a];var _0x422d22={'id':_0xe6851b['id'],'name':_0xe6851b[_0x5b14('0x22')],'strategy':_0xe6851b[_0x5b14('0x23')],'answered':_0xe6851b[_0x5b14('0x24')],'available':_0xe6851b[_0x5b14('0x25')],'loggedIn':_0xe6851b[_0x5b14('0x26')],'pTalking':_0xe6851b[_0x5b14('0x27')],'sumBillable':_0xe6851b[_0x5b14('0x28')],'sumDuration':_0xe6851b['sumDuration'],'sumHoldTime':_0xe6851b[_0x5b14('0x29')]||0x0,'talking':_0xe6851b[_0x5b14('0x2a')],'total':_0xe6851b['total'],'type':_0xe6851b['type'],'unmanaged':_0xe6851b[_0x5b14('0x2b')],'abandoned':_0xe6851b[_0x5b14('0x2c')],'waiting':_0xe6851b['waiting'],'loggedInDb':_0xe6851b['loggedInDb']};if(_0xe6851b[_0x5b14('0x2d')]==='outbound'){_0x422d22[_0x5b14('0x2e')]=_0xe6851b[_0x5b14('0x2e')];_0x422d22['dialMethod']=_0xe6851b['dialMethod'];_0x422d22[_0x5b14('0x2f')]=_0xe6851b[_0x5b14('0x2f')];_0x422d22[_0x5b14('0x30')]=_0xe6851b['dialOriginateCallerIdNumber'];_0x422d22[_0x5b14('0x31')]=_0xe6851b['dialOriginateTimeout'];_0x422d22[_0x5b14('0x32')]=_0xe6851b[_0x5b14('0x32')];_0x422d22[_0x5b14('0x33')]=_0xe6851b[_0x5b14('0x33')];_0x422d22['outboundAnswerAgiCallsDay']=_0xe6851b[_0x5b14('0x34')];_0x422d22[_0x5b14('0x35')]=_0xe6851b[_0x5b14('0x35')];_0x422d22[_0x5b14('0x36')]=_0xe6851b['outboundBlacklistCallsDay'];_0x422d22[_0x5b14('0x37')]=_0xe6851b[_0x5b14('0x37')];_0x422d22[_0x5b14('0x38')]=_0xe6851b['outboundCongestionCallsDay'];_0x422d22[_0x5b14('0x39')]=_0xe6851b['outboundDropCallsDayACS'];_0x422d22[_0x5b14('0x3a')]=_0xe6851b[_0x5b14('0x3a')];_0x422d22['outboundDropCallsDayTimeout']=_0xe6851b[_0x5b14('0x3b')];_0x422d22[_0x5b14('0x3c')]=_0xe6851b['outboundNoAnswerCallsDay'];_0x422d22[_0x5b14('0x3d')]=_0xe6851b['outboundNoSuchCallsDay'];_0x422d22[_0x5b14('0x3e')]=_0xe6851b[_0x5b14('0x3e')];_0x422d22[_0x5b14('0x3f')]=_0xe6851b[_0x5b14('0x3f')];_0x422d22['outboundRejectCallsDay']=_0xe6851b[_0x5b14('0x40')];_0x422d22[_0x5b14('0x41')]=_0xe6851b[_0x5b14('0x41')];_0x422d22[_0x5b14('0x42')]=_0xe6851b[_0x5b14('0x42')];_0x422d22[_0x5b14('0x43')]=_0xe6851b[_0x5b14('0x43')];_0x422d22[_0x5b14('0x44')]=_0xe6851b[_0x5b14('0x44')];_0x422d22[_0x5b14('0x45')]=_0xe6851b[_0x5b14('0x45')];_0x422d22[_0x5b14('0x46')]=_0xe6851b[_0x5b14('0x46')];_0x422d22[_0x5b14('0x47')]=_0xe6851b[_0x5b14('0x47')];_0x422d22[_0x5b14('0x48')]=_0xe6851b['predictiveIntervalErlangCallsDroppedCalls'];_0x422d22[_0x5b14('0x49')]=_0xe6851b['predictiveIntervalHitRate'];_0x422d22[_0x5b14('0x4a')]=_0xe6851b[_0x5b14('0x4a')];_0x422d22['predictiveIntervalPauses']=_0xe6851b['predictiveIntervalPauses'];_0x422d22['predictiveIntervalAvailable']=_0xe6851b[_0x5b14('0x4b')];_0x422d22[_0x5b14('0x4c')]=_0xe6851b['predictiveIntervalTotalCalls'];_0x422d22[_0x5b14('0x1c')]=_0xe6851b[_0x5b14('0x1c')];_0x422d22[_0x5b14('0x4d')]=_0xe6851b[_0x5b14('0x4d')];_0x422d22[_0x5b14('0x4e')]=_0xe6851b['erlangCalls'];_0x422d22[_0x5b14('0x4f')]=_0xe6851b[_0x5b14('0x4f')];_0x422d22['erlangAbandonmentRate']=_0xe6851b[_0x5b14('0x50')];_0x422d22[_0x5b14('0x51')]=_0xe6851b[_0x5b14('0x51')];_0x422d22[_0x5b14('0x52')]=_0xe6851b['startPredictive'];_0x422d22[_0x5b14('0x53')]=_0xe6851b[_0x5b14('0x53')];}if(_0xe6851b[_0x5b14('0x54')]){_0x422d22[_0x5b14('0x54')]={'id':_0xe6851b['Trunk']['id'],'name':_0xe6851b[_0x5b14('0x54')][_0x5b14('0x22')],'active':_0xe6851b[_0x5b14('0x54')][_0x5b14('0x55')],'callerid':_0xe6851b['Trunk']['callerid']};}if(_0xe6851b[_0x5b14('0x56')]){_0x422d22[_0x5b14('0x56')]={'id':_0xe6851b['Interval']['id'],'name':_0xe6851b[_0x5b14('0x56')]['name']};}_0x5da505[_0x5b14('0x57')](_0x422d22);}}_0x2d5f56({'count':_0x5da505[_0x5b14('0x58')],'rows':_0x5da505});});},'UpdateVoiceQueue':function(_0x2df4fa){return new Promise(function(_0x3bf048,_0x30d8d4){var _0x557ff4=_[_0x5b14('0x59')](_0x1e0b5b[_0x5b14('0x20')],{'id':parseInt(_0x2df4fa['id'])});var _0x285881=_[_0x5b14('0x5a')](_0x2df4fa,['id']);if(_0x557ff4){for(var _0x46e8ba in _0x285881){if(typeof _0x285881[_0x46e8ba]!=='undefined'&&typeof _0x557ff4[_0x46e8ba]!=='undefined'){_0x557ff4[_0x46e8ba]=_0x285881[_0x46e8ba];}}_0x3bf048(_0x557ff4);}else{_0x30d8d4();}});},'VoiceChannels':function(_0x370f19){return new Promise(function(_0x51af0f,_0x4a93e9){var _0x4825b4=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x5c')]);_0x51af0f({'count':_0x4825b4[_0x5b14('0x58')],'rows':_0x4825b4});});},'VoiceChannelMixMonitor':function(_0x16af6f){var _0x3740bb=this;return new Promise(function(_0x3eb335,_0x1d550f){if(ami['isConnected']()==![]){return _0x1d550f(_0x3740bb['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x5b14('0x14')][_0x5b14('0x15')]('\x20')));}var _0x31b527=schema(properties[_0x5b14('0x5d')])[_0x5b14('0x2')](_0x16af6f);if(_0x31b527['length']>0x0){return _0x1d550f(_0x3740bb['error'](0x1f4,_[_0x5b14('0x5e')](_0x31b527,_0x5b14('0x1c'))['join'](',\x20')));}var _0x286879=_[_0x5b14('0x59')](_0x1e0b5b['channels'],{'uniqueid':_0x16af6f['uniqueid']});if(_0x286879&&_0x286879[_0x5b14('0x5f')]){var _0x1d6fdc=util[_0x5b14('0x60')]('%s.%s',_0x16af6f[_0x5b14('0x61')]||_0x16af6f[_0x5b14('0x62')],_0x16af6f[_0x5b14('0x60')]||_0x5b14('0x63'));return ami[_0x5b14('0x1e')]({'action':_0x5b14('0x64'),'channel':_0x286879[_0x5b14('0x5f')],'file':_0x1d6fdc,'options':'ai(mixmonitorid)'})[_0x5b14('0x1b')](function(_0x5e99a4){var _0x44e625=_[_0x5b14('0x59')](_0x286879[_0x5b14('0x65')],{'filename':_0x5b14('0x66')+_0x1d6fdc[_0x5b14('0x67')]()});if(_[_0x5b14('0x68')](_0x44e625)){_0x286879[_0x5b14('0x65')][_0x5b14('0x57')]({'filename':_0x5b14('0x66')+_0x1d6fdc[_0x5b14('0x67')](),'createdAt':moment()[_0x5b14('0x60')](_0x5b14('0x69')),'mixmonitorid':_0x5e99a4['mixmonitorid'],'status':'rec'});}else{_0x44e625['mixmonitorid']=_0x5e99a4[_0x5b14('0x6a')];_0x44e625[_0x5b14('0x6b')]=_0x5b14('0x6c');}_0x3eb335({'code':0xc8,'message':[_0x16af6f[_0x5b14('0x62')],_0x5b14('0x6d'),_0x5e99a4[_0x5b14('0x6a')]][_0x5b14('0x15')]('\x20'),'mixmonitorid':_0x5e99a4['mixmonitorid']});})[_0x5b14('0x6e')](function(_0x19e88a){_0x1d550f(_0x3740bb['error'](0x1f5,[_0x16af6f['uniqueid'],_0x19e88a[_0x5b14('0x1c')][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')));});}else{return _0x1d550f(_0x3740bb[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x1009e5){var _0x5a21af=this;return new Promise(function(_0x2629ad,_0x48ffb3){if(ami[_0x5b14('0x10')]()==![]){return _0x48ffb3(_0x5a21af['error'](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],'ami\x20disconnected'][_0x5b14('0x15')]('\x20')));}var _0x566063=schema(properties[_0x5b14('0x5d')])[_0x5b14('0x2')](_0x1009e5);if(_0x566063[_0x5b14('0x58')]>0x0){return _0x48ffb3(_0x5a21af['error'](0x1f4,_[_0x5b14('0x5e')](_0x566063,_0x5b14('0x1c'))[_0x5b14('0x15')](',\x20')));}var _0x2e5bd4=_['find'](_0x1e0b5b[_0x5b14('0x5c')],{'uniqueid':_0x1009e5['uniqueid']});if(_0x2e5bd4){return BPromise[_0x5b14('0x70')]()[_0x5b14('0x1b')](function(){if(_0x2e5bd4['channel']){return ami['Action']({'action':_0x5b14('0x71'),'channel':_0x2e5bd4[_0x5b14('0x5f')],'mixmonitorid':_0x1009e5[_0x5b14('0x6a')]})['catch'](function(_0x474999){});}})[_0x5b14('0x1b')](function(){if(_0x2e5bd4['destinationchannel']){return ami[_0x5b14('0x1e')]({'action':_0x5b14('0x71'),'channel':_0x2e5bd4[_0x5b14('0x72')],'mixmonitorid':_0x1009e5[_0x5b14('0x6a')]})[_0x5b14('0x6e')](function(_0x49af2e){});}})[_0x5b14('0x1b')](function(_0x465907){var _0x521513=_['find'](_0x2e5bd4[_0x5b14('0x65')],{'mixmonitorid':_0x1009e5[_0x5b14('0x6a')]});if(_0x521513){_0x521513['status']='stop';}})[_0x5b14('0x1b')](function(){var _0x3824e6=util[_0x5b14('0x60')]('%s.%s',_0x1009e5[_0x5b14('0x61')]||_0x1009e5[_0x5b14('0x62')],_0x1009e5[_0x5b14('0x60')]||'wav');var _0x453e4b=_[_0x5b14('0x59')](_0x2e5bd4[_0x5b14('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x3824e6[_0x5b14('0x67')]()});if(_0x453e4b){_0x453e4b[_0x5b14('0x6b')]=_0x5b14('0x73');}})[_0x5b14('0x1b')](function(){_0x2629ad({'code':0xc8,'message':[_0x1009e5[_0x5b14('0x62')],_0x5b14('0x74')][_0x5b14('0x15')]('\x20')});})['catch'](function(_0x5ac604){_0x48ffb3(_0x5a21af['error'](0x1f5,[_0x1009e5['uniqueid'],_0x5ac604[_0x5b14('0x1c')][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')));});}else{return _0x48ffb3(_0x5a21af[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'VoiceQueuesChannels':function(_0x58f544){return new Promise(function(_0x56f20e,_0x1df8b2){var _0x5d9348=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x75')]);_0x56f20e({'count':_0x5d9348[_0x5b14('0x58')],'rows':_0x5d9348});});},'VoiceQueuesChannel':function(_0x4870f9){var _0x540f81=this;return new Promise(function(_0x1dded6,_0x1b76a0){var _0x160a4f=schema(properties[_0x5b14('0x76')])[_0x5b14('0x2')](_0x4870f9);if(_0x160a4f[_0x5b14('0x58')]>0x0){return _0x1b76a0(_0x540f81[_0x5b14('0x11')](0x1f4,_[_0x5b14('0x5e')](_0x160a4f,_0x5b14('0x1c'))['join'](',\x20')));}var _0x18960b=_['find'](_0x1e0b5b[_0x5b14('0x75')],{'uniqueid':_0x4870f9[_0x5b14('0x62')]});if(_0x18960b){_0x1dded6(_0x18960b);}else{return _0x1b76a0(_0x540f81[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x4665d7){var _0x223faa=this;return new Promise(function(_0x2b8286,_0x4f9e57){if(ami['isConnected']()==![]){return _0x4f9e57(_0x223faa[_0x5b14('0x11')](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')]['join']('\x20')));}var _0x1310a5=schema(properties[_0x5b14('0x77')])[_0x5b14('0x2')](_0x4665d7);if(_0x1310a5[_0x5b14('0x58')]>0x0){return _0x4f9e57(_0x223faa[_0x5b14('0x11')](0x1f4,_[_0x5b14('0x5e')](_0x1310a5,_0x5b14('0x1c'))[_0x5b14('0x15')](',\x20')));}var _0x44c3a2=_[_0x5b14('0x59')](_0x1e0b5b['queueChannels'],{'uniqueid':_0x4665d7['uniqueid']});if(_0x44c3a2&&_0x44c3a2[_0x5b14('0x5f')]){return ami[_0x5b14('0x1e')]({'action':'Hangup','channel':_0x44c3a2[_0x5b14('0x5f')]})[_0x5b14('0x1b')](function(_0x2c24cb){_0x2b8286({'code':0xc8,'message':[_0x4665d7[_0x5b14('0x62')],_0x2c24cb['message'][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')});})[_0x5b14('0x6e')](function(_0x35f241){_0x4f9e57(_0x223faa[_0x5b14('0x11')](0x1f5,[_0x4665d7[_0x5b14('0x62')],_0x35f241[_0x5b14('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x4f9e57(_0x223faa['error'](0x1f5,_0x5b14('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x23c285){var _0xaf4676=this;return new Promise(function(_0x7541a1,_0x3449df){if(ami[_0x5b14('0x10')]()==![]){return _0x3449df(_0xaf4676[_0x5b14('0x11')](0x1f4,[config[_0x5b14('0x12')]['ip'],config[_0x5b14('0x12')][_0x5b14('0x13')],_0x5b14('0x14')]['join']('\x20')));}var _0xd28c0d=schema(properties[_0x5b14('0x78')])[_0x5b14('0x2')](_0x23c285);if(_0xd28c0d[_0x5b14('0x58')]>0x0){return _0x3449df(_0xaf4676['error'](0x1f4,_[_0x5b14('0x5e')](_0xd28c0d,_0x5b14('0x1c'))[_0x5b14('0x15')](',\x20')));}var _0xc16146=_[_0x5b14('0x59')](_0x1e0b5b[_0x5b14('0x75')],{'uniqueid':_0x23c285[_0x5b14('0x62')]});if(_0xc16146&&_0xc16146[_0x5b14('0x5f')]){return ami[_0x5b14('0x1e')]({'action':_0x5b14('0x79'),'channel':_0xc16146[_0x5b14('0x5f')],'exten':_0x23c285[_0x5b14('0x7a')],'context':_0x23c285[_0x5b14('0x7b')]||_0xc16146[_0x5b14('0x7b')],'priority':0x1})[_0x5b14('0x1b')](function(_0x49fbbc){_0x7541a1({'code':0xc8,'message':[_0x23c285[_0x5b14('0x62')],_0x49fbbc[_0x5b14('0x1c')][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')});})[_0x5b14('0x6e')](function(_0x5939ae){_0x3449df(_0xaf4676['error'](0x1f5,[_0x23c285[_0x5b14('0x62')],_0x5939ae['message'][_0x5b14('0x67')]()][_0x5b14('0x15')]('\x20')));});}else{return _0x3449df(_0xaf4676[_0x5b14('0x11')](0x1f5,_0x5b14('0x6f')));}});},'Agents':function(_0x1af04d){return new Promise(function(_0x1eebf1,_0x4f09d5){var _0x1f08e3=_['values'](_0x1e0b5b['agents']);_0x1eebf1({'count':_0x1f08e3[_0x5b14('0x58')],'rows':_0x1f08e3});});},'Telephones':function(_0x3c79bb){return new Promise(function(_0x110968,_0x5ef4aa){var _0x5b8e11=_['values'](_0x1e0b5b['telephones']);_0x110968({'count':_0x5b8e11[_0x5b14('0x58')],'rows':_0x5b8e11});});},'Trunks':function(_0x1f7304){return new Promise(function(_0x30ad09,_0x47e418){var _0x5761cf=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x7c')]);_0x30ad09({'count':_0x5761cf['length'],'rows':_0x5761cf});});},'OutboundChannels':function(_0x293016){return new Promise(function(_0x16931d,_0x4bead1){var _0x4e7109=_['values'](_0x1e0b5b['outboundChannels']);_0x16931d({'count':_0x4e7109[_0x5b14('0x58')],'rows':_0x4e7109});});},'Outbound':function(_0x4b8775){return new Promise(function(_0x30d043,_0x7de41b){_0x30d043(_0x1e0b5b['outbound']);});},'Campaigns':function(_0x1fc726){return new Promise(function(_0x5ce32a,_0x908c23){var _0x57ba59=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x7d')]);_0x5ce32a({'count':_0x57ba59['length'],'rows':_0x57ba59});});},'VoiceQueuesPreview':function(_0x1c2ebf){var _0x14b2e9=this;return new Promise(function(_0x21161b,_0x2a3a92){_0x15490e['run'](_0x1c2ebf['id'])[_0x5b14('0x1b')](function(_0x2b6397){_0x21161b({'code':0xc8,'message':_0x2b6397['message']});})[_0x5b14('0x6e')](function(_0x4042ec){_0x2a3a92(_0x14b2e9[_0x5b14('0x11')](0x1f4,_0x4042ec['message']));});});},'EventManager':function(_0x22eef3){var _0x3e22b9=this;return new Promise(function(_0xe32822,_0x4eb5d7){if(!_0x22eef3[_0x5b14('0x7e')]){return _0x4eb5d7(_0x3e22b9['error'](0x1f4,_0x5b14('0x7f')));}ami['emit'](_0x5b14('0x80')+_0x22eef3[_0x5b14('0x7e')],_0x22eef3['message']);_0xe32822({'code':0xc8,'message':_0x22eef3});});},'FaxAccounts':function(_0x389410){return new Promise(function(_0x49381f,_0x253054){var _0x891dee=_[_0x5b14('0x5b')](_0x1e0b5b[_0x5b14('0x81')]);_0x49381f({'count':_0x891dee[_0x5b14('0x58')],'rows':_0x891dee});});},'SendFax':function(_0x55c0e2){var _0x56a634=this;return new Promise(function(_0x343fe3,_0x5c5f1c){_0x392425[_0x5b14('0x82')](_0x55c0e2)[_0x5b14('0x1b')](function(_0x3b9788){_0x343fe3({'code':0xc8,'message':_0x3b9788[_0x5b14('0x1c')]});})['catch'](function(_0x4221bc){_0x5c5f1c(_0x56a634[_0x5b14('0x11')](0x1f4,_0x4221bc[_0x5b14('0x1c')]));});});},'CheckAfterSend':function(_0x89d622){var _0x16d778=this;return new Promise(function(_0xd637cb,_0x869232){_0x392425[_0x5b14('0x83')](_0x89d622)[_0x5b14('0x1b')](function(_0x61a051){_0xd637cb({'code':0xc8,'message':_0x61a051['message']});})['catch'](function(_0x54911b){_0x869232(_0x16d778['error'](0x1f4,_0x54911b['message']));});});}};var _0x43c239=jayson[_0x5b14('0x84')](_0x1d12ed)[_0x5b14('0x85')]();_0x43c239['on'](_0x5b14('0x11'),function(_0x57021a){return _0x50fd91(_0x57021a);});_0x43c239[_0x5b14('0x86')](0x232a,_0x5b14('0x87'),function(){console[_0x5b14('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x4d82ad('RPC\x20listening\x20on\x20port:'+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 0164a6f..ecc84fa 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 _0xb821=['routeId','destcalleridnum','calleridname','Unknown','destcalleridname','','push','format','name','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','../../../../config/logger','redis','defaults','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','map','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0xb821,0xa7));var _0x1b82=function(_0x31ad52,_0x488b34){_0x31ad52=_0x31ad52-0x0;var _0x30b38f=_0xb821[_0x31ad52];return _0x30b38f;};'use strict';var _=require('lodash');var BPromise=require(_0x1b82('0x0'));var Redis=require(_0x1b82('0x1'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x1b82('0x2'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x1b82('0x3')]=_[_0x1b82('0x4')](config[_0x1b82('0x3')],{'host':_0x1b82('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1b82('0x3')]));function emit(_0x192434,_0x202a5f,_0x3632dd,_0x18f45f,_0x7b87e8){logger[_0x1b82('0x6')](_0x1b82('0x7'),_0x192434,_0x202a5f['id'],_0x3632dd,_0x18f45f,JSON[_0x1b82('0x8')](_0x7b87e8));io['to'](_0x3632dd)['emit'](_0x18f45f,_0x7b87e8);}exports[_0x1b82('0x9')]=function(_0x30c6ee,_0x44dfd4,_0x14c57a,_0xcffb87){var _0x17a96b,_0x739f99;var _0x1ce719={};var _0x5f521f=Number(_0x14c57a[_0x1b82('0xa')]);var _0x241d11=_0x14c57a[_0x1b82('0xb')]?Boolean(Number(_0x14c57a[_0x1b82('0xb')])):![];var _0x50aed7;var _0x1a6285=![];if(!_['isNil'](_0x14c57a['data5'])){if(_0x14c57a[_0x1b82('0xc')]=='1')_0x1a6285=!![];}if(!_0x1a6285){if(_0xcffb87['xmd-contactid']){_0x1ce719['id']=_0xcffb87[_0x1b82('0xd')];}}if(!_0x1ce719['id']){_0x1ce719[_0x1b82('0xe')]=_0x5f521f;_0x50aed7=_0x14c57a['data3']&&_0x14c57a[_0x1b82('0xf')]!=='0'?_0x14c57a['data3']['split'](','):[_0x1b82('0x10')];_0x1ce719['$or']=_[_0x1b82('0x11')](_0x50aed7,function(_0x25228b){var _0xf42818={};_0xf42818[_0x25228b]=_0xcffb87['routeId']?_0xcffb87['destcalleridnum']:_0xcffb87[_0x1b82('0x12')];return _0xf42818;});}var _0x5d66c3=['id',_0x1b82('0x13'),_0x1b82('0x14'),_0x1b82('0x10'),'mobile',_0x1b82('0x15'),_0x1b82('0xe'),_0x1b82('0x16'),_0x1b82('0x17'),_0x1b82('0x18')];var _0x47e99b=_[_0x1b82('0x19')](_0x5d66c3,_0x50aed7);BPromise[_0x1b82('0x1a')]()[_0x1b82('0x1b')](cmContactRpc[_0x1b82('0x1c')]({'attributes':_0x47e99b,'where':_0x1ce719}))[_0x1b82('0x1b')](function(_0x31fd64){_0x739f99=_0x31fd64;if(!_[_0x1b82('0x1d')](_0x739f99)){if(_0x739f99['length']===0x1){_0x17a96b=_0x739f99[0x0];logger[_0x1b82('0x6')](_0x1b82('0x1e'),_0xcffb87['uniqueid'],_0x44dfd4['id'],_0x17a96b['id']);}else{logger[_0x1b82('0x6')](_0x1b82('0x1f'),_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id'],_['map'](_0x739f99,'id')[_0x1b82('0x21')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0xcffb87['uniqueid'],_0x44dfd4['id']);var _0xf2e556={'ListId':_0x5f521f};var _0x149d0f=_0x14c57a[_0x1b82('0x22')]&&_0x14c57a[_0x1b82('0x22')]!=='0'?_0x14c57a['data4']:_0x1b82('0x10');if(_0x241d11){logger[_0x1b82('0x6')](_0x1b82('0x23'),_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id']);_0xf2e556[_0x149d0f]=_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])?_0xcffb87[_0x1b82('0x12')]:_0xcffb87[_0x1b82('0x26')];if(_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])){_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x27')]&&_0xcffb87[_0x1b82('0x27')]!==''?_0xcffb87[_0x1b82('0x27')]:_0x1b82('0x28');}else{_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x29')]&&_0xcffb87[_0x1b82('0x29')]!==_0x1b82('0x2a')?_0xcffb87[_0x1b82('0x29')]:_0x1b82('0x28');}return BPromise[_0x1b82('0x1a')]()[_0x1b82('0x1b')](cmContactRpc['createContact'](_0xf2e556))[_0x1b82('0x1b')](function(_0x29a31e){_0x17a96b=_0x29a31e;_0x739f99[_0x1b82('0x2b')](_0x29a31e);if(_0x17a96b){logger[_0x1b82('0x6')]('[CM][%s][%s]\x20Contact\x20created:%s',_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id'],_0x17a96b['id']);}return;});}else{logger[_0x1b82('0x6')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id']);_0xf2e556[_0x149d0f]=_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])?_0xcffb87['calleridnum']:_0xcffb87['destcalleridnum'];if(_[_0x1b82('0x24')](_0xcffb87['routeId'])){_0xf2e556['firstName']=_0xcffb87[_0x1b82('0x27')]&&_0xcffb87[_0x1b82('0x27')]!==_0x1b82('0x2a')?_0xcffb87['calleridname']:_0x1b82('0x28');}else{_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x29')]&&_0xcffb87[_0x1b82('0x29')]!==''?_0xcffb87[_0x1b82('0x29')]:_0x1b82('0x28');}_0x17a96b=_0xf2e556;_0x739f99[_0x1b82('0x2b')](_0xf2e556);return;}}})['then'](function(){if(_0x30c6ee){emit(_0xcffb87['uniqueid'],_0x44dfd4,util[_0x1b82('0x2c')]('user:%s',_0x30c6ee[_0x1b82('0x2d')]),util[_0x1b82('0x2c')](_0x1b82('0x2e'),_0x14c57a[_0x1b82('0x2f')][_0x1b82('0x30')]()),{'evt':_[_0x1b82('0x31')](_0xcffb87,{'autoCreate':_0x241d11}),'contact':_0x17a96b===undefined?{}:_0x17a96b,'contacts':_0x739f99[_0x1b82('0x32')]===0x0?undefined:_0x739f99});}});}; \ No newline at end of file +var _0xac31=['mobile','fax','ListId','createdAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','info','[CM][%s][%s]\x20Contact\x20not\x20found','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName'];(function(_0x38b75c,_0xd912d3){var _0x12d29a=function(_0x52be94){while(--_0x52be94){_0x38b75c['push'](_0x38b75c['shift']());}};_0x12d29a(++_0xd912d3);}(_0xac31,0xca));var _0x1ac3=function(_0x9d2f02,_0x3a17be){_0x9d2f02=_0x9d2f02-0x0;var _0x3865ed=_0xac31[_0x9d2f02];return _0x3865ed;};'use strict';var _=require(_0x1ac3('0x0'));var BPromise=require(_0x1ac3('0x1'));var Redis=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var config=require(_0x1ac3('0x4'));var logger=require(_0x1ac3('0x5'))(_0x1ac3('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x1ac3('0x7')]=_[_0x1ac3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1ac3('0x9'))(new Redis(config[_0x1ac3('0x7')]));function emit(_0x2bf9b1,_0x1be223,_0x157604,_0x57893c,_0x2d17de){logger['info'](_0x1ac3('0xa'),_0x2bf9b1,_0x1be223['id'],_0x157604,_0x57893c,JSON[_0x1ac3('0xb')](_0x2d17de));io['to'](_0x157604)[_0x1ac3('0xc')](_0x57893c,_0x2d17de);}exports['exec']=function(_0xa26c88,_0x1e2642,_0x3e835b,_0x24f0d2){var _0x2a8dc7,_0x422d19;var _0x4b5c92={};var _0x3b38fc=Number(_0x3e835b[_0x1ac3('0xd')]);var _0x2eeabf=_0x3e835b[_0x1ac3('0xe')]?Boolean(Number(_0x3e835b['data2'])):![];var _0x88ed7c;var _0x37d426=![];if(!_[_0x1ac3('0xf')](_0x3e835b[_0x1ac3('0x10')])){if(_0x3e835b['data5']=='1')_0x37d426=!![];}if(!_0x37d426){if(_0x24f0d2[_0x1ac3('0x11')]){_0x4b5c92['id']=_0x24f0d2[_0x1ac3('0x11')];}}if(!_0x4b5c92['id']){_0x4b5c92['ListId']=_0x3b38fc;_0x88ed7c=_0x3e835b[_0x1ac3('0x12')]&&_0x3e835b[_0x1ac3('0x12')]!=='0'?_0x3e835b[_0x1ac3('0x12')]['split'](','):[_0x1ac3('0x13')];_0x4b5c92[_0x1ac3('0x14')]=_[_0x1ac3('0x15')](_0x88ed7c,function(_0x541744){var _0x195683={};_0x195683[_0x541744]=_0x24f0d2['routeId']?_0x24f0d2[_0x1ac3('0x16')]:_0x24f0d2[_0x1ac3('0x17')];return _0x195683;});}var _0x20091d=['id',_0x1ac3('0x18'),_0x1ac3('0x19'),'phone',_0x1ac3('0x1a'),_0x1ac3('0x1b'),_0x1ac3('0x1c'),_0x1ac3('0x1d'),'scheduledAt','updatedAt'];var _0x2879d8=_[_0x1ac3('0x1e')](_0x20091d,_0x88ed7c);BPromise[_0x1ac3('0x1f')]()[_0x1ac3('0x20')](cmContactRpc[_0x1ac3('0x21')]({'attributes':_0x2879d8,'where':_0x4b5c92}))[_0x1ac3('0x20')](function(_0x23b767){_0x422d19=_0x23b767;if(!_[_0x1ac3('0x22')](_0x422d19)){if(_0x422d19[_0x1ac3('0x23')]===0x1){_0x2a8dc7=_0x422d19[0x0];logger['info'](_0x1ac3('0x24'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_0x2a8dc7['id']);}else{logger['info'](_0x1ac3('0x26'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_['map'](_0x422d19,'id')[_0x1ac3('0x27')](','));}return;}else{logger[_0x1ac3('0x28')](_0x1ac3('0x29'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);var _0x10db3d={'ListId':_0x3b38fc};var _0x565a0f=_0x3e835b['data4']&&_0x3e835b['data4']!=='0'?_0x3e835b['data4']:'phone';if(_0x2eeabf){logger[_0x1ac3('0x28')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);_0x10db3d[_0x565a0f]=_[_0x1ac3('0xf')](_0x24f0d2[_0x1ac3('0x2a')])?_0x24f0d2[_0x1ac3('0x17')]:_0x24f0d2['destcalleridnum'];if(_[_0x1ac3('0xf')](_0x24f0d2['routeId'])){_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2[_0x1ac3('0x2b')]&&_0x24f0d2[_0x1ac3('0x2b')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2b')]:_0x1ac3('0x2d');}else{_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2['destcalleridname']&&_0x24f0d2[_0x1ac3('0x2e')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2e')]:_0x1ac3('0x2d');}return BPromise['resolve']()[_0x1ac3('0x20')](cmContactRpc[_0x1ac3('0x2f')](_0x10db3d))[_0x1ac3('0x20')](function(_0x294513){_0x2a8dc7=_0x294513;_0x422d19[_0x1ac3('0x30')](_0x294513);if(_0x2a8dc7){logger['info'](_0x1ac3('0x31'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_0x2a8dc7['id']);}return;});}else{logger[_0x1ac3('0x28')](_0x1ac3('0x32'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);_0x10db3d[_0x565a0f]=_[_0x1ac3('0xf')](_0x24f0d2['routeId'])?_0x24f0d2[_0x1ac3('0x17')]:_0x24f0d2[_0x1ac3('0x16')];if(_[_0x1ac3('0xf')](_0x24f0d2[_0x1ac3('0x2a')])){_0x10db3d['firstName']=_0x24f0d2[_0x1ac3('0x2b')]&&_0x24f0d2[_0x1ac3('0x2b')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2b')]:_0x1ac3('0x2d');}else{_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2[_0x1ac3('0x2e')]&&_0x24f0d2[_0x1ac3('0x2e')]!==_0x1ac3('0x2c')?_0x24f0d2['destcalleridname']:_0x1ac3('0x2d');}_0x2a8dc7=_0x10db3d;_0x422d19[_0x1ac3('0x30')](_0x10db3d);return;}}})['then'](function(){if(_0xa26c88){emit(_0x24f0d2[_0x1ac3('0x25')],_0x1e2642,util[_0x1ac3('0x33')](_0x1ac3('0x34'),_0xa26c88[_0x1ac3('0x35')]),util[_0x1ac3('0x33')](_0x1ac3('0x36'),_0x3e835b[_0x1ac3('0x37')][_0x1ac3('0x38')]()),{'evt':_['merge'](_0x24f0d2,{'autoCreate':_0x2eeabf}),'contact':_0x2a8dc7===undefined?{}:_0x2a8dc7,'contacts':_0x422d19[_0x1ac3('0x23')]===0x0?undefined:_0x422d19});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9cd26df..66660d5 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 _0xd90a=['zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','custom:dialend','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','stringify','clone','motionChannel','checkTriggers','interface','hasOwnProperty','status','checkTrigger','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','render','data2','template\x20not\x20found','uri','buildUri','data3','isNil','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments','emit','format','user:%s','name','merge','jscripty','trigger:%s','exec','integration','routeId','script','query','search','replace','AllConditions','every','channel','AnyConditions','some','checkConditions','field','chat','operator','value','ChatWebsiteId','AccountId','upperFirst','interaction','message','event','queue','membername','lastevent','mailSubstatus','null','substatus','undefined','offlineMessage','created','equals','util','url','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xd90a,0x6b));var _0xad90=function(_0x56072c,_0xbc1d04){_0x56072c=_0x56072c-0x0;var _0x487a84=_0xd90a[_0x56072c];return _0x487a84;};'use strict';var util=require(_0xad90('0x0'));var _=require('lodash');var url=require(_0xad90('0x1'));var Mustache=require('mustache');var Redis=require(_0xad90('0x2'));var urlforward=require('./urlforward');var integration=require(_0xad90('0x3'));var cmContact=require(_0xad90('0x4'));var script=require(_0xad90('0x5'));var config=require(_0xad90('0x6'));var logger=require(_0xad90('0x7'))(_0xad90('0x8'));var ami=require(_0xad90('0x9'));config[_0xad90('0xa')]=_[_0xad90('0xb')](config[_0xad90('0xa')],{'host':_0xad90('0xc'),'port':0x18eb});var io=require(_0xad90('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x18d4d3,_0x2c5b57){return _0x18d4d3==_0x2c5b57;},'not_equals':function(_0x5e86f5,_0x238224){return _0x5e86f5!=_0x238224;}};var barAndWebActions=[_0xad90('0xe'),_0xad90('0x1'),'winapp'];function Trigger(_0x42f1a8){this[_0xad90('0xf')]=_0x42f1a8['triggers'];this[_0xad90('0x10')]=_0x42f1a8[_0xad90('0x10')];this['voiceQueues']=_0x42f1a8[_0xad90('0x11')];this[_0xad90('0x12')]=_0x42f1a8[_0xad90('0x12')];this[_0xad90('0x13')]=_0x42f1a8[_0xad90('0x13')];this[_0xad90('0x14')]=_0x42f1a8[_0xad90('0x14')];this[_0xad90('0x15')]=_0x42f1a8['freshdeskAccounts'];this[_0xad90('0x16')]=_0x42f1a8[_0xad90('0x16')];this[_0xad90('0x17')]=_0x42f1a8[_0xad90('0x17')];this[_0xad90('0x18')]=_0x42f1a8[_0xad90('0x18')];this['deskAccounts']=_0x42f1a8['deskAccounts'];this[_0xad90('0x19')]=_0x42f1a8[_0xad90('0x19')];this[_0xad90('0x1a')]=_0x42f1a8[_0xad90('0x1a')];this[_0xad90('0x1b')]=_0x42f1a8[_0xad90('0x1b')];this['freshsalesAccounts']=_0x42f1a8[_0xad90('0x1c')];this[_0xad90('0x1d')]={'zendesk':this[_0xad90('0x14')],'salesforce':this[_0xad90('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xad90('0x17')],'zoho':this[_0xad90('0x18')],'desk':this[_0xad90('0x1e')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xad90('0x1a')]};ami['on'](_0xad90('0x1f'),this['syncCustomEvent'][_0xad90('0x20')](this));ami['on']('custom:agentconnect',this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x22'),this[_0xad90('0x21')]['bind'](this));ami['on']('custom:agentcomplete',this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x23'),this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0xad90('0x25'),this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x26'),this['syncCustomEvent'][_0xad90('0x20')](this));ami['on'](_0xad90('0x27'),this[_0xad90('0x21')]['bind'](this));ami['on'](_0xad90('0x28'),this['syncCustomEvent'][_0xad90('0x20')](this));ami['on'](_0xad90('0x29'),this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x2a'),this[_0xad90('0x21')]['bind'](this));ami['on'](_0xad90('0x2b'),this['syncAgentDial'][_0xad90('0x20')](this));ami['on'](_0xad90('0x2c'),this['syncAgentDial'][_0xad90('0x20')](this));ami['on'](_0xad90('0x2d'),this[_0xad90('0x2e')][_0xad90('0x20')](this));ami['on'](_0xad90('0x2f'),this[_0xad90('0x21')]['bind'](this));ami['on'](_0xad90('0x30'),this['syncCustomEvent'][_0xad90('0x20')](this));ami['on'](_0xad90('0x31'),this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x32'),this['syncCustomEvent'][_0xad90('0x20')](this));ami['on']('custom:outgoingmessage',this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x33'),this[_0xad90('0x21')][_0xad90('0x20')](this));ami['on'](_0xad90('0x34'),this[_0xad90('0x21')]['bind'](this));ami['on'](_0xad90('0x35'),this['syncCustomEvent'][_0xad90('0x20')](this));}Trigger[_0xad90('0x36')]['emit']=function(_0x532275,_0x2fea58,_0x4f795a){logger['info'](_0x532275,_0x2fea58,JSON[_0xad90('0x37')](_0x4f795a));io['to'](_0x532275)['emit'](_0x2fea58,_0x4f795a);};Trigger[_0xad90('0x36')][_0xad90('0x21')]=function(_0x390d1b){var _0xf853e5=_[_0xad90('0x38')](_0x390d1b);if(typeof _0xf853e5[_0xad90('0x39')]==='undefined'){_0xf853e5[_0xad90('0x39')]='voice';}this[_0xad90('0x3a')](_0xf853e5);};Trigger[_0xad90('0x36')][_0xad90('0x2e')]=function(_0x38e207){if(this[_0xad90('0x10')][_0x38e207[_0xad90('0x3b')]]){this[_0xad90('0x21')](_0x38e207);}};Trigger[_0xad90('0x36')]['checkTriggers']=function(_0x38b5f4){var _0x1b3fcc;for(var _0x37dffe in this['triggers']){if(this['triggers'][_0xad90('0x3c')](_0x37dffe)){if(this[_0xad90('0xf')][_0x37dffe][_0xad90('0x3d')]){_0x1b3fcc=this[_0xad90('0x3e')](this[_0xad90('0xf')][_0x37dffe],_0x38b5f4);if(_0x1b3fcc){_['merge'](_0x38b5f4,_0x38b5f4['variables']);for(var _0x1719de=0x0,_0x16aa3b,_0x55e80e,_0x2c3795;_0x1719de0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _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(_0x4baf2b,_0x275fc4){var _0x478d2e=function(_0x4c8ca5){while(--_0x4c8ca5){_0x4baf2b['push'](_0x4baf2b['shift']());}};_0x478d2e(++_0x275fc4);}(_0x3e74,0x175));var _0x43e7=function(_0x9840d5,_0x5a3274){_0x9840d5=_0x9840d5-0x0;var _0x4f7964=_0x3e74[_0x9840d5];return _0x4f7964;};'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 bea35a4..e757573 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 _0xe2dc=['customField','idField','substring','indexOf','content','incident','incidents','assign','getString','/contacts(','Fields','ticketType','phonecall','callDirection','queue','Descriptions','ticketId','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error','message','GET','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','outbound','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','Bearer\x20','telephone1','contactid','nothing','toUpperCase',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist'];(function(_0x507510,_0x42562e){var _0x4c2e80=function(_0x589536){while(--_0x589536){_0x507510['push'](_0x507510['shift']());}};_0x4c2e80(++_0x42562e);}(_0xe2dc,0x1c6));var _0xce2d=function(_0x6a1fbc,_0x4ddb2d){_0x6a1fbc=_0x6a1fbc-0x0;var _0x44ee87=_0xe2dc[_0x6a1fbc];return _0x44ee87;};'use strict';var _=require(_0xce2d('0x0'));var rp=require(_0xce2d('0x1'));var util=require(_0xce2d('0x2'));var intUtil=require(_0xce2d('0x3'));var md5=require(_0xce2d('0x4'));var Redis=require('ioredis');var logger=require(_0xce2d('0x5'))(_0xce2d('0x6'));var config=require(_0xce2d('0x7'));config['redis']=_['defaults'](config[_0xce2d('0x8')],{'host':_0xce2d('0x9'),'port':0x18eb});var io=require(_0xce2d('0xa'))(new Redis(config[_0xce2d('0x8')]));function getAuthToken(_0x5d8b68,_0xef519e,_0x3dd8bc){if(_0x5d8b68[_0xce2d('0xb')]){_0x5d8b68[_0xce2d('0xc')]=_0x5d8b68[_0xce2d('0xd')][_0xce2d('0xe')];_0x5d8b68[_0xce2d('0xf')]=_0x5d8b68[_0xce2d('0xd')][_0xce2d('0x10')];return Promise[_0xce2d('0x11')](_0x5d8b68[_0xce2d('0xd')][_0xce2d('0x12')]);}var _0x3b719d={'method':_0xce2d('0x13'),'uri':_0xef519e,'form':{'client_id':_0x5d8b68[_0xce2d('0x14')],'resource':_0x5d8b68[_0xce2d('0xc')],'username':_0x5d8b68[_0xce2d('0x15')],'password':_0x5d8b68[_0xce2d('0x16')],'grant_type':_0xce2d('0x16'),'client_secret':_0x5d8b68[_0xce2d('0x17')]},'json':!![]};return rp(_0x3b719d)[_0xce2d('0x18')](function(_0x2c2dcd){return _0x2c2dcd[_0xce2d('0x19')];})[_0xce2d('0x1a')](function(_0x39ae70){logger[_0xce2d('0x1b')]('['+[_0x3dd8bc['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x39ae70[_0xce2d('0x1c')];});}function getUser(_0x11e5c2,_0x45175d,_0x6a7082,_0x3ffdb3,_0x14c158,_0x4c13af){return new Promise(function(_0x894cbf,_0x1b7a54){return getAuthToken(_0x45175d,_0x3ffdb3,_0x4c13af)[_0xce2d('0x18')](function(_0x290be0){var _0x2e52da={'method':_0xce2d('0x1d'),'uri':_0x14c158+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x290be0,'OData-Version':_0xce2d('0x1e')},'json':!![]};return rp(_0x2e52da);})[_0xce2d('0x18')](function(_0x5ddba7){var _0x1e3a1d=_0x5ddba7['value'];var _0x13d574=![];var _0x299cbf=null;if(!_[_0xce2d('0x1f')](_0x6a7082)){if(intUtil[_0xce2d('0x20')](_0x6a7082[_0xce2d('0x21')])){_0x11e5c2[_0xce2d('0x22')]=_0x6a7082[_0xce2d('0x21')];for(_0x299cbf=0x0;_0x299cbf<_0x1e3a1d[_0xce2d('0x23')];_0x299cbf++){if(_0x1e3a1d[_0x299cbf][_0xce2d('0x24')]===_0x6a7082[_0xce2d('0x21')]&&!_0x1e3a1d[_0x299cbf][_0xce2d('0x25')]){_0x13d574=!![];logger[_0xce2d('0x26')]('['+[_0x4c13af['toUpperCase']()]+_0xce2d('0x27')+_0x1e3a1d[_0x299cbf][_0xce2d('0x28')]+'!');_0x11e5c2[_0xce2d('0x29')]=_0x1e3a1d[_0x299cbf][_0xce2d('0x28')];}}}}if(!_0x13d574){logger[_0xce2d('0x26')]('['+[_0x4c13af['toUpperCase']()]+_0xce2d('0x2a'));_0x11e5c2[_0xce2d('0x22')]=_0x45175d[_0xce2d('0x15')];for(_0x299cbf=0x0;_0x299cbf<_0x1e3a1d['length'];_0x299cbf++){if(_0x1e3a1d[_0x299cbf][_0xce2d('0x24')]===_0x45175d[_0xce2d('0x15')]){_0x11e5c2['userId']=_0x1e3a1d[_0x299cbf]['systemuserid'];}}}_0x894cbf(_0x11e5c2);})['catch'](function(_0x36d01a){_0x1b7a54(_0x36d01a[_0xce2d('0x1c')]);});});}function createEndUser(_0x245b45,_0x3e69d4,_0x8f2beb,_0xe57d49,_0x532c21,_0x434274){return new Promise(function(_0x3c641e,_0x3a68ef){return getAuthToken(_0x3e69d4,_0x8f2beb,_0x434274)[_0xce2d('0x18')](function(_0x414ba5){var _0x32677d=_0x434274[_0xce2d('0x2b')]()==='outbound'?_0x532c21[_0xce2d('0x2c')]:_0x532c21[_0xce2d('0x2d')];var _0x77d56b={'method':'POST','uri':_0xe57d49+_0xce2d('0x2e'),'body':{'telephone1':_0x32677d,'fullname':_0x32677d,'firstname':_0x32677d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xce2d('0x2f')+_0x245b45[_0xce2d('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x414ba5,'OData-Version':_0xce2d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x77d56b);})[_0xce2d('0x18')](function(_0x589024){var _0x496496=_0x589024[_0xce2d('0x30')][_0xce2d('0x31')];var _0x4f73dc=_0x496496['substring'](_0x496496[_0xce2d('0x32')]('(')+0x1,_0x496496[_0xce2d('0x32')](')'));_0x245b45[_0xce2d('0x33')]=_0x4f73dc;_0x3c641e(_0x245b45);})['catch'](function(_0x5218be){_0x3a68ef(_0x5218be['message']);});});}function getEndUser(_0x5831c3,_0x408392,_0x5f296e,_0x1ee6c8,_0x25fab0,_0x31ca5a,_0x2ff2bf){var _0x4a4f72=_0x31ca5a[_0xce2d('0x2b')]()===_0xce2d('0x34')?_0x25fab0[_0xce2d('0x2c')]:_0x25fab0['calleridnum'];return getAuthToken(_0x408392,_0x5f296e,_0x31ca5a)[_0xce2d('0x18')](function(_0x528832){var _0x214ede={'method':_0xce2d('0x1d'),'uri':_0x1ee6c8+_0xce2d('0x35')+_0x4a4f72['replace']('+',_0xce2d('0x36'))+'\x27','headers':{'Authorization':_0xce2d('0x37')+_0x528832,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x214ede);})[_0xce2d('0x18')](function(_0x589dff){var _0x550ef9=![];if(!_0x589dff)return _0x550ef9;var _0x49c35c=_0x589dff['value'];for(var _0x107055=0x0;_0x107055<_0x49c35c[_0xce2d('0x23')];_0x107055++){if(_0x49c35c[_0x107055][_0xce2d('0x38')]===_0x4a4f72){_0x550ef9=!![];_0x5831c3[_0xce2d('0x33')]=_0x49c35c[_0x107055][_0xce2d('0x39')];}}return _0x550ef9;})['then'](function(_0x496fdc){if(_0x496fdc)return _0x5831c3;if(_0x2ff2bf===_0xce2d('0x3a')){logger['info']('['+[_0x31ca5a[_0xce2d('0x3b')]()]+_0xce2d('0x3c'));return _0x5831c3;}return createEndUser(_0x5831c3,_0x408392,_0x5f296e,_0x1ee6c8,_0x25fab0,_0x31ca5a)[_0xce2d('0x18')](function(_0x538120){logger[_0xce2d('0x26')]('['+[_0x31ca5a[_0xce2d('0x3b')]()]+_0xce2d('0x3d'),_0x538120[_0xce2d('0x33')]);return _0x538120;});});}function getCustomFields(_0x47556c,_0x598d97,_0x4c2015){var _0x37aaca={};if(_0x47556c[_0xce2d('0x23')]>0x0){_[_0xce2d('0x3e')](_0x47556c,function(_0x4f9e10){if(_[_0xce2d('0x3f')]([_0xce2d('0x40'),_0xce2d('0x41')],_0x4f9e10['type'])&&_0x4f9e10['nameField']&&!_0x4f9e10[_0xce2d('0x42')]){var _0x128ee1=_0x4f9e10[_0xce2d('0x43')]['toLowerCase']();var _0x1838c1=_0x128ee1[_0xce2d('0x44')](0x0,_0x128ee1[_0xce2d('0x45')]('_'));var _0xf1c8f7=_0x128ee1[_0xce2d('0x44')](_0x128ee1[_0xce2d('0x45')]('_')+0x1);if(_0x1838c1===_0x4c2015){_0x37aaca[_0xf1c8f7]=_0x4f9e10[_0xce2d('0x46')];}}});}return _0x37aaca;}function getTicket(_0x2fb5d2,_0x5ca161,_0x3ce240,_0x45e507,_0x176530,_0x310053,_0x19e7e6){return new Promise(function(_0x360e2b,_0x3c72a3){var _0x3f8476;return getAuthToken(_0x5ca161,_0x3ce240,_0x19e7e6)[_0xce2d('0x18')](function(_0x26e07c){if(_0x310053['ticketType']===_0xce2d('0x47')){_0x3f8476={'method':_0xce2d('0x13'),'uri':_0x45e507+_0xce2d('0x48'),'body':Object[_0xce2d('0x49')]({},{'title':intUtil[_0xce2d('0x4a')](_0x310053['Subjects'],_0x176530,'\x20'),'description':intUtil[_0xce2d('0x4a')](_0x310053['Descriptions'],_0x176530,'\x0a'),'customerid_contact@odata.bind':_0x2fb5d2[_0xce2d('0x33')]?_0xce2d('0x4b')+_0x2fb5d2['enduserId']+')':undefined,'ownerid@odata.bind':_0xce2d('0x2f')+_0x2fb5d2['userId']+')','caseorigincode':'1'},getCustomFields(_0x310053[_0xce2d('0x4c')],_0x176530,_0x310053[_0xce2d('0x4d')])),'headers':{'Authorization':_0xce2d('0x37')+_0x26e07c,'OData-Version':_0xce2d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x310053[_0xce2d('0x4d')]===_0xce2d('0x4e')){var _0x578235=_0x2fb5d2[_0xce2d('0x33')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2fb5d2['userId']+')','participationtypemask':_0x2fb5d2[_0xce2d('0x4f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xce2d('0x4b')+_0x2fb5d2[_0xce2d('0x33')]+')','participationtypemask':_0x2fb5d2['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xce2d('0x2f')+_0x2fb5d2['userId']+')','participationtypemask':_0x2fb5d2['callDirection']===_0xce2d('0x50')?0x2:0x1}];_0x3f8476={'method':_0xce2d('0x13'),'uri':_0x45e507+'phonecalls','body':Object[_0xce2d('0x49')]({},{'subject':intUtil[_0xce2d('0x4a')](_0x310053['Subjects'],_0x176530,'\x20'),'phonenumber':String(_0x176530[_0xce2d('0x2d')]),'description':intUtil[_0xce2d('0x4a')](_0x310053[_0xce2d('0x51')],_0x176530,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2fb5d2[_0xce2d('0x33')]?_0xce2d('0x4b')+_0x2fb5d2['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2fb5d2['userId']+')','directioncode':_0x2fb5d2['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x578235},getCustomFields(_0x310053[_0xce2d('0x4c')],_0x176530,_0x310053[_0xce2d('0x4d')])),'headers':{'Authorization':_0xce2d('0x37')+_0x26e07c,'OData-Version':_0xce2d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3f8476);})[_0xce2d('0x18')](function(_0x24c277){var _0x181a3=_0x24c277[_0xce2d('0x30')]['odata-entityid'];var _0x3ec077=_0x181a3[_0xce2d('0x44')](_0x181a3['lastIndexOf']('(')+0x1,_0x181a3['lastIndexOf'](')'));_0x2fb5d2[_0xce2d('0x52')]=_0x3ec077;_0x360e2b(_0x2fb5d2);})[_0xce2d('0x1a')](function(_0x525e41){_0x3c72a3(_0x525e41[_0xce2d('0x1c')]);});});}function emit(_0x15c820,_0x3fa218,_0x35d3ec,_0x167bbd){var _0x2d1e7a={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x15c820,_0x35d3ec,_0x167bbd)};io['to'](util[_0xce2d('0x53')](_0xce2d('0x54'),_0x3fa218))[_0xce2d('0x55')]('trigger:browser:url',_0x2d1e7a);}exports['cs']=function(_0x43f294,_0x4e044e,_0x72792f,_0x35a50f,_0x3aa32f,_0x21c222,_0x2b5089,_0x590dd7){var _0x149b01={};_0x21c222[_0xce2d('0xc')]=_0x21c222['modernAuthentication']?intUtil[_0xce2d('0x56')](_0x21c222[_0xce2d('0xd')][_0xce2d('0xe')]):intUtil[_0xce2d('0x56')](_0x21c222[_0xce2d('0xc')]);_0x21c222[_0xce2d('0x57')]=intUtil[_0xce2d('0x56')](_0x21c222[_0xce2d('0x57')]);_0x149b01['callDirection']=_0x590dd7===_0xce2d('0x50')||_0x590dd7===_0xce2d('0x58')?_0xce2d('0x50'):_0xce2d('0x34');var _0xd023ca=_0x21c222[_0xce2d('0xb')]?util[_0xce2d('0x53')]('%s/api/data/v9.0/',_0x21c222[_0xce2d('0xd')][_0xce2d('0xe')]):util[_0xce2d('0x53')]('%s/api/data/v9.0/',_0x21c222['remoteUri']);var _0x3bc889=util[_0xce2d('0x53')](_0xce2d('0x59'),_0x21c222[_0xce2d('0xf')]);var _0x4567b7=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21c222[_0xce2d('0x57')],_0x4e044e[_0xce2d('0x5a')],md5(_0x4e044e[_0xce2d('0x5a')]));if(_0x3aa32f&&_0x3aa32f[_0xce2d('0x5b')]){logger[_0xce2d('0x26')](_0xce2d('0x5c'),_0xce2d('0x5d'));_0x4e044e[_0xce2d('0x5e')]=_0x4567b7;}else if(_0x2b5089&&_0x2b5089['recordingFormat']&&_0x2b5089['recordingFormat']!==_0xce2d('0x5f')){logger[_0xce2d('0x26')](_0xce2d('0x60'),_0xce2d('0x5d'));_0x4e044e['recordingURL']=_0x4567b7;}else{_0x4e044e[_0xce2d('0x5e')]='';}return getUser(_0x149b01,_0x21c222,_0x35a50f,_0x3bc889,_0xd023ca,_0x590dd7)[_0xce2d('0x18')](function(_0x166729){logger[_0xce2d('0x26')]('['+_0x590dd7[_0xce2d('0x3b')]()+_0xce2d('0x61'),_0x166729[_0xce2d('0x29')]);logger['info']('['+_0x590dd7[_0xce2d('0x3b')]()+_0xce2d('0x62'),_0x166729[_0xce2d('0x22')]);return getEndUser(_0x166729,_0x21c222,_0x3bc889,_0xd023ca,_0x4e044e,_0x590dd7,_0x72792f['moduleCreate']);})[_0xce2d('0x18')](function(_0x274717){logger[_0xce2d('0x26')]('['+_0x590dd7[_0xce2d('0x3b')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x274717['enduserId']);logger[_0xce2d('0x26')]('['+_0x590dd7['toUpperCase']()+_0xce2d('0x63'),_0x4e044e[_0xce2d('0x2d')]);return getTicket(_0x274717,_0x21c222,_0x3bc889,_0xd023ca,_0x4e044e,_0x72792f,_0x590dd7);})[_0xce2d('0x18')](function(_0x13a215){logger[_0xce2d('0x26')](util[_0xce2d('0x53')]('['+_0x590dd7[_0xce2d('0x3b')]()+_0xce2d('0x64'),_0x72792f[_0xce2d('0x4d')],_0x13a215['ticketId']));logger[_0xce2d('0x26')](util[_0xce2d('0x53')]('['+_0x590dd7[_0xce2d('0x3b')]()+_0xce2d('0x65'),_0x590dd7));if(_0x590dd7!==_0xce2d('0x58')){logger[_0xce2d('0x26')]('['+_0x590dd7['toUpperCase']()+']',_0xce2d('0x66'));emit(_0x21c222[_0xce2d('0xc')],_0x35a50f[_0xce2d('0x67')],_0x72792f[_0xce2d('0x4d')],_0x13a215[_0xce2d('0x52')]);}})[_0xce2d('0x1a')](function(_0x1b2bb2){logger[_0xce2d('0x1b')]('['+_0x590dd7[_0xce2d('0x3b')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x1b2bb2['message']);});}; \ No newline at end of file +var _0x4d3d=['then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','username','toLowerCase','outbound','destcalleridnum','contacts','4.0','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','/contacts(','Fields','phonecall','/systemusers(','callDirection','queue','phonecalls','Subjects','calleridnum','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','localhost','socket.io-emitter','redis','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','resolve','data5','POST','password','clientSecret'];(function(_0x21e0a9,_0x5edd42){var _0x2a12f5=function(_0x3c53a4){while(--_0x3c53a4){_0x21e0a9['push'](_0x21e0a9['shift']());}};_0x2a12f5(++_0x5edd42);}(_0x4d3d,0xc4));var _0xd4d3=function(_0x333ffb,_0x1c2367){_0x333ffb=_0x333ffb-0x0;var _0x13add9=_0x4d3d[_0x333ffb];return _0x13add9;};'use strict';var _=require(_0xd4d3('0x0'));var rp=require(_0xd4d3('0x1'));var util=require(_0xd4d3('0x2'));var intUtil=require(_0xd4d3('0x3'));var md5=require(_0xd4d3('0x4'));var Redis=require(_0xd4d3('0x5'));var logger=require(_0xd4d3('0x6'))(_0xd4d3('0x7'));var config=require(_0xd4d3('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0xd4d3('0x9'),'port':0x18eb});var io=require(_0xd4d3('0xa'))(new Redis(config[_0xd4d3('0xb')]));function getAuthToken(_0x117789,_0x4d500c,_0x31c13a){if(_0x117789[_0xd4d3('0xc')]){_0x117789[_0xd4d3('0xd')]=_0x117789['CloudProvider'][_0xd4d3('0xe')];_0x117789[_0xd4d3('0xf')]=_0x117789[_0xd4d3('0x10')]['data2'];return Promise[_0xd4d3('0x11')](_0x117789['CloudProvider'][_0xd4d3('0x12')]);}var _0x386ee7={'method':_0xd4d3('0x13'),'uri':_0x4d500c,'form':{'client_id':_0x117789['clientId'],'resource':_0x117789[_0xd4d3('0xd')],'username':_0x117789['username'],'password':_0x117789[_0xd4d3('0x14')],'grant_type':_0xd4d3('0x14'),'client_secret':_0x117789[_0xd4d3('0x15')]},'json':!![]};return rp(_0x386ee7)[_0xd4d3('0x16')](function(_0x2c27f5){return _0x2c27f5['access_token'];})[_0xd4d3('0x17')](function(_0x291f0b){logger[_0xd4d3('0x18')]('['+[_0x31c13a[_0xd4d3('0x19')]()]+_0xd4d3('0x1a'));return _0x291f0b[_0xd4d3('0x1b')];});}function getUser(_0x3165dd,_0x4cecc4,_0x3fe28c,_0x12567c,_0x21a8c5,_0xb5c829){return new Promise(function(_0x445ed0,_0x545252){return getAuthToken(_0x4cecc4,_0x12567c,_0xb5c829)[_0xd4d3('0x16')](function(_0x406a71){var _0x1222bc={'method':_0xd4d3('0x1c'),'uri':_0x21a8c5+_0xd4d3('0x1d'),'headers':{'Authorization':_0xd4d3('0x1e')+_0x406a71,'OData-Version':'4.0'},'json':!![]};return rp(_0x1222bc);})['then'](function(_0x111281){var _0x42739d=_0x111281[_0xd4d3('0x1f')];var _0x218af2=![];var _0x78550c=null;if(!_[_0xd4d3('0x20')](_0x3fe28c)){if(intUtil[_0xd4d3('0x21')](_0x3fe28c[_0xd4d3('0x22')])){_0x3165dd[_0xd4d3('0x23')]=_0x3fe28c['email'];for(_0x78550c=0x0;_0x78550c<_0x42739d[_0xd4d3('0x24')];_0x78550c++){if(_0x42739d[_0x78550c][_0xd4d3('0x25')]===_0x3fe28c[_0xd4d3('0x22')]&&!_0x42739d[_0x78550c][_0xd4d3('0x26')]){_0x218af2=!![];logger[_0xd4d3('0x27')]('['+[_0xb5c829['toUpperCase']()]+_0xd4d3('0x28')+_0x42739d[_0x78550c][_0xd4d3('0x29')]+'!');_0x3165dd[_0xd4d3('0x2a')]=_0x42739d[_0x78550c][_0xd4d3('0x29')];}}}}if(!_0x218af2){logger[_0xd4d3('0x27')]('['+[_0xb5c829['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3165dd[_0xd4d3('0x23')]=_0x4cecc4['username'];for(_0x78550c=0x0;_0x78550c<_0x42739d['length'];_0x78550c++){if(_0x42739d[_0x78550c][_0xd4d3('0x25')]===_0x4cecc4[_0xd4d3('0x2b')]){_0x3165dd[_0xd4d3('0x2a')]=_0x42739d[_0x78550c][_0xd4d3('0x29')];}}}_0x445ed0(_0x3165dd);})[_0xd4d3('0x17')](function(_0x1c4a55){_0x545252(_0x1c4a55['message']);});});}function createEndUser(_0x34827d,_0x17f3e1,_0x1076e7,_0x53839c,_0x3da602,_0x1da667){return new Promise(function(_0x5c72ac,_0xf86e52){return getAuthToken(_0x17f3e1,_0x1076e7,_0x1da667)['then'](function(_0x32559f){var _0x55fe1a=_0x1da667[_0xd4d3('0x2c')]()===_0xd4d3('0x2d')?_0x3da602[_0xd4d3('0x2e')]:_0x3da602['calleridnum'];var _0x65ad57={'method':_0xd4d3('0x13'),'uri':_0x53839c+_0xd4d3('0x2f'),'body':{'telephone1':_0x55fe1a,'fullname':_0x55fe1a,'firstname':_0x55fe1a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x34827d[_0xd4d3('0x2a')]+')'},'headers':{'Authorization':_0xd4d3('0x1e')+_0x32559f,'OData-Version':_0xd4d3('0x30')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x65ad57);})['then'](function(_0x283ee5){var _0x14f869=_0x283ee5[_0xd4d3('0x31')]['odata-entityid'];var _0xe11d71=_0x14f869[_0xd4d3('0x32')](_0x14f869[_0xd4d3('0x33')]('(')+0x1,_0x14f869[_0xd4d3('0x33')](')'));_0x34827d[_0xd4d3('0x34')]=_0xe11d71;_0x5c72ac(_0x34827d);})['catch'](function(_0x21edca){_0xf86e52(_0x21edca[_0xd4d3('0x1b')]);});});}function getEndUser(_0x115555,_0xe1e019,_0x311443,_0x1789b9,_0x29042e,_0x122ca3,_0x3698ab){var _0x139c28=_0x122ca3['toLowerCase']()===_0xd4d3('0x2d')?_0x29042e['destcalleridnum']:_0x29042e['calleridnum'];return getAuthToken(_0xe1e019,_0x311443,_0x122ca3)[_0xd4d3('0x16')](function(_0x5766a1){var _0x3c1499={'method':_0xd4d3('0x1c'),'uri':_0x1789b9+_0xd4d3('0x35')+_0x139c28[_0xd4d3('0x36')]('+',_0xd4d3('0x37'))+'\x27','headers':{'Authorization':_0xd4d3('0x1e')+_0x5766a1,'If-None-Match':null,'OData-Version':_0xd4d3('0x30')},'json':!![]};return rp(_0x3c1499);})[_0xd4d3('0x16')](function(_0x57f60b){var _0x5c494f=![];if(!_0x57f60b)return _0x5c494f;var _0x117b1b=_0x57f60b[_0xd4d3('0x1f')];for(var _0x5dbeae=0x0;_0x5dbeae<_0x117b1b[_0xd4d3('0x24')];_0x5dbeae++){if(_0x117b1b[_0x5dbeae][_0xd4d3('0x38')]===_0x139c28){_0x5c494f=!![];_0x115555[_0xd4d3('0x34')]=_0x117b1b[_0x5dbeae]['contactid'];}}return _0x5c494f;})[_0xd4d3('0x16')](function(_0x5dd847){if(_0x5dd847)return _0x115555;if(_0x3698ab===_0xd4d3('0x39')){logger[_0xd4d3('0x27')]('['+[_0x122ca3['toUpperCase']()]+_0xd4d3('0x3a'));return _0x115555;}return createEndUser(_0x115555,_0xe1e019,_0x311443,_0x1789b9,_0x29042e,_0x122ca3)[_0xd4d3('0x16')](function(_0x2e843b){logger[_0xd4d3('0x27')]('['+[_0x122ca3['toUpperCase']()]+_0xd4d3('0x3b'),_0x2e843b['enduserId']);return _0x2e843b;});});}function getCustomFields(_0x30c7b4,_0x4bcc60,_0x25d64e){var _0xdb9df1={};if(_0x30c7b4[_0xd4d3('0x24')]>0x0){_[_0xd4d3('0x3c')](_0x30c7b4,function(_0x22a5ac){if(_[_0xd4d3('0x3d')]([_0xd4d3('0x3e'),_0xd4d3('0x3f')],_0x22a5ac['type'])&&_0x22a5ac[_0xd4d3('0x40')]&&!_0x22a5ac[_0xd4d3('0x41')]){var _0xd5296d=_0x22a5ac[_0xd4d3('0x42')][_0xd4d3('0x2c')]();var _0x1c07e4=_0xd5296d[_0xd4d3('0x32')](0x0,_0xd5296d[_0xd4d3('0x43')]('_'));var _0x293721=_0xd5296d[_0xd4d3('0x32')](_0xd5296d[_0xd4d3('0x43')]('_')+0x1);if(_0x1c07e4===_0x25d64e){_0xdb9df1[_0x293721]=_0x22a5ac[_0xd4d3('0x44')];}}});}return _0xdb9df1;}function getTicket(_0x11a31e,_0x3ae357,_0x358035,_0x169d4e,_0x1dd059,_0x5a5b0c,_0x41558a){return new Promise(function(_0x550dab,_0xadc802){var _0x51e3f4;return getAuthToken(_0x3ae357,_0x358035,_0x41558a)['then'](function(_0x442e9d){if(_0x5a5b0c[_0xd4d3('0x45')]===_0xd4d3('0x46')){_0x51e3f4={'method':'POST','uri':_0x169d4e+_0xd4d3('0x47'),'body':Object[_0xd4d3('0x48')]({},{'title':intUtil[_0xd4d3('0x49')](_0x5a5b0c['Subjects'],_0x1dd059,'\x20'),'description':intUtil['getString'](_0x5a5b0c['Descriptions'],_0x1dd059,'\x0a'),'customerid_contact@odata.bind':_0x11a31e[_0xd4d3('0x34')]?_0xd4d3('0x4a')+_0x11a31e[_0xd4d3('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x11a31e['userId']+')','caseorigincode':'1'},getCustomFields(_0x5a5b0c[_0xd4d3('0x4b')],_0x1dd059,_0x5a5b0c[_0xd4d3('0x45')])),'headers':{'Authorization':_0xd4d3('0x1e')+_0x442e9d,'OData-Version':_0xd4d3('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5a5b0c[_0xd4d3('0x45')]===_0xd4d3('0x4c')){var _0x33ad60=_0x11a31e['enduserId']?[{'partyid_systemuser@odata.bind':_0xd4d3('0x4d')+_0x11a31e[_0xd4d3('0x2a')]+')','participationtypemask':_0x11a31e[_0xd4d3('0x4e')]===_0xd4d3('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x11a31e['enduserId']+')','participationtypemask':_0x11a31e['callDirection']===_0xd4d3('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd4d3('0x4d')+_0x11a31e[_0xd4d3('0x2a')]+')','participationtypemask':_0x11a31e[_0xd4d3('0x4e')]==='queue'?0x2:0x1}];_0x51e3f4={'method':'POST','uri':_0x169d4e+_0xd4d3('0x50'),'body':Object[_0xd4d3('0x48')]({},{'subject':intUtil['getString'](_0x5a5b0c[_0xd4d3('0x51')],_0x1dd059,'\x20'),'phonenumber':String(_0x1dd059[_0xd4d3('0x52')]),'description':intUtil[_0xd4d3('0x49')](_0x5a5b0c['Descriptions'],_0x1dd059,'\x0a'),'regardingobjectid_contact@odata.bind':_0x11a31e[_0xd4d3('0x34')]?'/contacts('+_0x11a31e[_0xd4d3('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x11a31e['userId']+')','directioncode':_0x11a31e[_0xd4d3('0x4e')]===_0xd4d3('0x4f')?![]:!![],'phonecall_activity_parties':_0x33ad60},getCustomFields(_0x5a5b0c[_0xd4d3('0x4b')],_0x1dd059,_0x5a5b0c[_0xd4d3('0x45')])),'headers':{'Authorization':_0xd4d3('0x1e')+_0x442e9d,'OData-Version':_0xd4d3('0x30')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x51e3f4);})[_0xd4d3('0x16')](function(_0x420f46){var _0x5da04d=_0x420f46['headers']['odata-entityid'];var _0x1e2a7c=_0x5da04d[_0xd4d3('0x32')](_0x5da04d['lastIndexOf']('(')+0x1,_0x5da04d['lastIndexOf'](')'));_0x11a31e[_0xd4d3('0x53')]=_0x1e2a7c;_0x550dab(_0x11a31e);})[_0xd4d3('0x17')](function(_0x28aded){_0xadc802(_0x28aded[_0xd4d3('0x1b')]);});});}function emit(_0x1f9bf9,_0x2787a5,_0x4b85df,_0x47e499){var _0x54a88d={'uri':util['format'](_0xd4d3('0x54'),_0x1f9bf9,_0x4b85df,_0x47e499)};io['to'](util[_0xd4d3('0x55')](_0xd4d3('0x56'),_0x2787a5))[_0xd4d3('0x57')](_0xd4d3('0x58'),_0x54a88d);}exports['cs']=function(_0xff4cb,_0x556967,_0x1f7567,_0x562229,_0x3e0366,_0xea912,_0x18995f,_0x7961b6){var _0x1eb658={};_0xea912['remoteUri']=_0xea912[_0xd4d3('0xc')]?intUtil[_0xd4d3('0x59')](_0xea912[_0xd4d3('0x10')][_0xd4d3('0xe')]):intUtil[_0xd4d3('0x59')](_0xea912[_0xd4d3('0xd')]);_0xea912['serverUrl']=intUtil['stripTrailingSlash'](_0xea912[_0xd4d3('0x5a')]);_0x1eb658['callDirection']=_0x7961b6===_0xd4d3('0x4f')||_0x7961b6==='unmanaged'?_0xd4d3('0x4f'):'outbound';var _0x223c0c=_0xea912['modernAuthentication']?util[_0xd4d3('0x55')]('%s/api/data/v9.0/',_0xea912[_0xd4d3('0x10')][_0xd4d3('0xe')]):util['format']('%s/api/data/v9.0/',_0xea912[_0xd4d3('0xd')]);var _0xdb56dc=util['format'](_0xd4d3('0x5b'),_0xea912['tenantId']);var _0x4d5cde=util[_0xd4d3('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xea912['serverUrl'],_0x556967[_0xd4d3('0x5c')],md5(_0x556967[_0xd4d3('0x5c')]));if(_0x3e0366&&_0x3e0366[_0xd4d3('0x5d')]){logger['info'](_0xd4d3('0x5e'),_0xd4d3('0x5f'));_0x556967[_0xd4d3('0x60')]=_0x4d5cde;}else if(_0x18995f&&_0x18995f[_0xd4d3('0x61')]&&_0x18995f[_0xd4d3('0x61')]!=='none'){logger[_0xd4d3('0x27')](_0xd4d3('0x62'),'Recording\x20is\x20enabled!');_0x556967[_0xd4d3('0x60')]=_0x4d5cde;}else{_0x556967[_0xd4d3('0x60')]='';}return getUser(_0x1eb658,_0xea912,_0x562229,_0xdb56dc,_0x223c0c,_0x7961b6)[_0xd4d3('0x16')](function(_0x3cfb7b){logger['info']('['+_0x7961b6[_0xd4d3('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0x3cfb7b[_0xd4d3('0x2a')]);logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x63'),_0x3cfb7b[_0xd4d3('0x23')]);return getEndUser(_0x3cfb7b,_0xea912,_0xdb56dc,_0x223c0c,_0x556967,_0x7961b6,_0x1f7567[_0xd4d3('0x64')]);})['then'](function(_0x5a35b2){logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x65'),_0x5a35b2[_0xd4d3('0x34')]);logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x66'),_0x556967['calleridnum']);return getTicket(_0x5a35b2,_0xea912,_0xdb56dc,_0x223c0c,_0x556967,_0x1f7567,_0x7961b6);})['then'](function(_0x5bfb16){logger[_0xd4d3('0x27')](util[_0xd4d3('0x55')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x67'),_0x1f7567[_0xd4d3('0x45')],_0x5bfb16[_0xd4d3('0x53')]));logger[_0xd4d3('0x27')](util['format']('['+_0x7961b6['toUpperCase']()+_0xd4d3('0x68'),_0x7961b6));if(_0x7961b6!==_0xd4d3('0x69')){logger[_0xd4d3('0x27')]('['+_0x7961b6[_0xd4d3('0x19')]()+']',_0xd4d3('0x6a'));emit(_0xea912['remoteUri'],_0x562229[_0xd4d3('0x6b')],_0x1f7567[_0xd4d3('0x45')],_0x5bfb16[_0xd4d3('0x53')]);}})['catch'](function(_0xeaea0b){logger[_0xd4d3('0x18')]('['+_0x7961b6[_0xd4d3('0x19')]()+_0xd4d3('0x6c'),_0xeaea0b[_0xd4d3('0x1b')]);});}; \ 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 a0dd7f7..2ede8e1 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 _0xa5f5=['Tags','name','Fields','custom_fields','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','freshdesk','defaults','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa5f5,0x166));var _0x5a5f=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xa5f5[_0x176329];return _0x31997c;};'use strict';var _=require(_0x5a5f('0x0'));var rp=require(_0x5a5f('0x1'));var md5=require(_0x5a5f('0x2'));var util=require(_0x5a5f('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x5a5f('0x4'));config['redis']=_[_0x5a5f('0x5')](config[_0x5a5f('0x6')],{'host':_0x5a5f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5a5f('0x6')]));var headers={'Content-Type':_0x5a5f('0x8'),'Accept':_0x5a5f('0x8')};function emit(_0xd41be5,_0x448991,_0x395ab6){io['to'](_0xd41be5)[_0x5a5f('0x9')](_0x448991,_0x395ab6);}function getTicket(_0x1b7c05,_0xbbeb5c,_0x57f319,_0x46a1e3,_0x1e8e19){logger[_0x5a5f('0xa')](_0x5a5f('0xb'));var _0x177f3b=_['merge']({'responder_id':_0xbbeb5c['id'],'requester_id':_0x57f319['id'],'name':util['format'](_0x5a5f('0xc'),_0x1e8e19['calleridname']),'phone':_0x1e8e19[_0x5a5f('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5a5f('0xe')](_0x46a1e3[_0x5a5f('0xf')],_0x1e8e19,'\x20'),'description':intUtil['getString'](_0x46a1e3[_0x5a5f('0x10')],_0x1e8e19,_0x5a5f('0x11')),'tags':getTags(_0x46a1e3[_0x5a5f('0x12')],_0x5a5f('0x13'))},getCustomFields(_0x46a1e3[_0x5a5f('0x14')],_0x1e8e19));_0x177f3b[_0x5a5f('0x15')]=_['mapValues'](_[_0x5a5f('0x16')](_0x177f3b[_0x5a5f('0x15')],'id'),_0x5a5f('0x17'));return request({'uri':util[_0x5a5f('0x18')](_0x5a5f('0x19'),_0x1b7c05[_0x5a5f('0x1a')]),'method':_0x5a5f('0x1b'),'body':_0x177f3b})['then'](function(_0x41226e){logger['info']('Ticket\x20created!');return _0x41226e;});}function getUser(_0x108774,_0x318201){if(intUtil[_0x5a5f('0x1c')](_0x318201)){return request({'uri':util[_0x5a5f('0x18')](_0x5a5f('0x1d'),_0x108774[_0x5a5f('0x1a')]),'qs':{'email':_0x318201}})[_0x5a5f('0x1e')](function(_0x37fb8c){if(_0x37fb8c[_0x5a5f('0x1f')]){logger[_0x5a5f('0xa')](_0x5a5f('0x20'));return _[_0x5a5f('0x21')](_0x37fb8c,function(_0x3509d9){return _0x3509d9[_0x5a5f('0x22')]['email']===_0x318201;});}else{logger[_0x5a5f('0xa')](_0x5a5f('0x23'));return request({'uri':util['format'](_0x5a5f('0x24'),_0x108774['remoteUri'])})['then'](function(_0x33a664){logger[_0x5a5f('0xa')](_0x5a5f('0x25'));return _0x33a664;});}});}else{logger[_0x5a5f('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x5a5f('0x24'),_0x108774[_0x5a5f('0x1a')])})[_0x5a5f('0x1e')](function(_0x3ba899){logger['info'](_0x5a5f('0x25'));return _0x3ba899;});}}function getEndUser(_0xfbe11d,_0x2d0a9e,_0x15cde2){logger[_0x5a5f('0xa')]('Searching\x20enduser\x20with\x20phone',_0x15cde2);return request({'uri':util[_0x5a5f('0x18')](_0x5a5f('0x26'),_0xfbe11d[_0x5a5f('0x1a')]),'qs':{'phone':_0x15cde2}})['then'](function(_0x1b4b70){if(_0x1b4b70[_0x5a5f('0x1f')]){logger[_0x5a5f('0xa')](_0x5a5f('0x27'));return _['find'](_0x1b4b70,{'phone':_0x15cde2});}else{logger[_0x5a5f('0xa')](_0x5a5f('0x28'));return request({'uri':util['format'](_0x5a5f('0x26'),_0xfbe11d[_0x5a5f('0x1a')]),'method':'POST','body':{'name':_0x2d0a9e,'phone':_0x15cde2}})[_0x5a5f('0x1e')](function(_0x239b9b){logger[_0x5a5f('0xa')]('Enduser\x20created.');return _0x239b9b;});}});}function getAuth(_0x219b91){return util[_0x5a5f('0x18')](_0x5a5f('0x29'),new Buffer(_0x219b91[_0x5a5f('0x2a')]+':X')[_0x5a5f('0x2b')](_0x5a5f('0x2c')));}function request(_0x171720){logger[_0x5a5f('0x2d')](_0x5a5f('0x2e'),JSON[_0x5a5f('0x2f')](_0x171720));return rp(_['defaults'](_0x171720,{'method':_0x5a5f('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x412ab3,_0x1b45ae){var _0x1fff96=[];if(_0x412ab3&&_0x412ab3[_0x5a5f('0x1f')]>0x0){_0x1fff96=_[_0x5a5f('0x31')](_0x412ab3,_0x1b45ae);}return _0x1fff96;}function getCustomFields(_0x5edfdf,_0x335289){var _0x5237d1=[];var _0x2cbeff={'custom_fields':[]};if(_0x5edfdf[_0x5a5f('0x1f')]>0x0){_[_0x5a5f('0x32')](_0x5edfdf,function(_0x4911e9){if(_[_0x5a5f('0x33')](['string',_0x5a5f('0x34')],_0x4911e9[_0x5a5f('0x35')])&&_0x4911e9[_0x5a5f('0x36')]&&!_0x4911e9[_0x5a5f('0x37')]){_0x2cbeff[_0x4911e9[_0x5a5f('0x36')][_0x5a5f('0x38')]()]=_0x4911e9[_0x5a5f('0x39')][_0x5a5f('0x2b')]();}else if(_[_0x5a5f('0x33')](['string',_0x5a5f('0x34')],_0x4911e9[_0x5a5f('0x35')])&&_0x4911e9[_0x5a5f('0x3a')]&&_0x4911e9[_0x5a5f('0x37')]){_0x2cbeff[_0x5a5f('0x15')][_0x5a5f('0x3b')]({'id':_0x4911e9[_0x5a5f('0x3a')],'value':_0x4911e9[_0x5a5f('0x39')][_0x5a5f('0x2b')]()});}else if(_0x4911e9[_0x5a5f('0x35')]===_0x5a5f('0x3c')&&_0x4911e9[_0x5a5f('0x3d')]&&_0x4911e9['idField']&&_0x4911e9[_0x5a5f('0x37')]){_0x335289[_0x4911e9[_0x5a5f('0x3d')]]&&_0x2cbeff['custom_fields']['push']({'id':_0x4911e9[_0x5a5f('0x3a')],'value':_0x335289[_0x4911e9[_0x5a5f('0x3d')]]['toString']()});}else if(_0x4911e9[_0x5a5f('0x35')]===_0x5a5f('0x3e')&&_0x4911e9[_0x5a5f('0x3f')]&&_0x4911e9[_0x5a5f('0x3f')][_0x5a5f('0x13')]&&_0x4911e9['idField']&&_0x4911e9[_0x5a5f('0x37')]){_0x335289[_0x4911e9[_0x5a5f('0x3f')][_0x5a5f('0x13')]['toLowerCase']()]&&_0x2cbeff[_0x5a5f('0x15')]['push']({'id':_0x4911e9['idField'],'value':_0x335289[_0x4911e9[_0x5a5f('0x3f')]['name'][_0x5a5f('0x38')]()]['toString']()});}});}return _0x2cbeff;}exports[_0x5a5f('0x40')]=function(_0x482bd9,_0x2c5230,_0x3cfd4b,_0x47e94a,_0x1d9337,_0x78aa4e){var _0x38aaba,_0x15f7d6;_0x78aa4e['remoteUri']=intUtil[_0x5a5f('0x41')](_0x78aa4e[_0x5a5f('0x1a')]);_0x78aa4e[_0x5a5f('0x42')]=intUtil[_0x5a5f('0x41')](_0x78aa4e[_0x5a5f('0x42')]);if(_0x1d9337&&_0x1d9337['monitor_format']){logger[_0x5a5f('0xa')](_0x5a5f('0x43'),_0x5a5f('0x44'));_0x2c5230['recordingURL']=util[_0x5a5f('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x78aa4e[_0x5a5f('0x42')],_0x2c5230[_0x5a5f('0x45')],md5(_0x2c5230[_0x5a5f('0x45')]));}else{_0x2c5230[_0x5a5f('0x46')]='';}headers[_0x5a5f('0x47')]=getAuth(_0x78aa4e);return getUser(_0x78aa4e,_0x47e94a[_0x5a5f('0x48')])[_0x5a5f('0x1e')](function(_0x3334e2){_0x38aaba=_0x3334e2;logger[_0x5a5f('0xa')](_0x5a5f('0x49'),_0x38aaba['id']);return getEndUser(_0x78aa4e,_0x2c5230[_0x5a5f('0x4a')],_0x2c5230[_0x5a5f('0xd')]);})[_0x5a5f('0x1e')](function(_0x3b9f0b){_0x15f7d6=_0x3b9f0b;logger[_0x5a5f('0xa')](_0x5a5f('0x4b'),_0x15f7d6['id']);return getTicket(_0x78aa4e,_0x38aaba,_0x15f7d6,_0x3cfd4b,_0x2c5230);})[_0x5a5f('0x1e')](function(_0x44fe0f){if(_0x44fe0f&&_0x44fe0f['id']){logger[_0x5a5f('0xa')](_0x5a5f('0x4c'));logger[_0x5a5f('0xa')]('The\x20Ticket\x20ID\x20is:',_0x44fe0f['id']);logger[_0x5a5f('0xa')]('[QUEUE]',_0x5a5f('0x4d'));emit(util[_0x5a5f('0x18')]('user:%s',_0x47e94a[_0x5a5f('0x13')]),_0x5a5f('0x4e'),{'uri':util[_0x5a5f('0x18')](_0x5a5f('0x4f'),_0x78aa4e[_0x5a5f('0x1a')],_0x44fe0f['id'])});}})[_0x5a5f('0x50')](function(_0x48b32a){logger[_0x5a5f('0x51')](_0x5a5f('0x43'),JSON[_0x5a5f('0x2f')](_0x48b32a));});};exports[_0x5a5f('0x52')]=function(_0x5018c6,_0x275a4b,_0x4e7c57,_0x4bc957,_0x182577,_0x2bc415,_0x43d990){var _0x368b08,_0x301e44;_0x2bc415[_0x5a5f('0x1a')]=intUtil[_0x5a5f('0x41')](_0x2bc415[_0x5a5f('0x1a')]);_0x2bc415['serverUrl']=intUtil['stripTrailingSlash'](_0x2bc415[_0x5a5f('0x42')]);if(_0x43d990&&_0x43d990[_0x5a5f('0x53')]&&_0x43d990[_0x5a5f('0x53')]!==_0x5a5f('0x54')){logger['info'](_0x5a5f('0x55'),'Recording\x20is\x20enabled!');_0x275a4b[_0x5a5f('0x46')]=util[_0x5a5f('0x18')](_0x5a5f('0x56'),_0x2bc415['serverUrl'],_0x275a4b[_0x5a5f('0x45')],md5(_0x275a4b['uniqueid']));}headers[_0x5a5f('0x47')]=getAuth(_0x2bc415);return getUser(_0x2bc415,_0x4bc957[_0x5a5f('0x48')])[_0x5a5f('0x1e')](function(_0x1e320b){_0x368b08=_0x1e320b;logger[_0x5a5f('0xa')](_0x5a5f('0x49'),_0x368b08['id']);return getEndUser(_0x2bc415,_0x275a4b[_0x5a5f('0x57')],_0x275a4b[_0x5a5f('0x58')]);})[_0x5a5f('0x1e')](function(_0x4eae2d){_0x301e44=_0x4eae2d;logger[_0x5a5f('0xa')](_0x5a5f('0x4b'),_0x301e44['id']);return getTicket(_0x2bc415,_0x368b08,_0x301e44,_0x4e7c57,_0x275a4b);})['then'](function(_0x3945fb){if(_0x3945fb&&_0x3945fb['id']){logger['info']('Ticket\x20created!');logger[_0x5a5f('0xa')](_0x5a5f('0x59'),_0x3945fb['id']);logger[_0x5a5f('0xa')](_0x5a5f('0x55'),_0x5a5f('0x4d'));emit(util['format']('user:%s',_0x4bc957[_0x5a5f('0x13')]),'trigger:browser:url',{'uri':util['format'](_0x5a5f('0x4f'),_0x2bc415[_0x5a5f('0x1a')],_0x3945fb['id'])});}})[_0x5a5f('0x50')](function(_0x5e1312){logger[_0x5a5f('0x51')]('[OUTBOUND]',JSON[_0x5a5f('0x2f')](_0x5e1312));});};exports[_0x5a5f('0x5a')]=function(_0x57239b,_0x352e1a,_0x20aedf,_0x7002c9,_0xaf3df0,_0x4d5b5d){var _0x8624c0,_0x5639d5;_0x4d5b5d[_0x5a5f('0x1a')]=intUtil[_0x5a5f('0x41')](_0x4d5b5d[_0x5a5f('0x1a')]);_0x4d5b5d[_0x5a5f('0x42')]=intUtil[_0x5a5f('0x41')](_0x4d5b5d[_0x5a5f('0x42')]);if(_0xaf3df0&&_0xaf3df0[_0x5a5f('0x5b')]){logger[_0x5a5f('0xa')]('['+_0x352e1a[_0x5a5f('0x5c')][_0x5a5f('0x5d')]()+']',_0x5a5f('0x44'));_0x352e1a[_0x5a5f('0x46')]=util[_0x5a5f('0x18')](_0x5a5f('0x56'),_0x4d5b5d['serverUrl'],_0x352e1a['uniqueid'],md5(_0x352e1a['uniqueid']));}else{_0x352e1a[_0x5a5f('0x46')]='';}headers[_0x5a5f('0x47')]=getAuth(_0x4d5b5d);return getUser(_0x4d5b5d,'')[_0x5a5f('0x1e')](function(_0x3fe8d6){_0x8624c0=_0x3fe8d6;logger['info'](_0x5a5f('0x49'),_0x8624c0['id']);return getEndUser(_0x4d5b5d,_0x352e1a[_0x5a5f('0x4a')],_0x352e1a[_0x5a5f('0xd')]);})[_0x5a5f('0x1e')](function(_0x197289){_0x5639d5=_0x197289;logger[_0x5a5f('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5639d5['id']);return getTicket(_0x4d5b5d,_0x8624c0,_0x5639d5,_0x20aedf,_0x352e1a);})['then'](function(_0x2f1b93){if(_0x2f1b93){logger['info'](_0x5a5f('0x4c'));logger['info'](_0x5a5f('0x59'),_0x2f1b93['id']);}})['catch'](function(_0x490e85){logger[_0x5a5f('0x51')]('['+_0x352e1a[_0x5a5f('0x5c')][_0x5a5f('0x5d')]()+']',JSON[_0x5a5f('0x2f')](_0x490e85));});}; \ No newline at end of file +var _0xedda=['toLowerCase','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','stringify','unmanaged','monitor_format','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','map','forEach','includes','string','type','nameField','customField','picklist','idField','push','content','variableName','customVariable','Variable'];(function(_0x242166,_0x5e5cff){var _0x4788c4=function(_0x95e7b1){while(--_0x95e7b1){_0x242166['push'](_0x242166['shift']());}};_0x4788c4(++_0x5e5cff);}(_0xedda,0x7d));var _0xaedd=function(_0x149c89,_0x5a4857){_0x149c89=_0x149c89-0x0;var _0x3bea59=_0xedda[_0x149c89];return _0x3bea59;};'use strict';var _=require(_0xaedd('0x0'));var rp=require(_0xaedd('0x1'));var md5=require(_0xaedd('0x2'));var util=require(_0xaedd('0x3'));var Redis=require(_0xaedd('0x4'));var intUtil=require(_0xaedd('0x5'));var config=require(_0xaedd('0x6'));var logger=require(_0xaedd('0x7'))(_0xaedd('0x8'));config[_0xaedd('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xaedd('0xa'))(new Redis(config[_0xaedd('0x9')]));var headers={'Content-Type':_0xaedd('0xb'),'Accept':'application/json'};function emit(_0x18d269,_0x64c796,_0x35fd45){io['to'](_0x18d269)['emit'](_0x64c796,_0x35fd45);}function getTicket(_0x349161,_0x87f34e,_0x3d3392,_0x73a3f3,_0x4355c9){logger[_0xaedd('0xc')]('Creating\x20new\x20ticket...');var _0x307459=_[_0xaedd('0xd')]({'responder_id':_0x87f34e['id'],'requester_id':_0x3d3392['id'],'name':util[_0xaedd('0xe')](_0xaedd('0xf'),_0x4355c9[_0xaedd('0x10')]),'phone':_0x4355c9[_0xaedd('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xaedd('0x12')](_0x73a3f3['Subjects'],_0x4355c9,'\x20'),'description':intUtil[_0xaedd('0x12')](_0x73a3f3['Descriptions'],_0x4355c9,_0xaedd('0x13')),'tags':getTags(_0x73a3f3[_0xaedd('0x14')],_0xaedd('0x15'))},getCustomFields(_0x73a3f3[_0xaedd('0x16')],_0x4355c9));_0x307459[_0xaedd('0x17')]=_[_0xaedd('0x18')](_[_0xaedd('0x19')](_0x307459[_0xaedd('0x17')],'id'),_0xaedd('0x1a'));return request({'uri':util[_0xaedd('0xe')](_0xaedd('0x1b'),_0x349161[_0xaedd('0x1c')]),'method':_0xaedd('0x1d'),'body':_0x307459})['then'](function(_0x2b4c3f){logger[_0xaedd('0xc')]('Ticket\x20created!');return _0x2b4c3f;});}function getUser(_0x249a55,_0x3b089a){if(intUtil['validateEmail'](_0x3b089a)){return request({'uri':util[_0xaedd('0xe')](_0xaedd('0x1e'),_0x249a55[_0xaedd('0x1c')]),'qs':{'email':_0x3b089a}})['then'](function(_0x5bd075){if(_0x5bd075[_0xaedd('0x1f')]){logger[_0xaedd('0xc')](_0xaedd('0x20'));return _[_0xaedd('0x21')](_0x5bd075,function(_0x5015bd){return _0x5015bd[_0xaedd('0x22')]['email']===_0x3b089a;});}else{logger[_0xaedd('0xc')](_0xaedd('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x249a55[_0xaedd('0x1c')])})[_0xaedd('0x24')](function(_0x5a4562){logger['info'](_0xaedd('0x25'));return _0x5a4562;});}});}else{logger[_0xaedd('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaedd('0xe')]('%s/api/v2/agents/me',_0x249a55[_0xaedd('0x1c')])})[_0xaedd('0x24')](function(_0x320a63){logger['info'](_0xaedd('0x25'));return _0x320a63;});}}function getEndUser(_0x543cc6,_0x51204f,_0x3d9fe6){logger['info'](_0xaedd('0x26'),_0x3d9fe6);return request({'uri':util[_0xaedd('0xe')]('%s/api/v2/contacts',_0x543cc6[_0xaedd('0x1c')]),'qs':{'phone':_0x3d9fe6}})[_0xaedd('0x24')](function(_0x526403){if(_0x526403[_0xaedd('0x1f')]){logger['info'](_0xaedd('0x27'));return _[_0xaedd('0x21')](_0x526403,{'phone':_0x3d9fe6});}else{logger[_0xaedd('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xaedd('0x28'),_0x543cc6[_0xaedd('0x1c')]),'method':_0xaedd('0x1d'),'body':{'name':_0x51204f,'phone':_0x3d9fe6}})[_0xaedd('0x24')](function(_0x3d814d){logger[_0xaedd('0xc')](_0xaedd('0x29'));return _0x3d814d;});}});}function getAuth(_0x5699da){return util[_0xaedd('0xe')](_0xaedd('0x2a'),new Buffer(_0x5699da[_0xaedd('0x2b')]+':X')[_0xaedd('0x2c')](_0xaedd('0x2d')));}function request(_0x35b70){logger[_0xaedd('0x2e')](_0xaedd('0x2f'),JSON['stringify'](_0x35b70));return rp(_[_0xaedd('0x30')](_0x35b70,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x51c8ed,_0x1f94af){var _0x3b345c=[];if(_0x51c8ed&&_0x51c8ed[_0xaedd('0x1f')]>0x0){_0x3b345c=_[_0xaedd('0x31')](_0x51c8ed,_0x1f94af);}return _0x3b345c;}function getCustomFields(_0x3839b3,_0x2a3a92){var _0x4773b1=[];var _0x92df7b={'custom_fields':[]};if(_0x3839b3[_0xaedd('0x1f')]>0x0){_[_0xaedd('0x32')](_0x3839b3,function(_0x298d55){if(_[_0xaedd('0x33')]([_0xaedd('0x34'),'picklist'],_0x298d55[_0xaedd('0x35')])&&_0x298d55[_0xaedd('0x36')]&&!_0x298d55[_0xaedd('0x37')]){_0x92df7b[_0x298d55[_0xaedd('0x36')]['toLowerCase']()]=_0x298d55['content'][_0xaedd('0x2c')]();}else if(_['includes'](['string',_0xaedd('0x38')],_0x298d55['type'])&&_0x298d55[_0xaedd('0x39')]&&_0x298d55['customField']){_0x92df7b[_0xaedd('0x17')][_0xaedd('0x3a')]({'id':_0x298d55[_0xaedd('0x39')],'value':_0x298d55[_0xaedd('0x3b')]['toString']()});}else if(_0x298d55['type']==='variable'&&_0x298d55[_0xaedd('0x3c')]&&_0x298d55[_0xaedd('0x39')]&&_0x298d55[_0xaedd('0x37')]){_0x2a3a92[_0x298d55[_0xaedd('0x3c')]]&&_0x92df7b[_0xaedd('0x17')]['push']({'id':_0x298d55['idField'],'value':_0x2a3a92[_0x298d55['variableName']]['toString']()});}else if(_0x298d55[_0xaedd('0x35')]===_0xaedd('0x3d')&&_0x298d55['Variable']&&_0x298d55[_0xaedd('0x3e')][_0xaedd('0x15')]&&_0x298d55['idField']&&_0x298d55['customField']){_0x2a3a92[_0x298d55[_0xaedd('0x3e')]['name'][_0xaedd('0x3f')]()]&&_0x92df7b['custom_fields'][_0xaedd('0x3a')]({'id':_0x298d55[_0xaedd('0x39')],'value':_0x2a3a92[_0x298d55[_0xaedd('0x3e')]['name']['toLowerCase']()][_0xaedd('0x2c')]()});}});}return _0x92df7b;}exports[_0xaedd('0x40')]=function(_0x4dbbe0,_0x4b4180,_0x192250,_0x479ee2,_0x5f50bc,_0x1aecd6){var _0x353606,_0x1d3186;_0x1aecd6[_0xaedd('0x1c')]=intUtil['stripTrailingSlash'](_0x1aecd6[_0xaedd('0x1c')]);_0x1aecd6[_0xaedd('0x41')]=intUtil[_0xaedd('0x42')](_0x1aecd6[_0xaedd('0x41')]);if(_0x5f50bc&&_0x5f50bc['monitor_format']){logger['info'](_0xaedd('0x43'),_0xaedd('0x44'));_0x4b4180[_0xaedd('0x45')]=util[_0xaedd('0xe')](_0xaedd('0x46'),_0x1aecd6['serverUrl'],_0x4b4180[_0xaedd('0x47')],md5(_0x4b4180[_0xaedd('0x47')]));}else{_0x4b4180[_0xaedd('0x45')]='';}headers[_0xaedd('0x48')]=getAuth(_0x1aecd6);return getUser(_0x1aecd6,_0x479ee2[_0xaedd('0x49')])[_0xaedd('0x24')](function(_0x527745){_0x353606=_0x527745;logger[_0xaedd('0xc')](_0xaedd('0x4a'),_0x353606['id']);return getEndUser(_0x1aecd6,_0x4b4180[_0xaedd('0x10')],_0x4b4180[_0xaedd('0x11')]);})[_0xaedd('0x24')](function(_0x4e9c85){_0x1d3186=_0x4e9c85;logger[_0xaedd('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1d3186['id']);return getTicket(_0x1aecd6,_0x353606,_0x1d3186,_0x192250,_0x4b4180);})[_0xaedd('0x24')](function(_0x52bf23){if(_0x52bf23&&_0x52bf23['id']){logger[_0xaedd('0xc')]('Ticket\x20created!');logger[_0xaedd('0xc')]('The\x20Ticket\x20ID\x20is:',_0x52bf23['id']);logger[_0xaedd('0xc')](_0xaedd('0x43'),_0xaedd('0x4b'));emit(util[_0xaedd('0xe')](_0xaedd('0x4c'),_0x479ee2[_0xaedd('0x15')]),_0xaedd('0x4d'),{'uri':util[_0xaedd('0xe')](_0xaedd('0x4e'),_0x1aecd6[_0xaedd('0x1c')],_0x52bf23['id'])});}})[_0xaedd('0x4f')](function(_0x971718){logger[_0xaedd('0x50')](_0xaedd('0x43'),JSON['stringify'](_0x971718));});};exports['outbound']=function(_0x3951c6,_0x4c596b,_0x4b2423,_0x534410,_0x538182,_0x189880,_0x597847){var _0xedae5e,_0x4404a0;_0x189880['remoteUri']=intUtil[_0xaedd('0x42')](_0x189880['remoteUri']);_0x189880[_0xaedd('0x41')]=intUtil[_0xaedd('0x42')](_0x189880[_0xaedd('0x41')]);if(_0x597847&&_0x597847[_0xaedd('0x51')]&&_0x597847[_0xaedd('0x51')]!==_0xaedd('0x52')){logger[_0xaedd('0xc')](_0xaedd('0x53'),_0xaedd('0x44'));_0x4c596b[_0xaedd('0x45')]=util[_0xaedd('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x189880['serverUrl'],_0x4c596b['uniqueid'],md5(_0x4c596b['uniqueid']));}headers[_0xaedd('0x48')]=getAuth(_0x189880);return getUser(_0x189880,_0x534410[_0xaedd('0x49')])['then'](function(_0x1afc6b){_0xedae5e=_0x1afc6b;logger[_0xaedd('0xc')](_0xaedd('0x4a'),_0xedae5e['id']);return getEndUser(_0x189880,_0x4c596b[_0xaedd('0x54')],_0x4c596b[_0xaedd('0x55')]);})[_0xaedd('0x24')](function(_0x3cc06d){_0x4404a0=_0x3cc06d;logger[_0xaedd('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4404a0['id']);return getTicket(_0x189880,_0xedae5e,_0x4404a0,_0x4b2423,_0x4c596b);})[_0xaedd('0x24')](function(_0x237051){if(_0x237051&&_0x237051['id']){logger['info'](_0xaedd('0x56'));logger[_0xaedd('0xc')](_0xaedd('0x57'),_0x237051['id']);logger[_0xaedd('0xc')](_0xaedd('0x53'),_0xaedd('0x4b'));emit(util[_0xaedd('0xe')](_0xaedd('0x4c'),_0x534410[_0xaedd('0x15')]),'trigger:browser:url',{'uri':util[_0xaedd('0xe')](_0xaedd('0x4e'),_0x189880[_0xaedd('0x1c')],_0x237051['id'])});}})['catch'](function(_0xf95c8e){logger[_0xaedd('0x50')](_0xaedd('0x53'),JSON[_0xaedd('0x58')](_0xf95c8e));});};exports[_0xaedd('0x59')]=function(_0xb44b53,_0x4443dc,_0x7e4db7,_0x4a25b2,_0x263b95,_0x33e80d){var _0x1484c1,_0x2edaf8;_0x33e80d[_0xaedd('0x1c')]=intUtil[_0xaedd('0x42')](_0x33e80d[_0xaedd('0x1c')]);_0x33e80d[_0xaedd('0x41')]=intUtil[_0xaedd('0x42')](_0x33e80d[_0xaedd('0x41')]);if(_0x263b95&&_0x263b95[_0xaedd('0x5a')]){logger[_0xaedd('0xc')]('['+_0x4443dc[_0xaedd('0x5b')]['toUpperCase']()+']',_0xaedd('0x44'));_0x4443dc[_0xaedd('0x45')]=util[_0xaedd('0xe')](_0xaedd('0x46'),_0x33e80d[_0xaedd('0x41')],_0x4443dc[_0xaedd('0x47')],md5(_0x4443dc[_0xaedd('0x47')]));}else{_0x4443dc[_0xaedd('0x45')]='';}headers[_0xaedd('0x48')]=getAuth(_0x33e80d);return getUser(_0x33e80d,'')['then'](function(_0xcecfd6){_0x1484c1=_0xcecfd6;logger['info']('The\x20User\x20ID\x20is:',_0x1484c1['id']);return getEndUser(_0x33e80d,_0x4443dc[_0xaedd('0x10')],_0x4443dc[_0xaedd('0x11')]);})['then'](function(_0x3799e6){_0x2edaf8=_0x3799e6;logger['info'](_0xaedd('0x5c'),_0x2edaf8['id']);return getTicket(_0x33e80d,_0x1484c1,_0x2edaf8,_0x7e4db7,_0x4443dc);})[_0xaedd('0x24')](function(_0x11044b){if(_0x11044b){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x11044b['id']);}})[_0xaedd('0x4f')](function(_0x246fa1){logger['error']('['+_0x4443dc[_0xaedd('0x5b')][_0xaedd('0x5d')]()+']',JSON[_0xaedd('0x58')](_0x246fa1));});}; \ 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 9da252a..3f2814a 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 _0x8f63=['mobile_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Subjects','Descriptions','Contact','format','ticketId','/contacts/','user:%s','emit','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','info','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','headers','agentEmail','Getting\x20user\x20with\x20email','email','userId','Admin\x20selected','userEmail','catch','message','/api/lookup?q=','&f=','contacts','contactNumber'];(function(_0x565e01,_0x42b582){var _0x5f40c9=function(_0x48a787){while(--_0x48a787){_0x565e01['push'](_0x565e01['shift']());}};_0x5f40c9(++_0x42b582);}(_0x8f63,0xc6));var _0x38f6=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0x8f63[_0x53ddab];return _0x5819ac;};'use strict';var _=require(_0x38f6('0x0'));var rp=require(_0x38f6('0x1'));var md5=require('md5');var util=require(_0x38f6('0x2'));var moment=require('moment');var Promise=require(_0x38f6('0x3'));var Redis=require(_0x38f6('0x4'));var intUtil=require('./util');var config=require(_0x38f6('0x5'));var logger=require(_0x38f6('0x6'))(_0x38f6('0x7'));config[_0x38f6('0x8')]=_[_0x38f6('0x9')](config[_0x38f6('0x8')],{'host':_0x38f6('0xa'),'port':0x18eb});var io=require(_0x38f6('0xb'))(new Redis(config[_0x38f6('0x8')]));function getAdminId(_0xadc02f,_0x1f7717,_0x3a72cf,_0x14d6f4){return new Promise(function(_0x5aae10,_0x46c207){var _0x2df998=![];var _0x32cd4c={'method':_0x38f6('0xc'),'uri':_0x14d6f4+_0x38f6('0xd'),'json':!![]};_0x32cd4c['headers']=_0x3a72cf;logger['info'](_0x38f6('0xe'));return rp(_0x32cd4c)[_0x38f6('0xf')](function(_0x36ced0){if(_0x36ced0){var _0x2736ab=_0x36ced0[_0x38f6('0x10')];var _0x5a2a2d=null;for(_0x5a2a2d=0x0;_0x5a2a2d<_0x2736ab[_0x38f6('0x11')];_0x5a2a2d++){if(_0x2736ab[_0x5a2a2d]['email']===_0xadc02f['adminEmail']){_0xadc02f['adminId']=_0x2736ab[_0x5a2a2d]['id'];_0x2df998=!![];}}if(_0x2df998){logger[_0x38f6('0x12')]('Admin\x20found:',_0xadc02f[_0x38f6('0x13')]);_0x5aae10(_0xadc02f);}else{_0x46c207({'statusCode':0x194,'message':_0x38f6('0x14')});}}else{_0x46c207({'statusCode':0x194,'message':_0x38f6('0x14')});}})['catch'](function(_0x5081ee){logger[_0x38f6('0x15')]('['+[_0x1f7717[_0x38f6('0x16')]()]+']',_0x5081ee['message']);_0x46c207(_0x5081ee);});});}function getUser(_0x47ceca,_0x1de789,_0x3bc994){return function(_0x426773){return new Promise(function(_0x48cda3,_0x262635){var _0x1a723e={'method':_0x38f6('0xc'),'uri':_0x3bc994+_0x38f6('0xd'),'json':!![]};_0x1a723e[_0x38f6('0x17')]=_0x1de789;logger[_0x38f6('0x12')]('Getting\x20user\x20list');return rp(_0x1a723e)[_0x38f6('0xf')](function(_0x11b26a){if(_0x11b26a){var _0x3048e1=_0x11b26a[_0x38f6('0x10')];var _0x1d4278=![];var _0x1810c9=null;if(_0x426773[_0x38f6('0x18')]!==null){logger['info'](_0x38f6('0x19'),_0x426773[_0x38f6('0x18')]);_0x426773['userEmail']=_0x426773[_0x38f6('0x18')];for(_0x1810c9=0x0;_0x1810c9<_0x3048e1[_0x38f6('0x11')];_0x1810c9++){if(_0x3048e1[_0x1810c9][_0x38f6('0x1a')]===_0x426773[_0x38f6('0x18')]){_0x1d4278=!![];_0x426773['userId']=_0x3048e1[_0x1810c9]['id'];logger['info']('User\x20found:',_0x426773[_0x38f6('0x1b')]);}}}if(!_0x1d4278){logger[_0x38f6('0x12')](_0x38f6('0x1c'));_0x426773[_0x38f6('0x1d')]=_0x426773['adminEmail'];_0x426773[_0x38f6('0x1b')]=_0x426773[_0x38f6('0x13')];_0x1d4278=!![];}if(_0x1d4278){_0x48cda3(_0x426773);}else{_0x262635({'statusCode':0x194,'message':_0x38f6('0x14')});}}else{_0x262635({'statusCode':0x194,'message':_0x38f6('0x14')});}})[_0x38f6('0x1e')](function(_0x116279){logger[_0x38f6('0x15')]('['+[_0x47ceca[_0x38f6('0x16')]()]+']',_0x116279[_0x38f6('0x1f')]);_0x262635(_0x116279);});});};}function searchContact(_0x4c7208,_0x8aeba5,_0x99432e,_0x543019){return new Promise(function(_0x131ffd,_0x492480){var _0x42c0e1={'method':_0x38f6('0xc'),'headers':_0x8aeba5,'uri':_0x4c7208+_0x38f6('0x20')+_0x543019+_0x38f6('0x21')+_0x99432e+'&entities=contact','json':!![]};rp(_0x42c0e1)[_0x38f6('0xf')](function(_0x922593){var _0x29e4f7=_['find'](_0x922593[_0x38f6('0x22')][_0x38f6('0x22')],[_0x99432e,_0x543019]);_0x131ffd(_0x29e4f7);})[_0x38f6('0x1e')](function(_0x3f09c3){_0x492480(_0x3f09c3);});});}function getEndUser(_0x415a63,_0x5e2719,_0x269ce2){return function(_0xdd66d7){return new Promise(function(_0x224cf5,_0x11879c){logger[_0x38f6('0x12')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0xdd66d7[_0x38f6('0x23')]));searchContact(_0x269ce2,_0x5e2719,_0x38f6('0x24'),_0xdd66d7[_0x38f6('0x23')])[_0x38f6('0xf')](function(_0x350126){if(_0x350126){_0xdd66d7[_0x38f6('0x25')]=_0x350126['id'];logger[_0x38f6('0x12')]('Contact\x20found\x20mobile_number:',_0xdd66d7[_0x38f6('0x25')]);return _0x224cf5(_0xdd66d7);}searchContact(_0x269ce2,_0x5e2719,'work_number',_0xdd66d7['contactNumber'])[_0x38f6('0xf')](function(_0x19b661){if(_0x19b661){_0xdd66d7['endUserId']=_0x19b661['id'];logger[_0x38f6('0x12')](_0x38f6('0x26'),_0xdd66d7[_0x38f6('0x25')]);return _0x224cf5(_0xdd66d7);}createEndUser(_0xdd66d7,_0x415a63,_0x5e2719,_0x269ce2)['then'](function(_0x1de850){logger[_0x38f6('0x12')](_0x38f6('0x27'),_0x1de850[_0x38f6('0x25')]);return _0x224cf5(_0x1de850);});});})[_0x38f6('0x1e')](function(_0x161625){_0x11879c(_0x161625);});});};}function createEndUser(_0x2d3c09,_0x501b46,_0x516c66,_0x26c9c5){return new Promise(function(_0x495293,_0x24be29){var _0x2b0574=moment();var _0x1db1a2={'method':_0x38f6('0x28'),'uri':_0x26c9c5+_0x38f6('0x29'),'body':{'contact':{'last_name':_0x2d3c09['contactNumber'],'work_number':_0x2d3c09[_0x38f6('0x23')],'mobile_number':_0x2d3c09[_0x38f6('0x23')],'owner_id':_0x2d3c09[_0x38f6('0x1b')],'created_at':_0x2b0574['format'](_0x38f6('0x2a'))}},'json':!![]};_0x1db1a2['headers']=_0x516c66;logger[_0x38f6('0x12')](_0x38f6('0x2b'));return rp(_0x1db1a2)[_0x38f6('0xf')](function(_0x380b9f){_0x2d3c09[_0x38f6('0x25')]=_0x380b9f[_0x38f6('0x2c')]['id'];_0x495293(_0x2d3c09);})[_0x38f6('0x1e')](function(_0x231bad){logger[_0x38f6('0x15')]('['+[_0x501b46[_0x38f6('0x16')]()]+']',_0x231bad[_0x38f6('0x1f')]);_0x24be29(_0x231bad['message']);});});}function getTicket(_0x474dc5,_0x296065,_0x43264d,_0x16d062,_0x443fd0){return function(_0x212fee){logger[_0x38f6('0x12')]('Creating\x20new\x20task');return new Promise(function(_0x132146,_0x2b31a5){var _0x53acb3=moment();var _0x5c81e2={'method':_0x38f6('0x28'),'uri':_0x43264d+'/api/tasks','body':{'title':intUtil[_0x38f6('0x2d')](_0x16d062[_0x38f6('0x2e')],_0x443fd0,'\x20'),'description':intUtil['getString'](_0x16d062[_0x38f6('0x2f')],_0x443fd0,'\x0a'),'owner_id':_0x212fee[_0x38f6('0x1b')],'creater_id':_0x212fee['adminId'],'targetable_id':_0x212fee[_0x38f6('0x25')],'targetable_type':_0x38f6('0x30'),'created_at':_0x53acb3[_0x38f6('0x31')](_0x38f6('0x2a')),'due_date':_0x53acb3['add'](0x1e,'m')['format'](_0x38f6('0x2a'))},'json':!![]};_0x5c81e2[_0x38f6('0x17')]=_0x296065;return rp(_0x5c81e2)[_0x38f6('0xf')](function(_0x3aa75c){_0x212fee[_0x38f6('0x32')]=_0x3aa75c['task']['id'];logger[_0x38f6('0x12')]('Task\x20created:',_0x212fee['ticketId']);_0x132146(_0x212fee);})[_0x38f6('0x1e')](function(_0xf6d0f3){logger[_0x38f6('0x15')]('['+[_0x474dc5[_0x38f6('0x16')]()]+']',_0xf6d0f3['message']);_0x2b31a5(_0xf6d0f3[_0x38f6('0x1f')]);});});};}function emit(_0x498358,_0x1bba87,_0x4b8858){var _0x45655a={'uri':_0x498358+_0x38f6('0x33')+_0x4b8858};io['to'](util[_0x38f6('0x31')](_0x38f6('0x34'),_0x1bba87))[_0x38f6('0x35')]('trigger:browser:url',_0x45655a);}exports['cs']=function(_0xe6eb63,_0x3e7c82,_0x346f22,_0x5f5497,_0x9c4157,_0x3150bd,_0x19c36a,_0x3712df){var _0xa08809={};var _0x2d2a6f={'Authorization':_0x38f6('0x36')+_0x3150bd['apiKey']};_0x3150bd[_0x38f6('0x37')]=intUtil[_0x38f6('0x38')](_0x3150bd[_0x38f6('0x37')]);_0x3150bd['serverUrl']=intUtil['stripTrailingSlash'](_0x3150bd[_0x38f6('0x39')]);var _0x1c2356=_0x3150bd[_0x38f6('0x37')];_0xa08809[_0x38f6('0x3a')]=_0x3150bd[_0x38f6('0x3b')];_0xa08809[_0x38f6('0x23')]=_0x3712df[_0x38f6('0x3c')]()===_0x38f6('0x3d')?_0x3e7c82[_0x38f6('0x3e')]:_0x3e7c82[_0x38f6('0x3f')];_0xa08809[_0x38f6('0x40')]=_0x3712df===_0x38f6('0x41')||_0x3712df===_0x38f6('0x42')?_0x38f6('0x41'):'outbound';if(_0x5f5497){_0xa08809[_0x38f6('0x18')]=_0x5f5497[_0x38f6('0x1a')];}var _0xaabf2a=util[_0x38f6('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3150bd['serverUrl'],_0x3e7c82['uniqueid'],md5(_0x3e7c82[_0x38f6('0x43')]));if(_0x9c4157&&_0x9c4157[_0x38f6('0x44')]){logger[_0x38f6('0x12')](_0x38f6('0x45'),'Recording\x20is\x20enabled!');_0x3e7c82[_0x38f6('0x46')]=_0xaabf2a;}else if(_0x19c36a&&_0x19c36a[_0x38f6('0x47')]&&_0x19c36a[_0x38f6('0x47')]!==_0x38f6('0x48')){logger['info'](_0x38f6('0x49'),_0x38f6('0x4a'));_0x3e7c82[_0x38f6('0x46')]=_0xaabf2a;}else{_0x3e7c82[_0x38f6('0x46')]='';}return getAdminId(_0xa08809,_0x3712df,_0x2d2a6f,_0x1c2356)[_0x38f6('0xf')](getUser(_0x3712df,_0x2d2a6f,_0x1c2356))['then'](getEndUser(_0x3712df,_0x2d2a6f,_0x1c2356))[_0x38f6('0xf')](getTicket(_0x3712df,_0x2d2a6f,_0x1c2356,_0x346f22,_0x3e7c82))['then'](function(_0x681778){logger['info'](util[_0x38f6('0x31')](_0x38f6('0x4b'),_0x681778[_0x38f6('0x32')]));if(_0x3712df!==_0x38f6('0x42')){logger[_0x38f6('0x12')]('['+[_0x3712df[_0x38f6('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1c2356,_0x5f5497['name'],_0x681778[_0x38f6('0x25')]);}})[_0x38f6('0x1e')](function(_0x53973c){logger[_0x38f6('0x15')]('['+[_0x3712df['toUpperCase']()]+_0x38f6('0x4c'),util[_0x38f6('0x4d')](_0x53973c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9b51=['Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','format','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','message','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId'];(function(_0xf340de,_0x16d2af){var _0x324415=function(_0x5b5a40){while(--_0x5b5a40){_0xf340de['push'](_0xf340de['shift']());}};_0x324415(++_0x16d2af);}(_0x9b51,0x1c5));var _0x19b5=function(_0x1d95e1,_0x2dac2f){_0x1d95e1=_0x1d95e1-0x0;var _0x542fa0=_0x9b51[_0x1d95e1];return _0x542fa0;};'use strict';var _=require(_0x19b5('0x0'));var rp=require(_0x19b5('0x1'));var md5=require(_0x19b5('0x2'));var util=require(_0x19b5('0x3'));var moment=require('moment');var Promise=require(_0x19b5('0x4'));var Redis=require(_0x19b5('0x5'));var intUtil=require(_0x19b5('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x19b5('0x7'));config[_0x19b5('0x8')]=_['defaults'](config[_0x19b5('0x8')],{'host':_0x19b5('0x9'),'port':0x18eb});var io=require(_0x19b5('0xa'))(new Redis(config[_0x19b5('0x8')]));function getAdminId(_0x135b2f,_0x8f7c89,_0x2a2e3a,_0x50a002){return new Promise(function(_0x533f05,_0xccd675){var _0x1b5831=![];var _0x39e25c={'method':_0x19b5('0xb'),'uri':_0x50a002+_0x19b5('0xc'),'json':!![]};_0x39e25c[_0x19b5('0xd')]=_0x2a2e3a;logger[_0x19b5('0xe')](_0x19b5('0xf'));return rp(_0x39e25c)[_0x19b5('0x10')](function(_0x344d0e){if(_0x344d0e){var _0x1345c8=_0x344d0e[_0x19b5('0x11')];var _0x2d03d5=null;for(_0x2d03d5=0x0;_0x2d03d5<_0x1345c8['length'];_0x2d03d5++){if(_0x1345c8[_0x2d03d5][_0x19b5('0x12')]===_0x135b2f[_0x19b5('0x13')]){_0x135b2f['adminId']=_0x1345c8[_0x2d03d5]['id'];_0x1b5831=!![];}}if(_0x1b5831){logger[_0x19b5('0xe')](_0x19b5('0x14'),_0x135b2f[_0x19b5('0x15')]);_0x533f05(_0x135b2f);}else{_0xccd675({'statusCode':0x194,'message':_0x19b5('0x16')});}}else{_0xccd675({'statusCode':0x194,'message':_0x19b5('0x16')});}})[_0x19b5('0x17')](function(_0x3b0520){logger[_0x19b5('0x18')]('['+[_0x8f7c89['toUpperCase']()]+']',_0x3b0520['message']);_0xccd675(_0x3b0520);});});}function getUser(_0x178afd,_0x3fa2d9,_0x1425a3){return function(_0x45ebf7){return new Promise(function(_0x29ff03,_0x14318f){var _0x29ef2f={'method':_0x19b5('0xb'),'uri':_0x1425a3+_0x19b5('0xc'),'json':!![]};_0x29ef2f['headers']=_0x3fa2d9;logger[_0x19b5('0xe')](_0x19b5('0x19'));return rp(_0x29ef2f)[_0x19b5('0x10')](function(_0x323cfb){if(_0x323cfb){var _0x41271a=_0x323cfb[_0x19b5('0x11')];var _0x26cbd4=![];var _0x565b68=null;if(_0x45ebf7['agentEmail']!==null){logger[_0x19b5('0xe')](_0x19b5('0x1a'),_0x45ebf7[_0x19b5('0x1b')]);_0x45ebf7['userEmail']=_0x45ebf7[_0x19b5('0x1b')];for(_0x565b68=0x0;_0x565b68<_0x41271a['length'];_0x565b68++){if(_0x41271a[_0x565b68][_0x19b5('0x12')]===_0x45ebf7[_0x19b5('0x1b')]){_0x26cbd4=!![];_0x45ebf7[_0x19b5('0x1c')]=_0x41271a[_0x565b68]['id'];logger[_0x19b5('0xe')](_0x19b5('0x1d'),_0x45ebf7[_0x19b5('0x1c')]);}}}if(!_0x26cbd4){logger[_0x19b5('0xe')]('Admin\x20selected');_0x45ebf7['userEmail']=_0x45ebf7[_0x19b5('0x13')];_0x45ebf7['userId']=_0x45ebf7[_0x19b5('0x15')];_0x26cbd4=!![];}if(_0x26cbd4){_0x29ff03(_0x45ebf7);}else{_0x14318f({'statusCode':0x194,'message':_0x19b5('0x16')});}}else{_0x14318f({'statusCode':0x194,'message':_0x19b5('0x16')});}})[_0x19b5('0x17')](function(_0x545b80){logger[_0x19b5('0x18')]('['+[_0x178afd['toUpperCase']()]+']',_0x545b80[_0x19b5('0x1e')]);_0x14318f(_0x545b80);});});};}function searchContact(_0x2dcf7c,_0x3b639f,_0x38a654,_0x5a3420){return new Promise(function(_0x3eda21,_0xcaf5bd){var _0x1b8ba0={'method':_0x19b5('0xb'),'headers':_0x3b639f,'uri':_0x2dcf7c+'/api/lookup?q='+_0x5a3420+_0x19b5('0x1f')+_0x38a654+_0x19b5('0x20'),'json':!![]};rp(_0x1b8ba0)[_0x19b5('0x10')](function(_0xd8c779){var _0x39c6e6=_[_0x19b5('0x21')](_0xd8c779[_0x19b5('0x22')]['contacts'],[_0x38a654,_0x5a3420]);_0x3eda21(_0x39c6e6);})['catch'](function(_0xa47f6){_0xcaf5bd(_0xa47f6);});});}function getEndUser(_0x19aa30,_0x4ff698,_0x32941f){return function(_0x18783d){return new Promise(function(_0x3c7a61,_0x1798b7){logger[_0x19b5('0xe')](util['format'](_0x19b5('0x23'),_0x18783d[_0x19b5('0x24')]));searchContact(_0x32941f,_0x4ff698,_0x19b5('0x25'),_0x18783d[_0x19b5('0x24')])[_0x19b5('0x10')](function(_0xd8a932){if(_0xd8a932){_0x18783d[_0x19b5('0x26')]=_0xd8a932['id'];logger[_0x19b5('0xe')](_0x19b5('0x27'),_0x18783d[_0x19b5('0x26')]);return _0x3c7a61(_0x18783d);}searchContact(_0x32941f,_0x4ff698,_0x19b5('0x28'),_0x18783d[_0x19b5('0x24')])[_0x19b5('0x10')](function(_0x37d8f6){if(_0x37d8f6){_0x18783d[_0x19b5('0x26')]=_0x37d8f6['id'];logger[_0x19b5('0xe')]('Contact\x20found\x20work_number:',_0x18783d['endUserId']);return _0x3c7a61(_0x18783d);}createEndUser(_0x18783d,_0x19aa30,_0x4ff698,_0x32941f)[_0x19b5('0x10')](function(_0x30a77d){logger['info']('Contact\x20created:',_0x30a77d[_0x19b5('0x26')]);return _0x3c7a61(_0x30a77d);});});})['catch'](function(_0x5e96eb){_0x1798b7(_0x5e96eb);});});};}function createEndUser(_0x4b45b5,_0x472dbe,_0x3d903d,_0x216eeb){return new Promise(function(_0x190fa1,_0x3edb82){var _0x415d72=moment();var _0x203b51={'method':_0x19b5('0x29'),'uri':_0x216eeb+_0x19b5('0x2a'),'body':{'contact':{'last_name':_0x4b45b5['contactNumber'],'work_number':_0x4b45b5[_0x19b5('0x24')],'mobile_number':_0x4b45b5[_0x19b5('0x24')],'owner_id':_0x4b45b5['userId'],'created_at':_0x415d72[_0x19b5('0x2b')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x203b51[_0x19b5('0xd')]=_0x3d903d;logger[_0x19b5('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x203b51)['then'](function(_0x5b7c07){_0x4b45b5['endUserId']=_0x5b7c07[_0x19b5('0x2c')]['id'];_0x190fa1(_0x4b45b5);})['catch'](function(_0x4b02cc){logger[_0x19b5('0x18')]('['+[_0x472dbe[_0x19b5('0x2d')]()]+']',_0x4b02cc['message']);_0x3edb82(_0x4b02cc['message']);});});}function getTicket(_0x117f52,_0x3a4e5e,_0x3c33b1,_0x12575f,_0xe9942c){return function(_0x3aa785){logger[_0x19b5('0xe')](_0x19b5('0x2e'));return new Promise(function(_0x4ac391,_0x28f352){var _0x32ecf7=moment();var _0x39e7cc={'method':_0x19b5('0x29'),'uri':_0x3c33b1+_0x19b5('0x2f'),'body':{'title':intUtil[_0x19b5('0x30')](_0x12575f[_0x19b5('0x31')],_0xe9942c,'\x20'),'description':intUtil[_0x19b5('0x30')](_0x12575f[_0x19b5('0x32')],_0xe9942c,'\x0a'),'owner_id':_0x3aa785['userId'],'creater_id':_0x3aa785['adminId'],'targetable_id':_0x3aa785[_0x19b5('0x26')],'targetable_type':'Contact','created_at':_0x32ecf7['format'](_0x19b5('0x33')),'due_date':_0x32ecf7[_0x19b5('0x34')](0x1e,'m')['format'](_0x19b5('0x33'))},'json':!![]};_0x39e7cc[_0x19b5('0xd')]=_0x3a4e5e;return rp(_0x39e7cc)['then'](function(_0x204227){_0x3aa785[_0x19b5('0x35')]=_0x204227[_0x19b5('0x36')]['id'];logger[_0x19b5('0xe')]('Task\x20created:',_0x3aa785['ticketId']);_0x4ac391(_0x3aa785);})['catch'](function(_0x1647e6){logger[_0x19b5('0x18')]('['+[_0x117f52[_0x19b5('0x2d')]()]+']',_0x1647e6['message']);_0x28f352(_0x1647e6[_0x19b5('0x1e')]);});});};}function emit(_0x44cef8,_0x5e916d,_0x2c192c){var _0x142139={'uri':_0x44cef8+_0x19b5('0x37')+_0x2c192c};io['to'](util['format'](_0x19b5('0x38'),_0x5e916d))[_0x19b5('0x39')]('trigger:browser:url',_0x142139);}exports['cs']=function(_0x5e5977,_0x79b6cc,_0x306550,_0x46bf13,_0x1000cc,_0x514035,_0x46262b,_0x308b3d){var _0x39f5d5={};var _0x2c551d={'Authorization':_0x19b5('0x3a')+_0x514035[_0x19b5('0x3b')]};_0x514035[_0x19b5('0x3c')]=intUtil[_0x19b5('0x3d')](_0x514035[_0x19b5('0x3c')]);_0x514035['serverUrl']=intUtil[_0x19b5('0x3d')](_0x514035[_0x19b5('0x3e')]);var _0x439853=_0x514035[_0x19b5('0x3c')];_0x39f5d5['adminEmail']=_0x514035[_0x19b5('0x3f')];_0x39f5d5[_0x19b5('0x24')]=_0x308b3d[_0x19b5('0x40')]()==='outbound'?_0x79b6cc[_0x19b5('0x41')]:_0x79b6cc[_0x19b5('0x42')];_0x39f5d5[_0x19b5('0x43')]=_0x308b3d===_0x19b5('0x44')||_0x308b3d==='unmanaged'?_0x19b5('0x44'):_0x19b5('0x45');if(_0x46bf13){_0x39f5d5['agentEmail']=_0x46bf13[_0x19b5('0x12')];}var _0x2e9086=util[_0x19b5('0x2b')](_0x19b5('0x46'),_0x514035[_0x19b5('0x3e')],_0x79b6cc[_0x19b5('0x47')],md5(_0x79b6cc['uniqueid']));if(_0x1000cc&&_0x1000cc[_0x19b5('0x48')]){logger[_0x19b5('0xe')](_0x19b5('0x49'),_0x19b5('0x4a'));_0x79b6cc[_0x19b5('0x4b')]=_0x2e9086;}else if(_0x46262b&&_0x46262b['recordingFormat']&&_0x46262b[_0x19b5('0x4c')]!=='none'){logger[_0x19b5('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x79b6cc[_0x19b5('0x4b')]=_0x2e9086;}else{_0x79b6cc[_0x19b5('0x4b')]='';}return getAdminId(_0x39f5d5,_0x308b3d,_0x2c551d,_0x439853)[_0x19b5('0x10')](getUser(_0x308b3d,_0x2c551d,_0x439853))[_0x19b5('0x10')](getEndUser(_0x308b3d,_0x2c551d,_0x439853))['then'](getTicket(_0x308b3d,_0x2c551d,_0x439853,_0x306550,_0x79b6cc))['then'](function(_0x204020){logger[_0x19b5('0xe')](util[_0x19b5('0x2b')]('The\x20ticket\x20ID\x20is:\x20%s',_0x204020[_0x19b5('0x35')]));if(_0x308b3d!==_0x19b5('0x4d')){logger['info']('['+[_0x308b3d[_0x19b5('0x2d')]()]+']',_0x19b5('0x4e'));emit(_0x439853,_0x46bf13[_0x19b5('0x4f')],_0x204020[_0x19b5('0x26')]);}})[_0x19b5('0x17')](function(_0x3e9eee){logger['error']('['+[_0x308b3d[_0x19b5('0x2d')]()]+_0x19b5('0x50'),util[_0x19b5('0x51')](_0x3e9eee,{'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 3d5b4bd..31e7e11 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 _0xc014=['data3','queue','routeId','log','unmanaged','toLowerCase','zendesk','freshdesk','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','data2','find'];(function(_0x36b07c,_0x2618c1){var _0x5f34a6=function(_0x26aeef){while(--_0x26aeef){_0x36b07c['push'](_0x36b07c['shift']());}};_0x5f34a6(++_0x2618c1);}(_0xc014,0x1d5));var _0x4c01=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xc014[_0x136619];return _0x38c4a5;};'use strict';var _=require(_0x4c01('0x0'));var util=require(_0x4c01('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4c01('0x2'));var sugarcrm=require(_0x4c01('0x3'));var freshdesk=require(_0x4c01('0x4'));var zoho=require(_0x4c01('0x5'));var desk=require(_0x4c01('0x6'));var vtiger=require(_0x4c01('0x7'));var servicenow=require(_0x4c01('0x8'));var dynamics365=require(_0x4c01('0x9'));var freshsales=require(_0x4c01('0xa'));var integrations=['zendesk','salesforce',_0x4c01('0xb'),'freshdesk','zoho',_0x4c01('0xc'),_0x4c01('0xd'),_0x4c01('0xe'),_0x4c01('0xf'),_0x4c01('0x10')];exports['exec']=function(_0x1f862f,_0x74c0ba,_0x11a476,_0x4cc718,_0x5435f7,_0xd06985){if(_0x11a476){if(_[_0x4c01('0x11')](integrations,_0x1f862f[_0x4c01('0x12')]['toLowerCase']())){try{var _0x12274f=null;var _0x4ce6d5='';var _0x1fe1aa=_0x11a476[_0x1f862f[_0x4c01('0x12')]['toLowerCase']()];if(_0x1fe1aa){var _0x32305d=_0x1fe1aa[_0x1f862f[_0x4c01('0x13')]];if(_0x32305d){var _0x213cd6=_[_0x4c01('0x14')](_0x32305d['Configurations'],{'id':parseInt(_0x1f862f[_0x4c01('0x15')],0xa)});if(_0x213cd6){if(_0x4cc718){if(_0x5435f7&&_0x74c0ba[_0x4c01('0x16')]){_0x4ce6d5=_0x4c01('0x16');}else if(_0x74c0ba[_0x4c01('0x17')]){_0x4ce6d5='outbound';}else{console[_0x4c01('0x18')]('EVENT\x20UNKNOWN',_0x74c0ba);}}else{_0x4ce6d5=_0x4c01('0x19');}switch(_0x1f862f[_0x4c01('0x12')][_0x4c01('0x1a')]()){case _0x4c01('0x1b'):zendesk[_0x4ce6d5](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985);break;case'salesforce':salesforce[_0x4ce6d5](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985);break;case _0x4c01('0xb'):sugarcrm[_0x4ce6d5](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985);break;case _0x4c01('0x1c'):freshdesk[_0x4ce6d5](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985);break;case'zoho':zoho[_0x4ce6d5](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985);break;case _0x4c01('0xc'):desk[_0x4ce6d5](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985);break;case _0x4c01('0xd'):vtiger[_0x4ce6d5](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985);break;case _0x4c01('0xf'):freshsales['cs'](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985,_0x4ce6d5);break;case'servicenow':servicenow['cs'](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985,_0x4ce6d5);break;case _0x4c01('0xe'):dynamics365['cs'](_0x1f862f,_0x74c0ba,_0x213cd6,_0x4cc718,_0x5435f7,_0x32305d,_0xd06985,_0x4ce6d5);break;default:console[_0x4c01('0x18')]('unknown\x20integration');}}else{_0x12274f=require(_0x4c01('0x1d'))(_0x1f862f['data1'][_0x4c01('0x1a')]());_0x12274f[_0x4c01('0x1e')](_0x4c01('0x1f'),util[_0x4c01('0x20')](_0x4c01('0x21'),_0x1f862f[_0x4c01('0x12')][_0x4c01('0x1a')](),_0x1f862f[_0x4c01('0x15')]));}}else{_0x12274f=require(_0x4c01('0x1d'))(_0x1f862f[_0x4c01('0x12')]['toLowerCase']());_0x12274f[_0x4c01('0x1e')]('[EXEC]',util[_0x4c01('0x20')](_0x4c01('0x22'),_0x1f862f[_0x4c01('0x12')]['toLowerCase'](),_0x1f862f[_0x4c01('0x13')]));}}else{}}catch(_0xa7c249){console[_0x4c01('0x1e')](_0xa7c249);}}}}; \ No newline at end of file +var _0xd599=['toLowerCase','find','Configurations','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','servicenow','exec','data1'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xd599,0xc6));var _0x9d59=function(_0x335589,_0x1aa3fb){_0x335589=_0x335589-0x0;var _0x843e05=_0xd599[_0x335589];return _0x843e05;};'use strict';var _=require(_0x9d59('0x0'));var util=require('util');var zendesk=require(_0x9d59('0x1'));var salesforce=require(_0x9d59('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9d59('0x3'));var zoho=require(_0x9d59('0x4'));var desk=require(_0x9d59('0x5'));var vtiger=require(_0x9d59('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x9d59('0x7'));var integrations=[_0x9d59('0x8'),_0x9d59('0x9'),_0x9d59('0xa'),_0x9d59('0xb'),'zoho',_0x9d59('0xc'),_0x9d59('0xd'),_0x9d59('0xe'),'freshsales',_0x9d59('0xf')];exports[_0x9d59('0x10')]=function(_0x2e3a5c,_0xaf5c5e,_0xacf687,_0x2c7278,_0x1fee18,_0x8f7905){if(_0xacf687){if(_['includes'](integrations,_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]())){try{var _0x198157=null;var _0x494629='';var _0x23a96c=_0xacf687[_0x2e3a5c['data1']['toLowerCase']()];if(_0x23a96c){var _0x405e52=_0x23a96c[_0x2e3a5c['data2']];if(_0x405e52){var _0xf415a6=_[_0x9d59('0x13')](_0x405e52[_0x9d59('0x14')],{'id':parseInt(_0x2e3a5c['data3'],0xa)});if(_0xf415a6){if(_0x2c7278){if(_0x1fee18&&_0xaf5c5e['queue']){_0x494629='queue';}else if(_0xaf5c5e[_0x9d59('0x15')]){_0x494629=_0x9d59('0x16');}else{console[_0x9d59('0x17')](_0x9d59('0x18'),_0xaf5c5e);}}else{_0x494629=_0x9d59('0x19');}switch(_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]()){case _0x9d59('0x8'):zendesk[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case'salesforce':salesforce[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0xa'):sugarcrm[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0xb'):freshdesk[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case'zoho':zoho[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case'desk':desk[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0xd'):vtiger[_0x494629](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905);break;case _0x9d59('0x1a'):freshsales['cs'](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905,_0x494629);break;case'servicenow':servicenow['cs'](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905,_0x494629);break;case _0x9d59('0xe'):dynamics365['cs'](_0x2e3a5c,_0xaf5c5e,_0xf415a6,_0x2c7278,_0x1fee18,_0x405e52,_0x8f7905,_0x494629);break;default:console['log'](_0x9d59('0x1b'));}}else{_0x198157=require(_0x9d59('0x1c'))(_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]());_0x198157[_0x9d59('0x1d')](_0x9d59('0x1e'),util[_0x9d59('0x1f')](_0x9d59('0x20'),_0x2e3a5c[_0x9d59('0x11')]['toLowerCase'](),_0x2e3a5c[_0x9d59('0x21')]));}}else{_0x198157=require(_0x9d59('0x1c'))(_0x2e3a5c[_0x9d59('0x11')][_0x9d59('0x12')]());_0x198157[_0x9d59('0x1d')]('[EXEC]',util[_0x9d59('0x1f')](_0x9d59('0x22'),_0x2e3a5c['data1']['toLowerCase'](),_0x2e3a5c[_0x9d59('0x23')]));}}else{}}catch(_0x212578){console['error'](_0x212578);}}}}; \ 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 d8dd700..12aa430 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 _0xf08d=['forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','error','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','lastevent','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','defaults','redis','socket.io-emitter','emit','assign','getString','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','$or','Account','execute','Lead','lead','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst'];(function(_0x7e4042,_0x4f551e){var _0xe14482=function(_0xb52589){while(--_0xb52589){_0x7e4042['push'](_0x7e4042['shift']());}};_0xe14482(++_0x4f551e);}(_0xf08d,0x1be));var _0xdf08=function(_0x4dc04b,_0xd9aac5){_0x4dc04b=_0x4dc04b-0x0;var _0xc65b3d=_0xf08d[_0x4dc04b];return _0xc65b3d;};'use strict';var _=require('lodash');var rp=require(_0xdf08('0x0'));var moment=require('moment');var BPromise=require(_0xdf08('0x1'));var md5=require(_0xdf08('0x2'));var jsforce=require(_0xdf08('0x3'));var util=require(_0xdf08('0x4'));var Redis=require(_0xdf08('0x5'));var intUtil=require(_0xdf08('0x6'));var config=require(_0xdf08('0x7'));var logger=require('../../../../config/logger')(_0xdf08('0x8'));config['redis']=_[_0xdf08('0x9')](config[_0xdf08('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xdf08('0xb'))(new Redis(config[_0xdf08('0xa')]));function emit(_0x314f8c,_0x34153c,_0x2c84cc){io['to'](_0x314f8c)[_0xdf08('0xc')](_0x34153c,_0x2c84cc);}function getTicket(_0xa6712c,_0x479c5e,_0xae955d,_0x40d95e,_0x1cd518,_0x124c9f,_0x5c0ef2,_0x152fa7){var _0x4fa6bf=Object[_0xdf08('0xd')]({},{'OwnerId':_0x479c5e['id'],'Subject':intUtil[_0xdf08('0xe')](_0x40d95e['Subjects'],_0x1cd518,'\x20'),'Description':intUtil[_0xdf08('0xe')](_0x40d95e['Descriptions'],_0x1cd518,'\x0a')},getCustomFields(_0x124c9f,_0x1cd518));if(_0xae955d){if(_0x40d95e[_0xdf08('0xf')]===_0xdf08('0x10')){_0x4fa6bf[_0xdf08('0x11')]=moment[_0xdf08('0x12')]();_0x4fa6bf[_0xdf08('0x13')]=![];_0x4fa6bf[_0xdf08('0x14')]=![];if(_0xae955d[_0xdf08('0x15')]===_0xdf08('0x16')||_0xae955d[_0xdf08('0x15')]==='lead'){_0x4fa6bf[_0xdf08('0x17')]=_0xae955d['id'];}else if(_0xae955d[_0xdf08('0x15')]===_0xdf08('0x18')){_0x4fa6bf[_0xdf08('0x19')]=_0xae955d['id'];}}else if(_0x40d95e[_0xdf08('0xf')]==='Case'){if(_0xae955d['endUserType']===_0xdf08('0x16')){_0x4fa6bf[_0xdf08('0x1a')]=_0xae955d['id'];}else if(_0xae955d['endUserType']===_0xdf08('0x18')){_0x4fa6bf[_0xdf08('0x1b')]=_0xae955d['id'];}else if(_0xae955d[_0xdf08('0x15')]==='lead'&&_0x40d95e[_0xdf08('0x1c')]){_0x4fa6bf[_0x40d95e[_0xdf08('0x1c')]]=_0xae955d['id'];}else{logger[_0xdf08('0x1d')](_0xdf08('0x1e'));}}}return _0x5c0ef2[_0xdf08('0x1f')](_0x40d95e[_0xdf08('0xf')])[_0xdf08('0x20')](_0x4fa6bf);}function getUser(_0xc83877,_0x402910,_0x13f4f5){if(!_[_0xdf08('0x21')](_0x402910)&&intUtil[_0xdf08('0x22')](_0x402910)){var _0x186f5b={'Email':_0x402910};var _0x443e9b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x13f4f5[_0xdf08('0x1f')](_0xdf08('0x23'))[_0xdf08('0x24')](_0x186f5b,_0x443e9b)['execute']()[_0xdf08('0x25')](function(_0x468d40){if(_0x468d40[_0xdf08('0x26')]){var _0x24641b=_['find'](_0x468d40,function(_0x55c1bc){return _0x55c1bc[_0xdf08('0x27')]===_0x402910;});if(_0x24641b){logger[_0xdf08('0x1d')]('Agent\x20%s\x20found.',_0x402910);return BPromise[_0xdf08('0x28')]({'id':_0x24641b['Id'],'name':_0x24641b[_0xdf08('0x29')]});}}else{logger['info'](_0xdf08('0x2a'),_0x402910);return _0x13f4f5[_0xdf08('0x2b')]()[_0xdf08('0x25')](function(_0x516461){return BPromise[_0xdf08('0x28')]({'id':_0x516461[_0xdf08('0x2c')],'name':_0x516461[_0xdf08('0x2d')]});});}});}else{logger[_0xdf08('0x1d')](_0xdf08('0x2a'),_0x402910);return _0x13f4f5['identity']()[_0xdf08('0x25')](function(_0x3b997c){return BPromise[_0xdf08('0x28')]({'id':_0x3b997c[_0xdf08('0x2c')],'name':_0x3b997c[_0xdf08('0x2d')]});});}}function getEndUser(_0x327a6e,_0x14d1a2,_0x21d456,_0x51c118,_0x4a725e){var _0x547556={'$or':{'Phone':_0x51c118}};var _0x22907b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0xdf08('0x1d')](_0xdf08('0x2e'),_0x51c118,_0x14d1a2[_0xdf08('0x2f')]);switch(_0x14d1a2[_0xdf08('0x2f')]){case _0xdf08('0x30'):var _0x2a8cb7=_[_0xdf08('0x31')](_0x547556);if(_0x14d1a2['additionalSearchContact']){var _0x5e0ecf={};_0x5e0ecf[_0x14d1a2[_0xdf08('0x32')]]=_0x51c118;_[_0xdf08('0x33')](_0x2a8cb7['$or'],_0x5e0ecf);}return _0x4a725e[_0xdf08('0x1f')](_0xdf08('0x34'))['find'](_0x2a8cb7,_0x22907b)['execute']()['then'](function(_0x5332dc){if(_0x5332dc&&_0x5332dc[_0xdf08('0x26')]){return _0x5332dc;}else{var _0x2b61ba=_['cloneDeep'](_0x547556);if(_0x14d1a2[_0xdf08('0x35')]){var _0x187f49={};_0x187f49[_0x14d1a2[_0xdf08('0x35')]]=_0x51c118;_[_0xdf08('0x33')](_0x2b61ba['$or'],_0x187f49);}return _0x4a725e[_0xdf08('0x1f')]('Lead')[_0xdf08('0x24')](_0x2b61ba,_0x22907b);}});case _0xdf08('0x36'):var _0x5e92f6=_[_0xdf08('0x31')](_0x547556);if(_0x14d1a2[_0xdf08('0x37')]){var _0x5e0ecf={};_0x5e0ecf[_0x14d1a2[_0xdf08('0x37')]]=_0x51c118;_[_0xdf08('0x33')](_0x5e92f6[_0xdf08('0x38')],_0x5e0ecf);}return _0x4a725e['sobject'](_0xdf08('0x39'))[_0xdf08('0x24')](_0x5e92f6,_0x22907b)[_0xdf08('0x3a')]()[_0xdf08('0x25')](function(_0x102256){if(_0x102256&&_0x102256[_0xdf08('0x26')]){return _0x102256;}else{var _0x2ccf52=_[_0xdf08('0x31')](_0x547556);if(_0x14d1a2[_0xdf08('0x32')]){var _0x27992c={};_0x27992c[_0x14d1a2['additionalSearchContact']]=_0x51c118;_[_0xdf08('0x33')](_0x2ccf52[_0xdf08('0x38')],_0x27992c);}return _0x4a725e[_0xdf08('0x1f')]('Contact')['find'](_0x2ccf52,_0x22907b)[_0xdf08('0x25')](function(_0x2b27d8){if(_0x2b27d8&&_0x2b27d8[_0xdf08('0x26')]){return _0x2b27d8;}else{var _0x4a1327=_[_0xdf08('0x31')](_0x547556);if(_0x14d1a2[_0xdf08('0x35')]){var _0x56a7a2={};_0x56a7a2[_0x14d1a2[_0xdf08('0x35')]]=_0x51c118;_['merge'](_0x4a1327[_0xdf08('0x38')],_0x56a7a2);}return _0x4a725e[_0xdf08('0x1f')](_0xdf08('0x3b'))[_0xdf08('0x24')](_0x4a1327,_0x22907b);}});}});case _0xdf08('0x16'):var _0x2a8cb7=_['cloneDeep'](_0x547556);if(_0x14d1a2[_0xdf08('0x32')]){var _0x5e0ecf={};_0x5e0ecf[_0x14d1a2[_0xdf08('0x32')]]=_0x51c118;_[_0xdf08('0x33')](_0x2a8cb7[_0xdf08('0x38')],_0x5e0ecf);}return _0x4a725e[_0xdf08('0x1f')](_0xdf08('0x34'))[_0xdf08('0x24')](_0x2a8cb7,_0x22907b)[_0xdf08('0x3a')]();case _0xdf08('0x3c'):var _0x479e8b=_[_0xdf08('0x31')](_0x547556);if(_0x14d1a2[_0xdf08('0x35')]){var _0x5e0ecf={};_0x5e0ecf[_0x14d1a2[_0xdf08('0x35')]]=_0x51c118;_[_0xdf08('0x33')](_0x479e8b[_0xdf08('0x38')],_0x5e0ecf);}return _0x4a725e[_0xdf08('0x1f')](_0xdf08('0x3b'))[_0xdf08('0x24')](_0x479e8b,_0x22907b);case _0xdf08('0x18'):var _0x5e92f6=_[_0xdf08('0x31')](_0x547556);if(_0x14d1a2[_0xdf08('0x37')]){var _0x5e0ecf={};_0x5e0ecf[_0x14d1a2[_0xdf08('0x37')]]=_0x51c118;_['merge'](_0x5e92f6['$or'],_0x5e0ecf);}return _0x4a725e[_0xdf08('0x1f')](_0xdf08('0x39'))[_0xdf08('0x24')](_0x5e92f6,_0x22907b);default:return null;}})['then'](function(_0x202860){if(_0x202860&&_0x202860['length']){var _0x180d62=_[_0xdf08('0x3d')](_0x202860);if(_0x180d62){return BPromise[_0xdf08('0x28')]({'id':_0x180d62['Id'],'name':_0x180d62[_0xdf08('0x29')],'phone':_0x180d62[_0xdf08('0x3e')],'endUserType':_0x180d62[_0xdf08('0x3f')][_0xdf08('0x40')]['toLowerCase']()});}}})[_0xdf08('0x25')](function(_0x3c420b){if(_0x3c420b){logger[_0xdf08('0x1d')](_0xdf08('0x41'),_0x3c420b[_0xdf08('0x15')],_0x51c118);return BPromise[_0xdf08('0x28')](_0x3c420b);}else{logger[_0xdf08('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x51c118);var _0x8c2eb7={'Phone':_0x51c118};if(_0x14d1a2[_0xdf08('0x42')]){if(_0x14d1a2[_0xdf08('0x42')]===_0xdf08('0x16')){logger[_0xdf08('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x51c118,_0x14d1a2[_0xdf08('0x42')]);_0x8c2eb7[_0xdf08('0x43')]=_0x21d456!==_0xdf08('0x44')?_0x21d456:util[_0xdf08('0x45')](_0xdf08('0x46'),_0x51c118);}else if(_0x14d1a2[_0xdf08('0x42')]===_0xdf08('0x3c')){logger[_0xdf08('0x1d')](_0xdf08('0x47'),_0x51c118,_0x14d1a2[_0xdf08('0x42')]);_0x8c2eb7[_0xdf08('0x43')]=_0x21d456!==_0xdf08('0x44')?_0x21d456:util[_0xdf08('0x45')](_0xdf08('0x46'),_0x51c118);_0x8c2eb7[_0xdf08('0x48')]='No\x20Company';}else if(_0x14d1a2[_0xdf08('0x42')]==='account'){logger[_0xdf08('0x1d')](_0xdf08('0x47'),_0x51c118,_0x14d1a2[_0xdf08('0x42')]);_0x8c2eb7['Name']=_0x21d456!==_0xdf08('0x44')?_0x21d456:util[_0xdf08('0x45')](_0xdf08('0x46'),_0x51c118);}else{return null;}}return _0x4a725e['sobject'](_[_0xdf08('0x49')](_0x14d1a2[_0xdf08('0x42')]))[_0xdf08('0x20')](_0x8c2eb7)[_0xdf08('0x25')](function(_0x11125e){return BPromise['resolve']({'id':_0x11125e['id'],'endUserType':_0x14d1a2[_0xdf08('0x42')]});});}});}function getCustomFields(_0xdb9f2,_0x248c55){var _0x1c1127={};if(_0xdb9f2[_0xdf08('0x26')]>0x0){_[_0xdf08('0x4a')](_0xdb9f2,function(_0x56947f){if(_[_0xdf08('0x4b')]([_0xdf08('0x4c'),_0xdf08('0x4d')],_0x56947f[_0xdf08('0x40')])&&_0x56947f[_0xdf08('0x4e')]){_0x1c1127[_0x56947f[_0xdf08('0x4e')]]=_0x56947f[_0xdf08('0x4f')][_0xdf08('0x50')]();}else if(_0x56947f['type']===_0xdf08('0x51')&&_0x56947f[_0xdf08('0x52')]&&_0x56947f['idField']){_0x248c55[_0x56947f[_0xdf08('0x52')]]&&(_0x1c1127[_0x56947f[_0xdf08('0x4e')]]=_0x248c55[_0x56947f[_0xdf08('0x52')]][_0xdf08('0x50')]());}else if(_0x56947f[_0xdf08('0x40')]==='customVariable'&&_0x56947f[_0xdf08('0x53')]&&_0x56947f[_0xdf08('0x53')]['name']&&_0x56947f[_0xdf08('0x4e')]){_0x248c55[_0x56947f['Variable'][_0xdf08('0x54')][_0xdf08('0x55')]()]&&(_0x1c1127[_0x56947f[_0xdf08('0x4e')]]=_0x248c55[_0x56947f[_0xdf08('0x53')][_0xdf08('0x54')][_0xdf08('0x55')]()][_0xdf08('0x50')]());}});}return _0x1c1127;}function getConnection(_0x2d2aba){var _0x8d5a14=_0x2d2aba[_0xdf08('0x56')]['concat'](_0x2d2aba[_0xdf08('0x57')]);var _0x440da9=new jsforce[(_0xdf08('0x58'))]({'oauth2':{'loginUrl':_0x2d2aba[_0xdf08('0x59')]||_0xdf08('0x5a'),'clientId':_0x2d2aba[_0xdf08('0x5b')],'clientSecret':_0x2d2aba[_0xdf08('0x5c')]}});return _0x440da9[_0xdf08('0x5d')](_0x2d2aba[_0xdf08('0x5e')],_0x8d5a14)[_0xdf08('0x25')](function(){logger[_0xdf08('0x1d')](_0xdf08('0x5f'));return _0x440da9;});}exports['queue']=function(_0x3c24f6,_0x191489,_0x3a77d1,_0x4c28a4,_0x32d8b6,_0x55963e){var _0x1c5ec0,_0x3aeeb9,_0x2ff169,_0x2403f0;_0x55963e[_0xdf08('0x60')]=intUtil['stripTrailingSlash'](_0x55963e[_0xdf08('0x60')]);_0x55963e['remoteUri']=intUtil[_0xdf08('0x61')](_0x55963e['remoteUri']);if(_0x32d8b6&&_0x32d8b6['monitor_format']){logger[_0xdf08('0x1d')](_0xdf08('0x62'),_0xdf08('0x63'));_0x191489['recordingURL']=util[_0xdf08('0x45')](_0xdf08('0x64'),_0x55963e[_0xdf08('0x60')],_0x191489['uniqueid'],md5(_0x191489[_0xdf08('0x65')]));}else{_0x191489[_0xdf08('0x66')]='';}return getConnection(_0x55963e)[_0xdf08('0x25')](function(_0x22063d){_0x2403f0=_0x22063d;return getUser(_0x55963e,_0x4c28a4[_0xdf08('0x67')],_0x2403f0);})[_0xdf08('0x25')](function(_0x445a17){_0x1c5ec0=_0x445a17;return getEndUser(_0x55963e,_0x3a77d1,_0x191489[_0xdf08('0x68')],_0x191489[_0xdf08('0x69')],_0x2403f0);})[_0xdf08('0x25')](function(_0x211e16){_0x3aeeb9=_0x211e16;return getTicket(_0x55963e,_0x1c5ec0,_0x3aeeb9,_0x3a77d1,_0x191489,_0x3a77d1[_0xdf08('0x6a')],_0x2403f0,_0xdf08('0x6b'));})[_0xdf08('0x25')](function(_0x22dd32){_0x2ff169=_0x22dd32;logger[_0xdf08('0x1d')](_0xdf08('0x6c'),_0x2ff169['id']);logger[_0xdf08('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2ff169['id'],_0x4c28a4[_0xdf08('0x54')],_0x55963e['type']);switch(_0x55963e[_0xdf08('0x40')]){case _0xdf08('0x6d'):emit(util[_0xdf08('0x45')](_0xdf08('0x6e'),_0x4c28a4[_0xdf08('0x54')]),'trigger:salesforce:display',{'recordId':_0x2ff169['id']});break;case _0xdf08('0x6f'):emit(util[_0xdf08('0x45')](_0xdf08('0x6e'),_0x4c28a4[_0xdf08('0x54')]),_0xdf08('0x70'),{'uri':util[_0xdf08('0x45')](_0xdf08('0x71'),_0x2403f0[_0xdf08('0x72')],_0x2ff169['id'])});break;default:logger['error'](_0xdf08('0x73'));}})[_0xdf08('0x74')](function(_0x3b5481){logger['error']('[QUEUE]',_0x3b5481);});};exports[_0xdf08('0x75')]=function(_0xd9f4e7,_0x2c3e59,_0x51f75a,_0x3eb7de,_0x3abc48,_0x532b17,_0x241ecd){var _0x859269,_0xc31e58,_0x99a436,_0x23d839;_0x532b17[_0xdf08('0x60')]=intUtil[_0xdf08('0x61')](_0x532b17[_0xdf08('0x60')]);_0x532b17[_0xdf08('0x59')]=intUtil[_0xdf08('0x61')](_0x532b17[_0xdf08('0x59')]);if(_0x241ecd&&_0x241ecd['recordingFormat']&&_0x241ecd['recordingFormat']!==_0xdf08('0x76')){logger[_0xdf08('0x1d')](_0xdf08('0x77'),_0xdf08('0x63'));_0x2c3e59[_0xdf08('0x66')]=util[_0xdf08('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x532b17[_0xdf08('0x60')],_0x2c3e59[_0xdf08('0x65')],md5(_0x2c3e59[_0xdf08('0x65')]));}return getConnection(_0x532b17)[_0xdf08('0x25')](function(_0x40a5a4){_0x23d839=_0x40a5a4;return getUser(_0x532b17,_0x3eb7de[_0xdf08('0x67')],_0x23d839);})[_0xdf08('0x25')](function(_0x52ad20){_0x859269=_0x52ad20;return getEndUser(_0x532b17,_0x51f75a,_0x2c3e59[_0xdf08('0x78')],_0x2c3e59['destcalleridnum'],_0x23d839);})[_0xdf08('0x25')](function(_0x3f99fa){_0xc31e58=_0x3f99fa;return getTicket(_0x532b17,_0x859269,_0xc31e58,_0x51f75a,_0x2c3e59,_0x51f75a[_0xdf08('0x6a')],_0x23d839,_0xdf08('0x75'));})[_0xdf08('0x25')](function(_0x41986e){_0x99a436=_0x41986e;logger[_0xdf08('0x1d')](_0xdf08('0x79'),_0x99a436['id']);logger[_0xdf08('0x1d')](_0xdf08('0x7a'),_0x99a436['id'],_0x3eb7de[_0xdf08('0x54')],_0x532b17['type']);switch(_0x532b17['type']){case _0xdf08('0x6d'):emit(util['format'](_0xdf08('0x6e'),_0x3eb7de[_0xdf08('0x54')]),_0xdf08('0x7b'),{'recordId':_0x99a436['id']});break;case _0xdf08('0x6f'):emit(util[_0xdf08('0x45')](_0xdf08('0x6e'),_0x3eb7de[_0xdf08('0x54')]),_0xdf08('0x70'),{'uri':util[_0xdf08('0x45')](_0xdf08('0x71'),_0x23d839[_0xdf08('0x72')],_0x99a436['id'])});break;default:logger[_0xdf08('0x7c')](_0xdf08('0x77'),_0xdf08('0x7d'));}})[_0xdf08('0x74')](function(_0x174969){logger['error']('[OUTBOUND]',_0x174969);});};exports[_0xdf08('0x7e')]=function(_0x191943,_0x585fd1,_0x5c3e27,_0x482e33,_0x599c30,_0x47cdf2){var _0xd7943,_0xaa135a,_0x44c0cd,_0x39b1e9;_0x47cdf2[_0xdf08('0x60')]=intUtil[_0xdf08('0x61')](_0x47cdf2['serverUrl']);_0x47cdf2['remoteUri']=intUtil['stripTrailingSlash'](_0x47cdf2['remoteUri']);if(_0x599c30&&_0x599c30[_0xdf08('0x7f')]){logger['info']('['+_0x585fd1['lastevent'][_0xdf08('0x80')]()+']',_0xdf08('0x63'));_0x585fd1[_0xdf08('0x66')]=util[_0xdf08('0x45')](_0xdf08('0x64'),_0x47cdf2[_0xdf08('0x60')],_0x585fd1['uniqueid'],md5(_0x585fd1[_0xdf08('0x65')]));}else{_0x585fd1[_0xdf08('0x66')]='';}return getConnection(_0x47cdf2)['then'](function(_0x37659a){_0x39b1e9=_0x37659a;if(!_['isNil'](_0x482e33)){return getUser(_0x47cdf2,_0x482e33[_0xdf08('0x54')],_0x39b1e9);}else{return getUser(_0x47cdf2,null,_0x39b1e9);}})['then'](function(_0x53d2c5){_0xd7943=_0x53d2c5;return getEndUser(_0x47cdf2,_0x5c3e27,_0x585fd1[_0xdf08('0x68')],_0x585fd1['calleridnum'],_0x39b1e9);})[_0xdf08('0x25')](function(_0x3736fe){_0xaa135a=_0x3736fe;return getTicket(_0x47cdf2,_0xd7943,_0xaa135a,_0x5c3e27,_0x585fd1,_0x5c3e27[_0xdf08('0x6a')],_0x39b1e9);})['then'](function(_0x474781){_0x44c0cd=_0x474781;logger[_0xdf08('0x1d')]('['+_0x585fd1['lastevent'][_0xdf08('0x80')]()+']\x20Ticket\x20%s\x20created.',_0x44c0cd['id']);logger[_0xdf08('0x1d')]('['+_0x585fd1[_0xdf08('0x81')][_0xdf08('0x80')]()+']\x20Integration\x20account\x20type\x20%s.',_0x47cdf2['type']);})[_0xdf08('0x74')](function(_0x3d8912){logger[_0xdf08('0x7c')]('['+_0x585fd1[_0xdf08('0x81')][_0xdf08('0x80')]()+']',_0x3d8912);});}; \ No newline at end of file +var _0x6406=['ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','Case','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','Lead','additionalSearchAccount','$or','Account','Contact','contact','first','Phone','attributes','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','login','username','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','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','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','assign','Subjects','getString','Descriptions'];(function(_0x19e45c,_0x35a205){var _0x5c2f09=function(_0x379aa0){while(--_0x379aa0){_0x19e45c['push'](_0x19e45c['shift']());}};_0x5c2f09(++_0x35a205);}(_0x6406,0xf2));var _0x6640=function(_0x5d2f39,_0x11e2f4){_0x5d2f39=_0x5d2f39-0x0;var _0x3df8f6=_0x6406[_0x5d2f39];return _0x3df8f6;};'use strict';var _=require('lodash');var rp=require(_0x6640('0x0'));var moment=require(_0x6640('0x1'));var BPromise=require('bluebird');var md5=require(_0x6640('0x2'));var jsforce=require(_0x6640('0x3'));var util=require(_0x6640('0x4'));var Redis=require(_0x6640('0x5'));var intUtil=require('./util');var config=require(_0x6640('0x6'));var logger=require(_0x6640('0x7'))('salesforce');config[_0x6640('0x8')]=_[_0x6640('0x9')](config['redis'],{'host':_0x6640('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6640('0x8')]));function emit(_0x2e45bd,_0x5629ab,_0x589b09){io['to'](_0x2e45bd)[_0x6640('0xb')](_0x5629ab,_0x589b09);}function getTicket(_0x498f42,_0x59c6bf,_0x2d8b59,_0x5a50d7,_0xabbd94,_0x3dc209,_0xdb0db8,_0x166134){var _0x2bbd22=Object[_0x6640('0xc')]({},{'OwnerId':_0x59c6bf['id'],'Subject':intUtil['getString'](_0x5a50d7[_0x6640('0xd')],_0xabbd94,'\x20'),'Description':intUtil[_0x6640('0xe')](_0x5a50d7[_0x6640('0xf')],_0xabbd94,'\x0a')},getCustomFields(_0x3dc209,_0xabbd94));if(_0x2d8b59){if(_0x5a50d7[_0x6640('0x10')]==='Task'){_0x2bbd22[_0x6640('0x11')]=moment[_0x6640('0x12')]();_0x2bbd22[_0x6640('0x13')]=![];_0x2bbd22[_0x6640('0x14')]=![];if(_0x2d8b59[_0x6640('0x15')]==='contact'||_0x2d8b59[_0x6640('0x15')]===_0x6640('0x16')){_0x2bbd22[_0x6640('0x17')]=_0x2d8b59['id'];}else if(_0x2d8b59[_0x6640('0x15')]===_0x6640('0x18')){_0x2bbd22['WhatId']=_0x2d8b59['id'];}}else if(_0x5a50d7[_0x6640('0x10')]===_0x6640('0x19')){if(_0x2d8b59[_0x6640('0x15')]==='contact'){_0x2bbd22[_0x6640('0x1a')]=_0x2d8b59['id'];}else if(_0x2d8b59[_0x6640('0x15')]==='account'){_0x2bbd22[_0x6640('0x1b')]=_0x2d8b59['id'];}else if(_0x2d8b59[_0x6640('0x15')]==='lead'&&_0x5a50d7['leadId']){_0x2bbd22[_0x5a50d7['leadId']]=_0x2d8b59['id'];}else{logger[_0x6640('0x1c')](_0x6640('0x1d'));}}}return _0xdb0db8[_0x6640('0x1e')](_0x5a50d7[_0x6640('0x10')])['create'](_0x2bbd22);}function getUser(_0x46f96b,_0x1bf214,_0x2640f9){if(!_[_0x6640('0x1f')](_0x1bf214)&&intUtil[_0x6640('0x20')](_0x1bf214)){var _0x3d4e75={'Email':_0x1bf214};var _0x1452f0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2640f9[_0x6640('0x1e')](_0x6640('0x21'))[_0x6640('0x22')](_0x3d4e75,_0x1452f0)['execute']()[_0x6640('0x23')](function(_0x1f1c82){if(_0x1f1c82[_0x6640('0x24')]){var _0x50ece3=_[_0x6640('0x22')](_0x1f1c82,function(_0x34262c){return _0x34262c[_0x6640('0x25')]===_0x1bf214;});if(_0x50ece3){logger[_0x6640('0x1c')](_0x6640('0x26'),_0x1bf214);return BPromise[_0x6640('0x27')]({'id':_0x50ece3['Id'],'name':_0x50ece3[_0x6640('0x28')]});}}else{logger[_0x6640('0x1c')](_0x6640('0x29'),_0x1bf214);return _0x2640f9['identity']()[_0x6640('0x23')](function(_0x42bbb4){return BPromise['resolve']({'id':_0x42bbb4[_0x6640('0x2a')],'name':_0x42bbb4[_0x6640('0x2b')]});});}});}else{logger[_0x6640('0x1c')](_0x6640('0x29'),_0x1bf214);return _0x2640f9[_0x6640('0x2c')]()['then'](function(_0x286a90){return BPromise[_0x6640('0x27')]({'id':_0x286a90[_0x6640('0x2a')],'name':_0x286a90['display_name']});});}}function getEndUser(_0x3506d3,_0x57980f,_0xe6b53c,_0x4c2fe4,_0xf1bfe1){var _0x10d6d1={'$or':{'Phone':_0x4c2fe4}};var _0x1b7e76={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6640('0x27')]()[_0x6640('0x23')](function(){logger[_0x6640('0x1c')](_0x6640('0x2d'),_0x4c2fe4,_0x57980f[_0x6640('0x2e')]);switch(_0x57980f[_0x6640('0x2e')]){case _0x6640('0x2f'):var _0x4941b2=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x31')]){var _0x249b90={};_0x249b90[_0x57980f[_0x6640('0x31')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x4941b2['$or'],_0x249b90);}return _0xf1bfe1[_0x6640('0x1e')]('Contact')[_0x6640('0x22')](_0x4941b2,_0x1b7e76)[_0x6640('0x33')]()[_0x6640('0x23')](function(_0x1f599a){if(_0x1f599a&&_0x1f599a[_0x6640('0x24')]){return _0x1f599a;}else{var _0x5a5b0c=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f['additionalSearchLead']){var _0x495e10={};_0x495e10[_0x57980f[_0x6640('0x34')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x5a5b0c['$or'],_0x495e10);}return _0xf1bfe1['sobject'](_0x6640('0x35'))[_0x6640('0x22')](_0x5a5b0c,_0x1b7e76);}});case'account_contact_lead':var _0x443ea4=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x36')]){var _0x249b90={};_0x249b90[_0x57980f['additionalSearchAccount']]=_0x4c2fe4;_[_0x6640('0x32')](_0x443ea4[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1[_0x6640('0x1e')](_0x6640('0x38'))[_0x6640('0x22')](_0x443ea4,_0x1b7e76)[_0x6640('0x33')]()['then'](function(_0x3757b8){if(_0x3757b8&&_0x3757b8['length']){return _0x3757b8;}else{var _0x2bbc79=_['cloneDeep'](_0x10d6d1);if(_0x57980f[_0x6640('0x31')]){var _0x185082={};_0x185082[_0x57980f[_0x6640('0x31')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x2bbc79['$or'],_0x185082);}return _0xf1bfe1['sobject'](_0x6640('0x39'))[_0x6640('0x22')](_0x2bbc79,_0x1b7e76)[_0x6640('0x23')](function(_0x4ae320){if(_0x4ae320&&_0x4ae320[_0x6640('0x24')]){return _0x4ae320;}else{var _0x2734cb=_['cloneDeep'](_0x10d6d1);if(_0x57980f['additionalSearchLead']){var _0x44139b={};_0x44139b[_0x57980f[_0x6640('0x34')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x2734cb[_0x6640('0x37')],_0x44139b);}return _0xf1bfe1['sobject'](_0x6640('0x35'))['find'](_0x2734cb,_0x1b7e76);}});}});case _0x6640('0x3a'):var _0x4941b2=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x31')]){var _0x249b90={};_0x249b90[_0x57980f[_0x6640('0x31')]]=_0x4c2fe4;_[_0x6640('0x32')](_0x4941b2[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1['sobject'](_0x6640('0x39'))[_0x6640('0x22')](_0x4941b2,_0x1b7e76)[_0x6640('0x33')]();case _0x6640('0x16'):var _0x214bae=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x34')]){var _0x249b90={};_0x249b90[_0x57980f['additionalSearchLead']]=_0x4c2fe4;_[_0x6640('0x32')](_0x214bae[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1[_0x6640('0x1e')](_0x6640('0x35'))[_0x6640('0x22')](_0x214bae,_0x1b7e76);case'account':var _0x443ea4=_[_0x6640('0x30')](_0x10d6d1);if(_0x57980f[_0x6640('0x36')]){var _0x249b90={};_0x249b90[_0x57980f['additionalSearchAccount']]=_0x4c2fe4;_['merge'](_0x443ea4[_0x6640('0x37')],_0x249b90);}return _0xf1bfe1['sobject']('Account')[_0x6640('0x22')](_0x443ea4,_0x1b7e76);default:return null;}})[_0x6640('0x23')](function(_0x19dbfa){if(_0x19dbfa&&_0x19dbfa[_0x6640('0x24')]){var _0x17980a=_[_0x6640('0x3b')](_0x19dbfa);if(_0x17980a){return BPromise[_0x6640('0x27')]({'id':_0x17980a['Id'],'name':_0x17980a[_0x6640('0x28')],'phone':_0x17980a[_0x6640('0x3c')],'endUserType':_0x17980a[_0x6640('0x3d')][_0x6640('0x3e')][_0x6640('0x3f')]()});}}})[_0x6640('0x23')](function(_0x247a16){if(_0x247a16){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x247a16[_0x6640('0x15')],_0x4c2fe4);return BPromise[_0x6640('0x27')](_0x247a16);}else{logger[_0x6640('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4c2fe4);var _0x5bcbf5={'Phone':_0x4c2fe4};if(_0x57980f[_0x6640('0x40')]){if(_0x57980f[_0x6640('0x40')]==='contact'){logger[_0x6640('0x1c')](_0x6640('0x41'),_0x4c2fe4,_0x57980f[_0x6640('0x40')]);_0x5bcbf5[_0x6640('0x42')]=_0xe6b53c!==_0x6640('0x43')?_0xe6b53c:util[_0x6640('0x44')]('Caller\x20-\x20%s',_0x4c2fe4);}else if(_0x57980f[_0x6640('0x40')]===_0x6640('0x16')){logger[_0x6640('0x1c')](_0x6640('0x41'),_0x4c2fe4,_0x57980f['moduleCreate']);_0x5bcbf5[_0x6640('0x42')]=_0xe6b53c!==_0x6640('0x43')?_0xe6b53c:util[_0x6640('0x44')](_0x6640('0x45'),_0x4c2fe4);_0x5bcbf5[_0x6640('0x46')]=_0x6640('0x47');}else if(_0x57980f['moduleCreate']===_0x6640('0x18')){logger['info'](_0x6640('0x41'),_0x4c2fe4,_0x57980f[_0x6640('0x40')]);_0x5bcbf5[_0x6640('0x28')]=_0xe6b53c!==''?_0xe6b53c:util['format'](_0x6640('0x45'),_0x4c2fe4);}else{return null;}}return _0xf1bfe1[_0x6640('0x1e')](_[_0x6640('0x48')](_0x57980f['moduleCreate']))[_0x6640('0x49')](_0x5bcbf5)[_0x6640('0x23')](function(_0x259e4c){return BPromise[_0x6640('0x27')]({'id':_0x259e4c['id'],'endUserType':_0x57980f[_0x6640('0x40')]});});}});}function getCustomFields(_0x5bb8a3,_0x49cb6f){var _0x1dcfe5={};if(_0x5bb8a3[_0x6640('0x24')]>0x0){_[_0x6640('0x4a')](_0x5bb8a3,function(_0x4c9bc0){if(_[_0x6640('0x4b')]([_0x6640('0x4c'),_0x6640('0x4d')],_0x4c9bc0['type'])&&_0x4c9bc0[_0x6640('0x4e')]){_0x1dcfe5[_0x4c9bc0[_0x6640('0x4e')]]=_0x4c9bc0[_0x6640('0x4f')][_0x6640('0x50')]();}else if(_0x4c9bc0[_0x6640('0x3e')]===_0x6640('0x51')&&_0x4c9bc0[_0x6640('0x52')]&&_0x4c9bc0[_0x6640('0x4e')]){_0x49cb6f[_0x4c9bc0[_0x6640('0x52')]]&&(_0x1dcfe5[_0x4c9bc0[_0x6640('0x4e')]]=_0x49cb6f[_0x4c9bc0[_0x6640('0x52')]][_0x6640('0x50')]());}else if(_0x4c9bc0['type']==='customVariable'&&_0x4c9bc0[_0x6640('0x53')]&&_0x4c9bc0[_0x6640('0x53')][_0x6640('0x54')]&&_0x4c9bc0[_0x6640('0x4e')]){_0x49cb6f[_0x4c9bc0[_0x6640('0x53')][_0x6640('0x54')][_0x6640('0x3f')]()]&&(_0x1dcfe5[_0x4c9bc0[_0x6640('0x4e')]]=_0x49cb6f[_0x4c9bc0[_0x6640('0x53')]['name']['toLowerCase']()][_0x6640('0x50')]());}});}return _0x1dcfe5;}function getConnection(_0x2e873a){var _0x54d500=_0x2e873a[_0x6640('0x55')][_0x6640('0x56')](_0x2e873a[_0x6640('0x57')]);var _0x4a1096=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2e873a[_0x6640('0x58')]||_0x6640('0x59'),'clientId':_0x2e873a['clientId'],'clientSecret':_0x2e873a['clientSecret']}});return _0x4a1096[_0x6640('0x5a')](_0x2e873a[_0x6640('0x5b')],_0x54d500)[_0x6640('0x23')](function(){logger['info']('Connection\x20established.');return _0x4a1096;});}exports['queue']=function(_0x2a2126,_0x50bf6b,_0x419afd,_0x447993,_0x57513b,_0x3d24fd){var _0x4bd4b3,_0x5c7d1e,_0x3814db,_0x530c21;_0x3d24fd[_0x6640('0x5c')]=intUtil[_0x6640('0x5d')](_0x3d24fd[_0x6640('0x5c')]);_0x3d24fd[_0x6640('0x58')]=intUtil[_0x6640('0x5d')](_0x3d24fd[_0x6640('0x58')]);if(_0x57513b&&_0x57513b[_0x6640('0x5e')]){logger[_0x6640('0x1c')]('[QUEUE]',_0x6640('0x5f'));_0x50bf6b['recordingURL']=util[_0x6640('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d24fd['serverUrl'],_0x50bf6b[_0x6640('0x60')],md5(_0x50bf6b[_0x6640('0x60')]));}else{_0x50bf6b[_0x6640('0x61')]='';}return getConnection(_0x3d24fd)['then'](function(_0x595f76){_0x530c21=_0x595f76;return getUser(_0x3d24fd,_0x447993[_0x6640('0x62')],_0x530c21);})[_0x6640('0x23')](function(_0x39497d){_0x4bd4b3=_0x39497d;return getEndUser(_0x3d24fd,_0x419afd,_0x50bf6b[_0x6640('0x63')],_0x50bf6b[_0x6640('0x64')],_0x530c21);})[_0x6640('0x23')](function(_0x5e4cee){_0x5c7d1e=_0x5e4cee;return getTicket(_0x3d24fd,_0x4bd4b3,_0x5c7d1e,_0x419afd,_0x50bf6b,_0x419afd['Fields'],_0x530c21,_0x6640('0x65'));})['then'](function(_0x389dc7){_0x3814db=_0x389dc7;logger[_0x6640('0x1c')](_0x6640('0x66'),_0x3814db['id']);logger[_0x6640('0x1c')](_0x6640('0x67'),_0x3814db['id'],_0x447993[_0x6640('0x54')],_0x3d24fd[_0x6640('0x3e')]);switch(_0x3d24fd[_0x6640('0x3e')]){case _0x6640('0x68'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x447993[_0x6640('0x54')]),_0x6640('0x6a'),{'recordId':_0x3814db['id']});break;case _0x6640('0x6b'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x447993[_0x6640('0x54')]),'trigger:browser:url',{'uri':util['format'](_0x6640('0x6c'),_0x530c21[_0x6640('0x6d')],_0x3814db['id'])});break;default:logger['error'](_0x6640('0x6e'));}})[_0x6640('0x6f')](function(_0x130044){logger[_0x6640('0x70')](_0x6640('0x71'),_0x130044);});};exports['outbound']=function(_0x1e9938,_0x3d6dc7,_0x5a50e9,_0x4da46e,_0x55e7ab,_0x2aba83,_0x2a5a21){var _0x5cbfc7,_0x1db535,_0xe48393,_0x57c54a;_0x2aba83[_0x6640('0x5c')]=intUtil[_0x6640('0x5d')](_0x2aba83[_0x6640('0x5c')]);_0x2aba83[_0x6640('0x58')]=intUtil[_0x6640('0x5d')](_0x2aba83[_0x6640('0x58')]);if(_0x2a5a21&&_0x2a5a21[_0x6640('0x72')]&&_0x2a5a21[_0x6640('0x72')]!==_0x6640('0x73')){logger[_0x6640('0x1c')]('[OUTBOUND]',_0x6640('0x5f'));_0x3d6dc7[_0x6640('0x61')]=util['format'](_0x6640('0x74'),_0x2aba83[_0x6640('0x5c')],_0x3d6dc7[_0x6640('0x60')],md5(_0x3d6dc7[_0x6640('0x60')]));}return getConnection(_0x2aba83)[_0x6640('0x23')](function(_0x18db3e){_0x57c54a=_0x18db3e;return getUser(_0x2aba83,_0x4da46e[_0x6640('0x62')],_0x57c54a);})[_0x6640('0x23')](function(_0x274158){_0x5cbfc7=_0x274158;return getEndUser(_0x2aba83,_0x5a50e9,_0x3d6dc7[_0x6640('0x75')],_0x3d6dc7[_0x6640('0x76')],_0x57c54a);})[_0x6640('0x23')](function(_0x4da221){_0x1db535=_0x4da221;return getTicket(_0x2aba83,_0x5cbfc7,_0x1db535,_0x5a50e9,_0x3d6dc7,_0x5a50e9[_0x6640('0x77')],_0x57c54a,_0x6640('0x78'));})[_0x6640('0x23')](function(_0x57d360){_0xe48393=_0x57d360;logger[_0x6640('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xe48393['id']);logger[_0x6640('0x1c')](_0x6640('0x79'),_0xe48393['id'],_0x4da46e[_0x6640('0x54')],_0x2aba83[_0x6640('0x3e')]);switch(_0x2aba83[_0x6640('0x3e')]){case _0x6640('0x68'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x4da46e[_0x6640('0x54')]),_0x6640('0x6a'),{'recordId':_0xe48393['id']});break;case _0x6640('0x6b'):emit(util[_0x6640('0x44')](_0x6640('0x69'),_0x4da46e[_0x6640('0x54')]),_0x6640('0x7a'),{'uri':util[_0x6640('0x44')](_0x6640('0x6c'),_0x57c54a[_0x6640('0x6d')],_0xe48393['id'])});break;default:logger['error'](_0x6640('0x7b'),_0x6640('0x7c'));}})['catch'](function(_0x362e9c){logger[_0x6640('0x70')]('[OUTBOUND]',_0x362e9c);});};exports[_0x6640('0x7d')]=function(_0x5e1627,_0x4f2a03,_0x2160af,_0x5f5636,_0x1e3249,_0x26df9a){var _0x28df23,_0x58471b,_0x1e1709,_0x916f2c;_0x26df9a[_0x6640('0x5c')]=intUtil[_0x6640('0x5d')](_0x26df9a['serverUrl']);_0x26df9a[_0x6640('0x58')]=intUtil['stripTrailingSlash'](_0x26df9a['remoteUri']);if(_0x1e3249&&_0x1e3249[_0x6640('0x5e')]){logger[_0x6640('0x1c')]('['+_0x4f2a03[_0x6640('0x7e')]['toUpperCase']()+']',_0x6640('0x5f'));_0x4f2a03[_0x6640('0x61')]=util[_0x6640('0x44')](_0x6640('0x74'),_0x26df9a[_0x6640('0x5c')],_0x4f2a03['uniqueid'],md5(_0x4f2a03[_0x6640('0x60')]));}else{_0x4f2a03['recordingURL']='';}return getConnection(_0x26df9a)[_0x6640('0x23')](function(_0x591f2c){_0x916f2c=_0x591f2c;if(!_[_0x6640('0x1f')](_0x5f5636)){return getUser(_0x26df9a,_0x5f5636['name'],_0x916f2c);}else{return getUser(_0x26df9a,null,_0x916f2c);}})['then'](function(_0x2ad6e3){_0x28df23=_0x2ad6e3;return getEndUser(_0x26df9a,_0x2160af,_0x4f2a03[_0x6640('0x63')],_0x4f2a03['calleridnum'],_0x916f2c);})[_0x6640('0x23')](function(_0x5008f5){_0x58471b=_0x5008f5;return getTicket(_0x26df9a,_0x28df23,_0x58471b,_0x2160af,_0x4f2a03,_0x2160af['Fields'],_0x916f2c);})['then'](function(_0x2805e){_0x1e1709=_0x2805e;logger[_0x6640('0x1c')]('['+_0x4f2a03[_0x6640('0x7e')][_0x6640('0x7f')]()+']\x20Ticket\x20%s\x20created.',_0x1e1709['id']);logger[_0x6640('0x1c')]('['+_0x4f2a03[_0x6640('0x7e')][_0x6640('0x7f')]()+_0x6640('0x80'),_0x26df9a[_0x6640('0x3e')]);})[_0x6640('0x6f')](function(_0x309a58){logger['error']('['+_0x4f2a03['lastevent']['toUpperCase']()+']',_0x309a58);});}; \ 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 0a30fd2..3c91f20 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 _0x0e22=['],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','nameField','customField','toLowerCase','type','idField','content','toString','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','format','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','serverUrl','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','sys_id','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','endUserId'];(function(_0x35abf0,_0x3c7115){var _0x1ccaa3=function(_0x43b8f1){while(--_0x43b8f1){_0x35abf0['push'](_0x35abf0['shift']());}};_0x1ccaa3(++_0x3c7115);}(_0x0e22,0x11a));var _0x20e2=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0x0e22[_0x3c8832];return _0xacf303;};'use strict';var _=require(_0x20e2('0x0'));var Promise=require(_0x20e2('0x1'));var rp=require(_0x20e2('0x2'));var util=require(_0x20e2('0x3'));var md5=require('md5');var Redis=require(_0x20e2('0x4'));var intUtil=require(_0x20e2('0x5'));var config=require(_0x20e2('0x6'));var logger=require('../../../../config/logger')(_0x20e2('0x7'));config[_0x20e2('0x8')]=_['defaults'](config[_0x20e2('0x8')],{'host':_0x20e2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x20e2('0x8')]));function getAdminUser(_0x2ea201,_0x172310,_0x5a37aa,_0x33ce11,_0x343e80,_0x54e250){return new Promise(function(_0x43dca2,_0xcd43e8){var _0x3d2cba={'method':'GET','uri':_0x33ce11+_0x20e2('0xa')+'&'+_0x343e80+'&'+_0x54e250,'auth':_0x172310,'json':!![]};return rp(_0x3d2cba)[_0x20e2('0xb')](function(_0x355378){if(_0x355378[_0x20e2('0xc')][_0x20e2('0xd')]>0x0){_0x5a37aa[_0x20e2('0xe')]=_0x355378[_0x20e2('0xc')][0x0]['sys_id'];}logger[_0x20e2('0xf')]('['+[_0x2ea201['toUpperCase']()]+_0x20e2('0x10'),_0x5a37aa);_0x43dca2(_0x5a37aa);})[_0x20e2('0x11')](function(_0x4eb2c4){logger['error']('['+[_0x2ea201[_0x20e2('0x12')]()]+']',_0x4eb2c4[_0x20e2('0x13')]);_0xcd43e8(_0x4eb2c4[_0x20e2('0x13')]);});});}function getUser(_0x2fde27,_0x301769,_0x21677d,_0x3e5e6b,_0x5b24a6){return function(_0x1e0ecd){logger[_0x20e2('0xf')]('['+[_0x2fde27[_0x20e2('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x1e0ecd);return new Promise(function(_0x45a622,_0x42bc31){if(intUtil[_0x20e2('0x14')](_0x1e0ecd[_0x20e2('0x15')])){var _0x312826={'method':_0x20e2('0x16'),'uri':_0x21677d+_0x20e2('0x17')+_0x1e0ecd[_0x20e2('0x15')]+'&'+_0x3e5e6b+'&'+_0x5b24a6,'auth':_0x301769,'json':!![]};logger[_0x20e2('0xf')]('['+[_0x2fde27[_0x20e2('0x12')]()]+_0x20e2('0x18'),_0x312826);return rp(_0x312826)[_0x20e2('0xb')](function(_0x320ae5){logger[_0x20e2('0xf')]('['+[_0x2fde27['toUpperCase']()]+_0x20e2('0x19'),_0x320ae5);if(_0x320ae5[_0x20e2('0xc')][_0x20e2('0xd')]>0x0&&String(_0x320ae5[_0x20e2('0xc')][0x0][_0x20e2('0x1a')])===_0x20e2('0x1b')){_0x1e0ecd['userId']=_0x320ae5[_0x20e2('0xc')][0x0][_0x20e2('0x1c')];}else{_0x1e0ecd[_0x20e2('0x1d')]=_0x1e0ecd['adminId'];_0x1e0ecd[_0x20e2('0x15')]=_0x1e0ecd[_0x20e2('0x1e')];}logger[_0x20e2('0xf')]('['+[_0x2fde27[_0x20e2('0x12')]()]+_0x20e2('0x1f'),_0x1e0ecd);_0x45a622(_0x1e0ecd);})[_0x20e2('0x11')](function(_0x5eeaee){logger[_0x20e2('0x20')]('['+[_0x2fde27[_0x20e2('0x12')]()]+']',_0x5eeaee['message']);_0x42bc31(_0x5eeaee[_0x20e2('0x13')]);});}else{logger[_0x20e2('0xf')]('['+[_0x2fde27['toUpperCase']()]+_0x20e2('0x21'));_0x1e0ecd[_0x20e2('0x1d')]=_0x1e0ecd[_0x20e2('0xe')];_0x1e0ecd[_0x20e2('0x15')]=_0x1e0ecd['adminEmail'];_0x45a622(_0x1e0ecd);}});};}function createEndUser(_0x2f45b9,_0x23853f,_0x2cc4dd,_0x2b1c61,_0x533842){logger['info']('['+[_0x2f45b9[_0x20e2('0x12')]()]+_0x20e2('0x22'),_0x2cc4dd);return new Promise(function(_0x5d5dd0,_0x2eab75){var _0x5b73bd={'method':'POST','uri':_0x2b1c61+_0x20e2('0x23')+_0x533842,'body':{'user_name':_0x2cc4dd['endUserNumber'],'roles':'user','first_name':_0x2cc4dd[_0x20e2('0x24')],'active':_0x20e2('0x1b'),'date_format':_0x20e2('0x25'),'phone':_0x2cc4dd['endUserNumber']},'auth':_0x23853f,'json':!![]};return rp(_0x5b73bd)[_0x20e2('0xb')](function(_0x11cf87){logger[_0x20e2('0xf')]('['+[_0x2f45b9['toUpperCase']()]+'],\x20EndUser\x20schema',_0x11cf87[_0x20e2('0xc')]);_0x2cc4dd[_0x20e2('0x26')]=_0x11cf87[_0x20e2('0xc')][_0x20e2('0x1c')];_0x5d5dd0(_0x2cc4dd);})['catch'](function(_0x59ef40){logger[_0x20e2('0x20')]('['+[_0x2f45b9[_0x20e2('0x12')]()]+']',_0x59ef40[_0x20e2('0x13')]);_0x2eab75(_0x59ef40[_0x20e2('0x13')]);});});}function getEndUser(_0x13c82f,_0x3bfdde,_0x2e55c8,_0x59b6a5,_0x1684d1){return function(_0x3211f2){logger[_0x20e2('0xf')]('['+[_0x13c82f[_0x20e2('0x12')]()]+_0x20e2('0x27'),_0x3211f2);return new Promise(function(_0x3a8006,_0x122ba1){var _0x6f4c37={'method':_0x20e2('0x16'),'uri':_0x2e55c8+_0x20e2('0x28')+_0x3211f2[_0x20e2('0x24')]+'&'+_0x59b6a5+'&'+_0x1684d1,'auth':_0x3bfdde,'json':!![]};return rp(_0x6f4c37)[_0x20e2('0xb')](function(_0x229279){if(_0x229279[_0x20e2('0xc')][_0x20e2('0xd')]>0x0){_0x3211f2[_0x20e2('0x26')]=_0x229279[_0x20e2('0xc')][0x0][_0x20e2('0x1c')];logger[_0x20e2('0xf')]('['+[_0x13c82f[_0x20e2('0x12')]()]+_0x20e2('0x29'),_0x3211f2);_0x3a8006(_0x3211f2);}else{return createEndUser(_0x13c82f,_0x3bfdde,_0x3211f2,_0x2e55c8,_0x59b6a5)[_0x20e2('0xb')](function(_0x354392){logger[_0x20e2('0xf')]('['+[_0x13c82f[_0x20e2('0x12')]()]+_0x20e2('0x2a'),_0x354392);_0x3a8006(_0x354392);});}})[_0x20e2('0x11')](function(_0x31deff){logger['error']('['+[_0x13c82f[_0x20e2('0x12')]()]+']',_0x31deff['message']);_0x122ba1(_0x31deff[_0x20e2('0x13')]);});});};}function getCustomFields(_0x256ddd,_0x264962){var _0x5f2f4c={};if(_0x256ddd[_0x20e2('0xd')]>0x0){_['forEach'](_0x256ddd,function(_0x1d19d0){if(_[_0x20e2('0x2b')]([_0x20e2('0x2c'),_0x20e2('0x2d')],_0x1d19d0['type'])&&_0x1d19d0[_0x20e2('0x2e')]&&!_0x1d19d0[_0x20e2('0x2f')]){_0x5f2f4c[_0x1d19d0[_0x20e2('0x2e')][_0x20e2('0x30')]()]=_0x1d19d0['content']['toString']();}else if(_['includes'](['string',_0x20e2('0x2d')],_0x1d19d0[_0x20e2('0x31')])&&_0x1d19d0[_0x20e2('0x32')]&&_0x1d19d0[_0x20e2('0x2f')]){_0x5f2f4c[_0x1d19d0[_0x20e2('0x32')][_0x20e2('0x30')]()]=_0x1d19d0[_0x20e2('0x33')][_0x20e2('0x34')]();}else if(_0x1d19d0[_0x20e2('0x31')]===_0x20e2('0x35')&&_0x1d19d0[_0x20e2('0x36')]&&_0x1d19d0['idField']&&_0x1d19d0[_0x20e2('0x2f')]){_0x5f2f4c[_0x1d19d0[_0x20e2('0x32')][_0x20e2('0x30')]()]=_0x264962[_0x1d19d0[_0x20e2('0x36')]][_0x20e2('0x34')]();}else if(_0x1d19d0['type']==='customVariable'&&_0x1d19d0[_0x20e2('0x37')]&&_0x1d19d0[_0x20e2('0x37')][_0x20e2('0x38')]&&_0x1d19d0[_0x20e2('0x32')]&&_0x1d19d0['customField']){_0x5f2f4c[_0x1d19d0[_0x20e2('0x32')][_0x20e2('0x30')]()]=_0x264962[_0x1d19d0[_0x20e2('0x37')]['name']['toLowerCase']()][_0x20e2('0x34')]();}});}return _0x5f2f4c;}function getTicket(_0x260cfa,_0x10feaa,_0x365e94,_0x40d99a,_0x4fb19e,_0x178f87){return function(_0x4c5642){logger[_0x20e2('0xf')]('['+[_0x260cfa['toUpperCase']()]+_0x20e2('0x39'),_0x4c5642);return new Promise(function(_0x29139c,_0x138eb1){var _0x561880=_0x260cfa[_0x20e2('0x30')]()===_0x20e2('0x3a')?_0x4c5642[_0x20e2('0x1d')]:_0x4c5642[_0x20e2('0x26')];var _0x2c3d27={'method':_0x20e2('0x3b'),'uri':_0x365e94+_0x20e2('0x3c')+'?'+_0x178f87,'body':Object['assign']({},{'active':_0x20e2('0x1b'),'caller_id':_0x561880,'assigned_to':_0x4c5642[_0x20e2('0x1d')],'short_description':intUtil[_0x20e2('0x3d')](_0x40d99a[_0x20e2('0x3e')],_0x4fb19e,'\x20'),'description':intUtil['getString'](_0x40d99a[_0x20e2('0x3f')],_0x4fb19e,'\x0a')},getCustomFields(_0x40d99a[_0x20e2('0x40')],_0x4fb19e)),'auth':_0x10feaa,'json':!![]};return rp(_0x2c3d27)[_0x20e2('0xb')](function(_0x20f9a0){logger[_0x20e2('0xf')]('['+[_0x260cfa[_0x20e2('0x12')]()]+_0x20e2('0x41'),_0x20f9a0[_0x20e2('0xc')]);_0x4c5642[_0x20e2('0x42')]=_0x20f9a0['result']['sys_id'];_0x4c5642[_0x20e2('0x43')]=_0x20f9a0[_0x20e2('0xc')]['number'];logger[_0x20e2('0xf')]('['+[_0x260cfa['toUpperCase']()]+_0x20e2('0x44'),_0x4c5642);_0x29139c(_0x4c5642);})[_0x20e2('0x11')](function(_0x4f4428){logger[_0x20e2('0x20')]('['+[_0x260cfa[_0x20e2('0x12')]()]+']',_0x4f4428[_0x20e2('0x13')]);_0x138eb1(_0x4f4428['message']);});});};}function createRemoteTag(_0x4cb95b,_0x51a469,_0x1e7c09,_0x9f1ab8){return new Promise(function(_0x2ffde7,_0x34be04){var _0x2c7dd6={'method':_0x20e2('0x3b'),'uri':_0x1e7c09+_0x20e2('0x45')+'?'+_0x9f1ab8,'body':{'short_description':_0x4cb95b,'global':!![],'active':!![],'name':_0x4cb95b},'auth':_0x51a469,'json':!![]};return rp(_0x2c7dd6)[_0x20e2('0xb')](function(_0x1c7f6b){var _0x96ea3e=_0x1c7f6b[_0x20e2('0xc')][_0x20e2('0x1c')];_0x2ffde7(_0x96ea3e);});});}function getRemoteTag(_0x588751,_0x2bd3cb,_0x4b3338,_0x2580dc,_0x1f480d){return new Promise(function(_0x4a5a69,_0x41d740){var _0x1d96cb={'method':_0x20e2('0x16'),'uri':_0x4b3338+_0x20e2('0x45')+'?sysparm_query=name%3D'+_0x588751+'&'+_0x2580dc,'auth':_0x2bd3cb,'json':!![]};return rp(_0x1d96cb)[_0x20e2('0xb')](function(_0x57cdfe){if(_0x57cdfe[_0x20e2('0xc')]['length']>0x0){var _0x324d83=_0x57cdfe['result'][0x0][_0x20e2('0x1c')];_0x4a5a69(_0x324d83);}else{return createRemoteTag(_0x588751,_0x2bd3cb,_0x4b3338,_0x2580dc)[_0x20e2('0xb')](function(_0x38a445){_0x4a5a69(_0x38a445);});}});});}function assignTagToIncident(_0x24b65a,_0x438564,_0x35530a,_0x3608bc,_0x111dc5){return new Promise(function(_0x13a15a,_0x55e26f){var _0x4e8e41={'method':_0x20e2('0x3b'),'uri':_0x35530a+_0x20e2('0x46')+'?'+_0x111dc5,'body':{'label':_0x24b65a,'table':_0x20e2('0x3c'),'id_type':'Incident','table_key':_0x3608bc[_0x20e2('0x42')],'title':_0x20e2('0x47')+_0x3608bc['ticketNumber'],'id_display':_0x3608bc[_0x20e2('0x43')]},'auth':_0x438564,'json':!![]};return rp(_0x4e8e41)[_0x20e2('0xb')](function(_0x56a48f){_0x13a15a();})['catch'](function(){_0x13a15a();});});}function manageTags(_0x2c450f,_0x449a38,_0x1f8300,_0x1a8bbf,_0x324b62,_0x1183e5,_0x2c0db0){return new Promise(function(_0x42ec86,_0x4a3350){var _0xf6a2b1=[];_0x449a38[_0x20e2('0x48')](function(_0x25f871){_0xf6a2b1[_0x20e2('0x49')](getRemoteTag(_0x25f871,_0x1f8300,_0x1a8bbf,_0x1183e5,_0x2c0db0));});return Promise['all'](_0xf6a2b1)['then'](function(_0x230970){if(_0x230970[_0x20e2('0xd')]){logger['info']('['+[_0x2c450f[_0x20e2('0x12')]()]+_0x20e2('0x4a'),_0x230970);var _0x1b4c89=[];_0x230970[_0x20e2('0x48')](function(_0x1ce2b9){_0x1b4c89[_0x20e2('0x49')](assignTagToIncident(_0x1ce2b9,_0x1f8300,_0x1a8bbf,_0x324b62,_0x1183e5));});return Promise[_0x20e2('0x4b')](_0x1b4c89)['then'](function(){_0x42ec86();})[_0x20e2('0x11')](function(){_0x42ec86();});}else{_0x42ec86();}});});}function getTags(_0x399305,_0x48d557,_0x4e8f94,_0x58b8c1,_0xdaa330,_0x2cd507){return function(_0x12a508){return new Promise(function(_0x2d4715,_0x4da962){var _0x250d56=[];var _0x33f235=_0x58b8c1[_0x20e2('0x4c')];if(_0x33f235&&_0x33f235[_0x20e2('0xd')]>0x0){_0x250d56=_[_0x20e2('0x4d')](_0x33f235,_0x20e2('0x38'));}if(_0x250d56[_0x20e2('0xd')]>0x0){return manageTags(_0x399305,_0x250d56,_0x48d557,_0x4e8f94,_0x12a508,_0xdaa330,_0x2cd507)[_0x20e2('0xb')](function(){_0x2d4715(_0x12a508);});}else{_0x2d4715(_0x12a508);}});};}function emit(_0x4bbd54,_0x1dc6c4,_0x4d79b8){var _0x3ddb05=_0x20e2('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x20e2('0x4f');var _0x4be75a={'uri':_0x4bbd54+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4d79b8+_0x3ddb05};io['to'](util[_0x20e2('0x50')]('user:%s',_0x1dc6c4))[_0x20e2('0x51')]('trigger:browser:url',_0x4be75a);}exports['cs']=function(_0x5abc57,_0x4fc6ad,_0x2cccf5,_0x5c1058,_0x204abf,_0x1127df,_0x5d216c,_0x3d2994){var _0x350183={};var _0x119be0={'user':_0x1127df[_0x20e2('0x52')],'pass':_0x1127df[_0x20e2('0x53')]};var _0x31195d=_0x20e2('0x54');var _0x51914e=_0x20e2('0x55');_0x1127df[_0x20e2('0x56')]=intUtil[_0x20e2('0x57')](_0x1127df[_0x20e2('0x56')]);_0x1127df['serverUrl']=intUtil['stripTrailingSlash'](_0x1127df['serverUrl']);var _0x13003a=util[_0x20e2('0x50')](_0x20e2('0x58'),_0x1127df[_0x20e2('0x56')]);_0x350183['userEmail']=!_[_0x20e2('0x59')](_0x5c1058)?_0x5c1058[_0x20e2('0x5a')]:null;_0x350183['adminEmail']=_0x1127df[_0x20e2('0x5a')];_0x350183[_0x20e2('0x24')]=_0x3d2994[_0x20e2('0x30')]()==='outbound'?_0x4fc6ad[_0x20e2('0x5b')]:_0x4fc6ad[_0x20e2('0x5c')];_0x350183[_0x20e2('0x5d')]=_0x3d2994===_0x20e2('0x5e')||_0x3d2994===_0x20e2('0x5f')?_0x20e2('0x5e'):_0x20e2('0x3a');var _0x41c229=util[_0x20e2('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1127df[_0x20e2('0x60')],_0x4fc6ad['uniqueid'],md5(_0x4fc6ad['uniqueid']));if(_0x204abf&&_0x204abf[_0x20e2('0x61')]){logger[_0x20e2('0xf')](_0x20e2('0x62'),'Recording\x20is\x20enabled!');_0x4fc6ad['recordingURL']=_0x41c229;}else if(_0x5d216c&&_0x5d216c[_0x20e2('0x63')]&&_0x5d216c[_0x20e2('0x63')]!==_0x20e2('0x64')){logger[_0x20e2('0xf')](_0x20e2('0x65'),_0x20e2('0x66'));_0x4fc6ad['recordingURL']=_0x41c229;}else{_0x4fc6ad[_0x20e2('0x67')]='';}return getAdminUser(_0x3d2994,_0x119be0,_0x350183,_0x13003a,_0x51914e,_0x31195d)[_0x20e2('0xb')](getUser(_0x3d2994,_0x119be0,_0x13003a,_0x51914e,_0x31195d))[_0x20e2('0xb')](getEndUser(_0x3d2994,_0x119be0,_0x13003a,_0x51914e,_0x31195d))[_0x20e2('0xb')](getTicket(_0x3d2994,_0x119be0,_0x13003a,_0x2cccf5,_0x4fc6ad,_0x51914e))[_0x20e2('0xb')](function(_0x2ec2c6){logger[_0x20e2('0xf')](util[_0x20e2('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2ec2c6['ticketId']));logger[_0x20e2('0xf')](util[_0x20e2('0x50')](_0x20e2('0x68'),_0x3d2994));if(_0x3d2994!==_0x20e2('0x5f')){logger[_0x20e2('0xf')]('['+[_0x3d2994[_0x20e2('0x12')]()]+']',_0x20e2('0x69'));emit(_0x1127df[_0x20e2('0x56')],_0x5c1058[_0x20e2('0x38')],_0x2ec2c6['ticketId']);}})[_0x20e2('0x11')](function(_0x10f746){logger['error']('['+[_0x3d2994[_0x20e2('0x12')]()]+_0x20e2('0x6a'),util['inspect'](_0x10f746,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbfaa=['variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','push','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField'];(function(_0x2f74b0,_0x5a7c8c){var _0x1ad5ed=function(_0x3e9485){while(--_0x3e9485){_0x2f74b0['push'](_0x2f74b0['shift']());}};_0x1ad5ed(++_0x5a7c8c);}(_0xbfaa,0x1de));var _0xabfa=function(_0x1c673a,_0x4eaa6e){_0x1c673a=_0x1c673a-0x0;var _0xca51=_0xbfaa[_0x1c673a];return _0xca51;};'use strict';var _=require(_0xabfa('0x0'));var Promise=require(_0xabfa('0x1'));var rp=require('request-promise');var util=require(_0xabfa('0x2'));var md5=require(_0xabfa('0x3'));var Redis=require(_0xabfa('0x4'));var intUtil=require(_0xabfa('0x5'));var config=require(_0xabfa('0x6'));var logger=require('../../../../config/logger')(_0xabfa('0x7'));config[_0xabfa('0x8')]=_['defaults'](config[_0xabfa('0x8')],{'host':_0xabfa('0x9'),'port':0x18eb});var io=require(_0xabfa('0xa'))(new Redis(config[_0xabfa('0x8')]));function getAdminUser(_0x5f3a23,_0x13fbc6,_0x54aaa2,_0x39a842,_0x12d4ff,_0x3143c3){return new Promise(function(_0x5f4e67,_0x209e5b){var _0x493c4c={'method':'GET','uri':_0x39a842+_0xabfa('0xb')+'&'+_0x12d4ff+'&'+_0x3143c3,'auth':_0x13fbc6,'json':!![]};return rp(_0x493c4c)[_0xabfa('0xc')](function(_0x8101d8){if(_0x8101d8[_0xabfa('0xd')][_0xabfa('0xe')]>0x0){_0x54aaa2[_0xabfa('0xf')]=_0x8101d8[_0xabfa('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x5f3a23[_0xabfa('0x10')]()]+'],\x20getAdminUser\x20crm',_0x54aaa2);_0x5f4e67(_0x54aaa2);})[_0xabfa('0x11')](function(_0x2d62b0){logger[_0xabfa('0x12')]('['+[_0x5f3a23[_0xabfa('0x10')]()]+']',_0x2d62b0[_0xabfa('0x13')]);_0x209e5b(_0x2d62b0[_0xabfa('0x13')]);});});}function getUser(_0x11fbad,_0x55250f,_0x56cdcc,_0x5eb8b1,_0x151ca6){return function(_0x3f25f2){logger['info']('['+[_0x11fbad[_0xabfa('0x10')]()]+_0xabfa('0x14'),_0x3f25f2);return new Promise(function(_0x36363c,_0x270c0a){if(intUtil[_0xabfa('0x15')](_0x3f25f2[_0xabfa('0x16')])){var _0x12041a={'method':_0xabfa('0x17'),'uri':_0x56cdcc+_0xabfa('0x18')+_0x3f25f2[_0xabfa('0x16')]+'&'+_0x5eb8b1+'&'+_0x151ca6,'auth':_0x55250f,'json':!![]};logger[_0xabfa('0x19')]('['+[_0x11fbad[_0xabfa('0x10')]()]+_0xabfa('0x1a'),_0x12041a);return rp(_0x12041a)[_0xabfa('0xc')](function(_0x1c8247){logger[_0xabfa('0x19')]('['+[_0x11fbad[_0xabfa('0x10')]()]+'],\x20getUser\x20entity',_0x1c8247);if(_0x1c8247['result'][_0xabfa('0xe')]>0x0&&String(_0x1c8247['result'][0x0][_0xabfa('0x1b')])===_0xabfa('0x1c')){_0x3f25f2[_0xabfa('0x1d')]=_0x1c8247['result'][0x0][_0xabfa('0x1e')];}else{_0x3f25f2['userId']=_0x3f25f2[_0xabfa('0xf')];_0x3f25f2['userEmail']=_0x3f25f2[_0xabfa('0x1f')];}logger['info']('['+[_0x11fbad['toUpperCase']()]+_0xabfa('0x20'),_0x3f25f2);_0x36363c(_0x3f25f2);})[_0xabfa('0x11')](function(_0x342a56){logger[_0xabfa('0x12')]('['+[_0x11fbad[_0xabfa('0x10')]()]+']',_0x342a56[_0xabfa('0x13')]);_0x270c0a(_0x342a56['message']);});}else{logger[_0xabfa('0x19')]('['+[_0x11fbad['toUpperCase']()]+_0xabfa('0x21'));_0x3f25f2[_0xabfa('0x1d')]=_0x3f25f2['adminId'];_0x3f25f2['userEmail']=_0x3f25f2['adminEmail'];_0x36363c(_0x3f25f2);}});};}function createEndUser(_0x367193,_0x402ecb,_0x5d2ad2,_0x2cb925,_0x2ffccb){logger[_0xabfa('0x19')]('['+[_0x367193[_0xabfa('0x10')]()]+_0xabfa('0x22'),_0x5d2ad2);return new Promise(function(_0x3961d6,_0x8b19cc){var _0x2039f3={'method':_0xabfa('0x23'),'uri':_0x2cb925+'sys_user?'+_0x2ffccb,'body':{'user_name':_0x5d2ad2[_0xabfa('0x24')],'roles':_0xabfa('0x25'),'first_name':_0x5d2ad2[_0xabfa('0x24')],'active':_0xabfa('0x1c'),'date_format':'System','phone':_0x5d2ad2[_0xabfa('0x24')]},'auth':_0x402ecb,'json':!![]};return rp(_0x2039f3)[_0xabfa('0xc')](function(_0x11ce81){logger['info']('['+[_0x367193[_0xabfa('0x10')]()]+'],\x20EndUser\x20schema',_0x11ce81[_0xabfa('0xd')]);_0x5d2ad2[_0xabfa('0x26')]=_0x11ce81[_0xabfa('0xd')][_0xabfa('0x1e')];_0x3961d6(_0x5d2ad2);})[_0xabfa('0x11')](function(_0x23d2b9){logger['error']('['+[_0x367193[_0xabfa('0x10')]()]+']',_0x23d2b9[_0xabfa('0x13')]);_0x8b19cc(_0x23d2b9[_0xabfa('0x13')]);});});}function getEndUser(_0x59ce9f,_0x169739,_0x12f10f,_0x5cba0a,_0x22214b){return function(_0x2d1c5b){logger[_0xabfa('0x19')]('['+[_0x59ce9f[_0xabfa('0x10')]()]+_0xabfa('0x27'),_0x2d1c5b);return new Promise(function(_0xc11f09,_0xe6fe68){var _0x27f6d2={'method':_0xabfa('0x17'),'uri':_0x12f10f+_0xabfa('0x28')+_0x2d1c5b[_0xabfa('0x24')]+'&'+_0x5cba0a+'&'+_0x22214b,'auth':_0x169739,'json':!![]};return rp(_0x27f6d2)[_0xabfa('0xc')](function(_0x5c9ea5){if(_0x5c9ea5[_0xabfa('0xd')][_0xabfa('0xe')]>0x0){_0x2d1c5b[_0xabfa('0x26')]=_0x5c9ea5[_0xabfa('0xd')][0x0][_0xabfa('0x1e')];logger['info']('['+[_0x59ce9f['toUpperCase']()]+_0xabfa('0x29'),_0x2d1c5b);_0xc11f09(_0x2d1c5b);}else{return createEndUser(_0x59ce9f,_0x169739,_0x2d1c5b,_0x12f10f,_0x5cba0a)['then'](function(_0x3ac5e1){logger['info']('['+[_0x59ce9f[_0xabfa('0x10')]()]+'],\x20createEndUser\x20crm',_0x3ac5e1);_0xc11f09(_0x3ac5e1);});}})[_0xabfa('0x11')](function(_0x42d9d9){logger['error']('['+[_0x59ce9f['toUpperCase']()]+']',_0x42d9d9[_0xabfa('0x13')]);_0xe6fe68(_0x42d9d9[_0xabfa('0x13')]);});});};}function getCustomFields(_0x50f4ae,_0x4d6f43){var _0x3cdb07={};if(_0x50f4ae['length']>0x0){_['forEach'](_0x50f4ae,function(_0x2f33ae){if(_['includes']([_0xabfa('0x2a'),_0xabfa('0x2b')],_0x2f33ae[_0xabfa('0x2c')])&&_0x2f33ae[_0xabfa('0x2d')]&&!_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae[_0xabfa('0x2d')][_0xabfa('0x2f')]()]=_0x2f33ae[_0xabfa('0x30')][_0xabfa('0x31')]();}else if(_[_0xabfa('0x32')]([_0xabfa('0x2a'),_0xabfa('0x2b')],_0x2f33ae[_0xabfa('0x2c')])&&_0x2f33ae[_0xabfa('0x33')]&&_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae[_0xabfa('0x33')]['toLowerCase']()]=_0x2f33ae['content']['toString']();}else if(_0x2f33ae[_0xabfa('0x2c')]===_0xabfa('0x34')&&_0x2f33ae[_0xabfa('0x35')]&&_0x2f33ae['idField']&&_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae['idField'][_0xabfa('0x2f')]()]=_0x4d6f43[_0x2f33ae[_0xabfa('0x35')]][_0xabfa('0x31')]();}else if(_0x2f33ae[_0xabfa('0x2c')]===_0xabfa('0x36')&&_0x2f33ae['Variable']&&_0x2f33ae[_0xabfa('0x37')][_0xabfa('0x38')]&&_0x2f33ae[_0xabfa('0x33')]&&_0x2f33ae[_0xabfa('0x2e')]){_0x3cdb07[_0x2f33ae[_0xabfa('0x33')][_0xabfa('0x2f')]()]=_0x4d6f43[_0x2f33ae[_0xabfa('0x37')][_0xabfa('0x38')][_0xabfa('0x2f')]()][_0xabfa('0x31')]();}});}return _0x3cdb07;}function getTicket(_0x1c15d8,_0x11488e,_0xd09c3f,_0x33b69a,_0x727d4b,_0x466b04){return function(_0x3563a9){logger[_0xabfa('0x19')]('['+[_0x1c15d8[_0xabfa('0x10')]()]+_0xabfa('0x39'),_0x3563a9);return new Promise(function(_0x34399f,_0x6ccca){var _0x130fb5=_0x1c15d8[_0xabfa('0x2f')]()===_0xabfa('0x3a')?_0x3563a9[_0xabfa('0x1d')]:_0x3563a9[_0xabfa('0x26')];var _0x13c614={'method':_0xabfa('0x23'),'uri':_0xd09c3f+'incident'+'?'+_0x466b04,'body':Object['assign']({},{'active':_0xabfa('0x1c'),'caller_id':_0x130fb5,'assigned_to':_0x3563a9[_0xabfa('0x1d')],'short_description':intUtil[_0xabfa('0x3b')](_0x33b69a[_0xabfa('0x3c')],_0x727d4b,'\x20'),'description':intUtil[_0xabfa('0x3b')](_0x33b69a['Descriptions'],_0x727d4b,'\x0a')},getCustomFields(_0x33b69a[_0xabfa('0x3d')],_0x727d4b)),'auth':_0x11488e,'json':!![]};return rp(_0x13c614)[_0xabfa('0xc')](function(_0x562ca6){logger[_0xabfa('0x19')]('['+[_0x1c15d8['toUpperCase']()]+_0xabfa('0x3e'),_0x562ca6['result']);_0x3563a9['ticketId']=_0x562ca6[_0xabfa('0xd')][_0xabfa('0x1e')];_0x3563a9[_0xabfa('0x3f')]=_0x562ca6['result']['number'];logger[_0xabfa('0x19')]('['+[_0x1c15d8['toUpperCase']()]+']\x20getTicket\x20crm',_0x3563a9);_0x34399f(_0x3563a9);})[_0xabfa('0x11')](function(_0x379aab){logger[_0xabfa('0x12')]('['+[_0x1c15d8[_0xabfa('0x10')]()]+']',_0x379aab[_0xabfa('0x13')]);_0x6ccca(_0x379aab['message']);});});};}function createRemoteTag(_0x4dbc01,_0x5c9bbc,_0x3c849e,_0x451441){return new Promise(function(_0x2a5176,_0x4a9db0){var _0x744ab8={'method':_0xabfa('0x23'),'uri':_0x3c849e+_0xabfa('0x40')+'?'+_0x451441,'body':{'short_description':_0x4dbc01,'global':!![],'active':!![],'name':_0x4dbc01},'auth':_0x5c9bbc,'json':!![]};return rp(_0x744ab8)[_0xabfa('0xc')](function(_0x291528){var _0x1bb54c=_0x291528[_0xabfa('0xd')][_0xabfa('0x1e')];_0x2a5176(_0x1bb54c);});});}function getRemoteTag(_0x509e81,_0x447789,_0x856785,_0x2ed565,_0x3527b9){return new Promise(function(_0x39b48b,_0x5c9cad){var _0x2bcff8={'method':'GET','uri':_0x856785+_0xabfa('0x40')+_0xabfa('0x41')+_0x509e81+'&'+_0x2ed565,'auth':_0x447789,'json':!![]};return rp(_0x2bcff8)['then'](function(_0x5b23db){if(_0x5b23db['result']['length']>0x0){var _0x3eb2e1=_0x5b23db['result'][0x0][_0xabfa('0x1e')];_0x39b48b(_0x3eb2e1);}else{return createRemoteTag(_0x509e81,_0x447789,_0x856785,_0x2ed565)['then'](function(_0x40d5ac){_0x39b48b(_0x40d5ac);});}});});}function assignTagToIncident(_0x1e7864,_0x2a9dc2,_0x5642bf,_0x44fd16,_0x23a764){return new Promise(function(_0x20efa8,_0x97bba8){var _0x5275b7={'method':_0xabfa('0x23'),'uri':_0x5642bf+_0xabfa('0x42')+'?'+_0x23a764,'body':{'label':_0x1e7864,'table':_0xabfa('0x43'),'id_type':_0xabfa('0x44'),'table_key':_0x44fd16['ticketId'],'title':_0xabfa('0x45')+_0x44fd16[_0xabfa('0x3f')],'id_display':_0x44fd16[_0xabfa('0x3f')]},'auth':_0x2a9dc2,'json':!![]};return rp(_0x5275b7)[_0xabfa('0xc')](function(_0x2b806e){_0x20efa8();})[_0xabfa('0x11')](function(){_0x20efa8();});});}function manageTags(_0x53acf7,_0x3c03d5,_0x2a74cc,_0x151c03,_0xdd1acf,_0x5d6fae,_0x177cc6){return new Promise(function(_0x47345e,_0x5ea5c1){var _0x226e4d=[];_0x3c03d5['forEach'](function(_0x18681f){_0x226e4d['push'](getRemoteTag(_0x18681f,_0x2a74cc,_0x151c03,_0x5d6fae,_0x177cc6));});return Promise[_0xabfa('0x46')](_0x226e4d)[_0xabfa('0xc')](function(_0x4f0f4b){if(_0x4f0f4b['length']){logger['info']('['+[_0x53acf7['toUpperCase']()]+_0xabfa('0x47'),_0x4f0f4b);var _0x51d3de=[];_0x4f0f4b[_0xabfa('0x48')](function(_0x5913e1){_0x51d3de[_0xabfa('0x49')](assignTagToIncident(_0x5913e1,_0x2a74cc,_0x151c03,_0xdd1acf,_0x5d6fae));});return Promise[_0xabfa('0x46')](_0x51d3de)[_0xabfa('0xc')](function(){_0x47345e();})[_0xabfa('0x11')](function(){_0x47345e();});}else{_0x47345e();}});});}function getTags(_0x4254ac,_0x7339d,_0x4ca266,_0x5f39e1,_0x5319b9,_0x50d8f1){return function(_0x4fc3e1){return new Promise(function(_0x2cafae,_0x548647){var _0x33a7d7=[];var _0x3e9c45=_0x5f39e1[_0xabfa('0x4a')];if(_0x3e9c45&&_0x3e9c45['length']>0x0){_0x33a7d7=_[_0xabfa('0x4b')](_0x3e9c45,_0xabfa('0x38'));}if(_0x33a7d7[_0xabfa('0xe')]>0x0){return manageTags(_0x4254ac,_0x33a7d7,_0x7339d,_0x4ca266,_0x4fc3e1,_0x5319b9,_0x50d8f1)[_0xabfa('0xc')](function(){_0x2cafae(_0x4fc3e1);});}else{_0x2cafae(_0x4fc3e1);}});};}function emit(_0x1124ed,_0x5d2f57,_0x2f385c){var _0x213521=_0xabfa('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xabfa('0x4d');var _0x4cbb3d={'uri':_0x1124ed+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2f385c+_0x213521};io['to'](util[_0xabfa('0x4e')](_0xabfa('0x4f'),_0x5d2f57))[_0xabfa('0x50')]('trigger:browser:url',_0x4cbb3d);}exports['cs']=function(_0x57683a,_0x57c4bc,_0x1fdca9,_0x14ded9,_0x64fd8a,_0x13dbe6,_0xd9f4c2,_0x2877a){var _0x550dd4={};var _0x157942={'user':_0x13dbe6[_0xabfa('0x51')],'pass':_0x13dbe6[_0xabfa('0x52')]};var _0x4023a4=_0xabfa('0x53');var _0x1b643c=_0xabfa('0x54');_0x13dbe6[_0xabfa('0x55')]=intUtil[_0xabfa('0x56')](_0x13dbe6[_0xabfa('0x55')]);_0x13dbe6[_0xabfa('0x57')]=intUtil['stripTrailingSlash'](_0x13dbe6[_0xabfa('0x57')]);var _0x34568a=util['format'](_0xabfa('0x58'),_0x13dbe6['remoteUri']);_0x550dd4['userEmail']=!_[_0xabfa('0x59')](_0x14ded9)?_0x14ded9['email']:null;_0x550dd4['adminEmail']=_0x13dbe6[_0xabfa('0x5a')];_0x550dd4[_0xabfa('0x24')]=_0x2877a['toLowerCase']()===_0xabfa('0x3a')?_0x57c4bc[_0xabfa('0x5b')]:_0x57c4bc['calleridnum'];_0x550dd4[_0xabfa('0x5c')]=_0x2877a===_0xabfa('0x5d')||_0x2877a===_0xabfa('0x5e')?_0xabfa('0x5d'):_0xabfa('0x3a');var _0x214954=util[_0xabfa('0x4e')](_0xabfa('0x5f'),_0x13dbe6[_0xabfa('0x57')],_0x57c4bc['uniqueid'],md5(_0x57c4bc[_0xabfa('0x60')]));if(_0x64fd8a&&_0x64fd8a[_0xabfa('0x61')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x57c4bc[_0xabfa('0x62')]=_0x214954;}else if(_0xd9f4c2&&_0xd9f4c2['recordingFormat']&&_0xd9f4c2['recordingFormat']!=='none'){logger[_0xabfa('0x19')]('[OUTBOUND]',_0xabfa('0x63'));_0x57c4bc[_0xabfa('0x62')]=_0x214954;}else{_0x57c4bc[_0xabfa('0x62')]='';}return getAdminUser(_0x2877a,_0x157942,_0x550dd4,_0x34568a,_0x1b643c,_0x4023a4)[_0xabfa('0xc')](getUser(_0x2877a,_0x157942,_0x34568a,_0x1b643c,_0x4023a4))[_0xabfa('0xc')](getEndUser(_0x2877a,_0x157942,_0x34568a,_0x1b643c,_0x4023a4))[_0xabfa('0xc')](getTicket(_0x2877a,_0x157942,_0x34568a,_0x1fdca9,_0x57c4bc,_0x1b643c))['then'](function(_0x52f28a){logger[_0xabfa('0x19')](util['format'](_0xabfa('0x64'),_0x52f28a[_0xabfa('0x65')]));logger[_0xabfa('0x19')](util[_0xabfa('0x4e')](_0xabfa('0x66'),_0x2877a));if(_0x2877a!==_0xabfa('0x5e')){logger[_0xabfa('0x19')]('['+[_0x2877a['toUpperCase']()]+']',_0xabfa('0x67'));emit(_0x13dbe6['remoteUri'],_0x14ded9[_0xabfa('0x38')],_0x52f28a[_0xabfa('0x65')]);}})[_0xabfa('0x11')](function(_0x270056){logger['error']('['+[_0x2877a['toUpperCase']()]+_0xabfa('0x68'),util[_0xabfa('0x69')](_0x270056,{'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 a546bae..ec18fa7 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 _0xc3a1=['value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','type','nameField','customField','content','string','variable','custom_fields','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','unmanaged','lastevent','toUpperCase','calleridname','Ticket\x20created!','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name'];(function(_0xa1dcbd,_0x39a535){var _0x5a20dc=function(_0x33c40f){while(--_0x33c40f){_0xa1dcbd['push'](_0xa1dcbd['shift']());}};_0x5a20dc(++_0x39a535);}(_0xc3a1,0x1c8));var _0x1c3a=function(_0x4e2f33,_0x394e16){_0x4e2f33=_0x4e2f33-0x0;var _0x4fc406=_0xc3a1[_0x4e2f33];return _0x4fc406;};'use strict';var _=require(_0x1c3a('0x0'));var rp=require('request-promise');var BPromise=require(_0x1c3a('0x1'));var md5=require('md5');var util=require(_0x1c3a('0x2'));var Redis=require(_0x1c3a('0x3'));var intUtil=require(_0x1c3a('0x4'));var config=require(_0x1c3a('0x5'));var logger=require(_0x1c3a('0x6'))(_0x1c3a('0x7'));config[_0x1c3a('0x8')]=_[_0x1c3a('0x9')](config['redis'],{'host':_0x1c3a('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1c3a('0x8')]));var def={'method':_0x1c3a('0xb'),'json':!![]};function emit(_0x449f79,_0x2a474d,_0x45f982){io['to'](_0x449f79)[_0x1c3a('0xc')](_0x2a474d,_0x45f982);}function getTicket(_0x3f6a75,_0x2e2cf6,_0x2d0833,_0x4d90b1,_0x239509,_0xf16c8d,_0x495b2a,_0x3d3ba1){logger[_0x1c3a('0xd')](_0x1c3a('0xe'));var _0x4f70ec=new Date();var _0x557782=[{'name':'name','value':intUtil[_0x1c3a('0xf')](_0x4d90b1[_0x1c3a('0x10')],_0x239509,'\x20')},{'name':_0x1c3a('0x11'),'value':_0x2e2cf6['id']},{'name':_0x1c3a('0x12'),'value':_0x2e2cf6['id']},{'name':_0x1c3a('0x13'),'value':intUtil[_0x1c3a('0xf')](_0x4d90b1[_0x1c3a('0x14')],_0x239509,'\x0a')},{'name':_0x1c3a('0x15'),'value':_0x4f70ec[_0x1c3a('0x16')]()['slice'](0x0,0x13)[_0x1c3a('0x17')]('T','\x20')},{'name':_0x1c3a('0x18'),'value':'0'},{'name':_0x1c3a('0x19'),'value':'15'},{'name':_0x1c3a('0x1a'),'value':_0x2d0833['id']},{'name':'parent_type','value':_0x1c3a('0x1b')},{'name':_0x1c3a('0x1c'),'value':_0x2d0833[_0x1c3a('0x1d')]},{'name':_0x1c3a('0x1e'),'value':_0x3d3ba1}];if(_0xf16c8d[_0x1c3a('0x1f')]){_[_0x1c3a('0x20')](_0xf16c8d,function(_0x2bac6e){if(_0x239509[_0x2bac6e[_0x1c3a('0x21')]]){_0x557782[_0x1c3a('0x22')]({'name':_0x2bac6e[_0x1c3a('0x23')],'value':_0x239509[_0x2bac6e[_0x1c3a('0x21')]]});}});}return request({'form':{'method':_0x1c3a('0x24'),'input_type':'JSON','response_type':_0x1c3a('0x25'),'rest_data':JSON[_0x1c3a('0x26')]({'session':_0x495b2a['id'],'module_name':_0x1c3a('0x27'),'name_value_list':_0x557782})}});}function getAuth(_0x27ae3f){return util[_0x1c3a('0x28')](_0x1c3a('0x29'),new Buffer(_0x27ae3f[_0x1c3a('0x2a')]+':X')[_0x1c3a('0x2b')](_0x1c3a('0x2c')));}function getServerInfo(_0x3eb67c){return request({'form':{'method':_0x1c3a('0x2d'),'input_type':_0x1c3a('0x25'),'response_type':_0x1c3a('0x25'),'rest_data':JSON[_0x1c3a('0x26')]({'session':_0x3eb67c['id']})}});}function getUser(_0x13f4ed,_0x52f2ce,_0x47f46b){if(!_[_0x1c3a('0x2e')](_0x52f2ce)){logger[_0x1c3a('0xd')](_0x1c3a('0x2f'),_0x52f2ce);return request({'form':{'method':_0x1c3a('0x30'),'input_type':_0x1c3a('0x25'),'response_type':_0x1c3a('0x25'),'rest_data':JSON[_0x1c3a('0x26')]({'session':_0x47f46b['id'],'module_name':_0x1c3a('0x31'),'query':util[_0x1c3a('0x28')](_0x1c3a('0x32'),_0x52f2ce),'order_by':'','offset':'0','select_fields':['id',_0x1c3a('0x1d'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1c3a('0x33')](function(_0x2f8bd1){if(_0x2f8bd1[_0x1c3a('0x34')]['length']){var _0x1ceb84=_[_0x1c3a('0x35')](_0x2f8bd1[_0x1c3a('0x34')],function(_0x1d6a8c){return _0x1d6a8c[_0x1c3a('0x36')][_0x1c3a('0x37')][_0x1c3a('0x38')]===_0x52f2ce;});if(_0x1ceb84){logger[_0x1c3a('0xd')](_0x1c3a('0x39'));return BPromise[_0x1c3a('0x3a')]({'id':_0x1ceb84[_0x1c3a('0x36')]['id'][_0x1c3a('0x38')],'name':_0x1ceb84[_0x1c3a('0x36')][_0x1c3a('0x1d')][_0x1c3a('0x38')]});}}logger[_0x1c3a('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1c3a('0x3a')]({'id':_0x47f46b[_0x1c3a('0x36')][_0x1c3a('0x3b')]['value'],'name':_0x47f46b[_0x1c3a('0x36')][_0x1c3a('0x37')]['value']});});}else{logger[_0x1c3a('0xd')](_0x1c3a('0x3c'));return BPromise[_0x1c3a('0x3a')]({'id':_0x47f46b['name_value_list'][_0x1c3a('0x3b')][_0x1c3a('0x38')],'name':_0x47f46b[_0x1c3a('0x36')][_0x1c3a('0x37')][_0x1c3a('0x38')]});}}function getEndUser(_0x235fb7,_0x3e09a8,_0x2e3156,_0x381c36){logger['info'](_0x1c3a('0x3d'),_0x2e3156);return request({'form':{'method':'get_entry_list','input_type':_0x1c3a('0x25'),'response_type':'JSON','rest_data':JSON[_0x1c3a('0x26')]({'session':_0x381c36['id'],'module_name':_0x1c3a('0x1b'),'query':util['format'](_0x1c3a('0x3e'),_0x2e3156),'order_by':'','offset':'0','select_fields':['id',_0x1c3a('0x1d'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1c3a('0x33')](function(_0x5166e8){if(_0x5166e8['entry_list']['length']){var _0x4a324d=_['find'](_0x5166e8[_0x1c3a('0x34')],function(_0x1ad07e){return _0x1ad07e[_0x1c3a('0x36')][_0x1c3a('0x3f')][_0x1c3a('0x38')]===_0x2e3156;});if(_0x4a324d){logger[_0x1c3a('0xd')](_0x1c3a('0x40'));return BPromise[_0x1c3a('0x3a')]({'id':_0x4a324d[_0x1c3a('0x36')]['id'][_0x1c3a('0x38')],'name':_0x4a324d[_0x1c3a('0x36')][_0x1c3a('0x1d')]['value'],'phone':_0x4a324d[_0x1c3a('0x36')][_0x1c3a('0x3f')][_0x1c3a('0x38')]});}}else{logger[_0x1c3a('0xd')](_0x1c3a('0x41'));return request({'form':{'method':_0x1c3a('0x24'),'input_type':_0x1c3a('0x25'),'response_type':_0x1c3a('0x25'),'rest_data':JSON[_0x1c3a('0x26')]({'session':_0x381c36['id'],'module_name':_0x1c3a('0x1b'),'name_value_list':[{'name':_0x1c3a('0x42'),'value':_0x3e09a8!==_0x1c3a('0x43')?_0x3e09a8:util[_0x1c3a('0x28')](_0x1c3a('0x44'),_0x2e3156)},{'name':_0x1c3a('0x3f'),'value':_0x2e3156}]})}})[_0x1c3a('0x33')](function(_0x1b23ca){logger[_0x1c3a('0xd')](_0x1c3a('0x45'));return BPromise[_0x1c3a('0x3a')]({'id':_0x1b23ca['id'],'name':_0x1b23ca[_0x1c3a('0x34')][_0x1c3a('0x42')]['value'],'phone':_0x1b23ca['entry_list'][_0x1c3a('0x3f')]['value']});});}});}function request(_0x5945ae){logger[_0x1c3a('0x46')]('[HTTP]',JSON[_0x1c3a('0x26')](_0x5945ae));return rp(_['merge'](def,_0x5945ae));}function getTags(_0x4f414c,_0x1ca109){var _0x2e6a60=[];if(_0x4f414c&&_0x4f414c['length']>0x0){_0x2e6a60=_['map'](_0x4f414c,_0x1ca109);}return _0x2e6a60;}function getCustomFields(_0x23ff56,_0x8e541b){var _0x2b1205=[];var _0x17b22f={'custom_fields':[]};if(_0x23ff56[_0x1c3a('0x1f')]>0x0){_[_0x1c3a('0x20')](_0x23ff56,function(_0x3bf065){if(_0x3bf065[_0x1c3a('0x47')]==='string'&&_0x3bf065[_0x1c3a('0x48')]&&!_0x3bf065[_0x1c3a('0x49')]){_0x17b22f[_0x3bf065[_0x1c3a('0x48')]['toLowerCase']()]=_0x3bf065[_0x1c3a('0x4a')]['toString']();}else if(_0x3bf065['type']===_0x1c3a('0x4b')&&_0x3bf065[_0x1c3a('0x23')]&&_0x3bf065[_0x1c3a('0x49')]){_0x17b22f['custom_fields'][_0x1c3a('0x22')]({'id':_0x3bf065[_0x1c3a('0x23')],'value':_0x3bf065[_0x1c3a('0x4a')][_0x1c3a('0x2b')]()});}else if(_0x3bf065['type']===_0x1c3a('0x4c')&&_0x3bf065[_0x1c3a('0x21')]&&_0x3bf065[_0x1c3a('0x23')]&&_0x3bf065[_0x1c3a('0x49')]){_0x8e541b[_0x3bf065[_0x1c3a('0x21')]]&&_0x17b22f[_0x1c3a('0x4d')]['push']({'id':_0x3bf065[_0x1c3a('0x23')],'value':_0x8e541b[_0x3bf065[_0x1c3a('0x21')]][_0x1c3a('0x2b')]()});}else if(_0x3bf065['type']==='customVariable'&&_0x3bf065[_0x1c3a('0x4e')]&&_0x3bf065['Variable'][_0x1c3a('0x1d')]&&_0x3bf065[_0x1c3a('0x23')]&&_0x3bf065[_0x1c3a('0x49')]){_0x8e541b[_0x3bf065['Variable'][_0x1c3a('0x1d')]['toLowerCase']()]&&_0x17b22f['custom_fields']['push']({'id':_0x3bf065[_0x1c3a('0x23')],'value':_0x8e541b[_0x3bf065['Variable'][_0x1c3a('0x1d')][_0x1c3a('0x4f')]()]['toString']()});}});}return _0x17b22f;}function getConnection(_0xe931b5){return request({'method':_0x1c3a('0xb'),'form':{'method':_0x1c3a('0x50'),'input_type':_0x1c3a('0x25'),'response_type':_0x1c3a('0x25'),'rest_data':JSON[_0x1c3a('0x26')]({'user_auth':{'user_name':_0xe931b5[_0x1c3a('0x51')],'password':_0xe931b5[_0x1c3a('0x52')],'encryption':_0x1c3a('0x53')},'application':_0x1c3a('0x54')})}})[_0x1c3a('0x33')](function(_0x553f2d){var _0x1a31bf=_0x553f2d;if(_0x1a31bf['id']){def[_0x1c3a('0x55')]=_0x1a31bf['id'];return BPromise[_0x1c3a('0x3a')](_0x1a31bf);}else{throw new Error(util[_0x1c3a('0x28')](_0x1c3a('0x56'),_0xe931b5['id']));}});}function setRelationship(_0x31dbd6,_0x277ff9,_0x33f4a7,_0xeaafad){return request({'form':{'method':_0x1c3a('0x57'),'input_type':_0x1c3a('0x25'),'response_type':_0x1c3a('0x25'),'rest_data':JSON['stringify']({'session':_0x31dbd6['id'],'module_name':_0x1c3a('0x27'),'module_id':_0x33f4a7['id'],'link_field_name':_0xeaafad,'related_ids':[_0x277ff9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1c3a('0x58')]=function(_0x3ada63,_0x5d6250,_0x4fd512,_0x5ac351,_0x730e6b,_0x3459fd){var _0x1d817a,_0x3550b9,_0x382f90,_0x49d15f;_0x3459fd[_0x1c3a('0x59')]=intUtil[_0x1c3a('0x5a')](_0x3459fd['remoteUri']);_0x3459fd[_0x1c3a('0x5b')]=intUtil[_0x1c3a('0x5a')](_0x3459fd[_0x1c3a('0x5b')]);def[_0x1c3a('0x5c')]=util[_0x1c3a('0x28')]('%s/service/v4_1/rest.php',_0x3459fd['remoteUri']);if(_0x730e6b&&_0x730e6b[_0x1c3a('0x5d')]){logger[_0x1c3a('0xd')]('[QUEUE]',_0x1c3a('0x5e'));_0x5d6250['recordingURL']=util['format'](_0x1c3a('0x5f'),_0x3459fd[_0x1c3a('0x5b')],_0x5d6250[_0x1c3a('0x60')],md5(_0x5d6250[_0x1c3a('0x60')]));}else{_0x5d6250[_0x1c3a('0x61')]='';}return getConnection(_0x3459fd)['then'](function(_0x4a0741){_0x49d15f=_0x4a0741;return getUser(_0x3459fd,_0x5ac351[_0x1c3a('0x1d')],_0x49d15f);})['then'](function(_0x4d96c4){_0x1d817a=_0x4d96c4;logger[_0x1c3a('0xd')](_0x1c3a('0x62'),_0x1d817a['id']);return getEndUser(_0x3459fd,_0x5d6250['calleridname'],_0x5d6250[_0x1c3a('0x63')],_0x49d15f);})[_0x1c3a('0x33')](function(_0xaac294){_0x3550b9=_0xaac294;logger[_0x1c3a('0xd')](_0x1c3a('0x64'),_0x3550b9['id']);return getTicket(_0x3459fd,_0x1d817a,_0x3550b9,_0x4fd512,_0x5d6250,_0x4fd512[_0x1c3a('0x65')],_0x49d15f,_0x1c3a('0x66'));})[_0x1c3a('0x33')](function(_0x5b6a81){_0x382f90=_0x5b6a81;logger[_0x1c3a('0xd')]('Ticket\x20created!');logger[_0x1c3a('0xd')](_0x1c3a('0x67'),_0x382f90['id']);return setRelationship(_0x49d15f,_0x1d817a,_0x382f90,_0x1c3a('0x68'));})['then'](function(){return setRelationship(_0x49d15f,_0x3550b9,_0x382f90,_0x1c3a('0x69'));})[_0x1c3a('0x33')](function(){return getServerInfo(_0x49d15f);})[_0x1c3a('0x33')](function(_0x5b1cac){var _0x45dbb2=parseInt(_0x5b1cac[_0x1c3a('0x6a')][_0x1c3a('0x6b')](0x0));var _0x2b1b53=util['format'](_0x1c3a('0x6c'),_0x3459fd[_0x1c3a('0x59')],_0x382f90['id']);if(_0x45dbb2>0x6){_0x2b1b53=util[_0x1c3a('0x28')](_0x1c3a('0x6d'),_0x3459fd['remoteUri'],_0x382f90['id']);}logger[_0x1c3a('0xd')](_0x1c3a('0x6e'),_0x1c3a('0x6f'));emit(util[_0x1c3a('0x28')](_0x1c3a('0x70'),_0x5ac351[_0x1c3a('0x1d')]),_0x1c3a('0x71'),{'uri':_0x2b1b53});})[_0x1c3a('0x72')](function(_0x4f9cfd){logger[_0x1c3a('0x73')](_0x1c3a('0x6e'),JSON[_0x1c3a('0x26')](_0x4f9cfd));});};exports[_0x1c3a('0x74')]=function(_0x4a3aa5,_0x5ae956,_0x20a958,_0x3ff873,_0x3ff332,_0x3dbfae,_0xa37d95){var _0x2c20e9,_0x50dc3a,_0x28c8ae,_0x31baf2;_0x3dbfae['remoteUri']=intUtil[_0x1c3a('0x5a')](_0x3dbfae[_0x1c3a('0x59')]);_0x3dbfae[_0x1c3a('0x5b')]=intUtil['stripTrailingSlash'](_0x3dbfae['serverUrl']);def[_0x1c3a('0x5c')]=util[_0x1c3a('0x28')](_0x1c3a('0x75'),_0x3dbfae[_0x1c3a('0x59')]);if(_0xa37d95&&_0xa37d95[_0x1c3a('0x76')]&&_0xa37d95[_0x1c3a('0x76')]!==_0x1c3a('0x77')){logger[_0x1c3a('0xd')](_0x1c3a('0x78'),_0x1c3a('0x5e'));_0x5ae956[_0x1c3a('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3dbfae[_0x1c3a('0x5b')],_0x5ae956[_0x1c3a('0x60')],md5(_0x5ae956[_0x1c3a('0x60')]));}return getConnection(_0x3dbfae)['then'](function(_0x18f8b6){_0x31baf2=_0x18f8b6;return getUser(_0x3dbfae,_0x3ff873['name'],_0x31baf2);})['then'](function(_0x2d1fb8){_0x2c20e9=_0x2d1fb8;logger['info']('The\x20User\x20ID\x20is:',_0x2c20e9['id']);return getEndUser(_0x3dbfae,_0x5ae956[_0x1c3a('0x79')],_0x5ae956['destcalleridnum'],_0x31baf2);})['then'](function(_0x3e94bd){_0x50dc3a=_0x3e94bd;logger['info'](_0x1c3a('0x64'),_0x50dc3a['id']);return getTicket(_0x3dbfae,_0x2c20e9,_0x50dc3a,_0x20a958,_0x5ae956,_0x20a958[_0x1c3a('0x65')],_0x31baf2,_0x1c3a('0x7a'));})[_0x1c3a('0x33')](function(_0x5b5fa5){_0x28c8ae=_0x5b5fa5;logger['info']('Ticket\x20created!');logger['info'](_0x1c3a('0x67'),_0x28c8ae['id']);return setRelationship(_0x31baf2,_0x2c20e9,_0x28c8ae,'users');})[_0x1c3a('0x33')](function(){return setRelationship(_0x31baf2,_0x50dc3a,_0x28c8ae,_0x1c3a('0x69'));})[_0x1c3a('0x33')](function(){return getServerInfo(_0x31baf2);})[_0x1c3a('0x33')](function(_0x2a2d27){var _0xcd121=parseInt(_0x2a2d27[_0x1c3a('0x6a')][_0x1c3a('0x6b')](0x0));var _0x52ed9e=util[_0x1c3a('0x28')](_0x1c3a('0x6c'),_0x3dbfae[_0x1c3a('0x59')],_0x28c8ae['id']);if(_0xcd121>0x6){_0x52ed9e=util[_0x1c3a('0x28')](_0x1c3a('0x6d'),_0x3dbfae[_0x1c3a('0x59')],_0x28c8ae['id']);}logger[_0x1c3a('0xd')](_0x1c3a('0x78'),_0x1c3a('0x6f'));emit(util[_0x1c3a('0x28')]('user:%s',_0x3ff873[_0x1c3a('0x1d')]),_0x1c3a('0x71'),{'uri':_0x52ed9e});})['catch'](function(_0x5421c9){logger[_0x1c3a('0x73')](_0x1c3a('0x78'),JSON['stringify'](_0x5421c9));});};exports[_0x1c3a('0x7b')]=function(_0x5f4962,_0x450461,_0x5eb64c,_0x3c2aa3,_0x354890,_0x502f87){var _0x1e9c7b,_0x112c5f,_0x328e76,_0x33cc3b;_0x502f87[_0x1c3a('0x59')]=intUtil[_0x1c3a('0x5a')](_0x502f87[_0x1c3a('0x59')]);_0x502f87[_0x1c3a('0x5b')]=intUtil[_0x1c3a('0x5a')](_0x502f87[_0x1c3a('0x5b')]);def[_0x1c3a('0x5c')]=util[_0x1c3a('0x28')]('%s/service/v4_1/rest.php',_0x502f87[_0x1c3a('0x59')]);if(_0x354890&&_0x354890[_0x1c3a('0x5d')]){logger[_0x1c3a('0xd')]('['+_0x450461[_0x1c3a('0x7c')][_0x1c3a('0x7d')]()+']','Recording\x20is\x20enabled!');_0x450461[_0x1c3a('0x61')]=util[_0x1c3a('0x28')](_0x1c3a('0x5f'),_0x502f87[_0x1c3a('0x5b')],_0x450461[_0x1c3a('0x60')],md5(_0x450461[_0x1c3a('0x60')]));}else{_0x450461[_0x1c3a('0x61')]='';}return getConnection(_0x502f87)[_0x1c3a('0x33')](function(_0x4e5821){_0x33cc3b=_0x4e5821;if(!_[_0x1c3a('0x2e')](_0x3c2aa3)){return getUser(_0x502f87,_0x3c2aa3['name'],_0x33cc3b);}else{return getUser(_0x502f87,null,_0x33cc3b);}})[_0x1c3a('0x33')](function(_0xbde4bd){_0x1e9c7b=_0xbde4bd;logger['info'](_0x1c3a('0x62'),_0x1e9c7b['id']);return getEndUser(_0x502f87,_0x450461[_0x1c3a('0x7e')],_0x450461['calleridnum'],_0x33cc3b);})['then'](function(_0x48e912){_0x112c5f=_0x48e912;logger[_0x1c3a('0xd')](_0x1c3a('0x64'),_0x112c5f['id']);return getTicket(_0x502f87,_0x1e9c7b,_0x112c5f,_0x5eb64c,_0x450461,_0x5eb64c[_0x1c3a('0x65')],_0x33cc3b,_0x1c3a('0x66'));})['then'](function(_0x43efda){_0x328e76=_0x43efda;logger[_0x1c3a('0xd')](_0x1c3a('0x7f'));logger[_0x1c3a('0xd')](_0x1c3a('0x67'),_0x328e76['id']);return setRelationship(_0x33cc3b,_0x1e9c7b,_0x328e76,'users');})[_0x1c3a('0x33')](function(){return setRelationship(_0x33cc3b,_0x112c5f,_0x328e76,_0x1c3a('0x69'));})[_0x1c3a('0x33')](function(){return getServerInfo(_0x33cc3b);})[_0x1c3a('0x72')](function(_0x4295d4){logger[_0x1c3a('0x73')]('['+_0x450461[_0x1c3a('0x7c')][_0x1c3a('0x7d')]()+']',JSON['stringify'](_0x4295d4));});}; \ No newline at end of file +var _0x4db1=['ioredis','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','name','Subjects','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','user_name','then','entry_list','length','name_value_list','Agent\x20found!','resolve','value','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','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','toString','custom_fields','content','variable','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','[QUEUE]','outbound','uri','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','calleridname','catch','error','toUpperCase','request-promise','md5'];(function(_0x54aaf1,_0x2061cb){var _0x4c7562=function(_0xae20e7){while(--_0xae20e7){_0x54aaf1['push'](_0x54aaf1['shift']());}};_0x4c7562(++_0x2061cb);}(_0x4db1,0x1ce));var _0x14db=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x4db1[_0x33fcbb];return _0x2efe40;};'use strict';var _=require('lodash');var rp=require(_0x14db('0x0'));var BPromise=require('bluebird');var md5=require(_0x14db('0x1'));var util=require('util');var Redis=require(_0x14db('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x14db('0x3'))(_0x14db('0x4'));config[_0x14db('0x5')]=_[_0x14db('0x6')](config[_0x14db('0x5')],{'host':_0x14db('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x14db('0x8'),'json':!![]};function emit(_0x3b7bc0,_0x1789a0,_0x1a4f9c){io['to'](_0x3b7bc0)[_0x14db('0x9')](_0x1789a0,_0x1a4f9c);}function getTicket(_0x141c2e,_0x1bd290,_0x582a3f,_0x3b6d48,_0x40218a,_0x40cf74,_0x1cf3dc,_0x320d54){logger[_0x14db('0xa')]('Creating\x20new\x20ticket...');var _0x3e5bf6=new Date();var _0x315a6c=[{'name':_0x14db('0xb'),'value':intUtil['getString'](_0x3b6d48[_0x14db('0xc')],_0x40218a,'\x20')},{'name':'assigned_user_id','value':_0x1bd290['id']},{'name':_0x14db('0xd'),'value':_0x1bd290['id']},{'name':'description','value':intUtil['getString'](_0x3b6d48[_0x14db('0xe')],_0x40218a,'\x0a')},{'name':_0x14db('0xf'),'value':_0x3e5bf6[_0x14db('0x10')]()[_0x14db('0x11')](0x0,0x13)[_0x14db('0x12')]('T','\x20')},{'name':_0x14db('0x13'),'value':'0'},{'name':_0x14db('0x14'),'value':'15'},{'name':_0x14db('0x15'),'value':_0x582a3f['id']},{'name':'parent_type','value':_0x14db('0x16')},{'name':'parent_name','value':_0x582a3f[_0x14db('0xb')]},{'name':_0x14db('0x17'),'value':_0x320d54}];if(_0x40cf74['length']){_[_0x14db('0x18')](_0x40cf74,function(_0x33b531){if(_0x40218a[_0x33b531[_0x14db('0x19')]]){_0x315a6c[_0x14db('0x1a')]({'name':_0x33b531[_0x14db('0x1b')],'value':_0x40218a[_0x33b531['variableName']]});}});}return request({'form':{'method':_0x14db('0x1c'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON['stringify']({'session':_0x1cf3dc['id'],'module_name':_0x14db('0x1e'),'name_value_list':_0x315a6c})}});}function getAuth(_0x4bc993){return util[_0x14db('0x1f')](_0x14db('0x20'),new Buffer(_0x4bc993['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x5e6a8f){return request({'form':{'method':_0x14db('0x21'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x5e6a8f['id']})}});}function getUser(_0x5e4827,_0x491e3b,_0x5d013a){if(!_[_0x14db('0x23')](_0x491e3b)){logger['info'](_0x14db('0x24'),_0x491e3b);return request({'form':{'method':'get_entry_list','input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x5d013a['id'],'module_name':'Employees','query':util[_0x14db('0x1f')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x491e3b),'order_by':'','offset':'0','select_fields':['id',_0x14db('0xb'),_0x14db('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x14db('0x26')](function(_0x3617cc){if(_0x3617cc[_0x14db('0x27')][_0x14db('0x28')]){var _0x2a0b6f=_['find'](_0x3617cc[_0x14db('0x27')],function(_0x43f091){return _0x43f091[_0x14db('0x29')]['user_name']['value']===_0x491e3b;});if(_0x2a0b6f){logger[_0x14db('0xa')](_0x14db('0x2a'));return BPromise[_0x14db('0x2b')]({'id':_0x2a0b6f[_0x14db('0x29')]['id'][_0x14db('0x2c')],'name':_0x2a0b6f[_0x14db('0x29')][_0x14db('0xb')][_0x14db('0x2c')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x14db('0x2b')]({'id':_0x5d013a['name_value_list'][_0x14db('0x2d')][_0x14db('0x2c')],'name':_0x5d013a[_0x14db('0x29')][_0x14db('0x25')][_0x14db('0x2c')]});});}else{logger['info'](_0x14db('0x2e'));return BPromise[_0x14db('0x2b')]({'id':_0x5d013a[_0x14db('0x29')][_0x14db('0x2d')]['value'],'name':_0x5d013a[_0x14db('0x29')][_0x14db('0x25')][_0x14db('0x2c')]});}}function getEndUser(_0x115318,_0x504f26,_0x59bf30,_0x2a20b4){logger[_0x14db('0xa')](_0x14db('0x2f'),_0x59bf30);return request({'form':{'method':_0x14db('0x30'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON['stringify']({'session':_0x2a20b4['id'],'module_name':'Contacts','query':util['format'](_0x14db('0x31'),_0x59bf30),'order_by':'','offset':'0','select_fields':['id','name',_0x14db('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x14db('0x26')](function(_0x3d69ab){if(_0x3d69ab[_0x14db('0x27')][_0x14db('0x28')]){var _0x160fc0=_[_0x14db('0x33')](_0x3d69ab['entry_list'],function(_0xfdd4b7){return _0xfdd4b7[_0x14db('0x29')][_0x14db('0x32')][_0x14db('0x2c')]===_0x59bf30;});if(_0x160fc0){logger[_0x14db('0xa')]('Enduser\x20found!');return BPromise[_0x14db('0x2b')]({'id':_0x160fc0[_0x14db('0x29')]['id'][_0x14db('0x2c')],'name':_0x160fc0[_0x14db('0x29')]['name']['value'],'phone':_0x160fc0[_0x14db('0x29')][_0x14db('0x32')][_0x14db('0x2c')]});}}else{logger[_0x14db('0xa')](_0x14db('0x34'));return request({'form':{'method':_0x14db('0x1c'),'input_type':'JSON','response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x2a20b4['id'],'module_name':_0x14db('0x16'),'name_value_list':[{'name':'first_name','value':_0x504f26!==_0x14db('0x35')?_0x504f26:util['format'](_0x14db('0x36'),_0x59bf30)},{'name':_0x14db('0x32'),'value':_0x59bf30}]})}})[_0x14db('0x26')](function(_0x3dc5d1){logger[_0x14db('0xa')](_0x14db('0x37'));return BPromise[_0x14db('0x2b')]({'id':_0x3dc5d1['id'],'name':_0x3dc5d1[_0x14db('0x27')]['first_name']['value'],'phone':_0x3dc5d1[_0x14db('0x27')][_0x14db('0x32')][_0x14db('0x2c')]});});}});}function request(_0x14feef){logger[_0x14db('0x38')](_0x14db('0x39'),JSON[_0x14db('0x22')](_0x14feef));return rp(_['merge'](def,_0x14feef));}function getTags(_0x1b817e,_0x70852c){var _0x4c5c00=[];if(_0x1b817e&&_0x1b817e[_0x14db('0x28')]>0x0){_0x4c5c00=_[_0x14db('0x3a')](_0x1b817e,_0x70852c);}return _0x4c5c00;}function getCustomFields(_0x211c10,_0xd296dd){var _0x55ebaf=[];var _0x838be7={'custom_fields':[]};if(_0x211c10[_0x14db('0x28')]>0x0){_[_0x14db('0x18')](_0x211c10,function(_0x4680ac){if(_0x4680ac[_0x14db('0x3b')]===_0x14db('0x3c')&&_0x4680ac[_0x14db('0x3d')]&&!_0x4680ac[_0x14db('0x3e')]){_0x838be7[_0x4680ac['nameField'][_0x14db('0x3f')]()]=_0x4680ac['content'][_0x14db('0x40')]();}else if(_0x4680ac['type']==='string'&&_0x4680ac[_0x14db('0x1b')]&&_0x4680ac[_0x14db('0x3e')]){_0x838be7[_0x14db('0x41')][_0x14db('0x1a')]({'id':_0x4680ac[_0x14db('0x1b')],'value':_0x4680ac[_0x14db('0x42')][_0x14db('0x40')]()});}else if(_0x4680ac['type']===_0x14db('0x43')&&_0x4680ac[_0x14db('0x19')]&&_0x4680ac[_0x14db('0x1b')]&&_0x4680ac[_0x14db('0x3e')]){_0xd296dd[_0x4680ac[_0x14db('0x19')]]&&_0x838be7[_0x14db('0x41')][_0x14db('0x1a')]({'id':_0x4680ac[_0x14db('0x1b')],'value':_0xd296dd[_0x4680ac[_0x14db('0x19')]][_0x14db('0x40')]()});}else if(_0x4680ac['type']===_0x14db('0x44')&&_0x4680ac[_0x14db('0x45')]&&_0x4680ac[_0x14db('0x45')]['name']&&_0x4680ac['idField']&&_0x4680ac[_0x14db('0x3e')]){_0xd296dd[_0x4680ac['Variable']['name'][_0x14db('0x3f')]()]&&_0x838be7[_0x14db('0x41')]['push']({'id':_0x4680ac[_0x14db('0x1b')],'value':_0xd296dd[_0x4680ac[_0x14db('0x45')][_0x14db('0xb')][_0x14db('0x3f')]()][_0x14db('0x40')]()});}});}return _0x838be7;}function getConnection(_0x889b6e){return request({'method':_0x14db('0x8'),'form':{'method':_0x14db('0x46'),'input_type':'JSON','response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'user_auth':{'user_name':_0x889b6e[_0x14db('0x47')],'password':_0x889b6e['password'],'encryption':_0x14db('0x48')},'application':_0x14db('0x49')})}})[_0x14db('0x26')](function(_0x5a9241){var _0xd674ea=_0x5a9241;if(_0xd674ea['id']){def[_0x14db('0x4a')]=_0xd674ea['id'];return BPromise[_0x14db('0x2b')](_0xd674ea);}else{throw new Error(util[_0x14db('0x1f')](_0x14db('0x4b'),_0x889b6e['id']));}});}function setRelationship(_0x12b8e8,_0x510ac1,_0x43ed9c,_0x37abf4){return request({'form':{'method':_0x14db('0x4c'),'input_type':_0x14db('0x1d'),'response_type':_0x14db('0x1d'),'rest_data':JSON[_0x14db('0x22')]({'session':_0x12b8e8['id'],'module_name':_0x14db('0x1e'),'module_id':_0x43ed9c['id'],'link_field_name':_0x37abf4,'related_ids':[_0x510ac1['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x32997e,_0x5c6c74,_0x20fa45,_0x4c09dd,_0x33d2dc,_0x3f9f85){var _0x5b4400,_0x393c17,_0x498a58,_0x351d38;_0x3f9f85[_0x14db('0x4d')]=intUtil[_0x14db('0x4e')](_0x3f9f85['remoteUri']);_0x3f9f85['serverUrl']=intUtil[_0x14db('0x4e')](_0x3f9f85[_0x14db('0x4f')]);def['uri']=util[_0x14db('0x1f')](_0x14db('0x50'),_0x3f9f85[_0x14db('0x4d')]);if(_0x33d2dc&&_0x33d2dc['monitor_format']){logger[_0x14db('0xa')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5c6c74[_0x14db('0x51')]=util[_0x14db('0x1f')](_0x14db('0x52'),_0x3f9f85[_0x14db('0x4f')],_0x5c6c74[_0x14db('0x53')],md5(_0x5c6c74[_0x14db('0x53')]));}else{_0x5c6c74['recordingURL']='';}return getConnection(_0x3f9f85)[_0x14db('0x26')](function(_0x1fe2e7){_0x351d38=_0x1fe2e7;return getUser(_0x3f9f85,_0x4c09dd[_0x14db('0xb')],_0x351d38);})[_0x14db('0x26')](function(_0x509131){_0x5b4400=_0x509131;logger[_0x14db('0xa')](_0x14db('0x54'),_0x5b4400['id']);return getEndUser(_0x3f9f85,_0x5c6c74['calleridname'],_0x5c6c74[_0x14db('0x55')],_0x351d38);})[_0x14db('0x26')](function(_0x4d046b){_0x393c17=_0x4d046b;logger['info'](_0x14db('0x56'),_0x393c17['id']);return getTicket(_0x3f9f85,_0x5b4400,_0x393c17,_0x20fa45,_0x5c6c74,_0x20fa45[_0x14db('0x57')],_0x351d38,_0x14db('0x58'));})['then'](function(_0x549703){_0x498a58=_0x549703;logger['info'](_0x14db('0x59'));logger[_0x14db('0xa')]('The\x20Ticket\x20ID\x20is:',_0x498a58['id']);return setRelationship(_0x351d38,_0x5b4400,_0x498a58,'users');})[_0x14db('0x26')](function(){return setRelationship(_0x351d38,_0x393c17,_0x498a58,_0x14db('0x5a'));})[_0x14db('0x26')](function(){return getServerInfo(_0x351d38);})[_0x14db('0x26')](function(_0x50359e){var _0x523471=parseInt(_0x50359e[_0x14db('0x5b')][_0x14db('0x5c')](0x0));var _0x467b32=util[_0x14db('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3f9f85[_0x14db('0x4d')],_0x498a58['id']);if(_0x523471>0x6){_0x467b32=util[_0x14db('0x1f')](_0x14db('0x5d'),_0x3f9f85['remoteUri'],_0x498a58['id']);}logger[_0x14db('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x14db('0x1f')]('user:%s',_0x4c09dd['name']),_0x14db('0x5e'),{'uri':_0x467b32});})['catch'](function(_0x3b53ac){logger['error'](_0x14db('0x5f'),JSON[_0x14db('0x22')](_0x3b53ac));});};exports[_0x14db('0x60')]=function(_0x424ab0,_0x57cefa,_0x412dc0,_0x210c2d,_0x57f587,_0x180d74,_0x10f52c){var _0x18f018,_0x5868df,_0x42bec8,_0x7e1713;_0x180d74[_0x14db('0x4d')]=intUtil['stripTrailingSlash'](_0x180d74[_0x14db('0x4d')]);_0x180d74[_0x14db('0x4f')]=intUtil[_0x14db('0x4e')](_0x180d74[_0x14db('0x4f')]);def[_0x14db('0x61')]=util[_0x14db('0x1f')]('%s/service/v4_1/rest.php',_0x180d74[_0x14db('0x4d')]);if(_0x10f52c&&_0x10f52c['recordingFormat']&&_0x10f52c[_0x14db('0x62')]!==_0x14db('0x63')){logger['info'](_0x14db('0x64'),_0x14db('0x65'));_0x57cefa[_0x14db('0x51')]=util['format'](_0x14db('0x52'),_0x180d74[_0x14db('0x4f')],_0x57cefa['uniqueid'],md5(_0x57cefa[_0x14db('0x53')]));}return getConnection(_0x180d74)[_0x14db('0x26')](function(_0x5599b4){_0x7e1713=_0x5599b4;return getUser(_0x180d74,_0x210c2d[_0x14db('0xb')],_0x7e1713);})[_0x14db('0x26')](function(_0x2a5ad2){_0x18f018=_0x2a5ad2;logger[_0x14db('0xa')](_0x14db('0x54'),_0x18f018['id']);return getEndUser(_0x180d74,_0x57cefa[_0x14db('0x66')],_0x57cefa[_0x14db('0x67')],_0x7e1713);})[_0x14db('0x26')](function(_0x52e1eb){_0x5868df=_0x52e1eb;logger['info'](_0x14db('0x56'),_0x5868df['id']);return getTicket(_0x180d74,_0x18f018,_0x5868df,_0x412dc0,_0x57cefa,_0x412dc0[_0x14db('0x57')],_0x7e1713,_0x14db('0x68'));})[_0x14db('0x26')](function(_0x274c1e){_0x42bec8=_0x274c1e;logger[_0x14db('0xa')](_0x14db('0x59'));logger[_0x14db('0xa')](_0x14db('0x69'),_0x42bec8['id']);return setRelationship(_0x7e1713,_0x18f018,_0x42bec8,_0x14db('0x6a'));})[_0x14db('0x26')](function(){return setRelationship(_0x7e1713,_0x5868df,_0x42bec8,_0x14db('0x5a'));})[_0x14db('0x26')](function(){return getServerInfo(_0x7e1713);})[_0x14db('0x26')](function(_0x176168){var _0x13292b=parseInt(_0x176168['version']['charAt'](0x0));var _0x2f26a9=util['format'](_0x14db('0x6b'),_0x180d74[_0x14db('0x4d')],_0x42bec8['id']);if(_0x13292b>0x6){_0x2f26a9=util['format'](_0x14db('0x5d'),_0x180d74[_0x14db('0x4d')],_0x42bec8['id']);}logger[_0x14db('0xa')](_0x14db('0x64'),_0x14db('0x6c'));emit(util[_0x14db('0x1f')]('user:%s',_0x210c2d['name']),'trigger:browser:url',{'uri':_0x2f26a9});})['catch'](function(_0x2cd3c3){logger['error'](_0x14db('0x64'),JSON[_0x14db('0x22')](_0x2cd3c3));});};exports[_0x14db('0x6d')]=function(_0x339c58,_0x34fd86,_0x3e4bd1,_0x5977ae,_0x9e9bd2,_0x3cddcc){var _0x22ae0d,_0x5f0469,_0x5b71e7,_0x116070;_0x3cddcc[_0x14db('0x4d')]=intUtil[_0x14db('0x4e')](_0x3cddcc[_0x14db('0x4d')]);_0x3cddcc['serverUrl']=intUtil[_0x14db('0x4e')](_0x3cddcc[_0x14db('0x4f')]);def['uri']=util[_0x14db('0x1f')](_0x14db('0x50'),_0x3cddcc['remoteUri']);if(_0x9e9bd2&&_0x9e9bd2[_0x14db('0x6e')]){logger[_0x14db('0xa')]('['+_0x34fd86[_0x14db('0x6f')]['toUpperCase']()+']',_0x14db('0x65'));_0x34fd86[_0x14db('0x51')]=util[_0x14db('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3cddcc[_0x14db('0x4f')],_0x34fd86[_0x14db('0x53')],md5(_0x34fd86[_0x14db('0x53')]));}else{_0x34fd86[_0x14db('0x51')]='';}return getConnection(_0x3cddcc)[_0x14db('0x26')](function(_0xfe1799){_0x116070=_0xfe1799;if(!_[_0x14db('0x23')](_0x5977ae)){return getUser(_0x3cddcc,_0x5977ae['name'],_0x116070);}else{return getUser(_0x3cddcc,null,_0x116070);}})[_0x14db('0x26')](function(_0x31b58f){_0x22ae0d=_0x31b58f;logger['info'](_0x14db('0x54'),_0x22ae0d['id']);return getEndUser(_0x3cddcc,_0x34fd86[_0x14db('0x70')],_0x34fd86[_0x14db('0x55')],_0x116070);})['then'](function(_0x273869){_0x5f0469=_0x273869;logger['info'](_0x14db('0x56'),_0x5f0469['id']);return getTicket(_0x3cddcc,_0x22ae0d,_0x5f0469,_0x3e4bd1,_0x34fd86,_0x3e4bd1[_0x14db('0x57')],_0x116070,_0x14db('0x58'));})['then'](function(_0x23fba3){_0x5b71e7=_0x23fba3;logger[_0x14db('0xa')](_0x14db('0x59'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5b71e7['id']);return setRelationship(_0x116070,_0x22ae0d,_0x5b71e7,_0x14db('0x6a'));})[_0x14db('0x26')](function(){return setRelationship(_0x116070,_0x5f0469,_0x5b71e7,_0x14db('0x5a'));})[_0x14db('0x26')](function(){return getServerInfo(_0x116070);})[_0x14db('0x71')](function(_0x44b1d0){logger[_0x14db('0x72')]('['+_0x34fd86['lastevent'][_0x14db('0x73')]()+']',JSON[_0x14db('0x22')](_0x44b1d0));});}; \ 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 9df500c..e83e8fe 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 _0xdffe=['length','sortBy','string','type','variableName','push','toString','customVariable','Variable','name','key','format','keyContent','keyType','variable','%s:\x20%s','toLowerCase','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString'];(function(_0x1fa87d,_0x41bc04){var _0x265758=function(_0x3c0446){while(--_0x3c0446){_0x1fa87d['push'](_0x1fa87d['shift']());}};_0x265758(++_0x41bc04);}(_0xdffe,0xe8));var _0xedff=function(_0x4a8600,_0x1e723e){_0x4a8600=_0x4a8600-0x0;var _0x4458b6=_0xdffe[_0x4a8600];return _0x4458b6;};'use strict';var _=require(_0xedff('0x0'));var util=require('util');exports[_0xedff('0x1')]=function(_0xe252fa,_0x22c858,_0x42ea57){var _0x35dec4=[];if(_0xe252fa[_0xedff('0x2')]>0x0){var _0x225216=_[_0xedff('0x3')](_0xe252fa,['id']);for(var _0x4fed73=0x0;_0x4fed73<_0x225216['length'];_0x4fed73++){var _0x31a1e4=_0x225216[_0x4fed73];if(_0x31a1e4['type']===_0xedff('0x4')){_0x35dec4['push'](_0x31a1e4['content']);}else if(_0x31a1e4[_0xedff('0x5')]==='variable'&&_0x31a1e4[_0xedff('0x6')]){_0x22c858[_0x31a1e4['variableName']]&&_0x35dec4[_0xedff('0x7')](_0x22c858[_0x31a1e4[_0xedff('0x6')]][_0xedff('0x8')]());}else if(_0x31a1e4[_0xedff('0x5')]===_0xedff('0x9')&&_0x31a1e4[_0xedff('0xa')]&&_0x31a1e4[_0xedff('0xa')]['name']){_0x22c858[_0x31a1e4[_0xedff('0xa')][_0xedff('0xb')]['toLowerCase']()]&&_0x35dec4[_0xedff('0x7')](_0x22c858[_0x31a1e4[_0xedff('0xa')][_0xedff('0xb')]['toLowerCase']()][_0xedff('0x8')]());}else if(_0x31a1e4[_0xedff('0x5')]==='keyValue'){if(_0x31a1e4['keyType']===_0xedff('0x4')&&_0x31a1e4[_0xedff('0xc')]){_0x35dec4[_0xedff('0x7')](util[_0xedff('0xd')]('%s:\x20%s',_0x31a1e4['key'],_0x31a1e4[_0xedff('0xe')]));}else if(_0x31a1e4[_0xedff('0xf')]===_0xedff('0x10')&&_0x31a1e4['variableName']&&_0x31a1e4[_0xedff('0xc')]){_0x22c858[_0x31a1e4['variableName']]&&_0x35dec4[_0xedff('0x7')](util[_0xedff('0xd')](_0xedff('0x11'),_0x31a1e4['key'],_0x22c858[_0x31a1e4[_0xedff('0x6')]]));}else if(_0x31a1e4[_0xedff('0xf')]===_0xedff('0x9')&&_0x31a1e4[_0xedff('0xa')]&&_0x31a1e4[_0xedff('0xa')][_0xedff('0xb')]&&_0x31a1e4[_0xedff('0xc')]){_0x22c858[_0x31a1e4[_0xedff('0xa')][_0xedff('0xb')]['toLowerCase']()]&&_0x35dec4[_0xedff('0x7')](util['format'](_0xedff('0x11'),_0x31a1e4[_0xedff('0xc')],_0x22c858[_0x31a1e4[_0xedff('0xa')][_0xedff('0xb')][_0xedff('0x12')]()]));}}}}return _0x35dec4[_0xedff('0x13')](_0x42ea57);};exports[_0xedff('0x14')]=function(_0x262daf){var _0x2a43e9=_0x262daf['slice'](-0x1);if(_0x2a43e9==='/'){_0x262daf=_0x262daf[_0xedff('0x15')](0x0,_0x262daf[_0xedff('0x16')](_0x2a43e9));}return _0x262daf;};exports[_0xedff('0x17')]=function(_0x45144b){if(!_[_0xedff('0x18')](_0x45144b)&&_0x45144b!==''){var _0x4538fc=/^(([^<>()\[\]\\.,;:\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 _0x4538fc[_0xedff('0x19')](String(_0x45144b)[_0xedff('0x12')]());}else{return![];}}; \ No newline at end of file +var _0x82d2=['keyType','key','format','%s:\x20%s','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0xccf22,_0x128718){var _0x229229=function(_0x2ef7ae){while(--_0x2ef7ae){_0xccf22['push'](_0xccf22['shift']());}};_0x229229(++_0x128718);}(_0x82d2,0x8c));var _0x282d=function(_0x281bd7,_0x11a709){_0x281bd7=_0x281bd7-0x0;var _0x3d05c2=_0x82d2[_0x281bd7];return _0x3d05c2;};'use strict';var _=require(_0x282d('0x0'));var util=require(_0x282d('0x1'));exports[_0x282d('0x2')]=function(_0x2a0ee7,_0x4e890b,_0x454882){var _0x215996=[];if(_0x2a0ee7[_0x282d('0x3')]>0x0){var _0x4ec9c6=_[_0x282d('0x4')](_0x2a0ee7,['id']);for(var _0x3a0822=0x0;_0x3a0822<_0x4ec9c6['length'];_0x3a0822++){var _0x5e6d5b=_0x4ec9c6[_0x3a0822];if(_0x5e6d5b[_0x282d('0x5')]===_0x282d('0x6')){_0x215996[_0x282d('0x7')](_0x5e6d5b[_0x282d('0x8')]);}else if(_0x5e6d5b[_0x282d('0x5')]==='variable'&&_0x5e6d5b['variableName']){_0x4e890b[_0x5e6d5b['variableName']]&&_0x215996['push'](_0x4e890b[_0x5e6d5b[_0x282d('0x9')]][_0x282d('0xa')]());}else if(_0x5e6d5b[_0x282d('0x5')]===_0x282d('0xb')&&_0x5e6d5b[_0x282d('0xc')]&&_0x5e6d5b[_0x282d('0xc')]['name']){_0x4e890b[_0x5e6d5b['Variable'][_0x282d('0xd')][_0x282d('0xe')]()]&&_0x215996['push'](_0x4e890b[_0x5e6d5b[_0x282d('0xc')]['name']['toLowerCase']()]['toString']());}else if(_0x5e6d5b[_0x282d('0x5')]===_0x282d('0xf')){if(_0x5e6d5b[_0x282d('0x10')]===_0x282d('0x6')&&_0x5e6d5b[_0x282d('0x11')]){_0x215996[_0x282d('0x7')](util[_0x282d('0x12')](_0x282d('0x13'),_0x5e6d5b[_0x282d('0x11')],_0x5e6d5b['keyContent']));}else if(_0x5e6d5b[_0x282d('0x10')]==='variable'&&_0x5e6d5b[_0x282d('0x9')]&&_0x5e6d5b[_0x282d('0x11')]){_0x4e890b[_0x5e6d5b[_0x282d('0x9')]]&&_0x215996['push'](util[_0x282d('0x12')](_0x282d('0x13'),_0x5e6d5b['key'],_0x4e890b[_0x5e6d5b[_0x282d('0x9')]]));}else if(_0x5e6d5b[_0x282d('0x10')]==='customVariable'&&_0x5e6d5b[_0x282d('0xc')]&&_0x5e6d5b['Variable'][_0x282d('0xd')]&&_0x5e6d5b[_0x282d('0x11')]){_0x4e890b[_0x5e6d5b[_0x282d('0xc')][_0x282d('0xd')][_0x282d('0xe')]()]&&_0x215996['push'](util[_0x282d('0x12')](_0x282d('0x13'),_0x5e6d5b['key'],_0x4e890b[_0x5e6d5b['Variable'][_0x282d('0xd')]['toLowerCase']()]));}}}}return _0x215996['join'](_0x454882);};exports['stripTrailingSlash']=function(_0x261678){var _0x34c998=_0x261678[_0x282d('0x14')](-0x1);if(_0x34c998==='/'){_0x261678=_0x261678[_0x282d('0x15')](0x0,_0x261678[_0x282d('0x16')](_0x34c998));}return _0x261678;};exports[_0x282d('0x17')]=function(_0x44efa9){if(!_[_0x282d('0x18')](_0x44efa9)&&_0x44efa9!==''){var _0x4d5209=/^(([^<>()\[\]\\.,;:\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 _0x4d5209[_0x282d('0x19')](String(_0x44efa9)[_0x282d('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 135639e..d3ad4fc 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x29d5c0,_0x59e8a0){var _0x4f2459=function(_0x3790d8){while(--_0x3790d8){_0x29d5c0['push'](_0x29d5c0['shift']());}};_0x4f2459(++_0x59e8a0);}(_0x34e8,0x12c));var _0x834e=function(_0x5d2106,_0x1360ad){_0x5d2106=_0x5d2106-0x0;var _0x3beb5c=_0x34e8[_0x5d2106];return _0x3beb5c;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +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(_0x4e5918,_0x57150b){var _0x154990=function(_0x19b730){while(--_0x19b730){_0x4e5918['push'](_0x4e5918['shift']());}};_0x154990(++_0x57150b);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 90e1b10..c5fdd5d 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 _0xa00f=['toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','results','length','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','%s/token:%s','username','token','toString','base64','defaults','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent'];(function(_0x4dc35f,_0x377c51){var _0x1f8820=function(_0x37c340){while(--_0x37c340){_0x4dc35f['push'](_0x4dc35f['shift']());}};_0x1f8820(++_0x377c51);}(_0xa00f,0xda));var _0xfa00=function(_0x3d1dba,_0x3fcbf6){_0x3d1dba=_0x3d1dba-0x0;var _0x1809e2=_0xa00f[_0x3d1dba];return _0x1809e2;};'use strict';var _=require('lodash');var rp=require(_0xfa00('0x0'));var md5=require('md5');var util=require(_0xfa00('0x1'));var Redis=require(_0xfa00('0x2'));var intUtil=require(_0xfa00('0x3'));var config=require(_0xfa00('0x4'));var logger=require(_0xfa00('0x5'))(_0xfa00('0x6'));config[_0xfa00('0x7')]=_['defaults'](config[_0xfa00('0x7')],{'host':_0xfa00('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfa00('0x7')]));function emit(_0x262dc6,_0x25e48b,_0x4afb86){io['to'](_0x262dc6)[_0xfa00('0x9')](_0x25e48b,_0x4afb86);}var headers={'Content-Type':_0xfa00('0xa'),'Accept':'application/json'};function getTicket(_0x1491bf,_0x1395b3,_0xfc8498,_0x87ca98,_0x4c60bc){logger[_0xfa00('0xb')](_0xfa00('0xc'));return request({'uri':util['format'](_0xfa00('0xd'),_0x1491bf[_0xfa00('0xe')]),'method':_0xfa00('0xf'),'body':{'ticket':_[_0xfa00('0x10')]({'requester_id':_0xfc8498['id'],'submitter_id':_0x1395b3?_0x1395b3['id']:undefined,'assignee_id':_0x1395b3?_0x1395b3['id']:undefined,'tags':getTags(_0x87ca98[_0xfa00('0x11')],_0xfa00('0x12')),'subject':intUtil[_0xfa00('0x13')](_0x87ca98[_0xfa00('0x14')],_0x4c60bc,'\x20'),'description':intUtil[_0xfa00('0x13')](_0x87ca98[_0xfa00('0x15')],_0x4c60bc,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x87ca98[_0xfa00('0x15')],_0x4c60bc,'\x0a')}},getCustomFields(_0x87ca98['Fields'],_0x4c60bc))}})[_0xfa00('0x16')](function(_0x3b6e2c){logger[_0xfa00('0xb')]('Ticket\x20created!');return _0x3b6e2c['ticket'];});}function getUser(_0x403351,_0x337dea){if(intUtil[_0xfa00('0x17')](_0x337dea)){logger[_0xfa00('0xb')](_0xfa00('0x18'),_0x337dea);return request({'uri':util[_0xfa00('0x19')](_0xfa00('0x1a'),_0x403351[_0xfa00('0xe')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x337dea)}})[_0xfa00('0x16')](function(_0x25b188){if(_0x25b188[_0xfa00('0x1b')]){logger[_0xfa00('0xb')](_0xfa00('0x1c'));return _[_0xfa00('0x1d')](_0x25b188['results'],{'email':_0x337dea,'role':_0xfa00('0x1e')});}else{logger[_0xfa00('0xb')](_0xfa00('0x1f'));return request({'uri':util[_0xfa00('0x19')]('%s/users/me.json',_0x403351[_0xfa00('0xe')])})['then'](function(_0xc88ccc){logger[_0xfa00('0xb')](_0xfa00('0x20'));return _0xc88ccc[_0xfa00('0x21')];});}});}else{logger[_0xfa00('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfa00('0x19')](_0xfa00('0x22'),_0x403351[_0xfa00('0xe')])})['then'](function(_0x2e5acd){logger[_0xfa00('0xb')](_0xfa00('0x20'));return _0x2e5acd[_0xfa00('0x21')];});}}function getEndUser(_0x1b38df,_0x475d25,_0x310034){logger['info'](_0xfa00('0x23'),_0x310034);return request({'uri':util[_0xfa00('0x19')](_0xfa00('0x1a'),_0x1b38df['remoteUri']),'qs':{'query':util[_0xfa00('0x19')]('type:user\x20role:end-user\x20phone:%s',_0x310034)}})[_0xfa00('0x16')](function(_0x5aa755){var _0x581cda;if(_0x5aa755[_0xfa00('0x24')][_0xfa00('0x25')]){_0x5aa755[_0xfa00('0x24')]=_['filter'](_0x5aa755[_0xfa00('0x24')],{'suspended':![],'role':_0xfa00('0x26')});if(_0x5aa755[_0xfa00('0x24')][_0xfa00('0x25')]){_0x581cda=_['first'](_0x5aa755[_0xfa00('0x24')]);}}if(_0x581cda){logger[_0xfa00('0xb')]('Enduser\x20found!');return _0x581cda;}else{logger[_0xfa00('0xb')](_0xfa00('0x27'));return request({'uri':util[_0xfa00('0x19')](_0xfa00('0x28'),_0x1b38df[_0xfa00('0xe')]),'method':_0xfa00('0xf'),'body':{'user':{'role':_0xfa00('0x26'),'name':util[_0xfa00('0x19')](_0xfa00('0x29'),_0x475d25||_0x310034),'phone':_0x310034}}})[_0xfa00('0x16')](function(_0x3da8b6){logger[_0xfa00('0xb')]('Enduser\x20created.');return _0x3da8b6[_0xfa00('0x21')];});}});}function getAuth(_0x4d9f1f){var _0x51e27c;if(_0x4d9f1f[_0xfa00('0x2a')]===_0xfa00('0x2b')){_0x51e27c=util['format'](_0xfa00('0x2c'),_0x4d9f1f['username'],_0x4d9f1f[_0xfa00('0x2b')]);}else if(_0x4d9f1f[_0xfa00('0x2a')]==='token'){_0x51e27c=util['format'](_0xfa00('0x2d'),_0x4d9f1f[_0xfa00('0x2e')],_0x4d9f1f[_0xfa00('0x2f')]);}return util[_0xfa00('0x19')]('Basic\x20%s',new Buffer(_0x51e27c)[_0xfa00('0x30')](_0xfa00('0x31')));}function request(_0x4ea90c){logger['debug']('[HTTP]',JSON['stringify'](_0x4ea90c));return rp(_[_0xfa00('0x32')](_0x4ea90c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2f3ce7,_0x6e0aec){var _0x5c2817=[];if(_0x2f3ce7&&_0x2f3ce7[_0xfa00('0x25')]>0x0){_0x5c2817=_[_0xfa00('0x33')](_0x2f3ce7,_0x6e0aec);}return _0x5c2817;}function getCustomFields(_0x8d8449,_0x8188db){var _0x1d545b=[];var _0x47c582={'custom_fields':[]};if(_0x8d8449[_0xfa00('0x25')]>0x0){_[_0xfa00('0x34')](_0x8d8449,function(_0x126407){if(_[_0xfa00('0x35')]([_0xfa00('0x36'),_0xfa00('0x37')],_0x126407[_0xfa00('0x38')])&&_0x126407[_0xfa00('0x39')]&&!_0x126407[_0xfa00('0x3a')]){_0x47c582[_0x126407['nameField'][_0xfa00('0x3b')]()]=_0x126407['content']['toString']();}else if(_[_0xfa00('0x35')](['string',_0xfa00('0x37')],_0x126407[_0xfa00('0x38')])&&_0x126407[_0xfa00('0x3c')]&&_0x126407['customField']){_0x47c582[_0xfa00('0x3d')][_0xfa00('0x3e')]({'id':_0x126407[_0xfa00('0x3c')],'value':_0x126407['content'][_0xfa00('0x30')]()});}else if(_0x126407['type']===_0xfa00('0x3f')&&_0x126407[_0xfa00('0x40')]&&_0x126407['idField']&&_0x126407[_0xfa00('0x3a')]){_0x8188db[_0x126407[_0xfa00('0x40')]]&&_0x47c582['custom_fields']['push']({'id':_0x126407[_0xfa00('0x3c')],'value':_0x8188db[_0x126407[_0xfa00('0x40')]][_0xfa00('0x30')]()});}else if(_0x126407[_0xfa00('0x38')]===_0xfa00('0x41')&&_0x126407[_0xfa00('0x42')]&&_0x126407['Variable'][_0xfa00('0x12')]&&_0x126407[_0xfa00('0x3c')]&&_0x126407[_0xfa00('0x3a')]){_0x8188db[_0x126407[_0xfa00('0x42')][_0xfa00('0x12')]['toLowerCase']()]&&_0x47c582[_0xfa00('0x3d')][_0xfa00('0x3e')]({'id':_0x126407[_0xfa00('0x3c')],'value':_0x8188db[_0x126407[_0xfa00('0x42')][_0xfa00('0x12')][_0xfa00('0x3b')]()][_0xfa00('0x30')]()});}});}return _0x47c582;}exports[_0xfa00('0x43')]=function(_0x3c3bdd,_0x31848d,_0x18c1d1,_0x405382,_0x1f1b14,_0x4bc0bc){var _0x42f10f,_0x5f8f77;_0x4bc0bc[_0xfa00('0xe')]=intUtil[_0xfa00('0x44')](_0x4bc0bc[_0xfa00('0xe')]);_0x4bc0bc[_0xfa00('0x45')]=intUtil[_0xfa00('0x44')](_0x4bc0bc['serverUrl']);if(_0x1f1b14&&_0x1f1b14[_0xfa00('0x46')]){logger[_0xfa00('0xb')](_0xfa00('0x47'),_0xfa00('0x48'));_0x31848d[_0xfa00('0x49')]=util[_0xfa00('0x19')](_0xfa00('0x4a'),_0x4bc0bc[_0xfa00('0x45')],_0x31848d['uniqueid'],md5(_0x31848d['uniqueid']));}else{_0x31848d[_0xfa00('0x49')]='';}headers[_0xfa00('0x4b')]=getAuth(_0x4bc0bc);return getUser(_0x4bc0bc,_0x405382[_0xfa00('0x4c')])[_0xfa00('0x16')](function(_0x3bc42b){_0x42f10f=_0x3bc42b;logger[_0xfa00('0xb')](_0xfa00('0x4d'),_0x42f10f['id']);return getEndUser(_0x4bc0bc,_0x31848d[_0xfa00('0x4e')],_0x31848d[_0xfa00('0x4f')]);})['then'](function(_0x170fe2){_0x5f8f77=_0x170fe2;logger[_0xfa00('0xb')](_0xfa00('0x50'),_0x5f8f77['id']);return getTicket(_0x4bc0bc,_0x42f10f,_0x5f8f77,_0x18c1d1,_0x31848d);})[_0xfa00('0x16')](function(_0x3d276a){if(_0x3d276a){logger['info'](_0xfa00('0x51'),_0x3d276a['id']);switch(_0x4bc0bc[_0xfa00('0x38')]){case _0xfa00('0x52'):logger[_0xfa00('0xb')](_0xfa00('0x47'),_0xfa00('0x53'));return request({'uri':util['format'](_0xfa00('0x54'),_0x4bc0bc[_0xfa00('0xe')],_0x42f10f['id'],_0x3d276a['id']),'method':'POST'});case _0xfa00('0x55'):logger[_0xfa00('0xb')](_0xfa00('0x47'),_0xfa00('0x56'));emit(util['format'](_0xfa00('0x57'),_0x405382['name']),_0xfa00('0x58'),{'uri':util[_0xfa00('0x19')](_0xfa00('0x59'),_0x4bc0bc[_0xfa00('0xe')][_0xfa00('0x5a')](_0xfa00('0x5b'),''),_0x3d276a['id'])});break;default:logger[_0xfa00('0x5c')](_0xfa00('0x47'),_0xfa00('0x5d'));}}})['catch'](function(_0x47b7d0){logger[_0xfa00('0x5c')](_0xfa00('0x5e'),util[_0xfa00('0x5f')](_0x47b7d0,{'showHidden':!![],'depth':null}));});};exports[_0xfa00('0x60')]=function(_0xa74a31,_0x449b17,_0x107ed5,_0x504338,_0x4d2c05,_0x5dc3b9,_0x560108){var _0x31b189,_0x1baa45;_0x5dc3b9[_0xfa00('0xe')]=intUtil['stripTrailingSlash'](_0x5dc3b9[_0xfa00('0xe')]);_0x5dc3b9[_0xfa00('0x45')]=intUtil['stripTrailingSlash'](_0x5dc3b9[_0xfa00('0x45')]);if(_0x560108&&_0x560108[_0xfa00('0x61')]&&_0x560108[_0xfa00('0x61')]!==_0xfa00('0x62')){logger[_0xfa00('0xb')]('[OUTBOUND]',_0xfa00('0x48'));_0x449b17['recordingURL']=util[_0xfa00('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5dc3b9[_0xfa00('0x45')],_0x449b17[_0xfa00('0x63')],md5(_0x449b17[_0xfa00('0x63')]));}headers[_0xfa00('0x4b')]=getAuth(_0x5dc3b9);return getUser(_0x5dc3b9,_0x504338[_0xfa00('0x4c')])[_0xfa00('0x16')](function(_0x2efce0){_0x31b189=_0x2efce0;logger[_0xfa00('0xb')](_0xfa00('0x4d'),_0x31b189['id']);return getEndUser(_0x5dc3b9,_0x449b17[_0xfa00('0x64')],_0x449b17[_0xfa00('0x65')]);})[_0xfa00('0x16')](function(_0x2506e1){_0x1baa45=_0x2506e1;logger[_0xfa00('0xb')](_0xfa00('0x50'),_0x1baa45['id']);return getTicket(_0x5dc3b9,_0x31b189,_0x1baa45,_0x107ed5,_0x449b17);})[_0xfa00('0x16')](function(_0x4b33c2){if(_0x4b33c2){logger[_0xfa00('0xb')](_0xfa00('0x51'),_0x4b33c2['id']);switch(_0x5dc3b9[_0xfa00('0x38')]){case'integrationTab':logger[_0xfa00('0xb')]('[OUTBOUND]',_0xfa00('0x53'));return request({'uri':util[_0xfa00('0x19')](_0xfa00('0x54'),_0x5dc3b9['remoteUri'],_0x31b189['id'],_0x4b33c2['id']),'method':_0xfa00('0xf')});case _0xfa00('0x55'):logger['info'](_0xfa00('0x66'),_0xfa00('0x56'));emit(util[_0xfa00('0x19')](_0xfa00('0x57'),_0x504338['name']),_0xfa00('0x58'),{'uri':util[_0xfa00('0x19')](_0xfa00('0x59'),_0x5dc3b9[_0xfa00('0xe')][_0xfa00('0x5a')](_0xfa00('0x5b'),''),_0x4b33c2['id'])});break;default:logger[_0xfa00('0x5c')](_0xfa00('0x66'),_0xfa00('0x5d'));}}})[_0xfa00('0x67')](function(_0x2294d1){logger[_0xfa00('0x5c')](_0xfa00('0x68'),util[_0xfa00('0x5f')](_0x2294d1,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x55bf7c,_0x2b7aa9,_0x494b55,_0x57f170,_0x249eb3,_0x39f7f0){var _0x1ac680,_0x48b899;_0x39f7f0['remoteUri']=intUtil[_0xfa00('0x44')](_0x39f7f0[_0xfa00('0xe')]);_0x39f7f0[_0xfa00('0x45')]=intUtil['stripTrailingSlash'](_0x39f7f0[_0xfa00('0x45')]);if(_0x249eb3&&_0x249eb3[_0xfa00('0x46')]){logger['info']('['+_0x2b7aa9[_0xfa00('0x69')][_0xfa00('0x6a')]()+']',_0xfa00('0x48'));_0x2b7aa9[_0xfa00('0x49')]=util[_0xfa00('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39f7f0[_0xfa00('0x45')],_0x2b7aa9['uniqueid'],md5(_0x2b7aa9[_0xfa00('0x63')]));}else{_0x2b7aa9['recordingURL']='';}headers[_0xfa00('0x4b')]=getAuth(_0x39f7f0);return getUser(_0x39f7f0)[_0xfa00('0x16')](function(_0xa2869d){_0x1ac680=_0xa2869d;logger[_0xfa00('0xb')]('The\x20User\x20ID\x20is:',_0x1ac680['id']);return getEndUser(_0x39f7f0,_0x2b7aa9[_0xfa00('0x4e')],_0x2b7aa9[_0xfa00('0x4f')]);})[_0xfa00('0x16')](function(_0x229f14){_0x48b899=_0x229f14;logger[_0xfa00('0xb')]('The\x20Enduser\x20ID\x20is:',_0x48b899['id']);return getTicket(_0x39f7f0,_0x1ac680,_0x48b899,_0x494b55,_0x2b7aa9);})[_0xfa00('0x16')](function(_0x590dc3){if(_0x590dc3){logger[_0xfa00('0xb')](_0xfa00('0x51'),_0x590dc3['id']);}})['catch'](function(_0x50b83c){logger['error']('['+_0x2b7aa9[_0xfa00('0x69')][_0xfa00('0x6a')]()+']'+_0xfa00('0x6b'),util[_0xfa00('0x5f')](_0x50b83c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbbc5=['length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','custom_fields','push','variable','variableName','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Fields','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone'];(function(_0x284f2c,_0x17233e){var _0x48ced1=function(_0x38cdda){while(--_0x38cdda){_0x284f2c['push'](_0x284f2c['shift']());}};_0x48ced1(++_0x17233e);}(_0xbbc5,0x137));var _0x5bbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbc5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5bbc('0x0'));var rp=require('request-promise');var md5=require(_0x5bbc('0x1'));var util=require(_0x5bbc('0x2'));var Redis=require(_0x5bbc('0x3'));var intUtil=require(_0x5bbc('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5bbc('0x5'))(_0x5bbc('0x6'));config[_0x5bbc('0x7')]=_['defaults'](config['redis'],{'host':_0x5bbc('0x8'),'port':0x18eb});var io=require(_0x5bbc('0x9'))(new Redis(config[_0x5bbc('0x7')]));function emit(_0x2f45a9,_0xfefd27,_0x24ee14){io['to'](_0x2f45a9)[_0x5bbc('0xa')](_0xfefd27,_0x24ee14);}var headers={'Content-Type':_0x5bbc('0xb'),'Accept':_0x5bbc('0xb')};function getTicket(_0x16bbb4,_0x54bcfa,_0x1a29c9,_0x3c2e54,_0x600f73){logger[_0x5bbc('0xc')](_0x5bbc('0xd'));return request({'uri':util['format'](_0x5bbc('0xe'),_0x16bbb4[_0x5bbc('0xf')]),'method':_0x5bbc('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x1a29c9['id'],'submitter_id':_0x54bcfa?_0x54bcfa['id']:undefined,'assignee_id':_0x54bcfa?_0x54bcfa['id']:undefined,'tags':getTags(_0x3c2e54[_0x5bbc('0x11')],'name'),'subject':intUtil[_0x5bbc('0x12')](_0x3c2e54[_0x5bbc('0x13')],_0x600f73,'\x20'),'description':intUtil['getString'](_0x3c2e54['Descriptions'],_0x600f73,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5bbc('0x12')](_0x3c2e54['Descriptions'],_0x600f73,'\x0a')}},getCustomFields(_0x3c2e54[_0x5bbc('0x14')],_0x600f73))}})['then'](function(_0x26f16a){logger[_0x5bbc('0xc')](_0x5bbc('0x15'));return _0x26f16a[_0x5bbc('0x16')];});}function getUser(_0x155620,_0x3f3841){if(intUtil[_0x5bbc('0x17')](_0x3f3841)){logger[_0x5bbc('0xc')]('Getting\x20agent\x20with\x20email',_0x3f3841);return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x19'),_0x155620[_0x5bbc('0xf')]),'qs':{'query':util[_0x5bbc('0x18')]('type:user\x20role:agent\x20email:%s',_0x3f3841)}})['then'](function(_0x523b4e){if(_0x523b4e[_0x5bbc('0x1a')]){logger[_0x5bbc('0xc')](_0x5bbc('0x1b'));return _[_0x5bbc('0x1c')](_0x523b4e[_0x5bbc('0x1d')],{'email':_0x3f3841,'role':_0x5bbc('0x1e')});}else{logger['info'](_0x5bbc('0x1f'));return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x20'),_0x155620[_0x5bbc('0xf')])})[_0x5bbc('0x21')](function(_0x3dcbb5){logger[_0x5bbc('0xc')](_0x5bbc('0x22'));return _0x3dcbb5[_0x5bbc('0x23')];});}});}else{logger[_0x5bbc('0xc')](_0x5bbc('0x1f'));return request({'uri':util[_0x5bbc('0x18')]('%s/users/me.json',_0x155620[_0x5bbc('0xf')])})[_0x5bbc('0x21')](function(_0x4279c8){logger[_0x5bbc('0xc')](_0x5bbc('0x22'));return _0x4279c8[_0x5bbc('0x23')];});}}function getEndUser(_0x26e4ff,_0x5cb808,_0x548597){logger[_0x5bbc('0xc')](_0x5bbc('0x24'),_0x548597);return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x19'),_0x26e4ff[_0x5bbc('0xf')]),'qs':{'query':util[_0x5bbc('0x18')]('type:user\x20role:end-user\x20phone:%s',_0x548597)}})[_0x5bbc('0x21')](function(_0x36b682){var _0x18ab82;if(_0x36b682[_0x5bbc('0x1d')][_0x5bbc('0x25')]){_0x36b682['results']=_[_0x5bbc('0x26')](_0x36b682['results'],{'suspended':![],'role':_0x5bbc('0x27')});if(_0x36b682[_0x5bbc('0x1d')][_0x5bbc('0x25')]){_0x18ab82=_[_0x5bbc('0x28')](_0x36b682[_0x5bbc('0x1d')]);}}if(_0x18ab82){logger[_0x5bbc('0xc')](_0x5bbc('0x29'));return _0x18ab82;}else{logger[_0x5bbc('0xc')](_0x5bbc('0x2a'));return request({'uri':util['format'](_0x5bbc('0x2b'),_0x26e4ff['remoteUri']),'method':_0x5bbc('0x10'),'body':{'user':{'role':_0x5bbc('0x27'),'name':util[_0x5bbc('0x18')](_0x5bbc('0x2c'),_0x5cb808||_0x548597),'phone':_0x548597}}})['then'](function(_0x4c4708){logger['info'](_0x5bbc('0x2d'));return _0x4c4708[_0x5bbc('0x23')];});}});}function getAuth(_0x569a1e){var _0x55e790;if(_0x569a1e[_0x5bbc('0x2e')]===_0x5bbc('0x2f')){_0x55e790=util[_0x5bbc('0x18')](_0x5bbc('0x30'),_0x569a1e[_0x5bbc('0x31')],_0x569a1e[_0x5bbc('0x2f')]);}else if(_0x569a1e[_0x5bbc('0x2e')]===_0x5bbc('0x32')){_0x55e790=util['format']('%s/token:%s',_0x569a1e[_0x5bbc('0x31')],_0x569a1e[_0x5bbc('0x32')]);}return util['format'](_0x5bbc('0x33'),new Buffer(_0x55e790)['toString'](_0x5bbc('0x34')));}function request(_0x337698){logger[_0x5bbc('0x35')](_0x5bbc('0x36'),JSON[_0x5bbc('0x37')](_0x337698));return rp(_[_0x5bbc('0x38')](_0x337698,{'method':_0x5bbc('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x658661,_0x24cd6b){var _0x3a7c15=[];if(_0x658661&&_0x658661['length']>0x0){_0x3a7c15=_[_0x5bbc('0x3a')](_0x658661,_0x24cd6b);}return _0x3a7c15;}function getCustomFields(_0x33045e,_0x287757){var _0x3a084f=[];var _0x24f700={'custom_fields':[]};if(_0x33045e['length']>0x0){_[_0x5bbc('0x3b')](_0x33045e,function(_0x3cfe33){if(_[_0x5bbc('0x3c')]([_0x5bbc('0x3d'),_0x5bbc('0x3e')],_0x3cfe33[_0x5bbc('0x3f')])&&_0x3cfe33['nameField']&&!_0x3cfe33[_0x5bbc('0x40')]){_0x24f700[_0x3cfe33[_0x5bbc('0x41')][_0x5bbc('0x42')]()]=_0x3cfe33[_0x5bbc('0x43')][_0x5bbc('0x44')]();}else if(_['includes']([_0x5bbc('0x3d'),'picklist'],_0x3cfe33[_0x5bbc('0x3f')])&&_0x3cfe33[_0x5bbc('0x45')]&&_0x3cfe33[_0x5bbc('0x40')]){_0x24f700[_0x5bbc('0x46')][_0x5bbc('0x47')]({'id':_0x3cfe33[_0x5bbc('0x45')],'value':_0x3cfe33['content']['toString']()});}else if(_0x3cfe33[_0x5bbc('0x3f')]===_0x5bbc('0x48')&&_0x3cfe33[_0x5bbc('0x49')]&&_0x3cfe33[_0x5bbc('0x45')]&&_0x3cfe33[_0x5bbc('0x40')]){_0x287757[_0x3cfe33[_0x5bbc('0x49')]]&&_0x24f700[_0x5bbc('0x46')][_0x5bbc('0x47')]({'id':_0x3cfe33[_0x5bbc('0x45')],'value':_0x287757[_0x3cfe33['variableName']]['toString']()});}else if(_0x3cfe33['type']==='customVariable'&&_0x3cfe33[_0x5bbc('0x4a')]&&_0x3cfe33[_0x5bbc('0x4a')][_0x5bbc('0x4b')]&&_0x3cfe33[_0x5bbc('0x45')]&&_0x3cfe33[_0x5bbc('0x40')]){_0x287757[_0x3cfe33['Variable'][_0x5bbc('0x4b')]['toLowerCase']()]&&_0x24f700[_0x5bbc('0x46')][_0x5bbc('0x47')]({'id':_0x3cfe33['idField'],'value':_0x287757[_0x3cfe33['Variable'][_0x5bbc('0x4b')]['toLowerCase']()]['toString']()});}});}return _0x24f700;}exports[_0x5bbc('0x4c')]=function(_0x4cb299,_0x284f3e,_0x4c2867,_0x39a142,_0x12c7c3,_0x2f61c4){var _0x1ac5f8,_0x218a52;_0x2f61c4[_0x5bbc('0xf')]=intUtil['stripTrailingSlash'](_0x2f61c4['remoteUri']);_0x2f61c4[_0x5bbc('0x4d')]=intUtil[_0x5bbc('0x4e')](_0x2f61c4[_0x5bbc('0x4d')]);if(_0x12c7c3&&_0x12c7c3[_0x5bbc('0x4f')]){logger['info'](_0x5bbc('0x50'),_0x5bbc('0x51'));_0x284f3e[_0x5bbc('0x52')]=util[_0x5bbc('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f61c4[_0x5bbc('0x4d')],_0x284f3e[_0x5bbc('0x53')],md5(_0x284f3e[_0x5bbc('0x53')]));}else{_0x284f3e[_0x5bbc('0x52')]='';}headers['Authorization']=getAuth(_0x2f61c4);return getUser(_0x2f61c4,_0x39a142[_0x5bbc('0x54')])[_0x5bbc('0x21')](function(_0x4320b8){_0x1ac5f8=_0x4320b8;logger[_0x5bbc('0xc')](_0x5bbc('0x55'),_0x1ac5f8['id']);return getEndUser(_0x2f61c4,_0x284f3e[_0x5bbc('0x56')],_0x284f3e[_0x5bbc('0x57')]);})[_0x5bbc('0x21')](function(_0x5cea18){_0x218a52=_0x5cea18;logger[_0x5bbc('0xc')](_0x5bbc('0x58'),_0x218a52['id']);return getTicket(_0x2f61c4,_0x1ac5f8,_0x218a52,_0x4c2867,_0x284f3e);})[_0x5bbc('0x21')](function(_0x157dac){if(_0x157dac){logger[_0x5bbc('0xc')](_0x5bbc('0x59'),_0x157dac['id']);switch(_0x2f61c4[_0x5bbc('0x3f')]){case _0x5bbc('0x5a'):logger[_0x5bbc('0xc')](_0x5bbc('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2f61c4['remoteUri'],_0x1ac5f8['id'],_0x157dac['id']),'method':_0x5bbc('0x10')});case _0x5bbc('0x5b'):logger[_0x5bbc('0xc')](_0x5bbc('0x50'),_0x5bbc('0x5c'));emit(util[_0x5bbc('0x18')](_0x5bbc('0x5d'),_0x39a142[_0x5bbc('0x4b')]),'trigger:browser:url',{'uri':util[_0x5bbc('0x18')](_0x5bbc('0x5e'),_0x2f61c4['remoteUri']['replace'](_0x5bbc('0x5f'),''),_0x157dac['id'])});break;default:logger[_0x5bbc('0x60')]('[QUEUE]',_0x5bbc('0x61'));}}})[_0x5bbc('0x62')](function(_0x3a4d4a){logger[_0x5bbc('0x60')](_0x5bbc('0x63'),util[_0x5bbc('0x64')](_0x3a4d4a,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4390d1,_0x59643c,_0x346c0e,_0x1cc79a,_0x2b57f6,_0x3fd822,_0x47de30){var _0x42fd21,_0x274604;_0x3fd822[_0x5bbc('0xf')]=intUtil[_0x5bbc('0x4e')](_0x3fd822[_0x5bbc('0xf')]);_0x3fd822[_0x5bbc('0x4d')]=intUtil[_0x5bbc('0x4e')](_0x3fd822[_0x5bbc('0x4d')]);if(_0x47de30&&_0x47de30[_0x5bbc('0x65')]&&_0x47de30[_0x5bbc('0x65')]!==_0x5bbc('0x66')){logger[_0x5bbc('0xc')]('[OUTBOUND]',_0x5bbc('0x51'));_0x59643c[_0x5bbc('0x52')]=util[_0x5bbc('0x18')](_0x5bbc('0x67'),_0x3fd822[_0x5bbc('0x4d')],_0x59643c[_0x5bbc('0x53')],md5(_0x59643c[_0x5bbc('0x53')]));}headers[_0x5bbc('0x68')]=getAuth(_0x3fd822);return getUser(_0x3fd822,_0x1cc79a['email'])['then'](function(_0x19c574){_0x42fd21=_0x19c574;logger[_0x5bbc('0xc')]('The\x20User\x20ID\x20is:',_0x42fd21['id']);return getEndUser(_0x3fd822,_0x59643c[_0x5bbc('0x69')],_0x59643c['destcalleridnum']);})[_0x5bbc('0x21')](function(_0x5f0eeb){_0x274604=_0x5f0eeb;logger[_0x5bbc('0xc')](_0x5bbc('0x58'),_0x274604['id']);return getTicket(_0x3fd822,_0x42fd21,_0x274604,_0x346c0e,_0x59643c);})[_0x5bbc('0x21')](function(_0x439a8e){if(_0x439a8e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x439a8e['id']);switch(_0x3fd822[_0x5bbc('0x3f')]){case _0x5bbc('0x5a'):logger[_0x5bbc('0xc')](_0x5bbc('0x6a'),_0x5bbc('0x6b'));return request({'uri':util[_0x5bbc('0x18')](_0x5bbc('0x6c'),_0x3fd822['remoteUri'],_0x42fd21['id'],_0x439a8e['id']),'method':_0x5bbc('0x10')});case _0x5bbc('0x5b'):logger[_0x5bbc('0xc')](_0x5bbc('0x6a'),_0x5bbc('0x5c'));emit(util[_0x5bbc('0x18')](_0x5bbc('0x5d'),_0x1cc79a[_0x5bbc('0x4b')]),_0x5bbc('0x6d'),{'uri':util[_0x5bbc('0x18')](_0x5bbc('0x5e'),_0x3fd822['remoteUri'][_0x5bbc('0x6e')]('/api/v2',''),_0x439a8e['id'])});break;default:logger[_0x5bbc('0x60')](_0x5bbc('0x6a'),_0x5bbc('0x61'));}}})[_0x5bbc('0x62')](function(_0x40f9f0){logger[_0x5bbc('0x60')](_0x5bbc('0x6f'),util[_0x5bbc('0x64')](_0x40f9f0,{'showHidden':!![],'depth':null}));});};exports[_0x5bbc('0x70')]=function(_0x2ff5d6,_0x3ab71d,_0x4c8bf0,_0x52bf9f,_0x131905,_0x5c7073){var _0x465f97,_0x158d64;_0x5c7073[_0x5bbc('0xf')]=intUtil[_0x5bbc('0x4e')](_0x5c7073[_0x5bbc('0xf')]);_0x5c7073[_0x5bbc('0x4d')]=intUtil[_0x5bbc('0x4e')](_0x5c7073['serverUrl']);if(_0x131905&&_0x131905[_0x5bbc('0x4f')]){logger[_0x5bbc('0xc')]('['+_0x3ab71d[_0x5bbc('0x71')][_0x5bbc('0x72')]()+']',_0x5bbc('0x51'));_0x3ab71d[_0x5bbc('0x52')]=util['format'](_0x5bbc('0x67'),_0x5c7073['serverUrl'],_0x3ab71d[_0x5bbc('0x53')],md5(_0x3ab71d[_0x5bbc('0x53')]));}else{_0x3ab71d[_0x5bbc('0x52')]='';}headers['Authorization']=getAuth(_0x5c7073);return getUser(_0x5c7073)[_0x5bbc('0x21')](function(_0x463cf9){_0x465f97=_0x463cf9;logger['info'](_0x5bbc('0x55'),_0x465f97['id']);return getEndUser(_0x5c7073,_0x3ab71d[_0x5bbc('0x56')],_0x3ab71d['calleridnum']);})[_0x5bbc('0x21')](function(_0x3cf11a){_0x158d64=_0x3cf11a;logger[_0x5bbc('0xc')](_0x5bbc('0x58'),_0x158d64['id']);return getTicket(_0x5c7073,_0x465f97,_0x158d64,_0x4c8bf0,_0x3ab71d);})[_0x5bbc('0x21')](function(_0x36d38f){if(_0x36d38f){logger[_0x5bbc('0xc')](_0x5bbc('0x59'),_0x36d38f['id']);}})[_0x5bbc('0x62')](function(_0x3cae89){logger[_0x5bbc('0x60')]('['+_0x3ab71d[_0x5bbc('0x71')]['toUpperCase']()+']'+_0x5bbc('0x73'),util['inspect'](_0x3cae89,{'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 e85a646..9c189a5 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 _0x91f3=['idField','content','type','variable','variableName','customVariable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','refresh_token','then','catch','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','Owner','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','details','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','user:%s','unmanaged','lastevent','com','calleridnum','toUpperCase','lodash','request-promise','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','length','includes','string','picklist'];(function(_0x46c865,_0x154b2f){var _0x200973=function(_0x6c1275){while(--_0x6c1275){_0x46c865['push'](_0x46c865['shift']());}};_0x200973(++_0x154b2f);}(_0x91f3,0x19d));var _0x391f=function(_0x53c4ec,_0x272441){_0x53c4ec=_0x53c4ec-0x0;var _0xcc8b0e=_0x91f3[_0x53c4ec];return _0xcc8b0e;};'use strict';var _=require(_0x391f('0x0'));var rp=require(_0x391f('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x391f('0x2'));var moment=require(_0x391f('0x3'));var Redis=require(_0x391f('0x4'));var BPromise=require(_0x391f('0x5'));var config=require(_0x391f('0x6'));var logger=require(_0x391f('0x7'))(_0x391f('0x8'));config[_0x391f('0x9')]=_[_0x391f('0xa')](config['redis'],{'host':_0x391f('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x391f('0x9')]));function emit(_0x5e1332,_0x5bd10a,_0x45620f){io['to'](_0x5e1332)[_0x391f('0xc')](_0x5bd10a,_0x45620f);}function request(_0x393e0f){logger[_0x391f('0xd')](_0x391f('0xe'),JSON['stringify'](_0x393e0f));return rp(_0x393e0f);}function getCustomFields(_0x514061,_0x5abdda){var _0x19dc38={};if(_0x514061[_0x391f('0xf')]>0x0){_['forEach'](_0x514061,function(_0x11f374){if(_[_0x391f('0x10')]([_0x391f('0x11'),_0x391f('0x12')],_0x11f374['type'])&&_0x11f374['idField']){_0x19dc38[_0x11f374[_0x391f('0x13')]]=_0x11f374[_0x391f('0x14')]['toString']();}else if(_0x11f374[_0x391f('0x15')]===_0x391f('0x16')&&_0x11f374[_0x391f('0x17')]&&_0x11f374[_0x391f('0x13')]&&_0x5abdda[_0x11f374[_0x391f('0x17')]]){_0x19dc38[_0x11f374[_0x391f('0x13')]]=_0x5abdda[_0x11f374[_0x391f('0x17')]]['toString']();}else if(_0x11f374['type']===_0x391f('0x18')&&_0x11f374['Variable']&&_0x11f374['Variable'][_0x391f('0x19')]&&_0x11f374[_0x391f('0x13')]&&_0x5abdda[_0x11f374['Variable'][_0x391f('0x19')][_0x391f('0x1a')]()]){_0x19dc38[_0x11f374[_0x391f('0x13')]]=_0x5abdda[_0x11f374['Variable']['name'][_0x391f('0x1a')]()]['toString']();}});}return _0x19dc38;}function getName(_0x89e2d0){if(_0x89e2d0[_0x391f('0x1b')]('\x20')>0x0){var _0x2d5b2c=_0x89e2d0['split'](/ (.+)/);if(_0x2d5b2c[0x1]){return _0x2d5b2c;}}return[_0x89e2d0,_0x89e2d0];}var accountsTokens={};function getAccessToken(_0x1bd262){return new Promise(function(_0x30f11f,_0x4ae0ea){if(!_[_0x391f('0x1c')](accountsTokens[_0x1bd262['id']])&&!_[_0x391f('0x1c')](accountsTokens[_0x1bd262['id']][_0x391f('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x1bd262['id']][_0x391f('0x1e')])){_0x30f11f(accountsTokens[_0x1bd262['id']][_0x391f('0x1d')]);}}var _0x374d53;switch(_0x1bd262[_0x391f('0x1f')]){case'US':_0x374d53=_0x391f('0x20');break;case'AU':_0x374d53=_0x391f('0x21');break;case'EU':_0x374d53=_0x391f('0x22');break;case'IN':_0x374d53='https://accounts.zoho.in';break;case'CN':_0x374d53='https://accounts.zoho.com.cn';break;default:_0x374d53=_0x391f('0x22');break;}var _0xa11297={'method':_0x391f('0x23'),'uri':_0x374d53+_0x391f('0x24'),'qs':{'refresh_token':_0x1bd262['refreshToken'],'client_id':_0x1bd262['clientId'],'client_secret':_0x1bd262[_0x391f('0x25')],'grant_type':_0x391f('0x26')},'json':!![]};return rp(_0xa11297)[_0x391f('0x27')](function(_0x196c8b){accountsTokens[_0x1bd262['id']]={'access_token':_0x196c8b[_0x391f('0x1d')],'expires_in':moment()['add'](_0x196c8b[_0x391f('0x1e')],'seconds')};_0x30f11f(_0x196c8b[_0x391f('0x1d')]);})[_0x391f('0x28')](function(_0xe83b1f){logger['error']('Failing\x20creating\x20the\x20access_token',_0xe83b1f[_0x391f('0x29')]);_0x4ae0ea(_0xe83b1f);});});}function getUser(_0x44362b,_0x1f40e6,_0x294bed,_0x5db9a5){logger[_0x391f('0x2a')](_0x391f('0x2b'));return request({'method':_0x391f('0x2c'),'uri':util[_0x391f('0x2d')](_0x391f('0x2e'),_0x1f40e6),'qs':{'type':_0x391f('0x2f')},'headers':{'Authorization':_0x391f('0x30')+_0x44362b},'json':!![]})['then'](function(_0x4b5172){if(_0x4b5172['users']){var _0x206238=-0x1;if(_[_0x391f('0x31')](_0x4b5172['users'])){if(!_[_0x391f('0x1c')](_0x5db9a5)){_0x206238=_[_0x391f('0x32')](_0x4b5172[_0x391f('0x33')],function(_0xfafb20){return _0xfafb20[_0x391f('0x34')]===_0x5db9a5;});}if(_0x206238>=0x0){logger[_0x391f('0x2a')](_0x391f('0x35'));}else{logger[_0x391f('0x2a')](_0x391f('0x36'));_0x206238=_[_0x391f('0x32')](_0x4b5172['users'],function(_0xb8a8ad){return _0xb8a8ad[_0x391f('0x37')][_0x391f('0x19')]==='Administrator';});}return _0x4b5172[_0x391f('0x33')][_0x206238];}else{if(_0x4b5172['user']['profile']['name']===_0x391f('0x38')){logger[_0x391f('0x2a')](_0x391f('0x36'));user=_0x4b5172[_0x391f('0x39')];return user;}else{logger[_0x391f('0x3a')](_0x391f('0x3b'),JSON['stringify'](_0x4b5172));throw new Error(_0x391f('0x3c')+JSON[_0x391f('0x3d')](_0x4b5172));}}}else{logger['error'](_0x391f('0x3b'),JSON[_0x391f('0x3d')](_0x4b5172));throw new Error(_0x391f('0x3c')+JSON[_0x391f('0x3d')](_0x4b5172));}})['catch'](function(_0x1d5955){console['error'](_0x1d5955);});}function getZohoUser(_0x21ad81,_0x4c5805){return new BPromise(function(_0x4c9ba6,_0x4e30c1){request(_0x21ad81)['then'](function(_0x44329d){var _0xa299d1=null;if(_0x44329d){_0xa299d1=_0x44329d[_0x391f('0x3e')][0x0];_0xa299d1[_0x391f('0x3f')]=_0x4c5805;}_0x4c9ba6(_0xa299d1);})[_0x391f('0x28')](function(_0x2d68eb){_0x4e30c1(_0x2d68eb);});});}function createEndUser(_0x3f4a40,_0x3f10cb,_0x4d7ede,_0x2bb3ae,_0x26ba15,_0x3896eb){var _0x4d7ede=getName(_0x4d7ede);return request({'method':_0x391f('0x23'),'uri':_0x391f('0x40')+_0x3f10cb+'/crm/v2/'+_[_0x391f('0x41')](_0x3896eb[_0x391f('0x42')])+'s','body':{'data':[{'Last_Name':_0x4d7ede[0x1],'First_Name':_0x4d7ede[0x0],'Phone':_0x2bb3ae,'Owner':{'name':!_[_0x391f('0x1c')](_0x26ba15[_0x391f('0x43')][_0x391f('0x19')])?_0x26ba15['role'][_0x391f('0x19')]:!_[_0x391f('0x1c')](_0x26ba15[_0x391f('0x44')])?_0x26ba15['first_name']+'\x20'+_0x26ba15[_0x391f('0x45')]:_0x26ba15['last_name'],'id':_0x26ba15['id']}}]},'headers':{'Authorization':_0x391f('0x30')+_0x3f4a40},'json':!![]})['then'](function(_0x10ae19){if(_0x10ae19&&_0x10ae19['data'][0x0][_0x391f('0x46')]==='SUCCESS'){var _0x15bb0d=_0x10ae19['data'][0x0]['details'];_0x15bb0d[_0x391f('0x3f')]=_[_0x391f('0x41')](_0x3896eb[_0x391f('0x42')])+'s';return _0x15bb0d;}logger['error'](_0x391f('0x3b'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x391f('0x3d')](data));})[_0x391f('0x28')](function(_0x2f0da8){console[_0x391f('0x47')](_0x391f('0x48'),_0x2f0da8);});}function getEndUser(_0x1ffa46,_0x389b62,_0x3db023,_0x310316,_0x2c76fa,_0x508c46,_0x5e7aef){var _0x4f9670={'method':'GET','uri':'','headers':{'Authorization':_0x391f('0x30')+_0x1ffa46},'json':!![]};switch(_0x5e7aef[_0x391f('0x49')]){case _0x391f('0x4a'):_0x4f9670[_0x391f('0x4b')]=_0x391f('0x40')+_0x389b62+_0x391f('0x4c')+_0x2c76fa+'))';return getZohoUser(_0x4f9670,_0x391f('0x4d'))[_0x391f('0x27')](function(_0x3b6156){if(_0x3b6156)return _0x3b6156;_0x4f9670[_0x391f('0x4b')]=_0x391f('0x40')+_0x389b62+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2c76fa+'))';return getZohoUser(_0x4f9670,_0x391f('0x4e'))[_0x391f('0x27')](function(_0x48cd4c){if(_0x48cd4c)return _0x48cd4c;if(_0x5e7aef['moduleCreate']!=_0x391f('0x4f')){return createEndUser(_0x1ffa46,_0x389b62,_0x310316,_0x2c76fa,_0x508c46,_0x5e7aef);}else{return{};}});});break;case _0x391f('0x50'):_0x4f9670[_0x391f('0x4b')]='https://www.zohoapis.'+_0x389b62+_0x391f('0x4c')+_0x2c76fa+'))';return getZohoUser(_0x4f9670,_0x391f('0x4d'))[_0x391f('0x27')](function(_0x52d070){if(_0x52d070)return _0x52d070;if(_0x5e7aef[_0x391f('0x42')]!=_0x391f('0x4f')){return createEndUser(_0x1ffa46,_0x389b62,_0x310316,_0x2c76fa,_0x508c46,_0x5e7aef);}else{return{};}});break;case _0x391f('0x51'):_0x4f9670[_0x391f('0x4b')]=_0x391f('0x40')+_0x389b62+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2c76fa+'))';return getZohoUser(_0x4f9670,_0x391f('0x4e'))[_0x391f('0x27')](function(_0x4d513e){if(_0x4d513e)return _0x4d513e;if(_0x5e7aef[_0x391f('0x42')]!='nothing'){return createEndUser(_0x1ffa46,_0x389b62,_0x310316,_0x2c76fa,_0x508c46,_0x5e7aef);}else{return{};}});break;}}function getCall(_0x42419a,_0xf2ea81,_0x2e615e,_0x2e1cf2,_0x5e2835,_0x51eb71,_0x1650f4,_0x317376){logger[_0x391f('0x2a')]('Creating\x20new\x20call...');var _0x47bf58={};_0x47bf58[_0x391f('0x52')]={'name':!_[_0x391f('0x1c')](_0x2e1cf2[_0x391f('0x43')][_0x391f('0x19')])&&!_['isNil'](_0x2e1cf2['profile']['name'])&&_0x2e1cf2[_0x391f('0x37')][_0x391f('0x19')]==='administrator'?_0x2e1cf2[_0x391f('0x43')][_0x391f('0x19')]:!_[_0x391f('0x1c')](_0x2e1cf2[_0x391f('0x44')])?_0x2e1cf2[_0x391f('0x44')]+'\x20'+_0x2e1cf2['last_name']:_0x2e1cf2['last_name'],'id':_0x2e1cf2['id']};_0x47bf58['Subject']=intUtil[_0x391f('0x53')](_0x51eb71[_0x391f('0x54')],_0x1650f4,'\x20');_0x47bf58[_0x391f('0x55')]=intUtil[_0x391f('0x53')](_0x51eb71['Descriptions'],_0x1650f4,'\x0a');if(_0x5e2835[_0x391f('0x3f')]===_0x391f('0x4d')){_0x47bf58[_0x391f('0x56')]={'name':!_[_0x391f('0x1c')](_0x5e2835[_0x391f('0x57')])?_0x5e2835[_0x391f('0x57')]:!_['isNil'](_0x5e2835[_0x391f('0x58')])?_0x5e2835[_0x391f('0x58')]+'\x20'+_0x5e2835[_0x391f('0x59')]:_0x5e2835[_0x391f('0x59')],'id':_0x5e2835['id']};}if(_0x5e2835[_0x391f('0x3f')]==='Leads'){_0x47bf58[_0x391f('0x5a')]={'name':!_['isNil'](_0x5e2835[_0x391f('0x57')])?_0x5e2835[_0x391f('0x57')]:!_[_0x391f('0x1c')](_0x5e2835[_0x391f('0x58')])?_0x5e2835[_0x391f('0x58')]+'\x20'+_0x5e2835[_0x391f('0x59')]:_0x5e2835['Last_Name'],'id':_0x5e2835['id']};_0x47bf58[_0x391f('0x5b')]=_[_0x391f('0x41')](_0x5e2835[_0x391f('0x3f')]);}if(_0x1650f4[_0x391f('0x5c')]){_0x47bf58[_0x391f('0x5d')]=moment[_0x391f('0x5e')](parseInt(_0x1650f4[_0x391f('0x5c')])*0x3e8)[_0x391f('0x2d')](_0x391f('0x5f'));}else if(_0x1650f4['answertime']&&_0x1650f4[_0x391f('0x60')]){_0x47bf58[_0x391f('0x5d')]=moment[_0x391f('0x5e')](moment(_0x1650f4[_0x391f('0x60')],_0x391f('0x61'))[_0x391f('0x62')](moment(_0x1650f4[_0x391f('0x63')],_0x391f('0x61'))))[_0x391f('0x2d')]('mm:ss');}switch(_0x1650f4['lastevent']){case _0x391f('0x64'):_0x47bf58[_0x391f('0x65')]=_0x391f('0x66');break;case _0x391f('0x67'):case _0x391f('0x68'):_0x47bf58[_0x391f('0x65')]=_0x391f('0x69');break;case _0x391f('0x6a'):_0x47bf58['Call_Result']=_0x391f('0x6b');break;case'abandoned':_0x47bf58['Call_Result']='Abandoned';break;case'timeout':_0x47bf58[_0x391f('0x65')]=_0x391f('0x6c');default:}_0x47bf58['Call_Start_Time']=(_0x317376===_0x391f('0x6d')?moment(_0x1650f4[_0x391f('0x63')])[_0x391f('0x2d')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1650f4[_0x391f('0x6e')])[_0x391f('0x2d')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x391f('0x2d')](_0x391f('0x61'));_0x47bf58[_0x391f('0x6f')]=_0x317376||_0x391f('0x70');_0x47bf58=_[_0x391f('0x71')](_0x47bf58,getCustomFields(_0x51eb71['Fields'],_0x1650f4));return request({'method':_0x391f('0x23'),'uri':_0x391f('0x40')+_0xf2ea81+_0x391f('0x72'),'headers':{'Authorization':_0x391f('0x30')+_0x42419a},'body':{'data':[_0x47bf58]},'json':!![]})[_0x391f('0x27')](function(_0x2a93f0){if(_0x2a93f0&&_0x2a93f0[_0x391f('0x3e')][0x0][_0x391f('0x46')]==='SUCCESS'){logger[_0x391f('0x2a')]('Call\x20created!');return{'id':_0x2a93f0['data'][0x0][_0x391f('0x73')]['id']};}})[_0x391f('0x28')](function(_0x500b35){logger[_0x391f('0x2a')](_0x391f('0x74'),_0x500b35[_0x391f('0x29')]);console[_0x391f('0x47')](_0x391f('0x74'),_0x500b35);});}exports[_0x391f('0x75')]=function(_0x3c1712,_0x4d0f3d,_0x2b9821,_0x3933ef,_0x4d5d23,_0xc244d5){var _0x2575ff,_0x259be4,_0x17b1ab;_0xc244d5['host']=intUtil[_0x391f('0x76')](_0xc244d5[_0x391f('0x77')]);_0xc244d5[_0x391f('0x78')]=intUtil[_0x391f('0x76')](_0xc244d5['serverUrl']);if(_0x4d5d23&&_0x4d5d23[_0x391f('0x79')]){logger['info'](_0x391f('0x7a'),_0x391f('0x7b'));_0x4d0f3d[_0x391f('0x7c')]=_0xc244d5[_0x391f('0x78')]+_0x391f('0x7d')+_0x4d0f3d[_0x391f('0x7e')]+_0x391f('0x7f')+md5(_0x4d0f3d[_0x391f('0x7e')]);}else{_0x4d0f3d[_0x391f('0x7c')]='';}var _0x175769=_0xc244d5[_0x391f('0x77')]===_0x391f('0x80')?'eu':'com';return getAccessToken(_0xc244d5)[_0x391f('0x27')](function(_0x164ff1){_0x17b1ab=_0x164ff1;return getUser(_0x17b1ab,_0x175769,_0xc244d5,_0x3933ef[_0x391f('0x34')]);})[_0x391f('0x27')](function(_0x123a56){_0x2575ff=_0x123a56;logger[_0x391f('0x2a')]('The\x20User\x20ID\x20is:',_0x2575ff['id']);return getEndUser(_0x17b1ab,_0x175769,_0xc244d5,_0x4d0f3d[_0x391f('0x81')],_0x4d0f3d['calleridnum'],_0x2575ff,_0x2b9821);})[_0x391f('0x27')](function(_0x174a2a){_0x259be4=_0x174a2a;return getCall(_0x17b1ab,_0x175769,_0xc244d5,_0x2575ff,_0x259be4,_0x2b9821,_0x4d0f3d,_0x391f('0x70'));})[_0x391f('0x27')](function(_0x162d4e){if(_0x162d4e){logger[_0x391f('0x2a')](_0x391f('0x82'),_0x162d4e['id']);logger['info'](_0x391f('0x7a'),_0x391f('0x83'));emit(util[_0x391f('0x2d')]('user:%s',_0x3933ef['name']),_0x391f('0x84'),{'uri':_0x391f('0x85')+_0xc244d5[_0x391f('0x77')]+_0x391f('0x86')+_0x162d4e['id']});}})[_0x391f('0x28')](function(_0x3cc03c){logger['error'](_0x391f('0x7a'),JSON[_0x391f('0x3d')](_0x3cc03c));});};exports[_0x391f('0x6d')]=function(_0x3ee595,_0x27504d,_0x26ab73,_0x4a8386,_0x12a611,_0x28593f,_0x2dfc94){var _0x543647,_0x5421e8,_0x1ce299;_0x28593f[_0x391f('0x77')]=intUtil['stripTrailingSlash'](_0x28593f[_0x391f('0x77')]);_0x28593f[_0x391f('0x78')]=intUtil[_0x391f('0x76')](_0x28593f[_0x391f('0x78')]);if(_0x2dfc94&&_0x2dfc94[_0x391f('0x87')]&&_0x2dfc94[_0x391f('0x87')]!=='none'){logger[_0x391f('0x2a')](_0x391f('0x88'),_0x391f('0x7b'));_0x27504d[_0x391f('0x7c')]=_0x28593f[_0x391f('0x78')]+_0x391f('0x7d')+_0x27504d[_0x391f('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x27504d[_0x391f('0x7e')]);}var _0x3cf081=_0x28593f[_0x391f('0x77')]===_0x391f('0x80')?'eu':'com';return getAccessToken(_0x28593f)['then'](function(_0x5e233a){_0x1ce299=_0x5e233a;return getUser(_0x1ce299,_0x3cf081,_0x28593f,_0x4a8386[_0x391f('0x34')]);})[_0x391f('0x27')](function(_0x2c8dc2){_0x543647=_0x2c8dc2;logger['info'](_0x391f('0x89'),_0x543647['id']);return getEndUser(_0x1ce299,_0x3cf081,_0x28593f,_0x27504d['destcalleridname'],_0x27504d['destcalleridnum'],_0x543647,_0x26ab73);})[_0x391f('0x27')](function(_0x20d097){_0x5421e8=_0x20d097;return getCall(_0x1ce299,_0x3cf081,_0x28593f,_0x543647,_0x5421e8,_0x26ab73,_0x27504d,'Outbound');})[_0x391f('0x27')](function(_0x56b5f6){if(_0x56b5f6){logger['info'](_0x391f('0x82'),_0x56b5f6['id']);logger[_0x391f('0x2a')](_0x391f('0x88'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x391f('0x2d')](_0x391f('0x8a'),_0x4a8386['name']),'trigger:browser:url',{'uri':_0x391f('0x85')+_0x28593f[_0x391f('0x77')]+_0x391f('0x86')+_0x56b5f6['id']});}})[_0x391f('0x28')](function(_0x3fbecc){logger[_0x391f('0x3a')]('[OUTBOUND]',JSON[_0x391f('0x3d')](_0x3fbecc));});};exports[_0x391f('0x8b')]=function(_0x5a205d,_0x113e61,_0x1625ea,_0x127473,_0x381db6,_0x168ee6){var _0x50f9ed,_0x5c1ef7,_0x4c3264;_0x168ee6[_0x391f('0x77')]=intUtil[_0x391f('0x76')](_0x168ee6[_0x391f('0x77')]);_0x168ee6['serverUrl']=intUtil[_0x391f('0x76')](_0x168ee6[_0x391f('0x78')]);if(_0x381db6&&_0x381db6[_0x391f('0x79')]){logger['info']('['+_0x113e61[_0x391f('0x8c')]['toUpperCase']()+']',_0x391f('0x7b'));_0x113e61[_0x391f('0x7c')]=_0x168ee6[_0x391f('0x78')]+_0x391f('0x7d')+_0x113e61[_0x391f('0x7e')]+_0x391f('0x7f')+md5(_0x113e61[_0x391f('0x7e')]);}else{_0x113e61[_0x391f('0x7c')]='';}var _0x46796f=_0x168ee6[_0x391f('0x77')]==='zoho.eu'?'eu':_0x391f('0x8d');return getAccessToken(_0x168ee6)[_0x391f('0x27')](function(_0x2129c7){_0x4c3264=_0x2129c7;return getUser(_0x4c3264,_0x46796f,_0x168ee6);})['then'](function(_0x5b9297){_0x50f9ed=_0x5b9297;logger[_0x391f('0x2a')]('The\x20User\x20ID\x20is:',_0x50f9ed['id']);return getEndUser(_0x4c3264,_0x46796f,_0x168ee6,_0x113e61[_0x391f('0x81')],_0x113e61[_0x391f('0x8e')],_0x50f9ed,_0x1625ea);})[_0x391f('0x27')](function(_0x1f370b){_0x5c1ef7=_0x1f370b;return getCall(_0x4c3264,_0x46796f,_0x168ee6,_0x50f9ed,_0x5c1ef7,_0x1625ea,_0x113e61,'Inbound');})[_0x391f('0x27')](function(_0x288d57){if(_0x288d57){logger[_0x391f('0x2a')]('The\x20Call\x20ID\x20is:',_0x288d57['id']);}})[_0x391f('0x28')](function(_0x33ffc1){logger[_0x391f('0x3a')]('['+_0x113e61[_0x391f('0x8c')][_0x391f('0x8f')]()+']',JSON[_0x391f('0x3d')](_0x33ffc1));});}; \ No newline at end of file +var _0xa90d=['content','toString','variable','variableName','idField','type','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','Failing\x20creating\x20the\x20access_token','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','then','users','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','log','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','answertime','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','Call_Type','merge','Fields','POST','code','Call\x20created!','err','stack','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','Inbound','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','calleridnum','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','emit','debug','stringify','length','picklist'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa90d,0x1b1));var _0xda90=function(_0x39ae82,_0x3893d6){_0x39ae82=_0x39ae82-0x0;var _0x2c4f77=_0xa90d[_0x39ae82];return _0x2c4f77;};'use strict';var _=require('lodash');var rp=require(_0xda90('0x0'));var md5=require(_0xda90('0x1'));var util=require(_0xda90('0x2'));var intUtil=require(_0xda90('0x3'));var moment=require(_0xda90('0x4'));var Redis=require(_0xda90('0x5'));var BPromise=require(_0xda90('0x6'));var config=require(_0xda90('0x7'));var logger=require(_0xda90('0x8'))(_0xda90('0x9'));config[_0xda90('0xa')]=_['defaults'](config['redis'],{'host':_0xda90('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda90('0xa')]));function emit(_0x507ad6,_0x17cc8e,_0x486b20){io['to'](_0x507ad6)[_0xda90('0xc')](_0x17cc8e,_0x486b20);}function request(_0x4f330b){logger[_0xda90('0xd')]('[HTTP]',JSON[_0xda90('0xe')](_0x4f330b));return rp(_0x4f330b);}function getCustomFields(_0x3e2fca,_0x51cfbd){var _0x2493bd={};if(_0x3e2fca[_0xda90('0xf')]>0x0){_['forEach'](_0x3e2fca,function(_0x352201){if(_['includes'](['string',_0xda90('0x10')],_0x352201['type'])&&_0x352201['idField']){_0x2493bd[_0x352201['idField']]=_0x352201[_0xda90('0x11')][_0xda90('0x12')]();}else if(_0x352201['type']===_0xda90('0x13')&&_0x352201[_0xda90('0x14')]&&_0x352201['idField']&&_0x51cfbd[_0x352201['variableName']]){_0x2493bd[_0x352201[_0xda90('0x15')]]=_0x51cfbd[_0x352201[_0xda90('0x14')]]['toString']();}else if(_0x352201[_0xda90('0x16')]===_0xda90('0x17')&&_0x352201[_0xda90('0x18')]&&_0x352201[_0xda90('0x18')][_0xda90('0x19')]&&_0x352201[_0xda90('0x15')]&&_0x51cfbd[_0x352201[_0xda90('0x18')]['name'][_0xda90('0x1a')]()]){_0x2493bd[_0x352201[_0xda90('0x15')]]=_0x51cfbd[_0x352201['Variable']['name'][_0xda90('0x1a')]()][_0xda90('0x12')]();}});}return _0x2493bd;}function getName(_0xda189d){if(_0xda189d[_0xda90('0x1b')]('\x20')>0x0){var _0x41cb71=_0xda189d[_0xda90('0x1c')](/ (.+)/);if(_0x41cb71[0x1]){return _0x41cb71;}}return[_0xda189d,_0xda189d];}var accountsTokens={};function getAccessToken(_0x7265c4){return new Promise(function(_0x55a864,_0x41cbf0){if(!_[_0xda90('0x1d')](accountsTokens[_0x7265c4['id']])&&!_[_0xda90('0x1d')](accountsTokens[_0x7265c4['id']][_0xda90('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x7265c4['id']][_0xda90('0x1f')])){_0x55a864(accountsTokens[_0x7265c4['id']][_0xda90('0x1e')]);}}var _0x5adfd4;switch(_0x7265c4['zone']){case'US':_0x5adfd4=_0xda90('0x20');break;case'AU':_0x5adfd4=_0xda90('0x21');break;case'EU':_0x5adfd4=_0xda90('0x22');break;case'IN':_0x5adfd4=_0xda90('0x23');break;case'CN':_0x5adfd4='https://accounts.zoho.com.cn';break;default:_0x5adfd4='https://accounts.zoho.eu';break;}var _0x3544ba={'method':'POST','uri':_0x5adfd4+_0xda90('0x24'),'qs':{'refresh_token':_0x7265c4[_0xda90('0x25')],'client_id':_0x7265c4[_0xda90('0x26')],'client_secret':_0x7265c4[_0xda90('0x27')],'grant_type':_0xda90('0x28')},'json':!![]};return rp(_0x3544ba)['then'](function(_0x586aae){accountsTokens[_0x7265c4['id']]={'access_token':_0x586aae[_0xda90('0x1e')],'expires_in':moment()[_0xda90('0x29')](_0x586aae[_0xda90('0x1f')],_0xda90('0x2a'))};_0x55a864(_0x586aae[_0xda90('0x1e')]);})['catch'](function(_0x46f3f1){logger['error'](_0xda90('0x2b'),_0x46f3f1['stack']);_0x41cbf0(_0x46f3f1);});});}function getUser(_0x4f1da5,_0x3edadd,_0x1ac488,_0x2254af){logger[_0xda90('0x2c')](_0xda90('0x2d'));return request({'method':'GET','uri':util['format'](_0xda90('0x2e'),_0x3edadd),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4f1da5},'json':!![]})[_0xda90('0x2f')](function(_0x260c58){if(_0x260c58['users']){var _0x35391b=-0x1;if(_['isArrayLikeObject'](_0x260c58[_0xda90('0x30')])){if(!_[_0xda90('0x1d')](_0x2254af)){_0x35391b=_[_0xda90('0x31')](_0x260c58[_0xda90('0x30')],function(_0x58556c){return _0x58556c[_0xda90('0x32')]===_0x2254af;});}if(_0x35391b>=0x0){logger[_0xda90('0x2c')](_0xda90('0x33'));}else{logger[_0xda90('0x2c')]('Using\x20the\x20admin\x20account!');_0x35391b=_[_0xda90('0x31')](_0x260c58[_0xda90('0x30')],function(_0x41cfa4){return _0x41cfa4[_0xda90('0x34')][_0xda90('0x19')]===_0xda90('0x35');});}return _0x260c58[_0xda90('0x30')][_0x35391b];}else{if(_0x260c58['user'][_0xda90('0x34')]['name']===_0xda90('0x35')){logger[_0xda90('0x2c')](_0xda90('0x36'));user=_0x260c58[_0xda90('0x37')];return user;}else{logger[_0xda90('0x38')](_0xda90('0x39'),JSON[_0xda90('0xe')](_0x260c58));throw new Error(_0xda90('0x3a')+JSON[_0xda90('0xe')](_0x260c58));}}}else{logger[_0xda90('0x38')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x260c58));throw new Error(_0xda90('0x3a')+JSON[_0xda90('0xe')](_0x260c58));}})[_0xda90('0x3b')](function(_0x663f7c){console[_0xda90('0x38')](_0x663f7c);});}function getZohoUser(_0x296990,_0x3e2b18){return new BPromise(function(_0x422bcb,_0x3ca652){request(_0x296990)['then'](function(_0x1eb293){var _0x28b2b3=null;if(_0x1eb293){_0x28b2b3=_0x1eb293[_0xda90('0x3c')][0x0];_0x28b2b3[_0xda90('0x3d')]=_0x3e2b18;}_0x422bcb(_0x28b2b3);})[_0xda90('0x3b')](function(_0x502b14){_0x3ca652(_0x502b14);});});}function createEndUser(_0x3f6fd3,_0x4aa05c,_0x2ee67c,_0x2f86d3,_0x2d2191,_0xfa5d0a){var _0x2ee67c=getName(_0x2ee67c);return request({'method':'POST','uri':_0xda90('0x3e')+_0x4aa05c+_0xda90('0x3f')+_[_0xda90('0x40')](_0xfa5d0a[_0xda90('0x41')])+'s','body':{'data':[{'Last_Name':_0x2ee67c[0x1],'First_Name':_0x2ee67c[0x0],'Phone':_0x2f86d3,'Owner':{'name':!_[_0xda90('0x1d')](_0x2d2191[_0xda90('0x42')][_0xda90('0x19')])?_0x2d2191[_0xda90('0x42')][_0xda90('0x19')]:!_[_0xda90('0x1d')](_0x2d2191[_0xda90('0x43')])?_0x2d2191[_0xda90('0x43')]+'\x20'+_0x2d2191[_0xda90('0x44')]:_0x2d2191[_0xda90('0x44')],'id':_0x2d2191['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3f6fd3},'json':!![]})[_0xda90('0x2f')](function(_0x50745d){if(_0x50745d&&_0x50745d[_0xda90('0x3c')][0x0]['code']===_0xda90('0x45')){var _0x548992=_0x50745d[_0xda90('0x3c')][0x0][_0xda90('0x46')];_0x548992[_0xda90('0x3d')]=_[_0xda90('0x40')](_0xfa5d0a[_0xda90('0x41')])+'s';return _0x548992;}logger['error'](_0xda90('0x39'),JSON[_0xda90('0xe')](data));throw new Error(_0xda90('0x47')+JSON[_0xda90('0xe')](data));})[_0xda90('0x3b')](function(_0x52fec7){console[_0xda90('0x48')]('CREATE\x20ERROR',_0x52fec7);});}function getEndUser(_0x51d29d,_0x29e284,_0x40d478,_0x338808,_0x343188,_0x53e709,_0x2f2e19){var _0x270671={'method':'GET','uri':'','headers':{'Authorization':_0xda90('0x49')+_0x51d29d},'json':!![]};switch(_0x2f2e19[_0xda90('0x4a')]){case _0xda90('0x4b'):_0x270671[_0xda90('0x4c')]=_0xda90('0x3e')+_0x29e284+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4d'))['then'](function(_0x100c67){if(_0x100c67)return _0x100c67;_0x270671[_0xda90('0x4c')]=_0xda90('0x3e')+_0x29e284+_0xda90('0x4e')+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4f'))[_0xda90('0x2f')](function(_0xe817cc){if(_0xe817cc)return _0xe817cc;if(_0x2f2e19[_0xda90('0x41')]!=_0xda90('0x50')){return createEndUser(_0x51d29d,_0x29e284,_0x338808,_0x343188,_0x53e709,_0x2f2e19);}else{return{};}});});break;case'contact':_0x270671[_0xda90('0x4c')]=_0xda90('0x3e')+_0x29e284+_0xda90('0x51')+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4d'))[_0xda90('0x2f')](function(_0x53c47b){if(_0x53c47b)return _0x53c47b;if(_0x2f2e19[_0xda90('0x41')]!='nothing'){return createEndUser(_0x51d29d,_0x29e284,_0x338808,_0x343188,_0x53e709,_0x2f2e19);}else{return{};}});break;case _0xda90('0x52'):_0x270671[_0xda90('0x4c')]='https://www.zohoapis.'+_0x29e284+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x343188+'))';return getZohoUser(_0x270671,_0xda90('0x4f'))[_0xda90('0x2f')](function(_0x5f293e){if(_0x5f293e)return _0x5f293e;if(_0x2f2e19[_0xda90('0x41')]!=_0xda90('0x50')){return createEndUser(_0x51d29d,_0x29e284,_0x338808,_0x343188,_0x53e709,_0x2f2e19);}else{return{};}});break;}}function getCall(_0x50de4d,_0x253486,_0x3075d9,_0x39ae81,_0x363561,_0x2f45a8,_0x9f1269,_0x35cafb){logger[_0xda90('0x2c')](_0xda90('0x53'));var _0x2f3187={};_0x2f3187[_0xda90('0x54')]={'name':!_[_0xda90('0x1d')](_0x39ae81[_0xda90('0x42')][_0xda90('0x19')])&&!_[_0xda90('0x1d')](_0x39ae81[_0xda90('0x34')][_0xda90('0x19')])&&_0x39ae81['profile'][_0xda90('0x19')]===_0xda90('0x55')?_0x39ae81['role'][_0xda90('0x19')]:!_['isNil'](_0x39ae81['first_name'])?_0x39ae81[_0xda90('0x43')]+'\x20'+_0x39ae81['last_name']:_0x39ae81[_0xda90('0x44')],'id':_0x39ae81['id']};_0x2f3187['Subject']=intUtil[_0xda90('0x56')](_0x2f45a8[_0xda90('0x57')],_0x9f1269,'\x20');_0x2f3187['Description']=intUtil[_0xda90('0x56')](_0x2f45a8[_0xda90('0x58')],_0x9f1269,'\x0a');if(_0x363561['enduserType']==='Contacts'){_0x2f3187['Who_Id']={'name':!_['isNil'](_0x363561[_0xda90('0x59')])?_0x363561[_0xda90('0x59')]:!_[_0xda90('0x1d')](_0x363561[_0xda90('0x5a')])?_0x363561[_0xda90('0x5a')]+'\x20'+_0x363561[_0xda90('0x5b')]:_0x363561[_0xda90('0x5b')],'id':_0x363561['id']};}if(_0x363561[_0xda90('0x3d')]===_0xda90('0x4f')){_0x2f3187[_0xda90('0x5c')]={'name':!_[_0xda90('0x1d')](_0x363561[_0xda90('0x59')])?_0x363561[_0xda90('0x59')]:!_[_0xda90('0x1d')](_0x363561[_0xda90('0x5a')])?_0x363561[_0xda90('0x5a')]+'\x20'+_0x363561[_0xda90('0x5b')]:_0x363561['Last_Name'],'id':_0x363561['id']};_0x2f3187[_0xda90('0x5d')]=_['startCase'](_0x363561[_0xda90('0x3d')]);}if(_0x9f1269[_0xda90('0x5e')]){_0x2f3187['Call_Duration']=moment[_0xda90('0x5f')](parseInt(_0x9f1269[_0xda90('0x5e')])*0x3e8)[_0xda90('0x60')]('mm:ss');}else if(_0x9f1269[_0xda90('0x61')]&&_0x9f1269[_0xda90('0x62')]){_0x2f3187[_0xda90('0x63')]=moment[_0xda90('0x5f')](moment(_0x9f1269[_0xda90('0x62')],'YYYY-MM-DDTHH:mm:ss')[_0xda90('0x64')](moment(_0x9f1269[_0xda90('0x65')],_0xda90('0x66'))))['format'](_0xda90('0x67'));}switch(_0x9f1269[_0xda90('0x68')]){case _0xda90('0x69'):_0x2f3187[_0xda90('0x6a')]=_0xda90('0x6b');break;case _0xda90('0x6c'):case'connect':_0x2f3187[_0xda90('0x6a')]=_0xda90('0x6d');break;case _0xda90('0x6e'):_0x2f3187[_0xda90('0x6a')]=_0xda90('0x6f');break;case _0xda90('0x70'):_0x2f3187[_0xda90('0x6a')]=_0xda90('0x71');break;case'timeout':_0x2f3187[_0xda90('0x6a')]=_0xda90('0x72');default:}_0x2f3187[_0xda90('0x73')]=(_0x35cafb==='outbound'?moment(_0x9f1269[_0xda90('0x65')])[_0xda90('0x60')](_0xda90('0x66')):moment(_0x9f1269['agentcalledAt'])['format'](_0xda90('0x66')))||moment()[_0xda90('0x60')](_0xda90('0x66'));_0x2f3187[_0xda90('0x74')]=_0x35cafb||'Inbound';_0x2f3187=_[_0xda90('0x75')](_0x2f3187,getCustomFields(_0x2f45a8[_0xda90('0x76')],_0x9f1269));return request({'method':_0xda90('0x77'),'uri':'https://www.zohoapis.'+_0x253486+'/crm/v2/Calls','headers':{'Authorization':_0xda90('0x49')+_0x50de4d},'body':{'data':[_0x2f3187]},'json':!![]})[_0xda90('0x2f')](function(_0x38d32c){if(_0x38d32c&&_0x38d32c['data'][0x0][_0xda90('0x78')]===_0xda90('0x45')){logger[_0xda90('0x2c')](_0xda90('0x79'));return{'id':_0x38d32c['data'][0x0][_0xda90('0x46')]['id']};}})['catch'](function(_0x20bccb){logger[_0xda90('0x2c')](_0xda90('0x7a'),_0x20bccb[_0xda90('0x7b')]);console[_0xda90('0x48')](_0xda90('0x7a'),_0x20bccb);});}exports['queue']=function(_0x31d9b6,_0x2b92fc,_0x39d242,_0x29fec4,_0x29e692,_0x41656f){var _0x52b6d9,_0x37d97f,_0x421464;_0x41656f[_0xda90('0x7c')]=intUtil['stripTrailingSlash'](_0x41656f[_0xda90('0x7c')]);_0x41656f[_0xda90('0x7d')]=intUtil[_0xda90('0x7e')](_0x41656f[_0xda90('0x7d')]);if(_0x29e692&&_0x29e692[_0xda90('0x7f')]){logger[_0xda90('0x2c')]('[QUEUE]',_0xda90('0x80'));_0x2b92fc['recordingURL']=_0x41656f[_0xda90('0x7d')]+_0xda90('0x81')+_0x2b92fc[_0xda90('0x82')]+_0xda90('0x83')+md5(_0x2b92fc[_0xda90('0x82')]);}else{_0x2b92fc['recordingURL']='';}var _0x3e0b76=_0x41656f[_0xda90('0x7c')]===_0xda90('0x84')?'eu':'com';return getAccessToken(_0x41656f)[_0xda90('0x2f')](function(_0x106926){_0x421464=_0x106926;return getUser(_0x421464,_0x3e0b76,_0x41656f,_0x29fec4[_0xda90('0x32')]);})[_0xda90('0x2f')](function(_0xb9340b){_0x52b6d9=_0xb9340b;logger[_0xda90('0x2c')](_0xda90('0x85'),_0x52b6d9['id']);return getEndUser(_0x421464,_0x3e0b76,_0x41656f,_0x2b92fc['calleridname'],_0x2b92fc['calleridnum'],_0x52b6d9,_0x39d242);})[_0xda90('0x2f')](function(_0x50c0f4){_0x37d97f=_0x50c0f4;return getCall(_0x421464,_0x3e0b76,_0x41656f,_0x52b6d9,_0x37d97f,_0x39d242,_0x2b92fc,_0xda90('0x86'));})[_0xda90('0x2f')](function(_0x438ea0){if(_0x438ea0){logger[_0xda90('0x2c')]('The\x20Call\x20ID\x20is:',_0x438ea0['id']);logger[_0xda90('0x2c')](_0xda90('0x87'),_0xda90('0x88'));emit(util['format'](_0xda90('0x89'),_0x29fec4[_0xda90('0x19')]),'trigger:browser:url',{'uri':_0xda90('0x8a')+_0x41656f['host']+_0xda90('0x8b')+_0x438ea0['id']});}})[_0xda90('0x3b')](function(_0x1972c9){logger[_0xda90('0x38')](_0xda90('0x87'),JSON['stringify'](_0x1972c9));});};exports[_0xda90('0x8c')]=function(_0x55e1a9,_0x18bff9,_0x150ee7,_0x30d12c,_0xb298e,_0x4e4291,_0x1228ce){var _0x2393c7,_0x25a00b,_0x477cd5;_0x4e4291[_0xda90('0x7c')]=intUtil['stripTrailingSlash'](_0x4e4291[_0xda90('0x7c')]);_0x4e4291[_0xda90('0x7d')]=intUtil[_0xda90('0x7e')](_0x4e4291[_0xda90('0x7d')]);if(_0x1228ce&&_0x1228ce[_0xda90('0x8d')]&&_0x1228ce['recordingFormat']!=='none'){logger['info'](_0xda90('0x8e'),_0xda90('0x80'));_0x18bff9[_0xda90('0x8f')]=_0x4e4291[_0xda90('0x7d')]+_0xda90('0x81')+_0x18bff9['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x18bff9[_0xda90('0x82')]);}var _0x31ca58=_0x4e4291[_0xda90('0x7c')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x4e4291)[_0xda90('0x2f')](function(_0x17c5e4){_0x477cd5=_0x17c5e4;return getUser(_0x477cd5,_0x31ca58,_0x4e4291,_0x30d12c[_0xda90('0x32')]);})[_0xda90('0x2f')](function(_0x342dc8){_0x2393c7=_0x342dc8;logger[_0xda90('0x2c')]('The\x20User\x20ID\x20is:',_0x2393c7['id']);return getEndUser(_0x477cd5,_0x31ca58,_0x4e4291,_0x18bff9[_0xda90('0x90')],_0x18bff9['destcalleridnum'],_0x2393c7,_0x150ee7);})['then'](function(_0x59fc60){_0x25a00b=_0x59fc60;return getCall(_0x477cd5,_0x31ca58,_0x4e4291,_0x2393c7,_0x25a00b,_0x150ee7,_0x18bff9,_0xda90('0x91'));})[_0xda90('0x2f')](function(_0x18de32){if(_0x18de32){logger[_0xda90('0x2c')](_0xda90('0x92'),_0x18de32['id']);logger['info'](_0xda90('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x30d12c[_0xda90('0x19')]),'trigger:browser:url',{'uri':_0xda90('0x8a')+_0x4e4291[_0xda90('0x7c')]+_0xda90('0x8b')+_0x18de32['id']});}})[_0xda90('0x3b')](function(_0x744d1b){logger[_0xda90('0x38')](_0xda90('0x8e'),JSON['stringify'](_0x744d1b));});};exports[_0xda90('0x93')]=function(_0x51e05c,_0x1d78c9,_0x4a2653,_0x371fe9,_0x131f54,_0x94abde){var _0x1ef71f,_0x5859dc,_0x5b46de;_0x94abde[_0xda90('0x7c')]=intUtil[_0xda90('0x7e')](_0x94abde[_0xda90('0x7c')]);_0x94abde['serverUrl']=intUtil[_0xda90('0x7e')](_0x94abde[_0xda90('0x7d')]);if(_0x131f54&&_0x131f54['monitor_format']){logger[_0xda90('0x2c')]('['+_0x1d78c9['lastevent'][_0xda90('0x94')]()+']',_0xda90('0x80'));_0x1d78c9[_0xda90('0x8f')]=_0x94abde['serverUrl']+_0xda90('0x81')+_0x1d78c9[_0xda90('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x1d78c9['uniqueid']);}else{_0x1d78c9[_0xda90('0x8f')]='';}var _0x2f3203=_0x94abde['host']===_0xda90('0x84')?'eu':'com';return getAccessToken(_0x94abde)[_0xda90('0x2f')](function(_0x17a3e2){_0x5b46de=_0x17a3e2;return getUser(_0x5b46de,_0x2f3203,_0x94abde);})[_0xda90('0x2f')](function(_0x518d72){_0x1ef71f=_0x518d72;logger[_0xda90('0x2c')](_0xda90('0x85'),_0x1ef71f['id']);return getEndUser(_0x5b46de,_0x2f3203,_0x94abde,_0x1d78c9['calleridname'],_0x1d78c9[_0xda90('0x95')],_0x1ef71f,_0x4a2653);})[_0xda90('0x2f')](function(_0x4be0bf){_0x5859dc=_0x4be0bf;return getCall(_0x5b46de,_0x2f3203,_0x94abde,_0x1ef71f,_0x5859dc,_0x4a2653,_0x1d78c9,_0xda90('0x86'));})[_0xda90('0x2f')](function(_0x22236e){if(_0x22236e){logger[_0xda90('0x2c')](_0xda90('0x92'),_0x22236e['id']);}})[_0xda90('0x3b')](function(_0x15500c){logger[_0xda90('0x38')]('['+_0x1d78c9[_0xda90('0x68')][_0xda90('0x94')]()+']',JSON[_0xda90('0xe')](_0x15500c));});}; \ 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 326e659..c91377c 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 _0x1011=['data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','data2','Script'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x1011,0x19e));var _0x1101=function(_0x100dcb,_0x2cfcdf){_0x100dcb=_0x100dcb-0x0;var _0x690bf=_0x1011[_0x100dcb];return _0x690bf;};'use strict';var util=require('util');var sh=require(_0x1101('0x0'));var Mustache=require(_0x1101('0x1'));var logger=require(_0x1101('0x2'))(_0x1101('0x3'));exports['exec']=function(_0x127dc9,_0x2abcda){var _0x356706=_0x127dc9[_0x1101('0x4')]?_0x127dc9[_0x1101('0x4')]:_0x1101('0x5');var _0x48dc33=_0x127dc9[_0x1101('0x6')]?Mustache['render'](_0x127dc9[_0x1101('0x6')],_0x2abcda):_0x2abcda;sh['exec'](_0x48dc33,function(_0xd4617a,_0x4b842e,_0x3c615a){if(_0xd4617a!==0x0){logger[_0x1101('0x7')](util[_0x1101('0x8')](_0x1101('0x9'),_0x356706,_0x48dc33,_0xd4617a,_0x3c615a));}else{logger[_0x1101('0xa')](util[_0x1101('0x8')](_0x1101('0xb'),_0x356706,_0x48dc33,_0x4b842e));}});}; \ No newline at end of file +var _0xbf2d=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','render','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x4c8f23,_0x152081){var _0x418f8d=function(_0x478d7c){while(--_0x478d7c){_0x4c8f23['push'](_0x4c8f23['shift']());}};_0x418f8d(++_0x152081);}(_0xbf2d,0xcd));var _0xdbf2=function(_0x1ffe30,_0x1ab73a){_0x1ffe30=_0x1ffe30-0x0;var _0x28a0f4=_0xbf2d[_0x1ffe30];return _0x28a0f4;};'use strict';var util=require(_0xdbf2('0x0'));var sh=require(_0xdbf2('0x1'));var Mustache=require(_0xdbf2('0x2'));var logger=require(_0xdbf2('0x3'))(_0xdbf2('0x4'));exports[_0xdbf2('0x5')]=function(_0x3fd7cb,_0x442fad){var _0x114d03=_0x3fd7cb[_0xdbf2('0x6')]?_0x3fd7cb['data2']:_0xdbf2('0x7');var _0x14220f=_0x3fd7cb['data3']?Mustache[_0xdbf2('0x8')](_0x3fd7cb[_0xdbf2('0x9')],_0x442fad):_0x442fad;sh[_0xdbf2('0x5')](_0x14220f,function(_0x213806,_0x1cd1fc,_0x22104e){if(_0x213806!==0x0){logger['error'](util['format'](_0xdbf2('0xa'),_0x114d03,_0x14220f,_0x213806,_0x22104e));}else{logger['info'](util['format'](_0xdbf2('0xb'),_0x114d03,_0x14220f,_0x1cd1fc));}});}; \ 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 d43db55..3b8efb0 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 _0xe7bb=['util','lodash','mustache','trigger','data1','toUpperCase','data5','number','headers','data6','parse','render','GET','POST','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','data2','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise'];(function(_0x1243f2,_0x3c7d5c){var _0x269c07=function(_0x3e3c35){while(--_0x3e3c35){_0x1243f2['push'](_0x1243f2['shift']());}};_0x269c07(++_0x3c7d5c);}(_0xe7bb,0x1cd));var _0xbe7b=function(_0x344e63,_0x4a5171){_0x344e63=_0x344e63-0x0;var _0x3fe3ea=_0xe7bb[_0x344e63];return _0x3fe3ea;};'use strict';var rp=require(_0xbe7b('0x0'));var util=require(_0xbe7b('0x1'));var _=require(_0xbe7b('0x2'));var Mustache=require(_0xbe7b('0x3'));var logger=require('../../../../config/logger')(_0xbe7b('0x4'));exports['exec']=function(_0xbe2ebd,_0x946471){var _0x400fe5,_0x75e7f3;var _0x468ed5={'method':_0xbe2ebd[_0xbe7b('0x5')][_0xbe7b('0x6')](),'uri':Mustache['render'](_0xbe2ebd['data2'],_0x946471),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xbe2ebd[_0xbe7b('0x7')])===_0xbe7b('0x8')&&parseInt(_0xbe2ebd[_0xbe7b('0x7')])>=0x1&&parseInt(_0xbe2ebd[_0xbe7b('0x7')])<=0xa?parseInt(_0xbe2ebd['data5'])*0x3e8:0x5*0x3e8};try{_0x468ed5[_0xbe7b('0x9')]=_0xbe2ebd[_0xbe7b('0xa')]?JSON[_0xbe7b('0xb')](Mustache[_0xbe7b('0xc')](_0xbe2ebd[_0xbe7b('0xa')],_0x946471)):{};}catch(_0x33f5fe){logger['error'](_0x33f5fe['stack']);}switch(_0xbe2ebd[_0xbe7b('0x5')][_0xbe7b('0x6')]()){case _0xbe7b('0xd'):case'DELETE':_0x400fe5=null;_0x468ed5['qs']=_0x946471;break;case _0xbe7b('0xe'):case'PUT':if(_0xbe2ebd[_0xbe7b('0xf')]){try{_0x400fe5=JSON[_0xbe7b('0xb')](Mustache[_0xbe7b('0xc')](_0xbe2ebd[_0xbe7b('0xf')],_0x946471));_0x468ed5[_0xbe7b('0x10')]=_0x400fe5;}catch(_0x21ed00){logger[_0xbe7b('0x11')](_0x21ed00[_0xbe7b('0x12')]);logger[_0xbe7b('0x11')](_0xbe7b('0x13'));}}else{_0x400fe5=_0x946471;_0x468ed5[_0xbe7b('0x10')]=_0x400fe5;}break;}logger[_0xbe7b('0x14')](util[_0xbe7b('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xbe2ebd[_0xbe7b('0x5')],_0xbe2ebd['data2'],JSON[_0xbe7b('0x16')](_0x468ed5)));rp(_0x468ed5)[_0xbe7b('0x17')](function(_0x2dae1f){_0x400fe5=!_[_0xbe7b('0x18')](_0x400fe5)?_0xbe7b('0x19')+_0x400fe5:'';_0x75e7f3=typeof _0x2dae1f[_0xbe7b('0x10')]===_0xbe7b('0x1a')?JSON[_0xbe7b('0x16')](_0x2dae1f['body']):_0x2dae1f['body'];logger[_0xbe7b('0x14')](util[_0xbe7b('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xbe2ebd[_0xbe7b('0x5')],_0xbe2ebd[_0xbe7b('0x1b')],_0x2dae1f['statusCode'],_0x75e7f3));})[_0xbe7b('0x1c')](function(_0x4b2230){logger[_0xbe7b('0x11')](util[_0xbe7b('0x15')](_0xbe7b('0x1d'),_0xbe2ebd[_0xbe7b('0x5')],_0xbe2ebd[_0xbe7b('0x1b')],_0x4b2230[_0xbe7b('0x1e')],_0x4b2230[_0xbe7b('0x1f')],_0x4b2230[_0xbe7b('0x20')]));});}; \ No newline at end of file +var _0xc6a3=[',\x20request\x20body:\x20','%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','name','message','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','data5','headers','data6','parse','error','toUpperCase','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','stringify','then','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6a3,0x150));var _0x3c6a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc6a3[_0x501510];return _0x1e6ee5;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x3c6a('0x0'));var Mustache=require(_0x3c6a('0x1'));var logger=require(_0x3c6a('0x2'))(_0x3c6a('0x3'));exports[_0x3c6a('0x4')]=function(_0x27cf14,_0x4246d5){var _0x354151,_0x40abab;var _0x122fb6={'method':_0x27cf14['data1']['toUpperCase'](),'uri':Mustache[_0x3c6a('0x5')](_0x27cf14[_0x3c6a('0x6')],_0x4246d5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x27cf14[_0x3c6a('0x7')])==='number'&&parseInt(_0x27cf14[_0x3c6a('0x7')])>=0x1&&parseInt(_0x27cf14[_0x3c6a('0x7')])<=0xa?parseInt(_0x27cf14[_0x3c6a('0x7')])*0x3e8:0x5*0x3e8};try{_0x122fb6[_0x3c6a('0x8')]=_0x27cf14[_0x3c6a('0x9')]?JSON[_0x3c6a('0xa')](Mustache['render'](_0x27cf14['data6'],_0x4246d5)):{};}catch(_0x1fb420){logger[_0x3c6a('0xb')](_0x1fb420['stack']);}switch(_0x27cf14['data1'][_0x3c6a('0xc')]()){case'GET':case'DELETE':_0x354151=null;_0x122fb6['qs']=_0x4246d5;break;case'POST':case _0x3c6a('0xd'):if(_0x27cf14[_0x3c6a('0xe')]){try{_0x354151=JSON['parse'](Mustache[_0x3c6a('0x5')](_0x27cf14[_0x3c6a('0xe')],_0x4246d5));_0x122fb6[_0x3c6a('0xf')]=_0x354151;}catch(_0xea96cc){logger['error'](_0xea96cc[_0x3c6a('0x10')]);logger[_0x3c6a('0xb')](_0x3c6a('0x11'));}}else{_0x354151=_0x4246d5;_0x122fb6[_0x3c6a('0xf')]=_0x354151;}break;}logger[_0x3c6a('0x12')](util['format'](_0x3c6a('0x13'),_0x27cf14[_0x3c6a('0x14')],_0x27cf14[_0x3c6a('0x6')],JSON[_0x3c6a('0x15')](_0x122fb6)));rp(_0x122fb6)[_0x3c6a('0x16')](function(_0x33bfa4){_0x354151=!_[_0x3c6a('0x17')](_0x354151)?_0x3c6a('0x18')+_0x354151:'';_0x40abab=typeof _0x33bfa4['body']==='object'?JSON[_0x3c6a('0x15')](_0x33bfa4[_0x3c6a('0xf')]):_0x33bfa4[_0x3c6a('0xf')];logger[_0x3c6a('0x12')](util['format'](_0x3c6a('0x19'),_0x27cf14['data1'],_0x27cf14[_0x3c6a('0x6')],_0x33bfa4['statusCode'],_0x40abab));})[_0x3c6a('0x1a')](function(_0x11eb4c){logger['error'](util['format'](_0x3c6a('0x1b'),_0x27cf14['data1'],_0x27cf14[_0x3c6a('0x6')],_0x11eb4c['statusCode'],_0x11eb4c[_0x3c6a('0x1c')],_0x11eb4c[_0x3c6a('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b37c84f..9bb0a1d 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 _0x6c89=['error','message','result','exports','bluebird','../../config/logger','routing','client','Request','request','then','debug','rpc'];(function(_0x53cf14,_0x29e073){var _0x3e5981=function(_0x4a9ab3){while(--_0x4a9ab3){_0x53cf14['push'](_0x53cf14['shift']());}};_0x3e5981(++_0x29e073);}(_0x6c89,0x1e5));var _0x96c8=function(_0x2c8113,_0x46dc97){_0x2c8113=_0x2c8113-0x0;var _0x1013f7=_0x6c89[_0x2c8113];return _0x1013f7;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x96c8('0x0'));var logger=require(_0x96c8('0x1'))(_0x96c8('0x2'));var client=jayson[_0x96c8('0x3')]['http']({'port':0x2329});client[_0x96c8('0x4')]=function(_0xecce44,_0x2758cf){return new BPromise(function(_0x51120b,_0xafdf68){return client[_0x96c8('0x5')](_0xecce44,_0x2758cf)[_0x96c8('0x6')](function(_0x1d7ce3){logger[_0x96c8('0x7')](_0x96c8('0x8'),_0x96c8('0x2'),_0xecce44,_0x2758cf,_0x1d7ce3);if(_0x1d7ce3[_0x96c8('0x9')]){logger[_0x96c8('0x9')](_0x96c8('0x8'),_0x96c8('0x2'),_0xecce44,_0x1d7ce3[_0x96c8('0x9')]['message'],_0x2758cf);return _0xafdf68(_0x1d7ce3[_0x96c8('0x9')][_0x96c8('0xa')]);}else{return _0x51120b(_0x1d7ce3[_0x96c8('0xb')]);}})['catch'](function(_0x9d1f35){logger[_0x96c8('0x9')](_0x96c8('0x8'),_0x96c8('0x2'),_0xecce44,_0x9d1f35,_0x2758cf);return _0xafdf68(_0x9d1f35);});});};module[_0x96c8('0xc')]=client; \ No newline at end of file +var _0x77eb=['result','catch','exports','../../config/logger','routing','http','Request','request','then','debug','error','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x77eb,0xc3));var _0xb77e=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x77eb[_0x515afd];return _0x536d53;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xb77e('0x0'))(_0xb77e('0x1'));var client=jayson['client'][_0xb77e('0x2')]({'port':0x2329});client[_0xb77e('0x3')]=function(_0x2fd656,_0x5757cd){return new BPromise(function(_0x1379a7,_0xe6a2be){return client[_0xb77e('0x4')](_0x2fd656,_0x5757cd)[_0xb77e('0x5')](function(_0x20eb6f){logger[_0xb77e('0x6')]('rpc',_0xb77e('0x1'),_0x2fd656,_0x5757cd,_0x20eb6f);if(_0x20eb6f[_0xb77e('0x7')]){logger[_0xb77e('0x7')]('rpc',_0xb77e('0x1'),_0x2fd656,_0x20eb6f[_0xb77e('0x7')][_0xb77e('0x8')],_0x5757cd);return _0xe6a2be(_0x20eb6f['error']['message']);}else{return _0x1379a7(_0x20eb6f[_0xb77e('0x9')]);}})[_0xb77e('0xa')](function(_0x1b1d6f){logger[_0xb77e('0x7')]('rpc',_0xb77e('0x1'),_0x2fd656,_0x1b1d6f,_0x5757cd);return _0xe6a2be(_0x1b1d6f);});});};module[_0xb77e('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5d322e6..d74e057 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 _0x6bf9=['./rpc/setting','../../config/logger','email','then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x25949d,_0x49889d){var _0x321fac=function(_0x345e70){while(--_0x345e70){_0x25949d['push'](_0x25949d['shift']());}};_0x321fac(++_0x49889d);}(_0x6bf9,0x7b));var _0x96bf=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0x6bf9[_0x204ad4];return _0x50675f;};'use strict';var server=require(_0x96bf('0x0'));var Realtime=require(_0x96bf('0x1'));var EmailChannel=require(_0x96bf('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x96bf('0x3'));var logger=require(_0x96bf('0x4'))(_0x96bf('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x96bf('0x6')](mailAccount['getMailAccounts']())['then'](realtime[_0x96bf('0x7')]())[_0x96bf('0x6')](function(){email[_0x96bf('0x8')](realtime[_0x96bf('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x96bf('0x6')](function(){return initRealtime();})[_0x96bf('0x6')](function(){return setting[_0x96bf('0xa')]();})[_0x96bf('0x6')](function(_0x385c2c){return setInterval(initRealtime,_0x385c2c[_0x96bf('0xb')]*0x3e8);})['catch'](function(_0x31efd0){logger[_0x96bf('0xc')](_0x96bf('0xd'),_0x31efd0);});}main(); \ No newline at end of file +var _0xb84e=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email','../../config/logger','email','resolve'];(function(_0x431054,_0x6ad732){var _0x5adc9b=function(_0x591daa){while(--_0x591daa){_0x431054['push'](_0x431054['shift']());}};_0x5adc9b(++_0x6ad732);}(_0xb84e,0x16b));var _0xeb84=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xb84e[_0x25a42a];return _0x1129b1;};'use strict';var server=require(_0xeb84('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xeb84('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xeb84('0x2'))(_0xeb84('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xeb84('0x4')]()[_0xeb84('0x5')](mailAccount[_0xeb84('0x6')]())[_0xeb84('0x5')](realtime[_0xeb84('0x7')]())[_0xeb84('0x5')](function(){email[_0xeb84('0x8')](realtime[_0xeb84('0x9')]);return realtime;});}function main(){return server[_0xeb84('0xa')](realtime,email)[_0xeb84('0x5')](function(){return initRealtime();})[_0xeb84('0x5')](function(){return setting[_0xeb84('0xb')]();})[_0xeb84('0x5')](function(_0x1d8e8c){return setInterval(initRealtime,_0x1d8e8c[_0xeb84('0xc')]*0x3e8);})[_0xeb84('0xd')](function(_0x41c231){logger[_0xeb84('0xe')](_0xeb84('0xf'),_0x41c231);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 46b382e..8e2deb6 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 _0x8173=['handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','messageStatus','status','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','key','active','Imap','total','stringify','refresh','hasOwnProperty','service','provider','custom','imapAccounts','box','bind'];(function(_0x21a314,_0xbe022b){var _0x3eb9f6=function(_0x3b53ff){while(--_0x3b53ff){_0x21a314['push'](_0x21a314['shift']());}};_0x3eb9f6(++_0xbe022b);}(_0x8173,0xba));var _0x3817=function(_0x139a42,_0x2a2603){_0x139a42=_0x139a42-0x0;var _0x111065=_0x8173[_0x139a42];return _0x111065;};'use strict';var _=require(_0x3817('0x0'));var moment=require(_0x3817('0x1'));var BPromise=require(_0x3817('0x2'));var md5=require(_0x3817('0x3'));var Redis=require(_0x3817('0x4'));var config=require(_0x3817('0x5'));var logger=require(_0x3817('0x6'))(_0x3817('0x7'));config[_0x3817('0x8')]=_[_0x3817('0x9')](config[_0x3817('0x8')],{'host':_0x3817('0xa'),'port':0x18eb});var io=require(_0x3817('0xb'))(new Redis(config['redis']));var EmailImap=require(_0x3817('0xc'));var EmailSmtp=require(_0x3817('0xd'));var mailAccount=require(_0x3817('0xe'));var md5Accounts={};function EmailChannel(_0x34eff4){logger[_0x3817('0xf')](_0x3817('0x10'));this['mailAccounts']=_0x34eff4[_0x3817('0x11')];this['imapAccounts']={};this[_0x3817('0x12')]=new EmailSmtp();}EmailChannel[_0x3817('0x13')][_0x3817('0x14')]=function(_0x2803d2){var _0x3dba1a=this[_0x3817('0x11')][_0x2803d2];var _0x5c340b={'id':_0x3dba1a['id'],'name':_0x3dba1a['name'],'key':_0x3dba1a[_0x3817('0x15')],'active':_0x3dba1a[_0x3817('0x16')],'Imap':{'status':_0x3dba1a[_0x3817('0x17')]['status'],'messageStatus':_0x3dba1a[_0x3817('0x17')]['messageStatus'],'total':_0x3dba1a[_0x3817('0x17')][_0x3817('0x18')]}};if(_['isNil'](md5Accounts[_0x2803d2])){md5Accounts[_0x2803d2]={};}var _0xcbe872=md5(JSON[_0x3817('0x19')](_0x5c340b));if(md5Accounts[_0x2803d2][_0x3817('0x3')]!==_0xcbe872){md5Accounts[_0x2803d2][_0x3817('0x3')]=_0xcbe872;io['emit']('mailAccount:update',_0x5c340b);}};EmailChannel[_0x3817('0x13')][_0x3817('0x1a')]=function(_0x600a5e){for(var _0xfd5d82 in _0x600a5e){if(_0x600a5e[_0x3817('0x1b')](_0xfd5d82)){if(_0x600a5e[_0xfd5d82][_0x3817('0x17')]&&_0x600a5e[_0xfd5d82]['active']){var _0x2d8596=_0x600a5e[_0xfd5d82][_0x3817('0x17')];if(!_0x2d8596[_0x3817('0x1c')]&&_0x600a5e[_0xfd5d82][_0x3817('0x1d')]!==_0x3817('0x1e'))_0x2d8596[_0x3817('0x1c')]=_0x600a5e[_0xfd5d82][_0x3817('0x1d')];if(!this[_0x3817('0x1f')][_0x3817('0x1b')](_0x2d8596['id'])){this[_0x3817('0x1f')][_0x2d8596['id']]=new EmailImap(_0x2d8596,_0x600a5e[_0xfd5d82][_0x3817('0x7')]);this[_0x3817('0x1f')][_0x2d8596['id']]['on'](_0x3817('0x20'),this['handleImapBox'][_0x3817('0x21')](this,_0xfd5d82));this[_0x3817('0x1f')][_0x2d8596['id']]['on'](_0x3817('0x7'),this[_0x3817('0x22')]['bind'](this,_0xfd5d82));this[_0x3817('0x1f')][_0x2d8596['id']]['on'](_0x3817('0x23'),this[_0x3817('0x24')][_0x3817('0x21')](this,_0xfd5d82));this[_0x3817('0x1f')][_0x2d8596['id']]['on'](_0x3817('0x25'),this[_0x3817('0x26')][_0x3817('0x21')](this,_0xfd5d82));}}else{if(_[_0x3817('0x27')](this[_0x3817('0x11')][_0xfd5d82][_0x3817('0x17')])){this['mailAccounts'][_0xfd5d82][_0x3817('0x17')]={};}this[_0x3817('0x11')][_0xfd5d82][_0x3817('0x17')]['status']='disabled';this['mailAccounts'][_0xfd5d82][_0x3817('0x17')][_0x3817('0x28')]='';this['emit'](_0xfd5d82);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x4106c0,_0x3f6bb5){if(this['mailAccounts'][_0x4106c0]){this[_0x3817('0x11')][_0x4106c0][_0x3817('0x17')][_0x3817('0x29')]='connected';this[_0x3817('0x11')][_0x4106c0]['Imap']['messageStatus']=_0x3f6bb5[_0x3817('0x2a')];if(_0x3f6bb5[_0x3817('0x2b')]){this['mailAccounts'][_0x4106c0][_0x3817('0x17')][_0x3817('0x18')]=_0x3f6bb5[_0x3817('0x2b')][_0x3817('0x18')];}return this[_0x3817('0x14')](_0x4106c0);}};EmailChannel['prototype'][_0x3817('0x22')]=function(_0x37f8d0,_0x1f84ac){logger['info'](_0x3817('0x2c'),_0x1f84ac['firstName'],_0x1f84ac['lastName'],_0x1f84ac[_0x3817('0x2d')],_0x37f8d0);if(this[_0x3817('0x11')][_0x37f8d0]){return mailAccount[_0x3817('0x2e')](_0x37f8d0,_0x1f84ac)[_0x3817('0x2f')](function(_0xb06ba8){if(_0xb06ba8){logger[_0x3817('0xf')](_0x3817('0x30'));}})[_0x3817('0x31')](function(_0x304e49){logger[_0x3817('0x25')](_0x3817('0x32'),JSON['stringify'](_0x304e49));});}};EmailChannel[_0x3817('0x13')]['handleImapEnd']=function(_0x1f7cdb){if(this[_0x3817('0x11')][_0x1f7cdb]&&this['mailAccounts'][_0x1f7cdb][_0x3817('0x17')]){if(this[_0x3817('0x1f')][this['mailAccounts'][_0x1f7cdb][_0x3817('0x17')]['id']]){delete this[_0x3817('0x1f')][this['mailAccounts'][_0x1f7cdb]['Imap']['id']];}this[_0x3817('0x11')][_0x1f7cdb][_0x3817('0x17')][_0x3817('0x33')]=moment();this['emit'](_0x1f7cdb);}};EmailChannel[_0x3817('0x13')]['handleImapError']=function(_0x57fdac,_0x2b3d07){if(this['mailAccounts'][_0x57fdac]){this[_0x3817('0x11')][_0x57fdac]['Imap']['status']=_0x3817('0x25');this[_0x3817('0x11')][_0x57fdac]['Imap'][_0x3817('0x28')]=_0x2b3d07;return this['emit'](_0x57fdac);}};EmailChannel['prototype'][_0x3817('0x34')]=function(_0x4597a1,_0x19bff2){return this[_0x3817('0x12')][_0x3817('0x35')](_0x4597a1,_0x19bff2);};EmailChannel['prototype']['verifySmtp']=function(_0x41d599){var _0x4885a5=this;if(this[_0x3817('0x11')][_0x41d599['id']]){if(_['isNil'](this[_0x3817('0x11')][_0x41d599['id']][_0x3817('0x36')])){this[_0x3817('0x11')][_0x41d599['id']][_0x3817('0x36')]={};}this[_0x3817('0x11')][_0x41d599['id']][_0x3817('0x36')][_0x3817('0x33')]=moment();return new BPromise(function(_0x300d08,_0x35f7d2){return _0x4885a5[_0x3817('0x12')]['verify'](_0x41d599)[_0x3817('0x2f')](function(_0x198e9c){_0x4885a5[_0x3817('0x11')][_0x41d599['id']][_0x3817('0x36')]['status']='verified';_0x4885a5['mailAccounts'][_0x41d599['id']][_0x3817('0x36')][_0x3817('0x28')]='';_0x4885a5[_0x3817('0x14')](_0x41d599['id']);_0x300d08(_0x198e9c);})['catch'](function(_0x18a6ed){_0x4885a5['mailAccounts'][_0x41d599['id']][_0x3817('0x36')]['status']=_0x3817('0x25');_0x4885a5[_0x3817('0x11')][_0x41d599['id']][_0x3817('0x36')]['messageStatus']=_0x18a6ed;_0x4885a5['emit'](_0x41d599['id']);_0x35f7d2(_0x18a6ed);});});}return this[_0x3817('0x12')]['verify'](_0x41d599);};module['exports']=EmailChannel; \ No newline at end of file +var _0x1dae=['messageStatus','isNil','mailAccount:update','refresh','hasOwnProperty','service','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','catch','sendMail','send','verifySmtp','Smtp','lastSync','verify','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status'];(function(_0x2e7aa8,_0x2c6c40){var _0x13ec84=function(_0x30d511){while(--_0x30d511){_0x2e7aa8['push'](_0x2e7aa8['shift']());}};_0x13ec84(++_0x2c6c40);}(_0x1dae,0x14d));var _0xe1da=function(_0xa9acb3,_0xf5bf1d){_0xa9acb3=_0xa9acb3-0x0;var _0x829049=_0x1dae[_0xa9acb3];return _0x829049;};'use strict';var _=require(_0xe1da('0x0'));var moment=require('moment');var BPromise=require(_0xe1da('0x1'));var md5=require(_0xe1da('0x2'));var Redis=require(_0xe1da('0x3'));var config=require(_0xe1da('0x4'));var logger=require(_0xe1da('0x5'))('email');config[_0xe1da('0x6')]=_[_0xe1da('0x7')](config['redis'],{'host':_0xe1da('0x8'),'port':0x18eb});var io=require(_0xe1da('0x9'))(new Redis(config[_0xe1da('0x6')]));var EmailImap=require(_0xe1da('0xa'));var EmailSmtp=require(_0xe1da('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x59898a){logger[_0xe1da('0xc')](_0xe1da('0xd'));this[_0xe1da('0xe')]=_0x59898a['mailAccounts'];this[_0xe1da('0xf')]={};this[_0xe1da('0x10')]=new EmailSmtp();}EmailChannel[_0xe1da('0x11')][_0xe1da('0x12')]=function(_0x219585){var _0x32040f=this[_0xe1da('0xe')][_0x219585];var _0x3d9618={'id':_0x32040f['id'],'name':_0x32040f[_0xe1da('0x13')],'key':_0x32040f[_0xe1da('0x14')],'active':_0x32040f[_0xe1da('0x15')],'Imap':{'status':_0x32040f[_0xe1da('0x16')][_0xe1da('0x17')],'messageStatus':_0x32040f[_0xe1da('0x16')][_0xe1da('0x18')],'total':_0x32040f[_0xe1da('0x16')]['total']}};if(_[_0xe1da('0x19')](md5Accounts[_0x219585])){md5Accounts[_0x219585]={};}var _0x2b0c20=md5(JSON['stringify'](_0x3d9618));if(md5Accounts[_0x219585][_0xe1da('0x2')]!==_0x2b0c20){md5Accounts[_0x219585][_0xe1da('0x2')]=_0x2b0c20;io[_0xe1da('0x12')](_0xe1da('0x1a'),_0x3d9618);}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x1b')]=function(_0x45c409){for(var _0x9d2608 in _0x45c409){if(_0x45c409[_0xe1da('0x1c')](_0x9d2608)){if(_0x45c409[_0x9d2608][_0xe1da('0x16')]&&_0x45c409[_0x9d2608][_0xe1da('0x15')]){var _0x4d059e=_0x45c409[_0x9d2608][_0xe1da('0x16')];if(!_0x4d059e[_0xe1da('0x1d')]&&_0x45c409[_0x9d2608]['provider']!=='custom')_0x4d059e['service']=_0x45c409[_0x9d2608]['provider'];if(!this[_0xe1da('0xf')][_0xe1da('0x1c')](_0x4d059e['id'])){this['imapAccounts'][_0x4d059e['id']]=new EmailImap(_0x4d059e,_0x45c409[_0x9d2608]['email']);this[_0xe1da('0xf')][_0x4d059e['id']]['on']('box',this[_0xe1da('0x1e')][_0xe1da('0x1f')](this,_0x9d2608));this[_0xe1da('0xf')][_0x4d059e['id']]['on']('email',this[_0xe1da('0x20')][_0xe1da('0x1f')](this,_0x9d2608));this[_0xe1da('0xf')][_0x4d059e['id']]['on'](_0xe1da('0x21'),this[_0xe1da('0x22')]['bind'](this,_0x9d2608));this[_0xe1da('0xf')][_0x4d059e['id']]['on'](_0xe1da('0x23'),this[_0xe1da('0x24')][_0xe1da('0x1f')](this,_0x9d2608));}}else{if(_['isNil'](this[_0xe1da('0xe')][_0x9d2608]['Imap'])){this[_0xe1da('0xe')][_0x9d2608][_0xe1da('0x16')]={};}this[_0xe1da('0xe')][_0x9d2608][_0xe1da('0x16')][_0xe1da('0x17')]=_0xe1da('0x25');this['mailAccounts'][_0x9d2608]['Imap'][_0xe1da('0x18')]='';this[_0xe1da('0x12')](_0x9d2608);}}}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x1e')]=function(_0x1a1db8,_0x231d2c){if(this[_0xe1da('0xe')][_0x1a1db8]){this[_0xe1da('0xe')][_0x1a1db8][_0xe1da('0x16')]['status']=_0xe1da('0x26');this[_0xe1da('0xe')][_0x1a1db8][_0xe1da('0x16')][_0xe1da('0x18')]=_0x231d2c[_0xe1da('0x13')];if(_0x231d2c['messages']){this[_0xe1da('0xe')][_0x1a1db8][_0xe1da('0x16')][_0xe1da('0x27')]=_0x231d2c['messages'][_0xe1da('0x27')];}return this[_0xe1da('0x12')](_0x1a1db8);}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x20')]=function(_0x1811b5,_0x558bc2){logger[_0xe1da('0xc')](_0xe1da('0x28'),_0x558bc2['firstName'],_0x558bc2[_0xe1da('0x29')],_0x558bc2['from'],_0x1811b5);if(this['mailAccounts'][_0x1811b5]){return mailAccount[_0xe1da('0x2a')](_0x1811b5,_0x558bc2)[_0xe1da('0x2b')](function(_0x2ccd88){if(_0x2ccd88){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0xe1da('0x2c')](function(_0x97b08b){logger[_0xe1da('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x97b08b));});}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x22')]=function(_0x400f8f){if(this[_0xe1da('0xe')][_0x400f8f]&&this['mailAccounts'][_0x400f8f]['Imap']){if(this[_0xe1da('0xf')][this[_0xe1da('0xe')][_0x400f8f]['Imap']['id']]){delete this['imapAccounts'][this[_0xe1da('0xe')][_0x400f8f][_0xe1da('0x16')]['id']];}this[_0xe1da('0xe')][_0x400f8f][_0xe1da('0x16')]['lastSync']=moment();this[_0xe1da('0x12')](_0x400f8f);}};EmailChannel['prototype'][_0xe1da('0x24')]=function(_0x4b0f6d,_0x530c1f){if(this[_0xe1da('0xe')][_0x4b0f6d]){this['mailAccounts'][_0x4b0f6d][_0xe1da('0x16')][_0xe1da('0x17')]=_0xe1da('0x23');this[_0xe1da('0xe')][_0x4b0f6d]['Imap']['messageStatus']=_0x530c1f;return this[_0xe1da('0x12')](_0x4b0f6d);}};EmailChannel[_0xe1da('0x11')][_0xe1da('0x2d')]=function(_0x114b01,_0x916bd6){return this[_0xe1da('0x10')][_0xe1da('0x2e')](_0x114b01,_0x916bd6);};EmailChannel[_0xe1da('0x11')][_0xe1da('0x2f')]=function(_0x58e066){var _0x583395=this;if(this[_0xe1da('0xe')][_0x58e066['id']]){if(_[_0xe1da('0x19')](this[_0xe1da('0xe')][_0x58e066['id']]['Smtp'])){this[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')]={};}this[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')][_0xe1da('0x31')]=moment();return new BPromise(function(_0x143fbe,_0x400b19){return _0x583395['smtp']['verify'](_0x58e066)[_0xe1da('0x2b')](function(_0x4dcb7f){_0x583395[_0xe1da('0xe')][_0x58e066['id']]['Smtp'][_0xe1da('0x17')]='verified';_0x583395[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')]['messageStatus']='';_0x583395['emit'](_0x58e066['id']);_0x143fbe(_0x4dcb7f);})[_0xe1da('0x2c')](function(_0x256ef4){_0x583395[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')]['status']=_0xe1da('0x23');_0x583395[_0xe1da('0xe')][_0x58e066['id']][_0xe1da('0x30')][_0xe1da('0x18')]=_0x256ef4;_0x583395[_0xe1da('0x12')](_0x58e066['id']);_0x400b19(_0x256ef4);});});}return this['smtp'][_0xe1da('0x32')](_0x58e066);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4ebc962..aa2b456 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 _0xdb28=['attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','INBOX','account','getAccount','once','handleReady','bind','end','handleEnd','error','handleError','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','mailbox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody'];(function(_0x1b8679,_0x3d8f6d){var _0x10f361=function(_0x32e7c3){while(--_0x32e7c3){_0x1b8679['push'](_0x1b8679['shift']());}};_0x10f361(++_0x3d8f6d);}(_0xdb28,0x106));var _0x8db2=function(_0x557530,_0x1f445d){_0x557530=_0x557530-0x0;var _0x448389=_0xdb28[_0x557530];return _0x448389;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var Imap=require(_0x8db2('0x2'));var simpleParser=require(_0x8db2('0x3'))['simpleParser'];var Iconv=require(_0x8db2('0x4'))[_0x8db2('0x5')];var EventEmitter=require(_0x8db2('0x6'))[_0x8db2('0x7')];var utils=require(_0x8db2('0x8'));var logger=require('../../../config/logger')(_0x8db2('0x9'));function EmailImap(_0x1d2dd3,_0x5f42ee){this['mailbox']=_0x8db2('0xa');this[_0x8db2('0xb')]=this[_0x8db2('0xc')](_0x1d2dd3,_0x5f42ee);this[_0x8db2('0x2')]=new Imap(this[_0x8db2('0xb')]);this[_0x8db2('0x2')][_0x8db2('0xd')]('ready',this[_0x8db2('0xe')][_0x8db2('0xf')](this));this[_0x8db2('0x2')]['once'](_0x8db2('0x10'),this[_0x8db2('0x11')]['bind'](this));this[_0x8db2('0x2')]['on'](_0x8db2('0x12'),this[_0x8db2('0x13')][_0x8db2('0xf')](this));this[_0x8db2('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x8db2('0x14')][_0x8db2('0xc')]=function(_0x350d61,_0x1d6a15){var _0x227355={'connTimeout':_0x350d61[_0x8db2('0x15')]?_0x350d61[_0x8db2('0x15')]*0x3e8:0x2710,'authTimeout':_0x350d61[_0x8db2('0x16')]?_0x350d61[_0x8db2('0x16')]*0x3e8:0x1388};if(_0x350d61[_0x8db2('0x17')]){_0x227355['user']=_0x350d61[_0x8db2('0x18')];_0x227355[_0x8db2('0x9')]=_0x1d6a15||_0x350d61['user']||_0x8db2('0x19');if(_0x350d61[_0x8db2('0x1a')]){_0x227355[_0x8db2('0x1b')]=utils[_0x8db2('0x1c')](_0x350d61[_0x8db2('0x1d')][_0x8db2('0x1e')],_0x350d61['user']);}else{_0x227355['password']=_0x350d61[_0x8db2('0x1f')];}}else{if(_0x350d61[_0x8db2('0x20')]){_0x227355[_0x8db2('0x18')]=_0x350d61[_0x8db2('0x18')];_0x227355['password']=_0x350d61[_0x8db2('0x1f')];}}_0x227355[_0x8db2('0x21')]=_0x350d61[_0x8db2('0x21')];_0x227355[_0x8db2('0x22')]=_0x350d61[_0x8db2('0x22')]||0x3e1;if(_0x350d61['tls']){_0x227355[_0x8db2('0x23')]=!![];}else{_0x227355[_0x8db2('0x23')]=![];_0x227355[_0x8db2('0x24')]=_0x8db2('0x25');}return _0x227355;};EmailImap[_0x8db2('0x14')][_0x8db2('0xe')]=function(){this[_0x8db2('0x2')]['openBox'](this[_0x8db2('0x26')],![],this['handleOpenBox']['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0xec8cd2,_0x29b5cd){if(_0xec8cd2){this[_0x8db2('0x13')](_0xec8cd2,!![]);}else{this[_0x8db2('0x27')](_0x8db2('0x28'),_0x29b5cd);this[_0x8db2('0x29')]();}};EmailImap['prototype'][_0x8db2('0x2a')]=function(_0x372311){if(_0x372311){this[_0x8db2('0x13')](_0x372311,!![]);}else{this[_0x8db2('0x2')]['end']();}};EmailImap[_0x8db2('0x14')][_0x8db2('0x29')]=function(){this[_0x8db2('0x2')][_0x8db2('0x2b')]([_0x8db2('0x2c')],this[_0x8db2('0x2d')][_0x8db2('0xf')](this));};EmailImap[_0x8db2('0x14')][_0x8db2('0x2d')]=function(_0x493cab,_0x4718ec){if(_0x493cab){this['handleError'](_0x493cab,!![]);}else{if(_0x4718ec['length']){try{var _0x302188=this[_0x8db2('0x2')][_0x8db2('0x2e')](_0x4718ec,{'bodies':'','markSeen':!![]});_0x302188['on']('message',this[_0x8db2('0x2f')]['bind'](this));_0x302188[_0x8db2('0xd')](_0x8db2('0x12'),this[_0x8db2('0x30')]['bind'](this));_0x302188['once'](_0x8db2('0x10'),this[_0x8db2('0x31')]['bind'](this));}catch(_0x516dcb){logger[_0x8db2('0x12')](_0x516dcb);}}else{this[_0x8db2('0x2')][_0x8db2('0x32')](!![],this[_0x8db2('0x2a')][_0x8db2('0xf')](this));}}};EmailImap[_0x8db2('0x14')][_0x8db2('0x2f')]=function(_0xae31b7){_0xae31b7['on'](_0x8db2('0x33'),this[_0x8db2('0x34')]['bind'](this));_0xae31b7[_0x8db2('0xd')](_0x8db2('0x35'),this['handleMessageAttributes'][_0x8db2('0xf')](this));_0xae31b7[_0x8db2('0xd')]('end',this['handleMessageEnd'][_0x8db2('0xf')](this));};EmailImap['prototype'][_0x8db2('0x34')]=function(_0x264696){simpleParser(_0x264696,{'Iconv':Iconv},this[_0x8db2('0x36')][_0x8db2('0xf')](this));};EmailImap['prototype'][_0x8db2('0x37')]=function(){};EmailImap['prototype'][_0x8db2('0x38')]=function(){};EmailImap[_0x8db2('0x14')][_0x8db2('0x36')]=function(_0x4599c3,_0x50e88a){if(_0x4599c3){logger['error'](_0x4599c3);}else{var _0x2acd1f=this;utils[_0x8db2('0x39')](this['account'],_0x50e88a,function(_0x2bac57){_0x2acd1f[_0x8db2('0x27')](_0x8db2('0x9'),_0x2bac57);});}};EmailImap['prototype'][_0x8db2('0x31')]=function(){this[_0x8db2('0x2')][_0x8db2('0x32')](!![],this[_0x8db2('0x2a')][_0x8db2('0xf')](this));};EmailImap[_0x8db2('0x14')][_0x8db2('0x30')]=function(_0x1575ea){this[_0x8db2('0x13')](_0x1575ea);this[_0x8db2('0x2')][_0x8db2('0x32')](!![],this[_0x8db2('0x2a')][_0x8db2('0xf')](this));};EmailImap['prototype'][_0x8db2('0x11')]=function(){this[_0x8db2('0x27')]('end');};EmailImap['prototype'][_0x8db2('0x13')]=function(_0x4f1a49,_0x130eb9){logger[_0x8db2('0x12')](_0x8db2('0x13'),this[_0x8db2('0xb')][_0x8db2('0x9')],JSON[_0x8db2('0x3a')](_0x4f1a49));var _0xa53fba='';if(_0x4f1a49){if(_0x4f1a49['textCode']){_0xa53fba=_0x4f1a49[_0x8db2('0x3b')];}else{for(var _0x3d44de in _0x4f1a49){if(_0x4f1a49[_0x8db2('0x3c')](_0x3d44de)){_0xa53fba+=_[_0x8db2('0x3d')](_0x3d44de)+':\x20'+_0x4f1a49[_0x3d44de]+'\x0a';}}}}if(_0x130eb9){this['imap'][_0x8db2('0x10')]();}else{this[_0x8db2('0x27')](_0x8db2('0x12'),_0xa53fba);this[_0x8db2('0x27')]('end');}};module[_0x8db2('0x3e')]=EmailImap; \ No newline at end of file +var _0xe2fe=['handleMessageAttributes','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','getAccount','account','imap','ready','handleReady','handleEnd','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','data5','password','authentication','host','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','error','handleFetchError','once','closeBox','handleFetchMessage','body','attributes','handleMessageBody','handleSimpleParser'];(function(_0x640509,_0x288391){var _0x4734bf=function(_0x5656d4){while(--_0x5656d4){_0x640509['push'](_0x640509['shift']());}};_0x4734bf(++_0x288391);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0xee2f('0x1'))['simpleParser'];var Iconv=require(_0xee2f('0x2'))[_0xee2f('0x3')];var EventEmitter=require(_0xee2f('0x4'))[_0xee2f('0x5')];var utils=require(_0xee2f('0x6'));var logger=require('../../../config/logger')(_0xee2f('0x7'));function EmailImap(_0x2b7e7c,_0x49926b){this[_0xee2f('0x8')]=_0xee2f('0x9');this['account']=this[_0xee2f('0xa')](_0x2b7e7c,_0x49926b);this['imap']=new Imap(this[_0xee2f('0xb')]);this[_0xee2f('0xc')]['once'](_0xee2f('0xd'),this[_0xee2f('0xe')]['bind'](this));this['imap']['once']('end',this[_0xee2f('0xf')]['bind'](this));this['imap']['on']('error',this[_0xee2f('0x10')][_0xee2f('0x11')](this));this[_0xee2f('0xc')][_0xee2f('0x12')]();}util[_0xee2f('0x13')](EmailImap,EventEmitter);EmailImap[_0xee2f('0x14')]['getAccount']=function(_0x3861e6,_0x531c3a){var _0x36db10={'connTimeout':_0x3861e6[_0xee2f('0x15')]?_0x3861e6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3861e6[_0xee2f('0x16')]?_0x3861e6[_0xee2f('0x16')]*0x3e8:0x1388};if(_0x3861e6[_0xee2f('0x17')]){_0x36db10[_0xee2f('0x18')]=_0x3861e6[_0xee2f('0x18')];_0x36db10['email']=_0x531c3a||_0x3861e6[_0xee2f('0x18')]||'anonymous@xcally.com';if(_0x3861e6[_0xee2f('0x19')]){_0x36db10[_0xee2f('0x1a')]=utils['generateXOAuth2Token'](_0x3861e6['CloudProvider'][_0xee2f('0x1b')],_0x3861e6['user']);}else{_0x36db10[_0xee2f('0x1c')]=_0x3861e6[_0xee2f('0x1c')];}}else{if(_0x3861e6[_0xee2f('0x1d')]){_0x36db10['user']=_0x3861e6[_0xee2f('0x18')];_0x36db10[_0xee2f('0x1c')]=_0x3861e6[_0xee2f('0x1c')];}}_0x36db10[_0xee2f('0x1e')]=_0x3861e6[_0xee2f('0x1e')];_0x36db10['port']=_0x3861e6['port']||0x3e1;if(_0x3861e6[_0xee2f('0x1f')]){_0x36db10[_0xee2f('0x1f')]=!![];}else{_0x36db10[_0xee2f('0x1f')]=![];_0x36db10[_0xee2f('0x20')]=_0xee2f('0x21');}return _0x36db10;};EmailImap[_0xee2f('0x14')][_0xee2f('0xe')]=function(){this['imap'][_0xee2f('0x22')](this[_0xee2f('0x8')],![],this[_0xee2f('0x23')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x23')]=function(_0x15a1b1,_0x13013f){if(_0x15a1b1){this[_0xee2f('0x10')](_0x15a1b1,!![]);}else{this[_0xee2f('0x24')](_0xee2f('0x25'),_0x13013f);this[_0xee2f('0x26')]();}};EmailImap[_0xee2f('0x14')][_0xee2f('0x27')]=function(_0x53f6ed){if(_0x53f6ed){this['handleError'](_0x53f6ed,!![]);}else{this['imap'][_0xee2f('0x28')]();}};EmailImap[_0xee2f('0x14')][_0xee2f('0x26')]=function(){this[_0xee2f('0xc')][_0xee2f('0x29')]([_0xee2f('0x2a')],this['handleReadUnseen'][_0xee2f('0x11')](this));};EmailImap['prototype'][_0xee2f('0x2b')]=function(_0x180429,_0x25ee9c){if(_0x180429){this[_0xee2f('0x10')](_0x180429,!![]);}else{if(_0x25ee9c[_0xee2f('0x2c')]){try{var _0x47d5a6=this[_0xee2f('0xc')][_0xee2f('0x2d')](_0x25ee9c,{'bodies':'','markSeen':!![]});_0x47d5a6['on']('message',this['handleFetchMessage'][_0xee2f('0x11')](this));_0x47d5a6['once'](_0xee2f('0x2e'),this[_0xee2f('0x2f')]['bind'](this));_0x47d5a6[_0xee2f('0x30')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x3f1fe8){logger[_0xee2f('0x2e')](_0x3f1fe8);}}else{this['imap'][_0xee2f('0x31')](!![],this[_0xee2f('0x27')][_0xee2f('0x11')](this));}}};EmailImap[_0xee2f('0x14')][_0xee2f('0x32')]=function(_0x4e682d){_0x4e682d['on'](_0xee2f('0x33'),this['handleMessageBody'][_0xee2f('0x11')](this));_0x4e682d[_0xee2f('0x30')](_0xee2f('0x34'),this['handleMessageAttributes'][_0xee2f('0x11')](this));_0x4e682d['once'](_0xee2f('0x28'),this['handleMessageEnd'][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x35')]=function(_0x1fb2cd){simpleParser(_0x1fb2cd,{'Iconv':Iconv},this[_0xee2f('0x36')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x37')]=function(){};EmailImap[_0xee2f('0x14')][_0xee2f('0x38')]=function(){};EmailImap[_0xee2f('0x14')]['handleSimpleParser']=function(_0x4584b8,_0x47e54b){if(_0x4584b8){logger[_0xee2f('0x2e')](_0x4584b8);}else{var _0x3cbc01=this;utils[_0xee2f('0x39')](this[_0xee2f('0xb')],_0x47e54b,function(_0xaddf3b){_0x3cbc01[_0xee2f('0x24')](_0xee2f('0x7'),_0xaddf3b);});}};EmailImap[_0xee2f('0x14')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0xee2f('0x27')]['bind'](this));};EmailImap[_0xee2f('0x14')]['handleFetchError']=function(_0x558aa3){this['handleError'](_0x558aa3);this['imap'][_0xee2f('0x31')](!![],this[_0xee2f('0x27')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')]['handleEnd']=function(){this['emit'](_0xee2f('0x28'));};EmailImap['prototype']['handleError']=function(_0x8204dc,_0x61d1c){logger[_0xee2f('0x2e')]('handleError',this[_0xee2f('0xb')][_0xee2f('0x7')],JSON[_0xee2f('0x3a')](_0x8204dc));var _0x4cb3fd='';if(_0x8204dc){if(_0x8204dc['textCode']){_0x4cb3fd=_0x8204dc[_0xee2f('0x3b')];}else{for(var _0xc40338 in _0x8204dc){if(_0x8204dc[_0xee2f('0x3c')](_0xc40338)){_0x4cb3fd+=_[_0xee2f('0x3d')](_0xc40338)+':\x20'+_0x8204dc[_0xc40338]+'\x0a';}}}}if(_0x61d1c){this['imap'][_0xee2f('0x28')]();}else{this[_0xee2f('0x24')](_0xee2f('0x2e'),_0x4cb3fd);this[_0xee2f('0x24')](_0xee2f('0x28'));}};module[_0xee2f('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 803f730..3015cd4 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 _0x5b1b=['send','createTransport','use','sendMail','toString','prototype','verify','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x5cc173,_0x1d7a20){var _0x3f1985=function(_0x25f79a){while(--_0x25f79a){_0x5cc173['push'](_0x5cc173['shift']());}};_0x3f1985(++_0x1d7a20);}(_0x5b1b,0x6c));var _0xb5b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b1b[_0x321bb2];return _0x9c12ed;};'use strict';var nodemailer=require(_0xb5b1('0x0'));var inlineBase64=require(_0xb5b1('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xb5b1('0x2')]=function(_0x135b3f,_0x36c57d){return new Promise(function(_0x57b77f,_0x600f6c){var _0x14b9c6=nodemailer[_0xb5b1('0x3')](_0x135b3f);_0x14b9c6[_0xb5b1('0x4')]('compile',inlineBase64());_0x14b9c6[_0xb5b1('0x5')](_0x36c57d,function(_0x4888c4,_0x3fb946){if(_0x4888c4){_0x600f6c(_0x4888c4[_0xb5b1('0x6')]());}else{_0x57b77f(_0x3fb946);}});});};EmailSmtp[_0xb5b1('0x7')][_0xb5b1('0x8')]=function(_0x4b5fe6){return new Promise(function(_0x19f668,_0x34bc59){var _0x58f5ca=nodemailer[_0xb5b1('0x3')](_0x4b5fe6);_0x58f5ca[_0xb5b1('0x8')](function(_0xc8e3aa,_0x2a7bfa){if(_0xc8e3aa){_0x34bc59(_0xc8e3aa['toString']());}else{if(_0x2a7bfa){_0x19f668(_0x2a7bfa);}else{_0x34bc59('Not\x20verifired');}}});});};module[_0xb5b1('0x9')]=EmailSmtp; \ No newline at end of file +var _0x6940=['use','compile','sendMail','toString','prototype','verify','createTransport','nodemailer','nodemailer-plugin-inline-base64','send'];(function(_0x475b6c,_0x35cb61){var _0x67b8a6=function(_0x509a2b){while(--_0x509a2b){_0x475b6c['push'](_0x475b6c['shift']());}};_0x67b8a6(++_0x35cb61);}(_0x6940,0x197));var _0x0694=function(_0x23d245,_0x23bf63){_0x23d245=_0x23d245-0x0;var _0x4c70e6=_0x6940[_0x23d245];return _0x4c70e6;};'use strict';var nodemailer=require(_0x0694('0x0'));var inlineBase64=require(_0x0694('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x0694('0x2')]=function(_0x134b3c,_0x53a76c){return new Promise(function(_0x45a91f,_0x5e20f5){var _0x11398c=nodemailer['createTransport'](_0x134b3c);_0x11398c[_0x0694('0x3')](_0x0694('0x4'),inlineBase64());_0x11398c[_0x0694('0x5')](_0x53a76c,function(_0x4a2ddb,_0x531020){if(_0x4a2ddb){_0x5e20f5(_0x4a2ddb[_0x0694('0x6')]());}else{_0x45a91f(_0x531020);}});});};EmailSmtp[_0x0694('0x7')][_0x0694('0x8')]=function(_0x2fd40e){return new Promise(function(_0x598174,_0xaa89f4){var _0x37bb4b=nodemailer[_0x0694('0x9')](_0x2fd40e);_0x37bb4b[_0x0694('0x8')](function(_0x9b190b,_0x27e669){if(_0x9b190b){_0xaa89f4(_0x9b190b[_0x0694('0x6')]());}else{if(_0x27e669){_0x598174(_0x27e669);}else{_0xaa89f4('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b4530dc..02d431b 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 _0xc757=['moment','randomstring','path','util','../../../config/logger','head','value','address','anonymous','@xcally.com','name','substring','split','slice','join','Anonymous','pop','length','generate','test','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','utf-8','base64','lodash'];(function(_0x5a6f32,_0x58b204){var _0x18c961=function(_0x2b7dc2){while(--_0x2b7dc2){_0x5a6f32['push'](_0x5a6f32['shift']());}};_0x18c961(++_0x58b204);}(_0xc757,0xe3));var _0x7c75=function(_0x4e0269,_0x5608e3){_0x4e0269=_0x4e0269-0x0;var _0x411ea=_0xc757[_0x4e0269];return _0x411ea;};'use strict';var _=require(_0x7c75('0x0'));var moment=require(_0x7c75('0x1'));var random=require(_0x7c75('0x2'));var fs=require('fs');var path=require(_0x7c75('0x3'));var util=require(_0x7c75('0x4'));var tnef=require('node-tnef');var logger=require(_0x7c75('0x5'))('email');var config=require('../../../config/environment');function getAddress(_0x2ec1bc){var _0x2fb663=_[_0x7c75('0x6')](_0x2ec1bc[_0x7c75('0x7')]);return _0x2fb663&&_0x2fb663[_0x7c75('0x8')]?_0x2fb663[_0x7c75('0x8')]:_0x7c75('0x9')+random['generate'](0x6)+_0x7c75('0xa');}function getFirstName(_0x543c1c){var _0x32964a=_[_0x7c75('0x6')](_0x543c1c[_0x7c75('0x7')]);if(_0x32964a&&_0x32964a[_0x7c75('0xb')]){if(_0x32964a[_0x7c75('0xb')]==_0x32964a[_0x7c75('0x8')]){return _0x32964a['name'][_0x7c75('0xc')](0x0,_0x32964a[_0x7c75('0xb')]['indexOf']('@'));}var _0x5278d6=_0x32964a[_0x7c75('0xb')][_0x7c75('0xd')](/\s+/);return _0x5278d6['length']>0x1?_0x5278d6[_0x7c75('0xe')](0x0,-0x1)[_0x7c75('0xf')]('\x20'):_0x32964a['name'];}return _0x7c75('0x10');}function getLastName(_0x2636b6){var _0x32b3ee=_['head'](_0x2636b6[_0x7c75('0x7')]);if(_0x32b3ee&&_0x32b3ee[_0x7c75('0xb')]){var _0x2f01e5=_0x32b3ee['name'][_0x7c75('0xd')](/\s+/);return _0x2f01e5['length']>0x1?_0x2f01e5[_0x7c75('0x11')]():'';}return'';}function getMails(_0xefe7a9,_0x44f955){var _0x2799bc='';for(var _0x34bc01=0x0;_0x34bc01<_0x44f955[_0x7c75('0x7')][_0x7c75('0x12')];_0x34bc01+=0x1){if(_0x44f955[_0x7c75('0x7')][_0x34bc01][_0x7c75('0x8')]!==_0xefe7a9){if(!_['isEmpty'](_0x2799bc)){_0x2799bc+=',';}_0x2799bc+=_0x44f955[_0x7c75('0x7')][_0x34bc01][_0x7c75('0xb')]||_0x44f955['value'][_0x34bc01][_0x7c75('0x8')]||'';_0x2799bc+='\x20<';_0x2799bc+=_0x44f955[_0x7c75('0x7')][_0x34bc01][_0x7c75('0x8')]?_0x44f955['value'][_0x34bc01]['address']:'anonymous'+random[_0x7c75('0x13')](0x6)+'@xcally.com';_0x2799bc+='>';}}return _0x2799bc;}function parseEmail(_0x12de72,_0x144572,_0x49cf12){if(_0x144572['html']){var _0x5cf275=/)<[^<]*)*<\/script>/gi;while(_0x5cf275[_0x7c75('0x14')](_0x144572[_0x7c75('0x15')])){_0x144572[_0x7c75('0x15')]=_0x144572[_0x7c75('0x15')][_0x7c75('0x16')](_0x5cf275,'');}if(_0x144572[_0x7c75('0x15')]['includes'](_0x7c75('0x17'))){var _0x4f756f=[];_0x144572[_0x7c75('0x18')][_0x7c75('0x19')](_0xba58d7=>{_0x4f756f[_0x7c75('0x1a')](_0xba58d7['filename']);});var _0x34e4aa=/]+>/g;var _0x28e35b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1630ab=_0x144572[_0x7c75('0x15')]['replace'](_0x28e35b,_0x7c75('0x1b'));var _0x1942f6=_0x1630ab[_0x7c75('0x16')](_0x34e4aa,_0x7c75('0x1c'));for(let _0x4b1bfd=0x0;_0x4b1bfd<_0x4f756f[_0x7c75('0x12')];_0x4b1bfd++){var _0x5d6ee5=_0x1942f6['replace'](_0x7c75('0x1c'),_0x7c75('0x1d')+_0x4f756f[_0x4b1bfd]+_0x7c75('0x1e'));_0x1942f6=_0x5d6ee5;}_0x144572['html']=_0x1942f6;}_0x49cf12[_0x7c75('0x1f')]=_0x144572['html'];}else{_0x49cf12[_0x7c75('0x1f')]=_0x144572[_0x7c75('0x20')];}if(_0x49cf12['body']){_0x49cf12[_0x7c75('0x1f')]=_0x49cf12[_0x7c75('0x1f')]['replace'](/0x0){var _0x248c80=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x7c75('0x34')];for(var _0x4d51e7=0x0;_0x4d51e7<_0x144572['headerLines'][_0x7c75('0x12')];_0x4d51e7++){var _0x3bbd15=_[_0x7c75('0x35')](_0x248c80,_0x144572[_0x7c75('0x33')][_0x4d51e7]['line']);if(_0x3bbd15>=0x0){_0x49cf12[_0x7c75('0x36')]=!![];}}}return _0x49cf12;}exports['parser']=function(_0x3cc878,_0x22133a,_0x43f275){var _0x30ac62={'from':getAddress(_0x22133a[_0x7c75('0x37')]),'firstName':getFirstName(_0x22133a[_0x7c75('0x37')]),'lastName':getLastName(_0x22133a[_0x7c75('0x37')]),'mapKey':'email','message':{'from':getMails(_0x3cc878['email'],_0x22133a[_0x7c75('0x37')]),'to':_0x3cc878[_0x7c75('0x24')],'cc':'','subject':_0x22133a[_0x7c75('0x38')]||'','messageId':_0x22133a[_0x7c75('0x39')],'inReplyTo':_0x22133a[_0x7c75('0x3a')],'sentAt':moment(_0x22133a[_0x7c75('0x3b')])['format'](_0x7c75('0x3c')),'attach':![],'attachments':[]}};if(!_0x22133a[_0x7c75('0x15')]&&!_0x22133a[_0x7c75('0x20')]){var _0x305892=_[_0x7c75('0x3d')](_0x22133a[_0x7c75('0x18')],{'contentType':_0x7c75('0x3e')});if(_0x305892['length']){logger[_0x7c75('0x3f')](util[_0x7c75('0x2d')](_0x7c75('0x40'),_0x22133a[_0x7c75('0x39')]));tnef[_0x7c75('0x41')](_[_0x7c75('0x42')](_0x305892)['content'],function(_0x74e366,_0x14131a){if(_0x14131a){_0x22133a[_0x7c75('0x15')]=_0x14131a[_0x7c75('0x43')]||_0x7c75('0x44');if(_0x14131a[_0x7c75('0x45')]){for(var _0x35903f=0x0;_0x35903f<_0x14131a[_0x7c75('0x45')][_0x7c75('0x12')];_0x35903f++){var _0x3ef014=_0x14131a[_0x7c75('0x45')][_0x35903f];_0x30ac62[_0x7c75('0x22')]['attachments'][_0x7c75('0x1a')]({'filename':_0x3ef014[_0x7c75('0x46')],'content':Buffer['from'](_0x3ef014[_0x7c75('0x47')])});}}}_0x43f275(parseEmail(_0x3cc878,_0x22133a,_0x30ac62));});}else{_0x22133a[_0x7c75('0x15')]=_0x7c75('0x44');_0x43f275(parseEmail(_0x3cc878,_0x22133a,_0x30ac62));}}else{_0x43f275(parseEmail(_0x3cc878,_0x22133a,_0x30ac62));}};exports[_0x7c75('0x48')]=function(_0xb864b1,_0xf80c0f){var _0x233bcd=[_0x7c75('0x49')+(_0xf80c0f||''),'auth=Bearer\x20'+_0xb864b1,'',''];return Buffer[_0x7c75('0x37')](_0x233bcd[_0x7c75('0xf')](''),_0x7c75('0x4a'))['toString'](_0x7c75('0x4b'));}; \ No newline at end of file +var _0x7f24=['message','originTo','isEmpty','originCc','email','bcc','attach','type','attachment','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','name','length','slice','join','Anonymous','split','pop','@xcally.com','test','html','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','0x1?_0x152d63[_0x47f2('0xd')](0x0,-0x1)[_0x47f2('0xe')]('\x20'):_0xef83e7[_0x47f2('0xb')];}return _0x47f2('0xf');}function getLastName(_0x288571){var _0x10f348=_['head'](_0x288571[_0x47f2('0x7')]);if(_0x10f348&&_0x10f348[_0x47f2('0xb')]){var _0x3af49b=_0x10f348['name'][_0x47f2('0x10')](/\s+/);return _0x3af49b['length']>0x1?_0x3af49b[_0x47f2('0x11')]():'';}return'';}function getMails(_0x13e927,_0x3febe1){var _0x22c569='';for(var _0x231001=0x0;_0x231001<_0x3febe1['value'][_0x47f2('0xc')];_0x231001+=0x1){if(_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]!==_0x13e927){if(!_['isEmpty'](_0x22c569)){_0x22c569+=',';}_0x22c569+=_0x3febe1['value'][_0x231001][_0x47f2('0xb')]||_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]||'';_0x22c569+='\x20<';_0x22c569+=_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]?_0x3febe1[_0x47f2('0x7')][_0x231001][_0x47f2('0x8')]:'anonymous'+random[_0x47f2('0xa')](0x6)+_0x47f2('0x12');_0x22c569+='>';}}return _0x22c569;}function parseEmail(_0x1f2b68,_0x108990,_0x659940){if(_0x108990['html']){var _0x3ba212=/)<[^<]*)*<\/script>/gi;while(_0x3ba212[_0x47f2('0x13')](_0x108990[_0x47f2('0x14')])){_0x108990[_0x47f2('0x14')]=_0x108990['html'][_0x47f2('0x15')](_0x3ba212,'');}if(_0x108990[_0x47f2('0x14')][_0x47f2('0x16')]('{_0x39c5ea[_0x47f2('0x19')](_0x339267[_0x47f2('0x1a')]);});var _0x5ed30c=/]+>/g;var _0x490412=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x229bb3=_0x108990[_0x47f2('0x14')][_0x47f2('0x15')](_0x490412,_0x47f2('0x1b'));var _0x437696=_0x229bb3[_0x47f2('0x15')](_0x5ed30c,'_IMG');for(let _0x31acd6=0x0;_0x31acd6<_0x39c5ea[_0x47f2('0xc')];_0x31acd6++){var _0x29dc79=_0x437696[_0x47f2('0x15')](_0x47f2('0x1c'),_0x47f2('0x1d')+_0x39c5ea[_0x31acd6]+_0x47f2('0x1e'));_0x437696=_0x29dc79;}_0x108990[_0x47f2('0x14')]=_0x437696;}_0x659940[_0x47f2('0x1f')]=_0x108990['html'];}else{_0x659940[_0x47f2('0x1f')]=_0x108990['textAsHtml'];}if(_0x659940['body']){_0x659940[_0x47f2('0x1f')]=_0x659940[_0x47f2('0x1f')]['replace'](/0x0){var _0x4e23cd=['Auto-Submitted:\x20auto-replied',_0x47f2('0x33'),'Precedence:\x20auto_reply'];for(var _0x11f6b7=0x0;_0x11f6b7<_0x108990['headerLines']['length'];_0x11f6b7++){var _0x5bdebe=_['indexOf'](_0x4e23cd,_0x108990[_0x47f2('0x32')][_0x11f6b7][_0x47f2('0x34')]);if(_0x5bdebe>=0x0){_0x659940[_0x47f2('0x35')]=!![];}}}return _0x659940;}exports[_0x47f2('0x36')]=function(_0x4b37f9,_0x5ac995,_0x5b747e){var _0x39f479={'from':getAddress(_0x5ac995[_0x47f2('0x37')]),'firstName':getFirstName(_0x5ac995['from']),'lastName':getLastName(_0x5ac995[_0x47f2('0x37')]),'mapKey':'email','message':{'from':getMails(_0x4b37f9[_0x47f2('0x25')],_0x5ac995['from']),'to':_0x4b37f9[_0x47f2('0x25')],'cc':'','subject':_0x5ac995[_0x47f2('0x38')]||'','messageId':_0x5ac995[_0x47f2('0x39')],'inReplyTo':_0x5ac995[_0x47f2('0x3a')],'sentAt':moment(_0x5ac995[_0x47f2('0x3b')])['format'](_0x47f2('0x3c')),'attach':![],'attachments':[]}};if(!_0x5ac995[_0x47f2('0x14')]&&!_0x5ac995[_0x47f2('0x3d')]){var _0x2895d5=_[_0x47f2('0x3e')](_0x5ac995[_0x47f2('0x17')],{'contentType':_0x47f2('0x3f')});if(_0x2895d5[_0x47f2('0xc')]){logger[_0x47f2('0x40')](util[_0x47f2('0x2b')](_0x47f2('0x41'),_0x5ac995['messageId']));tnef[_0x47f2('0x42')](_[_0x47f2('0x43')](_0x2895d5)[_0x47f2('0x30')],function(_0x5b4e56,_0x207422){if(_0x207422){_0x5ac995[_0x47f2('0x14')]=_0x207422[_0x47f2('0x44')]||_0x47f2('0x45');if(_0x207422[_0x47f2('0x46')]){for(var _0x99866e=0x0;_0x99866e<_0x207422[_0x47f2('0x46')][_0x47f2('0xc')];_0x99866e++){var _0x2dc425=_0x207422[_0x47f2('0x46')][_0x99866e];_0x39f479[_0x47f2('0x21')]['attachments'][_0x47f2('0x19')]({'filename':_0x2dc425[_0x47f2('0x47')],'content':Buffer[_0x47f2('0x37')](_0x2dc425[_0x47f2('0x48')])});}}}_0x5b747e(parseEmail(_0x4b37f9,_0x5ac995,_0x39f479));});}else{_0x5ac995['html']=_0x47f2('0x45');_0x5b747e(parseEmail(_0x4b37f9,_0x5ac995,_0x39f479));}}else{_0x5b747e(parseEmail(_0x4b37f9,_0x5ac995,_0x39f479));}};exports[_0x47f2('0x49')]=function(_0x228811,_0x40fde6){var _0x2d2936=[_0x47f2('0x4a')+(_0x40fde6||''),_0x47f2('0x4b')+_0x228811,'',''];return Buffer['from'](_0x2d2936[_0x47f2('0xe')](''),_0x47f2('0x4c'))[_0x47f2('0x4d')](_0x47f2('0x4e'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9d42cd6..a4668f9 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 _0x5c2d=['active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x1f01aa,_0x507386){var _0x229c55=function(_0x4ff01a){while(--_0x4ff01a){_0x1f01aa['push'](_0x1f01aa['shift']());}};_0x229c55(++_0x507386);}(_0x5c2d,0x114));var _0xd5c2=function(_0x51d1f7,_0x22b9cc){_0x51d1f7=_0x51d1f7-0x0;var _0x59d7d2=_0x5c2d[_0x51d1f7];return _0x59d7d2;};'use strict';var _=require(_0xd5c2('0x0'));function MailAccount(_0x12320b){this['id']=_0x12320b['id']||0x0;this[_0xd5c2('0x1')]=_0x12320b[_0xd5c2('0x1')]||_0xd5c2('0x2');this[_0xd5c2('0x3')]=_0x12320b[_0xd5c2('0x3')]||'SERV';this[_0xd5c2('0x4')]=_0x12320b[_0xd5c2('0x4')]||![];this[_0xd5c2('0x5')]=_0x12320b[_0xd5c2('0x5')]||[];this[_0xd5c2('0x6')]=_0x12320b[_0xd5c2('0x6')]||[];}module[_0xd5c2('0x7')]=MailAccount; \ No newline at end of file +var _0xf6f3=['Imap','Smtp','lodash','name','key','active'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0xf6f3,0x1d6));var _0x3f6f=function(_0x208025,_0x1089a3){_0x208025=_0x208025-0x0;var _0xee6b7f=_0xf6f3[_0x208025];return _0xee6b7f;};'use strict';var _=require(_0x3f6f('0x0'));function MailAccount(_0x2c4fec){this['id']=_0x2c4fec['id']||0x0;this[_0x3f6f('0x1')]=_0x2c4fec[_0x3f6f('0x1')]||'Service';this['key']=_0x2c4fec[_0x3f6f('0x2')]||'SERV';this[_0x3f6f('0x3')]=_0x2c4fec[_0x3f6f('0x3')]||![];this[_0x3f6f('0x4')]=_0x2c4fec[_0x3f6f('0x4')]||[];this[_0x3f6f('0x5')]=_0x2c4fec[_0x3f6f('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3b8623c..4c32b96 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 _0x485b=['isUndefined','merge','exports','lodash','../model/mailAccount','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts'];(function(_0x249565,_0x2a026a){var _0x43dee8=function(_0x15a1ab){while(--_0x15a1ab){_0x249565['push'](_0x249565['shift']());}};_0x43dee8(++_0x2a026a);}(_0x485b,0x186));var _0xb485=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x485b[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xb485('0x0'));var MailAccount=require(_0xb485('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4d5a40,_0x2c48dc,_0xda5b4e){var _0x4b0298=_['mapKeys'](_0x4d5a40,function(_0x64f699,_0x1a0fc3){return _0x64f699[_0xda5b4e];});for(var _0x42a99b in _0x2c48dc){if(_0x2c48dc[_0xb485('0x2')](_0x42a99b)){if(!_0x4b0298[_0x42a99b]){delete _0x2c48dc[_0x42a99b];}}}}Realtime[_0xb485('0x3')][_0xb485('0x4')]=function(_0x3b4649,_0x10ea0a){for(var _0x3d5bb9 in _0x10ea0a){if(_0x3b4649['hasOwnProperty'](_0x3d5bb9)){_0x3b4649[_0x3d5bb9]=_0x10ea0a[_0x3d5bb9];}}};Realtime[_0xb485('0x3')]['initMailAccounts']=function(){var _0x3617fc=this;return function(_0x3107dd){if(_0x3107dd){freeIsNotKey(_0x3107dd,_0x3617fc[_0xb485('0x5')],'id');for(var _0x54ea1b=0x0,_0x185f80={},_0x38b13e={};_0x54ea1b<_0x3107dd['length'];_0x54ea1b+=0x1){_0x185f80=_0x3107dd[_0x54ea1b];if(_[_0xb485('0x6')](_0x3617fc[_0xb485('0x5')][_0x185f80['id']])){_0x3617fc['mailAccounts'][_0x185f80['id']]=new MailAccount(_0x185f80);}else{_[_0xb485('0x7')](_0x3617fc[_0xb485('0x5')][_0x185f80['id']],_0x185f80);}}}return _0x3617fc['mailAccounts'];};};module[_0xb485('0x8')]=Realtime; \ No newline at end of file +var _0x1202=['prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1202,0x1d4));var _0x2120=function(_0x1ecb71,_0x370253){_0x1ecb71=_0x1ecb71-0x0;var _0x402229=_0x1202[_0x1ecb71];return _0x402229;};'use strict';var _=require(_0x2120('0x0'));var MailAccount=require(_0x2120('0x1'));var Realtime=function(){this[_0x2120('0x2')]={};};function freeIsNotKey(_0x105241,_0x41fdf9,_0x539da6){var _0x806137=_[_0x2120('0x3')](_0x105241,function(_0x1fbfbc,_0x42eda0){return _0x1fbfbc[_0x539da6];});for(var _0x72d37d in _0x41fdf9){if(_0x41fdf9[_0x2120('0x4')](_0x72d37d)){if(!_0x806137[_0x72d37d]){delete _0x41fdf9[_0x72d37d];}}}}Realtime[_0x2120('0x5')]['mergeFromDatabase']=function(_0x34a10e,_0x3a8e13){for(var _0x185ccd in _0x3a8e13){if(_0x34a10e[_0x2120('0x4')](_0x185ccd)){_0x34a10e[_0x185ccd]=_0x3a8e13[_0x185ccd];}}};Realtime['prototype'][_0x2120('0x6')]=function(){var _0x5cdfee=this;return function(_0x441dad){if(_0x441dad){freeIsNotKey(_0x441dad,_0x5cdfee[_0x2120('0x2')],'id');for(var _0x416d57=0x0,_0x3abeaf={},_0x460408={};_0x416d57<_0x441dad[_0x2120('0x7')];_0x416d57+=0x1){_0x3abeaf=_0x441dad[_0x416d57];if(_[_0x2120('0x8')](_0x5cdfee['mailAccounts'][_0x3abeaf['id']])){_0x5cdfee[_0x2120('0x2')][_0x3abeaf['id']]=new MailAccount(_0x3abeaf);}else{_[_0x2120('0x9')](_0x5cdfee[_0x2120('0x2')][_0x3abeaf['id']],_0x3abeaf);}}}return _0x5cdfee['mailAccounts'];};};module[_0x2120('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 82e7b0e..3f82346 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 _0xcd05=['key','ListId','CloudProvider','type','data5','MailServerOut','getMailAccount','notify','Request','NotifyMailAccount','../client','name','provider','service','email'];(function(_0x31520d,_0x50046a){var _0x4d0d26=function(_0x187fe0){while(--_0x187fe0){_0x31520d['push'](_0x31520d['shift']());}};_0x4d0d26(++_0x50046a);}(_0xcd05,0x163));var _0x5cd0=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xcd05[_0x5ef905];return _0x367808;};'use strict';var client=require(_0x5cd0('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x5cd0('0x1'),_0x5cd0('0x2'),_0x5cd0('0x3'),_0x5cd0('0x4'),'active',_0x5cd0('0x5'),_0x5cd0('0x6'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x5cd0('0x7'),'attributes':['id',_0x5cd0('0x1'),_0x5cd0('0x3'),_0x5cd0('0x8'),_0x5cd0('0x9')],'as':_0x5cd0('0x7')}]},{'model':_0x5cd0('0xa'),'as':'Smtp','include':[{'model':_0x5cd0('0x7'),'attributes':['id',_0x5cd0('0x1'),_0x5cd0('0x3'),_0x5cd0('0x8'),'data5'],'as':_0x5cd0('0x7')}]}]},'log':_0x5cd0('0xb')});};};exports[_0x5cd0('0xc')]=function(_0x6d7fbe,_0x601ac0){return client[_0x5cd0('0xd')](_0x5cd0('0xe'),{'account':{'id':_0x6d7fbe},'body':_0x601ac0,'log':_0x5cd0('0xe')});}; \ No newline at end of file +var _0xeb9a=['provider','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','Smtp','data5','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x547587,_0x48cbd9){var _0x3d7777=function(_0x3e5075){while(--_0x3e5075){_0x547587['push'](_0x547587['shift']());}};_0x3d7777(++_0x48cbd9);}(_0xeb9a,0x178));var _0xaeb9=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xeb9a[_0x101e7b];return _0x4995c0;};'use strict';var client=require(_0xaeb9('0x0'));exports[_0xaeb9('0x1')]=function(){return function(){return client[_0xaeb9('0x2')](_0xaeb9('0x3'),{'options':{'attributes':['id','name',_0xaeb9('0x4'),_0xaeb9('0x5'),'email',_0xaeb9('0x6'),_0xaeb9('0x7'),_0xaeb9('0x8'),_0xaeb9('0x9')],'raw':![],'include':[{'model':_0xaeb9('0xa'),'as':_0xaeb9('0xb'),'include':[{'model':_0xaeb9('0xc'),'attributes':['id',_0xaeb9('0xd'),_0xaeb9('0x5'),_0xaeb9('0xe'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xaeb9('0xf'),'include':[{'model':_0xaeb9('0xc'),'attributes':['id',_0xaeb9('0xd'),_0xaeb9('0x5'),_0xaeb9('0xe'),_0xaeb9('0x10')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0xaeb9('0x11')]=function(_0x131605,_0x1c9b0c){return client[_0xaeb9('0x2')](_0xaeb9('0x12'),{'account':{'id':_0x131605},'body':_0x1c9b0c,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 0d27b81..9375c22 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 _0xacb3=['../client','getSettings','Request','loginMailFrequency'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xacb3,0xc8));var _0x3acb=function(_0x14ead9,_0x410058){_0x14ead9=_0x14ead9-0x0;var _0x17bfe6=_0xacb3[_0x14ead9];return _0x17bfe6;};'use strict';var client=require(_0x3acb('0x0'));exports[_0x3acb('0x1')]=function(){return client[_0x3acb('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3acb('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x9699=['../client','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x9699,0x1f4));var _0x9969=function(_0x20540d,_0x400554){_0x20540d=_0x20540d-0x0;var _0x709a2b=_0x9699[_0x20540d];return _0x709a2b;};'use strict';var client=require(_0x9969('0x0'));exports['getSettings']=function(){return client['Request'](_0x9969('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9969('0x2')]},'log':_0x9969('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a100c81..8adce9b 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 30875cf..4a215a1 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 _0x6652=['../../config/triggers','default','../../config/express','../../routes','listening','log','lodash','express','sticky-session','ioredis','../../config/environment','createServer','port','socket.io','websocket','redis','adapter','socket.io-redis'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x6652,0x96));var _0x2665=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6652[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x2665('0x0'));var http=require('http');var express=require(_0x2665('0x1'));var sticky=require(_0x2665('0x2'));var Redis=require(_0x2665('0x3'));var config=require(_0x2665('0x4'));var app=express();var server=http[_0x2665('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x2665('0x6')])){var socketio=require(_0x2665('0x7'))(server,{'transports':[_0x2665('0x8'),'polling']});config[_0x2665('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x2665('0xa')](require(_0x2665('0xb'))({'pubClient':new Redis(config[_0x2665('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x2665('0xc'))[_0x2665('0xd')]();require('../../config/socketio')[_0x2665('0xd')](socketio);require(_0x2665('0xe'))[_0x2665('0xd')](app);require(_0x2665('0xf'))[_0x2665('0xd')](app);}else{server['once'](_0x2665('0x10'),function(){console[_0x2665('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2665('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xb2a9=['port','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','once','listening','log','exports','express','sticky-session','ioredis','../../config/environment','createServer'];(function(_0x2f3c84,_0xa6980){var _0x9c0e11=function(_0x55943e){while(--_0x55943e){_0x2f3c84['push'](_0x2f3c84['shift']());}};_0x9c0e11(++_0xa6980);}(_0xb2a9,0x19d));var _0x9b2a=function(_0x28fc8f,_0x232d17){_0x28fc8f=_0x28fc8f-0x0;var _0x5981bb=_0xb2a9[_0x28fc8f];return _0x5981bb;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x9b2a('0x0'));var sticky=require(_0x9b2a('0x1'));var Redis=require(_0x9b2a('0x2'));var config=require(_0x9b2a('0x3'));var app=express();var server=http[_0x9b2a('0x4')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x9b2a('0x5')])){var socketio=require(_0x9b2a('0x6'))(server,{'transports':['websocket',_0x9b2a('0x7')]});config['redis']=_['defaults'](config[_0x9b2a('0x8')],{'host':_0x9b2a('0x9'),'port':0x18eb});socketio[_0x9b2a('0xa')](require(_0x9b2a('0xb'))({'pubClient':new Redis(config[_0x9b2a('0x8')]),'subClient':new Redis(config[_0x9b2a('0x8')])}));require(_0x9b2a('0xc'))[_0x9b2a('0xd')]();require('../../config/socketio')['default'](socketio);require(_0x9b2a('0xe'))['default'](app);require('../../routes')[_0x9b2a('0xd')](app);}else{server[_0x9b2a('0xf')](_0x9b2a('0x10'),function(){console[_0x9b2a('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x9b2a('0x12')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 029c4e0..3588c59 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 _0xbc55=['http','Request','request','debug','rpc','error','message','result','catch','exports','bluebird','routing','client'];(function(_0x27bb49,_0x5a9b4b){var _0x2835c2=function(_0x5582b9){while(--_0x5582b9){_0x27bb49['push'](_0x27bb49['shift']());}};_0x2835c2(++_0x5a9b4b);}(_0xbc55,0x1aa));var _0x5bc5=function(_0x33dc51,_0x1d6b24){_0x33dc51=_0x33dc51-0x0;var _0x5bbd34=_0xbc55[_0x33dc51];return _0x5bbd34;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5bc5('0x0'));var logger=require('../../config/logger')(_0x5bc5('0x1'));var client=jayson[_0x5bc5('0x2')][_0x5bc5('0x3')]({'port':0x2329});client[_0x5bc5('0x4')]=function(_0x5658a2,_0x35c8b0){return new BPromise(function(_0x138979,_0x1ac080){return client[_0x5bc5('0x5')](_0x5658a2,_0x35c8b0)['then'](function(_0x2859ff){logger[_0x5bc5('0x6')](_0x5bc5('0x7'),_0x5bc5('0x1'),_0x5658a2,_0x35c8b0,_0x2859ff);if(_0x2859ff[_0x5bc5('0x8')]){logger[_0x5bc5('0x8')](_0x5bc5('0x7'),_0x5bc5('0x1'),_0x5658a2,_0x2859ff[_0x5bc5('0x8')][_0x5bc5('0x9')],_0x35c8b0);return _0x1ac080(_0x2859ff['error'][_0x5bc5('0x9')]);}else{return _0x138979(_0x2859ff[_0x5bc5('0xa')]);}})[_0x5bc5('0xb')](function(_0x4bb01b){logger[_0x5bc5('0x8')](_0x5bc5('0x7'),_0x5bc5('0x1'),_0x5658a2,_0x4bb01b,_0x35c8b0);return _0x1ac080(_0x4bb01b);});});};module[_0x5bc5('0xc')]=client; \ No newline at end of file +var _0xf8fe=['http','Request','rpc','error','message','catch','exports','bluebird','routing','client'];(function(_0x1be972,_0x42675c){var _0x401d51=function(_0x1d6647){while(--_0x1d6647){_0x1be972['push'](_0x1be972['shift']());}};_0x401d51(++_0x42675c);}(_0xf8fe,0xcf));var _0xef8f=function(_0x2918e3,_0x17ea6b){_0x2918e3=_0x2918e3-0x0;var _0x1b54f1=_0xf8fe[_0x2918e3];return _0x1b54f1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xef8f('0x0'));var logger=require('../../config/logger')(_0xef8f('0x1'));var client=jayson[_0xef8f('0x2')][_0xef8f('0x3')]({'port':0x2329});client[_0xef8f('0x4')]=function(_0x25aa9a,_0xcfbc7a){return new BPromise(function(_0x25a9f3,_0x4dd86f){return client['request'](_0x25aa9a,_0xcfbc7a)['then'](function(_0x10e383){logger['debug']('rpc',_0xef8f('0x1'),_0x25aa9a,_0xcfbc7a,_0x10e383);if(_0x10e383['error']){logger['error'](_0xef8f('0x5'),_0xef8f('0x1'),_0x25aa9a,_0x10e383[_0xef8f('0x6')]['message'],_0xcfbc7a);return _0x4dd86f(_0x10e383[_0xef8f('0x6')][_0xef8f('0x7')]);}else{return _0x25a9f3(_0x10e383['result']);}})[_0xef8f('0x8')](function(_0x42c0c7){logger[_0xef8f('0x6')]('rpc','routing',_0x25aa9a,_0x42c0c7,_0xcfbc7a);return _0x4dd86f(_0x42c0c7);});});};module[_0xef8f('0x9')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c25a5d0..ab48b8e 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 _0x9d38=['./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user'];(function(_0x5908f3,_0x31e0ea){var _0x45549c=function(_0x2c54ff){while(--_0x2c54ff){_0x5908f3['push'](_0x5908f3['shift']());}};_0x45549c(++_0x31e0ea);}(_0x9d38,0x1e0));var _0x89d3=function(_0x599a07,_0x13205b){_0x599a07=_0x599a07-0x0;var _0x21dfa9=_0x9d38[_0x599a07];return _0x21dfa9;};'use strict';var BPromise=require(_0x89d3('0x0'));var server=require(_0x89d3('0x1'));var Realtime=require(_0x89d3('0x2'));var user=require(_0x89d3('0x3'));var interval=require(_0x89d3('0x4'));var openchannelQueue=require(_0x89d3('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x89d3('0x6'));var mailQueue=require(_0x89d3('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())['then'](realtime[_0x89d3('0x8')]())[_0x89d3('0x9')](interval['getIntervals']())['then'](realtime[_0x89d3('0xa')]())['then'](openchannelQueue[_0x89d3('0xb')]())[_0x89d3('0x9')](realtime[_0x89d3('0xc')]())['then'](chatQueue[_0x89d3('0xd')]())[_0x89d3('0x9')](realtime[_0x89d3('0xe')]())['then'](smsQueue[_0x89d3('0xf')]())[_0x89d3('0x9')](realtime['initSmsQueues']())[_0x89d3('0x9')](mailQueue['getMailQueues']())[_0x89d3('0x9')](realtime[_0x89d3('0x10')]())[_0x89d3('0x9')](faxQueue['getFaxQueues']())[_0x89d3('0x9')](realtime['initFaxQueues']())[_0x89d3('0x9')](whatsappQueue[_0x89d3('0x11')]())[_0x89d3('0x9')](realtime[_0x89d3('0x12')]())[_0x89d3('0x9')](function(){return realtime;});}function main(){return server[_0x89d3('0x13')](realtime)['then'](function(_0x52641d){return initRealtime();})[_0x89d3('0x9')](function(_0x5a7d84){return setInterval(initRealtime,0x1388);})[_0x89d3('0x14')](function(_0x14ccb3){console[_0x89d3('0x15')](_0x14ccb3);});}main(); \ No newline at end of file +var _0x78fd=['initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x1e53fb,_0x58148f){var _0x1645ed=function(_0x3ddb69){while(--_0x3ddb69){_0x1e53fb['push'](_0x1e53fb['shift']());}};_0x1645ed(++_0x58148f);}(_0x78fd,0x145));var _0xd78f=function(_0x4e688a,_0x1266f2){_0x4e688a=_0x4e688a-0x0;var _0x5d8f91=_0x78fd[_0x4e688a];return _0x5d8f91;};'use strict';var BPromise=require(_0xd78f('0x0'));var server=require(_0xd78f('0x1'));var Realtime=require(_0xd78f('0x2'));var user=require('./rpc/user');var interval=require(_0xd78f('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xd78f('0x4'));var mailQueue=require(_0xd78f('0x5'));var faxQueue=require(_0xd78f('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xd78f('0x7')]()['then'](user['getAgents']())['then'](realtime['initAgents']())[_0xd78f('0x8')](interval[_0xd78f('0x9')]())[_0xd78f('0x8')](realtime[_0xd78f('0xa')]())[_0xd78f('0x8')](openchannelQueue[_0xd78f('0xb')]())[_0xd78f('0x8')](realtime[_0xd78f('0xc')]())['then'](chatQueue[_0xd78f('0xd')]())[_0xd78f('0x8')](realtime[_0xd78f('0xe')]())[_0xd78f('0x8')](smsQueue[_0xd78f('0xf')]())[_0xd78f('0x8')](realtime['initSmsQueues']())[_0xd78f('0x8')](mailQueue[_0xd78f('0x10')]())[_0xd78f('0x8')](realtime['initMailQueues']())[_0xd78f('0x8')](faxQueue[_0xd78f('0x11')]())['then'](realtime[_0xd78f('0x12')]())[_0xd78f('0x8')](whatsappQueue[_0xd78f('0x13')]())[_0xd78f('0x8')](realtime[_0xd78f('0x14')]())[_0xd78f('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd78f('0x8')](function(_0x41f11b){return initRealtime();})[_0xd78f('0x8')](function(_0x53d377){return setInterval(initRealtime,0x1388);})[_0xd78f('0x15')](function(_0x404cae){console[_0xd78f('0x16')](_0x404cae);});}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 8a314f8..3f8e164 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x37496d,_0xf738a6){var _0x3fc0e9=function(_0x57c4ff){while(--_0x57c4ff){_0x37496d['push'](_0x37496d['shift']());}};_0x3fc0e9(++_0xf738a6);}(_0x7a54,0x106));var _0x47a5=function(_0x543167,_0x9ab12f){_0x543167=_0x543167-0x0;var _0x51873d=_0x7a54[_0x543167];return _0x51873d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2362ba,_0xa8aec){var _0x2f2113=function(_0x262b5e){while(--_0x262b5e){_0x2362ba['push'](_0x2362ba['shift']());}};_0x2f2113(++_0xa8aec);}(_0x7a54,0x106));var _0x47a5=function(_0x543309,_0x25b99d){_0x543309=_0x543309-0x0;var _0x39707c=_0x7a54[_0x543309];return _0x39707c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 6262aec..46815e7 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 _0x024e=['then','error','message','result','catch','SendMail','client','http','request'];(function(_0x4c6446,_0x32b4bc){var _0x145c7f=function(_0x4c3b91){while(--_0x4c3b91){_0x4c6446['push'](_0x4c6446['shift']());}};_0x145c7f(++_0x32b4bc);}(_0x024e,0x7b));var _0xe024=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x024e[_0x25df80];return _0x17b6d0;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xe024('0x0')][_0xe024('0x1')]({'port':0x232b});function request(_0x19512f,_0x49fe62){return new BPromise(function(_0xc7c111,_0xab7418){return client[_0xe024('0x2')](_0x19512f,_0x49fe62)[_0xe024('0x3')](function(_0x40d4f4){if(_0x40d4f4[_0xe024('0x4')]){return _0xab7418(_0x40d4f4['error'][_0xe024('0x5')]);}else{return _0xc7c111(_0x40d4f4[_0xe024('0x6')]);}})[_0xe024('0x7')](function(_0x5cd1a1){return _0xab7418(_0x5cd1a1);});});}exports['sendMailMessage']=function(_0x4079e3,_0x437c9e){return request(_0xe024('0x8'),{'account':_0x4079e3,'message':_0x437c9e});}; \ No newline at end of file +var _0xe8fc=['error','message','result','SendMail','bluebird','http','request','then'];(function(_0x2909e0,_0x9a3311){var _0x348b70=function(_0x4c1347){while(--_0x4c1347){_0x2909e0['push'](_0x2909e0['shift']());}};_0x348b70(++_0x9a3311);}(_0xe8fc,0xe4));var _0xce8f=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0xe8fc[_0x31282b];return _0x19c632;};'use strict';var BPromise=require(_0xce8f('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce8f('0x1')]({'port':0x232b});function request(_0x75594b,_0x1231dd){return new BPromise(function(_0x281eb9,_0x32a3ae){return client[_0xce8f('0x2')](_0x75594b,_0x1231dd)[_0xce8f('0x3')](function(_0x162022){if(_0x162022[_0xce8f('0x4')]){return _0x32a3ae(_0x162022['error'][_0xce8f('0x5')]);}else{return _0x281eb9(_0x162022[_0xce8f('0x6')]);}})['catch'](function(_0x585758){return _0x32a3ae(_0x585758);});});}exports['sendMailMessage']=function(_0x56c378,_0xd9f71d){return request(_0xce8f('0x7'),{'account':_0x56c378,'message':_0xd9f71d});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index d909798..35c0b97 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 _0xba6e=['md5','updateRealtime','Capacity','CurrentCapacity','idle','prototype','mail','chat','openchannel','fax','sms','whatsapp','getChannelStatus','Status','StatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','faxStatus','smsStatus','smsCurrentCapacity','emit','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue'];(function(_0x1b10fa,_0x52484e){var _0x2bd5db=function(_0x4250ee){while(--_0x4250ee){_0x1b10fa['push'](_0x1b10fa['shift']());}};_0x2bd5db(++_0x52484e);}(_0xba6e,0x107));var _0xeba6=function(_0x4a07aa,_0x37d370){_0x4a07aa=_0x4a07aa-0x0;var _0x3db500=_0xba6e[_0x4a07aa];return _0x3db500;};'use strict';var _=require(_0xeba6('0x0'));var moment=require(_0xeba6('0x1'));var md5=require('md5');var Redis=require(_0xeba6('0x2'));var config=require(_0xeba6('0x3'));config[_0xeba6('0x4')]=_[_0xeba6('0x5')](config['redis'],{'host':_0xeba6('0x6'),'port':0x18eb});var io=require(_0xeba6('0x7'))(new Redis(config['redis']));function Agent(_0x291078){this['id']=_0x291078['id']||0x0;this[_0xeba6('0x8')]=_0x291078[_0xeba6('0x8')]||'';this[_0xeba6('0x9')]=_0x291078[_0xeba6('0x9')]||!![];this[_0xeba6('0xa')]=_0x291078[_0xeba6('0xa')]||![];this['chatPause']=_0x291078[_0xeba6('0xb')]||![];this[_0xeba6('0xc')]=_0x291078['mailPause']||![];this[_0xeba6('0xd')]=_0x291078[_0xeba6('0xd')]||![];this[_0xeba6('0xe')]=_0x291078[_0xeba6('0xe')]||![];this[_0xeba6('0xf')]=_0x291078[_0xeba6('0xf')]||![];this[_0xeba6('0x10')]=_0xeba6('0x11');this[_0xeba6('0x12')]=0x0;this[_0xeba6('0x13')]=_0x291078[_0xeba6('0x13')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0xeba6('0x11');this['mailStatusTime']=0x0;this[_0xeba6('0x14')]=_0x291078[_0xeba6('0x14')]||0x0;this[_0xeba6('0x15')]=0x0;this['faxStatus']=_0xeba6('0x11');this[_0xeba6('0x16')]=0x0;this[_0xeba6('0x17')]=_0x291078[_0xeba6('0x17')]||0x0;this[_0xeba6('0x18')]=0x0;this['smsStatus']=_0xeba6('0x11');this[_0xeba6('0x19')]=0x0;this[_0xeba6('0x1a')]=_0x291078[_0xeba6('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xeba6('0x1b')]=_0xeba6('0x11');this[_0xeba6('0x1c')]=0x0;this[_0xeba6('0x1d')]=_0x291078[_0xeba6('0x1d')]||0x0;this[_0xeba6('0x1e')]=0x0;this[_0xeba6('0x1f')]=_0xeba6('0x11');this[_0xeba6('0x20')]=0x0;this['openchannelCapacity']=_0x291078[_0xeba6('0x21')]||0x0;this[_0xeba6('0x22')]=0x0;this[_0xeba6('0x23')]=![];this[_0xeba6('0x24')]=undefined;this[_0xeba6('0x25')]='';this[_0xeba6('0x26')]();}Agent['prototype']['getChannelStatus']=function(_0x16c2b1){if(this[_0x16c2b1+'CurrentCapacity']>0x0){if(this[_0x16c2b1+_0xeba6('0x27')]>0x0&&this[_0x16c2b1+_0xeba6('0x28')]>=this[_0x16c2b1+_0xeba6('0x27')]){return'maxcapacity';}else{return'working';}}else{return _0xeba6('0x29');}};Agent[_0xeba6('0x2a')][_0xeba6('0x26')]=function(){var _0x1613e6=[_0xeba6('0x2b'),_0xeba6('0x2c'),_0xeba6('0x2d'),_0xeba6('0x2e'),_0xeba6('0x2f'),_0xeba6('0x30')];for(var _0xfaa382=0x0;_0xfaa382<_0x1613e6['length'];_0xfaa382+=0x1){var _0x1f07ff=this[_0xeba6('0x31')](_0x1613e6[_0xfaa382]);if(this[_0x1613e6[_0xfaa382]+_0xeba6('0x32')]!==_0x1f07ff){this[_0x1613e6[_0xfaa382]+_0xeba6('0x33')]=_['toNumber'](moment()['format']('x'));}this[_0x1613e6[_0xfaa382]+_0xeba6('0x32')]=_0x1f07ff;}var _0x45ec51={'id':this['id'],'name':this[_0xeba6('0x8')],'online':this[_0xeba6('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0xeba6('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xeba6('0xe')],'faxPause':this[_0xeba6('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xeba6('0x10')],'chatStatusTime':this[_0xeba6('0x12')],'chatCapacity':this[_0xeba6('0x13')],'chatCurrentCapacity':this[_0xeba6('0x34')],'mailStatus':this[_0xeba6('0x35')],'mailStatusTime':this[_0xeba6('0x36')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xeba6('0x37')],'faxStatusTime':this[_0xeba6('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xeba6('0x18')],'smsStatus':this[_0xeba6('0x38')],'smsStatusTime':this[_0xeba6('0x19')],'smsCapacity':this[_0xeba6('0x1a')],'smsCurrentCapacity':this[_0xeba6('0x39')],'whatsappStatus':this[_0xeba6('0x1b')],'whatsappStatusTime':this[_0xeba6('0x1c')],'whatsappCapacity':this[_0xeba6('0x1d')],'whatsappCurrentCapacity':this[_0xeba6('0x1e')],'openchannelStatus':this[_0xeba6('0x1f')],'openchannelStatusTime':this[_0xeba6('0x20')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xeba6('0x22')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x29667f=md5(JSON['stringify'](_0x45ec51));if(this[_0xeba6('0x25')]!==_0x29667f){this['md5']=_0x29667f;io[_0xeba6('0x3a')]('user:save',_0x45ec51);}};module[_0xeba6('0x3b')]=Agent; \ No newline at end of file +var _0x95a9=['busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','Status','mailStatus','stringify','user:save','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy'];(function(_0x12a819,_0x495b8a){var _0x1f86c1=function(_0x4a8f93){while(--_0x4a8f93){_0x12a819['push'](_0x12a819['shift']());}};_0x1f86c1(++_0x495b8a);}(_0x95a9,0x10b));var _0x995a=function(_0xbdc046,_0x417dea){_0xbdc046=_0xbdc046-0x0;var _0x1f4aee=_0x95a9[_0xbdc046];return _0x1f4aee;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x995a('0x0'));var Redis=require(_0x995a('0x1'));var config=require(_0x995a('0x2'));config['redis']=_['defaults'](config[_0x995a('0x3')],{'host':_0x995a('0x4'),'port':0x18eb});var io=require(_0x995a('0x5'))(new Redis(config[_0x995a('0x3')]));function Agent(_0x4ec437){this['id']=_0x4ec437['id']||0x0;this['name']=_0x4ec437[_0x995a('0x6')]||'';this['online']=_0x4ec437[_0x995a('0x7')]||!![];this[_0x995a('0x8')]=_0x4ec437['voicePause']||![];this[_0x995a('0x9')]=_0x4ec437[_0x995a('0x9')]||![];this[_0x995a('0xa')]=_0x4ec437['mailPause']||![];this[_0x995a('0xb')]=_0x4ec437[_0x995a('0xb')]||![];this[_0x995a('0xc')]=_0x4ec437[_0x995a('0xc')]||![];this[_0x995a('0xd')]=_0x4ec437[_0x995a('0xd')]||![];this[_0x995a('0xe')]=_0x995a('0xf');this[_0x995a('0x10')]=0x0;this[_0x995a('0x11')]=_0x4ec437[_0x995a('0x11')]||0x0;this[_0x995a('0x12')]=0x0;this['mailStatus']=_0x995a('0xf');this[_0x995a('0x13')]=0x0;this[_0x995a('0x14')]=_0x4ec437['mailCapacity']||0x0;this[_0x995a('0x15')]=0x0;this[_0x995a('0x16')]=_0x995a('0xf');this[_0x995a('0x17')]=0x0;this[_0x995a('0x18')]=_0x4ec437[_0x995a('0x18')]||0x0;this[_0x995a('0x19')]=0x0;this[_0x995a('0x1a')]='unknown';this[_0x995a('0x1b')]=0x0;this[_0x995a('0x1c')]=_0x4ec437[_0x995a('0x1c')]||0x0;this[_0x995a('0x1d')]=0x0;this['whatsappStatus']=_0x995a('0xf');this[_0x995a('0x1e')]=0x0;this[_0x995a('0x1f')]=_0x4ec437[_0x995a('0x1f')]||0x0;this[_0x995a('0x20')]=0x0;this[_0x995a('0x21')]=_0x995a('0xf');this[_0x995a('0x22')]=0x0;this['openchannelCapacity']=_0x4ec437[_0x995a('0x23')]||0x0;this[_0x995a('0x24')]=0x0;this[_0x995a('0x25')]=![];this[_0x995a('0x26')]=undefined;this[_0x995a('0x0')]='';this[_0x995a('0x27')]();}Agent[_0x995a('0x28')][_0x995a('0x29')]=function(_0x4e3034){if(this[_0x4e3034+_0x995a('0x2a')]>0x0){if(this[_0x4e3034+_0x995a('0x2b')]>0x0&&this[_0x4e3034+_0x995a('0x2a')]>=this[_0x4e3034+_0x995a('0x2b')]){return _0x995a('0x2c');}else{return _0x995a('0x2d');}}else{return _0x995a('0x2e');}};Agent[_0x995a('0x28')][_0x995a('0x27')]=function(){var _0x5db6dc=[_0x995a('0x2f'),_0x995a('0x30'),_0x995a('0x31'),_0x995a('0x32'),_0x995a('0x33'),_0x995a('0x34')];for(var _0xb6c3ff=0x0;_0xb6c3ff<_0x5db6dc[_0x995a('0x35')];_0xb6c3ff+=0x1){var _0x50aba7=this['getChannelStatus'](_0x5db6dc[_0xb6c3ff]);if(this[_0x5db6dc[_0xb6c3ff]+'Status']!==_0x50aba7){this[_0x5db6dc[_0xb6c3ff]+_0x995a('0x36')]=_[_0x995a('0x37')](moment()[_0x995a('0x38')]('x'));}this[_0x5db6dc[_0xb6c3ff]+_0x995a('0x39')]=_0x50aba7;}var _0x3c73b5={'id':this['id'],'name':this[_0x995a('0x6')],'online':this[_0x995a('0x7')],'voicePause':this[_0x995a('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x995a('0xa')],'smsPause':this[_0x995a('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x995a('0xe')],'chatStatusTime':this[_0x995a('0x10')],'chatCapacity':this[_0x995a('0x11')],'chatCurrentCapacity':this[_0x995a('0x12')],'mailStatus':this[_0x995a('0x3a')],'mailStatusTime':this[_0x995a('0x13')],'mailCapacity':this[_0x995a('0x14')],'mailCurrentCapacity':this[_0x995a('0x15')],'faxStatus':this[_0x995a('0x16')],'faxStatusTime':this[_0x995a('0x17')],'faxCapacity':this[_0x995a('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x995a('0x1a')],'smsStatusTime':this[_0x995a('0x1b')],'smsCapacity':this[_0x995a('0x1c')],'smsCurrentCapacity':this[_0x995a('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x995a('0x1f')],'whatsappCurrentCapacity':this[_0x995a('0x20')],'openchannelStatus':this[_0x995a('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x995a('0x23')],'openchannelCurrentCapacity':this[_0x995a('0x24')],'busy':this[_0x995a('0x25')],'busyQueue':this[_0x995a('0x26')]};var _0x5c633f=md5(JSON[_0x995a('0x3b')](_0x3c73b5));if(this[_0x995a('0x0')]!==_0x5c633f){this[_0x995a('0x0')]=_0x5c633f;io['emit'](_0x995a('0x3c'),_0x3c73b5);}};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 3957b88..0685c2d 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 _0xde70=['socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','Agents','_rr','prototype','loggedIn','online','chatPause','paused','available','stringify','emit','exports','lodash','ioredis','redis','localhost'];(function(_0x319c7a,_0x48c22c){var _0x462579=function(_0x276267){while(--_0x276267){_0x319c7a['push'](_0x319c7a['shift']());}};_0x462579(++_0x48c22c);}(_0xde70,0x1a5));var _0x0de7=function(_0xfff039,_0x18b801){_0xfff039=_0xfff039-0x0;var _0x44365f=_0xde70[_0xfff039];return _0x44365f;};'use strict';var _=require(_0x0de7('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x0de7('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x0de7('0x2')],{'host':_0x0de7('0x3'),'port':0x18eb});var io=require(_0x0de7('0x4'))(new Redis(config[_0x0de7('0x2')]));function ChatQueue(_0x15183d){this['id']=_0x15183d['id']||0x0;this[_0x0de7('0x5')]=_0x15183d[_0x0de7('0x5')]||'';this[_0x0de7('0x6')]=_0x15183d['timeout']||0xa;this[_0x0de7('0x7')]=_0x15183d[_0x0de7('0x7')]||'beepall';this['Agents']=_0x15183d['Agents'];this[_0x0de7('0x8')]={};this[_0x0de7('0x9')]=0x0;this[_0x0de7('0xa')]='';this[_0x0de7('0xb')]();this[_0x0de7('0xc')]();}ChatQueue['prototype'][_0x0de7('0xb')]=function(){var _0x856bf7=this[_0x0de7('0x8')]['_rr'];this[_0x0de7('0x8')]=_[_0x0de7('0xd')](this[_0x0de7('0xe')],'id');this['mapAgentsId'][_0x0de7('0xf')]=_0x856bf7;};ChatQueue[_0x0de7('0x10')]['updateRealtime']=function(){this[_0x0de7('0x11')]=0x0;this['paused']=0x0;for(var _0x30e923=0x0;_0x30e923=0x0?this[_0x0de7('0x15')]:0x0;var _0x258788={'id':this['id'],'available':this[_0x0de7('0x15')],'loggedIn':this[_0x0de7('0x11')],'name':this[_0x0de7('0x5')],'paused':this['paused'],'waiting':this[_0x0de7('0x9')]};var _0xe6dd9a=md5(JSON[_0x0de7('0x16')](_0x258788));if(this['md5']!==_0xe6dd9a){this[_0x0de7('0xa')]=_0xe6dd9a;io['to'](util['format']('chat:queue:%s',_0x258788[_0x0de7('0x5')]))[_0x0de7('0x17')]('chat_queue:save',_0x258788);}};module[_0x0de7('0x18')]=ChatQueue; \ No newline at end of file +var _0x11a1=['online','chatPause','available','format','chat:queue:%s','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x11a1,0x180));var _0x111a=function(_0x2e200d,_0x7ad9aa){_0x2e200d=_0x2e200d-0x0;var _0x42d35f=_0x11a1[_0x2e200d];return _0x42d35f;};'use strict';var _=require('lodash');var md5=require(_0x111a('0x0'));var util=require(_0x111a('0x1'));var Redis=require(_0x111a('0x2'));var config=require(_0x111a('0x3'));config[_0x111a('0x4')]=_[_0x111a('0x5')](config[_0x111a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x111a('0x6'))(new Redis(config[_0x111a('0x4')]));function ChatQueue(_0x3e7d8){this['id']=_0x3e7d8['id']||0x0;this[_0x111a('0x7')]=_0x3e7d8['name']||'';this[_0x111a('0x8')]=_0x3e7d8[_0x111a('0x8')]||0xa;this[_0x111a('0x9')]=_0x3e7d8[_0x111a('0x9')]||_0x111a('0xa');this[_0x111a('0xb')]=_0x3e7d8['Agents'];this['mapAgentsId']={};this[_0x111a('0xc')]=0x0;this[_0x111a('0x0')]='';this['updateRouting']();this[_0x111a('0xd')]();}ChatQueue[_0x111a('0xe')]['updateRouting']=function(){var _0x222d50=this[_0x111a('0xf')]['_rr'];this['mapAgentsId']=_[_0x111a('0x10')](this[_0x111a('0xb')],'id');this[_0x111a('0xf')][_0x111a('0x11')]=_0x222d50;};ChatQueue[_0x111a('0xe')][_0x111a('0xd')]=function(){this[_0x111a('0x12')]=0x0;this[_0x111a('0x13')]=0x0;for(var _0x5b88fe=0x0;_0x5b88fe=0x0?this[_0x111a('0x17')]:0x0;var _0x59b8e8={'id':this['id'],'available':this[_0x111a('0x17')],'loggedIn':this[_0x111a('0x12')],'name':this[_0x111a('0x7')],'paused':this['paused'],'waiting':this[_0x111a('0xc')]};var _0x3cb04d=md5(JSON['stringify'](_0x59b8e8));if(this[_0x111a('0x0')]!==_0x3cb04d){this[_0x111a('0x0')]=_0x3cb04d;io['to'](util[_0x111a('0x18')](_0x111a('0x19'),_0x59b8e8[_0x111a('0x7')]))['emit']('chat_queue:save',_0x59b8e8);}};module[_0x111a('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ae1055b..8a0537d 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 _0xa462=['_rr','updateRealtime','loggedIn','paused','length','online','faxPause','available','name','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa462,0x78));var _0x2a46=function(_0x1b427e,_0x188195){_0x1b427e=_0x1b427e-0x0;var _0x1f5640=_0xa462[_0x1b427e];return _0x1f5640;};'use strict';var _=require(_0x2a46('0x0'));var md5=require(_0x2a46('0x1'));var util=require(_0x2a46('0x2'));var Redis=require(_0x2a46('0x3'));var config=require('../../../config/environment');config[_0x2a46('0x4')]=_[_0x2a46('0x5')](config[_0x2a46('0x4')],{'host':_0x2a46('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a46('0x4')]));function FaxQueue(_0x393e86){this['id']=_0x393e86['id']||0x0;this['name']=_0x393e86['name']||'';this[_0x2a46('0x7')]=_0x393e86[_0x2a46('0x7')]||0xa;this[_0x2a46('0x8')]=_0x393e86['strategy']||_0x2a46('0x9');this[_0x2a46('0xa')]=_0x393e86[_0x2a46('0xa')];this[_0x2a46('0xb')]={};this[_0x2a46('0xc')]=0x0;this[_0x2a46('0x1')]='';this[_0x2a46('0xd')]();this['updateRealtime']();}FaxQueue[_0x2a46('0xe')][_0x2a46('0xd')]=function(){var _0x54bd1b=this['mapAgentsId'][_0x2a46('0xf')];this[_0x2a46('0xb')]=_['map'](this['Agents'],'id');this[_0x2a46('0xb')][_0x2a46('0xf')]=_0x54bd1b;};FaxQueue[_0x2a46('0xe')][_0x2a46('0x10')]=function(){this[_0x2a46('0x11')]=0x0;this[_0x2a46('0x12')]=0x0;for(var _0x56cd14=0x0;_0x56cd14=0x0?this[_0x2a46('0x16')]:0x0;var _0x353111={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2a46('0x11')],'name':this[_0x2a46('0x17')],'paused':this['paused'],'waiting':this[_0x2a46('0xc')]};var _0x3282af=md5(JSON['stringify'](_0x353111));if(this[_0x2a46('0x1')]!==_0x3282af){this[_0x2a46('0x1')]=_0x3282af;io['to'](util['format'](_0x2a46('0x18'),_0x353111['name']))[_0x2a46('0x19')](_0x2a46('0x1a'),_0x353111);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x503e=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x22491d,_0x3bad40){var _0x431173=function(_0x4fba3f){while(--_0x4fba3f){_0x22491d['push'](_0x22491d['shift']());}};_0x431173(++_0x3bad40);}(_0x503e,0x1e5));var _0xe503=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x503e[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xe503('0x0'));var md5=require(_0xe503('0x1'));var util=require(_0xe503('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xe503('0x3')](config[_0xe503('0x4')],{'host':_0xe503('0x5'),'port':0x18eb});var io=require(_0xe503('0x6'))(new Redis(config[_0xe503('0x4')]));function FaxQueue(_0x2e38c0){this['id']=_0x2e38c0['id']||0x0;this['name']=_0x2e38c0[_0xe503('0x7')]||'';this[_0xe503('0x8')]=_0x2e38c0[_0xe503('0x8')]||0xa;this[_0xe503('0x9')]=_0x2e38c0[_0xe503('0x9')]||_0xe503('0xa');this[_0xe503('0xb')]=_0x2e38c0[_0xe503('0xb')];this[_0xe503('0xc')]={};this[_0xe503('0xd')]=0x0;this[_0xe503('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xe503('0xe')]['updateRouting']=function(){var _0x3afecd=this[_0xe503('0xc')]['_rr'];this[_0xe503('0xc')]=_[_0xe503('0xf')](this[_0xe503('0xb')],'id');this[_0xe503('0xc')][_0xe503('0x10')]=_0x3afecd;};FaxQueue[_0xe503('0xe')][_0xe503('0x11')]=function(){this[_0xe503('0x12')]=0x0;this[_0xe503('0x13')]=0x0;for(var _0x15aecb=0x0;_0x15aecb=0x0?this[_0xe503('0x16')]:0x0;var _0x56e203={'id':this['id'],'available':this[_0xe503('0x16')],'loggedIn':this[_0xe503('0x12')],'name':this[_0xe503('0x7')],'paused':this[_0xe503('0x13')],'waiting':this['waiting']};var _0x76a2d5=md5(JSON[_0xe503('0x17')](_0x56e203));if(this[_0xe503('0x1')]!==_0x76a2d5){this[_0xe503('0x1')]=_0x76a2d5;io['to'](util[_0xe503('0x18')](_0xe503('0x19'),_0x56e203['name']))[_0xe503('0x1a')](_0xe503('0x1b'),_0x56e203);}};module[_0xe503('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index ad629f7..b6729ef 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 _0x1478=['Intervals','exports','name'];(function(_0x3be63e,_0x342639){var _0x322272=function(_0x4cffcc){while(--_0x4cffcc){_0x3be63e['push'](_0x3be63e['shift']());}};_0x322272(++_0x342639);}(_0x1478,0x14f));var _0x8147=function(_0x45598f,_0x1649ec){_0x45598f=_0x45598f-0x0;var _0x517e2b=_0x1478[_0x45598f];return _0x517e2b;};'use strict';function Interval(_0x2309d3){this['id']=_0x2309d3['id']||0x0;this[_0x8147('0x0')]=_0x2309d3[_0x8147('0x0')]||'';this['Intervals']=_0x2309d3[_0x8147('0x1')]||{};}module[_0x8147('0x2')]=Interval; \ No newline at end of file +var _0x228a=['Intervals','name'];(function(_0x180649,_0x178829){var _0x53f90b=function(_0x18f201){while(--_0x18f201){_0x180649['push'](_0x180649['shift']());}};_0x53f90b(++_0x178829);}(_0x228a,0x14b));var _0xa228=function(_0x526afe,_0x5937c3){_0x526afe=_0x526afe-0x0;var _0x402df7=_0x228a[_0x526afe];return _0x402df7;};'use strict';function Interval(_0x41fab7){this['id']=_0x41fab7['id']||0x0;this['name']=_0x41fab7[_0xa228('0x0')]||'';this['Intervals']=_0x41fab7[_0xa228('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 84d51b1..3ab5070 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 _0xcfdd=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost'];(function(_0x472935,_0x5805db){var _0x3a68ee=function(_0x4abb83){while(--_0x4abb83){_0x472935['push'](_0x472935['shift']());}};_0x3a68ee(++_0x5805db);}(_0xcfdd,0x13e));var _0xdcfd=function(_0x20210e,_0x1603f6){_0x20210e=_0x20210e-0x0;var _0x439c00=_0xcfdd[_0x20210e];return _0x439c00;};'use strict';var _=require(_0xdcfd('0x0'));var md5=require(_0xdcfd('0x1'));var util=require('util');var Redis=require(_0xdcfd('0x2'));var config=require(_0xdcfd('0x3'));config[_0xdcfd('0x4')]=_['defaults'](config[_0xdcfd('0x4')],{'host':_0xdcfd('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdcfd('0x4')]));function MailQueue(_0x4e1849){this['id']=_0x4e1849['id']||0x0;this['name']=_0x4e1849[_0xdcfd('0x6')]||'';this[_0xdcfd('0x7')]=_0x4e1849[_0xdcfd('0x7')]||0xa;this[_0xdcfd('0x8')]=_0x4e1849[_0xdcfd('0x8')]||_0xdcfd('0x9');this['Agents']=_0x4e1849[_0xdcfd('0xa')];this[_0xdcfd('0xb')]={};this[_0xdcfd('0xc')]=0x0;this[_0xdcfd('0x1')]='';this['updateRouting']();this[_0xdcfd('0xd')]();}MailQueue[_0xdcfd('0xe')]['updateRouting']=function(){var _0x4a5017=this[_0xdcfd('0xb')][_0xdcfd('0xf')];this[_0xdcfd('0xb')]=_[_0xdcfd('0x10')](this[_0xdcfd('0xa')],'id');this[_0xdcfd('0xb')]['_rr']=_0x4a5017;};MailQueue[_0xdcfd('0xe')][_0xdcfd('0xd')]=function(){this[_0xdcfd('0x11')]=0x0;this[_0xdcfd('0x12')]=0x0;for(var _0xc25912=0x0;_0xc25912=0x0?this[_0xdcfd('0x15')]:0x0;var _0x441304={'id':this['id'],'available':this[_0xdcfd('0x15')],'loggedIn':this[_0xdcfd('0x11')],'name':this[_0xdcfd('0x6')],'paused':this[_0xdcfd('0x12')],'waiting':this[_0xdcfd('0xc')]};var _0x113520=md5(JSON[_0xdcfd('0x16')](_0x441304));if(this[_0xdcfd('0x1')]!==_0x113520){this[_0xdcfd('0x1')]=_0x113520;io['to'](util[_0xdcfd('0x17')](_0xdcfd('0x18'),_0x441304['name']))['emit'](_0xdcfd('0x19'),_0x441304);}};module[_0xdcfd('0x1a')]=MailQueue; \ No newline at end of file +var _0x97f6=['waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','online','mailPause','available'];(function(_0x390b72,_0x2cef44){var _0x3574b9=function(_0xa11e0d){while(--_0xa11e0d){_0x390b72['push'](_0x390b72['shift']());}};_0x3574b9(++_0x2cef44);}(_0x97f6,0xa2));var _0x697f=function(_0x1fb6d6,_0xf6860f){_0x1fb6d6=_0x1fb6d6-0x0;var _0xc865e8=_0x97f6[_0x1fb6d6];return _0xc865e8;};'use strict';var _=require(_0x697f('0x0'));var md5=require('md5');var util=require(_0x697f('0x1'));var Redis=require(_0x697f('0x2'));var config=require('../../../config/environment');config[_0x697f('0x3')]=_[_0x697f('0x4')](config[_0x697f('0x3')],{'host':_0x697f('0x5'),'port':0x18eb});var io=require(_0x697f('0x6'))(new Redis(config[_0x697f('0x3')]));function MailQueue(_0x277e18){this['id']=_0x277e18['id']||0x0;this[_0x697f('0x7')]=_0x277e18[_0x697f('0x7')]||'';this[_0x697f('0x8')]=_0x277e18['timeout']||0xa;this[_0x697f('0x9')]=_0x277e18['strategy']||_0x697f('0xa');this['Agents']=_0x277e18[_0x697f('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x697f('0xc')]='';this['updateRouting']();this[_0x697f('0xd')]();}MailQueue[_0x697f('0xe')][_0x697f('0xf')]=function(){var _0x321495=this[_0x697f('0x10')][_0x697f('0x11')];this[_0x697f('0x10')]=_[_0x697f('0x12')](this[_0x697f('0xb')],'id');this[_0x697f('0x10')][_0x697f('0x11')]=_0x321495;};MailQueue[_0x697f('0xe')][_0x697f('0xd')]=function(){this[_0x697f('0x13')]=0x0;this[_0x697f('0x14')]=0x0;for(var _0x4cb4a1=0x0;_0x4cb4a1=0x0?this[_0x697f('0x17')]:0x0;var _0x327eb8={'id':this['id'],'available':this[_0x697f('0x17')],'loggedIn':this[_0x697f('0x13')],'name':this[_0x697f('0x7')],'paused':this[_0x697f('0x14')],'waiting':this[_0x697f('0x18')]};var _0x58bb5e=md5(JSON[_0x697f('0x19')](_0x327eb8));if(this[_0x697f('0xc')]!==_0x58bb5e){this['md5']=_0x58bb5e;io['to'](util[_0x697f('0x1a')](_0x697f('0x1b'),_0x327eb8[_0x697f('0x7')]))[_0x697f('0x1c')](_0x697f('0x1d'),_0x327eb8);}};module[_0x697f('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5a4a401..9232d86 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x2ef3,0xba));var _0x32ef=function(_0x423f10,_0x551a85){_0x423f10=_0x423f10-0x0;var _0x5c93ea=_0x2ef3[_0x423f10];return _0x5c93ea;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 70fb543..63d44e8 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 _0x35aa=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','length','loggedIn','available','paused','stringify','format','sms:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x26d3cb,_0x3a1b75){var _0x3f75bf=function(_0x1e0a72){while(--_0x1e0a72){_0x26d3cb['push'](_0x26d3cb['shift']());}};_0x3f75bf(++_0x3a1b75);}(_0x35aa,0xbe));var _0xa35a=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x35aa[_0x5192de];return _0x4e287e;};'use strict';var _=require('lodash');var md5=require(_0xa35a('0x0'));var util=require(_0xa35a('0x1'));var Redis=require(_0xa35a('0x2'));var config=require(_0xa35a('0x3'));config['redis']=_[_0xa35a('0x4')](config[_0xa35a('0x5')],{'host':_0xa35a('0x6'),'port':0x18eb});var io=require(_0xa35a('0x7'))(new Redis(config[_0xa35a('0x5')]));function SmsQueue(_0x41a154){this['id']=_0x41a154['id']||0x0;this[_0xa35a('0x8')]=_0x41a154[_0xa35a('0x8')]||'';this['timeout']=_0x41a154[_0xa35a('0x9')]||0xa;this['strategy']=_0x41a154[_0xa35a('0xa')]||_0xa35a('0xb');this[_0xa35a('0xc')]=_0x41a154[_0xa35a('0xc')];this[_0xa35a('0xd')]={};this[_0xa35a('0xe')]=0x0;this['md5']='';this[_0xa35a('0xf')]();this[_0xa35a('0x10')]();}SmsQueue[_0xa35a('0x11')][_0xa35a('0xf')]=function(){var _0x5314fa=this[_0xa35a('0xd')][_0xa35a('0x12')];this['mapAgentsId']=_[_0xa35a('0x13')](this[_0xa35a('0xc')],'id');this[_0xa35a('0xd')][_0xa35a('0x12')]=_0x5314fa;};SmsQueue[_0xa35a('0x11')][_0xa35a('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2dfa94=0x0;_0x2dfa94=0x0?this[_0xa35a('0x16')]:0x0;var _0x474cbd={'id':this['id'],'available':this[_0xa35a('0x16')],'loggedIn':this[_0xa35a('0x15')],'name':this[_0xa35a('0x8')],'paused':this[_0xa35a('0x17')],'waiting':this[_0xa35a('0xe')]};var _0x3af888=md5(JSON[_0xa35a('0x18')](_0x474cbd));if(this[_0xa35a('0x0')]!==_0x3af888){this[_0xa35a('0x0')]=_0x3af888;io['to'](util[_0xa35a('0x19')](_0xa35a('0x1a'),_0x474cbd[_0xa35a('0x8')]))[_0xa35a('0x1b')]('sms_queue:save',_0x474cbd);}};module[_0xa35a('0x1c')]=SmsQueue; \ No newline at end of file +var _0x85b5=['paused','length','available','stringify','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x85b5,0x7f));var _0x585b=function(_0x3ce40c,_0x28e2be){_0x3ce40c=_0x3ce40c-0x0;var _0x4526ac=_0x85b5[_0x3ce40c];return _0x4526ac;};'use strict';var _=require(_0x585b('0x0'));var md5=require(_0x585b('0x1'));var util=require('util');var Redis=require(_0x585b('0x2'));var config=require('../../../config/environment');config[_0x585b('0x3')]=_['defaults'](config['redis'],{'host':_0x585b('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x585b('0x3')]));function SmsQueue(_0x26ccfb){this['id']=_0x26ccfb['id']||0x0;this[_0x585b('0x5')]=_0x26ccfb['name']||'';this[_0x585b('0x6')]=_0x26ccfb['timeout']||0xa;this[_0x585b('0x7')]=_0x26ccfb[_0x585b('0x7')]||_0x585b('0x8');this[_0x585b('0x9')]=_0x26ccfb['Agents'];this[_0x585b('0xa')]={};this[_0x585b('0xb')]=0x0;this[_0x585b('0x1')]='';this[_0x585b('0xc')]();this[_0x585b('0xd')]();}SmsQueue[_0x585b('0xe')][_0x585b('0xc')]=function(){var _0x5dda1f=this[_0x585b('0xa')]['_rr'];this[_0x585b('0xa')]=_['map'](this[_0x585b('0x9')],'id');this[_0x585b('0xa')][_0x585b('0xf')]=_0x5dda1f;};SmsQueue['prototype'][_0x585b('0xd')]=function(){this[_0x585b('0x10')]=0x0;this[_0x585b('0x11')]=0x0;for(var _0x299ee4=0x0;_0x299ee4=0x0?this[_0x585b('0x13')]:0x0;var _0x510921={'id':this['id'],'available':this[_0x585b('0x13')],'loggedIn':this[_0x585b('0x10')],'name':this[_0x585b('0x5')],'paused':this[_0x585b('0x11')],'waiting':this['waiting']};var _0xec725d=md5(JSON[_0x585b('0x14')](_0x510921));if(this[_0x585b('0x1')]!==_0xec725d){this['md5']=_0xec725d;io['to'](util['format'](_0x585b('0x15'),_0x510921['name']))['emit'](_0x585b('0x16'),_0x510921);}};module[_0x585b('0x17')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ea4496f..4db34ae 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 _0x1062=['loggedIn','length','whatsappPause','paused','available','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x1062,0x1d9));var _0x2106=function(_0x5665be,_0x46b479){_0x5665be=_0x5665be-0x0;var _0x5e7b08=_0x1062[_0x5665be];return _0x5e7b08;};'use strict';var _=require(_0x2106('0x0'));var md5=require(_0x2106('0x1'));var util=require(_0x2106('0x2'));var Redis=require(_0x2106('0x3'));var config=require(_0x2106('0x4'));config[_0x2106('0x5')]=_[_0x2106('0x6')](config['redis'],{'host':_0x2106('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2106('0x5')]));function WhatsappQueue(_0x483d7b){this['id']=_0x483d7b['id']||0x0;this[_0x2106('0x8')]=_0x483d7b[_0x2106('0x8')]||'';this[_0x2106('0x9')]=_0x483d7b['timeout']||0xa;this['strategy']=_0x483d7b[_0x2106('0xa')]||_0x2106('0xb');this[_0x2106('0xc')]=_0x483d7b[_0x2106('0xc')];this['mapAgentsId']={};this[_0x2106('0xd')]=0x0;this[_0x2106('0x1')]='';this[_0x2106('0xe')]();this[_0x2106('0xf')]();}WhatsappQueue[_0x2106('0x10')][_0x2106('0xe')]=function(){var _0x15ecc8=this[_0x2106('0x11')][_0x2106('0x12')];this[_0x2106('0x11')]=_[_0x2106('0x13')](this['Agents'],'id');this[_0x2106('0x11')][_0x2106('0x12')]=_0x15ecc8;};WhatsappQueue[_0x2106('0x10')][_0x2106('0xf')]=function(){this[_0x2106('0x14')]=0x0;this['paused']=0x0;for(var _0xa3ff99=0x0;_0xa3ff99=0x0?this[_0x2106('0x18')]:0x0;var _0x332dac={'id':this['id'],'available':this[_0x2106('0x18')],'loggedIn':this[_0x2106('0x14')],'name':this[_0x2106('0x8')],'paused':this['paused'],'waiting':this[_0x2106('0xd')]};var _0x31f757=md5(JSON['stringify'](_0x332dac));if(this[_0x2106('0x1')]!==_0x31f757){this[_0x2106('0x1')]=_0x31f757;io['to'](util[_0x2106('0x19')](_0x2106('0x1a'),_0x332dac[_0x2106('0x8')]))['emit'](_0x2106('0x1b'),_0x332dac);}};module[_0x2106('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xcab6=['updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','waiting','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x277563,_0x566184){var _0xc114d5=function(_0x58ae70){while(--_0x58ae70){_0x277563['push'](_0x277563['shift']());}};_0xc114d5(++_0x566184);}(_0xcab6,0xe7));var _0x6cab=function(_0x2ac1b6,_0x19a542){_0x2ac1b6=_0x2ac1b6-0x0;var _0x278b3a=_0xcab6[_0x2ac1b6];return _0x278b3a;};'use strict';var _=require(_0x6cab('0x0'));var md5=require(_0x6cab('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6cab('0x2')]=_[_0x6cab('0x3')](config[_0x6cab('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x6cab('0x4'))(new Redis(config[_0x6cab('0x2')]));function WhatsappQueue(_0x2ed049){this['id']=_0x2ed049['id']||0x0;this[_0x6cab('0x5')]=_0x2ed049[_0x6cab('0x5')]||'';this[_0x6cab('0x6')]=_0x2ed049[_0x6cab('0x6')]||0xa;this[_0x6cab('0x7')]=_0x2ed049[_0x6cab('0x7')]||_0x6cab('0x8');this[_0x6cab('0x9')]=_0x2ed049['Agents'];this[_0x6cab('0xa')]={};this['waiting']=0x0;this[_0x6cab('0x1')]='';this[_0x6cab('0xb')]();this[_0x6cab('0xc')]();}WhatsappQueue[_0x6cab('0xd')]['updateRouting']=function(){var _0x4d66ad=this[_0x6cab('0xa')][_0x6cab('0xe')];this[_0x6cab('0xa')]=_[_0x6cab('0xf')](this[_0x6cab('0x9')],'id');this[_0x6cab('0xa')]['_rr']=_0x4d66ad;};WhatsappQueue[_0x6cab('0xd')][_0x6cab('0xc')]=function(){this['loggedIn']=0x0;this[_0x6cab('0x10')]=0x0;for(var _0xe4642=0x0;_0xe4642=0x0?this['available']:0x0;var _0x35cc44={'id':this['id'],'available':this[_0x6cab('0x14')],'loggedIn':this[_0x6cab('0x13')],'name':this['name'],'paused':this[_0x6cab('0x10')],'waiting':this[_0x6cab('0x15')]};var _0x1cc1f6=md5(JSON[_0x6cab('0x16')](_0x35cc44));if(this['md5']!==_0x1cc1f6){this[_0x6cab('0x1')]=_0x1cc1f6;io['to'](util[_0x6cab('0x17')]('whatsapp:queue:%s',_0x35cc44['name']))[_0x6cab('0x18')](_0x6cab('0x19'),_0x35cc44);}};module[_0x6cab('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0609043..28d7719 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(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x160c6e,_0x5ccb8e){var _0x5a8805=function(_0x4efefa){while(--_0x4efefa){_0x160c6e['push'](_0x160c6e['shift']());}};_0x5a8805(++_0x5ccb8e);}(_0xb10b,0x12a));var _0xbb10=function(_0x265c81,_0x4d539a){_0x265c81=_0x265c81-0x0;var _0x3e63d1=_0xb10b[_0x265c81];return _0x3e63d1;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index fd17a7a..7be8660 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 _0x0d86=['updateChatInteraction','addTags','AddTagsToChatInteraction','../client','Request'];(function(_0x3a7985,_0x381074){var _0x39c825=function(_0x297af5){while(--_0x297af5){_0x3a7985['push'](_0x3a7985['shift']());}};_0x39c825(++_0x381074);}(_0x0d86,0x1bb));var _0x60d8=function(_0x3a3816,_0x10edf2){_0x3a3816=_0x3a3816-0x0;var _0xc4c885=_0x0d86[_0x3a3816];return _0xc4c885;};'use strict';var client=require(_0x60d8('0x0'));exports['update']=function(_0x214432,_0x5336be){return client[_0x60d8('0x1')]('UpdateChatInteraction',{'body':_0x5336be,'options':{'where':{'id':_0x214432}},'log':_0x60d8('0x2')});};exports[_0x60d8('0x3')]=function(_0x6ea449,_0x14a8bf){return client['Request'](_0x60d8('0x4'),{'body':_0x14a8bf,'options':{'where':{'id':_0x6ea449}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x91c7=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x36f797,_0x351603){var _0x44ba30=function(_0x32eb10){while(--_0x32eb10){_0x36f797['push'](_0x36f797['shift']());}};_0x44ba30(++_0x351603);}(_0x91c7,0x96));var _0x791c=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x91c7[_0x3e6d5d];return _0x238923;};'use strict';var client=require(_0x791c('0x0'));exports[_0x791c('0x1')]=function(_0x22b2d7,_0x544d87){return client[_0x791c('0x2')](_0x791c('0x3'),{'body':_0x544d87,'options':{'where':{'id':_0x22b2d7}},'log':_0x791c('0x4')});};exports[_0x791c('0x5')]=function(_0x324831,_0x3f11e8){return client[_0x791c('0x2')](_0x791c('0x6'),{'body':_0x3f11e8,'options':{'where':{'id':_0x324831}},'log':_0x791c('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b61a173..fcb797e 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 _0x830e=['CreateChatMessage','createChatMessage','create'];(function(_0x54b458,_0x4da21b){var _0x18d704=function(_0x3ca278){while(--_0x3ca278){_0x54b458['push'](_0x54b458['shift']());}};_0x18d704(++_0x4da21b);}(_0x830e,0x1af));var _0xe830=function(_0x5a1822,_0x2a4a52){_0x5a1822=_0x5a1822-0x0;var _0x567235=_0x830e[_0x5a1822];return _0x567235;};'use strict';var client=require('../client');exports[_0xe830('0x0')]=function(_0x3b0cda){return client['Request'](_0xe830('0x1'),{'body':_0x3b0cda,'log':_0xe830('0x2')});}; \ No newline at end of file +var _0xebbc=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x37da3a,_0x540c02){var _0x50aba3=function(_0x5a4251){while(--_0x5a4251){_0x37da3a['push'](_0x37da3a['shift']());}};_0x50aba3(++_0x540c02);}(_0xebbc,0x1f0));var _0xcebb=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xebbc[_0x3cb6dc];return _0x47ec89;};'use strict';var client=require(_0xcebb('0x0'));exports[_0xcebb('0x1')]=function(_0x4ba090){return client[_0xcebb('0x2')](_0xcebb('0x3'),{'body':_0x4ba090,'log':_0xcebb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 838e20b..6d67f94 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 _0x8e0f=['Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x8e0f,0x12f));var _0xf8e0=function(_0xe4a90e,_0x5eb7b3){_0xe4a90e=_0xe4a90e-0x0;var _0xdb74b=_0x8e0f[_0xe4a90e];return _0xdb74b;};'use strict';var client=require(_0xf8e0('0x0'));exports[_0xf8e0('0x1')]=function(){return function(){return client[_0xf8e0('0x2')](_0xf8e0('0x3'),{'options':{'raw':![],'attributes':['id',_0xf8e0('0x4'),_0xf8e0('0x5'),_0xf8e0('0x6')],'include':[{'model':'User','as':_0xf8e0('0x7'),'attributes':['id','name',_0xf8e0('0x8'),_0xf8e0('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x55a5=['User','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x55a5,0xf7));var _0x555a=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x55a5[_0x21f9c2];return _0x3da17f;};'use strict';var client=require(_0x555a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x555a('0x1')](_0x555a('0x2'),{'options':{'raw':![],'attributes':['id',_0x555a('0x3'),_0x555a('0x4'),_0x555a('0x5')],'include':[{'model':_0x555a('0x6'),'as':_0x555a('0x7'),'attributes':['id',_0x555a('0x3'),_0x555a('0x8'),_0x555a('0x9')]}]},'log':_0x555a('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index b4570ce..e59f2f6 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 _0x89fe=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x89fe,0x83));var _0xe89f=function(_0x21b07b,_0x3ec603){_0x21b07b=_0x21b07b-0x0;var _0x4cae74=_0x89fe[_0x21b07b];return _0x4cae74;};'use strict';var client=require(_0xe89f('0x0'));exports[_0xe89f('0x1')]=function(_0x2aac3e){return client[_0xe89f('0x2')]('CreateChatQueueReport',{'body':_0x2aac3e,'log':_0xe89f('0x3')});};exports[_0xe89f('0x4')]=function(_0x580dce,_0x3d3aa8){return client[_0xe89f('0x2')](_0xe89f('0x5'),{'body':_0x3d3aa8,'options':{'where':{'uniqueid':_0x580dce},'order':[['id',_0xe89f('0x6')]],'limit':0x1},'log':_0xe89f('0x5')});}; \ No newline at end of file +var _0x2e35=['UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport','update','Request'];(function(_0x59a6e3,_0x4ed033){var _0x46509f=function(_0x402c24){while(--_0x402c24){_0x59a6e3['push'](_0x59a6e3['shift']());}};_0x46509f(++_0x4ed033);}(_0x2e35,0x1d0));var _0x52e3=function(_0x2daa7d,_0x5822c4){_0x2daa7d=_0x2daa7d-0x0;var _0x467e5f=_0x2e35[_0x2daa7d];return _0x467e5f;};'use strict';var client=require(_0x52e3('0x0'));exports[_0x52e3('0x1')]=function(_0x1dc2a2){return client['Request'](_0x52e3('0x2'),{'body':_0x1dc2a2,'log':_0x52e3('0x2')});};exports[_0x52e3('0x3')]=function(_0x3dc244,_0x4ccab4){return client[_0x52e3('0x4')](_0x52e3('0x5'),{'body':_0x4ccab4,'options':{'where':{'uniqueid':_0x3dc244},'order':[['id',_0x52e3('0x6')]],'limit':0x1},'log':_0x52e3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 227f6e0..c35f9c8 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x7a54,0x106));var _0x47a5=function(_0x4cb52e,_0x2f0da0){_0x4cb52e=_0x4cb52e-0x0;var _0x25c3cd=_0x7a54[_0x4cb52e];return _0x25c3cd;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x7a54,0x106));var _0x47a5=function(_0x36cfbc,_0x59ed80){_0x36cfbc=_0x36cfbc-0x0;var _0x581d0b=_0x7a54[_0x36cfbc];return _0x581d0b;};'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 247f656..f7f2539 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 _0x8f0a=['../client','CreateFaxMessage','createFaxMessage'];(function(_0x33ed02,_0x171eea){var _0x4130b2=function(_0x1890cb){while(--_0x1890cb){_0x33ed02['push'](_0x33ed02['shift']());}};_0x4130b2(++_0x171eea);}(_0x8f0a,0x1b6));var _0xa8f0=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x8f0a[_0x3d42d8];return _0x27fc41;};'use strict';var client=require(_0xa8f0('0x0'));exports['create']=function(_0x427bd1){return client['Request'](_0xa8f0('0x1'),{'body':_0x427bd1,'log':_0xa8f0('0x2')});}; \ No newline at end of file +var _0x7652=['../client','create','Request','CreateFaxMessage'];(function(_0x5e4ba7,_0x288a11){var _0x2adf5b=function(_0x16e46e){while(--_0x16e46e){_0x5e4ba7['push'](_0x5e4ba7['shift']());}};_0x2adf5b(++_0x288a11);}(_0x7652,0x1e4));var _0x2765=function(_0x33f118,_0xd56380){_0x33f118=_0x33f118-0x0;var _0x1d6fd7=_0x7652[_0x33f118];return _0x1d6fd7;};'use strict';var client=require(_0x2765('0x0'));exports[_0x2765('0x1')]=function(_0x587ef0){return client[_0x2765('0x2')](_0x2765('0x3'),{'body':_0x587ef0,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4eb8191..b20bde4 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 _0x9144=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0x1daba8,_0x7d875e){var _0x4a5b56=function(_0x33b599){while(--_0x33b599){_0x1daba8['push'](_0x1daba8['shift']());}};_0x4a5b56(++_0x7d875e);}(_0x9144,0x13b));var _0x4914=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0x9144[_0x3dc089];return _0x34d9d3;};'use strict';var client=require(_0x4914('0x0'));exports[_0x4914('0x1')]=function(){return function(){return client[_0x4914('0x2')](_0x4914('0x3'),{'options':{'raw':![],'attributes':['id',_0x4914('0x4'),_0x4914('0x5'),'strategy'],'include':[{'model':_0x4914('0x6'),'as':_0x4914('0x7'),'attributes':['id',_0x4914('0x4'),_0x4914('0x8'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x54df=['getFaxQueues','Request','GetFaxQueue','name','timeout','Agents','online','faxPause','../client'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x54df,0x1ee));var _0xf54d=function(_0x221757,_0x24f8e3){_0x221757=_0x221757-0x0;var _0x221979=_0x54df[_0x221757];return _0x221979;};'use strict';var client=require(_0xf54d('0x0'));exports[_0xf54d('0x1')]=function(){return function(){return client[_0xf54d('0x2')](_0xf54d('0x3'),{'options':{'raw':![],'attributes':['id',_0xf54d('0x4'),_0xf54d('0x5'),'strategy'],'include':[{'model':'User','as':_0xf54d('0x6'),'attributes':['id',_0xf54d('0x4'),_0xf54d('0x7'),_0xf54d('0x8')]}]},'log':_0xf54d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 017ab93..da16d52 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 _0x9378=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x36fd33,_0x319480){var _0x50b53d=function(_0x4af53b){while(--_0x4af53b){_0x36fd33['push'](_0x36fd33['shift']());}};_0x50b53d(++_0x319480);}(_0x9378,0xa9));var _0x8937=function(_0xf1fa33,_0x1c7cc9){_0xf1fa33=_0xf1fa33-0x0;var _0x515604=_0x9378[_0xf1fa33];return _0x515604;};'use strict';var client=require(_0x8937('0x0'));exports[_0x8937('0x1')]=function(_0x1aef07){return client[_0x8937('0x2')](_0x8937('0x3'),{'body':_0x1aef07,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x39d381,_0x1e1c94){return client[_0x8937('0x2')](_0x8937('0x4'),{'body':_0x1e1c94,'options':{'where':{'uniqueid':_0x39d381},'order':[['id',_0x8937('0x5')]],'limit':0x1},'log':_0x8937('0x4')});}; \ No newline at end of file +var _0x8999=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x30014e,_0x555f27){var _0x1e3be1=function(_0x36b923){while(--_0x36b923){_0x30014e['push'](_0x30014e['shift']());}};_0x1e3be1(++_0x555f27);}(_0x8999,0x11c));var _0x9899=function(_0x185d8f,_0x16b7f1){_0x185d8f=_0x185d8f-0x0;var _0x39072b=_0x8999[_0x185d8f];return _0x39072b;};'use strict';var client=require(_0x9899('0x0'));exports[_0x9899('0x1')]=function(_0x176d64){return client[_0x9899('0x2')](_0x9899('0x3'),{'body':_0x176d64,'log':_0x9899('0x3')});};exports[_0x9899('0x4')]=function(_0x24d51a,_0x2b5387){return client[_0x9899('0x2')](_0x9899('0x5'),{'body':_0x2b5387,'options':{'where':{'uniqueid':_0x24d51a},'order':[['id',_0x9899('0x6')]],'limit':0x1},'log':_0x9899('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b83cdfd..b550c83 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 _0x6bed=['GetInterval','name','Interval','interval','../client','getIntervals','Request'];(function(_0x58e144,_0x53ad2a){var _0x5eaaeb=function(_0x411123){while(--_0x411123){_0x58e144['push'](_0x58e144['shift']());}};_0x5eaaeb(++_0x53ad2a);}(_0x6bed,0x14d));var _0xd6be=function(_0x28be20,_0x3fed79){_0x28be20=_0x28be20-0x0;var _0x189d7f=_0x6bed[_0x28be20];return _0x189d7f;};'use strict';var client=require(_0xd6be('0x0'));exports[_0xd6be('0x1')]=function(){return function(){return client[_0xd6be('0x2')](_0xd6be('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd6be('0x4')],'include':[{'model':_0xd6be('0x5'),'as':'Intervals','attributes':['id',_0xd6be('0x4'),_0xd6be('0x6')]}]},'log':_0xd6be('0x1')});};}; \ No newline at end of file +var _0x8b55=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8b55,0x196));var _0x58b5=function(_0x26a9b5,_0x4f4e81){_0x26a9b5=_0x26a9b5-0x0;var _0x4fd65c=_0x8b55[_0x26a9b5];return _0x4fd65c;};'use strict';var client=require('../client');exports[_0x58b5('0x0')]=function(){return function(){return client[_0x58b5('0x1')](_0x58b5('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x58b5('0x3')],'include':[{'model':_0x58b5('0x4'),'as':_0x58b5('0x5'),'attributes':['id','name',_0x58b5('0x6')]}]},'log':_0x58b5('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ec06c0f..a59ec90 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 _0x2272=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x115043,_0x39842d){var _0x26dfcb=function(_0x2ab8d7){while(--_0x2ab8d7){_0x115043['push'](_0x115043['shift']());}};_0x26dfcb(++_0x39842d);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0x2227('0x0'));exports[_0x2227('0x1')]=function(_0xefcd5,_0x23bada){return client[_0x2227('0x2')]('UpdateMailInteraction',{'body':_0x23bada,'options':{'where':{'id':_0xefcd5}},'log':_0x2227('0x3')});};exports[_0x2227('0x4')]=function(_0x1f5a4a,_0x4c17c2){return client['Request'](_0x2227('0x5'),{'body':_0x4c17c2,'options':{'where':{'id':_0x1f5a4a}},'log':_0x2227('0x6')});}; \ No newline at end of file +var _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x3c360e,_0x2ac56){var _0x4bc3a2=function(_0x24f4ef){while(--_0x24f4ef){_0x3c360e['push'](_0x3c360e['shift']());}};_0x4bc3a2(++_0x2ac56);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5a09cc,_0x245518){_0x5a09cc=_0x5a09cc-0x0;var _0x42f9c1=_0x02ce[_0x5a09cc];return _0x42f9c1;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d6a6ea1..a275cd6 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 _0x1152=['create','Request','../client'];(function(_0x2270d6,_0x13180a){var _0x36e34f=function(_0x13b09a){while(--_0x13b09a){_0x2270d6['push'](_0x2270d6['shift']());}};_0x36e34f(++_0x13180a);}(_0x1152,0x16a));var _0x2115=function(_0x3dfbc3,_0x41a601){_0x3dfbc3=_0x3dfbc3-0x0;var _0x53fc9e=_0x1152[_0x3dfbc3];return _0x53fc9e;};'use strict';var client=require(_0x2115('0x0'));exports[_0x2115('0x1')]=function(_0x11d9bc){return client[_0x2115('0x2')]('CreateMailMessage',{'body':_0x11d9bc,'log':'createMailMessage'});}; \ No newline at end of file +var _0x1990=['createMailMessage','CreateMailMessage'];(function(_0x2ae633,_0x2f7d98){var _0x2f72f4=function(_0x563747){while(--_0x563747){_0x2ae633['push'](_0x2ae633['shift']());}};_0x2f72f4(++_0x2f7d98);}(_0x1990,0x1a3));var _0x0199=function(_0x24a4ba,_0xb1f32f){_0x24a4ba=_0x24a4ba-0x0;var _0x3d0ab3=_0x1990[_0x24a4ba];return _0x3d0ab3;};'use strict';var client=require('../client');exports['create']=function(_0x3be987){return client['Request'](_0x0199('0x0'),{'body':_0x3be987,'log':_0x0199('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 038ca2e..c4d9985 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 _0x3a0e=['getMailQueues','name','timeout','strategy','User','Agents','mailPause','../client'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0x3a0e,0x1c7));var _0xe3a0=function(_0x2cc036,_0x3e9326){_0x2cc036=_0x2cc036-0x0;var _0x3c7957=_0x3a0e[_0x2cc036];return _0x3c7957;};'use strict';var client=require(_0xe3a0('0x0'));exports[_0xe3a0('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xe3a0('0x2'),_0xe3a0('0x3'),_0xe3a0('0x4')],'include':[{'model':_0xe3a0('0x5'),'as':_0xe3a0('0x6'),'attributes':['id',_0xe3a0('0x2'),'online',_0xe3a0('0x7')]}]},'log':_0xe3a0('0x1')});};}; \ No newline at end of file +var _0xa5b5=['User','online','mailPause','getMailQueues','../client','Request','name'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0xa5b5,0xeb));var _0x5a5b=function(_0x1cad4b,_0x431242){_0x1cad4b=_0x1cad4b-0x0;var _0x2442c5=_0xa5b5[_0x1cad4b];return _0x2442c5;};'use strict';var client=require(_0x5a5b('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x5a5b('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x5a5b('0x2'),'timeout','strategy'],'include':[{'model':_0x5a5b('0x3'),'as':'Agents','attributes':['id',_0x5a5b('0x2'),_0x5a5b('0x4'),_0x5a5b('0x5')]}]},'log':_0x5a5b('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 496d499..4ada5e2 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 _0x78d6=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x78d6,0x1f4));var _0x678d=function(_0x146dde,_0x4b246f){_0x146dde=_0x146dde-0x0;var _0x4060ec=_0x78d6[_0x146dde];return _0x4060ec;};'use strict';var client=require(_0x678d('0x0'));exports[_0x678d('0x1')]=function(_0x4df4ba){return client[_0x678d('0x2')](_0x678d('0x3'),{'body':_0x4df4ba,'log':_0x678d('0x3')});};exports[_0x678d('0x4')]=function(_0x848d37,_0x31ae6c){return client[_0x678d('0x2')](_0x678d('0x5'),{'body':_0x31ae6c,'options':{'where':{'uniqueid':_0x848d37},'order':[['id',_0x678d('0x6')]],'limit':0x1},'log':_0x678d('0x5')});}; \ No newline at end of file +var _0xde17=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x1620d2,_0x798f79){var _0xb63a8d=function(_0x414068){while(--_0x414068){_0x1620d2['push'](_0x1620d2['shift']());}};_0xb63a8d(++_0x798f79);}(_0xde17,0x1e3));var _0x7de1=function(_0x7d4eec,_0x546e2b){_0x7d4eec=_0x7d4eec-0x0;var _0x4d785a=_0xde17[_0x7d4eec];return _0x4d785a;};'use strict';var client=require(_0x7de1('0x0'));exports[_0x7de1('0x1')]=function(_0x3a8ff7){return client[_0x7de1('0x2')](_0x7de1('0x3'),{'body':_0x3a8ff7,'log':'CreateMailQueueReport'});};exports['update']=function(_0x466136,_0x796075){return client['Request'](_0x7de1('0x4'),{'body':_0x796075,'options':{'where':{'uniqueid':_0x466136},'order':[['id',_0x7de1('0x5')]],'limit':0x1},'log':_0x7de1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 79b6dbf..37f2929 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 _0xd677=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x189406,_0x3ce38d){var _0x180d41=function(_0x556e3b){while(--_0x556e3b){_0x189406['push'](_0x189406['shift']());}};_0x180d41(++_0x3ce38d);}(_0xd677,0x71));var _0x7d67=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xd677[_0x412e27];return _0x53da42;};'use strict';var client=require(_0x7d67('0x0'));exports[_0x7d67('0x1')]=function(_0x500646,_0xff9930){return client[_0x7d67('0x2')](_0x7d67('0x3'),{'body':_0xff9930,'options':{'where':{'id':_0x500646}},'log':_0x7d67('0x4')});};exports['addTags']=function(_0x5eccb3,_0x3ce765){return client['Request'](_0x7d67('0x5'),{'body':_0x3ce765,'options':{'where':{'id':_0x5eccb3}},'log':_0x7d67('0x6')});}; \ No newline at end of file +var _0x6cba=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x2f3d86,_0x2797fe){var _0x596312=function(_0x19d0fd){while(--_0x19d0fd){_0x2f3d86['push'](_0x2f3d86['shift']());}};_0x596312(++_0x2797fe);}(_0x6cba,0x154));var _0xa6cb=function(_0x181b70,_0x41dc80){_0x181b70=_0x181b70-0x0;var _0x5ddf86=_0x6cba[_0x181b70];return _0x5ddf86;};'use strict';var client=require(_0xa6cb('0x0'));exports[_0xa6cb('0x1')]=function(_0x2b4c66,_0x4f4650){return client[_0xa6cb('0x2')](_0xa6cb('0x3'),{'body':_0x4f4650,'options':{'where':{'id':_0x2b4c66}},'log':_0xa6cb('0x4')});};exports[_0xa6cb('0x5')]=function(_0x3c369c,_0x2d4a06){return client[_0xa6cb('0x2')](_0xa6cb('0x6'),{'body':_0x2d4a06,'options':{'where':{'id':_0x3c369c}},'log':_0xa6cb('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b9a0b1e..27e1c90 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 _0x9ede=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x318d98,_0x129af4){var _0x136bc7=function(_0x443529){while(--_0x443529){_0x318d98['push'](_0x318d98['shift']());}};_0x136bc7(++_0x129af4);}(_0x9ede,0x19a));var _0xe9ed=function(_0x4342e0,_0x368e8e){_0x4342e0=_0x4342e0-0x0;var _0x333735=_0x9ede[_0x4342e0];return _0x333735;};'use strict';var client=require('../client');exports['create']=function(_0x4a9a26){return client[_0xe9ed('0x0')](_0xe9ed('0x1'),{'body':_0x4a9a26,'log':_0xe9ed('0x2')});}; \ No newline at end of file +var _0x1184=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x1184,0x1d8));var _0x4118=function(_0x5ed493,_0x2e626d){_0x5ed493=_0x5ed493-0x0;var _0x5515c8=_0x1184[_0x5ed493];return _0x5515c8;};'use strict';var client=require('../client');exports['create']=function(_0x4eaa78){return client[_0x4118('0x0')](_0x4118('0x1'),{'body':_0x4eaa78,'log':_0x4118('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 52e3f3c..1564035 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 _0x3717=['User','Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x364ac8,_0x5f2d96){var _0x41c23a=function(_0x7ed981){while(--_0x7ed981){_0x364ac8['push'](_0x364ac8['shift']());}};_0x41c23a(++_0x5f2d96);}(_0x3717,0x81));var _0x7371=function(_0x2a8ad5,_0x23be3a){_0x2a8ad5=_0x2a8ad5-0x0;var _0x557ac0=_0x3717[_0x2a8ad5];return _0x557ac0;};'use strict';var client=require('../client');exports[_0x7371('0x0')]=function(){return function(){return client[_0x7371('0x1')](_0x7371('0x2'),{'options':{'raw':![],'attributes':['id',_0x7371('0x3'),_0x7371('0x4'),_0x7371('0x5')],'include':[{'model':_0x7371('0x6'),'as':_0x7371('0x7'),'attributes':['id',_0x7371('0x3'),_0x7371('0x8'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xa74f=['../client','GetOpenchannelQueue','timeout','strategy','Agents','name','openchannelPause','getOpenchannelQueues'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa74f,0xe0));var _0xfa74=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xa74f[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0xfa74('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0xfa74('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xfa74('0x2'),_0xfa74('0x3')],'include':[{'model':'User','as':_0xfa74('0x4'),'attributes':['id',_0xfa74('0x5'),'online',_0xfa74('0x6')]}]},'log':_0xfa74('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a82e2c0..252eabf 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 _0x6c9c=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x44976e,_0x311385){var _0x4852b2=function(_0xd57529){while(--_0xd57529){_0x44976e['push'](_0x44976e['shift']());}};_0x4852b2(++_0x311385);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x3afe7a,_0x529fb2){_0x3afe7a=_0x3afe7a-0x0;var _0x286b71=_0x6c9c[_0x3afe7a];return _0x286b71;};'use strict';var client=require(_0xc6c9('0x0'));exports[_0xc6c9('0x1')]=function(_0x5a71e2){return client[_0xc6c9('0x2')](_0xc6c9('0x3'),{'body':_0x5a71e2,'log':_0xc6c9('0x3')});};exports[_0xc6c9('0x4')]=function(_0x589679,_0x3257fa){return client[_0xc6c9('0x2')](_0xc6c9('0x5'),{'body':_0x3257fa,'options':{'where':{'uniqueid':_0x589679},'order':[['id',_0xc6c9('0x6')]],'limit':0x1},'log':_0xc6c9('0x5')});}; \ No newline at end of file +var _0x827a=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x827a,0x167));var _0xa827=function(_0x5d7bef,_0x2af11c){_0x5d7bef=_0x5d7bef-0x0;var _0x20ab33=_0x827a[_0x5d7bef];return _0x20ab33;};'use strict';var client=require(_0xa827('0x0'));exports['create']=function(_0x538465){return client[_0xa827('0x1')](_0xa827('0x2'),{'body':_0x538465,'log':_0xa827('0x2')});};exports[_0xa827('0x3')]=function(_0x73d262,_0x57484c){return client[_0xa827('0x1')](_0xa827('0x4'),{'body':_0x57484c,'options':{'where':{'uniqueid':_0x73d262},'order':[['id',_0xa827('0x5')]],'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 e9d55ff..4dd1e84 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 _0x0a52=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x5cbd3a,_0x2be929){var _0x250b07=function(_0x2bce85){while(--_0x2bce85){_0x5cbd3a['push'](_0x5cbd3a['shift']());}};_0x250b07(++_0x2be929);}(_0x0a52,0xe4));var _0x20a5=function(_0xa72345,_0x1fd304){_0xa72345=_0xa72345-0x0;var _0xbc82fb=_0x0a52[_0xa72345];return _0xbc82fb;};'use strict';var client=require(_0x20a5('0x0'));exports[_0x20a5('0x1')]=function(_0x51add1,_0x1b91ca){return client[_0x20a5('0x2')](_0x20a5('0x3'),{'body':_0x1b91ca,'options':{'where':{'id':_0x51add1}},'log':'updateSmsInteraction'});};exports[_0x20a5('0x4')]=function(_0x16e604,_0x243305){return client[_0x20a5('0x2')](_0x20a5('0x5'),{'body':_0x243305,'options':{'where':{'id':_0x16e604}},'log':_0x20a5('0x6')});}; \ No newline at end of file +var _0xfd7b=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x1931e5,_0x4e000d){var _0x5669b6=function(_0x4e5991){while(--_0x4e5991){_0x1931e5['push'](_0x1931e5['shift']());}};_0x5669b6(++_0x4e000d);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xfd7b[_0x5834bc];return _0x3e183a;};'use strict';var client=require('../client');exports[_0xbfd7('0x0')]=function(_0x381d71,_0x3138e8){return client[_0xbfd7('0x1')](_0xbfd7('0x2'),{'body':_0x3138e8,'options':{'where':{'id':_0x381d71}},'log':_0xbfd7('0x3')});};exports[_0xbfd7('0x4')]=function(_0x221ad1,_0x249e59){return client[_0xbfd7('0x1')](_0xbfd7('0x5'),{'body':_0x249e59,'options':{'where':{'id':_0x221ad1}},'log':_0xbfd7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index af2a317..888963c 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 _0x61b2=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x2a24b2,_0x171540){var _0x2ed7d3=function(_0x49a1e7){while(--_0x49a1e7){_0x2a24b2['push'](_0x2a24b2['shift']());}};_0x2ed7d3(++_0x171540);}(_0x61b2,0x18b));var _0x261b=function(_0x1d203c,_0x443653){_0x1d203c=_0x1d203c-0x0;var _0xd2cbe3=_0x61b2[_0x1d203c];return _0xd2cbe3;};'use strict';var client=require(_0x261b('0x0'));exports[_0x261b('0x1')]=function(_0xd98167){return client[_0x261b('0x2')](_0x261b('0x3'),{'body':_0xd98167,'log':_0x261b('0x4')});}; \ No newline at end of file +var _0xdb64=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xdb64,0x146));var _0x4db6=function(_0x4c34d8,_0x383073){_0x4c34d8=_0x4c34d8-0x0;var _0x4c21df=_0xdb64[_0x4c34d8];return _0x4c21df;};'use strict';var client=require(_0x4db6('0x0'));exports[_0x4db6('0x1')]=function(_0x136e90){return client[_0x4db6('0x2')](_0x4db6('0x3'),{'body':_0x136e90,'log':_0x4db6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c344dcc..9319a64 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x57442a,_0x5e3823){var _0x49fedd=function(_0x64789c){while(--_0x64789c){_0x57442a['push'](_0x57442a['shift']());}};_0x49fedd(++_0x5e3823);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0190ede..5feb686 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x25215c,_0x87419d){var _0x340916=function(_0x5e7b5f){while(--_0x5e7b5f){_0x25215c['push'](_0x25215c['shift']());}};_0x340916(++_0x87419d);}(_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){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x5da095,_0x158c54){var _0x49f192=function(_0x469c5d){while(--_0x469c5d){_0x5da095['push'](_0x5da095['shift']());}};_0x49f192(++_0x158c54);}(_0x55ca,0x126));var _0xa55c=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x55ca[_0x48b810];return _0x23c17d;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4320579..4ff9162 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(_0xaf63e3,_0x159606){var _0xbbc92f=function(_0x2357ca){while(--_0x2357ca){_0xaf63e3['push'](_0xaf63e3['shift']());}};_0xbbc92f(++_0x159606);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x122c19,_0x14460e){var _0x504533=function(_0x2c7183){while(--_0x2c7183){_0x122c19['push'](_0x122c19['shift']());}};_0x504533(++_0x14460e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 cd22c23..0121f50 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 _0x50e5=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x1651c6,_0x2b5bab){var _0x30b653=function(_0x36aba4){while(--_0x36aba4){_0x1651c6['push'](_0x1651c6['shift']());}};_0x30b653(++_0x2b5bab);}(_0x50e5,0xb7));var _0x550e=function(_0x437e0d,_0x339d66){_0x437e0d=_0x437e0d-0x0;var _0xd8ec65=_0x50e5[_0x437e0d];return _0xd8ec65;};'use strict';var client=require(_0x550e('0x0'));exports[_0x550e('0x1')]=function(_0x524e28,_0x736dcd){return client[_0x550e('0x2')](_0x550e('0x3'),{'body':_0x736dcd,'options':{'where':{'id':_0x524e28}},'log':_0x550e('0x4')});};exports[_0x550e('0x5')]=function(_0x3f3a13,_0x78e6c5){return client[_0x550e('0x2')](_0x550e('0x6'),{'body':_0x78e6c5,'options':{'where':{'id':_0x3f3a13}},'log':_0x550e('0x7')});}; \ No newline at end of file +var _0xdbb1=['../client','Request','addTags'];(function(_0x50056e,_0x55e7ee){var _0x4adc4c=function(_0x4b6618){while(--_0x4b6618){_0x50056e['push'](_0x50056e['shift']());}};_0x4adc4c(++_0x55e7ee);}(_0xdbb1,0x105));var _0x1dbb=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xdbb1[_0x2aecb2];return _0x3ebb80;};'use strict';var client=require(_0x1dbb('0x0'));exports['update']=function(_0x53f27d,_0x4b55f7){return client[_0x1dbb('0x1')]('UpdateWhatsappInteraction',{'body':_0x4b55f7,'options':{'where':{'id':_0x53f27d}},'log':'updateWhatsappInteraction'});};exports[_0x1dbb('0x2')]=function(_0x483e15,_0xa1e321){return client[_0x1dbb('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xa1e321,'options':{'where':{'id':_0x483e15}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index db5554b..2dcb7e9 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 _0x7780=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x261ebc,_0x56d413){var _0xaf4ee2=function(_0x163250){while(--_0x163250){_0x261ebc['push'](_0x261ebc['shift']());}};_0xaf4ee2(++_0x56d413);}(_0x7780,0x1f2));var _0x0778=function(_0x203b5c,_0x2384f1){_0x203b5c=_0x203b5c-0x0;var _0x20a057=_0x7780[_0x203b5c];return _0x20a057;};'use strict';var client=require('../client');exports[_0x0778('0x0')]=function(_0x10626b){return client[_0x0778('0x1')](_0x0778('0x2'),{'body':_0x10626b,'log':_0x0778('0x3')});}; \ No newline at end of file +var _0xd2d7=['Request','CreateWhatsappMessage'];(function(_0x42bf0b,_0x465c08){var _0x3e333f=function(_0xcc97b8){while(--_0xcc97b8){_0x42bf0b['push'](_0x42bf0b['shift']());}};_0x3e333f(++_0x465c08);}(_0xd2d7,0xa2));var _0x7d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x5eb7dc){return client[_0x7d2d('0x0')](_0x7d2d('0x1'),{'body':_0x5eb7dc,'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 5791be3..a3eaccb 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 _0x7373=['Agents','online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x4515fe,_0xbde971){var _0x531a82=function(_0x3d146b){while(--_0x3d146b){_0x4515fe['push'](_0x4515fe['shift']());}};_0x531a82(++_0xbde971);}(_0x7373,0x68));var _0x3737=function(_0x2c2ba2,_0x2045c2){_0x2c2ba2=_0x2c2ba2-0x0;var _0x21a97a=_0x7373[_0x2c2ba2];return _0x21a97a;};'use strict';var client=require(_0x3737('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x3737('0x1')](_0x3737('0x2'),{'options':{'raw':![],'attributes':['id',_0x3737('0x3'),_0x3737('0x4'),_0x3737('0x5')],'include':[{'model':'User','as':_0x3737('0x6'),'attributes':['id',_0x3737('0x3'),_0x3737('0x7'),_0x3737('0x8')]}]},'log':_0x3737('0x9')});};}; \ No newline at end of file +var _0xa286=['Agents','name','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User'];(function(_0x1f4a69,_0x53b15e){var _0x2d3b80=function(_0x488c8a){while(--_0x488c8a){_0x1f4a69['push'](_0x1f4a69['shift']());}};_0x2d3b80(++_0x53b15e);}(_0xa286,0xd5));var _0x6a28=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xa286[_0x4b055c];return _0x4b62bb;};'use strict';var client=require(_0x6a28('0x0'));exports[_0x6a28('0x1')]=function(){return function(){return client[_0x6a28('0x2')](_0x6a28('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x6a28('0x4'),_0x6a28('0x5')],'include':[{'model':_0x6a28('0x6'),'as':_0x6a28('0x7'),'attributes':['id',_0x6a28('0x8'),_0x6a28('0x9'),_0x6a28('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ee8c31c..ad40947 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 _0x5163=['update','Request','DESC','UpdateWhatsappQueueReport','create','CreateWhatsappQueueReport'];(function(_0x295169,_0x3dd69e){var _0x12f795=function(_0x320779){while(--_0x320779){_0x295169['push'](_0x295169['shift']());}};_0x12f795(++_0x3dd69e);}(_0x5163,0x14e));var _0x3516=function(_0xc550d0,_0x5aba77){_0xc550d0=_0xc550d0-0x0;var _0x8ea8db=_0x5163[_0xc550d0];return _0x8ea8db;};'use strict';var client=require('../client');exports[_0x3516('0x0')]=function(_0x395db0){return client['Request'](_0x3516('0x1'),{'body':_0x395db0,'log':'CreateWhatsappQueueReport'});};exports[_0x3516('0x2')]=function(_0x271b80,_0xb7001a){return client[_0x3516('0x3')]('UpdateWhatsappQueueReport',{'body':_0xb7001a,'options':{'where':{'uniqueid':_0x271b80},'order':[['id',_0x3516('0x4')]],'limit':0x1},'log':_0x3516('0x5')});}; \ No newline at end of file +var _0x2bc3=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0xa81275,_0x520100){var _0x581248=function(_0x16f957){while(--_0x16f957){_0xa81275['push'](_0xa81275['shift']());}};_0x581248(++_0x520100);}(_0x2bc3,0x102));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x32bc('0x0'));exports[_0x32bc('0x1')]=function(_0x776b42){return client[_0x32bc('0x2')](_0x32bc('0x3'),{'body':_0x776b42,'log':_0x32bc('0x3')});};exports[_0x32bc('0x4')]=function(_0x553012,_0x23f047){return client[_0x32bc('0x2')](_0x32bc('0x5'),{'body':_0x23f047,'options':{'where':{'uniqueid':_0x553012},'order':[['id',_0x32bc('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 64316d3..1e03dff 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 _0x40c0=['end','info','close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','error','map','message','find','agents','timeout','createQueue','atimeout','channel','format'];(function(_0x4f75c9,_0x330fae){var _0x157745=function(_0x1bd9fd){while(--_0x1bd9fd){_0x4f75c9['push'](_0x4f75c9['shift']());}};_0x157745(++_0x330fae);}(_0x40c0,0x99));var _0x040c=function(_0x47d4d3,_0x569183){_0x47d4d3=_0x47d4d3-0x0;var _0x353323=_0x40c0[_0x47d4d3];return _0x353323;};'use strict';var schema=require('validate');var _=require(_0x040c('0x0'));var util=require(_0x040c('0x1'));var seqqueue=require(_0x040c('0x2'));var logger=require('../../../../config/logger')(_0x040c('0x3'));var strategy=require(_0x040c('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x040c('0x5')},'timeout':{'type':_0x040c('0x6'),'message':_0x040c('0x7')}});function writeLog(_0x34bbe0,_0x7ca15f,_0x169540){return logger['info'](util['format'](_0x040c('0x8'),_0x34bbe0,_0x7ca15f['name'],_0x169540));}function handleFindAgent(_0x2a3cd3){return function(_0x2a3eb5){return _0x2a3eb5[_0x040c('0x9')][_0x040c('0xa')]()===_0x2a3cd3[_0x040c('0xa')]();};}exports['consequence']=function(_0x4bddf1,_0xc58e5d,_0x29b9e4,_0x547739){return function(_0x13989e){try{var _0x28558f={'name':_0xc58e5d[0x0],'timeout':_0xc58e5d[0x1]};var _0x1067c0=queue[_0x040c('0xb')](_0x28558f,{'typecast':!![]});if(_0x1067c0['length']){logger[_0x040c('0xc')]('[%s][AGENT]\x20%s',_0x4bddf1,_[_0x040c('0xd')](_0x1067c0,_0x040c('0xe'))['join'](',\x20'));_0x13989e['stop']();}else{var _0x1a6d0b=_[_0x040c('0xf')](_0x29b9e4[_0x040c('0x10')],handleFindAgent(_0x28558f['name']));if(_0x1a6d0b){var _0xcfc616=(_0x28558f[_0x040c('0x11')]||0xa)*0x3e8;var _0x210450,_0x4630db;var _0x139092=seqqueue[_0x040c('0x12')](_0xcfc616);_0x139092['id']=_0x4bddf1;_0x139092[_0x040c('0x13')]=_0xcfc616;_0x139092[_0x040c('0x14')]=_0x547739[_0x040c('0x14')];writeLog(_0x4bddf1,_0x1a6d0b,util[_0x040c('0x15')]('START:%s',_0xcfc616));_0x29b9e4['rules'][_0x4bddf1]['on'](_0x040c('0x16'),function(){logger[_0x040c('0x17')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4bddf1);clearTimeout(_0x4630db);_0x4630db=undefined;_0x139092[_0x040c('0x18')]();if(_0x29b9e4[_0x040c('0x19')][_0x4bddf1]){delete _0x29b9e4['rules'][_0x4bddf1];}_0x13989e[_0x040c('0x1a')]();});_0x29b9e4[_0x040c('0x19')][_0x4bddf1]['on'](_0x040c('0x1b'),function(){if(_0x29b9e4[_0x040c('0x19')][_0x4bddf1]){delete _0x29b9e4[_0x040c('0x19')][_0x4bddf1];}});_0x4630db=setTimeout(function(){logger[_0x040c('0x17')](_0x040c('0x1c'),_0x4bddf1);clearTimeout(_0x4630db);_0x139092[_0x040c('0x18')]();_0x13989e[_0x040c('0x1d')]();},_0xcfc616);strategy[_0x040c('0x1e')](_0x139092,_0x1a6d0b,_0x29b9e4,_0x547739);}else{logger['error'](_0x040c('0x1f'),_0x4bddf1,_0x28558f[_0x040c('0x9')]);_0x13989e[_0x040c('0x1a')]();}}}catch(_0x4d07f7){console[_0x040c('0x20')](_0x4d07f7);logger[_0x040c('0xc')](_0x040c('0x21'),_0x4bddf1,_0x4d07f7[_0x040c('0x22')]);_0x13989e[_0x040c('0x1a')]();}};}; \ No newline at end of file +var _0xf956=['[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','find','agents','channel','rules','end','info','close','complete'];(function(_0x48fa01,_0x261143){var _0x8c57f0=function(_0x1c8040){while(--_0x1c8040){_0x48fa01['push'](_0x48fa01['shift']());}};_0x8c57f0(++_0x261143);}(_0xf956,0x105));var _0x6f95=function(_0x2ddba2,_0xba0437){_0x2ddba2=_0x2ddba2-0x0;var _0x252d33=_0xf956[_0x2ddba2];return _0x252d33;};'use strict';var schema=require(_0x6f95('0x0'));var _=require(_0x6f95('0x1'));var util=require('util');var seqqueue=require(_0x6f95('0x2'));var logger=require('../../../../config/logger')(_0x6f95('0x3'));var strategy=require(_0x6f95('0x4'));var queue=schema({'name':{'type':_0x6f95('0x5'),'required':!![],'message':_0x6f95('0x6')},'timeout':{'type':_0x6f95('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5f03dc,_0x3b8925,_0x19fce3){return logger['info'](util[_0x6f95('0x8')](_0x6f95('0x9'),_0x5f03dc,_0x3b8925[_0x6f95('0xa')],_0x19fce3));}function handleFindAgent(_0x84f3e1){return function(_0x2bcbc3){return _0x2bcbc3[_0x6f95('0xa')][_0x6f95('0xb')]()===_0x84f3e1[_0x6f95('0xb')]();};}exports[_0x6f95('0xc')]=function(_0x1ce692,_0x263efe,_0x294e2a,_0x341249){return function(_0x4c4089){try{var _0x472162={'name':_0x263efe[0x0],'timeout':_0x263efe[0x1]};var _0x426b7c=queue[_0x6f95('0x0')](_0x472162,{'typecast':!![]});if(_0x426b7c[_0x6f95('0xd')]){logger[_0x6f95('0xe')]('[%s][AGENT]\x20%s',_0x1ce692,_[_0x6f95('0xf')](_0x426b7c,_0x6f95('0x10'))[_0x6f95('0x11')](',\x20'));_0x4c4089[_0x6f95('0x12')]();}else{var _0xd7019f=_[_0x6f95('0x13')](_0x294e2a[_0x6f95('0x14')],handleFindAgent(_0x472162['name']));if(_0xd7019f){var _0x2b5876=(_0x472162['timeout']||0xa)*0x3e8;var _0x3c3eab,_0x4eddbe;var _0x219367=seqqueue['createQueue'](_0x2b5876);_0x219367['id']=_0x1ce692;_0x219367['atimeout']=_0x2b5876;_0x219367[_0x6f95('0x15')]=_0x341249['channel'];writeLog(_0x1ce692,_0xd7019f,util[_0x6f95('0x8')]('START:%s',_0x2b5876));_0x294e2a[_0x6f95('0x16')][_0x1ce692]['on'](_0x6f95('0x17'),function(){logger[_0x6f95('0x18')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1ce692);clearTimeout(_0x4eddbe);_0x4eddbe=undefined;_0x219367[_0x6f95('0x19')]();if(_0x294e2a[_0x6f95('0x16')][_0x1ce692]){delete _0x294e2a['rules'][_0x1ce692];}_0x4c4089[_0x6f95('0x12')]();});_0x294e2a[_0x6f95('0x16')][_0x1ce692]['on'](_0x6f95('0x1a'),function(){if(_0x294e2a['rules'][_0x1ce692]){delete _0x294e2a[_0x6f95('0x16')][_0x1ce692];}});_0x4eddbe=setTimeout(function(){logger[_0x6f95('0x18')](_0x6f95('0x1b'),_0x1ce692);clearTimeout(_0x4eddbe);_0x219367[_0x6f95('0x19')]();_0x4c4089[_0x6f95('0x1c')]();},_0x2b5876);strategy[_0x6f95('0x1d')](_0x219367,_0xd7019f,_0x294e2a,_0x341249);}else{logger[_0x6f95('0xe')](_0x6f95('0x1e'),_0x1ce692,_0x472162[_0x6f95('0xa')]);_0x4c4089[_0x6f95('0x12')]();}}}catch(_0x5acc29){console['log'](_0x5acc29);logger[_0x6f95('0xe')]('[%s][QUEUE]\x20%s',_0x1ce692,_0x5acc29[_0x6f95('0x1f')]);_0x4c4089[_0x6f95('0x12')]();}};}; \ 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 9ab5c5c..a054a34 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 _0xa82a=['moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','body','getMustacheRender','create','then','catch','error','stringify','finally','stop','$LATEST','message','toString','amazonlex','providerResponse','dialogState','Failed','next','lodash'];(function(_0x31f8a0,_0x1e3391){var _0x319328=function(_0x578f38){while(--_0x578f38){_0x31f8a0['push'](_0x31f8a0['shift']());}};_0x319328(++_0x1e3391);}(_0xa82a,0x89));var _0xaa82=function(_0x10bf3b,_0x4a7bc5){_0x10bf3b=_0x10bf3b-0x0;var _0x52b411=_0xa82a[_0x10bf3b];return _0x52b411;};'use strict';var _=require(_0xaa82('0x0'));var moment=require(_0xaa82('0x1'));var AWS=require('aws-sdk');var utils=require(_0xaa82('0x2'));var logger=require(_0xaa82('0x3'))(_0xaa82('0x4'));var rpc={'chatMessage':require(_0xaa82('0x5')),'openchannelMessage':require(_0xaa82('0x6')),'mailMessage':require(_0xaa82('0x7')),'smsMessage':require(_0xaa82('0x8')),'faxMessage':require(_0xaa82('0x9')),'whatsappMessage':require(_0xaa82('0xa'))};exports['consequence']=function(_0x125c1a,_0x5e9f22){return function(_0xc5ee9){try{if(!_['isNil'](this[_0xaa82('0xb')]['UserId'])){logger[_0xaa82('0xc')](_0xaa82('0xd'),_0x125c1a,_0xaa82('0xe'));return _0xc5ee9['next']();}var _0x10fc52={'ContactId':this['contact']['id'],'sentAt':moment()[_0xaa82('0xf')](_0xaa82('0x10')),'direction':_0xaa82('0x11')};if(this[_0xaa82('0x12')]===_0xaa82('0x13')||this[_0xaa82('0x12')]===_0xaa82('0x14')){_0x10fc52[_0xaa82('0x15')]=this[_0xaa82('0xb')][_0xaa82('0x15')];}var _0x586f6a=this[_0xaa82('0x12')];if(_0x586f6a===_0xaa82('0x16')){_0x10fc52[_0xaa82('0x17')]=this[_0xaa82('0x18')]['id'];}else{_0x10fc52[_['upperFirst'](_0x586f6a)+_0xaa82('0x19')]=this[_0xaa82('0x18')]['id'];}_0x10fc52[_[_0xaa82('0x1a')](_0x586f6a)+_0xaa82('0x1b')]=this[_0xaa82('0xb')]['id'];if(this[_0xaa82('0xb')][_0xaa82('0x1c')]){var _0xec887b=_0x5e9f22[0x4];if(!_['isEmpty'](_0xec887b)){_0x10fc52[_0xaa82('0x1d')]=utils[_0xaa82('0x1e')](_0xec887b,this);return rpc[_0x586f6a+'Message'][_0xaa82('0x1f')](_0x10fc52)[_0xaa82('0x20')](function(_0x12ff1a){logger['info'](_0xaa82('0xd'),_0x125c1a,_0x10fc52[_0xaa82('0x1d')]);})[_0xaa82('0x21')](function(_0x82d144){logger[_0xaa82('0x22')](_0xaa82('0xd'),_0x125c1a,JSON[_0xaa82('0x23')](_0x82d144));})[_0xaa82('0x24')](function(){logger[_0xaa82('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x125c1a);_0xc5ee9[_0xaa82('0x25')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x125c1a);_0xc5ee9[_0xaa82('0x25')]();}}else{var _0x57cbc4=this;var _0x346a34=new AWS['LexRuntime']({'accessKeyId':_0x5e9f22[0x0],'secretAccessKey':_0x5e9f22[0x1],'region':_0x5e9f22[0x2]});var _0x5a010e={'botAlias':_0xaa82('0x26'),'botName':_0x5e9f22[0x3],'inputText':this[_0xaa82('0x27')]['body'],'userId':this['channel']+':'+this['interaction']['id'][_0xaa82('0x28')]()};_0x346a34['postText'](_0x5a010e,function(_0xf2553b,_0x227242){if(_0xf2553b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x125c1a,_0xf2553b[_0xaa82('0x27')]);_0xc5ee9['next']();}else if(_0x227242&&_0x227242[_0xaa82('0x27')]){_0x57cbc4['body'][_0xaa82('0x29')]=_0x227242;_0x10fc52[_0xaa82('0x1d')]=_0x227242['message'];_0x10fc52['providerName']=_0xaa82('0x29');_0x10fc52[_0xaa82('0x2a')]=JSON['stringify'](_0x227242);return rpc[_0x586f6a+'Message'][_0xaa82('0x1f')](_0x10fc52)[_0xaa82('0x20')](function(_0x155317){logger[_0xaa82('0xc')](_0xaa82('0xd'),_0x125c1a,_0x10fc52[_0xaa82('0x1d')]);if(_0x227242[_0xaa82('0x2b')]==_0xaa82('0x2c')){_0xc5ee9[_0xaa82('0x2d')]();}else{_0xc5ee9[_0xaa82('0x25')]();}})[_0xaa82('0x21')](function(_0x205807){logger[_0xaa82('0x22')](_0xaa82('0xd'),_0x125c1a,JSON['stringify'](_0x205807));_0xc5ee9[_0xaa82('0x2d')]();});}else{_0xc5ee9[_0xaa82('0x2d')]();}});}}catch(_0x496b75){logger[_0xaa82('0x22')](_0xaa82('0xd'),_0x125c1a,JSON[_0xaa82('0x23')](_0x496b75));_0xc5ee9[_0xaa82('0x25')]();}};}; \ No newline at end of file +var _0xfd27=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','toString','message','amazonlex','then','dialogState','lodash','moment','aws-sdk','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','info','[%s][AMAZONLEX]\x20%s','catch','error','stringify'];(function(_0x282ed6,_0x1244f6){var _0x1f85ca=function(_0x2083b6){while(--_0x2083b6){_0x282ed6['push'](_0x282ed6['shift']());}};_0x1f85ca(++_0x1244f6);}(_0xfd27,0xbe));var _0x7fd2=function(_0x547496,_0x31d82d){_0x547496=_0x547496-0x0;var _0x440b97=_0xfd27[_0x547496];return _0x440b97;};'use strict';var _=require(_0x7fd2('0x0'));var moment=require(_0x7fd2('0x1'));var AWS=require(_0x7fd2('0x2'));var utils=require(_0x7fd2('0x3'));var logger=require('../../../../config/logger')(_0x7fd2('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7fd2('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7fd2('0x6')),'faxMessage':require(_0x7fd2('0x7')),'whatsappMessage':require(_0x7fd2('0x8'))};exports['consequence']=function(_0x16e111,_0x22ccde){return function(_0x468c2a){try{if(!_[_0x7fd2('0x9')](this[_0x7fd2('0xa')][_0x7fd2('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x16e111,_0x7fd2('0xc'));return _0x468c2a[_0x7fd2('0xd')]();}var _0x41e5b0={'ContactId':this[_0x7fd2('0xe')]['id'],'sentAt':moment()[_0x7fd2('0xf')](_0x7fd2('0x10')),'direction':'out'};if(this[_0x7fd2('0x11')]===_0x7fd2('0x12')||this[_0x7fd2('0x11')]==='whatsapp'){_0x41e5b0[_0x7fd2('0x13')]=this[_0x7fd2('0xa')][_0x7fd2('0x13')];}var _0xee614=this[_0x7fd2('0x11')];if(_0xee614===_0x7fd2('0x14')){_0x41e5b0[_0x7fd2('0x15')]=this[_0x7fd2('0x16')]['id'];}else{_0x41e5b0[_[_0x7fd2('0x17')](_0xee614)+_0x7fd2('0x18')]=this[_0x7fd2('0x16')]['id'];}_0x41e5b0[_[_0x7fd2('0x17')](_0xee614)+'InteractionId']=this[_0x7fd2('0xa')]['id'];if(this[_0x7fd2('0xa')]['created']){var _0x1e2275=_0x22ccde[0x4];if(!_[_0x7fd2('0x19')](_0x1e2275)){_0x41e5b0[_0x7fd2('0x1a')]=utils[_0x7fd2('0x1b')](_0x1e2275,this);return rpc[_0xee614+_0x7fd2('0x1c')][_0x7fd2('0x1d')](_0x41e5b0)['then'](function(_0x2166b5){logger[_0x7fd2('0x1e')](_0x7fd2('0x1f'),_0x16e111,_0x41e5b0[_0x7fd2('0x1a')]);})[_0x7fd2('0x20')](function(_0x50aae8){logger[_0x7fd2('0x21')](_0x7fd2('0x1f'),_0x16e111,JSON[_0x7fd2('0x22')](_0x50aae8));})['finally'](function(){logger[_0x7fd2('0x1e')](_0x7fd2('0x23'),_0x16e111);_0x468c2a['stop']();});}else{logger['info'](_0x7fd2('0x24'),_0x16e111);_0x468c2a[_0x7fd2('0x25')]();}}else{var _0x626067=this;var _0x4b13ba=new AWS[(_0x7fd2('0x26'))]({'accessKeyId':_0x22ccde[0x0],'secretAccessKey':_0x22ccde[0x1],'region':_0x22ccde[0x2]});var _0xa21a27={'botAlias':_0x7fd2('0x27'),'botName':_0x22ccde[0x3],'inputText':this['message'][_0x7fd2('0x1a')],'userId':this[_0x7fd2('0x11')]+':'+this[_0x7fd2('0xa')]['id'][_0x7fd2('0x28')]()};_0x4b13ba['postText'](_0xa21a27,function(_0x360ffa,_0x3590de){if(_0x360ffa){logger[_0x7fd2('0x21')]('[%s][AMAZONLEX]\x20%s',_0x16e111,_0x360ffa[_0x7fd2('0x29')]);_0x468c2a[_0x7fd2('0xd')]();}else if(_0x3590de&&_0x3590de['message']){_0x626067['body'][_0x7fd2('0x2a')]=_0x3590de;_0x41e5b0['body']=_0x3590de[_0x7fd2('0x29')];_0x41e5b0['providerName']='amazonlex';_0x41e5b0['providerResponse']=JSON[_0x7fd2('0x22')](_0x3590de);return rpc[_0xee614+_0x7fd2('0x1c')][_0x7fd2('0x1d')](_0x41e5b0)[_0x7fd2('0x2b')](function(_0x48ccc0){logger['info'](_0x7fd2('0x1f'),_0x16e111,_0x41e5b0[_0x7fd2('0x1a')]);if(_0x3590de[_0x7fd2('0x2c')]=='Failed'){_0x468c2a['next']();}else{_0x468c2a['stop']();}})[_0x7fd2('0x20')](function(_0x2c66e2){logger[_0x7fd2('0x21')](_0x7fd2('0x1f'),_0x16e111,JSON[_0x7fd2('0x22')](_0x2c66e2));_0x468c2a[_0x7fd2('0xd')]();});}else{_0x468c2a[_0x7fd2('0xd')]();}});}}catch(_0x1fb1a0){logger[_0x7fd2('0x21')](_0x7fd2('0x1f'),_0x16e111,JSON[_0x7fd2('0x22')](_0x1fb1a0));_0x468c2a[_0x7fd2('0x25')]();}};}; \ 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 5d362ee..443f159 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 _0x4af8=['One\x20Time\x20already\x20sent','contact','format','out','message','from','mail','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','upperFirst','account','Message','messageId','html','','replace','','headers','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','create','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0xb3eafc,_0x2e0913){var _0x206f07=function(_0x395b5e){while(--_0x395b5e){_0xb3eafc['push'](_0xb3eafc['shift']());}};_0x206f07(++_0x2e0913);}(_0x4af8,0x123));var _0x84af=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x4af8[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x84af('0x0'));var moment=require(_0x84af('0x1'));var utils=require('./utils');var logger=require(_0x84af('0x2'))(_0x84af('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x84af('0x4')),'mailMessage':require(_0x84af('0x5')),'smsMessage':require(_0x84af('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x84af('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x84af('0x8')),'mailInteraction':require(_0x84af('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x84af('0xa')),'whatsappInteraction':require(_0x84af('0xb'))};var mailRpc=require(_0x84af('0xc'));exports[_0x84af('0xd')]=function(_0x1004df,_0x4867c9,_0x2c9ec8,_0x25aedf){return function(_0x2f1f84){try{var _0x20224c=this[_0x84af('0xe')];if(_0x20224c==='mail'&&_0x25aedf[_0x84af('0xf')]['isAutoreply']){logger[_0x84af('0x10')](_0x84af('0x11'),_0x1004df,_0x84af('0x12'));return _0x2f1f84[_0x84af('0x13')]();}if(_0x4867c9[0x0]==='1'&&(_['isNil'](this[_0x84af('0x14')]['created'])||!this[_0x84af('0x14')][_0x84af('0x15')])){logger[_0x84af('0x10')](_0x84af('0x11'),_0x1004df,_0x84af('0x16'));return _0x2f1f84[_0x84af('0x13')]();}if(_0x4867c9[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x84af('0x10')](_0x84af('0x17'),_0x1004df,_0x84af('0x18'));return _0x2f1f84[_0x84af('0x13')]();}var _0x2f730a={'ContactId':this[_0x84af('0x19')]['id'],'sentAt':moment()[_0x84af('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x84af('0x1b')};if(this['channel']==='mail'){_0x2f730a[_0x84af('0xf')]=utils['getMustacheRender'](_0x4867c9[0x2],this);}else{_0x2f730a[_0x84af('0xf')]=utils['getMustacheRender'](_0x4867c9[0x1],this);}if(this[_0x84af('0x1c')]){_0x2f730a['to']=this[_0x84af('0x1c')][_0x84af('0x1d')]||'';if(this[_0x84af('0xe')]===_0x84af('0x1e')&&_0x4867c9[0x1]==='1'){_0x2f730a['cc']=this['message']['cc']||'';}_0x2f730a[_0x84af('0x1d')]=this[_0x84af('0x1c')]['to']||'';_0x2f730a[_0x84af('0x1f')]=this['message'][_0x84af('0x1f')]||'';_0x2f730a[_0x84af('0x20')]=!![];if(this[_0x84af('0x1c')][_0x84af('0x21')]){_0x2f730a[_0x84af('0x21')]='';_0x2f730a[_0x84af('0x21')]+=_['startsWith'](this[_0x84af('0x1c')][_0x84af('0x21')],_0x84af('0x22'))?'':_0x84af('0x23');_0x2f730a['subject']+=this['message']['subject'];}}if(this['channel']==='chat'){_0x2f730a[_0x84af('0x24')]=this['account']['id'];}else{_0x2f730a[_[_0x84af('0x25')](this['channel'])+'AccountId']=this[_0x84af('0x26')]['id'];}_0x2f730a[_[_0x84af('0x25')](this[_0x84af('0xe')])+'InteractionId']=this[_0x84af('0x14')]['id'];var _0x31e64e=this[_0x84af('0x14')];if(rpc[this[_0x84af('0xe')]+_0x84af('0x27')]){if(this[_0x84af('0xe')]===_0x84af('0x1e')){_0x2f730a['inReplyTo']=this[_0x84af('0x1c')][_0x84af('0x28')];_0x2f730a[_0x84af('0x29')]=_0x84af('0x2a')+_[_0x84af('0x2b')](_0x2f730a['body'],_0x84af('0x2c'),_0x84af('0x2d'))+_0x84af('0x2e');_0x2f730a[_0x84af('0x2f')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x84af('0x30'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this['account']['smtpOptions'],_0x2f730a)['then'](function(_0x3496ec){logger[_0x84af('0x10')](_0x84af('0x31'),_0x1004df);_0x2f730a[_0x84af('0x28')]=_0x3496ec['message'][_0x84af('0x28')];return rpc[_0x20224c+_0x84af('0x27')]['create'](_0x2f730a);})[_0x84af('0x32')](function(_0x1f5bea){logger[_0x84af('0x10')]('[%s][AUTOREPLY]\x20%s',_0x1004df,JSON[_0x84af('0x33')](_0x1f5bea));})[_0x84af('0x34')](function(_0x3cc2c4){logger[_0x84af('0x35')](_0x84af('0x36'),_0x1004df,JSON['stringify'](_0x3cc2c4));})[_0x84af('0x37')](function(){Promise[_0x84af('0x38')]()['then'](function(){if(_0x4867c9[0x0]!=='2'||_0x31e64e[_0x84af('0x39')])return;return rpc[_0x20224c+_0x84af('0x3a')]['update'](_0x31e64e['id'],{'autoreplyExecuted':!![]})[_0x84af('0x32')](function(_0x1a8cbd){logger[_0x84af('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1004df,JSON[_0x84af('0x33')](_0x1a8cbd));})[_0x84af('0x34')](function(_0x16c2bc){logger[_0x84af('0x35')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1004df,JSON['stringify'](_0x16c2bc));});})['then'](function(){_0x2f1f84[_0x84af('0x13')]();});});}else{return rpc[this[_0x84af('0xe')]+'Message'][_0x84af('0x3b')](_0x2f730a)[_0x84af('0x32')](function(){logger[_0x84af('0x10')](_0x84af('0x11'),_0x1004df,_0x2f730a[_0x84af('0xf')]);})[_0x84af('0x34')](function(_0x3daac6){logger[_0x84af('0x35')](_0x84af('0x11'),_0x1004df,JSON[_0x84af('0x33')](_0x3daac6));})['finally'](function(){Promise[_0x84af('0x38')]()['then'](function(){if(_0x4867c9[0x0]!=='2'||_0x31e64e[_0x84af('0x39')])return;return rpc[_0x20224c+_0x84af('0x3a')][_0x84af('0x3c')](_0x31e64e['id'],{'autoreplyExecuted':!![]})[_0x84af('0x32')](function(_0x37028c){logger[_0x84af('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1004df,JSON['stringify'](_0x37028c));})[_0x84af('0x34')](function(_0x41284a){logger['error'](_0x84af('0x3d'),_0x1004df,JSON[_0x84af('0x33')](_0x41284a));});})['then'](function(){_0x2f1f84[_0x84af('0x13')]();});});}}}catch(_0x20767d){logger[_0x84af('0x35')](_0x84af('0x11'),_0x1004df,JSON[_0x84af('0x33')](_0x20767d));_0x2f1f84[_0x84af('0x3e')]();}};}; \ No newline at end of file +var _0xa400=['startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','','replace','';_0x5ebd60[_0x0a40('0x2d')]={'Auto-Submitted':_0x0a40('0x2e'),'X-Auto-Response-Suppress':_0x0a40('0x2f'),'Precedence':_0x0a40('0x30')};return mailRpc[_0x0a40('0x31')](this['account'][_0x0a40('0x32')],_0x5ebd60)[_0x0a40('0x33')](function(_0x396694){logger['info'](_0x0a40('0x34'),_0x4be5fd);_0x5ebd60['messageId']=_0x396694['message']['messageId'];return rpc[_0x123734+'Message'][_0x0a40('0x35')](_0x5ebd60);})[_0x0a40('0x33')](function(_0x372b46){logger[_0x0a40('0x10')](_0x0a40('0x11'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x372b46));})[_0x0a40('0x37')](function(_0x250496){logger[_0x0a40('0x38')](_0x0a40('0x39'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x250496));})[_0x0a40('0x3a')](function(){Promise[_0x0a40('0x3b')]()[_0x0a40('0x33')](function(){if(_0x1ffed4[0x0]!=='2'||_0x2d9157[_0x0a40('0x3c')])return;return rpc[_0x123734+_0x0a40('0x3d')][_0x0a40('0x3e')](_0x2d9157['id'],{'autoreplyExecuted':!![]})[_0x0a40('0x33')](function(_0x68fdfa){logger['info'](_0x0a40('0x3f'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x68fdfa));})[_0x0a40('0x37')](function(_0x35b609){logger[_0x0a40('0x38')](_0x0a40('0x40'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x35b609));});})[_0x0a40('0x33')](function(){_0x10a34d[_0x0a40('0x16')]();});});}else{return rpc[this['channel']+_0x0a40('0x27')][_0x0a40('0x35')](_0x5ebd60)[_0x0a40('0x33')](function(){logger[_0x0a40('0x10')](_0x0a40('0x11'),_0x4be5fd,_0x5ebd60[_0x0a40('0xe')]);})[_0x0a40('0x37')](function(_0x2a8e28){logger[_0x0a40('0x38')]('[%s][AUTOREPLY]\x20%s',_0x4be5fd,JSON[_0x0a40('0x36')](_0x2a8e28));})['finally'](function(){Promise['resolve']()['then'](function(){if(_0x1ffed4[0x0]!=='2'||_0x2d9157[_0x0a40('0x3c')])return;return rpc[_0x123734+_0x0a40('0x3d')]['update'](_0x2d9157['id'],{'autoreplyExecuted':!![]})[_0x0a40('0x33')](function(_0x467b52){logger[_0x0a40('0x10')](_0x0a40('0x3f'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x467b52));})['catch'](function(_0x2857ab){logger['error'](_0x0a40('0x40'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x2857ab));});})[_0x0a40('0x33')](function(){_0x10a34d[_0x0a40('0x16')]();});});}}}catch(_0x504b5b){logger['error'](_0x0a40('0x11'),_0x4be5fd,JSON[_0x0a40('0x36')](_0x504b5b));_0x10a34d[_0x0a40('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 0f4c9ab..74b60c3 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f5b=['stop','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify'];(function(_0x1e70a7,_0x56d8fd){var _0x12c0a9=function(_0xa2f66a){while(--_0xa2f66a){_0x1e70a7['push'](_0x1e70a7['shift']());}};_0x12c0a9(++_0x56d8fd);}(_0x5f5b,0x7f));var _0xb5f5=function(_0x1448cd,_0x5ac472){_0x1448cd=_0x1448cd-0x0;var _0x24abbe=_0x5f5b[_0x1448cd];return _0x24abbe;};'use strict';var moment=require('moment');var logger=require(_0xb5f5('0x0'))('routing');var rpc={'chatInteraction':require(_0xb5f5('0x1')),'openchannelInteraction':require(_0xb5f5('0x2')),'smsInteraction':require(_0xb5f5('0x3')),'mailInteraction':require(_0xb5f5('0x4')),'faxInteraction':require(_0xb5f5('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xb5f5('0x6')]=function(_0x403db8,_0x1b4d5e,_0x435696,_0x1752fc){return function(_0x581e14){try{logger[_0xb5f5('0x7')](_0xb5f5('0x8'),_0x403db8,_0x1b4d5e[0x0]);var _0x56f49a={'closed':0x1,'closedAt':moment()[_0xb5f5('0x9')](_0xb5f5('0xa')),'closeReason':_0xb5f5('0xb'),'disposition':_0x1b4d5e[0x0]};if(rpc[_0x1752fc[_0xb5f5('0xc')]+_0xb5f5('0xd')]){rpc[_0x1752fc[_0xb5f5('0xc')]+'Interaction'][_0xb5f5('0xe')](_0x1752fc[_0xb5f5('0xf')]['id'],_0x56f49a)['then'](function(_0x46d667){logger['info'](_0xb5f5('0x10'),_0x403db8,_0x1752fc[_0xb5f5('0xf')]['id']);})[_0xb5f5('0x11')](function(_0x5d33f2){logger[_0xb5f5('0x12')]('[%s][CLOSE]\x20%s',_0x403db8,JSON[_0xb5f5('0x13')](_0x5d33f2));})['finally'](function(){_0x581e14['stop']();});}}catch(_0xb051f2){logger[_0xb5f5('0x12')]('[%s][CLOSE]\x20%s',_0x403db8,JSON[_0xb5f5('0x13')](_0xb051f2));_0x581e14[_0xb5f5('0x14')]();}};}; \ No newline at end of file +var _0x3d48=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x3d48,0x106));var _0x83d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3d48[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x83d4('0x0'));var logger=require(_0x83d4('0x1'))(_0x83d4('0x2'));var rpc={'chatInteraction':require(_0x83d4('0x3')),'openchannelInteraction':require(_0x83d4('0x4')),'smsInteraction':require(_0x83d4('0x5')),'mailInteraction':require(_0x83d4('0x6')),'faxInteraction':require(_0x83d4('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x2961b5,_0x120926,_0xcc3f5d,_0x448707){return function(_0x40d510){try{logger[_0x83d4('0x8')](_0x83d4('0x9'),_0x2961b5,_0x120926[0x0]);var _0x12f7d7={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x120926[0x0]};if(rpc[_0x448707[_0x83d4('0xa')]+'Interaction']){rpc[_0x448707[_0x83d4('0xa')]+_0x83d4('0xb')][_0x83d4('0xc')](_0x448707[_0x83d4('0xd')]['id'],_0x12f7d7)[_0x83d4('0xe')](function(_0x4b991e){logger[_0x83d4('0x8')](_0x83d4('0xf'),_0x2961b5,_0x448707[_0x83d4('0xd')]['id']);})[_0x83d4('0x10')](function(_0x27a7f3){logger[_0x83d4('0x11')](_0x83d4('0x12'),_0x2961b5,JSON[_0x83d4('0x13')](_0x27a7f3));})[_0x83d4('0x14')](function(){_0x40d510['stop']();});}}catch(_0x21a912){logger['error'](_0x83d4('0x12'),_0x2961b5,JSON['stringify'](_0x21a912));_0x40d510[_0x83d4('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index ee47a81..c04bb7d 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6c0=['lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','then','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','result','fulfillment','speech','providerName','dialogflow','providerResponse','create','metadata','endConversation','message'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xc6c0[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x0c6c('0x0'));var moment=require('moment');var apiai=require(_0x0c6c('0x1'));var md5=require(_0x0c6c('0x2'));var utils=require(_0x0c6c('0x3'));var logger=require(_0x0c6c('0x4'))(_0x0c6c('0x5'));var rpc={'chatMessage':require(_0x0c6c('0x6')),'openchannelMessage':require(_0x0c6c('0x7')),'mailMessage':require(_0x0c6c('0x8')),'smsMessage':require(_0x0c6c('0x9')),'faxMessage':require(_0x0c6c('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1791cb,_0x223b4f){return function(_0x51208d){try{if(!_[_0x0c6c('0xb')](this[_0x0c6c('0xc')][_0x0c6c('0xd')])){logger[_0x0c6c('0xe')](_0x0c6c('0xf'),_0x1791cb,_0x0c6c('0x10'));return _0x51208d[_0x0c6c('0x11')]();}var _0x4286b0={'ContactId':this[_0x0c6c('0x12')]['id'],'sentAt':moment()[_0x0c6c('0x13')](_0x0c6c('0x14')),'direction':_0x0c6c('0x15')};if(this['channel']===_0x0c6c('0x16')||this['channel']===_0x0c6c('0x17')){_0x4286b0[_0x0c6c('0x18')]=this['interaction'][_0x0c6c('0x18')];}var _0x435892=this[_0x0c6c('0x19')];if(_0x435892===_0x0c6c('0x1a')){_0x4286b0[_0x0c6c('0x1b')]=this['account']['id'];}else{_0x4286b0[_[_0x0c6c('0x1c')](_0x435892)+_0x0c6c('0x1d')]=this[_0x0c6c('0x1e')]['id'];}_0x4286b0[_[_0x0c6c('0x1c')](_0x435892)+_0x0c6c('0x1f')]=this[_0x0c6c('0xc')]['id'];if(this[_0x0c6c('0xc')]['created']){var _0x2d635c=_0x223b4f[0x2];if(!_['isEmpty'](_0x2d635c)){_0x4286b0['body']=utils['getMustacheRender'](_0x2d635c,this);return rpc[_0x435892+_0x0c6c('0x20')]['create'](_0x4286b0)[_0x0c6c('0x21')](function(_0x50be43){logger[_0x0c6c('0xe')](_0x0c6c('0xf'),_0x1791cb,_0x4286b0[_0x0c6c('0x22')]);})[_0x0c6c('0x23')](function(_0x4ff711){logger[_0x0c6c('0x24')](_0x0c6c('0xf'),_0x1791cb,JSON[_0x0c6c('0x25')](_0x4ff711));})[_0x0c6c('0x26')](function(){logger[_0x0c6c('0xe')](_0x0c6c('0x27'),_0x1791cb);_0x51208d[_0x0c6c('0x28')]();});}else{logger[_0x0c6c('0xe')](_0x0c6c('0x29'),_0x1791cb);_0x51208d['stop']();}}else{var _0x323854=this;var _0xc33069=apiai(_0x223b4f[0x0],{'language':_0x223b4f[0x1]||'en'});return _0xc33069[_0x0c6c('0x2a')](this['message'][_0x0c6c('0x22')],{'sessionId':md5(this['interaction']['id'])})[_0x0c6c('0x21')](function(_0x35f4ad){_0x323854[_0x0c6c('0x22')]['dialogflow']=_0x35f4ad;_0x4286b0[_0x0c6c('0x22')]=_0x35f4ad[_0x0c6c('0x2b')][_0x0c6c('0x2c')][_0x0c6c('0x2d')];_0x4286b0[_0x0c6c('0x2e')]=_0x0c6c('0x2f');_0x4286b0[_0x0c6c('0x30')]=JSON[_0x0c6c('0x25')](_0x35f4ad);return rpc[_0x435892+_0x0c6c('0x20')][_0x0c6c('0x31')](_0x4286b0)['then'](function(_0x194b59){logger['info'](_0x0c6c('0xf'),_0x1791cb,_0x4286b0['body']);if(_0x35f4ad[_0x0c6c('0x2b')][_0x0c6c('0x32')][_0x0c6c('0x33')]){_0x51208d[_0x0c6c('0x11')]();}else{_0x51208d[_0x0c6c('0x28')]();}})[_0x0c6c('0x23')](function(_0x2047ab){logger[_0x0c6c('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x1791cb,JSON[_0x0c6c('0x25')](_0x2047ab));_0x51208d[_0x0c6c('0x11')]();});})['catch'](function(_0x40d708){logger['error'](_0x0c6c('0xf'),_0x1791cb,_0x40d708[_0x0c6c('0x34')]);_0x51208d[_0x0c6c('0x11')]();});}}catch(_0xb2a3a2){logger[_0x0c6c('0x24')](_0x0c6c('0xf'),_0x1791cb,JSON[_0x0c6c('0x25')](_0xb2a3a2));_0x51208d[_0x0c6c('0x28')]();}};}; \ No newline at end of file +var _0x9d5c=['error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','dialogflow','result','fulfillment','speech','providerResponse','Message','metadata','endConversation','next','catch','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','body'];(function(_0x320689,_0x33823b){var _0x3b1a32=function(_0x2db06d){while(--_0x2db06d){_0x320689['push'](_0x320689['shift']());}};_0x3b1a32(++_0x33823b);}(_0x9d5c,0x98));var _0xc9d5=function(_0xba81b4,_0x3f3f6c){_0xba81b4=_0xba81b4-0x0;var _0x4deabd=_0x9d5c[_0xba81b4];return _0x4deabd;};'use strict';var _=require(_0xc9d5('0x0'));var moment=require('moment');var apiai=require(_0xc9d5('0x1'));var md5=require(_0xc9d5('0x2'));var utils=require('./utils');var logger=require(_0xc9d5('0x3'))(_0xc9d5('0x4'));var rpc={'chatMessage':require(_0xc9d5('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc9d5('0x6')),'smsMessage':require(_0xc9d5('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc9d5('0x8'))};exports[_0xc9d5('0x9')]=function(_0x1a91f5,_0x955d2d){return function(_0x2edfbc){try{if(!_[_0xc9d5('0xa')](this[_0xc9d5('0xb')][_0xc9d5('0xc')])){logger[_0xc9d5('0xd')](_0xc9d5('0xe'),_0x1a91f5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2edfbc['next']();}var _0x53816b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc9d5('0xf')](_0xc9d5('0x10')),'direction':_0xc9d5('0x11')};if(this[_0xc9d5('0x12')]===_0xc9d5('0x13')||this[_0xc9d5('0x12')]===_0xc9d5('0x14')){_0x53816b['phone']=this['interaction']['phone'];}var _0x2c40c2=this[_0xc9d5('0x12')];if(_0x2c40c2===_0xc9d5('0x15')){_0x53816b[_0xc9d5('0x16')]=this['account']['id'];}else{_0x53816b[_[_0xc9d5('0x17')](_0x2c40c2)+_0xc9d5('0x18')]=this['account']['id'];}_0x53816b[_[_0xc9d5('0x17')](_0x2c40c2)+_0xc9d5('0x19')]=this['interaction']['id'];if(this['interaction'][_0xc9d5('0x1a')]){var _0x7d5471=_0x955d2d[0x2];if(!_[_0xc9d5('0x1b')](_0x7d5471)){_0x53816b['body']=utils[_0xc9d5('0x1c')](_0x7d5471,this);return rpc[_0x2c40c2+'Message'][_0xc9d5('0x1d')](_0x53816b)[_0xc9d5('0x1e')](function(_0x3105d2){logger[_0xc9d5('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x1a91f5,_0x53816b[_0xc9d5('0x1f')]);})['catch'](function(_0x4431d2){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x4431d2));})['finally'](function(){logger[_0xc9d5('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1a91f5);_0x2edfbc['stop']();});}else{logger[_0xc9d5('0xd')](_0xc9d5('0x22'),_0x1a91f5);_0x2edfbc[_0xc9d5('0x23')]();}}else{var _0x7ce117=this;var _0x1447c9=apiai(_0x955d2d[0x0],{'language':_0x955d2d[0x1]||'en'});return _0x1447c9['textRequest'](this['message'][_0xc9d5('0x1f')],{'sessionId':md5(this[_0xc9d5('0xb')]['id'])})[_0xc9d5('0x1e')](function(_0x1424c9){_0x7ce117[_0xc9d5('0x1f')][_0xc9d5('0x24')]=_0x1424c9;_0x53816b[_0xc9d5('0x1f')]=_0x1424c9[_0xc9d5('0x25')][_0xc9d5('0x26')][_0xc9d5('0x27')];_0x53816b['providerName']=_0xc9d5('0x24');_0x53816b[_0xc9d5('0x28')]=JSON[_0xc9d5('0x21')](_0x1424c9);return rpc[_0x2c40c2+_0xc9d5('0x29')][_0xc9d5('0x1d')](_0x53816b)[_0xc9d5('0x1e')](function(_0x41a5d7){logger['info'](_0xc9d5('0xe'),_0x1a91f5,_0x53816b[_0xc9d5('0x1f')]);if(_0x1424c9['result'][_0xc9d5('0x2a')][_0xc9d5('0x2b')]){_0x2edfbc[_0xc9d5('0x2c')]();}else{_0x2edfbc[_0xc9d5('0x23')]();}})[_0xc9d5('0x2d')](function(_0x3ab4bc){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x3ab4bc));_0x2edfbc['next']();});})[_0xc9d5('0x2d')](function(_0x41d217){logger[_0xc9d5('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x1a91f5,_0x41d217['message']);_0x2edfbc['next']();});}}catch(_0x58991f){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x58991f));_0x2edfbc[_0xc9d5('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 6fda079..7dd6946 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb763=['DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','moment','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','name','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0xb763,0x155));var _0x3b76=function(_0x143e8a,_0x4baff2){_0x143e8a=_0x143e8a-0x0;var _0x579078=_0xb763[_0x143e8a];return _0x579078;};'use strict';var _=require(_0x3b76('0x0'));var dialogflow=require(_0x3b76('0x1'));var md5=require(_0x3b76('0x2'));var moment=require(_0x3b76('0x3'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x3b76('0x4'));var utils=require(_0x3b76('0x5'));var rpc={'chatMessage':require(_0x3b76('0x6')),'openchannelMessage':require(_0x3b76('0x7')),'mailMessage':require(_0x3b76('0x8')),'smsMessage':require(_0x3b76('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x4a0428,_0x81f08f,_0xe60f92,_0x4b7b35){return new Promise(function(_0x1c66bd,_0x26c6ef){var _0x2e611a=_[_0x3b76('0xa')](_0xe60f92);_0x2e611a[_0x3b76('0xb')]=_0x4b7b35;return rpc[_0x81f08f+_0x3b76('0xc')][_0x3b76('0xd')](_0x2e611a)['then'](function(){logger[_0x3b76('0xe')](_0x3b76('0xf'),_0x4a0428,_0x2e611a[_0x3b76('0xb')]);_0x1c66bd();})[_0x3b76('0x10')](function(_0x1ba342){logger[_0x3b76('0x11')](_0x3b76('0xf'),_0x4a0428,JSON[_0x3b76('0x12')](_0x1ba342));_0x26c6ef(_0x1ba342);});});}exports[_0x3b76('0x13')]=function(_0x5e5aef,_0x3604aa){return function(_0x3aafb4){try{if(!_[_0x3b76('0x14')](this[_0x3b76('0x15')]['UserId'])){logger[_0x3b76('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x5e5aef,_0x3b76('0x16'));return _0x3aafb4[_0x3b76('0x17')]();}var _0x148c9a={'ContactId':this[_0x3b76('0x18')]['id'],'sentAt':moment()['format'](_0x3b76('0x19')),'direction':'out'};if(this[_0x3b76('0x1a')]===_0x3b76('0x1b')||this[_0x3b76('0x1a')]==='whatsapp'){_0x148c9a[_0x3b76('0x1c')]=this[_0x3b76('0x15')][_0x3b76('0x1c')];}var _0x35d161=this[_0x3b76('0x1a')];if(_0x35d161===_0x3b76('0x1d')){_0x148c9a[_0x3b76('0x1e')]=this['account']['id'];}else{_0x148c9a[_['upperFirst'](_0x35d161)+'AccountId']=this[_0x3b76('0x1f')]['id'];}_0x148c9a[_[_0x3b76('0x20')](_0x35d161)+_0x3b76('0x21')]=this['interaction']['id'];if(this[_0x3b76('0x15')][_0x3b76('0x22')]){var _0x4a5ec8=_0x3604aa[0x4];if(!_[_0x3b76('0x23')](_0x4a5ec8)){_0x148c9a['body']=utils['getMustacheRender'](_0x4a5ec8,this);return rpc[_0x35d161+_0x3b76('0xc')][_0x3b76('0xd')](_0x148c9a)[_0x3b76('0x24')](function(_0x870f4){logger[_0x3b76('0xe')](_0x3b76('0xf'),_0x5e5aef,_0x148c9a[_0x3b76('0xb')]);})[_0x3b76('0x10')](function(_0x4aa801){logger[_0x3b76('0x11')](_0x3b76('0xf'),_0x5e5aef,JSON[_0x3b76('0x12')](_0x4aa801));})[_0x3b76('0x25')](function(){logger[_0x3b76('0xe')](_0x3b76('0x26'),_0x5e5aef);_0x3aafb4[_0x3b76('0x27')]();});}else{logger[_0x3b76('0xe')](_0x3b76('0x28'),_0x5e5aef);_0x3aafb4[_0x3b76('0x27')]();}}else{var _0x2c11b9=this;var _0x1acde4=_0x3604aa[0x2][_0x3b76('0x29')](/\\n/g,'\x0a');var _0x1f3d46={'credentials':{'private_key':_0x1acde4,'client_email':_0x3604aa[0x1]}};var _0xa17044=new dialogflow[(_0x3b76('0x2a'))](_0x1f3d46);var _0x4a5efa=_0xa17044[_0x3b76('0x2b')](_0x3604aa[0x0],md5(_0x2c11b9['interaction']['id']));var _0x132f72={'session':_0x4a5efa,'queryInput':{'text':{'text':_0x2c11b9[_0x3b76('0x2c')][_0x3b76('0xb')],'languageCode':_0x3604aa[0x3]||'en'}}};return _0xa17044['detectIntent'](_0x132f72)[_0x3b76('0x24')](function(_0x129794){if(_0x129794&&_0x129794[_0x3b76('0x2d')]){_0x2c11b9[_0x3b76('0xb')]['dialogflowV2']=_0x129794;var _0xd80475=_0x129794[0x0];var _0x48cf15=_0xd80475[_0x3b76('0x2e')][_0x3b76('0x2f')]&&_0xd80475[_0x3b76('0x2e')][_0x3b76('0x2f')][_0x3b76('0x30')]?_0xd80475[_0x3b76('0x2e')]['diagnosticInfo'][_0x3b76('0x30')][_0x3b76('0x31')][_0x3b76('0x32')]:![];_0x2c11b9['body'][_0x3b76('0x33')]=_0xd80475[_0x3b76('0x2e')][_0x3b76('0x34')];_0x2c11b9[_0x3b76('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0xd80475[_0x3b76('0x2e')][_0x3b76('0x35')];_0x2c11b9[_0x3b76('0xb')][_0x3b76('0x36')]=_0xd80475['queryResult']['diagnosticInfo']&&_0xd80475[_0x3b76('0x2e')][_0x3b76('0x2f')][_0x3b76('0x30')]?_0xd80475['queryResult'][_0x3b76('0x2f')][_0x3b76('0x30')][_0x3b76('0x31')]['boolValue']:![];_0x2c11b9['body']['DIALOGFLOWV2_INTENTNAME']=_0xd80475[_0x3b76('0x2e')]['intent'][_0x3b76('0x37')];_0x2c11b9[_0x3b76('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0xd80475[_0x3b76('0x2e')]['intent']['displayName'];_0x2c11b9[_0x3b76('0xb')][_0x3b76('0x38')]=_0xd80475[_0x3b76('0x2e')]['intent'][_0x3b76('0x39')];_0x2c11b9[_0x3b76('0xb')][_0x3b76('0x3a')]=_0xd80475[_0x3b76('0x2e')]['languageCode'];_0x2c11b9['body'][_0x3b76('0x3b')]=_0xd80475[_0x3b76('0x2e')][_0x3b76('0x3c')];_0x2c11b9[_0x3b76('0xb')][_0x3b76('0x3d')]=_0xd80475[_0x3b76('0x2e')]['intentDetectionConfidence'];_0x148c9a[_0x3b76('0x3e')]='dialogflowV2';_0x148c9a[_0x3b76('0x3f')]=JSON[_0x3b76('0x12')](_0x129794);var _0x431b6e=[];for(var _0x1e3dd9=0x0;_0x1e3dd9<_0x129794['length'];_0x1e3dd9++){var _0x3d366c=_0x129794[_0x1e3dd9];if(_0x3d366c&&_0x3d366c[_0x3b76('0x2e')]&&_0x3d366c['queryResult'][_0x3b76('0x40')]){_0x431b6e[_0x3b76('0x41')](createMessage(_0x5e5aef,_0x35d161,_0x148c9a,_0x3d366c[_0x3b76('0x2e')][_0x3b76('0x40')]));}}return Promise[_0x3b76('0x42')](_0x431b6e)['then'](function(){if(_0x48cf15){_0x3aafb4[_0x3b76('0x17')]();}else{_0x3aafb4[_0x3b76('0x27')]();}})[_0x3b76('0x10')](function(_0x150cac){logger[_0x3b76('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x5e5aef,JSON[_0x3b76('0x12')](_0x150cac));_0x3aafb4[_0x3b76('0x17')]();});}})[_0x3b76('0x10')](function(_0xeecaa3){logger['error'](_0x3b76('0xf'),_0x5e5aef,_0xeecaa3[_0x3b76('0x2c')]);_0x3aafb4[_0x3b76('0x17')]();});}}catch(_0x35432c){logger[_0x3b76('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x5e5aef,JSON[_0x3b76('0x12')](_0x35432c));_0x3aafb4[_0x3b76('0x27')]();}};}; \ No newline at end of file +var _0x3572=['next','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','message','md5','moment','bluebird','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x24dcaf,_0x2a7481){var _0x14fb38=function(_0x88dabd){while(--_0x88dabd){_0x24dcaf['push'](_0x24dcaf['shift']());}};_0x14fb38(++_0x2a7481);}(_0x3572,0x15b));var _0x2357=function(_0x403722,_0x519475){_0x403722=_0x403722-0x0;var _0x244231=_0x3572[_0x403722];return _0x244231;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x2357('0x0'));var moment=require(_0x2357('0x1'));var Promise=require(_0x2357('0x2'));var logger=require('../../../../config/logger')(_0x2357('0x3'));var utils=require(_0x2357('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2357('0x5')),'mailMessage':require(_0x2357('0x6')),'smsMessage':require(_0x2357('0x7')),'faxMessage':require(_0x2357('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x14863d,_0x15b051,_0x15f239,_0x1e8071){return new Promise(function(_0x3208b,_0x2c0275){var _0x599f59=_[_0x2357('0x9')](_0x15f239);_0x599f59['body']=_0x1e8071;return rpc[_0x15b051+_0x2357('0xa')][_0x2357('0xb')](_0x599f59)[_0x2357('0xc')](function(){logger[_0x2357('0xd')](_0x2357('0xe'),_0x14863d,_0x599f59[_0x2357('0xf')]);_0x3208b();})[_0x2357('0x10')](function(_0x236ed9){logger[_0x2357('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x14863d,JSON[_0x2357('0x12')](_0x236ed9));_0x2c0275(_0x236ed9);});});}exports[_0x2357('0x13')]=function(_0x12582b,_0xe0ae56){return function(_0x498505){try{if(!_[_0x2357('0x14')](this['interaction'][_0x2357('0x15')])){logger[_0x2357('0xd')](_0x2357('0xe'),_0x12582b,_0x2357('0x16'));return _0x498505[_0x2357('0x17')]();}var _0x5d6cf4={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x2357('0x18')),'direction':_0x2357('0x19')};if(this['channel']===_0x2357('0x1a')||this[_0x2357('0x1b')]===_0x2357('0x1c')){_0x5d6cf4[_0x2357('0x1d')]=this[_0x2357('0x1e')][_0x2357('0x1d')];}var _0x456abf=this[_0x2357('0x1b')];if(_0x456abf==='chat'){_0x5d6cf4[_0x2357('0x1f')]=this[_0x2357('0x20')]['id'];}else{_0x5d6cf4[_[_0x2357('0x21')](_0x456abf)+_0x2357('0x22')]=this[_0x2357('0x20')]['id'];}_0x5d6cf4[_['upperFirst'](_0x456abf)+_0x2357('0x23')]=this[_0x2357('0x1e')]['id'];if(this['interaction'][_0x2357('0x24')]){var _0x57c839=_0xe0ae56[0x4];if(!_[_0x2357('0x25')](_0x57c839)){_0x5d6cf4['body']=utils[_0x2357('0x26')](_0x57c839,this);return rpc[_0x456abf+_0x2357('0xa')][_0x2357('0xb')](_0x5d6cf4)[_0x2357('0xc')](function(_0x4a0627){logger[_0x2357('0xd')](_0x2357('0xe'),_0x12582b,_0x5d6cf4[_0x2357('0xf')]);})[_0x2357('0x10')](function(_0x4e2da8){logger[_0x2357('0x11')](_0x2357('0xe'),_0x12582b,JSON['stringify'](_0x4e2da8));})[_0x2357('0x27')](function(){logger[_0x2357('0xd')](_0x2357('0x28'),_0x12582b);_0x498505[_0x2357('0x29')]();});}else{logger[_0x2357('0xd')](_0x2357('0x2a'),_0x12582b);_0x498505[_0x2357('0x29')]();}}else{var _0x477975=this;var _0x5ee83c=_0xe0ae56[0x2][_0x2357('0x2b')](/\\n/g,'\x0a');var _0x2b81d2={'credentials':{'private_key':_0x5ee83c,'client_email':_0xe0ae56[0x1]}};var _0x8298aa=new dialogflow[(_0x2357('0x2c'))](_0x2b81d2);var _0x2d0881=_0x8298aa[_0x2357('0x2d')](_0xe0ae56[0x0],md5(_0x477975['interaction']['id']));var _0x3dded5={'session':_0x2d0881,'queryInput':{'text':{'text':_0x477975['message']['body'],'languageCode':_0xe0ae56[0x3]||'en'}}};return _0x8298aa[_0x2357('0x2e')](_0x3dded5)[_0x2357('0xc')](function(_0x211ffe){if(_0x211ffe&&_0x211ffe['length']){_0x477975['body'][_0x2357('0x2f')]=_0x211ffe;var _0x2b5df8=_0x211ffe[0x0];var _0x2db319=_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')]&&_0x2b5df8[_0x2357('0x30')]['diagnosticInfo']['fields']?_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')][_0x2357('0x32')]['end_conversation'][_0x2357('0x33')]:![];_0x477975[_0x2357('0xf')][_0x2357('0x34')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x35')];_0x477975[_0x2357('0xf')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2b5df8[_0x2357('0x30')][_0x2357('0x36')];_0x477975[_0x2357('0xf')][_0x2357('0x37')]=_0x2b5df8[_0x2357('0x30')]['diagnosticInfo']&&_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')][_0x2357('0x32')]?_0x2b5df8[_0x2357('0x30')][_0x2357('0x31')]['fields'][_0x2357('0x38')][_0x2357('0x33')]:![];_0x477975[_0x2357('0xf')][_0x2357('0x39')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x3a')][_0x2357('0x3b')];_0x477975[_0x2357('0xf')][_0x2357('0x3c')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x3a')][_0x2357('0x3d')];_0x477975['body'][_0x2357('0x3e')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x3a')][_0x2357('0x3f')];_0x477975[_0x2357('0xf')][_0x2357('0x40')]=_0x2b5df8['queryResult']['languageCode'];_0x477975[_0x2357('0xf')][_0x2357('0x41')]=_0x2b5df8[_0x2357('0x30')][_0x2357('0x42')];_0x477975['body']['DIALOGFLOWV2_SCORE']=_0x2b5df8[_0x2357('0x30')][_0x2357('0x43')];_0x5d6cf4[_0x2357('0x44')]=_0x2357('0x2f');_0x5d6cf4[_0x2357('0x45')]=JSON[_0x2357('0x12')](_0x211ffe);var _0x55b22e=[];for(var _0x13487d=0x0;_0x13487d<_0x211ffe[_0x2357('0x46')];_0x13487d++){var _0x365981=_0x211ffe[_0x13487d];if(_0x365981&&_0x365981[_0x2357('0x30')]&&_0x365981[_0x2357('0x30')][_0x2357('0x47')]){_0x55b22e[_0x2357('0x48')](createMessage(_0x12582b,_0x456abf,_0x5d6cf4,_0x365981[_0x2357('0x30')][_0x2357('0x47')]));}}return Promise['all'](_0x55b22e)[_0x2357('0xc')](function(){if(_0x2db319){_0x498505[_0x2357('0x17')]();}else{_0x498505[_0x2357('0x29')]();}})[_0x2357('0x10')](function(_0x54ebfa){logger[_0x2357('0x11')](_0x2357('0xe'),_0x12582b,JSON['stringify'](_0x54ebfa));_0x498505[_0x2357('0x17')]();});}})[_0x2357('0x10')](function(_0x1e599e){logger[_0x2357('0x11')](_0x2357('0xe'),_0x12582b,_0x1e599e[_0x2357('0x49')]);_0x498505['next']();});}}catch(_0x456fb5){logger['error'](_0x2357('0xe'),_0x12582b,JSON[_0x2357('0x12')](_0x456fb5));_0x498505[_0x2357('0x29')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 685a420..748b46d 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b95=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','map','message','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x5b95,0x1f4));var _0x55b9=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x5b95[_0x68ee8b];return _0x5148f7;};'use strict';var schema=require(_0x55b9('0x0'));var _=require(_0x55b9('0x1'));var htmlToText=require(_0x55b9('0x2'));var utils=require(_0x55b9('0x3'));var logger=require(_0x55b9('0x4'))(_0x55b9('0x5'));var gotoif=schema({'condition':{'type':_0x55b9('0x6'),'required':!![],'message':_0x55b9('0x7')},'priorityTrue':{'type':_0x55b9('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x55b9('0x8'),'message':_0x55b9('0x9')}});exports[_0x55b9('0xa')]=function(_0x276cce,_0x127613){return function(_0x2e5dcf){try{var _0x306caa={'condition':htmlToText[_0x55b9('0xb')](utils[_0x55b9('0xc')](_0x127613[0x0],this),{'wordwrap':![]})[_0x55b9('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x127613[0x1],'priorityFalse':_0x127613[0x2]};var _0x28b0f5=gotoif['validate'](_0x306caa,{'typecast':!![]});if(_0x28b0f5[_0x55b9('0xe')]){logger['error']('[%s][GOTOIF]\x20%s',_0x276cce,_[_0x55b9('0xf')](_0x28b0f5,_0x55b9('0x10'))['join'](',\x20'));_0x2e5dcf[_0x55b9('0x11')]();}else{try{var _0x487b89=eval('('+_0x306caa['condition']+')');var _0x4e3f25=_0x487b89?_0x306caa[_0x55b9('0x12')]:_0x306caa[_0x55b9('0x13')];logger[_0x55b9('0x14')](_0x55b9('0x15'),_0x276cce,_0x306caa[_0x55b9('0x16')],_0x487b89,_0x4e3f25||_0x55b9('0x17'));if(_0x4e3f25){var _0x3fae74=_[_0x55b9('0x18')](_0x2e5dcf[_0x55b9('0x19')](),{'p':_0x4e3f25});if(_0x3fae74>=0x0){logger[_0x55b9('0x14')](_0x55b9('0x1a'),_0x276cce,_0x4e3f25||_0x55b9('0x17'),_0x3fae74);_0x2e5dcf['next'](_0x3fae74);}else{logger[_0x55b9('0x14')](_0x55b9('0x1b'),_0x276cce,_0x4e3f25||'next');_0x2e5dcf[_0x55b9('0x11')]();}}else{_0x2e5dcf[_0x55b9('0x17')]();}}catch(_0x1c5ec0){logger['error'](_0x55b9('0x1c'),_0x276cce,_0x1c5ec0[_0x55b9('0x10')]);_0x2e5dcf[_0x55b9('0x11')]();}}}catch(_0x2c1320){logger[_0x55b9('0x1d')]('[%s][GOTOIF]\x20%s',_0x276cce,JSON[_0x55b9('0x1e')](_0x2c1320));_0x2e5dcf[_0x55b9('0x11')]();}};}; \ No newline at end of file +var _0xe9db=['./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','error','map','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','info','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text'];(function(_0x3c32d6,_0x346f90){var _0x25c93c=function(_0x205f40){while(--_0x205f40){_0x3c32d6['push'](_0x3c32d6['shift']());}};_0x25c93c(++_0x346f90);}(_0xe9db,0x141));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xbe9d('0x0'));var _=require(_0xbe9d('0x1'));var htmlToText=require(_0xbe9d('0x2'));var utils=require(_0xbe9d('0x3'));var logger=require('../../../../config/logger')(_0xbe9d('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xbe9d('0x5')},'priorityTrue':{'type':_0xbe9d('0x6'),'message':_0xbe9d('0x7')},'priorityFalse':{'type':_0xbe9d('0x6'),'message':_0xbe9d('0x8')}});exports[_0xbe9d('0x9')]=function(_0x2ed9af,_0x16c8d3){return function(_0x21b117){try{var _0x509e07={'condition':htmlToText[_0xbe9d('0xa')](utils['getMustacheRender'](_0x16c8d3[0x0],this),{'wordwrap':![]})[_0xbe9d('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x16c8d3[0x1],'priorityFalse':_0x16c8d3[0x2]};var _0x9a5495=gotoif[_0xbe9d('0x0')](_0x509e07,{'typecast':!![]});if(_0x9a5495['length']){logger[_0xbe9d('0xc')]('[%s][GOTOIF]\x20%s',_0x2ed9af,_[_0xbe9d('0xd')](_0x9a5495,_0xbe9d('0xe'))[_0xbe9d('0xf')](',\x20'));_0x21b117[_0xbe9d('0x10')]();}else{try{var _0x5f3e40=eval('('+_0x509e07[_0xbe9d('0x11')]+')');var _0xa38f4=_0x5f3e40?_0x509e07[_0xbe9d('0x12')]:_0x509e07[_0xbe9d('0x13')];logger['info'](_0xbe9d('0x14'),_0x2ed9af,_0x509e07['condition'],_0x5f3e40,_0xa38f4||'next');if(_0xa38f4){var _0x372980=_[_0xbe9d('0x15')](_0x21b117['rules'](),{'p':_0xa38f4});if(_0x372980>=0x0){logger[_0xbe9d('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2ed9af,_0xa38f4||_0xbe9d('0x17'),_0x372980);_0x21b117[_0xbe9d('0x17')](_0x372980);}else{logger[_0xbe9d('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2ed9af,_0xa38f4||_0xbe9d('0x17'));_0x21b117['stop']();}}else{_0x21b117[_0xbe9d('0x17')]();}}catch(_0x466478){logger[_0xbe9d('0xc')](_0xbe9d('0x18'),_0x2ed9af,_0x466478[_0xbe9d('0xe')]);_0x21b117[_0xbe9d('0x10')]();}}}catch(_0x11a528){logger[_0xbe9d('0xc')](_0xbe9d('0x19'),_0x2ed9af,JSON[_0xbe9d('0x1a')](_0x11a528));_0x21b117[_0xbe9d('0x10')]();}};}; \ 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 67156f7..461fc6d 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 _0xa9c8=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','routing','number','consequence','length','error','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9c8,0x1f1));var _0x8a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c8[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x8a9c('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x8a9c('0x1'));var gotop=schema({'priority':{'type':_0x8a9c('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x8a9c('0x3')]=function(_0x52084e,_0x588824){return function(_0x470a2e){try{var _0x1b2424={'priority':_0x588824[0x0]};var _0x174bb7=gotop[_0x8a9c('0x0')](_0x1b2424,{'typecast':!![]});if(_0x174bb7[_0x8a9c('0x4')]){logger[_0x8a9c('0x5')]('[%s][GOTOP]\x20%s',_0x52084e,_[_0x8a9c('0x6')](_0x174bb7,_0x8a9c('0x7'))['join'](',\x20'));_0x470a2e[_0x8a9c('0x8')]();}else{logger[_0x8a9c('0x9')](_0x8a9c('0xa'),_0x52084e,_0x1b2424[_0x8a9c('0xb')]);if(_0x1b2424[_0x8a9c('0xb')]){var _0x271a0e=_[_0x8a9c('0xc')](_0x470a2e[_0x8a9c('0xd')](),{'p':_0x1b2424[_0x8a9c('0xb')]});if(_0x271a0e>=0x0){logger[_0x8a9c('0x9')](_0x8a9c('0xe'),_0x52084e,_0x1b2424['priority']||'next',_0x271a0e);_0x470a2e[_0x8a9c('0xf')](_0x271a0e);}else{logger[_0x8a9c('0x9')](_0x8a9c('0x10'),_0x52084e,_0x1b2424[_0x8a9c('0xb')]||_0x8a9c('0xf'));_0x470a2e[_0x8a9c('0x8')]();}}else{_0x470a2e[_0x8a9c('0xf')]();}}}catch(_0x1278e5){logger[_0x8a9c('0x5')](_0x8a9c('0x11'),_0x52084e,JSON[_0x8a9c('0x12')](_0x1278e5));_0x470a2e['stop']();}};}; \ No newline at end of file +var _0x844d=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x113d17,_0x1ebbdd){var _0x5576ab=function(_0x2257b7){while(--_0x2257b7){_0x113d17['push'](_0x113d17['shift']());}};_0x5576ab(++_0x1ebbdd);}(_0x844d,0xc0));var _0xd844=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x844d[_0x333767];return _0x51661b;};'use strict';var schema=require('validate');var _=require(_0xd844('0x0'));var logger=require(_0xd844('0x1'))(_0xd844('0x2'));var gotop=schema({'priority':{'type':_0xd844('0x3'),'required':!![],'message':_0xd844('0x4')}});exports[_0xd844('0x5')]=function(_0xa9cca3,_0x5a75fc){return function(_0x49f50f){try{var _0x5a5f9c={'priority':_0x5a75fc[0x0]};var _0x2913fd=gotop[_0xd844('0x6')](_0x5a5f9c,{'typecast':!![]});if(_0x2913fd[_0xd844('0x7')]){logger[_0xd844('0x8')]('[%s][GOTOP]\x20%s',_0xa9cca3,_[_0xd844('0x9')](_0x2913fd,_0xd844('0xa'))[_0xd844('0xb')](',\x20'));_0x49f50f[_0xd844('0xc')]();}else{logger[_0xd844('0xd')](_0xd844('0xe'),_0xa9cca3,_0x5a5f9c['priority']);if(_0x5a5f9c[_0xd844('0xf')]){var _0x55c03f=_[_0xd844('0x10')](_0x49f50f[_0xd844('0x11')](),{'p':_0x5a5f9c[_0xd844('0xf')]});if(_0x55c03f>=0x0){logger[_0xd844('0xd')](_0xd844('0x12'),_0xa9cca3,_0x5a5f9c[_0xd844('0xf')]||_0xd844('0x13'),_0x55c03f);_0x49f50f[_0xd844('0x13')](_0x55c03f);}else{logger[_0xd844('0xd')](_0xd844('0x14'),_0xa9cca3,_0x5a5f9c['priority']||_0xd844('0x13'));_0x49f50f[_0xd844('0xc')]();}}else{_0x49f50f['next']();}}}catch(_0x3b73da){logger[_0xd844('0x8')](_0xd844('0x15'),_0xa9cca3,JSON[_0xd844('0x16')](_0x3b73da));_0x49f50f[_0xd844('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 510a3d4..9d344a4 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 _0xbbfd=['getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','error','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x512d04,_0x5b518d){var _0x2747a1=function(_0x18be58){while(--_0x18be58){_0x512d04['push'](_0x512d04['shift']());}};_0x2747a1(++_0x5b518d);}(_0xbbfd,0x1df));var _0xdbbf=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xbbfd[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xdbbf('0x0'))(_0xdbbf('0x1'));var rpc={'chatMessage':require(_0xdbbf('0x2')),'openchannelMessage':require(_0xdbbf('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdbbf('0x4')),'whatsappMessage':require(_0xdbbf('0x5'))};exports[_0xdbbf('0x6')]=function(_0x74a1e9,_0x10b520){return function(_0x1c5758){try{var _0x3b91f5={'body':utils[_0xdbbf('0x7')](_0x10b520[0x0],this),'ContactId':this[_0xdbbf('0x8')]['id']};if(this[_0xdbbf('0x9')]===_0xdbbf('0xa')){_0x3b91f5[_0xdbbf('0xb')]=this[_0xdbbf('0xc')]['id'];}else{_0x3b91f5[_[_0xdbbf('0xd')](this[_0xdbbf('0x9')])+_0xdbbf('0xe')]=this[_0xdbbf('0xc')]['id'];}_0x3b91f5[_[_0xdbbf('0xd')](this['channel'])+_0xdbbf('0xf')]=this[_0xdbbf('0x10')]['id'];if(rpc[this[_0xdbbf('0x9')]+_0xdbbf('0x11')]){return rpc[this[_0xdbbf('0x9')]+'Message'][_0xdbbf('0x12')](_0x3b91f5)['then'](function(_0x25a0e7){logger[_0xdbbf('0x13')](_0xdbbf('0x14'),_0x74a1e9,_0x3b91f5[_0xdbbf('0x15')]);_0x1c5758[_0xdbbf('0x16')]();})[_0xdbbf('0x17')](function(_0x359613){logger['error'](_0xdbbf('0x14'),_0x74a1e9,JSON[_0xdbbf('0x18')](_0x359613));_0x1c5758['stop']();});}}catch(_0x390ea2){logger[_0xdbbf('0x19')](_0xdbbf('0x14'),_0x74a1e9,JSON['stringify'](_0x390ea2));_0x1c5758[_0xdbbf('0x1a')]();}};}; \ No newline at end of file +var _0xcd5e=['[%s][MESSAGE]\x20%s','stringify','stop','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','create','then','next','catch','error'];(function(_0x687ce7,_0x39db4f){var _0x8bb835=function(_0x1fe8f7){while(--_0x1fe8f7){_0x687ce7['push'](_0x687ce7['shift']());}};_0x8bb835(++_0x39db4f);}(_0xcd5e,0xb3));var _0xecd5=function(_0x12ef8b,_0x444084){_0x12ef8b=_0x12ef8b-0x0;var _0x16b255=_0xcd5e[_0x12ef8b];return _0x16b255;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xecd5('0x0')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xecd5('0x1')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xecd5('0x2')),'whatsappMessage':require(_0xecd5('0x3'))};exports[_0xecd5('0x4')]=function(_0x109e9e,_0x53a12b){return function(_0x3002a2){try{var _0x555904={'body':utils[_0xecd5('0x5')](_0x53a12b[0x0],this),'ContactId':this[_0xecd5('0x6')]['id']};if(this[_0xecd5('0x7')]===_0xecd5('0x8')){_0x555904[_0xecd5('0x9')]=this[_0xecd5('0xa')]['id'];}else{_0x555904[_['upperFirst'](this['channel'])+_0xecd5('0xb')]=this[_0xecd5('0xa')]['id'];}_0x555904[_[_0xecd5('0xc')](this[_0xecd5('0x7')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0xecd5('0xd')]){return rpc[this[_0xecd5('0x7')]+_0xecd5('0xd')][_0xecd5('0xe')](_0x555904)[_0xecd5('0xf')](function(_0x4784c2){logger['info']('[%s][MESSAGE]\x20%s',_0x109e9e,_0x555904['body']);_0x3002a2[_0xecd5('0x10')]();})[_0xecd5('0x11')](function(_0x397cc1){logger[_0xecd5('0x12')](_0xecd5('0x13'),_0x109e9e,JSON[_0xecd5('0x14')](_0x397cc1));_0x3002a2[_0xecd5('0x15')]();});}}catch(_0x3dc588){logger[_0xecd5('0x12')](_0xecd5('0x13'),_0x109e9e,JSON[_0xecd5('0x14')](_0x3dc588));_0x3002a2[_0xecd5('0x15')]();}};}; \ 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 276f537..317bc4d 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 _0x06ed=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x1c7320,_0x3ab752){var _0x36ca88=function(_0x39ee53){while(--_0x39ee53){_0x1c7320['push'](_0x1c7320['shift']());}};_0x36ca88(++_0x3ab752);}(_0x06ed,0x19f));var _0xd06e=function(_0x270d5b,_0x3a13f6){_0x270d5b=_0x270d5b-0x0;var _0xfd4733=_0x06ed[_0x270d5b];return _0xfd4733;};'use strict';var utils=require(_0xd06e('0x0'));var logger=require(_0xd06e('0x1'))(_0xd06e('0x2'));exports[_0xd06e('0x3')]=function(_0x5919ad,_0x10b423){return function(_0x2e154b){try{logger[_0xd06e('0x4')](_0xd06e('0x5'),_0x5919ad,utils[_0xd06e('0x6')](_0x10b423[0x0],this));_0x2e154b[_0xd06e('0x7')]();}catch(_0x57ceeb){logger[_0xd06e('0x8')](_0xd06e('0x5'),_0x5919ad,JSON[_0xd06e('0x9')](_0x57ceeb));_0x2e154b[_0xd06e('0xa')]();}};}; \ No newline at end of file +var _0xb540=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb540,0x171));var _0x0b54=function(_0x271828,_0x82203e){_0x271828=_0x271828-0x0;var _0x3e4bf0=_0xb540[_0x271828];return _0x3e4bf0;};'use strict';var utils=require(_0x0b54('0x0'));var logger=require(_0x0b54('0x1'))(_0x0b54('0x2'));exports[_0x0b54('0x3')]=function(_0x23f5a6,_0x382ff9){return function(_0x4743b4){try{logger[_0x0b54('0x4')](_0x0b54('0x5'),_0x23f5a6,utils[_0x0b54('0x6')](_0x382ff9[0x0],this));_0x4743b4[_0x0b54('0x7')]();}catch(_0x4297e4){logger[_0x0b54('0x8')](_0x0b54('0x5'),_0x23f5a6,JSON['stringify'](_0x4297e4));_0x4743b4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 79ee543..db91048 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 _0x8303=['join','timeout','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','defaults','localhost','socket.io-emitter','redis','queue_id','account','joinAt','emit','clone','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','update','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map'];(function(_0x52917d,_0x35841b){var _0x5eb8c2=function(_0x10cf44){while(--_0x10cf44){_0x52917d['push'](_0x52917d['shift']());}};_0x5eb8c2(++_0x35841b);}(_0x8303,0xa5));var _0x3830=function(_0x112b27,_0x1ef0be){_0x112b27=_0x112b27-0x0;var _0x7afee1=_0x8303[_0x112b27];return _0x7afee1;};'use strict';var schema=require(_0x3830('0x0'));var _=require(_0x3830('0x1'));var util=require(_0x3830('0x2'));var seqqueue=require(_0x3830('0x3'));var moment=require(_0x3830('0x4'));var Redis=require('ioredis');var config=require(_0x3830('0x5'));var logger=require(_0x3830('0x6'))(_0x3830('0x7'));var strategy=require('./strategy');config['redis']=_[_0x3830('0x8')](config['redis'],{'host':_0x3830('0x9'),'port':0x18eb});var io=require(_0x3830('0xa'))(new Redis(config[_0x3830('0xb')]));var attributes=['id',_0x3830('0xc'),_0x3830('0xd'),'queue','from',_0x3830('0xe')];function emit(_0x1a49e0,_0x221bb2,_0x2dd374){io['to'](_0x1a49e0)[_0x3830('0xf')](_0x221bb2,_0x2dd374);}function emitChannelQueueInteraction(_0x31cbfc,_0x3c33ea,_0x302013,_0x54b933,_0x59b970,_0x12cc45,_0x2a1533,_0x28c256){var _0x22587c=_[_0x3830('0x10')](_0x302013);_0x22587c['queue_id']=_0x28c256;_0x22587c[_0x3830('0x11')]=_0x3c33ea;_0x22587c[_0x3830('0xd')]=_0x54b933;_0x22587c['id']=_0x59b970;if(_0x12cc45){_0x2a1533[util[_0x3830('0x12')](_0x3830('0x13'),_0x31cbfc)][_0x59b970]=_[_0x3830('0x14')](_0x22587c,attributes);}else{delete _0x2a1533[util[_0x3830('0x12')](_0x3830('0x13'),_0x31cbfc)][_0x59b970];}emit(util[_0x3830('0x12')](_0x3830('0x15'),_0x31cbfc,_0x3c33ea),util[_0x3830('0x12')](_0x3830('0x16'),_0x31cbfc,_0x12cc45?_0x3830('0x17'):_0x3830('0x18')),_[_0x3830('0x14')](_0x22587c,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x3830('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3830('0x1a'))};var queue=schema({'name':{'type':_0x3830('0x1b'),'required':!![],'message':_0x3830('0x1c')},'timeout':{'type':_0x3830('0x1d'),'message':_0x3830('0x1e')}});function startRouting(_0x333b63,_0xcb9768,_0x510286,_0x1a0fb4){if(_0x333b63&&_0xcb9768&&_0x510286){_0xcb9768['waiting']+=0x1;var _0x2a88b1={'uniqueid':_0x333b63,'from':_0x510286[_0x3830('0x1f')]?_0x510286[_0x3830('0x1f')][_0x3830('0x20')]:'','joinAt':moment()[_0x3830('0x12')](_0x3830('0x21')),'ContactId':_0x510286['contact']?_0x510286[_0x3830('0x22')]['id']:null,'ListId':_0x510286[_0x3830('0x23')]?_0x510286[_0x3830('0x23')]['id']:null};_0x2a88b1[_[_0x3830('0x24')](_0x510286[_0x3830('0x25')])+'QueueId']=_0xcb9768['id']||null;_0x2a88b1[_['upperFirst'](_0x510286[_0x3830('0x25')])+_0x3830('0x26')]=_0x510286[_0x3830('0x27')]?_0x510286['interaction']['id']:null;_0x2a88b1[_[_0x3830('0x24')](_0x510286['channel'])+'MessageId']=_0x510286[_0x3830('0x28')]?_0x510286['message']['id']:null;_0x2a88b1[_[_0x3830('0x24')](_0x510286[_0x3830('0x25')])+(_0x510286[_0x3830('0x25')]!=='chat'?_0x3830('0x29'):'WebsiteId')]=_0x510286['account']?_0x510286[_0x3830('0xd')]['id']:null;logger[_0x3830('0x2a')](util[_0x3830('0x12')](_0x3830('0x2b'),_0x333b63,_0xcb9768[_0x3830('0x2c')]));emitChannelQueueInteraction(_0x510286['channel'],_0xcb9768[_0x3830('0x2c')],_0x2a88b1,_0x510286['account'][_0x3830('0x2c')],_0x510286['message']['id'],!![],_0x1a0fb4,_0xcb9768['id']);if(rpc[_0x510286[_0x3830('0x25')]+_0x3830('0x2d')]){return rpc[_0x510286[_0x3830('0x25')]+'QueueReport'][_0x3830('0x2e')](_0x2a88b1)[_0x3830('0x2f')](function(_0x4da3a4){logger[_0x3830('0x30')](_0x3830('0x31'));});}}}function stopRouting(_0x72ce8b,_0x41688e,_0x47222f,_0x448c08){if(_0x72ce8b&&_0x41688e){_0x41688e[_0x3830('0x32')]-=0x1;var _0x535827={'leaveAt':moment()[_0x3830('0x12')](_0x3830('0x21')),'acceptAt':moment()[_0x3830('0x12')](_0x3830('0x21')),'reason':_0x3830('0x33')};logger[_0x3830('0x2a')](util[_0x3830('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x72ce8b,_0x41688e[_0x3830('0x2c')]));emitChannelQueueInteraction(_0x47222f['channel'],_0x41688e[_0x3830('0x2c')],_0x47222f['body'],_0x47222f['account'][_0x3830('0x2c')],_0x47222f[_0x3830('0x28')]['id'],![],_0x448c08,_0x41688e['id']);if(rpc[_0x47222f['channel']+'QueueReport']){return rpc[_0x47222f[_0x3830('0x25')]+_0x3830('0x2d')][_0x3830('0x34')](_0x72ce8b,_0x535827)[_0x3830('0x2f')](function(_0x46a345){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x2a7a89,_0x20ad5a,_0xa69d05,_0xa19df3){if(_0x2a7a89&&_0x20ad5a){_0x20ad5a[_0x3830('0x32')]-=0x1;var _0x56b5d2={'leaveAt':moment()[_0x3830('0x12')](_0x3830('0x21')),'exitAt':moment()[_0x3830('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0x3830('0x12')](_0x3830('0x35'),_0x2a7a89,_0x20ad5a['name']));emitChannelQueueInteraction(_0xa69d05[_0x3830('0x25')],_0x20ad5a['name'],_0xa69d05[_0x3830('0x1f')],_0xa69d05[_0x3830('0xd')][_0x3830('0x2c')],_0xa69d05[_0x3830('0x28')]['id'],![],_0xa19df3);if(rpc[_0xa69d05[_0x3830('0x25')]+_0x3830('0x2d')]){return rpc[_0xa69d05[_0x3830('0x25')]+'QueueReport'][_0x3830('0x34')](_0x2a7a89,_0x56b5d2)['catch'](function(_0x2cccde){logger['error'](_0x3830('0x36'));});}}}function handleFindQueue(_0x4d4337){return function(_0x2d8ca9){return _0x2d8ca9[_0x3830('0x2c')]['toLowerCase']()===_0x4d4337[_0x3830('0x37')]();};}exports[_0x3830('0x38')]=function(_0x1ae784,_0x1e505a,_0x2cb490,_0x3af73f){return function(_0x644f9f){try{var _0x1cb19a={'name':_0x1e505a[0x0],'timeout':_0x1e505a[0x1]};var _0x1ac27b=queue[_0x3830('0x0')](_0x1cb19a,{'typecast':!![]});if(_0x1ac27b[_0x3830('0x39')]){logger[_0x3830('0x30')](_0x3830('0x3a'),_0x1ae784,_[_0x3830('0x3b')](_0x1ac27b,_0x3830('0x28'))[_0x3830('0x3c')](',\x20'));_0x644f9f['stop']();}else{var _0x226835=_['find'](_0x2cb490[_0x3af73f[_0x3830('0x25')]+'Queues'],handleFindQueue(_0x1cb19a[_0x3830('0x2c')]));if(_0x226835){startRouting(_0x1ae784,_0x226835,_0x3af73f,_0x2cb490);var _0x3039c2=(_0x226835[_0x3830('0x3d')]||0xa)*0x3e8;var _0x2776b4=(_0x1cb19a['timeout']||0x14)*0x3e8;var _0x4e9cb2,_0xc8e1b0;if(_0x3039c2>_0x2776b4){_0x2776b4=_0x3039c2;}var _0x2b24f4=seqqueue['createQueue'](_0x3039c2);_0x2b24f4['id']=_0x1ae784;_0x2b24f4[_0x3830('0x3e')]=_0x3039c2;_0x2b24f4[_0x3830('0x3f')]=_0x2776b4;_0x2b24f4['channel']=_0x3af73f[_0x3830('0x25')];_0x2cb490[_0x3830('0x40')][_0x1ae784]['on'](_0x3830('0x41'),function(){logger[_0x3830('0x2a')](_0x3830('0x42'),_0x1ae784);stopRouting(_0x1ae784,_0x226835,_0x3af73f,_0x2cb490);clearTimeout(_0x4e9cb2);_0x4e9cb2=undefined;_0x2b24f4['close'](!![]);if(_0x2cb490['rules'][_0x1ae784]){delete _0x2cb490['rules'][_0x1ae784];}_0x644f9f[_0x3830('0x43')]();});_0x2cb490['rules'][_0x1ae784]['on'](_0x3830('0x44'),function(){if(_0x2cb490[_0x3830('0x40')][_0x1ae784]){delete _0x2cb490['rules'][_0x1ae784];}});_0x4e9cb2=setTimeout(function(){logger[_0x3830('0x2a')](_0x3830('0x45'),_0x1ae784);endRouting(_0x1ae784,_0x226835,_0x3af73f,_0x2cb490);clearTimeout(_0x4e9cb2);_0x2b24f4[_0x3830('0x46')](!![]);_0x644f9f['next']();},_0x2776b4);switch(_0x226835['strategy']){case _0x3830('0x47'):strategy[_0x3830('0x47')](_0x2b24f4,_0x226835,_0x2cb490,_0x3af73f);break;default:strategy[_0x3830('0x48')](_0x2b24f4,_0x226835,_0x2cb490,_0x3af73f);}}else{logger[_0x3830('0x30')](_0x3830('0x49'),_0x1ae784,_0x1cb19a[_0x3830('0x2c')]);_0x644f9f['stop']();}}}catch(_0x143eab){console[_0x3830('0x4a')](_0x143eab);logger[_0x3830('0x30')]('[%s][QUEUE]\x20%s',_0x1ae784,_0x143eab['stack']);_0x644f9f[_0x3830('0x43')]();}};}; \ No newline at end of file +var _0x75ea=['number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','clone','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string'];(function(_0x507b3b,_0x30c190){var _0xe1e48e=function(_0x1865ed){while(--_0x1865ed){_0x507b3b['push'](_0x507b3b['shift']());}};_0xe1e48e(++_0x30c190);}(_0x75ea,0x7d));var _0xa75e=function(_0x9fb220,_0x2f2974){_0x9fb220=_0x9fb220-0x0;var _0x5c4dc9=_0x75ea[_0x9fb220];return _0x5c4dc9;};'use strict';var schema=require(_0xa75e('0x0'));var _=require(_0xa75e('0x1'));var util=require('util');var seqqueue=require(_0xa75e('0x2'));var moment=require(_0xa75e('0x3'));var Redis=require('ioredis');var config=require(_0xa75e('0x4'));var logger=require(_0xa75e('0x5'))(_0xa75e('0x6'));var strategy=require(_0xa75e('0x7'));config[_0xa75e('0x8')]=_['defaults'](config[_0xa75e('0x8')],{'host':_0xa75e('0x9'),'port':0x18eb});var io=require(_0xa75e('0xa'))(new Redis(config[_0xa75e('0x8')]));var attributes=['id',_0xa75e('0xb'),_0xa75e('0xc'),_0xa75e('0xd'),'from','joinAt'];function emit(_0x560baa,_0x5c2c35,_0x39aab0){io['to'](_0x560baa)['emit'](_0x5c2c35,_0x39aab0);}function emitChannelQueueInteraction(_0x245dd2,_0x495157,_0x34ec67,_0xad9407,_0x58c4fd,_0x20b79b,_0x259e8c,_0x38dce8){var _0x35c81b=_[_0xa75e('0xe')](_0x34ec67);_0x35c81b[_0xa75e('0xb')]=_0x38dce8;_0x35c81b[_0xa75e('0xd')]=_0x495157;_0x35c81b[_0xa75e('0xc')]=_0xad9407;_0x35c81b['id']=_0x58c4fd;if(_0x20b79b){_0x259e8c[util[_0xa75e('0xf')]('%sQueuesWaitingInteractions',_0x245dd2)][_0x58c4fd]=_[_0xa75e('0x10')](_0x35c81b,attributes);}else{delete _0x259e8c[util['format'](_0xa75e('0x11'),_0x245dd2)][_0x58c4fd];}emit(util[_0xa75e('0xf')]('%s:queue:%s',_0x245dd2,_0x495157),util[_0xa75e('0xf')](_0xa75e('0x12'),_0x245dd2,_0x20b79b?_0xa75e('0x13'):'remove'),_[_0xa75e('0x10')](_0x35c81b,attributes));}var rpc={'openchannelQueueReport':require(_0xa75e('0x14')),'mailQueueReport':require(_0xa75e('0x15')),'chatQueueReport':require(_0xa75e('0x16')),'smsQueueReport':require(_0xa75e('0x17')),'faxQueueReport':require(_0xa75e('0x18')),'whatsappQueueReport':require(_0xa75e('0x19'))};var queue=schema({'name':{'type':_0xa75e('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa75e('0x1b'),'message':_0xa75e('0x1c')}});function startRouting(_0x149647,_0x4e0fea,_0x5d22ca,_0x42f1d6){if(_0x149647&&_0x4e0fea&&_0x5d22ca){_0x4e0fea['waiting']+=0x1;var _0x47b19c={'uniqueid':_0x149647,'from':_0x5d22ca['body']?_0x5d22ca[_0xa75e('0x1d')]['from']:'','joinAt':moment()[_0xa75e('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5d22ca[_0xa75e('0x1e')]?_0x5d22ca[_0xa75e('0x1e')]['id']:null,'ListId':_0x5d22ca[_0xa75e('0x1f')]?_0x5d22ca['list']['id']:null};_0x47b19c[_[_0xa75e('0x20')](_0x5d22ca[_0xa75e('0x21')])+_0xa75e('0x22')]=_0x4e0fea['id']||null;_0x47b19c[_['upperFirst'](_0x5d22ca[_0xa75e('0x21')])+_0xa75e('0x23')]=_0x5d22ca[_0xa75e('0x24')]?_0x5d22ca[_0xa75e('0x24')]['id']:null;_0x47b19c[_[_0xa75e('0x20')](_0x5d22ca[_0xa75e('0x21')])+_0xa75e('0x25')]=_0x5d22ca[_0xa75e('0x26')]?_0x5d22ca[_0xa75e('0x26')]['id']:null;_0x47b19c[_['upperFirst'](_0x5d22ca['channel'])+(_0x5d22ca[_0xa75e('0x21')]!==_0xa75e('0x27')?'AccountId':_0xa75e('0x28'))]=_0x5d22ca[_0xa75e('0xc')]?_0x5d22ca[_0xa75e('0xc')]['id']:null;logger[_0xa75e('0x29')](util[_0xa75e('0xf')](_0xa75e('0x2a'),_0x149647,_0x4e0fea['name']));emitChannelQueueInteraction(_0x5d22ca[_0xa75e('0x21')],_0x4e0fea[_0xa75e('0x2b')],_0x47b19c,_0x5d22ca[_0xa75e('0xc')][_0xa75e('0x2b')],_0x5d22ca[_0xa75e('0x26')]['id'],!![],_0x42f1d6,_0x4e0fea['id']);if(rpc[_0x5d22ca['channel']+_0xa75e('0x2c')]){return rpc[_0x5d22ca['channel']+'QueueReport'][_0xa75e('0x2d')](_0x47b19c)[_0xa75e('0x2e')](function(_0x207be3){logger[_0xa75e('0x2f')](_0xa75e('0x30'));});}}}function stopRouting(_0xf091d7,_0x1fccbb,_0x1df3ec,_0x3f7fc5){if(_0xf091d7&&_0x1fccbb){_0x1fccbb[_0xa75e('0x31')]-=0x1;var _0x30a7e5={'leaveAt':moment()[_0xa75e('0xf')](_0xa75e('0x32')),'acceptAt':moment()['format'](_0xa75e('0x32')),'reason':_0xa75e('0x33')};logger[_0xa75e('0x29')](util[_0xa75e('0xf')](_0xa75e('0x34'),_0xf091d7,_0x1fccbb[_0xa75e('0x2b')]));emitChannelQueueInteraction(_0x1df3ec['channel'],_0x1fccbb['name'],_0x1df3ec['body'],_0x1df3ec[_0xa75e('0xc')]['name'],_0x1df3ec['message']['id'],![],_0x3f7fc5,_0x1fccbb['id']);if(rpc[_0x1df3ec[_0xa75e('0x21')]+'QueueReport']){return rpc[_0x1df3ec[_0xa75e('0x21')]+_0xa75e('0x2c')][_0xa75e('0x35')](_0xf091d7,_0x30a7e5)[_0xa75e('0x2e')](function(_0x4a9356){logger[_0xa75e('0x2f')](_0xa75e('0x36'));});}}}function endRouting(_0x1679d1,_0x5f3d8f,_0x5b6044,_0x376ac1){if(_0x1679d1&&_0x5f3d8f){_0x5f3d8f[_0xa75e('0x31')]-=0x1;var _0x544783={'leaveAt':moment()[_0xa75e('0xf')](_0xa75e('0x32')),'exitAt':moment()['format'](_0xa75e('0x32')),'reason':_0xa75e('0x37')};logger['info'](util[_0xa75e('0xf')](_0xa75e('0x38'),_0x1679d1,_0x5f3d8f[_0xa75e('0x2b')]));emitChannelQueueInteraction(_0x5b6044['channel'],_0x5f3d8f[_0xa75e('0x2b')],_0x5b6044[_0xa75e('0x1d')],_0x5b6044[_0xa75e('0xc')][_0xa75e('0x2b')],_0x5b6044[_0xa75e('0x26')]['id'],![],_0x376ac1);if(rpc[_0x5b6044['channel']+_0xa75e('0x2c')]){return rpc[_0x5b6044['channel']+_0xa75e('0x2c')][_0xa75e('0x35')](_0x1679d1,_0x544783)[_0xa75e('0x2e')](function(_0xbfdd50){logger[_0xa75e('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x1400c1){return function(_0x38650a){return _0x38650a[_0xa75e('0x2b')]['toLowerCase']()===_0x1400c1[_0xa75e('0x39')]();};}exports[_0xa75e('0x3a')]=function(_0x5988b7,_0x153d2f,_0x24d54a,_0x554179){return function(_0x3ad6a0){try{var _0x17964e={'name':_0x153d2f[0x0],'timeout':_0x153d2f[0x1]};var _0x222b88=queue[_0xa75e('0x0')](_0x17964e,{'typecast':!![]});if(_0x222b88[_0xa75e('0x3b')]){logger[_0xa75e('0x2f')]('[%s][QUEUE]\x20%s',_0x5988b7,_[_0xa75e('0x3c')](_0x222b88,_0xa75e('0x26'))[_0xa75e('0x3d')](',\x20'));_0x3ad6a0[_0xa75e('0x3e')]();}else{var _0x51318d=_['find'](_0x24d54a[_0x554179['channel']+_0xa75e('0x3f')],handleFindQueue(_0x17964e[_0xa75e('0x2b')]));if(_0x51318d){startRouting(_0x5988b7,_0x51318d,_0x554179,_0x24d54a);var _0x12ac1d=(_0x51318d[_0xa75e('0x37')]||0xa)*0x3e8;var _0x55a338=(_0x17964e[_0xa75e('0x37')]||0x14)*0x3e8;var _0x4d0ff9,_0x465e22;if(_0x12ac1d>_0x55a338){_0x55a338=_0x12ac1d;}var _0x3c8ba3=seqqueue[_0xa75e('0x40')](_0x12ac1d);_0x3c8ba3['id']=_0x5988b7;_0x3c8ba3['atimeout']=_0x12ac1d;_0x3c8ba3[_0xa75e('0x41')]=_0x55a338;_0x3c8ba3[_0xa75e('0x21')]=_0x554179['channel'];_0x24d54a[_0xa75e('0x42')][_0x5988b7]['on'](_0xa75e('0x43'),function(){logger[_0xa75e('0x29')](_0xa75e('0x44'),_0x5988b7);stopRouting(_0x5988b7,_0x51318d,_0x554179,_0x24d54a);clearTimeout(_0x4d0ff9);_0x4d0ff9=undefined;_0x3c8ba3['close'](!![]);if(_0x24d54a[_0xa75e('0x42')][_0x5988b7]){delete _0x24d54a[_0xa75e('0x42')][_0x5988b7];}_0x3ad6a0[_0xa75e('0x3e')]();});_0x24d54a[_0xa75e('0x42')][_0x5988b7]['on']('complete',function(){if(_0x24d54a[_0xa75e('0x42')][_0x5988b7]){delete _0x24d54a['rules'][_0x5988b7];}});_0x4d0ff9=setTimeout(function(){logger[_0xa75e('0x29')](_0xa75e('0x45'),_0x5988b7);endRouting(_0x5988b7,_0x51318d,_0x554179,_0x24d54a);clearTimeout(_0x4d0ff9);_0x3c8ba3[_0xa75e('0x46')](!![]);_0x3ad6a0['next']();},_0x55a338);switch(_0x51318d[_0xa75e('0x47')]){case _0xa75e('0x48'):strategy[_0xa75e('0x48')](_0x3c8ba3,_0x51318d,_0x24d54a,_0x554179);break;default:strategy['beepall'](_0x3c8ba3,_0x51318d,_0x24d54a,_0x554179);}}else{logger[_0xa75e('0x2f')](_0xa75e('0x49'),_0x5988b7,_0x17964e[_0xa75e('0x2b')]);_0x3ad6a0['stop']();}}}catch(_0x24dd7a){console['log'](_0x24dd7a);logger[_0xa75e('0x2f')](_0xa75e('0x4a'),_0x5988b7,_0x24dd7a[_0xa75e('0x4b')]);_0x3ad6a0['stop']();}};}; \ 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 1dd1681..4bdc288 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 _0x9716=['[%s][AGENT]\x20try\x20with\x20%s','agents','routing','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','notificationId','RINGING',':FORCED','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','lodash','./util','squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x9716,0xd2));var _0x6971=function(_0x36a469,_0x59d84c){_0x36a469=_0x36a469-0x0;var _0x3347fc=_0x9716[_0x36a469];return _0x3347fc;};'use strict';var _=require(_0x6971('0x0'));var uuid=require('uuid');var util=require(_0x6971('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x1a2280,_0x35ea51,_0x4d43b4,_0x3323d1){this['notificationId']=uuid['v4']();this[_0x6971('0x2')]=_0x1a2280;this[_0x6971('0x3')]=_0x35ea51;this[_0x6971('0x4')]=_0x4d43b4;this['routing']=_0x3323d1;this[_0x6971('0x2')]['push'](this[_0x6971('0x5')][_0x6971('0x6')](this),this[_0x6971('0x7')][_0x6971('0x6')](this));this[_0x6971('0x2')]['on'](_0x6971('0x8'),this['handleTimeout'][_0x6971('0x6')](this));this['squeue']['on'](_0x6971('0x9'),this[_0x6971('0xa')][_0x6971('0x6')](this));};Agent[_0x6971('0xb')][_0x6971('0xc')]=function(){this[_0x6971('0x2')]['push'](this[_0x6971('0x5')][_0x6971('0x6')](this),this['handleTimeout'][_0x6971('0x6')](this));};Agent[_0x6971('0xb')][_0x6971('0xa')]=function(){this[_0x6971('0x7')](!![]);};Agent[_0x6971('0xb')][_0x6971('0x5')]=function(_0x1d24df){logger[_0x6971('0xd')](_0x6971('0xe'),this[_0x6971('0x2')]['id'],this[_0x6971('0x3')]['id']);if(_['isNil'](this[_0x6971('0x4')][_0x6971('0xf')][this[_0x6971('0x3')]['id']])){logger[_0x6971('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x6971('0x3')]['id']);setTimeout(this[_0x6971('0xc')][_0x6971('0x6')](this),0x3e8);}else{if(this[_0x6971('0x10')][_0x6971('0x11')]||util[_0x6971('0x12')](this['squeue']['id'],this[_0x6971('0x4')][_0x6971('0xf')][this[_0x6971('0x3')]['id']],this[_0x6971('0x2')]['channel'],![])){this[_0x6971('0x4')][_0x6971('0xf')][this[_0x6971('0x3')]['id']][_0x6971('0x13')]=!![];this[_0x6971('0x4')][_0x6971('0xf')][this[_0x6971('0x3')]['id']][_0x6971('0x14')]=undefined;util[_0x6971('0x15')](this[_0x6971('0x16')],this[_0x6971('0x2')]['id'],this[_0x6971('0x4')]['agents'][this[_0x6971('0x3')]['id']],null,this[_0x6971('0x10')]);util['writeLog'](this['squeue']['id'],this[_0x6971('0x4')]['agents'][this[_0x6971('0x3')]['id']],_0x6971('0x17')+(this[_0x6971('0x10')][_0x6971('0x11')]?_0x6971('0x18'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x6971('0x2')]['id'],this['agent']['id']);setTimeout(this[_0x6971('0xc')]['bind'](this),0x3e8);}}};Agent[_0x6971('0xb')][_0x6971('0x7')]=function(_0x3acd80){if(_[_0x6971('0x19')](this[_0x6971('0x4')][_0x6971('0xf')][this[_0x6971('0x3')]['id']])){return logger[_0x6971('0xd')](_0x6971('0x1a'),this[_0x6971('0x2')]['id'],this[_0x6971('0x3')]['id']);}else{logger[_0x6971('0xd')](_0x6971('0x1b'),this[_0x6971('0x2')]['id'],this[_0x6971('0x3')]['id']);util[_0x6971('0x1c')](this[_0x6971('0x16')],this[_0x6971('0x2')]['id'],this[_0x6971('0x4')]['agents'][this[_0x6971('0x3')]['id']],null,this['routing']);this[_0x6971('0x4')][_0x6971('0xf')][this[_0x6971('0x3')]['id']][_0x6971('0x13')]=![];this['realtime'][_0x6971('0xf')][this[_0x6971('0x3')]['id']][_0x6971('0x14')]=undefined;util[_0x6971('0x1d')](this[_0x6971('0x2')]['id'],this[_0x6971('0x4')]['agents'][this[_0x6971('0x3')]['id']],_0x3acd80?_0x6971('0x1e'):_0x6971('0x1f'));}if(!_0x3acd80){setTimeout(this[_0x6971('0xc')][_0x6971('0x6')](this),0x3e8);}};function agent(_0x5eb034,_0x2fa716,_0xb16c62,_0x5016e){return new Agent(_0x5eb034,_0x2fa716,_0xb16c62,_0x5016e);}module['exports']=agent; \ No newline at end of file +var _0x0e77=['TIMEOUT','exports','lodash','uuid','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','routing','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP'];(function(_0x4b43e1,_0x506077){var _0x531e5e=function(_0x40019f){while(--_0x40019f){_0x4b43e1['push'](_0x4b43e1['shift']());}};_0x531e5e(++_0x506077);}(_0x0e77,0xc8));var _0x70e7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0e77[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x70e7('0x0'));var uuid=require(_0x70e7('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x321cb1,_0x1763cc,_0x49ca5d,_0x194409){this[_0x70e7('0x2')]=uuid['v4']();this[_0x70e7('0x3')]=_0x321cb1;this[_0x70e7('0x4')]=_0x1763cc;this[_0x70e7('0x5')]=_0x49ca5d;this['routing']=_0x194409;this[_0x70e7('0x3')][_0x70e7('0x6')](this[_0x70e7('0x7')]['bind'](this),this[_0x70e7('0x8')][_0x70e7('0x9')](this));this['squeue']['on'](_0x70e7('0xa'),this['handleTimeout']['bind'](this));this[_0x70e7('0x3')]['on'](_0x70e7('0xb'),this[_0x70e7('0xc')][_0x70e7('0x9')](this));};Agent[_0x70e7('0xd')][_0x70e7('0x6')]=function(){this[_0x70e7('0x3')][_0x70e7('0x6')](this[_0x70e7('0x7')][_0x70e7('0x9')](this),this['handleTimeout']['bind'](this));};Agent[_0x70e7('0xd')]['handleDrained']=function(){this[_0x70e7('0x8')](!![]);};Agent[_0x70e7('0xd')]['handleRun']=function(_0xd95a50){logger[_0x70e7('0xe')](_0x70e7('0xf'),this['squeue']['id'],this[_0x70e7('0x4')]['id']);if(_[_0x70e7('0x10')](this['realtime']['agents'][this[_0x70e7('0x4')]['id']])){logger['info'](_0x70e7('0x11'),this[_0x70e7('0x3')]['id'],this[_0x70e7('0x4')]['id']);setTimeout(this[_0x70e7('0x6')]['bind'](this),0x3e8);}else{if(this['routing'][_0x70e7('0x12')]||util[_0x70e7('0x13')](this[_0x70e7('0x3')]['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']],this[_0x70e7('0x3')][_0x70e7('0x15')],![])){this[_0x70e7('0x5')]['agents'][this['agent']['id']]['busy']=!![];this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']][_0x70e7('0x16')]=undefined;util['showNotification'](this[_0x70e7('0x2')],this['squeue']['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']],null,this[_0x70e7('0x17')]);util['writeLog'](this['squeue']['id'],this[_0x70e7('0x5')]['agents'][this[_0x70e7('0x4')]['id']],_0x70e7('0x18')+(this[_0x70e7('0x17')]['forcedOwnership']?':FORCED':''));}else{logger[_0x70e7('0xe')](_0x70e7('0x19'),this[_0x70e7('0x3')]['id'],this['agent']['id']);setTimeout(this[_0x70e7('0x6')][_0x70e7('0x9')](this),0x3e8);}}};Agent[_0x70e7('0xd')]['handleTimeout']=function(_0x7bc667){if(_[_0x70e7('0x10')](this[_0x70e7('0x5')]['agents'][this[_0x70e7('0x4')]['id']])){return logger[_0x70e7('0xe')](_0x70e7('0x11'),this[_0x70e7('0x3')]['id'],this[_0x70e7('0x4')]['id']);}else{logger[_0x70e7('0xe')](_0x70e7('0x1a'),this['squeue']['id'],this[_0x70e7('0x4')]['id']);util[_0x70e7('0x1b')](this[_0x70e7('0x2')],this[_0x70e7('0x3')]['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this['agent']['id']],null,this[_0x70e7('0x17')]);this[_0x70e7('0x5')]['agents'][this['agent']['id']][_0x70e7('0x1c')]=![];this[_0x70e7('0x5')]['agents'][this[_0x70e7('0x4')]['id']][_0x70e7('0x16')]=undefined;util[_0x70e7('0x1d')](this[_0x70e7('0x3')]['id'],this[_0x70e7('0x5')][_0x70e7('0x14')][this[_0x70e7('0x4')]['id']],_0x7bc667?_0x70e7('0x1e'):_0x70e7('0x1f'));}if(!_0x7bc667){setTimeout(this[_0x70e7('0x6')][_0x70e7('0x9')](this),0x3e8);}};function agent(_0x3a9562,_0x2f95c8,_0x4fea55,_0x2bf18a){return new Agent(_0x3a9562,_0x2f95c8,_0x4fea55,_0x2bf18a);}module[_0x70e7('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 7ea62dc..504e1cd 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 _0xc999=['writeLog','agents','RINGING','busy','busyQueue','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','squeue','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','isNil','queue','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel'];(function(_0x134c2e,_0x1704d3){var _0x317bbe=function(_0xc1e0b4){while(--_0xc1e0b4){_0x134c2e['push'](_0x134c2e['shift']());}};_0x317bbe(++_0x1704d3);}(_0xc999,0x176));var _0x9c99=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xc999[_0x15942a];return _0x36a9fb;};'use strict';var _=require('lodash');var uuid=require(_0x9c99('0x0'));var util=require(_0x9c99('0x1'));var logger=require(_0x9c99('0x2'))('routing');var Beepall=function(_0x590362,_0x5473fe,_0x4bbc08,_0x3cecf2){this['notificationId']=uuid['v4']();this[_0x9c99('0x3')]=_0x590362;this['queue']=_0x5473fe;this[_0x9c99('0x4')]=_0x4bbc08;this[_0x9c99('0x5')]=_0x3cecf2;this[_0x9c99('0x3')]['push'](this[_0x9c99('0x6')][_0x9c99('0x7')](this),this[_0x9c99('0x8')][_0x9c99('0x7')](this));this[_0x9c99('0x3')]['on'](_0x9c99('0x9'),this['handleTimeout'][_0x9c99('0x7')](this));this[_0x9c99('0x3')]['on'](_0x9c99('0xa'),this[_0x9c99('0xb')]['bind'](this));};Beepall[_0x9c99('0xc')][_0x9c99('0xd')]=function(){this[_0x9c99('0x3')]['push'](this[_0x9c99('0x6')]['bind'](this),this['handleTimeout'][_0x9c99('0x7')](this));};Beepall[_0x9c99('0xc')][_0x9c99('0xb')]=function(_0x2bb18a){this['handleTimeout'](!![]);};Beepall[_0x9c99('0xc')]['handleRun']=function(_0x5db87b){var _0x594c9d=!![];if(!_[_0x9c99('0xe')](this[_0x9c99('0xf')])&&!_['isNil'](this[_0x9c99('0xf')]['Agents'])&&this['queue'][_0x9c99('0x10')][_0x9c99('0x11')]>0x0){for(var _0x5c0023=0x0,_0x34a89d;_0x5c00230x0){for(var _0x42ef5e=0x0,_0x1071d9;_0x42ef5e0x0&&_0x3525e8[_0x43c845+'CurrentCapacity']>=_0x3525e8[_0x43c845+'Capacity']){writeLog(_0x3d2943,_0x3525e8,_0x43c845[_0x477d('0x24')]()+_0x477d('0x25'));return![];}}return!![];};exports[_0x477d('0x26')]=function(_0x5c8ef1,_0x254141,_0x297d15,_0x74ebb4,_0xe4dd40){return sendNotification(!![],_0x5c8ef1,_0x254141,_0x297d15,_0x74ebb4,_0xe4dd40);};exports[_0x477d('0x27')]=function(_0x537fc4,_0x2fc959,_0xeb02f5,_0x17dd16,_0x25a329){return sendNotification(![],_0x537fc4,_0x2fc959,_0xeb02f5,_0x17dd16,_0x25a329);};exports[_0x477d('0x28')]=writeLog; \ No newline at end of file +var _0xfcf0=['body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','name','format','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','user:%s','user:save','\x20interaction','account','notificationSound','notificationShake'];(function(_0x4582e9,_0xc5b071){var _0x5d9d8b=function(_0x4bb7e2){while(--_0x4bb7e2){_0x4582e9['push'](_0x4582e9['shift']());}};_0x5d9d8b(++_0xc5b071);}(_0xfcf0,0x138));var _0x0fcf=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0xfcf0[_0x59eacf];return _0x5d74f2;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var utils=require('../utils');var Mustache=require(_0x0fcf('0x2'));var Redis=require(_0x0fcf('0x3'));var config=require(_0x0fcf('0x4'));var logger=require(_0x0fcf('0x5'))('routing');config[_0x0fcf('0x6')]=_[_0x0fcf('0x7')](config[_0x0fcf('0x6')],{'host':_0x0fcf('0x8'),'port':0x18eb});var io=require(_0x0fcf('0x9'))(new Redis(config[_0x0fcf('0x6')]));function emit(_0x61bbb9,_0x2dfdf8,_0x50c575){io['to'](_0x61bbb9)[_0x0fcf('0xa')](_0x2dfdf8,_0x50c575);}function sendNotification(_0x6ced94,_0xa9e007,_0x4de593,_0x69a840,_0x7ac7bd,_0x239e5d){io['to'](util['format'](_0x0fcf('0xb'),_0x69a840['name']))[_0x0fcf('0xa')](_0x0fcf('0xc'),_0x69a840);var _0x201a58=_0x239e5d||{};var _0x48619c=_0x4de593['split']('.');var _0x29336a={'uniqueid':_0xa9e007,'channel':_0x48619c[0x0],'id':_0x48619c[0x1],'title':_0x48619c[0x0]+_0x0fcf('0xd'),'interactionId':_0x48619c[0x2],'queue':_0x7ac7bd?_0x7ac7bd['name']:null,'sound':_0x201a58[_0x0fcf('0xe')][_0x0fcf('0xf')],'shake':_0x201a58[_0x0fcf('0xe')][_0x0fcf('0x10')]};try{if(!_0x201a58[_0x0fcf('0x11')]){_0x201a58['body']={};}if(_0x7ac7bd){_0x201a58[_0x0fcf('0x11')][_0x0fcf('0x12')]=_0x7ac7bd;}else if(_0x201a58[_0x0fcf('0x11')]['queue']){delete _0x201a58[_0x0fcf('0x11')][_0x0fcf('0x12')];}_0x29336a[_0x0fcf('0x13')]=utils[_0x0fcf('0x14')](_0x201a58['account'][_0x0fcf('0x15')],_0x201a58);}catch(_0x2f8289){_0x29336a[_0x0fcf('0x13')]=_0x0fcf('0x16');logger[_0x0fcf('0x17')](util['format'](_0x0fcf('0x18'),_0xa9e007,_0x2f8289[_0x0fcf('0x19')]));}io['to'](util['format'](_0x0fcf('0xb'),_0x69a840[_0x0fcf('0x1a')]))['emit'](util[_0x0fcf('0x1b')]('notification:%s',_0x6ced94?_0x0fcf('0x1c'):_0x0fcf('0x1d')),_0x29336a);}function writeLog(_0x5c8279,_0x457880,_0x3f28d0){return logger[_0x0fcf('0x1e')](util['format'](_0x0fcf('0x1f'),_0x5c8279,_0x457880[_0x0fcf('0x1a')],_0x3f28d0));}exports[_0x0fcf('0x20')]=function(_0x41b20b,_0x18af5c,_0x30e1b0,_0x5841a9){if(_0x18af5c[_0x0fcf('0x21')]){writeLog(_0x41b20b,_0x18af5c,_0x0fcf('0x22'));return![];}if(!_0x18af5c[_0x0fcf('0x23')]){writeLog(_0x41b20b,_0x18af5c,_0x0fcf('0x24'));return![];}if(_0x18af5c[_0x30e1b0+_0x0fcf('0x25')]){writeLog(_0x41b20b,_0x18af5c,_0x0fcf('0x26'));return![];}if(_0x5841a9&&_0x18af5c[_0x0fcf('0x27')](_0x30e1b0+_0x0fcf('0x28'))&&_0x18af5c[_0x0fcf('0x27')](_0x30e1b0+'CurrentCapacity')){if(_0x18af5c[_0x30e1b0+_0x0fcf('0x28')]>0x0&&_0x18af5c[_0x30e1b0+_0x0fcf('0x29')]>=_0x18af5c[_0x30e1b0+_0x0fcf('0x28')]){writeLog(_0x41b20b,_0x18af5c,_0x30e1b0[_0x0fcf('0x2a')]()+_0x0fcf('0x2b'));return![];}}return!![];};exports[_0x0fcf('0x2c')]=function(_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517){return sendNotification(!![],_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517);};exports[_0x0fcf('0x2d')]=function(_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df){return sendNotification(![],_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df);};exports[_0x0fcf('0x2e')]=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 a53cd94..77279aa 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 _0x9d5b=['error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length'];(function(_0x1e88eb,_0x4d031e){var _0x23fe01=function(_0x42f79c){while(--_0x42f79c){_0x1e88eb['push'](_0x1e88eb['shift']());}};_0x23fe01(++_0x4d031e);}(_0x9d5b,0x71));var _0xb9d5=function(_0x17e69b,_0x512806){_0x17e69b=_0x17e69b-0x0;var _0x55eea8=_0x9d5b[_0x17e69b];return _0x55eea8;};'use strict';var schema=require(_0xb9d5('0x0'));var sh=require('shelljs');var _=require(_0xb9d5('0x1'));var utils=require(_0xb9d5('0x2'));var logger=require(_0xb9d5('0x3'))('routing');var system=schema({'command':{'type':_0xb9d5('0x4'),'required':!![],'message':_0xb9d5('0x5')}});exports['consequence']=function(_0x241166,_0x3fbcbf){return function(_0xbddd22){try{var _0x450d40={'command':_0x3fbcbf[0x0]};var _0x858576=system[_0xb9d5('0x0')](_0x450d40,{'typecast':!![]});if(_0x858576[_0xb9d5('0x6')]){logger[_0xb9d5('0x7')]('[%s][SYSTEM]\x20%s',_0x241166,_[_0xb9d5('0x8')](_0x858576,_0xb9d5('0x9'))[_0xb9d5('0xa')](',\x20'));logger[_0xb9d5('0xb')](_0xb9d5('0xc'),_0x241166);_0xbddd22[_0xb9d5('0xd')]();}else{var _0xfb89d0=this;var _0x1c2091=utils[_0xb9d5('0xe')](_0x3fbcbf[0x0],this);logger[_0xb9d5('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x241166,_0x1c2091);sh[_0xb9d5('0xf')](_[_0xb9d5('0x10')](_0x1c2091),function(_0xddc836,_0x3d5678){logger[_0xb9d5('0xb')](_0xb9d5('0x11'),_0x241166,_0xddc836);if(_0xddc836==0x0){var _0x2769f8=_0x3d5678[_0xb9d5('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xb9d5('0x13')](_0x3fbcbf[0x1])||_['isEmpty'](_0x3fbcbf[0x1])){logger['info'](_0xb9d5('0x14'),_0x241166);_0xfb89d0[_0xb9d5('0x15')][_0x3fbcbf[0x1]]=_0x2769f8;}else{logger[_0xb9d5('0xb')](_0xb9d5('0x16'),_0x241166,_0x3fbcbf[0x1],_0x2769f8);_0xfb89d0[_0xb9d5('0x15')][_0x3fbcbf[0x1]]=_0x2769f8;}}_0xbddd22['next']();});}}catch(_0x3bff18){logger[_0xb9d5('0x7')]('[%s][SYSTEM]\x20%s',_0x241166,_[_0xb9d5('0x17')](_0x3bff18)?JSON['stringify'](_0x3bff18):_0x3bff18);logger[_0xb9d5('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x241166);_0xbddd22[_0xb9d5('0xd')]();}};}; \ No newline at end of file +var _0x1261=['map','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1261,0x1a8));var _0x1126=function(_0x803ae0,_0x5c5f30){_0x803ae0=_0x803ae0-0x0;var _0x3c38b1=_0x1261[_0x803ae0];return _0x3c38b1;};'use strict';var schema=require(_0x1126('0x0'));var sh=require(_0x1126('0x1'));var _=require('lodash');var utils=require(_0x1126('0x2'));var logger=require('../../../../config/logger')(_0x1126('0x3'));var system=schema({'command':{'type':_0x1126('0x4'),'required':!![],'message':_0x1126('0x5')}});exports['consequence']=function(_0x2409b5,_0x79a0c4){return function(_0x94c8c0){try{var _0x56c2fb={'command':_0x79a0c4[0x0]};var _0x5efc88=system[_0x1126('0x0')](_0x56c2fb,{'typecast':!![]});if(_0x5efc88['length']){logger[_0x1126('0x6')](_0x1126('0x7'),_0x2409b5,_[_0x1126('0x8')](_0x5efc88,_0x1126('0x9'))[_0x1126('0xa')](',\x20'));logger[_0x1126('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2409b5);_0x94c8c0[_0x1126('0xc')]();}else{var _0x3a68fc=this;var _0x1d661f=utils['getMustacheRender'](_0x79a0c4[0x0],this);logger[_0x1126('0xb')](_0x1126('0xd'),_0x2409b5,_0x1d661f);sh[_0x1126('0xe')](_[_0x1126('0xf')](_0x1d661f),function(_0x1ca8c,_0x38bd5e){logger[_0x1126('0xb')](_0x1126('0x10'),_0x2409b5,_0x1ca8c);if(_0x1ca8c==0x0){var _0x4e9f8d=_0x38bd5e[_0x1126('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x79a0c4[0x1])||_[_0x1126('0x12')](_0x79a0c4[0x1])){logger[_0x1126('0xb')](_0x1126('0x13'),_0x2409b5);_0x3a68fc[_0x1126('0x14')][_0x79a0c4[0x1]]=_0x4e9f8d;}else{logger[_0x1126('0xb')](_0x1126('0x15'),_0x2409b5,_0x79a0c4[0x1],_0x4e9f8d);_0x3a68fc['body'][_0x79a0c4[0x1]]=_0x4e9f8d;}}_0x94c8c0['next']();});}}catch(_0x21e2e1){logger[_0x1126('0x6')](_0x1126('0x7'),_0x2409b5,_[_0x1126('0x16')](_0x21e2e1)?JSON['stringify'](_0x21e2e1):_0x21e2e1);logger[_0x1126('0xb')](_0x1126('0x17'),_0x2409b5);_0x94c8c0['next']();}};}; \ 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 779ffcd..9d70972 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 _0x9c4c=['next','channel','Interaction','addTags','interaction','then','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','[%s][TAG]\x20%s','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info'];(function(_0x48c4d8,_0x40d9eb){var _0x587110=function(_0x4c6277){while(--_0x4c6277){_0x48c4d8['push'](_0x48c4d8['shift']());}};_0x587110(++_0x40d9eb);}(_0x9c4c,0x16b));var _0xc9c4=function(_0x4a4a99,_0x48287e){_0x4a4a99=_0x4a4a99-0x0;var _0xeb6b14=_0x9c4c[_0x4a4a99];return _0xeb6b14;};'use strict';var schema=require(_0xc9c4('0x0'));var _=require(_0xc9c4('0x1'));var rpc={'chatInteraction':require(_0xc9c4('0x2')),'openchannelInteraction':require(_0xc9c4('0x3')),'smsInteraction':require(_0xc9c4('0x4')),'mailInteraction':require(_0xc9c4('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xc9c4('0x6'));var tag=schema({'tag':{'type':_0xc9c4('0x7'),'required':!![],'message':_0xc9c4('0x8')}});exports['consequence']=function(_0x1c34f1,_0x354229,_0x21cb88,_0x1785ba){return function(_0x4d8d8a){try{var _0x58d6ef={'tag':_0x354229[0x0]};var _0xaaaa28=tag[_0xc9c4('0x0')](_0x58d6ef,{'typecast':!![]});if(_0xaaaa28[_0xc9c4('0x9')]){logger[_0xc9c4('0xa')]('[%s][TAG]\x20%s',_0x1c34f1,_[_0xc9c4('0xb')](_0xaaaa28,_0xc9c4('0xc'))[_0xc9c4('0xd')](',\x20'));logger[_0xc9c4('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1c34f1);_0x4d8d8a[_0xc9c4('0xf')]();}else{var _0x406a76={'ids':[_0x354229[0x0]]};if(rpc[_0x1785ba[_0xc9c4('0x10')]+_0xc9c4('0x11')]){rpc[_0x1785ba[_0xc9c4('0x10')]+_0xc9c4('0x11')][_0xc9c4('0x12')](_0x1785ba[_0xc9c4('0x13')]['id'],_0x406a76)[_0xc9c4('0x14')](function(_0x4a8c35){logger[_0xc9c4('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x1c34f1,_0x354229[0x1],_0x1785ba[_0xc9c4('0x10')],_0x1785ba['interaction']['id']);})[_0xc9c4('0x15')](function(_0x5e5ef3){logger[_0xc9c4('0xa')]('[%s][TAG]\x20%s',_0x1c34f1,JSON['stringify'](_0x5e5ef3));logger[_0xc9c4('0xe')](_0xc9c4('0x16'),_0x1c34f1);})[_0xc9c4('0x17')](function(){_0x4d8d8a['next']();});}}}catch(_0x2962aa){logger[_0xc9c4('0xa')](_0xc9c4('0x18'),_0x1c34f1,_[_0xc9c4('0x19')](_0x2962aa)?JSON[_0xc9c4('0x1a')](_0x2962aa):_0x2962aa);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1c34f1);_0x4d8d8a[_0xc9c4('0xf')]();}};}; \ No newline at end of file +var _0xb401=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing','number','consequence','validate','length','error','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then'];(function(_0x3a2414,_0x39aeaf){var _0x3c8c04=function(_0x2fa4e6){while(--_0x2fa4e6){_0x3a2414['push'](_0x3a2414['shift']());}};_0x3c8c04(++_0x39aeaf);}(_0xb401,0x14e));var _0x1b40=function(_0x8c9608,_0x1aac60){_0x8c9608=_0x8c9608-0x0;var _0x5b3815=_0xb401[_0x8c9608];return _0x5b3815;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x1b40('0x0')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1b40('0x1')),'mailInteraction':require(_0x1b40('0x2')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x1b40('0x3'));var tag=schema({'tag':{'type':_0x1b40('0x4'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1b40('0x5')]=function(_0x18b9c1,_0x66de92,_0x345375,_0xedf997){return function(_0x12d084){try{var _0x6718ef={'tag':_0x66de92[0x0]};var _0x425033=tag[_0x1b40('0x6')](_0x6718ef,{'typecast':!![]});if(_0x425033[_0x1b40('0x7')]){logger[_0x1b40('0x8')]('[%s][TAG]\x20%s',_0x18b9c1,_['map'](_0x425033,'message')[_0x1b40('0x9')](',\x20'));logger[_0x1b40('0xa')](_0x1b40('0xb'),_0x18b9c1);_0x12d084[_0x1b40('0xc')]();}else{var _0x914851={'ids':[_0x66de92[0x0]]};if(rpc[_0xedf997[_0x1b40('0xd')]+_0x1b40('0xe')]){rpc[_0xedf997[_0x1b40('0xd')]+_0x1b40('0xe')][_0x1b40('0xf')](_0xedf997[_0x1b40('0x10')]['id'],_0x914851)[_0x1b40('0x11')](function(_0x25b091){logger[_0x1b40('0xa')](_0x1b40('0x12'),_0x18b9c1,_0x66de92[0x1],_0xedf997[_0x1b40('0xd')],_0xedf997[_0x1b40('0x10')]['id']);})[_0x1b40('0x13')](function(_0x3524c0){logger[_0x1b40('0x8')](_0x1b40('0x14'),_0x18b9c1,JSON[_0x1b40('0x15')](_0x3524c0));logger[_0x1b40('0xa')](_0x1b40('0xb'),_0x18b9c1);})['finally'](function(){_0x12d084['next']();});}}}catch(_0x2aa14a){logger[_0x1b40('0x8')](_0x1b40('0x14'),_0x18b9c1,_['isObject'](_0x2aa14a)?JSON['stringify'](_0x2aa14a):_0x2aa14a);logger[_0x1b40('0xa')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x18b9c1);_0x12d084[_0x1b40('0xc')]();}};}; \ 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 aed88b4..fb2cd8b 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 _0xc795=['includes','push','?params=','urlOnRing','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','isObject','stop','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20'];(function(_0x20589f,_0x49d229){var _0x186ea5=function(_0x53810d){while(--_0x53810d){_0x20589f['push'](_0x20589f['shift']());}};_0x186ea5(++_0x49d229);}(_0xc795,0xd1));var _0x5c79=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc795[_0x40a045];return _0x1a687c;};'use strict';var rp=require(_0x5c79('0x0'));var logger=require(_0x5c79('0x1'))(_0x5c79('0x2'));var _=require(_0x5c79('0x3'));var arr=[];exports[_0x5c79('0x4')]=function(_0x5e6b6b,_0x14bcc1){return function(_0x583319){var _0x1f1811=_0x14bcc1[0xa];var _0x2b8922=_0x14bcc1[0xb];var _0xe8b002=_0x14bcc1[0xc];var _0x366b78=_0x14bcc1[0xd];var _0x1a9a97=_0x14bcc1[0xe];var _0x2c6f68=_0x14bcc1[0xf][_0x5c79('0x5')](/\n/g,_0x5c79('0x6'));var _0x1372b7=_0x14bcc1[0x10][_0x5c79('0x5')](/\n/g,'\x20');if(!arr[_0x5c79('0x7')](_0x2b8922)){arr[_0x5c79('0x8')](_0x2b8922);var _0x922981=_0x14bcc1[0x3];var _0x2d016f=_0x14bcc1[0x4];var _0x1c1347=_0x14bcc1[0x1];var _0x1dca5e=_0x14bcc1[0x0];var _0x28bc2e={};_0x28bc2e['urlOnAnswer']=_0x14bcc1[0x8]+_0x5c79('0x9')+_0xe8b002+'|'+_0x1f1811+'|'+_0x366b78+'|'+_0x2b8922+'|'+_0x1a9a97;_0x28bc2e[_0x5c79('0xa')]=_0x14bcc1[0x7]+_0x5c79('0x9')+_0xe8b002+'|'+_0x1f1811+'|'+_0x366b78+'|'+_0x2b8922+'|'+_0x1a9a97+'|'+_0x2c6f68+'|'+_0x1372b7;_0x28bc2e['title']=_0x14bcc1[0x9];var _0x2669eb={};_0x2669eb[_0x5c79('0xb')]=_0x5c79('0xc');_0x2669eb[_0x5c79('0xd')]=_0x5c79('0xe');var _0x317285=[];_0x317285[_0x5c79('0x8')](_0x14bcc1[0x2]);_0x317285[_0x5c79('0x8')](_0x14bcc1[0x5]);_0x317285[_0x5c79('0x8')](_0x14bcc1[0x6]);_0x2669eb[_0x5c79('0xf')]=_0x317285;_0x2669eb['id']=0x1;var _0x5ef882=JSON[_0x5c79('0x10')](_0x2669eb);var _0x50f383={'encoding':_0x5c79('0x11'),'method':_0x5c79('0x12'),'timeout':0x2710,'url':_0x922981,'headers':{'Content-Type':_0x5c79('0x13')},'body':_0x5ef882};return rp(_0x50f383)['then'](function(_0x2db8dc){const _0x20720d=JSON[_0x5c79('0x14')](_0x2db8dc);if(!_0x20720d[_0x5c79('0x15')][_0x5c79('0x16')]){throw new Error(_0x5c79('0x17'));}var _0x2d369f=_0x2b8922;var _0x2c0e12=_0x5c79('0x18')+_0x1c1347+_0x5c79('0x19')+_0x1dca5e+_0x5c79('0x1a')+_0x2d369f+_0x5c79('0x1b')+JSON[_0x5c79('0x10')](_0x28bc2e);var _0x3229b2=_0x2d016f+'?'+_0x2c0e12;return rp(_0x3229b2);})[_0x5c79('0x1c')](function(_0xc3e531){logger['info'](_0x5c79('0x1d'),_0x5e6b6b,_0xc3e531);_0x583319['stop']();})['catch'](function(_0x12bc7b){logger[_0x5c79('0x1e')](_0x5c79('0x1f'),_0x5e6b6b,_[_0x5c79('0x20')](_0x12bc7b)?JSON['stringify'](_0x12bc7b):_0x12bc7b);_0x583319[_0x5c79('0x21')]();});}else{logger[_0x5c79('0x22')](_0x5c79('0x23'),_0x5e6b6b);_0x583319['next']();}};}; \ No newline at end of file +var _0x3b42=['routing','lodash','\x20-\x20','replace','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','method','login','stringify','utf8','POST','application/json-rpc','then','parse','logged','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x3b42,0x106));var _0x23b4=function(_0x23b157,_0x459781){_0x23b157=_0x23b157-0x0;var _0x4dbbcb=_0x3b42[_0x23b157];return _0x4dbbcb;};'use strict';var rp=require(_0x23b4('0x0'));var logger=require(_0x23b4('0x1'))(_0x23b4('0x2'));var _=require(_0x23b4('0x3'));var arr=[];exports['consequence']=function(_0x1c0b46,_0x53c50d){return function(_0x17faae){var _0x442267=_0x53c50d[0xa];var _0x313cbe=_0x53c50d[0xb];var _0x2be24f=_0x53c50d[0xc];var _0x18e810=_0x53c50d[0xd];var _0x106205=_0x53c50d[0xe];var _0x4d6251=_0x53c50d[0xf]['replace'](/\n/g,_0x23b4('0x4'));var _0x522200=_0x53c50d[0x10][_0x23b4('0x5')](/\n/g,'\x20');if(!arr[_0x23b4('0x6')](_0x313cbe)){arr[_0x23b4('0x7')](_0x313cbe);var _0x3737ce=_0x53c50d[0x3];var _0x5ac044=_0x53c50d[0x4];var _0x81bd71=_0x53c50d[0x1];var _0x240a96=_0x53c50d[0x0];var _0x3f6cf0={};_0x3f6cf0[_0x23b4('0x8')]=_0x53c50d[0x8]+'?params='+_0x2be24f+'|'+_0x442267+'|'+_0x18e810+'|'+_0x313cbe+'|'+_0x106205;_0x3f6cf0[_0x23b4('0x9')]=_0x53c50d[0x7]+_0x23b4('0xa')+_0x2be24f+'|'+_0x442267+'|'+_0x18e810+'|'+_0x313cbe+'|'+_0x106205+'|'+_0x4d6251+'|'+_0x522200;_0x3f6cf0[_0x23b4('0xb')]=_0x53c50d[0x9];var _0x111ded={};_0x111ded[_0x23b4('0xc')]='2.0';_0x111ded[_0x23b4('0xd')]=_0x23b4('0xe');var _0x3bedc2=[];_0x3bedc2[_0x23b4('0x7')](_0x53c50d[0x2]);_0x3bedc2['push'](_0x53c50d[0x5]);_0x3bedc2['push'](_0x53c50d[0x6]);_0x111ded['params']=_0x3bedc2;_0x111ded['id']=0x1;var _0x525c27=JSON[_0x23b4('0xf')](_0x111ded);var _0x58c477={'encoding':_0x23b4('0x10'),'method':_0x23b4('0x11'),'timeout':0x2710,'url':_0x3737ce,'headers':{'Content-Type':_0x23b4('0x12')},'body':_0x525c27};return rp(_0x58c477)[_0x23b4('0x13')](function(_0x3ff494){const _0x3d6fc0=JSON[_0x23b4('0x14')](_0x3ff494);if(!_0x3d6fc0['result'][_0x23b4('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x47215c=_0x313cbe;var _0xf3f134='channelId='+_0x81bd71+_0x23b4('0x16')+_0x240a96+_0x23b4('0x17')+_0x47215c+_0x23b4('0x18')+JSON[_0x23b4('0xf')](_0x3f6cf0);var _0x378baa=_0x5ac044+'?'+_0xf3f134;return rp(_0x378baa);})[_0x23b4('0x13')](function(_0xc71ed9){logger['info'](_0x23b4('0x19'),_0x1c0b46,_0xc71ed9);_0x17faae[_0x23b4('0x1a')]();})[_0x23b4('0x1b')](function(_0x32a2c2){logger['error'](_0x23b4('0x1c'),_0x1c0b46,_[_0x23b4('0x1d')](_0x32a2c2)?JSON[_0x23b4('0xf')](_0x32a2c2):_0x32a2c2);_0x17faae[_0x23b4('0x1a')]();});}else{logger[_0x23b4('0x1e')](_0x23b4('0x1f'),_0x1c0b46);_0x17faae[_0x23b4('0x20')]();}};}; \ 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 8e13074..9c02f3b 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x566633,_0x37b705){var _0x4fb910=function(_0x5eade2){while(--_0x5eade2){_0x566633['push'](_0x566633['shift']());}};_0x4fb910(++_0x37b705);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0xf8f120,_0x1901f1){var _0x2e7a89=function(_0x3e9a53){while(--_0x3e9a53){_0xf8f120['push'](_0xf8f120['shift']());}};_0x2e7a89(++_0x1901f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 b1c03f4..24d6553 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 _0x593e=['whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','listen','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','isArray','length','app','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','tvox','account','ContactId','body','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','stringify','matchPath','emit','complete','error','stack','agent','agents','busy','end','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues'];(function(_0x1091a7,_0xc5239c){var _0x5a78d4=function(_0x2d398f){while(--_0x2d398f){_0x1091a7['push'](_0x1091a7['shift']());}};_0x5a78d4(++_0xc5239c);}(_0x593e,0xcb));var _0xe593=function(_0x59ec75,_0x2d6c26){_0x59ec75=_0x59ec75-0x0;var _0x39c903=_0x593e[_0x59ec75];return _0x39c903;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var fs=require('fs');var jayson=require(_0xe593('0x3'));var BPromise=require(_0xe593('0x4'));var uuid=require(_0xe593('0x5'));var utils=require(_0xe593('0x6'));var config=require(_0xe593('0x7'));var logger=require('../../../config/logger')(_0xe593('0x8'));var rpc={'openchannelQueueReport':require(_0xe593('0x9')),'mailQueueReport':require(_0xe593('0xa')),'chatQueueReport':require(_0xe593('0xb')),'smsQueueReport':require(_0xe593('0xc')),'faxQueueReport':require(_0xe593('0xd')),'whatsappQueueReport':require(_0xe593('0xe'))};var RuleEngine=require(_0xe593('0xf'));function getId(_0x169c08,_0x265099,_0x51b862){return util[_0xe593('0x10')](_0xe593('0x11'),_0x169c08,_0x265099||0x0,_0x51b862||0x0);}function getIntervals(_0x38d977,_0x5ba75c){var _0x5f1222=[];if(!_[_0xe593('0x12')](_0x5ba75c[_0xe593('0x13')])&&!_[_0xe593('0x12')](_0x38d977[_0x5ba75c['IntervalId']])&&!_[_0xe593('0x12')](_0x38d977[_0x5ba75c[_0xe593('0x13')]][_0xe593('0x14')])){_0x5f1222=_[_0xe593('0x15')](_0x38d977[_0x5ba75c[_0xe593('0x13')]][_0xe593('0x14')],_0xe593('0x16'));}else if(!_[_0xe593('0x12')](_0x5ba75c[_0xe593('0x16')])){_0x5f1222=[_0x5ba75c[_0xe593('0x16')]];}return _0x5f1222;}exports['listen']=function(_0x2907e4){_0x2907e4[_0xe593('0x17')]={};return new BPromise(function(_0x59f7c4,_0x38418c){var _0x44837b={'Start':function(_0x5d4c6a){var _0x2ae9b6=this;return new Promise(function(_0x40416c,_0x1c6de3){if(_0x5d4c6a){try{var _0x2d525c=[];var _0x3408ec=getId(_0x5d4c6a[_0xe593('0x18')],_0x5d4c6a['message']?_0x5d4c6a[_0xe593('0x19')]['id']:0x0,_0x5d4c6a[_0xe593('0x1a')]?_0x5d4c6a['interaction']['id']:0x0);if(_0x5d4c6a[_0xe593('0x1b')]&&_[_0xe593('0x1c')](_0x5d4c6a['applications'])&&_0x5d4c6a[_0xe593('0x1b')][_0xe593('0x1d')]){for(var _0x862672=0x0;_0x862672<_0x5d4c6a[_0xe593('0x1b')][_0xe593('0x1d')];_0x862672+=0x1){var _0x28ee05=_0x5d4c6a[_0xe593('0x1b')][_0x862672];if(fs['existsSync'](path['join'](__dirname,_0xe593('0x1b'),_0x28ee05['app']+'.js'))){var _0x1bb8e8=[];switch(_0x28ee05[_0xe593('0x1e')]['toLowerCase']()){case _0xe593('0x1f'):var _0x563053=_0x28ee05[_0xe593('0x20')][_0xe593('0x21')](',');if(_0x5d4c6a[_0xe593('0x18')]===_0xe593('0x22')){_0x1bb8e8[_0xe593('0x23')](_0x563053[0x0]);_0x1bb8e8[_0xe593('0x23')](_0x563053[0x1]);_0x1bb8e8[_0xe593('0x23')](_0x563053[_0xe593('0x24')](0x2,_0x563053['length'])[_0xe593('0x25')](','));}else{_0x1bb8e8[_0xe593('0x23')](_0x563053[0x0]);_0x1bb8e8['push'](_0x563053['slice'](0x1,_0x563053[_0xe593('0x1d')])[_0xe593('0x25')](','));}break;case _0xe593('0x26'):var _0x43699d=_0x28ee05[_0xe593('0x20')][_0xe593('0x21')](',');_0x1bb8e8['push'](_0x43699d[0x0]);_0x1bb8e8[_0xe593('0x23')](_0x43699d[0x1]);_0x1bb8e8['push'](_0x43699d[_0xe593('0x24')](0x2,_0x43699d[_0xe593('0x1d')])['join'](','));break;case _0xe593('0x27'):var _0x561a01=_0x28ee05[_0xe593('0x20')][_0xe593('0x21')](',');_0x1bb8e8[_0xe593('0x23')](_0x561a01[0x0]);_0x1bb8e8['push'](_0x561a01[0x1]);_0x1bb8e8[_0xe593('0x23')](_0x561a01[0x2]);_0x1bb8e8[_0xe593('0x23')](_0x561a01[0x3]);_0x1bb8e8[_0xe593('0x23')](_0x561a01[_0xe593('0x24')](0x4,_0x561a01[_0xe593('0x1d')])[_0xe593('0x25')](','));break;case _0xe593('0x28'):var _0x4efc93=_0x28ee05[_0xe593('0x20')][_0xe593('0x21')](',');_0x1bb8e8['push'](_0x4efc93[0x0]);_0x1bb8e8[_0xe593('0x23')](_0x4efc93[0x1]);_0x1bb8e8['push'](_0x4efc93[0x2]);_0x1bb8e8[_0xe593('0x23')](_0x4efc93[0x3]);_0x1bb8e8[_0xe593('0x23')](_0x4efc93[_0xe593('0x24')](0x4,_0x4efc93[_0xe593('0x1d')])[_0xe593('0x25')](','));break;case _0xe593('0x19'):_0x1bb8e8[_0xe593('0x23')](_0x28ee05[_0xe593('0x20')]);break;case _0xe593('0x29'):_0x1bb8e8[_0xe593('0x23')](_0x28ee05['TagId']);_0x1bb8e8[_0xe593('0x23')](_0x28ee05[_0xe593('0x20')]);break;case _0xe593('0x2a'):var _0x5a55c0=utils['getMustacheRender'](_0x5d4c6a[_0xe593('0x2b')]['notificationTemplate'],_0x5d4c6a);var _0x232bf1=_0x28ee05[_0xe593('0x20')][_0xe593('0x21')](',');_0x1bb8e8[_0xe593('0x23')](_0x232bf1[0x0]);_0x1bb8e8[_0xe593('0x23')](_0x232bf1[0x1]);_0x1bb8e8[_0xe593('0x23')](_0x232bf1[0x2]);_0x1bb8e8[_0xe593('0x23')](_0x232bf1[0x3]);_0x1bb8e8['push'](_0x232bf1[0x4]);_0x1bb8e8['push'](_0x232bf1[0x5]);_0x1bb8e8[_0xe593('0x23')](_0x232bf1[0x6]);_0x1bb8e8['push'](_0x232bf1[0x7]);_0x1bb8e8[_0xe593('0x23')](_0x232bf1[0x8]);_0x1bb8e8['push'](_0x232bf1[0x9]);_0x1bb8e8[_0xe593('0x23')](_0x232bf1[0xa]);_0x1bb8e8['push'](_0x5d4c6a['interaction']['id']);_0x1bb8e8[_0xe593('0x23')](_0x5d4c6a[_0xe593('0x19')]['id']);_0x1bb8e8[_0xe593('0x23')](_0x28ee05['ChatWebsiteId']);_0x1bb8e8['push'](_0x5d4c6a['interaction'][_0xe593('0x2c')]);_0x1bb8e8['push'](_0x5d4c6a[_0xe593('0x2d')][_0xe593('0x2d')]);_0x1bb8e8[_0xe593('0x23')](_0x5a55c0);break;default:_0x1bb8e8=_[_0xe593('0x12')](_0x28ee05['appdata'])?[]:_0x28ee05[_0xe593('0x20')]['split'](',');}var _0x36c08e={'id':util['format']('%s:%s:%s',_0x3408ec,_0x28ee05['id'],_0x28ee05['app']),'condition':require(_0xe593('0x2e'))['condition'](_0x3408ec,getIntervals(_0x2907e4[_0xe593('0x2f')],_0x28ee05),_0x2907e4),'consequence':require(_0xe593('0x30')+_0x28ee05[_0xe593('0x1e')])['consequence'](_0x3408ec,_0x1bb8e8,_0x2907e4,_0x5d4c6a),'p':_0x28ee05[_0xe593('0x31')]||0x0};logger[_0xe593('0x32')](_0xe593('0x33'),_0x36c08e['id'],_0xe593('0x34'),getIntervals(_0x2907e4[_0xe593('0x2f')],_0x28ee05)[_0xe593('0x25')](_0xe593('0x35')));_0x2d525c[_0xe593('0x23')](_0x36c08e);}else{logger['error'](_0xe593('0x36'),path[_0xe593('0x25')](__dirname,_0xe593('0x1b'),_0x28ee05[_0xe593('0x1e')]+_0xe593('0x37')));}}_0x2907e4['rules'][_0x3408ec]=new RuleEngine(_0x2d525c);_0x2907e4['rules'][_0x3408ec][_0xe593('0x38')](_0x5d4c6a,function(_0x380429){logger[_0xe593('0x32')]('Applications\x20executed',JSON[_0xe593('0x39')](_0x380429[_0xe593('0x3a')]));if(_0x2907e4['rules'][_0x3408ec]){_0x2907e4['rules'][_0x3408ec][_0xe593('0x3b')](_0xe593('0x3c'));}});return _0x40416c({'code':0xc8,'message':_0x5d4c6a});}else{logger[_0xe593('0x32')]('No\x20applications\x20to\x20execute');return _0x40416c({'code':0xc8,'message':_0x5d4c6a});}}catch(_0x2e88bf){logger[_0xe593('0x3d')](_0x2e88bf[_0xe593('0x3e')]);return _0x1c6de3(_0x2ae9b6[_0xe593('0x3d')](0x1f4,_0x2e88bf));}}return _0x1c6de3('routing\x20is\x20empty');});},'AcceptMessage':function(_0x552489){var _0x4a7434=this;return new Promise(function(_0x4c8d14,_0xed99bb){if(_0x552489['agent']&&_0x552489[_0xe593('0x3f')]['id']){if(_0x2907e4[_0xe593('0x40')][_0x552489[_0xe593('0x3f')]['id']]){_0x2907e4[_0xe593('0x40')][_0x552489[_0xe593('0x3f')]['id']][_0xe593('0x41')]=![];_0x2907e4[_0xe593('0x40')][_0x552489[_0xe593('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x552489[_0xe593('0x19')]&&_0x552489[_0xe593('0x19')]['id']){try{var _0x4118a5=getId(_0x552489['channel'],_0x552489[_0xe593('0x19')]?_0x552489['message']['id']:0x0,_0x552489[_0xe593('0x1a')]?_0x552489[_0xe593('0x1a')]['id']:0x0);if(_0x2907e4[_0xe593('0x17')][_0x4118a5]){_0x2907e4['rules'][_0x4118a5]['emit'](_0xe593('0x42'));if(rpc[_0x552489[_0xe593('0x18')]+'QueueReport']){rpc[_0x552489['channel']+'QueueReport']['update'](_0x4118a5,{'UserId':_0x552489['message'][_0xe593('0x43')]})[_0xe593('0x44')](function(_0x1ed8b5){logger[_0xe593('0x3d')](_0xe593('0x45'));});}}return _0x4c8d14({'code':0xc8,'message':_0x552489});}catch(_0x44201e){logger[_0xe593('0x3d')](_0x44201e[_0xe593('0x3e')]);return _0xed99bb(_0x4a7434[_0xe593('0x3d')](0x1f4,_0x44201e));}}logger[_0xe593('0x3d')](_0xe593('0x46'));return _0xed99bb(_0x4a7434[_0xe593('0x3d')](0x1f4,_0xe593('0x46')));});},'RejectMessage':function(_0x171350){var _0xa25aa8=this;return new Promise(function(_0x46544d,_0x5d60c3){if(_0x171350[_0xe593('0x3f')]&&_0x171350[_0xe593('0x3f')]['id']){try{if(_0x2907e4[_0xe593('0x40')][_0x171350[_0xe593('0x3f')]['id']]){_0x2907e4[_0xe593('0x40')][_0x171350[_0xe593('0x3f')]['id']][_0xe593('0x41')]=![];_0x2907e4[_0xe593('0x40')][_0x171350[_0xe593('0x3f')]['id']][_0xe593('0x47')]=undefined;}return _0x46544d({'code':0xc8,'message':_0x171350});}catch(_0x37373c){logger[_0xe593('0x3d')](_0x37373c[_0xe593('0x3e')]);return _0x5d60c3(_0xa25aa8[_0xe593('0x3d')](0x1f4,_0x37373c));}}logger[_0xe593('0x3d')]('message\x20is\x20empty');return _0x5d60c3(_0xa25aa8[_0xe593('0x3d')](0x1f4,_0xe593('0x46')));});},'AbandonInteraction':function(_0x142d0f){var _0x24d061=this;return new Promise(function(_0x3d6ed8,_0x5e1972){if(_0x142d0f['channel']&&_0x142d0f[_0xe593('0x1a')]&&_0x142d0f[_0xe593('0x1a')]['id']){try{var _0x318dd2=getId(_0x142d0f[_0xe593('0x18')],_0x142d0f[_0xe593('0x19')]?_0x142d0f[_0xe593('0x19')]['id']:0x0,_0x142d0f[_0xe593('0x1a')]?_0x142d0f['interaction']['id']:0x0);if(_0x2907e4['rules'][_0x318dd2]){_0x2907e4[_0xe593('0x17')][_0x318dd2][_0xe593('0x3b')]('end');}return _0x3d6ed8({'code':0xc8,'message':_0x142d0f});}catch(_0x103403){logger[_0xe593('0x3d')](_0x103403[_0xe593('0x3e')]);return _0x5e1972(_0x24d061[_0xe593('0x3d')](0x1f4,_0x103403));}}logger[_0xe593('0x3d')](_0xe593('0x46'));return _0x5e1972(_0x24d061[_0xe593('0x3d')](0x1f4,_0xe593('0x46')));});},'AgentCapacity':function(_0x1dc796){var _0x3316b8=this;return new Promise(function(_0x5b3fcc,_0x36f38e){if(_0x2907e4[_0xe593('0x40')][_0xe593('0x48')](_0x1dc796['id'])){for(var _0x1f1096 in _0x1dc796[_0xe593('0x49')]){if(_0x1dc796[_0xe593('0x49')][_0xe593('0x48')](_0x1f1096)){if(_0x2907e4['agents'][_0x1dc796['id']][_0xe593('0x48')](_0x1f1096+_0xe593('0x4a'))){_0x2907e4[_0xe593('0x40')][_0x1dc796['id']][_0x1f1096+_0xe593('0x4a')]=parseInt(_0x1dc796['capacity'][_0x1f1096],0xa);}}}_0x2907e4[_0xe593('0x40')][_0x1dc796['id']][_0xe593('0x4b')]();return _0x5b3fcc({'code':0xc8,'message':_0x2907e4[_0xe593('0x40')][_0x1dc796['id']]});}else{return _0x36f38e(_0x3316b8[_0xe593('0x3d')](0x1f4,_0xe593('0x4c')));}});},'Agents':function(_0x54a89d){return new Promise(function(_0x366dec,_0x2cca0b){var _0x3f61e4=_[_0xe593('0x4d')](_0x2907e4[_0xe593('0x40')]);_0x366dec({'count':_0x3f61e4[_0xe593('0x1d')],'rows':_0x3f61e4});});},'ChatQueues':function(_0x1f1a56){return new Promise(function(_0x7165df,_0x58ec07){var _0x2145c0=[];for(var _0x16f9fc in _0x2907e4[_0xe593('0x4e')]){if(_0x2907e4[_0xe593('0x4e')][_0xe593('0x48')](_0x16f9fc)){var _0x9f1813=_0x2907e4[_0xe593('0x4e')][_0x16f9fc];var _0x258cdf={'id':_0x9f1813['id'],'available':_0x9f1813[_0xe593('0x4f')],'loggedIn':_0x9f1813[_0xe593('0x50')],'name':_0x9f1813['name'],'paused':_0x9f1813[_0xe593('0x51')],'waiting':_0x9f1813[_0xe593('0x52')]};_0x2145c0[_0xe593('0x23')](_0x258cdf);}}_0x7165df({'count':_0x2145c0['length'],'rows':_0x2145c0});});},'MailQueues':function(_0x3310d3){return new Promise(function(_0x36e92d,_0x4001b7){var _0x197f3a=[];for(var _0x27c931 in _0x2907e4['mailQueues']){if(_0x2907e4[_0xe593('0x53')][_0xe593('0x48')](_0x27c931)){var _0x4c652e=_0x2907e4[_0xe593('0x53')][_0x27c931];var _0x344804={'id':_0x4c652e['id'],'available':_0x4c652e[_0xe593('0x4f')],'loggedIn':_0x4c652e[_0xe593('0x50')],'name':_0x4c652e['name'],'paused':_0x4c652e[_0xe593('0x51')],'waiting':_0x4c652e[_0xe593('0x52')]};_0x197f3a[_0xe593('0x23')](_0x344804);}}_0x36e92d({'count':_0x197f3a['length'],'rows':_0x197f3a});});},'OpenchannelQueues':function(_0x43dcb0){return new Promise(function(_0x43fe0b,_0x2ec8e7){var _0x5bbf3d=[];for(var _0xb6846a in _0x2907e4[_0xe593('0x54')]){if(_0x2907e4[_0xe593('0x54')][_0xe593('0x48')](_0xb6846a)){var _0xe89d7e=_0x2907e4['openchannelQueues'][_0xb6846a];var _0x2f81d2={'id':_0xe89d7e['id'],'available':_0xe89d7e[_0xe593('0x4f')],'loggedIn':_0xe89d7e[_0xe593('0x50')],'name':_0xe89d7e[_0xe593('0x55')],'paused':_0xe89d7e[_0xe593('0x51')],'waiting':_0xe89d7e[_0xe593('0x52')]};_0x5bbf3d[_0xe593('0x23')](_0x2f81d2);}}_0x43fe0b({'count':_0x5bbf3d[_0xe593('0x1d')],'rows':_0x5bbf3d});});},'SmsQueues':function(_0x3e6d23){return new Promise(function(_0xb7d821,_0x44d868){var _0x43f946=[];for(var _0x3ce0e7 in _0x2907e4[_0xe593('0x56')]){if(_0x2907e4['smsQueues'][_0xe593('0x48')](_0x3ce0e7)){var _0xc9e06f=_0x2907e4[_0xe593('0x56')][_0x3ce0e7];var _0xa9b0bd={'id':_0xc9e06f['id'],'available':_0xc9e06f[_0xe593('0x4f')],'loggedIn':_0xc9e06f[_0xe593('0x50')],'name':_0xc9e06f[_0xe593('0x55')],'paused':_0xc9e06f[_0xe593('0x51')],'waiting':_0xc9e06f['waiting']};_0x43f946['push'](_0xa9b0bd);}}_0xb7d821({'count':_0x43f946['length'],'rows':_0x43f946});});},'FaxQueues':function(_0x3baa10){return new Promise(function(_0x993a93,_0x45f9d5){var _0x48edd1=[];for(var _0x5c3134 in _0x2907e4[_0xe593('0x57')]){if(_0x2907e4['faxQueues'][_0xe593('0x48')](_0x5c3134)){var _0x27b8cf=_0x2907e4[_0xe593('0x57')][_0x5c3134];var _0x58c6ef={'id':_0x27b8cf['id'],'available':_0x27b8cf[_0xe593('0x4f')],'loggedIn':_0x27b8cf[_0xe593('0x50')],'name':_0x27b8cf[_0xe593('0x55')],'paused':_0x27b8cf[_0xe593('0x51')],'waiting':_0x27b8cf[_0xe593('0x52')]};_0x48edd1[_0xe593('0x23')](_0x58c6ef);}}_0x993a93({'count':_0x48edd1[_0xe593('0x1d')],'rows':_0x48edd1});});},'WhatsappQueues':function(_0x4fe0b7){return new Promise(function(_0x3007ea,_0x1d619e){var _0x5c4417=[];for(var _0x3709bf in _0x2907e4[_0xe593('0x58')]){if(_0x2907e4[_0xe593('0x58')]['hasOwnProperty'](_0x3709bf)){var _0x2e2f9b=_0x2907e4[_0xe593('0x58')][_0x3709bf];var _0x1d905c={'id':_0x2e2f9b['id'],'available':_0x2e2f9b[_0xe593('0x4f')],'loggedIn':_0x2e2f9b[_0xe593('0x50')],'name':_0x2e2f9b[_0xe593('0x55')],'paused':_0x2e2f9b['paused'],'waiting':_0x2e2f9b['waiting']};_0x5c4417[_0xe593('0x23')](_0x1d905c);}}_0x3007ea({'count':_0x5c4417['length'],'rows':_0x5c4417});});},'ChatQueuesWaitingInteractions':function(_0x5bbdb7){return new Promise(function(_0x594404,_0x4d6718){var _0x1fae18=_[_0xe593('0x4d')](_0x2907e4[_0xe593('0x59')]);_0x594404({'count':_0x1fae18[_0xe593('0x1d')],'rows':_0x1fae18});});},'MailQueuesWaitingInteractions':function(_0x56c586){return new Promise(function(_0x5de702,_0x3b48bb){var _0x42837c=_[_0xe593('0x4d')](_0x2907e4[_0xe593('0x5a')]);_0x5de702({'count':_0x42837c['length'],'rows':_0x42837c});});},'OpenchannelQueuesWaitingInteractions':function(_0x20574a){return new Promise(function(_0x328377,_0x309b9c){var _0x4f7b9c=_[_0xe593('0x4d')](_0x2907e4[_0xe593('0x5b')]);_0x328377({'count':_0x4f7b9c['length'],'rows':_0x4f7b9c});});},'SmsQueuesWaitingInteractions':function(_0xc0904c){return new Promise(function(_0x1061dd,_0x5566e0){var _0x5bb9e2=_['values'](_0x2907e4['smsQueuesWaitingInteractions']);_0x1061dd({'count':_0x5bb9e2['length'],'rows':_0x5bb9e2});});},'FaxQueuesWaitingInteractions':function(_0x58b6b3){return new Promise(function(_0x3d6417,_0x51a588){var _0x25bf66=_[_0xe593('0x4d')](_0x2907e4[_0xe593('0x5c')]);_0x3d6417({'count':_0x25bf66['length'],'rows':_0x25bf66});});},'WhatsappQueuesWaitingInteractions':function(_0x47ac27){return new Promise(function(_0x2efa5a,_0x40504d){var _0x3db9f1=_[_0xe593('0x4d')](_0x2907e4['whatsappQueuesWaitingInteractions']);_0x2efa5a({'count':_0x3db9f1['length'],'rows':_0x3db9f1});});}};var _0x12f9c4=jayson[_0xe593('0x5d')](_0x44837b)['http']();_0x12f9c4['on'](_0xe593('0x3d'),function(_0x36916a){logger[_0xe593('0x3d')](JSON[_0xe593('0x39')](_0x36916a));return _0x38418c(_0x36916a);});_0x12f9c4[_0xe593('0x5e')](0x232c,'127.0.0.1',function(){console[_0xe593('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x59f7c4(_0xe593('0x60')+0x232c);});});}; \ No newline at end of file +var _0x0fd9=['amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','intervals','./applications/','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','stack','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2'];(function(_0x3a40a2,_0x2aa75f){var _0x127963=function(_0x3fc03b){while(--_0x3fc03b){_0x3a40a2['push'](_0x3a40a2['shift']());}};_0x127963(++_0x2aa75f);}(_0x0fd9,0xa3));var _0x90fd=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x0fd9[_0x403c8d];return _0x4ca60d;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var fs=require('fs');var jayson=require(_0x90fd('0x2'));var BPromise=require(_0x90fd('0x3'));var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var rpc={'openchannelQueueReport':require(_0x90fd('0x7')),'mailQueueReport':require(_0x90fd('0x8')),'chatQueueReport':require(_0x90fd('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x90fd('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x5a604a,_0x2acef7,_0x1becf2){return util['format'](_0x90fd('0xb'),_0x5a604a,_0x2acef7||0x0,_0x1becf2||0x0);}function getIntervals(_0x464236,_0x3c0592){var _0x3262f6=[];if(!_[_0x90fd('0xc')](_0x3c0592[_0x90fd('0xd')])&&!_[_0x90fd('0xc')](_0x464236[_0x3c0592[_0x90fd('0xd')]])&&!_[_0x90fd('0xc')](_0x464236[_0x3c0592['IntervalId']][_0x90fd('0xe')])){_0x3262f6=_[_0x90fd('0xf')](_0x464236[_0x3c0592['IntervalId']][_0x90fd('0xe')],_0x90fd('0x10'));}else if(!_[_0x90fd('0xc')](_0x3c0592['interval'])){_0x3262f6=[_0x3c0592[_0x90fd('0x10')]];}return _0x3262f6;}exports['listen']=function(_0x1cae40){_0x1cae40[_0x90fd('0x11')]={};return new BPromise(function(_0x18bdb6,_0x1b3f3b){var _0x3c5da8={'Start':function(_0x442a19){var _0x296a64=this;return new Promise(function(_0x4eb953,_0x4f6b7b){if(_0x442a19){try{var _0x1e1cea=[];var _0x43d804=getId(_0x442a19['channel'],_0x442a19[_0x90fd('0x12')]?_0x442a19[_0x90fd('0x12')]['id']:0x0,_0x442a19[_0x90fd('0x13')]?_0x442a19['interaction']['id']:0x0);if(_0x442a19[_0x90fd('0x14')]&&_[_0x90fd('0x15')](_0x442a19[_0x90fd('0x14')])&&_0x442a19[_0x90fd('0x14')][_0x90fd('0x16')]){for(var _0x58866f=0x0;_0x58866f<_0x442a19[_0x90fd('0x14')][_0x90fd('0x16')];_0x58866f+=0x1){var _0x187cf1=_0x442a19[_0x90fd('0x14')][_0x58866f];if(fs[_0x90fd('0x17')](path[_0x90fd('0x18')](__dirname,_0x90fd('0x14'),_0x187cf1[_0x90fd('0x19')]+_0x90fd('0x1a')))){var _0x493c26=[];switch(_0x187cf1[_0x90fd('0x19')][_0x90fd('0x1b')]()){case _0x90fd('0x1c'):var _0x1b47e5=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');if(_0x442a19[_0x90fd('0x1f')]===_0x90fd('0x20')){_0x493c26['push'](_0x1b47e5[0x0]);_0x493c26[_0x90fd('0x21')](_0x1b47e5[0x1]);_0x493c26['push'](_0x1b47e5[_0x90fd('0x22')](0x2,_0x1b47e5[_0x90fd('0x16')])[_0x90fd('0x18')](','));}else{_0x493c26[_0x90fd('0x21')](_0x1b47e5[0x0]);_0x493c26[_0x90fd('0x21')](_0x1b47e5['slice'](0x1,_0x1b47e5[_0x90fd('0x16')])[_0x90fd('0x18')](','));}break;case _0x90fd('0x23'):var _0x1cdc38=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');_0x493c26['push'](_0x1cdc38[0x0]);_0x493c26['push'](_0x1cdc38[0x1]);_0x493c26[_0x90fd('0x21')](_0x1cdc38[_0x90fd('0x22')](0x2,_0x1cdc38[_0x90fd('0x16')])[_0x90fd('0x18')](','));break;case _0x90fd('0x24'):var _0x59b3e8=_0x187cf1['appdata'][_0x90fd('0x1e')](',');_0x493c26[_0x90fd('0x21')](_0x59b3e8[0x0]);_0x493c26[_0x90fd('0x21')](_0x59b3e8[0x1]);_0x493c26[_0x90fd('0x21')](_0x59b3e8[0x2]);_0x493c26['push'](_0x59b3e8[0x3]);_0x493c26['push'](_0x59b3e8[_0x90fd('0x22')](0x4,_0x59b3e8[_0x90fd('0x16')])[_0x90fd('0x18')](','));break;case _0x90fd('0x25'):var _0x5b64ec=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x0]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x1]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x2]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[0x3]);_0x493c26[_0x90fd('0x21')](_0x5b64ec[_0x90fd('0x22')](0x4,_0x5b64ec[_0x90fd('0x16')])[_0x90fd('0x18')](','));break;case _0x90fd('0x12'):_0x493c26[_0x90fd('0x21')](_0x187cf1[_0x90fd('0x1d')]);break;case _0x90fd('0x26'):_0x493c26[_0x90fd('0x21')](_0x187cf1[_0x90fd('0x27')]);_0x493c26['push'](_0x187cf1[_0x90fd('0x1d')]);break;case _0x90fd('0x28'):var _0x8b5ddc=utils[_0x90fd('0x29')](_0x442a19[_0x90fd('0x2a')][_0x90fd('0x2b')],_0x442a19);var _0x35eae2=_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');_0x493c26[_0x90fd('0x21')](_0x35eae2[0x0]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x1]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x2]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x3]);_0x493c26['push'](_0x35eae2[0x4]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x5]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x6]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x7]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0x8]);_0x493c26['push'](_0x35eae2[0x9]);_0x493c26[_0x90fd('0x21')](_0x35eae2[0xa]);_0x493c26[_0x90fd('0x21')](_0x442a19[_0x90fd('0x13')]['id']);_0x493c26['push'](_0x442a19['message']['id']);_0x493c26[_0x90fd('0x21')](_0x187cf1[_0x90fd('0x2c')]);_0x493c26[_0x90fd('0x21')](_0x442a19[_0x90fd('0x13')][_0x90fd('0x2d')]);_0x493c26[_0x90fd('0x21')](_0x442a19[_0x90fd('0x2e')][_0x90fd('0x2e')]);_0x493c26[_0x90fd('0x21')](_0x8b5ddc);break;default:_0x493c26=_[_0x90fd('0xc')](_0x187cf1[_0x90fd('0x1d')])?[]:_0x187cf1[_0x90fd('0x1d')][_0x90fd('0x1e')](',');}var _0x47856d={'id':util[_0x90fd('0x2f')](_0x90fd('0x30'),_0x43d804,_0x187cf1['id'],_0x187cf1[_0x90fd('0x19')]),'condition':require(_0x90fd('0x31'))['condition'](_0x43d804,getIntervals(_0x1cae40[_0x90fd('0x32')],_0x187cf1),_0x1cae40),'consequence':require(_0x90fd('0x33')+_0x187cf1[_0x90fd('0x19')])['consequence'](_0x43d804,_0x493c26,_0x1cae40,_0x442a19),'p':_0x187cf1['priority']||0x0};logger['info'](_0x90fd('0x34'),_0x47856d['id'],_0x90fd('0x35'),getIntervals(_0x1cae40[_0x90fd('0x32')],_0x187cf1)[_0x90fd('0x18')](_0x90fd('0x36')));_0x1e1cea[_0x90fd('0x21')](_0x47856d);}else{logger[_0x90fd('0x37')](_0x90fd('0x38'),path[_0x90fd('0x18')](__dirname,_0x90fd('0x14'),_0x187cf1[_0x90fd('0x19')]+_0x90fd('0x1a')));}}_0x1cae40[_0x90fd('0x11')][_0x43d804]=new RuleEngine(_0x1e1cea);_0x1cae40[_0x90fd('0x11')][_0x43d804][_0x90fd('0x39')](_0x442a19,function(_0x50b722){logger['info'](_0x90fd('0x3a'),JSON[_0x90fd('0x3b')](_0x50b722[_0x90fd('0x3c')]));if(_0x1cae40['rules'][_0x43d804]){_0x1cae40['rules'][_0x43d804][_0x90fd('0x3d')](_0x90fd('0x3e'));}});return _0x4eb953({'code':0xc8,'message':_0x442a19});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x4eb953({'code':0xc8,'message':_0x442a19});}}catch(_0x3f2769){logger[_0x90fd('0x37')](_0x3f2769['stack']);return _0x4f6b7b(_0x296a64['error'](0x1f4,_0x3f2769));}}return _0x4f6b7b(_0x90fd('0x3f'));});},'AcceptMessage':function(_0x24c640){var _0x169832=this;return new Promise(function(_0x5de9af,_0x1b0e03){if(_0x24c640[_0x90fd('0x40')]&&_0x24c640['agent']['id']){if(_0x1cae40['agents'][_0x24c640['agent']['id']]){_0x1cae40[_0x90fd('0x41')][_0x24c640[_0x90fd('0x40')]['id']]['busy']=![];_0x1cae40[_0x90fd('0x41')][_0x24c640[_0x90fd('0x40')]['id']][_0x90fd('0x42')]=undefined;}}if(_0x24c640[_0x90fd('0x12')]&&_0x24c640[_0x90fd('0x12')]['id']){try{var _0x493973=getId(_0x24c640['channel'],_0x24c640[_0x90fd('0x12')]?_0x24c640[_0x90fd('0x12')]['id']:0x0,_0x24c640[_0x90fd('0x13')]?_0x24c640[_0x90fd('0x13')]['id']:0x0);if(_0x1cae40[_0x90fd('0x11')][_0x493973]){_0x1cae40[_0x90fd('0x11')][_0x493973][_0x90fd('0x3d')](_0x90fd('0x43'));if(rpc[_0x24c640[_0x90fd('0x1f')]+_0x90fd('0x44')]){rpc[_0x24c640['channel']+_0x90fd('0x44')][_0x90fd('0x45')](_0x493973,{'UserId':_0x24c640[_0x90fd('0x12')][_0x90fd('0x46')]})['catch'](function(_0x4cf061){logger[_0x90fd('0x37')]('error\x20update\x20queue\x20report');});}}return _0x5de9af({'code':0xc8,'message':_0x24c640});}catch(_0x491daa){logger[_0x90fd('0x37')](_0x491daa[_0x90fd('0x47')]);return _0x1b0e03(_0x169832[_0x90fd('0x37')](0x1f4,_0x491daa));}}logger[_0x90fd('0x37')](_0x90fd('0x48'));return _0x1b0e03(_0x169832[_0x90fd('0x37')](0x1f4,_0x90fd('0x48')));});},'RejectMessage':function(_0x5502f2){var _0x55653c=this;return new Promise(function(_0x1b81dc,_0x43d076){if(_0x5502f2[_0x90fd('0x40')]&&_0x5502f2['agent']['id']){try{if(_0x1cae40[_0x90fd('0x41')][_0x5502f2[_0x90fd('0x40')]['id']]){_0x1cae40[_0x90fd('0x41')][_0x5502f2[_0x90fd('0x40')]['id']][_0x90fd('0x49')]=![];_0x1cae40[_0x90fd('0x41')][_0x5502f2[_0x90fd('0x40')]['id']][_0x90fd('0x42')]=undefined;}return _0x1b81dc({'code':0xc8,'message':_0x5502f2});}catch(_0x4ec476){logger['error'](_0x4ec476[_0x90fd('0x47')]);return _0x43d076(_0x55653c[_0x90fd('0x37')](0x1f4,_0x4ec476));}}logger[_0x90fd('0x37')]('message\x20is\x20empty');return _0x43d076(_0x55653c[_0x90fd('0x37')](0x1f4,_0x90fd('0x48')));});},'AbandonInteraction':function(_0x29b880){var _0x24229f=this;return new Promise(function(_0x43f75a,_0x408e8d){if(_0x29b880['channel']&&_0x29b880[_0x90fd('0x13')]&&_0x29b880['interaction']['id']){try{var _0x33e017=getId(_0x29b880['channel'],_0x29b880[_0x90fd('0x12')]?_0x29b880[_0x90fd('0x12')]['id']:0x0,_0x29b880[_0x90fd('0x13')]?_0x29b880[_0x90fd('0x13')]['id']:0x0);if(_0x1cae40['rules'][_0x33e017]){_0x1cae40[_0x90fd('0x11')][_0x33e017][_0x90fd('0x3d')](_0x90fd('0x43'));}return _0x43f75a({'code':0xc8,'message':_0x29b880});}catch(_0x40fea3){logger[_0x90fd('0x37')](_0x40fea3[_0x90fd('0x47')]);return _0x408e8d(_0x24229f['error'](0x1f4,_0x40fea3));}}logger['error']('message\x20is\x20empty');return _0x408e8d(_0x24229f['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x375fc8){var _0x3b98e2=this;return new Promise(function(_0x278db5,_0x161522){if(_0x1cae40[_0x90fd('0x41')]['hasOwnProperty'](_0x375fc8['id'])){for(var _0x54d55d in _0x375fc8['capacity']){if(_0x375fc8[_0x90fd('0x4a')][_0x90fd('0x4b')](_0x54d55d)){if(_0x1cae40['agents'][_0x375fc8['id']][_0x90fd('0x4b')](_0x54d55d+_0x90fd('0x4c'))){_0x1cae40[_0x90fd('0x41')][_0x375fc8['id']][_0x54d55d+_0x90fd('0x4c')]=parseInt(_0x375fc8[_0x90fd('0x4a')][_0x54d55d],0xa);}}}_0x1cae40[_0x90fd('0x41')][_0x375fc8['id']][_0x90fd('0x4d')]();return _0x278db5({'code':0xc8,'message':_0x1cae40[_0x90fd('0x41')][_0x375fc8['id']]});}else{return _0x161522(_0x3b98e2[_0x90fd('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3aaa50){return new Promise(function(_0xcebc5c,_0x1e7111){var _0x53e2bb=_['values'](_0x1cae40[_0x90fd('0x41')]);_0xcebc5c({'count':_0x53e2bb[_0x90fd('0x16')],'rows':_0x53e2bb});});},'ChatQueues':function(_0x479c8c){return new Promise(function(_0x5f4645,_0x4d761c){var _0x49533a=[];for(var _0x249331 in _0x1cae40[_0x90fd('0x4e')]){if(_0x1cae40[_0x90fd('0x4e')][_0x90fd('0x4b')](_0x249331)){var _0x2e6e95=_0x1cae40[_0x90fd('0x4e')][_0x249331];var _0x321cfb={'id':_0x2e6e95['id'],'available':_0x2e6e95[_0x90fd('0x4f')],'loggedIn':_0x2e6e95['loggedIn'],'name':_0x2e6e95[_0x90fd('0x50')],'paused':_0x2e6e95[_0x90fd('0x51')],'waiting':_0x2e6e95[_0x90fd('0x52')]};_0x49533a['push'](_0x321cfb);}}_0x5f4645({'count':_0x49533a[_0x90fd('0x16')],'rows':_0x49533a});});},'MailQueues':function(_0x4636d5){return new Promise(function(_0x52c920,_0x5cb475){var _0x1a4d3f=[];for(var _0x333c8d in _0x1cae40[_0x90fd('0x53')]){if(_0x1cae40['mailQueues'][_0x90fd('0x4b')](_0x333c8d)){var _0x497953=_0x1cae40['mailQueues'][_0x333c8d];var _0x206526={'id':_0x497953['id'],'available':_0x497953['available'],'loggedIn':_0x497953[_0x90fd('0x54')],'name':_0x497953[_0x90fd('0x50')],'paused':_0x497953['paused'],'waiting':_0x497953[_0x90fd('0x52')]};_0x1a4d3f[_0x90fd('0x21')](_0x206526);}}_0x52c920({'count':_0x1a4d3f[_0x90fd('0x16')],'rows':_0x1a4d3f});});},'OpenchannelQueues':function(_0x454201){return new Promise(function(_0x6a7a62,_0xd1ecc){var _0x4d2436=[];for(var _0x4c5fd3 in _0x1cae40['openchannelQueues']){if(_0x1cae40['openchannelQueues'][_0x90fd('0x4b')](_0x4c5fd3)){var _0x3d55d1=_0x1cae40[_0x90fd('0x55')][_0x4c5fd3];var _0x576a55={'id':_0x3d55d1['id'],'available':_0x3d55d1[_0x90fd('0x4f')],'loggedIn':_0x3d55d1[_0x90fd('0x54')],'name':_0x3d55d1['name'],'paused':_0x3d55d1[_0x90fd('0x51')],'waiting':_0x3d55d1[_0x90fd('0x52')]};_0x4d2436[_0x90fd('0x21')](_0x576a55);}}_0x6a7a62({'count':_0x4d2436[_0x90fd('0x16')],'rows':_0x4d2436});});},'SmsQueues':function(_0x5acecb){return new Promise(function(_0x42cdec,_0x3c4e9e){var _0x5d08e9=[];for(var _0x4a841e in _0x1cae40['smsQueues']){if(_0x1cae40[_0x90fd('0x56')]['hasOwnProperty'](_0x4a841e)){var _0x4ad10e=_0x1cae40[_0x90fd('0x56')][_0x4a841e];var _0x5a8445={'id':_0x4ad10e['id'],'available':_0x4ad10e[_0x90fd('0x4f')],'loggedIn':_0x4ad10e[_0x90fd('0x54')],'name':_0x4ad10e[_0x90fd('0x50')],'paused':_0x4ad10e[_0x90fd('0x51')],'waiting':_0x4ad10e[_0x90fd('0x52')]};_0x5d08e9[_0x90fd('0x21')](_0x5a8445);}}_0x42cdec({'count':_0x5d08e9['length'],'rows':_0x5d08e9});});},'FaxQueues':function(_0x37e8b3){return new Promise(function(_0x469898,_0x41a6fe){var _0x4e25f4=[];for(var _0x5b16a5 in _0x1cae40[_0x90fd('0x57')]){if(_0x1cae40[_0x90fd('0x57')][_0x90fd('0x4b')](_0x5b16a5)){var _0x2789d1=_0x1cae40[_0x90fd('0x57')][_0x5b16a5];var _0x278bcf={'id':_0x2789d1['id'],'available':_0x2789d1[_0x90fd('0x4f')],'loggedIn':_0x2789d1[_0x90fd('0x54')],'name':_0x2789d1[_0x90fd('0x50')],'paused':_0x2789d1[_0x90fd('0x51')],'waiting':_0x2789d1[_0x90fd('0x52')]};_0x4e25f4[_0x90fd('0x21')](_0x278bcf);}}_0x469898({'count':_0x4e25f4[_0x90fd('0x16')],'rows':_0x4e25f4});});},'WhatsappQueues':function(_0x34a33a){return new Promise(function(_0x37215e,_0x1b1f41){var _0x3b07fe=[];for(var _0x4f4eeb in _0x1cae40[_0x90fd('0x58')]){if(_0x1cae40[_0x90fd('0x58')][_0x90fd('0x4b')](_0x4f4eeb)){var _0xd14edf=_0x1cae40[_0x90fd('0x58')][_0x4f4eeb];var _0x3d0aba={'id':_0xd14edf['id'],'available':_0xd14edf[_0x90fd('0x4f')],'loggedIn':_0xd14edf['loggedIn'],'name':_0xd14edf[_0x90fd('0x50')],'paused':_0xd14edf[_0x90fd('0x51')],'waiting':_0xd14edf[_0x90fd('0x52')]};_0x3b07fe[_0x90fd('0x21')](_0x3d0aba);}}_0x37215e({'count':_0x3b07fe['length'],'rows':_0x3b07fe});});},'ChatQueuesWaitingInteractions':function(_0x57919c){return new Promise(function(_0x250c46,_0x16ffbc){var _0x696861=_[_0x90fd('0x59')](_0x1cae40['chatQueuesWaitingInteractions']);_0x250c46({'count':_0x696861['length'],'rows':_0x696861});});},'MailQueuesWaitingInteractions':function(_0x21b79c){return new Promise(function(_0x3f1086,_0x2397fd){var _0x2df466=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5a')]);_0x3f1086({'count':_0x2df466['length'],'rows':_0x2df466});});},'OpenchannelQueuesWaitingInteractions':function(_0x4135b1){return new Promise(function(_0xa74b83,_0x246b22){var _0x185056=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5b')]);_0xa74b83({'count':_0x185056[_0x90fd('0x16')],'rows':_0x185056});});},'SmsQueuesWaitingInteractions':function(_0x397474){return new Promise(function(_0x360ccd,_0x4b883f){var _0x1adcc2=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5c')]);_0x360ccd({'count':_0x1adcc2[_0x90fd('0x16')],'rows':_0x1adcc2});});},'FaxQueuesWaitingInteractions':function(_0x65459c){return new Promise(function(_0x43e37f,_0x47bb7a){var _0x1ee663=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5d')]);_0x43e37f({'count':_0x1ee663[_0x90fd('0x16')],'rows':_0x1ee663});});},'WhatsappQueuesWaitingInteractions':function(_0x140b49){return new Promise(function(_0x56bb7f,_0x1316e6){var _0x3b5f3b=_[_0x90fd('0x59')](_0x1cae40[_0x90fd('0x5e')]);_0x56bb7f({'count':_0x3b5f3b[_0x90fd('0x16')],'rows':_0x3b5f3b});});}};var _0x432ebd=jayson[_0x90fd('0x5f')](_0x3c5da8)[_0x90fd('0x60')]();_0x432ebd['on'](_0x90fd('0x37'),function(_0x3fc7c0){logger['error'](JSON[_0x90fd('0x3b')](_0x3fc7c0));return _0x1b3f3b(_0x3fc7c0);});_0x432ebd['listen'](0x232c,'127.0.0.1',function(){console[_0x90fd('0x61')](_0x90fd('0x62'),0x232c);return _0x18bdb6(_0x90fd('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3c6c2cc..9523e5c 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 _0x033e=['../../../config/logger','client','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash'];(function(_0x257c66,_0x444548){var _0x13e15f=function(_0xaacf11){while(--_0xaacf11){_0x257c66['push'](_0x257c66['shift']());}};_0x13e15f(++_0x444548);}(_0x033e,0x1f4));var _0xe033=function(_0x13b64d,_0xf92f15){_0x13b64d=_0x13b64d-0x0;var _0x35aec6=_0x033e[_0x13b64d];return _0x35aec6;};'use strict';var util=require(_0xe033('0x0'));var BPromise=require(_0xe033('0x1'));var jayson=require(_0xe033('0x2'));var _=require(_0xe033('0x3'));var logger=require(_0xe033('0x4'))('routing');var client=jayson[_0xe033('0x5')]['http']({'port':0x232a});function request(_0x666416,_0xa7c651){return new BPromise(function(_0xe3c6b4,_0x4dd129){return client[_0xe033('0x6')](_0x666416,_0xa7c651)[_0xe033('0x7')](function(_0x3b9236){if(_0x3b9236[_0xe033('0x8')]){return _0x4dd129(_0x3b9236[_0xe033('0x8')][_0xe033('0x9')]);}else{return _0xe3c6b4(_0x3b9236[_0xe033('0xa')]);}})[_0xe033('0xb')](function(_0xdca884){return _0x4dd129(_0xdca884);});});}exports[_0xe033('0xc')]=function(_0x117cb1,_0x4fe2e2,_0x60725f){return function(_0x33653a){if(_0x60725f[_0xe033('0xd')]&&!_0x60725f[_0xe033('0xd')][_0x117cb1]){logger[_0xe033('0xe')](_0xe033('0xf'),_0x117cb1);return _0x33653a[_0xe033('0x10')]();}var _0x33d2bb=[];for(var _0x44352f=0x0;_0x44352f<_0x4fe2e2[_0xe033('0x11')];_0x44352f+=0x1){_0x33d2bb[_0xe033('0x12')](request('Command',{'command':util[_0xe033('0x13')]('iftime\x20%s',_0x4fe2e2[_0x44352f])})[_0xe033('0x7')](function(_0x55bcc4){return _0x55bcc4&&_0x55bcc4[_0xe033('0x9')]&&_0x55bcc4['message']['indexOf']('true')>=0x0?!![]:![];})[_0xe033('0xb')](function(_0x54e2c0){logger['error']('[%s][INTERVAL]\x20%s',_0x117cb1,_0x4fe2e2[_0x44352f]);}));}BPromise[_0xe033('0x14')](_0x33d2bb)['then'](function(_0x12a484){var _0x907899=_[_0xe033('0x15')](_0x12a484);logger[_0xe033('0xe')](_0xe033('0x16'),_0x117cb1,_0x4fe2e2[_0xe033('0x17')](_0xe033('0x18')),_0x907899);_0x33653a[_0xe033('0x19')](_0x907899);})[_0xe033('0xb')](function(_0x365ec3){console[_0xe033('0x1a')](_0x365ec3);logger[_0xe033('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x117cb1,_0x4fe2e2[_0xe033('0x17')]('\x20|\x20'),_0x365ec3[_0xe033('0x1b')]);_0x33653a[_0xe033('0x10')]();});};}; \ No newline at end of file +var _0x4cd1=['Command','format','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','lodash','../../../config/logger','client','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push'];(function(_0x5c365f,_0x3b40ed){var _0x295e1b=function(_0x226683){while(--_0x226683){_0x5c365f['push'](_0x5c365f['shift']());}};_0x295e1b(++_0x3b40ed);}(_0x4cd1,0x1bb));var _0x14cd=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4cd1[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0x14cd('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x14cd('0x1'));var logger=require(_0x14cd('0x2'))('routing');var client=jayson[_0x14cd('0x3')]['http']({'port':0x232a});function request(_0x12f0ba,_0x3d762e){return new BPromise(function(_0x41b13a,_0x426924){return client['request'](_0x12f0ba,_0x3d762e)[_0x14cd('0x4')](function(_0x24d09b){if(_0x24d09b[_0x14cd('0x5')]){return _0x426924(_0x24d09b[_0x14cd('0x5')][_0x14cd('0x6')]);}else{return _0x41b13a(_0x24d09b['result']);}})[_0x14cd('0x7')](function(_0x52b067){return _0x426924(_0x52b067);});});}exports['condition']=function(_0x55ead6,_0x5e0b28,_0x32bbf1){return function(_0x7ac301){if(_0x32bbf1[_0x14cd('0x8')]&&!_0x32bbf1[_0x14cd('0x8')][_0x55ead6]){logger[_0x14cd('0x9')](_0x14cd('0xa'),_0x55ead6);return _0x7ac301[_0x14cd('0xb')]();}var _0x4439bd=[];for(var _0xb3e184=0x0;_0xb3e184<_0x5e0b28['length'];_0xb3e184+=0x1){_0x4439bd[_0x14cd('0xc')](request(_0x14cd('0xd'),{'command':util[_0x14cd('0xe')]('iftime\x20%s',_0x5e0b28[_0xb3e184])})[_0x14cd('0x4')](function(_0x3fd745){return _0x3fd745&&_0x3fd745[_0x14cd('0x6')]&&_0x3fd745[_0x14cd('0x6')]['indexOf'](_0x14cd('0xf'))>=0x0?!![]:![];})[_0x14cd('0x7')](function(_0x331cae){logger[_0x14cd('0x5')](_0x14cd('0x10'),_0x55ead6,_0x5e0b28[_0xb3e184]);}));}BPromise[_0x14cd('0x11')](_0x4439bd)[_0x14cd('0x4')](function(_0x576667){var _0x54a02f=_['some'](_0x576667);logger[_0x14cd('0x9')](_0x14cd('0x12'),_0x55ead6,_0x5e0b28[_0x14cd('0x13')]('\x20|\x20'),_0x54a02f);_0x7ac301[_0x14cd('0x14')](_0x54a02f);})[_0x14cd('0x7')](function(_0x5f4ec8){console[_0x14cd('0x15')](_0x5f4ec8);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x55ead6,_0x5e0b28[_0x14cd('0x13')](_0x14cd('0x16')),_0x5f4ec8[_0x14cd('0x17')]);_0x7ac301[_0x14cd('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 60a32fe..47d0d50 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 _0x0bb5=['called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt'];(function(_0x44bf54,_0x5be3d6){var _0x2c4a96=function(_0x2bd0ee){while(--_0x2bd0ee){_0x44bf54['push'](_0x44bf54['shift']());}};_0x2c4a96(++_0x5be3d6);}(_0x0bb5,0x148));var _0x50bb=function(_0x1f6ab0,_0x56e3e0){_0x1f6ab0=_0x1f6ab0-0x0;var _0x4b5186=_0x0bb5[_0x1f6ab0];return _0x4b5186;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5a12b6,_0x348380){utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x4'),_0x5a12b6[_0x50bb('0x5')],_0x5a12b6[_0x50bb('0x6')],_0x5a12b6[_0x50bb('0x7')],_0x5a12b6[_0x50bb('0x8')],_0x5a12b6['interface'],_0x5a12b6['calleridnum'],_0x5a12b6[_0x50bb('0x9')],_0x5a12b6[_0x50bb('0xa')]));if(_0x5a12b6[_0x50bb('0x7')]){utils[_0x50bb('0xb')](_0x5a12b6['queue'])['then'](function(_0x2bede8){if(_0x2bede8){_0x5a12b6[_0x50bb('0xc')]=_0x2bede8[_0x50bb('0xc')];_0x5a12b6[_0x50bb('0xd')]=_0x5a12b6['agentcomplete']?_0x2bede8[_0x50bb('0xe')]:![];_0x5a12b6[_0x50bb('0xf')]=_0x5a12b6[_0x50bb('0xd')]?_0x2bede8[_0x50bb('0x10')]:0x0;}utils[_0x50bb('0x11')](_0x50bb('0x12'),_0x5a12b6);});}else{utils[_0x50bb('0x11')]('CreateVoiceAgentReport',_0x5a12b6);}if(_0x348380){delete transfers[_0x5a12b6[_0x50bb('0x5')]];}else{delete agents[_0x5a12b6['destuniqueid']];}}exports[_0x50bb('0x13')]=function(_0xd8ab27){try{utils[_0x50bb('0x14')](util['format'](_0x50bb('0x15'),_0xd8ab27[_0x50bb('0x5')]),_0xd8ab27);agents[_0xd8ab27[_0x50bb('0x16')]]=_0xd8ab27;agents[_0xd8ab27['destuniqueid']][_0x50bb('0x17')]=utils['now']();agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0xa')]=_0x50bb('0x18');agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0x9')]=null;agents[_0xd8ab27['destuniqueid']][_0x50bb('0x19')]=null;utils[_0x50bb('0x2')](util['format'](_0x50bb('0x1a'),_0xd8ab27['uniqueid'],agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0x8')],_0xd8ab27['destuniqueid']));}catch(_0x4f1c0a){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x15'),_0xd8ab27[_0x50bb('0x5')]),_0x4f1c0a);}};exports['agentringnoanswer']=function(_0x19dc5d){try{if(!_[_0x50bb('0x1c')](agents[_0x19dc5d[_0x50bb('0x16')]])){utils['debug'](util[_0x50bb('0x3')](_0x50bb('0x1d'),_0x19dc5d[_0x50bb('0x5')]),_0x19dc5d);utils['info'](util[_0x50bb('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x19dc5d[_0x50bb('0x5')],agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x8')],_0x19dc5d[_0x50bb('0x16')]));agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x1e')]=!![];agents[_0x19dc5d['destuniqueid']][_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0xa')]='timeout';agents[_0x19dc5d[_0x50bb('0x16')]]['reason']='timeout';agents[_0x19dc5d[_0x50bb('0x16')]]['holdtime']=_0x19dc5d['ringtime']?parseInt(_0x19dc5d[_0x50bb('0x21')])/0x3e8:0x0;agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x22')]=0x0;unanswered[_0x50bb('0x23')](_0x19dc5d[_0x50bb('0x16')]);}}catch(_0x269479){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')]('[%s][agents][agentringnoanswer]',_0x19dc5d[_0x50bb('0x5')]),_0x269479);}};exports[_0x50bb('0x24')]=function(_0x15ee2e){try{_[_0x50bb('0x25')](agents,function(_0x560b07,_0x13dc3c){if(_0x560b07[_0x50bb('0x5')]==_0x15ee2e[_0x50bb('0x5')]&&!_[_0x50bb('0x26')](unanswered,_0x560b07[_0x50bb('0x16')])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x27'),_0x15ee2e[_0x50bb('0x5')]),_0x15ee2e);utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x28'),_0x15ee2e['uniqueid'],_0x560b07[_0x50bb('0x8')],_0x560b07[_0x50bb('0x16')]));_0x560b07[_0x50bb('0x1e')]=!![];_0x560b07[_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();_0x560b07[_0x50bb('0xa')]=_0x50bb('0x29');_0x560b07[_0x50bb('0x2a')]=_0x50bb('0x29');_0x560b07[_0x50bb('0x2b')]=_0x15ee2e[_0x50bb('0x2b')];_0x560b07['talktime']=0x0;writeDB(_0x560b07);}});}catch(_0x364ea0){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x27'),_0x15ee2e[_0x50bb('0x5')]),_0x364ea0);}};exports[_0x50bb('0x2c')]=function(_0x53600a){try{if(agents[_0x53600a['destuniqueid']]){utils[_0x50bb('0x14')](util['format'](_0x50bb('0x2d'),_0x53600a[_0x50bb('0x5')]),_0x53600a);utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x2e'),_0x53600a['uniqueid'],agents[_0x53600a[_0x50bb('0x16')]]['membername'],_0x53600a[_0x50bb('0x16')]));agents[_0x53600a[_0x50bb('0x16')]][_0x50bb('0x2f')]=utils['now']();agents[_0x53600a['destuniqueid']][_0x50bb('0x9')]=_0x53600a[_0x50bb('0x9')];agents[_0x53600a[_0x50bb('0x16')]][_0x50bb('0x19')]=_0x53600a['connectedlinename'];agents[_0x53600a[_0x50bb('0x16')]]['holdtime']=_0x53600a['ringtime'];agents[_0x53600a[_0x50bb('0x16')]]['lastevent']=_0x50bb('0x30');_[_0x50bb('0x25')](agents,function(_0x1ef231,_0x1f156e){if(_0x1ef231[_0x50bb('0x16')]!=_0x53600a[_0x50bb('0x16')]&&_0x1ef231[_0x50bb('0x5')]==_0x53600a[_0x50bb('0x5')]){_0x1ef231[_0x50bb('0x22')]=0x0;_0x1ef231[_0x50bb('0x2b')]=_0x53600a['ringtime'];_0x1ef231['agentringnoanswer']=!![];_0x1ef231[_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();_0x1ef231[_0x50bb('0xa')]=_0x50bb('0x31');_0x1ef231['reason']=_0x50bb('0x31');_0x1ef231['answeredelsewheredestinationuniqueid']=_0x53600a[_0x50bb('0x16')];_0x1ef231[_0x50bb('0x32')]=_0x53600a[_0x50bb('0x8')];writeDB(_0x1ef231);}});}}catch(_0x40748d){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x2d'),_0x53600a[_0x50bb('0x5')]),_0x40748d);}};exports[_0x50bb('0x33')]=function(_0x46c1c3){try{if(!_[_0x50bb('0x1c')](agents[_0x46c1c3[_0x50bb('0x16')]])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x34'),_0x46c1c3[_0x50bb('0x5')]),_0x46c1c3);utils['info'](util[_0x50bb('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x46c1c3[_0x50bb('0x5')],agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x8')],_0x46c1c3[_0x50bb('0x16')]));agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x33')]=!![];agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x35')]=utils[_0x50bb('0x20')]();agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x22')]=utils[_0x50bb('0x36')](agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x35')],agents[_0x46c1c3['destuniqueid']][_0x50bb('0x2f')]);agents[_0x46c1c3['destuniqueid']][_0x50bb('0x2a')]=_0x46c1c3[_0x50bb('0x2a')];agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0xa')]=_0x50bb('0x37');writeDB(agents[_0x46c1c3[_0x50bb('0x16')]]);}}catch(_0x133dd9){utils[_0x50bb('0x1b')](util['format'](_0x50bb('0x34'),_0x46c1c3[_0x50bb('0x5')]),_0x133dd9);}};exports[_0x50bb('0x38')]=function(_0x13afe2){try{if(!_[_0x50bb('0x1c')](agents[_0x13afe2['transfereruniqueid']])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x39'),_0x13afe2[_0x50bb('0x5')]),_0x13afe2);utils[_0x50bb('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x13afe2[_0x50bb('0x5')],agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x8')],agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x5')]));agents[_0x13afe2[_0x50bb('0x3a')]][_0x50bb('0x3b')]=!![];agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x3c')]=_0x50bb('0x3d');agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x3e')]=_0x13afe2[_0x50bb('0x3f')];agents[_0x13afe2[_0x50bb('0x3a')]][_0x50bb('0x40')]=agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x5')];}}catch(_0x46b51e){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x39'),_0x13afe2['uniqueid']),_0x46b51e);}};exports[_0x50bb('0x41')]=function(_0x50943a){try{utils[_0x50bb('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x50943a[_0x50bb('0x42')]),_0x50943a);if(_0x50943a['origtransfereruniqueid']==_0x50943a['origtransfererlinkedid']){if(!_[_0x50bb('0x1c')](agents[_0x50943a[_0x50bb('0x43')]])){utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x44'),_0x50943a[_0x50bb('0x42')],agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x8')]));agents[_0x50943a['secondtransfereruniqueid']]['transfer']=!![];agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x3c')]=_0x50bb('0x45');agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x3e')]=_0x50943a[_0x50bb('0x46')];agents[_0x50943a[_0x50bb('0x43')]]['transferuniqueid']=_0x50943a[_0x50bb('0x42')];}if(_0x50943a[_0x50bb('0x47')]&&agents[_0x50943a[_0x50bb('0x47')]]){agents[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x48')]=0x1;transfers[_0x50943a['transfereeuniqueid']]=_[_0x50bb('0x49')](agents[_0x50943a[_0x50bb('0x47')]]);transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x4a')]=agents[_0x50943a[_0x50bb('0x43')]]['calleridnum'];transfers[_0x50943a[_0x50bb('0x47')]]['calleridname']=agents[_0x50943a['secondtransfereruniqueid']][_0x50bb('0x4b')];transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x17')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x2f')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x2b')]=0x0;transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x48')]=0x2;}}else if(_0x50943a['secondtransfereruniqueid']==_0x50943a[_0x50bb('0x4c')]){if(!_['isNil'](agents[_0x50943a[_0x50bb('0x42')]])){utils[_0x50bb('0x2')](util['format'](_0x50bb('0x44'),_0x50943a[_0x50bb('0x42')],agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x8')]));agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3b')]=!![];agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3c')]='ATTENDED';agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3e')]=_0x50943a[_0x50bb('0x4d')];agents[_0x50943a['origtransfereruniqueid']][_0x50bb('0x40')]=_0x50943a[_0x50bb('0x43')];}if(_0x50943a[_0x50bb('0x4e')]&&agents[_0x50943a[_0x50bb('0x4e')]]){agents[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x48')]=0x1;transfers[_0x50943a['transfertargetuniqueid']]=_[_0x50bb('0x49')](agents[_0x50943a[_0x50bb('0x4e')]]);transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x4a')]=agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x4a')];transfers[_0x50943a['transfertargetuniqueid']][_0x50bb('0x4b')]=agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x4b')];transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x17')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x2f')]=utils[_0x50bb('0x20')]();transfers[_0x50943a['transfertargetuniqueid']][_0x50bb('0x2b')]=0x0;transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x48')]=0x2;}}}catch(_0x2d2463){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x4f'),_0x50943a[_0x50bb('0x42')]),_0x2d2463);}};exports[_0x50bb('0x50')]=function(_0x578ff3){try{utils['debug'](util['format'](_0x50bb('0x51'),_0x578ff3['uniqueid']),_0x578ff3);if(agents[_0x578ff3['uniqueid']]&&agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')]===_0x50bb('0x52')){if(_0x578ff3[_0x50bb('0x53')]==='21'){agents[_0x578ff3['uniqueid']][_0x50bb('0x2a')]=_0x50bb('0x54');agents[_0x578ff3['uniqueid']][_0x50bb('0xa')]='rejected';}utils[_0x50bb('0x2')](util[_0x50bb('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x578ff3[_0x50bb('0x5')],agents[_0x578ff3['uniqueid']][_0x50bb('0x8')],agents[_0x578ff3[_0x50bb('0x5')]]['reason'],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]));writeDB(agents[_0x578ff3[_0x50bb('0x5')]]);var _0x51142c=unanswered[_0x50bb('0x55')](_0x578ff3[_0x50bb('0x5')]);if(_0x51142c>-0x1){unanswered[_0x50bb('0x56')](_0x51142c,0x1);}}if(transfers[_0x578ff3[_0x50bb('0x5')]]){transfers[_0x578ff3['uniqueid']][_0x50bb('0x33')]=!![];transfers[_0x578ff3[_0x50bb('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x22')]=utils['diffTime'](transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2f')]);transfers[_0x578ff3[_0x50bb('0x5')]]['reason']='agent';transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]=_0x50bb('0x37');utils[_0x50bb('0x2')](util['format'](_0x50bb('0x57'),_0x578ff3['uniqueid'],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x8')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]));writeDB(transfers[_0x578ff3[_0x50bb('0x5')]],!![]);}if(agents[_0x578ff3['uniqueid']]&&agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2f')]){agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x33')]=!![];agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')]=utils[_0x50bb('0x20')]();agents[_0x578ff3['uniqueid']][_0x50bb('0x22')]=utils[_0x50bb('0x36')](agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')],agents[_0x578ff3[_0x50bb('0x5')]]['agentconnectAt']);agents[_0x578ff3['uniqueid']][_0x50bb('0x2a')]=agents[_0x578ff3['uniqueid']][_0x50bb('0x3b')]?_0x50bb('0x3b'):'agent';agents[_0x578ff3['uniqueid']][_0x50bb('0xa')]=_0x50bb('0x37');utils[_0x50bb('0x2')](util['format'](_0x50bb('0x57'),_0x578ff3[_0x50bb('0x5')],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x8')],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')],agents[_0x578ff3[_0x50bb('0x5')]]['lastevent']));writeDB(agents[_0x578ff3['uniqueid']]);}}catch(_0x28c99d){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x51'),_0x578ff3[_0x50bb('0x5')]),_0x28c99d);}}; \ No newline at end of file +var _0x0565=['agentacw','agentcomplete','acwtime','acwTimeout','request','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','queue','then','type'];(function(_0x2f2cbe,_0x15dea7){var _0x4f6b3d=function(_0x5e2d58){while(--_0x5e2d58){_0x2f2cbe['push'](_0x2f2cbe['shift']());}};_0x4f6b3d(++_0x15dea7);}(_0x0565,0xf2));var _0x5056=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0565[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var utils=require(_0x5056('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2e0694,_0x354d5d){utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x5'),_0x2e0694[_0x5056('0x6')],_0x2e0694[_0x5056('0x7')],_0x2e0694['queue'],_0x2e0694[_0x5056('0x8')],_0x2e0694[_0x5056('0x9')],_0x2e0694[_0x5056('0xa')],_0x2e0694[_0x5056('0xb')],_0x2e0694['lastevent']));if(_0x2e0694['queue']){utils[_0x5056('0xc')](_0x2e0694[_0x5056('0xd')])[_0x5056('0xe')](function(_0x2e6f18){if(_0x2e6f18){_0x2e0694[_0x5056('0xf')]=_0x2e6f18[_0x5056('0xf')];_0x2e0694[_0x5056('0x10')]=_0x2e0694[_0x5056('0x11')]?_0x2e6f18['acw']:![];_0x2e0694[_0x5056('0x12')]=_0x2e0694[_0x5056('0x10')]?_0x2e6f18[_0x5056('0x13')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x2e0694);});}else{utils[_0x5056('0x14')]('CreateVoiceAgentReport',_0x2e0694);}if(_0x354d5d){delete transfers[_0x2e0694['uniqueid']];}else{delete agents[_0x2e0694['destuniqueid']];}}exports[_0x5056('0x15')]=function(_0x4b183a){try{utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x17'),_0x4b183a['uniqueid']),_0x4b183a);agents[_0x4b183a[_0x5056('0x18')]]=_0x4b183a;agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x19')]=utils[_0x5056('0x1a')]();agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x1b')]='called';agents[_0x4b183a[_0x5056('0x18')]]['connectedlinenum']=null;agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x1c')]=null;utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x1d'),_0x4b183a['uniqueid'],agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x8')],_0x4b183a['destuniqueid']));}catch(_0x5c1cec){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x17'),_0x4b183a[_0x5056('0x6')]),_0x5c1cec);}};exports[_0x5056('0x1f')]=function(_0xf04e08){try{if(!_[_0x5056('0x20')](agents[_0xf04e08['destuniqueid']])){utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]',_0xf04e08[_0x5056('0x6')]),_0xf04e08);utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0xf04e08[_0x5056('0x6')],agents[_0xf04e08[_0x5056('0x18')]]['membername'],_0xf04e08['destuniqueid']));agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x1f')]=!![];agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x21')]=utils['now']();agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x1b')]='timeout';agents[_0xf04e08[_0x5056('0x18')]]['reason']=_0x5056('0x22');agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x23')]=_0xf04e08[_0x5056('0x24')]?parseInt(_0xf04e08[_0x5056('0x24')])/0x3e8:0x0;agents[_0xf04e08['destuniqueid']][_0x5056('0x25')]=0x0;unanswered[_0x5056('0x26')](_0xf04e08[_0x5056('0x18')]);}}catch(_0x2ac79a){utils['error'](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]',_0xf04e08[_0x5056('0x6')]),_0x2ac79a);}};exports['queuecallerabandon']=function(_0x56ccba){try{_['forIn'](agents,function(_0x113be0,_0x252f75){if(_0x113be0['uniqueid']==_0x56ccba[_0x5056('0x6')]&&!_[_0x5056('0x27')](unanswered,_0x113be0[_0x5056('0x18')])){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x28'),_0x56ccba[_0x5056('0x6')]),_0x56ccba);utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x29'),_0x56ccba[_0x5056('0x6')],_0x113be0['membername'],_0x113be0['destuniqueid']));_0x113be0[_0x5056('0x1f')]=!![];_0x113be0[_0x5056('0x21')]=utils['now']();_0x113be0[_0x5056('0x1b')]=_0x5056('0x2a');_0x113be0['reason']=_0x5056('0x2a');_0x113be0[_0x5056('0x23')]=_0x56ccba[_0x5056('0x23')];_0x113be0[_0x5056('0x25')]=0x0;writeDB(_0x113be0);}});}catch(_0x33edfb){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x28'),_0x56ccba[_0x5056('0x6')]),_0x33edfb);}};exports[_0x5056('0x2b')]=function(_0x199129){try{if(agents[_0x199129[_0x5056('0x18')]]){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x2c'),_0x199129['uniqueid']),_0x199129);utils[_0x5056('0x3')](util['format'](_0x5056('0x2d'),_0x199129[_0x5056('0x6')],agents[_0x199129[_0x5056('0x18')]][_0x5056('0x8')],_0x199129['destuniqueid']));agents[_0x199129[_0x5056('0x18')]][_0x5056('0x2e')]=utils['now']();agents[_0x199129[_0x5056('0x18')]]['connectedlinenum']=_0x199129[_0x5056('0xb')];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x1c')]=_0x199129['connectedlinename'];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x23')]=_0x199129[_0x5056('0x24')];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x1b')]=_0x5056('0x2f');_[_0x5056('0x30')](agents,function(_0x21aa75,_0x15553e){if(_0x21aa75[_0x5056('0x18')]!=_0x199129[_0x5056('0x18')]&&_0x21aa75[_0x5056('0x6')]==_0x199129[_0x5056('0x6')]){_0x21aa75[_0x5056('0x25')]=0x0;_0x21aa75[_0x5056('0x23')]=_0x199129[_0x5056('0x24')];_0x21aa75['agentringnoanswer']=!![];_0x21aa75['agentringnoanswerAt']=utils[_0x5056('0x1a')]();_0x21aa75[_0x5056('0x1b')]=_0x5056('0x31');_0x21aa75[_0x5056('0x32')]=_0x5056('0x31');_0x21aa75[_0x5056('0x33')]=_0x199129[_0x5056('0x18')];_0x21aa75[_0x5056('0x34')]=_0x199129['membername'];writeDB(_0x21aa75);}});}}catch(_0x58f12f){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x2c'),_0x199129['uniqueid']),_0x58f12f);}};exports[_0x5056('0x11')]=function(_0x5b99e9){try{if(!_[_0x5056('0x20')](agents[_0x5b99e9[_0x5056('0x18')]])){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x35'),_0x5b99e9[_0x5056('0x6')]),_0x5b99e9);utils['info'](util[_0x5056('0x4')](_0x5056('0x36'),_0x5b99e9[_0x5056('0x6')],agents[_0x5b99e9['destuniqueid']]['membername'],_0x5b99e9['destuniqueid']));agents[_0x5b99e9['destuniqueid']][_0x5056('0x11')]=!![];agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x37')]=utils[_0x5056('0x1a')]();agents[_0x5b99e9[_0x5056('0x18')]]['talktime']=utils['diffTime'](agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x37')],agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x2e')]);agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x32')]=_0x5b99e9[_0x5056('0x32')];agents[_0x5b99e9['destuniqueid']]['lastevent']=_0x5056('0x38');writeDB(agents[_0x5b99e9[_0x5056('0x18')]]);}}catch(_0x5a2f73){utils[_0x5056('0x1e')](util[_0x5056('0x4')]('[%s][agents][agentcomplete]',_0x5b99e9['uniqueid']),_0x5a2f73);}};exports[_0x5056('0x39')]=function(_0x1ab1a9){try{if(!_['isNil'](agents[_0x1ab1a9['transfereruniqueid']])){utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][blindtransfer]',_0x1ab1a9['uniqueid']),_0x1ab1a9);utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x3a'),_0x1ab1a9[_0x5056('0x6')],agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x8')],agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x6')]));agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3c')]=!![];agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3d')]=_0x5056('0x3e');agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3f')]=_0x1ab1a9['extension'];agents[_0x1ab1a9['transfereruniqueid']][_0x5056('0x40')]=agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x6')];}}catch(_0x1c84b1){utils[_0x5056('0x1e')](util[_0x5056('0x4')]('[%s][agents][blindtransfer]',_0x1ab1a9[_0x5056('0x6')]),_0x1c84b1);}};exports[_0x5056('0x41')]=function(_0x41dba4){try{utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x42'),_0x41dba4[_0x5056('0x43')]),_0x41dba4);if(_0x41dba4[_0x5056('0x43')]==_0x41dba4[_0x5056('0x44')]){if(!_[_0x5056('0x20')](agents[_0x41dba4[_0x5056('0x45')]])){utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x41dba4[_0x5056('0x43')],agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x8')]));agents[_0x41dba4['secondtransfereruniqueid']][_0x5056('0x3c')]=!![];agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x3d')]=_0x5056('0x46');agents[_0x41dba4['secondtransfereruniqueid']]['transferexten']=_0x41dba4['origtransfererexten'];agents[_0x41dba4[_0x5056('0x45')]]['transferuniqueid']=_0x41dba4[_0x5056('0x43')];}if(_0x41dba4[_0x5056('0x47')]&&agents[_0x41dba4[_0x5056('0x47')]]){agents[_0x41dba4[_0x5056('0x47')]][_0x5056('0x48')]=0x1;transfers[_0x41dba4[_0x5056('0x47')]]=_['clone'](agents[_0x41dba4['transfereeuniqueid']]);transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0xa')]=agents[_0x41dba4['secondtransfereruniqueid']][_0x5056('0xa')];transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x49')]=agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x49')];transfers[_0x41dba4['transfereeuniqueid']][_0x5056('0x19')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4['transfereeuniqueid']][_0x5056('0x2e')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x23')]=0x0;transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x48')]=0x2;}}else if(_0x41dba4[_0x5056('0x45')]==_0x41dba4[_0x5056('0x4a')]){if(!_[_0x5056('0x20')](agents[_0x41dba4[_0x5056('0x43')]])){utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x4b'),_0x41dba4['origtransfereruniqueid'],agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x8')]));agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x3c')]=!![];agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x3d')]='ATTENDED';agents[_0x41dba4[_0x5056('0x43')]]['transferexten']=_0x41dba4[_0x5056('0x4c')];agents[_0x41dba4[_0x5056('0x43')]]['transferuniqueid']=_0x41dba4['secondtransfereruniqueid'];}if(_0x41dba4[_0x5056('0x4d')]&&agents[_0x41dba4[_0x5056('0x4d')]]){agents[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x48')]=0x1;transfers[_0x41dba4['transfertargetuniqueid']]=_['clone'](agents[_0x41dba4[_0x5056('0x4d')]]);transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0xa')]=agents[_0x41dba4['origtransfereruniqueid']][_0x5056('0xa')];transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x49')]=agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x49')];transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x19')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x2e')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x23')]=0x0;transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x48')]=0x2;}}}catch(_0x17131c){utils[_0x5056('0x1e')](util['format'](_0x5056('0x42'),_0x41dba4['origtransfereruniqueid']),_0x17131c);}};exports[_0x5056('0x4e')]=function(_0x5468d6){try{utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][hangup]',_0x5468d6[_0x5056('0x6')]),_0x5468d6);if(agents[_0x5468d6[_0x5056('0x6')]]&&agents[_0x5468d6['uniqueid']][_0x5056('0x32')]==='timeout'){if(_0x5468d6['cause']==='21'){agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')]=_0x5056('0x4f');agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]=_0x5056('0x4f');}utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x50'),_0x5468d6[_0x5056('0x6')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x8')],agents[_0x5468d6['uniqueid']][_0x5056('0x32')],agents[_0x5468d6['uniqueid']][_0x5056('0x1b')]));writeDB(agents[_0x5468d6[_0x5056('0x6')]]);var _0x53816f=unanswered[_0x5056('0x51')](_0x5468d6[_0x5056('0x6')]);if(_0x53816f>-0x1){unanswered[_0x5056('0x52')](_0x53816f,0x1);}}if(transfers[_0x5468d6[_0x5056('0x6')]]){transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x11')]=!![];transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')]=utils['now']();transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x25')]=utils[_0x5056('0x53')](transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')],transfers[_0x5468d6['uniqueid']][_0x5056('0x2e')]);transfers[_0x5468d6['uniqueid']][_0x5056('0x32')]=_0x5056('0x54');transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]=_0x5056('0x38');utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5468d6[_0x5056('0x6')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x8')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]));writeDB(transfers[_0x5468d6['uniqueid']],!![]);}if(agents[_0x5468d6['uniqueid']]&&agents[_0x5468d6['uniqueid']][_0x5056('0x2e')]){agents[_0x5468d6['uniqueid']][_0x5056('0x11')]=!![];agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')]=utils['now']();agents[_0x5468d6[_0x5056('0x6')]]['talktime']=utils[_0x5056('0x53')](agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')],agents[_0x5468d6['uniqueid']][_0x5056('0x2e')]);agents[_0x5468d6['uniqueid']]['reason']=agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x3c')]?'transfer':_0x5056('0x54');agents[_0x5468d6['uniqueid']][_0x5056('0x1b')]=_0x5056('0x38');utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x50'),_0x5468d6[_0x5056('0x6')],agents[_0x5468d6['uniqueid']][_0x5056('0x8')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]));writeDB(agents[_0x5468d6[_0x5056('0x6')]]);}}catch(_0x5d5c93){utils[_0x5056('0x1e')](util['format'](_0x5056('0x55'),_0x5468d6[_0x5056('0x6')]),_0x5d5c93);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d156b5c..d672d58 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 _0x5a9e=['newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','lastapplication','util','./utils','FAILED','NO\x20ANSWER','BUSY','blinds','uniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','now','DOCUMENTATION'];(function(_0x2275ba,_0x3ba955){var _0x190f64=function(_0x5e28a5){while(--_0x5e28a5){_0x2275ba['push'](_0x2275ba['shift']());}};_0x190f64(++_0x3ba955);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x5a9e[_0x4d40dd];return _0x1c51f2;};'use strict';var _=require('lodash');var util=require(_0xe5a9('0x0'));var utils=require(_0xe5a9('0x1'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xe5a9('0x2'),_0xe5a9('0x2'),_0xe5a9('0x3'),_0xe5a9('0x3'),_0xe5a9('0x3'),'ANSWERED',_0xe5a9('0x4'),'FAILED',_0xe5a9('0x2'),_0xe5a9('0x2')];var channels={};function writeDB(_0x561aca){var _0x4acfa6;if(transfers[_0xe5a9('0x5')][_0x561aca[_0xe5a9('0x6')]]){_0x4acfa6=_0x561aca[_0xe5a9('0x6')];_0x561aca[_0xe5a9('0x6')]=transfers[_0xe5a9('0x5')][_0x561aca['uniqueid']]['transfereeuniqueid'];}utils[_0xe5a9('0x7')](util['format'](_0xe5a9('0x8'),_0x561aca['uniqueid'],_0x561aca['channel'],_0x561aca[_0xe5a9('0x9')],_0x561aca[_0xe5a9('0xa')],_0x561aca[_0xe5a9('0xb')],_0x561aca[_0xe5a9('0xc')],_0x561aca[_0xe5a9('0xd')],_0x561aca[_0xe5a9('0xe')]));if(_0x561aca[_0xe5a9('0xf')]){utils['getUserByInternal'](_0x561aca[_0xe5a9('0xf')])[_0xe5a9('0x10')](function(_0x1e5577){if(_0x1e5577){_0x561aca[_0xe5a9('0x11')]=_0x1e5577['id'];}utils[_0xe5a9('0x12')](_0xe5a9('0x13'),_0x561aca);});}else{utils[_0xe5a9('0x12')]('CreateVoiceCallReport',_0x561aca);}if(channels[_0x561aca[_0xe5a9('0x6')]]){delete channels[_0x561aca[_0xe5a9('0x6')]];}else if(_0x4acfa6&&channels[_0x4acfa6]){if(!transfers[_0xe5a9('0x5')][_0x4acfa6]['recording'])delete transfers['blinds'][_0x4acfa6];delete channels[_0x4acfa6];}}exports[_0xe5a9('0x14')]=function(_0x369d4f){try{utils[_0xe5a9('0x15')](util[_0xe5a9('0x16')](_0xe5a9('0x17'),_0x369d4f[_0xe5a9('0x6')]),_0x369d4f);if(_0x369d4f['uniqueid']==_0x369d4f[_0xe5a9('0x18')]&&_0x369d4f['channel']!='OutgoingSpoolFailed'){utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x19'),_0x369d4f[_0xe5a9('0x6')],_0x369d4f[_0xe5a9('0x1a')],_0x369d4f[_0xe5a9('0x1b')]));channels[_0x369d4f['uniqueid']]={'uniqueid':_0x369d4f['uniqueid'],'accountcode':_0x369d4f[_0xe5a9('0xf')],'source':_0x369d4f[_0xe5a9('0xc')],'destination':_0x369d4f[_0xe5a9('0x1b')],'destinationcontext':_0x369d4f[_0xe5a9('0x1a')],'channel':_0x369d4f[_0xe5a9('0x1c')],'starttime':utils[_0xe5a9('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xe5a9('0x1e')};}}catch(_0xdc93eb){utils['error'](util[_0xe5a9('0x16')](_0xe5a9('0x17'),_0x369d4f['uniqueid']),_0xdc93eb);}};exports[_0xe5a9('0x1f')]=function(_0x527c12){try{utils[_0xe5a9('0x15')](util[_0xe5a9('0x16')](_0xe5a9('0x20'),_0x527c12[_0xe5a9('0x6')]),_0x527c12);if(!_['isNil'](channels[_0x527c12[_0xe5a9('0x6')]])&&_0x527c12[_0xe5a9('0x21')]==0x6){utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x22'),_0x527c12[_0xe5a9('0x6')],_0x527c12[_0xe5a9('0x1a')],_0x527c12[_0xe5a9('0x1c')]));if(_[_0xe5a9('0x23')](channels[_0x527c12['uniqueid']][_0xe5a9('0x24')])){channels[_0x527c12[_0xe5a9('0x6')]]['systemanswertime']=utils[_0xe5a9('0x1d')]();}}else if(!_['isNil'](channels[_0x527c12[_0xe5a9('0x18')]])&&_0x527c12[_0xe5a9('0x21')]==0x6&&_0x527c12[_0xe5a9('0x1a')]!=_0xe5a9('0x25')){utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x26'),_0x527c12[_0xe5a9('0x6')],_0x527c12[_0xe5a9('0x18')],_0x527c12[_0xe5a9('0x1a')],_0x527c12['channel']));channels[_0x527c12[_0xe5a9('0x18')]][_0xe5a9('0xf')]=_0x527c12[_0xe5a9('0xf')];channels[_0x527c12[_0xe5a9('0x18')]][_0xe5a9('0x27')]=_0x527c12[_0xe5a9('0x1c')];if(_['isNil'](channels[_0x527c12[_0xe5a9('0x18')]]['answertime'])){channels[_0x527c12[_0xe5a9('0x18')]][_0xe5a9('0x28')]=utils[_0xe5a9('0x1d')]();}channels[_0x527c12[_0xe5a9('0x18')]][_0xe5a9('0x29')]=dispositions[_[_0xe5a9('0x2a')](_0x527c12[_0xe5a9('0x21')])]||'ANSWERED';}}catch(_0x23d23a){utils[_0xe5a9('0x2b')](util[_0xe5a9('0x16')](_0xe5a9('0x20'),_0x527c12[_0xe5a9('0x6')]),_0x23d23a);}};exports[_0xe5a9('0x2c')]=function(_0x5e655c){try{if(!_[_0xe5a9('0x23')](channels[_0x5e655c[_0xe5a9('0x6')]])){utils[_0xe5a9('0x15')](util['format'](_0xe5a9('0x2d'),_0x5e655c[_0xe5a9('0x6')]),_0x5e655c);if(_[_0xe5a9('0x23')](channels[_0x5e655c[_0xe5a9('0x6')]][_0xe5a9('0x2e')])){channels[_0x5e655c[_0xe5a9('0x6')]][_0xe5a9('0x2e')]=_0x5e655c[_0xe5a9('0x2f')]+'\x20<'+_0x5e655c[_0xe5a9('0xc')]+'>';}utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x30'),_0x5e655c[_0xe5a9('0x6')],channels[_0x5e655c['uniqueid']]['callerid'],_0x5e655c[_0xe5a9('0x31')]));channels[_0x5e655c[_0xe5a9('0x6')]][_0xe5a9('0x32')]=utils[_0xe5a9('0x1d')]();channels[_0x5e655c[_0xe5a9('0x6')]]['duration']=utils[_0xe5a9('0x33')](channels[_0x5e655c['uniqueid']][_0xe5a9('0x32')],channels[_0x5e655c[_0xe5a9('0x6')]][_0xe5a9('0x34')]);channels[_0x5e655c[_0xe5a9('0x6')]][_0xe5a9('0x35')]=channels[_0x5e655c[_0xe5a9('0x6')]]['answertime']?utils[_0xe5a9('0x33')](channels[_0x5e655c[_0xe5a9('0x6')]][_0xe5a9('0x32')],channels[_0x5e655c[_0xe5a9('0x6')]][_0xe5a9('0x28')]):0x0;writeDB(channels[_0x5e655c[_0xe5a9('0x6')]]);}}catch(_0x269c3c){utils['error'](util['format'](_0xe5a9('0x2d'),_0x5e655c[_0xe5a9('0x6')]),_0x269c3c);}};exports[_0xe5a9('0x36')]=function(_0x179084){try{if(!_['isNil'](channels[_0x179084[_0xe5a9('0x37')]])){utils[_0xe5a9('0x15')](util['format'](_0xe5a9('0x38'),_0x179084[_0xe5a9('0x39')]),_0x179084);if(channels[_0x179084[_0xe5a9('0x37')]][_0xe5a9('0x1c')]==_0x179084[_0xe5a9('0x3a')]){utils[_0xe5a9('0x7')](util['format'](_0xe5a9('0x3b'),_0x179084[_0xe5a9('0x39')],_0x179084[_0xe5a9('0x37')],_0x179084[_0xe5a9('0x3c')]));channels[_0x179084[_0xe5a9('0x37')]][_0xe5a9('0x27')]=_0x179084[_0xe5a9('0x3c')];channels[_0x179084[_0xe5a9('0x37')]][_0xe5a9('0x3d')]='_attended';}else if(channels[_0x179084[_0xe5a9('0x37')]][_0xe5a9('0x1c')]=_0x179084['transfertargetchannel']){utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x3b'),_0x179084['origtransfereruniqueid'],_0x179084[_0xe5a9('0x37')],_0x179084['origtransfererchannel']));channels[_0x179084[_0xe5a9('0x37')]][_0xe5a9('0x27')]=_0x179084[_0xe5a9('0x3e')];channels[_0x179084[_0xe5a9('0x37')]]['userfield']=_0xe5a9('0x3f');}}}catch(_0x1ecf1){utils[_0xe5a9('0x2b')](util[_0xe5a9('0x16')](_0xe5a9('0x38'),_0x179084[_0xe5a9('0x39')]),_0x1ecf1);}};exports[_0xe5a9('0x40')]=function(_0x2ef01e){try{if(!_[_0xe5a9('0x23')](channels[_0x2ef01e[_0xe5a9('0x6')]])){utils[_0xe5a9('0x15')](util[_0xe5a9('0x16')](_0xe5a9('0x41'),_0x2ef01e[_0xe5a9('0x6')]),_0x2ef01e);channels[_0x2ef01e[_0xe5a9('0x6')]][_0xe5a9('0x42')]=utils[_0xe5a9('0x1d')]();utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x43'),_0x2ef01e[_0xe5a9('0x6')],channels[_0x2ef01e[_0xe5a9('0x6')]][_0xe5a9('0x42')]));}}catch(_0x5c401b){utils[_0xe5a9('0x2b')](util[_0xe5a9('0x16')](_0xe5a9('0x41'),_0x2ef01e[_0xe5a9('0x6')]),_0x5c401b);}};exports['musiconholdstop']=function(_0x3c0403){try{if(!_['isNil'](channels[_0x3c0403['uniqueid']])){utils[_0xe5a9('0x15')](util[_0xe5a9('0x16')](_0xe5a9('0x44'),_0x3c0403['uniqueid']),_0x3c0403);if(!_[_0xe5a9('0x23')](channels[_0x3c0403[_0xe5a9('0x6')]][_0xe5a9('0x42')])){channels[_0x3c0403[_0xe5a9('0x6')]][_0xe5a9('0x45')]+=utils['diffTime'](utils[_0xe5a9('0x1d')](),channels[_0x3c0403[_0xe5a9('0x6')]]['musiconholdstartAt']);utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3c0403[_0xe5a9('0x6')],channels[_0x3c0403[_0xe5a9('0x6')]][_0xe5a9('0x45')]));delete channels[_0x3c0403['uniqueid']][_0xe5a9('0x42')];}}}catch(_0xa81fde){utils['error'](util[_0xe5a9('0x16')](_0xe5a9('0x44'),_0x3c0403['uniqueid']),_0xa81fde);}};exports[_0xe5a9('0x46')]=function(_0x17fe9c){try{if(!_[_0xe5a9('0x23')](channels[_0x17fe9c[_0xe5a9('0x6')]])){utils['debug'](util[_0xe5a9('0x16')]('[%s][calls][varset]',_0x17fe9c['uniqueid']),_0x17fe9c);if(!_['isNil'](_0x17fe9c[_0xe5a9('0x47')]['xmd-originatecalleridnum'])){utils['info'](util[_0xe5a9('0x16')](_0xe5a9('0x48'),_0x17fe9c['uniqueid'],_0x17fe9c[_0xe5a9('0x49')]));channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x4a')]=_0x17fe9c['value'];}if(!_['isNil'](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x4b')])){utils['info'](util[_0xe5a9('0x16')](_0xe5a9('0x4c'),_0x17fe9c[_0xe5a9('0x6')],_0x17fe9c[_0xe5a9('0x49')]));channels[_0x17fe9c[_0xe5a9('0x6')]]['destination']=_0x17fe9c[_0xe5a9('0x49')];channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x2e')]='\x22'+_0x17fe9c[_0xe5a9('0x49')]+_0xe5a9('0x4d')+_0x17fe9c[_0xe5a9('0x49')]+'>';}if(!_[_0xe5a9('0x23')](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x4e')])||!_['isNil'](_0x17fe9c[_0xe5a9('0x47')]['xmd-callerid'])){utils[_0xe5a9('0x7')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x17fe9c[_0xe5a9('0x6')],!_['isNil'](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x4e')])?_0xe5a9('0x4e'):_0xe5a9('0x4f'),_0x17fe9c[_0xe5a9('0x49')]));channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x2e')]=_0x17fe9c[_0xe5a9('0x49')];}if(!_[_0xe5a9('0x23')](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x50')])||!_[_0xe5a9('0x23')](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x51')])){utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x52'),_0x17fe9c[_0xe5a9('0x6')],!_[_0xe5a9('0x23')](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x50')])?'xmd-queue':_0xe5a9('0x51'),_0x17fe9c[_0xe5a9('0x49')]));channels[_0x17fe9c[_0xe5a9('0x6')]]['lastapplication']=_0xe5a9('0x53');channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x54')]=_0x17fe9c[_0xe5a9('0x49')];channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x9')]=!![];}if(!_[_0xe5a9('0x23')](_0x17fe9c[_0xe5a9('0x47')]['xmd-contactid'])){utils['info'](util[_0xe5a9('0x16')](_0xe5a9('0x55'),_0x17fe9c[_0xe5a9('0x6')],_0x17fe9c[_0xe5a9('0x49')]));channels[_0x17fe9c['uniqueid']][_0xe5a9('0x56')]=_0x17fe9c[_0xe5a9('0x49')];}if(!_[_0xe5a9('0x23')](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x57')])){utils['info'](util[_0xe5a9('0x16')](_0xe5a9('0x58'),_0x17fe9c[_0xe5a9('0x6')],_0x17fe9c['value']));channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x59')]=_0x17fe9c['value'];}if(!_[_0xe5a9('0x23')](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x5a')])){utils['info'](util[_0xe5a9('0x16')](_0xe5a9('0x5b'),_0x17fe9c[_0xe5a9('0x6')],_0x17fe9c[_0xe5a9('0x49')]));channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x5c')]=_0x17fe9c[_0xe5a9('0x49')];}if(!_['isNil'](_0x17fe9c[_0xe5a9('0x47')][_0xe5a9('0x5d')])){utils[_0xe5a9('0x7')](util[_0xe5a9('0x16')](_0xe5a9('0x5e'),_0x17fe9c['uniqueid'],_0x17fe9c[_0xe5a9('0x49')]));channels[_0x17fe9c[_0xe5a9('0x6')]][_0xe5a9('0x5d')]=_0x17fe9c['value'];}}}catch(_0x1b9dad){utils[_0xe5a9('0x2b')](util['format'](_0xe5a9('0x5f'),_0x17fe9c[_0xe5a9('0x6')]),_0x1b9dad);}};exports['newexten']=function(_0x38b610){try{if(!_[_0xe5a9('0x23')](channels[_0x38b610[_0xe5a9('0x6')]])){utils['debug'](util[_0xe5a9('0x16')](_0xe5a9('0x60'),_0x38b610['uniqueid']),_0x38b610);utils['info'](util[_0xe5a9('0x16')](_0xe5a9('0x61'),_0x38b610[_0xe5a9('0x6')],_0x38b610[_0xe5a9('0x62')],_0x38b610[_0xe5a9('0x63')]));if(_0x38b610[_0xe5a9('0x62')][_0xe5a9('0x64')]()==_0xe5a9('0x65')&&_[_0xe5a9('0x66')](_0x38b610[_0xe5a9('0x63')][_0xe5a9('0x64')](),_0xe5a9('0x67'))){var _0x57dc0b=_0x38b610[_0xe5a9('0x63')]['split']('=');var _0x436dad=_0x57dc0b[0x0][_0xe5a9('0x68')](_0x57dc0b[0x0][_0xe5a9('0x69')]('(')+0x1,_0x57dc0b[0x0]['lastIndexOf'](')'));var _0x24884d=_0x57dc0b[0x1];channels[_0x38b610[_0xe5a9('0x6')]][_0x436dad]=_0x24884d;}if(!_[_0xe5a9('0x6a')](['hangup',_0xe5a9('0x6b'),_0xe5a9('0x6c'),'set','gotoif'],_0x38b610[_0xe5a9('0x62')][_0xe5a9('0x64')]())){channels[_0x38b610[_0xe5a9('0x6')]][_0xe5a9('0x6d')]=_0x38b610[_0xe5a9('0x62')];channels[_0x38b610[_0xe5a9('0x6')]][_0xe5a9('0x54')]=_0x38b610['appdata'];}}}catch(_0x1cf6ba){utils['error'](util[_0xe5a9('0x16')](_0xe5a9('0x60'),_0x38b610[_0xe5a9('0x6')]),_0x1cf6ba);}}; \ No newline at end of file +var _0x4da5=['startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastdata','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','info','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','newstate','debug','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','duration','diffTime','starttime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4da5,0x1b7));var _0x54da=function(_0x1fcdeb,_0xe8ce8f){_0x1fcdeb=_0x1fcdeb-0x0;var _0x54c11a=_0x4da5[_0x1fcdeb];return _0x54c11a;};'use strict';var _=require('lodash');var util=require(_0x54da('0x0'));var utils=require(_0x54da('0x1'));var transfers=require(_0x54da('0x2'));var dispositions=['NO\x20ANSWER',_0x54da('0x3'),'FAILED',_0x54da('0x4'),_0x54da('0x4'),_0x54da('0x4'),_0x54da('0x5'),'BUSY',_0x54da('0x3'),_0x54da('0x3'),_0x54da('0x3')];var channels={};function writeDB(_0x1b2b5c){var _0x2fe7cc;if(transfers[_0x54da('0x6')][_0x1b2b5c[_0x54da('0x7')]]){_0x2fe7cc=_0x1b2b5c['uniqueid'];_0x1b2b5c[_0x54da('0x7')]=transfers[_0x54da('0x6')][_0x1b2b5c[_0x54da('0x7')]]['transfereeuniqueid'];}utils[_0x54da('0x8')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1b2b5c[_0x54da('0x7')],_0x1b2b5c[_0x54da('0x9')],_0x1b2b5c[_0x54da('0xa')],_0x1b2b5c[_0x54da('0xb')],_0x1b2b5c[_0x54da('0xc')],_0x1b2b5c[_0x54da('0xd')],_0x1b2b5c[_0x54da('0xe')],_0x1b2b5c[_0x54da('0xf')]));if(_0x1b2b5c[_0x54da('0x10')]){utils[_0x54da('0x11')](_0x1b2b5c[_0x54da('0x10')])[_0x54da('0x12')](function(_0x425756){if(_0x425756){_0x1b2b5c['UserId']=_0x425756['id'];}utils[_0x54da('0x13')](_0x54da('0x14'),_0x1b2b5c);});}else{utils[_0x54da('0x13')](_0x54da('0x14'),_0x1b2b5c);}if(channels[_0x1b2b5c['uniqueid']]){delete channels[_0x1b2b5c[_0x54da('0x7')]];}else if(_0x2fe7cc&&channels[_0x2fe7cc]){if(!transfers[_0x54da('0x6')][_0x2fe7cc][_0x54da('0x15')])delete transfers[_0x54da('0x6')][_0x2fe7cc];delete channels[_0x2fe7cc];}}exports[_0x54da('0x16')]=function(_0xf7bc1f){try{utils['debug'](util[_0x54da('0x17')](_0x54da('0x18'),_0xf7bc1f['uniqueid']),_0xf7bc1f);if(_0xf7bc1f[_0x54da('0x7')]==_0xf7bc1f[_0x54da('0x19')]&&_0xf7bc1f['channel']!='OutgoingSpoolFailed'){utils[_0x54da('0x8')](util['format'](_0x54da('0x1a'),_0xf7bc1f[_0x54da('0x7')],_0xf7bc1f['context'],_0xf7bc1f[_0x54da('0x1b')]));channels[_0xf7bc1f[_0x54da('0x7')]]={'uniqueid':_0xf7bc1f[_0x54da('0x7')],'accountcode':_0xf7bc1f[_0x54da('0x10')],'source':_0xf7bc1f[_0x54da('0xd')],'destination':_0xf7bc1f[_0x54da('0x1b')],'destinationcontext':_0xf7bc1f[_0x54da('0x1c')],'channel':_0xf7bc1f[_0x54da('0x9')],'starttime':utils[_0x54da('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x54da('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x17dfb8){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x18'),_0xf7bc1f[_0x54da('0x7')]),_0x17dfb8);}};exports[_0x54da('0x1f')]=function(_0x5839fc){try{utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x21'),_0x5839fc[_0x54da('0x7')]),_0x5839fc);if(!_[_0x54da('0x22')](channels[_0x5839fc[_0x54da('0x7')]])&&_0x5839fc['channelstate']==0x6){utils[_0x54da('0x8')](util['format'](_0x54da('0x23'),_0x5839fc[_0x54da('0x7')],_0x5839fc[_0x54da('0x1c')],_0x5839fc['channel']));if(_['isNil'](channels[_0x5839fc[_0x54da('0x7')]][_0x54da('0x24')])){channels[_0x5839fc[_0x54da('0x7')]]['systemanswertime']=utils[_0x54da('0x1d')]();}}else if(!_[_0x54da('0x22')](channels[_0x5839fc['linkedid']])&&_0x5839fc[_0x54da('0x25')]==0x6&&_0x5839fc[_0x54da('0x1c')]!=_0x54da('0x26')){utils['info'](util['format'](_0x54da('0x27'),_0x5839fc['uniqueid'],_0x5839fc[_0x54da('0x19')],_0x5839fc[_0x54da('0x1c')],_0x5839fc[_0x54da('0x9')]));channels[_0x5839fc[_0x54da('0x19')]][_0x54da('0x10')]=_0x5839fc[_0x54da('0x10')];channels[_0x5839fc[_0x54da('0x19')]][_0x54da('0x28')]=_0x5839fc['channel'];if(_[_0x54da('0x22')](channels[_0x5839fc[_0x54da('0x19')]]['answertime'])){channels[_0x5839fc['linkedid']][_0x54da('0x29')]=utils[_0x54da('0x1d')]();}channels[_0x5839fc[_0x54da('0x19')]][_0x54da('0x2a')]=dispositions[_[_0x54da('0x2b')](_0x5839fc[_0x54da('0x25')])]||_0x54da('0x5');}}catch(_0x4e0808){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x21'),_0x5839fc[_0x54da('0x7')]),_0x4e0808);}};exports['hangup']=function(_0x2d1fe8){try{if(!_[_0x54da('0x22')](channels[_0x2d1fe8['uniqueid']])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x2c'),_0x2d1fe8[_0x54da('0x7')]),_0x2d1fe8);if(_[_0x54da('0x22')](channels[_0x2d1fe8['uniqueid']]['callerid'])){channels[_0x2d1fe8[_0x54da('0x7')]]['callerid']=_0x2d1fe8['calleridname']+'\x20<'+_0x2d1fe8['calleridnum']+'>';}utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x2d'),_0x2d1fe8[_0x54da('0x7')],channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x2e')],_0x2d1fe8[_0x54da('0x2f')]));channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x30')]=utils[_0x54da('0x1d')]();channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x31')]=utils[_0x54da('0x32')](channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x30')],channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x33')]);channels[_0x2d1fe8[_0x54da('0x7')]]['billableseconds']=channels[_0x2d1fe8[_0x54da('0x7')]]['answertime']?utils[_0x54da('0x32')](channels[_0x2d1fe8['uniqueid']][_0x54da('0x30')],channels[_0x2d1fe8[_0x54da('0x7')]][_0x54da('0x29')]):0x0;writeDB(channels[_0x2d1fe8['uniqueid']]);}}catch(_0x2ea9eb){utils['error'](util[_0x54da('0x17')](_0x54da('0x2c'),_0x2d1fe8[_0x54da('0x7')]),_0x2ea9eb);}};exports['attendedtransfer']=function(_0x31678f){try{if(!_[_0x54da('0x22')](channels[_0x31678f[_0x54da('0x34')]])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x35'),_0x31678f[_0x54da('0x36')]),_0x31678f);if(channels[_0x31678f[_0x54da('0x34')]][_0x54da('0x9')]==_0x31678f['transfereechannel']){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x37'),_0x31678f['origtransfereruniqueid'],_0x31678f[_0x54da('0x34')],_0x31678f['secondtransfererchannel']));channels[_0x31678f[_0x54da('0x34')]][_0x54da('0x28')]=_0x31678f['secondtransfererchannel'];channels[_0x31678f[_0x54da('0x34')]]['userfield']='_attended';}else if(channels[_0x31678f[_0x54da('0x34')]]['channel']=_0x31678f[_0x54da('0x38')]){utils['info'](util['format'](_0x54da('0x37'),_0x31678f[_0x54da('0x36')],_0x31678f[_0x54da('0x34')],_0x31678f[_0x54da('0x39')]));channels[_0x31678f[_0x54da('0x34')]]['destinationchannel']=_0x31678f[_0x54da('0x39')];channels[_0x31678f[_0x54da('0x34')]][_0x54da('0x3a')]=_0x54da('0x3b');}}}catch(_0x6c9741){utils[_0x54da('0x1e')](util['format'](_0x54da('0x35'),_0x31678f[_0x54da('0x36')]),_0x6c9741);}};exports[_0x54da('0x3c')]=function(_0x53ab6a){try{if(!_[_0x54da('0x22')](channels[_0x53ab6a['uniqueid']])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x3d'),_0x53ab6a['uniqueid']),_0x53ab6a);channels[_0x53ab6a[_0x54da('0x7')]][_0x54da('0x3e')]=utils[_0x54da('0x1d')]();utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x3f'),_0x53ab6a[_0x54da('0x7')],channels[_0x53ab6a['uniqueid']][_0x54da('0x3e')]));}}catch(_0xfd856d){utils[_0x54da('0x1e')](util[_0x54da('0x17')]('[%s][calls][musiconholdstart]',_0x53ab6a['uniqueid']),_0xfd856d);}};exports[_0x54da('0x40')]=function(_0x59aa1e){try{if(!_[_0x54da('0x22')](channels[_0x59aa1e['uniqueid']])){utils[_0x54da('0x20')](util['format'](_0x54da('0x41'),_0x59aa1e[_0x54da('0x7')]),_0x59aa1e);if(!_['isNil'](channels[_0x59aa1e[_0x54da('0x7')]][_0x54da('0x3e')])){channels[_0x59aa1e['uniqueid']]['mohtime']+=utils[_0x54da('0x32')](utils[_0x54da('0x1d')](),channels[_0x59aa1e[_0x54da('0x7')]][_0x54da('0x3e')]);utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x42'),_0x59aa1e['uniqueid'],channels[_0x59aa1e[_0x54da('0x7')]]['mohtime']));delete channels[_0x59aa1e[_0x54da('0x7')]][_0x54da('0x3e')];}}}catch(_0x201df3){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x41'),_0x59aa1e[_0x54da('0x7')]),_0x201df3);}};exports[_0x54da('0x43')]=function(_0x5f5af5){try{if(!_[_0x54da('0x22')](channels[_0x5f5af5[_0x54da('0x7')]])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x44'),_0x5f5af5[_0x54da('0x7')]),_0x5f5af5);if(!_['isNil'](_0x5f5af5['variable'][_0x54da('0x45')])){utils['info'](util[_0x54da('0x17')](_0x54da('0x46'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5['uniqueid']][_0x54da('0x48')]=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4a')])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x4b'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5['value']));channels[_0x5f5af5[_0x54da('0x7')]]['destination']=_0x5f5af5[_0x54da('0x47')];channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x2e')]='\x22'+_0x5f5af5['value']+'\x22\x20<'+_0x5f5af5['value']+'>';}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4c')])||!_[_0x54da('0x22')](_0x5f5af5['variable'][_0x54da('0x4d')])){utils['info'](util[_0x54da('0x17')](_0x54da('0x4e'),_0x5f5af5[_0x54da('0x7')],!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')]['xmd-callerid-preview'])?_0x54da('0x4c'):_0x54da('0x4d'),_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x2e')]=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4f')])||!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x50')])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x4e'),_0x5f5af5[_0x54da('0x7')],!_['isNil'](_0x5f5af5[_0x54da('0x49')][_0x54da('0x4f')])?_0x54da('0x4f'):_0x54da('0x50'),_0x5f5af5['value']));channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x51')]=_0x54da('0x52');channels[_0x5f5af5['uniqueid']]['lastdata']=_0x5f5af5['value'];channels[_0x5f5af5['uniqueid']]['queue']=!![];}if(!_['isNil'](_0x5f5af5[_0x54da('0x49')]['xmd-contactid'])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x53'),_0x5f5af5['uniqueid'],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]][_0x54da('0x54')]=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x55')])){utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x56'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]]['type']=_0x5f5af5[_0x54da('0x47')];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')]['outboundrouteid'])){utils[_0x54da('0x8')](util[_0x54da('0x17')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5f5af5[_0x54da('0x7')],_0x5f5af5['value']));channels[_0x5f5af5['uniqueid']]['routeid']=_0x5f5af5['value'];}if(!_[_0x54da('0x22')](_0x5f5af5[_0x54da('0x49')][_0x54da('0x57')])){utils[_0x54da('0x8')](util['format'](_0x54da('0x58'),_0x5f5af5[_0x54da('0x7')],_0x5f5af5[_0x54da('0x47')]));channels[_0x5f5af5[_0x54da('0x7')]]['sipcallid']=_0x5f5af5[_0x54da('0x47')];}}}catch(_0x30e79e){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x44'),_0x5f5af5[_0x54da('0x7')]),_0x30e79e);}};exports[_0x54da('0x59')]=function(_0x562583){try{if(!_['isNil'](channels[_0x562583[_0x54da('0x7')]])){utils[_0x54da('0x20')](util[_0x54da('0x17')](_0x54da('0x5a'),_0x562583[_0x54da('0x7')]),_0x562583);utils[_0x54da('0x8')](util[_0x54da('0x17')](_0x54da('0x5b'),_0x562583[_0x54da('0x7')],_0x562583[_0x54da('0x5c')],_0x562583[_0x54da('0x5d')]));if(_0x562583[_0x54da('0x5c')][_0x54da('0x5e')]()==_0x54da('0x5f')&&_[_0x54da('0x60')](_0x562583['appdata']['toLowerCase'](),_0x54da('0x61'))){var _0x4a19eb=_0x562583[_0x54da('0x5d')][_0x54da('0x62')]('=');var _0x2ad4a2=_0x4a19eb[0x0][_0x54da('0x63')](_0x4a19eb[0x0][_0x54da('0x64')]('(')+0x1,_0x4a19eb[0x0]['lastIndexOf'](')'));var _0x299abc=_0x4a19eb[0x1];channels[_0x562583['uniqueid']][_0x2ad4a2]=_0x299abc;}if(!_[_0x54da('0x65')]([_0x54da('0x66'),_0x54da('0x67'),_0x54da('0x68'),_0x54da('0x5f'),_0x54da('0x69')],_0x562583[_0x54da('0x5c')]['toLowerCase']())){channels[_0x562583[_0x54da('0x7')]][_0x54da('0x51')]=_0x562583[_0x54da('0x5c')];channels[_0x562583[_0x54da('0x7')]][_0x54da('0x6a')]=_0x562583[_0x54da('0x5d')];}}}catch(_0x1f6b06){utils[_0x54da('0x1e')](util[_0x54da('0x17')](_0x54da('0x5a'),_0x562583[_0x54da('0x7')]),_0x1f6b06);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a693f7d..441ee46 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 _0x7a95=['./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x8909d8,_0xbf4955){var _0x31c117=function(_0x402151){while(--_0x402151){_0x8909d8['push'](_0x8909d8['shift']());}};_0x31c117(++_0xbf4955);}(_0x7a95,0x113));var _0x57a9=function(_0x128343,_0x3c6d62){_0x128343=_0x128343-0x0;var _0x23610b=_0x7a95[_0x128343];return _0x23610b;};'use strict';var utils=require(_0x57a9('0x0'));exports[_0x57a9('0x1')]=function(){utils[_0x57a9('0x2')](_0x57a9('0x3'));};exports[_0x57a9('0x4')]=function(){utils[_0x57a9('0x2')](_0x57a9('0x5'));};exports['fullybooted']=function(){utils[_0x57a9('0x2')](_0x57a9('0x6'));};exports[_0x57a9('0x7')]=function(_0x112c95){utils[_0x57a9('0x7')](_0x57a9('0x8'),_0x112c95);};exports[_0x57a9('0x9')]=function(){utils[_0x57a9('0x2')]('[core]\x20close');};exports[_0x57a9('0xa')]=function(_0x340391){}; \ No newline at end of file +var _0xd866=['fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','connect','[core]\x20connected','info','[core]\x20shutdown'];(function(_0x54f33a,_0x4ddf56){var _0x55c3a5=function(_0x112bec){while(--_0x112bec){_0x54f33a['push'](_0x54f33a['shift']());}};_0x55c3a5(++_0x4ddf56);}(_0xd866,0x1d2));var _0x6d86=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xd866[_0x770f7];return _0xe797c6;};'use strict';var utils=require('./utils');exports[_0x6d86('0x0')]=function(){utils['info'](_0x6d86('0x1'));};exports['shutdown']=function(){utils[_0x6d86('0x2')](_0x6d86('0x3'));};exports[_0x6d86('0x4')]=function(){utils[_0x6d86('0x2')](_0x6d86('0x5'));};exports[_0x6d86('0x6')]=function(_0x4f982f){utils[_0x6d86('0x6')]('[core]\x20error',_0x4f982f);};exports[_0x6d86('0x7')]=function(){utils[_0x6d86('0x2')](_0x6d86('0x8'));};exports[_0x6d86('0x9')]=function(_0x234d79){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1db25cb..ede766c 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 _0xfb17=['outboundrouteid','value','[%s][dials][dialbegin]','assign','starttime','now','called','dialend','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','endtime','holdtime','billableseconds','diffTime','[%s][dials][hangup]','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil'];(function(_0x530a52,_0x5a30a2){var _0x59fa95=function(_0x2c91a5){while(--_0x2c91a5){_0x530a52['push'](_0x530a52['shift']());}};_0x59fa95(++_0x5a30a2);}(_0xfb17,0x16e));var _0x7fb1=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xfb17[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x7fb1('0x0'));var util=require(_0x7fb1('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x247ebb){utils['info'](util[_0x7fb1('0x2')](_0x7fb1('0x3'),_0x247ebb[_0x7fb1('0x4')],_0x247ebb[_0x7fb1('0x5')],_0x247ebb[_0x7fb1('0x6')],_0x247ebb[_0x7fb1('0x7')],_0x247ebb[_0x7fb1('0x8')],_0x247ebb['dialstatus']));utils[_0x7fb1('0x9')](_0x7fb1('0xa'),_0x247ebb);delete dials[_0x247ebb[_0x7fb1('0x4')]];}exports['newexten']=function(_0x2ebf72){try{utils[_0x7fb1('0xb')](util[_0x7fb1('0x2')](_0x7fb1('0xc'),_0x2ebf72[_0x7fb1('0x4')]),_0x2ebf72);utils[_0x7fb1('0xd')](util[_0x7fb1('0x2')](_0x7fb1('0xe'),_0x2ebf72[_0x7fb1('0x4')],_0x2ebf72[_0x7fb1('0xf')],_0x2ebf72[_0x7fb1('0x10')]));if(_0x2ebf72['application'][_0x7fb1('0x11')]()==_0x7fb1('0x12')&&_[_0x7fb1('0x13')](_0x2ebf72[_0x7fb1('0x10')]['toLowerCase'](),_0x7fb1('0x14'))){var _0xdc1180=_0x2ebf72['appdata'][_0x7fb1('0x15')]('=');dials[_0x2ebf72['uniqueid']]={'routeId':_0xdc1180[0x1]};}}catch(_0xf984f3){utils[_0x7fb1('0x16')](util[_0x7fb1('0x2')](_0x7fb1('0xc'),_0x2ebf72[_0x7fb1('0x4')]),_0xf984f3);}};exports[_0x7fb1('0x17')]=function(_0x37645a){try{utils['debug'](util[_0x7fb1('0x2')](_0x7fb1('0x18'),_0x37645a[_0x7fb1('0x4')]),_0x37645a);if(!_[_0x7fb1('0x19')](_0x37645a['variable'][_0x7fb1('0x1a')])){utils['info'](util[_0x7fb1('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x37645a['uniqueid'],_0x37645a[_0x7fb1('0x1b')]));dials[_0x37645a['uniqueid']]={'routeId':_0x37645a['value']};}}catch(_0x32283e){utils[_0x7fb1('0x16')](util[_0x7fb1('0x2')](_0x7fb1('0x18'),_0x37645a['uniqueid']),_0x32283e);}};exports['dialbegin']=function(_0x379771){try{if(!_['isNil'](dials[_0x379771[_0x7fb1('0x4')]])){utils['debug'](util['format'](_0x7fb1('0x1c'),_0x379771[_0x7fb1('0x4')]),_0x379771);dials[_0x379771[_0x7fb1('0x4')]]=_[_0x7fb1('0x1d')](dials[_0x379771[_0x7fb1('0x4')]],_0x379771);dials[_0x379771[_0x7fb1('0x4')]][_0x7fb1('0x1e')]=utils[_0x7fb1('0x1f')]();dials[_0x379771[_0x7fb1('0x4')]]['lastevent']=_0x7fb1('0x20');utils[_0x7fb1('0xd')](util[_0x7fb1('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x379771['uniqueid'],dials[_0x379771[_0x7fb1('0x4')]][_0x7fb1('0x1e')]));}}catch(_0x1c95cb){utils[_0x7fb1('0x16')](util[_0x7fb1('0x2')]('[%s][dials][dialbegin]',_0x379771[_0x7fb1('0x4')]),_0x1c95cb);}};exports[_0x7fb1('0x21')]=function(_0xf309cf){try{if(!_['isNil'](dials[_0xf309cf['uniqueid']])){utils[_0x7fb1('0xb')](util[_0x7fb1('0x2')]('[%s][dials][dialend]',_0xf309cf['uniqueid']),_0xf309cf);dials[_0xf309cf['uniqueid']][_0x7fb1('0x22')]=_0xf309cf[_0x7fb1('0x22')];if(_0xf309cf[_0x7fb1('0x22')]==_0x7fb1('0x23')){dials[_0xf309cf['uniqueid']]=_[_0x7fb1('0x1d')](dials[_0xf309cf[_0x7fb1('0x4')]],_0xf309cf);dials[_0xf309cf[_0x7fb1('0x4')]][_0x7fb1('0x24')]=utils[_0x7fb1('0x1f')]();dials[_0xf309cf['uniqueid']]['lastevent']=_0x7fb1('0x25');utils[_0x7fb1('0xd')](util[_0x7fb1('0x2')](_0x7fb1('0x26'),_0xf309cf['uniqueid'],_0xf309cf['dialstatus'],dials[_0xf309cf[_0x7fb1('0x4')]][_0x7fb1('0x24')]));}else{utils['info'](util[_0x7fb1('0x2')](_0x7fb1('0x27'),_0xf309cf[_0x7fb1('0x4')],_0xf309cf['dialstatus']));}}}catch(_0xb531fd){utils['error'](util['format']('[%s][dials][dialend]',_0xf309cf[_0x7fb1('0x4')]),_0xb531fd);}};exports['hangup']=function(_0x397e9b){try{if(!_['isNil'](dials[_0x397e9b[_0x7fb1('0x4')]])){utils[_0x7fb1('0xb')](util[_0x7fb1('0x2')]('[%s][dials][hangup]',_0x397e9b[_0x7fb1('0x4')]),_0x397e9b);utils[_0x7fb1('0xd')](util[_0x7fb1('0x2')](_0x7fb1('0x28'),_0x397e9b[_0x7fb1('0x4')],_0x397e9b[_0x7fb1('0x7')],_0x397e9b[_0x7fb1('0x29')],_0x397e9b[_0x7fb1('0x2a')]));dials[_0x397e9b[_0x7fb1('0x4')]]=_['assign'](dials[_0x397e9b[_0x7fb1('0x4')]],{'endtime':utils[_0x7fb1('0x1f')](),'lastevent':'complete'});dials[_0x397e9b[_0x7fb1('0x4')]][_0x7fb1('0x2b')]=utils['diffTime'](dials[_0x397e9b[_0x7fb1('0x4')]][_0x7fb1('0x2c')],dials[_0x397e9b[_0x7fb1('0x4')]]['starttime']);dials[_0x397e9b['uniqueid']][_0x7fb1('0x2d')]=utils['diffTime'](dials[_0x397e9b[_0x7fb1('0x4')]]['answertime']||dials[_0x397e9b[_0x7fb1('0x4')]][_0x7fb1('0x2c')],dials[_0x397e9b[_0x7fb1('0x4')]][_0x7fb1('0x1e')]);dials[_0x397e9b[_0x7fb1('0x4')]][_0x7fb1('0x2e')]=dials[_0x397e9b[_0x7fb1('0x4')]][_0x7fb1('0x24')]?utils[_0x7fb1('0x2f')](dials[_0x397e9b[_0x7fb1('0x4')]][_0x7fb1('0x2c')],dials[_0x397e9b['uniqueid']][_0x7fb1('0x24')]):0x0;writeDB(dials[_0x397e9b['uniqueid']]);}}catch(_0x3bb548){utils[_0x7fb1('0x16')](util[_0x7fb1('0x2')](_0x7fb1('0x30'),_0x397e9b[_0x7fb1('0x4')]),_0x3bb548);}}; \ No newline at end of file +var _0x4183=['now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','assign','complete','duration','diffTime','endtime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','cdr(routeid)','appdata','split','error','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][dialbegin]','starttime'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0x4183,0x77));var _0x3418=function(_0x2707f4,_0x4c8b90){_0x2707f4=_0x2707f4-0x0;var _0x10122d=_0x4183[_0x2707f4];return _0x10122d;};'use strict';var _=require('lodash');var util=require(_0x3418('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x5e8972){utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0x3'),_0x5e8972[_0x3418('0x4')],_0x5e8972[_0x3418('0x5')],_0x5e8972[_0x3418('0x6')],_0x5e8972[_0x3418('0x7')],_0x5e8972[_0x3418('0x8')],_0x5e8972[_0x3418('0x9')]));utils['request']('CreateVoiceDialReport',_0x5e8972);delete dials[_0x5e8972[_0x3418('0x4')]];}exports[_0x3418('0xa')]=function(_0x291b05){try{utils['debug'](util['format'](_0x3418('0xb'),_0x291b05[_0x3418('0x4')]),_0x291b05);utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0xc'),_0x291b05[_0x3418('0x4')],_0x291b05['application'],_0x291b05['appdata']));if(_0x291b05['application'][_0x3418('0xd')]()==_0x3418('0xe')&&_[_0x3418('0xf')](_0x291b05['appdata'][_0x3418('0xd')](),_0x3418('0x10'))){var _0x20f744=_0x291b05[_0x3418('0x11')][_0x3418('0x12')]('=');dials[_0x291b05['uniqueid']]={'routeId':_0x20f744[0x1]};}}catch(_0x1cca4c){utils[_0x3418('0x13')](util[_0x3418('0x2')](_0x3418('0xb'),_0x291b05['uniqueid']),_0x1cca4c);}};exports['varset']=function(_0x58b9c2){try{utils[_0x3418('0x14')](util[_0x3418('0x2')](_0x3418('0x15'),_0x58b9c2['uniqueid']),_0x58b9c2);if(!_[_0x3418('0x16')](_0x58b9c2[_0x3418('0x17')][_0x3418('0x18')])){utils['info'](util[_0x3418('0x2')](_0x3418('0x19'),_0x58b9c2[_0x3418('0x4')],_0x58b9c2['value']));dials[_0x58b9c2[_0x3418('0x4')]]={'routeId':_0x58b9c2['value']};}}catch(_0x32484b){utils[_0x3418('0x13')](util[_0x3418('0x2')](_0x3418('0x15'),_0x58b9c2[_0x3418('0x4')]),_0x32484b);}};exports['dialbegin']=function(_0x323ea0){try{if(!_['isNil'](dials[_0x323ea0[_0x3418('0x4')]])){utils[_0x3418('0x14')](util[_0x3418('0x2')](_0x3418('0x1a'),_0x323ea0[_0x3418('0x4')]),_0x323ea0);dials[_0x323ea0[_0x3418('0x4')]]=_['assign'](dials[_0x323ea0[_0x3418('0x4')]],_0x323ea0);dials[_0x323ea0[_0x3418('0x4')]][_0x3418('0x1b')]=utils[_0x3418('0x1c')]();dials[_0x323ea0[_0x3418('0x4')]][_0x3418('0x1d')]=_0x3418('0x1e');utils[_0x3418('0x1')](util['format'](_0x3418('0x1f'),_0x323ea0[_0x3418('0x4')],dials[_0x323ea0['uniqueid']][_0x3418('0x1b')]));}}catch(_0x5a7596){utils['error'](util['format'](_0x3418('0x1a'),_0x323ea0[_0x3418('0x4')]),_0x5a7596);}};exports[_0x3418('0x20')]=function(_0x519d67){try{if(!_[_0x3418('0x16')](dials[_0x519d67[_0x3418('0x4')]])){utils[_0x3418('0x14')](util['format'](_0x3418('0x21'),_0x519d67[_0x3418('0x4')]),_0x519d67);dials[_0x519d67['uniqueid']]['dialstatus']=_0x519d67[_0x3418('0x9')];if(_0x519d67[_0x3418('0x9')]==_0x3418('0x22')){dials[_0x519d67['uniqueid']]=_['assign'](dials[_0x519d67[_0x3418('0x4')]],_0x519d67);dials[_0x519d67[_0x3418('0x4')]][_0x3418('0x23')]=utils['now']();dials[_0x519d67['uniqueid']][_0x3418('0x1d')]=_0x3418('0x24');utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0x25'),_0x519d67[_0x3418('0x4')],_0x519d67[_0x3418('0x9')],dials[_0x519d67['uniqueid']][_0x3418('0x23')]));}else{utils[_0x3418('0x1')](util[_0x3418('0x2')](_0x3418('0x26'),_0x519d67[_0x3418('0x4')],_0x519d67['dialstatus']));}}}catch(_0x4b4486){utils[_0x3418('0x13')](util[_0x3418('0x2')]('[%s][dials][dialend]',_0x519d67[_0x3418('0x4')]),_0x4b4486);}};exports[_0x3418('0x27')]=function(_0x59b572){try{if(!_[_0x3418('0x16')](dials[_0x59b572[_0x3418('0x4')]])){utils[_0x3418('0x14')](util[_0x3418('0x2')](_0x3418('0x28'),_0x59b572[_0x3418('0x4')]),_0x59b572);utils[_0x3418('0x1')](util[_0x3418('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x59b572[_0x3418('0x4')],_0x59b572[_0x3418('0x7')],_0x59b572[_0x3418('0x29')],_0x59b572[_0x3418('0x2a')]));dials[_0x59b572[_0x3418('0x4')]]=_[_0x3418('0x2b')](dials[_0x59b572['uniqueid']],{'endtime':utils[_0x3418('0x1c')](),'lastevent':_0x3418('0x2c')});dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x2d')]=utils[_0x3418('0x2e')](dials[_0x59b572[_0x3418('0x4')]]['endtime'],dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x1b')]);dials[_0x59b572[_0x3418('0x4')]]['holdtime']=utils[_0x3418('0x2e')](dials[_0x59b572['uniqueid']][_0x3418('0x23')]||dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x2f')],dials[_0x59b572['uniqueid']]['starttime']);dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x30')]=dials[_0x59b572[_0x3418('0x4')]]['answertime']?utils[_0x3418('0x2e')](dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x2f')],dials[_0x59b572[_0x3418('0x4')]][_0x3418('0x23')]):0x0;writeDB(dials[_0x59b572[_0x3418('0x4')]]);}}catch(_0x211dfa){utils[_0x3418('0x13')](util[_0x3418('0x2')]('[%s][dials][hangup]',_0x59b572[_0x3418('0x4')]),_0x211dfa);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 3decbf6..4e9ed7d 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 _0x6878=['varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x144a87,_0x1afddd){var _0x265cf7=function(_0x961314){while(--_0x961314){_0x144a87['push'](_0x144a87['shift']());}};_0x265cf7(++_0x1afddd);}(_0x6878,0x1ca));var _0x8687=function(_0xd48dda,_0x53b6da){_0xd48dda=_0xd48dda-0x0;var _0x51b3d2=_0x6878[_0xd48dda];return _0x51b3d2;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x8687('0x0'));var util=require(_0x8687('0x1'));var isXDREnabled=config[_0x8687('0x2')]&&config[_0x8687('0x2')][_0x8687('0x3')]?!config[_0x8687('0x2')][_0x8687('0x3')]:!![];var isProduction=config[_0x8687('0x4')]===_0x8687('0x5')||![];var isLocalAsterisk=config['xdr']&&config['xdr'][_0x8687('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x8687('0x7')][_0x8687('0x8')],config[_0x8687('0x7')]['ip'],config[_0x8687('0x7')][_0x8687('0x9')],config[_0x8687('0x7')][_0x8687('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x8687('0xb')](_0x8687('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8687('0xb')](_0x8687('0xd'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x8687('0xe'));var recordings=require('./recordings.controller');var members=require(_0x8687('0xf'));var dials=require(_0x8687('0x10'));var transfers=require(_0x8687('0x11'));var core=require(_0x8687('0x12'));ami['on'](_0x8687('0x13'),core[_0x8687('0x13')]);ami['on']('shutdown',core[_0x8687('0x14')]);ami['on'](_0x8687('0x15'),core[_0x8687('0x15')]);ami['on']('error',core[_0x8687('0x16')]);ami['on'](_0x8687('0x17'),core['close']);ami['on'](_0x8687('0x18'),core[_0x8687('0x18')]);ami['on']('devicestatechange',function(_0x3e86b0){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')]('[%s][index][devicestatechange]',_0x3e86b0[_0x8687('0x1b')]),_0x3e86b0);members['devicestatechange'](_0x3e86b0);}catch(_0xc6627e){utils[_0x8687('0x16')](util[_0x8687('0x1a')]('[%s][index][devicestatechange]',_0x3e86b0[_0x8687('0x1b')]),_0xc6627e);}});ami['on']('agentcalled',function(_0x2e7273){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x1c'),_0x2e7273[_0x8687('0x1d')]),_0x2e7273);agents[_0x8687('0x1e')](_0x2e7273);}catch(_0xe7d0e2){utils[_0x8687('0x16')](util[_0x8687('0x1a')](_0x8687('0x1c'),_0x2e7273[_0x8687('0x1d')]),_0xe7d0e2);}});ami['on'](_0x8687('0x1f'),function(_0x5823a0){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')]('[%s][index][agentringnoanswer]',_0x5823a0[_0x8687('0x1d')]),_0x5823a0);agents[_0x8687('0x1f')](_0x5823a0);}catch(_0x57a57c){utils['error'](util['format'](_0x8687('0x20'),_0x5823a0[_0x8687('0x1d')]),_0x57a57c);}});ami['on'](_0x8687('0x21'),function(_0x205403){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')]('[%s][index][agentconnect]',_0x205403[_0x8687('0x1d')]),_0x205403);agents[_0x8687('0x21')](_0x205403);queues['agentconnect'](_0x205403);}catch(_0x5e6529){utils[_0x8687('0x16')](util['format']('[%s][index][agentconnect]',_0x205403[_0x8687('0x1d')]),_0x5e6529);}});ami['on'](_0x8687('0x22'),function(_0x4b0f81){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x23'),_0x4b0f81[_0x8687('0x1d')]),_0x4b0f81);agents[_0x8687('0x22')](_0x4b0f81);queues['agentcomplete'](_0x4b0f81);members[_0x8687('0x22')](_0x4b0f81);}catch(_0xb49f12){utils[_0x8687('0x16')](util[_0x8687('0x1a')](_0x8687('0x23'),_0x4b0f81[_0x8687('0x1d')]),_0xb49f12);}});ami['on'](_0x8687('0x24'),function(_0x2f34be){try{utils['debug'](util[_0x8687('0x1a')](_0x8687('0x25'),_0x2f34be[_0x8687('0x1d')]),_0x2f34be);agents['queuecallerabandon'](_0x2f34be);queues[_0x8687('0x24')](_0x2f34be);}catch(_0x32b563){utils[_0x8687('0x16')](util[_0x8687('0x1a')](_0x8687('0x25'),_0x2f34be[_0x8687('0x1d')]),_0x32b563);}});ami['on'](_0x8687('0x26'),function(_0x232252){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')]('[%s][index][queuecallerjoin]',_0x232252[_0x8687('0x1d')]),_0x232252);queues[_0x8687('0x26')](_0x232252);recordings['queuecallerjoin'](_0x232252);}catch(_0x40a6d6){utils[_0x8687('0x16')](util[_0x8687('0x1a')](_0x8687('0x27'),_0x232252[_0x8687('0x1d')]),_0x40a6d6);}});ami['on']('queuecallerleave',function(_0x55eed9){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x28'),_0x55eed9[_0x8687('0x1d')]),_0x55eed9);queues['queuecallerleave'](_0x55eed9);}catch(_0x1e97ee){utils[_0x8687('0x16')](util[_0x8687('0x1a')]('[%s][index][queuecallerleave]',_0x55eed9[_0x8687('0x1d')]),_0x1e97ee);}});ami['on'](_0x8687('0x29'),function(_0x244b3b){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x2a'),_0x244b3b[_0x8687('0x1d')]),_0x244b3b);queues['musiconholdstart'](_0x244b3b);calls[_0x8687('0x29')](_0x244b3b);}catch(_0x34dca4){utils[_0x8687('0x16')](util[_0x8687('0x1a')](_0x8687('0x2a'),_0x244b3b[_0x8687('0x1d')]),_0x34dca4);}});ami['on'](_0x8687('0x2b'),function(_0x49b2ec){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x2c'),_0x49b2ec[_0x8687('0x1d')]),_0x49b2ec);queues[_0x8687('0x2b')](_0x49b2ec);calls[_0x8687('0x2b')](_0x49b2ec);}catch(_0xcb41e0){utils[_0x8687('0x16')](util[_0x8687('0x1a')]('[%s][index][musiconholdstop]',_0x49b2ec[_0x8687('0x1d')]),_0xcb41e0);}});ami['on']('newstate',function(_0x405702){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x2d'),_0x405702[_0x8687('0x1d')]),_0x405702);calls['newstate'](_0x405702);recordings['newstate'](_0x405702);}catch(_0x1c9701){utils[_0x8687('0x16')](util['format']('[%s][index][newstate]',_0x405702[_0x8687('0x1d')]),_0x1c9701);}});ami['on'](_0x8687('0x2e'),function(_0x5517a5){try{utils[_0x8687('0x19')](util['format']('[%s][index][hangup]',_0x5517a5[_0x8687('0x1d')]),_0x5517a5);calls[_0x8687('0x2e')](_0x5517a5);recordings['hangup'](_0x5517a5);dials[_0x8687('0x2e')](_0x5517a5);agents[_0x8687('0x2e')](_0x5517a5);queues['hangup'](_0x5517a5);}catch(_0x440324){utils[_0x8687('0x16')](util['format']('[%s][index][hangup]',_0x5517a5['uniqueid']),_0x440324);}});ami['on'](_0x8687('0x2f'),function(_0xb92080){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x30'),_0xb92080[_0x8687('0x1d')]),_0xb92080);members[_0x8687('0x2f')](_0xb92080);}catch(_0x1b8503){utils[_0x8687('0x16')](util[_0x8687('0x1a')]('[%s][index][cdr]',_0xb92080[_0x8687('0x1d')]),_0x1b8503);}});ami['on'](_0x8687('0x31'),function(_0x20ace4){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x32'),_0x20ace4['uniqueid']),_0x20ace4);queues[_0x8687('0x31')](_0x20ace4);agents[_0x8687('0x31')](_0x20ace4);transfers[_0x8687('0x31')](_0x20ace4);recordings[_0x8687('0x31')](_0x20ace4);}catch(_0x26df32){utils['error'](util[_0x8687('0x1a')](_0x8687('0x32'),_0x20ace4[_0x8687('0x1d')]),_0x26df32);}});ami['on'](_0x8687('0x33'),function(_0x13a9e1){try{utils['debug'](util['format']('[%s][index][attendedtransfer]',_0x13a9e1['origtransfereruniqueid']),_0x13a9e1);queues[_0x8687('0x33')](_0x13a9e1);transfers[_0x8687('0x33')](_0x13a9e1);agents['attendedtransfer'](_0x13a9e1);calls['attendedtransfer'](_0x13a9e1);}catch(_0x3554c5){utils[_0x8687('0x16')](util['format'](_0x8687('0x34'),_0x13a9e1[_0x8687('0x35')]),_0x3554c5);}});ami['on'](_0x8687('0x36'),function(_0x150b68){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x37'),_0x150b68[_0x8687('0x1d')]),_0x150b68);queues[_0x8687('0x36')](_0x150b68);recordings['varset'](_0x150b68);calls[_0x8687('0x36')](_0x150b68);dials[_0x8687('0x36')](_0x150b68);}catch(_0x1611ec){utils[_0x8687('0x16')](util[_0x8687('0x1a')](_0x8687('0x37'),_0x150b68['uniqueid']),_0x1611ec);}});ami['on'](_0x8687('0x38'),function(_0x2f54ce){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x39'),_0x2f54ce[_0x8687('0x1d')]),_0x2f54ce);calls[_0x8687('0x38')](_0x2f54ce);recordings[_0x8687('0x38')](_0x2f54ce);dials[_0x8687('0x38')](_0x2f54ce);}catch(_0x37a174){utils[_0x8687('0x16')](util[_0x8687('0x1a')]('[%s][index][newexten]',_0x2f54ce[_0x8687('0x1d')]),_0x37a174);}});ami['on']('newchannel',function(_0x7b6d00){try{utils[_0x8687('0x19')](util['format']('[%s][index][newchannel]',_0x7b6d00['uniqueid']),_0x7b6d00);calls[_0x8687('0x3a')](_0x7b6d00);recordings[_0x8687('0x3a')](_0x7b6d00);}catch(_0x44f3ba){utils[_0x8687('0x16')](util[_0x8687('0x1a')]('[%s][index][newchannel]',_0x7b6d00['uniqueid']),_0x44f3ba);}});ami['on'](_0x8687('0x3b'),function(_0x31f057){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x3c'),_0x31f057[_0x8687('0x1d')]),_0x31f057);dials[_0x8687('0x3b')](_0x31f057);}catch(_0x13096f){utils[_0x8687('0x16')](util[_0x8687('0x1a')](_0x8687('0x3d'),_0x31f057[_0x8687('0x1d')]),_0x13096f);}});ami['on']('dialend',function(_0x1ae48d){try{utils[_0x8687('0x19')](util[_0x8687('0x1a')](_0x8687('0x3e'),_0x1ae48d['uniqueid']),_0x1ae48d);dials[_0x8687('0x3f')](_0x1ae48d);}catch(_0x7964c2){utils['error'](util[_0x8687('0x1a')](_0x8687('0x3e'),_0x1ae48d[_0x8687('0x1d')]),_0x7964c2);}});} \ No newline at end of file +var _0xf3fd=['[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','production','local','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug'];(function(_0x6f050b,_0xdd2d31){var _0x771d46=function(_0x35d806){while(--_0x35d806){_0x6f050b['push'](_0x6f050b['shift']());}};_0x771d46(++_0xdd2d31);}(_0xf3fd,0x1c0));var _0xdf3f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf3fd[_0x5ddb1c];return _0x354adc;};var AsteriskManager=require(_0xdf3f('0x0'));var config=require(_0xdf3f('0x1'));var utils=require(_0xdf3f('0x2'));var util=require('util');var isXDREnabled=config[_0xdf3f('0x3')]&&config[_0xdf3f('0x3')][_0xdf3f('0x4')]?!config[_0xdf3f('0x3')][_0xdf3f('0x4')]:!![];var isProduction=config['env']===_0xdf3f('0x5')||![];var isLocalAsterisk=config[_0xdf3f('0x3')]&&config[_0xdf3f('0x3')][_0xdf3f('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xdf3f('0x7')],config[_0xdf3f('0x8')]['ip'],config['asterisk'][_0xdf3f('0x9')],config[_0xdf3f('0x8')][_0xdf3f('0xa')],!![]);ami[_0xdf3f('0xb')]();if(!isXDREnabled){utils[_0xdf3f('0xc')](_0xdf3f('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xdf3f('0xc')](_0xdf3f('0xe'));}else{var agents=require(_0xdf3f('0xf'));var calls=require(_0xdf3f('0x10'));var queues=require(_0xdf3f('0x11'));var recordings=require(_0xdf3f('0x12'));var members=require('./members.controller');var dials=require(_0xdf3f('0x13'));var transfers=require(_0xdf3f('0x14'));var core=require('./core.controller');ami['on'](_0xdf3f('0x15'),core[_0xdf3f('0x15')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xdf3f('0x16'),core[_0xdf3f('0x16')]);ami['on'](_0xdf3f('0x17'),core['error']);ami['on'](_0xdf3f('0x18'),core[_0xdf3f('0x18')]);ami['on'](_0xdf3f('0x19'),core['managerevent']);ami['on'](_0xdf3f('0x1a'),function(_0x28b655){try{utils['debug'](util[_0xdf3f('0x1b')](_0xdf3f('0x1c'),_0x28b655[_0xdf3f('0x1d')]),_0x28b655);members[_0xdf3f('0x1a')](_0x28b655);}catch(_0x3ee2a2){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x1c'),_0x28b655[_0xdf3f('0x1d')]),_0x3ee2a2);}});ami['on'](_0xdf3f('0x1e'),function(_0x3ca530){try{utils['debug'](util['format'](_0xdf3f('0x1f'),_0x3ca530[_0xdf3f('0x20')]),_0x3ca530);agents[_0xdf3f('0x1e')](_0x3ca530);}catch(_0x1f1e34){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x1f'),_0x3ca530[_0xdf3f('0x20')]),_0x1f1e34);}});ami['on'](_0xdf3f('0x21'),function(_0x131810){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')]('[%s][index][agentringnoanswer]',_0x131810[_0xdf3f('0x20')]),_0x131810);agents['agentringnoanswer'](_0x131810);}catch(_0x5f3266){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x23'),_0x131810[_0xdf3f('0x20')]),_0x5f3266);}});ami['on'](_0xdf3f('0x24'),function(_0x214120){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x25'),_0x214120['uniqueid']),_0x214120);agents['agentconnect'](_0x214120);queues[_0xdf3f('0x24')](_0x214120);}catch(_0x2ecab7){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x25'),_0x214120['uniqueid']),_0x2ecab7);}});ami['on'](_0xdf3f('0x26'),function(_0x2c03e8){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x27'),_0x2c03e8[_0xdf3f('0x20')]),_0x2c03e8);agents[_0xdf3f('0x26')](_0x2c03e8);queues['agentcomplete'](_0x2c03e8);members['agentcomplete'](_0x2c03e8);}catch(_0xdc9a33){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x27'),_0x2c03e8[_0xdf3f('0x20')]),_0xdc9a33);}});ami['on'](_0xdf3f('0x28'),function(_0x4549a2){try{utils[_0xdf3f('0x22')](util['format'](_0xdf3f('0x29'),_0x4549a2[_0xdf3f('0x20')]),_0x4549a2);agents[_0xdf3f('0x28')](_0x4549a2);queues[_0xdf3f('0x28')](_0x4549a2);}catch(_0x286e5c){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x29'),_0x4549a2['uniqueid']),_0x286e5c);}});ami['on'](_0xdf3f('0x2a'),function(_0x5e1f2b){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x2b'),_0x5e1f2b[_0xdf3f('0x20')]),_0x5e1f2b);queues['queuecallerjoin'](_0x5e1f2b);recordings[_0xdf3f('0x2a')](_0x5e1f2b);}catch(_0xd8805f){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x2b'),_0x5e1f2b['uniqueid']),_0xd8805f);}});ami['on'](_0xdf3f('0x2c'),function(_0x591410){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x2d'),_0x591410[_0xdf3f('0x20')]),_0x591410);queues[_0xdf3f('0x2c')](_0x591410);}catch(_0x291091){utils['error'](util['format'](_0xdf3f('0x2d'),_0x591410[_0xdf3f('0x20')]),_0x291091);}});ami['on']('musiconholdstart',function(_0x191dbe){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x2e'),_0x191dbe[_0xdf3f('0x20')]),_0x191dbe);queues[_0xdf3f('0x2f')](_0x191dbe);calls[_0xdf3f('0x2f')](_0x191dbe);}catch(_0x3098fd){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')]('[%s][index][musiconholdstart]',_0x191dbe[_0xdf3f('0x20')]),_0x3098fd);}});ami['on'](_0xdf3f('0x30'),function(_0x4fedf9){try{utils['debug'](util[_0xdf3f('0x1b')](_0xdf3f('0x31'),_0x4fedf9[_0xdf3f('0x20')]),_0x4fedf9);queues[_0xdf3f('0x30')](_0x4fedf9);calls[_0xdf3f('0x30')](_0x4fedf9);}catch(_0x4a9d90){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x31'),_0x4fedf9[_0xdf3f('0x20')]),_0x4a9d90);}});ami['on'](_0xdf3f('0x32'),function(_0xfedd56){try{utils['debug'](util[_0xdf3f('0x1b')](_0xdf3f('0x33'),_0xfedd56[_0xdf3f('0x20')]),_0xfedd56);calls[_0xdf3f('0x32')](_0xfedd56);recordings['newstate'](_0xfedd56);}catch(_0x372669){utils[_0xdf3f('0x17')](util['format']('[%s][index][newstate]',_0xfedd56[_0xdf3f('0x20')]),_0x372669);}});ami['on'](_0xdf3f('0x34'),function(_0x497718){try{utils['debug'](util[_0xdf3f('0x1b')]('[%s][index][hangup]',_0x497718[_0xdf3f('0x20')]),_0x497718);calls[_0xdf3f('0x34')](_0x497718);recordings[_0xdf3f('0x34')](_0x497718);dials[_0xdf3f('0x34')](_0x497718);agents[_0xdf3f('0x34')](_0x497718);queues[_0xdf3f('0x34')](_0x497718);}catch(_0x171ebf){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x35'),_0x497718[_0xdf3f('0x20')]),_0x171ebf);}});ami['on'](_0xdf3f('0x36'),function(_0x2625cb){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x37'),_0x2625cb['uniqueid']),_0x2625cb);members[_0xdf3f('0x36')](_0x2625cb);}catch(_0x2b347c){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x37'),_0x2625cb[_0xdf3f('0x20')]),_0x2b347c);}});ami['on'](_0xdf3f('0x38'),function(_0x4c2ca4){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x39'),_0x4c2ca4['uniqueid']),_0x4c2ca4);queues['blindtransfer'](_0x4c2ca4);agents[_0xdf3f('0x38')](_0x4c2ca4);transfers[_0xdf3f('0x38')](_0x4c2ca4);recordings[_0xdf3f('0x38')](_0x4c2ca4);}catch(_0x5e32a9){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x39'),_0x4c2ca4[_0xdf3f('0x20')]),_0x5e32a9);}});ami['on'](_0xdf3f('0x3a'),function(_0x480d7c){try{utils['debug'](util[_0xdf3f('0x1b')]('[%s][index][attendedtransfer]',_0x480d7c['origtransfereruniqueid']),_0x480d7c);queues[_0xdf3f('0x3a')](_0x480d7c);transfers[_0xdf3f('0x3a')](_0x480d7c);agents[_0xdf3f('0x3a')](_0x480d7c);calls['attendedtransfer'](_0x480d7c);}catch(_0x460d75){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x3b'),_0x480d7c[_0xdf3f('0x3c')]),_0x460d75);}});ami['on'](_0xdf3f('0x3d'),function(_0x238d6f){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')]('[%s][index][varset]',_0x238d6f['uniqueid']),_0x238d6f);queues[_0xdf3f('0x3d')](_0x238d6f);recordings[_0xdf3f('0x3d')](_0x238d6f);calls[_0xdf3f('0x3d')](_0x238d6f);dials[_0xdf3f('0x3d')](_0x238d6f);}catch(_0x17d274){utils[_0xdf3f('0x17')](util['format']('[%s][index][varset]',_0x238d6f[_0xdf3f('0x20')]),_0x17d274);}});ami['on'](_0xdf3f('0x3e'),function(_0xa192f9){try{utils['debug'](util['format'](_0xdf3f('0x3f'),_0xa192f9[_0xdf3f('0x20')]),_0xa192f9);calls['newexten'](_0xa192f9);recordings[_0xdf3f('0x3e')](_0xa192f9);dials[_0xdf3f('0x3e')](_0xa192f9);}catch(_0x16a336){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')](_0xdf3f('0x3f'),_0xa192f9['uniqueid']),_0x16a336);}});ami['on'](_0xdf3f('0x40'),function(_0x5bb35f){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')](_0xdf3f('0x41'),_0x5bb35f[_0xdf3f('0x20')]),_0x5bb35f);calls['newchannel'](_0x5bb35f);recordings['newchannel'](_0x5bb35f);}catch(_0x3a51ff){utils[_0xdf3f('0x17')](util['format'](_0xdf3f('0x41'),_0x5bb35f[_0xdf3f('0x20')]),_0x3a51ff);}});ami['on'](_0xdf3f('0x42'),function(_0x4ae188){try{utils[_0xdf3f('0x22')](util[_0xdf3f('0x1b')]('[%s][index][dialbegin]',_0x4ae188[_0xdf3f('0x20')]),_0x4ae188);dials[_0xdf3f('0x42')](_0x4ae188);}catch(_0x58cdee){utils['error'](util[_0xdf3f('0x1b')]('[%s]dialbegin',_0x4ae188[_0xdf3f('0x20')]),_0x58cdee);}});ami['on'](_0xdf3f('0x43'),function(_0x58adab){try{utils['debug'](util['format'](_0xdf3f('0x44'),_0x58adab[_0xdf3f('0x20')]),_0x58adab);dials['dialend'](_0x58adab);}catch(_0x1fc1cd){utils[_0xdf3f('0x17')](util[_0xdf3f('0x1b')]('[%s][index][dialend]',_0x58adab[_0xdf3f('0x20')]),_0x1fc1cd);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 96cfa0f..bcb4318 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 _0xda73=['exitAt','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','membername','type','interface','getUserByInterface','internal','request','getUserByName','split','then','name','CreateMemberReport','catch','error','[%s][members][writeDB]','startsWith','debug','device','state','INUSE','BUSY','now','agent','NOT_INUSE','isNil','duration'];(function(_0x29f5aa,_0x1028b7){var _0x5d800c=function(_0xd9f0f5){while(--_0xd9f0f5){_0x29f5aa['push'](_0x29f5aa['shift']());}};_0x5d800c(++_0x1028b7);}(_0xda73,0x160));var _0x3da7=function(_0x22b0fb,_0x4201a8){_0x22b0fb=_0x22b0fb-0x0;var _0x4dc90b=_0xda73[_0x22b0fb];return _0x4dc90b;};'use strict';var _=require(_0x3da7('0x0'));var util=require(_0x3da7('0x1'));var utils=require(_0x3da7('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x365468){utils[_0x3da7('0x3')](util[_0x3da7('0x4')](_0x3da7('0x5'),_0x365468[_0x3da7('0x6')],_0x365468['interface'],_0x365468['channel'],_0x365468['data2'],_0x365468[_0x3da7('0x7')],_0x365468[_0x3da7('0x8')]));if(_0x365468[_0x3da7('0x9')]){utils[_0x3da7('0xa')](_0x365468[_0x3da7('0x9')])['then'](function(_0x3d361f){if(_0x3d361f){_0x365468[_0x3da7('0x7')]=_0x3d361f['name'];_0x365468[_0x3da7('0xb')]=_0x3d361f[_0x3da7('0xb')];utils[_0x3da7('0xc')]('CreateMemberReport',_0x365468);}else{utils[_0x3da7('0xd')](_0x365468[_0x3da7('0x9')][_0x3da7('0xe')]('/')[0x1])[_0x3da7('0xf')](function(_0x14335f){if(_0x14335f){_0x365468[_0x3da7('0x7')]=_0x14335f[_0x3da7('0x10')];_0x365468['internal']=_0x14335f[_0x3da7('0xb')];utils[_0x3da7('0xc')](_0x3da7('0x11'),_0x365468);}});}})[_0x3da7('0x12')](function(_0x5d7aea){utils[_0x3da7('0x13')](util[_0x3da7('0x4')](_0x3da7('0x14'),_0x365468['uniqueid']),_0x5d7aea);});}delete members[_0x365468[_0x3da7('0x9')]];}function startsWith(_0x37eb72,_0x550275){return _['some'](_0x37eb72,function(_0xf4b9ba){return _[_0x3da7('0x15')](_0x550275,_0xf4b9ba);});}exports['devicestatechange']=function(_0x561338){try{utils[_0x3da7('0x16')](util[_0x3da7('0x4')]('[%s][members][devicestatechange]',members[_0x561338['device']]?members[_0x561338[_0x3da7('0x17')]][_0x3da7('0x6')]:_0x561338[_0x3da7('0x17')]),_0x561338);utils[_0x3da7('0x3')](util[_0x3da7('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x561338[_0x3da7('0x17')]]?members[_0x561338[_0x3da7('0x17')]][_0x3da7('0x6')]:_0x561338[_0x3da7('0x17')],_0x561338[_0x3da7('0x18')],_0x561338[_0x3da7('0x17')]));switch(_0x561338[_0x3da7('0x18')]){case _0x3da7('0x19'):case _0x3da7('0x1a'):if(!startsWith(exclude,_0x561338['device'])){members[_0x561338[_0x3da7('0x17')]]={'channel':'voice','interface':_0x561338[_0x3da7('0x17')],'type':'TALKING','enterAt':utils[_0x3da7('0x1b')](),'role':_0x3da7('0x1c')};}break;case _0x3da7('0x1d'):if(!_[_0x3da7('0x1e')](members[_0x561338[_0x3da7('0x17')]])){members[_0x561338[_0x3da7('0x17')]]['exitAt']=utils[_0x3da7('0x1b')]();members[_0x561338[_0x3da7('0x17')]][_0x3da7('0x1f')]=utils['diffTime'](members[_0x561338[_0x3da7('0x17')]][_0x3da7('0x20')],members[_0x561338[_0x3da7('0x17')]][_0x3da7('0x21')]);if(members[_0x561338[_0x3da7('0x17')]][_0x3da7('0x6')]){writeDB(members[_0x561338[_0x3da7('0x17')]]);}}break;default:break;}}catch(_0x34bff2){utils[_0x3da7('0x13')](util[_0x3da7('0x4')](_0x3da7('0x22'),members[_0x561338[_0x3da7('0x17')]]?members[_0x561338[_0x3da7('0x17')]][_0x3da7('0x6')]:_0x561338[_0x3da7('0x17')]),_0x34bff2);}};exports['agentcomplete']=function(_0x3058f0){try{if(!_[_0x3da7('0x1e')](members[_0x3058f0['interface']])){utils[_0x3da7('0x16')](util[_0x3da7('0x4')](_0x3da7('0x23'),_0x3058f0[_0x3da7('0x6')]),_0x3058f0);utils['info'](util[_0x3da7('0x4')](_0x3da7('0x24'),_0x3058f0[_0x3da7('0x6')],_0x3058f0['interface'],_0x3058f0[_0x3da7('0x25')]));members[_0x3058f0['interface']]=_[_0x3da7('0x26')](members[_0x3058f0[_0x3da7('0x9')]],{'data4':_0x3058f0[_0x3da7('0x25')],'uniqueid':_0x3058f0['uniqueid']});}}catch(_0x4939b6){utils['error'](util[_0x3da7('0x4')](_0x3da7('0x23'),_0x3058f0[_0x3da7('0x6')]),_0x4939b6);}};exports[_0x3da7('0x27')]=function(_0x2460f2){try{utils[_0x3da7('0x16')](util[_0x3da7('0x4')](_0x3da7('0x28'),_0x2460f2[_0x3da7('0x6')]),_0x2460f2);if(_0x2460f2[_0x3da7('0x29')]){var _0x4f8d99=_0x2460f2[_0x3da7('0x29')][_0x3da7('0xe')]('-')[0x0];if(!_[_0x3da7('0x1e')](members[_0x4f8d99])){members[_0x4f8d99]=_[_0x3da7('0x26')](members[_0x4f8d99],{'data1':members[_0x4f8d99][_0x3da7('0x2a')]||_0x2460f2['type'],'data2':members[_0x4f8d99][_0x3da7('0x2b')]||_0x2460f2[_0x3da7('0x2c')],'data3':members[_0x4f8d99][_0x3da7('0x2d')]||_0x2460f2[_0x3da7('0x2e')],'uniqueid':members[_0x4f8d99]['uniqueid']||_0x2460f2[_0x3da7('0x6')]});utils['info'](util[_0x3da7('0x4')](_0x3da7('0x2f'),_0x2460f2[_0x3da7('0x6')],members[_0x4f8d99]['data1'],members[_0x4f8d99][_0x3da7('0x2b')],members[_0x4f8d99]['data3']));if(members[_0x4f8d99][_0x3da7('0x20')]){writeDB(members[_0x4f8d99]);}}}if(_0x2460f2['destinationchannel']){var _0x58af76=_0x2460f2['destinationchannel']['split']('-')[0x0];if(!_[_0x3da7('0x1e')](members[_0x58af76])){members[_0x58af76]=_[_0x3da7('0x26')](members[_0x58af76],{'data1':members[_0x58af76][_0x3da7('0x2a')]||_0x2460f2[_0x3da7('0x8')],'data2':members[_0x58af76][_0x3da7('0x2b')]||_0x2460f2['source'],'data3':members[_0x58af76][_0x3da7('0x2d')]||_0x2460f2['destination'],'uniqueid':members[_0x58af76][_0x3da7('0x6')]||_0x2460f2[_0x3da7('0x6')]});utils[_0x3da7('0x3')](util[_0x3da7('0x4')](_0x3da7('0x2f'),_0x2460f2[_0x3da7('0x6')],members[_0x58af76][_0x3da7('0x2a')],members[_0x58af76]['data2'],members[_0x58af76][_0x3da7('0x2d')]));if(members[_0x58af76]['exitAt']){writeDB(members[_0x58af76]);}}}}catch(_0x130761){utils[_0x3da7('0x13')](util[_0x3da7('0x4')](_0x3da7('0x28'),_0x2460f2['uniqueid']),_0x130761);}}; \ No newline at end of file +var _0x119c=['source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','assign','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split','catch','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','exitAt','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','isNil','data1','data2'];(function(_0x4b416c,_0x53ef9e){var _0x2037fa=function(_0x5d9816){while(--_0x5d9816){_0x4b416c['push'](_0x4b416c['shift']());}};_0x2037fa(++_0x53ef9e);}(_0x119c,0xa5));var _0xc119=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x119c[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0xc119('0x0'));var util=require('util');var utils=require(_0xc119('0x1'));var members={};var exclude=[_0xc119('0x2'),_0xc119('0x3')];function writeDB(_0x4c5016){utils['info'](util[_0xc119('0x4')](_0xc119('0x5'),_0x4c5016[_0xc119('0x6')],_0x4c5016[_0xc119('0x7')],_0x4c5016[_0xc119('0x8')],_0x4c5016['data2'],_0x4c5016['membername'],_0x4c5016[_0xc119('0x9')]));if(_0x4c5016['interface']){utils[_0xc119('0xa')](_0x4c5016[_0xc119('0x7')])[_0xc119('0xb')](function(_0x3034b3){if(_0x3034b3){_0x4c5016[_0xc119('0xc')]=_0x3034b3[_0xc119('0xd')];_0x4c5016[_0xc119('0xe')]=_0x3034b3[_0xc119('0xe')];utils[_0xc119('0xf')](_0xc119('0x10'),_0x4c5016);}else{utils['getUserByName'](_0x4c5016[_0xc119('0x7')][_0xc119('0x11')]('/')[0x1])['then'](function(_0x2ab680){if(_0x2ab680){_0x4c5016[_0xc119('0xc')]=_0x2ab680[_0xc119('0xd')];_0x4c5016[_0xc119('0xe')]=_0x2ab680[_0xc119('0xe')];utils[_0xc119('0xf')](_0xc119('0x10'),_0x4c5016);}});}})[_0xc119('0x12')](function(_0x523f7b){utils['error'](util[_0xc119('0x4')](_0xc119('0x13'),_0x4c5016['uniqueid']),_0x523f7b);});}delete members[_0x4c5016[_0xc119('0x7')]];}function startsWith(_0x230fb2,_0x4d5e43){return _['some'](_0x230fb2,function(_0x2ab3b2){return _[_0xc119('0x14')](_0x4d5e43,_0x2ab3b2);});}exports[_0xc119('0x15')]=function(_0x49246a){try{utils[_0xc119('0x16')](util[_0xc119('0x4')]('[%s][members][devicestatechange]',members[_0x49246a[_0xc119('0x17')]]?members[_0x49246a['device']][_0xc119('0x6')]:_0x49246a['device']),_0x49246a);utils[_0xc119('0x18')](util[_0xc119('0x4')](_0xc119('0x19'),members[_0x49246a[_0xc119('0x17')]]?members[_0x49246a[_0xc119('0x17')]][_0xc119('0x6')]:_0x49246a['device'],_0x49246a[_0xc119('0x1a')],_0x49246a[_0xc119('0x17')]));switch(_0x49246a[_0xc119('0x1a')]){case _0xc119('0x1b'):case _0xc119('0x1c'):if(!startsWith(exclude,_0x49246a['device'])){members[_0x49246a[_0xc119('0x17')]]={'channel':_0xc119('0x1d'),'interface':_0x49246a[_0xc119('0x17')],'type':_0xc119('0x1e'),'enterAt':utils[_0xc119('0x1f')](),'role':'agent'};}break;case _0xc119('0x20'):if(!_['isNil'](members[_0x49246a[_0xc119('0x17')]])){members[_0x49246a[_0xc119('0x17')]][_0xc119('0x21')]=utils[_0xc119('0x1f')]();members[_0x49246a[_0xc119('0x17')]]['duration']=utils[_0xc119('0x22')](members[_0x49246a[_0xc119('0x17')]][_0xc119('0x21')],members[_0x49246a[_0xc119('0x17')]][_0xc119('0x23')]);if(members[_0x49246a[_0xc119('0x17')]][_0xc119('0x6')]){writeDB(members[_0x49246a['device']]);}}break;default:break;}}catch(_0x1eddb5){utils[_0xc119('0x24')](util[_0xc119('0x4')](_0xc119('0x25'),members[_0x49246a['device']]?members[_0x49246a[_0xc119('0x17')]][_0xc119('0x6')]:_0x49246a[_0xc119('0x17')]),_0x1eddb5);}};exports[_0xc119('0x26')]=function(_0x50bfbd){try{if(!_['isNil'](members[_0x50bfbd[_0xc119('0x7')]])){utils[_0xc119('0x16')](util['format'](_0xc119('0x27'),_0x50bfbd[_0xc119('0x6')]),_0x50bfbd);utils[_0xc119('0x18')](util[_0xc119('0x4')](_0xc119('0x28'),_0x50bfbd[_0xc119('0x6')],_0x50bfbd['interface'],_0x50bfbd[_0xc119('0x29')]));members[_0x50bfbd[_0xc119('0x7')]]=_['assign'](members[_0x50bfbd[_0xc119('0x7')]],{'data4':_0x50bfbd[_0xc119('0x29')],'uniqueid':_0x50bfbd['uniqueid']});}}catch(_0x1c87e0){utils['error'](util[_0xc119('0x4')]('[%s][members][agentcomplete]',_0x50bfbd[_0xc119('0x6')]),_0x1c87e0);}};exports[_0xc119('0x2a')]=function(_0x504a02){try{utils[_0xc119('0x16')](util[_0xc119('0x4')](_0xc119('0x2b'),_0x504a02['uniqueid']),_0x504a02);if(_0x504a02['channel']){var _0x1f435d=_0x504a02[_0xc119('0x8')][_0xc119('0x11')]('-')[0x0];if(!_[_0xc119('0x2c')](members[_0x1f435d])){members[_0x1f435d]=_['assign'](members[_0x1f435d],{'data1':members[_0x1f435d][_0xc119('0x2d')]||_0x504a02[_0xc119('0x9')],'data2':members[_0x1f435d][_0xc119('0x2e')]||_0x504a02[_0xc119('0x2f')],'data3':members[_0x1f435d]['data3']||_0x504a02[_0xc119('0x30')],'uniqueid':members[_0x1f435d][_0xc119('0x6')]||_0x504a02[_0xc119('0x6')]});utils[_0xc119('0x18')](util['format'](_0xc119('0x31'),_0x504a02[_0xc119('0x6')],members[_0x1f435d][_0xc119('0x2d')],members[_0x1f435d][_0xc119('0x2e')],members[_0x1f435d][_0xc119('0x32')]));if(members[_0x1f435d][_0xc119('0x21')]){writeDB(members[_0x1f435d]);}}}if(_0x504a02[_0xc119('0x33')]){var _0x3aee8f=_0x504a02[_0xc119('0x33')][_0xc119('0x11')]('-')[0x0];if(!_[_0xc119('0x2c')](members[_0x3aee8f])){members[_0x3aee8f]=_[_0xc119('0x34')](members[_0x3aee8f],{'data1':members[_0x3aee8f][_0xc119('0x2d')]||_0x504a02[_0xc119('0x9')],'data2':members[_0x3aee8f][_0xc119('0x2e')]||_0x504a02[_0xc119('0x2f')],'data3':members[_0x3aee8f][_0xc119('0x32')]||_0x504a02[_0xc119('0x30')],'uniqueid':members[_0x3aee8f][_0xc119('0x6')]||_0x504a02[_0xc119('0x6')]});utils[_0xc119('0x18')](util[_0xc119('0x4')](_0xc119('0x31'),_0x504a02[_0xc119('0x6')],members[_0x3aee8f]['data1'],members[_0x3aee8f][_0xc119('0x2e')],members[_0x3aee8f][_0xc119('0x32')]));if(members[_0x3aee8f]['exitAt']){writeDB(members[_0x3aee8f]);}}}}catch(_0x151f31){utils[_0xc119('0x24')](util[_0xc119('0x4')](_0xc119('0x2b'),_0x504a02[_0xc119('0x6')]),_0x151f31);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0681475..f856759 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 _0x8391=['origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','value','CONTINUE','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexit','EXITWITHKEY','info','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid'];(function(_0x3a35d7,_0x234d19){var _0x477f2a=function(_0x8c8bde){while(--_0x8c8bde){_0x3a35d7['push'](_0x3a35d7['shift']());}};_0x477f2a(++_0x234d19);}(_0x8391,0x83));var _0x1839=function(_0x48e22b,_0x385d36){_0x48e22b=_0x48e22b-0x0;var _0x40e1b3=_0x8391[_0x48e22b];return _0x40e1b3;};'use strict';var _=require(_0x1839('0x0'));var util=require(_0x1839('0x1'));var utils=require(_0x1839('0x2'));var queues={};function writeDB(_0x2fb7fe){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2fb7fe[_0x1839('0x3')],_0x2fb7fe[_0x1839('0x4')],_0x2fb7fe[_0x1839('0x5')],_0x2fb7fe[_0x1839('0x6')],_0x2fb7fe[_0x1839('0x7')],_0x2fb7fe[_0x1839('0x8')],_0x2fb7fe['queuecallerexitreason']));if(_0x2fb7fe['queue']){utils[_0x1839('0x9')](_0x2fb7fe[_0x1839('0x5')])[_0x1839('0xa')](function(_0x455ba2){if(_0x455ba2){_0x2fb7fe[_0x1839('0xb')]=_0x455ba2[_0x1839('0xb')];}utils[_0x1839('0xc')](_0x1839('0xd'),_0x2fb7fe);});}else{utils[_0x1839('0xc')](_0x1839('0xd'),_0x2fb7fe);}if(_0x2fb7fe[_0x1839('0xe')]){delete queues[_0x2fb7fe['transfereduniqueid']];}else{delete queues[_0x2fb7fe[_0x1839('0x3')]];}}exports[_0x1839('0xf')]=function(_0x464c9f){try{utils[_0x1839('0x10')](util['format'](_0x1839('0x11'),_0x464c9f[_0x1839('0x3')]),_0x464c9f);utils['info'](util[_0x1839('0x12')](_0x1839('0x13'),_0x464c9f[_0x1839('0x3')],_0x464c9f[_0x1839('0x5')],_0x464c9f[_0x1839('0x14')]));queues[_0x464c9f['uniqueid']]=_[_0x1839('0x15')](_0x464c9f,{'originalposition':_0x464c9f[_0x1839('0x14')],'queuecallerjoinAt':utils[_0x1839('0x16')](),'mohtime':0x0});}catch(_0x24f47f){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x464c9f[_0x1839('0x3')]),_0x24f47f);}};exports[_0x1839('0x17')]=function(_0x392203){try{if(!_[_0x1839('0x18')](queues[_0x392203[_0x1839('0x3')]])){utils[_0x1839('0x10')](util[_0x1839('0x12')](_0x1839('0x19'),_0x392203[_0x1839('0x3')]),_0x392203);if(queues[_0x392203[_0x1839('0x3')]][_0x1839('0x1a')]){if(!queues[_0x392203[_0x1839('0x3')]][_0x1839('0x1b')]&&!queues[_0x392203[_0x1839('0x3')]]['queuecallerexit']){queues[_0x392203[_0x1839('0x3')]][_0x1839('0x1c')]=!![];queues[_0x392203[_0x1839('0x3')]][_0x1839('0x1d')]=utils[_0x1839('0x16')]();queues[_0x392203[_0x1839('0x3')]][_0x1839('0x1e')]=_0x1839('0x1f');}utils['info'](util[_0x1839('0x12')](_0x1839('0x20'),_0x392203['uniqueid'],queues[_0x392203[_0x1839('0x3')]]['name'],queues[_0x392203[_0x1839('0x3')]][_0x1839('0x1e')]));writeDB(queues[_0x392203['uniqueid']]);}else if(queues[_0x392203['uniqueid']][_0x1839('0xe')]){utils['info'](util['format'](_0x1839('0x21'),_0x392203[_0x1839('0x3')],queues[_0x392203[_0x1839('0x3')]][_0x1839('0x22')],queues[_0x392203[_0x1839('0x3')]][_0x1839('0xe')]));queues[queues[_0x392203[_0x1839('0x3')]][_0x1839('0xe')]]=queues[_0x392203[_0x1839('0x3')]];queues[queues[_0x392203[_0x1839('0x3')]][_0x1839('0xe')]][_0x1839('0x23')]=0x2;delete queues[_0x392203[_0x1839('0x3')]];}}}catch(_0x1b183e){utils[_0x1839('0x24')](util[_0x1839('0x12')](_0x1839('0x19'),_0x392203[_0x1839('0x3')]),_0x1b183e);}};exports[_0x1839('0x25')]=function(_0xf42009){try{utils[_0x1839('0x10')](util[_0x1839('0x12')](_0x1839('0x26'),_0xf42009['uniqueid']),_0xf42009);if(!_[_0x1839('0x18')](_0xf42009[_0x1839('0x27')]['queuestatus'])&&_0xf42009[_0x1839('0x28')]['toUpperCase']()!==_0x1839('0x29')){if(!_[_0x1839('0x18')](queues[_0xf42009[_0x1839('0x3')]])){queues[_0xf42009['uniqueid']]['queuecallerabandon']=![];queues[_0xf42009[_0x1839('0x3')]]['queuecallerabandonAt']=null;queues[_0xf42009[_0x1839('0x3')]]['queuecallerexit']=!![];queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x2a')]=utils[_0x1839('0x16')]();queues[_0xf42009['uniqueid']]['queuecallerexitreason']=_0xf42009['value'][_0x1839('0x2b')]();utils['info'](util[_0x1839('0x12')](_0x1839('0x2c'),_0xf42009[_0x1839('0x3')],queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x22')],_0xf42009['value'],queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x1e')]));writeDB(queues[_0xf42009['uniqueid']]);}}else if(!_[_0x1839('0x18')](_0xf42009[_0x1839('0x27')][_0x1839('0x2d')])){if(!_['isNil'](queues[_0xf42009[_0x1839('0x3')]])&&!queues[_0xf42009[_0x1839('0x3')]]['queuecallerabandon']){queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x1b')]=![];queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x2e')]=null;queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x2f')]=!![];queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x2a')]=utils[_0x1839('0x16')]();queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x1e')]=_0x1839('0x30');utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x32'),_0xf42009['uniqueid'],queues[_0xf42009[_0x1839('0x3')]][_0x1839('0x22')],_0xf42009[_0x1839('0x28')],queues[_0xf42009['uniqueid']][_0x1839('0x1e')]));}}}catch(_0x380d3a){utils[_0x1839('0x24')](util[_0x1839('0x12')]('[%s][queues][varset]',_0xf42009[_0x1839('0x3')]),_0x380d3a);}};exports[_0x1839('0x1b')]=function(_0x1c3751){try{if(!_['isNil'](queues[_0x1c3751[_0x1839('0x3')]])){utils['debug'](util['format'](_0x1839('0x33'),_0x1c3751['uniqueid']),_0x1c3751);queues[_0x1c3751[_0x1839('0x3')]][_0x1839('0x2f')]=![];queues[_0x1c3751[_0x1839('0x3')]][_0x1839('0x2a')]=null;queues[_0x1c3751['uniqueid']][_0x1839('0x1b')]=!![];queues[_0x1c3751['uniqueid']]['queuecallerabandonAt']=utils[_0x1839('0x16')]();queues[_0x1c3751[_0x1839('0x3')]][_0x1839('0x1e')]=_0x1839('0x34');utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x35'),_0x1c3751[_0x1839('0x3')],queues[_0x1c3751['uniqueid']][_0x1839('0x22')],queues[_0x1c3751[_0x1839('0x3')]][_0x1839('0x1e')]));}}catch(_0x1bd087){utils['error'](util[_0x1839('0x12')]('[%s][queues][queuecallerabandon]',_0x1c3751[_0x1839('0x3')]),_0x1bd087);}};exports[_0x1839('0x36')]=function(_0x4f1a56){try{if(!_[_0x1839('0x18')](queues[_0x4f1a56[_0x1839('0x3')]])){utils['debug'](util[_0x1839('0x12')](_0x1839('0x37'),_0x4f1a56[_0x1839('0x3')]),_0x4f1a56);utils['info'](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4f1a56['uniqueid'],queues[_0x4f1a56[_0x1839('0x3')]]['name'],_0x4f1a56[_0x1839('0x38')],_0x4f1a56[_0x1839('0x39')]));queues[_0x4f1a56[_0x1839('0x3')]][_0x1839('0x36')]=!![];queues[_0x4f1a56[_0x1839('0x3')]][_0x1839('0x1a')]=utils[_0x1839('0x16')]();queues[_0x4f1a56[_0x1839('0x3')]][_0x1839('0x3a')]=utils[_0x1839('0x3b')](queues[_0x4f1a56['uniqueid']][_0x1839('0x1a')],queues[_0x4f1a56['uniqueid']][_0x1839('0x3c')]);queues[_0x4f1a56[_0x1839('0x3')]][_0x1839('0x14')]=_0x4f1a56['position'];queues[_0x4f1a56[_0x1839('0x3')]][_0x1839('0x3d')]=_0x4f1a56[_0x1839('0x3d')];queues[_0x4f1a56['uniqueid']][_0x1839('0x38')]=_0x4f1a56[_0x1839('0x38')];queues[_0x4f1a56['uniqueid']][_0x1839('0x39')]=_0x4f1a56[_0x1839('0x39')];}}catch(_0x5bb8e1){utils['error'](util['format'](_0x1839('0x37'),_0x4f1a56[_0x1839('0x3')]),_0x5bb8e1);}};exports[_0x1839('0x3e')]=function(_0x43f917){try{if(!_[_0x1839('0x18')](queues[_0x43f917[_0x1839('0x3')]])){utils[_0x1839('0x10')](util[_0x1839('0x12')]('[%s][queues][agentconnect]',_0x43f917['uniqueid']),_0x43f917);utils[_0x1839('0x31')](util[_0x1839('0x12')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x43f917[_0x1839('0x3')],queues[_0x43f917[_0x1839('0x3')]]['name'],_0x43f917[_0x1839('0x3f')],_0x43f917[_0x1839('0x40')]));queues[_0x43f917[_0x1839('0x3')]][_0x1839('0x1b')]=![];queues[_0x43f917[_0x1839('0x3')]][_0x1839('0x1b')]=![];queues[_0x43f917[_0x1839('0x3')]][_0x1839('0x2e')]=null;queues[_0x43f917[_0x1839('0x3')]]['queuecallerexit']=![];queues[_0x43f917['uniqueid']][_0x1839('0x1e')]=null;queues[_0x43f917['uniqueid']][_0x1839('0x2a')]=null;queues[_0x43f917[_0x1839('0x3')]][_0x1839('0x41')]=!![];queues[_0x43f917[_0x1839('0x3')]][_0x1839('0x8')]=_0x43f917[_0x1839('0x40')];queues[_0x43f917['uniqueid']]['lastAssignedTo']=_0x43f917[_0x1839('0x3f')];}}catch(_0x44e5de){utils[_0x1839('0x24')](util['format']('[%s][queues][agentconnect]',_0x43f917[_0x1839('0x3')]),_0x44e5de);}};exports[_0x1839('0x42')]=function(_0x47f630){try{if(!_['isNil'](queues[_0x47f630[_0x1839('0x3')]])){if(queues[_0x47f630['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x1839('0x12')](_0x1839('0x43'),_0x47f630['uniqueid']),_0x47f630);queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x1b')]=![];queues[_0x47f630[_0x1839('0x3')]]['queuecallerabandon']=![];queues[_0x47f630['uniqueid']][_0x1839('0x2e')]=null;queues[_0x47f630['uniqueid']]['queuecallerexit']=![];queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x2a')]=null;queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x41')]=!![];queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x6')]=_0x47f630[_0x1839('0x3f')];queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x1c')]=!![];queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x1d')]=utils['now']();if(_0x47f630[_0x1839('0x44')]==_0x1839('0x45')){if(!queues[_0x47f630[_0x1839('0x3')]]['transfer']){queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x1e')]=_0x1839('0x46');}}else{queues[_0x47f630[_0x1839('0x3')]]['queuecallerexitreason']=_0x1839('0x47')+_0x47f630[_0x1839('0x44')]['toUpperCase']();}utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x48'),_0x47f630['uniqueid'],queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x22')],_0x47f630[_0x1839('0x3f')],queues[_0x47f630[_0x1839('0x3')]][_0x1839('0x1e')]));writeDB(queues[_0x47f630['uniqueid']]);}}}catch(_0x36641e){utils[_0x1839('0x24')](util[_0x1839('0x12')](_0x1839('0x43'),_0x47f630['uniqueid']),_0x36641e);}};exports[_0x1839('0x49')]=function(_0x9d6764){try{if(!_[_0x1839('0x18')](queues[_0x9d6764[_0x1839('0x4a')]])){utils[_0x1839('0x10')](util[_0x1839('0x12')](_0x1839('0x4b'),_0x9d6764[_0x1839('0x3')]),_0x9d6764);queues[_0x9d6764['transfereeuniqueid']][_0x1839('0x45')]=!![];queues[_0x9d6764['transfereeuniqueid']][_0x1839('0x4c')]=_0x1839('0x4d');queues[_0x9d6764[_0x1839('0x4a')]]['transferexten']=_0x9d6764[_0x1839('0x4e')];queues[_0x9d6764[_0x1839('0x4a')]][_0x1839('0x4f')]=_0x9d6764[_0x1839('0x4a')];queues[_0x9d6764[_0x1839('0x4a')]][_0x1839('0x1e')]=_0x1839('0x50');utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x51'),_0x9d6764[_0x1839('0x3')],queues[_0x9d6764['transfereeuniqueid']][_0x1839('0x22')],_0x9d6764[_0x1839('0x4a')],_0x9d6764['extension']));}}catch(_0x1c8da2){utils[_0x1839('0x24')](util[_0x1839('0x12')]('[%s][queues][blindtransfer]',_0x9d6764[_0x1839('0x3')]),_0x1c8da2);}};exports[_0x1839('0x52')]=function(_0x1f6e69){try{utils['debug'](util[_0x1839('0x12')](_0x1839('0x53'),_0x1f6e69[_0x1839('0x54')]),_0x1f6e69);if(_0x1f6e69[_0x1839('0x54')]==_0x1f6e69[_0x1839('0x55')]){if(!_[_0x1839('0x18')](queues[_0x1f6e69[_0x1839('0x56')]])){utils['info'](util[_0x1839('0x12')](_0x1839('0x57'),_0x1f6e69['origtransfereruniqueid'],queues[_0x1f6e69[_0x1839('0x56')]][_0x1839('0x22')],_0x1f6e69['origtransfererexten']));queues[_0x1f6e69[_0x1839('0x56')]][_0x1839('0x45')]=!![];queues[_0x1f6e69[_0x1839('0x56')]][_0x1839('0x4c')]=_0x1839('0x58');queues[_0x1f6e69[_0x1839('0x56')]][_0x1839('0x59')]=_0x1f6e69['origtransfererexten'];queues[_0x1f6e69['secondtransfererlinkedid']][_0x1839('0x4f')]=_0x1f6e69[_0x1839('0x54')];queues[_0x1f6e69[_0x1839('0x56')]][_0x1839('0x1e')]=_0x1839('0x5a');}if(!_[_0x1839('0x18')](queues[_0x1f6e69['origtransfererlinkedid']])){if(_0x1f6e69['transfereelinkedid']&&queues[_0x1f6e69['transfereelinkedid']]){queues[_0x1f6e69[_0x1839('0x5b')]][_0x1839('0x23')]=0x1;queues[_0x1f6e69[_0x1839('0x4a')]]=_['clone'](queues[_0x1f6e69[_0x1839('0x5b')]]);queues[_0x1f6e69['transfereeuniqueid']][_0x1839('0xe')]=_0x1f6e69[_0x1839('0x5c')];queues[_0x1f6e69['transfereeuniqueid']][_0x1839('0x23')]=0x2;queues[_0x1f6e69['transfereeuniqueid']][_0x1839('0x7')]=queues[_0x1f6e69[_0x1839('0x56')]]['calleridnum'];queues[_0x1f6e69[_0x1839('0x4a')]]['calleridname']=queues[_0x1f6e69[_0x1839('0x56')]][_0x1839('0x5d')];queues[_0x1f6e69[_0x1839('0x4a')]]['queuecallerjoinAt']=utils['now']();queues[_0x1f6e69[_0x1839('0x4a')]][_0x1839('0x1a')]=utils['now']();queues[_0x1f6e69[_0x1839('0x4a')]][_0x1839('0x3a')]=0x0;queues[_0x1f6e69[_0x1839('0x4a')]][_0x1839('0x5e')]=0x0;utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x5f'),_0x1f6e69['origtransfereruniqueid'],queues[_0x1f6e69['transfereeuniqueid']][_0x1839('0x22')],queues[_0x1f6e69[_0x1839('0x4a')]][_0x1839('0x7')],queues[_0x1f6e69[_0x1839('0x4a')]][_0x1839('0x5d')]));}else{utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x60'),_0x1f6e69[_0x1839('0x54')],queues[_0x1f6e69['origtransfererlinkedid']][_0x1839('0x22')],_0x1f6e69['secondtransfererlinkedid']));queues[_0x1f6e69[_0x1839('0x55')]][_0x1839('0xe')]=_0x1f6e69['secondtransfererlinkedid'];}}}else if(_0x1f6e69[_0x1839('0x61')]==_0x1f6e69[_0x1839('0x56')]){if(!_['isNil'](queues[_0x1f6e69[_0x1839('0x55')]])){utils['info'](util[_0x1839('0x12')](_0x1839('0x62'),_0x1f6e69[_0x1839('0x54')],queues[_0x1f6e69[_0x1839('0x55')]][_0x1839('0x22')],_0x1f6e69[_0x1839('0x61')],_0x1f6e69[_0x1839('0x63')]));queues[_0x1f6e69[_0x1839('0x55')]][_0x1839('0x45')]=!![];queues[_0x1f6e69[_0x1839('0x55')]]['transfertype']='ATTENDED';queues[_0x1f6e69[_0x1839('0x55')]][_0x1839('0x59')]=_0x1f6e69[_0x1839('0x63')];queues[_0x1f6e69[_0x1839('0x55')]][_0x1839('0x4f')]=_0x1f6e69[_0x1839('0x61')];queues[_0x1f6e69[_0x1839('0x55')]][_0x1839('0x1e')]=_0x1839('0x5a');}if(!_[_0x1839('0x18')](queues[_0x1f6e69['secondtransfererlinkedid']])){if(_0x1f6e69[_0x1839('0x64')]&&queues[_0x1f6e69[_0x1839('0x64')]]){queues[_0x1f6e69[_0x1839('0x64')]][_0x1839('0x23')]=0x1;queues[_0x1f6e69[_0x1839('0x5c')]]=_[_0x1839('0x65')](queues[_0x1f6e69[_0x1839('0x64')]]);queues[_0x1f6e69['transfertargetuniqueid']][_0x1839('0xe')]=_0x1f6e69[_0x1839('0x5c')];queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x23')]=0x2;queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x7')]=queues[_0x1f6e69[_0x1839('0x55')]]['calleridnum'];queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x5d')]=queues[_0x1f6e69[_0x1839('0x55')]][_0x1839('0x5d')];queues[_0x1f6e69['transfertargetuniqueid']][_0x1839('0x3c')]=utils[_0x1839('0x16')]();queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x1a')]=utils['now']();queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x3a')]=0x0;queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x5e')]=0x0;utils[_0x1839('0x31')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1f6e69[_0x1839('0x54')],queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x22')],queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0xe')],queues[_0x1f6e69[_0x1839('0x5c')]][_0x1839('0x7')],queues[_0x1f6e69['transfertargetuniqueid']][_0x1839('0x5d')]));}else{utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x60'),_0x1f6e69[_0x1839('0x54')],queues[_0x1f6e69[_0x1839('0x56')]][_0x1839('0x22')],_0x1f6e69[_0x1839('0x55')]));queues[_0x1f6e69[_0x1839('0x56')]]['transfereduniqueid']=_0x1f6e69[_0x1839('0x55')];}}}}catch(_0x31bbb0){utils['error'](util[_0x1839('0x12')](_0x1839('0x53'),_0x1f6e69[_0x1839('0x54')]),_0x31bbb0);}};exports[_0x1839('0x66')]=function(_0x4a2873){try{if(!_['isNil'](queues[_0x4a2873[_0x1839('0x3')]])){utils[_0x1839('0x10')](util[_0x1839('0x12')]('[%s][queues][musiconholdstart]',_0x4a2873['uniqueid']),_0x4a2873);queues[_0x4a2873[_0x1839('0x3')]]['musiconholdstartAt']=utils[_0x1839('0x16')]();utils[_0x1839('0x31')](util[_0x1839('0x12')](_0x1839('0x67'),_0x4a2873[_0x1839('0x3')],queues[_0x4a2873[_0x1839('0x3')]][_0x1839('0x22')],queues[_0x4a2873[_0x1839('0x3')]][_0x1839('0x68')]));}}catch(_0x579616){utils[_0x1839('0x24')](util['format'](_0x1839('0x69'),_0x4a2873[_0x1839('0x3')]),_0x579616);}};exports[_0x1839('0x6a')]=function(_0x11cbe6){try{if(!_[_0x1839('0x18')](queues[_0x11cbe6[_0x1839('0x3')]])){if(!_[_0x1839('0x18')](queues[_0x11cbe6[_0x1839('0x3')]][_0x1839('0x68')])){utils[_0x1839('0x10')](util['format'](_0x1839('0x6b'),_0x11cbe6['uniqueid']),_0x11cbe6);queues[_0x11cbe6[_0x1839('0x3')]]['mohtime']+=utils[_0x1839('0x3b')](utils[_0x1839('0x16')](),queues[_0x11cbe6[_0x1839('0x3')]][_0x1839('0x68')]);utils[_0x1839('0x31')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x11cbe6[_0x1839('0x3')],queues[_0x11cbe6['uniqueid']][_0x1839('0x22')],queues[_0x11cbe6[_0x1839('0x3')]][_0x1839('0x5e')]));delete queues[_0x11cbe6['uniqueid']][_0x1839('0x68')];}}}catch(_0x281131){utils['error'](util[_0x1839('0x12')]('[%s][queues][musiconholdstop]',_0x11cbe6[_0x1839('0x3')]),_0x281131);}}; \ No newline at end of file +var _0xabb2=['ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position','count','agentconnect','membername','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','error','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]'];(function(_0x65af97,_0x2a0ec1){var _0x57b0f8=function(_0x37cfcc){while(--_0x37cfcc){_0x65af97['push'](_0x65af97['shift']());}};_0x57b0f8(++_0x2a0ec1);}(_0xabb2,0x169));var _0x2abb=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xabb2[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x2abb('0x0'));var util=require('util');var utils=require(_0x2abb('0x1'));var queues={};function writeDB(_0x4edafc){utils['info'](util[_0x2abb('0x2')](_0x2abb('0x3'),_0x4edafc[_0x2abb('0x4')],_0x4edafc['channel'],_0x4edafc[_0x2abb('0x5')],_0x4edafc[_0x2abb('0x6')],_0x4edafc[_0x2abb('0x7')],_0x4edafc[_0x2abb('0x8')],_0x4edafc[_0x2abb('0x9')]));if(_0x4edafc['queue']){utils[_0x2abb('0xa')](_0x4edafc[_0x2abb('0x5')])[_0x2abb('0xb')](function(_0x34371a){if(_0x34371a){_0x4edafc[_0x2abb('0xc')]=_0x34371a[_0x2abb('0xc')];}utils[_0x2abb('0xd')](_0x2abb('0xe'),_0x4edafc);});}else{utils['request'](_0x2abb('0xe'),_0x4edafc);}if(_0x4edafc[_0x2abb('0xf')]){delete queues[_0x4edafc['transfereduniqueid']];}else{delete queues[_0x4edafc[_0x2abb('0x4')]];}}exports[_0x2abb('0x10')]=function(_0x43568a){try{utils[_0x2abb('0x11')](util['format'](_0x2abb('0x12'),_0x43568a['uniqueid']),_0x43568a);utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x14'),_0x43568a[_0x2abb('0x4')],_0x43568a[_0x2abb('0x5')],_0x43568a['position']));queues[_0x43568a[_0x2abb('0x4')]]=_[_0x2abb('0x15')](_0x43568a,{'originalposition':_0x43568a['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5916bb){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x12'),_0x43568a[_0x2abb('0x4')]),_0x5916bb);}};exports['hangup']=function(_0x234e1a){try{if(!_[_0x2abb('0x17')](queues[_0x234e1a[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x18'),_0x234e1a[_0x2abb('0x4')]),_0x234e1a);if(queues[_0x234e1a[_0x2abb('0x4')]]['queuecallerleaveAt']){if(!queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x19')]&&!queues[_0x234e1a['uniqueid']]['queuecallerexit']){queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x1a')]=!![];queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x1b')]=utils['now']();queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x9')]='COMPLETEDBYAGENT';}utils[_0x2abb('0x13')](util[_0x2abb('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x234e1a[_0x2abb('0x4')],queues[_0x234e1a[_0x2abb('0x4')]]['name'],queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0x9')]));writeDB(queues[_0x234e1a[_0x2abb('0x4')]]);}else if(queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0xf')]){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x234e1a[_0x2abb('0x4')],queues[_0x234e1a[_0x2abb('0x4')]]['name'],queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0xf')]));queues[queues[_0x234e1a[_0x2abb('0x4')]][_0x2abb('0xf')]]=queues[_0x234e1a[_0x2abb('0x4')]];queues[queues[_0x234e1a['uniqueid']][_0x2abb('0xf')]][_0x2abb('0x1c')]=0x2;delete queues[_0x234e1a['uniqueid']];}}}catch(_0x318050){utils['error'](util[_0x2abb('0x2')](_0x2abb('0x18'),_0x234e1a[_0x2abb('0x4')]),_0x318050);}};exports[_0x2abb('0x1d')]=function(_0x3101c0){try{utils[_0x2abb('0x11')](util['format']('[%s][queues][varset]',_0x3101c0[_0x2abb('0x4')]),_0x3101c0);if(!_['isNil'](_0x3101c0[_0x2abb('0x1e')][_0x2abb('0x1f')])&&_0x3101c0[_0x2abb('0x20')][_0x2abb('0x21')]()!=='CONTINUE'){if(!_[_0x2abb('0x17')](queues[_0x3101c0['uniqueid']])){queues[_0x3101c0[_0x2abb('0x4')]]['queuecallerabandon']=![];queues[_0x3101c0['uniqueid']][_0x2abb('0x22')]=null;queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x23')]=!![];queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x24')]=utils[_0x2abb('0x25')]();queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x3101c0[_0x2abb('0x20')]['toUpperCase']();utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x26'),_0x3101c0[_0x2abb('0x4')],queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x27')],_0x3101c0[_0x2abb('0x20')],queues[_0x3101c0['uniqueid']][_0x2abb('0x9')]));writeDB(queues[_0x3101c0[_0x2abb('0x4')]]);}}else if(!_[_0x2abb('0x17')](_0x3101c0[_0x2abb('0x1e')]['queueposition'])){if(!_[_0x2abb('0x17')](queues[_0x3101c0[_0x2abb('0x4')]])&&!queues[_0x3101c0['uniqueid']]['queuecallerabandon']){queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x22')]=null;queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x23')]=!![];queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x24')]=utils[_0x2abb('0x25')]();queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x2abb('0x28');utils['info'](util['format'](_0x2abb('0x29'),_0x3101c0['uniqueid'],queues[_0x3101c0['uniqueid']][_0x2abb('0x27')],_0x3101c0[_0x2abb('0x20')],queues[_0x3101c0[_0x2abb('0x4')]][_0x2abb('0x9')]));}}}catch(_0x17b786){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x2a'),_0x3101c0['uniqueid']),_0x17b786);}};exports[_0x2abb('0x19')]=function(_0x51c0e8){try{if(!_[_0x2abb('0x17')](queues[_0x51c0e8[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')]('[%s][queues][queuecallerabandon]',_0x51c0e8[_0x2abb('0x4')]),_0x51c0e8);queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x23')]=![];queues[_0x51c0e8[_0x2abb('0x4')]]['queuecallerexitAt']=null;queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x19')]=!![];queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x22')]=utils[_0x2abb('0x25')]();queues[_0x51c0e8[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x2abb('0x2b');utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x2c'),_0x51c0e8[_0x2abb('0x4')],queues[_0x51c0e8['uniqueid']][_0x2abb('0x27')],queues[_0x51c0e8['uniqueid']][_0x2abb('0x9')]));}}catch(_0x2900c0){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x2d'),_0x51c0e8[_0x2abb('0x4')]),_0x2900c0);}};exports[_0x2abb('0x2e')]=function(_0x5485cd){try{if(!_[_0x2abb('0x17')](queues[_0x5485cd[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x2f'),_0x5485cd[_0x2abb('0x4')]),_0x5485cd);utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x30'),_0x5485cd[_0x2abb('0x4')],queues[_0x5485cd[_0x2abb('0x4')]][_0x2abb('0x27')],_0x5485cd[_0x2abb('0x31')],_0x5485cd[_0x2abb('0x32')]));queues[_0x5485cd[_0x2abb('0x4')]]['queuecallerleave']=!![];queues[_0x5485cd[_0x2abb('0x4')]][_0x2abb('0x33')]=utils[_0x2abb('0x25')]();queues[_0x5485cd['uniqueid']][_0x2abb('0x34')]=utils[_0x2abb('0x35')](queues[_0x5485cd[_0x2abb('0x4')]]['queuecallerleaveAt'],queues[_0x5485cd[_0x2abb('0x4')]][_0x2abb('0x36')]);queues[_0x5485cd[_0x2abb('0x4')]]['position']=_0x5485cd[_0x2abb('0x37')];queues[_0x5485cd[_0x2abb('0x4')]]['count']=_0x5485cd[_0x2abb('0x38')];queues[_0x5485cd['uniqueid']][_0x2abb('0x31')]=_0x5485cd['connectedlinenum'];queues[_0x5485cd['uniqueid']][_0x2abb('0x32')]=_0x5485cd[_0x2abb('0x32')];}}catch(_0x4bef57){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x2f'),_0x5485cd[_0x2abb('0x4')]),_0x4bef57);}};exports[_0x2abb('0x39')]=function(_0xa41b93){try{if(!_[_0x2abb('0x17')](queues[_0xa41b93[_0x2abb('0x4')]])){utils['debug'](util[_0x2abb('0x2')]('[%s][queues][agentconnect]',_0xa41b93[_0x2abb('0x4')]),_0xa41b93);utils[_0x2abb('0x13')](util[_0x2abb('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xa41b93[_0x2abb('0x4')],queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x27')],_0xa41b93[_0x2abb('0x3a')],_0xa41b93['destaccountcode']));queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0xa41b93[_0x2abb('0x4')]]['queuecallerabandon']=![];queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x22')]=null;queues[_0xa41b93['uniqueid']][_0x2abb('0x23')]=![];queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x9')]=null;queues[_0xa41b93[_0x2abb('0x4')]]['queuecallerexitAt']=null;queues[_0xa41b93['uniqueid']][_0x2abb('0x3b')]=!![];queues[_0xa41b93[_0x2abb('0x4')]][_0x2abb('0x8')]=_0xa41b93['destaccountcode'];queues[_0xa41b93[_0x2abb('0x4')]]['lastAssignedTo']=_0xa41b93[_0x2abb('0x3a')];}}catch(_0x506a28){utils['error'](util[_0x2abb('0x2')](_0x2abb('0x3c'),_0xa41b93[_0x2abb('0x4')]),_0x506a28);}};exports[_0x2abb('0x3d')]=function(_0x294d90){try{if(!_['isNil'](queues[_0x294d90[_0x2abb('0x4')]])){if(queues[_0x294d90[_0x2abb('0x4')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0x2abb('0x3e'),_0x294d90[_0x2abb('0x4')]),_0x294d90);queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x19')]=![];queues[_0x294d90[_0x2abb('0x4')]]['queuecallerabandonAt']=null;queues[_0x294d90['uniqueid']][_0x2abb('0x23')]=![];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x24')]=null;queues[_0x294d90['uniqueid']][_0x2abb('0x3b')]=!![];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x6')]=_0x294d90[_0x2abb('0x3a')];queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x1a')]=!![];queues[_0x294d90['uniqueid']][_0x2abb('0x1b')]=utils[_0x2abb('0x25')]();if(_0x294d90[_0x2abb('0x3f')]==_0x2abb('0x40')){if(!queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x40')]){queues[_0x294d90['uniqueid']][_0x2abb('0x9')]=_0x2abb('0x41');}}else{queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x9')]=_0x2abb('0x42')+_0x294d90[_0x2abb('0x3f')][_0x2abb('0x21')]();}utils[_0x2abb('0x13')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x294d90['uniqueid'],queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x27')],_0x294d90[_0x2abb('0x3a')],queues[_0x294d90[_0x2abb('0x4')]][_0x2abb('0x9')]));writeDB(queues[_0x294d90[_0x2abb('0x4')]]);}}}catch(_0x1b0500){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x3e'),_0x294d90[_0x2abb('0x4')]),_0x1b0500);}};exports[_0x2abb('0x43')]=function(_0x5d06fc){try{if(!_['isNil'](queues[_0x5d06fc[_0x2abb('0x44')]])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x45'),_0x5d06fc['uniqueid']),_0x5d06fc);queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x40')]=!![];queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x46')]='BLIND';queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x47')]=_0x5d06fc[_0x2abb('0x48')];queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x49')]=_0x5d06fc[_0x2abb('0x44')];queues[_0x5d06fc[_0x2abb('0x44')]][_0x2abb('0x9')]=_0x2abb('0x4a');utils[_0x2abb('0x13')](util['format'](_0x2abb('0x4b'),_0x5d06fc[_0x2abb('0x4')],queues[_0x5d06fc[_0x2abb('0x44')]]['name'],_0x5d06fc['transfereeuniqueid'],_0x5d06fc[_0x2abb('0x48')]));}}catch(_0xadd9ef){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x45'),_0x5d06fc[_0x2abb('0x4')]),_0xadd9ef);}};exports[_0x2abb('0x4c')]=function(_0x33cdd5){try{utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x4d'),_0x33cdd5[_0x2abb('0x4e')]),_0x33cdd5);if(_0x33cdd5[_0x2abb('0x4e')]==_0x33cdd5[_0x2abb('0x4f')]){if(!_[_0x2abb('0x17')](queues[_0x33cdd5[_0x2abb('0x50')]])){utils[_0x2abb('0x13')](util['format'](_0x2abb('0x51'),_0x33cdd5[_0x2abb('0x4e')],queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x27')],_0x33cdd5[_0x2abb('0x52')]));queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x40')]=!![];queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x46')]=_0x2abb('0x53');queues[_0x33cdd5['secondtransfererlinkedid']][_0x2abb('0x47')]=_0x33cdd5[_0x2abb('0x52')];queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x49')]=_0x33cdd5[_0x2abb('0x4e')];queues[_0x33cdd5['secondtransfererlinkedid']]['queuecallerexitreason']=_0x2abb('0x54');}if(!_[_0x2abb('0x17')](queues[_0x33cdd5[_0x2abb('0x4f')]])){if(_0x33cdd5[_0x2abb('0x55')]&&queues[_0x33cdd5[_0x2abb('0x55')]]){queues[_0x33cdd5[_0x2abb('0x55')]][_0x2abb('0x1c')]=0x1;queues[_0x33cdd5[_0x2abb('0x44')]]=_[_0x2abb('0x56')](queues[_0x33cdd5[_0x2abb('0x55')]]);queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0xf')]=_0x33cdd5[_0x2abb('0x57')];queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x1c')]=0x2;queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x7')]=queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x7')];queues[_0x33cdd5[_0x2abb('0x44')]]['calleridname']=queues[_0x33cdd5[_0x2abb('0x50')]][_0x2abb('0x58')];queues[_0x33cdd5['transfereeuniqueid']][_0x2abb('0x36')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x33')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x34')]=0x0;queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x59')]=0x0;utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x5a'),_0x33cdd5['origtransfereruniqueid'],queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x27')],queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x7')],queues[_0x33cdd5[_0x2abb('0x44')]][_0x2abb('0x58')]));}else{utils[_0x2abb('0x13')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x33cdd5[_0x2abb('0x4e')],queues[_0x33cdd5[_0x2abb('0x4f')]]['name'],_0x33cdd5[_0x2abb('0x50')]));queues[_0x33cdd5[_0x2abb('0x4f')]]['transfereduniqueid']=_0x33cdd5['secondtransfererlinkedid'];}}}else if(_0x33cdd5[_0x2abb('0x5b')]==_0x33cdd5[_0x2abb('0x50')]){if(!_[_0x2abb('0x17')](queues[_0x33cdd5[_0x2abb('0x4f')]])){utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x5c'),_0x33cdd5['origtransfereruniqueid'],queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x27')],_0x33cdd5[_0x2abb('0x5b')],_0x33cdd5[_0x2abb('0x5d')]));queues[_0x33cdd5['origtransfererlinkedid']][_0x2abb('0x40')]=!![];queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x46')]=_0x2abb('0x53');queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x47')]=_0x33cdd5[_0x2abb('0x5d')];queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x49')]=_0x33cdd5['secondtransfereruniqueid'];queues[_0x33cdd5[_0x2abb('0x4f')]][_0x2abb('0x9')]=_0x2abb('0x54');}if(!_['isNil'](queues[_0x33cdd5['secondtransfererlinkedid']])){if(_0x33cdd5[_0x2abb('0x5e')]&&queues[_0x33cdd5['transfertargetlinkedid']]){queues[_0x33cdd5[_0x2abb('0x5e')]][_0x2abb('0x1c')]=0x1;queues[_0x33cdd5[_0x2abb('0x57')]]=_['clone'](queues[_0x33cdd5[_0x2abb('0x5e')]]);queues[_0x33cdd5['transfertargetuniqueid']][_0x2abb('0xf')]=_0x33cdd5[_0x2abb('0x57')];queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x1c')]=0x2;queues[_0x33cdd5[_0x2abb('0x57')]]['calleridnum']=queues[_0x33cdd5['origtransfererlinkedid']][_0x2abb('0x7')];queues[_0x33cdd5[_0x2abb('0x57')]]['calleridname']=queues[_0x33cdd5[_0x2abb('0x4f')]]['calleridname'];queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x36')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x33')]=utils[_0x2abb('0x25')]();queues[_0x33cdd5['transfertargetuniqueid']][_0x2abb('0x34')]=0x0;queues[_0x33cdd5['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x2abb('0x13')](util[_0x2abb('0x2')](_0x2abb('0x5f'),_0x33cdd5[_0x2abb('0x4e')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x27')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0xf')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x7')],queues[_0x33cdd5[_0x2abb('0x57')]][_0x2abb('0x58')]));}else{utils[_0x2abb('0x13')](util['format'](_0x2abb('0x60'),_0x33cdd5['origtransfereruniqueid'],queues[_0x33cdd5[_0x2abb('0x50')]]['name'],_0x33cdd5[_0x2abb('0x4f')]));queues[_0x33cdd5[_0x2abb('0x50')]]['transfereduniqueid']=_0x33cdd5[_0x2abb('0x4f')];}}}}catch(_0x2a3aeb){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x4d'),_0x33cdd5[_0x2abb('0x4e')]),_0x2a3aeb);}};exports['musiconholdstart']=function(_0xc088b9){try{if(!_[_0x2abb('0x17')](queues[_0xc088b9[_0x2abb('0x4')]])){utils[_0x2abb('0x11')](util['format'](_0x2abb('0x61'),_0xc088b9['uniqueid']),_0xc088b9);queues[_0xc088b9[_0x2abb('0x4')]]['musiconholdstartAt']=utils[_0x2abb('0x25')]();utils[_0x2abb('0x13')](util['format'](_0x2abb('0x62'),_0xc088b9[_0x2abb('0x4')],queues[_0xc088b9[_0x2abb('0x4')]][_0x2abb('0x27')],queues[_0xc088b9[_0x2abb('0x4')]][_0x2abb('0x63')]));}}catch(_0x3617ce){utils[_0x2abb('0x16')](util[_0x2abb('0x2')](_0x2abb('0x61'),_0xc088b9[_0x2abb('0x4')]),_0x3617ce);}};exports['musiconholdstop']=function(_0x58e441){try{if(!_[_0x2abb('0x17')](queues[_0x58e441['uniqueid']])){if(!_[_0x2abb('0x17')](queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x63')])){utils[_0x2abb('0x11')](util[_0x2abb('0x2')](_0x2abb('0x64'),_0x58e441[_0x2abb('0x4')]),_0x58e441);queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x59')]+=utils[_0x2abb('0x35')](utils[_0x2abb('0x25')](),queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x63')]);utils[_0x2abb('0x13')](util[_0x2abb('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x58e441['uniqueid'],queues[_0x58e441['uniqueid']][_0x2abb('0x27')],queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x59')]));delete queues[_0x58e441[_0x2abb('0x4')]][_0x2abb('0x63')];}}}catch(_0x32e16f){utils[_0x2abb('0x16')](util[_0x2abb('0x2')]('[%s][queues][musiconholdstop]',_0x58e441[_0x2abb('0x4')]),_0x32e16f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 1166a1d..aebd5a7 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 _0x7d17=['./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridname','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util'];(function(_0x3fd757,_0x224085){var _0x318f9f=function(_0x32f627){while(--_0x32f627){_0x3fd757['push'](_0x3fd757['shift']());}};_0x318f9f(++_0x224085);}(_0x7d17,0x1b5));var _0x77d1=function(_0x1d2f85,_0x27e8a5){_0x1d2f85=_0x1d2f85-0x0;var _0x3254db=_0x7d17[_0x1d2f85];return _0x3254db;};'use strict';var _=require('lodash');var util=require(_0x77d1('0x0'));var utils=require('./utils');var transfers=require(_0x77d1('0x1'));var recordings={};function writeDB(_0x5653ec){var _0x19a4a1;utils[_0x77d1('0x2')](util[_0x77d1('0x3')]('[%s][recordings][writeDB]',_0x5653ec[_0x77d1('0x4')]));if(transfers[_0x77d1('0x5')][_0x5653ec[_0x77d1('0x4')]]){_0x19a4a1=_0x5653ec[_0x77d1('0x4')];_0x5653ec['uniqueid']=transfers[_0x77d1('0x5')][_0x5653ec[_0x77d1('0x4')]][_0x77d1('0x6')];}if(_0x5653ec[_0x77d1('0x7')]){utils[_0x77d1('0x8')](_0x5653ec[_0x77d1('0x7')])[_0x77d1('0x9')](function(_0x3dfb34){if(_0x3dfb34){_0x5653ec[_0x77d1('0xa')]=_0x3dfb34[_0x77d1('0xb')];_0x5653ec[_0x77d1('0xc')]=_0x3dfb34['id'];}utils[_0x77d1('0xd')](_0x77d1('0xe'),_0x5653ec);});}else{utils[_0x77d1('0xd')](_0x77d1('0xe'),_0x5653ec);}if(_0x19a4a1)delete transfers[_0x77d1('0x5')][_0x19a4a1];}exports[_0x77d1('0xf')]=function(_0x64f4aa){try{utils[_0x77d1('0x10')](util[_0x77d1('0x3')](_0x77d1('0x11'),_0x64f4aa['uniqueid']),_0x64f4aa);if(_0x64f4aa[_0x77d1('0x4')]==_0x64f4aa[_0x77d1('0x12')]){utils[_0x77d1('0x2')](util['format'](_0x77d1('0x13'),_0x64f4aa[_0x77d1('0x4')],_0x64f4aa['context'],_0x64f4aa[_0x77d1('0x14')]));recordings[_0x64f4aa['uniqueid']]={'uniqueid':_0x64f4aa[_0x77d1('0x4')],'accountcode':_0x64f4aa[_0x77d1('0x7')],'exten':_0x64f4aa['exten'],'context':_0x64f4aa['context'],'channel':_0x64f4aa['channel'],'monitors':[]};}}catch(_0x17baf4){utils[_0x77d1('0x15')](util[_0x77d1('0x3')](_0x77d1('0x11'),_0x64f4aa[_0x77d1('0x4')]),_0x17baf4);}};exports[_0x77d1('0x16')]=function(_0x2b6cdc){try{utils[_0x77d1('0x10')](util[_0x77d1('0x3')](_0x77d1('0x17'),_0x2b6cdc[_0x77d1('0x4')]),_0x2b6cdc);if(!_[_0x77d1('0x18')](recordings[_0x2b6cdc[_0x77d1('0x4')]])&&_0x2b6cdc[_0x77d1('0x19')]==0x6){utils['info'](util['format'](_0x77d1('0x1a'),_0x2b6cdc['uniqueid'],_0x2b6cdc[_0x77d1('0x1b')],_0x2b6cdc[_0x77d1('0x1c')]));}else if(!_[_0x77d1('0x18')](recordings[_0x2b6cdc['linkedid']])&&_0x2b6cdc[_0x77d1('0x19')]==0x6&&_0x2b6cdc[_0x77d1('0x1b')]!=_0x77d1('0x1d')){utils[_0x77d1('0x2')](util[_0x77d1('0x3')](_0x77d1('0x1e'),_0x2b6cdc[_0x77d1('0x4')],_0x2b6cdc['linkedid'],_0x2b6cdc['context'],_0x2b6cdc[_0x77d1('0x1c')]));recordings[_0x2b6cdc[_0x77d1('0x12')]]['accountcode']=_0x2b6cdc[_0x77d1('0x7')];}}catch(_0x18e1c5){utils[_0x77d1('0x15')](util[_0x77d1('0x3')]('[%s][recordings][newstate]',_0x2b6cdc['uniqueid']),_0x18e1c5);}};exports['varset']=function(_0x487de4){try{if(!_['isNil'](_0x487de4['variable'])&&!_[_0x77d1('0x18')](_0x487de4[_0x77d1('0x1f')]['mixmonitor_filename'])){utils[_0x77d1('0x10')](util['format'](_0x77d1('0x20'),_0x487de4['uniqueid']),_0x487de4);utils[_0x77d1('0x2')](util['format'](_0x77d1('0x21'),_0x487de4[_0x77d1('0x4')],_0x487de4[_0x77d1('0x1f')],_0x487de4['value']));if(_['endsWith'](_0x487de4[_0x77d1('0x22')],'.wav49')){_0x487de4[_0x77d1('0x22')]=_0x487de4['value'][_0x77d1('0x23')](_0x77d1('0x24'),_0x77d1('0x25'));}if(recordings[_0x487de4[_0x77d1('0x12')]]){var _0x40bcf0=_['find'](recordings[_0x487de4[_0x77d1('0x12')]][_0x77d1('0x26')],{'value':_0x487de4[_0x77d1('0x22')]});if(_[_0x77d1('0x18')](_0x40bcf0)){recordings[_0x487de4[_0x77d1('0x12')]]['monitors'][_0x77d1('0x27')]({'value':_0x487de4[_0x77d1('0x22')]});}}}}catch(_0x2eb1a8){utils[_0x77d1('0x15')](util[_0x77d1('0x3')](_0x77d1('0x20'),_0x487de4[_0x77d1('0x4')]),_0x2eb1a8);}};exports[_0x77d1('0x28')]=function(_0x440065){try{if(!_['isNil'](recordings[_0x440065['uniqueid']])){utils[_0x77d1('0x10')](util[_0x77d1('0x3')]('[%s][recordings][hangup]',_0x440065['uniqueid']),_0x440065);utils[_0x77d1('0x2')](util[_0x77d1('0x3')](_0x77d1('0x29'),_0x440065[_0x77d1('0x4')],_0x440065['calleridnum'],_0x440065['calleridname'],_0x440065[_0x77d1('0x2a')]));recordings[_0x440065[_0x77d1('0x4')]]['calleridnum']=_0x440065['calleridnum'];recordings[_0x440065[_0x77d1('0x4')]][_0x77d1('0x2b')]=_0x440065[_0x77d1('0x2b')];recordings[_0x440065[_0x77d1('0x4')]]['connectedlinenum']=_0x440065['connectedlinenum'];recordings[_0x440065[_0x77d1('0x4')]][_0x77d1('0x2c')]=_0x440065[_0x77d1('0x2c')];if(recordings[_0x440065[_0x77d1('0x4')]][_0x77d1('0x2d')]==_0x77d1('0x2e')&&recordings[_0x440065['uniqueid']][_0x77d1('0x7')]){recordings[_0x440065[_0x77d1('0x4')]]['connectedlinenum']=recordings[_0x440065[_0x77d1('0x4')]][_0x77d1('0x7')];recordings[_0x440065['uniqueid']][_0x77d1('0x2c')]='';}recordings[_0x440065[_0x77d1('0x4')]][_0x77d1('0x26')][_0x77d1('0x2f')](function(_0x18a8ce){var _0x23786c=_[_0x77d1('0x30')](recordings[_0x440065[_0x77d1('0x4')]]);_0x23786c[_0x77d1('0x22')]=_0x18a8ce['value'];writeDB(_0x23786c);});delete recordings[_0x440065[_0x77d1('0x4')]];}}catch(_0x4ced30){utils['error'](util[_0x77d1('0x3')](_0x77d1('0x31'),_0x440065['uniqueid']),_0x4ced30);}};exports[_0x77d1('0x32')]=function(_0x3889c9){try{if(!_['isNil'](recordings[_0x3889c9[_0x77d1('0x4')]])){utils[_0x77d1('0x10')](util[_0x77d1('0x3')]('[%s][recordings][newexten]',_0x3889c9[_0x77d1('0x4')]),_0x3889c9);utils[_0x77d1('0x2')](util[_0x77d1('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3889c9[_0x77d1('0x4')],_0x3889c9[_0x77d1('0x33')],_0x3889c9[_0x77d1('0x34')]));if(_0x3889c9[_0x77d1('0x33')][_0x77d1('0x35')]()==_0x77d1('0x36')&&_['startsWith'](_0x3889c9['appdata'][_0x77d1('0x35')](),_0x77d1('0x37'))){var _0x4342a3=_0x3889c9['appdata'][_0x77d1('0x38')]('=');var _0x322c54=_0x4342a3[0x0][_0x77d1('0x39')](_0x4342a3[0x0]['lastIndexOf']('(')+0x1,_0x4342a3[0x0][_0x77d1('0x3a')](')'));var _0x22ba85=_0x4342a3[0x1];recordings[_0x3889c9[_0x77d1('0x4')]][_0x322c54]=_0x22ba85;}}}catch(_0x4e27d8){utils['error'](util[_0x77d1('0x3')](_0x77d1('0x3b'),_0x3889c9[_0x77d1('0x4')]),_0x4e27d8);}};exports[_0x77d1('0x3c')]=function(_0x3442d6){try{if(!_[_0x77d1('0x18')](recordings[_0x3442d6[_0x77d1('0x4')]])){utils[_0x77d1('0x10')](util[_0x77d1('0x3')](_0x77d1('0x3d'),_0x3442d6[_0x77d1('0x4')]),_0x3442d6);utils[_0x77d1('0x2')](util[_0x77d1('0x3')](_0x77d1('0x3e'),_0x3442d6[_0x77d1('0x4')],_0x3442d6[_0x77d1('0x3f')]));recordings[_0x3442d6[_0x77d1('0x4')]][_0x77d1('0x3f')]=_0x3442d6[_0x77d1('0x3f')];}}catch(_0x59b184){utils[_0x77d1('0x15')](util['format'](_0x77d1('0x3d'),_0x3442d6[_0x77d1('0x4')]),_0x59b184);}};exports[_0x77d1('0x40')]=function(_0x246978){try{utils[_0x77d1('0x10')](util[_0x77d1('0x3')](_0x77d1('0x41'),_0x246978[_0x77d1('0x4')]),_0x246978);utils['info'](util[_0x77d1('0x3')](_0x77d1('0x42'),_0x246978[_0x77d1('0x4')],_0x246978[_0x77d1('0x43')],_0x246978[_0x77d1('0x44')],_0x246978[_0x77d1('0x45')],_0x246978[_0x77d1('0x46')]));if(recordings[_0x246978[_0x77d1('0x47')]]&&transfers[_0x77d1('0x5')][_0x246978[_0x77d1('0x47')]]){transfers[_0x77d1('0x5')][_0x246978[_0x77d1('0x47')]][_0x77d1('0x48')]=!![];}}catch(_0x64c8f){utils['error'](util[_0x77d1('0x3')]('[%s][recordings][blindtransfer]',_0x246978[_0x77d1('0x4')]),_0x64c8f);}}; \ No newline at end of file +var _0xf48d=['then','membername','name','UserId','request','CreateVoiceRecording','blinds','newchannel','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','accountcode'];(function(_0x3cd2ea,_0xf3bf4d){var _0x1acc13=function(_0x42e499){while(--_0x42e499){_0x3cd2ea['push'](_0x3cd2ea['shift']());}};_0x1acc13(++_0xf3bf4d);}(_0xf48d,0x174));var _0xdf48=function(_0x968411,_0x151619){_0x968411=_0x968411-0x0;var _0x46e3e5=_0xf48d[_0x968411];return _0x46e3e5;};'use strict';var _=require(_0xdf48('0x0'));var util=require('util');var utils=require(_0xdf48('0x1'));var transfers=require(_0xdf48('0x2'));var recordings={};function writeDB(_0x17fa9e){var _0x5d9414;utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x5'),_0x17fa9e['uniqueid']));if(transfers['blinds'][_0x17fa9e[_0xdf48('0x6')]]){_0x5d9414=_0x17fa9e['uniqueid'];_0x17fa9e[_0xdf48('0x6')]=transfers['blinds'][_0x17fa9e[_0xdf48('0x6')]]['transfereeuniqueid'];}if(_0x17fa9e[_0xdf48('0x7')]){utils['getUserByInternal'](_0x17fa9e[_0xdf48('0x7')])[_0xdf48('0x8')](function(_0x3b6308){if(_0x3b6308){_0x17fa9e[_0xdf48('0x9')]=_0x3b6308[_0xdf48('0xa')];_0x17fa9e[_0xdf48('0xb')]=_0x3b6308['id'];}utils[_0xdf48('0xc')]('CreateVoiceRecording',_0x17fa9e);});}else{utils[_0xdf48('0xc')](_0xdf48('0xd'),_0x17fa9e);}if(_0x5d9414)delete transfers[_0xdf48('0xe')][_0x5d9414];}exports[_0xdf48('0xf')]=function(_0x1eea4f){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x1eea4f[_0xdf48('0x6')]),_0x1eea4f);if(_0x1eea4f[_0xdf48('0x6')]==_0x1eea4f[_0xdf48('0x10')]){utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x11'),_0x1eea4f['uniqueid'],_0x1eea4f[_0xdf48('0x12')],_0x1eea4f['exten']));recordings[_0x1eea4f['uniqueid']]={'uniqueid':_0x1eea4f[_0xdf48('0x6')],'accountcode':_0x1eea4f[_0xdf48('0x7')],'exten':_0x1eea4f[_0xdf48('0x13')],'context':_0x1eea4f['context'],'channel':_0x1eea4f[_0xdf48('0x14')],'monitors':[]};}}catch(_0x41e538){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x16'),_0x1eea4f[_0xdf48('0x6')]),_0x41e538);}};exports[_0xdf48('0x17')]=function(_0x487c1a){try{utils[_0xdf48('0x18')](util['format'](_0xdf48('0x19'),_0x487c1a[_0xdf48('0x6')]),_0x487c1a);if(!_[_0xdf48('0x1a')](recordings[_0x487c1a[_0xdf48('0x6')]])&&_0x487c1a[_0xdf48('0x1b')]==0x6){utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x1c'),_0x487c1a['uniqueid'],_0x487c1a[_0xdf48('0x12')],_0x487c1a[_0xdf48('0x14')]));}else if(!_[_0xdf48('0x1a')](recordings[_0x487c1a['linkedid']])&&_0x487c1a['channelstate']==0x6&&_0x487c1a[_0xdf48('0x12')]!=_0xdf48('0x1d')){utils[_0xdf48('0x3')](util[_0xdf48('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x487c1a['uniqueid'],_0x487c1a[_0xdf48('0x10')],_0x487c1a[_0xdf48('0x12')],_0x487c1a[_0xdf48('0x14')]));recordings[_0x487c1a['linkedid']][_0xdf48('0x7')]=_0x487c1a['accountcode'];}}catch(_0x9e50b7){utils[_0xdf48('0x15')](util['format'](_0xdf48('0x19'),_0x487c1a[_0xdf48('0x6')]),_0x9e50b7);}};exports[_0xdf48('0x1e')]=function(_0x53fb39){try{if(!_['isNil'](_0x53fb39[_0xdf48('0x1f')])&&!_['isNil'](_0x53fb39[_0xdf48('0x1f')]['mixmonitor_filename'])){utils[_0xdf48('0x18')](util[_0xdf48('0x4')]('[%s][recordings][varset]',_0x53fb39['uniqueid']),_0x53fb39);utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x20'),_0x53fb39[_0xdf48('0x6')],_0x53fb39['variable'],_0x53fb39['value']));if(_[_0xdf48('0x21')](_0x53fb39[_0xdf48('0x22')],_0xdf48('0x23'))){_0x53fb39[_0xdf48('0x22')]=_0x53fb39[_0xdf48('0x22')]['replace'](_0xdf48('0x23'),_0xdf48('0x24'));}if(recordings[_0x53fb39[_0xdf48('0x10')]]){var _0xe6234=_[_0xdf48('0x25')](recordings[_0x53fb39[_0xdf48('0x10')]][_0xdf48('0x26')],{'value':_0x53fb39[_0xdf48('0x22')]});if(_[_0xdf48('0x1a')](_0xe6234)){recordings[_0x53fb39['linkedid']][_0xdf48('0x26')][_0xdf48('0x27')]({'value':_0x53fb39['value']});}}}}catch(_0x527558){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x28'),_0x53fb39['uniqueid']),_0x527558);}};exports[_0xdf48('0x29')]=function(_0x251cf3){try{if(!_[_0xdf48('0x1a')](recordings[_0x251cf3['uniqueid']])){utils[_0xdf48('0x18')](util['format'](_0xdf48('0x2a'),_0x251cf3[_0xdf48('0x6')]),_0x251cf3);utils['info'](util[_0xdf48('0x4')](_0xdf48('0x2b'),_0x251cf3[_0xdf48('0x6')],_0x251cf3['calleridnum'],_0x251cf3[_0xdf48('0x2c')],_0x251cf3[_0xdf48('0x2d')]));recordings[_0x251cf3['uniqueid']][_0xdf48('0x2e')]=_0x251cf3[_0xdf48('0x2e')];recordings[_0x251cf3[_0xdf48('0x6')]]['calleridname']=_0x251cf3['calleridname'];recordings[_0x251cf3[_0xdf48('0x6')]]['connectedlinenum']=_0x251cf3[_0xdf48('0x2f')];recordings[_0x251cf3['uniqueid']][_0xdf48('0x30')]=_0x251cf3[_0xdf48('0x30')];if(recordings[_0x251cf3[_0xdf48('0x6')]][_0xdf48('0x31')]==_0xdf48('0x32')&&recordings[_0x251cf3[_0xdf48('0x6')]][_0xdf48('0x7')]){recordings[_0x251cf3[_0xdf48('0x6')]]['connectedlinenum']=recordings[_0x251cf3[_0xdf48('0x6')]]['accountcode'];recordings[_0x251cf3[_0xdf48('0x6')]][_0xdf48('0x30')]='';}recordings[_0x251cf3[_0xdf48('0x6')]]['monitors'][_0xdf48('0x33')](function(_0x513452){var _0xcac92f=_[_0xdf48('0x34')](recordings[_0x251cf3[_0xdf48('0x6')]]);_0xcac92f[_0xdf48('0x22')]=_0x513452[_0xdf48('0x22')];writeDB(_0xcac92f);});delete recordings[_0x251cf3['uniqueid']];}}catch(_0x404871){utils['error'](util['format'](_0xdf48('0x2a'),_0x251cf3[_0xdf48('0x6')]),_0x404871);}};exports[_0xdf48('0x35')]=function(_0x32358e){try{if(!_['isNil'](recordings[_0x32358e['uniqueid']])){utils['debug'](util[_0xdf48('0x4')](_0xdf48('0x36'),_0x32358e[_0xdf48('0x6')]),_0x32358e);utils[_0xdf48('0x3')](util[_0xdf48('0x4')](_0xdf48('0x37'),_0x32358e[_0xdf48('0x6')],_0x32358e['application'],_0x32358e[_0xdf48('0x38')]));if(_0x32358e[_0xdf48('0x39')][_0xdf48('0x3a')]()==_0xdf48('0x3b')&&_[_0xdf48('0x3c')](_0x32358e[_0xdf48('0x38')][_0xdf48('0x3a')](),_0xdf48('0x3d'))){var _0xc6ed82=_0x32358e[_0xdf48('0x38')][_0xdf48('0x3e')]('=');var _0x2d5583=_0xc6ed82[0x0][_0xdf48('0x3f')](_0xc6ed82[0x0][_0xdf48('0x40')]('(')+0x1,_0xc6ed82[0x0][_0xdf48('0x40')](')'));var _0x122fd5=_0xc6ed82[0x1];recordings[_0x32358e[_0xdf48('0x6')]][_0x2d5583]=_0x122fd5;}}}catch(_0xfb939c){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x36'),_0x32358e[_0xdf48('0x6')]),_0xfb939c);}};exports['queuecallerjoin']=function(_0x5d9b00){try{if(!_[_0xdf48('0x1a')](recordings[_0x5d9b00[_0xdf48('0x6')]])){utils[_0xdf48('0x18')](util[_0xdf48('0x4')](_0xdf48('0x41'),_0x5d9b00[_0xdf48('0x6')]),_0x5d9b00);utils['info'](util[_0xdf48('0x4')](_0xdf48('0x42'),_0x5d9b00[_0xdf48('0x6')],_0x5d9b00['queue']));recordings[_0x5d9b00['uniqueid']][_0xdf48('0x43')]=_0x5d9b00['queue'];}}catch(_0x465e51){utils[_0xdf48('0x15')](util['format'](_0xdf48('0x41'),_0x5d9b00[_0xdf48('0x6')]),_0x465e51);}};exports[_0xdf48('0x44')]=function(_0x469036){try{utils[_0xdf48('0x18')](util[_0xdf48('0x4')]('[%s][recordings][blindtransfer]',_0x469036[_0xdf48('0x6')]),_0x469036);utils[_0xdf48('0x3')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x469036['uniqueid'],_0x469036[_0xdf48('0x45')],_0x469036[_0xdf48('0x46')],_0x469036[_0xdf48('0x47')],_0x469036[_0xdf48('0x48')]));if(recordings[_0x469036[_0xdf48('0x49')]]&&transfers[_0xdf48('0xe')][_0x469036[_0xdf48('0x49')]]){transfers[_0xdf48('0xe')][_0x469036[_0xdf48('0x49')]][_0xdf48('0x4a')]=!![];}}catch(_0x1c22e4){utils[_0xdf48('0x15')](util[_0xdf48('0x4')](_0xdf48('0x4b'),_0x469036['uniqueid']),_0x1c22e4);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 691a9e7..40b49f8 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 _0x5eb1=['blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','attended','origtransfereruniqueid','uniqueid','type','CreateVoiceTransferReport'];(function(_0xc1ede1,_0x27c567){var _0x36f293=function(_0x1fe28c){while(--_0x1fe28c){_0xc1ede1['push'](_0xc1ede1['shift']());}};_0x36f293(++_0x27c567);}(_0x5eb1,0x15e));var _0x15eb=function(_0x55a802,_0x10ab3a){_0x55a802=_0x55a802-0x0;var _0x1a0461=_0x5eb1[_0x55a802];return _0x1a0461;};'use strict';var _=require(_0x15eb('0x0'));var util=require(_0x15eb('0x1'));var utils=require(_0x15eb('0x2'));function writeDB(_0x341abe){utils[_0x15eb('0x3')](util[_0x15eb('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x341abe['type']===_0x15eb('0x5')?_0x341abe[_0x15eb('0x6')]:_0x341abe[_0x15eb('0x7')],_0x341abe[_0x15eb('0x8')]));utils['request'](_0x15eb('0x9'),_0x341abe);}exports[_0x15eb('0xa')]={};exports[_0x15eb('0xb')]=function(_0x4f6c85){try{utils[_0x15eb('0xc')](util[_0x15eb('0x4')]('[%s][transfers][blindtransfer]',_0x4f6c85[_0x15eb('0x7')]),_0x4f6c85);utils[_0x15eb('0x3')](util[_0x15eb('0x4')](_0x15eb('0xd'),_0x4f6c85[_0x15eb('0x7')],_0x4f6c85[_0x15eb('0xe')],_0x4f6c85['transferercalleridname'],_0x4f6c85['transfereecalleridnum'],_0x4f6c85['transfereecalleridname']));_0x4f6c85[_0x15eb('0x8')]=_0x15eb('0xf');exports['blinds'][_0x4f6c85[_0x15eb('0x10')]]=_0x4f6c85;writeDB(_0x4f6c85);}catch(_0x4bde3b){utils[_0x15eb('0x11')](util[_0x15eb('0x4')](_0x15eb('0x12'),_0x4f6c85[_0x15eb('0x7')]),_0x4bde3b);}};exports[_0x15eb('0x13')]=function(_0xccc96c){try{utils[_0x15eb('0xc')](util[_0x15eb('0x4')]('[%s][transfers][attendedtransfer]',_0xccc96c[_0x15eb('0x6')]),_0xccc96c);utils[_0x15eb('0x3')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xccc96c[_0x15eb('0x6')],_0xccc96c[_0x15eb('0x14')],_0xccc96c[_0x15eb('0x15')],_0xccc96c['transfertargetcalleridnum'],_0xccc96c[_0x15eb('0x16')]));_0xccc96c=_[_0x15eb('0x17')](_0xccc96c,{'transfererchannel':_0xccc96c[_0x15eb('0x18')],'transferercalleridnum':_0xccc96c[_0x15eb('0x14')],'transferercalleridname':_0xccc96c['origtransferercalleridname'],'transfererconnectedlinenum':_0xccc96c[_0x15eb('0x19')],'transfererconnectedlinename':_0xccc96c[_0x15eb('0x1a')],'transfereraccountcode':_0xccc96c['origtransfereraccountcode'],'transferercontext':_0xccc96c[_0x15eb('0x1b')],'transfererexten':_0xccc96c['secondtransfererexten'],'transfererlinkedid':_0xccc96c[_0x15eb('0x1c')],'context':_0xccc96c[_0x15eb('0x1d')],'extension':_0xccc96c[_0x15eb('0x1e')],'type':_0x15eb('0x5')});if(_[_0x15eb('0x1f')](_0xccc96c['transfereechannel'])){_0xccc96c=_[_0x15eb('0x17')](_0xccc96c,{'transfereechannel':_0xccc96c['transfertargetchannel'],'transfereecalleridnum':_0xccc96c['transfertargetcalleridnum'],'transfereecalleridname':_0xccc96c[_0x15eb('0x16')],'transfereeconnectedlinenum':_0xccc96c[_0x15eb('0x20')],'transfereeconnectedlinename':_0xccc96c['transfertargetconnectedlinename'],'transfereeaccountcode':_0xccc96c[_0x15eb('0x21')],'transfereecontext':_0xccc96c['transfertargetcontext'],'transfereeexten':_0xccc96c['transfertargetexten'],'transfereelinkedid':_0xccc96c[_0x15eb('0x22')]});}writeDB(_0xccc96c);}catch(_0x431c8f){utils[_0x15eb('0x11')](util['format'](_0x15eb('0x23'),_0xccc96c[_0x15eb('0x6')]),_0x431c8f);}}; \ No newline at end of file +var _0xcd05=['uniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xcd05,0x1b0));var _0x5cd0=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xcd05[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x5cd0('0x0'));var util=require(_0x5cd0('0x1'));var utils=require(_0x5cd0('0x2'));function writeDB(_0x733cde){utils[_0x5cd0('0x3')](util[_0x5cd0('0x4')](_0x5cd0('0x5'),_0x733cde['type']===_0x5cd0('0x6')?_0x733cde[_0x5cd0('0x7')]:_0x733cde[_0x5cd0('0x8')],_0x733cde[_0x5cd0('0x9')]));utils[_0x5cd0('0xa')](_0x5cd0('0xb'),_0x733cde);}exports[_0x5cd0('0xc')]={};exports[_0x5cd0('0xd')]=function(_0x5df623){try{utils['debug'](util[_0x5cd0('0x4')](_0x5cd0('0xe'),_0x5df623[_0x5cd0('0x8')]),_0x5df623);utils['info'](util[_0x5cd0('0x4')](_0x5cd0('0xf'),_0x5df623['uniqueid'],_0x5df623[_0x5cd0('0x10')],_0x5df623['transferercalleridname'],_0x5df623['transfereecalleridnum'],_0x5df623[_0x5cd0('0x11')]));_0x5df623[_0x5cd0('0x9')]=_0x5cd0('0x12');exports['blinds'][_0x5df623[_0x5cd0('0x13')]]=_0x5df623;writeDB(_0x5df623);}catch(_0x2bde52){utils[_0x5cd0('0x14')](util[_0x5cd0('0x4')](_0x5cd0('0xe'),_0x5df623['uniqueid']),_0x2bde52);}};exports[_0x5cd0('0x15')]=function(_0x33227b){try{utils[_0x5cd0('0x16')](util[_0x5cd0('0x4')]('[%s][transfers][attendedtransfer]',_0x33227b[_0x5cd0('0x7')]),_0x33227b);utils[_0x5cd0('0x3')](util['format'](_0x5cd0('0x17'),_0x33227b[_0x5cd0('0x7')],_0x33227b[_0x5cd0('0x18')],_0x33227b[_0x5cd0('0x19')],_0x33227b[_0x5cd0('0x1a')],_0x33227b[_0x5cd0('0x1b')]));_0x33227b=_['assign'](_0x33227b,{'transfererchannel':_0x33227b[_0x5cd0('0x1c')],'transferercalleridnum':_0x33227b[_0x5cd0('0x18')],'transferercalleridname':_0x33227b[_0x5cd0('0x19')],'transfererconnectedlinenum':_0x33227b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x33227b[_0x5cd0('0x1d')],'transfereraccountcode':_0x33227b[_0x5cd0('0x1e')],'transferercontext':_0x33227b[_0x5cd0('0x1f')],'transfererexten':_0x33227b['secondtransfererexten'],'transfererlinkedid':_0x33227b[_0x5cd0('0x20')],'context':_0x33227b[_0x5cd0('0x21')],'extension':_0x33227b[_0x5cd0('0x22')],'type':_0x5cd0('0x6')});if(_['isNil'](_0x33227b['transfereechannel'])){_0x33227b=_[_0x5cd0('0x23')](_0x33227b,{'transfereechannel':_0x33227b[_0x5cd0('0x24')],'transfereecalleridnum':_0x33227b[_0x5cd0('0x1a')],'transfereecalleridname':_0x33227b[_0x5cd0('0x1b')],'transfereeconnectedlinenum':_0x33227b[_0x5cd0('0x25')],'transfereeconnectedlinename':_0x33227b['transfertargetconnectedlinename'],'transfereeaccountcode':_0x33227b['transfertargetaccountcode'],'transfereecontext':_0x33227b['transfertargetcontext'],'transfereeexten':_0x33227b['transfertargetexten'],'transfereelinkedid':_0x33227b[_0x5cd0('0x26')]});}writeDB(_0x33227b);}catch(_0x3ab52f){utils[_0x5cd0('0x14')](util[_0x5cd0('0x4')](_0x5cd0('0x27'),_0x33227b[_0x5cd0('0x7')]),_0x3ab52f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index da6b300..e0bb6a7 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 _0xc132=['moment','http','../../config/logger','info','inspect','error','request','debug','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x3877b6,_0x34a518){var _0xf20535=function(_0x3c7b22){while(--_0x3c7b22){_0x3877b6['push'](_0x3877b6['shift']());}};_0xf20535(++_0x34a518);}(_0xc132,0x11e));var _0x2c13=function(_0x5b4d43,_0x3e8d89){_0x5b4d43=_0x5b4d43-0x0;var _0x520c11=_0xc132[_0x5b4d43];return _0x520c11;};'use strict';var BPromise=require(_0x2c13('0x0'));var jayson=require(_0x2c13('0x1'));var moment=require(_0x2c13('0x2'));var util=require('util');var client=jayson['client'][_0x2c13('0x3')]({'port':0x2329});var logger=require(_0x2c13('0x4'))('xdr');exports[_0x2c13('0x5')]=function(_0x58125a,_0x22d73e){logger[_0x2c13('0x5')](_0x58125a,_0x22d73e?util[_0x2c13('0x6')](_0x22d73e,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x41581e,_0x3bc603){logger['debug'](_0x41581e,_0x3bc603?util['inspect'](_0x3bc603,{'showHidden':![],'depth':null}):'');};exports[_0x2c13('0x7')]=function(_0x668941,_0x3733c5){logger[_0x2c13('0x7')](_0x668941,_0x3733c5?util[_0x2c13('0x6')](_0x3733c5,{'showHidden':![],'depth':null}):'');};exports[_0x2c13('0x8')]=function(_0xefebe4,_0xd7fef6){return client[_0x2c13('0x8')](_0xefebe4,{'body':_0xd7fef6})['then'](function(_0x4d3703){logger[_0x2c13('0x9')](_0x2c13('0xa'),_0xefebe4,_0x4d3703?util[_0x2c13('0x6')](_0x4d3703,{'showHidden':![],'depth':null}):'');})[_0x2c13('0xb')](function(_0x209403){logger[_0x2c13('0x7')]('[utils][request]\x20name:%s',_0xefebe4,_0x209403?util[_0x2c13('0x6')](_0x209403,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e4497){return client[_0x2c13('0x8')](_0x2c13('0xc'),{'options':{'raw':!![],'attributes':['id',_0x2c13('0xd'),'name',_0x2c13('0xe')],'where':_0x4e4497,'limit':0x1}})[_0x2c13('0xf')](function(_0x4d584d){logger[_0x2c13('0x9')](_0x2c13('0x10'),JSON[_0x2c13('0x11')](_0x4e4497),_0x4d584d?util[_0x2c13('0x6')](_0x4d584d,{'showHidden':![],'depth':null}):'');return _0x4d584d[_0x2c13('0x12')][_0x2c13('0x13')]?_0x4d584d[_0x2c13('0x12')][0x0]:null;});}exports[_0x2c13('0x14')]=function(_0x1569c5){return new BPromise(function(_0x119c8e,_0x230488){if(_0x1569c5){return getUser({'internal':_0x1569c5})[_0x2c13('0xf')](function(_0x4477f0){logger['info'](_0x2c13('0x15'),_0x1569c5,_0x4477f0?_0x2c13('0x16'):'notfound');return _0x119c8e(_0x4477f0);})[_0x2c13('0xb')](function(_0x7711c9){logger[_0x2c13('0x7')](_0x2c13('0x17'),_0x7711c9?util[_0x2c13('0x6')](_0x7711c9,{'showHidden':![],'depth':null}):'');return _0x119c8e(null);});}return _0x119c8e(null);});};exports[_0x2c13('0x18')]=function(_0x54ae7a){return new BPromise(function(_0x1f3a51,_0x60661e){if(_0x54ae7a){return getUser({'interface':_0x54ae7a})[_0x2c13('0xf')](function(_0x4d69cc){logger[_0x2c13('0x5')](_0x2c13('0x19'),_0x54ae7a,_0x4d69cc?_0x2c13('0x16'):'notfound');return _0x1f3a51(_0x4d69cc);})[_0x2c13('0xb')](function(_0x46c176){logger[_0x2c13('0x7')](_0x2c13('0x1a'),_0x46c176?util[_0x2c13('0x6')](_0x46c176,{'showHidden':![],'depth':null}):'');return _0x1f3a51(null);});}return _0x1f3a51(null);});};exports[_0x2c13('0x1b')]=function(_0x1f221f){return new BPromise(function(_0x16e51f,_0x2cc03f){if(_0x1f221f){return getUser({'name':_0x1f221f})[_0x2c13('0xf')](function(_0x300ca5){logger[_0x2c13('0x5')](_0x2c13('0x1c'),_0x1f221f,_0x300ca5?_0x2c13('0x16'):_0x2c13('0x1d'));return _0x16e51f(_0x300ca5);})[_0x2c13('0xb')](function(_0x4fe6e0){logger[_0x2c13('0x7')](_0x2c13('0x1e'),_0x4fe6e0?util['inspect'](_0x4fe6e0,{'showHidden':![],'depth':null}):'');return _0x16e51f(null);});}return _0x16e51f(null);});};exports[_0x2c13('0x1f')]=function(_0x1ce36a){return new BPromise(function(_0x14903c,_0x4e1204){if(_0x1ce36a){return client[_0x2c13('0x8')](_0x2c13('0x20'),{'options':{'raw':!![],'attributes':['id',_0x2c13('0x21'),'type','acw',_0x2c13('0x22')],'where':{'name':_0x1ce36a},'limit':0x1}})[_0x2c13('0xf')](function(_0x127d13){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x1ce36a,_0x127d13?util[_0x2c13('0x6')](_0x127d13,{'showHidden':![],'depth':null}):'');logger['info'](_0x2c13('0x23'),_0x1ce36a,_0x127d13?_0x2c13('0x16'):'notfound');return _0x14903c(_0x127d13['result'][_0x2c13('0x13')]?_0x127d13[_0x2c13('0x12')][0x0]:null);})[_0x2c13('0xb')](function(_0x364ad9){logger[_0x2c13('0x7')](_0x2c13('0x24'),_0x364ad9?util[_0x2c13('0x6')](_0x364ad9,{'showHidden':![],'depth':null}):'');return _0x14903c(null);});}return _0x14903c(null);});};exports[_0x2c13('0x25')]=function(_0x5b8d57,_0x13fa2e){return moment(_0x5b8d57)[_0x2c13('0x26')](_0x13fa2e,_0x2c13('0x27'))[_0x2c13('0x28')](_0x2c13('0x29'));};exports['subtractTime']=function(_0x362431,_0x395cfc){return moment(_0x362431)[_0x2c13('0x2a')](_0x395cfc,_0x2c13('0x27'))[_0x2c13('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2c13('0x2b')]=function(_0x4bb9b7,_0x431fa5){return moment(_0x4bb9b7)['diff'](moment(_0x431fa5),_0x2c13('0x27'));};exports[_0x2c13('0x2c')]=function(_0x54a11e,_0x275cdf){return parseInt(_0x54a11e,0xa)+parseInt(_0x275cdf,0xa);};exports[_0x2c13('0x2d')]=function(){return moment()[_0x2c13('0x28')](_0x2c13('0x29'));};exports['isAfter']=function(_0x2a495f,_0x290499){if(_0x290499){return moment(_0x2a495f)[_0x2c13('0x2e')](_0x290499);}return!![];};exports[_0x2c13('0x2f')]=function(_0x89b555,_0x2939ca){if(_0x2939ca){return moment(_0x89b555)[_0x2c13('0x2f')](_0x2939ca);}else if(_0x89b555){return!![];}return![];}; \ No newline at end of file +var _0x708c=['isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','name','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','catch','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','now','isAfter'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x708c,0x8b));var _0xc708=function(_0xe1868e,_0x330bc3){_0xe1868e=_0xe1868e-0x0;var _0x139e77=_0x708c[_0xe1868e];return _0x139e77;};'use strict';var BPromise=require(_0xc708('0x0'));var jayson=require(_0xc708('0x1'));var moment=require(_0xc708('0x2'));var util=require('util');var client=jayson[_0xc708('0x3')][_0xc708('0x4')]({'port':0x2329});var logger=require(_0xc708('0x5'))(_0xc708('0x6'));exports[_0xc708('0x7')]=function(_0x46d3b4,_0x56b4f3){logger[_0xc708('0x7')](_0x46d3b4,_0x56b4f3?util[_0xc708('0x8')](_0x56b4f3,{'showHidden':![],'depth':null}):'');};exports[_0xc708('0x9')]=function(_0x486de8,_0x1de7c6){logger[_0xc708('0x9')](_0x486de8,_0x1de7c6?util[_0xc708('0x8')](_0x1de7c6,{'showHidden':![],'depth':null}):'');};exports[_0xc708('0xa')]=function(_0x397b36,_0x27c9f9){logger[_0xc708('0xa')](_0x397b36,_0x27c9f9?util[_0xc708('0x8')](_0x27c9f9,{'showHidden':![],'depth':null}):'');};exports[_0xc708('0xb')]=function(_0x27d4c2,_0x458905){return client[_0xc708('0xb')](_0x27d4c2,{'body':_0x458905})[_0xc708('0xc')](function(_0x514e9a){logger[_0xc708('0x9')](_0xc708('0xd'),_0x27d4c2,_0x514e9a?util[_0xc708('0x8')](_0x514e9a,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1425c2){logger['error']('[utils][request]\x20name:%s',_0x27d4c2,_0x1425c2?util[_0xc708('0x8')](_0x1425c2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x545c64){return client[_0xc708('0xb')](_0xc708('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xc708('0xf'),'interface'],'where':_0x545c64,'limit':0x1}})['then'](function(_0x1814ff){logger[_0xc708('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xc708('0x10')](_0x545c64),_0x1814ff?util[_0xc708('0x8')](_0x1814ff,{'showHidden':![],'depth':null}):'');return _0x1814ff[_0xc708('0x11')][_0xc708('0x12')]?_0x1814ff[_0xc708('0x11')][0x0]:null;});}exports[_0xc708('0x13')]=function(_0x3341fc){return new BPromise(function(_0x5b11d4,_0xed720b){if(_0x3341fc){return getUser({'internal':_0x3341fc})[_0xc708('0xc')](function(_0x1c8388){logger[_0xc708('0x7')](_0xc708('0x14'),_0x3341fc,_0x1c8388?_0xc708('0x15'):'notfound');return _0x5b11d4(_0x1c8388);})['catch'](function(_0x354cd3){logger['error'](_0xc708('0x16'),_0x354cd3?util[_0xc708('0x8')](_0x354cd3,{'showHidden':![],'depth':null}):'');return _0x5b11d4(null);});}return _0x5b11d4(null);});};exports[_0xc708('0x17')]=function(_0x58910f){return new BPromise(function(_0x2df3d8,_0x41f5fa){if(_0x58910f){return getUser({'interface':_0x58910f})[_0xc708('0xc')](function(_0x5eff2f){logger[_0xc708('0x7')](_0xc708('0x18'),_0x58910f,_0x5eff2f?_0xc708('0x15'):_0xc708('0x19'));return _0x2df3d8(_0x5eff2f);})[_0xc708('0x1a')](function(_0x47191f){logger['error']('[utils][getUserByInterface]',_0x47191f?util[_0xc708('0x8')](_0x47191f,{'showHidden':![],'depth':null}):'');return _0x2df3d8(null);});}return _0x2df3d8(null);});};exports[_0xc708('0x1b')]=function(_0x28b7f5){return new BPromise(function(_0x33a611,_0x1b25ba){if(_0x28b7f5){return getUser({'name':_0x28b7f5})['then'](function(_0x360410){logger['info'](_0xc708('0x1c'),_0x28b7f5,_0x360410?_0xc708('0x15'):'notfound');return _0x33a611(_0x360410);})[_0xc708('0x1a')](function(_0x463d47){logger[_0xc708('0xa')](_0xc708('0x1d'),_0x463d47?util[_0xc708('0x8')](_0x463d47,{'showHidden':![],'depth':null}):'');return _0x33a611(null);});}return _0x33a611(null);});};exports[_0xc708('0x1e')]=function(_0x1142db){return new BPromise(function(_0x4cff56,_0x160543){if(_0x1142db){return client[_0xc708('0xb')](_0xc708('0x1f'),{'options':{'raw':!![],'attributes':['id','name',_0xc708('0x20'),_0xc708('0x21'),'acwTimeout'],'where':{'name':_0x1142db},'limit':0x1}})[_0xc708('0xc')](function(_0x754bc2){logger[_0xc708('0x9')](_0xc708('0x22'),_0x1142db,_0x754bc2?util['inspect'](_0x754bc2,{'showHidden':![],'depth':null}):'');logger[_0xc708('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1142db,_0x754bc2?_0xc708('0x15'):_0xc708('0x19'));return _0x4cff56(_0x754bc2['result']['length']?_0x754bc2[_0xc708('0x11')][0x0]:null);})[_0xc708('0x1a')](function(_0x3e8c14){logger[_0xc708('0xa')](_0xc708('0x23'),_0x3e8c14?util[_0xc708('0x8')](_0x3e8c14,{'showHidden':![],'depth':null}):'');return _0x4cff56(null);});}return _0x4cff56(null);});};exports[_0xc708('0x24')]=function(_0x356ed8,_0x74ff9e){return moment(_0x356ed8)['add'](_0x74ff9e,_0xc708('0x25'))[_0xc708('0x26')](_0xc708('0x27'));};exports[_0xc708('0x28')]=function(_0x38643e,_0x554b43){return moment(_0x38643e)['subtract'](_0x554b43,_0xc708('0x25'))[_0xc708('0x26')](_0xc708('0x27'));};exports[_0xc708('0x29')]=function(_0x51a715,_0x23c005){return moment(_0x51a715)[_0xc708('0x2a')](moment(_0x23c005),_0xc708('0x25'));};exports['sumTime']=function(_0x537429,_0x1fe8c7){return parseInt(_0x537429,0xa)+parseInt(_0x1fe8c7,0xa);};exports[_0xc708('0x2b')]=function(){return moment()[_0xc708('0x26')](_0xc708('0x27'));};exports[_0xc708('0x2c')]=function(_0x6714f3,_0x1dc328){if(_0x1dc328){return moment(_0x6714f3)['isAfter'](_0x1dc328);}return!![];};exports[_0xc708('0x2d')]=function(_0x176f00,_0x2df3bd){if(_0x2df3bd){return moment(_0x176f00)[_0xc708('0x2d')](_0x2df3bd);}else if(_0x176f00){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 4b9dd46..39db8bc 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 _0x72f6=['fileLogger','maskSensitiveData','/var','log','xcally','join','role','name','then','client','catch','user','no-user','error','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','responseTime','agent_name','test','setupLoggers','lodash','path','util','./loggers'];(function(_0x430c18,_0x21023c){var _0x2137fd=function(_0x4817b0){while(--_0x4817b0){_0x430c18['push'](_0x430c18['shift']());}};_0x2137fd(++_0x21023c);}(_0x72f6,0xc9));var _0x672f=function(_0x105ec5,_0x1f4555){_0x105ec5=_0x105ec5-0x0;var _0x490f72=_0x72f6[_0x105ec5];return _0x490f72;};var fs=require('fs-extra');var _=require(_0x672f('0x0'));var ewinston=require('express-winston');var path=require(_0x672f('0x1'));var util=require(_0x672f('0x2'));var fileLogger=require(_0x672f('0x3'))[_0x672f('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x672f('0x5')];function ClientSideLogger(){function _0x1f4f94(_0x5c7f5e){var _0x1ebe38=path['join'](_0x672f('0x6'),_0x672f('0x7'),_0x672f('0x8'));var _0x1ac0ba=path[_0x672f('0x9')]('client',_0x5c7f5e[_0x672f('0xa')]+'-'+_0x5c7f5e[_0x672f('0xb')]);return fs['ensureDir'](path['join'](_0x1ebe38,_0x1ac0ba))[_0x672f('0xc')](function(){var _0x4af09d=fileLogger(_0x672f('0xd'),path[_0x672f('0x9')](_0x1ebe38,_0x1ac0ba));return _0x4af09d;})[_0x672f('0xe')](function(_0x24784f){throw _0x24784f;});}this[_0x672f('0x7')]=function(_0x33dc38,_0x5c7c11,_0x592201,_0x10243d){return _0x1f4f94(_0x33dc38[_0x672f('0xf')])[_0x672f('0xc')](function(_0xa363bf){var _0x35c0cf=_0xa363bf[_0x5c7c11];return _0x35c0cf;})[_0x672f('0xc')](function(_0x2020c4){var _0x81d9c1=_0x33dc38[_0x672f('0xf')]?_0x33dc38[_0x672f('0xf')]['id']:_0x672f('0x10');var _0x55f720=_0x10243d['data'];var _0x1007c4=_0x10243d['timestamp'];var _0x303cbf=new Date(Number(_0x1007c4));return _0x2020c4(_0x81d9c1,_0x303cbf,_0x592201,_0x55f720);})[_0x672f('0xe')](function(_0x5c806e){fileLogger(_0x672f('0xd'))[_0x672f('0x11')](_0x5c806e);});};}function setupLoggers(_0x18145f){return new Promise(function(_0x33008e){var _0x2a4f85=new ClientSideLogger();var _0x487e3b=fileLogger('api');var _0x4f376d=fileLogger(_0x672f('0x12'));_0x18145f['set'](_0x672f('0x13'),_0x2a4f85);_0x18145f[_0x672f('0x14')](ewinston['logger']({'winstonInstance':_0x487e3b,'meta':![],'statusLevels':!![],'msg':function(_0x3fcea4,_0x1a9385){var _0x1d785a=_0x672f('0x15');if(!_[_0x672f('0x16')](_0x3fcea4[_0x672f('0x17')])){_0x1d785a+='\x20body=%s';var _0x2f741f=_0x3fcea4[_0x672f('0x17')];maskSensitiveData(_0x2f741f);}return safeTemplate(util[_0x672f('0x18')](_0x1d785a,_0x3fcea4[_0x672f('0x19')],_0x3fcea4[_0x672f('0x1a')][_0x672f('0x1b')]?_0x3fcea4['headers'][_0x672f('0x1b')]:_0x3fcea4[_0x672f('0x1c')][_0x672f('0x1d')]||_0x3fcea4['ip'],_0x3fcea4[_0x672f('0x1e')],_0x1a9385[_0x672f('0x1f')],_0x1a9385['responseTime'],_0x3fcea4[_0x672f('0xf')]?_0x3fcea4[_0x672f('0xf')]['id']:null,_0x3fcea4['user']?_0x3fcea4[_0x672f('0xf')][_0x672f('0xb')]:null,_0x3fcea4[_0x672f('0xf')]?_0x3fcea4[_0x672f('0xf')][_0x672f('0xa')]:null,_0x2f741f?util[_0x672f('0x20')](_0x2f741f,![],null):''));}}));_0x18145f['use'](ewinston[_0x672f('0x21')]({'winstonInstance':_0x4f376d,'meta':![],'statusLevels':!![],'msg':function(_0x2d2a98,_0x346139){var _0x3fc5fb=_0x672f('0x22');if(_0x2d2a98[_0x672f('0x17')]&&_0x2d2a98[_0x672f('0x17')][_0x672f('0x23')]&&_0x2d2a98[_0x672f('0x17')][_0x672f('0x24')]){_0x3fc5fb='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x672f('0x18')](_0x3fc5fb,_0x2d2a98[_0x672f('0x19')],_0x2d2a98['headers'][_0x672f('0x1b')]?_0x2d2a98['headers'][_0x672f('0x1b')]:_0x2d2a98[_0x672f('0x1c')][_0x672f('0x1d')]||_0x2d2a98['ip'],_0x2d2a98[_0x672f('0x1e')],_0x346139['statusCode'],_0x346139[_0x672f('0x25')],_0x2d2a98[_0x672f('0xf')]?_0x2d2a98['user']['id']:null,_0x2d2a98[_0x672f('0xf')]?_0x2d2a98[_0x672f('0xf')][_0x672f('0xb')]:null,_0x2d2a98[_0x672f('0xf')]?_0x2d2a98['user'][_0x672f('0xa')]:null,_0x2d2a98[_0x672f('0x17')]&&_0x2d2a98[_0x672f('0x17')][_0x672f('0x23')]?_0x2d2a98[_0x672f('0x17')][_0x672f('0x23')]:'other',_0x2d2a98['body']&&_0x2d2a98[_0x672f('0x17')][_0x672f('0x24')]?_0x2d2a98[_0x672f('0x17')][_0x672f('0x24')]:'',_0x2d2a98[_0x672f('0x17')]&&_0x2d2a98[_0x672f('0x17')][_0x672f('0x26')]?_0x2d2a98[_0x672f('0x17')][_0x672f('0x26')]:'');},'ignoreRoute':function(_0x3da375){var _0x304c71=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x304c71[_0x672f('0x27')](_0x3da375[_0x672f('0x1e')]);}}));return _0x33008e();});}exports[_0x672f('0x28')]=setupLoggers; \ No newline at end of file +var _0x8a35=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','fileLogger','./mask-sensitive-data','join','/var','log','xcally','client','name','then','catch','user','no-user','timestamp','api','auth','set','client-side-logger','use','logger','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','remoteAddress','url','responseTime','role','device'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x8a35,0x134));var _0x58a3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8a35[_0x167cc1];return _0x10bc4b;};var fs=require(_0x58a3('0x0'));var _=require('lodash');var ewinston=require(_0x58a3('0x1'));var path=require(_0x58a3('0x2'));var util=require(_0x58a3('0x3'));var fileLogger=require(_0x58a3('0x4'))[_0x58a3('0x5')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x58a3('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0xdfb0cc(_0x4ff96a){var _0x1b7d6d=path[_0x58a3('0x7')](_0x58a3('0x8'),_0x58a3('0x9'),_0x58a3('0xa'));var _0x52a6af=path[_0x58a3('0x7')](_0x58a3('0xb'),_0x4ff96a['role']+'-'+_0x4ff96a[_0x58a3('0xc')]);return fs['ensureDir'](path['join'](_0x1b7d6d,_0x52a6af))[_0x58a3('0xd')](function(){var _0x190778=fileLogger('client',path['join'](_0x1b7d6d,_0x52a6af));return _0x190778;})[_0x58a3('0xe')](function(_0x3551f8){throw _0x3551f8;});}this[_0x58a3('0x9')]=function(_0x2d5b7e,_0x5e3f37,_0x36860f,_0x290e2c){return _0xdfb0cc(_0x2d5b7e[_0x58a3('0xf')])[_0x58a3('0xd')](function(_0x18ae9a){var _0x57dd71=_0x18ae9a[_0x5e3f37];return _0x57dd71;})[_0x58a3('0xd')](function(_0x313295){var _0xb58dd4=_0x2d5b7e[_0x58a3('0xf')]?_0x2d5b7e[_0x58a3('0xf')]['id']:_0x58a3('0x10');var _0x35334b=_0x290e2c['data'];var _0x193e4e=_0x290e2c[_0x58a3('0x11')];var _0x34dd3a=new Date(Number(_0x193e4e));return _0x313295(_0xb58dd4,_0x34dd3a,_0x36860f,_0x35334b);})['catch'](function(_0x493513){fileLogger(_0x58a3('0xb'))['error'](_0x493513);});};}function setupLoggers(_0x5ae2b3){return new Promise(function(_0x41faf6){var _0xff2944=new ClientSideLogger();var _0x4bd0d6=fileLogger(_0x58a3('0x12'));var _0x96c58a=fileLogger(_0x58a3('0x13'));_0x5ae2b3[_0x58a3('0x14')](_0x58a3('0x15'),_0xff2944);_0x5ae2b3[_0x58a3('0x16')](ewinston[_0x58a3('0x17')]({'winstonInstance':_0x4bd0d6,'meta':![],'statusLevels':!![],'msg':function(_0x13f598,_0x5dd146){var _0xb9baf8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x58a3('0x18')](_0x13f598['body'])){_0xb9baf8+=_0x58a3('0x19');var _0x515b57=_0x13f598[_0x58a3('0x1a')];maskSensitiveData(_0x515b57);}return safeTemplate(util[_0x58a3('0x1b')](_0xb9baf8,_0x13f598[_0x58a3('0x1c')],_0x13f598[_0x58a3('0x1d')][_0x58a3('0x1e')]?_0x13f598[_0x58a3('0x1d')][_0x58a3('0x1e')]:_0x13f598['connection'][_0x58a3('0x1f')]||_0x13f598['ip'],_0x13f598[_0x58a3('0x20')],_0x5dd146['statusCode'],_0x5dd146[_0x58a3('0x21')],_0x13f598['user']?_0x13f598[_0x58a3('0xf')]['id']:null,_0x13f598['user']?_0x13f598[_0x58a3('0xf')][_0x58a3('0xc')]:null,_0x13f598[_0x58a3('0xf')]?_0x13f598['user'][_0x58a3('0x22')]:null,_0x515b57?util['inspect'](_0x515b57,![],null):''));}}));_0x5ae2b3[_0x58a3('0x16')](ewinston['logger']({'winstonInstance':_0x96c58a,'meta':![],'statusLevels':!![],'msg':function(_0x1ec543,_0x2dac45){var _0x57bc24='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x1ec543['body']&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x23')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x24')]){_0x57bc24=_0x58a3('0x25');}return util[_0x58a3('0x1b')](_0x57bc24,_0x1ec543['method'],_0x1ec543[_0x58a3('0x1d')][_0x58a3('0x1e')]?_0x1ec543[_0x58a3('0x1d')][_0x58a3('0x1e')]:_0x1ec543['connection']['remoteAddress']||_0x1ec543['ip'],_0x1ec543[_0x58a3('0x20')],_0x2dac45[_0x58a3('0x26')],_0x2dac45[_0x58a3('0x21')],_0x1ec543[_0x58a3('0xf')]?_0x1ec543[_0x58a3('0xf')]['id']:null,_0x1ec543[_0x58a3('0xf')]?_0x1ec543['user']['name']:null,_0x1ec543['user']?_0x1ec543[_0x58a3('0xf')]['role']:null,_0x1ec543[_0x58a3('0x1a')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x23')]?_0x1ec543['body'][_0x58a3('0x23')]:_0x58a3('0x27'),_0x1ec543[_0x58a3('0x1a')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x24')]?_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x24')]:'',_0x1ec543[_0x58a3('0x1a')]&&_0x1ec543[_0x58a3('0x1a')][_0x58a3('0x28')]?_0x1ec543[_0x58a3('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x28aacb){var _0x5c723e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5c723e[_0x58a3('0x29')](_0x28aacb[_0x58a3('0x20')]);}}));return _0x41faf6();});}exports[_0x58a3('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 9350d00..7d1a403 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb473=['bold\x20magenta','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','File','error','%s-%s','warn','consoleLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green'];(function(_0xd04c71,_0x316f16){var _0x907c86=function(_0x466b4b){while(--_0x466b4b){_0xd04c71['push'](_0xd04c71['shift']());}};_0x907c86(++_0x316f16);}(_0xb473,0x68));var _0x3b47=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xb473[_0xa30766];return _0x24e780;};'use strict';var path=require(_0x3b47('0x0'));var util=require(_0x3b47('0x1'));var moment=require(_0x3b47('0x2'));var winston=require(_0x3b47('0x3'));var config=require(_0x3b47('0x4'));var debugLevel=config['debugLevel']?config[_0x3b47('0x5')][_0x3b47('0x6')]():_0x3b47('0x7');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':_0x3b47('0x8'),'error':_0x3b47('0x9'),'warn':_0x3b47('0xa'),'info':'white','print':_0x3b47('0xb'),'success':_0x3b47('0xc'),'http':'gray','verbose':_0x3b47('0xd'),'debug':'bold\x20blue','silly':_0x3b47('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x450e6c,_0x2a99b4,_0x163815){var _0x271d38=_0x450e6c||_0x3b47('0xf');return path[_0x3b47('0x10')](_0x271d38,util[_0x3b47('0x11')](_0x3b47('0x12'),_0x2a99b4,_0x163815));}function formatter(_0x228561,_0xecab48){_0xecab48[_0x3b47('0x13')]=_0xecab48['message']['replace'](/@@{/g,_0x3b47('0x14'))['replace'](/}@@/g,_0x3b47('0x15'))['replace'](/@{/g,'{{')[_0x3b47('0x16')](/}@/g,'}}');return util[_0x3b47('0x11')](_0x3b47('0x17'),moment()[_0x3b47('0x11')](_0x3b47('0x18')),_0xecab48[_0x3b47('0x19')][_0x3b47('0x1a')](),_0x228561,_0xecab48['message']);}function fileFormat(_0x57e921,_0x40e445){_0x40e445[_0x3b47('0x13')]=_0x40e445['message'][_0x3b47('0x16')](/@@{/g,_0x3b47('0x14'))['replace'](/}@@/g,_0x3b47('0x15'))[_0x3b47('0x16')](/@{/g,'{{')[_0x3b47('0x16')](/}@/g,'}}');var _0x1504a2=_0x40e445['meta']&&Object[_0x3b47('0x1b')](_0x40e445[_0x3b47('0x1c')])['length']?'\x0a\x09'+JSON[_0x3b47('0x1d')](_0x40e445['meta']):'';return util[_0x3b47('0x11')](_0x3b47('0x1e'),moment()['format'](_0x3b47('0x18')),_0x40e445['level'][_0x3b47('0x1a')](),_0x57e921,_0x40e445[_0x3b47('0x13')],_0x1504a2);}function consoleLogger(){var _0x320c9d=new winston[(_0x3b47('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3b47('0x20'))][(_0x3b47('0x21'))]({'level':'warn','json':![],'formatter':function(_0x19838c){return formatter('',_0x19838c);}})]});return _0x320c9d;}function fileLogger(_0x4da8ad,_0x324b9e){var _0x1a17a3=new winston[(_0x3b47('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3b47('0x20'))][(_0x3b47('0x22'))]({'name':util[_0x3b47('0x11')]('%s-%s',_0x4da8ad,'error'),'filename':getLogFileName(_0x324b9e,_0x4da8ad,_0x3b47('0x23')),'level':_0x3b47('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe343bd){return fileFormat(_0x4da8ad,_0xe343bd);}}),new winston['transports'][(_0x3b47('0x22'))]({'name':util['format'](_0x3b47('0x24'),_0x4da8ad,debugLevel),'filename':getLogFileName(_0x324b9e,_0x4da8ad,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf0225e){return fileFormat(_0x4da8ad,_0xf0225e);}}),new winston['transports'][(_0x3b47('0x21'))]({'level':_0x3b47('0x25'),'json':![],'formatter':function(_0x4a53be){return fileFormat(_0x4da8ad,_0x4a53be);}})]});return _0x1a17a3;}exports[_0x3b47('0x26')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xfbc2=['meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','File','%s-%s','error','transports','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys'];(function(_0x57f243,_0x157b0a){var _0x3c2ac0=function(_0x2c49f4){while(--_0x2c49f4){_0x57f243['push'](_0x57f243['shift']());}};_0x3c2ac0(++_0x157b0a);}(_0xfbc2,0x18a));var _0x2fbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbc2[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x2fbc('0x0'));var util=require(_0x2fbc('0x1'));var moment=require('moment');var winston=require(_0x2fbc('0x2'));var config=require(_0x2fbc('0x3'));var debugLevel=config['debugLevel']?config[_0x2fbc('0x4')][_0x2fbc('0x5')]():_0x2fbc('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':_0x2fbc('0x7'),'error':_0x2fbc('0x8'),'warn':_0x2fbc('0x9'),'info':_0x2fbc('0xa'),'print':'bold\x20white','success':_0x2fbc('0xb'),'http':_0x2fbc('0xc'),'verbose':'bold\x20magenta','debug':_0x2fbc('0xd'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x35d2bb,_0x255ec3,_0x5188e){var _0x520dcf=_0x35d2bb||_0x2fbc('0xe');return path[_0x2fbc('0xf')](_0x520dcf,util[_0x2fbc('0x10')](_0x2fbc('0x11'),_0x255ec3,_0x5188e));}function formatter(_0x4ccea8,_0x5ac34d){_0x5ac34d[_0x2fbc('0x12')]=_0x5ac34d[_0x2fbc('0x12')][_0x2fbc('0x13')](/@@{/g,_0x2fbc('0x14'))[_0x2fbc('0x13')](/}@@/g,_0x2fbc('0x15'))[_0x2fbc('0x13')](/@{/g,'{{')[_0x2fbc('0x13')](/}@/g,'}}');return util[_0x2fbc('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x2fbc('0x10')](_0x2fbc('0x16')),_0x5ac34d[_0x2fbc('0x17')][_0x2fbc('0x18')](),_0x4ccea8,_0x5ac34d[_0x2fbc('0x12')]);}function fileFormat(_0x5a2ead,_0x4bff54){_0x4bff54[_0x2fbc('0x12')]=_0x4bff54['message']['replace'](/@@{/g,_0x2fbc('0x14'))['replace'](/}@@/g,_0x2fbc('0x15'))[_0x2fbc('0x13')](/@{/g,'{{')[_0x2fbc('0x13')](/}@/g,'}}');var _0x4dc081=_0x4bff54['meta']&&Object[_0x2fbc('0x19')](_0x4bff54[_0x2fbc('0x1a')])['length']?'\x0a\x09'+JSON['stringify'](_0x4bff54['meta']):'';return util[_0x2fbc('0x10')](_0x2fbc('0x1b'),moment()[_0x2fbc('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4bff54[_0x2fbc('0x17')][_0x2fbc('0x18')](),_0x5a2ead,_0x4bff54[_0x2fbc('0x12')],_0x4dc081);}function consoleLogger(){var _0x31f559=new winston[(_0x2fbc('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2fbc('0x1d'))]({'level':_0x2fbc('0x1e'),'json':![],'formatter':function(_0x10c5be){return formatter('',_0x10c5be);}})]});return _0x31f559;}function fileLogger(_0x247862,_0x1ff087){var _0x1c4861=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2fbc('0x1f'))]({'name':util[_0x2fbc('0x10')](_0x2fbc('0x20'),_0x247862,'error'),'filename':getLogFileName(_0x1ff087,_0x247862,_0x2fbc('0x21')),'level':_0x2fbc('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47384d){return fileFormat(_0x247862,_0x47384d);}}),new winston[(_0x2fbc('0x22'))][(_0x2fbc('0x1f'))]({'name':util['format'](_0x2fbc('0x20'),_0x247862,debugLevel),'filename':getLogFileName(_0x1ff087,_0x247862,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18d1ab){return fileFormat(_0x247862,_0x18d1ab);}}),new winston[(_0x2fbc('0x22'))][(_0x2fbc('0x1d'))]({'level':_0x2fbc('0x1e'),'json':![],'formatter':function(_0x33204c){return fileFormat(_0x247862,_0x33204c);}})]});return _0x1c4861;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 4fb529c..851ceba 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 _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x1967,0x173));var _0x7196=function(_0x36c3a3,_0x4f8ab4){_0x36c3a3=_0x36c3a3-0x0;var _0x3f5751=_0x1967[_0x36c3a3];return _0x3f5751;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0xd4cd29,_0x54f4ae){var _0x79e8f5=function(_0x533ebf){while(--_0x533ebf){_0xd4cd29['push'](_0xd4cd29['shift']());}};_0x79e8f5(++_0x54f4ae);}(_0x1261,0x144));var _0x1126=function(_0x5d6448,_0x53522f){_0x5d6448=_0x5d6448-0x0;var _0x58c195=_0x1261[_0x5d6448];return _0x58c195;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index fd0a0c3..ea1ce74 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 _0x4213=['{\x20{\x20','\x20}\x20}','string','isArray','isPlainObject','keys','reduce','exports','safeTemplate','lodash'];(function(_0x1f860d,_0x28a70d){var _0x3bea61=function(_0x512308){while(--_0x512308){_0x1f860d['push'](_0x1f860d['shift']());}};_0x3bea61(++_0x28a70d);}(_0x4213,0x77));var _0x3421=function(_0x204931,_0x53e846){_0x204931=_0x204931-0x0;var _0x9d95b8=_0x4213[_0x204931];return _0x9d95b8;};var _=require(_0x3421('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x445ef6){return _0x445ef6==='{{'?_0x3421('0x1'):_0x3421('0x2');}function safeTemplate(_0x2613b6){var _0x153f3a=_0x2613b6;if(typeof _0x2613b6===_0x3421('0x3')){_0x153f3a=_0x2613b6['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3421('0x4')](_0x2613b6)){_0x153f3a=_0x2613b6['map'](function(_0x459c5e){return safeTemplate(_0x459c5e);});}else if(_[_0x3421('0x5')](_0x2613b6)){_0x153f3a=Object[_0x3421('0x6')](_0x2613b6)[_0x3421('0x7')](function(_0x5469d8,_0x50e464){_0x5469d8[_0x50e464]=safeTemplate(_0x2613b6[_0x50e464]);return _0x5469d8;},{});}return _0x153f3a;}module[_0x3421('0x8')][_0x3421('0x9')]=safeTemplate; \ No newline at end of file +var _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2032,0xd9));var _0x2203=function(_0x251b6c,_0xf1a210){_0x251b6c=_0x251b6c-0x0;var _0x1781fb=_0x2032[_0x251b6c];return _0x1781fb;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file